From: Andrea Amorese Date: Fri, 26 Nov 2021 13:49:48 +0000 (+0100) Subject: Built motion from commit 0b90e591.|2.5.33 X-Git-Url: http://repos.xcallymotion.com/base//%22api/fax/attachments/%7B%7BfaxAttachment.id%7D%7D/%22?a=commitdiff_plain;h=2c4260b5ee18c04e9ab0b3b3e6d2a75dfee71c24;p=motion2.git Built motion from commit 0b90e591.|2.5.33 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 065097a..f0697a7 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-11-26T13:23:55.785Z", + "time": "2021-11-26T13:39:26.592Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 4c74801..6405e0c 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-11-26T13:23:55.785Z", + "time": "2021-11-26T13:39:26.592Z", "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 05e90b6..f4021de 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 _0x8349=['exports','VIRTUAL','getDataValue','action','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','STRING','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize'];(function(_0x245728,_0x1e8ca4){var _0x1be470=function(_0x580fce){while(--_0x580fce){_0x245728['push'](_0x245728['shift']());}};_0x1be470(++_0x1e8ca4);}(_0x8349,0x142));var _0x9834=function(_0x4da28f,_0x164324){_0x4da28f=_0x4da28f-0x0;var _0xe49192=_0x8349[_0x4da28f];return _0xe49192;};'use strict';var Sequelize=require(_0x9834('0x0'));module[_0x9834('0x1')]={'name':{'type':Sequelize[_0x9834('0x2')],'get':function(_0x35b192){return this[_0x9834('0x3')](_0x9834('0x4'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x9834('0x5'),_0x9834('0x6'),_0x9834('0x7'),_0x9834('0x8'),_0x9834('0x9'),_0x9834('0xa'),_0x9834('0xb'),_0x9834('0xc')]],'msg':_0x9834('0xd')}},'comment':_0x9834('0xd')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x9834('0xe')},'data2':{'type':Sequelize[_0x9834('0xf')](0x1000),'comment':_0x9834('0x10')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x9834('0x11')},'data4':{'type':Sequelize[_0x9834('0xf')](0x1000)},'data5':{'type':Sequelize[_0x9834('0xf')](0x1000)},'data6':{'type':Sequelize[_0x9834('0xf')]},'data7':{'type':Sequelize[_0x9834('0x12')]}}; \ No newline at end of file +var _0xca66=['contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','exports','VIRTUAL','action','STRING'];(function(_0x3c4f93,_0x24be5c){var _0x56d097=function(_0x30ad6e){while(--_0x30ad6e){_0x3c4f93['push'](_0x3c4f93['shift']());}};_0x56d097(++_0x24be5c);}(_0xca66,0x10b));var _0x6ca6=function(_0x2920a5,_0x455716){_0x2920a5=_0x2920a5-0x0;var _0x1bfa23=_0xca66[_0x2920a5];return _0x1bfa23;};'use strict';var Sequelize=require(_0x6ca6('0x0'));module[_0x6ca6('0x1')]={'name':{'type':Sequelize[_0x6ca6('0x2')],'get':function(_0x2f31dc){return this['getDataValue'](_0x6ca6('0x3'));}},'action':{'type':Sequelize[_0x6ca6('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x6ca6('0x5'),_0x6ca6('0x6'),_0x6ca6('0x7'),_0x6ca6('0x8'),_0x6ca6('0x9'),_0x6ca6('0xa'),_0x6ca6('0xb'),_0x6ca6('0xc')]],'msg':_0x6ca6('0xd')}},'comment':_0x6ca6('0xd')},'data1':{'type':Sequelize[_0x6ca6('0x4')](0x1000),'comment':_0x6ca6('0xe')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':'integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]'},'data3':{'type':Sequelize[_0x6ca6('0x4')](0x1000),'comment':_0x6ca6('0xf')},'data4':{'type':Sequelize[_0x6ca6('0x4')](0x1000)},'data5':{'type':Sequelize[_0x6ca6('0x4')](0x1000)},'data6':{'type':Sequelize[_0x6ca6('0x4')]},'data7':{'type':Sequelize[_0x6ca6('0x10')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 814cd17..3c0753e 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 _0x58a8=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','error','stack','name','update','Action','find','params','catch','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x5192de,_0x4e91cd){var _0x4e287e=function(_0x3639bc){while(--_0x3639bc){_0x5192de['push'](_0x5192de['shift']());}};_0x4e287e(++_0x4e91cd);}(_0x58a8,0x1e7));var _0x858a=function(_0x211dba,_0x487d76){_0x211dba=_0x211dba-0x0;var _0x217af2=_0x58a8[_0x211dba];return _0x217af2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x858a('0x0'));var zipdir=require(_0x858a('0x1'));var jsonpatch=require(_0x858a('0x2'));var rp=require(_0x858a('0x3'));var moment=require(_0x858a('0x4'));var BPromise=require(_0x858a('0x5'));var Mustache=require(_0x858a('0x6'));var util=require(_0x858a('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x858a('0x8'));var fs=require('fs');var fs_extra=require(_0x858a('0x9'));var _=require(_0x858a('0xa'));var squel=require(_0x858a('0xb'));var crypto=require(_0x858a('0xc'));var jsforce=require(_0x858a('0xd'));var deskjs=require(_0x858a('0xe'));var toCsv=require(_0x858a('0xf'));var querystring=require('querystring');var Papa=require(_0x858a('0x10'));var Redis=require(_0x858a('0x11'));var authService=require(_0x858a('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x858a('0x13'));var hardwareService=require(_0x858a('0x14'));var logger=require(_0x858a('0x15'))(_0x858a('0x16'));var utils=require('../../config/utils');var config=require(_0x858a('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x58399f,_0x4766c8){_0x4766c8=_0x4766c8||0xcc;return function(_0x358d21){if(_0x358d21){return _0x58399f['sendStatus'](_0x4766c8);}return _0x58399f[_0x858a('0x18')](_0x4766c8)[_0x858a('0x19')]();};}function respondWithResult(_0x28e222,_0x366d25){_0x366d25=_0x366d25||0xc8;return function(_0x13ff8c){if(_0x13ff8c){return _0x28e222[_0x858a('0x18')](_0x366d25)[_0x858a('0x1a')](_0x13ff8c);}};}function respondWithFilteredResult(_0x160c3c,_0x464cb7){return function(_0xb45d60){if(_0xb45d60){var _0x19f2df=typeof _0x464cb7[_0x858a('0x1b')]===_0x858a('0x1c')&&typeof _0x464cb7[_0x858a('0x1d')]===_0x858a('0x1c');var _0x47c416=_0xb45d60[_0x858a('0x1e')];var _0xda2f5d=_0x19f2df?0x0:_0x464cb7[_0x858a('0x1b')];var _0x18b6c7=_0x19f2df?_0xb45d60[_0x858a('0x1e')]:_0x464cb7[_0x858a('0x1b')]+_0x464cb7['limit'];var _0x213927;if(_0x18b6c7>=_0x47c416){_0x18b6c7=_0x47c416;_0x213927=0xc8;}else{_0x213927=0xce;}_0x160c3c[_0x858a('0x18')](_0x213927);return _0x160c3c[_0x858a('0x1f')](_0x858a('0x20'),_0xda2f5d+'-'+_0x18b6c7+'/'+_0x47c416)[_0x858a('0x1a')](_0xb45d60);}return null;};}function patchUpdates(_0x3a35e9){return function(_0x41e911){try{jsonpatch[_0x858a('0x21')](_0x41e911,_0x3a35e9,!![]);}catch(_0x98ebf6){return BPromise[_0x858a('0x22')](_0x98ebf6);}return _0x41e911['save']();};}function saveUpdates(_0x2b79f7,_0x14ef4a){return function(_0x4201cb){if(_0x4201cb){return _0x4201cb['update'](_0x2b79f7)[_0x858a('0x23')](function(_0x5f3011){return _0x5f3011;});}return null;};}function removeEntity(_0x97cbe8,_0x3824d3){return function(_0x45de68){if(_0x45de68){return _0x45de68['destroy']()[_0x858a('0x23')](function(){_0x97cbe8['status'](0xcc)[_0x858a('0x19')]();});}};}function handleEntityNotFound(_0x37882e,_0x11a7a1){return function(_0x3173e5){if(!_0x3173e5){_0x37882e['sendStatus'](0x194);}return _0x3173e5;};}function handleError(_0x44f500,_0x2596ea){_0x2596ea=_0x2596ea||0x1f4;return function(_0x21e1cf){logger[_0x858a('0x24')](_0x21e1cf[_0x858a('0x25')]);if(_0x21e1cf[_0x858a('0x26')]){delete _0x21e1cf[_0x858a('0x26')];}_0x44f500[_0x858a('0x18')](_0x2596ea)['send'](_0x21e1cf);};}exports[_0x858a('0x27')]=function(_0x33b459,_0x2f66d9){if(_0x33b459['body']['id']){delete _0x33b459['body']['id'];}return db[_0x858a('0x28')][_0x858a('0x29')]({'where':{'id':_0x33b459[_0x858a('0x2a')]['id']}})[_0x858a('0x23')](handleEntityNotFound(_0x2f66d9,null))['then'](saveUpdates(_0x33b459['body'],null))[_0x858a('0x23')](respondWithResult(_0x2f66d9,null))[_0x858a('0x2b')](handleError(_0x2f66d9,null));};exports[_0x858a('0x2c')]=function(_0x57a61f,_0x48880a){return db[_0x858a('0x28')]['find']({'where':{'id':_0x57a61f['params']['id']}})[_0x858a('0x23')](handleEntityNotFound(_0x48880a,null))[_0x858a('0x23')](removeEntity(_0x48880a,null))[_0x858a('0x2b')](handleError(_0x48880a,null));}; \ No newline at end of file +var _0xb1c5=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','error','stack','name','body','Action','find','params','catch','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x103bb1,_0x55583e){var _0x37c7c0=function(_0x2c0c85){while(--_0x2c0c85){_0x103bb1['push'](_0x103bb1['shift']());}};_0x37c7c0(++_0x55583e);}(_0xb1c5,0x1c9));var _0x5b1c=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0xb1c5[_0x2070da];return _0x4f9fe1;};'use strict';var emlformat=require(_0x5b1c('0x0'));var rimraf=require(_0x5b1c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5b1c('0x2'));var rp=require(_0x5b1c('0x3'));var moment=require(_0x5b1c('0x4'));var BPromise=require(_0x5b1c('0x5'));var Mustache=require(_0x5b1c('0x6'));var util=require(_0x5b1c('0x7'));var path=require(_0x5b1c('0x8'));var sox=require(_0x5b1c('0x9'));var csv=require(_0x5b1c('0xa'));var ejs=require(_0x5b1c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5b1c('0xc'));var squel=require(_0x5b1c('0xd'));var crypto=require('crypto');var jsforce=require(_0x5b1c('0xe'));var deskjs=require(_0x5b1c('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5b1c('0x10'));var Redis=require(_0x5b1c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5b1c('0x12'));var as=require(_0x5b1c('0x13'));var hardwareService=require(_0x5b1c('0x14'));var logger=require(_0x5b1c('0x15'))(_0x5b1c('0x16'));var utils=require('../../config/utils');var config=require(_0x5b1c('0x17'));var licenseUtil=require(_0x5b1c('0x18'));var db=require(_0x5b1c('0x19'))['db'];function respondWithStatusCode(_0x4119c9,_0x130b44){_0x130b44=_0x130b44||0xcc;return function(_0x5a3351){if(_0x5a3351){return _0x4119c9[_0x5b1c('0x1a')](_0x130b44);}return _0x4119c9[_0x5b1c('0x1b')](_0x130b44)[_0x5b1c('0x1c')]();};}function respondWithResult(_0x233ffa,_0x2ae4ca){_0x2ae4ca=_0x2ae4ca||0xc8;return function(_0x1b1733){if(_0x1b1733){return _0x233ffa[_0x5b1c('0x1b')](_0x2ae4ca)[_0x5b1c('0x1d')](_0x1b1733);}};}function respondWithFilteredResult(_0x1758fb,_0x1794e8){return function(_0xd17b73){if(_0xd17b73){var _0x462d27=typeof _0x1794e8[_0x5b1c('0x1e')]===_0x5b1c('0x1f')&&typeof _0x1794e8[_0x5b1c('0x20')]===_0x5b1c('0x1f');var _0x1cce58=_0xd17b73[_0x5b1c('0x21')];var _0x48e196=_0x462d27?0x0:_0x1794e8['offset'];var _0x274df8=_0x462d27?_0xd17b73['count']:_0x1794e8[_0x5b1c('0x1e')]+_0x1794e8[_0x5b1c('0x20')];var _0x178bdb;if(_0x274df8>=_0x1cce58){_0x274df8=_0x1cce58;_0x178bdb=0xc8;}else{_0x178bdb=0xce;}_0x1758fb[_0x5b1c('0x1b')](_0x178bdb);return _0x1758fb['set'](_0x5b1c('0x22'),_0x48e196+'-'+_0x274df8+'/'+_0x1cce58)[_0x5b1c('0x1d')](_0xd17b73);}return null;};}function patchUpdates(_0x3e32e0){return function(_0x45df0e){try{jsonpatch['apply'](_0x45df0e,_0x3e32e0,!![]);}catch(_0x235a8d){return BPromise[_0x5b1c('0x23')](_0x235a8d);}return _0x45df0e[_0x5b1c('0x24')]();};}function saveUpdates(_0x6f02bb,_0x2ae196){return function(_0x2996fa){if(_0x2996fa){return _0x2996fa[_0x5b1c('0x25')](_0x6f02bb)[_0x5b1c('0x26')](function(_0x340a3e){return _0x340a3e;});}return null;};}function removeEntity(_0x24c3da,_0x1183e1){return function(_0x139c8a){if(_0x139c8a){return _0x139c8a[_0x5b1c('0x27')]()['then'](function(){_0x24c3da[_0x5b1c('0x1b')](0xcc)[_0x5b1c('0x1c')]();});}};}function handleEntityNotFound(_0x29ae72,_0x39e477){return function(_0x2312cf){if(!_0x2312cf){_0x29ae72[_0x5b1c('0x1a')](0x194);}return _0x2312cf;};}function handleError(_0x505991,_0x2dcc08){_0x2dcc08=_0x2dcc08||0x1f4;return function(_0x1a86f9){logger[_0x5b1c('0x28')](_0x1a86f9[_0x5b1c('0x29')]);if(_0x1a86f9[_0x5b1c('0x2a')]){delete _0x1a86f9[_0x5b1c('0x2a')];}_0x505991['status'](_0x2dcc08)['send'](_0x1a86f9);};}exports['update']=function(_0x479a59,_0x5e49bc){if(_0x479a59[_0x5b1c('0x2b')]['id']){delete _0x479a59[_0x5b1c('0x2b')]['id'];}return db[_0x5b1c('0x2c')][_0x5b1c('0x2d')]({'where':{'id':_0x479a59[_0x5b1c('0x2e')]['id']}})['then'](handleEntityNotFound(_0x5e49bc,null))[_0x5b1c('0x26')](saveUpdates(_0x479a59['body'],null))['then'](respondWithResult(_0x5e49bc,null))['catch'](handleError(_0x5e49bc,null));};exports['destroy']=function(_0x313410,_0x574b13){return db[_0x5b1c('0x2c')][_0x5b1c('0x2d')]({'where':{'id':_0x313410[_0x5b1c('0x2e')]['id']}})[_0x5b1c('0x26')](handleEntityNotFound(_0x574b13,null))[_0x5b1c('0x26')](removeEntity(_0x574b13,null))[_0x5b1c('0x2f')](handleError(_0x574b13,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 820c142..a19dfae 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 _0x342e=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./action.attributes','exports','Action','tools_actions','lodash'];(function(_0x30abff,_0x5f2c5f){var _0x4c571e=function(_0x43de9a){while(--_0x43de9a){_0x30abff['push'](_0x30abff['shift']());}};_0x4c571e(++_0x5f2c5f);}(_0x342e,0xa8));var _0xe342=function(_0x3f2a90,_0x50baf1){_0x3f2a90=_0x3f2a90-0x0;var _0xb46279=_0x342e[_0x3f2a90];return _0xb46279;};'use strict';var _=require(_0xe342('0x0'));var util=require(_0xe342('0x1'));var logger=require(_0xe342('0x2'))(_0xe342('0x3'));var moment=require(_0xe342('0x4'));var BPromise=require(_0xe342('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe342('0x6'));var rimraf=require(_0xe342('0x7'));var config=require(_0xe342('0x8'));var attributes=require(_0xe342('0x9'));module[_0xe342('0xa')]=function(_0xe4cc3a,_0x5b8cd4){return _0xe4cc3a['define'](_0xe342('0xb'),attributes,{'tableName':_0xe342('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x38c7=['exports','define','Action','tools_actions','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./action.attributes'];(function(_0x2d460c,_0x4f08c0){var _0xf6fc4c=function(_0x4fb81c){while(--_0x4fb81c){_0x2d460c['push'](_0x2d460c['shift']());}};_0xf6fc4c(++_0x4f08c0);}(_0x38c7,0x88));var _0x738c=function(_0x34f11f,_0x137c32){_0x34f11f=_0x34f11f-0x0;var _0x1a09f7=_0x38c7[_0x34f11f];return _0x1a09f7;};'use strict';var _=require(_0x738c('0x0'));var util=require(_0x738c('0x1'));var logger=require(_0x738c('0x2'))(_0x738c('0x3'));var moment=require('moment');var BPromise=require(_0x738c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x738c('0x5'));var rimraf=require('rimraf');var config=require(_0x738c('0x6'));var attributes=require(_0x738c('0x7'));module[_0x738c('0x8')]=function(_0x1bec61,_0x572da0){return _0x1bec61[_0x738c('0x9')](_0x738c('0xa'),attributes,{'tableName':_0x738c('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 c4870d7..e3ffa13 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 _0x5fc3=['../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','message','Action,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x403568,_0x3eb985){var _0x557ed4=function(_0x259521){while(--_0x259521){_0x403568['push'](_0x403568['shift']());}};_0x557ed4(++_0x3eb985);}(_0x5fc3,0xa8));var _0x35fc=function(_0x466bc5,_0x3a0f2a){_0x466bc5=_0x466bc5-0x0;var _0x138952=_0x5fc3[_0x466bc5];return _0x138952;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('Action,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('Action,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('Action,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});} \ No newline at end of file +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(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x53ec,0x192));var _0xc53e=function(_0x2db3ce,_0x360607){_0x2db3ce=_0x2db3ce-0x0;var _0x4f45ec=_0x53ec[_0x2db3ce];return _0x4f45ec;};'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 diff --git a/server/api/action/index.js b/server/api/action/index.js index 7810636..9077f94 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 _0xcd65=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','isAuthenticated','update','delete','/:id','exports','util','path','connect-timeout','express'];(function(_0x32eef2,_0x5cf5e2){var _0x114321=function(_0x27c38a){while(--_0x27c38a){_0x32eef2['push'](_0x32eef2['shift']());}};_0x114321(++_0x5cf5e2);}(_0xcd65,0x128));var _0x5cd6=function(_0x323419,_0x2a6172){_0x323419=_0x323419-0x0;var _0x4c0be7=_0xcd65[_0x323419];return _0x4c0be7;};'use strict';var multer=require('multer');var util=require(_0x5cd6('0x0'));var path=require(_0x5cd6('0x1'));var timeout=require(_0x5cd6('0x2'));var express=require(_0x5cd6('0x3'));var router=express['Router']();var fs_extra=require(_0x5cd6('0x4'));var auth=require(_0x5cd6('0x5'));var interaction=require(_0x5cd6('0x6'));var config=require(_0x5cd6('0x7'));var controller=require(_0x5cd6('0x8'));router[_0x5cd6('0x9')]('/:id',auth[_0x5cd6('0xa')](),controller[_0x5cd6('0xb')]);router[_0x5cd6('0xc')](_0x5cd6('0xd'),auth[_0x5cd6('0xa')](),controller['destroy']);module[_0x5cd6('0xe')]=router; \ No newline at end of file +var _0xf705=['./action.controller','update','delete','isAuthenticated','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x4c4083,_0x11a683){var _0x31d635=function(_0x38d5f1){while(--_0x38d5f1){_0x4c4083['push'](_0x4c4083['shift']());}};_0x31d635(++_0x11a683);}(_0xf705,0xef));var _0x5f70=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xf705[_0x8c43de];return _0xa6591b;};'use strict';var multer=require(_0x5f70('0x0'));var util=require(_0x5f70('0x1'));var path=require('path');var timeout=require(_0x5f70('0x2'));var express=require(_0x5f70('0x3'));var router=express[_0x5f70('0x4')]();var fs_extra=require(_0x5f70('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5f70('0x6'));var config=require(_0x5f70('0x7'));var controller=require(_0x5f70('0x8'));router['put']('/:id',auth['isAuthenticated'](),controller[_0x5f70('0x9')]);router[_0x5f70('0xa')]('/:id',auth[_0x5f70('0xb')](),controller[_0x5f70('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 7f161c1..e63a015 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 _0x2eb2=['TEXT','exports','STRING'];(function(_0x3058b8,_0x5e12e1){var _0x282a80=function(_0x49bf6c){while(--_0x49bf6c){_0x3058b8['push'](_0x3058b8['shift']());}};_0x282a80(++_0x5e12e1);}(_0x2eb2,0x19f));var _0x22eb=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x2eb2[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require('sequelize');module[_0x22eb('0x0')]={'name':{'type':Sequelize[_0x22eb('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x22eb('0x1')]},'parent':{'type':Sequelize[_0x22eb('0x1')]},'table':{'type':Sequelize[_0x22eb('0x1')]},'conditions':{'type':Sequelize[_0x22eb('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x71ab=['TEXT','exports','STRING'];(function(_0x27a94f,_0x49bbf1){var _0x26c834=function(_0x20c7e4){while(--_0x20c7e4){_0x27a94f['push'](_0x27a94f['shift']());}};_0x26c834(++_0x49bbf1);}(_0x71ab,0x64));var _0xb71a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x71ab[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0xb71a('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xb71a('0x1')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0xb71a('0x1')]},'conditions':{'type':Sequelize[_0xb71a('0x2')]},'joins':{'type':Sequelize[_0xb71a('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 17931b4..6905afa 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 _0x9ed0=['getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','select','from','table','MetricId','metric','function','replace','format','orderBy','DESC','alias','joins','parse','includes','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','clone','toString','sequelize','QueryTypes','SELECT','left_join','AVG(%s)','IS\x20NULL','operator','Sequelize','groupBy','web','%s-%s.%s','output','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','../../components/export/','../../files/reports','savename','COUNT(*)','count','run','runReport','IS\x20NOT\x20EMPTY','keyBy','Limited\x20Query:','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','end','status','json','offset','undefined','limit','set','Content-Range','reject','save','then','get','CustomReports','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','field','condition','value'];(function(_0x119b4b,_0x322a87){var _0x2ca4d5=function(_0x45a93e){while(--_0x45a93e){_0x119b4b['push'](_0x119b4b['shift']());}};_0x2ca4d5(++_0x322a87);}(_0x9ed0,0xe1));var _0x09ed=function(_0x1e6aa7,_0x3282c6){_0x1e6aa7=_0x1e6aa7-0x0;var _0x5f20c3=_0x9ed0[_0x1e6aa7];return _0x5f20c3;};'use strict';var emlformat=require(_0x09ed('0x0'));var rimraf=require(_0x09ed('0x1'));var zipdir=require(_0x09ed('0x2'));var jsonpatch=require(_0x09ed('0x3'));var rp=require(_0x09ed('0x4'));var moment=require(_0x09ed('0x5'));var BPromise=require(_0x09ed('0x6'));var Mustache=require(_0x09ed('0x7'));var util=require('util');var path=require(_0x09ed('0x8'));var sox=require(_0x09ed('0x9'));var csv=require(_0x09ed('0xa'));var ejs=require(_0x09ed('0xb'));var fs=require('fs');var fs_extra=require(_0x09ed('0xc'));var _=require(_0x09ed('0xd'));var squel=require(_0x09ed('0xe'));var crypto=require(_0x09ed('0xf'));var jsforce=require(_0x09ed('0x10'));var deskjs=require(_0x09ed('0x11'));var toCsv=require(_0x09ed('0xa'));var querystring=require('querystring');var Papa=require(_0x09ed('0x12'));var Redis=require(_0x09ed('0x13'));var authService=require(_0x09ed('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x09ed('0x15'));var hardwareService=require(_0x09ed('0x16'));var logger=require(_0x09ed('0x17'))(_0x09ed('0x18'));var utils=require('../../config/utils');var config=require(_0x09ed('0x19'));var licenseUtil=require(_0x09ed('0x1a'));var db=require(_0x09ed('0x1b'))['db'];var dbH=require(_0x09ed('0x1b'))[_0x09ed('0x1c')];function respondWithStatusCode(_0x255179,_0x443466){_0x443466=_0x443466||0xcc;return function(_0x4c0cb7){if(_0x4c0cb7){return _0x255179['sendStatus'](_0x443466);}return _0x255179['status'](_0x443466)[_0x09ed('0x1d')]();};}function respondWithResult(_0x320d4b,_0x50c796){_0x50c796=_0x50c796||0xc8;return function(_0x4b41d5){if(_0x4b41d5){return _0x320d4b[_0x09ed('0x1e')](_0x50c796)[_0x09ed('0x1f')](_0x4b41d5);}};}function respondWithFilteredResult(_0x5a2786,_0x5de4da){return function(_0x43d212){if(_0x43d212){var _0x4df999=typeof _0x5de4da[_0x09ed('0x20')]===_0x09ed('0x21')&&typeof _0x5de4da[_0x09ed('0x22')]===_0x09ed('0x21');var _0x262daa=_0x43d212['count'];var _0x257007=_0x4df999?0x0:_0x5de4da['offset'];var _0x2effe0=_0x4df999?_0x43d212['count']:_0x5de4da[_0x09ed('0x20')]+_0x5de4da[_0x09ed('0x22')];var _0x1eec0e;if(_0x2effe0>=_0x262daa){_0x2effe0=_0x262daa;_0x1eec0e=0xc8;}else{_0x1eec0e=0xce;}_0x5a2786['status'](_0x1eec0e);return _0x5a2786[_0x09ed('0x23')](_0x09ed('0x24'),_0x257007+'-'+_0x2effe0+'/'+_0x262daa)[_0x09ed('0x1f')](_0x43d212);}return null;};}function patchUpdates(_0x27e440){return function(_0x477c4c){try{jsonpatch['apply'](_0x477c4c,_0x27e440,!![]);}catch(_0x21d632){return BPromise[_0x09ed('0x25')](_0x21d632);}return _0x477c4c[_0x09ed('0x26')]();};}function saveUpdates(_0x201963,_0x1db8d0){return function(_0x2a1b72){if(_0x2a1b72){return _0x2a1b72['update'](_0x201963)['then'](function(_0x24a05e){return _0x24a05e;});}return null;};}function removeEntity(_0xe9859d,_0x5248bc){return function(_0x8634c3){if(_0x8634c3){return _0x8634c3['destroy']()[_0x09ed('0x27')](function(){var _0x2f10e1=_0x8634c3[_0x09ed('0x28')]({'plain':!![]});var _0x3a4ed3=_0x09ed('0x29');return db[_0x09ed('0x2a')][_0x09ed('0x2b')]({'where':{'type':_0x3a4ed3,'resourceId':_0x2f10e1['id']}})[_0x09ed('0x27')](function(){return _0x8634c3;});})[_0x09ed('0x27')](function(){_0xe9859d[_0x09ed('0x1e')](0xcc)[_0x09ed('0x1d')]();});}};}function handleEntityNotFound(_0x4171df,_0x3bb7ad){return function(_0x24d820){if(!_0x24d820){_0x4171df[_0x09ed('0x2c')](0x194);}return _0x24d820;};}function handleError(_0x485931,_0x2aab77){_0x2aab77=_0x2aab77||0x1f4;return function(_0xfaa0e2){logger[_0x09ed('0x2d')](_0xfaa0e2[_0x09ed('0x2e')]);if(_0xfaa0e2['name']){delete _0xfaa0e2[_0x09ed('0x2f')];}_0x485931[_0x09ed('0x1e')](_0x2aab77)[_0x09ed('0x30')](_0xfaa0e2);};}exports[_0x09ed('0x31')]=function(_0x42bbc9,_0x3c3ae0){var _0x2e6750={},_0x3c73ea={},_0x1ec9b9={'count':0x0,'rows':[]};var _0x31081f=_[_0x09ed('0x32')](db[_0x09ed('0x33')][_0x09ed('0x34')],function(_0x3072f9){return{'name':_0x3072f9['fieldName'],'type':_0x3072f9['type'][_0x09ed('0x35')]};});_0x3c73ea[_0x09ed('0x36')]=_[_0x09ed('0x32')](_0x31081f,'name');_0x3c73ea['query']=_[_0x09ed('0x37')](_0x42bbc9[_0x09ed('0x38')]);_0x3c73ea[_0x09ed('0x39')]=_[_0x09ed('0x3a')](_0x3c73ea['model'],_0x3c73ea[_0x09ed('0x38')]);_0x2e6750[_0x09ed('0x3b')]=_[_0x09ed('0x3a')](_0x3c73ea[_0x09ed('0x36')],qs[_0x09ed('0x3c')](_0x42bbc9['query']['fields']));_0x2e6750[_0x09ed('0x3b')]=_0x2e6750[_0x09ed('0x3b')][_0x09ed('0x3d')]?_0x2e6750[_0x09ed('0x3b')]:_0x3c73ea[_0x09ed('0x36')];if(!_0x42bbc9[_0x09ed('0x38')]['hasOwnProperty']('nolimit')){_0x2e6750[_0x09ed('0x22')]=qs[_0x09ed('0x22')](_0x42bbc9['query'][_0x09ed('0x22')]);_0x2e6750[_0x09ed('0x20')]=qs[_0x09ed('0x20')](_0x42bbc9['query'][_0x09ed('0x20')]);}_0x2e6750[_0x09ed('0x3e')]=qs['sort'](_0x42bbc9[_0x09ed('0x38')][_0x09ed('0x3f')]);_0x2e6750[_0x09ed('0x40')]=qs[_0x09ed('0x39')](_[_0x09ed('0x41')](_0x42bbc9['query'],_0x3c73ea[_0x09ed('0x39')]),_0x31081f);if(_0x42bbc9[_0x09ed('0x38')][_0x09ed('0x42')]){_0x2e6750['where']=_[_0x09ed('0x43')](_0x2e6750['where'],{'$or':_[_0x09ed('0x32')](_0x31081f,function(_0x412c0b){if(_0x412c0b[_0x09ed('0x44')]!==_0x09ed('0x45')){var _0x2472bc={};_0x2472bc[_0x412c0b[_0x09ed('0x2f')]]={'$like':'%'+_0x42bbc9[_0x09ed('0x38')][_0x09ed('0x42')]+'%'};return _0x2472bc;}})});}_0x2e6750=_[_0x09ed('0x43')]({},_0x2e6750,_0x42bbc9[_0x09ed('0x46')]);var _0x44e1a7={'where':_0x2e6750[_0x09ed('0x40')]};return db[_0x09ed('0x33')]['count'](_0x44e1a7)[_0x09ed('0x27')](function(_0x3e2800){_0x1ec9b9['count']=_0x3e2800;if(_0x42bbc9['query'][_0x09ed('0x47')]){_0x2e6750['include']=[{'all':!![]}];}return db[_0x09ed('0x33')]['findAll'](_0x2e6750);})[_0x09ed('0x27')](function(_0x202261){_0x1ec9b9[_0x09ed('0x48')]=_0x202261;return _0x1ec9b9;})[_0x09ed('0x27')](respondWithFilteredResult(_0x3c3ae0,_0x2e6750))[_0x09ed('0x49')](handleError(_0x3c3ae0,null));};exports[_0x09ed('0x4a')]=function(_0x3ac483,_0xaf0e60){var _0x57f9dd={'raw':![],'where':{'id':_0x3ac483[_0x09ed('0x4b')]['id']}},_0xcf1fb1={};_0xcf1fb1['model']=_[_0x09ed('0x37')](db[_0x09ed('0x33')][_0x09ed('0x34')]);_0xcf1fb1[_0x09ed('0x38')]=_[_0x09ed('0x37')](_0x3ac483[_0x09ed('0x38')]);_0xcf1fb1[_0x09ed('0x39')]=_[_0x09ed('0x3a')](_0xcf1fb1[_0x09ed('0x36')],_0xcf1fb1[_0x09ed('0x38')]);_0x57f9dd['attributes']=_['intersection'](_0xcf1fb1[_0x09ed('0x36')],qs[_0x09ed('0x3c')](_0x3ac483[_0x09ed('0x38')]['fields']));_0x57f9dd[_0x09ed('0x3b')]=_0x57f9dd[_0x09ed('0x3b')][_0x09ed('0x3d')]?_0x57f9dd[_0x09ed('0x3b')]:_0xcf1fb1[_0x09ed('0x36')];if(_0x3ac483[_0x09ed('0x38')][_0x09ed('0x47')]){_0x57f9dd[_0x09ed('0x4c')]=[{'all':!![]}];}_0x57f9dd=_[_0x09ed('0x43')]({},_0x57f9dd,_0x3ac483[_0x09ed('0x46')]);return db['AnalyticCustomReport'][_0x09ed('0x4d')](_0x57f9dd)[_0x09ed('0x27')](handleEntityNotFound(_0xaf0e60,null))[_0x09ed('0x27')](respondWithResult(_0xaf0e60,null))[_0x09ed('0x49')](handleError(_0xaf0e60,null));};exports[_0x09ed('0x4e')]=function(_0x247a91,_0x18fc2f){return db['AnalyticCustomReport'][_0x09ed('0x4e')](_0x247a91[_0x09ed('0x4f')],{})['then'](function(_0x3f158a){var _0x544438=_0x247a91[_0x09ed('0x50')][_0x09ed('0x28')]({'plain':!![]});if(!_0x544438)throw new Error(_0x09ed('0x51'));if(_0x544438[_0x09ed('0x52')]===_0x09ed('0x50')){var _0x3b223e=_0x3f158a[_0x09ed('0x28')]({'plain':!![]});var _0xb59573=_0x09ed('0x53');return db['UserProfileSection'][_0x09ed('0x4d')]({'where':{'name':_0xb59573,'userProfileId':_0x544438['userProfileId']},'raw':!![]})[_0x09ed('0x27')](function(_0x2e5b0d){if(_0x2e5b0d&&_0x2e5b0d[_0x09ed('0x54')]===0x0){return db['UserProfileResource'][_0x09ed('0x4e')]({'name':_0x3b223e[_0x09ed('0x2f')],'resourceId':_0x3b223e['id'],'type':'CustomReports','sectionId':_0x2e5b0d['id']},{})[_0x09ed('0x27')](function(){return _0x3f158a;});}else{return _0x3f158a;}})[_0x09ed('0x49')](function(_0x3f9b71){logger[_0x09ed('0x2d')](_0x09ed('0x55'),_0x3f9b71);throw _0x3f9b71;});}return _0x3f158a;})['then'](respondWithResult(_0x18fc2f,0xc9))[_0x09ed('0x49')](handleError(_0x18fc2f,null));};exports[_0x09ed('0x56')]=function(_0x173f4f,_0x370d7c){if(_0x173f4f[_0x09ed('0x4f')]['id']){delete _0x173f4f[_0x09ed('0x4f')]['id'];}return db[_0x09ed('0x33')][_0x09ed('0x4d')]({'where':{'id':_0x173f4f[_0x09ed('0x4b')]['id']}})[_0x09ed('0x27')](handleEntityNotFound(_0x370d7c,null))[_0x09ed('0x27')](saveUpdates(_0x173f4f[_0x09ed('0x4f')],null))[_0x09ed('0x27')](respondWithResult(_0x370d7c,null))[_0x09ed('0x49')](handleError(_0x370d7c,null));};exports[_0x09ed('0x2b')]=function(_0x4d351b,_0x11aa22){return db[_0x09ed('0x33')][_0x09ed('0x4d')]({'where':{'id':_0x4d351b['params']['id']}})[_0x09ed('0x27')](handleEntityNotFound(_0x11aa22,null))[_0x09ed('0x27')](removeEntity(_0x11aa22,null))['catch'](handleError(_0x11aa22,null));};exports[_0x09ed('0x57')]=function(_0x518218,_0x1f0bc7){var _0x2ca01a=0xa;var _0x2b4ea9=[_0x09ed('0x58'),'left_join',_0x09ed('0x59'),_0x09ed('0x5a')];var _0x285cd9={'SUM':_0x09ed('0x5b'),'COUNT':_0x09ed('0x5c'),'COUNT DISTINCT':_0x09ed('0x5d'),'MAX':_0x09ed('0x5e'),'MIN':_0x09ed('0x5f'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x09ed('0x60'),'GROUP_CONCAT ASC':_0x09ed('0x61'),'GROUP_CONCAT DESC':_0x09ed('0x62')};var _0x397963={'SEC_TO_TIME':_0x09ed('0x63'),'DATE':_0x09ed('0x64'),'HOUR':_0x09ed('0x65'),'ROUND':_0x09ed('0x66'),'UNIX_TIMESTAMP':_0x09ed('0x67')};var _0x4882aa=function(_0x3967fa){return!_['includes'](['IS\x20NULL',_0x09ed('0x68'),_0x09ed('0x69'),'IS\x20NOT\x20EMPTY'],_0x3967fa);};var _0x544e02=function(_0x3b66a5){if(!_0x3b66a5||!_0x3b66a5[_0x09ed('0x6a')][_0x09ed('0x3d')]){return'';}for(var _0x2627b7='(',_0x26c03d=0x0;_0x26c03d<_0x3b66a5[_0x09ed('0x6a')]['length'];_0x26c03d+=0x1){_0x26c03d>0x0&&(_0x2627b7+='\x20'+_0x3b66a5['operator']+'\x20');_0x2627b7+=_0x3b66a5[_0x09ed('0x6a')][_0x26c03d][_0x09ed('0x6b')]?_0x544e02(_0x3b66a5[_0x09ed('0x6a')][_0x26c03d]['group']):_0x3b66a5[_0x09ed('0x6a')][_0x26c03d][_0x09ed('0x6c')]+'\x20'+_0x3b66a5[_0x09ed('0x6a')][_0x26c03d][_0x09ed('0x6d')]+(_0x4882aa(_0x3b66a5[_0x09ed('0x6a')][_0x26c03d][_0x09ed('0x6d')])?'\x20'+_0x3b66a5[_0x09ed('0x6a')][_0x26c03d][_0x09ed('0x6e')]:'');}return _0x2627b7+')';};var _0x57671f={'where':{'id':_0x518218[_0x09ed('0x4b')]['id']}},_0x4bcb9b,_0x4e3d7a,_0x267ba2,_0x5b0dd5,_0x300d1a;_0x57671f=_[_0x09ed('0x43')]({},_0x57671f,_0x518218[_0x09ed('0x46')]);return db[_0x09ed('0x33')][_0x09ed('0x4d')](_0x57671f)[_0x09ed('0x27')](function(_0x498d43){if(_0x498d43){_0x4bcb9b=_0x498d43;return _0x498d43[_0x09ed('0x6f')]();}return null;})[_0x09ed('0x27')](function(_0x4dca1e){if(_0x4dca1e){if(!_0x4dca1e[_0x09ed('0x3d')]){throw new db['Sequelize'][(_0x09ed('0x70'))](_0x09ed('0x71'),0x193);}_0x4e3d7a=_0x4dca1e;return db[_0x09ed('0x72')][_0x09ed('0x73')]({'raw':!![]});}return null;})[_0x09ed('0x27')](function(_0x492d89){if(_0x492d89){_0x267ba2=_['keyBy'](_0x492d89,'id');var _0x34548a;var _0x47af34=squel[_0x09ed('0x74')]();_0x47af34[_0x09ed('0x75')](_0x4bcb9b[_0x09ed('0x76')]);for(var _0x2267b7=0x0;_0x2267b7<_0x4e3d7a['length'];_0x2267b7+=0x1){_0x34548a=_0x4e3d7a[_0x2267b7][_0x09ed('0x77')]?_0x267ba2[_0x4e3d7a[_0x2267b7][_0x09ed('0x77')]][_0x09ed('0x78')]:_0x4e3d7a[_0x2267b7][_0x09ed('0x6c')];_0x34548a=_0x4e3d7a[_0x2267b7][_0x09ed('0x79')]?_[_0x09ed('0x7a')](_0x285cd9[_0x4e3d7a[_0x2267b7]['function']],'%s',_0x34548a):_0x34548a;_0x34548a=_0x4e3d7a[_0x2267b7][_0x09ed('0x7b')]?_['replace'](_0x397963[_0x4e3d7a[_0x2267b7][_0x09ed('0x7b')]],'%s',_0x34548a):_0x34548a;if(_0x4e3d7a[_0x2267b7]['groupBy']){_0x47af34[_0x09ed('0x6b')](_0x34548a);}_0x4e3d7a[_0x2267b7][_0x09ed('0x7c')]&&_0x47af34[_0x09ed('0x3e')](_0x34548a,_0x4e3d7a[_0x2267b7][_0x09ed('0x7c')]===_0x09ed('0x7d')?![]:!![]);_0x47af34[_0x09ed('0x6c')](_0x34548a,_0x4e3d7a[_0x2267b7][_0x09ed('0x7e')]||_0x34548a);}if(_0x4bcb9b[_0x09ed('0x7f')]){_0x4bcb9b[_0x09ed('0x7f')]=JSON[_0x09ed('0x80')](_0x4bcb9b[_0x09ed('0x7f')]);for(var _0x1d2779=0x0;_0x1d2779<_0x4bcb9b[_0x09ed('0x7f')]['length'];_0x1d2779+=0x1){if(_0x4bcb9b[_0x09ed('0x7f')][_0x1d2779][_0x09ed('0x44')]&&_[_0x09ed('0x81')](_0x2b4ea9,_0x4bcb9b[_0x09ed('0x7f')][_0x1d2779][_0x09ed('0x44')])&&_0x4bcb9b['joins'][_0x1d2779][_0x09ed('0x82')]&&_0x4bcb9b[_0x09ed('0x7f')][_0x1d2779][_0x09ed('0x83')]&&_0x4bcb9b[_0x09ed('0x7f')][_0x1d2779]['foreignKey']){_0x47af34[_0x4bcb9b[_0x09ed('0x7f')][_0x1d2779][_0x09ed('0x44')]](_0x4bcb9b[_0x09ed('0x7f')][_0x1d2779][_0x09ed('0x83')],null,util['format'](_0x09ed('0x84'),_0x4bcb9b[_0x09ed('0x76')],_0x4bcb9b[_0x09ed('0x7f')][_0x1d2779]['parentKey'],_0x4bcb9b['joins'][_0x1d2779][_0x09ed('0x83')],_0x4bcb9b[_0x09ed('0x7f')][_0x1d2779][_0x09ed('0x85')]));}}}if(_0x4bcb9b[_0x09ed('0x86')]){_0x4bcb9b[_0x09ed('0x86')]=JSON[_0x09ed('0x80')](_0x4bcb9b[_0x09ed('0x86')]);_0x47af34[_0x09ed('0x40')](_0x544e02(_0x4bcb9b['conditions'][_0x09ed('0x6b')]));}_0x300d1a=_0x47af34[_0x09ed('0x87')]();_0x47af34[_0x09ed('0x22')](_0x2ca01a);_0x47af34['offset'](0x0);logger['debug']('Limited\x20Query:',_0x47af34[_0x09ed('0x88')]());return dbH[_0x09ed('0x89')]['query'](_0x47af34[_0x09ed('0x88')](),{'type':dbH[_0x09ed('0x89')][_0x09ed('0x8a')][_0x09ed('0x8b')]});}})[_0x09ed('0x27')](respondWithResult(_0x1f0bc7,null))[_0x09ed('0x49')](handleError(_0x1f0bc7,null));};function runReport(_0x59c345,_0x175f0f,_0x469f5b){var _0x58594a=_0x175f0f[_0x09ed('0x2f')];var _0x259dee=0xa;var _0x26e4ac=[_0x09ed('0x58'),_0x09ed('0x8c'),_0x09ed('0x59'),_0x09ed('0x5a')];var _0x4f3458={'SUM':_0x09ed('0x5b'),'COUNT':_0x09ed('0x5c'),'COUNT DISTINCT':_0x09ed('0x5d'),'MAX':_0x09ed('0x5e'),'MIN':'MIN(%s)','AVG':_0x09ed('0x8d'),'GROUP_CONCAT':_0x09ed('0x60'),'GROUP_CONCAT ASC':_0x09ed('0x61'),'GROUP_CONCAT DESC':_0x09ed('0x62')};var _0x27e831={'SEC_TO_TIME':_0x09ed('0x63'),'DATE':_0x09ed('0x64'),'HOUR':_0x09ed('0x65'),'ROUND':_0x09ed('0x66'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5a1657=function(_0x27683a){return!_[_0x09ed('0x81')]([_0x09ed('0x8e'),_0x09ed('0x68'),_0x09ed('0x69'),'IS\x20NOT\x20EMPTY'],_0x27683a);};var _0x42508a=function(_0xe1bb43){if(!_0xe1bb43||!_0xe1bb43[_0x09ed('0x6a')][_0x09ed('0x3d')]){return'';}for(var _0x12b98f='(',_0x283992=0x0;_0x283992<_0xe1bb43['rules'][_0x09ed('0x3d')];_0x283992+=0x1){_0x283992>0x0&&(_0x12b98f+='\x20'+_0xe1bb43[_0x09ed('0x8f')]+'\x20');_0x12b98f+=_0xe1bb43[_0x09ed('0x6a')][_0x283992][_0x09ed('0x6b')]?_0x42508a(_0xe1bb43[_0x09ed('0x6a')][_0x283992][_0x09ed('0x6b')]):_0xe1bb43[_0x09ed('0x6a')][_0x283992]['field']+'\x20'+_0xe1bb43['rules'][_0x283992][_0x09ed('0x6d')]+(_0x5a1657(_0xe1bb43[_0x09ed('0x6a')][_0x283992][_0x09ed('0x6d')])?'\x20'+_0xe1bb43[_0x09ed('0x6a')][_0x283992]['value']:'');}return _0x12b98f+')';};var _0x387b96={'where':{'id':_0x59c345['id']}},_0x271b83,_0x2bf4ec,_0x4619c5,_0x43f365,_0x421ca2;_0x387b96=_['merge']({},_0x387b96,_0x469f5b);return db[_0x09ed('0x33')][_0x09ed('0x4d')](_0x387b96)[_0x09ed('0x27')](function(_0x3a3af9){if(_0x3a3af9){_0x271b83=_0x3a3af9;return _0x3a3af9['getFields']();}return null;})[_0x09ed('0x27')](function(_0x34deed){if(_0x34deed){if(!_0x34deed[_0x09ed('0x3d')]){throw new db[(_0x09ed('0x90'))][(_0x09ed('0x70'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2bf4ec=_0x34deed;return db[_0x09ed('0x72')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x66faa2){if(_0x66faa2){_0x4619c5=_['keyBy'](_0x66faa2,'id');var _0x1cddd9;var _0x282f0a=squel['select']();_0x282f0a[_0x09ed('0x75')](_0x271b83[_0x09ed('0x76')]);for(var _0x4fd105=0x0;_0x4fd105<_0x2bf4ec[_0x09ed('0x3d')];_0x4fd105+=0x1){_0x1cddd9=_0x2bf4ec[_0x4fd105][_0x09ed('0x77')]?_0x4619c5[_0x2bf4ec[_0x4fd105]['MetricId']][_0x09ed('0x78')]:_0x2bf4ec[_0x4fd105][_0x09ed('0x6c')];_0x1cddd9=_0x2bf4ec[_0x4fd105]['function']?_[_0x09ed('0x7a')](_0x4f3458[_0x2bf4ec[_0x4fd105][_0x09ed('0x79')]],'%s',_0x1cddd9):_0x1cddd9;_0x1cddd9=_0x2bf4ec[_0x4fd105][_0x09ed('0x7b')]?_[_0x09ed('0x7a')](_0x27e831[_0x2bf4ec[_0x4fd105][_0x09ed('0x7b')]],'%s',_0x1cddd9):_0x1cddd9;if(_0x2bf4ec[_0x4fd105][_0x09ed('0x91')]){_0x282f0a[_0x09ed('0x6b')](_0x1cddd9);}_0x2bf4ec[_0x4fd105]['orderBy']&&_0x282f0a[_0x09ed('0x3e')](_0x1cddd9,_0x2bf4ec[_0x4fd105][_0x09ed('0x7c')]===_0x09ed('0x7d')?![]:!![]);_0x282f0a['field'](_0x1cddd9,_0x2bf4ec[_0x4fd105][_0x09ed('0x7e')]||_0x1cddd9);}if(_0x271b83['joins']){_0x271b83[_0x09ed('0x7f')]=JSON['parse'](_0x271b83[_0x09ed('0x7f')]);for(var _0x192c80=0x0;_0x192c80<_0x271b83[_0x09ed('0x7f')][_0x09ed('0x3d')];_0x192c80+=0x1){if(_0x271b83[_0x09ed('0x7f')][_0x192c80][_0x09ed('0x44')]&&_['includes'](_0x26e4ac,_0x271b83[_0x09ed('0x7f')][_0x192c80][_0x09ed('0x44')])&&_0x271b83[_0x09ed('0x7f')][_0x192c80]['parentKey']&&_0x271b83[_0x09ed('0x7f')][_0x192c80]['foreignTable']&&_0x271b83[_0x09ed('0x7f')][_0x192c80][_0x09ed('0x85')]){_0x282f0a[_0x271b83[_0x09ed('0x7f')][_0x192c80][_0x09ed('0x44')]](_0x271b83[_0x09ed('0x7f')][_0x192c80][_0x09ed('0x83')],null,util[_0x09ed('0x7b')](_0x09ed('0x84'),_0x271b83[_0x09ed('0x76')],_0x271b83['joins'][_0x192c80][_0x09ed('0x82')],_0x271b83['joins'][_0x192c80][_0x09ed('0x83')],_0x271b83['joins'][_0x192c80][_0x09ed('0x85')]));}}}if(_0x271b83[_0x09ed('0x86')]){_0x271b83[_0x09ed('0x86')]=JSON[_0x09ed('0x80')](_0x271b83[_0x09ed('0x86')]);_0x282f0a[_0x09ed('0x40')](_0x42508a(_0x271b83['conditions'][_0x09ed('0x6b')]));}_0x421ca2=_0x282f0a[_0x09ed('0x87')]();_0x282f0a[_0x09ed('0x22')](_0x259dee);_0x282f0a[_0x09ed('0x20')](0x0);return;}})[_0x09ed('0x27')](function(){if(_0x175f0f['output']===_0x09ed('0x92')){return null;}var _0x252d4b=_['merge'](_0x175f0f,{'name':_0x175f0f['fullPath']||_0x175f0f[_0x09ed('0x2f')]||_0x271b83[_0x09ed('0x2f')],'basename':_0x58594a,'savename':util[_0x09ed('0x7b')](_0x09ed('0x93'),_0x175f0f[_0x09ed('0x2f')]||_0x271b83[_0x09ed('0x2f')],require('randomstring')['generate'](0x4),_0x175f0f[_0x09ed('0x94')]||'csv'),'reportId':_0x271b83['id'],'reportType':_0x09ed('0x95')});return db[_0x09ed('0x96')]['create'](_0x252d4b,{'raw':!![]});})[_0x09ed('0x27')](function(_0x7207){if(_0x271b83[_0x09ed('0x76')]==='cdr'){_0x421ca2['where'](_0x271b83[_0x09ed('0x76')]+_0x09ed('0x97'),_0x175f0f[_0x09ed('0x98')],_0x175f0f[_0x09ed('0x99')]);}else{_0x421ca2[_0x09ed('0x40')](_0x271b83[_0x09ed('0x76')]+_0x09ed('0x9a'),_0x175f0f[_0x09ed('0x98')],_0x175f0f[_0x09ed('0x99')]);}if(_0x7207){logger[_0x09ed('0x9b')](_0x09ed('0x9c'),_0x421ca2[_0x09ed('0x88')]());require(_0x09ed('0x9d'))['fork'](path[_0x09ed('0x58')](__dirname,_0x09ed('0x9e'),_0x7207[_0x09ed('0x94')]),[_0x7207['id'],_0x421ca2['toString'](),path['join'](__dirname,_0x09ed('0x9f'),_0x7207[_0x09ed('0xa0')]),_0x58594a]);return _0x7207;}else{var _0x3df215=squel[_0x09ed('0x74')]();_0x3df215[_0x09ed('0x75')]('('+_0x421ca2[_0x09ed('0x88')]()+')','countTable');_0x3df215[_0x09ed('0x6c')](_0x09ed('0xa1'),_0x09ed('0xa2'));_0x421ca2[_0x09ed('0x22')](_0x175f0f['limit']||_0x259dee);_0x421ca2[_0x09ed('0x20')](_0x175f0f['offset']||0x0);return dbH['sequelize'][_0x09ed('0x38')](_0x3df215[_0x09ed('0x88')](),{'type':dbH[_0x09ed('0x89')][_0x09ed('0x8a')]['SELECT']})['then'](function(_0x48a1af){if(!_0x48a1af[_0x09ed('0x3d')]){_0x43f365=0x0;}else{_0x43f365=_0x48a1af[0x0][_0x09ed('0xa2')]||0x0;}return dbH[_0x09ed('0x89')][_0x09ed('0x38')](_0x421ca2[_0x09ed('0x88')](),{'type':dbH[_0x09ed('0x89')][_0x09ed('0x8a')][_0x09ed('0x8b')]});})[_0x09ed('0x27')](function(_0x41e851){return{'rows':_0x41e851||[],'count':_0x43f365};});}});}exports[_0x09ed('0xa3')]=function(_0x2569ae,_0x4a827){return runReport(_0x2569ae[_0x09ed('0x4b')],_0x2569ae[_0x09ed('0x38')],_0x2569ae[_0x09ed('0x46')])[_0x09ed('0x27')](respondWithResult(_0x4a827,null))['catch'](handleError(_0x4a827,null));};exports[_0x09ed('0xa4')]=runReport;exports[_0x09ed('0x38')]=function(_0x459905,_0x5d80b7){var _0x46f2c9=0xa;var _0x569c79=[_0x09ed('0x58'),_0x09ed('0x8c'),_0x09ed('0x59'),_0x09ed('0x5a')];var _0x214a1f={'SUM':_0x09ed('0x5b'),'COUNT':_0x09ed('0x5c'),'COUNT DISTINCT':_0x09ed('0x5d'),'MAX':_0x09ed('0x5e'),'MIN':_0x09ed('0x5f'),'AVG':_0x09ed('0x8d'),'GROUP_CONCAT':_0x09ed('0x60'),'GROUP_CONCAT ASC':_0x09ed('0x61'),'GROUP_CONCAT DESC':_0x09ed('0x62')};var _0x120e88={'SEC_TO_TIME':_0x09ed('0x63'),'DATE':_0x09ed('0x64'),'HOUR':'HOUR(%s)','ROUND':_0x09ed('0x66'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x21bdd2=function(_0x1e9e7f){return!_[_0x09ed('0x81')]([_0x09ed('0x8e'),_0x09ed('0x68'),'IS\x20EMPTY',_0x09ed('0xa5')],_0x1e9e7f);};var _0x161f36=function(_0x26986d){if(!_0x26986d||!_0x26986d['rules'][_0x09ed('0x3d')]){return'';}for(var _0x390a98='(',_0x5416ad=0x0;_0x5416ad<_0x26986d[_0x09ed('0x6a')]['length'];_0x5416ad+=0x1){_0x5416ad>0x0&&(_0x390a98+='\x20'+_0x26986d[_0x09ed('0x8f')]+'\x20');_0x390a98+=_0x26986d[_0x09ed('0x6a')][_0x5416ad][_0x09ed('0x6b')]?_0x161f36(_0x26986d['rules'][_0x5416ad][_0x09ed('0x6b')]):_0x26986d[_0x09ed('0x6a')][_0x5416ad][_0x09ed('0x6c')]+'\x20'+_0x26986d[_0x09ed('0x6a')][_0x5416ad]['condition']+(_0x21bdd2(_0x26986d[_0x09ed('0x6a')][_0x5416ad][_0x09ed('0x6d')])?'\x20'+_0x26986d[_0x09ed('0x6a')][_0x5416ad][_0x09ed('0x6e')]:'');}return _0x390a98+')';};var _0x22da97={'where':{'id':_0x459905[_0x09ed('0x4b')]['id']}},_0x8360b2,_0x1f566e,_0x495839,_0x3b3e8b,_0x4f4e85;_0x22da97=_[_0x09ed('0x43')]({},_0x22da97,_0x459905[_0x09ed('0x46')]);return db['AnalyticCustomReport'][_0x09ed('0x4d')](_0x22da97)['then'](function(_0x546af0){if(_0x546af0){_0x8360b2=_0x546af0;return _0x546af0[_0x09ed('0x6f')]();}return null;})[_0x09ed('0x27')](function(_0x3b7ad2){if(_0x3b7ad2){if(!_0x3b7ad2[_0x09ed('0x3d')]){throw new db[(_0x09ed('0x90'))]['ValidationErrorItem'](_0x09ed('0x71'),0x193);}_0x1f566e=_0x3b7ad2;return db['AnalyticMetric'][_0x09ed('0x73')]({'raw':!![]});}return null;})[_0x09ed('0x27')](function(_0xff1d4){if(_0xff1d4){_0x495839=_[_0x09ed('0xa6')](_0xff1d4,'id');var _0x2991a1;var _0x543312=squel[_0x09ed('0x74')]();_0x543312['from'](_0x8360b2[_0x09ed('0x76')]);for(var _0x5ad66e=0x0;_0x5ad66e<_0x1f566e['length'];_0x5ad66e+=0x1){_0x2991a1=_0x1f566e[_0x5ad66e][_0x09ed('0x77')]?_0x495839[_0x1f566e[_0x5ad66e][_0x09ed('0x77')]][_0x09ed('0x78')]:_0x1f566e[_0x5ad66e][_0x09ed('0x6c')];_0x2991a1=_0x1f566e[_0x5ad66e][_0x09ed('0x79')]?_[_0x09ed('0x7a')](_0x214a1f[_0x1f566e[_0x5ad66e]['function']],'%s',_0x2991a1):_0x2991a1;_0x2991a1=_0x1f566e[_0x5ad66e][_0x09ed('0x7b')]?_[_0x09ed('0x7a')](_0x120e88[_0x1f566e[_0x5ad66e][_0x09ed('0x7b')]],'%s',_0x2991a1):_0x2991a1;if(_0x1f566e[_0x5ad66e][_0x09ed('0x91')]){_0x543312[_0x09ed('0x6b')](_0x2991a1);}_0x1f566e[_0x5ad66e][_0x09ed('0x7c')]&&_0x543312[_0x09ed('0x3e')](_0x2991a1,_0x1f566e[_0x5ad66e]['orderBy']===_0x09ed('0x7d')?![]:!![]);_0x543312['field'](_0x2991a1,_0x1f566e[_0x5ad66e][_0x09ed('0x7e')]||_0x2991a1);}if(_0x8360b2['joins']){_0x8360b2['joins']=JSON[_0x09ed('0x80')](_0x8360b2[_0x09ed('0x7f')]);for(var _0x345e82=0x0;_0x345e82<_0x8360b2['joins'][_0x09ed('0x3d')];_0x345e82+=0x1){if(_0x8360b2[_0x09ed('0x7f')][_0x345e82]['type']&&_[_0x09ed('0x81')](_0x569c79,_0x8360b2[_0x09ed('0x7f')][_0x345e82][_0x09ed('0x44')])&&_0x8360b2['joins'][_0x345e82][_0x09ed('0x82')]&&_0x8360b2['joins'][_0x345e82][_0x09ed('0x83')]&&_0x8360b2[_0x09ed('0x7f')][_0x345e82][_0x09ed('0x85')]){_0x543312[_0x8360b2[_0x09ed('0x7f')][_0x345e82]['type']](_0x8360b2['joins'][_0x345e82]['foreignTable'],null,util[_0x09ed('0x7b')](_0x09ed('0x84'),_0x8360b2[_0x09ed('0x76')],_0x8360b2[_0x09ed('0x7f')][_0x345e82]['parentKey'],_0x8360b2[_0x09ed('0x7f')][_0x345e82]['foreignTable'],_0x8360b2[_0x09ed('0x7f')][_0x345e82][_0x09ed('0x85')]));}}}if(_0x8360b2[_0x09ed('0x86')]){_0x8360b2['conditions']=JSON['parse'](_0x8360b2['conditions']);_0x543312['where'](_0x161f36(_0x8360b2['conditions'][_0x09ed('0x6b')]));}_0x4f4e85=_0x543312[_0x09ed('0x87')]();_0x543312[_0x09ed('0x22')](_0x46f2c9);_0x543312[_0x09ed('0x20')](0x0);logger['debug'](_0x09ed('0xa7'),_0x543312[_0x09ed('0x88')]());return dbH['sequelize'][_0x09ed('0x38')](_0x543312[_0x09ed('0x88')](),{'type':dbH[_0x09ed('0x89')][_0x09ed('0x8a')]['SELECT']});}})[_0x09ed('0x27')](function(){return{'sql':_0x4f4e85[_0x09ed('0x88')]()};})[_0x09ed('0x27')](respondWithResult(_0x5d80b7,null))[_0x09ed('0x49')](handleError(_0x5d80b7,null));}; \ No newline at end of file +var _0x1121=['foreignKey','table','conditions','parse','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','SEC_TO_TIME(%s)','IS\x20NULL','Please\x20insert\x20at\x20least\x20one\x20field','from','DESC','alias','parentKey','clone','output','web','fullPath','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','Run\x20Query:','child_process','fork','../../files/reports','savename','COUNT(*)','run','runReport','IS\x20EMPTY','ValidationErrorItem','%s.%s\x20=\x20%s.%s','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','status','end','offset','undefined','limit','count','set','json','reject','then','destroy','CustomReports','UserProfileResource','sendStatus','error','stack','name','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','rows','catch','params','includeAll','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','Sequelize','AnalyticMetric','findAll','keyBy','select','MetricId','metric','field','function','replace','format','groupBy','orderBy','joins','foreignTable'];(function(_0x5a6644,_0x45d612){var _0x3a2a5d=function(_0x54159e){while(--_0x54159e){_0x5a6644['push'](_0x5a6644['shift']());}};_0x3a2a5d(++_0x45d612);}(_0x1121,0xc9));var _0x1112=function(_0x24600a,_0xab1618){_0x24600a=_0x24600a-0x0;var _0x100968=_0x1121[_0x24600a];return _0x100968;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1112('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1112('0x1'));var moment=require(_0x1112('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x1112('0x3'));var util=require(_0x1112('0x4'));var path=require(_0x1112('0x5'));var sox=require(_0x1112('0x6'));var csv=require(_0x1112('0x7'));var ejs=require(_0x1112('0x8'));var fs=require('fs');var fs_extra=require(_0x1112('0x9'));var _=require('lodash');var squel=require(_0x1112('0xa'));var crypto=require(_0x1112('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1112('0x7'));var querystring=require(_0x1112('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1112('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x1112('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1112('0xf'));var utils=require('../../config/utils');var config=require(_0x1112('0x10'));var licenseUtil=require(_0x1112('0x11'));var db=require(_0x1112('0x12'))['db'];var dbH=require('../../mysqldb')[_0x1112('0x13')];function respondWithStatusCode(_0x105258,_0x1adff7){_0x1adff7=_0x1adff7||0xcc;return function(_0x1a7b21){if(_0x1a7b21){return _0x105258['sendStatus'](_0x1adff7);}return _0x105258[_0x1112('0x14')](_0x1adff7)[_0x1112('0x15')]();};}function respondWithResult(_0x213f34,_0x3d5d5c){_0x3d5d5c=_0x3d5d5c||0xc8;return function(_0xde3db8){if(_0xde3db8){return _0x213f34[_0x1112('0x14')](_0x3d5d5c)['json'](_0xde3db8);}};}function respondWithFilteredResult(_0xb7f38d,_0x258ea7){return function(_0xbfc2bd){if(_0xbfc2bd){var _0x5eb6a4=typeof _0x258ea7[_0x1112('0x16')]===_0x1112('0x17')&&typeof _0x258ea7[_0x1112('0x18')]===_0x1112('0x17');var _0x426902=_0xbfc2bd['count'];var _0x5e53d1=_0x5eb6a4?0x0:_0x258ea7[_0x1112('0x16')];var _0x1124ed=_0x5eb6a4?_0xbfc2bd[_0x1112('0x19')]:_0x258ea7[_0x1112('0x16')]+_0x258ea7[_0x1112('0x18')];var _0x9ee5f9;if(_0x1124ed>=_0x426902){_0x1124ed=_0x426902;_0x9ee5f9=0xc8;}else{_0x9ee5f9=0xce;}_0xb7f38d[_0x1112('0x14')](_0x9ee5f9);return _0xb7f38d[_0x1112('0x1a')]('Content-Range',_0x5e53d1+'-'+_0x1124ed+'/'+_0x426902)[_0x1112('0x1b')](_0xbfc2bd);}return null;};}function patchUpdates(_0x13a89b){return function(_0x2f43b7){try{jsonpatch['apply'](_0x2f43b7,_0x13a89b,!![]);}catch(_0x36106e){return BPromise[_0x1112('0x1c')](_0x36106e);}return _0x2f43b7['save']();};}function saveUpdates(_0x23686e,_0x226c81){return function(_0x457914){if(_0x457914){return _0x457914['update'](_0x23686e)[_0x1112('0x1d')](function(_0x342928){return _0x342928;});}return null;};}function removeEntity(_0x267ae3,_0x41e807){return function(_0x3a574f){if(_0x3a574f){return _0x3a574f[_0x1112('0x1e')]()[_0x1112('0x1d')](function(){var _0x5f31a0=_0x3a574f['get']({'plain':!![]});var _0x572f5d=_0x1112('0x1f');return db[_0x1112('0x20')][_0x1112('0x1e')]({'where':{'type':_0x572f5d,'resourceId':_0x5f31a0['id']}})[_0x1112('0x1d')](function(){return _0x3a574f;});})[_0x1112('0x1d')](function(){_0x267ae3[_0x1112('0x14')](0xcc)[_0x1112('0x15')]();});}};}function handleEntityNotFound(_0x3645ec,_0x1e1e9e){return function(_0x3c7df7){if(!_0x3c7df7){_0x3645ec[_0x1112('0x21')](0x194);}return _0x3c7df7;};}function handleError(_0xd14503,_0x5ca322){_0x5ca322=_0x5ca322||0x1f4;return function(_0x152e47){logger[_0x1112('0x22')](_0x152e47[_0x1112('0x23')]);if(_0x152e47[_0x1112('0x24')]){delete _0x152e47[_0x1112('0x24')];}_0xd14503[_0x1112('0x14')](_0x5ca322)['send'](_0x152e47);};}exports[_0x1112('0x25')]=function(_0x47b422,_0x1b991b){var _0x3f3edd={},_0x35a617={},_0x13eef2={'count':0x0,'rows':[]};var _0x46a5a9=_[_0x1112('0x26')](db[_0x1112('0x27')][_0x1112('0x28')],function(_0x4edf75){return{'name':_0x4edf75[_0x1112('0x29')],'type':_0x4edf75[_0x1112('0x2a')][_0x1112('0x2b')]};});_0x35a617[_0x1112('0x2c')]=_['map'](_0x46a5a9,_0x1112('0x24'));_0x35a617[_0x1112('0x2d')]=_[_0x1112('0x2e')](_0x47b422['query']);_0x35a617[_0x1112('0x2f')]=_[_0x1112('0x30')](_0x35a617[_0x1112('0x2c')],_0x35a617['query']);_0x3f3edd[_0x1112('0x31')]=_[_0x1112('0x30')](_0x35a617[_0x1112('0x2c')],qs[_0x1112('0x32')](_0x47b422[_0x1112('0x2d')][_0x1112('0x32')]));_0x3f3edd[_0x1112('0x31')]=_0x3f3edd[_0x1112('0x31')][_0x1112('0x33')]?_0x3f3edd[_0x1112('0x31')]:_0x35a617[_0x1112('0x2c')];if(!_0x47b422[_0x1112('0x2d')][_0x1112('0x34')](_0x1112('0x35'))){_0x3f3edd[_0x1112('0x18')]=qs[_0x1112('0x18')](_0x47b422[_0x1112('0x2d')][_0x1112('0x18')]);_0x3f3edd['offset']=qs[_0x1112('0x16')](_0x47b422[_0x1112('0x2d')][_0x1112('0x16')]);}_0x3f3edd[_0x1112('0x36')]=qs['sort'](_0x47b422['query'][_0x1112('0x37')]);_0x3f3edd[_0x1112('0x38')]=qs[_0x1112('0x2f')](_['pick'](_0x47b422[_0x1112('0x2d')],_0x35a617['filters']),_0x46a5a9);if(_0x47b422[_0x1112('0x2d')][_0x1112('0x39')]){_0x3f3edd[_0x1112('0x38')]=_['merge'](_0x3f3edd[_0x1112('0x38')],{'$or':_[_0x1112('0x26')](_0x46a5a9,function(_0x1aab00){if(_0x1aab00[_0x1112('0x2a')]!=='VIRTUAL'){var _0x5ac479={};_0x5ac479[_0x1aab00[_0x1112('0x24')]]={'$like':'%'+_0x47b422['query'][_0x1112('0x39')]+'%'};return _0x5ac479;}})});}_0x3f3edd=_[_0x1112('0x3a')]({},_0x3f3edd,_0x47b422[_0x1112('0x3b')]);var _0x5db78f={'where':_0x3f3edd['where']};return db[_0x1112('0x27')][_0x1112('0x19')](_0x5db78f)[_0x1112('0x1d')](function(_0xef6d91){_0x13eef2[_0x1112('0x19')]=_0xef6d91;if(_0x47b422[_0x1112('0x2d')]['includeAll']){_0x3f3edd['include']=[{'all':!![]}];}return db['AnalyticCustomReport']['findAll'](_0x3f3edd);})[_0x1112('0x1d')](function(_0x19bfe9){_0x13eef2[_0x1112('0x3c')]=_0x19bfe9;return _0x13eef2;})[_0x1112('0x1d')](respondWithFilteredResult(_0x1b991b,_0x3f3edd))[_0x1112('0x3d')](handleError(_0x1b991b,null));};exports['show']=function(_0x192795,_0x179ff3){var _0x43adea={'raw':![],'where':{'id':_0x192795[_0x1112('0x3e')]['id']}},_0x4c9156={};_0x4c9156[_0x1112('0x2c')]=_['keys'](db[_0x1112('0x27')][_0x1112('0x28')]);_0x4c9156[_0x1112('0x2d')]=_[_0x1112('0x2e')](_0x192795['query']);_0x4c9156[_0x1112('0x2f')]=_[_0x1112('0x30')](_0x4c9156['model'],_0x4c9156[_0x1112('0x2d')]);_0x43adea['attributes']=_[_0x1112('0x30')](_0x4c9156[_0x1112('0x2c')],qs[_0x1112('0x32')](_0x192795['query'][_0x1112('0x32')]));_0x43adea[_0x1112('0x31')]=_0x43adea[_0x1112('0x31')]['length']?_0x43adea[_0x1112('0x31')]:_0x4c9156[_0x1112('0x2c')];if(_0x192795[_0x1112('0x2d')][_0x1112('0x3f')]){_0x43adea[_0x1112('0x40')]=[{'all':!![]}];}_0x43adea=_[_0x1112('0x3a')]({},_0x43adea,_0x192795[_0x1112('0x3b')]);return db['AnalyticCustomReport'][_0x1112('0x41')](_0x43adea)['then'](handleEntityNotFound(_0x179ff3,null))[_0x1112('0x1d')](respondWithResult(_0x179ff3,null))[_0x1112('0x3d')](handleError(_0x179ff3,null));};exports[_0x1112('0x42')]=function(_0xc8323a,_0x505dcc){return db[_0x1112('0x27')][_0x1112('0x42')](_0xc8323a[_0x1112('0x43')],{})[_0x1112('0x1d')](function(_0x34c181){var _0x303daa=_0xc8323a[_0x1112('0x44')][_0x1112('0x45')]({'plain':!![]});if(!_0x303daa)throw new Error(_0x1112('0x46'));if(_0x303daa[_0x1112('0x47')]===_0x1112('0x44')){var _0x1c805d=_0x34c181[_0x1112('0x45')]({'plain':!![]});var _0x1c2e50=_0x1112('0x48');return db[_0x1112('0x49')][_0x1112('0x41')]({'where':{'name':_0x1c2e50,'userProfileId':_0x303daa[_0x1112('0x4a')]},'raw':!![]})[_0x1112('0x1d')](function(_0x4168ae){if(_0x4168ae&&_0x4168ae[_0x1112('0x4b')]===0x0){return db['UserProfileResource']['create']({'name':_0x1c805d['name'],'resourceId':_0x1c805d['id'],'type':_0x1112('0x1f'),'sectionId':_0x4168ae['id']},{})[_0x1112('0x1d')](function(){return _0x34c181;});}else{return _0x34c181;}})['catch'](function(_0x2b12fd){logger[_0x1112('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b12fd);throw _0x2b12fd;});}return _0x34c181;})[_0x1112('0x1d')](respondWithResult(_0x505dcc,0xc9))[_0x1112('0x3d')](handleError(_0x505dcc,null));};exports['update']=function(_0x15b925,_0x376ba6){if(_0x15b925[_0x1112('0x43')]['id']){delete _0x15b925[_0x1112('0x43')]['id'];}return db['AnalyticCustomReport']['find']({'where':{'id':_0x15b925[_0x1112('0x3e')]['id']}})[_0x1112('0x1d')](handleEntityNotFound(_0x376ba6,null))[_0x1112('0x1d')](saveUpdates(_0x15b925[_0x1112('0x43')],null))[_0x1112('0x1d')](respondWithResult(_0x376ba6,null))[_0x1112('0x3d')](handleError(_0x376ba6,null));};exports['destroy']=function(_0x342a3a,_0x3761eb){return db[_0x1112('0x27')][_0x1112('0x41')]({'where':{'id':_0x342a3a[_0x1112('0x3e')]['id']}})[_0x1112('0x1d')](handleEntityNotFound(_0x3761eb,null))[_0x1112('0x1d')](removeEntity(_0x3761eb,null))[_0x1112('0x3d')](handleError(_0x3761eb,null));};exports['preview']=function(_0x18c1b4,_0x19c1f6){var _0x1eec53=0xa;var _0x47d7f7=[_0x1112('0x4c'),_0x1112('0x4d'),_0x1112('0x4e'),_0x1112('0x4f')];var _0x5cdcd9={'SUM':_0x1112('0x50'),'COUNT':_0x1112('0x51'),'COUNT DISTINCT':_0x1112('0x52'),'MAX':_0x1112('0x53'),'MIN':_0x1112('0x54'),'AVG':_0x1112('0x55'),'GROUP_CONCAT':_0x1112('0x56'),'GROUP_CONCAT ASC':_0x1112('0x57'),'GROUP_CONCAT DESC':_0x1112('0x58')};var _0xdccd79={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x1112('0x59'),'HOUR':_0x1112('0x5a'),'ROUND':_0x1112('0x5b'),'UNIX_TIMESTAMP':_0x1112('0x5c')};var _0x19d4a7=function(_0x284a02){return!_[_0x1112('0x5d')](['IS\x20NULL',_0x1112('0x5e'),'IS\x20EMPTY',_0x1112('0x5f')],_0x284a02);};var _0x4465d0=function(_0x570604){if(!_0x570604||!_0x570604[_0x1112('0x60')]['length']){return'';}for(var _0x45c387='(',_0x31c85e=0x0;_0x31c85e<_0x570604[_0x1112('0x60')][_0x1112('0x33')];_0x31c85e+=0x1){_0x31c85e>0x0&&(_0x45c387+='\x20'+_0x570604[_0x1112('0x61')]+'\x20');_0x45c387+=_0x570604['rules'][_0x31c85e][_0x1112('0x62')]?_0x4465d0(_0x570604[_0x1112('0x60')][_0x31c85e][_0x1112('0x62')]):_0x570604['rules'][_0x31c85e]['field']+'\x20'+_0x570604['rules'][_0x31c85e][_0x1112('0x63')]+(_0x19d4a7(_0x570604['rules'][_0x31c85e][_0x1112('0x63')])?'\x20'+_0x570604[_0x1112('0x60')][_0x31c85e][_0x1112('0x64')]:'');}return _0x45c387+')';};var _0x435fcc={'where':{'id':_0x18c1b4[_0x1112('0x3e')]['id']}},_0x554f76,_0x5e0f97,_0x4b0b3d,_0x46eced,_0x532f5a;_0x435fcc=_[_0x1112('0x3a')]({},_0x435fcc,_0x18c1b4[_0x1112('0x3b')]);return db[_0x1112('0x27')][_0x1112('0x41')](_0x435fcc)[_0x1112('0x1d')](function(_0x4252ad){if(_0x4252ad){_0x554f76=_0x4252ad;return _0x4252ad[_0x1112('0x65')]();}return null;})[_0x1112('0x1d')](function(_0x44ce2f){if(_0x44ce2f){if(!_0x44ce2f[_0x1112('0x33')]){throw new db[(_0x1112('0x66'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5e0f97=_0x44ce2f;return db[_0x1112('0x67')][_0x1112('0x68')]({'raw':!![]});}return null;})[_0x1112('0x1d')](function(_0x32a881){if(_0x32a881){_0x4b0b3d=_[_0x1112('0x69')](_0x32a881,'id');var _0x53a7ff;var _0x3cad02=squel[_0x1112('0x6a')]();_0x3cad02['from'](_0x554f76['table']);for(var _0x107bcd=0x0;_0x107bcd<_0x5e0f97['length'];_0x107bcd+=0x1){_0x53a7ff=_0x5e0f97[_0x107bcd]['MetricId']?_0x4b0b3d[_0x5e0f97[_0x107bcd][_0x1112('0x6b')]][_0x1112('0x6c')]:_0x5e0f97[_0x107bcd][_0x1112('0x6d')];_0x53a7ff=_0x5e0f97[_0x107bcd][_0x1112('0x6e')]?_[_0x1112('0x6f')](_0x5cdcd9[_0x5e0f97[_0x107bcd]['function']],'%s',_0x53a7ff):_0x53a7ff;_0x53a7ff=_0x5e0f97[_0x107bcd][_0x1112('0x70')]?_[_0x1112('0x6f')](_0xdccd79[_0x5e0f97[_0x107bcd]['format']],'%s',_0x53a7ff):_0x53a7ff;if(_0x5e0f97[_0x107bcd][_0x1112('0x71')]){_0x3cad02[_0x1112('0x62')](_0x53a7ff);}_0x5e0f97[_0x107bcd][_0x1112('0x72')]&&_0x3cad02[_0x1112('0x36')](_0x53a7ff,_0x5e0f97[_0x107bcd][_0x1112('0x72')]==='DESC'?![]:!![]);_0x3cad02[_0x1112('0x6d')](_0x53a7ff,_0x5e0f97[_0x107bcd]['alias']||_0x53a7ff);}if(_0x554f76[_0x1112('0x73')]){_0x554f76[_0x1112('0x73')]=JSON['parse'](_0x554f76[_0x1112('0x73')]);for(var _0x5d5775=0x0;_0x5d5775<_0x554f76[_0x1112('0x73')]['length'];_0x5d5775+=0x1){if(_0x554f76[_0x1112('0x73')][_0x5d5775][_0x1112('0x2a')]&&_['includes'](_0x47d7f7,_0x554f76[_0x1112('0x73')][_0x5d5775][_0x1112('0x2a')])&&_0x554f76['joins'][_0x5d5775]['parentKey']&&_0x554f76[_0x1112('0x73')][_0x5d5775][_0x1112('0x74')]&&_0x554f76[_0x1112('0x73')][_0x5d5775][_0x1112('0x75')]){_0x3cad02[_0x554f76[_0x1112('0x73')][_0x5d5775][_0x1112('0x2a')]](_0x554f76[_0x1112('0x73')][_0x5d5775][_0x1112('0x74')],null,util[_0x1112('0x70')]('%s.%s\x20=\x20%s.%s',_0x554f76[_0x1112('0x76')],_0x554f76[_0x1112('0x73')][_0x5d5775]['parentKey'],_0x554f76[_0x1112('0x73')][_0x5d5775]['foreignTable'],_0x554f76[_0x1112('0x73')][_0x5d5775]['foreignKey']));}}}if(_0x554f76[_0x1112('0x77')]){_0x554f76[_0x1112('0x77')]=JSON[_0x1112('0x78')](_0x554f76[_0x1112('0x77')]);_0x3cad02[_0x1112('0x38')](_0x4465d0(_0x554f76[_0x1112('0x77')][_0x1112('0x62')]));}_0x532f5a=_0x3cad02['clone']();_0x3cad02[_0x1112('0x18')](_0x1eec53);_0x3cad02[_0x1112('0x16')](0x0);logger[_0x1112('0x79')](_0x1112('0x7a'),_0x3cad02[_0x1112('0x7b')]());return dbH['sequelize'][_0x1112('0x2d')](_0x3cad02[_0x1112('0x7b')](),{'type':dbH[_0x1112('0x7c')][_0x1112('0x7d')][_0x1112('0x7e')]});}})['then'](respondWithResult(_0x19c1f6,null))[_0x1112('0x3d')](handleError(_0x19c1f6,null));};function runReport(_0x10ca1f,_0x1784d1,_0x518419){var _0x457010=_0x1784d1['name'];var _0x2860d7=0xa;var _0x108079=[_0x1112('0x4c'),'left_join',_0x1112('0x4e'),_0x1112('0x4f')];var _0x149bde={'SUM':_0x1112('0x50'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x1112('0x52'),'MAX':'MAX(%s)','MIN':_0x1112('0x54'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x1112('0x56'),'GROUP_CONCAT ASC':_0x1112('0x57'),'GROUP_CONCAT DESC':_0x1112('0x58')};var _0x3013c3={'SEC_TO_TIME':_0x1112('0x7f'),'DATE':_0x1112('0x59'),'HOUR':_0x1112('0x5a'),'ROUND':_0x1112('0x5b'),'UNIX_TIMESTAMP':_0x1112('0x5c')};var _0x359fab=function(_0x39ef98){return!_['includes']([_0x1112('0x80'),_0x1112('0x5e'),'IS\x20EMPTY',_0x1112('0x5f')],_0x39ef98);};var _0x17cd21=function(_0x436380){if(!_0x436380||!_0x436380['rules'][_0x1112('0x33')]){return'';}for(var _0x594327='(',_0x194acf=0x0;_0x194acf<_0x436380[_0x1112('0x60')]['length'];_0x194acf+=0x1){_0x194acf>0x0&&(_0x594327+='\x20'+_0x436380['operator']+'\x20');_0x594327+=_0x436380['rules'][_0x194acf][_0x1112('0x62')]?_0x17cd21(_0x436380[_0x1112('0x60')][_0x194acf][_0x1112('0x62')]):_0x436380[_0x1112('0x60')][_0x194acf]['field']+'\x20'+_0x436380[_0x1112('0x60')][_0x194acf][_0x1112('0x63')]+(_0x359fab(_0x436380[_0x1112('0x60')][_0x194acf]['condition'])?'\x20'+_0x436380[_0x1112('0x60')][_0x194acf][_0x1112('0x64')]:'');}return _0x594327+')';};var _0x9cac92={'where':{'id':_0x10ca1f['id']}},_0x2609b8,_0x414f8b,_0x33a61d,_0x4ab164,_0x1c78fc;_0x9cac92=_['merge']({},_0x9cac92,_0x518419);return db[_0x1112('0x27')]['find'](_0x9cac92)[_0x1112('0x1d')](function(_0x2ebb71){if(_0x2ebb71){_0x2609b8=_0x2ebb71;return _0x2ebb71[_0x1112('0x65')]();}return null;})['then'](function(_0x448073){if(_0x448073){if(!_0x448073[_0x1112('0x33')]){throw new db[(_0x1112('0x66'))]['ValidationErrorItem'](_0x1112('0x81'),0x193);}_0x414f8b=_0x448073;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x1112('0x1d')](function(_0x5c83b1){if(_0x5c83b1){_0x33a61d=_[_0x1112('0x69')](_0x5c83b1,'id');var _0x36a42f;var _0x2c28c0=squel['select']();_0x2c28c0[_0x1112('0x82')](_0x2609b8['table']);for(var _0x42f6ef=0x0;_0x42f6ef<_0x414f8b['length'];_0x42f6ef+=0x1){_0x36a42f=_0x414f8b[_0x42f6ef][_0x1112('0x6b')]?_0x33a61d[_0x414f8b[_0x42f6ef][_0x1112('0x6b')]]['metric']:_0x414f8b[_0x42f6ef]['field'];_0x36a42f=_0x414f8b[_0x42f6ef][_0x1112('0x6e')]?_['replace'](_0x149bde[_0x414f8b[_0x42f6ef][_0x1112('0x6e')]],'%s',_0x36a42f):_0x36a42f;_0x36a42f=_0x414f8b[_0x42f6ef][_0x1112('0x70')]?_[_0x1112('0x6f')](_0x3013c3[_0x414f8b[_0x42f6ef][_0x1112('0x70')]],'%s',_0x36a42f):_0x36a42f;if(_0x414f8b[_0x42f6ef]['groupBy']){_0x2c28c0[_0x1112('0x62')](_0x36a42f);}_0x414f8b[_0x42f6ef][_0x1112('0x72')]&&_0x2c28c0[_0x1112('0x36')](_0x36a42f,_0x414f8b[_0x42f6ef][_0x1112('0x72')]===_0x1112('0x83')?![]:!![]);_0x2c28c0[_0x1112('0x6d')](_0x36a42f,_0x414f8b[_0x42f6ef][_0x1112('0x84')]||_0x36a42f);}if(_0x2609b8[_0x1112('0x73')]){_0x2609b8[_0x1112('0x73')]=JSON['parse'](_0x2609b8[_0x1112('0x73')]);for(var _0x5abdda=0x0;_0x5abdda<_0x2609b8[_0x1112('0x73')][_0x1112('0x33')];_0x5abdda+=0x1){if(_0x2609b8['joins'][_0x5abdda]['type']&&_['includes'](_0x108079,_0x2609b8[_0x1112('0x73')][_0x5abdda][_0x1112('0x2a')])&&_0x2609b8[_0x1112('0x73')][_0x5abdda][_0x1112('0x85')]&&_0x2609b8[_0x1112('0x73')][_0x5abdda][_0x1112('0x74')]&&_0x2609b8['joins'][_0x5abdda][_0x1112('0x75')]){_0x2c28c0[_0x2609b8[_0x1112('0x73')][_0x5abdda][_0x1112('0x2a')]](_0x2609b8[_0x1112('0x73')][_0x5abdda][_0x1112('0x74')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x2609b8[_0x1112('0x76')],_0x2609b8['joins'][_0x5abdda][_0x1112('0x85')],_0x2609b8[_0x1112('0x73')][_0x5abdda][_0x1112('0x74')],_0x2609b8['joins'][_0x5abdda][_0x1112('0x75')]));}}}if(_0x2609b8[_0x1112('0x77')]){_0x2609b8[_0x1112('0x77')]=JSON[_0x1112('0x78')](_0x2609b8['conditions']);_0x2c28c0[_0x1112('0x38')](_0x17cd21(_0x2609b8[_0x1112('0x77')][_0x1112('0x62')]));}_0x1c78fc=_0x2c28c0[_0x1112('0x86')]();_0x2c28c0[_0x1112('0x18')](_0x2860d7);_0x2c28c0['offset'](0x0);return;}})['then'](function(){if(_0x1784d1[_0x1112('0x87')]===_0x1112('0x88')){return null;}var _0x510061=_[_0x1112('0x3a')](_0x1784d1,{'name':_0x1784d1[_0x1112('0x89')]||_0x1784d1[_0x1112('0x24')]||_0x2609b8[_0x1112('0x24')],'basename':_0x457010,'savename':util[_0x1112('0x70')]('%s-%s.%s',_0x1784d1[_0x1112('0x24')]||_0x2609b8['name'],require(_0x1112('0x8a'))[_0x1112('0x8b')](0x4),_0x1784d1[_0x1112('0x87')]||_0x1112('0x8c')),'reportId':_0x2609b8['id'],'reportType':_0x1112('0x8d')});return db[_0x1112('0x8e')][_0x1112('0x42')](_0x510061,{'raw':!![]});})[_0x1112('0x1d')](function(_0x513a80){if(_0x2609b8[_0x1112('0x76')]===_0x1112('0x8f')){_0x1c78fc[_0x1112('0x38')](_0x2609b8['table']+_0x1112('0x90'),_0x1784d1['startDate'],_0x1784d1[_0x1112('0x91')]);}else{_0x1c78fc[_0x1112('0x38')](_0x2609b8[_0x1112('0x76')]+_0x1112('0x92'),_0x1784d1[_0x1112('0x93')],_0x1784d1[_0x1112('0x91')]);}if(_0x513a80){logger['info'](_0x1112('0x94'),_0x1c78fc[_0x1112('0x7b')]());require(_0x1112('0x95'))[_0x1112('0x96')](path[_0x1112('0x4c')](__dirname,'../../components/export/',_0x513a80['output']),[_0x513a80['id'],_0x1c78fc[_0x1112('0x7b')](),path['join'](__dirname,_0x1112('0x97'),_0x513a80[_0x1112('0x98')]),_0x457010]);return _0x513a80;}else{var _0x470474=squel[_0x1112('0x6a')]();_0x470474[_0x1112('0x82')]('('+_0x1c78fc[_0x1112('0x7b')]()+')','countTable');_0x470474['field'](_0x1112('0x99'),_0x1112('0x19'));_0x1c78fc[_0x1112('0x18')](_0x1784d1['limit']||_0x2860d7);_0x1c78fc[_0x1112('0x16')](_0x1784d1['offset']||0x0);return dbH['sequelize'][_0x1112('0x2d')](_0x470474[_0x1112('0x7b')](),{'type':dbH[_0x1112('0x7c')][_0x1112('0x7d')][_0x1112('0x7e')]})[_0x1112('0x1d')](function(_0x2ce3bc){if(!_0x2ce3bc[_0x1112('0x33')]){_0x4ab164=0x0;}else{_0x4ab164=_0x2ce3bc[0x0][_0x1112('0x19')]||0x0;}return dbH[_0x1112('0x7c')][_0x1112('0x2d')](_0x1c78fc[_0x1112('0x7b')](),{'type':dbH[_0x1112('0x7c')]['QueryTypes'][_0x1112('0x7e')]});})[_0x1112('0x1d')](function(_0x40cc3d){return{'rows':_0x40cc3d||[],'count':_0x4ab164};});}});}exports[_0x1112('0x9a')]=function(_0x1efb43,_0x499bd5){return runReport(_0x1efb43[_0x1112('0x3e')],_0x1efb43[_0x1112('0x2d')],_0x1efb43[_0x1112('0x3b')])[_0x1112('0x1d')](respondWithResult(_0x499bd5,null))[_0x1112('0x3d')](handleError(_0x499bd5,null));};exports[_0x1112('0x9b')]=runReport;exports[_0x1112('0x2d')]=function(_0x175900,_0x8dce9a){var _0x5e2c89=0xa;var _0x27dfd8=[_0x1112('0x4c'),_0x1112('0x4d'),_0x1112('0x4e'),_0x1112('0x4f')];var _0x24e4f3={'SUM':'SUM(%s)','COUNT':_0x1112('0x51'),'COUNT DISTINCT':_0x1112('0x52'),'MAX':_0x1112('0x53'),'MIN':_0x1112('0x54'),'AVG':_0x1112('0x55'),'GROUP_CONCAT':_0x1112('0x56'),'GROUP_CONCAT ASC':_0x1112('0x57'),'GROUP_CONCAT DESC':_0x1112('0x58')};var _0x544e9d={'SEC_TO_TIME':_0x1112('0x7f'),'DATE':_0x1112('0x59'),'HOUR':_0x1112('0x5a'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x1112('0x5c')};var _0x15f8b3=function(_0x12be79){return!_[_0x1112('0x5d')]([_0x1112('0x80'),_0x1112('0x5e'),_0x1112('0x9c'),'IS\x20NOT\x20EMPTY'],_0x12be79);};var _0x2a4b26=function(_0x19d51b){if(!_0x19d51b||!_0x19d51b[_0x1112('0x60')][_0x1112('0x33')]){return'';}for(var _0x1ddc0b='(',_0x101651=0x0;_0x101651<_0x19d51b[_0x1112('0x60')]['length'];_0x101651+=0x1){_0x101651>0x0&&(_0x1ddc0b+='\x20'+_0x19d51b[_0x1112('0x61')]+'\x20');_0x1ddc0b+=_0x19d51b[_0x1112('0x60')][_0x101651][_0x1112('0x62')]?_0x2a4b26(_0x19d51b[_0x1112('0x60')][_0x101651][_0x1112('0x62')]):_0x19d51b[_0x1112('0x60')][_0x101651][_0x1112('0x6d')]+'\x20'+_0x19d51b['rules'][_0x101651][_0x1112('0x63')]+(_0x15f8b3(_0x19d51b[_0x1112('0x60')][_0x101651][_0x1112('0x63')])?'\x20'+_0x19d51b[_0x1112('0x60')][_0x101651]['value']:'');}return _0x1ddc0b+')';};var _0x3c30b={'where':{'id':_0x175900['params']['id']}},_0x2e096b,_0x5c48fc,_0x40fef3,_0x2f745b,_0x2913d5;_0x3c30b=_['merge']({},_0x3c30b,_0x175900['options']);return db[_0x1112('0x27')][_0x1112('0x41')](_0x3c30b)[_0x1112('0x1d')](function(_0x3cd264){if(_0x3cd264){_0x2e096b=_0x3cd264;return _0x3cd264[_0x1112('0x65')]();}return null;})[_0x1112('0x1d')](function(_0x161475){if(_0x161475){if(!_0x161475[_0x1112('0x33')]){throw new db[(_0x1112('0x66'))][(_0x1112('0x9d'))](_0x1112('0x81'),0x193);}_0x5c48fc=_0x161475;return db[_0x1112('0x67')][_0x1112('0x68')]({'raw':!![]});}return null;})[_0x1112('0x1d')](function(_0x450499){if(_0x450499){_0x40fef3=_[_0x1112('0x69')](_0x450499,'id');var _0x278867;var _0x21394c=squel['select']();_0x21394c[_0x1112('0x82')](_0x2e096b[_0x1112('0x76')]);for(var _0xfb64c6=0x0;_0xfb64c6<_0x5c48fc[_0x1112('0x33')];_0xfb64c6+=0x1){_0x278867=_0x5c48fc[_0xfb64c6][_0x1112('0x6b')]?_0x40fef3[_0x5c48fc[_0xfb64c6]['MetricId']]['metric']:_0x5c48fc[_0xfb64c6][_0x1112('0x6d')];_0x278867=_0x5c48fc[_0xfb64c6][_0x1112('0x6e')]?_[_0x1112('0x6f')](_0x24e4f3[_0x5c48fc[_0xfb64c6][_0x1112('0x6e')]],'%s',_0x278867):_0x278867;_0x278867=_0x5c48fc[_0xfb64c6][_0x1112('0x70')]?_[_0x1112('0x6f')](_0x544e9d[_0x5c48fc[_0xfb64c6]['format']],'%s',_0x278867):_0x278867;if(_0x5c48fc[_0xfb64c6][_0x1112('0x71')]){_0x21394c['group'](_0x278867);}_0x5c48fc[_0xfb64c6][_0x1112('0x72')]&&_0x21394c[_0x1112('0x36')](_0x278867,_0x5c48fc[_0xfb64c6]['orderBy']===_0x1112('0x83')?![]:!![]);_0x21394c['field'](_0x278867,_0x5c48fc[_0xfb64c6][_0x1112('0x84')]||_0x278867);}if(_0x2e096b[_0x1112('0x73')]){_0x2e096b[_0x1112('0x73')]=JSON[_0x1112('0x78')](_0x2e096b[_0x1112('0x73')]);for(var _0x228aa1=0x0;_0x228aa1<_0x2e096b[_0x1112('0x73')][_0x1112('0x33')];_0x228aa1+=0x1){if(_0x2e096b[_0x1112('0x73')][_0x228aa1][_0x1112('0x2a')]&&_[_0x1112('0x5d')](_0x27dfd8,_0x2e096b[_0x1112('0x73')][_0x228aa1]['type'])&&_0x2e096b['joins'][_0x228aa1][_0x1112('0x85')]&&_0x2e096b['joins'][_0x228aa1][_0x1112('0x74')]&&_0x2e096b[_0x1112('0x73')][_0x228aa1][_0x1112('0x75')]){_0x21394c[_0x2e096b[_0x1112('0x73')][_0x228aa1][_0x1112('0x2a')]](_0x2e096b[_0x1112('0x73')][_0x228aa1]['foreignTable'],null,util[_0x1112('0x70')](_0x1112('0x9e'),_0x2e096b[_0x1112('0x76')],_0x2e096b[_0x1112('0x73')][_0x228aa1]['parentKey'],_0x2e096b[_0x1112('0x73')][_0x228aa1][_0x1112('0x74')],_0x2e096b[_0x1112('0x73')][_0x228aa1][_0x1112('0x75')]));}}}if(_0x2e096b['conditions']){_0x2e096b[_0x1112('0x77')]=JSON[_0x1112('0x78')](_0x2e096b[_0x1112('0x77')]);_0x21394c[_0x1112('0x38')](_0x2a4b26(_0x2e096b[_0x1112('0x77')][_0x1112('0x62')]));}_0x2913d5=_0x21394c[_0x1112('0x86')]();_0x21394c[_0x1112('0x18')](_0x5e2c89);_0x21394c[_0x1112('0x16')](0x0);logger[_0x1112('0x79')](_0x1112('0x7a'),_0x21394c[_0x1112('0x7b')]());return dbH[_0x1112('0x7c')][_0x1112('0x2d')](_0x21394c[_0x1112('0x7b')](),{'type':dbH[_0x1112('0x7c')][_0x1112('0x7d')][_0x1112('0x7e')]});}})[_0x1112('0x1d')](function(){return{'sql':_0x2913d5[_0x1112('0x7b')]()};})['then'](respondWithResult(_0x8dce9a,null))[_0x1112('0x3d')](handleError(_0x8dce9a,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 37fb60e..c99010f 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 _0x6faf=['exports','define','analytics_custom_reports','lodash','api','moment','request-promise','path','../../config/environment'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x6faf,0x1f2));var _0xf6fa=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6faf[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xf6fa('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf6fa('0x1'));var moment=require(_0xf6fa('0x2'));var BPromise=require('bluebird');var rp=require(_0xf6fa('0x3'));var fs=require('fs');var path=require(_0xf6fa('0x4'));var rimraf=require('rimraf');var config=require(_0xf6fa('0x5'));var attributes=require('./analyticCustomReport.attributes');module[_0xf6fa('0x6')]=function(_0x5bb903,_0x556dbd){return _0x5bb903[_0xf6fa('0x7')]('AnalyticCustomReport',attributes,{'tableName':_0xf6fa('0x8'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x041f=['../../config/environment','./analyticCustomReport.attributes','exports','analytics_custom_reports','lodash','api','moment','request-promise','path','rimraf'];(function(_0x5f3e48,_0x1fcfe7){var _0x487ea7=function(_0x389ee2){while(--_0x389ee2){_0x5f3e48['push'](_0x5f3e48['shift']());}};_0x487ea7(++_0x1fcfe7);}(_0x041f,0x144));var _0xf041=function(_0x587823,_0x4a07d9){_0x587823=_0x587823-0x0;var _0x4b456c=_0x041f[_0x587823];return _0x4b456c;};'use strict';var _=require(_0xf041('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf041('0x1'));var moment=require(_0xf041('0x2'));var BPromise=require('bluebird');var rp=require(_0xf041('0x3'));var fs=require('fs');var path=require(_0xf041('0x4'));var rimraf=require(_0xf041('0x5'));var config=require(_0xf041('0x6'));var attributes=require(_0xf041('0x7'));module[_0xf041('0x8')]=function(_0x13b067,_0x20c1e6){return _0x13b067['define']('AnalyticCustomReport',attributes,{'tableName':_0xf041('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index af60264..11831db 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 _0xc75b=['rpc','jayson/promise','client','request','then','info','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','message','AnalyticCustomReport,\x20%s,\x20%s','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x10fc0e,_0x3b68d1){var _0x1f47b6=function(_0x20f622){while(--_0x20f622){_0x10fc0e['push'](_0x10fc0e['shift']());}};_0x1f47b6(++_0x3b68d1);}(_0xc75b,0xdf));var _0xbc75=function(_0x23d39d,_0x68a19f){_0x23d39d=_0x23d39d-0x0;var _0x4e0cdf=_0xc75b[_0x23d39d];return _0x4e0cdf;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbc75('0x0'));var BPromise=require(_0xbc75('0x1'));var rs=require(_0xbc75('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbc75('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xbc75('0x4'))(_0xbc75('0x5'));var config=require('../../config/environment');var jayson=require(_0xbc75('0x6'));var client=jayson[_0xbc75('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a9873,_0x1fe8c4,_0x56372f){return new BPromise(function(_0x297327,_0x34f05b){return client[_0xbc75('0x8')](_0x1a9873,_0x56372f)[_0xbc75('0x9')](function(_0x3b3cdf){logger[_0xbc75('0xa')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1fe8c4,_0xbc75('0xb'));logger[_0xbc75('0xc')](_0xbc75('0xd'),_0x1fe8c4,_0xbc75('0xb'),JSON['stringify'](_0x3b3cdf));if(_0x3b3cdf[_0xbc75('0xe')]){if(_0x3b3cdf['error']['code']===0x1f4){logger[_0xbc75('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1fe8c4,_0x3b3cdf[_0xbc75('0xe')][_0xbc75('0xf')]);return _0x34f05b(_0x3b3cdf[_0xbc75('0xe')][_0xbc75('0xf')]);}logger[_0xbc75('0xe')](_0xbc75('0x10'),_0x1fe8c4,_0x3b3cdf[_0xbc75('0xe')][_0xbc75('0xf')]);return _0x297327(_0x3b3cdf[_0xbc75('0xe')][_0xbc75('0xf')]);}else{logger[_0xbc75('0xa')](_0xbc75('0x10'),_0x1fe8c4,'request\x20sent');_0x297327(_0x3b3cdf[_0xbc75('0x11')][_0xbc75('0xf')]);}})[_0xbc75('0x12')](function(_0x47edd4){logger['error'](_0xbc75('0x10'),_0x1fe8c4,_0x47edd4);_0x34f05b(_0x47edd4);});});} \ No newline at end of file +var _0x6c0c=['randomstring','ioredis','../../config/logger','rpc','jayson/promise','http','request','then','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment'];(function(_0x5c1ef2,_0x419ad6){var _0x1600b8=function(_0x5801e9){while(--_0x5801e9){_0x5c1ef2['push'](_0x5c1ef2['shift']());}};_0x1600b8(++_0x419ad6);}(_0x6c0c,0x14d));var _0xc6c0=function(_0x5ce7a0,_0x2fccb8){_0x5ce7a0=_0x5ce7a0-0x0;var _0xc4425a=_0x6c0c[_0x5ce7a0];return _0xc4425a;};'use strict';var _=require(_0xc6c0('0x0'));var util=require(_0xc6c0('0x1'));var moment=require(_0xc6c0('0x2'));var BPromise=require('bluebird');var rs=require(_0xc6c0('0x3'));var fs=require('fs');var Redis=require(_0xc6c0('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc6c0('0x5'))(_0xc6c0('0x6'));var config=require('../../config/environment');var jayson=require(_0xc6c0('0x7'));var client=jayson['client'][_0xc6c0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3a7bc7,_0x4c56ee,_0x35c6b4){return new BPromise(function(_0x5cb1f3,_0xe5e780){return client[_0xc6c0('0x9')](_0x3a7bc7,_0x35c6b4)[_0xc6c0('0xa')](function(_0x2d2e31){logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x4c56ee,'request\x20sent');logger['debug'](_0xc6c0('0xb'),_0x4c56ee,_0xc6c0('0xc'),JSON[_0xc6c0('0xd')](_0x2d2e31));if(_0x2d2e31[_0xc6c0('0xe')]){if(_0x2d2e31[_0xc6c0('0xe')][_0xc6c0('0xf')]===0x1f4){logger[_0xc6c0('0xe')](_0xc6c0('0x10'),_0x4c56ee,_0x2d2e31[_0xc6c0('0xe')][_0xc6c0('0x11')]);return _0xe5e780(_0x2d2e31[_0xc6c0('0xe')][_0xc6c0('0x11')]);}logger[_0xc6c0('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x4c56ee,_0x2d2e31[_0xc6c0('0xe')][_0xc6c0('0x11')]);return _0x5cb1f3(_0x2d2e31[_0xc6c0('0xe')][_0xc6c0('0x11')]);}else{logger[_0xc6c0('0x12')](_0xc6c0('0x10'),_0x4c56ee,_0xc6c0('0xc'));_0x5cb1f3(_0x2d2e31[_0xc6c0('0x13')][_0xc6c0('0x11')]);}})[_0xc6c0('0x14')](function(_0x583cc6){logger['error'](_0xc6c0('0x10'),_0x4c56ee,_0x583cc6);_0xe5e780(_0x583cc6);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index ad89b7e..2ae9d33 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 _0xd143=['create','put','delete','destroy','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd143,0x138));var _0x3d14=function(_0x2fb049,_0x2a4364){_0x2fb049=_0x2fb049-0x0;var _0x22af82=_0xd143[_0x2fb049];return _0x22af82;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x3d14('0x0'));var express=require('express');var router=express[_0x3d14('0x1')]();var fs_extra=require(_0x3d14('0x2'));var auth=require(_0x3d14('0x3'));var interaction=require(_0x3d14('0x4'));var config=require(_0x3d14('0x5'));var controller=require(_0x3d14('0x6'));router[_0x3d14('0x7')]('/',auth[_0x3d14('0x8')](),controller[_0x3d14('0x9')]);router[_0x3d14('0x7')](_0x3d14('0xa'),auth['isAuthenticated'](),controller[_0x3d14('0xb')]);router[_0x3d14('0x7')](_0x3d14('0xc'),auth[_0x3d14('0x8')](),controller[_0x3d14('0xd')]);router['get'](_0x3d14('0xe'),auth[_0x3d14('0x8')](),controller[_0x3d14('0xf')]);router['get'](_0x3d14('0x10'),auth['isAuthenticated'](),controller[_0x3d14('0x11')]);router['post']('/',auth[_0x3d14('0x8')](),controller[_0x3d14('0x12')]);router[_0x3d14('0x13')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x3d14('0x14')]('/:id',auth[_0x3d14('0x8')](),controller[_0x3d14('0x15')]);module['exports']=router; \ No newline at end of file +var _0x1dc0=['../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated','/:id','show','get','preview','/:id/run','run','post','create','put','update','destroy','multer','util','connect-timeout','Router','fs-extra'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x1dc0,0xe2));var _0x01dc=function(_0x16651f,_0x1beebd){_0x16651f=_0x16651f-0x0;var _0x1b7748=_0x1dc0[_0x16651f];return _0x1b7748;};'use strict';var multer=require(_0x01dc('0x0'));var util=require(_0x01dc('0x1'));var path=require('path');var timeout=require(_0x01dc('0x2'));var express=require('express');var router=express[_0x01dc('0x3')]();var fs_extra=require(_0x01dc('0x4'));var auth=require(_0x01dc('0x5'));var interaction=require(_0x01dc('0x6'));var config=require(_0x01dc('0x7'));var controller=require(_0x01dc('0x8'));router['get']('/',auth[_0x01dc('0x9')](),controller['index']);router['get'](_0x01dc('0xa'),auth[_0x01dc('0x9')](),controller[_0x01dc('0xb')]);router[_0x01dc('0xc')]('/:id/preview',auth[_0x01dc('0x9')](),controller[_0x01dc('0xd')]);router[_0x01dc('0xc')](_0x01dc('0xe'),auth[_0x01dc('0x9')](),controller[_0x01dc('0xf')]);router['get']('/:id/query',auth[_0x01dc('0x9')](),controller['query']);router[_0x01dc('0x10')]('/',auth['isAuthenticated'](),controller[_0x01dc('0x11')]);router[_0x01dc('0x12')](_0x01dc('0xa'),auth['isAuthenticated'](),controller[_0x01dc('0x13')]);router['delete'](_0x01dc('0xa'),auth[_0x01dc('0x9')](),controller[_0x01dc('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 3f38b6c..b662ae0 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 _0x1cb9=['TEXT','sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1cb9,0x14e));var _0x91cb=function(_0x284540,_0x207799){_0x284540=_0x284540-0x0;var _0xaabefd=_0x1cb9[_0x284540];return _0xaabefd;};'use strict';var Sequelize=require(_0x91cb('0x0'));module['exports']={'name':{'type':Sequelize[_0x91cb('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x91cb('0x1')]},'parent':{'type':Sequelize[_0x91cb('0x1')]},'table':{'type':Sequelize[_0x91cb('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x91cb('0x2')]}}; \ No newline at end of file +var _0xafc4=['sequelize','STRING','TEXT'];(function(_0x4c184d,_0x4278ab){var _0x23d997=function(_0x22d068){while(--_0x22d068){_0x4c184d['push'](_0x4c184d['shift']());}};_0x23d997(++_0x4278ab);}(_0xafc4,0x69));var _0x4afc=function(_0x3f76a8,_0x16d1bb){_0x3f76a8=_0x3f76a8-0x0;var _0x4dd90d=_0xafc4[_0x3f76a8];return _0x4dd90d;};'use strict';var Sequelize=require(_0x4afc('0x0'));module['exports']={'name':{'type':Sequelize[_0x4afc('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x4afc('0x1')]},'table':{'type':Sequelize[_0x4afc('0x1')]},'conditions':{'type':Sequelize[_0x4afc('0x2')]},'joins':{'type':Sequelize[_0x4afc('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 8e4c93e..6cce05a 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 _0x2ef3=['Sequelize','from','foreignKey','output','web','fullPath','generate','csv','cdr','startDate','endDate','info','child_process','fork','../../components/export/','savename','countTable','COUNT(*)','runReport','IS\x20NULL','IS\x20NOT\x20EMPTY','metric','Limited\x20Query:','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','../../mysqldb','status','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','get','DefaultReports','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','type','key','model','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','AnalyticDefaultReport','includeAll','include','findAll','rows','catch','show','params','keys','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','autoAssociation','update','preview','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20EMPTY','operator','rules','group','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','MetricId','field','function','replace','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','table','conditions','parse','clone','debug','toString','sequelize','QueryTypes','SELECT','join','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x2ef3,0xba));var _0x32ef=function(_0x8670b9,_0x168af2){_0x8670b9=_0x8670b9-0x0;var _0x564460=_0x2ef3[_0x8670b9];return _0x564460;};'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'];var dbH=require(_0x32ef('0x18'))['dbH'];function respondWithStatusCode(_0x3e98df,_0x1ef1ae){_0x1ef1ae=_0x1ef1ae||0xcc;return function(_0x5c3eb9){if(_0x5c3eb9){return _0x3e98df['sendStatus'](_0x1ef1ae);}return _0x3e98df[_0x32ef('0x19')](_0x1ef1ae)['end']();};}function respondWithResult(_0x326fce,_0x40a6e6){_0x40a6e6=_0x40a6e6||0xc8;return function(_0x93d492){if(_0x93d492){return _0x326fce[_0x32ef('0x19')](_0x40a6e6)['json'](_0x93d492);}};}function respondWithFilteredResult(_0x55bf0b,_0x531e30){return function(_0x13db1a){if(_0x13db1a){var _0x3950e6=typeof _0x531e30[_0x32ef('0x1a')]==='undefined'&&typeof _0x531e30['limit']===_0x32ef('0x1b');var _0x1a9476=_0x13db1a[_0x32ef('0x1c')];var _0x57863c=_0x3950e6?0x0:_0x531e30[_0x32ef('0x1a')];var _0x33e230=_0x3950e6?_0x13db1a['count']:_0x531e30[_0x32ef('0x1a')]+_0x531e30[_0x32ef('0x1d')];var _0x26aff3;if(_0x33e230>=_0x1a9476){_0x33e230=_0x1a9476;_0x26aff3=0xc8;}else{_0x26aff3=0xce;}_0x55bf0b[_0x32ef('0x19')](_0x26aff3);return _0x55bf0b[_0x32ef('0x1e')](_0x32ef('0x1f'),_0x57863c+'-'+_0x33e230+'/'+_0x1a9476)['json'](_0x13db1a);}return null;};}function patchUpdates(_0x3c5b78){return function(_0x5cc3ef){try{jsonpatch[_0x32ef('0x20')](_0x5cc3ef,_0x3c5b78,!![]);}catch(_0x3a20ca){return BPromise['reject'](_0x3a20ca);}return _0x5cc3ef[_0x32ef('0x21')]();};}function saveUpdates(_0x97780,_0x5e8898){return function(_0x55f7f2){if(_0x55f7f2){return _0x55f7f2['update'](_0x97780)[_0x32ef('0x22')](function(_0xb30fab){return _0xb30fab;});}return null;};}function removeEntity(_0x225feb,_0x478bef){return function(_0x59585f){if(_0x59585f){return _0x59585f[_0x32ef('0x23')]()['then'](function(){var _0x51a412=_0x59585f[_0x32ef('0x24')]({'plain':!![]});var _0x14d4b3=_0x32ef('0x25');return db[_0x32ef('0x26')][_0x32ef('0x23')]({'where':{'type':_0x14d4b3,'resourceId':_0x51a412['id']}})[_0x32ef('0x22')](function(){return _0x59585f;});})[_0x32ef('0x22')](function(){_0x225feb[_0x32ef('0x19')](0xcc)[_0x32ef('0x27')]();});}};}function handleEntityNotFound(_0x2f52d7,_0x1335e2){return function(_0xba4b3f){if(!_0xba4b3f){_0x2f52d7['sendStatus'](0x194);}return _0xba4b3f;};}function handleError(_0xd65fde,_0x2f5d06){_0x2f5d06=_0x2f5d06||0x1f4;return function(_0x5a04cd){logger[_0x32ef('0x28')](_0x5a04cd[_0x32ef('0x29')]);if(_0x5a04cd[_0x32ef('0x2a')]){delete _0x5a04cd[_0x32ef('0x2a')];}_0xd65fde['status'](_0x2f5d06)[_0x32ef('0x2b')](_0x5a04cd);};}exports[_0x32ef('0x2c')]=function(_0x31dbc3,_0x2ac686){var _0x1b668a={},_0x1a6ed2={},_0x1a122d={'count':0x0,'rows':[]};var _0x575f3e=_[_0x32ef('0x2d')](db['AnalyticDefaultReport'][_0x32ef('0x2e')],function(_0x2b6c6a){return{'name':_0x2b6c6a['fieldName'],'type':_0x2b6c6a[_0x32ef('0x2f')][_0x32ef('0x30')]};});_0x1a6ed2[_0x32ef('0x31')]=_[_0x32ef('0x2d')](_0x575f3e,_0x32ef('0x2a'));_0x1a6ed2['query']=_['keys'](_0x31dbc3[_0x32ef('0x32')]);_0x1a6ed2['filters']=_[_0x32ef('0x33')](_0x1a6ed2[_0x32ef('0x31')],_0x1a6ed2[_0x32ef('0x32')]);_0x1b668a[_0x32ef('0x34')]=_[_0x32ef('0x33')](_0x1a6ed2[_0x32ef('0x31')],qs['fields'](_0x31dbc3['query']['fields']));_0x1b668a[_0x32ef('0x34')]=_0x1b668a[_0x32ef('0x34')][_0x32ef('0x35')]?_0x1b668a['attributes']:_0x1a6ed2['model'];if(!_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x36')](_0x32ef('0x37'))){_0x1b668a['limit']=qs['limit'](_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x1d')]);_0x1b668a[_0x32ef('0x1a')]=qs[_0x32ef('0x1a')](_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x1a')]);}_0x1b668a[_0x32ef('0x38')]=qs[_0x32ef('0x39')](_0x31dbc3[_0x32ef('0x32')]['sort']);_0x1b668a[_0x32ef('0x3a')]=qs[_0x32ef('0x3b')](_[_0x32ef('0x3c')](_0x31dbc3['query'],_0x1a6ed2[_0x32ef('0x3b')]),_0x575f3e);if(_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x3d')]){_0x1b668a[_0x32ef('0x3a')]=_[_0x32ef('0x3e')](_0x1b668a[_0x32ef('0x3a')],{'$or':_[_0x32ef('0x2d')](_0x575f3e,function(_0x1cebed){if(_0x1cebed[_0x32ef('0x2f')]!==_0x32ef('0x3f')){var _0xb4db74={};_0xb4db74[_0x1cebed[_0x32ef('0x2a')]]={'$like':'%'+_0x31dbc3['query'][_0x32ef('0x3d')]+'%'};return _0xb4db74;}})});}_0x1b668a=_[_0x32ef('0x3e')]({},_0x1b668a,_0x31dbc3[_0x32ef('0x40')]);var _0x1733e3={'where':_0x1b668a[_0x32ef('0x3a')]};return db[_0x32ef('0x41')][_0x32ef('0x1c')](_0x1733e3)['then'](function(_0x538758){_0x1a122d[_0x32ef('0x1c')]=_0x538758;if(_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x42')]){_0x1b668a[_0x32ef('0x43')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x32ef('0x44')](_0x1b668a);})[_0x32ef('0x22')](function(_0x5d2f06){_0x1a122d[_0x32ef('0x45')]=_0x5d2f06;return _0x1a122d;})['then'](respondWithFilteredResult(_0x2ac686,_0x1b668a))[_0x32ef('0x46')](handleError(_0x2ac686,null));};exports[_0x32ef('0x47')]=function(_0x37a497,_0x3be46d){var _0x2c2b62={'raw':!![],'where':{'id':_0x37a497[_0x32ef('0x48')]['id']}},_0x2310ae={};_0x2310ae[_0x32ef('0x31')]=_[_0x32ef('0x49')](db[_0x32ef('0x41')]['rawAttributes']);_0x2310ae[_0x32ef('0x32')]=_['keys'](_0x37a497[_0x32ef('0x32')]);_0x2310ae[_0x32ef('0x3b')]=_[_0x32ef('0x33')](_0x2310ae['model'],_0x2310ae[_0x32ef('0x32')]);_0x2c2b62[_0x32ef('0x34')]=_[_0x32ef('0x33')](_0x2310ae[_0x32ef('0x31')],qs[_0x32ef('0x4a')](_0x37a497[_0x32ef('0x32')][_0x32ef('0x4a')]));_0x2c2b62['attributes']=_0x2c2b62['attributes'][_0x32ef('0x35')]?_0x2c2b62[_0x32ef('0x34')]:_0x2310ae[_0x32ef('0x31')];if(_0x37a497[_0x32ef('0x32')][_0x32ef('0x42')]){_0x2c2b62[_0x32ef('0x43')]=[{'all':!![]}];}_0x2c2b62=_[_0x32ef('0x3e')]({},_0x2c2b62,_0x37a497[_0x32ef('0x40')]);return db[_0x32ef('0x41')][_0x32ef('0x4b')](_0x2c2b62)[_0x32ef('0x22')](handleEntityNotFound(_0x3be46d,null))[_0x32ef('0x22')](respondWithResult(_0x3be46d,null))[_0x32ef('0x46')](handleError(_0x3be46d,null));};exports['create']=function(_0x420f00,_0x12fbd7){return db[_0x32ef('0x41')][_0x32ef('0x4c')](_0x420f00[_0x32ef('0x4d')],{})[_0x32ef('0x22')](function(_0x278696){var _0x1acded=_0x420f00[_0x32ef('0x4e')][_0x32ef('0x24')]({'plain':!![]});if(!_0x1acded)throw new Error(_0x32ef('0x4f'));if(_0x1acded[_0x32ef('0x50')]===_0x32ef('0x4e')){var _0x326445=_0x278696[_0x32ef('0x24')]({'plain':!![]});var _0x3fb4d8=_0x32ef('0x51');return db[_0x32ef('0x52')]['find']({'where':{'name':_0x3fb4d8,'userProfileId':_0x1acded['userProfileId']},'raw':!![]})[_0x32ef('0x22')](function(_0x259c32){if(_0x259c32&&_0x259c32[_0x32ef('0x53')]===0x0){return db[_0x32ef('0x26')][_0x32ef('0x4c')]({'name':_0x326445[_0x32ef('0x2a')],'resourceId':_0x326445['id'],'type':_0x32ef('0x25'),'sectionId':_0x259c32['id']},{})[_0x32ef('0x22')](function(){return _0x278696;});}else{return _0x278696;}})[_0x32ef('0x46')](function(_0x368bf1){logger[_0x32ef('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x368bf1);throw _0x368bf1;});}return _0x278696;})[_0x32ef('0x22')](respondWithResult(_0x12fbd7,0xc9))[_0x32ef('0x46')](handleError(_0x12fbd7,null));};exports[_0x32ef('0x54')]=function(_0x3fe01f,_0x38314a){if(_0x3fe01f[_0x32ef('0x4d')]['id']){delete _0x3fe01f['body']['id'];}return db[_0x32ef('0x41')][_0x32ef('0x4b')]({'where':{'id':_0x3fe01f[_0x32ef('0x48')]['id']}})['then'](handleEntityNotFound(_0x38314a,null))[_0x32ef('0x22')](saveUpdates(_0x3fe01f['body'],null))[_0x32ef('0x22')](respondWithResult(_0x38314a,null))[_0x32ef('0x46')](handleError(_0x38314a,null));};exports['destroy']=function(_0x206ad5,_0x59e5f9){return db[_0x32ef('0x41')][_0x32ef('0x4b')]({'where':{'id':_0x206ad5[_0x32ef('0x48')]['id']}})[_0x32ef('0x22')](handleEntityNotFound(_0x59e5f9,null))[_0x32ef('0x22')](removeEntity(_0x59e5f9,null))[_0x32ef('0x46')](handleError(_0x59e5f9,null));};exports[_0x32ef('0x55')]=function(_0x56260f,_0x56cc75){var _0xdfa103=0xa;var _0x52232a=['join',_0x32ef('0x56'),_0x32ef('0x57'),_0x32ef('0x58')];var _0x6aae59={'SUM':_0x32ef('0x59'),'COUNT':_0x32ef('0x5a'),'COUNT DISTINCT':_0x32ef('0x5b'),'MAX':_0x32ef('0x5c'),'MIN':_0x32ef('0x5d'),'AVG':_0x32ef('0x5e'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x32ef('0x5f')};var _0xbd059e={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x32ef('0x60'),'HOUR':_0x32ef('0x61'),'ROUND':_0x32ef('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2ac877=function(_0x3c31d0){return!_[_0x32ef('0x63')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x32ef('0x64'),'IS\x20NOT\x20EMPTY'],_0x3c31d0);};var _0x17f447=function(_0x5bb114){if(!_0x5bb114||!_0x5bb114['rules'][_0x32ef('0x35')]){return'';}for(var _0x208989='(',_0x10cb37=0x0;_0x10cb37<_0x5bb114['rules'][_0x32ef('0x35')];_0x10cb37+=0x1){_0x10cb37>0x0&&(_0x208989+='\x20'+_0x5bb114[_0x32ef('0x65')]+'\x20');_0x208989+=_0x5bb114[_0x32ef('0x66')][_0x10cb37]['group']?_0x17f447(_0x5bb114[_0x32ef('0x66')][_0x10cb37][_0x32ef('0x67')]):_0x5bb114['rules'][_0x10cb37]['field']+'\x20'+_0x5bb114[_0x32ef('0x66')][_0x10cb37][_0x32ef('0x68')]+(_0x2ac877(_0x5bb114[_0x32ef('0x66')][_0x10cb37][_0x32ef('0x68')])?'\x20'+_0x5bb114[_0x32ef('0x66')][_0x10cb37][_0x32ef('0x69')]:'');}return _0x208989+')';};var _0x4c89e8={'where':{'id':_0x56260f[_0x32ef('0x48')]['id']}},_0x285330,_0x63b65,_0x25b6d6,_0x36ed97,_0x21e930;_0x4c89e8=_[_0x32ef('0x3e')]({},_0x4c89e8,_0x56260f[_0x32ef('0x40')]);return db[_0x32ef('0x41')]['find'](_0x4c89e8)[_0x32ef('0x22')](function(_0x29ff58){if(_0x29ff58){_0x285330=_0x29ff58;return _0x29ff58[_0x32ef('0x6a')]();}return null;})[_0x32ef('0x22')](function(_0x79ae28){if(_0x79ae28){if(!_0x79ae28['length']){throw new db['Sequelize'][(_0x32ef('0x6b'))](_0x32ef('0x6c'),0x193);}_0x63b65=_0x79ae28;return db[_0x32ef('0x6d')][_0x32ef('0x44')]({'raw':!![]});}return null;})[_0x32ef('0x22')](function(_0x526fb1){if(_0x526fb1){_0x25b6d6=_[_0x32ef('0x6e')](_0x526fb1,'id');var _0x544045;var _0x216e2f=squel[_0x32ef('0x6f')]();_0x216e2f['from'](_0x285330['table']);for(var _0x2c9f7a=0x0;_0x2c9f7a<_0x63b65[_0x32ef('0x35')];_0x2c9f7a+=0x1){_0x544045=_0x63b65[_0x2c9f7a][_0x32ef('0x70')]?_0x25b6d6[_0x63b65[_0x2c9f7a]['MetricId']]['metric']:_0x63b65[_0x2c9f7a][_0x32ef('0x71')];_0x544045=_0x63b65[_0x2c9f7a][_0x32ef('0x72')]?_[_0x32ef('0x73')](_0x6aae59[_0x63b65[_0x2c9f7a][_0x32ef('0x72')]],'%s',_0x544045):_0x544045;_0x544045=_0x63b65[_0x2c9f7a]['format']?_[_0x32ef('0x73')](_0xbd059e[_0x63b65[_0x2c9f7a][_0x32ef('0x74')]],'%s',_0x544045):_0x544045;if(_0x63b65[_0x2c9f7a][_0x32ef('0x75')]){_0x216e2f[_0x32ef('0x67')](_0x544045);}_0x63b65[_0x2c9f7a][_0x32ef('0x76')]&&_0x216e2f[_0x32ef('0x38')](_0x544045,_0x63b65[_0x2c9f7a][_0x32ef('0x76')]===_0x32ef('0x77')?![]:!![]);_0x216e2f[_0x32ef('0x71')](_0x544045,_0x63b65[_0x2c9f7a][_0x32ef('0x78')]||_0x544045);}if(_0x285330[_0x32ef('0x79')]){_0x285330[_0x32ef('0x79')]=JSON['parse'](_0x285330['joins']);for(var _0x3a9c97=0x0;_0x3a9c97<_0x285330[_0x32ef('0x79')]['length'];_0x3a9c97+=0x1){if(_0x285330[_0x32ef('0x79')][_0x3a9c97]['type']&&_[_0x32ef('0x63')](_0x52232a,_0x285330[_0x32ef('0x79')][_0x3a9c97][_0x32ef('0x2f')])&&_0x285330['joins'][_0x3a9c97][_0x32ef('0x7a')]&&_0x285330['joins'][_0x3a9c97][_0x32ef('0x7b')]&&_0x285330[_0x32ef('0x79')][_0x3a9c97]['foreignKey']){_0x216e2f[_0x285330['joins'][_0x3a9c97][_0x32ef('0x2f')]](_0x285330['joins'][_0x3a9c97][_0x32ef('0x7b')],null,util['format'](_0x32ef('0x7c'),_0x285330[_0x32ef('0x7d')],_0x285330[_0x32ef('0x79')][_0x3a9c97]['parentKey'],_0x285330['joins'][_0x3a9c97]['foreignTable'],_0x285330[_0x32ef('0x79')][_0x3a9c97]['foreignKey']));}}}if(_0x285330[_0x32ef('0x7e')]){_0x285330[_0x32ef('0x7e')]=JSON[_0x32ef('0x7f')](_0x285330[_0x32ef('0x7e')]);_0x216e2f[_0x32ef('0x3a')](_0x17f447(_0x285330[_0x32ef('0x7e')]['group']));}_0x21e930=_0x216e2f[_0x32ef('0x80')]();_0x216e2f['limit'](_0xdfa103);_0x216e2f['offset'](0x0);logger[_0x32ef('0x81')]('Limited\x20Query:',_0x216e2f[_0x32ef('0x82')]());return dbH[_0x32ef('0x83')]['query'](_0x216e2f[_0x32ef('0x82')](),{'type':dbH[_0x32ef('0x83')][_0x32ef('0x84')][_0x32ef('0x85')]});}})[_0x32ef('0x22')](respondWithResult(_0x56cc75,null))[_0x32ef('0x46')](handleError(_0x56cc75,null));};function runReport(_0x4b5506,_0x51736f,_0x35b10d){var _0x5e0b55=_0x51736f[_0x32ef('0x2a')];var _0x266688=0xa;var _0x114d8e=[_0x32ef('0x86'),_0x32ef('0x56'),_0x32ef('0x57'),'cross_join'];var _0x3232ca={'SUM':_0x32ef('0x59'),'COUNT':_0x32ef('0x5a'),'COUNT DISTINCT':_0x32ef('0x5b'),'MAX':_0x32ef('0x5c'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x32ef('0x87'),'GROUP_CONCAT ASC':_0x32ef('0x88'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x211fb1={'SEC_TO_TIME':_0x32ef('0x89'),'DATE':_0x32ef('0x60'),'HOUR':_0x32ef('0x61'),'ROUND':_0x32ef('0x62'),'UNIX_TIMESTAMP':_0x32ef('0x8a')};var _0xfb4845=function(_0x21067e){return!_[_0x32ef('0x63')](['IS\x20NULL',_0x32ef('0x8b'),_0x32ef('0x64'),'IS\x20NOT\x20EMPTY'],_0x21067e);};var _0x35653b=function(_0x5ea727){if(!_0x5ea727||!_0x5ea727[_0x32ef('0x66')]['length']){return'';}for(var _0x43f36e='(',_0x39300f=0x0;_0x39300f<_0x5ea727[_0x32ef('0x66')][_0x32ef('0x35')];_0x39300f+=0x1){_0x39300f>0x0&&(_0x43f36e+='\x20'+_0x5ea727['operator']+'\x20');_0x43f36e+=_0x5ea727[_0x32ef('0x66')][_0x39300f][_0x32ef('0x67')]?_0x35653b(_0x5ea727[_0x32ef('0x66')][_0x39300f]['group']):_0x5ea727['rules'][_0x39300f]['field']+'\x20'+_0x5ea727[_0x32ef('0x66')][_0x39300f][_0x32ef('0x68')]+(_0xfb4845(_0x5ea727[_0x32ef('0x66')][_0x39300f][_0x32ef('0x68')])?'\x20'+_0x5ea727[_0x32ef('0x66')][_0x39300f]['value']:'');}return _0x43f36e+')';};var _0x2678e3={'where':{'id':_0x4b5506['id']}},_0x5b3deb,_0x471de6,_0x7b0ea5,_0xc43e1,_0x4baa7a;_0x2678e3=_[_0x32ef('0x3e')]({},_0x2678e3,_0x35b10d);return db[_0x32ef('0x41')][_0x32ef('0x4b')](_0x2678e3)[_0x32ef('0x22')](function(_0x28bebb){if(_0x28bebb){_0x5b3deb=_0x28bebb;return _0x28bebb['getFields']();}return null;})[_0x32ef('0x22')](function(_0x484df0){if(_0x484df0){if(!_0x484df0[_0x32ef('0x35')]){throw new db[(_0x32ef('0x8c'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x471de6=_0x484df0;return db[_0x32ef('0x6d')][_0x32ef('0x44')]({'raw':!![]});}return null;})[_0x32ef('0x22')](function(_0x3b9896){if(_0x3b9896){_0x7b0ea5=_['keyBy'](_0x3b9896,'id');var _0x356fd4;var _0x51ca6e=squel['select']();_0x51ca6e[_0x32ef('0x8d')](_0x5b3deb['table']);for(var _0x2237cf=0x0;_0x2237cf<_0x471de6[_0x32ef('0x35')];_0x2237cf+=0x1){_0x356fd4=_0x471de6[_0x2237cf][_0x32ef('0x70')]?_0x7b0ea5[_0x471de6[_0x2237cf]['MetricId']]['metric']:_0x471de6[_0x2237cf][_0x32ef('0x71')];_0x356fd4=_0x471de6[_0x2237cf][_0x32ef('0x72')]?_[_0x32ef('0x73')](_0x3232ca[_0x471de6[_0x2237cf][_0x32ef('0x72')]],'%s',_0x356fd4):_0x356fd4;_0x356fd4=_0x471de6[_0x2237cf][_0x32ef('0x74')]?_[_0x32ef('0x73')](_0x211fb1[_0x471de6[_0x2237cf][_0x32ef('0x74')]],'%s',_0x356fd4):_0x356fd4;if(_0x471de6[_0x2237cf]['groupBy']){_0x51ca6e[_0x32ef('0x67')](_0x356fd4);}_0x471de6[_0x2237cf][_0x32ef('0x76')]&&_0x51ca6e[_0x32ef('0x38')](_0x356fd4,_0x471de6[_0x2237cf][_0x32ef('0x76')]==='DESC'?![]:!![]);_0x51ca6e['field'](_0x356fd4,_0x471de6[_0x2237cf][_0x32ef('0x78')]||_0x356fd4);}if(_0x5b3deb['joins']){_0x5b3deb[_0x32ef('0x79')]=JSON[_0x32ef('0x7f')](_0x5b3deb['joins']);for(var _0x5c7594=0x0;_0x5c7594<_0x5b3deb['joins'][_0x32ef('0x35')];_0x5c7594+=0x1){if(_0x5b3deb[_0x32ef('0x79')][_0x5c7594][_0x32ef('0x2f')]&&_[_0x32ef('0x63')](_0x114d8e,_0x5b3deb['joins'][_0x5c7594][_0x32ef('0x2f')])&&_0x5b3deb[_0x32ef('0x79')][_0x5c7594][_0x32ef('0x7a')]&&_0x5b3deb['joins'][_0x5c7594][_0x32ef('0x7b')]&&_0x5b3deb['joins'][_0x5c7594][_0x32ef('0x8e')]){_0x51ca6e[_0x5b3deb[_0x32ef('0x79')][_0x5c7594]['type']](_0x5b3deb['joins'][_0x5c7594][_0x32ef('0x7b')],null,util[_0x32ef('0x74')](_0x32ef('0x7c'),_0x5b3deb[_0x32ef('0x7d')],_0x5b3deb[_0x32ef('0x79')][_0x5c7594][_0x32ef('0x7a')],_0x5b3deb[_0x32ef('0x79')][_0x5c7594][_0x32ef('0x7b')],_0x5b3deb[_0x32ef('0x79')][_0x5c7594]['foreignKey']));}}}if(_0x5b3deb[_0x32ef('0x7e')]){_0x5b3deb['conditions']=JSON[_0x32ef('0x7f')](_0x5b3deb[_0x32ef('0x7e')]);_0x51ca6e[_0x32ef('0x3a')](_0x35653b(_0x5b3deb[_0x32ef('0x7e')][_0x32ef('0x67')]));}_0x4baa7a=_0x51ca6e['clone']();_0x51ca6e[_0x32ef('0x1d')](_0x266688);_0x51ca6e[_0x32ef('0x1a')](0x0);return;}})[_0x32ef('0x22')](function(){if(_0x51736f[_0x32ef('0x8f')]===_0x32ef('0x90')){return null;}var _0x1cfdd8=_[_0x32ef('0x3e')](_0x51736f,{'name':_0x51736f[_0x32ef('0x91')]||_0x51736f[_0x32ef('0x2a')]||_0x5b3deb['name'],'basename':_0x5e0b55,'savename':util['format']('%s-%s.%s',_0x51736f[_0x32ef('0x2a')]||_0x5b3deb[_0x32ef('0x2a')],require('randomstring')[_0x32ef('0x92')](0x4),_0x51736f['output']||_0x32ef('0x93')),'reportId':_0x5b3deb['id'],'reportType':'default'});return db['AnalyticExtractedReport'][_0x32ef('0x4c')](_0x1cfdd8,{'raw':!![]});})[_0x32ef('0x22')](function(_0x118d2e){if(_0x5b3deb[_0x32ef('0x7d')]===_0x32ef('0x94')){_0x4baa7a['where'](_0x5b3deb[_0x32ef('0x7d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x51736f[_0x32ef('0x95')],_0x51736f['endDate']);}else{_0x4baa7a['where'](_0x5b3deb['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x51736f['startDate'],_0x51736f[_0x32ef('0x96')]);}if(_0x118d2e){logger[_0x32ef('0x97')]('Run\x20Query:',_0x4baa7a[_0x32ef('0x82')]());require(_0x32ef('0x98'))[_0x32ef('0x99')](path[_0x32ef('0x86')](__dirname,_0x32ef('0x9a'),_0x118d2e[_0x32ef('0x8f')]),[_0x118d2e['id'],_0x4baa7a['toString'](),path[_0x32ef('0x86')](__dirname,'../../files/reports',_0x118d2e[_0x32ef('0x9b')]),_0x5e0b55]);return _0x118d2e;}else{var _0x1be713=squel['select']();_0x1be713[_0x32ef('0x8d')]('('+_0x4baa7a['toString']()+')',_0x32ef('0x9c'));_0x1be713[_0x32ef('0x71')](_0x32ef('0x9d'),_0x32ef('0x1c'));_0x4baa7a['limit'](_0x51736f[_0x32ef('0x1d')]||_0x266688);_0x4baa7a[_0x32ef('0x1a')](_0x51736f[_0x32ef('0x1a')]||0x0);return dbH[_0x32ef('0x83')]['query'](_0x1be713[_0x32ef('0x82')](),{'type':dbH['sequelize'][_0x32ef('0x84')][_0x32ef('0x85')]})[_0x32ef('0x22')](function(_0x28ef17){if(!_0x28ef17[_0x32ef('0x35')]){_0xc43e1=0x0;}else{_0xc43e1=_0x28ef17[0x0][_0x32ef('0x1c')]||0x0;}return dbH['sequelize'][_0x32ef('0x32')](_0x4baa7a['toString'](),{'type':dbH['sequelize'][_0x32ef('0x84')][_0x32ef('0x85')]});})[_0x32ef('0x22')](function(_0x3956e7){return{'rows':_0x3956e7||[],'count':_0xc43e1};});}});}exports['run']=function(_0x8d3b24,_0x642716){return runReport(_0x8d3b24[_0x32ef('0x48')],_0x8d3b24[_0x32ef('0x32')],_0x8d3b24['options'])['then'](respondWithResult(_0x642716,null))['catch'](handleError(_0x642716,null));};exports[_0x32ef('0x9e')]=runReport;exports[_0x32ef('0x32')]=function(_0x4454f3,_0xc92dcc){var _0x3d18b9=0xa;var _0x9233cb=[_0x32ef('0x86'),_0x32ef('0x56'),_0x32ef('0x57'),_0x32ef('0x58')];var _0xa76912={'SUM':'SUM(%s)','COUNT':_0x32ef('0x5a'),'COUNT DISTINCT':_0x32ef('0x5b'),'MAX':_0x32ef('0x5c'),'MIN':_0x32ef('0x5d'),'AVG':_0x32ef('0x5e'),'GROUP_CONCAT':_0x32ef('0x87'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x32ef('0x5f')};var _0x1526a1={'SEC_TO_TIME':_0x32ef('0x89'),'DATE':_0x32ef('0x60'),'HOUR':_0x32ef('0x61'),'ROUND':_0x32ef('0x62'),'UNIX_TIMESTAMP':_0x32ef('0x8a')};var _0x2d4d2f=function(_0x292488){return!_[_0x32ef('0x63')]([_0x32ef('0x9f'),_0x32ef('0x8b'),_0x32ef('0x64'),_0x32ef('0xa0')],_0x292488);};var _0x50b674=function(_0x379d40){if(!_0x379d40||!_0x379d40[_0x32ef('0x66')][_0x32ef('0x35')]){return'';}for(var _0x4b7a4d='(',_0x16525b=0x0;_0x16525b<_0x379d40['rules'][_0x32ef('0x35')];_0x16525b+=0x1){_0x16525b>0x0&&(_0x4b7a4d+='\x20'+_0x379d40[_0x32ef('0x65')]+'\x20');_0x4b7a4d+=_0x379d40[_0x32ef('0x66')][_0x16525b]['group']?_0x50b674(_0x379d40[_0x32ef('0x66')][_0x16525b]['group']):_0x379d40[_0x32ef('0x66')][_0x16525b][_0x32ef('0x71')]+'\x20'+_0x379d40['rules'][_0x16525b][_0x32ef('0x68')]+(_0x2d4d2f(_0x379d40[_0x32ef('0x66')][_0x16525b][_0x32ef('0x68')])?'\x20'+_0x379d40[_0x32ef('0x66')][_0x16525b][_0x32ef('0x69')]:'');}return _0x4b7a4d+')';};var _0x264075={'where':{'id':_0x4454f3[_0x32ef('0x48')]['id']}},_0x3798d1,_0x4befa9,_0x493ae9,_0x143d39,_0x497948;_0x264075=_[_0x32ef('0x3e')]({},_0x264075,_0x4454f3['options']);return db[_0x32ef('0x41')][_0x32ef('0x4b')](_0x264075)['then'](function(_0x1200c9){if(_0x1200c9){_0x3798d1=_0x1200c9;return _0x1200c9[_0x32ef('0x6a')]();}return null;})[_0x32ef('0x22')](function(_0xa5f787){if(_0xa5f787){if(!_0xa5f787[_0x32ef('0x35')]){throw new db['Sequelize'][(_0x32ef('0x6b'))](_0x32ef('0x6c'),0x193);}_0x4befa9=_0xa5f787;return db['AnalyticMetric'][_0x32ef('0x44')]({'raw':!![]});}return null;})[_0x32ef('0x22')](function(_0x55ad11){if(_0x55ad11){_0x493ae9=_[_0x32ef('0x6e')](_0x55ad11,'id');var _0x2971a8;var _0x522c22=squel[_0x32ef('0x6f')]();_0x522c22[_0x32ef('0x8d')](_0x3798d1['table']);for(var _0xb41a01=0x0;_0xb41a01<_0x4befa9[_0x32ef('0x35')];_0xb41a01+=0x1){_0x2971a8=_0x4befa9[_0xb41a01][_0x32ef('0x70')]?_0x493ae9[_0x4befa9[_0xb41a01][_0x32ef('0x70')]][_0x32ef('0xa1')]:_0x4befa9[_0xb41a01][_0x32ef('0x71')];_0x2971a8=_0x4befa9[_0xb41a01][_0x32ef('0x72')]?_['replace'](_0xa76912[_0x4befa9[_0xb41a01]['function']],'%s',_0x2971a8):_0x2971a8;_0x2971a8=_0x4befa9[_0xb41a01][_0x32ef('0x74')]?_[_0x32ef('0x73')](_0x1526a1[_0x4befa9[_0xb41a01][_0x32ef('0x74')]],'%s',_0x2971a8):_0x2971a8;if(_0x4befa9[_0xb41a01]['groupBy']){_0x522c22[_0x32ef('0x67')](_0x2971a8);}_0x4befa9[_0xb41a01][_0x32ef('0x76')]&&_0x522c22['order'](_0x2971a8,_0x4befa9[_0xb41a01][_0x32ef('0x76')]===_0x32ef('0x77')?![]:!![]);_0x522c22['field'](_0x2971a8,_0x4befa9[_0xb41a01]['alias']||_0x2971a8);}if(_0x3798d1[_0x32ef('0x79')]){_0x3798d1[_0x32ef('0x79')]=JSON[_0x32ef('0x7f')](_0x3798d1['joins']);for(var _0x5f4eab=0x0;_0x5f4eab<_0x3798d1['joins'][_0x32ef('0x35')];_0x5f4eab+=0x1){if(_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x2f')]&&_['includes'](_0x9233cb,_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x2f')])&&_0x3798d1[_0x32ef('0x79')][_0x5f4eab]['parentKey']&&_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x7b')]&&_0x3798d1['joins'][_0x5f4eab]['foreignKey']){_0x522c22[_0x3798d1[_0x32ef('0x79')][_0x5f4eab]['type']](_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x7b')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x3798d1[_0x32ef('0x7d')],_0x3798d1['joins'][_0x5f4eab][_0x32ef('0x7a')],_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x7b')],_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x8e')]));}}}if(_0x3798d1[_0x32ef('0x7e')]){_0x3798d1[_0x32ef('0x7e')]=JSON[_0x32ef('0x7f')](_0x3798d1[_0x32ef('0x7e')]);_0x522c22[_0x32ef('0x3a')](_0x50b674(_0x3798d1['conditions']['group']));}_0x497948=_0x522c22[_0x32ef('0x80')]();_0x522c22[_0x32ef('0x1d')](_0x3d18b9);_0x522c22[_0x32ef('0x1a')](0x0);logger[_0x32ef('0x81')](_0x32ef('0xa2'),_0x522c22[_0x32ef('0x82')]());return dbH[_0x32ef('0x83')][_0x32ef('0x32')](_0x522c22[_0x32ef('0x82')](),{'type':dbH[_0x32ef('0x83')]['QueryTypes'][_0x32ef('0x85')]});}})[_0x32ef('0x22')](function(){return{'sql':_0x497948[_0x32ef('0x82')]()};})[_0x32ef('0x22')](respondWithResult(_0xc92dcc,null))[_0x32ef('0x46')](handleError(_0xc92dcc,null));}; \ No newline at end of file +var _0x5fab=['debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','COUNT(DISTINCT\x20%s)','from','function','order','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','run','params','runReport','AVG(%s)','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','status','end','limit','undefined','count','offset','Content-Range','apply','save','update','then','destroy','get','DefaultReports','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','query','where','pick','filters','filter','VIRTUAL','merge','options','include','findAll','rows','catch','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','table','MetricId','metric','replace','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone'];(function(_0x590b95,_0x4c93de){var _0x1aa83f=function(_0x5cb8be){while(--_0x5cb8be){_0x590b95['push'](_0x590b95['shift']());}};_0x1aa83f(++_0x4c93de);}(_0x5fab,0x177));var _0xb5fa=function(_0x11ead2,_0x70de8a){_0x11ead2=_0x11ead2-0x0;var _0x3cac96=_0x5fab[_0x11ead2];return _0x3cac96;};'use strict';var emlformat=require(_0xb5fa('0x0'));var rimraf=require(_0xb5fa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb5fa('0x2'));var rp=require(_0xb5fa('0x3'));var moment=require(_0xb5fa('0x4'));var BPromise=require(_0xb5fa('0x5'));var Mustache=require(_0xb5fa('0x6'));var util=require(_0xb5fa('0x7'));var path=require(_0xb5fa('0x8'));var sox=require(_0xb5fa('0x9'));var csv=require(_0xb5fa('0xa'));var ejs=require(_0xb5fa('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb5fa('0xc'));var crypto=require(_0xb5fa('0xd'));var jsforce=require(_0xb5fa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb5fa('0xa'));var querystring=require(_0xb5fa('0xf'));var Papa=require(_0xb5fa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb5fa('0x11'));var as=require(_0xb5fa('0x12'));var hardwareService=require(_0xb5fa('0x13'));var logger=require(_0xb5fa('0x14'))(_0xb5fa('0x15'));var utils=require(_0xb5fa('0x16'));var config=require(_0xb5fa('0x17'));var licenseUtil=require(_0xb5fa('0x18'));var db=require(_0xb5fa('0x19'))['db'];var dbH=require('../../mysqldb')[_0xb5fa('0x1a')];function respondWithStatusCode(_0x3dad4d,_0x56e8b0){_0x56e8b0=_0x56e8b0||0xcc;return function(_0x116849){if(_0x116849){return _0x3dad4d['sendStatus'](_0x56e8b0);}return _0x3dad4d[_0xb5fa('0x1b')](_0x56e8b0)[_0xb5fa('0x1c')]();};}function respondWithResult(_0x40c914,_0xca8d82){_0xca8d82=_0xca8d82||0xc8;return function(_0x8e9d1c){if(_0x8e9d1c){return _0x40c914['status'](_0xca8d82)['json'](_0x8e9d1c);}};}function respondWithFilteredResult(_0x38e964,_0x587043){return function(_0x31f252){if(_0x31f252){var _0x27c8f7=typeof _0x587043['offset']==='undefined'&&typeof _0x587043[_0xb5fa('0x1d')]===_0xb5fa('0x1e');var _0x32e9e5=_0x31f252[_0xb5fa('0x1f')];var _0x324ba5=_0x27c8f7?0x0:_0x587043[_0xb5fa('0x20')];var _0x3b0f69=_0x27c8f7?_0x31f252[_0xb5fa('0x1f')]:_0x587043[_0xb5fa('0x20')]+_0x587043[_0xb5fa('0x1d')];var _0x3c8d53;if(_0x3b0f69>=_0x32e9e5){_0x3b0f69=_0x32e9e5;_0x3c8d53=0xc8;}else{_0x3c8d53=0xce;}_0x38e964[_0xb5fa('0x1b')](_0x3c8d53);return _0x38e964['set'](_0xb5fa('0x21'),_0x324ba5+'-'+_0x3b0f69+'/'+_0x32e9e5)['json'](_0x31f252);}return null;};}function patchUpdates(_0x37ae06){return function(_0x4a6c04){try{jsonpatch[_0xb5fa('0x22')](_0x4a6c04,_0x37ae06,!![]);}catch(_0x43c09f){return BPromise['reject'](_0x43c09f);}return _0x4a6c04[_0xb5fa('0x23')]();};}function saveUpdates(_0x3a2ab9,_0x283a56){return function(_0x47f71a){if(_0x47f71a){return _0x47f71a[_0xb5fa('0x24')](_0x3a2ab9)[_0xb5fa('0x25')](function(_0x444237){return _0x444237;});}return null;};}function removeEntity(_0x542348,_0x224ec8){return function(_0x5d55f7){if(_0x5d55f7){return _0x5d55f7[_0xb5fa('0x26')]()[_0xb5fa('0x25')](function(){var _0x11053a=_0x5d55f7[_0xb5fa('0x27')]({'plain':!![]});var _0x2dbd22=_0xb5fa('0x28');return db[_0xb5fa('0x29')][_0xb5fa('0x26')]({'where':{'type':_0x2dbd22,'resourceId':_0x11053a['id']}})['then'](function(){return _0x5d55f7;});})['then'](function(){_0x542348['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x28a350,_0x460b54){return function(_0x12c0d4){if(!_0x12c0d4){_0x28a350[_0xb5fa('0x2a')](0x194);}return _0x12c0d4;};}function handleError(_0x534884,_0x3506a4){_0x3506a4=_0x3506a4||0x1f4;return function(_0x358549){logger[_0xb5fa('0x2b')](_0x358549[_0xb5fa('0x2c')]);if(_0x358549[_0xb5fa('0x2d')]){delete _0x358549[_0xb5fa('0x2d')];}_0x534884[_0xb5fa('0x1b')](_0x3506a4)[_0xb5fa('0x2e')](_0x358549);};}exports[_0xb5fa('0x2f')]=function(_0xed02e,_0x116773){var _0x5a0152={},_0x3fd1fb={},_0x21fc7e={'count':0x0,'rows':[]};var _0x319c48=_[_0xb5fa('0x30')](db[_0xb5fa('0x31')][_0xb5fa('0x32')],function(_0x25fc7c){return{'name':_0x25fc7c['fieldName'],'type':_0x25fc7c[_0xb5fa('0x33')]['key']};});_0x3fd1fb['model']=_['map'](_0x319c48,_0xb5fa('0x2d'));_0x3fd1fb['query']=_[_0xb5fa('0x34')](_0xed02e['query']);_0x3fd1fb['filters']=_[_0xb5fa('0x35')](_0x3fd1fb[_0xb5fa('0x36')],_0x3fd1fb['query']);_0x5a0152['attributes']=_[_0xb5fa('0x35')](_0x3fd1fb[_0xb5fa('0x36')],qs[_0xb5fa('0x37')](_0xed02e['query'][_0xb5fa('0x37')]));_0x5a0152[_0xb5fa('0x38')]=_0x5a0152['attributes'][_0xb5fa('0x39')]?_0x5a0152[_0xb5fa('0x38')]:_0x3fd1fb[_0xb5fa('0x36')];if(!_0xed02e['query'][_0xb5fa('0x3a')](_0xb5fa('0x3b'))){_0x5a0152[_0xb5fa('0x1d')]=qs['limit'](_0xed02e[_0xb5fa('0x3c')][_0xb5fa('0x1d')]);_0x5a0152[_0xb5fa('0x20')]=qs[_0xb5fa('0x20')](_0xed02e['query']['offset']);}_0x5a0152['order']=qs['sort'](_0xed02e['query']['sort']);_0x5a0152[_0xb5fa('0x3d')]=qs['filters'](_[_0xb5fa('0x3e')](_0xed02e[_0xb5fa('0x3c')],_0x3fd1fb[_0xb5fa('0x3f')]),_0x319c48);if(_0xed02e[_0xb5fa('0x3c')][_0xb5fa('0x40')]){_0x5a0152[_0xb5fa('0x3d')]=_['merge'](_0x5a0152['where'],{'$or':_['map'](_0x319c48,function(_0x534b38){if(_0x534b38['type']!==_0xb5fa('0x41')){var _0x5addd5={};_0x5addd5[_0x534b38['name']]={'$like':'%'+_0xed02e[_0xb5fa('0x3c')][_0xb5fa('0x40')]+'%'};return _0x5addd5;}})});}_0x5a0152=_[_0xb5fa('0x42')]({},_0x5a0152,_0xed02e[_0xb5fa('0x43')]);var _0x5bc93f={'where':_0x5a0152[_0xb5fa('0x3d')]};return db[_0xb5fa('0x31')][_0xb5fa('0x1f')](_0x5bc93f)[_0xb5fa('0x25')](function(_0x402a68){_0x21fc7e['count']=_0x402a68;if(_0xed02e[_0xb5fa('0x3c')]['includeAll']){_0x5a0152[_0xb5fa('0x44')]=[{'all':!![]}];}return db[_0xb5fa('0x31')][_0xb5fa('0x45')](_0x5a0152);})[_0xb5fa('0x25')](function(_0x1c706b){_0x21fc7e[_0xb5fa('0x46')]=_0x1c706b;return _0x21fc7e;})[_0xb5fa('0x25')](respondWithFilteredResult(_0x116773,_0x5a0152))[_0xb5fa('0x47')](handleError(_0x116773,null));};exports['show']=function(_0x1c3c2c,_0xc03e44){var _0x59ae64={'raw':!![],'where':{'id':_0x1c3c2c['params']['id']}},_0x293c19={};_0x293c19[_0xb5fa('0x36')]=_[_0xb5fa('0x34')](db['AnalyticDefaultReport']['rawAttributes']);_0x293c19[_0xb5fa('0x3c')]=_[_0xb5fa('0x34')](_0x1c3c2c[_0xb5fa('0x3c')]);_0x293c19[_0xb5fa('0x3f')]=_[_0xb5fa('0x35')](_0x293c19[_0xb5fa('0x36')],_0x293c19[_0xb5fa('0x3c')]);_0x59ae64[_0xb5fa('0x38')]=_['intersection'](_0x293c19[_0xb5fa('0x36')],qs[_0xb5fa('0x37')](_0x1c3c2c['query'][_0xb5fa('0x37')]));_0x59ae64[_0xb5fa('0x38')]=_0x59ae64[_0xb5fa('0x38')][_0xb5fa('0x39')]?_0x59ae64[_0xb5fa('0x38')]:_0x293c19[_0xb5fa('0x36')];if(_0x1c3c2c[_0xb5fa('0x3c')][_0xb5fa('0x48')]){_0x59ae64[_0xb5fa('0x44')]=[{'all':!![]}];}_0x59ae64=_[_0xb5fa('0x42')]({},_0x59ae64,_0x1c3c2c[_0xb5fa('0x43')]);return db[_0xb5fa('0x31')][_0xb5fa('0x49')](_0x59ae64)[_0xb5fa('0x25')](handleEntityNotFound(_0xc03e44,null))[_0xb5fa('0x25')](respondWithResult(_0xc03e44,null))[_0xb5fa('0x47')](handleError(_0xc03e44,null));};exports['create']=function(_0x56dceb,_0x46194d){return db['AnalyticDefaultReport'][_0xb5fa('0x4a')](_0x56dceb[_0xb5fa('0x4b')],{})['then'](function(_0x4ef1d0){var _0x2931a7=_0x56dceb[_0xb5fa('0x4c')][_0xb5fa('0x27')]({'plain':!![]});if(!_0x2931a7)throw new Error(_0xb5fa('0x4d'));if(_0x2931a7[_0xb5fa('0x4e')]==='user'){var _0x27a651=_0x4ef1d0['get']({'plain':!![]});var _0x251d36=_0xb5fa('0x4f');return db[_0xb5fa('0x50')]['find']({'where':{'name':_0x251d36,'userProfileId':_0x2931a7[_0xb5fa('0x51')]},'raw':!![]})[_0xb5fa('0x25')](function(_0x4dea87){if(_0x4dea87&&_0x4dea87['autoAssociation']===0x0){return db[_0xb5fa('0x29')][_0xb5fa('0x4a')]({'name':_0x27a651[_0xb5fa('0x2d')],'resourceId':_0x27a651['id'],'type':_0xb5fa('0x28'),'sectionId':_0x4dea87['id']},{})[_0xb5fa('0x25')](function(){return _0x4ef1d0;});}else{return _0x4ef1d0;}})[_0xb5fa('0x47')](function(_0x31c91f){logger[_0xb5fa('0x2b')](_0xb5fa('0x52'),_0x31c91f);throw _0x31c91f;});}return _0x4ef1d0;})[_0xb5fa('0x25')](respondWithResult(_0x46194d,0xc9))[_0xb5fa('0x47')](handleError(_0x46194d,null));};exports[_0xb5fa('0x24')]=function(_0x3ccfd1,_0x2799e7){if(_0x3ccfd1[_0xb5fa('0x4b')]['id']){delete _0x3ccfd1[_0xb5fa('0x4b')]['id'];}return db[_0xb5fa('0x31')][_0xb5fa('0x49')]({'where':{'id':_0x3ccfd1['params']['id']}})[_0xb5fa('0x25')](handleEntityNotFound(_0x2799e7,null))[_0xb5fa('0x25')](saveUpdates(_0x3ccfd1[_0xb5fa('0x4b')],null))[_0xb5fa('0x25')](respondWithResult(_0x2799e7,null))[_0xb5fa('0x47')](handleError(_0x2799e7,null));};exports[_0xb5fa('0x26')]=function(_0x4224cf,_0x24117e){return db[_0xb5fa('0x31')][_0xb5fa('0x49')]({'where':{'id':_0x4224cf['params']['id']}})['then'](handleEntityNotFound(_0x24117e,null))[_0xb5fa('0x25')](removeEntity(_0x24117e,null))[_0xb5fa('0x47')](handleError(_0x24117e,null));};exports[_0xb5fa('0x53')]=function(_0x5caf84,_0x441c41){var _0x367f7a=0xa;var _0x1572fb=[_0xb5fa('0x54'),_0xb5fa('0x55'),_0xb5fa('0x56'),_0xb5fa('0x57')];var _0x4f82f0={'SUM':_0xb5fa('0x58'),'COUNT':_0xb5fa('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xb5fa('0x5a'),'MIN':_0xb5fa('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb5fa('0x5c'),'GROUP_CONCAT ASC':_0xb5fa('0x5d'),'GROUP_CONCAT DESC':_0xb5fa('0x5e')};var _0x2b9a45={'SEC_TO_TIME':_0xb5fa('0x5f'),'DATE':_0xb5fa('0x60'),'HOUR':_0xb5fa('0x61'),'ROUND':_0xb5fa('0x62'),'UNIX_TIMESTAMP':_0xb5fa('0x63')};var _0x1c24e3=function(_0xfb88cc){return!_[_0xb5fa('0x64')]([_0xb5fa('0x65'),_0xb5fa('0x66'),_0xb5fa('0x67'),_0xb5fa('0x68')],_0xfb88cc);};var _0x41cce9=function(_0x23fb01){if(!_0x23fb01||!_0x23fb01[_0xb5fa('0x69')][_0xb5fa('0x39')]){return'';}for(var _0x421a93='(',_0x36fc0f=0x0;_0x36fc0f<_0x23fb01['rules'][_0xb5fa('0x39')];_0x36fc0f+=0x1){_0x36fc0f>0x0&&(_0x421a93+='\x20'+_0x23fb01[_0xb5fa('0x6a')]+'\x20');_0x421a93+=_0x23fb01[_0xb5fa('0x69')][_0x36fc0f]['group']?_0x41cce9(_0x23fb01[_0xb5fa('0x69')][_0x36fc0f][_0xb5fa('0x6b')]):_0x23fb01['rules'][_0x36fc0f][_0xb5fa('0x6c')]+'\x20'+_0x23fb01[_0xb5fa('0x69')][_0x36fc0f][_0xb5fa('0x6d')]+(_0x1c24e3(_0x23fb01['rules'][_0x36fc0f]['condition'])?'\x20'+_0x23fb01[_0xb5fa('0x69')][_0x36fc0f][_0xb5fa('0x6e')]:'');}return _0x421a93+')';};var _0x432f04={'where':{'id':_0x5caf84['params']['id']}},_0x57d8b7,_0x597206,_0x30d53b,_0x199555,_0x12b0a2;_0x432f04=_['merge']({},_0x432f04,_0x5caf84['options']);return db[_0xb5fa('0x31')][_0xb5fa('0x49')](_0x432f04)[_0xb5fa('0x25')](function(_0x4ce1bd){if(_0x4ce1bd){_0x57d8b7=_0x4ce1bd;return _0x4ce1bd[_0xb5fa('0x6f')]();}return null;})[_0xb5fa('0x25')](function(_0x13ef3a){if(_0x13ef3a){if(!_0x13ef3a[_0xb5fa('0x39')]){throw new db[(_0xb5fa('0x70'))][(_0xb5fa('0x71'))](_0xb5fa('0x72'),0x193);}_0x597206=_0x13ef3a;return db[_0xb5fa('0x73')][_0xb5fa('0x45')]({'raw':!![]});}return null;})[_0xb5fa('0x25')](function(_0x3a1db9){if(_0x3a1db9){_0x30d53b=_[_0xb5fa('0x74')](_0x3a1db9,'id');var _0xecdff3;var _0x38faa6=squel[_0xb5fa('0x75')]();_0x38faa6['from'](_0x57d8b7[_0xb5fa('0x76')]);for(var _0x5a6f74=0x0;_0x5a6f74<_0x597206[_0xb5fa('0x39')];_0x5a6f74+=0x1){_0xecdff3=_0x597206[_0x5a6f74][_0xb5fa('0x77')]?_0x30d53b[_0x597206[_0x5a6f74][_0xb5fa('0x77')]][_0xb5fa('0x78')]:_0x597206[_0x5a6f74][_0xb5fa('0x6c')];_0xecdff3=_0x597206[_0x5a6f74]['function']?_[_0xb5fa('0x79')](_0x4f82f0[_0x597206[_0x5a6f74]['function']],'%s',_0xecdff3):_0xecdff3;_0xecdff3=_0x597206[_0x5a6f74][_0xb5fa('0x7a')]?_[_0xb5fa('0x79')](_0x2b9a45[_0x597206[_0x5a6f74][_0xb5fa('0x7a')]],'%s',_0xecdff3):_0xecdff3;if(_0x597206[_0x5a6f74][_0xb5fa('0x7b')]){_0x38faa6['group'](_0xecdff3);}_0x597206[_0x5a6f74]['orderBy']&&_0x38faa6['order'](_0xecdff3,_0x597206[_0x5a6f74][_0xb5fa('0x7c')]===_0xb5fa('0x7d')?![]:!![]);_0x38faa6[_0xb5fa('0x6c')](_0xecdff3,_0x597206[_0x5a6f74][_0xb5fa('0x7e')]||_0xecdff3);}if(_0x57d8b7[_0xb5fa('0x7f')]){_0x57d8b7[_0xb5fa('0x7f')]=JSON['parse'](_0x57d8b7[_0xb5fa('0x7f')]);for(var _0x5c08e1=0x0;_0x5c08e1<_0x57d8b7['joins'][_0xb5fa('0x39')];_0x5c08e1+=0x1){if(_0x57d8b7['joins'][_0x5c08e1]['type']&&_['includes'](_0x1572fb,_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1]['type'])&&_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x80')]&&_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1]['foreignTable']&&_0x57d8b7['joins'][_0x5c08e1][_0xb5fa('0x81')]){_0x38faa6[_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1]['type']](_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x82')],null,util[_0xb5fa('0x7a')](_0xb5fa('0x83'),_0x57d8b7['table'],_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x80')],_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x82')],_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x81')]));}}}if(_0x57d8b7[_0xb5fa('0x84')]){_0x57d8b7['conditions']=JSON[_0xb5fa('0x85')](_0x57d8b7['conditions']);_0x38faa6[_0xb5fa('0x3d')](_0x41cce9(_0x57d8b7[_0xb5fa('0x84')]['group']));}_0x12b0a2=_0x38faa6[_0xb5fa('0x86')]();_0x38faa6[_0xb5fa('0x1d')](_0x367f7a);_0x38faa6[_0xb5fa('0x20')](0x0);logger[_0xb5fa('0x87')](_0xb5fa('0x88'),_0x38faa6[_0xb5fa('0x89')]());return dbH[_0xb5fa('0x8a')][_0xb5fa('0x3c')](_0x38faa6['toString'](),{'type':dbH[_0xb5fa('0x8a')][_0xb5fa('0x8b')][_0xb5fa('0x8c')]});}})[_0xb5fa('0x25')](respondWithResult(_0x441c41,null))['catch'](handleError(_0x441c41,null));};function runReport(_0x593386,_0x47d72b,_0x5557a3){var _0x1c60bd=_0x47d72b[_0xb5fa('0x2d')];var _0xff504d=0xa;var _0x188e66=['join','left_join',_0xb5fa('0x56'),'cross_join'];var _0x32eebd={'SUM':_0xb5fa('0x58'),'COUNT':_0xb5fa('0x59'),'COUNT DISTINCT':_0xb5fa('0x8d'),'MAX':'MAX(%s)','MIN':_0xb5fa('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb5fa('0x5c'),'GROUP_CONCAT ASC':_0xb5fa('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5e6852={'SEC_TO_TIME':_0xb5fa('0x5f'),'DATE':_0xb5fa('0x60'),'HOUR':_0xb5fa('0x61'),'ROUND':_0xb5fa('0x62'),'UNIX_TIMESTAMP':_0xb5fa('0x63')};var _0xa7fd3b=function(_0x42e210){return!_[_0xb5fa('0x64')]([_0xb5fa('0x65'),_0xb5fa('0x66'),_0xb5fa('0x67'),_0xb5fa('0x68')],_0x42e210);};var _0x86dfe9=function(_0x53c7b5){if(!_0x53c7b5||!_0x53c7b5['rules'][_0xb5fa('0x39')]){return'';}for(var _0x52384b='(',_0x1cb113=0x0;_0x1cb113<_0x53c7b5[_0xb5fa('0x69')]['length'];_0x1cb113+=0x1){_0x1cb113>0x0&&(_0x52384b+='\x20'+_0x53c7b5[_0xb5fa('0x6a')]+'\x20');_0x52384b+=_0x53c7b5[_0xb5fa('0x69')][_0x1cb113]['group']?_0x86dfe9(_0x53c7b5[_0xb5fa('0x69')][_0x1cb113][_0xb5fa('0x6b')]):_0x53c7b5['rules'][_0x1cb113][_0xb5fa('0x6c')]+'\x20'+_0x53c7b5[_0xb5fa('0x69')][_0x1cb113][_0xb5fa('0x6d')]+(_0xa7fd3b(_0x53c7b5['rules'][_0x1cb113]['condition'])?'\x20'+_0x53c7b5[_0xb5fa('0x69')][_0x1cb113][_0xb5fa('0x6e')]:'');}return _0x52384b+')';};var _0x3b5e1d={'where':{'id':_0x593386['id']}},_0x3d18a9,_0x397830,_0x234d9d,_0x10222c,_0x1eec65;_0x3b5e1d=_[_0xb5fa('0x42')]({},_0x3b5e1d,_0x5557a3);return db[_0xb5fa('0x31')]['find'](_0x3b5e1d)['then'](function(_0x3c5563){if(_0x3c5563){_0x3d18a9=_0x3c5563;return _0x3c5563[_0xb5fa('0x6f')]();}return null;})[_0xb5fa('0x25')](function(_0x18498d){if(_0x18498d){if(!_0x18498d['length']){throw new db[(_0xb5fa('0x70'))][(_0xb5fa('0x71'))](_0xb5fa('0x72'),0x193);}_0x397830=_0x18498d;return db['AnalyticMetric'][_0xb5fa('0x45')]({'raw':!![]});}return null;})[_0xb5fa('0x25')](function(_0x109dd9){if(_0x109dd9){_0x234d9d=_[_0xb5fa('0x74')](_0x109dd9,'id');var _0x5ba2e7;var _0x1175da=squel[_0xb5fa('0x75')]();_0x1175da[_0xb5fa('0x8e')](_0x3d18a9[_0xb5fa('0x76')]);for(var _0x19717a=0x0;_0x19717a<_0x397830[_0xb5fa('0x39')];_0x19717a+=0x1){_0x5ba2e7=_0x397830[_0x19717a][_0xb5fa('0x77')]?_0x234d9d[_0x397830[_0x19717a][_0xb5fa('0x77')]][_0xb5fa('0x78')]:_0x397830[_0x19717a][_0xb5fa('0x6c')];_0x5ba2e7=_0x397830[_0x19717a][_0xb5fa('0x8f')]?_[_0xb5fa('0x79')](_0x32eebd[_0x397830[_0x19717a][_0xb5fa('0x8f')]],'%s',_0x5ba2e7):_0x5ba2e7;_0x5ba2e7=_0x397830[_0x19717a][_0xb5fa('0x7a')]?_[_0xb5fa('0x79')](_0x5e6852[_0x397830[_0x19717a]['format']],'%s',_0x5ba2e7):_0x5ba2e7;if(_0x397830[_0x19717a][_0xb5fa('0x7b')]){_0x1175da[_0xb5fa('0x6b')](_0x5ba2e7);}_0x397830[_0x19717a][_0xb5fa('0x7c')]&&_0x1175da[_0xb5fa('0x90')](_0x5ba2e7,_0x397830[_0x19717a][_0xb5fa('0x7c')]===_0xb5fa('0x7d')?![]:!![]);_0x1175da[_0xb5fa('0x6c')](_0x5ba2e7,_0x397830[_0x19717a][_0xb5fa('0x7e')]||_0x5ba2e7);}if(_0x3d18a9['joins']){_0x3d18a9['joins']=JSON[_0xb5fa('0x85')](_0x3d18a9['joins']);for(var _0x5d0ca8=0x0;_0x5d0ca8<_0x3d18a9[_0xb5fa('0x7f')][_0xb5fa('0x39')];_0x5d0ca8+=0x1){if(_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8]['type']&&_[_0xb5fa('0x64')](_0x188e66,_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x33')])&&_0x3d18a9['joins'][_0x5d0ca8][_0xb5fa('0x80')]&&_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8]['foreignTable']&&_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x81')]){_0x1175da[_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x33')]](_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x82')],null,util[_0xb5fa('0x7a')]('%s.%s\x20=\x20%s.%s',_0x3d18a9[_0xb5fa('0x76')],_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x80')],_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8]['foreignTable'],_0x3d18a9['joins'][_0x5d0ca8][_0xb5fa('0x81')]));}}}if(_0x3d18a9[_0xb5fa('0x84')]){_0x3d18a9[_0xb5fa('0x84')]=JSON[_0xb5fa('0x85')](_0x3d18a9['conditions']);_0x1175da['where'](_0x86dfe9(_0x3d18a9['conditions']['group']));}_0x1eec65=_0x1175da[_0xb5fa('0x86')]();_0x1175da[_0xb5fa('0x1d')](_0xff504d);_0x1175da[_0xb5fa('0x20')](0x0);return;}})[_0xb5fa('0x25')](function(){if(_0x47d72b[_0xb5fa('0x91')]===_0xb5fa('0x92')){return null;}var _0x3c36a8=_[_0xb5fa('0x42')](_0x47d72b,{'name':_0x47d72b[_0xb5fa('0x93')]||_0x47d72b[_0xb5fa('0x2d')]||_0x3d18a9[_0xb5fa('0x2d')],'basename':_0x1c60bd,'savename':util['format'](_0xb5fa('0x94'),_0x47d72b[_0xb5fa('0x2d')]||_0x3d18a9['name'],require(_0xb5fa('0x95'))[_0xb5fa('0x96')](0x4),_0x47d72b['output']||_0xb5fa('0x97')),'reportId':_0x3d18a9['id'],'reportType':_0xb5fa('0x98')});return db[_0xb5fa('0x99')][_0xb5fa('0x4a')](_0x3c36a8,{'raw':!![]});})[_0xb5fa('0x25')](function(_0x2b449a){if(_0x3d18a9[_0xb5fa('0x76')]===_0xb5fa('0x9a')){_0x1eec65[_0xb5fa('0x3d')](_0x3d18a9['table']+_0xb5fa('0x9b'),_0x47d72b[_0xb5fa('0x9c')],_0x47d72b[_0xb5fa('0x9d')]);}else{_0x1eec65[_0xb5fa('0x3d')](_0x3d18a9[_0xb5fa('0x76')]+_0xb5fa('0x9e'),_0x47d72b[_0xb5fa('0x9c')],_0x47d72b[_0xb5fa('0x9d')]);}if(_0x2b449a){logger['info'](_0xb5fa('0x9f'),_0x1eec65['toString']());require(_0xb5fa('0xa0'))[_0xb5fa('0xa1')](path[_0xb5fa('0x54')](__dirname,_0xb5fa('0xa2'),_0x2b449a[_0xb5fa('0x91')]),[_0x2b449a['id'],_0x1eec65[_0xb5fa('0x89')](),path[_0xb5fa('0x54')](__dirname,_0xb5fa('0xa3'),_0x2b449a[_0xb5fa('0xa4')]),_0x1c60bd]);return _0x2b449a;}else{var _0x4bb9b4=squel['select']();_0x4bb9b4[_0xb5fa('0x8e')]('('+_0x1eec65[_0xb5fa('0x89')]()+')',_0xb5fa('0xa5'));_0x4bb9b4[_0xb5fa('0x6c')]('COUNT(*)',_0xb5fa('0x1f'));_0x1eec65['limit'](_0x47d72b[_0xb5fa('0x1d')]||_0xff504d);_0x1eec65[_0xb5fa('0x20')](_0x47d72b['offset']||0x0);return dbH[_0xb5fa('0x8a')]['query'](_0x4bb9b4[_0xb5fa('0x89')](),{'type':dbH['sequelize'][_0xb5fa('0x8b')][_0xb5fa('0x8c')]})[_0xb5fa('0x25')](function(_0x70e4ae){if(!_0x70e4ae[_0xb5fa('0x39')]){_0x10222c=0x0;}else{_0x10222c=_0x70e4ae[0x0][_0xb5fa('0x1f')]||0x0;}return dbH[_0xb5fa('0x8a')][_0xb5fa('0x3c')](_0x1eec65[_0xb5fa('0x89')](),{'type':dbH[_0xb5fa('0x8a')][_0xb5fa('0x8b')]['SELECT']});})[_0xb5fa('0x25')](function(_0x284b34){return{'rows':_0x284b34||[],'count':_0x10222c};});}});}exports[_0xb5fa('0xa6')]=function(_0x497931,_0x2145d8){return runReport(_0x497931[_0xb5fa('0xa7')],_0x497931[_0xb5fa('0x3c')],_0x497931[_0xb5fa('0x43')])[_0xb5fa('0x25')](respondWithResult(_0x2145d8,null))[_0xb5fa('0x47')](handleError(_0x2145d8,null));};exports[_0xb5fa('0xa8')]=runReport;exports[_0xb5fa('0x3c')]=function(_0x59fd75,_0x245ee1){var _0x5c1e1f=0xa;var _0x3ba723=[_0xb5fa('0x54'),_0xb5fa('0x55'),_0xb5fa('0x56'),_0xb5fa('0x57')];var _0x105c0f={'SUM':_0xb5fa('0x58'),'COUNT':_0xb5fa('0x59'),'COUNT DISTINCT':_0xb5fa('0x8d'),'MAX':_0xb5fa('0x5a'),'MIN':_0xb5fa('0x5b'),'AVG':_0xb5fa('0xa9'),'GROUP_CONCAT':_0xb5fa('0x5c'),'GROUP_CONCAT ASC':_0xb5fa('0x5d'),'GROUP_CONCAT DESC':_0xb5fa('0x5e')};var _0x41e086={'SEC_TO_TIME':_0xb5fa('0x5f'),'DATE':'DATE(%s)','HOUR':_0xb5fa('0x61'),'ROUND':_0xb5fa('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xd34c31=function(_0x2e614e){return!_['includes'](['IS\x20NULL','IS\x20NOT\x20NULL',_0xb5fa('0x67'),_0xb5fa('0x68')],_0x2e614e);};var _0x1aae82=function(_0x474bb){if(!_0x474bb||!_0x474bb[_0xb5fa('0x69')][_0xb5fa('0x39')]){return'';}for(var _0x17ae50='(',_0x51c9ba=0x0;_0x51c9ba<_0x474bb['rules']['length'];_0x51c9ba+=0x1){_0x51c9ba>0x0&&(_0x17ae50+='\x20'+_0x474bb[_0xb5fa('0x6a')]+'\x20');_0x17ae50+=_0x474bb['rules'][_0x51c9ba]['group']?_0x1aae82(_0x474bb[_0xb5fa('0x69')][_0x51c9ba]['group']):_0x474bb[_0xb5fa('0x69')][_0x51c9ba][_0xb5fa('0x6c')]+'\x20'+_0x474bb[_0xb5fa('0x69')][_0x51c9ba][_0xb5fa('0x6d')]+(_0xd34c31(_0x474bb[_0xb5fa('0x69')][_0x51c9ba]['condition'])?'\x20'+_0x474bb[_0xb5fa('0x69')][_0x51c9ba][_0xb5fa('0x6e')]:'');}return _0x17ae50+')';};var _0x2fe715={'where':{'id':_0x59fd75[_0xb5fa('0xa7')]['id']}},_0x3c5ac4,_0x23b70f,_0x488818,_0x15b228,_0x42fd84;_0x2fe715=_[_0xb5fa('0x42')]({},_0x2fe715,_0x59fd75[_0xb5fa('0x43')]);return db[_0xb5fa('0x31')]['find'](_0x2fe715)[_0xb5fa('0x25')](function(_0x390043){if(_0x390043){_0x3c5ac4=_0x390043;return _0x390043[_0xb5fa('0x6f')]();}return null;})[_0xb5fa('0x25')](function(_0x32c191){if(_0x32c191){if(!_0x32c191[_0xb5fa('0x39')]){throw new db[(_0xb5fa('0x70'))][(_0xb5fa('0x71'))](_0xb5fa('0x72'),0x193);}_0x23b70f=_0x32c191;return db[_0xb5fa('0x73')][_0xb5fa('0x45')]({'raw':!![]});}return null;})[_0xb5fa('0x25')](function(_0x1d307c){if(_0x1d307c){_0x488818=_[_0xb5fa('0x74')](_0x1d307c,'id');var _0x3347eb;var _0x349e0b=squel[_0xb5fa('0x75')]();_0x349e0b[_0xb5fa('0x8e')](_0x3c5ac4[_0xb5fa('0x76')]);for(var _0x2b1c3f=0x0;_0x2b1c3f<_0x23b70f[_0xb5fa('0x39')];_0x2b1c3f+=0x1){_0x3347eb=_0x23b70f[_0x2b1c3f][_0xb5fa('0x77')]?_0x488818[_0x23b70f[_0x2b1c3f]['MetricId']]['metric']:_0x23b70f[_0x2b1c3f][_0xb5fa('0x6c')];_0x3347eb=_0x23b70f[_0x2b1c3f][_0xb5fa('0x8f')]?_[_0xb5fa('0x79')](_0x105c0f[_0x23b70f[_0x2b1c3f][_0xb5fa('0x8f')]],'%s',_0x3347eb):_0x3347eb;_0x3347eb=_0x23b70f[_0x2b1c3f][_0xb5fa('0x7a')]?_[_0xb5fa('0x79')](_0x41e086[_0x23b70f[_0x2b1c3f]['format']],'%s',_0x3347eb):_0x3347eb;if(_0x23b70f[_0x2b1c3f]['groupBy']){_0x349e0b['group'](_0x3347eb);}_0x23b70f[_0x2b1c3f][_0xb5fa('0x7c')]&&_0x349e0b[_0xb5fa('0x90')](_0x3347eb,_0x23b70f[_0x2b1c3f]['orderBy']===_0xb5fa('0x7d')?![]:!![]);_0x349e0b[_0xb5fa('0x6c')](_0x3347eb,_0x23b70f[_0x2b1c3f]['alias']||_0x3347eb);}if(_0x3c5ac4[_0xb5fa('0x7f')]){_0x3c5ac4[_0xb5fa('0x7f')]=JSON[_0xb5fa('0x85')](_0x3c5ac4[_0xb5fa('0x7f')]);for(var _0x10dbdf=0x0;_0x10dbdf<_0x3c5ac4[_0xb5fa('0x7f')][_0xb5fa('0x39')];_0x10dbdf+=0x1){if(_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['type']&&_[_0xb5fa('0x64')](_0x3ba723,_0x3c5ac4['joins'][_0x10dbdf][_0xb5fa('0x33')])&&_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x80')]&&_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['foreignTable']&&_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x81')]){_0x349e0b[_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x33')]](_0x3c5ac4['joins'][_0x10dbdf][_0xb5fa('0x82')],null,util[_0xb5fa('0x7a')](_0xb5fa('0x83'),_0x3c5ac4[_0xb5fa('0x76')],_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x80')],_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['foreignTable'],_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['foreignKey']));}}}if(_0x3c5ac4[_0xb5fa('0x84')]){_0x3c5ac4[_0xb5fa('0x84')]=JSON[_0xb5fa('0x85')](_0x3c5ac4[_0xb5fa('0x84')]);_0x349e0b[_0xb5fa('0x3d')](_0x1aae82(_0x3c5ac4[_0xb5fa('0x84')][_0xb5fa('0x6b')]));}_0x42fd84=_0x349e0b['clone']();_0x349e0b['limit'](_0x5c1e1f);_0x349e0b[_0xb5fa('0x20')](0x0);logger[_0xb5fa('0x87')](_0xb5fa('0x88'),_0x349e0b[_0xb5fa('0x89')]());return dbH[_0xb5fa('0x8a')][_0xb5fa('0x3c')](_0x349e0b[_0xb5fa('0x89')](),{'type':dbH[_0xb5fa('0x8a')]['QueryTypes'][_0xb5fa('0x8c')]});}})[_0xb5fa('0x25')](function(){return{'sql':_0x42fd84[_0xb5fa('0x89')]()};})[_0xb5fa('0x25')](respondWithResult(_0x245ee1,null))[_0xb5fa('0x47')](handleError(_0x245ee1,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 0a3b37d..0ad6b65 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 _0x9fe9=['util','../../config/logger','api','request-promise','rimraf','./analyticDefaultReport.attributes','define','AnalyticDefaultReport','analytics_default_reports','lodash'];(function(_0x25c38f,_0x1538b4){var _0x2de94e=function(_0x3b836d){while(--_0x3b836d){_0x25c38f['push'](_0x25c38f['shift']());}};_0x2de94e(++_0x1538b4);}(_0x9fe9,0x1c1));var _0x99fe=function(_0x3baa05,_0x207228){_0x3baa05=_0x3baa05-0x0;var _0x3b2b8d=_0x9fe9[_0x3baa05];return _0x3b2b8d;};'use strict';var _=require(_0x99fe('0x0'));var util=require(_0x99fe('0x1'));var logger=require(_0x99fe('0x2'))(_0x99fe('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x99fe('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x99fe('0x5'));var config=require('../../config/environment');var attributes=require(_0x99fe('0x6'));module['exports']=function(_0x25f9ed,_0xd96fb9){return _0x25f9ed[_0x99fe('0x7')](_0x99fe('0x8'),attributes,{'tableName':_0x99fe('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5402=['util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','AnalyticDefaultReport','analytics_default_reports'];(function(_0x5b6a55,_0xd81f6b){var _0x362e73=function(_0x3c293d){while(--_0x3c293d){_0x5b6a55['push'](_0x5b6a55['shift']());}};_0x362e73(++_0xd81f6b);}(_0x5402,0xf2));var _0x2540=function(_0x4b6b65,_0xdbdfd2){_0x4b6b65=_0x4b6b65-0x0;var _0x3207ed=_0x5402[_0x4b6b65];return _0x3207ed;};'use strict';var _=require('lodash');var util=require(_0x2540('0x0'));var logger=require(_0x2540('0x1'))('api');var moment=require(_0x2540('0x2'));var BPromise=require('bluebird');var rp=require(_0x2540('0x3'));var fs=require('fs');var path=require(_0x2540('0x4'));var rimraf=require(_0x2540('0x5'));var config=require(_0x2540('0x6'));var attributes=require(_0x2540('0x7'));module[_0x2540('0x8')]=function(_0x14154f,_0x424cd5){return _0x14154f['define'](_0x2540('0x9'),attributes,{'tableName':_0x2540('0xa'),'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 f34db5f..c665eb0 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 _0x86e0=['rpc','jayson/promise','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2f5b04,_0x56202c){var _0x2b587c=function(_0x18479c){while(--_0x18479c){_0x2f5b04['push'](_0x2f5b04['shift']());}};_0x2b587c(++_0x56202c);}(_0x86e0,0x1f3));var _0x086e=function(_0x189cef,_0x515130){_0x189cef=_0x189cef-0x0;var _0x332a74=_0x86e0[_0x189cef];return _0x332a74;};'use strict';var _=require(_0x086e('0x0'));var util=require('util');var moment=require(_0x086e('0x1'));var BPromise=require('bluebird');var rs=require(_0x086e('0x2'));var fs=require('fs');var Redis=require(_0x086e('0x3'));var db=require(_0x086e('0x4'))['db'];var utils=require(_0x086e('0x5'));var logger=require(_0x086e('0x6'))(_0x086e('0x7'));var config=require('../../config/environment');var jayson=require(_0x086e('0x8'));var client=jayson['client'][_0x086e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x576c1f,_0x3aa423,_0x2f32cf){return new BPromise(function(_0x454d2d,_0x30b38c){return client[_0x086e('0xa')](_0x576c1f,_0x2f32cf)[_0x086e('0xb')](function(_0xefffdb){logger[_0x086e('0xc')](_0x086e('0xd'),_0x3aa423,_0x086e('0xe'));logger[_0x086e('0xf')](_0x086e('0x10'),_0x3aa423,_0x086e('0xe'),JSON[_0x086e('0x11')](_0xefffdb));if(_0xefffdb[_0x086e('0x12')]){if(_0xefffdb['error'][_0x086e('0x13')]===0x1f4){logger[_0x086e('0x12')](_0x086e('0xd'),_0x3aa423,_0xefffdb[_0x086e('0x12')][_0x086e('0x14')]);return _0x30b38c(_0xefffdb[_0x086e('0x12')][_0x086e('0x14')]);}logger['error'](_0x086e('0xd'),_0x3aa423,_0xefffdb[_0x086e('0x12')][_0x086e('0x14')]);return _0x454d2d(_0xefffdb[_0x086e('0x12')]['message']);}else{logger[_0x086e('0xc')](_0x086e('0xd'),_0x3aa423,_0x086e('0xe'));_0x454d2d(_0xefffdb[_0x086e('0x15')][_0x086e('0x14')]);}})[_0x086e('0x16')](function(_0x241758){logger[_0x086e('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3aa423,_0x241758);_0x30b38c(_0x241758);});});} \ No newline at end of file +var _0xc8aa=['stringify','error','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s'];(function(_0x25c988,_0xce8221){var _0x45fcc2=function(_0x47fba5){while(--_0x47fba5){_0x25c988['push'](_0x25c988['shift']());}};_0x45fcc2(++_0xce8221);}(_0xc8aa,0x14e));var _0xac8a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc8aa[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xac8a('0x0'));var util=require(_0xac8a('0x1'));var moment=require(_0xac8a('0x2'));var BPromise=require(_0xac8a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xac8a('0x4'));var db=require(_0xac8a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xac8a('0x6'))(_0xac8a('0x7'));var config=require(_0xac8a('0x8'));var jayson=require(_0xac8a('0x9'));var client=jayson[_0xac8a('0xa')][_0xac8a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b4b1c,_0x5d83f7,_0x29b0e7){return new BPromise(function(_0x21fc5b,_0x1f7ea2){return client['request'](_0x1b4b1c,_0x29b0e7)[_0xac8a('0xc')](function(_0xf7a48c){logger[_0xac8a('0xd')](_0xac8a('0xe'),_0x5d83f7,_0xac8a('0xf'));logger[_0xac8a('0x10')](_0xac8a('0x11'),_0x5d83f7,'request\x20sent',JSON[_0xac8a('0x12')](_0xf7a48c));if(_0xf7a48c[_0xac8a('0x13')]){if(_0xf7a48c[_0xac8a('0x13')]['code']===0x1f4){logger[_0xac8a('0x13')](_0xac8a('0xe'),_0x5d83f7,_0xf7a48c[_0xac8a('0x13')][_0xac8a('0x14')]);return _0x1f7ea2(_0xf7a48c[_0xac8a('0x13')][_0xac8a('0x14')]);}logger['error'](_0xac8a('0xe'),_0x5d83f7,_0xf7a48c[_0xac8a('0x13')][_0xac8a('0x14')]);return _0x21fc5b(_0xf7a48c[_0xac8a('0x13')]['message']);}else{logger[_0xac8a('0xd')](_0xac8a('0xe'),_0x5d83f7,_0xac8a('0xf'));_0x21fc5b(_0xf7a48c[_0xac8a('0x15')]['message']);}})['catch'](function(_0x238641){logger['error'](_0xac8a('0xe'),_0x5d83f7,_0x238641);_0x1f7ea2(_0x238641);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index e3c7318..125f5c3 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 _0xc6a2=['get','isAuthenticated','index','/:id','/:id/preview','preview','/:id/run','run','query','post','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller'];(function(_0x13ce0c,_0x3f2a0d){var _0x4388fb=function(_0x27db4b){while(--_0x27db4b){_0x13ce0c['push'](_0x13ce0c['shift']());}};_0x4388fb(++_0x3f2a0d);}(_0xc6a2,0x69));var _0x2c6a=function(_0x4c7ce9,_0x3428df){_0x4c7ce9=_0x4c7ce9-0x0;var _0x37eee2=_0xc6a2[_0x4c7ce9];return _0x37eee2;};'use strict';var multer=require(_0x2c6a('0x0'));var util=require(_0x2c6a('0x1'));var path=require('path');var timeout=require(_0x2c6a('0x2'));var express=require(_0x2c6a('0x3'));var router=express[_0x2c6a('0x4')]();var fs_extra=require(_0x2c6a('0x5'));var auth=require(_0x2c6a('0x6'));var interaction=require(_0x2c6a('0x7'));var config=require(_0x2c6a('0x8'));var controller=require(_0x2c6a('0x9'));router[_0x2c6a('0xa')]('/',auth[_0x2c6a('0xb')](),controller[_0x2c6a('0xc')]);router[_0x2c6a('0xa')](_0x2c6a('0xd'),auth[_0x2c6a('0xb')](),controller['show']);router[_0x2c6a('0xa')](_0x2c6a('0xe'),auth[_0x2c6a('0xb')](),controller[_0x2c6a('0xf')]);router[_0x2c6a('0xa')](_0x2c6a('0x10'),auth[_0x2c6a('0xb')](),controller[_0x2c6a('0x11')]);router['get']('/:id/query',auth[_0x2c6a('0xb')](),controller[_0x2c6a('0x12')]);router[_0x2c6a('0x13')]('/',auth[_0x2c6a('0xb')](),controller['create']);router['put'](_0x2c6a('0xd'),auth[_0x2c6a('0xb')](),controller[_0x2c6a('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x2c6a('0x15')]);module[_0x2c6a('0x16')]=router; \ No newline at end of file +var _0x4b95=['/:id/preview','/:id/run','run','/:id/query','query','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index'];(function(_0x372129,_0x539547){var _0x2385b4=function(_0x17969f){while(--_0x17969f){_0x372129['push'](_0x372129['shift']());}};_0x2385b4(++_0x539547);}(_0x4b95,0x1d7));var _0x54b9=function(_0x36f051,_0x34b4ab){_0x36f051=_0x36f051-0x0;var _0x32bed7=_0x4b95[_0x36f051];return _0x32bed7;};'use strict';var multer=require(_0x54b9('0x0'));var util=require(_0x54b9('0x1'));var path=require(_0x54b9('0x2'));var timeout=require(_0x54b9('0x3'));var express=require('express');var router=express[_0x54b9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x54b9('0x5'));var interaction=require(_0x54b9('0x6'));var config=require(_0x54b9('0x7'));var controller=require(_0x54b9('0x8'));router[_0x54b9('0x9')]('/',auth[_0x54b9('0xa')](),controller[_0x54b9('0xb')]);router[_0x54b9('0x9')]('/:id',auth[_0x54b9('0xa')](),controller['show']);router[_0x54b9('0x9')](_0x54b9('0xc'),auth['isAuthenticated'](),controller['preview']);router[_0x54b9('0x9')](_0x54b9('0xd'),auth[_0x54b9('0xa')](),controller[_0x54b9('0xe')]);router['get'](_0x54b9('0xf'),auth[_0x54b9('0xa')](),controller[_0x54b9('0x10')]);router['post']('/',auth[_0x54b9('0xa')](),controller[_0x54b9('0x11')]);router[_0x54b9('0x12')](_0x54b9('0x13'),auth[_0x54b9('0xa')](),controller[_0x54b9('0x14')]);router[_0x54b9('0x15')](_0x54b9('0x13'),auth[_0x54b9('0xa')](),controller[_0x54b9('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 0211e30..1c99979 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 _0x1b4d=['moment','exports','STRING','csv','pdf','DATE','Loading','ENUM','scheduled','manual','UNSIGNED'];(function(_0x2841d8,_0x32296e){var _0x4e2df3=function(_0x31003e){while(--_0x31003e){_0x2841d8['push'](_0x2841d8['shift']());}};_0x4e2df3(++_0x32296e);}(_0x1b4d,0x1ef));var _0xd1b4=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x1b4d[_0x28947d];return _0x12d2ee;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xd1b4('0x0'));module[_0xd1b4('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0xd1b4('0x2')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0xd1b4('0x3'),_0xd1b4('0x4'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0xd1b4('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0xd1b4('0x5')]},'endDate':{'type':Sequelize[_0xd1b4('0x5')]},'status':{'type':Sequelize[_0xd1b4('0x2')],'defaultValue':_0xd1b4('0x6')},'type':{'type':Sequelize[_0xd1b4('0x7')]('manual',_0xd1b4('0x8')),'allowNull':![],'defaultValue':_0xd1b4('0x9')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0xd1b4('0xa')]},'reportType':{'type':Sequelize[_0xd1b4('0x2')]}}; \ No newline at end of file +var _0xc05e=['UNSIGNED','sequelize','moment','exports','STRING','ENUM','pdf','DATE','Loading','manual','INTEGER'];(function(_0x24eb35,_0x4209a5){var _0x4c2f13=function(_0x5b222d){while(--_0x5b222d){_0x24eb35['push'](_0x24eb35['shift']());}};_0x4c2f13(++_0x4209a5);}(_0xc05e,0x64));var _0xec05=function(_0xc34199,_0xebd421){_0xc34199=_0xc34199-0x0;var _0xb0fa0c=_0xc05e[_0xc34199];return _0xb0fa0c;};'use strict';var Sequelize=require(_0xec05('0x0'));var moment=require(_0xec05('0x1'));module[_0xec05('0x2')]={'name':{'type':Sequelize[_0xec05('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0xec05('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0xec05('0x4')]('csv',_0xec05('0x5'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0xec05('0x3')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0xec05('0x6')]},'status':{'type':Sequelize[_0xec05('0x3')],'defaultValue':_0xec05('0x7')},'type':{'type':Sequelize[_0xec05('0x4')](_0xec05('0x8'),'scheduled'),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0xec05('0x9')](0xb)[_0xec05('0xa')]},'reportType':{'type':Sequelize[_0xec05('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 2ce4d5f..08cfce6 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 _0x016a=['keys','model','attributes','intersection','fields','hasOwnProperty','nolimit','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','rows','show','params','length','include','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','basename','output','existsSync','join','root','server/files/reports','Sequelize','exists','download','savename','format','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','reject','update','then','get','ExtractedReports','UserProfileResource','error','name','send','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','query'];(function(_0x2f599f,_0x111228){var _0x42efc6=function(_0x573b99){while(--_0x573b99){_0x2f599f['push'](_0x2f599f['shift']());}};_0x42efc6(++_0x111228);}(_0x016a,0xee));var _0xa016=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0x016a[_0x373dee];return _0x46798f;};'use strict';var emlformat=require(_0xa016('0x0'));var rimraf=require(_0xa016('0x1'));var zipdir=require(_0xa016('0x2'));var jsonpatch=require(_0xa016('0x3'));var rp=require(_0xa016('0x4'));var moment=require(_0xa016('0x5'));var BPromise=require(_0xa016('0x6'));var Mustache=require(_0xa016('0x7'));var util=require(_0xa016('0x8'));var path=require(_0xa016('0x9'));var sox=require(_0xa016('0xa'));var csv=require(_0xa016('0xb'));var ejs=require(_0xa016('0xc'));var fs=require('fs');var fs_extra=require(_0xa016('0xd'));var _=require(_0xa016('0xe'));var squel=require(_0xa016('0xf'));var crypto=require(_0xa016('0x10'));var jsforce=require('jsforce');var deskjs=require(_0xa016('0x11'));var toCsv=require(_0xa016('0xb'));var querystring=require(_0xa016('0x12'));var Papa=require(_0xa016('0x13'));var Redis=require(_0xa016('0x14'));var authService=require(_0xa016('0x15'));var qs=require(_0xa016('0x16'));var as=require(_0xa016('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa016('0x18'))(_0xa016('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa016('0x1a'));var db=require(_0xa016('0x1b'))['db'];function respondWithStatusCode(_0x53512f,_0x1ce96c){_0x1ce96c=_0x1ce96c||0xcc;return function(_0x56836d){if(_0x56836d){return _0x53512f[_0xa016('0x1c')](_0x1ce96c);}return _0x53512f[_0xa016('0x1d')](_0x1ce96c)[_0xa016('0x1e')]();};}function respondWithResult(_0x232cd4,_0x3567b4){_0x3567b4=_0x3567b4||0xc8;return function(_0x5b0d11){if(_0x5b0d11){return _0x232cd4['status'](_0x3567b4)[_0xa016('0x1f')](_0x5b0d11);}};}function respondWithFilteredResult(_0x18361e,_0x5ceb21){return function(_0x4c6187){if(_0x4c6187){var _0x450f4d=typeof _0x5ceb21['offset']===_0xa016('0x20')&&typeof _0x5ceb21[_0xa016('0x21')]===_0xa016('0x20');var _0x40a7d2=_0x4c6187['count'];var _0x303b9a=_0x450f4d?0x0:_0x5ceb21[_0xa016('0x22')];var _0x3c8bd7=_0x450f4d?_0x4c6187['count']:_0x5ceb21[_0xa016('0x22')]+_0x5ceb21[_0xa016('0x21')];var _0x2ad233;if(_0x3c8bd7>=_0x40a7d2){_0x3c8bd7=_0x40a7d2;_0x2ad233=0xc8;}else{_0x2ad233=0xce;}_0x18361e[_0xa016('0x1d')](_0x2ad233);return _0x18361e[_0xa016('0x23')](_0xa016('0x24'),_0x303b9a+'-'+_0x3c8bd7+'/'+_0x40a7d2)[_0xa016('0x1f')](_0x4c6187);}return null;};}function patchUpdates(_0x1c1286){return function(_0x577a85){try{jsonpatch['apply'](_0x577a85,_0x1c1286,!![]);}catch(_0x5381ef){return BPromise[_0xa016('0x25')](_0x5381ef);}return _0x577a85['save']();};}function saveUpdates(_0x5a1093,_0x427652){return function(_0x3002bb){if(_0x3002bb){return _0x3002bb[_0xa016('0x26')](_0x5a1093)[_0xa016('0x27')](function(_0x1d610b){return _0x1d610b;});}return null;};}function removeEntity(_0x2da0d8,_0xcebaea){return function(_0x2a2971){if(_0x2a2971){return _0x2a2971['destroy']()['then'](function(){var _0xf1309=_0x2a2971[_0xa016('0x28')]({'plain':!![]});var _0x444bdf=_0xa016('0x29');return db[_0xa016('0x2a')]['destroy']({'where':{'type':_0x444bdf,'resourceId':_0xf1309['id']}})[_0xa016('0x27')](function(){return _0x2a2971;});})[_0xa016('0x27')](function(){_0x2da0d8[_0xa016('0x1d')](0xcc)[_0xa016('0x1e')]();});}};}function handleEntityNotFound(_0x15d297,_0x2da888){return function(_0x185732){if(!_0x185732){_0x15d297[_0xa016('0x1c')](0x194);}return _0x185732;};}function handleError(_0xe9bd65,_0x3e2db7){_0x3e2db7=_0x3e2db7||0x1f4;return function(_0x6597a8){logger[_0xa016('0x2b')](_0x6597a8['stack']);if(_0x6597a8[_0xa016('0x2c')]){delete _0x6597a8[_0xa016('0x2c')];}_0xe9bd65[_0xa016('0x1d')](_0x3e2db7)[_0xa016('0x2d')](_0x6597a8);};}exports['index']=function(_0x406da2,_0x7794fe){var _0x2e5b94={},_0xfcf6ad={},_0x16000a={'count':0x0,'rows':[]};var _0x498483=_[_0xa016('0x2e')](db[_0xa016('0x2f')][_0xa016('0x30')],function(_0x2c9e24){return{'name':_0x2c9e24[_0xa016('0x31')],'type':_0x2c9e24[_0xa016('0x32')][_0xa016('0x33')]};});_0xfcf6ad['model']=_[_0xa016('0x2e')](_0x498483,_0xa016('0x2c'));_0xfcf6ad[_0xa016('0x34')]=_[_0xa016('0x35')](_0x406da2[_0xa016('0x34')]);_0xfcf6ad['filters']=_['intersection'](_0xfcf6ad[_0xa016('0x36')],_0xfcf6ad[_0xa016('0x34')]);_0x2e5b94[_0xa016('0x37')]=_[_0xa016('0x38')](_0xfcf6ad['model'],qs[_0xa016('0x39')](_0x406da2['query'][_0xa016('0x39')]));_0x2e5b94[_0xa016('0x37')]=_0x2e5b94[_0xa016('0x37')]['length']?_0x2e5b94[_0xa016('0x37')]:_0xfcf6ad[_0xa016('0x36')];if(!_0x406da2[_0xa016('0x34')][_0xa016('0x3a')](_0xa016('0x3b'))){_0x2e5b94[_0xa016('0x21')]=qs[_0xa016('0x21')](_0x406da2[_0xa016('0x34')][_0xa016('0x21')]);_0x2e5b94['offset']=qs[_0xa016('0x22')](_0x406da2[_0xa016('0x34')][_0xa016('0x22')]);}_0x2e5b94['order']=qs['sort'](_0x406da2[_0xa016('0x34')]['sort']);_0x2e5b94[_0xa016('0x3c')]=qs[_0xa016('0x3d')](_[_0xa016('0x3e')](_0x406da2[_0xa016('0x34')],_0xfcf6ad[_0xa016('0x3d')]),_0x498483);if(_0x406da2[_0xa016('0x34')][_0xa016('0x3f')]){_0x2e5b94[_0xa016('0x3c')]=_[_0xa016('0x40')](_0x2e5b94['where'],{'$or':_[_0xa016('0x2e')](_0x498483,function(_0x2981d3){if(_0x2981d3[_0xa016('0x32')]!==_0xa016('0x41')){var _0x4d4ceb={};_0x4d4ceb[_0x2981d3['name']]={'$like':'%'+_0x406da2[_0xa016('0x34')]['filter']+'%'};return _0x4d4ceb;}})});}_0x2e5b94=_[_0xa016('0x40')]({},_0x2e5b94,_0x406da2[_0xa016('0x42')]);var _0x28f6dd={'where':_0x2e5b94[_0xa016('0x3c')]};return db[_0xa016('0x2f')]['count'](_0x28f6dd)['then'](function(_0x16cf10){_0x16000a[_0xa016('0x43')]=_0x16cf10;if(_0x406da2[_0xa016('0x34')][_0xa016('0x44')]){_0x2e5b94['include']=[{'all':!![]}];}return db[_0xa016('0x2f')]['findAll'](_0x2e5b94);})[_0xa016('0x27')](function(_0x11d64c){_0x16000a[_0xa016('0x45')]=_0x11d64c;return _0x16000a;})[_0xa016('0x27')](respondWithFilteredResult(_0x7794fe,_0x2e5b94))['catch'](handleError(_0x7794fe,null));};exports[_0xa016('0x46')]=function(_0x1d6fff,_0x5c3420){var _0x387277={'raw':!![],'where':{'id':_0x1d6fff[_0xa016('0x47')]['id']}},_0x256d68={};_0x256d68['model']=_['keys'](db[_0xa016('0x2f')][_0xa016('0x30')]);_0x256d68['query']=_[_0xa016('0x35')](_0x1d6fff['query']);_0x256d68['filters']=_[_0xa016('0x38')](_0x256d68['model'],_0x256d68[_0xa016('0x34')]);_0x387277[_0xa016('0x37')]=_[_0xa016('0x38')](_0x256d68[_0xa016('0x36')],qs[_0xa016('0x39')](_0x1d6fff[_0xa016('0x34')][_0xa016('0x39')]));_0x387277[_0xa016('0x37')]=_0x387277['attributes'][_0xa016('0x48')]?_0x387277[_0xa016('0x37')]:_0x256d68[_0xa016('0x36')];if(_0x1d6fff[_0xa016('0x34')][_0xa016('0x44')]){_0x387277[_0xa016('0x49')]=[{'all':!![]}];}_0x387277=_[_0xa016('0x40')]({},_0x387277,_0x1d6fff['options']);return db['AnalyticExtractedReport'][_0xa016('0x4a')](_0x387277)['then'](handleEntityNotFound(_0x5c3420,null))[_0xa016('0x27')](respondWithResult(_0x5c3420,null))[_0xa016('0x4b')](handleError(_0x5c3420,null));};exports[_0xa016('0x4c')]=function(_0x25e9fe,_0x18874d){return db[_0xa016('0x2f')]['create'](_0x25e9fe['body'],{})['then'](function(_0xfca099){var _0x157c30=_0x25e9fe[_0xa016('0x4d')]['get']({'plain':!![]});if(!_0x157c30)throw new Error(_0xa016('0x4e'));if(_0x157c30[_0xa016('0x4f')]===_0xa016('0x4d')){var _0x41b612=_0xfca099[_0xa016('0x28')]({'plain':!![]});var _0x247072=_0xa016('0x29');return db[_0xa016('0x50')][_0xa016('0x4a')]({'where':{'name':_0x247072,'userProfileId':_0x157c30[_0xa016('0x51')]},'raw':!![]})[_0xa016('0x27')](function(_0x5b12ba){if(_0x5b12ba&&_0x5b12ba[_0xa016('0x52')]===0x0){return db[_0xa016('0x2a')]['create']({'name':_0x41b612[_0xa016('0x2c')],'resourceId':_0x41b612['id'],'type':_0x5b12ba[_0xa016('0x2c')],'sectionId':_0x5b12ba['id']},{})['then'](function(){return _0xfca099;});}else{return _0xfca099;}})[_0xa016('0x4b')](function(_0x3fd966){logger[_0xa016('0x2b')](_0xa016('0x53'),_0x3fd966);throw _0x3fd966;});}return _0xfca099;})[_0xa016('0x27')](respondWithResult(_0x18874d,0xc9))[_0xa016('0x4b')](handleError(_0x18874d,null));};exports[_0xa016('0x26')]=function(_0xaf174f,_0x16ab90){if(_0xaf174f[_0xa016('0x54')]['id']){delete _0xaf174f[_0xa016('0x54')]['id'];}return db[_0xa016('0x2f')][_0xa016('0x4a')]({'where':{'id':_0xaf174f['params']['id']}})[_0xa016('0x27')](handleEntityNotFound(_0x16ab90,null))[_0xa016('0x27')](saveUpdates(_0xaf174f[_0xa016('0x54')],null))[_0xa016('0x27')](respondWithResult(_0x16ab90,null))[_0xa016('0x4b')](handleError(_0x16ab90,null));};exports['destroy']=function(_0xb0215a,_0x5bf83e){return db[_0xa016('0x2f')][_0xa016('0x4a')]({'where':{'id':_0xb0215a[_0xa016('0x47')]['id']}})[_0xa016('0x27')](handleEntityNotFound(_0x5bf83e,null))[_0xa016('0x27')](removeEntity(_0x5bf83e,null))[_0xa016('0x4b')](handleError(_0x5bf83e,null));};exports['download']=function(_0x15ffdf,_0x7826f8,_0x375a68){return db[_0xa016('0x2f')][_0xa016('0x4a')]({'where':{'id':_0x15ffdf[_0xa016('0x47')]['id']},'attributes':[_0xa016('0x2c'),_0xa016('0x55'),'savename',_0xa016('0x56')],'raw':!![]})[_0xa016('0x27')](handleEntityNotFound(_0x7826f8,null))[_0xa016('0x27')](function(_0x12ccf1){if(_0x12ccf1){if(!fs[_0xa016('0x57')](path[_0xa016('0x58')](config[_0xa016('0x59')],_0xa016('0x5a'),_0x12ccf1['savename']))){throw new db[(_0xa016('0x5b'))]['ValidationError']('Report\x20not\x20found\x20or\x20empty');}if(_0x15ffdf['query'][_0xa016('0x5c')]){return _0x7826f8[_0xa016('0x1c')](0xc8);}return _0x7826f8[_0xa016('0x5d')](path['join'](config[_0xa016('0x59')],_0xa016('0x5a'),_0x12ccf1[_0xa016('0x5e')]),util[_0xa016('0x5f')]('%s.%s',_0x12ccf1['basename']||_0x12ccf1['name'],_0x12ccf1[_0xa016('0x56')][_0xa016('0x60')]()));}})[_0xa016('0x4b')](handleError(_0x7826f8,null));}; \ No newline at end of file +var _0x1d03=['desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','get','ExtractedReports','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','AnalyticExtractedReport','includeAll','include','findAll','rows','catch','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','update','params','download','savename','existsSync','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','output','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce'];(function(_0xcd0918,_0x56bdf9){var _0x250704=function(_0x56788e){while(--_0x56788e){_0xcd0918['push'](_0xcd0918['shift']());}};_0x250704(++_0x56bdf9);}(_0x1d03,0x1d2));var _0x31d0=function(_0x4113e3,_0x33283e){_0x4113e3=_0x4113e3-0x0;var _0x57b3df=_0x1d03[_0x4113e3];return _0x57b3df;};'use strict';var emlformat=require(_0x31d0('0x0'));var rimraf=require(_0x31d0('0x1'));var zipdir=require(_0x31d0('0x2'));var jsonpatch=require(_0x31d0('0x3'));var rp=require('request-promise');var moment=require(_0x31d0('0x4'));var BPromise=require(_0x31d0('0x5'));var Mustache=require(_0x31d0('0x6'));var util=require(_0x31d0('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x31d0('0x8'));var ejs=require(_0x31d0('0x9'));var fs=require('fs');var fs_extra=require(_0x31d0('0xa'));var _=require(_0x31d0('0xb'));var squel=require(_0x31d0('0xc'));var crypto=require('crypto');var jsforce=require(_0x31d0('0xd'));var deskjs=require(_0x31d0('0xe'));var toCsv=require('to-csv');var querystring=require(_0x31d0('0xf'));var Papa=require('papaparse');var Redis=require(_0x31d0('0x10'));var authService=require(_0x31d0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x31d0('0x12'));var hardwareService=require(_0x31d0('0x13'));var logger=require(_0x31d0('0x14'))(_0x31d0('0x15'));var utils=require('../../config/utils');var config=require(_0x31d0('0x16'));var licenseUtil=require(_0x31d0('0x17'));var db=require(_0x31d0('0x18'))['db'];function respondWithStatusCode(_0x203d06,_0x4df6d0){_0x4df6d0=_0x4df6d0||0xcc;return function(_0x41319e){if(_0x41319e){return _0x203d06['sendStatus'](_0x4df6d0);}return _0x203d06[_0x31d0('0x19')](_0x4df6d0)[_0x31d0('0x1a')]();};}function respondWithResult(_0x56724c,_0x673378){_0x673378=_0x673378||0xc8;return function(_0x147a0c){if(_0x147a0c){return _0x56724c['status'](_0x673378)[_0x31d0('0x1b')](_0x147a0c);}};}function respondWithFilteredResult(_0x4f4587,_0x4f0a4d){return function(_0x4228b5){if(_0x4228b5){var _0x1705b2=typeof _0x4f0a4d[_0x31d0('0x1c')]==='undefined'&&typeof _0x4f0a4d[_0x31d0('0x1d')]===_0x31d0('0x1e');var _0x9baa4b=_0x4228b5['count'];var _0x30bf9a=_0x1705b2?0x0:_0x4f0a4d[_0x31d0('0x1c')];var _0x5d05c6=_0x1705b2?_0x4228b5[_0x31d0('0x1f')]:_0x4f0a4d[_0x31d0('0x1c')]+_0x4f0a4d['limit'];var _0x4c09d1;if(_0x5d05c6>=_0x9baa4b){_0x5d05c6=_0x9baa4b;_0x4c09d1=0xc8;}else{_0x4c09d1=0xce;}_0x4f4587[_0x31d0('0x19')](_0x4c09d1);return _0x4f4587[_0x31d0('0x20')](_0x31d0('0x21'),_0x30bf9a+'-'+_0x5d05c6+'/'+_0x9baa4b)[_0x31d0('0x1b')](_0x4228b5);}return null;};}function patchUpdates(_0x4fad2c){return function(_0x14b5d3){try{jsonpatch[_0x31d0('0x22')](_0x14b5d3,_0x4fad2c,!![]);}catch(_0x4c7560){return BPromise[_0x31d0('0x23')](_0x4c7560);}return _0x14b5d3[_0x31d0('0x24')]();};}function saveUpdates(_0x315d3f,_0x59c22d){return function(_0x454d22){if(_0x454d22){return _0x454d22['update'](_0x315d3f)[_0x31d0('0x25')](function(_0x125424){return _0x125424;});}return null;};}function removeEntity(_0x16997b,_0x5322e9){return function(_0x2cf86a){if(_0x2cf86a){return _0x2cf86a[_0x31d0('0x26')]()[_0x31d0('0x25')](function(){var _0x144db6=_0x2cf86a[_0x31d0('0x27')]({'plain':!![]});var _0x19fe71=_0x31d0('0x28');return db['UserProfileResource'][_0x31d0('0x26')]({'where':{'type':_0x19fe71,'resourceId':_0x144db6['id']}})['then'](function(){return _0x2cf86a;});})['then'](function(){_0x16997b[_0x31d0('0x19')](0xcc)[_0x31d0('0x1a')]();});}};}function handleEntityNotFound(_0xf49873,_0xa936a1){return function(_0x43a15c){if(!_0x43a15c){_0xf49873[_0x31d0('0x29')](0x194);}return _0x43a15c;};}function handleError(_0x3589df,_0x2cdeb2){_0x2cdeb2=_0x2cdeb2||0x1f4;return function(_0x5d62a2){logger[_0x31d0('0x2a')](_0x5d62a2[_0x31d0('0x2b')]);if(_0x5d62a2[_0x31d0('0x2c')]){delete _0x5d62a2[_0x31d0('0x2c')];}_0x3589df[_0x31d0('0x19')](_0x2cdeb2)[_0x31d0('0x2d')](_0x5d62a2);};}exports[_0x31d0('0x2e')]=function(_0x32487c,_0x5878ec){var _0x540bb1={},_0x4f8ce6={},_0x518ada={'count':0x0,'rows':[]};var _0x559210=_[_0x31d0('0x2f')](db['AnalyticExtractedReport'][_0x31d0('0x30')],function(_0x43a390){return{'name':_0x43a390[_0x31d0('0x31')],'type':_0x43a390['type']['key']};});_0x4f8ce6[_0x31d0('0x32')]=_['map'](_0x559210,_0x31d0('0x2c'));_0x4f8ce6[_0x31d0('0x33')]=_[_0x31d0('0x34')](_0x32487c['query']);_0x4f8ce6[_0x31d0('0x35')]=_[_0x31d0('0x36')](_0x4f8ce6[_0x31d0('0x32')],_0x4f8ce6[_0x31d0('0x33')]);_0x540bb1[_0x31d0('0x37')]=_[_0x31d0('0x36')](_0x4f8ce6['model'],qs[_0x31d0('0x38')](_0x32487c[_0x31d0('0x33')][_0x31d0('0x38')]));_0x540bb1['attributes']=_0x540bb1[_0x31d0('0x37')][_0x31d0('0x39')]?_0x540bb1[_0x31d0('0x37')]:_0x4f8ce6[_0x31d0('0x32')];if(!_0x32487c[_0x31d0('0x33')][_0x31d0('0x3a')]('nolimit')){_0x540bb1[_0x31d0('0x1d')]=qs[_0x31d0('0x1d')](_0x32487c[_0x31d0('0x33')]['limit']);_0x540bb1[_0x31d0('0x1c')]=qs['offset'](_0x32487c[_0x31d0('0x33')][_0x31d0('0x1c')]);}_0x540bb1[_0x31d0('0x3b')]=qs[_0x31d0('0x3c')](_0x32487c['query'][_0x31d0('0x3c')]);_0x540bb1[_0x31d0('0x3d')]=qs[_0x31d0('0x35')](_['pick'](_0x32487c[_0x31d0('0x33')],_0x4f8ce6[_0x31d0('0x35')]),_0x559210);if(_0x32487c[_0x31d0('0x33')][_0x31d0('0x3e')]){_0x540bb1[_0x31d0('0x3d')]=_[_0x31d0('0x3f')](_0x540bb1[_0x31d0('0x3d')],{'$or':_[_0x31d0('0x2f')](_0x559210,function(_0x1f6093){if(_0x1f6093[_0x31d0('0x40')]!==_0x31d0('0x41')){var _0xc3a5c5={};_0xc3a5c5[_0x1f6093[_0x31d0('0x2c')]]={'$like':'%'+_0x32487c[_0x31d0('0x33')][_0x31d0('0x3e')]+'%'};return _0xc3a5c5;}})});}_0x540bb1=_[_0x31d0('0x3f')]({},_0x540bb1,_0x32487c[_0x31d0('0x42')]);var _0x4ab6cc={'where':_0x540bb1[_0x31d0('0x3d')]};return db[_0x31d0('0x43')][_0x31d0('0x1f')](_0x4ab6cc)['then'](function(_0x3e3949){_0x518ada[_0x31d0('0x1f')]=_0x3e3949;if(_0x32487c['query'][_0x31d0('0x44')]){_0x540bb1[_0x31d0('0x45')]=[{'all':!![]}];}return db[_0x31d0('0x43')][_0x31d0('0x46')](_0x540bb1);})['then'](function(_0xdf5020){_0x518ada[_0x31d0('0x47')]=_0xdf5020;return _0x518ada;})[_0x31d0('0x25')](respondWithFilteredResult(_0x5878ec,_0x540bb1))[_0x31d0('0x48')](handleError(_0x5878ec,null));};exports['show']=function(_0x1f38dd,_0x37b63b){var _0x3e7665={'raw':!![],'where':{'id':_0x1f38dd['params']['id']}},_0x2bbb1d={};_0x2bbb1d['model']=_['keys'](db[_0x31d0('0x43')][_0x31d0('0x30')]);_0x2bbb1d[_0x31d0('0x33')]=_[_0x31d0('0x34')](_0x1f38dd[_0x31d0('0x33')]);_0x2bbb1d[_0x31d0('0x35')]=_[_0x31d0('0x36')](_0x2bbb1d['model'],_0x2bbb1d[_0x31d0('0x33')]);_0x3e7665[_0x31d0('0x37')]=_[_0x31d0('0x36')](_0x2bbb1d[_0x31d0('0x32')],qs[_0x31d0('0x38')](_0x1f38dd['query'][_0x31d0('0x38')]));_0x3e7665[_0x31d0('0x37')]=_0x3e7665[_0x31d0('0x37')][_0x31d0('0x39')]?_0x3e7665[_0x31d0('0x37')]:_0x2bbb1d[_0x31d0('0x32')];if(_0x1f38dd['query'][_0x31d0('0x44')]){_0x3e7665[_0x31d0('0x45')]=[{'all':!![]}];}_0x3e7665=_[_0x31d0('0x3f')]({},_0x3e7665,_0x1f38dd[_0x31d0('0x42')]);return db['AnalyticExtractedReport'][_0x31d0('0x49')](_0x3e7665)['then'](handleEntityNotFound(_0x37b63b,null))[_0x31d0('0x25')](respondWithResult(_0x37b63b,null))[_0x31d0('0x48')](handleError(_0x37b63b,null));};exports[_0x31d0('0x4a')]=function(_0x3869de,_0x554558){return db[_0x31d0('0x43')][_0x31d0('0x4a')](_0x3869de[_0x31d0('0x4b')],{})[_0x31d0('0x25')](function(_0xa71de1){var _0x1f8fcb=_0x3869de['user'][_0x31d0('0x27')]({'plain':!![]});if(!_0x1f8fcb)throw new Error(_0x31d0('0x4c'));if(_0x1f8fcb[_0x31d0('0x4d')]===_0x31d0('0x4e')){var _0x2b6e88=_0xa71de1[_0x31d0('0x27')]({'plain':!![]});var _0x3770fb='ExtractedReports';return db[_0x31d0('0x4f')][_0x31d0('0x49')]({'where':{'name':_0x3770fb,'userProfileId':_0x1f8fcb[_0x31d0('0x50')]},'raw':!![]})[_0x31d0('0x25')](function(_0x406cf0){if(_0x406cf0&&_0x406cf0['autoAssociation']===0x0){return db['UserProfileResource'][_0x31d0('0x4a')]({'name':_0x2b6e88[_0x31d0('0x2c')],'resourceId':_0x2b6e88['id'],'type':_0x406cf0[_0x31d0('0x2c')],'sectionId':_0x406cf0['id']},{})[_0x31d0('0x25')](function(){return _0xa71de1;});}else{return _0xa71de1;}})[_0x31d0('0x48')](function(_0x5b8a87){logger[_0x31d0('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b8a87);throw _0x5b8a87;});}return _0xa71de1;})[_0x31d0('0x25')](respondWithResult(_0x554558,0xc9))[_0x31d0('0x48')](handleError(_0x554558,null));};exports[_0x31d0('0x51')]=function(_0x28be45,_0x528b65){if(_0x28be45['body']['id']){delete _0x28be45[_0x31d0('0x4b')]['id'];}return db[_0x31d0('0x43')][_0x31d0('0x49')]({'where':{'id':_0x28be45[_0x31d0('0x52')]['id']}})['then'](handleEntityNotFound(_0x528b65,null))[_0x31d0('0x25')](saveUpdates(_0x28be45['body'],null))[_0x31d0('0x25')](respondWithResult(_0x528b65,null))[_0x31d0('0x48')](handleError(_0x528b65,null));};exports[_0x31d0('0x26')]=function(_0x41db31,_0x292141){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x41db31['params']['id']}})[_0x31d0('0x25')](handleEntityNotFound(_0x292141,null))[_0x31d0('0x25')](removeEntity(_0x292141,null))['catch'](handleError(_0x292141,null));};exports[_0x31d0('0x53')]=function(_0x2a40e9,_0x4e7a61,_0x42a1b4){return db[_0x31d0('0x43')][_0x31d0('0x49')]({'where':{'id':_0x2a40e9[_0x31d0('0x52')]['id']},'attributes':[_0x31d0('0x2c'),'basename',_0x31d0('0x54'),'output'],'raw':!![]})[_0x31d0('0x25')](handleEntityNotFound(_0x4e7a61,null))[_0x31d0('0x25')](function(_0x4bde05){if(_0x4bde05){if(!fs[_0x31d0('0x55')](path['join'](config[_0x31d0('0x56')],_0x31d0('0x57'),_0x4bde05[_0x31d0('0x54')]))){throw new db[(_0x31d0('0x58'))][(_0x31d0('0x59'))](_0x31d0('0x5a'));}if(_0x2a40e9[_0x31d0('0x33')][_0x31d0('0x5b')]){return _0x4e7a61[_0x31d0('0x29')](0xc8);}return _0x4e7a61[_0x31d0('0x53')](path['join'](config[_0x31d0('0x56')],_0x31d0('0x57'),_0x4bde05[_0x31d0('0x54')]),util[_0x31d0('0x5c')](_0x31d0('0x5d'),_0x4bde05['basename']||_0x4bde05[_0x31d0('0x2c')],_0x4bde05[_0x31d0('0x5e')][_0x31d0('0x5f')]()));}})['catch'](handleError(_0x4e7a61,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index db045b0..4950106 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 _0xa121=['analytics_extracted_reports','lodash','util','../../config/logger','moment','bluebird','path','rimraf','define','AnalyticExtractedReport'];(function(_0x2621e7,_0x3323f0){var _0x216828=function(_0x581cb3){while(--_0x581cb3){_0x2621e7['push'](_0x2621e7['shift']());}};_0x216828(++_0x3323f0);}(_0xa121,0xc9));var _0x1a12=function(_0x53f940,_0x1e4088){_0x53f940=_0x53f940-0x0;var _0x365769=_0xa121[_0x53f940];return _0x365769;};'use strict';var _=require(_0x1a12('0x0'));var util=require(_0x1a12('0x1'));var logger=require(_0x1a12('0x2'))('api');var moment=require(_0x1a12('0x3'));var BPromise=require(_0x1a12('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1a12('0x5'));var rimraf=require(_0x1a12('0x6'));var config=require('../../config/environment');var attributes=require('./analyticExtractedReport.attributes');module['exports']=function(_0x5cc6f4,_0x2b6777){return _0x5cc6f4[_0x1a12('0x7')](_0x1a12('0x8'),attributes,{'tableName':_0x1a12('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x03c5=['path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','AnalyticExtractedReport','analytics_extracted_reports','util','../../config/logger','request-promise'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x03c5,0x129));var _0x503c=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0x03c5[_0x1ae5ab];return _0x1ce001;};'use strict';var _=require('lodash');var util=require(_0x503c('0x0'));var logger=require(_0x503c('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x503c('0x2'));var fs=require('fs');var path=require(_0x503c('0x3'));var rimraf=require(_0x503c('0x4'));var config=require(_0x503c('0x5'));var attributes=require(_0x503c('0x6'));module[_0x503c('0x7')]=function(_0x19d14d,_0x3d8946){return _0x19d14d['define'](_0x503c('0x8'),attributes,{'tableName':_0x503c('0x9'),'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 83c70c2..ce703ba 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 _0xa1ab=['message','result','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticExtractedReport,\x20%s,\x20%s'];(function(_0x2cade4,_0x4bf38f){var _0x5bafa8=function(_0x59edd4){while(--_0x59edd4){_0x2cade4['push'](_0x2cade4['shift']());}};_0x5bafa8(++_0x4bf38f);}(_0xa1ab,0x1a1));var _0xba1a=function(_0x1e3a63,_0x154185){_0x1e3a63=_0x1e3a63-0x0;var _0x4a7209=_0xa1ab[_0x1e3a63];return _0x4a7209;};'use strict';var _=require('lodash');var util=require(_0xba1a('0x0'));var moment=require(_0xba1a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xba1a('0x2'));var db=require(_0xba1a('0x3'))['db'];var utils=require(_0xba1a('0x4'));var logger=require(_0xba1a('0x5'))(_0xba1a('0x6'));var config=require(_0xba1a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xba1a('0x8')][_0xba1a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19b3bc,_0x35ba1f,_0x40e1fa){return new BPromise(function(_0x1a2cd3,_0x3384b8){return client[_0xba1a('0xa')](_0x19b3bc,_0x40e1fa)[_0xba1a('0xb')](function(_0x213554){logger[_0xba1a('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x35ba1f,_0xba1a('0xd'));logger[_0xba1a('0xe')](_0xba1a('0xf'),_0x35ba1f,_0xba1a('0xd'),JSON[_0xba1a('0x10')](_0x213554));if(_0x213554['error']){if(_0x213554[_0xba1a('0x11')][_0xba1a('0x12')]===0x1f4){logger[_0xba1a('0x11')](_0xba1a('0x13'),_0x35ba1f,_0x213554[_0xba1a('0x11')][_0xba1a('0x14')]);return _0x3384b8(_0x213554[_0xba1a('0x11')][_0xba1a('0x14')]);}logger[_0xba1a('0x11')](_0xba1a('0x13'),_0x35ba1f,_0x213554['error'][_0xba1a('0x14')]);return _0x1a2cd3(_0x213554[_0xba1a('0x11')][_0xba1a('0x14')]);}else{logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x35ba1f,'request\x20sent');_0x1a2cd3(_0x213554[_0xba1a('0x15')][_0xba1a('0x14')]);}})[_0xba1a('0x16')](function(_0x13cd4e){logger[_0xba1a('0x11')](_0xba1a('0x13'),_0x35ba1f,_0x13cd4e);_0x3384b8(_0x13cd4e);});});} \ No newline at end of file +var _0x7317=['then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x276f3b,_0x3718e9){var _0x1aa18e=function(_0x2ce604){while(--_0x2ce604){_0x276f3b['push'](_0x276f3b['shift']());}};_0x1aa18e(++_0x3718e9);}(_0x7317,0xac));var _0x7731=function(_0xac876e,_0x497c9d){_0xac876e=_0xac876e-0x0;var _0x318ae5=_0x7317[_0xac876e];return _0x318ae5;};'use strict';var _=require(_0x7731('0x0'));var util=require(_0x7731('0x1'));var moment=require(_0x7731('0x2'));var BPromise=require('bluebird');var rs=require(_0x7731('0x3'));var fs=require('fs');var Redis=require(_0x7731('0x4'));var db=require(_0x7731('0x5'))['db'];var utils=require(_0x7731('0x6'));var logger=require('../../config/logger')(_0x7731('0x7'));var config=require(_0x7731('0x8'));var jayson=require(_0x7731('0x9'));var client=jayson[_0x7731('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27f2d1,_0x41c8af,_0x16095c){return new BPromise(function(_0x336fef,_0x2c0a7e){return client[_0x7731('0xb')](_0x27f2d1,_0x16095c)[_0x7731('0xc')](function(_0x86abe4){logger[_0x7731('0xd')](_0x7731('0xe'),_0x41c8af,_0x7731('0xf'));logger[_0x7731('0x10')](_0x7731('0x11'),_0x41c8af,_0x7731('0xf'),JSON['stringify'](_0x86abe4));if(_0x86abe4[_0x7731('0x12')]){if(_0x86abe4[_0x7731('0x12')][_0x7731('0x13')]===0x1f4){logger['error'](_0x7731('0xe'),_0x41c8af,_0x86abe4['error'][_0x7731('0x14')]);return _0x2c0a7e(_0x86abe4[_0x7731('0x12')][_0x7731('0x14')]);}logger['error'](_0x7731('0xe'),_0x41c8af,_0x86abe4[_0x7731('0x12')][_0x7731('0x14')]);return _0x336fef(_0x86abe4[_0x7731('0x12')][_0x7731('0x14')]);}else{logger[_0x7731('0xd')](_0x7731('0xe'),_0x41c8af,_0x7731('0xf'));_0x336fef(_0x86abe4[_0x7731('0x15')][_0x7731('0x14')]);}})[_0x7731('0x16')](function(_0x587a4c){logger[_0x7731('0x12')](_0x7731('0xe'),_0x41c8af,_0x587a4c);_0x2c0a7e(_0x587a4c);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index d297b4e..681f758 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 _0x77d4=['destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','isAuthenticated','get','/:id','/:id/download','download','post','create','put','update','delete'];(function(_0x5cc8,_0x1faa02){var _0x450661=function(_0x237b05){while(--_0x237b05){_0x5cc8['push'](_0x5cc8['shift']());}};_0x450661(++_0x1faa02);}(_0x77d4,0x152));var _0x477d=function(_0x5dca60,_0x2b2eeb){_0x5dca60=_0x5dca60-0x0;var _0xb2e3a9=_0x77d4[_0x5dca60];return _0xb2e3a9;};'use strict';var multer=require(_0x477d('0x0'));var util=require('util');var path=require(_0x477d('0x1'));var timeout=require('connect-timeout');var express=require(_0x477d('0x2'));var router=express[_0x477d('0x3')]();var fs_extra=require(_0x477d('0x4'));var auth=require(_0x477d('0x5'));var interaction=require(_0x477d('0x6'));var config=require(_0x477d('0x7'));var controller=require(_0x477d('0x8'));router['get']('/',auth[_0x477d('0x9')](),controller['index']);router[_0x477d('0xa')](_0x477d('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x477d('0xa')](_0x477d('0xc'),auth[_0x477d('0x9')](),controller[_0x477d('0xd')]);router[_0x477d('0xe')]('/',auth['isAuthenticated'](),controller[_0x477d('0xf')]);router[_0x477d('0x10')](_0x477d('0xb'),auth[_0x477d('0x9')](),controller[_0x477d('0x11')]);router[_0x477d('0x12')](_0x477d('0xb'),auth['isAuthenticated'](),controller[_0x477d('0x13')]);module[_0x477d('0x14')]=router; \ No newline at end of file +var _0x8887=['../../config/environment','index','/:id','isAuthenticated','get','/:id/download','download','post','put','update','destroy','util','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3163a0,_0xb631ed){var _0x39c168=function(_0x4acf4f){while(--_0x4acf4f){_0x3163a0['push'](_0x3163a0['shift']());}};_0x39c168(++_0xb631ed);}(_0x8887,0x164));var _0x7888=function(_0x10cfdd,_0x5eff47){_0x10cfdd=_0x10cfdd-0x0;var _0x158961=_0x8887[_0x10cfdd];return _0x158961;};'use strict';var multer=require('multer');var util=require(_0x7888('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x7888('0x1'));var auth=require(_0x7888('0x2'));var interaction=require(_0x7888('0x3'));var config=require(_0x7888('0x4'));var controller=require('./analyticExtractedReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x7888('0x5')]);router['get'](_0x7888('0x6'),auth[_0x7888('0x7')](),controller['show']);router[_0x7888('0x8')](_0x7888('0x9'),auth[_0x7888('0x7')](),controller[_0x7888('0xa')]);router[_0x7888('0xb')]('/',auth[_0x7888('0x7')](),controller['create']);router[_0x7888('0xc')](_0x7888('0x6'),auth[_0x7888('0x7')](),controller[_0x7888('0xd')]);router['delete'](_0x7888('0x6'),auth[_0x7888('0x7')](),controller[_0x7888('0xe')]);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 9e4fba8..803cb08 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 _0x8d12=['exports','TEXT','STRING','BOOLEAN'];(function(_0x598b78,_0xf4ee7e){var _0x6392fa=function(_0x810353){while(--_0x810353){_0x598b78['push'](_0x598b78['shift']());}};_0x6392fa(++_0xf4ee7e);}(_0x8d12,0x70));var _0x28d1=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0x8d12[_0x20c9b2];return _0x2c6030;};'use strict';var Sequelize=require('sequelize');module[_0x28d1('0x0')]={'field':{'type':Sequelize[_0x28d1('0x1')]},'alias':{'type':Sequelize[_0x28d1('0x2')]},'function':{'type':Sequelize[_0x28d1('0x2')]},'format':{'type':Sequelize[_0x28d1('0x2')]},'groupBy':{'type':Sequelize[_0x28d1('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x79c0=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x2927e0,_0xcedf35){var _0x42c54a=function(_0x566cff){while(--_0x566cff){_0x2927e0['push'](_0x2927e0['shift']());}};_0x42c54a(++_0xcedf35);}(_0x79c0,0xc6));var _0x079c=function(_0x1b3322,_0xec8ce7){_0x1b3322=_0x1b3322-0x0;var _0x2467a1=_0x79c0[_0x1b3322];return _0x2467a1;};'use strict';var Sequelize=require(_0x079c('0x0'));module[_0x079c('0x1')]={'field':{'type':Sequelize[_0x079c('0x2')]},'alias':{'type':Sequelize[_0x079c('0x3')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0x079c('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0x079c('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 7510168..43042a6 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 _0x037b=['sox','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','AnalyticFieldReport','includeAll','include','findAll','rows','catch','show','params','options','find','create','bulkCreate','body','destroy','bulkDestroy','addFields','AnalyticCustomReport','findOne','transaction','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path'];(function(_0x1f7330,_0x13e6c4){var _0x16ec2e=function(_0xa925b1){while(--_0xa925b1){_0x1f7330['push'](_0x1f7330['shift']());}};_0x16ec2e(++_0x13e6c4);}(_0x037b,0x19c));var _0xb037=function(_0x1d16e8,_0x14d94e){_0x1d16e8=_0x1d16e8-0x0;var _0x8d6085=_0x037b[_0x1d16e8];return _0x8d6085;};'use strict';var emlformat=require(_0xb037('0x0'));var rimraf=require(_0xb037('0x1'));var zipdir=require(_0xb037('0x2'));var jsonpatch=require(_0xb037('0x3'));var rp=require(_0xb037('0x4'));var moment=require(_0xb037('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb037('0x6'));var path=require(_0xb037('0x7'));var sox=require(_0xb037('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb037('0x9'));var squel=require(_0xb037('0xa'));var crypto=require(_0xb037('0xb'));var jsforce=require(_0xb037('0xc'));var deskjs=require(_0xb037('0xd'));var toCsv=require(_0xb037('0xe'));var querystring=require('querystring');var Papa=require(_0xb037('0xf'));var Redis=require(_0xb037('0x10'));var authService=require(_0xb037('0x11'));var qs=require(_0xb037('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb037('0x13'));var logger=require(_0xb037('0x14'))(_0xb037('0x15'));var utils=require('../../config/utils');var config=require(_0xb037('0x16'));var licenseUtil=require(_0xb037('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5287a5,_0x56b843){_0x56b843=_0x56b843||0xcc;return function(_0x3cd18a){if(_0x3cd18a){return _0x5287a5['sendStatus'](_0x56b843);}return _0x5287a5[_0xb037('0x18')](_0x56b843)[_0xb037('0x19')]();};}function respondWithResult(_0x594534,_0xcf9645){_0xcf9645=_0xcf9645||0xc8;return function(_0x2fa2e6){if(_0x2fa2e6){return _0x594534[_0xb037('0x18')](_0xcf9645)[_0xb037('0x1a')](_0x2fa2e6);}};}function respondWithFilteredResult(_0x3757fa,_0x414ba0){return function(_0x24cc65){if(_0x24cc65){var _0x18005b=typeof _0x414ba0[_0xb037('0x1b')]===_0xb037('0x1c')&&typeof _0x414ba0[_0xb037('0x1d')]===_0xb037('0x1c');var _0x281b56=_0x24cc65[_0xb037('0x1e')];var _0x1b9dd5=_0x18005b?0x0:_0x414ba0[_0xb037('0x1b')];var _0x46695e=_0x18005b?_0x24cc65[_0xb037('0x1e')]:_0x414ba0[_0xb037('0x1b')]+_0x414ba0[_0xb037('0x1d')];var _0x1129b3;if(_0x46695e>=_0x281b56){_0x46695e=_0x281b56;_0x1129b3=0xc8;}else{_0x1129b3=0xce;}_0x3757fa['status'](_0x1129b3);return _0x3757fa['set'](_0xb037('0x1f'),_0x1b9dd5+'-'+_0x46695e+'/'+_0x281b56)['json'](_0x24cc65);}return null;};}function patchUpdates(_0xc0e6ab){return function(_0x1ae27c){try{jsonpatch[_0xb037('0x20')](_0x1ae27c,_0xc0e6ab,!![]);}catch(_0x5a686c){return BPromise[_0xb037('0x21')](_0x5a686c);}return _0x1ae27c[_0xb037('0x22')]();};}function saveUpdates(_0x1302a7,_0x3376d2){return function(_0x54cbc1){if(_0x54cbc1){return _0x54cbc1[_0xb037('0x23')](_0x1302a7)[_0xb037('0x24')](function(_0x3e7f31){return _0x3e7f31;});}return null;};}function removeEntity(_0x291bbc,_0x3b38a2){return function(_0x4dc61a){if(_0x4dc61a){return _0x4dc61a['destroy']()['then'](function(){_0x291bbc['status'](0xcc)[_0xb037('0x19')]();});}};}function handleEntityNotFound(_0x302c67,_0x548cfb){return function(_0x23f716){if(!_0x23f716){_0x302c67[_0xb037('0x25')](0x194);}return _0x23f716;};}function handleError(_0x89e2c1,_0x526b1f){_0x526b1f=_0x526b1f||0x1f4;return function(_0x477c15){logger[_0xb037('0x26')](_0x477c15[_0xb037('0x27')]);if(_0x477c15['name']){delete _0x477c15[_0xb037('0x28')];}_0x89e2c1[_0xb037('0x18')](_0x526b1f)[_0xb037('0x29')](_0x477c15);};}exports[_0xb037('0x2a')]=function(_0x57254a,_0x2560ab){var _0x221797={},_0x5f04fc={},_0x504ac7={'count':0x0,'rows':[]};var _0x10d96a=_['map'](db['AnalyticFieldReport'][_0xb037('0x2b')],function(_0x50cb69){return{'name':_0x50cb69[_0xb037('0x2c')],'type':_0x50cb69[_0xb037('0x2d')][_0xb037('0x2e')]};});_0x5f04fc[_0xb037('0x2f')]=_['map'](_0x10d96a,_0xb037('0x28'));_0x5f04fc[_0xb037('0x30')]=_[_0xb037('0x31')](_0x57254a[_0xb037('0x30')]);_0x5f04fc[_0xb037('0x32')]=_[_0xb037('0x33')](_0x5f04fc[_0xb037('0x2f')],_0x5f04fc[_0xb037('0x30')]);_0x221797[_0xb037('0x34')]=_[_0xb037('0x33')](_0x5f04fc[_0xb037('0x2f')],qs['fields'](_0x57254a[_0xb037('0x30')][_0xb037('0x35')]));_0x221797[_0xb037('0x34')]=_0x221797[_0xb037('0x34')][_0xb037('0x36')]?_0x221797['attributes']:_0x5f04fc[_0xb037('0x2f')];if(!_0x57254a[_0xb037('0x30')][_0xb037('0x37')](_0xb037('0x38'))){_0x221797[_0xb037('0x1d')]=qs[_0xb037('0x1d')](_0x57254a['query'][_0xb037('0x1d')]);_0x221797['offset']=qs[_0xb037('0x1b')](_0x57254a[_0xb037('0x30')]['offset']);}_0x221797[_0xb037('0x39')]=qs[_0xb037('0x3a')](_0x57254a[_0xb037('0x30')][_0xb037('0x3a')]);_0x221797[_0xb037('0x3b')]=qs[_0xb037('0x32')](_[_0xb037('0x3c')](_0x57254a[_0xb037('0x30')],_0x5f04fc['filters']),_0x10d96a);if(_0x57254a['query'][_0xb037('0x3d')]){_0x221797[_0xb037('0x3b')]=_[_0xb037('0x3e')](_0x221797[_0xb037('0x3b')],{'$or':_[_0xb037('0x3f')](_0x10d96a,function(_0x33ba05){if(_0x33ba05[_0xb037('0x2d')]!==_0xb037('0x40')){var _0x4e7911={};_0x4e7911[_0x33ba05['name']]={'$like':'%'+_0x57254a['query'][_0xb037('0x3d')]+'%'};return _0x4e7911;}})});}_0x221797=_[_0xb037('0x3e')]({},_0x221797,_0x57254a['options']);var _0x1d5cf4={'where':_0x221797[_0xb037('0x3b')]};return db[_0xb037('0x41')][_0xb037('0x1e')](_0x1d5cf4)[_0xb037('0x24')](function(_0x434690){_0x504ac7[_0xb037('0x1e')]=_0x434690;if(_0x57254a[_0xb037('0x30')][_0xb037('0x42')]){_0x221797[_0xb037('0x43')]=[{'all':!![]}];}return db[_0xb037('0x41')][_0xb037('0x44')](_0x221797);})[_0xb037('0x24')](function(_0x8cf7fe){_0x504ac7[_0xb037('0x45')]=_0x8cf7fe;return _0x504ac7;})['then'](respondWithFilteredResult(_0x2560ab,_0x221797))[_0xb037('0x46')](handleError(_0x2560ab,null));};exports[_0xb037('0x47')]=function(_0x49d902,_0xceb0bd){var _0x4364c5={'raw':![],'where':{'id':_0x49d902[_0xb037('0x48')]['id']}},_0x38f8af={};_0x38f8af['model']=_['keys'](db[_0xb037('0x41')][_0xb037('0x2b')]);_0x38f8af[_0xb037('0x30')]=_['keys'](_0x49d902[_0xb037('0x30')]);_0x38f8af[_0xb037('0x32')]=_[_0xb037('0x33')](_0x38f8af[_0xb037('0x2f')],_0x38f8af[_0xb037('0x30')]);_0x4364c5[_0xb037('0x34')]=_['intersection'](_0x38f8af['model'],qs[_0xb037('0x35')](_0x49d902[_0xb037('0x30')]['fields']));_0x4364c5[_0xb037('0x34')]=_0x4364c5['attributes'][_0xb037('0x36')]?_0x4364c5[_0xb037('0x34')]:_0x38f8af[_0xb037('0x2f')];if(_0x49d902['query'][_0xb037('0x42')]){_0x4364c5[_0xb037('0x43')]=[{'all':!![]}];}_0x4364c5=_[_0xb037('0x3e')]({},_0x4364c5,_0x49d902[_0xb037('0x49')]);return db[_0xb037('0x41')][_0xb037('0x4a')](_0x4364c5)[_0xb037('0x24')](handleEntityNotFound(_0xceb0bd,null))[_0xb037('0x24')](respondWithResult(_0xceb0bd,null))[_0xb037('0x46')](handleError(_0xceb0bd,null));};exports[_0xb037('0x4b')]=function(_0x319c48,_0x4f3aef){return db[_0xb037('0x41')][_0xb037('0x4b')](_0x319c48['body'],{})[_0xb037('0x24')](respondWithResult(_0x4f3aef,0xc9))[_0xb037('0x46')](handleError(_0x4f3aef,null));};exports[_0xb037('0x4c')]=function(_0x58d1c5,_0x1df94f){return db[_0xb037('0x41')][_0xb037('0x4c')](_0x58d1c5['body'],{'raw':![],'individualHooks':!![]})[_0xb037('0x24')](respondWithResult(_0x1df94f,0xc9))[_0xb037('0x46')](handleError(_0x1df94f,null));};exports[_0xb037('0x23')]=function(_0x4fd0cd,_0x5ee22f){if(_0x4fd0cd['body']['id']){delete _0x4fd0cd[_0xb037('0x4d')]['id'];}return db[_0xb037('0x41')][_0xb037('0x4a')]({'where':{'id':_0x4fd0cd['params']['id']}})['then'](handleEntityNotFound(_0x5ee22f,null))[_0xb037('0x24')](saveUpdates(_0x4fd0cd[_0xb037('0x4d')],null))[_0xb037('0x24')](respondWithResult(_0x5ee22f,null))[_0xb037('0x46')](handleError(_0x5ee22f,null));};exports[_0xb037('0x4e')]=function(_0x5c6b76,_0x166de5){return db[_0xb037('0x41')]['find']({'where':{'id':_0x5c6b76['params']['id']}})[_0xb037('0x24')](handleEntityNotFound(_0x166de5,null))['then'](removeEntity(_0x166de5,null))[_0xb037('0x46')](handleError(_0x166de5,null));};exports[_0xb037('0x4f')]=function(_0x50d35a,_0x3f2072){return db[_0xb037('0x41')][_0xb037('0x4e')]({'where':{'id':_0x50d35a['query']['ids']||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x3f2072,0xcc))[_0xb037('0x46')](handleError(_0x3f2072,null));};exports[_0xb037('0x50')]=function(_0xf04815,_0x830a5d,_0x483ca4){return db[_0xb037('0x51')][_0xb037('0x52')]({'where':{'id':_0xf04815[_0xb037('0x48')]['id']}})[_0xb037('0x24')](handleEntityNotFound(_0x830a5d,null))[_0xb037('0x24')](function(_0x1fc0c0){if(_0x1fc0c0){return db['sequelize'][_0xb037('0x53')](function(_0x2217f4){return db[_0xb037('0x41')][_0xb037('0x4e')]({'where':{'CustomReportId':_0xf04815['params']['id']},'transaction':_0x2217f4})[_0xb037('0x24')](function(_0xb5d70c){var _0x4db1eb=_[_0xb037('0x3f')](_0xf04815[_0xb037('0x4d')],function(_0x574cde){delete _0x574cde['id'];_0x574cde['CustomReportId']=_0xf04815[_0xb037('0x48')]['id'];return _0x574cde;});return db['AnalyticFieldReport'][_0xb037('0x4c')](_0x4db1eb,{'transaction':_0x2217f4});});})[_0xb037('0x24')](function(){return db['AnalyticFieldReport'][_0xb037('0x44')]({'where':{'CustomReportId':_0xf04815[_0xb037('0x48')]['id']}});});}})[_0xb037('0x24')](respondWithResult(_0x830a5d,null))['catch'](handleError(_0x830a5d,null));}; \ No newline at end of file +var _0xe307=['fields','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','params','rawAttributes','length','include','find','create','body','bulkCreate','bulkDestroy','ids','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','error','name','index','map','AnalyticFieldReport','fieldName','type','key','model','query','keys','intersection','attributes'];(function(_0x1a071c,_0x55ee5d){var _0x4f7b06=function(_0x809015){while(--_0x809015){_0x1a071c['push'](_0x1a071c['shift']());}};_0x4f7b06(++_0x55ee5d);}(_0xe307,0x6f));var _0x7e30=function(_0x3ae159,_0xa19777){_0x3ae159=_0x3ae159-0x0;var _0x45938e=_0xe307[_0x3ae159];return _0x45938e;};'use strict';var emlformat=require(_0x7e30('0x0'));var rimraf=require(_0x7e30('0x1'));var zipdir=require(_0x7e30('0x2'));var jsonpatch=require(_0x7e30('0x3'));var rp=require(_0x7e30('0x4'));var moment=require(_0x7e30('0x5'));var BPromise=require(_0x7e30('0x6'));var Mustache=require('mustache');var util=require(_0x7e30('0x7'));var path=require(_0x7e30('0x8'));var sox=require(_0x7e30('0x9'));var csv=require(_0x7e30('0xa'));var ejs=require(_0x7e30('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7e30('0xc'));var squel=require(_0x7e30('0xd'));var crypto=require('crypto');var jsforce=require(_0x7e30('0xe'));var deskjs=require(_0x7e30('0xf'));var toCsv=require(_0x7e30('0xa'));var querystring=require(_0x7e30('0x10'));var Papa=require(_0x7e30('0x11'));var Redis=require(_0x7e30('0x12'));var authService=require(_0x7e30('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7e30('0x14'));var hardwareService=require(_0x7e30('0x15'));var logger=require(_0x7e30('0x16'))('api');var utils=require(_0x7e30('0x17'));var config=require(_0x7e30('0x18'));var licenseUtil=require(_0x7e30('0x19'));var db=require(_0x7e30('0x1a'))['db'];function respondWithStatusCode(_0x1341d4,_0x5c452b){_0x5c452b=_0x5c452b||0xcc;return function(_0x273e75){if(_0x273e75){return _0x1341d4[_0x7e30('0x1b')](_0x5c452b);}return _0x1341d4[_0x7e30('0x1c')](_0x5c452b)[_0x7e30('0x1d')]();};}function respondWithResult(_0x349ad1,_0x5e3a33){_0x5e3a33=_0x5e3a33||0xc8;return function(_0x15a518){if(_0x15a518){return _0x349ad1['status'](_0x5e3a33)[_0x7e30('0x1e')](_0x15a518);}};}function respondWithFilteredResult(_0x302500,_0x2eafbd){return function(_0xb013a9){if(_0xb013a9){var _0x327336=typeof _0x2eafbd[_0x7e30('0x1f')]===_0x7e30('0x20')&&typeof _0x2eafbd[_0x7e30('0x21')]===_0x7e30('0x20');var _0x17d3c0=_0xb013a9[_0x7e30('0x22')];var _0x499b60=_0x327336?0x0:_0x2eafbd[_0x7e30('0x1f')];var _0x429e9e=_0x327336?_0xb013a9['count']:_0x2eafbd['offset']+_0x2eafbd['limit'];var _0x364aca;if(_0x429e9e>=_0x17d3c0){_0x429e9e=_0x17d3c0;_0x364aca=0xc8;}else{_0x364aca=0xce;}_0x302500[_0x7e30('0x1c')](_0x364aca);return _0x302500[_0x7e30('0x23')](_0x7e30('0x24'),_0x499b60+'-'+_0x429e9e+'/'+_0x17d3c0)[_0x7e30('0x1e')](_0xb013a9);}return null;};}function patchUpdates(_0x18ac6f){return function(_0x2e790b){try{jsonpatch['apply'](_0x2e790b,_0x18ac6f,!![]);}catch(_0x2e869f){return BPromise[_0x7e30('0x25')](_0x2e869f);}return _0x2e790b['save']();};}function saveUpdates(_0x15839e,_0x6ccafa){return function(_0x4574c8){if(_0x4574c8){return _0x4574c8[_0x7e30('0x26')](_0x15839e)[_0x7e30('0x27')](function(_0xcf569b){return _0xcf569b;});}return null;};}function removeEntity(_0xea8bbe,_0x3dcf72){return function(_0x4d3bb7){if(_0x4d3bb7){return _0x4d3bb7['destroy']()['then'](function(){_0xea8bbe[_0x7e30('0x1c')](0xcc)[_0x7e30('0x1d')]();});}};}function handleEntityNotFound(_0x164637,_0x1f37b3){return function(_0x4766d8){if(!_0x4766d8){_0x164637['sendStatus'](0x194);}return _0x4766d8;};}function handleError(_0x567f37,_0x57ffe2){_0x57ffe2=_0x57ffe2||0x1f4;return function(_0xc6658e){logger[_0x7e30('0x28')](_0xc6658e['stack']);if(_0xc6658e[_0x7e30('0x29')]){delete _0xc6658e[_0x7e30('0x29')];}_0x567f37[_0x7e30('0x1c')](_0x57ffe2)['send'](_0xc6658e);};}exports[_0x7e30('0x2a')]=function(_0x1fb532,_0x8984b8){var _0x39b6ac={},_0x4f4ba2={},_0x137826={'count':0x0,'rows':[]};var _0x3087d3=_[_0x7e30('0x2b')](db[_0x7e30('0x2c')]['rawAttributes'],function(_0x3b8760){return{'name':_0x3b8760[_0x7e30('0x2d')],'type':_0x3b8760[_0x7e30('0x2e')][_0x7e30('0x2f')]};});_0x4f4ba2[_0x7e30('0x30')]=_[_0x7e30('0x2b')](_0x3087d3,'name');_0x4f4ba2[_0x7e30('0x31')]=_[_0x7e30('0x32')](_0x1fb532[_0x7e30('0x31')]);_0x4f4ba2['filters']=_[_0x7e30('0x33')](_0x4f4ba2[_0x7e30('0x30')],_0x4f4ba2['query']);_0x39b6ac[_0x7e30('0x34')]=_['intersection'](_0x4f4ba2[_0x7e30('0x30')],qs[_0x7e30('0x35')](_0x1fb532[_0x7e30('0x31')][_0x7e30('0x35')]));_0x39b6ac[_0x7e30('0x34')]=_0x39b6ac[_0x7e30('0x34')]['length']?_0x39b6ac[_0x7e30('0x34')]:_0x4f4ba2['model'];if(!_0x1fb532[_0x7e30('0x31')]['hasOwnProperty'](_0x7e30('0x36'))){_0x39b6ac[_0x7e30('0x21')]=qs[_0x7e30('0x21')](_0x1fb532[_0x7e30('0x31')]['limit']);_0x39b6ac[_0x7e30('0x1f')]=qs[_0x7e30('0x1f')](_0x1fb532[_0x7e30('0x31')][_0x7e30('0x1f')]);}_0x39b6ac['order']=qs[_0x7e30('0x37')](_0x1fb532[_0x7e30('0x31')][_0x7e30('0x37')]);_0x39b6ac[_0x7e30('0x38')]=qs[_0x7e30('0x39')](_[_0x7e30('0x3a')](_0x1fb532[_0x7e30('0x31')],_0x4f4ba2[_0x7e30('0x39')]),_0x3087d3);if(_0x1fb532[_0x7e30('0x31')][_0x7e30('0x3b')]){_0x39b6ac[_0x7e30('0x38')]=_[_0x7e30('0x3c')](_0x39b6ac['where'],{'$or':_[_0x7e30('0x2b')](_0x3087d3,function(_0x2823fb){if(_0x2823fb[_0x7e30('0x2e')]!==_0x7e30('0x3d')){var _0x21149d={};_0x21149d[_0x2823fb['name']]={'$like':'%'+_0x1fb532[_0x7e30('0x31')][_0x7e30('0x3b')]+'%'};return _0x21149d;}})});}_0x39b6ac=_['merge']({},_0x39b6ac,_0x1fb532[_0x7e30('0x3e')]);var _0x34dd97={'where':_0x39b6ac[_0x7e30('0x38')]};return db[_0x7e30('0x2c')]['count'](_0x34dd97)['then'](function(_0x4557e9){_0x137826[_0x7e30('0x22')]=_0x4557e9;if(_0x1fb532[_0x7e30('0x31')][_0x7e30('0x3f')]){_0x39b6ac['include']=[{'all':!![]}];}return db[_0x7e30('0x2c')]['findAll'](_0x39b6ac);})[_0x7e30('0x27')](function(_0x3849d7){_0x137826[_0x7e30('0x40')]=_0x3849d7;return _0x137826;})[_0x7e30('0x27')](respondWithFilteredResult(_0x8984b8,_0x39b6ac))[_0x7e30('0x41')](handleError(_0x8984b8,null));};exports['show']=function(_0x3a3cf8,_0x2337f4){var _0x320acc={'raw':![],'where':{'id':_0x3a3cf8[_0x7e30('0x42')]['id']}},_0x1582f8={};_0x1582f8['model']=_[_0x7e30('0x32')](db[_0x7e30('0x2c')][_0x7e30('0x43')]);_0x1582f8['query']=_[_0x7e30('0x32')](_0x3a3cf8[_0x7e30('0x31')]);_0x1582f8[_0x7e30('0x39')]=_['intersection'](_0x1582f8[_0x7e30('0x30')],_0x1582f8[_0x7e30('0x31')]);_0x320acc[_0x7e30('0x34')]=_[_0x7e30('0x33')](_0x1582f8['model'],qs[_0x7e30('0x35')](_0x3a3cf8[_0x7e30('0x31')]['fields']));_0x320acc[_0x7e30('0x34')]=_0x320acc[_0x7e30('0x34')][_0x7e30('0x44')]?_0x320acc['attributes']:_0x1582f8['model'];if(_0x3a3cf8[_0x7e30('0x31')]['includeAll']){_0x320acc[_0x7e30('0x45')]=[{'all':!![]}];}_0x320acc=_['merge']({},_0x320acc,_0x3a3cf8[_0x7e30('0x3e')]);return db[_0x7e30('0x2c')][_0x7e30('0x46')](_0x320acc)[_0x7e30('0x27')](handleEntityNotFound(_0x2337f4,null))[_0x7e30('0x27')](respondWithResult(_0x2337f4,null))[_0x7e30('0x41')](handleError(_0x2337f4,null));};exports[_0x7e30('0x47')]=function(_0x5ae487,_0x149456){return db['AnalyticFieldReport'][_0x7e30('0x47')](_0x5ae487[_0x7e30('0x48')],{})['then'](respondWithResult(_0x149456,0xc9))[_0x7e30('0x41')](handleError(_0x149456,null));};exports['bulkCreate']=function(_0x29484f,_0xc5672f){return db[_0x7e30('0x2c')][_0x7e30('0x49')](_0x29484f['body'],{'raw':![],'individualHooks':!![]})[_0x7e30('0x27')](respondWithResult(_0xc5672f,0xc9))[_0x7e30('0x41')](handleError(_0xc5672f,null));};exports[_0x7e30('0x26')]=function(_0x2dd364,_0x1a57c2){if(_0x2dd364[_0x7e30('0x48')]['id']){delete _0x2dd364[_0x7e30('0x48')]['id'];}return db[_0x7e30('0x2c')][_0x7e30('0x46')]({'where':{'id':_0x2dd364['params']['id']}})[_0x7e30('0x27')](handleEntityNotFound(_0x1a57c2,null))[_0x7e30('0x27')](saveUpdates(_0x2dd364['body'],null))[_0x7e30('0x27')](respondWithResult(_0x1a57c2,null))[_0x7e30('0x41')](handleError(_0x1a57c2,null));};exports['destroy']=function(_0x332b9a,_0x1300b2){return db[_0x7e30('0x2c')][_0x7e30('0x46')]({'where':{'id':_0x332b9a[_0x7e30('0x42')]['id']}})[_0x7e30('0x27')](handleEntityNotFound(_0x1300b2,null))['then'](removeEntity(_0x1300b2,null))['catch'](handleError(_0x1300b2,null));};exports[_0x7e30('0x4a')]=function(_0x2cc041,_0x11617e){return db[_0x7e30('0x2c')]['destroy']({'where':{'id':_0x2cc041['query'][_0x7e30('0x4b')]||[]},'raw':![],'individualHooks':!![]})[_0x7e30('0x27')](respondWithResult(_0x11617e,0xcc))[_0x7e30('0x41')](handleError(_0x11617e,null));};exports['addFields']=function(_0x4fc6b5,_0x5ac83c,_0x407c62){return db[_0x7e30('0x4c')][_0x7e30('0x4d')]({'where':{'id':_0x4fc6b5[_0x7e30('0x42')]['id']}})[_0x7e30('0x27')](handleEntityNotFound(_0x5ac83c,null))[_0x7e30('0x27')](function(_0x5d4e1e){if(_0x5d4e1e){return db[_0x7e30('0x4e')][_0x7e30('0x4f')](function(_0x5f25fa){return db[_0x7e30('0x2c')]['destroy']({'where':{'CustomReportId':_0x4fc6b5[_0x7e30('0x42')]['id']},'transaction':_0x5f25fa})['then'](function(_0x4f8b94){var _0x3e1b42=_['map'](_0x4fc6b5[_0x7e30('0x48')],function(_0x3cdc00){delete _0x3cdc00['id'];_0x3cdc00[_0x7e30('0x50')]=_0x4fc6b5[_0x7e30('0x42')]['id'];return _0x3cdc00;});return db[_0x7e30('0x2c')][_0x7e30('0x49')](_0x3e1b42,{'transaction':_0x5f25fa});});})[_0x7e30('0x27')](function(){return db['AnalyticFieldReport'][_0x7e30('0x51')]({'where':{'CustomReportId':_0x4fc6b5[_0x7e30('0x42')]['id']}});});}})[_0x7e30('0x27')](respondWithResult(_0x5ac83c,null))['catch'](handleError(_0x5ac83c,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 8ce0668..5288347 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 _0xe320=['../../config/logger','moment','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport'];(function(_0x2694a4,_0x46b7cb){var _0x113c52=function(_0x500d3b){while(--_0x500d3b){_0x2694a4['push'](_0x2694a4['shift']());}};_0x113c52(++_0x46b7cb);}(_0xe320,0x13b));var _0x0e32=function(_0x3ad25e,_0x5d80a6){_0x3ad25e=_0x3ad25e-0x0;var _0x156775=_0xe320[_0x3ad25e];return _0x156775;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0e32('0x0'))('api');var moment=require(_0x0e32('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0e32('0x2'));var rimraf=require(_0x0e32('0x3'));var config=require(_0x0e32('0x4'));var attributes=require(_0x0e32('0x5'));module[_0x0e32('0x6')]=function(_0x43d378,_0x3bf241){return _0x43d378[_0x0e32('0x7')](_0x0e32('0x8'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4564=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields'];(function(_0x317257,_0x1677dc){var _0x1f235d=function(_0xda0ccf){while(--_0xda0ccf){_0x317257['push'](_0x317257['shift']());}};_0x1f235d(++_0x1677dc);}(_0x4564,0x1c7));var _0x4456=function(_0x3486f2,_0x1153b5){_0x3486f2=_0x3486f2-0x0;var _0x2bb12c=_0x4564[_0x3486f2];return _0x2bb12c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4456('0x0'))(_0x4456('0x1'));var moment=require(_0x4456('0x2'));var BPromise=require(_0x4456('0x3'));var rp=require(_0x4456('0x4'));var fs=require('fs');var path=require(_0x4456('0x5'));var rimraf=require(_0x4456('0x6'));var config=require(_0x4456('0x7'));var attributes=require(_0x4456('0x8'));module[_0x4456('0x9')]=function(_0xf3c9d8,_0x3ff424){return _0xf3c9d8[_0x4456('0xa')](_0x4456('0xb'),attributes,{'tableName':_0x4456('0xc'),'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 bf30447..704e9bd 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 _0xcf90=['util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x36f641,_0x1a3063){var _0x39b299=function(_0x20c0a3){while(--_0x20c0a3){_0x36f641['push'](_0x36f641['shift']());}};_0x39b299(++_0x1a3063);}(_0xcf90,0x175));var _0x0cf9=function(_0x1b514f,_0x30fba3){_0x1b514f=_0x1b514f-0x0;var _0x3d5c97=_0xcf90[_0x1b514f];return _0x3d5c97;};'use strict';var _=require(_0x0cf9('0x0'));var util=require(_0x0cf9('0x1'));var moment=require('moment');var BPromise=require(_0x0cf9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0cf9('0x3'));var db=require(_0x0cf9('0x4'))['db'];var utils=require(_0x0cf9('0x5'));var logger=require(_0x0cf9('0x6'))(_0x0cf9('0x7'));var config=require('../../config/environment');var jayson=require(_0x0cf9('0x8'));var client=jayson[_0x0cf9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25973d,_0x20e17d,_0x51a0cb){return new BPromise(function(_0x5a1046,_0x34915){return client[_0x0cf9('0xa')](_0x25973d,_0x51a0cb)[_0x0cf9('0xb')](function(_0x418068){logger[_0x0cf9('0xc')](_0x0cf9('0xd'),_0x20e17d,_0x0cf9('0xe'));logger[_0x0cf9('0xf')](_0x0cf9('0x10'),_0x20e17d,_0x0cf9('0xe'),JSON[_0x0cf9('0x11')](_0x418068));if(_0x418068['error']){if(_0x418068[_0x0cf9('0x12')][_0x0cf9('0x13')]===0x1f4){logger[_0x0cf9('0x12')](_0x0cf9('0xd'),_0x20e17d,_0x418068['error'][_0x0cf9('0x14')]);return _0x34915(_0x418068['error'][_0x0cf9('0x14')]);}logger[_0x0cf9('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0x20e17d,_0x418068[_0x0cf9('0x12')][_0x0cf9('0x14')]);return _0x5a1046(_0x418068[_0x0cf9('0x12')][_0x0cf9('0x14')]);}else{logger[_0x0cf9('0xc')](_0x0cf9('0xd'),_0x20e17d,_0x0cf9('0xe'));_0x5a1046(_0x418068[_0x0cf9('0x15')][_0x0cf9('0x14')]);}})['catch'](function(_0x5dbda8){logger['error'](_0x0cf9('0xd'),_0x20e17d,_0x5dbda8);_0x34915(_0x5dbda8);});});} \ No newline at end of file +var _0x7fef=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment'];(function(_0x1d7d58,_0x2bbefb){var _0x21a6cb=function(_0x2aa61c){while(--_0x2aa61c){_0x1d7d58['push'](_0x1d7d58['shift']());}};_0x21a6cb(++_0x2bbefb);}(_0x7fef,0xbd));var _0xf7fe=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7fef[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xf7fe('0x0'));var util=require(_0xf7fe('0x1'));var moment=require(_0xf7fe('0x2'));var BPromise=require(_0xf7fe('0x3'));var rs=require(_0xf7fe('0x4'));var fs=require('fs');var Redis=require(_0xf7fe('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf7fe('0x6'));var logger=require(_0xf7fe('0x7'))(_0xf7fe('0x8'));var config=require(_0xf7fe('0x9'));var jayson=require(_0xf7fe('0xa'));var client=jayson[_0xf7fe('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56f17e,_0x1a7633,_0x168a73){return new BPromise(function(_0xd149ae,_0x257952){return client[_0xf7fe('0xc')](_0x56f17e,_0x168a73)[_0xf7fe('0xd')](function(_0x333f5f){logger[_0xf7fe('0xe')](_0xf7fe('0xf'),_0x1a7633,'request\x20sent');logger[_0xf7fe('0x10')](_0xf7fe('0x11'),_0x1a7633,_0xf7fe('0x12'),JSON[_0xf7fe('0x13')](_0x333f5f));if(_0x333f5f['error']){if(_0x333f5f[_0xf7fe('0x14')][_0xf7fe('0x15')]===0x1f4){logger[_0xf7fe('0x14')](_0xf7fe('0xf'),_0x1a7633,_0x333f5f['error'][_0xf7fe('0x16')]);return _0x257952(_0x333f5f[_0xf7fe('0x14')][_0xf7fe('0x16')]);}logger[_0xf7fe('0x14')](_0xf7fe('0xf'),_0x1a7633,_0x333f5f[_0xf7fe('0x14')][_0xf7fe('0x16')]);return _0xd149ae(_0x333f5f[_0xf7fe('0x14')][_0xf7fe('0x16')]);}else{logger['info'](_0xf7fe('0xf'),_0x1a7633,_0xf7fe('0x12'));_0xd149ae(_0x333f5f[_0xf7fe('0x17')][_0xf7fe('0x16')]);}})['catch'](function(_0x54abbc){logger[_0xf7fe('0x14')](_0xf7fe('0xf'),_0x1a7633,_0x54abbc);_0x257952(_0x54abbc);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 378dd4e..74c97c7 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(_0x1c7033,_0x895853){var _0xf93472=function(_0x54d328){while(--_0x54d328){_0x1c7033['push'](_0x1c7033['shift']());}};_0xf93472(++_0x895853);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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(_0x24882d,_0x3fdc21){var _0x5885e9=function(_0x5e105f){while(--_0x5e105f){_0x24882d['push'](_0x24882d['shift']());}};_0x5885e9(++_0x3fdc21);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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 0f00c70..73668bd 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 _0xaf1d=['exports','STRING','name','TEXT','sequelize'];(function(_0x1b96f2,_0x14f728){var _0x53eace=function(_0x3eee42){while(--_0x3eee42){_0x1b96f2['push'](_0x1b96f2['shift']());}};_0x53eace(++_0x14f728);}(_0xaf1d,0x9f));var _0xdaf1=function(_0x526cde,_0x505ef0){_0x526cde=_0x526cde-0x0;var _0x489274=_0xaf1d[_0x526cde];return _0x489274;};'use strict';var Sequelize=require(_0xdaf1('0x0'));module[_0xdaf1('0x1')]={'name':{'type':Sequelize[_0xdaf1('0x2')],'allowNull':![],'unique':_0xdaf1('0x3')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0xdaf1('0x4')]},'description':{'type':Sequelize[_0xdaf1('0x2')]}}; \ No newline at end of file +var _0x3f19=['sequelize','STRING'];(function(_0x53e3de,_0x13da7b){var _0x7b905b=function(_0x29b56a){while(--_0x29b56a){_0x53e3de['push'](_0x53e3de['shift']());}};_0x7b905b(++_0x13da7b);}(_0x3f19,0xc0));var _0x93f1=function(_0x53db91,_0x29a9c0){_0x53db91=_0x53db91-0x0;var _0x5ccf61=_0x3f19[_0x53db91];return _0x5ccf61;};'use strict';var Sequelize=require(_0x93f1('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x93f1('0x1')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0x93f1('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 050d849..6028521 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 _0x00bb=['create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','json','undefined','limit','offset','apply','reject','update','destroy','get','Metrics','then','stack','name','send','map','AnalyticMetric','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','count','includeAll','include','findAll','rows','catch','show','params','keys','find'];(function(_0x3a0f4b,_0x365b6e){var _0x1238c8=function(_0x182d57){while(--_0x182d57){_0x3a0f4b['push'](_0x3a0f4b['shift']());}};_0x1238c8(++_0x365b6e);}(_0x00bb,0x1d8));var _0xb00b=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x00bb[_0x3054be];return _0x3df150;};'use strict';var emlformat=require(_0xb00b('0x0'));var rimraf=require(_0xb00b('0x1'));var zipdir=require(_0xb00b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb00b('0x3'));var moment=require('moment');var BPromise=require(_0xb00b('0x4'));var Mustache=require(_0xb00b('0x5'));var util=require('util');var path=require(_0xb00b('0x6'));var sox=require(_0xb00b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb00b('0x8'));var squel=require(_0xb00b('0x9'));var crypto=require(_0xb00b('0xa'));var jsforce=require(_0xb00b('0xb'));var deskjs=require(_0xb00b('0xc'));var toCsv=require(_0xb00b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb00b('0xe'));var authService=require(_0xb00b('0xf'));var qs=require(_0xb00b('0x10'));var as=require(_0xb00b('0x11'));var hardwareService=require(_0xb00b('0x12'));var logger=require('../../config/logger')(_0xb00b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb00b('0x14'))['db'];function respondWithStatusCode(_0x2d8ddf,_0x1be8aa){_0x1be8aa=_0x1be8aa||0xcc;return function(_0x466b9b){if(_0x466b9b){return _0x2d8ddf[_0xb00b('0x15')](_0x1be8aa);}return _0x2d8ddf[_0xb00b('0x16')](_0x1be8aa)['end']();};}function respondWithResult(_0x218de2,_0xb0d42e){_0xb0d42e=_0xb0d42e||0xc8;return function(_0x482fe6){if(_0x482fe6){return _0x218de2[_0xb00b('0x16')](_0xb0d42e)[_0xb00b('0x17')](_0x482fe6);}};}function respondWithFilteredResult(_0x540b79,_0x5da36b){return function(_0x9b471e){if(_0x9b471e){var _0x4dcd45=typeof _0x5da36b['offset']===_0xb00b('0x18')&&typeof _0x5da36b[_0xb00b('0x19')]===_0xb00b('0x18');var _0xbb72fc=_0x9b471e['count'];var _0x2a7231=_0x4dcd45?0x0:_0x5da36b['offset'];var _0x415f91=_0x4dcd45?_0x9b471e['count']:_0x5da36b[_0xb00b('0x1a')]+_0x5da36b['limit'];var _0xb26ebb;if(_0x415f91>=_0xbb72fc){_0x415f91=_0xbb72fc;_0xb26ebb=0xc8;}else{_0xb26ebb=0xce;}_0x540b79[_0xb00b('0x16')](_0xb26ebb);return _0x540b79['set']('Content-Range',_0x2a7231+'-'+_0x415f91+'/'+_0xbb72fc)[_0xb00b('0x17')](_0x9b471e);}return null;};}function patchUpdates(_0x4a334b){return function(_0x1344c4){try{jsonpatch[_0xb00b('0x1b')](_0x1344c4,_0x4a334b,!![]);}catch(_0x2fe48d){return BPromise[_0xb00b('0x1c')](_0x2fe48d);}return _0x1344c4['save']();};}function saveUpdates(_0x362ee0,_0x4df284){return function(_0x25a973){if(_0x25a973){return _0x25a973[_0xb00b('0x1d')](_0x362ee0)['then'](function(_0x231293){return _0x231293;});}return null;};}function removeEntity(_0x2896d1,_0x520444){return function(_0x3ab3cc){if(_0x3ab3cc){return _0x3ab3cc[_0xb00b('0x1e')]()['then'](function(){var _0x44efe5=_0x3ab3cc[_0xb00b('0x1f')]({'plain':!![]});var _0x3c9500=_0xb00b('0x20');return db['UserProfileResource']['destroy']({'where':{'type':_0x3c9500,'resourceId':_0x44efe5['id']}})[_0xb00b('0x21')](function(){return _0x3ab3cc;});})['then'](function(){_0x2896d1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x16ac55,_0x73b6b0){return function(_0x2592cf){if(!_0x2592cf){_0x16ac55[_0xb00b('0x15')](0x194);}return _0x2592cf;};}function handleError(_0x1f14fa,_0x197379){_0x197379=_0x197379||0x1f4;return function(_0x15d3b9){logger['error'](_0x15d3b9[_0xb00b('0x22')]);if(_0x15d3b9['name']){delete _0x15d3b9[_0xb00b('0x23')];}_0x1f14fa[_0xb00b('0x16')](_0x197379)[_0xb00b('0x24')](_0x15d3b9);};}exports['index']=function(_0x2fc11a,_0x280ed3){var _0x16fbd5={},_0x183233={},_0x303625={'count':0x0,'rows':[]};var _0x2b9824=_[_0xb00b('0x25')](db[_0xb00b('0x26')][_0xb00b('0x27')],function(_0x54e247){return{'name':_0x54e247[_0xb00b('0x28')],'type':_0x54e247[_0xb00b('0x29')]['key']};});_0x183233[_0xb00b('0x2a')]=_[_0xb00b('0x25')](_0x2b9824,'name');_0x183233[_0xb00b('0x2b')]=_['keys'](_0x2fc11a[_0xb00b('0x2b')]);_0x183233[_0xb00b('0x2c')]=_[_0xb00b('0x2d')](_0x183233[_0xb00b('0x2a')],_0x183233[_0xb00b('0x2b')]);_0x16fbd5[_0xb00b('0x2e')]=_[_0xb00b('0x2d')](_0x183233['model'],qs['fields'](_0x2fc11a['query'][_0xb00b('0x2f')]));_0x16fbd5[_0xb00b('0x2e')]=_0x16fbd5[_0xb00b('0x2e')][_0xb00b('0x30')]?_0x16fbd5['attributes']:_0x183233[_0xb00b('0x2a')];if(!_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x31')](_0xb00b('0x32'))){_0x16fbd5[_0xb00b('0x19')]=qs[_0xb00b('0x19')](_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x19')]);_0x16fbd5['offset']=qs['offset'](_0x2fc11a[_0xb00b('0x2b')]['offset']);}_0x16fbd5[_0xb00b('0x33')]=qs[_0xb00b('0x34')](_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x34')]);_0x16fbd5[_0xb00b('0x35')]=qs[_0xb00b('0x2c')](_[_0xb00b('0x36')](_0x2fc11a['query'],_0x183233[_0xb00b('0x2c')]),_0x2b9824);if(_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x37')]){_0x16fbd5[_0xb00b('0x35')]=_[_0xb00b('0x38')](_0x16fbd5[_0xb00b('0x35')],{'$or':_['map'](_0x2b9824,function(_0x36980a){if(_0x36980a[_0xb00b('0x29')]!=='VIRTUAL'){var _0x17ff34={};_0x17ff34[_0x36980a[_0xb00b('0x23')]]={'$like':'%'+_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x37')]+'%'};return _0x17ff34;}})});}_0x16fbd5=_[_0xb00b('0x38')]({},_0x16fbd5,_0x2fc11a['options']);var _0x14ff6a={'where':_0x16fbd5[_0xb00b('0x35')]};return db[_0xb00b('0x26')][_0xb00b('0x39')](_0x14ff6a)['then'](function(_0x4867fe){_0x303625[_0xb00b('0x39')]=_0x4867fe;if(_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x3a')]){_0x16fbd5[_0xb00b('0x3b')]=[{'all':!![]}];}return db[_0xb00b('0x26')][_0xb00b('0x3c')](_0x16fbd5);})[_0xb00b('0x21')](function(_0x493841){_0x303625[_0xb00b('0x3d')]=_0x493841;return _0x303625;})[_0xb00b('0x21')](respondWithFilteredResult(_0x280ed3,_0x16fbd5))[_0xb00b('0x3e')](handleError(_0x280ed3,null));};exports[_0xb00b('0x3f')]=function(_0x302ded,_0x1dc4c5){var _0x2e3d83={'raw':!![],'where':{'id':_0x302ded[_0xb00b('0x40')]['id']}},_0x974a29={};_0x974a29[_0xb00b('0x2a')]=_[_0xb00b('0x41')](db[_0xb00b('0x26')]['rawAttributes']);_0x974a29[_0xb00b('0x2b')]=_[_0xb00b('0x41')](_0x302ded[_0xb00b('0x2b')]);_0x974a29[_0xb00b('0x2c')]=_[_0xb00b('0x2d')](_0x974a29[_0xb00b('0x2a')],_0x974a29[_0xb00b('0x2b')]);_0x2e3d83[_0xb00b('0x2e')]=_[_0xb00b('0x2d')](_0x974a29[_0xb00b('0x2a')],qs[_0xb00b('0x2f')](_0x302ded[_0xb00b('0x2b')]['fields']));_0x2e3d83['attributes']=_0x2e3d83['attributes'][_0xb00b('0x30')]?_0x2e3d83[_0xb00b('0x2e')]:_0x974a29['model'];if(_0x302ded[_0xb00b('0x2b')][_0xb00b('0x3a')]){_0x2e3d83[_0xb00b('0x3b')]=[{'all':!![]}];}_0x2e3d83=_[_0xb00b('0x38')]({},_0x2e3d83,_0x302ded['options']);return db['AnalyticMetric'][_0xb00b('0x42')](_0x2e3d83)[_0xb00b('0x21')](handleEntityNotFound(_0x1dc4c5,null))['then'](respondWithResult(_0x1dc4c5,null))['catch'](handleError(_0x1dc4c5,null));};exports[_0xb00b('0x43')]=function(_0x3a205d,_0x4e0be4){return db[_0xb00b('0x26')]['create'](_0x3a205d['body'],{})['then'](function(_0x465d90){var _0x481515=_0x3a205d[_0xb00b('0x44')][_0xb00b('0x1f')]({'plain':!![]});if(!_0x481515)throw new Error(_0xb00b('0x45'));if(_0x481515[_0xb00b('0x46')]===_0xb00b('0x44')){var _0xda60ca=_0x465d90['get']({'plain':!![]});var _0x5bd40c=_0xb00b('0x20');return db[_0xb00b('0x47')]['find']({'where':{'name':_0x5bd40c,'userProfileId':_0x481515[_0xb00b('0x48')]},'raw':!![]})[_0xb00b('0x21')](function(_0x57f6ab){if(_0x57f6ab&&_0x57f6ab[_0xb00b('0x49')]===0x0){return db[_0xb00b('0x4a')][_0xb00b('0x43')]({'name':_0xda60ca['name'],'resourceId':_0xda60ca['id'],'type':_0x57f6ab['name'],'sectionId':_0x57f6ab['id']},{})[_0xb00b('0x21')](function(){return _0x465d90;});}else{return _0x465d90;}})[_0xb00b('0x3e')](function(_0x12737d){logger[_0xb00b('0x4b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x12737d);throw _0x12737d;});}return _0x465d90;})[_0xb00b('0x21')](respondWithResult(_0x4e0be4,0xc9))[_0xb00b('0x3e')](handleError(_0x4e0be4,null));};exports['update']=function(_0x4cd9fd,_0x160965){if(_0x4cd9fd['body']['id']){delete _0x4cd9fd[_0xb00b('0x4c')]['id'];}return db[_0xb00b('0x26')][_0xb00b('0x42')]({'where':{'id':_0x4cd9fd[_0xb00b('0x40')]['id']}})[_0xb00b('0x21')](handleEntityNotFound(_0x160965,null))[_0xb00b('0x21')](saveUpdates(_0x4cd9fd['body'],null))[_0xb00b('0x21')](respondWithResult(_0x160965,null))['catch'](handleError(_0x160965,null));};exports[_0xb00b('0x1e')]=function(_0x98caa9,_0x4129ba){return db['AnalyticMetric'][_0xb00b('0x42')]({'where':{'id':_0x98caa9[_0xb00b('0x40')]['id']}})[_0xb00b('0x21')](handleEntityNotFound(_0x4129ba,null))['then'](removeEntity(_0x4129ba,null))[_0xb00b('0x3e')](handleError(_0x4129ba,null));}; \ No newline at end of file +var _0x4b84=['status','end','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Metrics','UserProfileResource','sendStatus','stack','name','map','AnalyticMetric','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','mustache','util','path','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x41a60b,_0xc398d){var _0x10c95a=function(_0x2b8bd9){while(--_0x2b8bd9){_0x41a60b['push'](_0x41a60b['shift']());}};_0x10c95a(++_0xc398d);}(_0x4b84,0x1cc));var _0x44b8=function(_0x7b173,_0x539d7f){_0x7b173=_0x7b173-0x0;var _0x1c598c=_0x4b84[_0x7b173];return _0x1c598c;};'use strict';var emlformat=require(_0x44b8('0x0'));var rimraf=require(_0x44b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x44b8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x44b8('0x3'));var util=require(_0x44b8('0x4'));var path=require(_0x44b8('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x44b8('0x6'));var _=require('lodash');var squel=require(_0x44b8('0x7'));var crypto=require('crypto');var jsforce=require(_0x44b8('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x44b8('0x9'));var Papa=require(_0x44b8('0xa'));var Redis=require(_0x44b8('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x44b8('0xc'));var as=require(_0x44b8('0xd'));var hardwareService=require(_0x44b8('0xe'));var logger=require(_0x44b8('0xf'))(_0x44b8('0x10'));var utils=require(_0x44b8('0x11'));var config=require(_0x44b8('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x44b8('0x13'))['db'];function respondWithStatusCode(_0x4301a6,_0x4bcc43){_0x4bcc43=_0x4bcc43||0xcc;return function(_0x194230){if(_0x194230){return _0x4301a6['sendStatus'](_0x4bcc43);}return _0x4301a6[_0x44b8('0x14')](_0x4bcc43)[_0x44b8('0x15')]();};}function respondWithResult(_0x4df670,_0x63e8f6){_0x63e8f6=_0x63e8f6||0xc8;return function(_0x4be54c){if(_0x4be54c){return _0x4df670['status'](_0x63e8f6)[_0x44b8('0x16')](_0x4be54c);}};}function respondWithFilteredResult(_0x2af0ad,_0x1722da){return function(_0x41ab46){if(_0x41ab46){var _0x5e52f2=typeof _0x1722da['offset']==='undefined'&&typeof _0x1722da[_0x44b8('0x17')]==='undefined';var _0x28ef36=_0x41ab46[_0x44b8('0x18')];var _0x55e258=_0x5e52f2?0x0:_0x1722da[_0x44b8('0x19')];var _0xe3de8f=_0x5e52f2?_0x41ab46['count']:_0x1722da[_0x44b8('0x19')]+_0x1722da[_0x44b8('0x17')];var _0x4b600f;if(_0xe3de8f>=_0x28ef36){_0xe3de8f=_0x28ef36;_0x4b600f=0xc8;}else{_0x4b600f=0xce;}_0x2af0ad[_0x44b8('0x14')](_0x4b600f);return _0x2af0ad[_0x44b8('0x1a')](_0x44b8('0x1b'),_0x55e258+'-'+_0xe3de8f+'/'+_0x28ef36)[_0x44b8('0x16')](_0x41ab46);}return null;};}function patchUpdates(_0x102ef9){return function(_0x369c09){try{jsonpatch[_0x44b8('0x1c')](_0x369c09,_0x102ef9,!![]);}catch(_0x9b0536){return BPromise[_0x44b8('0x1d')](_0x9b0536);}return _0x369c09[_0x44b8('0x1e')]();};}function saveUpdates(_0x1d642b,_0x14996c){return function(_0x48327e){if(_0x48327e){return _0x48327e[_0x44b8('0x1f')](_0x1d642b)[_0x44b8('0x20')](function(_0x416b34){return _0x416b34;});}return null;};}function removeEntity(_0x1418db,_0x305a5c){return function(_0x51a34a){if(_0x51a34a){return _0x51a34a[_0x44b8('0x21')]()['then'](function(){var _0x41a922=_0x51a34a[_0x44b8('0x22')]({'plain':!![]});var _0x25a0c1=_0x44b8('0x23');return db[_0x44b8('0x24')]['destroy']({'where':{'type':_0x25a0c1,'resourceId':_0x41a922['id']}})[_0x44b8('0x20')](function(){return _0x51a34a;});})['then'](function(){_0x1418db[_0x44b8('0x14')](0xcc)[_0x44b8('0x15')]();});}};}function handleEntityNotFound(_0x549a26,_0x17ac44){return function(_0x470f49){if(!_0x470f49){_0x549a26[_0x44b8('0x25')](0x194);}return _0x470f49;};}function handleError(_0x59c1bf,_0xb22107){_0xb22107=_0xb22107||0x1f4;return function(_0x242342){logger['error'](_0x242342[_0x44b8('0x26')]);if(_0x242342['name']){delete _0x242342[_0x44b8('0x27')];}_0x59c1bf['status'](_0xb22107)['send'](_0x242342);};}exports['index']=function(_0x387293,_0x29b18d){var _0x44ce5a={},_0x1bd1be={},_0x38cd17={'count':0x0,'rows':[]};var _0xc3f667=_[_0x44b8('0x28')](db[_0x44b8('0x29')][_0x44b8('0x2a')],function(_0x28f918){return{'name':_0x28f918[_0x44b8('0x2b')],'type':_0x28f918[_0x44b8('0x2c')][_0x44b8('0x2d')]};});_0x1bd1be['model']=_[_0x44b8('0x28')](_0xc3f667,'name');_0x1bd1be[_0x44b8('0x2e')]=_[_0x44b8('0x2f')](_0x387293[_0x44b8('0x2e')]);_0x1bd1be[_0x44b8('0x30')]=_[_0x44b8('0x31')](_0x1bd1be['model'],_0x1bd1be[_0x44b8('0x2e')]);_0x44ce5a[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x1bd1be[_0x44b8('0x33')],qs[_0x44b8('0x34')](_0x387293['query'][_0x44b8('0x34')]));_0x44ce5a[_0x44b8('0x32')]=_0x44ce5a[_0x44b8('0x32')][_0x44b8('0x35')]?_0x44ce5a[_0x44b8('0x32')]:_0x1bd1be[_0x44b8('0x33')];if(!_0x387293[_0x44b8('0x2e')][_0x44b8('0x36')](_0x44b8('0x37'))){_0x44ce5a[_0x44b8('0x17')]=qs[_0x44b8('0x17')](_0x387293[_0x44b8('0x2e')][_0x44b8('0x17')]);_0x44ce5a[_0x44b8('0x19')]=qs[_0x44b8('0x19')](_0x387293[_0x44b8('0x2e')][_0x44b8('0x19')]);}_0x44ce5a[_0x44b8('0x38')]=qs[_0x44b8('0x39')](_0x387293[_0x44b8('0x2e')][_0x44b8('0x39')]);_0x44ce5a[_0x44b8('0x3a')]=qs['filters'](_[_0x44b8('0x3b')](_0x387293[_0x44b8('0x2e')],_0x1bd1be['filters']),_0xc3f667);if(_0x387293[_0x44b8('0x2e')][_0x44b8('0x3c')]){_0x44ce5a[_0x44b8('0x3a')]=_[_0x44b8('0x3d')](_0x44ce5a['where'],{'$or':_[_0x44b8('0x28')](_0xc3f667,function(_0x11e4e3){if(_0x11e4e3[_0x44b8('0x2c')]!==_0x44b8('0x3e')){var _0x9cb2a={};_0x9cb2a[_0x11e4e3[_0x44b8('0x27')]]={'$like':'%'+_0x387293[_0x44b8('0x2e')][_0x44b8('0x3c')]+'%'};return _0x9cb2a;}})});}_0x44ce5a=_[_0x44b8('0x3d')]({},_0x44ce5a,_0x387293[_0x44b8('0x3f')]);var _0x1c9983={'where':_0x44ce5a[_0x44b8('0x3a')]};return db[_0x44b8('0x29')][_0x44b8('0x18')](_0x1c9983)[_0x44b8('0x20')](function(_0x29b43f){_0x38cd17['count']=_0x29b43f;if(_0x387293[_0x44b8('0x2e')][_0x44b8('0x40')]){_0x44ce5a[_0x44b8('0x41')]=[{'all':!![]}];}return db['AnalyticMetric'][_0x44b8('0x42')](_0x44ce5a);})[_0x44b8('0x20')](function(_0x229cc9){_0x38cd17['rows']=_0x229cc9;return _0x38cd17;})[_0x44b8('0x20')](respondWithFilteredResult(_0x29b18d,_0x44ce5a))[_0x44b8('0x43')](handleError(_0x29b18d,null));};exports[_0x44b8('0x44')]=function(_0x334f86,_0xfd590a){var _0x499a3e={'raw':!![],'where':{'id':_0x334f86[_0x44b8('0x45')]['id']}},_0x5ae5f9={};_0x5ae5f9[_0x44b8('0x33')]=_[_0x44b8('0x2f')](db[_0x44b8('0x29')][_0x44b8('0x2a')]);_0x5ae5f9[_0x44b8('0x2e')]=_[_0x44b8('0x2f')](_0x334f86[_0x44b8('0x2e')]);_0x5ae5f9[_0x44b8('0x30')]=_[_0x44b8('0x31')](_0x5ae5f9[_0x44b8('0x33')],_0x5ae5f9[_0x44b8('0x2e')]);_0x499a3e[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x5ae5f9[_0x44b8('0x33')],qs[_0x44b8('0x34')](_0x334f86[_0x44b8('0x2e')][_0x44b8('0x34')]));_0x499a3e[_0x44b8('0x32')]=_0x499a3e['attributes']['length']?_0x499a3e[_0x44b8('0x32')]:_0x5ae5f9[_0x44b8('0x33')];if(_0x334f86[_0x44b8('0x2e')][_0x44b8('0x40')]){_0x499a3e[_0x44b8('0x41')]=[{'all':!![]}];}_0x499a3e=_[_0x44b8('0x3d')]({},_0x499a3e,_0x334f86[_0x44b8('0x3f')]);return db['AnalyticMetric'][_0x44b8('0x46')](_0x499a3e)['then'](handleEntityNotFound(_0xfd590a,null))[_0x44b8('0x20')](respondWithResult(_0xfd590a,null))[_0x44b8('0x43')](handleError(_0xfd590a,null));};exports[_0x44b8('0x47')]=function(_0x9207bf,_0x103d57){return db[_0x44b8('0x29')]['create'](_0x9207bf[_0x44b8('0x48')],{})[_0x44b8('0x20')](function(_0x10602c){var _0x25d266=_0x9207bf['user'][_0x44b8('0x22')]({'plain':!![]});if(!_0x25d266)throw new Error(_0x44b8('0x49'));if(_0x25d266[_0x44b8('0x4a')]===_0x44b8('0x4b')){var _0x44ec23=_0x10602c[_0x44b8('0x22')]({'plain':!![]});var _0x500bad=_0x44b8('0x23');return db[_0x44b8('0x4c')][_0x44b8('0x46')]({'where':{'name':_0x500bad,'userProfileId':_0x25d266[_0x44b8('0x4d')]},'raw':!![]})[_0x44b8('0x20')](function(_0x57d0e2){if(_0x57d0e2&&_0x57d0e2['autoAssociation']===0x0){return db[_0x44b8('0x24')]['create']({'name':_0x44ec23[_0x44b8('0x27')],'resourceId':_0x44ec23['id'],'type':_0x57d0e2['name'],'sectionId':_0x57d0e2['id']},{})[_0x44b8('0x20')](function(){return _0x10602c;});}else{return _0x10602c;}})[_0x44b8('0x43')](function(_0x1a29f6){logger[_0x44b8('0x4e')](_0x44b8('0x4f'),_0x1a29f6);throw _0x1a29f6;});}return _0x10602c;})[_0x44b8('0x20')](respondWithResult(_0x103d57,0xc9))[_0x44b8('0x43')](handleError(_0x103d57,null));};exports['update']=function(_0x3ad278,_0x37b2c2){if(_0x3ad278[_0x44b8('0x48')]['id']){delete _0x3ad278['body']['id'];}return db[_0x44b8('0x29')][_0x44b8('0x46')]({'where':{'id':_0x3ad278[_0x44b8('0x45')]['id']}})[_0x44b8('0x20')](handleEntityNotFound(_0x37b2c2,null))['then'](saveUpdates(_0x3ad278[_0x44b8('0x48')],null))[_0x44b8('0x20')](respondWithResult(_0x37b2c2,null))['catch'](handleError(_0x37b2c2,null));};exports[_0x44b8('0x21')]=function(_0x19f22b,_0x35136e){return db[_0x44b8('0x29')][_0x44b8('0x46')]({'where':{'id':_0x19f22b['params']['id']}})['then'](handleEntityNotFound(_0x35136e,null))[_0x44b8('0x20')](removeEntity(_0x35136e,null))[_0x44b8('0x43')](handleError(_0x35136e,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 4b89328..d60d316 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 _0x482d=['path','../../config/environment','./analyticMetric.attributes','exports','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x84d8fb,_0x107be4){var _0x4de1fb=function(_0x28a4b1){while(--_0x28a4b1){_0x84d8fb['push'](_0x84d8fb['shift']());}};_0x4de1fb(++_0x107be4);}(_0x482d,0x16c));var _0xd482=function(_0x3b71e2,_0x35c979){_0x3b71e2=_0x3b71e2-0x0;var _0x1bd52e=_0x482d[_0x3b71e2];return _0x1bd52e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd482('0x0'))(_0xd482('0x1'));var moment=require(_0xd482('0x2'));var BPromise=require(_0xd482('0x3'));var rp=require(_0xd482('0x4'));var fs=require('fs');var path=require(_0xd482('0x5'));var rimraf=require('rimraf');var config=require(_0xd482('0x6'));var attributes=require(_0xd482('0x7'));module[_0xd482('0x8')]=function(_0x57cd2c,_0x3b9989){return _0x57cd2c['define']('AnalyticMetric',attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0f4d=['api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x0f4d,0x12c));var _0xd0f4=function(_0x3ff530,_0x1c1ee1){_0x3ff530=_0x3ff530-0x0;var _0x278bb0=_0x0f4d[_0x3ff530];return _0x278bb0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd0f4('0x0'));var moment=require('moment');var BPromise=require(_0xd0f4('0x1'));var rp=require(_0xd0f4('0x2'));var fs=require('fs');var path=require(_0xd0f4('0x3'));var rimraf=require(_0xd0f4('0x4'));var config=require(_0xd0f4('0x5'));var attributes=require(_0xd0f4('0x6'));module[_0xd0f4('0x7')]=function(_0x1d9a9d,_0x531f85){return _0x1d9a9d[_0xd0f4('0x8')](_0xd0f4('0x9'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 433f1b3..820e7e4 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 _0x2e39=['jayson/promise','client','http','then','info','AnalyticMetric,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','rpc','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2e39,0x1c5));var _0x92e3=function(_0x319a63,_0x3a7d3f){_0x319a63=_0x319a63-0x0;var _0x353bca=_0x2e39[_0x319a63];return _0x353bca;};'use strict';var _=require(_0x92e3('0x0'));var util=require(_0x92e3('0x1'));var moment=require('moment');var BPromise=require(_0x92e3('0x2'));var rs=require(_0x92e3('0x3'));var fs=require('fs');var Redis=require(_0x92e3('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x92e3('0x5'));var config=require(_0x92e3('0x6'));var jayson=require(_0x92e3('0x7'));var client=jayson[_0x92e3('0x8')][_0x92e3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x14f09a,_0x33e336,_0x4d9789){return new BPromise(function(_0x374696,_0x25dc98){return client['request'](_0x14f09a,_0x4d9789)[_0x92e3('0xa')](function(_0x2f4ca2){logger[_0x92e3('0xb')](_0x92e3('0xc'),_0x33e336,'request\x20sent');logger[_0x92e3('0xd')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x33e336,_0x92e3('0xe'),JSON[_0x92e3('0xf')](_0x2f4ca2));if(_0x2f4ca2[_0x92e3('0x10')]){if(_0x2f4ca2[_0x92e3('0x10')][_0x92e3('0x11')]===0x1f4){logger[_0x92e3('0x10')](_0x92e3('0xc'),_0x33e336,_0x2f4ca2[_0x92e3('0x10')]['message']);return _0x25dc98(_0x2f4ca2[_0x92e3('0x10')][_0x92e3('0x12')]);}logger[_0x92e3('0x10')](_0x92e3('0xc'),_0x33e336,_0x2f4ca2['error'][_0x92e3('0x12')]);return _0x374696(_0x2f4ca2[_0x92e3('0x10')][_0x92e3('0x12')]);}else{logger[_0x92e3('0xb')](_0x92e3('0xc'),_0x33e336,_0x92e3('0xe'));_0x374696(_0x2f4ca2['result'][_0x92e3('0x12')]);}})[_0x92e3('0x13')](function(_0x5051c4){logger['error'](_0x92e3('0xc'),_0x33e336,_0x5051c4);_0x25dc98(_0x5051c4);});});} \ No newline at end of file +var _0x999e=['request','then','info','AnalyticMetric,\x20%s,\x20%s','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4c649b,_0x1eb725){var _0x5d7983=function(_0x34026f){while(--_0x34026f){_0x4c649b['push'](_0x4c649b['shift']());}};_0x5d7983(++_0x1eb725);}(_0x999e,0x9e));var _0xe999=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x999e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe999('0x0'));var util=require(_0xe999('0x1'));var moment=require(_0xe999('0x2'));var BPromise=require('bluebird');var rs=require(_0xe999('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe999('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe999('0x5'))(_0xe999('0x6'));var config=require(_0xe999('0x7'));var jayson=require(_0xe999('0x8'));var client=jayson[_0xe999('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x319604,_0x260d16,_0x197559){return new BPromise(function(_0x1f6b48,_0x16b877){return client[_0xe999('0xa')](_0x319604,_0x197559)[_0xe999('0xb')](function(_0x1e239b){logger[_0xe999('0xc')](_0xe999('0xd'),_0x260d16,'request\x20sent');logger[_0xe999('0xe')](_0xe999('0xf'),_0x260d16,'request\x20sent',JSON[_0xe999('0x10')](_0x1e239b));if(_0x1e239b[_0xe999('0x11')]){if(_0x1e239b['error']['code']===0x1f4){logger[_0xe999('0x11')](_0xe999('0xd'),_0x260d16,_0x1e239b[_0xe999('0x11')]['message']);return _0x16b877(_0x1e239b[_0xe999('0x11')][_0xe999('0x12')]);}logger[_0xe999('0x11')](_0xe999('0xd'),_0x260d16,_0x1e239b[_0xe999('0x11')][_0xe999('0x12')]);return _0x1f6b48(_0x1e239b['error'][_0xe999('0x12')]);}else{logger[_0xe999('0xc')](_0xe999('0xd'),_0x260d16,_0xe999('0x13'));_0x1f6b48(_0x1e239b['result'][_0xe999('0x12')]);}})[_0xe999('0x14')](function(_0xde5867){logger[_0xe999('0x11')](_0xe999('0xd'),_0x260d16,_0xde5867);_0x16b877(_0xde5867);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 06ee8a6..bc33391 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 _0x5398=['create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x1abeb2,_0x79f462){var _0x48da20=function(_0x42a90b){while(--_0x42a90b){_0x1abeb2['push'](_0x1abeb2['shift']());}};_0x48da20(++_0x79f462);}(_0x5398,0xe2));var _0x8539=function(_0xf771fe,_0x1d1fa8){_0xf771fe=_0xf771fe-0x0;var _0x27eecc=_0x5398[_0xf771fe];return _0x27eecc;};'use strict';var multer=require('multer');var util=require(_0x8539('0x0'));var path=require(_0x8539('0x1'));var timeout=require(_0x8539('0x2'));var express=require(_0x8539('0x3'));var router=express[_0x8539('0x4')]();var fs_extra=require(_0x8539('0x5'));var auth=require(_0x8539('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8539('0x7'));router[_0x8539('0x8')]('/',auth[_0x8539('0x9')](),controller[_0x8539('0xa')]);router[_0x8539('0x8')](_0x8539('0xb'),auth['isAuthenticated'](),controller[_0x8539('0xc')]);router[_0x8539('0xd')]('/',auth[_0x8539('0x9')](),controller[_0x8539('0xe')]);router[_0x8539('0xf')](_0x8539('0xb'),auth[_0x8539('0x9')](),controller[_0x8539('0x10')]);router[_0x8539('0x11')](_0x8539('0xb'),auth['isAuthenticated'](),controller[_0x8539('0x12')]);module[_0x8539('0x13')]=router; \ No newline at end of file +var _0x37c5=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','isAuthenticated','index','get','show','post','put','/:id','delete','destroy','util','path','connect-timeout','express'];(function(_0x21a3f2,_0x97377d){var _0x30212c=function(_0xf748f4){while(--_0xf748f4){_0x21a3f2['push'](_0x21a3f2['shift']());}};_0x30212c(++_0x97377d);}(_0x37c5,0xa7));var _0x537c=function(_0x174cb3,_0x333a86){_0x174cb3=_0x174cb3-0x0;var _0x41f0c4=_0x37c5[_0x174cb3];return _0x41f0c4;};'use strict';var multer=require('multer');var util=require(_0x537c('0x0'));var path=require(_0x537c('0x1'));var timeout=require(_0x537c('0x2'));var express=require(_0x537c('0x3'));var router=express[_0x537c('0x4')]();var fs_extra=require(_0x537c('0x5'));var auth=require(_0x537c('0x6'));var interaction=require(_0x537c('0x7'));var config=require(_0x537c('0x8'));var controller=require(_0x537c('0x9'));router['get']('/',auth[_0x537c('0xa')](),controller[_0x537c('0xb')]);router[_0x537c('0xc')]('/:id',auth[_0x537c('0xa')](),controller[_0x537c('0xd')]);router[_0x537c('0xe')]('/',auth[_0x537c('0xa')](),controller['create']);router[_0x537c('0xf')](_0x537c('0x10'),auth[_0x537c('0xa')](),controller['update']);router[_0x537c('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x537c('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 6f3e560..c67152a 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 _0x32ac=['TEXT','sequelize'];(function(_0x313866,_0x3ecd92){var _0x5a818f=function(_0x507e58){while(--_0x507e58){_0x313866['push'](_0x313866['shift']());}};_0x5a818f(++_0x3ecd92);}(_0x32ac,0x113));var _0xc32a=function(_0x4ad9cd,_0x43e881){_0x4ad9cd=_0x4ad9cd-0x0;var _0x5e34b1=_0x32ac[_0x4ad9cd];return _0x5e34b1;};'use strict';var Sequelize=require(_0xc32a('0x0'));module['exports']={'tree':{'type':Sequelize[_0xc32a('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xb6b1=['TEXT','sequelize'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0xb6b1,0x17b));var _0x1b6b=function(_0x313c96,_0x3cee6e){_0x313c96=_0x313c96-0x0;var _0x522f53=_0xb6b1[_0x313c96];return _0x522f53;};'use strict';var Sequelize=require(_0x1b6b('0x0'));module['exports']={'tree':{'type':Sequelize[_0x1b6b('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 8c7fd34..fa495fb 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 _0x4cf3=['moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','index','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','options','include','rows','catch','show','includeAll','create','body','find','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x275d47,_0x2e98e6){var _0x2e09e2=function(_0x3d46bb){while(--_0x3d46bb){_0x275d47['push'](_0x275d47['shift']());}};_0x2e09e2(++_0x2e98e6);}(_0x4cf3,0x13f));var _0x34cf=function(_0x2a5950,_0x12cadf){_0x2a5950=_0x2a5950-0x0;var _0x1bc546=_0x4cf3[_0x2a5950];return _0x1bc546;};'use strict';var emlformat=require(_0x34cf('0x0'));var rimraf=require(_0x34cf('0x1'));var zipdir=require(_0x34cf('0x2'));var jsonpatch=require(_0x34cf('0x3'));var rp=require(_0x34cf('0x4'));var moment=require(_0x34cf('0x5'));var BPromise=require(_0x34cf('0x6'));var Mustache=require(_0x34cf('0x7'));var util=require(_0x34cf('0x8'));var path=require(_0x34cf('0x9'));var sox=require(_0x34cf('0xa'));var csv=require('to-csv');var ejs=require(_0x34cf('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x34cf('0xc'));var squel=require(_0x34cf('0xd'));var crypto=require(_0x34cf('0xe'));var jsforce=require(_0x34cf('0xf'));var deskjs=require(_0x34cf('0x10'));var toCsv=require(_0x34cf('0x11'));var querystring=require(_0x34cf('0x12'));var Papa=require(_0x34cf('0x13'));var Redis=require(_0x34cf('0x14'));var authService=require(_0x34cf('0x15'));var qs=require(_0x34cf('0x16'));var as=require(_0x34cf('0x17'));var hardwareService=require(_0x34cf('0x18'));var logger=require(_0x34cf('0x19'))(_0x34cf('0x1a'));var utils=require(_0x34cf('0x1b'));var config=require('../../config/environment');var licenseUtil=require(_0x34cf('0x1c'));var db=require(_0x34cf('0x1d'))['db'];function respondWithStatusCode(_0xee105d,_0x4cbbeb){_0x4cbbeb=_0x4cbbeb||0xcc;return function(_0x443bd6){if(_0x443bd6){return _0xee105d[_0x34cf('0x1e')](_0x4cbbeb);}return _0xee105d[_0x34cf('0x1f')](_0x4cbbeb)['end']();};}function respondWithResult(_0x631798,_0x251de0){_0x251de0=_0x251de0||0xc8;return function(_0x1e5056){if(_0x1e5056){return _0x631798[_0x34cf('0x1f')](_0x251de0)[_0x34cf('0x20')](_0x1e5056);}};}function respondWithFilteredResult(_0xf79b44,_0xdb1e64){return function(_0x1212e1){if(_0x1212e1){var _0x28086d=typeof _0xdb1e64[_0x34cf('0x21')]==='undefined'&&typeof _0xdb1e64['limit']===_0x34cf('0x22');var _0x4e3380=_0x1212e1[_0x34cf('0x23')];var _0x5ba400=_0x28086d?0x0:_0xdb1e64[_0x34cf('0x21')];var _0x56e976=_0x28086d?_0x1212e1[_0x34cf('0x23')]:_0xdb1e64[_0x34cf('0x21')]+_0xdb1e64['limit'];var _0x146267;if(_0x56e976>=_0x4e3380){_0x56e976=_0x4e3380;_0x146267=0xc8;}else{_0x146267=0xce;}_0xf79b44[_0x34cf('0x1f')](_0x146267);return _0xf79b44[_0x34cf('0x24')](_0x34cf('0x25'),_0x5ba400+'-'+_0x56e976+'/'+_0x4e3380)[_0x34cf('0x20')](_0x1212e1);}return null;};}function patchUpdates(_0x3f47e5){return function(_0x12031b){try{jsonpatch[_0x34cf('0x26')](_0x12031b,_0x3f47e5,!![]);}catch(_0x43cc6f){return BPromise[_0x34cf('0x27')](_0x43cc6f);}return _0x12031b[_0x34cf('0x28')]();};}function saveUpdates(_0x5f5af1,_0x590aae){return function(_0x11cc35){if(_0x11cc35){return _0x11cc35[_0x34cf('0x29')](_0x5f5af1)[_0x34cf('0x2a')](function(_0x94055c){return _0x94055c;});}return null;};}function removeEntity(_0x27ea20,_0x52fd70){return function(_0x3e69f6){if(_0x3e69f6){return _0x3e69f6['destroy']()['then'](function(){_0x27ea20[_0x34cf('0x1f')](0xcc)[_0x34cf('0x2b')]();});}};}function handleEntityNotFound(_0x489cc5,_0x126a6d){return function(_0x3afffb){if(!_0x3afffb){_0x489cc5[_0x34cf('0x1e')](0x194);}return _0x3afffb;};}function handleError(_0x5c8a7e,_0x1888c6){_0x1888c6=_0x1888c6||0x1f4;return function(_0x3bafd6){logger[_0x34cf('0x2c')](_0x3bafd6[_0x34cf('0x2d')]);if(_0x3bafd6[_0x34cf('0x2e')]){delete _0x3bafd6['name'];}_0x5c8a7e['status'](_0x1888c6)['send'](_0x3bafd6);};}exports[_0x34cf('0x2f')]=function(_0x3c241d,_0x41d01a){var _0x514848={},_0x2379ce={},_0x1beb03={'count':0x0,'rows':[]};var _0x531704=_['map'](db[_0x34cf('0x30')][_0x34cf('0x31')],function(_0x559b2e){return{'name':_0x559b2e[_0x34cf('0x32')],'type':_0x559b2e[_0x34cf('0x33')][_0x34cf('0x34')]};});_0x2379ce[_0x34cf('0x35')]=_[_0x34cf('0x36')](_0x531704,_0x34cf('0x2e'));_0x2379ce[_0x34cf('0x37')]=_[_0x34cf('0x38')](_0x3c241d['query']);_0x2379ce[_0x34cf('0x39')]=_[_0x34cf('0x3a')](_0x2379ce[_0x34cf('0x35')],_0x2379ce['query']);_0x514848[_0x34cf('0x3b')]=_[_0x34cf('0x3a')](_0x2379ce[_0x34cf('0x35')],qs['fields'](_0x3c241d[_0x34cf('0x37')][_0x34cf('0x3c')]));_0x514848[_0x34cf('0x3b')]=_0x514848[_0x34cf('0x3b')][_0x34cf('0x3d')]?_0x514848[_0x34cf('0x3b')]:_0x2379ce[_0x34cf('0x35')];if(!_0x3c241d[_0x34cf('0x37')]['hasOwnProperty'](_0x34cf('0x3e'))){_0x514848[_0x34cf('0x3f')]=qs[_0x34cf('0x3f')](_0x3c241d[_0x34cf('0x37')]['limit']);_0x514848[_0x34cf('0x21')]=qs[_0x34cf('0x21')](_0x3c241d['query'][_0x34cf('0x21')]);}_0x514848[_0x34cf('0x40')]=qs[_0x34cf('0x41')](_0x3c241d[_0x34cf('0x37')][_0x34cf('0x41')]);_0x514848[_0x34cf('0x42')]=qs[_0x34cf('0x39')](_[_0x34cf('0x43')](_0x3c241d[_0x34cf('0x37')],_0x2379ce['filters']),_0x531704);if(_0x3c241d[_0x34cf('0x37')][_0x34cf('0x44')]){_0x514848[_0x34cf('0x42')]=_['merge'](_0x514848[_0x34cf('0x42')],{'$or':_[_0x34cf('0x36')](_0x531704,function(_0x3f4402){if(_0x3f4402[_0x34cf('0x33')]!=='VIRTUAL'){var _0x49a9fd={};_0x49a9fd[_0x3f4402['name']]={'$like':'%'+_0x3c241d[_0x34cf('0x37')][_0x34cf('0x44')]+'%'};return _0x49a9fd;}})});}_0x514848=_[_0x34cf('0x45')]({},_0x514848,_0x3c241d[_0x34cf('0x46')]);var _0x5634ec={'where':_0x514848[_0x34cf('0x42')]};return db[_0x34cf('0x30')][_0x34cf('0x23')](_0x5634ec)[_0x34cf('0x2a')](function(_0x345dc5){_0x1beb03['count']=_0x345dc5;if(_0x3c241d['query']['includeAll']){_0x514848[_0x34cf('0x47')]=[{'all':!![]}];}return db['AnalyticTreeReport']['findAll'](_0x514848);})[_0x34cf('0x2a')](function(_0x45c597){_0x1beb03[_0x34cf('0x48')]=_0x45c597;return _0x1beb03;})['then'](respondWithFilteredResult(_0x41d01a,_0x514848))[_0x34cf('0x49')](handleError(_0x41d01a,null));};exports[_0x34cf('0x4a')]=function(_0x327044,_0x16fe28){var _0x36da12={'raw':!![],'where':{'id':_0x327044['params']['id']}},_0x3641aa={};_0x3641aa[_0x34cf('0x35')]=_[_0x34cf('0x38')](db[_0x34cf('0x30')]['rawAttributes']);_0x3641aa['query']=_[_0x34cf('0x38')](_0x327044[_0x34cf('0x37')]);_0x3641aa[_0x34cf('0x39')]=_['intersection'](_0x3641aa[_0x34cf('0x35')],_0x3641aa[_0x34cf('0x37')]);_0x36da12[_0x34cf('0x3b')]=_[_0x34cf('0x3a')](_0x3641aa['model'],qs['fields'](_0x327044[_0x34cf('0x37')][_0x34cf('0x3c')]));_0x36da12['attributes']=_0x36da12['attributes'][_0x34cf('0x3d')]?_0x36da12['attributes']:_0x3641aa['model'];if(_0x327044[_0x34cf('0x37')][_0x34cf('0x4b')]){_0x36da12['include']=[{'all':!![]}];}_0x36da12=_['merge']({},_0x36da12,_0x327044[_0x34cf('0x46')]);return db[_0x34cf('0x30')]['find'](_0x36da12)[_0x34cf('0x2a')](handleEntityNotFound(_0x16fe28,null))[_0x34cf('0x2a')](respondWithResult(_0x16fe28,null))['catch'](handleError(_0x16fe28,null));};exports['create']=function(_0x397b44,_0x472969){return db[_0x34cf('0x30')][_0x34cf('0x4c')](_0x397b44[_0x34cf('0x4d')],{})[_0x34cf('0x2a')](respondWithResult(_0x472969,0xc9))[_0x34cf('0x49')](handleError(_0x472969,null));};exports[_0x34cf('0x29')]=function(_0x14bfdf,_0x198f73){if(_0x14bfdf[_0x34cf('0x4d')]['id']){delete _0x14bfdf[_0x34cf('0x4d')]['id'];}return db[_0x34cf('0x30')][_0x34cf('0x4e')]({'where':{'id':_0x14bfdf[_0x34cf('0x4f')]['id']}})[_0x34cf('0x2a')](handleEntityNotFound(_0x198f73,null))[_0x34cf('0x2a')](saveUpdates(_0x14bfdf[_0x34cf('0x4d')],null))[_0x34cf('0x2a')](respondWithResult(_0x198f73,null))[_0x34cf('0x49')](handleError(_0x198f73,null));};exports[_0x34cf('0x50')]=function(_0x39cc72,_0xac54fb){return db[_0x34cf('0x30')][_0x34cf('0x4e')]({'where':{'id':_0x39cc72[_0x34cf('0x4f')]['id']}})[_0x34cf('0x2a')](handleEntityNotFound(_0xac54fb,null))['then'](removeEntity(_0xac54fb,null))[_0x34cf('0x49')](handleError(_0xac54fb,null));}; \ No newline at end of file +var _0xd152=['send','index','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','stack','name'];(function(_0x5bf46c,_0x1fe508){var _0x5a37c4=function(_0x2cf2c3){while(--_0x2cf2c3){_0x5bf46c['push'](_0x5bf46c['shift']());}};_0x5a37c4(++_0x1fe508);}(_0xd152,0x6c));var _0x2d15=function(_0x4f2b2d,_0x4f2aa5){_0x4f2b2d=_0x4f2b2d-0x0;var _0xc3def7=_0xd152[_0x4f2b2d];return _0xc3def7;};'use strict';var emlformat=require(_0x2d15('0x0'));var rimraf=require(_0x2d15('0x1'));var zipdir=require(_0x2d15('0x2'));var jsonpatch=require(_0x2d15('0x3'));var rp=require(_0x2d15('0x4'));var moment=require(_0x2d15('0x5'));var BPromise=require(_0x2d15('0x6'));var Mustache=require(_0x2d15('0x7'));var util=require(_0x2d15('0x8'));var path=require('path');var sox=require(_0x2d15('0x9'));var csv=require(_0x2d15('0xa'));var ejs=require(_0x2d15('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2d15('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2d15('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2d15('0xa'));var querystring=require(_0x2d15('0xe'));var Papa=require(_0x2d15('0xf'));var Redis=require(_0x2d15('0x10'));var authService=require(_0x2d15('0x11'));var qs=require(_0x2d15('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2d15('0x13'));var logger=require(_0x2d15('0x14'))('api');var utils=require(_0x2d15('0x15'));var config=require(_0x2d15('0x16'));var licenseUtil=require(_0x2d15('0x17'));var db=require(_0x2d15('0x18'))['db'];function respondWithStatusCode(_0x5c9d39,_0x5097be){_0x5097be=_0x5097be||0xcc;return function(_0x53e372){if(_0x53e372){return _0x5c9d39[_0x2d15('0x19')](_0x5097be);}return _0x5c9d39['status'](_0x5097be)[_0x2d15('0x1a')]();};}function respondWithResult(_0x40cc15,_0x479cad){_0x479cad=_0x479cad||0xc8;return function(_0x10ade8){if(_0x10ade8){return _0x40cc15[_0x2d15('0x1b')](_0x479cad)[_0x2d15('0x1c')](_0x10ade8);}};}function respondWithFilteredResult(_0x326882,_0x5820ef){return function(_0x354dd6){if(_0x354dd6){var _0x549f9d=typeof _0x5820ef[_0x2d15('0x1d')]==='undefined'&&typeof _0x5820ef[_0x2d15('0x1e')]===_0x2d15('0x1f');var _0x20239d=_0x354dd6['count'];var _0x263e37=_0x549f9d?0x0:_0x5820ef['offset'];var _0x24ee42=_0x549f9d?_0x354dd6[_0x2d15('0x20')]:_0x5820ef[_0x2d15('0x1d')]+_0x5820ef[_0x2d15('0x1e')];var _0x511cb0;if(_0x24ee42>=_0x20239d){_0x24ee42=_0x20239d;_0x511cb0=0xc8;}else{_0x511cb0=0xce;}_0x326882[_0x2d15('0x1b')](_0x511cb0);return _0x326882[_0x2d15('0x21')](_0x2d15('0x22'),_0x263e37+'-'+_0x24ee42+'/'+_0x20239d)[_0x2d15('0x1c')](_0x354dd6);}return null;};}function patchUpdates(_0x1a56ca){return function(_0x530f30){try{jsonpatch[_0x2d15('0x23')](_0x530f30,_0x1a56ca,!![]);}catch(_0x6c227f){return BPromise[_0x2d15('0x24')](_0x6c227f);}return _0x530f30[_0x2d15('0x25')]();};}function saveUpdates(_0xbac71c,_0x3e938d){return function(_0x2c62ee){if(_0x2c62ee){return _0x2c62ee[_0x2d15('0x26')](_0xbac71c)['then'](function(_0x5d470c){return _0x5d470c;});}return null;};}function removeEntity(_0x50dc72,_0x1dead6){return function(_0x3cae3d){if(_0x3cae3d){return _0x3cae3d['destroy']()[_0x2d15('0x27')](function(){_0x50dc72[_0x2d15('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12b164,_0x2e1e13){return function(_0x1a10ff){if(!_0x1a10ff){_0x12b164['sendStatus'](0x194);}return _0x1a10ff;};}function handleError(_0x19d854,_0x1bc0fb){_0x1bc0fb=_0x1bc0fb||0x1f4;return function(_0x373fba){logger['error'](_0x373fba[_0x2d15('0x28')]);if(_0x373fba[_0x2d15('0x29')]){delete _0x373fba[_0x2d15('0x29')];}_0x19d854[_0x2d15('0x1b')](_0x1bc0fb)[_0x2d15('0x2a')](_0x373fba);};}exports[_0x2d15('0x2b')]=function(_0x5b8947,_0x1eecbc){var _0x5b994d={},_0x52871f={},_0x4d10b0={'count':0x0,'rows':[]};var _0x472389=_['map'](db[_0x2d15('0x2c')][_0x2d15('0x2d')],function(_0x191000){return{'name':_0x191000[_0x2d15('0x2e')],'type':_0x191000[_0x2d15('0x2f')][_0x2d15('0x30')]};});_0x52871f[_0x2d15('0x31')]=_[_0x2d15('0x32')](_0x472389,_0x2d15('0x29'));_0x52871f[_0x2d15('0x33')]=_[_0x2d15('0x34')](_0x5b8947['query']);_0x52871f['filters']=_[_0x2d15('0x35')](_0x52871f[_0x2d15('0x31')],_0x52871f[_0x2d15('0x33')]);_0x5b994d[_0x2d15('0x36')]=_[_0x2d15('0x35')](_0x52871f[_0x2d15('0x31')],qs[_0x2d15('0x37')](_0x5b8947[_0x2d15('0x33')][_0x2d15('0x37')]));_0x5b994d[_0x2d15('0x36')]=_0x5b994d[_0x2d15('0x36')][_0x2d15('0x38')]?_0x5b994d[_0x2d15('0x36')]:_0x52871f['model'];if(!_0x5b8947[_0x2d15('0x33')]['hasOwnProperty']('nolimit')){_0x5b994d[_0x2d15('0x1e')]=qs[_0x2d15('0x1e')](_0x5b8947[_0x2d15('0x33')][_0x2d15('0x1e')]);_0x5b994d[_0x2d15('0x1d')]=qs[_0x2d15('0x1d')](_0x5b8947[_0x2d15('0x33')][_0x2d15('0x1d')]);}_0x5b994d['order']=qs[_0x2d15('0x39')](_0x5b8947[_0x2d15('0x33')][_0x2d15('0x39')]);_0x5b994d[_0x2d15('0x3a')]=qs[_0x2d15('0x3b')](_[_0x2d15('0x3c')](_0x5b8947[_0x2d15('0x33')],_0x52871f[_0x2d15('0x3b')]),_0x472389);if(_0x5b8947['query'][_0x2d15('0x3d')]){_0x5b994d['where']=_[_0x2d15('0x3e')](_0x5b994d[_0x2d15('0x3a')],{'$or':_[_0x2d15('0x32')](_0x472389,function(_0x3b8ab4){if(_0x3b8ab4[_0x2d15('0x2f')]!==_0x2d15('0x3f')){var _0x45c7cb={};_0x45c7cb[_0x3b8ab4[_0x2d15('0x29')]]={'$like':'%'+_0x5b8947[_0x2d15('0x33')][_0x2d15('0x3d')]+'%'};return _0x45c7cb;}})});}_0x5b994d=_[_0x2d15('0x3e')]({},_0x5b994d,_0x5b8947[_0x2d15('0x40')]);var _0xa2440f={'where':_0x5b994d[_0x2d15('0x3a')]};return db['AnalyticTreeReport'][_0x2d15('0x20')](_0xa2440f)[_0x2d15('0x27')](function(_0x2a8585){_0x4d10b0[_0x2d15('0x20')]=_0x2a8585;if(_0x5b8947['query'][_0x2d15('0x41')]){_0x5b994d[_0x2d15('0x42')]=[{'all':!![]}];}return db[_0x2d15('0x2c')][_0x2d15('0x43')](_0x5b994d);})[_0x2d15('0x27')](function(_0x129c7c){_0x4d10b0[_0x2d15('0x44')]=_0x129c7c;return _0x4d10b0;})[_0x2d15('0x27')](respondWithFilteredResult(_0x1eecbc,_0x5b994d))[_0x2d15('0x45')](handleError(_0x1eecbc,null));};exports['show']=function(_0x2ee42b,_0x12afcf){var _0x4244d3={'raw':!![],'where':{'id':_0x2ee42b['params']['id']}},_0x32cf43={};_0x32cf43[_0x2d15('0x31')]=_[_0x2d15('0x34')](db[_0x2d15('0x2c')][_0x2d15('0x2d')]);_0x32cf43['query']=_[_0x2d15('0x34')](_0x2ee42b[_0x2d15('0x33')]);_0x32cf43['filters']=_[_0x2d15('0x35')](_0x32cf43['model'],_0x32cf43['query']);_0x4244d3[_0x2d15('0x36')]=_[_0x2d15('0x35')](_0x32cf43[_0x2d15('0x31')],qs[_0x2d15('0x37')](_0x2ee42b['query'][_0x2d15('0x37')]));_0x4244d3[_0x2d15('0x36')]=_0x4244d3[_0x2d15('0x36')][_0x2d15('0x38')]?_0x4244d3['attributes']:_0x32cf43[_0x2d15('0x31')];if(_0x2ee42b[_0x2d15('0x33')][_0x2d15('0x41')]){_0x4244d3['include']=[{'all':!![]}];}_0x4244d3=_[_0x2d15('0x3e')]({},_0x4244d3,_0x2ee42b[_0x2d15('0x40')]);return db[_0x2d15('0x2c')][_0x2d15('0x46')](_0x4244d3)[_0x2d15('0x27')](handleEntityNotFound(_0x12afcf,null))['then'](respondWithResult(_0x12afcf,null))[_0x2d15('0x45')](handleError(_0x12afcf,null));};exports['create']=function(_0x1becbe,_0x3b2426){return db['AnalyticTreeReport'][_0x2d15('0x47')](_0x1becbe[_0x2d15('0x48')],{})[_0x2d15('0x27')](respondWithResult(_0x3b2426,0xc9))[_0x2d15('0x45')](handleError(_0x3b2426,null));};exports[_0x2d15('0x26')]=function(_0x2f067a,_0x1b3b1c){if(_0x2f067a[_0x2d15('0x48')]['id']){delete _0x2f067a[_0x2d15('0x48')]['id'];}return db[_0x2d15('0x2c')]['find']({'where':{'id':_0x2f067a[_0x2d15('0x49')]['id']}})['then'](handleEntityNotFound(_0x1b3b1c,null))[_0x2d15('0x27')](saveUpdates(_0x2f067a[_0x2d15('0x48')],null))[_0x2d15('0x27')](respondWithResult(_0x1b3b1c,null))[_0x2d15('0x45')](handleError(_0x1b3b1c,null));};exports[_0x2d15('0x4a')]=function(_0x5c7b31,_0x324a02){return db[_0x2d15('0x2c')][_0x2d15('0x46')]({'where':{'id':_0x5c7b31[_0x2d15('0x49')]['id']}})[_0x2d15('0x27')](handleEntityNotFound(_0x324a02,null))[_0x2d15('0x27')](removeEntity(_0x324a02,null))[_0x2d15('0x45')](handleError(_0x324a02,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 140423d..88b6def 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 _0x743c=['request-promise','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util','api','moment','bluebird'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x743c,0x14d));var _0xc743=function(_0x8e6768,_0x997aad){_0x8e6768=_0x8e6768-0x0;var _0x4db9e9=_0x743c[_0x8e6768];return _0x4db9e9;};'use strict';var _=require(_0xc743('0x0'));var util=require(_0xc743('0x1'));var logger=require('../../config/logger')(_0xc743('0x2'));var moment=require(_0xc743('0x3'));var BPromise=require(_0xc743('0x4'));var rp=require(_0xc743('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc743('0x6'));var config=require(_0xc743('0x7'));var attributes=require(_0xc743('0x8'));module[_0xc743('0x9')]=function(_0x958b03,_0x521ebf){return _0x958b03[_0xc743('0xa')](_0xc743('0xb'),attributes,{'tableName':_0xc743('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x69ad=['analytics_report_trees','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','AnalyticTreeReport'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x69ad,0x1da));var _0xd69a=function(_0x335234,_0x12407a){_0x335234=_0x335234-0x0;var _0x150368=_0x69ad[_0x335234];return _0x150368;};'use strict';var _=require(_0xd69a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd69a('0x1'));var moment=require(_0xd69a('0x2'));var BPromise=require(_0xd69a('0x3'));var rp=require(_0xd69a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd69a('0x5'));var config=require(_0xd69a('0x6'));var attributes=require('./analyticTreeReport.attributes');module[_0xd69a('0x7')]=function(_0x357f5b,_0x3ae418){return _0x357f5b[_0xd69a('0x8')](_0xd69a('0x9'),attributes,{'tableName':_0xd69a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 9f06527..e381f5c 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 _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x18a669,_0x3e97f7){var _0x57cd6f=function(_0x5de55b){while(--_0x5de55b){_0x18a669['push'](_0x18a669['shift']());}};_0x57cd6f(++_0x3e97f7);}(_0xdb28,0x106));var _0x8db2=function(_0x565777,_0x169f59){_0x565777=_0x565777-0x0;var _0x56d505=_0xdb28[_0x565777];return _0x56d505;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file +var _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x2895d7,_0x49d277){var _0x21e801=function(_0x42059f){while(--_0x42059f){_0x2895d7['push'](_0x2895d7['shift']());}};_0x21e801(++_0x49d277);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x5f66[_0x5d4607];return _0x5e4a86;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('AnalyticTreeReport,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 88b64a4..8066bd1 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 _0x2220=['path','express','Router','fs-extra','get','isAuthenticated','index','show','post','put','/:id','delete','destroy','util'];(function(_0x553dca,_0x3dcc0c){var _0x4ecbdf=function(_0x21e89b){while(--_0x21e89b){_0x553dca['push'](_0x553dca['shift']());}};_0x4ecbdf(++_0x3dcc0c);}(_0x2220,0xdf));var _0x0222=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x2220[_0x5f3f88];return _0xd08119;};'use strict';var multer=require('multer');var util=require(_0x0222('0x0'));var path=require(_0x0222('0x1'));var timeout=require('connect-timeout');var express=require(_0x0222('0x2'));var router=express[_0x0222('0x3')]();var fs_extra=require(_0x0222('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticTreeReport.controller');router[_0x0222('0x5')]('/',auth[_0x0222('0x6')](),controller[_0x0222('0x7')]);router[_0x0222('0x5')]('/:id',auth[_0x0222('0x6')](),controller[_0x0222('0x8')]);router[_0x0222('0x9')]('/',auth[_0x0222('0x6')](),controller['create']);router[_0x0222('0xa')](_0x0222('0xb'),auth[_0x0222('0x6')](),controller['update']);router[_0x0222('0xc')]('/:id',auth[_0x0222('0x6')](),controller[_0x0222('0xd')]);module['exports']=router; \ No newline at end of file +var _0xa75c=['delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./analyticTreeReport.controller','get','isAuthenticated','create','/:id','update'];(function(_0x337c8c,_0x905c4b){var _0x2de675=function(_0x68a8e5){while(--_0x68a8e5){_0x337c8c['push'](_0x337c8c['shift']());}};_0x2de675(++_0x905c4b);}(_0xa75c,0x103));var _0xca75=function(_0x53e3de,_0x13da7b){_0x53e3de=_0x53e3de-0x0;var _0x7b905b=_0xa75c[_0x53e3de];return _0x7b905b;};'use strict';var multer=require('multer');var util=require(_0xca75('0x0'));var path=require(_0xca75('0x1'));var timeout=require(_0xca75('0x2'));var express=require(_0xca75('0x3'));var router=express[_0xca75('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xca75('0x5'));var interaction=require(_0xca75('0x6'));var config=require('../../config/environment');var controller=require(_0xca75('0x7'));router[_0xca75('0x8')]('/',auth[_0xca75('0x9')](),controller['index']);router['get']('/:id',auth[_0xca75('0x9')](),controller['show']);router['post']('/',auth[_0xca75('0x9')](),controller[_0xca75('0xa')]);router['put'](_0xca75('0xb'),auth[_0xca75('0x9')](),controller[_0xca75('0xc')]);router[_0xca75('0xd')](_0xca75('0xb'),auth['isAuthenticated'](),controller[_0xca75('0xe')]);module[_0xca75('0xf')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 28c3deb..3bf2580 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 _0x2cc1=['STRING','sequelize','exports'];(function(_0x5a4e76,_0x11f33f){var _0x38b339=function(_0x41bfac){while(--_0x41bfac){_0x5a4e76['push'](_0x5a4e76['shift']());}};_0x38b339(++_0x11f33f);}(_0x2cc1,0x1bd));var _0x12cc=function(_0x31f5ce,_0x379d01){_0x31f5ce=_0x31f5ce-0x0;var _0x156662=_0x2cc1[_0x31f5ce];return _0x156662;};'use strict';var Sequelize=require(_0x12cc('0x0'));module[_0x12cc('0x1')]={'name':{'type':Sequelize[_0x12cc('0x2')]},'basename':{'type':Sequelize[_0x12cc('0x2')]},'type':{'type':Sequelize[_0x12cc('0x2')]}}; \ No newline at end of file +var _0x3e74=['STRING','sequelize'];(function(_0x216494,_0x21a0b4){var _0x3fce22=function(_0x510bbd){while(--_0x510bbd){_0x216494['push'](_0x216494['shift']());}};_0x3fce22(++_0x21a0b4);}(_0x3e74,0x175));var _0x43e7=function(_0x54bc76,_0x53bc22){_0x54bc76=_0x54bc76-0x0;var _0x4aa3f6=_0x3e74[_0x54bc76];return _0x4aa3f6;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'name':{'type':Sequelize[_0x43e7('0x1')]},'basename':{'type':Sequelize[_0x43e7('0x1')]},'type':{'type':Sequelize[_0x43e7('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index aa1ab11..1f2a598 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 _0x490c=['clone','get','createdAt','updatedAt','body','omit','create','file','originalname','basename','filename','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','index','map','Attachment','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','rows','catch','params','include','find'];(function(_0x5a5395,_0x5361f6){var _0x4da43d=function(_0x149941){while(--_0x149941){_0x5a5395['push'](_0x5a5395['shift']());}};_0x4da43d(++_0x5361f6);}(_0x490c,0x11c));var _0xc490=function(_0x58f245,_0x3e4f31){_0x58f245=_0x58f245-0x0;var _0x1f0cfb=_0x490c[_0x58f245];return _0x1f0cfb;};'use strict';var emlformat=require(_0xc490('0x0'));var rimraf=require(_0xc490('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc490('0x2'));var rp=require(_0xc490('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc490('0x4'));var util=require(_0xc490('0x5'));var path=require('path');var sox=require(_0xc490('0x6'));var csv=require(_0xc490('0x7'));var ejs=require(_0xc490('0x8'));var fs=require('fs');var fs_extra=require(_0xc490('0x9'));var _=require(_0xc490('0xa'));var squel=require(_0xc490('0xb'));var crypto=require(_0xc490('0xc'));var jsforce=require(_0xc490('0xd'));var deskjs=require(_0xc490('0xe'));var toCsv=require(_0xc490('0x7'));var querystring=require(_0xc490('0xf'));var Papa=require('papaparse');var Redis=require(_0xc490('0x10'));var authService=require(_0xc490('0x11'));var qs=require(_0xc490('0x12'));var as=require(_0xc490('0x13'));var hardwareService=require(_0xc490('0x14'));var logger=require('../../config/logger')(_0xc490('0x15'));var utils=require('../../config/utils');var config=require(_0xc490('0x16'));var licenseUtil=require(_0xc490('0x17'));var db=require(_0xc490('0x18'))['db'];function respondWithStatusCode(_0x13d053,_0x1239c9){_0x1239c9=_0x1239c9||0xcc;return function(_0x19a16a){if(_0x19a16a){return _0x13d053['sendStatus'](_0x1239c9);}return _0x13d053[_0xc490('0x19')](_0x1239c9)[_0xc490('0x1a')]();};}function respondWithResult(_0x259221,_0x11b794){_0x11b794=_0x11b794||0xc8;return function(_0x572e8e){if(_0x572e8e){return _0x259221[_0xc490('0x19')](_0x11b794)[_0xc490('0x1b')](_0x572e8e);}};}function respondWithFilteredResult(_0x18e5d4,_0x241ff3){return function(_0x35e024){if(_0x35e024){var _0x4a9bbf=typeof _0x241ff3[_0xc490('0x1c')]===_0xc490('0x1d')&&typeof _0x241ff3['limit']===_0xc490('0x1d');var _0x19c66d=_0x35e024[_0xc490('0x1e')];var _0x372dca=_0x4a9bbf?0x0:_0x241ff3['offset'];var _0x2ca73a=_0x4a9bbf?_0x35e024[_0xc490('0x1e')]:_0x241ff3['offset']+_0x241ff3[_0xc490('0x1f')];var _0x5f52b5;if(_0x2ca73a>=_0x19c66d){_0x2ca73a=_0x19c66d;_0x5f52b5=0xc8;}else{_0x5f52b5=0xce;}_0x18e5d4[_0xc490('0x19')](_0x5f52b5);return _0x18e5d4[_0xc490('0x20')](_0xc490('0x21'),_0x372dca+'-'+_0x2ca73a+'/'+_0x19c66d)[_0xc490('0x1b')](_0x35e024);}return null;};}function patchUpdates(_0x4eebc0){return function(_0x4fa1c5){try{jsonpatch[_0xc490('0x22')](_0x4fa1c5,_0x4eebc0,!![]);}catch(_0x54a37f){return BPromise[_0xc490('0x23')](_0x54a37f);}return _0x4fa1c5['save']();};}function saveUpdates(_0x3d5c17,_0x5db2f9){return function(_0x315445){if(_0x315445){return _0x315445[_0xc490('0x24')](_0x3d5c17)[_0xc490('0x25')](function(_0x5e24c1){return _0x5e24c1;});}return null;};}function removeEntity(_0x3b5891,_0x50030d){return function(_0x333030){if(_0x333030){return _0x333030[_0xc490('0x26')]()['then'](function(){_0x3b5891[_0xc490('0x19')](0xcc)[_0xc490('0x1a')]();});}};}function handleEntityNotFound(_0x1146fd,_0x17f80b){return function(_0x3c64c3){if(!_0x3c64c3){_0x1146fd[_0xc490('0x27')](0x194);}return _0x3c64c3;};}function handleError(_0x1bc904,_0x20aa0d){_0x20aa0d=_0x20aa0d||0x1f4;return function(_0x51430a){logger[_0xc490('0x28')](_0x51430a[_0xc490('0x29')]);if(_0x51430a['name']){delete _0x51430a[_0xc490('0x2a')];}_0x1bc904[_0xc490('0x19')](_0x20aa0d)['send'](_0x51430a);};}exports[_0xc490('0x2b')]=function(_0x3ea7a2,_0x25a007){var _0x45cb07={},_0x46c13f={},_0x382ebb={'count':0x0,'rows':[]};var _0x27587b=_[_0xc490('0x2c')](db[_0xc490('0x2d')][_0xc490('0x2e')],function(_0x37f80c){return{'name':_0x37f80c[_0xc490('0x2f')],'type':_0x37f80c[_0xc490('0x30')][_0xc490('0x31')]};});_0x46c13f[_0xc490('0x32')]=_[_0xc490('0x2c')](_0x27587b,_0xc490('0x2a'));_0x46c13f['query']=_[_0xc490('0x33')](_0x3ea7a2[_0xc490('0x34')]);_0x46c13f['filters']=_['intersection'](_0x46c13f[_0xc490('0x32')],_0x46c13f[_0xc490('0x34')]);_0x45cb07[_0xc490('0x35')]=_[_0xc490('0x36')](_0x46c13f[_0xc490('0x32')],qs[_0xc490('0x37')](_0x3ea7a2[_0xc490('0x34')][_0xc490('0x37')]));_0x45cb07[_0xc490('0x35')]=_0x45cb07[_0xc490('0x35')][_0xc490('0x38')]?_0x45cb07['attributes']:_0x46c13f['model'];if(!_0x3ea7a2[_0xc490('0x34')][_0xc490('0x39')]('nolimit')){_0x45cb07[_0xc490('0x1f')]=qs['limit'](_0x3ea7a2[_0xc490('0x34')][_0xc490('0x1f')]);_0x45cb07[_0xc490('0x1c')]=qs['offset'](_0x3ea7a2[_0xc490('0x34')][_0xc490('0x1c')]);}_0x45cb07[_0xc490('0x3a')]=qs[_0xc490('0x3b')](_0x3ea7a2[_0xc490('0x34')][_0xc490('0x3b')]);_0x45cb07[_0xc490('0x3c')]=qs[_0xc490('0x3d')](_['pick'](_0x3ea7a2[_0xc490('0x34')],_0x46c13f[_0xc490('0x3d')]),_0x27587b);if(_0x3ea7a2[_0xc490('0x34')][_0xc490('0x3e')]){_0x45cb07[_0xc490('0x3c')]=_[_0xc490('0x3f')](_0x45cb07[_0xc490('0x3c')],{'$or':_[_0xc490('0x2c')](_0x27587b,function(_0x4516f3){if(_0x4516f3['type']!==_0xc490('0x40')){var _0x5930a7={};_0x5930a7[_0x4516f3[_0xc490('0x2a')]]={'$like':'%'+_0x3ea7a2['query'][_0xc490('0x3e')]+'%'};return _0x5930a7;}})});}_0x45cb07=_[_0xc490('0x3f')]({},_0x45cb07,_0x3ea7a2[_0xc490('0x41')]);var _0x5ac065={'where':_0x45cb07[_0xc490('0x3c')]};return db[_0xc490('0x2d')][_0xc490('0x1e')](_0x5ac065)[_0xc490('0x25')](function(_0x381d0f){_0x382ebb[_0xc490('0x1e')]=_0x381d0f;if(_0x3ea7a2[_0xc490('0x34')][_0xc490('0x42')]){_0x45cb07['include']=[{'all':!![]}];}return db[_0xc490('0x2d')]['findAll'](_0x45cb07);})[_0xc490('0x25')](function(_0x48ba3f){_0x382ebb[_0xc490('0x43')]=_0x48ba3f;return _0x382ebb;})[_0xc490('0x25')](respondWithFilteredResult(_0x25a007,_0x45cb07))[_0xc490('0x44')](handleError(_0x25a007,null));};exports['show']=function(_0x1b9637,_0x93ebbe){var _0x588fce={'raw':!![],'where':{'id':_0x1b9637[_0xc490('0x45')]['id']}},_0xd8c8ed={};_0xd8c8ed['model']=_[_0xc490('0x33')](db[_0xc490('0x2d')]['rawAttributes']);_0xd8c8ed['query']=_[_0xc490('0x33')](_0x1b9637['query']);_0xd8c8ed[_0xc490('0x3d')]=_[_0xc490('0x36')](_0xd8c8ed[_0xc490('0x32')],_0xd8c8ed[_0xc490('0x34')]);_0x588fce[_0xc490('0x35')]=_[_0xc490('0x36')](_0xd8c8ed[_0xc490('0x32')],qs[_0xc490('0x37')](_0x1b9637['query']['fields']));_0x588fce[_0xc490('0x35')]=_0x588fce[_0xc490('0x35')][_0xc490('0x38')]?_0x588fce['attributes']:_0xd8c8ed[_0xc490('0x32')];if(_0x1b9637[_0xc490('0x34')][_0xc490('0x42')]){_0x588fce[_0xc490('0x46')]=[{'all':!![]}];}_0x588fce=_['merge']({},_0x588fce,_0x1b9637[_0xc490('0x41')]);return db[_0xc490('0x2d')][_0xc490('0x47')](_0x588fce)['then'](handleEntityNotFound(_0x93ebbe,null))[_0xc490('0x25')](respondWithResult(_0x93ebbe,null))[_0xc490('0x44')](handleError(_0x93ebbe,null));};exports[_0xc490('0x48')]=function(_0x1777e0,_0x31d7c4){var _0x232df8={'where':{'id':_0x1777e0[_0xc490('0x45')]['id']}},_0x3025ea={};_0x3025ea[_0xc490('0x32')]=_[_0xc490('0x33')](db[_0xc490('0x2d')][_0xc490('0x2e')]);_0x232df8['attributes']=_[_0xc490('0x36')](_0x3025ea[_0xc490('0x32')],qs[_0xc490('0x37')](_0x1777e0[_0xc490('0x34')][_0xc490('0x37')]));_0x232df8[_0xc490('0x35')]=_0x232df8['attributes'][_0xc490('0x38')]?_0x232df8[_0xc490('0x35')]:_0x3025ea['model'];if(_0x1777e0[_0xc490('0x34')][_0xc490('0x42')]){_0x232df8[_0xc490('0x46')]=[{'all':!![]}];}_0x232df8=_['merge']({},_0x232df8,_0x1777e0[_0xc490('0x41')]);return db[_0xc490('0x2d')]['find'](_0x232df8)[_0xc490('0x25')](handleEntityNotFound(_0x31d7c4,null))['then'](function(_0x2bc600){if(_0x2bc600){var _0x26523a=_0x2bc600[_0xc490('0x49')]({'plain':!![]});_0x26523a=qs['omit'](_0x26523a,['id',_0xc490('0x4a'),_0xc490('0x4b')]);_0x1777e0[_0xc490('0x4c')]=_[_0xc490('0x4d')](_0x1777e0['body'],['id',_0xc490('0x4a'),_0xc490('0x4b')]);return db['Attachment'][_0xc490('0x4e')](_[_0xc490('0x3f')](_0x26523a,_0x1777e0[_0xc490('0x4c')]),{'include':_0x1777e0[_0xc490('0x34')][_0xc490('0x42')]?[{'all':!![]}]:undefined});}})[_0xc490('0x25')](respondWithResult(_0x31d7c4,0xc9))[_0xc490('0x44')](handleError(_0x31d7c4,null));};exports[_0xc490('0x24')]=function(_0x1d1432,_0xb71699){if(_0x1d1432[_0xc490('0x4c')]['id']){delete _0x1d1432[_0xc490('0x4c')]['id'];}return db[_0xc490('0x2d')]['find']({'where':{'id':_0x1d1432['params']['id']}})[_0xc490('0x25')](handleEntityNotFound(_0xb71699,null))[_0xc490('0x25')](saveUpdates(_0x1d1432['body'],null))['then'](respondWithResult(_0xb71699,null))[_0xc490('0x44')](handleError(_0xb71699,null));};exports[_0xc490('0x26')]=function(_0x3b09ae,_0x51ba3e){return db[_0xc490('0x2d')][_0xc490('0x47')]({'where':{'id':_0x3b09ae[_0xc490('0x45')]['id']}})[_0xc490('0x25')](handleEntityNotFound(_0x51ba3e,null))[_0xc490('0x25')](removeEntity(_0x51ba3e,null))[_0xc490('0x44')](handleError(_0x51ba3e,null));};exports[_0xc490('0x4e')]=function(_0x275937,_0x735f56,_0x358ad4){_0x275937[_0xc490('0x4c')][_0xc490('0x2a')]=_0x275937[_0xc490('0x4f')][_0xc490('0x50')];_0x275937[_0xc490('0x4c')][_0xc490('0x51')]=_0x275937[_0xc490('0x4f')][_0xc490('0x52')];_0x275937['body'][_0xc490('0x30')]=_0x275937['file']['mimetype'];return db['Attachment'][_0xc490('0x4e')](_0x275937[_0xc490('0x4c')])[_0xc490('0x25')](respondWithResult(_0x735f56,0xc9))[_0xc490('0x44')](handleError(_0x735f56,null));};exports[_0xc490('0x53')]=function(_0x1c8f8a,_0x3150a4,_0x2d9a07){return db[_0xc490('0x2d')][_0xc490('0x54')]({'where':{'id':_0x1c8f8a[_0xc490('0x45')]['id']},'raw':!![]})[_0xc490('0x25')](handleEntityNotFound(_0x3150a4,null))[_0xc490('0x25')](function(_0x35aa66){if(_0x35aa66){var _0x426998=_0x35aa66[_0xc490('0x55')]!==null;var _0x1d6fdd=path[_0xc490('0x56')](config[_0xc490('0x57')],_0xc490('0x58'));if(_0x426998){_0x1d6fdd=path[_0xc490('0x56')](_0x1d6fdd,'offline-chat/');}var _0x5b72ac=path['join'](_0x1d6fdd,_0x35aa66[_0xc490('0x51')]);return _0x3150a4['download'](_0x5b72ac);}})[_0xc490('0x44')](handleError(_0x3150a4,null));}; \ No newline at end of file +var _0xc1e1=['hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','then','include','catch','params','length','includeAll','find','clone','get','createdAt','body','omit','create','originalname','basename','file','filename','mimetype','findOne','ChatOfflineMessageId','join','root','offline-chat/','download','rimraf','zip-dir','fast-json-patch','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','error','stack','name','map','Attachment','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x2cff4f,_0x21e344){var _0x3df848=function(_0x49474b){while(--_0x49474b){_0x2cff4f['push'](_0x2cff4f['shift']());}};_0x3df848(++_0x21e344);}(_0xc1e1,0x120));var _0x1c1e=function(_0x1c2a5a,_0x284bb5){_0x1c2a5a=_0x1c2a5a-0x0;var _0x3b6846=_0xc1e1[_0x1c2a5a];return _0x3b6846;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1c1e('0x0'));var zipdir=require(_0x1c1e('0x1'));var jsonpatch=require(_0x1c1e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1c1e('0x3'));var util=require(_0x1c1e('0x4'));var path=require('path');var sox=require(_0x1c1e('0x5'));var csv=require(_0x1c1e('0x6'));var ejs=require(_0x1c1e('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1c1e('0x8'));var squel=require(_0x1c1e('0x9'));var crypto=require(_0x1c1e('0xa'));var jsforce=require(_0x1c1e('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1c1e('0x6'));var querystring=require(_0x1c1e('0xc'));var Papa=require(_0x1c1e('0xd'));var Redis=require(_0x1c1e('0xe'));var authService=require(_0x1c1e('0xf'));var qs=require(_0x1c1e('0x10'));var as=require(_0x1c1e('0x11'));var hardwareService=require(_0x1c1e('0x12'));var logger=require(_0x1c1e('0x13'))('api');var utils=require(_0x1c1e('0x14'));var config=require(_0x1c1e('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x1c1e('0x16'))['db'];function respondWithStatusCode(_0x28a9b9,_0x5687c2){_0x5687c2=_0x5687c2||0xcc;return function(_0x6525a2){if(_0x6525a2){return _0x28a9b9[_0x1c1e('0x17')](_0x5687c2);}return _0x28a9b9[_0x1c1e('0x18')](_0x5687c2)[_0x1c1e('0x19')]();};}function respondWithResult(_0x33e047,_0x46f1c5){_0x46f1c5=_0x46f1c5||0xc8;return function(_0x1becba){if(_0x1becba){return _0x33e047[_0x1c1e('0x18')](_0x46f1c5)[_0x1c1e('0x1a')](_0x1becba);}};}function respondWithFilteredResult(_0x42f03c,_0x291d3e){return function(_0x253f08){if(_0x253f08){var _0x47e13e=typeof _0x291d3e[_0x1c1e('0x1b')]===_0x1c1e('0x1c')&&typeof _0x291d3e[_0x1c1e('0x1d')]===_0x1c1e('0x1c');var _0x43c4bc=_0x253f08['count'];var _0x4bf6a8=_0x47e13e?0x0:_0x291d3e[_0x1c1e('0x1b')];var _0x1bbab8=_0x47e13e?_0x253f08[_0x1c1e('0x1e')]:_0x291d3e[_0x1c1e('0x1b')]+_0x291d3e['limit'];var _0x5ddd70;if(_0x1bbab8>=_0x43c4bc){_0x1bbab8=_0x43c4bc;_0x5ddd70=0xc8;}else{_0x5ddd70=0xce;}_0x42f03c['status'](_0x5ddd70);return _0x42f03c[_0x1c1e('0x1f')](_0x1c1e('0x20'),_0x4bf6a8+'-'+_0x1bbab8+'/'+_0x43c4bc)['json'](_0x253f08);}return null;};}function patchUpdates(_0x2b6c9c){return function(_0x4a7595){try{jsonpatch[_0x1c1e('0x21')](_0x4a7595,_0x2b6c9c,!![]);}catch(_0x300d91){return BPromise['reject'](_0x300d91);}return _0x4a7595[_0x1c1e('0x22')]();};}function saveUpdates(_0xe40cec,_0x50549c){return function(_0x3c16ce){if(_0x3c16ce){return _0x3c16ce[_0x1c1e('0x23')](_0xe40cec)['then'](function(_0x3e533e){return _0x3e533e;});}return null;};}function removeEntity(_0x305298,_0x1eb34d){return function(_0x105a20){if(_0x105a20){return _0x105a20[_0x1c1e('0x24')]()['then'](function(){_0x305298[_0x1c1e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f5b9b,_0x1dc820){return function(_0x3df363){if(!_0x3df363){_0x2f5b9b[_0x1c1e('0x17')](0x194);}return _0x3df363;};}function handleError(_0x3b19fd,_0x37ab8c){_0x37ab8c=_0x37ab8c||0x1f4;return function(_0x4a1c7d){logger[_0x1c1e('0x25')](_0x4a1c7d[_0x1c1e('0x26')]);if(_0x4a1c7d['name']){delete _0x4a1c7d[_0x1c1e('0x27')];}_0x3b19fd[_0x1c1e('0x18')](_0x37ab8c)['send'](_0x4a1c7d);};}exports['index']=function(_0x4a2c95,_0x5e776d){var _0x4795de={},_0x1e32f1={},_0x566af0={'count':0x0,'rows':[]};var _0x3cb111=_[_0x1c1e('0x28')](db[_0x1c1e('0x29')][_0x1c1e('0x2a')],function(_0x3af440){return{'name':_0x3af440['fieldName'],'type':_0x3af440[_0x1c1e('0x2b')][_0x1c1e('0x2c')]};});_0x1e32f1[_0x1c1e('0x2d')]=_[_0x1c1e('0x28')](_0x3cb111,_0x1c1e('0x27'));_0x1e32f1[_0x1c1e('0x2e')]=_[_0x1c1e('0x2f')](_0x4a2c95['query']);_0x1e32f1[_0x1c1e('0x30')]=_[_0x1c1e('0x31')](_0x1e32f1[_0x1c1e('0x2d')],_0x1e32f1[_0x1c1e('0x2e')]);_0x4795de[_0x1c1e('0x32')]=_[_0x1c1e('0x31')](_0x1e32f1[_0x1c1e('0x2d')],qs[_0x1c1e('0x33')](_0x4a2c95[_0x1c1e('0x2e')][_0x1c1e('0x33')]));_0x4795de[_0x1c1e('0x32')]=_0x4795de[_0x1c1e('0x32')]['length']?_0x4795de[_0x1c1e('0x32')]:_0x1e32f1[_0x1c1e('0x2d')];if(!_0x4a2c95[_0x1c1e('0x2e')][_0x1c1e('0x34')](_0x1c1e('0x35'))){_0x4795de[_0x1c1e('0x1d')]=qs['limit'](_0x4a2c95['query'][_0x1c1e('0x1d')]);_0x4795de['offset']=qs['offset'](_0x4a2c95[_0x1c1e('0x2e')][_0x1c1e('0x1b')]);}_0x4795de[_0x1c1e('0x36')]=qs[_0x1c1e('0x37')](_0x4a2c95[_0x1c1e('0x2e')][_0x1c1e('0x37')]);_0x4795de[_0x1c1e('0x38')]=qs['filters'](_['pick'](_0x4a2c95[_0x1c1e('0x2e')],_0x1e32f1[_0x1c1e('0x30')]),_0x3cb111);if(_0x4a2c95[_0x1c1e('0x2e')][_0x1c1e('0x39')]){_0x4795de[_0x1c1e('0x38')]=_[_0x1c1e('0x3a')](_0x4795de[_0x1c1e('0x38')],{'$or':_[_0x1c1e('0x28')](_0x3cb111,function(_0x171f2e){if(_0x171f2e['type']!==_0x1c1e('0x3b')){var _0x135236={};_0x135236[_0x171f2e[_0x1c1e('0x27')]]={'$like':'%'+_0x4a2c95[_0x1c1e('0x2e')][_0x1c1e('0x39')]+'%'};return _0x135236;}})});}_0x4795de=_['merge']({},_0x4795de,_0x4a2c95[_0x1c1e('0x3c')]);var _0x308295={'where':_0x4795de[_0x1c1e('0x38')]};return db[_0x1c1e('0x29')][_0x1c1e('0x1e')](_0x308295)[_0x1c1e('0x3d')](function(_0x32982d){_0x566af0[_0x1c1e('0x1e')]=_0x32982d;if(_0x4a2c95[_0x1c1e('0x2e')]['includeAll']){_0x4795de[_0x1c1e('0x3e')]=[{'all':!![]}];}return db[_0x1c1e('0x29')]['findAll'](_0x4795de);})['then'](function(_0x3cd382){_0x566af0['rows']=_0x3cd382;return _0x566af0;})[_0x1c1e('0x3d')](respondWithFilteredResult(_0x5e776d,_0x4795de))[_0x1c1e('0x3f')](handleError(_0x5e776d,null));};exports['show']=function(_0x248cdc,_0x209304){var _0x3bcc77={'raw':!![],'where':{'id':_0x248cdc[_0x1c1e('0x40')]['id']}},_0x463503={};_0x463503[_0x1c1e('0x2d')]=_['keys'](db[_0x1c1e('0x29')][_0x1c1e('0x2a')]);_0x463503['query']=_[_0x1c1e('0x2f')](_0x248cdc[_0x1c1e('0x2e')]);_0x463503['filters']=_['intersection'](_0x463503['model'],_0x463503[_0x1c1e('0x2e')]);_0x3bcc77[_0x1c1e('0x32')]=_[_0x1c1e('0x31')](_0x463503[_0x1c1e('0x2d')],qs['fields'](_0x248cdc['query']['fields']));_0x3bcc77['attributes']=_0x3bcc77[_0x1c1e('0x32')][_0x1c1e('0x41')]?_0x3bcc77[_0x1c1e('0x32')]:_0x463503['model'];if(_0x248cdc[_0x1c1e('0x2e')][_0x1c1e('0x42')]){_0x3bcc77[_0x1c1e('0x3e')]=[{'all':!![]}];}_0x3bcc77=_[_0x1c1e('0x3a')]({},_0x3bcc77,_0x248cdc[_0x1c1e('0x3c')]);return db['Attachment'][_0x1c1e('0x43')](_0x3bcc77)['then'](handleEntityNotFound(_0x209304,null))[_0x1c1e('0x3d')](respondWithResult(_0x209304,null))[_0x1c1e('0x3f')](handleError(_0x209304,null));};exports[_0x1c1e('0x44')]=function(_0x408cd6,_0x208262){var _0x296ffa={'where':{'id':_0x408cd6[_0x1c1e('0x40')]['id']}},_0xa9a1d3={};_0xa9a1d3[_0x1c1e('0x2d')]=_['keys'](db[_0x1c1e('0x29')][_0x1c1e('0x2a')]);_0x296ffa[_0x1c1e('0x32')]=_[_0x1c1e('0x31')](_0xa9a1d3[_0x1c1e('0x2d')],qs[_0x1c1e('0x33')](_0x408cd6[_0x1c1e('0x2e')][_0x1c1e('0x33')]));_0x296ffa[_0x1c1e('0x32')]=_0x296ffa[_0x1c1e('0x32')][_0x1c1e('0x41')]?_0x296ffa[_0x1c1e('0x32')]:_0xa9a1d3[_0x1c1e('0x2d')];if(_0x408cd6[_0x1c1e('0x2e')][_0x1c1e('0x42')]){_0x296ffa[_0x1c1e('0x3e')]=[{'all':!![]}];}_0x296ffa=_[_0x1c1e('0x3a')]({},_0x296ffa,_0x408cd6[_0x1c1e('0x3c')]);return db[_0x1c1e('0x29')]['find'](_0x296ffa)['then'](handleEntityNotFound(_0x208262,null))[_0x1c1e('0x3d')](function(_0x4cb043){if(_0x4cb043){var _0x32792c=_0x4cb043[_0x1c1e('0x45')]({'plain':!![]});_0x32792c=qs['omit'](_0x32792c,['id',_0x1c1e('0x46'),'updatedAt']);_0x408cd6[_0x1c1e('0x47')]=_[_0x1c1e('0x48')](_0x408cd6[_0x1c1e('0x47')],['id',_0x1c1e('0x46'),'updatedAt']);return db[_0x1c1e('0x29')][_0x1c1e('0x49')](_[_0x1c1e('0x3a')](_0x32792c,_0x408cd6[_0x1c1e('0x47')]),{'include':_0x408cd6[_0x1c1e('0x2e')][_0x1c1e('0x42')]?[{'all':!![]}]:undefined});}})[_0x1c1e('0x3d')](respondWithResult(_0x208262,0xc9))[_0x1c1e('0x3f')](handleError(_0x208262,null));};exports[_0x1c1e('0x23')]=function(_0x1d3be0,_0x329f33){if(_0x1d3be0[_0x1c1e('0x47')]['id']){delete _0x1d3be0[_0x1c1e('0x47')]['id'];}return db[_0x1c1e('0x29')][_0x1c1e('0x43')]({'where':{'id':_0x1d3be0[_0x1c1e('0x40')]['id']}})[_0x1c1e('0x3d')](handleEntityNotFound(_0x329f33,null))[_0x1c1e('0x3d')](saveUpdates(_0x1d3be0['body'],null))[_0x1c1e('0x3d')](respondWithResult(_0x329f33,null))[_0x1c1e('0x3f')](handleError(_0x329f33,null));};exports['destroy']=function(_0x3e4b36,_0x11da55){return db[_0x1c1e('0x29')][_0x1c1e('0x43')]({'where':{'id':_0x3e4b36[_0x1c1e('0x40')]['id']}})[_0x1c1e('0x3d')](handleEntityNotFound(_0x11da55,null))[_0x1c1e('0x3d')](removeEntity(_0x11da55,null))[_0x1c1e('0x3f')](handleError(_0x11da55,null));};exports[_0x1c1e('0x49')]=function(_0x3665b2,_0x105a2e,_0x25014f){_0x3665b2['body'][_0x1c1e('0x27')]=_0x3665b2['file'][_0x1c1e('0x4a')];_0x3665b2[_0x1c1e('0x47')][_0x1c1e('0x4b')]=_0x3665b2[_0x1c1e('0x4c')][_0x1c1e('0x4d')];_0x3665b2[_0x1c1e('0x47')][_0x1c1e('0x2b')]=_0x3665b2[_0x1c1e('0x4c')][_0x1c1e('0x4e')];return db['Attachment']['create'](_0x3665b2[_0x1c1e('0x47')])[_0x1c1e('0x3d')](respondWithResult(_0x105a2e,0xc9))[_0x1c1e('0x3f')](handleError(_0x105a2e,null));};exports['download']=function(_0x532401,_0x6d98da,_0x1f1ca8){return db[_0x1c1e('0x29')][_0x1c1e('0x4f')]({'where':{'id':_0x532401['params']['id']},'raw':!![]})[_0x1c1e('0x3d')](handleEntityNotFound(_0x6d98da,null))[_0x1c1e('0x3d')](function(_0x47c900){if(_0x47c900){var _0x5036b3=_0x47c900[_0x1c1e('0x50')]!==null;var _0x29ae35=path[_0x1c1e('0x51')](config[_0x1c1e('0x52')],'server/files/attachments/');if(_0x5036b3){_0x29ae35=path[_0x1c1e('0x51')](_0x29ae35,_0x1c1e('0x53'));}var _0x3ad8f5=path[_0x1c1e('0x51')](_0x29ae35,_0x47c900[_0x1c1e('0x4b')]);return _0x6d98da[_0x1c1e('0x54')](_0x3ad8f5);}})[_0x1c1e('0x3f')](handleError(_0x6d98da,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 49a5534..5bdeba8 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 _0x233b=['rimraf','../../config/environment','./attachment.attributes','exports','define','../../config/logger','api','moment','bluebird','path'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x233b,0x1a9));var _0xb233=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x233b[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb233('0x0'))(_0xb233('0x1'));var moment=require(_0xb233('0x2'));var BPromise=require(_0xb233('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb233('0x4'));var rimraf=require(_0xb233('0x5'));var config=require(_0xb233('0x6'));var attributes=require(_0xb233('0x7'));module[_0xb233('0x8')]=function(_0x45fdc9,_0x49a7fa){return _0x45fdc9[_0xb233('0x9')]('Attachment',attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6aea=['api','moment','bluebird','path','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','attachments','lodash','util','../../config/logger'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0x6aea,0xdd));var _0xa6ae=function(_0x5ceb68,_0x1aa3bc){_0x5ceb68=_0x5ceb68-0x0;var _0x3d9ae8=_0x6aea[_0x5ceb68];return _0x3d9ae8;};'use strict';var _=require(_0xa6ae('0x0'));var util=require(_0xa6ae('0x1'));var logger=require(_0xa6ae('0x2'))(_0xa6ae('0x3'));var moment=require(_0xa6ae('0x4'));var BPromise=require(_0xa6ae('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa6ae('0x6'));var rimraf=require(_0xa6ae('0x7'));var config=require(_0xa6ae('0x8'));var attributes=require(_0xa6ae('0x9'));module[_0xa6ae('0xa')]=function(_0x1d5cc4,_0x193a80){return _0x1d5cc4[_0xa6ae('0xb')](_0xa6ae('0xc'),attributes,{'tableName':_0xa6ae('0xd'),'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 f430c54..fd2e13f 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 _0x032a=['result','catch','CreateAttachment','Attachment','create','options','raw','then','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x32a884,_0x183853){var _0x242f9b=function(_0x556c63){while(--_0x556c63){_0x32a884['push'](_0x32a884['shift']());}};_0x242f9b(++_0x183853);}(_0x032a,0xf0));var _0xa032=function(_0x50e7e0,_0x5affce){_0x50e7e0=_0x50e7e0-0x0;var _0x1a0307=_0x032a[_0x50e7e0];return _0x1a0307;};'use strict';var _=require('lodash');var util=require(_0xa032('0x0'));var moment=require('moment');var BPromise=require(_0xa032('0x1'));var rs=require(_0xa032('0x2'));var fs=require('fs');var Redis=require(_0xa032('0x3'));var db=require(_0xa032('0x4'))['db'];var utils=require(_0xa032('0x5'));var logger=require(_0xa032('0x6'))(_0xa032('0x7'));var config=require(_0xa032('0x8'));var jayson=require(_0xa032('0x9'));var client=jayson[_0xa032('0xa')][_0xa032('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x40128a,_0x54275c,_0x616437){return new BPromise(function(_0x4a5d8e,_0x5d0744){return client[_0xa032('0xc')](_0x40128a,_0x616437)['then'](function(_0x18283a){logger[_0xa032('0xd')](_0xa032('0xe'),_0x54275c,_0xa032('0xf'));logger[_0xa032('0x10')]('Attachment,\x20%s,\x20%s,\x20%s',_0x54275c,_0xa032('0xf'),JSON[_0xa032('0x11')](_0x18283a));if(_0x18283a['error']){if(_0x18283a[_0xa032('0x12')][_0xa032('0x13')]===0x1f4){logger[_0xa032('0x12')](_0xa032('0xe'),_0x54275c,_0x18283a[_0xa032('0x12')]['message']);return _0x5d0744(_0x18283a[_0xa032('0x12')][_0xa032('0x14')]);}logger[_0xa032('0x12')](_0xa032('0xe'),_0x54275c,_0x18283a[_0xa032('0x12')][_0xa032('0x14')]);return _0x4a5d8e(_0x18283a[_0xa032('0x12')][_0xa032('0x14')]);}else{logger[_0xa032('0xd')](_0xa032('0xe'),_0x54275c,'request\x20sent');_0x4a5d8e(_0x18283a[_0xa032('0x15')][_0xa032('0x14')]);}})[_0xa032('0x16')](function(_0x2caacd){logger[_0xa032('0x12')](_0xa032('0xe'),_0x54275c,_0x2caacd);_0x5d0744(_0x2caacd);});});}exports[_0xa032('0x17')]=function(_0x577406){var _0xff6817=this;return new Promise(function(_0x54fba7,_0x1d8cf4){return db[_0xa032('0x18')][_0xa032('0x19')](_0x577406['body'],{'raw':_0x577406[_0xa032('0x1a')]?_0x577406['options'][_0xa032('0x1b')]===undefined?!![]:![]:!![]})[_0xa032('0x1c')](function(_0x471757){logger[_0xa032('0xd')](_0xa032('0x17'),_0x577406);logger[_0xa032('0x10')]('CreateAttachment',_0x577406,JSON[_0xa032('0x11')](_0x471757));_0x54fba7(_0x471757);})[_0xa032('0x16')](function(_0x5a817b){logger[_0xa032('0x12')]('CreateAttachment',_0x5a817b[_0xa032('0x14')],_0x577406);_0x1d8cf4(_0xff6817['error'](0x1f4,_0x5a817b[_0xa032('0x14')]));});});}; \ No newline at end of file +var _0x8cfd=['options','raw','info','CreateAttachment','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Attachment','create','body'];(function(_0x2114e3,_0x2c3028){var _0x6bff25=function(_0x197a39){while(--_0x197a39){_0x2114e3['push'](_0x2114e3['shift']());}};_0x6bff25(++_0x2c3028);}(_0x8cfd,0xe4));var _0xd8cf=function(_0x271060,_0x3f86b1){_0x271060=_0x271060-0x0;var _0x40540b=_0x8cfd[_0x271060];return _0x40540b;};'use strict';var _=require(_0xd8cf('0x0'));var util=require(_0xd8cf('0x1'));var moment=require(_0xd8cf('0x2'));var BPromise=require(_0xd8cf('0x3'));var rs=require(_0xd8cf('0x4'));var fs=require('fs');var Redis=require(_0xd8cf('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd8cf('0x6'));var logger=require(_0xd8cf('0x7'))(_0xd8cf('0x8'));var config=require(_0xd8cf('0x9'));var jayson=require(_0xd8cf('0xa'));var client=jayson[_0xd8cf('0xb')][_0xd8cf('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4b41b7,_0x5cfd20,_0x3fe2d2){return new BPromise(function(_0xa5b446,_0x37b91b){return client[_0xd8cf('0xd')](_0x4b41b7,_0x3fe2d2)[_0xd8cf('0xe')](function(_0x668d6c){logger['info'](_0xd8cf('0xf'),_0x5cfd20,_0xd8cf('0x10'));logger[_0xd8cf('0x11')](_0xd8cf('0x12'),_0x5cfd20,_0xd8cf('0x10'),JSON[_0xd8cf('0x13')](_0x668d6c));if(_0x668d6c[_0xd8cf('0x14')]){if(_0x668d6c[_0xd8cf('0x14')][_0xd8cf('0x15')]===0x1f4){logger[_0xd8cf('0x14')](_0xd8cf('0xf'),_0x5cfd20,_0x668d6c[_0xd8cf('0x14')]['message']);return _0x37b91b(_0x668d6c[_0xd8cf('0x14')]['message']);}logger[_0xd8cf('0x14')](_0xd8cf('0xf'),_0x5cfd20,_0x668d6c['error'][_0xd8cf('0x16')]);return _0xa5b446(_0x668d6c[_0xd8cf('0x14')][_0xd8cf('0x16')]);}else{logger['info'](_0xd8cf('0xf'),_0x5cfd20,'request\x20sent');_0xa5b446(_0x668d6c[_0xd8cf('0x17')][_0xd8cf('0x16')]);}})[_0xd8cf('0x18')](function(_0x55018c){logger[_0xd8cf('0x14')](_0xd8cf('0xf'),_0x5cfd20,_0x55018c);_0x37b91b(_0x55018c);});});}exports['CreateAttachment']=function(_0xecd444){var _0x73e7c3=this;return new Promise(function(_0x3bee85,_0xf8732e){return db[_0xd8cf('0x19')][_0xd8cf('0x1a')](_0xecd444[_0xd8cf('0x1b')],{'raw':_0xecd444[_0xd8cf('0x1c')]?_0xecd444[_0xd8cf('0x1c')][_0xd8cf('0x1d')]===undefined?!![]:![]:!![]})[_0xd8cf('0xe')](function(_0x2f8e8a){logger[_0xd8cf('0x1e')](_0xd8cf('0x1f'),_0xecd444);logger['debug'](_0xd8cf('0x1f'),_0xecd444,JSON[_0xd8cf('0x13')](_0x2f8e8a));_0x3bee85(_0x2f8e8a);})[_0xd8cf('0x18')](function(_0x182613){logger[_0xd8cf('0x14')]('CreateAttachment',_0x182613[_0xd8cf('0x16')],_0xecd444);_0xf8732e(_0x73e7c3['error'](0x1f4,_0x182613['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 54e5ff7..e071f14 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(_0x30e43f,_0x418ef7){var _0x571e18=function(_0x41d3df){while(--_0x41d3df){_0x30e43f['push'](_0x30e43f['shift']());}};_0x571e18(++_0x418ef7);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1c802c,_0x177ac9){_0x1c802c=_0x1c802c-0x0;var _0x1e53da=_0x5f2f[_0x1c802c];return _0x1e53da;};'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 _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','/:id/clone','clone','join','root','server/files/attachments/','%s-%s','now','originalname','replace','post','single','file','create','put','update','delete','destroy','exports','multer','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xdb28,0x106));var _0x8db2=function(_0x1d0549,_0x141420){_0x1d0549=_0x1d0549-0x0;var _0x4cea46=_0xdb28[_0x1d0549];return _0x4cea46;};'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('./attachment.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'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1d9371,_0x150942,_0x576475){_0x576475(null,path[_0x8db2('0x11')](config[_0x8db2('0x12')],_0x8db2('0x13')));},'filename':function(_0x204f49,_0x37d017,_0x559fb1){_0x559fb1(null,util['format'](_0x8db2('0x14'),Date[_0x8db2('0x15')](),_0x37d017[_0x8db2('0x16')][_0x8db2('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8db2('0x18')]('/',upload[_0x8db2('0x19')](_0x8db2('0x1a')),controller[_0x8db2('0x1b')]);router[_0x8db2('0x1c')](_0x8db2('0xb'),auth['isAuthenticated'](),controller[_0x8db2('0x1d')]);router[_0x8db2('0x1e')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x1f')]);module[_0x8db2('0x20')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index fe4a83c..4e2cfe6 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 _0x0983=['email','use','clientID','secret','callbackURL','Setting','findOne','allowedLoginAttempts','blockDuration','then','User','map','emails','user','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','clearBlockUser','getLicense','catch','lodash','passport-google-oauth20','Strategy','moment','../../mysqldb','../../config/environment','../../components/auth/service','../../config/utils','login','authenticate','google','/login','profile'];(function(_0x21a1a6,_0x1474bf){var _0x5cec0e=function(_0x13abb9){while(--_0x13abb9){_0x21a1a6['push'](_0x21a1a6['shift']());}};_0x5cec0e(++_0x1474bf);}(_0x0983,0x151));var _0x3098=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x0983[_0x36eaaa];return _0x461349;};'use strict';var _=require(_0x3098('0x0'));var passport=require('passport');var GoogleStrategy=require(_0x3098('0x1'))[_0x3098('0x2')];var moment=require(_0x3098('0x3'));var db=require(_0x3098('0x4'))['db'];var config=require(_0x3098('0x5'));var signToken=require(_0x3098('0x6'))['signToken'];var utils=require(_0x3098('0x7'));exports[_0x3098('0x8')]=passport[_0x3098('0x9')](_0x3098('0xa'),{'failureRedirect':_0x3098('0xb'),'scope':[_0x3098('0xc'),_0x3098('0xd')],'session':![]});exports['callback']=passport[_0x3098('0x9')]('google',{'failureRedirect':_0x3098('0xb'),'session':![]});passport[_0x3098('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x3098('0xa')][_0x3098('0xf')]:'id','clientSecret':config[_0x3098('0xa')]?config[_0x3098('0xa')]['clientSecret']:_0x3098('0x10'),'callbackURL':config['google']?config[_0x3098('0xa')][_0x3098('0x11')]:''},function(_0x4b3b3c,_0x37a2c4,_0x567748,_0x1d3cf2){var _0x522c66,_0x4ce235;return db[_0x3098('0x12')][_0x3098('0x13')]({'where':{'id':0x1},'attributes':[_0x3098('0x14'),_0x3098('0x15')],'raw':!![]})[_0x3098('0x16')](function(_0x58a6fe){_0x522c66=_0x58a6fe;return db[_0x3098('0x17')]['find']({'where':{'email':_[_0x3098('0x18')](_0x567748[_0x3098('0x19')],'value'),'role':{'$or':['admin',_0x3098('0x1a'),_0x3098('0x1b')]}}});})[_0x3098('0x16')](function(_0x869728){_0x4ce235=_0x869728;if(_0x4ce235){if(_0x4ce235[_0x3098('0x1c')]){return _0x1d3cf2(_0x3098('0x1d'));}else if(_0x522c66[_0x3098('0x15')]>0x0){if(_0x4ce235[_0x3098('0x1e')]){if(moment(_0x4ce235[_0x3098('0x1f')])['add'](_0x522c66['blockDuration'],'minutes')>moment()){return _0x1d3cf2(_0x3098('0x1d'));}else{return utils[_0x3098('0x20')](_0x4ce235,0x0,![],null)[_0x3098('0x16')](function(){return utils[_0x3098('0x21')](_0x4ce235);})[_0x3098('0x16')](function(){return _0x1d3cf2(null,_0x4ce235);});}}else{return utils['getLicense'](_0x4ce235)[_0x3098('0x16')](function(){return _0x1d3cf2(null,_0x4ce235);});}}else{return utils['getLicense'](_0x4ce235)[_0x3098('0x16')](function(){return _0x1d3cf2(null,_0x4ce235);});}}return _0x1d3cf2('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})[_0x3098('0x22')](function(_0x16a087){_0x1d3cf2(_0x16a087);});})); \ No newline at end of file +var _0x170f=['authenticate','google','/login','profile','email','callback','use','secret','callbackURL','Setting','findOne','blockDuration','then','find','map','emails','value','admin','user','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','add','minutes','clearBlockUser','getLicense','lodash','passport','passport-google-oauth20','Strategy','moment','../../mysqldb','../../components/auth/service','signToken','../../config/utils','login'];(function(_0x393a89,_0x2781fe){var _0x5c2c06=function(_0x9c539e){while(--_0x9c539e){_0x393a89['push'](_0x393a89['shift']());}};_0x5c2c06(++_0x2781fe);}(_0x170f,0x14c));var _0xf170=function(_0x236c89,_0xd76ba9){_0x236c89=_0x236c89-0x0;var _0x3b2a15=_0x170f[_0x236c89];return _0x3b2a15;};'use strict';var _=require(_0xf170('0x0'));var passport=require(_0xf170('0x1'));var GoogleStrategy=require(_0xf170('0x2'))[_0xf170('0x3')];var moment=require(_0xf170('0x4'));var db=require(_0xf170('0x5'))['db'];var config=require('../../config/environment');var signToken=require(_0xf170('0x6'))[_0xf170('0x7')];var utils=require(_0xf170('0x8'));exports[_0xf170('0x9')]=passport[_0xf170('0xa')](_0xf170('0xb'),{'failureRedirect':_0xf170('0xc'),'scope':[_0xf170('0xd'),_0xf170('0xe')],'session':![]});exports[_0xf170('0xf')]=passport[_0xf170('0xa')](_0xf170('0xb'),{'failureRedirect':'/login','session':![]});passport[_0xf170('0x10')](new GoogleStrategy({'clientID':config[_0xf170('0xb')]?config[_0xf170('0xb')]['clientID']:'id','clientSecret':config['google']?config['google']['clientSecret']:_0xf170('0x11'),'callbackURL':config[_0xf170('0xb')]?config[_0xf170('0xb')][_0xf170('0x12')]:''},function(_0x429465,_0x21c4d9,_0x5abe66,_0x19e2d8){var _0x9917f3,_0x1ef495;return db[_0xf170('0x13')][_0xf170('0x14')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xf170('0x15')],'raw':!![]})[_0xf170('0x16')](function(_0x168154){_0x9917f3=_0x168154;return db['User'][_0xf170('0x17')]({'where':{'email':_[_0xf170('0x18')](_0x5abe66[_0xf170('0x19')],_0xf170('0x1a')),'role':{'$or':[_0xf170('0x1b'),_0xf170('0x1c'),_0xf170('0x1d')]}}});})['then'](function(_0x1374a1){_0x1ef495=_0x1374a1;if(_0x1ef495){if(_0x1ef495[_0xf170('0x1e')]){return _0x19e2d8(_0xf170('0x1f'));}else if(_0x9917f3[_0xf170('0x15')]>0x0){if(_0x1ef495[_0xf170('0x20')]){if(moment(_0x1ef495[_0xf170('0x21')])[_0xf170('0x22')](_0x9917f3[_0xf170('0x15')],_0xf170('0x23'))>moment()){return _0x19e2d8(_0xf170('0x1f'));}else{return utils[_0xf170('0x24')](_0x1ef495,0x0,![],null)[_0xf170('0x16')](function(){return utils[_0xf170('0x25')](_0x1ef495);})['then'](function(){return _0x19e2d8(null,_0x1ef495);});}}else{return utils[_0xf170('0x25')](_0x1ef495)[_0xf170('0x16')](function(){return _0x19e2d8(null,_0x1ef495);});}}else{return utils[_0xf170('0x25')](_0x1ef495)[_0xf170('0x16')](function(){return _0x19e2d8(null,_0x1ef495);});}}return _0x19e2d8(_0xf170('0x1f'));})['catch'](function(_0x2d6207){_0x19e2d8(_0x2d6207);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 9feafa2..8ed8f1a 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 _0x1d99=['login','callback','isMiddleware','setTokenCookie','exports','express','passport','Router','../user/user.controller.js','../../components/auth/service','get'];(function(_0x3553cb,_0x16f3db){var _0x47f419=function(_0x398197){while(--_0x398197){_0x3553cb['push'](_0x3553cb['shift']());}};_0x47f419(++_0x16f3db);}(_0x1d99,0xaa));var _0x91d9=function(_0xe289f7,_0x5f21cb){_0xe289f7=_0xe289f7-0x0;var _0x45314c=_0x1d99[_0xe289f7];return _0x45314c;};'use strict';var express=require(_0x91d9('0x0'));var passport=require(_0x91d9('0x1'));var router=express[_0x91d9('0x2')]();var controller=require('./authGoogle.controller');var userController=require(_0x91d9('0x3'));var authService=require(_0x91d9('0x4'));router[_0x91d9('0x5')]('/',controller[_0x91d9('0x6')]);router[_0x91d9('0x5')]('/callback',controller[_0x91d9('0x7')],authService[_0x91d9('0x8')],userController[_0x91d9('0x6')],authService[_0x91d9('0x9')]);module[_0x91d9('0xa')]=router; \ No newline at end of file +var _0x9fe9=['login','/callback','callback','exports','passport','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get'];(function(_0x2a6e4c,_0x5eef27){var _0x153fce=function(_0x37c2ef){while(--_0x37c2ef){_0x2a6e4c['push'](_0x2a6e4c['shift']());}};_0x153fce(++_0x5eef27);}(_0x9fe9,0x1e1));var _0x99fe=function(_0x2d1785,_0x27fc1b){_0x2d1785=_0x2d1785-0x0;var _0x275a55=_0x9fe9[_0x2d1785];return _0x275a55;};'use strict';var express=require('express');var passport=require(_0x99fe('0x0'));var router=express['Router']();var controller=require(_0x99fe('0x1'));var userController=require(_0x99fe('0x2'));var authService=require(_0x99fe('0x3'));router[_0x99fe('0x4')]('/',controller[_0x99fe('0x5')]);router[_0x99fe('0x4')](_0x99fe('0x6'),controller[_0x99fe('0x7')],authService['isMiddleware'],userController['login'],authService['setTokenCookie']);module[_0x99fe('0x8')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 84e52b9..bd7922f 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 _0x5d44=['error','message','stringify','status','login','signToken','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','Setting','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','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','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','send','Reset\x20Email\x20sent!','reset','User','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','Password\x20reset!','util','passport','passport-local','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','http','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','disabled','add','minutes','clearBlockUser','getLicense','catch','MailAccount','email','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','pass','format'];(function(_0x560a6d,_0x42c234){var _0x4b29aa=function(_0x24309c){while(--_0x24309c){_0x560a6d['push'](_0x560a6d['shift']());}};_0x4b29aa(++_0x42c234);}(_0x5d44,0xd1));var _0x45d4=function(_0x20b91e,_0xe4e682){_0x20b91e=_0x20b91e-0x0;var _0x41d214=_0x5d44[_0x20b91e];return _0x41d214;};'use strict';var util=require(_0x45d4('0x0'));var passport=require(_0x45d4('0x1'));var LocalStrategy=require(_0x45d4('0x2'))['Strategy'];var jayson=require(_0x45d4('0x3'));var _=require(_0x45d4('0x4'));var rs=require(_0x45d4('0x5'));var moment=require(_0x45d4('0x6'));var db=require(_0x45d4('0x7'))['db'];var authService=require(_0x45d4('0x8'));var utils=require(_0x45d4('0x9'));var client=jayson['client'][_0x45d4('0xa')]({'port':0x232b});function localAuthenticate(_0x17e99c,_0x32d570,_0x56fe0b,_0x2717b2){var _0x4ecf33,_0x102cbe;return db['Setting'][_0x45d4('0xb')]({'where':{'id':0x1},'attributes':[_0x45d4('0xc'),_0x45d4('0xd')],'raw':!![]})[_0x45d4('0xe')](function(_0x4d9bae){_0x4ecf33=_0x4d9bae;return _0x17e99c[_0x45d4('0xb')]({'attributes':['id',_0x45d4('0xf'),_0x45d4('0x10'),_0x45d4('0x11'),_0x45d4('0x12'),'disabled',_0x45d4('0x13'),_0x45d4('0x14'),_0x45d4('0x15')],'where':{'name':_0x32d570,'role':{'$or':[_0x45d4('0x16'),_0x45d4('0x17'),_0x45d4('0x18')]}}});})[_0x45d4('0xe')](function(_0x45eb36){if(!_0x45eb36||_0x45eb36&&_0x45eb36[_0x45d4('0xf')]!==_0x32d570){throw new Error(_0x45d4('0x19'));}else{_0x102cbe=_0x45eb36;return _0x102cbe;}})[_0x45d4('0xe')](function(){_0x102cbe[_0x45d4('0x1a')](_0x56fe0b,function(_0x152ecb,_0x1adc55){var _0x2ba0e0=_0x102cbe[_0x45d4('0x15')]+0x1;if(_0x152ecb){return _0x2717b2(_0x152ecb);}else if(!_0x1adc55){if(_0x102cbe[_0x45d4('0x1b')]){return _0x2717b2(null,![],{'message':_0x45d4('0x19')});}else if(_0x4ecf33[_0x45d4('0xc')]>0x0){if(_0x102cbe['blocked']){if(_0x4ecf33[_0x45d4('0xd')]>0x0){if(moment(_0x102cbe[_0x45d4('0x14')])[_0x45d4('0x1c')](_0x4ecf33['blockDuration'],_0x45d4('0x1d'))>moment()){return _0x2717b2(null,![],{'message':_0x45d4('0x19')});}else{return utils['clearBlockUser'](_0x102cbe,_0x2ba0e0,![],null)['then'](function(){return _0x2717b2(null,![],{'message':_0x45d4('0x19')});});}}else{return _0x2717b2(null,![],{'message':_0x45d4('0x19')});}}else{if(_0x2ba0e0>=_0x4ecf33[_0x45d4('0xc')]){return utils[_0x45d4('0x1e')](_0x102cbe,0x0,!![],moment())[_0x45d4('0xe')](function(){return _0x2717b2(null,![],{'message':_0x45d4('0x19')});});}else{return utils[_0x45d4('0x1e')](_0x102cbe,_0x2ba0e0,![],null)[_0x45d4('0xe')](function(){return _0x2717b2(null,![],{'message':_0x45d4('0x19')});});}}}else{return _0x2717b2(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x102cbe[_0x45d4('0x1b')]){return _0x2717b2(null,![],{'message':_0x45d4('0x19')});}else if(_0x4ecf33['allowedLoginAttempts']>0x0){if(_0x102cbe['blocked']){if(_0x4ecf33['blockDuration']>0x0){if(moment(_0x102cbe[_0x45d4('0x14')])[_0x45d4('0x1c')](_0x4ecf33[_0x45d4('0xd')],'minutes')>moment()){return _0x2717b2(null,![],{'message':_0x45d4('0x19')});}else{return utils['clearBlockUser'](_0x102cbe,0x0,![],null)[_0x45d4('0xe')](function(){return utils[_0x45d4('0x1f')](_0x102cbe);})[_0x45d4('0xe')](function(){return _0x2717b2(null,_0x102cbe);});}}else{return _0x2717b2(null,![],{'message':_0x45d4('0x19')});}}else{return utils[_0x45d4('0x1e')](_0x102cbe,0x0,![],null)[_0x45d4('0xe')](function(){return utils[_0x45d4('0x1f')](_0x102cbe);})[_0x45d4('0xe')](function(){return _0x2717b2(null,_0x102cbe);})[_0x45d4('0x20')](function(_0x30781e){return _0x2717b2(null,![],_0x30781e);});}}else{if(_0x102cbe[_0x45d4('0x13')]){return _0x2717b2(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x45d4('0x1f')](_0x102cbe)[_0x45d4('0xe')](function(){return _0x2717b2(null,_0x102cbe);});}}}});})['catch'](function(_0x3cf0c1){return _0x2717b2(null,![],_0x3cf0c1);});}function sendServiceMail(_0x6bc17b){return db[_0x45d4('0x21')]['find']({'where':{'service':!![]},'attributes':['id',_0x45d4('0xf'),_0x45d4('0x22')],'include':[{'model':db['MailServerOut'],'as':_0x45d4('0x23')}]})[_0x45d4('0xe')](function(_0x23bd4c){if(!_0x23bd4c){throw new Error(_0x45d4('0x24'));}var _0x4cbdd2={'tls':{'rejectUnauthorized':![]}};if(_0x23bd4c[_0x45d4('0x23')][_0x45d4('0x25')]){_0x4cbdd2[_0x45d4('0x25')]=_0x23bd4c['Smtp'][_0x45d4('0x25')];}else{_0x4cbdd2[_0x45d4('0x26')]=_0x23bd4c[_0x45d4('0x23')][_0x45d4('0x26')];_0x4cbdd2[_0x45d4('0x27')]=_0x23bd4c[_0x45d4('0x23')][_0x45d4('0x27')];_0x4cbdd2[_0x45d4('0x28')]=_0x23bd4c[_0x45d4('0x23')][_0x45d4('0x28')];}if(_0x23bd4c[_0x45d4('0x23')]['authentication']){_0x4cbdd2['auth']={'user':_0x23bd4c[_0x45d4('0x23')][_0x45d4('0x17')],'pass':_0x23bd4c[_0x45d4('0x23')][_0x45d4('0x29')]};}var _0x282f61={'account':_0x4cbdd2,'message':_['merge']({'from':util[_0x45d4('0x2a')]('\x22%s\x22\x20<%s>',_0x23bd4c[_0x45d4('0xf')],_0x23bd4c['email']||_0x23bd4c[_0x45d4('0x23')][_0x45d4('0x17')])},_0x6bc17b)};return client['request']('SendMail',_0x282f61);})[_0x45d4('0xe')](function(_0x2889db){if(_0x2889db[_0x45d4('0x2b')]){throw new Error(util['format']('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x2889db['error'][_0x45d4('0x2c')]||JSON[_0x45d4('0x2d')](_0x2889db[_0x45d4('0x2b')])));}return!![];});}function handleError(_0x3cc141,_0x15f3e5,_0xe02fb2){return _0x3cc141[_0x45d4('0x2e')](_0x15f3e5||0x1f4)['send']({'message':_0xe02fb2?_0xe02fb2[_0x45d4('0x2c')]||_0xe02fb2:''});}exports[_0x45d4('0x2f')]=function(_0x26aa1f,_0x2e7491,_0x41eba8){passport['authenticate']('local',function(_0x23db01,_0x399f78,_0x569e9d){var _0x139859=_0x23db01||_0x569e9d;if(_0x139859){return handleError(_0x2e7491,0x191,_0x139859);}if(!_0x399f78){return handleError(_0x2e7491,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x55d270={'payload':{'id':_0x399f78['id'],'role':_0x399f78[_0x45d4('0x12')]},'options':{'expiresIn':0x15180}};return authService[_0x45d4('0x30')](_0x55d270)[_0x45d4('0xe')](function(_0xfafe6a){_0x2e7491['json']({'id':_0x399f78['id'],'token':_0xfafe6a,'statusCall':'','isAlreadyLogged':_0x399f78[_0x45d4('0x31')]});});}})(_0x26aa1f,_0x2e7491,_0x41eba8);};exports[_0x45d4('0x32')]=function(_0x3be779,_0x2616dd,_0xb51b99){if(!_0x3be779[_0x45d4('0x33')]['email']){return handleError(_0x2616dd,0x1f4,{'message':_0x45d4('0x34')});}var _0x39920e=rs[_0x45d4('0x35')]();_0x3be779[_0x45d4('0x33')][_0x45d4('0x22')]=_0x3be779['body'][_0x45d4('0x22')][_0x45d4('0x36')]()[_0x45d4('0x37')]();var _0x59df68;return db[_0x45d4('0x38')][_0x45d4('0xb')]({'where':{'id':0x1},'attributes':[_0x45d4('0xc'),_0x45d4('0xd')],'raw':!![]})[_0x45d4('0xe')](function(_0x199bf6){_0x59df68=_0x199bf6;return db['User'][_0x45d4('0x39')]({'where':{'email':_0x3be779['body'][_0x45d4('0x22')]}});})[_0x45d4('0xe')](function(_0x16ed41){if(!_0x16ed41){throw new Error(_0x45d4('0x3a'));}if(_0x16ed41[_0x45d4('0x1b')]){throw new Error(_0x45d4('0x3b'));}if(_0x16ed41[_0x45d4('0x13')]){if(moment(_0x16ed41[_0x45d4('0x14')])[_0x45d4('0x1c')](_0x59df68[_0x45d4('0xd')],_0x45d4('0x1d'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x16ed41['blocked']=![];_0x16ed41[_0x45d4('0x14')]=null;}}_0x16ed41[_0x45d4('0x3c')]=_0x39920e;_0x16ed41[_0x45d4('0x3d')]=Date[_0x45d4('0x3e')]()+0x36ee80;return _0x16ed41[_0x45d4('0x3f')]();})[_0x45d4('0xe')](function(){return sendServiceMail({'to':_0x3be779[_0x45d4('0x33')][_0x45d4('0x22')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x45d4('0x40')+_0x45d4('0x41')+_0x45d4('0x42')+_0x3be779[_0x45d4('0x43')][_0x45d4('0x26')]+_0x45d4('0x44')+_0x39920e+'\x0a\x0a'+_0x45d4('0x45')});})[_0x45d4('0xe')](function(){_0x2616dd['status'](0xc8)[_0x45d4('0x46')]({'message':_0x45d4('0x47')});})[_0x45d4('0x20')](function(_0x14ef5d){return handleError(_0x2616dd,0x1f4,_0x14ef5d);});};exports[_0x45d4('0x48')]=function(_0x5d56da,_0x206e2c,_0x48e552){return db[_0x45d4('0x49')][_0x45d4('0x39')]({'where':{'resetPasswordToken':_0x5d56da[_0x45d4('0x4a')][_0x45d4('0x4b')],'resetPasswordExpires':{'$gt':Date[_0x45d4('0x3e')]()}}})[_0x45d4('0xe')](function(_0x3a76eb){if(!_0x3a76eb){throw new Error(_0x45d4('0x4c'));}return db[_0x45d4('0x38')]['findOne']({'attributes':['id',_0x45d4('0x4d'),_0x45d4('0x4e'),_0x45d4('0x4f')]})['then'](function(_0xb9bc4f){if(_0xb9bc4f[_0x45d4('0x4d')])authService[_0x45d4('0x50')](_0x5d56da['body'][_0x45d4('0x10')]);if(!_0xb9bc4f[_0x45d4('0x4e')]||!_0x3a76eb[_0x45d4('0x51')])return _0x3a76eb;authService[_0x45d4('0x52')](_0x5d56da['body'][_0x45d4('0x10')],_0x3a76eb['previousPasswords'],_0xb9bc4f[_0x45d4('0x4f')]);return _0x3a76eb;})[_0x45d4('0xe')](function(){_0x3a76eb[_0x45d4('0x10')]=_0x5d56da[_0x45d4('0x33')][_0x45d4('0x10')];_0x3a76eb[_0x45d4('0x3c')]=null;_0x3a76eb[_0x45d4('0x3d')]=null;return _0x3a76eb[_0x45d4('0x3f')]();});})[_0x45d4('0xe')](function(){_0x206e2c[_0x45d4('0x2e')](0xc8)['send']({'message':_0x45d4('0x53')});})[_0x45d4('0x20')](function(_0x59a201){return handleError(_0x206e2c,0x1f4,_0x59a201);});};passport['use'](new LocalStrategy({'usernameField':_0x45d4('0xf'),'passwordField':_0x45d4('0x10')},function(_0x5a1889,_0x115804,_0x51eb90){return localAuthenticate(db[_0x45d4('0x49')],_0x5a1889,_0x115804,_0x51eb90);})); \ No newline at end of file +var _0x8b6b=['loginAttempts','admin','user','agent','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','clearBlockUser','add','minutes','getLicense','catch','MailAccount','find','email','MailServerOut','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','Smtp','service','host','port','secure','authentication','auth','pass','merge','\x22%s\x22\x20<%s>','request','SendMail','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','status','send','local','signToken','json','online','forgot','body','trim','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','params','passwordHistoryLimit','securePassword','validatePasswordPattern','previousPasswords','Password\x20reset!','use','util','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','password','salt','role','disabled','blocked','blockedAt'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x8b6b,0x8e));var _0xb8b6=function(_0x12d274,_0x26ee13){_0x12d274=_0x12d274-0x0;var _0x4fe54b=_0x8b6b[_0x12d274];return _0x4fe54b;};'use strict';var util=require(_0xb8b6('0x0'));var passport=require('passport');var LocalStrategy=require(_0xb8b6('0x1'))[_0xb8b6('0x2')];var jayson=require(_0xb8b6('0x3'));var _=require(_0xb8b6('0x4'));var rs=require(_0xb8b6('0x5'));var moment=require(_0xb8b6('0x6'));var db=require('../../mysqldb')['db'];var authService=require(_0xb8b6('0x7'));var utils=require(_0xb8b6('0x8'));var client=jayson[_0xb8b6('0x9')][_0xb8b6('0xa')]({'port':0x232b});function localAuthenticate(_0x2fc941,_0x5bfc67,_0x8db467,_0x5b64ad){var _0x4c4590,_0x4bfd6b;return db[_0xb8b6('0xb')][_0xb8b6('0xc')]({'where':{'id':0x1},'attributes':[_0xb8b6('0xd'),_0xb8b6('0xe')],'raw':!![]})[_0xb8b6('0xf')](function(_0x152ae1){_0x4c4590=_0x152ae1;return _0x2fc941['findOne']({'attributes':['id','name',_0xb8b6('0x10'),_0xb8b6('0x11'),_0xb8b6('0x12'),_0xb8b6('0x13'),_0xb8b6('0x14'),_0xb8b6('0x15'),_0xb8b6('0x16')],'where':{'name':_0x5bfc67,'role':{'$or':[_0xb8b6('0x17'),_0xb8b6('0x18'),_0xb8b6('0x19')]}}});})[_0xb8b6('0xf')](function(_0x34e1b9){if(!_0x34e1b9||_0x34e1b9&&_0x34e1b9[_0xb8b6('0x1a')]!==_0x5bfc67){throw new Error(_0xb8b6('0x1b'));}else{_0x4bfd6b=_0x34e1b9;return _0x4bfd6b;}})[_0xb8b6('0xf')](function(){_0x4bfd6b[_0xb8b6('0x1c')](_0x8db467,function(_0x49e5c6,_0x3deb37){var _0x4fca3a=_0x4bfd6b[_0xb8b6('0x16')]+0x1;if(_0x49e5c6){return _0x5b64ad(_0x49e5c6);}else if(!_0x3deb37){if(_0x4bfd6b[_0xb8b6('0x13')]){return _0x5b64ad(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x4c4590[_0xb8b6('0xd')]>0x0){if(_0x4bfd6b[_0xb8b6('0x14')]){if(_0x4c4590[_0xb8b6('0xe')]>0x0){if(moment(_0x4bfd6b[_0xb8b6('0x15')])['add'](_0x4c4590[_0xb8b6('0xe')],'minutes')>moment()){return _0x5b64ad(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0x4bfd6b,_0x4fca3a,![],null)[_0xb8b6('0xf')](function(){return _0x5b64ad(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x5b64ad(null,![],{'message':_0xb8b6('0x1b')});}}else{if(_0x4fca3a>=_0x4c4590[_0xb8b6('0xd')]){return utils[_0xb8b6('0x1d')](_0x4bfd6b,0x0,!![],moment())[_0xb8b6('0xf')](function(){return _0x5b64ad(null,![],{'message':_0xb8b6('0x1b')});});}else{return utils['clearBlockUser'](_0x4bfd6b,_0x4fca3a,![],null)[_0xb8b6('0xf')](function(){return _0x5b64ad(null,![],{'message':_0xb8b6('0x1b')});});}}}else{return _0x5b64ad(null,![],{'message':_0xb8b6('0x1b')});}}else{if(_0x4bfd6b[_0xb8b6('0x13')]){return _0x5b64ad(null,![],{'message':_0xb8b6('0x1b')});}else if(_0x4c4590[_0xb8b6('0xd')]>0x0){if(_0x4bfd6b[_0xb8b6('0x14')]){if(_0x4c4590['blockDuration']>0x0){if(moment(_0x4bfd6b[_0xb8b6('0x15')])[_0xb8b6('0x1e')](_0x4c4590['blockDuration'],_0xb8b6('0x1f'))>moment()){return _0x5b64ad(null,![],{'message':_0xb8b6('0x1b')});}else{return utils[_0xb8b6('0x1d')](_0x4bfd6b,0x0,![],null)[_0xb8b6('0xf')](function(){return utils[_0xb8b6('0x20')](_0x4bfd6b);})[_0xb8b6('0xf')](function(){return _0x5b64ad(null,_0x4bfd6b);});}}else{return _0x5b64ad(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0xb8b6('0x1d')](_0x4bfd6b,0x0,![],null)[_0xb8b6('0xf')](function(){return utils[_0xb8b6('0x20')](_0x4bfd6b);})['then'](function(){return _0x5b64ad(null,_0x4bfd6b);})[_0xb8b6('0x21')](function(_0x4cedf1){return _0x5b64ad(null,![],_0x4cedf1);});}}else{if(_0x4bfd6b[_0xb8b6('0x14')]){return _0x5b64ad(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xb8b6('0x20')](_0x4bfd6b)[_0xb8b6('0xf')](function(){return _0x5b64ad(null,_0x4bfd6b);});}}}});})[_0xb8b6('0x21')](function(_0x3e945a){return _0x5b64ad(null,![],_0x3e945a);});}function sendServiceMail(_0x123aed){return db[_0xb8b6('0x22')][_0xb8b6('0x23')]({'where':{'service':!![]},'attributes':['id',_0xb8b6('0x1a'),_0xb8b6('0x24')],'include':[{'model':db[_0xb8b6('0x25')],'as':'Smtp'}]})['then'](function(_0x25395b){if(!_0x25395b){throw new Error(_0xb8b6('0x26'));}var _0x5c578e={'tls':{'rejectUnauthorized':![]}};if(_0x25395b[_0xb8b6('0x27')][_0xb8b6('0x28')]){_0x5c578e[_0xb8b6('0x28')]=_0x25395b[_0xb8b6('0x27')][_0xb8b6('0x28')];}else{_0x5c578e['host']=_0x25395b[_0xb8b6('0x27')][_0xb8b6('0x29')];_0x5c578e[_0xb8b6('0x2a')]=_0x25395b['Smtp'][_0xb8b6('0x2a')];_0x5c578e[_0xb8b6('0x2b')]=_0x25395b[_0xb8b6('0x27')][_0xb8b6('0x2b')];}if(_0x25395b[_0xb8b6('0x27')][_0xb8b6('0x2c')]){_0x5c578e[_0xb8b6('0x2d')]={'user':_0x25395b[_0xb8b6('0x27')][_0xb8b6('0x18')],'pass':_0x25395b[_0xb8b6('0x27')][_0xb8b6('0x2e')]};}var _0x4df9b8={'account':_0x5c578e,'message':_[_0xb8b6('0x2f')]({'from':util['format'](_0xb8b6('0x30'),_0x25395b[_0xb8b6('0x1a')],_0x25395b[_0xb8b6('0x24')]||_0x25395b[_0xb8b6('0x27')][_0xb8b6('0x18')])},_0x123aed)};return client[_0xb8b6('0x31')](_0xb8b6('0x32'),_0x4df9b8);})[_0xb8b6('0xf')](function(_0xdc233a){if(_0xdc233a[_0xb8b6('0x33')]){throw new Error(util[_0xb8b6('0x34')](_0xb8b6('0x35'),_0xdc233a['error'][_0xb8b6('0x36')]||JSON['stringify'](_0xdc233a['error'])));}return!![];});}function handleError(_0x40a9fa,_0x7dd06b,_0x1f8556){return _0x40a9fa[_0xb8b6('0x37')](_0x7dd06b||0x1f4)[_0xb8b6('0x38')]({'message':_0x1f8556?_0x1f8556['message']||_0x1f8556:''});}exports['login']=function(_0x335b59,_0x9604c1,_0x5538f7){passport[_0xb8b6('0x1c')](_0xb8b6('0x39'),function(_0x42bb3d,_0x1a2b0d,_0x458d24){var _0x2a2ad5=_0x42bb3d||_0x458d24;if(_0x2a2ad5){return handleError(_0x9604c1,0x191,_0x2a2ad5);}if(!_0x1a2b0d){return handleError(_0x9604c1,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x485dc6={'payload':{'id':_0x1a2b0d['id'],'role':_0x1a2b0d[_0xb8b6('0x12')]},'options':{'expiresIn':0x15180}};return authService[_0xb8b6('0x3a')](_0x485dc6)['then'](function(_0x38aedc){_0x9604c1[_0xb8b6('0x3b')]({'id':_0x1a2b0d['id'],'token':_0x38aedc,'statusCall':'','isAlreadyLogged':_0x1a2b0d[_0xb8b6('0x3c')]});});}})(_0x335b59,_0x9604c1,_0x5538f7);};exports[_0xb8b6('0x3d')]=function(_0x58a0d9,_0x2ea90e,_0x3e00bf){if(!_0x58a0d9[_0xb8b6('0x3e')]['email']){return handleError(_0x2ea90e,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x7f76ff=rs['generate']();_0x58a0d9['body'][_0xb8b6('0x24')]=_0x58a0d9[_0xb8b6('0x3e')][_0xb8b6('0x24')][_0xb8b6('0x3f')]()['toLowerCase']();var _0x41c853;return db[_0xb8b6('0xb')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xb8b6('0xe')],'raw':!![]})[_0xb8b6('0xf')](function(_0x2724b0){_0x41c853=_0x2724b0;return db[_0xb8b6('0x40')]['find']({'where':{'email':_0x58a0d9[_0xb8b6('0x3e')]['email']}});})[_0xb8b6('0xf')](function(_0x52c9d9){if(!_0x52c9d9){throw new Error(_0xb8b6('0x41'));}if(_0x52c9d9[_0xb8b6('0x13')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x52c9d9[_0xb8b6('0x14')]){if(moment(_0x52c9d9[_0xb8b6('0x15')])[_0xb8b6('0x1e')](_0x41c853['blockDuration'],_0xb8b6('0x1f'))>moment()){throw new Error(_0xb8b6('0x42'));}else{_0x52c9d9[_0xb8b6('0x14')]=![];_0x52c9d9[_0xb8b6('0x15')]=null;}}_0x52c9d9[_0xb8b6('0x43')]=_0x7f76ff;_0x52c9d9[_0xb8b6('0x44')]=Date[_0xb8b6('0x45')]()+0x36ee80;return _0x52c9d9[_0xb8b6('0x46')]();})[_0xb8b6('0xf')](function(){return sendServiceMail({'to':_0x58a0d9['body'][_0xb8b6('0x24')],'subject':_0xb8b6('0x47'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0xb8b6('0x48')+'https://'+_0x58a0d9['headers'][_0xb8b6('0x29')]+_0xb8b6('0x49')+_0x7f76ff+'\x0a\x0a'+_0xb8b6('0x4a')});})[_0xb8b6('0xf')](function(){_0x2ea90e['status'](0xc8)['send']({'message':'Reset\x20Email\x20sent!'});})[_0xb8b6('0x21')](function(_0x22cc7f){return handleError(_0x2ea90e,0x1f4,_0x22cc7f);});};exports['reset']=function(_0x5da0d9,_0xa51814,_0x2d4ff1){return db[_0xb8b6('0x40')][_0xb8b6('0x23')]({'where':{'resetPasswordToken':_0x5da0d9[_0xb8b6('0x4b')]['token'],'resetPasswordExpires':{'$gt':Date['now']()}}})['then'](function(_0x2c05c3){if(!_0x2c05c3){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0xb8b6('0xb')]['findOne']({'attributes':['id','securePassword','enforcePasswordHistory',_0xb8b6('0x4c')]})[_0xb8b6('0xf')](function(_0x52939d){if(_0x52939d[_0xb8b6('0x4d')])authService[_0xb8b6('0x4e')](_0x5da0d9[_0xb8b6('0x3e')][_0xb8b6('0x10')]);if(!_0x52939d['enforcePasswordHistory']||!_0x2c05c3[_0xb8b6('0x4f')])return _0x2c05c3;authService['validatePasswordHistory'](_0x5da0d9[_0xb8b6('0x3e')][_0xb8b6('0x10')],_0x2c05c3[_0xb8b6('0x4f')],_0x52939d['passwordHistoryLimit']);return _0x2c05c3;})[_0xb8b6('0xf')](function(){_0x2c05c3[_0xb8b6('0x10')]=_0x5da0d9[_0xb8b6('0x3e')][_0xb8b6('0x10')];_0x2c05c3[_0xb8b6('0x43')]=null;_0x2c05c3[_0xb8b6('0x44')]=null;return _0x2c05c3[_0xb8b6('0x46')]();});})[_0xb8b6('0xf')](function(){_0xa51814[_0xb8b6('0x37')](0xc8)[_0xb8b6('0x38')]({'message':_0xb8b6('0x50')});})[_0xb8b6('0x21')](function(_0x4e7731){return handleError(_0xa51814,0x1f4,_0x4e7731);});};passport[_0xb8b6('0x51')](new LocalStrategy({'usernameField':_0xb8b6('0x1a'),'passwordField':_0xb8b6('0x10')},function(_0xc4d60a,_0x225faa,_0x49c09b){return localAuthenticate(db['User'],_0xc4d60a,_0x225faa,_0x49c09b);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index b145197..b08e337 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 _0x8a1a=['login','forgot','./authLocal.controller','post'];(function(_0x155116,_0x27df78){var _0x403b73=function(_0x2eb7b4){while(--_0x2eb7b4){_0x155116['push'](_0x155116['shift']());}};_0x403b73(++_0x27df78);}(_0x8a1a,0x96));var _0xa8a1=function(_0x1168a1,_0xa0d8c9){_0x1168a1=_0x1168a1-0x0;var _0xcc5ad8=_0x8a1a[_0x1168a1];return _0xcc5ad8;};'use strict';var express=require('express');var router=express['Router']();var controller=require(_0xa8a1('0x0'));router[_0xa8a1('0x1')]('/',controller[_0xa8a1('0x2')]);router[_0xa8a1('0x1')]('/forgot',controller[_0xa8a1('0x3')]);router[_0xa8a1('0x1')]('/reset/:token',controller['reset']);module['exports']=router; \ No newline at end of file +var _0x6d04=['exports','express','./authLocal.controller','post','login','/reset/:token','reset'];(function(_0x42f941,_0x133f4a){var _0x90a769=function(_0xfaf3d){while(--_0xfaf3d){_0x42f941['push'](_0x42f941['shift']());}};_0x90a769(++_0x133f4a);}(_0x6d04,0x127));var _0x46d0=function(_0x20eb01,_0x59ae21){_0x20eb01=_0x20eb01-0x0;var _0x5c5e37=_0x6d04[_0x20eb01];return _0x5c5e37;};'use strict';var express=require(_0x46d0('0x0'));var router=express['Router']();var controller=require(_0x46d0('0x1'));router[_0x46d0('0x2')]('/',controller[_0x46d0('0x3')]);router[_0x46d0('0x2')]('/forgot',controller['forgot']);router['post'](_0x46d0('0x4'),controller[_0x46d0('0x5')]);module[_0x46d0('0x6')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index adfbbde..aee3b41 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 _0x84b8=['BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0x267556,_0x293028){var _0x1ec0b1=function(_0xf02080){while(--_0xf02080){_0x267556['push'](_0x267556['shift']());}};_0x1ec0b1(++_0x293028);}(_0x84b8,0x174));var _0x884b=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0x84b8[_0x5e36d1];return _0x950b9e;};'use strict';var Sequelize=require(_0x884b('0x0'));module[_0x884b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x884b('0x2')]},'status':{'type':Sequelize[_0x884b('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x884b('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x1ea2=['exports','STRING','INTEGER','sequelize'];(function(_0x299316,_0x13e283){var _0x35698=function(_0x5d2172){while(--_0x5d2172){_0x299316['push'](_0x299316['shift']());}};_0x35698(++_0x13e283);}(_0x1ea2,0x113));var _0x21ea=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0x1ea2[_0x3305de];return _0x3b5a84;};'use strict';var Sequelize=require(_0x21ea('0x0'));module[_0x21ea('0x1')]={'name':{'type':Sequelize[_0x21ea('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x21ea('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x21ea('0x3')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 3273ced..87da2f4 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 _0x7ca7=['findOne','Condition','order','pick','getConditions','Action','addActions','getActions','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','Automation','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','fields','length','options','find','body','addConditions','ids','omit'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7ca7,0x164));var _0x77ca=function(_0x238671,_0x34aea0){_0x238671=_0x238671-0x0;var _0x474844=_0x7ca7[_0x238671];return _0x474844;};'use strict';var emlformat=require(_0x77ca('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x77ca('0x1'));var rp=require(_0x77ca('0x2'));var moment=require(_0x77ca('0x3'));var BPromise=require(_0x77ca('0x4'));var Mustache=require('mustache');var util=require(_0x77ca('0x5'));var path=require(_0x77ca('0x6'));var sox=require(_0x77ca('0x7'));var csv=require('to-csv');var ejs=require(_0x77ca('0x8'));var fs=require('fs');var fs_extra=require(_0x77ca('0x9'));var _=require(_0x77ca('0xa'));var squel=require(_0x77ca('0xb'));var crypto=require('crypto');var jsforce=require(_0x77ca('0xc'));var deskjs=require(_0x77ca('0xd'));var toCsv=require(_0x77ca('0xe'));var querystring=require('querystring');var Papa=require(_0x77ca('0xf'));var Redis=require(_0x77ca('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x77ca('0x11'));var as=require(_0x77ca('0x12'));var hardwareService=require(_0x77ca('0x13'));var logger=require(_0x77ca('0x14'))(_0x77ca('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x77ca('0x16'));var db=require(_0x77ca('0x17'))['db'];function respondWithStatusCode(_0x27d5f9,_0xdb00b5){_0xdb00b5=_0xdb00b5||0xcc;return function(_0x30dc9c){if(_0x30dc9c){return _0x27d5f9[_0x77ca('0x18')](_0xdb00b5);}return _0x27d5f9[_0x77ca('0x19')](_0xdb00b5)[_0x77ca('0x1a')]();};}function respondWithResult(_0xacb434,_0x1e2600){_0x1e2600=_0x1e2600||0xc8;return function(_0x5f1ccb){if(_0x5f1ccb){return _0xacb434['status'](_0x1e2600)[_0x77ca('0x1b')](_0x5f1ccb);}};}function respondWithFilteredResult(_0x5313fe,_0x52614a){return function(_0x119b53){if(_0x119b53){var _0x68daf8=typeof _0x52614a['offset']==='undefined'&&typeof _0x52614a[_0x77ca('0x1c')]===_0x77ca('0x1d');var _0x1c4faf=_0x119b53[_0x77ca('0x1e')];var _0x2e4a87=_0x68daf8?0x0:_0x52614a['offset'];var _0x56905b=_0x68daf8?_0x119b53['count']:_0x52614a[_0x77ca('0x1f')]+_0x52614a[_0x77ca('0x1c')];var _0x41e27b;if(_0x56905b>=_0x1c4faf){_0x56905b=_0x1c4faf;_0x41e27b=0xc8;}else{_0x41e27b=0xce;}_0x5313fe[_0x77ca('0x19')](_0x41e27b);return _0x5313fe[_0x77ca('0x20')](_0x77ca('0x21'),_0x2e4a87+'-'+_0x56905b+'/'+_0x1c4faf)[_0x77ca('0x1b')](_0x119b53);}return null;};}function patchUpdates(_0x4d8655){return function(_0x34ab02){try{jsonpatch[_0x77ca('0x22')](_0x34ab02,_0x4d8655,!![]);}catch(_0x4af6dc){return BPromise[_0x77ca('0x23')](_0x4af6dc);}return _0x34ab02[_0x77ca('0x24')]();};}function saveUpdates(_0xe9d25f,_0x59be2e){return function(_0x42ed21){if(_0x42ed21){return _0x42ed21[_0x77ca('0x25')](_0xe9d25f)['then'](function(_0x1a8e36){return _0x1a8e36;});}return null;};}function removeEntity(_0x10dba5,_0x592483){return function(_0x4b01ea){if(_0x4b01ea){return _0x4b01ea[_0x77ca('0x26')]()[_0x77ca('0x27')](function(){_0x10dba5[_0x77ca('0x19')](0xcc)[_0x77ca('0x1a')]();});}};}function handleEntityNotFound(_0x271b12,_0x571db9){return function(_0x5e5c12){if(!_0x5e5c12){_0x271b12['sendStatus'](0x194);}return _0x5e5c12;};}function handleError(_0x17188f,_0x3bfb29){_0x3bfb29=_0x3bfb29||0x1f4;return function(_0x5a7d44){logger[_0x77ca('0x28')](_0x5a7d44[_0x77ca('0x29')]);if(_0x5a7d44[_0x77ca('0x2a')]){delete _0x5a7d44[_0x77ca('0x2a')];}_0x17188f[_0x77ca('0x19')](_0x3bfb29)[_0x77ca('0x2b')](_0x5a7d44);};}exports[_0x77ca('0x2c')]=function(_0x2f67cc,_0x82a6cd){var _0x358086={},_0xb868a8={},_0x4ac1a2={'count':0x0,'rows':[]};var _0xbfc35a=_[_0x77ca('0x2d')](db[_0x77ca('0x2e')][_0x77ca('0x2f')],function(_0x2c9f69){return{'name':_0x2c9f69[_0x77ca('0x30')],'type':_0x2c9f69[_0x77ca('0x31')][_0x77ca('0x32')]};});_0xb868a8[_0x77ca('0x33')]=_[_0x77ca('0x2d')](_0xbfc35a,_0x77ca('0x2a'));_0xb868a8[_0x77ca('0x34')]=_['keys'](_0x2f67cc['query']);_0xb868a8[_0x77ca('0x35')]=_[_0x77ca('0x36')](_0xb868a8[_0x77ca('0x33')],_0xb868a8[_0x77ca('0x34')]);_0x358086[_0x77ca('0x37')]=_[_0x77ca('0x36')](_0xb868a8[_0x77ca('0x33')],qs['fields'](_0x2f67cc['query']['fields']));_0x358086[_0x77ca('0x37')]=_0x358086[_0x77ca('0x37')]['length']?_0x358086[_0x77ca('0x37')]:_0xb868a8[_0x77ca('0x33')];if(!_0x2f67cc['query'][_0x77ca('0x38')](_0x77ca('0x39'))){_0x358086['limit']=qs[_0x77ca('0x1c')](_0x2f67cc[_0x77ca('0x34')][_0x77ca('0x1c')]);_0x358086[_0x77ca('0x1f')]=qs[_0x77ca('0x1f')](_0x2f67cc[_0x77ca('0x34')][_0x77ca('0x1f')]);}_0x358086['order']=qs[_0x77ca('0x3a')](_0x2f67cc['query'][_0x77ca('0x3a')]);_0x358086[_0x77ca('0x3b')]=qs[_0x77ca('0x35')](_['pick'](_0x2f67cc[_0x77ca('0x34')],_0xb868a8['filters']),_0xbfc35a);if(_0x2f67cc['query'][_0x77ca('0x3c')]){_0x358086[_0x77ca('0x3b')]=_[_0x77ca('0x3d')](_0x358086['where'],{'$or':_[_0x77ca('0x2d')](_0xbfc35a,function(_0x12a9ef){if(_0x12a9ef['type']!==_0x77ca('0x3e')){var _0x30af40={};_0x30af40[_0x12a9ef[_0x77ca('0x2a')]]={'$like':'%'+_0x2f67cc['query']['filter']+'%'};return _0x30af40;}})});}_0x358086=_[_0x77ca('0x3d')]({},_0x358086,_0x2f67cc['options']);var _0x4c3cec={'where':_0x358086[_0x77ca('0x3b')]};return db['Automation'][_0x77ca('0x1e')](_0x4c3cec)['then'](function(_0x2d5e53){_0x4ac1a2[_0x77ca('0x1e')]=_0x2d5e53;if(_0x2f67cc[_0x77ca('0x34')][_0x77ca('0x3f')]){_0x358086[_0x77ca('0x40')]=[{'all':!![]}];}return db[_0x77ca('0x2e')][_0x77ca('0x41')](_0x358086);})[_0x77ca('0x27')](function(_0x5b04bd){_0x4ac1a2[_0x77ca('0x42')]=_0x5b04bd;return _0x4ac1a2;})[_0x77ca('0x27')](respondWithFilteredResult(_0x82a6cd,_0x358086))[_0x77ca('0x43')](handleError(_0x82a6cd,null));};exports[_0x77ca('0x44')]=function(_0x13c9fc,_0x2f62cc){var _0x27d739={'raw':![],'where':{'id':_0x13c9fc[_0x77ca('0x45')]['id']}},_0x18366b={};_0x18366b[_0x77ca('0x33')]=_['keys'](db['Automation'][_0x77ca('0x2f')]);_0x18366b[_0x77ca('0x34')]=_[_0x77ca('0x46')](_0x13c9fc['query']);_0x18366b['filters']=_[_0x77ca('0x36')](_0x18366b[_0x77ca('0x33')],_0x18366b[_0x77ca('0x34')]);_0x27d739['attributes']=_[_0x77ca('0x36')](_0x18366b[_0x77ca('0x33')],qs[_0x77ca('0x47')](_0x13c9fc[_0x77ca('0x34')][_0x77ca('0x47')]));_0x27d739[_0x77ca('0x37')]=_0x27d739[_0x77ca('0x37')][_0x77ca('0x48')]?_0x27d739[_0x77ca('0x37')]:_0x18366b[_0x77ca('0x33')];if(_0x13c9fc['query']['includeAll']){_0x27d739['include']=[{'all':!![]}];}_0x27d739=_[_0x77ca('0x3d')]({},_0x27d739,_0x13c9fc[_0x77ca('0x49')]);return db[_0x77ca('0x2e')][_0x77ca('0x4a')](_0x27d739)[_0x77ca('0x27')](handleEntityNotFound(_0x2f62cc,null))['then'](respondWithResult(_0x2f62cc,null))['catch'](handleError(_0x2f62cc,null));};exports['create']=function(_0x25e635,_0x9e8bcf){return db['Automation']['create'](_0x25e635['body'],{})['then'](respondWithResult(_0x9e8bcf,0xc9))[_0x77ca('0x43')](handleError(_0x9e8bcf,null));};exports['update']=function(_0x3f0279,_0x54a55c){if(_0x3f0279[_0x77ca('0x4b')]['id']){delete _0x3f0279['body']['id'];}return db[_0x77ca('0x2e')]['find']({'where':{'id':_0x3f0279[_0x77ca('0x45')]['id']}})[_0x77ca('0x27')](handleEntityNotFound(_0x54a55c,null))[_0x77ca('0x27')](saveUpdates(_0x3f0279['body'],null))[_0x77ca('0x27')](respondWithResult(_0x54a55c,null))[_0x77ca('0x43')](handleError(_0x54a55c,null));};exports[_0x77ca('0x26')]=function(_0x4bd644,_0x3901a4){return db['Automation'][_0x77ca('0x4a')]({'where':{'id':_0x4bd644[_0x77ca('0x45')]['id']}})[_0x77ca('0x27')](handleEntityNotFound(_0x3901a4,null))[_0x77ca('0x27')](removeEntity(_0x3901a4,null))[_0x77ca('0x43')](handleError(_0x3901a4,null));};exports[_0x77ca('0x4c')]=function(_0x4fec2c,_0x118fea,_0x515d27){return db['Condition'][_0x77ca('0x4a')]({'where':{'id':_0x4fec2c[_0x77ca('0x45')]['id']}})[_0x77ca('0x27')](handleEntityNotFound(_0x118fea,null))[_0x77ca('0x27')](function(_0x5b0e75){if(_0x5b0e75){return _0x5b0e75[_0x77ca('0x4c')](_0x4fec2c['body'][_0x77ca('0x4d')],_[_0x77ca('0x4e')](_0x4fec2c[_0x77ca('0x4b')],[_0x77ca('0x4d'),'id'])||{});}})[_0x77ca('0x27')](respondWithResult(_0x118fea,null))[_0x77ca('0x43')](handleError(_0x118fea,null));};exports['getConditions']=function(_0x3caf44,_0x2eb218,_0x1da7c6){var _0x26212f={};var _0x4a0fdf={};var _0x40f590;var _0x24d8c8;return db[_0x77ca('0x2e')][_0x77ca('0x4f')]({'where':{'id':_0x3caf44[_0x77ca('0x45')]['id']}})['then'](handleEntityNotFound(_0x2eb218,null))['then'](function(_0x19601e){if(_0x19601e){_0x40f590=_0x19601e;_0x4a0fdf[_0x77ca('0x33')]=_['keys'](db[_0x77ca('0x50')][_0x77ca('0x2f')]);_0x4a0fdf[_0x77ca('0x34')]=_[_0x77ca('0x46')](_0x3caf44[_0x77ca('0x34')]);_0x4a0fdf[_0x77ca('0x35')]=_[_0x77ca('0x36')](_0x4a0fdf[_0x77ca('0x33')],_0x4a0fdf['query']);_0x26212f['attributes']=_['intersection'](_0x4a0fdf['model'],qs[_0x77ca('0x47')](_0x3caf44[_0x77ca('0x34')][_0x77ca('0x47')]));_0x26212f[_0x77ca('0x37')]=_0x26212f[_0x77ca('0x37')][_0x77ca('0x48')]?_0x26212f['attributes']:_0x4a0fdf['model'];_0x26212f[_0x77ca('0x51')]=qs[_0x77ca('0x3a')](_0x3caf44[_0x77ca('0x34')][_0x77ca('0x3a')]);_0x26212f[_0x77ca('0x3b')]=qs[_0x77ca('0x35')](_[_0x77ca('0x52')](_0x3caf44[_0x77ca('0x34')],_0x4a0fdf['filters']));if(_0x3caf44[_0x77ca('0x34')][_0x77ca('0x3c')]){_0x26212f['where']=_['merge'](_0x26212f['where'],{'$or':_['map'](_0x26212f['attributes'],function(_0xaa62f4){var _0x5734d1={};_0x5734d1[_0xaa62f4]={'$like':'%'+_0x3caf44[_0x77ca('0x34')]['filter']+'%'};return _0x5734d1;})});}_0x26212f=_[_0x77ca('0x3d')]({},_0x26212f,_0x3caf44['options']);return _0x40f590[_0x77ca('0x53')](_0x26212f);}})[_0x77ca('0x27')](function(_0x50030f){if(_0x50030f){_0x24d8c8=_0x50030f[_0x77ca('0x48')];if(!_0x3caf44[_0x77ca('0x34')][_0x77ca('0x38')]('nolimit')){_0x26212f[_0x77ca('0x1c')]=qs[_0x77ca('0x1c')](_0x3caf44[_0x77ca('0x34')][_0x77ca('0x1c')]);_0x26212f['offset']=qs[_0x77ca('0x1f')](_0x3caf44[_0x77ca('0x34')][_0x77ca('0x1f')]);}return _0x40f590[_0x77ca('0x53')](_0x26212f);}})[_0x77ca('0x27')](function(_0x24602c){if(_0x24602c){return _0x24602c?{'count':_0x24d8c8,'rows':_0x24602c}:null;}})[_0x77ca('0x27')](respondWithResult(_0x2eb218,null))['catch'](handleError(_0x2eb218,null));};exports['addActions']=function(_0x4213fe,_0x28bcfe,_0x73d048){return db[_0x77ca('0x54')][_0x77ca('0x4a')]({'where':{'id':_0x4213fe[_0x77ca('0x45')]['id']}})[_0x77ca('0x27')](handleEntityNotFound(_0x28bcfe,null))[_0x77ca('0x27')](function(_0x3f2724){if(_0x3f2724){return _0x3f2724[_0x77ca('0x55')](_0x4213fe['body'][_0x77ca('0x4d')],_[_0x77ca('0x4e')](_0x4213fe[_0x77ca('0x4b')],[_0x77ca('0x4d'),'id'])||{});}})[_0x77ca('0x27')](respondWithResult(_0x28bcfe,null))[_0x77ca('0x43')](handleError(_0x28bcfe,null));};exports['getActions']=function(_0x395457,_0x2a4ba4,_0x2f5489){var _0x1f73ea={};var _0x5e0505={};var _0x3bf12a;var _0x47c23c;return db[_0x77ca('0x2e')]['findOne']({'where':{'id':_0x395457[_0x77ca('0x45')]['id']}})[_0x77ca('0x27')](handleEntityNotFound(_0x2a4ba4,null))[_0x77ca('0x27')](function(_0x6ec020){if(_0x6ec020){_0x3bf12a=_0x6ec020;_0x5e0505[_0x77ca('0x33')]=_[_0x77ca('0x46')](db['Action'][_0x77ca('0x2f')]);_0x5e0505[_0x77ca('0x34')]=_[_0x77ca('0x46')](_0x395457[_0x77ca('0x34')]);_0x5e0505['filters']=_['intersection'](_0x5e0505[_0x77ca('0x33')],_0x5e0505[_0x77ca('0x34')]);_0x1f73ea['attributes']=_[_0x77ca('0x36')](_0x5e0505['model'],qs[_0x77ca('0x47')](_0x395457[_0x77ca('0x34')][_0x77ca('0x47')]));_0x1f73ea['attributes']=_0x1f73ea[_0x77ca('0x37')]['length']?_0x1f73ea[_0x77ca('0x37')]:_0x5e0505[_0x77ca('0x33')];_0x1f73ea[_0x77ca('0x51')]=qs['sort'](_0x395457[_0x77ca('0x34')][_0x77ca('0x3a')]);_0x1f73ea['where']=qs[_0x77ca('0x35')](_['pick'](_0x395457['query'],_0x5e0505[_0x77ca('0x35')]));if(_0x395457[_0x77ca('0x34')][_0x77ca('0x3c')]){_0x1f73ea[_0x77ca('0x3b')]=_['merge'](_0x1f73ea[_0x77ca('0x3b')],{'$or':_[_0x77ca('0x2d')](_0x1f73ea[_0x77ca('0x37')],function(_0x26db94){var _0x4b8e5f={};_0x4b8e5f[_0x26db94]={'$like':'%'+_0x395457[_0x77ca('0x34')][_0x77ca('0x3c')]+'%'};return _0x4b8e5f;})});}_0x1f73ea=_[_0x77ca('0x3d')]({},_0x1f73ea,_0x395457['options']);return _0x3bf12a['getActions'](_0x1f73ea);}})['then'](function(_0x58d232){if(_0x58d232){_0x47c23c=_0x58d232[_0x77ca('0x48')];if(!_0x395457['query']['hasOwnProperty'](_0x77ca('0x39'))){_0x1f73ea[_0x77ca('0x1c')]=qs['limit'](_0x395457[_0x77ca('0x34')][_0x77ca('0x1c')]);_0x1f73ea[_0x77ca('0x1f')]=qs['offset'](_0x395457[_0x77ca('0x34')][_0x77ca('0x1f')]);}return _0x3bf12a[_0x77ca('0x56')](_0x1f73ea);}})['then'](function(_0x4e5907){if(_0x4e5907){return _0x4e5907?{'count':_0x47c23c,'rows':_0x4e5907}:null;}})[_0x77ca('0x27')](respondWithResult(_0x2a4ba4,null))[_0x77ca('0x43')](handleError(_0x2a4ba4,null));}; \ No newline at end of file +var _0xe833=['../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','Automation','type','key','model','query','intersection','attributes','fields','length','nolimit','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','keys','include','find','catch','body','addConditions','ids','omit','findOne','Condition','rawAttributes','order','sort','getConditions','hasOwnProperty','Action','getActions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xe833,0x182));var _0x3e83=function(_0x34311c,_0x52a317){_0x34311c=_0x34311c-0x0;var _0x4b8b35=_0xe833[_0x34311c];return _0x4b8b35;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e83('0x0'));var zipdir=require(_0x3e83('0x1'));var jsonpatch=require(_0x3e83('0x2'));var rp=require(_0x3e83('0x3'));var moment=require(_0x3e83('0x4'));var BPromise=require(_0x3e83('0x5'));var Mustache=require(_0x3e83('0x6'));var util=require(_0x3e83('0x7'));var path=require('path');var sox=require(_0x3e83('0x8'));var csv=require(_0x3e83('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e83('0xa'));var _=require(_0x3e83('0xb'));var squel=require('squel');var crypto=require(_0x3e83('0xc'));var jsforce=require(_0x3e83('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3e83('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3e83('0xe'));var qs=require(_0x3e83('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3e83('0x10'));var logger=require(_0x3e83('0x11'))(_0x3e83('0x12'));var utils=require(_0x3e83('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x3e83('0x14'));var db=require(_0x3e83('0x15'))['db'];function respondWithStatusCode(_0x1e3aa7,_0x5b7acf){_0x5b7acf=_0x5b7acf||0xcc;return function(_0x265f68){if(_0x265f68){return _0x1e3aa7['sendStatus'](_0x5b7acf);}return _0x1e3aa7['status'](_0x5b7acf)[_0x3e83('0x16')]();};}function respondWithResult(_0x3a04f1,_0x21c2c7){_0x21c2c7=_0x21c2c7||0xc8;return function(_0x5481f7){if(_0x5481f7){return _0x3a04f1[_0x3e83('0x17')](_0x21c2c7)[_0x3e83('0x18')](_0x5481f7);}};}function respondWithFilteredResult(_0x48e4e2,_0x1da5dc){return function(_0x15acd4){if(_0x15acd4){var _0x5f3c86=typeof _0x1da5dc[_0x3e83('0x19')]===_0x3e83('0x1a')&&typeof _0x1da5dc[_0x3e83('0x1b')]===_0x3e83('0x1a');var _0x177661=_0x15acd4[_0x3e83('0x1c')];var _0x1029c8=_0x5f3c86?0x0:_0x1da5dc[_0x3e83('0x19')];var _0xa44b85=_0x5f3c86?_0x15acd4[_0x3e83('0x1c')]:_0x1da5dc[_0x3e83('0x19')]+_0x1da5dc[_0x3e83('0x1b')];var _0x13cf27;if(_0xa44b85>=_0x177661){_0xa44b85=_0x177661;_0x13cf27=0xc8;}else{_0x13cf27=0xce;}_0x48e4e2[_0x3e83('0x17')](_0x13cf27);return _0x48e4e2[_0x3e83('0x1d')](_0x3e83('0x1e'),_0x1029c8+'-'+_0xa44b85+'/'+_0x177661)[_0x3e83('0x18')](_0x15acd4);}return null;};}function patchUpdates(_0x17f81f){return function(_0x53faa5){try{jsonpatch[_0x3e83('0x1f')](_0x53faa5,_0x17f81f,!![]);}catch(_0x2e19b1){return BPromise[_0x3e83('0x20')](_0x2e19b1);}return _0x53faa5[_0x3e83('0x21')]();};}function saveUpdates(_0x2de4b3,_0x273603){return function(_0x2441a6){if(_0x2441a6){return _0x2441a6[_0x3e83('0x22')](_0x2de4b3)[_0x3e83('0x23')](function(_0x1fc69e){return _0x1fc69e;});}return null;};}function removeEntity(_0x551b14,_0x205e4d){return function(_0x247c29){if(_0x247c29){return _0x247c29[_0x3e83('0x24')]()['then'](function(){_0x551b14[_0x3e83('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f19a6,_0x560931){return function(_0x60534c){if(!_0x60534c){_0x3f19a6['sendStatus'](0x194);}return _0x60534c;};}function handleError(_0x275658,_0x4a6974){_0x4a6974=_0x4a6974||0x1f4;return function(_0x4cb034){logger['error'](_0x4cb034[_0x3e83('0x25')]);if(_0x4cb034[_0x3e83('0x26')]){delete _0x4cb034[_0x3e83('0x26')];}_0x275658[_0x3e83('0x17')](_0x4a6974)[_0x3e83('0x27')](_0x4cb034);};}exports[_0x3e83('0x28')]=function(_0x36956a,_0x1abb27){var _0x1d09cd={},_0x5e0fce={},_0x2e745d={'count':0x0,'rows':[]};var _0x480a38=_[_0x3e83('0x29')](db[_0x3e83('0x2a')]['rawAttributes'],function(_0x23bfb0){return{'name':_0x23bfb0['fieldName'],'type':_0x23bfb0[_0x3e83('0x2b')][_0x3e83('0x2c')]};});_0x5e0fce[_0x3e83('0x2d')]=_[_0x3e83('0x29')](_0x480a38,'name');_0x5e0fce[_0x3e83('0x2e')]=_['keys'](_0x36956a[_0x3e83('0x2e')]);_0x5e0fce['filters']=_[_0x3e83('0x2f')](_0x5e0fce[_0x3e83('0x2d')],_0x5e0fce[_0x3e83('0x2e')]);_0x1d09cd[_0x3e83('0x30')]=_['intersection'](_0x5e0fce['model'],qs[_0x3e83('0x31')](_0x36956a[_0x3e83('0x2e')]['fields']));_0x1d09cd[_0x3e83('0x30')]=_0x1d09cd[_0x3e83('0x30')][_0x3e83('0x32')]?_0x1d09cd[_0x3e83('0x30')]:_0x5e0fce[_0x3e83('0x2d')];if(!_0x36956a[_0x3e83('0x2e')]['hasOwnProperty'](_0x3e83('0x33'))){_0x1d09cd['limit']=qs[_0x3e83('0x1b')](_0x36956a[_0x3e83('0x2e')][_0x3e83('0x1b')]);_0x1d09cd[_0x3e83('0x19')]=qs[_0x3e83('0x19')](_0x36956a[_0x3e83('0x2e')][_0x3e83('0x19')]);}_0x1d09cd['order']=qs['sort'](_0x36956a[_0x3e83('0x2e')]['sort']);_0x1d09cd[_0x3e83('0x34')]=qs['filters'](_[_0x3e83('0x35')](_0x36956a[_0x3e83('0x2e')],_0x5e0fce[_0x3e83('0x36')]),_0x480a38);if(_0x36956a[_0x3e83('0x2e')][_0x3e83('0x37')]){_0x1d09cd['where']=_['merge'](_0x1d09cd[_0x3e83('0x34')],{'$or':_['map'](_0x480a38,function(_0x516cc9){if(_0x516cc9['type']!==_0x3e83('0x38')){var _0x15abed={};_0x15abed[_0x516cc9['name']]={'$like':'%'+_0x36956a[_0x3e83('0x2e')][_0x3e83('0x37')]+'%'};return _0x15abed;}})});}_0x1d09cd=_[_0x3e83('0x39')]({},_0x1d09cd,_0x36956a[_0x3e83('0x3a')]);var _0x5bd1bc={'where':_0x1d09cd['where']};return db[_0x3e83('0x2a')][_0x3e83('0x1c')](_0x5bd1bc)[_0x3e83('0x23')](function(_0x333cf9){_0x2e745d['count']=_0x333cf9;if(_0x36956a[_0x3e83('0x2e')][_0x3e83('0x3b')]){_0x1d09cd['include']=[{'all':!![]}];}return db[_0x3e83('0x2a')][_0x3e83('0x3c')](_0x1d09cd);})['then'](function(_0xbc27c4){_0x2e745d[_0x3e83('0x3d')]=_0xbc27c4;return _0x2e745d;})[_0x3e83('0x23')](respondWithFilteredResult(_0x1abb27,_0x1d09cd))['catch'](handleError(_0x1abb27,null));};exports[_0x3e83('0x3e')]=function(_0x1ce6ec,_0x26f0b7){var _0x427c73={'raw':![],'where':{'id':_0x1ce6ec[_0x3e83('0x3f')]['id']}},_0xac2026={};_0xac2026[_0x3e83('0x2d')]=_[_0x3e83('0x40')](db[_0x3e83('0x2a')]['rawAttributes']);_0xac2026[_0x3e83('0x2e')]=_[_0x3e83('0x40')](_0x1ce6ec[_0x3e83('0x2e')]);_0xac2026[_0x3e83('0x36')]=_[_0x3e83('0x2f')](_0xac2026[_0x3e83('0x2d')],_0xac2026[_0x3e83('0x2e')]);_0x427c73[_0x3e83('0x30')]=_[_0x3e83('0x2f')](_0xac2026[_0x3e83('0x2d')],qs[_0x3e83('0x31')](_0x1ce6ec[_0x3e83('0x2e')]['fields']));_0x427c73[_0x3e83('0x30')]=_0x427c73[_0x3e83('0x30')][_0x3e83('0x32')]?_0x427c73[_0x3e83('0x30')]:_0xac2026[_0x3e83('0x2d')];if(_0x1ce6ec[_0x3e83('0x2e')][_0x3e83('0x3b')]){_0x427c73[_0x3e83('0x41')]=[{'all':!![]}];}_0x427c73=_['merge']({},_0x427c73,_0x1ce6ec['options']);return db[_0x3e83('0x2a')][_0x3e83('0x42')](_0x427c73)[_0x3e83('0x23')](handleEntityNotFound(_0x26f0b7,null))[_0x3e83('0x23')](respondWithResult(_0x26f0b7,null))[_0x3e83('0x43')](handleError(_0x26f0b7,null));};exports['create']=function(_0x8ccb5b,_0x1e2e15){return db[_0x3e83('0x2a')]['create'](_0x8ccb5b[_0x3e83('0x44')],{})[_0x3e83('0x23')](respondWithResult(_0x1e2e15,0xc9))[_0x3e83('0x43')](handleError(_0x1e2e15,null));};exports[_0x3e83('0x22')]=function(_0x42c095,_0x2df3f3){if(_0x42c095[_0x3e83('0x44')]['id']){delete _0x42c095[_0x3e83('0x44')]['id'];}return db[_0x3e83('0x2a')][_0x3e83('0x42')]({'where':{'id':_0x42c095[_0x3e83('0x3f')]['id']}})[_0x3e83('0x23')](handleEntityNotFound(_0x2df3f3,null))[_0x3e83('0x23')](saveUpdates(_0x42c095[_0x3e83('0x44')],null))[_0x3e83('0x23')](respondWithResult(_0x2df3f3,null))[_0x3e83('0x43')](handleError(_0x2df3f3,null));};exports[_0x3e83('0x24')]=function(_0x423379,_0x467cf8){return db['Automation'][_0x3e83('0x42')]({'where':{'id':_0x423379['params']['id']}})[_0x3e83('0x23')](handleEntityNotFound(_0x467cf8,null))['then'](removeEntity(_0x467cf8,null))['catch'](handleError(_0x467cf8,null));};exports[_0x3e83('0x45')]=function(_0x5e8fde,_0x320cc6,_0x338667){return db['Condition'][_0x3e83('0x42')]({'where':{'id':_0x5e8fde[_0x3e83('0x3f')]['id']}})[_0x3e83('0x23')](handleEntityNotFound(_0x320cc6,null))['then'](function(_0xd474c7){if(_0xd474c7){return _0xd474c7[_0x3e83('0x45')](_0x5e8fde['body'][_0x3e83('0x46')],_[_0x3e83('0x47')](_0x5e8fde[_0x3e83('0x44')],['ids','id'])||{});}})[_0x3e83('0x23')](respondWithResult(_0x320cc6,null))[_0x3e83('0x43')](handleError(_0x320cc6,null));};exports['getConditions']=function(_0x527397,_0x348b5f,_0x3eef74){var _0xac78={};var _0x238fef={};var _0x209023;var _0x3d2b14;return db[_0x3e83('0x2a')][_0x3e83('0x48')]({'where':{'id':_0x527397[_0x3e83('0x3f')]['id']}})[_0x3e83('0x23')](handleEntityNotFound(_0x348b5f,null))['then'](function(_0x1281fe){if(_0x1281fe){_0x209023=_0x1281fe;_0x238fef[_0x3e83('0x2d')]=_[_0x3e83('0x40')](db[_0x3e83('0x49')][_0x3e83('0x4a')]);_0x238fef[_0x3e83('0x2e')]=_[_0x3e83('0x40')](_0x527397['query']);_0x238fef[_0x3e83('0x36')]=_[_0x3e83('0x2f')](_0x238fef[_0x3e83('0x2d')],_0x238fef['query']);_0xac78[_0x3e83('0x30')]=_[_0x3e83('0x2f')](_0x238fef[_0x3e83('0x2d')],qs['fields'](_0x527397[_0x3e83('0x2e')][_0x3e83('0x31')]));_0xac78['attributes']=_0xac78[_0x3e83('0x30')][_0x3e83('0x32')]?_0xac78[_0x3e83('0x30')]:_0x238fef[_0x3e83('0x2d')];_0xac78[_0x3e83('0x4b')]=qs['sort'](_0x527397[_0x3e83('0x2e')][_0x3e83('0x4c')]);_0xac78['where']=qs['filters'](_[_0x3e83('0x35')](_0x527397[_0x3e83('0x2e')],_0x238fef[_0x3e83('0x36')]));if(_0x527397['query'][_0x3e83('0x37')]){_0xac78[_0x3e83('0x34')]=_[_0x3e83('0x39')](_0xac78['where'],{'$or':_['map'](_0xac78[_0x3e83('0x30')],function(_0x3885e8){var _0xfcf80c={};_0xfcf80c[_0x3885e8]={'$like':'%'+_0x527397[_0x3e83('0x2e')][_0x3e83('0x37')]+'%'};return _0xfcf80c;})});}_0xac78=_[_0x3e83('0x39')]({},_0xac78,_0x527397[_0x3e83('0x3a')]);return _0x209023[_0x3e83('0x4d')](_0xac78);}})['then'](function(_0x2179c4){if(_0x2179c4){_0x3d2b14=_0x2179c4[_0x3e83('0x32')];if(!_0x527397[_0x3e83('0x2e')][_0x3e83('0x4e')](_0x3e83('0x33'))){_0xac78['limit']=qs[_0x3e83('0x1b')](_0x527397['query'][_0x3e83('0x1b')]);_0xac78[_0x3e83('0x19')]=qs[_0x3e83('0x19')](_0x527397[_0x3e83('0x2e')][_0x3e83('0x19')]);}return _0x209023[_0x3e83('0x4d')](_0xac78);}})[_0x3e83('0x23')](function(_0x3bb25d){if(_0x3bb25d){return _0x3bb25d?{'count':_0x3d2b14,'rows':_0x3bb25d}:null;}})[_0x3e83('0x23')](respondWithResult(_0x348b5f,null))['catch'](handleError(_0x348b5f,null));};exports['addActions']=function(_0x479014,_0x39def2,_0x2f97f3){return db[_0x3e83('0x4f')]['find']({'where':{'id':_0x479014[_0x3e83('0x3f')]['id']}})['then'](handleEntityNotFound(_0x39def2,null))[_0x3e83('0x23')](function(_0x284188){if(_0x284188){return _0x284188['addActions'](_0x479014[_0x3e83('0x44')][_0x3e83('0x46')],_['omit'](_0x479014['body'],['ids','id'])||{});}})[_0x3e83('0x23')](respondWithResult(_0x39def2,null))[_0x3e83('0x43')](handleError(_0x39def2,null));};exports[_0x3e83('0x50')]=function(_0x4a8156,_0x9739d5,_0x1b19be){var _0x5e8c03={};var _0xe3ab05={};var _0x22a243;var _0x3c0528;return db[_0x3e83('0x2a')][_0x3e83('0x48')]({'where':{'id':_0x4a8156[_0x3e83('0x3f')]['id']}})[_0x3e83('0x23')](handleEntityNotFound(_0x9739d5,null))[_0x3e83('0x23')](function(_0x101e1f){if(_0x101e1f){_0x22a243=_0x101e1f;_0xe3ab05[_0x3e83('0x2d')]=_['keys'](db['Action'][_0x3e83('0x4a')]);_0xe3ab05[_0x3e83('0x2e')]=_['keys'](_0x4a8156[_0x3e83('0x2e')]);_0xe3ab05[_0x3e83('0x36')]=_[_0x3e83('0x2f')](_0xe3ab05[_0x3e83('0x2d')],_0xe3ab05[_0x3e83('0x2e')]);_0x5e8c03[_0x3e83('0x30')]=_['intersection'](_0xe3ab05[_0x3e83('0x2d')],qs['fields'](_0x4a8156[_0x3e83('0x2e')][_0x3e83('0x31')]));_0x5e8c03[_0x3e83('0x30')]=_0x5e8c03[_0x3e83('0x30')]['length']?_0x5e8c03['attributes']:_0xe3ab05[_0x3e83('0x2d')];_0x5e8c03[_0x3e83('0x4b')]=qs[_0x3e83('0x4c')](_0x4a8156[_0x3e83('0x2e')][_0x3e83('0x4c')]);_0x5e8c03[_0x3e83('0x34')]=qs[_0x3e83('0x36')](_[_0x3e83('0x35')](_0x4a8156['query'],_0xe3ab05[_0x3e83('0x36')]));if(_0x4a8156['query'][_0x3e83('0x37')]){_0x5e8c03[_0x3e83('0x34')]=_[_0x3e83('0x39')](_0x5e8c03[_0x3e83('0x34')],{'$or':_[_0x3e83('0x29')](_0x5e8c03[_0x3e83('0x30')],function(_0x1e22a2){var _0x50b1f0={};_0x50b1f0[_0x1e22a2]={'$like':'%'+_0x4a8156[_0x3e83('0x2e')][_0x3e83('0x37')]+'%'};return _0x50b1f0;})});}_0x5e8c03=_[_0x3e83('0x39')]({},_0x5e8c03,_0x4a8156['options']);return _0x22a243[_0x3e83('0x50')](_0x5e8c03);}})[_0x3e83('0x23')](function(_0x27a7cd){if(_0x27a7cd){_0x3c0528=_0x27a7cd[_0x3e83('0x32')];if(!_0x4a8156[_0x3e83('0x2e')]['hasOwnProperty'](_0x3e83('0x33'))){_0x5e8c03[_0x3e83('0x1b')]=qs[_0x3e83('0x1b')](_0x4a8156[_0x3e83('0x2e')][_0x3e83('0x1b')]);_0x5e8c03[_0x3e83('0x19')]=qs[_0x3e83('0x19')](_0x4a8156[_0x3e83('0x2e')][_0x3e83('0x19')]);}return _0x22a243['getActions'](_0x5e8c03);}})[_0x3e83('0x23')](function(_0x558187){if(_0x558187){return _0x558187?{'count':_0x3c0528,'rows':_0x558187}:null;}})[_0x3e83('0x23')](respondWithResult(_0x9739d5,null))[_0x3e83('0x43')](handleError(_0x9739d5,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index c52220b..a0ad701 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 _0xb7a4=['define','Automation','lodash','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x1ed116,_0x23bc80){var _0x574066=function(_0x424f9e){while(--_0x424f9e){_0x1ed116['push'](_0x1ed116['shift']());}};_0x574066(++_0x23bc80);}(_0xb7a4,0xe2));var _0x4b7a=function(_0x258a9f,_0xdd62ce){_0x258a9f=_0x258a9f-0x0;var _0xd06cb8=_0xb7a4[_0x258a9f];return _0xd06cb8;};'use strict';var _=require(_0x4b7a('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x4b7a('0x1'));var BPromise=require(_0x4b7a('0x2'));var rp=require(_0x4b7a('0x3'));var fs=require('fs');var path=require(_0x4b7a('0x4'));var rimraf=require('rimraf');var config=require(_0x4b7a('0x5'));var attributes=require('./automation.attributes');module['exports']=function(_0x120f07,_0x144416){return _0x120f07[_0x4b7a('0x6')](_0x4b7a('0x7'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6523=['tools_automations','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes','exports','define'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6523,0x1bb));var _0x3652=function(_0xd46227,_0x18477f){_0xd46227=_0xd46227-0x0;var _0x2a980d=_0x6523[_0xd46227];return _0x2a980d;};'use strict';var _=require(_0x3652('0x0'));var util=require(_0x3652('0x1'));var logger=require(_0x3652('0x2'))('api');var moment=require(_0x3652('0x3'));var BPromise=require(_0x3652('0x4'));var rp=require(_0x3652('0x5'));var fs=require('fs');var path=require(_0x3652('0x6'));var rimraf=require(_0x3652('0x7'));var config=require(_0x3652('0x8'));var attributes=require(_0x3652('0x9'));module[_0x3652('0xa')]=function(_0x29fb1d,_0x2e4370){return _0x29fb1d[_0x3652('0xb')]('Automation',attributes,{'tableName':_0x3652('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index d3d443d..2fac7ec 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 _0xb79a=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash'];(function(_0x689cd7,_0x596cb1){var _0x1da31d=function(_0x132cac){while(--_0x132cac){_0x689cd7['push'](_0x689cd7['shift']());}};_0x1da31d(++_0x596cb1);}(_0xb79a,0x18e));var _0xab79=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xb79a[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xab79('0x0'));var util=require(_0xab79('0x1'));var moment=require('moment');var BPromise=require(_0xab79('0x2'));var rs=require(_0xab79('0x3'));var fs=require('fs');var Redis=require(_0xab79('0x4'));var db=require(_0xab79('0x5'))['db'];var utils=require(_0xab79('0x6'));var logger=require(_0xab79('0x7'))(_0xab79('0x8'));var config=require(_0xab79('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xab79('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe8ba5a,_0x10d402,_0x11ceb3){return new BPromise(function(_0x7eabd1,_0x4585fe){return client[_0xab79('0xb')](_0xe8ba5a,_0x11ceb3)[_0xab79('0xc')](function(_0x426cb9){logger[_0xab79('0xd')](_0xab79('0xe'),_0x10d402,_0xab79('0xf'));logger['debug']('Automation,\x20%s,\x20%s,\x20%s',_0x10d402,_0xab79('0xf'),JSON[_0xab79('0x10')](_0x426cb9));if(_0x426cb9[_0xab79('0x11')]){if(_0x426cb9[_0xab79('0x11')][_0xab79('0x12')]===0x1f4){logger[_0xab79('0x11')]('Automation,\x20%s,\x20%s',_0x10d402,_0x426cb9['error'][_0xab79('0x13')]);return _0x4585fe(_0x426cb9['error'][_0xab79('0x13')]);}logger[_0xab79('0x11')](_0xab79('0xe'),_0x10d402,_0x426cb9['error']['message']);return _0x7eabd1(_0x426cb9['error']['message']);}else{logger[_0xab79('0xd')](_0xab79('0xe'),_0x10d402,'request\x20sent');_0x7eabd1(_0x426cb9['result']['message']);}})[_0xab79('0x14')](function(_0xc9650d){logger['error'](_0xab79('0xe'),_0x10d402,_0xc9650d);_0x4585fe(_0xc9650d);});});} \ No newline at end of file +var _0x4fc2=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x270adf,_0x1daaa3){var _0x29eda9=function(_0x40afec){while(--_0x40afec){_0x270adf['push'](_0x270adf['shift']());}};_0x29eda9(++_0x1daaa3);}(_0x4fc2,0x111));var _0x24fc=function(_0x47de9a,_0x40cf23){_0x47de9a=_0x47de9a-0x0;var _0x4b9d6c=_0x4fc2[_0x47de9a];return _0x4b9d6c;};'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')]('Automation,\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')]('Automation,\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);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 5731bab..8221887 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 _0x833b=['get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions','addActions','put','update','delete','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller'];(function(_0x2fcf18,_0x10009a){var _0x4c68cc=function(_0x444002){while(--_0x444002){_0x2fcf18['push'](_0x2fcf18['shift']());}};_0x4c68cc(++_0x10009a);}(_0x833b,0x131));var _0xb833=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x833b[_0x5d6456];return _0x4d66c1;};'use strict';var multer=require('multer');var util=require(_0xb833('0x0'));var path=require('path');var timeout=require(_0xb833('0x1'));var express=require('express');var router=express[_0xb833('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xb833('0x3'));var interaction=require(_0xb833('0x4'));var config=require(_0xb833('0x5'));var controller=require(_0xb833('0x6'));router[_0xb833('0x7')]('/',auth[_0xb833('0x8')](),controller[_0xb833('0x9')]);router['get'](_0xb833('0xa'),auth[_0xb833('0x8')](),controller[_0xb833('0xb')]);router[_0xb833('0x7')](_0xb833('0xc'),auth[_0xb833('0x8')](),controller[_0xb833('0xd')]);router['get'](_0xb833('0xe'),auth['isAuthenticated'](),controller[_0xb833('0xf')]);router[_0xb833('0x10')]('/',auth[_0xb833('0x8')](),controller[_0xb833('0x11')]);router['post']('/:id/conditions',auth[_0xb833('0x8')](),controller[_0xb833('0x12')]);router['post'](_0xb833('0xe'),auth['isAuthenticated'](),controller[_0xb833('0x13')]);router[_0xb833('0x14')](_0xb833('0xa'),auth[_0xb833('0x8')](),controller[_0xb833('0x15')]);router[_0xb833('0x16')](_0xb833('0xa'),auth[_0xb833('0x8')](),controller['destroy']);module[_0xb833('0x17')]=router; \ No newline at end of file +var _0x4536=['../../config/environment','./automation.controller','isAuthenticated','index','/:id','get','/:id/conditions','getConditions','/:id/actions','getActions','post','addConditions','addActions','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4536,0xe9));var _0x6453=function(_0x3f8ca7,_0x1cfd75){_0x3f8ca7=_0x3f8ca7-0x0;var _0x2ef97e=_0x4536[_0x3f8ca7];return _0x2ef97e;};'use strict';var multer=require(_0x6453('0x0'));var util=require(_0x6453('0x1'));var path=require(_0x6453('0x2'));var timeout=require(_0x6453('0x3'));var express=require('express');var router=express[_0x6453('0x4')]();var fs_extra=require(_0x6453('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6453('0x6'));var config=require(_0x6453('0x7'));var controller=require(_0x6453('0x8'));router['get']('/',auth[_0x6453('0x9')](),controller[_0x6453('0xa')]);router['get'](_0x6453('0xb'),auth[_0x6453('0x9')](),controller['show']);router[_0x6453('0xc')](_0x6453('0xd'),auth[_0x6453('0x9')](),controller[_0x6453('0xe')]);router[_0x6453('0xc')](_0x6453('0xf'),auth['isAuthenticated'](),controller[_0x6453('0x10')]);router[_0x6453('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6453('0x11')](_0x6453('0xd'),auth[_0x6453('0x9')](),controller[_0x6453('0x12')]);router[_0x6453('0x11')]('/:id/actions',auth[_0x6453('0x9')](),controller[_0x6453('0x13')]);router[_0x6453('0x14')](_0x6453('0xb'),auth[_0x6453('0x9')](),controller[_0x6453('0x15')]);router['delete']('/:id',auth[_0x6453('0x9')](),controller[_0x6453('0x16')]);module[_0x6453('0x17')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index f7d3d96..a8c8da4 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 _0x62a8=['Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#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)','always','onlyIfOpen','BOOLEAN','#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','DESC','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','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)','sequelize','exports','STRING','name','ENUM','ivr','Active/Disactive\x20Campaign','UNSIGNED','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x62a8,0x16b));var _0x862a=function(_0x49be98,_0x441f1c){_0x49be98=_0x49be98-0x0;var _0x5053b2=_0x62a8[_0x49be98];return _0x5053b2;};'use strict';var Sequelize=require(_0x862a('0x0'));module[_0x862a('0x1')]={'name':{'type':Sequelize[_0x862a('0x2')],'unique':_0x862a('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x862a('0x4')]('ivr'),'allowNull':![],'defaultValue':_0x862a('0x5')},'description':{'type':Sequelize[_0x862a('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x862a('0x6')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x862a('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x862a('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x862a('0x8')](0x3)[_0x862a('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x862a('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x862a('0x8')](0x3)[_0x862a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x862a('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x862a('0x8')](0x5)[_0x862a('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x862a('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x862a('0x8')](0x3)[_0x862a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x862a('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x862a('0x8')](0x5)[_0x862a('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x862a('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x862a('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x862a('0x8')](0x5)[_0x862a('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x862a('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0x862a('0x8')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x862a('0xf')},'dialTimezone':{'type':Sequelize[_0x862a('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x862a('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x862a('0x4')](_0x862a('0x10'),'never',_0x862a('0x11')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x862a('0x12')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x862a('0x8')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x862a('0x13')},'dialAMDGreeting':{'type':Sequelize[_0x862a('0x8')](0x9)[_0x862a('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x862a('0x8')](0x9)[_0x862a('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x862a('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x862a('0x8')](0x9)[_0x862a('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x862a('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0x862a('0x8')](0x9)[_0x862a('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x862a('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x862a('0x8')](0x9)[_0x862a('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x862a('0x8')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x862a('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x862a('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x862a('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x862a('0x8')](0x9)[_0x862a('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x862a('0x19')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x862a('0x1a'),'ASC'),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x862a('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x862a('0x8')](0x3)[_0x862a('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x862a('0x8')](0x3)[_0x862a('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x862a('0x1b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x862a('0x8')](0x3)[_0x862a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x862a('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x862a('0x1c')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x862a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x862a('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x862a('0x1d')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x862a('0x8')](0x3)[_0x862a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x862a('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x862a('0x1e')},'dialMachineMaxRetry':{'type':Sequelize[_0x862a('0x8')](0x3)[_0x862a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x862a('0x1f')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x862a('0x8')](0x3)[_0x862a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x862a('0x20')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x862a('0x8')](0x5)[_0x862a('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x862a('0x21')}}; \ No newline at end of file +var _0x89d3=['#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\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','BOOLEAN','UNSIGNED','Max\x20200\x20calls.','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','ENUM','never','always','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence'];(function(_0x7a011e,_0x3a24bd){var _0x13d75b=function(_0x38deeb){while(--_0x38deeb){_0x7a011e['push'](_0x7a011e['shift']());}};_0x13d75b(++_0x3a24bd);}(_0x89d3,0x13f));var _0x389d=function(_0x239b31,_0x44a64d){_0x239b31=_0x239b31-0x0;var _0x41c8be=_0x89d3[_0x239b31];return _0x41c8be;};'use strict';var Sequelize=require(_0x389d('0x0'));module[_0x389d('0x1')]={'name':{'type':Sequelize[_0x389d('0x2')],'unique':_0x389d('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('ivr'),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x389d('0x2')]},'active':{'type':Sequelize[_0x389d('0x4')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x389d('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x389d('0x6')},'dialOriginateCallerIdName':{'type':Sequelize[_0x389d('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x389d('0x7')](0x3)[_0x389d('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x389d('0x8')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x389d('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x389d('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x389d('0x7')](0x5)[_0x389d('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x389d('0xa')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x389d('0x7')](0x5)[_0x389d('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x389d('0x7')](0x3)[_0x389d('0x5')],'defaultValue':0x3,'comment':_0x389d('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x389d('0x7')](0x5)[_0x389d('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x389d('0x7')](0x3)[_0x389d('0x5')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x389d('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x389d('0x2')],'defaultValue':_0x389d('0xc')},'dialCheckDuplicateType':{'type':Sequelize[_0x389d('0xd')]('always',_0x389d('0xe'),'onlyIfOpen'),'defaultValue':_0x389d('0xf')},'dialAMDActive':{'type':Sequelize[_0x389d('0x4')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x389d('0x5')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x389d('0x10')},'dialAMDGreeting':{'type':Sequelize[_0x389d('0x7')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x389d('0x11')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x389d('0x5')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x389d('0x7')](0x9)[_0x389d('0x5')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x389d('0x12')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x389d('0x5')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x389d('0x13')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x389d('0x5')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x389d('0x14')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x389d('0x7')](0x9)[_0x389d('0x5')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x389d('0x15')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x389d('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x389d('0x16')},'dialOrderByScheduledAt':{'type':Sequelize[_0x389d('0xd')](_0x389d('0x17'),_0x389d('0x18')),'defaultValue':_0x389d('0x17')},'dialPrefix':{'type':Sequelize[_0x389d('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x389d('0x7')](0x3)[_0x389d('0x5')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x389d('0x7')](0x3)[_0x389d('0x5')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x389d('0x19')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x389d('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x389d('0x1a')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x389d('0x7')](0x5)[_0x389d('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x389d('0x1b')},'dialDropMaxRetry':{'type':Sequelize[_0x389d('0x7')](0x3)[_0x389d('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x389d('0x1c')},'dialDropRetryFrequency':{'type':Sequelize[_0x389d('0x7')](0x5)[_0x389d('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x389d('0x1d')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x389d('0x7')](0x3)[_0x389d('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x389d('0x7')](0x5)[_0x389d('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x389d('0x1e')},'dialMachineMaxRetry':{'type':Sequelize[_0x389d('0x7')](0x3)[_0x389d('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x389d('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x389d('0x1f')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x389d('0x7')](0x3)[_0x389d('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x389d('0x20')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x389d('0x7')](0x5)[_0x389d('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x389d('0x21')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 486f150..eb2d550 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 _0x60d7=['phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','fromQuery','from','cm_hopper_additional_phones','OrderBy','cm_contact_has_items','join','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','ids','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','error','stack','name','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','catch','show','params','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','updatedAt','omit','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','findOne','CmHopper','hasOwnProperty','nolimit','CampaignId','CmHopperHistory','findAll','rows','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','format','YYYY-MM-DD\x20HH:mm:ss','spread','dialCheckDuplicateType','always','insert','into','phone','scheduledAt','ContactId','ListId','select','field','NOW()','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x60d7,0x139));var _0x760d=function(_0x238e2d,_0x3fc80c){_0x238e2d=_0x238e2d-0x0;var _0x51eb18=_0x60d7[_0x238e2d];return _0x51eb18;};'use strict';var emlformat=require(_0x760d('0x0'));var rimraf=require(_0x760d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x760d('0x2'));var rp=require('request-promise');var moment=require(_0x760d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x760d('0x4'));var util=require(_0x760d('0x5'));var path=require(_0x760d('0x6'));var sox=require(_0x760d('0x7'));var csv=require('to-csv');var ejs=require(_0x760d('0x8'));var fs=require('fs');var fs_extra=require(_0x760d('0x9'));var _=require(_0x760d('0xa'));var squel=require(_0x760d('0xb'));var crypto=require(_0x760d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x760d('0xd'));var toCsv=require(_0x760d('0xe'));var querystring=require(_0x760d('0xf'));var Papa=require('papaparse');var Redis=require(_0x760d('0x10'));var authService=require(_0x760d('0x11'));var qs=require(_0x760d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x760d('0x13'));var logger=require(_0x760d('0x14'))('api');var utils=require(_0x760d('0x15'));var config=require(_0x760d('0x16'));var licenseUtil=require(_0x760d('0x17'));var db=require(_0x760d('0x18'))['db'];function respondWithStatusCode(_0x1c6d0d,_0x40b3ee){_0x40b3ee=_0x40b3ee||0xcc;return function(_0xffb1f9){if(_0xffb1f9){return _0x1c6d0d[_0x760d('0x19')](_0x40b3ee);}return _0x1c6d0d[_0x760d('0x1a')](_0x40b3ee)[_0x760d('0x1b')]();};}function respondWithResult(_0x28bd1b,_0x543d6e){_0x543d6e=_0x543d6e||0xc8;return function(_0x1fed3a){if(_0x1fed3a){return _0x28bd1b['status'](_0x543d6e)[_0x760d('0x1c')](_0x1fed3a);}};}function respondWithFilteredResult(_0x62b5e9,_0x13118d){return function(_0x86e62a){if(_0x86e62a){var _0x49c0d4=typeof _0x13118d['offset']===_0x760d('0x1d')&&typeof _0x13118d[_0x760d('0x1e')]===_0x760d('0x1d');var _0x436bbd=_0x86e62a[_0x760d('0x1f')];var _0x1bed8=_0x49c0d4?0x0:_0x13118d['offset'];var _0x49cac3=_0x49c0d4?_0x86e62a[_0x760d('0x1f')]:_0x13118d[_0x760d('0x20')]+_0x13118d[_0x760d('0x1e')];var _0x2bbf82;if(_0x49cac3>=_0x436bbd){_0x49cac3=_0x436bbd;_0x2bbf82=0xc8;}else{_0x2bbf82=0xce;}_0x62b5e9[_0x760d('0x1a')](_0x2bbf82);return _0x62b5e9[_0x760d('0x21')](_0x760d('0x22'),_0x1bed8+'-'+_0x49cac3+'/'+_0x436bbd)[_0x760d('0x1c')](_0x86e62a);}return null;};}function patchUpdates(_0x37d5a5){return function(_0x2f74b5){try{jsonpatch['apply'](_0x2f74b5,_0x37d5a5,!![]);}catch(_0xf3c65f){return BPromise[_0x760d('0x23')](_0xf3c65f);}return _0x2f74b5[_0x760d('0x24')]();};}function saveUpdates(_0x2797bf,_0x234934){return function(_0x57dcea){if(_0x57dcea){return _0x57dcea[_0x760d('0x25')](_0x2797bf)[_0x760d('0x26')](function(_0x1fac3c){return _0x1fac3c;});}return null;};}function removeEntity(_0x516133,_0x55b45a){return function(_0x44b653){if(_0x44b653){return _0x44b653[_0x760d('0x27')]()[_0x760d('0x26')](function(){var _0x19cd53=_0x44b653[_0x760d('0x28')]({'plain':!![]});var _0x16bbdb=_0x760d('0x29');return db[_0x760d('0x2a')]['destroy']({'where':{'type':_0x16bbdb,'resourceId':_0x19cd53['id']}})[_0x760d('0x26')](function(){return _0x44b653;});})[_0x760d('0x26')](function(){_0x516133[_0x760d('0x1a')](0xcc)[_0x760d('0x1b')]();});}};}function handleEntityNotFound(_0x47c5e6,_0x2b2251){return function(_0x58b4fb){if(!_0x58b4fb){_0x47c5e6['sendStatus'](0x194);}return _0x58b4fb;};}function handleError(_0x10696b,_0x4619ed){_0x4619ed=_0x4619ed||0x1f4;return function(_0x3bb676){logger[_0x760d('0x2b')](_0x3bb676[_0x760d('0x2c')]);if(_0x3bb676[_0x760d('0x2d')]){delete _0x3bb676[_0x760d('0x2d')];}_0x10696b[_0x760d('0x1a')](_0x4619ed)['send'](_0x3bb676);};}exports[_0x760d('0x2e')]=function(_0xc4fec8,_0x27cb58){var _0x149732={},_0x4b5bfb={},_0x5584c7={'count':0x0,'rows':[]};var _0x47ef8f=_[_0x760d('0x2f')](db[_0x760d('0x30')][_0x760d('0x31')],function(_0x3cd782){return{'name':_0x3cd782[_0x760d('0x32')],'type':_0x3cd782[_0x760d('0x33')][_0x760d('0x34')]};});_0x4b5bfb[_0x760d('0x35')]=_[_0x760d('0x2f')](_0x47ef8f,_0x760d('0x2d'));_0x4b5bfb[_0x760d('0x36')]=_[_0x760d('0x37')](_0xc4fec8['query']);_0x4b5bfb[_0x760d('0x38')]=_[_0x760d('0x39')](_0x4b5bfb['model'],_0x4b5bfb['query']);_0x149732[_0x760d('0x3a')]=_[_0x760d('0x39')](_0x4b5bfb['model'],qs[_0x760d('0x3b')](_0xc4fec8['query']['fields']));_0x149732[_0x760d('0x3a')]=_0x149732[_0x760d('0x3a')][_0x760d('0x3c')]?_0x149732[_0x760d('0x3a')]:_0x4b5bfb[_0x760d('0x35')];if(!_0xc4fec8['query']['hasOwnProperty']('nolimit')){_0x149732['limit']=qs[_0x760d('0x1e')](_0xc4fec8[_0x760d('0x36')][_0x760d('0x1e')]);_0x149732[_0x760d('0x20')]=qs[_0x760d('0x20')](_0xc4fec8[_0x760d('0x36')]['offset']);}_0x149732[_0x760d('0x3d')]=qs[_0x760d('0x3e')](_0xc4fec8[_0x760d('0x36')][_0x760d('0x3e')]);_0x149732[_0x760d('0x3f')]=qs[_0x760d('0x38')](_[_0x760d('0x40')](_0xc4fec8[_0x760d('0x36')],_0x4b5bfb['filters']),_0x47ef8f);if(_0xc4fec8[_0x760d('0x36')]['filter']){_0x149732[_0x760d('0x3f')]=_[_0x760d('0x41')](_0x149732['where'],{'$or':_[_0x760d('0x2f')](_0x47ef8f,function(_0x551e9d){if(_0x551e9d['type']!==_0x760d('0x42')){var _0x4ef63f={};_0x4ef63f[_0x551e9d['name']]={'$like':'%'+_0xc4fec8[_0x760d('0x36')][_0x760d('0x43')]+'%'};return _0x4ef63f;}})});}_0x149732=_[_0x760d('0x41')]({},_0x149732,_0xc4fec8['options']);var _0x57d950={'where':_0x149732['where']};return db[_0x760d('0x30')][_0x760d('0x1f')](_0x57d950)[_0x760d('0x26')](function(_0x3be521){_0x5584c7[_0x760d('0x1f')]=_0x3be521;if(_0xc4fec8[_0x760d('0x36')][_0x760d('0x44')]){_0x149732[_0x760d('0x45')]=[{'all':!![]}];}return db[_0x760d('0x30')]['findAll'](_0x149732);})['then'](function(_0x3dbc36){_0x5584c7['rows']=_0x3dbc36;return _0x5584c7;})[_0x760d('0x26')](respondWithFilteredResult(_0x27cb58,_0x149732))[_0x760d('0x46')](handleError(_0x27cb58,null));};exports[_0x760d('0x47')]=function(_0xe11b50,_0x2e4df3){var _0x974af2={'raw':![],'where':{'id':_0xe11b50[_0x760d('0x48')]['id']}},_0x18d132={};_0x18d132[_0x760d('0x35')]=_[_0x760d('0x37')](db[_0x760d('0x30')][_0x760d('0x31')]);_0x18d132[_0x760d('0x36')]=_[_0x760d('0x37')](_0xe11b50[_0x760d('0x36')]);_0x18d132[_0x760d('0x38')]=_[_0x760d('0x39')](_0x18d132['model'],_0x18d132['query']);_0x974af2['attributes']=_['intersection'](_0x18d132[_0x760d('0x35')],qs[_0x760d('0x3b')](_0xe11b50[_0x760d('0x36')]['fields']));_0x974af2[_0x760d('0x3a')]=_0x974af2[_0x760d('0x3a')][_0x760d('0x3c')]?_0x974af2[_0x760d('0x3a')]:_0x18d132[_0x760d('0x35')];if(_0xe11b50[_0x760d('0x36')]['includeAll']){_0x974af2[_0x760d('0x45')]=[{'all':!![]}];}_0x974af2=_[_0x760d('0x41')]({},_0x974af2,_0xe11b50[_0x760d('0x49')]);return db[_0x760d('0x30')][_0x760d('0x4a')](_0x974af2)[_0x760d('0x26')](handleEntityNotFound(_0x2e4df3,null))[_0x760d('0x26')](respondWithResult(_0x2e4df3,null))[_0x760d('0x46')](handleError(_0x2e4df3,null));};exports[_0x760d('0x4b')]=function(_0x823b7b,_0x5b7555){return db['Campaign'][_0x760d('0x4b')](_0x823b7b[_0x760d('0x4c')],{})['then'](function(_0xa211d6){var _0x5f1e09=_0x823b7b[_0x760d('0x4d')]['get']({'plain':!![]});if(!_0x5f1e09)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5f1e09[_0x760d('0x4e')]===_0x760d('0x4d')){var _0x3dbfa5=_0xa211d6[_0x760d('0x28')]({'plain':!![]});var _0x5d6426=_0x760d('0x29');return db[_0x760d('0x4f')]['find']({'where':{'name':_0x5d6426,'userProfileId':_0x5f1e09[_0x760d('0x50')]},'raw':!![]})['then'](function(_0x453582){if(_0x453582&&_0x453582[_0x760d('0x51')]===0x0){return db[_0x760d('0x2a')]['create']({'name':_0x3dbfa5[_0x760d('0x2d')],'resourceId':_0x3dbfa5['id'],'type':_0x453582[_0x760d('0x2d')],'sectionId':_0x453582['id']},{})[_0x760d('0x26')](function(){return _0xa211d6;});}else{return _0xa211d6;}})[_0x760d('0x46')](function(_0x102e7d){logger[_0x760d('0x2b')](_0x760d('0x52'),_0x102e7d);throw _0x102e7d;});}return _0xa211d6;})['then'](respondWithResult(_0x5b7555,0xc9))[_0x760d('0x46')](handleError(_0x5b7555,null));};exports[_0x760d('0x53')]=function(_0x6dbc5b,_0xc7610d){var _0x187e28={'where':{'id':_0x6dbc5b['params']['id']}},_0x83749a={};_0x83749a['model']=_[_0x760d('0x37')](db[_0x760d('0x30')]['rawAttributes']);_0x187e28[_0x760d('0x3a')]=_[_0x760d('0x39')](_0x83749a['model'],qs[_0x760d('0x3b')](_0x6dbc5b['query'][_0x760d('0x3b')]));_0x187e28[_0x760d('0x3a')]=_0x187e28[_0x760d('0x3a')][_0x760d('0x3c')]?_0x187e28[_0x760d('0x3a')]:_0x83749a['model'];if(_0x6dbc5b[_0x760d('0x36')][_0x760d('0x44')]){_0x187e28[_0x760d('0x45')]=[{'all':!![]}];}_0x187e28=_[_0x760d('0x41')]({},_0x187e28,_0x6dbc5b[_0x760d('0x49')]);return db[_0x760d('0x30')][_0x760d('0x4a')](_0x187e28)[_0x760d('0x26')](handleEntityNotFound(_0xc7610d,null))[_0x760d('0x26')](function(_0x23fc40){if(_0x23fc40){var _0x42b713=_0x23fc40[_0x760d('0x28')]({'plain':!![]});_0x42b713=qs['omit'](_0x42b713,['id','createdAt',_0x760d('0x54')]);_0x6dbc5b[_0x760d('0x4c')]=_[_0x760d('0x55')](_0x6dbc5b[_0x760d('0x4c')],['id',_0x760d('0x56'),_0x760d('0x54')]);return db[_0x760d('0x30')][_0x760d('0x4b')](_[_0x760d('0x41')](_0x42b713,_0x6dbc5b[_0x760d('0x4c')]),{'include':_0x6dbc5b[_0x760d('0x36')][_0x760d('0x44')]?[{'all':!![]}]:undefined})[_0x760d('0x26')](function(_0x4084a8){var _0x322be2=_0x6dbc5b[_0x760d('0x4d')]['get']({'plain':!![]});if(!_0x322be2)throw new Error(_0x760d('0x57'));if(_0x322be2[_0x760d('0x4e')]===_0x760d('0x4d')){var _0x36dfa0=_0x4084a8[_0x760d('0x28')]({'plain':!![]});var _0x5ca3f7=_0x760d('0x29');return db['UserProfileSection'][_0x760d('0x4a')]({'where':{'name':_0x5ca3f7,'userProfileId':_0x322be2[_0x760d('0x50')]},'raw':!![]})[_0x760d('0x26')](function(_0x1fddbe){if(_0x1fddbe&&_0x1fddbe['autoAssociation']===0x0){return db[_0x760d('0x2a')][_0x760d('0x4b')]({'name':_0x36dfa0['name'],'resourceId':_0x36dfa0['id'],'type':_0x1fddbe[_0x760d('0x2d')],'sectionId':_0x1fddbe['id']},{})[_0x760d('0x26')](function(){return _0x4084a8;});}else{return _0x4084a8;}})[_0x760d('0x46')](function(_0x30d6ec){logger[_0x760d('0x2b')](_0x760d('0x52'),_0x30d6ec);throw _0x30d6ec;});}return _0x4084a8;});}})[_0x760d('0x26')](respondWithResult(_0xc7610d,0xc9))['catch'](handleError(_0xc7610d,null));};exports[_0x760d('0x25')]=function(_0x509100,_0x3ad4bc){if(_0x509100[_0x760d('0x4c')]['id']){delete _0x509100[_0x760d('0x4c')]['id'];}return db['Campaign'][_0x760d('0x4a')]({'where':{'id':_0x509100['params']['id']}})[_0x760d('0x26')](handleEntityNotFound(_0x3ad4bc,null))[_0x760d('0x26')](saveUpdates(_0x509100[_0x760d('0x4c')],null))[_0x760d('0x26')](respondWithResult(_0x3ad4bc,null))[_0x760d('0x46')](handleError(_0x3ad4bc,null));};exports['destroy']=function(_0x1c52f5,_0x17baa4){return db[_0x760d('0x30')]['find']({'where':{'id':_0x1c52f5[_0x760d('0x48')]['id']}})[_0x760d('0x26')](handleEntityNotFound(_0x17baa4,null))[_0x760d('0x26')](removeEntity(_0x17baa4,null))['catch'](handleError(_0x17baa4,null));};exports['getHoppers']=function(_0x5aea04,_0x292b0f,_0x356959){var _0x56b2c2={'raw':!![],'where':{}};var _0x55bd28={};var _0x2ccd9b={'count':0x0,'rows':[]};return db[_0x760d('0x30')][_0x760d('0x58')]({'where':{'id':_0x5aea04[_0x760d('0x48')]['id']}})[_0x760d('0x26')](handleEntityNotFound(_0x292b0f,null))[_0x760d('0x26')](function(_0x1483db){if(_0x1483db){_0x55bd28[_0x760d('0x35')]=_[_0x760d('0x37')](db[_0x760d('0x59')]['rawAttributes']);_0x55bd28[_0x760d('0x36')]=_[_0x760d('0x37')](_0x5aea04['query']);_0x55bd28['filters']=_[_0x760d('0x39')](_0x55bd28[_0x760d('0x35')],_0x55bd28['query']);_0x56b2c2[_0x760d('0x3a')]=_[_0x760d('0x39')](_0x55bd28['model'],qs[_0x760d('0x3b')](_0x5aea04['query'][_0x760d('0x3b')]));_0x56b2c2['attributes']=_0x56b2c2[_0x760d('0x3a')][_0x760d('0x3c')]?_0x56b2c2['attributes']:_0x55bd28['model'];if(!_0x5aea04[_0x760d('0x36')][_0x760d('0x5a')](_0x760d('0x5b'))){_0x56b2c2['limit']=qs[_0x760d('0x1e')](_0x5aea04['query']['limit']);_0x56b2c2[_0x760d('0x20')]=qs[_0x760d('0x20')](_0x5aea04[_0x760d('0x36')]['offset']);}_0x56b2c2['order']=qs[_0x760d('0x3e')](_0x5aea04[_0x760d('0x36')][_0x760d('0x3e')]);_0x56b2c2[_0x760d('0x3f')]=qs[_0x760d('0x38')](_[_0x760d('0x40')](_0x5aea04['query'],_0x55bd28[_0x760d('0x38')]));_0x56b2c2[_0x760d('0x3f')][_0x760d('0x5c')]=_0x1483db['id'];if(_0x5aea04[_0x760d('0x36')]['filter']){_0x56b2c2[_0x760d('0x3f')]=_[_0x760d('0x41')](_0x56b2c2['where'],{'$or':_[_0x760d('0x2f')](_0x56b2c2['attributes'],function(_0xee30f9){var _0x3702b2={};_0x3702b2[_0xee30f9]={'$like':'%'+_0x5aea04[_0x760d('0x36')][_0x760d('0x43')]+'%'};return _0x3702b2;})});}_0x56b2c2=_[_0x760d('0x41')]({},_0x56b2c2,_0x5aea04['options']);return db['CmHopper'][_0x760d('0x1f')]({'where':_0x56b2c2[_0x760d('0x3f')]})['then'](function(_0x33cb84){_0x2ccd9b[_0x760d('0x1f')]=_0x33cb84;if(_0x5aea04['query'][_0x760d('0x44')]){_0x56b2c2[_0x760d('0x45')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x56b2c2);})[_0x760d('0x26')](function(_0x10de79){_0x2ccd9b['rows']=_0x10de79;return _0x2ccd9b;});}})[_0x760d('0x26')](respondWithFilteredResult(_0x292b0f,_0x56b2c2))[_0x760d('0x46')](handleError(_0x292b0f,null));};exports['getHopperHistories']=function(_0x28e84a,_0x571519,_0x45804b){var _0x3c6431={'raw':!![],'where':{}};var _0x4dbb24={};var _0x429579={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x28e84a[_0x760d('0x48')]['id']}})['then'](handleEntityNotFound(_0x571519,null))['then'](function(_0x5d7a8e){if(_0x5d7a8e){_0x4dbb24['model']=_[_0x760d('0x37')](db[_0x760d('0x5d')][_0x760d('0x31')]);_0x4dbb24[_0x760d('0x36')]=_[_0x760d('0x37')](_0x28e84a[_0x760d('0x36')]);_0x4dbb24['filters']=_['intersection'](_0x4dbb24[_0x760d('0x35')],_0x4dbb24['query']);_0x3c6431[_0x760d('0x3a')]=_[_0x760d('0x39')](_0x4dbb24[_0x760d('0x35')],qs['fields'](_0x28e84a[_0x760d('0x36')][_0x760d('0x3b')]));_0x3c6431[_0x760d('0x3a')]=_0x3c6431[_0x760d('0x3a')][_0x760d('0x3c')]?_0x3c6431[_0x760d('0x3a')]:_0x4dbb24[_0x760d('0x35')];if(!_0x28e84a[_0x760d('0x36')][_0x760d('0x5a')](_0x760d('0x5b'))){_0x3c6431[_0x760d('0x1e')]=qs[_0x760d('0x1e')](_0x28e84a[_0x760d('0x36')][_0x760d('0x1e')]);_0x3c6431[_0x760d('0x20')]=qs[_0x760d('0x20')](_0x28e84a['query']['offset']);}_0x3c6431[_0x760d('0x3d')]=qs[_0x760d('0x3e')](_0x28e84a[_0x760d('0x36')][_0x760d('0x3e')]);_0x3c6431['where']=qs[_0x760d('0x38')](_['pick'](_0x28e84a['query'],_0x4dbb24[_0x760d('0x38')]));_0x3c6431[_0x760d('0x3f')][_0x760d('0x5c')]=_0x5d7a8e['id'];if(_0x28e84a['query'][_0x760d('0x43')]){_0x3c6431[_0x760d('0x3f')]=_[_0x760d('0x41')](_0x3c6431[_0x760d('0x3f')],{'$or':_[_0x760d('0x2f')](_0x3c6431[_0x760d('0x3a')],function(_0x211a08){var _0x31d6ee={};_0x31d6ee[_0x211a08]={'$like':'%'+_0x28e84a[_0x760d('0x36')]['filter']+'%'};return _0x31d6ee;})});}_0x3c6431=_[_0x760d('0x41')]({},_0x3c6431,_0x28e84a[_0x760d('0x49')]);return db['CmHopperHistory'][_0x760d('0x1f')]({'where':_0x3c6431[_0x760d('0x3f')]})[_0x760d('0x26')](function(_0x27e44b){_0x429579['count']=_0x27e44b;if(_0x28e84a[_0x760d('0x36')][_0x760d('0x44')]){_0x3c6431['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x760d('0x5e')](_0x3c6431);})[_0x760d('0x26')](function(_0x7ce645){_0x429579[_0x760d('0x5f')]=_0x7ce645;return _0x429579;});}})['then'](respondWithFilteredResult(_0x571519,_0x3c6431))[_0x760d('0x46')](handleError(_0x571519,null));};exports[_0x760d('0x60')]=function(_0x282c3b,_0x4dd845,_0x48f562){var _0x5f24c3={'raw':!![],'where':{}};var _0x135544={};var _0x29219d={'count':0x0,'rows':[]};return db[_0x760d('0x30')][_0x760d('0x58')]({'where':{'id':_0x282c3b[_0x760d('0x48')]['id']}})[_0x760d('0x26')](handleEntityNotFound(_0x4dd845,null))[_0x760d('0x26')](function(_0x18bc64){if(_0x18bc64){_0x135544[_0x760d('0x35')]=_['keys'](db['CmHopperFinal'][_0x760d('0x31')]);_0x135544[_0x760d('0x36')]=_[_0x760d('0x37')](_0x282c3b[_0x760d('0x36')]);_0x135544[_0x760d('0x38')]=_[_0x760d('0x39')](_0x135544[_0x760d('0x35')],_0x135544[_0x760d('0x36')]);_0x5f24c3[_0x760d('0x3a')]=_[_0x760d('0x39')](_0x135544[_0x760d('0x35')],qs[_0x760d('0x3b')](_0x282c3b[_0x760d('0x36')]['fields']));_0x5f24c3['attributes']=_0x5f24c3[_0x760d('0x3a')][_0x760d('0x3c')]?_0x5f24c3['attributes']:_0x135544['model'];if(!_0x282c3b[_0x760d('0x36')][_0x760d('0x5a')](_0x760d('0x5b'))){_0x5f24c3[_0x760d('0x1e')]=qs['limit'](_0x282c3b['query'][_0x760d('0x1e')]);_0x5f24c3[_0x760d('0x20')]=qs[_0x760d('0x20')](_0x282c3b[_0x760d('0x36')]['offset']);}_0x5f24c3[_0x760d('0x3d')]=qs[_0x760d('0x3e')](_0x282c3b[_0x760d('0x36')][_0x760d('0x3e')]);_0x5f24c3[_0x760d('0x3f')]=qs['filters'](_[_0x760d('0x40')](_0x282c3b[_0x760d('0x36')],_0x135544['filters']));_0x5f24c3[_0x760d('0x3f')][_0x760d('0x5c')]=_0x18bc64['id'];if(_0x282c3b[_0x760d('0x36')][_0x760d('0x43')]){_0x5f24c3[_0x760d('0x3f')]=_['merge'](_0x5f24c3[_0x760d('0x3f')],{'$or':_[_0x760d('0x2f')](_0x5f24c3[_0x760d('0x3a')],function(_0x3265d3){var _0x275662={};_0x275662[_0x3265d3]={'$like':'%'+_0x282c3b[_0x760d('0x36')][_0x760d('0x43')]+'%'};return _0x275662;})});}_0x5f24c3=_[_0x760d('0x41')]({},_0x5f24c3,_0x282c3b['options']);return db[_0x760d('0x61')][_0x760d('0x1f')]({'where':_0x5f24c3[_0x760d('0x3f')]})['then'](function(_0x26ffbe){_0x29219d[_0x760d('0x1f')]=_0x26ffbe;if(_0x282c3b[_0x760d('0x36')]['includeAll']){_0x5f24c3[_0x760d('0x45')]=[{'all':!![]}];}return db[_0x760d('0x61')]['findAll'](_0x5f24c3);})[_0x760d('0x26')](function(_0x189885){_0x29219d[_0x760d('0x5f')]=_0x189885;return _0x29219d;});}})['then'](respondWithFilteredResult(_0x4dd845,_0x5f24c3))[_0x760d('0x46')](handleError(_0x4dd845,null));};exports[_0x760d('0x62')]=function(_0x3ff551,_0x35116b,_0x52e16a){var _0x356602={'raw':!![],'where':{}};var _0x28576f={};var _0x165985={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x3ff551[_0x760d('0x48')]['id']}})[_0x760d('0x26')](handleEntityNotFound(_0x35116b,null))['then'](function(_0x364036){if(_0x364036){_0x28576f[_0x760d('0x35')]=_['keys'](db[_0x760d('0x63')][_0x760d('0x31')]);_0x28576f[_0x760d('0x36')]=_['keys'](_0x3ff551[_0x760d('0x36')]);_0x28576f[_0x760d('0x38')]=_[_0x760d('0x39')](_0x28576f['model'],_0x28576f[_0x760d('0x36')]);_0x356602['attributes']=_[_0x760d('0x39')](_0x28576f[_0x760d('0x35')],qs[_0x760d('0x3b')](_0x3ff551[_0x760d('0x36')][_0x760d('0x3b')]));_0x356602[_0x760d('0x3a')]=_0x356602[_0x760d('0x3a')]['length']?_0x356602[_0x760d('0x3a')]:_0x28576f[_0x760d('0x35')];if(!_0x3ff551[_0x760d('0x36')]['hasOwnProperty'](_0x760d('0x5b'))){_0x356602[_0x760d('0x1e')]=qs[_0x760d('0x1e')](_0x3ff551[_0x760d('0x36')][_0x760d('0x1e')]);_0x356602[_0x760d('0x20')]=qs['offset'](_0x3ff551[_0x760d('0x36')]['offset']);}_0x356602[_0x760d('0x3d')]=qs[_0x760d('0x3e')](_0x3ff551['query']['sort']);_0x356602[_0x760d('0x3f')]=qs[_0x760d('0x38')](_[_0x760d('0x40')](_0x3ff551[_0x760d('0x36')],_0x28576f['filters']));_0x356602['where']['CampaignId']=_0x364036['id'];if(_0x3ff551[_0x760d('0x36')][_0x760d('0x43')]){_0x356602[_0x760d('0x3f')]=_['merge'](_0x356602[_0x760d('0x3f')],{'$or':_[_0x760d('0x2f')](_0x356602[_0x760d('0x3a')],function(_0x5e13e5){var _0x6a2688={};_0x6a2688[_0x5e13e5]={'$like':'%'+_0x3ff551[_0x760d('0x36')]['filter']+'%'};return _0x6a2688;})});}_0x356602=_['merge']({},_0x356602,_0x3ff551['options']);return db[_0x760d('0x63')][_0x760d('0x1f')]({'where':_0x356602[_0x760d('0x3f')]})[_0x760d('0x26')](function(_0x4ccd36){_0x165985[_0x760d('0x1f')]=_0x4ccd36;if(_0x3ff551[_0x760d('0x36')][_0x760d('0x44')]){_0x356602['include']=[{'all':!![]}];}return db[_0x760d('0x63')][_0x760d('0x5e')](_0x356602);})[_0x760d('0x26')](function(_0x24006a){_0x165985[_0x760d('0x5f')]=_0x24006a;return _0x165985;});}})['then'](respondWithFilteredResult(_0x35116b,_0x356602))[_0x760d('0x46')](handleError(_0x35116b,null));};exports[_0x760d('0x64')]=function(_0x3082ed,_0x4c2377,_0x49085c){var _0x18a1ef={};var _0x2b3fb9={};var _0x2eef8e;var _0x8e8791;return db[_0x760d('0x30')][_0x760d('0x58')]({'where':{'id':_0x3082ed[_0x760d('0x48')]['id']}})['then'](handleEntityNotFound(_0x4c2377,null))[_0x760d('0x26')](function(_0x2a6b76){if(_0x2a6b76){_0x2eef8e=_0x2a6b76;_0x2b3fb9[_0x760d('0x35')]=_[_0x760d('0x37')](db['CmList'][_0x760d('0x31')]);_0x2b3fb9['query']=_[_0x760d('0x37')](_0x3082ed[_0x760d('0x36')]);_0x2b3fb9[_0x760d('0x38')]=_[_0x760d('0x39')](_0x2b3fb9[_0x760d('0x35')],_0x2b3fb9[_0x760d('0x36')]);_0x18a1ef[_0x760d('0x3a')]=_[_0x760d('0x39')](_0x2b3fb9['model'],qs[_0x760d('0x3b')](_0x3082ed[_0x760d('0x36')][_0x760d('0x3b')]));_0x18a1ef[_0x760d('0x3a')]=_0x18a1ef[_0x760d('0x3a')][_0x760d('0x3c')]?_0x18a1ef[_0x760d('0x3a')]:_0x2b3fb9[_0x760d('0x35')];_0x18a1ef[_0x760d('0x3d')]=qs['sort'](_0x3082ed[_0x760d('0x36')][_0x760d('0x3e')]);_0x18a1ef[_0x760d('0x3f')]=qs[_0x760d('0x38')](_[_0x760d('0x40')](_0x3082ed['query'],_0x2b3fb9[_0x760d('0x38')]));if(_0x3082ed['query']['filter']){_0x18a1ef[_0x760d('0x3f')]=_[_0x760d('0x41')](_0x18a1ef[_0x760d('0x3f')],{'$or':_[_0x760d('0x2f')](_0x18a1ef['attributes'],function(_0x463d20){var _0x4b96fd={};_0x4b96fd[_0x463d20]={'$like':'%'+_0x3082ed[_0x760d('0x36')]['filter']+'%'};return _0x4b96fd;})});}_0x18a1ef=_[_0x760d('0x41')]({},_0x18a1ef,_0x3082ed[_0x760d('0x49')]);return _0x2eef8e[_0x760d('0x64')](_0x18a1ef);}})[_0x760d('0x26')](function(_0x58835d){if(_0x58835d){_0x8e8791=_0x58835d['length'];if(!_0x3082ed[_0x760d('0x36')][_0x760d('0x5a')](_0x760d('0x5b'))){_0x18a1ef[_0x760d('0x1e')]=qs[_0x760d('0x1e')](_0x3082ed[_0x760d('0x36')]['limit']);_0x18a1ef['offset']=qs[_0x760d('0x20')](_0x3082ed[_0x760d('0x36')]['offset']);}return _0x2eef8e['getLists'](_0x18a1ef);}})[_0x760d('0x26')](function(_0x475940){if(_0x475940){return _0x475940?{'count':_0x8e8791,'rows':_0x475940}:null;}})[_0x760d('0x26')](respondWithResult(_0x4c2377,null))[_0x760d('0x46')](handleError(_0x4c2377,null));};exports[_0x760d('0x65')]=function(_0x35bb84,_0x5f5aa3,_0x151416){var _0xbbfbde,_0x440539;var _0x4525a0=[];var _0x6cf52=moment()[_0x760d('0x66')](_0x760d('0x67'));return db[_0x760d('0x30')]['find']({'where':{'id':_0x35bb84['params']['id']}})[_0x760d('0x26')](handleEntityNotFound(_0x5f5aa3,null))[_0x760d('0x26')](function(_0x5d6d3c){if(_0x5d6d3c){_0x440539=_0x5d6d3c;return _0x5d6d3c['addLists'](_0x35bb84[_0x760d('0x4c')]['ids'],_[_0x760d('0x55')](_0x35bb84[_0x760d('0x4c')],['ids','id'])||{});}return null;})[_0x760d('0x68')](function(_0x26c5c8){var _0x260404;var _0x589503;_0xbbfbde=_0x26c5c8||[];var _0x213958=[];if(_0x26c5c8){for(var _0x55c677=0x0;_0x55c677<_0x26c5c8['length'];_0x55c677+=0x1){var _0x1b8928=_0x26c5c8[_0x55c677][_0x760d('0x28')]({'plain':!![]});_0x440539[_0x760d('0x69')]=_0x35bb84[_0x760d('0x4c')][_0x760d('0x69')]?_0x35bb84[_0x760d('0x4c')][_0x760d('0x69')]:_0x440539[_0x760d('0x69')];switch(_0x440539[_0x760d('0x69')]){case _0x760d('0x6a'):_0x260404=squel[_0x760d('0x6b')]()[_0x760d('0x6c')]('cm_hopper')['fromQuery']([_0x760d('0x6d'),_0x760d('0x6e'),_0x760d('0x6f'),_0x760d('0x70'),_0x760d('0x5c'),'createdAt',_0x760d('0x54')],squel[_0x760d('0x71')]()[_0x760d('0x72')]('phone',_0x760d('0x6d'))[_0x760d('0x72')](_0x760d('0x73'),'scheduledAt')[_0x760d('0x72')]('id',_0x760d('0x6f'))['field'](_0x1b8928['CmListId'][_0x760d('0x74')](),'ListId')[_0x760d('0x72')](_0x35bb84['params']['id'][_0x760d('0x74')](),_0x760d('0x5c'))[_0x760d('0x72')]('\x27'+_0x6cf52+'\x27','createdAt')['field']('\x27'+_0x6cf52+'\x27',_0x760d('0x54'))['from'](_0x760d('0x75'))[_0x760d('0x3f')](_0x760d('0x76'))[_0x760d('0x3f')](_0x760d('0x77'),_0x1b8928[_0x760d('0x78')][_0x760d('0x74')]())[_0x760d('0x3f')](_0x760d('0x79'))[_0x760d('0x3f')](_0x760d('0x7a'),squel[_0x760d('0x71')]()[_0x760d('0x72')](_0x760d('0x7b'))['from']('cm_hopper_final')[_0x760d('0x3f')](_0x760d('0x7c'),_0x35bb84[_0x760d('0x48')]['id'][_0x760d('0x74')]()))['where'](_0x760d('0x7a'),squel[_0x760d('0x71')]()['field'](_0x760d('0x7d'))['from'](_0x760d('0x7e'))[_0x760d('0x3f')](_0x760d('0x7c'),_0x35bb84[_0x760d('0x48')]['id']['toString']())))[_0x760d('0x74')]();break;case _0x760d('0x7f'):_0x260404=squel['insert']()[_0x760d('0x6c')](_0x760d('0x7e'))[_0x760d('0x80')]([_0x760d('0x6d'),_0x760d('0x6e'),_0x760d('0x6f'),'ListId',_0x760d('0x5c'),_0x760d('0x56'),_0x760d('0x54')],squel['select']()['field'](_0x760d('0x6d'),_0x760d('0x6d'))['field'](_0x760d('0x73'),'scheduledAt')[_0x760d('0x72')]('id',_0x760d('0x6f'))[_0x760d('0x72')](_0x1b8928[_0x760d('0x78')][_0x760d('0x74')](),_0x760d('0x70'))['field'](_0x35bb84[_0x760d('0x48')]['id'][_0x760d('0x74')](),_0x760d('0x5c'))['field']('\x27'+_0x6cf52+'\x27','createdAt')[_0x760d('0x72')]('\x27'+_0x6cf52+'\x27',_0x760d('0x54'))['from']('cm_contacts')['where'](_0x760d('0x76'))[_0x760d('0x3f')](_0x760d('0x77'),_0x1b8928['CmListId']['toString']())[_0x760d('0x3f')](_0x760d('0x79'))[_0x760d('0x3f')](_0x760d('0x7a'),squel[_0x760d('0x71')]()[_0x760d('0x72')](_0x760d('0x7d'))[_0x760d('0x81')]('cm_hopper')['where'](_0x760d('0x7c'),_0x35bb84[_0x760d('0x48')]['id']['toString']())))[_0x760d('0x74')]();break;default:_0x260404=squel['insert']()[_0x760d('0x6c')](_0x760d('0x7e'))['fromQuery']([_0x760d('0x6d'),_0x760d('0x6e'),_0x760d('0x6f'),'ListId','CampaignId',_0x760d('0x56'),_0x760d('0x54')],squel['select']()[_0x760d('0x72')](_0x760d('0x6d'),_0x760d('0x6d'))[_0x760d('0x72')](_0x760d('0x73'),_0x760d('0x6e'))[_0x760d('0x72')]('id',_0x760d('0x6f'))['field'](_0x1b8928[_0x760d('0x78')][_0x760d('0x74')](),_0x760d('0x70'))[_0x760d('0x72')](_0x35bb84[_0x760d('0x48')]['id']['toString'](),_0x760d('0x5c'))['field']('\x27'+_0x6cf52+'\x27',_0x760d('0x56'))[_0x760d('0x72')]('\x27'+_0x6cf52+'\x27',_0x760d('0x54'))['from'](_0x760d('0x75'))['where'](_0x760d('0x76'))[_0x760d('0x3f')](_0x760d('0x77'),_0x1b8928['CmListId'][_0x760d('0x74')]())[_0x760d('0x3f')](_0x760d('0x79')))['toString']();}_0x589503=squel['insert']()['into'](_0x760d('0x82'))[_0x760d('0x80')](['cmHopperId','scheduledAt',_0x760d('0x6d'),'OrderBy','createdAt',_0x760d('0x54')],squel['select']()[_0x760d('0x72')]('h.id','id')[_0x760d('0x72')](_0x760d('0x73'),_0x760d('0x6e'))[_0x760d('0x72')]('ci.item',_0x760d('0x6d'))[_0x760d('0x72')]('ci.OrderBY',_0x760d('0x83'))['field']('\x27'+_0x6cf52+'\x27',_0x760d('0x56'))[_0x760d('0x72')]('\x27'+_0x6cf52+'\x27',_0x760d('0x54'))[_0x760d('0x81')](_0x760d('0x84'),'ci')[_0x760d('0x85')](_0x760d('0x7e'),'h','h.ContactId\x20=\x20ci.CmContactId')[_0x760d('0x3f')]('h.ListId\x20=\x20?',_0x1b8928[_0x760d('0x78')][_0x760d('0x74')]())[_0x760d('0x3f')](_0x760d('0x86'),_0x35bb84['params']['id'][_0x760d('0x74')]())[_0x760d('0x3f')](_0x760d('0x87'),_0x6cf52))[_0x760d('0x74')]();_0x213958[_0x760d('0x88')](db[_0x760d('0x89')][_0x760d('0x36')](_0x260404));_0x4525a0[_0x760d('0x88')](db[_0x760d('0x89')][_0x760d('0x36')](_0x589503));}return BPromise[_0x760d('0x8a')](_0x213958);}})[_0x760d('0x26')](function(){return BPromise[_0x760d('0x8a')](_0x4525a0);})[_0x760d('0x26')](function(){return _0xbbfbde;})['then'](respondWithResult(_0x5f5aa3,null))[_0x760d('0x46')](handleError(_0x5f5aa3,null));};exports[_0x760d('0x8b')]=function(_0x5a3dd0,_0x13e10c,_0x1e02d2){return db['Campaign'][_0x760d('0x4a')]({'where':{'id':_0x5a3dd0['params']['id']}})[_0x760d('0x26')](handleEntityNotFound(_0x13e10c,null))[_0x760d('0x26')](function(_0x56db54){if(_0x56db54){return _0x56db54[_0x760d('0x8b')](_0x5a3dd0['query'][_0x760d('0x8c')]);}})['then'](function(_0x434173){if(_0x434173){return db['CmHopper']['destroy']({'where':{'ListId':_0x5a3dd0['query'][_0x760d('0x8c')],'CampaignId':_0x5a3dd0[_0x760d('0x48')]['id']}})['then'](function(){return _0x434173;});}})['then'](respondWithStatusCode(_0x13e10c,null))[_0x760d('0x46')](handleError(_0x13e10c,null));};exports[_0x760d('0x8d')]=function(_0xeac13,_0x56e2ae,_0x559f2e){var _0x56f9cf={};var _0x176814={};var _0x3dc8ad;var _0x25927b;return db[_0x760d('0x30')][_0x760d('0x58')]({'where':{'id':_0xeac13['params']['id']}})['then'](handleEntityNotFound(_0x56e2ae,null))['then'](function(_0x519188){if(_0x519188){_0x3dc8ad=_0x519188;_0x176814[_0x760d('0x35')]=_[_0x760d('0x37')](db['CmList'][_0x760d('0x31')]);_0x176814[_0x760d('0x36')]=_[_0x760d('0x37')](_0xeac13['query']);_0x176814[_0x760d('0x38')]=_[_0x760d('0x39')](_0x176814['model'],_0x176814[_0x760d('0x36')]);_0x56f9cf[_0x760d('0x3a')]=_[_0x760d('0x39')](_0x176814['model'],qs[_0x760d('0x3b')](_0xeac13[_0x760d('0x36')]['fields']));_0x56f9cf[_0x760d('0x3a')]=_0x56f9cf[_0x760d('0x3a')][_0x760d('0x3c')]?_0x56f9cf[_0x760d('0x3a')]:_0x176814[_0x760d('0x35')];_0x56f9cf[_0x760d('0x3d')]=qs['sort'](_0xeac13[_0x760d('0x36')][_0x760d('0x3e')]);_0x56f9cf[_0x760d('0x3f')]=qs[_0x760d('0x38')](_[_0x760d('0x40')](_0xeac13[_0x760d('0x36')],_0x176814[_0x760d('0x38')]));if(_0xeac13['query'][_0x760d('0x43')]){_0x56f9cf[_0x760d('0x3f')]=_[_0x760d('0x41')](_0x56f9cf[_0x760d('0x3f')],{'$or':_[_0x760d('0x2f')](_0x56f9cf[_0x760d('0x3a')],function(_0x5ae107){var _0xf38411={};_0xf38411[_0x5ae107]={'$like':'%'+_0xeac13['query']['filter']+'%'};return _0xf38411;})});}_0x56f9cf=_[_0x760d('0x41')]({},_0x56f9cf,_0xeac13[_0x760d('0x49')]);return _0x3dc8ad[_0x760d('0x8d')](_0x56f9cf);}})['then'](function(_0x53369d){if(_0x53369d){_0x25927b=_0x53369d[_0x760d('0x3c')];if(!_0xeac13[_0x760d('0x36')][_0x760d('0x5a')](_0x760d('0x5b'))){_0x56f9cf[_0x760d('0x1e')]=qs[_0x760d('0x1e')](_0xeac13['query'][_0x760d('0x1e')]);_0x56f9cf[_0x760d('0x20')]=qs[_0x760d('0x20')](_0xeac13[_0x760d('0x36')][_0x760d('0x20')]);}return _0x3dc8ad[_0x760d('0x8d')](_0x56f9cf);}})['then'](function(_0x1e241f){if(_0x1e241f){return _0x1e241f?{'count':_0x25927b,'rows':_0x1e241f}:null;}})[_0x760d('0x26')](respondWithResult(_0x56e2ae,null))[_0x760d('0x46')](handleError(_0x56e2ae,null));};exports['addBlackLists']=function(_0xecae35,_0xf3cd8b,_0x59b57b){var _0x5aa429,_0xfcb74e;var _0x5b8487=[];var _0x4ecd17=moment()['format'](_0x760d('0x67'));return db[_0x760d('0x30')][_0x760d('0x4a')]({'where':{'id':_0xecae35[_0x760d('0x48')]['id']}})[_0x760d('0x26')](handleEntityNotFound(_0xf3cd8b,null))['then'](function(_0x2117ad){if(_0x2117ad){_0xfcb74e=_0x2117ad;return _0x2117ad[_0x760d('0x8e')](_0xecae35[_0x760d('0x4c')][_0x760d('0x8c')],_[_0x760d('0x55')](_0xecae35['body'],[_0x760d('0x8c'),'id'])||{});}return null;})['spread'](function(_0x3bd7ba){var _0x391200;var _0x228c03;_0x5aa429=_0x3bd7ba||[];var _0x2bdbfe=[];if(_0x3bd7ba){for(var _0x10d180=0x0;_0x10d180<_0x3bd7ba[_0x760d('0x3c')];_0x10d180+=0x1){var _0x3c1c13=_0x3bd7ba[_0x10d180][_0x760d('0x28')]({'plain':!![]});_0x391200=squel['insert']()[_0x760d('0x6c')](_0x760d('0x8f'))[_0x760d('0x80')](['phone',_0x760d('0x6f'),'ListId','CampaignId',_0x760d('0x56'),'updatedAt'],squel['select']()[_0x760d('0x72')](_0x760d('0x6d'),_0x760d('0x6d'))[_0x760d('0x72')]('id','ContactId')[_0x760d('0x72')](_0x3c1c13[_0x760d('0x78')]['toString'](),_0x760d('0x70'))[_0x760d('0x72')](_0xecae35[_0x760d('0x48')]['id'][_0x760d('0x74')](),_0x760d('0x5c'))[_0x760d('0x72')](_0x760d('0x73'),_0x760d('0x56'))['field'](_0x760d('0x73'),_0x760d('0x54'))[_0x760d('0x81')]('cm_contacts')[_0x760d('0x3f')](_0x760d('0x76'))[_0x760d('0x3f')](_0x760d('0x77'),_0x3c1c13['CmListId'][_0x760d('0x74')]())[_0x760d('0x3f')](_0x760d('0x79')))['toString']();_0x2bdbfe[_0x760d('0x88')](db[_0x760d('0x89')][_0x760d('0x36')](_0x391200));}return BPromise[_0x760d('0x8a')](_0x2bdbfe);}})[_0x760d('0x26')](function(){return _0x5aa429;})[_0x760d('0x26')](respondWithResult(_0xf3cd8b,null))[_0x760d('0x46')](handleError(_0xf3cd8b,null));};exports[_0x760d('0x90')]=function(_0x58bb24,_0x3e7f75,_0x428f7f){return db[_0x760d('0x30')][_0x760d('0x4a')]({'where':{'id':_0x58bb24['params']['id']}})[_0x760d('0x26')](handleEntityNotFound(_0x3e7f75,null))[_0x760d('0x26')](function(_0x3b8ad3){if(_0x3b8ad3){return _0x3b8ad3[_0x760d('0x90')](_0x58bb24['query'][_0x760d('0x8c')]);}})[_0x760d('0x26')](function(_0x4a9598){if(_0x4a9598){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x58bb24[_0x760d('0x36')][_0x760d('0x8c')],'CampaignId':_0x58bb24[_0x760d('0x48')]['id']}})[_0x760d('0x26')](function(){return _0x4a9598;});}})['then'](respondWithStatusCode(_0x3e7f75,null))[_0x760d('0x46')](handleError(_0x3e7f75,null));}; \ No newline at end of file +var _0xa503=['COALESCE(phone,\x27\x27)','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','YYYY-MM-DD\x20HH:mm:ss','addBlackLists','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','IvrCampaigns','UserProfileResource','end','stack','name','index','map','Campaign','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','create','user','role','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','getHoppers','findOne','pick','CampaignId','CmHopper','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','ids','spread','dialCheckDuplicateType','insert','cm_hopper','fromQuery','scheduledAt','ListId','field','phone','NOW()','ContactId','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','into'];(function(_0x5d2288,_0x352f6c){var _0x633f73=function(_0x4c26cf){while(--_0x4c26cf){_0x5d2288['push'](_0x5d2288['shift']());}};_0x633f73(++_0x352f6c);}(_0xa503,0x143));var _0x3a50=function(_0x4da373,_0x186d75){_0x4da373=_0x4da373-0x0;var _0x50e48d=_0xa503[_0x4da373];return _0x50e48d;};'use strict';var emlformat=require(_0x3a50('0x0'));var rimraf=require(_0x3a50('0x1'));var zipdir=require(_0x3a50('0x2'));var jsonpatch=require(_0x3a50('0x3'));var rp=require(_0x3a50('0x4'));var moment=require(_0x3a50('0x5'));var BPromise=require(_0x3a50('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3a50('0x7'));var sox=require(_0x3a50('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3a50('0x9'));var _=require(_0x3a50('0xa'));var squel=require(_0x3a50('0xb'));var crypto=require(_0x3a50('0xc'));var jsforce=require(_0x3a50('0xd'));var deskjs=require(_0x3a50('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3a50('0xf'));var Papa=require(_0x3a50('0x10'));var Redis=require(_0x3a50('0x11'));var authService=require(_0x3a50('0x12'));var qs=require(_0x3a50('0x13'));var as=require(_0x3a50('0x14'));var hardwareService=require(_0x3a50('0x15'));var logger=require('../../config/logger')(_0x3a50('0x16'));var utils=require(_0x3a50('0x17'));var config=require(_0x3a50('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x3a50('0x19'))['db'];function respondWithStatusCode(_0x4e9a5a,_0x1719c8){_0x1719c8=_0x1719c8||0xcc;return function(_0x401060){if(_0x401060){return _0x4e9a5a[_0x3a50('0x1a')](_0x1719c8);}return _0x4e9a5a[_0x3a50('0x1b')](_0x1719c8)['end']();};}function respondWithResult(_0x4762e2,_0x54cb88){_0x54cb88=_0x54cb88||0xc8;return function(_0x2aeba7){if(_0x2aeba7){return _0x4762e2[_0x3a50('0x1b')](_0x54cb88)[_0x3a50('0x1c')](_0x2aeba7);}};}function respondWithFilteredResult(_0x260374,_0x51aa93){return function(_0x55365e){if(_0x55365e){var _0x4b8971=typeof _0x51aa93[_0x3a50('0x1d')]===_0x3a50('0x1e')&&typeof _0x51aa93['limit']==='undefined';var _0x49f294=_0x55365e['count'];var _0x176e85=_0x4b8971?0x0:_0x51aa93[_0x3a50('0x1d')];var _0xaa2e18=_0x4b8971?_0x55365e[_0x3a50('0x1f')]:_0x51aa93['offset']+_0x51aa93[_0x3a50('0x20')];var _0x4d9c37;if(_0xaa2e18>=_0x49f294){_0xaa2e18=_0x49f294;_0x4d9c37=0xc8;}else{_0x4d9c37=0xce;}_0x260374[_0x3a50('0x1b')](_0x4d9c37);return _0x260374[_0x3a50('0x21')](_0x3a50('0x22'),_0x176e85+'-'+_0xaa2e18+'/'+_0x49f294)[_0x3a50('0x1c')](_0x55365e);}return null;};}function patchUpdates(_0x1871df){return function(_0x231a24){try{jsonpatch[_0x3a50('0x23')](_0x231a24,_0x1871df,!![]);}catch(_0x42c445){return BPromise[_0x3a50('0x24')](_0x42c445);}return _0x231a24[_0x3a50('0x25')]();};}function saveUpdates(_0x4081ba,_0x505bdc){return function(_0x3d2b0c){if(_0x3d2b0c){return _0x3d2b0c[_0x3a50('0x26')](_0x4081ba)['then'](function(_0x219f34){return _0x219f34;});}return null;};}function removeEntity(_0x33333f,_0x51f153){return function(_0x1e7f1c){if(_0x1e7f1c){return _0x1e7f1c[_0x3a50('0x27')]()[_0x3a50('0x28')](function(){var _0xbd8b18=_0x1e7f1c[_0x3a50('0x29')]({'plain':!![]});var _0xc4adc7=_0x3a50('0x2a');return db[_0x3a50('0x2b')][_0x3a50('0x27')]({'where':{'type':_0xc4adc7,'resourceId':_0xbd8b18['id']}})[_0x3a50('0x28')](function(){return _0x1e7f1c;});})[_0x3a50('0x28')](function(){_0x33333f[_0x3a50('0x1b')](0xcc)[_0x3a50('0x2c')]();});}};}function handleEntityNotFound(_0x267e0b,_0x357298){return function(_0xca5e99){if(!_0xca5e99){_0x267e0b[_0x3a50('0x1a')](0x194);}return _0xca5e99;};}function handleError(_0x253b13,_0x232efd){_0x232efd=_0x232efd||0x1f4;return function(_0x4dc6c8){logger['error'](_0x4dc6c8[_0x3a50('0x2d')]);if(_0x4dc6c8[_0x3a50('0x2e')]){delete _0x4dc6c8[_0x3a50('0x2e')];}_0x253b13['status'](_0x232efd)['send'](_0x4dc6c8);};}exports[_0x3a50('0x2f')]=function(_0x235e7b,_0x7e3dff){var _0x5ae379={},_0x202abc={},_0x119bb7={'count':0x0,'rows':[]};var _0x5f179a=_[_0x3a50('0x30')](db[_0x3a50('0x31')]['rawAttributes'],function(_0xaf4f0f){return{'name':_0xaf4f0f[_0x3a50('0x32')],'type':_0xaf4f0f['type'][_0x3a50('0x33')]};});_0x202abc[_0x3a50('0x34')]=_['map'](_0x5f179a,'name');_0x202abc[_0x3a50('0x35')]=_[_0x3a50('0x36')](_0x235e7b[_0x3a50('0x35')]);_0x202abc[_0x3a50('0x37')]=_['intersection'](_0x202abc['model'],_0x202abc[_0x3a50('0x35')]);_0x5ae379[_0x3a50('0x38')]=_[_0x3a50('0x39')](_0x202abc[_0x3a50('0x34')],qs['fields'](_0x235e7b[_0x3a50('0x35')][_0x3a50('0x3a')]));_0x5ae379[_0x3a50('0x38')]=_0x5ae379[_0x3a50('0x38')][_0x3a50('0x3b')]?_0x5ae379[_0x3a50('0x38')]:_0x202abc['model'];if(!_0x235e7b[_0x3a50('0x35')][_0x3a50('0x3c')](_0x3a50('0x3d'))){_0x5ae379[_0x3a50('0x20')]=qs['limit'](_0x235e7b[_0x3a50('0x35')][_0x3a50('0x20')]);_0x5ae379[_0x3a50('0x1d')]=qs[_0x3a50('0x1d')](_0x235e7b[_0x3a50('0x35')]['offset']);}_0x5ae379[_0x3a50('0x3e')]=qs[_0x3a50('0x3f')](_0x235e7b[_0x3a50('0x35')][_0x3a50('0x3f')]);_0x5ae379['where']=qs['filters'](_['pick'](_0x235e7b[_0x3a50('0x35')],_0x202abc[_0x3a50('0x37')]),_0x5f179a);if(_0x235e7b[_0x3a50('0x35')][_0x3a50('0x40')]){_0x5ae379[_0x3a50('0x41')]=_[_0x3a50('0x42')](_0x5ae379['where'],{'$or':_[_0x3a50('0x30')](_0x5f179a,function(_0x4fee36){if(_0x4fee36[_0x3a50('0x43')]!==_0x3a50('0x44')){var _0x55ddd5={};_0x55ddd5[_0x4fee36[_0x3a50('0x2e')]]={'$like':'%'+_0x235e7b[_0x3a50('0x35')]['filter']+'%'};return _0x55ddd5;}})});}_0x5ae379=_[_0x3a50('0x42')]({},_0x5ae379,_0x235e7b[_0x3a50('0x45')]);var _0x2552b5={'where':_0x5ae379[_0x3a50('0x41')]};return db['Campaign'][_0x3a50('0x1f')](_0x2552b5)[_0x3a50('0x28')](function(_0xd48e4b){_0x119bb7[_0x3a50('0x1f')]=_0xd48e4b;if(_0x235e7b[_0x3a50('0x35')][_0x3a50('0x46')]){_0x5ae379[_0x3a50('0x47')]=[{'all':!![]}];}return db[_0x3a50('0x31')]['findAll'](_0x5ae379);})[_0x3a50('0x28')](function(_0x403b8c){_0x119bb7[_0x3a50('0x48')]=_0x403b8c;return _0x119bb7;})[_0x3a50('0x28')](respondWithFilteredResult(_0x7e3dff,_0x5ae379))[_0x3a50('0x49')](handleError(_0x7e3dff,null));};exports[_0x3a50('0x4a')]=function(_0x5a881b,_0x189f05){var _0x280a75={'raw':![],'where':{'id':_0x5a881b[_0x3a50('0x4b')]['id']}},_0x54c9f9={};_0x54c9f9[_0x3a50('0x34')]=_[_0x3a50('0x36')](db[_0x3a50('0x31')][_0x3a50('0x4c')]);_0x54c9f9[_0x3a50('0x35')]=_['keys'](_0x5a881b[_0x3a50('0x35')]);_0x54c9f9[_0x3a50('0x37')]=_[_0x3a50('0x39')](_0x54c9f9['model'],_0x54c9f9['query']);_0x280a75[_0x3a50('0x38')]=_[_0x3a50('0x39')](_0x54c9f9['model'],qs[_0x3a50('0x3a')](_0x5a881b[_0x3a50('0x35')][_0x3a50('0x3a')]));_0x280a75[_0x3a50('0x38')]=_0x280a75['attributes'][_0x3a50('0x3b')]?_0x280a75[_0x3a50('0x38')]:_0x54c9f9[_0x3a50('0x34')];if(_0x5a881b[_0x3a50('0x35')][_0x3a50('0x46')]){_0x280a75[_0x3a50('0x47')]=[{'all':!![]}];}_0x280a75=_['merge']({},_0x280a75,_0x5a881b[_0x3a50('0x45')]);return db[_0x3a50('0x31')]['find'](_0x280a75)[_0x3a50('0x28')](handleEntityNotFound(_0x189f05,null))[_0x3a50('0x28')](respondWithResult(_0x189f05,null))[_0x3a50('0x49')](handleError(_0x189f05,null));};exports['create']=function(_0x139e7e,_0x341d99){return db['Campaign'][_0x3a50('0x4d')](_0x139e7e['body'],{})[_0x3a50('0x28')](function(_0x241569){var _0x3757d9=_0x139e7e[_0x3a50('0x4e')]['get']({'plain':!![]});if(!_0x3757d9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3757d9[_0x3a50('0x4f')]===_0x3a50('0x4e')){var _0x453901=_0x241569[_0x3a50('0x29')]({'plain':!![]});var _0x78a968='IvrCampaigns';return db[_0x3a50('0x50')][_0x3a50('0x51')]({'where':{'name':_0x78a968,'userProfileId':_0x3757d9[_0x3a50('0x52')]},'raw':!![]})[_0x3a50('0x28')](function(_0x39ce27){if(_0x39ce27&&_0x39ce27[_0x3a50('0x53')]===0x0){return db['UserProfileResource'][_0x3a50('0x4d')]({'name':_0x453901[_0x3a50('0x2e')],'resourceId':_0x453901['id'],'type':_0x39ce27['name'],'sectionId':_0x39ce27['id']},{})[_0x3a50('0x28')](function(){return _0x241569;});}else{return _0x241569;}})[_0x3a50('0x49')](function(_0x5a9a5e){logger[_0x3a50('0x54')](_0x3a50('0x55'),_0x5a9a5e);throw _0x5a9a5e;});}return _0x241569;})[_0x3a50('0x28')](respondWithResult(_0x341d99,0xc9))['catch'](handleError(_0x341d99,null));};exports['clone']=function(_0x33ebad,_0x38535a){var _0x1de526={'where':{'id':_0x33ebad[_0x3a50('0x4b')]['id']}},_0x194529={};_0x194529[_0x3a50('0x34')]=_[_0x3a50('0x36')](db[_0x3a50('0x31')][_0x3a50('0x4c')]);_0x1de526['attributes']=_['intersection'](_0x194529[_0x3a50('0x34')],qs[_0x3a50('0x3a')](_0x33ebad[_0x3a50('0x35')][_0x3a50('0x3a')]));_0x1de526['attributes']=_0x1de526[_0x3a50('0x38')][_0x3a50('0x3b')]?_0x1de526[_0x3a50('0x38')]:_0x194529['model'];if(_0x33ebad[_0x3a50('0x35')][_0x3a50('0x46')]){_0x1de526[_0x3a50('0x47')]=[{'all':!![]}];}_0x1de526=_[_0x3a50('0x42')]({},_0x1de526,_0x33ebad[_0x3a50('0x45')]);return db['Campaign'][_0x3a50('0x51')](_0x1de526)['then'](handleEntityNotFound(_0x38535a,null))[_0x3a50('0x28')](function(_0x4bd89f){if(_0x4bd89f){var _0x5204c5=_0x4bd89f['get']({'plain':!![]});_0x5204c5=qs[_0x3a50('0x56')](_0x5204c5,['id',_0x3a50('0x57'),_0x3a50('0x58')]);_0x33ebad[_0x3a50('0x59')]=_[_0x3a50('0x56')](_0x33ebad[_0x3a50('0x59')],['id',_0x3a50('0x57'),'updatedAt']);return db[_0x3a50('0x31')][_0x3a50('0x4d')](_[_0x3a50('0x42')](_0x5204c5,_0x33ebad[_0x3a50('0x59')]),{'include':_0x33ebad[_0x3a50('0x35')]['includeAll']?[{'all':!![]}]:undefined})[_0x3a50('0x28')](function(_0x2128b8){var _0x710df3=_0x33ebad[_0x3a50('0x4e')]['get']({'plain':!![]});if(!_0x710df3)throw new Error(_0x3a50('0x5a'));if(_0x710df3['role']===_0x3a50('0x4e')){var _0x3d246e=_0x2128b8[_0x3a50('0x29')]({'plain':!![]});var _0x45cc4d=_0x3a50('0x2a');return db['UserProfileSection'][_0x3a50('0x51')]({'where':{'name':_0x45cc4d,'userProfileId':_0x710df3[_0x3a50('0x52')]},'raw':!![]})[_0x3a50('0x28')](function(_0x3eb6f2){if(_0x3eb6f2&&_0x3eb6f2['autoAssociation']===0x0){return db[_0x3a50('0x2b')]['create']({'name':_0x3d246e['name'],'resourceId':_0x3d246e['id'],'type':_0x3eb6f2[_0x3a50('0x2e')],'sectionId':_0x3eb6f2['id']},{})[_0x3a50('0x28')](function(){return _0x2128b8;});}else{return _0x2128b8;}})['catch'](function(_0x4a7d82){logger['error'](_0x3a50('0x55'),_0x4a7d82);throw _0x4a7d82;});}return _0x2128b8;});}})['then'](respondWithResult(_0x38535a,0xc9))[_0x3a50('0x49')](handleError(_0x38535a,null));};exports[_0x3a50('0x26')]=function(_0x2cb0c6,_0x42065a){if(_0x2cb0c6[_0x3a50('0x59')]['id']){delete _0x2cb0c6[_0x3a50('0x59')]['id'];}return db[_0x3a50('0x31')]['find']({'where':{'id':_0x2cb0c6[_0x3a50('0x4b')]['id']}})[_0x3a50('0x28')](handleEntityNotFound(_0x42065a,null))['then'](saveUpdates(_0x2cb0c6[_0x3a50('0x59')],null))[_0x3a50('0x28')](respondWithResult(_0x42065a,null))[_0x3a50('0x49')](handleError(_0x42065a,null));};exports[_0x3a50('0x27')]=function(_0x5b3133,_0x32eb86){return db[_0x3a50('0x31')]['find']({'where':{'id':_0x5b3133['params']['id']}})[_0x3a50('0x28')](handleEntityNotFound(_0x32eb86,null))[_0x3a50('0x28')](removeEntity(_0x32eb86,null))[_0x3a50('0x49')](handleError(_0x32eb86,null));};exports[_0x3a50('0x5b')]=function(_0x4ed915,_0x374795,_0x5071e7){var _0x2fd2ed={'raw':!![],'where':{}};var _0x4b9049={};var _0x21ee47={'count':0x0,'rows':[]};return db['Campaign'][_0x3a50('0x5c')]({'where':{'id':_0x4ed915[_0x3a50('0x4b')]['id']}})['then'](handleEntityNotFound(_0x374795,null))[_0x3a50('0x28')](function(_0x3a688d){if(_0x3a688d){_0x4b9049['model']=_[_0x3a50('0x36')](db['CmHopper'][_0x3a50('0x4c')]);_0x4b9049[_0x3a50('0x35')]=_[_0x3a50('0x36')](_0x4ed915[_0x3a50('0x35')]);_0x4b9049['filters']=_['intersection'](_0x4b9049[_0x3a50('0x34')],_0x4b9049['query']);_0x2fd2ed[_0x3a50('0x38')]=_[_0x3a50('0x39')](_0x4b9049[_0x3a50('0x34')],qs[_0x3a50('0x3a')](_0x4ed915[_0x3a50('0x35')]['fields']));_0x2fd2ed[_0x3a50('0x38')]=_0x2fd2ed[_0x3a50('0x38')][_0x3a50('0x3b')]?_0x2fd2ed[_0x3a50('0x38')]:_0x4b9049[_0x3a50('0x34')];if(!_0x4ed915[_0x3a50('0x35')][_0x3a50('0x3c')](_0x3a50('0x3d'))){_0x2fd2ed[_0x3a50('0x20')]=qs[_0x3a50('0x20')](_0x4ed915[_0x3a50('0x35')]['limit']);_0x2fd2ed[_0x3a50('0x1d')]=qs[_0x3a50('0x1d')](_0x4ed915[_0x3a50('0x35')][_0x3a50('0x1d')]);}_0x2fd2ed[_0x3a50('0x3e')]=qs[_0x3a50('0x3f')](_0x4ed915[_0x3a50('0x35')][_0x3a50('0x3f')]);_0x2fd2ed['where']=qs[_0x3a50('0x37')](_[_0x3a50('0x5d')](_0x4ed915[_0x3a50('0x35')],_0x4b9049[_0x3a50('0x37')]));_0x2fd2ed[_0x3a50('0x41')][_0x3a50('0x5e')]=_0x3a688d['id'];if(_0x4ed915[_0x3a50('0x35')][_0x3a50('0x40')]){_0x2fd2ed['where']=_[_0x3a50('0x42')](_0x2fd2ed[_0x3a50('0x41')],{'$or':_[_0x3a50('0x30')](_0x2fd2ed[_0x3a50('0x38')],function(_0x47ae49){var _0x3a0752={};_0x3a0752[_0x47ae49]={'$like':'%'+_0x4ed915[_0x3a50('0x35')][_0x3a50('0x40')]+'%'};return _0x3a0752;})});}_0x2fd2ed=_[_0x3a50('0x42')]({},_0x2fd2ed,_0x4ed915[_0x3a50('0x45')]);return db[_0x3a50('0x5f')][_0x3a50('0x1f')]({'where':_0x2fd2ed['where']})[_0x3a50('0x28')](function(_0x4a11a3){_0x21ee47[_0x3a50('0x1f')]=_0x4a11a3;if(_0x4ed915[_0x3a50('0x35')][_0x3a50('0x46')]){_0x2fd2ed['include']=[{'all':!![]}];}return db['CmHopper'][_0x3a50('0x60')](_0x2fd2ed);})[_0x3a50('0x28')](function(_0x3d1070){_0x21ee47[_0x3a50('0x48')]=_0x3d1070;return _0x21ee47;});}})[_0x3a50('0x28')](respondWithFilteredResult(_0x374795,_0x2fd2ed))[_0x3a50('0x49')](handleError(_0x374795,null));};exports[_0x3a50('0x61')]=function(_0x5bf52a,_0x39a017,_0x3216c9){var _0x3f9e3f={'raw':!![],'where':{}};var _0x38cbf9={};var _0x8c5094={'count':0x0,'rows':[]};return db[_0x3a50('0x31')][_0x3a50('0x5c')]({'where':{'id':_0x5bf52a['params']['id']}})[_0x3a50('0x28')](handleEntityNotFound(_0x39a017,null))['then'](function(_0x3dafd1){if(_0x3dafd1){_0x38cbf9[_0x3a50('0x34')]=_[_0x3a50('0x36')](db['CmHopperHistory'][_0x3a50('0x4c')]);_0x38cbf9[_0x3a50('0x35')]=_[_0x3a50('0x36')](_0x5bf52a[_0x3a50('0x35')]);_0x38cbf9[_0x3a50('0x37')]=_['intersection'](_0x38cbf9[_0x3a50('0x34')],_0x38cbf9['query']);_0x3f9e3f[_0x3a50('0x38')]=_['intersection'](_0x38cbf9['model'],qs[_0x3a50('0x3a')](_0x5bf52a[_0x3a50('0x35')]['fields']));_0x3f9e3f['attributes']=_0x3f9e3f[_0x3a50('0x38')][_0x3a50('0x3b')]?_0x3f9e3f['attributes']:_0x38cbf9['model'];if(!_0x5bf52a[_0x3a50('0x35')]['hasOwnProperty'](_0x3a50('0x3d'))){_0x3f9e3f['limit']=qs[_0x3a50('0x20')](_0x5bf52a['query'][_0x3a50('0x20')]);_0x3f9e3f[_0x3a50('0x1d')]=qs['offset'](_0x5bf52a[_0x3a50('0x35')][_0x3a50('0x1d')]);}_0x3f9e3f['order']=qs[_0x3a50('0x3f')](_0x5bf52a[_0x3a50('0x35')][_0x3a50('0x3f')]);_0x3f9e3f[_0x3a50('0x41')]=qs[_0x3a50('0x37')](_['pick'](_0x5bf52a[_0x3a50('0x35')],_0x38cbf9['filters']));_0x3f9e3f['where'][_0x3a50('0x5e')]=_0x3dafd1['id'];if(_0x5bf52a[_0x3a50('0x35')][_0x3a50('0x40')]){_0x3f9e3f[_0x3a50('0x41')]=_[_0x3a50('0x42')](_0x3f9e3f[_0x3a50('0x41')],{'$or':_[_0x3a50('0x30')](_0x3f9e3f[_0x3a50('0x38')],function(_0x88e0c8){var _0x581223={};_0x581223[_0x88e0c8]={'$like':'%'+_0x5bf52a[_0x3a50('0x35')][_0x3a50('0x40')]+'%'};return _0x581223;})});}_0x3f9e3f=_['merge']({},_0x3f9e3f,_0x5bf52a['options']);return db[_0x3a50('0x62')][_0x3a50('0x1f')]({'where':_0x3f9e3f['where']})['then'](function(_0x1bdcf3){_0x8c5094[_0x3a50('0x1f')]=_0x1bdcf3;if(_0x5bf52a[_0x3a50('0x35')][_0x3a50('0x46')]){_0x3f9e3f[_0x3a50('0x47')]=[{'all':!![]}];}return db[_0x3a50('0x62')][_0x3a50('0x60')](_0x3f9e3f);})['then'](function(_0x44af97){_0x8c5094[_0x3a50('0x48')]=_0x44af97;return _0x8c5094;});}})[_0x3a50('0x28')](respondWithFilteredResult(_0x39a017,_0x3f9e3f))['catch'](handleError(_0x39a017,null));};exports[_0x3a50('0x63')]=function(_0x1e5057,_0x4009ba,_0x4da9b5){var _0x3a48b3={'raw':!![],'where':{}};var _0x279747={};var _0x557314={'count':0x0,'rows':[]};return db[_0x3a50('0x31')][_0x3a50('0x5c')]({'where':{'id':_0x1e5057['params']['id']}})['then'](handleEntityNotFound(_0x4009ba,null))[_0x3a50('0x28')](function(_0x58454e){if(_0x58454e){_0x279747[_0x3a50('0x34')]=_['keys'](db[_0x3a50('0x64')][_0x3a50('0x4c')]);_0x279747[_0x3a50('0x35')]=_[_0x3a50('0x36')](_0x1e5057[_0x3a50('0x35')]);_0x279747[_0x3a50('0x37')]=_[_0x3a50('0x39')](_0x279747[_0x3a50('0x34')],_0x279747['query']);_0x3a48b3[_0x3a50('0x38')]=_['intersection'](_0x279747[_0x3a50('0x34')],qs[_0x3a50('0x3a')](_0x1e5057[_0x3a50('0x35')]['fields']));_0x3a48b3[_0x3a50('0x38')]=_0x3a48b3['attributes'][_0x3a50('0x3b')]?_0x3a48b3[_0x3a50('0x38')]:_0x279747[_0x3a50('0x34')];if(!_0x1e5057['query'][_0x3a50('0x3c')]('nolimit')){_0x3a48b3[_0x3a50('0x20')]=qs[_0x3a50('0x20')](_0x1e5057[_0x3a50('0x35')][_0x3a50('0x20')]);_0x3a48b3['offset']=qs[_0x3a50('0x1d')](_0x1e5057['query'][_0x3a50('0x1d')]);}_0x3a48b3[_0x3a50('0x3e')]=qs['sort'](_0x1e5057['query'][_0x3a50('0x3f')]);_0x3a48b3[_0x3a50('0x41')]=qs[_0x3a50('0x37')](_[_0x3a50('0x5d')](_0x1e5057[_0x3a50('0x35')],_0x279747[_0x3a50('0x37')]));_0x3a48b3['where'][_0x3a50('0x5e')]=_0x58454e['id'];if(_0x1e5057['query'][_0x3a50('0x40')]){_0x3a48b3[_0x3a50('0x41')]=_[_0x3a50('0x42')](_0x3a48b3[_0x3a50('0x41')],{'$or':_[_0x3a50('0x30')](_0x3a48b3['attributes'],function(_0x5ee7ae){var _0x20fba1={};_0x20fba1[_0x5ee7ae]={'$like':'%'+_0x1e5057[_0x3a50('0x35')][_0x3a50('0x40')]+'%'};return _0x20fba1;})});}_0x3a48b3=_[_0x3a50('0x42')]({},_0x3a48b3,_0x1e5057[_0x3a50('0x45')]);return db[_0x3a50('0x64')][_0x3a50('0x1f')]({'where':_0x3a48b3['where']})['then'](function(_0x2b1fbe){_0x557314['count']=_0x2b1fbe;if(_0x1e5057[_0x3a50('0x35')][_0x3a50('0x46')]){_0x3a48b3[_0x3a50('0x47')]=[{'all':!![]}];}return db[_0x3a50('0x64')][_0x3a50('0x60')](_0x3a48b3);})[_0x3a50('0x28')](function(_0x4e9ab8){_0x557314[_0x3a50('0x48')]=_0x4e9ab8;return _0x557314;});}})[_0x3a50('0x28')](respondWithFilteredResult(_0x4009ba,_0x3a48b3))['catch'](handleError(_0x4009ba,null));};exports[_0x3a50('0x65')]=function(_0x5f4062,_0x21ecc8,_0x2e34b8){var _0x53a62f={'raw':!![],'where':{}};var _0x243890={};var _0x2e8ee6={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x5f4062[_0x3a50('0x4b')]['id']}})[_0x3a50('0x28')](handleEntityNotFound(_0x21ecc8,null))[_0x3a50('0x28')](function(_0x365c8d){if(_0x365c8d){_0x243890[_0x3a50('0x34')]=_[_0x3a50('0x36')](db[_0x3a50('0x66')]['rawAttributes']);_0x243890[_0x3a50('0x35')]=_[_0x3a50('0x36')](_0x5f4062[_0x3a50('0x35')]);_0x243890[_0x3a50('0x37')]=_[_0x3a50('0x39')](_0x243890[_0x3a50('0x34')],_0x243890['query']);_0x53a62f[_0x3a50('0x38')]=_[_0x3a50('0x39')](_0x243890[_0x3a50('0x34')],qs[_0x3a50('0x3a')](_0x5f4062[_0x3a50('0x35')][_0x3a50('0x3a')]));_0x53a62f[_0x3a50('0x38')]=_0x53a62f['attributes'][_0x3a50('0x3b')]?_0x53a62f[_0x3a50('0x38')]:_0x243890[_0x3a50('0x34')];if(!_0x5f4062[_0x3a50('0x35')][_0x3a50('0x3c')](_0x3a50('0x3d'))){_0x53a62f[_0x3a50('0x20')]=qs[_0x3a50('0x20')](_0x5f4062[_0x3a50('0x35')][_0x3a50('0x20')]);_0x53a62f[_0x3a50('0x1d')]=qs['offset'](_0x5f4062[_0x3a50('0x35')][_0x3a50('0x1d')]);}_0x53a62f[_0x3a50('0x3e')]=qs[_0x3a50('0x3f')](_0x5f4062[_0x3a50('0x35')][_0x3a50('0x3f')]);_0x53a62f[_0x3a50('0x41')]=qs[_0x3a50('0x37')](_[_0x3a50('0x5d')](_0x5f4062[_0x3a50('0x35')],_0x243890[_0x3a50('0x37')]));_0x53a62f[_0x3a50('0x41')][_0x3a50('0x5e')]=_0x365c8d['id'];if(_0x5f4062[_0x3a50('0x35')][_0x3a50('0x40')]){_0x53a62f[_0x3a50('0x41')]=_['merge'](_0x53a62f[_0x3a50('0x41')],{'$or':_[_0x3a50('0x30')](_0x53a62f['attributes'],function(_0x538deb){var _0x15c5e6={};_0x15c5e6[_0x538deb]={'$like':'%'+_0x5f4062[_0x3a50('0x35')]['filter']+'%'};return _0x15c5e6;})});}_0x53a62f=_['merge']({},_0x53a62f,_0x5f4062[_0x3a50('0x45')]);return db[_0x3a50('0x66')][_0x3a50('0x1f')]({'where':_0x53a62f[_0x3a50('0x41')]})[_0x3a50('0x28')](function(_0x3d647f){_0x2e8ee6[_0x3a50('0x1f')]=_0x3d647f;if(_0x5f4062[_0x3a50('0x35')][_0x3a50('0x46')]){_0x53a62f['include']=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x53a62f);})['then'](function(_0x155b65){_0x2e8ee6[_0x3a50('0x48')]=_0x155b65;return _0x2e8ee6;});}})[_0x3a50('0x28')](respondWithFilteredResult(_0x21ecc8,_0x53a62f))['catch'](handleError(_0x21ecc8,null));};exports[_0x3a50('0x67')]=function(_0x128de7,_0x566136,_0x9463db){var _0x46d253={};var _0x226fa1={};var _0x4ba626;var _0x18ae63;return db['Campaign']['findOne']({'where':{'id':_0x128de7[_0x3a50('0x4b')]['id']}})[_0x3a50('0x28')](handleEntityNotFound(_0x566136,null))['then'](function(_0x414165){if(_0x414165){_0x4ba626=_0x414165;_0x226fa1['model']=_[_0x3a50('0x36')](db[_0x3a50('0x68')]['rawAttributes']);_0x226fa1[_0x3a50('0x35')]=_[_0x3a50('0x36')](_0x128de7[_0x3a50('0x35')]);_0x226fa1['filters']=_['intersection'](_0x226fa1[_0x3a50('0x34')],_0x226fa1[_0x3a50('0x35')]);_0x46d253[_0x3a50('0x38')]=_[_0x3a50('0x39')](_0x226fa1[_0x3a50('0x34')],qs[_0x3a50('0x3a')](_0x128de7[_0x3a50('0x35')][_0x3a50('0x3a')]));_0x46d253['attributes']=_0x46d253[_0x3a50('0x38')][_0x3a50('0x3b')]?_0x46d253[_0x3a50('0x38')]:_0x226fa1['model'];_0x46d253['order']=qs[_0x3a50('0x3f')](_0x128de7['query'][_0x3a50('0x3f')]);_0x46d253[_0x3a50('0x41')]=qs['filters'](_[_0x3a50('0x5d')](_0x128de7[_0x3a50('0x35')],_0x226fa1[_0x3a50('0x37')]));if(_0x128de7[_0x3a50('0x35')][_0x3a50('0x40')]){_0x46d253[_0x3a50('0x41')]=_[_0x3a50('0x42')](_0x46d253[_0x3a50('0x41')],{'$or':_[_0x3a50('0x30')](_0x46d253[_0x3a50('0x38')],function(_0x36da64){var _0x4bbb7a={};_0x4bbb7a[_0x36da64]={'$like':'%'+_0x128de7[_0x3a50('0x35')][_0x3a50('0x40')]+'%'};return _0x4bbb7a;})});}_0x46d253=_[_0x3a50('0x42')]({},_0x46d253,_0x128de7[_0x3a50('0x45')]);return _0x4ba626[_0x3a50('0x67')](_0x46d253);}})[_0x3a50('0x28')](function(_0x35950f){if(_0x35950f){_0x18ae63=_0x35950f[_0x3a50('0x3b')];if(!_0x128de7['query'][_0x3a50('0x3c')](_0x3a50('0x3d'))){_0x46d253[_0x3a50('0x20')]=qs[_0x3a50('0x20')](_0x128de7['query'][_0x3a50('0x20')]);_0x46d253[_0x3a50('0x1d')]=qs[_0x3a50('0x1d')](_0x128de7['query'][_0x3a50('0x1d')]);}return _0x4ba626[_0x3a50('0x67')](_0x46d253);}})['then'](function(_0x17e6fb){if(_0x17e6fb){return _0x17e6fb?{'count':_0x18ae63,'rows':_0x17e6fb}:null;}})['then'](respondWithResult(_0x566136,null))[_0x3a50('0x49')](handleError(_0x566136,null));};exports[_0x3a50('0x69')]=function(_0x4d8efe,_0x526ee7,_0x1861e4){var _0x192855,_0x5d1c7a;var _0x37cfdd=[];var _0x1ae0d1=moment()[_0x3a50('0x6a')]('YYYY-MM-DD\x20HH:mm:ss');return db['Campaign'][_0x3a50('0x51')]({'where':{'id':_0x4d8efe['params']['id']}})[_0x3a50('0x28')](handleEntityNotFound(_0x526ee7,null))[_0x3a50('0x28')](function(_0x392e20){if(_0x392e20){_0x5d1c7a=_0x392e20;return _0x392e20['addLists'](_0x4d8efe[_0x3a50('0x59')][_0x3a50('0x6b')],_['omit'](_0x4d8efe[_0x3a50('0x59')],[_0x3a50('0x6b'),'id'])||{});}return null;})[_0x3a50('0x6c')](function(_0x246d26){var _0x12f4df;var _0x29a628;_0x192855=_0x246d26||[];var _0x281c68=[];if(_0x246d26){for(var _0x3e6922=0x0;_0x3e6922<_0x246d26[_0x3a50('0x3b')];_0x3e6922+=0x1){var _0xc1c7f9=_0x246d26[_0x3e6922][_0x3a50('0x29')]({'plain':!![]});_0x5d1c7a[_0x3a50('0x6d')]=_0x4d8efe[_0x3a50('0x59')][_0x3a50('0x6d')]?_0x4d8efe[_0x3a50('0x59')][_0x3a50('0x6d')]:_0x5d1c7a[_0x3a50('0x6d')];switch(_0x5d1c7a[_0x3a50('0x6d')]){case'always':_0x12f4df=squel[_0x3a50('0x6e')]()['into'](_0x3a50('0x6f'))[_0x3a50('0x70')](['phone',_0x3a50('0x71'),'ContactId',_0x3a50('0x72'),_0x3a50('0x5e'),_0x3a50('0x57'),_0x3a50('0x58')],squel['select']()[_0x3a50('0x73')](_0x3a50('0x74'),_0x3a50('0x74'))['field'](_0x3a50('0x75'),_0x3a50('0x71'))[_0x3a50('0x73')]('id',_0x3a50('0x76'))[_0x3a50('0x73')](_0xc1c7f9[_0x3a50('0x77')]['toString'](),_0x3a50('0x72'))[_0x3a50('0x73')](_0x4d8efe[_0x3a50('0x4b')]['id'][_0x3a50('0x78')](),_0x3a50('0x5e'))[_0x3a50('0x73')]('\x27'+_0x1ae0d1+'\x27',_0x3a50('0x57'))[_0x3a50('0x73')]('\x27'+_0x1ae0d1+'\x27',_0x3a50('0x58'))[_0x3a50('0x79')](_0x3a50('0x7a'))[_0x3a50('0x41')](_0x3a50('0x7b'))[_0x3a50('0x41')](_0x3a50('0x7c'),_0xc1c7f9['CmListId'][_0x3a50('0x78')]())[_0x3a50('0x41')](_0x3a50('0x7d'))[_0x3a50('0x41')](_0x3a50('0x7e'),squel[_0x3a50('0x7f')]()[_0x3a50('0x73')](_0x3a50('0x80'))[_0x3a50('0x79')](_0x3a50('0x81'))['where'](_0x3a50('0x82'),_0x4d8efe[_0x3a50('0x4b')]['id']['toString']()))[_0x3a50('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0x3a50('0x7f')]()[_0x3a50('0x73')]('COALESCE(phone,\x27\x27)')[_0x3a50('0x79')](_0x3a50('0x6f'))['where'](_0x3a50('0x82'),_0x4d8efe[_0x3a50('0x4b')]['id']['toString']())))[_0x3a50('0x78')]();break;case _0x3a50('0x83'):_0x12f4df=squel['insert']()[_0x3a50('0x84')](_0x3a50('0x6f'))[_0x3a50('0x70')]([_0x3a50('0x74'),_0x3a50('0x71'),_0x3a50('0x76'),_0x3a50('0x72'),'CampaignId',_0x3a50('0x57'),_0x3a50('0x58')],squel[_0x3a50('0x7f')]()['field'](_0x3a50('0x74'),_0x3a50('0x74'))['field'](_0x3a50('0x75'),'scheduledAt')[_0x3a50('0x73')]('id','ContactId')[_0x3a50('0x73')](_0xc1c7f9['CmListId'][_0x3a50('0x78')](),'ListId')[_0x3a50('0x73')](_0x4d8efe[_0x3a50('0x4b')]['id'][_0x3a50('0x78')](),'CampaignId')[_0x3a50('0x73')]('\x27'+_0x1ae0d1+'\x27',_0x3a50('0x57'))[_0x3a50('0x73')]('\x27'+_0x1ae0d1+'\x27',_0x3a50('0x58'))['from'](_0x3a50('0x7a'))[_0x3a50('0x41')](_0x3a50('0x7b'))[_0x3a50('0x41')](_0x3a50('0x7c'),_0xc1c7f9[_0x3a50('0x77')][_0x3a50('0x78')]())[_0x3a50('0x41')](_0x3a50('0x7d'))[_0x3a50('0x41')](_0x3a50('0x7e'),squel['select']()[_0x3a50('0x73')](_0x3a50('0x85'))[_0x3a50('0x79')](_0x3a50('0x6f'))['where']('CampaignId\x20=\x20?',_0x4d8efe[_0x3a50('0x4b')]['id'][_0x3a50('0x78')]())))['toString']();break;default:_0x12f4df=squel[_0x3a50('0x6e')]()['into']('cm_hopper')[_0x3a50('0x70')]([_0x3a50('0x74'),_0x3a50('0x71'),_0x3a50('0x76'),_0x3a50('0x72'),_0x3a50('0x5e'),_0x3a50('0x57'),_0x3a50('0x58')],squel[_0x3a50('0x7f')]()[_0x3a50('0x73')](_0x3a50('0x74'),'phone')[_0x3a50('0x73')](_0x3a50('0x75'),_0x3a50('0x71'))[_0x3a50('0x73')]('id',_0x3a50('0x76'))[_0x3a50('0x73')](_0xc1c7f9[_0x3a50('0x77')]['toString'](),'ListId')['field'](_0x4d8efe[_0x3a50('0x4b')]['id'][_0x3a50('0x78')](),_0x3a50('0x5e'))['field']('\x27'+_0x1ae0d1+'\x27',_0x3a50('0x57'))[_0x3a50('0x73')]('\x27'+_0x1ae0d1+'\x27',_0x3a50('0x58'))[_0x3a50('0x79')](_0x3a50('0x7a'))[_0x3a50('0x41')](_0x3a50('0x7b'))['where']('ListId\x20=\x20?',_0xc1c7f9[_0x3a50('0x77')][_0x3a50('0x78')]())[_0x3a50('0x41')](_0x3a50('0x7d')))[_0x3a50('0x78')]();}_0x29a628=squel[_0x3a50('0x6e')]()['into'](_0x3a50('0x86'))[_0x3a50('0x70')]([_0x3a50('0x87'),_0x3a50('0x71'),'phone',_0x3a50('0x88'),_0x3a50('0x57'),'updatedAt'],squel[_0x3a50('0x7f')]()['field'](_0x3a50('0x89'),'id')[_0x3a50('0x73')]('NOW()','scheduledAt')[_0x3a50('0x73')](_0x3a50('0x8a'),_0x3a50('0x74'))['field'](_0x3a50('0x8b'),_0x3a50('0x88'))[_0x3a50('0x73')]('\x27'+_0x1ae0d1+'\x27','createdAt')[_0x3a50('0x73')]('\x27'+_0x1ae0d1+'\x27','updatedAt')[_0x3a50('0x79')]('cm_contact_has_items','ci')[_0x3a50('0x8c')](_0x3a50('0x6f'),'h',_0x3a50('0x8d'))[_0x3a50('0x41')](_0x3a50('0x8e'),_0xc1c7f9[_0x3a50('0x77')][_0x3a50('0x78')]())[_0x3a50('0x41')](_0x3a50('0x8f'),_0x4d8efe['params']['id'][_0x3a50('0x78')]())[_0x3a50('0x41')](_0x3a50('0x90'),_0x1ae0d1))[_0x3a50('0x78')]();_0x281c68[_0x3a50('0x91')](db[_0x3a50('0x92')]['query'](_0x12f4df));_0x37cfdd[_0x3a50('0x91')](db['sequelize'][_0x3a50('0x35')](_0x29a628));}return BPromise[_0x3a50('0x93')](_0x281c68);}})['then'](function(){return BPromise[_0x3a50('0x93')](_0x37cfdd);})[_0x3a50('0x28')](function(){return _0x192855;})[_0x3a50('0x28')](respondWithResult(_0x526ee7,null))[_0x3a50('0x49')](handleError(_0x526ee7,null));};exports[_0x3a50('0x94')]=function(_0x516089,_0x31cad4,_0x4188d4){return db['Campaign']['find']({'where':{'id':_0x516089[_0x3a50('0x4b')]['id']}})[_0x3a50('0x28')](handleEntityNotFound(_0x31cad4,null))[_0x3a50('0x28')](function(_0x46c2da){if(_0x46c2da){return _0x46c2da[_0x3a50('0x94')](_0x516089[_0x3a50('0x35')][_0x3a50('0x6b')]);}})[_0x3a50('0x28')](function(_0xa45573){if(_0xa45573){return db[_0x3a50('0x5f')][_0x3a50('0x27')]({'where':{'ListId':_0x516089[_0x3a50('0x35')][_0x3a50('0x6b')],'CampaignId':_0x516089[_0x3a50('0x4b')]['id']}})['then'](function(){return _0xa45573;});}})[_0x3a50('0x28')](respondWithStatusCode(_0x31cad4,null))[_0x3a50('0x49')](handleError(_0x31cad4,null));};exports['getBlackLists']=function(_0xab39df,_0x59a14f,_0x26018e){var _0x4bbb39={};var _0x4b552d={};var _0x4af0db;var _0x6f29cc;return db[_0x3a50('0x31')][_0x3a50('0x5c')]({'where':{'id':_0xab39df[_0x3a50('0x4b')]['id']}})[_0x3a50('0x28')](handleEntityNotFound(_0x59a14f,null))[_0x3a50('0x28')](function(_0x4da73c){if(_0x4da73c){_0x4af0db=_0x4da73c;_0x4b552d[_0x3a50('0x34')]=_[_0x3a50('0x36')](db[_0x3a50('0x68')][_0x3a50('0x4c')]);_0x4b552d['query']=_['keys'](_0xab39df['query']);_0x4b552d['filters']=_[_0x3a50('0x39')](_0x4b552d['model'],_0x4b552d[_0x3a50('0x35')]);_0x4bbb39[_0x3a50('0x38')]=_['intersection'](_0x4b552d[_0x3a50('0x34')],qs[_0x3a50('0x3a')](_0xab39df[_0x3a50('0x35')]['fields']));_0x4bbb39['attributes']=_0x4bbb39[_0x3a50('0x38')][_0x3a50('0x3b')]?_0x4bbb39['attributes']:_0x4b552d[_0x3a50('0x34')];_0x4bbb39[_0x3a50('0x3e')]=qs[_0x3a50('0x3f')](_0xab39df[_0x3a50('0x35')][_0x3a50('0x3f')]);_0x4bbb39[_0x3a50('0x41')]=qs[_0x3a50('0x37')](_[_0x3a50('0x5d')](_0xab39df[_0x3a50('0x35')],_0x4b552d[_0x3a50('0x37')]));if(_0xab39df[_0x3a50('0x35')][_0x3a50('0x40')]){_0x4bbb39[_0x3a50('0x41')]=_['merge'](_0x4bbb39[_0x3a50('0x41')],{'$or':_[_0x3a50('0x30')](_0x4bbb39[_0x3a50('0x38')],function(_0x10ea04){var _0x303e64={};_0x303e64[_0x10ea04]={'$like':'%'+_0xab39df['query'][_0x3a50('0x40')]+'%'};return _0x303e64;})});}_0x4bbb39=_[_0x3a50('0x42')]({},_0x4bbb39,_0xab39df[_0x3a50('0x45')]);return _0x4af0db['getBlackLists'](_0x4bbb39);}})[_0x3a50('0x28')](function(_0x4ce299){if(_0x4ce299){_0x6f29cc=_0x4ce299[_0x3a50('0x3b')];if(!_0xab39df[_0x3a50('0x35')][_0x3a50('0x3c')](_0x3a50('0x3d'))){_0x4bbb39[_0x3a50('0x20')]=qs['limit'](_0xab39df[_0x3a50('0x35')][_0x3a50('0x20')]);_0x4bbb39['offset']=qs['offset'](_0xab39df['query'][_0x3a50('0x1d')]);}return _0x4af0db['getBlackLists'](_0x4bbb39);}})[_0x3a50('0x28')](function(_0x29ecb7){if(_0x29ecb7){return _0x29ecb7?{'count':_0x6f29cc,'rows':_0x29ecb7}:null;}})[_0x3a50('0x28')](respondWithResult(_0x59a14f,null))['catch'](handleError(_0x59a14f,null));};exports['addBlackLists']=function(_0xd90324,_0x442703,_0x4bd5d8){var _0x355594,_0x4bdd23;var _0x3a8dc1=[];var _0x4a2d08=moment()[_0x3a50('0x6a')](_0x3a50('0x95'));return db['Campaign']['find']({'where':{'id':_0xd90324[_0x3a50('0x4b')]['id']}})['then'](handleEntityNotFound(_0x442703,null))[_0x3a50('0x28')](function(_0x320e34){if(_0x320e34){_0x4bdd23=_0x320e34;return _0x320e34[_0x3a50('0x96')](_0xd90324[_0x3a50('0x59')][_0x3a50('0x6b')],_[_0x3a50('0x56')](_0xd90324[_0x3a50('0x59')],[_0x3a50('0x6b'),'id'])||{});}return null;})[_0x3a50('0x6c')](function(_0x16f4e2){var _0x251423;var _0x5d54b6;_0x355594=_0x16f4e2||[];var _0x5888d2=[];if(_0x16f4e2){for(var _0x53e4e2=0x0;_0x53e4e2<_0x16f4e2[_0x3a50('0x3b')];_0x53e4e2+=0x1){var _0x4b493d=_0x16f4e2[_0x53e4e2]['get']({'plain':!![]});_0x251423=squel['insert']()[_0x3a50('0x84')]('cm_hopper_black')[_0x3a50('0x70')](['phone',_0x3a50('0x76'),_0x3a50('0x72'),_0x3a50('0x5e'),_0x3a50('0x57'),_0x3a50('0x58')],squel[_0x3a50('0x7f')]()[_0x3a50('0x73')](_0x3a50('0x74'),_0x3a50('0x74'))[_0x3a50('0x73')]('id',_0x3a50('0x76'))[_0x3a50('0x73')](_0x4b493d[_0x3a50('0x77')]['toString'](),_0x3a50('0x72'))[_0x3a50('0x73')](_0xd90324[_0x3a50('0x4b')]['id'][_0x3a50('0x78')](),_0x3a50('0x5e'))['field'](_0x3a50('0x75'),_0x3a50('0x57'))['field'](_0x3a50('0x75'),_0x3a50('0x58'))[_0x3a50('0x79')]('cm_contacts')[_0x3a50('0x41')](_0x3a50('0x7b'))[_0x3a50('0x41')](_0x3a50('0x7c'),_0x4b493d[_0x3a50('0x77')]['toString']())[_0x3a50('0x41')]('phone\x20IS\x20NOT\x20NULL'))[_0x3a50('0x78')]();_0x5888d2[_0x3a50('0x91')](db[_0x3a50('0x92')][_0x3a50('0x35')](_0x251423));}return BPromise[_0x3a50('0x93')](_0x5888d2);}})[_0x3a50('0x28')](function(){return _0x355594;})[_0x3a50('0x28')](respondWithResult(_0x442703,null))[_0x3a50('0x49')](handleError(_0x442703,null));};exports[_0x3a50('0x97')]=function(_0x3582cd,_0x288de7,_0x368d0a){return db['Campaign'][_0x3a50('0x51')]({'where':{'id':_0x3582cd[_0x3a50('0x4b')]['id']}})[_0x3a50('0x28')](handleEntityNotFound(_0x288de7,null))['then'](function(_0x30e8de){if(_0x30e8de){return _0x30e8de['removeBlackLists'](_0x3582cd[_0x3a50('0x35')][_0x3a50('0x6b')]);}})['then'](function(_0x3a151e){if(_0x3a151e){return db['CmHopperBlack'][_0x3a50('0x27')]({'where':{'ListId':_0x3582cd['query'][_0x3a50('0x6b')],'CampaignId':_0x3582cd[_0x3a50('0x4b')]['id']}})[_0x3a50('0x28')](function(){return _0x3a151e;});}})[_0x3a50('0x28')](respondWithStatusCode(_0x288de7,null))['catch'](handleError(_0x288de7,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index d945f9b..7ac9983 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(_0x59f638,_0x45a5d0){var _0x348cfc=function(_0x5a5760){while(--_0x5a5760){_0x59f638['push'](_0x59f638['shift']());}};_0x348cfc(++_0x45a5d0);}(_0x7a54,0x106));var _0x47a5=function(_0xd3f3f4,_0x4ebd90){_0xd3f3f4=_0xd3f3f4-0x0;var _0x1b27d9=_0x7a54[_0xd3f3f4];return _0x1b27d9;};'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 _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 8ebd6ed..3e8f37f 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 _0x80c7=['result','catch','GetCampaign','Campaign','findAll','options','raw','attributes','limit','include','map','model','info','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','Campaign,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x2583a8,_0x4130a5){var _0x51b92a=function(_0x3c6ba0){while(--_0x3c6ba0){_0x2583a8['push'](_0x2583a8['shift']());}};_0x51b92a(++_0x4130a5);}(_0x80c7,0x8d));var _0x780c=function(_0x444a1f,_0x22127b){_0x444a1f=_0x444a1f-0x0;var _0x5dec75=_0x80c7[_0x444a1f];return _0x5dec75;};'use strict';var _=require(_0x780c('0x0'));var util=require(_0x780c('0x1'));var moment=require(_0x780c('0x2'));var BPromise=require(_0x780c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x780c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x780c('0x5'))(_0x780c('0x6'));var config=require(_0x780c('0x7'));var jayson=require(_0x780c('0x8'));var client=jayson[_0x780c('0x9')][_0x780c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4170ef,_0x269976,_0x4041cb){return new BPromise(function(_0x2d858f,_0x1d87ca){return client['request'](_0x4170ef,_0x4041cb)[_0x780c('0xb')](function(_0x3411de){logger['info'](_0x780c('0xc'),_0x269976,_0x780c('0xd'));logger[_0x780c('0xe')]('Campaign,\x20%s,\x20%s,\x20%s',_0x269976,_0x780c('0xd'),JSON[_0x780c('0xf')](_0x3411de));if(_0x3411de[_0x780c('0x10')]){if(_0x3411de[_0x780c('0x10')][_0x780c('0x11')]===0x1f4){logger[_0x780c('0x10')](_0x780c('0xc'),_0x269976,_0x3411de[_0x780c('0x10')][_0x780c('0x12')]);return _0x1d87ca(_0x3411de[_0x780c('0x10')][_0x780c('0x12')]);}logger[_0x780c('0x10')]('Campaign,\x20%s,\x20%s',_0x269976,_0x3411de['error'][_0x780c('0x12')]);return _0x2d858f(_0x3411de[_0x780c('0x10')]['message']);}else{logger['info'](_0x780c('0xc'),_0x269976,_0x780c('0xd'));_0x2d858f(_0x3411de[_0x780c('0x13')][_0x780c('0x12')]);}})[_0x780c('0x14')](function(_0x33c514){logger['error'](_0x780c('0xc'),_0x269976,_0x33c514);_0x1d87ca(_0x33c514);});});}exports[_0x780c('0x15')]=function(_0x2127e2){var _0x2dbcd8=this;return new Promise(function(_0x48e6fe,_0xcd171e){return db[_0x780c('0x16')][_0x780c('0x17')]({'raw':_0x2127e2[_0x780c('0x18')]?_0x2127e2['options'][_0x780c('0x19')]===undefined?!![]:![]:!![],'where':_0x2127e2[_0x780c('0x18')]?_0x2127e2['options']['where']||null:null,'attributes':_0x2127e2['options']?_0x2127e2[_0x780c('0x18')][_0x780c('0x1a')]||null:null,'limit':_0x2127e2[_0x780c('0x18')]?_0x2127e2[_0x780c('0x18')][_0x780c('0x1b')]||null:null,'include':_0x2127e2[_0x780c('0x18')]?_0x2127e2[_0x780c('0x18')][_0x780c('0x1c')]?_[_0x780c('0x1d')](_0x2127e2[_0x780c('0x18')][_0x780c('0x1c')],function(_0x55fc81){return{'model':db[_0x55fc81[_0x780c('0x1e')]],'as':_0x55fc81['as'],'attributes':_0x55fc81[_0x780c('0x1a')],'include':_0x55fc81[_0x780c('0x1c')]?_['map'](_0x55fc81[_0x780c('0x1c')],function(_0x121199){return{'model':db[_0x121199[_0x780c('0x1e')]],'as':_0x121199['as'],'attributes':_0x121199[_0x780c('0x1a')],'include':_0x121199[_0x780c('0x1c')]?_[_0x780c('0x1d')](_0x121199['include'],function(_0x1cb65e){return{'model':db[_0x1cb65e[_0x780c('0x1e')]],'as':_0x1cb65e['as'],'attributes':_0x1cb65e[_0x780c('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d9702){logger[_0x780c('0x1f')](_0x780c('0x15'),_0x2127e2);logger[_0x780c('0xe')](_0x780c('0x15'),_0x2127e2,JSON[_0x780c('0xf')](_0x2d9702));_0x48e6fe(_0x2d9702);})[_0x780c('0x14')](function(_0x35b97a){logger[_0x780c('0x10')](_0x780c('0x15'),_0x35b97a[_0x780c('0x12')],_0x2127e2);_0xcd171e(_0x2dbcd8[_0x780c('0x10')](0x1f4,_0x35b97a[_0x780c('0x12')]));});});}; \ No newline at end of file +var _0x2a41=['Campaign,\x20%s,\x20%s','message','result','catch','GetCampaign','Campaign','options','raw','where','limit','map','include','attributes','model','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x56ed36,_0x266cef){var _0x28e12f=function(_0x26d8ed){while(--_0x26d8ed){_0x56ed36['push'](_0x56ed36['shift']());}};_0x28e12f(++_0x266cef);}(_0x2a41,0x126));var _0x12a4=function(_0x51fb3c,_0x28a763){_0x51fb3c=_0x51fb3c-0x0;var _0x941d96=_0x2a41[_0x51fb3c];return _0x941d96;};'use strict';var _=require(_0x12a4('0x0'));var util=require('util');var moment=require(_0x12a4('0x1'));var BPromise=require(_0x12a4('0x2'));var rs=require(_0x12a4('0x3'));var fs=require('fs');var Redis=require(_0x12a4('0x4'));var db=require(_0x12a4('0x5'))['db'];var utils=require(_0x12a4('0x6'));var logger=require(_0x12a4('0x7'))(_0x12a4('0x8'));var config=require(_0x12a4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x12a4('0xa')][_0x12a4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58fffc,_0x5d2353,_0x2042cc){return new BPromise(function(_0x5ae867,_0x23bb59){return client[_0x12a4('0xc')](_0x58fffc,_0x2042cc)[_0x12a4('0xd')](function(_0x38d894){logger[_0x12a4('0xe')]('Campaign,\x20%s,\x20%s',_0x5d2353,_0x12a4('0xf'));logger[_0x12a4('0x10')](_0x12a4('0x11'),_0x5d2353,_0x12a4('0xf'),JSON[_0x12a4('0x12')](_0x38d894));if(_0x38d894[_0x12a4('0x13')]){if(_0x38d894[_0x12a4('0x13')][_0x12a4('0x14')]===0x1f4){logger[_0x12a4('0x13')](_0x12a4('0x15'),_0x5d2353,_0x38d894[_0x12a4('0x13')][_0x12a4('0x16')]);return _0x23bb59(_0x38d894['error'][_0x12a4('0x16')]);}logger[_0x12a4('0x13')](_0x12a4('0x15'),_0x5d2353,_0x38d894[_0x12a4('0x13')][_0x12a4('0x16')]);return _0x5ae867(_0x38d894['error']['message']);}else{logger[_0x12a4('0xe')](_0x12a4('0x15'),_0x5d2353,_0x12a4('0xf'));_0x5ae867(_0x38d894[_0x12a4('0x17')]['message']);}})[_0x12a4('0x18')](function(_0x28d311){logger[_0x12a4('0x13')](_0x12a4('0x15'),_0x5d2353,_0x28d311);_0x23bb59(_0x28d311);});});}exports[_0x12a4('0x19')]=function(_0xe274e1){var _0x4d7c49=this;return new Promise(function(_0x1a6bbe,_0x3a783c){return db[_0x12a4('0x1a')]['findAll']({'raw':_0xe274e1['options']?_0xe274e1[_0x12a4('0x1b')][_0x12a4('0x1c')]===undefined?!![]:![]:!![],'where':_0xe274e1[_0x12a4('0x1b')]?_0xe274e1[_0x12a4('0x1b')][_0x12a4('0x1d')]||null:null,'attributes':_0xe274e1['options']?_0xe274e1[_0x12a4('0x1b')]['attributes']||null:null,'limit':_0xe274e1[_0x12a4('0x1b')]?_0xe274e1[_0x12a4('0x1b')][_0x12a4('0x1e')]||null:null,'include':_0xe274e1[_0x12a4('0x1b')]?_0xe274e1[_0x12a4('0x1b')]['include']?_[_0x12a4('0x1f')](_0xe274e1[_0x12a4('0x1b')][_0x12a4('0x20')],function(_0x1c4255){return{'model':db[_0x1c4255['model']],'as':_0x1c4255['as'],'attributes':_0x1c4255[_0x12a4('0x21')],'include':_0x1c4255[_0x12a4('0x20')]?_[_0x12a4('0x1f')](_0x1c4255['include'],function(_0x395749){return{'model':db[_0x395749[_0x12a4('0x22')]],'as':_0x395749['as'],'attributes':_0x395749['attributes'],'include':_0x395749[_0x12a4('0x20')]?_[_0x12a4('0x1f')](_0x395749['include'],function(_0x5e952f){return{'model':db[_0x5e952f['model']],'as':_0x5e952f['as'],'attributes':_0x5e952f[_0x12a4('0x21')]};}):[]};}):[]};}):[]:[]})[_0x12a4('0xd')](function(_0x3314da){logger[_0x12a4('0xe')]('GetCampaign',_0xe274e1);logger[_0x12a4('0x10')]('GetCampaign',_0xe274e1,JSON[_0x12a4('0x12')](_0x3314da));_0x1a6bbe(_0x3314da);})[_0x12a4('0x18')](function(_0x377466){logger[_0x12a4('0x13')]('GetCampaign',_0x377466[_0x12a4('0x16')],_0xe274e1);_0x3a783c(_0x4d7c49[_0x12a4('0x13')](0x1f4,_0x377466['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 20c5f5b..43e8ac3 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 _0xce5c=['getHopperBlacks','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','/:id/lists','addLists','addBlackLists','update','delete','destroy','removeLists','exports','multer','path','Router','fs-extra','../../components/auth/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black'];(function(_0x41b1fa,_0x19c954){var _0x1c4822=function(_0xb9e25d){while(--_0xb9e25d){_0x41b1fa['push'](_0x41b1fa['shift']());}};_0x1c4822(++_0x19c954);}(_0xce5c,0x79));var _0xcce5=function(_0x5a60ce,_0x48f080){_0x5a60ce=_0x5a60ce-0x0;var _0x393e5e=_0xce5c[_0x5a60ce];return _0x393e5e;};'use strict';var multer=require(_0xcce5('0x0'));var util=require('util');var path=require(_0xcce5('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xcce5('0x2')]();var fs_extra=require(_0xcce5('0x3'));var auth=require(_0xcce5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xcce5('0x5'));var controller=require(_0xcce5('0x6'));router[_0xcce5('0x7')]('/',auth[_0xcce5('0x8')](),controller[_0xcce5('0x9')]);router[_0xcce5('0x7')](_0xcce5('0xa'),auth[_0xcce5('0x8')](),controller[_0xcce5('0xb')]);router['get'](_0xcce5('0xc'),auth[_0xcce5('0x8')](),controller[_0xcce5('0xd')]);router[_0xcce5('0x7')](_0xcce5('0xe'),auth[_0xcce5('0x8')](),controller[_0xcce5('0xf')]);router[_0xcce5('0x7')](_0xcce5('0x10'),auth[_0xcce5('0x8')](),controller[_0xcce5('0x11')]);router[_0xcce5('0x7')](_0xcce5('0x12'),auth['isAuthenticated'](),controller[_0xcce5('0x13')]);router['get']('/:id/lists',auth[_0xcce5('0x8')](),controller[_0xcce5('0x14')]);router['get'](_0xcce5('0x15'),auth[_0xcce5('0x8')](),controller[_0xcce5('0x16')]);router[_0xcce5('0x17')]('/',auth['isAuthenticated'](),controller[_0xcce5('0x18')]);router[_0xcce5('0x17')](_0xcce5('0x19'),auth[_0xcce5('0x8')](),controller[_0xcce5('0x1a')]);router[_0xcce5('0x17')](_0xcce5('0x1b'),auth[_0xcce5('0x8')](),controller[_0xcce5('0x1c')]);router[_0xcce5('0x17')]('/:id/blacklists',auth[_0xcce5('0x8')](),controller[_0xcce5('0x1d')]);router['put'](_0xcce5('0xa'),auth[_0xcce5('0x8')](),controller[_0xcce5('0x1e')]);router[_0xcce5('0x1f')]('/:id',auth[_0xcce5('0x8')](),controller[_0xcce5('0x20')]);router['delete'](_0xcce5('0x1b'),auth[_0xcce5('0x8')](),controller[_0xcce5('0x21')]);router[_0xcce5('0x1f')](_0xcce5('0x15'),auth[_0xcce5('0x8')](),controller['removeBlackLists']);module[_0xcce5('0x22')]=router; \ No newline at end of file +var _0xa16a=['connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','getBlackLists','post','create','/:id/clone','clone','addLists','addBlackLists','update','delete','destroy','removeLists','/:id/blacklists','removeBlackLists','multer','util','path'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa16a,0x1aa));var _0xaa16=function(_0x8af54b,_0x280be5){_0x8af54b=_0x8af54b-0x0;var _0x27d8f0=_0xa16a[_0x8af54b];return _0x27d8f0;};'use strict';var multer=require(_0xaa16('0x0'));var util=require(_0xaa16('0x1'));var path=require(_0xaa16('0x2'));var timeout=require(_0xaa16('0x3'));var express=require('express');var router=express[_0xaa16('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaa16('0x5'));var config=require(_0xaa16('0x6'));var controller=require('./campaign.controller');router[_0xaa16('0x7')]('/',auth[_0xaa16('0x8')](),controller[_0xaa16('0x9')]);router['get'](_0xaa16('0xa'),auth[_0xaa16('0x8')](),controller[_0xaa16('0xb')]);router['get'](_0xaa16('0xc'),auth[_0xaa16('0x8')](),controller[_0xaa16('0xd')]);router[_0xaa16('0x7')]('/:id/hopper_histories',auth[_0xaa16('0x8')](),controller['getHopperHistories']);router['get'](_0xaa16('0xe'),auth[_0xaa16('0x8')](),controller[_0xaa16('0xf')]);router[_0xaa16('0x7')](_0xaa16('0x10'),auth[_0xaa16('0x8')](),controller[_0xaa16('0x11')]);router['get'](_0xaa16('0x12'),auth['isAuthenticated'](),controller[_0xaa16('0x13')]);router[_0xaa16('0x7')]('/:id/blacklists',auth[_0xaa16('0x8')](),controller[_0xaa16('0x14')]);router[_0xaa16('0x15')]('/',auth[_0xaa16('0x8')](),controller[_0xaa16('0x16')]);router[_0xaa16('0x15')](_0xaa16('0x17'),auth[_0xaa16('0x8')](),controller[_0xaa16('0x18')]);router[_0xaa16('0x15')]('/:id/lists',auth[_0xaa16('0x8')](),controller[_0xaa16('0x19')]);router[_0xaa16('0x15')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0xaa16('0x1a')]);router['put'](_0xaa16('0xa'),auth[_0xaa16('0x8')](),controller[_0xaa16('0x1b')]);router[_0xaa16('0x1c')](_0xaa16('0xa'),auth['isAuthenticated'](),controller[_0xaa16('0x1d')]);router[_0xaa16('0x1c')]('/:id/lists',auth[_0xaa16('0x8')](),controller[_0xaa16('0x1e')]);router[_0xaa16('0x1c')](_0xaa16('0x1f'),auth[_0xaa16('0x8')](),controller[_0xaa16('0x20')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index bb7c5a9..037c9b7 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 _0x5288=['exports','STRING','TEXT','VIRTUAL','key','sequelize'];(function(_0x5276c6,_0x252a1a){var _0x5825d8=function(_0x1f61cf){while(--_0x1f61cf){_0x5276c6['push'](_0x5276c6['shift']());}};_0x5825d8(++_0x252a1a);}(_0x5288,0x197));var _0x8528=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0x5288[_0x59d89e];return _0x554e93;};'use strict';var Sequelize=require(_0x8528('0x0'));module[_0x8528('0x1')]={'key':{'type':Sequelize[_0x8528('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x8528('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x8528('0x2')]},'name':{'type':Sequelize[_0x8528('0x4')],'get':function(){return this['getDataValue'](_0x8528('0x5'));}}}; \ No newline at end of file +var _0x9dcb=['STRING','TEXT','getDataValue','key','sequelize'];(function(_0x2cf2fb,_0x12ab1b){var _0x3d61a4=function(_0x4aa564){while(--_0x4aa564){_0x2cf2fb['push'](_0x2cf2fb['shift']());}};_0x3d61a4(++_0x12ab1b);}(_0x9dcb,0x7c));var _0xb9dc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9dcb[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xb9dc('0x0'));module['exports']={'key':{'type':Sequelize[_0xb9dc('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0xb9dc('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xb9dc('0x1')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xb9dc('0x3')](_0xb9dc('0x4'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 08ccf42..3621d7d 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 _0xe7f3=['status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','CannedAnswers','end','error','stack','name','send','index','CannedAnswer','rawAttributes','fieldName','type','model','map','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','includeAll','include','findAll','rows','catch','show','params','keys','find','body','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','get','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus'];(function(_0x15882b,_0xc30d9d){var _0x59612d=function(_0x774f8){while(--_0x774f8){_0x15882b['push'](_0x15882b['shift']());}};_0x59612d(++_0xc30d9d);}(_0xe7f3,0x97));var _0x3e7f=function(_0x492039,_0x487df3){_0x492039=_0x492039-0x0;var _0xf1a5a2=_0xe7f3[_0x492039];return _0xf1a5a2;};'use strict';var emlformat=require(_0x3e7f('0x0'));var rimraf=require(_0x3e7f('0x1'));var zipdir=require(_0x3e7f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3e7f('0x3'));var moment=require('moment');var BPromise=require(_0x3e7f('0x4'));var Mustache=require('mustache');var util=require(_0x3e7f('0x5'));var path=require('path');var sox=require(_0x3e7f('0x6'));var csv=require(_0x3e7f('0x7'));var ejs=require(_0x3e7f('0x8'));var fs=require('fs');var fs_extra=require(_0x3e7f('0x9'));var _=require(_0x3e7f('0xa'));var squel=require(_0x3e7f('0xb'));var crypto=require(_0x3e7f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3e7f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3e7f('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3e7f('0xf'));var qs=require(_0x3e7f('0x10'));var as=require(_0x3e7f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3e7f('0x12'))('api');var utils=require(_0x3e7f('0x13'));var config=require(_0x3e7f('0x14'));var licenseUtil=require(_0x3e7f('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51e0e3,_0x542a5a){_0x542a5a=_0x542a5a||0xcc;return function(_0x3e122f){if(_0x3e122f){return _0x51e0e3[_0x3e7f('0x16')](_0x542a5a);}return _0x51e0e3[_0x3e7f('0x17')](_0x542a5a)['end']();};}function respondWithResult(_0x4d8c34,_0x510d08){_0x510d08=_0x510d08||0xc8;return function(_0xa44d8f){if(_0xa44d8f){return _0x4d8c34[_0x3e7f('0x17')](_0x510d08)[_0x3e7f('0x18')](_0xa44d8f);}};}function respondWithFilteredResult(_0x13a887,_0x45b57e){return function(_0x1b4bd1){if(_0x1b4bd1){var _0x39929b=typeof _0x45b57e['offset']===_0x3e7f('0x19')&&typeof _0x45b57e['limit']===_0x3e7f('0x19');var _0x5c8e4a=_0x1b4bd1[_0x3e7f('0x1a')];var _0x199f83=_0x39929b?0x0:_0x45b57e['offset'];var _0x5e0638=_0x39929b?_0x1b4bd1['count']:_0x45b57e[_0x3e7f('0x1b')]+_0x45b57e[_0x3e7f('0x1c')];var _0x26021a;if(_0x5e0638>=_0x5c8e4a){_0x5e0638=_0x5c8e4a;_0x26021a=0xc8;}else{_0x26021a=0xce;}_0x13a887[_0x3e7f('0x17')](_0x26021a);return _0x13a887[_0x3e7f('0x1d')](_0x3e7f('0x1e'),_0x199f83+'-'+_0x5e0638+'/'+_0x5c8e4a)[_0x3e7f('0x18')](_0x1b4bd1);}return null;};}function patchUpdates(_0x17302d){return function(_0x5e7246){try{jsonpatch[_0x3e7f('0x1f')](_0x5e7246,_0x17302d,!![]);}catch(_0x328edb){return BPromise[_0x3e7f('0x20')](_0x328edb);}return _0x5e7246[_0x3e7f('0x21')]();};}function saveUpdates(_0x2d04b,_0x3c0301){return function(_0x26d477){if(_0x26d477){return _0x26d477[_0x3e7f('0x22')](_0x2d04b)[_0x3e7f('0x23')](function(_0x2b185e){return _0x2b185e;});}return null;};}function removeEntity(_0xdbcce6,_0x5db45c){return function(_0x3ccdfe){if(_0x3ccdfe){return _0x3ccdfe[_0x3e7f('0x24')]()['then'](function(){var _0x660f11=_0x3ccdfe['get']({'plain':!![]});var _0x33e901=_0x3e7f('0x25');return db['UserProfileResource'][_0x3e7f('0x24')]({'where':{'type':_0x33e901,'resourceId':_0x660f11['id']}})[_0x3e7f('0x23')](function(){return _0x3ccdfe;});})[_0x3e7f('0x23')](function(){_0xdbcce6[_0x3e7f('0x17')](0xcc)[_0x3e7f('0x26')]();});}};}function handleEntityNotFound(_0x1cd40c,_0x4c7e30){return function(_0x28eb8e){if(!_0x28eb8e){_0x1cd40c[_0x3e7f('0x16')](0x194);}return _0x28eb8e;};}function handleError(_0x8638ca,_0x55a939){_0x55a939=_0x55a939||0x1f4;return function(_0xe1a67b){logger[_0x3e7f('0x27')](_0xe1a67b[_0x3e7f('0x28')]);if(_0xe1a67b[_0x3e7f('0x29')]){delete _0xe1a67b[_0x3e7f('0x29')];}_0x8638ca[_0x3e7f('0x17')](_0x55a939)[_0x3e7f('0x2a')](_0xe1a67b);};}exports[_0x3e7f('0x2b')]=function(_0xff948f,_0x32109f){var _0x362acc={},_0xeee457={},_0x159aea={'count':0x0,'rows':[]};var _0x51fdb3=_['map'](db[_0x3e7f('0x2c')][_0x3e7f('0x2d')],function(_0x57074d){return{'name':_0x57074d[_0x3e7f('0x2e')],'type':_0x57074d[_0x3e7f('0x2f')]['key']};});_0xeee457[_0x3e7f('0x30')]=_[_0x3e7f('0x31')](_0x51fdb3,_0x3e7f('0x29'));_0xeee457['query']=_['keys'](_0xff948f['query']);_0xeee457['filters']=_[_0x3e7f('0x32')](_0xeee457[_0x3e7f('0x30')],_0xeee457[_0x3e7f('0x33')]);_0x362acc[_0x3e7f('0x34')]=_[_0x3e7f('0x32')](_0xeee457[_0x3e7f('0x30')],qs[_0x3e7f('0x35')](_0xff948f['query'][_0x3e7f('0x35')]));_0x362acc['attributes']=_0x362acc[_0x3e7f('0x34')][_0x3e7f('0x36')]?_0x362acc['attributes']:_0xeee457[_0x3e7f('0x30')];if(!_0xff948f[_0x3e7f('0x33')][_0x3e7f('0x37')](_0x3e7f('0x38'))){_0x362acc[_0x3e7f('0x1c')]=qs['limit'](_0xff948f[_0x3e7f('0x33')]['limit']);_0x362acc[_0x3e7f('0x1b')]=qs[_0x3e7f('0x1b')](_0xff948f['query'][_0x3e7f('0x1b')]);}_0x362acc[_0x3e7f('0x39')]=qs[_0x3e7f('0x3a')](_0xff948f['query'][_0x3e7f('0x3a')]);_0x362acc['where']=qs[_0x3e7f('0x3b')](_['pick'](_0xff948f[_0x3e7f('0x33')],_0xeee457[_0x3e7f('0x3b')]),_0x51fdb3);if(_0xff948f[_0x3e7f('0x33')][_0x3e7f('0x3c')]){_0x362acc[_0x3e7f('0x3d')]=_[_0x3e7f('0x3e')](_0x362acc[_0x3e7f('0x3d')],{'$or':[{'key':{'$like':'%'+_0xff948f[_0x3e7f('0x33')]['filter']+'%'}},{'value':{'$like':'%'+_0xff948f[_0x3e7f('0x33')][_0x3e7f('0x3c')]+'%'}}]});}_0x362acc=_[_0x3e7f('0x3e')]({},_0x362acc,_0xff948f['options']);var _0x1344f4={'where':_0x362acc[_0x3e7f('0x3d')]};return db[_0x3e7f('0x2c')]['count'](_0x1344f4)[_0x3e7f('0x23')](function(_0x201cac){_0x159aea[_0x3e7f('0x1a')]=_0x201cac;if(_0xff948f[_0x3e7f('0x33')][_0x3e7f('0x3f')]){_0x362acc[_0x3e7f('0x40')]=[{'all':!![]}];}return db[_0x3e7f('0x2c')][_0x3e7f('0x41')](_0x362acc);})[_0x3e7f('0x23')](function(_0x17ad0a){_0x159aea[_0x3e7f('0x42')]=_0x17ad0a;return _0x159aea;})[_0x3e7f('0x23')](respondWithFilteredResult(_0x32109f,_0x362acc))[_0x3e7f('0x43')](handleError(_0x32109f,null));};exports[_0x3e7f('0x44')]=function(_0x3e7c08,_0x22cfb0){var _0x52b81b={'raw':!![],'where':{'id':_0x3e7c08[_0x3e7f('0x45')]['id']}},_0x227842={};_0x227842['model']=_['keys'](db[_0x3e7f('0x2c')]['rawAttributes']);_0x227842['query']=_[_0x3e7f('0x46')](_0x3e7c08[_0x3e7f('0x33')]);_0x227842[_0x3e7f('0x3b')]=_['intersection'](_0x227842['model'],_0x227842['query']);_0x52b81b[_0x3e7f('0x34')]=_[_0x3e7f('0x32')](_0x227842[_0x3e7f('0x30')],qs[_0x3e7f('0x35')](_0x3e7c08['query']['fields']));_0x52b81b['attributes']=_0x52b81b[_0x3e7f('0x34')][_0x3e7f('0x36')]?_0x52b81b[_0x3e7f('0x34')]:_0x227842[_0x3e7f('0x30')];if(_0x3e7c08[_0x3e7f('0x33')][_0x3e7f('0x3f')]){_0x52b81b['include']=[{'all':!![]}];}_0x52b81b=_[_0x3e7f('0x3e')]({},_0x52b81b,_0x3e7c08['options']);return db['CannedAnswer'][_0x3e7f('0x47')](_0x52b81b)[_0x3e7f('0x23')](handleEntityNotFound(_0x22cfb0,null))[_0x3e7f('0x23')](respondWithResult(_0x22cfb0,null))['catch'](handleError(_0x22cfb0,null));};exports['update']=function(_0x44f1ec,_0x14a122){if(_0x44f1ec[_0x3e7f('0x48')]['id']){delete _0x44f1ec[_0x3e7f('0x48')]['id'];}return db['CannedAnswer'][_0x3e7f('0x47')]({'where':{'id':_0x44f1ec[_0x3e7f('0x45')]['id']}})[_0x3e7f('0x23')](handleEntityNotFound(_0x14a122,null))['then'](saveUpdates(_0x44f1ec[_0x3e7f('0x48')],null))['then'](respondWithResult(_0x14a122,null))[_0x3e7f('0x43')](handleError(_0x14a122,null));};exports['destroy']=function(_0x515a60,_0x4d83b3){return db[_0x3e7f('0x2c')][_0x3e7f('0x47')]({'where':{'id':_0x515a60['params']['id']}})[_0x3e7f('0x23')](handleEntityNotFound(_0x4d83b3,null))[_0x3e7f('0x23')](removeEntity(_0x4d83b3,null))[_0x3e7f('0x43')](handleError(_0x4d83b3,null));};exports[_0x3e7f('0x49')]=function(_0x42a44c,_0x46a443){var _0x538e37={'key':_0x42a44c[_0x3e7f('0x48')][_0x3e7f('0x4a')]};if(_0x42a44c[_0x3e7f('0x48')][_0x3e7f('0x4b')]){_0x538e37['MailAccountId']=_0x42a44c['body'][_0x3e7f('0x4b')];}else if(_0x42a44c[_0x3e7f('0x48')][_0x3e7f('0x4c')]){_0x538e37[_0x3e7f('0x4c')]=_0x42a44c[_0x3e7f('0x48')]['SmsAccountId'];}else if(_0x42a44c[_0x3e7f('0x48')][_0x3e7f('0x4d')]){_0x538e37[_0x3e7f('0x4d')]=_0x42a44c[_0x3e7f('0x48')]['OpenchannelAccountId'];}else if(_0x42a44c[_0x3e7f('0x48')][_0x3e7f('0x4e')]){_0x538e37[_0x3e7f('0x4e')]=_0x42a44c[_0x3e7f('0x48')][_0x3e7f('0x4e')];}return db[_0x3e7f('0x2c')][_0x3e7f('0x47')]({'where':_0x538e37})[_0x3e7f('0x23')](function(_0x139ae2){if(_0x139ae2){throw new db['Sequelize'][(_0x3e7f('0x4f'))](_0x3e7f('0x50'));}return db[_0x3e7f('0x2c')][_0x3e7f('0x49')](_0x42a44c['body']);})[_0x3e7f('0x23')](function(_0x5a624a){var _0x4bda60=_0x42a44c[_0x3e7f('0x51')][_0x3e7f('0x52')]({'plain':!![]});if(!_0x4bda60)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4bda60[_0x3e7f('0x53')]===_0x3e7f('0x51')){var _0x4ba8e1=_0x5a624a[_0x3e7f('0x52')]({'plain':!![]});return db[_0x3e7f('0x54')]['find']({'where':{'name':_0x3e7f('0x25'),'userProfileId':_0x4bda60[_0x3e7f('0x55')]},'raw':!![]})[_0x3e7f('0x23')](function(_0x2df04e){if(_0x2df04e&&_0x2df04e['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x4ba8e1['name'],'resourceId':_0x4ba8e1['id'],'type':_0x2df04e['name'],'sectionId':_0x2df04e['id']},{})[_0x3e7f('0x23')](function(){return _0x5a624a;});}else{return _0x5a624a;}})[_0x3e7f('0x43')](function(_0x4db259){logger[_0x3e7f('0x27')](_0x3e7f('0x56'),_0x4db259);throw _0x4db259;});}return _0x5a624a;})[_0x3e7f('0x23')](respondWithResult(_0x46a443,0xc9))['catch'](handleError(_0x46a443,null));}; \ No newline at end of file +var _0xba61=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','get','CannedAnswers','UserProfileResource','destroy','stack','name','send','index','CannedAnswer','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','body','find','catch','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError'];(function(_0x1b00c4,_0x2dbab6){var _0x4dd3d5=function(_0x34e5b7){while(--_0x34e5b7){_0x1b00c4['push'](_0x1b00c4['shift']());}};_0x4dd3d5(++_0x2dbab6);}(_0xba61,0x115));var _0x1ba6=function(_0x46be00,_0x439bbf){_0x46be00=_0x46be00-0x0;var _0x46ec29=_0xba61[_0x46be00];return _0x46ec29;};'use strict';var emlformat=require(_0x1ba6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1ba6('0x1'));var jsonpatch=require(_0x1ba6('0x2'));var rp=require(_0x1ba6('0x3'));var moment=require(_0x1ba6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1ba6('0x5'));var util=require(_0x1ba6('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x1ba6('0x7'));var ejs=require(_0x1ba6('0x8'));var fs=require('fs');var fs_extra=require(_0x1ba6('0x9'));var _=require(_0x1ba6('0xa'));var squel=require('squel');var crypto=require(_0x1ba6('0xb'));var jsforce=require(_0x1ba6('0xc'));var deskjs=require(_0x1ba6('0xd'));var toCsv=require(_0x1ba6('0x7'));var querystring=require('querystring');var Papa=require(_0x1ba6('0xe'));var Redis=require('ioredis');var authService=require(_0x1ba6('0xf'));var qs=require(_0x1ba6('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1ba6('0x11'));var logger=require(_0x1ba6('0x12'))(_0x1ba6('0x13'));var utils=require(_0x1ba6('0x14'));var config=require(_0x1ba6('0x15'));var licenseUtil=require(_0x1ba6('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x58d6e5,_0xaf3307){_0xaf3307=_0xaf3307||0xcc;return function(_0x5493d3){if(_0x5493d3){return _0x58d6e5['sendStatus'](_0xaf3307);}return _0x58d6e5[_0x1ba6('0x17')](_0xaf3307)[_0x1ba6('0x18')]();};}function respondWithResult(_0x4e8438,_0xdcf6f4){_0xdcf6f4=_0xdcf6f4||0xc8;return function(_0x1ac1a9){if(_0x1ac1a9){return _0x4e8438[_0x1ba6('0x17')](_0xdcf6f4)[_0x1ba6('0x19')](_0x1ac1a9);}};}function respondWithFilteredResult(_0x362a48,_0x254460){return function(_0x1a25ef){if(_0x1a25ef){var _0x1f995e=typeof _0x254460[_0x1ba6('0x1a')]===_0x1ba6('0x1b')&&typeof _0x254460['limit']===_0x1ba6('0x1b');var _0x4bc451=_0x1a25ef['count'];var _0x3d7958=_0x1f995e?0x0:_0x254460['offset'];var _0x30999f=_0x1f995e?_0x1a25ef[_0x1ba6('0x1c')]:_0x254460[_0x1ba6('0x1a')]+_0x254460[_0x1ba6('0x1d')];var _0x108203;if(_0x30999f>=_0x4bc451){_0x30999f=_0x4bc451;_0x108203=0xc8;}else{_0x108203=0xce;}_0x362a48[_0x1ba6('0x17')](_0x108203);return _0x362a48[_0x1ba6('0x1e')](_0x1ba6('0x1f'),_0x3d7958+'-'+_0x30999f+'/'+_0x4bc451)[_0x1ba6('0x19')](_0x1a25ef);}return null;};}function patchUpdates(_0x57c21c){return function(_0x3e849e){try{jsonpatch[_0x1ba6('0x20')](_0x3e849e,_0x57c21c,!![]);}catch(_0x3ef371){return BPromise[_0x1ba6('0x21')](_0x3ef371);}return _0x3e849e[_0x1ba6('0x22')]();};}function saveUpdates(_0x228351,_0xfbdae8){return function(_0x1152b6){if(_0x1152b6){return _0x1152b6['update'](_0x228351)['then'](function(_0x5a6c79){return _0x5a6c79;});}return null;};}function removeEntity(_0x6153f8,_0x26dab9){return function(_0xff88e4){if(_0xff88e4){return _0xff88e4['destroy']()[_0x1ba6('0x23')](function(){var _0xc969b8=_0xff88e4[_0x1ba6('0x24')]({'plain':!![]});var _0x4f227d=_0x1ba6('0x25');return db[_0x1ba6('0x26')][_0x1ba6('0x27')]({'where':{'type':_0x4f227d,'resourceId':_0xc969b8['id']}})['then'](function(){return _0xff88e4;});})[_0x1ba6('0x23')](function(){_0x6153f8[_0x1ba6('0x17')](0xcc)[_0x1ba6('0x18')]();});}};}function handleEntityNotFound(_0x4ace8d,_0x2e3bf9){return function(_0x58b8bd){if(!_0x58b8bd){_0x4ace8d['sendStatus'](0x194);}return _0x58b8bd;};}function handleError(_0x2ccaf8,_0x5912a7){_0x5912a7=_0x5912a7||0x1f4;return function(_0x20b996){logger['error'](_0x20b996[_0x1ba6('0x28')]);if(_0x20b996[_0x1ba6('0x29')]){delete _0x20b996[_0x1ba6('0x29')];}_0x2ccaf8['status'](_0x5912a7)[_0x1ba6('0x2a')](_0x20b996);};}exports[_0x1ba6('0x2b')]=function(_0x2a38eb,_0x3578e3){var _0x5cfdb2={},_0x566a76={},_0x12d699={'count':0x0,'rows':[]};var _0x300ac7=_['map'](db[_0x1ba6('0x2c')][_0x1ba6('0x2d')],function(_0x5a805b){return{'name':_0x5a805b[_0x1ba6('0x2e')],'type':_0x5a805b[_0x1ba6('0x2f')][_0x1ba6('0x30')]};});_0x566a76[_0x1ba6('0x31')]=_[_0x1ba6('0x32')](_0x300ac7,_0x1ba6('0x29'));_0x566a76[_0x1ba6('0x33')]=_[_0x1ba6('0x34')](_0x2a38eb[_0x1ba6('0x33')]);_0x566a76[_0x1ba6('0x35')]=_[_0x1ba6('0x36')](_0x566a76['model'],_0x566a76[_0x1ba6('0x33')]);_0x5cfdb2['attributes']=_['intersection'](_0x566a76['model'],qs[_0x1ba6('0x37')](_0x2a38eb['query'][_0x1ba6('0x37')]));_0x5cfdb2[_0x1ba6('0x38')]=_0x5cfdb2[_0x1ba6('0x38')][_0x1ba6('0x39')]?_0x5cfdb2[_0x1ba6('0x38')]:_0x566a76['model'];if(!_0x2a38eb[_0x1ba6('0x33')][_0x1ba6('0x3a')](_0x1ba6('0x3b'))){_0x5cfdb2['limit']=qs[_0x1ba6('0x1d')](_0x2a38eb[_0x1ba6('0x33')][_0x1ba6('0x1d')]);_0x5cfdb2[_0x1ba6('0x1a')]=qs[_0x1ba6('0x1a')](_0x2a38eb[_0x1ba6('0x33')][_0x1ba6('0x1a')]);}_0x5cfdb2[_0x1ba6('0x3c')]=qs[_0x1ba6('0x3d')](_0x2a38eb[_0x1ba6('0x33')][_0x1ba6('0x3d')]);_0x5cfdb2[_0x1ba6('0x3e')]=qs[_0x1ba6('0x35')](_[_0x1ba6('0x3f')](_0x2a38eb[_0x1ba6('0x33')],_0x566a76[_0x1ba6('0x35')]),_0x300ac7);if(_0x2a38eb[_0x1ba6('0x33')][_0x1ba6('0x40')]){_0x5cfdb2['where']=_[_0x1ba6('0x41')](_0x5cfdb2[_0x1ba6('0x3e')],{'$or':[{'key':{'$like':'%'+_0x2a38eb[_0x1ba6('0x33')][_0x1ba6('0x40')]+'%'}},{'value':{'$like':'%'+_0x2a38eb['query']['filter']+'%'}}]});}_0x5cfdb2=_['merge']({},_0x5cfdb2,_0x2a38eb[_0x1ba6('0x42')]);var _0x1e1fd8={'where':_0x5cfdb2[_0x1ba6('0x3e')]};return db[_0x1ba6('0x2c')][_0x1ba6('0x1c')](_0x1e1fd8)[_0x1ba6('0x23')](function(_0x575bd1){_0x12d699['count']=_0x575bd1;if(_0x2a38eb[_0x1ba6('0x33')][_0x1ba6('0x43')]){_0x5cfdb2[_0x1ba6('0x44')]=[{'all':!![]}];}return db['CannedAnswer'][_0x1ba6('0x45')](_0x5cfdb2);})[_0x1ba6('0x23')](function(_0x40dc16){_0x12d699[_0x1ba6('0x46')]=_0x40dc16;return _0x12d699;})[_0x1ba6('0x23')](respondWithFilteredResult(_0x3578e3,_0x5cfdb2))['catch'](handleError(_0x3578e3,null));};exports[_0x1ba6('0x47')]=function(_0x3af051,_0x12ecd2){var _0xc5b64d={'raw':!![],'where':{'id':_0x3af051[_0x1ba6('0x48')]['id']}},_0x53cb6f={};_0x53cb6f[_0x1ba6('0x31')]=_[_0x1ba6('0x34')](db[_0x1ba6('0x2c')][_0x1ba6('0x2d')]);_0x53cb6f[_0x1ba6('0x33')]=_[_0x1ba6('0x34')](_0x3af051[_0x1ba6('0x33')]);_0x53cb6f[_0x1ba6('0x35')]=_[_0x1ba6('0x36')](_0x53cb6f[_0x1ba6('0x31')],_0x53cb6f[_0x1ba6('0x33')]);_0xc5b64d[_0x1ba6('0x38')]=_[_0x1ba6('0x36')](_0x53cb6f['model'],qs[_0x1ba6('0x37')](_0x3af051['query'][_0x1ba6('0x37')]));_0xc5b64d[_0x1ba6('0x38')]=_0xc5b64d[_0x1ba6('0x38')][_0x1ba6('0x39')]?_0xc5b64d['attributes']:_0x53cb6f[_0x1ba6('0x31')];if(_0x3af051[_0x1ba6('0x33')][_0x1ba6('0x43')]){_0xc5b64d[_0x1ba6('0x44')]=[{'all':!![]}];}_0xc5b64d=_[_0x1ba6('0x41')]({},_0xc5b64d,_0x3af051[_0x1ba6('0x42')]);return db[_0x1ba6('0x2c')]['find'](_0xc5b64d)[_0x1ba6('0x23')](handleEntityNotFound(_0x12ecd2,null))[_0x1ba6('0x23')](respondWithResult(_0x12ecd2,null))['catch'](handleError(_0x12ecd2,null));};exports['update']=function(_0x45c1a0,_0x30f519){if(_0x45c1a0[_0x1ba6('0x49')]['id']){delete _0x45c1a0[_0x1ba6('0x49')]['id'];}return db[_0x1ba6('0x2c')][_0x1ba6('0x4a')]({'where':{'id':_0x45c1a0[_0x1ba6('0x48')]['id']}})[_0x1ba6('0x23')](handleEntityNotFound(_0x30f519,null))['then'](saveUpdates(_0x45c1a0['body'],null))[_0x1ba6('0x23')](respondWithResult(_0x30f519,null))[_0x1ba6('0x4b')](handleError(_0x30f519,null));};exports[_0x1ba6('0x27')]=function(_0x1605e2,_0xa6339f){return db['CannedAnswer'][_0x1ba6('0x4a')]({'where':{'id':_0x1605e2[_0x1ba6('0x48')]['id']}})[_0x1ba6('0x23')](handleEntityNotFound(_0xa6339f,null))[_0x1ba6('0x23')](removeEntity(_0xa6339f,null))[_0x1ba6('0x4b')](handleError(_0xa6339f,null));};exports[_0x1ba6('0x4c')]=function(_0x5592ff,_0x18d728){var _0x3f5efa={'key':_0x5592ff[_0x1ba6('0x49')][_0x1ba6('0x30')]};if(_0x5592ff['body'][_0x1ba6('0x4d')]){_0x3f5efa['MailAccountId']=_0x5592ff[_0x1ba6('0x49')]['MailAccountId'];}else if(_0x5592ff[_0x1ba6('0x49')][_0x1ba6('0x4e')]){_0x3f5efa[_0x1ba6('0x4e')]=_0x5592ff[_0x1ba6('0x49')][_0x1ba6('0x4e')];}else if(_0x5592ff['body'][_0x1ba6('0x4f')]){_0x3f5efa[_0x1ba6('0x4f')]=_0x5592ff[_0x1ba6('0x49')][_0x1ba6('0x4f')];}else if(_0x5592ff[_0x1ba6('0x49')]['ChatWebsiteId']){_0x3f5efa[_0x1ba6('0x50')]=_0x5592ff[_0x1ba6('0x49')][_0x1ba6('0x50')];}return db[_0x1ba6('0x2c')]['find']({'where':_0x3f5efa})['then'](function(_0x23e750){if(_0x23e750){throw new db[(_0x1ba6('0x51'))][(_0x1ba6('0x52'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x1ba6('0x2c')][_0x1ba6('0x4c')](_0x5592ff[_0x1ba6('0x49')]);})['then'](function(_0x3c98a8){var _0x1e277a=_0x5592ff[_0x1ba6('0x53')]['get']({'plain':!![]});if(!_0x1e277a)throw new Error(_0x1ba6('0x54'));if(_0x1e277a[_0x1ba6('0x55')]===_0x1ba6('0x53')){var _0x292cd9=_0x3c98a8[_0x1ba6('0x24')]({'plain':!![]});return db[_0x1ba6('0x56')][_0x1ba6('0x4a')]({'where':{'name':_0x1ba6('0x25'),'userProfileId':_0x1e277a[_0x1ba6('0x57')]},'raw':!![]})[_0x1ba6('0x23')](function(_0x57ef5){if(_0x57ef5&&_0x57ef5[_0x1ba6('0x58')]===0x0){return db[_0x1ba6('0x26')][_0x1ba6('0x4c')]({'name':_0x292cd9[_0x1ba6('0x29')],'resourceId':_0x292cd9['id'],'type':_0x57ef5['name'],'sectionId':_0x57ef5['id']},{})['then'](function(){return _0x3c98a8;});}else{return _0x3c98a8;}})['catch'](function(_0x47e6dd){logger['error'](_0x1ba6('0x59'),_0x47e6dd);throw _0x47e6dd;});}return _0x3c98a8;})[_0x1ba6('0x23')](respondWithResult(_0x18d728,0xc9))[_0x1ba6('0x4b')](handleError(_0x18d728,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 34ba175..e0fe474 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 _0x5e29=['./cannedAnswer.attributes','exports','CannedAnswer','tools_canned_answers','utf8mb4','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x5e29,0x149));var _0x95e2=function(_0x57caf0,_0x1fe145){_0x57caf0=_0x57caf0-0x0;var _0x65d871=_0x5e29[_0x57caf0];return _0x65d871;};'use strict';var _=require(_0x95e2('0x0'));var util=require('util');var logger=require(_0x95e2('0x1'))('api');var moment=require(_0x95e2('0x2'));var BPromise=require(_0x95e2('0x3'));var rp=require(_0x95e2('0x4'));var fs=require('fs');var path=require(_0x95e2('0x5'));var rimraf=require(_0x95e2('0x6'));var config=require('../../config/environment');var attributes=require(_0x95e2('0x7'));module[_0x95e2('0x8')]=function(_0x3ba9d3,_0x1373d6){return _0x3ba9d3['define'](_0x95e2('0x9'),attributes,{'tableName':_0x95e2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x95e2('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xb139=['lodash','util','api','moment','bluebird','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci'];(function(_0x441f7a,_0x576321){var _0x4821da=function(_0x5c5b52){while(--_0x5c5b52){_0x441f7a['push'](_0x441f7a['shift']());}};_0x4821da(++_0x576321);}(_0xb139,0x1ba));var _0x9b13=function(_0xf27012,_0x94a86f){_0xf27012=_0xf27012-0x0;var _0x23ce26=_0xb139[_0xf27012];return _0x23ce26;};'use strict';var _=require(_0x9b13('0x0'));var util=require(_0x9b13('0x1'));var logger=require('../../config/logger')(_0x9b13('0x2'));var moment=require(_0x9b13('0x3'));var BPromise=require(_0x9b13('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9b13('0x5'));var attributes=require(_0x9b13('0x6'));module[_0x9b13('0x7')]=function(_0x57c7a5,_0x3cb126){return _0x57c7a5[_0x9b13('0x8')](_0x9b13('0x9'),attributes,{'tableName':_0x9b13('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9b13('0xb'),'collate':_0x9b13('0xc')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 39d4ae1..9407ba5 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(_0x1ad31b,_0x50da64){var _0x17f2f0=function(_0x5483b6){while(--_0x5483b6){_0x1ad31b['push'](_0x1ad31b['shift']());}};_0x17f2f0(++_0x50da64);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +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(_0x5822bc,_0x39d45e){var _0x4fa8ca=function(_0x17cffa){while(--_0x17cffa){_0x5822bc['push'](_0x5822bc['shift']());}};_0x4fa8ca(++_0x39d45e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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 a92e274..9f019d9 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 _0x9dbc=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x938c4e,_0x2fa5ca){var _0x2bb9a9=function(_0x3a2a61){while(--_0x3a2a61){_0x938c4e['push'](_0x938c4e['shift']());}};_0x2bb9a9(++_0x2fa5ca);}(_0x9dbc,0xc1));var _0xc9db=function(_0xcc1266,_0x27ba6d){_0xcc1266=_0xcc1266-0x0;var _0x34e46a=_0x9dbc[_0xcc1266];return _0x34e46a;};'use strict';var multer=require(_0xc9db('0x0'));var util=require(_0xc9db('0x1'));var path=require(_0xc9db('0x2'));var timeout=require(_0xc9db('0x3'));var express=require(_0xc9db('0x4'));var router=express[_0xc9db('0x5')]();var fs_extra=require(_0xc9db('0x6'));var auth=require(_0xc9db('0x7'));var interaction=require(_0xc9db('0x8'));var config=require(_0xc9db('0x9'));var controller=require('./cannedAnswer.controller');router[_0xc9db('0xa')]('/',auth[_0xc9db('0xb')](),controller[_0xc9db('0xc')]);router[_0xc9db('0xa')](_0xc9db('0xd'),auth[_0xc9db('0xb')](),controller['show']);router[_0xc9db('0xe')]('/',auth[_0xc9db('0xb')](),controller[_0xc9db('0xf')]);router[_0xc9db('0x10')]('/:id',auth[_0xc9db('0xb')](),controller[_0xc9db('0x11')]);router['delete']('/:id',auth[_0xc9db('0xb')](),controller[_0xc9db('0x12')]);module[_0xc9db('0x13')]=router; \ No newline at end of file +var _0x4a49=['post','put','update','delete','destroy','exports','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show'];(function(_0x577c7c,_0x314381){var _0x56b1d4=function(_0xf97b2d){while(--_0xf97b2d){_0x577c7c['push'](_0x577c7c['shift']());}};_0x56b1d4(++_0x314381);}(_0x4a49,0x180));var _0x94a4=function(_0x10d99f,_0x2a560b){_0x10d99f=_0x10d99f-0x0;var _0x1afb16=_0x4a49[_0x10d99f];return _0x1afb16;};'use strict';var multer=require('multer');var util=require(_0x94a4('0x0'));var path=require(_0x94a4('0x1'));var timeout=require(_0x94a4('0x2'));var express=require(_0x94a4('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x94a4('0x4'));var config=require(_0x94a4('0x5'));var controller=require(_0x94a4('0x6'));router[_0x94a4('0x7')]('/',auth[_0x94a4('0x8')](),controller[_0x94a4('0x9')]);router[_0x94a4('0x7')](_0x94a4('0xa'),auth['isAuthenticated'](),controller[_0x94a4('0xb')]);router[_0x94a4('0xc')]('/',auth[_0x94a4('0x8')](),controller['create']);router[_0x94a4('0xd')](_0x94a4('0xa'),auth['isAuthenticated'](),controller[_0x94a4('0xe')]);router[_0x94a4('0xf')](_0x94a4('0xa'),auth[_0x94a4('0x8')](),controller[_0x94a4('0x10')]);module[_0x94a4('0x11')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index bca494b..f7597a7 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 _0x7217=['INTEGER','DATE','STRING'];(function(_0x2fe487,_0x2b78f6){var _0x250916=function(_0x4b9a0c){while(--_0x4b9a0c){_0x2fe487['push'](_0x2fe487['shift']());}};_0x250916(++_0x2b78f6);}(_0x7217,0xa9));var _0x7721=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x7217[_0x187ee1];return _0x388160;};'use strict';var Sequelize=require('sequelize');module['exports']={'calldate':{'type':Sequelize[_0x7721('0x0')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x7721('0x1')]},'src':{'type':Sequelize[_0x7721('0x1')]},'dst':{'type':Sequelize[_0x7721('0x1')]},'dcontext':{'type':Sequelize[_0x7721('0x1')]},'channel':{'type':Sequelize[_0x7721('0x1')]},'dstchannel':{'type':Sequelize[_0x7721('0x1')]},'lastapp':{'type':Sequelize[_0x7721('0x1')]},'lastdata':{'type':Sequelize[_0x7721('0x1')]},'duration':{'type':Sequelize[_0x7721('0x2')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x7721('0x2')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x7721('0x2')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x7721('0x1')]},'userfield':{'type':Sequelize[_0x7721('0x1')]},'uniqueid':{'type':Sequelize[_0x7721('0x1')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0x7721('0x1')]},'peeraccount':{'type':Sequelize[_0x7721('0x1')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x7721('0x1')]}}; \ No newline at end of file +var _0x47c0=['INTEGER','sequelize','exports','DATE','STRING'];(function(_0x342700,_0x569f75){var _0x53406f=function(_0x3b3c32){while(--_0x3b3c32){_0x342700['push'](_0x342700['shift']());}};_0x53406f(++_0x569f75);}(_0x47c0,0x1dc));var _0x047c=function(_0x255083,_0x3d687f){_0x255083=_0x255083-0x0;var _0x3fc668=_0x47c0[_0x255083];return _0x3fc668;};'use strict';var Sequelize=require(_0x047c('0x0'));module[_0x047c('0x1')]={'calldate':{'type':Sequelize[_0x047c('0x2')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x047c('0x3')]},'src':{'type':Sequelize[_0x047c('0x3')]},'dst':{'type':Sequelize[_0x047c('0x3')]},'dcontext':{'type':Sequelize[_0x047c('0x3')]},'channel':{'type':Sequelize[_0x047c('0x3')]},'dstchannel':{'type':Sequelize[_0x047c('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x047c('0x3')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x047c('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x047c('0x3')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x047c('0x3')]},'userfield':{'type':Sequelize[_0x047c('0x3')]},'uniqueid':{'type':Sequelize[_0x047c('0x3')]},'linkedid':{'type':Sequelize[_0x047c('0x3')]},'sequence':{'type':Sequelize[_0x047c('0x3')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x047c('0x3')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index d8cca91..00b94fb 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 _0xcb81=['save','then','destroy','error','stack','name','send','index','Cdr','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create','body','update','params','describe','eml-format','rimraf','fast-json-patch','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject'];(function(_0x57e648,_0x2d8f7e){var _0x3edc8f=function(_0x426502){while(--_0x426502){_0x57e648['push'](_0x57e648['shift']());}};_0x3edc8f(++_0x2d8f7e);}(_0xcb81,0x154));var _0x1cb8=function(_0x2440fe,_0x281a11){_0x2440fe=_0x2440fe-0x0;var _0x5cf734=_0xcb81[_0x2440fe];return _0x5cf734;};'use strict';var emlformat=require(_0x1cb8('0x0'));var rimraf=require(_0x1cb8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1cb8('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1cb8('0x3'));var util=require(_0x1cb8('0x4'));var path=require(_0x1cb8('0x5'));var sox=require(_0x1cb8('0x6'));var csv=require(_0x1cb8('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1cb8('0x8'));var _=require(_0x1cb8('0x9'));var squel=require('squel');var crypto=require(_0x1cb8('0xa'));var jsforce=require(_0x1cb8('0xb'));var deskjs=require(_0x1cb8('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1cb8('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1cb8('0xe'));var qs=require(_0x1cb8('0xf'));var as=require(_0x1cb8('0x10'));var hardwareService=require(_0x1cb8('0x11'));var logger=require(_0x1cb8('0x12'))(_0x1cb8('0x13'));var utils=require(_0x1cb8('0x14'));var config=require(_0x1cb8('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x1cb8('0x16'))['db'];function respondWithStatusCode(_0x1ffe94,_0x1938ee){_0x1938ee=_0x1938ee||0xcc;return function(_0x299eea){if(_0x299eea){return _0x1ffe94[_0x1cb8('0x17')](_0x1938ee);}return _0x1ffe94['status'](_0x1938ee)[_0x1cb8('0x18')]();};}function respondWithResult(_0x2c600,_0xcb6ad1){_0xcb6ad1=_0xcb6ad1||0xc8;return function(_0x14d84d){if(_0x14d84d){return _0x2c600[_0x1cb8('0x19')](_0xcb6ad1)[_0x1cb8('0x1a')](_0x14d84d);}};}function respondWithFilteredResult(_0x339ad0,_0x243930){return function(_0x5af4a3){if(_0x5af4a3){var _0x17a95d=typeof _0x243930['offset']===_0x1cb8('0x1b')&&typeof _0x243930[_0x1cb8('0x1c')]===_0x1cb8('0x1b');var _0x46abd0=_0x5af4a3[_0x1cb8('0x1d')];var _0x308088=_0x17a95d?0x0:_0x243930[_0x1cb8('0x1e')];var _0x9f0adb=_0x17a95d?_0x5af4a3[_0x1cb8('0x1d')]:_0x243930[_0x1cb8('0x1e')]+_0x243930[_0x1cb8('0x1c')];var _0x3cda27;if(_0x9f0adb>=_0x46abd0){_0x9f0adb=_0x46abd0;_0x3cda27=0xc8;}else{_0x3cda27=0xce;}_0x339ad0['status'](_0x3cda27);return _0x339ad0[_0x1cb8('0x1f')](_0x1cb8('0x20'),_0x308088+'-'+_0x9f0adb+'/'+_0x46abd0)[_0x1cb8('0x1a')](_0x5af4a3);}return null;};}function patchUpdates(_0x3d1682){return function(_0x4abf3a){try{jsonpatch[_0x1cb8('0x21')](_0x4abf3a,_0x3d1682,!![]);}catch(_0x4f9220){return BPromise[_0x1cb8('0x22')](_0x4f9220);}return _0x4abf3a[_0x1cb8('0x23')]();};}function saveUpdates(_0x40b914,_0x38ff3a){return function(_0x559916){if(_0x559916){return _0x559916['update'](_0x40b914)[_0x1cb8('0x24')](function(_0x4040be){return _0x4040be;});}return null;};}function removeEntity(_0x22dafe,_0x44a00d){return function(_0x2473b8){if(_0x2473b8){return _0x2473b8[_0x1cb8('0x25')]()[_0x1cb8('0x24')](function(){_0x22dafe['status'](0xcc)[_0x1cb8('0x18')]();});}};}function handleEntityNotFound(_0x4554d5,_0x35c890){return function(_0xeeb21d){if(!_0xeeb21d){_0x4554d5[_0x1cb8('0x17')](0x194);}return _0xeeb21d;};}function handleError(_0x41ab56,_0x4ca3be){_0x4ca3be=_0x4ca3be||0x1f4;return function(_0x1ec995){logger[_0x1cb8('0x26')](_0x1ec995[_0x1cb8('0x27')]);if(_0x1ec995[_0x1cb8('0x28')]){delete _0x1ec995[_0x1cb8('0x28')];}_0x41ab56['status'](_0x4ca3be)[_0x1cb8('0x29')](_0x1ec995);};}exports[_0x1cb8('0x2a')]=function(_0x3a8b53,_0x21c17a){var _0x4fda96={},_0x2a79e0={},_0x2ba8c8={'count':0x0,'rows':[]};var _0x3a6a67=_['map'](db[_0x1cb8('0x2b')][_0x1cb8('0x2c')],function(_0x17abe1){return{'name':_0x17abe1['fieldName'],'type':_0x17abe1[_0x1cb8('0x2d')][_0x1cb8('0x2e')]};});_0x2a79e0[_0x1cb8('0x2f')]=_[_0x1cb8('0x30')](_0x3a6a67,_0x1cb8('0x28'));_0x2a79e0['query']=_[_0x1cb8('0x31')](_0x3a8b53[_0x1cb8('0x32')]);_0x2a79e0[_0x1cb8('0x33')]=_[_0x1cb8('0x34')](_0x2a79e0[_0x1cb8('0x2f')],_0x2a79e0[_0x1cb8('0x32')]);_0x4fda96[_0x1cb8('0x35')]=_[_0x1cb8('0x34')](_0x2a79e0[_0x1cb8('0x2f')],qs['fields'](_0x3a8b53['query'][_0x1cb8('0x36')]));_0x4fda96[_0x1cb8('0x35')]=_0x4fda96[_0x1cb8('0x35')]['length']?_0x4fda96['attributes']:_0x2a79e0[_0x1cb8('0x2f')];if(!_0x3a8b53[_0x1cb8('0x32')][_0x1cb8('0x37')](_0x1cb8('0x38'))){_0x4fda96[_0x1cb8('0x1c')]=qs[_0x1cb8('0x1c')](_0x3a8b53[_0x1cb8('0x32')][_0x1cb8('0x1c')]);_0x4fda96['offset']=qs[_0x1cb8('0x1e')](_0x3a8b53[_0x1cb8('0x32')][_0x1cb8('0x1e')]);}_0x4fda96[_0x1cb8('0x39')]=qs[_0x1cb8('0x3a')](_0x3a8b53[_0x1cb8('0x32')][_0x1cb8('0x3a')]);_0x4fda96[_0x1cb8('0x3b')]=qs[_0x1cb8('0x33')](_['pick'](_0x3a8b53[_0x1cb8('0x32')],_0x2a79e0[_0x1cb8('0x33')]),_0x3a6a67);if(_0x3a8b53['query'][_0x1cb8('0x3c')]){_0x4fda96[_0x1cb8('0x3b')]=_[_0x1cb8('0x3d')](_0x4fda96[_0x1cb8('0x3b')],{'$or':_[_0x1cb8('0x30')](_0x3a6a67,function(_0x5dc4c0){if(_0x5dc4c0[_0x1cb8('0x2d')]!==_0x1cb8('0x3e')){var _0x2989c6={};_0x2989c6[_0x5dc4c0['name']]={'$like':'%'+_0x3a8b53['query']['filter']+'%'};return _0x2989c6;}})});}_0x4fda96=_[_0x1cb8('0x3d')]({},_0x4fda96,_0x3a8b53[_0x1cb8('0x3f')]);var _0x328f7e={'where':_0x4fda96[_0x1cb8('0x3b')]};return db['Cdr']['count'](_0x328f7e)[_0x1cb8('0x24')](function(_0x25f0a3){_0x2ba8c8[_0x1cb8('0x1d')]=_0x25f0a3;if(_0x3a8b53[_0x1cb8('0x32')][_0x1cb8('0x40')]){_0x4fda96[_0x1cb8('0x41')]=[{'all':!![]}];}return db[_0x1cb8('0x2b')][_0x1cb8('0x42')](_0x4fda96);})['then'](function(_0x2044d1){_0x2ba8c8[_0x1cb8('0x43')]=_0x2044d1;return _0x2ba8c8;})[_0x1cb8('0x24')](respondWithFilteredResult(_0x21c17a,_0x4fda96))[_0x1cb8('0x44')](handleError(_0x21c17a,null));};exports['show']=function(_0x156298,_0x47c18a){var _0x2060a6={'raw':!![],'where':{'id':_0x156298['params']['id']}},_0x37230e={};_0x37230e[_0x1cb8('0x2f')]=_[_0x1cb8('0x31')](db[_0x1cb8('0x2b')]['rawAttributes']);_0x37230e['query']=_[_0x1cb8('0x31')](_0x156298['query']);_0x37230e[_0x1cb8('0x33')]=_[_0x1cb8('0x34')](_0x37230e[_0x1cb8('0x2f')],_0x37230e[_0x1cb8('0x32')]);_0x2060a6[_0x1cb8('0x35')]=_[_0x1cb8('0x34')](_0x37230e[_0x1cb8('0x2f')],qs['fields'](_0x156298[_0x1cb8('0x32')][_0x1cb8('0x36')]));_0x2060a6[_0x1cb8('0x35')]=_0x2060a6[_0x1cb8('0x35')]['length']?_0x2060a6[_0x1cb8('0x35')]:_0x37230e[_0x1cb8('0x2f')];if(_0x156298[_0x1cb8('0x32')][_0x1cb8('0x40')]){_0x2060a6[_0x1cb8('0x41')]=[{'all':!![]}];}_0x2060a6=_['merge']({},_0x2060a6,_0x156298[_0x1cb8('0x3f')]);return db[_0x1cb8('0x2b')][_0x1cb8('0x45')](_0x2060a6)[_0x1cb8('0x24')](handleEntityNotFound(_0x47c18a,null))[_0x1cb8('0x24')](respondWithResult(_0x47c18a,null))['catch'](handleError(_0x47c18a,null));};exports[_0x1cb8('0x46')]=function(_0x3a4ec4,_0x5598b1){return db[_0x1cb8('0x2b')][_0x1cb8('0x46')](_0x3a4ec4[_0x1cb8('0x47')],{})[_0x1cb8('0x24')](respondWithResult(_0x5598b1,0xc9))[_0x1cb8('0x44')](handleError(_0x5598b1,null));};exports[_0x1cb8('0x48')]=function(_0x3b063c,_0x219541){if(_0x3b063c[_0x1cb8('0x47')]['id']){delete _0x3b063c[_0x1cb8('0x47')]['id'];}return db[_0x1cb8('0x2b')][_0x1cb8('0x45')]({'where':{'id':_0x3b063c[_0x1cb8('0x49')]['id']}})[_0x1cb8('0x24')](handleEntityNotFound(_0x219541,null))['then'](saveUpdates(_0x3b063c[_0x1cb8('0x47')],null))[_0x1cb8('0x24')](respondWithResult(_0x219541,null))[_0x1cb8('0x44')](handleError(_0x219541,null));};exports[_0x1cb8('0x25')]=function(_0x21aba7,_0x15f0ba){return db[_0x1cb8('0x2b')]['find']({'where':{'id':_0x21aba7[_0x1cb8('0x49')]['id']}})[_0x1cb8('0x24')](handleEntityNotFound(_0x15f0ba,null))[_0x1cb8('0x24')](removeEntity(_0x15f0ba,null))['catch'](handleError(_0x15f0ba,null));};exports['describe']=function(_0x1c12aa,_0x42cc81){return db[_0x1cb8('0x2b')][_0x1cb8('0x4a')]()[_0x1cb8('0x24')](respondWithResult(_0x42cc81,null))['catch'](handleError(_0x42cc81,null));}; \ No newline at end of file +var _0xda19=['rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','Cdr','includeAll','findAll','catch','show','body','find','params','describe'];(function(_0x3fd9ce,_0x4b1fbe){var _0x3618d9=function(_0x35438d){while(--_0x35438d){_0x3fd9ce['push'](_0x3fd9ce['shift']());}};_0x3618d9(++_0x4b1fbe);}(_0xda19,0xd5));var _0x9da1=function(_0xbbcd48,_0x287535){_0xbbcd48=_0xbbcd48-0x0;var _0x4f4c00=_0xda19[_0xbbcd48];return _0x4f4c00;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9da1('0x0'));var zipdir=require(_0x9da1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9da1('0x2'));var moment=require('moment');var BPromise=require(_0x9da1('0x3'));var Mustache=require('mustache');var util=require(_0x9da1('0x4'));var path=require(_0x9da1('0x5'));var sox=require(_0x9da1('0x6'));var csv=require(_0x9da1('0x7'));var ejs=require(_0x9da1('0x8'));var fs=require('fs');var fs_extra=require(_0x9da1('0x9'));var _=require(_0x9da1('0xa'));var squel=require(_0x9da1('0xb'));var crypto=require(_0x9da1('0xc'));var jsforce=require(_0x9da1('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9da1('0xe'));var Redis=require('ioredis');var authService=require(_0x9da1('0xf'));var qs=require(_0x9da1('0x10'));var as=require(_0x9da1('0x11'));var hardwareService=require(_0x9da1('0x12'));var logger=require(_0x9da1('0x13'))(_0x9da1('0x14'));var utils=require(_0x9da1('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9da1('0x16'))['db'];function respondWithStatusCode(_0x596b6b,_0x4735c7){_0x4735c7=_0x4735c7||0xcc;return function(_0x1d93f8){if(_0x1d93f8){return _0x596b6b[_0x9da1('0x17')](_0x4735c7);}return _0x596b6b[_0x9da1('0x18')](_0x4735c7)['end']();};}function respondWithResult(_0x2837e3,_0x535a13){_0x535a13=_0x535a13||0xc8;return function(_0x4d17e1){if(_0x4d17e1){return _0x2837e3[_0x9da1('0x18')](_0x535a13)['json'](_0x4d17e1);}};}function respondWithFilteredResult(_0x433ff4,_0x43c093){return function(_0x37653d){if(_0x37653d){var _0x1a1a6b=typeof _0x43c093[_0x9da1('0x19')]==='undefined'&&typeof _0x43c093[_0x9da1('0x1a')]===_0x9da1('0x1b');var _0xf83bf8=_0x37653d[_0x9da1('0x1c')];var _0xfb278d=_0x1a1a6b?0x0:_0x43c093[_0x9da1('0x19')];var _0x497676=_0x1a1a6b?_0x37653d['count']:_0x43c093[_0x9da1('0x19')]+_0x43c093[_0x9da1('0x1a')];var _0x1b0e7f;if(_0x497676>=_0xf83bf8){_0x497676=_0xf83bf8;_0x1b0e7f=0xc8;}else{_0x1b0e7f=0xce;}_0x433ff4[_0x9da1('0x18')](_0x1b0e7f);return _0x433ff4[_0x9da1('0x1d')](_0x9da1('0x1e'),_0xfb278d+'-'+_0x497676+'/'+_0xf83bf8)[_0x9da1('0x1f')](_0x37653d);}return null;};}function patchUpdates(_0x47e5cf){return function(_0x1a459c){try{jsonpatch[_0x9da1('0x20')](_0x1a459c,_0x47e5cf,!![]);}catch(_0x9c3b37){return BPromise[_0x9da1('0x21')](_0x9c3b37);}return _0x1a459c[_0x9da1('0x22')]();};}function saveUpdates(_0x4e9d7d,_0x5454d3){return function(_0x14793b){if(_0x14793b){return _0x14793b[_0x9da1('0x23')](_0x4e9d7d)[_0x9da1('0x24')](function(_0x330219){return _0x330219;});}return null;};}function removeEntity(_0x32eb55,_0x165b73){return function(_0x4c60aa){if(_0x4c60aa){return _0x4c60aa[_0x9da1('0x25')]()[_0x9da1('0x24')](function(){_0x32eb55['status'](0xcc)[_0x9da1('0x26')]();});}};}function handleEntityNotFound(_0x3f5680,_0x534210){return function(_0x2fd49c){if(!_0x2fd49c){_0x3f5680[_0x9da1('0x17')](0x194);}return _0x2fd49c;};}function handleError(_0x4b1152,_0x36b87a){_0x36b87a=_0x36b87a||0x1f4;return function(_0x1d6af5){logger['error'](_0x1d6af5['stack']);if(_0x1d6af5[_0x9da1('0x27')]){delete _0x1d6af5[_0x9da1('0x27')];}_0x4b1152['status'](_0x36b87a)[_0x9da1('0x28')](_0x1d6af5);};}exports['index']=function(_0x5a6f2d,_0x5a59c2){var _0x31b826={},_0x404b86={},_0x24c6d5={'count':0x0,'rows':[]};var _0x26dd58=_[_0x9da1('0x29')](db['Cdr'][_0x9da1('0x2a')],function(_0x4e6083){return{'name':_0x4e6083[_0x9da1('0x2b')],'type':_0x4e6083[_0x9da1('0x2c')]['key']};});_0x404b86[_0x9da1('0x2d')]=_[_0x9da1('0x29')](_0x26dd58,'name');_0x404b86[_0x9da1('0x2e')]=_[_0x9da1('0x2f')](_0x5a6f2d[_0x9da1('0x2e')]);_0x404b86[_0x9da1('0x30')]=_['intersection'](_0x404b86['model'],_0x404b86[_0x9da1('0x2e')]);_0x31b826[_0x9da1('0x31')]=_[_0x9da1('0x32')](_0x404b86[_0x9da1('0x2d')],qs[_0x9da1('0x33')](_0x5a6f2d['query'][_0x9da1('0x33')]));_0x31b826[_0x9da1('0x31')]=_0x31b826[_0x9da1('0x31')][_0x9da1('0x34')]?_0x31b826[_0x9da1('0x31')]:_0x404b86[_0x9da1('0x2d')];if(!_0x5a6f2d['query'][_0x9da1('0x35')]('nolimit')){_0x31b826['limit']=qs[_0x9da1('0x1a')](_0x5a6f2d['query'][_0x9da1('0x1a')]);_0x31b826[_0x9da1('0x19')]=qs[_0x9da1('0x19')](_0x5a6f2d[_0x9da1('0x2e')][_0x9da1('0x19')]);}_0x31b826[_0x9da1('0x36')]=qs[_0x9da1('0x37')](_0x5a6f2d[_0x9da1('0x2e')]['sort']);_0x31b826[_0x9da1('0x38')]=qs['filters'](_[_0x9da1('0x39')](_0x5a6f2d['query'],_0x404b86['filters']),_0x26dd58);if(_0x5a6f2d[_0x9da1('0x2e')]['filter']){_0x31b826[_0x9da1('0x38')]=_[_0x9da1('0x3a')](_0x31b826['where'],{'$or':_[_0x9da1('0x29')](_0x26dd58,function(_0x1b750f){if(_0x1b750f[_0x9da1('0x2c')]!==_0x9da1('0x3b')){var _0x56bd49={};_0x56bd49[_0x1b750f[_0x9da1('0x27')]]={'$like':'%'+_0x5a6f2d['query'][_0x9da1('0x3c')]+'%'};return _0x56bd49;}})});}_0x31b826=_['merge']({},_0x31b826,_0x5a6f2d[_0x9da1('0x3d')]);var _0x46c176={'where':_0x31b826['where']};return db[_0x9da1('0x3e')][_0x9da1('0x1c')](_0x46c176)[_0x9da1('0x24')](function(_0x4e9af3){_0x24c6d5['count']=_0x4e9af3;if(_0x5a6f2d['query'][_0x9da1('0x3f')]){_0x31b826['include']=[{'all':!![]}];}return db[_0x9da1('0x3e')][_0x9da1('0x40')](_0x31b826);})[_0x9da1('0x24')](function(_0x43c064){_0x24c6d5['rows']=_0x43c064;return _0x24c6d5;})[_0x9da1('0x24')](respondWithFilteredResult(_0x5a59c2,_0x31b826))[_0x9da1('0x41')](handleError(_0x5a59c2,null));};exports[_0x9da1('0x42')]=function(_0x173dc6,_0x28fc88){var _0x26c225={'raw':!![],'where':{'id':_0x173dc6['params']['id']}},_0x28e0b2={};_0x28e0b2[_0x9da1('0x2d')]=_['keys'](db[_0x9da1('0x3e')]['rawAttributes']);_0x28e0b2[_0x9da1('0x2e')]=_[_0x9da1('0x2f')](_0x173dc6['query']);_0x28e0b2[_0x9da1('0x30')]=_[_0x9da1('0x32')](_0x28e0b2['model'],_0x28e0b2[_0x9da1('0x2e')]);_0x26c225['attributes']=_[_0x9da1('0x32')](_0x28e0b2[_0x9da1('0x2d')],qs['fields'](_0x173dc6['query'][_0x9da1('0x33')]));_0x26c225[_0x9da1('0x31')]=_0x26c225[_0x9da1('0x31')][_0x9da1('0x34')]?_0x26c225[_0x9da1('0x31')]:_0x28e0b2[_0x9da1('0x2d')];if(_0x173dc6[_0x9da1('0x2e')][_0x9da1('0x3f')]){_0x26c225['include']=[{'all':!![]}];}_0x26c225=_[_0x9da1('0x3a')]({},_0x26c225,_0x173dc6[_0x9da1('0x3d')]);return db[_0x9da1('0x3e')]['find'](_0x26c225)[_0x9da1('0x24')](handleEntityNotFound(_0x28fc88,null))[_0x9da1('0x24')](respondWithResult(_0x28fc88,null))[_0x9da1('0x41')](handleError(_0x28fc88,null));};exports['create']=function(_0x336fc3,_0x351d4d){return db[_0x9da1('0x3e')]['create'](_0x336fc3[_0x9da1('0x43')],{})['then'](respondWithResult(_0x351d4d,0xc9))['catch'](handleError(_0x351d4d,null));};exports[_0x9da1('0x23')]=function(_0x43c47d,_0x5afbc7){if(_0x43c47d[_0x9da1('0x43')]['id']){delete _0x43c47d[_0x9da1('0x43')]['id'];}return db['Cdr'][_0x9da1('0x44')]({'where':{'id':_0x43c47d[_0x9da1('0x45')]['id']}})[_0x9da1('0x24')](handleEntityNotFound(_0x5afbc7,null))[_0x9da1('0x24')](saveUpdates(_0x43c47d[_0x9da1('0x43')],null))[_0x9da1('0x24')](respondWithResult(_0x5afbc7,null))[_0x9da1('0x41')](handleError(_0x5afbc7,null));};exports[_0x9da1('0x25')]=function(_0x3889f4,_0x5c9b46){return db[_0x9da1('0x3e')][_0x9da1('0x44')]({'where':{'id':_0x3889f4[_0x9da1('0x45')]['id']}})[_0x9da1('0x24')](handleEntityNotFound(_0x5c9b46,null))['then'](removeEntity(_0x5c9b46,null))['catch'](handleError(_0x5c9b46,null));};exports[_0x9da1('0x46')]=function(_0x6ca1ac,_0x3870dd){return db[_0x9da1('0x3e')][_0x9da1('0x46')]()[_0x9da1('0x24')](respondWithResult(_0x3870dd,null))[_0x9da1('0x41')](handleError(_0x3870dd,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index d2c887a..923a772 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(_0x52c27d,_0xda4996){var _0x3e712a=function(_0x4bc790){while(--_0x4bc790){_0x52c27d['push'](_0x52c27d['shift']());}};_0x3e712a(++_0xda4996);}(_0x7a54,0x106));var _0x47a5=function(_0x1ffa19,_0x143952){_0x1ffa19=_0x1ffa19-0x0;var _0x125b11=_0x7a54[_0x1ffa19];return _0x125b11;};'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 _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x36965d,_0x370b7c){var _0x461fec=function(_0x5e8d04){while(--_0x5e8d04){_0x36965d['push'](_0x36965d['shift']());}};_0x461fec(++_0x370b7c);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 10dc045..a9e9a05 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 _0xecdd=['Cdr,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x2a1445,_0x5d2b8d){var _0x5ec7f4=function(_0x54492a){while(--_0x54492a){_0x2a1445['push'](_0x2a1445['shift']());}};_0x5ec7f4(++_0x5d2b8d);}(_0xecdd,0x169));var _0xdecd=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xecdd[_0x4ea69d];return _0x5318e0;};'use strict';var _=require('lodash');var util=require(_0xdecd('0x0'));var moment=require(_0xdecd('0x1'));var BPromise=require('bluebird');var rs=require(_0xdecd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdecd('0x3'))['db'];var utils=require(_0xdecd('0x4'));var logger=require(_0xdecd('0x5'))(_0xdecd('0x6'));var config=require(_0xdecd('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdecd('0x8')][_0xdecd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x28537c,_0x535609,_0x213407){return new BPromise(function(_0x582899,_0x4302e8){return client[_0xdecd('0xa')](_0x28537c,_0x213407)[_0xdecd('0xb')](function(_0x122a36){logger[_0xdecd('0xc')](_0xdecd('0xd'),_0x535609,_0xdecd('0xe'));logger[_0xdecd('0xf')]('Cdr,\x20%s,\x20%s,\x20%s',_0x535609,_0xdecd('0xe'),JSON[_0xdecd('0x10')](_0x122a36));if(_0x122a36['error']){if(_0x122a36[_0xdecd('0x11')][_0xdecd('0x12')]===0x1f4){logger[_0xdecd('0x11')]('Cdr,\x20%s,\x20%s',_0x535609,_0x122a36[_0xdecd('0x11')]['message']);return _0x4302e8(_0x122a36[_0xdecd('0x11')][_0xdecd('0x13')]);}logger['error'](_0xdecd('0xd'),_0x535609,_0x122a36[_0xdecd('0x11')]['message']);return _0x582899(_0x122a36[_0xdecd('0x11')][_0xdecd('0x13')]);}else{logger[_0xdecd('0xc')](_0xdecd('0xd'),_0x535609,_0xdecd('0xe'));_0x582899(_0x122a36[_0xdecd('0x14')][_0xdecd('0x13')]);}})[_0xdecd('0x15')](function(_0xc014a3){logger[_0xdecd('0x11')](_0xdecd('0xd'),_0x535609,_0xc014a3);_0x4302e8(_0xc014a3);});});} \ No newline at end of file +var _0xbfb4=['error','Cdr,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x16c996,_0x23b8b5){var _0x43e961=function(_0x5dec9d){while(--_0x5dec9d){_0x16c996['push'](_0x16c996['shift']());}};_0x43e961(++_0x23b8b5);}(_0xbfb4,0x165));var _0x4bfb=function(_0x40a778,_0x298f10){_0x40a778=_0x40a778-0x0;var _0x4ee87e=_0xbfb4[_0x40a778];return _0x4ee87e;};'use strict';var _=require('lodash');var util=require(_0x4bfb('0x0'));var moment=require(_0x4bfb('0x1'));var BPromise=require('bluebird');var rs=require(_0x4bfb('0x2'));var fs=require('fs');var Redis=require(_0x4bfb('0x3'));var db=require(_0x4bfb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4bfb('0x5'))(_0x4bfb('0x6'));var config=require(_0x4bfb('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4bfb('0x8')][_0x4bfb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55562f,_0xa93e38,_0x37b8f8){return new BPromise(function(_0x1bcfd7,_0x5c28d1){return client[_0x4bfb('0xa')](_0x55562f,_0x37b8f8)[_0x4bfb('0xb')](function(_0x51a243){logger[_0x4bfb('0xc')]('Cdr,\x20%s,\x20%s',_0xa93e38,_0x4bfb('0xd'));logger[_0x4bfb('0xe')](_0x4bfb('0xf'),_0xa93e38,'request\x20sent',JSON[_0x4bfb('0x10')](_0x51a243));if(_0x51a243[_0x4bfb('0x11')]){if(_0x51a243['error']['code']===0x1f4){logger[_0x4bfb('0x11')](_0x4bfb('0x12'),_0xa93e38,_0x51a243[_0x4bfb('0x11')][_0x4bfb('0x13')]);return _0x5c28d1(_0x51a243['error']['message']);}logger[_0x4bfb('0x11')](_0x4bfb('0x12'),_0xa93e38,_0x51a243[_0x4bfb('0x11')][_0x4bfb('0x13')]);return _0x1bcfd7(_0x51a243[_0x4bfb('0x11')][_0x4bfb('0x13')]);}else{logger['info'](_0x4bfb('0x12'),_0xa93e38,'request\x20sent');_0x1bcfd7(_0x51a243[_0x4bfb('0x14')]['message']);}})[_0x4bfb('0x15')](function(_0x230256){logger[_0x4bfb('0x11')](_0x4bfb('0x12'),_0xa93e38,_0x230256);_0x5c28d1(_0x230256);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index e322466..bdfd412 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x1f808f,_0x172b10){var _0x282348=function(_0xfa8c2){while(--_0xfa8c2){_0x1f808f['push'](_0x1f808f['shift']());}};_0x282348(++_0x172b10);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +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(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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 10536ea..cd0db5c 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 _0xbd13=['*,*,*,*','sequelize','exports','noop','TEXT','STRING'];(function(_0x352d28,_0x444033){var _0x387d7e=function(_0x40be0e){while(--_0x40be0e){_0x352d28['push'](_0x352d28['shift']());}};_0x387d7e(++_0x444033);}(_0xbd13,0xc7));var _0x3bd1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbd13[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3bd1('0x0'));module[_0x3bd1('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3bd1('0x2')},'appdata':{'type':Sequelize[_0x3bd1('0x3')]()},'description':{'type':Sequelize[_0x3bd1('0x4')]},'interval':{'type':Sequelize[_0x3bd1('0x4')],'defaultValue':_0x3bd1('0x5')}}; \ No newline at end of file +var _0x6e8f=['exports','INTEGER','STRING','noop','TEXT'];(function(_0x4ef7d7,_0x5b971f){var _0x2ca766=function(_0x420507){while(--_0x420507){_0x4ef7d7['push'](_0x4ef7d7['shift']());}};_0x2ca766(++_0x5b971f);}(_0x6e8f,0x181));var _0xf6e8=function(_0x555bef,_0x3dda60){_0x555bef=_0x555bef-0x0;var _0x317ace=_0x6e8f[_0x555bef];return _0x317ace;};'use strict';var Sequelize=require('sequelize');module[_0xf6e8('0x0')]={'priority':{'type':Sequelize[_0xf6e8('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xf6e8('0x2')],'allowNull':![],'defaultValue':_0xf6e8('0x3')},'appdata':{'type':Sequelize[_0xf6e8('0x4')]()},'description':{'type':Sequelize[_0xf6e8('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index edf1ff2..3e8bbe9 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 _0xeea4=['../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','error','stack','name','send','keys','rawAttributes','query','filters','intersection','model','attributes','fields','length','include','options','find','then','catch','body','ChatApplication','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x4d1ee9,_0x394a78){var _0x9a5456=function(_0x224f3b){while(--_0x224f3b){_0x4d1ee9['push'](_0x4d1ee9['shift']());}};_0x9a5456(++_0x394a78);}(_0xeea4,0x19e));var _0x4eea=function(_0x34bea7,_0x36c7f7){_0x34bea7=_0x34bea7-0x0;var _0x33cf81=_0xeea4[_0x34bea7];return _0x33cf81;};'use strict';var emlformat=require(_0x4eea('0x0'));var rimraf=require(_0x4eea('0x1'));var zipdir=require(_0x4eea('0x2'));var jsonpatch=require(_0x4eea('0x3'));var rp=require(_0x4eea('0x4'));var moment=require(_0x4eea('0x5'));var BPromise=require(_0x4eea('0x6'));var Mustache=require(_0x4eea('0x7'));var util=require(_0x4eea('0x8'));var path=require('path');var sox=require(_0x4eea('0x9'));var csv=require('to-csv');var ejs=require(_0x4eea('0xa'));var fs=require('fs');var fs_extra=require(_0x4eea('0xb'));var _=require(_0x4eea('0xc'));var squel=require('squel');var crypto=require(_0x4eea('0xd'));var jsforce=require(_0x4eea('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4eea('0xf'));var querystring=require(_0x4eea('0x10'));var Papa=require(_0x4eea('0x11'));var Redis=require(_0x4eea('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4eea('0x13'));var as=require(_0x4eea('0x14'));var hardwareService=require(_0x4eea('0x15'));var logger=require(_0x4eea('0x16'))(_0x4eea('0x17'));var utils=require(_0x4eea('0x18'));var config=require(_0x4eea('0x19'));var licenseUtil=require(_0x4eea('0x1a'));var db=require(_0x4eea('0x1b'))['db'];function respondWithStatusCode(_0x130507,_0x47b971){_0x47b971=_0x47b971||0xcc;return function(_0x54fa8c){if(_0x54fa8c){return _0x130507[_0x4eea('0x1c')](_0x47b971);}return _0x130507[_0x4eea('0x1d')](_0x47b971)[_0x4eea('0x1e')]();};}function respondWithResult(_0x238405,_0x3327e0){_0x3327e0=_0x3327e0||0xc8;return function(_0x328275){if(_0x328275){return _0x238405[_0x4eea('0x1d')](_0x3327e0)[_0x4eea('0x1f')](_0x328275);}};}function respondWithFilteredResult(_0x5828e0,_0x1654c0){return function(_0x34ce09){if(_0x34ce09){var _0x150d60=typeof _0x1654c0[_0x4eea('0x20')]==='undefined'&&typeof _0x1654c0[_0x4eea('0x21')]===_0x4eea('0x22');var _0x3fbe8b=_0x34ce09[_0x4eea('0x23')];var _0x27a227=_0x150d60?0x0:_0x1654c0['offset'];var _0x1571f3=_0x150d60?_0x34ce09[_0x4eea('0x23')]:_0x1654c0['offset']+_0x1654c0[_0x4eea('0x21')];var _0x325185;if(_0x1571f3>=_0x3fbe8b){_0x1571f3=_0x3fbe8b;_0x325185=0xc8;}else{_0x325185=0xce;}_0x5828e0[_0x4eea('0x1d')](_0x325185);return _0x5828e0[_0x4eea('0x24')](_0x4eea('0x25'),_0x27a227+'-'+_0x1571f3+'/'+_0x3fbe8b)[_0x4eea('0x1f')](_0x34ce09);}return null;};}function patchUpdates(_0x56fefc){return function(_0xf054a7){try{jsonpatch[_0x4eea('0x26')](_0xf054a7,_0x56fefc,!![]);}catch(_0x24f371){return BPromise[_0x4eea('0x27')](_0x24f371);}return _0xf054a7[_0x4eea('0x28')]();};}function saveUpdates(_0x496ab6,_0x4898e8){return function(_0x3b7513){if(_0x3b7513){return _0x3b7513['update'](_0x496ab6)['then'](function(_0x5a2722){return _0x5a2722;});}return null;};}function removeEntity(_0x37f024,_0x3be3f3){return function(_0x505e50){if(_0x505e50){return _0x505e50[_0x4eea('0x29')]()['then'](function(){_0x37f024[_0x4eea('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x111e65,_0x5a1ec7){return function(_0x1e8f29){if(!_0x1e8f29){_0x111e65[_0x4eea('0x1c')](0x194);}return _0x1e8f29;};}function handleError(_0x22f706,_0x430a46){_0x430a46=_0x430a46||0x1f4;return function(_0xd09e64){logger[_0x4eea('0x2a')](_0xd09e64[_0x4eea('0x2b')]);if(_0xd09e64[_0x4eea('0x2c')]){delete _0xd09e64[_0x4eea('0x2c')];}_0x22f706[_0x4eea('0x1d')](_0x430a46)[_0x4eea('0x2d')](_0xd09e64);};}exports['show']=function(_0x58c0df,_0x3e602c){var _0x3eeb41={'raw':!![],'where':{'id':_0x58c0df['params']['id']}},_0x591b2f={};_0x591b2f['model']=_[_0x4eea('0x2e')](db['ChatApplication'][_0x4eea('0x2f')]);_0x591b2f[_0x4eea('0x30')]=_[_0x4eea('0x2e')](_0x58c0df['query']);_0x591b2f[_0x4eea('0x31')]=_[_0x4eea('0x32')](_0x591b2f[_0x4eea('0x33')],_0x591b2f['query']);_0x3eeb41[_0x4eea('0x34')]=_[_0x4eea('0x32')](_0x591b2f[_0x4eea('0x33')],qs['fields'](_0x58c0df['query'][_0x4eea('0x35')]));_0x3eeb41[_0x4eea('0x34')]=_0x3eeb41['attributes'][_0x4eea('0x36')]?_0x3eeb41[_0x4eea('0x34')]:_0x591b2f[_0x4eea('0x33')];if(_0x58c0df[_0x4eea('0x30')]['includeAll']){_0x3eeb41[_0x4eea('0x37')]=[{'all':!![]}];}_0x3eeb41=_['merge']({},_0x3eeb41,_0x58c0df[_0x4eea('0x38')]);return db['ChatApplication'][_0x4eea('0x39')](_0x3eeb41)[_0x4eea('0x3a')](handleEntityNotFound(_0x3e602c,null))['then'](respondWithResult(_0x3e602c,null))[_0x4eea('0x3b')](handleError(_0x3e602c,null));};exports['update']=function(_0x1df208,_0x2e7b37){if(_0x1df208['body']['id']){delete _0x1df208[_0x4eea('0x3c')]['id'];}return db[_0x4eea('0x3d')][_0x4eea('0x39')]({'where':{'id':_0x1df208['params']['id']}})[_0x4eea('0x3a')](handleEntityNotFound(_0x2e7b37,null))['then'](saveUpdates(_0x1df208['body'],null))[_0x4eea('0x3a')](respondWithResult(_0x2e7b37,null))[_0x4eea('0x3b')](handleError(_0x2e7b37,null));};exports[_0x4eea('0x29')]=function(_0x4c8dd2,_0x57e9b6){return db[_0x4eea('0x3d')][_0x4eea('0x39')]({'where':{'id':_0x4c8dd2[_0x4eea('0x3e')]['id']}})[_0x4eea('0x3a')](handleEntityNotFound(_0x57e9b6,null))[_0x4eea('0x3a')](removeEntity(_0x57e9b6,null))['catch'](handleError(_0x57e9b6,null));}; \ No newline at end of file +var _0x0d74=['desk.js','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','json','limit','undefined','count','offset','set','Content-Range','save','update','then','destroy','error','stack','name','show','params','model','ChatApplication','rawAttributes','query','keys','intersection','attributes','fields','includeAll','include','merge','options','find','catch','body','eml-format','rimraf','request-promise','moment','util','path','sox','to-csv','squel','jsforce'];(function(_0x272156,_0x5e4b0d){var _0x1071d0=function(_0x5f1f6b){while(--_0x5f1f6b){_0x272156['push'](_0x272156['shift']());}};_0x1071d0(++_0x5e4b0d);}(_0x0d74,0x146));var _0x40d7=function(_0x211533,_0x11e508){_0x211533=_0x211533-0x0;var _0x4fa6e7=_0x0d74[_0x211533];return _0x4fa6e7;};'use strict';var emlformat=require(_0x40d7('0x0'));var rimraf=require(_0x40d7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x40d7('0x2'));var moment=require(_0x40d7('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x40d7('0x4'));var path=require(_0x40d7('0x5'));var sox=require(_0x40d7('0x6'));var csv=require(_0x40d7('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x40d7('0x8'));var crypto=require('crypto');var jsforce=require(_0x40d7('0x9'));var deskjs=require(_0x40d7('0xa'));var toCsv=require('to-csv');var querystring=require(_0x40d7('0xb'));var Papa=require(_0x40d7('0xc'));var Redis=require(_0x40d7('0xd'));var authService=require(_0x40d7('0xe'));var qs=require(_0x40d7('0xf'));var as=require(_0x40d7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x40d7('0x11'))(_0x40d7('0x12'));var utils=require(_0x40d7('0x13'));var config=require(_0x40d7('0x14'));var licenseUtil=require(_0x40d7('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43f1d8,_0xa08fd6){_0xa08fd6=_0xa08fd6||0xcc;return function(_0x3723a4){if(_0x3723a4){return _0x43f1d8[_0x40d7('0x16')](_0xa08fd6);}return _0x43f1d8['status'](_0xa08fd6)[_0x40d7('0x17')]();};}function respondWithResult(_0x4cb402,_0x14c12b){_0x14c12b=_0x14c12b||0xc8;return function(_0x2acc5b){if(_0x2acc5b){return _0x4cb402[_0x40d7('0x18')](_0x14c12b)[_0x40d7('0x19')](_0x2acc5b);}};}function respondWithFilteredResult(_0x1acc2f,_0x67d691){return function(_0x473fea){if(_0x473fea){var _0x55a7e0=typeof _0x67d691['offset']==='undefined'&&typeof _0x67d691[_0x40d7('0x1a')]===_0x40d7('0x1b');var _0x486d75=_0x473fea['count'];var _0x120964=_0x55a7e0?0x0:_0x67d691['offset'];var _0x4ed97e=_0x55a7e0?_0x473fea[_0x40d7('0x1c')]:_0x67d691[_0x40d7('0x1d')]+_0x67d691[_0x40d7('0x1a')];var _0x44fa91;if(_0x4ed97e>=_0x486d75){_0x4ed97e=_0x486d75;_0x44fa91=0xc8;}else{_0x44fa91=0xce;}_0x1acc2f[_0x40d7('0x18')](_0x44fa91);return _0x1acc2f[_0x40d7('0x1e')](_0x40d7('0x1f'),_0x120964+'-'+_0x4ed97e+'/'+_0x486d75)[_0x40d7('0x19')](_0x473fea);}return null;};}function patchUpdates(_0x5eb3c1){return function(_0x4c47cf){try{jsonpatch['apply'](_0x4c47cf,_0x5eb3c1,!![]);}catch(_0x34ea1d){return BPromise['reject'](_0x34ea1d);}return _0x4c47cf[_0x40d7('0x20')]();};}function saveUpdates(_0x145422,_0x985914){return function(_0x1a441a){if(_0x1a441a){return _0x1a441a[_0x40d7('0x21')](_0x145422)[_0x40d7('0x22')](function(_0xfec685){return _0xfec685;});}return null;};}function removeEntity(_0x3ccae9,_0x51180d){return function(_0x1cb3b2){if(_0x1cb3b2){return _0x1cb3b2[_0x40d7('0x23')]()['then'](function(){_0x3ccae9[_0x40d7('0x18')](0xcc)[_0x40d7('0x17')]();});}};}function handleEntityNotFound(_0x38276c,_0x29c62b){return function(_0x528ab5){if(!_0x528ab5){_0x38276c['sendStatus'](0x194);}return _0x528ab5;};}function handleError(_0x4889df,_0x4e7d84){_0x4e7d84=_0x4e7d84||0x1f4;return function(_0x539985){logger[_0x40d7('0x24')](_0x539985[_0x40d7('0x25')]);if(_0x539985[_0x40d7('0x26')]){delete _0x539985[_0x40d7('0x26')];}_0x4889df['status'](_0x4e7d84)['send'](_0x539985);};}exports[_0x40d7('0x27')]=function(_0x2b5f11,_0x4503cc){var _0x532ed5={'raw':!![],'where':{'id':_0x2b5f11[_0x40d7('0x28')]['id']}},_0x4fdf53={};_0x4fdf53[_0x40d7('0x29')]=_['keys'](db[_0x40d7('0x2a')][_0x40d7('0x2b')]);_0x4fdf53[_0x40d7('0x2c')]=_[_0x40d7('0x2d')](_0x2b5f11['query']);_0x4fdf53['filters']=_[_0x40d7('0x2e')](_0x4fdf53[_0x40d7('0x29')],_0x4fdf53[_0x40d7('0x2c')]);_0x532ed5[_0x40d7('0x2f')]=_[_0x40d7('0x2e')](_0x4fdf53[_0x40d7('0x29')],qs[_0x40d7('0x30')](_0x2b5f11['query'][_0x40d7('0x30')]));_0x532ed5[_0x40d7('0x2f')]=_0x532ed5[_0x40d7('0x2f')]['length']?_0x532ed5[_0x40d7('0x2f')]:_0x4fdf53[_0x40d7('0x29')];if(_0x2b5f11[_0x40d7('0x2c')][_0x40d7('0x31')]){_0x532ed5[_0x40d7('0x32')]=[{'all':!![]}];}_0x532ed5=_[_0x40d7('0x33')]({},_0x532ed5,_0x2b5f11[_0x40d7('0x34')]);return db['ChatApplication'][_0x40d7('0x35')](_0x532ed5)[_0x40d7('0x22')](handleEntityNotFound(_0x4503cc,null))[_0x40d7('0x22')](respondWithResult(_0x4503cc,null))[_0x40d7('0x36')](handleError(_0x4503cc,null));};exports[_0x40d7('0x21')]=function(_0x2d1ee6,_0x1e6f08){if(_0x2d1ee6[_0x40d7('0x37')]['id']){delete _0x2d1ee6['body']['id'];}return db['ChatApplication'][_0x40d7('0x35')]({'where':{'id':_0x2d1ee6[_0x40d7('0x28')]['id']}})['then'](handleEntityNotFound(_0x1e6f08,null))['then'](saveUpdates(_0x2d1ee6['body'],null))[_0x40d7('0x22')](respondWithResult(_0x1e6f08,null))['catch'](handleError(_0x1e6f08,null));};exports[_0x40d7('0x23')]=function(_0x56b17c,_0x798ba7){return db[_0x40d7('0x2a')][_0x40d7('0x35')]({'where':{'id':_0x56b17c[_0x40d7('0x28')]['id']}})[_0x40d7('0x22')](handleEntityNotFound(_0x798ba7,null))['then'](removeEntity(_0x798ba7,null))[_0x40d7('0x36')](handleError(_0x798ba7,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 5105a8d..50f7627 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 _0xdb90=['../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0x2ca94e,_0xd97864){var _0x1c6718=function(_0x44c561){while(--_0x44c561){_0x2ca94e['push'](_0x2ca94e['shift']());}};_0x1c6718(++_0xd97864);}(_0xdb90,0xcb));var _0x0db9=function(_0xc889e1,_0x438415){_0xc889e1=_0xc889e1-0x0;var _0x17ab9e=_0xdb90[_0xc889e1];return _0x17ab9e;};'use strict';var _=require(_0x0db9('0x0'));var util=require(_0x0db9('0x1'));var logger=require('../../config/logger')(_0x0db9('0x2'));var moment=require(_0x0db9('0x3'));var BPromise=require('bluebird');var rp=require(_0x0db9('0x4'));var fs=require('fs');var path=require(_0x0db9('0x5'));var rimraf=require(_0x0db9('0x6'));var config=require(_0x0db9('0x7'));var attributes=require(_0x0db9('0x8'));module[_0x0db9('0x9')]=function(_0x227647,_0x513a01){return _0x227647[_0x0db9('0xa')](_0x0db9('0xb'),attributes,{'tableName':_0x0db9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0db9('0xd'),'collate':_0x0db9('0xe')});}; \ No newline at end of file +var _0x95f4=['utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','utf8mb4'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x95f4,0xf1));var _0x495f=function(_0x27ff37,_0x2d4e0f){_0x27ff37=_0x27ff37-0x0;var _0x4681d7=_0x95f4[_0x27ff37];return _0x4681d7;};'use strict';var _=require(_0x495f('0x0'));var util=require(_0x495f('0x1'));var logger=require(_0x495f('0x2'))('api');var moment=require('moment');var BPromise=require(_0x495f('0x3'));var rp=require(_0x495f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x495f('0x5'));var attributes=require(_0x495f('0x6'));module[_0x495f('0x7')]=function(_0x4a56a5,_0x704a46){return _0x4a56a5[_0x495f('0x8')](_0x495f('0x9'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x495f('0xa'),'collate':_0x495f('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index da4eda1..f46b2d9 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 _0xd6f8=['result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x11aee6,_0x18af38){var _0x5094cd=function(_0x4d70fe){while(--_0x4d70fe){_0x11aee6['push'](_0x11aee6['shift']());}};_0x5094cd(++_0x18af38);}(_0xd6f8,0x1e4));var _0x8d6f=function(_0x1966f3,_0x210ea3){_0x1966f3=_0x1966f3-0x0;var _0x17575f=_0xd6f8[_0x1966f3];return _0x17575f;};'use strict';var _=require(_0x8d6f('0x0'));var util=require(_0x8d6f('0x1'));var moment=require(_0x8d6f('0x2'));var BPromise=require(_0x8d6f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8d6f('0x4'));var db=require(_0x8d6f('0x5'))['db'];var utils=require(_0x8d6f('0x6'));var logger=require(_0x8d6f('0x7'))(_0x8d6f('0x8'));var config=require('../../config/environment');var jayson=require(_0x8d6f('0x9'));var client=jayson[_0x8d6f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x738815,_0x459349,_0x383b05){return new BPromise(function(_0x6608f,_0xa86649){return client[_0x8d6f('0xb')](_0x738815,_0x383b05)[_0x8d6f('0xc')](function(_0x238a42){logger[_0x8d6f('0xd')](_0x8d6f('0xe'),_0x459349,_0x8d6f('0xf'));logger[_0x8d6f('0x10')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x459349,_0x8d6f('0xf'),JSON['stringify'](_0x238a42));if(_0x238a42[_0x8d6f('0x11')]){if(_0x238a42[_0x8d6f('0x11')][_0x8d6f('0x12')]===0x1f4){logger[_0x8d6f('0x11')](_0x8d6f('0xe'),_0x459349,_0x238a42[_0x8d6f('0x11')][_0x8d6f('0x13')]);return _0xa86649(_0x238a42['error'][_0x8d6f('0x13')]);}logger['error'](_0x8d6f('0xe'),_0x459349,_0x238a42[_0x8d6f('0x11')]['message']);return _0x6608f(_0x238a42[_0x8d6f('0x11')]['message']);}else{logger[_0x8d6f('0xd')](_0x8d6f('0xe'),_0x459349,_0x8d6f('0xf'));_0x6608f(_0x238a42[_0x8d6f('0x14')]['message']);}})['catch'](function(_0x507b82){logger[_0x8d6f('0x11')](_0x8d6f('0xe'),_0x459349,_0x507b82);_0xa86649(_0x507b82);});});} \ No newline at end of file +var _0x0569=['ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x2bb3a0,_0x33cf48){var _0x7b2fb5=function(_0xdba234){while(--_0xdba234){_0x2bb3a0['push'](_0x2bb3a0['shift']());}};_0x7b2fb5(++_0x33cf48);}(_0x0569,0x6e));var _0x9056=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x0569[_0x344a3f];return _0x264712;};'use strict';var _=require(_0x9056('0x0'));var util=require(_0x9056('0x1'));var moment=require('moment');var BPromise=require(_0x9056('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9056('0x3'));var db=require(_0x9056('0x4'))['db'];var utils=require(_0x9056('0x5'));var logger=require(_0x9056('0x6'))(_0x9056('0x7'));var config=require(_0x9056('0x8'));var jayson=require(_0x9056('0x9'));var client=jayson[_0x9056('0xa')][_0x9056('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58f779,_0x1fe675,_0x941b5f){return new BPromise(function(_0xdd408f,_0x442dc1){return client[_0x9056('0xc')](_0x58f779,_0x941b5f)[_0x9056('0xd')](function(_0x4ab054){logger[_0x9056('0xe')](_0x9056('0xf'),_0x1fe675,_0x9056('0x10'));logger[_0x9056('0x11')](_0x9056('0x12'),_0x1fe675,_0x9056('0x10'),JSON[_0x9056('0x13')](_0x4ab054));if(_0x4ab054[_0x9056('0x14')]){if(_0x4ab054['error'][_0x9056('0x15')]===0x1f4){logger['error'](_0x9056('0xf'),_0x1fe675,_0x4ab054[_0x9056('0x14')][_0x9056('0x16')]);return _0x442dc1(_0x4ab054[_0x9056('0x14')][_0x9056('0x16')]);}logger['error'](_0x9056('0xf'),_0x1fe675,_0x4ab054['error'][_0x9056('0x16')]);return _0xdd408f(_0x4ab054[_0x9056('0x14')][_0x9056('0x16')]);}else{logger[_0x9056('0xe')](_0x9056('0xf'),_0x1fe675,_0x9056('0x10'));_0xdd408f(_0x4ab054[_0x9056('0x17')][_0x9056('0x16')]);}})[_0x9056('0x18')](function(_0xc8cce8){logger[_0x9056('0x14')](_0x9056('0xf'),_0x1fe675,_0xc8cce8);_0x442dc1(_0xc8cce8);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 9120d0a..77a36e1 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 _0x74be=['isAuthenticated','show','put','update','delete','destroy','exports','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x74be,0x67));var _0xe74b=function(_0x548b6,_0x5e84a4){_0x548b6=_0x548b6-0x0;var _0x169764=_0x74be[_0x548b6];return _0x169764;};'use strict';var multer=require('multer');var util=require(_0xe74b('0x0'));var path=require(_0xe74b('0x1'));var timeout=require('connect-timeout');var express=require(_0xe74b('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe74b('0x3'));var interaction=require(_0xe74b('0x4'));var config=require(_0xe74b('0x5'));var controller=require(_0xe74b('0x6'));router[_0xe74b('0x7')](_0xe74b('0x8'),auth[_0xe74b('0x9')](),controller[_0xe74b('0xa')]);router[_0xe74b('0xb')](_0xe74b('0x8'),auth['isAuthenticated'](),controller[_0xe74b('0xc')]);router[_0xe74b('0xd')](_0xe74b('0x8'),auth[_0xe74b('0x9')](),controller[_0xe74b('0xe')]);module[_0xe74b('0xf')]=router; \ No newline at end of file +var _0x7228=['/:id','isAuthenticated','show','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get'];(function(_0x1d426f,_0x37e919){var _0x17f71a=function(_0x3bf60c){while(--_0x3bf60c){_0x1d426f['push'](_0x1d426f['shift']());}};_0x17f71a(++_0x37e919);}(_0x7228,0x1c9));var _0x8722=function(_0xbeab9,_0x37ec4a){_0xbeab9=_0xbeab9-0x0;var _0x27650c=_0x7228[_0xbeab9];return _0x27650c;};'use strict';var multer=require(_0x8722('0x0'));var util=require(_0x8722('0x1'));var path=require(_0x8722('0x2'));var timeout=require(_0x8722('0x3'));var express=require(_0x8722('0x4'));var router=express['Router']();var fs_extra=require(_0x8722('0x5'));var auth=require(_0x8722('0x6'));var interaction=require(_0x8722('0x7'));var config=require(_0x8722('0x8'));var controller=require(_0x8722('0x9'));router[_0x8722('0xa')](_0x8722('0xb'),auth[_0x8722('0xc')](),controller[_0x8722('0xd')]);router[_0x8722('0xe')](_0x8722('0xb'),auth['isAuthenticated'](),controller[_0x8722('0xf')]);router['delete'](_0x8722('0xb'),auth[_0x8722('0xc')](),controller[_0x8722('0x10')]);module[_0x8722('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 0ab73e3..f5eba6a 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 _0xba6e=['sequelize','exports','STRING'];(function(_0x2433e3,_0x28ac1e){var _0x3e5feb=function(_0x47f203){while(--_0x47f203){_0x2433e3['push'](_0x2433e3['shift']());}};_0x3e5feb(++_0x28ac1e);}(_0xba6e,0x168));var _0xeba6=function(_0x3b1252,_0x43691c){_0x3b1252=_0x3b1252-0x0;var _0x1af329=_0xba6e[_0x3b1252];return _0x1af329;};'use strict';var Sequelize=require(_0xeba6('0x0'));module[_0xeba6('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xeba6('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xcf58=['STRING','BOOLEAN','sequelize','exports'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xcf58,0x1be));var _0x8cf5=function(_0x579f79,_0x1f1bab){_0x579f79=_0x579f79-0x0;var _0x4c52f9=_0xcf58[_0x579f79];return _0x4c52f9;};'use strict';var Sequelize=require(_0x8cf5('0x0'));module[_0x8cf5('0x1')]={'name':{'type':Sequelize[_0x8cf5('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x8cf5('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 cf53e00..7c46737 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 _0x46b9=['map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','ChatGroup','includeAll','include','rows','show','params','rawAttributes','find','catch','create','body','describe','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','order','removeMembers','ChatGroupId','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index'];(function(_0x435eac,_0x459918){var _0x436f53=function(_0x450946){while(--_0x450946){_0x435eac['push'](_0x435eac['shift']());}};_0x436f53(++_0x459918);}(_0x46b9,0x90));var _0x946b=function(_0x5c4273,_0x46315e){_0x5c4273=_0x5c4273-0x0;var _0x4a0173=_0x46b9[_0x5c4273];return _0x4a0173;};'use strict';var emlformat=require(_0x946b('0x0'));var rimraf=require(_0x946b('0x1'));var zipdir=require(_0x946b('0x2'));var jsonpatch=require(_0x946b('0x3'));var rp=require(_0x946b('0x4'));var moment=require(_0x946b('0x5'));var BPromise=require(_0x946b('0x6'));var Mustache=require(_0x946b('0x7'));var util=require(_0x946b('0x8'));var path=require('path');var sox=require(_0x946b('0x9'));var csv=require(_0x946b('0xa'));var ejs=require(_0x946b('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x946b('0xc'));var squel=require('squel');var crypto=require(_0x946b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x946b('0xe'));var toCsv=require(_0x946b('0xa'));var querystring=require(_0x946b('0xf'));var Papa=require('papaparse');var Redis=require(_0x946b('0x10'));var authService=require(_0x946b('0x11'));var qs=require(_0x946b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x946b('0x13'));var logger=require(_0x946b('0x14'))('api');var utils=require(_0x946b('0x15'));var config=require(_0x946b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x946b('0x17'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x946b('0x18'),'port':0x18eb});var socket=require(_0x946b('0x19'))(new Redis(config['redis']));require(_0x946b('0x1a'))[_0x946b('0x1b')](socket);function respondWithStatusCode(_0x34e3dd,_0x35424d){_0x35424d=_0x35424d||0xcc;return function(_0x101e8e){if(_0x101e8e){return _0x34e3dd[_0x946b('0x1c')](_0x35424d);}return _0x34e3dd[_0x946b('0x1d')](_0x35424d)[_0x946b('0x1e')]();};}function respondWithResult(_0x68854d,_0x27e07d){_0x27e07d=_0x27e07d||0xc8;return function(_0x16a27e){if(_0x16a27e){return _0x68854d['status'](_0x27e07d)[_0x946b('0x1f')](_0x16a27e);}};}function respondWithFilteredResult(_0x44e54d,_0x59d005){return function(_0x5e8742){if(_0x5e8742){var _0x248af4=typeof _0x59d005[_0x946b('0x20')]===_0x946b('0x21')&&typeof _0x59d005['limit']===_0x946b('0x21');var _0x38f4fc=_0x5e8742[_0x946b('0x22')];var _0x2dc652=_0x248af4?0x0:_0x59d005[_0x946b('0x20')];var _0x1965ad=_0x248af4?_0x5e8742[_0x946b('0x22')]:_0x59d005[_0x946b('0x20')]+_0x59d005[_0x946b('0x23')];var _0x16134b;if(_0x1965ad>=_0x38f4fc){_0x1965ad=_0x38f4fc;_0x16134b=0xc8;}else{_0x16134b=0xce;}_0x44e54d[_0x946b('0x1d')](_0x16134b);return _0x44e54d[_0x946b('0x24')](_0x946b('0x25'),_0x2dc652+'-'+_0x1965ad+'/'+_0x38f4fc)[_0x946b('0x1f')](_0x5e8742);}return null;};}function patchUpdates(_0x240f88){return function(_0x40d956){try{jsonpatch[_0x946b('0x26')](_0x40d956,_0x240f88,!![]);}catch(_0xe80bd9){return BPromise[_0x946b('0x27')](_0xe80bd9);}return _0x40d956[_0x946b('0x28')]();};}function saveUpdates(_0x401c92,_0x9e3d69){return function(_0x22db9d){if(_0x22db9d){return _0x22db9d[_0x946b('0x29')](_0x401c92)['then'](function(_0x3ed6aa){return _0x3ed6aa;});}return null;};}function removeEntity(_0xceee59,_0x33e298){return function(_0x205237){if(_0x205237){return _0x205237['destroy']()[_0x946b('0x2a')](function(){_0xceee59['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f91da,_0x296646){return function(_0x583897){if(!_0x583897){_0x1f91da[_0x946b('0x1c')](0x194);}return _0x583897;};}function handleError(_0x3f0ddb,_0x564817){_0x564817=_0x564817||0x1f4;return function(_0x5c01db){logger[_0x946b('0x2b')](_0x5c01db[_0x946b('0x2c')]);if(_0x5c01db[_0x946b('0x2d')]){delete _0x5c01db['name'];}_0x3f0ddb[_0x946b('0x1d')](_0x564817)[_0x946b('0x2e')](_0x5c01db);};}exports[_0x946b('0x2f')]=function(_0x3f5318,_0x52cb74){var _0x1b0a8a={},_0x39bdb7={},_0x4debd9={'count':0x0,'rows':[]};var _0x14c88f=_[_0x946b('0x30')](db['ChatGroup']['rawAttributes'],function(_0x53b2aa){return{'name':_0x53b2aa[_0x946b('0x31')],'type':_0x53b2aa[_0x946b('0x32')][_0x946b('0x33')]};});_0x39bdb7[_0x946b('0x34')]=_[_0x946b('0x30')](_0x14c88f,_0x946b('0x2d'));_0x39bdb7[_0x946b('0x35')]=_[_0x946b('0x36')](_0x3f5318[_0x946b('0x35')]);_0x39bdb7[_0x946b('0x37')]=_[_0x946b('0x38')](_0x39bdb7['model'],_0x39bdb7[_0x946b('0x35')]);_0x1b0a8a[_0x946b('0x39')]=_[_0x946b('0x38')](_0x39bdb7['model'],qs[_0x946b('0x3a')](_0x3f5318['query'][_0x946b('0x3a')]));_0x1b0a8a[_0x946b('0x39')]=_0x1b0a8a[_0x946b('0x39')][_0x946b('0x3b')]?_0x1b0a8a[_0x946b('0x39')]:_0x39bdb7[_0x946b('0x34')];if(!_0x3f5318[_0x946b('0x35')][_0x946b('0x3c')](_0x946b('0x3d'))){_0x1b0a8a[_0x946b('0x23')]=qs[_0x946b('0x23')](_0x3f5318['query']['limit']);_0x1b0a8a[_0x946b('0x20')]=qs[_0x946b('0x20')](_0x3f5318[_0x946b('0x35')][_0x946b('0x20')]);}_0x1b0a8a['order']=qs[_0x946b('0x3e')](_0x3f5318[_0x946b('0x35')][_0x946b('0x3e')]);_0x1b0a8a['where']=qs['filters'](_[_0x946b('0x3f')](_0x3f5318[_0x946b('0x35')],_0x39bdb7[_0x946b('0x37')]),_0x14c88f);if(_0x3f5318[_0x946b('0x35')][_0x946b('0x40')]){_0x1b0a8a[_0x946b('0x41')]=_[_0x946b('0x42')](_0x1b0a8a[_0x946b('0x41')],{'$or':_[_0x946b('0x30')](_0x14c88f,function(_0x7e24da){if(_0x7e24da[_0x946b('0x32')]!==_0x946b('0x43')){var _0x3e4489={};_0x3e4489[_0x7e24da[_0x946b('0x2d')]]={'$like':'%'+_0x3f5318['query'][_0x946b('0x40')]+'%'};return _0x3e4489;}})});}_0x1b0a8a=_[_0x946b('0x42')]({},_0x1b0a8a,_0x3f5318[_0x946b('0x44')]);var _0x1fffd5={'where':_0x1b0a8a[_0x946b('0x41')]};return db[_0x946b('0x45')][_0x946b('0x22')](_0x1fffd5)[_0x946b('0x2a')](function(_0x261eb4){_0x4debd9['count']=_0x261eb4;if(_0x3f5318[_0x946b('0x35')][_0x946b('0x46')]){_0x1b0a8a[_0x946b('0x47')]=[{'all':!![]}];}return db[_0x946b('0x45')]['findAll'](_0x1b0a8a);})['then'](function(_0x3a44ab){_0x4debd9[_0x946b('0x48')]=_0x3a44ab;return _0x4debd9;})[_0x946b('0x2a')](respondWithFilteredResult(_0x52cb74,_0x1b0a8a))['catch'](handleError(_0x52cb74,null));};exports[_0x946b('0x49')]=function(_0xd2c78f,_0x4afcc2){var _0xe8cc82={'raw':!![],'where':{'id':_0xd2c78f[_0x946b('0x4a')]['id']}},_0x4a9749={};_0x4a9749[_0x946b('0x34')]=_[_0x946b('0x36')](db['ChatGroup'][_0x946b('0x4b')]);_0x4a9749[_0x946b('0x35')]=_[_0x946b('0x36')](_0xd2c78f[_0x946b('0x35')]);_0x4a9749[_0x946b('0x37')]=_['intersection'](_0x4a9749[_0x946b('0x34')],_0x4a9749['query']);_0xe8cc82[_0x946b('0x39')]=_[_0x946b('0x38')](_0x4a9749[_0x946b('0x34')],qs[_0x946b('0x3a')](_0xd2c78f[_0x946b('0x35')][_0x946b('0x3a')]));_0xe8cc82[_0x946b('0x39')]=_0xe8cc82[_0x946b('0x39')]['length']?_0xe8cc82[_0x946b('0x39')]:_0x4a9749[_0x946b('0x34')];if(_0xd2c78f[_0x946b('0x35')][_0x946b('0x46')]){_0xe8cc82[_0x946b('0x47')]=[{'all':!![]}];}_0xe8cc82=_[_0x946b('0x42')]({},_0xe8cc82,_0xd2c78f[_0x946b('0x44')]);return db['ChatGroup'][_0x946b('0x4c')](_0xe8cc82)[_0x946b('0x2a')](handleEntityNotFound(_0x4afcc2,null))['then'](respondWithResult(_0x4afcc2,null))[_0x946b('0x4d')](handleError(_0x4afcc2,null));};exports['create']=function(_0x56f56e,_0x167d80){return db['ChatGroup'][_0x946b('0x4e')](_0x56f56e[_0x946b('0x4f')],{})[_0x946b('0x2a')](respondWithResult(_0x167d80,0xc9))[_0x946b('0x4d')](handleError(_0x167d80,null));};exports[_0x946b('0x29')]=function(_0x138646,_0x3b3ce7){if(_0x138646[_0x946b('0x4f')]['id']){delete _0x138646[_0x946b('0x4f')]['id'];}return db[_0x946b('0x45')][_0x946b('0x4c')]({'where':{'id':_0x138646[_0x946b('0x4a')]['id']}})[_0x946b('0x2a')](handleEntityNotFound(_0x3b3ce7,null))[_0x946b('0x2a')](saveUpdates(_0x138646[_0x946b('0x4f')],null))['then'](respondWithResult(_0x3b3ce7,null))[_0x946b('0x4d')](handleError(_0x3b3ce7,null));};exports['destroy']=function(_0x5bda76,_0x493c06){return db[_0x946b('0x45')][_0x946b('0x4c')]({'where':{'id':_0x5bda76[_0x946b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x493c06,null))[_0x946b('0x2a')](removeEntity(_0x493c06,null))[_0x946b('0x4d')](handleError(_0x493c06,null));};exports[_0x946b('0x50')]=function(_0x44979c,_0x1df06a){return db[_0x946b('0x45')][_0x946b('0x50')]()[_0x946b('0x2a')](respondWithResult(_0x1df06a,null))[_0x946b('0x4d')](handleError(_0x1df06a,null));};exports['getUnread']=function(_0x88f55c,_0x2060e2,_0xce24fe){return db[_0x946b('0x51')][_0x946b('0x22')]({'where':{'ChatGroupId':_0x88f55c[_0x946b('0x4a')]['id'],'ToId':_0x88f55c[_0x946b('0x52')]['id'],'read':![]}})[_0x946b('0x2a')](function(_0x4bcfc5){return{'id':_[_0x946b('0x53')](_0x88f55c[_0x946b('0x4a')]['id']),'count':_0x4bcfc5};})[_0x946b('0x2a')](respondWithResult(_0x2060e2,null))['catch'](handleError(_0x2060e2,null));};exports[_0x946b('0x54')]=function(_0x284d9f,_0xaec05,_0x1cbcf5){return db[_0x946b('0x45')][_0x946b('0x4c')]({'where':{'id':_0x284d9f[_0x946b('0x4a')]['id']}})['then'](handleEntityNotFound(_0xaec05,null))[_0x946b('0x2a')](function(_0x4112a4){if(_0x4112a4){return _0x4112a4[_0x946b('0x54')](_0x284d9f['body'][_0x946b('0x55')],_[_0x946b('0x56')](_0x284d9f[_0x946b('0x4f')],[_0x946b('0x55'),'id'])||{});}})[_0x946b('0x2a')](respondWithResult(_0xaec05,null))[_0x946b('0x4d')](handleError(_0xaec05,null));};exports[_0x946b('0x57')]=function(_0x5c6c66,_0x49c926,_0x4b84dd){var _0x3553c6={};var _0x269a7={};var _0x592793;var _0x201f78;return db[_0x946b('0x45')][_0x946b('0x58')]({'where':{'id':_0x5c6c66[_0x946b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x49c926,null))[_0x946b('0x2a')](function(_0x3b0008){if(_0x3b0008){_0x592793=_0x3b0008;_0x269a7[_0x946b('0x34')]=_['keys'](db['User']['rawAttributes']);_0x269a7[_0x946b('0x35')]=_[_0x946b('0x36')](_0x5c6c66[_0x946b('0x35')]);_0x269a7[_0x946b('0x37')]=_[_0x946b('0x38')](_0x269a7[_0x946b('0x34')],_0x269a7[_0x946b('0x35')]);_0x3553c6['attributes']=_[_0x946b('0x38')](_0x269a7[_0x946b('0x34')],qs[_0x946b('0x3a')](_0x5c6c66[_0x946b('0x35')][_0x946b('0x3a')]));_0x3553c6[_0x946b('0x39')]=_0x3553c6[_0x946b('0x39')][_0x946b('0x3b')]?_0x3553c6['attributes']:_0x269a7[_0x946b('0x34')];_0x3553c6[_0x946b('0x59')]=qs['sort'](_0x5c6c66[_0x946b('0x35')][_0x946b('0x3e')]);_0x3553c6['where']=qs['filters'](_[_0x946b('0x3f')](_0x5c6c66['query'],_0x269a7['filters']));if(_0x5c6c66[_0x946b('0x35')][_0x946b('0x40')]){_0x3553c6['where']=_['merge'](_0x3553c6[_0x946b('0x41')],{'$or':_['map'](_0x3553c6[_0x946b('0x39')],function(_0x5d402f){var _0x5e8ea4={};_0x5e8ea4[_0x5d402f]={'$like':'%'+_0x5c6c66[_0x946b('0x35')][_0x946b('0x40')]+'%'};return _0x5e8ea4;})});}_0x3553c6=_[_0x946b('0x42')]({},_0x3553c6,_0x5c6c66[_0x946b('0x44')]);return _0x592793[_0x946b('0x57')](_0x3553c6);}})[_0x946b('0x2a')](function(_0x4b45eb){if(_0x4b45eb){_0x201f78=_0x4b45eb[_0x946b('0x3b')];if(!_0x5c6c66['query'][_0x946b('0x3c')](_0x946b('0x3d'))){_0x3553c6[_0x946b('0x23')]=qs[_0x946b('0x23')](_0x5c6c66['query']['limit']);_0x3553c6['offset']=qs[_0x946b('0x20')](_0x5c6c66['query'][_0x946b('0x20')]);}return _0x592793[_0x946b('0x57')](_0x3553c6);}})[_0x946b('0x2a')](function(_0x41dd58){if(_0x41dd58){return _0x41dd58?{'count':_0x201f78,'rows':_0x41dd58}:null;}})[_0x946b('0x2a')](respondWithResult(_0x49c926,null))[_0x946b('0x4d')](handleError(_0x49c926,null));};exports[_0x946b('0x5a')]=function(_0x1e8b58,_0x26ef7e,_0xe0f6c8){return db[_0x946b('0x45')][_0x946b('0x4c')]({'where':{'id':_0x1e8b58['params']['id']}})[_0x946b('0x2a')](handleEntityNotFound(_0x26ef7e,null))['then'](function(_0x257400){if(_0x257400){return _0x257400[_0x946b('0x5a')](_0x1e8b58['query'][_0x946b('0x55')]);}})[_0x946b('0x2a')](respondWithStatusCode(_0x26ef7e,null))['catch'](handleError(_0x26ef7e,null));};exports['addMessage']=function(_0x46479f,_0x2b6c98,_0x2e6790){if(_0x46479f[_0x946b('0x4f')]['id']){delete _0x46479f[_0x946b('0x4f')]['id'];}return db[_0x946b('0x45')][_0x946b('0x4c')]({'where':{'id':_0x46479f[_0x946b('0x4a')]['id']}})[_0x946b('0x2a')](handleEntityNotFound(_0x2b6c98,null))[_0x946b('0x2a')](function(_0x3ed570){if(_0x3ed570){_0x46479f[_0x946b('0x4f')][_0x946b('0x5b')]=_0x3ed570['id'];return db[_0x946b('0x51')][_0x946b('0x4e')](_0x46479f[_0x946b('0x4f')]);}})[_0x946b('0x2a')](respondWithResult(_0x2b6c98,null))[_0x946b('0x4d')](handleError(_0x2b6c98,null));};exports[_0x946b('0x5c')]=function(_0x468e60,_0x4973b7,_0x1eccda){var _0x3a1cb1={};var _0x3190ed={};var _0x190b95;var _0xd15be3;return db[_0x946b('0x45')][_0x946b('0x58')]({'where':{'id':_0x468e60[_0x946b('0x4a')]['id']}})[_0x946b('0x2a')](handleEntityNotFound(_0x4973b7,null))[_0x946b('0x2a')](function(_0x66f599){if(_0x66f599){_0x190b95=_0x66f599;_0x3190ed[_0x946b('0x34')]=_[_0x946b('0x36')](db[_0x946b('0x51')]['rawAttributes']);_0x3190ed[_0x946b('0x35')]=_['keys'](_0x468e60['query']);_0x3190ed[_0x946b('0x37')]=_['intersection'](_0x3190ed[_0x946b('0x34')],_0x3190ed[_0x946b('0x35')]);_0x3a1cb1[_0x946b('0x39')]=_['intersection'](_0x3190ed[_0x946b('0x34')],qs[_0x946b('0x3a')](_0x468e60[_0x946b('0x35')]['fields']));_0x3a1cb1[_0x946b('0x39')]=_0x3a1cb1[_0x946b('0x39')][_0x946b('0x3b')]?_0x3a1cb1[_0x946b('0x39')]:_0x3190ed[_0x946b('0x34')];_0x3a1cb1[_0x946b('0x59')]=qs[_0x946b('0x3e')](_0x468e60['query'][_0x946b('0x3e')]);_0x3a1cb1[_0x946b('0x41')]=qs[_0x946b('0x37')](_[_0x946b('0x3f')](_0x468e60[_0x946b('0x35')],_0x3190ed[_0x946b('0x37')]));if(_0x468e60['query'][_0x946b('0x40')]){_0x3a1cb1[_0x946b('0x41')]=_[_0x946b('0x42')](_0x3a1cb1[_0x946b('0x41')],{'$or':_['map'](_0x3a1cb1[_0x946b('0x39')],function(_0xb96e5b){var _0x42b899={};_0x42b899[_0xb96e5b]={'$like':'%'+_0x468e60[_0x946b('0x35')][_0x946b('0x40')]+'%'};return _0x42b899;})});}if(_0x468e60[_0x946b('0x35')][_0x946b('0x5d')]){var _0x3ab846=_0x468e60[_0x946b('0x35')][_0x946b('0x5d')]['split'](',');var _0x447b87={};_0x447b87[_0x3ab846[0x0]]={'$gte':moment(_0x3ab846[0x1])[_0x946b('0x5e')](_0x946b('0x5f'))};_0x3a1cb1[_0x946b('0x41')]=_[_0x946b('0x42')](_0x3a1cb1[_0x946b('0x41')],_0x447b87);}_0x3a1cb1=_[_0x946b('0x42')]({},_0x3a1cb1,_0x468e60[_0x946b('0x44')]);return _0x190b95['getMessages'](_0x3a1cb1);}})[_0x946b('0x2a')](function(_0x33f872){if(_0x33f872){_0xd15be3=_0x33f872[_0x946b('0x3b')];if(!_0x468e60[_0x946b('0x35')][_0x946b('0x3c')]('nolimit')){_0x3a1cb1[_0x946b('0x23')]=qs[_0x946b('0x23')](_0x468e60[_0x946b('0x35')]['limit']);_0x3a1cb1[_0x946b('0x20')]=qs[_0x946b('0x20')](_0x468e60[_0x946b('0x35')][_0x946b('0x20')]);}return _0x190b95[_0x946b('0x5c')](_0x3a1cb1);}})['then'](function(_0x2fb860){if(_0x2fb860){return _0x2fb860?{'count':_0xd15be3,'rows':_0x2fb860}:null;}})[_0x946b('0x2a')](respondWithResult(_0x4973b7,null))['catch'](handleError(_0x4973b7,null));}; \ No newline at end of file +var _0xf9db=['removeMembers','addMessage','ChatGroupId','getMessages','findOne','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','register','sendStatus','end','json','limit','offset','count','status','set','apply','reject','save','then','error','name','send','map','ChatGroup','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','create','body','update','destroy','find','describe','getUnread','ChatInternalMessage','toInteger','addMembers','ids','omit','getMembers','filter'];(function(_0x31c19c,_0xbe4b70){var _0x1a87f7=function(_0x23cf92){while(--_0x23cf92){_0x31c19c['push'](_0x31c19c['shift']());}};_0x1a87f7(++_0xbe4b70);}(_0xf9db,0x6b));var _0xbf9d=function(_0x33c69b,_0x3ffbcd){_0x33c69b=_0x33c69b-0x0;var _0x160012=_0xf9db[_0x33c69b];return _0x160012;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbf9d('0x0'));var zipdir=require(_0xbf9d('0x1'));var jsonpatch=require(_0xbf9d('0x2'));var rp=require(_0xbf9d('0x3'));var moment=require(_0xbf9d('0x4'));var BPromise=require(_0xbf9d('0x5'));var Mustache=require(_0xbf9d('0x6'));var util=require(_0xbf9d('0x7'));var path=require(_0xbf9d('0x8'));var sox=require(_0xbf9d('0x9'));var csv=require(_0xbf9d('0xa'));var ejs=require(_0xbf9d('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbf9d('0xc'));var squel=require('squel');var crypto=require(_0xbf9d('0xd'));var jsforce=require(_0xbf9d('0xe'));var deskjs=require(_0xbf9d('0xf'));var toCsv=require(_0xbf9d('0xa'));var querystring=require(_0xbf9d('0x10'));var Papa=require(_0xbf9d('0x11'));var Redis=require(_0xbf9d('0x12'));var authService=require(_0xbf9d('0x13'));var qs=require(_0xbf9d('0x14'));var as=require(_0xbf9d('0x15'));var hardwareService=require(_0xbf9d('0x16'));var logger=require(_0xbf9d('0x17'))('api');var utils=require(_0xbf9d('0x18'));var config=require(_0xbf9d('0x19'));var licenseUtil=require(_0xbf9d('0x1a'));var db=require('../../mysqldb')['db'];config[_0xbf9d('0x1b')]=_['defaults'](config['redis'],{'host':_0xbf9d('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbf9d('0x1b')]));require('./chatGroup.socket')[_0xbf9d('0x1d')](socket);function respondWithStatusCode(_0x343aec,_0x160cb7){_0x160cb7=_0x160cb7||0xcc;return function(_0x116022){if(_0x116022){return _0x343aec[_0xbf9d('0x1e')](_0x160cb7);}return _0x343aec['status'](_0x160cb7)[_0xbf9d('0x1f')]();};}function respondWithResult(_0x16b089,_0x1d2083){_0x1d2083=_0x1d2083||0xc8;return function(_0x212da7){if(_0x212da7){return _0x16b089['status'](_0x1d2083)[_0xbf9d('0x20')](_0x212da7);}};}function respondWithFilteredResult(_0x49a443,_0x3feca7){return function(_0x4c9a4a){if(_0x4c9a4a){var _0x2620dd=typeof _0x3feca7['offset']==='undefined'&&typeof _0x3feca7[_0xbf9d('0x21')]==='undefined';var _0x4978d6=_0x4c9a4a['count'];var _0x2816b5=_0x2620dd?0x0:_0x3feca7[_0xbf9d('0x22')];var _0x5c8541=_0x2620dd?_0x4c9a4a[_0xbf9d('0x23')]:_0x3feca7[_0xbf9d('0x22')]+_0x3feca7[_0xbf9d('0x21')];var _0x39ad69;if(_0x5c8541>=_0x4978d6){_0x5c8541=_0x4978d6;_0x39ad69=0xc8;}else{_0x39ad69=0xce;}_0x49a443[_0xbf9d('0x24')](_0x39ad69);return _0x49a443[_0xbf9d('0x25')]('Content-Range',_0x2816b5+'-'+_0x5c8541+'/'+_0x4978d6)['json'](_0x4c9a4a);}return null;};}function patchUpdates(_0x3733e7){return function(_0x41978f){try{jsonpatch[_0xbf9d('0x26')](_0x41978f,_0x3733e7,!![]);}catch(_0x2412a3){return BPromise[_0xbf9d('0x27')](_0x2412a3);}return _0x41978f[_0xbf9d('0x28')]();};}function saveUpdates(_0xf73c5b,_0x46725f){return function(_0x32601e){if(_0x32601e){return _0x32601e['update'](_0xf73c5b)[_0xbf9d('0x29')](function(_0x1aee9e){return _0x1aee9e;});}return null;};}function removeEntity(_0x2880b5,_0x467f9a){return function(_0x1a7986){if(_0x1a7986){return _0x1a7986['destroy']()[_0xbf9d('0x29')](function(){_0x2880b5[_0xbf9d('0x24')](0xcc)[_0xbf9d('0x1f')]();});}};}function handleEntityNotFound(_0x4c0830,_0x1c5a18){return function(_0x39fca6){if(!_0x39fca6){_0x4c0830[_0xbf9d('0x1e')](0x194);}return _0x39fca6;};}function handleError(_0x4be7ff,_0x18f42b){_0x18f42b=_0x18f42b||0x1f4;return function(_0x34a6d6){logger[_0xbf9d('0x2a')](_0x34a6d6['stack']);if(_0x34a6d6['name']){delete _0x34a6d6[_0xbf9d('0x2b')];}_0x4be7ff[_0xbf9d('0x24')](_0x18f42b)[_0xbf9d('0x2c')](_0x34a6d6);};}exports['index']=function(_0x412ba9,_0xf8c497){var _0x27b22f={},_0x59850c={},_0xfb8799={'count':0x0,'rows':[]};var _0x1aa726=_[_0xbf9d('0x2d')](db[_0xbf9d('0x2e')][_0xbf9d('0x2f')],function(_0x22ad39){return{'name':_0x22ad39[_0xbf9d('0x30')],'type':_0x22ad39[_0xbf9d('0x31')][_0xbf9d('0x32')]};});_0x59850c[_0xbf9d('0x33')]=_[_0xbf9d('0x2d')](_0x1aa726,_0xbf9d('0x2b'));_0x59850c[_0xbf9d('0x34')]=_[_0xbf9d('0x35')](_0x412ba9[_0xbf9d('0x34')]);_0x59850c[_0xbf9d('0x36')]=_[_0xbf9d('0x37')](_0x59850c[_0xbf9d('0x33')],_0x59850c[_0xbf9d('0x34')]);_0x27b22f[_0xbf9d('0x38')]=_[_0xbf9d('0x37')](_0x59850c[_0xbf9d('0x33')],qs['fields'](_0x412ba9[_0xbf9d('0x34')][_0xbf9d('0x39')]));_0x27b22f['attributes']=_0x27b22f[_0xbf9d('0x38')]['length']?_0x27b22f[_0xbf9d('0x38')]:_0x59850c[_0xbf9d('0x33')];if(!_0x412ba9[_0xbf9d('0x34')][_0xbf9d('0x3a')](_0xbf9d('0x3b'))){_0x27b22f[_0xbf9d('0x21')]=qs['limit'](_0x412ba9['query'][_0xbf9d('0x21')]);_0x27b22f[_0xbf9d('0x22')]=qs[_0xbf9d('0x22')](_0x412ba9[_0xbf9d('0x34')]['offset']);}_0x27b22f[_0xbf9d('0x3c')]=qs[_0xbf9d('0x3d')](_0x412ba9[_0xbf9d('0x34')][_0xbf9d('0x3d')]);_0x27b22f[_0xbf9d('0x3e')]=qs[_0xbf9d('0x36')](_[_0xbf9d('0x3f')](_0x412ba9[_0xbf9d('0x34')],_0x59850c[_0xbf9d('0x36')]),_0x1aa726);if(_0x412ba9[_0xbf9d('0x34')]['filter']){_0x27b22f[_0xbf9d('0x3e')]=_[_0xbf9d('0x40')](_0x27b22f[_0xbf9d('0x3e')],{'$or':_[_0xbf9d('0x2d')](_0x1aa726,function(_0x351208){if(_0x351208[_0xbf9d('0x31')]!==_0xbf9d('0x41')){var _0x1a0ad3={};_0x1a0ad3[_0x351208[_0xbf9d('0x2b')]]={'$like':'%'+_0x412ba9[_0xbf9d('0x34')]['filter']+'%'};return _0x1a0ad3;}})});}_0x27b22f=_[_0xbf9d('0x40')]({},_0x27b22f,_0x412ba9[_0xbf9d('0x42')]);var _0x5d7bc8={'where':_0x27b22f[_0xbf9d('0x3e')]};return db[_0xbf9d('0x2e')][_0xbf9d('0x23')](_0x5d7bc8)[_0xbf9d('0x29')](function(_0x30a497){_0xfb8799[_0xbf9d('0x23')]=_0x30a497;if(_0x412ba9[_0xbf9d('0x34')][_0xbf9d('0x43')]){_0x27b22f['include']=[{'all':!![]}];}return db[_0xbf9d('0x2e')][_0xbf9d('0x44')](_0x27b22f);})[_0xbf9d('0x29')](function(_0xbfca1b){_0xfb8799[_0xbf9d('0x45')]=_0xbfca1b;return _0xfb8799;})[_0xbf9d('0x29')](respondWithFilteredResult(_0xf8c497,_0x27b22f))[_0xbf9d('0x46')](handleError(_0xf8c497,null));};exports[_0xbf9d('0x47')]=function(_0x8b9db4,_0x58862f){var _0x522670={'raw':!![],'where':{'id':_0x8b9db4[_0xbf9d('0x48')]['id']}},_0xdbda2c={};_0xdbda2c[_0xbf9d('0x33')]=_[_0xbf9d('0x35')](db['ChatGroup'][_0xbf9d('0x2f')]);_0xdbda2c[_0xbf9d('0x34')]=_[_0xbf9d('0x35')](_0x8b9db4[_0xbf9d('0x34')]);_0xdbda2c['filters']=_[_0xbf9d('0x37')](_0xdbda2c[_0xbf9d('0x33')],_0xdbda2c[_0xbf9d('0x34')]);_0x522670[_0xbf9d('0x38')]=_['intersection'](_0xdbda2c[_0xbf9d('0x33')],qs[_0xbf9d('0x39')](_0x8b9db4['query']['fields']));_0x522670[_0xbf9d('0x38')]=_0x522670[_0xbf9d('0x38')][_0xbf9d('0x49')]?_0x522670[_0xbf9d('0x38')]:_0xdbda2c[_0xbf9d('0x33')];if(_0x8b9db4['query'][_0xbf9d('0x43')]){_0x522670[_0xbf9d('0x4a')]=[{'all':!![]}];}_0x522670=_[_0xbf9d('0x40')]({},_0x522670,_0x8b9db4[_0xbf9d('0x42')]);return db[_0xbf9d('0x2e')]['find'](_0x522670)[_0xbf9d('0x29')](handleEntityNotFound(_0x58862f,null))['then'](respondWithResult(_0x58862f,null))[_0xbf9d('0x46')](handleError(_0x58862f,null));};exports[_0xbf9d('0x4b')]=function(_0x3f807b,_0x5ee722){return db[_0xbf9d('0x2e')][_0xbf9d('0x4b')](_0x3f807b[_0xbf9d('0x4c')],{})['then'](respondWithResult(_0x5ee722,0xc9))[_0xbf9d('0x46')](handleError(_0x5ee722,null));};exports[_0xbf9d('0x4d')]=function(_0x12fd47,_0xb5d910){if(_0x12fd47[_0xbf9d('0x4c')]['id']){delete _0x12fd47[_0xbf9d('0x4c')]['id'];}return db[_0xbf9d('0x2e')]['find']({'where':{'id':_0x12fd47['params']['id']}})[_0xbf9d('0x29')](handleEntityNotFound(_0xb5d910,null))[_0xbf9d('0x29')](saveUpdates(_0x12fd47[_0xbf9d('0x4c')],null))['then'](respondWithResult(_0xb5d910,null))[_0xbf9d('0x46')](handleError(_0xb5d910,null));};exports[_0xbf9d('0x4e')]=function(_0x2798d0,_0x597c5c){return db[_0xbf9d('0x2e')][_0xbf9d('0x4f')]({'where':{'id':_0x2798d0[_0xbf9d('0x48')]['id']}})[_0xbf9d('0x29')](handleEntityNotFound(_0x597c5c,null))[_0xbf9d('0x29')](removeEntity(_0x597c5c,null))[_0xbf9d('0x46')](handleError(_0x597c5c,null));};exports[_0xbf9d('0x50')]=function(_0x58d4d6,_0x5d98e4){return db[_0xbf9d('0x2e')]['describe']()['then'](respondWithResult(_0x5d98e4,null))[_0xbf9d('0x46')](handleError(_0x5d98e4,null));};exports[_0xbf9d('0x51')]=function(_0x389184,_0x3461d2,_0xccd720){return db[_0xbf9d('0x52')][_0xbf9d('0x23')]({'where':{'ChatGroupId':_0x389184['params']['id'],'ToId':_0x389184['user']['id'],'read':![]}})['then'](function(_0x204383){return{'id':_[_0xbf9d('0x53')](_0x389184[_0xbf9d('0x48')]['id']),'count':_0x204383};})[_0xbf9d('0x29')](respondWithResult(_0x3461d2,null))[_0xbf9d('0x46')](handleError(_0x3461d2,null));};exports[_0xbf9d('0x54')]=function(_0x564dd8,_0x742d8a,_0x2b0c93){return db[_0xbf9d('0x2e')][_0xbf9d('0x4f')]({'where':{'id':_0x564dd8[_0xbf9d('0x48')]['id']}})[_0xbf9d('0x29')](handleEntityNotFound(_0x742d8a,null))[_0xbf9d('0x29')](function(_0x1c8523){if(_0x1c8523){return _0x1c8523[_0xbf9d('0x54')](_0x564dd8[_0xbf9d('0x4c')][_0xbf9d('0x55')],_[_0xbf9d('0x56')](_0x564dd8['body'],[_0xbf9d('0x55'),'id'])||{});}})[_0xbf9d('0x29')](respondWithResult(_0x742d8a,null))[_0xbf9d('0x46')](handleError(_0x742d8a,null));};exports[_0xbf9d('0x57')]=function(_0x21d89a,_0x5c65e5,_0x3d8842){var _0x34be0f={};var _0x3d2e1c={};var _0x31b6b7;var _0x252b20;return db[_0xbf9d('0x2e')]['findOne']({'where':{'id':_0x21d89a['params']['id']}})[_0xbf9d('0x29')](handleEntityNotFound(_0x5c65e5,null))['then'](function(_0x52f267){if(_0x52f267){_0x31b6b7=_0x52f267;_0x3d2e1c[_0xbf9d('0x33')]=_[_0xbf9d('0x35')](db['User'][_0xbf9d('0x2f')]);_0x3d2e1c['query']=_[_0xbf9d('0x35')](_0x21d89a['query']);_0x3d2e1c[_0xbf9d('0x36')]=_['intersection'](_0x3d2e1c[_0xbf9d('0x33')],_0x3d2e1c['query']);_0x34be0f[_0xbf9d('0x38')]=_['intersection'](_0x3d2e1c[_0xbf9d('0x33')],qs[_0xbf9d('0x39')](_0x21d89a[_0xbf9d('0x34')][_0xbf9d('0x39')]));_0x34be0f[_0xbf9d('0x38')]=_0x34be0f[_0xbf9d('0x38')][_0xbf9d('0x49')]?_0x34be0f[_0xbf9d('0x38')]:_0x3d2e1c[_0xbf9d('0x33')];_0x34be0f[_0xbf9d('0x3c')]=qs[_0xbf9d('0x3d')](_0x21d89a[_0xbf9d('0x34')]['sort']);_0x34be0f[_0xbf9d('0x3e')]=qs['filters'](_[_0xbf9d('0x3f')](_0x21d89a[_0xbf9d('0x34')],_0x3d2e1c[_0xbf9d('0x36')]));if(_0x21d89a[_0xbf9d('0x34')][_0xbf9d('0x58')]){_0x34be0f[_0xbf9d('0x3e')]=_[_0xbf9d('0x40')](_0x34be0f[_0xbf9d('0x3e')],{'$or':_[_0xbf9d('0x2d')](_0x34be0f[_0xbf9d('0x38')],function(_0x30f369){var _0x3d60da={};_0x3d60da[_0x30f369]={'$like':'%'+_0x21d89a[_0xbf9d('0x34')]['filter']+'%'};return _0x3d60da;})});}_0x34be0f=_[_0xbf9d('0x40')]({},_0x34be0f,_0x21d89a[_0xbf9d('0x42')]);return _0x31b6b7[_0xbf9d('0x57')](_0x34be0f);}})[_0xbf9d('0x29')](function(_0x230b25){if(_0x230b25){_0x252b20=_0x230b25[_0xbf9d('0x49')];if(!_0x21d89a[_0xbf9d('0x34')][_0xbf9d('0x3a')]('nolimit')){_0x34be0f[_0xbf9d('0x21')]=qs[_0xbf9d('0x21')](_0x21d89a['query'][_0xbf9d('0x21')]);_0x34be0f['offset']=qs[_0xbf9d('0x22')](_0x21d89a[_0xbf9d('0x34')][_0xbf9d('0x22')]);}return _0x31b6b7[_0xbf9d('0x57')](_0x34be0f);}})[_0xbf9d('0x29')](function(_0x66aa3d){if(_0x66aa3d){return _0x66aa3d?{'count':_0x252b20,'rows':_0x66aa3d}:null;}})[_0xbf9d('0x29')](respondWithResult(_0x5c65e5,null))[_0xbf9d('0x46')](handleError(_0x5c65e5,null));};exports[_0xbf9d('0x59')]=function(_0x494f6c,_0x443e07,_0x95ebf){return db[_0xbf9d('0x2e')][_0xbf9d('0x4f')]({'where':{'id':_0x494f6c['params']['id']}})[_0xbf9d('0x29')](handleEntityNotFound(_0x443e07,null))[_0xbf9d('0x29')](function(_0x5ae527){if(_0x5ae527){return _0x5ae527[_0xbf9d('0x59')](_0x494f6c[_0xbf9d('0x34')][_0xbf9d('0x55')]);}})[_0xbf9d('0x29')](respondWithStatusCode(_0x443e07,null))[_0xbf9d('0x46')](handleError(_0x443e07,null));};exports[_0xbf9d('0x5a')]=function(_0x4bab02,_0x51cbd7,_0x239bca){if(_0x4bab02['body']['id']){delete _0x4bab02['body']['id'];}return db[_0xbf9d('0x2e')]['find']({'where':{'id':_0x4bab02['params']['id']}})['then'](handleEntityNotFound(_0x51cbd7,null))[_0xbf9d('0x29')](function(_0x41d69e){if(_0x41d69e){_0x4bab02[_0xbf9d('0x4c')][_0xbf9d('0x5b')]=_0x41d69e['id'];return db[_0xbf9d('0x52')]['create'](_0x4bab02[_0xbf9d('0x4c')]);}})[_0xbf9d('0x29')](respondWithResult(_0x51cbd7,null))['catch'](handleError(_0x51cbd7,null));};exports[_0xbf9d('0x5c')]=function(_0x173c01,_0x1dcee2,_0x42103e){var _0x13ea25={};var _0x5c643d={};var _0xc198db;var _0x51a9e6;return db['ChatGroup'][_0xbf9d('0x5d')]({'where':{'id':_0x173c01[_0xbf9d('0x48')]['id']}})[_0xbf9d('0x29')](handleEntityNotFound(_0x1dcee2,null))[_0xbf9d('0x29')](function(_0x1529a7){if(_0x1529a7){_0xc198db=_0x1529a7;_0x5c643d['model']=_[_0xbf9d('0x35')](db[_0xbf9d('0x52')][_0xbf9d('0x2f')]);_0x5c643d[_0xbf9d('0x34')]=_[_0xbf9d('0x35')](_0x173c01[_0xbf9d('0x34')]);_0x5c643d[_0xbf9d('0x36')]=_[_0xbf9d('0x37')](_0x5c643d['model'],_0x5c643d[_0xbf9d('0x34')]);_0x13ea25[_0xbf9d('0x38')]=_[_0xbf9d('0x37')](_0x5c643d[_0xbf9d('0x33')],qs[_0xbf9d('0x39')](_0x173c01[_0xbf9d('0x34')][_0xbf9d('0x39')]));_0x13ea25['attributes']=_0x13ea25[_0xbf9d('0x38')]['length']?_0x13ea25[_0xbf9d('0x38')]:_0x5c643d['model'];_0x13ea25[_0xbf9d('0x3c')]=qs['sort'](_0x173c01[_0xbf9d('0x34')][_0xbf9d('0x3d')]);_0x13ea25[_0xbf9d('0x3e')]=qs[_0xbf9d('0x36')](_['pick'](_0x173c01['query'],_0x5c643d[_0xbf9d('0x36')]));if(_0x173c01[_0xbf9d('0x34')][_0xbf9d('0x58')]){_0x13ea25[_0xbf9d('0x3e')]=_[_0xbf9d('0x40')](_0x13ea25[_0xbf9d('0x3e')],{'$or':_[_0xbf9d('0x2d')](_0x13ea25[_0xbf9d('0x38')],function(_0x2ca957){var _0x4d55e1={};_0x4d55e1[_0x2ca957]={'$like':'%'+_0x173c01[_0xbf9d('0x34')][_0xbf9d('0x58')]+'%'};return _0x4d55e1;})});}if(_0x173c01[_0xbf9d('0x34')][_0xbf9d('0x5e')]){var _0x40409e=_0x173c01[_0xbf9d('0x34')][_0xbf9d('0x5e')][_0xbf9d('0x5f')](',');var _0x6ebc90={};_0x6ebc90[_0x40409e[0x0]]={'$gte':moment(_0x40409e[0x1])[_0xbf9d('0x60')](_0xbf9d('0x61'))};_0x13ea25[_0xbf9d('0x3e')]=_[_0xbf9d('0x40')](_0x13ea25['where'],_0x6ebc90);}_0x13ea25=_['merge']({},_0x13ea25,_0x173c01[_0xbf9d('0x42')]);return _0xc198db[_0xbf9d('0x5c')](_0x13ea25);}})[_0xbf9d('0x29')](function(_0x2d37b6){if(_0x2d37b6){_0x51a9e6=_0x2d37b6['length'];if(!_0x173c01[_0xbf9d('0x34')][_0xbf9d('0x3a')](_0xbf9d('0x3b'))){_0x13ea25['limit']=qs[_0xbf9d('0x21')](_0x173c01['query'][_0xbf9d('0x21')]);_0x13ea25[_0xbf9d('0x22')]=qs[_0xbf9d('0x22')](_0x173c01[_0xbf9d('0x34')][_0xbf9d('0x22')]);}return _0xc198db[_0xbf9d('0x5c')](_0x13ea25);}})[_0xbf9d('0x29')](function(_0x4ef2be){if(_0x4ef2be){return _0x4ef2be?{'count':_0x51a9e6,'rows':_0x4ef2be}:null;}})[_0xbf9d('0x29')](respondWithResult(_0x1dcee2,null))['catch'](handleError(_0x1dcee2,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 6849f7b..a35eac1 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 _0xe3cf=['hasOwnProperty','hook','exports','events','ChatGroup','remove','emit'];(function(_0x53cf1c,_0x2c2b16){var _0x27221a=function(_0x104d7c){while(--_0x104d7c){_0x53cf1c['push'](_0x53cf1c['shift']());}};_0x27221a(++_0x2c2b16);}(_0xe3cf,0x16f));var _0xfe3c=function(_0x112df4,_0x14bb3d){_0x112df4=_0x112df4-0x0;var _0x4c2a76=_0xe3cf[_0x112df4];return _0x4c2a76;};'use strict';var EventEmitter=require(_0xfe3c('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0xfe3c('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xfe3c('0x2')};function emitEvent(_0x2fc7c5){return function(_0x1e474a,_0x32bb6b,_0x1ced6d){ChatGroupEvents[_0xfe3c('0x3')](_0x2fc7c5+':'+_0x1e474a['id'],_0x1e474a);ChatGroupEvents['emit'](_0x2fc7c5,_0x1e474a);_0x1ced6d(null);};}for(var e in events){if(events[_0xfe3c('0x4')](e)){var event=events[e];ChatGroup[_0xfe3c('0x5')](e,emitEvent(event));}}module[_0xfe3c('0x6')]=ChatGroupEvents; \ No newline at end of file +var _0x3d49=['emit','../../mysqldb','ChatGroup','setMaxListeners','save','remove'];(function(_0x53a738,_0x363a12){var _0x28b643=function(_0x517a08){while(--_0x517a08){_0x53a738['push'](_0x53a738['shift']());}};_0x28b643(++_0x363a12);}(_0x3d49,0x151));var _0x93d4=function(_0x4e90e3,_0x570a1d){_0x4e90e3=_0x4e90e3-0x0;var _0x295e5b=_0x3d49[_0x4e90e3];return _0x295e5b;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x93d4('0x0'))['db'][_0x93d4('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x93d4('0x2')](0x0);var events={'afterCreate':_0x93d4('0x3'),'afterUpdate':'update','afterDestroy':_0x93d4('0x4')};function emitEvent(_0x9846c2){return function(_0xa1de2e,_0x41313a,_0x20e6c7){ChatGroupEvents[_0x93d4('0x5')](_0x9846c2+':'+_0xa1de2e['id'],_0xa1de2e);ChatGroupEvents['emit'](_0x9846c2,_0xa1de2e);_0x20e6c7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index fd0a534..3d91dd7 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 _0x6d5e=['request-promise','path','rimraf','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1bbb91,_0xc65ae3){var _0x46053a=function(_0x3e174e){while(--_0x3e174e){_0x1bbb91['push'](_0x1bbb91['shift']());}};_0x46053a(++_0xc65ae3);}(_0x6d5e,0x190));var _0xe6d5=function(_0x4f8196,_0x6ce644){_0x4f8196=_0x4f8196-0x0;var _0x1d62b3=_0x6d5e[_0x4f8196];return _0x1d62b3;};'use strict';var _=require(_0xe6d5('0x0'));var util=require(_0xe6d5('0x1'));var logger=require(_0xe6d5('0x2'))(_0xe6d5('0x3'));var moment=require(_0xe6d5('0x4'));var BPromise=require(_0xe6d5('0x5'));var rp=require(_0xe6d5('0x6'));var fs=require('fs');var path=require(_0xe6d5('0x7'));var rimraf=require(_0xe6d5('0x8'));var config=require('../../config/environment');var attributes=require(_0xe6d5('0x9'));module[_0xe6d5('0xa')]=function(_0x42afed,_0x10206e){return _0x42afed[_0xe6d5('0xb')](_0xe6d5('0xc'),attributes,{'tableName':_0xe6d5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd026=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','define','ChatGroup','chat_groups','lodash','../../config/logger','api'];(function(_0x142531,_0x2c3f6f){var _0x4df971=function(_0x5c80b2){while(--_0x5c80b2){_0x142531['push'](_0x142531['shift']());}};_0x4df971(++_0x2c3f6f);}(_0xd026,0xa6));var _0x6d02=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xd026[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0x6d02('0x0'));var util=require('util');var logger=require(_0x6d02('0x1'))(_0x6d02('0x2'));var moment=require(_0x6d02('0x3'));var BPromise=require(_0x6d02('0x4'));var rp=require(_0x6d02('0x5'));var fs=require('fs');var path=require(_0x6d02('0x6'));var rimraf=require(_0x6d02('0x7'));var config=require(_0x6d02('0x8'));var attributes=require(_0x6d02('0x9'));module['exports']=function(_0x47d8ef,_0x401e07){return _0x47d8ef[_0x6d02('0xa')](_0x6d02('0xb'),attributes,{'tableName':_0x6d02('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 a4ffe8e..f96966e 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 _0xa37e=['ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./chatGroup.socket','request','then','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','moment','bluebird','randomstring'];(function(_0x45961f,_0x40c9ba){var _0x57d209=function(_0x2f0c03){while(--_0x2f0c03){_0x45961f['push'](_0x45961f['shift']());}};_0x57d209(++_0x40c9ba);}(_0xa37e,0x97));var _0xea37=function(_0x5723f9,_0x294319){_0x5723f9=_0x5723f9-0x0;var _0x1c021c=_0xa37e[_0x5723f9];return _0x1c021c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xea37('0x0'));var BPromise=require(_0xea37('0x1'));var rs=require(_0xea37('0x2'));var fs=require('fs');var Redis=require(_0xea37('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xea37('0x4'));var logger=require('../../config/logger')(_0xea37('0x5'));var config=require(_0xea37('0x6'));var jayson=require(_0xea37('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0xea37('0x8')]=_['defaults'](config['redis'],{'host':_0xea37('0x9'),'port':0x18eb});var socket=require(_0xea37('0xa'))(new Redis(config[_0xea37('0x8')]));require(_0xea37('0xb'))['register'](socket);function respondWithRpcPromise(_0x315e5f,_0x37ca45,_0x8371a){return new BPromise(function(_0x55d4de,_0x5060cd){return client[_0xea37('0xc')](_0x315e5f,_0x8371a)[_0xea37('0xd')](function(_0x3cd18b){logger['info'](_0xea37('0xe'),_0x37ca45,_0xea37('0xf'));logger[_0xea37('0x10')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x37ca45,_0xea37('0xf'),JSON[_0xea37('0x11')](_0x3cd18b));if(_0x3cd18b['error']){if(_0x3cd18b[_0xea37('0x12')]['code']===0x1f4){logger[_0xea37('0x12')]('ChatGroup,\x20%s,\x20%s',_0x37ca45,_0x3cd18b[_0xea37('0x12')][_0xea37('0x13')]);return _0x5060cd(_0x3cd18b[_0xea37('0x12')][_0xea37('0x13')]);}logger['error'](_0xea37('0xe'),_0x37ca45,_0x3cd18b['error']['message']);return _0x55d4de(_0x3cd18b[_0xea37('0x12')]['message']);}else{logger[_0xea37('0x14')](_0xea37('0xe'),_0x37ca45,'request\x20sent');_0x55d4de(_0x3cd18b[_0xea37('0x15')][_0xea37('0x13')]);}})['catch'](function(_0x786ee5){logger[_0xea37('0x12')](_0xea37('0xe'),_0x37ca45,_0x786ee5);_0x5060cd(_0x786ee5);});});} \ No newline at end of file +var _0xfef2=['message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','request\x20sent','debug','error','code','ChatGroup,\x20%s,\x20%s'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0xfef2,0x1e0));var _0x2fef=function(_0x606fe8,_0x10b084){_0x606fe8=_0x606fe8-0x0;var _0x28b517=_0xfef2[_0x606fe8];return _0x28b517;};'use strict';var _=require(_0x2fef('0x0'));var util=require(_0x2fef('0x1'));var moment=require(_0x2fef('0x2'));var BPromise=require('bluebird');var rs=require(_0x2fef('0x3'));var fs=require('fs');var Redis=require(_0x2fef('0x4'));var db=require(_0x2fef('0x5'))['db'];var utils=require(_0x2fef('0x6'));var logger=require('../../config/logger')(_0x2fef('0x7'));var config=require('../../config/environment');var jayson=require(_0x2fef('0x8'));var client=jayson[_0x2fef('0x9')][_0x2fef('0xa')]({'port':0x232a});config[_0x2fef('0xb')]=_[_0x2fef('0xc')](config[_0x2fef('0xb')],{'host':_0x2fef('0xd'),'port':0x18eb});var socket=require(_0x2fef('0xe'))(new Redis(config[_0x2fef('0xb')]));require(_0x2fef('0xf'))[_0x2fef('0x10')](socket);function respondWithRpcPromise(_0x4bce8d,_0x2042f5,_0x52982b){return new BPromise(function(_0x23a632,_0x389501){return client[_0x2fef('0x11')](_0x4bce8d,_0x52982b)[_0x2fef('0x12')](function(_0x3ac314){logger['info']('ChatGroup,\x20%s,\x20%s',_0x2042f5,_0x2fef('0x13'));logger[_0x2fef('0x14')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x2042f5,_0x2fef('0x13'),JSON['stringify'](_0x3ac314));if(_0x3ac314['error']){if(_0x3ac314[_0x2fef('0x15')][_0x2fef('0x16')]===0x1f4){logger[_0x2fef('0x15')](_0x2fef('0x17'),_0x2042f5,_0x3ac314[_0x2fef('0x15')][_0x2fef('0x18')]);return _0x389501(_0x3ac314[_0x2fef('0x15')]['message']);}logger['error'](_0x2fef('0x17'),_0x2042f5,_0x3ac314[_0x2fef('0x15')]['message']);return _0x23a632(_0x3ac314['error'][_0x2fef('0x18')]);}else{logger[_0x2fef('0x19')](_0x2fef('0x17'),_0x2042f5,_0x2fef('0x13'));_0x23a632(_0x3ac314[_0x2fef('0x1a')][_0x2fef('0x18')]);}})[_0x2fef('0x1b')](function(_0x394a20){logger[_0x2fef('0x15')](_0x2fef('0x17'),_0x2042f5,_0x394a20);_0x389501(_0x394a20);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index e1ce1a9..0fbd663 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 _0x577c=['register','length','./chatGroup.events','save','remove','update','removeListener'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x577c,0x9c));var _0xc577=function(_0x1d5ff0,_0x251781){_0x1d5ff0=_0x1d5ff0-0x0;var _0x9003ac=_0x577c[_0x1d5ff0];return _0x9003ac;};'use strict';var ChatGroupEvents=require(_0xc577('0x0'));var events=[_0xc577('0x1'),_0xc577('0x2'),_0xc577('0x3')];function createListener(_0x2c1dbe,_0x370e17){return function(_0x2e0e2a){_0x370e17['emit'](_0x2c1dbe,_0x2e0e2a);};}function removeListener(_0x47f25c,_0x5c6f7a){return function(){ChatGroupEvents[_0xc577('0x4')](_0x47f25c,_0x5c6f7a);};}exports[_0xc577('0x5')]=function(_0x4627b4){for(var _0x4fdcbd=0x0,_0x1c31d3=events[_0xc577('0x6')];_0x4fdcbd<_0x1c31d3;_0x4fdcbd++){var _0x258d69=events[_0x4fdcbd];var _0x7be767=createListener('chatGroup:'+_0x258d69,_0x4627b4);ChatGroupEvents['on'](_0x258d69,_0x7be767);}}; \ No newline at end of file +var _0xe399=['remove','update','removeListener','register','length','./chatGroup.events','save'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xe399,0x16a));var _0x9e39=function(_0x205afc,_0x16f412){_0x205afc=_0x205afc-0x0;var _0x4dae5a=_0xe399[_0x205afc];return _0x4dae5a;};'use strict';var ChatGroupEvents=require(_0x9e39('0x0'));var events=[_0x9e39('0x1'),_0x9e39('0x2'),_0x9e39('0x3')];function createListener(_0x28a01e,_0x195654){return function(_0x49dcde){_0x195654['emit'](_0x28a01e,_0x49dcde);};}function removeListener(_0x53b590,_0x3f9ca6){return function(){ChatGroupEvents[_0x9e39('0x4')](_0x53b590,_0x3f9ca6);};}exports[_0x9e39('0x5')]=function(_0x328a86){for(var _0x292caa=0x0,_0x271cde=events[_0x9e39('0x6')];_0x292caa<_0x271cde;_0x292caa++){var _0x5935fb=events[_0x292caa];var _0x25cff1=createListener('chatGroup:'+_0x5935fb,_0x328a86);ChatGroupEvents['on'](_0x5935fb,_0x25cff1);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 8bad05b..75b08de 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 _0x5a3b=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/unread','getUnread','/:id/members','/:id/messages','getMessages','post','create','addMessage','put','update'];(function(_0x427127,_0x3a4a16){var _0x22d8e7=function(_0x210c9f){while(--_0x210c9f){_0x427127['push'](_0x427127['shift']());}};_0x22d8e7(++_0x3a4a16);}(_0x5a3b,0x1bd));var _0xb5a3=function(_0x4682eb,_0x2bfc64){_0x4682eb=_0x4682eb-0x0;var _0x25ee36=_0x5a3b[_0x4682eb];return _0x25ee36;};'use strict';var multer=require(_0xb5a3('0x0'));var util=require(_0xb5a3('0x1'));var path=require(_0xb5a3('0x2'));var timeout=require(_0xb5a3('0x3'));var express=require(_0xb5a3('0x4'));var router=express[_0xb5a3('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb5a3('0x6'));var controller=require('./chatGroup.controller');router[_0xb5a3('0x7')]('/',auth[_0xb5a3('0x8')](),controller[_0xb5a3('0x9')]);router[_0xb5a3('0x7')]('/describe',auth[_0xb5a3('0x8')](),controller[_0xb5a3('0xa')]);router['get'](_0xb5a3('0xb'),auth['isAuthenticated'](),controller[_0xb5a3('0xc')]);router[_0xb5a3('0x7')](_0xb5a3('0xd'),auth[_0xb5a3('0x8')](),controller[_0xb5a3('0xe')]);router[_0xb5a3('0x7')](_0xb5a3('0xf'),auth[_0xb5a3('0x8')](),controller['getMembers']);router[_0xb5a3('0x7')](_0xb5a3('0x10'),auth['isAuthenticated'](),controller[_0xb5a3('0x11')]);router[_0xb5a3('0x12')]('/',auth[_0xb5a3('0x8')](),controller[_0xb5a3('0x13')]);router[_0xb5a3('0x12')]('/:id/members',auth[_0xb5a3('0x8')](),controller['addMembers']);router[_0xb5a3('0x12')](_0xb5a3('0x10'),auth[_0xb5a3('0x8')](),controller[_0xb5a3('0x14')]);router[_0xb5a3('0x15')](_0xb5a3('0xb'),auth['isAuthenticated'](),controller[_0xb5a3('0x16')]);router[_0xb5a3('0x17')](_0xb5a3('0xb'),auth['isAuthenticated'](),controller[_0xb5a3('0x18')]);router[_0xb5a3('0x17')]('/:id/members',auth[_0xb5a3('0x8')](),controller['removeMembers']);module[_0xb5a3('0x19')]=router; \ No newline at end of file +var _0xaffb=['post','create','put','delete','destroy','removeMembers','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','describe','/:id','isAuthenticated','getUnread','/:id/members','/:id/messages','getMessages'];(function(_0x26f3df,_0x19cb5e){var _0x551ae3=function(_0xb69a7e){while(--_0xb69a7e){_0x26f3df['push'](_0x26f3df['shift']());}};_0x551ae3(++_0x19cb5e);}(_0xaffb,0xa7));var _0xbaff=function(_0x187399,_0x40c56d){_0x187399=_0x187399-0x0;var _0x40fa92=_0xaffb[_0x187399];return _0x40fa92;};'use strict';var multer=require(_0xbaff('0x0'));var util=require(_0xbaff('0x1'));var path=require(_0xbaff('0x2'));var timeout=require(_0xbaff('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbaff('0x4'));var auth=require(_0xbaff('0x5'));var interaction=require(_0xbaff('0x6'));var config=require(_0xbaff('0x7'));var controller=require('./chatGroup.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xbaff('0x8')](_0xbaff('0x9'),auth['isAuthenticated'](),controller[_0xbaff('0xa')]);router[_0xbaff('0x8')](_0xbaff('0xb'),auth[_0xbaff('0xc')](),controller['show']);router[_0xbaff('0x8')]('/:id/unread',auth[_0xbaff('0xc')](),controller[_0xbaff('0xd')]);router[_0xbaff('0x8')](_0xbaff('0xe'),auth[_0xbaff('0xc')](),controller['getMembers']);router['get'](_0xbaff('0xf'),auth[_0xbaff('0xc')](),controller[_0xbaff('0x10')]);router[_0xbaff('0x11')]('/',auth[_0xbaff('0xc')](),controller[_0xbaff('0x12')]);router['post'](_0xbaff('0xe'),auth[_0xbaff('0xc')](),controller['addMembers']);router[_0xbaff('0x11')]('/:id/messages',auth[_0xbaff('0xc')](),controller['addMessage']);router[_0xbaff('0x13')](_0xbaff('0xb'),auth[_0xbaff('0xc')](),controller['update']);router[_0xbaff('0x14')](_0xbaff('0xb'),auth[_0xbaff('0xc')](),controller[_0xbaff('0x15')]);router[_0xbaff('0x14')](_0xbaff('0xe'),auth[_0xbaff('0xc')](),controller[_0xbaff('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index f44714a..365c4cc 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 _0x9e6b=['star','TEXT','DATE','STRING','long','ENUM','out','BOOLEAN','sequelize','exports','INTEGER','thumb'];(function(_0x4472b6,_0x3768b6){var _0x153531=function(_0x517b02){while(--_0x517b02){_0x4472b6['push'](_0x4472b6['shift']());}};_0x153531(++_0x3768b6);}(_0x9e6b,0x11c));var _0xb9e6=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x9e6b[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0xb9e6('0x0'));module[_0xb9e6('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xb9e6('0x2')]},'ratingType':{'type':Sequelize['ENUM']('star',_0xb9e6('0x3')),'defaultValue':_0xb9e6('0x4')},'ratingMessage':{'type':Sequelize[_0xb9e6('0x5')]},'pathTranscript':{'type':Sequelize[_0xb9e6('0x5')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xb9e6('0x6')]},'disposition':{'type':Sequelize[_0xb9e6('0x7')]},'secondDisposition':{'type':Sequelize[_0xb9e6('0x7')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xb9e6('0x7')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0xb9e6('0x7')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0xb9e6('0x7')]},'deviceType':{'type':Sequelize[_0xb9e6('0x7')]},'referer':{'type':Sequelize[_0xb9e6('0x5')]},'customerIp':{'type':Sequelize[_0xb9e6('0x7')]},'formData':{'type':Sequelize[_0xb9e6('0x5')](_0xb9e6('0x8'))},'read1stAt':{'type':Sequelize[_0xb9e6('0x6')]},'lastMsgAt':{'type':Sequelize[_0xb9e6('0x6')]},'lastMsgDirection':{'type':Sequelize[_0xb9e6('0x9')]('in',_0xb9e6('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0xb9e6('0x7')]},'vidaooSessionId':{'type':Sequelize[_0xb9e6('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0xb9e6('0xb')],'defaultValue':![]}}; \ No newline at end of file +var _0xeffd=['ENUM','star','thumb','TEXT','STRING','DATE','long','out','sequelize','BOOLEAN','INTEGER'];(function(_0x35f83e,_0x30ec55){var _0x249b05=function(_0x2c2fcc){while(--_0x2c2fcc){_0x35f83e['push'](_0x35f83e['shift']());}};_0x249b05(++_0x30ec55);}(_0xeffd,0x6b));var _0xdeff=function(_0x4ab6bb,_0x4f6c90){_0x4ab6bb=_0x4ab6bb-0x0;var _0x451c7e=_0xeffd[_0x4ab6bb];return _0x451c7e;};'use strict';var Sequelize=require(_0xdeff('0x0'));module['exports']={'closed':{'type':Sequelize[_0xdeff('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xdeff('0x2')]},'ratingType':{'type':Sequelize[_0xdeff('0x3')](_0xdeff('0x4'),_0xdeff('0x5')),'defaultValue':_0xdeff('0x4')},'ratingMessage':{'type':Sequelize[_0xdeff('0x6')]},'pathTranscript':{'type':Sequelize[_0xdeff('0x6')]},'mailTranscript':{'type':Sequelize[_0xdeff('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xdeff('0x8')]},'disposition':{'type':Sequelize[_0xdeff('0x7')]},'secondDisposition':{'type':Sequelize[_0xdeff('0x7')]},'thirdDisposition':{'type':Sequelize[_0xdeff('0x7')]},'note':{'type':Sequelize[_0xdeff('0x7')]},'browserName':{'type':Sequelize[_0xdeff('0x7')]},'browserVersion':{'type':Sequelize[_0xdeff('0x7')]},'osName':{'type':Sequelize[_0xdeff('0x7')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0xdeff('0x7')]},'deviceVendor':{'type':Sequelize[_0xdeff('0x7')]},'deviceType':{'type':Sequelize[_0xdeff('0x7')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0xdeff('0x7')]},'formData':{'type':Sequelize[_0xdeff('0x6')](_0xdeff('0x9'))},'read1stAt':{'type':Sequelize[_0xdeff('0x8')]},'lastMsgAt':{'type':Sequelize[_0xdeff('0x8')]},'lastMsgDirection':{'type':Sequelize[_0xdeff('0x3')]('in',_0xdeff('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xdeff('0x7')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0xdeff('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0xdeff('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index a678ab4..3e99bfa 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 _0x66fa=['error','code','message','catch','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','body','contact','agent','interaction','TagIds','Tags','split','forEach','push','map','ChatInteraction','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','field','from','tools_tags','select','u.id','u.fullname','ui.ChatInteractionId','left_join','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','users','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','buildExpression','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','some','compact','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','contactName','DESC','isEmpty','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','ChatInteractionId','all','rows','params','includeAll','create','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','fullname','email','account','https://api-vidaoo.xcally.com/api/v1/meetings','follow','isNull','metadata','ValidationError','join_url','out','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','attachmentUpload','file','originalname','filename','mimetype','Attachment','attachmentDownload','Unauthorized','ChatOfflineMessageId','root','offline-chat/','join','basename','close','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','User','CmContact','ContactId','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','direction','MailServerOut','Smtp','service','host','port','secure','auth','pass','\x22%s\x22\x20<%s>','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','ChatMessage','addMessage','omit','ids','getMessages','merge','YYYY-MM-DD\x20HH:mm:ss','options','getMyMessages','include','includeAgent','alias','addTags','setTags','findAll','color','emit','chatInteractionTags:save','removeTags','download','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','createdAt','secret','read','Account','Owner','mkdirSync','Chat','N.A.','closedAt','browserName','osName','customerIp','customerPort','tail','existsSync','createReadStream','createWriteStream','renderFile','downloadInteraction.ejs','transcript-','createPdfFromHTML','log','err','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/export/pdf','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','jayson/promise','client','http','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4772f7,_0x7ca703){var _0x13c46d=function(_0x3342b6){while(--_0x3342b6){_0x4772f7['push'](_0x4772f7['shift']());}};_0x13c46d(++_0x7ca703);}(_0x66fa,0x117));var _0xa66f=function(_0x55cf68,_0x49959b){_0x55cf68=_0x55cf68-0x0;var _0x1c5151=_0x66fa[_0x55cf68];return _0x1c5151;};'use strict';var emlformat=require(_0xa66f('0x0'));var rimraf=require(_0xa66f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa66f('0x2'));var rp=require(_0xa66f('0x3'));var moment=require(_0xa66f('0x4'));var BPromise=require(_0xa66f('0x5'));var Mustache=require(_0xa66f('0x6'));var util=require(_0xa66f('0x7'));var path=require(_0xa66f('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa66f('0x9'));var fs=require('fs');var fs_extra=require(_0xa66f('0xa'));var _=require(_0xa66f('0xb'));var squel=require(_0xa66f('0xc'));var crypto=require(_0xa66f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa66f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa66f('0xf'));var Papa=require('papaparse');var Redis=require(_0xa66f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xa66f('0x11'));var hardwareService=require(_0xa66f('0x12'));var logger=require('../../config/logger')(_0xa66f('0x13'));var utils=require('../../config/utils');var config=require(_0xa66f('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xa66f('0x15'))['db'];config[_0xa66f('0x16')]=_[_0xa66f('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa66f('0x18'))(new Redis(config['redis']));require('./chatInteraction.socket')['register'](socket);var jayson=require(_0xa66f('0x19'));var client=jayson[_0xa66f('0x1a')][_0xa66f('0x1b')]({'port':0x232b});var client9004=jayson[_0xa66f('0x1a')][_0xa66f('0x1b')]({'port':0x232c});function respondWithRpcPromise(_0x567d4f,_0x5510dc,_0x19b5ac,_0x32d338){return new BPromise(function(_0x295acf,_0x403f4d){var _0x5c67f5=_0x32d338||client;return _0x5c67f5[_0xa66f('0x1c')](_0x567d4f,_0x19b5ac)['then'](function(_0x4a28d4){logger[_0xa66f('0x1d')](_0xa66f('0x1e'),_0x5510dc,_0xa66f('0x1f'));logger[_0xa66f('0x20')](_0xa66f('0x21'),_0x5510dc,_0xa66f('0x1f'),JSON[_0xa66f('0x22')](_0x4a28d4));if(_0x4a28d4[_0xa66f('0x23')]){if(_0x4a28d4[_0xa66f('0x23')][_0xa66f('0x24')]===0x1f4){logger[_0xa66f('0x23')](_0xa66f('0x1e'),_0x5510dc,_0x4a28d4[_0xa66f('0x23')][_0xa66f('0x25')]);return _0x403f4d(_0x4a28d4[_0xa66f('0x23')]['message']);}logger[_0xa66f('0x23')](_0xa66f('0x1e'),_0x5510dc,_0x4a28d4[_0xa66f('0x23')][_0xa66f('0x25')]);return _0x295acf(_0x4a28d4['error'][_0xa66f('0x25')]);}else{logger[_0xa66f('0x1d')](_0xa66f('0x1e'),_0x5510dc,_0xa66f('0x1f'));_0x295acf(_0x4a28d4['result']['message']);}})[_0xa66f('0x26')](function(_0x598942){logger[_0xa66f('0x23')](_0xa66f('0x1e'),_0x5510dc,_0x598942);_0x403f4d(_0x598942);});});}function respondWithStatusCode(_0x384164,_0x57da7f){_0x57da7f=_0x57da7f||0xcc;return function(_0x4683c7){if(_0x4683c7){return _0x384164[_0xa66f('0x27')](_0x57da7f);}return _0x384164[_0xa66f('0x28')](_0x57da7f)[_0xa66f('0x29')]();};}function respondWithResult(_0x17c103,_0x236046){_0x236046=_0x236046||0xc8;return function(_0x1eb86a){if(_0x1eb86a){return _0x17c103[_0xa66f('0x28')](_0x236046)[_0xa66f('0x2a')](_0x1eb86a);}};}function respondWithFilteredResult(_0x117d03,_0x45f71c){return function(_0x63650b){if(_0x63650b){var _0x42b966=typeof _0x45f71c[_0xa66f('0x2b')]==='undefined'&&typeof _0x45f71c['limit']===_0xa66f('0x2c');var _0x27ceae=_0x63650b['count'];var _0x44c79a=_0x42b966?0x0:_0x45f71c[_0xa66f('0x2b')];var _0x4cd7f2=_0x42b966?_0x63650b[_0xa66f('0x2d')]:_0x45f71c[_0xa66f('0x2b')]+_0x45f71c[_0xa66f('0x2e')];var _0x2c2ace;if(_0x4cd7f2>=_0x27ceae){_0x4cd7f2=_0x27ceae;_0x2c2ace=0xc8;}else{_0x2c2ace=0xce;}_0x117d03[_0xa66f('0x28')](_0x2c2ace);return _0x117d03['set'](_0xa66f('0x2f'),_0x44c79a+'-'+_0x4cd7f2+'/'+_0x27ceae)['json'](_0x63650b);}return null;};}function patchUpdates(_0x306b35){return function(_0x35a0a7){try{jsonpatch[_0xa66f('0x30')](_0x35a0a7,_0x306b35,!![]);}catch(_0x486e4e){return BPromise[_0xa66f('0x31')](_0x486e4e);}return _0x35a0a7[_0xa66f('0x32')]();};}function saveUpdates(_0x4f1668,_0x1a5d4a){return function(_0x35a847){if(_0x35a847){return _0x35a847[_0xa66f('0x33')](_0x4f1668)[_0xa66f('0x34')](function(_0x10a782){return _0x10a782;});}return null;};}function removeEntity(_0x2452d2,_0x25c74c){return function(_0x41303c){if(_0x41303c){return _0x41303c[_0xa66f('0x35')]()[_0xa66f('0x34')](function(){_0x2452d2['status'](0xcc)[_0xa66f('0x29')]();});}};}function handleEntityNotFound(_0x5bf736,_0x1c7eda){return function(_0x46f6cc){if(!_0x46f6cc){_0x5bf736[_0xa66f('0x27')](0x194);}return _0x46f6cc;};}function handleError(_0x3b9261,_0x3722d3){_0x3722d3=_0x3722d3||0x1f4;return function(_0x201432){logger[_0xa66f('0x23')](_0x201432[_0xa66f('0x36')]);if(_0x201432['name']){delete _0x201432[_0xa66f('0x37')];}_0x3b9261['status'](_0x3722d3)[_0xa66f('0x38')](_0x201432);};}function getMustacheRender(_0x45eeb8,_0x2ed1fb){return Mustache['render'](_0x45eeb8,_['merge'](_0x2ed1fb[_0xa66f('0x39')],{'contact':_0x2ed1fb[_0xa66f('0x3a')],'message':_0x2ed1fb[_0xa66f('0x25')],'agent':_0x2ed1fb[_0xa66f('0x3b')],'interaction':_0x2ed1fb[_0xa66f('0x3c')],'account':_0x2ed1fb['account']}))||'';}function getInteractionUsers(_0x5cb0a9,_0x49b869){return new BPromise(function(_0x30f7de,_0x4aeeb4){try{if(_0x49b869[_0x5cb0a9['id']]){_0x5cb0a9['Users']=_['map'](_0x49b869[_0x5cb0a9['id']],function(_0x5fdc3e){return{'id':_0x5fdc3e['id'],'fullname':_0x5fdc3e['fullname']};});}}catch(_0x8965d3){_0x4aeeb4(_0x8965d3);}_0x30f7de(_0x5cb0a9);});}function getInteractionTags(_0x17d942,_0x23a546){return new BPromise(function(_0x1647a0,_0xd65c5d){try{if(_0x17d942[_0xa66f('0x3d')]){_0x17d942[_0xa66f('0x3e')]=[];_0x17d942[_0xa66f('0x3d')][_0xa66f('0x3f')](',')[_0xa66f('0x40')](function(_0x3a7929){_0x17d942[_0xa66f('0x3e')][_0xa66f('0x41')](_0x23a546[_0x3a7929]);});}delete _0x17d942[_0xa66f('0x3d')];}catch(_0x4f01b9){_0xd65c5d(_0x4f01b9);}_0x1647a0(_0x17d942);});}function updateChatInteraction(_0x36037c,_0x25c2cb,_0x58c1f2){return new BPromise(function(_0x248587,_0x4b6e6b){return getInteractionUsers(_0x36037c,_0x58c1f2)[_0xa66f('0x34')](function(_0x27adf4){return getInteractionTags(_0x27adf4,_0x25c2cb);})['then'](function(_0x1ddd2f){_0x248587(_0x1ddd2f);})[_0xa66f('0x26')](function(_0x2126e8){_0x4b6e6b(_0x2126e8);});});}exports['index']=function(_0x394b1e,_0x5cdfe2){var _0x276cd5={},_0x33ed23={},_0xb52cc6={'count':0x0,'rows':[]};var _0x3a499e=_[_0xa66f('0x42')](db[_0xa66f('0x43')][_0xa66f('0x44')],function(_0x50cc47){return{'name':_0x50cc47[_0xa66f('0x45')],'type':_0x50cc47[_0xa66f('0x46')][_0xa66f('0x47')]};});_0x33ed23[_0xa66f('0x48')]=_[_0xa66f('0x42')](_0x3a499e,'name');_0x33ed23['query']=_[_0xa66f('0x49')](_0x394b1e[_0xa66f('0x4a')]);_0x33ed23[_0xa66f('0x4b')]=_[_0xa66f('0x4c')](_0x33ed23[_0xa66f('0x48')],_0x33ed23[_0xa66f('0x4a')]);_0x276cd5['attributes']=_[_0xa66f('0x4c')](_0x33ed23[_0xa66f('0x48')],qs[_0xa66f('0x4d')](_0x394b1e['query']['fields']));_0x276cd5[_0xa66f('0x4e')]=_0x276cd5[_0xa66f('0x4e')][_0xa66f('0x4f')]?_0x276cd5['attributes']:_0x33ed23['model'];if(!_0x394b1e['query'][_0xa66f('0x50')](_0xa66f('0x51'))){_0x276cd5[_0xa66f('0x2e')]=qs[_0xa66f('0x2e')](_0x394b1e[_0xa66f('0x4a')][_0xa66f('0x2e')]);_0x276cd5[_0xa66f('0x2b')]=qs[_0xa66f('0x2b')](_0x394b1e['query'][_0xa66f('0x2b')]);}_0x276cd5[_0xa66f('0x52')]=qs[_0xa66f('0x53')](_0x394b1e[_0xa66f('0x4a')][_0xa66f('0x53')]);_0x276cd5[_0xa66f('0x54')]=qs['filters'](_[_0xa66f('0x55')](_0x394b1e[_0xa66f('0x4a')],_0x33ed23[_0xa66f('0x4b')]),_0x3a499e);var _0x13848d=[];var _0x20d6be=squel['select']()[_0xa66f('0x56')]('id')['field'](_0xa66f('0x37'))['field']('color')[_0xa66f('0x57')](_0xa66f('0x58'));var _0x12271d=squel[_0xa66f('0x59')]()[_0xa66f('0x56')](_0xa66f('0x5a'))['field'](_0xa66f('0x5b'))[_0xa66f('0x56')](_0xa66f('0x5c'))[_0xa66f('0x57')]('user_has_chat_interactions','ui')[_0xa66f('0x5d')]('users','u',_0xa66f('0x5e'));var _0x10fc75=squel[_0xa66f('0x59')]()[_0xa66f('0x57')](_0xa66f('0x5f'),'i')[_0xa66f('0x5d')](_0xa66f('0x60'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xa66f('0x5d')](_0xa66f('0x61'),'o',_0xa66f('0x62'))[_0xa66f('0x5d')](_0xa66f('0x63'),'a',_0xa66f('0x64'))[_0xa66f('0x5d')](_0xa66f('0x65'),'me',_0xa66f('0x66'))['left_join']('chat_interaction_has_tags','it',_0xa66f('0x67'))[_0xa66f('0x5d')](_0xa66f('0x58'),'t',_0xa66f('0x68'));var _0x2f1f1e=squel[_0xa66f('0x69')]();var _0x8bea2b=[];var _0x4b10cf=squel[_0xa66f('0x69')]();var _0x11c89e;if(_0x394b1e[_0xa66f('0x4a')][_0xa66f('0x6a')]){_0x11c89e=as['parseSearch'](_0x394b1e[_0xa66f('0x4a')][_0xa66f('0x6a')]);var _0x19ff30=_0x11c89e[_0xa66f('0x6b')];for(var _0x19f4b5=0x0;_0x19f4b5<_0x11c89e[_0xa66f('0x6c')]['length'];_0x19f4b5++){var _0x4b31f7=_0x11c89e[_0xa66f('0x6c')][_0x19f4b5];var _0x31b81b='i';var _0x174aad=_['find'](_0x3a499e,[_0xa66f('0x37'),_0x4b31f7[_0xa66f('0x56')]]);if(!_0x174aad){switch(_0x4b31f7[_0xa66f('0x56')]){case _0xa66f('0x6d'):if(_0x4b31f7[_0xa66f('0x6e')]==0x1){_0x10fc75[_0xa66f('0x6f')]('`'+_0x4b31f7[_0xa66f('0x56')]+_0xa66f('0x70'));}else{_0x10fc75[_0xa66f('0x6f')]('`'+_0x4b31f7['field']+_0xa66f('0x71'));}break;case _0xa66f('0x72'):if(_0x4b31f7[_0xa66f('0x73')]===_0xa66f('0x74')){if(_0x4b31f7[_0xa66f('0x6e')][_0xa66f('0x3f')]('\x20')[_0xa66f('0x4f')]>0x1){_0x2f1f1e[_0x19ff30](_0xa66f('0x75'),qs['getFullTextValue'](_0x4b31f7['value']),null);}else{var _0x46327d='%'+_0x4b31f7[_0xa66f('0x6e')]+'%';_0x2f1f1e[_0x19ff30](_0xa66f('0x76'),_0x46327d,_0x46327d,_0x46327d);}}else{_0x174aad=_[_0xa66f('0x77')](_0x3a499e,[_0xa66f('0x37'),'ContactId']);_0x4b31f7[_0xa66f('0x56')]='ContactId';_0x53b01b=as[_0xa66f('0x78')](_0x31b81b,_0x174aad[_0xa66f('0x46')],_0x4b31f7);_0x2f1f1e[_0x19ff30](_0x53b01b[_0xa66f('0x79')],_0x53b01b[_0xa66f('0x6e')]['start'],_0x53b01b[_0xa66f('0x6e')][_0xa66f('0x29')]);}break;case _0xa66f('0x7a'):var _0x46ea11=_0x4b31f7[_0xa66f('0x6e')][_0xa66f('0x3f')](',')[_0xa66f('0x42')](function(_0x2bdb18){return Number(_0x2bdb18);});_0x46ea11[_0xa66f('0x40')](function(_0x36b92f){_0x4b10cf['or'](_0xa66f('0x7b'),'%,'+_0x36b92f+',%');});_0x8bea2b=_[_0xa66f('0x7c')](_0x8bea2b,_0x46ea11);break;case'User':if(_0x4b31f7[_0xa66f('0x73')]===_0xa66f('0x74')){_0x2f1f1e[_0x19ff30](_0xa66f('0x7d'),'%'+_0x4b31f7[_0xa66f('0x6e')]+'%',null);}else{_0x174aad=_[_0xa66f('0x77')](_0x3a499e,[_0xa66f('0x37'),_0xa66f('0x7e')]);_0x4b31f7[_0xa66f('0x56')]='UserId';_0x53b01b=as[_0xa66f('0x78')](_0x31b81b,_0x174aad[_0xa66f('0x46')],_0x4b31f7);_0x2f1f1e[_0x19ff30](_0x53b01b[_0xa66f('0x79')],_0x53b01b[_0xa66f('0x6e')][_0xa66f('0x7f')],_0x53b01b[_0xa66f('0x6e')][_0xa66f('0x29')]);}break;case _0xa66f('0x39'):_0x53b01b=as['buildExpression']('me',null,_0x4b31f7);_0x2f1f1e[_0x19ff30](_0x53b01b['text'],_0x53b01b[_0xa66f('0x6e')][_0xa66f('0x7f')],_0x53b01b[_0xa66f('0x6e')]['end']);break;}}else{var _0x53b01b=as[_0xa66f('0x78')](_0x31b81b,_0x174aad[_0xa66f('0x46')],_0x4b31f7);_0x2f1f1e[_0x19ff30](_0x53b01b[_0xa66f('0x79')],_0x53b01b[_0xa66f('0x6e')]['start'],_0x53b01b[_0xa66f('0x6e')][_0xa66f('0x29')]);}}}else{var _0x1d4642=_(_0x394b1e[_0xa66f('0x4a')])[_0xa66f('0x49')]()[_0xa66f('0x42')](function(_0x218128){return _[_0xa66f('0x80')](_0x3a499e,['name',_0x218128])?_0x218128:undefined;})[_0xa66f('0x81')]()[_0xa66f('0x6e')]();if(!_['isEmpty'](_0x1d4642)){_0x1d4642['forEach'](function(_0x183155){if(_0x183155===_0xa66f('0x82')){_0x10fc75['where'](_0xa66f('0x83'),[]['concat'](_0x394b1e[_0xa66f('0x4a')][_0x183155]));}else if(_0x183155==='createdAt'){var _0x4feda0=JSON['parse'](_0x394b1e[_0xa66f('0x4a')][_0x183155])[_0xa66f('0x84')];var _0x1f05bb=JSON[_0xa66f('0x85')](_0x394b1e[_0xa66f('0x4a')][_0x183155])[_0xa66f('0x86')];_0x10fc75[_0xa66f('0x54')](_0xa66f('0x87'),_0x4feda0,_0x1f05bb);}else{if(_0x394b1e[_0xa66f('0x4a')][_0x183155]===_0xa66f('0x88')){_0x10fc75[_0xa66f('0x54')]('i.'+_0x183155+_0xa66f('0x89'));}else{_0x10fc75[_0xa66f('0x54')]('i.'+_0x183155+_0xa66f('0x8a'),_0x394b1e[_0xa66f('0x4a')][_0x183155]);}}});}if(_0x394b1e[_0xa66f('0x4a')]['read']){if(_0x394b1e[_0xa66f('0x4a')]['read']==0x1){_0x10fc75[_0xa66f('0x6f')]('`unreadMessages`\x20=\x200');}else{_0x10fc75[_0xa66f('0x6f')](_0xa66f('0x8b'));}}if(_0x394b1e[_0xa66f('0x4a')]['tag']){_0x8bea2b=_['isArray'](_0x394b1e[_0xa66f('0x4a')][_0xa66f('0x8c')])?_0x394b1e[_0xa66f('0x4a')][_0xa66f('0x8c')]:new Array(_0x394b1e[_0xa66f('0x4a')][_0xa66f('0x8c')]);_0x8bea2b[_0xa66f('0x40')](function(_0x578bff){_0x4b10cf['or'](_0xa66f('0x7b'),'%,'+_0x578bff+',%');});}if(_0x394b1e[_0xa66f('0x4a')][_0xa66f('0x8d')]){var _0x4426d2=_0x394b1e[_0xa66f('0x4a')][_0xa66f('0x8d')][_0xa66f('0x8e')]('\x5c','\x5c\x5c')[_0xa66f('0x8e')](/'/g,'\x27\x27');if(qs[_0xa66f('0x8f')](_0x4426d2)){_0x2f1f1e['or'](_0xa66f('0x90'),_0x4426d2+'%');}else{_0x2f1f1e['or'](_0xa66f('0x91'),qs[_0xa66f('0x92')](_0x4426d2))['or'](_0xa66f('0x93'),_0x4426d2+'%');}}}_0x10fc75['where'](_0x2f1f1e);_0x10fc75[_0xa66f('0x94')](_0xa66f('0x95'));var _0x34ebfd={'type':db[_0xa66f('0x96')][_0xa66f('0x97')][_0xa66f('0x98')],'raw':!![]};var _0x3058aa=_0x10fc75[_0xa66f('0x99')]();_0x3058aa[_0xa66f('0x56')]('i.id');_0x3058aa[_0xa66f('0x56')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xa66f('0x6d'));if(_0x276cd5['order']){_0x276cd5[_0xa66f('0x52')]['forEach'](function(_0x298bd8){var _0x5a1750=_0x298bd8[0x0]===_0xa66f('0x9a')?_0x298bd8[0x0]:'i.'+_0x298bd8[0x0];_0x10fc75[_0xa66f('0x52')](_0x5a1750,_0x298bd8[0x1]===_0xa66f('0x9b')?![]:!![]);});}if(!_[_0xa66f('0x9c')](_0x8bea2b)){_0x10fc75[_0xa66f('0x6f')](_0x4b10cf);_0x3058aa[_0xa66f('0x54')]('t.id\x20IN\x20?',_0x8bea2b);}BPromise[_0xa66f('0x9d')]()[_0xa66f('0x34')](function(){if(!_0x11c89e){if(_0x394b1e[_0xa66f('0x4a')]['ChatWebsiteId'])return;_0x3058aa[_0xa66f('0x54')](_0xa66f('0x9e'));_0x10fc75['where'](_0xa66f('0x9e'));return;}if(_0x394b1e[_0xa66f('0x9f')]['role']!=='agent')return;return _0x394b1e[_0xa66f('0x9f')][_0xa66f('0xa0')]({'attributes':['id'],'raw':!![]})[_0xa66f('0x34')](function(_0x2929fe){if(_[_0xa66f('0x9c')](_0x2929fe)){_0x3058aa['where'](_0xa66f('0xa1'));_0x10fc75[_0xa66f('0x54')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x3058aa[_0xa66f('0x54')](_0xa66f('0x83'),_['map'](_0x2929fe,'id'));_0x10fc75[_0xa66f('0x54')](_0xa66f('0x83'),_[_0xa66f('0x42')](_0x2929fe,'id'));}});})[_0xa66f('0x34')](function(){if(_0x394b1e[_0xa66f('0x9f')]['role']===_0xa66f('0x3b')&&!_0x11c89e&&!_0x394b1e[_0xa66f('0x4a')][_0xa66f('0x82')])return[];return db[_0xa66f('0xa2')][_0xa66f('0x4a')](_0x3058aa[_0xa66f('0xa3')](),_0x34ebfd);})['then'](function(_0x2b2c54){_0xb52cc6[_0xa66f('0x2d')]=_0x2b2c54[_0xa66f('0x4f')];if(_0xb52cc6[_0xa66f('0x2d')]===0x0)return[];return db[_0xa66f('0xa2')][_0xa66f('0x4a')](_0x20d6be[_0xa66f('0xa3')](),_0x34ebfd)['then'](function(_0x5ec355){_0x13848d=_[_0xa66f('0xa4')](_0x5ec355,'id');_0x34ebfd=_['merge'](_0x34ebfd,{'model':db[_0xa66f('0x43')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x394b1e[_0xa66f('0x4a')]['fields']){_0x276cd5[_0xa66f('0x4e')][_0xa66f('0x40')](function(_0x3f84f9){_0x10fc75['field']('i.'+_0x3f84f9);});}else{_0x10fc75['field'](_0xa66f('0xa5'),'unreadMessages');_0x10fc75[_0xa66f('0x56')](_0xa66f('0xa6'),_0xa66f('0xa7'));_0x10fc75['field'](_0xa66f('0xa8'),'Account.mandatoryDisposition');_0x10fc75[_0xa66f('0x56')](_0xa66f('0xa9'),_0xa66f('0x9a'));_0x10fc75[_0xa66f('0x56')]('i.*');_0x10fc75[_0xa66f('0x56')](_0xa66f('0xaa'),_0xa66f('0xab'));_0x10fc75[_0xa66f('0x56')](_0xa66f('0xac'),_0xa66f('0xad'));_0x10fc75['field'](_0xa66f('0xae'),_0xa66f('0xaf'));_0x10fc75[_0xa66f('0x56')](_0xa66f('0xb0'),_0xa66f('0xb1'));_0x10fc75['field']('c.mobile',_0xa66f('0xb2'));_0x10fc75[_0xa66f('0x56')](_0xa66f('0xb3'),_0xa66f('0xb4'));_0x10fc75[_0xa66f('0x56')](_0xa66f('0xb5'),_0xa66f('0xb6'));_0x10fc75[_0xa66f('0x56')](_0xa66f('0xb7'),_0xa66f('0xb8'));_0x10fc75[_0xa66f('0x56')](_0xa66f('0xb9'),'TagIds');}if(_0x276cd5[_0xa66f('0x2e')])_0x10fc75[_0xa66f('0x2e')](_0x276cd5['limit']);if(_0x276cd5[_0xa66f('0x2b')])_0x10fc75[_0xa66f('0x2b')](_0x276cd5[_0xa66f('0x2b')]);return db['sequelize']['query'](_0x10fc75[_0xa66f('0xa3')](),_0x34ebfd);})['then'](function(_0x3520e1){if(_0x3520e1[_0xa66f('0x4f')]>0x0)_0x12271d['where'](_0xa66f('0xba'),_[_0xa66f('0x42')](_0x3520e1,'id'));return db['sequelize'][_0xa66f('0x4a')](_0x12271d[_0xa66f('0xa3')](),_0x34ebfd)[_0xa66f('0x34')](function(_0x176b30){var _0x4bc36d=_['groupBy'](_0x176b30,_0xa66f('0xbb'));var _0xdd2d09=[];_0x3520e1[_0xa66f('0x40')](function(_0x1bab2b){_0xdd2d09[_0xa66f('0x41')](updateChatInteraction(_0x1bab2b,_0x13848d,_0x4bc36d));});return BPromise[_0xa66f('0xbc')](_0xdd2d09);});});})[_0xa66f('0x34')](function(_0xac0e98){_0xb52cc6[_0xa66f('0xbd')]=_0xac0e98;return _0xb52cc6;})[_0xa66f('0x34')](respondWithFilteredResult(_0x5cdfe2,_0x276cd5))['catch'](handleError(_0x5cdfe2,null));};exports['show']=function(_0x1d472d,_0x3cbbb6){var _0x3cf40f={'raw':![],'where':{'id':_0x1d472d[_0xa66f('0xbe')]['id']}},_0x4298ca={};_0x4298ca['model']=_[_0xa66f('0x49')](db[_0xa66f('0x43')][_0xa66f('0x44')]);_0x4298ca['query']=_['keys'](_0x1d472d['query']);_0x4298ca[_0xa66f('0x4b')]=_['intersection'](_0x4298ca[_0xa66f('0x48')],_0x4298ca[_0xa66f('0x4a')]);_0x3cf40f[_0xa66f('0x4e')]=_[_0xa66f('0x4c')](_0x4298ca['model'],qs[_0xa66f('0x4d')](_0x1d472d[_0xa66f('0x4a')]['fields']));_0x3cf40f[_0xa66f('0x4e')]=_0x3cf40f[_0xa66f('0x4e')]['length']?_0x3cf40f['attributes']:_0x4298ca[_0xa66f('0x48')];if(_0x1d472d[_0xa66f('0x4a')][_0xa66f('0xbf')]){_0x3cf40f['include']=[{'all':!![]}];}_0x3cf40f=_['merge']({},_0x3cf40f,_0x1d472d['options']);return db['ChatInteraction'][_0xa66f('0x77')](_0x3cf40f)[_0xa66f('0x34')](handleEntityNotFound(_0x3cbbb6,null))[_0xa66f('0x34')](respondWithResult(_0x3cbbb6,null))[_0xa66f('0x26')](handleError(_0x3cbbb6,null));};exports[_0xa66f('0xc0')]=function(_0x46c9b2,_0x580eb7){return db[_0xa66f('0x43')][_0xa66f('0xc0')](_0x46c9b2[_0xa66f('0x39')],{})[_0xa66f('0x34')](respondWithResult(_0x580eb7,0xc9))['catch'](handleError(_0x580eb7,null));};exports['update']=function(_0xd78ede,_0xe11c2d){if(_0xd78ede[_0xa66f('0x39')]['id']){delete _0xd78ede[_0xa66f('0x39')]['id'];}return db[_0xa66f('0x43')][_0xa66f('0x77')]({'where':{'id':_0xd78ede[_0xa66f('0xbe')]['id']}})[_0xa66f('0x34')](handleEntityNotFound(_0xe11c2d,null))[_0xa66f('0x34')](saveUpdates(_0xd78ede[_0xa66f('0x39')],null))[_0xa66f('0x34')](respondWithResult(_0xe11c2d,null))['catch'](handleError(_0xe11c2d,null));};exports[_0xa66f('0x35')]=function(_0x597ae3,_0x1b93e0){return db[_0xa66f('0x43')][_0xa66f('0x77')]({'where':{'id':_0x597ae3[_0xa66f('0xbe')]['id']}})[_0xa66f('0x34')](handleEntityNotFound(_0x1b93e0,null))['then'](removeEntity(_0x1b93e0,null))['catch'](handleError(_0x1b93e0,null));};exports['describe']=function(_0x484c8e,_0x728faa){return db[_0xa66f('0x43')][_0xa66f('0xc1')]()[_0xa66f('0x34')](respondWithResult(_0x728faa,null))['catch'](handleError(_0x728faa,null));};exports[_0xa66f('0xc2')]=function(_0x174510,_0x4f3985){var _0x348e6b=_0x174510[_0xa66f('0xbe')]['id'];var _0x4ed950;var _0xe43d63;var _0x3c2367;return db['ChatInteraction'][_0xa66f('0xc3')]({'where':{'id':_0x348e6b}})[_0xa66f('0x34')](function(_0x32bea5){_0x4ed950=_0x32bea5;return db[_0xa66f('0xc4')][_0xa66f('0xc3')]({'where':{'id':_0x32bea5[_0xa66f('0x82')]},'attributes':['id',_0xa66f('0xc5'),_0xa66f('0xc6'),_0xa66f('0xc7'),_0xa66f('0xc8'),_0xa66f('0xc9')],'raw':!![]});})['then'](function(_0x4c8386){if(_0x4c8386&&_0x4c8386[_0xa66f('0xc5')]&&_0x4c8386[_0xa66f('0xc6')]){_0xe43d63=_0x4c8386;var _0x12278e={'interaction':{'id':_0x348e6b},'agent':{'id':_0x174510['user']['id'],'name':_0x174510['user'][_0xa66f('0x37')],'fullname':_0x174510[_0xa66f('0x9f')][_0xa66f('0xca')],'email':_0x174510[_0xa66f('0x9f')][_0xa66f('0xcb')]},'contact':_0x174510['body'][_0xa66f('0x3a')],'account':_0x174510[_0xa66f('0x39')][_0xa66f('0xcc')]};var _0xfc01d7={'rejectUnauthorized':![],'method':'POST','url':_0xa66f('0xcd'),'headers':{'X-APIKEY':_0x4c8386[_0xa66f('0xc5')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x174510['user'][_0xa66f('0xcb')]],'buttons':null,'topic':_0xe43d63[_0xa66f('0xc7')],'note':_['isNull'](_0xe43d63[_0xa66f('0xc8')])?null:getMustacheRender(_0xe43d63[_0xa66f('0xc8')],_0x12278e),'metadata':null},'redirect':_0xa66f('0xce'),'json':!![]};try{if(!_[_0xa66f('0xcf')](_0xe43d63[_0xa66f('0xc9')])){var _0x3c73cc=getMustacheRender(_0xe43d63[_0xa66f('0xc9')],_0x12278e);var _0x4885bb=JSON['parse'](_0x3c73cc);_0xfc01d7[_0xa66f('0x39')][_0xa66f('0xd0')]=_0x4885bb;}}catch(_0x2e7c26){throw new db[(_0xa66f('0x96'))][(_0xa66f('0xd1'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0xfc01d7);}else{throw new db[(_0xa66f('0x96'))][(_0xa66f('0xd1'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0xa66f('0x34')](function(_0x56198a){_0x3c2367=_0x56198a;if(_0x3c2367['id']){var _0x41ef9a={'body':_0x3c2367[_0xa66f('0xd2')],'ChatWebsiteId':_0xe43d63['id'],'ChatInteractionId':_0x4ed950['id'],'direction':_0xa66f('0xd3'),'UserId':_0x174510[_0xa66f('0x9f')]['id']};return db['ChatMessage']['create'](_0x41ef9a,{});}else{throw new db['Sequelize'][(_0xa66f('0xd1'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0xa66f('0x34')](function(){return _0x4ed950['updateAttributes']({'vidaooSessionId':_0x3c2367['id']});})[_0xa66f('0x34')](respondWithResult(_0x4f3985,null))[_0xa66f('0x26')](handleError(_0x4f3985,null));};exports['customUpdate']=function(_0x35a2ce,_0x2d3bca){if(_0x35a2ce[_0xa66f('0x39')]['id']){delete _0x35a2ce[_0xa66f('0x39')]['id'];}return db[_0xa66f('0x43')][_0xa66f('0x77')]({'where':{'id':_0x35a2ce[_0xa66f('0xbe')]['id']},'include':[{'model':db['CmContact'],'as':_0xa66f('0x72')}]})[_0xa66f('0x34')](handleEntityNotFound(_0x2d3bca,null))[_0xa66f('0x34')](saveUpdates(_0x35a2ce[_0xa66f('0x39')],null))[_0xa66f('0x34')](respondWithResult(_0x2d3bca,null))[_0xa66f('0x26')](handleError(_0x2d3bca,null));};exports[_0xa66f('0xd4')]=function(_0x3a2c2c,_0x179953,_0x5dcf9d){if(_0x3a2c2c[_0xa66f('0x39')]['id']){delete _0x3a2c2c['body']['id'];}return db[_0xa66f('0x43')][_0xa66f('0x77')]({'where':{'id':_0x3a2c2c[_0xa66f('0xbe')]['id']}})[_0xa66f('0x34')](function(_0x1f4bc4){if(!_0x1f4bc4){logger['error'](_0xa66f('0xd5'),_0xa66f('0xd4'),0x194,_0xa66f('0xd6'));_0x179953[_0xa66f('0x27')](0x194);}else{if(_0x1f4bc4['UserId']){throw new db['Sequelize']['ValidationError'](_0xa66f('0xd7'));}}return _0x1f4bc4;})[_0xa66f('0x34')](function(_0x4be9ae){if(_0x4be9ae){return _0x4be9ae['update']({'closed':_0x3a2c2c[_0xa66f('0x39')][_0xa66f('0xd8')],'disposition':_0x3a2c2c['body'][_0xa66f('0xd9')]})[_0xa66f('0x34')](function(_0x17dc7d){return _0x17dc7d;});}})[_0xa66f('0x34')](function(_0x551c09){return respondWithRpcPromise('AbandonInteraction','abandon',_0x3a2c2c[_0xa66f('0x39')],client9004);})[_0xa66f('0x34')](respondWithResult(_0x179953,null))[_0xa66f('0x26')](handleError(_0x179953,null));};exports[_0xa66f('0xda')]=function(_0x377764,_0x434764,_0x315b27){_0x377764[_0xa66f('0x39')]['name']=_0x377764[_0xa66f('0xdb')][_0xa66f('0xdc')];_0x377764[_0xa66f('0x39')]['basename']=_0x377764[_0xa66f('0xdb')][_0xa66f('0xdd')];_0x377764[_0xa66f('0x39')]['type']=_0x377764['file'][_0xa66f('0xde')];return db[_0xa66f('0xdf')][_0xa66f('0xc0')](_0x377764[_0xa66f('0x39')])[_0xa66f('0x34')](respondWithResult(_0x434764,0xc9))[_0xa66f('0x26')](handleError(_0x434764,null));};exports[_0xa66f('0xe0')]=function(_0x5c5550,_0x383ce6,_0x4b2702){return db[_0xa66f('0x43')][_0xa66f('0xc3')]({'where':{'id':_0x5c5550[_0xa66f('0xbe')]['id']},'raw':!![]})[_0xa66f('0x34')](handleEntityNotFound(_0x383ce6,null))[_0xa66f('0x34')](function(_0x32f7ab){if(_0x32f7ab){if(_0x32f7ab[_0xa66f('0xd8')]){return _0x383ce6[_0xa66f('0x28')](0x193)[_0xa66f('0x2a')]({'status':0x193,'message':_0xa66f('0xe1')});}return db[_0xa66f('0xdf')][_0xa66f('0xc3')]({'where':{'id':_0x5c5550['query']['attachId']},'raw':!![]})[_0xa66f('0x34')](handleEntityNotFound(_0x383ce6,null));}})[_0xa66f('0x34')](function(_0x29ce7f){if(_0x29ce7f){var _0x1248c9=_0x29ce7f[_0xa66f('0xe2')]!==null;var _0x13948a=path['join'](config[_0xa66f('0xe3')],'server/files/attachments/');if(_0x1248c9){_0x13948a=path['join'](_0x13948a,_0xa66f('0xe4'));}var _0x1ce936=path[_0xa66f('0xe5')](_0x13948a,_0x29ce7f[_0xa66f('0xe6')]);return _0x383ce6['download'](_0x1ce936);}})[_0xa66f('0x26')](handleError(_0x383ce6,null));};exports[_0xa66f('0xe7')]=function(_0x1686df,_0x1889f4){var _0x2a03c8=null;var _0x48b16d=null;var _0x5a05e4=null;var _0x1b78fa=null;if(_0x1686df[_0xa66f('0x39')]['id']){delete _0x1686df[_0xa66f('0x39')]['id'];}if(_0x1686df[_0xa66f('0x39')]['mailTranscript']){_0x1b78fa=path[_0xa66f('0xe5')](config[_0xa66f('0xe3')],_0xa66f('0xe8'),util[_0xa66f('0xe9')](_0xa66f('0xea'),Date[_0xa66f('0xeb')]()));_0x1686df[_0xa66f('0x39')][_0xa66f('0xec')]=_0x1b78fa;}return db['ChatInteraction'][_0xa66f('0x77')]({'where':{'id':_0x1686df[_0xa66f('0xbe')]['id']},'include':[{'model':db['ChatMessage'],'as':_0xa66f('0xed'),'include':[{'model':db[_0xa66f('0xee')],'as':_0xa66f('0xee')}]}]})[_0xa66f('0x34')](handleEntityNotFound(_0x1889f4,null))[_0xa66f('0x34')](saveUpdates(_0x1686df['body'],null))[_0xa66f('0x34')](function(_0x4153a0){if(_0x4153a0){_0x2a03c8=_0x4153a0;return db[_0xa66f('0xc4')][_0xa66f('0x77')]({'where':{'id':_0x2a03c8[_0xa66f('0x82')]}});}})['then'](function(_0x820ac1){if(_0x820ac1){_0x5a05e4=_0x820ac1;return db[_0xa66f('0xef')]['find']({'where':{'id':_0x2a03c8[_0xa66f('0xf0')]}});}})[_0xa66f('0x34')](function(_0x22d154){if(_0x22d154){_0x48b16d=_0x22d154;if(_0x1b78fa){var _0x31959f=null;for(var _0x2d3123=0x1;_0x2d3123<_0x2a03c8['Messages'][_0xa66f('0x4f')];++_0x2d3123){_0x31959f=_0x2a03c8[_0xa66f('0xed')][_0x2d3123];var _0x207ea2=_0x31959f[_0xa66f('0x7e')]?util['format'](_0xa66f('0xf1'),_0x5a05e4[_0xa66f('0xf2')],_0x31959f['UserId']):_0xa66f('0xf3');var _0x19fabd=_0x1686df[_0xa66f('0x39')][_0xa66f('0xf4')]||util['format'](_0xa66f('0xf1'),_0xa66f('0xf5'),_0x31959f['ContactId']);switch(_0x5a05e4[_0xa66f('0xf6')]){case _0xa66f('0xf7'):_0x207ea2=_0x31959f[_0xa66f('0x7e')]?util['format'](_0xa66f('0xf1'),_0x5a05e4[_0xa66f('0xf2')],_0x31959f[_0xa66f('0x7e')]):'System';break;case _0xa66f('0xf8'):_0x207ea2=_0x31959f[_0xa66f('0x7e')]?_0x31959f['User']['alias']||_0x31959f[_0xa66f('0xee')][_0xa66f('0xca')]:'System';break;case _0xa66f('0xf9'):_0x207ea2=_0x31959f[_0xa66f('0x7e')]?_0x31959f[_0xa66f('0xee')][_0xa66f('0xca')]:_0xa66f('0xf3');break;default:_0x207ea2=_0x31959f['UserId']?util[_0xa66f('0xe9')](_0xa66f('0xf1'),_0x5a05e4['agentAlias'],_0x31959f[_0xa66f('0x7e')]):'System';}var _0x506797=util[_0xa66f('0xe9')](_0xa66f('0xfa'),moment(_0x31959f['createdAt'])[_0xa66f('0xe9')]('MM/DD/YYYY\x20HH:mm:ss'),_0x31959f[_0xa66f('0xfb')]==='in'?_0x19fabd:_0x207ea2,_0x31959f[_0xa66f('0x39')]);if(!_0x31959f['secret']){fs['appendFileSync'](_0x1b78fa,_0x506797);}}return db['MailAccount'][_0xa66f('0xc3')]({'where':{'service':!![]},'include':[{'model':db[_0xa66f('0xfc')],'as':_0xa66f('0xfd'),'raw':!![]}]});}}})[_0xa66f('0x34')](function(_0x168d31){if(_0x168d31&&_0x168d31[_0xa66f('0xfd')]&&_0x1686df[_0xa66f('0x39')]){var _0x5a762d={'tls':{'rejectUnauthorized':![]}};if(_0x168d31['Smtp'][_0xa66f('0xfe')]){_0x5a762d[_0xa66f('0xfe')]=_0x168d31[_0xa66f('0xfd')][_0xa66f('0xfe')];}else{_0x5a762d[_0xa66f('0xff')]=_0x168d31[_0xa66f('0xfd')]['host'];_0x5a762d[_0xa66f('0x100')]=_0x168d31[_0xa66f('0xfd')]['port'];_0x5a762d[_0xa66f('0x101')]=_0x168d31['Smtp'][_0xa66f('0x101')];}if(_0x168d31['Smtp']['authentication']){_0x5a762d[_0xa66f('0x102')]={'user':_0x168d31[_0xa66f('0xfd')][_0xa66f('0x9f')],'pass':_0x168d31[_0xa66f('0xfd')][_0xa66f('0x103')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x5a762d,'message':{'from':util[_0xa66f('0xe9')](_0xa66f('0x104'),_0x168d31[_0xa66f('0x37')],_0x168d31['email']||_0x168d31['Smtp']['user']),'to':_0x1686df[_0xa66f('0x39')][_0xa66f('0x105')],'subject':_0xa66f('0x106'),'text':util[_0xa66f('0xe9')](_0xa66f('0x107'),_0x1686df[_0xa66f('0x39')]['mailTranscript']),'attachments':[{'path':_0x1b78fa}]}})[_0xa66f('0x34')](function(){return _0x2a03c8;})[_0xa66f('0x26')](function(_0x3215af){console['error'](_0x3215af);});}else{return _0x2a03c8;}})[_0xa66f('0x34')](respondWithStatusCode(_0x1889f4,0xc8))[_0xa66f('0x26')](handleError(_0x1889f4,null));};exports['addMessage']=function(_0x4e4b66,_0x2aaaab,_0x75d882){return db[_0xa66f('0x108')][_0xa66f('0x77')]({'where':{'id':_0x4e4b66['params']['id']}})[_0xa66f('0x34')](handleEntityNotFound(_0x2aaaab,null))[_0xa66f('0x34')](function(_0x21e1d1){if(_0x21e1d1){return _0x21e1d1[_0xa66f('0x109')](_0x4e4b66[_0xa66f('0x39')]['ids'],_[_0xa66f('0x10a')](_0x4e4b66[_0xa66f('0x39')],[_0xa66f('0x10b'),'id'])||{});}})['then'](respondWithResult(_0x2aaaab,null))[_0xa66f('0x26')](handleError(_0x2aaaab,null));};exports[_0xa66f('0x10c')]=function(_0x53170d,_0x5d1e51,_0x3c3aff){var _0x3fb295={'raw':![],'where':{}};var _0x57c403={};var _0x31832f={'count':0x0,'rows':[]};return db[_0xa66f('0x43')][_0xa66f('0xc3')]({'where':{'id':_0x53170d[_0xa66f('0xbe')]['id']}})['then'](handleEntityNotFound(_0x5d1e51,null))[_0xa66f('0x34')](function(_0x43cc99){if(_0x43cc99){_0x57c403['model']=_[_0xa66f('0x49')](db[_0xa66f('0x108')]['rawAttributes']);_0x57c403['query']=_['keys'](_0x53170d[_0xa66f('0x4a')]);_0x57c403[_0xa66f('0x4b')]=_[_0xa66f('0x4c')](_0x57c403[_0xa66f('0x48')],_0x57c403[_0xa66f('0x4a')]);_0x3fb295['attributes']=_[_0xa66f('0x4c')](_0x57c403[_0xa66f('0x48')],qs['fields'](_0x53170d['query']['fields']));_0x3fb295[_0xa66f('0x4e')]=_0x3fb295[_0xa66f('0x4e')][_0xa66f('0x4f')]?_0x3fb295['attributes']:_0x57c403[_0xa66f('0x48')];if(!_0x53170d[_0xa66f('0x4a')][_0xa66f('0x50')]('nolimit')){_0x3fb295[_0xa66f('0x2e')]=qs[_0xa66f('0x2e')](_0x53170d[_0xa66f('0x4a')]['limit']);_0x3fb295[_0xa66f('0x2b')]=qs[_0xa66f('0x2b')](_0x53170d[_0xa66f('0x4a')][_0xa66f('0x2b')]);}_0x3fb295[_0xa66f('0x52')]=qs[_0xa66f('0x53')](_0x53170d[_0xa66f('0x4a')][_0xa66f('0x53')]);_0x3fb295['where']=qs[_0xa66f('0x4b')](_[_0xa66f('0x55')](_0x53170d[_0xa66f('0x4a')],_0x57c403[_0xa66f('0x4b')]));_0x3fb295[_0xa66f('0x54')][_0xa66f('0xbb')]=_0x43cc99['id'];if(_0x53170d[_0xa66f('0x4a')][_0xa66f('0x8d')]){_0x3fb295[_0xa66f('0x54')]=_[_0xa66f('0x10d')](_0x3fb295[_0xa66f('0x54')],{'$or':_[_0xa66f('0x42')](_0x3fb295[_0xa66f('0x4e')],function(_0x2b9a3c){var _0x1d688a={};_0x1d688a[_0x2b9a3c]={'$like':'%'+_0x53170d[_0xa66f('0x4a')][_0xa66f('0x8d')]+'%'};return _0x1d688a;})});}if(_0x53170d['query'][_0xa66f('0x84')]){var _0x570a01=_0x53170d['query']['$gte'][_0xa66f('0x3f')](',');var _0x35919e={};_0x35919e[_0x570a01[0x0]]={'$gte':moment(_0x570a01[0x1])[_0xa66f('0xe9')](_0xa66f('0x10e'))};_0x3fb295[_0xa66f('0x54')]=_['merge'](_0x3fb295[_0xa66f('0x54')],_0x35919e);}_0x3fb295=_['merge']({},_0x3fb295,_0x53170d[_0xa66f('0x10f')]);return db[_0xa66f('0x108')]['count']({'where':_0x3fb295['where']})[_0xa66f('0x34')](function(_0x3517eb){_0x31832f[_0xa66f('0x2d')]=_0x3517eb;if(_0x53170d[_0xa66f('0x4a')][_0xa66f('0xbf')]){_0x3fb295['include']=[{'all':!![]}];}return db[_0xa66f('0x108')]['findAll'](_0x3fb295);})[_0xa66f('0x34')](function(_0x24c209){_0x31832f[_0xa66f('0xbd')]=_0x24c209;return _0x31832f;});}})[_0xa66f('0x34')](respondWithFilteredResult(_0x5d1e51,_0x3fb295))[_0xa66f('0x26')](handleError(_0x5d1e51,null));};exports[_0xa66f('0x110')]=function(_0x1ef4c2,_0x21ec7f,_0x32b1c1){var _0x4ee9a3={'where':{}},_0x12889f={},_0xc813ad={'count':0x0,'rows':[]};return db[_0xa66f('0x43')]['findOne']({'where':{'id':_0x1ef4c2['params']['id']}})[_0xa66f('0x34')](handleEntityNotFound(_0x21ec7f,null))[_0xa66f('0x34')](function(_0x3a1e4a){if(_0x3a1e4a){_0x12889f['model']=_[_0xa66f('0x49')](db[_0xa66f('0x108')]['rawAttributes']);_0x12889f[_0xa66f('0x4a')]=_[_0xa66f('0x49')](_0x1ef4c2[_0xa66f('0x4a')]);_0x12889f[_0xa66f('0x4b')]=_[_0xa66f('0x4c')](_0x12889f[_0xa66f('0x48')],_0x12889f[_0xa66f('0x4a')]);_0x4ee9a3[_0xa66f('0x4e')]=_[_0xa66f('0x4c')](_0x12889f[_0xa66f('0x48')],qs[_0xa66f('0x4d')](_0x1ef4c2[_0xa66f('0x4a')]['fields']));_0x4ee9a3[_0xa66f('0x4e')]=_0x4ee9a3[_0xa66f('0x4e')][_0xa66f('0x4f')]?_0x4ee9a3[_0xa66f('0x4e')]:_0x12889f['model'];if(!_0x1ef4c2[_0xa66f('0x4a')]['hasOwnProperty'](_0xa66f('0x51'))){_0x4ee9a3[_0xa66f('0x2e')]=qs['limit'](_0x1ef4c2['query'][_0xa66f('0x2e')]);_0x4ee9a3[_0xa66f('0x2b')]=qs[_0xa66f('0x2b')](_0x1ef4c2[_0xa66f('0x4a')][_0xa66f('0x2b')]);}_0x4ee9a3[_0xa66f('0x52')]=qs['sort'](_0x1ef4c2['query']['sort']);_0x4ee9a3[_0xa66f('0x54')]=qs[_0xa66f('0x4b')](_[_0xa66f('0x55')](_0x1ef4c2[_0xa66f('0x4a')],_0x12889f[_0xa66f('0x4b')]));_0x4ee9a3['where'][_0xa66f('0xbb')]=_0x3a1e4a['id'];if(_0x1ef4c2['query'][_0xa66f('0x8d')]){_0x4ee9a3[_0xa66f('0x54')]=_[_0xa66f('0x10d')](_0x4ee9a3['where'],{'$or':_['map'](_0x4ee9a3[_0xa66f('0x4e')],function(_0x2bf349){var _0x211ac6={};_0x211ac6[_0x2bf349]={'$like':'%'+_0x1ef4c2[_0xa66f('0x4a')][_0xa66f('0x8d')]+'%'};return _0x211ac6;})});}_0x4ee9a3[_0xa66f('0x54')]['secret']=![];if(_0x1ef4c2[_0xa66f('0x4a')]['id']){_0x4ee9a3['where']['id']={'$gt':_0x1ef4c2['query']['id']};}_0x4ee9a3=_[_0xa66f('0x10d')]({},_0x4ee9a3,_0x1ef4c2[_0xa66f('0x10f')]);return db[_0xa66f('0x108')]['count']({'where':_0x4ee9a3['where']})['then'](function(_0x533dc1){_0xc813ad[_0xa66f('0x2d')]=_0x533dc1;_0x4ee9a3[_0xa66f('0x111')]=[];if(_0x1ef4c2[_0xa66f('0x4a')][_0xa66f('0x112')]){_0x4ee9a3[_0xa66f('0x111')][_0xa66f('0x41')]({'model':db[_0xa66f('0xee')],'as':_0xa66f('0xee'),'attributes':['id',_0xa66f('0xca'),_0xa66f('0x113')]});}if(_0x1ef4c2[_0xa66f('0x4a')][_0xa66f('0xbf')]){_0x4ee9a3[_0xa66f('0x111')]=[{'all':!![]}];}return db[_0xa66f('0x108')]['findAll'](_0x4ee9a3);})['then'](function(_0x554ba6){_0xc813ad[_0xa66f('0xbd')]=_0x554ba6;return _0xc813ad;});}})[_0xa66f('0x34')](respondWithFilteredResult(_0x21ec7f,_0x4ee9a3))[_0xa66f('0x26')](handleError(_0x21ec7f,null));};exports[_0xa66f('0x114')]=function(_0x1a3bac,_0x44649c,_0x5e4fbc){return db[_0xa66f('0x43')][_0xa66f('0x77')]({'where':{'id':_0x1a3bac[_0xa66f('0xbe')]['id']}})['then'](handleEntityNotFound(_0x44649c,null))[_0xa66f('0x34')](function(_0x1d2967){if(_0x1d2967){return _0x1d2967[_0xa66f('0x115')](_0x1a3bac[_0xa66f('0x39')][_0xa66f('0x10b')],_[_0xa66f('0x10a')](_0x1a3bac[_0xa66f('0x39')],[_0xa66f('0x10b'),'id'])||{})['spread'](function(){return db[_0xa66f('0x7a')][_0xa66f('0x116')]({'attributes':['id','name',_0xa66f('0x117')],'where':{'id':_0x1a3bac[_0xa66f('0x39')][_0xa66f('0x10b')]}});})['then'](function(_0x367549){socket[_0xa66f('0x118')](_0xa66f('0x119'),{'id':Number(_0x1a3bac['params']['id']),'tags':_0x367549||[]});return{'id':Number(_0x1a3bac[_0xa66f('0xbe')]['id']),'tags':_0x367549||[]};});}})[_0xa66f('0x34')](respondWithResult(_0x44649c,null))[_0xa66f('0x26')](handleError(_0x44649c,null));};exports[_0xa66f('0x11a')]=function(_0x4a1613,_0x324b7e,_0x1d3395){return db[_0xa66f('0x43')][_0xa66f('0x77')]({'where':{'id':_0x4a1613[_0xa66f('0xbe')]['id']}})[_0xa66f('0x34')](handleEntityNotFound(_0x324b7e,null))[_0xa66f('0x34')](function(_0x33f1ea){if(_0x33f1ea){return _0x33f1ea[_0xa66f('0x11a')](_0x4a1613[_0xa66f('0x4a')]['ids']);}})[_0xa66f('0x34')](respondWithStatusCode(_0x324b7e,null))['catch'](handleError(_0x324b7e,null));};exports[_0xa66f('0x11b')]=function(_0xd7dccf,_0x2b4238){var _0x321fa1=moment()['unix']()['toString']();var _0x254599=path[_0xa66f('0xe5')](config[_0xa66f('0xe3')],_0xa66f('0x11c'),_0xa66f('0x11d'),_0xa66f('0x11e'));var _0x3b9ff3=path['join'](config[_0xa66f('0xe3')],_0xa66f('0x11c'),'files',_0xa66f('0x11f'));var _0x5206a5=path['join'](_0x254599,_0x321fa1);var _0x6b60bd=util[_0xa66f('0xe9')](_0xa66f('0x120'),_0xd7dccf['params']['id'],_0x321fa1);var _0x3709b6=path['join'](_0x254599,_0x6b60bd);var _0x21bda3=[];_0x21bda3[_0xa66f('0x41')]({'model':db['User'],'as':_0xa66f('0xee'),'attributes':['id',_0xa66f('0xca')],'raw':!![]});_0x21bda3[_0xa66f('0x41')]({'model':db[_0xa66f('0xef')],'as':_0xa66f('0x72'),'attributes':['id',_0xa66f('0x121'),_0xa66f('0x122')],'raw':!![]});if(_0xd7dccf['query'][_0xa66f('0x11f')]){_0x21bda3[_0xa66f('0x41')]({'model':db['Attachment'],'as':_0xa66f('0xdf'),'raw':!![]});}var _0x22e7a6=[{'model':db[_0xa66f('0x108')],'as':_0xa66f('0xed'),'attributes':['id',_0xa66f('0x39'),_0xa66f('0x123'),_0xa66f('0xfb'),_0xa66f('0x124'),_0xa66f('0x125')],'include':_0x21bda3}];_0x22e7a6[_0xa66f('0x41')]({'model':db[_0xa66f('0xc4')],'as':_0xa66f('0x126'),'attributes':['id','name']});_0x22e7a6[_0xa66f('0x41')]({'model':db['User'],'as':_0xa66f('0x127'),'attributes':['id',_0xa66f('0xca')]});return db[_0xa66f('0x43')][_0xa66f('0x77')]({'where':{'id':_0xd7dccf[_0xa66f('0xbe')]['id']},'include':_0x22e7a6})[_0xa66f('0x34')](handleEntityNotFound(_0x2b4238,null))[_0xa66f('0x34')](function(_0x5efd6c){if(_0x5efd6c){var _0x24ee72=_0x5efd6c['get']({'plain':!![]});fs[_0xa66f('0x128')](_0x5206a5);var _0xdbb792={'channel':_0xa66f('0x129'),'account':_0x24ee72['Account'][_0xa66f('0x37')],'agent':_0x24ee72[_0xa66f('0x127')]?_0x24ee72['Owner']['fullname']:_0xa66f('0x12a'),'createdAt':moment(_0x24ee72[_0xa66f('0x123')])[_0xa66f('0xe9')]('YYYY-MM-DD\x20HH:mm:ss')[_0xa66f('0xa3')](),'closedAt':_0x24ee72[_0xa66f('0xd8')]?moment(_0x24ee72[_0xa66f('0x12b')])['format'](_0xa66f('0x10e'))[_0xa66f('0xa3')]():'','disposition':_0x24ee72[_0xa66f('0xd9')],'chatInfo':{'browser':_0x24ee72[_0xa66f('0x12c')],'os':_0x24ee72[_0xa66f('0x12d')],'referer':_0x24ee72['referer'],'customerIp':_0x24ee72[_0xa66f('0x12e')],'customerPort':_0x24ee72[_0xa66f('0x12f')]?_0x24ee72[_0xa66f('0x12f')]:_0xa66f('0x12a')},'messages':_(_0x24ee72[_0xa66f('0xed')])[_0xa66f('0x130')]()['filter']({'secret':![]})[_0xa66f('0x42')](function(_0x31cc20){if(_0x31cc20['Attachment']){var _0x10a611=path[_0xa66f('0xe5')](_0x3b9ff3,_0x31cc20['Attachment'][_0xa66f('0xe6')]);if(fs[_0xa66f('0x131')](_0x10a611)){fs[_0xa66f('0x132')](_0x10a611)['pipe'](fs[_0xa66f('0x133')](path['join'](_0x5206a5,_0x31cc20['Attachment']['basename'])));}}return{'date':moment(_0x31cc20['createdAt'])['format'](_0xa66f('0x10e'))['toString'](),'sender':_0x31cc20[_0xa66f('0xfb')]===_0xa66f('0xd3')?_0x31cc20[_0xa66f('0xee')]?_0x31cc20[_0xa66f('0xee')][_0xa66f('0xca')]:_0xa66f('0xf3'):_0x31cc20[_0xa66f('0x72')][_0xa66f('0x121')]+(_0x31cc20[_0xa66f('0x72')][_0xa66f('0x122')]?'\x20'+_0x31cc20[_0xa66f('0x72')][_0xa66f('0x122')]:''),'body':_0x31cc20[_0xa66f('0xdf')]?_0x31cc20[_0xa66f('0xdf')][_0xa66f('0xe6')]:_0x31cc20[_0xa66f('0x39')],'direction':_0x31cc20[_0xa66f('0xfb')]==='out'?'A':'C','secret':_0x31cc20['secret'],'read':_0x31cc20[_0xa66f('0x125')],'attachment':_0x31cc20[_0xa66f('0xdf')]};})[_0xa66f('0x6e')]()};return ejs[_0xa66f('0x134')](path[_0xa66f('0xe5')](config[_0xa66f('0xe3')],_0xa66f('0x11c'),'views',_0xa66f('0x135')),{'interaction':_0xdbb792})['then'](function(_0x12024d){var _0x4baf59=path[_0xa66f('0xe5')](_0x5206a5,_0xa66f('0x136')+_0x24ee72['id']+'-'+_0x321fa1+'.pdf');var _0x33198c={'path':_0x4baf59,'channel':_0xa66f('0x129'),'interactionId':_0x24ee72['id']};return pdf[_0xa66f('0x137')](_0x12024d,_0x33198c);})[_0xa66f('0x34')](function(){return new BPromise(function(_0x3792b2,_0x5101f8){zipdir(_0x5206a5,{'saveTo':_0x3709b6},function(_0x4ac4b4,_0x171111){if(_0x4ac4b4)return _0x5101f8(_0x4ac4b4);return _0x3792b2(_0x171111);});})[_0xa66f('0x34')](function(){return new BPromise(function(_0x46691d,_0x136518){rimraf(_0x5206a5,function(_0x1404df){if(_0x1404df)_0x136518(_0x1404df);return _0x46691d();});});})[_0xa66f('0x34')](function(){return _0x2b4238[_0xa66f('0x11b')](_0x3709b6,_0x6b60bd,function(_0x58f445){if(_0x58f445){console[_0xa66f('0x138')](_0xa66f('0x139'),_0x58f445);}else{fs['unlinkSync'](_0x3709b6);}});});});}else{return _0x2b4238[_0xa66f('0x27')](0xc8);}})['catch'](handleError(_0x2b4238,null));}; \ No newline at end of file +var _0x7880=['parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','ChatWebsiteId','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','agent','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.firstName','Contact.firstName','c.lastName','Contact.lastName','c.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.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','rows','show','params','include','options','create','destroy','describe','createVidaooSession','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','Error\x20in\x20conversion\x20vidaooMetadata','ValidationError','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','update','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','attachmentDownload','Unauthorized','findOne','attachId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','transcript-%s.txt','now','Messages','%s%d','agentAlias','customer','format','website_alias','System','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','appendFileSync','MailServerOut','Smtp','service','host','port','secure','pass','SendMail','\x22%s\x22\x20<%s>','email','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','getMessages','nolimit','pick','YYYY-MM-DD\x20HH:mm:ss','includeAll','getMyMessages','secret','includeAgent','findAll','addTags','spread','emit','chatInteractionTags:save','removeTags','unix','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','Owner','get','mkdirSync','Account','closedAt','browserName','customerPort','N.A.','tail','createReadStream','createWriteStream','direction','renderFile','downloadInteraction.ejs','transcript-','.pdf','Chat','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','jayson/promise','http','client','then','info','request\x20sent','debug','error','code','ChatInteraction,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','name','send','merge','contact','interaction','account','fullname','Tags','TagIds','split','forEach','push','index','map','ChatInteraction','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','select','field','color','from','tools_tags','u.id','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','chat_websites','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','ContactId','buildExpression','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','body','some','isEmpty','concat','createdAt'];(function(_0x2db099,_0x5d96d2){var _0x1e25d8=function(_0x38b6f0){while(--_0x38b6f0){_0x2db099['push'](_0x2db099['shift']());}};_0x1e25d8(++_0x5d96d2);}(_0x7880,0x1f4));var _0x0788=function(_0x706091,_0x5e07d9){_0x706091=_0x706091-0x0;var _0x4aee6f=_0x7880[_0x706091];return _0x4aee6f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0788('0x0'));var zipdir=require(_0x0788('0x1'));var jsonpatch=require(_0x0788('0x2'));var rp=require(_0x0788('0x3'));var moment=require(_0x0788('0x4'));var BPromise=require(_0x0788('0x5'));var Mustache=require('mustache');var util=require(_0x0788('0x6'));var path=require(_0x0788('0x7'));var sox=require(_0x0788('0x8'));var csv=require(_0x0788('0x9'));var ejs=require(_0x0788('0xa'));var fs=require('fs');var fs_extra=require(_0x0788('0xb'));var _=require(_0x0788('0xc'));var squel=require(_0x0788('0xd'));var crypto=require(_0x0788('0xe'));var jsforce=require(_0x0788('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0788('0x9'));var querystring=require('querystring');var Papa=require(_0x0788('0x10'));var Redis=require('ioredis');var authService=require(_0x0788('0x11'));var qs=require(_0x0788('0x12'));var as=require(_0x0788('0x13'));var pdf=require(_0x0788('0x14'));var hardwareService=require(_0x0788('0x15'));var logger=require('../../config/logger')(_0x0788('0x16'));var utils=require(_0x0788('0x17'));var config=require(_0x0788('0x18'));var licenseUtil=require(_0x0788('0x19'));var db=require(_0x0788('0x1a'))['db'];config[_0x0788('0x1b')]=_[_0x0788('0x1c')](config['redis'],{'host':_0x0788('0x1d'),'port':0x18eb});var socket=require(_0x0788('0x1e'))(new Redis(config[_0x0788('0x1b')]));require(_0x0788('0x1f'))['register'](socket);var jayson=require(_0x0788('0x20'));var client=jayson['client'][_0x0788('0x21')]({'port':0x232b});var client9004=jayson[_0x0788('0x22')][_0x0788('0x21')]({'port':0x232c});function respondWithRpcPromise(_0xb406fb,_0x2ddd1a,_0x430e34,_0x5e1a29){return new BPromise(function(_0x573822,_0x17d805){var _0x461d9d=_0x5e1a29||client;return _0x461d9d['request'](_0xb406fb,_0x430e34)[_0x0788('0x23')](function(_0x415f19){logger[_0x0788('0x24')]('ChatInteraction,\x20%s,\x20%s',_0x2ddd1a,_0x0788('0x25'));logger[_0x0788('0x26')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x2ddd1a,_0x0788('0x25'),JSON['stringify'](_0x415f19));if(_0x415f19[_0x0788('0x27')]){if(_0x415f19['error'][_0x0788('0x28')]===0x1f4){logger[_0x0788('0x27')](_0x0788('0x29'),_0x2ddd1a,_0x415f19[_0x0788('0x27')][_0x0788('0x2a')]);return _0x17d805(_0x415f19['error']['message']);}logger[_0x0788('0x27')](_0x0788('0x29'),_0x2ddd1a,_0x415f19[_0x0788('0x27')][_0x0788('0x2a')]);return _0x573822(_0x415f19['error']['message']);}else{logger[_0x0788('0x24')](_0x0788('0x29'),_0x2ddd1a,_0x0788('0x25'));_0x573822(_0x415f19['result']['message']);}})[_0x0788('0x2b')](function(_0xa1f7dc){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x2ddd1a,_0xa1f7dc);_0x17d805(_0xa1f7dc);});});}function respondWithStatusCode(_0x5a54a5,_0x44798c){_0x44798c=_0x44798c||0xcc;return function(_0x57fda1){if(_0x57fda1){return _0x5a54a5[_0x0788('0x2c')](_0x44798c);}return _0x5a54a5[_0x0788('0x2d')](_0x44798c)[_0x0788('0x2e')]();};}function respondWithResult(_0x18fc0e,_0xf9ba32){_0xf9ba32=_0xf9ba32||0xc8;return function(_0xb2f4a5){if(_0xb2f4a5){return _0x18fc0e[_0x0788('0x2d')](_0xf9ba32)[_0x0788('0x2f')](_0xb2f4a5);}};}function respondWithFilteredResult(_0x5b7594,_0x5a5178){return function(_0x3c5246){if(_0x3c5246){var _0x40d345=typeof _0x5a5178['offset']==='undefined'&&typeof _0x5a5178[_0x0788('0x30')]===_0x0788('0x31');var _0x20fcd8=_0x3c5246[_0x0788('0x32')];var _0x44cbfb=_0x40d345?0x0:_0x5a5178[_0x0788('0x33')];var _0x327d67=_0x40d345?_0x3c5246[_0x0788('0x32')]:_0x5a5178[_0x0788('0x33')]+_0x5a5178[_0x0788('0x30')];var _0x5ec0ed;if(_0x327d67>=_0x20fcd8){_0x327d67=_0x20fcd8;_0x5ec0ed=0xc8;}else{_0x5ec0ed=0xce;}_0x5b7594[_0x0788('0x2d')](_0x5ec0ed);return _0x5b7594[_0x0788('0x34')](_0x0788('0x35'),_0x44cbfb+'-'+_0x327d67+'/'+_0x20fcd8)[_0x0788('0x2f')](_0x3c5246);}return null;};}function patchUpdates(_0xce4534){return function(_0x458193){try{jsonpatch[_0x0788('0x36')](_0x458193,_0xce4534,!![]);}catch(_0x15d67a){return BPromise[_0x0788('0x37')](_0x15d67a);}return _0x458193[_0x0788('0x38')]();};}function saveUpdates(_0x4fa055,_0x4ae132){return function(_0x5947d3){if(_0x5947d3){return _0x5947d3['update'](_0x4fa055)['then'](function(_0x586a06){return _0x586a06;});}return null;};}function removeEntity(_0x208a89,_0x38a4ae){return function(_0x2130e3){if(_0x2130e3){return _0x2130e3['destroy']()[_0x0788('0x23')](function(){_0x208a89[_0x0788('0x2d')](0xcc)[_0x0788('0x2e')]();});}};}function handleEntityNotFound(_0xaea11d,_0x57c4d8){return function(_0x2ed940){if(!_0x2ed940){_0xaea11d['sendStatus'](0x194);}return _0x2ed940;};}function handleError(_0x322465,_0x4fcde3){_0x4fcde3=_0x4fcde3||0x1f4;return function(_0x9d1edb){logger[_0x0788('0x27')](_0x9d1edb['stack']);if(_0x9d1edb[_0x0788('0x39')]){delete _0x9d1edb[_0x0788('0x39')];}_0x322465['status'](_0x4fcde3)[_0x0788('0x3a')](_0x9d1edb);};}function getMustacheRender(_0x5eb693,_0x295024){return Mustache['render'](_0x5eb693,_[_0x0788('0x3b')](_0x295024['body'],{'contact':_0x295024[_0x0788('0x3c')],'message':_0x295024['message'],'agent':_0x295024['agent'],'interaction':_0x295024[_0x0788('0x3d')],'account':_0x295024[_0x0788('0x3e')]}))||'';}function getInteractionUsers(_0x2e48cf,_0x2d17b0){return new BPromise(function(_0x8cfffc,_0x53da74){try{if(_0x2d17b0[_0x2e48cf['id']]){_0x2e48cf['Users']=_['map'](_0x2d17b0[_0x2e48cf['id']],function(_0x4d539a){return{'id':_0x4d539a['id'],'fullname':_0x4d539a[_0x0788('0x3f')]};});}}catch(_0x1202c4){_0x53da74(_0x1202c4);}_0x8cfffc(_0x2e48cf);});}function getInteractionTags(_0x45b247,_0x358a22){return new BPromise(function(_0x362c49,_0x5993ad){try{if(_0x45b247['TagIds']){_0x45b247[_0x0788('0x40')]=[];_0x45b247[_0x0788('0x41')][_0x0788('0x42')](',')[_0x0788('0x43')](function(_0x236b63){_0x45b247[_0x0788('0x40')][_0x0788('0x44')](_0x358a22[_0x236b63]);});}delete _0x45b247[_0x0788('0x41')];}catch(_0x347984){_0x5993ad(_0x347984);}_0x362c49(_0x45b247);});}function updateChatInteraction(_0x50e8f5,_0x5581e6,_0x441aec){return new BPromise(function(_0x1d579d,_0x9e8ee){return getInteractionUsers(_0x50e8f5,_0x441aec)['then'](function(_0x5ab353){return getInteractionTags(_0x5ab353,_0x5581e6);})['then'](function(_0x172424){_0x1d579d(_0x172424);})[_0x0788('0x2b')](function(_0x25501b){_0x9e8ee(_0x25501b);});});}exports[_0x0788('0x45')]=function(_0x2737d8,_0x1928f3){var _0x1ab634={},_0x15b90c={},_0x4bd0d9={'count':0x0,'rows':[]};var _0x15c618=_[_0x0788('0x46')](db[_0x0788('0x47')][_0x0788('0x48')],function(_0x58eb04){return{'name':_0x58eb04[_0x0788('0x49')],'type':_0x58eb04[_0x0788('0x4a')]['key']};});_0x15b90c['model']=_['map'](_0x15c618,_0x0788('0x39'));_0x15b90c['query']=_[_0x0788('0x4b')](_0x2737d8[_0x0788('0x4c')]);_0x15b90c[_0x0788('0x4d')]=_[_0x0788('0x4e')](_0x15b90c[_0x0788('0x4f')],_0x15b90c[_0x0788('0x4c')]);_0x1ab634[_0x0788('0x50')]=_[_0x0788('0x4e')](_0x15b90c['model'],qs['fields'](_0x2737d8[_0x0788('0x4c')][_0x0788('0x51')]));_0x1ab634[_0x0788('0x50')]=_0x1ab634['attributes'][_0x0788('0x52')]?_0x1ab634[_0x0788('0x50')]:_0x15b90c[_0x0788('0x4f')];if(!_0x2737d8[_0x0788('0x4c')][_0x0788('0x53')]('nolimit')){_0x1ab634['limit']=qs[_0x0788('0x30')](_0x2737d8[_0x0788('0x4c')]['limit']);_0x1ab634[_0x0788('0x33')]=qs['offset'](_0x2737d8[_0x0788('0x4c')][_0x0788('0x33')]);}_0x1ab634[_0x0788('0x54')]=qs[_0x0788('0x55')](_0x2737d8[_0x0788('0x4c')][_0x0788('0x55')]);_0x1ab634[_0x0788('0x56')]=qs[_0x0788('0x4d')](_['pick'](_0x2737d8[_0x0788('0x4c')],_0x15b90c[_0x0788('0x4d')]),_0x15c618);var _0x3f2f1b=[];var _0x5ef557=squel[_0x0788('0x57')]()[_0x0788('0x58')]('id')['field'](_0x0788('0x39'))[_0x0788('0x58')](_0x0788('0x59'))[_0x0788('0x5a')](_0x0788('0x5b'));var _0x347cc8=squel['select']()['field'](_0x0788('0x5c'))[_0x0788('0x58')]('u.fullname')[_0x0788('0x58')](_0x0788('0x5d'))[_0x0788('0x5a')](_0x0788('0x5e'),'ui')[_0x0788('0x5f')](_0x0788('0x60'),'u',_0x0788('0x61'));var _0xeedd30=squel[_0x0788('0x57')]()[_0x0788('0x5a')](_0x0788('0x62'),'i')[_0x0788('0x5f')]('cm_contacts','c',_0x0788('0x63'))[_0x0788('0x5f')](_0x0788('0x60'),'o','o.id\x20=\x20i.UserId')[_0x0788('0x5f')](_0x0788('0x64'),'a','a.id\x20=\x20i.ChatWebsiteId')['left_join'](_0x0788('0x65'),'me',_0x0788('0x66'))[_0x0788('0x5f')](_0x0788('0x67'),'it',_0x0788('0x68'))[_0x0788('0x5f')]('tools_tags','t',_0x0788('0x69'));var _0x3be076=squel[_0x0788('0x6a')]();var _0x47be71=[];var _0x533f71=squel[_0x0788('0x6a')]();var _0x5419d9;if(_0x2737d8[_0x0788('0x4c')][_0x0788('0x6b')]){_0x5419d9=as[_0x0788('0x6c')](_0x2737d8[_0x0788('0x4c')][_0x0788('0x6b')]);var _0x348d25=_0x5419d9[_0x0788('0x6d')];for(var _0x29c912=0x0;_0x29c912<_0x5419d9[_0x0788('0x6e')][_0x0788('0x52')];_0x29c912++){var _0x59fcbc=_0x5419d9[_0x0788('0x6e')][_0x29c912];var _0x446170='i';var _0x602e3b=_[_0x0788('0x6f')](_0x15c618,['name',_0x59fcbc[_0x0788('0x58')]]);if(!_0x602e3b){switch(_0x59fcbc[_0x0788('0x58')]){case _0x0788('0x70'):if(_0x59fcbc[_0x0788('0x71')]==0x1){_0xeedd30[_0x0788('0x72')]('`'+_0x59fcbc['field']+_0x0788('0x73'));}else{_0xeedd30['having']('`'+_0x59fcbc[_0x0788('0x58')]+_0x0788('0x74'));}break;case _0x0788('0x75'):if(_0x59fcbc[_0x0788('0x76')]===_0x0788('0x77')){if(_0x59fcbc[_0x0788('0x71')][_0x0788('0x42')]('\x20')[_0x0788('0x52')]>0x1){_0x3be076[_0x348d25](_0x0788('0x78'),qs['getFullTextValue'](_0x59fcbc[_0x0788('0x71')]),null);}else{var _0x2dea6c='%'+_0x59fcbc[_0x0788('0x71')]+'%';_0x3be076[_0x348d25]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x2dea6c,_0x2dea6c,_0x2dea6c);}}else{_0x602e3b=_['find'](_0x15c618,[_0x0788('0x39'),_0x0788('0x79')]);_0x59fcbc[_0x0788('0x58')]='ContactId';_0x35c612=as[_0x0788('0x7a')](_0x446170,_0x602e3b[_0x0788('0x4a')],_0x59fcbc);_0x3be076[_0x348d25](_0x35c612[_0x0788('0x7b')],_0x35c612[_0x0788('0x71')]['start'],_0x35c612['value']['end']);}break;case _0x0788('0x7c'):var _0x2a55f2=_0x59fcbc[_0x0788('0x71')]['split'](',')['map'](function(_0xaa2d4d){return Number(_0xaa2d4d);});_0x2a55f2['forEach'](function(_0x955bfa){_0x533f71['or'](_0x0788('0x7d'),'%,'+_0x955bfa+',%');});_0x47be71=_[_0x0788('0x7e')](_0x47be71,_0x2a55f2);break;case _0x0788('0x7f'):if(_0x59fcbc[_0x0788('0x76')]===_0x0788('0x77')){_0x3be076[_0x348d25](_0x0788('0x80'),'%'+_0x59fcbc[_0x0788('0x71')]+'%',null);}else{_0x602e3b=_[_0x0788('0x6f')](_0x15c618,[_0x0788('0x39'),'UserId']);_0x59fcbc[_0x0788('0x58')]=_0x0788('0x81');_0x35c612=as['buildExpression'](_0x446170,_0x602e3b['type'],_0x59fcbc);_0x3be076[_0x348d25](_0x35c612[_0x0788('0x7b')],_0x35c612[_0x0788('0x71')][_0x0788('0x82')],_0x35c612[_0x0788('0x71')][_0x0788('0x2e')]);}break;case _0x0788('0x83'):_0x35c612=as['buildExpression']('me',null,_0x59fcbc);_0x3be076[_0x348d25](_0x35c612[_0x0788('0x7b')],_0x35c612[_0x0788('0x71')][_0x0788('0x82')],_0x35c612[_0x0788('0x71')]['end']);break;}}else{var _0x35c612=as[_0x0788('0x7a')](_0x446170,_0x602e3b[_0x0788('0x4a')],_0x59fcbc);_0x3be076[_0x348d25](_0x35c612[_0x0788('0x7b')],_0x35c612['value']['start'],_0x35c612[_0x0788('0x71')][_0x0788('0x2e')]);}}}else{var _0x5513f7=_(_0x2737d8[_0x0788('0x4c')])[_0x0788('0x4b')]()[_0x0788('0x46')](function(_0x2b10fe){return _[_0x0788('0x84')](_0x15c618,[_0x0788('0x39'),_0x2b10fe])?_0x2b10fe:undefined;})['compact']()[_0x0788('0x71')]();if(!_[_0x0788('0x85')](_0x5513f7)){_0x5513f7[_0x0788('0x43')](function(_0x515dd8){if(_0x515dd8==='ChatWebsiteId'){_0xeedd30[_0x0788('0x56')]('i.ChatWebsiteId\x20IN\x20?',[][_0x0788('0x86')](_0x2737d8[_0x0788('0x4c')][_0x515dd8]));}else if(_0x515dd8===_0x0788('0x87')){var _0xa4b3f8=JSON[_0x0788('0x88')](_0x2737d8[_0x0788('0x4c')][_0x515dd8])[_0x0788('0x89')];var _0x216ea9=JSON[_0x0788('0x88')](_0x2737d8['query'][_0x515dd8])[_0x0788('0x8a')];_0xeedd30[_0x0788('0x56')](_0x0788('0x8b'),_0xa4b3f8,_0x216ea9);}else{if(_0x2737d8['query'][_0x515dd8]===_0x0788('0x8c')){_0xeedd30[_0x0788('0x56')]('i.'+_0x515dd8+_0x0788('0x8d'));}else{_0xeedd30['where']('i.'+_0x515dd8+_0x0788('0x8e'),_0x2737d8[_0x0788('0x4c')][_0x515dd8]);}}});}if(_0x2737d8[_0x0788('0x4c')][_0x0788('0x8f')]){if(_0x2737d8[_0x0788('0x4c')][_0x0788('0x8f')]==0x1){_0xeedd30[_0x0788('0x72')](_0x0788('0x90'));}else{_0xeedd30[_0x0788('0x72')]('`unreadMessages`\x20>\x200');}}if(_0x2737d8[_0x0788('0x4c')][_0x0788('0x91')]){_0x47be71=_[_0x0788('0x92')](_0x2737d8[_0x0788('0x4c')][_0x0788('0x91')])?_0x2737d8['query'][_0x0788('0x91')]:new Array(_0x2737d8[_0x0788('0x4c')][_0x0788('0x91')]);_0x47be71['forEach'](function(_0x1788d1){_0x533f71['or'](_0x0788('0x7d'),'%,'+_0x1788d1+',%');});}if(_0x2737d8[_0x0788('0x4c')][_0x0788('0x93')]){var _0x2b74df=_0x2737d8['query'][_0x0788('0x93')][_0x0788('0x94')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x0788('0x95')](_0x2b74df)){_0x3be076['or'](_0x0788('0x96'),_0x2b74df+'%');}else{_0x3be076['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0788('0x97')](_0x2b74df))['or'](_0x0788('0x98'),_0x2b74df+'%');}}}_0xeedd30[_0x0788('0x56')](_0x3be076);_0xeedd30['group'](_0x0788('0x99'));var _0x42c537={'type':db[_0x0788('0x9a')]['QueryTypes'][_0x0788('0x9b')],'raw':!![]};var _0x1b3046=_0xeedd30[_0x0788('0x9c')]();_0x1b3046[_0x0788('0x58')](_0x0788('0x99'));_0x1b3046[_0x0788('0x58')](_0x0788('0x9d'),_0x0788('0x70'));if(_0x1ab634['order']){_0x1ab634[_0x0788('0x54')][_0x0788('0x43')](function(_0x121f1d){var _0x31c921=_0x121f1d[0x0]==='contactName'?_0x121f1d[0x0]:'i.'+_0x121f1d[0x0];_0xeedd30['order'](_0x31c921,_0x121f1d[0x1]===_0x0788('0x9e')?![]:!![]);});}if(!_[_0x0788('0x85')](_0x47be71)){_0xeedd30['having'](_0x533f71);_0x1b3046[_0x0788('0x56')](_0x0788('0x9f'),_0x47be71);}BPromise[_0x0788('0xa0')]()['then'](function(){if(!_0x5419d9){if(_0x2737d8['query'][_0x0788('0xa1')])return;_0x1b3046[_0x0788('0x56')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0xeedd30['where']('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x2737d8[_0x0788('0xa2')][_0x0788('0xa3')]!=='agent')return;return _0x2737d8[_0x0788('0xa2')][_0x0788('0xa4')]({'attributes':['id'],'raw':!![]})[_0x0788('0x23')](function(_0x41fe7a){if(_[_0x0788('0x85')](_0x41fe7a)){_0x1b3046['where'](_0x0788('0xa5'));_0xeedd30['where'](_0x0788('0xa5'));}else{_0x1b3046['where'](_0x0788('0xa6'),_[_0x0788('0x46')](_0x41fe7a,'id'));_0xeedd30[_0x0788('0x56')](_0x0788('0xa6'),_[_0x0788('0x46')](_0x41fe7a,'id'));}});})[_0x0788('0x23')](function(){if(_0x2737d8[_0x0788('0xa2')][_0x0788('0xa3')]===_0x0788('0xa7')&&!_0x5419d9&&!_0x2737d8[_0x0788('0x4c')][_0x0788('0xa1')])return[];return db[_0x0788('0xa8')][_0x0788('0x4c')](_0x1b3046['toString'](),_0x42c537);})['then'](function(_0x50363e){_0x4bd0d9[_0x0788('0x32')]=_0x50363e[_0x0788('0x52')];if(_0x4bd0d9[_0x0788('0x32')]===0x0)return[];return db[_0x0788('0xa8')][_0x0788('0x4c')](_0x5ef557[_0x0788('0xa9')](),_0x42c537)[_0x0788('0x23')](function(_0x16838d){_0x3f2f1b=_[_0x0788('0xaa')](_0x16838d,'id');_0x42c537=_[_0x0788('0x3b')](_0x42c537,{'model':db[_0x0788('0x47')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2737d8['query']['fields']){_0x1ab634[_0x0788('0x50')][_0x0788('0x43')](function(_0x104a70){_0xeedd30[_0x0788('0x58')]('i.'+_0x104a70);});}else{_0xeedd30[_0x0788('0x58')](_0x0788('0x9d'),_0x0788('0x70'));_0xeedd30[_0x0788('0x58')]('a.key','Account.key');_0xeedd30[_0x0788('0x58')](_0x0788('0xab'),_0x0788('0xac'));_0xeedd30[_0x0788('0x58')](_0x0788('0xad'),_0x0788('0xae'));_0xeedd30['field'](_0x0788('0xaf'));_0xeedd30[_0x0788('0x58')](_0x0788('0xb0'),_0x0788('0xb1'));_0xeedd30[_0x0788('0x58')](_0x0788('0xb2'),_0x0788('0xb3'));_0xeedd30[_0x0788('0x58')](_0x0788('0xb4'),'Contact.email');_0xeedd30[_0x0788('0x58')](_0x0788('0xb5'),_0x0788('0xb6'));_0xeedd30[_0x0788('0x58')](_0x0788('0xb7'),_0x0788('0xb8'));_0xeedd30['field'](_0x0788('0xb9'),_0x0788('0xba'));_0xeedd30[_0x0788('0x58')](_0x0788('0xbb'),_0x0788('0xbc'));_0xeedd30[_0x0788('0x58')](_0x0788('0xbd'),_0x0788('0xbe'));_0xeedd30[_0x0788('0x58')](_0x0788('0xbf'),'TagIds');}if(_0x1ab634[_0x0788('0x30')])_0xeedd30['limit'](_0x1ab634[_0x0788('0x30')]);if(_0x1ab634['offset'])_0xeedd30[_0x0788('0x33')](_0x1ab634['offset']);return db[_0x0788('0xa8')][_0x0788('0x4c')](_0xeedd30[_0x0788('0xa9')](),_0x42c537);})[_0x0788('0x23')](function(_0x5242eb){if(_0x5242eb[_0x0788('0x52')]>0x0)_0x347cc8[_0x0788('0x56')](_0x0788('0xc0'),_['map'](_0x5242eb,'id'));return db[_0x0788('0xa8')][_0x0788('0x4c')](_0x347cc8['toString'](),_0x42c537)[_0x0788('0x23')](function(_0x4645aa){var _0x37e9a9=_[_0x0788('0xc1')](_0x4645aa,_0x0788('0xc2'));var _0xab471b=[];_0x5242eb[_0x0788('0x43')](function(_0x563533){_0xab471b[_0x0788('0x44')](updateChatInteraction(_0x563533,_0x3f2f1b,_0x37e9a9));});return BPromise[_0x0788('0xc3')](_0xab471b);});});})[_0x0788('0x23')](function(_0x3f3e06){_0x4bd0d9[_0x0788('0xc4')]=_0x3f3e06;return _0x4bd0d9;})[_0x0788('0x23')](respondWithFilteredResult(_0x1928f3,_0x1ab634))[_0x0788('0x2b')](handleError(_0x1928f3,null));};exports[_0x0788('0xc5')]=function(_0x5761b1,_0x5130c4){var _0x26233b={'raw':![],'where':{'id':_0x5761b1[_0x0788('0xc6')]['id']}},_0x42f6df={};_0x42f6df[_0x0788('0x4f')]=_[_0x0788('0x4b')](db[_0x0788('0x47')][_0x0788('0x48')]);_0x42f6df['query']=_[_0x0788('0x4b')](_0x5761b1['query']);_0x42f6df['filters']=_[_0x0788('0x4e')](_0x42f6df[_0x0788('0x4f')],_0x42f6df['query']);_0x26233b[_0x0788('0x50')]=_[_0x0788('0x4e')](_0x42f6df[_0x0788('0x4f')],qs[_0x0788('0x51')](_0x5761b1[_0x0788('0x4c')][_0x0788('0x51')]));_0x26233b['attributes']=_0x26233b[_0x0788('0x50')][_0x0788('0x52')]?_0x26233b['attributes']:_0x42f6df[_0x0788('0x4f')];if(_0x5761b1[_0x0788('0x4c')]['includeAll']){_0x26233b[_0x0788('0xc7')]=[{'all':!![]}];}_0x26233b=_[_0x0788('0x3b')]({},_0x26233b,_0x5761b1[_0x0788('0xc8')]);return db[_0x0788('0x47')][_0x0788('0x6f')](_0x26233b)[_0x0788('0x23')](handleEntityNotFound(_0x5130c4,null))[_0x0788('0x23')](respondWithResult(_0x5130c4,null))['catch'](handleError(_0x5130c4,null));};exports[_0x0788('0xc9')]=function(_0x2e0529,_0x1f9944){return db[_0x0788('0x47')]['create'](_0x2e0529[_0x0788('0x83')],{})[_0x0788('0x23')](respondWithResult(_0x1f9944,0xc9))['catch'](handleError(_0x1f9944,null));};exports['update']=function(_0x691225,_0x15a70b){if(_0x691225[_0x0788('0x83')]['id']){delete _0x691225[_0x0788('0x83')]['id'];}return db[_0x0788('0x47')][_0x0788('0x6f')]({'where':{'id':_0x691225['params']['id']}})[_0x0788('0x23')](handleEntityNotFound(_0x15a70b,null))[_0x0788('0x23')](saveUpdates(_0x691225[_0x0788('0x83')],null))[_0x0788('0x23')](respondWithResult(_0x15a70b,null))[_0x0788('0x2b')](handleError(_0x15a70b,null));};exports[_0x0788('0xca')]=function(_0xc5e64a,_0x3539d4){return db[_0x0788('0x47')][_0x0788('0x6f')]({'where':{'id':_0xc5e64a[_0x0788('0xc6')]['id']}})[_0x0788('0x23')](handleEntityNotFound(_0x3539d4,null))[_0x0788('0x23')](removeEntity(_0x3539d4,null))[_0x0788('0x2b')](handleError(_0x3539d4,null));};exports[_0x0788('0xcb')]=function(_0x150a05,_0x1e0fb7){return db['ChatInteraction'][_0x0788('0xcb')]()[_0x0788('0x23')](respondWithResult(_0x1e0fb7,null))[_0x0788('0x2b')](handleError(_0x1e0fb7,null));};exports[_0x0788('0xcc')]=function(_0x57b44e,_0x191e15){var _0x5d0919=_0x57b44e[_0x0788('0xc6')]['id'];var _0x563e4c;var _0x51da2c;var _0x34a12a;return db[_0x0788('0x47')]['findOne']({'where':{'id':_0x5d0919}})[_0x0788('0x23')](function(_0x522e02){_0x563e4c=_0x522e02;return db[_0x0788('0xcd')]['findOne']({'where':{'id':_0x522e02[_0x0788('0xa1')]},'attributes':['id',_0x0788('0xce'),_0x0788('0xcf'),_0x0788('0xd0'),_0x0788('0xd1'),_0x0788('0xd2')],'raw':!![]});})['then'](function(_0x473491){if(_0x473491&&_0x473491['vidaooApiKey']&&_0x473491[_0x0788('0xcf')]){_0x51da2c=_0x473491;var _0x1222f8={'interaction':{'id':_0x5d0919},'agent':{'id':_0x57b44e['user']['id'],'name':_0x57b44e['user']['name'],'fullname':_0x57b44e[_0x0788('0xa2')]['fullname'],'email':_0x57b44e['user']['email']},'contact':_0x57b44e['body']['contact'],'account':_0x57b44e['body'][_0x0788('0x3e')]};var _0x3c2aa3={'rejectUnauthorized':![],'method':'POST','url':_0x0788('0xd3'),'headers':{'X-APIKEY':_0x473491['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x57b44e[_0x0788('0xa2')]['email']],'buttons':null,'topic':_0x51da2c[_0x0788('0xd0')],'note':_[_0x0788('0xd4')](_0x51da2c[_0x0788('0xd1')])?null:getMustacheRender(_0x51da2c[_0x0788('0xd1')],_0x1222f8),'metadata':null},'redirect':_0x0788('0xd5'),'json':!![]};try{if(!_[_0x0788('0xd4')](_0x51da2c[_0x0788('0xd2')])){var _0x37439f=getMustacheRender(_0x51da2c[_0x0788('0xd2')],_0x1222f8);var _0xf87649=JSON['parse'](_0x37439f);_0x3c2aa3[_0x0788('0x83')]['metadata']=_0xf87649;}}catch(_0x3bd7f3){throw new db['Sequelize']['ValidationError'](_0x0788('0xd6'));}return rp(_0x3c2aa3);}else{throw new db[(_0x0788('0x9a'))][(_0x0788('0xd7'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0x0788('0x23')](function(_0x1b52f6){_0x34a12a=_0x1b52f6;if(_0x34a12a['id']){var _0x5be647={'body':_0x34a12a['join_url'],'ChatWebsiteId':_0x51da2c['id'],'ChatInteractionId':_0x563e4c['id'],'direction':_0x0788('0xd8'),'UserId':_0x57b44e[_0x0788('0xa2')]['id']};return db[_0x0788('0xd9')]['create'](_0x5be647,{});}else{throw new db['Sequelize'][(_0x0788('0xd7'))](_0x0788('0xda'));}})[_0x0788('0x23')](function(){return _0x563e4c[_0x0788('0xdb')]({'vidaooSessionId':_0x34a12a['id']});})[_0x0788('0x23')](respondWithResult(_0x191e15,null))[_0x0788('0x2b')](handleError(_0x191e15,null));};exports[_0x0788('0xdc')]=function(_0x252780,_0x3d3272){if(_0x252780['body']['id']){delete _0x252780[_0x0788('0x83')]['id'];}return db['ChatInteraction'][_0x0788('0x6f')]({'where':{'id':_0x252780[_0x0788('0xc6')]['id']},'include':[{'model':db[_0x0788('0xdd')],'as':_0x0788('0x75')}]})[_0x0788('0x23')](handleEntityNotFound(_0x3d3272,null))['then'](saveUpdates(_0x252780[_0x0788('0x83')],null))[_0x0788('0x23')](respondWithResult(_0x3d3272,null))['catch'](handleError(_0x3d3272,null));};exports[_0x0788('0xde')]=function(_0x881d27,_0x47ce3c,_0x1c9b6f){if(_0x881d27['body']['id']){delete _0x881d27[_0x0788('0x83')]['id'];}return db[_0x0788('0x47')]['find']({'where':{'id':_0x881d27[_0x0788('0xc6')]['id']}})[_0x0788('0x23')](function(_0x207b55){if(!_0x207b55){logger[_0x0788('0x27')](_0x0788('0xdf'),_0x0788('0xde'),0x194,_0x0788('0xe0'));_0x47ce3c[_0x0788('0x2c')](0x194);}else{if(_0x207b55['UserId']){throw new db[(_0x0788('0x9a'))][(_0x0788('0xd7'))](_0x0788('0xe1'));}}return _0x207b55;})['then'](function(_0x5ac0bc){if(_0x5ac0bc){return _0x5ac0bc[_0x0788('0xe2')]({'closed':_0x881d27[_0x0788('0x83')][_0x0788('0xe3')],'disposition':_0x881d27[_0x0788('0x83')][_0x0788('0xe4')]})[_0x0788('0x23')](function(_0x48e56d){return _0x48e56d;});}})[_0x0788('0x23')](function(_0x227eaf){return respondWithRpcPromise(_0x0788('0xe5'),_0x0788('0xde'),_0x881d27[_0x0788('0x83')],client9004);})[_0x0788('0x23')](respondWithResult(_0x47ce3c,null))[_0x0788('0x2b')](handleError(_0x47ce3c,null));};exports[_0x0788('0xe6')]=function(_0x1fc335,_0x27c428,_0x1ce4f2){_0x1fc335[_0x0788('0x83')][_0x0788('0x39')]=_0x1fc335[_0x0788('0xe7')][_0x0788('0xe8')];_0x1fc335[_0x0788('0x83')][_0x0788('0xe9')]=_0x1fc335[_0x0788('0xe7')][_0x0788('0xea')];_0x1fc335[_0x0788('0x83')][_0x0788('0x4a')]=_0x1fc335['file'][_0x0788('0xeb')];return db[_0x0788('0xec')][_0x0788('0xc9')](_0x1fc335[_0x0788('0x83')])['then'](respondWithResult(_0x27c428,0xc9))[_0x0788('0x2b')](handleError(_0x27c428,null));};exports[_0x0788('0xed')]=function(_0x5eb3f1,_0xb63553,_0x4a34e2){return db['ChatInteraction']['findOne']({'where':{'id':_0x5eb3f1['params']['id']},'raw':!![]})[_0x0788('0x23')](handleEntityNotFound(_0xb63553,null))[_0x0788('0x23')](function(_0x4cc536){if(_0x4cc536){if(_0x4cc536[_0x0788('0xe3')]){return _0xb63553[_0x0788('0x2d')](0x193)[_0x0788('0x2f')]({'status':0x193,'message':_0x0788('0xee')});}return db[_0x0788('0xec')][_0x0788('0xef')]({'where':{'id':_0x5eb3f1[_0x0788('0x4c')][_0x0788('0xf0')]},'raw':!![]})[_0x0788('0x23')](handleEntityNotFound(_0xb63553,null));}})['then'](function(_0x2047bc){if(_0x2047bc){var _0x38fd71=_0x2047bc['ChatOfflineMessageId']!==null;var _0x224ef9=path[_0x0788('0xf1')](config[_0x0788('0xf2')],_0x0788('0xf3'));if(_0x38fd71){_0x224ef9=path[_0x0788('0xf1')](_0x224ef9,_0x0788('0xf4'));}var _0x2399b9=path[_0x0788('0xf1')](_0x224ef9,_0x2047bc[_0x0788('0xe9')]);return _0xb63553[_0x0788('0xf5')](_0x2399b9);}})[_0x0788('0x2b')](handleError(_0xb63553,null));};exports[_0x0788('0xf6')]=function(_0x31c746,_0x4f696c){var _0x11de9c=null;var _0xf690e0=null;var _0x4a492c=null;var _0x523faa=null;if(_0x31c746[_0x0788('0x83')]['id']){delete _0x31c746[_0x0788('0x83')]['id'];}if(_0x31c746['body'][_0x0788('0xf7')]){_0x523faa=path[_0x0788('0xf1')](config[_0x0788('0xf2')],'server/files/chat/upload/',util['format'](_0x0788('0xf8'),Date[_0x0788('0xf9')]()));_0x31c746['body']['pathTranscript']=_0x523faa;}return db[_0x0788('0x47')][_0x0788('0x6f')]({'where':{'id':_0x31c746['params']['id']},'include':[{'model':db['ChatMessage'],'as':_0x0788('0xfa'),'include':[{'model':db[_0x0788('0x7f')],'as':'User'}]}]})[_0x0788('0x23')](handleEntityNotFound(_0x4f696c,null))[_0x0788('0x23')](saveUpdates(_0x31c746['body'],null))[_0x0788('0x23')](function(_0x21be45){if(_0x21be45){_0x11de9c=_0x21be45;return db[_0x0788('0xcd')][_0x0788('0x6f')]({'where':{'id':_0x11de9c[_0x0788('0xa1')]}});}})['then'](function(_0x36acad){if(_0x36acad){_0x4a492c=_0x36acad;return db[_0x0788('0xdd')][_0x0788('0x6f')]({'where':{'id':_0x11de9c[_0x0788('0x79')]}});}})[_0x0788('0x23')](function(_0x569b4d){if(_0x569b4d){_0xf690e0=_0x569b4d;if(_0x523faa){var _0x31ffc7=null;for(var _0x59aece=0x1;_0x59aece<_0x11de9c['Messages'][_0x0788('0x52')];++_0x59aece){_0x31ffc7=_0x11de9c[_0x0788('0xfa')][_0x59aece];var _0x3787d3=_0x31ffc7[_0x0788('0x81')]?util['format'](_0x0788('0xfb'),_0x4a492c[_0x0788('0xfc')],_0x31ffc7[_0x0788('0x81')]):'System';var _0x3ea229=_0x31c746[_0x0788('0x83')][_0x0788('0xfd')]||util[_0x0788('0xfe')](_0x0788('0xfb'),'Visitor',_0x31ffc7[_0x0788('0x79')]);switch(_0x4a492c['agentIdentifier']){case _0x0788('0xff'):_0x3787d3=_0x31ffc7[_0x0788('0x81')]?util[_0x0788('0xfe')](_0x0788('0xfb'),_0x4a492c[_0x0788('0xfc')],_0x31ffc7['UserId']):_0x0788('0x100');break;case'agent_alias':_0x3787d3=_0x31ffc7[_0x0788('0x81')]?_0x31ffc7['User'][_0x0788('0x101')]||_0x31ffc7[_0x0788('0x7f')]['fullname']:_0x0788('0x100');break;case _0x0788('0x102'):_0x3787d3=_0x31ffc7[_0x0788('0x81')]?_0x31ffc7[_0x0788('0x7f')][_0x0788('0x3f')]:_0x0788('0x100');break;default:_0x3787d3=_0x31ffc7[_0x0788('0x81')]?util[_0x0788('0xfe')](_0x0788('0xfb'),_0x4a492c[_0x0788('0xfc')],_0x31ffc7[_0x0788('0x81')]):'System';}var _0x303d5=util['format'](_0x0788('0x103'),moment(_0x31ffc7['createdAt'])[_0x0788('0xfe')](_0x0788('0x104')),_0x31ffc7['direction']==='in'?_0x3ea229:_0x3787d3,_0x31ffc7['body']);if(!_0x31ffc7['secret']){fs[_0x0788('0x105')](_0x523faa,_0x303d5);}}return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x0788('0x106')],'as':_0x0788('0x107'),'raw':!![]}]});}}})[_0x0788('0x23')](function(_0x5c5464){if(_0x5c5464&&_0x5c5464[_0x0788('0x107')]&&_0x31c746[_0x0788('0x83')]){var _0x14420b={'tls':{'rejectUnauthorized':![]}};if(_0x5c5464['Smtp']['service']){_0x14420b[_0x0788('0x108')]=_0x5c5464[_0x0788('0x107')][_0x0788('0x108')];}else{_0x14420b['host']=_0x5c5464[_0x0788('0x107')][_0x0788('0x109')];_0x14420b[_0x0788('0x10a')]=_0x5c5464['Smtp']['port'];_0x14420b[_0x0788('0x10b')]=_0x5c5464['Smtp'][_0x0788('0x10b')];}if(_0x5c5464[_0x0788('0x107')]['authentication']){_0x14420b['auth']={'user':_0x5c5464[_0x0788('0x107')][_0x0788('0xa2')],'pass':_0x5c5464['Smtp'][_0x0788('0x10c')]};}return respondWithRpcPromise(_0x0788('0x10d'),'sendMail',{'account':_0x14420b,'message':{'from':util[_0x0788('0xfe')](_0x0788('0x10e'),_0x5c5464[_0x0788('0x39')],_0x5c5464[_0x0788('0x10f')]||_0x5c5464['Smtp'][_0x0788('0xa2')]),'to':_0x31c746[_0x0788('0x83')][_0x0788('0xf7')],'subject':_0x0788('0x110'),'text':util[_0x0788('0xfe')](_0x0788('0x111'),_0x31c746[_0x0788('0x83')][_0x0788('0xf7')]),'attachments':[{'path':_0x523faa}]}})[_0x0788('0x23')](function(){return _0x11de9c;})['catch'](function(_0x1b5b80){console[_0x0788('0x27')](_0x1b5b80);});}else{return _0x11de9c;}})['then'](respondWithStatusCode(_0x4f696c,0xc8))[_0x0788('0x2b')](handleError(_0x4f696c,null));};exports[_0x0788('0x112')]=function(_0x5522e3,_0x5f1a46,_0x248f60){return db[_0x0788('0xd9')][_0x0788('0x6f')]({'where':{'id':_0x5522e3['params']['id']}})[_0x0788('0x23')](handleEntityNotFound(_0x5f1a46,null))[_0x0788('0x23')](function(_0x36d7f9){if(_0x36d7f9){return _0x36d7f9['addMessage'](_0x5522e3[_0x0788('0x83')][_0x0788('0x113')],_['omit'](_0x5522e3['body'],['ids','id'])||{});}})[_0x0788('0x23')](respondWithResult(_0x5f1a46,null))[_0x0788('0x2b')](handleError(_0x5f1a46,null));};exports[_0x0788('0x114')]=function(_0x20f429,_0x364f26,_0x351665){var _0x1ba9fb={'raw':![],'where':{}};var _0x56b11c={};var _0x4f36bd={'count':0x0,'rows':[]};return db[_0x0788('0x47')][_0x0788('0xef')]({'where':{'id':_0x20f429[_0x0788('0xc6')]['id']}})['then'](handleEntityNotFound(_0x364f26,null))[_0x0788('0x23')](function(_0x1c7980){if(_0x1c7980){_0x56b11c[_0x0788('0x4f')]=_[_0x0788('0x4b')](db['ChatMessage']['rawAttributes']);_0x56b11c[_0x0788('0x4c')]=_[_0x0788('0x4b')](_0x20f429[_0x0788('0x4c')]);_0x56b11c[_0x0788('0x4d')]=_[_0x0788('0x4e')](_0x56b11c[_0x0788('0x4f')],_0x56b11c[_0x0788('0x4c')]);_0x1ba9fb[_0x0788('0x50')]=_[_0x0788('0x4e')](_0x56b11c['model'],qs[_0x0788('0x51')](_0x20f429[_0x0788('0x4c')][_0x0788('0x51')]));_0x1ba9fb[_0x0788('0x50')]=_0x1ba9fb[_0x0788('0x50')][_0x0788('0x52')]?_0x1ba9fb[_0x0788('0x50')]:_0x56b11c['model'];if(!_0x20f429[_0x0788('0x4c')][_0x0788('0x53')](_0x0788('0x115'))){_0x1ba9fb['limit']=qs[_0x0788('0x30')](_0x20f429[_0x0788('0x4c')][_0x0788('0x30')]);_0x1ba9fb[_0x0788('0x33')]=qs[_0x0788('0x33')](_0x20f429['query']['offset']);}_0x1ba9fb['order']=qs[_0x0788('0x55')](_0x20f429[_0x0788('0x4c')][_0x0788('0x55')]);_0x1ba9fb[_0x0788('0x56')]=qs[_0x0788('0x4d')](_[_0x0788('0x116')](_0x20f429[_0x0788('0x4c')],_0x56b11c['filters']));_0x1ba9fb[_0x0788('0x56')][_0x0788('0xc2')]=_0x1c7980['id'];if(_0x20f429[_0x0788('0x4c')][_0x0788('0x93')]){_0x1ba9fb['where']=_[_0x0788('0x3b')](_0x1ba9fb[_0x0788('0x56')],{'$or':_[_0x0788('0x46')](_0x1ba9fb[_0x0788('0x50')],function(_0xccb2e6){var _0x4cc769={};_0x4cc769[_0xccb2e6]={'$like':'%'+_0x20f429[_0x0788('0x4c')][_0x0788('0x93')]+'%'};return _0x4cc769;})});}if(_0x20f429[_0x0788('0x4c')][_0x0788('0x89')]){var _0x4785ac=_0x20f429[_0x0788('0x4c')][_0x0788('0x89')][_0x0788('0x42')](',');var _0x4455dc={};_0x4455dc[_0x4785ac[0x0]]={'$gte':moment(_0x4785ac[0x1])['format'](_0x0788('0x117'))};_0x1ba9fb['where']=_[_0x0788('0x3b')](_0x1ba9fb[_0x0788('0x56')],_0x4455dc);}_0x1ba9fb=_[_0x0788('0x3b')]({},_0x1ba9fb,_0x20f429[_0x0788('0xc8')]);return db[_0x0788('0xd9')][_0x0788('0x32')]({'where':_0x1ba9fb[_0x0788('0x56')]})['then'](function(_0x3eb474){_0x4f36bd[_0x0788('0x32')]=_0x3eb474;if(_0x20f429['query'][_0x0788('0x118')]){_0x1ba9fb[_0x0788('0xc7')]=[{'all':!![]}];}return db[_0x0788('0xd9')]['findAll'](_0x1ba9fb);})['then'](function(_0x1aa86f){_0x4f36bd[_0x0788('0xc4')]=_0x1aa86f;return _0x4f36bd;});}})['then'](respondWithFilteredResult(_0x364f26,_0x1ba9fb))['catch'](handleError(_0x364f26,null));};exports[_0x0788('0x119')]=function(_0x4d6a60,_0x114658,_0x4b11b9){var _0x9af662={'where':{}},_0x257e1c={},_0x35a6bc={'count':0x0,'rows':[]};return db[_0x0788('0x47')]['findOne']({'where':{'id':_0x4d6a60['params']['id']}})[_0x0788('0x23')](handleEntityNotFound(_0x114658,null))[_0x0788('0x23')](function(_0x278a6f){if(_0x278a6f){_0x257e1c[_0x0788('0x4f')]=_['keys'](db[_0x0788('0xd9')][_0x0788('0x48')]);_0x257e1c[_0x0788('0x4c')]=_[_0x0788('0x4b')](_0x4d6a60['query']);_0x257e1c[_0x0788('0x4d')]=_[_0x0788('0x4e')](_0x257e1c['model'],_0x257e1c[_0x0788('0x4c')]);_0x9af662[_0x0788('0x50')]=_[_0x0788('0x4e')](_0x257e1c[_0x0788('0x4f')],qs[_0x0788('0x51')](_0x4d6a60[_0x0788('0x4c')]['fields']));_0x9af662[_0x0788('0x50')]=_0x9af662[_0x0788('0x50')][_0x0788('0x52')]?_0x9af662[_0x0788('0x50')]:_0x257e1c['model'];if(!_0x4d6a60[_0x0788('0x4c')]['hasOwnProperty'](_0x0788('0x115'))){_0x9af662['limit']=qs['limit'](_0x4d6a60[_0x0788('0x4c')][_0x0788('0x30')]);_0x9af662[_0x0788('0x33')]=qs[_0x0788('0x33')](_0x4d6a60[_0x0788('0x4c')][_0x0788('0x33')]);}_0x9af662[_0x0788('0x54')]=qs[_0x0788('0x55')](_0x4d6a60[_0x0788('0x4c')][_0x0788('0x55')]);_0x9af662['where']=qs['filters'](_['pick'](_0x4d6a60[_0x0788('0x4c')],_0x257e1c[_0x0788('0x4d')]));_0x9af662[_0x0788('0x56')][_0x0788('0xc2')]=_0x278a6f['id'];if(_0x4d6a60[_0x0788('0x4c')][_0x0788('0x93')]){_0x9af662[_0x0788('0x56')]=_[_0x0788('0x3b')](_0x9af662['where'],{'$or':_[_0x0788('0x46')](_0x9af662[_0x0788('0x50')],function(_0x4a4297){var _0x1fb846={};_0x1fb846[_0x4a4297]={'$like':'%'+_0x4d6a60[_0x0788('0x4c')][_0x0788('0x93')]+'%'};return _0x1fb846;})});}_0x9af662['where'][_0x0788('0x11a')]=![];if(_0x4d6a60[_0x0788('0x4c')]['id']){_0x9af662[_0x0788('0x56')]['id']={'$gt':_0x4d6a60[_0x0788('0x4c')]['id']};}_0x9af662=_[_0x0788('0x3b')]({},_0x9af662,_0x4d6a60[_0x0788('0xc8')]);return db[_0x0788('0xd9')][_0x0788('0x32')]({'where':_0x9af662[_0x0788('0x56')]})[_0x0788('0x23')](function(_0x292d07){_0x35a6bc[_0x0788('0x32')]=_0x292d07;_0x9af662[_0x0788('0xc7')]=[];if(_0x4d6a60[_0x0788('0x4c')][_0x0788('0x11b')]){_0x9af662['include'][_0x0788('0x44')]({'model':db[_0x0788('0x7f')],'as':_0x0788('0x7f'),'attributes':['id','fullname',_0x0788('0x101')]});}if(_0x4d6a60[_0x0788('0x4c')][_0x0788('0x118')]){_0x9af662['include']=[{'all':!![]}];}return db[_0x0788('0xd9')][_0x0788('0x11c')](_0x9af662);})['then'](function(_0xa44dc3){_0x35a6bc[_0x0788('0xc4')]=_0xa44dc3;return _0x35a6bc;});}})[_0x0788('0x23')](respondWithFilteredResult(_0x114658,_0x9af662))['catch'](handleError(_0x114658,null));};exports[_0x0788('0x11d')]=function(_0x5b0417,_0x4d5e94,_0x1fb141){return db[_0x0788('0x47')][_0x0788('0x6f')]({'where':{'id':_0x5b0417[_0x0788('0xc6')]['id']}})['then'](handleEntityNotFound(_0x4d5e94,null))[_0x0788('0x23')](function(_0x5bf415){if(_0x5bf415){return _0x5bf415['setTags'](_0x5b0417['body'][_0x0788('0x113')],_['omit'](_0x5b0417['body'],['ids','id'])||{})[_0x0788('0x11e')](function(){return db[_0x0788('0x7c')][_0x0788('0x11c')]({'attributes':['id',_0x0788('0x39'),_0x0788('0x59')],'where':{'id':_0x5b0417[_0x0788('0x83')][_0x0788('0x113')]}});})[_0x0788('0x23')](function(_0x109d90){socket[_0x0788('0x11f')](_0x0788('0x120'),{'id':Number(_0x5b0417[_0x0788('0xc6')]['id']),'tags':_0x109d90||[]});return{'id':Number(_0x5b0417[_0x0788('0xc6')]['id']),'tags':_0x109d90||[]};});}})['then'](respondWithResult(_0x4d5e94,null))[_0x0788('0x2b')](handleError(_0x4d5e94,null));};exports['removeTags']=function(_0x26343c,_0x30334c,_0x1d18bc){return db[_0x0788('0x47')][_0x0788('0x6f')]({'where':{'id':_0x26343c[_0x0788('0xc6')]['id']}})['then'](handleEntityNotFound(_0x30334c,null))[_0x0788('0x23')](function(_0x10266b){if(_0x10266b){return _0x10266b[_0x0788('0x121')](_0x26343c[_0x0788('0x4c')][_0x0788('0x113')]);}})[_0x0788('0x23')](respondWithStatusCode(_0x30334c,null))['catch'](handleError(_0x30334c,null));};exports['download']=function(_0x1fb76f,_0x17ca71){var _0xbae24f=moment()[_0x0788('0x122')]()[_0x0788('0xa9')]();var _0x525754=path['join'](config['root'],_0x0788('0x123'),_0x0788('0x124'),_0x0788('0x125'));var _0x2d51ef=path[_0x0788('0xf1')](config[_0x0788('0xf2')],_0x0788('0x123'),_0x0788('0x124'),_0x0788('0x126'));var _0x5ecd59=path['join'](_0x525754,_0xbae24f);var _0xf63471=util[_0x0788('0xfe')](_0x0788('0x127'),_0x1fb76f[_0x0788('0xc6')]['id'],_0xbae24f);var _0x390cdf=path[_0x0788('0xf1')](_0x525754,_0xf63471);var _0x40a75d=[];_0x40a75d[_0x0788('0x44')]({'model':db[_0x0788('0x7f')],'as':_0x0788('0x7f'),'attributes':['id',_0x0788('0x3f')],'raw':!![]});_0x40a75d[_0x0788('0x44')]({'model':db[_0x0788('0xdd')],'as':'Contact','attributes':['id',_0x0788('0x128'),_0x0788('0x129')],'raw':!![]});if(_0x1fb76f[_0x0788('0x4c')][_0x0788('0x126')]){_0x40a75d[_0x0788('0x44')]({'model':db[_0x0788('0xec')],'as':_0x0788('0xec'),'raw':!![]});}var _0x4cf323=[{'model':db[_0x0788('0xd9')],'as':_0x0788('0xfa'),'attributes':['id','body',_0x0788('0x87'),'direction',_0x0788('0x11a'),_0x0788('0x8f')],'include':_0x40a75d}];_0x4cf323['push']({'model':db[_0x0788('0xcd')],'as':'Account','attributes':['id',_0x0788('0x39')]});_0x4cf323[_0x0788('0x44')]({'model':db[_0x0788('0x7f')],'as':_0x0788('0x12a'),'attributes':['id',_0x0788('0x3f')]});return db['ChatInteraction'][_0x0788('0x6f')]({'where':{'id':_0x1fb76f['params']['id']},'include':_0x4cf323})['then'](handleEntityNotFound(_0x17ca71,null))[_0x0788('0x23')](function(_0x1fa39f){if(_0x1fa39f){var _0x19b030=_0x1fa39f[_0x0788('0x12b')]({'plain':!![]});fs[_0x0788('0x12c')](_0x5ecd59);var _0x35fc5b={'channel':'Chat','account':_0x19b030[_0x0788('0x12d')]['name'],'agent':_0x19b030[_0x0788('0x12a')]?_0x19b030[_0x0788('0x12a')][_0x0788('0x3f')]:'N.A.','createdAt':moment(_0x19b030['createdAt'])[_0x0788('0xfe')](_0x0788('0x117'))['toString'](),'closedAt':_0x19b030[_0x0788('0xe3')]?moment(_0x19b030[_0x0788('0x12e')])[_0x0788('0xfe')](_0x0788('0x117'))[_0x0788('0xa9')]():'','disposition':_0x19b030[_0x0788('0xe4')],'chatInfo':{'browser':_0x19b030[_0x0788('0x12f')],'os':_0x19b030['osName'],'referer':_0x19b030['referer'],'customerIp':_0x19b030['customerIp'],'customerPort':_0x19b030[_0x0788('0x130')]?_0x19b030['customerPort']:_0x0788('0x131')},'messages':_(_0x19b030[_0x0788('0xfa')])[_0x0788('0x132')]()[_0x0788('0x93')]({'secret':![]})[_0x0788('0x46')](function(_0x3ff416){if(_0x3ff416[_0x0788('0xec')]){var _0x7d6cf9=path[_0x0788('0xf1')](_0x2d51ef,_0x3ff416[_0x0788('0xec')][_0x0788('0xe9')]);if(fs['existsSync'](_0x7d6cf9)){fs[_0x0788('0x133')](_0x7d6cf9)['pipe'](fs[_0x0788('0x134')](path[_0x0788('0xf1')](_0x5ecd59,_0x3ff416[_0x0788('0xec')][_0x0788('0xe9')])));}}return{'date':moment(_0x3ff416[_0x0788('0x87')])[_0x0788('0xfe')](_0x0788('0x117'))[_0x0788('0xa9')](),'sender':_0x3ff416[_0x0788('0x135')]===_0x0788('0xd8')?_0x3ff416['User']?_0x3ff416[_0x0788('0x7f')][_0x0788('0x3f')]:_0x0788('0x100'):_0x3ff416[_0x0788('0x75')]['firstName']+(_0x3ff416[_0x0788('0x75')][_0x0788('0x129')]?'\x20'+_0x3ff416['Contact'][_0x0788('0x129')]:''),'body':_0x3ff416['Attachment']?_0x3ff416[_0x0788('0xec')]['basename']:_0x3ff416[_0x0788('0x83')],'direction':_0x3ff416[_0x0788('0x135')]===_0x0788('0xd8')?'A':'C','secret':_0x3ff416['secret'],'read':_0x3ff416[_0x0788('0x8f')],'attachment':_0x3ff416['Attachment']};})[_0x0788('0x71')]()};return ejs[_0x0788('0x136')](path[_0x0788('0xf1')](config[_0x0788('0xf2')],'server','views',_0x0788('0x137')),{'interaction':_0x35fc5b})['then'](function(_0x45962d){var _0x4cc133=path[_0x0788('0xf1')](_0x5ecd59,_0x0788('0x138')+_0x19b030['id']+'-'+_0xbae24f+_0x0788('0x139'));var _0x52452f={'path':_0x4cc133,'channel':_0x0788('0x13a'),'interactionId':_0x19b030['id']};return pdf[_0x0788('0x13b')](_0x45962d,_0x52452f);})[_0x0788('0x23')](function(){return new BPromise(function(_0xe2d72d,_0x5401a8){zipdir(_0x5ecd59,{'saveTo':_0x390cdf},function(_0x5b289e,_0x4191b4){if(_0x5b289e)return _0x5401a8(_0x5b289e);return _0xe2d72d(_0x4191b4);});})[_0x0788('0x23')](function(){return new BPromise(function(_0x5440c6,_0x2dbb74){rimraf(_0x5ecd59,function(_0x8a89c0){if(_0x8a89c0)_0x2dbb74(_0x8a89c0);return _0x5440c6();});});})['then'](function(){return _0x17ca71['download'](_0x390cdf,_0xf63471,function(_0x2487db){if(_0x2487db){console['log'](_0x0788('0x13c'),_0x2487db);}else{fs[_0x0788('0x13d')](_0x390cdf);}});});});}else{return _0x17ca71[_0x0788('0x2c')](0xc8);}})['catch'](handleError(_0x17ca71,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 243fce2..ef342e0 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 _0xca31=['save','update','remove','getUsers','then','setDataValue','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','ChatMessage','setMaxListeners'];(function(_0x56f552,_0x374061){var _0x21a33a=function(_0x38a83d){while(--_0x38a83d){_0x56f552['push'](_0x56f552['shift']());}};_0x21a33a(++_0x374061);}(_0xca31,0xd5));var _0x1ca3=function(_0x129259,_0x3c39ec){_0x129259=_0x129259-0x0;var _0x110f34=_0xca31[_0x129259];return _0x110f34;};'use strict';var EventEmitter=require(_0x1ca3('0x0'));var ChatInteraction=require('../../mysqldb')['db']['ChatInteraction'];var ChatMessage=require('../../mysqldb')['db'][_0x1ca3('0x1')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x1ca3('0x2')](0x0);var events={'afterCreate':_0x1ca3('0x3'),'afterUpdate':_0x1ca3('0x4'),'afterDestroy':_0x1ca3('0x5')};function emitEvent(_0x75f7a3){return function(_0x341fae,_0x4e3bbc,_0x4df219){_0x341fae[_0x1ca3('0x6')]({'attributes':['id'],'raw':!![]})[_0x1ca3('0x7')](function(_0x4f131e){_0x341fae[_0x1ca3('0x8')]('Users',_0x4f131e[_0x1ca3('0x9')](function(_0x158da0){return{'id':_0x158da0['id']};}));return ChatMessage[_0x1ca3('0xa')]({'where':{'ChatInteractionId':_0x341fae['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1ca3('0x7')](function(_0x39469b){_0x341fae[_0x1ca3('0x8')](_0x1ca3('0xb'),_0x39469b[_0x1ca3('0xc')]);ChatInteractionEvents[_0x1ca3('0xd')](_0x75f7a3+':'+_0x341fae['id'],_0x341fae);ChatInteractionEvents[_0x1ca3('0xd')](_0x75f7a3,_0x341fae);_0x4df219(null);})[_0x1ca3('0xe')](_0x4df219(null));};}for(var e in events){if(events[_0x1ca3('0xf')](e)){var event=events[e];ChatInteraction[_0x1ca3('0x10')](e,emitEvent(event));}}module[_0x1ca3('0x11')]=ChatInteractionEvents; \ No newline at end of file +var _0x8339=['map','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','update','remove','then','setDataValue','Users'];(function(_0x16d3a4,_0xfcd64b){var _0xbd7a0c=function(_0xa0c4f7){while(--_0xa0c4f7){_0x16d3a4['push'](_0x16d3a4['shift']());}};_0xbd7a0c(++_0xfcd64b);}(_0x8339,0x1e3));var _0x9833=function(_0x22b368,_0xb71c40){_0x22b368=_0x22b368-0x0;var _0x161d41=_0x8339[_0x22b368];return _0x161d41;};'use strict';var EventEmitter=require(_0x9833('0x0'));var ChatInteraction=require(_0x9833('0x1'))['db'][_0x9833('0x2')];var ChatMessage=require(_0x9833('0x1'))['db'][_0x9833('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x9833('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9833('0x5'),'afterDestroy':_0x9833('0x6')};function emitEvent(_0x533619){return function(_0x30f75e,_0x3e3c36,_0x43449c){_0x30f75e['getUsers']({'attributes':['id'],'raw':!![]})[_0x9833('0x7')](function(_0x3bcd01){_0x30f75e[_0x9833('0x8')](_0x9833('0x9'),_0x3bcd01[_0x9833('0xa')](function(_0x287040){return{'id':_0x287040['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x30f75e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9833('0x7')](function(_0x895df1){_0x30f75e[_0x9833('0x8')](_0x9833('0xb'),_0x895df1[_0x9833('0xc')]);ChatInteractionEvents[_0x9833('0xd')](_0x533619+':'+_0x30f75e['id'],_0x30f75e);ChatInteractionEvents['emit'](_0x533619,_0x30f75e);_0x43449c(null);})[_0x9833('0xe')](_0x43449c(null));};}for(var e in events){if(events[_0x9833('0xf')](e)){var event=events[e];ChatInteraction[_0x9833('0x10')](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 ac984a7..cc18c10 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 _0xec4f=['closedAt','format','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','closed'];(function(_0x1962a7,_0x14784d){var _0x2a7571=function(_0x278c1d){while(--_0x278c1d){_0x1962a7['push'](_0x1962a7['shift']());}};_0x2a7571(++_0x14784d);}(_0xec4f,0x1cc));var _0xfec4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xec4f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfec4('0x0'));var util=require(_0xfec4('0x1'));var logger=require(_0xfec4('0x2'))('api');var moment=require(_0xfec4('0x3'));var BPromise=require(_0xfec4('0x4'));var rp=require(_0xfec4('0x5'));var fs=require('fs');var path=require(_0xfec4('0x6'));var rimraf=require(_0xfec4('0x7'));var config=require(_0xfec4('0x8'));var attributes=require(_0xfec4('0x9'));module[_0xfec4('0xa')]=function(_0xc2a126,_0x256c15){return _0xc2a126[_0xfec4('0xb')](_0xfec4('0xc'),attributes,{'tableName':_0xfec4('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5fea63,_0x404b37,_0x162402){if(_0x5fea63['changed'](_0xfec4('0xe'))){_0x5fea63[_0xfec4('0xf')]=moment()[_0xfec4('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x162402(null,_0x5fea63);}},'charset':_0xfec4('0x11'),'collate':_0xfec4('0x12')});}; \ No newline at end of file +var _0xc50c=['../../config/environment','exports','define','ChatInteraction','chat_interactions','closed','closedAt','format','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x4ba508,_0x5244a5){var _0x45db96=function(_0x3a50b9){while(--_0x3a50b9){_0x4ba508['push'](_0x4ba508['shift']());}};_0x45db96(++_0x5244a5);}(_0xc50c,0x70));var _0xcc50=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0xc50c[_0x1589dd];return _0x1bddd1;};'use strict';var _=require(_0xcc50('0x0'));var util=require(_0xcc50('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcc50('0x2'));var BPromise=require(_0xcc50('0x3'));var rp=require(_0xcc50('0x4'));var fs=require('fs');var path=require(_0xcc50('0x5'));var rimraf=require(_0xcc50('0x6'));var config=require(_0xcc50('0x7'));var attributes=require('./chatInteraction.attributes');module[_0xcc50('0x8')]=function(_0x1d4afd,_0x426bbb){return _0x1d4afd[_0xcc50('0x9')](_0xcc50('0xa'),attributes,{'tableName':_0xcc50('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1dc72b,_0x181310,_0x1f853e){if(_0x1dc72b['changed'](_0xcc50('0xc'))){_0x1dc72b[_0xcc50('0xd')]=moment()[_0xcc50('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1f853e(null,_0x1dc72b);}},'charset':_0xcc50('0xf'),'collate':_0xcc50('0x10')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 8570ef2..71c8724 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 _0xc8f8=['find','then','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','socket.io-emitter','redis','register','request','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','AddTagsToChatInteraction'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xc8f8,0xcf));var _0x8c8f=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0xc8f8[_0x500419];return _0x241c1a;};'use strict';var _=require(_0x8c8f('0x0'));var util=require('util');var moment=require(_0x8c8f('0x1'));var BPromise=require(_0x8c8f('0x2'));var rs=require(_0x8c8f('0x3'));var fs=require('fs');var Redis=require(_0x8c8f('0x4'));var db=require(_0x8c8f('0x5'))['db'];var utils=require(_0x8c8f('0x6'));var logger=require(_0x8c8f('0x7'))(_0x8c8f('0x8'));var config=require(_0x8c8f('0x9'));var jayson=require(_0x8c8f('0xa'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x8c8f('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8c8f('0xc'))(new Redis(config[_0x8c8f('0xd')]));require('./chatInteraction.socket')[_0x8c8f('0xe')](socket);function respondWithRpcPromise(_0x36e20a,_0x4c35e4,_0x1b1391){return new BPromise(function(_0x20eca8,_0x279527){return client[_0x8c8f('0xf')](_0x36e20a,_0x1b1391)['then'](function(_0xbf8cad){logger[_0x8c8f('0x10')](_0x8c8f('0x11'),_0x4c35e4,'request\x20sent');logger[_0x8c8f('0x12')](_0x8c8f('0x13'),_0x4c35e4,'request\x20sent',JSON[_0x8c8f('0x14')](_0xbf8cad));if(_0xbf8cad['error']){if(_0xbf8cad[_0x8c8f('0x15')]['code']===0x1f4){logger['error'](_0x8c8f('0x11'),_0x4c35e4,_0xbf8cad['error'][_0x8c8f('0x16')]);return _0x279527(_0xbf8cad['error'][_0x8c8f('0x16')]);}logger[_0x8c8f('0x15')](_0x8c8f('0x11'),_0x4c35e4,_0xbf8cad[_0x8c8f('0x15')][_0x8c8f('0x16')]);return _0x20eca8(_0xbf8cad[_0x8c8f('0x15')][_0x8c8f('0x16')]);}else{logger['info'](_0x8c8f('0x11'),_0x4c35e4,_0x8c8f('0x17'));_0x20eca8(_0xbf8cad['result'][_0x8c8f('0x16')]);}})[_0x8c8f('0x18')](function(_0x2903fc){logger[_0x8c8f('0x15')](_0x8c8f('0x11'),_0x4c35e4,_0x2903fc);_0x279527(_0x2903fc);});});}exports[_0x8c8f('0x19')]=function(_0x2f09fd){var _0x131d06=this;return new Promise(function(_0x6afd41,_0x36bb19){return db[_0x8c8f('0x1a')][_0x8c8f('0x1b')](_0x2f09fd[_0x8c8f('0x1c')],{'raw':_0x2f09fd[_0x8c8f('0x1d')]?_0x2f09fd['options'][_0x8c8f('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f09fd[_0x8c8f('0x1d')]?_0x2f09fd[_0x8c8f('0x1d')][_0x8c8f('0x1f')]||null:null,'attributes':_0x2f09fd[_0x8c8f('0x1d')]?_0x2f09fd[_0x8c8f('0x1d')]['attributes']||null:null,'limit':_0x2f09fd[_0x8c8f('0x1d')]?_0x2f09fd['options']['limit']||null:null})['then'](function(_0x274e25){logger[_0x8c8f('0x10')](_0x8c8f('0x19'),_0x2f09fd);logger[_0x8c8f('0x12')]('UpdateChatInteraction',_0x2f09fd,JSON[_0x8c8f('0x14')](_0x274e25));_0x6afd41(_0x274e25);})[_0x8c8f('0x18')](function(_0x2270f9){logger[_0x8c8f('0x15')](_0x8c8f('0x19'),_0x2270f9['message'],_0x2f09fd);_0x36bb19(_0x131d06[_0x8c8f('0x15')](0x1f4,_0x2270f9['message']));});});};exports[_0x8c8f('0x20')]=function(_0x41e386){return new Promise(function(_0xc5bed1,_0x321144){return db[_0x8c8f('0x1a')][_0x8c8f('0x21')]({'where':_0x41e386[_0x8c8f('0x1d')]?_0x41e386[_0x8c8f('0x1d')][_0x8c8f('0x1f')]||null:null})[_0x8c8f('0x22')](function(_0x1f8cd8){if(_0x1f8cd8){return _0x1f8cd8[_0x8c8f('0x23')](_0x41e386[_0x8c8f('0x1c')][_0x8c8f('0x24')],_[_0x8c8f('0x25')](_0x41e386[_0x8c8f('0x1c')],[_0x8c8f('0x24'),'id'])||{});}})[_0x8c8f('0x26')](function(_0x2f825b){logger[_0x8c8f('0x10')](_0x8c8f('0x27'),_0x41e386);logger[_0x8c8f('0x12')](_0x8c8f('0x27'),_0x41e386,JSON[_0x8c8f('0x14')](_0x2f825b));_0xc5bed1(_0x2f825b);})['catch'](function(_0x2c8630){logger[_0x8c8f('0x15')](_0x8c8f('0x27'),_0x2c8630[_0x8c8f('0x16')],_0x41e386);_0x321144(_this[_0x8c8f('0x15')](0x1f4,_0x2c8630[_0x8c8f('0x16')]));});});}; \ No newline at end of file +var _0x2b8f=['UpdateChatInteraction','ChatInteraction','update','body','options','where','limit','AddTagsToChatInteraction','ids','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','jayson/promise','client','http','redis','localhost','./chatInteraction.socket','register','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x1e235e,_0x994b77){var _0x1e8e94=function(_0x4a9e2c){while(--_0x4a9e2c){_0x1e235e['push'](_0x1e235e['shift']());}};_0x1e8e94(++_0x994b77);}(_0x2b8f,0x1bb));var _0xf2b8=function(_0x2d8fb9,_0x519390){_0x2d8fb9=_0x2d8fb9-0x0;var _0x42475e=_0x2b8f[_0x2d8fb9];return _0x42475e;};'use strict';var _=require(_0xf2b8('0x0'));var util=require(_0xf2b8('0x1'));var moment=require(_0xf2b8('0x2'));var BPromise=require('bluebird');var rs=require(_0xf2b8('0x3'));var fs=require('fs');var Redis=require(_0xf2b8('0x4'));var db=require(_0xf2b8('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xf2b8('0x6'));var client=jayson[_0xf2b8('0x7')][_0xf2b8('0x8')]({'port':0x232a});config[_0xf2b8('0x9')]=_['defaults'](config[_0xf2b8('0x9')],{'host':_0xf2b8('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf2b8('0x9')]));require(_0xf2b8('0xb'))[_0xf2b8('0xc')](socket);function respondWithRpcPromise(_0x2e3772,_0x5d6556,_0x805ee){return new BPromise(function(_0x847219,_0x4b19a1){return client['request'](_0x2e3772,_0x805ee)[_0xf2b8('0xd')](function(_0x418d81){logger[_0xf2b8('0xe')](_0xf2b8('0xf'),_0x5d6556,_0xf2b8('0x10'));logger[_0xf2b8('0x11')](_0xf2b8('0x12'),_0x5d6556,_0xf2b8('0x10'),JSON[_0xf2b8('0x13')](_0x418d81));if(_0x418d81['error']){if(_0x418d81[_0xf2b8('0x14')][_0xf2b8('0x15')]===0x1f4){logger['error'](_0xf2b8('0xf'),_0x5d6556,_0x418d81[_0xf2b8('0x14')]['message']);return _0x4b19a1(_0x418d81['error'][_0xf2b8('0x16')]);}logger[_0xf2b8('0x14')](_0xf2b8('0xf'),_0x5d6556,_0x418d81['error'][_0xf2b8('0x16')]);return _0x847219(_0x418d81['error'][_0xf2b8('0x16')]);}else{logger[_0xf2b8('0xe')](_0xf2b8('0xf'),_0x5d6556,_0xf2b8('0x10'));_0x847219(_0x418d81[_0xf2b8('0x17')]['message']);}})[_0xf2b8('0x18')](function(_0x325699){logger[_0xf2b8('0x14')]('ChatInteraction,\x20%s,\x20%s',_0x5d6556,_0x325699);_0x4b19a1(_0x325699);});});}exports[_0xf2b8('0x19')]=function(_0x3fb404){var _0x175c59=this;return new Promise(function(_0x229a87,_0x3f0b05){return db[_0xf2b8('0x1a')][_0xf2b8('0x1b')](_0x3fb404[_0xf2b8('0x1c')],{'raw':_0x3fb404[_0xf2b8('0x1d')]?_0x3fb404[_0xf2b8('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fb404['options']?_0x3fb404[_0xf2b8('0x1d')][_0xf2b8('0x1e')]||null:null,'attributes':_0x3fb404[_0xf2b8('0x1d')]?_0x3fb404['options']['attributes']||null:null,'limit':_0x3fb404[_0xf2b8('0x1d')]?_0x3fb404[_0xf2b8('0x1d')][_0xf2b8('0x1f')]||null:null})['then'](function(_0x3ef13a){logger[_0xf2b8('0xe')](_0xf2b8('0x19'),_0x3fb404);logger[_0xf2b8('0x11')](_0xf2b8('0x19'),_0x3fb404,JSON[_0xf2b8('0x13')](_0x3ef13a));_0x229a87(_0x3ef13a);})['catch'](function(_0xa5b4dd){logger[_0xf2b8('0x14')](_0xf2b8('0x19'),_0xa5b4dd[_0xf2b8('0x16')],_0x3fb404);_0x3f0b05(_0x175c59[_0xf2b8('0x14')](0x1f4,_0xa5b4dd[_0xf2b8('0x16')]));});});};exports[_0xf2b8('0x20')]=function(_0x1fc478){return new Promise(function(_0x552d2b,_0x2b32ae){return db[_0xf2b8('0x1a')]['find']({'where':_0x1fc478['options']?_0x1fc478[_0xf2b8('0x1d')][_0xf2b8('0x1e')]||null:null})[_0xf2b8('0xd')](function(_0x18579f){if(_0x18579f){return _0x18579f['addTags'](_0x1fc478[_0xf2b8('0x1c')][_0xf2b8('0x21')],_['omit'](_0x1fc478['body'],['ids','id'])||{});}})[_0xf2b8('0x22')](function(_0x3ad876){logger[_0xf2b8('0xe')]('AddTags',_0x1fc478);logger['debug'](_0xf2b8('0x23'),_0x1fc478,JSON[_0xf2b8('0x13')](_0x3ad876));_0x552d2b(_0x3ad876);})[_0xf2b8('0x18')](function(_0x2505d6){logger[_0xf2b8('0x14')](_0xf2b8('0x23'),_0x2505d6['message'],_0x1fc478);_0x2b32ae(_this[_0xf2b8('0x14')](0x1f4,_0x2505d6[_0xf2b8('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 41b253a..acd83f4 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 _0x9daa=['remove','update','emit','removeListener','register','chatInteraction:','./chatInteraction.events','save'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x9daa,0x146));var _0xa9da=function(_0x28430d,_0x45523a){_0x28430d=_0x28430d-0x0;var _0x5cae1b=_0x9daa[_0x28430d];return _0x5cae1b;};'use strict';var ChatInteractionEvents=require(_0xa9da('0x0'));var events=[_0xa9da('0x1'),_0xa9da('0x2'),_0xa9da('0x3')];function createListener(_0x54105a,_0xa817d9){return function(_0x112851){_0xa817d9[_0xa9da('0x4')](_0x54105a,_0x112851);};}function removeListener(_0xee9072,_0x347ed7){return function(){ChatInteractionEvents[_0xa9da('0x5')](_0xee9072,_0x347ed7);};}exports[_0xa9da('0x6')]=function(_0x56a8fc){for(var _0x4dbf12=0x0,_0x4ef8e6=events['length'];_0x4dbf12<_0x4ef8e6;_0x4dbf12++){var _0x2840df=events[_0x4dbf12];var _0x5e588c=createListener(_0xa9da('0x7')+_0x2840df,_0x56a8fc);ChatInteractionEvents['on'](_0x2840df,_0x5e588c);}}; \ No newline at end of file +var _0x1ef3=['chatInteraction:','./chatInteraction.events','save','update','emit','removeListener','register','length'];(function(_0x5a53a0,_0x11f000){var _0x51779d=function(_0x28d19a){while(--_0x28d19a){_0x5a53a0['push'](_0x5a53a0['shift']());}};_0x51779d(++_0x11f000);}(_0x1ef3,0x69));var _0x31ef=function(_0x460bd6,_0x43f145){_0x460bd6=_0x460bd6-0x0;var _0x564c38=_0x1ef3[_0x460bd6];return _0x564c38;};'use strict';var ChatInteractionEvents=require(_0x31ef('0x0'));var events=[_0x31ef('0x1'),'remove',_0x31ef('0x2')];function createListener(_0x24447b,_0x30dbd7){return function(_0x4df75f){_0x30dbd7[_0x31ef('0x3')](_0x24447b,_0x4df75f);};}function removeListener(_0x58388a,_0x49ce87){return function(){ChatInteractionEvents[_0x31ef('0x4')](_0x58388a,_0x49ce87);};}exports[_0x31ef('0x5')]=function(_0x81db4){for(var _0x454b60=0x0,_0x185f8c=events[_0x31ef('0x6')];_0x454b60<_0x185f8c;_0x454b60++){var _0x554347=events[_0x454b60];var _0xf94594=createListener(_0x31ef('0x7')+_0x554347,_0x81db4);ChatInteractionEvents['on'](_0x554347,_0xf94594);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index bae2273..9506dd4 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 _0x0fbc=['post','single','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','update','/:id/custom_update','/:id/close','close','delete','destroy','removeTags','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','get','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','isAuthenticated','createVidaooSession','diskStorage','join','server/files/attachments/','format','now'];(function(_0x37835e,_0x3c2095){var _0x46e6f2=function(_0x3956ea){while(--_0x3956ea){_0x37835e['push'](_0x37835e['shift']());}};_0x46e6f2(++_0x3c2095);}(_0x0fbc,0x99));var _0xc0fb=function(_0x350360,_0x36b354){_0x350360=_0x350360-0x0;var _0x4f755c=_0x0fbc[_0x350360];return _0x4f755c;};'use strict';var multer=require(_0xc0fb('0x0'));var util=require(_0xc0fb('0x1'));var path=require('path');var timeout=require(_0xc0fb('0x2'));var express=require(_0xc0fb('0x3'));var router=express[_0xc0fb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc0fb('0x5'));var interaction=require(_0xc0fb('0x6'));var config=require('../../config/environment');var controller=require(_0xc0fb('0x7'));router[_0xc0fb('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc0fb('0x8')](_0xc0fb('0x9'),auth['isAuthenticated'](),controller[_0xc0fb('0xa')]);router['get'](_0xc0fb('0xb'),auth[_0xc0fb('0xc')](),controller[_0xc0fb('0xd')]);router[_0xc0fb('0x8')](_0xc0fb('0xe'),auth[_0xc0fb('0xc')](),controller[_0xc0fb('0xf')]);router[_0xc0fb('0x8')](_0xc0fb('0x10'),auth['isAuthenticated'](),controller[_0xc0fb('0x11')]);router[_0xc0fb('0x8')](_0xc0fb('0x12'),auth[_0xc0fb('0xc')](),controller[_0xc0fb('0x13')]);router['get']('/:id/download',auth[_0xc0fb('0x14')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/vidaoo',auth['isAuthenticated'](),controller[_0xc0fb('0x15')]);var upload=multer({'storage':multer[_0xc0fb('0x16')]({'destination':function(_0x4143fb,_0x236e5d,_0x71a10a){_0x71a10a(null,path[_0xc0fb('0x17')](config['root'],_0xc0fb('0x18')));},'filename':function(_0x10cc2a,_0x37fc76,_0x12b20a){_0x12b20a(null,util[_0xc0fb('0x19')]('%s-%s',Date[_0xc0fb('0x1a')](),_0x37fc76['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xc0fb('0x1b')]('/:id/attachment_upload',upload[_0xc0fb('0x1c')]('file'),controller[_0xc0fb('0x1d')]);router[_0xc0fb('0x1b')](_0xc0fb('0x10'),auth[_0xc0fb('0xc')](),controller[_0xc0fb('0x1e')]);router[_0xc0fb('0x1b')](_0xc0fb('0x1f'),auth[_0xc0fb('0x14')](),interaction[_0xc0fb('0x20')](_0xc0fb('0x21'),_0xc0fb('0x22')),controller[_0xc0fb('0x23')]);router[_0xc0fb('0x24')](_0xc0fb('0xb'),auth[_0xc0fb('0x14')](),interaction['tracked'](_0xc0fb('0x21'),_0xc0fb('0x25')),controller[_0xc0fb('0x26')]);router[_0xc0fb('0x24')](_0xc0fb('0x27'),controller['customUpdate']);router['put']('/:id/abandon',auth[_0xc0fb('0xc')](),controller['abandon']);router['put'](_0xc0fb('0x28'),controller[_0xc0fb('0x29')]);router[_0xc0fb('0x2a')](_0xc0fb('0xb'),auth[_0xc0fb('0x14')](),interaction[_0xc0fb('0x20')](_0xc0fb('0x21'),'chatinteraction:destroy'),controller[_0xc0fb('0x2b')]);router['delete'](_0xc0fb('0x1f'),auth[_0xc0fb('0x14')](),controller[_0xc0fb('0x2c')]);module['exports']=router; \ No newline at end of file +var _0xe782=['diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','put','chatinteraction:update','update','/:id/custom_update','customUpdate','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','get','isAuthenticated','describe','/:id','isChatInteractionAuthorized','show','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe782,0x15a));var _0x2e78=function(_0x2e0bac,_0x56796d){_0x2e0bac=_0x2e0bac-0x0;var _0x14c25f=_0xe782[_0x2e0bac];return _0x14c25f;};'use strict';var multer=require(_0x2e78('0x0'));var util=require(_0x2e78('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2e78('0x2'));var router=express[_0x2e78('0x3')]();var fs_extra=require(_0x2e78('0x4'));var auth=require(_0x2e78('0x5'));var interaction=require(_0x2e78('0x6'));var config=require('../../config/environment');var controller=require(_0x2e78('0x7'));router[_0x2e78('0x8')]('/',auth[_0x2e78('0x9')](),controller['index']);router['get']('/describe',auth[_0x2e78('0x9')](),controller[_0x2e78('0xa')]);router[_0x2e78('0x8')](_0x2e78('0xb'),auth[_0x2e78('0xc')](),controller[_0x2e78('0xd')]);router[_0x2e78('0x8')]('/:id/attachment_download',auth[_0x2e78('0xc')](),controller[_0x2e78('0xe')]);router[_0x2e78('0x8')](_0x2e78('0xf'),auth[_0x2e78('0x9')](),controller[_0x2e78('0x10')]);router['get'](_0x2e78('0x11'),auth['isChatInteractionAuthorized'](),controller[_0x2e78('0x12')]);router[_0x2e78('0x8')](_0x2e78('0x13'),auth[_0x2e78('0x9')](),controller[_0x2e78('0x14')]);router[_0x2e78('0x15')]('/',auth['isAuthenticated'](),controller[_0x2e78('0x16')]);router[_0x2e78('0x15')](_0x2e78('0x17'),auth[_0x2e78('0x9')](),controller[_0x2e78('0x18')]);var upload=multer({'storage':multer[_0x2e78('0x19')]({'destination':function(_0x22fd55,_0x642d3b,_0x5e83b4){_0x5e83b4(null,path[_0x2e78('0x1a')](config[_0x2e78('0x1b')],_0x2e78('0x1c')));},'filename':function(_0x2c9624,_0x1aaba3,_0x47fab4){_0x47fab4(null,util[_0x2e78('0x1d')](_0x2e78('0x1e'),Date[_0x2e78('0x1f')](),_0x1aaba3[_0x2e78('0x20')][_0x2e78('0x21')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x2e78('0x22'),upload['single'](_0x2e78('0x23')),controller[_0x2e78('0x24')]);router[_0x2e78('0x15')](_0x2e78('0xf'),auth[_0x2e78('0xc')](),controller[_0x2e78('0x25')]);router['post'](_0x2e78('0x26'),auth[_0x2e78('0x9')](),interaction[_0x2e78('0x27')](_0x2e78('0x28'),'chatinteraction:addtags'),controller['addTags']);router[_0x2e78('0x29')]('/:id',auth['isAuthenticated'](),interaction[_0x2e78('0x27')](_0x2e78('0x28'),_0x2e78('0x2a')),controller[_0x2e78('0x2b')]);router[_0x2e78('0x29')](_0x2e78('0x2c'),controller[_0x2e78('0x2d')]);router[_0x2e78('0x29')]('/:id/abandon',auth[_0x2e78('0xc')](),controller[_0x2e78('0x2e')]);router[_0x2e78('0x29')](_0x2e78('0x2f'),controller[_0x2e78('0x30')]);router[_0x2e78('0x31')]('/:id',auth[_0x2e78('0x9')](),interaction[_0x2e78('0x27')](_0x2e78('0x28'),_0x2e78('0x32')),controller[_0x2e78('0x33')]);router[_0x2e78('0x31')]('/:id/tags',auth[_0x2e78('0x9')](),controller['removeTags']);module[_0x2e78('0x34')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 4086d50..841d8f3 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 _0xbf04=['exports','TEXT','sequelize'];(function(_0x3eee56,_0x176daf){var _0x506bcd=function(_0x3cfe8b){while(--_0x3cfe8b){_0x3eee56['push'](_0x3eee56['shift']());}};_0x506bcd(++_0x176daf);}(_0xbf04,0x158));var _0x4bf0=function(_0xde1348,_0x5205b6){_0xde1348=_0xde1348-0x0;var _0x32c5e0=_0xbf04[_0xde1348];return _0x32c5e0;};'use strict';var Sequelize=require(_0x4bf0('0x0'));module[_0x4bf0('0x1')]={'body':{'type':Sequelize[_0x4bf0('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xc666=['medium','BOOLEAN','INTEGER','exports'];(function(_0x38c0b2,_0x6a67a5){var _0x283c00=function(_0x259f03){while(--_0x259f03){_0x38c0b2['push'](_0x38c0b2['shift']());}};_0x283c00(++_0x6a67a5);}(_0xc666,0x1bb));var _0x6c66=function(_0x4e5592,_0x2a483e){_0x4e5592=_0x4e5592-0x0;var _0x2b8962=_0xc666[_0x4e5592];return _0x2b8962;};'use strict';var Sequelize=require('sequelize');module[_0x6c66('0x0')]={'body':{'type':Sequelize['TEXT'](_0x6c66('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x6c66('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x6c66('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 9b5210b..dcf7846 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 _0x76ce=['push','createdAt','ToId','read','-createdAt','all','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','map','ChatInternalMessage','fieldName','type','model','keys','query','filters','intersection','attributes','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','options','catch','show','fields','includeAll','include','merge','create','body','find','params','describe','messages','lastMessageAt','lastMessage','format','getUsers','User','findAll','agent','admin','user','role','userpic','internal','lastLoginAt','allowmessenger','VoiceQueue','VoiceQueues','get','UserProfileSection','autoAssociation','isEmpty','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x76ce,0x6d));var _0xe76c=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x76ce[_0xae7c2f];return _0x5d7001;};'use strict';var emlformat=require(_0xe76c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe76c('0x1'));var jsonpatch=require(_0xe76c('0x2'));var rp=require('request-promise');var moment=require(_0xe76c('0x3'));var BPromise=require(_0xe76c('0x4'));var Mustache=require(_0xe76c('0x5'));var util=require('util');var path=require('path');var sox=require(_0xe76c('0x6'));var csv=require(_0xe76c('0x7'));var ejs=require(_0xe76c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe76c('0x9'));var crypto=require(_0xe76c('0xa'));var jsforce=require(_0xe76c('0xb'));var deskjs=require(_0xe76c('0xc'));var toCsv=require(_0xe76c('0x7'));var querystring=require(_0xe76c('0xd'));var Papa=require(_0xe76c('0xe'));var Redis=require(_0xe76c('0xf'));var authService=require(_0xe76c('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe76c('0x11'))(_0xe76c('0x12'));var utils=require(_0xe76c('0x13'));var config=require(_0xe76c('0x14'));var licenseUtil=require(_0xe76c('0x15'));var db=require(_0xe76c('0x16'))['db'];config['redis']=_['defaults'](config[_0xe76c('0x17')],{'host':_0xe76c('0x18'),'port':0x18eb});var socket=require(_0xe76c('0x19'))(new Redis(config['redis']));require(_0xe76c('0x1a'))[_0xe76c('0x1b')](socket);function respondWithStatusCode(_0x4ef71c,_0x3f8e3f){_0x3f8e3f=_0x3f8e3f||0xcc;return function(_0x47b2da){if(_0x47b2da){return _0x4ef71c[_0xe76c('0x1c')](_0x3f8e3f);}return _0x4ef71c['status'](_0x3f8e3f)[_0xe76c('0x1d')]();};}function respondWithResult(_0x5f0b99,_0x24bbad){_0x24bbad=_0x24bbad||0xc8;return function(_0x2519f3){if(_0x2519f3){return _0x5f0b99[_0xe76c('0x1e')](_0x24bbad)['json'](_0x2519f3);}};}function respondWithFilteredResult(_0x25b6ef,_0x4ba9fe){return function(_0x5a0bd8){if(_0x5a0bd8){var _0x128ad7=typeof _0x4ba9fe[_0xe76c('0x1f')]===_0xe76c('0x20')&&typeof _0x4ba9fe[_0xe76c('0x21')]===_0xe76c('0x20');var _0x4d2dcb=_0x5a0bd8[_0xe76c('0x22')];var _0xc6c9f8=_0x128ad7?0x0:_0x4ba9fe[_0xe76c('0x1f')];var _0x4f5094=_0x128ad7?_0x5a0bd8[_0xe76c('0x22')]:_0x4ba9fe[_0xe76c('0x1f')]+_0x4ba9fe[_0xe76c('0x21')];var _0x405b2e;if(_0x4f5094>=_0x4d2dcb){_0x4f5094=_0x4d2dcb;_0x405b2e=0xc8;}else{_0x405b2e=0xce;}_0x25b6ef[_0xe76c('0x1e')](_0x405b2e);return _0x25b6ef['set'](_0xe76c('0x23'),_0xc6c9f8+'-'+_0x4f5094+'/'+_0x4d2dcb)[_0xe76c('0x24')](_0x5a0bd8);}return null;};}function patchUpdates(_0x4cadd2){return function(_0x3982c4){try{jsonpatch[_0xe76c('0x25')](_0x3982c4,_0x4cadd2,!![]);}catch(_0x4b24a1){return BPromise[_0xe76c('0x26')](_0x4b24a1);}return _0x3982c4['save']();};}function saveUpdates(_0x5e478c,_0x4e033c){return function(_0x36eb07){if(_0x36eb07){return _0x36eb07[_0xe76c('0x27')](_0x5e478c)[_0xe76c('0x28')](function(_0x29ee32){return _0x29ee32;});}return null;};}function removeEntity(_0x4994f6,_0x26aa6d){return function(_0x15f63a){if(_0x15f63a){return _0x15f63a[_0xe76c('0x29')]()[_0xe76c('0x28')](function(){_0x4994f6[_0xe76c('0x1e')](0xcc)[_0xe76c('0x1d')]();});}};}function handleEntityNotFound(_0xa2bc4f,_0x52605e){return function(_0x1905d1){if(!_0x1905d1){_0xa2bc4f['sendStatus'](0x194);}return _0x1905d1;};}function handleError(_0x54d736,_0x377638){_0x377638=_0x377638||0x1f4;return function(_0x29809d){logger[_0xe76c('0x2a')](_0x29809d[_0xe76c('0x2b')]);if(_0x29809d[_0xe76c('0x2c')]){delete _0x29809d[_0xe76c('0x2c')];}_0x54d736[_0xe76c('0x1e')](_0x377638)[_0xe76c('0x2d')](_0x29809d);};}exports['index']=function(_0x8a5b1c,_0x1c5aa7){var _0x3c1929={},_0x179f9d={},_0x4657cf={'count':0x0,'rows':[]};var _0x4af313=_[_0xe76c('0x2e')](db[_0xe76c('0x2f')]['rawAttributes'],function(_0x24c03b){return{'name':_0x24c03b[_0xe76c('0x30')],'type':_0x24c03b[_0xe76c('0x31')]['key']};});_0x179f9d[_0xe76c('0x32')]=_['map'](_0x4af313,'name');_0x179f9d['query']=_[_0xe76c('0x33')](_0x8a5b1c[_0xe76c('0x34')]);_0x179f9d[_0xe76c('0x35')]=_[_0xe76c('0x36')](_0x179f9d[_0xe76c('0x32')],_0x179f9d[_0xe76c('0x34')]);_0x3c1929[_0xe76c('0x37')]=_[_0xe76c('0x36')](_0x179f9d[_0xe76c('0x32')],qs['fields'](_0x8a5b1c[_0xe76c('0x34')]['fields']));_0x3c1929[_0xe76c('0x37')]=_0x3c1929[_0xe76c('0x37')]['length']?_0x3c1929[_0xe76c('0x37')]:_0x179f9d[_0xe76c('0x32')];if(!_0x8a5b1c['query'][_0xe76c('0x38')](_0xe76c('0x39'))){_0x3c1929[_0xe76c('0x21')]=qs[_0xe76c('0x21')](_0x8a5b1c[_0xe76c('0x34')][_0xe76c('0x21')]);_0x3c1929[_0xe76c('0x1f')]=qs['offset'](_0x8a5b1c[_0xe76c('0x34')]['offset']);}_0x3c1929['order']=qs[_0xe76c('0x3a')](_0x8a5b1c['query']['sort']);_0x3c1929[_0xe76c('0x3b')]=qs['filters'](_[_0xe76c('0x3c')](_0x8a5b1c[_0xe76c('0x34')],_0x179f9d[_0xe76c('0x35')]),_0x4af313);if(_0x8a5b1c[_0xe76c('0x34')]['filter']){_0x3c1929[_0xe76c('0x3b')]=_['merge'](_0x3c1929[_0xe76c('0x3b')],{'$or':_[_0xe76c('0x2e')](_0x4af313,function(_0x32cf0a){if(_0x32cf0a['type']!==_0xe76c('0x3d')){var _0x26c98d={};_0x26c98d[_0x32cf0a[_0xe76c('0x2c')]]={'$like':'%'+_0x8a5b1c[_0xe76c('0x34')][_0xe76c('0x3e')]+'%'};return _0x26c98d;}})});}_0x3c1929=_['merge']({},_0x3c1929,_0x8a5b1c[_0xe76c('0x3f')]);var _0x451ffc={'where':_0x3c1929[_0xe76c('0x3b')]};return db['ChatInternalMessage'][_0xe76c('0x22')](_0x451ffc)[_0xe76c('0x28')](function(_0x2cbf28){_0x4657cf[_0xe76c('0x22')]=_0x2cbf28;if(_0x8a5b1c[_0xe76c('0x34')]['includeAll']){_0x3c1929['include']=[{'all':!![]}];}return db[_0xe76c('0x2f')]['findAll'](_0x3c1929);})[_0xe76c('0x28')](function(_0x5f4e12){_0x4657cf['rows']=_0x5f4e12;return _0x4657cf;})[_0xe76c('0x28')](respondWithFilteredResult(_0x1c5aa7,_0x3c1929))[_0xe76c('0x40')](handleError(_0x1c5aa7,null));};exports[_0xe76c('0x41')]=function(_0x5a254d,_0x31128a){var _0x313115={'raw':!![],'where':{'id':_0x5a254d['params']['id']}},_0x50739a={};_0x50739a[_0xe76c('0x32')]=_['keys'](db[_0xe76c('0x2f')]['rawAttributes']);_0x50739a['query']=_[_0xe76c('0x33')](_0x5a254d[_0xe76c('0x34')]);_0x50739a[_0xe76c('0x35')]=_['intersection'](_0x50739a[_0xe76c('0x32')],_0x50739a[_0xe76c('0x34')]);_0x313115[_0xe76c('0x37')]=_[_0xe76c('0x36')](_0x50739a[_0xe76c('0x32')],qs['fields'](_0x5a254d[_0xe76c('0x34')][_0xe76c('0x42')]));_0x313115[_0xe76c('0x37')]=_0x313115[_0xe76c('0x37')]['length']?_0x313115[_0xe76c('0x37')]:_0x50739a[_0xe76c('0x32')];if(_0x5a254d[_0xe76c('0x34')][_0xe76c('0x43')]){_0x313115[_0xe76c('0x44')]=[{'all':!![]}];}_0x313115=_[_0xe76c('0x45')]({},_0x313115,_0x5a254d[_0xe76c('0x3f')]);return db[_0xe76c('0x2f')]['find'](_0x313115)[_0xe76c('0x28')](handleEntityNotFound(_0x31128a,null))[_0xe76c('0x28')](respondWithResult(_0x31128a,null))[_0xe76c('0x40')](handleError(_0x31128a,null));};exports[_0xe76c('0x46')]=function(_0x5f46a0,_0x504daf){return db[_0xe76c('0x2f')][_0xe76c('0x46')](_0x5f46a0['body'],{})[_0xe76c('0x28')](respondWithResult(_0x504daf,0xc9))['catch'](handleError(_0x504daf,null));};exports[_0xe76c('0x27')]=function(_0xdd704f,_0xea772){if(_0xdd704f[_0xe76c('0x47')]['id']){delete _0xdd704f[_0xe76c('0x47')]['id'];}return db['ChatInternalMessage'][_0xe76c('0x48')]({'where':{'id':_0xdd704f[_0xe76c('0x49')]['id']}})[_0xe76c('0x28')](handleEntityNotFound(_0xea772,null))['then'](saveUpdates(_0xdd704f[_0xe76c('0x47')],null))['then'](respondWithResult(_0xea772,null))[_0xe76c('0x40')](handleError(_0xea772,null));};exports[_0xe76c('0x29')]=function(_0x5daee7,_0x3be4ea){return db[_0xe76c('0x2f')][_0xe76c('0x48')]({'where':{'id':_0x5daee7['params']['id']}})[_0xe76c('0x28')](handleEntityNotFound(_0x3be4ea,null))[_0xe76c('0x28')](removeEntity(_0x3be4ea,null))[_0xe76c('0x40')](handleError(_0x3be4ea,null));};exports[_0xe76c('0x4a')]=function(_0x26f5ca,_0x219af1){return db[_0xe76c('0x2f')]['describe']()[_0xe76c('0x28')](respondWithResult(_0x219af1,null))['catch'](handleError(_0x219af1,null));};function wrapUser(_0x30060e){return function(_0x2f2f77){var _0x334204=_0x30060e['get']({'plain':!![]});_0x334204[_0xe76c('0x4b')]=[];if(_0x2f2f77){_0x334204[_0xe76c('0x4c')]=_0x2f2f77['createdAt'];_0x334204[_0xe76c('0x4d')]=_0x2f2f77;}else{_0x334204[_0xe76c('0x4c')]=moment(0x0)[_0xe76c('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x334204[_0xe76c('0x4d')]={};}return _0x334204;};}exports[_0xe76c('0x4f')]=function(_0x18953c,_0x296bed,_0x51f9aa){var _0x98fb02=[];return db[_0xe76c('0x50')][_0xe76c('0x51')]({'where':{'role':[_0xe76c('0x52'),_0xe76c('0x53'),_0xe76c('0x54')]},'attributes':['id','fullname',_0xe76c('0x2c'),_0xe76c('0x55'),_0xe76c('0x56'),_0xe76c('0x57'),'online',_0xe76c('0x58'),_0xe76c('0x59'),'showWebBar'],'order':qs[_0xe76c('0x3a')]('-online'),'include':[{'model':db[_0xe76c('0x5a')],'as':_0xe76c('0x5b'),'attributes':['id',_0xe76c('0x2c'),_0xe76c('0x31')],'through':{'attributes':[]}}]})[_0xe76c('0x28')](function(_0x1698b3){if(_0x1698b3){var _0x449d61=_0x18953c[_0xe76c('0x54')][_0xe76c('0x5c')]({'plain':!![]});if(!_0x449d61)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x449d61['role']===_0xe76c('0x54')){return db[_0xe76c('0x5d')][_0xe76c('0x48')]({'where':{'name':'Agents','userProfileId':_0x449d61['userProfileId']},'raw':!![]})[_0xe76c('0x28')](function(_0x1c534f){if(_0x1c534f){if(_0x1c534f[_0xe76c('0x5e')]===0x0){return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x1c534f['id']},'raw':!![]})[_0xe76c('0x28')](function(_0x4238d4){var _0x31cc28=[];if(_[_0xe76c('0x5f')](_0x4238d4)){_0x31cc28=_[_0xe76c('0x3e')](_0x1698b3,function(_0x3ca00d){if(_0x3ca00d[_0xe76c('0x55')]!==_0xe76c('0x52')){return _0x3ca00d;}});return _0x31cc28;}else{for(var _0x1b29a5=0x0;_0x1b29a5<_0x1698b3[_0xe76c('0x60')];_0x1b29a5++){var _0xaa41ba=_0x1698b3[_0x1b29a5];if(_0xaa41ba[_0xe76c('0x55')]===_0xe76c('0x52')){var _0x1cc837=_[_0xe76c('0x48')](_0x4238d4,function(_0x1dac22){return _0x1dac22['resourceId']===_0xaa41ba['id'];});if(_0x1cc837)_0x31cc28[_0xe76c('0x61')](_0xaa41ba);}else{_0x31cc28[_0xe76c('0x61')](_0xaa41ba);}}return _0x31cc28;}});}else{return _0x1698b3;}}else{var _0x11825c=_[_0xe76c('0x3e')](_0x1698b3,function(_0x2f52f6){if(_0x2f52f6[_0xe76c('0x55')]!==_0xe76c('0x52')){return _0x2f52f6;}});return _0x11825c;}});}else{return _0x1698b3;}}})[_0xe76c('0x28')](function(_0x17bd49){var _0x50fd55=[];if(_0x17bd49){_0x98fb02=_0x17bd49;for(var _0x139a9c=0x0;_0x139a9c<_0x17bd49[_0xe76c('0x60')];_0x139a9c+=0x1){_0x98fb02[_0x139a9c][_0xe76c('0x4b')]=[];_0x50fd55[_0xe76c('0x61')](db[_0xe76c('0x2f')][_0xe76c('0x48')]({'where':{'FromId':[_0x18953c[_0xe76c('0x54')]['id'],_0x17bd49[_0x139a9c]['id']],'ToId':[_0x18953c[_0xe76c('0x54')]['id'],_0x17bd49[_0x139a9c]['id']],'ChatGroupId':null},'attributes':['id',_0xe76c('0x62'),'FromId',_0xe76c('0x63'),_0xe76c('0x64'),'body'],'order':qs['sort'](_0xe76c('0x65')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xe76c('0x28')](wrapUser(_0x17bd49[_0x139a9c])));}return BPromise[_0xe76c('0x66')](_0x50fd55);}return[];})[_0xe76c('0x28')](function(_0xa4de4d){return{'rows':_0xa4de4d,'count':_0xa4de4d[_0xe76c('0x60')]};})['then'](respondWithResult(_0x296bed,null))['catch'](handleError(_0x296bed,null));}; \ No newline at end of file +var _0xa7f7=['catch','params','rawAttributes','find','create','body','update','describe','get','lastMessage','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','agent','admin','online','lastLoginAt','allowmessenger','-online','VoiceQueues','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','resourceId','push','messages','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','lodash','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','save','then','destroy','stack','name','send','index','map','ChatInternalMessage','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows'];(function(_0x13cf7a,_0x479809){var _0x5cb678=function(_0x267d4a){while(--_0x267d4a){_0x13cf7a['push'](_0x13cf7a['shift']());}};_0x5cb678(++_0x479809);}(_0xa7f7,0x8a));var _0x7a7f=function(_0x487ab4,_0x1e24e8){_0x487ab4=_0x487ab4-0x0;var _0x3bef77=_0xa7f7[_0x487ab4];return _0x3bef77;};'use strict';var emlformat=require(_0x7a7f('0x0'));var rimraf=require(_0x7a7f('0x1'));var zipdir=require(_0x7a7f('0x2'));var jsonpatch=require(_0x7a7f('0x3'));var rp=require(_0x7a7f('0x4'));var moment=require(_0x7a7f('0x5'));var BPromise=require(_0x7a7f('0x6'));var Mustache=require('mustache');var util=require(_0x7a7f('0x7'));var path=require(_0x7a7f('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7a7f('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7a7f('0xa'));var deskjs=require(_0x7a7f('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7a7f('0xc'));var Redis=require(_0x7a7f('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x7a7f('0xe'));var as=require(_0x7a7f('0xf'));var hardwareService=require(_0x7a7f('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x7a7f('0x11'));var licenseUtil=require(_0x7a7f('0x12'));var db=require(_0x7a7f('0x13'))['db'];config[_0x7a7f('0x14')]=_[_0x7a7f('0x15')](config[_0x7a7f('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0x7a7f('0x16'))(new Redis(config[_0x7a7f('0x14')]));require(_0x7a7f('0x17'))[_0x7a7f('0x18')](socket);function respondWithStatusCode(_0x2de9f9,_0x2d6ec9){_0x2d6ec9=_0x2d6ec9||0xcc;return function(_0x237095){if(_0x237095){return _0x2de9f9[_0x7a7f('0x19')](_0x2d6ec9);}return _0x2de9f9[_0x7a7f('0x1a')](_0x2d6ec9)[_0x7a7f('0x1b')]();};}function respondWithResult(_0x2090f0,_0x50ec2b){_0x50ec2b=_0x50ec2b||0xc8;return function(_0x33ef4b){if(_0x33ef4b){return _0x2090f0['status'](_0x50ec2b)[_0x7a7f('0x1c')](_0x33ef4b);}};}function respondWithFilteredResult(_0x1781c4,_0x5ba334){return function(_0x54dd4e){if(_0x54dd4e){var _0x17a4e5=typeof _0x5ba334[_0x7a7f('0x1d')]===_0x7a7f('0x1e')&&typeof _0x5ba334['limit']===_0x7a7f('0x1e');var _0x45af28=_0x54dd4e[_0x7a7f('0x1f')];var _0x13dc8a=_0x17a4e5?0x0:_0x5ba334[_0x7a7f('0x1d')];var _0x3a3de3=_0x17a4e5?_0x54dd4e[_0x7a7f('0x1f')]:_0x5ba334[_0x7a7f('0x1d')]+_0x5ba334[_0x7a7f('0x20')];var _0x18cc03;if(_0x3a3de3>=_0x45af28){_0x3a3de3=_0x45af28;_0x18cc03=0xc8;}else{_0x18cc03=0xce;}_0x1781c4['status'](_0x18cc03);return _0x1781c4[_0x7a7f('0x21')]('Content-Range',_0x13dc8a+'-'+_0x3a3de3+'/'+_0x45af28)[_0x7a7f('0x1c')](_0x54dd4e);}return null;};}function patchUpdates(_0x16d54b){return function(_0x586ace){try{jsonpatch[_0x7a7f('0x22')](_0x586ace,_0x16d54b,!![]);}catch(_0x71d29){return BPromise['reject'](_0x71d29);}return _0x586ace[_0x7a7f('0x23')]();};}function saveUpdates(_0x3fb517,_0x11f494){return function(_0x3216e6){if(_0x3216e6){return _0x3216e6['update'](_0x3fb517)[_0x7a7f('0x24')](function(_0x2bfdfd){return _0x2bfdfd;});}return null;};}function removeEntity(_0x280d16,_0x135243){return function(_0x2e2ab0){if(_0x2e2ab0){return _0x2e2ab0[_0x7a7f('0x25')]()['then'](function(){_0x280d16[_0x7a7f('0x1a')](0xcc)[_0x7a7f('0x1b')]();});}};}function handleEntityNotFound(_0x454e13,_0x20b070){return function(_0x5e69b6){if(!_0x5e69b6){_0x454e13['sendStatus'](0x194);}return _0x5e69b6;};}function handleError(_0x4b35c5,_0x57651d){_0x57651d=_0x57651d||0x1f4;return function(_0x36e4e5){logger['error'](_0x36e4e5[_0x7a7f('0x26')]);if(_0x36e4e5[_0x7a7f('0x27')]){delete _0x36e4e5[_0x7a7f('0x27')];}_0x4b35c5['status'](_0x57651d)[_0x7a7f('0x28')](_0x36e4e5);};}exports[_0x7a7f('0x29')]=function(_0x22ea30,_0x115572){var _0x3f0781={},_0x37b691={},_0xa1b3a1={'count':0x0,'rows':[]};var _0x1896b8=_[_0x7a7f('0x2a')](db[_0x7a7f('0x2b')]['rawAttributes'],function(_0x377427){return{'name':_0x377427[_0x7a7f('0x2c')],'type':_0x377427[_0x7a7f('0x2d')][_0x7a7f('0x2e')]};});_0x37b691['model']=_[_0x7a7f('0x2a')](_0x1896b8,'name');_0x37b691[_0x7a7f('0x2f')]=_['keys'](_0x22ea30['query']);_0x37b691[_0x7a7f('0x30')]=_[_0x7a7f('0x31')](_0x37b691[_0x7a7f('0x32')],_0x37b691[_0x7a7f('0x2f')]);_0x3f0781['attributes']=_['intersection'](_0x37b691[_0x7a7f('0x32')],qs[_0x7a7f('0x33')](_0x22ea30['query'][_0x7a7f('0x33')]));_0x3f0781[_0x7a7f('0x34')]=_0x3f0781[_0x7a7f('0x34')][_0x7a7f('0x35')]?_0x3f0781[_0x7a7f('0x34')]:_0x37b691[_0x7a7f('0x32')];if(!_0x22ea30[_0x7a7f('0x2f')]['hasOwnProperty'](_0x7a7f('0x36'))){_0x3f0781[_0x7a7f('0x20')]=qs['limit'](_0x22ea30[_0x7a7f('0x2f')][_0x7a7f('0x20')]);_0x3f0781[_0x7a7f('0x1d')]=qs[_0x7a7f('0x1d')](_0x22ea30[_0x7a7f('0x2f')][_0x7a7f('0x1d')]);}_0x3f0781[_0x7a7f('0x37')]=qs[_0x7a7f('0x38')](_0x22ea30[_0x7a7f('0x2f')]['sort']);_0x3f0781[_0x7a7f('0x39')]=qs[_0x7a7f('0x30')](_[_0x7a7f('0x3a')](_0x22ea30[_0x7a7f('0x2f')],_0x37b691[_0x7a7f('0x30')]),_0x1896b8);if(_0x22ea30[_0x7a7f('0x2f')][_0x7a7f('0x3b')]){_0x3f0781[_0x7a7f('0x39')]=_[_0x7a7f('0x3c')](_0x3f0781[_0x7a7f('0x39')],{'$or':_['map'](_0x1896b8,function(_0x2097ac){if(_0x2097ac['type']!==_0x7a7f('0x3d')){var _0x2b1dd0={};_0x2b1dd0[_0x2097ac[_0x7a7f('0x27')]]={'$like':'%'+_0x22ea30[_0x7a7f('0x2f')][_0x7a7f('0x3b')]+'%'};return _0x2b1dd0;}})});}_0x3f0781=_['merge']({},_0x3f0781,_0x22ea30[_0x7a7f('0x3e')]);var _0x167c22={'where':_0x3f0781['where']};return db[_0x7a7f('0x2b')][_0x7a7f('0x1f')](_0x167c22)[_0x7a7f('0x24')](function(_0x6ce5c1){_0xa1b3a1[_0x7a7f('0x1f')]=_0x6ce5c1;if(_0x22ea30[_0x7a7f('0x2f')]['includeAll']){_0x3f0781[_0x7a7f('0x3f')]=[{'all':!![]}];}return db[_0x7a7f('0x2b')][_0x7a7f('0x40')](_0x3f0781);})[_0x7a7f('0x24')](function(_0x54df45){_0xa1b3a1[_0x7a7f('0x41')]=_0x54df45;return _0xa1b3a1;})[_0x7a7f('0x24')](respondWithFilteredResult(_0x115572,_0x3f0781))[_0x7a7f('0x42')](handleError(_0x115572,null));};exports['show']=function(_0x49e40f,_0x5bcbd3){var _0x169f53={'raw':!![],'where':{'id':_0x49e40f[_0x7a7f('0x43')]['id']}},_0x2ff8d4={};_0x2ff8d4[_0x7a7f('0x32')]=_['keys'](db[_0x7a7f('0x2b')][_0x7a7f('0x44')]);_0x2ff8d4[_0x7a7f('0x2f')]=_['keys'](_0x49e40f[_0x7a7f('0x2f')]);_0x2ff8d4[_0x7a7f('0x30')]=_[_0x7a7f('0x31')](_0x2ff8d4[_0x7a7f('0x32')],_0x2ff8d4[_0x7a7f('0x2f')]);_0x169f53['attributes']=_[_0x7a7f('0x31')](_0x2ff8d4[_0x7a7f('0x32')],qs[_0x7a7f('0x33')](_0x49e40f[_0x7a7f('0x2f')][_0x7a7f('0x33')]));_0x169f53[_0x7a7f('0x34')]=_0x169f53[_0x7a7f('0x34')][_0x7a7f('0x35')]?_0x169f53[_0x7a7f('0x34')]:_0x2ff8d4[_0x7a7f('0x32')];if(_0x49e40f[_0x7a7f('0x2f')]['includeAll']){_0x169f53[_0x7a7f('0x3f')]=[{'all':!![]}];}_0x169f53=_[_0x7a7f('0x3c')]({},_0x169f53,_0x49e40f[_0x7a7f('0x3e')]);return db[_0x7a7f('0x2b')][_0x7a7f('0x45')](_0x169f53)['then'](handleEntityNotFound(_0x5bcbd3,null))['then'](respondWithResult(_0x5bcbd3,null))['catch'](handleError(_0x5bcbd3,null));};exports[_0x7a7f('0x46')]=function(_0x2afe9c,_0x1c2509){return db[_0x7a7f('0x2b')][_0x7a7f('0x46')](_0x2afe9c[_0x7a7f('0x47')],{})[_0x7a7f('0x24')](respondWithResult(_0x1c2509,0xc9))[_0x7a7f('0x42')](handleError(_0x1c2509,null));};exports[_0x7a7f('0x48')]=function(_0x438ecf,_0x2dd401){if(_0x438ecf[_0x7a7f('0x47')]['id']){delete _0x438ecf[_0x7a7f('0x47')]['id'];}return db[_0x7a7f('0x2b')][_0x7a7f('0x45')]({'where':{'id':_0x438ecf[_0x7a7f('0x43')]['id']}})[_0x7a7f('0x24')](handleEntityNotFound(_0x2dd401,null))[_0x7a7f('0x24')](saveUpdates(_0x438ecf[_0x7a7f('0x47')],null))[_0x7a7f('0x24')](respondWithResult(_0x2dd401,null))[_0x7a7f('0x42')](handleError(_0x2dd401,null));};exports[_0x7a7f('0x25')]=function(_0x46d142,_0x1def4a){return db[_0x7a7f('0x2b')][_0x7a7f('0x45')]({'where':{'id':_0x46d142[_0x7a7f('0x43')]['id']}})['then'](handleEntityNotFound(_0x1def4a,null))[_0x7a7f('0x24')](removeEntity(_0x1def4a,null))[_0x7a7f('0x42')](handleError(_0x1def4a,null));};exports[_0x7a7f('0x49')]=function(_0xc820d9,_0x37a9f4){return db['ChatInternalMessage']['describe']()[_0x7a7f('0x24')](respondWithResult(_0x37a9f4,null))[_0x7a7f('0x42')](handleError(_0x37a9f4,null));};function wrapUser(_0x205b97){return function(_0x21125d){var _0x32d29d=_0x205b97[_0x7a7f('0x4a')]({'plain':!![]});_0x32d29d['messages']=[];if(_0x21125d){_0x32d29d['lastMessageAt']=_0x21125d['createdAt'];_0x32d29d[_0x7a7f('0x4b')]=_0x21125d;}else{_0x32d29d[_0x7a7f('0x4c')]=moment(0x0)[_0x7a7f('0x4d')](_0x7a7f('0x4e'));_0x32d29d['lastMessage']={};}return _0x32d29d;};}exports[_0x7a7f('0x4f')]=function(_0x5ceea9,_0x2fcf17,_0x3c9f9d){var _0xabbdba=[];return db['User'][_0x7a7f('0x40')]({'where':{'role':[_0x7a7f('0x50'),_0x7a7f('0x51'),'user']},'attributes':['id','fullname',_0x7a7f('0x27'),'role','userpic','internal',_0x7a7f('0x52'),_0x7a7f('0x53'),_0x7a7f('0x54'),'showWebBar'],'order':qs[_0x7a7f('0x38')](_0x7a7f('0x55')),'include':[{'model':db['VoiceQueue'],'as':_0x7a7f('0x56'),'attributes':['id',_0x7a7f('0x27'),_0x7a7f('0x2d')],'through':{'attributes':[]}}]})['then'](function(_0x5a440b){if(_0x5a440b){var _0x5909d9=_0x5ceea9[_0x7a7f('0x57')][_0x7a7f('0x4a')]({'plain':!![]});if(!_0x5909d9)throw new Error(_0x7a7f('0x58'));if(_0x5909d9[_0x7a7f('0x59')]==='user'){return db[_0x7a7f('0x5a')][_0x7a7f('0x45')]({'where':{'name':_0x7a7f('0x5b'),'userProfileId':_0x5909d9[_0x7a7f('0x5c')]},'raw':!![]})[_0x7a7f('0x24')](function(_0x3a1aec){if(_0x3a1aec){if(_0x3a1aec[_0x7a7f('0x5d')]===0x0){return db[_0x7a7f('0x5e')][_0x7a7f('0x40')]({'where':{'sectionId':_0x3a1aec['id']},'raw':!![]})[_0x7a7f('0x24')](function(_0xff8a92){var _0x545121=[];if(_['isEmpty'](_0xff8a92)){_0x545121=_[_0x7a7f('0x3b')](_0x5a440b,function(_0xc865cf){if(_0xc865cf['role']!==_0x7a7f('0x50')){return _0xc865cf;}});return _0x545121;}else{for(var _0x34aa3a=0x0;_0x34aa3a<_0x5a440b[_0x7a7f('0x35')];_0x34aa3a++){var _0x53997e=_0x5a440b[_0x34aa3a];if(_0x53997e[_0x7a7f('0x59')]===_0x7a7f('0x50')){var _0xbdc853=_[_0x7a7f('0x45')](_0xff8a92,function(_0x5b0eb6){return _0x5b0eb6[_0x7a7f('0x5f')]===_0x53997e['id'];});if(_0xbdc853)_0x545121[_0x7a7f('0x60')](_0x53997e);}else{_0x545121[_0x7a7f('0x60')](_0x53997e);}}return _0x545121;}});}else{return _0x5a440b;}}else{var _0x486459=_['filter'](_0x5a440b,function(_0x5ce3d0){if(_0x5ce3d0[_0x7a7f('0x59')]!==_0x7a7f('0x50')){return _0x5ce3d0;}});return _0x486459;}});}else{return _0x5a440b;}}})[_0x7a7f('0x24')](function(_0x5005af){var _0x19f5ce=[];if(_0x5005af){_0xabbdba=_0x5005af;for(var _0x417bd1=0x0;_0x417bd1<_0x5005af[_0x7a7f('0x35')];_0x417bd1+=0x1){_0xabbdba[_0x417bd1][_0x7a7f('0x61')]=[];_0x19f5ce[_0x7a7f('0x60')](db['ChatInternalMessage'][_0x7a7f('0x45')]({'where':{'FromId':[_0x5ceea9[_0x7a7f('0x57')]['id'],_0x5005af[_0x417bd1]['id']],'ToId':[_0x5ceea9[_0x7a7f('0x57')]['id'],_0x5005af[_0x417bd1]['id']],'ChatGroupId':null},'attributes':['id','createdAt','FromId',_0x7a7f('0x62'),_0x7a7f('0x63'),_0x7a7f('0x47')],'order':qs[_0x7a7f('0x38')](_0x7a7f('0x64')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x7a7f('0x24')](wrapUser(_0x5005af[_0x417bd1])));}return BPromise[_0x7a7f('0x65')](_0x19f5ce);}return[];})[_0x7a7f('0x24')](function(_0xf2cdbf){return{'rows':_0xf2cdbf,'count':_0xf2cdbf['length']};})[_0x7a7f('0x24')](respondWithResult(_0x2fcf17,null))[_0x7a7f('0x42')](handleError(_0x2fcf17,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 4750aeb..e3eea1e 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 _0x6356=['hook','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x4c983b,_0x16d315){var _0x3d0ff0=function(_0x3939ef){while(--_0x3939ef){_0x4c983b['push'](_0x4c983b['shift']());}};_0x3d0ff0(++_0x16d315);}(_0x6356,0xc7));var _0x6635=function(_0x207114,_0x25902e){_0x207114=_0x207114-0x0;var _0x14d3b4=_0x6356[_0x207114];return _0x14d3b4;};'use strict';var EventEmitter=require(_0x6635('0x0'));var ChatInternalMessage=require(_0x6635('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x6635('0x2')](0x0);var events={'afterCreate':_0x6635('0x3'),'afterUpdate':_0x6635('0x4'),'afterDestroy':_0x6635('0x5')};function emitEvent(_0x42bf57){return function(_0x521df7,_0x684e9a,_0x44e99e){ChatInternalMessageEvents[_0x6635('0x6')](_0x42bf57+':'+_0x521df7['id'],_0x521df7);ChatInternalMessageEvents[_0x6635('0x6')](_0x42bf57,_0x521df7);_0x44e99e(null);};}for(var e in events){if(events[_0x6635('0x7')](e)){var event=events[e];ChatInternalMessage[_0x6635('0x8')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0x7ae6=['remove','emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7ae6,0x94));var _0x67ae=function(_0x3e8e85,_0xadecee){_0x3e8e85=_0x3e8e85-0x0;var _0xc42eab=_0x7ae6[_0x3e8e85];return _0xc42eab;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x67ae('0x0'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x67ae('0x1')](0x0);var events={'afterCreate':_0x67ae('0x2'),'afterUpdate':_0x67ae('0x3'),'afterDestroy':_0x67ae('0x4')};function emitEvent(_0x118b8b){return function(_0x45c5a5,_0x55f2cc,_0x18d44c){ChatInternalMessageEvents[_0x67ae('0x5')](_0x118b8b+':'+_0x45c5a5['id'],_0x45c5a5);ChatInternalMessageEvents[_0x67ae('0x5')](_0x118b8b,_0x45c5a5);_0x18d44c(null);};}for(var e in events){if(events[_0x67ae('0x6')](e)){var event=events[e];ChatInternalMessage[_0x67ae('0x7')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index d2c8d55..d12e747 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 _0xd94e=['request-promise','rimraf','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird'];(function(_0x3be2e2,_0x5c166d){var _0x53b9c5=function(_0x248aa7){while(--_0x248aa7){_0x3be2e2['push'](_0x3be2e2['shift']());}};_0x53b9c5(++_0x5c166d);}(_0xd94e,0xc8));var _0xed94=function(_0x35559,_0x36ab81){_0x35559=_0x35559-0x0;var _0x368237=_0xd94e[_0x35559];return _0x368237;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xed94('0x0'))(_0xed94('0x1'));var moment=require(_0xed94('0x2'));var BPromise=require(_0xed94('0x3'));var rp=require(_0xed94('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xed94('0x5'));var config=require('../../config/environment');var attributes=require('./chatInternalMessage.attributes');module[_0xed94('0x6')]=function(_0xa776a3,_0x2740ca){return _0xa776a3[_0xed94('0x7')](_0xed94('0x8'),attributes,{'tableName':_0xed94('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xed94('0xa'),'collate':_0xed94('0xb')});}; \ No newline at end of file +var _0x9dec=['../../config/environment','exports','ChatInternalMessage','utf8mb4','lodash','api','bluebird'];(function(_0x216251,_0x230823){var _0x5821af=function(_0x33a575){while(--_0x33a575){_0x216251['push'](_0x216251['shift']());}};_0x5821af(++_0x230823);}(_0x9dec,0x13f));var _0xc9de=function(_0x3be5dd,_0x2a47e1){_0x3be5dd=_0x3be5dd-0x0;var _0x45a15c=_0x9dec[_0x3be5dd];return _0x45a15c;};'use strict';var _=require(_0xc9de('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc9de('0x1'));var moment=require('moment');var BPromise=require(_0xc9de('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc9de('0x3'));var attributes=require('./chatInternalMessage.attributes');module[_0xc9de('0x4')]=function(_0x1be64d,_0x42d76c){return _0x1be64d['define'](_0xc9de('0x5'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc9de('0x6'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 6853b90..56a2865 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 _0x83ea=['http','redis','./chatInternalMessage.socket','register','request','then','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','client'];(function(_0x5ace3b,_0x5aeac0){var _0x762c23=function(_0x4b66a3){while(--_0x4b66a3){_0x5ace3b['push'](_0x5ace3b['shift']());}};_0x762c23(++_0x5aeac0);}(_0x83ea,0x158));var _0xa83e=function(_0x327bc7,_0x10fcc5){_0x327bc7=_0x327bc7-0x0;var _0x47e71f=_0x83ea[_0x327bc7];return _0x47e71f;};'use strict';var _=require(_0xa83e('0x0'));var util=require(_0xa83e('0x1'));var moment=require('moment');var BPromise=require(_0xa83e('0x2'));var rs=require(_0xa83e('0x3'));var fs=require('fs');var Redis=require(_0xa83e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa83e('0x5'));var logger=require('../../config/logger')(_0xa83e('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa83e('0x7')][_0xa83e('0x8')]({'port':0x232a});config[_0xa83e('0x9')]=_['defaults'](config[_0xa83e('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa83e('0x9')]));require(_0xa83e('0xa'))[_0xa83e('0xb')](socket);function respondWithRpcPromise(_0x2b59a1,_0x1b3ae2,_0x47ab2b){return new BPromise(function(_0x2a19a5,_0xea8495){return client[_0xa83e('0xc')](_0x2b59a1,_0x47ab2b)[_0xa83e('0xd')](function(_0x42dfd6){logger['info'](_0xa83e('0xe'),_0x1b3ae2,_0xa83e('0xf'));logger[_0xa83e('0x10')](_0xa83e('0x11'),_0x1b3ae2,'request\x20sent',JSON[_0xa83e('0x12')](_0x42dfd6));if(_0x42dfd6[_0xa83e('0x13')]){if(_0x42dfd6[_0xa83e('0x13')]['code']===0x1f4){logger['error'](_0xa83e('0xe'),_0x1b3ae2,_0x42dfd6[_0xa83e('0x13')]['message']);return _0xea8495(_0x42dfd6[_0xa83e('0x13')][_0xa83e('0x14')]);}logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x1b3ae2,_0x42dfd6[_0xa83e('0x13')][_0xa83e('0x14')]);return _0x2a19a5(_0x42dfd6[_0xa83e('0x13')][_0xa83e('0x14')]);}else{logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0x1b3ae2,_0xa83e('0xf'));_0x2a19a5(_0x42dfd6['result'][_0xa83e('0x14')]);}})[_0xa83e('0x15')](function(_0x1c7b7f){logger[_0xa83e('0x13')](_0xa83e('0xe'),_0x1b3ae2,_0x1c7b7f);_0xea8495(_0x1c7b7f);});});} \ No newline at end of file +var _0xac94=['ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','rpc','jayson/promise','client','http','redis','register','request','info'];(function(_0x4f6732,_0xb4f108){var _0x5db1c4=function(_0x31e8a0){while(--_0x31e8a0){_0x4f6732['push'](_0x4f6732['shift']());}};_0x5db1c4(++_0xb4f108);}(_0xac94,0x11b));var _0x4ac9=function(_0x26b77c,_0x641f1d){_0x26b77c=_0x26b77c-0x0;var _0x3fb1d6=_0xac94[_0x26b77c];return _0x3fb1d6;};'use strict';var _=require(_0x4ac9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4ac9('0x1'));var rs=require(_0x4ac9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4ac9('0x3'));var config=require('../../config/environment');var jayson=require(_0x4ac9('0x4'));var client=jayson[_0x4ac9('0x5')][_0x4ac9('0x6')]({'port':0x232a});config[_0x4ac9('0x7')]=_['defaults'](config[_0x4ac9('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4ac9('0x7')]));require('./chatInternalMessage.socket')[_0x4ac9('0x8')](socket);function respondWithRpcPromise(_0x36122a,_0x4ded57,_0x3af754){return new BPromise(function(_0x1f1bb3,_0x8a2a4e){return client[_0x4ac9('0x9')](_0x36122a,_0x3af754)['then'](function(_0x4730a2){logger[_0x4ac9('0xa')](_0x4ac9('0xb'),_0x4ded57,_0x4ac9('0xc'));logger[_0x4ac9('0xd')](_0x4ac9('0xe'),_0x4ded57,_0x4ac9('0xc'),JSON[_0x4ac9('0xf')](_0x4730a2));if(_0x4730a2[_0x4ac9('0x10')]){if(_0x4730a2[_0x4ac9('0x10')][_0x4ac9('0x11')]===0x1f4){logger[_0x4ac9('0x10')]('ChatInternalMessage,\x20%s,\x20%s',_0x4ded57,_0x4730a2[_0x4ac9('0x10')]['message']);return _0x8a2a4e(_0x4730a2[_0x4ac9('0x10')]['message']);}logger['error'](_0x4ac9('0xb'),_0x4ded57,_0x4730a2[_0x4ac9('0x10')]['message']);return _0x1f1bb3(_0x4730a2[_0x4ac9('0x10')][_0x4ac9('0x12')]);}else{logger['info'](_0x4ac9('0xb'),_0x4ded57,_0x4ac9('0xc'));_0x1f1bb3(_0x4730a2[_0x4ac9('0x13')][_0x4ac9('0x12')]);}})[_0x4ac9('0x14')](function(_0x5e2b78){logger[_0x4ac9('0x10')]('ChatInternalMessage,\x20%s,\x20%s',_0x4ded57,_0x5e2b78);_0x8a2a4e(_0x5e2b78);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 05dcd0c..63bcf65 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 _0x849e=['./chatInternalMessage.events','save','remove','update','length','chatInternalMessage:'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x849e,0xb4));var _0xe849=function(_0x374cbc,_0x37460){_0x374cbc=_0x374cbc-0x0;var _0x45e20b=_0x849e[_0x374cbc];return _0x45e20b;};'use strict';var ChatInternalMessageEvents=require(_0xe849('0x0'));var events=[_0xe849('0x1'),_0xe849('0x2'),_0xe849('0x3')];function createListener(_0x6ce360,_0x1aed09){return function(_0x41f4e4){_0x1aed09['emit'](_0x6ce360,_0x41f4e4);};}function removeListener(_0x5bac9a,_0x5c87ce){return function(){ChatInternalMessageEvents['removeListener'](_0x5bac9a,_0x5c87ce);};}exports['register']=function(_0x3e4ec1){for(var _0x1a5757=0x0,_0x519c27=events[_0xe849('0x4')];_0x1a5757<_0x519c27;_0x1a5757++){var _0x562d16=events[_0x1a5757];var _0x3020ef=createListener(_0xe849('0x5')+_0x562d16,_0x3e4ec1);ChatInternalMessageEvents['on'](_0x562d16,_0x3020ef);}}; \ No newline at end of file +var _0x3429=['save','remove','update','emit','register','length','chatInternalMessage:'];(function(_0x48eb64,_0x551a7e){var _0x2bdd58=function(_0xb5dd56){while(--_0xb5dd56){_0x48eb64['push'](_0x48eb64['shift']());}};_0x2bdd58(++_0x551a7e);}(_0x3429,0x19d));var _0x9342=function(_0x48949c,_0x3b80b7){_0x48949c=_0x48949c-0x0;var _0x127aaa=_0x3429[_0x48949c];return _0x127aaa;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x9342('0x0'),_0x9342('0x1'),_0x9342('0x2')];function createListener(_0x238cb2,_0x3b6914){return function(_0x16cbeb){_0x3b6914[_0x9342('0x3')](_0x238cb2,_0x16cbeb);};}function removeListener(_0x3eb499,_0x7cf3de){return function(){ChatInternalMessageEvents['removeListener'](_0x3eb499,_0x7cf3de);};}exports[_0x9342('0x4')]=function(_0x3b661f){for(var _0x468cac=0x0,_0x57710b=events[_0x9342('0x5')];_0x468cac<_0x57710b;_0x468cac++){var _0x31a3df=events[_0x468cac];var _0x138c10=createListener(_0x9342('0x6')+_0x31a3df,_0x3b661f);ChatInternalMessageEvents['on'](_0x31a3df,_0x138c10);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 44394e1..449436e 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 _0x51e4=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','/describe','/users','/:id','show','put','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x5761b8,_0x27fbf9){var _0x1e7ae0=function(_0xc26727){while(--_0xc26727){_0x5761b8['push'](_0x5761b8['shift']());}};_0x1e7ae0(++_0x27fbf9);}(_0x51e4,0x18b));var _0x451e=function(_0x180fcb,_0x208b94){_0x180fcb=_0x180fcb-0x0;var _0x515f0d=_0x51e4[_0x180fcb];return _0x515f0d;};'use strict';var multer=require(_0x451e('0x0'));var util=require(_0x451e('0x1'));var path=require(_0x451e('0x2'));var timeout=require(_0x451e('0x3'));var express=require(_0x451e('0x4'));var router=express[_0x451e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x451e('0x6'));var interaction=require(_0x451e('0x7'));var config=require(_0x451e('0x8'));var controller=require(_0x451e('0x9'));router[_0x451e('0xa')]('/',auth[_0x451e('0xb')](),controller['index']);router[_0x451e('0xa')](_0x451e('0xc'),auth[_0x451e('0xb')](),controller['describe']);router['get'](_0x451e('0xd'),auth[_0x451e('0xb')](),controller['getUsers']);router[_0x451e('0xa')](_0x451e('0xe'),auth['isAuthenticated'](),controller[_0x451e('0xf')]);router['post']('/',auth[_0x451e('0xb')](),controller['create']);router[_0x451e('0x10')](_0x451e('0xe'),controller[_0x451e('0x11')]);router[_0x451e('0x12')]('/:id',auth[_0x451e('0xb')](),controller[_0x451e('0x13')]);module['exports']=router; \ No newline at end of file +var _0x6076=['../../config/environment','isAuthenticated','describe','/users','getUsers','get','/:id','show','post','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x372417,_0x176da3){var _0x508ec9=function(_0x157fd1){while(--_0x157fd1){_0x372417['push'](_0x372417['shift']());}};_0x508ec9(++_0x176da3);}(_0x6076,0x71));var _0x6607=function(_0x40d6f5,_0x2bf845){_0x40d6f5=_0x40d6f5-0x0;var _0x1d651e=_0x6076[_0x40d6f5];return _0x1d651e;};'use strict';var multer=require(_0x6607('0x0'));var util=require(_0x6607('0x1'));var path=require(_0x6607('0x2'));var timeout=require('connect-timeout');var express=require(_0x6607('0x3'));var router=express['Router']();var fs_extra=require(_0x6607('0x4'));var auth=require(_0x6607('0x5'));var interaction=require(_0x6607('0x6'));var config=require(_0x6607('0x7'));var controller=require('./chatInternalMessage.controller');router['get']('/',auth[_0x6607('0x8')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x6607('0x9')]);router['get'](_0x6607('0xa'),auth['isAuthenticated'](),controller[_0x6607('0xb')]);router[_0x6607('0xc')](_0x6607('0xd'),auth[_0x6607('0x8')](),controller[_0x6607('0xe')]);router[_0x6607('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x6607('0xd'),controller[_0x6607('0x10')]);router[_0x6607('0x11')](_0x6607('0xd'),auth[_0x6607('0x8')](),controller[_0x6607('0x12')]);module[_0x6607('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 6aa23c7..5bed910 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 _0x9e5e=['exports','medium','BOOLEAN','out','DATE','STRING','sequelize'];(function(_0x3c7cca,_0x3f9621){var _0x5c08cd=function(_0x21a761){while(--_0x21a761){_0x3c7cca['push'](_0x3c7cca['shift']());}};_0x5c08cd(++_0x3f9621);}(_0x9e5e,0x1e2));var _0xe9e5=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0x9e5e[_0x56916d];return _0x2b7f1f;};'use strict';var Sequelize=require(_0xe9e5('0x0'));module[_0xe9e5('0x1')]={'body':{'type':Sequelize['TEXT'](_0xe9e5('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xe9e5('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xe9e5('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xe9e5('0x4')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xe9e5('0x5')]},'providerName':{'type':Sequelize[_0xe9e5('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x337f=['BOOLEAN','ENUM','out','DATE','sequelize','exports','TEXT'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0x337f,0x11c));var _0xf337=function(_0x2f229a,_0x542731){_0x2f229a=_0x2f229a-0x0;var _0xdd2c1f=_0x337f[_0x2f229a];return _0xdd2c1f;};'use strict';var Sequelize=require(_0xf337('0x0'));module[_0xf337('0x1')]={'body':{'type':Sequelize[_0xf337('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xf337('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xf337('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf337('0x4')]('in','out'),'defaultValue':_0xf337('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xf337('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xf337('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 11113c9..ae8f211 100644 --- a/server/api/chatMessage/chatMessage.controller.js +++ b/server/api/chatMessage/chatMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','contact','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','chat-interactions','chat','ChatInteraction','RejectMessage','rejectMessage','Sequelize','QueryTypes','SELECT','fullname','rejectmessage','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatMessage.socket','register','jayson/promise','client','http','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','stack','name','send','map','ChatMessage','fieldName','type','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','body','find','describe','../../config/logger','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','ChatInteractionId','isNil','read1stAt','format'];(function(_0x5cb7b0,_0x3b5793){var _0x448a44=function(_0x429bee){while(--_0x429bee){_0x5cb7b0['push'](_0x5cb7b0['shift']());}};_0x448a44(++_0x3b5793);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);var jayson=require(_0x0a9e('0x1a'));var client=jayson[_0x0a9e('0x1b')][_0x0a9e('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0x0a9e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5d0880,_0x1985b6,_0x519dfd,_0x16033c){return new BPromise(function(_0x12066b,_0x48f32d){var _0x225616=_0x16033c||client;return _0x225616['request'](_0x5d0880,_0x519dfd)[_0x0a9e('0x1d')](function(_0x478723){logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x1985b6,_0x0a9e('0x20'));logger[_0x0a9e('0x21')](_0x0a9e('0x22'),_0x1985b6,_0x0a9e('0x20'),JSON[_0x0a9e('0x23')](_0x478723));if(_0x478723[_0x0a9e('0x24')]){if(_0x478723[_0x0a9e('0x24')][_0x0a9e('0x25')]===0x1f4){logger['error'](_0x0a9e('0x1f'),_0x1985b6,_0x478723[_0x0a9e('0x24')]['message']);return _0x48f32d(_0x478723[_0x0a9e('0x24')]['message']);}logger['error'](_0x0a9e('0x1f'),_0x1985b6,_0x478723[_0x0a9e('0x24')][_0x0a9e('0x26')]);return _0x12066b(_0x478723[_0x0a9e('0x24')]['message']);}else{logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x1985b6,_0x0a9e('0x20'));_0x12066b(_0x478723[_0x0a9e('0x27')][_0x0a9e('0x26')]);}})[_0x0a9e('0x28')](function(_0x16b1ca){logger['error']('ChatMessage,\x20%s,\x20%s',_0x1985b6,_0x16b1ca);_0x48f32d(_0x16b1ca);});});}function respondWithStatusCode(_0x197ec0,_0x3a8e58){_0x3a8e58=_0x3a8e58||0xcc;return function(_0x40c424){if(_0x40c424){return _0x197ec0[_0x0a9e('0x29')](_0x3a8e58);}return _0x197ec0['status'](_0x3a8e58)[_0x0a9e('0x2a')]();};}function respondWithResult(_0x479bc4,_0x45a1e7){_0x45a1e7=_0x45a1e7||0xc8;return function(_0x5bfb33){if(_0x5bfb33){return _0x479bc4[_0x0a9e('0x2b')](_0x45a1e7)[_0x0a9e('0x2c')](_0x5bfb33);}};}function respondWithFilteredResult(_0x25fba9,_0x14433c){return function(_0x140511){if(_0x140511){var _0x1538a4=typeof _0x14433c[_0x0a9e('0x2d')]===_0x0a9e('0x2e')&&typeof _0x14433c['limit']===_0x0a9e('0x2e');var _0x468813=_0x140511[_0x0a9e('0x2f')];var _0x2ec755=_0x1538a4?0x0:_0x14433c['offset'];var _0x15b200=_0x1538a4?_0x140511[_0x0a9e('0x2f')]:_0x14433c[_0x0a9e('0x2d')]+_0x14433c[_0x0a9e('0x30')];var _0x58b06f;if(_0x15b200>=_0x468813){_0x15b200=_0x468813;_0x58b06f=0xc8;}else{_0x58b06f=0xce;}_0x25fba9[_0x0a9e('0x2b')](_0x58b06f);return _0x25fba9[_0x0a9e('0x31')](_0x0a9e('0x32'),_0x2ec755+'-'+_0x15b200+'/'+_0x468813)[_0x0a9e('0x2c')](_0x140511);}return null;};}function patchUpdates(_0x540530){return function(_0x426950){try{jsonpatch['apply'](_0x426950,_0x540530,!![]);}catch(_0x2407f9){return BPromise[_0x0a9e('0x33')](_0x2407f9);}return _0x426950[_0x0a9e('0x34')]();};}function saveUpdates(_0x33bdb7,_0x25ce3a){return function(_0x5180f1){if(_0x5180f1){return _0x5180f1[_0x0a9e('0x35')](_0x33bdb7)[_0x0a9e('0x1d')](function(_0x40cb85){return _0x40cb85;});}return null;};}function removeEntity(_0x2da5c0,_0x2b45ea){return function(_0x409319){if(_0x409319){return _0x409319[_0x0a9e('0x36')]()[_0x0a9e('0x1d')](function(){_0x2da5c0['status'](0xcc)[_0x0a9e('0x2a')]();});}};}function handleEntityNotFound(_0x5e7238,_0x2cc7a0){return function(_0x14b13f){if(!_0x14b13f){_0x5e7238[_0x0a9e('0x29')](0x194);}return _0x14b13f;};}function handleError(_0x3f3d41,_0x567193){_0x567193=_0x567193||0x1f4;return function(_0x191e91){logger[_0x0a9e('0x24')](_0x191e91[_0x0a9e('0x37')]);if(_0x191e91[_0x0a9e('0x38')]){delete _0x191e91['name'];}_0x3f3d41['status'](_0x567193)[_0x0a9e('0x39')](_0x191e91);};}exports['index']=function(_0x24936a,_0x3d9717){var _0x381c37={},_0x1ef87a={},_0x4f41ae={'count':0x0,'rows':[]};var _0x31916f=_[_0x0a9e('0x3a')](db[_0x0a9e('0x3b')]['rawAttributes'],function(_0x1dbf74){return{'name':_0x1dbf74[_0x0a9e('0x3c')],'type':_0x1dbf74[_0x0a9e('0x3d')]['key']};});_0x1ef87a['model']=_[_0x0a9e('0x3a')](_0x31916f,_0x0a9e('0x38'));_0x1ef87a['query']=_[_0x0a9e('0x3e')](_0x24936a[_0x0a9e('0x3f')]);_0x1ef87a[_0x0a9e('0x40')]=_[_0x0a9e('0x41')](_0x1ef87a['model'],_0x1ef87a['query']);_0x381c37[_0x0a9e('0x42')]=_[_0x0a9e('0x41')](_0x1ef87a['model'],qs[_0x0a9e('0x43')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x381c37['attributes']=_0x381c37[_0x0a9e('0x42')][_0x0a9e('0x44')]?_0x381c37[_0x0a9e('0x42')]:_0x1ef87a[_0x0a9e('0x45')];if(!_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x46')](_0x0a9e('0x47'))){_0x381c37[_0x0a9e('0x30')]=qs[_0x0a9e('0x30')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x30')]);_0x381c37[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x2d')]);}_0x381c37['order']=qs['sort'](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x48')]);_0x381c37[_0x0a9e('0x49')]=qs[_0x0a9e('0x40')](_[_0x0a9e('0x4a')](_0x24936a[_0x0a9e('0x3f')],_0x1ef87a[_0x0a9e('0x40')]),_0x31916f);if(_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4b')]){_0x381c37[_0x0a9e('0x49')]=_[_0x0a9e('0x4c')](_0x381c37[_0x0a9e('0x49')],{'$or':_['map'](_0x31916f,function(_0x117c99){if(_0x117c99[_0x0a9e('0x3d')]!==_0x0a9e('0x4d')){var _0xfbd5ad={};_0xfbd5ad[_0x117c99[_0x0a9e('0x38')]]={'$like':'%'+_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4b')]+'%'};return _0xfbd5ad;}})});}_0x381c37=_[_0x0a9e('0x4c')]({},_0x381c37,_0x24936a['options']);var _0x2e9d90={'where':_0x381c37['where']};return db[_0x0a9e('0x3b')][_0x0a9e('0x2f')](_0x2e9d90)[_0x0a9e('0x1d')](function(_0x562fb4){_0x4f41ae[_0x0a9e('0x2f')]=_0x562fb4;if(_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4e')]){_0x381c37[_0x0a9e('0x4f')]=[{'all':!![]}];}return db[_0x0a9e('0x3b')][_0x0a9e('0x50')](_0x381c37);})[_0x0a9e('0x1d')](function(_0x5bbcde){_0x4f41ae[_0x0a9e('0x51')]=_0x5bbcde;return _0x4f41ae;})[_0x0a9e('0x1d')](respondWithFilteredResult(_0x3d9717,_0x381c37))[_0x0a9e('0x28')](handleError(_0x3d9717,null));};exports[_0x0a9e('0x52')]=function(_0x409789,_0x992c77){var _0x6054ee={'raw':!![],'where':{'id':_0x409789[_0x0a9e('0x53')]['id']}},_0x19383e={};_0x19383e['model']=_[_0x0a9e('0x3e')](db[_0x0a9e('0x3b')]['rawAttributes']);_0x19383e['query']=_['keys'](_0x409789[_0x0a9e('0x3f')]);_0x19383e[_0x0a9e('0x40')]=_[_0x0a9e('0x41')](_0x19383e[_0x0a9e('0x45')],_0x19383e[_0x0a9e('0x3f')]);_0x6054ee[_0x0a9e('0x42')]=_[_0x0a9e('0x41')](_0x19383e[_0x0a9e('0x45')],qs['fields'](_0x409789['query']['fields']));_0x6054ee[_0x0a9e('0x42')]=_0x6054ee[_0x0a9e('0x42')][_0x0a9e('0x44')]?_0x6054ee['attributes']:_0x19383e[_0x0a9e('0x45')];if(_0x409789[_0x0a9e('0x3f')]['includeAll']){_0x6054ee['include']=[{'all':!![]}];}_0x6054ee=_[_0x0a9e('0x4c')]({},_0x6054ee,_0x409789['options']);return db[_0x0a9e('0x3b')]['find'](_0x6054ee)[_0x0a9e('0x1d')](handleEntityNotFound(_0x992c77,null))[_0x0a9e('0x1d')](respondWithResult(_0x992c77,null))[_0x0a9e('0x28')](handleError(_0x992c77,null));};exports['create']=function(_0x2f82da,_0x1bf38a){return db['ChatMessage']['create'](_0x2f82da[_0x0a9e('0x54')],{})[_0x0a9e('0x1d')](respondWithResult(_0x1bf38a,0xc9))['catch'](handleError(_0x1bf38a,null));};exports[_0x0a9e('0x35')]=function(_0x5ce9ac,_0x211ef9){if(_0x5ce9ac['body']['id']){delete _0x5ce9ac[_0x0a9e('0x54')]['id'];}return db['ChatMessage']['find']({'where':{'id':_0x5ce9ac['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x211ef9,null))['then'](saveUpdates(_0x5ce9ac[_0x0a9e('0x54')],null))[_0x0a9e('0x1d')](respondWithResult(_0x211ef9,null))[_0x0a9e('0x28')](handleError(_0x211ef9,null));};exports[_0x0a9e('0x36')]=function(_0x232830,_0x272738){return db[_0x0a9e('0x3b')][_0x0a9e('0x55')]({'where':{'id':_0x232830['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x272738,null))[_0x0a9e('0x1d')](removeEntity(_0x272738,null))[_0x0a9e('0x28')](handleError(_0x272738,null));};exports[_0x0a9e('0x56')]=function(_0xb83dfd,_0x156662){return db['ChatMessage'][_0x0a9e('0x56')]()[_0x0a9e('0x1d')](respondWithResult(_0x156662,null))['catch'](handleError(_0x156662,null));};var interaction_log=require(_0x0a9e('0x57'))('chat-interactions');exports[_0x0a9e('0x58')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee){var _0x273cb5={'agent':{},'channel':'chat'};if(_0x5ba1f9[_0x0a9e('0x54')]['id']){delete _0x5ba1f9[_0x0a9e('0x54')]['id'];}_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x59')]=!![];_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5a')]=moment()['format'](_0x0a9e('0x5b'));_0x5ba1f9['body'][_0x0a9e('0x5c')]=_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')]||_0x5ba1f9['user']['id'];_0x273cb5[_0x0a9e('0x5d')]['id']=_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x5ba1f9[_0x0a9e('0x53')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))['then'](saveUpdates(_0x5ba1f9[_0x0a9e('0x54')],null))[_0x0a9e('0x1d')](function(_0x88dcbf){if(_0x88dcbf){_0x273cb5[_0x0a9e('0x26')]=_0x88dcbf[_0x0a9e('0x5e')]({'plain':!![]});return db['ChatInteraction'][_0x0a9e('0x55')]({'where':{'id':_0x88dcbf[_0x0a9e('0x5f')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))['then'](function(_0x3528b7){if(_0x3528b7){return _0x3528b7['update']({'UserId':_0x5ba1f9['body'][_0x0a9e('0x5c')],'read1stAt':_[_0x0a9e('0x60')](_0x3528b7[_0x0a9e('0x61')])?moment()[_0x0a9e('0x62')](_0x0a9e('0x5b')):undefined});}return null;})[_0x0a9e('0x1d')](function(_0x387489){if(_0x387489){_0x273cb5[_0x0a9e('0x63')]=_0x387489[_0x0a9e('0x5e')]({'plain':!![]});interaction_log[_0x0a9e('0x1e')](_0x0a9e('0x64'),_0x5ba1f9[_0x0a9e('0x65')]['id'],_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x38')],_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x66')],_0x273cb5[_0x0a9e('0x63')]['id'],_0x5ba1f9[_0x0a9e('0x54')]?JSON['stringify'](_0x5ba1f9[_0x0a9e('0x54')]):_0x0a9e('0x67'));return respondWithRpcPromise(_0x0a9e('0x68'),'acceptMessage',_0x273cb5);}return null;})[_0x0a9e('0x1d')](function(_0x30944e){var _0x4b341d=_0x0a9e('0x69')+_0x30944e[_0x0a9e('0x26')][_0x0a9e('0x6a')];return db[_0x0a9e('0x6b')][_0x0a9e('0x3f')](_0x4b341d,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x0a9e('0x1d')](function(_0x18bf5d){return _0x18bf5d;});})[_0x0a9e('0x1d')](function(_0x23a7d3){if(_0x23a7d3){_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x6c')]=_0x23a7d3[0x0];if(!_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')])return;return db['User'][_0x0a9e('0x55')]({'where':{'id':_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')],'role':'agent'},'attributes':['id',_0x0a9e('0x38'),'fullname',_0x0a9e('0x6d'),_0x0a9e('0x6e')],'raw':!![]});}return null;})['then'](function(_0x2ed01e){if(!_0x2ed01e)return null;_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x5d')]=_0x2ed01e;return _0x273cb5;})[_0x0a9e('0x1d')](function(_0x542ece){if(_0x542ece){if(_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x6f')]){_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x70')]=util['format'](_0x0a9e('0x71'),_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x38')]);_0x273cb5[_0x0a9e('0x26')]['channel']=_0x273cb5[_0x0a9e('0x72')];_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x73')]=_0x0a9e('0x58');return respondWithRpcPromise(_0x0a9e('0x74'),_0x0a9e('0x74'),{'event':_0x0a9e('0x75'),'message':_[_0x0a9e('0x4c')](_0x273cb5[_0x0a9e('0x26')],JSON[_0x0a9e('0x76')](_0x273cb5[_0x0a9e('0x63')][_0x0a9e('0x77')]))},client9002)[_0x0a9e('0x1d')](function(){return _0x273cb5;});}return _0x273cb5;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x4b3c1a,null))['catch'](handleError(_0x4b3c1a,null));};var interaction_log=require(_0x0a9e('0x57'))(_0x0a9e('0x78'));exports[_0x0a9e('0x33')]=function(_0x563627,_0x3736e0,_0x33dda0){var _0x8cea96={'agent':{},'channel':_0x0a9e('0x79')};if(_0x563627['body']['id']){delete _0x563627['body']['id'];}_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')]=_0x563627['body'][_0x0a9e('0x5c')]||_0x563627['user']['id'];_0x8cea96[_0x0a9e('0x5d')]['id']=_0x563627[_0x0a9e('0x54')]['UserId'];return db[_0x0a9e('0x3b')][_0x0a9e('0x55')]({'where':{'id':_0x563627[_0x0a9e('0x53')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x3736e0,null))[_0x0a9e('0x1d')](function(_0x1f42a0){if(_0x1f42a0){_0x8cea96[_0x0a9e('0x26')]=_0x1f42a0['get']({'plain':!![]});return db[_0x0a9e('0x7a')][_0x0a9e('0x55')]({'where':{'id':_0x1f42a0[_0x0a9e('0x5f')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x3736e0,null))['then'](function(_0xf51744){if(_0xf51744){_0x8cea96[_0x0a9e('0x63')]=_0xf51744['get']({'plain':!![]});interaction_log[_0x0a9e('0x1e')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x563627[_0x0a9e('0x65')]['id'],_0x563627[_0x0a9e('0x65')][_0x0a9e('0x38')],_0x563627[_0x0a9e('0x65')]['role'],_0x8cea96['interaction']['id'],_0x563627[_0x0a9e('0x54')]?JSON[_0x0a9e('0x23')](_0x563627[_0x0a9e('0x54')]):'null');return respondWithRpcPromise(_0x0a9e('0x7b'),_0x0a9e('0x7c'),_0x8cea96);}return null;})['then'](function(_0x4e46b2){var _0xf0a802='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4e46b2['message']['ContactId'];return db[_0x0a9e('0x6b')][_0x0a9e('0x3f')](_0xf0a802,{'type':db[_0x0a9e('0x7d')][_0x0a9e('0x7e')][_0x0a9e('0x7f')],'raw':!![]})[_0x0a9e('0x1d')](function(_0x5a8854){return _0x5a8854;});})[_0x0a9e('0x1d')](function(_0x5955f1){if(_0x5955f1){_0x8cea96[_0x0a9e('0x26')][_0x0a9e('0x6c')]=_0x5955f1[0x0];if(!_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')])return;return db['User'][_0x0a9e('0x55')]({'where':{'id':_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')],'role':'agent'},'attributes':['id',_0x0a9e('0x38'),_0x0a9e('0x80'),_0x0a9e('0x6d'),_0x0a9e('0x6e')],'raw':!![]});}return null;})[_0x0a9e('0x1d')](function(_0x1910bf){if(!_0x1910bf)return null;_0x8cea96[_0x0a9e('0x26')][_0x0a9e('0x5d')]=_0x1910bf;return _0x8cea96;})['then'](function(_0x2645d6){if(_0x2645d6){_0x2645d6[_0x0a9e('0x26')]['interface']=util[_0x0a9e('0x62')](_0x0a9e('0x71'),_0x563627[_0x0a9e('0x65')]['name']);_0x2645d6[_0x0a9e('0x26')]['channel']=_0x8cea96[_0x0a9e('0x72')];_0x2645d6[_0x0a9e('0x26')][_0x0a9e('0x73')]=_0x0a9e('0x33');respondWithRpcPromise(_0x0a9e('0x74'),_0x0a9e('0x74'),{'event':_0x0a9e('0x81'),'message':_[_0x0a9e('0x4c')](_0x8cea96['message'],JSON[_0x0a9e('0x76')](_0x8cea96[_0x0a9e('0x63')][_0x0a9e('0x77')]))},client9002);return _0x8cea96;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x3736e0,null))[_0x0a9e('0x28')](handleError(_0x3736e0,null));}; \ No newline at end of file +var _0xa9e0=['interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','contact','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','chat-interactions','chat','ChatInteraction','RejectMessage','rejectMessage','Sequelize','QueryTypes','SELECT','fullname','rejectmessage','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatMessage.socket','register','jayson/promise','client','http','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','stack','name','send','map','ChatMessage','fieldName','type','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','body','find','describe','../../config/logger','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','ChatInteractionId','isNil','read1stAt','format'];(function(_0x3da312,_0x391ccd){var _0x28fb08=function(_0x1792bf){while(--_0x1792bf){_0x3da312['push'](_0x3da312['shift']());}};_0x28fb08(++_0x391ccd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);var jayson=require(_0x0a9e('0x1a'));var client=jayson[_0x0a9e('0x1b')][_0x0a9e('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0x0a9e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5d0880,_0x1985b6,_0x519dfd,_0x16033c){return new BPromise(function(_0x12066b,_0x48f32d){var _0x225616=_0x16033c||client;return _0x225616['request'](_0x5d0880,_0x519dfd)[_0x0a9e('0x1d')](function(_0x478723){logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x1985b6,_0x0a9e('0x20'));logger[_0x0a9e('0x21')](_0x0a9e('0x22'),_0x1985b6,_0x0a9e('0x20'),JSON[_0x0a9e('0x23')](_0x478723));if(_0x478723[_0x0a9e('0x24')]){if(_0x478723[_0x0a9e('0x24')][_0x0a9e('0x25')]===0x1f4){logger['error'](_0x0a9e('0x1f'),_0x1985b6,_0x478723[_0x0a9e('0x24')]['message']);return _0x48f32d(_0x478723[_0x0a9e('0x24')]['message']);}logger['error'](_0x0a9e('0x1f'),_0x1985b6,_0x478723[_0x0a9e('0x24')][_0x0a9e('0x26')]);return _0x12066b(_0x478723[_0x0a9e('0x24')]['message']);}else{logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x1985b6,_0x0a9e('0x20'));_0x12066b(_0x478723[_0x0a9e('0x27')][_0x0a9e('0x26')]);}})[_0x0a9e('0x28')](function(_0x16b1ca){logger['error']('ChatMessage,\x20%s,\x20%s',_0x1985b6,_0x16b1ca);_0x48f32d(_0x16b1ca);});});}function respondWithStatusCode(_0x197ec0,_0x3a8e58){_0x3a8e58=_0x3a8e58||0xcc;return function(_0x40c424){if(_0x40c424){return _0x197ec0[_0x0a9e('0x29')](_0x3a8e58);}return _0x197ec0['status'](_0x3a8e58)[_0x0a9e('0x2a')]();};}function respondWithResult(_0x479bc4,_0x45a1e7){_0x45a1e7=_0x45a1e7||0xc8;return function(_0x5bfb33){if(_0x5bfb33){return _0x479bc4[_0x0a9e('0x2b')](_0x45a1e7)[_0x0a9e('0x2c')](_0x5bfb33);}};}function respondWithFilteredResult(_0x25fba9,_0x14433c){return function(_0x140511){if(_0x140511){var _0x1538a4=typeof _0x14433c[_0x0a9e('0x2d')]===_0x0a9e('0x2e')&&typeof _0x14433c['limit']===_0x0a9e('0x2e');var _0x468813=_0x140511[_0x0a9e('0x2f')];var _0x2ec755=_0x1538a4?0x0:_0x14433c['offset'];var _0x15b200=_0x1538a4?_0x140511[_0x0a9e('0x2f')]:_0x14433c[_0x0a9e('0x2d')]+_0x14433c[_0x0a9e('0x30')];var _0x58b06f;if(_0x15b200>=_0x468813){_0x15b200=_0x468813;_0x58b06f=0xc8;}else{_0x58b06f=0xce;}_0x25fba9[_0x0a9e('0x2b')](_0x58b06f);return _0x25fba9[_0x0a9e('0x31')](_0x0a9e('0x32'),_0x2ec755+'-'+_0x15b200+'/'+_0x468813)[_0x0a9e('0x2c')](_0x140511);}return null;};}function patchUpdates(_0x540530){return function(_0x426950){try{jsonpatch['apply'](_0x426950,_0x540530,!![]);}catch(_0x2407f9){return BPromise[_0x0a9e('0x33')](_0x2407f9);}return _0x426950[_0x0a9e('0x34')]();};}function saveUpdates(_0x33bdb7,_0x25ce3a){return function(_0x5180f1){if(_0x5180f1){return _0x5180f1[_0x0a9e('0x35')](_0x33bdb7)[_0x0a9e('0x1d')](function(_0x40cb85){return _0x40cb85;});}return null;};}function removeEntity(_0x2da5c0,_0x2b45ea){return function(_0x409319){if(_0x409319){return _0x409319[_0x0a9e('0x36')]()[_0x0a9e('0x1d')](function(){_0x2da5c0['status'](0xcc)[_0x0a9e('0x2a')]();});}};}function handleEntityNotFound(_0x5e7238,_0x2cc7a0){return function(_0x14b13f){if(!_0x14b13f){_0x5e7238[_0x0a9e('0x29')](0x194);}return _0x14b13f;};}function handleError(_0x3f3d41,_0x567193){_0x567193=_0x567193||0x1f4;return function(_0x191e91){logger[_0x0a9e('0x24')](_0x191e91[_0x0a9e('0x37')]);if(_0x191e91[_0x0a9e('0x38')]){delete _0x191e91['name'];}_0x3f3d41['status'](_0x567193)[_0x0a9e('0x39')](_0x191e91);};}exports['index']=function(_0x24936a,_0x3d9717){var _0x381c37={},_0x1ef87a={},_0x4f41ae={'count':0x0,'rows':[]};var _0x31916f=_[_0x0a9e('0x3a')](db[_0x0a9e('0x3b')]['rawAttributes'],function(_0x1dbf74){return{'name':_0x1dbf74[_0x0a9e('0x3c')],'type':_0x1dbf74[_0x0a9e('0x3d')]['key']};});_0x1ef87a['model']=_[_0x0a9e('0x3a')](_0x31916f,_0x0a9e('0x38'));_0x1ef87a['query']=_[_0x0a9e('0x3e')](_0x24936a[_0x0a9e('0x3f')]);_0x1ef87a[_0x0a9e('0x40')]=_[_0x0a9e('0x41')](_0x1ef87a['model'],_0x1ef87a['query']);_0x381c37[_0x0a9e('0x42')]=_[_0x0a9e('0x41')](_0x1ef87a['model'],qs[_0x0a9e('0x43')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x381c37['attributes']=_0x381c37[_0x0a9e('0x42')][_0x0a9e('0x44')]?_0x381c37[_0x0a9e('0x42')]:_0x1ef87a[_0x0a9e('0x45')];if(!_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x46')](_0x0a9e('0x47'))){_0x381c37[_0x0a9e('0x30')]=qs[_0x0a9e('0x30')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x30')]);_0x381c37[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x2d')]);}_0x381c37['order']=qs['sort'](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x48')]);_0x381c37[_0x0a9e('0x49')]=qs[_0x0a9e('0x40')](_[_0x0a9e('0x4a')](_0x24936a[_0x0a9e('0x3f')],_0x1ef87a[_0x0a9e('0x40')]),_0x31916f);if(_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4b')]){_0x381c37[_0x0a9e('0x49')]=_[_0x0a9e('0x4c')](_0x381c37[_0x0a9e('0x49')],{'$or':_['map'](_0x31916f,function(_0x117c99){if(_0x117c99[_0x0a9e('0x3d')]!==_0x0a9e('0x4d')){var _0xfbd5ad={};_0xfbd5ad[_0x117c99[_0x0a9e('0x38')]]={'$like':'%'+_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4b')]+'%'};return _0xfbd5ad;}})});}_0x381c37=_[_0x0a9e('0x4c')]({},_0x381c37,_0x24936a['options']);var _0x2e9d90={'where':_0x381c37['where']};return db[_0x0a9e('0x3b')][_0x0a9e('0x2f')](_0x2e9d90)[_0x0a9e('0x1d')](function(_0x562fb4){_0x4f41ae[_0x0a9e('0x2f')]=_0x562fb4;if(_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4e')]){_0x381c37[_0x0a9e('0x4f')]=[{'all':!![]}];}return db[_0x0a9e('0x3b')][_0x0a9e('0x50')](_0x381c37);})[_0x0a9e('0x1d')](function(_0x5bbcde){_0x4f41ae[_0x0a9e('0x51')]=_0x5bbcde;return _0x4f41ae;})[_0x0a9e('0x1d')](respondWithFilteredResult(_0x3d9717,_0x381c37))[_0x0a9e('0x28')](handleError(_0x3d9717,null));};exports[_0x0a9e('0x52')]=function(_0x409789,_0x992c77){var _0x6054ee={'raw':!![],'where':{'id':_0x409789[_0x0a9e('0x53')]['id']}},_0x19383e={};_0x19383e['model']=_[_0x0a9e('0x3e')](db[_0x0a9e('0x3b')]['rawAttributes']);_0x19383e['query']=_['keys'](_0x409789[_0x0a9e('0x3f')]);_0x19383e[_0x0a9e('0x40')]=_[_0x0a9e('0x41')](_0x19383e[_0x0a9e('0x45')],_0x19383e[_0x0a9e('0x3f')]);_0x6054ee[_0x0a9e('0x42')]=_[_0x0a9e('0x41')](_0x19383e[_0x0a9e('0x45')],qs['fields'](_0x409789['query']['fields']));_0x6054ee[_0x0a9e('0x42')]=_0x6054ee[_0x0a9e('0x42')][_0x0a9e('0x44')]?_0x6054ee['attributes']:_0x19383e[_0x0a9e('0x45')];if(_0x409789[_0x0a9e('0x3f')]['includeAll']){_0x6054ee['include']=[{'all':!![]}];}_0x6054ee=_[_0x0a9e('0x4c')]({},_0x6054ee,_0x409789['options']);return db[_0x0a9e('0x3b')]['find'](_0x6054ee)[_0x0a9e('0x1d')](handleEntityNotFound(_0x992c77,null))[_0x0a9e('0x1d')](respondWithResult(_0x992c77,null))[_0x0a9e('0x28')](handleError(_0x992c77,null));};exports['create']=function(_0x2f82da,_0x1bf38a){return db['ChatMessage']['create'](_0x2f82da[_0x0a9e('0x54')],{})[_0x0a9e('0x1d')](respondWithResult(_0x1bf38a,0xc9))['catch'](handleError(_0x1bf38a,null));};exports[_0x0a9e('0x35')]=function(_0x5ce9ac,_0x211ef9){if(_0x5ce9ac['body']['id']){delete _0x5ce9ac[_0x0a9e('0x54')]['id'];}return db['ChatMessage']['find']({'where':{'id':_0x5ce9ac['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x211ef9,null))['then'](saveUpdates(_0x5ce9ac[_0x0a9e('0x54')],null))[_0x0a9e('0x1d')](respondWithResult(_0x211ef9,null))[_0x0a9e('0x28')](handleError(_0x211ef9,null));};exports[_0x0a9e('0x36')]=function(_0x232830,_0x272738){return db[_0x0a9e('0x3b')][_0x0a9e('0x55')]({'where':{'id':_0x232830['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x272738,null))[_0x0a9e('0x1d')](removeEntity(_0x272738,null))[_0x0a9e('0x28')](handleError(_0x272738,null));};exports[_0x0a9e('0x56')]=function(_0xb83dfd,_0x156662){return db['ChatMessage'][_0x0a9e('0x56')]()[_0x0a9e('0x1d')](respondWithResult(_0x156662,null))['catch'](handleError(_0x156662,null));};var interaction_log=require(_0x0a9e('0x57'))('chat-interactions');exports[_0x0a9e('0x58')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee){var _0x273cb5={'agent':{},'channel':'chat'};if(_0x5ba1f9[_0x0a9e('0x54')]['id']){delete _0x5ba1f9[_0x0a9e('0x54')]['id'];}_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x59')]=!![];_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5a')]=moment()['format'](_0x0a9e('0x5b'));_0x5ba1f9['body'][_0x0a9e('0x5c')]=_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')]||_0x5ba1f9['user']['id'];_0x273cb5[_0x0a9e('0x5d')]['id']=_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x5ba1f9[_0x0a9e('0x53')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))['then'](saveUpdates(_0x5ba1f9[_0x0a9e('0x54')],null))[_0x0a9e('0x1d')](function(_0x88dcbf){if(_0x88dcbf){_0x273cb5[_0x0a9e('0x26')]=_0x88dcbf[_0x0a9e('0x5e')]({'plain':!![]});return db['ChatInteraction'][_0x0a9e('0x55')]({'where':{'id':_0x88dcbf[_0x0a9e('0x5f')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))['then'](function(_0x3528b7){if(_0x3528b7){return _0x3528b7['update']({'UserId':_0x5ba1f9['body'][_0x0a9e('0x5c')],'read1stAt':_[_0x0a9e('0x60')](_0x3528b7[_0x0a9e('0x61')])?moment()[_0x0a9e('0x62')](_0x0a9e('0x5b')):undefined});}return null;})[_0x0a9e('0x1d')](function(_0x387489){if(_0x387489){_0x273cb5[_0x0a9e('0x63')]=_0x387489[_0x0a9e('0x5e')]({'plain':!![]});interaction_log[_0x0a9e('0x1e')](_0x0a9e('0x64'),_0x5ba1f9[_0x0a9e('0x65')]['id'],_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x38')],_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x66')],_0x273cb5[_0x0a9e('0x63')]['id'],_0x5ba1f9[_0x0a9e('0x54')]?JSON['stringify'](_0x5ba1f9[_0x0a9e('0x54')]):_0x0a9e('0x67'));return respondWithRpcPromise(_0x0a9e('0x68'),'acceptMessage',_0x273cb5);}return null;})[_0x0a9e('0x1d')](function(_0x30944e){var _0x4b341d=_0x0a9e('0x69')+_0x30944e[_0x0a9e('0x26')][_0x0a9e('0x6a')];return db[_0x0a9e('0x6b')][_0x0a9e('0x3f')](_0x4b341d,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x0a9e('0x1d')](function(_0x18bf5d){return _0x18bf5d;});})[_0x0a9e('0x1d')](function(_0x23a7d3){if(_0x23a7d3){_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x6c')]=_0x23a7d3[0x0];if(!_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')])return;return db['User'][_0x0a9e('0x55')]({'where':{'id':_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')],'role':'agent'},'attributes':['id',_0x0a9e('0x38'),'fullname',_0x0a9e('0x6d'),_0x0a9e('0x6e')],'raw':!![]});}return null;})['then'](function(_0x2ed01e){if(!_0x2ed01e)return null;_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x5d')]=_0x2ed01e;return _0x273cb5;})[_0x0a9e('0x1d')](function(_0x542ece){if(_0x542ece){if(_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x6f')]){_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x70')]=util['format'](_0x0a9e('0x71'),_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x38')]);_0x273cb5[_0x0a9e('0x26')]['channel']=_0x273cb5[_0x0a9e('0x72')];_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x73')]=_0x0a9e('0x58');return respondWithRpcPromise(_0x0a9e('0x74'),_0x0a9e('0x74'),{'event':_0x0a9e('0x75'),'message':_[_0x0a9e('0x4c')](_0x273cb5[_0x0a9e('0x26')],JSON[_0x0a9e('0x76')](_0x273cb5[_0x0a9e('0x63')][_0x0a9e('0x77')]))},client9002)[_0x0a9e('0x1d')](function(){return _0x273cb5;});}return _0x273cb5;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x4b3c1a,null))['catch'](handleError(_0x4b3c1a,null));};var interaction_log=require(_0x0a9e('0x57'))(_0x0a9e('0x78'));exports[_0x0a9e('0x33')]=function(_0x563627,_0x3736e0,_0x33dda0){var _0x8cea96={'agent':{},'channel':_0x0a9e('0x79')};if(_0x563627['body']['id']){delete _0x563627['body']['id'];}_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')]=_0x563627['body'][_0x0a9e('0x5c')]||_0x563627['user']['id'];_0x8cea96[_0x0a9e('0x5d')]['id']=_0x563627[_0x0a9e('0x54')]['UserId'];return db[_0x0a9e('0x3b')][_0x0a9e('0x55')]({'where':{'id':_0x563627[_0x0a9e('0x53')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x3736e0,null))[_0x0a9e('0x1d')](function(_0x1f42a0){if(_0x1f42a0){_0x8cea96[_0x0a9e('0x26')]=_0x1f42a0['get']({'plain':!![]});return db[_0x0a9e('0x7a')][_0x0a9e('0x55')]({'where':{'id':_0x1f42a0[_0x0a9e('0x5f')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x3736e0,null))['then'](function(_0xf51744){if(_0xf51744){_0x8cea96[_0x0a9e('0x63')]=_0xf51744['get']({'plain':!![]});interaction_log[_0x0a9e('0x1e')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x563627[_0x0a9e('0x65')]['id'],_0x563627[_0x0a9e('0x65')][_0x0a9e('0x38')],_0x563627[_0x0a9e('0x65')]['role'],_0x8cea96['interaction']['id'],_0x563627[_0x0a9e('0x54')]?JSON[_0x0a9e('0x23')](_0x563627[_0x0a9e('0x54')]):'null');return respondWithRpcPromise(_0x0a9e('0x7b'),_0x0a9e('0x7c'),_0x8cea96);}return null;})['then'](function(_0x4e46b2){var _0xf0a802='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4e46b2['message']['ContactId'];return db[_0x0a9e('0x6b')][_0x0a9e('0x3f')](_0xf0a802,{'type':db[_0x0a9e('0x7d')][_0x0a9e('0x7e')][_0x0a9e('0x7f')],'raw':!![]})[_0x0a9e('0x1d')](function(_0x5a8854){return _0x5a8854;});})[_0x0a9e('0x1d')](function(_0x5955f1){if(_0x5955f1){_0x8cea96[_0x0a9e('0x26')][_0x0a9e('0x6c')]=_0x5955f1[0x0];if(!_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')])return;return db['User'][_0x0a9e('0x55')]({'where':{'id':_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')],'role':'agent'},'attributes':['id',_0x0a9e('0x38'),_0x0a9e('0x80'),_0x0a9e('0x6d'),_0x0a9e('0x6e')],'raw':!![]});}return null;})[_0x0a9e('0x1d')](function(_0x1910bf){if(!_0x1910bf)return null;_0x8cea96[_0x0a9e('0x26')][_0x0a9e('0x5d')]=_0x1910bf;return _0x8cea96;})['then'](function(_0x2645d6){if(_0x2645d6){_0x2645d6[_0x0a9e('0x26')]['interface']=util[_0x0a9e('0x62')](_0x0a9e('0x71'),_0x563627[_0x0a9e('0x65')]['name']);_0x2645d6[_0x0a9e('0x26')]['channel']=_0x8cea96[_0x0a9e('0x72')];_0x2645d6[_0x0a9e('0x26')][_0x0a9e('0x73')]=_0x0a9e('0x33');respondWithRpcPromise(_0x0a9e('0x74'),_0x0a9e('0x74'),{'event':_0x0a9e('0x81'),'message':_[_0x0a9e('0x4c')](_0x8cea96['message'],JSON[_0x0a9e('0x76')](_0x8cea96[_0x0a9e('0x63')][_0x0a9e('0x77')]))},client9002);return _0x8cea96;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x3736e0,null))[_0x0a9e('0x28')](handleError(_0x3736e0,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 7477e9e..73a5420 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 _0x1c11=['ChatMessage','setMaxListeners','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x119ffd,_0x15bd2f){var _0x264e2c=function(_0x5b978f){while(--_0x5b978f){_0x119ffd['push'](_0x119ffd['shift']());}};_0x264e2c(++_0x15bd2f);}(_0x1c11,0xbf));var _0x11c1=function(_0xce923d,_0x1e1168){_0xce923d=_0xce923d-0x0;var _0x10d7a5=_0x1c11[_0xce923d];return _0x10d7a5;};'use strict';var EventEmitter=require(_0x11c1('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0x11c1('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x11c1('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x11c1('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3cbbd3){return function(_0x217438,_0x362aa5,_0x2f1537){ChatMessageEvents[_0x11c1('0x4')](_0x3cbbd3+':'+_0x217438['id'],_0x217438);ChatMessageEvents['emit'](_0x3cbbd3,_0x217438);_0x2f1537(null);};}for(var e in events){if(events[_0x11c1('0x5')](e)){var event=events[e];ChatMessage[_0x11c1('0x6')](e,emitEvent(event));}}module[_0x11c1('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0xcd12=['exports','ChatMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x30f333,_0x1aeeea){var _0x479f1c=function(_0x306ad9){while(--_0x306ad9){_0x30f333['push'](_0x30f333['shift']());}};_0x479f1c(++_0x1aeeea);}(_0xcd12,0x169));var _0x2cd1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcd12[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var ChatMessage=require('../../mysqldb')['db'][_0x2cd1('0x0')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x2cd1('0x1')](0x0);var events={'afterCreate':_0x2cd1('0x2'),'afterUpdate':_0x2cd1('0x3'),'afterDestroy':_0x2cd1('0x4')};function emitEvent(_0x3d36ca){return function(_0x36fc3b,_0x4c516e,_0x5adeeb){ChatMessageEvents[_0x2cd1('0x5')](_0x3d36ca+':'+_0x36fc3b['id'],_0x36fc3b);ChatMessageEvents[_0x2cd1('0x5')](_0x3d36ca,_0x36fc3b);_0x5adeeb(null);};}for(var e in events){if(events[_0x2cd1('0x6')](e)){var event=events[e];ChatMessage[_0x2cd1('0x7')](e,emitEvent(event));}}module[_0x2cd1('0x8')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index cc880b8..cb1b961 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 _0xa8fc=['catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','define','ChatMessage','chat_messages','fti_chat_messages','body','models','get','direction','toLowerCase','out','secret','isNil','ChatInteraction','findOne','then','update','createdAt'];(function(_0x2fc113,_0x45ec6e){var _0x5144ce=function(_0x47fd29){while(--_0x47fd29){_0x2fc113['push'](_0x2fc113['shift']());}};_0x5144ce(++_0x45ec6e);}(_0xa8fc,0x144));var _0xca8f=function(_0x10cf4e,_0x3290e9){_0x10cf4e=_0x10cf4e-0x0;var _0x238609=_0xa8fc[_0x10cf4e];return _0x238609;};'use strict';var _=require(_0xca8f('0x0'));var util=require(_0xca8f('0x1'));var logger=require(_0xca8f('0x2'))(_0xca8f('0x3'));var moment=require(_0xca8f('0x4'));var BPromise=require(_0xca8f('0x5'));var rp=require(_0xca8f('0x6'));var fs=require('fs');var path=require(_0xca8f('0x7'));var rimraf=require(_0xca8f('0x8'));var config=require(_0xca8f('0x9'));var attributes=require(_0xca8f('0xa'));module['exports']=function(_0x412862,_0x2bef4e){return _0x412862[_0xca8f('0xb')](_0xca8f('0xc'),attributes,{'tableName':_0xca8f('0xd'),'paranoid':![],'indexes':[{'name':_0xca8f('0xe'),'fields':[_0xca8f('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x29f6bb,_0x5895a9,_0x40c26d){var _0xc5645d=_0x412862[_0xca8f('0x10')];var _0x5ac313=_0x29f6bb[_0xca8f('0x11')]({'plain':!![]});if(_0x5ac313[_0xca8f('0x12')][_0xca8f('0x13')]()==='in'||_0x5ac313[_0xca8f('0x12')][_0xca8f('0x13')]()===_0xca8f('0x14')&&!_0x5ac313[_0xca8f('0x15')]&&!_[_0xca8f('0x16')](_0x5ac313['UserId'])){_0xc5645d[_0xca8f('0x17')][_0xca8f('0x18')]({'where':{'id':_0x5ac313['ChatInteractionId']}})[_0xca8f('0x19')](function(_0x488d63){if(_0x488d63){_0x488d63[_0xca8f('0x1a')]({'lastMsgAt':_0x5ac313[_0xca8f('0x1b')],'lastMsgDirection':_0x5ac313[_0xca8f('0x12')]['toLowerCase']()});}})[_0xca8f('0x1c')](function(_0x514aec){console[_0xca8f('0x1d')](_0x514aec);});}_0x40c26d();}},'charset':_0xca8f('0x1e'),'collate':_0xca8f('0x1f')});}; \ No newline at end of file +var _0xb5fc=['body','FULLTEXT','models','get','toLowerCase','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','direction','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages'];(function(_0x43f842,_0x130257){var _0x22b965=function(_0x53e057){while(--_0x53e057){_0x43f842['push'](_0x43f842['shift']());}};_0x22b965(++_0x130257);}(_0xb5fc,0x1e3));var _0xcb5f=function(_0x4a3513,_0x49a288){_0x4a3513=_0x4a3513-0x0;var _0x32fdcb=_0xb5fc[_0x4a3513];return _0x32fdcb;};'use strict';var _=require(_0xcb5f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xcb5f('0x1'));var moment=require(_0xcb5f('0x2'));var BPromise=require(_0xcb5f('0x3'));var rp=require(_0xcb5f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcb5f('0x5'));var config=require(_0xcb5f('0x6'));var attributes=require(_0xcb5f('0x7'));module[_0xcb5f('0x8')]=function(_0x366cf3,_0xc97300){return _0x366cf3[_0xcb5f('0x9')](_0xcb5f('0xa'),attributes,{'tableName':_0xcb5f('0xb'),'paranoid':![],'indexes':[{'name':_0xcb5f('0xc'),'fields':[_0xcb5f('0xd')],'type':_0xcb5f('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x247f26,_0xe4607,_0x332876){var _0x31bed4=_0x366cf3[_0xcb5f('0xf')];var _0x2bbee8=_0x247f26[_0xcb5f('0x10')]({'plain':!![]});if(_0x2bbee8['direction'][_0xcb5f('0x11')]()==='in'||_0x2bbee8['direction'][_0xcb5f('0x11')]()==='out'&&!_0x2bbee8[_0xcb5f('0x12')]&&!_[_0xcb5f('0x13')](_0x2bbee8[_0xcb5f('0x14')])){_0x31bed4[_0xcb5f('0x15')][_0xcb5f('0x16')]({'where':{'id':_0x2bbee8[_0xcb5f('0x17')]}})[_0xcb5f('0x18')](function(_0x544732){if(_0x544732){_0x544732[_0xcb5f('0x19')]({'lastMsgAt':_0x2bbee8['createdAt'],'lastMsgDirection':_0x2bbee8[_0xcb5f('0x1a')][_0xcb5f('0x11')]()});}})[_0xcb5f('0x1b')](function(_0x2ccee3){console[_0xcb5f('0x1c')](_0x2ccee3);});}_0x332876();}},'charset':_0xcb5f('0x1d'),'collate':_0xcb5f('0x1e')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 739d018..2d08975 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 _0x1e8f=['socket.io-emitter','register','request','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','ChatMessage,\x20%s,\x20%s','info','result','catch','CreateChatMessage','ChatMessage','body','options','then','debug','stringify','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost'];(function(_0x11d326,_0x3d48f6){var _0x304839=function(_0x352267){while(--_0x352267){_0x11d326['push'](_0x11d326['shift']());}};_0x304839(++_0x3d48f6);}(_0x1e8f,0x149));var _0xf1e8=function(_0x31fee1,_0x8d0b5){_0x31fee1=_0x31fee1-0x0;var _0x834e13=_0x1e8f[_0x31fee1];return _0x834e13;};'use strict';var _=require('lodash');var util=require(_0xf1e8('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf1e8('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf1e8('0x2'))['db'];var utils=require(_0xf1e8('0x3'));var logger=require(_0xf1e8('0x4'))(_0xf1e8('0x5'));var config=require(_0xf1e8('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf1e8('0x7')][_0xf1e8('0x8')]({'port':0x232a});config[_0xf1e8('0x9')]=_[_0xf1e8('0xa')](config[_0xf1e8('0x9')],{'host':_0xf1e8('0xb'),'port':0x18eb});var socket=require(_0xf1e8('0xc'))(new Redis(config[_0xf1e8('0x9')]));require('./chatMessage.socket')[_0xf1e8('0xd')](socket);function respondWithRpcPromise(_0x411f33,_0x1251b4,_0x2dfc0d){return new BPromise(function(_0x2b3ee4,_0x42f9fe){return client[_0xf1e8('0xe')](_0x411f33,_0x2dfc0d)['then'](function(_0x582529){logger['info']('ChatMessage,\x20%s,\x20%s',_0x1251b4,_0xf1e8('0xf'));logger['debug'](_0xf1e8('0x10'),_0x1251b4,_0xf1e8('0xf'),JSON['stringify'](_0x582529));if(_0x582529[_0xf1e8('0x11')]){if(_0x582529[_0xf1e8('0x11')][_0xf1e8('0x12')]===0x1f4){logger[_0xf1e8('0x11')]('ChatMessage,\x20%s,\x20%s',_0x1251b4,_0x582529[_0xf1e8('0x11')][_0xf1e8('0x13')]);return _0x42f9fe(_0x582529['error']['message']);}logger['error'](_0xf1e8('0x14'),_0x1251b4,_0x582529['error'][_0xf1e8('0x13')]);return _0x2b3ee4(_0x582529[_0xf1e8('0x11')][_0xf1e8('0x13')]);}else{logger[_0xf1e8('0x15')](_0xf1e8('0x14'),_0x1251b4,_0xf1e8('0xf'));_0x2b3ee4(_0x582529[_0xf1e8('0x16')][_0xf1e8('0x13')]);}})[_0xf1e8('0x17')](function(_0x27c3e4){logger[_0xf1e8('0x11')](_0xf1e8('0x14'),_0x1251b4,_0x27c3e4);_0x42f9fe(_0x27c3e4);});});}exports[_0xf1e8('0x18')]=function(_0x23051c){var _0x175a7b=this;return new Promise(function(_0x277943,_0x19c91a){return db[_0xf1e8('0x19')]['create'](_0x23051c[_0xf1e8('0x1a')],{'raw':_0x23051c[_0xf1e8('0x1b')]?_0x23051c[_0xf1e8('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xf1e8('0x1c')](function(_0x2988b7){logger[_0xf1e8('0x15')]('CreateChatMessage',_0x23051c);logger[_0xf1e8('0x1d')]('CreateChatMessage',_0x23051c,JSON[_0xf1e8('0x1e')](_0x2988b7));_0x277943(_0x2988b7);})[_0xf1e8('0x17')](function(_0x2f149d){logger['error'](_0xf1e8('0x18'),_0x2f149d['message'],_0x23051c);_0x19c91a(_0x175a7b['error'](0x1f4,_0x2f149d[_0xf1e8('0x13')]));});});}; \ No newline at end of file +var _0xfaf1=['register','then','debug','request\x20sent','error','ChatMessage,\x20%s,\x20%s','message','info','catch','CreateChatMessage','ChatMessage','create','body','options','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','redis','defaults','localhost','./chatMessage.socket'];(function(_0x4d2d63,_0x213bd3){var _0x5a9e05=function(_0x286f80){while(--_0x286f80){_0x4d2d63['push'](_0x4d2d63['shift']());}};_0x5a9e05(++_0x213bd3);}(_0xfaf1,0xd3));var _0x1faf=function(_0x2228a9,_0x396716){_0x2228a9=_0x2228a9-0x0;var _0x25de40=_0xfaf1[_0x2228a9];return _0x25de40;};'use strict';var _=require(_0x1faf('0x0'));var util=require(_0x1faf('0x1'));var moment=require(_0x1faf('0x2'));var BPromise=require(_0x1faf('0x3'));var rs=require(_0x1faf('0x4'));var fs=require('fs');var Redis=require(_0x1faf('0x5'));var db=require(_0x1faf('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x1faf('0x7'));var jayson=require(_0x1faf('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x1faf('0x9')]=_[_0x1faf('0xa')](config[_0x1faf('0x9')],{'host':_0x1faf('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1faf('0x9')]));require(_0x1faf('0xc'))[_0x1faf('0xd')](socket);function respondWithRpcPromise(_0x20fa9f,_0x9cefb5,_0x47c636){return new BPromise(function(_0x33295e,_0x1fe352){return client['request'](_0x20fa9f,_0x47c636)[_0x1faf('0xe')](function(_0x4a00ba){logger['info']('ChatMessage,\x20%s,\x20%s',_0x9cefb5,'request\x20sent');logger[_0x1faf('0xf')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x9cefb5,_0x1faf('0x10'),JSON['stringify'](_0x4a00ba));if(_0x4a00ba[_0x1faf('0x11')]){if(_0x4a00ba[_0x1faf('0x11')]['code']===0x1f4){logger[_0x1faf('0x11')](_0x1faf('0x12'),_0x9cefb5,_0x4a00ba[_0x1faf('0x11')][_0x1faf('0x13')]);return _0x1fe352(_0x4a00ba[_0x1faf('0x11')][_0x1faf('0x13')]);}logger[_0x1faf('0x11')](_0x1faf('0x12'),_0x9cefb5,_0x4a00ba[_0x1faf('0x11')][_0x1faf('0x13')]);return _0x33295e(_0x4a00ba[_0x1faf('0x11')][_0x1faf('0x13')]);}else{logger[_0x1faf('0x14')]('ChatMessage,\x20%s,\x20%s',_0x9cefb5,_0x1faf('0x10'));_0x33295e(_0x4a00ba['result'][_0x1faf('0x13')]);}})[_0x1faf('0x15')](function(_0x342610){logger['error'](_0x1faf('0x12'),_0x9cefb5,_0x342610);_0x1fe352(_0x342610);});});}exports[_0x1faf('0x16')]=function(_0x9932de){var _0x39b526=this;return new Promise(function(_0x1bdef0,_0x509f9e){return db[_0x1faf('0x17')][_0x1faf('0x18')](_0x9932de[_0x1faf('0x19')],{'raw':_0x9932de[_0x1faf('0x1a')]?_0x9932de['options']['raw']===undefined?!![]:![]:!![]})[_0x1faf('0xe')](function(_0x1e8144){logger[_0x1faf('0x14')](_0x1faf('0x16'),_0x9932de);logger[_0x1faf('0xf')](_0x1faf('0x16'),_0x9932de,JSON[_0x1faf('0x1b')](_0x1e8144));_0x1bdef0(_0x1e8144);})['catch'](function(_0x2fe35b){logger[_0x1faf('0x11')](_0x1faf('0x16'),_0x2fe35b['message'],_0x9932de);_0x509f9e(_0x39b526[_0x1faf('0x11')](0x1f4,_0x2fe35b[_0x1faf('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 7b6befe..ee11327 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 _0x8c52=['./chatMessage.events','remove','update','emit','removeListener','register','chatMessage:'];(function(_0x4dc46a,_0x47fbd7){var _0x29fbcb=function(_0xeb2ae1){while(--_0xeb2ae1){_0x4dc46a['push'](_0x4dc46a['shift']());}};_0x29fbcb(++_0x47fbd7);}(_0x8c52,0x7e));var _0x28c5=function(_0x3e961c,_0x5747e7){_0x3e961c=_0x3e961c-0x0;var _0x474f9c=_0x8c52[_0x3e961c];return _0x474f9c;};'use strict';var ChatMessageEvents=require(_0x28c5('0x0'));var events=['save',_0x28c5('0x1'),_0x28c5('0x2')];function createListener(_0x3d994a,_0x37c10f){return function(_0x398f22){_0x37c10f[_0x28c5('0x3')](_0x3d994a,_0x398f22);};}function removeListener(_0x412a0a,_0x3b6b48){return function(){ChatMessageEvents[_0x28c5('0x4')](_0x412a0a,_0x3b6b48);};}exports[_0x28c5('0x5')]=function(_0x209f3d){for(var _0x3b5c38=0x0,_0x53584d=events['length'];_0x3b5c38<_0x53584d;_0x3b5c38++){var _0x5d9299=events[_0x3b5c38];var _0x5099e8=createListener(_0x28c5('0x6')+_0x5d9299,_0x209f3d);ChatMessageEvents['on'](_0x5d9299,_0x5099e8);}}; \ No newline at end of file +var _0x5577=['length','chatMessage:','./chatMessage.events','remove','update','emit','removeListener'];(function(_0x4250b3,_0x45209d){var _0x5e66a2=function(_0x14d123){while(--_0x14d123){_0x4250b3['push'](_0x4250b3['shift']());}};_0x5e66a2(++_0x45209d);}(_0x5577,0x1b4));var _0x7557=function(_0x5c61d3,_0x2ffe64){_0x5c61d3=_0x5c61d3-0x0;var _0x44d5cc=_0x5577[_0x5c61d3];return _0x44d5cc;};'use strict';var ChatMessageEvents=require(_0x7557('0x0'));var events=['save',_0x7557('0x1'),_0x7557('0x2')];function createListener(_0x52a8c6,_0x34636a){return function(_0x289758){_0x34636a[_0x7557('0x3')](_0x52a8c6,_0x289758);};}function removeListener(_0x3c4697,_0x1274d5){return function(){ChatMessageEvents[_0x7557('0x4')](_0x3c4697,_0x1274d5);};}exports['register']=function(_0x7bb8c){for(var _0x41a4a5=0x0,_0x3da895=events[_0x7557('0x5')];_0x41a4a5<_0x3da895;_0x41a4a5++){var _0x33e9aa=events[_0x41a4a5];var _0x37f335=createListener(_0x7557('0x6')+_0x33e9aa,_0x7bb8c);ChatMessageEvents['on'](_0x33e9aa,_0x37f335);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 51a4781..0819e4f 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 _0x75b7=['/:id','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','show','post','tracked','chat','chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete'];(function(_0x3ef526,_0x2cb29d){var _0x257f66=function(_0x52f25f){while(--_0x52f25f){_0x3ef526['push'](_0x3ef526['shift']());}};_0x257f66(++_0x2cb29d);}(_0x75b7,0x1cc));var _0x775b=function(_0x5ae3e5,_0x4561e7){_0x5ae3e5=_0x5ae3e5-0x0;var _0x3c93c7=_0x75b7[_0x5ae3e5];return _0x3c93c7;};'use strict';var multer=require(_0x775b('0x0'));var util=require(_0x775b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x775b('0x2')]();var fs_extra=require(_0x775b('0x3'));var auth=require(_0x775b('0x4'));var interaction=require(_0x775b('0x5'));var config=require(_0x775b('0x6'));var controller=require(_0x775b('0x7'));router[_0x775b('0x8')]('/',auth[_0x775b('0x9')](),controller[_0x775b('0xa')]);router[_0x775b('0x8')](_0x775b('0xb'),auth['isAuthenticated'](),controller[_0x775b('0xc')]);router['get']('/:id',auth[_0x775b('0x9')](),controller[_0x775b('0xd')]);router[_0x775b('0xe')]('/',auth[_0x775b('0x9')](),interaction[_0x775b('0xf')](_0x775b('0x10'),_0x775b('0x11')),controller[_0x775b('0x12')]);router[_0x775b('0x13')]('/:id',controller[_0x775b('0x14')]);router[_0x775b('0x13')](_0x775b('0x15'),auth[_0x775b('0x9')](),controller[_0x775b('0x16')]);router['put'](_0x775b('0x17'),auth['isAuthenticated'](),controller[_0x775b('0x18')]);router[_0x775b('0x19')](_0x775b('0x1a'),auth[_0x775b('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x72ad=['chatmessage:create','put','update','/:id/reject','reject','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./chatMessage.controller','get','index','describe','/:id','isAuthenticated','post'];(function(_0x2be661,_0x50de17){var _0x2cce43=function(_0x4f694){while(--_0x4f694){_0x2be661['push'](_0x2be661['shift']());}};_0x2cce43(++_0x50de17);}(_0x72ad,0x1e6));var _0xd72a=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0x72ad[_0x2576d7];return _0x16a08c;};'use strict';var multer=require(_0xd72a('0x0'));var util=require('util');var path=require(_0xd72a('0x1'));var timeout=require(_0xd72a('0x2'));var express=require(_0xd72a('0x3'));var router=express[_0xd72a('0x4')]();var fs_extra=require(_0xd72a('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd72a('0x6'));var controller=require(_0xd72a('0x7'));router[_0xd72a('0x8')]('/',auth['isAuthenticated'](),controller[_0xd72a('0x9')]);router[_0xd72a('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xd72a('0xa')]);router[_0xd72a('0x8')](_0xd72a('0xb'),auth[_0xd72a('0xc')](),controller['show']);router[_0xd72a('0xd')]('/',auth['isAuthenticated'](),interaction['tracked']('chat',_0xd72a('0xe')),controller['create']);router[_0xd72a('0xf')](_0xd72a('0xb'),controller[_0xd72a('0x10')]);router[_0xd72a('0xf')]('/:id/accept',auth[_0xd72a('0xc')](),controller['accept']);router[_0xd72a('0xf')](_0xd72a('0x11'),auth[_0xd72a('0xc')](),controller[_0xd72a('0x12')]);router['delete'](_0xd72a('0xb'),auth[_0xd72a('0xc')](),controller[_0xd72a('0x13')]);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 cdd77a8..04901ac 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 _0xa192=['exports','TEXT'];(function(_0x2b0690,_0x4f742f){var _0x82be1=function(_0x1e1084){while(--_0x1e1084){_0x2b0690['push'](_0x2b0690['shift']());}};_0x82be1(++_0x4f742f);}(_0xa192,0x12e));var _0x2a19=function(_0x45b3ed,_0x192e1a){_0x45b3ed=_0x45b3ed-0x0;var _0x5502a5=_0xa192[_0x45b3ed];return _0x5502a5;};'use strict';var Sequelize=require('sequelize');module[_0x2a19('0x0')]={'body':{'type':Sequelize[_0x2a19('0x1')]('medium'),'allowNull':![]}}; \ No newline at end of file +var _0x9d3a=['TEXT'];(function(_0x4350c2,_0x112f3c){var _0x8b6406=function(_0x49e845){while(--_0x49e845){_0x4350c2['push'](_0x4350c2['shift']());}};_0x8b6406(++_0x112f3c);}(_0x9d3a,0x9f));var _0xa9d3=function(_0x4c0b26,_0x4853ee){_0x4c0b26=_0x4c0b26-0x0;var _0x363dea=_0x9d3a[_0x4c0b26];return _0x363dea;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xa9d3('0x0')]('medium'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index e87ea0f..3cedaa8 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(_0x35cad5,_0x36c77a){var _0x213ddc=function(_0x20dfac){while(--_0x20dfac){_0x35cad5['push'](_0x35cad5['shift']());}};_0x213ddc(++_0x36c77a);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'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(_0x5412cb,_0x29b1c4){var _0x3f916e=function(_0x3d1eaf){while(--_0x3d1eaf){_0x5412cb['push'](_0x5412cb['shift']());}};_0x3f916e(++_0x29b1c4);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index a5799d8..5547d03 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 _0x8690=['request-promise','path','rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','api','bluebird'];(function(_0xe609de,_0x1ef5fc){var _0x5aafbd=function(_0x2510c){while(--_0x2510c){_0xe609de['push'](_0xe609de['shift']());}};_0x5aafbd(++_0x1ef5fc);}(_0x8690,0x1df));var _0x0869=function(_0x334d1e,_0x28a488){_0x334d1e=_0x334d1e-0x0;var _0x3b33ba=_0x8690[_0x334d1e];return _0x3b33ba;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x0869('0x0'));var moment=require('moment');var BPromise=require(_0x0869('0x1'));var rp=require(_0x0869('0x2'));var fs=require('fs');var path=require(_0x0869('0x3'));var rimraf=require(_0x0869('0x4'));var config=require(_0x0869('0x5'));var attributes=require(_0x0869('0x6'));module[_0x0869('0x7')]=function(_0x174c88,_0x53fdb9){return _0x174c88[_0x0869('0x8')](_0x0869('0x9'),attributes,{'tableName':_0x0869('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0869('0xb'),'collate':_0x0869('0xc')});}; \ No newline at end of file +var _0x0963=['define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','path','rimraf','./chatOfflineMessage.attributes','exports'];(function(_0x5a5395,_0x5361f6){var _0x4da43d=function(_0x149941){while(--_0x149941){_0x5a5395['push'](_0x5a5395['shift']());}};_0x4da43d(++_0x5361f6);}(_0x0963,0x10f));var _0x3096=function(_0x1ce4d1,_0xea0bcb){_0x1ce4d1=_0x1ce4d1-0x0;var _0x1b270e=_0x0963[_0x1ce4d1];return _0x1b270e;};'use strict';var _=require(_0x3096('0x0'));var util=require(_0x3096('0x1'));var logger=require('../../config/logger')(_0x3096('0x2'));var moment=require(_0x3096('0x3'));var BPromise=require(_0x3096('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3096('0x5'));var rimraf=require(_0x3096('0x6'));var config=require('../../config/environment');var attributes=require(_0x3096('0x7'));module[_0x3096('0x8')]=function(_0x5d6b09,_0xfcf8fa){return _0x5d6b09[_0x3096('0x9')](_0x3096('0xa'),attributes,{'tableName':_0x3096('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3096('0xc'),'collate':_0x3096('0xd')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 019700a..2cedebb 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 _0xf670=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','error','code','message','result'];(function(_0x221952,_0x55ec08){var _0x51e994=function(_0x323927){while(--_0x323927){_0x221952['push'](_0x221952['shift']());}};_0x51e994(++_0x55ec08);}(_0xf670,0x8d));var _0x0f67=function(_0x57643b,_0x1706fe){_0x57643b=_0x57643b-0x0;var _0x53a35b=_0xf670[_0x57643b];return _0x53a35b;};'use strict';var _=require('lodash');var util=require(_0x0f67('0x0'));var moment=require(_0x0f67('0x1'));var BPromise=require(_0x0f67('0x2'));var rs=require(_0x0f67('0x3'));var fs=require('fs');var Redis=require(_0x0f67('0x4'));var db=require(_0x0f67('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0f67('0x6'))(_0x0f67('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0f67('0x8')][_0x0f67('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd6248b,_0x248449,_0x4fc325){return new BPromise(function(_0x5f2f5d,_0x369cf8){return client[_0x0f67('0xa')](_0xd6248b,_0x4fc325)[_0x0f67('0xb')](function(_0x41cf31){logger[_0x0f67('0xc')](_0x0f67('0xd'),_0x248449,_0x0f67('0xe'));logger['debug']('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x248449,_0x0f67('0xe'),JSON['stringify'](_0x41cf31));if(_0x41cf31[_0x0f67('0xf')]){if(_0x41cf31['error'][_0x0f67('0x10')]===0x1f4){logger['error'](_0x0f67('0xd'),_0x248449,_0x41cf31[_0x0f67('0xf')][_0x0f67('0x11')]);return _0x369cf8(_0x41cf31['error'][_0x0f67('0x11')]);}logger[_0x0f67('0xf')](_0x0f67('0xd'),_0x248449,_0x41cf31[_0x0f67('0xf')][_0x0f67('0x11')]);return _0x5f2f5d(_0x41cf31[_0x0f67('0xf')][_0x0f67('0x11')]);}else{logger[_0x0f67('0xc')]('ChatOfflineMessage,\x20%s,\x20%s',_0x248449,_0x0f67('0xe'));_0x5f2f5d(_0x41cf31[_0x0f67('0x12')][_0x0f67('0x11')]);}})[_0x0f67('0x13')](function(_0x4f4f9f){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x248449,_0x4f4f9f);_0x369cf8(_0x4f4f9f);});});} \ No newline at end of file +var _0x13c6=['ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','client','request','then','info'];(function(_0x385ac4,_0x9c7883){var _0x49a74c=function(_0x35762e){while(--_0x35762e){_0x385ac4['push'](_0x385ac4['shift']());}};_0x49a74c(++_0x9c7883);}(_0x13c6,0x94));var _0x613c=function(_0x458ffc,_0x1afbc5){_0x458ffc=_0x458ffc-0x0;var _0x56fc17=_0x13c6[_0x458ffc];return _0x56fc17;};'use strict';var _=require(_0x613c('0x0'));var util=require(_0x613c('0x1'));var moment=require(_0x613c('0x2'));var BPromise=require(_0x613c('0x3'));var rs=require(_0x613c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x613c('0x5'));var logger=require('../../config/logger')(_0x613c('0x6'));var config=require(_0x613c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x613c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x411bda,_0x266b12,_0x2d3865){return new BPromise(function(_0x2d99df,_0x3306ec){return client[_0x613c('0x9')](_0x411bda,_0x2d3865)[_0x613c('0xa')](function(_0x1dfa38){logger[_0x613c('0xb')](_0x613c('0xc'),_0x266b12,_0x613c('0xd'));logger[_0x613c('0xe')](_0x613c('0xf'),_0x266b12,'request\x20sent',JSON['stringify'](_0x1dfa38));if(_0x1dfa38['error']){if(_0x1dfa38[_0x613c('0x10')][_0x613c('0x11')]===0x1f4){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x266b12,_0x1dfa38[_0x613c('0x10')]['message']);return _0x3306ec(_0x1dfa38[_0x613c('0x10')][_0x613c('0x12')]);}logger[_0x613c('0x10')](_0x613c('0xc'),_0x266b12,_0x1dfa38[_0x613c('0x10')][_0x613c('0x12')]);return _0x2d99df(_0x1dfa38[_0x613c('0x10')][_0x613c('0x12')]);}else{logger['info'](_0x613c('0xc'),_0x266b12,_0x613c('0xd'));_0x2d99df(_0x1dfa38[_0x613c('0x13')][_0x613c('0x12')]);}})['catch'](function(_0x23e600){logger[_0x613c('0x10')](_0x613c('0xc'),_0x266b12,_0x23e600);_0x3306ec(_0x23e600);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 93de6ad..85fbb55 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 _0x7b9d=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','post','create','put','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x7b9d,0x119));var _0xd7b9=function(_0x592416,_0x2c75e9){_0x592416=_0x592416-0x0;var _0x3005fa=_0x7b9d[_0x592416];return _0x3005fa;};'use strict';var multer=require(_0xd7b9('0x0'));var util=require(_0xd7b9('0x1'));var path=require(_0xd7b9('0x2'));var timeout=require(_0xd7b9('0x3'));var express=require(_0xd7b9('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd7b9('0x5'));var interaction=require(_0xd7b9('0x6'));var config=require(_0xd7b9('0x7'));var controller=require('./chatOfflineMessage.controller');router[_0xd7b9('0x8')]('/',auth[_0xd7b9('0x9')](),controller['index']);router[_0xd7b9('0x8')](_0xd7b9('0xa'),auth[_0xd7b9('0x9')](),controller[_0xd7b9('0xb')]);router['get'](_0xd7b9('0xc'),auth[_0xd7b9('0x9')](),controller['show']);router[_0xd7b9('0xd')]('/',auth[_0xd7b9('0x9')](),controller[_0xd7b9('0xe')]);router[_0xd7b9('0xf')](_0xd7b9('0xc'),auth[_0xd7b9('0x9')](),controller[_0xd7b9('0x10')]);router[_0xd7b9('0x11')](_0xd7b9('0xc'),auth['isAuthenticated'](),controller[_0xd7b9('0x12')]);module['exports']=router; \ No newline at end of file +var _0xb7ff=['multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','describe','show','post','put','/:id','update','delete','destroy','exports'];(function(_0x356107,_0x3bb13c){var _0x2f9d2b=function(_0x5279c4){while(--_0x5279c4){_0x356107['push'](_0x356107['shift']());}};_0x2f9d2b(++_0x3bb13c);}(_0xb7ff,0x1a4));var _0xfb7f=function(_0x465aab,_0x7d2a65){_0x465aab=_0x465aab-0x0;var _0x5e2500=_0xb7ff[_0x465aab];return _0x5e2500;};'use strict';var multer=require(_0xfb7f('0x0'));var util=require(_0xfb7f('0x1'));var path=require(_0xfb7f('0x2'));var timeout=require(_0xfb7f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfb7f('0x4'));var interaction=require(_0xfb7f('0x5'));var config=require(_0xfb7f('0x6'));var controller=require('./chatOfflineMessage.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xfb7f('0x7')]);router[_0xfb7f('0x8')](_0xfb7f('0x9'),auth[_0xfb7f('0xa')](),controller[_0xfb7f('0xb')]);router[_0xfb7f('0x8')]('/:id',auth[_0xfb7f('0xa')](),controller[_0xfb7f('0xc')]);router[_0xfb7f('0xd')]('/',auth[_0xfb7f('0xa')](),controller['create']);router[_0xfb7f('0xe')](_0xfb7f('0xf'),auth['isAuthenticated'](),controller[_0xfb7f('0x10')]);router[_0xfb7f('0x11')](_0xfb7f('0xf'),auth[_0xfb7f('0xa')](),controller[_0xfb7f('0x12')]);module[_0xfb7f('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 95b1a2d..6b938de 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 _0x405e=['sequelize','exports','STRING','ENUM','mouseOver','timeout','INTEGER'];(function(_0x4afa89,_0x1b9ed3){var _0x151c58=function(_0x406491){while(--_0x406491){_0x4afa89['push'](_0x4afa89['shift']());}};_0x151c58(++_0x1b9ed3);}(_0x405e,0x111));var _0xe405=function(_0x2ebb5c,_0x5efe37){_0x2ebb5c=_0x2ebb5c-0x0;var _0x5d965f=_0x405e[_0x2ebb5c];return _0x5d965f;};'use strict';var Sequelize=require(_0xe405('0x0'));module[_0xe405('0x1')]={'name':{'type':Sequelize[_0xe405('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xe405('0x3')](_0xe405('0x4'),_0xe405('0x5')),'defaultValue':_0xe405('0x4')},'selector':{'type':Sequelize[_0xe405('0x2')]},'timeout':{'type':Sequelize[_0xe405('0x6')]}}; \ No newline at end of file +var _0xed0d=['INTEGER','exports','STRING','ENUM','mouseOver'];(function(_0x4e317b,_0x46b419){var _0x103371=function(_0x8a800e){while(--_0x8a800e){_0x4e317b['push'](_0x4e317b['shift']());}};_0x103371(++_0x46b419);}(_0xed0d,0x92));var _0xded0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xed0d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xded0('0x0')]={'name':{'type':Sequelize[_0xded0('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xded0('0x2')](_0xded0('0x3'),'timeout'),'defaultValue':_0xded0('0x3')},'selector':{'type':Sequelize[_0xded0('0x1')]},'timeout':{'type':Sequelize[_0xded0('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 2b60135..7c0c750 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 _0xc0a4=['intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','catch','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','end','name','send','params','model','ChatProactiveAction','rawAttributes','query','keys','filters'];(function(_0x5ca04c,_0x27f8db){var _0x5e227e=function(_0x5d256e){while(--_0x5d256e){_0x5ca04c['push'](_0x5ca04c['shift']());}};_0x5e227e(++_0x27f8db);}(_0xc0a4,0x147));var _0x4c0a=function(_0x4a7cb9,_0x4e0fa2){_0x4a7cb9=_0x4a7cb9-0x0;var _0x4cde3b=_0xc0a4[_0x4a7cb9];return _0x4cde3b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4c0a('0x0'));var zipdir=require(_0x4c0a('0x1'));var jsonpatch=require(_0x4c0a('0x2'));var rp=require('request-promise');var moment=require(_0x4c0a('0x3'));var BPromise=require(_0x4c0a('0x4'));var Mustache=require(_0x4c0a('0x5'));var util=require(_0x4c0a('0x6'));var path=require(_0x4c0a('0x7'));var sox=require('sox');var csv=require(_0x4c0a('0x8'));var ejs=require(_0x4c0a('0x9'));var fs=require('fs');var fs_extra=require(_0x4c0a('0xa'));var _=require(_0x4c0a('0xb'));var squel=require(_0x4c0a('0xc'));var crypto=require(_0x4c0a('0xd'));var jsforce=require(_0x4c0a('0xe'));var deskjs=require(_0x4c0a('0xf'));var toCsv=require(_0x4c0a('0x8'));var querystring=require('querystring');var Papa=require(_0x4c0a('0x10'));var Redis=require(_0x4c0a('0x11'));var authService=require(_0x4c0a('0x12'));var qs=require(_0x4c0a('0x13'));var as=require(_0x4c0a('0x14'));var hardwareService=require(_0x4c0a('0x15'));var logger=require(_0x4c0a('0x16'))(_0x4c0a('0x17'));var utils=require(_0x4c0a('0x18'));var config=require(_0x4c0a('0x19'));var licenseUtil=require(_0x4c0a('0x1a'));var db=require(_0x4c0a('0x1b'))['db'];function respondWithStatusCode(_0x55b124,_0x1ff4d3){_0x1ff4d3=_0x1ff4d3||0xcc;return function(_0xef01ab){if(_0xef01ab){return _0x55b124[_0x4c0a('0x1c')](_0x1ff4d3);}return _0x55b124[_0x4c0a('0x1d')](_0x1ff4d3)['end']();};}function respondWithResult(_0x437513,_0x223c2a){_0x223c2a=_0x223c2a||0xc8;return function(_0x16d852){if(_0x16d852){return _0x437513[_0x4c0a('0x1d')](_0x223c2a)[_0x4c0a('0x1e')](_0x16d852);}};}function respondWithFilteredResult(_0x8055cc,_0x31e574){return function(_0xe6569b){if(_0xe6569b){var _0x22bc77=typeof _0x31e574[_0x4c0a('0x1f')]===_0x4c0a('0x20')&&typeof _0x31e574[_0x4c0a('0x21')]===_0x4c0a('0x20');var _0x1ebf5e=_0xe6569b[_0x4c0a('0x22')];var _0x7e7d4b=_0x22bc77?0x0:_0x31e574['offset'];var _0x251c7f=_0x22bc77?_0xe6569b['count']:_0x31e574[_0x4c0a('0x1f')]+_0x31e574[_0x4c0a('0x21')];var _0x324469;if(_0x251c7f>=_0x1ebf5e){_0x251c7f=_0x1ebf5e;_0x324469=0xc8;}else{_0x324469=0xce;}_0x8055cc[_0x4c0a('0x1d')](_0x324469);return _0x8055cc[_0x4c0a('0x23')]('Content-Range',_0x7e7d4b+'-'+_0x251c7f+'/'+_0x1ebf5e)[_0x4c0a('0x1e')](_0xe6569b);}return null;};}function patchUpdates(_0x5e7cf1){return function(_0x2cd240){try{jsonpatch[_0x4c0a('0x24')](_0x2cd240,_0x5e7cf1,!![]);}catch(_0x33a3c5){return BPromise[_0x4c0a('0x25')](_0x33a3c5);}return _0x2cd240['save']();};}function saveUpdates(_0x2fef66,_0x19705f){return function(_0x271e58){if(_0x271e58){return _0x271e58[_0x4c0a('0x26')](_0x2fef66)[_0x4c0a('0x27')](function(_0x2cbb8b){return _0x2cbb8b;});}return null;};}function removeEntity(_0x18019d,_0x5bd479){return function(_0x5116ee){if(_0x5116ee){return _0x5116ee[_0x4c0a('0x28')]()['then'](function(){_0x18019d[_0x4c0a('0x1d')](0xcc)[_0x4c0a('0x29')]();});}};}function handleEntityNotFound(_0x22a3ad,_0x319b6f){return function(_0x117ac7){if(!_0x117ac7){_0x22a3ad['sendStatus'](0x194);}return _0x117ac7;};}function handleError(_0x241e91,_0xf239ed){_0xf239ed=_0xf239ed||0x1f4;return function(_0x5b91e2){logger['error'](_0x5b91e2['stack']);if(_0x5b91e2[_0x4c0a('0x2a')]){delete _0x5b91e2['name'];}_0x241e91['status'](_0xf239ed)[_0x4c0a('0x2b')](_0x5b91e2);};}exports['show']=function(_0x23bee2,_0x25a139){var _0x167604={'raw':!![],'where':{'id':_0x23bee2[_0x4c0a('0x2c')]['id']}},_0x5baa4b={};_0x5baa4b[_0x4c0a('0x2d')]=_['keys'](db[_0x4c0a('0x2e')][_0x4c0a('0x2f')]);_0x5baa4b[_0x4c0a('0x30')]=_[_0x4c0a('0x31')](_0x23bee2['query']);_0x5baa4b[_0x4c0a('0x32')]=_[_0x4c0a('0x33')](_0x5baa4b['model'],_0x5baa4b[_0x4c0a('0x30')]);_0x167604[_0x4c0a('0x34')]=_[_0x4c0a('0x33')](_0x5baa4b[_0x4c0a('0x2d')],qs[_0x4c0a('0x35')](_0x23bee2[_0x4c0a('0x30')][_0x4c0a('0x35')]));_0x167604['attributes']=_0x167604[_0x4c0a('0x34')][_0x4c0a('0x36')]?_0x167604[_0x4c0a('0x34')]:_0x5baa4b[_0x4c0a('0x2d')];if(_0x23bee2[_0x4c0a('0x30')][_0x4c0a('0x37')]){_0x167604[_0x4c0a('0x38')]=[{'all':!![]}];}_0x167604=_[_0x4c0a('0x39')]({},_0x167604,_0x23bee2[_0x4c0a('0x3a')]);return db['ChatProactiveAction'][_0x4c0a('0x3b')](_0x167604)[_0x4c0a('0x27')](handleEntityNotFound(_0x25a139,null))['then'](respondWithResult(_0x25a139,null))['catch'](handleError(_0x25a139,null));};exports[_0x4c0a('0x3c')]=function(_0x48ed41,_0x484d0a){return db[_0x4c0a('0x2e')][_0x4c0a('0x3c')](_0x48ed41[_0x4c0a('0x3d')],{})[_0x4c0a('0x27')](respondWithResult(_0x484d0a,0xc9))[_0x4c0a('0x3e')](handleError(_0x484d0a,null));};exports['update']=function(_0x36bd3c,_0x44887f){if(_0x36bd3c[_0x4c0a('0x3d')]['id']){delete _0x36bd3c[_0x4c0a('0x3d')]['id'];}return db[_0x4c0a('0x2e')]['find']({'where':{'id':_0x36bd3c[_0x4c0a('0x2c')]['id']}})[_0x4c0a('0x27')](handleEntityNotFound(_0x44887f,null))['then'](saveUpdates(_0x36bd3c[_0x4c0a('0x3d')],null))[_0x4c0a('0x27')](respondWithResult(_0x44887f,null))[_0x4c0a('0x3e')](handleError(_0x44887f,null));};exports[_0x4c0a('0x28')]=function(_0xb03bce,_0x4aa44c){return db[_0x4c0a('0x2e')][_0x4c0a('0x3b')]({'where':{'id':_0xb03bce[_0x4c0a('0x2c')]['id']}})[_0x4c0a('0x27')](handleEntityNotFound(_0x4aa44c,null))['then'](removeEntity(_0x4aa44c,null))[_0x4c0a('0x3e')](handleError(_0x4aa44c,null));}; \ No newline at end of file +var _0x5ed2=['status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','params','model','keys','rawAttributes','query','filters','attributes','intersection','fields','length','includeAll','include','merge','options','ChatProactiveAction','find','catch','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end'];(function(_0x433439,_0x2483b5){var _0x4e8348=function(_0x1218d5){while(--_0x1218d5){_0x433439['push'](_0x433439['shift']());}};_0x4e8348(++_0x2483b5);}(_0x5ed2,0x114));var _0x25ed=function(_0x4b2693,_0x29f874){_0x4b2693=_0x4b2693-0x0;var _0x1957d7=_0x5ed2[_0x4b2693];return _0x1957d7;};'use strict';var emlformat=require(_0x25ed('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x25ed('0x1'));var jsonpatch=require(_0x25ed('0x2'));var rp=require('request-promise');var moment=require(_0x25ed('0x3'));var BPromise=require(_0x25ed('0x4'));var Mustache=require('mustache');var util=require(_0x25ed('0x5'));var path=require(_0x25ed('0x6'));var sox=require(_0x25ed('0x7'));var csv=require(_0x25ed('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x25ed('0x9'));var _=require(_0x25ed('0xa'));var squel=require(_0x25ed('0xb'));var crypto=require(_0x25ed('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x25ed('0xd'));var Redis=require(_0x25ed('0xe'));var authService=require(_0x25ed('0xf'));var qs=require(_0x25ed('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x25ed('0x11'));var logger=require(_0x25ed('0x12'))(_0x25ed('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x25ed('0x14'));var db=require(_0x25ed('0x15'))['db'];function respondWithStatusCode(_0x1530e0,_0x623120){_0x623120=_0x623120||0xcc;return function(_0x187a10){if(_0x187a10){return _0x1530e0[_0x25ed('0x16')](_0x623120);}return _0x1530e0['status'](_0x623120)[_0x25ed('0x17')]();};}function respondWithResult(_0xbdc943,_0x4730c5){_0x4730c5=_0x4730c5||0xc8;return function(_0x54c37c){if(_0x54c37c){return _0xbdc943[_0x25ed('0x18')](_0x4730c5)['json'](_0x54c37c);}};}function respondWithFilteredResult(_0x3e9b5e,_0x7244b7){return function(_0x43e295){if(_0x43e295){var _0x551342=typeof _0x7244b7[_0x25ed('0x19')]===_0x25ed('0x1a')&&typeof _0x7244b7[_0x25ed('0x1b')]===_0x25ed('0x1a');var _0x405667=_0x43e295[_0x25ed('0x1c')];var _0x576378=_0x551342?0x0:_0x7244b7[_0x25ed('0x19')];var _0x3a86ae=_0x551342?_0x43e295['count']:_0x7244b7[_0x25ed('0x19')]+_0x7244b7[_0x25ed('0x1b')];var _0x3ec467;if(_0x3a86ae>=_0x405667){_0x3a86ae=_0x405667;_0x3ec467=0xc8;}else{_0x3ec467=0xce;}_0x3e9b5e['status'](_0x3ec467);return _0x3e9b5e[_0x25ed('0x1d')](_0x25ed('0x1e'),_0x576378+'-'+_0x3a86ae+'/'+_0x405667)[_0x25ed('0x1f')](_0x43e295);}return null;};}function patchUpdates(_0x2fb6ba){return function(_0xc04e54){try{jsonpatch[_0x25ed('0x20')](_0xc04e54,_0x2fb6ba,!![]);}catch(_0x257d6d){return BPromise[_0x25ed('0x21')](_0x257d6d);}return _0xc04e54[_0x25ed('0x22')]();};}function saveUpdates(_0x3414ac,_0x3bc398){return function(_0x4a8135){if(_0x4a8135){return _0x4a8135[_0x25ed('0x23')](_0x3414ac)[_0x25ed('0x24')](function(_0x402010){return _0x402010;});}return null;};}function removeEntity(_0x453181,_0x1e33f1){return function(_0x5d72ed){if(_0x5d72ed){return _0x5d72ed[_0x25ed('0x25')]()[_0x25ed('0x24')](function(){_0x453181[_0x25ed('0x18')](0xcc)[_0x25ed('0x17')]();});}};}function handleEntityNotFound(_0x561288,_0x2f5d93){return function(_0x225916){if(!_0x225916){_0x561288[_0x25ed('0x16')](0x194);}return _0x225916;};}function handleError(_0x5cd61f,_0x524736){_0x524736=_0x524736||0x1f4;return function(_0x35b206){logger['error'](_0x35b206[_0x25ed('0x26')]);if(_0x35b206[_0x25ed('0x27')]){delete _0x35b206['name'];}_0x5cd61f[_0x25ed('0x18')](_0x524736)[_0x25ed('0x28')](_0x35b206);};}exports['show']=function(_0x26456f,_0x30b096){var _0x31bde0={'raw':!![],'where':{'id':_0x26456f[_0x25ed('0x29')]['id']}},_0x6f3d9={};_0x6f3d9[_0x25ed('0x2a')]=_[_0x25ed('0x2b')](db['ChatProactiveAction'][_0x25ed('0x2c')]);_0x6f3d9['query']=_[_0x25ed('0x2b')](_0x26456f[_0x25ed('0x2d')]);_0x6f3d9[_0x25ed('0x2e')]=_['intersection'](_0x6f3d9[_0x25ed('0x2a')],_0x6f3d9['query']);_0x31bde0[_0x25ed('0x2f')]=_[_0x25ed('0x30')](_0x6f3d9[_0x25ed('0x2a')],qs[_0x25ed('0x31')](_0x26456f['query'][_0x25ed('0x31')]));_0x31bde0[_0x25ed('0x2f')]=_0x31bde0[_0x25ed('0x2f')][_0x25ed('0x32')]?_0x31bde0[_0x25ed('0x2f')]:_0x6f3d9['model'];if(_0x26456f[_0x25ed('0x2d')][_0x25ed('0x33')]){_0x31bde0[_0x25ed('0x34')]=[{'all':!![]}];}_0x31bde0=_[_0x25ed('0x35')]({},_0x31bde0,_0x26456f[_0x25ed('0x36')]);return db[_0x25ed('0x37')][_0x25ed('0x38')](_0x31bde0)[_0x25ed('0x24')](handleEntityNotFound(_0x30b096,null))[_0x25ed('0x24')](respondWithResult(_0x30b096,null))[_0x25ed('0x39')](handleError(_0x30b096,null));};exports[_0x25ed('0x3a')]=function(_0x287b92,_0x57310c){return db[_0x25ed('0x37')]['create'](_0x287b92[_0x25ed('0x3b')],{})[_0x25ed('0x24')](respondWithResult(_0x57310c,0xc9))['catch'](handleError(_0x57310c,null));};exports[_0x25ed('0x23')]=function(_0x1fd0d7,_0x4639ff){if(_0x1fd0d7[_0x25ed('0x3b')]['id']){delete _0x1fd0d7[_0x25ed('0x3b')]['id'];}return db[_0x25ed('0x37')]['find']({'where':{'id':_0x1fd0d7[_0x25ed('0x29')]['id']}})['then'](handleEntityNotFound(_0x4639ff,null))[_0x25ed('0x24')](saveUpdates(_0x1fd0d7['body'],null))[_0x25ed('0x24')](respondWithResult(_0x4639ff,null))[_0x25ed('0x39')](handleError(_0x4639ff,null));};exports[_0x25ed('0x25')]=function(_0x4ce418,_0x403867){return db[_0x25ed('0x37')][_0x25ed('0x38')]({'where':{'id':_0x4ce418[_0x25ed('0x29')]['id']}})['then'](handleEntityNotFound(_0x403867,null))[_0x25ed('0x24')](removeEntity(_0x403867,null))[_0x25ed('0x39')](handleError(_0x403867,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 2363a15..9488d43 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 _0x4363=['ChatProactiveAction','chat_proactive_actions','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatProactiveAction.attributes'];(function(_0x37db95,_0x4f2cca){var _0x28070c=function(_0x5712b6){while(--_0x5712b6){_0x37db95['push'](_0x37db95['shift']());}};_0x28070c(++_0x4f2cca);}(_0x4363,0x18e));var _0x3436=function(_0x53c37a,_0x5b1dd4){_0x53c37a=_0x53c37a-0x0;var _0x283edf=_0x4363[_0x53c37a];return _0x283edf;};'use strict';var _=require(_0x3436('0x0'));var util=require('util');var logger=require(_0x3436('0x1'))(_0x3436('0x2'));var moment=require(_0x3436('0x3'));var BPromise=require(_0x3436('0x4'));var rp=require(_0x3436('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3436('0x6'));var config=require(_0x3436('0x7'));var attributes=require(_0x3436('0x8'));module['exports']=function(_0x58d084,_0x1a5ab2){return _0x58d084['define'](_0x3436('0x9'),attributes,{'tableName':_0x3436('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf012=['api','moment','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','define','chat_proactive_actions','lodash','util'];(function(_0x2c0529,_0x5ec1ca){var _0x3d990f=function(_0x2dc8f2){while(--_0x2dc8f2){_0x2c0529['push'](_0x2c0529['shift']());}};_0x3d990f(++_0x5ec1ca);}(_0xf012,0x82));var _0x2f01=function(_0x3c3d59,_0x369b04){_0x3c3d59=_0x3c3d59-0x0;var _0x25d467=_0xf012[_0x3c3d59];return _0x25d467;};'use strict';var _=require(_0x2f01('0x0'));var util=require(_0x2f01('0x1'));var logger=require('../../config/logger')(_0x2f01('0x2'));var moment=require(_0x2f01('0x3'));var BPromise=require('bluebird');var rp=require(_0x2f01('0x4'));var fs=require('fs');var path=require(_0x2f01('0x5'));var rimraf=require(_0x2f01('0x6'));var config=require(_0x2f01('0x7'));var attributes=require(_0x2f01('0x8'));module['exports']=function(_0x217128,_0x199060){return _0x217128[_0x2f01('0x9')]('ChatProactiveAction',attributes,{'tableName':_0x2f01('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index be05d8f..6ac1bf2 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 _0xc0d8=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x9996d7,_0x36a17b){var _0x3b0dca=function(_0x510c76){while(--_0x510c76){_0x9996d7['push'](_0x9996d7['shift']());}};_0x3b0dca(++_0x36a17b);}(_0xc0d8,0xa8));var _0x8c0d=function(_0x148670,_0x2b0db3){_0x148670=_0x148670-0x0;var _0x5f52f7=_0xc0d8[_0x148670];return _0x5f52f7;};'use strict';var _=require(_0x8c0d('0x0'));var util=require(_0x8c0d('0x1'));var moment=require(_0x8c0d('0x2'));var BPromise=require(_0x8c0d('0x3'));var rs=require(_0x8c0d('0x4'));var fs=require('fs');var Redis=require(_0x8c0d('0x5'));var db=require(_0x8c0d('0x6'))['db'];var utils=require(_0x8c0d('0x7'));var logger=require(_0x8c0d('0x8'))(_0x8c0d('0x9'));var config=require('../../config/environment');var jayson=require(_0x8c0d('0xa'));var client=jayson[_0x8c0d('0xb')][_0x8c0d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x273063,_0x3d3b26,_0x2ae784){return new BPromise(function(_0x34d5de,_0x4f85a8){return client[_0x8c0d('0xd')](_0x273063,_0x2ae784)[_0x8c0d('0xe')](function(_0x32b6a8){logger[_0x8c0d('0xf')](_0x8c0d('0x10'),_0x3d3b26,'request\x20sent');logger[_0x8c0d('0x11')](_0x8c0d('0x12'),_0x3d3b26,_0x8c0d('0x13'),JSON[_0x8c0d('0x14')](_0x32b6a8));if(_0x32b6a8[_0x8c0d('0x15')]){if(_0x32b6a8[_0x8c0d('0x15')][_0x8c0d('0x16')]===0x1f4){logger['error'](_0x8c0d('0x10'),_0x3d3b26,_0x32b6a8[_0x8c0d('0x15')][_0x8c0d('0x17')]);return _0x4f85a8(_0x32b6a8[_0x8c0d('0x15')][_0x8c0d('0x17')]);}logger['error'](_0x8c0d('0x10'),_0x3d3b26,_0x32b6a8[_0x8c0d('0x15')][_0x8c0d('0x17')]);return _0x34d5de(_0x32b6a8['error'][_0x8c0d('0x17')]);}else{logger[_0x8c0d('0xf')](_0x8c0d('0x10'),_0x3d3b26,_0x8c0d('0x13'));_0x34d5de(_0x32b6a8['result'][_0x8c0d('0x17')]);}})[_0x8c0d('0x18')](function(_0x1ded10){logger[_0x8c0d('0x15')]('ChatProactiveAction,\x20%s,\x20%s',_0x3d3b26,_0x1ded10);_0x4f85a8(_0x1ded10);});});} \ No newline at end of file +var _0xa9b2=['info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x43c8b8,_0x5e8934){var _0x413be3=function(_0x23969c){while(--_0x23969c){_0x43c8b8['push'](_0x43c8b8['shift']());}};_0x413be3(++_0x5e8934);}(_0xa9b2,0x1e5));var _0x2a9b=function(_0x314a8c,_0x1c2e8d){_0x314a8c=_0x314a8c-0x0;var _0x1d4607=_0xa9b2[_0x314a8c];return _0x1d4607;};'use strict';var _=require(_0x2a9b('0x0'));var util=require(_0x2a9b('0x1'));var moment=require(_0x2a9b('0x2'));var BPromise=require(_0x2a9b('0x3'));var rs=require(_0x2a9b('0x4'));var fs=require('fs');var Redis=require(_0x2a9b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2a9b('0x6'));var logger=require('../../config/logger')(_0x2a9b('0x7'));var config=require(_0x2a9b('0x8'));var jayson=require(_0x2a9b('0x9'));var client=jayson[_0x2a9b('0xa')][_0x2a9b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2dafb4,_0x20b12c,_0x53c156){return new BPromise(function(_0x577525,_0x3748a0){return client[_0x2a9b('0xc')](_0x2dafb4,_0x53c156)['then'](function(_0x4891d2){logger['info'](_0x2a9b('0xd'),_0x20b12c,_0x2a9b('0xe'));logger[_0x2a9b('0xf')](_0x2a9b('0x10'),_0x20b12c,_0x2a9b('0xe'),JSON[_0x2a9b('0x11')](_0x4891d2));if(_0x4891d2['error']){if(_0x4891d2[_0x2a9b('0x12')][_0x2a9b('0x13')]===0x1f4){logger[_0x2a9b('0x12')](_0x2a9b('0xd'),_0x20b12c,_0x4891d2[_0x2a9b('0x12')]['message']);return _0x3748a0(_0x4891d2[_0x2a9b('0x12')]['message']);}logger[_0x2a9b('0x12')](_0x2a9b('0xd'),_0x20b12c,_0x4891d2[_0x2a9b('0x12')][_0x2a9b('0x14')]);return _0x577525(_0x4891d2[_0x2a9b('0x12')][_0x2a9b('0x14')]);}else{logger[_0x2a9b('0x15')](_0x2a9b('0xd'),_0x20b12c,_0x2a9b('0xe'));_0x577525(_0x4891d2['result'][_0x2a9b('0x14')]);}})[_0x2a9b('0x16')](function(_0x53ce4b){logger[_0x2a9b('0x12')](_0x2a9b('0xd'),_0x20b12c,_0x53ce4b);_0x3748a0(_0x53ce4b);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index d93ed59..c2e600d 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 _0xfdbd=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','/:id','isAuthenticated'];(function(_0x1b698d,_0x1aae30){var _0x49042b=function(_0xae9203){while(--_0xae9203){_0x1b698d['push'](_0x1b698d['shift']());}};_0x49042b(++_0x1aae30);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x19159d,_0x3d05c8){_0x19159d=_0x19159d-0x0;var _0x35884a=_0xfdbd[_0x19159d];return _0x35884a;};'use strict';var multer=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var path=require(_0xdfdb('0x2'));var timeout=require(_0xdfdb('0x3'));var express=require(_0xdfdb('0x4'));var router=express[_0xdfdb('0x5')]();var fs_extra=require(_0xdfdb('0x6'));var auth=require(_0xdfdb('0x7'));var interaction=require(_0xdfdb('0x8'));var config=require('../../config/environment');var controller=require(_0xdfdb('0x9'));router['get'](_0xdfdb('0xa'),auth[_0xdfdb('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xdfdb('0xc')]);router[_0xdfdb('0xd')]('/:id',auth[_0xdfdb('0xb')](),controller[_0xdfdb('0xe')]);router[_0xdfdb('0xf')](_0xdfdb('0xa'),auth[_0xdfdb('0xb')](),controller[_0xdfdb('0x10')]);module[_0xdfdb('0x11')]=router; \ No newline at end of file +var _0x9c5a=['/:id','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','create','put','update'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x189afd,_0x41d640){_0x189afd=_0x189afd-0x0;var _0x33f028=_0x9c5a[_0x189afd];return _0x33f028;};'use strict';var multer=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var path=require('path');var timeout=require(_0xa9c5('0x2'));var express=require(_0xa9c5('0x3'));var router=express[_0xa9c5('0x4')]();var fs_extra=require(_0xa9c5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa9c5('0x6'));var config=require(_0xa9c5('0x7'));var controller=require('./chatProactiveAction.controller');router[_0xa9c5('0x8')]('/:id',auth[_0xa9c5('0x9')](),controller[_0xa9c5('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa9c5('0xb')]);router[_0xa9c5('0xc')]('/:id',auth[_0xa9c5('0x9')](),controller[_0xa9c5('0xd')]);router['delete'](_0xa9c5('0xe'),auth[_0xa9c5('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index d603629..057f286 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 _0x1324=['INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','STRING','name'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0x1324,0x9d));var _0x4132=function(_0x5a6f32,_0x55b359){_0x5a6f32=_0x5a6f32-0x0;var _0x512785=_0x1324[_0x5a6f32];return _0x512785;};'use strict';var Sequelize=require(_0x4132('0x0'));module['exports']={'name':{'type':Sequelize[_0x4132('0x1')],'unique':_0x4132('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4132('0x1')]},'timeout':{'type':Sequelize[_0x4132('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4132('0x4')](_0x4132('0x5'),_0x4132('0x6'),_0x4132('0x7'))}}; \ No newline at end of file +var _0xbe4c=['INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','STRING'];(function(_0x5f0f7a,_0x244c53){var _0x8742e7=function(_0x48ff6e){while(--_0x48ff6e){_0x5f0f7a['push'](_0x5f0f7a['shift']());}};_0x8742e7(++_0x244c53);}(_0xbe4c,0x1e8));var _0xcbe4=function(_0x27dd62,_0x4cc168){_0x27dd62=_0x27dd62-0x0;var _0x3a2a72=_0xbe4c[_0x27dd62];return _0x3a2a72;};'use strict';var Sequelize=require(_0xcbe4('0x0'));module['exports']={'name':{'type':Sequelize[_0xcbe4('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xcbe4('0x1')]},'timeout':{'type':Sequelize[_0xcbe4('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcbe4('0x3')](_0xcbe4('0x4'),_0xcbe4('0x5'),_0xcbe4('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 70cc93a..25ec7a3 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 _0x43f2=['request-promise','moment','bluebird','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','papaparse','../../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','./chatQueue.socket','register','client','http','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','ChatQueues','UserProfileResource','end','stack','name','index','map','ChatQueue','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','type','options','includeAll','include','findAll','rows','params','keys','rawAttributes','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','body','describe','getMembers','findOne','UserChatQueue','hasOwnProperty','order','pick','ChatQueueId','findAndCountAll','UserId','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','User','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','userChatQueue:remove','addAgents','omit','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x40ebff,_0x1dd15e){var _0x40122a=function(_0xae6174){while(--_0xae6174){_0x40ebff['push'](_0x40ebff['shift']());}};_0x40122a(++_0x1dd15e);}(_0x43f2,0x97));var _0x243f=function(_0x5aecfb,_0x4a149d){_0x5aecfb=_0x5aecfb-0x0;var _0x34b827=_0x43f2[_0x5aecfb];return _0x34b827;};'use strict';var emlformat=require(_0x243f('0x0'));var rimraf=require(_0x243f('0x1'));var zipdir=require(_0x243f('0x2'));var jsonpatch=require(_0x243f('0x3'));var rp=require(_0x243f('0x4'));var moment=require(_0x243f('0x5'));var BPromise=require(_0x243f('0x6'));var Mustache=require(_0x243f('0x7'));var util=require('util');var path=require(_0x243f('0x8'));var sox=require(_0x243f('0x9'));var csv=require('to-csv');var ejs=require(_0x243f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x243f('0xb'));var crypto=require(_0x243f('0xc'));var jsforce=require(_0x243f('0xd'));var deskjs=require(_0x243f('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x243f('0xf'));var Redis=require('ioredis');var authService=require(_0x243f('0x10'));var qs=require(_0x243f('0x11'));var as=require(_0x243f('0x12'));var hardwareService=require(_0x243f('0x13'));var logger=require(_0x243f('0x14'))(_0x243f('0x15'));var utils=require(_0x243f('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x243f('0x17'));var db=require(_0x243f('0x18'))['db'];config[_0x243f('0x19')]=_[_0x243f('0x1a')](config[_0x243f('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x243f('0x1b'))(new Redis(config[_0x243f('0x19')]));require(_0x243f('0x1c'))[_0x243f('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x243f('0x1e')][_0x243f('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0xce6dc6,_0x545782,_0x20b5fb,_0x55f3f0){return new BPromise(function(_0x408f22,_0x22a92c){var _0x5de166=_0x55f3f0||client;return _0x5de166['request'](_0xce6dc6,_0x20b5fb)['then'](function(_0x1a115f){logger[_0x243f('0x20')](_0x243f('0x21'),_0x545782,'request\x20sent');logger[_0x243f('0x22')](_0x243f('0x23'),_0x545782,_0x243f('0x24'),JSON[_0x243f('0x25')](_0x1a115f));if(_0x1a115f[_0x243f('0x26')]){if(_0x1a115f[_0x243f('0x26')][_0x243f('0x27')]===0x1f4){logger[_0x243f('0x26')]('ChatQueue,\x20%s,\x20%s',_0x545782,_0x1a115f[_0x243f('0x26')]['message']);return _0x22a92c(_0x1a115f[_0x243f('0x26')][_0x243f('0x28')]);}logger[_0x243f('0x26')](_0x243f('0x21'),_0x545782,_0x1a115f[_0x243f('0x26')]['message']);return _0x408f22(_0x1a115f[_0x243f('0x26')][_0x243f('0x28')]);}else{logger[_0x243f('0x20')]('ChatQueue,\x20%s,\x20%s',_0x545782,_0x243f('0x24'));_0x408f22(_0x1a115f[_0x243f('0x29')]['message']);}})[_0x243f('0x2a')](function(_0x19c4a1){logger[_0x243f('0x26')](_0x243f('0x21'),_0x545782,_0x19c4a1);_0x22a92c(_0x19c4a1);});});}function respondWithStatusCode(_0x776b3,_0x548ac0){_0x548ac0=_0x548ac0||0xcc;return function(_0x3bb3de){if(_0x3bb3de){return _0x776b3[_0x243f('0x2b')](_0x548ac0);}return _0x776b3[_0x243f('0x2c')](_0x548ac0)['end']();};}function respondWithResult(_0x305be2,_0x543c57){_0x543c57=_0x543c57||0xc8;return function(_0x19cb67){if(_0x19cb67){return _0x305be2[_0x243f('0x2c')](_0x543c57)[_0x243f('0x2d')](_0x19cb67);}};}function respondWithFilteredResult(_0x2c6aa1,_0x1c889f){return function(_0x4754e1){if(_0x4754e1){var _0x436ade=typeof _0x1c889f['offset']===_0x243f('0x2e')&&typeof _0x1c889f[_0x243f('0x2f')]==='undefined';var _0x4ddd69=_0x4754e1[_0x243f('0x30')];var _0x380146=_0x436ade?0x0:_0x1c889f['offset'];var _0xc43768=_0x436ade?_0x4754e1['count']:_0x1c889f[_0x243f('0x31')]+_0x1c889f[_0x243f('0x2f')];var _0x4bcc98;if(_0xc43768>=_0x4ddd69){_0xc43768=_0x4ddd69;_0x4bcc98=0xc8;}else{_0x4bcc98=0xce;}_0x2c6aa1[_0x243f('0x2c')](_0x4bcc98);return _0x2c6aa1['set'](_0x243f('0x32'),_0x380146+'-'+_0xc43768+'/'+_0x4ddd69)[_0x243f('0x2d')](_0x4754e1);}return null;};}function patchUpdates(_0x124cdc){return function(_0x5c923b){try{jsonpatch[_0x243f('0x33')](_0x5c923b,_0x124cdc,!![]);}catch(_0x162cb2){return BPromise[_0x243f('0x34')](_0x162cb2);}return _0x5c923b[_0x243f('0x35')]();};}function saveUpdates(_0x480d7b,_0x1d3a11){return function(_0x1ee370){if(_0x1ee370){return _0x1ee370[_0x243f('0x36')](_0x480d7b)[_0x243f('0x37')](function(_0x5a1b14){return _0x5a1b14;});}return null;};}function removeEntity(_0x199405,_0x38fe37){return function(_0x1f1f95){if(_0x1f1f95){return _0x1f1f95[_0x243f('0x38')]()['then'](function(){var _0x24b21c=_0x1f1f95['get']({'plain':!![]});var _0x499312=_0x243f('0x39');return db[_0x243f('0x3a')][_0x243f('0x38')]({'where':{'type':_0x499312,'resourceId':_0x24b21c['id']}})[_0x243f('0x37')](function(){return _0x1f1f95;});})['then'](function(){_0x199405['status'](0xcc)[_0x243f('0x3b')]();});}};}function handleEntityNotFound(_0x5856f5,_0x43a848){return function(_0x179f66){if(!_0x179f66){_0x5856f5[_0x243f('0x2b')](0x194);}return _0x179f66;};}function handleError(_0x31f6f5,_0x8eaee0){_0x8eaee0=_0x8eaee0||0x1f4;return function(_0x4be4ad){logger[_0x243f('0x26')](_0x4be4ad[_0x243f('0x3c')]);if(_0x4be4ad[_0x243f('0x3d')]){delete _0x4be4ad[_0x243f('0x3d')];}_0x31f6f5[_0x243f('0x2c')](_0x8eaee0)['send'](_0x4be4ad);};}exports[_0x243f('0x3e')]=function(_0x53985c,_0x4ad269){var _0x4038fd={},_0xd4130a={},_0x517359={'count':0x0,'rows':[]};var _0x2221e3=_[_0x243f('0x3f')](db[_0x243f('0x40')]['rawAttributes'],function(_0x272887){return{'name':_0x272887[_0x243f('0x41')],'type':_0x272887['type'][_0x243f('0x42')]};});_0xd4130a[_0x243f('0x43')]=_['map'](_0x2221e3,_0x243f('0x3d'));_0xd4130a[_0x243f('0x44')]=_['keys'](_0x53985c['query']);_0xd4130a[_0x243f('0x45')]=_[_0x243f('0x46')](_0xd4130a[_0x243f('0x43')],_0xd4130a['query']);_0x4038fd[_0x243f('0x47')]=_['intersection'](_0xd4130a[_0x243f('0x43')],qs[_0x243f('0x48')](_0x53985c['query']['fields']));_0x4038fd[_0x243f('0x47')]=_0x4038fd['attributes'][_0x243f('0x49')]?_0x4038fd[_0x243f('0x47')]:_0xd4130a['model'];if(!_0x53985c['query']['hasOwnProperty'](_0x243f('0x4a'))){_0x4038fd[_0x243f('0x2f')]=qs['limit'](_0x53985c['query'][_0x243f('0x2f')]);_0x4038fd['offset']=qs['offset'](_0x53985c[_0x243f('0x44')]['offset']);}_0x4038fd['order']=qs[_0x243f('0x4b')](_0x53985c[_0x243f('0x44')][_0x243f('0x4b')]);_0x4038fd[_0x243f('0x4c')]=qs['filters'](_['pick'](_0x53985c['query'],_0xd4130a[_0x243f('0x45')]),_0x2221e3);if(_0x53985c['query'][_0x243f('0x4d')]){_0x4038fd[_0x243f('0x4c')]=_[_0x243f('0x4e')](_0x4038fd[_0x243f('0x4c')],{'$or':_[_0x243f('0x3f')](_0x2221e3,function(_0x591466){if(_0x591466[_0x243f('0x4f')]!=='VIRTUAL'){var _0x1ce528={};_0x1ce528[_0x591466['name']]={'$like':'%'+_0x53985c[_0x243f('0x44')][_0x243f('0x4d')]+'%'};return _0x1ce528;}})});}_0x4038fd=_[_0x243f('0x4e')]({},_0x4038fd,_0x53985c[_0x243f('0x50')]);var _0x414d6e={'where':_0x4038fd['where']};return db[_0x243f('0x40')][_0x243f('0x30')](_0x414d6e)[_0x243f('0x37')](function(_0x408023){_0x517359[_0x243f('0x30')]=_0x408023;if(_0x53985c[_0x243f('0x44')][_0x243f('0x51')]){_0x4038fd[_0x243f('0x52')]=[{'all':!![]}];}return db[_0x243f('0x40')][_0x243f('0x53')](_0x4038fd);})[_0x243f('0x37')](function(_0x3ad657){_0x517359[_0x243f('0x54')]=_0x3ad657;return _0x517359;})['then'](respondWithFilteredResult(_0x4ad269,_0x4038fd))['catch'](handleError(_0x4ad269,null));};exports['show']=function(_0x371c55,_0x42d122){var _0x37a288={'raw':!![],'where':{'id':_0x371c55[_0x243f('0x55')]['id']}},_0x4afcc3={};_0x4afcc3[_0x243f('0x43')]=_[_0x243f('0x56')](db[_0x243f('0x40')][_0x243f('0x57')]);_0x4afcc3[_0x243f('0x44')]=_['keys'](_0x371c55[_0x243f('0x44')]);_0x4afcc3[_0x243f('0x45')]=_[_0x243f('0x46')](_0x4afcc3[_0x243f('0x43')],_0x4afcc3[_0x243f('0x44')]);_0x37a288[_0x243f('0x47')]=_[_0x243f('0x46')](_0x4afcc3[_0x243f('0x43')],qs[_0x243f('0x48')](_0x371c55[_0x243f('0x44')][_0x243f('0x48')]));_0x37a288[_0x243f('0x47')]=_0x37a288[_0x243f('0x47')]['length']?_0x37a288[_0x243f('0x47')]:_0x4afcc3['model'];if(_0x371c55['query'][_0x243f('0x51')]){_0x37a288[_0x243f('0x52')]=[{'all':!![]}];}_0x37a288=_[_0x243f('0x4e')]({},_0x37a288,_0x371c55[_0x243f('0x50')]);return db['ChatQueue'][_0x243f('0x58')](_0x37a288)[_0x243f('0x37')](handleEntityNotFound(_0x42d122,null))[_0x243f('0x37')](respondWithResult(_0x42d122,null))[_0x243f('0x2a')](handleError(_0x42d122,null));};exports[_0x243f('0x59')]=function(_0x13a02e,_0x38a588){return db['ChatQueue'][_0x243f('0x59')](_0x13a02e['body'],{})['then'](function(_0xb05f7f){var _0x16c148=_0x13a02e[_0x243f('0x5a')][_0x243f('0x5b')]({'plain':!![]});if(!_0x16c148)throw new Error(_0x243f('0x5c'));if(_0x16c148[_0x243f('0x5d')]===_0x243f('0x5a')){var _0x5e8b90=_0xb05f7f[_0x243f('0x5b')]({'plain':!![]});var _0x17f49d=_0x243f('0x39');return db[_0x243f('0x5e')][_0x243f('0x58')]({'where':{'name':_0x17f49d,'userProfileId':_0x16c148[_0x243f('0x5f')]},'raw':!![]})[_0x243f('0x37')](function(_0xc829b3){if(_0xc829b3&&_0xc829b3[_0x243f('0x60')]===0x0){return db['UserProfileResource'][_0x243f('0x59')]({'name':_0x5e8b90[_0x243f('0x3d')],'resourceId':_0x5e8b90['id'],'type':_0xc829b3[_0x243f('0x3d')],'sectionId':_0xc829b3['id']},{})[_0x243f('0x37')](function(){return _0xb05f7f;});}else{return _0xb05f7f;}})[_0x243f('0x2a')](function(_0x152f30){logger[_0x243f('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x152f30);throw _0x152f30;});}return _0xb05f7f;})[_0x243f('0x37')](respondWithResult(_0x38a588,0xc9))[_0x243f('0x2a')](handleError(_0x38a588,null));};exports[_0x243f('0x36')]=function(_0x5383f2,_0x5b1873){if(_0x5383f2[_0x243f('0x61')]['id']){delete _0x5383f2[_0x243f('0x61')]['id'];}return db[_0x243f('0x40')][_0x243f('0x58')]({'where':{'id':_0x5383f2['params']['id']}})[_0x243f('0x37')](handleEntityNotFound(_0x5b1873,null))[_0x243f('0x37')](saveUpdates(_0x5383f2['body'],null))[_0x243f('0x37')](respondWithResult(_0x5b1873,null))[_0x243f('0x2a')](handleError(_0x5b1873,null));};exports[_0x243f('0x38')]=function(_0x4ac4db,_0x1b7a67){return db['ChatQueue']['find']({'where':{'id':_0x4ac4db[_0x243f('0x55')]['id']}})[_0x243f('0x37')](handleEntityNotFound(_0x1b7a67,null))['then'](removeEntity(_0x1b7a67,null))[_0x243f('0x2a')](handleError(_0x1b7a67,null));};exports[_0x243f('0x62')]=function(_0x45d7dc,_0x6f1b59){return db['ChatQueue'][_0x243f('0x62')]()['then'](respondWithResult(_0x6f1b59,null))[_0x243f('0x2a')](handleError(_0x6f1b59,null));};exports[_0x243f('0x63')]=function(_0x56ad7d,_0x3421ef,_0x312e63){var _0xfc36e5={'raw':!![],'where':{}},_0x2221ec={},_0x2764e3;return db['ChatQueue'][_0x243f('0x64')]({'where':{'id':_0x56ad7d[_0x243f('0x55')]['id']}})[_0x243f('0x37')](handleEntityNotFound(_0x3421ef,null))[_0x243f('0x37')](function(_0x54fca3){if(_0x54fca3){_0x2764e3=_0x54fca3['get']({'plain':!![]});_0x2221ec['model']=_[_0x243f('0x56')](db[_0x243f('0x65')][_0x243f('0x57')]);_0x2221ec[_0x243f('0x44')]=_[_0x243f('0x56')](_0x56ad7d[_0x243f('0x44')]);_0x2221ec[_0x243f('0x45')]=_[_0x243f('0x46')](_0x2221ec['model'],_0x2221ec['query']);_0xfc36e5[_0x243f('0x47')]=_[_0x243f('0x46')](_0x2221ec[_0x243f('0x43')],qs['fields'](_0x56ad7d[_0x243f('0x44')]['fields']));_0xfc36e5[_0x243f('0x47')]=_0xfc36e5[_0x243f('0x47')][_0x243f('0x49')]?_0xfc36e5[_0x243f('0x47')]:_0x2221ec['model'];if(!_0x56ad7d[_0x243f('0x44')][_0x243f('0x66')](_0x243f('0x4a'))){_0xfc36e5[_0x243f('0x2f')]=qs[_0x243f('0x2f')](_0x56ad7d[_0x243f('0x44')]['limit']);_0xfc36e5['offset']=qs[_0x243f('0x31')](_0x56ad7d[_0x243f('0x44')][_0x243f('0x31')]);}_0xfc36e5[_0x243f('0x67')]=qs[_0x243f('0x4b')](_0x56ad7d['query'][_0x243f('0x4b')]);_0xfc36e5[_0x243f('0x4c')]=qs[_0x243f('0x45')](_[_0x243f('0x68')](_0x56ad7d['query'],_0x2221ec[_0x243f('0x45')]));_0xfc36e5[_0x243f('0x4c')][_0x243f('0x69')]=_0x54fca3['id'];if(_0x56ad7d[_0x243f('0x44')][_0x243f('0x4d')]){_0xfc36e5[_0x243f('0x4c')]=_[_0x243f('0x4e')](_0xfc36e5['where'],{'$or':_[_0x243f('0x3f')](_0xfc36e5['attributes'],function(_0x53948e){var _0x4610df={};_0x4610df[_0x53948e]={'$like':'%'+_0x56ad7d['query']['filter']+'%'};return _0x4610df;})});}_0xfc36e5=_[_0x243f('0x4e')]({},_0xfc36e5,_0x56ad7d[_0x243f('0x50')]);return db[_0x243f('0x65')]['findAll'](_0xfc36e5);}})['then'](function(_0x47d078){if(_0x47d078){return db['User'][_0x243f('0x6a')]({'where':{'id':_[_0x243f('0x3f')](_0x47d078,_0x243f('0x6b')),'role':'agent'},'attributes':['id',_0x243f('0x3d'),'chatPause',_0x243f('0x6c'),_0x243f('0x6d')]});}})['then'](function(_0x419c39){if(_0x419c39){return{'count':_0x419c39[_0x243f('0x30')],'rows':_['map'](_0x419c39[_0x243f('0x54')],function(_0x55acbc){return{'membername':_0x55acbc['name'],'UserId':_0x55acbc['id'],'queue_name':_0x2764e3[_0x243f('0x3d')],'ChatQueueId':_0x2764e3['id'],'interface':util[_0x243f('0x6e')](_0x243f('0x6f'),_0x243f('0x70'),_0x55acbc[_0x243f('0x3d')]),'penalty':0x0,'paused':_0x55acbc['chatPause'],'createdAt':_0x55acbc[_0x243f('0x6d')],'updatedAt':_0x55acbc[_0x243f('0x6c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3421ef,_0xfc36e5))[_0x243f('0x2a')](handleError(_0x3421ef,null));};exports[_0x243f('0x71')]=function(_0x825b5f,_0x268be6,_0x330501){var _0x566a56={};var _0x4fcf5f={};var _0xf7520e;var _0x1d4841;return db[_0x243f('0x40')][_0x243f('0x64')]({'where':{'id':_0x825b5f[_0x243f('0x55')]['id']}})[_0x243f('0x37')](handleEntityNotFound(_0x268be6,null))[_0x243f('0x37')](function(_0x264188){if(_0x264188){_0xf7520e=_0x264188;_0x4fcf5f['model']=_[_0x243f('0x56')](db[_0x243f('0x72')]['rawAttributes']);_0x4fcf5f[_0x243f('0x44')]=_['keys'](_0x825b5f[_0x243f('0x44')]);_0x4fcf5f[_0x243f('0x45')]=_[_0x243f('0x46')](_0x4fcf5f[_0x243f('0x43')],_0x4fcf5f[_0x243f('0x44')]);_0x566a56['attributes']=_[_0x243f('0x46')](_0x4fcf5f['model'],qs['fields'](_0x825b5f[_0x243f('0x44')][_0x243f('0x48')]));_0x566a56['attributes']=_0x566a56[_0x243f('0x47')]['length']?_0x566a56[_0x243f('0x47')]:_0x4fcf5f['model'];_0x566a56[_0x243f('0x67')]=qs[_0x243f('0x4b')](_0x825b5f['query'][_0x243f('0x4b')]);_0x566a56[_0x243f('0x4c')]=qs[_0x243f('0x45')](_[_0x243f('0x68')](_0x825b5f[_0x243f('0x44')],_0x4fcf5f[_0x243f('0x45')]));if(_0x825b5f[_0x243f('0x44')]['filter']){_0x566a56['where']=_[_0x243f('0x4e')](_0x566a56[_0x243f('0x4c')],{'$or':_[_0x243f('0x3f')](_0x566a56[_0x243f('0x47')],function(_0x23f59b){var _0x38bfd9={};_0x38bfd9[_0x23f59b]={'$like':'%'+_0x825b5f[_0x243f('0x44')][_0x243f('0x4d')]+'%'};return _0x38bfd9;})});}_0x566a56=_[_0x243f('0x4e')]({},_0x566a56,_0x825b5f['options']);return _0xf7520e[_0x243f('0x71')](_0x566a56);}})['then'](function(_0x54bdd2){if(_0x54bdd2){_0x1d4841=_0x54bdd2['length'];if(!_0x825b5f[_0x243f('0x44')][_0x243f('0x66')](_0x243f('0x4a'))){_0x566a56[_0x243f('0x2f')]=qs[_0x243f('0x2f')](_0x825b5f[_0x243f('0x44')]['limit']);_0x566a56['offset']=qs['offset'](_0x825b5f[_0x243f('0x44')]['offset']);}return _0xf7520e[_0x243f('0x71')](_0x566a56);}})['then'](function(_0x185534){if(_0x185534){return _0x185534?{'count':_0x1d4841,'rows':_0x185534}:null;}})[_0x243f('0x37')](respondWithResult(_0x268be6,null))[_0x243f('0x2a')](handleError(_0x268be6,null));};exports[_0x243f('0x73')]=function(_0x573645,_0x346899,_0x4748b6){var _0x495cbd=_0x573645[_0x243f('0x61')][_0x243f('0x74')];return db[_0x243f('0x72')]['findAll']({'where':{'id':_0x495cbd},'attributes':['id'],'include':[{'model':db[_0x243f('0x75')],'as':'Agents','attributes':['id',_0x243f('0x3d'),_0x243f('0x76'),_0x243f('0x77'),_0x243f('0x78')],'raw':!![]}]})[_0x243f('0x37')](function(_0x206a3e){if(_0x206a3e){var _0xd02535=_[_0x243f('0x79')](_0x206a3e,function(_0x3eb9a9){var _0x4bf5be=_0x3eb9a9[_0x243f('0x5b')]({'plain':!![]});return _0x4bf5be[_0x243f('0x7a')];});return db['ChatQueue'][_0x243f('0x58')]({'where':{'id':_0x573645[_0x243f('0x55')]['id']}})[_0x243f('0x37')](function(_0xda7872){return db[_0x243f('0x7b')][_0x243f('0x7c')](function(_0x3fff63){return _0xda7872['addTeams'](_0x495cbd,{'transaction':_0x3fff63})['then'](function(){return BPromise[_0x243f('0x7d')](_0xd02535,function(_0x80a2d9){return db['UserChatQueue'][_0x243f('0x7e')]({'where':{'UserId':_0x80a2d9['id'],'ChatQueueId':_0x573645[_0x243f('0x55')]['id']},'transaction':_0x3fff63});});})[_0x243f('0x37')](function(){_0xd02535[_0x243f('0x7f')](function(_0x46b827){socket[_0x243f('0x80')](_0x243f('0x81'),{'UserId':_0x46b827['id'],'ChatQueueId':_0xda7872['id']});});});});});}})[_0x243f('0x37')](respondWithStatusCode(_0x346899,null))[_0x243f('0x2a')](handleError(_0x346899,null));};exports[_0x243f('0x82')]=function(_0x5c02cd,_0x162f8d,_0x49942f){return db['Team'][_0x243f('0x53')]({'where':{'id':_0x5c02cd['query'][_0x243f('0x74')]},'attributes':['id'],'include':[{'model':db[_0x243f('0x75')],'as':_0x243f('0x7a'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x162f8d,null))['then'](function(_0x54e46b){var _0x86f2cc=_[_0x243f('0x3f')](_0x54e46b,'id');var _0x184235=[];var _0x383120=[];var _0x556155=squel[_0x243f('0x83')]();_0x556155[_0x243f('0x84')](_0x243f('0x85'))['from'](_0x243f('0x86'),'tq')[_0x243f('0x87')](_0x243f('0x88'),'ut',_0x243f('0x89'))['where']('ChatQueueId\x20=\x20?',_0x5c02cd[_0x243f('0x55')]['id']);for(var _0x5bb5ed=0x0;_0x5bb5ed<_0x54e46b[_0x243f('0x49')];_0x5bb5ed+=0x1){let _0x13e070=_0x54e46b[_0x5bb5ed];for(var _0x443147=0x0;_0x443147<_0x13e070[_0x243f('0x7a')][_0x243f('0x49')];_0x443147+=0x1){let _0x3e117b=_0x13e070['Agents'][_0x443147];var _0x51d2b5=_0x556155['clone']();_0x51d2b5[_0x243f('0x4c')]('ut.UserId\x20=\x20?',_0x3e117b['id']);_0x383120['push'](db['sequelize']['query'](_0x51d2b5[_0x243f('0x8a')](),{'type':db[_0x243f('0x7b')][_0x243f('0x8b')][_0x243f('0x8c')]})[_0x243f('0x37')](function(_0x38ce34){if(_0x38ce34[_0x243f('0x49')]===0x1){return _0x3e117b['id'];}else{var _0x394ff8=_[_0x243f('0x8d')](_['map'](_0x38ce34,_0x243f('0x8e')),function(_0x31709e){return _[_0x243f('0x8f')](_0x86f2cc,_0x31709e);});if(_0x394ff8){return _0x3e117b['id'];}}}));}}return BPromise[_0x243f('0x90')](_0x383120)[_0x243f('0x37')](function(_0x305cf8){_0x184235=_(_0x184235)[_0x243f('0x91')](_0x305cf8)[_0x243f('0x92')]()[_0x243f('0x93')]();return db[_0x243f('0x40')][_0x243f('0x58')]({'where':{'id':_0x5c02cd['params']['id']}})[_0x243f('0x37')](function(_0x2e4599){return db['sequelize']['transaction'](function(_0x16a592){return _0x2e4599['removeTeams'](_0x5c02cd['query'][_0x243f('0x74')],{'transaction':_0x16a592})[_0x243f('0x37')](function(){if(!_[_0x243f('0x94')](_0x184235)){return _0x2e4599['removeAgents'](_0x184235,{'transaction':_0x16a592});}})[_0x243f('0x37')](function(){_0x184235['forEach'](function(_0x1eb1c1){socket[_0x243f('0x80')](_0x243f('0x95'),{'UserId':_0x1eb1c1,'ChatQueueId':_0x2e4599['id']});});});});});});})[_0x243f('0x37')](respondWithStatusCode(_0x162f8d,null))[_0x243f('0x2a')](handleError(_0x162f8d,null));};exports[_0x243f('0x96')]=function(_0x30b216,_0x2e9f4a,_0x1c3ec8){return db[_0x243f('0x40')][_0x243f('0x58')]({'where':{'id':_0x30b216['params']['id']}})['then'](handleEntityNotFound(_0x2e9f4a,null))[_0x243f('0x37')](function(_0x244cd5){if(_0x244cd5){return _0x244cd5['addAgents'](_0x30b216['body'][_0x243f('0x74')],_[_0x243f('0x97')](_0x30b216[_0x243f('0x61')],['ids','id'])||{})['spread'](function(_0x58c738){for(var _0x13c11c=0x0;_0x13c11c<_0x30b216[_0x243f('0x61')][_0x243f('0x74')][_0x243f('0x49')];_0x13c11c+=0x1){socket[_0x243f('0x80')](_0x243f('0x81'),{'UserId':Number(_0x30b216[_0x243f('0x61')]['ids'][_0x13c11c]),'ChatQueueId':Number(_0x30b216['params']['id'])});}return _0x58c738;});}})['then'](respondWithResult(_0x2e9f4a,null))[_0x243f('0x2a')](handleError(_0x2e9f4a,null));};exports[_0x243f('0x98')]=function(_0x4305b6,_0x167eaa,_0x1031bd){return db['ChatQueue'][_0x243f('0x58')]({'where':{'id':_0x4305b6[_0x243f('0x55')]['id']}})[_0x243f('0x37')](handleEntityNotFound(_0x167eaa,null))[_0x243f('0x37')](function(_0x3d0439){if(_0x3d0439){return _0x3d0439[_0x243f('0x98')](_0x4305b6[_0x243f('0x44')]['ids'])['then'](function(){if(_[_0x243f('0x99')](_0x4305b6[_0x243f('0x44')][_0x243f('0x74')])){for(var _0x706e34=0x0;_0x706e34<_0x4305b6[_0x243f('0x44')][_0x243f('0x74')]['length'];_0x706e34+=0x1){socket[_0x243f('0x80')](_0x243f('0x95'),{'UserId':Number(_0x4305b6[_0x243f('0x44')][_0x243f('0x74')][_0x706e34]),'ChatQueueId':Number(_0x4305b6[_0x243f('0x55')]['id'])});}}else{socket[_0x243f('0x80')](_0x243f('0x95'),{'UserId':Number(_0x4305b6['query']['ids']),'ChatQueueId':Number(_0x4305b6[_0x243f('0x55')]['id'])});}});}})['then'](respondWithStatusCode(_0x167eaa,null))[_0x243f('0x2a')](handleError(_0x167eaa,null));};exports['getAgents']=function(_0x432d62,_0x2778bb,_0x3ca30d){var _0x5753eb={};var _0x1b289c={};var _0x51f830;var _0x1c76ce;return db[_0x243f('0x40')][_0x243f('0x64')]({'where':{'id':_0x432d62[_0x243f('0x55')]['id']}})[_0x243f('0x37')](handleEntityNotFound(_0x2778bb,null))[_0x243f('0x37')](function(_0x4c5e7e){if(_0x4c5e7e){_0x51f830=_0x4c5e7e;_0x1b289c[_0x243f('0x43')]=_[_0x243f('0x56')](db[_0x243f('0x75')]['rawAttributes']);_0x1b289c['query']=_[_0x243f('0x56')](_0x432d62[_0x243f('0x44')]);_0x1b289c[_0x243f('0x45')]=_['intersection'](_0x1b289c[_0x243f('0x43')],_0x1b289c[_0x243f('0x44')]);_0x5753eb[_0x243f('0x47')]=_['intersection'](_0x1b289c[_0x243f('0x43')],qs[_0x243f('0x48')](_0x432d62[_0x243f('0x44')][_0x243f('0x48')]));_0x5753eb[_0x243f('0x47')]=_0x5753eb[_0x243f('0x47')]['length']?_0x5753eb['attributes']:_0x1b289c['model'];_0x5753eb[_0x243f('0x67')]=qs[_0x243f('0x4b')](_0x432d62[_0x243f('0x44')][_0x243f('0x4b')]);_0x5753eb[_0x243f('0x4c')]=qs[_0x243f('0x45')](_[_0x243f('0x68')](_0x432d62[_0x243f('0x44')],_0x1b289c[_0x243f('0x45')]));if(_0x432d62[_0x243f('0x44')][_0x243f('0x4d')]){_0x5753eb[_0x243f('0x4c')]=_[_0x243f('0x4e')](_0x5753eb['where'],{'$or':_[_0x243f('0x3f')](_0x5753eb[_0x243f('0x47')],function(_0x2f0737){var _0x5330ca={};_0x5330ca[_0x2f0737]={'$like':'%'+_0x432d62[_0x243f('0x44')][_0x243f('0x4d')]+'%'};return _0x5330ca;})});}_0x5753eb=_[_0x243f('0x4e')]({},_0x5753eb,_0x432d62['options']);return _0x51f830['getAgents'](_0x5753eb);}})[_0x243f('0x37')](function(_0x2a0607){if(_0x2a0607){_0x1c76ce=_0x2a0607[_0x243f('0x49')];if(!_0x432d62[_0x243f('0x44')][_0x243f('0x66')](_0x243f('0x4a'))){_0x5753eb[_0x243f('0x2f')]=qs['limit'](_0x432d62[_0x243f('0x44')][_0x243f('0x2f')]);_0x5753eb[_0x243f('0x31')]=qs['offset'](_0x432d62[_0x243f('0x44')][_0x243f('0x31')]);}return _0x51f830[_0x243f('0x9a')](_0x5753eb);}})[_0x243f('0x37')](function(_0x5b49fa){if(_0x5b49fa){return _0x5b49fa?{'count':_0x1c76ce,'rows':_0x5b49fa}:null;}})['then'](respondWithResult(_0x2778bb,null))[_0x243f('0x2a')](handleError(_0x2778bb,null));}; \ No newline at end of file +var _0x9702=['message','result','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','get','ChatQueues','UserProfileResource','destroy','stack','name','send','map','ChatQueue','rawAttributes','fieldName','key','keys','query','model','attributes','intersection','fields','length','hasOwnProperty','order','where','filters','pick','merge','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','nolimit','sort','ChatQueueId','filter','UserChatQueue','findAll','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','ids','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','SELECT','union','compact','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x529595,_0x2177e9){var _0x1ef41b=function(_0x381faf){while(--_0x381faf){_0x529595['push'](_0x529595['shift']());}};_0x1ef41b(++_0x2177e9);}(_0x9702,0x1a7));var _0x2970=function(_0x1d7106,_0x16ae3a){_0x1d7106=_0x1d7106-0x0;var _0x34305a=_0x9702[_0x1d7106];return _0x34305a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2970('0x0'));var zipdir=require(_0x2970('0x1'));var jsonpatch=require(_0x2970('0x2'));var rp=require('request-promise');var moment=require(_0x2970('0x3'));var BPromise=require(_0x2970('0x4'));var Mustache=require(_0x2970('0x5'));var util=require(_0x2970('0x6'));var path=require(_0x2970('0x7'));var sox=require(_0x2970('0x8'));var csv=require(_0x2970('0x9'));var ejs=require(_0x2970('0xa'));var fs=require('fs');var fs_extra=require(_0x2970('0xb'));var _=require(_0x2970('0xc'));var squel=require(_0x2970('0xd'));var crypto=require('crypto');var jsforce=require(_0x2970('0xe'));var deskjs=require(_0x2970('0xf'));var toCsv=require(_0x2970('0x9'));var querystring=require(_0x2970('0x10'));var Papa=require(_0x2970('0x11'));var Redis=require(_0x2970('0x12'));var authService=require(_0x2970('0x13'));var qs=require(_0x2970('0x14'));var as=require(_0x2970('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2970('0x16'))('api');var utils=require(_0x2970('0x17'));var config=require(_0x2970('0x18'));var licenseUtil=require(_0x2970('0x19'));var db=require('../../mysqldb')['db'];config[_0x2970('0x1a')]=_[_0x2970('0x1b')](config[_0x2970('0x1a')],{'host':_0x2970('0x1c'),'port':0x18eb});var socket=require(_0x2970('0x1d'))(new Redis(config[_0x2970('0x1a')]));require(_0x2970('0x1e'))[_0x2970('0x1f')](socket);var jayson=require(_0x2970('0x20'));var client=jayson[_0x2970('0x21')][_0x2970('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x112e31,_0x1118a4,_0x57d92d,_0x2be803){return new BPromise(function(_0x471716,_0xe508c8){var _0xc26061=_0x2be803||client;return _0xc26061['request'](_0x112e31,_0x57d92d)[_0x2970('0x23')](function(_0x3b44b3){logger[_0x2970('0x24')](_0x2970('0x25'),_0x1118a4,_0x2970('0x26'));logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0x1118a4,_0x2970('0x26'),JSON[_0x2970('0x27')](_0x3b44b3));if(_0x3b44b3[_0x2970('0x28')]){if(_0x3b44b3[_0x2970('0x28')][_0x2970('0x29')]===0x1f4){logger[_0x2970('0x28')](_0x2970('0x25'),_0x1118a4,_0x3b44b3[_0x2970('0x28')][_0x2970('0x2a')]);return _0xe508c8(_0x3b44b3[_0x2970('0x28')][_0x2970('0x2a')]);}logger['error'](_0x2970('0x25'),_0x1118a4,_0x3b44b3[_0x2970('0x28')][_0x2970('0x2a')]);return _0x471716(_0x3b44b3[_0x2970('0x28')][_0x2970('0x2a')]);}else{logger[_0x2970('0x24')](_0x2970('0x25'),_0x1118a4,_0x2970('0x26'));_0x471716(_0x3b44b3[_0x2970('0x2b')][_0x2970('0x2a')]);}})['catch'](function(_0x588aad){logger[_0x2970('0x28')]('ChatQueue,\x20%s,\x20%s',_0x1118a4,_0x588aad);_0xe508c8(_0x588aad);});});}function respondWithStatusCode(_0x3b26b2,_0x49da6b){_0x49da6b=_0x49da6b||0xcc;return function(_0x1f9a75){if(_0x1f9a75){return _0x3b26b2[_0x2970('0x2c')](_0x49da6b);}return _0x3b26b2[_0x2970('0x2d')](_0x49da6b)[_0x2970('0x2e')]();};}function respondWithResult(_0x16491c,_0x2b6318){_0x2b6318=_0x2b6318||0xc8;return function(_0x2d9a0c){if(_0x2d9a0c){return _0x16491c[_0x2970('0x2d')](_0x2b6318)[_0x2970('0x2f')](_0x2d9a0c);}};}function respondWithFilteredResult(_0x43f921,_0x5cc5fd){return function(_0x4d7437){if(_0x4d7437){var _0x17fa0e=typeof _0x5cc5fd['offset']===_0x2970('0x30')&&typeof _0x5cc5fd[_0x2970('0x31')]===_0x2970('0x30');var _0x347033=_0x4d7437[_0x2970('0x32')];var _0x1943a6=_0x17fa0e?0x0:_0x5cc5fd[_0x2970('0x33')];var _0xdced9f=_0x17fa0e?_0x4d7437[_0x2970('0x32')]:_0x5cc5fd['offset']+_0x5cc5fd[_0x2970('0x31')];var _0x2dd88a;if(_0xdced9f>=_0x347033){_0xdced9f=_0x347033;_0x2dd88a=0xc8;}else{_0x2dd88a=0xce;}_0x43f921[_0x2970('0x2d')](_0x2dd88a);return _0x43f921[_0x2970('0x34')](_0x2970('0x35'),_0x1943a6+'-'+_0xdced9f+'/'+_0x347033)[_0x2970('0x2f')](_0x4d7437);}return null;};}function patchUpdates(_0x41fb9e){return function(_0x4cdf45){try{jsonpatch[_0x2970('0x36')](_0x4cdf45,_0x41fb9e,!![]);}catch(_0x3cd246){return BPromise[_0x2970('0x37')](_0x3cd246);}return _0x4cdf45[_0x2970('0x38')]();};}function saveUpdates(_0x5d7b14,_0x461042){return function(_0x2f415c){if(_0x2f415c){return _0x2f415c[_0x2970('0x39')](_0x5d7b14)[_0x2970('0x23')](function(_0x1f1825){return _0x1f1825;});}return null;};}function removeEntity(_0x4fba93,_0x4addd8){return function(_0x484208){if(_0x484208){return _0x484208['destroy']()[_0x2970('0x23')](function(){var _0x9852aa=_0x484208[_0x2970('0x3a')]({'plain':!![]});var _0x4792a5=_0x2970('0x3b');return db[_0x2970('0x3c')][_0x2970('0x3d')]({'where':{'type':_0x4792a5,'resourceId':_0x9852aa['id']}})['then'](function(){return _0x484208;});})[_0x2970('0x23')](function(){_0x4fba93['status'](0xcc)[_0x2970('0x2e')]();});}};}function handleEntityNotFound(_0x5e0b1a,_0x193346){return function(_0x52ebdd){if(!_0x52ebdd){_0x5e0b1a['sendStatus'](0x194);}return _0x52ebdd;};}function handleError(_0x19193f,_0x10333c){_0x10333c=_0x10333c||0x1f4;return function(_0x2accac){logger[_0x2970('0x28')](_0x2accac[_0x2970('0x3e')]);if(_0x2accac[_0x2970('0x3f')]){delete _0x2accac['name'];}_0x19193f[_0x2970('0x2d')](_0x10333c)[_0x2970('0x40')](_0x2accac);};}exports['index']=function(_0x4432ef,_0x540336){var _0xdbb5d5={},_0x3197c2={},_0x37ae46={'count':0x0,'rows':[]};var _0x5a281c=_[_0x2970('0x41')](db[_0x2970('0x42')][_0x2970('0x43')],function(_0x22494b){return{'name':_0x22494b[_0x2970('0x44')],'type':_0x22494b['type'][_0x2970('0x45')]};});_0x3197c2['model']=_[_0x2970('0x41')](_0x5a281c,_0x2970('0x3f'));_0x3197c2['query']=_[_0x2970('0x46')](_0x4432ef[_0x2970('0x47')]);_0x3197c2['filters']=_['intersection'](_0x3197c2[_0x2970('0x48')],_0x3197c2[_0x2970('0x47')]);_0xdbb5d5[_0x2970('0x49')]=_[_0x2970('0x4a')](_0x3197c2[_0x2970('0x48')],qs[_0x2970('0x4b')](_0x4432ef[_0x2970('0x47')][_0x2970('0x4b')]));_0xdbb5d5[_0x2970('0x49')]=_0xdbb5d5[_0x2970('0x49')][_0x2970('0x4c')]?_0xdbb5d5[_0x2970('0x49')]:_0x3197c2['model'];if(!_0x4432ef[_0x2970('0x47')][_0x2970('0x4d')]('nolimit')){_0xdbb5d5['limit']=qs[_0x2970('0x31')](_0x4432ef[_0x2970('0x47')][_0x2970('0x31')]);_0xdbb5d5[_0x2970('0x33')]=qs[_0x2970('0x33')](_0x4432ef[_0x2970('0x47')]['offset']);}_0xdbb5d5[_0x2970('0x4e')]=qs['sort'](_0x4432ef[_0x2970('0x47')]['sort']);_0xdbb5d5[_0x2970('0x4f')]=qs[_0x2970('0x50')](_[_0x2970('0x51')](_0x4432ef[_0x2970('0x47')],_0x3197c2[_0x2970('0x50')]),_0x5a281c);if(_0x4432ef[_0x2970('0x47')]['filter']){_0xdbb5d5['where']=_[_0x2970('0x52')](_0xdbb5d5[_0x2970('0x4f')],{'$or':_['map'](_0x5a281c,function(_0x46bff2){if(_0x46bff2['type']!==_0x2970('0x53')){var _0x458311={};_0x458311[_0x46bff2['name']]={'$like':'%'+_0x4432ef[_0x2970('0x47')]['filter']+'%'};return _0x458311;}})});}_0xdbb5d5=_[_0x2970('0x52')]({},_0xdbb5d5,_0x4432ef[_0x2970('0x54')]);var _0x1117b4={'where':_0xdbb5d5[_0x2970('0x4f')]};return db['ChatQueue'][_0x2970('0x32')](_0x1117b4)[_0x2970('0x23')](function(_0x332f7a){_0x37ae46[_0x2970('0x32')]=_0x332f7a;if(_0x4432ef[_0x2970('0x47')][_0x2970('0x55')]){_0xdbb5d5[_0x2970('0x56')]=[{'all':!![]}];}return db[_0x2970('0x42')]['findAll'](_0xdbb5d5);})['then'](function(_0x419235){_0x37ae46[_0x2970('0x57')]=_0x419235;return _0x37ae46;})[_0x2970('0x23')](respondWithFilteredResult(_0x540336,_0xdbb5d5))[_0x2970('0x58')](handleError(_0x540336,null));};exports['show']=function(_0x150b47,_0x4f26c3){var _0x13d74a={'raw':!![],'where':{'id':_0x150b47[_0x2970('0x59')]['id']}},_0x49de2d={};_0x49de2d[_0x2970('0x48')]=_[_0x2970('0x46')](db['ChatQueue'][_0x2970('0x43')]);_0x49de2d['query']=_[_0x2970('0x46')](_0x150b47[_0x2970('0x47')]);_0x49de2d[_0x2970('0x50')]=_['intersection'](_0x49de2d['model'],_0x49de2d['query']);_0x13d74a[_0x2970('0x49')]=_[_0x2970('0x4a')](_0x49de2d[_0x2970('0x48')],qs[_0x2970('0x4b')](_0x150b47[_0x2970('0x47')]['fields']));_0x13d74a['attributes']=_0x13d74a['attributes'][_0x2970('0x4c')]?_0x13d74a[_0x2970('0x49')]:_0x49de2d[_0x2970('0x48')];if(_0x150b47[_0x2970('0x47')][_0x2970('0x55')]){_0x13d74a[_0x2970('0x56')]=[{'all':!![]}];}_0x13d74a=_[_0x2970('0x52')]({},_0x13d74a,_0x150b47[_0x2970('0x54')]);return db['ChatQueue'][_0x2970('0x5a')](_0x13d74a)[_0x2970('0x23')](handleEntityNotFound(_0x4f26c3,null))[_0x2970('0x23')](respondWithResult(_0x4f26c3,null))[_0x2970('0x58')](handleError(_0x4f26c3,null));};exports['create']=function(_0x344188,_0x45972a){return db['ChatQueue'][_0x2970('0x5b')](_0x344188['body'],{})[_0x2970('0x23')](function(_0x5f2b04){var _0x2c1e9c=_0x344188[_0x2970('0x5c')][_0x2970('0x3a')]({'plain':!![]});if(!_0x2c1e9c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2c1e9c[_0x2970('0x5d')]===_0x2970('0x5c')){var _0x1f855d=_0x5f2b04[_0x2970('0x3a')]({'plain':!![]});var _0x4feca5=_0x2970('0x3b');return db[_0x2970('0x5e')][_0x2970('0x5a')]({'where':{'name':_0x4feca5,'userProfileId':_0x2c1e9c[_0x2970('0x5f')]},'raw':!![]})[_0x2970('0x23')](function(_0x48cb06){if(_0x48cb06&&_0x48cb06[_0x2970('0x60')]===0x0){return db[_0x2970('0x3c')][_0x2970('0x5b')]({'name':_0x1f855d[_0x2970('0x3f')],'resourceId':_0x1f855d['id'],'type':_0x48cb06[_0x2970('0x3f')],'sectionId':_0x48cb06['id']},{})[_0x2970('0x23')](function(){return _0x5f2b04;});}else{return _0x5f2b04;}})[_0x2970('0x58')](function(_0x317c9e){logger[_0x2970('0x28')](_0x2970('0x61'),_0x317c9e);throw _0x317c9e;});}return _0x5f2b04;})[_0x2970('0x23')](respondWithResult(_0x45972a,0xc9))[_0x2970('0x58')](handleError(_0x45972a,null));};exports[_0x2970('0x39')]=function(_0x37d8f5,_0x30a05c){if(_0x37d8f5[_0x2970('0x62')]['id']){delete _0x37d8f5[_0x2970('0x62')]['id'];}return db[_0x2970('0x42')][_0x2970('0x5a')]({'where':{'id':_0x37d8f5['params']['id']}})[_0x2970('0x23')](handleEntityNotFound(_0x30a05c,null))[_0x2970('0x23')](saveUpdates(_0x37d8f5[_0x2970('0x62')],null))[_0x2970('0x23')](respondWithResult(_0x30a05c,null))[_0x2970('0x58')](handleError(_0x30a05c,null));};exports[_0x2970('0x3d')]=function(_0x383af5,_0x5d8b25){return db[_0x2970('0x42')][_0x2970('0x5a')]({'where':{'id':_0x383af5[_0x2970('0x59')]['id']}})[_0x2970('0x23')](handleEntityNotFound(_0x5d8b25,null))['then'](removeEntity(_0x5d8b25,null))['catch'](handleError(_0x5d8b25,null));};exports[_0x2970('0x63')]=function(_0x25ed9a,_0x1fd62d){return db[_0x2970('0x42')][_0x2970('0x63')]()[_0x2970('0x23')](respondWithResult(_0x1fd62d,null))['catch'](handleError(_0x1fd62d,null));};exports[_0x2970('0x64')]=function(_0x33e729,_0x2ddac2,_0x2273f9){var _0x25646b={'raw':!![],'where':{}},_0x109d86={},_0x23b1ff;return db[_0x2970('0x42')][_0x2970('0x65')]({'where':{'id':_0x33e729['params']['id']}})['then'](handleEntityNotFound(_0x2ddac2,null))[_0x2970('0x23')](function(_0x172e7f){if(_0x172e7f){_0x23b1ff=_0x172e7f['get']({'plain':!![]});_0x109d86['model']=_[_0x2970('0x46')](db['UserChatQueue'][_0x2970('0x43')]);_0x109d86[_0x2970('0x47')]=_['keys'](_0x33e729[_0x2970('0x47')]);_0x109d86[_0x2970('0x50')]=_[_0x2970('0x4a')](_0x109d86[_0x2970('0x48')],_0x109d86[_0x2970('0x47')]);_0x25646b[_0x2970('0x49')]=_[_0x2970('0x4a')](_0x109d86['model'],qs[_0x2970('0x4b')](_0x33e729[_0x2970('0x47')][_0x2970('0x4b')]));_0x25646b[_0x2970('0x49')]=_0x25646b[_0x2970('0x49')][_0x2970('0x4c')]?_0x25646b['attributes']:_0x109d86[_0x2970('0x48')];if(!_0x33e729[_0x2970('0x47')][_0x2970('0x4d')](_0x2970('0x66'))){_0x25646b[_0x2970('0x31')]=qs[_0x2970('0x31')](_0x33e729[_0x2970('0x47')]['limit']);_0x25646b['offset']=qs[_0x2970('0x33')](_0x33e729[_0x2970('0x47')][_0x2970('0x33')]);}_0x25646b[_0x2970('0x4e')]=qs[_0x2970('0x67')](_0x33e729[_0x2970('0x47')][_0x2970('0x67')]);_0x25646b['where']=qs[_0x2970('0x50')](_['pick'](_0x33e729[_0x2970('0x47')],_0x109d86[_0x2970('0x50')]));_0x25646b[_0x2970('0x4f')][_0x2970('0x68')]=_0x172e7f['id'];if(_0x33e729[_0x2970('0x47')]['filter']){_0x25646b['where']=_[_0x2970('0x52')](_0x25646b[_0x2970('0x4f')],{'$or':_[_0x2970('0x41')](_0x25646b['attributes'],function(_0x5981e1){var _0x5ef203={};_0x5ef203[_0x5981e1]={'$like':'%'+_0x33e729[_0x2970('0x47')][_0x2970('0x69')]+'%'};return _0x5ef203;})});}_0x25646b=_['merge']({},_0x25646b,_0x33e729[_0x2970('0x54')]);return db[_0x2970('0x6a')][_0x2970('0x6b')](_0x25646b);}})[_0x2970('0x23')](function(_0x18d61b){if(_0x18d61b){return db['User'][_0x2970('0x6c')]({'where':{'id':_[_0x2970('0x41')](_0x18d61b,_0x2970('0x6d')),'role':_0x2970('0x6e')},'attributes':['id','name',_0x2970('0x6f'),_0x2970('0x70'),_0x2970('0x71')]});}})['then'](function(_0x265ab3){if(_0x265ab3){return{'count':_0x265ab3[_0x2970('0x32')],'rows':_[_0x2970('0x41')](_0x265ab3[_0x2970('0x57')],function(_0x2ff8a3){return{'membername':_0x2ff8a3[_0x2970('0x3f')],'UserId':_0x2ff8a3['id'],'queue_name':_0x23b1ff['name'],'ChatQueueId':_0x23b1ff['id'],'interface':util['format'](_0x2970('0x72'),_0x2970('0x73'),_0x2ff8a3[_0x2970('0x3f')]),'penalty':0x0,'paused':_0x2ff8a3['chatPause'],'createdAt':_0x2ff8a3[_0x2970('0x71')],'updatedAt':_0x2ff8a3[_0x2970('0x70')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2970('0x23')](respondWithFilteredResult(_0x2ddac2,_0x25646b))[_0x2970('0x58')](handleError(_0x2ddac2,null));};exports[_0x2970('0x74')]=function(_0x330e69,_0x3619ff,_0x1c5f09){var _0x37ebe0={};var _0x12f7c3={};var _0x2ad2a6;var _0x13e413;return db[_0x2970('0x42')][_0x2970('0x65')]({'where':{'id':_0x330e69['params']['id']}})[_0x2970('0x23')](handleEntityNotFound(_0x3619ff,null))[_0x2970('0x23')](function(_0x589b16){if(_0x589b16){_0x2ad2a6=_0x589b16;_0x12f7c3['model']=_[_0x2970('0x46')](db[_0x2970('0x75')][_0x2970('0x43')]);_0x12f7c3[_0x2970('0x47')]=_['keys'](_0x330e69[_0x2970('0x47')]);_0x12f7c3[_0x2970('0x50')]=_[_0x2970('0x4a')](_0x12f7c3[_0x2970('0x48')],_0x12f7c3[_0x2970('0x47')]);_0x37ebe0['attributes']=_[_0x2970('0x4a')](_0x12f7c3['model'],qs[_0x2970('0x4b')](_0x330e69[_0x2970('0x47')][_0x2970('0x4b')]));_0x37ebe0['attributes']=_0x37ebe0[_0x2970('0x49')]['length']?_0x37ebe0[_0x2970('0x49')]:_0x12f7c3[_0x2970('0x48')];_0x37ebe0[_0x2970('0x4e')]=qs[_0x2970('0x67')](_0x330e69[_0x2970('0x47')][_0x2970('0x67')]);_0x37ebe0[_0x2970('0x4f')]=qs[_0x2970('0x50')](_[_0x2970('0x51')](_0x330e69[_0x2970('0x47')],_0x12f7c3[_0x2970('0x50')]));if(_0x330e69[_0x2970('0x47')]['filter']){_0x37ebe0[_0x2970('0x4f')]=_[_0x2970('0x52')](_0x37ebe0[_0x2970('0x4f')],{'$or':_[_0x2970('0x41')](_0x37ebe0[_0x2970('0x49')],function(_0x509fc3){var _0x3c7696={};_0x3c7696[_0x509fc3]={'$like':'%'+_0x330e69[_0x2970('0x47')][_0x2970('0x69')]+'%'};return _0x3c7696;})});}_0x37ebe0=_['merge']({},_0x37ebe0,_0x330e69[_0x2970('0x54')]);return _0x2ad2a6[_0x2970('0x74')](_0x37ebe0);}})[_0x2970('0x23')](function(_0x2ab51d){if(_0x2ab51d){_0x13e413=_0x2ab51d[_0x2970('0x4c')];if(!_0x330e69[_0x2970('0x47')]['hasOwnProperty'](_0x2970('0x66'))){_0x37ebe0[_0x2970('0x31')]=qs[_0x2970('0x31')](_0x330e69[_0x2970('0x47')][_0x2970('0x31')]);_0x37ebe0[_0x2970('0x33')]=qs['offset'](_0x330e69[_0x2970('0x47')][_0x2970('0x33')]);}return _0x2ad2a6[_0x2970('0x74')](_0x37ebe0);}})[_0x2970('0x23')](function(_0x2e79ed){if(_0x2e79ed){return _0x2e79ed?{'count':_0x13e413,'rows':_0x2e79ed}:null;}})[_0x2970('0x23')](respondWithResult(_0x3619ff,null))['catch'](handleError(_0x3619ff,null));};exports['addTeams']=function(_0x5eb40b,_0x1f8106,_0x749daa){var _0x586e7e=_0x5eb40b[_0x2970('0x62')]['ids'];return db[_0x2970('0x75')][_0x2970('0x6b')]({'where':{'id':_0x586e7e},'attributes':['id'],'include':[{'model':db[_0x2970('0x76')],'as':_0x2970('0x77'),'attributes':['id',_0x2970('0x3f'),_0x2970('0x78'),_0x2970('0x79'),_0x2970('0x7a')],'raw':!![]}]})[_0x2970('0x23')](function(_0x14d56a){if(_0x14d56a){var _0x3ed3a1=_[_0x2970('0x7b')](_0x14d56a,function(_0x116699){var _0x3ed50b=_0x116699[_0x2970('0x3a')]({'plain':!![]});return _0x3ed50b['Agents'];});return db['ChatQueue'][_0x2970('0x5a')]({'where':{'id':_0x5eb40b[_0x2970('0x59')]['id']}})[_0x2970('0x23')](function(_0x4a48cc){return db[_0x2970('0x7c')][_0x2970('0x7d')](function(_0x337f6c){return _0x4a48cc[_0x2970('0x7e')](_0x586e7e,{'transaction':_0x337f6c})['then'](function(){return BPromise[_0x2970('0x7f')](_0x3ed3a1,function(_0x5165e5){return db[_0x2970('0x6a')][_0x2970('0x80')]({'where':{'UserId':_0x5165e5['id'],'ChatQueueId':_0x5eb40b[_0x2970('0x59')]['id']},'transaction':_0x337f6c});});})[_0x2970('0x23')](function(){_0x3ed3a1[_0x2970('0x81')](function(_0x36d11c){socket[_0x2970('0x82')](_0x2970('0x83'),{'UserId':_0x36d11c['id'],'ChatQueueId':_0x4a48cc['id']});});});});});}})['then'](respondWithStatusCode(_0x1f8106,null))['catch'](handleError(_0x1f8106,null));};exports[_0x2970('0x84')]=function(_0x40a0c3,_0x25a838,_0x9e659a){return db['Team']['findAll']({'where':{'id':_0x40a0c3[_0x2970('0x47')][_0x2970('0x85')]},'attributes':['id'],'include':[{'model':db[_0x2970('0x76')],'as':_0x2970('0x77'),'attributes':['id'],'raw':!![]}]})[_0x2970('0x23')](handleEntityNotFound(_0x25a838,null))['then'](function(_0x392400){var _0x58822f=_[_0x2970('0x41')](_0x392400,'id');var _0x534854=[];var _0x474e11=[];var _0x1b01f3=squel[_0x2970('0x86')]();_0x1b01f3[_0x2970('0x87')](_0x2970('0x88'))[_0x2970('0x89')]('team_has_chat_queues','tq')[_0x2970('0x8a')](_0x2970('0x8b'),'ut',_0x2970('0x8c'))['where']('ChatQueueId\x20=\x20?',_0x40a0c3[_0x2970('0x59')]['id']);for(var _0x325e72=0x0;_0x325e72<_0x392400[_0x2970('0x4c')];_0x325e72+=0x1){let _0x4bd324=_0x392400[_0x325e72];for(var _0x5c1c30=0x0;_0x5c1c30<_0x4bd324[_0x2970('0x77')]['length'];_0x5c1c30+=0x1){let _0x2f7091=_0x4bd324[_0x2970('0x77')][_0x5c1c30];var _0x15b715=_0x1b01f3[_0x2970('0x8d')]();_0x15b715[_0x2970('0x4f')](_0x2970('0x8e'),_0x2f7091['id']);_0x474e11['push'](db['sequelize'][_0x2970('0x47')](_0x15b715[_0x2970('0x8f')](),{'type':db[_0x2970('0x7c')]['QueryTypes'][_0x2970('0x90')]})[_0x2970('0x23')](function(_0x399b52){if(_0x399b52[_0x2970('0x4c')]===0x1){return _0x2f7091['id'];}else{var _0xabfc70=_['every'](_[_0x2970('0x41')](_0x399b52,'TeamId'),function(_0x456802){return _['includes'](_0x58822f,_0x456802);});if(_0xabfc70){return _0x2f7091['id'];}}}));}}return BPromise['all'](_0x474e11)[_0x2970('0x23')](function(_0x46e414){_0x534854=_(_0x534854)[_0x2970('0x91')](_0x46e414)[_0x2970('0x92')]()['value']();return db[_0x2970('0x42')]['find']({'where':{'id':_0x40a0c3[_0x2970('0x59')]['id']}})[_0x2970('0x23')](function(_0x4ff908){return db[_0x2970('0x7c')][_0x2970('0x7d')](function(_0x28f51f){return _0x4ff908[_0x2970('0x84')](_0x40a0c3[_0x2970('0x47')][_0x2970('0x85')],{'transaction':_0x28f51f})['then'](function(){if(!_[_0x2970('0x93')](_0x534854)){return _0x4ff908[_0x2970('0x94')](_0x534854,{'transaction':_0x28f51f});}})['then'](function(){_0x534854[_0x2970('0x81')](function(_0x2f5623){socket[_0x2970('0x82')](_0x2970('0x95'),{'UserId':_0x2f5623,'ChatQueueId':_0x4ff908['id']});});});});});});})['then'](respondWithStatusCode(_0x25a838,null))[_0x2970('0x58')](handleError(_0x25a838,null));};exports['addAgents']=function(_0x424ec9,_0x584d90,_0x359a0b){return db[_0x2970('0x42')][_0x2970('0x5a')]({'where':{'id':_0x424ec9[_0x2970('0x59')]['id']}})['then'](handleEntityNotFound(_0x584d90,null))[_0x2970('0x23')](function(_0x417c48){if(_0x417c48){return _0x417c48[_0x2970('0x96')](_0x424ec9[_0x2970('0x62')]['ids'],_[_0x2970('0x97')](_0x424ec9['body'],['ids','id'])||{})[_0x2970('0x98')](function(_0x1d643c){for(var _0x3fd4ad=0x0;_0x3fd4ad<_0x424ec9[_0x2970('0x62')][_0x2970('0x85')][_0x2970('0x4c')];_0x3fd4ad+=0x1){socket[_0x2970('0x82')](_0x2970('0x83'),{'UserId':Number(_0x424ec9[_0x2970('0x62')][_0x2970('0x85')][_0x3fd4ad]),'ChatQueueId':Number(_0x424ec9[_0x2970('0x59')]['id'])});}return _0x1d643c;});}})[_0x2970('0x23')](respondWithResult(_0x584d90,null))[_0x2970('0x58')](handleError(_0x584d90,null));};exports[_0x2970('0x94')]=function(_0x4d19a7,_0x7b432,_0x510824){return db[_0x2970('0x42')][_0x2970('0x5a')]({'where':{'id':_0x4d19a7[_0x2970('0x59')]['id']}})[_0x2970('0x23')](handleEntityNotFound(_0x7b432,null))[_0x2970('0x23')](function(_0x1fb4d0){if(_0x1fb4d0){return _0x1fb4d0[_0x2970('0x94')](_0x4d19a7['query'][_0x2970('0x85')])[_0x2970('0x23')](function(){if(_[_0x2970('0x99')](_0x4d19a7[_0x2970('0x47')][_0x2970('0x85')])){for(var _0x404a40=0x0;_0x404a40<_0x4d19a7['query'][_0x2970('0x85')][_0x2970('0x4c')];_0x404a40+=0x1){socket[_0x2970('0x82')](_0x2970('0x95'),{'UserId':Number(_0x4d19a7[_0x2970('0x47')][_0x2970('0x85')][_0x404a40]),'ChatQueueId':Number(_0x4d19a7[_0x2970('0x59')]['id'])});}}else{socket['emit'](_0x2970('0x95'),{'UserId':Number(_0x4d19a7['query']['ids']),'ChatQueueId':Number(_0x4d19a7[_0x2970('0x59')]['id'])});}});}})[_0x2970('0x23')](respondWithStatusCode(_0x7b432,null))[_0x2970('0x58')](handleError(_0x7b432,null));};exports[_0x2970('0x9a')]=function(_0x221452,_0x43c44a,_0x3122d7){var _0x2eb8b8={};var _0x2c0016={};var _0x1dcd22;var _0x2b4325;return db[_0x2970('0x42')][_0x2970('0x65')]({'where':{'id':_0x221452[_0x2970('0x59')]['id']}})[_0x2970('0x23')](handleEntityNotFound(_0x43c44a,null))[_0x2970('0x23')](function(_0xd40089){if(_0xd40089){_0x1dcd22=_0xd40089;_0x2c0016[_0x2970('0x48')]=_[_0x2970('0x46')](db[_0x2970('0x76')][_0x2970('0x43')]);_0x2c0016['query']=_['keys'](_0x221452[_0x2970('0x47')]);_0x2c0016[_0x2970('0x50')]=_[_0x2970('0x4a')](_0x2c0016[_0x2970('0x48')],_0x2c0016[_0x2970('0x47')]);_0x2eb8b8[_0x2970('0x49')]=_[_0x2970('0x4a')](_0x2c0016['model'],qs['fields'](_0x221452[_0x2970('0x47')]['fields']));_0x2eb8b8['attributes']=_0x2eb8b8[_0x2970('0x49')][_0x2970('0x4c')]?_0x2eb8b8[_0x2970('0x49')]:_0x2c0016[_0x2970('0x48')];_0x2eb8b8['order']=qs['sort'](_0x221452[_0x2970('0x47')][_0x2970('0x67')]);_0x2eb8b8[_0x2970('0x4f')]=qs['filters'](_['pick'](_0x221452[_0x2970('0x47')],_0x2c0016['filters']));if(_0x221452[_0x2970('0x47')][_0x2970('0x69')]){_0x2eb8b8[_0x2970('0x4f')]=_[_0x2970('0x52')](_0x2eb8b8[_0x2970('0x4f')],{'$or':_[_0x2970('0x41')](_0x2eb8b8['attributes'],function(_0x517d01){var _0x193cd4={};_0x193cd4[_0x517d01]={'$like':'%'+_0x221452[_0x2970('0x47')][_0x2970('0x69')]+'%'};return _0x193cd4;})});}_0x2eb8b8=_[_0x2970('0x52')]({},_0x2eb8b8,_0x221452[_0x2970('0x54')]);return _0x1dcd22[_0x2970('0x9a')](_0x2eb8b8);}})[_0x2970('0x23')](function(_0x5f4d4b){if(_0x5f4d4b){_0x2b4325=_0x5f4d4b[_0x2970('0x4c')];if(!_0x221452[_0x2970('0x47')][_0x2970('0x4d')](_0x2970('0x66'))){_0x2eb8b8[_0x2970('0x31')]=qs[_0x2970('0x31')](_0x221452[_0x2970('0x47')][_0x2970('0x31')]);_0x2eb8b8[_0x2970('0x33')]=qs[_0x2970('0x33')](_0x221452['query']['offset']);}return _0x1dcd22['getAgents'](_0x2eb8b8);}})[_0x2970('0x23')](function(_0x306efb){if(_0x306efb){return _0x306efb?{'count':_0x2b4325,'rows':_0x306efb}:null;}})[_0x2970('0x23')](respondWithResult(_0x43c44a,null))[_0x2970('0x58')](handleError(_0x43c44a,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 0807f8a..c6287ba 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 _0x1c06=['hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x20c522,_0x50e1d2){var _0x346df6=function(_0x2ef44c){while(--_0x2ef44c){_0x20c522['push'](_0x20c522['shift']());}};_0x346df6(++_0x50e1d2);}(_0x1c06,0xc0));var _0x61c0=function(_0x4e90e3,_0x570a1d){_0x4e90e3=_0x4e90e3-0x0;var _0x295e5b=_0x1c06[_0x4e90e3];return _0x295e5b;};'use strict';var EventEmitter=require(_0x61c0('0x0'));var ChatQueue=require(_0x61c0('0x1'))['db'][_0x61c0('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x61c0('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x61c0('0x4'),'afterDestroy':_0x61c0('0x5')};function emitEvent(_0x5a1865){return function(_0x3ccc01,_0xf4617f,_0x3dfe21){ChatQueueEvents[_0x61c0('0x6')](_0x5a1865+':'+_0x3ccc01['id'],_0x3ccc01);ChatQueueEvents[_0x61c0('0x6')](_0x5a1865,_0x3ccc01);_0x3dfe21(null);};}for(var e in events){if(events[_0x61c0('0x7')](e)){var event=events[e];ChatQueue[_0x61c0('0x8')](e,emitEvent(event));}}module[_0x61c0('0x9')]=ChatQueueEvents; \ No newline at end of file +var _0xc4c1=['hook','exports','events','ChatQueue','setMaxListeners','save','emit','hasOwnProperty'];(function(_0x2583a8,_0x55f4ff){var _0x33efed=function(_0x4d2ec8){while(--_0x4d2ec8){_0x2583a8['push'](_0x2583a8['shift']());}};_0x33efed(++_0x55f4ff);}(_0xc4c1,0x1ea));var _0x1c4c=function(_0x2a26f2,_0x35a965){_0x2a26f2=_0x2a26f2-0x0;var _0x2c3f1b=_0xc4c1[_0x2a26f2];return _0x2c3f1b;};'use strict';var EventEmitter=require(_0x1c4c('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x1c4c('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x1c4c('0x2')](0x0);var events={'afterCreate':_0x1c4c('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x7bd058){return function(_0x592b56,_0x251132,_0x447b61){ChatQueueEvents[_0x1c4c('0x4')](_0x7bd058+':'+_0x592b56['id'],_0x592b56);ChatQueueEvents[_0x1c4c('0x4')](_0x7bd058,_0x592b56);_0x447b61(null);};}for(var e in events){if(events[_0x1c4c('0x5')](e)){var event=events[e];ChatQueue[_0x1c4c('0x6')](e,emitEvent(event));}}module[_0x1c4c('0x7')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 20d9775..c1dc8ba 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 _0xe819=['api','moment','bluebird','path','rimraf','../../config/environment','./chatQueue.attributes','ChatQueue','chat_queues','lodash','../../config/logger'];(function(_0x5ac1e5,_0x4b5012){var _0x1bccc6=function(_0x102562){while(--_0x102562){_0x5ac1e5['push'](_0x5ac1e5['shift']());}};_0x1bccc6(++_0x4b5012);}(_0xe819,0x17f));var _0x9e81=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xe819[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x9e81('0x0'));var util=require('util');var logger=require(_0x9e81('0x1'))(_0x9e81('0x2'));var moment=require(_0x9e81('0x3'));var BPromise=require(_0x9e81('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9e81('0x5'));var rimraf=require(_0x9e81('0x6'));var config=require(_0x9e81('0x7'));var attributes=require(_0x9e81('0x8'));module['exports']=function(_0x1ad12d,_0x30a50b){return _0x1ad12d['define'](_0x9e81('0x9'),attributes,{'tableName':_0x9e81('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd6=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatQueue.attributes','ChatQueue','chat_queues'];(function(_0x314025,_0x4a899c){var _0x1bef69=function(_0x162422){while(--_0x162422){_0x314025['push'](_0x314025['shift']());}};_0x1bef69(++_0x4a899c);}(_0xedd6,0x108));var _0x6edd=function(_0x19d9a4,_0x195086){_0x19d9a4=_0x19d9a4-0x0;var _0x46397a=_0xedd6[_0x19d9a4];return _0x46397a;};'use strict';var _=require('lodash');var util=require(_0x6edd('0x0'));var logger=require(_0x6edd('0x1'))(_0x6edd('0x2'));var moment=require(_0x6edd('0x3'));var BPromise=require(_0x6edd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6edd('0x5'));var rimraf=require(_0x6edd('0x6'));var config=require(_0x6edd('0x7'));var attributes=require(_0x6edd('0x8'));module['exports']=function(_0x54fbec,_0x11a75b){return _0x54fbec['define'](_0x6edd('0x9'),attributes,{'tableName':_0x6edd('0xa'),'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 acc5c96..0bd4eb2 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 _0x30d6=['ChatQueue','options','raw','attributes','limit','map','include','model','GetChatQueue','stringify','ShowChatQueue','find','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','redis','defaults','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch'];(function(_0x5802bb,_0x4bef35){var _0x4b02b7=function(_0x3502a1){while(--_0x3502a1){_0x5802bb['push'](_0x5802bb['shift']());}};_0x4b02b7(++_0x4bef35);}(_0x30d6,0x1b0));var _0x630d=function(_0x3ee5df,_0x583073){_0x3ee5df=_0x3ee5df-0x0;var _0x446d24=_0x30d6[_0x3ee5df];return _0x446d24;};'use strict';var _=require(_0x630d('0x0'));var util=require(_0x630d('0x1'));var moment=require('moment');var BPromise=require(_0x630d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x630d('0x3'));var db=require(_0x630d('0x4'))['db'];var utils=require(_0x630d('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x630d('0x6'));var jayson=require(_0x630d('0x7'));var client=jayson[_0x630d('0x8')]['http']({'port':0x232a});config[_0x630d('0x9')]=_[_0x630d('0xa')](config[_0x630d('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x630d('0x9')]));require(_0x630d('0xb'))[_0x630d('0xc')](socket);function respondWithRpcPromise(_0x382760,_0x4d4f13,_0xc5bc63){return new BPromise(function(_0x43ea98,_0x2f88fb){return client[_0x630d('0xd')](_0x382760,_0xc5bc63)[_0x630d('0xe')](function(_0x4294d0){logger[_0x630d('0xf')](_0x630d('0x10'),_0x4d4f13,_0x630d('0x11'));logger[_0x630d('0x12')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x4d4f13,_0x630d('0x11'),JSON['stringify'](_0x4294d0));if(_0x4294d0[_0x630d('0x13')]){if(_0x4294d0[_0x630d('0x13')]['code']===0x1f4){logger[_0x630d('0x13')](_0x630d('0x10'),_0x4d4f13,_0x4294d0[_0x630d('0x13')][_0x630d('0x14')]);return _0x2f88fb(_0x4294d0[_0x630d('0x13')][_0x630d('0x14')]);}logger[_0x630d('0x13')](_0x630d('0x10'),_0x4d4f13,_0x4294d0['error'][_0x630d('0x14')]);return _0x43ea98(_0x4294d0['error'][_0x630d('0x14')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x4d4f13,_0x630d('0x11'));_0x43ea98(_0x4294d0[_0x630d('0x15')]['message']);}})[_0x630d('0x16')](function(_0x18e685){logger['error'](_0x630d('0x10'),_0x4d4f13,_0x18e685);_0x2f88fb(_0x18e685);});});}exports['GetChatQueue']=function(_0x4df27f){var _0x456b07=this;return new Promise(function(_0x53498b,_0x2d960f){return db[_0x630d('0x17')]['findAll']({'raw':_0x4df27f[_0x630d('0x18')]?_0x4df27f[_0x630d('0x18')][_0x630d('0x19')]===undefined?!![]:![]:!![],'where':_0x4df27f[_0x630d('0x18')]?_0x4df27f['options']['where']||null:null,'attributes':_0x4df27f[_0x630d('0x18')]?_0x4df27f[_0x630d('0x18')][_0x630d('0x1a')]||null:null,'limit':_0x4df27f['options']?_0x4df27f[_0x630d('0x18')][_0x630d('0x1b')]||null:null,'include':_0x4df27f[_0x630d('0x18')]?_0x4df27f[_0x630d('0x18')]['include']?_[_0x630d('0x1c')](_0x4df27f[_0x630d('0x18')][_0x630d('0x1d')],function(_0x2ba2c9){return{'model':db[_0x2ba2c9[_0x630d('0x1e')]],'as':_0x2ba2c9['as'],'attributes':_0x2ba2c9[_0x630d('0x1a')],'include':_0x2ba2c9[_0x630d('0x1d')]?_['map'](_0x2ba2c9[_0x630d('0x1d')],function(_0x5c5d36){return{'model':db[_0x5c5d36[_0x630d('0x1e')]],'as':_0x5c5d36['as'],'attributes':_0x5c5d36['attributes'],'include':_0x5c5d36['include']?_[_0x630d('0x1c')](_0x5c5d36[_0x630d('0x1d')],function(_0x3d62dd){return{'model':db[_0x3d62dd['model']],'as':_0x3d62dd['as'],'attributes':_0x3d62dd[_0x630d('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2bed85){logger[_0x630d('0xf')](_0x630d('0x1f'),_0x4df27f);logger[_0x630d('0x12')](_0x630d('0x1f'),_0x4df27f,JSON[_0x630d('0x20')](_0x2bed85));_0x53498b(_0x2bed85);})[_0x630d('0x16')](function(_0x2d6d26){logger[_0x630d('0x13')](_0x630d('0x1f'),_0x2d6d26['message'],_0x4df27f);_0x2d960f(_0x456b07[_0x630d('0x13')](0x1f4,_0x2d6d26[_0x630d('0x14')]));});});};exports[_0x630d('0x21')]=function(_0x789005){var _0x25cf85=this;return new Promise(function(_0x18c8a2,_0x58e392){return db[_0x630d('0x17')][_0x630d('0x22')]({'raw':_0x789005[_0x630d('0x18')]?_0x789005[_0x630d('0x18')][_0x630d('0x19')]===undefined?!![]:![]:!![],'where':_0x789005['options']?_0x789005[_0x630d('0x18')]['where']||null:null,'attributes':_0x789005[_0x630d('0x18')]?_0x789005[_0x630d('0x18')][_0x630d('0x1a')]||null:null,'include':_0x789005[_0x630d('0x18')]?_0x789005['options'][_0x630d('0x1d')]?_['map'](_0x789005[_0x630d('0x18')][_0x630d('0x1d')],function(_0x63c194){return{'model':db[_0x63c194[_0x630d('0x1e')]],'as':_0x63c194['as'],'attributes':_0x63c194['attributes'],'include':_0x63c194[_0x630d('0x1d')]?_[_0x630d('0x1c')](_0x63c194['include'],function(_0xa10a79){return{'model':db[_0xa10a79[_0x630d('0x1e')]],'as':_0xa10a79['as'],'attributes':_0xa10a79[_0x630d('0x1a')],'include':_0xa10a79['include']?_[_0x630d('0x1c')](_0xa10a79[_0x630d('0x1d')],function(_0x22ae2c){return{'model':db[_0x22ae2c['model']],'as':_0x22ae2c['as'],'attributes':_0x22ae2c[_0x630d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x630d('0xe')](function(_0x598a60){logger[_0x630d('0xf')](_0x630d('0x21'),_0x789005);logger[_0x630d('0x12')](_0x630d('0x21'),_0x789005,JSON[_0x630d('0x20')](_0x598a60));_0x18c8a2(_0x598a60);})[_0x630d('0x16')](function(_0x4609ce){logger[_0x630d('0x13')](_0x630d('0x21'),_0x4609ce['message'],_0x789005);_0x58e392(_0x25cf85[_0x630d('0x13')](0x1f4,_0x4609ce['message']));});});}; \ No newline at end of file +var _0xdc9c=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','attributes','limit','include','map','model','debug','ShowChatQueue','find','where','bluebird','ioredis'];(function(_0x47f89c,_0x16325e){var _0x499805=function(_0x3dcc15){while(--_0x3dcc15){_0x47f89c['push'](_0x47f89c['shift']());}};_0x499805(++_0x16325e);}(_0xdc9c,0xe2));var _0xcdc9=function(_0x4f72bb,_0x32a014){_0x4f72bb=_0x4f72bb-0x0;var _0x4b4a32=_0xdc9c[_0x4f72bb];return _0x4b4a32;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xcdc9('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcdc9('0x1'));var db=require(_0xcdc9('0x2'))['db'];var utils=require(_0xcdc9('0x3'));var logger=require(_0xcdc9('0x4'))('rpc');var config=require(_0xcdc9('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xcdc9('0x6')][_0xcdc9('0x7')]({'port':0x232a});config[_0xcdc9('0x8')]=_[_0xcdc9('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xcdc9('0xa'))[_0xcdc9('0xb')](socket);function respondWithRpcPromise(_0x1efa14,_0x3feb96,_0x3ee1a5){return new BPromise(function(_0x1afa92,_0x3a7cb4){return client[_0xcdc9('0xc')](_0x1efa14,_0x3ee1a5)[_0xcdc9('0xd')](function(_0x5db48d){logger[_0xcdc9('0xe')](_0xcdc9('0xf'),_0x3feb96,_0xcdc9('0x10'));logger['debug'](_0xcdc9('0x11'),_0x3feb96,_0xcdc9('0x10'),JSON[_0xcdc9('0x12')](_0x5db48d));if(_0x5db48d[_0xcdc9('0x13')]){if(_0x5db48d[_0xcdc9('0x13')][_0xcdc9('0x14')]===0x1f4){logger[_0xcdc9('0x13')](_0xcdc9('0xf'),_0x3feb96,_0x5db48d[_0xcdc9('0x13')][_0xcdc9('0x15')]);return _0x3a7cb4(_0x5db48d[_0xcdc9('0x13')][_0xcdc9('0x15')]);}logger[_0xcdc9('0x13')](_0xcdc9('0xf'),_0x3feb96,_0x5db48d[_0xcdc9('0x13')]['message']);return _0x1afa92(_0x5db48d[_0xcdc9('0x13')][_0xcdc9('0x15')]);}else{logger['info'](_0xcdc9('0xf'),_0x3feb96,_0xcdc9('0x10'));_0x1afa92(_0x5db48d[_0xcdc9('0x16')]['message']);}})[_0xcdc9('0x17')](function(_0x39667e){logger[_0xcdc9('0x13')](_0xcdc9('0xf'),_0x3feb96,_0x39667e);_0x3a7cb4(_0x39667e);});});}exports[_0xcdc9('0x18')]=function(_0x216a90){var _0x36c0db=this;return new Promise(function(_0x12e828,_0x22a5fe){return db[_0xcdc9('0x19')][_0xcdc9('0x1a')]({'raw':_0x216a90[_0xcdc9('0x1b')]?_0x216a90[_0xcdc9('0x1b')][_0xcdc9('0x1c')]===undefined?!![]:![]:!![],'where':_0x216a90[_0xcdc9('0x1b')]?_0x216a90[_0xcdc9('0x1b')]['where']||null:null,'attributes':_0x216a90[_0xcdc9('0x1b')]?_0x216a90['options'][_0xcdc9('0x1d')]||null:null,'limit':_0x216a90[_0xcdc9('0x1b')]?_0x216a90[_0xcdc9('0x1b')][_0xcdc9('0x1e')]||null:null,'include':_0x216a90[_0xcdc9('0x1b')]?_0x216a90['options'][_0xcdc9('0x1f')]?_[_0xcdc9('0x20')](_0x216a90[_0xcdc9('0x1b')]['include'],function(_0x2c565c){return{'model':db[_0x2c565c[_0xcdc9('0x21')]],'as':_0x2c565c['as'],'attributes':_0x2c565c[_0xcdc9('0x1d')],'include':_0x2c565c[_0xcdc9('0x1f')]?_[_0xcdc9('0x20')](_0x2c565c['include'],function(_0x55545e){return{'model':db[_0x55545e[_0xcdc9('0x21')]],'as':_0x55545e['as'],'attributes':_0x55545e[_0xcdc9('0x1d')],'include':_0x55545e[_0xcdc9('0x1f')]?_[_0xcdc9('0x20')](_0x55545e[_0xcdc9('0x1f')],function(_0x2d8c91){return{'model':db[_0x2d8c91[_0xcdc9('0x21')]],'as':_0x2d8c91['as'],'attributes':_0x2d8c91[_0xcdc9('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xcdc9('0xd')](function(_0x464058){logger['info'](_0xcdc9('0x18'),_0x216a90);logger[_0xcdc9('0x22')](_0xcdc9('0x18'),_0x216a90,JSON[_0xcdc9('0x12')](_0x464058));_0x12e828(_0x464058);})['catch'](function(_0x1fb964){logger[_0xcdc9('0x13')](_0xcdc9('0x18'),_0x1fb964[_0xcdc9('0x15')],_0x216a90);_0x22a5fe(_0x36c0db[_0xcdc9('0x13')](0x1f4,_0x1fb964['message']));});});};exports[_0xcdc9('0x23')]=function(_0x2a30da){var _0x511d2c=this;return new Promise(function(_0x50137c,_0x329a91){return db['ChatQueue'][_0xcdc9('0x24')]({'raw':_0x2a30da[_0xcdc9('0x1b')]?_0x2a30da['options'][_0xcdc9('0x1c')]===undefined?!![]:![]:!![],'where':_0x2a30da[_0xcdc9('0x1b')]?_0x2a30da[_0xcdc9('0x1b')][_0xcdc9('0x25')]||null:null,'attributes':_0x2a30da[_0xcdc9('0x1b')]?_0x2a30da[_0xcdc9('0x1b')][_0xcdc9('0x1d')]||null:null,'include':_0x2a30da[_0xcdc9('0x1b')]?_0x2a30da[_0xcdc9('0x1b')][_0xcdc9('0x1f')]?_['map'](_0x2a30da[_0xcdc9('0x1b')][_0xcdc9('0x1f')],function(_0x23040f){return{'model':db[_0x23040f[_0xcdc9('0x21')]],'as':_0x23040f['as'],'attributes':_0x23040f['attributes'],'include':_0x23040f[_0xcdc9('0x1f')]?_['map'](_0x23040f['include'],function(_0x50205c){return{'model':db[_0x50205c['model']],'as':_0x50205c['as'],'attributes':_0x50205c[_0xcdc9('0x1d')],'include':_0x50205c['include']?_[_0xcdc9('0x20')](_0x50205c[_0xcdc9('0x1f')],function(_0x20b75a){return{'model':db[_0x20b75a[_0xcdc9('0x21')]],'as':_0x20b75a['as'],'attributes':_0x20b75a[_0xcdc9('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xcdc9('0xd')](function(_0x51fded){logger['info'](_0xcdc9('0x23'),_0x2a30da);logger[_0xcdc9('0x22')](_0xcdc9('0x23'),_0x2a30da,JSON['stringify'](_0x51fded));_0x50137c(_0x51fded);})[_0xcdc9('0x17')](function(_0x27d4ce){logger[_0xcdc9('0x13')]('ShowChatQueue',_0x27d4ce[_0xcdc9('0x15')],_0x2a30da);_0x329a91(_0x511d2c['error'](0x1f4,_0x27d4ce[_0xcdc9('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 87a39a7..7fea399 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 _0xe13a=['update','emit','removeListener','register','chatQueue:','save','remove'];(function(_0x462fe4,_0x394d3e){var _0x82b23a=function(_0x2c071f){while(--_0x2c071f){_0x462fe4['push'](_0x462fe4['shift']());}};_0x82b23a(++_0x394d3e);}(_0xe13a,0x178));var _0xae13=function(_0x859e7b,_0x560c8a){_0x859e7b=_0x859e7b-0x0;var _0xb9c8a8=_0xe13a[_0x859e7b];return _0xb9c8a8;};'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 +var _0xbd50=['length','./chatQueue.events','save','remove','emit'];(function(_0x57aad4,_0x108f28){var _0x26b886=function(_0x222c41){while(--_0x222c41){_0x57aad4['push'](_0x57aad4['shift']());}};_0x26b886(++_0x108f28);}(_0xbd50,0x196));var _0x0bd5=function(_0xd97d5d,_0x26bfca){_0xd97d5d=_0xd97d5d-0x0;var _0x3f34be=_0xbd50[_0xd97d5d];return _0x3f34be;};'use strict';var ChatQueueEvents=require(_0x0bd5('0x0'));var events=[_0x0bd5('0x1'),_0x0bd5('0x2'),'update'];function createListener(_0x44fcb9,_0x167372){return function(_0x37acba){_0x167372[_0x0bd5('0x3')](_0x44fcb9,_0x37acba);};}function removeListener(_0x15620d,_0x4c17ee){return function(){ChatQueueEvents['removeListener'](_0x15620d,_0x4c17ee);};}exports['register']=function(_0x376024){for(var _0x2ef1d0=0x0,_0xcc6cfa=events[_0x0bd5('0x4')];_0x2ef1d0<_0xcc6cfa;_0x2ef1d0++){var _0x1b99f3=events[_0x2ef1d0];var _0x5ebe64=createListener('chatQueue:'+_0x1b99f3,_0x376024);ChatQueueEvents['on'](_0x1b99f3,_0x5ebe64);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index e0f1c57..449a597 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 _0xe14b=['/describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','express','Router','../../components/auth/service','./chatQueue.controller','get','isAuthenticated','index'];(function(_0x266494,_0x34269f){var _0x446c0d=function(_0x438258){while(--_0x438258){_0x266494['push'](_0x266494['shift']());}};_0x446c0d(++_0x34269f);}(_0xe14b,0x93));var _0xbe14=function(_0x13fe04,_0x261b1c){_0x13fe04=_0x13fe04-0x0;var _0x45867b=_0xe14b[_0x13fe04];return _0x45867b;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x10')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x10')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x12')]);router[_0xbe14('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x13')]);router[_0xbe14('0x14')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0x16')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x16')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeTeams']);router[_0xbe14('0x16')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);module[_0xbe14('0x19')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','/:id/teams','removeTeams','multer','util','path'];(function(_0xa19c53,_0x188f53){var _0x447226=function(_0x1406e1){while(--_0x1406e1){_0xa19c53['push'](_0xa19c53['shift']());}};_0x447226(++_0x188f53);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/teams',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x14')](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x17')]);router[_0x7995('0x18')](_0x7995('0x19'),auth[_0x7995('0xa')](),controller['update']);router[_0x7995('0x1a')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0x1b')]);router[_0x7995('0x1a')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router['delete']('/:id/users',auth[_0x7995('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index b98935d..ad15d68 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 _0xee26=['sequelize','exports','STRING','DATE'];(function(_0x5a685a,_0x14937e){var _0x19db1c=function(_0xa06c44){while(--_0xa06c44){_0x5a685a['push'](_0x5a685a['shift']());}};_0x19db1c(++_0x14937e);}(_0xee26,0x9c));var _0x6ee2=function(_0xef338e,_0x22256e){_0xef338e=_0xef338e-0x0;var _0x3a3dde=_0xee26[_0xef338e];return _0x3a3dde;};'use strict';var moment=require('moment');var Sequelize=require(_0x6ee2('0x0'));module[_0x6ee2('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x6ee2('0x2')]},'joinAt':{'type':Sequelize[_0x6ee2('0x3')]},'leaveAt':{'type':Sequelize[_0x6ee2('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x6ee2('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x58df=['DATE','moment','sequelize','exports','STRING'];(function(_0x1d25a0,_0x48c1ed){var _0x416b2d=function(_0xe79a39){while(--_0xe79a39){_0x1d25a0['push'](_0x1d25a0['shift']());}};_0x416b2d(++_0x48c1ed);}(_0x58df,0x1cd));var _0xf58d=function(_0x5bbe81,_0x17eaea){_0x5bbe81=_0x5bbe81-0x0;var _0x5cc670=_0x58df[_0x5bbe81];return _0x5cc670;};'use strict';var moment=require(_0xf58d('0x0'));var Sequelize=require(_0xf58d('0x1'));module[_0xf58d('0x2')]={'uniqueid':{'type':Sequelize[_0xf58d('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xf58d('0x4')]},'leaveAt':{'type':Sequelize[_0xf58d('0x4')]},'acceptAt':{'type':Sequelize[_0xf58d('0x4')]},'exitAt':{'type':Sequelize[_0xf58d('0x4')]},'reason':{'type':Sequelize[_0xf58d('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 9e5a593..00b2e63 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 _0x46cb=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','end','error','stack','name','send','index','ChatQueueReport','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','includeAll','include','rows','catch','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x46cb,0x84));var _0xb46c=function(_0x1d5a32,_0x47974a){_0x1d5a32=_0x1d5a32-0x0;var _0x361ca0=_0x46cb[_0x1d5a32];return _0x361ca0;};'use strict';var emlformat=require(_0xb46c('0x0'));var rimraf=require(_0xb46c('0x1'));var zipdir=require(_0xb46c('0x2'));var jsonpatch=require(_0xb46c('0x3'));var rp=require('request-promise');var moment=require(_0xb46c('0x4'));var BPromise=require(_0xb46c('0x5'));var Mustache=require(_0xb46c('0x6'));var util=require(_0xb46c('0x7'));var path=require('path');var sox=require(_0xb46c('0x8'));var csv=require(_0xb46c('0x9'));var ejs=require(_0xb46c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb46c('0xb'));var squel=require('squel');var crypto=require(_0xb46c('0xc'));var jsforce=require(_0xb46c('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb46c('0xe'));var Papa=require(_0xb46c('0xf'));var Redis=require(_0xb46c('0x10'));var authService=require(_0xb46c('0x11'));var qs=require(_0xb46c('0x12'));var as=require(_0xb46c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb46c('0x14'))(_0xb46c('0x15'));var utils=require(_0xb46c('0x16'));var config=require(_0xb46c('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xb46c('0x18'))['db'];function respondWithStatusCode(_0x3059da,_0x1dd251){_0x1dd251=_0x1dd251||0xcc;return function(_0x4a3399){if(_0x4a3399){return _0x3059da[_0xb46c('0x19')](_0x1dd251);}return _0x3059da[_0xb46c('0x1a')](_0x1dd251)['end']();};}function respondWithResult(_0x18f1d0,_0x213f4a){_0x213f4a=_0x213f4a||0xc8;return function(_0x967278){if(_0x967278){return _0x18f1d0[_0xb46c('0x1a')](_0x213f4a)[_0xb46c('0x1b')](_0x967278);}};}function respondWithFilteredResult(_0x45c3e1,_0x172bb8){return function(_0x5d431b){if(_0x5d431b){var _0xe4261a=typeof _0x172bb8[_0xb46c('0x1c')]===_0xb46c('0x1d')&&typeof _0x172bb8[_0xb46c('0x1e')]===_0xb46c('0x1d');var _0x2437a0=_0x5d431b['count'];var _0x572860=_0xe4261a?0x0:_0x172bb8[_0xb46c('0x1c')];var _0x4c7ef6=_0xe4261a?_0x5d431b[_0xb46c('0x1f')]:_0x172bb8[_0xb46c('0x1c')]+_0x172bb8[_0xb46c('0x1e')];var _0x32ade3;if(_0x4c7ef6>=_0x2437a0){_0x4c7ef6=_0x2437a0;_0x32ade3=0xc8;}else{_0x32ade3=0xce;}_0x45c3e1['status'](_0x32ade3);return _0x45c3e1[_0xb46c('0x20')]('Content-Range',_0x572860+'-'+_0x4c7ef6+'/'+_0x2437a0)['json'](_0x5d431b);}return null;};}function patchUpdates(_0x87d31d){return function(_0x1b8c8d){try{jsonpatch[_0xb46c('0x21')](_0x1b8c8d,_0x87d31d,!![]);}catch(_0x43ae7c){return BPromise[_0xb46c('0x22')](_0x43ae7c);}return _0x1b8c8d[_0xb46c('0x23')]();};}function saveUpdates(_0x5f3cfb,_0x4d68b1){return function(_0x184038){if(_0x184038){return _0x184038[_0xb46c('0x24')](_0x5f3cfb)[_0xb46c('0x25')](function(_0x11b121){return _0x11b121;});}return null;};}function removeEntity(_0x1e40ed,_0x2b4412){return function(_0x8d71cd){if(_0x8d71cd){return _0x8d71cd['destroy']()[_0xb46c('0x25')](function(){_0x1e40ed[_0xb46c('0x1a')](0xcc)[_0xb46c('0x26')]();});}};}function handleEntityNotFound(_0x47960b,_0x4e822a){return function(_0x20fc36){if(!_0x20fc36){_0x47960b[_0xb46c('0x19')](0x194);}return _0x20fc36;};}function handleError(_0x3ff2a6,_0x2585c6){_0x2585c6=_0x2585c6||0x1f4;return function(_0x463a71){logger[_0xb46c('0x27')](_0x463a71[_0xb46c('0x28')]);if(_0x463a71[_0xb46c('0x29')]){delete _0x463a71[_0xb46c('0x29')];}_0x3ff2a6[_0xb46c('0x1a')](_0x2585c6)[_0xb46c('0x2a')](_0x463a71);};}exports[_0xb46c('0x2b')]=function(_0x4220a9,_0x2c8956){var _0x3cd6e0={},_0x3fab04={},_0x56310b={'count':0x0,'rows':[]};var _0x2412a7=_['map'](db[_0xb46c('0x2c')]['rawAttributes'],function(_0x4dd0bd){return{'name':_0x4dd0bd[_0xb46c('0x2d')],'type':_0x4dd0bd[_0xb46c('0x2e')][_0xb46c('0x2f')]};});_0x3fab04[_0xb46c('0x30')]=_['map'](_0x2412a7,_0xb46c('0x29'));_0x3fab04[_0xb46c('0x31')]=_[_0xb46c('0x32')](_0x4220a9['query']);_0x3fab04[_0xb46c('0x33')]=_['intersection'](_0x3fab04[_0xb46c('0x30')],_0x3fab04['query']);_0x3cd6e0[_0xb46c('0x34')]=_[_0xb46c('0x35')](_0x3fab04[_0xb46c('0x30')],qs[_0xb46c('0x36')](_0x4220a9[_0xb46c('0x31')][_0xb46c('0x36')]));_0x3cd6e0[_0xb46c('0x34')]=_0x3cd6e0[_0xb46c('0x34')][_0xb46c('0x37')]?_0x3cd6e0[_0xb46c('0x34')]:_0x3fab04[_0xb46c('0x30')];if(!_0x4220a9[_0xb46c('0x31')]['hasOwnProperty'](_0xb46c('0x38'))){_0x3cd6e0[_0xb46c('0x1e')]=qs['limit'](_0x4220a9['query']['limit']);_0x3cd6e0['offset']=qs[_0xb46c('0x1c')](_0x4220a9['query'][_0xb46c('0x1c')]);}_0x3cd6e0[_0xb46c('0x39')]=qs[_0xb46c('0x3a')](_0x4220a9[_0xb46c('0x31')]['sort']);_0x3cd6e0[_0xb46c('0x3b')]=qs[_0xb46c('0x33')](_['pick'](_0x4220a9[_0xb46c('0x31')],_0x3fab04[_0xb46c('0x33')]),_0x2412a7);if(_0x4220a9['query'][_0xb46c('0x3c')]){_0x3cd6e0['where']=_[_0xb46c('0x3d')](_0x3cd6e0[_0xb46c('0x3b')],{'$or':_[_0xb46c('0x3e')](_0x2412a7,function(_0x302580){if(_0x302580['type']!==_0xb46c('0x3f')){var _0x4c9db1={};_0x4c9db1[_0x302580[_0xb46c('0x29')]]={'$like':'%'+_0x4220a9[_0xb46c('0x31')]['filter']+'%'};return _0x4c9db1;}})});}_0x3cd6e0=_[_0xb46c('0x3d')]({},_0x3cd6e0,_0x4220a9[_0xb46c('0x40')]);var _0xfa2a48={'where':_0x3cd6e0['where']};return db['ChatQueueReport'][_0xb46c('0x1f')](_0xfa2a48)[_0xb46c('0x25')](function(_0x4e4169){_0x56310b[_0xb46c('0x1f')]=_0x4e4169;if(_0x4220a9['query'][_0xb46c('0x41')]){_0x3cd6e0[_0xb46c('0x42')]=[{'all':!![]}];}return db['ChatQueueReport']['findAll'](_0x3cd6e0);})[_0xb46c('0x25')](function(_0x1c38fe){_0x56310b[_0xb46c('0x43')]=_0x1c38fe;return _0x56310b;})[_0xb46c('0x25')](respondWithFilteredResult(_0x2c8956,_0x3cd6e0))[_0xb46c('0x44')](handleError(_0x2c8956,null));};exports['show']=function(_0x1b9af7,_0x7e15f3){var _0x4fd0d9={'raw':!![],'where':{'id':_0x1b9af7['params']['id']}},_0x20d2e5={};_0x20d2e5[_0xb46c('0x30')]=_[_0xb46c('0x32')](db[_0xb46c('0x2c')]['rawAttributes']);_0x20d2e5[_0xb46c('0x31')]=_['keys'](_0x1b9af7[_0xb46c('0x31')]);_0x20d2e5[_0xb46c('0x33')]=_[_0xb46c('0x35')](_0x20d2e5[_0xb46c('0x30')],_0x20d2e5[_0xb46c('0x31')]);_0x4fd0d9[_0xb46c('0x34')]=_[_0xb46c('0x35')](_0x20d2e5['model'],qs[_0xb46c('0x36')](_0x1b9af7['query'][_0xb46c('0x36')]));_0x4fd0d9[_0xb46c('0x34')]=_0x4fd0d9['attributes'][_0xb46c('0x37')]?_0x4fd0d9[_0xb46c('0x34')]:_0x20d2e5[_0xb46c('0x30')];if(_0x1b9af7['query']['includeAll']){_0x4fd0d9['include']=[{'all':!![]}];}_0x4fd0d9=_['merge']({},_0x4fd0d9,_0x1b9af7['options']);return db[_0xb46c('0x2c')][_0xb46c('0x45')](_0x4fd0d9)[_0xb46c('0x25')](handleEntityNotFound(_0x7e15f3,null))[_0xb46c('0x25')](respondWithResult(_0x7e15f3,null))[_0xb46c('0x44')](handleError(_0x7e15f3,null));};exports[_0xb46c('0x46')]=function(_0x40ca97,_0x44b792){return db[_0xb46c('0x2c')][_0xb46c('0x46')](_0x40ca97['body'],{})[_0xb46c('0x25')](respondWithResult(_0x44b792,0xc9))[_0xb46c('0x44')](handleError(_0x44b792,null));};exports['update']=function(_0x4db28a,_0x63d0d6){if(_0x4db28a['body']['id']){delete _0x4db28a[_0xb46c('0x47')]['id'];}return db[_0xb46c('0x2c')][_0xb46c('0x45')]({'where':{'id':_0x4db28a[_0xb46c('0x48')]['id']}})[_0xb46c('0x25')](handleEntityNotFound(_0x63d0d6,null))[_0xb46c('0x25')](saveUpdates(_0x4db28a[_0xb46c('0x47')],null))[_0xb46c('0x25')](respondWithResult(_0x63d0d6,null))[_0xb46c('0x44')](handleError(_0x63d0d6,null));};exports['destroy']=function(_0x1e0ffe,_0x841649){return db[_0xb46c('0x2c')][_0xb46c('0x45')]({'where':{'id':_0x1e0ffe[_0xb46c('0x48')]['id']}})[_0xb46c('0x25')](handleEntityNotFound(_0x841649,null))[_0xb46c('0x25')](removeEntity(_0x841649,null))[_0xb46c('0x44')](handleError(_0x841649,null));};exports[_0xb46c('0x49')]=function(_0xa6800d,_0x191054){return db['ChatQueueReport'][_0xb46c('0x49')]()[_0xb46c('0x25')](respondWithResult(_0x191054,null))['catch'](handleError(_0x191054,null));}; \ No newline at end of file +var _0x374c=['../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','status','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','where','pick','filter','merge','VIRTUAL','ChatQueueReport','includeAll','include','findAll','show','params','options','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x374c,0x1e3));var _0xc374=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x374c[_0x2aec52];return _0x3b8835;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc374('0x0'));var zipdir=require(_0xc374('0x1'));var jsonpatch=require(_0xc374('0x2'));var rp=require(_0xc374('0x3'));var moment=require(_0xc374('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc374('0x5'));var util=require('util');var path=require(_0xc374('0x6'));var sox=require(_0xc374('0x7'));var csv=require('to-csv');var ejs=require(_0xc374('0x8'));var fs=require('fs');var fs_extra=require(_0xc374('0x9'));var _=require(_0xc374('0xa'));var squel=require(_0xc374('0xb'));var crypto=require(_0xc374('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc374('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc374('0xe'));var Redis=require(_0xc374('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xc374('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc374('0x11'));var logger=require(_0xc374('0x12'))(_0xc374('0x13'));var utils=require('../../config/utils');var config=require(_0xc374('0x14'));var licenseUtil=require(_0xc374('0x15'));var db=require(_0xc374('0x16'))['db'];function respondWithStatusCode(_0x5e0f82,_0x44eba3){_0x44eba3=_0x44eba3||0xcc;return function(_0x30bde){if(_0x30bde){return _0x5e0f82[_0xc374('0x17')](_0x44eba3);}return _0x5e0f82['status'](_0x44eba3)[_0xc374('0x18')]();};}function respondWithResult(_0x47a7bf,_0xae92ab){_0xae92ab=_0xae92ab||0xc8;return function(_0x1f472b){if(_0x1f472b){return _0x47a7bf['status'](_0xae92ab)[_0xc374('0x19')](_0x1f472b);}};}function respondWithFilteredResult(_0x3f868a,_0x4109ec){return function(_0x198919){if(_0x198919){var _0x1178a1=typeof _0x4109ec[_0xc374('0x1a')]===_0xc374('0x1b')&&typeof _0x4109ec[_0xc374('0x1c')]===_0xc374('0x1b');var _0x1c3784=_0x198919[_0xc374('0x1d')];var _0x5957c5=_0x1178a1?0x0:_0x4109ec[_0xc374('0x1a')];var _0x3553bb=_0x1178a1?_0x198919[_0xc374('0x1d')]:_0x4109ec['offset']+_0x4109ec[_0xc374('0x1c')];var _0x16c7de;if(_0x3553bb>=_0x1c3784){_0x3553bb=_0x1c3784;_0x16c7de=0xc8;}else{_0x16c7de=0xce;}_0x3f868a['status'](_0x16c7de);return _0x3f868a['set'](_0xc374('0x1e'),_0x5957c5+'-'+_0x3553bb+'/'+_0x1c3784)[_0xc374('0x19')](_0x198919);}return null;};}function patchUpdates(_0x4110bf){return function(_0x2beb98){try{jsonpatch['apply'](_0x2beb98,_0x4110bf,!![]);}catch(_0xa65465){return BPromise[_0xc374('0x1f')](_0xa65465);}return _0x2beb98[_0xc374('0x20')]();};}function saveUpdates(_0x16959d,_0x3cbbad){return function(_0x33c61d){if(_0x33c61d){return _0x33c61d[_0xc374('0x21')](_0x16959d)[_0xc374('0x22')](function(_0x2b7fa6){return _0x2b7fa6;});}return null;};}function removeEntity(_0x18699e,_0x4110a5){return function(_0x5b92c6){if(_0x5b92c6){return _0x5b92c6[_0xc374('0x23')]()[_0xc374('0x22')](function(){_0x18699e[_0xc374('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x460fe1,_0x3d4fb3){return function(_0x19c668){if(!_0x19c668){_0x460fe1[_0xc374('0x17')](0x194);}return _0x19c668;};}function handleError(_0x52d69c,_0x5c6d3e){_0x5c6d3e=_0x5c6d3e||0x1f4;return function(_0x4ad849){logger[_0xc374('0x25')](_0x4ad849[_0xc374('0x26')]);if(_0x4ad849[_0xc374('0x27')]){delete _0x4ad849['name'];}_0x52d69c[_0xc374('0x24')](_0x5c6d3e)['send'](_0x4ad849);};}exports[_0xc374('0x28')]=function(_0xbd1d3d,_0x434c44){var _0x31ae09={},_0x2a87f2={},_0xb7cc5={'count':0x0,'rows':[]};var _0x10b1a0=_[_0xc374('0x29')](db['ChatQueueReport'][_0xc374('0x2a')],function(_0x48aa6f){return{'name':_0x48aa6f[_0xc374('0x2b')],'type':_0x48aa6f[_0xc374('0x2c')][_0xc374('0x2d')]};});_0x2a87f2[_0xc374('0x2e')]=_['map'](_0x10b1a0,_0xc374('0x27'));_0x2a87f2['query']=_[_0xc374('0x2f')](_0xbd1d3d[_0xc374('0x30')]);_0x2a87f2[_0xc374('0x31')]=_[_0xc374('0x32')](_0x2a87f2[_0xc374('0x2e')],_0x2a87f2[_0xc374('0x30')]);_0x31ae09[_0xc374('0x33')]=_[_0xc374('0x32')](_0x2a87f2[_0xc374('0x2e')],qs[_0xc374('0x34')](_0xbd1d3d[_0xc374('0x30')][_0xc374('0x34')]));_0x31ae09['attributes']=_0x31ae09[_0xc374('0x33')]['length']?_0x31ae09[_0xc374('0x33')]:_0x2a87f2[_0xc374('0x2e')];if(!_0xbd1d3d[_0xc374('0x30')]['hasOwnProperty'](_0xc374('0x35'))){_0x31ae09[_0xc374('0x1c')]=qs['limit'](_0xbd1d3d[_0xc374('0x30')][_0xc374('0x1c')]);_0x31ae09[_0xc374('0x1a')]=qs[_0xc374('0x1a')](_0xbd1d3d[_0xc374('0x30')][_0xc374('0x1a')]);}_0x31ae09[_0xc374('0x36')]=qs['sort'](_0xbd1d3d['query']['sort']);_0x31ae09[_0xc374('0x37')]=qs[_0xc374('0x31')](_[_0xc374('0x38')](_0xbd1d3d[_0xc374('0x30')],_0x2a87f2['filters']),_0x10b1a0);if(_0xbd1d3d[_0xc374('0x30')][_0xc374('0x39')]){_0x31ae09[_0xc374('0x37')]=_[_0xc374('0x3a')](_0x31ae09['where'],{'$or':_['map'](_0x10b1a0,function(_0x53cc84){if(_0x53cc84[_0xc374('0x2c')]!==_0xc374('0x3b')){var _0x5c4011={};_0x5c4011[_0x53cc84[_0xc374('0x27')]]={'$like':'%'+_0xbd1d3d[_0xc374('0x30')]['filter']+'%'};return _0x5c4011;}})});}_0x31ae09=_[_0xc374('0x3a')]({},_0x31ae09,_0xbd1d3d['options']);var _0x5baff8={'where':_0x31ae09[_0xc374('0x37')]};return db[_0xc374('0x3c')][_0xc374('0x1d')](_0x5baff8)[_0xc374('0x22')](function(_0x39b59f){_0xb7cc5['count']=_0x39b59f;if(_0xbd1d3d[_0xc374('0x30')][_0xc374('0x3d')]){_0x31ae09[_0xc374('0x3e')]=[{'all':!![]}];}return db[_0xc374('0x3c')][_0xc374('0x3f')](_0x31ae09);})[_0xc374('0x22')](function(_0x39225c){_0xb7cc5['rows']=_0x39225c;return _0xb7cc5;})[_0xc374('0x22')](respondWithFilteredResult(_0x434c44,_0x31ae09))['catch'](handleError(_0x434c44,null));};exports[_0xc374('0x40')]=function(_0x4f5e44,_0x59e86d){var _0x3abfe5={'raw':!![],'where':{'id':_0x4f5e44[_0xc374('0x41')]['id']}},_0xb4b71b={};_0xb4b71b['model']=_[_0xc374('0x2f')](db[_0xc374('0x3c')]['rawAttributes']);_0xb4b71b[_0xc374('0x30')]=_[_0xc374('0x2f')](_0x4f5e44[_0xc374('0x30')]);_0xb4b71b[_0xc374('0x31')]=_[_0xc374('0x32')](_0xb4b71b[_0xc374('0x2e')],_0xb4b71b[_0xc374('0x30')]);_0x3abfe5[_0xc374('0x33')]=_['intersection'](_0xb4b71b['model'],qs[_0xc374('0x34')](_0x4f5e44[_0xc374('0x30')]['fields']));_0x3abfe5[_0xc374('0x33')]=_0x3abfe5[_0xc374('0x33')]['length']?_0x3abfe5[_0xc374('0x33')]:_0xb4b71b[_0xc374('0x2e')];if(_0x4f5e44[_0xc374('0x30')][_0xc374('0x3d')]){_0x3abfe5[_0xc374('0x3e')]=[{'all':!![]}];}_0x3abfe5=_[_0xc374('0x3a')]({},_0x3abfe5,_0x4f5e44[_0xc374('0x42')]);return db[_0xc374('0x3c')][_0xc374('0x43')](_0x3abfe5)[_0xc374('0x22')](handleEntityNotFound(_0x59e86d,null))['then'](respondWithResult(_0x59e86d,null))[_0xc374('0x44')](handleError(_0x59e86d,null));};exports['create']=function(_0x45a599,_0x423d05){return db['ChatQueueReport'][_0xc374('0x45')](_0x45a599[_0xc374('0x46')],{})[_0xc374('0x22')](respondWithResult(_0x423d05,0xc9))[_0xc374('0x44')](handleError(_0x423d05,null));};exports[_0xc374('0x21')]=function(_0x549b95,_0x42d0cc){if(_0x549b95[_0xc374('0x46')]['id']){delete _0x549b95[_0xc374('0x46')]['id'];}return db['ChatQueueReport'][_0xc374('0x43')]({'where':{'id':_0x549b95['params']['id']}})[_0xc374('0x22')](handleEntityNotFound(_0x42d0cc,null))[_0xc374('0x22')](saveUpdates(_0x549b95[_0xc374('0x46')],null))['then'](respondWithResult(_0x42d0cc,null))[_0xc374('0x44')](handleError(_0x42d0cc,null));};exports['destroy']=function(_0x1cf1cf,_0x3d001b){return db[_0xc374('0x3c')][_0xc374('0x43')]({'where':{'id':_0x1cf1cf[_0xc374('0x41')]['id']}})[_0xc374('0x22')](handleEntityNotFound(_0x3d001b,null))['then'](removeEntity(_0x3d001b,null))[_0xc374('0x44')](handleError(_0x3d001b,null));};exports['describe']=function(_0x3dba84,_0x3b63e5){return db[_0xc374('0x3c')][_0xc374('0x47')]()[_0xc374('0x22')](respondWithResult(_0x3b63e5,null))['catch'](handleError(_0x3b63e5,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index c60a4a3..239cadd 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 _0xcb91=['path','rimraf','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x435b13,_0x43f5b9){var _0x1309a3=function(_0xfe6e8a){while(--_0xfe6e8a){_0x435b13['push'](_0x435b13['shift']());}};_0x1309a3(++_0x43f5b9);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x44a64f,_0x38475c){_0x44a64f=_0x44a64f-0x0;var _0x52024b=_0xcb91[_0x44a64f];return _0x52024b;};'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')]('ChatQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0x4066ef,_0x87236d){var _0x195d64=function(_0x3d4870){while(--_0x3d4870){_0x4066ef['push'](_0x4066ef['shift']());}};_0x195d64(++_0x87236d);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 1b69600..415fdfa 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 _0x0cce=['message','result','CreateChatQueueReport','ChatQueueReport','create','options','raw','catch','UpdateChatQueueReport','update','body','where','attributes','limit','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5c81c2,_0x3e18a2){var _0x16a5a4=function(_0x3d60ec){while(--_0x3d60ec){_0x5c81c2['push'](_0x5c81c2['shift']());}};_0x16a5a4(++_0x3e18a2);}(_0x0cce,0xf6));var _0xe0cc=function(_0x3e0dc4,_0x13971b){_0x3e0dc4=_0x3e0dc4-0x0;var _0x586111=_0x0cce[_0x3e0dc4];return _0x586111;};'use strict';var _=require(_0xe0cc('0x0'));var util=require(_0xe0cc('0x1'));var moment=require(_0xe0cc('0x2'));var BPromise=require(_0xe0cc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe0cc('0x4'));var db=require(_0xe0cc('0x5'))['db'];var utils=require(_0xe0cc('0x6'));var logger=require('../../config/logger')(_0xe0cc('0x7'));var config=require(_0xe0cc('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe0cc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x437d77,_0x2c06bb,_0x2d0a0d){return new BPromise(function(_0x1354e6,_0x1a48ab){return client[_0xe0cc('0xa')](_0x437d77,_0x2d0a0d)[_0xe0cc('0xb')](function(_0x353b76){logger[_0xe0cc('0xc')](_0xe0cc('0xd'),_0x2c06bb,_0xe0cc('0xe'));logger['debug'](_0xe0cc('0xf'),_0x2c06bb,'request\x20sent',JSON[_0xe0cc('0x10')](_0x353b76));if(_0x353b76[_0xe0cc('0x11')]){if(_0x353b76[_0xe0cc('0x11')]['code']===0x1f4){logger[_0xe0cc('0x11')](_0xe0cc('0xd'),_0x2c06bb,_0x353b76[_0xe0cc('0x11')][_0xe0cc('0x12')]);return _0x1a48ab(_0x353b76[_0xe0cc('0x11')][_0xe0cc('0x12')]);}logger['error'](_0xe0cc('0xd'),_0x2c06bb,_0x353b76[_0xe0cc('0x11')][_0xe0cc('0x12')]);return _0x1354e6(_0x353b76[_0xe0cc('0x11')][_0xe0cc('0x12')]);}else{logger['info'](_0xe0cc('0xd'),_0x2c06bb,_0xe0cc('0xe'));_0x1354e6(_0x353b76[_0xe0cc('0x13')][_0xe0cc('0x12')]);}})['catch'](function(_0x5708be){logger[_0xe0cc('0x11')](_0xe0cc('0xd'),_0x2c06bb,_0x5708be);_0x1a48ab(_0x5708be);});});}exports[_0xe0cc('0x14')]=function(_0x5777e3){var _0x2ea767=this;return new Promise(function(_0x585760,_0x1e2bf9){return db[_0xe0cc('0x15')][_0xe0cc('0x16')](_0x5777e3['body'],{'raw':_0x5777e3[_0xe0cc('0x17')]?_0x5777e3['options'][_0xe0cc('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x597136){logger[_0xe0cc('0xc')](_0xe0cc('0x14'),_0x5777e3);logger['debug'](_0xe0cc('0x14'),_0x5777e3,JSON[_0xe0cc('0x10')](_0x597136));_0x585760(_0x597136);})[_0xe0cc('0x19')](function(_0x4aca44){logger[_0xe0cc('0x11')](_0xe0cc('0x14'),_0x4aca44[_0xe0cc('0x12')],_0x5777e3);_0x1e2bf9(_0x2ea767[_0xe0cc('0x11')](0x1f4,_0x4aca44['message']));});});};exports[_0xe0cc('0x1a')]=function(_0x1c45af){var _0x24c006=this;return new Promise(function(_0x5c9382,_0x28b7ac){return db[_0xe0cc('0x15')][_0xe0cc('0x1b')](_0x1c45af[_0xe0cc('0x1c')],{'raw':_0x1c45af[_0xe0cc('0x17')]?_0x1c45af[_0xe0cc('0x17')][_0xe0cc('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c45af['options']?_0x1c45af['options'][_0xe0cc('0x1d')]||null:null,'attributes':_0x1c45af[_0xe0cc('0x17')]?_0x1c45af[_0xe0cc('0x17')][_0xe0cc('0x1e')]||null:null,'limit':_0x1c45af[_0xe0cc('0x17')]?_0x1c45af[_0xe0cc('0x17')][_0xe0cc('0x1f')]||null:null})['then'](function(_0x5ef449){logger[_0xe0cc('0xc')](_0xe0cc('0x1a'),_0x1c45af);logger[_0xe0cc('0x20')](_0xe0cc('0x1a'),_0x1c45af,JSON[_0xe0cc('0x10')](_0x5ef449));_0x5c9382(_0x5ef449);})['catch'](function(_0x2b8aa9){logger[_0xe0cc('0x11')]('UpdateChatQueueReport',_0x2b8aa9[_0xe0cc('0x12')],_0x1c45af);_0x28b7ac(_0x24c006[_0xe0cc('0x11')](0x1f4,_0x2b8aa9[_0xe0cc('0x12')]));});});}; \ No newline at end of file +var _0x11ad=['ChatQueueReport','body','where','limit','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateChatQueueReport','create','options','raw','UpdateChatQueueReport'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x11ad,0x13a));var _0xd11a=function(_0x522775,_0x40d0b2){_0x522775=_0x522775-0x0;var _0x333780=_0x11ad[_0x522775];return _0x333780;};'use strict';var _=require(_0xd11a('0x0'));var util=require(_0xd11a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd11a('0x2'));var fs=require('fs');var Redis=require(_0xd11a('0x3'));var db=require(_0xd11a('0x4'))['db'];var utils=require(_0xd11a('0x5'));var logger=require('../../config/logger')(_0xd11a('0x6'));var config=require(_0xd11a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd11a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a08dd,_0x367925,_0x3965e6){return new BPromise(function(_0x4871ee,_0x3e5859){return client[_0xd11a('0x9')](_0x2a08dd,_0x3965e6)[_0xd11a('0xa')](function(_0x547afd){logger[_0xd11a('0xb')](_0xd11a('0xc'),_0x367925,'request\x20sent');logger[_0xd11a('0xd')](_0xd11a('0xe'),_0x367925,_0xd11a('0xf'),JSON[_0xd11a('0x10')](_0x547afd));if(_0x547afd[_0xd11a('0x11')]){if(_0x547afd[_0xd11a('0x11')][_0xd11a('0x12')]===0x1f4){logger['error'](_0xd11a('0xc'),_0x367925,_0x547afd[_0xd11a('0x11')][_0xd11a('0x13')]);return _0x3e5859(_0x547afd[_0xd11a('0x11')][_0xd11a('0x13')]);}logger[_0xd11a('0x11')](_0xd11a('0xc'),_0x367925,_0x547afd[_0xd11a('0x11')][_0xd11a('0x13')]);return _0x4871ee(_0x547afd[_0xd11a('0x11')][_0xd11a('0x13')]);}else{logger[_0xd11a('0xb')](_0xd11a('0xc'),_0x367925,_0xd11a('0xf'));_0x4871ee(_0x547afd[_0xd11a('0x14')][_0xd11a('0x13')]);}})[_0xd11a('0x15')](function(_0x2fc782){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x367925,_0x2fc782);_0x3e5859(_0x2fc782);});});}exports[_0xd11a('0x16')]=function(_0x37ff0c){var _0x3843fc=this;return new Promise(function(_0x175c18,_0x153ac0){return db['ChatQueueReport'][_0xd11a('0x17')](_0x37ff0c['body'],{'raw':_0x37ff0c[_0xd11a('0x18')]?_0x37ff0c[_0xd11a('0x18')][_0xd11a('0x19')]===undefined?!![]:![]:!![]})[_0xd11a('0xa')](function(_0xf6cdcf){logger['info'](_0xd11a('0x16'),_0x37ff0c);logger[_0xd11a('0xd')](_0xd11a('0x16'),_0x37ff0c,JSON[_0xd11a('0x10')](_0xf6cdcf));_0x175c18(_0xf6cdcf);})['catch'](function(_0x249e64){logger['error'](_0xd11a('0x16'),_0x249e64['message'],_0x37ff0c);_0x153ac0(_0x3843fc[_0xd11a('0x11')](0x1f4,_0x249e64[_0xd11a('0x13')]));});});};exports[_0xd11a('0x1a')]=function(_0x412ee6){var _0x37fa60=this;return new Promise(function(_0x446e35,_0x53ddd1){return db[_0xd11a('0x1b')]['update'](_0x412ee6[_0xd11a('0x1c')],{'raw':_0x412ee6[_0xd11a('0x18')]?_0x412ee6[_0xd11a('0x18')][_0xd11a('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x412ee6['options']?_0x412ee6[_0xd11a('0x18')][_0xd11a('0x1d')]||null:null,'attributes':_0x412ee6[_0xd11a('0x18')]?_0x412ee6['options']['attributes']||null:null,'limit':_0x412ee6[_0xd11a('0x18')]?_0x412ee6[_0xd11a('0x18')][_0xd11a('0x1e')]||null:null})[_0xd11a('0xa')](function(_0x2ebbaa){logger[_0xd11a('0xb')]('UpdateChatQueueReport',_0x412ee6);logger[_0xd11a('0xd')](_0xd11a('0x1a'),_0x412ee6,JSON[_0xd11a('0x10')](_0x2ebbaa));_0x446e35(_0x2ebbaa);})[_0xd11a('0x15')](function(_0x224f15){logger[_0xd11a('0x11')](_0xd11a('0x1a'),_0x224f15[_0xd11a('0x13')],_0x412ee6);_0x53ddd1(_0x37fa60[_0xd11a('0x11')](0x1f4,_0x224f15['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 4300b84..c91343c 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 _0xc5df=['util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','index','/describe','isAuthenticated','describe','/:id','show','post','create','update','delete','multer'];(function(_0x32dce6,_0x23f570){var _0x1191ba=function(_0x58efa8){while(--_0x58efa8){_0x32dce6['push'](_0x32dce6['shift']());}};_0x1191ba(++_0x23f570);}(_0xc5df,0x143));var _0xfc5d=function(_0x2d0b33,_0x13b6d3){_0x2d0b33=_0x2d0b33-0x0;var _0x5ceb77=_0xc5df[_0x2d0b33];return _0x5ceb77;};'use strict';var multer=require(_0xfc5d('0x0'));var util=require(_0xfc5d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfc5d('0x2'));var router=express[_0xfc5d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xfc5d('0x4'));var interaction=require(_0xfc5d('0x5'));var config=require(_0xfc5d('0x6'));var controller=require(_0xfc5d('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xfc5d('0x8')]);router['get'](_0xfc5d('0x9'),auth[_0xfc5d('0xa')](),controller[_0xfc5d('0xb')]);router['get'](_0xfc5d('0xc'),auth[_0xfc5d('0xa')](),controller[_0xfc5d('0xd')]);router[_0xfc5d('0xe')]('/',auth[_0xfc5d('0xa')](),controller[_0xfc5d('0xf')]);router['put'](_0xfc5d('0xc'),auth[_0xfc5d('0xa')](),controller[_0xfc5d('0x10')]);router[_0xfc5d('0x11')](_0xfc5d('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3b99=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','delete','exports','multer','util','path','connect-timeout'];(function(_0x488bdb,_0x3de599){var _0xefb0b0=function(_0x5b390a){while(--_0x5b390a){_0x488bdb['push'](_0x488bdb['shift']());}};_0xefb0b0(++_0x3de599);}(_0x3b99,0x80));var _0x93b9=function(_0x491ea4,_0x30b0e7){_0x491ea4=_0x491ea4-0x0;var _0x225362=_0x3b99[_0x491ea4];return _0x225362;};'use strict';var multer=require(_0x93b9('0x0'));var util=require(_0x93b9('0x1'));var path=require(_0x93b9('0x2'));var timeout=require(_0x93b9('0x3'));var express=require(_0x93b9('0x4'));var router=express[_0x93b9('0x5')]();var fs_extra=require(_0x93b9('0x6'));var auth=require(_0x93b9('0x7'));var interaction=require(_0x93b9('0x8'));var config=require('../../config/environment');var controller=require(_0x93b9('0x9'));router['get']('/',auth[_0x93b9('0xa')](),controller[_0x93b9('0xb')]);router[_0x93b9('0xc')](_0x93b9('0xd'),auth[_0x93b9('0xa')](),controller[_0x93b9('0xe')]);router[_0x93b9('0xc')](_0x93b9('0xf'),auth['isAuthenticated'](),controller[_0x93b9('0x10')]);router[_0x93b9('0x11')]('/',auth[_0x93b9('0xa')](),controller[_0x93b9('0x12')]);router[_0x93b9('0x13')](_0x93b9('0xf'),auth[_0x93b9('0xa')](),controller['update']);router[_0x93b9('0x14')](_0x93b9('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x93b9('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 253c1f8..98efe13 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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x2d8f6c,_0x44db4c){var _0x3a00f6=function(_0x1b16ea){while(--_0x1b16ea){_0x2d8f6c['push'](_0x2d8f6c['shift']());}};_0x3a00f6(++_0x44db4c);}(_0x34e8,0x12c));var _0x834e=function(_0x3528b4,_0x3b1fa1){_0x3528b4=_0x3528b4-0x0;var _0x45462a=_0x34e8[_0x3528b4];return _0x45462a;};'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 +var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x37978d,_0x3aa658){var _0x7ad95e=function(_0xaa5d17){while(--_0xaa5d17){_0x37978d['push'](_0x37978d['shift']());}};_0x7ad95e(++_0x3aa658);}(_0x70e0,0x17b));var _0x070e=function(_0x4b340d,_0x157994){_0x4b340d=_0x4b340d-0x0;var _0x34f211=_0x70e0[_0x4b340d];return _0x34f211;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 7d7e0b2..9107856 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 _0x5227=['../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','stack','name','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ChatTransferReport','include','rows','catch','params','rawAttributes','includeAll','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5227,0x113));var _0x7522=function(_0x3ec751,_0x3009cd){_0x3ec751=_0x3ec751-0x0;var _0x252150=_0x5227[_0x3ec751];return _0x252150;};'use strict';var emlformat=require(_0x7522('0x0'));var rimraf=require(_0x7522('0x1'));var zipdir=require(_0x7522('0x2'));var jsonpatch=require(_0x7522('0x3'));var rp=require('request-promise');var moment=require(_0x7522('0x4'));var BPromise=require(_0x7522('0x5'));var Mustache=require(_0x7522('0x6'));var util=require(_0x7522('0x7'));var path=require('path');var sox=require(_0x7522('0x8'));var csv=require(_0x7522('0x9'));var ejs=require(_0x7522('0xa'));var fs=require('fs');var fs_extra=require(_0x7522('0xb'));var _=require(_0x7522('0xc'));var squel=require(_0x7522('0xd'));var crypto=require(_0x7522('0xe'));var jsforce=require(_0x7522('0xf'));var deskjs=require(_0x7522('0x10'));var toCsv=require(_0x7522('0x9'));var querystring=require(_0x7522('0x11'));var Papa=require('papaparse');var Redis=require(_0x7522('0x12'));var authService=require(_0x7522('0x13'));var qs=require(_0x7522('0x14'));var as=require(_0x7522('0x15'));var hardwareService=require(_0x7522('0x16'));var logger=require(_0x7522('0x17'))(_0x7522('0x18'));var utils=require('../../config/utils');var config=require(_0x7522('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x7522('0x1a'))['db'];function respondWithStatusCode(_0x826b2e,_0x35597d){_0x35597d=_0x35597d||0xcc;return function(_0x5eaa4d){if(_0x5eaa4d){return _0x826b2e[_0x7522('0x1b')](_0x35597d);}return _0x826b2e[_0x7522('0x1c')](_0x35597d)[_0x7522('0x1d')]();};}function respondWithResult(_0x32ccda,_0x327b52){_0x327b52=_0x327b52||0xc8;return function(_0x51f7c2){if(_0x51f7c2){return _0x32ccda['status'](_0x327b52)['json'](_0x51f7c2);}};}function respondWithFilteredResult(_0x5f51d2,_0x4e1916){return function(_0x271f6c){if(_0x271f6c){var _0x2c4950=typeof _0x4e1916[_0x7522('0x1e')]===_0x7522('0x1f')&&typeof _0x4e1916[_0x7522('0x20')]===_0x7522('0x1f');var _0x33255a=_0x271f6c[_0x7522('0x21')];var _0x78048=_0x2c4950?0x0:_0x4e1916[_0x7522('0x1e')];var _0x132b6c=_0x2c4950?_0x271f6c['count']:_0x4e1916[_0x7522('0x1e')]+_0x4e1916[_0x7522('0x20')];var _0xf50ab0;if(_0x132b6c>=_0x33255a){_0x132b6c=_0x33255a;_0xf50ab0=0xc8;}else{_0xf50ab0=0xce;}_0x5f51d2[_0x7522('0x1c')](_0xf50ab0);return _0x5f51d2['set'](_0x7522('0x22'),_0x78048+'-'+_0x132b6c+'/'+_0x33255a)['json'](_0x271f6c);}return null;};}function patchUpdates(_0x34c76d){return function(_0x3d432e){try{jsonpatch['apply'](_0x3d432e,_0x34c76d,!![]);}catch(_0x4ccbbd){return BPromise[_0x7522('0x23')](_0x4ccbbd);}return _0x3d432e[_0x7522('0x24')]();};}function saveUpdates(_0x4a9cac,_0x29586a){return function(_0x25699f){if(_0x25699f){return _0x25699f[_0x7522('0x25')](_0x4a9cac)[_0x7522('0x26')](function(_0x91311e){return _0x91311e;});}return null;};}function removeEntity(_0x3ece42,_0x1f3a5f){return function(_0x5d1b4e){if(_0x5d1b4e){return _0x5d1b4e[_0x7522('0x27')]()['then'](function(){_0x3ece42['status'](0xcc)[_0x7522('0x1d')]();});}};}function handleEntityNotFound(_0x3ef256,_0x123044){return function(_0x53c8c7){if(!_0x53c8c7){_0x3ef256[_0x7522('0x1b')](0x194);}return _0x53c8c7;};}function handleError(_0xbb4d8c,_0x33afa9){_0x33afa9=_0x33afa9||0x1f4;return function(_0x4af7b0){logger['error'](_0x4af7b0[_0x7522('0x28')]);if(_0x4af7b0['name']){delete _0x4af7b0[_0x7522('0x29')];}_0xbb4d8c['status'](_0x33afa9)['send'](_0x4af7b0);};}exports[_0x7522('0x2a')]=function(_0x36a61d,_0x54154c){var _0x82adfe={},_0x4d64b3={},_0x30c834={'count':0x0,'rows':[]};var _0x5d3611=_[_0x7522('0x2b')](db['ChatTransferReport']['rawAttributes'],function(_0x1c34e8){return{'name':_0x1c34e8[_0x7522('0x2c')],'type':_0x1c34e8[_0x7522('0x2d')][_0x7522('0x2e')]};});_0x4d64b3[_0x7522('0x2f')]=_[_0x7522('0x2b')](_0x5d3611,_0x7522('0x29'));_0x4d64b3[_0x7522('0x30')]=_[_0x7522('0x31')](_0x36a61d[_0x7522('0x30')]);_0x4d64b3[_0x7522('0x32')]=_[_0x7522('0x33')](_0x4d64b3['model'],_0x4d64b3[_0x7522('0x30')]);_0x82adfe[_0x7522('0x34')]=_['intersection'](_0x4d64b3[_0x7522('0x2f')],qs['fields'](_0x36a61d[_0x7522('0x30')][_0x7522('0x35')]));_0x82adfe[_0x7522('0x34')]=_0x82adfe[_0x7522('0x34')][_0x7522('0x36')]?_0x82adfe[_0x7522('0x34')]:_0x4d64b3[_0x7522('0x2f')];if(!_0x36a61d[_0x7522('0x30')]['hasOwnProperty'](_0x7522('0x37'))){_0x82adfe[_0x7522('0x20')]=qs[_0x7522('0x20')](_0x36a61d[_0x7522('0x30')][_0x7522('0x20')]);_0x82adfe['offset']=qs[_0x7522('0x1e')](_0x36a61d['query'][_0x7522('0x1e')]);}_0x82adfe[_0x7522('0x38')]=qs[_0x7522('0x39')](_0x36a61d['query']['sort']);_0x82adfe[_0x7522('0x3a')]=qs[_0x7522('0x32')](_[_0x7522('0x3b')](_0x36a61d[_0x7522('0x30')],_0x4d64b3[_0x7522('0x32')]),_0x5d3611);if(_0x36a61d[_0x7522('0x30')][_0x7522('0x3c')]){_0x82adfe[_0x7522('0x3a')]=_[_0x7522('0x3d')](_0x82adfe[_0x7522('0x3a')],{'$or':_['map'](_0x5d3611,function(_0x131eaf){if(_0x131eaf['type']!==_0x7522('0x3e')){var _0x45d82e={};_0x45d82e[_0x131eaf['name']]={'$like':'%'+_0x36a61d[_0x7522('0x30')][_0x7522('0x3c')]+'%'};return _0x45d82e;}})});}_0x82adfe=_[_0x7522('0x3d')]({},_0x82adfe,_0x36a61d[_0x7522('0x3f')]);var _0x11367a={'where':_0x82adfe[_0x7522('0x3a')]};return db[_0x7522('0x40')][_0x7522('0x21')](_0x11367a)['then'](function(_0x232822){_0x30c834[_0x7522('0x21')]=_0x232822;if(_0x36a61d['query']['includeAll']){_0x82adfe[_0x7522('0x41')]=[{'all':!![]}];}return db[_0x7522('0x40')]['findAll'](_0x82adfe);})['then'](function(_0xb2c8da){_0x30c834[_0x7522('0x42')]=_0xb2c8da;return _0x30c834;})[_0x7522('0x26')](respondWithFilteredResult(_0x54154c,_0x82adfe))[_0x7522('0x43')](handleError(_0x54154c,null));};exports['show']=function(_0x3e0c7d,_0x564f61){var _0x34a7b2={'raw':!![],'where':{'id':_0x3e0c7d[_0x7522('0x44')]['id']}},_0x2ca2e7={};_0x2ca2e7['model']=_['keys'](db[_0x7522('0x40')][_0x7522('0x45')]);_0x2ca2e7[_0x7522('0x30')]=_['keys'](_0x3e0c7d[_0x7522('0x30')]);_0x2ca2e7['filters']=_['intersection'](_0x2ca2e7['model'],_0x2ca2e7[_0x7522('0x30')]);_0x34a7b2['attributes']=_[_0x7522('0x33')](_0x2ca2e7['model'],qs[_0x7522('0x35')](_0x3e0c7d[_0x7522('0x30')]['fields']));_0x34a7b2[_0x7522('0x34')]=_0x34a7b2[_0x7522('0x34')][_0x7522('0x36')]?_0x34a7b2[_0x7522('0x34')]:_0x2ca2e7[_0x7522('0x2f')];if(_0x3e0c7d[_0x7522('0x30')][_0x7522('0x46')]){_0x34a7b2[_0x7522('0x41')]=[{'all':!![]}];}_0x34a7b2=_['merge']({},_0x34a7b2,_0x3e0c7d['options']);return db[_0x7522('0x40')]['find'](_0x34a7b2)[_0x7522('0x26')](handleEntityNotFound(_0x564f61,null))[_0x7522('0x26')](respondWithResult(_0x564f61,null))[_0x7522('0x43')](handleError(_0x564f61,null));};exports[_0x7522('0x47')]=function(_0xd6c4c2,_0x282df1){return db[_0x7522('0x40')][_0x7522('0x47')](_0xd6c4c2[_0x7522('0x48')],{})[_0x7522('0x26')](respondWithResult(_0x282df1,0xc9))[_0x7522('0x43')](handleError(_0x282df1,null));};exports[_0x7522('0x25')]=function(_0x4a2784,_0xe7d0c5){if(_0x4a2784[_0x7522('0x48')]['id']){delete _0x4a2784['body']['id'];}return db[_0x7522('0x40')][_0x7522('0x49')]({'where':{'id':_0x4a2784['params']['id']}})[_0x7522('0x26')](handleEntityNotFound(_0xe7d0c5,null))[_0x7522('0x26')](saveUpdates(_0x4a2784[_0x7522('0x48')],null))[_0x7522('0x26')](respondWithResult(_0xe7d0c5,null))[_0x7522('0x43')](handleError(_0xe7d0c5,null));};exports['destroy']=function(_0x39775b,_0x57fd8c){return db[_0x7522('0x40')][_0x7522('0x49')]({'where':{'id':_0x39775b[_0x7522('0x44')]['id']}})[_0x7522('0x26')](handleEntityNotFound(_0x57fd8c,null))[_0x7522('0x26')](removeEntity(_0x57fd8c,null))[_0x7522('0x43')](handleError(_0x57fd8c,null));};exports['describe']=function(_0x46673e,_0x1bce7f){return db[_0x7522('0x40')][_0x7522('0x4a')]()[_0x7522('0x26')](respondWithResult(_0x1bce7f,null))[_0x7522('0x43')](handleError(_0x1bce7f,null));}; \ No newline at end of file +var _0xc57e=['filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','options','ChatTransferReport','findAll','rows','catch','show','include','create','body','find','params','describe','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','save','then','destroy','error','name','send','map','rawAttributes','fieldName','type','key','model','keys','query'];(function(_0x215231,_0x3b67de){var _0x41c203=function(_0x306841){while(--_0x306841){_0x215231['push'](_0x215231['shift']());}};_0x41c203(++_0x3b67de);}(_0xc57e,0xa3));var _0xec57=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xc57e[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require(_0xec57('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xec57('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xec57('0x2'));var Mustache=require(_0xec57('0x3'));var util=require(_0xec57('0x4'));var path=require(_0xec57('0x5'));var sox=require(_0xec57('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xec57('0x7'));var _=require(_0xec57('0x8'));var squel=require(_0xec57('0x9'));var crypto=require(_0xec57('0xa'));var jsforce=require(_0xec57('0xb'));var deskjs=require(_0xec57('0xc'));var toCsv=require('to-csv');var querystring=require(_0xec57('0xd'));var Papa=require(_0xec57('0xe'));var Redis=require(_0xec57('0xf'));var authService=require(_0xec57('0x10'));var qs=require(_0xec57('0x11'));var as=require(_0xec57('0x12'));var hardwareService=require(_0xec57('0x13'));var logger=require('../../config/logger')(_0xec57('0x14'));var utils=require(_0xec57('0x15'));var config=require(_0xec57('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xec57('0x17'))['db'];function respondWithStatusCode(_0x349f47,_0x5666e0){_0x5666e0=_0x5666e0||0xcc;return function(_0x56c82e){if(_0x56c82e){return _0x349f47[_0xec57('0x18')](_0x5666e0);}return _0x349f47[_0xec57('0x19')](_0x5666e0)[_0xec57('0x1a')]();};}function respondWithResult(_0x17ab7c,_0x5ddeb4){_0x5ddeb4=_0x5ddeb4||0xc8;return function(_0x7394a1){if(_0x7394a1){return _0x17ab7c[_0xec57('0x19')](_0x5ddeb4)[_0xec57('0x1b')](_0x7394a1);}};}function respondWithFilteredResult(_0x2967ec,_0x5c8e9b){return function(_0x225b5a){if(_0x225b5a){var _0x4a79dd=typeof _0x5c8e9b[_0xec57('0x1c')]==='undefined'&&typeof _0x5c8e9b[_0xec57('0x1d')]===_0xec57('0x1e');var _0x15a3a7=_0x225b5a[_0xec57('0x1f')];var _0x2d3480=_0x4a79dd?0x0:_0x5c8e9b[_0xec57('0x1c')];var _0x1c3e5b=_0x4a79dd?_0x225b5a[_0xec57('0x1f')]:_0x5c8e9b['offset']+_0x5c8e9b[_0xec57('0x1d')];var _0xade45;if(_0x1c3e5b>=_0x15a3a7){_0x1c3e5b=_0x15a3a7;_0xade45=0xc8;}else{_0xade45=0xce;}_0x2967ec['status'](_0xade45);return _0x2967ec['set'](_0xec57('0x20'),_0x2d3480+'-'+_0x1c3e5b+'/'+_0x15a3a7)['json'](_0x225b5a);}return null;};}function patchUpdates(_0x1e42b3){return function(_0x3d1a59){try{jsonpatch['apply'](_0x3d1a59,_0x1e42b3,!![]);}catch(_0x1137bf){return BPromise['reject'](_0x1137bf);}return _0x3d1a59[_0xec57('0x21')]();};}function saveUpdates(_0x1cb341,_0x2069da){return function(_0x2fb28e){if(_0x2fb28e){return _0x2fb28e['update'](_0x1cb341)[_0xec57('0x22')](function(_0x57bbad){return _0x57bbad;});}return null;};}function removeEntity(_0x266a80,_0x484de0){return function(_0xf6e24c){if(_0xf6e24c){return _0xf6e24c[_0xec57('0x23')]()[_0xec57('0x22')](function(){_0x266a80[_0xec57('0x19')](0xcc)[_0xec57('0x1a')]();});}};}function handleEntityNotFound(_0x32128c,_0x371b10){return function(_0x5debaf){if(!_0x5debaf){_0x32128c[_0xec57('0x18')](0x194);}return _0x5debaf;};}function handleError(_0x3ad81a,_0x3cdce){_0x3cdce=_0x3cdce||0x1f4;return function(_0xd72b9){logger[_0xec57('0x24')](_0xd72b9['stack']);if(_0xd72b9[_0xec57('0x25')]){delete _0xd72b9[_0xec57('0x25')];}_0x3ad81a[_0xec57('0x19')](_0x3cdce)[_0xec57('0x26')](_0xd72b9);};}exports['index']=function(_0x49425e,_0x39a201){var _0x30bbee={},_0x42a11d={},_0x438aa6={'count':0x0,'rows':[]};var _0x54ee71=_[_0xec57('0x27')](db['ChatTransferReport'][_0xec57('0x28')],function(_0x3c6635){return{'name':_0x3c6635[_0xec57('0x29')],'type':_0x3c6635[_0xec57('0x2a')][_0xec57('0x2b')]};});_0x42a11d[_0xec57('0x2c')]=_[_0xec57('0x27')](_0x54ee71,'name');_0x42a11d['query']=_[_0xec57('0x2d')](_0x49425e[_0xec57('0x2e')]);_0x42a11d[_0xec57('0x2f')]=_[_0xec57('0x30')](_0x42a11d[_0xec57('0x2c')],_0x42a11d[_0xec57('0x2e')]);_0x30bbee[_0xec57('0x31')]=_[_0xec57('0x30')](_0x42a11d['model'],qs['fields'](_0x49425e[_0xec57('0x2e')][_0xec57('0x32')]));_0x30bbee[_0xec57('0x31')]=_0x30bbee[_0xec57('0x31')][_0xec57('0x33')]?_0x30bbee[_0xec57('0x31')]:_0x42a11d[_0xec57('0x2c')];if(!_0x49425e[_0xec57('0x2e')]['hasOwnProperty'](_0xec57('0x34'))){_0x30bbee['limit']=qs[_0xec57('0x1d')](_0x49425e[_0xec57('0x2e')]['limit']);_0x30bbee[_0xec57('0x1c')]=qs['offset'](_0x49425e[_0xec57('0x2e')][_0xec57('0x1c')]);}_0x30bbee['order']=qs[_0xec57('0x35')](_0x49425e[_0xec57('0x2e')][_0xec57('0x35')]);_0x30bbee[_0xec57('0x36')]=qs['filters'](_[_0xec57('0x37')](_0x49425e['query'],_0x42a11d['filters']),_0x54ee71);if(_0x49425e[_0xec57('0x2e')][_0xec57('0x38')]){_0x30bbee['where']=_[_0xec57('0x39')](_0x30bbee[_0xec57('0x36')],{'$or':_[_0xec57('0x27')](_0x54ee71,function(_0x2a8d99){if(_0x2a8d99[_0xec57('0x2a')]!=='VIRTUAL'){var _0x320cb5={};_0x320cb5[_0x2a8d99[_0xec57('0x25')]]={'$like':'%'+_0x49425e[_0xec57('0x2e')][_0xec57('0x38')]+'%'};return _0x320cb5;}})});}_0x30bbee=_[_0xec57('0x39')]({},_0x30bbee,_0x49425e[_0xec57('0x3a')]);var _0x4a39={'where':_0x30bbee[_0xec57('0x36')]};return db['ChatTransferReport'][_0xec57('0x1f')](_0x4a39)[_0xec57('0x22')](function(_0x22e6a1){_0x438aa6[_0xec57('0x1f')]=_0x22e6a1;if(_0x49425e[_0xec57('0x2e')]['includeAll']){_0x30bbee['include']=[{'all':!![]}];}return db[_0xec57('0x3b')][_0xec57('0x3c')](_0x30bbee);})[_0xec57('0x22')](function(_0x2143c9){_0x438aa6[_0xec57('0x3d')]=_0x2143c9;return _0x438aa6;})[_0xec57('0x22')](respondWithFilteredResult(_0x39a201,_0x30bbee))[_0xec57('0x3e')](handleError(_0x39a201,null));};exports[_0xec57('0x3f')]=function(_0x4f5053,_0x126064){var _0x184576={'raw':!![],'where':{'id':_0x4f5053['params']['id']}},_0x286c8a={};_0x286c8a[_0xec57('0x2c')]=_['keys'](db[_0xec57('0x3b')][_0xec57('0x28')]);_0x286c8a[_0xec57('0x2e')]=_[_0xec57('0x2d')](_0x4f5053[_0xec57('0x2e')]);_0x286c8a[_0xec57('0x2f')]=_[_0xec57('0x30')](_0x286c8a[_0xec57('0x2c')],_0x286c8a[_0xec57('0x2e')]);_0x184576[_0xec57('0x31')]=_['intersection'](_0x286c8a[_0xec57('0x2c')],qs[_0xec57('0x32')](_0x4f5053[_0xec57('0x2e')]['fields']));_0x184576[_0xec57('0x31')]=_0x184576[_0xec57('0x31')][_0xec57('0x33')]?_0x184576[_0xec57('0x31')]:_0x286c8a[_0xec57('0x2c')];if(_0x4f5053[_0xec57('0x2e')]['includeAll']){_0x184576[_0xec57('0x40')]=[{'all':!![]}];}_0x184576=_['merge']({},_0x184576,_0x4f5053[_0xec57('0x3a')]);return db[_0xec57('0x3b')]['find'](_0x184576)[_0xec57('0x22')](handleEntityNotFound(_0x126064,null))[_0xec57('0x22')](respondWithResult(_0x126064,null))[_0xec57('0x3e')](handleError(_0x126064,null));};exports[_0xec57('0x41')]=function(_0x383727,_0x51e8f2){return db[_0xec57('0x3b')][_0xec57('0x41')](_0x383727['body'],{})[_0xec57('0x22')](respondWithResult(_0x51e8f2,0xc9))[_0xec57('0x3e')](handleError(_0x51e8f2,null));};exports['update']=function(_0x487fff,_0x6962fb){if(_0x487fff[_0xec57('0x42')]['id']){delete _0x487fff[_0xec57('0x42')]['id'];}return db[_0xec57('0x3b')][_0xec57('0x43')]({'where':{'id':_0x487fff[_0xec57('0x44')]['id']}})[_0xec57('0x22')](handleEntityNotFound(_0x6962fb,null))[_0xec57('0x22')](saveUpdates(_0x487fff[_0xec57('0x42')],null))[_0xec57('0x22')](respondWithResult(_0x6962fb,null))[_0xec57('0x3e')](handleError(_0x6962fb,null));};exports[_0xec57('0x23')]=function(_0x3f2003,_0x5c52e1){return db[_0xec57('0x3b')][_0xec57('0x43')]({'where':{'id':_0x3f2003['params']['id']}})[_0xec57('0x22')](handleEntityNotFound(_0x5c52e1,null))[_0xec57('0x22')](removeEntity(_0x5c52e1,null))[_0xec57('0x3e')](handleError(_0x5c52e1,null));};exports[_0xec57('0x45')]=function(_0x57f82b,_0x18ed54){return db[_0xec57('0x3b')][_0xec57('0x45')]()[_0xec57('0x22')](respondWithResult(_0x18ed54,null))[_0xec57('0x3e')](handleError(_0x18ed54,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 6602f68..3956cb0 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 _0x9a76=['define','ChatTransferReport','uniqueid','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes'];(function(_0xc17d60,_0x4d3616){var _0x462396=function(_0x23d12e){while(--_0x23d12e){_0xc17d60['push'](_0xc17d60['shift']());}};_0x462396(++_0x4d3616);}(_0x9a76,0x7b));var _0x69a7=function(_0x38d5ee,_0x17438c){_0x38d5ee=_0x38d5ee-0x0;var _0x37c2e4=_0x9a76[_0x38d5ee];return _0x37c2e4;};'use strict';var _=require(_0x69a7('0x0'));var util=require('util');var logger=require(_0x69a7('0x1'))(_0x69a7('0x2'));var moment=require(_0x69a7('0x3'));var BPromise=require('bluebird');var rp=require(_0x69a7('0x4'));var fs=require('fs');var path=require(_0x69a7('0x5'));var rimraf=require(_0x69a7('0x6'));var config=require(_0x69a7('0x7'));var attributes=require(_0x69a7('0x8'));module['exports']=function(_0x36e6fb,_0x9bbfd4){return _0x36e6fb[_0x69a7('0x9')](_0x69a7('0xa'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x69a7('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb106=['./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0xb106,0x1f4));var _0x6b10=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0xb106[_0x1ccdf7];return _0x52a0ae;};'use strict';var _=require('lodash');var util=require(_0x6b10('0x0'));var logger=require(_0x6b10('0x1'))('api');var moment=require('moment');var BPromise=require(_0x6b10('0x2'));var rp=require(_0x6b10('0x3'));var fs=require('fs');var path=require(_0x6b10('0x4'));var rimraf=require(_0x6b10('0x5'));var config=require(_0x6b10('0x6'));var attributes=require(_0x6b10('0x7'));module[_0x6b10('0x8')]=function(_0x2081bb,_0x29b57b){return _0x2081bb[_0x6b10('0x9')](_0x6b10('0xa'),attributes,{'tableName':_0x6b10('0xb'),'paranoid':![],'indexes':[{'name':_0x6b10('0xc'),'fields':[_0x6b10('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index cc1cd17..2de2dc9 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 _0xbdca=['jayson/promise','client','http','request','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x35cb5d,_0x2039d9){var _0x1da2db=function(_0x4172d5){while(--_0x4172d5){_0x35cb5d['push'](_0x35cb5d['shift']());}};_0x1da2db(++_0x2039d9);}(_0xbdca,0x177));var _0xabdc=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xbdca[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xabdc('0x0'));var util=require(_0xabdc('0x1'));var moment=require(_0xabdc('0x2'));var BPromise=require(_0xabdc('0x3'));var rs=require(_0xabdc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xabdc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xabdc('0x6'))(_0xabdc('0x7'));var config=require(_0xabdc('0x8'));var jayson=require(_0xabdc('0x9'));var client=jayson[_0xabdc('0xa')][_0xabdc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38ab68,_0x20930a,_0x314f7c){return new BPromise(function(_0x297da5,_0x47bf1e){return client[_0xabdc('0xc')](_0x38ab68,_0x314f7c)['then'](function(_0x5d7bc1){logger[_0xabdc('0xd')](_0xabdc('0xe'),_0x20930a,_0xabdc('0xf'));logger[_0xabdc('0x10')](_0xabdc('0x11'),_0x20930a,_0xabdc('0xf'),JSON[_0xabdc('0x12')](_0x5d7bc1));if(_0x5d7bc1[_0xabdc('0x13')]){if(_0x5d7bc1[_0xabdc('0x13')][_0xabdc('0x14')]===0x1f4){logger[_0xabdc('0x13')](_0xabdc('0xe'),_0x20930a,_0x5d7bc1[_0xabdc('0x13')][_0xabdc('0x15')]);return _0x47bf1e(_0x5d7bc1['error'][_0xabdc('0x15')]);}logger[_0xabdc('0x13')](_0xabdc('0xe'),_0x20930a,_0x5d7bc1[_0xabdc('0x13')][_0xabdc('0x15')]);return _0x297da5(_0x5d7bc1[_0xabdc('0x13')][_0xabdc('0x15')]);}else{logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x20930a,_0xabdc('0xf'));_0x297da5(_0x5d7bc1[_0xabdc('0x16')][_0xabdc('0x15')]);}})[_0xabdc('0x17')](function(_0x1640a5){logger[_0xabdc('0x13')](_0xabdc('0xe'),_0x20930a,_0x1640a5);_0x47bf1e(_0x1640a5);});});} \ No newline at end of file +var _0xd1f5=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','ChatTransferReport,\x20%s,\x20%s','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','message','catch','util','moment','bluebird','randomstring'];(function(_0x1ed95c,_0xf05dff){var _0x4601b3=function(_0xdcfbc){while(--_0xdcfbc){_0x1ed95c['push'](_0x1ed95c['shift']());}};_0x4601b3(++_0xf05dff);}(_0xd1f5,0x12c));var _0x5d1f=function(_0x1ef9a4,_0x1ca6de){_0x1ef9a4=_0x1ef9a4-0x0;var _0xd46714=_0xd1f5[_0x1ef9a4];return _0xd46714;};'use strict';var _=require('lodash');var util=require(_0x5d1f('0x0'));var moment=require(_0x5d1f('0x1'));var BPromise=require(_0x5d1f('0x2'));var rs=require(_0x5d1f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5d1f('0x4'))['db'];var utils=require(_0x5d1f('0x5'));var logger=require(_0x5d1f('0x6'))(_0x5d1f('0x7'));var config=require(_0x5d1f('0x8'));var jayson=require(_0x5d1f('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xedec45,_0x2d8c97,_0x491f11){return new BPromise(function(_0xf34fcb,_0x14c745){return client[_0x5d1f('0xa')](_0xedec45,_0x491f11)[_0x5d1f('0xb')](function(_0x55d49e){logger[_0x5d1f('0xc')](_0x5d1f('0xd'),_0x2d8c97,'request\x20sent');logger[_0x5d1f('0xe')](_0x5d1f('0xf'),_0x2d8c97,'request\x20sent',JSON['stringify'](_0x55d49e));if(_0x55d49e[_0x5d1f('0x10')]){if(_0x55d49e[_0x5d1f('0x10')]['code']===0x1f4){logger[_0x5d1f('0x10')](_0x5d1f('0xd'),_0x2d8c97,_0x55d49e[_0x5d1f('0x10')][_0x5d1f('0x11')]);return _0x14c745(_0x55d49e[_0x5d1f('0x10')][_0x5d1f('0x11')]);}logger[_0x5d1f('0x10')](_0x5d1f('0xd'),_0x2d8c97,_0x55d49e[_0x5d1f('0x10')][_0x5d1f('0x11')]);return _0xf34fcb(_0x55d49e['error']['message']);}else{logger['info'](_0x5d1f('0xd'),_0x2d8c97,'request\x20sent');_0xf34fcb(_0x55d49e['result'][_0x5d1f('0x11')]);}})[_0x5d1f('0x12')](function(_0xf5868e){logger[_0x5d1f('0x10')](_0x5d1f('0xd'),_0x2d8c97,_0xf5868e);_0x14c745(_0xf5868e);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 2d67c41..1235831 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 _0xbdbb=['isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get'];(function(_0x5aba30,_0x41a5e0){var _0x227541=function(_0x3a0a52){while(--_0x3a0a52){_0x5aba30['push'](_0x5aba30['shift']());}};_0x227541(++_0x41a5e0);}(_0xbdbb,0x17c));var _0xbbdb=function(_0x26371f,_0x3529d6){_0x26371f=_0x26371f-0x0;var _0x7bf77f=_0xbdbb[_0x26371f];return _0x7bf77f;};'use strict';var multer=require(_0xbbdb('0x0'));var util=require(_0xbbdb('0x1'));var path=require(_0xbbdb('0x2'));var timeout=require(_0xbbdb('0x3'));var express=require(_0xbbdb('0x4'));var router=express[_0xbbdb('0x5')]();var fs_extra=require(_0xbbdb('0x6'));var auth=require(_0xbbdb('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xbbdb('0x8'));var controller=require(_0xbbdb('0x9'));router[_0xbbdb('0xa')]('/',auth[_0xbbdb('0xb')](),controller[_0xbbdb('0xc')]);router['get'](_0xbbdb('0xd'),auth['isAuthenticated'](),controller[_0xbbdb('0xe')]);router['get'](_0xbbdb('0xf'),auth['isAuthenticated'](),controller[_0xbbdb('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbbdb('0x11')]);router[_0xbbdb('0x12')](_0xbbdb('0xf'),auth[_0xbbdb('0xb')](),controller[_0xbbdb('0x13')]);router[_0xbbdb('0x14')](_0xbbdb('0xf'),auth[_0xbbdb('0xb')](),controller[_0xbbdb('0x15')]);module[_0xbbdb('0x16')]=router; \ No newline at end of file +var _0x19bb=['get','isAuthenticated','index','/describe','/:id','put','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../config/environment','./chatTransferReport.controller'];(function(_0x4cd782,_0x2f1f68){var _0x34d61c=function(_0x47d915){while(--_0x47d915){_0x4cd782['push'](_0x4cd782['shift']());}};_0x34d61c(++_0x2f1f68);}(_0x19bb,0x119));var _0xb19b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x19bb[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xb19b('0x0'));var util=require('util');var path=require(_0xb19b('0x1'));var timeout=require(_0xb19b('0x2'));var express=require('express');var router=express[_0xb19b('0x3')]();var fs_extra=require(_0xb19b('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb19b('0x5'));var controller=require(_0xb19b('0x6'));router[_0xb19b('0x7')]('/',auth[_0xb19b('0x8')](),controller[_0xb19b('0x9')]);router[_0xb19b('0x7')](_0xb19b('0xa'),auth[_0xb19b('0x8')](),controller['describe']);router[_0xb19b('0x7')](_0xb19b('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xb19b('0x8')](),controller['create']);router[_0xb19b('0xc')]('/:id',auth[_0xb19b('0x8')](),controller['update']);router[_0xb19b('0xd')](_0xb19b('0xb'),auth[_0xb19b('0x8')](),controller[_0xb19b('0xe')]);module[_0xb19b('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index a98382f..ab3f501 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 _0x583b=['Skip','Feedback','ENUM','star','thumb','stringify','input','text','name','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.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','alternate','System','mandatoryDispositionPauseId','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','randomstring','exports','STRING','address','email','#011F6A','#ffffff','INTEGER','BOOLEAN','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Type\x20a\x20message'];(function(_0x51f47b,_0x597006){var _0x35718c=function(_0x151950){while(--_0x151950){_0x51f47b['push'](_0x51f47b['shift']());}};_0x35718c(++_0x597006);}(_0x583b,0xe5));var _0xb583=function(_0x209403,_0x27d3d7){_0x209403=_0x209403-0x0;var _0x2fd163=_0x583b[_0x209403];return _0x2fd163;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xb583('0x0'));module[_0xb583('0x1')]={'name':{'type':Sequelize[_0xb583('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0xb583('0x2')],'allowNull':![],'unique':_0xb583('0x3')},'description':{'type':Sequelize[_0xb583('0x2')]},'mapKey':{'type':Sequelize[_0xb583('0x2')],'defaultValue':_0xb583('0x4')},'mapKeyOffline':{'type':Sequelize[_0xb583('0x2')],'defaultValue':_0xb583('0x4')},'key':{'type':Sequelize[_0xb583('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xb583('0x2')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0xb583('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xb583('0x2')],'allowNull':![],'defaultValue':_0xb583('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xb583('0x2')],'allowNull':![],'defaultValue':_0xb583('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xb583('0x2')],'allowNull':![],'defaultValue':_0xb583('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xb583('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xb583('0x2')]},'animation':{'type':Sequelize[_0xb583('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0xb583('0x9'),_0xb583('0xa')),'defaultValue':_0xb583('0x9')},'header_online':{'type':Sequelize[_0xb583('0x2')],'defaultValue':_0xb583('0xb')},'start_chat_button':{'type':Sequelize[_0xb583('0x2')],'defaultValue':_0xb583('0xc')},'offline_chat_button':{'type':Sequelize[_0xb583('0x2')],'defaultValue':_0xb583('0xd')},'header_offline':{'type':Sequelize[_0xb583('0x2')],'defaultValue':_0xb583('0xe')},'download_transcript':{'type':Sequelize[_0xb583('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xb583('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xb583('0x2')],'defaultValue':_0xb583('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0xb583('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xb583('0x10')]},'closingQuestion':{'type':Sequelize[_0xb583('0x2')],'defaultValue':_0xb583('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0xb583('0x2')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0xb583('0x2')],'defaultValue':_0xb583('0x12')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0xb583('0x13')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0xb583('0x14')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0xb583('0x2')],'defaultValue':_0xb583('0xd')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xb583('0x15')},'conditionAgreement':{'type':Sequelize[_0xb583('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xb583('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xb583('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xb583('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xb583('0x2')],'defaultValue':_0xb583('0x16')},'ratingType':{'type':Sequelize[_0xb583('0x17')](_0xb583('0x18'),_0xb583('0x19')),'defaultValue':_0xb583('0x18')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xb583('0x10')],'defaultValue':function(){return JSON[_0xb583('0x1a')]({'items':[{'type':_0xb583('0x1b'),'variable':null,'config':{'placeholder':'name','type':_0xb583('0x1c'),'required':!![]},'props':{'title':_0xb583('0x1d'),'helpText':''}},{'type':_0xb583('0x1b'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xb583('0x4'),'type':_0xb583('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xb583('0x1e')](_0xb583('0x1f'))?JSON[_0xb583('0x20')](this[_0xb583('0x1e')](_0xb583('0x1f'))):{};},'set':function(_0x5040fa){return this[_0xb583('0x21')]('onlineForm',JSON[_0xb583('0x1a')](_0x5040fa));}},'offlineForm':{'type':Sequelize[_0xb583('0x10')],'defaultValue':function(){return JSON[_0xb583('0x1a')]({'items':[{'type':'input','props':{'title':_0xb583('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xb583('0x4'),'type':_0xb583('0x4')},'variable':null},{'type':_0xb583('0x22'),'config':{'placeholder':_0xb583('0x23')},'props':{'title':_0xb583('0x23'),'helpText':_0xb583('0x24')}}],'fromKey':0x0});},'get':function(){return this[_0xb583('0x1e')](_0xb583('0x25'))?JSON['parse'](this[_0xb583('0x1e')]('offlineForm')):{};},'set':function(_0x573452){return this[_0xb583('0x21')](_0xb583('0x25'),JSON['stringify'](_0x573452));}},'token':{'type':Sequelize[_0xb583('0x2')],'defaultValue':function(){return rs[_0xb583('0x26')]();}},'autoclose':{'type':Sequelize[_0xb583('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xb583('0x2')]},'forwardOffline':{'type':Sequelize[_0xb583('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xb583('0x2')]},'waitingTitle':{'type':Sequelize[_0xb583('0x2')],'defaultValue':_0xb583('0x27')},'waitingMessage':{'type':Sequelize[_0xb583('0x2')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0xb583('0x28')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0xb583('0x29')},'enableUnmanagedNote':{'type':Sequelize[_0xb583('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xb583('0x2')],'defaultValue':_0xb583('0x2a')},'skipUnmanaged':{'type':Sequelize[_0xb583('0x2')],'defaultValue':_0xb583('0x15')},'sendUnmanaged':{'type':Sequelize[_0xb583('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0xb583('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xb583('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xb583('0x10')]},'showAgentAvatar':{'type':Sequelize[_0xb583('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xb583('0x10')],'defaultValue':function(){return _0xb583('0x2b');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb583('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0xb583('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0xb583('0x2c')},'verticalAlignment':{'type':Sequelize[_0xb583('0x7')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xb583('0x2')],'defaultValue':_0xb583('0x2d')},'defaultTitle':{'type':Sequelize[_0xb583('0x2')]},'customerAvatar':{'type':Sequelize[_0xb583('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0xb583('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xb583('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xb583('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb583('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb583('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0xb583('0x2e')},'systemAvatar':{'type':Sequelize[_0xb583('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb583('0x7')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xb583('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x51ae5f){if(!_0x51ae5f)this[_0xb583('0x21')](_0xb583('0x2f'),null);this[_0xb583('0x21')]('mandatoryDisposition',_0x51ae5f);}},'vidaooEscalation':{'type':Sequelize[_0xb583('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xb583('0x2')]},'vidaooTopic':{'type':Sequelize[_0xb583('0x2')],'allowNull':![],'defaultValue':_0xb583('0x30')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0xb583('0x31');}},'vidaooMetadata':{'type':Sequelize[_0xb583('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xb583('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xb583('0x10')]}}; \ No newline at end of file +var _0xf61c=['address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','squared','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Feedback','thumb','TEXT','stringify','input','name','text','getDataValue','onlineForm','setDataValue','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.','Skip','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','exports','STRING'];(function(_0x592df4,_0x4e719b){var _0x3b4fe4=function(_0x5ebf53){while(--_0x5ebf53){_0x592df4['push'](_0x592df4['shift']());}};_0x3b4fe4(++_0x4e719b);}(_0xf61c,0x195));var _0xcf61=function(_0xa04e45,_0x3e2c31){_0xa04e45=_0xa04e45-0x0;var _0x2cd452=_0xf61c[_0xa04e45];return _0x2cd452;};'use strict';var Sequelize=require(_0xcf61('0x0'));var rs=require('randomstring');module[_0xcf61('0x1')]={'name':{'type':Sequelize[_0xcf61('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0xcf61('0x2')],'allowNull':![],'unique':_0xcf61('0x3')},'description':{'type':Sequelize[_0xcf61('0x2')]},'mapKey':{'type':Sequelize[_0xcf61('0x2')],'defaultValue':_0xcf61('0x4')},'mapKeyOffline':{'type':Sequelize[_0xcf61('0x2')],'defaultValue':_0xcf61('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xcf61('0x5')},'customerAlias':{'type':Sequelize[_0xcf61('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xcf61('0x2')],'allowNull':![],'defaultValue':_0xcf61('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xcf61('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xcf61('0x2')],'allowNull':![],'defaultValue':_0xcf61('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xcf61('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0xcf61('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xcf61('0xa')]('rounded',_0xcf61('0xb')),'defaultValue':_0xcf61('0xc')},'header_online':{'type':Sequelize[_0xcf61('0x2')],'defaultValue':_0xcf61('0xd')},'start_chat_button':{'type':Sequelize[_0xcf61('0x2')],'defaultValue':_0xcf61('0xe')},'offline_chat_button':{'type':Sequelize[_0xcf61('0x2')],'defaultValue':_0xcf61('0xf')},'header_offline':{'type':Sequelize[_0xcf61('0x2')],'defaultValue':_0xcf61('0x10')},'download_transcript':{'type':Sequelize[_0xcf61('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xcf61('0x2')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xcf61('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0xcf61('0x2')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0xcf61('0x2')],'defaultValue':_0xcf61('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0xcf61('0x2')],'defaultValue':_0xcf61('0x12')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0xcf61('0x13')},'placeholderMessage':{'type':Sequelize[_0xcf61('0x2')],'defaultValue':_0xcf61('0x14')},'closingMessage':{'type':Sequelize[_0xcf61('0x2')],'defaultValue':_0xcf61('0x15')},'closingMessageButton':{'type':Sequelize[_0xcf61('0x2')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0xcf61('0x2')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xcf61('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0xcf61('0x16')},'ratingType':{'type':Sequelize[_0xcf61('0xa')]('star',_0xcf61('0x17')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0xcf61('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xcf61('0x18')],'defaultValue':function(){return JSON[_0xcf61('0x19')]({'items':[{'type':_0xcf61('0x1a'),'variable':null,'config':{'placeholder':_0xcf61('0x1b'),'type':_0xcf61('0x1c'),'required':!![]},'props':{'title':_0xcf61('0x1b'),'helpText':''}},{'type':'input','props':{'title':_0xcf61('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xcf61('0x4'),'type':_0xcf61('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xcf61('0x1d')](_0xcf61('0x1e'))?JSON['parse'](this['getDataValue'](_0xcf61('0x1e'))):{};},'set':function(_0x3fad3d){return this[_0xcf61('0x1f')]('onlineForm',JSON[_0xcf61('0x19')](_0x3fad3d));}},'offlineForm':{'type':Sequelize[_0xcf61('0x18')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xcf61('0x1a'),'props':{'title':_0xcf61('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xcf61('0x4'),'type':_0xcf61('0x4')},'variable':null},{'type':'textarea','config':{'placeholder':_0xcf61('0x20')},'props':{'title':_0xcf61('0x20'),'helpText':_0xcf61('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0xcf61('0x1d')](_0xcf61('0x22'))?JSON['parse'](this['getDataValue'](_0xcf61('0x22'))):{};},'set':function(_0x5d12e1){return this['setDataValue'](_0xcf61('0x22'),JSON['stringify'](_0x5d12e1));}},'token':{'type':Sequelize[_0xcf61('0x2')],'defaultValue':function(){return rs[_0xcf61('0x23')]();}},'autoclose':{'type':Sequelize[_0xcf61('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xcf61('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xcf61('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0xcf61('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0xcf61('0x24')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xcf61('0x25')},'offlineMessageSubject':{'type':Sequelize[_0xcf61('0x2')],'defaultValue':_0xcf61('0x26')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0xcf61('0x27')},'enableUnmanagedNote':{'type':Sequelize[_0xcf61('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xcf61('0x2')],'defaultValue':_0xcf61('0x28')},'skipUnmanaged':{'type':Sequelize[_0xcf61('0x2')],'defaultValue':_0xcf61('0x29')},'sendUnmanaged':{'type':Sequelize[_0xcf61('0x2')],'defaultValue':_0xcf61('0xf')},'enableCustomerAttachment':{'type':Sequelize[_0xcf61('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xcf61('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0xcf61('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xcf61('0x2')]},'notificationTemplate':{'type':Sequelize[_0xcf61('0x18')],'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[_0xcf61('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xcf61('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xcf61('0x2')],'defaultValue':_0xcf61('0x2a')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xcf61('0x2')],'defaultValue':_0xcf61('0x2b')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0xcf61('0x18')]},'showCustomerAvatar':{'type':Sequelize[_0xcf61('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xcf61('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xcf61('0x2')],'allowNull':![],'defaultValue':_0xcf61('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xcf61('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xcf61('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcf61('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xcf61('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xcf61('0x2')],'defaultValue':_0xcf61('0x2d')},'systemAvatar':{'type':Sequelize[_0xcf61('0x18')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xcf61('0x8')],'comment':_0xcf61('0x2e')},'mandatoryDisposition':{'type':Sequelize[_0xcf61('0x9')],'defaultValue':![],'comment':_0xcf61('0x2f'),'set':function(_0x34c938){if(!_0x34c938)this['setDataValue'](_0xcf61('0x30'),null);this[_0xcf61('0x1f')]('mandatoryDisposition',_0x34c938);}},'vidaooEscalation':{'type':Sequelize[_0xcf61('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xcf61('0x2')]},'vidaooTopic':{'type':Sequelize[_0xcf61('0x2')],'allowNull':![],'defaultValue':_0xcf61('0x31')},'vidaooNote':{'type':Sequelize[_0xcf61('0x2')],'defaultValue':function(){return _0xcf61('0x32');}},'vidaooMetadata':{'type':Sequelize[_0xcf61('0x18')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xcf61('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xcf61('0x18')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index cb252af..8c6e94e 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 _0xfe33=['waitForTheAssignedAgent','forcedOwnership','Start','EventManager','notify','offline','files','createdAt','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','ChatOfflineMessage','originalname','mimetype','server','attachments','offline-chat','basename','transaction','Attachment','MailAccount','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','openNewInteraction','MailAccountId','toPairsIn','mapValues','subjectOffline','Chat','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','getInteractions','Contact','Owner','fullname','internal','Tags','color','tag','findAll','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','inspect','Interval','Intervals','getProactiveActions','getLicense','License','chatLicenseExceeded','push','all','some','server/files/chat/iframe.ejs','remote','connection','remoteAddress','virtual','render','verticalAlignment','textColor','color_button','backgroundColor','sequelize','ChatApplication','bulkCreate','findAndCountAll','getApplications','chatProactiveAction','addProactiveActions','ChatProactiveAction','getFields','online','false','onlineForm','items','fromKey','Attachments','addAgents','omit','emit','removeAgents','userChatWebsite:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','sox','to-csv','ejs','fs-extra','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./chatWebsite.socket','jayson/promise','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','get','ChatWebsites','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','rows','show','params','keys','merge','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','Disposition','getDispositions','findOne','ChatWebsiteId','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addLogo','sitepic','file','addAvatar','agentAvatar','customerAvatar','filename','systemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','custom','isNil','existsSync','join','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','user-agent-parser','setUA','headers','getResult','chat','CmContact','ValidationError','no\x20available\x20attributes','difference','updatedAt','CompanyId','ListId','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','Contacts','DESC','account','applications','Applications','list','orderBy','priority','asc','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','referer','browser','version','format','%s\x20%s','unknown','device','vendor','stringify','threadId','externalUrl','ChatInteraction','ContactId','interaction','spread','lastName','messageId','created','autoclose','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','User','UserId','unshift'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xfe33,0x6e));var _0x3fe3=function(_0x1d32ac,_0x16f800){_0x1d32ac=_0x1d32ac-0x0;var _0x2e15e4=_0xfe33[_0x1d32ac];return _0x2e15e4;};'use strict';var emlformat=require(_0x3fe3('0x0'));var rimraf=require(_0x3fe3('0x1'));var zipdir=require(_0x3fe3('0x2'));var jsonpatch=require(_0x3fe3('0x3'));var rp=require(_0x3fe3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x3fe3('0x5'));var csv=require(_0x3fe3('0x6'));var ejs=require(_0x3fe3('0x7'));var fs=require('fs');var fs_extra=require(_0x3fe3('0x8'));var _=require('lodash');var squel=require(_0x3fe3('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3fe3('0xa'));var toCsv=require(_0x3fe3('0x6'));var querystring=require('querystring');var Papa=require(_0x3fe3('0xb'));var Redis=require('ioredis');var authService=require(_0x3fe3('0xc'));var qs=require(_0x3fe3('0xd'));var as=require(_0x3fe3('0xe'));var hardwareService=require(_0x3fe3('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0x3fe3('0x10'));var config=require(_0x3fe3('0x11'));var licenseUtil=require(_0x3fe3('0x12'));var db=require(_0x3fe3('0x13'))['db'];config['redis']=_[_0x3fe3('0x14')](config[_0x3fe3('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x3fe3('0x16'))(new Redis(config['redis']));require(_0x3fe3('0x17'))['register'](socket);var jayson=require(_0x3fe3('0x18'));var client=jayson[_0x3fe3('0x19')]['http']({'port':0x232c});var client9002=jayson[_0x3fe3('0x19')][_0x3fe3('0x1a')]({'port':0x232a});var client9003=jayson[_0x3fe3('0x19')][_0x3fe3('0x1a')]({'port':0x232b});var client9001=jayson['client'][_0x3fe3('0x1a')]({'port':0x2329});function respondWithRpcPromise(_0x32765f,_0x341524,_0x28478d,_0x5d5526){return new BPromise(function(_0x589f2a,_0xdc2fe3){var _0x36af23=_0x5d5526||client;return _0x36af23[_0x3fe3('0x1b')](_0x32765f,_0x28478d)[_0x3fe3('0x1c')](function(_0x57a784){logger[_0x3fe3('0x1d')](_0x3fe3('0x1e'),_0x341524,_0x3fe3('0x1f'));logger[_0x3fe3('0x20')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x341524,_0x3fe3('0x1f'),JSON['stringify'](_0x57a784));if(_0x57a784[_0x3fe3('0x21')]){if(_0x57a784['error'][_0x3fe3('0x22')]===0x1f4){logger[_0x3fe3('0x21')](_0x3fe3('0x1e'),_0x341524,_0x57a784['error']['message']);return _0xdc2fe3(_0x57a784[_0x3fe3('0x21')][_0x3fe3('0x23')]);}logger[_0x3fe3('0x21')](_0x3fe3('0x1e'),_0x341524,_0x57a784['error'][_0x3fe3('0x23')]);return _0x589f2a(_0x57a784[_0x3fe3('0x21')]['message']);}else{logger[_0x3fe3('0x1d')](_0x3fe3('0x1e'),_0x341524,'request\x20sent');_0x589f2a(_0x57a784[_0x3fe3('0x24')][_0x3fe3('0x23')]);}})[_0x3fe3('0x25')](function(_0x1c731d){logger[_0x3fe3('0x21')](_0x3fe3('0x1e'),_0x341524,_0x1c731d);_0xdc2fe3(_0x1c731d);});});}function respondWithStatusCode(_0x2b5e33,_0xf9a689){_0xf9a689=_0xf9a689||0xcc;return function(_0x9bf9ed){if(_0x9bf9ed){return _0x2b5e33[_0x3fe3('0x26')](_0xf9a689);}return _0x2b5e33[_0x3fe3('0x27')](_0xf9a689)[_0x3fe3('0x28')]();};}function respondWithResult(_0x4aef2e,_0x1e243c){_0x1e243c=_0x1e243c||0xc8;return function(_0x48e7f7){if(_0x48e7f7){return _0x4aef2e[_0x3fe3('0x27')](_0x1e243c)[_0x3fe3('0x29')](_0x48e7f7);}};}function respondWithFilteredResult(_0x3db9b3,_0x3ec7f5){return function(_0x59e27d){if(_0x59e27d){var _0x242701=typeof _0x3ec7f5[_0x3fe3('0x2a')]===_0x3fe3('0x2b')&&typeof _0x3ec7f5[_0x3fe3('0x2c')]===_0x3fe3('0x2b');var _0x54934a=_0x59e27d[_0x3fe3('0x2d')];var _0xa423bd=_0x242701?0x0:_0x3ec7f5[_0x3fe3('0x2a')];var _0xe68adb=_0x242701?_0x59e27d[_0x3fe3('0x2d')]:_0x3ec7f5['offset']+_0x3ec7f5[_0x3fe3('0x2c')];var _0xfea885;if(_0xe68adb>=_0x54934a){_0xe68adb=_0x54934a;_0xfea885=0xc8;}else{_0xfea885=0xce;}_0x3db9b3[_0x3fe3('0x27')](_0xfea885);return _0x3db9b3[_0x3fe3('0x2e')](_0x3fe3('0x2f'),_0xa423bd+'-'+_0xe68adb+'/'+_0x54934a)[_0x3fe3('0x29')](_0x59e27d);}return null;};}function patchUpdates(_0x13b9e3){return function(_0xf5da50){try{jsonpatch[_0x3fe3('0x30')](_0xf5da50,_0x13b9e3,!![]);}catch(_0x40dc5d){return BPromise['reject'](_0x40dc5d);}return _0xf5da50['save']();};}function saveUpdates(_0x45828c,_0x3f8f49){return function(_0x5e8b03){if(_0x5e8b03){return _0x5e8b03[_0x3fe3('0x31')](_0x45828c)[_0x3fe3('0x1c')](function(_0xe03238){return _0xe03238;});}return null;};}function removeEntity(_0x379a4b,_0x520ea9){return function(_0x58b018){if(_0x58b018){return _0x58b018[_0x3fe3('0x32')]()[_0x3fe3('0x1c')](function(){var _0xb46c34=_0x58b018[_0x3fe3('0x33')]({'plain':!![]});var _0xcafc68=_0x3fe3('0x34');return db[_0x3fe3('0x35')][_0x3fe3('0x32')]({'where':{'type':_0xcafc68,'resourceId':_0xb46c34['id']}})[_0x3fe3('0x1c')](function(){return _0x58b018;});})['then'](function(){_0x379a4b[_0x3fe3('0x27')](0xcc)[_0x3fe3('0x28')]();});}};}function handleEntityNotFound(_0x3e2f64,_0x4f9f85){return function(_0x302f18){if(!_0x302f18){_0x3e2f64['sendStatus'](0x194);}return _0x302f18;};}function handleError(_0x2e2738,_0x4b3f30){_0x4b3f30=_0x4b3f30||0x1f4;return function(_0x4c05ca){logger['error'](_0x4c05ca[_0x3fe3('0x36')]);if(_0x4c05ca[_0x3fe3('0x37')]){delete _0x4c05ca['name'];}_0x2e2738[_0x3fe3('0x27')](_0x4b3f30)[_0x3fe3('0x38')](_0x4c05ca);};}exports[_0x3fe3('0x39')]=function(_0x4946b3,_0x1fbb55){var _0x242037={'include':[{'model':db[_0x3fe3('0x3a')],'as':_0x3fe3('0x3b')}]},_0x3f15af={},_0xb447d3={'count':0x0,'rows':[]};var _0x5a4593=_['map'](db[_0x3fe3('0x3c')][_0x3fe3('0x3d')],function(_0x3e6f7d){return{'name':_0x3e6f7d[_0x3fe3('0x3e')],'type':_0x3e6f7d[_0x3fe3('0x3f')][_0x3fe3('0x40')]};});_0x3f15af[_0x3fe3('0x41')]=_[_0x3fe3('0x42')](_0x5a4593,_0x3fe3('0x37'));_0x3f15af[_0x3fe3('0x43')]=_['keys'](_0x4946b3[_0x3fe3('0x43')]);_0x3f15af[_0x3fe3('0x44')]=_['intersection'](_0x3f15af['model'],_0x3f15af[_0x3fe3('0x43')]);_0x242037['attributes']=_[_0x3fe3('0x45')](_0x3f15af['model'],qs[_0x3fe3('0x46')](_0x4946b3['query'][_0x3fe3('0x46')]));_0x242037['attributes']=_0x242037[_0x3fe3('0x47')][_0x3fe3('0x48')]?_0x242037['attributes']:_0x3f15af['model'];if(!_0x4946b3[_0x3fe3('0x43')][_0x3fe3('0x49')](_0x3fe3('0x4a'))){_0x242037[_0x3fe3('0x2c')]=qs['limit'](_0x4946b3['query'][_0x3fe3('0x2c')]);_0x242037['offset']=qs[_0x3fe3('0x2a')](_0x4946b3[_0x3fe3('0x43')][_0x3fe3('0x2a')]);}_0x242037[_0x3fe3('0x4b')]=qs['sort'](_0x4946b3[_0x3fe3('0x43')][_0x3fe3('0x4c')]);_0x242037[_0x3fe3('0x4d')]=qs['filters'](_[_0x3fe3('0x4e')](_0x4946b3[_0x3fe3('0x43')],_0x3f15af[_0x3fe3('0x44')]),_0x5a4593);if(_0x4946b3['query'][_0x3fe3('0x4f')]){_0x242037[_0x3fe3('0x4d')]=_['merge'](_0x242037[_0x3fe3('0x4d')],{'$or':_[_0x3fe3('0x42')](_0x5a4593,function(_0x45d719){if(_0x45d719[_0x3fe3('0x3f')]!==_0x3fe3('0x50')){var _0xc960f6={};_0xc960f6[_0x45d719[_0x3fe3('0x37')]]={'$like':'%'+_0x4946b3[_0x3fe3('0x43')]['filter']+'%'};return _0xc960f6;}})});}_0x242037=_['merge']({},_0x242037,_0x4946b3[_0x3fe3('0x51')]);var _0x38443d={'where':_0x242037['where']};return db[_0x3fe3('0x3c')][_0x3fe3('0x2d')](_0x38443d)[_0x3fe3('0x1c')](function(_0x1130d7){_0xb447d3['count']=_0x1130d7;if(_0x4946b3[_0x3fe3('0x43')][_0x3fe3('0x52')]){_0x242037[_0x3fe3('0x53')]=[{'all':!![]}];}return db[_0x3fe3('0x3c')]['findAll'](_0x242037);})[_0x3fe3('0x1c')](function(_0x57d9e6){_0xb447d3[_0x3fe3('0x54')]=_0x57d9e6;return _0xb447d3;})[_0x3fe3('0x1c')](respondWithFilteredResult(_0x1fbb55,_0x242037))[_0x3fe3('0x25')](handleError(_0x1fbb55,null));};exports[_0x3fe3('0x55')]=function(_0xe70851,_0x16937a){var _0x2c990f={'raw':![],'where':{'id':_0xe70851[_0x3fe3('0x56')]['id']},'include':[{'model':db[_0x3fe3('0x3a')],'as':'mandatoryDispositionPause'}]},_0x58ff4b={};_0x58ff4b[_0x3fe3('0x41')]=_['keys'](db[_0x3fe3('0x3c')]['rawAttributes']);_0x58ff4b[_0x3fe3('0x43')]=_[_0x3fe3('0x57')](_0xe70851[_0x3fe3('0x43')]);_0x58ff4b[_0x3fe3('0x44')]=_[_0x3fe3('0x45')](_0x58ff4b[_0x3fe3('0x41')],_0x58ff4b[_0x3fe3('0x43')]);_0x2c990f['attributes']=_[_0x3fe3('0x45')](_0x58ff4b[_0x3fe3('0x41')],qs['fields'](_0xe70851[_0x3fe3('0x43')]['fields']));_0x2c990f[_0x3fe3('0x47')]=_0x2c990f['attributes'][_0x3fe3('0x48')]?_0x2c990f[_0x3fe3('0x47')]:_0x58ff4b['model'];if(_0xe70851[_0x3fe3('0x43')][_0x3fe3('0x52')]){_0x2c990f[_0x3fe3('0x53')]=[{'all':!![]}];}_0x2c990f=_[_0x3fe3('0x58')]({},_0x2c990f,_0xe70851[_0x3fe3('0x51')]);return db[_0x3fe3('0x3c')][_0x3fe3('0x59')](_0x2c990f)[_0x3fe3('0x1c')](handleEntityNotFound(_0x16937a,null))[_0x3fe3('0x1c')](respondWithResult(_0x16937a,null))[_0x3fe3('0x25')](handleError(_0x16937a,null));};exports[_0x3fe3('0x5a')]=function(_0x5724e8,_0xba56e){return db[_0x3fe3('0x3c')][_0x3fe3('0x5a')](_0x5724e8['body'],{})[_0x3fe3('0x1c')](function(_0x421ffb){var _0x33b1e4=_0x5724e8[_0x3fe3('0x5b')][_0x3fe3('0x33')]({'plain':!![]});if(!_0x33b1e4)throw new Error(_0x3fe3('0x5c'));if(_0x33b1e4['role']===_0x3fe3('0x5b')){var _0x285c8b=_0x421ffb['get']({'plain':!![]});var _0x508b57='ChatWebsites';return db[_0x3fe3('0x5d')]['find']({'where':{'name':_0x508b57,'userProfileId':_0x33b1e4[_0x3fe3('0x5e')]},'raw':!![]})['then'](function(_0x1cdcad){if(_0x1cdcad&&_0x1cdcad[_0x3fe3('0x5f')]===0x0){return db[_0x3fe3('0x35')][_0x3fe3('0x5a')]({'name':_0x285c8b[_0x3fe3('0x37')],'resourceId':_0x285c8b['id'],'type':_0x1cdcad[_0x3fe3('0x37')],'sectionId':_0x1cdcad['id']},{})[_0x3fe3('0x1c')](function(){return _0x421ffb;});}else{return _0x421ffb;}})['catch'](function(_0x56e3b9){logger[_0x3fe3('0x21')](_0x3fe3('0x60'),_0x56e3b9);throw _0x56e3b9;});}return _0x421ffb;})[_0x3fe3('0x1c')](respondWithResult(_0xba56e,0xc9))[_0x3fe3('0x25')](handleError(_0xba56e,null));};exports['update']=function(_0x22ab38,_0x496a77){if(_0x22ab38['body']['id']){delete _0x22ab38[_0x3fe3('0x61')]['id'];}return db[_0x3fe3('0x3c')][_0x3fe3('0x59')]({'where':{'id':_0x22ab38[_0x3fe3('0x56')]['id']},'include':[{'model':db[_0x3fe3('0x3a')],'as':_0x3fe3('0x3b')}]})[_0x3fe3('0x1c')](handleEntityNotFound(_0x496a77,null))[_0x3fe3('0x1c')](saveUpdates(_0x22ab38[_0x3fe3('0x61')],null))[_0x3fe3('0x1c')](respondWithResult(_0x496a77,null))[_0x3fe3('0x25')](handleError(_0x496a77,null));};exports[_0x3fe3('0x32')]=function(_0x4ff239,_0x2b1fa0){return db[_0x3fe3('0x3c')][_0x3fe3('0x59')]({'where':{'id':_0x4ff239[_0x3fe3('0x56')]['id']}})['then'](handleEntityNotFound(_0x2b1fa0,null))['then'](removeEntity(_0x2b1fa0,null))[_0x3fe3('0x25')](handleError(_0x2b1fa0,null));};exports[_0x3fe3('0x62')]=function(_0x3007e6,_0x39a557){return db[_0x3fe3('0x3c')]['describe']()[_0x3fe3('0x1c')](respondWithResult(_0x39a557,null))[_0x3fe3('0x25')](handleError(_0x39a557,null));};exports[_0x3fe3('0x63')]=function(_0x469d06,_0x229132,_0x5f3e18){if(_0x469d06['body']['id']){delete _0x469d06[_0x3fe3('0x61')]['id'];}return db[_0x3fe3('0x3c')]['find']({'where':{'id':_0x469d06['params']['id']}})[_0x3fe3('0x1c')](handleEntityNotFound(_0x229132,null))[_0x3fe3('0x1c')](function(_0x11bbdd){if(_0x11bbdd){_0x469d06[_0x3fe3('0x61')]['ChatWebsiteId']=_0x11bbdd['id'];return db[_0x3fe3('0x64')][_0x3fe3('0x5a')](_0x469d06[_0x3fe3('0x61')]);}})[_0x3fe3('0x1c')](respondWithResult(_0x229132,null))[_0x3fe3('0x25')](handleError(_0x229132,null));};exports[_0x3fe3('0x65')]=function(_0x35ecc7,_0x58b242,_0x695b26){var _0x44d88f={'raw':![],'where':{}};var _0x27646a={};var _0x22785d={'count':0x0,'rows':[]};return db[_0x3fe3('0x3c')][_0x3fe3('0x66')]({'where':{'id':_0x35ecc7['params']['id']}})[_0x3fe3('0x1c')](handleEntityNotFound(_0x58b242,null))['then'](function(_0x5d8e6b){if(_0x5d8e6b){_0x27646a[_0x3fe3('0x41')]=_['keys'](db[_0x3fe3('0x64')][_0x3fe3('0x3d')]);_0x27646a[_0x3fe3('0x43')]=_[_0x3fe3('0x57')](_0x35ecc7[_0x3fe3('0x43')]);_0x27646a[_0x3fe3('0x44')]=_[_0x3fe3('0x45')](_0x27646a[_0x3fe3('0x41')],_0x27646a[_0x3fe3('0x43')]);_0x44d88f[_0x3fe3('0x47')]=_[_0x3fe3('0x45')](_0x27646a[_0x3fe3('0x41')],qs[_0x3fe3('0x46')](_0x35ecc7['query']['fields']));_0x44d88f[_0x3fe3('0x47')]=_0x44d88f[_0x3fe3('0x47')][_0x3fe3('0x48')]?_0x44d88f[_0x3fe3('0x47')]:_0x27646a[_0x3fe3('0x41')];if(!_0x35ecc7[_0x3fe3('0x43')][_0x3fe3('0x49')](_0x3fe3('0x4a'))){_0x44d88f[_0x3fe3('0x2c')]=qs['limit'](_0x35ecc7[_0x3fe3('0x43')][_0x3fe3('0x2c')]);_0x44d88f[_0x3fe3('0x2a')]=qs[_0x3fe3('0x2a')](_0x35ecc7[_0x3fe3('0x43')][_0x3fe3('0x2a')]);}_0x44d88f[_0x3fe3('0x4b')]=qs[_0x3fe3('0x4c')](_0x35ecc7['query'][_0x3fe3('0x4c')]);_0x44d88f[_0x3fe3('0x4d')]=qs[_0x3fe3('0x44')](_[_0x3fe3('0x4e')](_0x35ecc7[_0x3fe3('0x43')],_0x27646a['filters']));_0x44d88f['where'][_0x3fe3('0x67')]=_0x5d8e6b['id'];if(_0x35ecc7['query']['filter']){_0x44d88f[_0x3fe3('0x4d')]=_[_0x3fe3('0x58')](_0x44d88f[_0x3fe3('0x4d')],{'$or':_[_0x3fe3('0x42')](_0x44d88f[_0x3fe3('0x47')],function(_0x1ae1a5){var _0x4b917e={};_0x4b917e[_0x1ae1a5]={'$like':'%'+_0x35ecc7[_0x3fe3('0x43')][_0x3fe3('0x4f')]+'%'};return _0x4b917e;})});}_0x44d88f=_['merge']({},_0x44d88f,_0x35ecc7[_0x3fe3('0x51')]);return db['Disposition'][_0x3fe3('0x2d')]({'where':_0x44d88f[_0x3fe3('0x4d')]})[_0x3fe3('0x1c')](function(_0x3ceb8b){_0x22785d[_0x3fe3('0x2d')]=_0x3ceb8b;if(_0x35ecc7[_0x3fe3('0x43')][_0x3fe3('0x52')]){_0x44d88f['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x44d88f);})[_0x3fe3('0x1c')](function(_0x3f77bb){_0x22785d['rows']=_0x3f77bb;return _0x22785d;});}})[_0x3fe3('0x1c')](respondWithFilteredResult(_0x58b242,_0x44d88f))[_0x3fe3('0x25')](handleError(_0x58b242,null));};exports[_0x3fe3('0x68')]=function(_0x57643f,_0x29b240,_0x1c11c7){return db[_0x3fe3('0x3c')][_0x3fe3('0x59')]({'where':{'id':_0x57643f['params']['id']}})[_0x3fe3('0x1c')](handleEntityNotFound(_0x29b240,null))[_0x3fe3('0x1c')](function(_0x122247){if(_0x122247){return _0x122247[_0x3fe3('0x68')](_0x57643f['query'][_0x3fe3('0x69')]);}})[_0x3fe3('0x1c')](respondWithStatusCode(_0x29b240,null))['catch'](handleError(_0x29b240,null));};exports[_0x3fe3('0x6a')]=function(_0xabb2fc,_0x16a922,_0x15c379){if(_0xabb2fc['body']['id']){delete _0xabb2fc[_0x3fe3('0x61')]['id'];}return db[_0x3fe3('0x3c')][_0x3fe3('0x59')]({'where':{'id':_0xabb2fc['params']['id']}})['then'](handleEntityNotFound(_0x16a922,null))[_0x3fe3('0x1c')](function(_0x4f1c8d){if(_0x4f1c8d){_0xabb2fc[_0x3fe3('0x61')][_0x3fe3('0x67')]=_0x4f1c8d['id'];return db['CannedAnswer'][_0x3fe3('0x5a')](_0xabb2fc[_0x3fe3('0x61')]);}})[_0x3fe3('0x1c')](respondWithResult(_0x16a922,null))['catch'](handleError(_0x16a922,null));};exports[_0x3fe3('0x6b')]=function(_0xf0bca4,_0x1e4df7,_0x53c7ca){var _0x865f4b={'raw':![],'where':{}};var _0x111b45={};var _0x3f0cf2={'count':0x0,'rows':[]};return db[_0x3fe3('0x3c')][_0x3fe3('0x66')]({'where':{'id':_0xf0bca4[_0x3fe3('0x56')]['id']}})[_0x3fe3('0x1c')](handleEntityNotFound(_0x1e4df7,null))[_0x3fe3('0x1c')](function(_0x103c3f){if(_0x103c3f){_0x111b45[_0x3fe3('0x41')]=_[_0x3fe3('0x57')](db[_0x3fe3('0x6c')][_0x3fe3('0x3d')]);_0x111b45[_0x3fe3('0x43')]=_[_0x3fe3('0x57')](_0xf0bca4['query']);_0x111b45['filters']=_[_0x3fe3('0x45')](_0x111b45['model'],_0x111b45[_0x3fe3('0x43')]);_0x865f4b['attributes']=_[_0x3fe3('0x45')](_0x111b45[_0x3fe3('0x41')],qs[_0x3fe3('0x46')](_0xf0bca4[_0x3fe3('0x43')][_0x3fe3('0x46')]));_0x865f4b[_0x3fe3('0x47')]=_0x865f4b[_0x3fe3('0x47')][_0x3fe3('0x48')]?_0x865f4b[_0x3fe3('0x47')]:_0x111b45[_0x3fe3('0x41')];if(!_0xf0bca4['query'][_0x3fe3('0x49')](_0x3fe3('0x4a'))){_0x865f4b[_0x3fe3('0x2c')]=qs[_0x3fe3('0x2c')](_0xf0bca4['query'][_0x3fe3('0x2c')]);_0x865f4b['offset']=qs[_0x3fe3('0x2a')](_0xf0bca4[_0x3fe3('0x43')][_0x3fe3('0x2a')]);}_0x865f4b[_0x3fe3('0x4b')]=qs['sort'](_0xf0bca4[_0x3fe3('0x43')][_0x3fe3('0x4c')]);_0x865f4b['where']=qs[_0x3fe3('0x44')](_['pick'](_0xf0bca4[_0x3fe3('0x43')],_0x111b45['filters']));_0x865f4b['where'][_0x3fe3('0x67')]=_0x103c3f['id'];if(_0xf0bca4[_0x3fe3('0x43')][_0x3fe3('0x4f')]){_0x865f4b[_0x3fe3('0x4d')]=_['merge'](_0x865f4b[_0x3fe3('0x4d')],{'$or':_[_0x3fe3('0x42')](_0x865f4b[_0x3fe3('0x47')],function(_0x3b5d8d){var _0x3ec497={};_0x3ec497[_0x3b5d8d]={'$like':'%'+_0xf0bca4['query'][_0x3fe3('0x4f')]+'%'};return _0x3ec497;})});}_0x865f4b=_[_0x3fe3('0x58')]({},_0x865f4b,_0xf0bca4['options']);return db[_0x3fe3('0x6c')][_0x3fe3('0x2d')]({'where':_0x865f4b[_0x3fe3('0x4d')]})[_0x3fe3('0x1c')](function(_0x4a438e){_0x3f0cf2[_0x3fe3('0x2d')]=_0x4a438e;if(_0xf0bca4['query']['includeAll']){_0x865f4b[_0x3fe3('0x53')]=[{'all':!![]}];}return db[_0x3fe3('0x6c')]['findAll'](_0x865f4b);})[_0x3fe3('0x1c')](function(_0x365ec9){_0x3f0cf2[_0x3fe3('0x54')]=_0x365ec9;return _0x3f0cf2;});}})['then'](respondWithFilteredResult(_0x1e4df7,_0x865f4b))[_0x3fe3('0x25')](handleError(_0x1e4df7,null));};exports[_0x3fe3('0x6d')]=function(_0x4b61ea,_0x4c3f4f,_0x6a99eb){return db['ChatWebsite'][_0x3fe3('0x59')]({'where':{'id':_0x4b61ea['params']['id']}})[_0x3fe3('0x1c')](handleEntityNotFound(_0x4c3f4f,null))[_0x3fe3('0x1c')](function(_0x378fea){if(_0x378fea){return _0x378fea['removeAnswers'](_0x4b61ea[_0x3fe3('0x43')][_0x3fe3('0x69')]);}})[_0x3fe3('0x1c')](respondWithStatusCode(_0x4c3f4f,null))[_0x3fe3('0x25')](handleError(_0x4c3f4f,null));};exports[_0x3fe3('0x6e')]=function(_0x5d8e3b,_0x3448e6,_0x4bb9d3){_0x5d8e3b['body'][_0x3fe3('0x6f')]=_0x5d8e3b[_0x3fe3('0x70')]['filename'];return db[_0x3fe3('0x3c')]['find']({'where':{'id':_0x5d8e3b[_0x3fe3('0x56')]['id']}})['then'](handleEntityNotFound(_0x3448e6,null))[_0x3fe3('0x1c')](saveUpdates(_0x5d8e3b[_0x3fe3('0x61')],null))[_0x3fe3('0x1c')](respondWithResult(_0x3448e6,null))['catch'](handleError(_0x3448e6,null));};exports[_0x3fe3('0x71')]=function(_0x28bcb8,_0x33a892,_0x321a32){_0x28bcb8[_0x3fe3('0x61')][_0x3fe3('0x72')]=_0x28bcb8[_0x3fe3('0x70')]['filename'];return db[_0x3fe3('0x3c')]['find']({'where':{'id':_0x28bcb8[_0x3fe3('0x56')]['id']}})['then'](handleEntityNotFound(_0x33a892,null))[_0x3fe3('0x1c')](saveUpdates(_0x28bcb8[_0x3fe3('0x61')],null))[_0x3fe3('0x1c')](respondWithResult(_0x33a892,null))[_0x3fe3('0x25')](handleError(_0x33a892,null));};exports['addCustomerAvatar']=function(_0x1845dd,_0x15408b,_0x219cb9){_0x1845dd[_0x3fe3('0x61')][_0x3fe3('0x73')]=_0x1845dd['file'][_0x3fe3('0x74')];return db['ChatWebsite'][_0x3fe3('0x59')]({'where':{'id':_0x1845dd[_0x3fe3('0x56')]['id']}})[_0x3fe3('0x1c')](handleEntityNotFound(_0x15408b,null))['then'](saveUpdates(_0x1845dd[_0x3fe3('0x61')],null))[_0x3fe3('0x1c')](respondWithResult(_0x15408b,null))['catch'](handleError(_0x15408b,null));};exports['addSystemAvatar']=function(_0x57ac0f,_0x4eb740,_0x56f0ae){_0x57ac0f[_0x3fe3('0x61')][_0x3fe3('0x75')]=_0x57ac0f['file'][_0x3fe3('0x74')];return db['ChatWebsite']['find']({'where':{'id':_0x57ac0f[_0x3fe3('0x56')]['id']}})['then'](handleEntityNotFound(_0x4eb740,null))[_0x3fe3('0x1c')](saveUpdates(_0x57ac0f[_0x3fe3('0x61')],null))[_0x3fe3('0x1c')](respondWithResult(_0x4eb740,null))[_0x3fe3('0x25')](handleError(_0x4eb740,null));};exports[_0x3fe3('0x76')]=function(_0x6245cd,_0x44c754,_0x2a2cca){var _0x8eae21=path['join'](config[_0x3fe3('0x77')],_0x3fe3('0x78'));var _0x250101={'where':{'id':_0x6245cd[_0x3fe3('0x56')]['id']},'attributes':['id',_0x3fe3('0x6f')],'raw':!![]};var _0x4c59c5=![];return require(_0x3fe3('0x12'))['getLicense']()['then'](function(_0x573578){if(_0x573578){_0x4c59c5=_0x573578[_0x3fe3('0x79')];}})[_0x3fe3('0x1c')](function(){return db[_0x3fe3('0x3c')][_0x3fe3('0x59')](_0x250101);})[_0x3fe3('0x1c')](handleEntityNotFound(_0x44c754,null))[_0x3fe3('0x1c')](function(_0x5e590b){if(_0x5e590b){if(!_[_0x3fe3('0x7a')](_0x5e590b['sitepic'])){if(fs[_0x3fe3('0x7b')](path[_0x3fe3('0x7c')](config[_0x3fe3('0x77')],_0x3fe3('0x7d'),_0x5e590b[_0x3fe3('0x6f')]))&&_0x4c59c5){_0x8eae21=path[_0x3fe3('0x7c')](config[_0x3fe3('0x77')],_0x3fe3('0x7d'),_0x5e590b[_0x3fe3('0x6f')]);}}return _0x44c754[_0x3fe3('0x7e')](_0x8eae21);}})[_0x3fe3('0x25')](handleError(_0x44c754,null));};exports['getAvatar']=function(_0x203f60,_0x5581d7,_0x6284f9){var _0x3c71d5=path['join'](config['root'],_0x3fe3('0x7f'));var _0x2b86e8={'where':{'id':_0x203f60[_0x3fe3('0x56')]['id']},'attributes':['id',_0x3fe3('0x72')],'raw':!![]};return db[_0x3fe3('0x3c')][_0x3fe3('0x59')](_0x2b86e8)[_0x3fe3('0x1c')](handleEntityNotFound(_0x5581d7,null))[_0x3fe3('0x1c')](function(_0x19f25e){if(_0x19f25e){if(!_['isNil'](_0x19f25e['agentAvatar'])){if(fs[_0x3fe3('0x7b')](path[_0x3fe3('0x7c')](config[_0x3fe3('0x77')],_0x3fe3('0x80'),_0x19f25e['agentAvatar']))){_0x3c71d5=path[_0x3fe3('0x7c')](config[_0x3fe3('0x77')],_0x3fe3('0x80'),_0x19f25e[_0x3fe3('0x72')]);}}return _0x5581d7[_0x3fe3('0x7e')](_0x3c71d5);}})[_0x3fe3('0x25')](handleError(_0x5581d7,null));};exports[_0x3fe3('0x81')]=function(_0x46bb9d,_0x15b981,_0x27803d){var _0x3bf029=path[_0x3fe3('0x7c')](config[_0x3fe3('0x77')],_0x3fe3('0x82'));var _0x1a0a6d={'where':{'id':_0x46bb9d[_0x3fe3('0x56')]['id']},'attributes':['id',_0x3fe3('0x73'),'showCustomerAvatar'],'raw':!![]};return db[_0x3fe3('0x3c')][_0x3fe3('0x59')](_0x1a0a6d)[_0x3fe3('0x1c')](handleEntityNotFound(_0x15b981,null))[_0x3fe3('0x1c')](function(_0x35d384){if(_0x35d384){if(!_[_0x3fe3('0x7a')](_0x35d384[_0x3fe3('0x73')])){if(fs[_0x3fe3('0x7b')](path[_0x3fe3('0x7c')](config['root'],_0x3fe3('0x80'),_0x35d384['customerAvatar']))&&_0x35d384[_0x3fe3('0x83')]){_0x3bf029=path['join'](config[_0x3fe3('0x77')],'server/files/images/avatars/',_0x35d384[_0x3fe3('0x73')]);}}return _0x15b981[_0x3fe3('0x7e')](_0x3bf029);}})[_0x3fe3('0x25')](handleError(_0x15b981,null));};exports[_0x3fe3('0x84')]=function(_0x2b8eb8,_0x2bf28f,_0x24f160){var _0x512d61=path[_0x3fe3('0x7c')](config[_0x3fe3('0x77')],_0x3fe3('0x85'));var _0x53c285={'where':{'id':_0x2b8eb8[_0x3fe3('0x56')]['id']},'attributes':['id',_0x3fe3('0x75')],'raw':!![]};return db[_0x3fe3('0x3c')][_0x3fe3('0x59')](_0x53c285)[_0x3fe3('0x1c')](handleEntityNotFound(_0x2bf28f,null))[_0x3fe3('0x1c')](function(_0x1c81cf){if(_0x1c81cf){if(!_[_0x3fe3('0x7a')](_0x1c81cf['systemAvatar'])){if(fs[_0x3fe3('0x7b')](path['join'](config[_0x3fe3('0x77')],_0x3fe3('0x80'),_0x1c81cf[_0x3fe3('0x75')]))){_0x512d61=path[_0x3fe3('0x7c')](config[_0x3fe3('0x77')],_0x3fe3('0x80'),_0x1c81cf[_0x3fe3('0x75')]);}}return _0x2bf28f['download'](_0x512d61);}})[_0x3fe3('0x25')](handleError(_0x2bf28f,null));};exports['notify']=function(_0x50743b,_0x217f32,_0x2026c4){var _0x17d825=require(_0x3fe3('0x86'));var _0x50500d=new _0x17d825();var _0x344c85=_0x50500d[_0x3fe3('0x87')](_0x50743b[_0x3fe3('0x88')]['user-agent'])[_0x3fe3('0x89')]();var _0x4dfd69={'body':_0x50743b['body'],'channel':_0x3fe3('0x8a')};var _0x4c2c21=[];var _0x4daecd=[];var _0x411d13={};var _0x1e9122=![];return db[_0x3fe3('0x8b')][_0x3fe3('0x62')]()['then'](function(_0xa4fcfd){if(!_0xa4fcfd){throw new db['Sequelize'][(_0x3fe3('0x8c'))](_0x3fe3('0x8d'));}_0x4c2c21=_[_0x3fe3('0x8e')](_[_0x3fe3('0x57')](_0xa4fcfd),['createdAt',_0x3fe3('0x8f')]);_0x4daecd=_['difference'](_[_0x3fe3('0x57')](_0xa4fcfd),['createdAt',_0x3fe3('0x8f'),_0x3fe3('0x90'),_0x3fe3('0x91')]);if(_0x50743b['body']['id']){delete _0x50743b[_0x3fe3('0x61')]['id'];}if(_[_0x3fe3('0x7a')](_0x50743b[_0x3fe3('0x61')]['from'])){throw new db[(_0x3fe3('0x92'))][(_0x3fe3('0x8c'))](_0x3fe3('0x93'));}if(_[_0x3fe3('0x7a')](_0x50743b[_0x3fe3('0x61')]['body'])||_0x50743b['body'][_0x3fe3('0x61')]===''){throw new db['Sequelize'][(_0x3fe3('0x8c'))](_0x3fe3('0x94'));}if(_['isNil'](_0x50743b[_0x3fe3('0x61')][_0x3fe3('0x95')])){throw new db[(_0x3fe3('0x92'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4daecd);}if(!_['includes'](_0x4daecd,_0x50743b[_0x3fe3('0x61')][_0x3fe3('0x95')])){throw new db[(_0x3fe3('0x92'))]['ValidationError'](_0x3fe3('0x96')+_0x4daecd);}_0x411d13[_0x50743b[_0x3fe3('0x61')][_0x3fe3('0x95')]]=_0x50743b['body'][_0x3fe3('0x97')];})[_0x3fe3('0x1c')](function(){return db['ChatWebsite'][_0x3fe3('0x59')]({'where':{'id':_0x50743b[_0x3fe3('0x56')]['id']},'include':[{'model':db[_0x3fe3('0x98')],'as':_0x3fe3('0x99'),'include':[{'model':db[_0x3fe3('0x8b')],'as':_0x3fe3('0x9a'),'where':_0x411d13,'limit':0x1,'order':[[_0x3fe3('0x8f'),_0x3fe3('0x9b')]]}]},{'model':db['ChatApplication'],'as':'Applications'}]});})[_0x3fe3('0x1c')](handleEntityNotFound(_0x217f32,null))[_0x3fe3('0x1c')](function(_0x59b703){if(_0x59b703&&_0x59b703[_0x3fe3('0x99')]){_0x4dfd69[_0x3fe3('0x9c')]=_0x59b703;_0x4dfd69[_0x3fe3('0x9d')]=_0x59b703[_0x3fe3('0x9e')];_0x4dfd69[_0x3fe3('0x9f')]=_0x59b703[_0x3fe3('0x99')];_0x4dfd69[_0x3fe3('0x9d')]=_[_0x3fe3('0xa0')](_0x4dfd69[_0x3fe3('0x9d')],[_0x3fe3('0xa1')],[_0x3fe3('0xa2')]);if(_0x4dfd69[_0x3fe3('0x9c')]['Applications']){delete _0x4dfd69['account'][_0x3fe3('0x9e')];}if(_0x4dfd69['account'][_0x3fe3('0x99')]&&_0x4dfd69[_0x3fe3('0x9c')][_0x3fe3('0x99')][_0x3fe3('0x9a')][_0x3fe3('0x48')]){return _0x4dfd69['account']['List'][_0x3fe3('0x9a')][0x0];}var _0xb252ec=_['defaults'](_0x50743b['body'],{'firstName':_0x50743b[_0x3fe3('0x61')][_0x3fe3('0x97')],'ListId':_0x59b703[_0x3fe3('0x91')]});_0xb252ec[_0x50743b['body']['mapKey']]=_0x50743b[_0x3fe3('0x61')][_0x3fe3('0x97')];return db['CmContact'][_0x3fe3('0x5a')](_0xb252ec,{'fields':_0x4c2c21,'raw':!![]});}})[_0x3fe3('0x1c')](handleEntityNotFound(_0x217f32,null))[_0x3fe3('0x1c')](function(_0xd17ec2){_0x4dfd69[_0x3fe3('0xa3')]=_0xd17ec2;var _0x1f9b5c=_0x50743b[_0x3fe3('0x61')][_0x3fe3('0xa4')];if(_0x50743b[_0x3fe3('0x88')][_0x3fe3('0xa5')]){_0x1f9b5c=_0x50743b[_0x3fe3('0x88')]['cf-connecting-ip'];}else if(_0x50743b['headers'][_0x3fe3('0xa6')]){_0x1f9b5c=_[_0x3fe3('0xa7')](_0x50743b[_0x3fe3('0x88')][_0x3fe3('0xa6')][_0x3fe3('0xa8')](','));}if(_0xd17ec2){var _0x1c9f96={'ContactId':_0xd17ec2['id'],'ChatWebsiteId':_0x50743b[_0x3fe3('0x56')]['id'],'from':(_0xd17ec2[_0x3fe3('0xa9')]||'')+'\x20'+(_0xd17ec2['lastName']||''),'customerIp':_0x1f9b5c,'customerPort':_0x50743b[_0x3fe3('0x88')]['x-real-port']?_0x50743b['headers']['x-real-port']:null,'referer':_0x50743b[_0x3fe3('0x61')][_0x3fe3('0xaa')],'browserName':_0x344c85[_0x3fe3('0xab')][_0x3fe3('0x37')]&&_0x344c85[_0x3fe3('0xab')][_0x3fe3('0xac')]?util[_0x3fe3('0xad')](_0x3fe3('0xae'),_0x344c85[_0x3fe3('0xab')][_0x3fe3('0x37')],_0x344c85[_0x3fe3('0xab')][_0x3fe3('0xac')]):_0x3fe3('0xaf'),'browserVersion':_0x344c85[_0x3fe3('0xab')][_0x3fe3('0xac')]||_0x3fe3('0xaf'),'osName':util['format']('%s\x20%s',_0x344c85['os'][_0x3fe3('0x37')],_0x344c85['os'][_0x3fe3('0xac')]),'osVersion':_0x344c85['os'][_0x3fe3('0xac')],'deviceModel':_0x344c85[_0x3fe3('0xb0')][_0x3fe3('0x41')]&&_0x344c85[_0x3fe3('0xb0')]['vendor']?util[_0x3fe3('0xad')]('%s\x20%s\x20%s',_0x344c85[_0x3fe3('0xb0')][_0x3fe3('0x41')],_0x344c85[_0x3fe3('0xb0')]['vendor'],_0x344c85[_0x3fe3('0xb0')][_0x3fe3('0x3f')]):null,'deviceVendor':_0x344c85['device'][_0x3fe3('0xb1')],'deviceType':_0x344c85[_0x3fe3('0xb0')][_0x3fe3('0x3f')],'formData':JSON[_0x3fe3('0xb2')](_0x50743b[_0x3fe3('0x61')])};var _0x511746={'ChatWebsiteId':_0x50743b[_0x3fe3('0x56')]['id'],'closed':![]};if(_0x50743b['body'][_0x3fe3('0xb3')]){_0x511746['threadId']=_0x50743b['body']['threadId'];return db['ChatInteraction'][_0x3fe3('0x59')]({'where':_0x511746})[_0x3fe3('0x1c')](function(_0xd158f1){if(_0xd158f1){return[_0xd158f1,![]];}_0x1c9f96[_0x3fe3('0xb3')]=_0x50743b[_0x3fe3('0x61')][_0x3fe3('0xb3')];_0x1c9f96[_0x3fe3('0xb4')]=_0x50743b[_0x3fe3('0x61')][_0x3fe3('0xb4')];return db[_0x3fe3('0xb5')]['create'](_0x1c9f96)[_0x3fe3('0x1c')](function(_0x138561){return[_0x138561,!![]];});});}_0x511746[_0x3fe3('0xb6')]=_0xd17ec2['id'];if(_0x50743b[_0x3fe3('0x61')][_0x3fe3('0xb7')]&&_0x50743b[_0x3fe3('0x61')]['interaction']['id']){_0x511746['id']=_0x50743b[_0x3fe3('0x61')][_0x3fe3('0xb7')]['id'];return db['ChatInteraction'][_0x3fe3('0x59')]({'where':_0x511746})['then'](function(_0x4b8ca1){if(_0x4b8ca1){return[_0x4b8ca1,![]];}return db['ChatInteraction'][_0x3fe3('0x5a')](_0x1c9f96)[_0x3fe3('0x1c')](function(_0x562264){return[_0x562264,!![]];});});}return db[_0x3fe3('0xb5')][_0x3fe3('0x5a')](_0x1c9f96)['then'](function(_0x305b67){return[_0x305b67,!![]];});}})[_0x3fe3('0xb8')](function(_0x2befc8,_0x59e5c7){if(_0x2befc8){_0x1e9122=_0x59e5c7;if(!_0x59e5c7){var _0x3467e1={'from':(_0x4dfd69[_0x3fe3('0xa3')][_0x3fe3('0xa9')]||'')+'\x20'+(_0x4dfd69[_0x3fe3('0xa3')][_0x3fe3('0xb9')]||'')};if(_0x50743b[_0x3fe3('0x61')]['threadId']&&_0x50743b['body'][_0x3fe3('0xba')]&&_0x50743b[_0x3fe3('0x61')][_0x3fe3('0xb3')]!=_0x50743b[_0x3fe3('0x61')]['messageId']){_0x3467e1['threadId']=_0x50743b[_0x3fe3('0x61')]['messageId'];}return _0x2befc8[_0x3fe3('0x31')](_0x3467e1);}else{return _0x2befc8;}}})[_0x3fe3('0x1c')](function(_0x474e26){_0x4dfd69['interaction']=_0x474e26[_0x3fe3('0x33')]({'plain':!![]});_0x4dfd69[_0x3fe3('0xb7')][_0x3fe3('0xbb')]=_0x1e9122;if(_0x4dfd69[_0x3fe3('0xb7')]['created']){if(_0x4dfd69[_0x3fe3('0x9c')][_0x3fe3('0xbc')]){_0x4dfd69['applications']['push']({'id':0x0,'priority':_0x4dfd69[_0x3fe3('0x9d')]['length']+0x1,'app':_0x3fe3('0xbd'),'appdata':_0x3fe3('0xbe'),'interval':_0x3fe3('0xbf')});}}return db[_0x3fe3('0xc0')]['create']({'body':_0x50743b[_0x3fe3('0x61')][_0x3fe3('0x61')],'ChatWebsiteId':_0x50743b[_0x3fe3('0x56')]['id'],'ChatInteractionId':_0x474e26['id'],'direction':'in','ContactId':_0x4dfd69[_0x3fe3('0xa3')]['id'],'AttachmentId':_0x50743b['body'][_0x3fe3('0xc1')]});})[_0x3fe3('0x1c')](function(_0x369912){_0x4dfd69[_0x3fe3('0x23')]=_0x369912;if(_0x4dfd69['interaction']['UserId']){return db[_0x3fe3('0xc2')][_0x3fe3('0x59')]({'attributes':['id',_0x3fe3('0x37')],'where':{'id':_0x4dfd69[_0x3fe3('0xb7')][_0x3fe3('0xc3')]}})[_0x3fe3('0x1c')](function(_0x403f02){if(_0x403f02){_0x4dfd69[_0x3fe3('0x9d')][_0x3fe3('0xc4')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x403f02[_0x3fe3('0x37')]+','+(_0x4dfd69['account'][_0x3fe3('0xc5')]||0xa),'interval':_0x3fe3('0xbf')});_0x4dfd69[_0x3fe3('0xc6')]=!![];}return respondWithRpcPromise(_0x3fe3('0xc7'),'startRouting',_0x4dfd69);});}return respondWithRpcPromise(_0x3fe3('0xc7'),'startRouting',_0x4dfd69);})[_0x3fe3('0x1c')](function(_0x444fe9){respondWithRpcPromise('EventManager',_0x3fe3('0xc8'),{'event':_0x3fe3('0xc9'),'message':_0x444fe9},client9002);return _0x444fe9;})[_0x3fe3('0x1c')](respondWithResult(_0x217f32,null))[_0x3fe3('0x25')](handleError(_0x217f32,null));};exports[_0x3fe3('0xca')]=function(_0x399100,_0x3857c6,_0x56d3d3){var _0x2215e2,_0x2e075a,_0x2d3a89;var _0x8cddf4=[];var _0x5b04a0=[];var _0x158444={};var _0x2bd590=_0x399100[_0x3fe3('0xcb')]||[];var _0x314763=[];var _0x501707;return db[_0x3fe3('0x8b')][_0x3fe3('0x62')]()[_0x3fe3('0x1c')](function(_0x1357cd){if(!_0x1357cd){throw new db['Sequelize'][(_0x3fe3('0x8c'))](_0x3fe3('0x8d'));}_0x5b04a0=_[_0x3fe3('0x8e')](_[_0x3fe3('0x57')](_0x1357cd),[_0x3fe3('0xcc'),_0x3fe3('0x8f')]);_0x8cddf4=_[_0x3fe3('0x8e')](_[_0x3fe3('0x57')](_0x1357cd),[_0x3fe3('0xcc'),'updatedAt','CompanyId','ListId']);if(_0x399100['body']['id']){delete _0x399100['body']['id'];}if(_[_0x3fe3('0x7a')](_0x399100[_0x3fe3('0x61')][_0x3fe3('0x97')])){throw _0x3857c6['status'](0x1f4)[_0x3fe3('0x38')](new db[(_0x3fe3('0x92'))]['ValidationError'](_0x3fe3('0x93')));}if(_[_0x3fe3('0x7a')](_0x399100['body'][_0x3fe3('0x61')])||_0x399100[_0x3fe3('0x61')][_0x3fe3('0x61')]===''){throw _0x3857c6[_0x3fe3('0x27')](0x1f4)[_0x3fe3('0x38')](new db['Sequelize'][(_0x3fe3('0x8c'))](_0x3fe3('0x94')));}if(_[_0x3fe3('0x7a')](_0x399100[_0x3fe3('0x61')][_0x3fe3('0xcd')])){throw _0x3857c6[_0x3fe3('0x27')](0x1f4)[_0x3fe3('0x38')](new db[(_0x3fe3('0x92'))]['ValidationError'](_0x3fe3('0xce')+_0x8cddf4));}if(!_[_0x3fe3('0xcf')](_0x8cddf4,_0x399100[_0x3fe3('0x61')][_0x3fe3('0xcd')])){throw _0x3857c6[_0x3fe3('0x27')](0x1f4)[_0x3fe3('0x38')](new db[(_0x3fe3('0x92'))][(_0x3fe3('0x8c'))](_0x3fe3('0xd0')+_0x8cddf4));}_0x158444[_0x399100[_0x3fe3('0x61')][_0x3fe3('0xcd')]]=_0x399100['body'][_0x3fe3('0x97')];})[_0x3fe3('0x1c')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x399100[_0x3fe3('0x56')]['id']},'include':[{'model':db[_0x3fe3('0x98')],'as':'List'},{'model':db['MailAccount'],'as':'MailAccount'}]});})[_0x3fe3('0x1c')](handleEntityNotFound(_0x3857c6,null))['then'](function(_0x1b4f47){if(_0x1b4f47&&_0x1b4f47[_0x3fe3('0x99')]){_0x2e075a=_0x1b4f47;var _0xe3f278=_['defaults'](_0x399100[_0x3fe3('0x61')],{'firstName':_0x399100[_0x3fe3('0x61')]['from'],'phone':_0x399100['body'][_0x3fe3('0x97')],'ListId':_0x1b4f47[_0x3fe3('0x91')]});_0xe3f278[_0x399100[_0x3fe3('0x61')]['mapKeyOffline']]=_0x399100['body'][_0x3fe3('0x97')];return db[_0x3fe3('0x8b')]['findOrCreate']({'where':_0x158444,'defaults':_0xe3f278});}})[_0x3fe3('0xb8')](function(_0x363519){if(_0x363519){_0x2d3a89=_0x363519;var _0x5a1d14=fs[_0x3fe3('0xd1')](path['join'](config[_0x3fe3('0x77')],_0x3fe3('0xd2')),_0x3fe3('0xd3'));var _0x304d96=ejs['render'](_0x5a1d14,{'body':_[_0x3fe3('0xd4')](_0x399100['body']['body']),'bodyTitle':_0x2e075a['offlineMessageBody']});return db[_0x3fe3('0xd5')]['create']({'body':_0x304d96,'ContactId':_0x363519['id'],'ChatWebsiteId':_0x2e075a['id']});}})[_0x3fe3('0x1c')](function(_0x46ba1f){_0x501707=_0x46ba1f;if(_0x2bd590['length']){var _0x1de25f=_0x2bd590[_0x3fe3('0x42')](function(_0x2e89b1){return{'name':_0x2e89b1[_0x3fe3('0xd6')],'basename':_0x2e89b1['filename'],'type':_0x2e89b1[_0x3fe3('0xd7')],'ChatOfflineMessageId':_0x46ba1f['id']};});_0x314763=_0x1de25f[_0x3fe3('0x42')](_0x1a1e31=>{var _0x2e93e3={'filename':_0x1a1e31[_0x3fe3('0x37')],'path':path[_0x3fe3('0x7c')](config[_0x3fe3('0x77')],_0x3fe3('0xd8'),'files',_0x3fe3('0xd9'),_0x3fe3('0xda'),_0x1a1e31[_0x3fe3('0xdb')])};return _0x2e93e3;});if(!_0x2e075a['openNewInteraction']){return db['sequelize'][_0x3fe3('0xdc')](function(_0x1a9e1a){return db[_0x3fe3('0xdd')]['bulkCreate'](_0x1de25f,{'transaction':_0x1a9e1a});});}}})[_0x3fe3('0x1c')](function(){if(_0x501707){_0x2215e2=_0x501707;return db[_0x3fe3('0xde')][_0x3fe3('0x66')]({'where':{'active':!![]},'include':[{'model':db[_0x3fe3('0xdf')],'as':_0x3fe3('0xe0'),'raw':!![]}]});}})[_0x3fe3('0x1c')](function(_0x119488){if(_0x119488&&_0x119488[_0x3fe3('0xe0')]&&_0x2e075a[_0x3fe3('0xe1')]&&_0x2e075a[_0x3fe3('0xe2')]){var _0x19abf5={'tls':{'rejectUnauthorized':![]}};if(_0x119488[_0x3fe3('0xe0')][_0x3fe3('0xe3')]){_0x19abf5[_0x3fe3('0xe3')]=_0x119488[_0x3fe3('0xe0')][_0x3fe3('0xe3')];}else{_0x19abf5[_0x3fe3('0xe4')]=_0x119488[_0x3fe3('0xe0')][_0x3fe3('0xe4')];_0x19abf5['port']=_0x119488[_0x3fe3('0xe0')][_0x3fe3('0xe5')];_0x19abf5[_0x3fe3('0xe6')]=_0x119488[_0x3fe3('0xe0')][_0x3fe3('0xe6')];}if(_0x119488[_0x3fe3('0xe0')]['authentication']){_0x19abf5[_0x3fe3('0xe7')]={'user':_0x119488['Smtp'][_0x3fe3('0x5b')],'pass':_0x119488[_0x3fe3('0xe0')][_0x3fe3('0xe8')]};}return respondWithRpcPromise(_0x3fe3('0xe9'),_0x3fe3('0xea'),{'account':_0x19abf5,'message':{'from':util['format'](_0x3fe3('0xeb'),_0x119488[_0x3fe3('0x37')],_0x119488[_0x3fe3('0xec')]||_0x119488[_0x3fe3('0xe0')][_0x3fe3('0x5b')]),'to':_0x2e075a[_0x3fe3('0xe2')],'subject':_0x2e075a[_0x3fe3('0xed')],'html':_0x2215e2[_0x3fe3('0x61')],'attachments':_0x314763}},client9003)['then'](function(){return _0x2215e2;})[_0x3fe3('0x25')](function(_0x508de8){console['error'](_0x508de8);});}})['then'](function(){if(_0x2e075a&&_0x2e075a[_0x3fe3('0xee')]&&_0x2e075a[_0x3fe3('0xef')]){var _0x54c642=[];if(_0x2bd590[_0x3fe3('0x48')]){_0x54c642=_0x2bd590[_0x3fe3('0x42')](function(_0x47b509){return{'name':_0x47b509[_0x3fe3('0xd6')],'basename':_0x47b509['filename'],'type':_0x47b509[_0x3fe3('0xd7')],'ChatOfflineMessageId':_0x501707['id']};});}var _0x90f0ad;if(!_[_0x3fe3('0x7a')](_0x2e075a['subjectOffline'])){var _0x397af7=_[_0x3fe3('0x42')](_0x399100[_0x3fe3('0x61')],function(_0x2de4fa){return _0x2de4fa;});var _0x3cb069=_[_0x3fe3('0xf0')](_0x397af7)[0x0];var _0x73c122=_[_0x3fe3('0xf1')](_0x3cb069,function(_0x70272){return _0x70272;});_0x90f0ad=_0x73c122[0x1][_0x2e075a[_0x3fe3('0xf2')]];}var _0x52d2b4={'from':_0x2d3a89['email'],'firstName':_0x2d3a89[_0x3fe3('0xa9')],'lastName':_0x2d3a89[_0x3fe3('0xb9')],'mapKey':'email','message':{'from':_0x2d3a89[_0x3fe3('0xec')],'to':_0x2e075a[_0x3fe3('0xde')][_0x3fe3('0xec')],'cc':'','subject':_['isNil'](_0x90f0ad)?_0x2e075a[_0x3fe3('0xed')]:_0x90f0ad,'messageId':'','sentAt':new Date(),'attach':_0x54c642[_0x3fe3('0x48')],'attachments':_0x54c642,'originChannel':_0x3fe3('0xf3'),'ChatWebsiteId':_0x2e075a['id'],'ChatOfflineMessageId':_0x2215e2['id'],'originTo':_0x2e075a[_0x3fe3('0xde')][_0x3fe3('0xec')]},'body':_0x2215e2[_0x3fe3('0x61')]};var _0x424ca3={'account':{'id':_0x2e075a[_0x3fe3('0xef')]},'body':_0x52d2b4,'log':_0x3fe3('0xf4')};return respondWithRpcPromise(_0x3fe3('0xf4'),_0x3fe3('0xf5'),_0x424ca3,client9001)['then'](function(){return _0x2215e2;})[_0x3fe3('0x25')](function(_0x15e907){console[_0x3fe3('0x21')](_0x15e907);});}return;})[_0x3fe3('0x1c')](function(){if(_0x2215e2){return _0x2215e2;}})[_0x3fe3('0x1c')](respondWithResult(_0x3857c6,null))['catch'](function(_0x135ef3){console['error'](_0x3fe3('0x25'),_0x135ef3);for(var _0x37f2ce of _0x2bd590){var _0x5acbb7=path[_0x3fe3('0x7c')](config['root'],_0x3fe3('0xd8'),_0x3fe3('0xcb'),'attachments',_0x3fe3('0xda'),_0x37f2ce[_0x3fe3('0x74')]);fs_extra[_0x3fe3('0xf6')](_0x5acbb7)[_0x3fe3('0x25')](function(_0x36e0f8){console[_0x3fe3('0x21')](_0x3fe3('0xf7'),_0x5acbb7,_0x36e0f8);});}});};exports[_0x3fe3('0xf8')]=function(_0x24c859,_0x2e74cf,_0x406d54){return db['ChatInteraction'][_0x3fe3('0x59')]({'where':{'id':_0x24c859[_0x3fe3('0x56')]['id']}})[_0x3fe3('0x1c')](handleEntityNotFound(_0x2e74cf,null))[_0x3fe3('0x1c')](function(_0x851102){if(_0x851102){return _0x851102[_0x3fe3('0xf8')](_0x24c859[_0x3fe3('0x61')][_0x3fe3('0x69')],_['omit'](_0x24c859[_0x3fe3('0x61')],[_0x3fe3('0x69'),'id'])||{});}})[_0x3fe3('0x1c')](respondWithResult(_0x2e74cf,null))[_0x3fe3('0x25')](handleError(_0x2e74cf,null));};exports[_0x3fe3('0xf9')]=function(_0x68e6e5,_0x45c71e,_0x2b6aa9){var _0xab4aac={'raw':![],'where':{}};var _0x511bcf={};var _0x1bc35e={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x68e6e5[_0x3fe3('0x56')]['id']}})['then'](handleEntityNotFound(_0x45c71e,null))[_0x3fe3('0x1c')](function(_0x4700d2){if(_0x4700d2){_0x511bcf[_0x3fe3('0x41')]=_[_0x3fe3('0x57')](db['ChatInteraction'][_0x3fe3('0x3d')]);_0x511bcf[_0x3fe3('0x43')]=_['keys'](_0x68e6e5[_0x3fe3('0x43')]);_0x511bcf[_0x3fe3('0x44')]=_[_0x3fe3('0x45')](_0x511bcf[_0x3fe3('0x41')],_0x511bcf[_0x3fe3('0x43')]);_0xab4aac[_0x3fe3('0x47')]=_[_0x3fe3('0x45')](_0x511bcf[_0x3fe3('0x41')],qs['fields'](_0x68e6e5['query'][_0x3fe3('0x46')]));_0xab4aac[_0x3fe3('0x47')]=_0xab4aac[_0x3fe3('0x47')][_0x3fe3('0x48')]?_0xab4aac['attributes']:_0x511bcf[_0x3fe3('0x41')];if(!_0x68e6e5['query'][_0x3fe3('0x49')](_0x3fe3('0x4a'))){_0xab4aac[_0x3fe3('0x2c')]=qs['limit'](_0x68e6e5[_0x3fe3('0x43')][_0x3fe3('0x2c')]);_0xab4aac[_0x3fe3('0x2a')]=qs['offset'](_0x68e6e5['query'][_0x3fe3('0x2a')]);}_0xab4aac[_0x3fe3('0x4b')]=qs['sort'](_0x68e6e5[_0x3fe3('0x43')][_0x3fe3('0x4c')]);_0xab4aac[_0x3fe3('0x4d')]=qs[_0x3fe3('0x44')](_[_0x3fe3('0x4e')](_0x68e6e5[_0x3fe3('0x43')],_0x511bcf['filters']));_0xab4aac[_0x3fe3('0x4d')][_0x3fe3('0x67')]=_0x4700d2['id'];if(_0x68e6e5[_0x3fe3('0x43')][_0x3fe3('0x4f')]){_0xab4aac['where']=_[_0x3fe3('0x58')](_0xab4aac[_0x3fe3('0x4d')],{'$or':_[_0x3fe3('0x42')](_0xab4aac['attributes'],function(_0x48377b){var _0x128ebd={};_0x128ebd[_0x48377b]={'$like':'%'+_0x68e6e5['query'][_0x3fe3('0x4f')]+'%'};return _0x128ebd;})});}_0xab4aac=_[_0x3fe3('0x58')]({},_0xab4aac,_0x68e6e5['options']);return db[_0x3fe3('0xb5')][_0x3fe3('0x2d')]({'where':_0xab4aac[_0x3fe3('0x4d')]})[_0x3fe3('0x1c')](function(_0x4f9c27){_0x1bc35e[_0x3fe3('0x2d')]=_0x4f9c27;if(_0x68e6e5[_0x3fe3('0x43')][_0x3fe3('0x52')]){_0xab4aac[_0x3fe3('0x53')]=[{'model':db['CmContact'],'as':_0x3fe3('0xfa'),'required':![]},{'model':db[_0x3fe3('0xc2')],'as':_0x3fe3('0xfb'),'attributes':[_0x3fe3('0x37'),_0x3fe3('0xfc'),_0x3fe3('0xfd')],'required':![]},{'model':db['Tag'],'as':_0x3fe3('0xfe'),'attributes':['id','name',_0x3fe3('0xff')],'where':_0x68e6e5[_0x3fe3('0x43')]['tag']?{'id':_0x68e6e5[_0x3fe3('0x43')]['tag']}:undefined,'required':_0x68e6e5[_0x3fe3('0x43')][_0x3fe3('0x100')]?!![]:![]}];}return db['ChatInteraction'][_0x3fe3('0x101')](_0xab4aac);})[_0x3fe3('0x1c')](function(_0x576d9e){_0x1bc35e[_0x3fe3('0x54')]=_0x576d9e;return _0x1bc35e;});}})[_0x3fe3('0x1c')](respondWithFilteredResult(_0x45c71e,_0xab4aac))[_0x3fe3('0x25')](handleError(_0x45c71e,null));};function iftimePromise(_0x42f9ae,_0x1f5dd1){return respondWithRpcPromise('Command',_0x3fe3('0x102'),{'command':_0x1f5dd1[_0x3fe3('0x103')]?util[_0x3fe3('0xad')](_0x3fe3('0x104'),_0x42f9ae[_0x3fe3('0x105')],_0x1f5dd1[_0x3fe3('0x103')]):util[_0x3fe3('0xad')](_0x3fe3('0x106'),_0x42f9ae[_0x3fe3('0x105')])},client9002)[_0x3fe3('0x1c')](function(_0x2b6d88){var _0x4028dc=_0x2b6d88&&_0x2b6d88['indexOf']('true')>=0x0?!![]:![];logger[_0x3fe3('0x1d')](_0x3fe3('0x107'),_0x1f5dd1['id'],_0x42f9ae['id'],_0x42f9ae[_0x3fe3('0x105')],_0x4028dc?_0x3fe3('0x108'):_0x3fe3('0x109'),_0x1f5dd1[_0x3fe3('0x103')]?_0x1f5dd1[_0x3fe3('0x103')]:'No\x20timezone');return _0x4028dc;})[_0x3fe3('0x25')](function(_0xa5746c){logger[_0x3fe3('0x21')](_0x3fe3('0x107'),_0x1f5dd1['id'],_0x42f9ae['id'],_0x42f9ae[_0x3fe3('0x105')],util[_0x3fe3('0x10a')](_0xa5746c,{'showHidden':![],'depth':null}),_0x1f5dd1['timezone']?_0x1f5dd1['timezone']:'No\x20timezone');return![];});}exports[_0x3fe3('0x102')]=function(_0x3a28f8,_0xbc6d2a,_0x1e1622){var _0x34ba1a=0x0;var _0x31179d=0x0;var _0x2dc4e1=![];var _0x4325b2;var _0x4c2a77;return db['ChatWebsite']['find']({'where':{'id':_0x3a28f8[_0x3fe3('0x56')]['id']},'include':[{'model':db['Interval'],'as':_0x3fe3('0x10b'),'include':[{'model':db['Interval'],'as':_0x3fe3('0x10c'),'attributes':['id',_0x3fe3('0x105')],'raw':!![]}]}]})[_0x3fe3('0x1c')](handleEntityNotFound(_0xbc6d2a,null))['then'](function(_0x383efd){if(_0x383efd){_0x4325b2=_0x383efd;return _0x383efd[_0x3fe3('0x10d')]({'raw':!![]});}})['then'](function(_0x360a3e){if(_0x4325b2){if(_0x360a3e){_0x4c2a77=_0x360a3e;}}return require(_0x3fe3('0x12'))[_0x3fe3('0x10e')]();})[_0x3fe3('0x1c')](function(_0x453891){if(_0x453891){_0x31179d=_0x453891['virtual'];_0x2dc4e1=_0x453891[_0x3fe3('0x79')];}})[_0x3fe3('0x1c')](function(){return db['ChatInteraction'][_0x3fe3('0x2d')]({'where':{'closed':![]}});})[_0x3fe3('0x1c')](function(_0x5f5de4){_0x34ba1a=_0x5f5de4;if(_0x31179d&&_0x5f5de4>_0x31179d){return db[_0x3fe3('0x10f')][_0x3fe3('0x66')]({'where':{'id':0x1}})['then'](function(_0x18ceef){if(_0x18ceef){_0x18ceef['increment'](_0x3fe3('0x110'));}});}})['then'](function(){if(_0x4325b2['Interval']&&_0x4325b2[_0x3fe3('0x10b')]['Intervals']){var _0x43fe11=[];for(var _0x4744db=0x0;_0x4744db<_0x4325b2[_0x3fe3('0x10b')][_0x3fe3('0x10c')][_0x3fe3('0x48')];_0x4744db++){var _0x2cccb6=_0x4325b2[_0x3fe3('0x10b')][_0x3fe3('0x10c')][_0x4744db][_0x3fe3('0x33')]({'plain':!![]});_0x43fe11[_0x3fe3('0x111')](iftimePromise(_0x2cccb6,_0x4325b2));}return BPromise[_0x3fe3('0x112')](_0x43fe11)[_0x3fe3('0x1c')](function(_0x4af8a2){return _[_0x3fe3('0x113')](_0x4af8a2);});}else{return!![];}})['then'](function(_0x411e42){var _0x4e7aad=fs[_0x3fe3('0xd1')](path[_0x3fe3('0x7c')](config['root'],_0x3fe3('0x114')),'utf8');var _0xfbbab8={'remote':_0x4325b2[_0x3fe3('0x115')],'query':querystring['stringify'](_['merge'](_0x4325b2[_0x3fe3('0x33')]({'plain':!![]}),{'customerIp':_0x3a28f8[_0x3fe3('0x88')]['x-forwarded-for']||_0x3a28f8[_0x3fe3('0x88')]['x-real-ip']||_0x3a28f8[_0x3fe3('0x116')][_0x3fe3('0x117')]||_0x3a28f8['ip'],'referer':_0x3a28f8['headers'][_0x3fe3('0xaa')],'openedInteractions':_0x34ba1a,'maxInteractions':_0x31179d,'virtual':_0x2dc4e1[_0x3fe3('0x118')],'online':_0x411e42,'custom':_0x2dc4e1}))['replace'](/'/g,'\x5c\x27')};_0xbc6d2a['send'](ejs[_0x3fe3('0x119')](Mustache[_0x3fe3('0x119')](_0x4e7aad,_0xfbbab8),{'proactiveActions':_0x4c2a77,'alignment':_0x4325b2['alignment'],'verticalAlignment':_0x4325b2[_0x3fe3('0x11a')],'div_color':_0x4325b2[_0x3fe3('0xff')],'text_color':_0x4325b2[_0x3fe3('0x11b')],'button_color':_0x4325b2[_0x3fe3('0x11c')],'background_color':_0x4325b2[_0x3fe3('0x11d')]}));})[_0x3fe3('0x25')](handleError(_0xbc6d2a,null));};exports['addApplications']=function(_0x5237c0,_0x1dd617,_0x327a1d){return db[_0x3fe3('0x3c')][_0x3fe3('0x66')]({'where':{'id':_0x5237c0[_0x3fe3('0x56')]['id']}})[_0x3fe3('0x1c')](handleEntityNotFound(_0x1dd617,null))[_0x3fe3('0x1c')](function(_0x4f7b09){if(_0x4f7b09){return db[_0x3fe3('0x11e')][_0x3fe3('0xdc')](function(_0x1a903a){return db['ChatApplication'][_0x3fe3('0x32')]({'where':{'ChatWebsiteId':_0x5237c0[_0x3fe3('0x56')]['id']},'transaction':_0x1a903a})[_0x3fe3('0x1c')](function(_0x1dfe0a){var _0x32957c=_['map'](_0x5237c0[_0x3fe3('0x61')],function(_0x4be523){_0x4be523[_0x3fe3('0x67')]=_0x5237c0[_0x3fe3('0x56')]['id'];return _0x4be523;});return db[_0x3fe3('0x11f')][_0x3fe3('0x120')](_0x32957c,{'transaction':_0x1a903a});});})[_0x3fe3('0x1c')](function(){return db[_0x3fe3('0x11f')][_0x3fe3('0x121')]({'where':{'ChatWebsiteId':_0x5237c0['params']['id']},'order':_0x3fe3('0xa1')});});}})[_0x3fe3('0x1c')](respondWithResult(_0x1dd617,null))[_0x3fe3('0x25')](handleError(_0x1dd617,null));};exports['getApplications']=function(_0x51ef55,_0x4dde8b,_0x232f07){var _0x1ecd85={};var _0x204396={};var _0x3e7f07;var _0x25349;return db[_0x3fe3('0x3c')][_0x3fe3('0x66')]({'where':{'id':_0x51ef55[_0x3fe3('0x56')]['id']}})[_0x3fe3('0x1c')](handleEntityNotFound(_0x4dde8b,null))[_0x3fe3('0x1c')](function(_0x4dcbda){if(_0x4dcbda){_0x3e7f07=_0x4dcbda;_0x204396[_0x3fe3('0x41')]=_['keys'](db[_0x3fe3('0x11f')][_0x3fe3('0x3d')]);_0x204396[_0x3fe3('0x43')]=_[_0x3fe3('0x57')](_0x51ef55[_0x3fe3('0x43')]);_0x204396[_0x3fe3('0x44')]=_['intersection'](_0x204396[_0x3fe3('0x41')],_0x204396[_0x3fe3('0x43')]);_0x1ecd85[_0x3fe3('0x47')]=_[_0x3fe3('0x45')](_0x204396[_0x3fe3('0x41')],qs[_0x3fe3('0x46')](_0x51ef55['query'][_0x3fe3('0x46')]));_0x1ecd85[_0x3fe3('0x47')]=_0x1ecd85['attributes'][_0x3fe3('0x48')]?_0x1ecd85[_0x3fe3('0x47')]:_0x204396[_0x3fe3('0x41')];_0x1ecd85[_0x3fe3('0x4b')]=qs[_0x3fe3('0x4c')](_0x51ef55[_0x3fe3('0x43')][_0x3fe3('0x4c')]);_0x1ecd85[_0x3fe3('0x4d')]=qs[_0x3fe3('0x44')](_['pick'](_0x51ef55[_0x3fe3('0x43')],_0x204396[_0x3fe3('0x44')]));if(_0x51ef55[_0x3fe3('0x43')]['filter']){_0x1ecd85[_0x3fe3('0x4d')]=_[_0x3fe3('0x58')](_0x1ecd85[_0x3fe3('0x4d')],{'$or':_[_0x3fe3('0x42')](_0x1ecd85[_0x3fe3('0x47')],function(_0x5bf79f){var _0x1976ba={};_0x1976ba[_0x5bf79f]={'$like':'%'+_0x51ef55[_0x3fe3('0x43')][_0x3fe3('0x4f')]+'%'};return _0x1976ba;})});}_0x1ecd85=_[_0x3fe3('0x58')]({},_0x1ecd85,_0x51ef55['options']);return _0x3e7f07[_0x3fe3('0x122')](_0x1ecd85);}})[_0x3fe3('0x1c')](function(_0x4ff7d3){if(_0x4ff7d3){_0x25349=_0x4ff7d3['length'];if(!_0x51ef55[_0x3fe3('0x43')][_0x3fe3('0x49')]('nolimit')){_0x1ecd85[_0x3fe3('0x2c')]=qs[_0x3fe3('0x2c')](_0x51ef55[_0x3fe3('0x43')][_0x3fe3('0x2c')]);_0x1ecd85[_0x3fe3('0x2a')]=qs[_0x3fe3('0x2a')](_0x51ef55['query']['offset']);}return _0x3e7f07[_0x3fe3('0x122')](_0x1ecd85);}})[_0x3fe3('0x1c')](function(_0x189e49){if(_0x189e49){return _0x189e49?{'count':_0x25349,'rows':_0x189e49}:null;}})[_0x3fe3('0x1c')](respondWithResult(_0x4dde8b,null))['catch'](handleError(_0x4dde8b,null));};exports['addProactiveActions']=function(_0x459192,_0x3789a2,_0x3c1083){return db[_0x3fe3('0x123')]['find']({'where':{'id':_0x459192[_0x3fe3('0x56')]['id']}})[_0x3fe3('0x1c')](handleEntityNotFound(_0x3789a2,null))[_0x3fe3('0x1c')](function(_0x1a15e9){if(_0x1a15e9){return _0x1a15e9[_0x3fe3('0x124')](_0x459192[_0x3fe3('0x61')][_0x3fe3('0x69')],_['omit'](_0x459192[_0x3fe3('0x61')],[_0x3fe3('0x69'),'id'])||{});}})['then'](respondWithResult(_0x3789a2,null))['catch'](handleError(_0x3789a2,null));};exports[_0x3fe3('0x10d')]=function(_0x5d29e3,_0x2240d9,_0x286186){var _0x24182d={};var _0x4e1422={};var _0x3ba0b1;var _0x3c7898;return db[_0x3fe3('0x3c')][_0x3fe3('0x66')]({'where':{'id':_0x5d29e3[_0x3fe3('0x56')]['id']}})[_0x3fe3('0x1c')](handleEntityNotFound(_0x2240d9,null))[_0x3fe3('0x1c')](function(_0x2eec8a){if(_0x2eec8a){_0x3ba0b1=_0x2eec8a;_0x4e1422[_0x3fe3('0x41')]=_[_0x3fe3('0x57')](db[_0x3fe3('0x125')][_0x3fe3('0x3d')]);_0x4e1422[_0x3fe3('0x43')]=_[_0x3fe3('0x57')](_0x5d29e3['query']);_0x4e1422['filters']=_[_0x3fe3('0x45')](_0x4e1422[_0x3fe3('0x41')],_0x4e1422[_0x3fe3('0x43')]);_0x24182d[_0x3fe3('0x47')]=_['intersection'](_0x4e1422[_0x3fe3('0x41')],qs[_0x3fe3('0x46')](_0x5d29e3[_0x3fe3('0x43')][_0x3fe3('0x46')]));_0x24182d[_0x3fe3('0x47')]=_0x24182d[_0x3fe3('0x47')]['length']?_0x24182d[_0x3fe3('0x47')]:_0x4e1422['model'];_0x24182d['order']=qs['sort'](_0x5d29e3['query'][_0x3fe3('0x4c')]);_0x24182d[_0x3fe3('0x4d')]=qs[_0x3fe3('0x44')](_[_0x3fe3('0x4e')](_0x5d29e3[_0x3fe3('0x43')],_0x4e1422[_0x3fe3('0x44')]));if(_0x5d29e3[_0x3fe3('0x43')][_0x3fe3('0x4f')]){_0x24182d[_0x3fe3('0x4d')]=_[_0x3fe3('0x58')](_0x24182d[_0x3fe3('0x4d')],{'$or':_[_0x3fe3('0x42')](_0x24182d[_0x3fe3('0x47')],function(_0x472bd9){var _0x1340f4={};_0x1340f4[_0x472bd9]={'$like':'%'+_0x5d29e3[_0x3fe3('0x43')]['filter']+'%'};return _0x1340f4;})});}_0x24182d=_[_0x3fe3('0x58')]({},_0x24182d,_0x5d29e3[_0x3fe3('0x51')]);return _0x3ba0b1['getProactiveActions'](_0x24182d);}})[_0x3fe3('0x1c')](function(_0x556f86){if(_0x556f86){_0x3c7898=_0x556f86[_0x3fe3('0x48')];if(!_0x5d29e3['query'][_0x3fe3('0x49')](_0x3fe3('0x4a'))){_0x24182d[_0x3fe3('0x2c')]=qs['limit'](_0x5d29e3[_0x3fe3('0x43')][_0x3fe3('0x2c')]);_0x24182d['offset']=qs[_0x3fe3('0x2a')](_0x5d29e3[_0x3fe3('0x43')][_0x3fe3('0x2a')]);}return _0x3ba0b1[_0x3fe3('0x10d')](_0x24182d);}})['then'](function(_0x514d53){if(_0x514d53){return _0x514d53?{'count':_0x3c7898,'rows':_0x514d53}:null;}})[_0x3fe3('0x1c')](respondWithResult(_0x2240d9,null))['catch'](handleError(_0x2240d9,null));};exports[_0x3fe3('0x126')]=function(_0x513053,_0x258fc9,_0x1a0d4e){var _0xdfd02b=_0x513053[_0x3fe3('0x43')][_0x3fe3('0x127')]===_0x3fe3('0x128')?'offlineForm':_0x3fe3('0x129');return db['ChatWebsite']['find']({'attributes':['id',_0xdfd02b],'where':{'id':_0x513053['params']['id']}})[_0x3fe3('0x1c')](handleEntityNotFound(_0x258fc9,null))[_0x3fe3('0x1c')](function(_0x575e34){if(_0x575e34){var _0x2d7c82=_0x575e34[_0xdfd02b];var _0x205777=_0x2d7c82&&_0x2d7c82[_0x3fe3('0x12a')]?_0x2d7c82['items']:[];_0x258fc9[_0x3fe3('0x38')]({'fromKey':_['isNil'](_0x2d7c82[_0x3fe3('0x12b')])?undefined:_0x2d7c82[_0x3fe3('0x12b')],'count':_0x205777[_0x3fe3('0x48')],'rows':_0x205777});}})['catch'](handleError(_0x258fc9,null));};exports['getOfflineMessages']=function(_0x4a4992,_0xbafff3,_0x171396){var _0x130569={'raw':![],'where':{}};var _0x7c1b4b={};var _0x2e0754={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x3fe3('0x66')]({'where':{'id':_0x4a4992[_0x3fe3('0x56')]['id']}})['then'](handleEntityNotFound(_0xbafff3,null))[_0x3fe3('0x1c')](function(_0x33af9d){if(_0x33af9d){_0x7c1b4b[_0x3fe3('0x41')]=_[_0x3fe3('0x57')](db[_0x3fe3('0xd5')]['rawAttributes']);_0x7c1b4b[_0x3fe3('0x43')]=_[_0x3fe3('0x57')](_0x4a4992[_0x3fe3('0x43')]);_0x7c1b4b['filters']=_[_0x3fe3('0x45')](_0x7c1b4b[_0x3fe3('0x41')],_0x7c1b4b[_0x3fe3('0x43')]);_0x130569[_0x3fe3('0x47')]=_[_0x3fe3('0x45')](_0x7c1b4b[_0x3fe3('0x41')],qs[_0x3fe3('0x46')](_0x4a4992[_0x3fe3('0x43')][_0x3fe3('0x46')]));_0x130569[_0x3fe3('0x47')]=_0x130569['attributes'][_0x3fe3('0x48')]?_0x130569[_0x3fe3('0x47')]:_0x7c1b4b[_0x3fe3('0x41')];if(!_0x4a4992[_0x3fe3('0x43')][_0x3fe3('0x49')](_0x3fe3('0x4a'))){_0x130569[_0x3fe3('0x2c')]=qs['limit'](_0x4a4992[_0x3fe3('0x43')]['limit']);_0x130569[_0x3fe3('0x2a')]=qs['offset'](_0x4a4992['query'][_0x3fe3('0x2a')]);}_0x130569[_0x3fe3('0x4b')]=qs['sort'](_0x4a4992[_0x3fe3('0x43')][_0x3fe3('0x4c')]);_0x130569['where']=qs[_0x3fe3('0x44')](_[_0x3fe3('0x4e')](_0x4a4992[_0x3fe3('0x43')],_0x7c1b4b[_0x3fe3('0x44')]));_0x130569[_0x3fe3('0x4d')][_0x3fe3('0x67')]=_0x33af9d['id'];if(_0x4a4992[_0x3fe3('0x43')][_0x3fe3('0x4f')]){_0x130569['where']=_[_0x3fe3('0x58')](_0x130569[_0x3fe3('0x4d')],{'$or':_[_0x3fe3('0x42')](_0x130569[_0x3fe3('0x47')],function(_0xfbcf0f){var _0x4eb31c={};_0x4eb31c[_0xfbcf0f]={'$like':'%'+_0x4a4992['query'][_0x3fe3('0x4f')]+'%'};return _0x4eb31c;})});}_0x130569=_['merge']({},_0x130569,_0x4a4992[_0x3fe3('0x51')]);return db['ChatOfflineMessage']['count']({'where':_0x130569['where']})['then'](function(_0x2a0886){_0x2e0754[_0x3fe3('0x2d')]=_0x2a0886;if(_0x4a4992[_0x3fe3('0x43')][_0x3fe3('0x52')]){_0x130569[_0x3fe3('0x53')]=[{'all':!![]}];}else{_0x130569[_0x3fe3('0x53')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x3fe3('0xdd')],'as':_0x3fe3('0x12c'),'required':![]}];}return db[_0x3fe3('0xd5')][_0x3fe3('0x101')](_0x130569);})[_0x3fe3('0x1c')](function(_0x3f7516){_0x2e0754[_0x3fe3('0x54')]=_0x3f7516;return _0x2e0754;});}})[_0x3fe3('0x1c')](respondWithFilteredResult(_0xbafff3,_0x130569))['catch'](handleError(_0xbafff3,null));};exports[_0x3fe3('0x12d')]=function(_0x55aa16,_0x118c4a,_0x365910){return db[_0x3fe3('0x3c')][_0x3fe3('0x59')]({'where':{'id':_0x55aa16[_0x3fe3('0x56')]['id']}})[_0x3fe3('0x1c')](handleEntityNotFound(_0x118c4a,null))['then'](function(_0x19db34){if(_0x19db34){return _0x19db34[_0x3fe3('0x12d')](_0x55aa16['body'][_0x3fe3('0x69')],_[_0x3fe3('0x12e')](_0x55aa16['body'],[_0x3fe3('0x69'),'id'])||{})[_0x3fe3('0xb8')](function(_0x817a2){for(var _0x316431=0x0;_0x316431<_0x55aa16[_0x3fe3('0x61')][_0x3fe3('0x69')][_0x3fe3('0x48')];_0x316431+=0x1){socket[_0x3fe3('0x12f')]('userChatWebsite:save',{'UserId':Number(_0x55aa16[_0x3fe3('0x61')][_0x3fe3('0x69')][_0x316431]),'ChatWebsiteId':Number(_0x55aa16[_0x3fe3('0x56')]['id'])});}return _0x817a2;});}})[_0x3fe3('0x1c')](respondWithResult(_0x118c4a,null))[_0x3fe3('0x25')](handleError(_0x118c4a,null));};exports[_0x3fe3('0x130')]=function(_0x2417ee,_0x5902ec,_0x51c2c6){return db[_0x3fe3('0x3c')][_0x3fe3('0x59')]({'where':{'id':_0x2417ee[_0x3fe3('0x56')]['id']}})[_0x3fe3('0x1c')](handleEntityNotFound(_0x5902ec,null))['then'](function(_0x55dbb7){if(_0x55dbb7){return _0x55dbb7['removeAgents'](_0x2417ee[_0x3fe3('0x43')][_0x3fe3('0x69')])[_0x3fe3('0x1c')](function(){if(_['isArray'](_0x2417ee[_0x3fe3('0x43')][_0x3fe3('0x69')])){for(var _0x46801b=0x0;_0x46801b<_0x2417ee[_0x3fe3('0x43')][_0x3fe3('0x69')][_0x3fe3('0x48')];_0x46801b+=0x1){socket[_0x3fe3('0x12f')]('userChatWebsite:remove',{'UserId':Number(_0x2417ee[_0x3fe3('0x43')][_0x3fe3('0x69')][_0x46801b]),'ChatWebsiteId':Number(_0x2417ee[_0x3fe3('0x56')]['id'])});}}else{socket[_0x3fe3('0x12f')](_0x3fe3('0x131'),{'UserId':Number(_0x2417ee[_0x3fe3('0x43')][_0x3fe3('0x69')]),'ChatWebsiteId':Number(_0x2417ee[_0x3fe3('0x56')]['id'])});}});}})[_0x3fe3('0x1c')](respondWithStatusCode(_0x5902ec,null))[_0x3fe3('0x25')](handleError(_0x5902ec,null));};exports[_0x3fe3('0x132')]=function(_0x44ffae,_0x1715bb,_0x2a9f08){var _0x210c63={};var _0x43740a={};var _0x287142;var _0x3275b2;return db['ChatWebsite'][_0x3fe3('0x66')]({'where':{'id':_0x44ffae[_0x3fe3('0x56')]['id']}})[_0x3fe3('0x1c')](handleEntityNotFound(_0x1715bb,null))['then'](function(_0x968c98){if(_0x968c98){_0x287142=_0x968c98;_0x43740a[_0x3fe3('0x41')]=_[_0x3fe3('0x57')](db[_0x3fe3('0xc2')]['rawAttributes']);_0x43740a['query']=_['keys'](_0x44ffae[_0x3fe3('0x43')]);_0x43740a[_0x3fe3('0x44')]=_[_0x3fe3('0x45')](_0x43740a['model'],_0x43740a[_0x3fe3('0x43')]);_0x210c63[_0x3fe3('0x47')]=_[_0x3fe3('0x45')](_0x43740a[_0x3fe3('0x41')],qs[_0x3fe3('0x46')](_0x44ffae[_0x3fe3('0x43')][_0x3fe3('0x46')]));_0x210c63[_0x3fe3('0x47')]=_0x210c63[_0x3fe3('0x47')][_0x3fe3('0x48')]?_0x210c63[_0x3fe3('0x47')]:_0x43740a[_0x3fe3('0x41')];_0x210c63[_0x3fe3('0x4b')]=qs[_0x3fe3('0x4c')](_0x44ffae[_0x3fe3('0x43')]['sort']);_0x210c63[_0x3fe3('0x4d')]=qs[_0x3fe3('0x44')](_['pick'](_0x44ffae[_0x3fe3('0x43')],_0x43740a['filters']));if(_0x44ffae[_0x3fe3('0x43')][_0x3fe3('0x4f')]){_0x210c63[_0x3fe3('0x4d')]=_[_0x3fe3('0x58')](_0x210c63[_0x3fe3('0x4d')],{'$or':_['map'](_0x210c63['attributes'],function(_0x1ef9c5){var _0x3255db={};_0x3255db[_0x1ef9c5]={'$like':'%'+_0x44ffae['query'][_0x3fe3('0x4f')]+'%'};return _0x3255db;})});}_0x210c63=_[_0x3fe3('0x58')]({},_0x210c63,_0x44ffae[_0x3fe3('0x51')]);return _0x287142['getAgents'](_0x210c63);}})[_0x3fe3('0x1c')](function(_0x327e06){if(_0x327e06){_0x3275b2=_0x327e06['length'];if(!_0x44ffae[_0x3fe3('0x43')]['hasOwnProperty'](_0x3fe3('0x4a'))){_0x210c63[_0x3fe3('0x2c')]=qs['limit'](_0x44ffae[_0x3fe3('0x43')][_0x3fe3('0x2c')]);_0x210c63['offset']=qs[_0x3fe3('0x2a')](_0x44ffae[_0x3fe3('0x43')][_0x3fe3('0x2a')]);}return _0x287142[_0x3fe3('0x132')](_0x210c63);}})['then'](function(_0x14c517){if(_0x14c517){return _0x14c517?{'count':_0x3275b2,'rows':_0x14c517}:null;}})[_0x3fe3('0x1c')](respondWithResult(_0x1715bb,null))[_0x3fe3('0x25')](handleError(_0x1715bb,null));}; \ No newline at end of file +var _0x6bd9=['%s\x20%s\x20%s','vendor','threadId','ChatInteraction','externalUrl','interaction','spread','firstName','lastName','messageId','autoclose','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','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','toPairs','offlineMessageBody','ChatOfflineMessage','originalname','server','attachments','offline-chat','basename','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','authentication','auth','SendMail','\x22%s\x22\x20<%s>','email','openNewInteraction','MailAccountId','mimetype','toPairsIn','subjectOffline','offlineMessageSubject','Chat','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','includeAll','Contact','Owner','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','interval','ONLINE','OFFLINE','No\x20timezone','Interval','Intervals','virtual','custom','chatLicenseExceeded','push','all','some','remote','x-real-ip','connection','remoteAddress','replace','verticalAlignment','color_button','backgroundColor','addApplications','findAndCountAll','priority','getApplications','chatProactiveAction','addProactiveActions','getProactiveActions','ChatProactiveAction','getFields','online','false','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','jayson/promise','http','client','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','UserProfileResource','sendStatus','stack','send','Pause','map','ChatWebsite','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','name','options','include','findAll','rows','show','params','mandatoryDispositionPause','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','Disposition','getDispositions','ChatWebsiteId','merge','removeDispositions','findOne','CannedAnswer','removeAnswers','ids','addLogo','file','filename','agentAvatar','addCustomerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','isNil','existsSync','server/files/images/logos/','sitepic','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','download','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','DESC','ChatApplication','account','applications','Applications','list','orderBy','asc','Contacts','mapKey','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device'];(function(_0x5840a5,_0x374e6c){var _0x2d3e92=function(_0x96cad4){while(--_0x96cad4){_0x5840a5['push'](_0x5840a5['shift']());}};_0x2d3e92(++_0x374e6c);}(_0x6bd9,0x1bf));var _0x96bd=function(_0x37c3da,_0x5df920){_0x37c3da=_0x37c3da-0x0;var _0x1426cb=_0x6bd9[_0x37c3da];return _0x1426cb;};'use strict';var emlformat=require(_0x96bd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x96bd('0x1'));var jsonpatch=require(_0x96bd('0x2'));var rp=require(_0x96bd('0x3'));var moment=require('moment');var BPromise=require(_0x96bd('0x4'));var Mustache=require(_0x96bd('0x5'));var util=require(_0x96bd('0x6'));var path=require(_0x96bd('0x7'));var sox=require(_0x96bd('0x8'));var csv=require('to-csv');var ejs=require(_0x96bd('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x96bd('0xa'));var crypto=require(_0x96bd('0xb'));var jsforce=require(_0x96bd('0xc'));var deskjs=require(_0x96bd('0xd'));var toCsv=require(_0x96bd('0xe'));var querystring=require('querystring');var Papa=require(_0x96bd('0xf'));var Redis=require(_0x96bd('0x10'));var authService=require(_0x96bd('0x11'));var qs=require(_0x96bd('0x12'));var as=require(_0x96bd('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x96bd('0x14'))(_0x96bd('0x15'));var utils=require(_0x96bd('0x16'));var config=require(_0x96bd('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x96bd('0x18'))['db'];config['redis']=_[_0x96bd('0x19')](config[_0x96bd('0x1a')],{'host':_0x96bd('0x1b'),'port':0x18eb});var socket=require(_0x96bd('0x1c'))(new Redis(config[_0x96bd('0x1a')]));require(_0x96bd('0x1d'))['register'](socket);var jayson=require(_0x96bd('0x1e'));var client=jayson['client'][_0x96bd('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0x96bd('0x1f')]({'port':0x232a});var client9003=jayson['client']['http']({'port':0x232b});var client9001=jayson[_0x96bd('0x20')][_0x96bd('0x1f')]({'port':0x2329});function respondWithRpcPromise(_0x318344,_0x5c48c5,_0x453c80,_0x2f72ea){return new BPromise(function(_0x2417b8,_0x4c781a){var _0x3a3b2e=_0x2f72ea||client;return _0x3a3b2e['request'](_0x318344,_0x453c80)['then'](function(_0x231a0d){logger[_0x96bd('0x21')](_0x96bd('0x22'),_0x5c48c5,'request\x20sent');logger[_0x96bd('0x23')](_0x96bd('0x24'),_0x5c48c5,_0x96bd('0x25'),JSON[_0x96bd('0x26')](_0x231a0d));if(_0x231a0d[_0x96bd('0x27')]){if(_0x231a0d[_0x96bd('0x27')]['code']===0x1f4){logger[_0x96bd('0x27')](_0x96bd('0x22'),_0x5c48c5,_0x231a0d[_0x96bd('0x27')][_0x96bd('0x28')]);return _0x4c781a(_0x231a0d['error'][_0x96bd('0x28')]);}logger[_0x96bd('0x27')](_0x96bd('0x22'),_0x5c48c5,_0x231a0d['error']['message']);return _0x2417b8(_0x231a0d['error'][_0x96bd('0x28')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x5c48c5,'request\x20sent');_0x2417b8(_0x231a0d[_0x96bd('0x29')][_0x96bd('0x28')]);}})[_0x96bd('0x2a')](function(_0x120100){logger['error'](_0x96bd('0x22'),_0x5c48c5,_0x120100);_0x4c781a(_0x120100);});});}function respondWithStatusCode(_0xeb2f1f,_0x13e476){_0x13e476=_0x13e476||0xcc;return function(_0x305dd5){if(_0x305dd5){return _0xeb2f1f['sendStatus'](_0x13e476);}return _0xeb2f1f[_0x96bd('0x2b')](_0x13e476)[_0x96bd('0x2c')]();};}function respondWithResult(_0x445234,_0x46eab9){_0x46eab9=_0x46eab9||0xc8;return function(_0x2c81f1){if(_0x2c81f1){return _0x445234[_0x96bd('0x2b')](_0x46eab9)[_0x96bd('0x2d')](_0x2c81f1);}};}function respondWithFilteredResult(_0x4bbe61,_0x538981){return function(_0x80eaaf){if(_0x80eaaf){var _0x274f1b=typeof _0x538981['offset']===_0x96bd('0x2e')&&typeof _0x538981[_0x96bd('0x2f')]==='undefined';var _0x13793a=_0x80eaaf[_0x96bd('0x30')];var _0xe67d6c=_0x274f1b?0x0:_0x538981['offset'];var _0x596107=_0x274f1b?_0x80eaaf['count']:_0x538981[_0x96bd('0x31')]+_0x538981[_0x96bd('0x2f')];var _0x466c5f;if(_0x596107>=_0x13793a){_0x596107=_0x13793a;_0x466c5f=0xc8;}else{_0x466c5f=0xce;}_0x4bbe61[_0x96bd('0x2b')](_0x466c5f);return _0x4bbe61[_0x96bd('0x32')](_0x96bd('0x33'),_0xe67d6c+'-'+_0x596107+'/'+_0x13793a)[_0x96bd('0x2d')](_0x80eaaf);}return null;};}function patchUpdates(_0x452f78){return function(_0x9a341c){try{jsonpatch[_0x96bd('0x34')](_0x9a341c,_0x452f78,!![]);}catch(_0x5b2b6a){return BPromise['reject'](_0x5b2b6a);}return _0x9a341c[_0x96bd('0x35')]();};}function saveUpdates(_0xd5aa27,_0x2a5038){return function(_0x5a2a86){if(_0x5a2a86){return _0x5a2a86[_0x96bd('0x36')](_0xd5aa27)[_0x96bd('0x37')](function(_0x2a62b9){return _0x2a62b9;});}return null;};}function removeEntity(_0x9dcaae,_0x394ff2){return function(_0x3bf9a2){if(_0x3bf9a2){return _0x3bf9a2[_0x96bd('0x38')]()[_0x96bd('0x37')](function(){var _0x39658e=_0x3bf9a2['get']({'plain':!![]});var _0x4b3424='ChatWebsites';return db[_0x96bd('0x39')][_0x96bd('0x38')]({'where':{'type':_0x4b3424,'resourceId':_0x39658e['id']}})['then'](function(){return _0x3bf9a2;});})[_0x96bd('0x37')](function(){_0x9dcaae[_0x96bd('0x2b')](0xcc)[_0x96bd('0x2c')]();});}};}function handleEntityNotFound(_0x1952af,_0x5d62c8){return function(_0x21758c){if(!_0x21758c){_0x1952af[_0x96bd('0x3a')](0x194);}return _0x21758c;};}function handleError(_0xde8fcd,_0x29d11e){_0x29d11e=_0x29d11e||0x1f4;return function(_0x111e9a){logger[_0x96bd('0x27')](_0x111e9a[_0x96bd('0x3b')]);if(_0x111e9a['name']){delete _0x111e9a['name'];}_0xde8fcd[_0x96bd('0x2b')](_0x29d11e)[_0x96bd('0x3c')](_0x111e9a);};}exports['index']=function(_0x5df5cc,_0x27b082){var _0x15d924={'include':[{'model':db[_0x96bd('0x3d')],'as':'mandatoryDispositionPause'}]},_0x1deb71={},_0x4194a0={'count':0x0,'rows':[]};var _0x5556c8=_[_0x96bd('0x3e')](db[_0x96bd('0x3f')][_0x96bd('0x40')],function(_0x4b73c5){return{'name':_0x4b73c5[_0x96bd('0x41')],'type':_0x4b73c5[_0x96bd('0x42')][_0x96bd('0x43')]};});_0x1deb71['model']=_[_0x96bd('0x3e')](_0x5556c8,'name');_0x1deb71[_0x96bd('0x44')]=_[_0x96bd('0x45')](_0x5df5cc[_0x96bd('0x44')]);_0x1deb71[_0x96bd('0x46')]=_[_0x96bd('0x47')](_0x1deb71[_0x96bd('0x48')],_0x1deb71[_0x96bd('0x44')]);_0x15d924[_0x96bd('0x49')]=_[_0x96bd('0x47')](_0x1deb71['model'],qs[_0x96bd('0x4a')](_0x5df5cc[_0x96bd('0x44')]['fields']));_0x15d924[_0x96bd('0x49')]=_0x15d924['attributes'][_0x96bd('0x4b')]?_0x15d924[_0x96bd('0x49')]:_0x1deb71[_0x96bd('0x48')];if(!_0x5df5cc[_0x96bd('0x44')][_0x96bd('0x4c')](_0x96bd('0x4d'))){_0x15d924[_0x96bd('0x2f')]=qs['limit'](_0x5df5cc[_0x96bd('0x44')]['limit']);_0x15d924['offset']=qs['offset'](_0x5df5cc[_0x96bd('0x44')][_0x96bd('0x31')]);}_0x15d924[_0x96bd('0x4e')]=qs[_0x96bd('0x4f')](_0x5df5cc[_0x96bd('0x44')]['sort']);_0x15d924[_0x96bd('0x50')]=qs[_0x96bd('0x46')](_[_0x96bd('0x51')](_0x5df5cc[_0x96bd('0x44')],_0x1deb71[_0x96bd('0x46')]),_0x5556c8);if(_0x5df5cc[_0x96bd('0x44')][_0x96bd('0x52')]){_0x15d924[_0x96bd('0x50')]=_['merge'](_0x15d924[_0x96bd('0x50')],{'$or':_[_0x96bd('0x3e')](_0x5556c8,function(_0xbd0e02){if(_0xbd0e02['type']!=='VIRTUAL'){var _0x402bbe={};_0x402bbe[_0xbd0e02[_0x96bd('0x53')]]={'$like':'%'+_0x5df5cc[_0x96bd('0x44')][_0x96bd('0x52')]+'%'};return _0x402bbe;}})});}_0x15d924=_['merge']({},_0x15d924,_0x5df5cc[_0x96bd('0x54')]);var _0xe9bf12={'where':_0x15d924[_0x96bd('0x50')]};return db[_0x96bd('0x3f')]['count'](_0xe9bf12)['then'](function(_0x5b7a55){_0x4194a0['count']=_0x5b7a55;if(_0x5df5cc[_0x96bd('0x44')]['includeAll']){_0x15d924[_0x96bd('0x55')]=[{'all':!![]}];}return db[_0x96bd('0x3f')][_0x96bd('0x56')](_0x15d924);})[_0x96bd('0x37')](function(_0x3a3bb7){_0x4194a0[_0x96bd('0x57')]=_0x3a3bb7;return _0x4194a0;})[_0x96bd('0x37')](respondWithFilteredResult(_0x27b082,_0x15d924))[_0x96bd('0x2a')](handleError(_0x27b082,null));};exports[_0x96bd('0x58')]=function(_0x542be7,_0xfca316){var _0x40cd56={'raw':![],'where':{'id':_0x542be7[_0x96bd('0x59')]['id']},'include':[{'model':db[_0x96bd('0x3d')],'as':_0x96bd('0x5a')}]},_0x483f4b={};_0x483f4b[_0x96bd('0x48')]=_[_0x96bd('0x45')](db[_0x96bd('0x3f')][_0x96bd('0x40')]);_0x483f4b[_0x96bd('0x44')]=_['keys'](_0x542be7[_0x96bd('0x44')]);_0x483f4b[_0x96bd('0x46')]=_[_0x96bd('0x47')](_0x483f4b[_0x96bd('0x48')],_0x483f4b[_0x96bd('0x44')]);_0x40cd56['attributes']=_[_0x96bd('0x47')](_0x483f4b[_0x96bd('0x48')],qs['fields'](_0x542be7[_0x96bd('0x44')][_0x96bd('0x4a')]));_0x40cd56[_0x96bd('0x49')]=_0x40cd56[_0x96bd('0x49')][_0x96bd('0x4b')]?_0x40cd56[_0x96bd('0x49')]:_0x483f4b[_0x96bd('0x48')];if(_0x542be7['query']['includeAll']){_0x40cd56[_0x96bd('0x55')]=[{'all':!![]}];}_0x40cd56=_['merge']({},_0x40cd56,_0x542be7['options']);return db['ChatWebsite'][_0x96bd('0x5b')](_0x40cd56)[_0x96bd('0x37')](handleEntityNotFound(_0xfca316,null))['then'](respondWithResult(_0xfca316,null))[_0x96bd('0x2a')](handleError(_0xfca316,null));};exports['create']=function(_0x45355c,_0x3556a1){return db['ChatWebsite'][_0x96bd('0x5c')](_0x45355c[_0x96bd('0x5d')],{})[_0x96bd('0x37')](function(_0x5c87fa){var _0x2038f5=_0x45355c['user'][_0x96bd('0x5e')]({'plain':!![]});if(!_0x2038f5)throw new Error(_0x96bd('0x5f'));if(_0x2038f5['role']===_0x96bd('0x60')){var _0x22aed0=_0x5c87fa[_0x96bd('0x5e')]({'plain':!![]});var _0x321eca='ChatWebsites';return db[_0x96bd('0x61')][_0x96bd('0x5b')]({'where':{'name':_0x321eca,'userProfileId':_0x2038f5[_0x96bd('0x62')]},'raw':!![]})[_0x96bd('0x37')](function(_0x377fbf){if(_0x377fbf&&_0x377fbf[_0x96bd('0x63')]===0x0){return db[_0x96bd('0x39')][_0x96bd('0x5c')]({'name':_0x22aed0[_0x96bd('0x53')],'resourceId':_0x22aed0['id'],'type':_0x377fbf['name'],'sectionId':_0x377fbf['id']},{})[_0x96bd('0x37')](function(){return _0x5c87fa;});}else{return _0x5c87fa;}})['catch'](function(_0x2f06e8){logger[_0x96bd('0x27')](_0x96bd('0x64'),_0x2f06e8);throw _0x2f06e8;});}return _0x5c87fa;})[_0x96bd('0x37')](respondWithResult(_0x3556a1,0xc9))[_0x96bd('0x2a')](handleError(_0x3556a1,null));};exports['update']=function(_0x4161c4,_0x12c0bd){if(_0x4161c4[_0x96bd('0x5d')]['id']){delete _0x4161c4[_0x96bd('0x5d')]['id'];}return db[_0x96bd('0x3f')]['find']({'where':{'id':_0x4161c4['params']['id']},'include':[{'model':db[_0x96bd('0x3d')],'as':_0x96bd('0x5a')}]})[_0x96bd('0x37')](handleEntityNotFound(_0x12c0bd,null))[_0x96bd('0x37')](saveUpdates(_0x4161c4[_0x96bd('0x5d')],null))[_0x96bd('0x37')](respondWithResult(_0x12c0bd,null))[_0x96bd('0x2a')](handleError(_0x12c0bd,null));};exports[_0x96bd('0x38')]=function(_0x4782ad,_0x16da71){return db[_0x96bd('0x3f')][_0x96bd('0x5b')]({'where':{'id':_0x4782ad[_0x96bd('0x59')]['id']}})[_0x96bd('0x37')](handleEntityNotFound(_0x16da71,null))[_0x96bd('0x37')](removeEntity(_0x16da71,null))[_0x96bd('0x2a')](handleError(_0x16da71,null));};exports['describe']=function(_0x172ae4,_0x2b623a){return db[_0x96bd('0x3f')][_0x96bd('0x65')]()[_0x96bd('0x37')](respondWithResult(_0x2b623a,null))[_0x96bd('0x2a')](handleError(_0x2b623a,null));};exports[_0x96bd('0x66')]=function(_0x47ec62,_0x34b0be,_0x5ac7f2){if(_0x47ec62[_0x96bd('0x5d')]['id']){delete _0x47ec62[_0x96bd('0x5d')]['id'];}return db[_0x96bd('0x3f')][_0x96bd('0x5b')]({'where':{'id':_0x47ec62['params']['id']}})[_0x96bd('0x37')](handleEntityNotFound(_0x34b0be,null))[_0x96bd('0x37')](function(_0x1b3c96){if(_0x1b3c96){_0x47ec62['body']['ChatWebsiteId']=_0x1b3c96['id'];return db[_0x96bd('0x67')][_0x96bd('0x5c')](_0x47ec62['body']);}})[_0x96bd('0x37')](respondWithResult(_0x34b0be,null))[_0x96bd('0x2a')](handleError(_0x34b0be,null));};exports[_0x96bd('0x68')]=function(_0x5996ef,_0x201703,_0x29adf8){var _0x1c710f={'raw':![],'where':{}};var _0x38bdfc={};var _0x5b2046={'count':0x0,'rows':[]};return db[_0x96bd('0x3f')]['findOne']({'where':{'id':_0x5996ef[_0x96bd('0x59')]['id']}})[_0x96bd('0x37')](handleEntityNotFound(_0x201703,null))[_0x96bd('0x37')](function(_0x4817bd){if(_0x4817bd){_0x38bdfc[_0x96bd('0x48')]=_[_0x96bd('0x45')](db['Disposition']['rawAttributes']);_0x38bdfc[_0x96bd('0x44')]=_['keys'](_0x5996ef[_0x96bd('0x44')]);_0x38bdfc['filters']=_[_0x96bd('0x47')](_0x38bdfc['model'],_0x38bdfc['query']);_0x1c710f['attributes']=_[_0x96bd('0x47')](_0x38bdfc[_0x96bd('0x48')],qs['fields'](_0x5996ef['query'][_0x96bd('0x4a')]));_0x1c710f[_0x96bd('0x49')]=_0x1c710f[_0x96bd('0x49')][_0x96bd('0x4b')]?_0x1c710f['attributes']:_0x38bdfc['model'];if(!_0x5996ef['query'][_0x96bd('0x4c')]('nolimit')){_0x1c710f[_0x96bd('0x2f')]=qs[_0x96bd('0x2f')](_0x5996ef[_0x96bd('0x44')][_0x96bd('0x2f')]);_0x1c710f['offset']=qs[_0x96bd('0x31')](_0x5996ef[_0x96bd('0x44')][_0x96bd('0x31')]);}_0x1c710f['order']=qs['sort'](_0x5996ef[_0x96bd('0x44')][_0x96bd('0x4f')]);_0x1c710f[_0x96bd('0x50')]=qs[_0x96bd('0x46')](_['pick'](_0x5996ef['query'],_0x38bdfc[_0x96bd('0x46')]));_0x1c710f[_0x96bd('0x50')][_0x96bd('0x69')]=_0x4817bd['id'];if(_0x5996ef[_0x96bd('0x44')][_0x96bd('0x52')]){_0x1c710f[_0x96bd('0x50')]=_[_0x96bd('0x6a')](_0x1c710f[_0x96bd('0x50')],{'$or':_[_0x96bd('0x3e')](_0x1c710f['attributes'],function(_0x27b674){var _0x139bba={};_0x139bba[_0x27b674]={'$like':'%'+_0x5996ef[_0x96bd('0x44')][_0x96bd('0x52')]+'%'};return _0x139bba;})});}_0x1c710f=_[_0x96bd('0x6a')]({},_0x1c710f,_0x5996ef[_0x96bd('0x54')]);return db['Disposition'][_0x96bd('0x30')]({'where':_0x1c710f[_0x96bd('0x50')]})[_0x96bd('0x37')](function(_0x17c0bf){_0x5b2046[_0x96bd('0x30')]=_0x17c0bf;if(_0x5996ef[_0x96bd('0x44')]['includeAll']){_0x1c710f[_0x96bd('0x55')]=[{'all':!![]}];}return db['Disposition'][_0x96bd('0x56')](_0x1c710f);})[_0x96bd('0x37')](function(_0x3ff703){_0x5b2046[_0x96bd('0x57')]=_0x3ff703;return _0x5b2046;});}})['then'](respondWithFilteredResult(_0x201703,_0x1c710f))[_0x96bd('0x2a')](handleError(_0x201703,null));};exports['removeDispositions']=function(_0x3c7647,_0x4a3883,_0x398e03){return db[_0x96bd('0x3f')][_0x96bd('0x5b')]({'where':{'id':_0x3c7647['params']['id']}})[_0x96bd('0x37')](handleEntityNotFound(_0x4a3883,null))[_0x96bd('0x37')](function(_0xcba8a4){if(_0xcba8a4){return _0xcba8a4[_0x96bd('0x6b')](_0x3c7647['query']['ids']);}})[_0x96bd('0x37')](respondWithStatusCode(_0x4a3883,null))['catch'](handleError(_0x4a3883,null));};exports['addAnswer']=function(_0x503764,_0x424597,_0x15cac4){if(_0x503764['body']['id']){delete _0x503764[_0x96bd('0x5d')]['id'];}return db['ChatWebsite'][_0x96bd('0x5b')]({'where':{'id':_0x503764[_0x96bd('0x59')]['id']}})[_0x96bd('0x37')](handleEntityNotFound(_0x424597,null))[_0x96bd('0x37')](function(_0x470e30){if(_0x470e30){_0x503764[_0x96bd('0x5d')][_0x96bd('0x69')]=_0x470e30['id'];return db['CannedAnswer']['create'](_0x503764[_0x96bd('0x5d')]);}})['then'](respondWithResult(_0x424597,null))[_0x96bd('0x2a')](handleError(_0x424597,null));};exports['getAnswers']=function(_0x3fa472,_0x9a4880,_0x4d18dc){var _0x164642={'raw':![],'where':{}};var _0xdc57e4={};var _0x1d8932={'count':0x0,'rows':[]};return db[_0x96bd('0x3f')][_0x96bd('0x6c')]({'where':{'id':_0x3fa472['params']['id']}})['then'](handleEntityNotFound(_0x9a4880,null))['then'](function(_0x304670){if(_0x304670){_0xdc57e4[_0x96bd('0x48')]=_['keys'](db[_0x96bd('0x6d')][_0x96bd('0x40')]);_0xdc57e4['query']=_[_0x96bd('0x45')](_0x3fa472[_0x96bd('0x44')]);_0xdc57e4[_0x96bd('0x46')]=_[_0x96bd('0x47')](_0xdc57e4[_0x96bd('0x48')],_0xdc57e4[_0x96bd('0x44')]);_0x164642[_0x96bd('0x49')]=_[_0x96bd('0x47')](_0xdc57e4[_0x96bd('0x48')],qs[_0x96bd('0x4a')](_0x3fa472[_0x96bd('0x44')][_0x96bd('0x4a')]));_0x164642[_0x96bd('0x49')]=_0x164642[_0x96bd('0x49')][_0x96bd('0x4b')]?_0x164642['attributes']:_0xdc57e4[_0x96bd('0x48')];if(!_0x3fa472['query'][_0x96bd('0x4c')]('nolimit')){_0x164642[_0x96bd('0x2f')]=qs[_0x96bd('0x2f')](_0x3fa472[_0x96bd('0x44')][_0x96bd('0x2f')]);_0x164642[_0x96bd('0x31')]=qs[_0x96bd('0x31')](_0x3fa472['query'][_0x96bd('0x31')]);}_0x164642[_0x96bd('0x4e')]=qs[_0x96bd('0x4f')](_0x3fa472['query']['sort']);_0x164642['where']=qs[_0x96bd('0x46')](_[_0x96bd('0x51')](_0x3fa472[_0x96bd('0x44')],_0xdc57e4[_0x96bd('0x46')]));_0x164642['where'][_0x96bd('0x69')]=_0x304670['id'];if(_0x3fa472[_0x96bd('0x44')][_0x96bd('0x52')]){_0x164642[_0x96bd('0x50')]=_[_0x96bd('0x6a')](_0x164642['where'],{'$or':_[_0x96bd('0x3e')](_0x164642[_0x96bd('0x49')],function(_0x5ab3cb){var _0x497cef={};_0x497cef[_0x5ab3cb]={'$like':'%'+_0x3fa472['query'][_0x96bd('0x52')]+'%'};return _0x497cef;})});}_0x164642=_['merge']({},_0x164642,_0x3fa472[_0x96bd('0x54')]);return db[_0x96bd('0x6d')][_0x96bd('0x30')]({'where':_0x164642[_0x96bd('0x50')]})[_0x96bd('0x37')](function(_0x8b580){_0x1d8932['count']=_0x8b580;if(_0x3fa472[_0x96bd('0x44')]['includeAll']){_0x164642[_0x96bd('0x55')]=[{'all':!![]}];}return db[_0x96bd('0x6d')]['findAll'](_0x164642);})[_0x96bd('0x37')](function(_0x368f04){_0x1d8932[_0x96bd('0x57')]=_0x368f04;return _0x1d8932;});}})[_0x96bd('0x37')](respondWithFilteredResult(_0x9a4880,_0x164642))['catch'](handleError(_0x9a4880,null));};exports['removeAnswers']=function(_0x3bc40a,_0x4b338e,_0x10fcbd){return db['ChatWebsite'][_0x96bd('0x5b')]({'where':{'id':_0x3bc40a['params']['id']}})[_0x96bd('0x37')](handleEntityNotFound(_0x4b338e,null))[_0x96bd('0x37')](function(_0xba0c98){if(_0xba0c98){return _0xba0c98[_0x96bd('0x6e')](_0x3bc40a['query'][_0x96bd('0x6f')]);}})[_0x96bd('0x37')](respondWithStatusCode(_0x4b338e,null))[_0x96bd('0x2a')](handleError(_0x4b338e,null));};exports[_0x96bd('0x70')]=function(_0x1d5d3b,_0x5cc66f,_0x5f3b16){_0x1d5d3b['body']['sitepic']=_0x1d5d3b[_0x96bd('0x71')][_0x96bd('0x72')];return db['ChatWebsite']['find']({'where':{'id':_0x1d5d3b[_0x96bd('0x59')]['id']}})[_0x96bd('0x37')](handleEntityNotFound(_0x5cc66f,null))[_0x96bd('0x37')](saveUpdates(_0x1d5d3b[_0x96bd('0x5d')],null))[_0x96bd('0x37')](respondWithResult(_0x5cc66f,null))[_0x96bd('0x2a')](handleError(_0x5cc66f,null));};exports['addAvatar']=function(_0x25a9d5,_0x4a8d5f,_0x60c722){_0x25a9d5[_0x96bd('0x5d')][_0x96bd('0x73')]=_0x25a9d5[_0x96bd('0x71')][_0x96bd('0x72')];return db[_0x96bd('0x3f')][_0x96bd('0x5b')]({'where':{'id':_0x25a9d5['params']['id']}})[_0x96bd('0x37')](handleEntityNotFound(_0x4a8d5f,null))[_0x96bd('0x37')](saveUpdates(_0x25a9d5[_0x96bd('0x5d')],null))[_0x96bd('0x37')](respondWithResult(_0x4a8d5f,null))[_0x96bd('0x2a')](handleError(_0x4a8d5f,null));};exports[_0x96bd('0x74')]=function(_0x55d08b,_0xa779be,_0xe47afe){_0x55d08b[_0x96bd('0x5d')]['customerAvatar']=_0x55d08b[_0x96bd('0x71')][_0x96bd('0x72')];return db[_0x96bd('0x3f')]['find']({'where':{'id':_0x55d08b[_0x96bd('0x59')]['id']}})[_0x96bd('0x37')](handleEntityNotFound(_0xa779be,null))['then'](saveUpdates(_0x55d08b[_0x96bd('0x5d')],null))['then'](respondWithResult(_0xa779be,null))[_0x96bd('0x2a')](handleError(_0xa779be,null));};exports[_0x96bd('0x75')]=function(_0x4c710f,_0x50d651,_0x529d74){_0x4c710f[_0x96bd('0x5d')][_0x96bd('0x76')]=_0x4c710f['file'][_0x96bd('0x72')];return db[_0x96bd('0x3f')][_0x96bd('0x5b')]({'where':{'id':_0x4c710f['params']['id']}})[_0x96bd('0x37')](handleEntityNotFound(_0x50d651,null))[_0x96bd('0x37')](saveUpdates(_0x4c710f[_0x96bd('0x5d')],null))['then'](respondWithResult(_0x50d651,null))[_0x96bd('0x2a')](handleError(_0x50d651,null));};exports[_0x96bd('0x77')]=function(_0x3ed979,_0x6d964a,_0x15d05f){var _0x1fc65f=path[_0x96bd('0x78')](config[_0x96bd('0x79')],_0x96bd('0x7a'));var _0x17af73={'where':{'id':_0x3ed979['params']['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x1b4a70=![];return require(_0x96bd('0x7b'))[_0x96bd('0x7c')]()[_0x96bd('0x37')](function(_0x56ffd7){if(_0x56ffd7){_0x1b4a70=_0x56ffd7['custom'];}})[_0x96bd('0x37')](function(){return db['ChatWebsite']['find'](_0x17af73);})[_0x96bd('0x37')](handleEntityNotFound(_0x6d964a,null))[_0x96bd('0x37')](function(_0x18750d){if(_0x18750d){if(!_[_0x96bd('0x7d')](_0x18750d['sitepic'])){if(fs[_0x96bd('0x7e')](path[_0x96bd('0x78')](config[_0x96bd('0x79')],_0x96bd('0x7f'),_0x18750d[_0x96bd('0x80')]))&&_0x1b4a70){_0x1fc65f=path[_0x96bd('0x78')](config[_0x96bd('0x79')],_0x96bd('0x7f'),_0x18750d[_0x96bd('0x80')]);}}return _0x6d964a['download'](_0x1fc65f);}})[_0x96bd('0x2a')](handleError(_0x6d964a,null));};exports[_0x96bd('0x81')]=function(_0x3da916,_0x44d5ed,_0x257c9c){var _0x33b1c2=path[_0x96bd('0x78')](config[_0x96bd('0x79')],_0x96bd('0x82'));var _0x44f818={'where':{'id':_0x3da916['params']['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x96bd('0x3f')]['find'](_0x44f818)['then'](handleEntityNotFound(_0x44d5ed,null))['then'](function(_0x306ccd){if(_0x306ccd){if(!_[_0x96bd('0x7d')](_0x306ccd[_0x96bd('0x73')])){if(fs[_0x96bd('0x7e')](path[_0x96bd('0x78')](config[_0x96bd('0x79')],_0x96bd('0x83'),_0x306ccd[_0x96bd('0x73')]))){_0x33b1c2=path[_0x96bd('0x78')](config['root'],_0x96bd('0x83'),_0x306ccd[_0x96bd('0x73')]);}}return _0x44d5ed[_0x96bd('0x84')](_0x33b1c2);}})[_0x96bd('0x2a')](handleError(_0x44d5ed,null));};exports['getCustomerAvatar']=function(_0x5998fb,_0x5bff00,_0x384854){var _0x1e89d0=path['join'](config[_0x96bd('0x79')],_0x96bd('0x85'));var _0x49a56c={'where':{'id':_0x5998fb['params']['id']},'attributes':['id',_0x96bd('0x86'),_0x96bd('0x87')],'raw':!![]};return db[_0x96bd('0x3f')][_0x96bd('0x5b')](_0x49a56c)[_0x96bd('0x37')](handleEntityNotFound(_0x5bff00,null))[_0x96bd('0x37')](function(_0x4014ce){if(_0x4014ce){if(!_[_0x96bd('0x7d')](_0x4014ce[_0x96bd('0x86')])){if(fs[_0x96bd('0x7e')](path[_0x96bd('0x78')](config['root'],'server/files/images/avatars/',_0x4014ce[_0x96bd('0x86')]))&&_0x4014ce[_0x96bd('0x87')]){_0x1e89d0=path['join'](config['root'],_0x96bd('0x83'),_0x4014ce['customerAvatar']);}}return _0x5bff00[_0x96bd('0x84')](_0x1e89d0);}})[_0x96bd('0x2a')](handleError(_0x5bff00,null));};exports[_0x96bd('0x88')]=function(_0x47d3f0,_0x29257a,_0x45fa72){var _0x2b94ea=path[_0x96bd('0x78')](config[_0x96bd('0x79')],_0x96bd('0x89'));var _0x540284={'where':{'id':_0x47d3f0['params']['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x96bd('0x3f')][_0x96bd('0x5b')](_0x540284)[_0x96bd('0x37')](handleEntityNotFound(_0x29257a,null))[_0x96bd('0x37')](function(_0x46a7af){if(_0x46a7af){if(!_[_0x96bd('0x7d')](_0x46a7af[_0x96bd('0x76')])){if(fs[_0x96bd('0x7e')](path[_0x96bd('0x78')](config[_0x96bd('0x79')],_0x96bd('0x83'),_0x46a7af['systemAvatar']))){_0x2b94ea=path[_0x96bd('0x78')](config[_0x96bd('0x79')],_0x96bd('0x83'),_0x46a7af[_0x96bd('0x76')]);}}return _0x29257a['download'](_0x2b94ea);}})['catch'](handleError(_0x29257a,null));};exports[_0x96bd('0x8a')]=function(_0x460c75,_0x20be5b,_0x47a0be){var _0x30d5f9=require(_0x96bd('0x8b'));var _0x2c9114=new _0x30d5f9();var _0x294c3a=_0x2c9114[_0x96bd('0x8c')](_0x460c75[_0x96bd('0x8d')][_0x96bd('0x8e')])[_0x96bd('0x8f')]();var _0x4ff2a7={'body':_0x460c75[_0x96bd('0x5d')],'channel':_0x96bd('0x90')};var _0x23d460=[];var _0x2c3e81=[];var _0x367f9c={};var _0x59eea1=![];return db[_0x96bd('0x91')]['describe']()[_0x96bd('0x37')](function(_0x279057){if(!_0x279057){throw new db[(_0x96bd('0x92'))][(_0x96bd('0x93'))](_0x96bd('0x94'));}_0x23d460=_[_0x96bd('0x95')](_[_0x96bd('0x45')](_0x279057),[_0x96bd('0x96'),_0x96bd('0x97')]);_0x2c3e81=_[_0x96bd('0x95')](_[_0x96bd('0x45')](_0x279057),[_0x96bd('0x96'),'updatedAt',_0x96bd('0x98'),_0x96bd('0x99')]);if(_0x460c75[_0x96bd('0x5d')]['id']){delete _0x460c75['body']['id'];}if(_[_0x96bd('0x7d')](_0x460c75[_0x96bd('0x5d')][_0x96bd('0x9a')])){throw new db[(_0x96bd('0x92'))][(_0x96bd('0x93'))](_0x96bd('0x9b'));}if(_[_0x96bd('0x7d')](_0x460c75[_0x96bd('0x5d')]['body'])||_0x460c75[_0x96bd('0x5d')][_0x96bd('0x5d')]===''){throw new db['Sequelize'][(_0x96bd('0x93'))](_0x96bd('0x9c'));}if(_[_0x96bd('0x7d')](_0x460c75[_0x96bd('0x5d')]['mapKey'])){throw new db[(_0x96bd('0x92'))]['ValidationError'](_0x96bd('0x9d')+_0x2c3e81);}if(!_[_0x96bd('0x9e')](_0x2c3e81,_0x460c75[_0x96bd('0x5d')]['mapKey'])){throw new db['Sequelize'][(_0x96bd('0x93'))](_0x96bd('0x9f')+_0x2c3e81);}_0x367f9c[_0x460c75[_0x96bd('0x5d')]['mapKey']]=_0x460c75[_0x96bd('0x5d')][_0x96bd('0x9a')];})[_0x96bd('0x37')](function(){return db[_0x96bd('0x3f')][_0x96bd('0x5b')]({'where':{'id':_0x460c75[_0x96bd('0x59')]['id']},'include':[{'model':db[_0x96bd('0xa0')],'as':_0x96bd('0xa1'),'include':[{'model':db[_0x96bd('0x91')],'as':'Contacts','where':_0x367f9c,'limit':0x1,'order':[[_0x96bd('0x97'),_0x96bd('0xa2')]]}]},{'model':db[_0x96bd('0xa3')],'as':'Applications'}]});})[_0x96bd('0x37')](handleEntityNotFound(_0x20be5b,null))[_0x96bd('0x37')](function(_0x625ec5){if(_0x625ec5&&_0x625ec5[_0x96bd('0xa1')]){_0x4ff2a7[_0x96bd('0xa4')]=_0x625ec5;_0x4ff2a7[_0x96bd('0xa5')]=_0x625ec5[_0x96bd('0xa6')];_0x4ff2a7[_0x96bd('0xa7')]=_0x625ec5[_0x96bd('0xa1')];_0x4ff2a7['applications']=_[_0x96bd('0xa8')](_0x4ff2a7['applications'],['priority'],[_0x96bd('0xa9')]);if(_0x4ff2a7[_0x96bd('0xa4')][_0x96bd('0xa6')]){delete _0x4ff2a7[_0x96bd('0xa4')][_0x96bd('0xa6')];}if(_0x4ff2a7[_0x96bd('0xa4')][_0x96bd('0xa1')]&&_0x4ff2a7[_0x96bd('0xa4')][_0x96bd('0xa1')][_0x96bd('0xaa')][_0x96bd('0x4b')]){return _0x4ff2a7[_0x96bd('0xa4')][_0x96bd('0xa1')][_0x96bd('0xaa')][0x0];}var _0x34bd46=_[_0x96bd('0x19')](_0x460c75[_0x96bd('0x5d')],{'firstName':_0x460c75[_0x96bd('0x5d')][_0x96bd('0x9a')],'ListId':_0x625ec5[_0x96bd('0x99')]});_0x34bd46[_0x460c75['body'][_0x96bd('0xab')]]=_0x460c75[_0x96bd('0x5d')]['from'];return db[_0x96bd('0x91')]['create'](_0x34bd46,{'fields':_0x23d460,'raw':!![]});}})[_0x96bd('0x37')](handleEntityNotFound(_0x20be5b,null))[_0x96bd('0x37')](function(_0xd3ba05){_0x4ff2a7[_0x96bd('0xac')]=_0xd3ba05;var _0x6a9b4c=_0x460c75[_0x96bd('0x5d')][_0x96bd('0xad')];if(_0x460c75['headers'][_0x96bd('0xae')]){_0x6a9b4c=_0x460c75[_0x96bd('0x8d')][_0x96bd('0xae')];}else if(_0x460c75[_0x96bd('0x8d')][_0x96bd('0xaf')]){_0x6a9b4c=_[_0x96bd('0xb0')](_0x460c75[_0x96bd('0x8d')][_0x96bd('0xaf')]['split'](','));}if(_0xd3ba05){var _0x2134e0={'ContactId':_0xd3ba05['id'],'ChatWebsiteId':_0x460c75[_0x96bd('0x59')]['id'],'from':(_0xd3ba05['firstName']||'')+'\x20'+(_0xd3ba05['lastName']||''),'customerIp':_0x6a9b4c,'customerPort':_0x460c75[_0x96bd('0x8d')][_0x96bd('0xb1')]?_0x460c75[_0x96bd('0x8d')][_0x96bd('0xb1')]:null,'referer':_0x460c75['body'][_0x96bd('0xb2')],'browserName':_0x294c3a['browser'][_0x96bd('0x53')]&&_0x294c3a[_0x96bd('0xb3')][_0x96bd('0xb4')]?util[_0x96bd('0xb5')](_0x96bd('0xb6'),_0x294c3a[_0x96bd('0xb3')][_0x96bd('0x53')],_0x294c3a['browser'][_0x96bd('0xb4')]):_0x96bd('0xb7'),'browserVersion':_0x294c3a[_0x96bd('0xb3')][_0x96bd('0xb4')]||_0x96bd('0xb7'),'osName':util['format'](_0x96bd('0xb6'),_0x294c3a['os'][_0x96bd('0x53')],_0x294c3a['os']['version']),'osVersion':_0x294c3a['os'][_0x96bd('0xb4')],'deviceModel':_0x294c3a[_0x96bd('0xb8')]['model']&&_0x294c3a[_0x96bd('0xb8')]['vendor']?util[_0x96bd('0xb5')](_0x96bd('0xb9'),_0x294c3a['device']['model'],_0x294c3a[_0x96bd('0xb8')][_0x96bd('0xba')],_0x294c3a[_0x96bd('0xb8')][_0x96bd('0x42')]):null,'deviceVendor':_0x294c3a[_0x96bd('0xb8')][_0x96bd('0xba')],'deviceType':_0x294c3a[_0x96bd('0xb8')]['type'],'formData':JSON[_0x96bd('0x26')](_0x460c75['body'])};var _0x12e710={'ChatWebsiteId':_0x460c75[_0x96bd('0x59')]['id'],'closed':![]};if(_0x460c75[_0x96bd('0x5d')]['threadId']){_0x12e710[_0x96bd('0xbb')]=_0x460c75[_0x96bd('0x5d')][_0x96bd('0xbb')];return db[_0x96bd('0xbc')][_0x96bd('0x5b')]({'where':_0x12e710})[_0x96bd('0x37')](function(_0x1e1553){if(_0x1e1553){return[_0x1e1553,![]];}_0x2134e0[_0x96bd('0xbb')]=_0x460c75[_0x96bd('0x5d')][_0x96bd('0xbb')];_0x2134e0[_0x96bd('0xbd')]=_0x460c75[_0x96bd('0x5d')]['externalUrl'];return db[_0x96bd('0xbc')]['create'](_0x2134e0)[_0x96bd('0x37')](function(_0x1fd062){return[_0x1fd062,!![]];});});}_0x12e710['ContactId']=_0xd3ba05['id'];if(_0x460c75[_0x96bd('0x5d')][_0x96bd('0xbe')]&&_0x460c75[_0x96bd('0x5d')][_0x96bd('0xbe')]['id']){_0x12e710['id']=_0x460c75['body']['interaction']['id'];return db[_0x96bd('0xbc')][_0x96bd('0x5b')]({'where':_0x12e710})[_0x96bd('0x37')](function(_0x22d979){if(_0x22d979){return[_0x22d979,![]];}return db[_0x96bd('0xbc')]['create'](_0x2134e0)[_0x96bd('0x37')](function(_0x1fec04){return[_0x1fec04,!![]];});});}return db[_0x96bd('0xbc')][_0x96bd('0x5c')](_0x2134e0)[_0x96bd('0x37')](function(_0x51121b){return[_0x51121b,!![]];});}})[_0x96bd('0xbf')](function(_0x3167a2,_0x37e1c3){if(_0x3167a2){_0x59eea1=_0x37e1c3;if(!_0x37e1c3){var _0x18212d={'from':(_0x4ff2a7['contact'][_0x96bd('0xc0')]||'')+'\x20'+(_0x4ff2a7[_0x96bd('0xac')][_0x96bd('0xc1')]||'')};if(_0x460c75[_0x96bd('0x5d')][_0x96bd('0xbb')]&&_0x460c75['body'][_0x96bd('0xc2')]&&_0x460c75[_0x96bd('0x5d')][_0x96bd('0xbb')]!=_0x460c75[_0x96bd('0x5d')]['messageId']){_0x18212d[_0x96bd('0xbb')]=_0x460c75[_0x96bd('0x5d')][_0x96bd('0xc2')];}return _0x3167a2[_0x96bd('0x36')](_0x18212d);}else{return _0x3167a2;}}})[_0x96bd('0x37')](function(_0x2edc4c){_0x4ff2a7[_0x96bd('0xbe')]=_0x2edc4c['get']({'plain':!![]});_0x4ff2a7[_0x96bd('0xbe')]['created']=_0x59eea1;if(_0x4ff2a7[_0x96bd('0xbe')]['created']){if(_0x4ff2a7[_0x96bd('0xa4')][_0x96bd('0xc3')]){_0x4ff2a7[_0x96bd('0xa5')]['push']({'id':0x0,'priority':_0x4ff2a7['applications'][_0x96bd('0x4b')]+0x1,'app':_0x96bd('0xc4'),'appdata':_0x96bd('0xc5'),'interval':_0x96bd('0xc6')});}}return db[_0x96bd('0xc7')][_0x96bd('0x5c')]({'body':_0x460c75['body'][_0x96bd('0x5d')],'ChatWebsiteId':_0x460c75[_0x96bd('0x59')]['id'],'ChatInteractionId':_0x2edc4c['id'],'direction':'in','ContactId':_0x4ff2a7[_0x96bd('0xac')]['id'],'AttachmentId':_0x460c75[_0x96bd('0x5d')][_0x96bd('0xc8')]});})[_0x96bd('0x37')](function(_0x43f423){_0x4ff2a7[_0x96bd('0x28')]=_0x43f423;if(_0x4ff2a7[_0x96bd('0xbe')][_0x96bd('0xc9')]){return db[_0x96bd('0xca')][_0x96bd('0x5b')]({'attributes':['id',_0x96bd('0x53')],'where':{'id':_0x4ff2a7[_0x96bd('0xbe')][_0x96bd('0xc9')]}})[_0x96bd('0x37')](function(_0x149f02){if(_0x149f02){_0x4ff2a7[_0x96bd('0xa5')][_0x96bd('0xcb')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x149f02['name']+','+(_0x4ff2a7[_0x96bd('0xa4')][_0x96bd('0xcc')]||0xa),'interval':_0x96bd('0xc6')});_0x4ff2a7[_0x96bd('0xcd')]=!![];}return respondWithRpcPromise(_0x96bd('0xce'),_0x96bd('0xcf'),_0x4ff2a7);});}return respondWithRpcPromise(_0x96bd('0xce'),'startRouting',_0x4ff2a7);})[_0x96bd('0x37')](function(_0x4119dd){respondWithRpcPromise(_0x96bd('0xd0'),_0x96bd('0xd0'),{'event':_0x96bd('0x8a'),'message':_0x4119dd},client9002);return _0x4119dd;})['then'](respondWithResult(_0x20be5b,null))['catch'](handleError(_0x20be5b,null));};exports['offline']=function(_0x54df7b,_0x2cd84d,_0x3225ad){var _0xdc4a,_0xa10c1a,_0x2f5554;var _0x484260=[];var _0x5aea5a=[];var _0x51e802={};var _0x5d95ea=_0x54df7b[_0x96bd('0xd1')]||[];var _0x443950=[];var _0x1f07f6;return db['CmContact']['describe']()[_0x96bd('0x37')](function(_0x200bf1){if(!_0x200bf1){throw new db['Sequelize'][(_0x96bd('0x93'))](_0x96bd('0x94'));}_0x5aea5a=_[_0x96bd('0x95')](_['keys'](_0x200bf1),[_0x96bd('0x96'),'updatedAt']);_0x484260=_[_0x96bd('0x95')](_[_0x96bd('0x45')](_0x200bf1),[_0x96bd('0x96'),_0x96bd('0x97'),_0x96bd('0x98'),'ListId']);if(_0x54df7b[_0x96bd('0x5d')]['id']){delete _0x54df7b['body']['id'];}if(_[_0x96bd('0x7d')](_0x54df7b[_0x96bd('0x5d')][_0x96bd('0x9a')])){throw _0x2cd84d[_0x96bd('0x2b')](0x1f4)[_0x96bd('0x3c')](new db[(_0x96bd('0x92'))]['ValidationError'](_0x96bd('0x9b')));}if(_[_0x96bd('0x7d')](_0x54df7b[_0x96bd('0x5d')]['body'])||_0x54df7b[_0x96bd('0x5d')]['body']===''){throw _0x2cd84d[_0x96bd('0x2b')](0x1f4)['send'](new db[(_0x96bd('0x92'))][(_0x96bd('0x93'))](_0x96bd('0x9c')));}if(_[_0x96bd('0x7d')](_0x54df7b['body'][_0x96bd('0xd2')])){throw _0x2cd84d['status'](0x1f4)[_0x96bd('0x3c')](new db[(_0x96bd('0x92'))][(_0x96bd('0x93'))](_0x96bd('0xd3')+_0x484260));}if(!_[_0x96bd('0x9e')](_0x484260,_0x54df7b[_0x96bd('0x5d')][_0x96bd('0xd2')])){throw _0x2cd84d[_0x96bd('0x2b')](0x1f4)['send'](new db[(_0x96bd('0x92'))][(_0x96bd('0x93'))](_0x96bd('0xd4')+_0x484260));}_0x51e802[_0x54df7b['body'][_0x96bd('0xd2')]]=_0x54df7b['body']['from'];})[_0x96bd('0x37')](function(){return db[_0x96bd('0x3f')][_0x96bd('0x5b')]({'where':{'id':_0x54df7b[_0x96bd('0x59')]['id']},'include':[{'model':db[_0x96bd('0xa0')],'as':_0x96bd('0xa1')},{'model':db[_0x96bd('0xd5')],'as':_0x96bd('0xd5')}]});})[_0x96bd('0x37')](handleEntityNotFound(_0x2cd84d,null))[_0x96bd('0x37')](function(_0x225cab){if(_0x225cab&&_0x225cab[_0x96bd('0xa1')]){_0xa10c1a=_0x225cab;var _0x37fbd7=_[_0x96bd('0x19')](_0x54df7b['body'],{'firstName':_0x54df7b[_0x96bd('0x5d')]['from'],'phone':_0x54df7b[_0x96bd('0x5d')][_0x96bd('0x9a')],'ListId':_0x225cab[_0x96bd('0x99')]});_0x37fbd7[_0x54df7b[_0x96bd('0x5d')]['mapKeyOffline']]=_0x54df7b[_0x96bd('0x5d')][_0x96bd('0x9a')];return db['CmContact'][_0x96bd('0xd6')]({'where':_0x51e802,'defaults':_0x37fbd7});}})[_0x96bd('0xbf')](function(_0xb7dc5f){if(_0xb7dc5f){_0x2f5554=_0xb7dc5f;var _0x286718=fs[_0x96bd('0xd7')](path[_0x96bd('0x78')](config['root'],_0x96bd('0xd8')),_0x96bd('0xd9'));var _0x16ebba=ejs['render'](_0x286718,{'body':_[_0x96bd('0xda')](_0x54df7b[_0x96bd('0x5d')]['body']),'bodyTitle':_0xa10c1a[_0x96bd('0xdb')]});return db[_0x96bd('0xdc')][_0x96bd('0x5c')]({'body':_0x16ebba,'ContactId':_0xb7dc5f['id'],'ChatWebsiteId':_0xa10c1a['id']});}})['then'](function(_0x23af6d){_0x1f07f6=_0x23af6d;if(_0x5d95ea['length']){var _0x1cc8e2=_0x5d95ea[_0x96bd('0x3e')](function(_0x56a458){return{'name':_0x56a458[_0x96bd('0xdd')],'basename':_0x56a458['filename'],'type':_0x56a458['mimetype'],'ChatOfflineMessageId':_0x23af6d['id']};});_0x443950=_0x1cc8e2[_0x96bd('0x3e')](_0x25500d=>{var _0x2971d0={'filename':_0x25500d[_0x96bd('0x53')],'path':path['join'](config[_0x96bd('0x79')],_0x96bd('0xde'),_0x96bd('0xd1'),_0x96bd('0xdf'),_0x96bd('0xe0'),_0x25500d[_0x96bd('0xe1')])};return _0x2971d0;});if(!_0xa10c1a['openNewInteraction']){return db[_0x96bd('0xe2')][_0x96bd('0xe3')](function(_0x46ca5e){return db[_0x96bd('0xe4')][_0x96bd('0xe5')](_0x1cc8e2,{'transaction':_0x46ca5e});});}}})[_0x96bd('0x37')](function(){if(_0x1f07f6){_0xdc4a=_0x1f07f6;return db[_0x96bd('0xd5')][_0x96bd('0x6c')]({'where':{'active':!![]},'include':[{'model':db[_0x96bd('0xe6')],'as':_0x96bd('0xe7'),'raw':!![]}]});}})[_0x96bd('0x37')](function(_0x1612f4){if(_0x1612f4&&_0x1612f4[_0x96bd('0xe7')]&&_0xa10c1a[_0x96bd('0xe8')]&&_0xa10c1a[_0x96bd('0xe9')]){var _0x21d0fb={'tls':{'rejectUnauthorized':![]}};if(_0x1612f4[_0x96bd('0xe7')][_0x96bd('0xea')]){_0x21d0fb[_0x96bd('0xea')]=_0x1612f4[_0x96bd('0xe7')][_0x96bd('0xea')];}else{_0x21d0fb[_0x96bd('0xeb')]=_0x1612f4[_0x96bd('0xe7')][_0x96bd('0xeb')];_0x21d0fb[_0x96bd('0xec')]=_0x1612f4['Smtp'][_0x96bd('0xec')];_0x21d0fb[_0x96bd('0xed')]=_0x1612f4[_0x96bd('0xe7')][_0x96bd('0xed')];}if(_0x1612f4[_0x96bd('0xe7')][_0x96bd('0xee')]){_0x21d0fb[_0x96bd('0xef')]={'user':_0x1612f4[_0x96bd('0xe7')]['user'],'pass':_0x1612f4['Smtp']['pass']};}return respondWithRpcPromise(_0x96bd('0xf0'),'sendMail',{'account':_0x21d0fb,'message':{'from':util[_0x96bd('0xb5')](_0x96bd('0xf1'),_0x1612f4['name'],_0x1612f4[_0x96bd('0xf2')]||_0x1612f4[_0x96bd('0xe7')][_0x96bd('0x60')]),'to':_0xa10c1a[_0x96bd('0xe9')],'subject':_0xa10c1a['offlineMessageSubject'],'html':_0xdc4a[_0x96bd('0x5d')],'attachments':_0x443950}},client9003)[_0x96bd('0x37')](function(){return _0xdc4a;})[_0x96bd('0x2a')](function(_0x830daf){console[_0x96bd('0x27')](_0x830daf);});}})[_0x96bd('0x37')](function(){if(_0xa10c1a&&_0xa10c1a[_0x96bd('0xf3')]&&_0xa10c1a[_0x96bd('0xf4')]){var _0x588647=[];if(_0x5d95ea[_0x96bd('0x4b')]){_0x588647=_0x5d95ea['map'](function(_0x2a7d69){return{'name':_0x2a7d69['originalname'],'basename':_0x2a7d69[_0x96bd('0x72')],'type':_0x2a7d69[_0x96bd('0xf5')],'ChatOfflineMessageId':_0x1f07f6['id']};});}var _0x5b811c;if(!_[_0x96bd('0x7d')](_0xa10c1a['subjectOffline'])){var _0x306afa=_[_0x96bd('0x3e')](_0x54df7b[_0x96bd('0x5d')],function(_0x3a24a2){return _0x3a24a2;});var _0x2ae12e=_[_0x96bd('0xf6')](_0x306afa)[0x0];var _0x24d4fb=_['mapValues'](_0x2ae12e,function(_0x50d8f8){return _0x50d8f8;});_0x5b811c=_0x24d4fb[0x1][_0xa10c1a[_0x96bd('0xf7')]];}var _0x22a244={'from':_0x2f5554[_0x96bd('0xf2')],'firstName':_0x2f5554[_0x96bd('0xc0')],'lastName':_0x2f5554[_0x96bd('0xc1')],'mapKey':'email','message':{'from':_0x2f5554['email'],'to':_0xa10c1a['MailAccount'][_0x96bd('0xf2')],'cc':'','subject':_[_0x96bd('0x7d')](_0x5b811c)?_0xa10c1a[_0x96bd('0xf8')]:_0x5b811c,'messageId':'','sentAt':new Date(),'attach':_0x588647[_0x96bd('0x4b')],'attachments':_0x588647,'originChannel':_0x96bd('0xf9'),'ChatWebsiteId':_0xa10c1a['id'],'ChatOfflineMessageId':_0xdc4a['id'],'originTo':_0xa10c1a[_0x96bd('0xd5')]['email']},'body':_0xdc4a[_0x96bd('0x5d')]};var _0x181c72={'account':{'id':_0xa10c1a[_0x96bd('0xf4')]},'body':_0x22a244,'log':_0x96bd('0xfa')};return respondWithRpcPromise(_0x96bd('0xfa'),_0x96bd('0xfb'),_0x181c72,client9001)['then'](function(){return _0xdc4a;})[_0x96bd('0x2a')](function(_0x22a052){console[_0x96bd('0x27')](_0x22a052);});}return;})[_0x96bd('0x37')](function(){if(_0xdc4a){return _0xdc4a;}})[_0x96bd('0x37')](respondWithResult(_0x2cd84d,null))[_0x96bd('0x2a')](function(_0x3a338c){console[_0x96bd('0x27')](_0x96bd('0x2a'),_0x3a338c);for(var _0x2fa09d of _0x5d95ea){var _0x4bea9f=path[_0x96bd('0x78')](config[_0x96bd('0x79')],_0x96bd('0xde'),_0x96bd('0xd1'),_0x96bd('0xdf'),_0x96bd('0xe0'),_0x2fa09d[_0x96bd('0x72')]);fs_extra[_0x96bd('0xfc')](_0x4bea9f)[_0x96bd('0x2a')](function(_0x58433f){console[_0x96bd('0x27')](_0x96bd('0xfd'),_0x4bea9f,_0x58433f);});}});};exports['addInteraction']=function(_0x19807a,_0x5376b2,_0x50798f){return db[_0x96bd('0xbc')][_0x96bd('0x5b')]({'where':{'id':_0x19807a[_0x96bd('0x59')]['id']}})[_0x96bd('0x37')](handleEntityNotFound(_0x5376b2,null))[_0x96bd('0x37')](function(_0x22cc0a){if(_0x22cc0a){return _0x22cc0a[_0x96bd('0xfe')](_0x19807a[_0x96bd('0x5d')][_0x96bd('0x6f')],_[_0x96bd('0xff')](_0x19807a['body'],['ids','id'])||{});}})[_0x96bd('0x37')](respondWithResult(_0x5376b2,null))[_0x96bd('0x2a')](handleError(_0x5376b2,null));};exports[_0x96bd('0x100')]=function(_0x4512a3,_0xedd1d9,_0x5083e5){var _0x39d748={'raw':![],'where':{}};var _0x382c09={};var _0x5e4c9c={'count':0x0,'rows':[]};return db[_0x96bd('0x3f')][_0x96bd('0x6c')]({'where':{'id':_0x4512a3[_0x96bd('0x59')]['id']}})[_0x96bd('0x37')](handleEntityNotFound(_0xedd1d9,null))[_0x96bd('0x37')](function(_0x36f80f){if(_0x36f80f){_0x382c09[_0x96bd('0x48')]=_['keys'](db['ChatInteraction'][_0x96bd('0x40')]);_0x382c09['query']=_[_0x96bd('0x45')](_0x4512a3[_0x96bd('0x44')]);_0x382c09[_0x96bd('0x46')]=_[_0x96bd('0x47')](_0x382c09[_0x96bd('0x48')],_0x382c09[_0x96bd('0x44')]);_0x39d748['attributes']=_[_0x96bd('0x47')](_0x382c09[_0x96bd('0x48')],qs[_0x96bd('0x4a')](_0x4512a3[_0x96bd('0x44')][_0x96bd('0x4a')]));_0x39d748['attributes']=_0x39d748[_0x96bd('0x49')][_0x96bd('0x4b')]?_0x39d748['attributes']:_0x382c09[_0x96bd('0x48')];if(!_0x4512a3['query'][_0x96bd('0x4c')](_0x96bd('0x4d'))){_0x39d748[_0x96bd('0x2f')]=qs['limit'](_0x4512a3[_0x96bd('0x44')]['limit']);_0x39d748['offset']=qs['offset'](_0x4512a3['query']['offset']);}_0x39d748['order']=qs[_0x96bd('0x4f')](_0x4512a3[_0x96bd('0x44')]['sort']);_0x39d748[_0x96bd('0x50')]=qs[_0x96bd('0x46')](_[_0x96bd('0x51')](_0x4512a3[_0x96bd('0x44')],_0x382c09[_0x96bd('0x46')]));_0x39d748[_0x96bd('0x50')][_0x96bd('0x69')]=_0x36f80f['id'];if(_0x4512a3[_0x96bd('0x44')]['filter']){_0x39d748['where']=_[_0x96bd('0x6a')](_0x39d748[_0x96bd('0x50')],{'$or':_[_0x96bd('0x3e')](_0x39d748[_0x96bd('0x49')],function(_0x30572d){var _0x5d6f67={};_0x5d6f67[_0x30572d]={'$like':'%'+_0x4512a3[_0x96bd('0x44')][_0x96bd('0x52')]+'%'};return _0x5d6f67;})});}_0x39d748=_['merge']({},_0x39d748,_0x4512a3['options']);return db[_0x96bd('0xbc')][_0x96bd('0x30')]({'where':_0x39d748[_0x96bd('0x50')]})[_0x96bd('0x37')](function(_0x585e7c){_0x5e4c9c['count']=_0x585e7c;if(_0x4512a3[_0x96bd('0x44')][_0x96bd('0x101')]){_0x39d748[_0x96bd('0x55')]=[{'model':db[_0x96bd('0x91')],'as':_0x96bd('0x102'),'required':![]},{'model':db['User'],'as':_0x96bd('0x103'),'attributes':['name',_0x96bd('0x104'),_0x96bd('0x105')],'required':![]},{'model':db[_0x96bd('0x106')],'as':_0x96bd('0x107'),'attributes':['id','name',_0x96bd('0x108')],'where':_0x4512a3[_0x96bd('0x44')][_0x96bd('0x109')]?{'id':_0x4512a3[_0x96bd('0x44')][_0x96bd('0x109')]}:undefined,'required':_0x4512a3[_0x96bd('0x44')][_0x96bd('0x109')]?!![]:![]}];}return db['ChatInteraction'][_0x96bd('0x56')](_0x39d748);})[_0x96bd('0x37')](function(_0x563046){_0x5e4c9c[_0x96bd('0x57')]=_0x563046;return _0x5e4c9c;});}})[_0x96bd('0x37')](respondWithFilteredResult(_0xedd1d9,_0x39d748))[_0x96bd('0x2a')](handleError(_0xedd1d9,null));};function iftimePromise(_0x189ac8,_0x1b272e){return respondWithRpcPromise(_0x96bd('0x10a'),_0x96bd('0x10b'),{'command':_0x1b272e[_0x96bd('0x10c')]?util[_0x96bd('0xb5')](_0x96bd('0x10d'),_0x189ac8['interval'],_0x1b272e['timezone']):util['format'](_0x96bd('0x10e'),_0x189ac8['interval'])},client9002)['then'](function(_0x4a5b24){var _0x2a3061=_0x4a5b24&&_0x4a5b24[_0x96bd('0x10f')](_0x96bd('0x110'))>=0x0?!![]:![];logger['info'](_0x96bd('0x111'),_0x1b272e['id'],_0x189ac8['id'],_0x189ac8[_0x96bd('0x112')],_0x2a3061?_0x96bd('0x113'):_0x96bd('0x114'),_0x1b272e[_0x96bd('0x10c')]?_0x1b272e[_0x96bd('0x10c')]:'No\x20timezone');return _0x2a3061;})[_0x96bd('0x2a')](function(_0x2e8104){logger[_0x96bd('0x27')](_0x96bd('0x111'),_0x1b272e['id'],_0x189ac8['id'],_0x189ac8[_0x96bd('0x112')],util['inspect'](_0x2e8104,{'showHidden':![],'depth':null}),_0x1b272e[_0x96bd('0x10c')]?_0x1b272e[_0x96bd('0x10c')]:_0x96bd('0x115'));return![];});}exports[_0x96bd('0x10b')]=function(_0x4ee803,_0x163206,_0x117f57){var _0xa55a53=0x0;var _0x47d5a2=0x0;var _0x2b5f92=![];var _0x42fd79;var _0xbc975e;return db[_0x96bd('0x3f')][_0x96bd('0x5b')]({'where':{'id':_0x4ee803[_0x96bd('0x59')]['id']},'include':[{'model':db[_0x96bd('0x116')],'as':_0x96bd('0x116'),'include':[{'model':db['Interval'],'as':_0x96bd('0x117'),'attributes':['id',_0x96bd('0x112')],'raw':!![]}]}]})[_0x96bd('0x37')](handleEntityNotFound(_0x163206,null))['then'](function(_0x562d1a){if(_0x562d1a){_0x42fd79=_0x562d1a;return _0x562d1a['getProactiveActions']({'raw':!![]});}})[_0x96bd('0x37')](function(_0x5958fb){if(_0x42fd79){if(_0x5958fb){_0xbc975e=_0x5958fb;}}return require('../../config/license/util')[_0x96bd('0x7c')]();})[_0x96bd('0x37')](function(_0x24297b){if(_0x24297b){_0x47d5a2=_0x24297b[_0x96bd('0x118')];_0x2b5f92=_0x24297b[_0x96bd('0x119')];}})['then'](function(){return db[_0x96bd('0xbc')]['count']({'where':{'closed':![]}});})[_0x96bd('0x37')](function(_0x2368a0){_0xa55a53=_0x2368a0;if(_0x47d5a2&&_0x2368a0>_0x47d5a2){return db['License'][_0x96bd('0x6c')]({'where':{'id':0x1}})[_0x96bd('0x37')](function(_0x577f2a){if(_0x577f2a){_0x577f2a['increment'](_0x96bd('0x11a'));}});}})[_0x96bd('0x37')](function(){if(_0x42fd79[_0x96bd('0x116')]&&_0x42fd79[_0x96bd('0x116')]['Intervals']){var _0x447f00=[];for(var _0x5535b6=0x0;_0x5535b6<_0x42fd79['Interval'][_0x96bd('0x117')][_0x96bd('0x4b')];_0x5535b6++){var _0x5ac383=_0x42fd79[_0x96bd('0x116')][_0x96bd('0x117')][_0x5535b6][_0x96bd('0x5e')]({'plain':!![]});_0x447f00[_0x96bd('0x11b')](iftimePromise(_0x5ac383,_0x42fd79));}return BPromise[_0x96bd('0x11c')](_0x447f00)['then'](function(_0x35d421){return _[_0x96bd('0x11d')](_0x35d421);});}else{return!![];}})[_0x96bd('0x37')](function(_0x3120ad){var _0x2b4c3b=fs[_0x96bd('0xd7')](path['join'](config['root'],'server/files/chat/iframe.ejs'),_0x96bd('0xd9'));var _0x458021={'remote':_0x42fd79[_0x96bd('0x11e')],'query':querystring[_0x96bd('0x26')](_[_0x96bd('0x6a')](_0x42fd79[_0x96bd('0x5e')]({'plain':!![]}),{'customerIp':_0x4ee803[_0x96bd('0x8d')][_0x96bd('0xaf')]||_0x4ee803[_0x96bd('0x8d')][_0x96bd('0x11f')]||_0x4ee803[_0x96bd('0x120')][_0x96bd('0x121')]||_0x4ee803['ip'],'referer':_0x4ee803[_0x96bd('0x8d')]['referer'],'openedInteractions':_0xa55a53,'maxInteractions':_0x47d5a2,'virtual':_0x2b5f92[_0x96bd('0x118')],'online':_0x3120ad,'custom':_0x2b5f92}))[_0x96bd('0x122')](/'/g,'\x5c\x27')};_0x163206[_0x96bd('0x3c')](ejs['render'](Mustache['render'](_0x2b4c3b,_0x458021),{'proactiveActions':_0xbc975e,'alignment':_0x42fd79['alignment'],'verticalAlignment':_0x42fd79[_0x96bd('0x123')],'div_color':_0x42fd79[_0x96bd('0x108')],'text_color':_0x42fd79['textColor'],'button_color':_0x42fd79[_0x96bd('0x124')],'background_color':_0x42fd79[_0x96bd('0x125')]}));})[_0x96bd('0x2a')](handleError(_0x163206,null));};exports[_0x96bd('0x126')]=function(_0x3f4e27,_0x1f4b27,_0x4acb17){return db['ChatWebsite'][_0x96bd('0x6c')]({'where':{'id':_0x3f4e27[_0x96bd('0x59')]['id']}})['then'](handleEntityNotFound(_0x1f4b27,null))[_0x96bd('0x37')](function(_0x20cd6d){if(_0x20cd6d){return db['sequelize']['transaction'](function(_0x2cc771){return db[_0x96bd('0xa3')][_0x96bd('0x38')]({'where':{'ChatWebsiteId':_0x3f4e27[_0x96bd('0x59')]['id']},'transaction':_0x2cc771})[_0x96bd('0x37')](function(_0x232428){var _0x122afc=_[_0x96bd('0x3e')](_0x3f4e27[_0x96bd('0x5d')],function(_0x7b05b9){_0x7b05b9[_0x96bd('0x69')]=_0x3f4e27[_0x96bd('0x59')]['id'];return _0x7b05b9;});return db[_0x96bd('0xa3')][_0x96bd('0xe5')](_0x122afc,{'transaction':_0x2cc771});});})[_0x96bd('0x37')](function(){return db[_0x96bd('0xa3')][_0x96bd('0x127')]({'where':{'ChatWebsiteId':_0x3f4e27[_0x96bd('0x59')]['id']},'order':_0x96bd('0x128')});});}})['then'](respondWithResult(_0x1f4b27,null))['catch'](handleError(_0x1f4b27,null));};exports['getApplications']=function(_0x5c6ae7,_0x1e2c9c,_0x507dc7){var _0x1e6884={};var _0x126387={};var _0x3008f7;var _0xe56539;return db['ChatWebsite'][_0x96bd('0x6c')]({'where':{'id':_0x5c6ae7[_0x96bd('0x59')]['id']}})[_0x96bd('0x37')](handleEntityNotFound(_0x1e2c9c,null))[_0x96bd('0x37')](function(_0x3abd66){if(_0x3abd66){_0x3008f7=_0x3abd66;_0x126387[_0x96bd('0x48')]=_[_0x96bd('0x45')](db[_0x96bd('0xa3')][_0x96bd('0x40')]);_0x126387[_0x96bd('0x44')]=_[_0x96bd('0x45')](_0x5c6ae7[_0x96bd('0x44')]);_0x126387[_0x96bd('0x46')]=_[_0x96bd('0x47')](_0x126387['model'],_0x126387[_0x96bd('0x44')]);_0x1e6884['attributes']=_[_0x96bd('0x47')](_0x126387[_0x96bd('0x48')],qs[_0x96bd('0x4a')](_0x5c6ae7[_0x96bd('0x44')][_0x96bd('0x4a')]));_0x1e6884['attributes']=_0x1e6884[_0x96bd('0x49')][_0x96bd('0x4b')]?_0x1e6884[_0x96bd('0x49')]:_0x126387[_0x96bd('0x48')];_0x1e6884[_0x96bd('0x4e')]=qs[_0x96bd('0x4f')](_0x5c6ae7[_0x96bd('0x44')][_0x96bd('0x4f')]);_0x1e6884[_0x96bd('0x50')]=qs['filters'](_['pick'](_0x5c6ae7['query'],_0x126387[_0x96bd('0x46')]));if(_0x5c6ae7['query'][_0x96bd('0x52')]){_0x1e6884[_0x96bd('0x50')]=_[_0x96bd('0x6a')](_0x1e6884['where'],{'$or':_[_0x96bd('0x3e')](_0x1e6884[_0x96bd('0x49')],function(_0x26afc5){var _0x56d5c5={};_0x56d5c5[_0x26afc5]={'$like':'%'+_0x5c6ae7['query'][_0x96bd('0x52')]+'%'};return _0x56d5c5;})});}_0x1e6884=_['merge']({},_0x1e6884,_0x5c6ae7[_0x96bd('0x54')]);return _0x3008f7[_0x96bd('0x129')](_0x1e6884);}})[_0x96bd('0x37')](function(_0x377b08){if(_0x377b08){_0xe56539=_0x377b08[_0x96bd('0x4b')];if(!_0x5c6ae7[_0x96bd('0x44')][_0x96bd('0x4c')](_0x96bd('0x4d'))){_0x1e6884[_0x96bd('0x2f')]=qs[_0x96bd('0x2f')](_0x5c6ae7[_0x96bd('0x44')][_0x96bd('0x2f')]);_0x1e6884[_0x96bd('0x31')]=qs[_0x96bd('0x31')](_0x5c6ae7[_0x96bd('0x44')]['offset']);}return _0x3008f7[_0x96bd('0x129')](_0x1e6884);}})[_0x96bd('0x37')](function(_0x55933e){if(_0x55933e){return _0x55933e?{'count':_0xe56539,'rows':_0x55933e}:null;}})[_0x96bd('0x37')](respondWithResult(_0x1e2c9c,null))[_0x96bd('0x2a')](handleError(_0x1e2c9c,null));};exports['addProactiveActions']=function(_0x171964,_0x329377,_0x4342e6){return db[_0x96bd('0x12a')]['find']({'where':{'id':_0x171964[_0x96bd('0x59')]['id']}})[_0x96bd('0x37')](handleEntityNotFound(_0x329377,null))[_0x96bd('0x37')](function(_0x19c3d7){if(_0x19c3d7){return _0x19c3d7[_0x96bd('0x12b')](_0x171964[_0x96bd('0x5d')][_0x96bd('0x6f')],_[_0x96bd('0xff')](_0x171964[_0x96bd('0x5d')],['ids','id'])||{});}})[_0x96bd('0x37')](respondWithResult(_0x329377,null))[_0x96bd('0x2a')](handleError(_0x329377,null));};exports[_0x96bd('0x12c')]=function(_0x59ac52,_0x794fbb,_0x4d73d5){var _0x1ca206={};var _0xee8efc={};var _0x13cbd0;var _0x1d49f9;return db['ChatWebsite']['findOne']({'where':{'id':_0x59ac52[_0x96bd('0x59')]['id']}})[_0x96bd('0x37')](handleEntityNotFound(_0x794fbb,null))[_0x96bd('0x37')](function(_0x11319a){if(_0x11319a){_0x13cbd0=_0x11319a;_0xee8efc[_0x96bd('0x48')]=_[_0x96bd('0x45')](db[_0x96bd('0x12d')][_0x96bd('0x40')]);_0xee8efc[_0x96bd('0x44')]=_[_0x96bd('0x45')](_0x59ac52[_0x96bd('0x44')]);_0xee8efc[_0x96bd('0x46')]=_[_0x96bd('0x47')](_0xee8efc[_0x96bd('0x48')],_0xee8efc[_0x96bd('0x44')]);_0x1ca206['attributes']=_[_0x96bd('0x47')](_0xee8efc[_0x96bd('0x48')],qs[_0x96bd('0x4a')](_0x59ac52[_0x96bd('0x44')]['fields']));_0x1ca206[_0x96bd('0x49')]=_0x1ca206[_0x96bd('0x49')][_0x96bd('0x4b')]?_0x1ca206['attributes']:_0xee8efc[_0x96bd('0x48')];_0x1ca206[_0x96bd('0x4e')]=qs[_0x96bd('0x4f')](_0x59ac52[_0x96bd('0x44')][_0x96bd('0x4f')]);_0x1ca206[_0x96bd('0x50')]=qs['filters'](_[_0x96bd('0x51')](_0x59ac52[_0x96bd('0x44')],_0xee8efc[_0x96bd('0x46')]));if(_0x59ac52[_0x96bd('0x44')][_0x96bd('0x52')]){_0x1ca206[_0x96bd('0x50')]=_[_0x96bd('0x6a')](_0x1ca206[_0x96bd('0x50')],{'$or':_[_0x96bd('0x3e')](_0x1ca206[_0x96bd('0x49')],function(_0x5f44ed){var _0xbdd9c7={};_0xbdd9c7[_0x5f44ed]={'$like':'%'+_0x59ac52[_0x96bd('0x44')][_0x96bd('0x52')]+'%'};return _0xbdd9c7;})});}_0x1ca206=_[_0x96bd('0x6a')]({},_0x1ca206,_0x59ac52['options']);return _0x13cbd0[_0x96bd('0x12c')](_0x1ca206);}})['then'](function(_0x33f863){if(_0x33f863){_0x1d49f9=_0x33f863['length'];if(!_0x59ac52['query'][_0x96bd('0x4c')](_0x96bd('0x4d'))){_0x1ca206[_0x96bd('0x2f')]=qs[_0x96bd('0x2f')](_0x59ac52[_0x96bd('0x44')][_0x96bd('0x2f')]);_0x1ca206[_0x96bd('0x31')]=qs[_0x96bd('0x31')](_0x59ac52[_0x96bd('0x44')][_0x96bd('0x31')]);}return _0x13cbd0[_0x96bd('0x12c')](_0x1ca206);}})[_0x96bd('0x37')](function(_0x3c17cd){if(_0x3c17cd){return _0x3c17cd?{'count':_0x1d49f9,'rows':_0x3c17cd}:null;}})[_0x96bd('0x37')](respondWithResult(_0x794fbb,null))[_0x96bd('0x2a')](handleError(_0x794fbb,null));};exports[_0x96bd('0x12e')]=function(_0x4bf154,_0x503fd3,_0x4170d6){var _0x1947e0=_0x4bf154[_0x96bd('0x44')][_0x96bd('0x12f')]===_0x96bd('0x130')?'offlineForm':_0x96bd('0x131');return db[_0x96bd('0x3f')]['find']({'attributes':['id',_0x1947e0],'where':{'id':_0x4bf154[_0x96bd('0x59')]['id']}})[_0x96bd('0x37')](handleEntityNotFound(_0x503fd3,null))[_0x96bd('0x37')](function(_0x19d6cd){if(_0x19d6cd){var _0x2dd58c=_0x19d6cd[_0x1947e0];var _0x223703=_0x2dd58c&&_0x2dd58c[_0x96bd('0x132')]?_0x2dd58c[_0x96bd('0x132')]:[];_0x503fd3[_0x96bd('0x3c')]({'fromKey':_['isNil'](_0x2dd58c[_0x96bd('0x133')])?undefined:_0x2dd58c[_0x96bd('0x133')],'count':_0x223703['length'],'rows':_0x223703});}})[_0x96bd('0x2a')](handleError(_0x503fd3,null));};exports[_0x96bd('0x134')]=function(_0x5df18e,_0x2b8cdf,_0x8e8371){var _0x571828={'raw':![],'where':{}};var _0x4cdeb7={};var _0x16bc74={'count':0x0,'rows':[]};return db[_0x96bd('0x3f')][_0x96bd('0x6c')]({'where':{'id':_0x5df18e[_0x96bd('0x59')]['id']}})[_0x96bd('0x37')](handleEntityNotFound(_0x2b8cdf,null))[_0x96bd('0x37')](function(_0xbe48f6){if(_0xbe48f6){_0x4cdeb7[_0x96bd('0x48')]=_[_0x96bd('0x45')](db[_0x96bd('0xdc')]['rawAttributes']);_0x4cdeb7[_0x96bd('0x44')]=_[_0x96bd('0x45')](_0x5df18e[_0x96bd('0x44')]);_0x4cdeb7[_0x96bd('0x46')]=_[_0x96bd('0x47')](_0x4cdeb7[_0x96bd('0x48')],_0x4cdeb7[_0x96bd('0x44')]);_0x571828['attributes']=_[_0x96bd('0x47')](_0x4cdeb7[_0x96bd('0x48')],qs[_0x96bd('0x4a')](_0x5df18e[_0x96bd('0x44')][_0x96bd('0x4a')]));_0x571828[_0x96bd('0x49')]=_0x571828['attributes'][_0x96bd('0x4b')]?_0x571828['attributes']:_0x4cdeb7[_0x96bd('0x48')];if(!_0x5df18e[_0x96bd('0x44')][_0x96bd('0x4c')](_0x96bd('0x4d'))){_0x571828['limit']=qs[_0x96bd('0x2f')](_0x5df18e[_0x96bd('0x44')][_0x96bd('0x2f')]);_0x571828[_0x96bd('0x31')]=qs[_0x96bd('0x31')](_0x5df18e[_0x96bd('0x44')]['offset']);}_0x571828[_0x96bd('0x4e')]=qs['sort'](_0x5df18e[_0x96bd('0x44')][_0x96bd('0x4f')]);_0x571828[_0x96bd('0x50')]=qs[_0x96bd('0x46')](_[_0x96bd('0x51')](_0x5df18e[_0x96bd('0x44')],_0x4cdeb7['filters']));_0x571828[_0x96bd('0x50')][_0x96bd('0x69')]=_0xbe48f6['id'];if(_0x5df18e[_0x96bd('0x44')][_0x96bd('0x52')]){_0x571828[_0x96bd('0x50')]=_[_0x96bd('0x6a')](_0x571828[_0x96bd('0x50')],{'$or':_[_0x96bd('0x3e')](_0x571828[_0x96bd('0x49')],function(_0x1ff9b3){var _0x204ae8={};_0x204ae8[_0x1ff9b3]={'$like':'%'+_0x5df18e['query'][_0x96bd('0x52')]+'%'};return _0x204ae8;})});}_0x571828=_[_0x96bd('0x6a')]({},_0x571828,_0x5df18e[_0x96bd('0x54')]);return db[_0x96bd('0xdc')][_0x96bd('0x30')]({'where':_0x571828[_0x96bd('0x50')]})['then'](function(_0x25a067){_0x16bc74['count']=_0x25a067;if(_0x5df18e[_0x96bd('0x44')]['includeAll']){_0x571828[_0x96bd('0x55')]=[{'all':!![]}];}else{_0x571828['include']=[{'model':db[_0x96bd('0x91')],'as':_0x96bd('0x102'),'required':![]},{'model':db[_0x96bd('0xe4')],'as':_0x96bd('0x135'),'required':![]}];}return db['ChatOfflineMessage']['findAll'](_0x571828);})['then'](function(_0x71d9c2){_0x16bc74[_0x96bd('0x57')]=_0x71d9c2;return _0x16bc74;});}})['then'](respondWithFilteredResult(_0x2b8cdf,_0x571828))[_0x96bd('0x2a')](handleError(_0x2b8cdf,null));};exports[_0x96bd('0x136')]=function(_0x53377c,_0x2086e6,_0x31cadc){return db[_0x96bd('0x3f')][_0x96bd('0x5b')]({'where':{'id':_0x53377c['params']['id']}})[_0x96bd('0x37')](handleEntityNotFound(_0x2086e6,null))[_0x96bd('0x37')](function(_0x3f031f){if(_0x3f031f){return _0x3f031f[_0x96bd('0x136')](_0x53377c[_0x96bd('0x5d')]['ids'],_[_0x96bd('0xff')](_0x53377c[_0x96bd('0x5d')],['ids','id'])||{})[_0x96bd('0xbf')](function(_0x52d7bc){for(var _0x5a6a6b=0x0;_0x5a6a6b<_0x53377c[_0x96bd('0x5d')][_0x96bd('0x6f')][_0x96bd('0x4b')];_0x5a6a6b+=0x1){socket[_0x96bd('0x137')]('userChatWebsite:save',{'UserId':Number(_0x53377c[_0x96bd('0x5d')][_0x96bd('0x6f')][_0x5a6a6b]),'ChatWebsiteId':Number(_0x53377c['params']['id'])});}return _0x52d7bc;});}})['then'](respondWithResult(_0x2086e6,null))[_0x96bd('0x2a')](handleError(_0x2086e6,null));};exports[_0x96bd('0x138')]=function(_0x11b6ed,_0x14bed0,_0x45f5c2){return db[_0x96bd('0x3f')]['find']({'where':{'id':_0x11b6ed['params']['id']}})[_0x96bd('0x37')](handleEntityNotFound(_0x14bed0,null))['then'](function(_0x2b6068){if(_0x2b6068){return _0x2b6068[_0x96bd('0x138')](_0x11b6ed[_0x96bd('0x44')][_0x96bd('0x6f')])['then'](function(){if(_[_0x96bd('0x139')](_0x11b6ed[_0x96bd('0x44')][_0x96bd('0x6f')])){for(var _0x26cc82=0x0;_0x26cc82<_0x11b6ed['query']['ids']['length'];_0x26cc82+=0x1){socket[_0x96bd('0x137')](_0x96bd('0x13a'),{'UserId':Number(_0x11b6ed[_0x96bd('0x44')][_0x96bd('0x6f')][_0x26cc82]),'ChatWebsiteId':Number(_0x11b6ed[_0x96bd('0x59')]['id'])});}}else{socket[_0x96bd('0x137')](_0x96bd('0x13a'),{'UserId':Number(_0x11b6ed[_0x96bd('0x44')][_0x96bd('0x6f')]),'ChatWebsiteId':Number(_0x11b6ed['params']['id'])});}});}})[_0x96bd('0x37')](respondWithStatusCode(_0x14bed0,null))['catch'](handleError(_0x14bed0,null));};exports[_0x96bd('0x13b')]=function(_0x15429b,_0xb8057e,_0x2bb623){var _0x13a200={};var _0x4245eb={};var _0x2316db;var _0x525570;return db[_0x96bd('0x3f')][_0x96bd('0x6c')]({'where':{'id':_0x15429b[_0x96bd('0x59')]['id']}})[_0x96bd('0x37')](handleEntityNotFound(_0xb8057e,null))[_0x96bd('0x37')](function(_0x6e760a){if(_0x6e760a){_0x2316db=_0x6e760a;_0x4245eb[_0x96bd('0x48')]=_[_0x96bd('0x45')](db[_0x96bd('0xca')][_0x96bd('0x40')]);_0x4245eb[_0x96bd('0x44')]=_['keys'](_0x15429b[_0x96bd('0x44')]);_0x4245eb[_0x96bd('0x46')]=_[_0x96bd('0x47')](_0x4245eb[_0x96bd('0x48')],_0x4245eb[_0x96bd('0x44')]);_0x13a200[_0x96bd('0x49')]=_['intersection'](_0x4245eb[_0x96bd('0x48')],qs[_0x96bd('0x4a')](_0x15429b['query'][_0x96bd('0x4a')]));_0x13a200[_0x96bd('0x49')]=_0x13a200['attributes'][_0x96bd('0x4b')]?_0x13a200[_0x96bd('0x49')]:_0x4245eb[_0x96bd('0x48')];_0x13a200[_0x96bd('0x4e')]=qs['sort'](_0x15429b[_0x96bd('0x44')][_0x96bd('0x4f')]);_0x13a200[_0x96bd('0x50')]=qs[_0x96bd('0x46')](_[_0x96bd('0x51')](_0x15429b[_0x96bd('0x44')],_0x4245eb[_0x96bd('0x46')]));if(_0x15429b[_0x96bd('0x44')][_0x96bd('0x52')]){_0x13a200['where']=_[_0x96bd('0x6a')](_0x13a200[_0x96bd('0x50')],{'$or':_[_0x96bd('0x3e')](_0x13a200['attributes'],function(_0x5ceb25){var _0x3a3ba0={};_0x3a3ba0[_0x5ceb25]={'$like':'%'+_0x15429b[_0x96bd('0x44')][_0x96bd('0x52')]+'%'};return _0x3a3ba0;})});}_0x13a200=_[_0x96bd('0x6a')]({},_0x13a200,_0x15429b[_0x96bd('0x54')]);return _0x2316db[_0x96bd('0x13b')](_0x13a200);}})[_0x96bd('0x37')](function(_0xeb999e){if(_0xeb999e){_0x525570=_0xeb999e[_0x96bd('0x4b')];if(!_0x15429b[_0x96bd('0x44')][_0x96bd('0x4c')](_0x96bd('0x4d'))){_0x13a200[_0x96bd('0x2f')]=qs[_0x96bd('0x2f')](_0x15429b[_0x96bd('0x44')][_0x96bd('0x2f')]);_0x13a200[_0x96bd('0x31')]=qs[_0x96bd('0x31')](_0x15429b[_0x96bd('0x44')][_0x96bd('0x31')]);}return _0x2316db[_0x96bd('0x13b')](_0x13a200);}})[_0x96bd('0x37')](function(_0x2749ca){if(_0x2749ca){return _0x2749ca?{'count':_0x525570,'rows':_0x2749ca}:null;}})[_0x96bd('0x37')](respondWithResult(_0xb8057e,null))[_0x96bd('0x2a')](handleError(_0xb8057e,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 16940c4..b05f085 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 _0x757f=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','ChatWebsite'];(function(_0x7ddf5a,_0x3e0253){var _0x2c8abd=function(_0x15cc34){while(--_0x15cc34){_0x7ddf5a['push'](_0x7ddf5a['shift']());}};_0x2c8abd(++_0x3e0253);}(_0x757f,0xee));var _0xf757=function(_0x2fbb8c,_0x15bc93){_0x2fbb8c=_0x2fbb8c-0x0;var _0x1005b4=_0x757f[_0x2fbb8c];return _0x1005b4;};'use strict';var EventEmitter=require(_0xf757('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0xf757('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xf757('0x2')](0x0);var events={'afterCreate':_0xf757('0x3'),'afterUpdate':_0xf757('0x4'),'afterDestroy':_0xf757('0x5')};function emitEvent(_0x44ebcf){return function(_0x26a38a,_0x302fba,_0x958ba7){ChatWebsiteEvents['emit'](_0x44ebcf+':'+_0x26a38a['id'],_0x26a38a);ChatWebsiteEvents[_0xf757('0x6')](_0x44ebcf,_0x26a38a);_0x958ba7(null);};}for(var e in events){if(events[_0xf757('0x7')](e)){var event=events[e];ChatWebsite[_0xf757('0x8')](e,emitEvent(event));}}module[_0xf757('0x9')]=ChatWebsiteEvents; \ No newline at end of file +var _0x946e=['hook','exports','events','ChatWebsite','save','emit','hasOwnProperty'];(function(_0x4d968a,_0x3cef1b){var _0xe0859d=function(_0x164a0b){while(--_0x164a0b){_0x4d968a['push'](_0x4d968a['shift']());}};_0xe0859d(++_0x3cef1b);}(_0x946e,0x1d0));var _0xe946=function(_0x5cc61d,_0x4fe17b){_0x5cc61d=_0x5cc61d-0x0;var _0x2e25d0=_0x946e[_0x5cc61d];return _0x2e25d0;};'use strict';var EventEmitter=require(_0xe946('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0xe946('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe946('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x31cade){return function(_0xb981db,_0x2b42cd,_0x145058){ChatWebsiteEvents[_0xe946('0x3')](_0x31cade+':'+_0xb981db['id'],_0xb981db);ChatWebsiteEvents['emit'](_0x31cade,_0xb981db);_0x145058(null);};}for(var e in events){if(events[_0xe946('0x4')](e)){var event=events[e];ChatWebsite[_0xe946('0x5')](e,emitEvent(event));}}module[_0xe946('0x6')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index ab4102a..bc6dfc3 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 _0x424f=['chat_websites','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','ChatWebsite'];(function(_0x1b8e60,_0x21b885){var _0x363363=function(_0x5987c7){while(--_0x5987c7){_0x1b8e60['push'](_0x1b8e60['shift']());}};_0x363363(++_0x21b885);}(_0x424f,0x76));var _0xf424=function(_0x4fce1e,_0x5e9dfe){_0x4fce1e=_0x4fce1e-0x0;var _0x27ea1c=_0x424f[_0x4fce1e];return _0x27ea1c;};'use strict';var _=require(_0xf424('0x0'));var util=require('util');var logger=require(_0xf424('0x1'))(_0xf424('0x2'));var moment=require(_0xf424('0x3'));var BPromise=require(_0xf424('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf424('0x5'));var config=require(_0xf424('0x6'));var attributes=require('./chatWebsite.attributes');module['exports']=function(_0x1ef4d0,_0x11250c){return _0x1ef4d0['define'](_0xf424('0x7'),attributes,{'tableName':_0xf424('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6188=['../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','moment','request-promise','rimraf'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6188,0x88));var _0x8618=function(_0x1fc1f9,_0x454fb2){_0x1fc1f9=_0x1fc1f9-0x0;var _0x4987ca=_0x6188[_0x1fc1f9];return _0x4987ca;};'use strict';var _=require(_0x8618('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x8618('0x1'));var BPromise=require('bluebird');var rp=require(_0x8618('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8618('0x3'));var config=require(_0x8618('0x4'));var attributes=require(_0x8618('0x5'));module[_0x8618('0x6')]=function(_0x1ca967,_0x219c0b){return _0x1ca967[_0x8618('0x7')](_0x8618('0x8'),attributes,{'tableName':_0x8618('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 5ac06ce..2ff4144 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 _0x0ba3=['redis','defaults','socket.io-emitter','./chatWebsite.socket','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x45b976,_0x3ac0e3){var _0x42c656=function(_0x8025da){while(--_0x8025da){_0x45b976['push'](_0x45b976['shift']());}};_0x42c656(++_0x3ac0e3);}(_0x0ba3,0x70));var _0x30ba=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x0ba3[_0x1b2ff7];return _0x31656a;};'use strict';var _=require(_0x30ba('0x0'));var util=require(_0x30ba('0x1'));var moment=require(_0x30ba('0x2'));var BPromise=require(_0x30ba('0x3'));var rs=require(_0x30ba('0x4'));var fs=require('fs');var Redis=require(_0x30ba('0x5'));var db=require(_0x30ba('0x6'))['db'];var utils=require(_0x30ba('0x7'));var logger=require(_0x30ba('0x8'))(_0x30ba('0x9'));var config=require('../../config/environment');var jayson=require(_0x30ba('0xa'));var client=jayson[_0x30ba('0xb')][_0x30ba('0xc')]({'port':0x232a});config[_0x30ba('0xd')]=_[_0x30ba('0xe')](config[_0x30ba('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x30ba('0xf'))(new Redis(config['redis']));require(_0x30ba('0x10'))['register'](socket);function respondWithRpcPromise(_0x13359a,_0x11e2a2,_0xd77125){return new BPromise(function(_0x3b04f1,_0x166e04){return client['request'](_0x13359a,_0xd77125)['then'](function(_0x4a6634){logger[_0x30ba('0x11')](_0x30ba('0x12'),_0x11e2a2,_0x30ba('0x13'));logger[_0x30ba('0x14')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x11e2a2,_0x30ba('0x13'),JSON['stringify'](_0x4a6634));if(_0x4a6634[_0x30ba('0x15')]){if(_0x4a6634[_0x30ba('0x15')][_0x30ba('0x16')]===0x1f4){logger[_0x30ba('0x15')](_0x30ba('0x12'),_0x11e2a2,_0x4a6634['error'][_0x30ba('0x17')]);return _0x166e04(_0x4a6634['error'][_0x30ba('0x17')]);}logger[_0x30ba('0x15')](_0x30ba('0x12'),_0x11e2a2,_0x4a6634['error'][_0x30ba('0x17')]);return _0x3b04f1(_0x4a6634[_0x30ba('0x15')][_0x30ba('0x17')]);}else{logger['info'](_0x30ba('0x12'),_0x11e2a2,'request\x20sent');_0x3b04f1(_0x4a6634[_0x30ba('0x18')][_0x30ba('0x17')]);}})['catch'](function(_0x1ae53d){logger[_0x30ba('0x15')](_0x30ba('0x12'),_0x11e2a2,_0x1ae53d);_0x166e04(_0x1ae53d);});});} \ No newline at end of file +var _0xa27a=['code','ChatWebsite,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x42ef9a,_0x11845e){var _0x56e5dd=function(_0x170b1c){while(--_0x170b1c){_0x42ef9a['push'](_0x42ef9a['shift']());}};_0x56e5dd(++_0x11845e);}(_0xa27a,0x6c));var _0xaa27=function(_0xaec7d,_0x44dce6){_0xaec7d=_0xaec7d-0x0;var _0x54a0ce=_0xa27a[_0xaec7d];return _0x54a0ce;};'use strict';var _=require('lodash');var util=require(_0xaa27('0x0'));var moment=require(_0xaa27('0x1'));var BPromise=require(_0xaa27('0x2'));var rs=require(_0xaa27('0x3'));var fs=require('fs');var Redis=require(_0xaa27('0x4'));var db=require(_0xaa27('0x5'))['db'];var utils=require(_0xaa27('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xaa27('0x7'));var jayson=require(_0xaa27('0x8'));var client=jayson[_0xaa27('0x9')]['http']({'port':0x232a});config[_0xaa27('0xa')]=_[_0xaa27('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xaa27('0xc'))(new Redis(config[_0xaa27('0xa')]));require(_0xaa27('0xd'))[_0xaa27('0xe')](socket);function respondWithRpcPromise(_0x1656cc,_0x5c6084,_0x2dde59){return new BPromise(function(_0x34f167,_0x6f3c7d){return client['request'](_0x1656cc,_0x2dde59)[_0xaa27('0xf')](function(_0x4bab4e){logger[_0xaa27('0x10')]('ChatWebsite,\x20%s,\x20%s',_0x5c6084,_0xaa27('0x11'));logger[_0xaa27('0x12')](_0xaa27('0x13'),_0x5c6084,_0xaa27('0x11'),JSON[_0xaa27('0x14')](_0x4bab4e));if(_0x4bab4e[_0xaa27('0x15')]){if(_0x4bab4e[_0xaa27('0x15')][_0xaa27('0x16')]===0x1f4){logger[_0xaa27('0x15')](_0xaa27('0x17'),_0x5c6084,_0x4bab4e[_0xaa27('0x15')]['message']);return _0x6f3c7d(_0x4bab4e[_0xaa27('0x15')]['message']);}logger['error'](_0xaa27('0x17'),_0x5c6084,_0x4bab4e['error'][_0xaa27('0x18')]);return _0x34f167(_0x4bab4e[_0xaa27('0x15')][_0xaa27('0x18')]);}else{logger[_0xaa27('0x10')](_0xaa27('0x17'),_0x5c6084,'request\x20sent');_0x34f167(_0x4bab4e[_0xaa27('0x19')]['message']);}})['catch'](function(_0x5b826e){logger[_0xaa27('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x5c6084,_0x5b826e);_0x6f3c7d(_0x5b826e);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 7022856..a3b1da9 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 _0xf65a=['./chatWebsite.events','remove','update','emit','removeListener','register','chatWebsite:'];(function(_0x505dcb,_0x3d3646){var _0x3f1944=function(_0x22dfa1){while(--_0x22dfa1){_0x505dcb['push'](_0x505dcb['shift']());}};_0x3f1944(++_0x3d3646);}(_0xf65a,0x10a));var _0xaf65=function(_0x2b2641,_0x28312b){_0x2b2641=_0x2b2641-0x0;var _0x36d9f4=_0xf65a[_0x2b2641];return _0x36d9f4;};'use strict';var ChatWebsiteEvents=require(_0xaf65('0x0'));var events=['save',_0xaf65('0x1'),_0xaf65('0x2')];function createListener(_0x52f995,_0x3b40ec){return function(_0x1e017e){_0x3b40ec[_0xaf65('0x3')](_0x52f995,_0x1e017e);};}function removeListener(_0x30026c,_0x2de4ae){return function(){ChatWebsiteEvents[_0xaf65('0x4')](_0x30026c,_0x2de4ae);};}exports[_0xaf65('0x5')]=function(_0x1ba358){for(var _0x63857f=0x0,_0x284cfa=events['length'];_0x63857f<_0x284cfa;_0x63857f++){var _0x2c2a48=events[_0x63857f];var _0x37bf1f=createListener(_0xaf65('0x6')+_0x2c2a48,_0x1ba358);ChatWebsiteEvents['on'](_0x2c2a48,_0x37bf1f);}}; \ No newline at end of file +var _0x8443=['save','remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x8443,0x1ca));var _0x3844=function(_0x15872f,_0x574f38){_0x15872f=_0x15872f-0x0;var _0x3dc290=_0x8443[_0x15872f];return _0x3dc290;};'use strict';var ChatWebsiteEvents=require(_0x3844('0x0'));var events=[_0x3844('0x1'),_0x3844('0x2'),_0x3844('0x3')];function createListener(_0x407804,_0x3b7843){return function(_0x3cbc63){_0x3b7843[_0x3844('0x4')](_0x407804,_0x3cbc63);};}function removeListener(_0x3b4699,_0x4a060c){return function(){ChatWebsiteEvents[_0x3844('0x5')](_0x3b4699,_0x4a060c);};}exports[_0x3844('0x6')]=function(_0xddea77){for(var _0x236729=0x0,_0x50b12f=events[_0x3844('0x7')];_0x236729<_0x50b12f;_0x236729++){var _0x40f802=events[_0x236729];var _0x412bab=createListener(_0x3844('0x8')+_0x40f802,_0xddea77);ChatWebsiteEvents['on'](_0x40f802,_0x412bab);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 7ed7c47..8437189 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 _0xcc60=['removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./chatWebsite.controller','isAuthenticated','/describe','get','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','getCustomerAvatar','/:id/system_avatar','/:id/interactions','getInteractions','getSnippet','/:id/applications','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','post','create','addDisposition','addAnswer','diskStorage','root','format','%s-%s','now','single','addLogo','join','server/files/images/avatars/','originalname','file','addAvatar','/:id/customer_avatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','ensureDir','extname','/:id/offline','any','addInteraction','addApplications','/:id/proactive_actions','addProactiveActions','put','/:id','update','delete','destroy','removeDispositions','removeAnswers'];(function(_0x2e2c52,_0x7e90fb){var _0x5918c5=function(_0x3f99a7){while(--_0x3f99a7){_0x2e2c52['push'](_0x2e2c52['shift']());}};_0x5918c5(++_0x7e90fb);}(_0xcc60,0x94));var _0x0cc6=function(_0xb38540,_0x1fc920){_0xb38540=_0xb38540-0x0;var _0x27fa72=_0xcc60[_0xb38540];return _0x27fa72;};'use strict';var multer=require(_0x0cc6('0x0'));var util=require(_0x0cc6('0x1'));var path=require(_0x0cc6('0x2'));var timeout=require(_0x0cc6('0x3'));var express=require(_0x0cc6('0x4'));var router=express[_0x0cc6('0x5')]();var fs_extra=require(_0x0cc6('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0cc6('0x7'));var controller=require(_0x0cc6('0x8'));router['get']('/',auth[_0x0cc6('0x9')](),controller['index']);router['get'](_0x0cc6('0xa'),auth[_0x0cc6('0x9')](),controller['describe']);router[_0x0cc6('0xb')]('/:id',auth[_0x0cc6('0x9')](),controller[_0x0cc6('0xc')]);router[_0x0cc6('0xb')](_0x0cc6('0xd'),auth[_0x0cc6('0x9')](),controller[_0x0cc6('0xe')]);router['get'](_0x0cc6('0xf'),auth[_0x0cc6('0x9')](),controller[_0x0cc6('0x10')]);router[_0x0cc6('0xb')](_0x0cc6('0x11'),controller[_0x0cc6('0x12')]);router[_0x0cc6('0xb')](_0x0cc6('0x13'),controller[_0x0cc6('0x14')]);router['get']('/:id/customer_avatar',controller[_0x0cc6('0x15')]);router[_0x0cc6('0xb')](_0x0cc6('0x16'),controller['getSystemAvatar']);router[_0x0cc6('0xb')](_0x0cc6('0x17'),auth[_0x0cc6('0x9')](),controller[_0x0cc6('0x18')]);router[_0x0cc6('0xb')]('/:id/snippet',controller[_0x0cc6('0x19')]);router[_0x0cc6('0xb')](_0x0cc6('0x1a'),auth[_0x0cc6('0x9')](),controller['getApplications']);router[_0x0cc6('0xb')]('/:id/proactive_actions',auth[_0x0cc6('0x9')](),controller[_0x0cc6('0x1b')]);router[_0x0cc6('0xb')](_0x0cc6('0x1c'),controller[_0x0cc6('0x1d')]);router[_0x0cc6('0xb')](_0x0cc6('0x1e'),auth[_0x0cc6('0x9')](),controller[_0x0cc6('0x1f')]);router[_0x0cc6('0xb')](_0x0cc6('0x20'),auth[_0x0cc6('0x9')](),controller['getAgents']);router[_0x0cc6('0x21')]('/',auth[_0x0cc6('0x9')](),controller[_0x0cc6('0x22')]);router[_0x0cc6('0x21')](_0x0cc6('0xd'),auth['isAuthenticated'](),controller[_0x0cc6('0x23')]);router['post'](_0x0cc6('0xf'),auth[_0x0cc6('0x9')](),controller[_0x0cc6('0x24')]);var upload=multer({'storage':multer[_0x0cc6('0x25')]({'destination':function(_0x42c430,_0x56dbf9,_0x4cac90){_0x4cac90(null,path['join'](config[_0x0cc6('0x26')],'server/files/images/logos/'));},'filename':function(_0x14b259,_0x5d6a39,_0x15afa8){_0x15afa8(null,util[_0x0cc6('0x27')](_0x0cc6('0x28'),Date[_0x0cc6('0x29')](),_0x5d6a39['originalname']));}})});router[_0x0cc6('0x21')](_0x0cc6('0x11'),upload[_0x0cc6('0x2a')]('file'),controller[_0x0cc6('0x2b')]);var upload=multer({'storage':multer[_0x0cc6('0x25')]({'destination':function(_0x5affc4,_0x2090c8,_0x20d982){_0x20d982(null,path[_0x0cc6('0x2c')](config[_0x0cc6('0x26')],_0x0cc6('0x2d')));},'filename':function(_0x882ef3,_0x3b603e,_0x24728e){_0x24728e(null,util[_0x0cc6('0x27')]('%s-%s',Date['now'](),_0x3b603e[_0x0cc6('0x2e')]));}})});router[_0x0cc6('0x21')](_0x0cc6('0x13'),upload[_0x0cc6('0x2a')](_0x0cc6('0x2f')),controller[_0x0cc6('0x30')]);var upload=multer({'storage':multer[_0x0cc6('0x25')]({'destination':function(_0x67d9f8,_0x344ec6,_0x1392fb){_0x1392fb(null,path[_0x0cc6('0x2c')](config[_0x0cc6('0x26')],'server/files/images/avatars/'));},'filename':function(_0x47cfd3,_0x1448a9,_0x30a663){_0x30a663(null,util['format'](_0x0cc6('0x28'),Date[_0x0cc6('0x29')](),_0x1448a9[_0x0cc6('0x2e')]));}})});router[_0x0cc6('0x21')](_0x0cc6('0x31'),upload[_0x0cc6('0x2a')](_0x0cc6('0x2f')),controller[_0x0cc6('0x32')]);var upload=multer({'storage':multer[_0x0cc6('0x25')]({'destination':function(_0x2b5517,_0x9fba4e,_0x342ee4){_0x342ee4(null,path['join'](config[_0x0cc6('0x26')],_0x0cc6('0x2d')));},'filename':function(_0x570efa,_0x42a49e,_0x3facf5){_0x3facf5(null,util[_0x0cc6('0x27')]('%s-%s',Date['now'](),_0x42a49e[_0x0cc6('0x2e')]));}})});router[_0x0cc6('0x21')](_0x0cc6('0x16'),upload[_0x0cc6('0x2a')](_0x0cc6('0x2f')),controller[_0x0cc6('0x33')]);router[_0x0cc6('0x21')](_0x0cc6('0x34'),controller[_0x0cc6('0x35')]);const offlineUploadMulter=multer({'storage':multer[_0x0cc6('0x25')]({'destination':function(_0x9fabb1,_0x1b88b7,_0x226bb8){const _0x5920d1=path[_0x0cc6('0x2c')](config[_0x0cc6('0x26')],_0x0cc6('0x36'),_0x0cc6('0x37'),'offline-chat');fs_extra[_0x0cc6('0x38')](_0x5920d1,function(){_0x226bb8(null,_0x5920d1);});},'filename':function(_0x4d1257,_0x5add92,_0x12e22b){const _0xf281b=_0x5add92['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x1c065d=path[_0x0cc6('0x39')](_0xf281b);const _0x5d3a7b=Date[_0x0cc6('0x29')]()+'-'+_0xf281b['replace'](_0x1c065d,'')+_0x1c065d;_0x12e22b(null,_0x5d3a7b);}})});router['post'](_0x0cc6('0x3a'),offlineUploadMulter[_0x0cc6('0x3b')](),controller['offline']);router[_0x0cc6('0x21')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x0cc6('0x3c')]);router['post'](_0x0cc6('0x1a'),auth['isAuthenticated'](),controller[_0x0cc6('0x3d')]);router[_0x0cc6('0x21')](_0x0cc6('0x3e'),auth[_0x0cc6('0x9')](),controller[_0x0cc6('0x3f')]);router[_0x0cc6('0x21')](_0x0cc6('0x20'),auth['isAuthenticated'](),controller['addAgents']);router[_0x0cc6('0x40')](_0x0cc6('0x41'),auth['isAuthenticated'](),controller[_0x0cc6('0x42')]);router[_0x0cc6('0x43')]('/:id',auth[_0x0cc6('0x9')](),controller[_0x0cc6('0x44')]);router[_0x0cc6('0x43')](_0x0cc6('0xd'),auth[_0x0cc6('0x9')](),controller[_0x0cc6('0x45')]);router[_0x0cc6('0x43')](_0x0cc6('0xf'),auth[_0x0cc6('0x9')](),controller[_0x0cc6('0x46')]);router[_0x0cc6('0x43')](_0x0cc6('0x20'),auth[_0x0cc6('0x9')](),controller[_0x0cc6('0x47')]);module[_0x0cc6('0x48')]=router; \ No newline at end of file +var _0xe381=['getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','diskStorage','root','server/files/images/logos/','format','%s-%s','now','file','addLogo','join','originalname','single','addAvatar','addCustomerAvatar','server/files/images/avatars/','addSystemAvatar','server/files','offline-chat','ensureDir','replace','extname','/:id/offline','offline','addInteraction','addApplications','addProactiveActions','addAgents','put','/:id','update','delete','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/logo','getLogo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions'];(function(_0x5a5225,_0x30ded3){var _0x533f2f=function(_0xe3d024){while(--_0xe3d024){_0x5a5225['push'](_0x5a5225['shift']());}};_0x533f2f(++_0x30ded3);}(_0xe381,0x1f4));var _0x1e38=function(_0x470b0a,_0x2889d6){_0x470b0a=_0x470b0a-0x0;var _0x4463f6=_0xe381[_0x470b0a];return _0x4463f6;};'use strict';var multer=require('multer');var util=require(_0x1e38('0x0'));var path=require(_0x1e38('0x1'));var timeout=require(_0x1e38('0x2'));var express=require(_0x1e38('0x3'));var router=express[_0x1e38('0x4')]();var fs_extra=require(_0x1e38('0x5'));var auth=require(_0x1e38('0x6'));var interaction=require(_0x1e38('0x7'));var config=require('../../config/environment');var controller=require(_0x1e38('0x8'));router[_0x1e38('0x9')]('/',auth[_0x1e38('0xa')](),controller[_0x1e38('0xb')]);router[_0x1e38('0x9')](_0x1e38('0xc'),auth[_0x1e38('0xa')](),controller[_0x1e38('0xd')]);router[_0x1e38('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x1e38('0xe')]);router[_0x1e38('0x9')](_0x1e38('0xf'),auth[_0x1e38('0xa')](),controller[_0x1e38('0x10')]);router['get'](_0x1e38('0x11'),auth[_0x1e38('0xa')](),controller['getAnswers']);router['get'](_0x1e38('0x12'),controller[_0x1e38('0x13')]);router[_0x1e38('0x9')](_0x1e38('0x14'),controller['getAvatar']);router[_0x1e38('0x9')](_0x1e38('0x15'),controller[_0x1e38('0x16')]);router['get'](_0x1e38('0x17'),controller[_0x1e38('0x18')]);router['get'](_0x1e38('0x19'),auth[_0x1e38('0xa')](),controller[_0x1e38('0x1a')]);router[_0x1e38('0x9')](_0x1e38('0x1b'),controller[_0x1e38('0x1c')]);router['get'](_0x1e38('0x1d'),auth['isAuthenticated'](),controller[_0x1e38('0x1e')]);router['get'](_0x1e38('0x1f'),auth[_0x1e38('0xa')](),controller[_0x1e38('0x20')]);router[_0x1e38('0x9')](_0x1e38('0x21'),controller[_0x1e38('0x22')]);router[_0x1e38('0x9')](_0x1e38('0x23'),auth[_0x1e38('0xa')](),controller[_0x1e38('0x24')]);router['get'](_0x1e38('0x25'),auth['isAuthenticated'](),controller[_0x1e38('0x26')]);router[_0x1e38('0x27')]('/',auth[_0x1e38('0xa')](),controller[_0x1e38('0x28')]);router['post'](_0x1e38('0xf'),auth[_0x1e38('0xa')](),controller[_0x1e38('0x29')]);router['post']('/:id/canned_answers',auth[_0x1e38('0xa')](),controller[_0x1e38('0x2a')]);var upload=multer({'storage':multer[_0x1e38('0x2b')]({'destination':function(_0x3c9820,_0x3fb002,_0x46c3e4){_0x46c3e4(null,path['join'](config[_0x1e38('0x2c')],_0x1e38('0x2d')));},'filename':function(_0x2efdc6,_0x52c21c,_0x3008dd){_0x3008dd(null,util[_0x1e38('0x2e')](_0x1e38('0x2f'),Date[_0x1e38('0x30')](),_0x52c21c['originalname']));}})});router[_0x1e38('0x27')](_0x1e38('0x12'),upload['single'](_0x1e38('0x31')),controller[_0x1e38('0x32')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5dae8a,_0x58a70a,_0x43c545){_0x43c545(null,path[_0x1e38('0x33')](config[_0x1e38('0x2c')],'server/files/images/avatars/'));},'filename':function(_0x849b79,_0x55011a,_0x11afd4){_0x11afd4(null,util[_0x1e38('0x2e')](_0x1e38('0x2f'),Date[_0x1e38('0x30')](),_0x55011a[_0x1e38('0x34')]));}})});router[_0x1e38('0x27')](_0x1e38('0x14'),upload[_0x1e38('0x35')](_0x1e38('0x31')),controller[_0x1e38('0x36')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4380f2,_0x4beda0,_0x5fbccd){_0x5fbccd(null,path[_0x1e38('0x33')](config[_0x1e38('0x2c')],'server/files/images/avatars/'));},'filename':function(_0x23d04f,_0x1d90dc,_0x3daf9d){_0x3daf9d(null,util[_0x1e38('0x2e')]('%s-%s',Date[_0x1e38('0x30')](),_0x1d90dc['originalname']));}})});router['post'](_0x1e38('0x15'),upload[_0x1e38('0x35')](_0x1e38('0x31')),controller[_0x1e38('0x37')]);var upload=multer({'storage':multer[_0x1e38('0x2b')]({'destination':function(_0xe8b62d,_0x47d316,_0x268b75){_0x268b75(null,path[_0x1e38('0x33')](config['root'],_0x1e38('0x38')));},'filename':function(_0x21cb1f,_0x17f396,_0x4b1f74){_0x4b1f74(null,util[_0x1e38('0x2e')](_0x1e38('0x2f'),Date[_0x1e38('0x30')](),_0x17f396['originalname']));}})});router[_0x1e38('0x27')](_0x1e38('0x17'),upload[_0x1e38('0x35')](_0x1e38('0x31')),controller[_0x1e38('0x39')]);router[_0x1e38('0x27')]('/:id/notify',controller['notify']);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x194ad9,_0x5d47d7,_0x5da8f1){const _0x21dcd4=path[_0x1e38('0x33')](config['root'],_0x1e38('0x3a'),'attachments',_0x1e38('0x3b'));fs_extra[_0x1e38('0x3c')](_0x21dcd4,function(){_0x5da8f1(null,_0x21dcd4);});},'filename':function(_0x14214e,_0x24b615,_0x37f108){const _0x10ae58=_0x24b615[_0x1e38('0x34')][_0x1e38('0x3d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x3f9a03=path[_0x1e38('0x3e')](_0x10ae58);const _0x531016=Date[_0x1e38('0x30')]()+'-'+_0x10ae58[_0x1e38('0x3d')](_0x3f9a03,'')+_0x3f9a03;_0x37f108(null,_0x531016);}})});router['post'](_0x1e38('0x3f'),offlineUploadMulter['any'](),controller[_0x1e38('0x40')]);router[_0x1e38('0x27')](_0x1e38('0x19'),auth[_0x1e38('0xa')](),controller[_0x1e38('0x41')]);router['post'](_0x1e38('0x1d'),auth[_0x1e38('0xa')](),controller[_0x1e38('0x42')]);router['post'](_0x1e38('0x1f'),auth[_0x1e38('0xa')](),controller[_0x1e38('0x43')]);router[_0x1e38('0x27')](_0x1e38('0x25'),auth['isAuthenticated'](),controller[_0x1e38('0x44')]);router[_0x1e38('0x45')](_0x1e38('0x46'),auth[_0x1e38('0xa')](),controller[_0x1e38('0x47')]);router['delete']('/:id',auth[_0x1e38('0xa')](),controller['destroy']);router['delete'](_0x1e38('0xf'),auth[_0x1e38('0xa')](),controller['removeDispositions']);router[_0x1e38('0x48')](_0x1e38('0x11'),auth[_0x1e38('0xa')](),controller[_0x1e38('0x49')]);router[_0x1e38('0x48')]('/:id/users',auth[_0x1e38('0xa')](),controller[_0x1e38('0x4a')]);module[_0x1e38('0x4b')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index c387ff2..443fdf3 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 _0x0763=['STRING','ENUM','Google','sequelize'];(function(_0x52c51a,_0x31478a){var _0x20089c=function(_0x5b163c){while(--_0x5b163c){_0x52c51a['push'](_0x52c51a['shift']());}};_0x20089c(++_0x31478a);}(_0x0763,0x87));var _0x3076=function(_0xa45395,_0x5579e6){_0xa45395=_0xa45395-0x0;var _0x3c83d2=_0x0763[_0xa45395];return _0x3c83d2;};'use strict';var Sequelize=require(_0x3076('0x0'));module['exports']={'name':{'type':Sequelize[_0x3076('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x3076('0x2')]('AmazonAWS',_0x3076('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x3076('0x1')]},'data2':{'type':Sequelize[_0x3076('0x1')]}}; \ No newline at end of file +var _0x6869=['STRING','AmazonAWS','sequelize','exports'];(function(_0x4c98b9,_0x1ad11b){var _0x3a257a=function(_0x147857){while(--_0x147857){_0x4c98b9['push'](_0x4c98b9['shift']());}};_0x3a257a(++_0x1ad11b);}(_0x6869,0xe2));var _0x9686=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x6869[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x9686('0x0'));module[_0x9686('0x1')]={'name':{'type':Sequelize[_0x9686('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0x9686('0x3'),'Google'),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x9686('0x2')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index af5fe45..055c93d 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 _0x2032=['body','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','CloudProvider','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','options','rows','show','params','keys','rawAttributes','includeAll','find','catch'];(function(_0x41dc41,_0x11b458){var _0x3a112f=function(_0x42e7c1){while(--_0x42e7c1){_0x41dc41['push'](_0x41dc41['shift']());}};_0x3a112f(++_0x11b458);}(_0x2032,0xd9));var _0x2203=function(_0x277f49,_0x4717d1){_0x277f49=_0x277f49-0x0;var _0x1bb801=_0x2032[_0x277f49];return _0x1bb801;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){_0x5c8da9[_0x2203('0x19')](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x49c12,_0x250349){return function(_0x576378){if(!_0x576378){_0x49c12[_0x2203('0x25')](0x194);}return _0x576378;};}function handleError(_0x36b958,_0x39a11a){_0x39a11a=_0x39a11a||0x1f4;return function(_0x5f11bf){logger[_0x2203('0x26')](_0x5f11bf[_0x2203('0x27')]);if(_0x5f11bf['name']){delete _0x5f11bf[_0x2203('0x28')];}_0x36b958[_0x2203('0x19')](_0x39a11a)[_0x2203('0x29')](_0x5f11bf);};}exports[_0x2203('0x2a')]=function(_0x28ae02,_0x1df508){var _0x9c53f={},_0x5a95c1={},_0x34b8ba={'count':0x0,'rows':[]};var _0x616ed8=_[_0x2203('0x2b')](db[_0x2203('0x2c')]['rawAttributes'],function(_0x3a8e23){return{'name':_0x3a8e23[_0x2203('0x2d')],'type':_0x3a8e23[_0x2203('0x2e')][_0x2203('0x2f')]};});_0x5a95c1['model']=_[_0x2203('0x2b')](_0x616ed8,_0x2203('0x28'));_0x5a95c1['query']=_['keys'](_0x28ae02[_0x2203('0x30')]);_0x5a95c1['filters']=_['intersection'](_0x5a95c1[_0x2203('0x31')],_0x5a95c1[_0x2203('0x30')]);_0x9c53f[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5a95c1[_0x2203('0x31')],qs['fields'](_0x28ae02[_0x2203('0x30')][_0x2203('0x34')]));_0x9c53f['attributes']=_0x9c53f[_0x2203('0x32')][_0x2203('0x35')]?_0x9c53f[_0x2203('0x32')]:_0x5a95c1[_0x2203('0x31')];if(!_0x28ae02[_0x2203('0x30')][_0x2203('0x36')](_0x2203('0x37'))){_0x9c53f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x28ae02['query'][_0x2203('0x1d')]);_0x9c53f[_0x2203('0x1b')]=qs['offset'](_0x28ae02['query'][_0x2203('0x1b')]);}_0x9c53f['order']=qs[_0x2203('0x38')](_0x28ae02[_0x2203('0x30')][_0x2203('0x38')]);_0x9c53f['where']=qs['filters'](_[_0x2203('0x39')](_0x28ae02['query'],_0x5a95c1[_0x2203('0x3a')]),_0x616ed8);if(_0x28ae02['query'][_0x2203('0x3b')]){_0x9c53f['where']=_[_0x2203('0x3c')](_0x9c53f[_0x2203('0x3d')],{'$or':_[_0x2203('0x2b')](_0x616ed8,function(_0x40a793){if(_0x40a793[_0x2203('0x2e')]!=='VIRTUAL'){var _0x5f1561={};_0x5f1561[_0x40a793['name']]={'$like':'%'+_0x28ae02[_0x2203('0x30')][_0x2203('0x3b')]+'%'};return _0x5f1561;}})});}_0x9c53f=_[_0x2203('0x3c')]({},_0x9c53f,_0x28ae02[_0x2203('0x3e')]);var _0x3283fb={'where':_0x9c53f[_0x2203('0x3d')]};return db[_0x2203('0x2c')]['count'](_0x3283fb)[_0x2203('0x23')](function(_0x1b12c3){_0x34b8ba[_0x2203('0x1e')]=_0x1b12c3;if(_0x28ae02[_0x2203('0x30')]['includeAll']){_0x9c53f['include']=[{'all':!![]}];}return db[_0x2203('0x2c')]['findAll'](_0x9c53f);})[_0x2203('0x23')](function(_0x446209){_0x34b8ba[_0x2203('0x3f')]=_0x446209;return _0x34b8ba;})['then'](respondWithFilteredResult(_0x1df508,_0x9c53f))['catch'](handleError(_0x1df508,null));};exports[_0x2203('0x40')]=function(_0x3739f6,_0x368444){var _0x1e09f3={'raw':!![],'where':{'id':_0x3739f6[_0x2203('0x41')]['id']}},_0x372709={};_0x372709['model']=_[_0x2203('0x42')](db[_0x2203('0x2c')][_0x2203('0x43')]);_0x372709[_0x2203('0x30')]=_[_0x2203('0x42')](_0x3739f6[_0x2203('0x30')]);_0x372709[_0x2203('0x3a')]=_[_0x2203('0x33')](_0x372709[_0x2203('0x31')],_0x372709[_0x2203('0x30')]);_0x1e09f3['attributes']=_[_0x2203('0x33')](_0x372709[_0x2203('0x31')],qs[_0x2203('0x34')](_0x3739f6[_0x2203('0x30')]['fields']));_0x1e09f3['attributes']=_0x1e09f3[_0x2203('0x32')]['length']?_0x1e09f3[_0x2203('0x32')]:_0x372709[_0x2203('0x31')];if(_0x3739f6[_0x2203('0x30')][_0x2203('0x44')]){_0x1e09f3['include']=[{'all':!![]}];}_0x1e09f3=_[_0x2203('0x3c')]({},_0x1e09f3,_0x3739f6[_0x2203('0x3e')]);return db['CloudProvider'][_0x2203('0x45')](_0x1e09f3)[_0x2203('0x23')](handleEntityNotFound(_0x368444,null))[_0x2203('0x23')](respondWithResult(_0x368444,null))[_0x2203('0x46')](handleError(_0x368444,null));};exports['create']=function(_0x4c1a29,_0x21b8ab){return db['CloudProvider']['create'](_0x4c1a29[_0x2203('0x47')],{})[_0x2203('0x23')](respondWithResult(_0x21b8ab,0xc9))[_0x2203('0x46')](handleError(_0x21b8ab,null));};exports['update']=function(_0x4c1496,_0x131aec){if(_0x4c1496[_0x2203('0x47')]['id']){delete _0x4c1496[_0x2203('0x47')]['id'];}return db[_0x2203('0x2c')][_0x2203('0x45')]({'where':{'id':_0x4c1496[_0x2203('0x41')]['id']}})['then'](handleEntityNotFound(_0x131aec,null))[_0x2203('0x23')](saveUpdates(_0x4c1496['body'],null))[_0x2203('0x23')](respondWithResult(_0x131aec,null))[_0x2203('0x46')](handleError(_0x131aec,null));};exports[_0x2203('0x24')]=function(_0x1e49dd,_0x58b9bb){return db['CloudProvider'][_0x2203('0x45')]({'where':{'id':_0x1e49dd[_0x2203('0x41')]['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x58b9bb,null))[_0x2203('0x23')](removeEntity(_0x58b9bb,null))['catch'](handleError(_0x58b9bb,null));}; \ No newline at end of file +var _0x7a54=['offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','CloudProvider','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x158b71,_0x24f792){var _0x5056ab=function(_0x43b3e1){while(--_0x43b3e1){_0x158b71['push'](_0x158b71['shift']());}};_0x5056ab(++_0x24f792);}(_0x7a54,0x106));var _0x47a5=function(_0x327ff5,_0x3a1250){_0x327ff5=_0x327ff5-0x0;var _0x248bca=_0x7a54[_0x327ff5];return _0x248bca;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['CloudProvider'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['CloudProvider']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['CloudProvider']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 9c87f26..98dd126 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 _0x3f3d=['path','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x19aa84,_0x549537){var _0x536146=function(_0x5da480){while(--_0x5da480){_0x19aa84['push'](_0x19aa84['shift']());}};_0x536146(++_0x549537);}(_0x3f3d,0x1ac));var _0xd3f3=function(_0x4e9861,_0x25fe5f){_0x4e9861=_0x4e9861-0x0;var _0x49802f=_0x3f3d[_0x4e9861];return _0x49802f;};'use strict';var _=require(_0xd3f3('0x0'));var util=require('util');var logger=require(_0xd3f3('0x1'))(_0xd3f3('0x2'));var moment=require(_0xd3f3('0x3'));var BPromise=require(_0xd3f3('0x4'));var rp=require(_0xd3f3('0x5'));var fs=require('fs');var path=require(_0xd3f3('0x6'));var rimraf=require(_0xd3f3('0x7'));var config=require(_0xd3f3('0x8'));var attributes=require(_0xd3f3('0x9'));module[_0xd3f3('0xa')]=function(_0xe78eba,_0x13a2a1){return _0xe78eba[_0xd3f3('0xb')](_0xd3f3('0xc'),attributes,{'tableName':_0xd3f3('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa466=['exports','CloudProvider','cloud_providers','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes'];(function(_0x5d7141,_0x13de2f){var _0x1c5d84=function(_0x29ae86){while(--_0x29ae86){_0x5d7141['push'](_0x5d7141['shift']());}};_0x1c5d84(++_0x13de2f);}(_0xa466,0x1d7));var _0x6a46=function(_0xa81117,_0x356201){_0xa81117=_0xa81117-0x0;var _0x4df5b5=_0xa466[_0xa81117];return _0x4df5b5;};'use strict';var _=require('lodash');var util=require(_0x6a46('0x0'));var logger=require(_0x6a46('0x1'))(_0x6a46('0x2'));var moment=require(_0x6a46('0x3'));var BPromise=require(_0x6a46('0x4'));var rp=require(_0x6a46('0x5'));var fs=require('fs');var path=require(_0x6a46('0x6'));var rimraf=require(_0x6a46('0x7'));var config=require(_0x6a46('0x8'));var attributes=require(_0x6a46('0x9'));module[_0x6a46('0xa')]=function(_0x5b049b,_0x12cf7c){return _0x5b049b['define'](_0x6a46('0xb'),attributes,{'tableName':_0x6a46('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 104d31c..231d931 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 _0xd786=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','CloudProvider,\x20%s,\x20%s','debug','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x2cd969,_0x35dcd4){var _0x10d32f=function(_0xa86b97){while(--_0xa86b97){_0x2cd969['push'](_0x2cd969['shift']());}};_0x10d32f(++_0x35dcd4);}(_0xd786,0x1dc));var _0x6d78=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd786[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x6d78('0x0'));var util=require(_0x6d78('0x1'));var moment=require(_0x6d78('0x2'));var BPromise=require(_0x6d78('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d78('0x4'));var db=require(_0x6d78('0x5'))['db'];var utils=require(_0x6d78('0x6'));var logger=require(_0x6d78('0x7'))(_0x6d78('0x8'));var config=require(_0x6d78('0x9'));var jayson=require(_0x6d78('0xa'));var client=jayson['client'][_0x6d78('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x30e9e5,_0x5c3f38,_0x44db98){return new BPromise(function(_0x33b85e,_0x10f58a){return client[_0x6d78('0xc')](_0x30e9e5,_0x44db98)['then'](function(_0x3198b6){logger[_0x6d78('0xd')](_0x6d78('0xe'),_0x5c3f38,'request\x20sent');logger[_0x6d78('0xf')](_0x6d78('0x10'),_0x5c3f38,_0x6d78('0x11'),JSON[_0x6d78('0x12')](_0x3198b6));if(_0x3198b6[_0x6d78('0x13')]){if(_0x3198b6[_0x6d78('0x13')][_0x6d78('0x14')]===0x1f4){logger[_0x6d78('0x13')](_0x6d78('0xe'),_0x5c3f38,_0x3198b6[_0x6d78('0x13')]['message']);return _0x10f58a(_0x3198b6[_0x6d78('0x13')][_0x6d78('0x15')]);}logger[_0x6d78('0x13')](_0x6d78('0xe'),_0x5c3f38,_0x3198b6[_0x6d78('0x13')]['message']);return _0x33b85e(_0x3198b6['error'][_0x6d78('0x15')]);}else{logger['info'](_0x6d78('0xe'),_0x5c3f38,'request\x20sent');_0x33b85e(_0x3198b6[_0x6d78('0x16')]['message']);}})[_0x6d78('0x17')](function(_0x378c59){logger[_0x6d78('0x13')](_0x6d78('0xe'),_0x5c3f38,_0x378c59);_0x10f58a(_0x378c59);});});} \ No newline at end of file +var _0xbc36=['info','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','CloudProvider,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x1b9ee6,_0x83b1e1){var _0x3a8ca3=function(_0x32985d){while(--_0x32985d){_0x1b9ee6['push'](_0x1b9ee6['shift']());}};_0x3a8ca3(++_0x83b1e1);}(_0xbc36,0x169));var _0x6bc3=function(_0x2d14e7,_0x32cff9){_0x2d14e7=_0x2d14e7-0x0;var _0x30f1e8=_0xbc36[_0x2d14e7];return _0x30f1e8;};'use strict';var _=require(_0x6bc3('0x0'));var util=require('util');var moment=require(_0x6bc3('0x1'));var BPromise=require(_0x6bc3('0x2'));var rs=require(_0x6bc3('0x3'));var fs=require('fs');var Redis=require(_0x6bc3('0x4'));var db=require(_0x6bc3('0x5'))['db'];var utils=require(_0x6bc3('0x6'));var logger=require(_0x6bc3('0x7'))(_0x6bc3('0x8'));var config=require(_0x6bc3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6bc3('0xa')][_0x6bc3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5584a5,_0x33e11c,_0x1f894a){return new BPromise(function(_0xf07594,_0x4de32d){return client[_0x6bc3('0xc')](_0x5584a5,_0x1f894a)[_0x6bc3('0xd')](function(_0x33e8e0){logger[_0x6bc3('0xe')]('CloudProvider,\x20%s,\x20%s',_0x33e11c,_0x6bc3('0xf'));logger[_0x6bc3('0x10')](_0x6bc3('0x11'),_0x33e11c,_0x6bc3('0xf'),JSON[_0x6bc3('0x12')](_0x33e8e0));if(_0x33e8e0[_0x6bc3('0x13')]){if(_0x33e8e0[_0x6bc3('0x13')][_0x6bc3('0x14')]===0x1f4){logger[_0x6bc3('0x13')]('CloudProvider,\x20%s,\x20%s',_0x33e11c,_0x33e8e0[_0x6bc3('0x13')]['message']);return _0x4de32d(_0x33e8e0[_0x6bc3('0x13')]['message']);}logger[_0x6bc3('0x13')](_0x6bc3('0x15'),_0x33e11c,_0x33e8e0['error'][_0x6bc3('0x16')]);return _0xf07594(_0x33e8e0['error']['message']);}else{logger[_0x6bc3('0xe')](_0x6bc3('0x15'),_0x33e11c,_0x6bc3('0xf'));_0xf07594(_0x33e8e0[_0x6bc3('0x17')][_0x6bc3('0x16')]);}})[_0x6bc3('0x18')](function(_0xa1782){logger['error'](_0x6bc3('0x15'),_0x33e11c,_0xa1782);_0x4de32d(_0xa1782);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index a20c43c..7de3726 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 _0xa03d=['show','post','/:id','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./cloudProvider.controller','isAuthenticated','index','get'];(function(_0x334292,_0xa12527){var _0x3af4a9=function(_0x26e948){while(--_0x26e948){_0x334292['push'](_0x334292['shift']());}};_0x3af4a9(++_0xa12527);}(_0xa03d,0x15b));var _0xda03=function(_0xa45300,_0x12b025){_0xa45300=_0xa45300-0x0;var _0x4b9521=_0xa03d[_0xa45300];return _0x4b9521;};'use strict';var multer=require(_0xda03('0x0'));var util=require(_0xda03('0x1'));var path=require('path');var timeout=require(_0xda03('0x2'));var express=require('express');var router=express[_0xda03('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xda03('0x4'));var interaction=require(_0xda03('0x5'));var config=require('../../config/environment');var controller=require(_0xda03('0x6'));router['get']('/',auth[_0xda03('0x7')](),controller[_0xda03('0x8')]);router[_0xda03('0x9')]('/:id',auth[_0xda03('0x7')](),controller[_0xda03('0xa')]);router[_0xda03('0xb')]('/',auth[_0xda03('0x7')](),controller['create']);router['put'](_0xda03('0xc'),auth[_0xda03('0x7')](),controller[_0xda03('0xd')]);router[_0xda03('0xe')](_0xda03('0xc'),auth['isAuthenticated'](),controller[_0xda03('0xf')]);module[_0xda03('0x10')]=router; \ No newline at end of file +var _0xd946=['isAuthenticated','show','post','put','/:id','update','destroy','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x1ccf7f,_0x1ed2b7){var _0x289389=function(_0x15cfce){while(--_0x15cfce){_0x1ccf7f['push'](_0x1ccf7f['shift']());}};_0x289389(++_0x1ed2b7);}(_0xd946,0x98));var _0x6d94=function(_0x43c1c6,_0x5863a3){_0x43c1c6=_0x43c1c6-0x0;var _0x51c1c0=_0xd946[_0x43c1c6];return _0x51c1c0;};'use strict';var multer=require(_0x6d94('0x0'));var util=require('util');var path=require(_0x6d94('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6d94('0x2')]();var fs_extra=require(_0x6d94('0x3'));var auth=require(_0x6d94('0x4'));var interaction=require(_0x6d94('0x5'));var config=require(_0x6d94('0x6'));var controller=require('./cloudProvider.controller');router[_0x6d94('0x7')]('/',auth[_0x6d94('0x8')](),controller['index']);router['get']('/:id',auth[_0x6d94('0x8')](),controller[_0x6d94('0x9')]);router[_0x6d94('0xa')]('/',auth[_0x6d94('0x8')](),controller['create']);router[_0x6d94('0xb')](_0x6d94('0xc'),auth[_0x6d94('0x8')](),controller[_0x6d94('0xd')]);router['delete'](_0x6d94('0xc'),auth[_0x6d94('0x8')](),controller[_0x6d94('0xe')]);module[_0x6d94('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index c43b7d2..ccbdb96 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 _0x357f=['name','sequelize','exports','STRING'];(function(_0xa20571,_0x49a4b9){var _0x16beae=function(_0x402d7d){while(--_0x402d7d){_0xa20571['push'](_0xa20571['shift']());}};_0x16beae(++_0x49a4b9);}(_0x357f,0x99));var _0xf357=function(_0x386297,_0x5bfc15){_0x386297=_0x386297-0x0;var _0x4c051e=_0x357f[_0x386297];return _0x4c051e;};'use strict';var Sequelize=require(_0xf357('0x0'));module[_0xf357('0x1')]={'name':{'type':Sequelize[_0xf357('0x2')],'unique':_0xf357('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xf357('0x2')]},'companyId':{'type':Sequelize[_0xf357('0x2')]},'website':{'type':Sequelize[_0xf357('0x2')]},'phone':{'type':Sequelize[_0xf357('0x2')]},'fax':{'type':Sequelize[_0xf357('0x2')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xf357('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xf357('0x2')]},'country':{'type':Sequelize[_0xf357('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xf357('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0xf357('0x2')]},'sCountry':{'type':Sequelize[_0xf357('0x2')]},'description':{'type':Sequelize[_0xf357('0x2')]}}; \ No newline at end of file +var _0xef8b=['exports','STRING','name'];(function(_0x261697,_0x150fe0){var _0x553db6=function(_0x417253){while(--_0x417253){_0x261697['push'](_0x261697['shift']());}};_0x553db6(++_0x150fe0);}(_0xef8b,0x192));var _0xbef8=function(_0x24d24e,_0x4e17a4){_0x24d24e=_0x24d24e-0x0;var _0x20e068=_0xef8b[_0x24d24e];return _0x20e068;};'use strict';var Sequelize=require('sequelize');module[_0xbef8('0x0')]={'name':{'type':Sequelize[_0xbef8('0x1')],'unique':_0xbef8('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xbef8('0x1')]},'companyId':{'type':Sequelize[_0xbef8('0x1')]},'website':{'type':Sequelize[_0xbef8('0x1')]},'phone':{'type':Sequelize[_0xbef8('0x1')]},'fax':{'type':Sequelize[_0xbef8('0x1')]},'type':{'type':Sequelize[_0xbef8('0x1')]},'street':{'type':Sequelize[_0xbef8('0x1')]},'postalCode':{'type':Sequelize[_0xbef8('0x1')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xbef8('0x1')]},'email':{'type':Sequelize[_0xbef8('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xbef8('0x1')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0xbef8('0x1')]},'sCity':{'type':Sequelize[_0xbef8('0x1')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index e34bd98..6bd8e7b 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 _0xfa3a=['end','json','limit','offset','set','Content-Range','reject','save','update','destroy','then','get','Companies','UserProfileResource','error','stack','name','send','index','CmCompany','describe','keys','query','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','count','includeAll','include','findAll','rows','catch','params','rawAttributes','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','omit','ids','findOne','CmContact','length','getContacts','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x3bf194,_0x342216){var _0x105954=function(_0x40732d){while(--_0x40732d){_0x3bf194['push'](_0x3bf194['shift']());}};_0x105954(++_0x342216);}(_0xfa3a,0x145));var _0xafa3=function(_0x32e59e,_0x252469){_0x32e59e=_0x32e59e-0x0;var _0x4a621d=_0xfa3a[_0x32e59e];return _0x4a621d;};'use strict';var emlformat=require(_0xafa3('0x0'));var rimraf=require(_0xafa3('0x1'));var zipdir=require(_0xafa3('0x2'));var jsonpatch=require(_0xafa3('0x3'));var rp=require(_0xafa3('0x4'));var moment=require(_0xafa3('0x5'));var BPromise=require(_0xafa3('0x6'));var Mustache=require(_0xafa3('0x7'));var util=require('util');var path=require(_0xafa3('0x8'));var sox=require(_0xafa3('0x9'));var csv=require('to-csv');var ejs=require(_0xafa3('0xa'));var fs=require('fs');var fs_extra=require(_0xafa3('0xb'));var _=require(_0xafa3('0xc'));var squel=require(_0xafa3('0xd'));var crypto=require('crypto');var jsforce=require(_0xafa3('0xe'));var deskjs=require(_0xafa3('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xafa3('0x10'));var Redis=require(_0xafa3('0x11'));var authService=require(_0xafa3('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xafa3('0x13'));var hardwareService=require(_0xafa3('0x14'));var logger=require(_0xafa3('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xafa3('0x16'));var licenseUtil=require(_0xafa3('0x17'));var db=require(_0xafa3('0x18'))['db'];function respondWithStatusCode(_0x33fc81,_0x3c9324){_0x3c9324=_0x3c9324||0xcc;return function(_0x2b4ec4){if(_0x2b4ec4){return _0x33fc81[_0xafa3('0x19')](_0x3c9324);}return _0x33fc81[_0xafa3('0x1a')](_0x3c9324)[_0xafa3('0x1b')]();};}function respondWithResult(_0x5ed5bd,_0x168d69){_0x168d69=_0x168d69||0xc8;return function(_0xae981f){if(_0xae981f){return _0x5ed5bd[_0xafa3('0x1a')](_0x168d69)[_0xafa3('0x1c')](_0xae981f);}};}function respondWithFilteredResult(_0x40feef,_0x1d0377){return function(_0x2c8f4f){if(_0x2c8f4f){var _0x4b823f=typeof _0x1d0377['offset']==='undefined'&&typeof _0x1d0377[_0xafa3('0x1d')]==='undefined';var _0x4628b7=_0x2c8f4f['count'];var _0x413e6b=_0x4b823f?0x0:_0x1d0377[_0xafa3('0x1e')];var _0x58a450=_0x4b823f?_0x2c8f4f['count']:_0x1d0377[_0xafa3('0x1e')]+_0x1d0377['limit'];var _0x337dcf;if(_0x58a450>=_0x4628b7){_0x58a450=_0x4628b7;_0x337dcf=0xc8;}else{_0x337dcf=0xce;}_0x40feef[_0xafa3('0x1a')](_0x337dcf);return _0x40feef[_0xafa3('0x1f')](_0xafa3('0x20'),_0x413e6b+'-'+_0x58a450+'/'+_0x4628b7)[_0xafa3('0x1c')](_0x2c8f4f);}return null;};}function patchUpdates(_0x1b0c2c){return function(_0x5bdc4d){try{jsonpatch['apply'](_0x5bdc4d,_0x1b0c2c,!![]);}catch(_0x301d1a){return BPromise[_0xafa3('0x21')](_0x301d1a);}return _0x5bdc4d[_0xafa3('0x22')]();};}function saveUpdates(_0x1f25cf,_0x4ef5e1){return function(_0x3fde81){if(_0x3fde81){return _0x3fde81[_0xafa3('0x23')](_0x1f25cf)['then'](function(_0x21ad2a){return _0x21ad2a;});}return null;};}function removeEntity(_0x5de009,_0x3b80a1){return function(_0x3ed3f1){if(_0x3ed3f1){return _0x3ed3f1[_0xafa3('0x24')]()[_0xafa3('0x25')](function(){var _0x356413=_0x3ed3f1[_0xafa3('0x26')]({'plain':!![]});var _0x4fb2b0=_0xafa3('0x27');return db[_0xafa3('0x28')][_0xafa3('0x24')]({'where':{'type':_0x4fb2b0,'resourceId':_0x356413['id']}})[_0xafa3('0x25')](function(){return _0x3ed3f1;});})['then'](function(){_0x5de009[_0xafa3('0x1a')](0xcc)[_0xafa3('0x1b')]();});}};}function handleEntityNotFound(_0x4b008a,_0x5f41c2){return function(_0x48f2da){if(!_0x48f2da){_0x4b008a[_0xafa3('0x19')](0x194);}return _0x48f2da;};}function handleError(_0x41f9f7,_0xdd4506){_0xdd4506=_0xdd4506||0x1f4;return function(_0x5f2ce2){logger[_0xafa3('0x29')](_0x5f2ce2[_0xafa3('0x2a')]);if(_0x5f2ce2[_0xafa3('0x2b')]){delete _0x5f2ce2['name'];}_0x41f9f7[_0xafa3('0x1a')](_0xdd4506)[_0xafa3('0x2c')](_0x5f2ce2);};}exports[_0xafa3('0x2d')]=function(_0x56d23b,_0x320e6d){var _0x2abd46={},_0x257fa5={},_0x1e9023={'count':0x0,'rows':[]};return db[_0xafa3('0x2e')][_0xafa3('0x2f')]()['then'](function(_0x1b0bb5){_0x257fa5['model']=_[_0xafa3('0x30')](_0x1b0bb5);_0x257fa5[_0xafa3('0x31')]=_[_0xafa3('0x30')](_0x56d23b[_0xafa3('0x31')]);_0x257fa5['filters']=_[_0xafa3('0x32')](_0x257fa5[_0xafa3('0x33')],_0x257fa5[_0xafa3('0x31')]);_0x2abd46['attributes']=_[_0xafa3('0x32')](_0x257fa5['model'],qs[_0xafa3('0x34')](_0x56d23b[_0xafa3('0x31')]['fields']));_0x2abd46[_0xafa3('0x35')]=_0x2abd46[_0xafa3('0x35')]['length']?_0x2abd46[_0xafa3('0x35')]:_0x257fa5['model'];if(!_0x56d23b['query'][_0xafa3('0x36')](_0xafa3('0x37'))){_0x2abd46['limit']=qs[_0xafa3('0x1d')](_0x56d23b[_0xafa3('0x31')][_0xafa3('0x1d')]);_0x2abd46[_0xafa3('0x1e')]=qs['offset'](_0x56d23b[_0xafa3('0x31')][_0xafa3('0x1e')]);}_0x2abd46[_0xafa3('0x38')]=qs[_0xafa3('0x39')](_0x56d23b[_0xafa3('0x31')]['sort']);_0x2abd46[_0xafa3('0x3a')]=qs[_0xafa3('0x3b')](_[_0xafa3('0x3c')](_0x56d23b[_0xafa3('0x31')],_0x257fa5[_0xafa3('0x3b')]),_0x1b0bb5);if(_0x56d23b[_0xafa3('0x31')][_0xafa3('0x3d')]){_0x2abd46['where']=_[_0xafa3('0x3e')](_0x2abd46[_0xafa3('0x3a')],{'$or':_[_0xafa3('0x3f')](_0x2abd46[_0xafa3('0x35')],function(_0x5dbce1){var _0x13da20={};_0x13da20[_0x5dbce1]={'$like':'%'+_0x56d23b[_0xafa3('0x31')]['filter']+'%'};return _0x13da20;})});}_0x2abd46=_['merge']({},_0x2abd46,_0x56d23b['options']);var _0x11d101={'where':_0x2abd46[_0xafa3('0x3a')]};return db[_0xafa3('0x2e')]['count'](_0x11d101)[_0xafa3('0x25')](function(_0x47a2bb){_0x1e9023[_0xafa3('0x40')]=_0x47a2bb;if(_0x56d23b['query'][_0xafa3('0x41')]){_0x2abd46[_0xafa3('0x42')]=[{'all':!![]}];}return db[_0xafa3('0x2e')][_0xafa3('0x43')](_0x2abd46);})['then'](function(_0x1f131e){_0x1e9023[_0xafa3('0x44')]=_0x1f131e;return _0x1e9023;})[_0xafa3('0x25')](respondWithFilteredResult(_0x320e6d,_0x2abd46))[_0xafa3('0x45')](handleError(_0x320e6d,null));})[_0xafa3('0x45')](handleError(_0x320e6d,null));};exports['show']=function(_0x4b5959,_0x5315c1){var _0x1a0163={'raw':![],'where':{'id':_0x4b5959[_0xafa3('0x46')]['id']}},_0x2db8a4={};_0x2db8a4[_0xafa3('0x33')]=_[_0xafa3('0x30')](db[_0xafa3('0x2e')][_0xafa3('0x47')]);_0x2db8a4[_0xafa3('0x31')]=_[_0xafa3('0x30')](_0x4b5959[_0xafa3('0x31')]);_0x2db8a4[_0xafa3('0x3b')]=_[_0xafa3('0x32')](_0x2db8a4['model'],_0x2db8a4[_0xafa3('0x31')]);_0x1a0163['attributes']=_[_0xafa3('0x32')](_0x2db8a4[_0xafa3('0x33')],qs[_0xafa3('0x34')](_0x4b5959['query'][_0xafa3('0x34')]));_0x1a0163[_0xafa3('0x35')]=_0x1a0163[_0xafa3('0x35')]['length']?_0x1a0163[_0xafa3('0x35')]:_0x2db8a4[_0xafa3('0x33')];if(_0x4b5959[_0xafa3('0x31')][_0xafa3('0x41')]){_0x1a0163[_0xafa3('0x42')]=[{'all':!![]}];}_0x1a0163=_[_0xafa3('0x3e')]({},_0x1a0163,_0x4b5959[_0xafa3('0x48')]);return db[_0xafa3('0x2e')][_0xafa3('0x49')](_0x1a0163)[_0xafa3('0x25')](handleEntityNotFound(_0x5315c1,null))[_0xafa3('0x25')](respondWithResult(_0x5315c1,null))[_0xafa3('0x45')](handleError(_0x5315c1,null));};exports[_0xafa3('0x4a')]=function(_0x4efa80,_0x34fc93){return db[_0xafa3('0x2e')]['create'](_0x4efa80[_0xafa3('0x4b')],{})[_0xafa3('0x25')](function(_0x5a48d4){var _0x49acd8=_0x4efa80['user'][_0xafa3('0x26')]({'plain':!![]});if(!_0x49acd8)throw new Error(_0xafa3('0x4c'));if(_0x49acd8[_0xafa3('0x4d')]===_0xafa3('0x4e')){var _0x3a78a8=_0x5a48d4[_0xafa3('0x26')]({'plain':!![]});var _0x2a94d0=_0xafa3('0x27');return db[_0xafa3('0x4f')]['find']({'where':{'name':_0x2a94d0,'userProfileId':_0x49acd8['userProfileId']},'raw':!![]})['then'](function(_0x2ab1e3){if(_0x2ab1e3&&_0x2ab1e3['autoAssociation']===0x0){return db[_0xafa3('0x28')][_0xafa3('0x4a')]({'name':_0x3a78a8[_0xafa3('0x2b')],'resourceId':_0x3a78a8['id'],'type':_0x2ab1e3[_0xafa3('0x2b')],'sectionId':_0x2ab1e3['id']},{})[_0xafa3('0x25')](function(){return _0x5a48d4;});}else{return _0x5a48d4;}})[_0xafa3('0x45')](function(_0x50c799){logger[_0xafa3('0x29')](_0xafa3('0x50'),_0x50c799);throw _0x50c799;});}return _0x5a48d4;})['then'](respondWithResult(_0x34fc93,0xc9))[_0xafa3('0x45')](handleError(_0x34fc93,null));};exports[_0xafa3('0x23')]=function(_0x73676f,_0x27b457){if(_0x73676f[_0xafa3('0x4b')]['id']){delete _0x73676f[_0xafa3('0x4b')]['id'];}return db['CmCompany'][_0xafa3('0x49')]({'where':{'id':_0x73676f['params']['id']}})[_0xafa3('0x25')](handleEntityNotFound(_0x27b457,null))[_0xafa3('0x25')](saveUpdates(_0x73676f['body'],null))[_0xafa3('0x25')](respondWithResult(_0x27b457,null))[_0xafa3('0x45')](handleError(_0x27b457,null));};exports[_0xafa3('0x24')]=function(_0x15cb85,_0x5ef9f6){return db[_0xafa3('0x2e')][_0xafa3('0x49')]({'where':{'id':_0x15cb85[_0xafa3('0x46')]['id']}})[_0xafa3('0x25')](handleEntityNotFound(_0x5ef9f6,null))[_0xafa3('0x25')](removeEntity(_0x5ef9f6,null))['catch'](handleError(_0x5ef9f6,null));};exports[_0xafa3('0x2f')]=function(_0xe813c5,_0x201e59){return db[_0xafa3('0x2e')]['describe']()[_0xafa3('0x25')](respondWithResult(_0x201e59,null))[_0xafa3('0x45')](handleError(_0x201e59,null));};exports[_0xafa3('0x51')]=function(_0x5c09ad,_0x1af878,_0x23ce5d){return db['CmContact'][_0xafa3('0x49')]({'where':{'id':_0x5c09ad['params']['id']}})[_0xafa3('0x25')](handleEntityNotFound(_0x1af878,null))[_0xafa3('0x25')](function(_0x13e4e9){if(_0x13e4e9){return _0x13e4e9[_0xafa3('0x51')](_0x5c09ad[_0xafa3('0x4b')]['ids'],_[_0xafa3('0x52')](_0x5c09ad[_0xafa3('0x4b')],[_0xafa3('0x53'),'id'])||{});}})[_0xafa3('0x25')](respondWithResult(_0x1af878,null))[_0xafa3('0x45')](handleError(_0x1af878,null));};exports['getContacts']=function(_0x25e51c,_0x1b8801,_0x3d7144){var _0x247de5={};var _0x483038={};var _0x388328;var _0x4e1ad6;return db[_0xafa3('0x2e')][_0xafa3('0x54')]({'where':{'id':_0x25e51c[_0xafa3('0x46')]['id']}})[_0xafa3('0x25')](handleEntityNotFound(_0x1b8801,null))[_0xafa3('0x25')](function(_0x4fcbee){if(_0x4fcbee){_0x388328=_0x4fcbee;_0x483038[_0xafa3('0x33')]=_['keys'](db[_0xafa3('0x55')][_0xafa3('0x47')]);_0x483038[_0xafa3('0x31')]=_[_0xafa3('0x30')](_0x25e51c['query']);_0x483038[_0xafa3('0x3b')]=_[_0xafa3('0x32')](_0x483038[_0xafa3('0x33')],_0x483038[_0xafa3('0x31')]);_0x247de5[_0xafa3('0x35')]=_['intersection'](_0x483038[_0xafa3('0x33')],qs[_0xafa3('0x34')](_0x25e51c[_0xafa3('0x31')][_0xafa3('0x34')]));_0x247de5[_0xafa3('0x35')]=_0x247de5[_0xafa3('0x35')][_0xafa3('0x56')]?_0x247de5[_0xafa3('0x35')]:_0x483038['model'];_0x247de5[_0xafa3('0x38')]=qs[_0xafa3('0x39')](_0x25e51c['query'][_0xafa3('0x39')]);_0x247de5['where']=qs['filters'](_['pick'](_0x25e51c[_0xafa3('0x31')],_0x483038[_0xafa3('0x3b')]));if(_0x25e51c[_0xafa3('0x31')][_0xafa3('0x3d')]){_0x247de5[_0xafa3('0x3a')]=_[_0xafa3('0x3e')](_0x247de5[_0xafa3('0x3a')],{'$or':_[_0xafa3('0x3f')](_0x247de5[_0xafa3('0x35')],function(_0x2e9d4e){var _0x18bc4f={};_0x18bc4f[_0x2e9d4e]={'$like':'%'+_0x25e51c[_0xafa3('0x31')][_0xafa3('0x3d')]+'%'};return _0x18bc4f;})});}_0x247de5=_['merge']({},_0x247de5,_0x25e51c[_0xafa3('0x48')]);return _0x388328['getContacts'](_0x247de5);}})[_0xafa3('0x25')](function(_0x2be164){if(_0x2be164){_0x4e1ad6=_0x2be164[_0xafa3('0x56')];if(!_0x25e51c[_0xafa3('0x31')]['hasOwnProperty'](_0xafa3('0x37'))){_0x247de5[_0xafa3('0x1d')]=qs[_0xafa3('0x1d')](_0x25e51c[_0xafa3('0x31')][_0xafa3('0x1d')]);_0x247de5[_0xafa3('0x1e')]=qs['offset'](_0x25e51c[_0xafa3('0x31')][_0xafa3('0x1e')]);}return _0x388328[_0xafa3('0x57')](_0x247de5);}})[_0xafa3('0x25')](function(_0xdeeda6){if(_0xdeeda6){return _0xdeeda6?{'count':_0x4e1ad6,'rows':_0xdeeda6}:null;}})[_0xafa3('0x25')](respondWithResult(_0x1b8801,null))[_0xafa3('0x45')](handleError(_0x1b8801,null));}; \ No newline at end of file +var _0x4bf5=['UserProfileResource','end','error','name','send','index','CmCompany','describe','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','map','merge','options','includeAll','include','catch','show','params','rawAttributes','length','find','create','user','Companies','UserProfileSection','autoAssociation','body','CmContact','ids','getContacts','findOne','nolimit','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get'];(function(_0x2405bc,_0x2f28a1){var _0x5272d4=function(_0x225294){while(--_0x225294){_0x2405bc['push'](_0x2405bc['shift']());}};_0x5272d4(++_0x2f28a1);}(_0x4bf5,0xcd));var _0x54bf=function(_0x180c9b,_0x13d173){_0x180c9b=_0x180c9b-0x0;var _0x3ff116=_0x4bf5[_0x180c9b];return _0x3ff116;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x54bf('0x0'));var zipdir=require(_0x54bf('0x1'));var jsonpatch=require(_0x54bf('0x2'));var rp=require(_0x54bf('0x3'));var moment=require('moment');var BPromise=require(_0x54bf('0x4'));var Mustache=require(_0x54bf('0x5'));var util=require(_0x54bf('0x6'));var path=require(_0x54bf('0x7'));var sox=require(_0x54bf('0x8'));var csv=require(_0x54bf('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x54bf('0xa'));var _=require(_0x54bf('0xb'));var squel=require('squel');var crypto=require(_0x54bf('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x54bf('0xd'));var toCsv=require('to-csv');var querystring=require(_0x54bf('0xe'));var Papa=require(_0x54bf('0xf'));var Redis=require(_0x54bf('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x54bf('0x11'));var as=require(_0x54bf('0x12'));var hardwareService=require(_0x54bf('0x13'));var logger=require(_0x54bf('0x14'))(_0x54bf('0x15'));var utils=require('../../config/utils');var config=require(_0x54bf('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a077d,_0x295856){_0x295856=_0x295856||0xcc;return function(_0x9d3828){if(_0x9d3828){return _0x5a077d[_0x54bf('0x17')](_0x295856);}return _0x5a077d['status'](_0x295856)['end']();};}function respondWithResult(_0x290dca,_0x1cdf71){_0x1cdf71=_0x1cdf71||0xc8;return function(_0x16585e){if(_0x16585e){return _0x290dca[_0x54bf('0x18')](_0x1cdf71)[_0x54bf('0x19')](_0x16585e);}};}function respondWithFilteredResult(_0x2159cc,_0x2731ea){return function(_0x4ac673){if(_0x4ac673){var _0xf37633=typeof _0x2731ea[_0x54bf('0x1a')]===_0x54bf('0x1b')&&typeof _0x2731ea[_0x54bf('0x1c')]===_0x54bf('0x1b');var _0x13f294=_0x4ac673[_0x54bf('0x1d')];var _0x1d1251=_0xf37633?0x0:_0x2731ea[_0x54bf('0x1a')];var _0x246cbc=_0xf37633?_0x4ac673[_0x54bf('0x1d')]:_0x2731ea[_0x54bf('0x1a')]+_0x2731ea['limit'];var _0x5e5033;if(_0x246cbc>=_0x13f294){_0x246cbc=_0x13f294;_0x5e5033=0xc8;}else{_0x5e5033=0xce;}_0x2159cc[_0x54bf('0x18')](_0x5e5033);return _0x2159cc[_0x54bf('0x1e')](_0x54bf('0x1f'),_0x1d1251+'-'+_0x246cbc+'/'+_0x13f294)['json'](_0x4ac673);}return null;};}function patchUpdates(_0x5bfd1c){return function(_0x5d8c5b){try{jsonpatch['apply'](_0x5d8c5b,_0x5bfd1c,!![]);}catch(_0x31e49d){return BPromise[_0x54bf('0x20')](_0x31e49d);}return _0x5d8c5b[_0x54bf('0x21')]();};}function saveUpdates(_0x4e127a,_0x724d43){return function(_0x5f3e5b){if(_0x5f3e5b){return _0x5f3e5b[_0x54bf('0x22')](_0x4e127a)[_0x54bf('0x23')](function(_0x394d18){return _0x394d18;});}return null;};}function removeEntity(_0x4a7020,_0x188362){return function(_0x5dbe92){if(_0x5dbe92){return _0x5dbe92[_0x54bf('0x24')]()[_0x54bf('0x23')](function(){var _0xcc5631=_0x5dbe92[_0x54bf('0x25')]({'plain':!![]});var _0x3cc16f='Companies';return db[_0x54bf('0x26')][_0x54bf('0x24')]({'where':{'type':_0x3cc16f,'resourceId':_0xcc5631['id']}})[_0x54bf('0x23')](function(){return _0x5dbe92;});})[_0x54bf('0x23')](function(){_0x4a7020[_0x54bf('0x18')](0xcc)[_0x54bf('0x27')]();});}};}function handleEntityNotFound(_0x323a96,_0x4c51b8){return function(_0x19a7a8){if(!_0x19a7a8){_0x323a96[_0x54bf('0x17')](0x194);}return _0x19a7a8;};}function handleError(_0x44113f,_0x2a7aa6){_0x2a7aa6=_0x2a7aa6||0x1f4;return function(_0x1aa607){logger[_0x54bf('0x28')](_0x1aa607['stack']);if(_0x1aa607[_0x54bf('0x29')]){delete _0x1aa607[_0x54bf('0x29')];}_0x44113f[_0x54bf('0x18')](_0x2a7aa6)[_0x54bf('0x2a')](_0x1aa607);};}exports[_0x54bf('0x2b')]=function(_0x5a3ee7,_0xda5840){var _0x3da3b1={},_0x4b60d1={},_0x1f49e5={'count':0x0,'rows':[]};return db[_0x54bf('0x2c')][_0x54bf('0x2d')]()[_0x54bf('0x23')](function(_0x37613f){_0x4b60d1['model']=_[_0x54bf('0x2e')](_0x37613f);_0x4b60d1[_0x54bf('0x2f')]=_[_0x54bf('0x2e')](_0x5a3ee7[_0x54bf('0x2f')]);_0x4b60d1[_0x54bf('0x30')]=_[_0x54bf('0x31')](_0x4b60d1[_0x54bf('0x32')],_0x4b60d1['query']);_0x3da3b1[_0x54bf('0x33')]=_['intersection'](_0x4b60d1[_0x54bf('0x32')],qs[_0x54bf('0x34')](_0x5a3ee7[_0x54bf('0x2f')][_0x54bf('0x34')]));_0x3da3b1[_0x54bf('0x33')]=_0x3da3b1['attributes']['length']?_0x3da3b1[_0x54bf('0x33')]:_0x4b60d1[_0x54bf('0x32')];if(!_0x5a3ee7[_0x54bf('0x2f')][_0x54bf('0x35')]('nolimit')){_0x3da3b1[_0x54bf('0x1c')]=qs[_0x54bf('0x1c')](_0x5a3ee7['query'][_0x54bf('0x1c')]);_0x3da3b1['offset']=qs[_0x54bf('0x1a')](_0x5a3ee7['query']['offset']);}_0x3da3b1[_0x54bf('0x36')]=qs['sort'](_0x5a3ee7[_0x54bf('0x2f')][_0x54bf('0x37')]);_0x3da3b1[_0x54bf('0x38')]=qs[_0x54bf('0x30')](_[_0x54bf('0x39')](_0x5a3ee7['query'],_0x4b60d1[_0x54bf('0x30')]),_0x37613f);if(_0x5a3ee7[_0x54bf('0x2f')][_0x54bf('0x3a')]){_0x3da3b1[_0x54bf('0x38')]=_['merge'](_0x3da3b1[_0x54bf('0x38')],{'$or':_[_0x54bf('0x3b')](_0x3da3b1[_0x54bf('0x33')],function(_0x5d9cdf){var _0x3e8650={};_0x3e8650[_0x5d9cdf]={'$like':'%'+_0x5a3ee7['query']['filter']+'%'};return _0x3e8650;})});}_0x3da3b1=_[_0x54bf('0x3c')]({},_0x3da3b1,_0x5a3ee7[_0x54bf('0x3d')]);var _0x1c8d8d={'where':_0x3da3b1['where']};return db[_0x54bf('0x2c')]['count'](_0x1c8d8d)[_0x54bf('0x23')](function(_0xa3f48e){_0x1f49e5['count']=_0xa3f48e;if(_0x5a3ee7[_0x54bf('0x2f')][_0x54bf('0x3e')]){_0x3da3b1[_0x54bf('0x3f')]=[{'all':!![]}];}return db['CmCompany']['findAll'](_0x3da3b1);})[_0x54bf('0x23')](function(_0x3c069d){_0x1f49e5['rows']=_0x3c069d;return _0x1f49e5;})[_0x54bf('0x23')](respondWithFilteredResult(_0xda5840,_0x3da3b1))[_0x54bf('0x40')](handleError(_0xda5840,null));})['catch'](handleError(_0xda5840,null));};exports[_0x54bf('0x41')]=function(_0x4b3d2c,_0x2375ee){var _0x14e7cc={'raw':![],'where':{'id':_0x4b3d2c[_0x54bf('0x42')]['id']}},_0x5e629f={};_0x5e629f[_0x54bf('0x32')]=_[_0x54bf('0x2e')](db[_0x54bf('0x2c')][_0x54bf('0x43')]);_0x5e629f['query']=_[_0x54bf('0x2e')](_0x4b3d2c[_0x54bf('0x2f')]);_0x5e629f['filters']=_[_0x54bf('0x31')](_0x5e629f[_0x54bf('0x32')],_0x5e629f[_0x54bf('0x2f')]);_0x14e7cc[_0x54bf('0x33')]=_[_0x54bf('0x31')](_0x5e629f[_0x54bf('0x32')],qs[_0x54bf('0x34')](_0x4b3d2c['query'][_0x54bf('0x34')]));_0x14e7cc[_0x54bf('0x33')]=_0x14e7cc[_0x54bf('0x33')][_0x54bf('0x44')]?_0x14e7cc[_0x54bf('0x33')]:_0x5e629f['model'];if(_0x4b3d2c[_0x54bf('0x2f')][_0x54bf('0x3e')]){_0x14e7cc[_0x54bf('0x3f')]=[{'all':!![]}];}_0x14e7cc=_[_0x54bf('0x3c')]({},_0x14e7cc,_0x4b3d2c[_0x54bf('0x3d')]);return db[_0x54bf('0x2c')][_0x54bf('0x45')](_0x14e7cc)[_0x54bf('0x23')](handleEntityNotFound(_0x2375ee,null))[_0x54bf('0x23')](respondWithResult(_0x2375ee,null))[_0x54bf('0x40')](handleError(_0x2375ee,null));};exports[_0x54bf('0x46')]=function(_0x1f4116,_0x5d5f4d){return db['CmCompany'][_0x54bf('0x46')](_0x1f4116['body'],{})[_0x54bf('0x23')](function(_0x4d59c6){var _0x576277=_0x1f4116[_0x54bf('0x47')][_0x54bf('0x25')]({'plain':!![]});if(!_0x576277)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x576277['role']==='user'){var _0x4c25e7=_0x4d59c6[_0x54bf('0x25')]({'plain':!![]});var _0x42bbfc=_0x54bf('0x48');return db[_0x54bf('0x49')][_0x54bf('0x45')]({'where':{'name':_0x42bbfc,'userProfileId':_0x576277['userProfileId']},'raw':!![]})[_0x54bf('0x23')](function(_0x352f31){if(_0x352f31&&_0x352f31[_0x54bf('0x4a')]===0x0){return db[_0x54bf('0x26')][_0x54bf('0x46')]({'name':_0x4c25e7[_0x54bf('0x29')],'resourceId':_0x4c25e7['id'],'type':_0x352f31[_0x54bf('0x29')],'sectionId':_0x352f31['id']},{})['then'](function(){return _0x4d59c6;});}else{return _0x4d59c6;}})['catch'](function(_0x551f63){logger[_0x54bf('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x551f63);throw _0x551f63;});}return _0x4d59c6;})[_0x54bf('0x23')](respondWithResult(_0x5d5f4d,0xc9))['catch'](handleError(_0x5d5f4d,null));};exports[_0x54bf('0x22')]=function(_0x2302fd,_0x26a6d6){if(_0x2302fd[_0x54bf('0x4b')]['id']){delete _0x2302fd[_0x54bf('0x4b')]['id'];}return db['CmCompany']['find']({'where':{'id':_0x2302fd[_0x54bf('0x42')]['id']}})['then'](handleEntityNotFound(_0x26a6d6,null))[_0x54bf('0x23')](saveUpdates(_0x2302fd['body'],null))['then'](respondWithResult(_0x26a6d6,null))[_0x54bf('0x40')](handleError(_0x26a6d6,null));};exports[_0x54bf('0x24')]=function(_0x30f68f,_0x1f5f79){return db[_0x54bf('0x2c')][_0x54bf('0x45')]({'where':{'id':_0x30f68f[_0x54bf('0x42')]['id']}})[_0x54bf('0x23')](handleEntityNotFound(_0x1f5f79,null))[_0x54bf('0x23')](removeEntity(_0x1f5f79,null))[_0x54bf('0x40')](handleError(_0x1f5f79,null));};exports[_0x54bf('0x2d')]=function(_0x32a64c,_0x42a276){return db[_0x54bf('0x2c')][_0x54bf('0x2d')]()['then'](respondWithResult(_0x42a276,null))['catch'](handleError(_0x42a276,null));};exports['addContacts']=function(_0x4c6587,_0x14d17f,_0x542b31){return db[_0x54bf('0x4c')][_0x54bf('0x45')]({'where':{'id':_0x4c6587[_0x54bf('0x42')]['id']}})['then'](handleEntityNotFound(_0x14d17f,null))[_0x54bf('0x23')](function(_0x37411d){if(_0x37411d){return _0x37411d['addContacts'](_0x4c6587[_0x54bf('0x4b')]['ids'],_['omit'](_0x4c6587[_0x54bf('0x4b')],[_0x54bf('0x4d'),'id'])||{});}})['then'](respondWithResult(_0x14d17f,null))['catch'](handleError(_0x14d17f,null));};exports[_0x54bf('0x4e')]=function(_0x1887f0,_0x4b516b,_0x367e7c){var _0x18058a={};var _0x3fcf0e={};var _0x462f64;var _0x133fb7;return db[_0x54bf('0x2c')][_0x54bf('0x4f')]({'where':{'id':_0x1887f0[_0x54bf('0x42')]['id']}})['then'](handleEntityNotFound(_0x4b516b,null))['then'](function(_0x2aac5c){if(_0x2aac5c){_0x462f64=_0x2aac5c;_0x3fcf0e[_0x54bf('0x32')]=_[_0x54bf('0x2e')](db['CmContact']['rawAttributes']);_0x3fcf0e['query']=_[_0x54bf('0x2e')](_0x1887f0[_0x54bf('0x2f')]);_0x3fcf0e[_0x54bf('0x30')]=_[_0x54bf('0x31')](_0x3fcf0e['model'],_0x3fcf0e['query']);_0x18058a[_0x54bf('0x33')]=_[_0x54bf('0x31')](_0x3fcf0e[_0x54bf('0x32')],qs['fields'](_0x1887f0['query']['fields']));_0x18058a['attributes']=_0x18058a[_0x54bf('0x33')]['length']?_0x18058a[_0x54bf('0x33')]:_0x3fcf0e[_0x54bf('0x32')];_0x18058a[_0x54bf('0x36')]=qs['sort'](_0x1887f0[_0x54bf('0x2f')]['sort']);_0x18058a['where']=qs['filters'](_['pick'](_0x1887f0[_0x54bf('0x2f')],_0x3fcf0e[_0x54bf('0x30')]));if(_0x1887f0['query']['filter']){_0x18058a[_0x54bf('0x38')]=_['merge'](_0x18058a[_0x54bf('0x38')],{'$or':_[_0x54bf('0x3b')](_0x18058a[_0x54bf('0x33')],function(_0x3e1af9){var _0x4934fb={};_0x4934fb[_0x3e1af9]={'$like':'%'+_0x1887f0[_0x54bf('0x2f')]['filter']+'%'};return _0x4934fb;})});}_0x18058a=_['merge']({},_0x18058a,_0x1887f0['options']);return _0x462f64['getContacts'](_0x18058a);}})[_0x54bf('0x23')](function(_0x1c4603){if(_0x1c4603){_0x133fb7=_0x1c4603[_0x54bf('0x44')];if(!_0x1887f0[_0x54bf('0x2f')]['hasOwnProperty'](_0x54bf('0x50'))){_0x18058a['limit']=qs['limit'](_0x1887f0[_0x54bf('0x2f')][_0x54bf('0x1c')]);_0x18058a[_0x54bf('0x1a')]=qs['offset'](_0x1887f0[_0x54bf('0x2f')][_0x54bf('0x1a')]);}return _0x462f64[_0x54bf('0x4e')](_0x18058a);}})[_0x54bf('0x23')](function(_0xcf1df){if(_0xcf1df){return _0xcf1df?{'count':_0x133fb7,'rows':_0xcf1df}:null;}})[_0x54bf('0x23')](respondWithResult(_0x4b516b,null))['catch'](handleError(_0x4b516b,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 81dc3b5..151ec99 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 _0xbc6d=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','define','lodash','util','../../config/logger'];(function(_0x4b125d,_0x3dc671){var _0x535ead=function(_0x1e9b7e){while(--_0x1e9b7e){_0x4b125d['push'](_0x4b125d['shift']());}};_0x535ead(++_0x3dc671);}(_0xbc6d,0x189));var _0xdbc6=function(_0x5d82d9,_0x3d7694){_0x5d82d9=_0x5d82d9-0x0;var _0x3dfd86=_0xbc6d[_0x5d82d9];return _0x3dfd86;};'use strict';var _=require(_0xdbc6('0x0'));var util=require(_0xdbc6('0x1'));var logger=require(_0xdbc6('0x2'))(_0xdbc6('0x3'));var moment=require(_0xdbc6('0x4'));var BPromise=require(_0xdbc6('0x5'));var rp=require(_0xdbc6('0x6'));var fs=require('fs');var path=require(_0xdbc6('0x7'));var rimraf=require(_0xdbc6('0x8'));var config=require(_0xdbc6('0x9'));var attributes=require(_0xdbc6('0xa'));module['exports']=function(_0x190fdd,_0x3a9ebb){return _0x190fdd[_0xdbc6('0xb')]('CmCompany',attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x63c6=['lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./cmCompany.attributes','exports','define','cm_companies'];(function(_0x5e7979,_0x4175c0){var _0x50f569=function(_0x184fa4){while(--_0x184fa4){_0x5e7979['push'](_0x5e7979['shift']());}};_0x50f569(++_0x4175c0);}(_0x63c6,0xf0));var _0x663c=function(_0x4503a1,_0xb44ea){_0x4503a1=_0x4503a1-0x0;var _0x4e0b58=_0x63c6[_0x4503a1];return _0x4e0b58;};'use strict';var _=require(_0x663c('0x0'));var util=require(_0x663c('0x1'));var logger=require('../../config/logger')(_0x663c('0x2'));var moment=require(_0x663c('0x3'));var BPromise=require(_0x663c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x663c('0x5'));var rimraf=require(_0x663c('0x6'));var config=require(_0x663c('0x7'));var attributes=require(_0x663c('0x8'));module[_0x663c('0x9')]=function(_0x2c2c4e,_0x461111){return _0x2c2c4e[_0x663c('0xa')]('CmCompany',attributes,{'tableName':_0x663c('0xb'),'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 ef7e702..5643399 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 _0x8af7=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','CmCompany,\x20%s,\x20%s','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','message','info','lodash','util'];(function(_0x136290,_0x3e6b8f){var _0x290e92=function(_0x4095d6){while(--_0x4095d6){_0x136290['push'](_0x136290['shift']());}};_0x290e92(++_0x3e6b8f);}(_0x8af7,0x141));var _0x78af=function(_0x2e9921,_0x35501a){_0x2e9921=_0x2e9921-0x0;var _0x44575a=_0x8af7[_0x2e9921];return _0x44575a;};'use strict';var _=require(_0x78af('0x0'));var util=require(_0x78af('0x1'));var moment=require(_0x78af('0x2'));var BPromise=require(_0x78af('0x3'));var rs=require(_0x78af('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x78af('0x5'))['db'];var utils=require(_0x78af('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x78af('0x7'));var jayson=require(_0x78af('0x8'));var client=jayson[_0x78af('0x9')][_0x78af('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x222a7a,_0x25f854,_0x4b813e){return new BPromise(function(_0x43b884,_0x28f212){return client['request'](_0x222a7a,_0x4b813e)[_0x78af('0xb')](function(_0x28e2f6){logger['info'](_0x78af('0xc'),_0x25f854,'request\x20sent');logger[_0x78af('0xd')](_0x78af('0xe'),_0x25f854,'request\x20sent',JSON[_0x78af('0xf')](_0x28e2f6));if(_0x28e2f6[_0x78af('0x10')]){if(_0x28e2f6[_0x78af('0x10')]['code']===0x1f4){logger[_0x78af('0x10')](_0x78af('0xc'),_0x25f854,_0x28e2f6[_0x78af('0x10')][_0x78af('0x11')]);return _0x28f212(_0x28e2f6[_0x78af('0x10')][_0x78af('0x11')]);}logger[_0x78af('0x10')](_0x78af('0xc'),_0x25f854,_0x28e2f6[_0x78af('0x10')][_0x78af('0x11')]);return _0x43b884(_0x28e2f6[_0x78af('0x10')]['message']);}else{logger[_0x78af('0x12')](_0x78af('0xc'),_0x25f854,'request\x20sent');_0x43b884(_0x28e2f6['result']['message']);}})['catch'](function(_0x1c48c1){logger['error'](_0x78af('0xc'),_0x25f854,_0x1c48c1);_0x28f212(_0x1c48c1);});});} \ No newline at end of file +var _0x9a6b=['CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','CmCompany,\x20%s,\x20%s','debug'];(function(_0x3c00fa,_0x5b8d3b){var _0x5bdf86=function(_0x5518af){while(--_0x5518af){_0x3c00fa['push'](_0x3c00fa['shift']());}};_0x5bdf86(++_0x5b8d3b);}(_0x9a6b,0x92));var _0xb9a6=function(_0x24c0a3,_0x443029){_0x24c0a3=_0x24c0a3-0x0;var _0xd4cfbb=_0x9a6b[_0x24c0a3];return _0xd4cfbb;};'use strict';var _=require('lodash');var util=require(_0xb9a6('0x0'));var moment=require(_0xb9a6('0x1'));var BPromise=require(_0xb9a6('0x2'));var rs=require(_0xb9a6('0x3'));var fs=require('fs');var Redis=require(_0xb9a6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb9a6('0x5'));var logger=require(_0xb9a6('0x6'))('rpc');var config=require(_0xb9a6('0x7'));var jayson=require(_0xb9a6('0x8'));var client=jayson[_0xb9a6('0x9')][_0xb9a6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58a3c5,_0x5eefc3,_0x5a7cd1){return new BPromise(function(_0xa7669c,_0xbb6163){return client[_0xb9a6('0xb')](_0x58a3c5,_0x5a7cd1)[_0xb9a6('0xc')](function(_0x49776f){logger['info'](_0xb9a6('0xd'),_0x5eefc3,'request\x20sent');logger[_0xb9a6('0xe')](_0xb9a6('0xf'),_0x5eefc3,_0xb9a6('0x10'),JSON[_0xb9a6('0x11')](_0x49776f));if(_0x49776f[_0xb9a6('0x12')]){if(_0x49776f[_0xb9a6('0x12')][_0xb9a6('0x13')]===0x1f4){logger['error']('CmCompany,\x20%s,\x20%s',_0x5eefc3,_0x49776f[_0xb9a6('0x12')][_0xb9a6('0x14')]);return _0xbb6163(_0x49776f[_0xb9a6('0x12')][_0xb9a6('0x14')]);}logger[_0xb9a6('0x12')]('CmCompany,\x20%s,\x20%s',_0x5eefc3,_0x49776f[_0xb9a6('0x12')]['message']);return _0xa7669c(_0x49776f[_0xb9a6('0x12')][_0xb9a6('0x14')]);}else{logger[_0xb9a6('0x15')]('CmCompany,\x20%s,\x20%s',_0x5eefc3,'request\x20sent');_0xa7669c(_0x49776f[_0xb9a6('0x16')][_0xb9a6('0x14')]);}})['catch'](function(_0x3f824a){logger[_0xb9a6('0x12')](_0xb9a6('0xd'),_0x5eefc3,_0x3f824a);_0xbb6163(_0x3f824a);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index d1d6e70..4903a3e 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 _0xe455=['./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/contacts','getContacts','post','addContacts','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5e0531,_0x4537b9){var _0xce690a=function(_0x2f015f){while(--_0x2f015f){_0x5e0531['push'](_0x5e0531['shift']());}};_0xce690a(++_0x4537b9);}(_0xe455,0xad));var _0x5e45=function(_0x30be10,_0x374300){_0x30be10=_0x30be10-0x0;var _0x3b379f=_0xe455[_0x30be10];return _0x3b379f;};'use strict';var multer=require(_0x5e45('0x0'));var util=require(_0x5e45('0x1'));var path=require('path');var timeout=require(_0x5e45('0x2'));var express=require(_0x5e45('0x3'));var router=express[_0x5e45('0x4')]();var fs_extra=require(_0x5e45('0x5'));var auth=require(_0x5e45('0x6'));var interaction=require(_0x5e45('0x7'));var config=require(_0x5e45('0x8'));var controller=require(_0x5e45('0x9'));router[_0x5e45('0xa')]('/',auth[_0x5e45('0xb')](),controller[_0x5e45('0xc')]);router[_0x5e45('0xa')](_0x5e45('0xd'),auth[_0x5e45('0xb')](),controller[_0x5e45('0xe')]);router[_0x5e45('0xa')](_0x5e45('0xf'),auth[_0x5e45('0xb')](),controller[_0x5e45('0x10')]);router['get'](_0x5e45('0x11'),auth['isAuthenticated'](),controller[_0x5e45('0x12')]);router[_0x5e45('0x13')]('/',auth[_0x5e45('0xb')](),controller['create']);router[_0x5e45('0x13')](_0x5e45('0x11'),auth[_0x5e45('0xb')](),controller[_0x5e45('0x14')]);router[_0x5e45('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x5e45('0x16')]);router[_0x5e45('0x17')](_0x5e45('0xf'),auth[_0x5e45('0xb')](),controller[_0x5e45('0x18')]);module[_0x5e45('0x19')]=router; \ No newline at end of file +var _0xf3bb=['exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/contacts','getContacts','post','addContacts','put','delete','destroy'];(function(_0x271507,_0x2b5210){var _0xd2da30=function(_0x499da1){while(--_0x499da1){_0x271507['push'](_0x271507['shift']());}};_0xd2da30(++_0x2b5210);}(_0xf3bb,0x15a));var _0xbf3b=function(_0xecddb9,_0x15e35e){_0xecddb9=_0xecddb9-0x0;var _0x34b872=_0xf3bb[_0xecddb9];return _0x34b872;};'use strict';var multer=require(_0xbf3b('0x0'));var util=require(_0xbf3b('0x1'));var path=require(_0xbf3b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xbf3b('0x3'));var auth=require(_0xbf3b('0x4'));var interaction=require(_0xbf3b('0x5'));var config=require(_0xbf3b('0x6'));var controller=require(_0xbf3b('0x7'));router[_0xbf3b('0x8')]('/',auth['isAuthenticated'](),controller[_0xbf3b('0x9')]);router[_0xbf3b('0x8')](_0xbf3b('0xa'),auth[_0xbf3b('0xb')](),controller[_0xbf3b('0xc')]);router[_0xbf3b('0x8')](_0xbf3b('0xd'),auth[_0xbf3b('0xb')](),controller[_0xbf3b('0xe')]);router['get'](_0xbf3b('0xf'),auth[_0xbf3b('0xb')](),controller[_0xbf3b('0x10')]);router[_0xbf3b('0x11')]('/',auth[_0xbf3b('0xb')](),controller['create']);router[_0xbf3b('0x11')](_0xbf3b('0xf'),auth[_0xbf3b('0xb')](),controller[_0xbf3b('0x12')]);router[_0xbf3b('0x13')](_0xbf3b('0xd'),auth[_0xbf3b('0xb')](),controller['update']);router[_0xbf3b('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xbf3b('0x15')]);module[_0xbf3b('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 3afea2f..524b980 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 _0xca9e=['exports','STRING','TEXT','INTEGER','UNSIGNED','NOW','lodash','sequelize'];(function(_0x2d73da,_0x4e9643){var _0x2d06af=function(_0x2f5810){while(--_0x2f5810){_0x2d73da['push'](_0x2d73da['shift']());}};_0x2d06af(++_0x4e9643);}(_0xca9e,0x136));var _0xeca9=function(_0x1fc62f,_0x547477){_0x1fc62f=_0x1fc62f-0x0;var _0x2cb919=_0xca9e[_0x1fc62f];return _0x2cb919;};'use strict';var _=require(_0xeca9('0x0'));var Sequelize=require(_0xeca9('0x1'));module[_0xeca9('0x2')]={'firstName':{'type':Sequelize[_0xeca9('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0xeca9('0x3')]},'street':{'type':Sequelize[_0xeca9('0x3')]},'postalCode':{'type':Sequelize[_0xeca9('0x3')]},'city':{'type':Sequelize[_0xeca9('0x3')]},'country':{'type':Sequelize[_0xeca9('0x3')]},'dateOfBirth':{'type':Sequelize[_0xeca9('0x3')]},'description':{'type':Sequelize[_0xeca9('0x4')]},'phone':{'type':Sequelize[_0xeca9('0x3')]},'mobile':{'type':Sequelize[_0xeca9('0x3')]},'fax':{'type':Sequelize[_0xeca9('0x3')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0xeca9('0x3')]},'facebook':{'type':Sequelize[_0xeca9('0x3')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0xeca9('0x3')]},'teams':{'type':Sequelize[_0xeca9('0x3')]},'viber':{'type':Sequelize[_0xeca9('0x3')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0xeca9('0x3')]},'telegram':{'type':Sequelize[_0xeca9('0x3')]},'UserId':{'type':Sequelize[_0xeca9('0x5')]},'AdditionalPhones':{'type':Sequelize[_0xeca9('0x3')]},'priority':{'type':Sequelize[_0xeca9('0x5')](0x2)[_0xeca9('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0xeca9('0x7')]}}; \ No newline at end of file +var _0xc0a4=['STRING','INTEGER','UNSIGNED','DATE','NOW','sequelize','exports'];(function(_0x302f9b,_0x57fd3e){var _0x4b7c81=function(_0x239046){while(--_0x239046){_0x302f9b['push'](_0x302f9b['shift']());}};_0x4b7c81(++_0x57fd3e);}(_0xc0a4,0x147));var _0x4c0a=function(_0x1ab88a,_0x4a27dc){_0x1ab88a=_0x1ab88a-0x0;var _0x56b695=_0xc0a4[_0x1ab88a];return _0x56b695;};'use strict';var _=require('lodash');var Sequelize=require(_0x4c0a('0x0'));module[_0x4c0a('0x1')]={'firstName':{'type':Sequelize[_0x4c0a('0x2')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x4c0a('0x2')]},'postalCode':{'type':Sequelize[_0x4c0a('0x2')]},'city':{'type':Sequelize[_0x4c0a('0x2')]},'country':{'type':Sequelize[_0x4c0a('0x2')]},'dateOfBirth':{'type':Sequelize[_0x4c0a('0x2')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x4c0a('0x2')]},'mobile':{'type':Sequelize[_0x4c0a('0x2')]},'fax':{'type':Sequelize[_0x4c0a('0x2')]},'email':{'type':Sequelize[_0x4c0a('0x2')]},'url':{'type':Sequelize[_0x4c0a('0x2')]},'facebook':{'type':Sequelize[_0x4c0a('0x2')]},'fb_data':{'type':Sequelize[_0x4c0a('0x2')]},'twitter':{'type':Sequelize[_0x4c0a('0x2')]},'skype':{'type':Sequelize[_0x4c0a('0x2')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x4c0a('0x2')]},'line':{'type':Sequelize[_0x4c0a('0x2')]},'wechat':{'type':Sequelize[_0x4c0a('0x2')]},'telegram':{'type':Sequelize[_0x4c0a('0x2')]},'UserId':{'type':Sequelize[_0x4c0a('0x3')]},'AdditionalPhones':{'type':Sequelize[_0x4c0a('0x2')]},'priority':{'type':Sequelize[_0x4c0a('0x3')](0x2)[_0x4c0a('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x4c0a('0x5')],'defaultValue':Sequelize[_0x4c0a('0x6')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 6834242..46b46fd 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 _0xe3d4=['agent','getLists','c.ListId\x20IS\x20NULL','ListId','sequelize','toString','keyBy','merge','CmContact','c.firstName','c.lastName','c.phone','c.mobile','c.email','c.ListId','c.deletedAt','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','catch','destroy','describe','tags','columnName','displayName','CmCustomField','findAll','alias','values','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','body','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','create','ChatMessage','ChatOfflineMessage','MailInteraction','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperHistory','VoiceCallReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','additionalPhones','each','duplicates','$or','findOrCreate','spread','contact','show','params','CmContactHasItem','Phones','ContactItemType','ItemType','literal','`Phones.ItemType`.OrderBy','log','$and','format','cf_%d','pickBy','setFields','id\x20=\x20?','toParam','phone','getTags','rawAttributes','options','setTags','ids','setAdditionalPhones','item_types','items','ItemTypeId','description','PHONE','OrderBy','CmHopperId','ItemType.OrderBy','CmHopperAdditionalPhone','bulkCreate','getAdditionalPhones','`ItemType`.OrderBy','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','hopperId','getHoppers','ContactId','includeAll','include','getHopperHistories','getHopperFinals','CmHopperFinal','getJscriptySessions','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\x20firstName\x20column\x20specified','join','file','filename','chmodSync','child_process','fork','CompanyId','File\x20uploaded\x20correctly!','pid','send','upload','createReadStream','parse','meta','import','binding','No\x20phone\x20column\x20specified','firstName','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','../../components/import/cm/csvUpdates','getJourney','mail','chat','sms','whatsapp','voice','resolve','channel','includes','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','destination','endtime','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','findAndCountAll','get','startCase','closed','closedAt','disposition','secondDisposition','thirdDisposition','Account','key','Owner','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingType','ratingValue','referer','subject','substatus','openchannel','threadId','Interaction','flatten','reverse','slice','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','save','update','then','error','name','index','length','startsWith','cf_','push','findOne','trimStart','all','fieldType','type','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','select','field','color','tools_tags','from','cm_contacts','cm_user_has_contacts','left_join','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator','conditions','find','Tag','split','map','union','User','and','uc.UserId\x20=\x20?','value','datetime','castTo','DATE','buildExpression','text','filter','isNil','Contact','forEach','c.ListId\x20IN\x20?','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','c.id','QueryTypes','SELECT','DESC','isEmpty','t.id\x20IN\x20?','user','role'];(function(_0x44f39d,_0x1d05df){var _0x295cdf=function(_0x563147){while(--_0x563147){_0x44f39d['push'](_0x44f39d['shift']());}};_0x295cdf(++_0x1d05df);}(_0xe3d4,0xc6));var _0x4e3d=function(_0x231a47,_0x46a963){_0x231a47=_0x231a47-0x0;var _0x48d7c9=_0xe3d4[_0x231a47];return _0x48d7c9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4e3d('0x0'));var zipdir=require(_0x4e3d('0x1'));var jsonpatch=require(_0x4e3d('0x2'));var rp=require('request-promise');var moment=require(_0x4e3d('0x3'));var BPromise=require(_0x4e3d('0x4'));var Mustache=require('mustache');var util=require(_0x4e3d('0x5'));var path=require('path');var sox=require(_0x4e3d('0x6'));var csv=require(_0x4e3d('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4e3d('0x8'));var _=require(_0x4e3d('0x9'));var squel=require('squel');var crypto=require(_0x4e3d('0xa'));var jsforce=require(_0x4e3d('0xb'));var deskjs=require(_0x4e3d('0xc'));var toCsv=require(_0x4e3d('0x7'));var querystring=require(_0x4e3d('0xd'));var Papa=require(_0x4e3d('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4e3d('0xf'));var as=require(_0x4e3d('0x10'));var hardwareService=require(_0x4e3d('0x11'));var logger=require(_0x4e3d('0x12'))(_0x4e3d('0x13'));var utils=require(_0x4e3d('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x4e3d('0x15'));var db=require(_0x4e3d('0x16'))['db'];config[_0x4e3d('0x17')]=_[_0x4e3d('0x18')](config[_0x4e3d('0x17')],{'host':_0x4e3d('0x19'),'port':0x18eb});var socket=require(_0x4e3d('0x1a'))(new Redis(config[_0x4e3d('0x17')]));require('./cmContact.socket')[_0x4e3d('0x1b')](socket);function respondWithStatusCode(_0x4325b4,_0x3b7b45){_0x3b7b45=_0x3b7b45||0xcc;return function(_0x5e0d2c){if(_0x5e0d2c){return _0x4325b4[_0x4e3d('0x1c')](_0x3b7b45);}return _0x4325b4[_0x4e3d('0x1d')](_0x3b7b45)[_0x4e3d('0x1e')]();};}function respondWithResult(_0xc20768,_0x1b829e){_0x1b829e=_0x1b829e||0xc8;return function(_0x364798){if(_0x364798){return _0xc20768[_0x4e3d('0x1d')](_0x1b829e)[_0x4e3d('0x1f')](_0x364798);}};}function respondWithFilteredResult(_0x554ba6,_0x2aab75){return function(_0x5129d5){if(_0x5129d5){var _0x4b74cb=typeof _0x2aab75[_0x4e3d('0x20')]==='undefined'&&typeof _0x2aab75['limit']===_0x4e3d('0x21');var _0x2e37ad=_0x5129d5[_0x4e3d('0x22')];var _0x318bd4=_0x4b74cb?0x0:_0x2aab75['offset'];var _0x35d75c=_0x4b74cb?_0x5129d5['count']:_0x2aab75[_0x4e3d('0x20')]+_0x2aab75['limit'];var _0x170f88;if(_0x35d75c>=_0x2e37ad){_0x35d75c=_0x2e37ad;_0x170f88=0xc8;}else{_0x170f88=0xce;}_0x554ba6[_0x4e3d('0x1d')](_0x170f88);return _0x554ba6[_0x4e3d('0x23')](_0x4e3d('0x24'),_0x318bd4+'-'+_0x35d75c+'/'+_0x2e37ad)[_0x4e3d('0x1f')](_0x5129d5);}return null;};}function patchUpdates(_0x2c8186){return function(_0x575c72){try{jsonpatch['apply'](_0x575c72,_0x2c8186,!![]);}catch(_0x18271a){return BPromise[_0x4e3d('0x25')](_0x18271a);}return _0x575c72[_0x4e3d('0x26')]();};}function saveUpdates(_0x49301f,_0x3e6b53){return function(_0x58a9cb){if(_0x58a9cb){return _0x58a9cb[_0x4e3d('0x27')](_0x49301f)[_0x4e3d('0x28')](function(_0x43bc1b){return _0x43bc1b;});}return null;};}function removeEntity(_0x50d9db,_0x2434ea){return function(_0xa6569b){if(_0xa6569b){return _0xa6569b['destroy']()[_0x4e3d('0x28')](function(){_0x50d9db[_0x4e3d('0x1d')](0xcc)[_0x4e3d('0x1e')]();});}};}function handleEntityNotFound(_0x4a7820,_0x727783){return function(_0x56395b){if(!_0x56395b){_0x4a7820[_0x4e3d('0x1c')](0x194);}return _0x56395b;};}function handleError(_0x5271a1,_0x2edb44){_0x2edb44=_0x2edb44||0x1f4;return function(_0x2d1991){logger[_0x4e3d('0x29')](_0x2d1991['stack']);if(_0x2d1991[_0x4e3d('0x2a')]){delete _0x2d1991[_0x4e3d('0x2a')];}_0x5271a1['status'](_0x2edb44)['send'](_0x2d1991);};}exports[_0x4e3d('0x2b')]=function(_0x333fff,_0x36621d){var _0x49ba5b={},_0x4157e5={},_0x1be6aa={'count':0x0,'rows':[]};return db['CmContact']['describe']()[_0x4e3d('0x28')](function(_0x21c9d1){var _0x575957=[];for(var _0xefeafa=0x0;_0xefeafa0x1){_0x44926a['or'](_0x4e3d('0x6b'),qs[_0x4e3d('0x6c')](_0x211591),null);}else{if(qs[_0x4e3d('0x6d')](_0x211591)){_0x44926a['or']('c.id\x20LIKE\x20?',_0x211591+'%');_0x44926a['or']('c.phone\x20LIKE\x20?',_0x211591+'%');_0x44926a['or'](_0x4e3d('0x6e'),_0x211591+'%');_0x44926a['or'](_0x4e3d('0x6f'),_0x211591+'%');}else if(qs[_0x4e3d('0x70')](_0x211591)){_0x44926a['or'](_0x4e3d('0x71'),_0x211591+'%');}else{_0x44926a['or'](_0x4e3d('0x72'),'%'+_0x211591+'%');_0x44926a['or'](_0x4e3d('0x73'),'%'+_0x211591+'%');_0x44926a['or'](_0x4e3d('0x71'),'%'+_0x211591+'%');}}}}_0x5b6fe0[_0x4e3d('0x41')](_0x44926a);_0x5b6fe0[_0x4e3d('0x74')](_0x4e3d('0x75'));var _0x45095f={'type':db['Sequelize'][_0x4e3d('0x76')][_0x4e3d('0x77')],'raw':!![]};var _0x3d069f=_0x5b6fe0['clone']()[_0x4e3d('0x44')](_0x4e3d('0x75'));if(_0x49ba5b[_0x4e3d('0x3f')]){_0x49ba5b[_0x4e3d('0x3f')][_0x4e3d('0x65')](function(_0x270f34){_0x5b6fe0['order']('c.'+_0x270f34[0x0],_0x270f34[0x1]===_0x4e3d('0x78')?![]:!![]);});}if(!_[_0x4e3d('0x79')](_0xee533a)){_0x5b6fe0['having'](_0xa3ff1f);_0x3d069f[_0x4e3d('0x41')](_0x4e3d('0x7a'),_0xee533a);}BPromise['resolve']()['then'](function(){if(!_0x454a6f)return;if(_0x333fff[_0x4e3d('0x7b')][_0x4e3d('0x7c')]!==_0x4e3d('0x7d'))return;if(!_['some'](_0x454a6f[_0x4e3d('0x53')],['field','User'])){return _0x333fff[_0x4e3d('0x7b')][_0x4e3d('0x7e')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4d914c){if(_[_0x4e3d('0x79')](_0x4d914c)){_0x3d069f[_0x4e3d('0x41')](_0x4e3d('0x7f'));_0x5b6fe0[_0x4e3d('0x41')](_0x4e3d('0x7f'));}else{_0x3d069f[_0x4e3d('0x41')](_0x4e3d('0x66'),_['map'](_0x4d914c,'id'));_0x5b6fe0[_0x4e3d('0x41')](_0x4e3d('0x66'),_[_0x4e3d('0x57')](_0x4d914c,'id'));}});}})[_0x4e3d('0x28')](function(){if(_0x333fff['user']['role']===_0x4e3d('0x7d')&&!_0x454a6f&&!_0x333fff[_0x4e3d('0x37')][_0x4e3d('0x80')])return[];return db[_0x4e3d('0x81')][_0x4e3d('0x37')](_0x3d069f[_0x4e3d('0x82')](),_0x45095f);})[_0x4e3d('0x28')](function(_0x59cdd6){_0x1be6aa[_0x4e3d('0x22')]=_0x59cdd6[_0x4e3d('0x2c')];if(_0x1be6aa[_0x4e3d('0x22')]===0x0)return[];return db[_0x4e3d('0x81')][_0x4e3d('0x37')](_0x4fc35b[_0x4e3d('0x82')](),_0x45095f)[_0x4e3d('0x28')](function(_0x2e7d5c){_0x4e1b89=_[_0x4e3d('0x83')](_0x2e7d5c,'id');_0x45095f=_[_0x4e3d('0x84')](_0x45095f,{'model':db[_0x4e3d('0x85')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x333fff[_0x4e3d('0x37')][_0x4e3d('0x3a')]){_0x49ba5b[_0x4e3d('0x3b')]['forEach'](function(_0x209313){_0x5b6fe0[_0x4e3d('0x44')]('c.'+_0x209313);});}else{_0x5b6fe0[_0x4e3d('0x44')]('c.id');_0x5b6fe0[_0x4e3d('0x44')](_0x4e3d('0x86'));_0x5b6fe0[_0x4e3d('0x44')](_0x4e3d('0x87'));_0x5b6fe0[_0x4e3d('0x44')](_0x4e3d('0x88'));_0x5b6fe0[_0x4e3d('0x44')](_0x4e3d('0x89'));_0x5b6fe0[_0x4e3d('0x44')]('c.fax');_0x5b6fe0[_0x4e3d('0x44')](_0x4e3d('0x8a'));_0x5b6fe0[_0x4e3d('0x44')](_0x4e3d('0x8b'));_0x5b6fe0['field']('c.createdAt');_0x5b6fe0[_0x4e3d('0x44')](_0x4e3d('0x8c'));_0x5b6fe0[_0x4e3d('0x44')]('c.CompanyId');_0x5b6fe0[_0x4e3d('0x44')](_0x4e3d('0x8d'),'TagIds');}if(_0x49ba5b[_0x4e3d('0x3e')])_0x5b6fe0[_0x4e3d('0x3e')](_0x49ba5b[_0x4e3d('0x3e')]);if(_0x49ba5b[_0x4e3d('0x20')])_0x5b6fe0['offset'](_0x49ba5b['offset']);return db['sequelize'][_0x4e3d('0x37')](_0x5b6fe0['toString'](),_0x45095f);});})['then'](function(_0x4bb959){_0x4bb959[_0x4e3d('0x65')](function(_0x9aa22b){if(_0x9aa22b[_0x4e3d('0x8e')]){_0x9aa22b[_0x4e3d('0x8f')]=[];_0x9aa22b[_0x4e3d('0x8e')][_0x4e3d('0x56')](',')[_0x4e3d('0x65')](function(_0x37dac9){_0x9aa22b[_0x4e3d('0x8f')][_0x4e3d('0x2f')](_0x4e1b89[_0x37dac9]);});}delete _0x9aa22b['TagIds'];});_0x1be6aa[_0x4e3d('0x90')]=_0x4bb959;return _0x1be6aa;})[_0x4e3d('0x28')](respondWithFilteredResult(_0x36621d,_0x49ba5b));})[_0x4e3d('0x91')](handleError(_0x36621d,null));};exports[_0x4e3d('0x92')]=function(_0x282e03,_0x25fcf6){return db[_0x4e3d('0x85')][_0x4e3d('0x54')]({'where':{'id':_0x282e03['params']['id']}})[_0x4e3d('0x28')](handleEntityNotFound(_0x25fcf6,null))[_0x4e3d('0x28')](removeEntity(_0x25fcf6,null))[_0x4e3d('0x91')](handleError(_0x25fcf6,null));};exports[_0x4e3d('0x93')]=function(_0x4a5deb,_0x18975b){return db['CmContact'][_0x4e3d('0x93')]()[_0x4e3d('0x28')](function(_0x3a3ebc){delete _0x3a3ebc[_0x4e3d('0x94')];for(var _0xb3f80e=0x0;_0xb3f80e0x0){return new Promise(function(_0x115418,_0x21f929){var _0x8ee723=[];for(var _0x2b00da=0x0;_0x2b00da<_0x19851c[_0x4e3d('0x2c')];_0x2b00da++){_0x8ee723['push'](insertAdditionalPhones(_0x19851c[_0x2b00da][_0x4e3d('0xbb')],_0x19851c[_0x2b00da][_0x4e3d('0xb5')]));}Promise['all'](_0x8ee723)['then'](function(){_0x115418(0x1);});})['then'](function(){return{'success':_0x12fe73,'failure':_0x1d72ec,'duplicates':_0x24efce};});}else{return{'success':_0x12fe73,'failure':_0x1d72ec,'duplicates':_0x24efce};}}})[_0x4e3d('0x28')](respondWithResult(_0x14db21,0xc9))['catch'](handleError(_0x14db21,null));};exports[_0x4e3d('0xbc')]=function(_0x50217f,_0xed0e42,_0x2902ca){var _0x32df8;return db[_0x4e3d('0x85')][_0x4e3d('0x93')]()[_0x4e3d('0x28')](function(_0x2cf647){return db[_0x4e3d('0x85')]['find']({'where':{'id':_0x50217f[_0x4e3d('0xbd')]['id']},'include':[{'model':db['Tag'],'as':_0x4e3d('0x8f'),'attributes':['id','name','color'],'required':_0x50217f[_0x4e3d('0x37')][_0x4e3d('0x67')]?!![]:![]},{'model':db[_0x4e3d('0xbe')],'as':_0x4e3d('0xbf'),'where':{'CmContactId':_0x50217f[_0x4e3d('0xbd')]['id']},'required':![],'include':[{'model':db[_0x4e3d('0xc0')],'as':_0x4e3d('0xc1')}]}],'order':[db[_0x4e3d('0x81')][_0x4e3d('0xc2')](_0x4e3d('0xc3'))],'logging':console[_0x4e3d('0xc4')],'attributes':_['keys'](_0x2cf647)});})[_0x4e3d('0x28')](function(_0x40083f){_0x32df8=_0x40083f['get']({'plain':!![]});var _0x56513b={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x40083f&&_0x40083f[_0x4e3d('0x80')]){if(_0x40083f[_0x4e3d('0x80')]){_0x56513b[_0x4e3d('0x41')][_0x4e3d('0xc5')]['push']({'ListId':{'$ne':_0x40083f[_0x4e3d('0x80')]}});}}return db[_0x4e3d('0x97')][_0x4e3d('0x98')](_0x56513b);})[_0x4e3d('0x28')](function(_0x5e93ea){return _['omit'](_0x32df8,_[_0x4e3d('0x57')](_0x5e93ea,function(_0x15e32c){return util[_0x4e3d('0xc6')](_0x4e3d('0xc7'),_0x15e32c['id']);}));})['then'](handleEntityNotFound(_0xed0e42,null))[_0x4e3d('0x28')](respondWithResult(_0xed0e42,null))[_0x4e3d('0x91')](handleError(_0xed0e42,null));};exports[_0x4e3d('0x27')]=function(_0x5224bd,_0x3ba69c){var _0x449321;if(_0x5224bd['body']['id']){delete _0x5224bd['body']['id'];}return db[_0x4e3d('0x85')][_0x4e3d('0x54')]({'where':{'id':_0x5224bd['params']['id']}})[_0x4e3d('0x28')](handleEntityNotFound(_0x3ba69c,null))[_0x4e3d('0x28')](saveUpdates(_0x5224bd[_0x4e3d('0x9d')],null))[_0x4e3d('0x28')](function(_0x326ac2){_0x449321=_0x326ac2;var _0x194bb2={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x326ac2&&_0x326ac2[_0x4e3d('0x80')]){if(_0x326ac2[_0x4e3d('0x80')]){_0x194bb2[_0x4e3d('0x41')]['$and'][_0x4e3d('0x2f')]({'ListId':{'$ne':_0x326ac2[_0x4e3d('0x80')]}});}}return db[_0x4e3d('0x97')][_0x4e3d('0x98')](_0x194bb2);})[_0x4e3d('0x28')](function(_0x47f4f8){if(_0x47f4f8){return _['omit'](_[_0x4e3d('0xc8')](_0x5224bd[_0x4e3d('0x9d')],function(_0x184b36,_0x466cf3){return _[_0x4e3d('0x2d')](_0x466cf3,_0x4e3d('0x2e'));}),_[_0x4e3d('0x57')](_0x47f4f8,function(_0x6f5f6e){return util[_0x4e3d('0xc6')](_0x4e3d('0xc7'),_0x6f5f6e['id']);}));}})[_0x4e3d('0x28')](function(_0x122cbe){if(_0x122cbe&&!_['isEmpty'](_0x122cbe)){var _0x4a9def=squel[_0x4e3d('0x27')]()['table'](_0x4e3d('0x48'))[_0x4e3d('0xc9')](_0x122cbe)[_0x4e3d('0x41')](_0x4e3d('0xca'),_0x5224bd[_0x4e3d('0xbd')]['id'])[_0x4e3d('0xcb')]();return db[_0x4e3d('0x81')][_0x4e3d('0x37')](_0x4a9def['text'],{'replacements':_0x4a9def[_0x4e3d('0x9a')]});}})[_0x4e3d('0x28')](function(){if(_0x5224bd['body']['phone']&&_0x449321){return db[_0x4e3d('0x9e')][_0x4e3d('0x27')]({'phone':_0x5224bd[_0x4e3d('0x9d')][_0x4e3d('0xcc')]},{'where':{'ContactId':_0x449321['id']}});}})[_0x4e3d('0x28')](function(){return _0x449321;})[_0x4e3d('0x28')](respondWithResult(_0x3ba69c,null))['catch'](handleError(_0x3ba69c,null));};exports[_0x4e3d('0xcd')]=function(_0x1b108f,_0x85b2c1,_0x4a10ae){var _0x21c995={};var _0x57ddab={};var _0x131043;var _0x558320;return db[_0x4e3d('0x85')]['findOne']({'where':{'id':_0x1b108f[_0x4e3d('0xbd')]['id']}})['then'](handleEntityNotFound(_0x85b2c1,null))[_0x4e3d('0x28')](function(_0x1e2cad){if(_0x1e2cad){_0x131043=_0x1e2cad;_0x57ddab[_0x4e3d('0x35')]=_[_0x4e3d('0x36')](db[_0x4e3d('0x55')][_0x4e3d('0xce')]);_0x57ddab[_0x4e3d('0x37')]=_[_0x4e3d('0x36')](_0x1b108f[_0x4e3d('0x37')]);_0x57ddab['filters']=_['intersection'](_0x57ddab['model'],_0x57ddab[_0x4e3d('0x37')]);_0x21c995['attributes']=_[_0x4e3d('0x39')](_0x57ddab[_0x4e3d('0x35')],qs[_0x4e3d('0x3a')](_0x1b108f[_0x4e3d('0x37')][_0x4e3d('0x3a')]));_0x21c995[_0x4e3d('0x3b')]=_0x21c995[_0x4e3d('0x3b')][_0x4e3d('0x2c')]?_0x21c995[_0x4e3d('0x3b')]:_0x57ddab[_0x4e3d('0x35')];_0x21c995[_0x4e3d('0x3f')]=qs[_0x4e3d('0x40')](_0x1b108f[_0x4e3d('0x37')][_0x4e3d('0x40')]);_0x21c995['where']=qs['filters'](_[_0x4e3d('0x42')](_0x1b108f[_0x4e3d('0x37')],_0x57ddab[_0x4e3d('0x38')]));if(_0x1b108f['query'][_0x4e3d('0x62')]){_0x21c995[_0x4e3d('0x41')]=_[_0x4e3d('0x84')](_0x21c995[_0x4e3d('0x41')],{'$or':_[_0x4e3d('0x57')](_0x21c995[_0x4e3d('0x3b')],function(_0x470489){var _0x5a5808={};_0x5a5808[_0x470489]={'$like':'%'+_0x1b108f[_0x4e3d('0x37')][_0x4e3d('0x62')]+'%'};return _0x5a5808;})});}_0x21c995=_['merge']({},_0x21c995,_0x1b108f[_0x4e3d('0xcf')]);return _0x131043['getTags'](_0x21c995);}})['then'](function(_0x5526fc){if(_0x5526fc){_0x558320=_0x5526fc[_0x4e3d('0x2c')];if(!_0x1b108f[_0x4e3d('0x37')]['hasOwnProperty'](_0x4e3d('0x3d'))){_0x21c995[_0x4e3d('0x3e')]=qs[_0x4e3d('0x3e')](_0x1b108f[_0x4e3d('0x37')][_0x4e3d('0x3e')]);_0x21c995[_0x4e3d('0x20')]=qs[_0x4e3d('0x20')](_0x1b108f[_0x4e3d('0x37')][_0x4e3d('0x20')]);}return _0x131043['getTags'](_0x21c995);}})[_0x4e3d('0x28')](function(_0x1ccc33){if(_0x1ccc33){return _0x1ccc33?{'count':_0x558320,'rows':_0x1ccc33}:null;}})[_0x4e3d('0x28')](respondWithResult(_0x85b2c1,null))[_0x4e3d('0x91')](handleError(_0x85b2c1,null));};exports[_0x4e3d('0xd0')]=function(_0x4b274e,_0x177b64,_0x4f8a81){if(_0x4b274e[_0x4e3d('0x9d')]['id']){delete _0x4b274e[_0x4e3d('0x9d')]['id'];}return db[_0x4e3d('0x85')]['findOne']({'where':{'id':_0x4b274e[_0x4e3d('0xbd')]['id']}})[_0x4e3d('0x28')](handleEntityNotFound(_0x177b64,null))[_0x4e3d('0x28')](function(_0x5bc8bf){if(_0x5bc8bf){return _0x5bc8bf['setTags'](_0x4b274e[_0x4e3d('0x9d')][_0x4e3d('0xd1')]||[]);}return null;})[_0x4e3d('0x28')](respondWithResult(_0x177b64,null))['catch'](handleError(_0x177b64,null));};exports[_0x4e3d('0xd2')]=function(_0x2990f5,_0x285982){var _0x5dd6df=[];_0x5dd6df['push'](addAdditionalPhones(_0x2990f5['body']));Promise[_0x4e3d('0x32')](_0x5dd6df)[_0x4e3d('0x28')](function(){_0x5dd6df=[];_0x5dd6df[_0x4e3d('0x2f')](deleteCmHopperPhones(_0x2990f5[_0x4e3d('0x9d')]['id']));_0x5dd6df[_0x4e3d('0x2f')](addCmHopperPhones(_0x2990f5[_0x4e3d('0x9d')]['id']));Promise[_0x4e3d('0x32')](_0x5dd6df)[_0x4e3d('0x28')](function(){return[0x1];})[_0x4e3d('0x28')](respondWithResult(_0x285982,null));});};function addAdditionalPhones(_0x57402c){var _0x58195a;return new Promise(function(_0x4fb601,_0x2e7b4a){return db[_0x4e3d('0xbe')][_0x4e3d('0x92')]({'where':{'CmContactId':_0x57402c['id']}})[_0x4e3d('0x28')](function(){var _0x56a0d0=[];for(var _0x34d1e8=0x0;_0x34d1e8<_0x57402c['items']['length'];_0x34d1e8++){var _0xb3be28=_0x57402c['item_types']?_[_0x4e3d('0x63')](_0x57402c[_0x4e3d('0xd3')][_0x34d1e8])?'':_0x57402c[_0x4e3d('0xd3')][_0x34d1e8]:_0x57402c[_0x4e3d('0xd4')][_0x34d1e8][_0x4e3d('0xd5')]?_0x57402c[_0x4e3d('0xd4')][_0x34d1e8][_0x4e3d('0xd5')]:'';var _0xad84f9=_[_0x4e3d('0x63')](_0x57402c['items'][_0x34d1e8][_0x4e3d('0xd6')])?'':_0x57402c[_0x4e3d('0xd4')][_0x34d1e8][_0x4e3d('0xd6')];var _0x48754d=_0xb3be28+':'+_0x57402c[_0x4e3d('0xd4')][_0x34d1e8][_0x4e3d('0xcc')]+'§'+_0xad84f9;if(_['isNil'](_0x58195a))_0x58195a=_0x48754d;else _0x58195a+=';'+_0x48754d;_0x56a0d0['push'](addAdditionalPhone(_0x57402c['id'],_0x57402c[_0x4e3d('0xd4')][_0x34d1e8]['phone'],_0x57402c[_0x4e3d('0xd3')]?_[_0x4e3d('0x63')](_0x57402c[_0x4e3d('0xd3')][_0x34d1e8])?null:_0x57402c[_0x4e3d('0xd3')][_0x34d1e8]:_0x57402c[_0x4e3d('0xd4')][_0x34d1e8]['ItemTypeId']?_0x57402c[_0x4e3d('0xd4')][_0x34d1e8][_0x4e3d('0xd5')]:null,_0x34d1e8,_0xad84f9));}Promise['all'](_0x56a0d0)[_0x4e3d('0x28')](function(){db[_0x4e3d('0x85')][_0x4e3d('0x27')]({'AdditionalPhones':_0x58195a},{'where':{'id':_0x57402c['id']}})[_0x4e3d('0x28')](function(){_0x4fb601(0x1);});});});});}function addAdditionalPhone(_0xf2afa7,_0x5752a6,_0x47b520,_0x5bd426,_0x200178){return db[_0x4e3d('0xbe')][_0x4e3d('0x54')]({'where':{'CmContactId':_0xf2afa7,'item':_0x5752a6}})[_0x4e3d('0x28')](function(_0x55a3e7){if(_0x55a3e7)logger[_0x4e3d('0x9b')]('contact\x20phone\x20exists',_0x55a3e7);else{db['CmContactHasItem'][_0x4e3d('0xa1')]({'CmContactId':_0xf2afa7,'item':_0x5752a6,'ItemTypeId':_0x47b520,'OrderBy':_0x5bd426,'ItemClass':_0x4e3d('0xd7'),'description':_0x200178});}});}function deletePhones(_0x3cf87d){return db[_0x4e3d('0xbe')][_0x4e3d('0x92')]({'where':{'CmContactId':_0x3cf87d}});}function deleteCmHopperPhones(_0x2aeaa2){return new Promise(function(_0x1c9c48,_0x5467f0){return db[_0x4e3d('0x9e')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x2aeaa2}})[_0x4e3d('0x28')](function(_0x4f764f){db['CmHopperAdditionalPhone'][_0x4e3d('0x92')]({'where':{'CmHopperId':{'$in':_[_0x4e3d('0x57')](_0x4f764f,'id')}}});})['then'](function(){_0x1c9c48(0x1);});});}function addCmHopperPhones(_0x173dc2){return new Promise(function(_0x3775c9,_0x298086){return db[_0x4e3d('0x9e')][_0x4e3d('0x98')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x173dc2}})[_0x4e3d('0x28')](function(_0x5016b7){var _0x4d6c1a=[];_[_0x4e3d('0x57')](_0x5016b7,function(_0x54c2c9){_0x4d6c1a[_0x4e3d('0x2f')](createCmHopperPhone(_0x173dc2,_0x54c2c9['id']));});Promise[_0x4e3d('0x32')](_0x4d6c1a)['then'](function(){_0x3775c9(0x1);});});});}function createCmHopperPhone(_0x58c218,_0x171ce8){return new Promise(function(_0x38e2fc,_0x50867e){db[_0x4e3d('0xbe')][_0x4e3d('0x98')]({'raw':!![],'attributes':['item'],'where':{'CmContactId':_0x58c218,'ItemClass':_0x4e3d('0xd7')},'include':[{'model':db[_0x4e3d('0xc0')],'attributes':[_0x4e3d('0xd8')],'as':'ItemType'}],'order':[db[_0x4e3d('0x81')][_0x4e3d('0xc2')]('`ItemType`.OrderBy')]})[_0x4e3d('0x28')](function(_0x52372b){var _0x107747=0x1;var _0x3d4c19=_[_0x4e3d('0x57')](_0x52372b,function(_0x423f93){_0x423f93[_0x4e3d('0xd9')]=_0x171ce8;_0x423f93[_0x4e3d('0xcc')]=_0x423f93['item'];_0x423f93[_0x4e3d('0xd8')]=_0x423f93[_0x4e3d('0xda')]||_0x107747;delete _0x423f93['ItemType.OrderBy'];_0x107747=_0x107747+0x1;return _0x423f93;});return db[_0x4e3d('0xdb')][_0x4e3d('0xdc')](_0x3d4c19,{});})[_0x4e3d('0x28')](function(){_0x38e2fc(0x1);});});}function insertAdditionalPhones(_0x402ed2,_0x463933){return new Promise(function(_0x18adf6,_0x4ada6b){var _0x31a948=[];for(var _0x1059fc=0x0;_0x1059fc<_0x463933[_0x4e3d('0x2c')];_0x1059fc++){var _0x46f622=_0x463933[_0x1059fc];_0x31a948['push'](parseContactItemType(_0x46f622));}Promise['all'](_0x31a948)[_0x4e3d('0x28')](function(){var _0x5a86d8={'id':_0x402ed2['id'],'items':_0x463933};return addAdditionalPhones(_0x5a86d8)['then'](function(_0x50f463){return addCmHopperPhones(_0x402ed2['id']);});})[_0x4e3d('0x28')](function(){_0x18adf6(_0x402ed2);});});}function parseContactItemType(_0x365e2f){return new Promise(function(_0x4021c6,_0x119302){if(_0x365e2f['hasOwnProperty'](_0x4e3d('0xd5'))){_0x4021c6(_0x365e2f);}else{return db[_0x4e3d('0xc0')][_0x4e3d('0x54')]({'where':{'name':_0x365e2f[_0x4e3d('0xc1')]}})['then'](function(_0x288ca8){if(_['isNil'](_0x288ca8))_0x365e2f[_0x4e3d('0xd5')]=null;else _0x365e2f[_0x4e3d('0xd5')]=_0x288ca8['id'];_0x4021c6(_0x365e2f);});}});}exports[_0x4e3d('0xdd')]=function(_0x42bdd4,_0x1fb73e){return db[_0x4e3d('0xbe')]['findAll']({'raw':!![],'where':{'CmContactId':_0x42bdd4[_0x4e3d('0xbd')]['id'],'ItemClass':_0x4e3d('0xd7')},'include':[{'model':db[_0x4e3d('0xc0')],'as':_0x4e3d('0xc1')}],'order':[[db[_0x4e3d('0x81')][_0x4e3d('0xc2')](_0x4e3d('0xde'))],[_0x4e3d('0xd8')]]})[_0x4e3d('0x28')](function(_0x348cf3){return _0x348cf3;})['then'](respondWithResult(_0x1fb73e,null))['catch'](handleError(_0x1fb73e,null));};exports[_0x4e3d('0xdf')]=function(_0x30e59d,_0x4d7f1a){return db[_0x4e3d('0xbe')]['findAll']({'raw':!![],'where':{'CmContactId':_0x30e59d[_0x4e3d('0x9d')][_0x4e3d('0xe0')]}})['then'](function(_0x17f6ab){var _0x3a2be7=_[_0x4e3d('0x57')](_0x17f6ab,function(_0x3fd259){_0x3fd259[_0x4e3d('0xe1')]=_0x30e59d[_0x4e3d('0x9d')][_0x4e3d('0xe2')];return _0x3fd259;});return db['CmContactHasItem']['bulkCreate'](_0x3a2be7,{});})[_0x4e3d('0x28')](function(_0x5abc54){return addCmHopperPhones(_0x30e59d[_0x4e3d('0x9d')][_0x4e3d('0xe2')]);})['then'](function(_0x65866a){return['ok'];})[_0x4e3d('0x28')](respondWithResult(_0x4d7f1a,null))[_0x4e3d('0x91')](handleError(_0x4d7f1a,null));};exports['rescheduleAdditionalPhones']=function(_0x2ded40,_0x42ae40){var _0x495986=[];_0x495986[_0x4e3d('0x2f')](createCmHopperPhone(_0x2ded40['body']['id'],_0x2ded40['body'][_0x4e3d('0xe3')]));Promise['all'](_0x495986)['then'](function(){return[0x1];})[_0x4e3d('0x28')](respondWithResult(_0x42ae40,null));};exports[_0x4e3d('0xe4')]=function(_0x3fce2,_0x514ab0,_0x37822e){var _0x4dc450={'raw':![],'where':{}};var _0x5f0eed={};var _0x4b1e19={'count':0x0,'rows':[]};return db['CmContact'][_0x4e3d('0x30')]({'where':{'id':_0x3fce2[_0x4e3d('0xbd')]['id']}})['then'](handleEntityNotFound(_0x514ab0,null))['then'](function(_0x34d949){if(_0x34d949){_0x5f0eed[_0x4e3d('0x35')]=_[_0x4e3d('0x36')](db[_0x4e3d('0x9e')][_0x4e3d('0xce')]);_0x5f0eed[_0x4e3d('0x37')]=_[_0x4e3d('0x36')](_0x3fce2[_0x4e3d('0x37')]);_0x5f0eed[_0x4e3d('0x38')]=_['intersection'](_0x5f0eed[_0x4e3d('0x35')],_0x5f0eed[_0x4e3d('0x37')]);_0x4dc450[_0x4e3d('0x3b')]=_[_0x4e3d('0x39')](_0x5f0eed[_0x4e3d('0x35')],qs[_0x4e3d('0x3a')](_0x3fce2['query'][_0x4e3d('0x3a')]));_0x4dc450[_0x4e3d('0x3b')]=_0x4dc450[_0x4e3d('0x3b')][_0x4e3d('0x2c')]?_0x4dc450[_0x4e3d('0x3b')]:_0x5f0eed[_0x4e3d('0x35')];if(!_0x3fce2[_0x4e3d('0x37')][_0x4e3d('0x3c')](_0x4e3d('0x3d'))){_0x4dc450['limit']=qs[_0x4e3d('0x3e')](_0x3fce2[_0x4e3d('0x37')][_0x4e3d('0x3e')]);_0x4dc450[_0x4e3d('0x20')]=qs[_0x4e3d('0x20')](_0x3fce2[_0x4e3d('0x37')]['offset']);}_0x4dc450[_0x4e3d('0x3f')]=qs[_0x4e3d('0x40')](_0x3fce2['query'][_0x4e3d('0x40')]);_0x4dc450[_0x4e3d('0x41')]=qs[_0x4e3d('0x38')](_[_0x4e3d('0x42')](_0x3fce2[_0x4e3d('0x37')],_0x5f0eed['filters']));_0x4dc450[_0x4e3d('0x41')][_0x4e3d('0xe5')]=_0x34d949['id'];if(_0x3fce2['query'][_0x4e3d('0x62')]){_0x4dc450[_0x4e3d('0x41')]=_[_0x4e3d('0x84')](_0x4dc450[_0x4e3d('0x41')],{'$or':_[_0x4e3d('0x57')](_0x4dc450[_0x4e3d('0x3b')],function(_0x19b305){var _0x5465ac={};_0x5465ac[_0x19b305]={'$like':'%'+_0x3fce2[_0x4e3d('0x37')][_0x4e3d('0x62')]+'%'};return _0x5465ac;})});}_0x4dc450=_['merge']({},_0x4dc450,_0x3fce2[_0x4e3d('0xcf')]);return db['CmHopper'][_0x4e3d('0x22')]({'where':_0x4dc450[_0x4e3d('0x41')]})[_0x4e3d('0x28')](function(_0x2318d3){_0x4b1e19[_0x4e3d('0x22')]=_0x2318d3;if(_0x3fce2[_0x4e3d('0x37')][_0x4e3d('0xe6')]){_0x4dc450[_0x4e3d('0xe7')]=[{'all':!![]}];}return db[_0x4e3d('0x9e')][_0x4e3d('0x98')](_0x4dc450);})['then'](function(_0x4c9b00){_0x4b1e19[_0x4e3d('0x90')]=_0x4c9b00;return _0x4b1e19;});}})[_0x4e3d('0x28')](respondWithFilteredResult(_0x514ab0,_0x4dc450))['catch'](handleError(_0x514ab0,null));};exports[_0x4e3d('0xe8')]=function(_0x4ad5e9,_0x540554,_0x494a18){var _0x4b1db2={'raw':!![],'where':{}};var _0x4bb6ba={};var _0x4c69c1={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0x4ad5e9[_0x4e3d('0xbd')]['id']}})['then'](handleEntityNotFound(_0x540554,null))[_0x4e3d('0x28')](function(_0x1d6cee){if(_0x1d6cee){_0x4bb6ba[_0x4e3d('0x35')]=_[_0x4e3d('0x36')](db[_0x4e3d('0xab')][_0x4e3d('0xce')]);_0x4bb6ba['query']=_[_0x4e3d('0x36')](_0x4ad5e9[_0x4e3d('0x37')]);_0x4bb6ba[_0x4e3d('0x38')]=_['intersection'](_0x4bb6ba['model'],_0x4bb6ba[_0x4e3d('0x37')]);_0x4b1db2[_0x4e3d('0x3b')]=_[_0x4e3d('0x39')](_0x4bb6ba[_0x4e3d('0x35')],qs[_0x4e3d('0x3a')](_0x4ad5e9[_0x4e3d('0x37')]['fields']));_0x4b1db2['attributes']=_0x4b1db2['attributes'][_0x4e3d('0x2c')]?_0x4b1db2['attributes']:_0x4bb6ba[_0x4e3d('0x35')];if(!_0x4ad5e9[_0x4e3d('0x37')][_0x4e3d('0x3c')](_0x4e3d('0x3d'))){_0x4b1db2[_0x4e3d('0x3e')]=qs[_0x4e3d('0x3e')](_0x4ad5e9[_0x4e3d('0x37')]['limit']);_0x4b1db2[_0x4e3d('0x20')]=qs[_0x4e3d('0x20')](_0x4ad5e9[_0x4e3d('0x37')][_0x4e3d('0x20')]);}_0x4b1db2[_0x4e3d('0x3f')]=qs[_0x4e3d('0x40')](_0x4ad5e9[_0x4e3d('0x37')][_0x4e3d('0x40')]);_0x4b1db2[_0x4e3d('0x41')]=qs[_0x4e3d('0x38')](_[_0x4e3d('0x42')](_0x4ad5e9[_0x4e3d('0x37')],_0x4bb6ba['filters']));_0x4b1db2[_0x4e3d('0x41')][_0x4e3d('0xe5')]=_0x1d6cee['id'];if(_0x4ad5e9[_0x4e3d('0x37')]['filter']){_0x4b1db2['where']=_[_0x4e3d('0x84')](_0x4b1db2['where'],{'$or':_[_0x4e3d('0x57')](_0x4b1db2[_0x4e3d('0x3b')],function(_0x3b21aa){var _0x4b2e66={};_0x4b2e66[_0x3b21aa]={'$like':'%'+_0x4ad5e9[_0x4e3d('0x37')]['filter']+'%'};return _0x4b2e66;})});}_0x4b1db2=_[_0x4e3d('0x84')]({},_0x4b1db2,_0x4ad5e9[_0x4e3d('0xcf')]);return db[_0x4e3d('0xab')][_0x4e3d('0x22')]({'where':_0x4b1db2[_0x4e3d('0x41')]})['then'](function(_0x4d2c38){_0x4c69c1[_0x4e3d('0x22')]=_0x4d2c38;if(_0x4ad5e9['query'][_0x4e3d('0xe6')]){_0x4b1db2[_0x4e3d('0xe7')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x4e3d('0x98')](_0x4b1db2);})['then'](function(_0x19d773){_0x4c69c1['rows']=_0x19d773;return _0x4c69c1;});}})[_0x4e3d('0x28')](respondWithFilteredResult(_0x540554,_0x4b1db2))[_0x4e3d('0x91')](handleError(_0x540554,null));};exports[_0x4e3d('0xe9')]=function(_0x3d8e0e,_0x193c7f,_0x2844c9){var _0x29e3f1={'raw':!![],'where':{}};var _0x4d5b0f={};var _0x5bc838={'count':0x0,'rows':[]};return db[_0x4e3d('0x85')][_0x4e3d('0x30')]({'where':{'id':_0x3d8e0e['params']['id']}})[_0x4e3d('0x28')](handleEntityNotFound(_0x193c7f,null))['then'](function(_0x16752c){if(_0x16752c){_0x4d5b0f[_0x4e3d('0x35')]=_[_0x4e3d('0x36')](db['CmHopperFinal']['rawAttributes']);_0x4d5b0f[_0x4e3d('0x37')]=_[_0x4e3d('0x36')](_0x3d8e0e['query']);_0x4d5b0f[_0x4e3d('0x38')]=_[_0x4e3d('0x39')](_0x4d5b0f[_0x4e3d('0x35')],_0x4d5b0f[_0x4e3d('0x37')]);_0x29e3f1['attributes']=_[_0x4e3d('0x39')](_0x4d5b0f['model'],qs[_0x4e3d('0x3a')](_0x3d8e0e[_0x4e3d('0x37')]['fields']));_0x29e3f1['attributes']=_0x29e3f1['attributes'][_0x4e3d('0x2c')]?_0x29e3f1['attributes']:_0x4d5b0f[_0x4e3d('0x35')];if(!_0x3d8e0e['query'][_0x4e3d('0x3c')](_0x4e3d('0x3d'))){_0x29e3f1[_0x4e3d('0x3e')]=qs[_0x4e3d('0x3e')](_0x3d8e0e[_0x4e3d('0x37')][_0x4e3d('0x3e')]);_0x29e3f1[_0x4e3d('0x20')]=qs[_0x4e3d('0x20')](_0x3d8e0e['query'][_0x4e3d('0x20')]);}_0x29e3f1[_0x4e3d('0x3f')]=qs[_0x4e3d('0x40')](_0x3d8e0e['query'][_0x4e3d('0x40')]);_0x29e3f1[_0x4e3d('0x41')]=qs[_0x4e3d('0x38')](_[_0x4e3d('0x42')](_0x3d8e0e[_0x4e3d('0x37')],_0x4d5b0f[_0x4e3d('0x38')]));_0x29e3f1['where'][_0x4e3d('0xe5')]=_0x16752c['id'];if(_0x3d8e0e[_0x4e3d('0x37')][_0x4e3d('0x62')]){_0x29e3f1[_0x4e3d('0x41')]=_['merge'](_0x29e3f1[_0x4e3d('0x41')],{'$or':_[_0x4e3d('0x57')](_0x29e3f1[_0x4e3d('0x3b')],function(_0x1003d1){var _0x2ebf00={};_0x2ebf00[_0x1003d1]={'$like':'%'+_0x3d8e0e[_0x4e3d('0x37')]['filter']+'%'};return _0x2ebf00;})});}_0x29e3f1=_['merge']({},_0x29e3f1,_0x3d8e0e[_0x4e3d('0xcf')]);return db[_0x4e3d('0xea')][_0x4e3d('0x22')]({'where':_0x29e3f1['where']})[_0x4e3d('0x28')](function(_0x4d9b36){_0x5bc838[_0x4e3d('0x22')]=_0x4d9b36;if(_0x3d8e0e[_0x4e3d('0x37')][_0x4e3d('0xe6')]){_0x29e3f1[_0x4e3d('0xe7')]=[{'all':!![]}];}return db[_0x4e3d('0xea')]['findAll'](_0x29e3f1);})[_0x4e3d('0x28')](function(_0x5dcf90){_0x5bc838[_0x4e3d('0x90')]=_0x5dcf90;return _0x5bc838;});}})[_0x4e3d('0x28')](respondWithFilteredResult(_0x193c7f,_0x29e3f1))[_0x4e3d('0x91')](handleError(_0x193c7f,null));};exports[_0x4e3d('0xeb')]=function(_0x5ccabb,_0x3beddb,_0x5ce43e){var _0x2d8f18={'raw':!![],'where':{}};var _0x4a505e={};var _0x453b18={'count':0x0,'rows':[]};return db[_0x4e3d('0x85')][_0x4e3d('0x30')]({'where':{'id':_0x5ccabb['params']['id']}})[_0x4e3d('0x28')](handleEntityNotFound(_0x3beddb,null))[_0x4e3d('0x28')](function(_0x25f2ea){if(_0x25f2ea){_0x4a505e[_0x4e3d('0x35')]=_[_0x4e3d('0x36')](db[_0x4e3d('0xb1')][_0x4e3d('0xce')]);_0x4a505e[_0x4e3d('0x37')]=_[_0x4e3d('0x36')](_0x5ccabb['query']);_0x4a505e[_0x4e3d('0x38')]=_[_0x4e3d('0x39')](_0x4a505e[_0x4e3d('0x35')],_0x4a505e[_0x4e3d('0x37')]);_0x2d8f18[_0x4e3d('0x3b')]=_['intersection'](_0x4a505e[_0x4e3d('0x35')],qs['fields'](_0x5ccabb[_0x4e3d('0x37')][_0x4e3d('0x3a')]));_0x2d8f18[_0x4e3d('0x3b')]=_0x2d8f18[_0x4e3d('0x3b')][_0x4e3d('0x2c')]?_0x2d8f18[_0x4e3d('0x3b')]:_0x4a505e[_0x4e3d('0x35')];if(!_0x5ccabb[_0x4e3d('0x37')][_0x4e3d('0x3c')]('nolimit')){_0x2d8f18[_0x4e3d('0x3e')]=qs[_0x4e3d('0x3e')](_0x5ccabb['query'][_0x4e3d('0x3e')]);_0x2d8f18['offset']=qs['offset'](_0x5ccabb['query'][_0x4e3d('0x20')]);}_0x2d8f18[_0x4e3d('0x3f')]=qs[_0x4e3d('0x40')](_0x5ccabb[_0x4e3d('0x37')][_0x4e3d('0x40')]);_0x2d8f18['where']=qs[_0x4e3d('0x38')](_[_0x4e3d('0x42')](_0x5ccabb[_0x4e3d('0x37')],_0x4a505e[_0x4e3d('0x38')]));_0x2d8f18[_0x4e3d('0x41')][_0x4e3d('0xe5')]=_0x25f2ea['id'];if(_0x5ccabb[_0x4e3d('0x37')][_0x4e3d('0x62')]){_0x2d8f18[_0x4e3d('0x41')]=_[_0x4e3d('0x84')](_0x2d8f18[_0x4e3d('0x41')],{'$or':_[_0x4e3d('0x57')](_0x2d8f18['attributes'],function(_0x1dd795){var _0x5010a1={};_0x5010a1[_0x1dd795]={'$like':'%'+_0x5ccabb['query'][_0x4e3d('0x62')]+'%'};return _0x5010a1;})});}_0x2d8f18=_[_0x4e3d('0x84')]({},_0x2d8f18,_0x5ccabb[_0x4e3d('0xcf')]);return db[_0x4e3d('0xb1')][_0x4e3d('0x22')]({'where':_0x2d8f18[_0x4e3d('0x41')]})[_0x4e3d('0x28')](function(_0x5cd07c){_0x453b18[_0x4e3d('0x22')]=_0x5cd07c;if(_0x5ccabb['query']['includeAll']){_0x2d8f18[_0x4e3d('0xe7')]=[{'all':!![]}];}return db[_0x4e3d('0xb1')]['findAll'](_0x2d8f18);})[_0x4e3d('0x28')](function(_0x3f923f){_0x453b18[_0x4e3d('0x90')]=_0x3f923f;return _0x453b18;});}})['then'](respondWithFilteredResult(_0x3beddb,_0x2d8f18))['catch'](handleError(_0x3beddb,null));};exports[_0x4e3d('0xec')]=function(_0x3cb934,_0x2f450f,_0x3485ba){try{if(!_0x3cb934[_0x4e3d('0x9d')][_0x4e3d('0x80')]){throw new Error(_0x4e3d('0xed'));}if(!_0x3cb934[_0x4e3d('0x9d')][_0x4e3d('0xee')]){throw new Error(_0x4e3d('0xef'));}if(!_0x3cb934[_0x4e3d('0x9d')][_0x4e3d('0xf0')]){throw new Error(_0x4e3d('0xf1'));}if(!_0x3cb934['body'][_0x4e3d('0xf2')]){throw new Error(_0x4e3d('0xf3'));}var _0x4ebf64=_0x3cb934['body']['binding_keys']['split'](',');var _0x1441a5=_0x3cb934[_0x4e3d('0x9d')]['binding_values'][_0x4e3d('0x56')](',');if(!_0x4ebf64[_0x4e3d('0x2c')]||!_0x1441a5[_0x4e3d('0x2c')]||_0x4ebf64['length']!==_0x1441a5['length']){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x3cb934[_0x4e3d('0x9d')][_0x4e3d('0x3a')]=_[_0x4e3d('0xf4')](_0x4ebf64,_0x1441a5);if(!_0x3cb934[_0x4e3d('0x9d')][_0x4e3d('0x3a')][_0x4e3d('0xcc')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x3cb934[_0x4e3d('0x9d')][_0x4e3d('0x3a')]['firstName']){throw new Error(_0x4e3d('0xf5'));}var _0x5ede77=path[_0x4e3d('0xf6')](config['root'],'server/files/tmp',_0x3cb934[_0x4e3d('0xf7')][_0x4e3d('0xf8')]);fs[_0x4e3d('0xf9')](_0x5ede77,parseInt('0777',0x8));var _0x27c9e0=require(_0x4e3d('0xfa'))[_0x4e3d('0xfb')](path['join'](__dirname,'../../components/import/cm/csv'),[_0x5ede77,_0x3cb934['body'][_0x4e3d('0xee')],_0x3cb934[_0x4e3d('0x9d')]['binding_values'],_0x3cb934[_0x4e3d('0x9d')][_0x4e3d('0x80')],_0x3cb934[_0x4e3d('0x9d')][_0x4e3d('0xfc')],_0x3cb934[_0x4e3d('0x9d')][_0x4e3d('0xb7')],_0x3cb934[_0x4e3d('0x9d')][_0x4e3d('0xf2')]]);return _0x2f450f[_0x4e3d('0x1d')](0xc8)[_0x4e3d('0x1f')]({'message':_0x4e3d('0xfd'),'pid':_0x27c9e0[_0x4e3d('0xfe')]});}catch(_0x17091a){return _0x2f450f[_0x4e3d('0x1d')](0x1f4)[_0x4e3d('0xff')](_0x17091a);}};exports[_0x4e3d('0x100')]=function(_0x91e3e2,_0x566e49,_0x18ef54){var _0x315bb8=fs[_0x4e3d('0x101')](_0x91e3e2[_0x4e3d('0xf7')]['path']);Papa[_0x4e3d('0x102')](_0x315bb8,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x121cec){return _0x566e49[_0x4e3d('0x1d')](0xc8)['json']({'file':_0x91e3e2[_0x4e3d('0xf7')],'fields':_0x121cec[_0x4e3d('0x103')][_0x4e3d('0x3a')]});}});};exports[_0x4e3d('0x104')]=function(_0x474eac,_0x19cf96,_0x1e2ed1){return db[_0x4e3d('0x59')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x4e3d('0x7d')}})[_0x4e3d('0x28')](function(_0xf93674){var _0x4e3931=![];if(!_0x474eac[_0x4e3d('0x9d')][_0x4e3d('0x80')]){throw new Error(_0x4e3d('0xed'));}if(!_0x474eac[_0x4e3d('0x9d')][_0x4e3d('0x105')][_0x4e3d('0xcc')]){throw new Error(_0x4e3d('0x106'));}if(!_0x474eac[_0x4e3d('0x9d')][_0x4e3d('0x105')][_0x4e3d('0x107')]){throw new Error(_0x4e3d('0xf5'));}if(!_0x474eac[_0x4e3d('0x9d')][_0x4e3d('0xf2')]){throw new Error(_0x4e3d('0xf3'));}var _0x51960b=require(_0x4e3d('0xfa'))[_0x4e3d('0xfb')](path['join'](__dirname,_0x4e3d('0x108')),[_0x474eac[_0x4e3d('0xbd')]['id'],JSON[_0x4e3d('0x109')](_0x474eac[_0x4e3d('0x9d')]),JSON[_0x4e3d('0x109')](_0xf93674)]);_0x51960b['on'](_0x4e3d('0x10a'),function(_0xddb4e2){_0x4e3931=!![];return _0x19cf96[_0x4e3d('0x1d')](0xc8)['json']({'message':_0x4e3d('0x10b'),'pid':_0x51960b[_0x4e3d('0xfe')]});});_0x51960b['on'](_0x4e3d('0x10c'),function(_0x2469b1){if(_0x2469b1&&!_0x4e3931){return _0x19cf96['status'](0x1f4)[_0x4e3d('0x1f')]({'message':_0x4e3d('0x10d'),'pid':_0x51960b[_0x4e3d('0xfe')]});}});})[_0x4e3d('0x91')](handleError(_0x19cf96,null));};exports['importUpdates']=function(_0x45e686,_0x10268b,_0x51899f){return db[_0x4e3d('0x59')][_0x4e3d('0x98')]({'raw':!![],'attributes':['id'],'where':{'role':_0x4e3d('0x7d')}})[_0x4e3d('0x28')](function(_0x232b39){var _0x3bf6e5=![];if(!_0x45e686[_0x4e3d('0x9d')][_0x4e3d('0x80')]){throw new Error(_0x4e3d('0xed'));}if(!_0x45e686[_0x4e3d('0x9d')]['binding'][_0x4e3d('0xcc')]){throw new Error(_0x4e3d('0x106'));}if(!_0x45e686[_0x4e3d('0x9d')][_0x4e3d('0x105')][_0x4e3d('0x107')]){throw new Error(_0x4e3d('0xf5'));}if(!_0x45e686[_0x4e3d('0x9d')][_0x4e3d('0xf2')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x14f1b3=require('child_process')['fork'](path['join'](__dirname,_0x4e3d('0x10e')),[_0x45e686['params']['id'],JSON[_0x4e3d('0x109')](_0x45e686[_0x4e3d('0x9d')]),JSON[_0x4e3d('0x109')](_0x232b39)]);_0x14f1b3['on'](_0x4e3d('0x10a'),function(_0x61797){_0x3bf6e5=!![];return _0x10268b[_0x4e3d('0x1d')](0xc8)[_0x4e3d('0x1f')]({'message':_0x4e3d('0x10b'),'pid':_0x14f1b3[_0x4e3d('0xfe')]});});_0x14f1b3['on']('exit',function(_0x22dfec){if(_0x22dfec&&!_0x3bf6e5){return _0x10268b[_0x4e3d('0x1d')](0x1f4)[_0x4e3d('0x1f')]({'message':_0x4e3d('0x10d'),'pid':_0x14f1b3[_0x4e3d('0xfe')]});}});})[_0x4e3d('0x91')](handleError(_0x10268b,null));};exports[_0x4e3d('0x10f')]=function(_0x21d4d8,_0x38c30f){var _0x3acd26=[_0x4e3d('0x110'),_0x4e3d('0x111'),_0x4e3d('0x112'),'openchannel','fax',_0x4e3d('0x113'),_0x4e3d('0x114')];var _0x2683fc={'offset':0x0,'order':qs[_0x4e3d('0x40')]('-createdAt')},_0x3605bf={'count':0x0,'rows':[]};Promise[_0x4e3d('0x115')]()[_0x4e3d('0x28')](function(){if(_0x21d4d8['query'][_0x4e3d('0x116')]){if(!_[_0x4e3d('0x117')](_0x3acd26,_0x21d4d8[_0x4e3d('0x37')][_0x4e3d('0x116')]['toLowerCase']())){throw new Error('Invalid\x20channel');}_0x3acd26=[_0x21d4d8[_0x4e3d('0x37')]['channel']['toLowerCase']()];}if(_0x21d4d8['query'][_0x4e3d('0x118')]){try{var _0x36eb93=JSON[_0x4e3d('0x102')](_0x21d4d8['query'][_0x4e3d('0x118')]);if(!moment(_0x36eb93['from'])[_0x4e3d('0x119')]()){throw new Error(_0x4e3d('0x11a'));}if(!moment(_0x36eb93['to'])[_0x4e3d('0x119')]()){throw new Error(_0x4e3d('0x11b'));}}catch(_0x33645f){throw new Error(_0x4e3d('0x11c'));}}if(!_0x21d4d8['query'][_0x4e3d('0x3c')](_0x4e3d('0x3d'))){_0x2683fc['limit']=qs['limit'](_0x21d4d8['query'][_0x4e3d('0x3e')]||0xa);_0x2683fc['offset']=qs[_0x4e3d('0x20')](_0x21d4d8[_0x4e3d('0x37')][_0x4e3d('0x20')]);}var _0xc3164f=_0x3acd26[_0x4e3d('0x57')](function(_0x5ec4bd){if(_0x5ec4bd===_0x4e3d('0x114')){var _0x2eb9e3={'attributes':['id',_0x4e3d('0x11d'),_0x4e3d('0x34'),'source',_0x4e3d('0x11e'),'callerid','starttime',_0x4e3d('0x11f'),'duration',_0x4e3d('0x120'),_0x4e3d('0x121'),_0x4e3d('0x122'),_0x4e3d('0x123'),_0x4e3d('0x124'),_0x4e3d('0x125')],'where':{'ContactId':_0x21d4d8[_0x4e3d('0xbd')]['id']},'include':[{'model':db[_0x4e3d('0x59')],'as':_0x4e3d('0x59'),'attributes':['id',_0x4e3d('0x2a'),_0x4e3d('0x126'),_0x4e3d('0x99')]}],'order':[['createdAt',_0x4e3d('0x78')]]};if(_0x21d4d8['query'][_0x4e3d('0x118')]){_0x2eb9e3[_0x4e3d('0x41')]['createdAt']={'$gte':_0x36eb93[_0x4e3d('0x47')],'$lte':_0x36eb93['to']};}return db[_0x4e3d('0xac')][_0x4e3d('0x127')](_0x2eb9e3)[_0x4e3d('0x28')](function(_0x4019d6){_0x3605bf['count']+=_0x4019d6[_0x4e3d('0x22')];return _[_0x4e3d('0x57')](_0x4019d6['rows'],function(_0x3390a7){var _0x2e15c9=_0x3390a7[_0x4e3d('0x128')]({'plain':!![]});_0x2e15c9['channel']=_0x5ec4bd;if(_0x2e15c9[_0x4e3d('0x59')]){_0x2e15c9[_0x4e3d('0x59')]={'id':_0x2e15c9[_0x4e3d('0x59')]['id'],'name':_0x2e15c9[_0x4e3d('0x59')][_0x4e3d('0x2a')],'fullname':_0x2e15c9['User'][_0x4e3d('0x126')],'alias':_0x2e15c9[_0x4e3d('0x59')][_0x4e3d('0x99')]};}return _0x2e15c9;});});}else{var _0x173383=_[_0x4e3d('0x129')](_0x5ec4bd)+(_0x5ec4bd===_0x4e3d('0x111')?'Website':'Account');var _0x17bad0={'attributes':['id',_0x4e3d('0x12a'),_0x4e3d('0x12b'),_0x4e3d('0x121'),_0x4e3d('0x120'),_0x4e3d('0x12c'),_0x4e3d('0x12d'),_0x4e3d('0x12e'),_0x4e3d('0x125'),_0x173383+'Id'],'where':{'ContactId':_0x21d4d8[_0x4e3d('0xbd')]['id']},'include':[{'model':db[_0x173383],'as':_0x4e3d('0x12f'),'attributes':['id',_0x4e3d('0x2a'),_0x4e3d('0x130')]},{'model':db['User'],'as':_0x4e3d('0x131'),'attributes':['id',_0x4e3d('0x2a'),'fullname']},{'model':db['Tag'],'as':'Tags','attributes':['id','name',_0x4e3d('0x45')],'through':{'attributes':[]}}],'order':[[_0x4e3d('0x121'),'DESC']]};if(_0x21d4d8[_0x4e3d('0x37')][_0x4e3d('0x118')]){_0x17bad0[_0x4e3d('0x41')][_0x4e3d('0x121')]={'$gte':_0x36eb93['from'],'$lte':_0x36eb93['to']};}switch(_0x5ec4bd){case _0x4e3d('0x111'):_0x17bad0[_0x4e3d('0x3b')][_0x4e3d('0x2f')](_0x4e3d('0x132'),_0x4e3d('0x133'),_0x4e3d('0x134'),_0x4e3d('0x135'),_0x4e3d('0x136'),_0x4e3d('0x137'),_0x4e3d('0x138'),_0x4e3d('0x139'),_0x4e3d('0x13a'));break;case'mail':_0x17bad0[_0x4e3d('0x3b')]['push'](_0x4e3d('0x13b'),_0x4e3d('0x13c'));break;case _0x4e3d('0x13d'):_0x17bad0['attributes'][_0x4e3d('0x2f')]('externalUrl',_0x4e3d('0x13e'));break;}return db[_[_0x4e3d('0x129')](_0x5ec4bd)+_0x4e3d('0x13f')][_0x4e3d('0x127')](_0x17bad0)[_0x4e3d('0x28')](function(_0x514cb7){_0x3605bf[_0x4e3d('0x22')]+=_0x514cb7[_0x4e3d('0x22')];return _[_0x4e3d('0x57')](_0x514cb7['rows'],function(_0x59b8b7){var _0x282e16=_0x59b8b7[_0x4e3d('0x128')]({'plain':!![]});_0x282e16[_0x4e3d('0x116')]=_0x5ec4bd;if(_0x282e16['Owner']){_0x282e16[_0x4e3d('0x131')]={'id':_0x282e16['Owner']['id'],'name':_0x282e16[_0x4e3d('0x131')][_0x4e3d('0x2a')],'fullname':_0x282e16['Owner'][_0x4e3d('0x126')]};}return _0x282e16;});});}});return Promise[_0x4e3d('0x32')](_0xc3164f);})[_0x4e3d('0x28')](function(_0x39b4f5){return _(_0x39b4f5)[_0x4e3d('0x140')]()['sortBy'](_0x4e3d('0x121'))[_0x4e3d('0x141')]()[_0x4e3d('0x5c')]();})['then'](function(_0x1e44f6){_0x3605bf[_0x4e3d('0x90')]=_0x2683fc['limit']?_0x1e44f6[_0x4e3d('0x142')](_0x2683fc['offset'],_0x2683fc[_0x4e3d('0x20')]+_0x2683fc[_0x4e3d('0x3e')]):_0x1e44f6;return _0x3605bf;})[_0x4e3d('0x28')](respondWithFilteredResult(_0x38c30f,_0x2683fc))[_0x4e3d('0x91')](handleError(_0x38c30f,null));}; \ No newline at end of file +var _0xd757=['catch','destroy','params','describe','startsWith','displayName','columnName','custom','body','findAll','get','mergeWith','tags','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','MailMessage','MailInteraction','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','ChatQueueReport','MailQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappQueueReport','additionalPhones','each','duplicates','$or','findOrCreate','spread','contact','show','color','Phones','ContactItemType','literal','`Phones.ItemType`.OrderBy','log','$and','omit','format','cf_%d','pickBy','table','toParam','text','values','phone','getTags','rawAttributes','options','setTags','ids','items','item_types','ItemTypeId','description','CmHopperAdditionalPhone','item','ItemType','`ItemType`.OrderBy','ItemType.OrderBy','bulkCreate','getAdditionalPhones','OrderBy','duplicateAdditionalPhones','fromContactId','toContactId','rescheduleAdditionalPhones','getHoppers','ContactId','includeAll','include','getHopperHistories','rows','getJscriptySessions','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','fork','../../components/import/cm/csv','CompanyId','socket_timestamp','File\x20uploaded\x20correctly!','pid','upload','createReadStream','parse','meta','User','binding','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','child_process','stringify','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','importUpdates','mail','chat','sms','openchannel','voice','-createdAt','channel','includes','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','destination','starttime','duration','note','createdAt','userDisposition','userSecondDisposition','UserId','fullname','alias','DESC','VoiceCallReport','findAndCountAll','startCase','Account','closed','disposition','secondDisposition','thirdDisposition','key','browserName','osName','ratingValue','referer','subject','substatus','Interaction','Owner','flatten','sortBy','reverse','slice','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','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/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','keys','length','cf_','push','CmCustomField','findOne','trimStart','all','fieldType','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','select','field','from','tools_tags','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','where','expr','search','parseSearch','sqlOperator','conditions','find','Tag','value','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','and','uc.UserId\x20=\x20?','dateOfBirth','datetime','castTo','DATE','buildExpression','filter','isNil','Contact','ListId','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','isArray','replace','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','isNumeric','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','Sequelize','QueryTypes','clone','c.id','isEmpty','having','t.id\x20IN\x20?','resolve','user','role','agent','some','getLists','c.ListId\x20IS\x20NULL','sequelize','toString','keyBy','merge','CmContact','c.lastName','c.phone','c.mobile','c.fax','c.email','c.ListId','c.deletedAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags'];(function(_0xc8023,_0xd1912){var _0x448b50=function(_0x4b8a6f){while(--_0x4b8a6f){_0xc8023['push'](_0xc8023['shift']());}};_0x448b50(++_0xd1912);}(_0xd757,0x1e5));var _0x7d75=function(_0xa24ecb,_0x24864f){_0xa24ecb=_0xa24ecb-0x0;var _0x1797bb=_0xd757[_0xa24ecb];return _0x1797bb;};'use strict';var emlformat=require(_0x7d75('0x0'));var rimraf=require(_0x7d75('0x1'));var zipdir=require(_0x7d75('0x2'));var jsonpatch=require(_0x7d75('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7d75('0x4'));var Mustache=require(_0x7d75('0x5'));var util=require('util');var path=require(_0x7d75('0x6'));var sox=require(_0x7d75('0x7'));var csv=require(_0x7d75('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7d75('0x9'));var squel=require(_0x7d75('0xa'));var crypto=require(_0x7d75('0xb'));var jsforce=require(_0x7d75('0xc'));var deskjs=require(_0x7d75('0xd'));var toCsv=require(_0x7d75('0x8'));var querystring=require(_0x7d75('0xe'));var Papa=require(_0x7d75('0xf'));var Redis=require(_0x7d75('0x10'));var authService=require(_0x7d75('0x11'));var qs=require(_0x7d75('0x12'));var as=require(_0x7d75('0x13'));var hardwareService=require(_0x7d75('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x7d75('0x15'));var config=require(_0x7d75('0x16'));var licenseUtil=require(_0x7d75('0x17'));var db=require('../../mysqldb')['db'];config[_0x7d75('0x18')]=_[_0x7d75('0x19')](config['redis'],{'host':_0x7d75('0x1a'),'port':0x18eb});var socket=require(_0x7d75('0x1b'))(new Redis(config[_0x7d75('0x18')]));require(_0x7d75('0x1c'))[_0x7d75('0x1d')](socket);function respondWithStatusCode(_0x3be8b2,_0x4b4994){_0x4b4994=_0x4b4994||0xcc;return function(_0x8d8bb8){if(_0x8d8bb8){return _0x3be8b2[_0x7d75('0x1e')](_0x4b4994);}return _0x3be8b2[_0x7d75('0x1f')](_0x4b4994)[_0x7d75('0x20')]();};}function respondWithResult(_0x44041e,_0x859c4){_0x859c4=_0x859c4||0xc8;return function(_0x5b0dc3){if(_0x5b0dc3){return _0x44041e[_0x7d75('0x1f')](_0x859c4)['json'](_0x5b0dc3);}};}function respondWithFilteredResult(_0x3896c3,_0x334161){return function(_0x40edfc){if(_0x40edfc){var _0x3bcb3e=typeof _0x334161[_0x7d75('0x21')]===_0x7d75('0x22')&&typeof _0x334161[_0x7d75('0x23')]===_0x7d75('0x22');var _0x55b89d=_0x40edfc['count'];var _0x4d7b23=_0x3bcb3e?0x0:_0x334161[_0x7d75('0x21')];var _0x404257=_0x3bcb3e?_0x40edfc[_0x7d75('0x24')]:_0x334161['offset']+_0x334161[_0x7d75('0x23')];var _0x31bfa8;if(_0x404257>=_0x55b89d){_0x404257=_0x55b89d;_0x31bfa8=0xc8;}else{_0x31bfa8=0xce;}_0x3896c3[_0x7d75('0x1f')](_0x31bfa8);return _0x3896c3[_0x7d75('0x25')](_0x7d75('0x26'),_0x4d7b23+'-'+_0x404257+'/'+_0x55b89d)[_0x7d75('0x27')](_0x40edfc);}return null;};}function patchUpdates(_0x486ce1){return function(_0x3490d4){try{jsonpatch[_0x7d75('0x28')](_0x3490d4,_0x486ce1,!![]);}catch(_0x1c0327){return BPromise[_0x7d75('0x29')](_0x1c0327);}return _0x3490d4[_0x7d75('0x2a')]();};}function saveUpdates(_0x323e20,_0x9a831b){return function(_0x1e32d6){if(_0x1e32d6){return _0x1e32d6[_0x7d75('0x2b')](_0x323e20)[_0x7d75('0x2c')](function(_0x3103d6){return _0x3103d6;});}return null;};}function removeEntity(_0x5a1218,_0xec279d){return function(_0x1fb273){if(_0x1fb273){return _0x1fb273['destroy']()[_0x7d75('0x2c')](function(){_0x5a1218['status'](0xcc)[_0x7d75('0x20')]();});}};}function handleEntityNotFound(_0x37456d,_0x17d83a){return function(_0xe66bff){if(!_0xe66bff){_0x37456d[_0x7d75('0x1e')](0x194);}return _0xe66bff;};}function handleError(_0x5623d1,_0x32fbaa){_0x32fbaa=_0x32fbaa||0x1f4;return function(_0x31055c){logger[_0x7d75('0x2d')](_0x31055c[_0x7d75('0x2e')]);if(_0x31055c[_0x7d75('0x2f')]){delete _0x31055c[_0x7d75('0x2f')];}_0x5623d1['status'](_0x32fbaa)[_0x7d75('0x30')](_0x31055c);};}exports[_0x7d75('0x31')]=function(_0x131518,_0x2a1c5b){var _0x8bd77b={},_0x4600d2={},_0x96a0fc={'count':0x0,'rows':[]};return db['CmContact']['describe']()['then'](function(_0x3b5c4b){var _0x4cab67=[];for(var _0x411752=0x0;_0x4117520x1){_0x1882ff['or'](_0x7d75('0x6f'),qs['getFullTextValue'](_0x340564),null);}else{if(qs[_0x7d75('0x70')](_0x340564)){_0x1882ff['or']('c.id\x20LIKE\x20?',_0x340564+'%');_0x1882ff['or'](_0x7d75('0x71'),_0x340564+'%');_0x1882ff['or'](_0x7d75('0x72'),_0x340564+'%');_0x1882ff['or'](_0x7d75('0x73'),_0x340564+'%');}else if(qs['isEmail'](_0x340564)){_0x1882ff['or']('c.email\x20LIKE\x20?',_0x340564+'%');}else{_0x1882ff['or'](_0x7d75('0x74'),'%'+_0x340564+'%');_0x1882ff['or'](_0x7d75('0x75'),'%'+_0x340564+'%');_0x1882ff['or']('c.email\x20LIKE\x20?','%'+_0x340564+'%');}}}}_0x1e7b3f['where'](_0x1882ff);_0x1e7b3f[_0x7d75('0x76')]('c.id');var _0x164cf0={'type':db[_0x7d75('0x77')][_0x7d75('0x78')]['SELECT'],'raw':!![]};var _0x2425a8=_0x1e7b3f[_0x7d75('0x79')]()['field'](_0x7d75('0x7a'));if(_0x8bd77b['order']){_0x8bd77b[_0x7d75('0x44')][_0x7d75('0x5a')](function(_0x334e8c){_0x1e7b3f[_0x7d75('0x44')]('c.'+_0x334e8c[0x0],_0x334e8c[0x1]==='DESC'?![]:!![]);});}if(!_[_0x7d75('0x7b')](_0x4dfa00)){_0x1e7b3f[_0x7d75('0x7c')](_0x264aeb);_0x2425a8[_0x7d75('0x50')](_0x7d75('0x7d'),_0x4dfa00);}BPromise[_0x7d75('0x7e')]()[_0x7d75('0x2c')](function(){if(!_0x27f0c7)return;if(_0x131518[_0x7d75('0x7f')][_0x7d75('0x80')]!==_0x7d75('0x81'))return;if(!_[_0x7d75('0x82')](_0x27f0c7[_0x7d75('0x55')],[_0x7d75('0x48'),'User'])){return _0x131518['user'][_0x7d75('0x83')]({'attributes':['id'],'raw':!![]})['then'](function(_0x31c908){if(_[_0x7d75('0x7b')](_0x31c908)){_0x2425a8[_0x7d75('0x50')](_0x7d75('0x84'));_0x1e7b3f[_0x7d75('0x50')]('c.ListId\x20IS\x20NULL');}else{_0x2425a8[_0x7d75('0x50')](_0x7d75('0x67'),_['map'](_0x31c908,'id'));_0x1e7b3f[_0x7d75('0x50')](_0x7d75('0x67'),_[_0x7d75('0x59')](_0x31c908,'id'));}});}})[_0x7d75('0x2c')](function(){if(_0x131518[_0x7d75('0x7f')][_0x7d75('0x80')]===_0x7d75('0x81')&&!_0x27f0c7&&!_0x131518[_0x7d75('0x3d')][_0x7d75('0x66')])return[];return db[_0x7d75('0x85')]['query'](_0x2425a8[_0x7d75('0x86')](),_0x164cf0);})[_0x7d75('0x2c')](function(_0x153776){_0x96a0fc[_0x7d75('0x24')]=_0x153776[_0x7d75('0x33')];if(_0x96a0fc['count']===0x0)return[];return db[_0x7d75('0x85')][_0x7d75('0x3d')](_0x29d82f[_0x7d75('0x86')](),_0x164cf0)['then'](function(_0x5c5ecb){_0x222ece=_[_0x7d75('0x87')](_0x5c5ecb,'id');_0x164cf0=_[_0x7d75('0x88')](_0x164cf0,{'model':db[_0x7d75('0x89')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x131518[_0x7d75('0x3d')][_0x7d75('0x41')]){_0x8bd77b[_0x7d75('0x40')][_0x7d75('0x5a')](function(_0x1a8b73){_0x1e7b3f[_0x7d75('0x48')]('c.'+_0x1a8b73);});}else{_0x1e7b3f['field'](_0x7d75('0x7a'));_0x1e7b3f[_0x7d75('0x48')]('c.firstName');_0x1e7b3f[_0x7d75('0x48')](_0x7d75('0x8a'));_0x1e7b3f[_0x7d75('0x48')](_0x7d75('0x8b'));_0x1e7b3f[_0x7d75('0x48')](_0x7d75('0x8c'));_0x1e7b3f[_0x7d75('0x48')](_0x7d75('0x8d'));_0x1e7b3f[_0x7d75('0x48')](_0x7d75('0x8e'));_0x1e7b3f[_0x7d75('0x48')](_0x7d75('0x8f'));_0x1e7b3f[_0x7d75('0x48')]('c.createdAt');_0x1e7b3f[_0x7d75('0x48')](_0x7d75('0x90'));_0x1e7b3f[_0x7d75('0x48')](_0x7d75('0x91'));_0x1e7b3f['field'](_0x7d75('0x92'),_0x7d75('0x93'));}if(_0x8bd77b[_0x7d75('0x23')])_0x1e7b3f[_0x7d75('0x23')](_0x8bd77b[_0x7d75('0x23')]);if(_0x8bd77b[_0x7d75('0x21')])_0x1e7b3f['offset'](_0x8bd77b[_0x7d75('0x21')]);return db[_0x7d75('0x85')][_0x7d75('0x3d')](_0x1e7b3f[_0x7d75('0x86')](),_0x164cf0);});})['then'](function(_0x3ba1c1){_0x3ba1c1[_0x7d75('0x5a')](function(_0x2d2b54){if(_0x2d2b54[_0x7d75('0x93')]){_0x2d2b54[_0x7d75('0x94')]=[];_0x2d2b54['TagIds'][_0x7d75('0x6e')](',')[_0x7d75('0x5a')](function(_0x50ca10){_0x2d2b54['Tags'][_0x7d75('0x35')](_0x222ece[_0x50ca10]);});}delete _0x2d2b54[_0x7d75('0x93')];});_0x96a0fc['rows']=_0x3ba1c1;return _0x96a0fc;})[_0x7d75('0x2c')](respondWithFilteredResult(_0x2a1c5b,_0x8bd77b));})[_0x7d75('0x95')](handleError(_0x2a1c5b,null));};exports[_0x7d75('0x96')]=function(_0x54c813,_0x5c17db){return db['CmContact']['find']({'where':{'id':_0x54c813[_0x7d75('0x97')]['id']}})[_0x7d75('0x2c')](handleEntityNotFound(_0x5c17db,null))[_0x7d75('0x2c')](removeEntity(_0x5c17db,null))[_0x7d75('0x95')](handleError(_0x5c17db,null));};exports[_0x7d75('0x98')]=function(_0x1dfd3c,_0x5213f7){return db[_0x7d75('0x89')]['describe']()[_0x7d75('0x2c')](function(_0x583bf2){delete _0x583bf2['tags'];for(var _0x155cfc=0x0;_0x155cfc0x0){return new Promise(function(_0x53f00d,_0x287427){var _0xb8465c=[];for(var _0x2eff47=0x0;_0x2eff47<_0x27daa8[_0x7d75('0x33')];_0x2eff47++){_0xb8465c[_0x7d75('0x35')](insertAdditionalPhones(_0x27daa8[_0x2eff47][_0x7d75('0xc2')],_0x27daa8[_0x2eff47][_0x7d75('0xbc')]));}Promise['all'](_0xb8465c)[_0x7d75('0x2c')](function(){_0x53f00d(0x1);});})[_0x7d75('0x2c')](function(){return{'success':_0x1ebd3f,'failure':_0x121928,'duplicates':_0x266bec};});}else{return{'success':_0x1ebd3f,'failure':_0x121928,'duplicates':_0x266bec};}}})['then'](respondWithResult(_0x235ca7,0xc9))[_0x7d75('0x95')](handleError(_0x235ca7,null));};exports[_0x7d75('0xc3')]=function(_0x45ce32,_0x2e143d,_0x20ed49){var _0x56f56d;return db[_0x7d75('0x89')][_0x7d75('0x98')]()[_0x7d75('0x2c')](function(_0x2dc21a){return db[_0x7d75('0x89')][_0x7d75('0x56')]({'where':{'id':_0x45ce32['params']['id']},'include':[{'model':db[_0x7d75('0x57')],'as':_0x7d75('0x94'),'attributes':['id',_0x7d75('0x2f'),_0x7d75('0xc4')],'required':_0x45ce32['query'][_0x7d75('0x6b')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x7d75('0xc5'),'where':{'CmContactId':_0x45ce32[_0x7d75('0x97')]['id']},'required':![],'include':[{'model':db[_0x7d75('0xc6')],'as':'ItemType'}]}],'order':[db['sequelize'][_0x7d75('0xc7')](_0x7d75('0xc8'))],'logging':console[_0x7d75('0xc9')],'attributes':_[_0x7d75('0x32')](_0x2dc21a)});})[_0x7d75('0x2c')](function(_0x2ebadc){_0x56f56d=_0x2ebadc['get']({'plain':!![]});var _0x32286d={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x2ebadc&&_0x2ebadc[_0x7d75('0x66')]){if(_0x2ebadc['ListId']){_0x32286d[_0x7d75('0x50')][_0x7d75('0xca')][_0x7d75('0x35')]({'ListId':{'$ne':_0x2ebadc[_0x7d75('0x66')]}});}}return db[_0x7d75('0x36')][_0x7d75('0x9e')](_0x32286d);})[_0x7d75('0x2c')](function(_0x2413d9){return _[_0x7d75('0xcb')](_0x56f56d,_[_0x7d75('0x59')](_0x2413d9,function(_0x48838a){return util[_0x7d75('0xcc')](_0x7d75('0xcd'),_0x48838a['id']);}));})[_0x7d75('0x2c')](handleEntityNotFound(_0x2e143d,null))['then'](respondWithResult(_0x2e143d,null))[_0x7d75('0x95')](handleError(_0x2e143d,null));};exports[_0x7d75('0x2b')]=function(_0x5c503d,_0x5e7da7){var _0x5d5597;if(_0x5c503d[_0x7d75('0x9d')]['id']){delete _0x5c503d['body']['id'];}return db['CmContact'][_0x7d75('0x56')]({'where':{'id':_0x5c503d[_0x7d75('0x97')]['id']}})['then'](handleEntityNotFound(_0x5e7da7,null))[_0x7d75('0x2c')](saveUpdates(_0x5c503d[_0x7d75('0x9d')],null))[_0x7d75('0x2c')](function(_0x1b997b){_0x5d5597=_0x1b997b;var _0x4ccddd={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x1b997b&&_0x1b997b[_0x7d75('0x66')]){if(_0x1b997b[_0x7d75('0x66')]){_0x4ccddd[_0x7d75('0x50')][_0x7d75('0xca')][_0x7d75('0x35')]({'ListId':{'$ne':_0x1b997b[_0x7d75('0x66')]}});}}return db[_0x7d75('0x36')][_0x7d75('0x9e')](_0x4ccddd);})[_0x7d75('0x2c')](function(_0x47b65a){if(_0x47b65a){return _[_0x7d75('0xcb')](_[_0x7d75('0xce')](_0x5c503d[_0x7d75('0x9d')],function(_0x32f054,_0x17d174){return _[_0x7d75('0x99')](_0x17d174,_0x7d75('0x34'));}),_[_0x7d75('0x59')](_0x47b65a,function(_0x2cda35){return util[_0x7d75('0xcc')](_0x7d75('0xcd'),_0x2cda35['id']);}));}})['then'](function(_0x12669c){if(_0x12669c&&!_[_0x7d75('0x7b')](_0x12669c)){var _0x5613a6=squel[_0x7d75('0x2b')]()[_0x7d75('0xcf')](_0x7d75('0x4b'))['setFields'](_0x12669c)[_0x7d75('0x50')]('id\x20=\x20?',_0x5c503d[_0x7d75('0x97')]['id'])[_0x7d75('0xd0')]();return db[_0x7d75('0x85')][_0x7d75('0x3d')](_0x5613a6[_0x7d75('0xd1')],{'replacements':_0x5613a6[_0x7d75('0xd2')]});}})[_0x7d75('0x2c')](function(){if(_0x5c503d[_0x7d75('0x9d')]['phone']&&_0x5d5597){return db[_0x7d75('0xa5')][_0x7d75('0x2b')]({'phone':_0x5c503d[_0x7d75('0x9d')][_0x7d75('0xd3')]},{'where':{'ContactId':_0x5d5597['id']}});}})[_0x7d75('0x2c')](function(){return _0x5d5597;})[_0x7d75('0x2c')](respondWithResult(_0x5e7da7,null))[_0x7d75('0x95')](handleError(_0x5e7da7,null));};exports[_0x7d75('0xd4')]=function(_0x3e8db1,_0x1865f4,_0x3a1e40){var _0x39632d={};var _0x3a643c={};var _0x2dd43d;var _0x56e83e;return db[_0x7d75('0x89')][_0x7d75('0x37')]({'where':{'id':_0x3e8db1['params']['id']}})['then'](handleEntityNotFound(_0x1865f4,null))['then'](function(_0x4d47dd){if(_0x4d47dd){_0x2dd43d=_0x4d47dd;_0x3a643c[_0x7d75('0x3c')]=_[_0x7d75('0x32')](db['Tag'][_0x7d75('0xd5')]);_0x3a643c['query']=_[_0x7d75('0x32')](_0x3e8db1['query']);_0x3a643c['filters']=_[_0x7d75('0x3f')](_0x3a643c[_0x7d75('0x3c')],_0x3a643c[_0x7d75('0x3d')]);_0x39632d[_0x7d75('0x40')]=_['intersection'](_0x3a643c[_0x7d75('0x3c')],qs[_0x7d75('0x41')](_0x3e8db1[_0x7d75('0x3d')][_0x7d75('0x41')]));_0x39632d[_0x7d75('0x40')]=_0x39632d[_0x7d75('0x40')]['length']?_0x39632d['attributes']:_0x3a643c['model'];_0x39632d[_0x7d75('0x44')]=qs['sort'](_0x3e8db1[_0x7d75('0x3d')][_0x7d75('0x45')]);_0x39632d['where']=qs['filters'](_[_0x7d75('0x46')](_0x3e8db1[_0x7d75('0x3d')],_0x3a643c[_0x7d75('0x3e')]));if(_0x3e8db1[_0x7d75('0x3d')][_0x7d75('0x63')]){_0x39632d[_0x7d75('0x50')]=_[_0x7d75('0x88')](_0x39632d[_0x7d75('0x50')],{'$or':_[_0x7d75('0x59')](_0x39632d[_0x7d75('0x40')],function(_0x2e46ab){var _0x5d431a={};_0x5d431a[_0x2e46ab]={'$like':'%'+_0x3e8db1['query'][_0x7d75('0x63')]+'%'};return _0x5d431a;})});}_0x39632d=_['merge']({},_0x39632d,_0x3e8db1[_0x7d75('0xd6')]);return _0x2dd43d['getTags'](_0x39632d);}})[_0x7d75('0x2c')](function(_0x57ae12){if(_0x57ae12){_0x56e83e=_0x57ae12['length'];if(!_0x3e8db1[_0x7d75('0x3d')][_0x7d75('0x42')](_0x7d75('0x43'))){_0x39632d[_0x7d75('0x23')]=qs[_0x7d75('0x23')](_0x3e8db1[_0x7d75('0x3d')][_0x7d75('0x23')]);_0x39632d[_0x7d75('0x21')]=qs[_0x7d75('0x21')](_0x3e8db1['query']['offset']);}return _0x2dd43d[_0x7d75('0xd4')](_0x39632d);}})[_0x7d75('0x2c')](function(_0x1e3ae0){if(_0x1e3ae0){return _0x1e3ae0?{'count':_0x56e83e,'rows':_0x1e3ae0}:null;}})[_0x7d75('0x2c')](respondWithResult(_0x1865f4,null))[_0x7d75('0x95')](handleError(_0x1865f4,null));};exports[_0x7d75('0xd7')]=function(_0x7692b3,_0x551456,_0x3fdaa7){if(_0x7692b3[_0x7d75('0x9d')]['id']){delete _0x7692b3[_0x7d75('0x9d')]['id'];}return db[_0x7d75('0x89')][_0x7d75('0x37')]({'where':{'id':_0x7692b3[_0x7d75('0x97')]['id']}})['then'](handleEntityNotFound(_0x551456,null))['then'](function(_0x18c32a){if(_0x18c32a){return _0x18c32a['setTags'](_0x7692b3['body'][_0x7d75('0xd8')]||[]);}return null;})[_0x7d75('0x2c')](respondWithResult(_0x551456,null))[_0x7d75('0x95')](handleError(_0x551456,null));};exports['setAdditionalPhones']=function(_0x46ea68,_0xfac3b2){var _0x50a53e=[];_0x50a53e[_0x7d75('0x35')](addAdditionalPhones(_0x46ea68['body']));Promise['all'](_0x50a53e)[_0x7d75('0x2c')](function(){_0x50a53e=[];_0x50a53e[_0x7d75('0x35')](deleteCmHopperPhones(_0x46ea68[_0x7d75('0x9d')]['id']));_0x50a53e['push'](addCmHopperPhones(_0x46ea68[_0x7d75('0x9d')]['id']));Promise[_0x7d75('0x39')](_0x50a53e)[_0x7d75('0x2c')](function(){return[0x1];})[_0x7d75('0x2c')](respondWithResult(_0xfac3b2,null));});};function addAdditionalPhones(_0x3a7367){var _0x528fa7;return new Promise(function(_0x3bec7b,_0x114b0b){return db[_0x7d75('0xb2')][_0x7d75('0x96')]({'where':{'CmContactId':_0x3a7367['id']}})[_0x7d75('0x2c')](function(){var _0x1bc318=[];for(var _0x25bc7d=0x0;_0x25bc7d<_0x3a7367[_0x7d75('0xd9')]['length'];_0x25bc7d++){var _0xb04a34=_0x3a7367[_0x7d75('0xda')]?_['isNil'](_0x3a7367[_0x7d75('0xda')][_0x25bc7d])?'':_0x3a7367[_0x7d75('0xda')][_0x25bc7d]:_0x3a7367[_0x7d75('0xd9')][_0x25bc7d][_0x7d75('0xdb')]?_0x3a7367[_0x7d75('0xd9')][_0x25bc7d][_0x7d75('0xdb')]:'';var _0x49e9fd=_['isNil'](_0x3a7367[_0x7d75('0xd9')][_0x25bc7d][_0x7d75('0xdc')])?'':_0x3a7367[_0x7d75('0xd9')][_0x25bc7d]['description'];var _0x3257f9=_0xb04a34+':'+_0x3a7367[_0x7d75('0xd9')][_0x25bc7d][_0x7d75('0xd3')]+'§'+_0x49e9fd;if(_['isNil'](_0x528fa7))_0x528fa7=_0x3257f9;else _0x528fa7+=';'+_0x3257f9;_0x1bc318[_0x7d75('0x35')](addAdditionalPhone(_0x3a7367['id'],_0x3a7367[_0x7d75('0xd9')][_0x25bc7d][_0x7d75('0xd3')],_0x3a7367['item_types']?_[_0x7d75('0x64')](_0x3a7367[_0x7d75('0xda')][_0x25bc7d])?null:_0x3a7367[_0x7d75('0xda')][_0x25bc7d]:_0x3a7367['items'][_0x25bc7d][_0x7d75('0xdb')]?_0x3a7367['items'][_0x25bc7d][_0x7d75('0xdb')]:null,_0x25bc7d,_0x49e9fd));}Promise[_0x7d75('0x39')](_0x1bc318)[_0x7d75('0x2c')](function(){db['CmContact']['update']({'AdditionalPhones':_0x528fa7},{'where':{'id':_0x3a7367['id']}})[_0x7d75('0x2c')](function(){_0x3bec7b(0x1);});});});});}function addAdditionalPhone(_0x2f5558,_0xa84da,_0x44afaa,_0x3af6f3,_0x29e3d7){return db['CmContactHasItem'][_0x7d75('0x56')]({'where':{'CmContactId':_0x2f5558,'item':_0xa84da}})[_0x7d75('0x2c')](function(_0x24f94c){if(_0x24f94c)logger['info']('contact\x20phone\x20exists',_0x24f94c);else{db[_0x7d75('0xb2')][_0x7d75('0xa9')]({'CmContactId':_0x2f5558,'item':_0xa84da,'ItemTypeId':_0x44afaa,'OrderBy':_0x3af6f3,'ItemClass':'PHONE','description':_0x29e3d7});}});}function deletePhones(_0x5d7100){return db['CmContactHasItem'][_0x7d75('0x96')]({'where':{'CmContactId':_0x5d7100}});}function deleteCmHopperPhones(_0x16e717){return new Promise(function(_0x4080f3,_0x3891e7){return db[_0x7d75('0xa5')][_0x7d75('0x9e')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x16e717}})[_0x7d75('0x2c')](function(_0x3ed0d8){db[_0x7d75('0xdd')][_0x7d75('0x96')]({'where':{'CmHopperId':{'$in':_[_0x7d75('0x59')](_0x3ed0d8,'id')}}});})[_0x7d75('0x2c')](function(){_0x4080f3(0x1);});});}function addCmHopperPhones(_0x5c3d1c){return new Promise(function(_0x4c680b,_0x55af84){return db[_0x7d75('0xa5')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x5c3d1c}})[_0x7d75('0x2c')](function(_0x2fd896){var _0x33ca9d=[];_[_0x7d75('0x59')](_0x2fd896,function(_0x52927e){_0x33ca9d[_0x7d75('0x35')](createCmHopperPhone(_0x5c3d1c,_0x52927e['id']));});Promise[_0x7d75('0x39')](_0x33ca9d)[_0x7d75('0x2c')](function(){_0x4c680b(0x1);});});});}function createCmHopperPhone(_0x4cd75c,_0x2304db){return new Promise(function(_0x527da7,_0x10ddc2){db[_0x7d75('0xb2')][_0x7d75('0x9e')]({'raw':!![],'attributes':[_0x7d75('0xde')],'where':{'CmContactId':_0x4cd75c,'ItemClass':'PHONE'},'include':[{'model':db[_0x7d75('0xc6')],'attributes':['OrderBy'],'as':_0x7d75('0xdf')}],'order':[db['sequelize'][_0x7d75('0xc7')](_0x7d75('0xe0'))]})[_0x7d75('0x2c')](function(_0x18463f){var _0x86db74=0x1;var _0x5f5a78=_[_0x7d75('0x59')](_0x18463f,function(_0x51e882){_0x51e882['CmHopperId']=_0x2304db;_0x51e882['phone']=_0x51e882[_0x7d75('0xde')];_0x51e882['OrderBy']=_0x51e882['ItemType.OrderBy']||_0x86db74;delete _0x51e882[_0x7d75('0xe1')];_0x86db74=_0x86db74+0x1;return _0x51e882;});return db[_0x7d75('0xdd')][_0x7d75('0xe2')](_0x5f5a78,{});})[_0x7d75('0x2c')](function(){_0x527da7(0x1);});});}function insertAdditionalPhones(_0x10665f,_0x13f403){return new Promise(function(_0x555700,_0x1af890){var _0x215993=[];for(var _0x5e5e6f=0x0;_0x5e5e6f<_0x13f403[_0x7d75('0x33')];_0x5e5e6f++){var _0x3f582c=_0x13f403[_0x5e5e6f];_0x215993[_0x7d75('0x35')](parseContactItemType(_0x3f582c));}Promise[_0x7d75('0x39')](_0x215993)[_0x7d75('0x2c')](function(){var _0x3a2822={'id':_0x10665f['id'],'items':_0x13f403};return addAdditionalPhones(_0x3a2822)[_0x7d75('0x2c')](function(_0x3fdf29){return addCmHopperPhones(_0x10665f['id']);});})[_0x7d75('0x2c')](function(){_0x555700(_0x10665f);});});}function parseContactItemType(_0x5786df){return new Promise(function(_0x5a3ca3,_0x431b52){if(_0x5786df['hasOwnProperty']('ItemTypeId')){_0x5a3ca3(_0x5786df);}else{return db[_0x7d75('0xc6')]['find']({'where':{'name':_0x5786df['ItemType']}})['then'](function(_0x103a95){if(_[_0x7d75('0x64')](_0x103a95))_0x5786df[_0x7d75('0xdb')]=null;else _0x5786df[_0x7d75('0xdb')]=_0x103a95['id'];_0x5a3ca3(_0x5786df);});}});}exports[_0x7d75('0xe3')]=function(_0x220291,_0x4c8de7){return db['CmContactHasItem'][_0x7d75('0x9e')]({'raw':!![],'where':{'CmContactId':_0x220291[_0x7d75('0x97')]['id'],'ItemClass':'PHONE'},'include':[{'model':db[_0x7d75('0xc6')],'as':'ItemType'}],'order':[[db['sequelize']['literal'](_0x7d75('0xe0'))],[_0x7d75('0xe4')]]})[_0x7d75('0x2c')](function(_0x137b7c){return _0x137b7c;})[_0x7d75('0x2c')](respondWithResult(_0x4c8de7,null))[_0x7d75('0x95')](handleError(_0x4c8de7,null));};exports[_0x7d75('0xe5')]=function(_0x5c23b6,_0x4ff53c){return db[_0x7d75('0xb2')]['findAll']({'raw':!![],'where':{'CmContactId':_0x5c23b6[_0x7d75('0x9d')][_0x7d75('0xe6')]}})[_0x7d75('0x2c')](function(_0x39ae01){var _0x3885fe=_['map'](_0x39ae01,function(_0x59e122){_0x59e122['CmContactId']=_0x5c23b6[_0x7d75('0x9d')][_0x7d75('0xe7')];return _0x59e122;});return db[_0x7d75('0xb2')][_0x7d75('0xe2')](_0x3885fe,{});})[_0x7d75('0x2c')](function(_0x59fdc7){return addCmHopperPhones(_0x5c23b6[_0x7d75('0x9d')][_0x7d75('0xe7')]);})[_0x7d75('0x2c')](function(_0x13d742){return['ok'];})[_0x7d75('0x2c')](respondWithResult(_0x4ff53c,null))[_0x7d75('0x95')](handleError(_0x4ff53c,null));};exports[_0x7d75('0xe8')]=function(_0x458940,_0x5b3ccb){var _0x1c5ea0=[];_0x1c5ea0[_0x7d75('0x35')](createCmHopperPhone(_0x458940['body']['id'],_0x458940[_0x7d75('0x9d')]['hopperId']));Promise['all'](_0x1c5ea0)[_0x7d75('0x2c')](function(){return[0x1];})['then'](respondWithResult(_0x5b3ccb,null));};exports[_0x7d75('0xe9')]=function(_0x47561a,_0x2ebc61,_0x17bebb){var _0x1012f2={'raw':![],'where':{}};var _0x914267={};var _0x15b1cc={'count':0x0,'rows':[]};return db[_0x7d75('0x89')][_0x7d75('0x37')]({'where':{'id':_0x47561a[_0x7d75('0x97')]['id']}})[_0x7d75('0x2c')](handleEntityNotFound(_0x2ebc61,null))['then'](function(_0x3fee72){if(_0x3fee72){_0x914267[_0x7d75('0x3c')]=_[_0x7d75('0x32')](db[_0x7d75('0xa5')][_0x7d75('0xd5')]);_0x914267['query']=_['keys'](_0x47561a['query']);_0x914267[_0x7d75('0x3e')]=_['intersection'](_0x914267[_0x7d75('0x3c')],_0x914267[_0x7d75('0x3d')]);_0x1012f2['attributes']=_['intersection'](_0x914267[_0x7d75('0x3c')],qs[_0x7d75('0x41')](_0x47561a['query'][_0x7d75('0x41')]));_0x1012f2['attributes']=_0x1012f2[_0x7d75('0x40')][_0x7d75('0x33')]?_0x1012f2[_0x7d75('0x40')]:_0x914267[_0x7d75('0x3c')];if(!_0x47561a[_0x7d75('0x3d')][_0x7d75('0x42')](_0x7d75('0x43'))){_0x1012f2['limit']=qs[_0x7d75('0x23')](_0x47561a[_0x7d75('0x3d')][_0x7d75('0x23')]);_0x1012f2[_0x7d75('0x21')]=qs[_0x7d75('0x21')](_0x47561a[_0x7d75('0x3d')][_0x7d75('0x21')]);}_0x1012f2[_0x7d75('0x44')]=qs[_0x7d75('0x45')](_0x47561a[_0x7d75('0x3d')][_0x7d75('0x45')]);_0x1012f2[_0x7d75('0x50')]=qs['filters'](_[_0x7d75('0x46')](_0x47561a[_0x7d75('0x3d')],_0x914267['filters']));_0x1012f2[_0x7d75('0x50')][_0x7d75('0xea')]=_0x3fee72['id'];if(_0x47561a['query'][_0x7d75('0x63')]){_0x1012f2[_0x7d75('0x50')]=_[_0x7d75('0x88')](_0x1012f2[_0x7d75('0x50')],{'$or':_['map'](_0x1012f2[_0x7d75('0x40')],function(_0x3d3572){var _0x2261b5={};_0x2261b5[_0x3d3572]={'$like':'%'+_0x47561a['query'][_0x7d75('0x63')]+'%'};return _0x2261b5;})});}_0x1012f2=_[_0x7d75('0x88')]({},_0x1012f2,_0x47561a[_0x7d75('0xd6')]);return db['CmHopper']['count']({'where':_0x1012f2[_0x7d75('0x50')]})['then'](function(_0x22fdea){_0x15b1cc['count']=_0x22fdea;if(_0x47561a['query'][_0x7d75('0xeb')]){_0x1012f2[_0x7d75('0xec')]=[{'all':!![]}];}return db[_0x7d75('0xa5')][_0x7d75('0x9e')](_0x1012f2);})[_0x7d75('0x2c')](function(_0x36fbd1){_0x15b1cc['rows']=_0x36fbd1;return _0x15b1cc;});}})[_0x7d75('0x2c')](respondWithFilteredResult(_0x2ebc61,_0x1012f2))[_0x7d75('0x95')](handleError(_0x2ebc61,null));};exports[_0x7d75('0xed')]=function(_0x1315aa,_0x9cace8,_0x3e6e30){var _0x5c727c={'raw':!![],'where':{}};var _0x4c9861={};var _0xf4d3a9={'count':0x0,'rows':[]};return db[_0x7d75('0x89')][_0x7d75('0x37')]({'where':{'id':_0x1315aa[_0x7d75('0x97')]['id']}})[_0x7d75('0x2c')](handleEntityNotFound(_0x9cace8,null))['then'](function(_0x4d0c1e){if(_0x4d0c1e){_0x4c9861[_0x7d75('0x3c')]=_[_0x7d75('0x32')](db[_0x7d75('0xb4')]['rawAttributes']);_0x4c9861[_0x7d75('0x3d')]=_[_0x7d75('0x32')](_0x1315aa[_0x7d75('0x3d')]);_0x4c9861[_0x7d75('0x3e')]=_[_0x7d75('0x3f')](_0x4c9861[_0x7d75('0x3c')],_0x4c9861[_0x7d75('0x3d')]);_0x5c727c[_0x7d75('0x40')]=_['intersection'](_0x4c9861[_0x7d75('0x3c')],qs[_0x7d75('0x41')](_0x1315aa[_0x7d75('0x3d')][_0x7d75('0x41')]));_0x5c727c['attributes']=_0x5c727c[_0x7d75('0x40')][_0x7d75('0x33')]?_0x5c727c[_0x7d75('0x40')]:_0x4c9861[_0x7d75('0x3c')];if(!_0x1315aa[_0x7d75('0x3d')][_0x7d75('0x42')]('nolimit')){_0x5c727c[_0x7d75('0x23')]=qs['limit'](_0x1315aa[_0x7d75('0x3d')][_0x7d75('0x23')]);_0x5c727c[_0x7d75('0x21')]=qs['offset'](_0x1315aa[_0x7d75('0x3d')][_0x7d75('0x21')]);}_0x5c727c['order']=qs[_0x7d75('0x45')](_0x1315aa[_0x7d75('0x3d')][_0x7d75('0x45')]);_0x5c727c[_0x7d75('0x50')]=qs[_0x7d75('0x3e')](_[_0x7d75('0x46')](_0x1315aa[_0x7d75('0x3d')],_0x4c9861[_0x7d75('0x3e')]));_0x5c727c[_0x7d75('0x50')]['ContactId']=_0x4d0c1e['id'];if(_0x1315aa['query'][_0x7d75('0x63')]){_0x5c727c[_0x7d75('0x50')]=_[_0x7d75('0x88')](_0x5c727c['where'],{'$or':_[_0x7d75('0x59')](_0x5c727c[_0x7d75('0x40')],function(_0x5f8b5f){var _0x56e4ce={};_0x56e4ce[_0x5f8b5f]={'$like':'%'+_0x1315aa[_0x7d75('0x3d')][_0x7d75('0x63')]+'%'};return _0x56e4ce;})});}_0x5c727c=_['merge']({},_0x5c727c,_0x1315aa[_0x7d75('0xd6')]);return db[_0x7d75('0xb4')][_0x7d75('0x24')]({'where':_0x5c727c[_0x7d75('0x50')]})['then'](function(_0x5f091f){_0xf4d3a9['count']=_0x5f091f;if(_0x1315aa[_0x7d75('0x3d')][_0x7d75('0xeb')]){_0x5c727c[_0x7d75('0xec')]=[{'all':!![]}];}return db[_0x7d75('0xb4')][_0x7d75('0x9e')](_0x5c727c);})['then'](function(_0x2b76f9){_0xf4d3a9[_0x7d75('0xee')]=_0x2b76f9;return _0xf4d3a9;});}})[_0x7d75('0x2c')](respondWithFilteredResult(_0x9cace8,_0x5c727c))['catch'](handleError(_0x9cace8,null));};exports['getHopperFinals']=function(_0x43465e,_0x209015,_0x2617c2){var _0x402398={'raw':!![],'where':{}};var _0x14cdb0={};var _0x8fd877={'count':0x0,'rows':[]};return db[_0x7d75('0x89')]['findOne']({'where':{'id':_0x43465e[_0x7d75('0x97')]['id']}})[_0x7d75('0x2c')](handleEntityNotFound(_0x209015,null))[_0x7d75('0x2c')](function(_0x7eeeed){if(_0x7eeeed){_0x14cdb0[_0x7d75('0x3c')]=_[_0x7d75('0x32')](db[_0x7d75('0xb3')][_0x7d75('0xd5')]);_0x14cdb0[_0x7d75('0x3d')]=_[_0x7d75('0x32')](_0x43465e[_0x7d75('0x3d')]);_0x14cdb0[_0x7d75('0x3e')]=_[_0x7d75('0x3f')](_0x14cdb0[_0x7d75('0x3c')],_0x14cdb0[_0x7d75('0x3d')]);_0x402398[_0x7d75('0x40')]=_[_0x7d75('0x3f')](_0x14cdb0['model'],qs[_0x7d75('0x41')](_0x43465e[_0x7d75('0x3d')][_0x7d75('0x41')]));_0x402398[_0x7d75('0x40')]=_0x402398[_0x7d75('0x40')]['length']?_0x402398['attributes']:_0x14cdb0['model'];if(!_0x43465e[_0x7d75('0x3d')][_0x7d75('0x42')]('nolimit')){_0x402398['limit']=qs['limit'](_0x43465e['query'][_0x7d75('0x23')]);_0x402398[_0x7d75('0x21')]=qs[_0x7d75('0x21')](_0x43465e[_0x7d75('0x3d')]['offset']);}_0x402398[_0x7d75('0x44')]=qs[_0x7d75('0x45')](_0x43465e[_0x7d75('0x3d')][_0x7d75('0x45')]);_0x402398[_0x7d75('0x50')]=qs[_0x7d75('0x3e')](_['pick'](_0x43465e[_0x7d75('0x3d')],_0x14cdb0[_0x7d75('0x3e')]));_0x402398[_0x7d75('0x50')][_0x7d75('0xea')]=_0x7eeeed['id'];if(_0x43465e[_0x7d75('0x3d')]['filter']){_0x402398['where']=_['merge'](_0x402398['where'],{'$or':_[_0x7d75('0x59')](_0x402398[_0x7d75('0x40')],function(_0x4da8d0){var _0x5470ee={};_0x5470ee[_0x4da8d0]={'$like':'%'+_0x43465e[_0x7d75('0x3d')][_0x7d75('0x63')]+'%'};return _0x5470ee;})});}_0x402398=_[_0x7d75('0x88')]({},_0x402398,_0x43465e[_0x7d75('0xd6')]);return db[_0x7d75('0xb3')][_0x7d75('0x24')]({'where':_0x402398['where']})[_0x7d75('0x2c')](function(_0x3b6c33){_0x8fd877[_0x7d75('0x24')]=_0x3b6c33;if(_0x43465e['query'][_0x7d75('0xeb')]){_0x402398[_0x7d75('0xec')]=[{'all':!![]}];}return db[_0x7d75('0xb3')][_0x7d75('0x9e')](_0x402398);})[_0x7d75('0x2c')](function(_0x848a1e){_0x8fd877[_0x7d75('0xee')]=_0x848a1e;return _0x8fd877;});}})['then'](respondWithFilteredResult(_0x209015,_0x402398))[_0x7d75('0x95')](handleError(_0x209015,null));};exports[_0x7d75('0xef')]=function(_0x245562,_0x3b900f,_0x19e643){var _0x34d80e={'raw':!![],'where':{}};var _0x13a2e8={};var _0x39a0a4={'count':0x0,'rows':[]};return db[_0x7d75('0x89')]['findOne']({'where':{'id':_0x245562[_0x7d75('0x97')]['id']}})[_0x7d75('0x2c')](handleEntityNotFound(_0x3b900f,null))['then'](function(_0x4624c0){if(_0x4624c0){_0x13a2e8['model']=_[_0x7d75('0x32')](db[_0x7d75('0xb9')]['rawAttributes']);_0x13a2e8[_0x7d75('0x3d')]=_[_0x7d75('0x32')](_0x245562[_0x7d75('0x3d')]);_0x13a2e8[_0x7d75('0x3e')]=_[_0x7d75('0x3f')](_0x13a2e8['model'],_0x13a2e8[_0x7d75('0x3d')]);_0x34d80e[_0x7d75('0x40')]=_[_0x7d75('0x3f')](_0x13a2e8[_0x7d75('0x3c')],qs[_0x7d75('0x41')](_0x245562['query'][_0x7d75('0x41')]));_0x34d80e['attributes']=_0x34d80e['attributes'][_0x7d75('0x33')]?_0x34d80e[_0x7d75('0x40')]:_0x13a2e8[_0x7d75('0x3c')];if(!_0x245562[_0x7d75('0x3d')][_0x7d75('0x42')](_0x7d75('0x43'))){_0x34d80e['limit']=qs[_0x7d75('0x23')](_0x245562[_0x7d75('0x3d')][_0x7d75('0x23')]);_0x34d80e[_0x7d75('0x21')]=qs[_0x7d75('0x21')](_0x245562[_0x7d75('0x3d')]['offset']);}_0x34d80e['order']=qs[_0x7d75('0x45')](_0x245562[_0x7d75('0x3d')][_0x7d75('0x45')]);_0x34d80e['where']=qs[_0x7d75('0x3e')](_[_0x7d75('0x46')](_0x245562[_0x7d75('0x3d')],_0x13a2e8[_0x7d75('0x3e')]));_0x34d80e['where']['ContactId']=_0x4624c0['id'];if(_0x245562[_0x7d75('0x3d')][_0x7d75('0x63')]){_0x34d80e['where']=_[_0x7d75('0x88')](_0x34d80e[_0x7d75('0x50')],{'$or':_[_0x7d75('0x59')](_0x34d80e[_0x7d75('0x40')],function(_0x1cd5cc){var _0x2a969f={};_0x2a969f[_0x1cd5cc]={'$like':'%'+_0x245562['query'][_0x7d75('0x63')]+'%'};return _0x2a969f;})});}_0x34d80e=_['merge']({},_0x34d80e,_0x245562[_0x7d75('0xd6')]);return db[_0x7d75('0xb9')]['count']({'where':_0x34d80e['where']})[_0x7d75('0x2c')](function(_0x30fede){_0x39a0a4[_0x7d75('0x24')]=_0x30fede;if(_0x245562['query'][_0x7d75('0xeb')]){_0x34d80e['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x7d75('0x9e')](_0x34d80e);})[_0x7d75('0x2c')](function(_0x3742e9){_0x39a0a4[_0x7d75('0xee')]=_0x3742e9;return _0x39a0a4;});}})[_0x7d75('0x2c')](respondWithFilteredResult(_0x3b900f,_0x34d80e))[_0x7d75('0x95')](handleError(_0x3b900f,null));};exports['uploadCsv']=function(_0x19d323,_0x5e3594,_0x44eda6){try{if(!_0x19d323[_0x7d75('0x9d')][_0x7d75('0x66')]){throw new Error(_0x7d75('0xf0'));}if(!_0x19d323['body'][_0x7d75('0xf1')]){throw new Error(_0x7d75('0xf2'));}if(!_0x19d323[_0x7d75('0x9d')][_0x7d75('0xf3')]){throw new Error(_0x7d75('0xf4'));}if(!_0x19d323['body']['socket_timestamp']){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x1aabbf=_0x19d323[_0x7d75('0x9d')]['binding_keys']['split'](',');var _0x57cf30=_0x19d323[_0x7d75('0x9d')]['binding_values']['split'](',');if(!_0x1aabbf['length']||!_0x57cf30[_0x7d75('0x33')]||_0x1aabbf[_0x7d75('0x33')]!==_0x57cf30[_0x7d75('0x33')]){throw new Error(_0x7d75('0xf5'));}_0x19d323['body'][_0x7d75('0x41')]=_[_0x7d75('0xf6')](_0x1aabbf,_0x57cf30);if(!_0x19d323[_0x7d75('0x9d')][_0x7d75('0x41')][_0x7d75('0xd3')]){throw new Error(_0x7d75('0xf7'));}if(!_0x19d323['body'][_0x7d75('0x41')][_0x7d75('0xf8')]){throw new Error(_0x7d75('0xf9'));}var _0x42ad01=path[_0x7d75('0xa2')](config[_0x7d75('0xfa')],_0x7d75('0xfb'),_0x19d323[_0x7d75('0xfc')][_0x7d75('0xfd')]);fs['chmodSync'](_0x42ad01,parseInt('0777',0x8));var _0x52b236=require('child_process')[_0x7d75('0xfe')](path['join'](__dirname,_0x7d75('0xff')),[_0x42ad01,_0x19d323[_0x7d75('0x9d')][_0x7d75('0xf1')],_0x19d323[_0x7d75('0x9d')][_0x7d75('0xf3')],_0x19d323[_0x7d75('0x9d')][_0x7d75('0x66')],_0x19d323[_0x7d75('0x9d')][_0x7d75('0x100')],_0x19d323[_0x7d75('0x9d')]['duplicates'],_0x19d323[_0x7d75('0x9d')][_0x7d75('0x101')]]);return _0x5e3594[_0x7d75('0x1f')](0xc8)['json']({'message':_0x7d75('0x102'),'pid':_0x52b236[_0x7d75('0x103')]});}catch(_0x3e00a0){return _0x5e3594[_0x7d75('0x1f')](0x1f4)[_0x7d75('0x30')](_0x3e00a0);}};exports[_0x7d75('0x104')]=function(_0x2ef77e,_0xaa14fb,_0xbcb8f4){var _0x490e28=fs[_0x7d75('0x105')](_0x2ef77e[_0x7d75('0xfc')][_0x7d75('0x6')]);Papa[_0x7d75('0x106')](_0x490e28,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x48dd0d){return _0xaa14fb[_0x7d75('0x1f')](0xc8)['json']({'file':_0x2ef77e[_0x7d75('0xfc')],'fields':_0x48dd0d[_0x7d75('0x107')]['fields']});}});};exports['import']=function(_0x41ddde,_0x3bf84a,_0x58033f){return db[_0x7d75('0x108')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x7d75('0x81')}})[_0x7d75('0x2c')](function(_0x2ccb73){var _0x4941e4=![];if(!_0x41ddde[_0x7d75('0x9d')][_0x7d75('0x66')]){throw new Error('No\x20ListId\x20specified');}if(!_0x41ddde[_0x7d75('0x9d')][_0x7d75('0x109')][_0x7d75('0xd3')]){throw new Error(_0x7d75('0xf7'));}if(!_0x41ddde['body'][_0x7d75('0x109')][_0x7d75('0xf8')]){throw new Error(_0x7d75('0xf9'));}if(!_0x41ddde[_0x7d75('0x9d')][_0x7d75('0x101')]){throw new Error(_0x7d75('0x10a'));}var _0x59a9de=require(_0x7d75('0x10b'))['fork'](path[_0x7d75('0xa2')](__dirname,'../../components/import/cm/csv2'),[_0x41ddde[_0x7d75('0x97')]['id'],JSON['stringify'](_0x41ddde[_0x7d75('0x9d')]),JSON[_0x7d75('0x10c')](_0x2ccb73)]);_0x59a9de['on']('message',function(_0xd1ae00){_0x4941e4=!![];return _0x3bf84a[_0x7d75('0x1f')](0xc8)[_0x7d75('0x27')]({'message':_0x7d75('0x10d'),'pid':_0x59a9de['pid']});});_0x59a9de['on'](_0x7d75('0x10e'),function(_0x1e521f){if(_0x1e521f&&!_0x4941e4){return _0x3bf84a[_0x7d75('0x1f')](0x1f4)['json']({'message':_0x7d75('0x10f'),'pid':_0x59a9de[_0x7d75('0x103')]});}});})[_0x7d75('0x95')](handleError(_0x3bf84a,null));};exports[_0x7d75('0x110')]=function(_0x55c354,_0x4c1a92,_0x12f4ca){return db[_0x7d75('0x108')][_0x7d75('0x9e')]({'raw':!![],'attributes':['id'],'where':{'role':_0x7d75('0x81')}})[_0x7d75('0x2c')](function(_0x1a3a76){var _0x1f9103=![];if(!_0x55c354[_0x7d75('0x9d')][_0x7d75('0x66')]){throw new Error('No\x20ListId\x20specified');}if(!_0x55c354[_0x7d75('0x9d')][_0x7d75('0x109')][_0x7d75('0xd3')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x55c354[_0x7d75('0x9d')][_0x7d75('0x109')][_0x7d75('0xf8')]){throw new Error(_0x7d75('0xf9'));}if(!_0x55c354['body'][_0x7d75('0x101')]){throw new Error(_0x7d75('0x10a'));}var _0x5d91af=require(_0x7d75('0x10b'))[_0x7d75('0xfe')](path[_0x7d75('0xa2')](__dirname,'../../components/import/cm/csvUpdates'),[_0x55c354[_0x7d75('0x97')]['id'],JSON[_0x7d75('0x10c')](_0x55c354[_0x7d75('0x9d')]),JSON[_0x7d75('0x10c')](_0x1a3a76)]);_0x5d91af['on']('message',function(_0x5c3939){_0x1f9103=!![];return _0x4c1a92[_0x7d75('0x1f')](0xc8)[_0x7d75('0x27')]({'message':_0x7d75('0x10d'),'pid':_0x5d91af[_0x7d75('0x103')]});});_0x5d91af['on'](_0x7d75('0x10e'),function(_0x4faaac){if(_0x4faaac&&!_0x1f9103){return _0x4c1a92['status'](0x1f4)[_0x7d75('0x27')]({'message':'error\x20child\x20process','pid':_0x5d91af[_0x7d75('0x103')]});}});})[_0x7d75('0x95')](handleError(_0x4c1a92,null));};exports['getJourney']=function(_0x4a916a,_0x43fd1b){var _0x389a14=[_0x7d75('0x111'),_0x7d75('0x112'),_0x7d75('0x113'),_0x7d75('0x114'),'fax','whatsapp',_0x7d75('0x115')];var _0x34a3bf={'offset':0x0,'order':qs[_0x7d75('0x45')](_0x7d75('0x116'))},_0x157cf3={'count':0x0,'rows':[]};Promise[_0x7d75('0x7e')]()[_0x7d75('0x2c')](function(){if(_0x4a916a[_0x7d75('0x3d')][_0x7d75('0x117')]){if(!_[_0x7d75('0x118')](_0x389a14,_0x4a916a['query'][_0x7d75('0x117')][_0x7d75('0x119')]())){throw new Error('Invalid\x20channel');}_0x389a14=[_0x4a916a['query'][_0x7d75('0x117')]['toLowerCase']()];}if(_0x4a916a[_0x7d75('0x3d')][_0x7d75('0x11a')]){try{var _0x4a74c5=JSON['parse'](_0x4a916a['query'][_0x7d75('0x11a')]);if(!moment(_0x4a74c5[_0x7d75('0x49')])[_0x7d75('0x11b')]()){throw new Error(_0x7d75('0x11c'));}if(!moment(_0x4a74c5['to'])[_0x7d75('0x11b')]()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x53e9e2){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0x4a916a[_0x7d75('0x3d')][_0x7d75('0x42')](_0x7d75('0x43'))){_0x34a3bf[_0x7d75('0x23')]=qs['limit'](_0x4a916a[_0x7d75('0x3d')][_0x7d75('0x23')]||0xa);_0x34a3bf['offset']=qs[_0x7d75('0x21')](_0x4a916a['query']['offset']);}var _0x25d0f2=_0x389a14['map'](function(_0x82dde2){if(_0x82dde2==='voice'){var _0x2b8781={'attributes':['id','uniqueid',_0x7d75('0x3b'),'source',_0x7d75('0x11d'),'callerid',_0x7d75('0x11e'),'endtime',_0x7d75('0x11f'),_0x7d75('0x120'),_0x7d75('0x121'),_0x7d75('0x122'),_0x7d75('0x123'),'userThirdDisposition',_0x7d75('0x124')],'where':{'ContactId':_0x4a916a['params']['id']},'include':[{'model':db[_0x7d75('0x108')],'as':_0x7d75('0x108'),'attributes':['id','name',_0x7d75('0x125'),_0x7d75('0x126')]}],'order':[['createdAt',_0x7d75('0x127')]]};if(_0x4a916a[_0x7d75('0x3d')][_0x7d75('0x11a')]){_0x2b8781[_0x7d75('0x50')][_0x7d75('0x121')]={'$gte':_0x4a74c5[_0x7d75('0x49')],'$lte':_0x4a74c5['to']};}return db[_0x7d75('0x128')][_0x7d75('0x129')](_0x2b8781)[_0x7d75('0x2c')](function(_0x9bdb33){_0x157cf3[_0x7d75('0x24')]+=_0x9bdb33[_0x7d75('0x24')];return _[_0x7d75('0x59')](_0x9bdb33[_0x7d75('0xee')],function(_0x3d0fe7){var _0x48d9de=_0x3d0fe7['get']({'plain':!![]});_0x48d9de[_0x7d75('0x117')]=_0x82dde2;if(_0x48d9de[_0x7d75('0x108')]){_0x48d9de['User']={'id':_0x48d9de[_0x7d75('0x108')]['id'],'name':_0x48d9de[_0x7d75('0x108')][_0x7d75('0x2f')],'fullname':_0x48d9de['User']['fullname'],'alias':_0x48d9de['User']['alias']};}return _0x48d9de;});});}else{var _0x4c89dd=_[_0x7d75('0x12a')](_0x82dde2)+(_0x82dde2===_0x7d75('0x112')?'Website':_0x7d75('0x12b'));var _0x1311d9={'attributes':['id',_0x7d75('0x12c'),'closedAt',_0x7d75('0x121'),_0x7d75('0x120'),_0x7d75('0x12d'),_0x7d75('0x12e'),_0x7d75('0x12f'),'UserId',_0x4c89dd+'Id'],'where':{'ContactId':_0x4a916a[_0x7d75('0x97')]['id']},'include':[{'model':db[_0x4c89dd],'as':_0x7d75('0x12b'),'attributes':['id',_0x7d75('0x2f'),_0x7d75('0x130')]},{'model':db[_0x7d75('0x108')],'as':'Owner','attributes':['id',_0x7d75('0x2f'),_0x7d75('0x125')]},{'model':db[_0x7d75('0x57')],'as':_0x7d75('0x94'),'attributes':['id',_0x7d75('0x2f'),_0x7d75('0xc4')],'through':{'attributes':[]}}],'order':[['createdAt',_0x7d75('0x127')]]};if(_0x4a916a[_0x7d75('0x3d')][_0x7d75('0x11a')]){_0x1311d9[_0x7d75('0x50')]['createdAt']={'$gte':_0x4a74c5['from'],'$lte':_0x4a74c5['to']};}switch(_0x82dde2){case'chat':_0x1311d9[_0x7d75('0x40')][_0x7d75('0x35')](_0x7d75('0x131'),'customerIp','customerPort','deviceModel',_0x7d75('0x132'),'ratingMessage','ratingType',_0x7d75('0x133'),_0x7d75('0x134'));break;case _0x7d75('0x111'):_0x1311d9['attributes'][_0x7d75('0x35')](_0x7d75('0x135'),_0x7d75('0x136'));break;case _0x7d75('0x114'):_0x1311d9[_0x7d75('0x40')][_0x7d75('0x35')]('externalUrl','threadId');break;}return db[_[_0x7d75('0x12a')](_0x82dde2)+_0x7d75('0x137')]['findAndCountAll'](_0x1311d9)[_0x7d75('0x2c')](function(_0x1b4043){_0x157cf3[_0x7d75('0x24')]+=_0x1b4043[_0x7d75('0x24')];return _[_0x7d75('0x59')](_0x1b4043['rows'],function(_0x434da5){var _0x1377b3=_0x434da5[_0x7d75('0x9f')]({'plain':!![]});_0x1377b3[_0x7d75('0x117')]=_0x82dde2;if(_0x1377b3['Owner']){_0x1377b3[_0x7d75('0x138')]={'id':_0x1377b3[_0x7d75('0x138')]['id'],'name':_0x1377b3[_0x7d75('0x138')][_0x7d75('0x2f')],'fullname':_0x1377b3[_0x7d75('0x138')][_0x7d75('0x125')]};}return _0x1377b3;});});}});return Promise[_0x7d75('0x39')](_0x25d0f2);})[_0x7d75('0x2c')](function(_0x3d52a7){return _(_0x3d52a7)[_0x7d75('0x139')]()[_0x7d75('0x13a')]('createdAt')[_0x7d75('0x13b')]()['value']();})[_0x7d75('0x2c')](function(_0x5ae581){_0x157cf3['rows']=_0x34a3bf[_0x7d75('0x23')]?_0x5ae581[_0x7d75('0x13c')](_0x34a3bf['offset'],_0x34a3bf['offset']+_0x34a3bf['limit']):_0x5ae581;return _0x157cf3;})[_0x7d75('0x2c')](respondWithFilteredResult(_0x43fd1b,_0x34a3bf))[_0x7d75('0x95')](handleError(_0x43fd1b,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 100294e..406688f 100644 --- a/server/api/cmContact/cmContact.events.js +++ b/server/api/cmContact/cmContact.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x363a=['hasOwnProperty','exports','../../mysqldb','CmContact','setMaxListeners','save','update','remove','emit'];(function(_0x26c4aa,_0x2eb22c){var _0xd7c782=function(_0x538ee9){while(--_0x538ee9){_0x26c4aa['push'](_0x26c4aa['shift']());}};_0xd7c782(++_0x2eb22c);}(_0x363a,0x1a9));var _0xa363=function(_0x1ba19c,_0x3975e2){_0x1ba19c=_0x1ba19c-0x0;var _0x4e069b=_0x363a[_0x1ba19c];return _0x4e069b;};'use strict';var EventEmitter=require('events');var CmContact=require(_0xa363('0x0'))['db'][_0xa363('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xa363('0x2')](0x0);var events={'afterCreate':_0xa363('0x3'),'afterUpdate':_0xa363('0x4'),'afterDestroy':_0xa363('0x5')};function emitEvent(_0x53c99e){return function(_0x439236,_0x1504a1,_0x599cb8){CmContactEvents['emit'](_0x53c99e+':'+_0x439236['id'],_0x439236);CmContactEvents[_0xa363('0x6')](_0x53c99e,_0x439236);_0x599cb8(null);};}for(var e in events){if(events[_0xa363('0x7')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0xa363('0x8')]=CmContactEvents; \ No newline at end of file +var _0x8d3c=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmContact'];(function(_0x1f5e4a,_0x16111e){var _0x380da7=function(_0x49dbbb){while(--_0x49dbbb){_0x1f5e4a['push'](_0x1f5e4a['shift']());}};_0x380da7(++_0x16111e);}(_0x8d3c,0x126));var _0xc8d3=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x8d3c[_0x4b369d];return _0x571a98;};'use strict';var EventEmitter=require(_0xc8d3('0x0'));var CmContact=require(_0xc8d3('0x1'))['db'][_0xc8d3('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xc8d3('0x3')](0x0);var events={'afterCreate':_0xc8d3('0x4'),'afterUpdate':_0xc8d3('0x5'),'afterDestroy':_0xc8d3('0x6')};function emitEvent(_0xb7f959){return function(_0x4cce5d,_0x54fe13,_0x4ea16c){CmContactEvents[_0xc8d3('0x7')](_0xb7f959+':'+_0x4cce5d['id'],_0x4cce5d);CmContactEvents[_0xc8d3('0x7')](_0xb7f959,_0x4cce5d);_0x4ea16c(null);};}for(var e in events){if(events[_0xc8d3('0x8')](e)){var event=events[e];CmContact[_0xc8d3('0x9')](e,emitEvent(event));}}module[_0xc8d3('0xa')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 56c348c..38e37ea 100644 --- a/server/api/cmContact/cmContact.model.js +++ b/server/api/cmContact/cmContact.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd827=['rimraf','../../config/environment','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','mobile','fax','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','cmContact','findOne','then','isNil','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','priority','scheduledat','callbackUniqueid','YYYY-MM-DD\x20HH:mm:ss','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','CmHopper','ListId','format','catch','afterCreate','inspect','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','create','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','CmList','Lists','length','always','onlyIfOpen','VoiceQueue','BlackLists','CmHopperBlack','message','Campaign','cmContact,\x20%s,\x20%s','List\x20not\x20found','isEmpty','VoiceQueueId','push','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0x3778fb,_0x4fb11f){var _0x1cbe9e=function(_0x4909c2){while(--_0x4909c2){_0x3778fb['push'](_0x3778fb['shift']());}};_0x1cbe9e(++_0x4fb11f);}(_0xd827,0x1d6));var _0x7d82=function(_0x4e77c6,_0x4c359c){_0x4e77c6=_0x4e77c6-0x0;var _0x3e326c=_0xd827[_0x4e77c6];return _0x3e326c;};'use strict';var _=require(_0x7d82('0x0'));var util=require('util');var logger=require(_0x7d82('0x1'))(_0x7d82('0x2'));var moment=require('moment');var BPromise=require(_0x7d82('0x3'));var rp=require(_0x7d82('0x4'));var fs=require('fs');var path=require(_0x7d82('0x5'));var rimraf=require(_0x7d82('0x6'));var config=require(_0x7d82('0x7'));var attributes=require(_0x7d82('0x8'));module[_0x7d82('0x9')]=function(_0x2a7b17,_0x2321b1){return _0x2a7b17[_0x7d82('0xa')](_0x7d82('0xb'),attributes,{'tableName':_0x7d82('0xc'),'paranoid':!![],'indexes':[{'name':_0x7d82('0xd'),'fields':['phone']},{'name':_0x7d82('0xe'),'fields':[_0x7d82('0xf'),'lastName',_0x7d82('0xd'),_0x7d82('0x10'),_0x7d82('0x11'),'email'],'type':_0x7d82('0x12')}],'timestamps':!![],'charset':_0x7d82('0x13'),'collate':_0x7d82('0x14'),'hooks':{'afterCreate':function(_0x3651cc,_0x5152e6,_0xf94042){var _0x226f98=_0x2a7b17[_0x7d82('0x15')];var _0x3351e3=_0x3651cc[_0x7d82('0x16')]({'plain':!![]});function _0x460bf8(){return function(_0x5c7504){logger[_0x7d82('0x17')](_0x7d82('0x18'),'afterCreate',util['inspect'](_0x5c7504,{'showHidden':![],'depth':null}));};}var _0x2ca26d=function(_0x1505e9){return new BPromise(function(_0x260180,_0x438ca6){_0x226f98['CmHopper'][_0x7d82('0x19')]({'where':{'phone':_0x3351e3[_0x7d82('0xd')],'VoiceQueueId':_0x1505e9['id']}})[_0x7d82('0x1a')](function(_0x1613c6){if(!_[_0x7d82('0x1b')](_0x1613c6)){throw new Error('cmContact,\x20afterCreate\x20'+_0x3351e3['phone']+_0x7d82('0x1c')+_0x1505e9['id']);}return _0x226f98['CmHopper']['create']({'phone':_0x3351e3[_0x7d82('0xd')],'ContactId':_0x3351e3['id'],'ListId':_0x3351e3['ListId'],'priority':_0x3351e3[_0x7d82('0x1d')]?_0x3351e3[_0x7d82('0x1d')]:0x2,'scheduledat':_0x3351e3['scheduledat']?_0x3351e3[_0x7d82('0x1e')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x3351e3['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x3351e3[_0x7d82('0x1f')]?_0x3351e3[_0x7d82('0x1f')]:undefined,'callbackat':_0x3351e3[_0x7d82('0x1f')]?moment()['format'](_0x7d82('0x20')):undefined,'VoiceQueueId':_0x1505e9['id']});})['catch'](function(_0x1bb64e){_0x438ca6(_0x1bb64e);});});};var _0x3de4b2=function(_0x20d95e){return new BPromise(function(_0x4a99ff,_0xad6eb1){_0x226f98['CmHopper'][_0x7d82('0x19')]({'where':{'phone':_0x3351e3[_0x7d82('0xd')],'VoiceQueueId':_0x20d95e['id']}})['then'](function(_0x54ceb4){if(!_[_0x7d82('0x1b')](_0x54ceb4)){throw new Error(_0x7d82('0x21')+_0x3351e3[_0x7d82('0xd')]+_0x7d82('0x22')+_0x20d95e['id']);}return _0x226f98[_0x7d82('0x23')][_0x7d82('0x19')]({'where':{'calleridnum':_0x3351e3['phone'],'VoiceQueueId':_0x20d95e['id']}});})[_0x7d82('0x1a')](function(_0x3f8228){if(!_[_0x7d82('0x1b')](_0x3f8228)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x3351e3[_0x7d82('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0x20d95e['id']);}return _0x226f98[_0x7d82('0x24')]['create']({'phone':_0x3351e3['phone'],'ContactId':_0x3351e3['id'],'ListId':_0x3351e3[_0x7d82('0x25')],'priority':_0x3351e3['priority']?_0x3351e3[_0x7d82('0x1d')]:0x2,'scheduledat':_0x3351e3[_0x7d82('0x1e')]?_0x3351e3[_0x7d82('0x1e')]:moment()[_0x7d82('0x26')](_0x7d82('0x20')),'callback':_0x3351e3['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x3351e3[_0x7d82('0x1f')]?_0x3351e3[_0x7d82('0x1f')]:undefined,'callbackat':_0x3351e3[_0x7d82('0x1f')]?moment()[_0x7d82('0x26')](_0x7d82('0x20')):undefined,'VoiceQueueId':_0x20d95e['id']});})[_0x7d82('0x27')](function(_0x22cd14){_0xad6eb1(_0x22cd14);});});};function _0x274c55(){return function(_0x3e0086){logger[_0x7d82('0x17')]('cmContact',_0x7d82('0x28'),util[_0x7d82('0x29')](_0x3e0086,{'showHidden':![],'depth':null}));};}var _0x132462=function(_0x23786e){return new BPromise(function(_0x5aa429,_0x3ec9df){_0x226f98['CmHopper']['findOne']({'where':{'phone':_0x3351e3['phone'],'CampaignId':_0x23786e['id']}})[_0x7d82('0x1a')](function(_0x42a1bc){if(!_[_0x7d82('0x1b')](_0x42a1bc)){throw new Error(_0x7d82('0x21')+_0x3351e3[_0x7d82('0xd')]+_0x7d82('0x2a')+_0x23786e['id']);}return _0x226f98[_0x7d82('0x24')][_0x7d82('0x2b')]({'phone':_0x3351e3[_0x7d82('0xd')],'ContactId':_0x3351e3['id'],'ListId':_0x3351e3[_0x7d82('0x25')],'priority':_0x3351e3[_0x7d82('0x1d')]?_0x3351e3[_0x7d82('0x1d')]:0x2,'scheduledat':_0x3351e3[_0x7d82('0x1e')]?_0x3351e3[_0x7d82('0x1e')]:moment()['format'](_0x7d82('0x20')),'callback':_0x3351e3[_0x7d82('0x1f')]?!![]:![],'callbackuniqueid':_0x3351e3[_0x7d82('0x1f')]?_0x3351e3['callbackUniqueid']:undefined,'callbackat':_0x3351e3[_0x7d82('0x1f')]?moment()[_0x7d82('0x26')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x23786e['id']});})[_0x7d82('0x27')](function(_0x2605ff){_0x3ec9df(_0x2605ff);});});};var _0x49673e=function(_0x112a96){return new BPromise(function(_0x1b1072,_0x2a22b8){_0x226f98[_0x7d82('0x24')][_0x7d82('0x19')]({'where':{'phone':_0x3351e3[_0x7d82('0xd')],'CampaignId':_0x112a96['id']}})[_0x7d82('0x1a')](function(_0x37c014){if(!_[_0x7d82('0x1b')](_0x37c014)){throw new Error(_0x7d82('0x21')+_0x3351e3[_0x7d82('0xd')]+_0x7d82('0x2c')+_0x112a96['id']);}return _0x226f98[_0x7d82('0x23')][_0x7d82('0x19')]({'where':{'calleridnum':_0x3351e3[_0x7d82('0xd')],'CampaignId':_0x112a96['id']}});})[_0x7d82('0x1a')](function(_0x5e2427){if(!_[_0x7d82('0x1b')](_0x5e2427)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x3351e3['phone']+_0x7d82('0x2d')+_0x112a96['id']);}return _0x226f98[_0x7d82('0x24')][_0x7d82('0x2b')]({'phone':_0x3351e3[_0x7d82('0xd')],'ContactId':_0x3351e3['id'],'ListId':_0x3351e3[_0x7d82('0x25')],'priority':_0x3351e3['priority']?_0x3351e3[_0x7d82('0x1d')]:0x2,'scheduledat':_0x3351e3[_0x7d82('0x1e')]?_0x3351e3['scheduledat']:moment()[_0x7d82('0x26')](_0x7d82('0x20')),'callback':_0x3351e3[_0x7d82('0x1f')]?!![]:![],'callbackuniqueid':_0x3351e3[_0x7d82('0x1f')]?_0x3351e3['callbackUniqueid']:undefined,'callbackat':_0x3351e3['callbackUniqueid']?moment()[_0x7d82('0x26')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x112a96['id']});})[_0x7d82('0x27')](function(_0x5e32a4){_0x2a22b8(_0x5e32a4);});});};if(_0x3351e3['ListId']){_0x226f98['VoiceQueue'][_0x7d82('0x2e')]({'where':{'type':_0x7d82('0x2f')},'attributes':['id',_0x7d82('0x30')],'include':[{'model':_0x226f98[_0x7d82('0x31')],'as':_0x7d82('0x32'),'where':{'id':_0x3351e3[_0x7d82('0x25')]}}]})['then'](function(_0x21d8fc){if(_0x21d8fc){var _0x487fc4=[];for(var _0x11b9f1=0x0,_0x4bdb59;_0x11b9f1<_0x21d8fc[_0x7d82('0x33')];_0x11b9f1+=0x1){_0x4bdb59=_0x21d8fc[_0x11b9f1][_0x7d82('0x16')]({'plain':!![]});switch(_0x4bdb59[_0x7d82('0x30')]){case _0x7d82('0x34'):_0x3de4b2(_0x4bdb59)[_0x7d82('0x27')](_0x460bf8());break;case _0x7d82('0x35'):_0x2ca26d(_0x4bdb59)[_0x7d82('0x27')](_0x460bf8());break;default:_0x226f98[_0x7d82('0x24')][_0x7d82('0x2b')]({'phone':_0x3351e3[_0x7d82('0xd')],'ContactId':_0x3351e3['id'],'ListId':_0x3351e3[_0x7d82('0x25')],'scheduledat':_0x3351e3[_0x7d82('0x1e')]?_0x3351e3[_0x7d82('0x1e')]:moment()[_0x7d82('0x26')](_0x7d82('0x20')),'priority':_0x3351e3[_0x7d82('0x1d')]?_0x3351e3['priority']:0x2,'callback':_0x3351e3[_0x7d82('0x1f')]?!![]:![],'callbackuniqueid':_0x3351e3[_0x7d82('0x1f')]?_0x3351e3[_0x7d82('0x1f')]:undefined,'callbackat':_0x3351e3[_0x7d82('0x1f')]?moment()[_0x7d82('0x26')](_0x7d82('0x20')):undefined,'VoiceQueueId':_0x4bdb59['id']})[_0x7d82('0x27')](_0x460bf8());}}}})[_0x7d82('0x1a')](function(){return _0x226f98[_0x7d82('0x36')]['findAll']({'where':{'type':_0x7d82('0x2f')},'attributes':['id'],'include':[{'model':_0x226f98[_0x7d82('0x31')],'as':_0x7d82('0x37'),'where':{'id':_0x3351e3[_0x7d82('0x25')]}}]})['then'](function(_0x3ff623){if(_0x3ff623){var _0xdc0895=[];for(var _0x260118=0x0,_0x524f23;_0x260118<_0x3ff623[_0x7d82('0x33')];_0x260118+=0x1){_0x524f23=_0x3ff623[_0x260118]['get']({'plain':!![]});_0x226f98[_0x7d82('0x38')]['create']({'phone':_0x3351e3[_0x7d82('0xd')],'ContactId':_0x3351e3['id'],'ListId':_0x3351e3['ListId'],'VoiceQueueId':_0x524f23['id']})['catch'](function(_0x917756){logger[_0x7d82('0x17')]('cmContact,\x20%s,\x20%s',_0x7d82('0x28'),_0x917756[_0x7d82('0x39')]);});}}});})[_0x7d82('0x1a')](function(){return _0x226f98[_0x7d82('0x3a')][_0x7d82('0x2e')]({'attributes':['id',_0x7d82('0x30')],'include':[{'model':_0x226f98[_0x7d82('0x31')],'as':_0x7d82('0x32'),'where':{'id':_0x3351e3[_0x7d82('0x25')]}}]})[_0x7d82('0x1a')](function(_0x38d19c){if(_0x38d19c){var _0x4ad5c0=[];for(var _0x1638a2=0x0,_0x1e1031;_0x1638a2<_0x38d19c[_0x7d82('0x33')];_0x1638a2+=0x1){_0x1e1031=_0x38d19c[_0x1638a2][_0x7d82('0x16')]({'plain':!![]});switch(_0x1e1031[_0x7d82('0x30')]){case'always':_0x49673e(_0x1e1031)[_0x7d82('0x27')](_0x274c55());break;case _0x7d82('0x35'):_0x132462(_0x1e1031)[_0x7d82('0x27')](_0x274c55());break;default:_0x226f98['CmHopper'][_0x7d82('0x2b')]({'phone':_0x3351e3[_0x7d82('0xd')],'ContactId':_0x3351e3['id'],'ListId':_0x3351e3['ListId'],'scheduledat':_0x3351e3[_0x7d82('0x1e')]?_0x3351e3[_0x7d82('0x1e')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x3351e3['priority']?_0x3351e3[_0x7d82('0x1d')]:0x2,'callback':_0x3351e3[_0x7d82('0x1f')]?!![]:![],'callbackuniqueid':_0x3351e3['callbackUniqueid']?_0x3351e3[_0x7d82('0x1f')]:undefined,'callbackat':_0x3351e3['callbackUniqueid']?moment()[_0x7d82('0x26')](_0x7d82('0x20')):undefined,'CampaignId':_0x1e1031['id']})[_0x7d82('0x27')](_0x274c55());}}}});})[_0x7d82('0x1a')](function(){return _0x226f98['Campaign'][_0x7d82('0x2e')]({'attributes':['id'],'include':[{'model':_0x226f98['CmList'],'as':_0x7d82('0x37'),'where':{'id':_0x3351e3[_0x7d82('0x25')]}}]})[_0x7d82('0x1a')](function(_0xed6f19){if(_0xed6f19){var _0x26eed6=[];for(var _0x1f5ffa=0x0,_0x4a68af;_0x1f5ffa<_0xed6f19[_0x7d82('0x33')];_0x1f5ffa+=0x1){_0x4a68af=_0xed6f19[_0x1f5ffa][_0x7d82('0x16')]({'plain':!![]});_0x226f98[_0x7d82('0x38')]['create']({'phone':_0x3351e3[_0x7d82('0xd')],'ContactId':_0x3351e3['id'],'ListId':_0x3351e3[_0x7d82('0x25')],'CampaignId':_0x4a68af['id']})[_0x7d82('0x27')](function(_0x274ccf){logger['error'](_0x7d82('0x3b'),'afterCreate',_0x274ccf[_0x7d82('0x39')]);});}}});})[_0x7d82('0x1a')](function(){_0xf94042();})[_0x7d82('0x27')](function(_0x4da574){logger[_0x7d82('0x17')]('cmContact,\x20%s,\x20%s',_0x7d82('0x28'),_0x4da574[_0x7d82('0x39')]);_0xf94042(_0x4da574);});}else{_0xf94042(new Error(_0x7d82('0x3c')));}},'afterDestroy':function(_0x4801b7,_0x33c86c,_0xce4f98){var _0x27c781=_0x2a7b17[_0x7d82('0x15')];var _0x27a129=_0x4801b7[_0x7d82('0x16')]({'plain':!![]});return _0x27c781[_0x7d82('0x24')][_0x7d82('0x2e')]({'raw':!![],'where':{'ListId':_0x27a129[_0x7d82('0x25')],'ContactId':_0x27a129['id']}})['then'](function(_0x3b2dcb){if(!_[_0x7d82('0x3d')](_0x3b2dcb)){var _0x3096d8=[];for(var _0xdc02f0=0x0;_0xdc02f0<_0x3b2dcb[_0x7d82('0x33')];_0xdc02f0+=0x1){var _0x52131a=_0x27c781[_0x7d82('0x24')]['destroy']({'where':{'ListId':_0x3b2dcb[_0xdc02f0][_0x7d82('0x25')],'ContactId':_0x3b2dcb[_0xdc02f0]['ContactId'],'VoiceQueueId':_0x3b2dcb[_0xdc02f0][_0x7d82('0x3e')],'CampaignId':_0x3b2dcb[_0xdc02f0]['CampaignId']}});_0x3096d8[_0x7d82('0x3f')](_0x52131a);}return BPromise[_0x7d82('0x40')](_0x3096d8);}})[_0x7d82('0x1a')](function(_0x68b261){logger[_0x7d82('0x41')](_0x7d82('0x42'),util[_0x7d82('0x29')](_0x68b261,{'showHidden':![],'depth':null}));_0xce4f98();})[_0x7d82('0x27')](function(_0x337911){logger['error'](_0x7d82('0x43'),util[_0x7d82('0x29')](_0x337911,{'showHidden':![],'depth':null}));_0xce4f98(_0x337911);});}}});}; \ No newline at end of file +var _0x3651=['\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','VoiceQueue','outbound','dialCheckDuplicateType','CmList','Lists','length','always','findAll','BlackLists','error','cmContact,\x20%s,\x20%s','Campaign','CmHopperBlack','message','List\x20not\x20found','models','isEmpty','destroy','ContactId','VoiceQueueId','CampaignId','push','all','[CmContact][afterDestroy][Error]','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','CmContact','phone','fti_cm_contacts','firstName','lastName','mobile','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','get','cmContact','afterCreate','inspect','CmHopper','findOne','then','cmContact,\x20afterCreate\x20','ListId','priority','scheduledat','YYYY-MM-DD\x20HH:mm:ss','callbackUniqueid','format','catch','isNil','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','create'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0x3651,0x1e1));var _0x1365=function(_0x3aada6,_0x59895d){_0x3aada6=_0x3aada6-0x0;var _0x402b9d=_0x3651[_0x3aada6];return _0x402b9d;};'use strict';var _=require(_0x1365('0x0'));var util=require(_0x1365('0x1'));var logger=require('../../config/logger')(_0x1365('0x2'));var moment=require(_0x1365('0x3'));var BPromise=require('bluebird');var rp=require(_0x1365('0x4'));var fs=require('fs');var path=require(_0x1365('0x5'));var rimraf=require(_0x1365('0x6'));var config=require(_0x1365('0x7'));var attributes=require('./cmContact.attributes');module['exports']=function(_0x33f05c,_0x53b109){return _0x33f05c['define'](_0x1365('0x8'),attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':_0x1365('0x9'),'fields':[_0x1365('0x9')]},{'name':_0x1365('0xa'),'fields':[_0x1365('0xb'),_0x1365('0xc'),_0x1365('0x9'),_0x1365('0xd'),_0x1365('0xe'),_0x1365('0xf')],'type':_0x1365('0x10')}],'timestamps':!![],'charset':_0x1365('0x11'),'collate':_0x1365('0x12'),'hooks':{'afterCreate':function(_0xc15be7,_0x5e2694,_0x5793e5){var _0x1edb17=_0x33f05c['models'];var _0x60d48e=_0xc15be7[_0x1365('0x13')]({'plain':!![]});function _0x102497(){return function(_0x4ddcba){logger['error'](_0x1365('0x14'),_0x1365('0x15'),util[_0x1365('0x16')](_0x4ddcba,{'showHidden':![],'depth':null}));};}var _0x3d264d=function(_0xe7cd7d){return new BPromise(function(_0x4f745d,_0x2ffd8d){_0x1edb17[_0x1365('0x17')][_0x1365('0x18')]({'where':{'phone':_0x60d48e[_0x1365('0x9')],'VoiceQueueId':_0xe7cd7d['id']}})[_0x1365('0x19')](function(_0x5124fd){if(!_['isNil'](_0x5124fd)){throw new Error(_0x1365('0x1a')+_0x60d48e['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0xe7cd7d['id']);}return _0x1edb17['CmHopper']['create']({'phone':_0x60d48e['phone'],'ContactId':_0x60d48e['id'],'ListId':_0x60d48e[_0x1365('0x1b')],'priority':_0x60d48e[_0x1365('0x1c')]?_0x60d48e['priority']:0x2,'scheduledat':_0x60d48e[_0x1365('0x1d')]?_0x60d48e[_0x1365('0x1d')]:moment()['format'](_0x1365('0x1e')),'callback':_0x60d48e[_0x1365('0x1f')]?!![]:![],'callbackuniqueid':_0x60d48e[_0x1365('0x1f')]?_0x60d48e['callbackUniqueid']:undefined,'callbackat':_0x60d48e['callbackUniqueid']?moment()[_0x1365('0x20')](_0x1365('0x1e')):undefined,'VoiceQueueId':_0xe7cd7d['id']});})[_0x1365('0x21')](function(_0x10f54d){_0x2ffd8d(_0x10f54d);});});};var _0x37c4ba=function(_0x4489d0){return new BPromise(function(_0xd95367,_0x402f1d){_0x1edb17[_0x1365('0x17')]['findOne']({'where':{'phone':_0x60d48e[_0x1365('0x9')],'VoiceQueueId':_0x4489d0['id']}})[_0x1365('0x19')](function(_0x555d7){if(!_[_0x1365('0x22')](_0x555d7)){throw new Error(_0x1365('0x1a')+_0x60d48e['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x4489d0['id']);}return _0x1edb17[_0x1365('0x23')][_0x1365('0x18')]({'where':{'calleridnum':_0x60d48e[_0x1365('0x9')],'VoiceQueueId':_0x4489d0['id']}});})[_0x1365('0x19')](function(_0x42b280){if(!_['isNil'](_0x42b280)){throw new Error(_0x1365('0x24')+_0x60d48e[_0x1365('0x9')]+_0x1365('0x25')+_0x4489d0['id']);}return _0x1edb17[_0x1365('0x17')][_0x1365('0x26')]({'phone':_0x60d48e[_0x1365('0x9')],'ContactId':_0x60d48e['id'],'ListId':_0x60d48e['ListId'],'priority':_0x60d48e[_0x1365('0x1c')]?_0x60d48e[_0x1365('0x1c')]:0x2,'scheduledat':_0x60d48e['scheduledat']?_0x60d48e[_0x1365('0x1d')]:moment()[_0x1365('0x20')](_0x1365('0x1e')),'callback':_0x60d48e[_0x1365('0x1f')]?!![]:![],'callbackuniqueid':_0x60d48e['callbackUniqueid']?_0x60d48e[_0x1365('0x1f')]:undefined,'callbackat':_0x60d48e['callbackUniqueid']?moment()[_0x1365('0x20')](_0x1365('0x1e')):undefined,'VoiceQueueId':_0x4489d0['id']});})[_0x1365('0x21')](function(_0x15313e){_0x402f1d(_0x15313e);});});};function _0x18bc81(){return function(_0x2c487e){logger['error'](_0x1365('0x14'),'afterCreate',util['inspect'](_0x2c487e,{'showHidden':![],'depth':null}));};}var _0x583527=function(_0xff766c){return new BPromise(function(_0x1e58b4,_0x7d360){_0x1edb17[_0x1365('0x17')][_0x1365('0x18')]({'where':{'phone':_0x60d48e['phone'],'CampaignId':_0xff766c['id']}})[_0x1365('0x19')](function(_0x548bdc){if(!_[_0x1365('0x22')](_0x548bdc)){throw new Error('cmContact,\x20afterCreate\x20'+_0x60d48e[_0x1365('0x9')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0xff766c['id']);}return _0x1edb17['CmHopper'][_0x1365('0x26')]({'phone':_0x60d48e[_0x1365('0x9')],'ContactId':_0x60d48e['id'],'ListId':_0x60d48e[_0x1365('0x1b')],'priority':_0x60d48e[_0x1365('0x1c')]?_0x60d48e[_0x1365('0x1c')]:0x2,'scheduledat':_0x60d48e[_0x1365('0x1d')]?_0x60d48e['scheduledat']:moment()[_0x1365('0x20')](_0x1365('0x1e')),'callback':_0x60d48e[_0x1365('0x1f')]?!![]:![],'callbackuniqueid':_0x60d48e[_0x1365('0x1f')]?_0x60d48e['callbackUniqueid']:undefined,'callbackat':_0x60d48e['callbackUniqueid']?moment()[_0x1365('0x20')](_0x1365('0x1e')):undefined,'CampaignId':_0xff766c['id']});})['catch'](function(_0x398a7e){_0x7d360(_0x398a7e);});});};var _0x55011b=function(_0x256e41){return new BPromise(function(_0xfc4d22,_0x6221e4){_0x1edb17[_0x1365('0x17')][_0x1365('0x18')]({'where':{'phone':_0x60d48e[_0x1365('0x9')],'CampaignId':_0x256e41['id']}})[_0x1365('0x19')](function(_0x276d3a){if(!_[_0x1365('0x22')](_0x276d3a)){throw new Error(_0x1365('0x1a')+_0x60d48e[_0x1365('0x9')]+_0x1365('0x27')+_0x256e41['id']);}return _0x1edb17[_0x1365('0x23')][_0x1365('0x18')]({'where':{'calleridnum':_0x60d48e[_0x1365('0x9')],'CampaignId':_0x256e41['id']}});})[_0x1365('0x19')](function(_0xa15178){if(!_[_0x1365('0x22')](_0xa15178)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x60d48e[_0x1365('0x9')]+_0x1365('0x28')+_0x256e41['id']);}return _0x1edb17[_0x1365('0x17')][_0x1365('0x26')]({'phone':_0x60d48e[_0x1365('0x9')],'ContactId':_0x60d48e['id'],'ListId':_0x60d48e['ListId'],'priority':_0x60d48e[_0x1365('0x1c')]?_0x60d48e[_0x1365('0x1c')]:0x2,'scheduledat':_0x60d48e['scheduledat']?_0x60d48e[_0x1365('0x1d')]:moment()[_0x1365('0x20')](_0x1365('0x1e')),'callback':_0x60d48e[_0x1365('0x1f')]?!![]:![],'callbackuniqueid':_0x60d48e['callbackUniqueid']?_0x60d48e['callbackUniqueid']:undefined,'callbackat':_0x60d48e['callbackUniqueid']?moment()[_0x1365('0x20')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x256e41['id']});})[_0x1365('0x21')](function(_0xdb330){_0x6221e4(_0xdb330);});});};if(_0x60d48e['ListId']){_0x1edb17[_0x1365('0x29')]['findAll']({'where':{'type':_0x1365('0x2a')},'attributes':['id',_0x1365('0x2b')],'include':[{'model':_0x1edb17[_0x1365('0x2c')],'as':_0x1365('0x2d'),'where':{'id':_0x60d48e[_0x1365('0x1b')]}}]})['then'](function(_0x294c69){if(_0x294c69){var _0x2f287e=[];for(var _0x451aff=0x0,_0x50f2d0;_0x451aff<_0x294c69[_0x1365('0x2e')];_0x451aff+=0x1){_0x50f2d0=_0x294c69[_0x451aff][_0x1365('0x13')]({'plain':!![]});switch(_0x50f2d0['dialCheckDuplicateType']){case _0x1365('0x2f'):_0x37c4ba(_0x50f2d0)[_0x1365('0x21')](_0x102497());break;case'onlyIfOpen':_0x3d264d(_0x50f2d0)[_0x1365('0x21')](_0x102497());break;default:_0x1edb17[_0x1365('0x17')][_0x1365('0x26')]({'phone':_0x60d48e[_0x1365('0x9')],'ContactId':_0x60d48e['id'],'ListId':_0x60d48e[_0x1365('0x1b')],'scheduledat':_0x60d48e[_0x1365('0x1d')]?_0x60d48e[_0x1365('0x1d')]:moment()[_0x1365('0x20')](_0x1365('0x1e')),'priority':_0x60d48e[_0x1365('0x1c')]?_0x60d48e[_0x1365('0x1c')]:0x2,'callback':_0x60d48e[_0x1365('0x1f')]?!![]:![],'callbackuniqueid':_0x60d48e[_0x1365('0x1f')]?_0x60d48e['callbackUniqueid']:undefined,'callbackat':_0x60d48e[_0x1365('0x1f')]?moment()['format'](_0x1365('0x1e')):undefined,'VoiceQueueId':_0x50f2d0['id']})[_0x1365('0x21')](_0x102497());}}}})[_0x1365('0x19')](function(){return _0x1edb17[_0x1365('0x29')][_0x1365('0x30')]({'where':{'type':_0x1365('0x2a')},'attributes':['id'],'include':[{'model':_0x1edb17[_0x1365('0x2c')],'as':_0x1365('0x31'),'where':{'id':_0x60d48e[_0x1365('0x1b')]}}]})[_0x1365('0x19')](function(_0x5eb2c1){if(_0x5eb2c1){var _0x166e4b=[];for(var _0x1108ad=0x0,_0x4edeb3;_0x1108ad<_0x5eb2c1[_0x1365('0x2e')];_0x1108ad+=0x1){_0x4edeb3=_0x5eb2c1[_0x1108ad]['get']({'plain':!![]});_0x1edb17['CmHopperBlack'][_0x1365('0x26')]({'phone':_0x60d48e[_0x1365('0x9')],'ContactId':_0x60d48e['id'],'ListId':_0x60d48e[_0x1365('0x1b')],'VoiceQueueId':_0x4edeb3['id']})['catch'](function(_0x2b1cc){logger[_0x1365('0x32')](_0x1365('0x33'),'afterCreate',_0x2b1cc['message']);});}}});})['then'](function(){return _0x1edb17[_0x1365('0x34')]['findAll']({'attributes':['id',_0x1365('0x2b')],'include':[{'model':_0x1edb17['CmList'],'as':_0x1365('0x2d'),'where':{'id':_0x60d48e['ListId']}}]})['then'](function(_0x3836b0){if(_0x3836b0){var _0x2a23ad=[];for(var _0x26dbb1=0x0,_0x23ba62;_0x26dbb1<_0x3836b0[_0x1365('0x2e')];_0x26dbb1+=0x1){_0x23ba62=_0x3836b0[_0x26dbb1][_0x1365('0x13')]({'plain':!![]});switch(_0x23ba62[_0x1365('0x2b')]){case'always':_0x55011b(_0x23ba62)[_0x1365('0x21')](_0x18bc81());break;case'onlyIfOpen':_0x583527(_0x23ba62)['catch'](_0x18bc81());break;default:_0x1edb17['CmHopper'][_0x1365('0x26')]({'phone':_0x60d48e[_0x1365('0x9')],'ContactId':_0x60d48e['id'],'ListId':_0x60d48e[_0x1365('0x1b')],'scheduledat':_0x60d48e[_0x1365('0x1d')]?_0x60d48e[_0x1365('0x1d')]:moment()[_0x1365('0x20')](_0x1365('0x1e')),'priority':_0x60d48e[_0x1365('0x1c')]?_0x60d48e[_0x1365('0x1c')]:0x2,'callback':_0x60d48e[_0x1365('0x1f')]?!![]:![],'callbackuniqueid':_0x60d48e[_0x1365('0x1f')]?_0x60d48e[_0x1365('0x1f')]:undefined,'callbackat':_0x60d48e[_0x1365('0x1f')]?moment()[_0x1365('0x20')](_0x1365('0x1e')):undefined,'CampaignId':_0x23ba62['id']})['catch'](_0x18bc81());}}}});})[_0x1365('0x19')](function(){return _0x1edb17['Campaign'][_0x1365('0x30')]({'attributes':['id'],'include':[{'model':_0x1edb17[_0x1365('0x2c')],'as':'BlackLists','where':{'id':_0x60d48e[_0x1365('0x1b')]}}]})['then'](function(_0x183e4f){if(_0x183e4f){var _0x88385f=[];for(var _0x16dbe4=0x0,_0x52d33f;_0x16dbe4<_0x183e4f[_0x1365('0x2e')];_0x16dbe4+=0x1){_0x52d33f=_0x183e4f[_0x16dbe4]['get']({'plain':!![]});_0x1edb17[_0x1365('0x35')][_0x1365('0x26')]({'phone':_0x60d48e['phone'],'ContactId':_0x60d48e['id'],'ListId':_0x60d48e[_0x1365('0x1b')],'CampaignId':_0x52d33f['id']})[_0x1365('0x21')](function(_0x11be3c){logger[_0x1365('0x32')](_0x1365('0x33'),_0x1365('0x15'),_0x11be3c['message']);});}}});})[_0x1365('0x19')](function(){_0x5793e5();})['catch'](function(_0x5ebf61){logger[_0x1365('0x32')](_0x1365('0x33'),'afterCreate',_0x5ebf61[_0x1365('0x36')]);_0x5793e5(_0x5ebf61);});}else{_0x5793e5(new Error(_0x1365('0x37')));}},'afterDestroy':function(_0x16ff9b,_0x1f2074,_0x3caa00){var _0x5aae1b=_0x33f05c[_0x1365('0x38')];var _0x65e4db=_0x16ff9b[_0x1365('0x13')]({'plain':!![]});return _0x5aae1b[_0x1365('0x17')][_0x1365('0x30')]({'raw':!![],'where':{'ListId':_0x65e4db['ListId'],'ContactId':_0x65e4db['id']}})[_0x1365('0x19')](function(_0x2df9a2){if(!_[_0x1365('0x39')](_0x2df9a2)){var _0x1219a0=[];for(var _0x5d8963=0x0;_0x5d8963<_0x2df9a2[_0x1365('0x2e')];_0x5d8963+=0x1){var _0x26a596=_0x5aae1b['CmHopper'][_0x1365('0x3a')]({'where':{'ListId':_0x2df9a2[_0x5d8963]['ListId'],'ContactId':_0x2df9a2[_0x5d8963][_0x1365('0x3b')],'VoiceQueueId':_0x2df9a2[_0x5d8963][_0x1365('0x3c')],'CampaignId':_0x2df9a2[_0x5d8963][_0x1365('0x3d')]}});_0x1219a0[_0x1365('0x3e')](_0x26a596);}return BPromise[_0x1365('0x3f')](_0x1219a0);}})[_0x1365('0x19')](function(_0x318e2f){logger['info']('[CmContact][afterDestroy][Succesfull]',util['inspect'](_0x318e2f,{'showHidden':![],'depth':null}));_0x3caa00();})['catch'](function(_0x306849){logger['error'](_0x1365('0x40'),util[_0x1365('0x16')](_0x306849,{'showHidden':![],'depth':null}));_0x3caa00(_0x306849);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index bae4758..6bf89d8 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x11d4=['options','raw','attributes','limit','include','map','model','stringify','catch','CreateCmContact','create','body','then','keys','length','table','set','where','id\x20=\x20?','toString','sequelize','query','util','moment','bluebird','ioredis','squel','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','request','info','CmContact,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','GetCmContact','CmContact','findAll'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x11d4,0x196));var _0x411d=function(_0xbb98ce,_0x273f4e){_0xbb98ce=_0xbb98ce-0x0;var _0xf953e4=_0x11d4[_0xbb98ce];return _0xf953e4;};'use strict';var _=require('lodash');var util=require(_0x411d('0x0'));var moment=require(_0x411d('0x1'));var BPromise=require(_0x411d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x411d('0x3'));var squel=require(_0x411d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x411d('0x5'));var config=require(_0x411d('0x6'));var jayson=require(_0x411d('0x7'));var client=jayson['client'][_0x411d('0x8')]({'port':0x232a});config[_0x411d('0x9')]=_[_0x411d('0xa')](config[_0x411d('0x9')],{'host':_0x411d('0xb'),'port':0x18eb});var socket=require(_0x411d('0xc'))(new Redis(config[_0x411d('0x9')]));require(_0x411d('0xd'))['register'](socket);function respondWithRpcPromise(_0x37a427,_0x181239,_0x4342a1){return new BPromise(function(_0x26ee40,_0x53c33c){return client[_0x411d('0xe')](_0x37a427,_0x4342a1)['then'](function(_0x5158bf){logger[_0x411d('0xf')](_0x411d('0x10'),_0x181239,'request\x20sent');logger[_0x411d('0x11')]('CmContact,\x20%s,\x20%s,\x20%s',_0x181239,_0x411d('0x12'),JSON['stringify'](_0x5158bf));if(_0x5158bf[_0x411d('0x13')]){if(_0x5158bf['error'][_0x411d('0x14')]===0x1f4){logger[_0x411d('0x13')]('CmContact,\x20%s,\x20%s',_0x181239,_0x5158bf['error'][_0x411d('0x15')]);return _0x53c33c(_0x5158bf[_0x411d('0x13')][_0x411d('0x15')]);}logger['error'](_0x411d('0x10'),_0x181239,_0x5158bf['error'][_0x411d('0x15')]);return _0x26ee40(_0x5158bf['error'][_0x411d('0x15')]);}else{logger[_0x411d('0xf')]('CmContact,\x20%s,\x20%s',_0x181239,_0x411d('0x12'));_0x26ee40(_0x5158bf[_0x411d('0x16')]['message']);}})['catch'](function(_0x183ffb){logger['error']('CmContact,\x20%s,\x20%s',_0x181239,_0x183ffb);_0x53c33c(_0x183ffb);});});}exports[_0x411d('0x17')]=function(_0xb39a68){var _0x409911=this;return new Promise(function(_0x4a77dd,_0x58cc58){return db[_0x411d('0x18')][_0x411d('0x19')]({'raw':_0xb39a68['options']?_0xb39a68[_0x411d('0x1a')][_0x411d('0x1b')]===undefined?!![]:![]:!![],'where':_0xb39a68[_0x411d('0x1a')]?_0xb39a68[_0x411d('0x1a')]['where']||null:null,'attributes':_0xb39a68[_0x411d('0x1a')]?_0xb39a68['options'][_0x411d('0x1c')]||null:null,'limit':_0xb39a68[_0x411d('0x1a')]?_0xb39a68[_0x411d('0x1a')][_0x411d('0x1d')]||null:null,'include':_0xb39a68[_0x411d('0x1a')]?_0xb39a68[_0x411d('0x1a')][_0x411d('0x1e')]?_[_0x411d('0x1f')](_0xb39a68[_0x411d('0x1a')]['include'],function(_0x87002e){return{'model':db[_0x87002e[_0x411d('0x20')]],'as':_0x87002e['as'],'attributes':_0x87002e[_0x411d('0x1c')],'include':_0x87002e['include']?_[_0x411d('0x1f')](_0x87002e[_0x411d('0x1e')],function(_0x5270b4){return{'model':db[_0x5270b4[_0x411d('0x20')]],'as':_0x5270b4['as'],'attributes':_0x5270b4[_0x411d('0x1c')],'include':_0x5270b4['include']?_[_0x411d('0x1f')](_0x5270b4[_0x411d('0x1e')],function(_0x48ef3f){return{'model':db[_0x48ef3f[_0x411d('0x20')]],'as':_0x48ef3f['as'],'attributes':_0x48ef3f[_0x411d('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b0f59){logger[_0x411d('0xf')]('GetCmContact',_0xb39a68);logger[_0x411d('0x11')](_0x411d('0x17'),_0xb39a68,JSON[_0x411d('0x21')](_0x3b0f59));_0x4a77dd(_0x3b0f59);})[_0x411d('0x22')](function(_0x52e121){logger[_0x411d('0x13')](_0x411d('0x17'),_0x52e121[_0x411d('0x15')],_0xb39a68);_0x58cc58(_0x409911[_0x411d('0x13')](0x1f4,_0x52e121[_0x411d('0x15')]));});});};exports[_0x411d('0x23')]=function(_0x390d62){var _0x417c64=this;return new Promise(function(_0x36e16f,_0x2b2f66){return db[_0x411d('0x18')][_0x411d('0x24')](_0x390d62[_0x411d('0x25')],{'raw':_0x390d62[_0x411d('0x1a')]?_0x390d62['options'][_0x411d('0x1b')]===undefined?!![]:![]:!![]})[_0x411d('0x26')](function(_0x51b257){var _0x489e62;for(var _0x539f89=0x0;_0x539f89{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x334bcf,_0x52f4f0){var _0x4f93ba=function(_0x495ecb){while(--_0x495ecb){_0x334bcf['push'](_0x334bcf['shift']());}};_0x4f93ba(++_0x52f4f0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index b11ad22..9191236 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa74d=['INTEGER','STRING','PHONE','exports'];(function(_0xfe3407,_0x2d93f9){var _0x2a86ba=function(_0x557e9e){while(--_0x557e9e){_0xfe3407['push'](_0xfe3407['shift']());}};_0x2a86ba(++_0x2d93f9);}(_0xa74d,0x1cf));var _0xda74=function(_0x4fef08,_0x4c98c7){_0x4fef08=_0x4fef08-0x0;var _0x1bde5d=_0xa74d[_0x4fef08];return _0x1bde5d;};'use strict';var Sequelize=require('sequelize');module[_0xda74('0x0')]={'CmContactId':{'type':Sequelize[_0xda74('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0xda74('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xda74('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xda74('0x2')],'defaultValue':_0xda74('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize[_0xda74('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0x2060=['INTEGER','STRING','sequelize'];(function(_0x2d6e06,_0x303edc){var _0x35d67f=function(_0x1f03ce){while(--_0x1f03ce){_0x2d6e06['push'](_0x2d6e06['shift']());}};_0x35d67f(++_0x303edc);}(_0x2060,0x1be));var _0x0206=function(_0x1d2c82,_0x1df200){_0x1d2c82=_0x1d2c82-0x0;var _0x596edb=_0x2060[_0x1d2c82];return _0x596edb;};'use strict';var Sequelize=require(_0x0206('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0x0206('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0x0206('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x0206('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x0206('0x2')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x0206('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0x0206('0x2')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 2191dce..e2fd30d 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5bf8=['reject','save','then','destroy','CmContactHasItems','UserProfileResource','name','send','index','map','rawAttributes','type','key','model','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','CmContactHasItem','includeAll','include','findAll','rows','catch','params','keys','length','find','create','body','user','role','UserProfileSection','userProfileId','error','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x7ad6cb,_0xffee6c){var _0x22a0ba=function(_0x47f291){while(--_0x47f291){_0x7ad6cb['push'](_0x7ad6cb['shift']());}};_0x22a0ba(++_0xffee6c);}(_0x5bf8,0xce));var _0x85bf=function(_0x9b5bb2,_0x5db315){_0x9b5bb2=_0x9b5bb2-0x0;var _0x2e1e92=_0x5bf8[_0x9b5bb2];return _0x2e1e92;};'use strict';var emlformat=require(_0x85bf('0x0'));var rimraf=require(_0x85bf('0x1'));var zipdir=require(_0x85bf('0x2'));var jsonpatch=require(_0x85bf('0x3'));var rp=require(_0x85bf('0x4'));var moment=require(_0x85bf('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x85bf('0x6'));var util=require(_0x85bf('0x7'));var path=require(_0x85bf('0x8'));var sox=require(_0x85bf('0x9'));var csv=require(_0x85bf('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x85bf('0xb'));var _=require(_0x85bf('0xc'));var squel=require('squel');var crypto=require(_0x85bf('0xd'));var jsforce=require(_0x85bf('0xe'));var deskjs=require(_0x85bf('0xf'));var toCsv=require(_0x85bf('0xa'));var querystring=require(_0x85bf('0x10'));var Papa=require('papaparse');var Redis=require(_0x85bf('0x11'));var authService=require(_0x85bf('0x12'));var qs=require(_0x85bf('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x85bf('0x14'))('api');var utils=require(_0x85bf('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x85bf('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54b5e3,_0x5266f7){_0x5266f7=_0x5266f7||0xcc;return function(_0x1b667e){if(_0x1b667e){return _0x54b5e3[_0x85bf('0x17')](_0x5266f7);}return _0x54b5e3[_0x85bf('0x18')](_0x5266f7)[_0x85bf('0x19')]();};}function respondWithResult(_0xbdc583,_0x23a098){_0x23a098=_0x23a098||0xc8;return function(_0x5a57fe){if(_0x5a57fe){return _0xbdc583[_0x85bf('0x18')](_0x23a098)[_0x85bf('0x1a')](_0x5a57fe);}};}function respondWithFilteredResult(_0x1b7cda,_0x1a808e){return function(_0x4156fa){if(_0x4156fa){var _0x38c6d2=typeof _0x1a808e[_0x85bf('0x1b')]===_0x85bf('0x1c')&&typeof _0x1a808e[_0x85bf('0x1d')]===_0x85bf('0x1c');var _0x53a2eb=_0x4156fa[_0x85bf('0x1e')];var _0x239554=_0x38c6d2?0x0:_0x1a808e['offset'];var _0x3ce9a1=_0x38c6d2?_0x4156fa[_0x85bf('0x1e')]:_0x1a808e['offset']+_0x1a808e['limit'];var _0x2a6ba3;if(_0x3ce9a1>=_0x53a2eb){_0x3ce9a1=_0x53a2eb;_0x2a6ba3=0xc8;}else{_0x2a6ba3=0xce;}_0x1b7cda['status'](_0x2a6ba3);return _0x1b7cda[_0x85bf('0x1f')](_0x85bf('0x20'),_0x239554+'-'+_0x3ce9a1+'/'+_0x53a2eb)[_0x85bf('0x1a')](_0x4156fa);}return null;};}function patchUpdates(_0x1bc94c){return function(_0x36c87b){try{jsonpatch[_0x85bf('0x21')](_0x36c87b,_0x1bc94c,!![]);}catch(_0x34442b){return BPromise[_0x85bf('0x22')](_0x34442b);}return _0x36c87b[_0x85bf('0x23')]();};}function saveUpdates(_0x125993,_0x56ea9c){return function(_0x101236){if(_0x101236){return _0x101236['update'](_0x125993)[_0x85bf('0x24')](function(_0x5b8543){return _0x5b8543;});}return null;};}function removeEntity(_0x5ae027,_0x13678f){return function(_0x13c8c2){if(_0x13c8c2){return _0x13c8c2[_0x85bf('0x25')]()[_0x85bf('0x24')](function(){var _0x2adb8f=_0x13c8c2['get']({'plain':!![]});var _0x189709=_0x85bf('0x26');return db[_0x85bf('0x27')][_0x85bf('0x25')]({'where':{'type':_0x189709,'resourceId':_0x2adb8f['id']}})[_0x85bf('0x24')](function(){return _0x13c8c2;});})[_0x85bf('0x24')](function(){_0x5ae027[_0x85bf('0x18')](0xcc)[_0x85bf('0x19')]();});}};}function handleEntityNotFound(_0x4c2ad5,_0x19ee50){return function(_0x16b946){if(!_0x16b946){_0x4c2ad5['sendStatus'](0x194);}return _0x16b946;};}function handleError(_0xae3877,_0x2ea63b){_0x2ea63b=_0x2ea63b||0x1f4;return function(_0x3abbf8){logger['error'](_0x3abbf8['stack']);if(_0x3abbf8[_0x85bf('0x28')]){delete _0x3abbf8[_0x85bf('0x28')];}_0xae3877[_0x85bf('0x18')](_0x2ea63b)[_0x85bf('0x29')](_0x3abbf8);};}exports[_0x85bf('0x2a')]=function(_0x526d51,_0x524cb7){var _0xdb52f4={},_0x18b007={},_0x21e5be={'count':0x0,'rows':[]};var _0x45235e=_[_0x85bf('0x2b')](db['CmContactHasItem'][_0x85bf('0x2c')],function(_0x2c1c59){return{'name':_0x2c1c59['fieldName'],'type':_0x2c1c59[_0x85bf('0x2d')][_0x85bf('0x2e')]};});_0x18b007[_0x85bf('0x2f')]=_[_0x85bf('0x2b')](_0x45235e,_0x85bf('0x28'));_0x18b007['query']=_['keys'](_0x526d51['query']);_0x18b007[_0x85bf('0x30')]=_[_0x85bf('0x31')](_0x18b007[_0x85bf('0x2f')],_0x18b007[_0x85bf('0x32')]);_0xdb52f4[_0x85bf('0x33')]=_[_0x85bf('0x31')](_0x18b007[_0x85bf('0x2f')],qs[_0x85bf('0x34')](_0x526d51[_0x85bf('0x32')][_0x85bf('0x34')]));_0xdb52f4[_0x85bf('0x33')]=_0xdb52f4[_0x85bf('0x33')]['length']?_0xdb52f4[_0x85bf('0x33')]:_0x18b007['model'];if(!_0x526d51['query'][_0x85bf('0x35')](_0x85bf('0x36'))){_0xdb52f4['limit']=qs[_0x85bf('0x1d')](_0x526d51['query'][_0x85bf('0x1d')]);_0xdb52f4[_0x85bf('0x1b')]=qs[_0x85bf('0x1b')](_0x526d51[_0x85bf('0x32')][_0x85bf('0x1b')]);}_0xdb52f4[_0x85bf('0x37')]=qs[_0x85bf('0x38')](_0x526d51[_0x85bf('0x32')][_0x85bf('0x38')]);_0xdb52f4[_0x85bf('0x39')]=qs[_0x85bf('0x30')](_['pick'](_0x526d51['query'],_0x18b007[_0x85bf('0x30')]),_0x45235e);if(_0x526d51[_0x85bf('0x32')]['filter']){_0xdb52f4['where']=_[_0x85bf('0x3a')](_0xdb52f4[_0x85bf('0x39')],{'$or':_[_0x85bf('0x2b')](_0x45235e,function(_0x302709){if(_0x302709[_0x85bf('0x2d')]!==_0x85bf('0x3b')){var _0x4c8ae3={};_0x4c8ae3[_0x302709[_0x85bf('0x28')]]={'$like':'%'+_0x526d51[_0x85bf('0x32')][_0x85bf('0x3c')]+'%'};return _0x4c8ae3;}})});}_0xdb52f4=_[_0x85bf('0x3a')]({},_0xdb52f4,_0x526d51[_0x85bf('0x3d')]);var _0x1b0990={'where':_0xdb52f4['where']};return db[_0x85bf('0x3e')][_0x85bf('0x1e')](_0x1b0990)[_0x85bf('0x24')](function(_0x7fe0c6){_0x21e5be[_0x85bf('0x1e')]=_0x7fe0c6;if(_0x526d51['query'][_0x85bf('0x3f')]){_0xdb52f4[_0x85bf('0x40')]=[{'all':!![]}];}return db['CmContactHasItem'][_0x85bf('0x41')](_0xdb52f4);})[_0x85bf('0x24')](function(_0x5aaa7c){_0x21e5be[_0x85bf('0x42')]=_0x5aaa7c;return _0x21e5be;})[_0x85bf('0x24')](respondWithFilteredResult(_0x524cb7,_0xdb52f4))[_0x85bf('0x43')](handleError(_0x524cb7,null));};exports['show']=function(_0x13a859,_0x1d654a){var _0x604778={'raw':!![],'where':{'id':_0x13a859[_0x85bf('0x44')]['id']}},_0xfe6166={};_0xfe6166[_0x85bf('0x2f')]=_[_0x85bf('0x45')](db['CmContactHasItem']['rawAttributes']);_0xfe6166['query']=_[_0x85bf('0x45')](_0x13a859[_0x85bf('0x32')]);_0xfe6166['filters']=_[_0x85bf('0x31')](_0xfe6166[_0x85bf('0x2f')],_0xfe6166['query']);_0x604778['attributes']=_['intersection'](_0xfe6166[_0x85bf('0x2f')],qs[_0x85bf('0x34')](_0x13a859[_0x85bf('0x32')][_0x85bf('0x34')]));_0x604778[_0x85bf('0x33')]=_0x604778[_0x85bf('0x33')][_0x85bf('0x46')]?_0x604778[_0x85bf('0x33')]:_0xfe6166[_0x85bf('0x2f')];if(_0x13a859[_0x85bf('0x32')][_0x85bf('0x3f')]){_0x604778['include']=[{'all':!![]}];}_0x604778=_['merge']({},_0x604778,_0x13a859[_0x85bf('0x3d')]);return db[_0x85bf('0x3e')][_0x85bf('0x47')](_0x604778)[_0x85bf('0x24')](handleEntityNotFound(_0x1d654a,null))[_0x85bf('0x24')](respondWithResult(_0x1d654a,null))[_0x85bf('0x43')](handleError(_0x1d654a,null));};exports[_0x85bf('0x48')]=function(_0x5d1d37,_0x520f29){return db['CmContactHasItem'][_0x85bf('0x48')](_0x5d1d37[_0x85bf('0x49')],{})[_0x85bf('0x24')](function(_0x199a42){var _0x5bd7c8=_0x5d1d37[_0x85bf('0x4a')]['get']({'plain':!![]});if(!_0x5bd7c8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5bd7c8[_0x85bf('0x4b')]===_0x85bf('0x4a')){var _0x529f57=_0x199a42['get']({'plain':!![]});var _0x50eccd='CmContactHasItems';return db[_0x85bf('0x4c')][_0x85bf('0x47')]({'where':{'name':_0x50eccd,'userProfileId':_0x5bd7c8[_0x85bf('0x4d')]},'raw':!![]})[_0x85bf('0x24')](function(_0x2b7974){if(_0x2b7974&&_0x2b7974['autoAssociation']===0x0){return db[_0x85bf('0x27')]['create']({'name':_0x529f57[_0x85bf('0x28')],'resourceId':_0x529f57['id'],'type':_0x2b7974[_0x85bf('0x28')],'sectionId':_0x2b7974['id']},{})[_0x85bf('0x24')](function(){return _0x199a42;});}else{return _0x199a42;}})['catch'](function(_0x570590){logger[_0x85bf('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x570590);throw _0x570590;});}return _0x199a42;})[_0x85bf('0x24')](respondWithResult(_0x520f29,0xc9))['catch'](handleError(_0x520f29,null));};exports[_0x85bf('0x4f')]=function(_0x1bae5e,_0x464543){if(_0x1bae5e[_0x85bf('0x49')]['id']){delete _0x1bae5e[_0x85bf('0x49')]['id'];}return db[_0x85bf('0x3e')][_0x85bf('0x47')]({'where':{'id':_0x1bae5e[_0x85bf('0x44')]['id']}})[_0x85bf('0x24')](handleEntityNotFound(_0x464543,null))['then'](saveUpdates(_0x1bae5e[_0x85bf('0x49')],null))[_0x85bf('0x24')](respondWithResult(_0x464543,null))[_0x85bf('0x43')](handleError(_0x464543,null));};exports[_0x85bf('0x25')]=function(_0x333fb2,_0x3b3bb4){return db[_0x85bf('0x3e')][_0x85bf('0x47')]({'where':{'id':_0x333fb2[_0x85bf('0x44')]['id']}})['then'](handleEntityNotFound(_0x3b3bb4,null))[_0x85bf('0x24')](removeEntity(_0x3b3bb4,null))[_0x85bf('0x43')](handleError(_0x3b3bb4,null));}; \ No newline at end of file +var _0x5f54=['sox','to-csv','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','set','apply','reject','save','then','destroy','UserProfileResource','error','stack','name','send','index','CmContactHasItem','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','filter','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','create','body','user','get','CmContactHasItems','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path'];(function(_0xc46d6f,_0x4cab50){var _0x3cd65c=function(_0x2710c6){while(--_0x2710c6){_0xc46d6f['push'](_0xc46d6f['shift']());}};_0x3cd65c(++_0x4cab50);}(_0x5f54,0xe5));var _0x45f5=function(_0x4a8a18,_0x556b72){_0x4a8a18=_0x4a8a18-0x0;var _0x3f8316=_0x5f54[_0x4a8a18];return _0x3f8316;};'use strict';var emlformat=require(_0x45f5('0x0'));var rimraf=require(_0x45f5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x45f5('0x2'));var rp=require(_0x45f5('0x3'));var moment=require(_0x45f5('0x4'));var BPromise=require(_0x45f5('0x5'));var Mustache=require('mustache');var util=require(_0x45f5('0x6'));var path=require(_0x45f5('0x7'));var sox=require(_0x45f5('0x8'));var csv=require(_0x45f5('0x9'));var ejs=require(_0x45f5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x45f5('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x45f5('0xc'));var toCsv=require(_0x45f5('0x9'));var querystring=require(_0x45f5('0xd'));var Papa=require(_0x45f5('0xe'));var Redis=require(_0x45f5('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x45f5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x45f5('0x11'));var logger=require(_0x45f5('0x12'))(_0x45f5('0x13'));var utils=require(_0x45f5('0x14'));var config=require(_0x45f5('0x15'));var licenseUtil=require(_0x45f5('0x16'));var db=require(_0x45f5('0x17'))['db'];function respondWithStatusCode(_0x3520b4,_0x52ff9b){_0x52ff9b=_0x52ff9b||0xcc;return function(_0x1a085f){if(_0x1a085f){return _0x3520b4[_0x45f5('0x18')](_0x52ff9b);}return _0x3520b4['status'](_0x52ff9b)[_0x45f5('0x19')]();};}function respondWithResult(_0x4f2ab4,_0xd52b76){_0xd52b76=_0xd52b76||0xc8;return function(_0x1caced){if(_0x1caced){return _0x4f2ab4['status'](_0xd52b76)['json'](_0x1caced);}};}function respondWithFilteredResult(_0x356def,_0x573b16){return function(_0x177a61){if(_0x177a61){var _0x41a3aa=typeof _0x573b16[_0x45f5('0x1a')]===_0x45f5('0x1b')&&typeof _0x573b16[_0x45f5('0x1c')]===_0x45f5('0x1b');var _0x1c7bfa=_0x177a61[_0x45f5('0x1d')];var _0x2a18a1=_0x41a3aa?0x0:_0x573b16['offset'];var _0x35231b=_0x41a3aa?_0x177a61['count']:_0x573b16['offset']+_0x573b16['limit'];var _0xbd8286;if(_0x35231b>=_0x1c7bfa){_0x35231b=_0x1c7bfa;_0xbd8286=0xc8;}else{_0xbd8286=0xce;}_0x356def[_0x45f5('0x1e')](_0xbd8286);return _0x356def[_0x45f5('0x1f')]('Content-Range',_0x2a18a1+'-'+_0x35231b+'/'+_0x1c7bfa)['json'](_0x177a61);}return null;};}function patchUpdates(_0xa70579){return function(_0x1eda45){try{jsonpatch[_0x45f5('0x20')](_0x1eda45,_0xa70579,!![]);}catch(_0x13a498){return BPromise[_0x45f5('0x21')](_0x13a498);}return _0x1eda45[_0x45f5('0x22')]();};}function saveUpdates(_0x20702a,_0x43d15d){return function(_0x3bc93a){if(_0x3bc93a){return _0x3bc93a['update'](_0x20702a)[_0x45f5('0x23')](function(_0x471d70){return _0x471d70;});}return null;};}function removeEntity(_0x1b163b,_0x33d1c2){return function(_0x393ba2){if(_0x393ba2){return _0x393ba2[_0x45f5('0x24')]()[_0x45f5('0x23')](function(){var _0x506738=_0x393ba2['get']({'plain':!![]});var _0x15da89='CmContactHasItems';return db[_0x45f5('0x25')]['destroy']({'where':{'type':_0x15da89,'resourceId':_0x506738['id']}})['then'](function(){return _0x393ba2;});})[_0x45f5('0x23')](function(){_0x1b163b[_0x45f5('0x1e')](0xcc)[_0x45f5('0x19')]();});}};}function handleEntityNotFound(_0x195c7a,_0x529fc0){return function(_0x1bdbef){if(!_0x1bdbef){_0x195c7a[_0x45f5('0x18')](0x194);}return _0x1bdbef;};}function handleError(_0x46d4f1,_0x21d0ca){_0x21d0ca=_0x21d0ca||0x1f4;return function(_0x4febb7){logger[_0x45f5('0x26')](_0x4febb7[_0x45f5('0x27')]);if(_0x4febb7[_0x45f5('0x28')]){delete _0x4febb7[_0x45f5('0x28')];}_0x46d4f1['status'](_0x21d0ca)[_0x45f5('0x29')](_0x4febb7);};}exports[_0x45f5('0x2a')]=function(_0x53d7fb,_0x1009b9){var _0x396f7a={},_0x5e361d={},_0x31e8ee={'count':0x0,'rows':[]};var _0x4476a4=_['map'](db[_0x45f5('0x2b')]['rawAttributes'],function(_0x5ba66d){return{'name':_0x5ba66d[_0x45f5('0x2c')],'type':_0x5ba66d[_0x45f5('0x2d')]['key']};});_0x5e361d['model']=_[_0x45f5('0x2e')](_0x4476a4,_0x45f5('0x28'));_0x5e361d[_0x45f5('0x2f')]=_[_0x45f5('0x30')](_0x53d7fb[_0x45f5('0x2f')]);_0x5e361d[_0x45f5('0x31')]=_[_0x45f5('0x32')](_0x5e361d[_0x45f5('0x33')],_0x5e361d[_0x45f5('0x2f')]);_0x396f7a[_0x45f5('0x34')]=_['intersection'](_0x5e361d[_0x45f5('0x33')],qs[_0x45f5('0x35')](_0x53d7fb['query']['fields']));_0x396f7a[_0x45f5('0x34')]=_0x396f7a[_0x45f5('0x34')][_0x45f5('0x36')]?_0x396f7a[_0x45f5('0x34')]:_0x5e361d[_0x45f5('0x33')];if(!_0x53d7fb[_0x45f5('0x2f')]['hasOwnProperty'](_0x45f5('0x37'))){_0x396f7a['limit']=qs[_0x45f5('0x1c')](_0x53d7fb[_0x45f5('0x2f')][_0x45f5('0x1c')]);_0x396f7a[_0x45f5('0x1a')]=qs[_0x45f5('0x1a')](_0x53d7fb[_0x45f5('0x2f')]['offset']);}_0x396f7a['order']=qs[_0x45f5('0x38')](_0x53d7fb[_0x45f5('0x2f')][_0x45f5('0x38')]);_0x396f7a[_0x45f5('0x39')]=qs[_0x45f5('0x31')](_['pick'](_0x53d7fb[_0x45f5('0x2f')],_0x5e361d[_0x45f5('0x31')]),_0x4476a4);if(_0x53d7fb[_0x45f5('0x2f')][_0x45f5('0x3a')]){_0x396f7a['where']=_[_0x45f5('0x3b')](_0x396f7a[_0x45f5('0x39')],{'$or':_[_0x45f5('0x2e')](_0x4476a4,function(_0x2732ef){if(_0x2732ef[_0x45f5('0x2d')]!=='VIRTUAL'){var _0x2eb6c1={};_0x2eb6c1[_0x2732ef['name']]={'$like':'%'+_0x53d7fb[_0x45f5('0x2f')][_0x45f5('0x3a')]+'%'};return _0x2eb6c1;}})});}_0x396f7a=_['merge']({},_0x396f7a,_0x53d7fb[_0x45f5('0x3c')]);var _0x430b5f={'where':_0x396f7a['where']};return db['CmContactHasItem'][_0x45f5('0x1d')](_0x430b5f)[_0x45f5('0x23')](function(_0x45ed43){_0x31e8ee[_0x45f5('0x1d')]=_0x45ed43;if(_0x53d7fb[_0x45f5('0x2f')][_0x45f5('0x3d')]){_0x396f7a['include']=[{'all':!![]}];}return db['CmContactHasItem'][_0x45f5('0x3e')](_0x396f7a);})['then'](function(_0x5e09f4){_0x31e8ee[_0x45f5('0x3f')]=_0x5e09f4;return _0x31e8ee;})[_0x45f5('0x23')](respondWithFilteredResult(_0x1009b9,_0x396f7a))[_0x45f5('0x40')](handleError(_0x1009b9,null));};exports[_0x45f5('0x41')]=function(_0x37ba10,_0x43fdf1){var _0x3a6bfc={'raw':!![],'where':{'id':_0x37ba10[_0x45f5('0x42')]['id']}},_0xaf176e={};_0xaf176e[_0x45f5('0x33')]=_[_0x45f5('0x30')](db[_0x45f5('0x2b')][_0x45f5('0x43')]);_0xaf176e[_0x45f5('0x2f')]=_[_0x45f5('0x30')](_0x37ba10[_0x45f5('0x2f')]);_0xaf176e[_0x45f5('0x31')]=_['intersection'](_0xaf176e['model'],_0xaf176e[_0x45f5('0x2f')]);_0x3a6bfc[_0x45f5('0x34')]=_[_0x45f5('0x32')](_0xaf176e[_0x45f5('0x33')],qs[_0x45f5('0x35')](_0x37ba10['query'][_0x45f5('0x35')]));_0x3a6bfc[_0x45f5('0x34')]=_0x3a6bfc[_0x45f5('0x34')][_0x45f5('0x36')]?_0x3a6bfc[_0x45f5('0x34')]:_0xaf176e[_0x45f5('0x33')];if(_0x37ba10[_0x45f5('0x2f')][_0x45f5('0x3d')]){_0x3a6bfc[_0x45f5('0x44')]=[{'all':!![]}];}_0x3a6bfc=_[_0x45f5('0x3b')]({},_0x3a6bfc,_0x37ba10['options']);return db[_0x45f5('0x2b')]['find'](_0x3a6bfc)[_0x45f5('0x23')](handleEntityNotFound(_0x43fdf1,null))[_0x45f5('0x23')](respondWithResult(_0x43fdf1,null))['catch'](handleError(_0x43fdf1,null));};exports[_0x45f5('0x45')]=function(_0x21557d,_0x447a8f){return db['CmContactHasItem'][_0x45f5('0x45')](_0x21557d[_0x45f5('0x46')],{})[_0x45f5('0x23')](function(_0x154a67){var _0x3dd9b4=_0x21557d[_0x45f5('0x47')][_0x45f5('0x48')]({'plain':!![]});if(!_0x3dd9b4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3dd9b4['role']==='user'){var _0x361abe=_0x154a67[_0x45f5('0x48')]({'plain':!![]});var _0x44c64e=_0x45f5('0x49');return db[_0x45f5('0x4a')][_0x45f5('0x4b')]({'where':{'name':_0x44c64e,'userProfileId':_0x3dd9b4['userProfileId']},'raw':!![]})['then'](function(_0x240abe){if(_0x240abe&&_0x240abe[_0x45f5('0x4c')]===0x0){return db[_0x45f5('0x25')][_0x45f5('0x45')]({'name':_0x361abe[_0x45f5('0x28')],'resourceId':_0x361abe['id'],'type':_0x240abe[_0x45f5('0x28')],'sectionId':_0x240abe['id']},{})['then'](function(){return _0x154a67;});}else{return _0x154a67;}})['catch'](function(_0x1b3bd1){logger[_0x45f5('0x26')](_0x45f5('0x4d'),_0x1b3bd1);throw _0x1b3bd1;});}return _0x154a67;})['then'](respondWithResult(_0x447a8f,0xc9))[_0x45f5('0x40')](handleError(_0x447a8f,null));};exports[_0x45f5('0x4e')]=function(_0x3a0371,_0x19b797){if(_0x3a0371[_0x45f5('0x46')]['id']){delete _0x3a0371['body']['id'];}return db[_0x45f5('0x2b')]['find']({'where':{'id':_0x3a0371[_0x45f5('0x42')]['id']}})[_0x45f5('0x23')](handleEntityNotFound(_0x19b797,null))[_0x45f5('0x23')](saveUpdates(_0x3a0371[_0x45f5('0x46')],null))[_0x45f5('0x23')](respondWithResult(_0x19b797,null))['catch'](handleError(_0x19b797,null));};exports[_0x45f5('0x24')]=function(_0xd03ecb,_0x230920){return db[_0x45f5('0x2b')][_0x45f5('0x4b')]({'where':{'id':_0xd03ecb[_0x45f5('0x42')]['id']}})[_0x45f5('0x23')](handleEntityNotFound(_0x230920,null))[_0x45f5('0x23')](removeEntity(_0x230920,null))[_0x45f5('0x40')](handleError(_0x230920,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 550f653..e2f5341 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x248e=['path','rimraf','./cmContactHasItem.attributes','define','cm_contact_has_items','util','../../config/logger','api','moment','request-promise'];(function(_0x39f59e,_0x36b9cf){var _0x54f7a5=function(_0x342855){while(--_0x342855){_0x39f59e['push'](_0x39f59e['shift']());}};_0x54f7a5(++_0x36b9cf);}(_0x248e,0xc3));var _0xe248=function(_0x13d85b,_0x16a963){_0x13d85b=_0x13d85b-0x0;var _0x56e679=_0x248e[_0x13d85b];return _0x56e679;};'use strict';var _=require('lodash');var util=require(_0xe248('0x0'));var logger=require(_0xe248('0x1'))(_0xe248('0x2'));var moment=require(_0xe248('0x3'));var BPromise=require('bluebird');var rp=require(_0xe248('0x4'));var fs=require('fs');var path=require(_0xe248('0x5'));var rimraf=require(_0xe248('0x6'));var config=require('../../config/environment');var attributes=require(_0xe248('0x7'));module['exports']=function(_0xbd8ae7,_0x36b0df){return _0xbd8ae7[_0xe248('0x8')]('CmContactHasItem',attributes,{'tableName':_0xe248('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xae39=['rimraf','../../config/environment','exports','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1eaf9a,_0x4a10c3){var _0x1fbedb=function(_0x261b11){while(--_0x261b11){_0x1eaf9a['push'](_0x1eaf9a['shift']());}};_0x1fbedb(++_0x4a10c3);}(_0xae39,0x7a));var _0x9ae3=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0xae39[_0x334841];return _0x5beb4b;};'use strict';var _=require(_0x9ae3('0x0'));var util=require(_0x9ae3('0x1'));var logger=require(_0x9ae3('0x2'))(_0x9ae3('0x3'));var moment=require(_0x9ae3('0x4'));var BPromise=require(_0x9ae3('0x5'));var rp=require(_0x9ae3('0x6'));var fs=require('fs');var path=require(_0x9ae3('0x7'));var rimraf=require(_0x9ae3('0x8'));var config=require(_0x9ae3('0x9'));var attributes=require('./cmContactHasItem.attributes');module[_0x9ae3('0xa')]=function(_0x51503e,_0x94cfb3){return _0x51503e['define'](_0x9ae3('0xb'),attributes,{'tableName':_0x9ae3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 3f42858..180a8d3 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe526=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','util','moment','bluebird'];(function(_0x43246d,_0x472d31){var _0x3fd15d=function(_0x3782f4){while(--_0x3782f4){_0x43246d['push'](_0x43246d['shift']());}};_0x3fd15d(++_0x472d31);}(_0xe526,0xe4));var _0x6e52=function(_0x434544,_0x12b511){_0x434544=_0x434544-0x0;var _0x3f039e=_0xe526[_0x434544];return _0x3f039e;};'use strict';var _=require('lodash');var util=require(_0x6e52('0x0'));var moment=require(_0x6e52('0x1'));var BPromise=require(_0x6e52('0x2'));var rs=require(_0x6e52('0x3'));var fs=require('fs');var Redis=require(_0x6e52('0x4'));var db=require(_0x6e52('0x5'))['db'];var utils=require(_0x6e52('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x6e52('0x7'));var jayson=require(_0x6e52('0x8'));var client=jayson[_0x6e52('0x9')][_0x6e52('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d0ebb,_0x5862dc,_0x1d3ef0){return new BPromise(function(_0xf130a5,_0x24e7d8){return client[_0x6e52('0xb')](_0x2d0ebb,_0x1d3ef0)[_0x6e52('0xc')](function(_0x2963d6){logger[_0x6e52('0xd')](_0x6e52('0xe'),_0x5862dc,_0x6e52('0xf'));logger[_0x6e52('0x10')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x5862dc,_0x6e52('0xf'),JSON[_0x6e52('0x11')](_0x2963d6));if(_0x2963d6[_0x6e52('0x12')]){if(_0x2963d6[_0x6e52('0x12')]['code']===0x1f4){logger['error'](_0x6e52('0xe'),_0x5862dc,_0x2963d6[_0x6e52('0x12')]['message']);return _0x24e7d8(_0x2963d6['error'][_0x6e52('0x13')]);}logger[_0x6e52('0x12')](_0x6e52('0xe'),_0x5862dc,_0x2963d6[_0x6e52('0x12')][_0x6e52('0x13')]);return _0xf130a5(_0x2963d6['error'][_0x6e52('0x13')]);}else{logger[_0x6e52('0xd')](_0x6e52('0xe'),_0x5862dc,_0x6e52('0xf'));_0xf130a5(_0x2963d6['result']['message']);}})[_0x6e52('0x14')](function(_0x2d8da3){logger[_0x6e52('0x12')](_0x6e52('0xe'),_0x5862dc,_0x2d8da3);_0x24e7d8(_0x2d8da3);});});} \ No newline at end of file +var _0x84e2=['request\x20sent','debug','stringify','error','CmContactHasItem,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x57616c,_0x3c8732){var _0x561e00=function(_0xd986b5){while(--_0xd986b5){_0x57616c['push'](_0x57616c['shift']());}};_0x561e00(++_0x3c8732);}(_0x84e2,0x68));var _0x284e=function(_0x231dda,_0x5b04cc){_0x231dda=_0x231dda-0x0;var _0x3f88cb=_0x84e2[_0x231dda];return _0x3f88cb;};'use strict';var _=require(_0x284e('0x0'));var util=require(_0x284e('0x1'));var moment=require(_0x284e('0x2'));var BPromise=require(_0x284e('0x3'));var rs=require(_0x284e('0x4'));var fs=require('fs');var Redis=require(_0x284e('0x5'));var db=require(_0x284e('0x6'))['db'];var utils=require(_0x284e('0x7'));var logger=require(_0x284e('0x8'))(_0x284e('0x9'));var config=require('../../config/environment');var jayson=require(_0x284e('0xa'));var client=jayson[_0x284e('0xb')][_0x284e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2cbaed,_0x5a0389,_0x57a32c){return new BPromise(function(_0x481366,_0x47d9af){return client[_0x284e('0xd')](_0x2cbaed,_0x57a32c)[_0x284e('0xe')](function(_0x5b4e7e){logger[_0x284e('0xf')]('CmContactHasItem,\x20%s,\x20%s',_0x5a0389,_0x284e('0x10'));logger[_0x284e('0x11')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x5a0389,'request\x20sent',JSON[_0x284e('0x12')](_0x5b4e7e));if(_0x5b4e7e[_0x284e('0x13')]){if(_0x5b4e7e['error']['code']===0x1f4){logger[_0x284e('0x13')](_0x284e('0x14'),_0x5a0389,_0x5b4e7e[_0x284e('0x13')][_0x284e('0x15')]);return _0x47d9af(_0x5b4e7e[_0x284e('0x13')]['message']);}logger['error'](_0x284e('0x14'),_0x5a0389,_0x5b4e7e['error'][_0x284e('0x15')]);return _0x481366(_0x5b4e7e[_0x284e('0x13')][_0x284e('0x15')]);}else{logger[_0x284e('0xf')](_0x284e('0x14'),_0x5a0389,_0x284e('0x10'));_0x481366(_0x5b4e7e[_0x284e('0x16')][_0x284e('0x15')]);}})[_0x284e('0x17')](function(_0x5d703d){logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x5a0389,_0x5d703d);_0x47d9af(_0x5d703d);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 4ba819e..5b54b67 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4a7d=['../../components/auth/service','../../config/environment','./cmContactHasItem.controller','index','/:id','isAuthenticated','show','post','create','put','update','multer','util','path','express','Router','fs-extra'];(function(_0x579c5b,_0x39e023){var _0x2f6eb1=function(_0x532a6){while(--_0x532a6){_0x579c5b['push'](_0x579c5b['shift']());}};_0x2f6eb1(++_0x39e023);}(_0x4a7d,0xe8));var _0xd4a7=function(_0x47872c,_0x8fc111){_0x47872c=_0x47872c-0x0;var _0x266863=_0x4a7d[_0x47872c];return _0x266863;};'use strict';var multer=require(_0xd4a7('0x0'));var util=require(_0xd4a7('0x1'));var path=require(_0xd4a7('0x2'));var timeout=require('connect-timeout');var express=require(_0xd4a7('0x3'));var router=express[_0xd4a7('0x4')]();var fs_extra=require(_0xd4a7('0x5'));var auth=require(_0xd4a7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd4a7('0x7'));var controller=require(_0xd4a7('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xd4a7('0x9')]);router['get'](_0xd4a7('0xa'),auth[_0xd4a7('0xb')](),controller[_0xd4a7('0xc')]);router[_0xd4a7('0xd')]('/',auth[_0xd4a7('0xb')](),controller[_0xd4a7('0xe')]);router[_0xd4a7('0xf')](_0xd4a7('0xa'),auth[_0xd4a7('0xb')](),controller[_0xd4a7('0x10')]);router['delete']('/:id',auth[_0xd4a7('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1e90=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x2b9a69,_0xffd8ec){var _0x12e89b=function(_0xdc9d01){while(--_0xdc9d01){_0x2b9a69['push'](_0x2b9a69['shift']());}};_0x12e89b(++_0xffd8ec);}(_0x1e90,0x103));var _0x01e9=function(_0x2333ca,_0x4797ce){_0x2333ca=_0x2333ca-0x0;var _0xf2b268=_0x1e90[_0x2333ca];return _0xf2b268;};'use strict';var multer=require(_0x01e9('0x0'));var util=require(_0x01e9('0x1'));var path=require(_0x01e9('0x2'));var timeout=require(_0x01e9('0x3'));var express=require(_0x01e9('0x4'));var router=express[_0x01e9('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x01e9('0x6'));var interaction=require(_0x01e9('0x7'));var config=require(_0x01e9('0x8'));var controller=require(_0x01e9('0x9'));router[_0x01e9('0xa')]('/',auth[_0x01e9('0xb')](),controller[_0x01e9('0xc')]);router[_0x01e9('0xa')](_0x01e9('0xd'),auth['isAuthenticated'](),controller[_0x01e9('0xe')]);router[_0x01e9('0xf')]('/',auth[_0x01e9('0xb')](),controller[_0x01e9('0x10')]);router[_0x01e9('0x11')](_0x01e9('0xd'),auth[_0x01e9('0xb')](),controller[_0x01e9('0x12')]);router[_0x01e9('0x13')](_0x01e9('0xd'),auth['isAuthenticated'](),controller[_0x01e9('0x14')]);module[_0x01e9('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index c1a4344..369094e 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 _0x4f68=['name','TEXT','long','parse','getDataValue','values','stringify','BOOLEAN','voice','sequelize','lodash','exports','VIRTUAL','STRING','setDataValue'];(function(_0x1c22ac,_0x4c86bd){var _0x4c867a=function(_0x370c7d){while(--_0x370c7d){_0x1c22ac['push'](_0x1c22ac['shift']());}};_0x4c867a(++_0x4c86bd);}(_0x4f68,0xf9));var _0x84f6=function(_0x46a30a,_0x6aa2a6){_0x46a30a=_0x46a30a-0x0;var _0x3328b3=_0x4f68[_0x46a30a];return _0x3328b3;};'use strict';var Sequelize=require(_0x84f6('0x0'));var _=require(_0x84f6('0x1'));module[_0x84f6('0x2')]={'name':{'type':Sequelize[_0x84f6('0x3')],'get':function(_0x2d83d1){return this['getDataValue']('alias');}},'alias':{'type':Sequelize[_0x84f6('0x4')],'allowNull':![],'set':function(_0x342791){this[_0x84f6('0x5')]('alias',_0x342791?_0x342791:this['getDataValue'](_0x84f6('0x6')));}},'type':{'type':Sequelize[_0x84f6('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0x84f6('0x7')](_0x84f6('0x8')),'get':function(){if(this['getDataValue']('type')==='select'){return JSON[_0x84f6('0x9')](this[_0x84f6('0xa')]('values'));}else{return this['getDataValue']('values');}},'set':function(_0x3b2421){if(Array['isArray'](_0x3b2421)){this[_0x84f6('0x5')](_0x84f6('0xb'),JSON[_0x84f6('0xc')](_0x3b2421));}else{this['setDataValue']('values',_0x3b2421);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x84f6('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x84f6('0xe'))}}; \ No newline at end of file +var _0xe353=['voice','sequelize','getDataValue','STRING','alias','name','TEXT','long','type','select','values','setDataValue','stringify','BOOLEAN','ENUM'];(function(_0x59bd2d,_0x307929){var _0x572487=function(_0x217fec){while(--_0x217fec){_0x59bd2d['push'](_0x59bd2d['shift']());}};_0x572487(++_0x307929);}(_0xe353,0xc4));var _0x3e35=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xe353[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x3e35('0x0'));var _=require('lodash');module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5a5d70){return this[_0x3e35('0x1')]('alias');}},'alias':{'type':Sequelize[_0x3e35('0x2')],'allowNull':![],'set':function(_0x5e9c79){this['setDataValue'](_0x3e35('0x3'),_0x5e9c79?_0x5e9c79:this['getDataValue'](_0x3e35('0x4')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x3e35('0x5')](_0x3e35('0x6')),'get':function(){if(this[_0x3e35('0x1')](_0x3e35('0x7'))===_0x3e35('0x8')){return JSON['parse'](this[_0x3e35('0x1')](_0x3e35('0x9')));}else{return this[_0x3e35('0x1')](_0x3e35('0x9'));}},'set':function(_0x3fc13a){if(Array['isArray'](_0x3fc13a)){this[_0x3e35('0xa')](_0x3e35('0x9'),JSON[_0x3e35('0xb')](_0x3fc13a));}else{this['setDataValue']('values',_0x3fc13a);}}},'required':{'type':Sequelize[_0x3e35('0xc')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x3e35('0xc')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x3e35('0xd')](_0x3e35('0xe'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 1474af2..e0b1f01 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 _0x9deb=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','Content-Range','reject','save','update','then','error','stack','send','rawAttributes','fieldName','type','model','differenceBy','map','name','query','keys','filters','intersection','attributes','fields','length','nolimit','where','merge','VIRTUAL','filter','options','CmCustomField','includeAll','include','findAll','catch','show','params','find','body','create','sequelize','transaction','Sequelize','TEXT','number','BOOLEAN','queryInterface','format','cf_%d','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','desk.js'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x9deb,0xdf));var _0xb9de=function(_0x56c65b,_0x234be9){_0x56c65b=_0x56c65b-0x0;var _0x54d3f2=_0x9deb[_0x56c65b];return _0x54d3f2;};'use strict';var emlformat=require(_0xb9de('0x0'));var rimraf=require(_0xb9de('0x1'));var zipdir=require(_0xb9de('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb9de('0x3'));var moment=require(_0xb9de('0x4'));var BPromise=require(_0xb9de('0x5'));var Mustache=require(_0xb9de('0x6'));var util=require(_0xb9de('0x7'));var path=require('path');var sox=require(_0xb9de('0x8'));var csv=require(_0xb9de('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb9de('0xa'));var _=require(_0xb9de('0xb'));var squel=require('squel');var crypto=require(_0xb9de('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb9de('0xd'));var toCsv=require(_0xb9de('0x9'));var querystring=require('querystring');var Papa=require(_0xb9de('0xe'));var Redis=require(_0xb9de('0xf'));var authService=require(_0xb9de('0x10'));var qs=require(_0xb9de('0x11'));var as=require(_0xb9de('0x12'));var hardwareService=require(_0xb9de('0x13'));var logger=require(_0xb9de('0x14'))(_0xb9de('0x15'));var utils=require(_0xb9de('0x16'));var config=require(_0xb9de('0x17'));var licenseUtil=require(_0xb9de('0x18'));var db=require(_0xb9de('0x19'))['db'];function respondWithStatusCode(_0x47843a,_0x271efc){_0x271efc=_0x271efc||0xcc;return function(_0x57af46){if(_0x57af46){return _0x47843a['sendStatus'](_0x271efc);}return _0x47843a[_0xb9de('0x1a')](_0x271efc)[_0xb9de('0x1b')]();};}function respondWithResult(_0x5cb1a2,_0x246979){_0x246979=_0x246979||0xc8;return function(_0x5b1a73){if(_0x5b1a73){return _0x5cb1a2['status'](_0x246979)[_0xb9de('0x1c')](_0x5b1a73);}};}function respondWithFilteredResult(_0x5490fe,_0x3566ca){return function(_0xb62748){if(_0xb62748){var _0x13d1a5=typeof _0x3566ca[_0xb9de('0x1d')]==='undefined'&&typeof _0x3566ca[_0xb9de('0x1e')]==='undefined';var _0x55650f=_0xb62748[_0xb9de('0x1f')];var _0x41e462=_0x13d1a5?0x0:_0x3566ca['offset'];var _0x39b9e4=_0x13d1a5?_0xb62748[_0xb9de('0x1f')]:_0x3566ca[_0xb9de('0x1d')]+_0x3566ca[_0xb9de('0x1e')];var _0x3a072d;if(_0x39b9e4>=_0x55650f){_0x39b9e4=_0x55650f;_0x3a072d=0xc8;}else{_0x3a072d=0xce;}_0x5490fe['status'](_0x3a072d);return _0x5490fe['set'](_0xb9de('0x20'),_0x41e462+'-'+_0x39b9e4+'/'+_0x55650f)['json'](_0xb62748);}return null;};}function patchUpdates(_0x5d8051){return function(_0xb31dd8){try{jsonpatch['apply'](_0xb31dd8,_0x5d8051,!![]);}catch(_0x255b68){return BPromise[_0xb9de('0x21')](_0x255b68);}return _0xb31dd8[_0xb9de('0x22')]();};}function saveUpdates(_0x479ddf,_0x411341){return function(_0x26f5ba){if(_0x26f5ba){return _0x26f5ba[_0xb9de('0x23')](_0x479ddf)[_0xb9de('0x24')](function(_0x67f8b0){return _0x67f8b0;});}return null;};}function removeEntity(_0x5906b7,_0x869ad1){return function(_0x1285f2){if(_0x1285f2){return _0x1285f2['destroy']()['then'](function(){_0x5906b7[_0xb9de('0x1a')](0xcc)[_0xb9de('0x1b')]();});}};}function handleEntityNotFound(_0x3fd386,_0x1bf048){return function(_0x1540f8){if(!_0x1540f8){_0x3fd386['sendStatus'](0x194);}return _0x1540f8;};}function handleError(_0x5270a4,_0x59de8f){_0x59de8f=_0x59de8f||0x1f4;return function(_0x5911de){logger[_0xb9de('0x25')](_0x5911de[_0xb9de('0x26')]);if(_0x5911de['name']){delete _0x5911de['name'];}_0x5270a4[_0xb9de('0x1a')](_0x59de8f)[_0xb9de('0x27')](_0x5911de);};}exports['index']=function(_0x17a694,_0x3787d1){var _0x34a766={},_0x524550={},_0x28ec62={'count':0x0,'rows':[]};var _0x22290c=_['map'](db['CmCustomField'][_0xb9de('0x28')],function(_0x2cbda9){return{'name':_0x2cbda9[_0xb9de('0x29')],'type':_0x2cbda9[_0xb9de('0x2a')]['key']};});_0x524550[_0xb9de('0x2b')]=_[_0xb9de('0x2c')](_[_0xb9de('0x2d')](_0x22290c,'name'),[_0xb9de('0x2e')]);_0x524550[_0xb9de('0x2f')]=_[_0xb9de('0x30')](_0x17a694[_0xb9de('0x2f')]);_0x524550[_0xb9de('0x31')]=_[_0xb9de('0x32')](_0x524550[_0xb9de('0x2b')],_0x524550[_0xb9de('0x2f')]);_0x34a766[_0xb9de('0x33')]=_[_0xb9de('0x32')](_0x524550[_0xb9de('0x2b')],qs[_0xb9de('0x34')](_0x17a694[_0xb9de('0x2f')][_0xb9de('0x34')]));_0x34a766[_0xb9de('0x33')]=_0x34a766[_0xb9de('0x33')][_0xb9de('0x35')]?_0x34a766[_0xb9de('0x33')]:_0x524550[_0xb9de('0x2b')];if(!_0x17a694[_0xb9de('0x2f')]['hasOwnProperty'](_0xb9de('0x36'))){_0x34a766[_0xb9de('0x1e')]=qs[_0xb9de('0x1e')](_0x17a694['query'][_0xb9de('0x1e')]);_0x34a766[_0xb9de('0x1d')]=qs['offset'](_0x17a694[_0xb9de('0x2f')]['offset']);}_0x34a766['order']=qs['sort'](_0x17a694[_0xb9de('0x2f')]['sort']);_0x34a766[_0xb9de('0x37')]=qs[_0xb9de('0x31')](_['pick'](_0x17a694[_0xb9de('0x2f')],_0x524550[_0xb9de('0x31')]),_0x22290c);if(_0x17a694[_0xb9de('0x2f')]['filter']){_0x34a766[_0xb9de('0x37')]=_[_0xb9de('0x38')](_0x34a766[_0xb9de('0x37')],{'$or':_[_0xb9de('0x2d')](_0x22290c,function(_0x346b8d){if(_0x346b8d[_0xb9de('0x2a')]!==_0xb9de('0x39')){var _0x11c6c6={};_0x11c6c6[_0x346b8d['name']]={'$like':'%'+_0x17a694['query'][_0xb9de('0x3a')]+'%'};return _0x11c6c6;}})});}_0x34a766=_[_0xb9de('0x38')]({},_0x34a766,_0x17a694[_0xb9de('0x3b')]);var _0x144f32={'where':_0x34a766[_0xb9de('0x37')]};return db[_0xb9de('0x3c')][_0xb9de('0x1f')](_0x144f32)[_0xb9de('0x24')](function(_0x4561af){_0x28ec62[_0xb9de('0x1f')]=_0x4561af;if(_0x17a694[_0xb9de('0x2f')][_0xb9de('0x3d')]){_0x34a766[_0xb9de('0x3e')]=[{'all':!![]}];}return db[_0xb9de('0x3c')][_0xb9de('0x3f')](_0x34a766);})[_0xb9de('0x24')](function(_0x13eaca){_0x28ec62['rows']=_0x13eaca;return _0x28ec62;})[_0xb9de('0x24')](respondWithFilteredResult(_0x3787d1,_0x34a766))[_0xb9de('0x40')](handleError(_0x3787d1,null));};exports[_0xb9de('0x41')]=function(_0x1825be,_0x3598f3){var _0x29e4f3={'raw':!![],'where':{'id':_0x1825be[_0xb9de('0x42')]['id']}},_0x48276f={};_0x48276f[_0xb9de('0x2b')]=_[_0xb9de('0x30')](db[_0xb9de('0x3c')][_0xb9de('0x28')]);_0x48276f[_0xb9de('0x2f')]=_[_0xb9de('0x30')](_0x1825be[_0xb9de('0x2f')]);_0x48276f[_0xb9de('0x31')]=_['intersection'](_0x48276f['model'],_0x48276f['query']);_0x29e4f3[_0xb9de('0x33')]=_[_0xb9de('0x32')](_0x48276f[_0xb9de('0x2b')],qs[_0xb9de('0x34')](_0x1825be[_0xb9de('0x2f')][_0xb9de('0x34')]));_0x29e4f3[_0xb9de('0x33')]=_0x29e4f3[_0xb9de('0x33')][_0xb9de('0x35')]?_0x29e4f3['attributes']:_0x48276f[_0xb9de('0x2b')];if(_0x1825be[_0xb9de('0x2f')]['includeAll']){_0x29e4f3[_0xb9de('0x3e')]=[{'all':!![]}];}_0x29e4f3=_[_0xb9de('0x38')]({},_0x29e4f3,_0x1825be[_0xb9de('0x3b')]);return db[_0xb9de('0x3c')][_0xb9de('0x43')](_0x29e4f3)[_0xb9de('0x24')](handleEntityNotFound(_0x3598f3,null))[_0xb9de('0x24')](respondWithResult(_0x3598f3,null))['catch'](handleError(_0x3598f3,null));};exports['update']=function(_0xc64a9d,_0x336634){if(_0xc64a9d[_0xb9de('0x44')]['id']){delete _0xc64a9d[_0xb9de('0x44')]['id'];}return db['CmCustomField'][_0xb9de('0x43')]({'where':{'id':_0xc64a9d['params']['id']}})[_0xb9de('0x24')](handleEntityNotFound(_0x336634,null))[_0xb9de('0x24')](saveUpdates(_0xc64a9d[_0xb9de('0x44')],null))[_0xb9de('0x24')](respondWithResult(_0x336634,null))['catch'](handleError(_0x336634,null));};exports['destroy']=function(_0x143268,_0x74863d){return db['CmCustomField'][_0xb9de('0x43')]({'where':{'id':_0x143268[_0xb9de('0x42')]['id']}})[_0xb9de('0x24')](handleEntityNotFound(_0x74863d,null))[_0xb9de('0x24')](removeEntity(_0x74863d,null))[_0xb9de('0x40')](handleError(_0x74863d,null));};exports[_0xb9de('0x45')]=function(_0x2d1bd6,_0x27ee56){var _0x2d9c7c;return db[_0xb9de('0x46')][_0xb9de('0x47')](function(_0x7871c8){return db[_0xb9de('0x3c')]['create'](_0x2d1bd6[_0xb9de('0x44')],{'transaction':_0x7871c8})[_0xb9de('0x24')](function(_0x1530bf){_0x2d9c7c=_0x1530bf;var _0x4e3e4d={'type':db[_0xb9de('0x48')][_0xb9de('0x49')],'transaction':_0x7871c8};switch(_0x2d1bd6[_0xb9de('0x44')][_0xb9de('0x2a')]){case'text':_0x4e3e4d[_0xb9de('0x2a')]=db[_0xb9de('0x48')][_0xb9de('0x49')];break;case _0xb9de('0x4a'):_0x4e3e4d[_0xb9de('0x2a')]=db[_0xb9de('0x48')]['INTEGER'];break;case'switch':_0x4e3e4d['type']=db[_0xb9de('0x48')][_0xb9de('0x4b')];_0x4e3e4d['defaultValue']=![];break;default:}return db[_0xb9de('0x46')][_0xb9de('0x4c')]['addColumn']('cm_contacts',util[_0xb9de('0x4d')](_0xb9de('0x4e'),_0x2d9c7c['id']),_0x4e3e4d);})[_0xb9de('0x24')](function(){return _0x2d9c7c;});})[_0xb9de('0x24')](respondWithResult(_0x27ee56,0xc9))[_0xb9de('0x40')](handleError(_0x27ee56,null));}; \ No newline at end of file +var _0x9f38=['undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','params','find','body','catch','create','Sequelize','TEXT','text','INTEGER','switch','defaultValue','sequelize','queryInterface','addColumn','cm_contacts','format','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x2ae0f5,_0x10a8a2){var _0x2ddc54=function(_0x4b2cb6){while(--_0x4b2cb6){_0x2ae0f5['push'](_0x2ae0f5['shift']());}};_0x2ddc54(++_0x10a8a2);}(_0x9f38,0xe7));var _0x89f3=function(_0x408e8a,_0x4bb065){_0x408e8a=_0x408e8a-0x0;var _0x18fe43=_0x9f38[_0x408e8a];return _0x18fe43;};'use strict';var emlformat=require(_0x89f3('0x0'));var rimraf=require(_0x89f3('0x1'));var zipdir=require(_0x89f3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x89f3('0x3'));var moment=require(_0x89f3('0x4'));var BPromise=require(_0x89f3('0x5'));var Mustache=require(_0x89f3('0x6'));var util=require(_0x89f3('0x7'));var path=require(_0x89f3('0x8'));var sox=require(_0x89f3('0x9'));var csv=require(_0x89f3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x89f3('0xb'));var _=require(_0x89f3('0xc'));var squel=require(_0x89f3('0xd'));var crypto=require(_0x89f3('0xe'));var jsforce=require(_0x89f3('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x89f3('0xa'));var querystring=require(_0x89f3('0x10'));var Papa=require(_0x89f3('0x11'));var Redis=require(_0x89f3('0x12'));var authService=require(_0x89f3('0x13'));var qs=require(_0x89f3('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x89f3('0x15'));var logger=require('../../config/logger')(_0x89f3('0x16'));var utils=require('../../config/utils');var config=require(_0x89f3('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x89f3('0x18'))['db'];function respondWithStatusCode(_0x3cbd4a,_0x3c088f){_0x3c088f=_0x3c088f||0xcc;return function(_0x429c4f){if(_0x429c4f){return _0x3cbd4a[_0x89f3('0x19')](_0x3c088f);}return _0x3cbd4a[_0x89f3('0x1a')](_0x3c088f)[_0x89f3('0x1b')]();};}function respondWithResult(_0x85daef,_0x1fbe18){_0x1fbe18=_0x1fbe18||0xc8;return function(_0x140130){if(_0x140130){return _0x85daef[_0x89f3('0x1a')](_0x1fbe18)[_0x89f3('0x1c')](_0x140130);}};}function respondWithFilteredResult(_0x5d04d4,_0x2fa80a){return function(_0x1fe162){if(_0x1fe162){var _0x36bb68=typeof _0x2fa80a[_0x89f3('0x1d')]===_0x89f3('0x1e')&&typeof _0x2fa80a['limit']===_0x89f3('0x1e');var _0x728fc1=_0x1fe162[_0x89f3('0x1f')];var _0x2b2d1d=_0x36bb68?0x0:_0x2fa80a['offset'];var _0x29e0b5=_0x36bb68?_0x1fe162[_0x89f3('0x1f')]:_0x2fa80a[_0x89f3('0x1d')]+_0x2fa80a[_0x89f3('0x20')];var _0x5b9389;if(_0x29e0b5>=_0x728fc1){_0x29e0b5=_0x728fc1;_0x5b9389=0xc8;}else{_0x5b9389=0xce;}_0x5d04d4['status'](_0x5b9389);return _0x5d04d4[_0x89f3('0x21')](_0x89f3('0x22'),_0x2b2d1d+'-'+_0x29e0b5+'/'+_0x728fc1)[_0x89f3('0x1c')](_0x1fe162);}return null;};}function patchUpdates(_0x41b3f5){return function(_0x211b67){try{jsonpatch['apply'](_0x211b67,_0x41b3f5,!![]);}catch(_0x3c2db8){return BPromise[_0x89f3('0x23')](_0x3c2db8);}return _0x211b67[_0x89f3('0x24')]();};}function saveUpdates(_0x59d90d,_0x4deef8){return function(_0x101423){if(_0x101423){return _0x101423[_0x89f3('0x25')](_0x59d90d)[_0x89f3('0x26')](function(_0x1722c5){return _0x1722c5;});}return null;};}function removeEntity(_0x54deeb,_0x4b9745){return function(_0x503517){if(_0x503517){return _0x503517[_0x89f3('0x27')]()[_0x89f3('0x26')](function(){_0x54deeb[_0x89f3('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x407e7e,_0x2c5cf0){return function(_0x2843af){if(!_0x2843af){_0x407e7e[_0x89f3('0x19')](0x194);}return _0x2843af;};}function handleError(_0x2b4676,_0x535431){_0x535431=_0x535431||0x1f4;return function(_0x3108ca){logger[_0x89f3('0x28')](_0x3108ca[_0x89f3('0x29')]);if(_0x3108ca[_0x89f3('0x2a')]){delete _0x3108ca['name'];}_0x2b4676[_0x89f3('0x1a')](_0x535431)['send'](_0x3108ca);};}exports[_0x89f3('0x2b')]=function(_0x8bad8e,_0x1c8551){var _0x2d558f={},_0x39d74c={},_0x23f125={'count':0x0,'rows':[]};var _0x686ee4=_[_0x89f3('0x2c')](db[_0x89f3('0x2d')][_0x89f3('0x2e')],function(_0x34a67b){return{'name':_0x34a67b[_0x89f3('0x2f')],'type':_0x34a67b[_0x89f3('0x30')][_0x89f3('0x31')]};});_0x39d74c[_0x89f3('0x32')]=_['differenceBy'](_['map'](_0x686ee4,'name'),[_0x89f3('0x2a')]);_0x39d74c[_0x89f3('0x33')]=_[_0x89f3('0x34')](_0x8bad8e[_0x89f3('0x33')]);_0x39d74c[_0x89f3('0x35')]=_['intersection'](_0x39d74c[_0x89f3('0x32')],_0x39d74c['query']);_0x2d558f[_0x89f3('0x36')]=_[_0x89f3('0x37')](_0x39d74c[_0x89f3('0x32')],qs[_0x89f3('0x38')](_0x8bad8e[_0x89f3('0x33')]['fields']));_0x2d558f[_0x89f3('0x36')]=_0x2d558f[_0x89f3('0x36')][_0x89f3('0x39')]?_0x2d558f[_0x89f3('0x36')]:_0x39d74c[_0x89f3('0x32')];if(!_0x8bad8e[_0x89f3('0x33')][_0x89f3('0x3a')](_0x89f3('0x3b'))){_0x2d558f['limit']=qs[_0x89f3('0x20')](_0x8bad8e['query'][_0x89f3('0x20')]);_0x2d558f['offset']=qs[_0x89f3('0x1d')](_0x8bad8e[_0x89f3('0x33')]['offset']);}_0x2d558f[_0x89f3('0x3c')]=qs[_0x89f3('0x3d')](_0x8bad8e[_0x89f3('0x33')][_0x89f3('0x3d')]);_0x2d558f[_0x89f3('0x3e')]=qs[_0x89f3('0x35')](_[_0x89f3('0x3f')](_0x8bad8e[_0x89f3('0x33')],_0x39d74c[_0x89f3('0x35')]),_0x686ee4);if(_0x8bad8e[_0x89f3('0x33')][_0x89f3('0x40')]){_0x2d558f['where']=_[_0x89f3('0x41')](_0x2d558f[_0x89f3('0x3e')],{'$or':_[_0x89f3('0x2c')](_0x686ee4,function(_0x44db60){if(_0x44db60['type']!==_0x89f3('0x42')){var _0x56c15a={};_0x56c15a[_0x44db60[_0x89f3('0x2a')]]={'$like':'%'+_0x8bad8e[_0x89f3('0x33')][_0x89f3('0x40')]+'%'};return _0x56c15a;}})});}_0x2d558f=_[_0x89f3('0x41')]({},_0x2d558f,_0x8bad8e[_0x89f3('0x43')]);var _0x14db6b={'where':_0x2d558f[_0x89f3('0x3e')]};return db[_0x89f3('0x2d')][_0x89f3('0x1f')](_0x14db6b)['then'](function(_0x479c3c){_0x23f125['count']=_0x479c3c;if(_0x8bad8e[_0x89f3('0x33')][_0x89f3('0x44')]){_0x2d558f[_0x89f3('0x45')]=[{'all':!![]}];}return db['CmCustomField']['findAll'](_0x2d558f);})[_0x89f3('0x26')](function(_0x13a04f){_0x23f125[_0x89f3('0x46')]=_0x13a04f;return _0x23f125;})['then'](respondWithFilteredResult(_0x1c8551,_0x2d558f))['catch'](handleError(_0x1c8551,null));};exports['show']=function(_0xbb7c24,_0x3cb6bb){var _0x50474e={'raw':!![],'where':{'id':_0xbb7c24[_0x89f3('0x47')]['id']}},_0x2e84a0={};_0x2e84a0[_0x89f3('0x32')]=_[_0x89f3('0x34')](db['CmCustomField'][_0x89f3('0x2e')]);_0x2e84a0[_0x89f3('0x33')]=_[_0x89f3('0x34')](_0xbb7c24[_0x89f3('0x33')]);_0x2e84a0[_0x89f3('0x35')]=_[_0x89f3('0x37')](_0x2e84a0[_0x89f3('0x32')],_0x2e84a0[_0x89f3('0x33')]);_0x50474e['attributes']=_[_0x89f3('0x37')](_0x2e84a0[_0x89f3('0x32')],qs[_0x89f3('0x38')](_0xbb7c24[_0x89f3('0x33')][_0x89f3('0x38')]));_0x50474e[_0x89f3('0x36')]=_0x50474e[_0x89f3('0x36')][_0x89f3('0x39')]?_0x50474e[_0x89f3('0x36')]:_0x2e84a0[_0x89f3('0x32')];if(_0xbb7c24[_0x89f3('0x33')][_0x89f3('0x44')]){_0x50474e[_0x89f3('0x45')]=[{'all':!![]}];}_0x50474e=_[_0x89f3('0x41')]({},_0x50474e,_0xbb7c24[_0x89f3('0x43')]);return db[_0x89f3('0x2d')][_0x89f3('0x48')](_0x50474e)[_0x89f3('0x26')](handleEntityNotFound(_0x3cb6bb,null))[_0x89f3('0x26')](respondWithResult(_0x3cb6bb,null))['catch'](handleError(_0x3cb6bb,null));};exports[_0x89f3('0x25')]=function(_0x2bab44,_0x283de0){if(_0x2bab44['body']['id']){delete _0x2bab44[_0x89f3('0x49')]['id'];}return db[_0x89f3('0x2d')][_0x89f3('0x48')]({'where':{'id':_0x2bab44[_0x89f3('0x47')]['id']}})[_0x89f3('0x26')](handleEntityNotFound(_0x283de0,null))[_0x89f3('0x26')](saveUpdates(_0x2bab44[_0x89f3('0x49')],null))['then'](respondWithResult(_0x283de0,null))[_0x89f3('0x4a')](handleError(_0x283de0,null));};exports[_0x89f3('0x27')]=function(_0x6f873b,_0x5a125a){return db[_0x89f3('0x2d')][_0x89f3('0x48')]({'where':{'id':_0x6f873b[_0x89f3('0x47')]['id']}})[_0x89f3('0x26')](handleEntityNotFound(_0x5a125a,null))[_0x89f3('0x26')](removeEntity(_0x5a125a,null))[_0x89f3('0x4a')](handleError(_0x5a125a,null));};exports[_0x89f3('0x4b')]=function(_0x2a1240,_0x92d7f9){var _0x1b6fbe;return db['sequelize']['transaction'](function(_0x4d22e9){return db[_0x89f3('0x2d')][_0x89f3('0x4b')](_0x2a1240['body'],{'transaction':_0x4d22e9})[_0x89f3('0x26')](function(_0x4832f1){_0x1b6fbe=_0x4832f1;var _0x4ce36c={'type':db[_0x89f3('0x4c')][_0x89f3('0x4d')],'transaction':_0x4d22e9};switch(_0x2a1240[_0x89f3('0x49')][_0x89f3('0x30')]){case _0x89f3('0x4e'):_0x4ce36c[_0x89f3('0x30')]=db[_0x89f3('0x4c')]['TEXT'];break;case'number':_0x4ce36c[_0x89f3('0x30')]=db[_0x89f3('0x4c')][_0x89f3('0x4f')];break;case _0x89f3('0x50'):_0x4ce36c['type']=db[_0x89f3('0x4c')]['BOOLEAN'];_0x4ce36c[_0x89f3('0x51')]=![];break;default:}return db[_0x89f3('0x52')][_0x89f3('0x53')][_0x89f3('0x54')](_0x89f3('0x55'),util[_0x89f3('0x56')]('cf_%d',_0x1b6fbe['id']),_0x4ce36c);})['then'](function(){return _0x1b6fbe;});})[_0x89f3('0x26')](respondWithResult(_0x92d7f9,0xc9))['catch'](handleError(_0x92d7f9,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index a43f114..a2ccde6 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 _0x7035=['bluebird','request-promise','path','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash','../../config/logger','moment'];(function(_0xbb0ae2,_0x1263b4){var _0x493d06=function(_0x3a80bd){while(--_0x3a80bd){_0xbb0ae2['push'](_0xbb0ae2['shift']());}};_0x493d06(++_0x1263b4);}(_0x7035,0x1ad));var _0x5703=function(_0x1acff6,_0x2fe5fd){_0x1acff6=_0x1acff6-0x0;var _0xa038bb=_0x7035[_0x1acff6];return _0xa038bb;};'use strict';var _=require(_0x5703('0x0'));var util=require('util');var logger=require(_0x5703('0x1'))('api');var moment=require(_0x5703('0x2'));var BPromise=require(_0x5703('0x3'));var rp=require(_0x5703('0x4'));var fs=require('fs');var path=require(_0x5703('0x5'));var rimraf=require('rimraf');var config=require(_0x5703('0x6'));var attributes=require(_0x5703('0x7'));module[_0x5703('0x8')]=function(_0x3f4b1a,_0x349570){return _0x3f4b1a[_0x5703('0x9')](_0x5703('0xa'),attributes,{'tableName':_0x5703('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x38e2=['../../config/environment','./cmCustomField.attributes','exports','cm_custom_fields','util','request-promise','path','rimraf'];(function(_0x311c75,_0x25dba0){var _0x5a7a4d=function(_0x13055e){while(--_0x13055e){_0x311c75['push'](_0x311c75['shift']());}};_0x5a7a4d(++_0x25dba0);}(_0x38e2,0x134));var _0x238e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x38e2[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x238e('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x238e('0x1'));var fs=require('fs');var path=require(_0x238e('0x2'));var rimraf=require(_0x238e('0x3'));var config=require(_0x238e('0x4'));var attributes=require(_0x238e('0x5'));module[_0x238e('0x6')]=function(_0xb602bf,_0x102298){return _0xb602bf['define']('CmCustomField',attributes,{'tableName':_0x238e('0x7'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index ca7e955..f6b2dc8 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 _0x8c17=['debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','CmCustomField,\x20%s,\x20%s','request\x20sent'];(function(_0x4dfc4f,_0x3147a4){var _0x29338c=function(_0x4751a9){while(--_0x4751a9){_0x4dfc4f['push'](_0x4dfc4f['shift']());}};_0x29338c(++_0x3147a4);}(_0x8c17,0xd7));var _0x78c1=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x8c17[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x78c1('0x0'));var BPromise=require(_0x78c1('0x1'));var rs=require(_0x78c1('0x2'));var fs=require('fs');var Redis=require(_0x78c1('0x3'));var db=require(_0x78c1('0x4'))['db'];var utils=require(_0x78c1('0x5'));var logger=require(_0x78c1('0x6'))(_0x78c1('0x7'));var config=require(_0x78c1('0x8'));var jayson=require(_0x78c1('0x9'));var client=jayson['client'][_0x78c1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x40f828,_0x40ed27,_0x50900f){return new BPromise(function(_0x379805,_0x3602d5){return client[_0x78c1('0xb')](_0x40f828,_0x50900f)[_0x78c1('0xc')](function(_0x1866d0){logger['info'](_0x78c1('0xd'),_0x40ed27,_0x78c1('0xe'));logger[_0x78c1('0xf')](_0x78c1('0x10'),_0x40ed27,_0x78c1('0xe'),JSON[_0x78c1('0x11')](_0x1866d0));if(_0x1866d0['error']){if(_0x1866d0[_0x78c1('0x12')][_0x78c1('0x13')]===0x1f4){logger[_0x78c1('0x12')](_0x78c1('0xd'),_0x40ed27,_0x1866d0[_0x78c1('0x12')]['message']);return _0x3602d5(_0x1866d0[_0x78c1('0x12')][_0x78c1('0x14')]);}logger[_0x78c1('0x12')]('CmCustomField,\x20%s,\x20%s',_0x40ed27,_0x1866d0['error'][_0x78c1('0x14')]);return _0x379805(_0x1866d0[_0x78c1('0x12')]['message']);}else{logger['info'](_0x78c1('0xd'),_0x40ed27,_0x78c1('0xe'));_0x379805(_0x1866d0[_0x78c1('0x15')][_0x78c1('0x14')]);}})[_0x78c1('0x16')](function(_0x13fa42){logger[_0x78c1('0x12')](_0x78c1('0xd'),_0x40ed27,_0x13fa42);_0x3602d5(_0x13fa42);});});} \ No newline at end of file +var _0x5f01=['debug','error','code','message','catch','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','info','CmCustomField,\x20%s,\x20%s','request\x20sent'];(function(_0x7cb10c,_0x2fcc3a){var _0x11df59=function(_0x75305f){while(--_0x75305f){_0x7cb10c['push'](_0x7cb10c['shift']());}};_0x11df59(++_0x2fcc3a);}(_0x5f01,0x1a5));var _0x15f0=function(_0x28b8cc,_0x67bfa7){_0x28b8cc=_0x28b8cc-0x0;var _0x313ef5=_0x5f01[_0x28b8cc];return _0x313ef5;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x15f0('0x0'));var rs=require(_0x15f0('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x15f0('0x2'))['db'];var utils=require(_0x15f0('0x3'));var logger=require(_0x15f0('0x4'))('rpc');var config=require(_0x15f0('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x15f0('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1eac76,_0x111a51,_0x49040b){return new BPromise(function(_0x33b231,_0x3a2e23){return client[_0x15f0('0x7')](_0x1eac76,_0x49040b)['then'](function(_0x2ea6aa){logger[_0x15f0('0x8')](_0x15f0('0x9'),_0x111a51,_0x15f0('0xa'));logger[_0x15f0('0xb')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x111a51,_0x15f0('0xa'),JSON['stringify'](_0x2ea6aa));if(_0x2ea6aa[_0x15f0('0xc')]){if(_0x2ea6aa[_0x15f0('0xc')][_0x15f0('0xd')]===0x1f4){logger['error'](_0x15f0('0x9'),_0x111a51,_0x2ea6aa[_0x15f0('0xc')][_0x15f0('0xe')]);return _0x3a2e23(_0x2ea6aa[_0x15f0('0xc')][_0x15f0('0xe')]);}logger[_0x15f0('0xc')](_0x15f0('0x9'),_0x111a51,_0x2ea6aa[_0x15f0('0xc')]['message']);return _0x33b231(_0x2ea6aa[_0x15f0('0xc')][_0x15f0('0xe')]);}else{logger[_0x15f0('0x8')]('CmCustomField,\x20%s,\x20%s',_0x111a51,_0x15f0('0xa'));_0x33b231(_0x2ea6aa['result'][_0x15f0('0xe')]);}})[_0x15f0('0xf')](function(_0xc6b785){logger['error'](_0x15f0('0x9'),_0x111a51,_0xc6b785);_0x3a2e23(_0xc6b785);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index e78f071..5a672e9 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 _0x4453=['create','put','delete','destroy','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0xcfcbaa,_0x369d95){var _0x157ed0=function(_0x3a0b62){while(--_0x3a0b62){_0xcfcbaa['push'](_0xcfcbaa['shift']());}};_0x157ed0(++_0x369d95);}(_0x4453,0x9c));var _0x3445=function(_0x2b41cd,_0x2b4d13){_0x2b41cd=_0x2b41cd-0x0;var _0x4d021b=_0x4453[_0x2b41cd];return _0x4d021b;};'use strict';var multer=require(_0x3445('0x0'));var util=require(_0x3445('0x1'));var path=require('path');var timeout=require(_0x3445('0x2'));var express=require(_0x3445('0x3'));var router=express['Router']();var fs_extra=require(_0x3445('0x4'));var auth=require(_0x3445('0x5'));var interaction=require(_0x3445('0x6'));var config=require(_0x3445('0x7'));var controller=require(_0x3445('0x8'));router[_0x3445('0x9')]('/',auth[_0x3445('0xa')](),controller[_0x3445('0xb')]);router[_0x3445('0x9')](_0x3445('0xc'),auth['isAuthenticated'](),controller[_0x3445('0xd')]);router[_0x3445('0xe')]('/',auth[_0x3445('0xa')](),controller[_0x3445('0xf')]);router[_0x3445('0x10')](_0x3445('0xc'),auth[_0x3445('0xa')](),controller['update']);router[_0x3445('0x11')](_0x3445('0xc'),auth[_0x3445('0xa')](),controller[_0x3445('0x12')]);module['exports']=router; \ No newline at end of file +var _0xbc00=['Router','fs-extra','../../components/auth/service','../../config/environment','./cmCustomField.controller','index','get','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x52282a,_0x45aef7){var _0x3c66b4=function(_0x312aa9){while(--_0x312aa9){_0x52282a['push'](_0x52282a['shift']());}};_0x3c66b4(++_0x45aef7);}(_0xbc00,0x107));var _0x0bc0=function(_0x58c20f,_0x4cdb1b){_0x58c20f=_0x58c20f-0x0;var _0x3b0318=_0xbc00[_0x58c20f];return _0x3b0318;};'use strict';var multer=require(_0x0bc0('0x0'));var util=require(_0x0bc0('0x1'));var path=require('path');var timeout=require(_0x0bc0('0x2'));var express=require('express');var router=express[_0x0bc0('0x3')]();var fs_extra=require(_0x0bc0('0x4'));var auth=require(_0x0bc0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0bc0('0x6'));var controller=require(_0x0bc0('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x0bc0('0x8')]);router[_0x0bc0('0x9')](_0x0bc0('0xa'),auth[_0x0bc0('0xb')](),controller[_0x0bc0('0xc')]);router[_0x0bc0('0xd')]('/',auth[_0x0bc0('0xb')](),controller[_0x0bc0('0xe')]);router[_0x0bc0('0xf')]('/:id',auth[_0x0bc0('0xb')](),controller['update']);router[_0x0bc0('0x10')](_0x0bc0('0xa'),auth[_0x0bc0('0xb')](),controller[_0x0bc0('0x11')]);module[_0x0bc0('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 0fb0359..d14143c 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 _0x00e9=['BOOLEAN','format','INTEGER','UNSIGNED','contactListQueue','sequelize','exports'];(function(_0x1395d8,_0x56f5d6){var _0x4e3962=function(_0x340eb0){while(--_0x340eb0){_0x1395d8['push'](_0x1395d8['shift']());}};_0x4e3962(++_0x56f5d6);}(_0x00e9,0x8a));var _0x900e=function(_0x5a27f1,_0x11312d){_0x5a27f1=_0x5a27f1-0x0;var _0xbbb997=_0x00e9[_0x5a27f1];return _0xbbb997;};'use strict';var moment=require('moment');var Sequelize=require(_0x900e('0x0'));module[_0x900e('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x900e('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x900e('0x3')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x900e('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x900e('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x900e('0x4')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x900e('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x900e('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x900e('0x4')],'unique':_0x900e('0x6')},'ListId':{'type':Sequelize[_0x900e('0x4')],'unique':_0x900e('0x6')},'UserId':{'type':Sequelize[_0x900e('0x4')]},'VoiceQueueId':{'type':Sequelize[_0x900e('0x4')],'unique':_0x900e('0x6')},'CampaignId':{'type':Sequelize[_0x900e('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x900e('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x900e('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x900e('0x4')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x900e('0x4')],'allowNull':!![],'defaultValue':0x0}}; \ No newline at end of file +var _0x54c4=['sequelize','exports','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x54c4,0xc5));var _0x454c=function(_0x1d6758,_0x199637){_0x1d6758=_0x1d6758-0x0;var _0x3c88eb=_0x54c4[_0x1d6758];return _0x3c88eb;};'use strict';var moment=require(_0x454c('0x0'));var Sequelize=require(_0x454c('0x1'));module[_0x454c('0x2')]={'phone':{'type':Sequelize[_0x454c('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x454c('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x454c('0x5')],'defaultValue':moment()[_0x454c('0x6')](_0x454c('0x7'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x454c('0x8')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x454c('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x454c('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x454c('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x454c('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x454c('0xa')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x454c('0xa')},'UserId':{'type':Sequelize[_0x454c('0x8')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x454c('0x8')]},'countnosuchnumberretry':{'type':Sequelize[_0x454c('0x8')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x454c('0x8')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x454c('0x8')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x454c('0x8')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x454c('0x8')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x454c('0x8')],'allowNull':!![],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index da0826e..13f3c29 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 _0xe5b3=['sequelize','transaction','direction','prev','isEmpty','hopperIds','priority','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','findOne','scheduledat','phone','LOCK','Contact','CmList','List','getOpenContacts','isNumber','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','name','index','map','CmHopper','rawAttributes','type','key','model','query','keys','filters','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$notIn','$like','$notILike','$overlap','$contains','$contained','$any','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','params','options','find','create','body','describe','destroy','VoiceQueue','Campaign','VoiceQueueId','CampaignId','omit','dataValues','createdAt','state','deleted','campaign','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','campaigntype','queue','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt'];(function(_0x277a66,_0x338269){var _0x268450=function(_0x171acc){while(--_0x171acc){_0x277a66['push'](_0x277a66['shift']());}};_0x268450(++_0x338269);}(_0xe5b3,0x133));var _0x3e5b=function(_0x41d73c,_0x50af9f){_0x41d73c=_0x41d73c-0x0;var _0x2f81a9=_0xe5b3[_0x41d73c];return _0x2f81a9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e5b('0x0'));var zipdir=require(_0x3e5b('0x1'));var jsonpatch=require(_0x3e5b('0x2'));var rp=require(_0x3e5b('0x3'));var moment=require(_0x3e5b('0x4'));var BPromise=require(_0x3e5b('0x5'));var Mustache=require(_0x3e5b('0x6'));var util=require(_0x3e5b('0x7'));var path=require(_0x3e5b('0x8'));var sox=require(_0x3e5b('0x9'));var csv=require(_0x3e5b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e5b('0xb'));var _=require(_0x3e5b('0xc'));var squel=require('squel');var crypto=require(_0x3e5b('0xd'));var jsforce=require(_0x3e5b('0xe'));var deskjs=require(_0x3e5b('0xf'));var toCsv=require(_0x3e5b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3e5b('0x10'));var authService=require(_0x3e5b('0x11'));var qs=require(_0x3e5b('0x12'));var as=require(_0x3e5b('0x13'));var hardwareService=require(_0x3e5b('0x14'));var logger=require('../../config/logger')(_0x3e5b('0x15'));var utils=require('../../config/utils');var config=require(_0x3e5b('0x16'));var licenseUtil=require(_0x3e5b('0x17'));var db=require(_0x3e5b('0x18'))['db'];function respondWithStatusCode(_0x374068,_0x20b97b){_0x20b97b=_0x20b97b||0xcc;return function(_0x3c4eb1){if(_0x3c4eb1){return _0x374068[_0x3e5b('0x19')](_0x20b97b);}return _0x374068['status'](_0x20b97b)[_0x3e5b('0x1a')]();};}function respondWithResult(_0x5f2f9c,_0x51a188){_0x51a188=_0x51a188||0xc8;return function(_0x4d71a3){if(_0x4d71a3){return _0x5f2f9c[_0x3e5b('0x1b')](_0x51a188)[_0x3e5b('0x1c')](_0x4d71a3);}};}function respondWithFilteredResult(_0x17aaa3,_0x4fb471){return function(_0x1f81a7){if(_0x1f81a7){var _0x59ddc0=typeof _0x4fb471['offset']===_0x3e5b('0x1d')&&typeof _0x4fb471[_0x3e5b('0x1e')]==='undefined';var _0x3d58a4=_0x1f81a7[_0x3e5b('0x1f')];var _0x555002=_0x59ddc0?0x0:_0x4fb471[_0x3e5b('0x20')];var _0x3365dd=_0x59ddc0?_0x1f81a7['count']:_0x4fb471['offset']+_0x4fb471[_0x3e5b('0x1e')];var _0x20806a;if(_0x3365dd>=_0x3d58a4){_0x3365dd=_0x3d58a4;_0x20806a=0xc8;}else{_0x20806a=0xce;}_0x17aaa3[_0x3e5b('0x1b')](_0x20806a);return _0x17aaa3[_0x3e5b('0x21')](_0x3e5b('0x22'),_0x555002+'-'+_0x3365dd+'/'+_0x3d58a4)[_0x3e5b('0x1c')](_0x1f81a7);}return null;};}function patchUpdates(_0x447d36){return function(_0x21fc32){try{jsonpatch[_0x3e5b('0x23')](_0x21fc32,_0x447d36,!![]);}catch(_0x3d95f3){return BPromise[_0x3e5b('0x24')](_0x3d95f3);}return _0x21fc32[_0x3e5b('0x25')]();};}function saveUpdates(_0x2d77cc,_0x402873){return function(_0x5b46d4){if(_0x5b46d4){return _0x5b46d4[_0x3e5b('0x26')](_0x2d77cc)[_0x3e5b('0x27')](function(_0x2146d4){return _0x2146d4;});}return null;};}function removeEntity(_0x150674,_0x50039b){return function(_0x1eb80f){if(_0x1eb80f){return _0x1eb80f['destroy']()[_0x3e5b('0x27')](function(){_0x150674[_0x3e5b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41b684,_0x2f6368){return function(_0x42d7e9){if(!_0x42d7e9){_0x41b684[_0x3e5b('0x19')](0x194);}return _0x42d7e9;};}function handleError(_0x3bb749,_0x26c7f2){_0x26c7f2=_0x26c7f2||0x1f4;return function(_0x160e87){logger[_0x3e5b('0x28')](_0x160e87['stack']);if(_0x160e87[_0x3e5b('0x29')]){delete _0x160e87['name'];}_0x3bb749[_0x3e5b('0x1b')](_0x26c7f2)['send'](_0x160e87);};}exports[_0x3e5b('0x2a')]=function(_0x1f6473,_0x1296ec){var _0x475b39={},_0x10d2ed={},_0x3cfaf6={'count':0x0,'rows':[]};var _0x307091=_[_0x3e5b('0x2b')](db[_0x3e5b('0x2c')][_0x3e5b('0x2d')],function(_0x1e1565){return{'name':_0x1e1565['fieldName'],'type':_0x1e1565[_0x3e5b('0x2e')][_0x3e5b('0x2f')]};});_0x10d2ed[_0x3e5b('0x30')]=_[_0x3e5b('0x2b')](_0x307091,_0x3e5b('0x29'));_0x10d2ed[_0x3e5b('0x31')]=_[_0x3e5b('0x32')](_0x1f6473['query']);_0x10d2ed[_0x3e5b('0x33')]=_['intersection'](_0x10d2ed['model'],_0x10d2ed[_0x3e5b('0x31')]);_0x10d2ed[_0x3e5b('0x33')]=_['concat'](_0x10d2ed[_0x3e5b('0x33')],[_0x3e5b('0x34'),_0x3e5b('0x35'),_0x3e5b('0x36'),_0x3e5b('0x37'),_0x3e5b('0x38'),_0x3e5b('0x39'),_0x3e5b('0x3a'),_0x3e5b('0x3b'),_0x3e5b('0x3c'),_0x3e5b('0x3d'),_0x3e5b('0x3e'),'$in',_0x3e5b('0x3f'),_0x3e5b('0x40'),'$notLike','$iLike',_0x3e5b('0x41'),'$like',_0x3e5b('0x42'),_0x3e5b('0x43'),_0x3e5b('0x44'),_0x3e5b('0x45')]);_0x475b39['attributes']=_[_0x3e5b('0x46')](_0x10d2ed['model'],qs[_0x3e5b('0x47')](_0x1f6473['query']['fields']));_0x475b39['attributes']=_0x475b39[_0x3e5b('0x48')][_0x3e5b('0x49')]?_0x475b39[_0x3e5b('0x48')]:_0x10d2ed[_0x3e5b('0x30')];if(!_0x1f6473[_0x3e5b('0x31')][_0x3e5b('0x4a')]('nolimit')){_0x475b39['limit']=qs['limit'](_0x1f6473['query']['limit']);_0x475b39['offset']=qs['offset'](_0x1f6473[_0x3e5b('0x31')][_0x3e5b('0x20')]);}_0x475b39[_0x3e5b('0x4b')]=qs[_0x3e5b('0x4c')](_0x1f6473[_0x3e5b('0x31')][_0x3e5b('0x4c')]);_0x475b39[_0x3e5b('0x4d')]=qs[_0x3e5b('0x33')](_[_0x3e5b('0x4e')](_0x1f6473[_0x3e5b('0x31')],_0x10d2ed[_0x3e5b('0x33')]),_0x307091);if(_0x1f6473['query'][_0x3e5b('0x4f')]){_0x475b39[_0x3e5b('0x4d')]=_[_0x3e5b('0x50')](_0x475b39[_0x3e5b('0x4d')],{'$or':_[_0x3e5b('0x2b')](_0x307091,function(_0xc69499){if(_0xc69499[_0x3e5b('0x2e')]!==_0x3e5b('0x51')){var _0x351d5d={};_0x351d5d[_0xc69499[_0x3e5b('0x29')]]={'$like':'%'+_0x1f6473[_0x3e5b('0x31')]['filter']+'%'};return _0x351d5d;}})});}_0x475b39=_['merge']({},_0x475b39,_0x1f6473['options']);var _0x4a6c66={'where':_0x475b39[_0x3e5b('0x4d')]};return db[_0x3e5b('0x2c')][_0x3e5b('0x1f')](_0x4a6c66)[_0x3e5b('0x27')](function(_0x252cd0){_0x3cfaf6[_0x3e5b('0x1f')]=_0x252cd0;if(_0x1f6473[_0x3e5b('0x31')][_0x3e5b('0x52')]){_0x475b39[_0x3e5b('0x53')]=[{'all':!![]}];}return db[_0x3e5b('0x2c')]['findAll'](_0x475b39);})[_0x3e5b('0x27')](function(_0x28a105){_0x3cfaf6[_0x3e5b('0x54')]=_0x28a105;return _0x3cfaf6;})[_0x3e5b('0x27')](respondWithFilteredResult(_0x1296ec,_0x475b39))[_0x3e5b('0x55')](handleError(_0x1296ec,null));};exports['show']=function(_0x588ee7,_0x495217){var _0x1fbd87={'raw':!![],'where':{'id':_0x588ee7[_0x3e5b('0x56')]['id']}},_0x20af6a={};_0x20af6a['model']=_['keys'](db[_0x3e5b('0x2c')][_0x3e5b('0x2d')]);_0x20af6a[_0x3e5b('0x31')]=_['keys'](_0x588ee7['query']);_0x20af6a[_0x3e5b('0x33')]=_['intersection'](_0x20af6a[_0x3e5b('0x30')],_0x20af6a[_0x3e5b('0x31')]);_0x1fbd87[_0x3e5b('0x48')]=_[_0x3e5b('0x46')](_0x20af6a[_0x3e5b('0x30')],qs[_0x3e5b('0x47')](_0x588ee7[_0x3e5b('0x31')][_0x3e5b('0x47')]));_0x1fbd87[_0x3e5b('0x48')]=_0x1fbd87['attributes'][_0x3e5b('0x49')]?_0x1fbd87['attributes']:_0x20af6a[_0x3e5b('0x30')];if(_0x588ee7[_0x3e5b('0x31')][_0x3e5b('0x52')]){_0x1fbd87[_0x3e5b('0x53')]=[{'all':!![]}];}_0x1fbd87=_[_0x3e5b('0x50')]({},_0x1fbd87,_0x588ee7[_0x3e5b('0x57')]);return db[_0x3e5b('0x2c')][_0x3e5b('0x58')](_0x1fbd87)[_0x3e5b('0x27')](handleEntityNotFound(_0x495217,null))[_0x3e5b('0x27')](respondWithResult(_0x495217,null))[_0x3e5b('0x55')](handleError(_0x495217,null));};exports[_0x3e5b('0x59')]=function(_0x458058,_0x59d311){return db[_0x3e5b('0x2c')][_0x3e5b('0x59')](_0x458058[_0x3e5b('0x5a')],{})[_0x3e5b('0x27')](respondWithResult(_0x59d311,0xc9))[_0x3e5b('0x55')](handleError(_0x59d311,null));};exports[_0x3e5b('0x26')]=function(_0x55b46c,_0x131af1){if(_0x55b46c[_0x3e5b('0x5a')]['id']){delete _0x55b46c[_0x3e5b('0x5a')]['id'];}return db[_0x3e5b('0x2c')][_0x3e5b('0x58')]({'where':{'id':_0x55b46c[_0x3e5b('0x56')]['id']}})[_0x3e5b('0x27')](handleEntityNotFound(_0x131af1,null))[_0x3e5b('0x27')](saveUpdates(_0x55b46c['body'],null))[_0x3e5b('0x27')](respondWithResult(_0x131af1,null))['catch'](handleError(_0x131af1,null));};exports['describe']=function(_0x207176,_0x53000e){return db[_0x3e5b('0x2c')][_0x3e5b('0x5b')]()[_0x3e5b('0x27')](respondWithResult(_0x53000e,null))[_0x3e5b('0x55')](handleError(_0x53000e,null));};exports['destroy']=function(_0x5ddeee,_0x545712){var _0x581b94;var _0x2ab5f3=_0x5ddeee[_0x3e5b('0x56')]['id'];return db[_0x3e5b('0x2c')][_0x3e5b('0x58')]({'where':{'id':_0x5ddeee[_0x3e5b('0x56')]['id']}})['then'](handleEntityNotFound(_0x545712,null))['then'](function(_0xa0a18d){if(_0xa0a18d){return _0xa0a18d[_0x3e5b('0x5c')]()[_0x3e5b('0x27')](function(_0x325f7b){return _0x325f7b;});}})[_0x3e5b('0x27')](function(_0x51efbd){_0x581b94=_0x51efbd;if(_0x51efbd){if(_0x51efbd['VoiceQueueId']||_0x51efbd['CampaignId']){return db[_0x51efbd['VoiceQueueId']?_0x3e5b('0x5d'):_0x3e5b('0x5e')][_0x3e5b('0x58')]({'where':{'id':_0x51efbd[_0x3e5b('0x5f')]?_0x51efbd[_0x3e5b('0x5f')]:_0x51efbd[_0x3e5b('0x60')]},'attributes':['id',_0x3e5b('0x29')],'raw':!![]});}}})[_0x3e5b('0x27')](function(_0x485951){var _0x285db6={};if(_0x485951){_[_0x3e5b('0x50')](_0x285db6,_[_0x3e5b('0x61')](_0x581b94[_0x3e5b('0x62')],[_0x3e5b('0x63'),'updatedAt','id']));_0x285db6[_0x3e5b('0x64')]=0x15;_0x285db6['statedesc']=_0x3e5b('0x65');_0x285db6[_0x3e5b('0x66')]=_0x485951['name'];_0x285db6['membername']=_0x5ddeee['user'][_0x3e5b('0x29')];_0x285db6['UserId']=_0x5ddeee[_0x3e5b('0x67')]['id'];_0x285db6[_0x3e5b('0x65')]=!![];_0x285db6[_0x3e5b('0x68')]=moment()[_0x3e5b('0x69')](_0x3e5b('0x6a'));_0x285db6['calleridnum']=_0x581b94['phone'];_0x285db6[_0x3e5b('0x6b')]=_0x581b94[_0x3e5b('0x5f')]?_0x3e5b('0x6c'):'ivr';return db[_0x3e5b('0x6d')][_0x3e5b('0x58')]({'where':{'id':_0x285db6[_0x3e5b('0x6e')]},'attributes':[_0x3e5b('0x6f'),_0x3e5b('0x70')]})[_0x3e5b('0x27')](function(_0x455594){if(!_[_0x3e5b('0x71')](_0x545712)&&!_[_0x3e5b('0x71')](_0x455594[_0x3e5b('0x6f')])){_0x285db6[_0x3e5b('0x72')]=_0x455594[_0x3e5b('0x6f')];if(!_[_0x3e5b('0x71')](_0x455594[_0x3e5b('0x70')])){_0x285db6[_0x3e5b('0x72')]+='\x20'+_0x455594[_0x3e5b('0x70')];}}})[_0x3e5b('0x73')](function(){return db[_0x3e5b('0x74')]['create'](_0x285db6);});}})[_0x3e5b('0x27')](function(_0x360303){return db['CmHopperAdditionalPhone'][_0x3e5b('0x5c')]({'where':{'CmHopperId':_0x2ab5f3}});})[_0x3e5b('0x27')](function(){return _0x545712['status'](0xcc)['end']();})['catch'](handleError(_0x545712,null));};exports[_0x3e5b('0x75')]=function(_0x465826,_0x498e6d,_0x2929ba){var _0x1f3a1e=[];return db['CmContact'][_0x3e5b('0x5b')]()[_0x3e5b('0x27')](function(_0x43f28f){_0x1f3a1e=_[_0x3e5b('0x32')](_0x43f28f);return _0x465826[_0x3e5b('0x67')][_0x3e5b('0x76')]({'where':{'type':_0x3e5b('0x77'),'dialActive':!![],'dialMethod':_0x3e5b('0x78')},'attributes':['id',_0x3e5b('0x79')],'raw':!![]});})['then'](function(_0x310238){if(_0x310238&&_0x310238[_0x3e5b('0x49')]){return db[_0x3e5b('0x7a')][_0x3e5b('0x7b')](function(_0x1adb46){var _0x1ec1f6={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x3e5b('0x69')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x310238,'id')},'$or':[{'UserId':null},{'UserId':_0x465826[_0x3e5b('0x67')]['id']}]};var _0x3ee33c=[];if(_0x465826['body'][_0x3e5b('0x7c')]&&_0x465826[_0x3e5b('0x5a')][_0x3e5b('0x7c')]===_0x3e5b('0x7d')){if(!_[_0x3e5b('0x7e')](_0x465826[_0x3e5b('0x5a')][_0x3e5b('0x7f')])){_0x1ec1f6['id']={'$in':_0x465826['body'][_0x3e5b('0x7f')]};}_0x3ee33c=[[_0x3e5b('0x80'),'ASC'],['scheduledAt',_0x310238[0x0]['dialOrderByScheduledAt']===_0x3e5b('0x81')?_0x3e5b('0x82'):_0x3e5b('0x81')],db[_0x3e5b('0x7a')][_0x3e5b('0x83')](_0x3e5b('0x84')),['id','DESC']];}else{if(!_[_0x3e5b('0x7e')](_0x465826[_0x3e5b('0x5a')]['hopperIds'])){_0x1ec1f6['id']={'$notIn':_0x465826[_0x3e5b('0x5a')]['hopperIds']};}_0x3ee33c=[['priority',_0x3e5b('0x82')],[_0x3e5b('0x85'),_0x310238[0x0]['dialOrderByScheduledAt']],db[_0x3e5b('0x7a')][_0x3e5b('0x83')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x3e5b('0x81')]];}return db[_0x3e5b('0x2c')][_0x3e5b('0x86')]({'attributes':['id',_0x3e5b('0x87'),_0x3e5b('0x88')],'where':_0x1ec1f6,'order':_0x3ee33c,'transaction':_0x1adb46,'lock':_0x1adb46[_0x3e5b('0x89')]['UPDATE'],'include':[{'model':db['CmContact'],'as':_0x3e5b('0x8a'),'attributes':_0x1f3a1e,'include':[{'model':db['CmCompany'],'as':'Company','attributes':['id',_0x3e5b('0x29')]}]},{'model':db[_0x3e5b('0x8b')],'as':_0x3e5b('0x8c'),'attributes':['id','name']},{'model':db[_0x3e5b('0x5d')],'as':'Queue','attributes':['id',_0x3e5b('0x29'),'dialActive']}]})[_0x3e5b('0x27')](function(_0x923269){if(_0x923269){return _0x923269[_0x3e5b('0x26')]({'UserId':_0x465826[_0x3e5b('0x67')]['id']},{'transaction':_0x1adb46});}});});}})['then'](handleEntityNotFound(_0x498e6d,null))[_0x3e5b('0x27')](respondWithResult(_0x498e6d,null))['catch'](handleError(_0x498e6d,null));};exports[_0x3e5b('0x8d')]=function(_0x8f992f,_0x58ccf3,_0x272ef1){return _0x8f992f[_0x3e5b('0x67')][_0x3e5b('0x76')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x3e5b('0x78')},'attributes':['id'],'raw':!![]})[_0x3e5b('0x27')](function(_0x2085be){if(_0x2085be&&_0x2085be['length']){return db[_0x3e5b('0x2c')][_0x3e5b('0x1f')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x3e5b('0x6a'))},'VoiceQueueId':{'$in':_[_0x3e5b('0x2b')](_0x2085be,'id')},'$or':[{'UserId':null},{'UserId':_0x8f992f[_0x3e5b('0x67')]['id']}]}});}return 0x0;})['then'](function(_0x3b3306){if(!_[_0x3e5b('0x71')](_0x3b3306)&&_[_0x3e5b('0x8e')](_0x3b3306)){return _0x58ccf3[_0x3e5b('0x1b')](0xc8)['json']({'contacts':_0x3b3306});}else{logger[_0x3e5b('0x28')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x3e5b('0x8d'),0x194,'entity\x20not\x20found');_0x58ccf3[_0x3e5b('0x19')](0x194);}})[_0x3e5b('0x55')](handleError(_0x58ccf3,null));}; \ No newline at end of file +var _0x24ca=['to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','limit','undefined','count','offset','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','key','query','filters','intersection','concat','$gt','$gte','$lt','$lte','$ne','$eq','$not','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$any','attributes','model','fields','length','order','sort','where','pick','filter','merge','type','VIRTUAL','CmHopper','includeAll','include','findAll','rows','catch','show','params','keys','options','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','find','omit','dataValues','createdAt','statedesc','membername','user','deleted','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','queue','CmContact','ContactId','lastName','isNil','calleridname','firstName','finally','CmHopperAdditionalPhone','getPreview','getVoiceQueues','preview','dialOrderByScheduledAt','sequelize','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','findOne','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','Queue','getOpenContacts','outbound','format','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox'];(function(_0x57fa70,_0x4dc938){var _0x4fa199=function(_0x229bbf){while(--_0x229bbf){_0x57fa70['push'](_0x57fa70['shift']());}};_0x4fa199(++_0x4dc938);}(_0x24ca,0x1bc));var _0xa24c=function(_0x422be2,_0x1c439e){_0x422be2=_0x422be2-0x0;var _0x1b820e=_0x24ca[_0x422be2];return _0x1b820e;};'use strict';var emlformat=require(_0xa24c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa24c('0x1'));var jsonpatch=require(_0xa24c('0x2'));var rp=require(_0xa24c('0x3'));var moment=require('moment');var BPromise=require(_0xa24c('0x4'));var Mustache=require(_0xa24c('0x5'));var util=require(_0xa24c('0x6'));var path=require(_0xa24c('0x7'));var sox=require(_0xa24c('0x8'));var csv=require(_0xa24c('0x9'));var ejs=require(_0xa24c('0xa'));var fs=require('fs');var fs_extra=require(_0xa24c('0xb'));var _=require(_0xa24c('0xc'));var squel=require(_0xa24c('0xd'));var crypto=require(_0xa24c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa24c('0xf'));var toCsv=require(_0xa24c('0x9'));var querystring=require(_0xa24c('0x10'));var Papa=require('papaparse');var Redis=require(_0xa24c('0x11'));var authService=require(_0xa24c('0x12'));var qs=require(_0xa24c('0x13'));var as=require(_0xa24c('0x14'));var hardwareService=require(_0xa24c('0x15'));var logger=require(_0xa24c('0x16'))(_0xa24c('0x17'));var utils=require(_0xa24c('0x18'));var config=require(_0xa24c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa24c('0x1a'))['db'];function respondWithStatusCode(_0x11090c,_0xcee4fe){_0xcee4fe=_0xcee4fe||0xcc;return function(_0x2c2af8){if(_0x2c2af8){return _0x11090c['sendStatus'](_0xcee4fe);}return _0x11090c[_0xa24c('0x1b')](_0xcee4fe)[_0xa24c('0x1c')]();};}function respondWithResult(_0x26ff28,_0x2fcd8b){_0x2fcd8b=_0x2fcd8b||0xc8;return function(_0x1cb08e){if(_0x1cb08e){return _0x26ff28[_0xa24c('0x1b')](_0x2fcd8b)[_0xa24c('0x1d')](_0x1cb08e);}};}function respondWithFilteredResult(_0x5d4727,_0x47a063){return function(_0xb80781){if(_0xb80781){var _0x87aa90=typeof _0x47a063['offset']==='undefined'&&typeof _0x47a063[_0xa24c('0x1e')]===_0xa24c('0x1f');var _0x5c479e=_0xb80781[_0xa24c('0x20')];var _0x5de3e6=_0x87aa90?0x0:_0x47a063[_0xa24c('0x21')];var _0x2a610a=_0x87aa90?_0xb80781[_0xa24c('0x20')]:_0x47a063[_0xa24c('0x21')]+_0x47a063['limit'];var _0x16d363;if(_0x2a610a>=_0x5c479e){_0x2a610a=_0x5c479e;_0x16d363=0xc8;}else{_0x16d363=0xce;}_0x5d4727[_0xa24c('0x1b')](_0x16d363);return _0x5d4727[_0xa24c('0x22')]('Content-Range',_0x5de3e6+'-'+_0x2a610a+'/'+_0x5c479e)['json'](_0xb80781);}return null;};}function patchUpdates(_0x506424){return function(_0x4cd77e){try{jsonpatch[_0xa24c('0x23')](_0x4cd77e,_0x506424,!![]);}catch(_0x174b69){return BPromise[_0xa24c('0x24')](_0x174b69);}return _0x4cd77e[_0xa24c('0x25')]();};}function saveUpdates(_0x51a275,_0x30ec21){return function(_0x5f299e){if(_0x5f299e){return _0x5f299e[_0xa24c('0x26')](_0x51a275)[_0xa24c('0x27')](function(_0x4a1cda){return _0x4a1cda;});}return null;};}function removeEntity(_0x346ee8,_0x363d52){return function(_0x43a0c0){if(_0x43a0c0){return _0x43a0c0[_0xa24c('0x28')]()[_0xa24c('0x27')](function(){_0x346ee8['status'](0xcc)[_0xa24c('0x1c')]();});}};}function handleEntityNotFound(_0x5cc9cb,_0x2365f9){return function(_0x3951ae){if(!_0x3951ae){_0x5cc9cb[_0xa24c('0x29')](0x194);}return _0x3951ae;};}function handleError(_0x51dc3f,_0x1beb55){_0x1beb55=_0x1beb55||0x1f4;return function(_0x31c4d9){logger[_0xa24c('0x2a')](_0x31c4d9[_0xa24c('0x2b')]);if(_0x31c4d9[_0xa24c('0x2c')]){delete _0x31c4d9[_0xa24c('0x2c')];}_0x51dc3f[_0xa24c('0x1b')](_0x1beb55)['send'](_0x31c4d9);};}exports[_0xa24c('0x2d')]=function(_0x28675f,_0x152120){var _0x12dbdc={},_0x5e491e={},_0x21d2a8={'count':0x0,'rows':[]};var _0xc96ce7=_[_0xa24c('0x2e')](db['CmHopper'][_0xa24c('0x2f')],function(_0x3dcb1b){return{'name':_0x3dcb1b[_0xa24c('0x30')],'type':_0x3dcb1b['type'][_0xa24c('0x31')]};});_0x5e491e['model']=_[_0xa24c('0x2e')](_0xc96ce7,_0xa24c('0x2c'));_0x5e491e[_0xa24c('0x32')]=_['keys'](_0x28675f[_0xa24c('0x32')]);_0x5e491e[_0xa24c('0x33')]=_[_0xa24c('0x34')](_0x5e491e['model'],_0x5e491e[_0xa24c('0x32')]);_0x5e491e['filters']=_[_0xa24c('0x35')](_0x5e491e[_0xa24c('0x33')],['$and','$or',_0xa24c('0x36'),_0xa24c('0x37'),_0xa24c('0x38'),_0xa24c('0x39'),_0xa24c('0x3a'),_0xa24c('0x3b'),_0xa24c('0x3c'),'$between',_0xa24c('0x3d'),_0xa24c('0x3e'),_0xa24c('0x3f'),_0xa24c('0x40'),_0xa24c('0x41'),_0xa24c('0x42'),_0xa24c('0x43'),_0xa24c('0x40'),_0xa24c('0x44'),_0xa24c('0x45'),'$contained',_0xa24c('0x46')]);_0x12dbdc[_0xa24c('0x47')]=_[_0xa24c('0x34')](_0x5e491e[_0xa24c('0x48')],qs['fields'](_0x28675f['query'][_0xa24c('0x49')]));_0x12dbdc['attributes']=_0x12dbdc[_0xa24c('0x47')][_0xa24c('0x4a')]?_0x12dbdc[_0xa24c('0x47')]:_0x5e491e[_0xa24c('0x48')];if(!_0x28675f[_0xa24c('0x32')]['hasOwnProperty']('nolimit')){_0x12dbdc[_0xa24c('0x1e')]=qs[_0xa24c('0x1e')](_0x28675f[_0xa24c('0x32')][_0xa24c('0x1e')]);_0x12dbdc[_0xa24c('0x21')]=qs[_0xa24c('0x21')](_0x28675f['query']['offset']);}_0x12dbdc[_0xa24c('0x4b')]=qs[_0xa24c('0x4c')](_0x28675f[_0xa24c('0x32')][_0xa24c('0x4c')]);_0x12dbdc[_0xa24c('0x4d')]=qs['filters'](_[_0xa24c('0x4e')](_0x28675f[_0xa24c('0x32')],_0x5e491e['filters']),_0xc96ce7);if(_0x28675f['query'][_0xa24c('0x4f')]){_0x12dbdc[_0xa24c('0x4d')]=_[_0xa24c('0x50')](_0x12dbdc['where'],{'$or':_['map'](_0xc96ce7,function(_0x21e204){if(_0x21e204[_0xa24c('0x51')]!==_0xa24c('0x52')){var _0x3ccc37={};_0x3ccc37[_0x21e204[_0xa24c('0x2c')]]={'$like':'%'+_0x28675f[_0xa24c('0x32')][_0xa24c('0x4f')]+'%'};return _0x3ccc37;}})});}_0x12dbdc=_[_0xa24c('0x50')]({},_0x12dbdc,_0x28675f['options']);var _0x4bac9e={'where':_0x12dbdc[_0xa24c('0x4d')]};return db[_0xa24c('0x53')][_0xa24c('0x20')](_0x4bac9e)['then'](function(_0x472c1e){_0x21d2a8[_0xa24c('0x20')]=_0x472c1e;if(_0x28675f[_0xa24c('0x32')][_0xa24c('0x54')]){_0x12dbdc[_0xa24c('0x55')]=[{'all':!![]}];}return db[_0xa24c('0x53')][_0xa24c('0x56')](_0x12dbdc);})[_0xa24c('0x27')](function(_0x3f52fe){_0x21d2a8[_0xa24c('0x57')]=_0x3f52fe;return _0x21d2a8;})['then'](respondWithFilteredResult(_0x152120,_0x12dbdc))[_0xa24c('0x58')](handleError(_0x152120,null));};exports[_0xa24c('0x59')]=function(_0x39a6cd,_0x5aa2b2){var _0x3a85cb={'raw':!![],'where':{'id':_0x39a6cd[_0xa24c('0x5a')]['id']}},_0x247d2c={};_0x247d2c[_0xa24c('0x48')]=_[_0xa24c('0x5b')](db[_0xa24c('0x53')][_0xa24c('0x2f')]);_0x247d2c[_0xa24c('0x32')]=_[_0xa24c('0x5b')](_0x39a6cd[_0xa24c('0x32')]);_0x247d2c[_0xa24c('0x33')]=_['intersection'](_0x247d2c[_0xa24c('0x48')],_0x247d2c[_0xa24c('0x32')]);_0x3a85cb[_0xa24c('0x47')]=_[_0xa24c('0x34')](_0x247d2c[_0xa24c('0x48')],qs[_0xa24c('0x49')](_0x39a6cd[_0xa24c('0x32')][_0xa24c('0x49')]));_0x3a85cb[_0xa24c('0x47')]=_0x3a85cb['attributes']['length']?_0x3a85cb[_0xa24c('0x47')]:_0x247d2c['model'];if(_0x39a6cd[_0xa24c('0x32')][_0xa24c('0x54')]){_0x3a85cb['include']=[{'all':!![]}];}_0x3a85cb=_[_0xa24c('0x50')]({},_0x3a85cb,_0x39a6cd[_0xa24c('0x5c')]);return db[_0xa24c('0x53')]['find'](_0x3a85cb)['then'](handleEntityNotFound(_0x5aa2b2,null))[_0xa24c('0x27')](respondWithResult(_0x5aa2b2,null))['catch'](handleError(_0x5aa2b2,null));};exports[_0xa24c('0x5d')]=function(_0x2a3665,_0x3c3c8b){return db[_0xa24c('0x53')][_0xa24c('0x5d')](_0x2a3665[_0xa24c('0x5e')],{})[_0xa24c('0x27')](respondWithResult(_0x3c3c8b,0xc9))[_0xa24c('0x58')](handleError(_0x3c3c8b,null));};exports[_0xa24c('0x26')]=function(_0xf3498c,_0x4ea43d){if(_0xf3498c[_0xa24c('0x5e')]['id']){delete _0xf3498c[_0xa24c('0x5e')]['id'];}return db[_0xa24c('0x53')]['find']({'where':{'id':_0xf3498c['params']['id']}})['then'](handleEntityNotFound(_0x4ea43d,null))[_0xa24c('0x27')](saveUpdates(_0xf3498c['body'],null))[_0xa24c('0x27')](respondWithResult(_0x4ea43d,null))[_0xa24c('0x58')](handleError(_0x4ea43d,null));};exports['describe']=function(_0x25c6e5,_0x204d33){return db[_0xa24c('0x53')][_0xa24c('0x5f')]()[_0xa24c('0x27')](respondWithResult(_0x204d33,null))[_0xa24c('0x58')](handleError(_0x204d33,null));};exports[_0xa24c('0x28')]=function(_0xbeab78,_0x518c2a){var _0x172645;var _0x47af80=_0xbeab78['params']['id'];return db['CmHopper']['find']({'where':{'id':_0xbeab78['params']['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x518c2a,null))['then'](function(_0x27c184){if(_0x27c184){return _0x27c184[_0xa24c('0x28')]()[_0xa24c('0x27')](function(_0x1a5f17){return _0x1a5f17;});}})[_0xa24c('0x27')](function(_0x2e1feb){_0x172645=_0x2e1feb;if(_0x2e1feb){if(_0x2e1feb[_0xa24c('0x60')]||_0x2e1feb[_0xa24c('0x61')]){return db[_0x2e1feb[_0xa24c('0x60')]?_0xa24c('0x62'):_0xa24c('0x63')][_0xa24c('0x64')]({'where':{'id':_0x2e1feb[_0xa24c('0x60')]?_0x2e1feb[_0xa24c('0x60')]:_0x2e1feb[_0xa24c('0x61')]},'attributes':['id','name'],'raw':!![]});}}})[_0xa24c('0x27')](function(_0x168601){var _0x5264a7={};if(_0x168601){_[_0xa24c('0x50')](_0x5264a7,_[_0xa24c('0x65')](_0x172645[_0xa24c('0x66')],[_0xa24c('0x67'),'updatedAt','id']));_0x5264a7['state']=0x15;_0x5264a7[_0xa24c('0x68')]='deleted';_0x5264a7['campaign']=_0x168601[_0xa24c('0x2c')];_0x5264a7[_0xa24c('0x69')]=_0xbeab78[_0xa24c('0x6a')][_0xa24c('0x2c')];_0x5264a7['UserId']=_0xbeab78['user']['id'];_0x5264a7[_0xa24c('0x6b')]=!![];_0x5264a7['deletedat']=moment()['format'](_0xa24c('0x6c'));_0x5264a7[_0xa24c('0x6d')]=_0x172645[_0xa24c('0x6e')];_0x5264a7['campaigntype']=_0x172645[_0xa24c('0x60')]?_0xa24c('0x6f'):'ivr';return db[_0xa24c('0x70')][_0xa24c('0x64')]({'where':{'id':_0x5264a7[_0xa24c('0x71')]},'attributes':['firstName',_0xa24c('0x72')]})[_0xa24c('0x27')](function(_0x21439a){if(!_[_0xa24c('0x73')](_0x518c2a)&&!_[_0xa24c('0x73')](_0x21439a['firstName'])){_0x5264a7[_0xa24c('0x74')]=_0x21439a[_0xa24c('0x75')];if(!_[_0xa24c('0x73')](_0x21439a[_0xa24c('0x72')])){_0x5264a7[_0xa24c('0x74')]+='\x20'+_0x21439a[_0xa24c('0x72')];}}})[_0xa24c('0x76')](function(){return db['CmHopperFinal'][_0xa24c('0x5d')](_0x5264a7);});}})[_0xa24c('0x27')](function(_0x5c0639){return db[_0xa24c('0x77')][_0xa24c('0x28')]({'where':{'CmHopperId':_0x47af80}});})[_0xa24c('0x27')](function(){return _0x518c2a[_0xa24c('0x1b')](0xcc)[_0xa24c('0x1c')]();})[_0xa24c('0x58')](handleError(_0x518c2a,null));};exports[_0xa24c('0x78')]=function(_0xa32e53,_0x38cc30,_0x32ddc3){var _0x50141e=[];return db[_0xa24c('0x70')][_0xa24c('0x5f')]()[_0xa24c('0x27')](function(_0x5e52f4){_0x50141e=_[_0xa24c('0x5b')](_0x5e52f4);return _0xa32e53[_0xa24c('0x6a')][_0xa24c('0x79')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xa24c('0x7a')},'attributes':['id',_0xa24c('0x7b')],'raw':!![]});})[_0xa24c('0x27')](function(_0xc0f2bc){if(_0xc0f2bc&&_0xc0f2bc[_0xa24c('0x4a')]){return db[_0xa24c('0x7c')]['transaction'](function(_0x4c374d){var _0x361763={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xa24c('0x6c'))},'VoiceQueueId':{'$in':_[_0xa24c('0x2e')](_0xc0f2bc,'id')},'$or':[{'UserId':null},{'UserId':_0xa32e53[_0xa24c('0x6a')]['id']}]};var _0x4073c5=[];if(_0xa32e53[_0xa24c('0x5e')]['direction']&&_0xa32e53[_0xa24c('0x5e')][_0xa24c('0x7d')]===_0xa24c('0x7e')){if(!_[_0xa24c('0x7f')](_0xa32e53[_0xa24c('0x5e')][_0xa24c('0x80')])){_0x361763['id']={'$in':_0xa32e53['body'][_0xa24c('0x80')]};}_0x4073c5=[[_0xa24c('0x81'),_0xa24c('0x82')],[_0xa24c('0x83'),_0xc0f2bc[0x0]['dialOrderByScheduledAt']===_0xa24c('0x82')?'DESC':_0xa24c('0x82')],db[_0xa24c('0x7c')][_0xa24c('0x84')](_0xa24c('0x85')),['id','DESC']];}else{if(!_[_0xa24c('0x7f')](_0xa32e53[_0xa24c('0x5e')]['hopperIds'])){_0x361763['id']={'$notIn':_0xa32e53[_0xa24c('0x5e')][_0xa24c('0x80')]};}_0x4073c5=[[_0xa24c('0x81'),_0xa24c('0x86')],[_0xa24c('0x83'),_0xc0f2bc[0x0][_0xa24c('0x7b')]],db[_0xa24c('0x7c')][_0xa24c('0x84')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0xa24c('0x82')]];}return db[_0xa24c('0x53')][_0xa24c('0x87')]({'attributes':['id',_0xa24c('0x88'),_0xa24c('0x6e')],'where':_0x361763,'order':_0x4073c5,'transaction':_0x4c374d,'lock':_0x4c374d[_0xa24c('0x89')][_0xa24c('0x8a')],'include':[{'model':db[_0xa24c('0x70')],'as':_0xa24c('0x8b'),'attributes':_0x50141e,'include':[{'model':db[_0xa24c('0x8c')],'as':_0xa24c('0x8d'),'attributes':['id','name']}]},{'model':db[_0xa24c('0x8e')],'as':_0xa24c('0x8f'),'attributes':['id','name']},{'model':db[_0xa24c('0x62')],'as':_0xa24c('0x90'),'attributes':['id',_0xa24c('0x2c'),'dialActive']}]})['then'](function(_0xf03c2f){if(_0xf03c2f){return _0xf03c2f[_0xa24c('0x26')]({'UserId':_0xa32e53['user']['id']},{'transaction':_0x4c374d});}});});}})[_0xa24c('0x27')](handleEntityNotFound(_0x38cc30,null))[_0xa24c('0x27')](respondWithResult(_0x38cc30,null))[_0xa24c('0x58')](handleError(_0x38cc30,null));};exports[_0xa24c('0x91')]=function(_0x371c80,_0x336898,_0x5e6e59){return _0x371c80['user']['getVoiceQueues']({'where':{'type':_0xa24c('0x92'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})['then'](function(_0xb3f567){if(_0xb3f567&&_0xb3f567[_0xa24c('0x4a')]){return db[_0xa24c('0x53')][_0xa24c('0x20')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xa24c('0x93')](_0xa24c('0x6c'))},'VoiceQueueId':{'$in':_[_0xa24c('0x2e')](_0xb3f567,'id')},'$or':[{'UserId':null},{'UserId':_0x371c80[_0xa24c('0x6a')]['id']}]}});}return 0x0;})[_0xa24c('0x27')](function(_0x4ee10d){if(!_[_0xa24c('0x73')](_0x4ee10d)&&_[_0xa24c('0x94')](_0x4ee10d)){return _0x336898[_0xa24c('0x1b')](0xc8)[_0xa24c('0x1d')]({'contacts':_0x4ee10d});}else{logger[_0xa24c('0x2a')](_0xa24c('0x95'),_0xa24c('0x91'),0x194,_0xa24c('0x96'));_0x336898[_0xa24c('0x29')](0x194);}})[_0xa24c('0x58')](handleError(_0x336898,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 99bd8ae..fd8a7d9 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 _0xabce=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','cm_hopper','scheduledat','phone','priority','lodash'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xabce,0x103));var _0xeabc=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xabce[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./cmHopper.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('CmHopper',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[{'name':_0xeabc('0xa'),'fields':[_0xeabc('0xa')]},{'name':'phone','fields':[_0xeabc('0xb')]},{'name':_0xeabc('0xc'),'fields':[_0xeabc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2ef3=['path','rimraf','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4bf27a,_0x435cc2){var _0x22a0ba=function(_0x4b442e){while(--_0x4b442e){_0x4bf27a['push'](_0x4bf27a['shift']());}};_0x22a0ba(++_0x435cc2);}(_0x2ef3,0xba));var _0x32ef=function(_0x1d208e,_0x2cbd59){_0x1d208e=_0x1d208e-0x0;var _0x1da542=_0x2ef3[_0x1d208e];return _0x1da542;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[{'name':_0x32ef('0xd'),'fields':[_0x32ef('0xd')]},{'name':_0x32ef('0xe'),'fields':[_0x32ef('0xe')]},{'name':_0x32ef('0xf'),'fields':[_0x32ef('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 9f29d9d..3a62cb6 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 _0xb821=['raw','ShowCmHopper','create','body','CreateCmHopper','UpdateCmHopper','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','order','Contact','keys','User','Agent','name','voicePause','length','UserId','push','update','includes','MoveContactManagedDialer','transaction','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','\x22%s\x22','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','LOCK','UPDATE','all','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopper,\x20%s,\x20%s','message','info','result','catch','CmHopper','findAll','options','where','include','model','map','attributes','GetCmHopper','find'];(function(_0x3902db,_0x594d5b){var _0xda52cf=function(_0x1d220){while(--_0x1d220){_0x3902db['push'](_0x3902db['shift']());}};_0xda52cf(++_0x594d5b);}(_0xb821,0x1d7));var _0x1b82=function(_0x126e4b,_0x505a51){_0x126e4b=_0x126e4b-0x0;var _0x2915e3=_0xb821[_0x126e4b];return _0x2915e3;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var moment=require(_0x1b82('0x1'));var BPromise=require('bluebird');var rs=require(_0x1b82('0x2'));var fs=require('fs');var Redis=require(_0x1b82('0x3'));var db=require(_0x1b82('0x4'))['db'];var utils=require(_0x1b82('0x5'));var logger=require(_0x1b82('0x6'))('rpc');var config=require(_0x1b82('0x7'));var jayson=require(_0x1b82('0x8'));var client=jayson['client'][_0x1b82('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37c758,_0x3a53ad,_0x5ae5a5){return new BPromise(function(_0x5ca3d6,_0x49b45c){return client[_0x1b82('0xa')](_0x37c758,_0x5ae5a5)[_0x1b82('0xb')](function(_0x5e9181){logger['info']('CmHopper,\x20%s,\x20%s',_0x3a53ad,_0x1b82('0xc'));logger[_0x1b82('0xd')](_0x1b82('0xe'),_0x3a53ad,'request\x20sent',JSON[_0x1b82('0xf')](_0x5e9181));if(_0x5e9181[_0x1b82('0x10')]){if(_0x5e9181[_0x1b82('0x10')][_0x1b82('0x11')]===0x1f4){logger['error'](_0x1b82('0x12'),_0x3a53ad,_0x5e9181[_0x1b82('0x10')][_0x1b82('0x13')]);return _0x49b45c(_0x5e9181[_0x1b82('0x10')]['message']);}logger['error']('CmHopper,\x20%s,\x20%s',_0x3a53ad,_0x5e9181[_0x1b82('0x10')][_0x1b82('0x13')]);return _0x5ca3d6(_0x5e9181['error'][_0x1b82('0x13')]);}else{logger[_0x1b82('0x14')](_0x1b82('0x12'),_0x3a53ad,_0x1b82('0xc'));_0x5ca3d6(_0x5e9181[_0x1b82('0x15')][_0x1b82('0x13')]);}})[_0x1b82('0x16')](function(_0x3d986d){logger[_0x1b82('0x10')](_0x1b82('0x12'),_0x3a53ad,_0x3d986d);_0x49b45c(_0x3d986d);});});}exports['GetCmHopper']=function(_0x57e125){var _0x59ef4b=this;return new Promise(function(_0x5b20fa,_0x6921c7){return db[_0x1b82('0x17')][_0x1b82('0x18')]({'raw':_0x57e125['options']?_0x57e125['options']['raw']===undefined?!![]:![]:!![],'where':_0x57e125[_0x1b82('0x19')]?_0x57e125[_0x1b82('0x19')][_0x1b82('0x1a')]||null:null,'attributes':_0x57e125[_0x1b82('0x19')]?_0x57e125[_0x1b82('0x19')]['attributes']||null:null,'limit':_0x57e125[_0x1b82('0x19')]?_0x57e125[_0x1b82('0x19')]['limit']||null:null,'include':_0x57e125['options']?_0x57e125[_0x1b82('0x19')][_0x1b82('0x1b')]?_['map'](_0x57e125[_0x1b82('0x19')][_0x1b82('0x1b')],function(_0x4d0c18){return{'model':db[_0x4d0c18[_0x1b82('0x1c')]],'as':_0x4d0c18['as'],'attributes':_0x4d0c18['attributes'],'include':_0x4d0c18[_0x1b82('0x1b')]?_[_0x1b82('0x1d')](_0x4d0c18['include'],function(_0x1363a3){return{'model':db[_0x1363a3[_0x1b82('0x1c')]],'as':_0x1363a3['as'],'attributes':_0x1363a3[_0x1b82('0x1e')],'include':_0x1363a3[_0x1b82('0x1b')]?_[_0x1b82('0x1d')](_0x1363a3['include'],function(_0x570c13){return{'model':db[_0x570c13[_0x1b82('0x1c')]],'as':_0x570c13['as'],'attributes':_0x570c13[_0x1b82('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1b82('0xb')](function(_0x5adda0){logger[_0x1b82('0x14')](_0x1b82('0x1f'),_0x57e125);logger[_0x1b82('0xd')](_0x1b82('0x1f'),_0x57e125,JSON[_0x1b82('0xf')](_0x5adda0));_0x5b20fa(_0x5adda0);})[_0x1b82('0x16')](function(_0x16c78e){logger[_0x1b82('0x10')](_0x1b82('0x1f'),_0x16c78e[_0x1b82('0x13')],_0x57e125);_0x6921c7(_0x59ef4b[_0x1b82('0x10')](0x1f4,_0x16c78e[_0x1b82('0x13')]));});});};exports['ShowCmHopper']=function(_0x490944){var _0xf0a504=this;return new Promise(function(_0x33bc0d,_0x99fa1){return db[_0x1b82('0x17')][_0x1b82('0x20')]({'raw':_0x490944[_0x1b82('0x19')]?_0x490944['options'][_0x1b82('0x21')]===undefined?!![]:![]:!![],'where':_0x490944[_0x1b82('0x19')]?_0x490944[_0x1b82('0x19')][_0x1b82('0x1a')]||null:null,'attributes':_0x490944[_0x1b82('0x19')]?_0x490944[_0x1b82('0x19')][_0x1b82('0x1e')]||null:null,'include':_0x490944[_0x1b82('0x19')]?_0x490944[_0x1b82('0x19')]['include']?_['map'](_0x490944[_0x1b82('0x19')][_0x1b82('0x1b')],function(_0x4e2300){return{'model':db[_0x4e2300[_0x1b82('0x1c')]],'as':_0x4e2300['as'],'attributes':_0x4e2300[_0x1b82('0x1e')],'include':_0x4e2300[_0x1b82('0x1b')]?_['map'](_0x4e2300[_0x1b82('0x1b')],function(_0x2523fe){return{'model':db[_0x2523fe[_0x1b82('0x1c')]],'as':_0x2523fe['as'],'attributes':_0x2523fe[_0x1b82('0x1e')],'include':_0x2523fe['include']?_[_0x1b82('0x1d')](_0x2523fe['include'],function(_0xa83a5a){return{'model':db[_0xa83a5a[_0x1b82('0x1c')]],'as':_0xa83a5a['as'],'attributes':_0xa83a5a[_0x1b82('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1b82('0xb')](function(_0x347720){logger[_0x1b82('0x14')](_0x1b82('0x22'),_0x490944);logger['debug']('ShowCmHopper',_0x490944,JSON['stringify'](_0x347720));_0x33bc0d(_0x347720);})[_0x1b82('0x16')](function(_0x294646){logger[_0x1b82('0x10')]('ShowCmHopper',_0x294646[_0x1b82('0x13')],_0x490944);_0x99fa1(_0xf0a504[_0x1b82('0x10')](0x1f4,_0x294646[_0x1b82('0x13')]));});});};exports['CreateCmHopper']=function(_0x38413e){var _0x5c8ce7=this;return new Promise(function(_0x37e95b,_0x220ac9){return db['CmHopper'][_0x1b82('0x23')](_0x38413e[_0x1b82('0x24')],{'raw':_0x38413e[_0x1b82('0x19')]?_0x38413e[_0x1b82('0x19')][_0x1b82('0x21')]===undefined?!![]:![]:!![]})[_0x1b82('0xb')](function(_0x19f3ec){logger[_0x1b82('0x14')]('CreateCmHopper',_0x38413e);logger[_0x1b82('0xd')](_0x1b82('0x25'),_0x38413e,JSON[_0x1b82('0xf')](_0x19f3ec));_0x37e95b(_0x19f3ec);})[_0x1b82('0x16')](function(_0x64cb3d){logger['error'](_0x1b82('0x25'),_0x64cb3d['message'],_0x38413e);_0x220ac9(_0x5c8ce7['error'](0x1f4,_0x64cb3d['message']));});});};exports[_0x1b82('0x26')]=function(_0x54aa81){var _0x417389=this;return new Promise(function(_0x324800,_0x5d4f10){return db[_0x1b82('0x17')]['update'](_0x54aa81['body'],{'raw':_0x54aa81[_0x1b82('0x19')]?_0x54aa81['options'][_0x1b82('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54aa81[_0x1b82('0x19')]?_0x54aa81[_0x1b82('0x19')][_0x1b82('0x1a')]||null:null,'attributes':_0x54aa81['options']?_0x54aa81[_0x1b82('0x19')][_0x1b82('0x1e')]||null:null,'limit':_0x54aa81[_0x1b82('0x19')]?_0x54aa81[_0x1b82('0x19')]['limit']||null:null})[_0x1b82('0xb')](function(_0x18f3f7){logger['info'](_0x1b82('0x26'),_0x54aa81);logger[_0x1b82('0xd')](_0x1b82('0x26'),_0x54aa81,JSON[_0x1b82('0xf')](_0x18f3f7));_0x324800(_0x18f3f7);})[_0x1b82('0x16')](function(_0x157ff6){logger[_0x1b82('0x10')](_0x1b82('0x26'),_0x157ff6[_0x1b82('0x13')],_0x54aa81);_0x5d4f10(_0x417389[_0x1b82('0x10')](0x1f4,_0x157ff6['message']));});});};exports[_0x1b82('0x27')]=function(_0x55e90a){var _0x346e81=this;return new Promise(function(_0x4afa9a,_0x1f2db7){return db['CmHopper'][_0x1b82('0x28')]({'where':_0x55e90a[_0x1b82('0x19')]?_0x55e90a['options'][_0x1b82('0x1a')]||null:null})['then'](function(_0x19a914){logger['info']('DestroyCmHopper',_0x55e90a);logger[_0x1b82('0xd')]('DestroyCmHopper',_0x55e90a,JSON[_0x1b82('0xf')](_0x19a914));_0x4afa9a(_0x19a914);})[_0x1b82('0x16')](function(_0x3d11e6){logger['error'](_0x1b82('0x27'),_0x3d11e6[_0x1b82('0x13')],_0x55e90a);_0x1f2db7(_0x346e81['error'](0x1f4,_0x3d11e6[_0x1b82('0x13')]));});});};exports[_0x1b82('0x29')]=function(_0x4979d6){var _0x1548d1=this;return new Promise(function(_0x461c6c,_0x562562){return db[_0x1b82('0x2a')][_0x1b82('0x2b')]()[_0x1b82('0xb')](function(_0x3d10c1){return db[_0x1b82('0x2c')]['transaction'](function(_0x41a2b5){return db['CmHopper'][_0x1b82('0x18')]({'where':_0x4979d6[_0x1b82('0x19')]?_0x4979d6[_0x1b82('0x19')]['where']||null:null,'attributes':_0x4979d6['options']?_0x4979d6[_0x1b82('0x19')][_0x1b82('0x1e')]||null:null,'limit':_0x4979d6[_0x1b82('0x19')]?_0x4979d6[_0x1b82('0x19')]['limit']||null:null,'order':_0x4979d6[_0x1b82('0x19')]?_0x4979d6[_0x1b82('0x19')][_0x1b82('0x2d')]||null:null,'transaction':_0x41a2b5,'lock':_0x41a2b5['LOCK']['UPDATE'],'include':[{'model':db[_0x1b82('0x2a')],'as':_0x1b82('0x2e'),'attributes':_[_0x1b82('0x2f')](_0x3d10c1)},{'model':db[_0x1b82('0x30')],'as':_0x1b82('0x31'),'attributes':['id',_0x1b82('0x32'),_0x1b82('0x33')]}]})[_0x1b82('0xb')](function(_0x3fbe92){var _0x20d14c=[];var _0x1560ff=[];for(var _0x2d0a7c=0x0;_0x2d0a7c<_0x3fbe92[_0x1b82('0x34')];_0x2d0a7c+=0x1){var _0xdc8a6a=_0x3fbe92[_0x2d0a7c][_0x1b82('0x35')];if(_0xdc8a6a===null){_0x20d14c[_0x1b82('0x36')](_0x3fbe92[_0x2d0a7c][_0x1b82('0x37')](_0x4979d6['body'],{'transaction':_0x41a2b5}));}else if(!_0x1560ff[_0x1b82('0x38')](_0xdc8a6a)){_0x1560ff[_0x1b82('0x36')](_0xdc8a6a);_0x20d14c['push'](_0x3fbe92[_0x2d0a7c][_0x1b82('0x37')](_0x4979d6['body'],{'transaction':_0x41a2b5}));}}return BPromise['all'](_0x20d14c);});})[_0x1b82('0xb')](function(_0xbdc055){logger[_0x1b82('0x14')]('GetContactDialer',_0x4979d6);logger['debug'](_0x1b82('0x29'),_0x4979d6,JSON[_0x1b82('0xf')](_0xbdc055));_0x461c6c(_0xbdc055);})[_0x1b82('0x16')](function(_0x5ae519){logger[_0x1b82('0x10')](_0x1b82('0x29'),_0x5ae519[_0x1b82('0x13')],_0x4979d6);_0x562562(_0x1548d1[_0x1b82('0x10')](0x1f4,_0x5ae519[_0x1b82('0x13')]));});});});};exports[_0x1b82('0x39')]=function(_0x58f8ac){var _0x8fca96=this;return new Promise(function(_0xff307b,_0x21cf70){return db[_0x1b82('0x2c')][_0x1b82('0x3a')](function(_0x4c609e){return db['CmHopperFinal']['create'](_0x58f8ac[_0x1b82('0x24')],{'raw':_0x58f8ac['options']?_0x58f8ac['options'][_0x1b82('0x21')]===undefined?!![]:![]:!![],'transaction':_0x4c609e})[_0x1b82('0xb')](function(){return db[_0x1b82('0x17')]['destroy']({'where':_0x58f8ac['options']?_0x58f8ac[_0x1b82('0x19')][_0x1b82('0x1a')]||null:null,'transaction':_0x4c609e});});})[_0x1b82('0xb')](function(_0x1c4122){logger['info'](_0x1b82('0x39'),_0x58f8ac);logger[_0x1b82('0xd')](_0x1b82('0x39'),_0x58f8ac,JSON[_0x1b82('0xf')](_0x1c4122));_0xff307b(_0x1c4122);})[_0x1b82('0x16')](function(_0x4953d8){logger['error']('MoveContactManagedDialer',_0x4953d8[_0x1b82('0x13')],_0x58f8ac);_0x21cf70(_0x8fca96[_0x1b82('0x10')](0x1f4,_0x4953d8['message']));});});};exports[_0x1b82('0x3b')]=function(_0xa0cfc2){var _0x295eb9=this;return new Promise(function(_0x43e684,_0x216c67){return db[_0x1b82('0x17')]['findAll']({'raw':_0xa0cfc2[_0x1b82('0x19')]?_0xa0cfc2[_0x1b82('0x19')][_0x1b82('0x21')]===undefined?!![]:![]:!![],'where':_0xa0cfc2[_0x1b82('0x19')]?_0xa0cfc2[_0x1b82('0x19')][_0x1b82('0x1a')]||null:null,'attributes':[[db[_0x1b82('0x2c')]['fn'](_0x1b82('0x3c'),db[_0x1b82('0x2c')]['fn']('IF',db[_0x1b82('0x2c')][_0x1b82('0x3d')](_0x1b82('0x3e')+util['format'](_0x1b82('0x3f'),moment()[_0x1b82('0x40')](_0x1b82('0x41')))+_0x1b82('0x42')))),_0x1b82('0x43')]]})[_0x1b82('0xb')](function(_0x4e2dd1){logger['info'](_0x1b82('0x3b'),_0xa0cfc2);logger['debug'](_0x1b82('0x3b'),_0xa0cfc2,JSON[_0x1b82('0xf')](_0x4e2dd1));_0x43e684(_0x4e2dd1);})[_0x1b82('0x16')](function(_0x4b7865){logger[_0x1b82('0x10')](_0x1b82('0x3b'),_0x4b7865[_0x1b82('0x13')],_0xa0cfc2);_0x216c67(_0x295eb9[_0x1b82('0x10')](0x1f4,_0x4b7865['message']));});});};exports[_0x1b82('0x44')]=function(_0x848189){var _0x4ee3c2=this;return new Promise(function(_0x2205ef,_0x4f6a20){return db[_0x1b82('0x2a')][_0x1b82('0x2b')]()[_0x1b82('0xb')](function(_0x3c4bc9){return db['sequelize'][_0x1b82('0x3a')](function(_0x23a85c){return db[_0x1b82('0x17')][_0x1b82('0x18')]({'where':_0x848189[_0x1b82('0x19')]?_0x848189[_0x1b82('0x19')][_0x1b82('0x1a')]||null:null,'attributes':_0x848189[_0x1b82('0x19')]?_0x848189[_0x1b82('0x19')][_0x1b82('0x1e')]||null:null,'limit':0x1,'order':_0x848189[_0x1b82('0x19')]?_0x848189[_0x1b82('0x19')][_0x1b82('0x2d')]||null:null,'group':db['CmHopper'][_0x1b82('0x35')],'transaction':_0x23a85c,'lock':_0x23a85c[_0x1b82('0x45')][_0x1b82('0x46')],'include':_0x848189['options']?_0x848189[_0x1b82('0x19')][_0x1b82('0x1b')]?_[_0x1b82('0x1d')](_0x848189['options']['include'],function(_0x302089){return{'model':db[_0x302089[_0x1b82('0x1c')]],'as':_0x302089['as'],'attributes':_0x302089['attributes'],'include':_0x302089[_0x1b82('0x1b')]?_[_0x1b82('0x1d')](_0x302089[_0x1b82('0x1b')],function(_0x47c04f){return{'model':db[_0x47c04f[_0x1b82('0x1c')]],'as':_0x47c04f['as'],'attributes':_0x47c04f[_0x1b82('0x1e')],'include':_0x47c04f[_0x1b82('0x1b')]?_[_0x1b82('0x1d')](_0x47c04f[_0x1b82('0x1b')],function(_0x41e727){return{'model':db[_0x41e727[_0x1b82('0x1c')]],'as':_0x41e727['as'],'attributes':_0x41e727[_0x1b82('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1b82('0xb')](function(_0x3c26fc){var _0x6db296=[];for(var _0x173e9e=0x0;_0x173e9e<_0x3c26fc[_0x1b82('0x34')];_0x173e9e+=0x1){_0x6db296[_0x1b82('0x36')](_0x3c26fc[_0x173e9e][_0x1b82('0x37')](_0x848189[_0x1b82('0x24')],{'transaction':_0x23a85c}));}return BPromise[_0x1b82('0x47')](_0x6db296);});})[_0x1b82('0xb')](function(_0x2bff09){logger[_0x1b82('0x14')](_0x1b82('0x44'),_0x848189);logger[_0x1b82('0xd')]('GetContactRecallMe',_0x848189,JSON[_0x1b82('0xf')](_0x2bff09));_0x2205ef(_0x2bff09);})[_0x1b82('0x16')](function(_0x4d89fc){logger[_0x1b82('0x10')](_0x1b82('0x44'),_0x4d89fc['message'],_0x848189);_0x4f6a20(_0x4ee3c2['error'](0x1f4,_0x4d89fc[_0x1b82('0x13')]));});});});};exports['GetCmHopperPreview']=function(_0x46cb20){var _0x1179dd=this;return new Promise(function(_0x150981,_0x4a7845){db[_0x1b82('0x2a')][_0x1b82('0x2b')]()['then'](function(_0x4060aa){return db[_0x1b82('0x17')][_0x1b82('0x18')]({'raw':_0x46cb20[_0x1b82('0x19')]?_0x46cb20[_0x1b82('0x19')][_0x1b82('0x21')]===undefined?!![]:![]:!![],'where':_0x46cb20[_0x1b82('0x19')]?_0x46cb20[_0x1b82('0x19')][_0x1b82('0x1a')]||null:null,'attributes':_0x46cb20[_0x1b82('0x19')]?_0x46cb20[_0x1b82('0x19')][_0x1b82('0x1e')]||null:null,'limit':_0x46cb20['options']?_0x46cb20['options']['limit']||null:null,'include':_0x46cb20[_0x1b82('0x19')]?_0x46cb20['options'][_0x1b82('0x1b')]?_[_0x1b82('0x1d')](_0x46cb20[_0x1b82('0x19')][_0x1b82('0x1b')],function(_0x544daf){return{'model':db[_0x544daf[_0x1b82('0x1c')]],'as':_0x544daf['as'],'attributes':_0x544daf['as']===_0x1b82('0x2e')?_[_0x1b82('0x2f')](_0x4060aa):_0x544daf[_0x1b82('0x1e')],'include':_0x544daf[_0x1b82('0x1b')]?_[_0x1b82('0x1d')](_0x544daf['include'],function(_0x36c269){return{'model':db[_0x36c269[_0x1b82('0x1c')]],'as':_0x36c269['as'],'attributes':_0x36c269[_0x1b82('0x1e')],'include':_0x36c269['include']?_['map'](_0x36c269[_0x1b82('0x1b')],function(_0x239309){return{'model':db[_0x239309[_0x1b82('0x1c')]],'as':_0x239309['as'],'attributes':_0x239309[_0x1b82('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1b82('0xb')](function(_0x34a20e){logger[_0x1b82('0x14')]('GetCmHopper',_0x46cb20);logger[_0x1b82('0xd')](_0x1b82('0x1f'),_0x46cb20,JSON[_0x1b82('0xf')](_0x34a20e));_0x150981(_0x34a20e);})[_0x1b82('0x16')](function(_0x33a27c){logger['error'](_0x1b82('0x1f'),_0x33a27c[_0x1b82('0x13')],_0x46cb20);_0x4a7845(_0x1179dd['error'](0x1f4,_0x33a27c[_0x1b82('0x13')]));});});});}; \ No newline at end of file +var _0xa1b2=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','map','include','model','stringify','ShowCmHopper','create','CreateCmHopper','UpdateCmHopper','body','DestroyCmHopper','sequelize','transaction','limit','order','LOCK','UPDATE','CmContact','Contact','keys','User','voicePause','length','UserId','push','update','all','GetContactDialer','MoveContactManagedDialer','CmHopperFinal','destroy','CountReScheduled','literal','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','describe','GetCmHopperPreview','util','moment'];(function(_0x3c414c,_0x399dbb){var _0x4f3062=function(_0x1b71cc){while(--_0x1b71cc){_0x3c414c['push'](_0x3c414c['shift']());}};_0x4f3062(++_0x399dbb);}(_0xa1b2,0x10a));var _0x2a1b=function(_0x42e681,_0x4fd811){_0x42e681=_0x42e681-0x0;var _0xe0c02a=_0xa1b2[_0x42e681];return _0xe0c02a;};'use strict';var _=require('lodash');var util=require(_0x2a1b('0x0'));var moment=require(_0x2a1b('0x1'));var BPromise=require('bluebird');var rs=require(_0x2a1b('0x2'));var fs=require('fs');var Redis=require(_0x2a1b('0x3'));var db=require(_0x2a1b('0x4'))['db'];var utils=require(_0x2a1b('0x5'));var logger=require(_0x2a1b('0x6'))(_0x2a1b('0x7'));var config=require('../../config/environment');var jayson=require(_0x2a1b('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x28fb28,_0x31af6a,_0x457520){return new BPromise(function(_0x5c98f2,_0x10c4d3){return client[_0x2a1b('0x9')](_0x28fb28,_0x457520)[_0x2a1b('0xa')](function(_0x16c418){logger[_0x2a1b('0xb')](_0x2a1b('0xc'),_0x31af6a,_0x2a1b('0xd'));logger[_0x2a1b('0xe')](_0x2a1b('0xf'),_0x31af6a,_0x2a1b('0xd'),JSON['stringify'](_0x16c418));if(_0x16c418[_0x2a1b('0x10')]){if(_0x16c418[_0x2a1b('0x10')][_0x2a1b('0x11')]===0x1f4){logger['error'](_0x2a1b('0xc'),_0x31af6a,_0x16c418[_0x2a1b('0x10')][_0x2a1b('0x12')]);return _0x10c4d3(_0x16c418[_0x2a1b('0x10')]['message']);}logger[_0x2a1b('0x10')]('CmHopper,\x20%s,\x20%s',_0x31af6a,_0x16c418['error'][_0x2a1b('0x12')]);return _0x5c98f2(_0x16c418[_0x2a1b('0x10')]['message']);}else{logger['info']('CmHopper,\x20%s,\x20%s',_0x31af6a,'request\x20sent');_0x5c98f2(_0x16c418[_0x2a1b('0x13')][_0x2a1b('0x12')]);}})[_0x2a1b('0x14')](function(_0x3618ef){logger[_0x2a1b('0x10')](_0x2a1b('0xc'),_0x31af6a,_0x3618ef);_0x10c4d3(_0x3618ef);});});}exports[_0x2a1b('0x15')]=function(_0x5d88cb){var _0x21ce5f=this;return new Promise(function(_0x3439f7,_0x3e0a3e){return db[_0x2a1b('0x16')][_0x2a1b('0x17')]({'raw':_0x5d88cb['options']?_0x5d88cb[_0x2a1b('0x18')][_0x2a1b('0x19')]===undefined?!![]:![]:!![],'where':_0x5d88cb[_0x2a1b('0x18')]?_0x5d88cb[_0x2a1b('0x18')][_0x2a1b('0x1a')]||null:null,'attributes':_0x5d88cb[_0x2a1b('0x18')]?_0x5d88cb[_0x2a1b('0x18')][_0x2a1b('0x1b')]||null:null,'limit':_0x5d88cb[_0x2a1b('0x18')]?_0x5d88cb[_0x2a1b('0x18')]['limit']||null:null,'include':_0x5d88cb[_0x2a1b('0x18')]?_0x5d88cb['options']['include']?_[_0x2a1b('0x1c')](_0x5d88cb['options'][_0x2a1b('0x1d')],function(_0x2115ad){return{'model':db[_0x2115ad[_0x2a1b('0x1e')]],'as':_0x2115ad['as'],'attributes':_0x2115ad[_0x2a1b('0x1b')],'include':_0x2115ad['include']?_['map'](_0x2115ad[_0x2a1b('0x1d')],function(_0x237e91){return{'model':db[_0x237e91['model']],'as':_0x237e91['as'],'attributes':_0x237e91[_0x2a1b('0x1b')],'include':_0x237e91[_0x2a1b('0x1d')]?_[_0x2a1b('0x1c')](_0x237e91[_0x2a1b('0x1d')],function(_0x14d7ad){return{'model':db[_0x14d7ad[_0x2a1b('0x1e')]],'as':_0x14d7ad['as'],'attributes':_0x14d7ad[_0x2a1b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2a1b('0xa')](function(_0x2d97e9){logger['info'](_0x2a1b('0x15'),_0x5d88cb);logger['debug']('GetCmHopper',_0x5d88cb,JSON[_0x2a1b('0x1f')](_0x2d97e9));_0x3439f7(_0x2d97e9);})['catch'](function(_0x528cdd){logger['error'](_0x2a1b('0x15'),_0x528cdd[_0x2a1b('0x12')],_0x5d88cb);_0x3e0a3e(_0x21ce5f['error'](0x1f4,_0x528cdd['message']));});});};exports[_0x2a1b('0x20')]=function(_0x3bd246){var _0x2fb0cc=this;return new Promise(function(_0x59e429,_0x2d23c6){return db[_0x2a1b('0x16')]['find']({'raw':_0x3bd246['options']?_0x3bd246[_0x2a1b('0x18')][_0x2a1b('0x19')]===undefined?!![]:![]:!![],'where':_0x3bd246[_0x2a1b('0x18')]?_0x3bd246[_0x2a1b('0x18')][_0x2a1b('0x1a')]||null:null,'attributes':_0x3bd246[_0x2a1b('0x18')]?_0x3bd246[_0x2a1b('0x18')]['attributes']||null:null,'include':_0x3bd246['options']?_0x3bd246[_0x2a1b('0x18')][_0x2a1b('0x1d')]?_[_0x2a1b('0x1c')](_0x3bd246[_0x2a1b('0x18')][_0x2a1b('0x1d')],function(_0x22a275){return{'model':db[_0x22a275[_0x2a1b('0x1e')]],'as':_0x22a275['as'],'attributes':_0x22a275[_0x2a1b('0x1b')],'include':_0x22a275[_0x2a1b('0x1d')]?_[_0x2a1b('0x1c')](_0x22a275[_0x2a1b('0x1d')],function(_0x3e8e96){return{'model':db[_0x3e8e96['model']],'as':_0x3e8e96['as'],'attributes':_0x3e8e96[_0x2a1b('0x1b')],'include':_0x3e8e96[_0x2a1b('0x1d')]?_[_0x2a1b('0x1c')](_0x3e8e96['include'],function(_0xef3bfd){return{'model':db[_0xef3bfd[_0x2a1b('0x1e')]],'as':_0xef3bfd['as'],'attributes':_0xef3bfd['attributes']};}):[]};}):[]};}):[]:[]})[_0x2a1b('0xa')](function(_0x43b331){logger[_0x2a1b('0xb')](_0x2a1b('0x20'),_0x3bd246);logger[_0x2a1b('0xe')]('ShowCmHopper',_0x3bd246,JSON['stringify'](_0x43b331));_0x59e429(_0x43b331);})[_0x2a1b('0x14')](function(_0x3e5984){logger[_0x2a1b('0x10')]('ShowCmHopper',_0x3e5984[_0x2a1b('0x12')],_0x3bd246);_0x2d23c6(_0x2fb0cc[_0x2a1b('0x10')](0x1f4,_0x3e5984[_0x2a1b('0x12')]));});});};exports['CreateCmHopper']=function(_0x563f93){var _0x9c284d=this;return new Promise(function(_0x26abb0,_0x21a988){return db[_0x2a1b('0x16')][_0x2a1b('0x21')](_0x563f93['body'],{'raw':_0x563f93[_0x2a1b('0x18')]?_0x563f93[_0x2a1b('0x18')][_0x2a1b('0x19')]===undefined?!![]:![]:!![]})[_0x2a1b('0xa')](function(_0x511138){logger[_0x2a1b('0xb')](_0x2a1b('0x22'),_0x563f93);logger[_0x2a1b('0xe')](_0x2a1b('0x22'),_0x563f93,JSON[_0x2a1b('0x1f')](_0x511138));_0x26abb0(_0x511138);})[_0x2a1b('0x14')](function(_0x1d3899){logger[_0x2a1b('0x10')](_0x2a1b('0x22'),_0x1d3899[_0x2a1b('0x12')],_0x563f93);_0x21a988(_0x9c284d[_0x2a1b('0x10')](0x1f4,_0x1d3899['message']));});});};exports[_0x2a1b('0x23')]=function(_0x6e6123){var _0x3de592=this;return new Promise(function(_0x12e01c,_0x5c9cdc){return db[_0x2a1b('0x16')]['update'](_0x6e6123[_0x2a1b('0x24')],{'raw':_0x6e6123[_0x2a1b('0x18')]?_0x6e6123['options'][_0x2a1b('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6e6123[_0x2a1b('0x18')]?_0x6e6123[_0x2a1b('0x18')][_0x2a1b('0x1a')]||null:null,'attributes':_0x6e6123['options']?_0x6e6123[_0x2a1b('0x18')][_0x2a1b('0x1b')]||null:null,'limit':_0x6e6123[_0x2a1b('0x18')]?_0x6e6123[_0x2a1b('0x18')]['limit']||null:null})[_0x2a1b('0xa')](function(_0x3a0234){logger[_0x2a1b('0xb')](_0x2a1b('0x23'),_0x6e6123);logger[_0x2a1b('0xe')](_0x2a1b('0x23'),_0x6e6123,JSON[_0x2a1b('0x1f')](_0x3a0234));_0x12e01c(_0x3a0234);})['catch'](function(_0x2fa3c8){logger['error'](_0x2a1b('0x23'),_0x2fa3c8['message'],_0x6e6123);_0x5c9cdc(_0x3de592['error'](0x1f4,_0x2fa3c8[_0x2a1b('0x12')]));});});};exports[_0x2a1b('0x25')]=function(_0x2aab7a){var _0x26a850=this;return new Promise(function(_0x222d31,_0x27a20d){return db['CmHopper']['destroy']({'where':_0x2aab7a[_0x2a1b('0x18')]?_0x2aab7a[_0x2a1b('0x18')][_0x2a1b('0x1a')]||null:null})['then'](function(_0x1995fc){logger[_0x2a1b('0xb')](_0x2a1b('0x25'),_0x2aab7a);logger['debug']('DestroyCmHopper',_0x2aab7a,JSON[_0x2a1b('0x1f')](_0x1995fc));_0x222d31(_0x1995fc);})[_0x2a1b('0x14')](function(_0x46c2ba){logger['error']('DestroyCmHopper',_0x46c2ba[_0x2a1b('0x12')],_0x2aab7a);_0x27a20d(_0x26a850['error'](0x1f4,_0x46c2ba[_0x2a1b('0x12')]));});});};exports['GetContactDialer']=function(_0x1b4933){var _0x599dd2=this;return new Promise(function(_0x49fbb1,_0x4aa165){return db['CmContact']['describe']()[_0x2a1b('0xa')](function(_0x22b598){return db[_0x2a1b('0x26')][_0x2a1b('0x27')](function(_0x15f6e3){return db[_0x2a1b('0x16')][_0x2a1b('0x17')]({'where':_0x1b4933['options']?_0x1b4933['options'][_0x2a1b('0x1a')]||null:null,'attributes':_0x1b4933[_0x2a1b('0x18')]?_0x1b4933[_0x2a1b('0x18')][_0x2a1b('0x1b')]||null:null,'limit':_0x1b4933[_0x2a1b('0x18')]?_0x1b4933['options'][_0x2a1b('0x28')]||null:null,'order':_0x1b4933[_0x2a1b('0x18')]?_0x1b4933[_0x2a1b('0x18')][_0x2a1b('0x29')]||null:null,'transaction':_0x15f6e3,'lock':_0x15f6e3[_0x2a1b('0x2a')][_0x2a1b('0x2b')],'include':[{'model':db[_0x2a1b('0x2c')],'as':_0x2a1b('0x2d'),'attributes':_[_0x2a1b('0x2e')](_0x22b598)},{'model':db[_0x2a1b('0x2f')],'as':'Agent','attributes':['id','name',_0x2a1b('0x30')]}]})[_0x2a1b('0xa')](function(_0x3c3d90){var _0x4c7b54=[];var _0x106540=[];for(var _0x5ad60a=0x0;_0x5ad60a<_0x3c3d90[_0x2a1b('0x31')];_0x5ad60a+=0x1){var _0x4b870e=_0x3c3d90[_0x5ad60a][_0x2a1b('0x32')];if(_0x4b870e===null){_0x4c7b54[_0x2a1b('0x33')](_0x3c3d90[_0x5ad60a]['update'](_0x1b4933[_0x2a1b('0x24')],{'transaction':_0x15f6e3}));}else if(!_0x106540['includes'](_0x4b870e)){_0x106540[_0x2a1b('0x33')](_0x4b870e);_0x4c7b54[_0x2a1b('0x33')](_0x3c3d90[_0x5ad60a][_0x2a1b('0x34')](_0x1b4933['body'],{'transaction':_0x15f6e3}));}}return BPromise[_0x2a1b('0x35')](_0x4c7b54);});})[_0x2a1b('0xa')](function(_0x3bbf63){logger[_0x2a1b('0xb')](_0x2a1b('0x36'),_0x1b4933);logger[_0x2a1b('0xe')](_0x2a1b('0x36'),_0x1b4933,JSON[_0x2a1b('0x1f')](_0x3bbf63));_0x49fbb1(_0x3bbf63);})[_0x2a1b('0x14')](function(_0x21131c){logger[_0x2a1b('0x10')](_0x2a1b('0x36'),_0x21131c[_0x2a1b('0x12')],_0x1b4933);_0x4aa165(_0x599dd2[_0x2a1b('0x10')](0x1f4,_0x21131c[_0x2a1b('0x12')]));});});});};exports[_0x2a1b('0x37')]=function(_0x4635d0){var _0x5b7cbf=this;return new Promise(function(_0x440e94,_0x3688e7){return db[_0x2a1b('0x26')][_0x2a1b('0x27')](function(_0x41dc26){return db[_0x2a1b('0x38')][_0x2a1b('0x21')](_0x4635d0[_0x2a1b('0x24')],{'raw':_0x4635d0[_0x2a1b('0x18')]?_0x4635d0[_0x2a1b('0x18')]['raw']===undefined?!![]:![]:!![],'transaction':_0x41dc26})[_0x2a1b('0xa')](function(){return db[_0x2a1b('0x16')][_0x2a1b('0x39')]({'where':_0x4635d0[_0x2a1b('0x18')]?_0x4635d0['options'][_0x2a1b('0x1a')]||null:null,'transaction':_0x41dc26});});})[_0x2a1b('0xa')](function(_0x1120a8){logger[_0x2a1b('0xb')](_0x2a1b('0x37'),_0x4635d0);logger[_0x2a1b('0xe')]('MoveContactManagedDialer',_0x4635d0,JSON['stringify'](_0x1120a8));_0x440e94(_0x1120a8);})['catch'](function(_0x9e0bba){logger['error'](_0x2a1b('0x37'),_0x9e0bba[_0x2a1b('0x12')],_0x4635d0);_0x3688e7(_0x5b7cbf[_0x2a1b('0x10')](0x1f4,_0x9e0bba[_0x2a1b('0x12')]));});});};exports[_0x2a1b('0x3a')]=function(_0x4b2648){var _0x1f6435=this;return new Promise(function(_0x3879ef,_0x9cef6){return db[_0x2a1b('0x16')]['findAll']({'raw':_0x4b2648[_0x2a1b('0x18')]?_0x4b2648[_0x2a1b('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4b2648[_0x2a1b('0x18')]?_0x4b2648['options'][_0x2a1b('0x1a')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0x2a1b('0x26')]['fn']('IF',db[_0x2a1b('0x26')][_0x2a1b('0x3b')]('`scheduledat`\x20>=\x20'+util[_0x2a1b('0x3c')]('\x22%s\x22',moment()[_0x2a1b('0x3c')](_0x2a1b('0x3d')))+_0x2a1b('0x3e')))),_0x2a1b('0x3f')]]})['then'](function(_0x47771a){logger[_0x2a1b('0xb')](_0x2a1b('0x3a'),_0x4b2648);logger['debug']('CountReScheduled',_0x4b2648,JSON[_0x2a1b('0x1f')](_0x47771a));_0x3879ef(_0x47771a);})[_0x2a1b('0x14')](function(_0x41e22e){logger['error'](_0x2a1b('0x3a'),_0x41e22e[_0x2a1b('0x12')],_0x4b2648);_0x9cef6(_0x1f6435[_0x2a1b('0x10')](0x1f4,_0x41e22e[_0x2a1b('0x12')]));});});};exports[_0x2a1b('0x40')]=function(_0x107e50){var _0x553dcc=this;return new Promise(function(_0x508667,_0x2dbf96){return db[_0x2a1b('0x2c')][_0x2a1b('0x41')]()[_0x2a1b('0xa')](function(_0x456dac){return db['sequelize'][_0x2a1b('0x27')](function(_0x181522){return db[_0x2a1b('0x16')][_0x2a1b('0x17')]({'where':_0x107e50[_0x2a1b('0x18')]?_0x107e50[_0x2a1b('0x18')][_0x2a1b('0x1a')]||null:null,'attributes':_0x107e50[_0x2a1b('0x18')]?_0x107e50['options'][_0x2a1b('0x1b')]||null:null,'limit':0x1,'order':_0x107e50[_0x2a1b('0x18')]?_0x107e50['options']['order']||null:null,'group':db['CmHopper'][_0x2a1b('0x32')],'transaction':_0x181522,'lock':_0x181522['LOCK'][_0x2a1b('0x2b')],'include':_0x107e50[_0x2a1b('0x18')]?_0x107e50[_0x2a1b('0x18')][_0x2a1b('0x1d')]?_[_0x2a1b('0x1c')](_0x107e50[_0x2a1b('0x18')][_0x2a1b('0x1d')],function(_0x22e41f){return{'model':db[_0x22e41f[_0x2a1b('0x1e')]],'as':_0x22e41f['as'],'attributes':_0x22e41f[_0x2a1b('0x1b')],'include':_0x22e41f[_0x2a1b('0x1d')]?_[_0x2a1b('0x1c')](_0x22e41f[_0x2a1b('0x1d')],function(_0x9d0cf6){return{'model':db[_0x9d0cf6[_0x2a1b('0x1e')]],'as':_0x9d0cf6['as'],'attributes':_0x9d0cf6[_0x2a1b('0x1b')],'include':_0x9d0cf6[_0x2a1b('0x1d')]?_['map'](_0x9d0cf6[_0x2a1b('0x1d')],function(_0x119242){return{'model':db[_0x119242[_0x2a1b('0x1e')]],'as':_0x119242['as'],'attributes':_0x119242[_0x2a1b('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xa4f087){var _0x41814a=[];for(var _0x4c896f=0x0;_0x4c896f<_0xa4f087['length'];_0x4c896f+=0x1){_0x41814a['push'](_0xa4f087[_0x4c896f][_0x2a1b('0x34')](_0x107e50[_0x2a1b('0x24')],{'transaction':_0x181522}));}return BPromise[_0x2a1b('0x35')](_0x41814a);});})[_0x2a1b('0xa')](function(_0x4f200a){logger['info'](_0x2a1b('0x40'),_0x107e50);logger['debug'](_0x2a1b('0x40'),_0x107e50,JSON[_0x2a1b('0x1f')](_0x4f200a));_0x508667(_0x4f200a);})[_0x2a1b('0x14')](function(_0x201c36){logger[_0x2a1b('0x10')]('GetContactRecallMe',_0x201c36['message'],_0x107e50);_0x2dbf96(_0x553dcc[_0x2a1b('0x10')](0x1f4,_0x201c36[_0x2a1b('0x12')]));});});});};exports[_0x2a1b('0x42')]=function(_0x267266){var _0x5f2976=this;return new Promise(function(_0xbef56f,_0x28a93d){db[_0x2a1b('0x2c')][_0x2a1b('0x41')]()['then'](function(_0x26f969){return db['CmHopper']['findAll']({'raw':_0x267266[_0x2a1b('0x18')]?_0x267266[_0x2a1b('0x18')][_0x2a1b('0x19')]===undefined?!![]:![]:!![],'where':_0x267266[_0x2a1b('0x18')]?_0x267266[_0x2a1b('0x18')][_0x2a1b('0x1a')]||null:null,'attributes':_0x267266[_0x2a1b('0x18')]?_0x267266[_0x2a1b('0x18')]['attributes']||null:null,'limit':_0x267266[_0x2a1b('0x18')]?_0x267266['options'][_0x2a1b('0x28')]||null:null,'include':_0x267266[_0x2a1b('0x18')]?_0x267266[_0x2a1b('0x18')][_0x2a1b('0x1d')]?_['map'](_0x267266['options'][_0x2a1b('0x1d')],function(_0x1a19f5){return{'model':db[_0x1a19f5['model']],'as':_0x1a19f5['as'],'attributes':_0x1a19f5['as']===_0x2a1b('0x2d')?_['keys'](_0x26f969):_0x1a19f5[_0x2a1b('0x1b')],'include':_0x1a19f5[_0x2a1b('0x1d')]?_['map'](_0x1a19f5[_0x2a1b('0x1d')],function(_0x5a4999){return{'model':db[_0x5a4999[_0x2a1b('0x1e')]],'as':_0x5a4999['as'],'attributes':_0x5a4999['attributes'],'include':_0x5a4999['include']?_['map'](_0x5a4999[_0x2a1b('0x1d')],function(_0x2a608d){return{'model':db[_0x2a608d[_0x2a1b('0x1e')]],'as':_0x2a608d['as'],'attributes':_0x2a608d[_0x2a1b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2a1b('0xa')](function(_0x1280ee){logger[_0x2a1b('0xb')](_0x2a1b('0x15'),_0x267266);logger[_0x2a1b('0xe')](_0x2a1b('0x15'),_0x267266,JSON[_0x2a1b('0x1f')](_0x1280ee));_0xbef56f(_0x1280ee);})['catch'](function(_0x3f37f8){logger[_0x2a1b('0x10')](_0x2a1b('0x15'),_0x3f37f8[_0x2a1b('0x12')],_0x267266);_0x28a93d(_0x5f2976[_0x2a1b('0x10')](0x1f4,_0x3f37f8[_0x2a1b('0x12')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 3602a60..6fb6553 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 _0xab1d=['../../config/environment','./cmHopper.controller','/describe','isAuthenticated','describe','get','/opencontacts','getOpenContacts','/:id','show','post','create','/preview','getPreview','put','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/interaction/service'];(function(_0xb10ff2,_0x16eb90){var _0x2631da=function(_0x52960f){while(--_0x52960f){_0xb10ff2['push'](_0xb10ff2['shift']());}};_0x2631da(++_0x16eb90);}(_0xab1d,0x132));var _0xdab1=function(_0x30482d,_0x751e39){_0x30482d=_0x30482d-0x0;var _0x58f212=_0xab1d[_0x30482d];return _0x58f212;};'use strict';var multer=require(_0xdab1('0x0'));var util=require(_0xdab1('0x1'));var path=require(_0xdab1('0x2'));var timeout=require(_0xdab1('0x3'));var express=require('express');var router=express[_0xdab1('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdab1('0x5'));var config=require(_0xdab1('0x6'));var controller=require(_0xdab1('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xdab1('0x8'),auth[_0xdab1('0x9')](),controller[_0xdab1('0xa')]);router[_0xdab1('0xb')](_0xdab1('0xc'),auth[_0xdab1('0x9')](),controller[_0xdab1('0xd')]);router[_0xdab1('0xb')](_0xdab1('0xe'),auth['isAuthenticated'](),controller[_0xdab1('0xf')]);router[_0xdab1('0x10')]('/',auth[_0xdab1('0x9')](),controller[_0xdab1('0x11')]);router[_0xdab1('0x10')](_0xdab1('0x12'),auth[_0xdab1('0x9')](),controller[_0xdab1('0x13')]);router[_0xdab1('0x14')]('/:id',auth[_0xdab1('0x9')](),controller[_0xdab1('0x15')]);router[_0xdab1('0x16')](_0xdab1('0xe'),auth[_0xdab1('0x9')](),controller[_0xdab1('0x17')]);module['exports']=router; \ No newline at end of file +var _0xf140=['get','/:id','show','post','/preview','put','update','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/opencontacts','getOpenContacts'];(function(_0x5a3efe,_0x39f646){var _0x130b04=function(_0x57b74a){while(--_0x57b74a){_0x5a3efe['push'](_0x5a3efe['shift']());}};_0x130b04(++_0x39f646);}(_0xf140,0x1c1));var _0x0f14=function(_0x4cfb78,_0x4c1da6){_0x4cfb78=_0x4cfb78-0x0;var _0xc1250e=_0xf140[_0x4cfb78];return _0xc1250e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0f14('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0f14('0x1')]();var fs_extra=require(_0x0f14('0x2'));var auth=require(_0x0f14('0x3'));var interaction=require(_0x0f14('0x4'));var config=require(_0x0f14('0x5'));var controller=require('./cmHopper.controller');router['get']('/',auth[_0x0f14('0x6')](),controller[_0x0f14('0x7')]);router['get']('/describe',auth[_0x0f14('0x6')](),controller['describe']);router['get'](_0x0f14('0x8'),auth[_0x0f14('0x6')](),controller[_0x0f14('0x9')]);router[_0x0f14('0xa')](_0x0f14('0xb'),auth[_0x0f14('0x6')](),controller[_0x0f14('0xc')]);router[_0x0f14('0xd')]('/',auth[_0x0f14('0x6')](),controller['create']);router[_0x0f14('0xd')](_0x0f14('0xe'),auth['isAuthenticated'](),controller['getPreview']);router[_0x0f14('0xf')](_0x0f14('0xb'),auth[_0x0f14('0x6')](),controller[_0x0f14('0x10')]);router['delete'](_0x0f14('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index c384657..86fb984 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6a13=['exports','INTEGER','STRING','DATE','format','sequelize'];(function(_0x3a7a9a,_0x560f34){var _0x521a2c=function(_0x68a5d2){while(--_0x68a5d2){_0x3a7a9a['push'](_0x3a7a9a['shift']());}};_0x521a2c(++_0x560f34);}(_0x6a13,0x1c1));var _0x36a1=function(_0x488964,_0x37ddb0){_0x488964=_0x488964-0x0;var _0x404b25=_0x6a13[_0x488964];return _0x404b25;};'use strict';var moment=require('moment');var Sequelize=require(_0x36a1('0x0'));module[_0x36a1('0x1')]={'CmHopperId':{'type':Sequelize[_0x36a1('0x2')]},'phone':{'type':Sequelize[_0x36a1('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x36a1('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x36a1('0x4')],'defaultValue':moment()[_0x36a1('0x5')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x36a1('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x36a1('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x36a1('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x36a1('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x36a1('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x36a1('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb680=['format','YYYY-MM-DD\x20HH:mm:ss','moment','exports','INTEGER','STRING'];(function(_0x519e8d,_0x12b9c0){var _0x1a7d24=function(_0x196c06){while(--_0x196c06){_0x519e8d['push'](_0x519e8d['shift']());}};_0x1a7d24(++_0x12b9c0);}(_0xb680,0x1c4));var _0x0b68=function(_0x3f9a64,_0x224930){_0x3f9a64=_0x3f9a64-0x0;var _0x353b88=_0xb680[_0x3f9a64];return _0x353b88;};'use strict';var moment=require(_0x0b68('0x0'));var Sequelize=require('sequelize');module[_0x0b68('0x1')]={'CmHopperId':{'type':Sequelize[_0x0b68('0x2')]},'phone':{'type':Sequelize[_0x0b68('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x0b68('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x0b68('0x4')](_0x0b68('0x5'))},'countbusyretry':{'type':Sequelize[_0x0b68('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0b68('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0b68('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x0b68('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0b68('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0b68('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0b68('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0b68('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 79caf54..11a8a43 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb8f0=['stack','name','send','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','offset','order','sort','where','filter','merge','includeAll','include','rows','catch','show','params','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','undefined','limit','count','status','set','Content-Range','json','apply','reject','save','update','then','destroy','CmHopperAdditionalPhones','UserProfileResource','error'];(function(_0x129954,_0x17b156){var _0x2b40f2=function(_0x5b3ce1){while(--_0x5b3ce1){_0x129954['push'](_0x129954['shift']());}};_0x2b40f2(++_0x17b156);}(_0xb8f0,0x174));var _0x0b8f=function(_0x3d35b9,_0x1d9037){_0x3d35b9=_0x3d35b9-0x0;var _0x5f19b0=_0xb8f0[_0x3d35b9];return _0x5f19b0;};'use strict';var emlformat=require(_0x0b8f('0x0'));var rimraf=require(_0x0b8f('0x1'));var zipdir=require(_0x0b8f('0x2'));var jsonpatch=require(_0x0b8f('0x3'));var rp=require(_0x0b8f('0x4'));var moment=require(_0x0b8f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0b8f('0x6'));var util=require(_0x0b8f('0x7'));var path=require(_0x0b8f('0x8'));var sox=require(_0x0b8f('0x9'));var csv=require(_0x0b8f('0xa'));var ejs=require(_0x0b8f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0b8f('0xc'));var squel=require(_0x0b8f('0xd'));var crypto=require('crypto');var jsforce=require(_0x0b8f('0xe'));var deskjs=require(_0x0b8f('0xf'));var toCsv=require(_0x0b8f('0xa'));var querystring=require(_0x0b8f('0x10'));var Papa=require(_0x0b8f('0x11'));var Redis=require('ioredis');var authService=require(_0x0b8f('0x12'));var qs=require(_0x0b8f('0x13'));var as=require(_0x0b8f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0b8f('0x15'));var utils=require(_0x0b8f('0x16'));var config=require(_0x0b8f('0x17'));var licenseUtil=require(_0x0b8f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x538117,_0x4e2897){_0x4e2897=_0x4e2897||0xcc;return function(_0x51bbe1){if(_0x51bbe1){return _0x538117[_0x0b8f('0x19')](_0x4e2897);}return _0x538117['status'](_0x4e2897)[_0x0b8f('0x1a')]();};}function respondWithResult(_0x413809,_0x569a8f){_0x569a8f=_0x569a8f||0xc8;return function(_0x245d51){if(_0x245d51){return _0x413809['status'](_0x569a8f)['json'](_0x245d51);}};}function respondWithFilteredResult(_0x164307,_0x5a058d){return function(_0x1c468a){if(_0x1c468a){var _0x42737a=typeof _0x5a058d['offset']===_0x0b8f('0x1b')&&typeof _0x5a058d[_0x0b8f('0x1c')]===_0x0b8f('0x1b');var _0x3fc35a=_0x1c468a[_0x0b8f('0x1d')];var _0x507774=_0x42737a?0x0:_0x5a058d['offset'];var _0x371783=_0x42737a?_0x1c468a[_0x0b8f('0x1d')]:_0x5a058d['offset']+_0x5a058d['limit'];var _0x3c843f;if(_0x371783>=_0x3fc35a){_0x371783=_0x3fc35a;_0x3c843f=0xc8;}else{_0x3c843f=0xce;}_0x164307[_0x0b8f('0x1e')](_0x3c843f);return _0x164307[_0x0b8f('0x1f')](_0x0b8f('0x20'),_0x507774+'-'+_0x371783+'/'+_0x3fc35a)[_0x0b8f('0x21')](_0x1c468a);}return null;};}function patchUpdates(_0x3d5ad0){return function(_0x238146){try{jsonpatch[_0x0b8f('0x22')](_0x238146,_0x3d5ad0,!![]);}catch(_0x45d198){return BPromise[_0x0b8f('0x23')](_0x45d198);}return _0x238146[_0x0b8f('0x24')]();};}function saveUpdates(_0x5360a1,_0x361abc){return function(_0x15fd4d){if(_0x15fd4d){return _0x15fd4d[_0x0b8f('0x25')](_0x5360a1)[_0x0b8f('0x26')](function(_0x3bf226){return _0x3bf226;});}return null;};}function removeEntity(_0x2b0477,_0x5f300a){return function(_0x436afc){if(_0x436afc){return _0x436afc[_0x0b8f('0x27')]()[_0x0b8f('0x26')](function(){var _0x18817f=_0x436afc['get']({'plain':!![]});var _0x15b85b=_0x0b8f('0x28');return db[_0x0b8f('0x29')][_0x0b8f('0x27')]({'where':{'type':_0x15b85b,'resourceId':_0x18817f['id']}})[_0x0b8f('0x26')](function(){return _0x436afc;});})[_0x0b8f('0x26')](function(){_0x2b0477[_0x0b8f('0x1e')](0xcc)[_0x0b8f('0x1a')]();});}};}function handleEntityNotFound(_0x41a132,_0x271edd){return function(_0x168ba8){if(!_0x168ba8){_0x41a132[_0x0b8f('0x19')](0x194);}return _0x168ba8;};}function handleError(_0x3ac8a2,_0x29dc5f){_0x29dc5f=_0x29dc5f||0x1f4;return function(_0x461073){logger[_0x0b8f('0x2a')](_0x461073[_0x0b8f('0x2b')]);if(_0x461073[_0x0b8f('0x2c')]){delete _0x461073[_0x0b8f('0x2c')];}_0x3ac8a2['status'](_0x29dc5f)[_0x0b8f('0x2d')](_0x461073);};}exports['index']=function(_0x4c7985,_0x471573){var _0x39a006={},_0x5272d8={},_0x2d10a4={'count':0x0,'rows':[]};var _0xc141c8=_['map'](db[_0x0b8f('0x2e')][_0x0b8f('0x2f')],function(_0xe0ce2e){return{'name':_0xe0ce2e[_0x0b8f('0x30')],'type':_0xe0ce2e[_0x0b8f('0x31')][_0x0b8f('0x32')]};});_0x5272d8['model']=_[_0x0b8f('0x33')](_0xc141c8,_0x0b8f('0x2c'));_0x5272d8[_0x0b8f('0x34')]=_[_0x0b8f('0x35')](_0x4c7985[_0x0b8f('0x34')]);_0x5272d8[_0x0b8f('0x36')]=_[_0x0b8f('0x37')](_0x5272d8['model'],_0x5272d8[_0x0b8f('0x34')]);_0x39a006['attributes']=_[_0x0b8f('0x37')](_0x5272d8['model'],qs[_0x0b8f('0x38')](_0x4c7985[_0x0b8f('0x34')][_0x0b8f('0x38')]));_0x39a006[_0x0b8f('0x39')]=_0x39a006[_0x0b8f('0x39')][_0x0b8f('0x3a')]?_0x39a006[_0x0b8f('0x39')]:_0x5272d8[_0x0b8f('0x3b')];if(!_0x4c7985[_0x0b8f('0x34')][_0x0b8f('0x3c')](_0x0b8f('0x3d'))){_0x39a006['limit']=qs[_0x0b8f('0x1c')](_0x4c7985[_0x0b8f('0x34')][_0x0b8f('0x1c')]);_0x39a006[_0x0b8f('0x3e')]=qs['offset'](_0x4c7985[_0x0b8f('0x34')]['offset']);}_0x39a006[_0x0b8f('0x3f')]=qs[_0x0b8f('0x40')](_0x4c7985[_0x0b8f('0x34')][_0x0b8f('0x40')]);_0x39a006[_0x0b8f('0x41')]=qs['filters'](_['pick'](_0x4c7985[_0x0b8f('0x34')],_0x5272d8[_0x0b8f('0x36')]),_0xc141c8);if(_0x4c7985[_0x0b8f('0x34')][_0x0b8f('0x42')]){_0x39a006[_0x0b8f('0x41')]=_[_0x0b8f('0x43')](_0x39a006[_0x0b8f('0x41')],{'$or':_[_0x0b8f('0x33')](_0xc141c8,function(_0x43a4ea){if(_0x43a4ea[_0x0b8f('0x31')]!=='VIRTUAL'){var _0x3871f7={};_0x3871f7[_0x43a4ea['name']]={'$like':'%'+_0x4c7985['query'][_0x0b8f('0x42')]+'%'};return _0x3871f7;}})});}_0x39a006=_[_0x0b8f('0x43')]({},_0x39a006,_0x4c7985['options']);var _0x2897a4={'where':_0x39a006[_0x0b8f('0x41')]};return db[_0x0b8f('0x2e')][_0x0b8f('0x1d')](_0x2897a4)[_0x0b8f('0x26')](function(_0x5c8402){_0x2d10a4[_0x0b8f('0x1d')]=_0x5c8402;if(_0x4c7985['query'][_0x0b8f('0x44')]){_0x39a006[_0x0b8f('0x45')]=[{'all':!![]}];}return db[_0x0b8f('0x2e')]['findAll'](_0x39a006);})[_0x0b8f('0x26')](function(_0x37d45b){_0x2d10a4[_0x0b8f('0x46')]=_0x37d45b;return _0x2d10a4;})[_0x0b8f('0x26')](respondWithFilteredResult(_0x471573,_0x39a006))[_0x0b8f('0x47')](handleError(_0x471573,null));};exports[_0x0b8f('0x48')]=function(_0x301c4d,_0x30d7e6){var _0x41307c={'raw':!![],'where':{'id':_0x301c4d[_0x0b8f('0x49')]['id']}},_0x592bf1={};_0x592bf1['model']=_['keys'](db[_0x0b8f('0x2e')][_0x0b8f('0x2f')]);_0x592bf1[_0x0b8f('0x34')]=_[_0x0b8f('0x35')](_0x301c4d[_0x0b8f('0x34')]);_0x592bf1[_0x0b8f('0x36')]=_[_0x0b8f('0x37')](_0x592bf1['model'],_0x592bf1[_0x0b8f('0x34')]);_0x41307c[_0x0b8f('0x39')]=_[_0x0b8f('0x37')](_0x592bf1[_0x0b8f('0x3b')],qs[_0x0b8f('0x38')](_0x301c4d[_0x0b8f('0x34')][_0x0b8f('0x38')]));_0x41307c[_0x0b8f('0x39')]=_0x41307c['attributes'][_0x0b8f('0x3a')]?_0x41307c['attributes']:_0x592bf1[_0x0b8f('0x3b')];if(_0x301c4d['query'][_0x0b8f('0x44')]){_0x41307c[_0x0b8f('0x45')]=[{'all':!![]}];}_0x41307c=_[_0x0b8f('0x43')]({},_0x41307c,_0x301c4d[_0x0b8f('0x4a')]);return db['CmHopperAdditionalPhone'][_0x0b8f('0x4b')](_0x41307c)[_0x0b8f('0x26')](handleEntityNotFound(_0x30d7e6,null))[_0x0b8f('0x26')](respondWithResult(_0x30d7e6,null))[_0x0b8f('0x47')](handleError(_0x30d7e6,null));};exports[_0x0b8f('0x4c')]=function(_0x489768,_0x2aaac3){return db['CmHopperAdditionalPhone'][_0x0b8f('0x4c')](_0x489768['body'],{})['then'](function(_0x1b859c){var _0x42e6d3=_0x489768[_0x0b8f('0x4d')][_0x0b8f('0x4e')]({'plain':!![]});if(!_0x42e6d3)throw new Error(_0x0b8f('0x4f'));if(_0x42e6d3['role']===_0x0b8f('0x4d')){var _0x518a20=_0x1b859c[_0x0b8f('0x4e')]({'plain':!![]});var _0x4d1387=_0x0b8f('0x28');return db['UserProfileSection'][_0x0b8f('0x4b')]({'where':{'name':_0x4d1387,'userProfileId':_0x42e6d3[_0x0b8f('0x50')]},'raw':!![]})[_0x0b8f('0x26')](function(_0x22c97f){if(_0x22c97f&&_0x22c97f[_0x0b8f('0x51')]===0x0){return db['UserProfileResource'][_0x0b8f('0x4c')]({'name':_0x518a20[_0x0b8f('0x2c')],'resourceId':_0x518a20['id'],'type':_0x22c97f[_0x0b8f('0x2c')],'sectionId':_0x22c97f['id']},{})['then'](function(){return _0x1b859c;});}else{return _0x1b859c;}})[_0x0b8f('0x47')](function(_0x387e87){logger[_0x0b8f('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x387e87);throw _0x387e87;});}return _0x1b859c;})[_0x0b8f('0x26')](respondWithResult(_0x2aaac3,0xc9))[_0x0b8f('0x47')](handleError(_0x2aaac3,null));};exports[_0x0b8f('0x25')]=function(_0x2331e5,_0x49542f){if(_0x2331e5[_0x0b8f('0x52')]['id']){delete _0x2331e5[_0x0b8f('0x52')]['id'];}return db[_0x0b8f('0x2e')][_0x0b8f('0x4b')]({'where':{'id':_0x2331e5[_0x0b8f('0x49')]['id']}})['then'](handleEntityNotFound(_0x49542f,null))[_0x0b8f('0x26')](saveUpdates(_0x2331e5['body'],null))['then'](respondWithResult(_0x49542f,null))['catch'](handleError(_0x49542f,null));};exports[_0x0b8f('0x27')]=function(_0xc90e4f,_0x55f355){return db['CmHopperAdditionalPhone']['find']({'where':{'id':_0xc90e4f[_0x0b8f('0x49')]['id']}})['then'](handleEntityNotFound(_0x55f355,null))['then'](removeEntity(_0x55f355,null))[_0x0b8f('0x47')](handleError(_0x55f355,null));}; \ No newline at end of file +var _0xb68b=['to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','end','error','stack','name','send','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','find','catch','create','user','get','CmHopperAdditionalPhones','UserProfileSection','autoAssociation','UserProfileResource','update','body','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x43e315,_0x18f41b){var _0x236dc1=function(_0x168eb9){while(--_0x168eb9){_0x43e315['push'](_0x43e315['shift']());}};_0x236dc1(++_0x18f41b);}(_0xb68b,0x132));var _0xbb68=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xb68b[_0x599f41];return _0x2e4d58;};'use strict';var emlformat=require(_0xbb68('0x0'));var rimraf=require(_0xbb68('0x1'));var zipdir=require(_0xbb68('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbb68('0x3'));var BPromise=require(_0xbb68('0x4'));var Mustache=require(_0xbb68('0x5'));var util=require('util');var path=require(_0xbb68('0x6'));var sox=require(_0xbb68('0x7'));var csv=require('to-csv');var ejs=require(_0xbb68('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbb68('0x9'));var squel=require(_0xbb68('0xa'));var crypto=require(_0xbb68('0xb'));var jsforce=require(_0xbb68('0xc'));var deskjs=require(_0xbb68('0xd'));var toCsv=require(_0xbb68('0xe'));var querystring=require(_0xbb68('0xf'));var Papa=require(_0xbb68('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbb68('0x11'));var as=require(_0xbb68('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbb68('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xbb68('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1df775,_0x51925e){_0x51925e=_0x51925e||0xcc;return function(_0x34e9ba){if(_0x34e9ba){return _0x1df775[_0xbb68('0x15')](_0x51925e);}return _0x1df775['status'](_0x51925e)['end']();};}function respondWithResult(_0x52a2a8,_0x554cc8){_0x554cc8=_0x554cc8||0xc8;return function(_0x3b2508){if(_0x3b2508){return _0x52a2a8[_0xbb68('0x16')](_0x554cc8)[_0xbb68('0x17')](_0x3b2508);}};}function respondWithFilteredResult(_0x1a44f5,_0x402fd4){return function(_0x2faf2f){if(_0x2faf2f){var _0x422d7d=typeof _0x402fd4[_0xbb68('0x18')]===_0xbb68('0x19')&&typeof _0x402fd4[_0xbb68('0x1a')]===_0xbb68('0x19');var _0x2216c3=_0x2faf2f[_0xbb68('0x1b')];var _0x2990f2=_0x422d7d?0x0:_0x402fd4['offset'];var _0x4a93cc=_0x422d7d?_0x2faf2f['count']:_0x402fd4['offset']+_0x402fd4[_0xbb68('0x1a')];var _0x18b122;if(_0x4a93cc>=_0x2216c3){_0x4a93cc=_0x2216c3;_0x18b122=0xc8;}else{_0x18b122=0xce;}_0x1a44f5[_0xbb68('0x16')](_0x18b122);return _0x1a44f5[_0xbb68('0x1c')](_0xbb68('0x1d'),_0x2990f2+'-'+_0x4a93cc+'/'+_0x2216c3)[_0xbb68('0x17')](_0x2faf2f);}return null;};}function patchUpdates(_0x517d9e){return function(_0x113cfa){try{jsonpatch[_0xbb68('0x1e')](_0x113cfa,_0x517d9e,!![]);}catch(_0x28dc15){return BPromise[_0xbb68('0x1f')](_0x28dc15);}return _0x113cfa[_0xbb68('0x20')]();};}function saveUpdates(_0x538c5b,_0x193325){return function(_0x1e42be){if(_0x1e42be){return _0x1e42be['update'](_0x538c5b)['then'](function(_0x74f74f){return _0x74f74f;});}return null;};}function removeEntity(_0x1e8645,_0xd212db){return function(_0x2a2353){if(_0x2a2353){return _0x2a2353[_0xbb68('0x21')]()['then'](function(){var _0x1e8b9a=_0x2a2353['get']({'plain':!![]});var _0x59256d='CmHopperAdditionalPhones';return db['UserProfileResource'][_0xbb68('0x21')]({'where':{'type':_0x59256d,'resourceId':_0x1e8b9a['id']}})[_0xbb68('0x22')](function(){return _0x2a2353;});})[_0xbb68('0x22')](function(){_0x1e8645[_0xbb68('0x16')](0xcc)[_0xbb68('0x23')]();});}};}function handleEntityNotFound(_0x4ad27b,_0xc5c8c1){return function(_0x2a0f32){if(!_0x2a0f32){_0x4ad27b[_0xbb68('0x15')](0x194);}return _0x2a0f32;};}function handleError(_0x27a13c,_0x1501ad){_0x1501ad=_0x1501ad||0x1f4;return function(_0x1a80c6){logger[_0xbb68('0x24')](_0x1a80c6[_0xbb68('0x25')]);if(_0x1a80c6[_0xbb68('0x26')]){delete _0x1a80c6[_0xbb68('0x26')];}_0x27a13c['status'](_0x1501ad)[_0xbb68('0x27')](_0x1a80c6);};}exports['index']=function(_0x3926e5,_0x2cacc2){var _0x132161={},_0x27a7f5={},_0x5477bd={'count':0x0,'rows':[]};var _0x4fef5d=_['map'](db[_0xbb68('0x28')][_0xbb68('0x29')],function(_0x5b1aec){return{'name':_0x5b1aec[_0xbb68('0x2a')],'type':_0x5b1aec[_0xbb68('0x2b')][_0xbb68('0x2c')]};});_0x27a7f5['model']=_['map'](_0x4fef5d,_0xbb68('0x26'));_0x27a7f5['query']=_[_0xbb68('0x2d')](_0x3926e5[_0xbb68('0x2e')]);_0x27a7f5[_0xbb68('0x2f')]=_[_0xbb68('0x30')](_0x27a7f5['model'],_0x27a7f5[_0xbb68('0x2e')]);_0x132161[_0xbb68('0x31')]=_[_0xbb68('0x30')](_0x27a7f5['model'],qs[_0xbb68('0x32')](_0x3926e5[_0xbb68('0x2e')][_0xbb68('0x32')]));_0x132161[_0xbb68('0x31')]=_0x132161[_0xbb68('0x31')][_0xbb68('0x33')]?_0x132161[_0xbb68('0x31')]:_0x27a7f5[_0xbb68('0x34')];if(!_0x3926e5[_0xbb68('0x2e')][_0xbb68('0x35')](_0xbb68('0x36'))){_0x132161[_0xbb68('0x1a')]=qs[_0xbb68('0x1a')](_0x3926e5[_0xbb68('0x2e')][_0xbb68('0x1a')]);_0x132161[_0xbb68('0x18')]=qs[_0xbb68('0x18')](_0x3926e5[_0xbb68('0x2e')][_0xbb68('0x18')]);}_0x132161[_0xbb68('0x37')]=qs['sort'](_0x3926e5[_0xbb68('0x2e')][_0xbb68('0x38')]);_0x132161[_0xbb68('0x39')]=qs[_0xbb68('0x2f')](_[_0xbb68('0x3a')](_0x3926e5['query'],_0x27a7f5['filters']),_0x4fef5d);if(_0x3926e5[_0xbb68('0x2e')]['filter']){_0x132161['where']=_[_0xbb68('0x3b')](_0x132161[_0xbb68('0x39')],{'$or':_[_0xbb68('0x3c')](_0x4fef5d,function(_0x5112a1){if(_0x5112a1[_0xbb68('0x2b')]!==_0xbb68('0x3d')){var _0x421bdb={};_0x421bdb[_0x5112a1[_0xbb68('0x26')]]={'$like':'%'+_0x3926e5[_0xbb68('0x2e')][_0xbb68('0x3e')]+'%'};return _0x421bdb;}})});}_0x132161=_[_0xbb68('0x3b')]({},_0x132161,_0x3926e5[_0xbb68('0x3f')]);var _0x148711={'where':_0x132161[_0xbb68('0x39')]};return db[_0xbb68('0x28')][_0xbb68('0x1b')](_0x148711)[_0xbb68('0x22')](function(_0x353cc9){_0x5477bd[_0xbb68('0x1b')]=_0x353cc9;if(_0x3926e5[_0xbb68('0x2e')][_0xbb68('0x40')]){_0x132161[_0xbb68('0x41')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone'][_0xbb68('0x42')](_0x132161);})[_0xbb68('0x22')](function(_0x16df99){_0x5477bd[_0xbb68('0x43')]=_0x16df99;return _0x5477bd;})[_0xbb68('0x22')](respondWithFilteredResult(_0x2cacc2,_0x132161))['catch'](handleError(_0x2cacc2,null));};exports['show']=function(_0x2f11b3,_0x2e147f){var _0x233d11={'raw':!![],'where':{'id':_0x2f11b3[_0xbb68('0x44')]['id']}},_0x99f45c={};_0x99f45c[_0xbb68('0x34')]=_[_0xbb68('0x2d')](db[_0xbb68('0x28')][_0xbb68('0x29')]);_0x99f45c[_0xbb68('0x2e')]=_[_0xbb68('0x2d')](_0x2f11b3[_0xbb68('0x2e')]);_0x99f45c[_0xbb68('0x2f')]=_[_0xbb68('0x30')](_0x99f45c[_0xbb68('0x34')],_0x99f45c['query']);_0x233d11['attributes']=_[_0xbb68('0x30')](_0x99f45c[_0xbb68('0x34')],qs['fields'](_0x2f11b3[_0xbb68('0x2e')][_0xbb68('0x32')]));_0x233d11[_0xbb68('0x31')]=_0x233d11[_0xbb68('0x31')][_0xbb68('0x33')]?_0x233d11[_0xbb68('0x31')]:_0x99f45c[_0xbb68('0x34')];if(_0x2f11b3[_0xbb68('0x2e')]['includeAll']){_0x233d11[_0xbb68('0x41')]=[{'all':!![]}];}_0x233d11=_[_0xbb68('0x3b')]({},_0x233d11,_0x2f11b3[_0xbb68('0x3f')]);return db['CmHopperAdditionalPhone'][_0xbb68('0x45')](_0x233d11)[_0xbb68('0x22')](handleEntityNotFound(_0x2e147f,null))[_0xbb68('0x22')](respondWithResult(_0x2e147f,null))[_0xbb68('0x46')](handleError(_0x2e147f,null));};exports[_0xbb68('0x47')]=function(_0x2e90b6,_0x355299){return db[_0xbb68('0x28')][_0xbb68('0x47')](_0x2e90b6['body'],{})[_0xbb68('0x22')](function(_0x1aa401){var _0x4e0431=_0x2e90b6[_0xbb68('0x48')][_0xbb68('0x49')]({'plain':!![]});if(!_0x4e0431)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4e0431['role']===_0xbb68('0x48')){var _0x4c924f=_0x1aa401[_0xbb68('0x49')]({'plain':!![]});var _0x4779c0=_0xbb68('0x4a');return db[_0xbb68('0x4b')][_0xbb68('0x45')]({'where':{'name':_0x4779c0,'userProfileId':_0x4e0431['userProfileId']},'raw':!![]})[_0xbb68('0x22')](function(_0x4ff7e6){if(_0x4ff7e6&&_0x4ff7e6[_0xbb68('0x4c')]===0x0){return db[_0xbb68('0x4d')][_0xbb68('0x47')]({'name':_0x4c924f[_0xbb68('0x26')],'resourceId':_0x4c924f['id'],'type':_0x4ff7e6[_0xbb68('0x26')],'sectionId':_0x4ff7e6['id']},{})[_0xbb68('0x22')](function(){return _0x1aa401;});}else{return _0x1aa401;}})['catch'](function(_0x5b5330){logger[_0xbb68('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b5330);throw _0x5b5330;});}return _0x1aa401;})[_0xbb68('0x22')](respondWithResult(_0x355299,0xc9))['catch'](handleError(_0x355299,null));};exports[_0xbb68('0x4e')]=function(_0x2c0385,_0x159eb8){if(_0x2c0385['body']['id']){delete _0x2c0385[_0xbb68('0x4f')]['id'];}return db[_0xbb68('0x28')][_0xbb68('0x45')]({'where':{'id':_0x2c0385['params']['id']}})[_0xbb68('0x22')](handleEntityNotFound(_0x159eb8,null))['then'](saveUpdates(_0x2c0385[_0xbb68('0x4f')],null))[_0xbb68('0x22')](respondWithResult(_0x159eb8,null))[_0xbb68('0x46')](handleError(_0x159eb8,null));};exports[_0xbb68('0x21')]=function(_0xc2bb35,_0x7e257a){return db['CmHopperAdditionalPhone'][_0xbb68('0x45')]({'where':{'id':_0xc2bb35[_0xbb68('0x44')]['id']}})[_0xbb68('0x22')](handleEntityNotFound(_0x7e257a,null))[_0xbb68('0x22')](removeEntity(_0x7e257a,null))[_0xbb68('0x46')](handleError(_0x7e257a,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index ae563a6..54a6802 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9d3f=['lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones'];(function(_0x35007a,_0x58a0d4){var _0x574f68=function(_0xd1c129){while(--_0xd1c129){_0x35007a['push'](_0x35007a['shift']());}};_0x574f68(++_0x58a0d4);}(_0x9d3f,0x1b8));var _0xf9d3=function(_0x29714b,_0x5c8856){_0x29714b=_0x29714b-0x0;var _0x219de9=_0x9d3f[_0x29714b];return _0x219de9;};'use strict';var _=require(_0xf9d3('0x0'));var util=require(_0xf9d3('0x1'));var logger=require(_0xf9d3('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf9d3('0x3'));var rp=require(_0xf9d3('0x4'));var fs=require('fs');var path=require(_0xf9d3('0x5'));var rimraf=require('rimraf');var config=require(_0xf9d3('0x6'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0xf9d3('0x7')]=function(_0x48c971,_0x49c1d8){return _0x48c971[_0xf9d3('0x8')](_0xf9d3('0x9'),attributes,{'tableName':_0xf9d3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x683f=['define','cm_hopper_additional_phones','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports'];(function(_0x3a5b19,_0x167b03){var _0x1ff912=function(_0x4153c0){while(--_0x4153c0){_0x3a5b19['push'](_0x3a5b19['shift']());}};_0x1ff912(++_0x167b03);}(_0x683f,0x18e));var _0xf683=function(_0x57643b,_0x1706fe){_0x57643b=_0x57643b-0x0;var _0x53a35b=_0x683f[_0x57643b];return _0x53a35b;};'use strict';var _=require(_0xf683('0x0'));var util=require(_0xf683('0x1'));var logger=require(_0xf683('0x2'))(_0xf683('0x3'));var moment=require('moment');var BPromise=require(_0xf683('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf683('0x5'));var config=require(_0xf683('0x6'));var attributes=require(_0xf683('0x7'));module[_0xf683('0x8')]=function(_0x53e1c4,_0x46b9a3){return _0x53e1c4[_0xf683('0x9')]('CmHopperAdditionalPhone',attributes,{'tableName':_0xf683('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index ef7a8ab..7786bc3 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0177=['result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','VoiceQueueId','CampaignId','then','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countnoanswerretry','countabandonedretry','countagentrejectretry','entity','dialGlobalMaxRetry','countcongestionretry','countnosuchnumberretry','countdropretry','countmachineretry','SwapAdditionalPhones','ListId','duration','waitTime','minutes','scheduledat','add','phone','isNil','createdAt','updatedAt','hopperToAdd','additionalToHop','sequelize','transaction','update','IncrementPreviewCounters','field','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x47e9dc,_0x347e4e){var _0x58e385=function(_0x4cf524){while(--_0x4cf524){_0x47e9dc['push'](_0x47e9dc['shift']());}};_0x58e385(++_0x347e4e);}(_0x0177,0x197));var _0x7017=function(_0x113e13,_0x55459c){_0x113e13=_0x113e13-0x0;var _0x54c79a=_0x0177[_0x113e13];return _0x54c79a;};'use strict';var _=require(_0x7017('0x0'));var util=require(_0x7017('0x1'));var moment=require(_0x7017('0x2'));var BPromise=require(_0x7017('0x3'));var rs=require(_0x7017('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7017('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7017('0x6'))(_0x7017('0x7'));var config=require('../../config/environment');var jayson=require(_0x7017('0x8'));var client=jayson['client'][_0x7017('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d54bd,_0x237e18,_0x268a64){return new BPromise(function(_0x3922b5,_0x3cbe76){return client[_0x7017('0xa')](_0x5d54bd,_0x268a64)['then'](function(_0x30e160){logger[_0x7017('0xb')](_0x7017('0xc'),_0x237e18,_0x7017('0xd'));logger[_0x7017('0xe')](_0x7017('0xf'),_0x237e18,_0x7017('0xd'),JSON[_0x7017('0x10')](_0x30e160));if(_0x30e160['error']){if(_0x30e160[_0x7017('0x11')][_0x7017('0x12')]===0x1f4){logger[_0x7017('0x11')](_0x7017('0xc'),_0x237e18,_0x30e160[_0x7017('0x11')][_0x7017('0x13')]);return _0x3cbe76(_0x30e160[_0x7017('0x11')][_0x7017('0x13')]);}logger['error'](_0x7017('0xc'),_0x237e18,_0x30e160[_0x7017('0x11')]['message']);return _0x3922b5(_0x30e160['error'][_0x7017('0x13')]);}else{logger[_0x7017('0xb')](_0x7017('0xc'),_0x237e18,_0x7017('0xd'));_0x3922b5(_0x30e160[_0x7017('0x14')][_0x7017('0x13')]);}})[_0x7017('0x15')](function(_0xb8a193){logger[_0x7017('0x11')](_0x7017('0xc'),_0x237e18,_0xb8a193);_0x3cbe76(_0xb8a193);});});}exports[_0x7017('0x16')]=function(_0x4d49da){var _0x500232=this;return new Promise(function(_0x4fde1c,_0x613e6){return db[_0x7017('0x17')][_0x7017('0x18')]({'raw':!![],'where':{'ContactId':_0x4d49da[_0x7017('0x19')][_0x7017('0x1a')],'ListId':_0x4d49da[_0x7017('0x19')]['ListId'],'VoiceQueueId':_0x4d49da[_0x7017('0x19')][_0x7017('0x1b')]===undefined?null:_0x4d49da['body'][_0x7017('0x1b')],'CampaignId':_0x4d49da['body'][_0x7017('0x1c')]===undefined?null:_0x4d49da[_0x7017('0x19')][_0x7017('0x1c')]}})[_0x7017('0x1d')](function(_0x58cae1){if(_0x58cae1!=null){return db[_0x7017('0x1e')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x58cae1['id'],'OrderBy':{'$gt':_0x58cae1[_0x7017('0x1f')]}},'order':[[_0x7017('0x1f'),_0x7017('0x20')]]})[_0x7017('0x1d')](function(_0x5925dd){var _0x50282b=0x0;if(_0x5925dd){if(_0x5925dd[_0x7017('0x21')]+_0x5925dd['countcongestionretry']+_0x5925dd[_0x7017('0x22')]+_0x5925dd['countnosuchnumberretry']+_0x5925dd['countdropretry']+_0x5925dd[_0x7017('0x23')]+_0x5925dd['countmachineretry']+_0x5925dd[_0x7017('0x24')]<_0x4d49da[_0x7017('0x25')][_0x7017('0x26')])_0x50282b=0x1;_0x4fde1c({'additional':_0x50282b});}else{return db[_0x7017('0x1e')][_0x7017('0x18')]({'raw':!![],'where':{'CmHopperId':_0x58cae1['id']},'order':[[_0x7017('0x1f'),'ASC']]})[_0x7017('0x1d')](function(_0xf09e78){var _0x1a109f=0x0;if(_0xf09e78){if(_0xf09e78[_0x7017('0x21')]+_0xf09e78[_0x7017('0x27')]+_0xf09e78[_0x7017('0x22')]+_0xf09e78[_0x7017('0x28')]+_0xf09e78[_0x7017('0x29')]+_0xf09e78[_0x7017('0x23')]+_0xf09e78[_0x7017('0x2a')]+_0xf09e78[_0x7017('0x24')]<_0x4d49da['entity'][_0x7017('0x26')])_0x1a109f=0x1;_0x4fde1c({'additional':_0x1a109f});}else{_0x4fde1c({'additional':0x0});}})[_0x7017('0x15')](function(_0x25a858){logger[_0x7017('0x11')](_0x7017('0x16'),_0x25a858[_0x7017('0x13')],_0x4d49da);_0x613e6(_0x500232[_0x7017('0x11')](0x1f4,_0x25a858[_0x7017('0x13')]));});}})[_0x7017('0x15')](function(_0x15adab){logger[_0x7017('0x11')]('VerifyAdditionalPhones',_0x15adab['message'],_0x4d49da);_0x613e6(_0x500232[_0x7017('0x11')](0x1f4,_0x15adab[_0x7017('0x13')]));});}else _0x4fde1c({'additional':0x0});});});};exports[_0x7017('0x2b')]=function(_0x23c2c5){var _0x4ed53c=this;return new Promise(function(_0x33838f,_0x3f3805){return db[_0x7017('0x17')][_0x7017('0x18')]({'raw':!![],'where':{'ContactId':_0x23c2c5['body'][_0x7017('0x1a')],'ListId':_0x23c2c5[_0x7017('0x19')][_0x7017('0x2c')],'VoiceQueueId':_0x23c2c5[_0x7017('0x19')][_0x7017('0x1b')]===undefined?null:_0x23c2c5[_0x7017('0x19')][_0x7017('0x1b')],'CampaignId':_0x23c2c5[_0x7017('0x19')]['CampaignId']===undefined?null:_0x23c2c5['body'][_0x7017('0x1c')]}})[_0x7017('0x1d')](function(_0x353c5d){if(_0x353c5d!=null){return db[_0x7017('0x1e')][_0x7017('0x18')]({'raw':!![],'where':{'CmHopperId':_0x353c5d['id'],'OrderBy':{'$gte':_0x353c5d[_0x7017('0x1f')]}},'order':[[_0x7017('0x1f'),_0x7017('0x20')]]})['then'](function(_0x59348b){if(_0x59348b)return activateAdditionalPhone(_0x353c5d,_0x23c2c5[_0x7017('0x19')],_0x59348b,_0x23c2c5[_0x7017('0x2d')],_0x23c2c5[_0x7017('0x2e')])['then'](function(_0x286512){_0x33838f(_0x286512);});else{return db[_0x7017('0x1e')][_0x7017('0x18')]({'raw':!![],'where':{'CmHopperId':_0x353c5d['id']},'order':[[_0x7017('0x1f'),'ASC']]})['then'](function(_0x34a112){if(_0x34a112)return activateAdditionalPhone(_0x353c5d,_0x23c2c5[_0x7017('0x19')],_0x34a112,_0x23c2c5[_0x7017('0x2d')],_0x23c2c5[_0x7017('0x2e')])[_0x7017('0x1d')](function(_0x439201){_0x33838f(_0x439201);});else{_0x33838f({'id':_0x353c5d['id'],'phone':''});}})[_0x7017('0x15')](function(_0x1d09de){logger[_0x7017('0x11')]('VerifyAdditionalPhones',_0x1d09de[_0x7017('0x13')],_0x23c2c5);_0x3f3805(_0x4ed53c[_0x7017('0x11')](0x1f4,_0x1d09de['message']));});}})[_0x7017('0x15')](function(_0x2e9aae){logger[_0x7017('0x11')](_0x7017('0x16'),_0x2e9aae[_0x7017('0x13')],_0x23c2c5);_0x3f3805(_0x4ed53c[_0x7017('0x11')](0x1f4,_0x2e9aae['message']));});}else _0x33838f(0x1);});});};function activateAdditionalPhone(_0x3abcef,_0x4c77a1,_0x2d1332,_0x2e5570,_0x4dac6f){return new Promise(function(_0x5d5fe4,_0x41d00c){logger[_0x7017('0xb')](_0x7017('0x16'),_0x2d1332);var _0x2b4a47;if(moment()>moment(_0x2d1332['scheduledat'])){_0x2b4a47=moment()['add'](_0x4dac6f||0x3,_0x7017('0x2f'));}else{if(_0x2d1332[_0x7017('0x1f')]==0x0){_0x2b4a47=moment(_0x2d1332[_0x7017('0x30')]);}else{_0x2b4a47=moment()[_0x7017('0x31')](_0x4dac6f||0x3,_0x7017('0x2f'));}}var _0x44d607={'phone':_0x3abcef[_0x7017('0x32')],'active':0x0,'OrderBy':_[_0x7017('0x33')](_0x3abcef['OrderBy'])?0x0:_0x3abcef[_0x7017('0x1f')],'scheduledat':moment()[_0x7017('0x31')](_0x2e5570||0x1,'minutes'),'countbusyretry':_0x4c77a1[_0x7017('0x21')],'countcongestionretry':_0x4c77a1[_0x7017('0x27')],'countnoanswerretry':_0x4c77a1[_0x7017('0x22')],'countnosuchnumberretry':_0x4c77a1[_0x7017('0x28')],'countdropretry':_0x4c77a1['countdropretry'],'countabandonedretry':_0x4c77a1[_0x7017('0x23')],'countmachineretry':_0x4c77a1[_0x7017('0x2a')],'countagentrejectretry':_0x4c77a1[_0x7017('0x24')],'createdAt':_0x4c77a1[_0x7017('0x34')],'updatedAt':_0x4c77a1[_0x7017('0x35')]};var _0x41798a={'CmHopperId':_0x3abcef['id'],'phone':_0x2d1332[_0x7017('0x32')],'active':0x0,'OrderBy':_[_0x7017('0x33')](_0x2d1332['OrderBy'])?0x0:_0x2d1332[_0x7017('0x1f')],'scheduledat':_0x2b4a47,'countbusyretry':_0x2d1332[_0x7017('0x21')],'countcongestionretry':_0x2d1332[_0x7017('0x27')],'countnoanswerretry':_0x2d1332[_0x7017('0x22')],'countnosuchnumberretry':_0x2d1332[_0x7017('0x28')],'countdropretry':_0x2d1332[_0x7017('0x29')],'countabandonedretry':_0x2d1332[_0x7017('0x23')],'countmachineretry':_0x2d1332[_0x7017('0x2a')],'countagentrejectretry':_0x2d1332[_0x7017('0x24')],'createdAt':_0x2d1332[_0x7017('0x34')],'updatedAt':_0x2d1332[_0x7017('0x35')]};logger[_0x7017('0xb')](_0x7017('0x36'),_0x44d607);logger['info'](_0x7017('0x37'),_0x41798a);return db[_0x7017('0x38')][_0x7017('0x39')](function(_0x329328){return db[_0x7017('0x1e')][_0x7017('0x3a')](_0x44d607,{'where':{'id':_0x2d1332['id']}},{'transaction':_0x329328})[_0x7017('0x1d')](function(){return db[_0x7017('0x17')][_0x7017('0x3a')](_0x41798a,{'where':{'id':_0x3abcef['id']}},{'transaction':_0x329328});});})[_0x7017('0x1d')](function(_0x24875e){_0x5d5fe4({'id':_0x3abcef['id'],'phone':_0x2d1332[_0x7017('0x32')]});})[_0x7017('0x15')](function(_0x1de5a7){logger[_0x7017('0x11')](_0x7017('0x16'),_0x1de5a7[_0x7017('0x13')],req);_0x41d00c(_this[_0x7017('0x11')](0x1f4,_0x1de5a7[_0x7017('0x13')]));});});}exports[_0x7017('0x3b')]=function(_0x458e19){var _0xcc24b6=this;return new Promise(function(_0x4eb91e,_0x31c4da){return db[_0x7017('0x17')][_0x7017('0x3a')](_0x458e19[_0x7017('0x19')][_0x7017('0x3c')],{'where':{'id':_0x458e19[_0x7017('0x19')]['id']}})[_0x7017('0x1d')](function(_0xcedb4a){_0x4eb91e(_0xcedb4a);})[_0x7017('0x15')](function(_0x3edbba){logger['error'](_0x7017('0x3b'),_0x3edbba[_0x7017('0x13')],_0x458e19);_0x31c4da(_0xcc24b6[_0x7017('0x11')](0x1f4,_0x3edbba[_0x7017('0x13')]));});});}; \ No newline at end of file +var _0x32cc=['IncrementPreviewCounters','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','code','message','info','result','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','OrderBy','ASC','countbusyretry','countcongestionretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','CmHopperAdditionalPhone','countnoanswerretry','countnosuchnumberretry','countdropretry','catch','SwapAdditionalPhones','waitTime','duration','add','minutes','scheduledat','phone','isNil','createdAt','updatedAt','hopperToAdd','sequelize','update','field'];(function(_0x3c6a0e,_0x37245a){var _0x1ec0d1=function(_0x560a38){while(--_0x560a38){_0x3c6a0e['push'](_0x3c6a0e['shift']());}};_0x1ec0d1(++_0x37245a);}(_0x32cc,0xb5));var _0xc32c=function(_0x103297,_0x5f288a){_0x103297=_0x103297-0x0;var _0x2231e2=_0x32cc[_0x103297];return _0x2231e2;};'use strict';var _=require(_0xc32c('0x0'));var util=require(_0xc32c('0x1'));var moment=require(_0xc32c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc32c('0x3'));var db=require(_0xc32c('0x4'))['db'];var utils=require(_0xc32c('0x5'));var logger=require(_0xc32c('0x6'))(_0xc32c('0x7'));var config=require(_0xc32c('0x8'));var jayson=require(_0xc32c('0x9'));var client=jayson[_0xc32c('0xa')][_0xc32c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3e5a22,_0x420a51,_0x4ac766){return new BPromise(function(_0x14b548,_0x4a44df){return client[_0xc32c('0xc')](_0x3e5a22,_0x4ac766)[_0xc32c('0xd')](function(_0x3eaffc){logger['info'](_0xc32c('0xe'),_0x420a51,_0xc32c('0xf'));logger[_0xc32c('0x10')](_0xc32c('0x11'),_0x420a51,'request\x20sent',JSON['stringify'](_0x3eaffc));if(_0x3eaffc[_0xc32c('0x12')]){if(_0x3eaffc[_0xc32c('0x12')][_0xc32c('0x13')]===0x1f4){logger[_0xc32c('0x12')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x420a51,_0x3eaffc[_0xc32c('0x12')][_0xc32c('0x14')]);return _0x4a44df(_0x3eaffc[_0xc32c('0x12')]['message']);}logger[_0xc32c('0x12')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x420a51,_0x3eaffc[_0xc32c('0x12')][_0xc32c('0x14')]);return _0x14b548(_0x3eaffc['error'][_0xc32c('0x14')]);}else{logger[_0xc32c('0x15')](_0xc32c('0xe'),_0x420a51,_0xc32c('0xf'));_0x14b548(_0x3eaffc[_0xc32c('0x16')][_0xc32c('0x14')]);}})['catch'](function(_0x39bbc8){logger[_0xc32c('0x12')](_0xc32c('0xe'),_0x420a51,_0x39bbc8);_0x4a44df(_0x39bbc8);});});}exports[_0xc32c('0x17')]=function(_0x8213){var _0x366bd8=this;return new Promise(function(_0x364a96,_0x438c8){return db[_0xc32c('0x18')][_0xc32c('0x19')]({'raw':!![],'where':{'ContactId':_0x8213[_0xc32c('0x1a')][_0xc32c('0x1b')],'ListId':_0x8213[_0xc32c('0x1a')][_0xc32c('0x1c')],'VoiceQueueId':_0x8213[_0xc32c('0x1a')][_0xc32c('0x1d')]===undefined?null:_0x8213['body'][_0xc32c('0x1d')],'CampaignId':_0x8213['body'][_0xc32c('0x1e')]===undefined?null:_0x8213['body'][_0xc32c('0x1e')]}})[_0xc32c('0xd')](function(_0x187f74){if(_0x187f74!=null){return db['CmHopperAdditionalPhone'][_0xc32c('0x19')]({'raw':!![],'where':{'CmHopperId':_0x187f74['id'],'OrderBy':{'$gt':_0x187f74[_0xc32c('0x1f')]}},'order':[[_0xc32c('0x1f'),_0xc32c('0x20')]]})[_0xc32c('0xd')](function(_0x55fbfb){var _0x255a09=0x0;if(_0x55fbfb){if(_0x55fbfb[_0xc32c('0x21')]+_0x55fbfb[_0xc32c('0x22')]+_0x55fbfb['countnoanswerretry']+_0x55fbfb['countnosuchnumberretry']+_0x55fbfb['countdropretry']+_0x55fbfb[_0xc32c('0x23')]+_0x55fbfb[_0xc32c('0x24')]+_0x55fbfb[_0xc32c('0x25')]<_0x8213[_0xc32c('0x26')][_0xc32c('0x27')])_0x255a09=0x1;_0x364a96({'additional':_0x255a09});}else{return db[_0xc32c('0x28')][_0xc32c('0x19')]({'raw':!![],'where':{'CmHopperId':_0x187f74['id']},'order':[[_0xc32c('0x1f'),_0xc32c('0x20')]]})[_0xc32c('0xd')](function(_0x2bdf2f){var _0x3e0e3d=0x0;if(_0x2bdf2f){if(_0x2bdf2f['countbusyretry']+_0x2bdf2f[_0xc32c('0x22')]+_0x2bdf2f[_0xc32c('0x29')]+_0x2bdf2f[_0xc32c('0x2a')]+_0x2bdf2f[_0xc32c('0x2b')]+_0x2bdf2f[_0xc32c('0x23')]+_0x2bdf2f[_0xc32c('0x24')]+_0x2bdf2f['countagentrejectretry']<_0x8213[_0xc32c('0x26')][_0xc32c('0x27')])_0x3e0e3d=0x1;_0x364a96({'additional':_0x3e0e3d});}else{_0x364a96({'additional':0x0});}})['catch'](function(_0x41d0b9){logger[_0xc32c('0x12')]('VerifyAdditionalPhones',_0x41d0b9[_0xc32c('0x14')],_0x8213);_0x438c8(_0x366bd8['error'](0x1f4,_0x41d0b9[_0xc32c('0x14')]));});}})[_0xc32c('0x2c')](function(_0x49b1d2){logger[_0xc32c('0x12')](_0xc32c('0x17'),_0x49b1d2[_0xc32c('0x14')],_0x8213);_0x438c8(_0x366bd8[_0xc32c('0x12')](0x1f4,_0x49b1d2[_0xc32c('0x14')]));});}else _0x364a96({'additional':0x0});});});};exports[_0xc32c('0x2d')]=function(_0x6ab534){var _0x38937f=this;return new Promise(function(_0x46e3c2,_0x4016ff){return db[_0xc32c('0x18')]['findOne']({'raw':!![],'where':{'ContactId':_0x6ab534[_0xc32c('0x1a')]['ContactId'],'ListId':_0x6ab534[_0xc32c('0x1a')][_0xc32c('0x1c')],'VoiceQueueId':_0x6ab534[_0xc32c('0x1a')]['VoiceQueueId']===undefined?null:_0x6ab534[_0xc32c('0x1a')]['VoiceQueueId'],'CampaignId':_0x6ab534[_0xc32c('0x1a')][_0xc32c('0x1e')]===undefined?null:_0x6ab534[_0xc32c('0x1a')]['CampaignId']}})[_0xc32c('0xd')](function(_0x4684ca){if(_0x4684ca!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x4684ca['id'],'OrderBy':{'$gte':_0x4684ca[_0xc32c('0x1f')]}},'order':[[_0xc32c('0x1f'),_0xc32c('0x20')]]})[_0xc32c('0xd')](function(_0x4489f6){if(_0x4489f6)return activateAdditionalPhone(_0x4684ca,_0x6ab534[_0xc32c('0x1a')],_0x4489f6,_0x6ab534['duration'],_0x6ab534[_0xc32c('0x2e')])['then'](function(_0x523ddc){_0x46e3c2(_0x523ddc);});else{return db[_0xc32c('0x28')][_0xc32c('0x19')]({'raw':!![],'where':{'CmHopperId':_0x4684ca['id']},'order':[[_0xc32c('0x1f'),_0xc32c('0x20')]]})[_0xc32c('0xd')](function(_0x258cf3){if(_0x258cf3)return activateAdditionalPhone(_0x4684ca,_0x6ab534['body'],_0x258cf3,_0x6ab534[_0xc32c('0x2f')],_0x6ab534[_0xc32c('0x2e')])[_0xc32c('0xd')](function(_0x4441b2){_0x46e3c2(_0x4441b2);});else{_0x46e3c2({'id':_0x4684ca['id'],'phone':''});}})[_0xc32c('0x2c')](function(_0x9cd93d){logger[_0xc32c('0x12')](_0xc32c('0x17'),_0x9cd93d[_0xc32c('0x14')],_0x6ab534);_0x4016ff(_0x38937f[_0xc32c('0x12')](0x1f4,_0x9cd93d[_0xc32c('0x14')]));});}})['catch'](function(_0x22f6bb){logger['error']('VerifyAdditionalPhones',_0x22f6bb[_0xc32c('0x14')],_0x6ab534);_0x4016ff(_0x38937f['error'](0x1f4,_0x22f6bb[_0xc32c('0x14')]));});}else _0x46e3c2(0x1);});});};function activateAdditionalPhone(_0x2fa04b,_0x4ddbb3,_0x3b0739,_0x5f2d1e,_0x5d45db){return new Promise(function(_0x158753,_0x3bdf2a){logger['info'](_0xc32c('0x17'),_0x3b0739);var _0x2cdfc3;if(moment()>moment(_0x3b0739['scheduledat'])){_0x2cdfc3=moment()[_0xc32c('0x30')](_0x5d45db||0x3,_0xc32c('0x31'));}else{if(_0x3b0739[_0xc32c('0x1f')]==0x0){_0x2cdfc3=moment(_0x3b0739[_0xc32c('0x32')]);}else{_0x2cdfc3=moment()[_0xc32c('0x30')](_0x5d45db||0x3,_0xc32c('0x31'));}}var _0x53761d={'phone':_0x2fa04b[_0xc32c('0x33')],'active':0x0,'OrderBy':_[_0xc32c('0x34')](_0x2fa04b[_0xc32c('0x1f')])?0x0:_0x2fa04b['OrderBy'],'scheduledat':moment()['add'](_0x5f2d1e||0x1,_0xc32c('0x31')),'countbusyretry':_0x4ddbb3[_0xc32c('0x21')],'countcongestionretry':_0x4ddbb3['countcongestionretry'],'countnoanswerretry':_0x4ddbb3[_0xc32c('0x29')],'countnosuchnumberretry':_0x4ddbb3[_0xc32c('0x2a')],'countdropretry':_0x4ddbb3['countdropretry'],'countabandonedretry':_0x4ddbb3[_0xc32c('0x23')],'countmachineretry':_0x4ddbb3['countmachineretry'],'countagentrejectretry':_0x4ddbb3[_0xc32c('0x25')],'createdAt':_0x4ddbb3[_0xc32c('0x35')],'updatedAt':_0x4ddbb3[_0xc32c('0x36')]};var _0x326bc1={'CmHopperId':_0x2fa04b['id'],'phone':_0x3b0739['phone'],'active':0x0,'OrderBy':_[_0xc32c('0x34')](_0x3b0739['OrderBy'])?0x0:_0x3b0739[_0xc32c('0x1f')],'scheduledat':_0x2cdfc3,'countbusyretry':_0x3b0739['countbusyretry'],'countcongestionretry':_0x3b0739[_0xc32c('0x22')],'countnoanswerretry':_0x3b0739['countnoanswerretry'],'countnosuchnumberretry':_0x3b0739['countnosuchnumberretry'],'countdropretry':_0x3b0739[_0xc32c('0x2b')],'countabandonedretry':_0x3b0739['countabandonedretry'],'countmachineretry':_0x3b0739[_0xc32c('0x24')],'countagentrejectretry':_0x3b0739[_0xc32c('0x25')],'createdAt':_0x3b0739[_0xc32c('0x35')],'updatedAt':_0x3b0739[_0xc32c('0x36')]};logger['info'](_0xc32c('0x37'),_0x53761d);logger[_0xc32c('0x15')]('additionalToHop',_0x326bc1);return db[_0xc32c('0x38')]['transaction'](function(_0x2d5510){return db[_0xc32c('0x28')][_0xc32c('0x39')](_0x53761d,{'where':{'id':_0x3b0739['id']}},{'transaction':_0x2d5510})[_0xc32c('0xd')](function(){return db[_0xc32c('0x18')][_0xc32c('0x39')](_0x326bc1,{'where':{'id':_0x2fa04b['id']}},{'transaction':_0x2d5510});});})['then'](function(_0x31029d){_0x158753({'id':_0x2fa04b['id'],'phone':_0x3b0739['phone']});})['catch'](function(_0x4aa9a9){logger[_0xc32c('0x12')](_0xc32c('0x17'),_0x4aa9a9[_0xc32c('0x14')],req);_0x3bdf2a(_this[_0xc32c('0x12')](0x1f4,_0x4aa9a9[_0xc32c('0x14')]));});});}exports['IncrementPreviewCounters']=function(_0xe00764){var _0x35a476=this;return new Promise(function(_0x1b4c47,_0x12e648){return db['CmHopper'][_0xc32c('0x39')](_0xe00764[_0xc32c('0x1a')][_0xc32c('0x3a')],{'where':{'id':_0xe00764[_0xc32c('0x1a')]['id']}})[_0xc32c('0xd')](function(_0x2c776b){_0x1b4c47(_0x2c776b);})[_0xc32c('0x2c')](function(_0x135a28){logger['error'](_0xc32c('0x3b'),_0x135a28[_0xc32c('0x14')],_0xe00764);_0x12e648(_0x35a476[_0xc32c('0x12')](0x1f4,_0x135a28[_0xc32c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index f8e6101..e8b3585 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeff6=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','post','create','put','/:id','update','destroy','multer','util','path'];(function(_0x4b8806,_0x5d473f){var _0x1e7f0e=function(_0x3637ec){while(--_0x3637ec){_0x4b8806['push'](_0x4b8806['shift']());}};_0x1e7f0e(++_0x5d473f);}(_0xeff6,0xf9));var _0x6eff=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xeff6[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x6eff('0x0'));var util=require(_0x6eff('0x1'));var path=require(_0x6eff('0x2'));var timeout=require(_0x6eff('0x3'));var express=require(_0x6eff('0x4'));var router=express[_0x6eff('0x5')]();var fs_extra=require(_0x6eff('0x6'));var auth=require(_0x6eff('0x7'));var interaction=require(_0x6eff('0x8'));var config=require(_0x6eff('0x9'));var controller=require('./cmHopperAdditionalPhone.controller');router[_0x6eff('0xa')]('/',auth[_0x6eff('0xb')](),controller['index']);router['get']('/:id',auth[_0x6eff('0xb')](),controller['show']);router[_0x6eff('0xc')]('/',auth[_0x6eff('0xb')](),controller[_0x6eff('0xd')]);router[_0x6eff('0xe')](_0x6eff('0xf'),auth['isAuthenticated'](),controller[_0x6eff('0x10')]);router['delete']('/:id',auth[_0x6eff('0xb')](),controller[_0x6eff('0x11')]);module['exports']=router; \ No newline at end of file +var _0x64a5=['/:id','show','post','create','update','delete','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x27b592,_0x245d21){var _0x37f577=function(_0x4cc47f){while(--_0x4cc47f){_0x27b592['push'](_0x27b592['shift']());}};_0x37f577(++_0x245d21);}(_0x64a5,0xc6));var _0x564a=function(_0x37f4d4,_0x23a7c1){_0x37f4d4=_0x37f4d4-0x0;var _0x1e4349=_0x64a5[_0x37f4d4];return _0x1e4349;};'use strict';var multer=require(_0x564a('0x0'));var util=require(_0x564a('0x1'));var path=require(_0x564a('0x2'));var timeout=require('connect-timeout');var express=require(_0x564a('0x3'));var router=express['Router']();var fs_extra=require(_0x564a('0x4'));var auth=require(_0x564a('0x5'));var interaction=require(_0x564a('0x6'));var config=require(_0x564a('0x7'));var controller=require('./cmHopperAdditionalPhone.controller');router[_0x564a('0x8')]('/',auth[_0x564a('0x9')](),controller['index']);router[_0x564a('0x8')](_0x564a('0xa'),auth[_0x564a('0x9')](),controller[_0x564a('0xb')]);router[_0x564a('0xc')]('/',auth[_0x564a('0x9')](),controller[_0x564a('0xd')]);router['put'](_0x564a('0xa'),auth['isAuthenticated'](),controller[_0x564a('0xe')]);router[_0x564a('0xf')](_0x564a('0xa'),auth[_0x564a('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 7afbe33..fa29123 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 _0x3c2a=['sequelize','STRING','contactListQueue','INTEGER','moment'];(function(_0x5a9570,_0x255c95){var _0x55d2c0=function(_0xb803cb){while(--_0xb803cb){_0x5a9570['push'](_0x5a9570['shift']());}};_0x55d2c0(++_0x255c95);}(_0x3c2a,0x1b2));var _0xa3c2=function(_0x2275dc,_0x51a8ca){_0x2275dc=_0x2275dc-0x0;var _0x3e864a=_0x3c2a[_0x2275dc];return _0x3e864a;};'use strict';var moment=require(_0xa3c2('0x0'));var Sequelize=require(_0xa3c2('0x1'));module['exports']={'phone':{'type':Sequelize[_0xa3c2('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0xa3c2('0x3')},'ListId':{'type':Sequelize[_0xa3c2('0x4')],'unique':_0xa3c2('0x3')},'VoiceQueueId':{'type':Sequelize[_0xa3c2('0x4')],'unique':_0xa3c2('0x3')}}; \ No newline at end of file +var _0xe2af=['contactListQueue','sequelize','exports','STRING','INTEGER'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe2af,0x6a));var _0xfe2a=function(_0x3c6755,_0x3e90e9){_0x3c6755=_0x3c6755-0x0;var _0x24d55c=_0xe2af[_0x3c6755];return _0x24d55c;};'use strict';var moment=require('moment');var Sequelize=require(_0xfe2a('0x0'));module[_0xfe2a('0x1')]={'phone':{'type':Sequelize[_0xfe2a('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xfe2a('0x3')],'unique':_0xfe2a('0x4')},'ListId':{'type':Sequelize[_0xfe2a('0x3')],'unique':_0xfe2a('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xfe2a('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index b9c292a..3f8a574 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 _0x3067=['json','undefined','limit','count','offset','apply','reject','save','update','then','destroy','error','stack','name','send','map','CmHopperBlack','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','catch','show','params','keys','length','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','end','status'];(function(_0x305d88,_0x56620a){var _0x1e39e3=function(_0x26b20c){while(--_0x26b20c){_0x305d88['push'](_0x305d88['shift']());}};_0x1e39e3(++_0x56620a);}(_0x3067,0x7e));var _0x7306=function(_0x21809a,_0x14b2d3){_0x21809a=_0x21809a-0x0;var _0x348d83=_0x3067[_0x21809a];return _0x348d83;};'use strict';var emlformat=require(_0x7306('0x0'));var rimraf=require(_0x7306('0x1'));var zipdir=require(_0x7306('0x2'));var jsonpatch=require(_0x7306('0x3'));var rp=require(_0x7306('0x4'));var moment=require(_0x7306('0x5'));var BPromise=require(_0x7306('0x6'));var Mustache=require(_0x7306('0x7'));var util=require(_0x7306('0x8'));var path=require(_0x7306('0x9'));var sox=require(_0x7306('0xa'));var csv=require(_0x7306('0xb'));var ejs=require(_0x7306('0xc'));var fs=require('fs');var fs_extra=require(_0x7306('0xd'));var _=require(_0x7306('0xe'));var squel=require(_0x7306('0xf'));var crypto=require(_0x7306('0x10'));var jsforce=require(_0x7306('0x11'));var deskjs=require(_0x7306('0x12'));var toCsv=require(_0x7306('0xb'));var querystring=require(_0x7306('0x13'));var Papa=require(_0x7306('0x14'));var Redis=require(_0x7306('0x15'));var authService=require(_0x7306('0x16'));var qs=require(_0x7306('0x17'));var as=require(_0x7306('0x18'));var hardwareService=require(_0x7306('0x19'));var logger=require(_0x7306('0x1a'))(_0x7306('0x1b'));var utils=require(_0x7306('0x1c'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7306('0x1d'))['db'];function respondWithStatusCode(_0x26b43d,_0x191032){_0x191032=_0x191032||0xcc;return function(_0x2e0c76){if(_0x2e0c76){return _0x26b43d['sendStatus'](_0x191032);}return _0x26b43d['status'](_0x191032)[_0x7306('0x1e')]();};}function respondWithResult(_0x37ddac,_0x492bc6){_0x492bc6=_0x492bc6||0xc8;return function(_0x3b784f){if(_0x3b784f){return _0x37ddac[_0x7306('0x1f')](_0x492bc6)[_0x7306('0x20')](_0x3b784f);}};}function respondWithFilteredResult(_0x21764a,_0x546d58){return function(_0x1cbf0a){if(_0x1cbf0a){var _0x8e6278=typeof _0x546d58['offset']===_0x7306('0x21')&&typeof _0x546d58[_0x7306('0x22')]==='undefined';var _0x3c5e18=_0x1cbf0a[_0x7306('0x23')];var _0x50f5ef=_0x8e6278?0x0:_0x546d58[_0x7306('0x24')];var _0x33a144=_0x8e6278?_0x1cbf0a[_0x7306('0x23')]:_0x546d58[_0x7306('0x24')]+_0x546d58[_0x7306('0x22')];var _0x20baec;if(_0x33a144>=_0x3c5e18){_0x33a144=_0x3c5e18;_0x20baec=0xc8;}else{_0x20baec=0xce;}_0x21764a[_0x7306('0x1f')](_0x20baec);return _0x21764a['set']('Content-Range',_0x50f5ef+'-'+_0x33a144+'/'+_0x3c5e18)[_0x7306('0x20')](_0x1cbf0a);}return null;};}function patchUpdates(_0x5ee224){return function(_0x3ff934){try{jsonpatch[_0x7306('0x25')](_0x3ff934,_0x5ee224,!![]);}catch(_0xda48a0){return BPromise[_0x7306('0x26')](_0xda48a0);}return _0x3ff934[_0x7306('0x27')]();};}function saveUpdates(_0xf3d021,_0x223f21){return function(_0x2ae177){if(_0x2ae177){return _0x2ae177[_0x7306('0x28')](_0xf3d021)[_0x7306('0x29')](function(_0xa87e91){return _0xa87e91;});}return null;};}function removeEntity(_0x2bfb37,_0x1da87b){return function(_0x56f5c8){if(_0x56f5c8){return _0x56f5c8[_0x7306('0x2a')]()[_0x7306('0x29')](function(){_0x2bfb37[_0x7306('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4be940,_0x419b1a){return function(_0xb9b205){if(!_0xb9b205){_0x4be940['sendStatus'](0x194);}return _0xb9b205;};}function handleError(_0x237de5,_0x863b4){_0x863b4=_0x863b4||0x1f4;return function(_0x4b8ed3){logger[_0x7306('0x2b')](_0x4b8ed3[_0x7306('0x2c')]);if(_0x4b8ed3[_0x7306('0x2d')]){delete _0x4b8ed3[_0x7306('0x2d')];}_0x237de5[_0x7306('0x1f')](_0x863b4)[_0x7306('0x2e')](_0x4b8ed3);};}exports['index']=function(_0x29f7d6,_0x4c952d){var _0x1f623a={},_0x557473={},_0x1954eb={'count':0x0,'rows':[]};var _0x441fe9=_[_0x7306('0x2f')](db[_0x7306('0x30')]['rawAttributes'],function(_0x4e6a54){return{'name':_0x4e6a54[_0x7306('0x31')],'type':_0x4e6a54[_0x7306('0x32')][_0x7306('0x33')]};});_0x557473[_0x7306('0x34')]=_[_0x7306('0x2f')](_0x441fe9,'name');_0x557473['query']=_['keys'](_0x29f7d6[_0x7306('0x35')]);_0x557473[_0x7306('0x36')]=_[_0x7306('0x37')](_0x557473[_0x7306('0x34')],_0x557473[_0x7306('0x35')]);_0x1f623a['attributes']=_[_0x7306('0x37')](_0x557473['model'],qs['fields'](_0x29f7d6['query'][_0x7306('0x38')]));_0x1f623a['attributes']=_0x1f623a[_0x7306('0x39')]['length']?_0x1f623a[_0x7306('0x39')]:_0x557473[_0x7306('0x34')];if(!_0x29f7d6[_0x7306('0x35')][_0x7306('0x3a')](_0x7306('0x3b'))){_0x1f623a[_0x7306('0x22')]=qs[_0x7306('0x22')](_0x29f7d6['query'][_0x7306('0x22')]);_0x1f623a[_0x7306('0x24')]=qs[_0x7306('0x24')](_0x29f7d6[_0x7306('0x35')][_0x7306('0x24')]);}_0x1f623a[_0x7306('0x3c')]=qs['sort'](_0x29f7d6[_0x7306('0x35')][_0x7306('0x3d')]);_0x1f623a[_0x7306('0x3e')]=qs[_0x7306('0x36')](_[_0x7306('0x3f')](_0x29f7d6[_0x7306('0x35')],_0x557473['filters']),_0x441fe9);if(_0x29f7d6[_0x7306('0x35')]['filter']){_0x1f623a[_0x7306('0x3e')]=_['merge'](_0x1f623a[_0x7306('0x3e')],{'$or':_[_0x7306('0x2f')](_0x441fe9,function(_0x4d86a4){if(_0x4d86a4[_0x7306('0x32')]!==_0x7306('0x40')){var _0x18535c={};_0x18535c[_0x4d86a4['name']]={'$like':'%'+_0x29f7d6[_0x7306('0x35')][_0x7306('0x41')]+'%'};return _0x18535c;}})});}_0x1f623a=_[_0x7306('0x42')]({},_0x1f623a,_0x29f7d6[_0x7306('0x43')]);var _0x39647f={'where':_0x1f623a[_0x7306('0x3e')]};return db['CmHopperBlack'][_0x7306('0x23')](_0x39647f)['then'](function(_0x39479e){_0x1954eb['count']=_0x39479e;if(_0x29f7d6['query'][_0x7306('0x44')]){_0x1f623a[_0x7306('0x45')]=[{'all':!![]}];}return db[_0x7306('0x30')][_0x7306('0x46')](_0x1f623a);})[_0x7306('0x29')](function(_0x4df175){_0x1954eb['rows']=_0x4df175;return _0x1954eb;})[_0x7306('0x29')](respondWithFilteredResult(_0x4c952d,_0x1f623a))[_0x7306('0x47')](handleError(_0x4c952d,null));};exports[_0x7306('0x48')]=function(_0x42fa55,_0x2fdaa3){var _0x44fb77={'raw':!![],'where':{'id':_0x42fa55[_0x7306('0x49')]['id']}},_0x2f7b14={};_0x2f7b14[_0x7306('0x34')]=_['keys'](db[_0x7306('0x30')]['rawAttributes']);_0x2f7b14['query']=_[_0x7306('0x4a')](_0x42fa55[_0x7306('0x35')]);_0x2f7b14[_0x7306('0x36')]=_[_0x7306('0x37')](_0x2f7b14['model'],_0x2f7b14['query']);_0x44fb77[_0x7306('0x39')]=_[_0x7306('0x37')](_0x2f7b14['model'],qs[_0x7306('0x38')](_0x42fa55[_0x7306('0x35')][_0x7306('0x38')]));_0x44fb77[_0x7306('0x39')]=_0x44fb77[_0x7306('0x39')][_0x7306('0x4b')]?_0x44fb77[_0x7306('0x39')]:_0x2f7b14['model'];if(_0x42fa55[_0x7306('0x35')][_0x7306('0x44')]){_0x44fb77['include']=[{'all':!![]}];}_0x44fb77=_[_0x7306('0x42')]({},_0x44fb77,_0x42fa55[_0x7306('0x43')]);return db[_0x7306('0x30')][_0x7306('0x4c')](_0x44fb77)['then'](handleEntityNotFound(_0x2fdaa3,null))[_0x7306('0x29')](respondWithResult(_0x2fdaa3,null))[_0x7306('0x47')](handleError(_0x2fdaa3,null));};exports[_0x7306('0x28')]=function(_0x3f5bd6,_0x23ebed){if(_0x3f5bd6[_0x7306('0x4d')]['id']){delete _0x3f5bd6[_0x7306('0x4d')]['id'];}return db[_0x7306('0x30')][_0x7306('0x4c')]({'where':{'id':_0x3f5bd6['params']['id']}})[_0x7306('0x29')](handleEntityNotFound(_0x23ebed,null))['then'](saveUpdates(_0x3f5bd6['body'],null))['then'](respondWithResult(_0x23ebed,null))['catch'](handleError(_0x23ebed,null));};exports[_0x7306('0x2a')]=function(_0x1faf7a,_0x5c2ba0){return db[_0x7306('0x30')][_0x7306('0x4c')]({'where':{'id':_0x1faf7a[_0x7306('0x49')]['id']}})['then'](handleEntityNotFound(_0x5c2ba0,null))['then'](removeEntity(_0x5c2ba0,null))[_0x7306('0x47')](handleError(_0x5c2ba0,null));};exports[_0x7306('0x4e')]=function(_0x14418c,_0x362b64){return db[_0x7306('0x30')]['describe']()['then'](respondWithResult(_0x362b64,null))[_0x7306('0x47')](handleError(_0x362b64,null));}; \ No newline at end of file +var _0x16e0=['hasOwnProperty','nolimit','order','sort','pick','where','merge','options','CmHopperBlack','includeAll','include','findAll','rows','show','keys','find','body','catch','destroy','describe','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','stack','name','index','map','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields'];(function(_0x438eef,_0x22c644){var _0x4bd748=function(_0x1b3c63){while(--_0x1b3c63){_0x438eef['push'](_0x438eef['shift']());}};_0x4bd748(++_0x22c644);}(_0x16e0,0x1b2));var _0x016e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x16e0[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x016e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x016e('0x1'));var jsonpatch=require(_0x016e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x016e('0x3'));var Mustache=require(_0x016e('0x4'));var util=require(_0x016e('0x5'));var path=require('path');var sox=require(_0x016e('0x6'));var csv=require('to-csv');var ejs=require(_0x016e('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x016e('0x8'));var crypto=require(_0x016e('0x9'));var jsforce=require(_0x016e('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x016e('0xb'));var querystring=require('querystring');var Papa=require(_0x016e('0xc'));var Redis=require(_0x016e('0xd'));var authService=require(_0x016e('0xe'));var qs=require(_0x016e('0xf'));var as=require(_0x016e('0x10'));var hardwareService=require(_0x016e('0x11'));var logger=require('../../config/logger')(_0x016e('0x12'));var utils=require(_0x016e('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x016e('0x14'))['db'];function respondWithStatusCode(_0x5e49d4,_0x25af89){_0x25af89=_0x25af89||0xcc;return function(_0x5c4707){if(_0x5c4707){return _0x5e49d4[_0x016e('0x15')](_0x25af89);}return _0x5e49d4[_0x016e('0x16')](_0x25af89)[_0x016e('0x17')]();};}function respondWithResult(_0x51daa9,_0x1596e1){_0x1596e1=_0x1596e1||0xc8;return function(_0x2d9119){if(_0x2d9119){return _0x51daa9[_0x016e('0x16')](_0x1596e1)[_0x016e('0x18')](_0x2d9119);}};}function respondWithFilteredResult(_0x327a9c,_0x28187){return function(_0x27ad36){if(_0x27ad36){var _0x4fc356=typeof _0x28187['offset']===_0x016e('0x19')&&typeof _0x28187[_0x016e('0x1a')]==='undefined';var _0x3031b=_0x27ad36[_0x016e('0x1b')];var _0x71ba51=_0x4fc356?0x0:_0x28187[_0x016e('0x1c')];var _0x1c8ec2=_0x4fc356?_0x27ad36[_0x016e('0x1b')]:_0x28187[_0x016e('0x1c')]+_0x28187[_0x016e('0x1a')];var _0xb8ca84;if(_0x1c8ec2>=_0x3031b){_0x1c8ec2=_0x3031b;_0xb8ca84=0xc8;}else{_0xb8ca84=0xce;}_0x327a9c[_0x016e('0x16')](_0xb8ca84);return _0x327a9c[_0x016e('0x1d')](_0x016e('0x1e'),_0x71ba51+'-'+_0x1c8ec2+'/'+_0x3031b)[_0x016e('0x18')](_0x27ad36);}return null;};}function patchUpdates(_0x5a19a9){return function(_0x11f3f3){try{jsonpatch[_0x016e('0x1f')](_0x11f3f3,_0x5a19a9,!![]);}catch(_0x2ec89a){return BPromise[_0x016e('0x20')](_0x2ec89a);}return _0x11f3f3[_0x016e('0x21')]();};}function saveUpdates(_0x466d9d,_0x45ccfc){return function(_0x4358c4){if(_0x4358c4){return _0x4358c4[_0x016e('0x22')](_0x466d9d)[_0x016e('0x23')](function(_0x50c7ea){return _0x50c7ea;});}return null;};}function removeEntity(_0x15e301,_0x26f58a){return function(_0x1103bc){if(_0x1103bc){return _0x1103bc['destroy']()[_0x016e('0x23')](function(){_0x15e301['status'](0xcc)[_0x016e('0x17')]();});}};}function handleEntityNotFound(_0x46e3f2,_0x54b25c){return function(_0x335eaf){if(!_0x335eaf){_0x46e3f2[_0x016e('0x15')](0x194);}return _0x335eaf;};}function handleError(_0x44d178,_0x2e137a){_0x2e137a=_0x2e137a||0x1f4;return function(_0x2d188c){logger['error'](_0x2d188c[_0x016e('0x24')]);if(_0x2d188c[_0x016e('0x25')]){delete _0x2d188c[_0x016e('0x25')];}_0x44d178[_0x016e('0x16')](_0x2e137a)['send'](_0x2d188c);};}exports[_0x016e('0x26')]=function(_0x309c88,_0x41b047){var _0x55ef5b={},_0x31bf13={},_0x5c69b8={'count':0x0,'rows':[]};var _0x45ed08=_[_0x016e('0x27')](db['CmHopperBlack'][_0x016e('0x28')],function(_0x5ab4ee){return{'name':_0x5ab4ee[_0x016e('0x29')],'type':_0x5ab4ee[_0x016e('0x2a')]['key']};});_0x31bf13[_0x016e('0x2b')]=_[_0x016e('0x27')](_0x45ed08,_0x016e('0x25'));_0x31bf13[_0x016e('0x2c')]=_['keys'](_0x309c88['query']);_0x31bf13[_0x016e('0x2d')]=_['intersection'](_0x31bf13[_0x016e('0x2b')],_0x31bf13[_0x016e('0x2c')]);_0x55ef5b[_0x016e('0x2e')]=_[_0x016e('0x2f')](_0x31bf13[_0x016e('0x2b')],qs[_0x016e('0x30')](_0x309c88[_0x016e('0x2c')][_0x016e('0x30')]));_0x55ef5b[_0x016e('0x2e')]=_0x55ef5b[_0x016e('0x2e')]['length']?_0x55ef5b[_0x016e('0x2e')]:_0x31bf13[_0x016e('0x2b')];if(!_0x309c88[_0x016e('0x2c')][_0x016e('0x31')](_0x016e('0x32'))){_0x55ef5b[_0x016e('0x1a')]=qs['limit'](_0x309c88[_0x016e('0x2c')][_0x016e('0x1a')]);_0x55ef5b[_0x016e('0x1c')]=qs['offset'](_0x309c88['query'][_0x016e('0x1c')]);}_0x55ef5b[_0x016e('0x33')]=qs[_0x016e('0x34')](_0x309c88['query'][_0x016e('0x34')]);_0x55ef5b['where']=qs[_0x016e('0x2d')](_[_0x016e('0x35')](_0x309c88[_0x016e('0x2c')],_0x31bf13[_0x016e('0x2d')]),_0x45ed08);if(_0x309c88['query']['filter']){_0x55ef5b[_0x016e('0x36')]=_[_0x016e('0x37')](_0x55ef5b['where'],{'$or':_[_0x016e('0x27')](_0x45ed08,function(_0x9d5e47){if(_0x9d5e47[_0x016e('0x2a')]!=='VIRTUAL'){var _0x2405aa={};_0x2405aa[_0x9d5e47[_0x016e('0x25')]]={'$like':'%'+_0x309c88[_0x016e('0x2c')]['filter']+'%'};return _0x2405aa;}})});}_0x55ef5b=_['merge']({},_0x55ef5b,_0x309c88[_0x016e('0x38')]);var _0x355506={'where':_0x55ef5b[_0x016e('0x36')]};return db[_0x016e('0x39')][_0x016e('0x1b')](_0x355506)[_0x016e('0x23')](function(_0x1ca827){_0x5c69b8[_0x016e('0x1b')]=_0x1ca827;if(_0x309c88[_0x016e('0x2c')][_0x016e('0x3a')]){_0x55ef5b[_0x016e('0x3b')]=[{'all':!![]}];}return db[_0x016e('0x39')][_0x016e('0x3c')](_0x55ef5b);})[_0x016e('0x23')](function(_0x1ba3cd){_0x5c69b8[_0x016e('0x3d')]=_0x1ba3cd;return _0x5c69b8;})['then'](respondWithFilteredResult(_0x41b047,_0x55ef5b))['catch'](handleError(_0x41b047,null));};exports[_0x016e('0x3e')]=function(_0xd973ba,_0x1c8d86){var _0x520c9f={'raw':!![],'where':{'id':_0xd973ba['params']['id']}},_0x4d8fbd={};_0x4d8fbd['model']=_[_0x016e('0x3f')](db[_0x016e('0x39')]['rawAttributes']);_0x4d8fbd['query']=_[_0x016e('0x3f')](_0xd973ba[_0x016e('0x2c')]);_0x4d8fbd[_0x016e('0x2d')]=_['intersection'](_0x4d8fbd[_0x016e('0x2b')],_0x4d8fbd[_0x016e('0x2c')]);_0x520c9f[_0x016e('0x2e')]=_[_0x016e('0x2f')](_0x4d8fbd[_0x016e('0x2b')],qs[_0x016e('0x30')](_0xd973ba[_0x016e('0x2c')]['fields']));_0x520c9f[_0x016e('0x2e')]=_0x520c9f[_0x016e('0x2e')]['length']?_0x520c9f[_0x016e('0x2e')]:_0x4d8fbd[_0x016e('0x2b')];if(_0xd973ba[_0x016e('0x2c')]['includeAll']){_0x520c9f[_0x016e('0x3b')]=[{'all':!![]}];}_0x520c9f=_[_0x016e('0x37')]({},_0x520c9f,_0xd973ba['options']);return db[_0x016e('0x39')][_0x016e('0x40')](_0x520c9f)[_0x016e('0x23')](handleEntityNotFound(_0x1c8d86,null))['then'](respondWithResult(_0x1c8d86,null))['catch'](handleError(_0x1c8d86,null));};exports[_0x016e('0x22')]=function(_0x3797c0,_0x2cd7ec){if(_0x3797c0[_0x016e('0x41')]['id']){delete _0x3797c0[_0x016e('0x41')]['id'];}return db[_0x016e('0x39')][_0x016e('0x40')]({'where':{'id':_0x3797c0['params']['id']}})[_0x016e('0x23')](handleEntityNotFound(_0x2cd7ec,null))[_0x016e('0x23')](saveUpdates(_0x3797c0['body'],null))[_0x016e('0x23')](respondWithResult(_0x2cd7ec,null))[_0x016e('0x42')](handleError(_0x2cd7ec,null));};exports[_0x016e('0x43')]=function(_0x467633,_0x2c0755){return db[_0x016e('0x39')][_0x016e('0x40')]({'where':{'id':_0x467633['params']['id']}})['then'](handleEntityNotFound(_0x2c0755,null))[_0x016e('0x23')](removeEntity(_0x2c0755,null))[_0x016e('0x42')](handleError(_0x2c0755,null));};exports[_0x016e('0x44')]=function(_0x15555a,_0xf03d0e){return db['CmHopperBlack'][_0x016e('0x44')]()[_0x016e('0x23')](respondWithResult(_0xf03d0e,null))[_0x016e('0x42')](handleError(_0xf03d0e,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index c3cd4b6..4acd00e 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 _0x45d3=['moment','bluebird','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api'];(function(_0x1a4708,_0xbec007){var _0xd3e4c0=function(_0x15f352){while(--_0x15f352){_0x1a4708['push'](_0x1a4708['shift']());}};_0xd3e4c0(++_0xbec007);}(_0x45d3,0xbf));var _0x345d=function(_0xde142b,_0x40682c){_0xde142b=_0xde142b-0x0;var _0x4c9561=_0x45d3[_0xde142b];return _0x4c9561;};'use strict';var _=require(_0x345d('0x0'));var util=require(_0x345d('0x1'));var logger=require(_0x345d('0x2'))(_0x345d('0x3'));var moment=require(_0x345d('0x4'));var BPromise=require(_0x345d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x345d('0x6'));var config=require(_0x345d('0x7'));var attributes=require(_0x345d('0x8'));module[_0x345d('0x9')]=function(_0x2e25f8,_0xfd7b86){return _0x2e25f8[_0x345d('0xa')](_0x345d('0xb'),attributes,{'tableName':_0x345d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb54a=['rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0xad3ac2,_0xb570a2){var _0x4a53f3=function(_0x120253){while(--_0x120253){_0xad3ac2['push'](_0xad3ac2['shift']());}};_0x4a53f3(++_0xb570a2);}(_0xb54a,0x1ab));var _0xab54=function(_0x329371,_0x3255cf){_0x329371=_0x329371-0x0;var _0x1b4459=_0xb54a[_0x329371];return _0x1b4459;};'use strict';var _=require(_0xab54('0x0'));var util=require(_0xab54('0x1'));var logger=require(_0xab54('0x2'))(_0xab54('0x3'));var moment=require(_0xab54('0x4'));var BPromise=require('bluebird');var rp=require(_0xab54('0x5'));var fs=require('fs');var path=require(_0xab54('0x6'));var rimraf=require(_0xab54('0x7'));var config=require(_0xab54('0x8'));var attributes=require(_0xab54('0x9'));module[_0xab54('0xa')]=function(_0x422900,_0x1c3c74){return _0x422900[_0xab54('0xb')](_0xab54('0xc'),attributes,{'tableName':_0xab54('0xd'),'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 3d226f9..68f4f4b 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 _0xd447=['GetCmHopperBlack','CmHopperBlack','findAll','options','raw','limit','include','model','attributes','map','UpdateCmHopperBlack','update','where','DestroyCmHopperBlack','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','request\x20sent','debug','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','result','catch'];(function(_0x44f0ed,_0x5725a1){var _0x3d3683=function(_0x2668ee){while(--_0x2668ee){_0x44f0ed['push'](_0x44f0ed['shift']());}};_0x3d3683(++_0x5725a1);}(_0xd447,0x1a6));var _0x7d44=function(_0x328a9e,_0x23d474){_0x328a9e=_0x328a9e-0x0;var _0x3214a3=_0xd447[_0x328a9e];return _0x3214a3;};'use strict';var _=require(_0x7d44('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7d44('0x1'));var fs=require('fs');var Redis=require(_0x7d44('0x2'));var db=require(_0x7d44('0x3'))['db'];var utils=require(_0x7d44('0x4'));var logger=require('../../config/logger')(_0x7d44('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7d44('0x6')][_0x7d44('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x32a8f7,_0x57eb61,_0x26db6d){return new BPromise(function(_0x4a1f5b,_0x18c015){return client[_0x7d44('0x8')](_0x32a8f7,_0x26db6d)[_0x7d44('0x9')](function(_0x4a5b90){logger[_0x7d44('0xa')]('CmHopperBlack,\x20%s,\x20%s',_0x57eb61,_0x7d44('0xb'));logger[_0x7d44('0xc')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x57eb61,_0x7d44('0xb'),JSON[_0x7d44('0xd')](_0x4a5b90));if(_0x4a5b90[_0x7d44('0xe')]){if(_0x4a5b90[_0x7d44('0xe')][_0x7d44('0xf')]===0x1f4){logger['error'](_0x7d44('0x10'),_0x57eb61,_0x4a5b90['error']['message']);return _0x18c015(_0x4a5b90[_0x7d44('0xe')][_0x7d44('0x11')]);}logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x57eb61,_0x4a5b90['error']['message']);return _0x4a1f5b(_0x4a5b90['error'][_0x7d44('0x11')]);}else{logger[_0x7d44('0xa')]('CmHopperBlack,\x20%s,\x20%s',_0x57eb61,_0x7d44('0xb'));_0x4a1f5b(_0x4a5b90[_0x7d44('0x12')]['message']);}})[_0x7d44('0x13')](function(_0xf8b80f){logger[_0x7d44('0xe')](_0x7d44('0x10'),_0x57eb61,_0xf8b80f);_0x18c015(_0xf8b80f);});});}exports[_0x7d44('0x14')]=function(_0x2f0561){var _0x31d653=this;return new Promise(function(_0x50e748,_0x261509){return db[_0x7d44('0x15')][_0x7d44('0x16')]({'raw':_0x2f0561[_0x7d44('0x17')]?_0x2f0561[_0x7d44('0x17')][_0x7d44('0x18')]===undefined?!![]:![]:!![],'where':_0x2f0561[_0x7d44('0x17')]?_0x2f0561[_0x7d44('0x17')]['where']||null:null,'attributes':_0x2f0561[_0x7d44('0x17')]?_0x2f0561[_0x7d44('0x17')]['attributes']||null:null,'limit':_0x2f0561[_0x7d44('0x17')]?_0x2f0561[_0x7d44('0x17')][_0x7d44('0x19')]||null:null,'include':_0x2f0561['options']?_0x2f0561[_0x7d44('0x17')][_0x7d44('0x1a')]?_['map'](_0x2f0561[_0x7d44('0x17')][_0x7d44('0x1a')],function(_0x7c224){return{'model':db[_0x7c224[_0x7d44('0x1b')]],'as':_0x7c224['as'],'attributes':_0x7c224[_0x7d44('0x1c')],'include':_0x7c224[_0x7d44('0x1a')]?_[_0x7d44('0x1d')](_0x7c224[_0x7d44('0x1a')],function(_0x1f0880){return{'model':db[_0x1f0880['model']],'as':_0x1f0880['as'],'attributes':_0x1f0880[_0x7d44('0x1c')],'include':_0x1f0880[_0x7d44('0x1a')]?_[_0x7d44('0x1d')](_0x1f0880[_0x7d44('0x1a')],function(_0x41191a){return{'model':db[_0x41191a['model']],'as':_0x41191a['as'],'attributes':_0x41191a[_0x7d44('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x108ee3){logger['info'](_0x7d44('0x14'),_0x2f0561);logger[_0x7d44('0xc')](_0x7d44('0x14'),_0x2f0561,JSON['stringify'](_0x108ee3));_0x50e748(_0x108ee3);})[_0x7d44('0x13')](function(_0x21b420){logger[_0x7d44('0xe')](_0x7d44('0x14'),_0x21b420[_0x7d44('0x11')],_0x2f0561);_0x261509(_0x31d653[_0x7d44('0xe')](0x1f4,_0x21b420[_0x7d44('0x11')]));});});};exports[_0x7d44('0x1e')]=function(_0x2f14f2){var _0x26bbc5=this;return new Promise(function(_0x36fb65,_0x333bc3){return db['CmHopperBlack'][_0x7d44('0x1f')](_0x2f14f2['body'],{'raw':_0x2f14f2[_0x7d44('0x17')]?_0x2f14f2['options'][_0x7d44('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f14f2[_0x7d44('0x17')]?_0x2f14f2[_0x7d44('0x17')][_0x7d44('0x20')]||null:null,'attributes':_0x2f14f2[_0x7d44('0x17')]?_0x2f14f2[_0x7d44('0x17')][_0x7d44('0x1c')]||null:null,'limit':_0x2f14f2[_0x7d44('0x17')]?_0x2f14f2['options'][_0x7d44('0x19')]||null:null})[_0x7d44('0x9')](function(_0x2d016e){logger[_0x7d44('0xa')](_0x7d44('0x1e'),_0x2f14f2);logger[_0x7d44('0xc')](_0x7d44('0x1e'),_0x2f14f2,JSON[_0x7d44('0xd')](_0x2d016e));_0x36fb65(_0x2d016e);})['catch'](function(_0x20b95a){logger[_0x7d44('0xe')](_0x7d44('0x1e'),_0x20b95a[_0x7d44('0x11')],_0x2f14f2);_0x333bc3(_0x26bbc5[_0x7d44('0xe')](0x1f4,_0x20b95a[_0x7d44('0x11')]));});});};exports[_0x7d44('0x21')]=function(_0x218812){var _0x43513c=this;return new Promise(function(_0x157bc3,_0xb49ca1){return db['CmHopperBlack']['destroy']({'where':_0x218812[_0x7d44('0x17')]?_0x218812['options'][_0x7d44('0x20')]||null:null})['then'](function(_0x856cc6){logger['info']('DestroyCmHopperBlack',_0x218812);logger[_0x7d44('0xc')]('DestroyCmHopperBlack',_0x218812,JSON[_0x7d44('0xd')](_0x856cc6));_0x157bc3(_0x856cc6);})[_0x7d44('0x13')](function(_0x43055d){logger[_0x7d44('0xe')](_0x7d44('0x21'),_0x43055d[_0x7d44('0x11')],_0x218812);_0xb49ca1(_0x43513c[_0x7d44('0xe')](0x1f4,_0x43055d[_0x7d44('0x11')]));});});}; \ No newline at end of file +var _0xc404=['CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','GetCmHopperBlack','findAll','options','attributes','limit','map','include','model','UpdateCmHopperBlack','CmHopperBlack','update','body','raw','where','catch','DestroyCmHopperBlack','destroy','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x4c40d4,_0x20a005){var _0x2d6f3a=function(_0x53a81e){while(--_0x53a81e){_0x4c40d4['push'](_0x4c40d4['shift']());}};_0x2d6f3a(++_0x20a005);}(_0xc404,0x1c7));var _0x4c40=function(_0x89a342,_0x1de355){_0x89a342=_0x89a342-0x0;var _0x4311a7=_0xc404[_0x89a342];return _0x4311a7;};'use strict';var _=require(_0x4c40('0x0'));var util=require('util');var moment=require(_0x4c40('0x1'));var BPromise=require(_0x4c40('0x2'));var rs=require(_0x4c40('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4c40('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4c40('0x5'))(_0x4c40('0x6'));var config=require(_0x4c40('0x7'));var jayson=require(_0x4c40('0x8'));var client=jayson[_0x4c40('0x9')][_0x4c40('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b7cf1,_0x4acff6,_0x483be9){return new BPromise(function(_0xcebc40,_0x49b4d8){return client[_0x4c40('0xb')](_0x5b7cf1,_0x483be9)[_0x4c40('0xc')](function(_0x3492fe){logger['info'](_0x4c40('0xd'),_0x4acff6,_0x4c40('0xe'));logger[_0x4c40('0xf')](_0x4c40('0x10'),_0x4acff6,_0x4c40('0xe'),JSON[_0x4c40('0x11')](_0x3492fe));if(_0x3492fe[_0x4c40('0x12')]){if(_0x3492fe[_0x4c40('0x12')][_0x4c40('0x13')]===0x1f4){logger[_0x4c40('0x12')](_0x4c40('0xd'),_0x4acff6,_0x3492fe[_0x4c40('0x12')][_0x4c40('0x14')]);return _0x49b4d8(_0x3492fe[_0x4c40('0x12')]['message']);}logger[_0x4c40('0x12')](_0x4c40('0xd'),_0x4acff6,_0x3492fe[_0x4c40('0x12')][_0x4c40('0x14')]);return _0xcebc40(_0x3492fe[_0x4c40('0x12')]['message']);}else{logger[_0x4c40('0x15')](_0x4c40('0xd'),_0x4acff6,_0x4c40('0xe'));_0xcebc40(_0x3492fe['result'][_0x4c40('0x14')]);}})['catch'](function(_0x222f25){logger['error'](_0x4c40('0xd'),_0x4acff6,_0x222f25);_0x49b4d8(_0x222f25);});});}exports[_0x4c40('0x16')]=function(_0xe24ec3){var _0x231672=this;return new Promise(function(_0x21713c,_0x343a94){return db['CmHopperBlack'][_0x4c40('0x17')]({'raw':_0xe24ec3[_0x4c40('0x18')]?_0xe24ec3['options']['raw']===undefined?!![]:![]:!![],'where':_0xe24ec3['options']?_0xe24ec3[_0x4c40('0x18')]['where']||null:null,'attributes':_0xe24ec3['options']?_0xe24ec3[_0x4c40('0x18')][_0x4c40('0x19')]||null:null,'limit':_0xe24ec3[_0x4c40('0x18')]?_0xe24ec3[_0x4c40('0x18')][_0x4c40('0x1a')]||null:null,'include':_0xe24ec3[_0x4c40('0x18')]?_0xe24ec3['options']['include']?_[_0x4c40('0x1b')](_0xe24ec3[_0x4c40('0x18')][_0x4c40('0x1c')],function(_0x17cdfd){return{'model':db[_0x17cdfd['model']],'as':_0x17cdfd['as'],'attributes':_0x17cdfd[_0x4c40('0x19')],'include':_0x17cdfd['include']?_[_0x4c40('0x1b')](_0x17cdfd[_0x4c40('0x1c')],function(_0xb6d39d){return{'model':db[_0xb6d39d[_0x4c40('0x1d')]],'as':_0xb6d39d['as'],'attributes':_0xb6d39d[_0x4c40('0x19')],'include':_0xb6d39d[_0x4c40('0x1c')]?_[_0x4c40('0x1b')](_0xb6d39d[_0x4c40('0x1c')],function(_0xab098e){return{'model':db[_0xab098e[_0x4c40('0x1d')]],'as':_0xab098e['as'],'attributes':_0xab098e['attributes']};}):[]};}):[]};}):[]:[]})[_0x4c40('0xc')](function(_0x306c89){logger[_0x4c40('0x15')](_0x4c40('0x16'),_0xe24ec3);logger[_0x4c40('0xf')](_0x4c40('0x16'),_0xe24ec3,JSON['stringify'](_0x306c89));_0x21713c(_0x306c89);})['catch'](function(_0x374405){logger[_0x4c40('0x12')](_0x4c40('0x16'),_0x374405['message'],_0xe24ec3);_0x343a94(_0x231672[_0x4c40('0x12')](0x1f4,_0x374405[_0x4c40('0x14')]));});});};exports[_0x4c40('0x1e')]=function(_0xb6740d){var _0xa4165b=this;return new Promise(function(_0x5a4a3b,_0x5a2785){return db[_0x4c40('0x1f')][_0x4c40('0x20')](_0xb6740d[_0x4c40('0x21')],{'raw':_0xb6740d['options']?_0xb6740d[_0x4c40('0x18')][_0x4c40('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb6740d['options']?_0xb6740d['options'][_0x4c40('0x23')]||null:null,'attributes':_0xb6740d[_0x4c40('0x18')]?_0xb6740d[_0x4c40('0x18')][_0x4c40('0x19')]||null:null,'limit':_0xb6740d[_0x4c40('0x18')]?_0xb6740d[_0x4c40('0x18')][_0x4c40('0x1a')]||null:null})[_0x4c40('0xc')](function(_0x3114ff){logger[_0x4c40('0x15')](_0x4c40('0x1e'),_0xb6740d);logger[_0x4c40('0xf')]('UpdateCmHopperBlack',_0xb6740d,JSON['stringify'](_0x3114ff));_0x5a4a3b(_0x3114ff);})[_0x4c40('0x24')](function(_0x337591){logger[_0x4c40('0x12')](_0x4c40('0x1e'),_0x337591[_0x4c40('0x14')],_0xb6740d);_0x5a2785(_0xa4165b[_0x4c40('0x12')](0x1f4,_0x337591['message']));});});};exports[_0x4c40('0x25')]=function(_0x332f3b){var _0x2fd9ed=this;return new Promise(function(_0x10c558,_0x22983c){return db['CmHopperBlack'][_0x4c40('0x26')]({'where':_0x332f3b[_0x4c40('0x18')]?_0x332f3b[_0x4c40('0x18')][_0x4c40('0x23')]||null:null})['then'](function(_0x44dbda){logger['info'](_0x4c40('0x25'),_0x332f3b);logger['debug'](_0x4c40('0x25'),_0x332f3b,JSON[_0x4c40('0x11')](_0x44dbda));_0x10c558(_0x44dbda);})[_0x4c40('0x24')](function(_0x22ded0){logger['error'](_0x4c40('0x25'),_0x22ded0[_0x4c40('0x14')],_0x332f3b);_0x22983c(_0x2fd9ed[_0x4c40('0x12')](0x1f4,_0x22ded0[_0x4c40('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 3d4a48b..4207f8d 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 _0x0a6b=['fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperBlack.controller','isAuthenticated','index','/describe','describe','show','put','/:id','delete','destroy','exports','multer','express'];(function(_0x3f5c73,_0x7334d1){var _0x1d9c6d=function(_0x8237f){while(--_0x8237f){_0x3f5c73['push'](_0x3f5c73['shift']());}};_0x1d9c6d(++_0x7334d1);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x4bb6f6,_0x44aff4){_0x4bb6f6=_0x4bb6f6-0x0;var _0x4e71c3=_0x0a6b[_0x4bb6f6];return _0x4e71c3;};'use strict';var multer=require(_0xb0a6('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb0a6('0x1'));var router=express['Router']();var fs_extra=require(_0xb0a6('0x2'));var auth=require(_0xb0a6('0x3'));var interaction=require(_0xb0a6('0x4'));var config=require('../../config/environment');var controller=require(_0xb0a6('0x5'));router['get']('/',auth[_0xb0a6('0x6')](),controller[_0xb0a6('0x7')]);router['get'](_0xb0a6('0x8'),auth[_0xb0a6('0x6')](),controller[_0xb0a6('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xb0a6('0xa')]);router[_0xb0a6('0xb')](_0xb0a6('0xc'),auth[_0xb0a6('0x6')](),controller['update']);router[_0xb0a6('0xd')](_0xb0a6('0xc'),auth['isAuthenticated'](),controller[_0xb0a6('0xe')]);module[_0xb0a6('0xf')]=router; \ No newline at end of file +var _0xafc4=['multer','path','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','/:id','show','put','delete','destroy'];(function(_0x46a2ef,_0x38e6cd){var _0x1e278c=function(_0x18843d){while(--_0x18843d){_0x46a2ef['push'](_0x46a2ef['shift']());}};_0x1e278c(++_0x38e6cd);}(_0xafc4,0x69));var _0x4afc=function(_0x49f743,_0x3660ac){_0x49f743=_0x49f743-0x0;var _0x3275f1=_0xafc4[_0x49f743];return _0x3275f1;};'use strict';var multer=require(_0x4afc('0x0'));var util=require('util');var path=require(_0x4afc('0x1'));var timeout=require('connect-timeout');var express=require(_0x4afc('0x2'));var router=express[_0x4afc('0x3')]();var fs_extra=require(_0x4afc('0x4'));var auth=require(_0x4afc('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmHopperBlack.controller');router[_0x4afc('0x6')]('/',auth[_0x4afc('0x7')](),controller[_0x4afc('0x8')]);router[_0x4afc('0x6')](_0x4afc('0x9'),auth[_0x4afc('0x7')](),controller['describe']);router[_0x4afc('0x6')](_0x4afc('0xa'),auth[_0x4afc('0x7')](),controller[_0x4afc('0xb')]);router[_0x4afc('0xc')](_0x4afc('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x4afc('0xd')]('/:id',auth[_0x4afc('0x7')](),controller[_0x4afc('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index e4cd54b..d40280a 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 _0xcaeb=['moment','STRING','DATE','INTEGER','getDataValue','setDataValue','followuptime','seconds','BOOLEAN','sequelize'];(function(_0x1073ad,_0x44bf0b){var _0x528474=function(_0x3450f7){while(--_0x3450f7){_0x1073ad['push'](_0x1073ad['shift']());}};_0x528474(++_0x44bf0b);}(_0xcaeb,0x121));var _0xbcae=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xcaeb[_0x5a776b];return _0xbbef59;};'use strict';var Sequelize=require(_0xbcae('0x0'));var moment=require(_0xbcae('0x1'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xbcae('0x2')]},'scheduledat':{'type':Sequelize[_0xbcae('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xbcae('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xbcae('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xbcae('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xbcae('0x2')]},'originatecalleridname':{'type':Sequelize[_0xbcae('0x2')]},'calleridnum':{'type':Sequelize[_0xbcae('0x2')]},'calleridname':{'type':Sequelize[_0xbcae('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xbcae('0x3')]},'answertime':{'type':Sequelize[_0xbcae('0x3')]},'droptime':{'type':Sequelize[_0xbcae('0x3')]},'endtime':{'type':Sequelize[_0xbcae('0x3')]},'ringtime':{'type':Sequelize[_0xbcae('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xbcae('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xbcae('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xbcae('0x2')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xbcae('0x2')]},'membername':{'type':Sequelize[_0xbcae('0x2')]},'reason':{'type':Sequelize[_0xbcae('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xbcae('0x2')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x262e5a){var _0x4b2fb8=this[_0xbcae('0x5')]('endtime');if(_0x4b2fb8&&_0x262e5a){this[_0xbcae('0x6')](_0xbcae('0x7'),moment(_0x262e5a)['diff'](moment(_0x4b2fb8),_0xbcae('0x8')));}}},'amd':{'type':Sequelize[_0xbcae('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0xbcae('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0xbcae('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xbcae('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xbcae('0x3')]},'deleted':{'type':Sequelize[_0xbcae('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xbcae('0x3')]},'recallme':{'type':Sequelize[_0xbcae('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xbcae('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0xbcae('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xbcae('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xbcae('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xaaf5=['endtime','setDataValue','followuptime','diff','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue'];(function(_0x35de93,_0x4dac4b){var _0x2343e6=function(_0xe4077c){while(--_0xe4077c){_0x35de93['push'](_0x35de93['shift']());}};_0x2343e6(++_0x4dac4b);}(_0xaaf5,0x149));var _0x5aaf=function(_0x18f24f,_0x2478b7){_0x18f24f=_0x18f24f-0x0;var _0xa5a38c=_0xaaf5[_0x18f24f];return _0xa5a38c;};'use strict';var Sequelize=require(_0x5aaf('0x0'));var moment=require(_0x5aaf('0x1'));module[_0x5aaf('0x2')]={'state':{'type':Sequelize[_0x5aaf('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x5aaf('0x4')]},'scheduledat':{'type':Sequelize[_0x5aaf('0x5')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5aaf('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5aaf('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x5aaf('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x5aaf('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x5aaf('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5aaf('0x4')]},'starttime':{'type':Sequelize[_0x5aaf('0x5')]},'responsetime':{'type':Sequelize[_0x5aaf('0x5')]},'answertime':{'type':Sequelize[_0x5aaf('0x5')]},'droptime':{'type':Sequelize[_0x5aaf('0x5')]},'endtime':{'type':Sequelize[_0x5aaf('0x5')]},'ringtime':{'type':Sequelize[_0x5aaf('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x5aaf('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x5aaf('0x4')]},'campaigntype':{'type':Sequelize[_0x5aaf('0x4')]},'membername':{'type':Sequelize[_0x5aaf('0x4')]},'reason':{'type':Sequelize[_0x5aaf('0x4')]},'disposition':{'type':Sequelize[_0x5aaf('0x4')]},'secondDisposition':{'type':Sequelize[_0x5aaf('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x5aaf('0x5')],'set':function(_0x2d1252){var _0x5912ea=this[_0x5aaf('0x6')](_0x5aaf('0x7'));if(_0x5912ea&&_0x2d1252){this[_0x5aaf('0x8')](_0x5aaf('0x9'),moment(_0x2d1252)[_0x5aaf('0xa')](moment(_0x5912ea),'seconds'));}}},'amd':{'type':Sequelize[_0x5aaf('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0x5aaf('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x5aaf('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x5aaf('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x5aaf('0x5')]},'callback':{'type':Sequelize[_0x5aaf('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x5aaf('0x5')]},'deleted':{'type':Sequelize[_0x5aaf('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x5aaf('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x5aaf('0x5')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5aaf('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x5aaf('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x5aaf('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 57d6496..7f4914c 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 _0x430c=['field','phone','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','createdAt','CampaignId\x20=\x20?','state\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','from','checkContactHopper','CmHopper','findOne','eml-format','fast-json-patch','request-promise','moment','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','then','destroy','error','stack','name','send','index','CmHopperFinal','rawAttributes','fieldName','key','model','map','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','describe','update','uniqueid','body','find','COUNT','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x208,\x201,\x20null','dropContacts','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','scheduledAt','ContactId','ListId','VoiceQueueId','updatedAt','select'];(function(_0x447678,_0x3a16b3){var _0x4355ba=function(_0x415e47){while(--_0x415e47){_0x447678['push'](_0x447678['shift']());}};_0x4355ba(++_0x3a16b3);}(_0x430c,0x1a1));var _0xc430=function(_0x1304c6,_0x6bb485){_0x1304c6=_0x1304c6-0x0;var _0x2e6654=_0x430c[_0x1304c6];return _0x2e6654;};'use strict';var emlformat=require(_0xc430('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc430('0x1'));var rp=require(_0xc430('0x2'));var moment=require(_0xc430('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc430('0x4'));var csv=require(_0xc430('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc430('0x6'));var _=require('lodash');var squel=require(_0xc430('0x7'));var crypto=require(_0xc430('0x8'));var jsforce=require(_0xc430('0x9'));var deskjs=require(_0xc430('0xa'));var toCsv=require(_0xc430('0x5'));var querystring=require(_0xc430('0xb'));var Papa=require(_0xc430('0xc'));var Redis=require(_0xc430('0xd'));var authService=require(_0xc430('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xc430('0xf'));var hardwareService=require(_0xc430('0x10'));var logger=require('../../config/logger')(_0xc430('0x11'));var utils=require('../../config/utils');var config=require(_0xc430('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xc430('0x13'))['db'];function respondWithStatusCode(_0x8aa2e6,_0xc5f92){_0xc5f92=_0xc5f92||0xcc;return function(_0x1fb8ce){if(_0x1fb8ce){return _0x8aa2e6[_0xc430('0x14')](_0xc5f92);}return _0x8aa2e6[_0xc430('0x15')](_0xc5f92)[_0xc430('0x16')]();};}function respondWithResult(_0x54d851,_0x4e9134){_0x4e9134=_0x4e9134||0xc8;return function(_0x3f359c){if(_0x3f359c){return _0x54d851[_0xc430('0x15')](_0x4e9134)[_0xc430('0x17')](_0x3f359c);}};}function respondWithFilteredResult(_0x2ef538,_0x31d3b7){return function(_0x55cc6c){if(_0x55cc6c){var _0x111598=typeof _0x31d3b7['offset']==='undefined'&&typeof _0x31d3b7[_0xc430('0x18')]===_0xc430('0x19');var _0x2327c5=_0x55cc6c['count'];var _0x5d3acc=_0x111598?0x0:_0x31d3b7[_0xc430('0x1a')];var _0x4c1937=_0x111598?_0x55cc6c[_0xc430('0x1b')]:_0x31d3b7['offset']+_0x31d3b7['limit'];var _0x2f3203;if(_0x4c1937>=_0x2327c5){_0x4c1937=_0x2327c5;_0x2f3203=0xc8;}else{_0x2f3203=0xce;}_0x2ef538['status'](_0x2f3203);return _0x2ef538[_0xc430('0x1c')](_0xc430('0x1d'),_0x5d3acc+'-'+_0x4c1937+'/'+_0x2327c5)[_0xc430('0x17')](_0x55cc6c);}return null;};}function patchUpdates(_0x1f90bb){return function(_0x2a1ea1){try{jsonpatch['apply'](_0x2a1ea1,_0x1f90bb,!![]);}catch(_0x388a2f){return BPromise['reject'](_0x388a2f);}return _0x2a1ea1['save']();};}function saveUpdates(_0x3b7c3d,_0x2ea352){return function(_0x3c7afa){if(_0x3c7afa){return _0x3c7afa['update'](_0x3b7c3d)[_0xc430('0x1e')](function(_0x57d26e){return _0x57d26e;});}return null;};}function removeEntity(_0x23425d,_0x22ebfb){return function(_0x4efecd){if(_0x4efecd){return _0x4efecd[_0xc430('0x1f')]()[_0xc430('0x1e')](function(){_0x23425d['status'](0xcc)[_0xc430('0x16')]();});}};}function handleEntityNotFound(_0x59c498,_0x3aa85e){return function(_0x4b5280){if(!_0x4b5280){_0x59c498[_0xc430('0x14')](0x194);}return _0x4b5280;};}function handleError(_0x21e28a,_0x50110b){_0x50110b=_0x50110b||0x1f4;return function(_0x33433f){logger[_0xc430('0x20')](_0x33433f[_0xc430('0x21')]);if(_0x33433f[_0xc430('0x22')]){delete _0x33433f[_0xc430('0x22')];}_0x21e28a['status'](_0x50110b)[_0xc430('0x23')](_0x33433f);};}exports[_0xc430('0x24')]=function(_0x1c1da9,_0x1591e3){var _0x542cba={},_0x1f8086={},_0x4cf56c={'count':0x0,'rows':[]};var _0x1d65ee=_['map'](db[_0xc430('0x25')][_0xc430('0x26')],function(_0xfc8767){return{'name':_0xfc8767[_0xc430('0x27')],'type':_0xfc8767['type'][_0xc430('0x28')]};});_0x1f8086[_0xc430('0x29')]=_[_0xc430('0x2a')](_0x1d65ee,_0xc430('0x22'));_0x1f8086['query']=_[_0xc430('0x2b')](_0x1c1da9[_0xc430('0x2c')]);_0x1f8086['filters']=_[_0xc430('0x2d')](_0x1f8086['model'],_0x1f8086['query']);_0x542cba[_0xc430('0x2e')]=_[_0xc430('0x2d')](_0x1f8086[_0xc430('0x29')],qs[_0xc430('0x2f')](_0x1c1da9[_0xc430('0x2c')][_0xc430('0x2f')]));_0x542cba[_0xc430('0x2e')]=_0x542cba[_0xc430('0x2e')]['length']?_0x542cba[_0xc430('0x2e')]:_0x1f8086['model'];if(!_0x1c1da9[_0xc430('0x2c')][_0xc430('0x30')](_0xc430('0x31'))){_0x542cba[_0xc430('0x18')]=qs['limit'](_0x1c1da9[_0xc430('0x2c')]['limit']);_0x542cba['offset']=qs[_0xc430('0x1a')](_0x1c1da9[_0xc430('0x2c')]['offset']);}_0x542cba[_0xc430('0x32')]=qs[_0xc430('0x33')](_0x1c1da9[_0xc430('0x2c')][_0xc430('0x33')]);_0x542cba[_0xc430('0x34')]=qs[_0xc430('0x35')](_[_0xc430('0x36')](_0x1c1da9[_0xc430('0x2c')],_0x1f8086[_0xc430('0x35')]),_0x1d65ee);if(_0x1c1da9[_0xc430('0x2c')][_0xc430('0x37')]){_0x542cba[_0xc430('0x34')]=_[_0xc430('0x38')](_0x542cba[_0xc430('0x34')],{'$or':_[_0xc430('0x2a')](_0x1d65ee,function(_0x537e4c){if(_0x537e4c[_0xc430('0x39')]!==_0xc430('0x3a')){var _0x24363b={};_0x24363b[_0x537e4c[_0xc430('0x22')]]={'$like':'%'+_0x1c1da9['query'][_0xc430('0x37')]+'%'};return _0x24363b;}})});}_0x542cba=_[_0xc430('0x38')]({},_0x542cba,_0x1c1da9[_0xc430('0x3b')]);var _0x45b3dc={'where':_0x542cba[_0xc430('0x34')]};return db[_0xc430('0x25')]['count'](_0x45b3dc)[_0xc430('0x1e')](function(_0x348f2f){_0x4cf56c[_0xc430('0x1b')]=_0x348f2f;if(_0x1c1da9[_0xc430('0x2c')][_0xc430('0x3c')]){_0x542cba[_0xc430('0x3d')]=[{'all':!![]}];}return db[_0xc430('0x25')][_0xc430('0x3e')](_0x542cba);})[_0xc430('0x1e')](function(_0x4174d2){_0x4cf56c[_0xc430('0x3f')]=_0x4174d2;return _0x4cf56c;})[_0xc430('0x1e')](respondWithFilteredResult(_0x1591e3,_0x542cba))[_0xc430('0x40')](handleError(_0x1591e3,null));};exports[_0xc430('0x41')]=function(_0x5a9c4b,_0x47edb0){var _0x4983e0={'raw':!![],'where':{'id':_0x5a9c4b[_0xc430('0x42')]['id']}},_0x262063={};_0x262063[_0xc430('0x29')]=_[_0xc430('0x2b')](db[_0xc430('0x25')][_0xc430('0x26')]);_0x262063[_0xc430('0x2c')]=_[_0xc430('0x2b')](_0x5a9c4b[_0xc430('0x2c')]);_0x262063[_0xc430('0x35')]=_[_0xc430('0x2d')](_0x262063[_0xc430('0x29')],_0x262063[_0xc430('0x2c')]);_0x4983e0[_0xc430('0x2e')]=_[_0xc430('0x2d')](_0x262063[_0xc430('0x29')],qs['fields'](_0x5a9c4b[_0xc430('0x2c')][_0xc430('0x2f')]));_0x4983e0[_0xc430('0x2e')]=_0x4983e0[_0xc430('0x2e')][_0xc430('0x43')]?_0x4983e0[_0xc430('0x2e')]:_0x262063[_0xc430('0x29')];if(_0x5a9c4b[_0xc430('0x2c')]['includeAll']){_0x4983e0[_0xc430('0x3d')]=[{'all':!![]}];}_0x4983e0=_['merge']({},_0x4983e0,_0x5a9c4b[_0xc430('0x3b')]);return db[_0xc430('0x25')]['find'](_0x4983e0)['then'](handleEntityNotFound(_0x47edb0,null))[_0xc430('0x1e')](respondWithResult(_0x47edb0,null))['catch'](handleError(_0x47edb0,null));};exports['describe']=function(_0x10db27,_0x4eafae){return db[_0xc430('0x25')][_0xc430('0x44')]()[_0xc430('0x1e')](respondWithResult(_0x4eafae,null))['catch'](handleError(_0x4eafae,null));};exports[_0xc430('0x45')]=function(_0x2e7052,_0x19e563){if(_0x2e7052['body'][_0xc430('0x46')]){delete _0x2e7052[_0xc430('0x47')][_0xc430('0x46')];}return db[_0xc430('0x25')][_0xc430('0x48')]({'where':{'uniqueid':_0x2e7052[_0xc430('0x42')]['id']}})[_0xc430('0x1e')](handleEntityNotFound(_0x19e563,null))['then'](saveUpdates(_0x2e7052[_0xc430('0x47')],null))[_0xc430('0x1e')](respondWithResult(_0x19e563,null))[_0xc430('0x40')](handleError(_0x19e563,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x23cb41,_0x4178d7,_0x2d064b){return db[_0xc430('0x25')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x23cb41[_0xc430('0x42')]['id']},'attributes':[[db['sequelize']['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')](_0xc430('0x4c')))),_0xc430('0x4d')],[db['sequelize']['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db['sequelize'][_0xc430('0x4b')](_0xc430('0x4e')))),_0xc430('0x4f')],[db[_0xc430('0x4a')]['fn']('COUNT',db[_0xc430('0x4a')]['fn']('IF',db['sequelize'][_0xc430('0x4b')](_0xc430('0x50')))),_0xc430('0x51')],[db[_0xc430('0x4a')]['fn']('COUNT',db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0xc430('0x52')],[db[_0xc430('0x4a')]['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')](_0xc430('0x53')))),'dropContacts'],[db[_0xc430('0x4a')]['fn']('COUNT',db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')](_0xc430('0x54')))),_0xc430('0x55')],[db[_0xc430('0x4a')]['fn']('COUNT',db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')](_0xc430('0x56')))),_0xc430('0x57')],[db[_0xc430('0x4a')]['fn'](_0xc430('0x49'),db['sequelize']['fn']('IF',db[_0xc430('0x4a')]['literal'](_0xc430('0x58')))),'answeringMachine']]})[_0xc430('0x1e')](handleEntityNotFound(_0x4178d7,null))[_0xc430('0x1e')](respondWithResult(_0x4178d7,null))[_0xc430('0x40')](handleError(_0x4178d7,null));};exports[_0xc430('0x59')]=function(_0x147062,_0x45eec6,_0x5d3393){return db[_0xc430('0x25')][_0xc430('0x3e')]({'raw':![],'where':{'CampaignId':_0x147062['params']['id']},'attributes':[[db['sequelize']['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')](_0xc430('0x4c')))),_0xc430('0x4d')],[db[_0xc430('0x4a')]['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')](_0xc430('0x4e')))),'noAnswerContacts'],[db['sequelize']['fn'](_0xc430('0x49'),db['sequelize']['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')]('`state`\x20=\x205,\x201,\x20null'))),_0xc430('0x51')],[db['sequelize']['fn']('COUNT',db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')]['literal'](_0xc430('0x5a')))),'congestionContacts'],[db['sequelize']['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xc430('0x5b')],[db[_0xc430('0x4a')]['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db['sequelize'][_0xc430('0x4b')](_0xc430('0x54')))),_0xc430('0x55')],[db[_0xc430('0x4a')]['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')](_0xc430('0x56')))),_0xc430('0x57')],[db[_0xc430('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xc430('0x4b')](_0xc430('0x58')))),_0xc430('0x5c')]]})['then'](handleEntityNotFound(_0x45eec6,null))['then'](respondWithResult(_0x45eec6,null))[_0xc430('0x40')](handleError(_0x45eec6,null));};exports[_0xc430('0x5d')]=function(_0x31ae3c,_0x19c080,_0x256290){return db[_0xc430('0x5e')][_0xc430('0x48')]({'where':{'id':_0x31ae3c[_0xc430('0x42')]['id']}})[_0xc430('0x1e')](handleEntityNotFound(_0x19c080,null))[_0xc430('0x1e')](function(_0x5ca0f2){var _0x6debfb;if(_0x5ca0f2){_0x6debfb=squel[_0xc430('0x5f')]()[_0xc430('0x60')]('cm_hopper')['fromQuery'](['phone',_0xc430('0x61'),_0xc430('0x62'),_0xc430('0x63'),_0xc430('0x64'),'createdAt',_0xc430('0x65')],squel[_0xc430('0x66')]()[_0xc430('0x67')]('ANY_VALUE(calleridnum)',_0xc430('0x68'))['field'](_0xc430('0x69'),_0xc430('0x61'))[_0xc430('0x67')](_0xc430('0x6a'),_0xc430('0x62'))['field'](_0xc430('0x6b'),_0xc430('0x63'))[_0xc430('0x67')](_0xc430('0x6c'),'VoiceQueueId')['field'](_0xc430('0x69'),'createdAt')['field'](_0xc430('0x69'),_0xc430('0x65'))['from'](_0xc430('0x6d'))[_0xc430('0x34')](_0xc430('0x6e'),_0x31ae3c[_0xc430('0x42')]['id'][_0xc430('0x6f')]())[_0xc430('0x34')]('state\x20=\x20?',_0x31ae3c[_0xc430('0x47')][_0xc430('0x70')][_0xc430('0x6f')]())[_0xc430('0x34')]('calleridnum\x20IS\x20NOT\x20NULL')[_0xc430('0x34')](_0xc430('0x71'),squel[_0xc430('0x66')]()['field'](_0xc430('0x68'))['from']('cm_hopper')[_0xc430('0x34')]('VoiceQueueId\x20=\x20?',_0x31ae3c[_0xc430('0x42')]['id']['toString']()))[_0xc430('0x34')](_0xc430('0x71'),squel['select']()[_0xc430('0x67')](_0xc430('0x72'))['from'](_0xc430('0x6d'))[_0xc430('0x34')]('VoiceQueueId\x20=\x20?',_0x31ae3c[_0xc430('0x42')]['id'][_0xc430('0x6f')]())['where'](_0xc430('0x73')))[_0xc430('0x74')](_0xc430('0x62')))[_0xc430('0x6f')]();return db[_0xc430('0x4a')][_0xc430('0x2c')](_0x6debfb);}return[];})[_0xc430('0x1e')](respondWithResult(_0x19c080,null))[_0xc430('0x40')](handleError(_0x19c080,null));};exports[_0xc430('0x75')]=function(_0x19789f,_0x24b380,_0x4fe467){return db[_0xc430('0x76')][_0xc430('0x48')]({'where':{'id':_0x19789f[_0xc430('0x42')]['id']}})['then'](handleEntityNotFound(_0x24b380,null))['then'](function(_0x150a8a){var _0x4edead;if(_0x150a8a){_0x4edead=squel[_0xc430('0x5f')]()[_0xc430('0x60')]('cm_hopper')['fromQuery']([_0xc430('0x68'),_0xc430('0x61'),_0xc430('0x62'),'ListId',_0xc430('0x77'),'createdAt','updatedAt'],squel[_0xc430('0x66')]()[_0xc430('0x67')](_0xc430('0x78'),'phone')[_0xc430('0x67')](_0xc430('0x69'),_0xc430('0x61'))[_0xc430('0x67')](_0xc430('0x6a'),'ContactId')['field'](_0xc430('0x6b'),_0xc430('0x63'))[_0xc430('0x67')](_0xc430('0x79'),_0xc430('0x77'))[_0xc430('0x67')](_0xc430('0x69'),_0xc430('0x7a'))[_0xc430('0x67')](_0xc430('0x69'),_0xc430('0x65'))['from'](_0xc430('0x6d'))[_0xc430('0x34')](_0xc430('0x7b'),_0x19789f[_0xc430('0x42')]['id']['toString']())['where'](_0xc430('0x7c'),_0x19789f['body'][_0xc430('0x70')][_0xc430('0x6f')]())[_0xc430('0x34')](_0xc430('0x7d'))[_0xc430('0x34')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()['field']('phone')[_0xc430('0x7e')]('cm_hopper')['where'](_0xc430('0x7b'),_0x19789f[_0xc430('0x42')]['id'][_0xc430('0x6f')]()))[_0xc430('0x34')](_0xc430('0x71'),squel[_0xc430('0x66')]()[_0xc430('0x67')](_0xc430('0x72'))[_0xc430('0x7e')](_0xc430('0x6d'))[_0xc430('0x34')](_0xc430('0x7b'),_0x19789f[_0xc430('0x42')]['id']['toString']())[_0xc430('0x34')](_0xc430('0x73')))[_0xc430('0x74')](_0xc430('0x62')))[_0xc430('0x6f')]();return db[_0xc430('0x4a')][_0xc430('0x2c')](_0x4edead);}return[];})[_0xc430('0x1e')](respondWithResult(_0x24b380,null))['catch'](handleError(_0x24b380,null));};exports[_0xc430('0x7f')]=function(_0x6e48a3,_0x5be78a,_0x3bd6e1){return db[_0xc430('0x80')][_0xc430('0x81')]({'where':{'VoiceQueueId':_0x6e48a3[_0xc430('0x47')]['VoiceQueueId'],'CampaignId':_0x6e48a3[_0xc430('0x47')]['CampaignId'],'ContactId':_0x6e48a3['body'][_0xc430('0x62')]}})[_0xc430('0x1e')](handleEntityNotFound(_0x5be78a,null))[_0xc430('0x1e')](function(_0x207067){if(_0x207067){return _0x207067;}return null;})[_0xc430('0x1e')](respondWithResult(_0x5be78a,null))[_0xc430('0x40')](handleError(_0x5be78a,null));}; \ No newline at end of file +var _0x2a07=['jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','error','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','catch','show','params','fields','includeAll','describe','body','uniqueid','find','findAll','sequelize','COUNT','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x2010\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','congestionContacts','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','ANY_VALUE(calleridnum)','phone','field','NOW()','scheduledAt','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','toString','Campaign','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','group','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x17c9b4,_0x4eae19){var _0x12d12a=function(_0x8451d4){while(--_0x8451d4){_0x17c9b4['push'](_0x17c9b4['shift']());}};_0x12d12a(++_0x4eae19);}(_0x2a07,0x74));var _0x72a0=function(_0x34eabc,_0x51d411){_0x34eabc=_0x34eabc-0x0;var _0x43e72f=_0x2a07[_0x34eabc];return _0x43e72f;};'use strict';var emlformat=require(_0x72a0('0x0'));var rimraf=require(_0x72a0('0x1'));var zipdir=require(_0x72a0('0x2'));var jsonpatch=require(_0x72a0('0x3'));var rp=require(_0x72a0('0x4'));var moment=require('moment');var BPromise=require(_0x72a0('0x5'));var Mustache=require(_0x72a0('0x6'));var util=require(_0x72a0('0x7'));var path=require(_0x72a0('0x8'));var sox=require(_0x72a0('0x9'));var csv=require(_0x72a0('0xa'));var ejs=require(_0x72a0('0xb'));var fs=require('fs');var fs_extra=require(_0x72a0('0xc'));var _=require(_0x72a0('0xd'));var squel=require(_0x72a0('0xe'));var crypto=require(_0x72a0('0xf'));var jsforce=require(_0x72a0('0x10'));var deskjs=require(_0x72a0('0x11'));var toCsv=require(_0x72a0('0xa'));var querystring=require(_0x72a0('0x12'));var Papa=require(_0x72a0('0x13'));var Redis=require('ioredis');var authService=require(_0x72a0('0x14'));var qs=require(_0x72a0('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x72a0('0x16'));var logger=require(_0x72a0('0x17'))(_0x72a0('0x18'));var utils=require(_0x72a0('0x19'));var config=require(_0x72a0('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x72a0('0x1b'))['db'];function respondWithStatusCode(_0x335b9f,_0x123ca4){_0x123ca4=_0x123ca4||0xcc;return function(_0xf91a82){if(_0xf91a82){return _0x335b9f[_0x72a0('0x1c')](_0x123ca4);}return _0x335b9f[_0x72a0('0x1d')](_0x123ca4)[_0x72a0('0x1e')]();};}function respondWithResult(_0x5e0b5f,_0x4930c5){_0x4930c5=_0x4930c5||0xc8;return function(_0xe103dc){if(_0xe103dc){return _0x5e0b5f[_0x72a0('0x1d')](_0x4930c5)[_0x72a0('0x1f')](_0xe103dc);}};}function respondWithFilteredResult(_0x1d1133,_0x23b001){return function(_0x3f3d62){if(_0x3f3d62){var _0x4ab55e=typeof _0x23b001[_0x72a0('0x20')]===_0x72a0('0x21')&&typeof _0x23b001[_0x72a0('0x22')]===_0x72a0('0x21');var _0x2d1e95=_0x3f3d62['count'];var _0x100d8f=_0x4ab55e?0x0:_0x23b001[_0x72a0('0x20')];var _0x131b73=_0x4ab55e?_0x3f3d62['count']:_0x23b001[_0x72a0('0x20')]+_0x23b001[_0x72a0('0x22')];var _0x30899b;if(_0x131b73>=_0x2d1e95){_0x131b73=_0x2d1e95;_0x30899b=0xc8;}else{_0x30899b=0xce;}_0x1d1133[_0x72a0('0x1d')](_0x30899b);return _0x1d1133['set'](_0x72a0('0x23'),_0x100d8f+'-'+_0x131b73+'/'+_0x2d1e95)['json'](_0x3f3d62);}return null;};}function patchUpdates(_0x3d0607){return function(_0x315413){try{jsonpatch[_0x72a0('0x24')](_0x315413,_0x3d0607,!![]);}catch(_0x5c7479){return BPromise[_0x72a0('0x25')](_0x5c7479);}return _0x315413[_0x72a0('0x26')]();};}function saveUpdates(_0x1d22d8,_0x3d1965){return function(_0x5d6145){if(_0x5d6145){return _0x5d6145[_0x72a0('0x27')](_0x1d22d8)[_0x72a0('0x28')](function(_0x1ddd54){return _0x1ddd54;});}return null;};}function removeEntity(_0x23b918,_0x3022b0){return function(_0x174b1b){if(_0x174b1b){return _0x174b1b['destroy']()['then'](function(){_0x23b918[_0x72a0('0x1d')](0xcc)[_0x72a0('0x1e')]();});}};}function handleEntityNotFound(_0x123df4,_0x1504ed){return function(_0xf5cb49){if(!_0xf5cb49){_0x123df4[_0x72a0('0x1c')](0x194);}return _0xf5cb49;};}function handleError(_0xa5bda0,_0x15922a){_0x15922a=_0x15922a||0x1f4;return function(_0xee99e2){logger[_0x72a0('0x29')](_0xee99e2['stack']);if(_0xee99e2[_0x72a0('0x2a')]){delete _0xee99e2[_0x72a0('0x2a')];}_0xa5bda0[_0x72a0('0x1d')](_0x15922a)[_0x72a0('0x2b')](_0xee99e2);};}exports[_0x72a0('0x2c')]=function(_0x177a3a,_0x432179){var _0x12eda2={},_0x23c96a={},_0x916733={'count':0x0,'rows':[]};var _0x4ba037=_[_0x72a0('0x2d')](db[_0x72a0('0x2e')][_0x72a0('0x2f')],function(_0xfbe9b3){return{'name':_0xfbe9b3[_0x72a0('0x30')],'type':_0xfbe9b3[_0x72a0('0x31')][_0x72a0('0x32')]};});_0x23c96a['model']=_[_0x72a0('0x2d')](_0x4ba037,_0x72a0('0x2a'));_0x23c96a[_0x72a0('0x33')]=_[_0x72a0('0x34')](_0x177a3a[_0x72a0('0x33')]);_0x23c96a[_0x72a0('0x35')]=_[_0x72a0('0x36')](_0x23c96a[_0x72a0('0x37')],_0x23c96a['query']);_0x12eda2[_0x72a0('0x38')]=_[_0x72a0('0x36')](_0x23c96a[_0x72a0('0x37')],qs['fields'](_0x177a3a[_0x72a0('0x33')]['fields']));_0x12eda2[_0x72a0('0x38')]=_0x12eda2[_0x72a0('0x38')][_0x72a0('0x39')]?_0x12eda2[_0x72a0('0x38')]:_0x23c96a[_0x72a0('0x37')];if(!_0x177a3a[_0x72a0('0x33')][_0x72a0('0x3a')](_0x72a0('0x3b'))){_0x12eda2[_0x72a0('0x22')]=qs[_0x72a0('0x22')](_0x177a3a[_0x72a0('0x33')][_0x72a0('0x22')]);_0x12eda2['offset']=qs[_0x72a0('0x20')](_0x177a3a['query'][_0x72a0('0x20')]);}_0x12eda2[_0x72a0('0x3c')]=qs[_0x72a0('0x3d')](_0x177a3a[_0x72a0('0x33')][_0x72a0('0x3d')]);_0x12eda2[_0x72a0('0x3e')]=qs[_0x72a0('0x35')](_[_0x72a0('0x3f')](_0x177a3a[_0x72a0('0x33')],_0x23c96a['filters']),_0x4ba037);if(_0x177a3a['query'][_0x72a0('0x40')]){_0x12eda2[_0x72a0('0x3e')]=_[_0x72a0('0x41')](_0x12eda2[_0x72a0('0x3e')],{'$or':_[_0x72a0('0x2d')](_0x4ba037,function(_0x512a06){if(_0x512a06[_0x72a0('0x31')]!==_0x72a0('0x42')){var _0x582c90={};_0x582c90[_0x512a06[_0x72a0('0x2a')]]={'$like':'%'+_0x177a3a['query']['filter']+'%'};return _0x582c90;}})});}_0x12eda2=_['merge']({},_0x12eda2,_0x177a3a[_0x72a0('0x43')]);var _0x49633b={'where':_0x12eda2[_0x72a0('0x3e')]};return db[_0x72a0('0x2e')][_0x72a0('0x44')](_0x49633b)[_0x72a0('0x28')](function(_0x4bf56e){_0x916733['count']=_0x4bf56e;if(_0x177a3a['query']['includeAll']){_0x12eda2[_0x72a0('0x45')]=[{'all':!![]}];}return db[_0x72a0('0x2e')]['findAll'](_0x12eda2);})[_0x72a0('0x28')](function(_0x35d790){_0x916733['rows']=_0x35d790;return _0x916733;})[_0x72a0('0x28')](respondWithFilteredResult(_0x432179,_0x12eda2))[_0x72a0('0x46')](handleError(_0x432179,null));};exports[_0x72a0('0x47')]=function(_0xe4abe1,_0x340153){var _0x341451={'raw':!![],'where':{'id':_0xe4abe1[_0x72a0('0x48')]['id']}},_0x50eb7f={};_0x50eb7f['model']=_[_0x72a0('0x34')](db['CmHopperFinal'][_0x72a0('0x2f')]);_0x50eb7f[_0x72a0('0x33')]=_['keys'](_0xe4abe1[_0x72a0('0x33')]);_0x50eb7f['filters']=_[_0x72a0('0x36')](_0x50eb7f[_0x72a0('0x37')],_0x50eb7f[_0x72a0('0x33')]);_0x341451['attributes']=_[_0x72a0('0x36')](_0x50eb7f[_0x72a0('0x37')],qs[_0x72a0('0x49')](_0xe4abe1['query']['fields']));_0x341451[_0x72a0('0x38')]=_0x341451['attributes'][_0x72a0('0x39')]?_0x341451[_0x72a0('0x38')]:_0x50eb7f[_0x72a0('0x37')];if(_0xe4abe1[_0x72a0('0x33')][_0x72a0('0x4a')]){_0x341451[_0x72a0('0x45')]=[{'all':!![]}];}_0x341451=_[_0x72a0('0x41')]({},_0x341451,_0xe4abe1[_0x72a0('0x43')]);return db[_0x72a0('0x2e')]['find'](_0x341451)[_0x72a0('0x28')](handleEntityNotFound(_0x340153,null))[_0x72a0('0x28')](respondWithResult(_0x340153,null))[_0x72a0('0x46')](handleError(_0x340153,null));};exports[_0x72a0('0x4b')]=function(_0x3a669d,_0x304400){return db[_0x72a0('0x2e')]['describe']()['then'](respondWithResult(_0x304400,null))[_0x72a0('0x46')](handleError(_0x304400,null));};exports[_0x72a0('0x27')]=function(_0xe38fb3,_0x3cab6a){if(_0xe38fb3[_0x72a0('0x4c')][_0x72a0('0x4d')]){delete _0xe38fb3[_0x72a0('0x4c')][_0x72a0('0x4d')];}return db[_0x72a0('0x2e')][_0x72a0('0x4e')]({'where':{'uniqueid':_0xe38fb3['params']['id']}})[_0x72a0('0x28')](handleEntityNotFound(_0x3cab6a,null))[_0x72a0('0x28')](saveUpdates(_0xe38fb3[_0x72a0('0x4c')],null))[_0x72a0('0x28')](respondWithResult(_0x3cab6a,null))[_0x72a0('0x46')](handleError(_0x3cab6a,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x143410,_0x595243,_0x4d712b){return db[_0x72a0('0x2e')][_0x72a0('0x4f')]({'raw':![],'where':{'VoiceQueueId':_0x143410[_0x72a0('0x48')]['id']},'attributes':[[db[_0x72a0('0x50')]['fn'](_0x72a0('0x51'),db['sequelize']['fn']('IF',db[_0x72a0('0x50')][_0x72a0('0x52')]('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0x72a0('0x50')]['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')][_0x72a0('0x52')](_0x72a0('0x53')))),_0x72a0('0x54')],[db[_0x72a0('0x50')]['fn']('COUNT',db[_0x72a0('0x50')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x72a0('0x55')],[db[_0x72a0('0x50')]['fn']('COUNT',db[_0x72a0('0x50')]['fn']('IF',db['sequelize'][_0x72a0('0x52')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db[_0x72a0('0x50')]['fn'](_0x72a0('0x51'),db['sequelize']['fn']('IF',db[_0x72a0('0x50')]['literal'](_0x72a0('0x56')))),'dropContacts'],[db['sequelize']['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x72a0('0x57')],[db['sequelize']['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')][_0x72a0('0x52')](_0x72a0('0x58')))),_0x72a0('0x59')],[db[_0x72a0('0x50')]['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')][_0x72a0('0x52')](_0x72a0('0x5a')))),'answeringMachine']]})[_0x72a0('0x28')](handleEntityNotFound(_0x595243,null))['then'](respondWithResult(_0x595243,null))['catch'](handleError(_0x595243,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x522ee2,_0x237025,_0x4e5d05){return db[_0x72a0('0x2e')]['findAll']({'raw':![],'where':{'CampaignId':_0x522ee2[_0x72a0('0x48')]['id']},'attributes':[[db['sequelize']['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db['sequelize'][_0x72a0('0x52')](_0x72a0('0x5b')))),_0x72a0('0x5c')],[db[_0x72a0('0x50')]['fn']('COUNT',db[_0x72a0('0x50')]['fn']('IF',db['sequelize'][_0x72a0('0x52')](_0x72a0('0x53')))),_0x72a0('0x54')],[db['sequelize']['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')][_0x72a0('0x52')](_0x72a0('0x5d')))),'busyContacts'],[db['sequelize']['fn'](_0x72a0('0x51'),db['sequelize']['fn']('IF',db[_0x72a0('0x50')]['literal'](_0x72a0('0x5e')))),_0x72a0('0x5f')],[db['sequelize']['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')]['literal'](_0x72a0('0x56')))),'dropContacts'],[db[_0x72a0('0x50')]['fn'](_0x72a0('0x51'),db['sequelize']['fn']('IF',db[_0x72a0('0x50')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db[_0x72a0('0x50')]['fn']('COUNT',db[_0x72a0('0x50')]['fn']('IF',db['sequelize'][_0x72a0('0x52')](_0x72a0('0x58')))),_0x72a0('0x59')],[db['sequelize']['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')][_0x72a0('0x52')](_0x72a0('0x5a')))),'answeringMachine']]})[_0x72a0('0x28')](handleEntityNotFound(_0x237025,null))[_0x72a0('0x28')](respondWithResult(_0x237025,null))[_0x72a0('0x46')](handleError(_0x237025,null));};exports[_0x72a0('0x60')]=function(_0x4f0944,_0x3dd25d,_0x647e75){return db['VoiceQueue'][_0x72a0('0x4e')]({'where':{'id':_0x4f0944['params']['id']}})[_0x72a0('0x28')](handleEntityNotFound(_0x3dd25d,null))[_0x72a0('0x28')](function(_0xb17e09){var _0x1238a3;if(_0xb17e09){_0x1238a3=squel[_0x72a0('0x61')]()[_0x72a0('0x62')](_0x72a0('0x63'))['fromQuery'](['phone','scheduledAt',_0x72a0('0x64'),_0x72a0('0x65'),_0x72a0('0x66'),_0x72a0('0x67'),_0x72a0('0x68')],squel[_0x72a0('0x69')]()['field'](_0x72a0('0x6a'),_0x72a0('0x6b'))[_0x72a0('0x6c')](_0x72a0('0x6d'),_0x72a0('0x6e'))[_0x72a0('0x6c')](_0x72a0('0x6f'),'ContactId')[_0x72a0('0x6c')](_0x72a0('0x70'),_0x72a0('0x65'))[_0x72a0('0x6c')](_0x72a0('0x71'),_0x72a0('0x66'))['field'](_0x72a0('0x6d'),'createdAt')[_0x72a0('0x6c')](_0x72a0('0x6d'),_0x72a0('0x68'))[_0x72a0('0x72')](_0x72a0('0x73'))['where'](_0x72a0('0x74'),_0x4f0944[_0x72a0('0x48')]['id']['toString']())[_0x72a0('0x3e')](_0x72a0('0x75'),_0x4f0944[_0x72a0('0x4c')][_0x72a0('0x76')]['toString']())[_0x72a0('0x3e')](_0x72a0('0x77'))[_0x72a0('0x3e')](_0x72a0('0x78'),squel[_0x72a0('0x69')]()[_0x72a0('0x6c')](_0x72a0('0x6b'))[_0x72a0('0x72')](_0x72a0('0x63'))[_0x72a0('0x3e')](_0x72a0('0x74'),_0x4f0944[_0x72a0('0x48')]['id']['toString']()))[_0x72a0('0x3e')](_0x72a0('0x78'),squel[_0x72a0('0x69')]()[_0x72a0('0x6c')](_0x72a0('0x79'))[_0x72a0('0x72')](_0x72a0('0x73'))[_0x72a0('0x3e')]('VoiceQueueId\x20=\x20?',_0x4f0944[_0x72a0('0x48')]['id']['toString']())['where'](_0x72a0('0x7a')))['group']('ContactId'))[_0x72a0('0x7b')]();return db['sequelize'][_0x72a0('0x33')](_0x1238a3);}return[];})[_0x72a0('0x28')](respondWithResult(_0x3dd25d,null))[_0x72a0('0x46')](handleError(_0x3dd25d,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x344a69,_0x179ca2,_0x3832d7){return db[_0x72a0('0x7c')][_0x72a0('0x4e')]({'where':{'id':_0x344a69['params']['id']}})[_0x72a0('0x28')](handleEntityNotFound(_0x179ca2,null))[_0x72a0('0x28')](function(_0x38736e){var _0x4f421f;if(_0x38736e){_0x4f421f=squel[_0x72a0('0x61')]()[_0x72a0('0x62')](_0x72a0('0x63'))['fromQuery']([_0x72a0('0x6b'),_0x72a0('0x6e'),_0x72a0('0x64'),_0x72a0('0x65'),_0x72a0('0x7d'),_0x72a0('0x67'),_0x72a0('0x68')],squel[_0x72a0('0x69')]()[_0x72a0('0x6c')]('ANY_VALUE(calleridnum)',_0x72a0('0x6b'))[_0x72a0('0x6c')](_0x72a0('0x6d'),_0x72a0('0x6e'))[_0x72a0('0x6c')]('ANY_VALUE(ContactId)',_0x72a0('0x64'))[_0x72a0('0x6c')](_0x72a0('0x70'),_0x72a0('0x65'))['field'](_0x72a0('0x7e'),_0x72a0('0x7d'))[_0x72a0('0x6c')]('NOW()','createdAt')[_0x72a0('0x6c')](_0x72a0('0x6d'),_0x72a0('0x68'))[_0x72a0('0x72')](_0x72a0('0x73'))['where']('CampaignId\x20=\x20?',_0x344a69['params']['id'][_0x72a0('0x7b')]())['where'](_0x72a0('0x75'),_0x344a69['body']['state']['toString']())['where'](_0x72a0('0x77'))[_0x72a0('0x3e')](_0x72a0('0x78'),squel[_0x72a0('0x69')]()['field'](_0x72a0('0x6b'))[_0x72a0('0x72')]('cm_hopper')[_0x72a0('0x3e')](_0x72a0('0x7f'),_0x344a69['params']['id'][_0x72a0('0x7b')]()))[_0x72a0('0x3e')](_0x72a0('0x78'),squel[_0x72a0('0x69')]()['field']('calleridnum')[_0x72a0('0x72')](_0x72a0('0x73'))[_0x72a0('0x3e')](_0x72a0('0x7f'),_0x344a69[_0x72a0('0x48')]['id'][_0x72a0('0x7b')]())['where']('state\x20=\x204'))[_0x72a0('0x80')](_0x72a0('0x64')))['toString']();return db[_0x72a0('0x50')][_0x72a0('0x33')](_0x4f421f);}return[];})[_0x72a0('0x28')](respondWithResult(_0x179ca2,null))[_0x72a0('0x46')](handleError(_0x179ca2,null));};exports[_0x72a0('0x81')]=function(_0x167a80,_0x7533ea,_0x56bdf5){return db[_0x72a0('0x82')][_0x72a0('0x83')]({'where':{'VoiceQueueId':_0x167a80[_0x72a0('0x4c')]['VoiceQueueId'],'CampaignId':_0x167a80[_0x72a0('0x4c')][_0x72a0('0x7d')],'ContactId':_0x167a80[_0x72a0('0x4c')][_0x72a0('0x64')]}})[_0x72a0('0x28')](handleEntityNotFound(_0x7533ea,null))['then'](function(_0xc16765){if(_0xc16765){return _0xc16765;}return null;})[_0x72a0('0x28')](respondWithResult(_0x7533ea,null))[_0x72a0('0x46')](handleError(_0x7533ea,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 5bb5722..432a319 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 _0xdfb7=['CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','moment','bluebird','rimraf','./cmHopperFinal.attributes','exports'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xdfb7,0x178));var _0x7dfb=function(_0x685047,_0x51decf){_0x685047=_0x685047-0x0;var _0x1bb61f=_0xdfb7[_0x685047];return _0x1bb61f;};'use strict';var _=require(_0x7dfb('0x0'));var util=require(_0x7dfb('0x1'));var logger=require(_0x7dfb('0x2'))('api');var moment=require(_0x7dfb('0x3'));var BPromise=require(_0x7dfb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7dfb('0x5'));var config=require('../../config/environment');var attributes=require(_0x7dfb('0x6'));module[_0x7dfb('0x7')]=function(_0x3aebfb,_0x2bdc6d){return _0x3aebfb['define'](_0x7dfb('0x8'),attributes,{'tableName':_0x7dfb('0x9'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x7dfb('0xa')]},{'name':_0x7dfb('0xb'),'fields':[_0x7dfb('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1014=['cm_hopper_final','calleridnum','uniqueid','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal'];(function(_0x40cd61,_0x36162c){var _0x120ce8=function(_0x59c7cc){while(--_0x59c7cc){_0x40cd61['push'](_0x40cd61['shift']());}};_0x120ce8(++_0x36162c);}(_0x1014,0x65));var _0x4101=function(_0x8f6830,_0x7c8a1e){_0x8f6830=_0x8f6830-0x0;var _0x4ce2e5=_0x1014[_0x8f6830];return _0x4ce2e5;};'use strict';var _=require('lodash');var util=require(_0x4101('0x0'));var logger=require(_0x4101('0x1'))(_0x4101('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4101('0x3'));var fs=require('fs');var path=require(_0x4101('0x4'));var rimraf=require(_0x4101('0x5'));var config=require(_0x4101('0x6'));var attributes=require(_0x4101('0x7'));module[_0x4101('0x8')]=function(_0x3ef29a,_0x471354){return _0x3ef29a[_0x4101('0x9')](_0x4101('0xa'),attributes,{'tableName':_0x4101('0xb'),'paranoid':![],'indexes':[{'name':_0x4101('0xc'),'fields':[_0x4101('0xc')]},{'name':_0x4101('0xd'),'fields':[_0x4101('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index d3d4d83..290202a 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x37ad58,_0x6e5a80){var _0x29ccce=function(_0x26043b){while(--_0x26043b){_0x37ad58['push'](_0x37ad58['shift']());}};_0x29ccce(++_0x6e5a80);}(_0x7a54,0x106));var _0x47a5=function(_0x35fe96,_0x3c274c){_0x35fe96=_0x35fe96-0x0;var _0x54a649=_0x7a54[_0x35fe96];return _0x54a649;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x513a09,_0x57b5e1){var _0x319cd7=function(_0x41d282){while(--_0x41d282){_0x513a09['push'](_0x513a09['shift']());}};_0x319cd7(++_0x57b5e1);}(_0xb10b,0x12a));var _0xbb10=function(_0x282442,_0x135555){_0x282442=_0x282442-0x0;var _0xf97807=_0xb10b[_0x282442];return _0xf97807;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 6dd525d..ad97c02 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 _0x5324=['update','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper'];(function(_0x50720c,_0x13f3e0){var _0x3674cd=function(_0x4ae5e4){while(--_0x4ae5e4){_0x50720c['push'](_0x50720c['shift']());}};_0x3674cd(++_0x13f3e0);}(_0x5324,0x154));var _0x4532=function(_0x4f5a99,_0x505eba){_0x4f5a99=_0x4f5a99-0x0;var _0x43d44d=_0x5324[_0x4f5a99];return _0x43d44d;};'use strict';var multer=require(_0x4532('0x0'));var util=require(_0x4532('0x1'));var path=require(_0x4532('0x2'));var timeout=require(_0x4532('0x3'));var express=require('express');var router=express[_0x4532('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4532('0x5'));var interaction=require(_0x4532('0x6'));var config=require(_0x4532('0x7'));var controller=require(_0x4532('0x8'));router[_0x4532('0x9')]('/',auth[_0x4532('0xa')](),controller[_0x4532('0xb')]);router[_0x4532('0x9')]('/describe',auth[_0x4532('0xa')](),controller[_0x4532('0xc')]);router[_0x4532('0x9')](_0x4532('0xd'),auth[_0x4532('0xa')](),controller[_0x4532('0xe')]);router[_0x4532('0x9')](_0x4532('0xf'),auth[_0x4532('0xa')](),controller[_0x4532('0x10')]);router[_0x4532('0x9')](_0x4532('0x11'),auth['isAuthenticated'](),controller['countContactsIvrCampaignHopperFinal']);router[_0x4532('0x12')]('/voice/queue/moveContacts/:id',auth[_0x4532('0xa')](),controller[_0x4532('0x13')]);router[_0x4532('0x12')](_0x4532('0x14'),auth['isAuthenticated'](),controller[_0x4532('0x15')]);router[_0x4532('0x12')](_0x4532('0x16'),auth[_0x4532('0xa')](),controller[_0x4532('0x17')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x4532('0x18')]);module[_0x4532('0x19')]=router; \ No newline at end of file +var _0x21bd=['/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper','update','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','/describe','describe','/:id','show','countContactsQueueCampaignHopperFinal','get','post'];(function(_0x228b55,_0x1fbc48){var _0x25446a=function(_0x13de98){while(--_0x13de98){_0x228b55['push'](_0x228b55['shift']());}};_0x25446a(++_0x1fbc48);}(_0x21bd,0x157));var _0xd21b=function(_0x20813c,_0x12054f){_0x20813c=_0x20813c-0x0;var _0x4f1d5e=_0x21bd[_0x20813c];return _0x4f1d5e;};'use strict';var multer=require(_0xd21b('0x0'));var util=require(_0xd21b('0x1'));var path=require(_0xd21b('0x2'));var timeout=require('connect-timeout');var express=require(_0xd21b('0x3'));var router=express[_0xd21b('0x4')]();var fs_extra=require(_0xd21b('0x5'));var auth=require(_0xd21b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd21b('0x7'));var controller=require('./cmHopperFinal.controller');router['get']('/',auth[_0xd21b('0x8')](),controller[_0xd21b('0x9')]);router['get'](_0xd21b('0xa'),auth[_0xd21b('0x8')](),controller[_0xd21b('0xb')]);router['get'](_0xd21b('0xc'),auth[_0xd21b('0x8')](),controller[_0xd21b('0xd')]);router['get']('/voice/queue/countAttributes/:id',auth[_0xd21b('0x8')](),controller[_0xd21b('0xe')]);router[_0xd21b('0xf')]('/campaign/countAttributes/:id',auth[_0xd21b('0x8')](),controller['countContactsIvrCampaignHopperFinal']);router[_0xd21b('0x10')](_0xd21b('0x11'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x12')]);router[_0xd21b('0x10')](_0xd21b('0x13'),auth[_0xd21b('0x8')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0xd21b('0x10')](_0xd21b('0x14'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x15')]);router['put'](_0xd21b('0xc'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x16')]);module[_0xd21b('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 36f9750..25a8a4c 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 _0x44b5=['STRING','DATE','BOOLEAN','sequelize','INTEGER'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x44b5,0xe4));var _0x544b=function(_0x56a9ae,_0xe89971){_0x56a9ae=_0x56a9ae-0x0;var _0x5e5f28=_0x44b5[_0x56a9ae];return _0x5e5f28;};'use strict';var Sequelize=require(_0x544b('0x0'));module['exports']={'state':{'type':Sequelize[_0x544b('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x544b('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x544b('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x544b('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x544b('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x544b('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x544b('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x544b('0x2')]},'originatecalleridname':{'type':Sequelize[_0x544b('0x2')]},'calleridnum':{'type':Sequelize[_0x544b('0x2')]},'calleridname':{'type':Sequelize[_0x544b('0x2')]},'starttime':{'type':Sequelize[_0x544b('0x3')]},'responsetime':{'type':Sequelize[_0x544b('0x3')]},'answertime':{'type':Sequelize[_0x544b('0x3')]},'droptime':{'type':Sequelize[_0x544b('0x3')]},'endtime':{'type':Sequelize[_0x544b('0x3')]},'ringtime':{'type':Sequelize[_0x544b('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x544b('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x544b('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x544b('0x2')]},'amd':{'type':Sequelize[_0x544b('0x4')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x544b('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x544b('0x3')]},'recallme':{'type':Sequelize[_0x544b('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x544b('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x544b('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x544b('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x544b('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9307=['BOOLEAN','sequelize','exports','INTEGER','STRING','DATE'];(function(_0x41aada,_0x42af40){var _0x3ffcc8=function(_0x299e8c){while(--_0x299e8c){_0x41aada['push'](_0x41aada['shift']());}};_0x3ffcc8(++_0x42af40);}(_0x9307,0xeb));var _0x7930=function(_0x5d60f0,_0x11dec7){_0x5d60f0=_0x5d60f0-0x0;var _0x20aaf2=_0x9307[_0x5d60f0];return _0x20aaf2;};'use strict';var Sequelize=require(_0x7930('0x0'));module[_0x7930('0x1')]={'state':{'type':Sequelize[_0x7930('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x7930('0x3')]},'scheduledat':{'type':Sequelize[_0x7930('0x4')]},'countbusyretry':{'type':Sequelize[_0x7930('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7930('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7930('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x7930('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x7930('0x3')]},'calleridnum':{'type':Sequelize[_0x7930('0x3')]},'calleridname':{'type':Sequelize[_0x7930('0x3')]},'starttime':{'type':Sequelize[_0x7930('0x4')]},'responsetime':{'type':Sequelize[_0x7930('0x4')]},'answertime':{'type':Sequelize[_0x7930('0x4')]},'droptime':{'type':Sequelize[_0x7930('0x4')]},'endtime':{'type':Sequelize[_0x7930('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x7930('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x7930('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x7930('0x3')]},'campaign':{'type':Sequelize[_0x7930('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x7930('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x7930('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x7930('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x7930('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x7930('0x4')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x7930('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x7930('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7930('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7930('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index ee894e3..259088a 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 _0x6e79=['key','model','map','name','query','keys','intersection','fields','attributes','length','order','sort','filters','pick','filter','merge','where','options','CmHopperHistory','includeAll','include','findAll','rows','params','find','catch','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','apply','reject','save','update','then','error','stack','send','rawAttributes','fieldName','type'];(function(_0x1792a9,_0x112b0d){var _0x392586=function(_0x486cf4){while(--_0x486cf4){_0x1792a9['push'](_0x1792a9['shift']());}};_0x392586(++_0x112b0d);}(_0x6e79,0x6a));var _0x96e7=function(_0x1d2c0c,_0x40dc5a){_0x1d2c0c=_0x1d2c0c-0x0;var _0x423cef=_0x6e79[_0x1d2c0c];return _0x423cef;};'use strict';var emlformat=require(_0x96e7('0x0'));var rimraf=require(_0x96e7('0x1'));var zipdir=require(_0x96e7('0x2'));var jsonpatch=require(_0x96e7('0x3'));var rp=require(_0x96e7('0x4'));var moment=require(_0x96e7('0x5'));var BPromise=require(_0x96e7('0x6'));var Mustache=require(_0x96e7('0x7'));var util=require('util');var path=require(_0x96e7('0x8'));var sox=require(_0x96e7('0x9'));var csv=require(_0x96e7('0xa'));var ejs=require(_0x96e7('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x96e7('0xc'));var squel=require(_0x96e7('0xd'));var crypto=require(_0x96e7('0xe'));var jsforce=require(_0x96e7('0xf'));var deskjs=require(_0x96e7('0x10'));var toCsv=require(_0x96e7('0xa'));var querystring=require('querystring');var Papa=require(_0x96e7('0x11'));var Redis=require(_0x96e7('0x12'));var authService=require(_0x96e7('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x96e7('0x14'));var hardwareService=require(_0x96e7('0x15'));var logger=require(_0x96e7('0x16'))(_0x96e7('0x17'));var utils=require('../../config/utils');var config=require(_0x96e7('0x18'));var licenseUtil=require(_0x96e7('0x19'));var db=require(_0x96e7('0x1a'))['db'];function respondWithStatusCode(_0x2bf090,_0x5b03f3){_0x5b03f3=_0x5b03f3||0xcc;return function(_0xbb742e){if(_0xbb742e){return _0x2bf090['sendStatus'](_0x5b03f3);}return _0x2bf090[_0x96e7('0x1b')](_0x5b03f3)[_0x96e7('0x1c')]();};}function respondWithResult(_0x42e274,_0x2360c5){_0x2360c5=_0x2360c5||0xc8;return function(_0x2528eb){if(_0x2528eb){return _0x42e274[_0x96e7('0x1b')](_0x2360c5)[_0x96e7('0x1d')](_0x2528eb);}};}function respondWithFilteredResult(_0x5df744,_0x12da42){return function(_0x5edeba){if(_0x5edeba){var _0xc21b6e=typeof _0x12da42['offset']===_0x96e7('0x1e')&&typeof _0x12da42['limit']===_0x96e7('0x1e');var _0x573555=_0x5edeba[_0x96e7('0x1f')];var _0x1dd571=_0xc21b6e?0x0:_0x12da42[_0x96e7('0x20')];var _0x3de32f=_0xc21b6e?_0x5edeba['count']:_0x12da42[_0x96e7('0x20')]+_0x12da42[_0x96e7('0x21')];var _0x3329d1;if(_0x3de32f>=_0x573555){_0x3de32f=_0x573555;_0x3329d1=0xc8;}else{_0x3329d1=0xce;}_0x5df744['status'](_0x3329d1);return _0x5df744[_0x96e7('0x22')]('Content-Range',_0x1dd571+'-'+_0x3de32f+'/'+_0x573555)[_0x96e7('0x1d')](_0x5edeba);}return null;};}function patchUpdates(_0x34ac33){return function(_0x4b3ac7){try{jsonpatch[_0x96e7('0x23')](_0x4b3ac7,_0x34ac33,!![]);}catch(_0x56fc24){return BPromise[_0x96e7('0x24')](_0x56fc24);}return _0x4b3ac7[_0x96e7('0x25')]();};}function saveUpdates(_0x38d12f,_0xff8342){return function(_0xb3495){if(_0xb3495){return _0xb3495[_0x96e7('0x26')](_0x38d12f)[_0x96e7('0x27')](function(_0x411761){return _0x411761;});}return null;};}function removeEntity(_0x2f6a39,_0x14eaf4){return function(_0x30d4a0){if(_0x30d4a0){return _0x30d4a0['destroy']()[_0x96e7('0x27')](function(){_0x2f6a39['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x487b8f,_0x5c4e42){return function(_0x4f536f){if(!_0x4f536f){_0x487b8f['sendStatus'](0x194);}return _0x4f536f;};}function handleError(_0x5265f1,_0x232728){_0x232728=_0x232728||0x1f4;return function(_0x4f1b4f){logger[_0x96e7('0x28')](_0x4f1b4f[_0x96e7('0x29')]);if(_0x4f1b4f['name']){delete _0x4f1b4f['name'];}_0x5265f1[_0x96e7('0x1b')](_0x232728)[_0x96e7('0x2a')](_0x4f1b4f);};}exports['index']=function(_0x11e5a7,_0x582760){var _0x272503={},_0x319f0c={},_0x59519e={'count':0x0,'rows':[]};var _0xe9e8a5=_['map'](db['CmHopperHistory'][_0x96e7('0x2b')],function(_0xa44597){return{'name':_0xa44597[_0x96e7('0x2c')],'type':_0xa44597[_0x96e7('0x2d')][_0x96e7('0x2e')]};});_0x319f0c[_0x96e7('0x2f')]=_[_0x96e7('0x30')](_0xe9e8a5,_0x96e7('0x31'));_0x319f0c[_0x96e7('0x32')]=_[_0x96e7('0x33')](_0x11e5a7[_0x96e7('0x32')]);_0x319f0c['filters']=_['intersection'](_0x319f0c[_0x96e7('0x2f')],_0x319f0c[_0x96e7('0x32')]);_0x272503['attributes']=_[_0x96e7('0x34')](_0x319f0c[_0x96e7('0x2f')],qs[_0x96e7('0x35')](_0x11e5a7[_0x96e7('0x32')][_0x96e7('0x35')]));_0x272503[_0x96e7('0x36')]=_0x272503[_0x96e7('0x36')][_0x96e7('0x37')]?_0x272503[_0x96e7('0x36')]:_0x319f0c[_0x96e7('0x2f')];if(!_0x11e5a7[_0x96e7('0x32')]['hasOwnProperty']('nolimit')){_0x272503[_0x96e7('0x21')]=qs[_0x96e7('0x21')](_0x11e5a7[_0x96e7('0x32')][_0x96e7('0x21')]);_0x272503[_0x96e7('0x20')]=qs[_0x96e7('0x20')](_0x11e5a7[_0x96e7('0x32')][_0x96e7('0x20')]);}_0x272503[_0x96e7('0x38')]=qs[_0x96e7('0x39')](_0x11e5a7[_0x96e7('0x32')][_0x96e7('0x39')]);_0x272503['where']=qs[_0x96e7('0x3a')](_[_0x96e7('0x3b')](_0x11e5a7[_0x96e7('0x32')],_0x319f0c[_0x96e7('0x3a')]),_0xe9e8a5);if(_0x11e5a7[_0x96e7('0x32')][_0x96e7('0x3c')]){_0x272503['where']=_[_0x96e7('0x3d')](_0x272503[_0x96e7('0x3e')],{'$or':_['map'](_0xe9e8a5,function(_0x3eb28c){if(_0x3eb28c['type']!=='VIRTUAL'){var _0x1cbbd7={};_0x1cbbd7[_0x3eb28c[_0x96e7('0x31')]]={'$like':'%'+_0x11e5a7[_0x96e7('0x32')][_0x96e7('0x3c')]+'%'};return _0x1cbbd7;}})});}_0x272503=_[_0x96e7('0x3d')]({},_0x272503,_0x11e5a7[_0x96e7('0x3f')]);var _0xcbb44b={'where':_0x272503[_0x96e7('0x3e')]};return db[_0x96e7('0x40')]['count'](_0xcbb44b)[_0x96e7('0x27')](function(_0x3d753f){_0x59519e['count']=_0x3d753f;if(_0x11e5a7['query'][_0x96e7('0x41')]){_0x272503[_0x96e7('0x42')]=[{'all':!![]}];}return db[_0x96e7('0x40')][_0x96e7('0x43')](_0x272503);})[_0x96e7('0x27')](function(_0x3060f3){_0x59519e[_0x96e7('0x44')]=_0x3060f3;return _0x59519e;})[_0x96e7('0x27')](respondWithFilteredResult(_0x582760,_0x272503))['catch'](handleError(_0x582760,null));};exports['show']=function(_0x4fb1f9,_0x30a702){var _0x2546c0={'raw':!![],'where':{'id':_0x4fb1f9[_0x96e7('0x45')]['id']}},_0x25285b={};_0x25285b[_0x96e7('0x2f')]=_[_0x96e7('0x33')](db[_0x96e7('0x40')][_0x96e7('0x2b')]);_0x25285b[_0x96e7('0x32')]=_[_0x96e7('0x33')](_0x4fb1f9['query']);_0x25285b['filters']=_[_0x96e7('0x34')](_0x25285b[_0x96e7('0x2f')],_0x25285b['query']);_0x2546c0[_0x96e7('0x36')]=_[_0x96e7('0x34')](_0x25285b[_0x96e7('0x2f')],qs[_0x96e7('0x35')](_0x4fb1f9[_0x96e7('0x32')][_0x96e7('0x35')]));_0x2546c0['attributes']=_0x2546c0['attributes'][_0x96e7('0x37')]?_0x2546c0['attributes']:_0x25285b[_0x96e7('0x2f')];if(_0x4fb1f9['query'][_0x96e7('0x41')]){_0x2546c0[_0x96e7('0x42')]=[{'all':!![]}];}_0x2546c0=_[_0x96e7('0x3d')]({},_0x2546c0,_0x4fb1f9[_0x96e7('0x3f')]);return db[_0x96e7('0x40')][_0x96e7('0x46')](_0x2546c0)[_0x96e7('0x27')](handleEntityNotFound(_0x30a702,null))[_0x96e7('0x27')](respondWithResult(_0x30a702,null))[_0x96e7('0x47')](handleError(_0x30a702,null));};exports[_0x96e7('0x48')]=function(_0x2d457d,_0x4ad779){return db[_0x96e7('0x40')][_0x96e7('0x48')](_0x2d457d[_0x96e7('0x49')],{})[_0x96e7('0x27')](respondWithResult(_0x4ad779,0xc9))['catch'](handleError(_0x4ad779,null));};exports[_0x96e7('0x4a')]=function(_0x2b70bc,_0x251560){return db[_0x96e7('0x40')][_0x96e7('0x4a')]()[_0x96e7('0x27')](respondWithResult(_0x251560,null))['catch'](handleError(_0x251560,null));};exports[_0x96e7('0x26')]=function(_0x47e9e6,_0x404847){if(_0x47e9e6['body'][_0x96e7('0x4b')]){delete _0x47e9e6[_0x96e7('0x49')][_0x96e7('0x4b')];}return db[_0x96e7('0x40')][_0x96e7('0x46')]({'where':{'uniqueid':_0x47e9e6[_0x96e7('0x45')]['id']}})[_0x96e7('0x27')](handleEntityNotFound(_0x404847,null))['then'](saveUpdates(_0x47e9e6['body'],null))[_0x96e7('0x27')](respondWithResult(_0x404847,null))[_0x96e7('0x47')](handleError(_0x404847,null));}; \ No newline at end of file +var _0xc827=['where','filters','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','params','options','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','api','../../config/license/util','end','status','json','undefined','count','offset','limit','set','Content-Range','apply','update','then','destroy','sendStatus','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x55ea94,_0x3ac6a4){var _0x20b522=function(_0x314d9b){while(--_0x314d9b){_0x55ea94['push'](_0x55ea94['shift']());}};_0x20b522(++_0x3ac6a4);}(_0xc827,0xeb));var _0x7c82=function(_0x2792f5,_0x114e9a){_0x2792f5=_0x2792f5-0x0;var _0x568111=_0xc827[_0x2792f5];return _0x568111;};'use strict';var emlformat=require(_0x7c82('0x0'));var rimraf=require(_0x7c82('0x1'));var zipdir=require(_0x7c82('0x2'));var jsonpatch=require(_0x7c82('0x3'));var rp=require(_0x7c82('0x4'));var moment=require('moment');var BPromise=require(_0x7c82('0x5'));var Mustache=require(_0x7c82('0x6'));var util=require(_0x7c82('0x7'));var path=require(_0x7c82('0x8'));var sox=require(_0x7c82('0x9'));var csv=require(_0x7c82('0xa'));var ejs=require(_0x7c82('0xb'));var fs=require('fs');var fs_extra=require(_0x7c82('0xc'));var _=require(_0x7c82('0xd'));var squel=require(_0x7c82('0xe'));var crypto=require(_0x7c82('0xf'));var jsforce=require(_0x7c82('0x10'));var deskjs=require(_0x7c82('0x11'));var toCsv=require(_0x7c82('0xa'));var querystring=require(_0x7c82('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7c82('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7c82('0x14'));var logger=require('../../config/logger')(_0x7c82('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7c82('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50e4e2,_0x1567e1){_0x1567e1=_0x1567e1||0xcc;return function(_0x5d5b74){if(_0x5d5b74){return _0x50e4e2['sendStatus'](_0x1567e1);}return _0x50e4e2['status'](_0x1567e1)[_0x7c82('0x17')]();};}function respondWithResult(_0xce6fee,_0x2a5274){_0x2a5274=_0x2a5274||0xc8;return function(_0x3a8fc1){if(_0x3a8fc1){return _0xce6fee[_0x7c82('0x18')](_0x2a5274)[_0x7c82('0x19')](_0x3a8fc1);}};}function respondWithFilteredResult(_0xe4f0c5,_0x871fa5){return function(_0x47b56d){if(_0x47b56d){var _0x5e616a=typeof _0x871fa5['offset']===_0x7c82('0x1a')&&typeof _0x871fa5['limit']==='undefined';var _0x47afe1=_0x47b56d[_0x7c82('0x1b')];var _0x279e73=_0x5e616a?0x0:_0x871fa5['offset'];var _0x574f63=_0x5e616a?_0x47b56d[_0x7c82('0x1b')]:_0x871fa5[_0x7c82('0x1c')]+_0x871fa5[_0x7c82('0x1d')];var _0x369769;if(_0x574f63>=_0x47afe1){_0x574f63=_0x47afe1;_0x369769=0xc8;}else{_0x369769=0xce;}_0xe4f0c5[_0x7c82('0x18')](_0x369769);return _0xe4f0c5[_0x7c82('0x1e')](_0x7c82('0x1f'),_0x279e73+'-'+_0x574f63+'/'+_0x47afe1)['json'](_0x47b56d);}return null;};}function patchUpdates(_0x129846){return function(_0xdea50e){try{jsonpatch[_0x7c82('0x20')](_0xdea50e,_0x129846,!![]);}catch(_0x5e9402){return BPromise['reject'](_0x5e9402);}return _0xdea50e['save']();};}function saveUpdates(_0x1b2bbe,_0x2e9f2f){return function(_0x2edcf4){if(_0x2edcf4){return _0x2edcf4[_0x7c82('0x21')](_0x1b2bbe)[_0x7c82('0x22')](function(_0x3ee902){return _0x3ee902;});}return null;};}function removeEntity(_0x38490e,_0x564886){return function(_0x1cd354){if(_0x1cd354){return _0x1cd354[_0x7c82('0x23')]()[_0x7c82('0x22')](function(){_0x38490e[_0x7c82('0x18')](0xcc)[_0x7c82('0x17')]();});}};}function handleEntityNotFound(_0x33f455,_0x3105ec){return function(_0x5b8584){if(!_0x5b8584){_0x33f455[_0x7c82('0x24')](0x194);}return _0x5b8584;};}function handleError(_0x5a2684,_0x379816){_0x379816=_0x379816||0x1f4;return function(_0x1ee966){logger[_0x7c82('0x25')](_0x1ee966[_0x7c82('0x26')]);if(_0x1ee966[_0x7c82('0x27')]){delete _0x1ee966[_0x7c82('0x27')];}_0x5a2684[_0x7c82('0x18')](_0x379816)[_0x7c82('0x28')](_0x1ee966);};}exports[_0x7c82('0x29')]=function(_0x502dd4,_0xc1fed2){var _0x4676b8={},_0x28ec69={},_0x1d368={'count':0x0,'rows':[]};var _0x328929=_[_0x7c82('0x2a')](db[_0x7c82('0x2b')][_0x7c82('0x2c')],function(_0x12a41a){return{'name':_0x12a41a[_0x7c82('0x2d')],'type':_0x12a41a[_0x7c82('0x2e')][_0x7c82('0x2f')]};});_0x28ec69[_0x7c82('0x30')]=_[_0x7c82('0x2a')](_0x328929,'name');_0x28ec69[_0x7c82('0x31')]=_[_0x7c82('0x32')](_0x502dd4[_0x7c82('0x31')]);_0x28ec69['filters']=_[_0x7c82('0x33')](_0x28ec69[_0x7c82('0x30')],_0x28ec69[_0x7c82('0x31')]);_0x4676b8[_0x7c82('0x34')]=_[_0x7c82('0x33')](_0x28ec69[_0x7c82('0x30')],qs['fields'](_0x502dd4[_0x7c82('0x31')][_0x7c82('0x35')]));_0x4676b8['attributes']=_0x4676b8[_0x7c82('0x34')][_0x7c82('0x36')]?_0x4676b8[_0x7c82('0x34')]:_0x28ec69[_0x7c82('0x30')];if(!_0x502dd4[_0x7c82('0x31')][_0x7c82('0x37')](_0x7c82('0x38'))){_0x4676b8[_0x7c82('0x1d')]=qs[_0x7c82('0x1d')](_0x502dd4[_0x7c82('0x31')][_0x7c82('0x1d')]);_0x4676b8['offset']=qs['offset'](_0x502dd4[_0x7c82('0x31')][_0x7c82('0x1c')]);}_0x4676b8['order']=qs['sort'](_0x502dd4[_0x7c82('0x31')]['sort']);_0x4676b8[_0x7c82('0x39')]=qs[_0x7c82('0x3a')](_[_0x7c82('0x3b')](_0x502dd4[_0x7c82('0x31')],_0x28ec69[_0x7c82('0x3a')]),_0x328929);if(_0x502dd4['query'][_0x7c82('0x3c')]){_0x4676b8[_0x7c82('0x39')]=_[_0x7c82('0x3d')](_0x4676b8[_0x7c82('0x39')],{'$or':_[_0x7c82('0x2a')](_0x328929,function(_0x108d9d){if(_0x108d9d[_0x7c82('0x2e')]!==_0x7c82('0x3e')){var _0x52b0cf={};_0x52b0cf[_0x108d9d[_0x7c82('0x27')]]={'$like':'%'+_0x502dd4['query']['filter']+'%'};return _0x52b0cf;}})});}_0x4676b8=_['merge']({},_0x4676b8,_0x502dd4['options']);var _0x36a631={'where':_0x4676b8[_0x7c82('0x39')]};return db[_0x7c82('0x2b')]['count'](_0x36a631)[_0x7c82('0x22')](function(_0x451e90){_0x1d368[_0x7c82('0x1b')]=_0x451e90;if(_0x502dd4[_0x7c82('0x31')]['includeAll']){_0x4676b8[_0x7c82('0x3f')]=[{'all':!![]}];}return db[_0x7c82('0x2b')][_0x7c82('0x40')](_0x4676b8);})[_0x7c82('0x22')](function(_0x4d3973){_0x1d368[_0x7c82('0x41')]=_0x4d3973;return _0x1d368;})[_0x7c82('0x22')](respondWithFilteredResult(_0xc1fed2,_0x4676b8))[_0x7c82('0x42')](handleError(_0xc1fed2,null));};exports['show']=function(_0x92b426,_0x3bbb2a){var _0x24f877={'raw':!![],'where':{'id':_0x92b426[_0x7c82('0x43')]['id']}},_0x37a149={};_0x37a149[_0x7c82('0x30')]=_[_0x7c82('0x32')](db[_0x7c82('0x2b')][_0x7c82('0x2c')]);_0x37a149[_0x7c82('0x31')]=_[_0x7c82('0x32')](_0x92b426[_0x7c82('0x31')]);_0x37a149['filters']=_[_0x7c82('0x33')](_0x37a149[_0x7c82('0x30')],_0x37a149[_0x7c82('0x31')]);_0x24f877[_0x7c82('0x34')]=_[_0x7c82('0x33')](_0x37a149[_0x7c82('0x30')],qs[_0x7c82('0x35')](_0x92b426[_0x7c82('0x31')][_0x7c82('0x35')]));_0x24f877['attributes']=_0x24f877[_0x7c82('0x34')]['length']?_0x24f877[_0x7c82('0x34')]:_0x37a149[_0x7c82('0x30')];if(_0x92b426[_0x7c82('0x31')]['includeAll']){_0x24f877[_0x7c82('0x3f')]=[{'all':!![]}];}_0x24f877=_[_0x7c82('0x3d')]({},_0x24f877,_0x92b426[_0x7c82('0x44')]);return db[_0x7c82('0x2b')]['find'](_0x24f877)[_0x7c82('0x22')](handleEntityNotFound(_0x3bbb2a,null))[_0x7c82('0x22')](respondWithResult(_0x3bbb2a,null))[_0x7c82('0x42')](handleError(_0x3bbb2a,null));};exports[_0x7c82('0x45')]=function(_0x4d5983,_0x4a9f2f){return db['CmHopperHistory'][_0x7c82('0x45')](_0x4d5983[_0x7c82('0x46')],{})['then'](respondWithResult(_0x4a9f2f,0xc9))[_0x7c82('0x42')](handleError(_0x4a9f2f,null));};exports[_0x7c82('0x47')]=function(_0x58e2ce,_0x5052dc){return db[_0x7c82('0x2b')][_0x7c82('0x47')]()[_0x7c82('0x22')](respondWithResult(_0x5052dc,null))['catch'](handleError(_0x5052dc,null));};exports['update']=function(_0x509e5f,_0x836fff){if(_0x509e5f['body'][_0x7c82('0x48')]){delete _0x509e5f['body'][_0x7c82('0x48')];}return db[_0x7c82('0x2b')]['find']({'where':{'uniqueid':_0x509e5f[_0x7c82('0x43')]['id']}})[_0x7c82('0x22')](handleEntityNotFound(_0x836fff,null))[_0x7c82('0x22')](saveUpdates(_0x509e5f[_0x7c82('0x46')],null))[_0x7c82('0x22')](respondWithResult(_0x836fff,null))[_0x7c82('0x42')](handleError(_0x836fff,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 7a329f5..343f3ab 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 _0x87f1=['CmHopperHistory','cm_hopper_history','endtime','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0x87f1,0x170));var _0x187f=function(_0x815de6,_0x2772bc){_0x815de6=_0x815de6-0x0;var _0x5251d5=_0x87f1[_0x815de6];return _0x5251d5;};'use strict';var _=require('lodash');var util=require(_0x187f('0x0'));var logger=require(_0x187f('0x1'))(_0x187f('0x2'));var moment=require(_0x187f('0x3'));var BPromise=require(_0x187f('0x4'));var rp=require(_0x187f('0x5'));var fs=require('fs');var path=require(_0x187f('0x6'));var rimraf=require('rimraf');var config=require(_0x187f('0x7'));var attributes=require('./cmHopperHistory.attributes');module[_0x187f('0x8')]=function(_0x591147,_0x1115d1){return _0x591147['define'](_0x187f('0x9'),attributes,{'tableName':_0x187f('0xa'),'paranoid':![],'indexes':[{'name':_0x187f('0xb'),'fields':[_0x187f('0xb')]},{'name':_0x187f('0xc'),'fields':[_0x187f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xafcd=['rimraf','../../config/environment','./cmHopperHistory.attributes','define','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5a9e79,_0x2fae9d){var _0x24b81c=function(_0x28ec38){while(--_0x28ec38){_0x5a9e79['push'](_0x5a9e79['shift']());}};_0x24b81c(++_0x2fae9d);}(_0xafcd,0x157));var _0xdafc=function(_0x4adad3,_0x202bba){_0x4adad3=_0x4adad3-0x0;var _0x52dae4=_0xafcd[_0x4adad3];return _0x52dae4;};'use strict';var _=require(_0xdafc('0x0'));var util=require(_0xdafc('0x1'));var logger=require(_0xdafc('0x2'))(_0xdafc('0x3'));var moment=require(_0xdafc('0x4'));var BPromise=require(_0xdafc('0x5'));var rp=require(_0xdafc('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdafc('0x7'));var config=require(_0xdafc('0x8'));var attributes=require(_0xdafc('0x9'));module['exports']=function(_0x3b4373,_0x2aa781){return _0x3b4373[_0xdafc('0xa')]('CmHopperHistory',attributes,{'tableName':_0xdafc('0xb'),'paranoid':![],'indexes':[{'name':_0xdafc('0xc'),'fields':[_0xdafc('0xc')]},{'name':_0xdafc('0xd'),'fields':[_0xdafc('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 473f868..337984a 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 _0x2b52=['outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','campaign','GetVoiceQueueHopperHistory','name','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','stringify','AvgHandleTime','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null'];(function(_0x42e462,_0x316aff){var _0x19f62b=function(_0x1a07cc){while(--_0x1a07cc){_0x42e462['push'](_0x42e462['shift']());}};_0x19f62b(++_0x316aff);}(_0x2b52,0x12a));var _0x22b5=function(_0x23c73d,_0x357b21){_0x23c73d=_0x23c73d-0x0;var _0x36ba47=_0x2b52[_0x23c73d];return _0x36ba47;};'use strict';var _=require(_0x22b5('0x0'));var util=require(_0x22b5('0x1'));var moment=require('moment');var BPromise=require(_0x22b5('0x2'));var rs=require(_0x22b5('0x3'));var fs=require('fs');var Redis=require(_0x22b5('0x4'));var db=require(_0x22b5('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x22b5('0x6'));var config=require(_0x22b5('0x7'));var jayson=require(_0x22b5('0x8'));var client=jayson[_0x22b5('0x9')][_0x22b5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d4087,_0x51a96c,_0x41976f){return new BPromise(function(_0x53b1cc,_0x4e0efa){return client['request'](_0x2d4087,_0x41976f)[_0x22b5('0xb')](function(_0xa9a8b9){logger[_0x22b5('0xc')](_0x22b5('0xd'),_0x51a96c,_0x22b5('0xe'));logger[_0x22b5('0xf')](_0x22b5('0x10'),_0x51a96c,_0x22b5('0xe'),JSON['stringify'](_0xa9a8b9));if(_0xa9a8b9[_0x22b5('0x11')]){if(_0xa9a8b9[_0x22b5('0x11')][_0x22b5('0x12')]===0x1f4){logger[_0x22b5('0x11')](_0x22b5('0xd'),_0x51a96c,_0xa9a8b9[_0x22b5('0x11')][_0x22b5('0x13')]);return _0x4e0efa(_0xa9a8b9[_0x22b5('0x11')]['message']);}logger[_0x22b5('0x11')](_0x22b5('0xd'),_0x51a96c,_0xa9a8b9[_0x22b5('0x11')][_0x22b5('0x13')]);return _0x53b1cc(_0xa9a8b9[_0x22b5('0x11')][_0x22b5('0x13')]);}else{logger['info'](_0x22b5('0xd'),_0x51a96c,_0x22b5('0xe'));_0x53b1cc(_0xa9a8b9[_0x22b5('0x14')][_0x22b5('0x13')]);}})[_0x22b5('0x15')](function(_0xec0c63){logger[_0x22b5('0x11')](_0x22b5('0xd'),_0x51a96c,_0xec0c63);_0x4e0efa(_0xec0c63);});});}exports[_0x22b5('0x16')]=function(_0x1f41b9){var _0x439b87=this;return new Promise(function(_0x4e6da4,_0x413611){return db[_0x22b5('0x17')][_0x22b5('0x18')](_0x1f41b9[_0x22b5('0x19')],{'raw':_0x1f41b9[_0x22b5('0x1a')]?_0x1f41b9['options'][_0x22b5('0x1b')]===undefined?!![]:![]:!![]})[_0x22b5('0xb')](function(_0x3a3537){logger['info'](_0x22b5('0x16'),_0x1f41b9);logger[_0x22b5('0xf')](_0x22b5('0x16'),_0x1f41b9,JSON[_0x22b5('0x1c')](_0x3a3537));_0x4e6da4(_0x3a3537);})['catch'](function(_0x3b0c31){logger[_0x22b5('0x11')](_0x22b5('0x16'),_0x3b0c31[_0x22b5('0x13')],_0x1f41b9);_0x413611(_0x439b87[_0x22b5('0x11')](0x1f4,_0x3b0c31[_0x22b5('0x13')]));});});};exports[_0x22b5('0x1d')]=function(_0x3ccdbd){var _0x280f93=this;return new Promise(function(_0x4d10fe,_0x47d3c5){return db[_0x22b5('0x17')][_0x22b5('0x1e')]({'raw':_0x3ccdbd[_0x22b5('0x1a')]?_0x3ccdbd[_0x22b5('0x1a')][_0x22b5('0x1b')]===undefined?!![]:![]:!![],'where':_0x3ccdbd[_0x22b5('0x1a')]?_0x3ccdbd[_0x22b5('0x1a')][_0x22b5('0x1f')]||null:null,'attributes':[[db[_0x22b5('0x20')]['fn'](_0x22b5('0x21'),db[_0x22b5('0x20')][_0x22b5('0x22')]('id')),_0x22b5('0x23')],[db[_0x22b5('0x20')]['fn'](_0x22b5('0x21'),db['sequelize']['fn']('IF',db['sequelize'][_0x22b5('0x24')](_0x22b5('0x25')))),_0x22b5('0x26')],[db[_0x22b5('0x20')]['fn']('COUNT',db[_0x22b5('0x20')]['fn']('IF',db[_0x22b5('0x20')][_0x22b5('0x24')](_0x22b5('0x27')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x22b5('0x20')]['fn']('COUNT',db[_0x22b5('0x20')]['fn']('IF',db[_0x22b5('0x20')][_0x22b5('0x24')](_0x22b5('0x28')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x22b5('0x20')]['fn'](_0x22b5('0x29'),db[_0x22b5('0x20')]['fn']('IF',db['sequelize'][_0x22b5('0x24')](_0x22b5('0x2a')))),_0x22b5('0x2b')],[db[_0x22b5('0x20')]['fn']('AVG',db[_0x22b5('0x20')]['fn']('IF',db[_0x22b5('0x20')][_0x22b5('0x24')](_0x22b5('0x2c')))),_0x22b5('0x2d')]]})[_0x22b5('0xb')](function(_0x507798){logger[_0x22b5('0xc')](_0x22b5('0x1d'),_0x3ccdbd);logger[_0x22b5('0xf')](_0x22b5('0x1d'),_0x3ccdbd,JSON[_0x22b5('0x1c')](_0x507798));_0x4d10fe(_0x507798);})['catch'](function(_0x16ba7b){logger['error'](_0x22b5('0x1d'),_0x16ba7b[_0x22b5('0x13')],_0x3ccdbd);_0x47d3c5(_0x280f93[_0x22b5('0x11')](0x1f4,_0x16ba7b[_0x22b5('0x13')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x59c00d){var _0x2aca3e=this;return new Promise(function(_0x2c905e,_0x3b8899){return db[_0x22b5('0x17')][_0x22b5('0x1e')]({'raw':_0x59c00d[_0x22b5('0x1a')]?_0x59c00d[_0x22b5('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x59c00d[_0x22b5('0x1a')]?_0x59c00d['options']['where']||null:null,'attributes':[['campaign','name'],[db[_0x22b5('0x20')]['fn'](_0x22b5('0x21'),db[_0x22b5('0x20')]['fn']('IF',db[_0x22b5('0x20')]['literal'](_0x22b5('0x2e')))),'outboundNoSuchCallsDay'],[db[_0x22b5('0x20')]['fn'](_0x22b5('0x21'),db[_0x22b5('0x20')]['fn']('IF',db[_0x22b5('0x20')][_0x22b5('0x24')](_0x22b5('0x2f')))),_0x22b5('0x30')],[db[_0x22b5('0x20')]['fn'](_0x22b5('0x21'),db[_0x22b5('0x20')]['fn']('IF',db[_0x22b5('0x20')][_0x22b5('0x24')](_0x22b5('0x25')))),_0x22b5('0x31')],[db[_0x22b5('0x20')]['fn'](_0x22b5('0x21'),db[_0x22b5('0x20')]['fn']('IF',db['sequelize'][_0x22b5('0x24')]('`state`\x20=\x205,\x201,\x20null'))),_0x22b5('0x32')],[db[_0x22b5('0x20')]['fn'](_0x22b5('0x21'),db['sequelize']['fn']('IF',db[_0x22b5('0x20')][_0x22b5('0x24')](_0x22b5('0x33')))),_0x22b5('0x34')],[db[_0x22b5('0x20')]['fn'](_0x22b5('0x21'),db[_0x22b5('0x20')]['fn']('IF',db[_0x22b5('0x20')][_0x22b5('0x24')](_0x22b5('0x35')))),_0x22b5('0x36')],[db['sequelize']['fn'](_0x22b5('0x21'),db[_0x22b5('0x20')]['fn']('IF',db[_0x22b5('0x20')][_0x22b5('0x24')](_0x22b5('0x37')))),'outboundDropCallsDayCallersExit'],[db[_0x22b5('0x20')]['fn']('COUNT',db[_0x22b5('0x20')]['fn']('IF',db['sequelize'][_0x22b5('0x24')](_0x22b5('0x38')))),'outboundUnknownCallsDay'],[db[_0x22b5('0x20')]['fn'](_0x22b5('0x21'),db[_0x22b5('0x20')]['fn']('IF',db[_0x22b5('0x20')][_0x22b5('0x24')](_0x22b5('0x39')))),_0x22b5('0x3a')],[db['sequelize']['fn'](_0x22b5('0x21'),db[_0x22b5('0x20')]['fn']('IF',db[_0x22b5('0x20')][_0x22b5('0x24')](_0x22b5('0x3b')))),'outboundOriginateFailureCallsDay'],[db[_0x22b5('0x20')]['fn'](_0x22b5('0x21'),db[_0x22b5('0x20')]['fn']('IF',db[_0x22b5('0x20')][_0x22b5('0x24')](_0x22b5('0x3c')))),_0x22b5('0x3d')],[db[_0x22b5('0x20')]['fn'](_0x22b5('0x21'),db[_0x22b5('0x20')]['fn']('IF',db['sequelize'][_0x22b5('0x24')](_0x22b5('0x3e')))),_0x22b5('0x3f')],[db[_0x22b5('0x20')]['fn'](_0x22b5('0x21'),db[_0x22b5('0x20')]['fn']('IF',db[_0x22b5('0x20')][_0x22b5('0x24')](_0x22b5('0x40')))),_0x22b5('0x3d')],[db[_0x22b5('0x20')]['fn']('COUNT',db[_0x22b5('0x20')]['fn']('IF',db[_0x22b5('0x20')][_0x22b5('0x24')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),'outboundReCallsDay']],'group':[_0x22b5('0x41')]})[_0x22b5('0xb')](function(_0x3e5548){logger[_0x22b5('0xc')]('GetVoiceQueueHopperHistory',_0x59c00d);logger[_0x22b5('0xf')]('GetVoiceQueueHopperHistory',_0x59c00d,JSON['stringify'](_0x3e5548));_0x2c905e(_0x3e5548);})[_0x22b5('0x15')](function(_0x4d4cff){logger[_0x22b5('0x11')](_0x22b5('0x42'),_0x4d4cff[_0x22b5('0x13')],_0x59c00d);_0x3b8899(_0x2aca3e[_0x22b5('0x11')](0x1f4,_0x4d4cff[_0x22b5('0x13')]));});});};exports['GetCampaignHopperHistory']=function(_0x144d4c){var _0x4aa074=this;return new Promise(function(_0xd191ae,_0x3cca57){return db['CmHopperHistory'][_0x22b5('0x1e')]({'raw':_0x144d4c['options']?_0x144d4c[_0x22b5('0x1a')][_0x22b5('0x1b')]===undefined?!![]:![]:!![],'where':_0x144d4c['options']?_0x144d4c[_0x22b5('0x1a')][_0x22b5('0x1f')]||null:null,'attributes':[[_0x22b5('0x41'),_0x22b5('0x43')],[db[_0x22b5('0x20')]['fn']('COUNT',db['sequelize'][_0x22b5('0x22')]('id')),'ivrTotalCallsDays'],[db['sequelize']['fn'](_0x22b5('0x21'),db[_0x22b5('0x20')]['fn']('IF',db[_0x22b5('0x20')][_0x22b5('0x24')](_0x22b5('0x25')))),_0x22b5('0x44')]],'group':['campaign']})[_0x22b5('0xb')](function(_0x3675c4){logger['info']('GetCampaignHopperHistory',_0x144d4c);logger[_0x22b5('0xf')](_0x22b5('0x45'),_0x144d4c,JSON['stringify'](_0x3675c4));_0xd191ae(_0x3675c4);})[_0x22b5('0x15')](function(_0x157dae){logger['error'](_0x22b5('0x45'),_0x157dae[_0x22b5('0x13')],_0x144d4c);_0x3cca57(_0x4aa074[_0x22b5('0x11')](0x1f4,_0x157dae['message']));});});}; \ No newline at end of file +var _0x1e91=['GetVoiceQueueHopperHistory','GetCampaignHopperHistory','col','ivrTotalCallsDays','ivrAnswerCallsDay','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','result','CmHopperHistory','create','body','options','raw','CreateCmHopperHistory','catch','AvgHandleTime','sequelize','COUNT','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','findAll','where','campaign','name','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','outboundReCallsDay'];(function(_0x51ac09,_0x383098){var _0x3f827d=function(_0x2d8d0f){while(--_0x2d8d0f){_0x51ac09['push'](_0x51ac09['shift']());}};_0x3f827d(++_0x383098);}(_0x1e91,0xe3));var _0x11e9=function(_0x1465dc,_0x4d684d){_0x1465dc=_0x1465dc-0x0;var _0x226206=_0x1e91[_0x1465dc];return _0x226206;};'use strict';var _=require('lodash');var util=require(_0x11e9('0x0'));var moment=require('moment');var BPromise=require(_0x11e9('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x11e9('0x2'));var db=require(_0x11e9('0x3'))['db'];var utils=require(_0x11e9('0x4'));var logger=require(_0x11e9('0x5'))('rpc');var config=require(_0x11e9('0x6'));var jayson=require(_0x11e9('0x7'));var client=jayson[_0x11e9('0x8')][_0x11e9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20954e,_0x32ced5,_0x56ef81){return new BPromise(function(_0x579026,_0xc95e3c){return client[_0x11e9('0xa')](_0x20954e,_0x56ef81)[_0x11e9('0xb')](function(_0x1a4fd8){logger[_0x11e9('0xc')]('CmHopperHistory,\x20%s,\x20%s',_0x32ced5,_0x11e9('0xd'));logger[_0x11e9('0xe')](_0x11e9('0xf'),_0x32ced5,_0x11e9('0xd'),JSON[_0x11e9('0x10')](_0x1a4fd8));if(_0x1a4fd8[_0x11e9('0x11')]){if(_0x1a4fd8[_0x11e9('0x11')][_0x11e9('0x12')]===0x1f4){logger[_0x11e9('0x11')](_0x11e9('0x13'),_0x32ced5,_0x1a4fd8['error'][_0x11e9('0x14')]);return _0xc95e3c(_0x1a4fd8[_0x11e9('0x11')][_0x11e9('0x14')]);}logger[_0x11e9('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x32ced5,_0x1a4fd8[_0x11e9('0x11')]['message']);return _0x579026(_0x1a4fd8['error'][_0x11e9('0x14')]);}else{logger[_0x11e9('0xc')](_0x11e9('0x13'),_0x32ced5,_0x11e9('0xd'));_0x579026(_0x1a4fd8[_0x11e9('0x15')][_0x11e9('0x14')]);}})['catch'](function(_0x952f3f){logger[_0x11e9('0x11')](_0x11e9('0x13'),_0x32ced5,_0x952f3f);_0xc95e3c(_0x952f3f);});});}exports['CreateCmHopperHistory']=function(_0x1acf45){var _0x4f3ee0=this;return new Promise(function(_0x2c1893,_0x16248b){return db[_0x11e9('0x16')][_0x11e9('0x17')](_0x1acf45[_0x11e9('0x18')],{'raw':_0x1acf45['options']?_0x1acf45[_0x11e9('0x19')][_0x11e9('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x39ba7a){logger[_0x11e9('0xc')](_0x11e9('0x1b'),_0x1acf45);logger[_0x11e9('0xe')](_0x11e9('0x1b'),_0x1acf45,JSON[_0x11e9('0x10')](_0x39ba7a));_0x2c1893(_0x39ba7a);})[_0x11e9('0x1c')](function(_0x2db755){logger[_0x11e9('0x11')](_0x11e9('0x1b'),_0x2db755['message'],_0x1acf45);_0x16248b(_0x4f3ee0[_0x11e9('0x11')](0x1f4,_0x2db755[_0x11e9('0x14')]));});});};exports[_0x11e9('0x1d')]=function(_0x108e5d){var _0x49a872=this;return new Promise(function(_0x34e656,_0x58f2b6){return db[_0x11e9('0x16')]['findAll']({'raw':_0x108e5d[_0x11e9('0x19')]?_0x108e5d[_0x11e9('0x19')][_0x11e9('0x1a')]===undefined?!![]:![]:!![],'where':_0x108e5d['options']?_0x108e5d[_0x11e9('0x19')]['where']||null:null,'attributes':[[db[_0x11e9('0x1e')]['fn'](_0x11e9('0x1f'),db[_0x11e9('0x1e')]['col']('id')),_0x11e9('0x20')],[db['sequelize']['fn'](_0x11e9('0x1f'),db[_0x11e9('0x1e')]['fn']('IF',db[_0x11e9('0x1e')][_0x11e9('0x21')](_0x11e9('0x22')))),_0x11e9('0x23')],[db[_0x11e9('0x1e')]['fn'](_0x11e9('0x1f'),db['sequelize']['fn']('IF',db[_0x11e9('0x1e')]['literal'](_0x11e9('0x24')))),_0x11e9('0x25')],[db[_0x11e9('0x1e')]['fn']('COUNT',db[_0x11e9('0x1e')]['fn']('IF',db[_0x11e9('0x1e')][_0x11e9('0x21')](_0x11e9('0x26')))),_0x11e9('0x27')],[db['sequelize']['fn']('AVG',db[_0x11e9('0x1e')]['fn']('IF',db['sequelize']['literal'](_0x11e9('0x28')))),_0x11e9('0x29')],[db[_0x11e9('0x1e')]['fn']('AVG',db[_0x11e9('0x1e')]['fn']('IF',db[_0x11e9('0x1e')][_0x11e9('0x21')](_0x11e9('0x2a')))),_0x11e9('0x2b')]]})[_0x11e9('0xb')](function(_0x2f2cf6){logger['info'](_0x11e9('0x1d'),_0x108e5d);logger['debug'](_0x11e9('0x1d'),_0x108e5d,JSON[_0x11e9('0x10')](_0x2f2cf6));_0x34e656(_0x2f2cf6);})['catch'](function(_0x5de66a){logger[_0x11e9('0x11')](_0x11e9('0x1d'),_0x5de66a[_0x11e9('0x14')],_0x108e5d);_0x58f2b6(_0x49a872[_0x11e9('0x11')](0x1f4,_0x5de66a[_0x11e9('0x14')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x498d38){var _0x4641a4=this;return new Promise(function(_0x59cb68,_0xf51aee){return db[_0x11e9('0x16')][_0x11e9('0x2c')]({'raw':_0x498d38['options']?_0x498d38[_0x11e9('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x498d38[_0x11e9('0x19')]?_0x498d38['options'][_0x11e9('0x2d')]||null:null,'attributes':[[_0x11e9('0x2e'),_0x11e9('0x2f')],[db[_0x11e9('0x1e')]['fn'](_0x11e9('0x1f'),db[_0x11e9('0x1e')]['fn']('IF',db[_0x11e9('0x1e')][_0x11e9('0x21')]('`state`\x20=\x200,\x201,\x20null'))),_0x11e9('0x30')],[db[_0x11e9('0x1e')]['fn'](_0x11e9('0x1f'),db['sequelize']['fn']('IF',db[_0x11e9('0x1e')]['literal'](_0x11e9('0x31')))),_0x11e9('0x32')],[db[_0x11e9('0x1e')]['fn'](_0x11e9('0x1f'),db[_0x11e9('0x1e')]['fn']('IF',db[_0x11e9('0x1e')][_0x11e9('0x21')](_0x11e9('0x22')))),_0x11e9('0x33')],[db['sequelize']['fn']('COUNT',db[_0x11e9('0x1e')]['fn']('IF',db[_0x11e9('0x1e')][_0x11e9('0x21')](_0x11e9('0x34')))),_0x11e9('0x35')],[db[_0x11e9('0x1e')]['fn'](_0x11e9('0x1f'),db[_0x11e9('0x1e')]['fn']('IF',db['sequelize'][_0x11e9('0x21')](_0x11e9('0x36')))),'outboundCongestionCallsDay'],[db[_0x11e9('0x1e')]['fn'](_0x11e9('0x1f'),db[_0x11e9('0x1e')]['fn']('IF',db[_0x11e9('0x1e')][_0x11e9('0x21')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x11e9('0x37')],[db[_0x11e9('0x1e')]['fn']('COUNT',db[_0x11e9('0x1e')]['fn']('IF',db[_0x11e9('0x1e')][_0x11e9('0x21')](_0x11e9('0x38')))),_0x11e9('0x39')],[db[_0x11e9('0x1e')]['fn'](_0x11e9('0x1f'),db[_0x11e9('0x1e')]['fn']('IF',db[_0x11e9('0x1e')][_0x11e9('0x21')](_0x11e9('0x3a')))),_0x11e9('0x3b')],[db['sequelize']['fn'](_0x11e9('0x1f'),db['sequelize']['fn']('IF',db[_0x11e9('0x1e')][_0x11e9('0x21')](_0x11e9('0x3c')))),_0x11e9('0x3d')],[db['sequelize']['fn']('COUNT',db[_0x11e9('0x1e')]['fn']('IF',db['sequelize'][_0x11e9('0x21')](_0x11e9('0x3e')))),_0x11e9('0x3f')],[db[_0x11e9('0x1e')]['fn'](_0x11e9('0x1f'),db['sequelize']['fn']('IF',db[_0x11e9('0x1e')]['literal'](_0x11e9('0x40')))),_0x11e9('0x41')],[db[_0x11e9('0x1e')]['fn'](_0x11e9('0x1f'),db['sequelize']['fn']('IF',db[_0x11e9('0x1e')][_0x11e9('0x21')](_0x11e9('0x42')))),_0x11e9('0x43')],[db[_0x11e9('0x1e')]['fn'](_0x11e9('0x1f'),db[_0x11e9('0x1e')]['fn']('IF',db[_0x11e9('0x1e')]['literal']('`state`\x20=\x2020,\x201,\x20null'))),'outboundRejectCallsDay'],[db['sequelize']['fn'](_0x11e9('0x1f'),db[_0x11e9('0x1e')]['fn']('IF',db[_0x11e9('0x1e')][_0x11e9('0x21')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x11e9('0x44')]],'group':[_0x11e9('0x2e')]})[_0x11e9('0xb')](function(_0x52cf0a){logger[_0x11e9('0xc')](_0x11e9('0x45'),_0x498d38);logger[_0x11e9('0xe')](_0x11e9('0x45'),_0x498d38,JSON[_0x11e9('0x10')](_0x52cf0a));_0x59cb68(_0x52cf0a);})[_0x11e9('0x1c')](function(_0x14cfd7){logger[_0x11e9('0x11')](_0x11e9('0x45'),_0x14cfd7['message'],_0x498d38);_0xf51aee(_0x4641a4[_0x11e9('0x11')](0x1f4,_0x14cfd7['message']));});});};exports[_0x11e9('0x46')]=function(_0x12dbd1){var _0x32cfdd=this;return new Promise(function(_0x51efea,_0x5ae83b){return db[_0x11e9('0x16')][_0x11e9('0x2c')]({'raw':_0x12dbd1[_0x11e9('0x19')]?_0x12dbd1[_0x11e9('0x19')][_0x11e9('0x1a')]===undefined?!![]:![]:!![],'where':_0x12dbd1[_0x11e9('0x19')]?_0x12dbd1[_0x11e9('0x19')][_0x11e9('0x2d')]||null:null,'attributes':[[_0x11e9('0x2e'),_0x11e9('0x2f')],[db[_0x11e9('0x1e')]['fn']('COUNT',db['sequelize'][_0x11e9('0x47')]('id')),_0x11e9('0x48')],[db[_0x11e9('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x11e9('0x1e')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x11e9('0x49')]],'group':[_0x11e9('0x2e')]})[_0x11e9('0xb')](function(_0x124bc5){logger[_0x11e9('0xc')](_0x11e9('0x46'),_0x12dbd1);logger[_0x11e9('0xe')](_0x11e9('0x46'),_0x12dbd1,JSON[_0x11e9('0x10')](_0x124bc5));_0x51efea(_0x124bc5);})[_0x11e9('0x1c')](function(_0x2e6957){logger[_0x11e9('0x11')](_0x11e9('0x46'),_0x2e6957[_0x11e9('0x14')],_0x12dbd1);_0x5ae83b(_0x32cfdd[_0x11e9('0x11')](0x1f4,_0x2e6957[_0x11e9('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index fac86b7..286e677 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 _0xe2e5=['isAuthenticated','index','/describe','describe','/:id','show','post','create','update','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get'];(function(_0x5ab04b,_0x1642f8){var _0x8c04a4=function(_0x58aed5){while(--_0x58aed5){_0x5ab04b['push'](_0x5ab04b['shift']());}};_0x8c04a4(++_0x1642f8);}(_0xe2e5,0x186));var _0x5e2e=function(_0x412572,_0x11e943){_0x412572=_0x412572-0x0;var _0x18691f=_0xe2e5[_0x412572];return _0x18691f;};'use strict';var multer=require(_0x5e2e('0x0'));var util=require(_0x5e2e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5e2e('0x2'));var router=express[_0x5e2e('0x3')]();var fs_extra=require(_0x5e2e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5e2e('0x5'));var config=require(_0x5e2e('0x6'));var controller=require(_0x5e2e('0x7'));router[_0x5e2e('0x8')]('/',auth[_0x5e2e('0x9')](),controller[_0x5e2e('0xa')]);router[_0x5e2e('0x8')](_0x5e2e('0xb'),auth[_0x5e2e('0x9')](),controller[_0x5e2e('0xc')]);router['get'](_0x5e2e('0xd'),auth[_0x5e2e('0x9')](),controller[_0x5e2e('0xe')]);router[_0x5e2e('0xf')]('/',auth[_0x5e2e('0x9')](),controller[_0x5e2e('0x10')]);router['put'](_0x5e2e('0xd'),auth['isAuthenticated'](),controller[_0x5e2e('0x11')]);module[_0x5e2e('0x12')]=router; \ No newline at end of file +var _0x26d9=['index','/describe','describe','/:id','post','create','put','update','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x26d9,0x105));var _0x926d=function(_0x5ea9d6,_0x44b8e7){_0x5ea9d6=_0x5ea9d6-0x0;var _0x57f011=_0x26d9[_0x5ea9d6];return _0x57f011;};'use strict';var multer=require('multer');var util=require(_0x926d('0x0'));var path=require(_0x926d('0x1'));var timeout=require('connect-timeout');var express=require(_0x926d('0x2'));var router=express['Router']();var fs_extra=require(_0x926d('0x3'));var auth=require(_0x926d('0x4'));var interaction=require(_0x926d('0x5'));var config=require(_0x926d('0x6'));var controller=require('./cmHopperHistory.controller');router[_0x926d('0x7')]('/',auth[_0x926d('0x8')](),controller[_0x926d('0x9')]);router[_0x926d('0x7')](_0x926d('0xa'),auth[_0x926d('0x8')](),controller[_0x926d('0xb')]);router[_0x926d('0x7')](_0x926d('0xc'),auth[_0x926d('0x8')](),controller['show']);router[_0x926d('0xd')]('/',auth[_0x926d('0x8')](),controller[_0x926d('0xe')]);router[_0x926d('0xf')](_0x926d('0xc'),auth[_0x926d('0x8')](),controller[_0x926d('0x10')]);module[_0x926d('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index cfc7e86..9bb013b 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 _0x5900=['exports','STRING'];(function(_0x1ef213,_0x54de15){var _0x38f93d=function(_0x4642b6){while(--_0x4642b6){_0x1ef213['push'](_0x1ef213['shift']());}};_0x38f93d(++_0x54de15);}(_0x5900,0xd2));var _0x0590=function(_0x12885b,_0x4ce691){_0x12885b=_0x12885b-0x0;var _0x52625a=_0x5900[_0x12885b];return _0x52625a;};'use strict';var Sequelize=require('sequelize');module[_0x0590('0x0')]={'name':{'type':Sequelize[_0x0590('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0590('0x1')]},'dialPrefix':{'type':Sequelize[_0x0590('0x1')]}}; \ No newline at end of file +var _0xc92f=['exports','name','STRING','sequelize'];(function(_0xf3d240,_0x58ee00){var _0x4fc747=function(_0x4e3812){while(--_0x4e3812){_0xf3d240['push'](_0xf3d240['shift']());}};_0x4fc747(++_0x58ee00);}(_0xc92f,0xf3));var _0xfc92=function(_0x1f921b,_0x3e0c1f){_0x1f921b=_0x1f921b-0x0;var _0x1265b9=_0xc92f[_0x1f921b];return _0x1265b9;};'use strict';var Sequelize=require(_0xfc92('0x0'));module[_0xfc92('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xfc92('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xfc92('0x3')]},'dialPrefix':{'type':Sequelize[_0xfc92('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 46d3d53..39cb661 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 _0xb0c5=['limit','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','sendStatus','stack','name','send','index','map','CmList','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','catch','show','params','keys','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Lists','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','addDisposition','ListId','findOne','Disposition','options','rows','removeDispositions','ids','describe','isArray','tags','join','push','each','CmContact','omit','dataValues','message','getContacts','CustomFields','format','hasOwnProperty','getContactsCsv','concat','cf_%d','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','attachment;\x20filename=','list_%d_%s.csv','setHeader','Content-type','download','addCustomField','transaction','addCustomFields','Sequelize','TEXT','number','INTEGER','switch','defaultValue','sequelize','queryInterface','addColumn','cm_contacts','getCustomFields','CmCustomField','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','status','end','json','undefined','count','offset'];(function(_0x419571,_0x5ad855){var _0x28be78=function(_0x4e2f0c){while(--_0x4e2f0c){_0x419571['push'](_0x419571['shift']());}};_0x28be78(++_0x5ad855);}(_0xb0c5,0xfa));var _0x5b0c=function(_0x3e3735,_0xaad8ef){_0x3e3735=_0x3e3735-0x0;var _0x1bf323=_0xb0c5[_0x3e3735];return _0x1bf323;};'use strict';var emlformat=require(_0x5b0c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5b0c('0x1'));var moment=require(_0x5b0c('0x2'));var BPromise=require(_0x5b0c('0x3'));var Mustache=require(_0x5b0c('0x4'));var util=require(_0x5b0c('0x5'));var path=require(_0x5b0c('0x6'));var sox=require(_0x5b0c('0x7'));var csv=require(_0x5b0c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5b0c('0x9'));var crypto=require(_0x5b0c('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x5b0c('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5b0c('0xc'));var Papa=require(_0x5b0c('0xd'));var Redis=require('ioredis');var authService=require(_0x5b0c('0xe'));var qs=require(_0x5b0c('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5b0c('0x10'))(_0x5b0c('0x11'));var utils=require(_0x5b0c('0x12'));var config=require(_0x5b0c('0x13'));var licenseUtil=require(_0x5b0c('0x14'));var db=require(_0x5b0c('0x15'))['db'];config[_0x5b0c('0x16')]=_[_0x5b0c('0x17')](config[_0x5b0c('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x5b0c('0x18'))(new Redis(config['redis']));require('./cmList.socket')[_0x5b0c('0x19')](socket);function respondWithStatusCode(_0x4d3ed3,_0x1a68da){_0x1a68da=_0x1a68da||0xcc;return function(_0x49f0a8){if(_0x49f0a8){return _0x4d3ed3['sendStatus'](_0x1a68da);}return _0x4d3ed3[_0x5b0c('0x1a')](_0x1a68da)[_0x5b0c('0x1b')]();};}function respondWithResult(_0x328d32,_0x8c181e){_0x8c181e=_0x8c181e||0xc8;return function(_0x10db54){if(_0x10db54){return _0x328d32[_0x5b0c('0x1a')](_0x8c181e)[_0x5b0c('0x1c')](_0x10db54);}};}function respondWithFilteredResult(_0x5148ec,_0x46cbc0){return function(_0x324531){if(_0x324531){var _0x150452=typeof _0x46cbc0['offset']===_0x5b0c('0x1d')&&typeof _0x46cbc0['limit']===_0x5b0c('0x1d');var _0x4ce01c=_0x324531[_0x5b0c('0x1e')];var _0x5b02ac=_0x150452?0x0:_0x46cbc0[_0x5b0c('0x1f')];var _0x7094b7=_0x150452?_0x324531['count']:_0x46cbc0['offset']+_0x46cbc0[_0x5b0c('0x20')];var _0x181fe0;if(_0x7094b7>=_0x4ce01c){_0x7094b7=_0x4ce01c;_0x181fe0=0xc8;}else{_0x181fe0=0xce;}_0x5148ec[_0x5b0c('0x1a')](_0x181fe0);return _0x5148ec[_0x5b0c('0x21')](_0x5b0c('0x22'),_0x5b02ac+'-'+_0x7094b7+'/'+_0x4ce01c)[_0x5b0c('0x1c')](_0x324531);}return null;};}function patchUpdates(_0x5561a7){return function(_0x1000f2){try{jsonpatch[_0x5b0c('0x23')](_0x1000f2,_0x5561a7,!![]);}catch(_0x3be0ea){return BPromise[_0x5b0c('0x24')](_0x3be0ea);}return _0x1000f2[_0x5b0c('0x25')]();};}function saveUpdates(_0x163250,_0x63d161){return function(_0xbbc5bc){if(_0xbbc5bc){return _0xbbc5bc[_0x5b0c('0x26')](_0x163250)[_0x5b0c('0x27')](function(_0x3449a8){return _0x3449a8;});}return null;};}function removeEntity(_0x553894,_0x7c5809){return function(_0xcb101f){if(_0xcb101f){return _0xcb101f['destroy']()[_0x5b0c('0x27')](function(){var _0xc659e6=_0xcb101f[_0x5b0c('0x28')]({'plain':!![]});var _0x454614='Lists';return db[_0x5b0c('0x29')]['destroy']({'where':{'type':_0x454614,'resourceId':_0xc659e6['id']}})[_0x5b0c('0x27')](function(){return _0xcb101f;});})[_0x5b0c('0x27')](function(){_0x553894[_0x5b0c('0x1a')](0xcc)[_0x5b0c('0x1b')]();});}};}function handleEntityNotFound(_0xdc2d94,_0x40a8d2){return function(_0x1f7475){if(!_0x1f7475){_0xdc2d94[_0x5b0c('0x2a')](0x194);}return _0x1f7475;};}function handleError(_0x593a19,_0x23df3f){_0x23df3f=_0x23df3f||0x1f4;return function(_0x27dd74){logger['error'](_0x27dd74[_0x5b0c('0x2b')]);if(_0x27dd74[_0x5b0c('0x2c')]){delete _0x27dd74['name'];}_0x593a19['status'](_0x23df3f)[_0x5b0c('0x2d')](_0x27dd74);};}exports[_0x5b0c('0x2e')]=function(_0x2278f2,_0x3c67f1){var _0x418757={},_0xc45ad4={},_0xe50f9c={'count':0x0,'rows':[]};var _0x554680=_[_0x5b0c('0x2f')](db[_0x5b0c('0x30')][_0x5b0c('0x31')],function(_0x403e23){return{'name':_0x403e23['fieldName'],'type':_0x403e23['type'][_0x5b0c('0x32')]};});_0xc45ad4[_0x5b0c('0x33')]=_[_0x5b0c('0x2f')](_0x554680,'name');_0xc45ad4[_0x5b0c('0x34')]=_['keys'](_0x2278f2[_0x5b0c('0x34')]);_0xc45ad4[_0x5b0c('0x35')]=_[_0x5b0c('0x36')](_0xc45ad4[_0x5b0c('0x33')],_0xc45ad4['query']);_0x418757[_0x5b0c('0x37')]=_[_0x5b0c('0x36')](_0xc45ad4[_0x5b0c('0x33')],qs[_0x5b0c('0x38')](_0x2278f2[_0x5b0c('0x34')]['fields']));_0x418757[_0x5b0c('0x37')]=_0x418757[_0x5b0c('0x37')][_0x5b0c('0x39')]?_0x418757['attributes']:_0xc45ad4[_0x5b0c('0x33')];if(!_0x2278f2[_0x5b0c('0x34')]['hasOwnProperty'](_0x5b0c('0x3a'))){_0x418757[_0x5b0c('0x20')]=qs[_0x5b0c('0x20')](_0x2278f2[_0x5b0c('0x34')][_0x5b0c('0x20')]);_0x418757['offset']=qs[_0x5b0c('0x1f')](_0x2278f2[_0x5b0c('0x34')][_0x5b0c('0x1f')]);}_0x418757[_0x5b0c('0x3b')]=qs[_0x5b0c('0x3c')](_0x2278f2[_0x5b0c('0x34')][_0x5b0c('0x3c')]);_0x418757[_0x5b0c('0x3d')]=qs[_0x5b0c('0x35')](_[_0x5b0c('0x3e')](_0x2278f2[_0x5b0c('0x34')],_0xc45ad4[_0x5b0c('0x35')]),_0x554680);if(_0x2278f2[_0x5b0c('0x34')][_0x5b0c('0x3f')]){_0x418757[_0x5b0c('0x3d')]=_[_0x5b0c('0x40')](_0x418757[_0x5b0c('0x3d')],{'$or':_[_0x5b0c('0x2f')](_0x554680,function(_0x47d63a){if(_0x47d63a[_0x5b0c('0x41')]!==_0x5b0c('0x42')){var _0x14619a={};_0x14619a[_0x47d63a[_0x5b0c('0x2c')]]={'$like':'%'+_0x2278f2[_0x5b0c('0x34')]['filter']+'%'};return _0x14619a;}})});}_0x418757=_[_0x5b0c('0x40')]({},_0x418757,_0x2278f2['options']);var _0x4092ad={'where':_0x418757[_0x5b0c('0x3d')]};return db[_0x5b0c('0x30')][_0x5b0c('0x1e')](_0x4092ad)['then'](function(_0x38fb73){_0xe50f9c['count']=_0x38fb73;if(_0x2278f2[_0x5b0c('0x34')][_0x5b0c('0x43')]){_0x418757[_0x5b0c('0x44')]=[{'all':!![]}];}return db['CmList']['findAll'](_0x418757);})['then'](function(_0x2025b1){_0xe50f9c['rows']=_0x2025b1;return _0xe50f9c;})['then'](respondWithFilteredResult(_0x3c67f1,_0x418757))[_0x5b0c('0x45')](handleError(_0x3c67f1,null));};exports[_0x5b0c('0x46')]=function(_0x35c15e,_0x50b544){var _0x105bc7={'raw':![],'where':{'id':_0x35c15e[_0x5b0c('0x47')]['id']}},_0x1b6e46={};_0x1b6e46[_0x5b0c('0x33')]=_[_0x5b0c('0x48')](db[_0x5b0c('0x30')][_0x5b0c('0x31')]);_0x1b6e46[_0x5b0c('0x34')]=_['keys'](_0x35c15e['query']);_0x1b6e46[_0x5b0c('0x35')]=_['intersection'](_0x1b6e46['model'],_0x1b6e46['query']);_0x105bc7[_0x5b0c('0x37')]=_[_0x5b0c('0x36')](_0x1b6e46[_0x5b0c('0x33')],qs[_0x5b0c('0x38')](_0x35c15e[_0x5b0c('0x34')][_0x5b0c('0x38')]));_0x105bc7[_0x5b0c('0x37')]=_0x105bc7[_0x5b0c('0x37')][_0x5b0c('0x39')]?_0x105bc7[_0x5b0c('0x37')]:_0x1b6e46[_0x5b0c('0x33')];if(_0x35c15e[_0x5b0c('0x34')][_0x5b0c('0x43')]){_0x105bc7['include']=[{'all':!![]}];}_0x105bc7=_[_0x5b0c('0x40')]({},_0x105bc7,_0x35c15e['options']);return db[_0x5b0c('0x30')][_0x5b0c('0x49')](_0x105bc7)[_0x5b0c('0x27')](handleEntityNotFound(_0x50b544,null))[_0x5b0c('0x27')](respondWithResult(_0x50b544,null))[_0x5b0c('0x45')](handleError(_0x50b544,null));};exports[_0x5b0c('0x4a')]=function(_0x14bf1e,_0x4cc965){return db[_0x5b0c('0x30')]['create'](_0x14bf1e['body'],{})[_0x5b0c('0x27')](function(_0x320703){var _0x185f18=_0x14bf1e['user'][_0x5b0c('0x28')]({'plain':!![]});if(!_0x185f18)throw new Error(_0x5b0c('0x4b'));if(_0x185f18[_0x5b0c('0x4c')]===_0x5b0c('0x4d')){var _0x2419ec=_0x320703['get']({'plain':!![]});var _0x4a785e=_0x5b0c('0x4e');return db[_0x5b0c('0x4f')]['find']({'where':{'name':_0x4a785e,'userProfileId':_0x185f18[_0x5b0c('0x50')]},'raw':!![]})['then'](function(_0x568868){if(_0x568868&&_0x568868['autoAssociation']===0x0){return db[_0x5b0c('0x29')][_0x5b0c('0x4a')]({'name':_0x2419ec[_0x5b0c('0x2c')],'resourceId':_0x2419ec['id'],'type':_0x568868[_0x5b0c('0x2c')],'sectionId':_0x568868['id']},{})['then'](function(){return _0x320703;});}else{return _0x320703;}})['catch'](function(_0x15e4a0){logger['error'](_0x5b0c('0x51'),_0x15e4a0);throw _0x15e4a0;});}return _0x320703;})[_0x5b0c('0x27')](respondWithResult(_0x4cc965,0xc9))[_0x5b0c('0x45')](handleError(_0x4cc965,null));};exports[_0x5b0c('0x26')]=function(_0x2c9ed5,_0x4efa13){if(_0x2c9ed5['body']['id']){delete _0x2c9ed5[_0x5b0c('0x52')]['id'];}return db[_0x5b0c('0x30')]['find']({'where':{'id':_0x2c9ed5['params']['id']}})[_0x5b0c('0x27')](handleEntityNotFound(_0x4efa13,null))[_0x5b0c('0x27')](saveUpdates(_0x2c9ed5['body'],null))[_0x5b0c('0x27')](respondWithResult(_0x4efa13,null))[_0x5b0c('0x45')](handleError(_0x4efa13,null));};exports[_0x5b0c('0x53')]=function(_0x199a25,_0x536766){return db[_0x5b0c('0x30')]['find']({'where':{'id':_0x199a25[_0x5b0c('0x47')]['id']}})['then'](handleEntityNotFound(_0x536766,null))[_0x5b0c('0x27')](removeEntity(_0x536766,null))[_0x5b0c('0x45')](handleError(_0x536766,null));};exports['describe']=function(_0x1bc4ff,_0x1c7a2d){return db[_0x5b0c('0x30')]['describe']()['then'](respondWithResult(_0x1c7a2d,null))['catch'](handleError(_0x1c7a2d,null));};exports[_0x5b0c('0x54')]=function(_0x572175,_0x301df4,_0x3899f7){if(_0x572175[_0x5b0c('0x52')]['id']){delete _0x572175[_0x5b0c('0x52')]['id'];}return db[_0x5b0c('0x30')][_0x5b0c('0x49')]({'where':{'id':_0x572175[_0x5b0c('0x47')]['id']}})[_0x5b0c('0x27')](handleEntityNotFound(_0x301df4,null))[_0x5b0c('0x27')](function(_0x1969e3){if(_0x1969e3){_0x572175[_0x5b0c('0x52')][_0x5b0c('0x55')]=_0x1969e3['id'];return db['Disposition'][_0x5b0c('0x4a')](_0x572175[_0x5b0c('0x52')]);}})[_0x5b0c('0x27')](respondWithResult(_0x301df4,null))[_0x5b0c('0x45')](handleError(_0x301df4,null));};exports['getDispositions']=function(_0x3111ae,_0x48f59f,_0x4d8dc1){var _0x30df2d={'raw':![],'where':{}};var _0x1b55c5={};var _0x2e17b8={'count':0x0,'rows':[]};return db['CmList'][_0x5b0c('0x56')]({'where':{'id':_0x3111ae['params']['id']}})[_0x5b0c('0x27')](handleEntityNotFound(_0x48f59f,null))['then'](function(_0x86556f){if(_0x86556f){_0x1b55c5[_0x5b0c('0x33')]=_[_0x5b0c('0x48')](db[_0x5b0c('0x57')][_0x5b0c('0x31')]);_0x1b55c5[_0x5b0c('0x34')]=_[_0x5b0c('0x48')](_0x3111ae['query']);_0x1b55c5[_0x5b0c('0x35')]=_[_0x5b0c('0x36')](_0x1b55c5[_0x5b0c('0x33')],_0x1b55c5[_0x5b0c('0x34')]);_0x30df2d['attributes']=_['intersection'](_0x1b55c5['model'],qs[_0x5b0c('0x38')](_0x3111ae[_0x5b0c('0x34')][_0x5b0c('0x38')]));_0x30df2d['attributes']=_0x30df2d[_0x5b0c('0x37')][_0x5b0c('0x39')]?_0x30df2d['attributes']:_0x1b55c5['model'];if(!_0x3111ae['query']['hasOwnProperty']('nolimit')){_0x30df2d[_0x5b0c('0x20')]=qs['limit'](_0x3111ae[_0x5b0c('0x34')][_0x5b0c('0x20')]);_0x30df2d[_0x5b0c('0x1f')]=qs['offset'](_0x3111ae[_0x5b0c('0x34')]['offset']);}_0x30df2d[_0x5b0c('0x3b')]=qs[_0x5b0c('0x3c')](_0x3111ae[_0x5b0c('0x34')][_0x5b0c('0x3c')]);_0x30df2d[_0x5b0c('0x3d')]=qs['filters'](_[_0x5b0c('0x3e')](_0x3111ae[_0x5b0c('0x34')],_0x1b55c5['filters']));_0x30df2d[_0x5b0c('0x3d')][_0x5b0c('0x55')]=_0x86556f['id'];if(_0x3111ae[_0x5b0c('0x34')]['filter']){_0x30df2d[_0x5b0c('0x3d')]=_[_0x5b0c('0x40')](_0x30df2d['where'],{'$or':_[_0x5b0c('0x2f')](_0x30df2d[_0x5b0c('0x37')],function(_0x51420d){var _0x1301ce={};_0x1301ce[_0x51420d]={'$like':'%'+_0x3111ae[_0x5b0c('0x34')][_0x5b0c('0x3f')]+'%'};return _0x1301ce;})});}_0x30df2d=_['merge']({},_0x30df2d,_0x3111ae[_0x5b0c('0x58')]);return db[_0x5b0c('0x57')][_0x5b0c('0x1e')]({'where':_0x30df2d['where']})[_0x5b0c('0x27')](function(_0xf154c7){_0x2e17b8[_0x5b0c('0x1e')]=_0xf154c7;if(_0x3111ae['query']['includeAll']){_0x30df2d[_0x5b0c('0x44')]=[{'all':!![]}];}return db[_0x5b0c('0x57')]['findAll'](_0x30df2d);})[_0x5b0c('0x27')](function(_0x4929cd){_0x2e17b8[_0x5b0c('0x59')]=_0x4929cd;return _0x2e17b8;});}})['then'](respondWithFilteredResult(_0x48f59f,_0x30df2d))[_0x5b0c('0x45')](handleError(_0x48f59f,null));};exports[_0x5b0c('0x5a')]=function(_0x25f48a,_0x72d7dd,_0x20e6a8){return db[_0x5b0c('0x30')]['find']({'where':{'id':_0x25f48a[_0x5b0c('0x47')]['id']}})[_0x5b0c('0x27')](handleEntityNotFound(_0x72d7dd,null))['then'](function(_0x31f501){if(_0x31f501){return _0x31f501[_0x5b0c('0x5a')](_0x25f48a[_0x5b0c('0x34')][_0x5b0c('0x5b')]);}})[_0x5b0c('0x27')](respondWithStatusCode(_0x72d7dd,null))['catch'](handleError(_0x72d7dd,null));};exports['addContacts']=function(_0x5b8200,_0x2167b4,_0x1915b8){return db[_0x5b0c('0x30')][_0x5b0c('0x49')]({'where':{'id':_0x5b8200[_0x5b0c('0x47')]['id']}})['then'](handleEntityNotFound(_0x2167b4,null))[_0x5b0c('0x27')](function(_0x3e49c5){if(_0x3e49c5){var _0x2ee5d0=[];var _0x240481={'success':[],'errors':[]};return db['CmContact'][_0x5b0c('0x5c')]()[_0x5b0c('0x27')](function(_0x2c8661){if(_0x5b8200[_0x5b0c('0x52')]['tags']&&_[_0x5b0c('0x5d')](_0x5b8200[_0x5b0c('0x52')][_0x5b0c('0x5e')])){if(_0x5b8200[_0x5b0c('0x52')][_0x5b0c('0x5e')]['length']){_0x5b8200[_0x5b0c('0x52')][_0x5b0c('0x5e')]=_0x5b8200[_0x5b0c('0x52')]['tags'][_0x5b0c('0x5f')](';')+';';}else{_0x5b8200[_0x5b0c('0x52')][_0x5b0c('0x5e')]=null;}}else{_0x5b8200['body']['tags']=null;}if(_0x5b8200[_0x5b0c('0x52')]&&_['isArray'](_0x5b8200[_0x5b0c('0x52')])){for(var _0x4613dc=0x0;_0x4613dc<_0x5b8200[_0x5b0c('0x52')][_0x5b0c('0x39')];_0x4613dc+=0x1){_0x5b8200[_0x5b0c('0x52')][_0x4613dc]['ListId']=_0x5b8200[_0x5b0c('0x47')]['id'];_0x2ee5d0[_0x5b0c('0x60')](_0x5b8200[_0x5b0c('0x52')][_0x4613dc]);}return BPromise[_0x5b0c('0x61')](_0x2ee5d0,function(_0x2cb660){return db[_0x5b0c('0x62')][_0x5b0c('0x4a')](_[_0x5b0c('0x63')](_0x2cb660,[_0x5b0c('0x5b'),'id'])||{},{'fields':_[_0x5b0c('0x48')](_0x2c8661),'raw':!![]})['then'](function(_0x5b0fa5){_0x240481['success'][_0x5b0c('0x60')](_0x5b0fa5[_0x5b0c('0x64')]);})[_0x5b0c('0x45')](function(_0x8f101){_0x240481['errors'][_0x5b0c('0x60')]({'data':_0x2cb660,'error':_0x8f101[_0x5b0c('0x65')]});});})['then'](function(_0x53b85a){return _0x240481;})[_0x5b0c('0x45')](function(_0x495dda){return _0x495dda;});}else{_0x2167b4[_0x5b0c('0x1a')](0x190)[_0x5b0c('0x1c')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0x5b0c('0x27')](respondWithResult(_0x2167b4,null))[_0x5b0c('0x45')](handleError(_0x2167b4,null));};exports[_0x5b0c('0x66')]=function(_0x46beda,_0x1b1489,_0x493245){var _0x22b135;return db[_0x5b0c('0x30')][_0x5b0c('0x49')]({'where':{'id':_0x46beda['params']['id']},'include':[{'model':db['CmCustomField'],'as':_0x5b0c('0x67')}]})[_0x5b0c('0x27')](handleEntityNotFound(_0x1b1489,null))[_0x5b0c('0x27')](function(_0x2179f2){if(_0x2179f2){_0x22b135=_0x2179f2;return db[_0x5b0c('0x62')]['rawAttributes'];}})['then'](function(_0x1699e9){if(_0x1699e9){var _0x2116c2={};var _0x58cf97={};_0x58cf97['model']=_['concat'](_[_0x5b0c('0x48')](_0x1699e9),_[_0x5b0c('0x2f')](_0x22b135[_0x5b0c('0x67')],function(_0x39cf6d){return util[_0x5b0c('0x68')]('cf_%d',_0x39cf6d['id']);}));_0x58cf97['query']=_[_0x5b0c('0x48')](_0x46beda[_0x5b0c('0x34')]);_0x58cf97[_0x5b0c('0x35')]=_[_0x5b0c('0x36')](_0x58cf97['model'],_0x58cf97['query']);_0x2116c2[_0x5b0c('0x37')]=_[_0x5b0c('0x36')](_0x58cf97[_0x5b0c('0x33')],qs['fields'](_0x46beda['query'][_0x5b0c('0x38')]));_0x2116c2[_0x5b0c('0x37')]=_0x2116c2['attributes']['length']?_0x2116c2[_0x5b0c('0x37')]:_0x58cf97[_0x5b0c('0x33')];if(!_0x46beda[_0x5b0c('0x34')][_0x5b0c('0x69')]('nolimit')){_0x2116c2[_0x5b0c('0x20')]=qs[_0x5b0c('0x20')](_0x46beda['query']['limit']);_0x2116c2[_0x5b0c('0x1f')]=qs[_0x5b0c('0x1f')](_0x46beda[_0x5b0c('0x34')][_0x5b0c('0x1f')]);}_0x2116c2[_0x5b0c('0x3b')]=qs[_0x5b0c('0x3c')](_0x46beda[_0x5b0c('0x34')][_0x5b0c('0x3c')]);_0x2116c2[_0x5b0c('0x3d')]=qs[_0x5b0c('0x35')](_[_0x5b0c('0x3e')](_0x46beda[_0x5b0c('0x34')],_0x58cf97['filters']));_0x2116c2['raw']=!![];if(_0x46beda[_0x5b0c('0x34')][_0x5b0c('0x3f')]){_0x2116c2[_0x5b0c('0x3d')]=_[_0x5b0c('0x40')](_0x2116c2[_0x5b0c('0x3d')],{'$or':_[_0x5b0c('0x2f')](_0x2116c2[_0x5b0c('0x37')],function(_0x5b05ee){var _0x44befa={};_0x44befa[_0x5b05ee]={'$like':'%'+_0x46beda[_0x5b0c('0x34')][_0x5b0c('0x3f')]+'%'};return _0x44befa;})});}_0x2116c2=_[_0x5b0c('0x40')]({},_0x2116c2,_0x46beda['options']);return _0x22b135[_0x5b0c('0x66')](_0x2116c2);}})[_0x5b0c('0x27')](respondWithResult(_0x1b1489,null))[_0x5b0c('0x45')](handleError(_0x1b1489,null));};exports[_0x5b0c('0x6a')]=function(_0x1fddc3,_0x478753,_0x1b4829){var _0x17125c;return db[_0x5b0c('0x30')][_0x5b0c('0x49')]({'where':{'id':_0x1fddc3['params']['id']},'include':[{'model':db['CmCustomField'],'as':_0x5b0c('0x67')}]})['then'](handleEntityNotFound(_0x478753,null))[_0x5b0c('0x27')](function(_0x4291b8){if(_0x4291b8){_0x17125c=_0x4291b8;return db[_0x5b0c('0x62')][_0x5b0c('0x31')];}})[_0x5b0c('0x27')](function(_0x449328){if(_0x449328){var _0xe608a8={};var _0x4faf47={};_0x4faf47[_0x5b0c('0x33')]=_[_0x5b0c('0x6b')](_[_0x5b0c('0x48')](_0x449328),_[_0x5b0c('0x2f')](_0x17125c[_0x5b0c('0x67')],function(_0x34e29e){return util[_0x5b0c('0x68')](_0x5b0c('0x6c'),_0x34e29e['id']);}));_0x4faf47[_0x5b0c('0x34')]=_[_0x5b0c('0x48')](_0x1fddc3[_0x5b0c('0x34')]);_0x4faf47['filters']=_[_0x5b0c('0x36')](_0x4faf47[_0x5b0c('0x33')],_0x4faf47[_0x5b0c('0x34')]);_0xe608a8[_0x5b0c('0x37')]=_[_0x5b0c('0x36')](_0x4faf47[_0x5b0c('0x33')],qs['fields'](_0x1fddc3['query'][_0x5b0c('0x38')]));_0xe608a8['attributes']=_0xe608a8[_0x5b0c('0x37')][_0x5b0c('0x39')]?_0xe608a8['attributes']:_0x4faf47[_0x5b0c('0x33')];if(!_0x1fddc3[_0x5b0c('0x34')][_0x5b0c('0x69')](_0x5b0c('0x3a'))){_0xe608a8[_0x5b0c('0x20')]=qs[_0x5b0c('0x20')](_0x1fddc3[_0x5b0c('0x34')]['limit']);_0xe608a8[_0x5b0c('0x1f')]=qs['offset'](_0x1fddc3[_0x5b0c('0x34')]['offset']);}_0xe608a8[_0x5b0c('0x3b')]=qs[_0x5b0c('0x3c')](_0x1fddc3[_0x5b0c('0x34')][_0x5b0c('0x3c')]);_0xe608a8['where']=qs[_0x5b0c('0x35')](_[_0x5b0c('0x3e')](_0x1fddc3[_0x5b0c('0x34')],_0x4faf47[_0x5b0c('0x35')]));_0xe608a8['raw']=!![];if(_0x1fddc3[_0x5b0c('0x34')][_0x5b0c('0x3f')]){_0xe608a8[_0x5b0c('0x3d')]=_[_0x5b0c('0x40')](_0xe608a8['where'],{'$or':_[_0x5b0c('0x2f')](_0xe608a8[_0x5b0c('0x37')],function(_0x549f74){var _0x267773={};_0x267773[_0x549f74]={'$like':'%'+_0x1fddc3[_0x5b0c('0x34')][_0x5b0c('0x3f')]+'%'};return _0x267773;})});}_0xe608a8=_[_0x5b0c('0x40')]({},_0xe608a8,_0x1fddc3[_0x5b0c('0x58')]);return _0x17125c[_0x5b0c('0x66')](_0xe608a8);}})[_0x5b0c('0x27')](function(_0xcb39ad){if(!_[_0x5b0c('0x6d')](_0xcb39ad)){var _0x1bb377=toCsv(_0xcb39ad);var _0x46d3c8=Date[_0x5b0c('0x6e')]();fs[_0x5b0c('0x6f')](util[_0x5b0c('0x68')](_0x5b0c('0x70'),_0x17125c['id'],_0x46d3c8),_0x1bb377);_0x478753['setHeader']('Content-disposition',_0x5b0c('0x71')+util[_0x5b0c('0x68')](_0x5b0c('0x72'),_0x17125c['id'],_0x46d3c8));_0x478753[_0x5b0c('0x73')](_0x5b0c('0x74'),'text/csv');return _0x478753[_0x5b0c('0x75')](util[_0x5b0c('0x68')](_0x5b0c('0x70'),_0x17125c['id'],_0x46d3c8));}else{return _0x478753['sendStatus'](0xcc);}})[_0x5b0c('0x45')](handleError(_0x478753,null));};exports[_0x5b0c('0x76')]=function(_0x1ee091,_0x17ead6,_0x534d91){var _0x4075ea;delete _0x1ee091[_0x5b0c('0x52')]['id'];return db[_0x5b0c('0x30')]['findOne']({'where':{'id':_0x1ee091['params']['id']}})[_0x5b0c('0x27')](handleEntityNotFound(_0x17ead6,null))[_0x5b0c('0x27')](function(_0x557695){if(_0x557695){return db['sequelize'][_0x5b0c('0x77')](function(_0x130ed3){return db['CmCustomField'][_0x5b0c('0x4a')](_0x1ee091[_0x5b0c('0x52')],{'transaction':_0x130ed3})[_0x5b0c('0x27')](function(_0x596d14){_0x4075ea=_0x596d14;return _0x557695[_0x5b0c('0x78')](_0x596d14,{'transaction':_0x130ed3});})[_0x5b0c('0x27')](function(){var _0x1a1176={'type':db['Sequelize']['TEXT'],'transaction':_0x130ed3};switch(_0x1ee091[_0x5b0c('0x52')]['type']){case'text':_0x1a1176[_0x5b0c('0x41')]=db[_0x5b0c('0x79')][_0x5b0c('0x7a')];break;case _0x5b0c('0x7b'):_0x1a1176[_0x5b0c('0x41')]=db[_0x5b0c('0x79')][_0x5b0c('0x7c')];break;case _0x5b0c('0x7d'):_0x1a1176[_0x5b0c('0x41')]=db[_0x5b0c('0x79')]['BOOLEAN'];_0x1a1176[_0x5b0c('0x7e')]=![];break;default:}return db[_0x5b0c('0x7f')][_0x5b0c('0x80')][_0x5b0c('0x81')](_0x5b0c('0x82'),util['format']('cf_%s',_0x4075ea['id']),_0x1a1176);})[_0x5b0c('0x27')](function(){return _0x4075ea;});});}})[_0x5b0c('0x27')](respondWithResult(_0x17ead6,null))[_0x5b0c('0x45')](handleError(_0x17ead6,null));};exports[_0x5b0c('0x83')]=function(_0x88102d,_0x315b03,_0x11278b){var _0xc0f0cd={};var _0x204d39={};var _0x5f5397;var _0x28935c;return db[_0x5b0c('0x30')][_0x5b0c('0x56')]({'where':{'id':_0x88102d['params']['id']}})[_0x5b0c('0x27')](handleEntityNotFound(_0x315b03,null))[_0x5b0c('0x27')](function(_0x370e8f){if(_0x370e8f){_0x5f5397=_0x370e8f;_0x204d39[_0x5b0c('0x33')]=_[_0x5b0c('0x48')](db[_0x5b0c('0x84')][_0x5b0c('0x31')]);_0x204d39[_0x5b0c('0x34')]=_['keys'](_0x88102d[_0x5b0c('0x34')]);_0x204d39[_0x5b0c('0x35')]=_[_0x5b0c('0x36')](_0x204d39['model'],_0x204d39[_0x5b0c('0x34')]);_0xc0f0cd[_0x5b0c('0x37')]=_[_0x5b0c('0x36')](_0x204d39[_0x5b0c('0x33')],qs[_0x5b0c('0x38')](_0x88102d[_0x5b0c('0x34')][_0x5b0c('0x38')]));_0xc0f0cd['attributes']=_0xc0f0cd['attributes']['length']?_0xc0f0cd[_0x5b0c('0x37')]:_0x204d39[_0x5b0c('0x33')];_0xc0f0cd[_0x5b0c('0x3b')]=qs[_0x5b0c('0x3c')](_0x88102d[_0x5b0c('0x34')]['sort']);_0xc0f0cd['where']=qs[_0x5b0c('0x35')](_[_0x5b0c('0x3e')](_0x88102d[_0x5b0c('0x34')],_0x204d39[_0x5b0c('0x35')]));_0xc0f0cd[_0x5b0c('0x3d')]=_[_0x5b0c('0x40')](_0xc0f0cd[_0x5b0c('0x3d')],{'$or':[{'ListId':_0x370e8f['id']},{'ListId':null}]});if(_0x88102d[_0x5b0c('0x34')]['filter']){_0xc0f0cd[_0x5b0c('0x3d')]=_['merge'](_0xc0f0cd[_0x5b0c('0x3d')],{'$or':_['map'](_0xc0f0cd[_0x5b0c('0x37')],function(_0x3d4943){var _0x12f5d3={};_0x12f5d3[_0x3d4943]={'$like':'%'+_0x88102d[_0x5b0c('0x34')][_0x5b0c('0x3f')]+'%'};return _0x12f5d3;})});}_0xc0f0cd=_['merge']({},_0xc0f0cd,_0x88102d[_0x5b0c('0x58')]);return db[_0x5b0c('0x84')][_0x5b0c('0x85')](_0xc0f0cd);}})[_0x5b0c('0x27')](respondWithResult(_0x315b03,null))['catch'](handleError(_0x315b03,null));};exports[_0x5b0c('0x86')]=function(_0x1926e9,_0x2cf0e5,_0x3eaa15){return db[_0x5b0c('0x30')][_0x5b0c('0x49')]({'where':{'id':_0x1926e9[_0x5b0c('0x47')]['id']}})[_0x5b0c('0x27')](handleEntityNotFound(_0x2cf0e5,null))[_0x5b0c('0x27')](function(_0xaa2ab2){if(_0xaa2ab2){return _0xaa2ab2[_0x5b0c('0x86')](_0x1926e9['body'][_0x5b0c('0x5b')],_['omit'](_0x1926e9['body'],['ids','id'])||{})[_0x5b0c('0x87')](function(_0x436683){for(var _0x6fe69b=0x0;_0x6fe69b<_0x1926e9[_0x5b0c('0x52')][_0x5b0c('0x5b')][_0x5b0c('0x39')];_0x6fe69b+=0x1){socket[_0x5b0c('0x88')](_0x5b0c('0x89'),{'UserId':Number(_0x1926e9[_0x5b0c('0x52')][_0x5b0c('0x5b')][_0x6fe69b]),'CmListId':Number(_0x1926e9['params']['id'])});}return _0x436683;});}})[_0x5b0c('0x27')](respondWithResult(_0x2cf0e5,null))['catch'](handleError(_0x2cf0e5,null));};exports[_0x5b0c('0x8a')]=function(_0x18546b,_0xa14d89,_0x240d18){return db[_0x5b0c('0x30')][_0x5b0c('0x49')]({'where':{'id':_0x18546b['params']['id']}})['then'](handleEntityNotFound(_0xa14d89,null))[_0x5b0c('0x27')](function(_0x358ebc){if(_0x358ebc){return _0x358ebc[_0x5b0c('0x8a')](_0x18546b[_0x5b0c('0x34')][_0x5b0c('0x5b')])[_0x5b0c('0x27')](function(){if(_[_0x5b0c('0x5d')](_0x18546b['query'][_0x5b0c('0x5b')])){for(var _0x380b56=0x0;_0x380b56<_0x18546b[_0x5b0c('0x34')][_0x5b0c('0x5b')][_0x5b0c('0x39')];_0x380b56+=0x1){socket[_0x5b0c('0x88')]('userCmList:remove',{'UserId':Number(_0x18546b[_0x5b0c('0x34')]['ids'][_0x380b56]),'CmListId':Number(_0x18546b[_0x5b0c('0x47')]['id'])});}}else{socket[_0x5b0c('0x88')](_0x5b0c('0x8b'),{'UserId':Number(_0x18546b[_0x5b0c('0x34')]['ids']),'CmListId':Number(_0x18546b[_0x5b0c('0x47')]['id'])});}});}})['then'](respondWithStatusCode(_0xa14d89,null))['catch'](handleError(_0xa14d89,null));};exports['getAgents']=function(_0x23f5ec,_0x9929f2,_0x30dd35){var _0x5e382d={};var _0x579371={};var _0x2b6788;var _0x3c9e54;return db[_0x5b0c('0x30')][_0x5b0c('0x56')]({'where':{'id':_0x23f5ec[_0x5b0c('0x47')]['id']}})['then'](handleEntityNotFound(_0x9929f2,null))['then'](function(_0x142c00){if(_0x142c00){_0x2b6788=_0x142c00;_0x579371[_0x5b0c('0x33')]=_['keys'](db['User'][_0x5b0c('0x31')]);_0x579371[_0x5b0c('0x34')]=_[_0x5b0c('0x48')](_0x23f5ec['query']);_0x579371[_0x5b0c('0x35')]=_[_0x5b0c('0x36')](_0x579371[_0x5b0c('0x33')],_0x579371['query']);_0x5e382d[_0x5b0c('0x37')]=_[_0x5b0c('0x36')](_0x579371[_0x5b0c('0x33')],qs[_0x5b0c('0x38')](_0x23f5ec[_0x5b0c('0x34')][_0x5b0c('0x38')]));_0x5e382d[_0x5b0c('0x37')]=_0x5e382d[_0x5b0c('0x37')][_0x5b0c('0x39')]?_0x5e382d[_0x5b0c('0x37')]:_0x579371[_0x5b0c('0x33')];_0x5e382d[_0x5b0c('0x3b')]=qs[_0x5b0c('0x3c')](_0x23f5ec[_0x5b0c('0x34')][_0x5b0c('0x3c')]);_0x5e382d[_0x5b0c('0x3d')]=qs[_0x5b0c('0x35')](_[_0x5b0c('0x3e')](_0x23f5ec['query'],_0x579371[_0x5b0c('0x35')]));if(_0x23f5ec[_0x5b0c('0x34')][_0x5b0c('0x3f')]){_0x5e382d[_0x5b0c('0x3d')]=_[_0x5b0c('0x40')](_0x5e382d[_0x5b0c('0x3d')],{'$or':_[_0x5b0c('0x2f')](_0x5e382d[_0x5b0c('0x37')],function(_0x15c4d8){var _0x5ede0d={};_0x5ede0d[_0x15c4d8]={'$like':'%'+_0x23f5ec[_0x5b0c('0x34')]['filter']+'%'};return _0x5ede0d;})});}_0x5e382d=_[_0x5b0c('0x40')]({},_0x5e382d,_0x23f5ec[_0x5b0c('0x58')]);return _0x2b6788[_0x5b0c('0x8c')](_0x5e382d);}})[_0x5b0c('0x27')](function(_0x4a21dd){if(_0x4a21dd){_0x3c9e54=_0x4a21dd[_0x5b0c('0x39')];if(!_0x23f5ec[_0x5b0c('0x34')][_0x5b0c('0x69')](_0x5b0c('0x3a'))){_0x5e382d[_0x5b0c('0x20')]=qs[_0x5b0c('0x20')](_0x23f5ec[_0x5b0c('0x34')][_0x5b0c('0x20')]);_0x5e382d['offset']=qs[_0x5b0c('0x1f')](_0x23f5ec[_0x5b0c('0x34')]['offset']);}return _0x2b6788[_0x5b0c('0x8c')](_0x5e382d);}})[_0x5b0c('0x27')](function(_0x63b6cf){if(_0x63b6cf){return _0x63b6cf?{'count':_0x3c9e54,'rows':_0x63b6cf}:null;}})[_0x5b0c('0x27')](respondWithResult(_0x9929f2,null))[_0x5b0c('0x45')](handleError(_0x9929f2,null));}; \ No newline at end of file +var _0x170e=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./cmList.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','get','Lists','sendStatus','error','stack','name','send','index','CmList','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','includeAll','include','rows','catch','show','params','keys','fields','options','find','create','user','role','userProfileId','autoAssociation','UserProfileResource','body','describe','ListId','Disposition','getDispositions','findOne','findAll','removeDispositions','ids','addContacts','CmContact','tags','isArray','push','each','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','cf_%d','raw','getContactsCsv','format','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','setHeader','Content-type','text/csv','addCustomField','sequelize','transaction','addCustomFields','text','Sequelize','TEXT','number','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','getCustomFields','findAndCountAll','addAgents','omit','spread','emit','removeAgents','userCmList:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash'];(function(_0xc9b1b7,_0x3112d8){var _0x464659=function(_0x7534cf){while(--_0x7534cf){_0xc9b1b7['push'](_0xc9b1b7['shift']());}};_0x464659(++_0x3112d8);}(_0x170e,0x1b6));var _0xe170=function(_0x2bafde,_0x39326c){_0x2bafde=_0x2bafde-0x0;var _0x5733dc=_0x170e[_0x2bafde];return _0x5733dc;};'use strict';var emlformat=require(_0xe170('0x0'));var rimraf=require(_0xe170('0x1'));var zipdir=require(_0xe170('0x2'));var jsonpatch=require(_0xe170('0x3'));var rp=require(_0xe170('0x4'));var moment=require(_0xe170('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe170('0x6'));var util=require(_0xe170('0x7'));var path=require(_0xe170('0x8'));var sox=require(_0xe170('0x9'));var csv=require(_0xe170('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe170('0xb'));var squel=require(_0xe170('0xc'));var crypto=require(_0xe170('0xd'));var jsforce=require(_0xe170('0xe'));var deskjs=require(_0xe170('0xf'));var toCsv=require(_0xe170('0xa'));var querystring=require(_0xe170('0x10'));var Papa=require(_0xe170('0x11'));var Redis=require(_0xe170('0x12'));var authService=require(_0xe170('0x13'));var qs=require(_0xe170('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe170('0x15'));var logger=require(_0xe170('0x16'))(_0xe170('0x17'));var utils=require(_0xe170('0x18'));var config=require(_0xe170('0x19'));var licenseUtil=require(_0xe170('0x1a'));var db=require(_0xe170('0x1b'))['db'];config[_0xe170('0x1c')]=_['defaults'](config['redis'],{'host':_0xe170('0x1d'),'port':0x18eb});var socket=require(_0xe170('0x1e'))(new Redis(config['redis']));require(_0xe170('0x1f'))[_0xe170('0x20')](socket);function respondWithStatusCode(_0x2faac2,_0x2d9356){_0x2d9356=_0x2d9356||0xcc;return function(_0x179f1b){if(_0x179f1b){return _0x2faac2['sendStatus'](_0x2d9356);}return _0x2faac2[_0xe170('0x21')](_0x2d9356)[_0xe170('0x22')]();};}function respondWithResult(_0x1b7f24,_0x45505f){_0x45505f=_0x45505f||0xc8;return function(_0x32bc92){if(_0x32bc92){return _0x1b7f24[_0xe170('0x21')](_0x45505f)[_0xe170('0x23')](_0x32bc92);}};}function respondWithFilteredResult(_0x453538,_0x14ccf7){return function(_0x505256){if(_0x505256){var _0x545143=typeof _0x14ccf7[_0xe170('0x24')]===_0xe170('0x25')&&typeof _0x14ccf7[_0xe170('0x26')]===_0xe170('0x25');var _0x5003e8=_0x505256['count'];var _0x39eae1=_0x545143?0x0:_0x14ccf7['offset'];var _0x42b21c=_0x545143?_0x505256[_0xe170('0x27')]:_0x14ccf7[_0xe170('0x24')]+_0x14ccf7['limit'];var _0x2c5054;if(_0x42b21c>=_0x5003e8){_0x42b21c=_0x5003e8;_0x2c5054=0xc8;}else{_0x2c5054=0xce;}_0x453538[_0xe170('0x21')](_0x2c5054);return _0x453538[_0xe170('0x28')](_0xe170('0x29'),_0x39eae1+'-'+_0x42b21c+'/'+_0x5003e8)[_0xe170('0x23')](_0x505256);}return null;};}function patchUpdates(_0x345288){return function(_0x4089a1){try{jsonpatch['apply'](_0x4089a1,_0x345288,!![]);}catch(_0x561949){return BPromise[_0xe170('0x2a')](_0x561949);}return _0x4089a1[_0xe170('0x2b')]();};}function saveUpdates(_0x3bede3,_0x3f6dad){return function(_0xea21a2){if(_0xea21a2){return _0xea21a2[_0xe170('0x2c')](_0x3bede3)['then'](function(_0xa65b5){return _0xa65b5;});}return null;};}function removeEntity(_0x2e2e6c,_0xe03e0b){return function(_0x4ac394){if(_0x4ac394){return _0x4ac394[_0xe170('0x2d')]()[_0xe170('0x2e')](function(){var _0x2d8a8f=_0x4ac394[_0xe170('0x2f')]({'plain':!![]});var _0x1b4902=_0xe170('0x30');return db['UserProfileResource'][_0xe170('0x2d')]({'where':{'type':_0x1b4902,'resourceId':_0x2d8a8f['id']}})[_0xe170('0x2e')](function(){return _0x4ac394;});})[_0xe170('0x2e')](function(){_0x2e2e6c[_0xe170('0x21')](0xcc)[_0xe170('0x22')]();});}};}function handleEntityNotFound(_0x4401f1,_0x51bfd4){return function(_0x375930){if(!_0x375930){_0x4401f1[_0xe170('0x31')](0x194);}return _0x375930;};}function handleError(_0x921347,_0x4b87a2){_0x4b87a2=_0x4b87a2||0x1f4;return function(_0x3bd513){logger[_0xe170('0x32')](_0x3bd513[_0xe170('0x33')]);if(_0x3bd513[_0xe170('0x34')]){delete _0x3bd513[_0xe170('0x34')];}_0x921347[_0xe170('0x21')](_0x4b87a2)[_0xe170('0x35')](_0x3bd513);};}exports[_0xe170('0x36')]=function(_0x366b23,_0x2984b4){var _0x2dcf59={},_0x9e9a6f={},_0x5800f0={'count':0x0,'rows':[]};var _0x31b97f=_['map'](db[_0xe170('0x37')][_0xe170('0x38')],function(_0x3d6f93){return{'name':_0x3d6f93[_0xe170('0x39')],'type':_0x3d6f93[_0xe170('0x3a')][_0xe170('0x3b')]};});_0x9e9a6f[_0xe170('0x3c')]=_[_0xe170('0x3d')](_0x31b97f,_0xe170('0x34'));_0x9e9a6f[_0xe170('0x3e')]=_['keys'](_0x366b23[_0xe170('0x3e')]);_0x9e9a6f[_0xe170('0x3f')]=_[_0xe170('0x40')](_0x9e9a6f[_0xe170('0x3c')],_0x9e9a6f[_0xe170('0x3e')]);_0x2dcf59[_0xe170('0x41')]=_['intersection'](_0x9e9a6f[_0xe170('0x3c')],qs['fields'](_0x366b23[_0xe170('0x3e')]['fields']));_0x2dcf59['attributes']=_0x2dcf59[_0xe170('0x41')][_0xe170('0x42')]?_0x2dcf59[_0xe170('0x41')]:_0x9e9a6f[_0xe170('0x3c')];if(!_0x366b23[_0xe170('0x3e')][_0xe170('0x43')](_0xe170('0x44'))){_0x2dcf59[_0xe170('0x26')]=qs['limit'](_0x366b23[_0xe170('0x3e')]['limit']);_0x2dcf59[_0xe170('0x24')]=qs[_0xe170('0x24')](_0x366b23[_0xe170('0x3e')][_0xe170('0x24')]);}_0x2dcf59[_0xe170('0x45')]=qs[_0xe170('0x46')](_0x366b23['query']['sort']);_0x2dcf59[_0xe170('0x47')]=qs[_0xe170('0x3f')](_[_0xe170('0x48')](_0x366b23['query'],_0x9e9a6f[_0xe170('0x3f')]),_0x31b97f);if(_0x366b23[_0xe170('0x3e')]['filter']){_0x2dcf59[_0xe170('0x47')]=_[_0xe170('0x49')](_0x2dcf59[_0xe170('0x47')],{'$or':_[_0xe170('0x3d')](_0x31b97f,function(_0x39c77e){if(_0x39c77e[_0xe170('0x3a')]!=='VIRTUAL'){var _0x41aac0={};_0x41aac0[_0x39c77e['name']]={'$like':'%'+_0x366b23[_0xe170('0x3e')][_0xe170('0x4a')]+'%'};return _0x41aac0;}})});}_0x2dcf59=_[_0xe170('0x49')]({},_0x2dcf59,_0x366b23['options']);var _0x324859={'where':_0x2dcf59[_0xe170('0x47')]};return db[_0xe170('0x37')][_0xe170('0x27')](_0x324859)[_0xe170('0x2e')](function(_0x1b8bad){_0x5800f0[_0xe170('0x27')]=_0x1b8bad;if(_0x366b23[_0xe170('0x3e')][_0xe170('0x4b')]){_0x2dcf59[_0xe170('0x4c')]=[{'all':!![]}];}return db[_0xe170('0x37')]['findAll'](_0x2dcf59);})[_0xe170('0x2e')](function(_0x22eb7a){_0x5800f0[_0xe170('0x4d')]=_0x22eb7a;return _0x5800f0;})[_0xe170('0x2e')](respondWithFilteredResult(_0x2984b4,_0x2dcf59))[_0xe170('0x4e')](handleError(_0x2984b4,null));};exports[_0xe170('0x4f')]=function(_0x5b6173,_0x3117a0){var _0x140560={'raw':![],'where':{'id':_0x5b6173[_0xe170('0x50')]['id']}},_0x468dba={};_0x468dba[_0xe170('0x3c')]=_[_0xe170('0x51')](db[_0xe170('0x37')][_0xe170('0x38')]);_0x468dba[_0xe170('0x3e')]=_['keys'](_0x5b6173[_0xe170('0x3e')]);_0x468dba[_0xe170('0x3f')]=_[_0xe170('0x40')](_0x468dba['model'],_0x468dba['query']);_0x140560[_0xe170('0x41')]=_[_0xe170('0x40')](_0x468dba[_0xe170('0x3c')],qs[_0xe170('0x52')](_0x5b6173[_0xe170('0x3e')][_0xe170('0x52')]));_0x140560['attributes']=_0x140560['attributes']['length']?_0x140560[_0xe170('0x41')]:_0x468dba[_0xe170('0x3c')];if(_0x5b6173['query'][_0xe170('0x4b')]){_0x140560['include']=[{'all':!![]}];}_0x140560=_[_0xe170('0x49')]({},_0x140560,_0x5b6173[_0xe170('0x53')]);return db[_0xe170('0x37')][_0xe170('0x54')](_0x140560)['then'](handleEntityNotFound(_0x3117a0,null))['then'](respondWithResult(_0x3117a0,null))[_0xe170('0x4e')](handleError(_0x3117a0,null));};exports[_0xe170('0x55')]=function(_0x15d236,_0x1249b2){return db[_0xe170('0x37')][_0xe170('0x55')](_0x15d236['body'],{})['then'](function(_0x14b852){var _0x5c2ed1=_0x15d236[_0xe170('0x56')][_0xe170('0x2f')]({'plain':!![]});if(!_0x5c2ed1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5c2ed1[_0xe170('0x57')]==='user'){var _0x4427ee=_0x14b852['get']({'plain':!![]});var _0x3db944='Lists';return db['UserProfileSection'][_0xe170('0x54')]({'where':{'name':_0x3db944,'userProfileId':_0x5c2ed1[_0xe170('0x58')]},'raw':!![]})['then'](function(_0x3793e1){if(_0x3793e1&&_0x3793e1[_0xe170('0x59')]===0x0){return db[_0xe170('0x5a')]['create']({'name':_0x4427ee[_0xe170('0x34')],'resourceId':_0x4427ee['id'],'type':_0x3793e1[_0xe170('0x34')],'sectionId':_0x3793e1['id']},{})[_0xe170('0x2e')](function(){return _0x14b852;});}else{return _0x14b852;}})['catch'](function(_0x4e391a){logger[_0xe170('0x32')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4e391a);throw _0x4e391a;});}return _0x14b852;})[_0xe170('0x2e')](respondWithResult(_0x1249b2,0xc9))['catch'](handleError(_0x1249b2,null));};exports[_0xe170('0x2c')]=function(_0x5af549,_0x22773c){if(_0x5af549[_0xe170('0x5b')]['id']){delete _0x5af549[_0xe170('0x5b')]['id'];}return db[_0xe170('0x37')][_0xe170('0x54')]({'where':{'id':_0x5af549[_0xe170('0x50')]['id']}})['then'](handleEntityNotFound(_0x22773c,null))[_0xe170('0x2e')](saveUpdates(_0x5af549[_0xe170('0x5b')],null))['then'](respondWithResult(_0x22773c,null))[_0xe170('0x4e')](handleError(_0x22773c,null));};exports[_0xe170('0x2d')]=function(_0x4e638e,_0x1fcff2){return db[_0xe170('0x37')][_0xe170('0x54')]({'where':{'id':_0x4e638e['params']['id']}})[_0xe170('0x2e')](handleEntityNotFound(_0x1fcff2,null))['then'](removeEntity(_0x1fcff2,null))[_0xe170('0x4e')](handleError(_0x1fcff2,null));};exports[_0xe170('0x5c')]=function(_0x258a53,_0x19be40){return db[_0xe170('0x37')][_0xe170('0x5c')]()['then'](respondWithResult(_0x19be40,null))[_0xe170('0x4e')](handleError(_0x19be40,null));};exports['addDisposition']=function(_0x3790c0,_0x2f72bc,_0x447184){if(_0x3790c0[_0xe170('0x5b')]['id']){delete _0x3790c0[_0xe170('0x5b')]['id'];}return db['CmList'][_0xe170('0x54')]({'where':{'id':_0x3790c0['params']['id']}})[_0xe170('0x2e')](handleEntityNotFound(_0x2f72bc,null))[_0xe170('0x2e')](function(_0x2d0bf8){if(_0x2d0bf8){_0x3790c0[_0xe170('0x5b')][_0xe170('0x5d')]=_0x2d0bf8['id'];return db[_0xe170('0x5e')]['create'](_0x3790c0[_0xe170('0x5b')]);}})['then'](respondWithResult(_0x2f72bc,null))['catch'](handleError(_0x2f72bc,null));};exports[_0xe170('0x5f')]=function(_0x458ef8,_0x1fc4f5,_0x3dfb4b){var _0x10043a={'raw':![],'where':{}};var _0x59cf9f={};var _0x7b33dd={'count':0x0,'rows':[]};return db['CmList'][_0xe170('0x60')]({'where':{'id':_0x458ef8[_0xe170('0x50')]['id']}})[_0xe170('0x2e')](handleEntityNotFound(_0x1fc4f5,null))['then'](function(_0x5587ca){if(_0x5587ca){_0x59cf9f[_0xe170('0x3c')]=_['keys'](db[_0xe170('0x5e')][_0xe170('0x38')]);_0x59cf9f[_0xe170('0x3e')]=_[_0xe170('0x51')](_0x458ef8[_0xe170('0x3e')]);_0x59cf9f[_0xe170('0x3f')]=_[_0xe170('0x40')](_0x59cf9f[_0xe170('0x3c')],_0x59cf9f['query']);_0x10043a[_0xe170('0x41')]=_['intersection'](_0x59cf9f[_0xe170('0x3c')],qs[_0xe170('0x52')](_0x458ef8[_0xe170('0x3e')][_0xe170('0x52')]));_0x10043a[_0xe170('0x41')]=_0x10043a[_0xe170('0x41')][_0xe170('0x42')]?_0x10043a[_0xe170('0x41')]:_0x59cf9f['model'];if(!_0x458ef8[_0xe170('0x3e')][_0xe170('0x43')](_0xe170('0x44'))){_0x10043a[_0xe170('0x26')]=qs['limit'](_0x458ef8['query']['limit']);_0x10043a[_0xe170('0x24')]=qs[_0xe170('0x24')](_0x458ef8[_0xe170('0x3e')]['offset']);}_0x10043a[_0xe170('0x45')]=qs[_0xe170('0x46')](_0x458ef8[_0xe170('0x3e')]['sort']);_0x10043a[_0xe170('0x47')]=qs['filters'](_[_0xe170('0x48')](_0x458ef8[_0xe170('0x3e')],_0x59cf9f['filters']));_0x10043a[_0xe170('0x47')][_0xe170('0x5d')]=_0x5587ca['id'];if(_0x458ef8['query'][_0xe170('0x4a')]){_0x10043a['where']=_['merge'](_0x10043a[_0xe170('0x47')],{'$or':_['map'](_0x10043a[_0xe170('0x41')],function(_0x305f85){var _0xbd07c1={};_0xbd07c1[_0x305f85]={'$like':'%'+_0x458ef8[_0xe170('0x3e')][_0xe170('0x4a')]+'%'};return _0xbd07c1;})});}_0x10043a=_[_0xe170('0x49')]({},_0x10043a,_0x458ef8['options']);return db[_0xe170('0x5e')]['count']({'where':_0x10043a['where']})['then'](function(_0x56af99){_0x7b33dd['count']=_0x56af99;if(_0x458ef8['query']['includeAll']){_0x10043a[_0xe170('0x4c')]=[{'all':!![]}];}return db[_0xe170('0x5e')][_0xe170('0x61')](_0x10043a);})['then'](function(_0x365a13){_0x7b33dd[_0xe170('0x4d')]=_0x365a13;return _0x7b33dd;});}})[_0xe170('0x2e')](respondWithFilteredResult(_0x1fc4f5,_0x10043a))['catch'](handleError(_0x1fc4f5,null));};exports['removeDispositions']=function(_0x95de70,_0x3ee0b8,_0x252a4e){return db['CmList'][_0xe170('0x54')]({'where':{'id':_0x95de70[_0xe170('0x50')]['id']}})[_0xe170('0x2e')](handleEntityNotFound(_0x3ee0b8,null))[_0xe170('0x2e')](function(_0x541656){if(_0x541656){return _0x541656[_0xe170('0x62')](_0x95de70[_0xe170('0x3e')][_0xe170('0x63')]);}})[_0xe170('0x2e')](respondWithStatusCode(_0x3ee0b8,null))[_0xe170('0x4e')](handleError(_0x3ee0b8,null));};exports[_0xe170('0x64')]=function(_0x7aaaeb,_0x294517,_0x378630){return db[_0xe170('0x37')]['find']({'where':{'id':_0x7aaaeb[_0xe170('0x50')]['id']}})[_0xe170('0x2e')](handleEntityNotFound(_0x294517,null))['then'](function(_0x29388f){if(_0x29388f){var _0x3e4779=[];var _0x1b848={'success':[],'errors':[]};return db[_0xe170('0x65')]['describe']()['then'](function(_0x3ab869){if(_0x7aaaeb[_0xe170('0x5b')][_0xe170('0x66')]&&_['isArray'](_0x7aaaeb[_0xe170('0x5b')]['tags'])){if(_0x7aaaeb['body'][_0xe170('0x66')][_0xe170('0x42')]){_0x7aaaeb[_0xe170('0x5b')]['tags']=_0x7aaaeb[_0xe170('0x5b')][_0xe170('0x66')]['join'](';')+';';}else{_0x7aaaeb['body']['tags']=null;}}else{_0x7aaaeb[_0xe170('0x5b')][_0xe170('0x66')]=null;}if(_0x7aaaeb[_0xe170('0x5b')]&&_[_0xe170('0x67')](_0x7aaaeb[_0xe170('0x5b')])){for(var _0x40faa6=0x0;_0x40faa6<_0x7aaaeb[_0xe170('0x5b')][_0xe170('0x42')];_0x40faa6+=0x1){_0x7aaaeb[_0xe170('0x5b')][_0x40faa6][_0xe170('0x5d')]=_0x7aaaeb[_0xe170('0x50')]['id'];_0x3e4779[_0xe170('0x68')](_0x7aaaeb[_0xe170('0x5b')][_0x40faa6]);}return BPromise[_0xe170('0x69')](_0x3e4779,function(_0x54ac6c){return db[_0xe170('0x65')][_0xe170('0x55')](_['omit'](_0x54ac6c,[_0xe170('0x63'),'id'])||{},{'fields':_[_0xe170('0x51')](_0x3ab869),'raw':!![]})[_0xe170('0x2e')](function(_0xa3e234){_0x1b848['success'][_0xe170('0x68')](_0xa3e234['dataValues']);})[_0xe170('0x4e')](function(_0x1f9018){_0x1b848[_0xe170('0x6a')][_0xe170('0x68')]({'data':_0x54ac6c,'error':_0x1f9018[_0xe170('0x6b')]});});})[_0xe170('0x2e')](function(_0x125171){return _0x1b848;})['catch'](function(_0xa8e703){return _0xa8e703;});}else{_0x294517[_0xe170('0x21')](0x190)[_0xe170('0x23')]({'message':_0xe170('0x6c')});}});}})['then'](respondWithResult(_0x294517,null))['catch'](handleError(_0x294517,null));};exports[_0xe170('0x6d')]=function(_0x4fd8c1,_0x474789,_0x598d06){var _0x19ed00;return db[_0xe170('0x37')][_0xe170('0x54')]({'where':{'id':_0x4fd8c1[_0xe170('0x50')]['id']},'include':[{'model':db[_0xe170('0x6e')],'as':_0xe170('0x6f')}]})['then'](handleEntityNotFound(_0x474789,null))['then'](function(_0x36797e){if(_0x36797e){_0x19ed00=_0x36797e;return db[_0xe170('0x65')][_0xe170('0x38')];}})[_0xe170('0x2e')](function(_0x64856b){if(_0x64856b){var _0x1b7bac={};var _0x20384e={};_0x20384e[_0xe170('0x3c')]=_[_0xe170('0x70')](_['keys'](_0x64856b),_[_0xe170('0x3d')](_0x19ed00['CustomFields'],function(_0x89dd6c){return util['format'](_0xe170('0x71'),_0x89dd6c['id']);}));_0x20384e['query']=_[_0xe170('0x51')](_0x4fd8c1[_0xe170('0x3e')]);_0x20384e[_0xe170('0x3f')]=_[_0xe170('0x40')](_0x20384e[_0xe170('0x3c')],_0x20384e[_0xe170('0x3e')]);_0x1b7bac[_0xe170('0x41')]=_['intersection'](_0x20384e[_0xe170('0x3c')],qs['fields'](_0x4fd8c1[_0xe170('0x3e')][_0xe170('0x52')]));_0x1b7bac[_0xe170('0x41')]=_0x1b7bac['attributes'][_0xe170('0x42')]?_0x1b7bac[_0xe170('0x41')]:_0x20384e['model'];if(!_0x4fd8c1[_0xe170('0x3e')][_0xe170('0x43')](_0xe170('0x44'))){_0x1b7bac['limit']=qs[_0xe170('0x26')](_0x4fd8c1[_0xe170('0x3e')]['limit']);_0x1b7bac[_0xe170('0x24')]=qs[_0xe170('0x24')](_0x4fd8c1[_0xe170('0x3e')][_0xe170('0x24')]);}_0x1b7bac[_0xe170('0x45')]=qs[_0xe170('0x46')](_0x4fd8c1['query'][_0xe170('0x46')]);_0x1b7bac[_0xe170('0x47')]=qs['filters'](_[_0xe170('0x48')](_0x4fd8c1[_0xe170('0x3e')],_0x20384e[_0xe170('0x3f')]));_0x1b7bac[_0xe170('0x72')]=!![];if(_0x4fd8c1['query'][_0xe170('0x4a')]){_0x1b7bac['where']=_['merge'](_0x1b7bac['where'],{'$or':_[_0xe170('0x3d')](_0x1b7bac['attributes'],function(_0x13d0d0){var _0x29cb1d={};_0x29cb1d[_0x13d0d0]={'$like':'%'+_0x4fd8c1['query']['filter']+'%'};return _0x29cb1d;})});}_0x1b7bac=_[_0xe170('0x49')]({},_0x1b7bac,_0x4fd8c1[_0xe170('0x53')]);return _0x19ed00['getContacts'](_0x1b7bac);}})[_0xe170('0x2e')](respondWithResult(_0x474789,null))[_0xe170('0x4e')](handleError(_0x474789,null));};exports[_0xe170('0x73')]=function(_0x208d38,_0x3e4b42,_0x589787){var _0x1d9ca7;return db[_0xe170('0x37')][_0xe170('0x54')]({'where':{'id':_0x208d38[_0xe170('0x50')]['id']},'include':[{'model':db[_0xe170('0x6e')],'as':_0xe170('0x6f')}]})['then'](handleEntityNotFound(_0x3e4b42,null))[_0xe170('0x2e')](function(_0x1fda86){if(_0x1fda86){_0x1d9ca7=_0x1fda86;return db[_0xe170('0x65')][_0xe170('0x38')];}})['then'](function(_0x1d9eb1){if(_0x1d9eb1){var _0x34fef8={};var _0x3b978a={};_0x3b978a['model']=_[_0xe170('0x70')](_['keys'](_0x1d9eb1),_['map'](_0x1d9ca7[_0xe170('0x6f')],function(_0xb83739){return util[_0xe170('0x74')]('cf_%d',_0xb83739['id']);}));_0x3b978a[_0xe170('0x3e')]=_['keys'](_0x208d38[_0xe170('0x3e')]);_0x3b978a[_0xe170('0x3f')]=_['intersection'](_0x3b978a[_0xe170('0x3c')],_0x3b978a[_0xe170('0x3e')]);_0x34fef8['attributes']=_[_0xe170('0x40')](_0x3b978a[_0xe170('0x3c')],qs[_0xe170('0x52')](_0x208d38[_0xe170('0x3e')]['fields']));_0x34fef8[_0xe170('0x41')]=_0x34fef8[_0xe170('0x41')][_0xe170('0x42')]?_0x34fef8[_0xe170('0x41')]:_0x3b978a[_0xe170('0x3c')];if(!_0x208d38[_0xe170('0x3e')][_0xe170('0x43')](_0xe170('0x44'))){_0x34fef8[_0xe170('0x26')]=qs[_0xe170('0x26')](_0x208d38[_0xe170('0x3e')][_0xe170('0x26')]);_0x34fef8[_0xe170('0x24')]=qs[_0xe170('0x24')](_0x208d38[_0xe170('0x3e')]['offset']);}_0x34fef8[_0xe170('0x45')]=qs[_0xe170('0x46')](_0x208d38[_0xe170('0x3e')][_0xe170('0x46')]);_0x34fef8[_0xe170('0x47')]=qs[_0xe170('0x3f')](_['pick'](_0x208d38[_0xe170('0x3e')],_0x3b978a[_0xe170('0x3f')]));_0x34fef8[_0xe170('0x72')]=!![];if(_0x208d38[_0xe170('0x3e')][_0xe170('0x4a')]){_0x34fef8['where']=_[_0xe170('0x49')](_0x34fef8[_0xe170('0x47')],{'$or':_[_0xe170('0x3d')](_0x34fef8['attributes'],function(_0x231d99){var _0x3e685b={};_0x3e685b[_0x231d99]={'$like':'%'+_0x208d38['query']['filter']+'%'};return _0x3e685b;})});}_0x34fef8=_[_0xe170('0x49')]({},_0x34fef8,_0x208d38[_0xe170('0x53')]);return _0x1d9ca7[_0xe170('0x6d')](_0x34fef8);}})[_0xe170('0x2e')](function(_0x130e03){if(!_[_0xe170('0x75')](_0x130e03)){var _0x4e86c9=toCsv(_0x130e03);var _0x18e659=Date[_0xe170('0x76')]();fs[_0xe170('0x77')](util[_0xe170('0x74')](_0xe170('0x78'),_0x1d9ca7['id'],_0x18e659),_0x4e86c9);_0x3e4b42['setHeader'](_0xe170('0x79'),_0xe170('0x7a')+util[_0xe170('0x74')](_0xe170('0x7b'),_0x1d9ca7['id'],_0x18e659));_0x3e4b42[_0xe170('0x7c')](_0xe170('0x7d'),_0xe170('0x7e'));return _0x3e4b42['download'](util[_0xe170('0x74')](_0xe170('0x78'),_0x1d9ca7['id'],_0x18e659));}else{return _0x3e4b42['sendStatus'](0xcc);}})[_0xe170('0x4e')](handleError(_0x3e4b42,null));};exports[_0xe170('0x7f')]=function(_0x8623f7,_0x1000b5,_0x24b57e){var _0x2d0ebe;delete _0x8623f7[_0xe170('0x5b')]['id'];return db[_0xe170('0x37')]['findOne']({'where':{'id':_0x8623f7[_0xe170('0x50')]['id']}})[_0xe170('0x2e')](handleEntityNotFound(_0x1000b5,null))['then'](function(_0x63dc11){if(_0x63dc11){return db[_0xe170('0x80')][_0xe170('0x81')](function(_0x3f2d23){return db[_0xe170('0x6e')][_0xe170('0x55')](_0x8623f7[_0xe170('0x5b')],{'transaction':_0x3f2d23})[_0xe170('0x2e')](function(_0x10f25e){_0x2d0ebe=_0x10f25e;return _0x63dc11[_0xe170('0x82')](_0x10f25e,{'transaction':_0x3f2d23});})[_0xe170('0x2e')](function(){var _0x22d38c={'type':db['Sequelize']['TEXT'],'transaction':_0x3f2d23};switch(_0x8623f7[_0xe170('0x5b')][_0xe170('0x3a')]){case _0xe170('0x83'):_0x22d38c[_0xe170('0x3a')]=db[_0xe170('0x84')][_0xe170('0x85')];break;case _0xe170('0x86'):_0x22d38c['type']=db[_0xe170('0x84')]['INTEGER'];break;case'switch':_0x22d38c[_0xe170('0x3a')]=db[_0xe170('0x84')][_0xe170('0x87')];_0x22d38c[_0xe170('0x88')]=![];break;default:}return db['sequelize'][_0xe170('0x89')][_0xe170('0x8a')](_0xe170('0x8b'),util[_0xe170('0x74')]('cf_%s',_0x2d0ebe['id']),_0x22d38c);})['then'](function(){return _0x2d0ebe;});});}})[_0xe170('0x2e')](respondWithResult(_0x1000b5,null))[_0xe170('0x4e')](handleError(_0x1000b5,null));};exports[_0xe170('0x8c')]=function(_0x44bb8e,_0x733470,_0x235b18){var _0x43e841={};var _0x1dff14={};var _0x2982cd;var _0x55938d;return db[_0xe170('0x37')][_0xe170('0x60')]({'where':{'id':_0x44bb8e[_0xe170('0x50')]['id']}})[_0xe170('0x2e')](handleEntityNotFound(_0x733470,null))[_0xe170('0x2e')](function(_0x48cfac){if(_0x48cfac){_0x2982cd=_0x48cfac;_0x1dff14[_0xe170('0x3c')]=_[_0xe170('0x51')](db['CmCustomField'][_0xe170('0x38')]);_0x1dff14['query']=_['keys'](_0x44bb8e[_0xe170('0x3e')]);_0x1dff14[_0xe170('0x3f')]=_[_0xe170('0x40')](_0x1dff14[_0xe170('0x3c')],_0x1dff14[_0xe170('0x3e')]);_0x43e841[_0xe170('0x41')]=_['intersection'](_0x1dff14['model'],qs['fields'](_0x44bb8e[_0xe170('0x3e')][_0xe170('0x52')]));_0x43e841[_0xe170('0x41')]=_0x43e841['attributes'][_0xe170('0x42')]?_0x43e841['attributes']:_0x1dff14[_0xe170('0x3c')];_0x43e841[_0xe170('0x45')]=qs[_0xe170('0x46')](_0x44bb8e['query']['sort']);_0x43e841[_0xe170('0x47')]=qs[_0xe170('0x3f')](_[_0xe170('0x48')](_0x44bb8e[_0xe170('0x3e')],_0x1dff14[_0xe170('0x3f')]));_0x43e841['where']=_[_0xe170('0x49')](_0x43e841[_0xe170('0x47')],{'$or':[{'ListId':_0x48cfac['id']},{'ListId':null}]});if(_0x44bb8e['query']['filter']){_0x43e841[_0xe170('0x47')]=_[_0xe170('0x49')](_0x43e841[_0xe170('0x47')],{'$or':_['map'](_0x43e841[_0xe170('0x41')],function(_0x10f337){var _0x43ad42={};_0x43ad42[_0x10f337]={'$like':'%'+_0x44bb8e[_0xe170('0x3e')][_0xe170('0x4a')]+'%'};return _0x43ad42;})});}_0x43e841=_[_0xe170('0x49')]({},_0x43e841,_0x44bb8e[_0xe170('0x53')]);return db[_0xe170('0x6e')][_0xe170('0x8d')](_0x43e841);}})[_0xe170('0x2e')](respondWithResult(_0x733470,null))[_0xe170('0x4e')](handleError(_0x733470,null));};exports[_0xe170('0x8e')]=function(_0x4ef4ef,_0x2c18c0,_0xd38fdf){return db['CmList'][_0xe170('0x54')]({'where':{'id':_0x4ef4ef[_0xe170('0x50')]['id']}})[_0xe170('0x2e')](handleEntityNotFound(_0x2c18c0,null))[_0xe170('0x2e')](function(_0x3e6052){if(_0x3e6052){return _0x3e6052['addAgents'](_0x4ef4ef[_0xe170('0x5b')][_0xe170('0x63')],_[_0xe170('0x8f')](_0x4ef4ef[_0xe170('0x5b')],[_0xe170('0x63'),'id'])||{})[_0xe170('0x90')](function(_0x5a2637){for(var _0x258e8c=0x0;_0x258e8c<_0x4ef4ef[_0xe170('0x5b')][_0xe170('0x63')][_0xe170('0x42')];_0x258e8c+=0x1){socket[_0xe170('0x91')]('userCmList:save',{'UserId':Number(_0x4ef4ef[_0xe170('0x5b')][_0xe170('0x63')][_0x258e8c]),'CmListId':Number(_0x4ef4ef['params']['id'])});}return _0x5a2637;});}})[_0xe170('0x2e')](respondWithResult(_0x2c18c0,null))['catch'](handleError(_0x2c18c0,null));};exports[_0xe170('0x92')]=function(_0x18fae3,_0xac084,_0x74c947){return db[_0xe170('0x37')]['find']({'where':{'id':_0x18fae3[_0xe170('0x50')]['id']}})[_0xe170('0x2e')](handleEntityNotFound(_0xac084,null))[_0xe170('0x2e')](function(_0x4a0505){if(_0x4a0505){return _0x4a0505[_0xe170('0x92')](_0x18fae3['query'][_0xe170('0x63')])['then'](function(){if(_[_0xe170('0x67')](_0x18fae3['query'][_0xe170('0x63')])){for(var _0x246409=0x0;_0x246409<_0x18fae3[_0xe170('0x3e')][_0xe170('0x63')][_0xe170('0x42')];_0x246409+=0x1){socket[_0xe170('0x91')](_0xe170('0x93'),{'UserId':Number(_0x18fae3[_0xe170('0x3e')]['ids'][_0x246409]),'CmListId':Number(_0x18fae3[_0xe170('0x50')]['id'])});}}else{socket[_0xe170('0x91')](_0xe170('0x93'),{'UserId':Number(_0x18fae3[_0xe170('0x3e')][_0xe170('0x63')]),'CmListId':Number(_0x18fae3[_0xe170('0x50')]['id'])});}});}})[_0xe170('0x2e')](respondWithStatusCode(_0xac084,null))[_0xe170('0x4e')](handleError(_0xac084,null));};exports[_0xe170('0x94')]=function(_0xfbab07,_0x1f751c,_0x4c6fb6){var _0x4cf7b9={};var _0x102f17={};var _0x3eb6d0;var _0x4ec0c3;return db[_0xe170('0x37')][_0xe170('0x60')]({'where':{'id':_0xfbab07[_0xe170('0x50')]['id']}})[_0xe170('0x2e')](handleEntityNotFound(_0x1f751c,null))['then'](function(_0x304301){if(_0x304301){_0x3eb6d0=_0x304301;_0x102f17['model']=_[_0xe170('0x51')](db[_0xe170('0x95')][_0xe170('0x38')]);_0x102f17['query']=_['keys'](_0xfbab07['query']);_0x102f17['filters']=_['intersection'](_0x102f17[_0xe170('0x3c')],_0x102f17[_0xe170('0x3e')]);_0x4cf7b9[_0xe170('0x41')]=_['intersection'](_0x102f17[_0xe170('0x3c')],qs['fields'](_0xfbab07[_0xe170('0x3e')]['fields']));_0x4cf7b9[_0xe170('0x41')]=_0x4cf7b9['attributes'][_0xe170('0x42')]?_0x4cf7b9[_0xe170('0x41')]:_0x102f17[_0xe170('0x3c')];_0x4cf7b9['order']=qs[_0xe170('0x46')](_0xfbab07[_0xe170('0x3e')][_0xe170('0x46')]);_0x4cf7b9[_0xe170('0x47')]=qs[_0xe170('0x3f')](_[_0xe170('0x48')](_0xfbab07[_0xe170('0x3e')],_0x102f17[_0xe170('0x3f')]));if(_0xfbab07['query'][_0xe170('0x4a')]){_0x4cf7b9['where']=_['merge'](_0x4cf7b9['where'],{'$or':_[_0xe170('0x3d')](_0x4cf7b9['attributes'],function(_0x1b1368){var _0x42d59b={};_0x42d59b[_0x1b1368]={'$like':'%'+_0xfbab07[_0xe170('0x3e')][_0xe170('0x4a')]+'%'};return _0x42d59b;})});}_0x4cf7b9=_['merge']({},_0x4cf7b9,_0xfbab07[_0xe170('0x53')]);return _0x3eb6d0[_0xe170('0x94')](_0x4cf7b9);}})['then'](function(_0x345e46){if(_0x345e46){_0x4ec0c3=_0x345e46[_0xe170('0x42')];if(!_0xfbab07['query'][_0xe170('0x43')](_0xe170('0x44'))){_0x4cf7b9[_0xe170('0x26')]=qs[_0xe170('0x26')](_0xfbab07['query']['limit']);_0x4cf7b9[_0xe170('0x24')]=qs[_0xe170('0x24')](_0xfbab07[_0xe170('0x3e')]['offset']);}return _0x3eb6d0[_0xe170('0x94')](_0x4cf7b9);}})[_0xe170('0x2e')](function(_0x459fc2){if(_0x459fc2){return _0x459fc2?{'count':_0x4ec0c3,'rows':_0x459fc2}:null;}})[_0xe170('0x2e')](respondWithResult(_0x1f751c,null))[_0xe170('0x4e')](handleError(_0x1f751c,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 049b927..c0e4188 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 _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x1fc84d,_0x3f469d){var _0x2658fa=function(_0x189ad0){while(--_0x189ad0){_0x1fc84d['push'](_0x1fc84d['shift']());}};_0x2658fa(++_0x3f469d);}(_0x5fc3,0xa8));var _0x35fc=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0x5fc3[_0x34021d];return _0x16597b;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var CmList=require(_0x35fc('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x35fc('0x2')](0x0);var events={'afterCreate':_0x35fc('0x3'),'afterUpdate':_0x35fc('0x4'),'afterDestroy':_0x35fc('0x5')};function emitEvent(_0xb4f9ce){return function(_0x5e75e6,_0x2d1404,_0x1d5fec){CmListEvents[_0x35fc('0x6')](_0xb4f9ce+':'+_0x5e75e6['id'],_0x5e75e6);CmListEvents['emit'](_0xb4f9ce,_0x5e75e6);_0x1d5fec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x35fc('0x7')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x261e29,_0x10fffd){var _0x25ef43=function(_0x21b8e7){while(--_0x21b8e7){_0x261e29['push'](_0x261e29['shift']());}};_0x25ef43(++_0x10fffd);}(_0x5fc3,0xa8));var _0x35fc=function(_0x130d82,_0x25f49b){_0x130d82=_0x130d82-0x0;var _0x112070=_0x5fc3[_0x130d82];return _0x112070;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var CmList=require(_0x35fc('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x35fc('0x2')](0x0);var events={'afterCreate':_0x35fc('0x3'),'afterUpdate':_0x35fc('0x4'),'afterDestroy':_0x35fc('0x5')};function emitEvent(_0xb4f9ce){return function(_0x5e75e6,_0x2d1404,_0x1d5fec){CmListEvents[_0x35fc('0x6')](_0xb4f9ce+':'+_0x5e75e6['id'],_0x5e75e6);CmListEvents['emit'](_0xb4f9ce,_0x5e75e6);_0x1d5fec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x35fc('0x7')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index fd5a7cd..3369ad3 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 _0x55e0=['./cmList.attributes','exports','define','cm_lists','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x55e0,0xdc));var _0x055e=function(_0x3421ac,_0x3228b5){_0x3421ac=_0x3421ac-0x0;var _0x16c2d2=_0x55e0[_0x3421ac];return _0x16c2d2;};'use strict';var _=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var logger=require(_0x055e('0x2'))(_0x055e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x055e('0x4'));var fs=require('fs');var path=require(_0x055e('0x5'));var rimraf=require(_0x055e('0x6'));var config=require(_0x055e('0x7'));var attributes=require(_0x055e('0x8'));module[_0x055e('0x9')]=function(_0x490ee1,_0x5239f6){return _0x490ee1[_0x055e('0xa')]('CmList',attributes,{'tableName':_0x055e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2ea=['cm_lists','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList'];(function(_0x12bcf7,_0xc11103){var _0x2825a=function(_0x4452ba){while(--_0x4452ba){_0x12bcf7['push'](_0x12bcf7['shift']());}};_0x2825a(++_0xc11103);}(_0xd2ea,0x15f));var _0xad2e=function(_0x331504,_0x357700){_0x331504=_0x331504-0x0;var _0x58a175=_0xd2ea[_0x331504];return _0x58a175;};'use strict';var _=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var logger=require(_0xad2e('0x2'))(_0xad2e('0x3'));var moment=require(_0xad2e('0x4'));var BPromise=require('bluebird');var rp=require(_0xad2e('0x5'));var fs=require('fs');var path=require(_0xad2e('0x6'));var rimraf=require(_0xad2e('0x7'));var config=require(_0xad2e('0x8'));var attributes=require(_0xad2e('0x9'));module[_0xad2e('0xa')]=function(_0x29e97f,_0x592e8b){return _0x29e97f[_0xad2e('0xb')](_0xad2e('0xc'),attributes,{'tableName':_0xad2e('0xd'),'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 6e6773f..0df7f54 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 _0x9641=['./cmList.socket','register','then','info','CmList,\x20%s,\x20%s','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','client','http','defaults','redis','localhost','socket.io-emitter'];(function(_0x22aadd,_0x3a0f58){var _0x54e9e9=function(_0x2f4a3e){while(--_0x2f4a3e){_0x22aadd['push'](_0x22aadd['shift']());}};_0x54e9e9(++_0x3a0f58);}(_0x9641,0x75));var _0x1964=function(_0x34204b,_0x3f91e9){_0x34204b=_0x34204b-0x0;var _0x24e995=_0x9641[_0x34204b];return _0x24e995;};'use strict';var _=require(_0x1964('0x0'));var util=require('util');var moment=require(_0x1964('0x1'));var BPromise=require(_0x1964('0x2'));var rs=require(_0x1964('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1964('0x4'))['db'];var utils=require(_0x1964('0x5'));var logger=require('../../config/logger')(_0x1964('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1964('0x7')][_0x1964('0x8')]({'port':0x232a});config['redis']=_[_0x1964('0x9')](config[_0x1964('0xa')],{'host':_0x1964('0xb'),'port':0x18eb});var socket=require(_0x1964('0xc'))(new Redis(config[_0x1964('0xa')]));require(_0x1964('0xd'))[_0x1964('0xe')](socket);function respondWithRpcPromise(_0x3f7672,_0x383d46,_0x2bb928){return new BPromise(function(_0x3a9f45,_0x161684){return client['request'](_0x3f7672,_0x2bb928)[_0x1964('0xf')](function(_0x3bc484){logger[_0x1964('0x10')](_0x1964('0x11'),_0x383d46,'request\x20sent');logger['debug'](_0x1964('0x12'),_0x383d46,_0x1964('0x13'),JSON[_0x1964('0x14')](_0x3bc484));if(_0x3bc484[_0x1964('0x15')]){if(_0x3bc484[_0x1964('0x15')][_0x1964('0x16')]===0x1f4){logger['error'](_0x1964('0x11'),_0x383d46,_0x3bc484[_0x1964('0x15')][_0x1964('0x17')]);return _0x161684(_0x3bc484[_0x1964('0x15')]['message']);}logger[_0x1964('0x15')](_0x1964('0x11'),_0x383d46,_0x3bc484['error']['message']);return _0x3a9f45(_0x3bc484['error'][_0x1964('0x17')]);}else{logger['info'](_0x1964('0x11'),_0x383d46,_0x1964('0x13'));_0x3a9f45(_0x3bc484[_0x1964('0x18')][_0x1964('0x17')]);}})[_0x1964('0x19')](function(_0x39f7d0){logger['error'](_0x1964('0x11'),_0x383d46,_0x39f7d0);_0x161684(_0x39f7d0);});});} \ No newline at end of file +var _0x1e8c=['error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','register','then','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x1e8c,0xe6));var _0xc1e8=function(_0x2af766,_0x269fdd){_0x2af766=_0x2af766-0x0;var _0x5e21a5=_0x1e8c[_0x2af766];return _0x5e21a5;};'use strict';var _=require(_0xc1e8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc1e8('0x1'));var rs=require(_0xc1e8('0x2'));var fs=require('fs');var Redis=require(_0xc1e8('0x3'));var db=require(_0xc1e8('0x4'))['db'];var utils=require(_0xc1e8('0x5'));var logger=require('../../config/logger')(_0xc1e8('0x6'));var config=require(_0xc1e8('0x7'));var jayson=require(_0xc1e8('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xc1e8('0x9')]=_[_0xc1e8('0xa')](config['redis'],{'host':_0xc1e8('0xb'),'port':0x18eb});var socket=require(_0xc1e8('0xc'))(new Redis(config[_0xc1e8('0x9')]));require('./cmList.socket')[_0xc1e8('0xd')](socket);function respondWithRpcPromise(_0x4ccc65,_0x13194f,_0x1da789){return new BPromise(function(_0x33db6c,_0x263600){return client['request'](_0x4ccc65,_0x1da789)[_0xc1e8('0xe')](function(_0x57140f){logger['info'](_0xc1e8('0xf'),_0x13194f,_0xc1e8('0x10'));logger[_0xc1e8('0x11')](_0xc1e8('0x12'),_0x13194f,_0xc1e8('0x10'),JSON[_0xc1e8('0x13')](_0x57140f));if(_0x57140f[_0xc1e8('0x14')]){if(_0x57140f[_0xc1e8('0x14')][_0xc1e8('0x15')]===0x1f4){logger[_0xc1e8('0x14')]('CmList,\x20%s,\x20%s',_0x13194f,_0x57140f[_0xc1e8('0x14')][_0xc1e8('0x16')]);return _0x263600(_0x57140f['error'][_0xc1e8('0x16')]);}logger[_0xc1e8('0x14')](_0xc1e8('0xf'),_0x13194f,_0x57140f['error'][_0xc1e8('0x16')]);return _0x33db6c(_0x57140f[_0xc1e8('0x14')][_0xc1e8('0x16')]);}else{logger['info'](_0xc1e8('0xf'),_0x13194f,'request\x20sent');_0x33db6c(_0x57140f[_0xc1e8('0x17')][_0xc1e8('0x16')]);}})[_0xc1e8('0x18')](function(_0xfb481b){logger[_0xc1e8('0x14')](_0xc1e8('0xf'),_0x13194f,_0xfb481b);_0x263600(_0xfb481b);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index b109976..ffa2b3c 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 _0x386c=['register','length','cmList:','./cmList.events','remove','update','emit','removeListener'];(function(_0x244857,_0x549d34){var _0xdfbd3c=function(_0x2dd2b3){while(--_0x2dd2b3){_0x244857['push'](_0x244857['shift']());}};_0xdfbd3c(++_0x549d34);}(_0x386c,0x1bb));var _0xc386=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x386c[_0x178e48];return _0x440d7e;};'use strict';var CmListEvents=require(_0xc386('0x0'));var events=['save',_0xc386('0x1'),_0xc386('0x2')];function createListener(_0x3e892e,_0x1a0690){return function(_0xb681fd){_0x1a0690[_0xc386('0x3')](_0x3e892e,_0xb681fd);};}function removeListener(_0x1047d2,_0x53cbbf){return function(){CmListEvents[_0xc386('0x4')](_0x1047d2,_0x53cbbf);};}exports[_0xc386('0x5')]=function(_0xe622d6){for(var _0x44bd02=0x0,_0x3fca5e=events[_0xc386('0x6')];_0x44bd02<_0x3fca5e;_0x44bd02++){var _0x457e33=events[_0x44bd02];var _0x542e60=createListener(_0xc386('0x7')+_0x457e33,_0xe622d6);CmListEvents['on'](_0x457e33,_0x542e60);}}; \ No newline at end of file +var _0x3f04=['./cmList.events','save','update','register','length'];(function(_0x334570,_0x23d405){var _0x45c6dc=function(_0x79e778){while(--_0x79e778){_0x334570['push'](_0x334570['shift']());}};_0x45c6dc(++_0x23d405);}(_0x3f04,0x1a9));var _0x43f0=function(_0x15d21f,_0x10997d){_0x15d21f=_0x15d21f-0x0;var _0x50b48d=_0x3f04[_0x15d21f];return _0x50b48d;};'use strict';var CmListEvents=require(_0x43f0('0x0'));var events=[_0x43f0('0x1'),'remove',_0x43f0('0x2')];function createListener(_0x4623d5,_0x10617e){return function(_0x55650a){_0x10617e['emit'](_0x4623d5,_0x55650a);};}function removeListener(_0x4a7ea9,_0x55ec57){return function(){CmListEvents['removeListener'](_0x4a7ea9,_0x55ec57);};}exports[_0x43f0('0x3')]=function(_0x3b82c){for(var _0x7ad44=0x0,_0x43356a=events[_0x43f0('0x4')];_0x7ad44<_0x43356a;_0x7ad44++){var _0x39a648=events[_0x7ad44];var _0x142353=createListener('cmList:'+_0x39a648,_0x3b82c);CmListEvents['on'](_0x39a648,_0x142353);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index a808975..e69d408 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 _0x688c=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','getAgents','post','create','addDisposition','/:id/contacts','addContacts','addCustomField','/:id/users','addAgents','delete','multer'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x688c,0xa9));var _0xc688=function(_0x6dba45,_0xf92d0a){_0x6dba45=_0x6dba45-0x0;var _0xbe9f78=_0x688c[_0x6dba45];return _0xbe9f78;};'use strict';var multer=require(_0xc688('0x0'));var util=require('util');var path=require(_0xc688('0x1'));var timeout=require(_0xc688('0x2'));var express=require(_0xc688('0x3'));var router=express[_0xc688('0x4')]();var fs_extra=require(_0xc688('0x5'));var auth=require(_0xc688('0x6'));var interaction=require(_0xc688('0x7'));var config=require(_0xc688('0x8'));var controller=require(_0xc688('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xc688('0xa')]);router[_0xc688('0xb')](_0xc688('0xc'),auth[_0xc688('0xd')](),controller[_0xc688('0xe')]);router[_0xc688('0xb')](_0xc688('0xf'),auth[_0xc688('0xd')](),controller[_0xc688('0x10')]);router[_0xc688('0xb')](_0xc688('0x11'),auth[_0xc688('0xd')](),controller[_0xc688('0x12')]);router[_0xc688('0xb')]('/:id/contacts',auth[_0xc688('0xd')](),controller[_0xc688('0x13')]);router['get'](_0xc688('0x14'),auth[_0xc688('0xd')](),controller[_0xc688('0x15')]);router[_0xc688('0xb')](_0xc688('0x16'),auth[_0xc688('0xd')](),controller[_0xc688('0x17')]);router[_0xc688('0xb')]('/:id/users',auth['isAuthenticated'](),controller[_0xc688('0x18')]);router[_0xc688('0x19')]('/',auth['isAuthenticated'](),controller[_0xc688('0x1a')]);router[_0xc688('0x19')]('/:id/dispositions',auth[_0xc688('0xd')](),controller[_0xc688('0x1b')]);router[_0xc688('0x19')](_0xc688('0x1c'),auth[_0xc688('0xd')](),controller[_0xc688('0x1d')]);router[_0xc688('0x19')](_0xc688('0x16'),auth[_0xc688('0xd')](),controller[_0xc688('0x1e')]);router[_0xc688('0x19')](_0xc688('0x1f'),auth[_0xc688('0xd')](),controller[_0xc688('0x20')]);router['put'](_0xc688('0xf'),auth[_0xc688('0xd')](),controller['update']);router['delete'](_0xc688('0xf'),auth[_0xc688('0xd')](),controller['destroy']);router['delete'](_0xc688('0x11'),auth[_0xc688('0xd')](),controller['removeDispositions']);router[_0xc688('0x21')](_0xc688('0x1f'),auth[_0xc688('0xd')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x6c2e=['/:id/contacts/csv','/:id/fields','getCustomFields','/:id/users','getAgents','create','post','addDisposition','addContacts','addCustomField','addAgents','put','update','delete','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','getDispositions','/:id/contacts'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6c2e,0x118));var _0xe6c2=function(_0x334a3c,_0x47172c){_0x334a3c=_0x334a3c-0x0;var _0x545eb0=_0x6c2e[_0x334a3c];return _0x545eb0;};'use strict';var multer=require('multer');var util=require(_0xe6c2('0x0'));var path=require(_0xe6c2('0x1'));var timeout=require(_0xe6c2('0x2'));var express=require(_0xe6c2('0x3'));var router=express[_0xe6c2('0x4')]();var fs_extra=require(_0xe6c2('0x5'));var auth=require(_0xe6c2('0x6'));var interaction=require(_0xe6c2('0x7'));var config=require('../../config/environment');var controller=require('./cmList.controller');router[_0xe6c2('0x8')]('/',auth[_0xe6c2('0x9')](),controller[_0xe6c2('0xa')]);router[_0xe6c2('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xe6c2('0xb')]);router[_0xe6c2('0x8')](_0xe6c2('0xc'),auth[_0xe6c2('0x9')](),controller[_0xe6c2('0xd')]);router[_0xe6c2('0x8')](_0xe6c2('0xe'),auth[_0xe6c2('0x9')](),controller[_0xe6c2('0xf')]);router[_0xe6c2('0x8')](_0xe6c2('0x10'),auth[_0xe6c2('0x9')](),controller['getContacts']);router[_0xe6c2('0x8')](_0xe6c2('0x11'),auth[_0xe6c2('0x9')](),controller['getContactsCsv']);router['get'](_0xe6c2('0x12'),auth['isAuthenticated'](),controller[_0xe6c2('0x13')]);router[_0xe6c2('0x8')](_0xe6c2('0x14'),auth[_0xe6c2('0x9')](),controller[_0xe6c2('0x15')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe6c2('0x16')]);router[_0xe6c2('0x17')](_0xe6c2('0xe'),auth[_0xe6c2('0x9')](),controller[_0xe6c2('0x18')]);router[_0xe6c2('0x17')](_0xe6c2('0x10'),auth['isAuthenticated'](),controller[_0xe6c2('0x19')]);router[_0xe6c2('0x17')]('/:id/fields',auth['isAuthenticated'](),controller[_0xe6c2('0x1a')]);router[_0xe6c2('0x17')](_0xe6c2('0x14'),auth[_0xe6c2('0x9')](),controller[_0xe6c2('0x1b')]);router[_0xe6c2('0x1c')](_0xe6c2('0xc'),auth['isAuthenticated'](),controller[_0xe6c2('0x1d')]);router[_0xe6c2('0x1e')](_0xe6c2('0xc'),auth[_0xe6c2('0x9')](),controller['destroy']);router[_0xe6c2('0x1e')](_0xe6c2('0xe'),auth[_0xe6c2('0x9')](),controller['removeDispositions']);router[_0xe6c2('0x1e')](_0xe6c2('0x14'),auth['isAuthenticated'](),controller[_0xe6c2('0x1f')]);module[_0xe6c2('0x20')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 1498f69..2425da5 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 _0x223e=['VIRTUAL','getDataValue','STRING','sequelize','exports'];(function(_0x3b5bee,_0x5aa74d){var _0x486d58=function(_0x8ab1f7){while(--_0x8ab1f7){_0x3b5bee['push'](_0x3b5bee['shift']());}};_0x486d58(++_0x5aa74d);}(_0x223e,0x1cf));var _0xe223=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0x223e[_0x42f009];return _0x22a1e0;};'use strict';var Sequelize=require(_0xe223('0x0'));module[_0xe223('0x1')]={'name':{'type':Sequelize[_0xe223('0x2')],'get':function(_0x33022){return this[_0xe223('0x3')]('field');}},'field':{'type':Sequelize[_0xe223('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0xe223('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0xe223('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x4551=['VIRTUAL','getDataValue','field','STRING','sequelize'];(function(_0x1cd3e3,_0xbeb106){var _0x4a3336=function(_0x2a385d){while(--_0x2a385d){_0x1cd3e3['push'](_0x1cd3e3['shift']());}};_0x4a3336(++_0xbeb106);}(_0x4551,0x1a8));var _0x1455=function(_0x46b5dd,_0xc5fc66){_0x46b5dd=_0x46b5dd-0x0;var _0xfee1cd=_0x4551[_0x46b5dd];return _0xfee1cd;};'use strict';var Sequelize=require(_0x1455('0x0'));module['exports']={'name':{'type':Sequelize[_0x1455('0x1')],'get':function(_0x224ab2){return this[_0x1455('0x2')](_0x1455('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x1455('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x1455('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 817e157..b94b488 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(_0x10159d,_0x4ca01f){var _0x586ae1=function(_0x564b1e){while(--_0x564b1e){_0x10159d['push'](_0x10159d['shift']());}};_0x586ae1(++_0x4ca01f);}(_0x7a54,0x106));var _0x47a5=function(_0x220b9e,_0x46bf44){_0x220b9e=_0x220b9e-0x0;var _0x5d9e73=_0x7a54[_0x220b9e];return _0x5d9e73;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x58c07c,_0x6f8bd2){var _0x54c32e=function(_0x4d60e3){while(--_0x4d60e3){_0x58c07c['push'](_0x58c07c['shift']());}};_0x54c32e(++_0x6f8bd2);}(_0x7a54,0x106));var _0x47a5=function(_0x448994,_0x2654ad){_0x448994=_0x448994-0x0;var _0x4948f8=_0x7a54[_0x448994];return _0x4948f8;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 0f2123f..1fcff43 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 _0x7897=['path','rimraf','../../config/environment','./condition.attributes','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x4826b7,_0x28aa1d){var _0xe07c3f=function(_0x5971d1){while(--_0x5971d1){_0x4826b7['push'](_0x4826b7['shift']());}};_0xe07c3f(++_0x28aa1d);}(_0x7897,0xae));var _0x7789=function(_0x2ae640,_0x182f3d){_0x2ae640=_0x2ae640-0x0;var _0x2f80d7=_0x7897[_0x2ae640];return _0x2f80d7;};'use strict';var _=require(_0x7789('0x0'));var util=require(_0x7789('0x1'));var logger=require(_0x7789('0x2'))('api');var moment=require(_0x7789('0x3'));var BPromise=require(_0x7789('0x4'));var rp=require(_0x7789('0x5'));var fs=require('fs');var path=require(_0x7789('0x6'));var rimraf=require(_0x7789('0x7'));var config=require(_0x7789('0x8'));var attributes=require(_0x7789('0x9'));module['exports']=function(_0x38435e,_0x152cd1){return _0x38435e['define']('Condition',attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1dbf=['define','Condition','tools_conditions','util','../../config/logger','api','moment','bluebird','../../config/environment','./condition.attributes','exports'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0x1dbf,0x184));var _0xf1db=function(_0x4480b9,_0x5c2949){_0x4480b9=_0x4480b9-0x0;var _0x3f0f02=_0x1dbf[_0x4480b9];return _0x3f0f02;};'use strict';var _=require('lodash');var util=require(_0xf1db('0x0'));var logger=require(_0xf1db('0x1'))(_0xf1db('0x2'));var moment=require(_0xf1db('0x3'));var BPromise=require(_0xf1db('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf1db('0x5'));var attributes=require(_0xf1db('0x6'));module[_0xf1db('0x7')]=function(_0x27a4bc,_0x48e630){return _0x27a4bc[_0xf1db('0x8')](_0xf1db('0x9'),attributes,{'tableName':_0xf1db('0xa'),'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 aa80a5d..9e0736a 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 _0xb2f5=['error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x25e88e,_0x1fbcd4){var _0xeead36=function(_0x16ab8f){while(--_0x16ab8f){_0x25e88e['push'](_0x25e88e['shift']());}};_0xeead36(++_0x1fbcd4);}(_0xb2f5,0x7c));var _0x5b2f=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0xb2f5[_0x1762b4];return _0x29beda;};'use strict';var _=require(_0x5b2f('0x0'));var util=require(_0x5b2f('0x1'));var moment=require(_0x5b2f('0x2'));var BPromise=require(_0x5b2f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5b2f('0x4'));var db=require(_0x5b2f('0x5'))['db'];var utils=require(_0x5b2f('0x6'));var logger=require(_0x5b2f('0x7'))(_0x5b2f('0x8'));var config=require(_0x5b2f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5b2f('0xa')][_0x5b2f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4dd7eb,_0xedd2f5,_0x5cc6ca){return new BPromise(function(_0x546c7d,_0x9ccd93){return client[_0x5b2f('0xc')](_0x4dd7eb,_0x5cc6ca)[_0x5b2f('0xd')](function(_0x4f261a){logger[_0x5b2f('0xe')](_0x5b2f('0xf'),_0xedd2f5,'request\x20sent');logger[_0x5b2f('0x10')](_0x5b2f('0x11'),_0xedd2f5,_0x5b2f('0x12'),JSON[_0x5b2f('0x13')](_0x4f261a));if(_0x4f261a[_0x5b2f('0x14')]){if(_0x4f261a[_0x5b2f('0x14')][_0x5b2f('0x15')]===0x1f4){logger['error'](_0x5b2f('0xf'),_0xedd2f5,_0x4f261a[_0x5b2f('0x14')][_0x5b2f('0x16')]);return _0x9ccd93(_0x4f261a[_0x5b2f('0x14')][_0x5b2f('0x16')]);}logger[_0x5b2f('0x14')](_0x5b2f('0xf'),_0xedd2f5,_0x4f261a[_0x5b2f('0x14')][_0x5b2f('0x16')]);return _0x546c7d(_0x4f261a[_0x5b2f('0x14')][_0x5b2f('0x16')]);}else{logger[_0x5b2f('0xe')]('Condition,\x20%s,\x20%s',_0xedd2f5,_0x5b2f('0x12'));_0x546c7d(_0x4f261a[_0x5b2f('0x17')][_0x5b2f('0x16')]);}})['catch'](function(_0xf6a0c0){logger[_0x5b2f('0x14')](_0x5b2f('0xf'),_0xedd2f5,_0xf6a0c0);_0x9ccd93(_0xf6a0c0);});});} \ No newline at end of file +var _0x5512=['request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','error','code','Condition,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info'];(function(_0x2cc9a3,_0x3a9a50){var _0x8bae7f=function(_0x130a6a){while(--_0x130a6a){_0x2cc9a3['push'](_0x2cc9a3['shift']());}};_0x8bae7f(++_0x3a9a50);}(_0x5512,0x8d));var _0x2551=function(_0x5f1bc6,_0x5a18c1){_0x5f1bc6=_0x5f1bc6-0x0;var _0x255326=_0x5512[_0x5f1bc6];return _0x255326;};'use strict';var _=require(_0x2551('0x0'));var util=require(_0x2551('0x1'));var moment=require(_0x2551('0x2'));var BPromise=require(_0x2551('0x3'));var rs=require(_0x2551('0x4'));var fs=require('fs');var Redis=require(_0x2551('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2551('0x6'));var logger=require('../../config/logger')(_0x2551('0x7'));var config=require(_0x2551('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2551('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26b584,_0x1ed312,_0x4fa3ed){return new BPromise(function(_0x10e7c9,_0x4852ca){return client[_0x2551('0xa')](_0x26b584,_0x4fa3ed)[_0x2551('0xb')](function(_0x56f07f){logger[_0x2551('0xc')]('Condition,\x20%s,\x20%s',_0x1ed312,_0x2551('0xd'));logger[_0x2551('0xe')](_0x2551('0xf'),_0x1ed312,_0x2551('0xd'),JSON['stringify'](_0x56f07f));if(_0x56f07f[_0x2551('0x10')]){if(_0x56f07f['error'][_0x2551('0x11')]===0x1f4){logger['error'](_0x2551('0x12'),_0x1ed312,_0x56f07f[_0x2551('0x10')]['message']);return _0x4852ca(_0x56f07f[_0x2551('0x10')][_0x2551('0x13')]);}logger[_0x2551('0x10')](_0x2551('0x12'),_0x1ed312,_0x56f07f['error'][_0x2551('0x13')]);return _0x10e7c9(_0x56f07f[_0x2551('0x10')][_0x2551('0x13')]);}else{logger[_0x2551('0xc')]('Condition,\x20%s,\x20%s',_0x1ed312,_0x2551('0xd'));_0x10e7c9(_0x56f07f[_0x2551('0x14')][_0x2551('0x13')]);}})[_0x2551('0x15')](function(_0x4eed2b){logger['error'](_0x2551('0x12'),_0x1ed312,_0x4eed2b);_0x4852ca(_0x4eed2b);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 029efb5..ac423ea 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 _0x21a0=['delete','destroy','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','./condition.controller','put','/:id','isAuthenticated','update'];(function(_0x3578aa,_0x28f55a){var _0x2f267f=function(_0x52b9c8){while(--_0x52b9c8){_0x3578aa['push'](_0x3578aa['shift']());}};_0x2f267f(++_0x28f55a);}(_0x21a0,0x84));var _0x021a=function(_0x42506c,_0x2a1044){_0x42506c=_0x42506c-0x0;var _0x5c9464=_0x21a0[_0x42506c];return _0x5c9464;};'use strict';var multer=require(_0x021a('0x0'));var util=require(_0x021a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x021a('0x2'));var router=express[_0x021a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x021a('0x4'));var interaction=require(_0x021a('0x5'));var config=require('../../config/environment');var controller=require(_0x021a('0x6'));router[_0x021a('0x7')](_0x021a('0x8'),auth[_0x021a('0x9')](),controller[_0x021a('0xa')]);router[_0x021a('0xb')](_0x021a('0x8'),auth[_0x021a('0x9')](),controller[_0x021a('0xc')]);module['exports']=router; \ No newline at end of file +var _0x33a4=['../../components/interaction/service','put','isAuthenticated','update','delete','/:id','destroy','exports','path','express','fs-extra','../../components/auth/service'];(function(_0x647e01,_0x528f65){var _0x333219=function(_0x21ff7b){while(--_0x21ff7b){_0x647e01['push'](_0x647e01['shift']());}};_0x333219(++_0x528f65);}(_0x33a4,0x1c4));var _0x433a=function(_0x159bba,_0x21da9e){_0x159bba=_0x159bba-0x0;var _0x243124=_0x33a4[_0x159bba];return _0x243124;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x433a('0x0'));var timeout=require('connect-timeout');var express=require(_0x433a('0x1'));var router=express['Router']();var fs_extra=require(_0x433a('0x2'));var auth=require(_0x433a('0x3'));var interaction=require(_0x433a('0x4'));var config=require('../../config/environment');var controller=require('./condition.controller');router[_0x433a('0x5')]('/:id',auth[_0x433a('0x6')](),controller[_0x433a('0x7')]);router[_0x433a('0x8')](_0x433a('0x9'),auth[_0x433a('0x6')](),controller[_0x433a('0xa')]);module[_0x433a('0xb')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 981bb02..8bb3536 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdfd4=['INTEGER','sequelize','exports','STRING'];(function(_0x4f96ec,_0x203eec){var _0x52f867=function(_0x504b5b){while(--_0x504b5b){_0x4f96ec['push'](_0x4f96ec['shift']());}};_0x52f867(++_0x203eec);}(_0xdfd4,0x1ad));var _0x4dfd=function(_0x2fc764,_0x24d9f1){_0x2fc764=_0x2fc764-0x0;var _0x265ead=_0xdfd4[_0x2fc764];return _0x265ead;};'use strict';var Sequelize=require(_0x4dfd('0x0'));module[_0x4dfd('0x1')]={'name':{'type':Sequelize[_0x4dfd('0x2')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0x4dfd('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x4dfd('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xaf65=['exports','STRING','name','INTEGER'];(function(_0x84670f,_0x78aaf9){var _0x4fec06=function(_0x2eb3df){while(--_0x2eb3df){_0x84670f['push'](_0x84670f['shift']());}};_0x4fec06(++_0x78aaf9);}(_0xaf65,0x15c));var _0x5af6=function(_0x1f2f28,_0x1a90ed){_0x1f2f28=_0x1f2f28-0x0;var _0x453a24=_0xaf65[_0x1f2f28];return _0x453a24;};'use strict';var Sequelize=require('sequelize');module[_0x5af6('0x0')]={'name':{'type':Sequelize[_0x5af6('0x1')],'allowNull':![],'unique':_0x5af6('0x2')},'OrderBy':{'type':Sequelize[_0x5af6('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x5af6('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index c163bd7..3943c41 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3bea=['error','stack','name','send','index','map','ContactItemType','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','then','get','ContactItemTypes'];(function(_0x337581,_0x32f492){var _0x1623a8=function(_0x58f463){while(--_0x58f463){_0x337581['push'](_0x337581['shift']());}};_0x1623a8(++_0x32f492);}(_0x3bea,0x11d));var _0xa3be=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x3bea[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require(_0xa3be('0x0'));var rimraf=require(_0xa3be('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa3be('0x2'));var rp=require(_0xa3be('0x3'));var moment=require('moment');var BPromise=require(_0xa3be('0x4'));var Mustache=require('mustache');var util=require(_0xa3be('0x5'));var path=require(_0xa3be('0x6'));var sox=require(_0xa3be('0x7'));var csv=require(_0xa3be('0x8'));var ejs=require(_0xa3be('0x9'));var fs=require('fs');var fs_extra=require(_0xa3be('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa3be('0x8'));var querystring=require(_0xa3be('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa3be('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa3be('0xd'));var logger=require(_0xa3be('0xe'))(_0xa3be('0xf'));var utils=require(_0xa3be('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa3be('0x11'))['db'];function respondWithStatusCode(_0x4c12d1,_0x15eeca){_0x15eeca=_0x15eeca||0xcc;return function(_0x4a5393){if(_0x4a5393){return _0x4c12d1[_0xa3be('0x12')](_0x15eeca);}return _0x4c12d1[_0xa3be('0x13')](_0x15eeca)[_0xa3be('0x14')]();};}function respondWithResult(_0xe59873,_0x276ad8){_0x276ad8=_0x276ad8||0xc8;return function(_0xf9bbd5){if(_0xf9bbd5){return _0xe59873[_0xa3be('0x13')](_0x276ad8)[_0xa3be('0x15')](_0xf9bbd5);}};}function respondWithFilteredResult(_0x25d44f,_0x129e1f){return function(_0x4b9a2f){if(_0x4b9a2f){var _0x5e9f76=typeof _0x129e1f[_0xa3be('0x16')]===_0xa3be('0x17')&&typeof _0x129e1f['limit']===_0xa3be('0x17');var _0x268dfc=_0x4b9a2f[_0xa3be('0x18')];var _0x125c15=_0x5e9f76?0x0:_0x129e1f[_0xa3be('0x16')];var _0x44e059=_0x5e9f76?_0x4b9a2f[_0xa3be('0x18')]:_0x129e1f[_0xa3be('0x16')]+_0x129e1f[_0xa3be('0x19')];var _0x23b893;if(_0x44e059>=_0x268dfc){_0x44e059=_0x268dfc;_0x23b893=0xc8;}else{_0x23b893=0xce;}_0x25d44f['status'](_0x23b893);return _0x25d44f[_0xa3be('0x1a')](_0xa3be('0x1b'),_0x125c15+'-'+_0x44e059+'/'+_0x268dfc)['json'](_0x4b9a2f);}return null;};}function patchUpdates(_0x50fac1){return function(_0x2d83c3){try{jsonpatch['apply'](_0x2d83c3,_0x50fac1,!![]);}catch(_0x435e72){return BPromise[_0xa3be('0x1c')](_0x435e72);}return _0x2d83c3[_0xa3be('0x1d')]();};}function saveUpdates(_0x31b532,_0x1284a2){return function(_0x1a38db){if(_0x1a38db){return _0x1a38db[_0xa3be('0x1e')](_0x31b532)['then'](function(_0x3b741){return _0x3b741;});}return null;};}function removeEntity(_0x3842fe,_0x5ab206){return function(_0x4ba945){if(_0x4ba945){return _0x4ba945[_0xa3be('0x1f')]()[_0xa3be('0x20')](function(){var _0x242237=_0x4ba945[_0xa3be('0x21')]({'plain':!![]});var _0x1d5c42=_0xa3be('0x22');return db['UserProfileResource']['destroy']({'where':{'type':_0x1d5c42,'resourceId':_0x242237['id']}})[_0xa3be('0x20')](function(){return _0x4ba945;});})[_0xa3be('0x20')](function(){_0x3842fe[_0xa3be('0x13')](0xcc)[_0xa3be('0x14')]();});}};}function handleEntityNotFound(_0x3f5b07,_0x25af84){return function(_0x123834){if(!_0x123834){_0x3f5b07['sendStatus'](0x194);}return _0x123834;};}function handleError(_0x206e97,_0x512fff){_0x512fff=_0x512fff||0x1f4;return function(_0x193f62){logger[_0xa3be('0x23')](_0x193f62[_0xa3be('0x24')]);if(_0x193f62[_0xa3be('0x25')]){delete _0x193f62[_0xa3be('0x25')];}_0x206e97[_0xa3be('0x13')](_0x512fff)[_0xa3be('0x26')](_0x193f62);};}exports[_0xa3be('0x27')]=function(_0x2483ba,_0x376b54){var _0x15fb72={},_0x56ed08={},_0x507447={'count':0x0,'rows':[]};var _0x30b721=_[_0xa3be('0x28')](db[_0xa3be('0x29')]['rawAttributes'],function(_0x973f8){return{'name':_0x973f8[_0xa3be('0x2a')],'type':_0x973f8[_0xa3be('0x2b')][_0xa3be('0x2c')]};});_0x56ed08[_0xa3be('0x2d')]=_['map'](_0x30b721,'name');_0x56ed08[_0xa3be('0x2e')]=_[_0xa3be('0x2f')](_0x2483ba['query']);_0x56ed08['filters']=_['intersection'](_0x56ed08[_0xa3be('0x2d')],_0x56ed08[_0xa3be('0x2e')]);_0x15fb72['attributes']=_[_0xa3be('0x30')](_0x56ed08[_0xa3be('0x2d')],qs[_0xa3be('0x31')](_0x2483ba['query'][_0xa3be('0x31')]));_0x15fb72[_0xa3be('0x32')]=_0x15fb72[_0xa3be('0x32')][_0xa3be('0x33')]?_0x15fb72[_0xa3be('0x32')]:_0x56ed08['model'];if(!_0x2483ba[_0xa3be('0x2e')][_0xa3be('0x34')](_0xa3be('0x35'))){_0x15fb72[_0xa3be('0x19')]=qs[_0xa3be('0x19')](_0x2483ba[_0xa3be('0x2e')][_0xa3be('0x19')]);_0x15fb72[_0xa3be('0x16')]=qs[_0xa3be('0x16')](_0x2483ba[_0xa3be('0x2e')][_0xa3be('0x16')]);}_0x15fb72[_0xa3be('0x36')]=qs[_0xa3be('0x37')](_0x2483ba[_0xa3be('0x2e')]['sort']);_0x15fb72[_0xa3be('0x38')]=qs[_0xa3be('0x39')](_[_0xa3be('0x3a')](_0x2483ba[_0xa3be('0x2e')],_0x56ed08[_0xa3be('0x39')]),_0x30b721);if(_0x2483ba[_0xa3be('0x2e')][_0xa3be('0x3b')]){_0x15fb72[_0xa3be('0x38')]=_[_0xa3be('0x3c')](_0x15fb72[_0xa3be('0x38')],{'$or':_[_0xa3be('0x28')](_0x30b721,function(_0x4cfc7d){if(_0x4cfc7d[_0xa3be('0x2b')]!==_0xa3be('0x3d')){var _0x26dfd4={};_0x26dfd4[_0x4cfc7d['name']]={'$like':'%'+_0x2483ba[_0xa3be('0x2e')][_0xa3be('0x3b')]+'%'};return _0x26dfd4;}})});}_0x15fb72=_[_0xa3be('0x3c')]({},_0x15fb72,_0x2483ba[_0xa3be('0x3e')]);var _0x6cef44={'where':_0x15fb72[_0xa3be('0x38')]};return db['ContactItemType'][_0xa3be('0x18')](_0x6cef44)[_0xa3be('0x20')](function(_0x483f66){_0x507447[_0xa3be('0x18')]=_0x483f66;if(_0x2483ba['query'][_0xa3be('0x3f')]){_0x15fb72[_0xa3be('0x40')]=[{'all':!![]}];}return db['ContactItemType'][_0xa3be('0x41')](_0x15fb72);})[_0xa3be('0x20')](function(_0x15e122){_0x507447[_0xa3be('0x42')]=_0x15e122;return _0x507447;})['then'](respondWithFilteredResult(_0x376b54,_0x15fb72))[_0xa3be('0x43')](handleError(_0x376b54,null));};exports[_0xa3be('0x44')]=function(_0x3d744b,_0x1d60bd){var _0xadc2a9={'raw':!![],'where':{'id':_0x3d744b[_0xa3be('0x45')]['id']}},_0x138011={};_0x138011[_0xa3be('0x2d')]=_[_0xa3be('0x2f')](db['ContactItemType'][_0xa3be('0x46')]);_0x138011['query']=_[_0xa3be('0x2f')](_0x3d744b[_0xa3be('0x2e')]);_0x138011[_0xa3be('0x39')]=_['intersection'](_0x138011['model'],_0x138011[_0xa3be('0x2e')]);_0xadc2a9[_0xa3be('0x32')]=_[_0xa3be('0x30')](_0x138011[_0xa3be('0x2d')],qs[_0xa3be('0x31')](_0x3d744b[_0xa3be('0x2e')]['fields']));_0xadc2a9['attributes']=_0xadc2a9[_0xa3be('0x32')]['length']?_0xadc2a9[_0xa3be('0x32')]:_0x138011[_0xa3be('0x2d')];if(_0x3d744b[_0xa3be('0x2e')][_0xa3be('0x3f')]){_0xadc2a9['include']=[{'all':!![]}];}_0xadc2a9=_[_0xa3be('0x3c')]({},_0xadc2a9,_0x3d744b[_0xa3be('0x3e')]);return db[_0xa3be('0x29')]['find'](_0xadc2a9)[_0xa3be('0x20')](handleEntityNotFound(_0x1d60bd,null))[_0xa3be('0x20')](respondWithResult(_0x1d60bd,null))['catch'](handleError(_0x1d60bd,null));};exports['create']=function(_0x2bc8a7,_0x4c4779){return db[_0xa3be('0x29')][_0xa3be('0x47')](_0x2bc8a7[_0xa3be('0x48')],{})[_0xa3be('0x20')](function(_0x1f1031){var _0x5ade5d=_0x2bc8a7[_0xa3be('0x49')][_0xa3be('0x21')]({'plain':!![]});if(!_0x5ade5d)throw new Error(_0xa3be('0x4a'));if(_0x5ade5d[_0xa3be('0x4b')]==='user'){var _0x27c945=_0x1f1031[_0xa3be('0x21')]({'plain':!![]});var _0x2b97ad=_0xa3be('0x22');return db[_0xa3be('0x4c')]['find']({'where':{'name':_0x2b97ad,'userProfileId':_0x5ade5d[_0xa3be('0x4d')]},'raw':!![]})[_0xa3be('0x20')](function(_0x52341f){if(_0x52341f&&_0x52341f['autoAssociation']===0x0){return db['UserProfileResource'][_0xa3be('0x47')]({'name':_0x27c945['name'],'resourceId':_0x27c945['id'],'type':_0x52341f[_0xa3be('0x25')],'sectionId':_0x52341f['id']},{})[_0xa3be('0x20')](function(){return _0x1f1031;});}else{return _0x1f1031;}})['catch'](function(_0x200b0c){logger['error'](_0xa3be('0x4e'),_0x200b0c);throw _0x200b0c;});}return _0x1f1031;})[_0xa3be('0x20')](respondWithResult(_0x4c4779,0xc9))[_0xa3be('0x43')](handleError(_0x4c4779,null));};exports[_0xa3be('0x1e')]=function(_0x364dd7,_0x521021){if(_0x364dd7[_0xa3be('0x48')]['id']){delete _0x364dd7[_0xa3be('0x48')]['id'];}return db[_0xa3be('0x29')][_0xa3be('0x4f')]({'where':{'id':_0x364dd7['params']['id']}})['then'](handleEntityNotFound(_0x521021,null))[_0xa3be('0x20')](saveUpdates(_0x364dd7[_0xa3be('0x48')],null))['then'](respondWithResult(_0x521021,null))[_0xa3be('0x43')](handleError(_0x521021,null));};exports['destroy']=function(_0x1bed1c,_0x2c76e8){return db['ContactItemType'][_0xa3be('0x4f')]({'where':{'id':_0x1bed1c['params']['id']}})[_0xa3be('0x20')](handleEntityNotFound(_0x2c76e8,null))[_0xa3be('0x20')](removeEntity(_0x2c76e8,null))['catch'](handleError(_0x2c76e8,null));}; \ No newline at end of file +var _0x78f1=['apply','reject','save','update','then','destroy','get','ContactItemTypes','UserProfileResource','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ContactItemType','includeAll','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json'];(function(_0x48d272,_0x155ea3){var _0x5042a1=function(_0x548d20){while(--_0x548d20){_0x48d272['push'](_0x48d272['shift']());}};_0x5042a1(++_0x155ea3);}(_0x78f1,0x1d6));var _0x178f=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x78f1[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x178f('0x0'));var zipdir=require(_0x178f('0x1'));var jsonpatch=require(_0x178f('0x2'));var rp=require('request-promise');var moment=require(_0x178f('0x3'));var BPromise=require(_0x178f('0x4'));var Mustache=require('mustache');var util=require(_0x178f('0x5'));var path=require('path');var sox=require(_0x178f('0x6'));var csv=require(_0x178f('0x7'));var ejs=require(_0x178f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x178f('0x9'));var squel=require(_0x178f('0xa'));var crypto=require(_0x178f('0xb'));var jsforce=require(_0x178f('0xc'));var deskjs=require(_0x178f('0xd'));var toCsv=require(_0x178f('0x7'));var querystring=require(_0x178f('0xe'));var Papa=require(_0x178f('0xf'));var Redis=require(_0x178f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x178f('0x11'));var as=require(_0x178f('0x12'));var hardwareService=require(_0x178f('0x13'));var logger=require(_0x178f('0x14'))(_0x178f('0x15'));var utils=require(_0x178f('0x16'));var config=require(_0x178f('0x17'));var licenseUtil=require(_0x178f('0x18'));var db=require(_0x178f('0x19'))['db'];function respondWithStatusCode(_0x5b874a,_0x3a25a5){_0x3a25a5=_0x3a25a5||0xcc;return function(_0x1ca436){if(_0x1ca436){return _0x5b874a[_0x178f('0x1a')](_0x3a25a5);}return _0x5b874a[_0x178f('0x1b')](_0x3a25a5)['end']();};}function respondWithResult(_0x64c876,_0x5b31b9){_0x5b31b9=_0x5b31b9||0xc8;return function(_0x11273b){if(_0x11273b){return _0x64c876['status'](_0x5b31b9)['json'](_0x11273b);}};}function respondWithFilteredResult(_0x2c147b,_0x2ccbe0){return function(_0x1cd96a){if(_0x1cd96a){var _0x5bd5ae=typeof _0x2ccbe0[_0x178f('0x1c')]===_0x178f('0x1d')&&typeof _0x2ccbe0[_0x178f('0x1e')]==='undefined';var _0x535c5d=_0x1cd96a['count'];var _0x29bf56=_0x5bd5ae?0x0:_0x2ccbe0[_0x178f('0x1c')];var _0x49e921=_0x5bd5ae?_0x1cd96a[_0x178f('0x1f')]:_0x2ccbe0['offset']+_0x2ccbe0[_0x178f('0x1e')];var _0x4c32ea;if(_0x49e921>=_0x535c5d){_0x49e921=_0x535c5d;_0x4c32ea=0xc8;}else{_0x4c32ea=0xce;}_0x2c147b[_0x178f('0x1b')](_0x4c32ea);return _0x2c147b[_0x178f('0x20')]('Content-Range',_0x29bf56+'-'+_0x49e921+'/'+_0x535c5d)[_0x178f('0x21')](_0x1cd96a);}return null;};}function patchUpdates(_0x540b52){return function(_0x237bbe){try{jsonpatch[_0x178f('0x22')](_0x237bbe,_0x540b52,!![]);}catch(_0x544ada){return BPromise[_0x178f('0x23')](_0x544ada);}return _0x237bbe[_0x178f('0x24')]();};}function saveUpdates(_0x9d706e,_0xd8cd24){return function(_0x146d87){if(_0x146d87){return _0x146d87[_0x178f('0x25')](_0x9d706e)[_0x178f('0x26')](function(_0x34d4e1){return _0x34d4e1;});}return null;};}function removeEntity(_0x49c02e,_0x4208c2){return function(_0x1e8d3d){if(_0x1e8d3d){return _0x1e8d3d[_0x178f('0x27')]()['then'](function(){var _0x33ca2b=_0x1e8d3d[_0x178f('0x28')]({'plain':!![]});var _0x5f0178=_0x178f('0x29');return db[_0x178f('0x2a')]['destroy']({'where':{'type':_0x5f0178,'resourceId':_0x33ca2b['id']}})[_0x178f('0x26')](function(){return _0x1e8d3d;});})[_0x178f('0x26')](function(){_0x49c02e[_0x178f('0x1b')](0xcc)[_0x178f('0x2b')]();});}};}function handleEntityNotFound(_0x5dd653,_0x3a8ea5){return function(_0x37633e){if(!_0x37633e){_0x5dd653[_0x178f('0x1a')](0x194);}return _0x37633e;};}function handleError(_0x3deaef,_0x5a4435){_0x5a4435=_0x5a4435||0x1f4;return function(_0x41c098){logger['error'](_0x41c098[_0x178f('0x2c')]);if(_0x41c098[_0x178f('0x2d')]){delete _0x41c098[_0x178f('0x2d')];}_0x3deaef[_0x178f('0x1b')](_0x5a4435)[_0x178f('0x2e')](_0x41c098);};}exports[_0x178f('0x2f')]=function(_0x57e1f4,_0x960b85){var _0x5b3294={},_0x1ec9a7={},_0x1e7f47={'count':0x0,'rows':[]};var _0x2e6665=_[_0x178f('0x30')](db['ContactItemType'][_0x178f('0x31')],function(_0x48e5ca){return{'name':_0x48e5ca[_0x178f('0x32')],'type':_0x48e5ca[_0x178f('0x33')][_0x178f('0x34')]};});_0x1ec9a7[_0x178f('0x35')]=_[_0x178f('0x30')](_0x2e6665,'name');_0x1ec9a7['query']=_[_0x178f('0x36')](_0x57e1f4[_0x178f('0x37')]);_0x1ec9a7[_0x178f('0x38')]=_[_0x178f('0x39')](_0x1ec9a7[_0x178f('0x35')],_0x1ec9a7[_0x178f('0x37')]);_0x5b3294[_0x178f('0x3a')]=_[_0x178f('0x39')](_0x1ec9a7[_0x178f('0x35')],qs['fields'](_0x57e1f4[_0x178f('0x37')][_0x178f('0x3b')]));_0x5b3294['attributes']=_0x5b3294[_0x178f('0x3a')]['length']?_0x5b3294['attributes']:_0x1ec9a7[_0x178f('0x35')];if(!_0x57e1f4[_0x178f('0x37')][_0x178f('0x3c')](_0x178f('0x3d'))){_0x5b3294[_0x178f('0x1e')]=qs['limit'](_0x57e1f4[_0x178f('0x37')]['limit']);_0x5b3294[_0x178f('0x1c')]=qs['offset'](_0x57e1f4[_0x178f('0x37')]['offset']);}_0x5b3294['order']=qs[_0x178f('0x3e')](_0x57e1f4[_0x178f('0x37')][_0x178f('0x3e')]);_0x5b3294[_0x178f('0x3f')]=qs[_0x178f('0x38')](_['pick'](_0x57e1f4['query'],_0x1ec9a7[_0x178f('0x38')]),_0x2e6665);if(_0x57e1f4[_0x178f('0x37')][_0x178f('0x40')]){_0x5b3294[_0x178f('0x3f')]=_[_0x178f('0x41')](_0x5b3294['where'],{'$or':_['map'](_0x2e6665,function(_0x543468){if(_0x543468[_0x178f('0x33')]!==_0x178f('0x42')){var _0x3753fa={};_0x3753fa[_0x543468[_0x178f('0x2d')]]={'$like':'%'+_0x57e1f4['query']['filter']+'%'};return _0x3753fa;}})});}_0x5b3294=_[_0x178f('0x41')]({},_0x5b3294,_0x57e1f4[_0x178f('0x43')]);var _0x5ea8ca={'where':_0x5b3294[_0x178f('0x3f')]};return db[_0x178f('0x44')][_0x178f('0x1f')](_0x5ea8ca)[_0x178f('0x26')](function(_0x2c4402){_0x1e7f47[_0x178f('0x1f')]=_0x2c4402;if(_0x57e1f4['query'][_0x178f('0x45')]){_0x5b3294[_0x178f('0x46')]=[{'all':!![]}];}return db[_0x178f('0x44')][_0x178f('0x47')](_0x5b3294);})[_0x178f('0x26')](function(_0x2ea460){_0x1e7f47[_0x178f('0x48')]=_0x2ea460;return _0x1e7f47;})[_0x178f('0x26')](respondWithFilteredResult(_0x960b85,_0x5b3294))[_0x178f('0x49')](handleError(_0x960b85,null));};exports[_0x178f('0x4a')]=function(_0x465c5a,_0xc7e120){var _0x30db87={'raw':!![],'where':{'id':_0x465c5a[_0x178f('0x4b')]['id']}},_0x4103dd={};_0x4103dd['model']=_[_0x178f('0x36')](db['ContactItemType'][_0x178f('0x31')]);_0x4103dd[_0x178f('0x37')]=_[_0x178f('0x36')](_0x465c5a[_0x178f('0x37')]);_0x4103dd[_0x178f('0x38')]=_['intersection'](_0x4103dd[_0x178f('0x35')],_0x4103dd['query']);_0x30db87[_0x178f('0x3a')]=_[_0x178f('0x39')](_0x4103dd[_0x178f('0x35')],qs[_0x178f('0x3b')](_0x465c5a[_0x178f('0x37')][_0x178f('0x3b')]));_0x30db87[_0x178f('0x3a')]=_0x30db87[_0x178f('0x3a')]['length']?_0x30db87['attributes']:_0x4103dd['model'];if(_0x465c5a[_0x178f('0x37')][_0x178f('0x45')]){_0x30db87['include']=[{'all':!![]}];}_0x30db87=_[_0x178f('0x41')]({},_0x30db87,_0x465c5a[_0x178f('0x43')]);return db[_0x178f('0x44')][_0x178f('0x4c')](_0x30db87)[_0x178f('0x26')](handleEntityNotFound(_0xc7e120,null))[_0x178f('0x26')](respondWithResult(_0xc7e120,null))['catch'](handleError(_0xc7e120,null));};exports[_0x178f('0x4d')]=function(_0x3963b3,_0x16eb07){return db[_0x178f('0x44')][_0x178f('0x4d')](_0x3963b3['body'],{})['then'](function(_0x192978){var _0x4fd0eb=_0x3963b3[_0x178f('0x4e')][_0x178f('0x28')]({'plain':!![]});if(!_0x4fd0eb)throw new Error(_0x178f('0x4f'));if(_0x4fd0eb['role']===_0x178f('0x4e')){var _0x23ab16=_0x192978[_0x178f('0x28')]({'plain':!![]});var _0x38b9da=_0x178f('0x29');return db[_0x178f('0x50')][_0x178f('0x4c')]({'where':{'name':_0x38b9da,'userProfileId':_0x4fd0eb[_0x178f('0x51')]},'raw':!![]})[_0x178f('0x26')](function(_0x43f702){if(_0x43f702&&_0x43f702[_0x178f('0x52')]===0x0){return db[_0x178f('0x2a')]['create']({'name':_0x23ab16[_0x178f('0x2d')],'resourceId':_0x23ab16['id'],'type':_0x43f702[_0x178f('0x2d')],'sectionId':_0x43f702['id']},{})[_0x178f('0x26')](function(){return _0x192978;});}else{return _0x192978;}})[_0x178f('0x49')](function(_0x56ad5a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x56ad5a);throw _0x56ad5a;});}return _0x192978;})[_0x178f('0x26')](respondWithResult(_0x16eb07,0xc9))[_0x178f('0x49')](handleError(_0x16eb07,null));};exports['update']=function(_0x444054,_0x373c11){if(_0x444054[_0x178f('0x53')]['id']){delete _0x444054[_0x178f('0x53')]['id'];}return db[_0x178f('0x44')][_0x178f('0x4c')]({'where':{'id':_0x444054['params']['id']}})[_0x178f('0x26')](handleEntityNotFound(_0x373c11,null))[_0x178f('0x26')](saveUpdates(_0x444054[_0x178f('0x53')],null))['then'](respondWithResult(_0x373c11,null))[_0x178f('0x49')](handleError(_0x373c11,null));};exports[_0x178f('0x27')]=function(_0x3a1219,_0x5e338c){return db[_0x178f('0x44')][_0x178f('0x4c')]({'where':{'id':_0x3a1219['params']['id']}})[_0x178f('0x26')](handleEntityNotFound(_0x5e338c,null))[_0x178f('0x26')](removeEntity(_0x5e338c,null))['catch'](handleError(_0x5e338c,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index b206ce7..105224e 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4cd9=['exports','tools_contact_item_types','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x39e15b,_0x555185){var _0x4e5766=function(_0x45ef45){while(--_0x45ef45){_0x39e15b['push'](_0x39e15b['shift']());}};_0x4e5766(++_0x555185);}(_0x4cd9,0x98));var _0x94cd=function(_0xdd62e3,_0x257fe9){_0xdd62e3=_0xdd62e3-0x0;var _0x3e10b5=_0x4cd9[_0xdd62e3];return _0x3e10b5;};'use strict';var _=require(_0x94cd('0x0'));var util=require('util');var logger=require(_0x94cd('0x1'))(_0x94cd('0x2'));var moment=require(_0x94cd('0x3'));var BPromise=require(_0x94cd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x94cd('0x5'));var rimraf=require(_0x94cd('0x6'));var config=require(_0x94cd('0x7'));var attributes=require('./contactItemType.attributes');module[_0x94cd('0x8')]=function(_0x4bc8f9,_0x34b4fc){return _0x4bc8f9['define']('ContactItemType',attributes,{'tableName':_0x94cd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3d1c=['api','moment','bluebird','request-promise','path','exports','define','ContactItemType','util','../../config/logger'];(function(_0x1c6ef2,_0x8d926a){var _0x404b8c=function(_0x4fdf1e){while(--_0x4fdf1e){_0x1c6ef2['push'](_0x1c6ef2['shift']());}};_0x404b8c(++_0x8d926a);}(_0x3d1c,0x10c));var _0xc3d1=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x3d1c[_0x4b2436];return _0x4f5ab2;};'use strict';var _=require('lodash');var util=require(_0xc3d1('0x0'));var logger=require(_0xc3d1('0x1'))(_0xc3d1('0x2'));var moment=require(_0xc3d1('0x3'));var BPromise=require(_0xc3d1('0x4'));var rp=require(_0xc3d1('0x5'));var fs=require('fs');var path=require(_0xc3d1('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./contactItemType.attributes');module[_0xc3d1('0x7')]=function(_0x30ada6,_0x2ccbd3){return _0x30ada6[_0xc3d1('0x8')](_0xc3d1('0x9'),attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index cea2224..faa5895 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x09e1=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','ContactItemType,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x539ae5,_0x58a7b0){var _0x52f155=function(_0x82f686){while(--_0x82f686){_0x539ae5['push'](_0x539ae5['shift']());}};_0x52f155(++_0x58a7b0);}(_0x09e1,0x9d));var _0x109e=function(_0x2f5e62,_0x59f646){_0x2f5e62=_0x2f5e62-0x0;var _0x5f1d4e=_0x09e1[_0x2f5e62];return _0x5f1d4e;};'use strict';var _=require(_0x109e('0x0'));var util=require('util');var moment=require(_0x109e('0x1'));var BPromise=require(_0x109e('0x2'));var rs=require(_0x109e('0x3'));var fs=require('fs');var Redis=require(_0x109e('0x4'));var db=require(_0x109e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x109e('0x6'))(_0x109e('0x7'));var config=require('../../config/environment');var jayson=require(_0x109e('0x8'));var client=jayson['client'][_0x109e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30b164,_0x2c6b89,_0xf4ffa2){return new BPromise(function(_0x353142,_0x44fade){return client[_0x109e('0xa')](_0x30b164,_0xf4ffa2)[_0x109e('0xb')](function(_0x33bb62){logger['info']('ContactItemType,\x20%s,\x20%s',_0x2c6b89,_0x109e('0xc'));logger[_0x109e('0xd')](_0x109e('0xe'),_0x2c6b89,_0x109e('0xc'),JSON[_0x109e('0xf')](_0x33bb62));if(_0x33bb62[_0x109e('0x10')]){if(_0x33bb62['error'][_0x109e('0x11')]===0x1f4){logger['error'](_0x109e('0x12'),_0x2c6b89,_0x33bb62[_0x109e('0x10')][_0x109e('0x13')]);return _0x44fade(_0x33bb62[_0x109e('0x10')][_0x109e('0x13')]);}logger[_0x109e('0x10')](_0x109e('0x12'),_0x2c6b89,_0x33bb62[_0x109e('0x10')][_0x109e('0x13')]);return _0x353142(_0x33bb62[_0x109e('0x10')][_0x109e('0x13')]);}else{logger[_0x109e('0x14')](_0x109e('0x12'),_0x2c6b89,_0x109e('0xc'));_0x353142(_0x33bb62[_0x109e('0x15')][_0x109e('0x13')]);}})[_0x109e('0x16')](function(_0x3883f4){logger[_0x109e('0x10')]('ContactItemType,\x20%s,\x20%s',_0x2c6b89,_0x3883f4);_0x44fade(_0x3883f4);});});} \ No newline at end of file +var _0xc8be=['code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ContactItemType,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0xc8be,0x15d));var _0xec8b=function(_0x18b1e1,_0x1d000b){_0x18b1e1=_0x18b1e1-0x0;var _0x117b6a=_0xc8be[_0x18b1e1];return _0x117b6a;};'use strict';var _=require(_0xec8b('0x0'));var util=require(_0xec8b('0x1'));var moment=require(_0xec8b('0x2'));var BPromise=require(_0xec8b('0x3'));var rs=require(_0xec8b('0x4'));var fs=require('fs');var Redis=require(_0xec8b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xec8b('0x6'));var logger=require(_0xec8b('0x7'))(_0xec8b('0x8'));var config=require(_0xec8b('0x9'));var jayson=require(_0xec8b('0xa'));var client=jayson[_0xec8b('0xb')][_0xec8b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a1412,_0x3d5088,_0x47bcef){return new BPromise(function(_0x36b91a,_0x22bda1){return client[_0xec8b('0xd')](_0x5a1412,_0x47bcef)[_0xec8b('0xe')](function(_0x1e2046){logger['info'](_0xec8b('0xf'),_0x3d5088,_0xec8b('0x10'));logger['debug']('ContactItemType,\x20%s,\x20%s,\x20%s',_0x3d5088,_0xec8b('0x10'),JSON[_0xec8b('0x11')](_0x1e2046));if(_0x1e2046[_0xec8b('0x12')]){if(_0x1e2046[_0xec8b('0x12')][_0xec8b('0x13')]===0x1f4){logger['error'](_0xec8b('0xf'),_0x3d5088,_0x1e2046[_0xec8b('0x12')][_0xec8b('0x14')]);return _0x22bda1(_0x1e2046[_0xec8b('0x12')]['message']);}logger[_0xec8b('0x12')]('ContactItemType,\x20%s,\x20%s',_0x3d5088,_0x1e2046['error']['message']);return _0x36b91a(_0x1e2046[_0xec8b('0x12')][_0xec8b('0x14')]);}else{logger[_0xec8b('0x15')](_0xec8b('0xf'),_0x3d5088,'request\x20sent');_0x36b91a(_0x1e2046[_0xec8b('0x16')][_0xec8b('0x14')]);}})['catch'](function(_0x5513b0){logger['error']('ContactItemType,\x20%s,\x20%s',_0x3d5088,_0x5513b0);_0x22bda1(_0x5513b0);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index e6e3946..09b4154 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac35=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','/:id','isAuthenticated','show','post','put','update','destroy','multer','path','connect-timeout'];(function(_0x29d2e9,_0x42c128){var _0x18c2ff=function(_0x169aac){while(--_0x169aac){_0x29d2e9['push'](_0x29d2e9['shift']());}};_0x18c2ff(++_0x42c128);}(_0xac35,0x195));var _0x5ac3=function(_0x479722,_0x912451){_0x479722=_0x479722-0x0;var _0x468d94=_0xac35[_0x479722];return _0x468d94;};'use strict';var multer=require(_0x5ac3('0x0'));var util=require('util');var path=require(_0x5ac3('0x1'));var timeout=require(_0x5ac3('0x2'));var express=require('express');var router=express[_0x5ac3('0x3')]();var fs_extra=require(_0x5ac3('0x4'));var auth=require(_0x5ac3('0x5'));var interaction=require(_0x5ac3('0x6'));var config=require(_0x5ac3('0x7'));var controller=require(_0x5ac3('0x8'));router[_0x5ac3('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x5ac3('0xa'),auth[_0x5ac3('0xb')](),controller[_0x5ac3('0xc')]);router[_0x5ac3('0xd')]('/',auth[_0x5ac3('0xb')](),controller['create']);router[_0x5ac3('0xe')](_0x5ac3('0xa'),auth[_0x5ac3('0xb')](),controller[_0x5ac3('0xf')]);router['delete'](_0x5ac3('0xa'),auth['isAuthenticated'](),controller[_0x5ac3('0x10')]);module['exports']=router; \ No newline at end of file +var _0x2cc9=['isAuthenticated','get','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./contactItemType.controller'];(function(_0x5ba29c,_0xde764c){var _0x5e2762=function(_0x39bbde){while(--_0x39bbde){_0x5ba29c['push'](_0x5ba29c['shift']());}};_0x5e2762(++_0xde764c);}(_0x2cc9,0xc8));var _0x92cc=function(_0x237249,_0x5eb6d0){_0x237249=_0x237249-0x0;var _0x30885f=_0x2cc9[_0x237249];return _0x30885f;};'use strict';var multer=require(_0x92cc('0x0'));var util=require(_0x92cc('0x1'));var path=require(_0x92cc('0x2'));var timeout=require(_0x92cc('0x3'));var express=require(_0x92cc('0x4'));var router=express[_0x92cc('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x92cc('0x6'));var interaction=require(_0x92cc('0x7'));var config=require('../../config/environment');var controller=require(_0x92cc('0x8'));router['get']('/',auth[_0x92cc('0x9')](),controller['index']);router[_0x92cc('0xa')](_0x92cc('0xb'),auth[_0x92cc('0x9')](),controller[_0x92cc('0xc')]);router[_0x92cc('0xd')]('/',auth[_0x92cc('0x9')](),controller[_0x92cc('0xe')]);router[_0x92cc('0xf')](_0x92cc('0xb'),auth[_0x92cc('0x9')](),controller[_0x92cc('0x10')]);router['delete']('/:id',auth[_0x92cc('0x9')](),controller[_0x92cc('0x11')]);module[_0x92cc('0x12')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 2a8b6ea..6c6c468 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(_0x5c7431,_0x2380be){var _0x51420c=function(_0x14baeb){while(--_0x14baeb){_0x5c7431['push'](_0x5c7431['shift']());}};_0x51420c(++_0x2380be);}(_0xb10b,0x12a));var _0xbb10=function(_0x3fb743,_0x2b6886){_0x3fb743=_0x3fb743-0x0;var _0x135901=_0xb10b[_0x3fb743];return _0x135901;};'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 _0x2032=['name','exports','STRING'];(function(_0x1fcce4,_0x399903){var _0x449319=function(_0x5b2ed6){while(--_0x5b2ed6){_0x1fcce4['push'](_0x1fcce4['shift']());}};_0x449319(++_0x399903);}(_0x2032,0xd9));var _0x2203=function(_0x2b981e,_0x3e7c82){_0x2b981e=_0x2b981e-0x0;var _0x4bd250=_0x2032[_0x2b981e];return _0x4bd250;};'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 diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 2c5d1be..91bac00 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 _0x69b5=['save','then','CustomDashboards','UserProfileResource','destroy','status','error','stack','name','send','index','Dashboard','rawAttributes','type','map','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','show','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','get','omit','createdAt','updatedAt','role','UserProfileSection','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','end','json','offset','undefined','set','Content-Range','apply','reject'];(function(_0x334c48,_0x4cd1bd){var _0x4fe16d=function(_0x27be44){while(--_0x27be44){_0x334c48['push'](_0x334c48['shift']());}};_0x4fe16d(++_0x4cd1bd);}(_0x69b5,0x1c6));var _0x569b=function(_0x501732,_0x53aaa0){_0x501732=_0x501732-0x0;var _0x588ae8=_0x69b5[_0x501732];return _0x588ae8;};'use strict';var emlformat=require(_0x569b('0x0'));var rimraf=require(_0x569b('0x1'));var zipdir=require(_0x569b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x569b('0x3'));var moment=require(_0x569b('0x4'));var BPromise=require(_0x569b('0x5'));var Mustache=require(_0x569b('0x6'));var util=require(_0x569b('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x569b('0x8'));var ejs=require(_0x569b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x569b('0xa'));var squel=require('squel');var crypto=require(_0x569b('0xb'));var jsforce=require(_0x569b('0xc'));var deskjs=require(_0x569b('0xd'));var toCsv=require(_0x569b('0x8'));var querystring=require(_0x569b('0xe'));var Papa=require(_0x569b('0xf'));var Redis=require(_0x569b('0x10'));var authService=require(_0x569b('0x11'));var qs=require(_0x569b('0x12'));var as=require(_0x569b('0x13'));var hardwareService=require(_0x569b('0x14'));var logger=require('../../config/logger')(_0x569b('0x15'));var utils=require(_0x569b('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x569b('0x17'));var db=require(_0x569b('0x18'))['db'];config[_0x569b('0x19')]=_[_0x569b('0x1a')](config[_0x569b('0x19')],{'host':_0x569b('0x1b'),'port':0x18eb});var socket=require(_0x569b('0x1c'))(new Redis(config[_0x569b('0x19')]));require(_0x569b('0x1d'))['register'](socket);function respondWithStatusCode(_0x5efda3,_0xd2c151){_0xd2c151=_0xd2c151||0xcc;return function(_0x40772d){if(_0x40772d){return _0x5efda3['sendStatus'](_0xd2c151);}return _0x5efda3['status'](_0xd2c151)[_0x569b('0x1e')]();};}function respondWithResult(_0x15743f,_0x38ddfa){_0x38ddfa=_0x38ddfa||0xc8;return function(_0x52160a){if(_0x52160a){return _0x15743f['status'](_0x38ddfa)[_0x569b('0x1f')](_0x52160a);}};}function respondWithFilteredResult(_0x5969e0,_0x4e3c31){return function(_0x2136b3){if(_0x2136b3){var _0x3adb81=typeof _0x4e3c31[_0x569b('0x20')]===_0x569b('0x21')&&typeof _0x4e3c31['limit']===_0x569b('0x21');var _0x5ce2ad=_0x2136b3['count'];var _0x2e9e43=_0x3adb81?0x0:_0x4e3c31[_0x569b('0x20')];var _0x8e4f91=_0x3adb81?_0x2136b3['count']:_0x4e3c31['offset']+_0x4e3c31['limit'];var _0x1151be;if(_0x8e4f91>=_0x5ce2ad){_0x8e4f91=_0x5ce2ad;_0x1151be=0xc8;}else{_0x1151be=0xce;}_0x5969e0['status'](_0x1151be);return _0x5969e0[_0x569b('0x22')](_0x569b('0x23'),_0x2e9e43+'-'+_0x8e4f91+'/'+_0x5ce2ad)[_0x569b('0x1f')](_0x2136b3);}return null;};}function patchUpdates(_0x1bcee6){return function(_0x45aeea){try{jsonpatch[_0x569b('0x24')](_0x45aeea,_0x1bcee6,!![]);}catch(_0x508307){return BPromise[_0x569b('0x25')](_0x508307);}return _0x45aeea[_0x569b('0x26')]();};}function saveUpdates(_0x9e95e2,_0x54cca8){return function(_0x30382a){if(_0x30382a){return _0x30382a['update'](_0x9e95e2)[_0x569b('0x27')](function(_0x20e0b9){return _0x20e0b9;});}return null;};}function removeEntity(_0x32f8db,_0x242275){return function(_0xd7651e){if(_0xd7651e){return _0xd7651e['destroy']()[_0x569b('0x27')](function(){var _0x342ab4=_0xd7651e['get']({'plain':!![]});var _0x4af699=_0x569b('0x28');return db[_0x569b('0x29')][_0x569b('0x2a')]({'where':{'type':_0x4af699,'resourceId':_0x342ab4['id']}})[_0x569b('0x27')](function(){return _0xd7651e;});})[_0x569b('0x27')](function(){_0x32f8db[_0x569b('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x162231,_0x5c786a){return function(_0x52c598){if(!_0x52c598){_0x162231['sendStatus'](0x194);}return _0x52c598;};}function handleError(_0x430a4f,_0x32da9a){_0x32da9a=_0x32da9a||0x1f4;return function(_0x56e27c){logger[_0x569b('0x2c')](_0x56e27c[_0x569b('0x2d')]);if(_0x56e27c['name']){delete _0x56e27c[_0x569b('0x2e')];}_0x430a4f[_0x569b('0x2b')](_0x32da9a)[_0x569b('0x2f')](_0x56e27c);};}exports[_0x569b('0x30')]=function(_0x4c4b86,_0x37bb53){var _0x52905d={},_0x68e7bf={},_0x3eeac1={'count':0x0,'rows':[]};var _0x293bd8=_['map'](db[_0x569b('0x31')][_0x569b('0x32')],function(_0x31cc3b){return{'name':_0x31cc3b['fieldName'],'type':_0x31cc3b[_0x569b('0x33')]['key']};});_0x68e7bf['model']=_[_0x569b('0x34')](_0x293bd8,'name');_0x68e7bf[_0x569b('0x35')]=_['keys'](_0x4c4b86[_0x569b('0x35')]);_0x68e7bf['filters']=_[_0x569b('0x36')](_0x68e7bf[_0x569b('0x37')],_0x68e7bf[_0x569b('0x35')]);_0x52905d[_0x569b('0x38')]=_[_0x569b('0x36')](_0x68e7bf[_0x569b('0x37')],qs[_0x569b('0x39')](_0x4c4b86[_0x569b('0x35')][_0x569b('0x39')]));_0x52905d['attributes']=_0x52905d[_0x569b('0x38')][_0x569b('0x3a')]?_0x52905d[_0x569b('0x38')]:_0x68e7bf[_0x569b('0x37')];if(!_0x4c4b86[_0x569b('0x35')][_0x569b('0x3b')](_0x569b('0x3c'))){_0x52905d[_0x569b('0x3d')]=qs[_0x569b('0x3d')](_0x4c4b86[_0x569b('0x35')][_0x569b('0x3d')]);_0x52905d['offset']=qs['offset'](_0x4c4b86[_0x569b('0x35')][_0x569b('0x20')]);}_0x52905d[_0x569b('0x3e')]=qs[_0x569b('0x3f')](_0x4c4b86['query'][_0x569b('0x3f')]);_0x52905d[_0x569b('0x40')]=qs[_0x569b('0x41')](_[_0x569b('0x42')](_0x4c4b86[_0x569b('0x35')],_0x68e7bf[_0x569b('0x41')]),_0x293bd8);if(_0x4c4b86['query'][_0x569b('0x43')]){_0x52905d['where']=_[_0x569b('0x44')](_0x52905d[_0x569b('0x40')],{'$or':_[_0x569b('0x34')](_0x293bd8,function(_0x439909){if(_0x439909['type']!==_0x569b('0x45')){var _0x29c01b={};_0x29c01b[_0x439909[_0x569b('0x2e')]]={'$like':'%'+_0x4c4b86[_0x569b('0x35')][_0x569b('0x43')]+'%'};return _0x29c01b;}})});}_0x52905d=_[_0x569b('0x44')]({},_0x52905d,_0x4c4b86[_0x569b('0x46')]);var _0x4f84f4={'where':_0x52905d[_0x569b('0x40')]};return db[_0x569b('0x31')]['count'](_0x4f84f4)['then'](function(_0x2b38ae){_0x3eeac1[_0x569b('0x47')]=_0x2b38ae;if(_0x4c4b86[_0x569b('0x35')][_0x569b('0x48')]){_0x52905d[_0x569b('0x49')]=[{'all':!![]}];}return db[_0x569b('0x31')][_0x569b('0x4a')](_0x52905d);})['then'](function(_0xba0c66){_0x3eeac1['rows']=_0xba0c66;return _0x3eeac1;})[_0x569b('0x27')](respondWithFilteredResult(_0x37bb53,_0x52905d))['catch'](handleError(_0x37bb53,null));};exports[_0x569b('0x4b')]=function(_0x51feb7,_0x10a9d6){var _0x5bb901={'raw':![],'where':{'id':_0x51feb7[_0x569b('0x4c')]['id']}},_0x51e14f={};_0x51e14f[_0x569b('0x37')]=_[_0x569b('0x4d')](db[_0x569b('0x31')][_0x569b('0x32')]);_0x51e14f[_0x569b('0x35')]=_[_0x569b('0x4d')](_0x51feb7[_0x569b('0x35')]);_0x51e14f[_0x569b('0x41')]=_['intersection'](_0x51e14f['model'],_0x51e14f['query']);_0x5bb901[_0x569b('0x38')]=_['intersection'](_0x51e14f[_0x569b('0x37')],qs['fields'](_0x51feb7[_0x569b('0x35')]['fields']));_0x5bb901[_0x569b('0x38')]=_0x5bb901[_0x569b('0x38')]['length']?_0x5bb901['attributes']:_0x51e14f['model'];if(_0x51feb7[_0x569b('0x35')][_0x569b('0x48')]){_0x5bb901['include']=[{'all':!![]}];}_0x5bb901=_[_0x569b('0x44')]({},_0x5bb901,_0x51feb7[_0x569b('0x46')]);return db[_0x569b('0x31')]['find'](_0x5bb901)[_0x569b('0x27')](handleEntityNotFound(_0x10a9d6,null))['then'](respondWithResult(_0x10a9d6,null))['catch'](handleError(_0x10a9d6,null));};exports[_0x569b('0x4e')]=function(_0xb5b974,_0x4efd93){return db[_0x569b('0x31')][_0x569b('0x4e')](_0xb5b974[_0x569b('0x4f')],{})[_0x569b('0x27')](function(_0x13a3fa){var _0x258020=_0xb5b974[_0x569b('0x50')]['get']({'plain':!![]});if(!_0x258020)throw new Error(_0x569b('0x51'));if(_0x258020['role']===_0x569b('0x50')){var _0x1b42da=_0x13a3fa['get']({'plain':!![]});var _0x50836f='CustomDashboards';return db['UserProfileSection'][_0x569b('0x52')]({'where':{'name':_0x50836f,'userProfileId':_0x258020[_0x569b('0x53')]},'raw':!![]})['then'](function(_0x2f3625){if(_0x2f3625&&_0x2f3625[_0x569b('0x54')]===0x0){return db[_0x569b('0x29')]['create']({'name':_0x1b42da[_0x569b('0x2e')],'resourceId':_0x1b42da['id'],'type':_0x2f3625[_0x569b('0x2e')],'sectionId':_0x2f3625['id']},{})[_0x569b('0x27')](function(){return _0x13a3fa;});}else{return _0x13a3fa;}})[_0x569b('0x55')](function(_0x524f82){logger[_0x569b('0x2c')](_0x569b('0x56'),_0x524f82);throw _0x524f82;});}return _0x13a3fa;})['then'](respondWithResult(_0x4efd93,0xc9))['catch'](handleError(_0x4efd93,null));};exports['clone']=function(_0x458f2e,_0x217483){var _0x1b9cf1={'where':{'id':_0x458f2e[_0x569b('0x4c')]['id']}},_0x3a7802={};_0x3a7802[_0x569b('0x37')]=_[_0x569b('0x4d')](db[_0x569b('0x31')][_0x569b('0x32')]);_0x1b9cf1[_0x569b('0x38')]=_[_0x569b('0x36')](_0x3a7802[_0x569b('0x37')],qs[_0x569b('0x39')](_0x458f2e['query'][_0x569b('0x39')]));_0x1b9cf1[_0x569b('0x38')]=_0x1b9cf1[_0x569b('0x38')][_0x569b('0x3a')]?_0x1b9cf1[_0x569b('0x38')]:_0x3a7802[_0x569b('0x37')];if(_0x458f2e[_0x569b('0x35')][_0x569b('0x48')]){_0x1b9cf1['include']=[{'all':!![]}];}_0x1b9cf1=_[_0x569b('0x44')]({},_0x1b9cf1,_0x458f2e[_0x569b('0x46')]);return db[_0x569b('0x31')][_0x569b('0x52')](_0x1b9cf1)[_0x569b('0x27')](handleEntityNotFound(_0x217483,null))[_0x569b('0x27')](function(_0x45ed91){if(_0x45ed91){var _0x5a3409=_0x45ed91[_0x569b('0x57')]({'plain':!![]});_0x5a3409=qs[_0x569b('0x58')](_0x5a3409,['id',_0x569b('0x59'),_0x569b('0x5a')]);_0x458f2e['body']=_[_0x569b('0x58')](_0x458f2e[_0x569b('0x4f')],['id',_0x569b('0x59'),_0x569b('0x5a')]);return db[_0x569b('0x31')][_0x569b('0x4e')](_[_0x569b('0x44')](_0x5a3409,_0x458f2e[_0x569b('0x4f')]),{'include':_0x458f2e[_0x569b('0x35')][_0x569b('0x48')]?[{'all':!![]}]:undefined})[_0x569b('0x27')](function(_0x26d0e6){var _0x1ad2d6=_0x458f2e[_0x569b('0x50')][_0x569b('0x57')]({'plain':!![]});if(!_0x1ad2d6)throw new Error(_0x569b('0x51'));if(_0x1ad2d6[_0x569b('0x5b')]==='user'){var _0xde17a3=_0x26d0e6['get']({'plain':!![]});var _0x126f47=_0x569b('0x28');return db[_0x569b('0x5c')][_0x569b('0x52')]({'where':{'name':_0x126f47,'userProfileId':_0x1ad2d6[_0x569b('0x53')]},'raw':!![]})[_0x569b('0x27')](function(_0x46e1aa){if(_0x46e1aa&&_0x46e1aa[_0x569b('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0xde17a3[_0x569b('0x2e')],'resourceId':_0xde17a3['id'],'type':_0x46e1aa['name'],'sectionId':_0x46e1aa['id']},{})['then'](function(){return _0x26d0e6;});}else{return _0x26d0e6;}})[_0x569b('0x55')](function(_0x9e913c){logger[_0x569b('0x2c')](_0x569b('0x56'),_0x9e913c);throw _0x9e913c;});}return _0x26d0e6;});}})[_0x569b('0x27')](respondWithResult(_0x217483,0xc9))['catch'](handleError(_0x217483,null));};exports['update']=function(_0x41a066,_0x2908b9){if(_0x41a066[_0x569b('0x4f')]['id']){delete _0x41a066[_0x569b('0x4f')]['id'];}return db['Dashboard'][_0x569b('0x52')]({'where':{'id':_0x41a066[_0x569b('0x4c')]['id']}})[_0x569b('0x27')](handleEntityNotFound(_0x2908b9,null))[_0x569b('0x27')](saveUpdates(_0x41a066['body'],null))[_0x569b('0x27')](respondWithResult(_0x2908b9,null))[_0x569b('0x55')](handleError(_0x2908b9,null));};exports[_0x569b('0x2a')]=function(_0x21a9a9,_0x30f81a){return db[_0x569b('0x31')][_0x569b('0x52')]({'where':{'id':_0x21a9a9['params']['id']}})[_0x569b('0x27')](handleEntityNotFound(_0x30f81a,null))[_0x569b('0x27')](removeEntity(_0x30f81a,null))['catch'](handleError(_0x30f81a,null));};function widgetAttributes(_0x49abff){try{switch(_0x49abff[_0x569b('0x33')]){case _0x569b('0x5d'):return[{'name':'attrUrl','value':_0x49abff[_0x569b('0x5e')]||(_0x49abff['attrs']&&_0x49abff[_0x569b('0x5f')][0x0]?_0x49abff[_0x569b('0x5f')][0x0][_0x569b('0x60')]:undefined)||_0x569b('0x61')}];case _0x569b('0x62'):return[{'name':'attrPath','value':_0x49abff[_0x569b('0x63')]||(_0x49abff[_0x569b('0x5f')]&&_0x49abff[_0x569b('0x5f')][0x0]?_0x49abff['attrs'][0x0][_0x569b('0x60')]:undefined)||''}];case _0x569b('0x64'):return[{'name':'attrHourFormat','value':_0x49abff[_0x569b('0x65')]||(_0x49abff[_0x569b('0x5f')]&&_0x49abff[_0x569b('0x5f')][0x0]?_0x49abff['attrs'][0x0][_0x569b('0x60')]:undefined)||_0x569b('0x66')},{'name':_0x569b('0x67'),'value':_0x49abff['attrTimezone']||(_0x49abff['attrs']&&_0x49abff['attrs'][0x1]?_0x49abff[_0x569b('0x5f')][0x1][_0x569b('0x60')]:undefined)||'0.00'},{'name':_0x569b('0x68'),'value':_0x49abff[_0x569b('0x68')]||(_0x49abff['attrs']&&_0x49abff[_0x569b('0x5f')][0x2]?_0x49abff[_0x569b('0x5f')][0x2][_0x569b('0x60')]:undefined)||0xc}];case _0x569b('0x69'):return[{'name':_0x569b('0x6a'),'value':_0x49abff[_0x569b('0x6a')]||(_0x49abff[_0x569b('0x5f')]&&_0x49abff[_0x569b('0x5f')][0x0]?_0x49abff[_0x569b('0x5f')][0x0][_0x569b('0x60')]:undefined)||_0x569b('0x6b')},{'name':'attrVoiceQueues','value':_0x49abff[_0x569b('0x6c')]||(_0x49abff[_0x569b('0x5f')]&&_0x49abff[_0x569b('0x5f')][0x1]?_0x49abff[_0x569b('0x5f')][0x1]['value']:undefined)||[]},{'name':_0x569b('0x68'),'value':_0x49abff['attrFontSize']||(_0x49abff[_0x569b('0x5f')]&&_0x49abff[_0x569b('0x5f')][0x2]?_0x49abff[_0x569b('0x5f')][0x2]['value']:undefined)||0x14}];case'multibar-chart':case'pie-chart':return[{'name':'attrSerie1','value':_0x49abff[_0x569b('0x6d')]||(_0x49abff[_0x569b('0x5f')]&&_0x49abff[_0x569b('0x5f')][0x0]?_0x49abff['attrs'][0x0][_0x569b('0x60')]:undefined)||_0x569b('0x6b')},{'name':_0x569b('0x6e'),'value':_0x49abff[_0x569b('0x6e')]||(_0x49abff[_0x569b('0x5f')]&&_0x49abff[_0x569b('0x5f')][0x1]?_0x49abff[_0x569b('0x5f')][0x1][_0x569b('0x60')]:undefined)||null},{'name':_0x569b('0x6f'),'value':_0x49abff[_0x569b('0x6f')]||(_0x49abff[_0x569b('0x5f')]&&_0x49abff['attrs'][0x2]?_0x49abff['attrs'][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x49abff[_0x569b('0x6c')]||(_0x49abff['attrs']&&_0x49abff['attrs'][0x3]?_0x49abff[_0x569b('0x5f')][0x3][_0x569b('0x60')]:undefined)||[]}];case _0x569b('0x70'):return[{'name':_0x569b('0x71'),'type':_0x49abff[_0x569b('0x72')]||(_0x49abff[_0x569b('0x5f')]&&_0x49abff[_0x569b('0x5f')][0x0]?_0x49abff['attrs'][0x0][_0x569b('0x33')]:undefined)||null,'value':_0x49abff[_0x569b('0x71')]||(_0x49abff[_0x569b('0x5f')]&&_0x49abff['attrs'][0x0]?_0x49abff[_0x569b('0x5f')][0x0][_0x569b('0x60')]:undefined)||null},{'name':'attrRefresh','value':_0x49abff[_0x569b('0x73')]||(_0x49abff['attrs']&&_0x49abff[_0x569b('0x5f')][0x1]?_0x49abff[_0x569b('0x5f')][0x1][_0x569b('0x60')]:undefined)||0x0}];default:return[];}}catch(_0x254e42){logger[_0x569b('0x2c')](_0x569b('0x74'),JSON[_0x569b('0x75')](_0x254e42));return[];}}exports[_0x569b('0x76')]=function(_0x307f8b,_0x364194,_0x5eb747){if(_0x307f8b['body']['id']){delete _0x307f8b['body']['id'];}return db['Dashboard'][_0x569b('0x52')]({'where':{'id':_0x307f8b[_0x569b('0x4c')]['id']}})['then'](handleEntityNotFound(_0x364194,null))[_0x569b('0x27')](function(_0x5b7482){if(_0x5b7482){_0x307f8b[_0x569b('0x4f')][_0x569b('0x77')]=_0x5b7482['id'];_0x307f8b[_0x569b('0x4f')][_0x569b('0x5f')]=widgetAttributes(_0x307f8b[_0x569b('0x4f')]);return db[_0x569b('0x78')]['create'](_0x307f8b[_0x569b('0x4f')]);}})[_0x569b('0x27')](respondWithResult(_0x364194,null))[_0x569b('0x55')](handleError(_0x364194,null));};exports[_0x569b('0x79')]=function(_0x16f4f8,_0x39d981,_0x57ff9a){var _0x43017c={};var _0x2453a3={};var _0x272a8d;var _0x15842f;return db['Dashboard'][_0x569b('0x7a')]({'where':{'id':_0x16f4f8[_0x569b('0x4c')]['id']}})[_0x569b('0x27')](handleEntityNotFound(_0x39d981,null))[_0x569b('0x27')](function(_0x2ca280){if(_0x2ca280){_0x272a8d=_0x2ca280;_0x2453a3[_0x569b('0x37')]=_['keys'](db[_0x569b('0x78')][_0x569b('0x32')]);_0x2453a3[_0x569b('0x35')]=_[_0x569b('0x4d')](_0x16f4f8[_0x569b('0x35')]);_0x2453a3[_0x569b('0x41')]=_[_0x569b('0x36')](_0x2453a3[_0x569b('0x37')],_0x2453a3['query']);_0x43017c[_0x569b('0x38')]=_[_0x569b('0x36')](_0x2453a3[_0x569b('0x37')],qs['fields'](_0x16f4f8[_0x569b('0x35')][_0x569b('0x39')]));_0x43017c[_0x569b('0x38')]=_0x43017c[_0x569b('0x38')]['length']?_0x43017c[_0x569b('0x38')]:_0x2453a3[_0x569b('0x37')];_0x43017c['order']=qs[_0x569b('0x3f')](_0x16f4f8[_0x569b('0x35')]['sort']);_0x43017c[_0x569b('0x40')]=qs['filters'](_[_0x569b('0x42')](_0x16f4f8['query'],_0x2453a3[_0x569b('0x41')]));if(_0x16f4f8['query'][_0x569b('0x43')]){_0x43017c[_0x569b('0x40')]=_[_0x569b('0x44')](_0x43017c[_0x569b('0x40')],{'$or':_[_0x569b('0x34')](_0x43017c[_0x569b('0x38')],function(_0x5b96f2){var _0x2eb033={};_0x2eb033[_0x5b96f2]={'$like':'%'+_0x16f4f8['query']['filter']+'%'};return _0x2eb033;})});}_0x43017c=_[_0x569b('0x44')]({},_0x43017c,_0x16f4f8['options']);return _0x272a8d[_0x569b('0x79')](_0x43017c);}})[_0x569b('0x27')](function(_0x593bc4){if(_0x593bc4){_0x15842f=_0x593bc4[_0x569b('0x3a')];if(!_0x16f4f8[_0x569b('0x35')]['hasOwnProperty'](_0x569b('0x3c'))){_0x43017c[_0x569b('0x3d')]=qs[_0x569b('0x3d')](_0x16f4f8[_0x569b('0x35')][_0x569b('0x3d')]);_0x43017c[_0x569b('0x20')]=qs[_0x569b('0x20')](_0x16f4f8[_0x569b('0x35')][_0x569b('0x20')]);}return _0x272a8d[_0x569b('0x79')](_0x43017c);}})[_0x569b('0x27')](function(_0x231d02){if(_0x231d02){return _0x231d02?{'count':_0x15842f,'rows':_0x231d02}:null;}})[_0x569b('0x27')](respondWithResult(_0x39d981,null))[_0x569b('0x55')](handleError(_0x39d981,null));}; \ No newline at end of file +var _0x272b=['localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomDashboards','error','stack','name','index','map','Dashboard','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','filter','merge','where','options','includeAll','include','rows','catch','show','length','find','create','body','user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','attrReport','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardId','DashboardItem','getItems','findOne','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis'];(function(_0x3fe76e,_0x3f417d){var _0x3db0e6=function(_0x23817a){while(--_0x23817a){_0x3fe76e['push'](_0x3fe76e['shift']());}};_0x3db0e6(++_0x3f417d);}(_0x272b,0x1cb));var _0xb272=function(_0x3416d9,_0x6a56f9){_0x3416d9=_0x3416d9-0x0;var _0x589ad9=_0x272b[_0x3416d9];return _0x589ad9;};'use strict';var emlformat=require(_0xb272('0x0'));var rimraf=require(_0xb272('0x1'));var zipdir=require(_0xb272('0x2'));var jsonpatch=require(_0xb272('0x3'));var rp=require(_0xb272('0x4'));var moment=require('moment');var BPromise=require(_0xb272('0x5'));var Mustache=require(_0xb272('0x6'));var util=require(_0xb272('0x7'));var path=require('path');var sox=require(_0xb272('0x8'));var csv=require('to-csv');var ejs=require(_0xb272('0x9'));var fs=require('fs');var fs_extra=require(_0xb272('0xa'));var _=require(_0xb272('0xb'));var squel=require('squel');var crypto=require(_0xb272('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb272('0xd'));var querystring=require(_0xb272('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb272('0xf'));var qs=require(_0xb272('0x10'));var as=require(_0xb272('0x11'));var hardwareService=require(_0xb272('0x12'));var logger=require(_0xb272('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xb272('0x14'));var licenseUtil=require(_0xb272('0x15'));var db=require(_0xb272('0x16'))['db'];config['redis']=_[_0xb272('0x17')](config[_0xb272('0x18')],{'host':_0xb272('0x19'),'port':0x18eb});var socket=require(_0xb272('0x1a'))(new Redis(config[_0xb272('0x18')]));require(_0xb272('0x1b'))[_0xb272('0x1c')](socket);function respondWithStatusCode(_0x1d699e,_0x159025){_0x159025=_0x159025||0xcc;return function(_0x2af002){if(_0x2af002){return _0x1d699e[_0xb272('0x1d')](_0x159025);}return _0x1d699e['status'](_0x159025)['end']();};}function respondWithResult(_0x1c7682,_0x2b9cee){_0x2b9cee=_0x2b9cee||0xc8;return function(_0x2afd88){if(_0x2afd88){return _0x1c7682[_0xb272('0x1e')](_0x2b9cee)[_0xb272('0x1f')](_0x2afd88);}};}function respondWithFilteredResult(_0x2cff6d,_0x5a6afb){return function(_0xb9cf8b){if(_0xb9cf8b){var _0x365a36=typeof _0x5a6afb[_0xb272('0x20')]==='undefined'&&typeof _0x5a6afb['limit']===_0xb272('0x21');var _0x1457b9=_0xb9cf8b[_0xb272('0x22')];var _0x595fc1=_0x365a36?0x0:_0x5a6afb[_0xb272('0x20')];var _0x1139ab=_0x365a36?_0xb9cf8b['count']:_0x5a6afb[_0xb272('0x20')]+_0x5a6afb['limit'];var _0x11ce42;if(_0x1139ab>=_0x1457b9){_0x1139ab=_0x1457b9;_0x11ce42=0xc8;}else{_0x11ce42=0xce;}_0x2cff6d[_0xb272('0x1e')](_0x11ce42);return _0x2cff6d[_0xb272('0x23')](_0xb272('0x24'),_0x595fc1+'-'+_0x1139ab+'/'+_0x1457b9)['json'](_0xb9cf8b);}return null;};}function patchUpdates(_0x4d23a8){return function(_0x18a715){try{jsonpatch[_0xb272('0x25')](_0x18a715,_0x4d23a8,!![]);}catch(_0xa134f3){return BPromise[_0xb272('0x26')](_0xa134f3);}return _0x18a715[_0xb272('0x27')]();};}function saveUpdates(_0x4c7bbc,_0x464862){return function(_0x588c27){if(_0x588c27){return _0x588c27[_0xb272('0x28')](_0x4c7bbc)[_0xb272('0x29')](function(_0x4d7109){return _0x4d7109;});}return null;};}function removeEntity(_0x48eb2f,_0xbb53da){return function(_0x23bdbf){if(_0x23bdbf){return _0x23bdbf[_0xb272('0x2a')]()[_0xb272('0x29')](function(){var _0x4400eb=_0x23bdbf[_0xb272('0x2b')]({'plain':!![]});var _0x305174=_0xb272('0x2c');return db['UserProfileResource']['destroy']({'where':{'type':_0x305174,'resourceId':_0x4400eb['id']}})['then'](function(){return _0x23bdbf;});})[_0xb272('0x29')](function(){_0x48eb2f[_0xb272('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4151bb,_0x109550){return function(_0x3ac843){if(!_0x3ac843){_0x4151bb[_0xb272('0x1d')](0x194);}return _0x3ac843;};}function handleError(_0x58e674,_0x3df250){_0x3df250=_0x3df250||0x1f4;return function(_0x10e134){logger[_0xb272('0x2d')](_0x10e134[_0xb272('0x2e')]);if(_0x10e134[_0xb272('0x2f')]){delete _0x10e134[_0xb272('0x2f')];}_0x58e674[_0xb272('0x1e')](_0x3df250)['send'](_0x10e134);};}exports[_0xb272('0x30')]=function(_0x61bfd1,_0x1f7075){var _0x1e3317={},_0x42a755={},_0x1b127a={'count':0x0,'rows':[]};var _0xec27ca=_[_0xb272('0x31')](db[_0xb272('0x32')][_0xb272('0x33')],function(_0x15f0e1){return{'name':_0x15f0e1[_0xb272('0x34')],'type':_0x15f0e1[_0xb272('0x35')][_0xb272('0x36')]};});_0x42a755[_0xb272('0x37')]=_[_0xb272('0x31')](_0xec27ca,_0xb272('0x2f'));_0x42a755[_0xb272('0x38')]=_[_0xb272('0x39')](_0x61bfd1['query']);_0x42a755[_0xb272('0x3a')]=_[_0xb272('0x3b')](_0x42a755[_0xb272('0x37')],_0x42a755[_0xb272('0x38')]);_0x1e3317['attributes']=_[_0xb272('0x3b')](_0x42a755[_0xb272('0x37')],qs[_0xb272('0x3c')](_0x61bfd1[_0xb272('0x38')][_0xb272('0x3c')]));_0x1e3317['attributes']=_0x1e3317[_0xb272('0x3d')]['length']?_0x1e3317[_0xb272('0x3d')]:_0x42a755['model'];if(!_0x61bfd1[_0xb272('0x38')][_0xb272('0x3e')](_0xb272('0x3f'))){_0x1e3317[_0xb272('0x40')]=qs['limit'](_0x61bfd1['query'][_0xb272('0x40')]);_0x1e3317[_0xb272('0x20')]=qs[_0xb272('0x20')](_0x61bfd1[_0xb272('0x38')][_0xb272('0x20')]);}_0x1e3317[_0xb272('0x41')]=qs['sort'](_0x61bfd1[_0xb272('0x38')][_0xb272('0x42')]);_0x1e3317['where']=qs[_0xb272('0x3a')](_['pick'](_0x61bfd1[_0xb272('0x38')],_0x42a755['filters']),_0xec27ca);if(_0x61bfd1[_0xb272('0x38')][_0xb272('0x43')]){_0x1e3317['where']=_[_0xb272('0x44')](_0x1e3317[_0xb272('0x45')],{'$or':_[_0xb272('0x31')](_0xec27ca,function(_0x441fa9){if(_0x441fa9[_0xb272('0x35')]!=='VIRTUAL'){var _0x22c9ed={};_0x22c9ed[_0x441fa9['name']]={'$like':'%'+_0x61bfd1[_0xb272('0x38')]['filter']+'%'};return _0x22c9ed;}})});}_0x1e3317=_[_0xb272('0x44')]({},_0x1e3317,_0x61bfd1[_0xb272('0x46')]);var _0x3f5ed5={'where':_0x1e3317[_0xb272('0x45')]};return db[_0xb272('0x32')]['count'](_0x3f5ed5)[_0xb272('0x29')](function(_0x2edabc){_0x1b127a[_0xb272('0x22')]=_0x2edabc;if(_0x61bfd1[_0xb272('0x38')][_0xb272('0x47')]){_0x1e3317[_0xb272('0x48')]=[{'all':!![]}];}return db[_0xb272('0x32')]['findAll'](_0x1e3317);})[_0xb272('0x29')](function(_0x504133){_0x1b127a[_0xb272('0x49')]=_0x504133;return _0x1b127a;})[_0xb272('0x29')](respondWithFilteredResult(_0x1f7075,_0x1e3317))[_0xb272('0x4a')](handleError(_0x1f7075,null));};exports[_0xb272('0x4b')]=function(_0x56f7cd,_0x5106ff){var _0x3f73b1={'raw':![],'where':{'id':_0x56f7cd['params']['id']}},_0x54cd7c={};_0x54cd7c[_0xb272('0x37')]=_[_0xb272('0x39')](db[_0xb272('0x32')]['rawAttributes']);_0x54cd7c[_0xb272('0x38')]=_[_0xb272('0x39')](_0x56f7cd[_0xb272('0x38')]);_0x54cd7c['filters']=_['intersection'](_0x54cd7c[_0xb272('0x37')],_0x54cd7c[_0xb272('0x38')]);_0x3f73b1[_0xb272('0x3d')]=_[_0xb272('0x3b')](_0x54cd7c['model'],qs[_0xb272('0x3c')](_0x56f7cd['query'][_0xb272('0x3c')]));_0x3f73b1[_0xb272('0x3d')]=_0x3f73b1[_0xb272('0x3d')][_0xb272('0x4c')]?_0x3f73b1[_0xb272('0x3d')]:_0x54cd7c[_0xb272('0x37')];if(_0x56f7cd[_0xb272('0x38')]['includeAll']){_0x3f73b1[_0xb272('0x48')]=[{'all':!![]}];}_0x3f73b1=_[_0xb272('0x44')]({},_0x3f73b1,_0x56f7cd[_0xb272('0x46')]);return db[_0xb272('0x32')][_0xb272('0x4d')](_0x3f73b1)['then'](handleEntityNotFound(_0x5106ff,null))[_0xb272('0x29')](respondWithResult(_0x5106ff,null))[_0xb272('0x4a')](handleError(_0x5106ff,null));};exports['create']=function(_0x133f34,_0x1607a4){return db[_0xb272('0x32')][_0xb272('0x4e')](_0x133f34[_0xb272('0x4f')],{})[_0xb272('0x29')](function(_0x41f11b){var _0x7a34a9=_0x133f34[_0xb272('0x50')][_0xb272('0x2b')]({'plain':!![]});if(!_0x7a34a9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x7a34a9[_0xb272('0x51')]===_0xb272('0x50')){var _0xbbf3b6=_0x41f11b[_0xb272('0x2b')]({'plain':!![]});var _0x38f976=_0xb272('0x2c');return db['UserProfileSection'][_0xb272('0x4d')]({'where':{'name':_0x38f976,'userProfileId':_0x7a34a9[_0xb272('0x52')]},'raw':!![]})['then'](function(_0x19db26){if(_0x19db26&&_0x19db26[_0xb272('0x53')]===0x0){return db[_0xb272('0x54')]['create']({'name':_0xbbf3b6['name'],'resourceId':_0xbbf3b6['id'],'type':_0x19db26[_0xb272('0x2f')],'sectionId':_0x19db26['id']},{})[_0xb272('0x29')](function(){return _0x41f11b;});}else{return _0x41f11b;}})['catch'](function(_0x1888b4){logger['error'](_0xb272('0x55'),_0x1888b4);throw _0x1888b4;});}return _0x41f11b;})[_0xb272('0x29')](respondWithResult(_0x1607a4,0xc9))[_0xb272('0x4a')](handleError(_0x1607a4,null));};exports[_0xb272('0x56')]=function(_0x4b5d05,_0x53343f){var _0x501010={'where':{'id':_0x4b5d05[_0xb272('0x57')]['id']}},_0x20bc57={};_0x20bc57[_0xb272('0x37')]=_['keys'](db[_0xb272('0x32')]['rawAttributes']);_0x501010['attributes']=_[_0xb272('0x3b')](_0x20bc57[_0xb272('0x37')],qs[_0xb272('0x3c')](_0x4b5d05[_0xb272('0x38')]['fields']));_0x501010[_0xb272('0x3d')]=_0x501010[_0xb272('0x3d')][_0xb272('0x4c')]?_0x501010[_0xb272('0x3d')]:_0x20bc57['model'];if(_0x4b5d05[_0xb272('0x38')][_0xb272('0x47')]){_0x501010['include']=[{'all':!![]}];}_0x501010=_[_0xb272('0x44')]({},_0x501010,_0x4b5d05[_0xb272('0x46')]);return db[_0xb272('0x32')][_0xb272('0x4d')](_0x501010)[_0xb272('0x29')](handleEntityNotFound(_0x53343f,null))[_0xb272('0x29')](function(_0x13f318){if(_0x13f318){var _0x348b83=_0x13f318[_0xb272('0x2b')]({'plain':!![]});_0x348b83=qs[_0xb272('0x58')](_0x348b83,['id',_0xb272('0x59'),'updatedAt']);_0x4b5d05[_0xb272('0x4f')]=_[_0xb272('0x58')](_0x4b5d05[_0xb272('0x4f')],['id','createdAt','updatedAt']);return db['Dashboard']['create'](_[_0xb272('0x44')](_0x348b83,_0x4b5d05[_0xb272('0x4f')]),{'include':_0x4b5d05[_0xb272('0x38')][_0xb272('0x47')]?[{'all':!![]}]:undefined})[_0xb272('0x29')](function(_0x287947){var _0x52bbe8=_0x4b5d05['user'][_0xb272('0x2b')]({'plain':!![]});if(!_0x52bbe8)throw new Error(_0xb272('0x5a'));if(_0x52bbe8[_0xb272('0x51')]===_0xb272('0x50')){var _0x41fb44=_0x287947[_0xb272('0x2b')]({'plain':!![]});var _0x44b50f=_0xb272('0x2c');return db[_0xb272('0x5b')][_0xb272('0x4d')]({'where':{'name':_0x44b50f,'userProfileId':_0x52bbe8['userProfileId']},'raw':!![]})['then'](function(_0x4ea7bd){if(_0x4ea7bd&&_0x4ea7bd[_0xb272('0x53')]===0x0){return db['UserProfileResource'][_0xb272('0x4e')]({'name':_0x41fb44['name'],'resourceId':_0x41fb44['id'],'type':_0x4ea7bd[_0xb272('0x2f')],'sectionId':_0x4ea7bd['id']},{})[_0xb272('0x29')](function(){return _0x287947;});}else{return _0x287947;}})[_0xb272('0x4a')](function(_0x3b66de){logger[_0xb272('0x2d')](_0xb272('0x55'),_0x3b66de);throw _0x3b66de;});}return _0x287947;});}})['then'](respondWithResult(_0x53343f,0xc9))[_0xb272('0x4a')](handleError(_0x53343f,null));};exports[_0xb272('0x28')]=function(_0x49877e,_0x4c232d){if(_0x49877e[_0xb272('0x4f')]['id']){delete _0x49877e[_0xb272('0x4f')]['id'];}return db['Dashboard']['find']({'where':{'id':_0x49877e[_0xb272('0x57')]['id']}})[_0xb272('0x29')](handleEntityNotFound(_0x4c232d,null))[_0xb272('0x29')](saveUpdates(_0x49877e[_0xb272('0x4f')],null))[_0xb272('0x29')](respondWithResult(_0x4c232d,null))[_0xb272('0x4a')](handleError(_0x4c232d,null));};exports[_0xb272('0x2a')]=function(_0x5b1fc7,_0x2769a2){return db['Dashboard'][_0xb272('0x4d')]({'where':{'id':_0x5b1fc7['params']['id']}})['then'](handleEntityNotFound(_0x2769a2,null))['then'](removeEntity(_0x2769a2,null))['catch'](handleError(_0x2769a2,null));};function widgetAttributes(_0x28198d){try{switch(_0x28198d['type']){case'iframe':return[{'name':_0xb272('0x5c'),'value':_0x28198d[_0xb272('0x5c')]||(_0x28198d[_0xb272('0x5d')]&&_0x28198d[_0xb272('0x5d')][0x0]?_0x28198d['attrs'][0x0][_0xb272('0x5e')]:undefined)||_0xb272('0x5f')}];case _0xb272('0x60'):return[{'name':'attrPath','value':_0x28198d[_0xb272('0x61')]||(_0x28198d[_0xb272('0x5d')]&&_0x28198d[_0xb272('0x5d')][0x0]?_0x28198d[_0xb272('0x5d')][0x0][_0xb272('0x5e')]:undefined)||''}];case _0xb272('0x62'):return[{'name':_0xb272('0x63'),'value':_0x28198d[_0xb272('0x63')]||(_0x28198d[_0xb272('0x5d')]&&_0x28198d[_0xb272('0x5d')][0x0]?_0x28198d['attrs'][0x0]['value']:undefined)||_0xb272('0x64')},{'name':_0xb272('0x65'),'value':_0x28198d[_0xb272('0x65')]||(_0x28198d[_0xb272('0x5d')]&&_0x28198d[_0xb272('0x5d')][0x1]?_0x28198d[_0xb272('0x5d')][0x1][_0xb272('0x5e')]:undefined)||_0xb272('0x66')},{'name':_0xb272('0x67'),'value':_0x28198d[_0xb272('0x67')]||(_0x28198d[_0xb272('0x5d')]&&_0x28198d[_0xb272('0x5d')][0x2]?_0x28198d[_0xb272('0x5d')][0x2][_0xb272('0x5e')]:undefined)||0xc}];case _0xb272('0x68'):return[{'name':'attrMetric','value':_0x28198d['attrMetric']||(_0x28198d['attrs']&&_0x28198d[_0xb272('0x5d')][0x0]?_0x28198d[_0xb272('0x5d')][0x0][_0xb272('0x5e')]:undefined)||'total'},{'name':_0xb272('0x69'),'value':_0x28198d[_0xb272('0x69')]||(_0x28198d[_0xb272('0x5d')]&&_0x28198d['attrs'][0x1]?_0x28198d['attrs'][0x1][_0xb272('0x5e')]:undefined)||[]},{'name':_0xb272('0x67'),'value':_0x28198d[_0xb272('0x67')]||(_0x28198d[_0xb272('0x5d')]&&_0x28198d[_0xb272('0x5d')][0x2]?_0x28198d[_0xb272('0x5d')][0x2]['value']:undefined)||0x14}];case _0xb272('0x6a'):case _0xb272('0x6b'):return[{'name':_0xb272('0x6c'),'value':_0x28198d[_0xb272('0x6c')]||(_0x28198d[_0xb272('0x5d')]&&_0x28198d[_0xb272('0x5d')][0x0]?_0x28198d[_0xb272('0x5d')][0x0]['value']:undefined)||_0xb272('0x6d')},{'name':_0xb272('0x6e'),'value':_0x28198d['attrSerie2']||(_0x28198d[_0xb272('0x5d')]&&_0x28198d[_0xb272('0x5d')][0x1]?_0x28198d[_0xb272('0x5d')][0x1]['value']:undefined)||null},{'name':_0xb272('0x6f'),'value':_0x28198d['attrSerie3']||(_0x28198d[_0xb272('0x5d')]&&_0x28198d[_0xb272('0x5d')][0x2]?_0x28198d[_0xb272('0x5d')][0x2][_0xb272('0x5e')]:undefined)||null},{'name':_0xb272('0x69'),'value':_0x28198d[_0xb272('0x69')]||(_0x28198d[_0xb272('0x5d')]&&_0x28198d[_0xb272('0x5d')][0x3]?_0x28198d[_0xb272('0x5d')][0x3][_0xb272('0x5e')]:undefined)||[]}];case'web-report':return[{'name':_0xb272('0x70'),'type':_0x28198d['reportType']||(_0x28198d[_0xb272('0x5d')]&&_0x28198d[_0xb272('0x5d')][0x0]?_0x28198d[_0xb272('0x5d')][0x0][_0xb272('0x35')]:undefined)||null,'value':_0x28198d[_0xb272('0x70')]||(_0x28198d[_0xb272('0x5d')]&&_0x28198d[_0xb272('0x5d')][0x0]?_0x28198d['attrs'][0x0][_0xb272('0x5e')]:undefined)||null},{'name':'attrRefresh','value':_0x28198d[_0xb272('0x71')]||(_0x28198d[_0xb272('0x5d')]&&_0x28198d[_0xb272('0x5d')][0x1]?_0x28198d['attrs'][0x1][_0xb272('0x5e')]:undefined)||0x0}];default:return[];}}catch(_0x1399b1){logger['error'](_0xb272('0x72'),JSON['stringify'](_0x1399b1));return[];}}exports[_0xb272('0x73')]=function(_0x8ce1da,_0x149d05,_0x7ebaf7){if(_0x8ce1da[_0xb272('0x4f')]['id']){delete _0x8ce1da[_0xb272('0x4f')]['id'];}return db[_0xb272('0x32')][_0xb272('0x4d')]({'where':{'id':_0x8ce1da['params']['id']}})[_0xb272('0x29')](handleEntityNotFound(_0x149d05,null))[_0xb272('0x29')](function(_0x3ad119){if(_0x3ad119){_0x8ce1da[_0xb272('0x4f')][_0xb272('0x74')]=_0x3ad119['id'];_0x8ce1da[_0xb272('0x4f')]['attrs']=widgetAttributes(_0x8ce1da[_0xb272('0x4f')]);return db[_0xb272('0x75')][_0xb272('0x4e')](_0x8ce1da['body']);}})['then'](respondWithResult(_0x149d05,null))[_0xb272('0x4a')](handleError(_0x149d05,null));};exports[_0xb272('0x76')]=function(_0x11e1a2,_0x106f3a,_0x2a0172){var _0x2c4561={};var _0x6d2ea5={};var _0x35f129;var _0x2ea3d0;return db[_0xb272('0x32')][_0xb272('0x77')]({'where':{'id':_0x11e1a2[_0xb272('0x57')]['id']}})['then'](handleEntityNotFound(_0x106f3a,null))[_0xb272('0x29')](function(_0x1461a6){if(_0x1461a6){_0x35f129=_0x1461a6;_0x6d2ea5[_0xb272('0x37')]=_[_0xb272('0x39')](db[_0xb272('0x75')][_0xb272('0x33')]);_0x6d2ea5[_0xb272('0x38')]=_[_0xb272('0x39')](_0x11e1a2[_0xb272('0x38')]);_0x6d2ea5['filters']=_[_0xb272('0x3b')](_0x6d2ea5[_0xb272('0x37')],_0x6d2ea5[_0xb272('0x38')]);_0x2c4561[_0xb272('0x3d')]=_[_0xb272('0x3b')](_0x6d2ea5[_0xb272('0x37')],qs['fields'](_0x11e1a2[_0xb272('0x38')][_0xb272('0x3c')]));_0x2c4561[_0xb272('0x3d')]=_0x2c4561[_0xb272('0x3d')]['length']?_0x2c4561['attributes']:_0x6d2ea5[_0xb272('0x37')];_0x2c4561[_0xb272('0x41')]=qs[_0xb272('0x42')](_0x11e1a2[_0xb272('0x38')][_0xb272('0x42')]);_0x2c4561[_0xb272('0x45')]=qs[_0xb272('0x3a')](_[_0xb272('0x78')](_0x11e1a2[_0xb272('0x38')],_0x6d2ea5['filters']));if(_0x11e1a2[_0xb272('0x38')][_0xb272('0x43')]){_0x2c4561['where']=_[_0xb272('0x44')](_0x2c4561[_0xb272('0x45')],{'$or':_[_0xb272('0x31')](_0x2c4561['attributes'],function(_0x3f7b92){var _0x2ac302={};_0x2ac302[_0x3f7b92]={'$like':'%'+_0x11e1a2['query'][_0xb272('0x43')]+'%'};return _0x2ac302;})});}_0x2c4561=_[_0xb272('0x44')]({},_0x2c4561,_0x11e1a2['options']);return _0x35f129['getItems'](_0x2c4561);}})[_0xb272('0x29')](function(_0x4ce712){if(_0x4ce712){_0x2ea3d0=_0x4ce712[_0xb272('0x4c')];if(!_0x11e1a2[_0xb272('0x38')][_0xb272('0x3e')](_0xb272('0x3f'))){_0x2c4561[_0xb272('0x40')]=qs[_0xb272('0x40')](_0x11e1a2[_0xb272('0x38')][_0xb272('0x40')]);_0x2c4561['offset']=qs[_0xb272('0x20')](_0x11e1a2['query'][_0xb272('0x20')]);}return _0x35f129[_0xb272('0x76')](_0x2c4561);}})[_0xb272('0x29')](function(_0x44ec2c){if(_0x44ec2c){return _0x44ec2c?{'count':_0x2ea3d0,'rows':_0x44ec2c}:null;}})['then'](respondWithResult(_0x106f3a,null))[_0xb272('0x4a')](handleError(_0x106f3a,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index c7ac4bc..3e052c3 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 _0xcaaf=['update','remove','emit','hasOwnProperty','hook','exports','events','Dashboard'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xcaaf,0x66));var _0xfcaa=function(_0x1e4a58,_0x24b93a){_0x1e4a58=_0x1e4a58-0x0;var _0x2a6171=_0xcaaf[_0x1e4a58];return _0x2a6171;};'use strict';var EventEmitter=require(_0xfcaa('0x0'));var Dashboard=require('../../mysqldb')['db'][_0xfcaa('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xfcaa('0x2'),'afterDestroy':_0xfcaa('0x3')};function emitEvent(_0x4b8844){return function(_0xf120fe,_0x540311,_0x581a66){DashboardEvents[_0xfcaa('0x4')](_0x4b8844+':'+_0xf120fe['id'],_0xf120fe);DashboardEvents[_0xfcaa('0x4')](_0x4b8844,_0xf120fe);_0x581a66(null);};}for(var e in events){if(events[_0xfcaa('0x5')](e)){var event=events[e];Dashboard[_0xfcaa('0x6')](e,emitEvent(event));}}module[_0xfcaa('0x7')]=DashboardEvents; \ No newline at end of file +var _0x4753=['update','emit','hasOwnProperty','exports','events','../../mysqldb','Dashboard','save'];(function(_0x122ba8,_0x18d4b0){var _0x5dbb55=function(_0x49ace5){while(--_0x49ace5){_0x122ba8['push'](_0x122ba8['shift']());}};_0x5dbb55(++_0x18d4b0);}(_0x4753,0x1f4));var _0x3475=function(_0x43b2e8,_0x2b3f7e){_0x43b2e8=_0x43b2e8-0x0;var _0x48757b=_0x4753[_0x43b2e8];return _0x48757b;};'use strict';var EventEmitter=require(_0x3475('0x0'));var Dashboard=require(_0x3475('0x1'))['db'][_0x3475('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3475('0x3'),'afterUpdate':_0x3475('0x4'),'afterDestroy':'remove'};function emitEvent(_0x212d98){return function(_0x4c6fd2,_0x5a801b,_0x5de37e){DashboardEvents['emit'](_0x212d98+':'+_0x4c6fd2['id'],_0x4c6fd2);DashboardEvents[_0x3475('0x5')](_0x212d98,_0x4c6fd2);_0x5de37e(null);};}for(var e in events){if(events[_0x3475('0x6')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0x3475('0x7')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 508a0af..74267d4 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 _0x5c94=['./dashboard.attributes','define','Dashboard','dashboards','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x165f97,_0x1d941b){var _0x149b10=function(_0xa647a4){while(--_0xa647a4){_0x165f97['push'](_0x165f97['shift']());}};_0x149b10(++_0x1d941b);}(_0x5c94,0x149));var _0x45c9=function(_0x5a3c8f,_0x3be0ee){_0x5a3c8f=_0x5a3c8f-0x0;var _0x286a94=_0x5c94[_0x5a3c8f];return _0x286a94;};'use strict';var _=require(_0x45c9('0x0'));var util=require(_0x45c9('0x1'));var logger=require(_0x45c9('0x2'))(_0x45c9('0x3'));var moment=require('moment');var BPromise=require(_0x45c9('0x4'));var rp=require(_0x45c9('0x5'));var fs=require('fs');var path=require(_0x45c9('0x6'));var rimraf=require(_0x45c9('0x7'));var config=require(_0x45c9('0x8'));var attributes=require(_0x45c9('0x9'));module['exports']=function(_0x52ad45,_0x4e3d30){return _0x52ad45[_0x45c9('0xa')](_0x45c9('0xb'),attributes,{'tableName':_0x45c9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa35d=['./dashboard.attributes','exports','define','dashboards','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x1f215a,_0x111d2f){var _0x4c03e5=function(_0x176c17){while(--_0x176c17){_0x1f215a['push'](_0x1f215a['shift']());}};_0x4c03e5(++_0x111d2f);}(_0xa35d,0x1d8));var _0xda35=function(_0x3d7486,_0x5529e5){_0x3d7486=_0x3d7486-0x0;var _0x54e078=_0xa35d[_0x3d7486];return _0x54e078;};'use strict';var _=require(_0xda35('0x0'));var util=require(_0xda35('0x1'));var logger=require(_0xda35('0x2'))(_0xda35('0x3'));var moment=require(_0xda35('0x4'));var BPromise=require(_0xda35('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xda35('0x6'));var rimraf=require(_0xda35('0x7'));var config=require(_0xda35('0x8'));var attributes=require(_0xda35('0x9'));module[_0xda35('0xa')]=function(_0x1cea75,_0x12e76d){return _0x1cea75[_0xda35('0xb')]('Dashboard',attributes,{'tableName':_0xda35('0xc'),'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 b9a51ec..a987319 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 _0x12c0=['code','message','info','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','then','Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3f670b,_0x10f414){var _0x1c0978=function(_0x5c1276){while(--_0x5c1276){_0x3f670b['push'](_0x3f670b['shift']());}};_0x1c0978(++_0x10f414);}(_0x12c0,0xc1));var _0x012c=function(_0x80f91,_0x346217){_0x80f91=_0x80f91-0x0;var _0x50c9e9=_0x12c0[_0x80f91];return _0x50c9e9;};'use strict';var _=require(_0x012c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x012c('0x1'));var rs=require(_0x012c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x012c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x012c('0x4'))(_0x012c('0x5'));var config=require('../../config/environment');var jayson=require(_0x012c('0x6'));var client=jayson[_0x012c('0x7')][_0x012c('0x8')]({'port':0x232a});config[_0x012c('0x9')]=_[_0x012c('0xa')](config[_0x012c('0x9')],{'host':_0x012c('0xb'),'port':0x18eb});var socket=require(_0x012c('0xc'))(new Redis(config[_0x012c('0x9')]));require(_0x012c('0xd'))[_0x012c('0xe')](socket);function respondWithRpcPromise(_0x45ffce,_0x5920dc,_0x4b893c){return new BPromise(function(_0x5700e7,_0x2e2013){return client[_0x012c('0xf')](_0x45ffce,_0x4b893c)[_0x012c('0x10')](function(_0x312509){logger['info'](_0x012c('0x11'),_0x5920dc,'request\x20sent');logger[_0x012c('0x12')](_0x012c('0x13'),_0x5920dc,_0x012c('0x14'),JSON[_0x012c('0x15')](_0x312509));if(_0x312509[_0x012c('0x16')]){if(_0x312509['error'][_0x012c('0x17')]===0x1f4){logger[_0x012c('0x16')]('Dashboard,\x20%s,\x20%s',_0x5920dc,_0x312509['error'][_0x012c('0x18')]);return _0x2e2013(_0x312509[_0x012c('0x16')][_0x012c('0x18')]);}logger['error']('Dashboard,\x20%s,\x20%s',_0x5920dc,_0x312509['error']['message']);return _0x5700e7(_0x312509[_0x012c('0x16')][_0x012c('0x18')]);}else{logger[_0x012c('0x19')]('Dashboard,\x20%s,\x20%s',_0x5920dc,_0x012c('0x14'));_0x5700e7(_0x312509['result'][_0x012c('0x18')]);}})[_0x012c('0x1a')](function(_0x197dd2){logger[_0x012c('0x16')](_0x012c('0x11'),_0x5920dc,_0x197dd2);_0x2e2013(_0x197dd2);});});} \ No newline at end of file +var _0x9473=['../../config/environment','jayson/promise','client','redis','socket.io-emitter','./dashboard.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','Dashboard,\x20%s,\x20%s','message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0xce3d93,_0x504f1c){var _0x16bcf8=function(_0xff82f3){while(--_0xff82f3){_0xce3d93['push'](_0xce3d93['shift']());}};_0x16bcf8(++_0x504f1c);}(_0x9473,0x75));var _0x3947=function(_0x30f53,_0x3751fc){_0x30f53=_0x30f53-0x0;var _0x5629c3=_0x9473[_0x30f53];return _0x5629c3;};'use strict';var _=require(_0x3947('0x0'));var util=require('util');var moment=require(_0x3947('0x1'));var BPromise=require(_0x3947('0x2'));var rs=require(_0x3947('0x3'));var fs=require('fs');var Redis=require(_0x3947('0x4'));var db=require(_0x3947('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3947('0x6'))(_0x3947('0x7'));var config=require(_0x3947('0x8'));var jayson=require(_0x3947('0x9'));var client=jayson[_0x3947('0xa')]['http']({'port':0x232a});config[_0x3947('0xb')]=_['defaults'](config[_0x3947('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x3947('0xc'))(new Redis(config[_0x3947('0xb')]));require(_0x3947('0xd'))[_0x3947('0xe')](socket);function respondWithRpcPromise(_0x1026c8,_0x3f30ab,_0x55b5f3){return new BPromise(function(_0x35e80b,_0x444d3e){return client[_0x3947('0xf')](_0x1026c8,_0x55b5f3)[_0x3947('0x10')](function(_0x46f627){logger[_0x3947('0x11')]('Dashboard,\x20%s,\x20%s',_0x3f30ab,_0x3947('0x12'));logger[_0x3947('0x13')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x3f30ab,_0x3947('0x12'),JSON[_0x3947('0x14')](_0x46f627));if(_0x46f627[_0x3947('0x15')]){if(_0x46f627[_0x3947('0x15')][_0x3947('0x16')]===0x1f4){logger[_0x3947('0x15')](_0x3947('0x17'),_0x3f30ab,_0x46f627[_0x3947('0x15')]['message']);return _0x444d3e(_0x46f627[_0x3947('0x15')][_0x3947('0x18')]);}logger[_0x3947('0x15')](_0x3947('0x17'),_0x3f30ab,_0x46f627[_0x3947('0x15')][_0x3947('0x18')]);return _0x35e80b(_0x46f627['error']['message']);}else{logger[_0x3947('0x11')](_0x3947('0x17'),_0x3f30ab,_0x3947('0x12'));_0x35e80b(_0x46f627['result'][_0x3947('0x18')]);}})['catch'](function(_0x553603){logger[_0x3947('0x15')]('Dashboard,\x20%s,\x20%s',_0x3f30ab,_0x553603);_0x444d3e(_0x553603);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 2e4a713..4a24dde 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 _0x12b9=['removeListener','register','dashboard:','remove','update'];(function(_0xadd525,_0x3b22e2){var _0x4c2195=function(_0x539d59){while(--_0x539d59){_0xadd525['push'](_0xadd525['shift']());}};_0x4c2195(++_0x3b22e2);}(_0x12b9,0xa3));var _0x912b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x12b9[_0x2dafbe];return _0x58a45a;};'use strict';var DashboardEvents=require('./dashboard.events');var events=['save',_0x912b('0x0'),_0x912b('0x1')];function createListener(_0x194ff1,_0x3f9bc1){return function(_0x4d4827){_0x3f9bc1['emit'](_0x194ff1,_0x4d4827);};}function removeListener(_0xb08708,_0x30a750){return function(){DashboardEvents[_0x912b('0x2')](_0xb08708,_0x30a750);};}exports[_0x912b('0x3')]=function(_0x4928aa){for(var _0x465221=0x0,_0x2190c5=events['length'];_0x465221<_0x2190c5;_0x465221++){var _0x129392=events[_0x465221];var _0x31619b=createListener(_0x912b('0x4')+_0x129392,_0x4928aa);DashboardEvents['on'](_0x129392,_0x31619b);}}; \ No newline at end of file +var _0x45b2=['./dashboard.events','save','remove','update','emit','removeListener','register','length','dashboard:'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x45b2,0x120));var _0x245b=function(_0x320e38,_0x7e116d){_0x320e38=_0x320e38-0x0;var _0x35c157=_0x45b2[_0x320e38];return _0x35c157;};'use strict';var DashboardEvents=require(_0x245b('0x0'));var events=[_0x245b('0x1'),_0x245b('0x2'),_0x245b('0x3')];function createListener(_0x5a7fd8,_0x5ee714){return function(_0x96aab2){_0x5ee714[_0x245b('0x4')](_0x5a7fd8,_0x96aab2);};}function removeListener(_0x4604cc,_0x5dca0a){return function(){DashboardEvents[_0x245b('0x5')](_0x4604cc,_0x5dca0a);};}exports[_0x245b('0x6')]=function(_0x38abf2){for(var _0x417548=0x0,_0x313a5d=events[_0x245b('0x7')];_0x417548<_0x313a5d;_0x417548++){var _0x5f23ec=events[_0x417548];var _0xd02d9=createListener(_0x245b('0x8')+_0x5f23ec,_0x38abf2);DashboardEvents['on'](_0x5f23ec,_0xd02d9);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 3dfc556..153618f 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 _0x4c21=['./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','post','/:id/clone','addItem','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x466d98,_0x4829a6){var _0x4e1690=function(_0x1f7bd1){while(--_0x1f7bd1){_0x466d98['push'](_0x466d98['shift']());}};_0x4e1690(++_0x4829a6);}(_0x4c21,0x154));var _0x14c2=function(_0x5f519b,_0x5b606f){_0x5f519b=_0x5f519b-0x0;var _0x2461e2=_0x4c21[_0x5f519b];return _0x2461e2;};'use strict';var multer=require(_0x14c2('0x0'));var util=require(_0x14c2('0x1'));var path=require(_0x14c2('0x2'));var timeout=require(_0x14c2('0x3'));var express=require(_0x14c2('0x4'));var router=express[_0x14c2('0x5')]();var fs_extra=require(_0x14c2('0x6'));var auth=require(_0x14c2('0x7'));var interaction=require(_0x14c2('0x8'));var config=require(_0x14c2('0x9'));var controller=require(_0x14c2('0xa'));router[_0x14c2('0xb')]('/',auth[_0x14c2('0xc')](),controller[_0x14c2('0xd')]);router['get'](_0x14c2('0xe'),auth[_0x14c2('0xc')](),controller[_0x14c2('0xf')]);router['get'](_0x14c2('0x10'),auth['isAuthenticated'](),controller[_0x14c2('0x11')]);router[_0x14c2('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x14c2('0x12')](_0x14c2('0x13'),auth[_0x14c2('0xc')](),controller['clone']);router[_0x14c2('0x12')]('/:id/items',auth[_0x14c2('0xc')](),controller[_0x14c2('0x14')]);router[_0x14c2('0x15')](_0x14c2('0xe'),auth[_0x14c2('0xc')](),controller['update']);router[_0x14c2('0x16')](_0x14c2('0xe'),auth[_0x14c2('0xc')](),controller[_0x14c2('0x17')]);module[_0x14c2('0x18')]=router; \ No newline at end of file +var _0x6b8b=['../../config/environment','./dashboard.controller','get','isAuthenticated','/:id','getItems','create','post','/:id/clone','clone','put','update','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3f61b0,_0x5b9f10){var _0x5ef0c1=function(_0x2f602d){while(--_0x2f602d){_0x3f61b0['push'](_0x3f61b0['shift']());}};_0x5ef0c1(++_0x5b9f10);}(_0x6b8b,0x15e));var _0xb6b8=function(_0x2f558e,_0xe4f1da){_0x2f558e=_0x2f558e-0x0;var _0x434f60=_0x6b8b[_0x2f558e];return _0x434f60;};'use strict';var multer=require(_0xb6b8('0x0'));var util=require(_0xb6b8('0x1'));var path=require(_0xb6b8('0x2'));var timeout=require('connect-timeout');var express=require(_0xb6b8('0x3'));var router=express[_0xb6b8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb6b8('0x5'));var interaction=require(_0xb6b8('0x6'));var config=require(_0xb6b8('0x7'));var controller=require(_0xb6b8('0x8'));router[_0xb6b8('0x9')]('/',auth[_0xb6b8('0xa')](),controller['index']);router[_0xb6b8('0x9')](_0xb6b8('0xb'),auth[_0xb6b8('0xa')](),controller['show']);router['get']('/:id/items',auth['isAuthenticated'](),controller[_0xb6b8('0xc')]);router['post']('/',auth[_0xb6b8('0xa')](),controller[_0xb6b8('0xd')]);router[_0xb6b8('0xe')](_0xb6b8('0xf'),auth[_0xb6b8('0xa')](),controller[_0xb6b8('0x10')]);router[_0xb6b8('0xe')]('/:id/items',auth[_0xb6b8('0xa')](),controller['addItem']);router[_0xb6b8('0x11')](_0xb6b8('0xb'),auth[_0xb6b8('0xa')](),controller[_0xb6b8('0x12')]);router[_0xb6b8('0x13')](_0xb6b8('0xb'),auth[_0xb6b8('0xa')](),controller['destroy']);module[_0xb6b8('0x14')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 31f8f4d..959c99c 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 _0x4c60=['attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING'];(function(_0xe80803,_0x19c5d9){var _0x10f2b3=function(_0x318f4b){while(--_0x318f4b){_0xe80803['push'](_0xe80803['shift']());}};_0x10f2b3(++_0x19c5d9);}(_0x4c60,0xc1));var _0x04c6=function(_0x295872,_0x3bca98){_0x295872=_0x295872-0x0;var _0x51df6e=_0x4c60[_0x295872];return _0x51df6e;};'use strict';var Sequelize=require(_0x04c6('0x0'));var squel=require(_0x04c6('0x1'));var _=require(_0x04c6('0x2'));module[_0x04c6('0x3')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x04c6('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT']('long'),'get':function(){try{return JSON['parse'](this['getDataValue'](_0x04c6('0x5')));}catch(_0xc6e772){return[];}},'set':function(_0x2054da){try{this[_0x04c6('0x6')](_0x04c6('0x5'),JSON[_0x04c6('0x7')](_0x2054da));}catch(_0x8f9b13){this['setDataValue'](_0x04c6('0x5'),JSON[_0x04c6('0x7')]([]));}}},'sizeX':{'type':Sequelize[_0x04c6('0x8')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x04c6('0x8')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x04c6('0x9'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x04c6('0xa'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x04c6('0x4')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0x46ed=['sequelize','squel','exports','STRING','long','parse','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3'];(function(_0x2067e9,_0x5e6a97){var _0x280ce4=function(_0x2eca23){while(--_0x2eca23){_0x2067e9['push'](_0x2067e9['shift']());}};_0x280ce4(++_0x5e6a97);}(_0x46ed,0x168));var _0xd46e=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x46ed[_0x599f41];return _0x2e4d58;};'use strict';var Sequelize=require(_0xd46e('0x0'));var squel=require(_0xd46e('0x1'));var _=require('lodash');module[_0xd46e('0x2')]={'title':{'type':Sequelize[_0xd46e('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xd46e('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0xd46e('0x4')),'get':function(){try{return JSON[_0xd46e('0x5')](this['getDataValue'](_0xd46e('0x6')));}catch(_0x1926d9){return[];}},'set':function(_0x160bcf){try{this[_0xd46e('0x7')](_0xd46e('0x6'),JSON[_0xd46e('0x8')](_0x160bcf));}catch(_0x437ea0){this[_0xd46e('0x7')](_0xd46e('0x6'),JSON[_0xd46e('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0xd46e('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xd46e('0x9')]},'col':{'type':Sequelize[_0xd46e('0x9')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd46e('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xd46e('0x3')],'allowNull':![],'defaultValue':_0xd46e('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xd46e('0x3')]},'titleFontSize':{'type':Sequelize[_0xd46e('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 b89b83d..175c8df 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 _0x250c=['show','params','model','keys','rawAttributes','query','intersection','attributes','fields','length','include','merge','find','catch','DashboardItem','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','type','attrRefresh','widgetAttributes:\x20%s','create','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send'];(function(_0x1a6304,_0x37b41e){var _0x825ac7=function(_0x342321){while(--_0x342321){_0x1a6304['push'](_0x1a6304['shift']());}};_0x825ac7(++_0x37b41e);}(_0x250c,0x135));var _0xc250=function(_0x985416,_0x3bba68){_0x985416=_0x985416-0x0;var _0x416937=_0x250c[_0x985416];return _0x416937;};'use strict';var emlformat=require(_0xc250('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc250('0x1'));var jsonpatch=require(_0xc250('0x2'));var rp=require(_0xc250('0x3'));var moment=require('moment');var BPromise=require(_0xc250('0x4'));var Mustache=require(_0xc250('0x5'));var util=require(_0xc250('0x6'));var path=require(_0xc250('0x7'));var sox=require('sox');var csv=require(_0xc250('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc250('0x9'));var _=require(_0xc250('0xa'));var squel=require(_0xc250('0xb'));var crypto=require(_0xc250('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc250('0xd'));var toCsv=require(_0xc250('0x8'));var querystring=require('querystring');var Papa=require(_0xc250('0xe'));var Redis=require('ioredis');var authService=require(_0xc250('0xf'));var qs=require(_0xc250('0x10'));var as=require(_0xc250('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc250('0x12'))('api');var utils=require(_0xc250('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xc250('0x14'));var db=require(_0xc250('0x15'))['db'];config[_0xc250('0x16')]=_[_0xc250('0x17')](config[_0xc250('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xc250('0x18'))(new Redis(config[_0xc250('0x16')]));require(_0xc250('0x19'))[_0xc250('0x1a')](socket);function respondWithStatusCode(_0x2790f8,_0x2aab22){_0x2aab22=_0x2aab22||0xcc;return function(_0x807017){if(_0x807017){return _0x2790f8['sendStatus'](_0x2aab22);}return _0x2790f8[_0xc250('0x1b')](_0x2aab22)[_0xc250('0x1c')]();};}function respondWithResult(_0x5bd982,_0x2d4c9b){_0x2d4c9b=_0x2d4c9b||0xc8;return function(_0x56755c){if(_0x56755c){return _0x5bd982[_0xc250('0x1b')](_0x2d4c9b)['json'](_0x56755c);}};}function respondWithFilteredResult(_0x2b4909,_0x135ea6){return function(_0x3ce3cf){if(_0x3ce3cf){var _0x127b94=typeof _0x135ea6[_0xc250('0x1d')]===_0xc250('0x1e')&&typeof _0x135ea6[_0xc250('0x1f')]==='undefined';var _0x553bcf=_0x3ce3cf[_0xc250('0x20')];var _0x1e58a7=_0x127b94?0x0:_0x135ea6[_0xc250('0x1d')];var _0x146a0e=_0x127b94?_0x3ce3cf[_0xc250('0x20')]:_0x135ea6[_0xc250('0x1d')]+_0x135ea6[_0xc250('0x1f')];var _0x304e1a;if(_0x146a0e>=_0x553bcf){_0x146a0e=_0x553bcf;_0x304e1a=0xc8;}else{_0x304e1a=0xce;}_0x2b4909['status'](_0x304e1a);return _0x2b4909[_0xc250('0x21')](_0xc250('0x22'),_0x1e58a7+'-'+_0x146a0e+'/'+_0x553bcf)[_0xc250('0x23')](_0x3ce3cf);}return null;};}function patchUpdates(_0x343e07){return function(_0x25b7bc){try{jsonpatch[_0xc250('0x24')](_0x25b7bc,_0x343e07,!![]);}catch(_0x9d8811){return BPromise[_0xc250('0x25')](_0x9d8811);}return _0x25b7bc[_0xc250('0x26')]();};}function saveUpdates(_0x38ccd5,_0x3359d4){return function(_0x3f3e69){if(_0x3f3e69){return _0x3f3e69[_0xc250('0x27')](_0x38ccd5)['then'](function(_0x6912e3){return _0x6912e3;});}return null;};}function removeEntity(_0x33e48c,_0x4adff0){return function(_0x1929ef){if(_0x1929ef){return _0x1929ef[_0xc250('0x28')]()[_0xc250('0x29')](function(){_0x33e48c[_0xc250('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56ee21,_0x657063){return function(_0x479f00){if(!_0x479f00){_0x56ee21[_0xc250('0x2a')](0x194);}return _0x479f00;};}function handleError(_0xce47a0,_0x545f36){_0x545f36=_0x545f36||0x1f4;return function(_0x155eac){logger[_0xc250('0x2b')](_0x155eac[_0xc250('0x2c')]);if(_0x155eac[_0xc250('0x2d')]){delete _0x155eac['name'];}_0xce47a0['status'](_0x545f36)[_0xc250('0x2e')](_0x155eac);};}exports[_0xc250('0x2f')]=function(_0xd7a93c,_0x2cb880){var _0x285e9a={'raw':![],'where':{'id':_0xd7a93c[_0xc250('0x30')]['id']}},_0x48eed2={};_0x48eed2[_0xc250('0x31')]=_[_0xc250('0x32')](db['DashboardItem'][_0xc250('0x33')]);_0x48eed2[_0xc250('0x34')]=_[_0xc250('0x32')](_0xd7a93c[_0xc250('0x34')]);_0x48eed2['filters']=_[_0xc250('0x35')](_0x48eed2[_0xc250('0x31')],_0x48eed2[_0xc250('0x34')]);_0x285e9a[_0xc250('0x36')]=_[_0xc250('0x35')](_0x48eed2[_0xc250('0x31')],qs[_0xc250('0x37')](_0xd7a93c[_0xc250('0x34')]['fields']));_0x285e9a[_0xc250('0x36')]=_0x285e9a[_0xc250('0x36')][_0xc250('0x38')]?_0x285e9a[_0xc250('0x36')]:_0x48eed2[_0xc250('0x31')];if(_0xd7a93c[_0xc250('0x34')]['includeAll']){_0x285e9a[_0xc250('0x39')]=[{'all':!![]}];}_0x285e9a=_[_0xc250('0x3a')]({},_0x285e9a,_0xd7a93c['options']);return db['DashboardItem'][_0xc250('0x3b')](_0x285e9a)['then'](handleEntityNotFound(_0x2cb880,null))[_0xc250('0x29')](respondWithResult(_0x2cb880,null))[_0xc250('0x3c')](handleError(_0x2cb880,null));};exports[_0xc250('0x28')]=function(_0x5952b8,_0x40c660){return db[_0xc250('0x3d')][_0xc250('0x3b')]({'where':{'id':_0x5952b8[_0xc250('0x30')]['id']}})[_0xc250('0x29')](handleEntityNotFound(_0x40c660,null))[_0xc250('0x29')](removeEntity(_0x40c660,null))[_0xc250('0x3c')](handleError(_0x40c660,null));};function widgetAttributes(_0x3a5b52){try{switch(_0x3a5b52['type']){case'iframe':return[{'name':_0xc250('0x3e'),'value':_0x3a5b52[_0xc250('0x3e')]||(_0x3a5b52[_0xc250('0x3f')]&&_0x3a5b52[_0xc250('0x3f')][0x0]?_0x3a5b52[_0xc250('0x3f')][0x0][_0xc250('0x40')]:undefined)||'https://'}];case _0xc250('0x41'):return[{'name':_0xc250('0x42'),'value':_0x3a5b52[_0xc250('0x42')]||(_0x3a5b52[_0xc250('0x3f')]&&_0x3a5b52[_0xc250('0x3f')][0x0]?_0x3a5b52[_0xc250('0x3f')][0x0]['value']:undefined)||''}];case _0xc250('0x43'):return[{'name':'attrHourFormat','value':_0x3a5b52[_0xc250('0x44')]||(_0x3a5b52[_0xc250('0x3f')]&&_0x3a5b52[_0xc250('0x3f')][0x0]?_0x3a5b52['attrs'][0x0][_0xc250('0x40')]:undefined)||_0xc250('0x45')},{'name':_0xc250('0x46'),'value':_0x3a5b52[_0xc250('0x46')]||(_0x3a5b52[_0xc250('0x3f')]&&_0x3a5b52[_0xc250('0x3f')][0x1]?_0x3a5b52['attrs'][0x1]['value']:undefined)||_0xc250('0x47')},{'name':'attrFontSize','value':_0x3a5b52[_0xc250('0x48')]||(_0x3a5b52[_0xc250('0x3f')]&&_0x3a5b52[_0xc250('0x3f')][0x2]?_0x3a5b52[_0xc250('0x3f')][0x2][_0xc250('0x40')]:undefined)||0xc}];case _0xc250('0x49'):return[{'name':'attrMetric','value':_0x3a5b52[_0xc250('0x4a')]||(_0x3a5b52['attrs']&&_0x3a5b52[_0xc250('0x3f')][0x0]?_0x3a5b52[_0xc250('0x3f')][0x0][_0xc250('0x40')]:undefined)||_0xc250('0x4b')},{'name':_0xc250('0x4c'),'value':_0x3a5b52['attrVoiceQueues']||(_0x3a5b52[_0xc250('0x3f')]&&_0x3a5b52[_0xc250('0x3f')][0x1]?_0x3a5b52[_0xc250('0x3f')][0x1][_0xc250('0x40')]:undefined)||[]},{'name':_0xc250('0x48'),'value':_0x3a5b52['attrFontSize']||(_0x3a5b52[_0xc250('0x3f')]&&_0x3a5b52[_0xc250('0x3f')][0x2]?_0x3a5b52[_0xc250('0x3f')][0x2][_0xc250('0x40')]:undefined)||0x14}];case _0xc250('0x4d'):case _0xc250('0x4e'):return[{'name':_0xc250('0x4f'),'value':_0x3a5b52[_0xc250('0x4f')]||(_0x3a5b52['attrs']&&_0x3a5b52['attrs'][0x0]?_0x3a5b52[_0xc250('0x3f')][0x0][_0xc250('0x40')]:undefined)||'total'},{'name':_0xc250('0x50'),'value':_0x3a5b52[_0xc250('0x50')]||(_0x3a5b52[_0xc250('0x3f')]&&_0x3a5b52[_0xc250('0x3f')][0x1]?_0x3a5b52[_0xc250('0x3f')][0x1][_0xc250('0x40')]:undefined)||null},{'name':_0xc250('0x51'),'value':_0x3a5b52[_0xc250('0x51')]||(_0x3a5b52['attrs']&&_0x3a5b52[_0xc250('0x3f')][0x2]?_0x3a5b52[_0xc250('0x3f')][0x2][_0xc250('0x40')]:undefined)||null},{'name':_0xc250('0x4c'),'value':_0x3a5b52['attrVoiceQueues']||(_0x3a5b52[_0xc250('0x3f')]&&_0x3a5b52[_0xc250('0x3f')][0x3]?_0x3a5b52['attrs'][0x3][_0xc250('0x40')]:undefined)||[]}];case'web-report':return[{'name':_0xc250('0x52'),'type':_0x3a5b52[_0xc250('0x53')]||(_0x3a5b52[_0xc250('0x3f')]&&_0x3a5b52[_0xc250('0x3f')][0x0]?_0x3a5b52[_0xc250('0x3f')][0x0][_0xc250('0x54')]:undefined)||null,'value':_0x3a5b52[_0xc250('0x52')]||(_0x3a5b52[_0xc250('0x3f')]&&_0x3a5b52['attrs'][0x0]?_0x3a5b52[_0xc250('0x3f')][0x0][_0xc250('0x40')]:undefined)||null},{'name':_0xc250('0x55'),'value':_0x3a5b52[_0xc250('0x55')]||(_0x3a5b52[_0xc250('0x3f')]&&_0x3a5b52['attrs'][0x1]?_0x3a5b52[_0xc250('0x3f')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x59c813){logger[_0xc250('0x2b')](_0xc250('0x56'),JSON['stringify'](_0x59c813));return[];}}exports[_0xc250('0x57')]=function(_0x48a6c4,_0x7090c3){if(_0x48a6c4['body']){_0x48a6c4[_0xc250('0x58')][_0xc250('0x3f')]=widgetAttributes(_0x48a6c4[_0xc250('0x58')]);}return db[_0xc250('0x3d')][_0xc250('0x57')](_0x48a6c4[_0xc250('0x58')],{})[_0xc250('0x29')](respondWithResult(_0x7090c3,0xc9))[_0xc250('0x3c')](handleError(_0x7090c3,null));};exports[_0xc250('0x27')]=function(_0x4ad5d1,_0xb45d46){if(_0x4ad5d1[_0xc250('0x58')]['id']){delete _0x4ad5d1[_0xc250('0x58')]['id'];}_0x4ad5d1[_0xc250('0x58')][_0xc250('0x3f')]=widgetAttributes(_0x4ad5d1[_0xc250('0x58')]);return db['DashboardItem'][_0xc250('0x3b')]({'where':{'id':_0x4ad5d1[_0xc250('0x30')]['id']}})[_0xc250('0x29')](handleEntityNotFound(_0xb45d46,null))['then'](saveUpdates(_0x4ad5d1[_0xc250('0x58')],null))[_0xc250('0x29')](respondWithResult(_0xb45d46,null))[_0xc250('0x3c')](handleError(_0xb45d46,null));}; \ No newline at end of file +var _0x1ab4=['sendStatus','end','offset','undefined','count','limit','status','set','Content-Range','json','reject','save','update','destroy','then','stack','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','attributes','intersection','fields','length','includeAll','merge','options','find','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','error','widgetAttributes:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','defaults','localhost','redis','./dashboardItem.socket'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x1ab4,0x95));var _0x41ab=function(_0x470636,_0x2099af){_0x470636=_0x470636-0x0;var _0x5734e7=_0x1ab4[_0x470636];return _0x5734e7;};'use strict';var emlformat=require(_0x41ab('0x0'));var rimraf=require(_0x41ab('0x1'));var zipdir=require(_0x41ab('0x2'));var jsonpatch=require(_0x41ab('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x41ab('0x4'));var Mustache=require(_0x41ab('0x5'));var util=require('util');var path=require(_0x41ab('0x6'));var sox=require(_0x41ab('0x7'));var csv=require('to-csv');var ejs=require(_0x41ab('0x8'));var fs=require('fs');var fs_extra=require(_0x41ab('0x9'));var _=require(_0x41ab('0xa'));var squel=require('squel');var crypto=require(_0x41ab('0xb'));var jsforce=require(_0x41ab('0xc'));var deskjs=require(_0x41ab('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x41ab('0xe'));var Redis=require(_0x41ab('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x41ab('0x10'));var logger=require(_0x41ab('0x11'))('api');var utils=require(_0x41ab('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x41ab('0x13')](config['redis'],{'host':_0x41ab('0x14'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x41ab('0x15')]));require(_0x41ab('0x16'))['register'](socket);function respondWithStatusCode(_0x4b7d55,_0x52eddf){_0x52eddf=_0x52eddf||0xcc;return function(_0x586aff){if(_0x586aff){return _0x4b7d55[_0x41ab('0x17')](_0x52eddf);}return _0x4b7d55['status'](_0x52eddf)[_0x41ab('0x18')]();};}function respondWithResult(_0x3f787d,_0x3adbe2){_0x3adbe2=_0x3adbe2||0xc8;return function(_0x58c843){if(_0x58c843){return _0x3f787d['status'](_0x3adbe2)['json'](_0x58c843);}};}function respondWithFilteredResult(_0x2903eb,_0x471334){return function(_0x59cad0){if(_0x59cad0){var _0x1e14be=typeof _0x471334[_0x41ab('0x19')]===_0x41ab('0x1a')&&typeof _0x471334['limit']===_0x41ab('0x1a');var _0x1ae5e4=_0x59cad0['count'];var _0x47ac5c=_0x1e14be?0x0:_0x471334[_0x41ab('0x19')];var _0x12a905=_0x1e14be?_0x59cad0[_0x41ab('0x1b')]:_0x471334[_0x41ab('0x19')]+_0x471334[_0x41ab('0x1c')];var _0x5d245c;if(_0x12a905>=_0x1ae5e4){_0x12a905=_0x1ae5e4;_0x5d245c=0xc8;}else{_0x5d245c=0xce;}_0x2903eb[_0x41ab('0x1d')](_0x5d245c);return _0x2903eb[_0x41ab('0x1e')](_0x41ab('0x1f'),_0x47ac5c+'-'+_0x12a905+'/'+_0x1ae5e4)[_0x41ab('0x20')](_0x59cad0);}return null;};}function patchUpdates(_0x48c41c){return function(_0x5b00b1){try{jsonpatch['apply'](_0x5b00b1,_0x48c41c,!![]);}catch(_0x175344){return BPromise[_0x41ab('0x21')](_0x175344);}return _0x5b00b1[_0x41ab('0x22')]();};}function saveUpdates(_0x17b59e,_0x8e8561){return function(_0x157fcc){if(_0x157fcc){return _0x157fcc[_0x41ab('0x23')](_0x17b59e)['then'](function(_0x2d9fed){return _0x2d9fed;});}return null;};}function removeEntity(_0x526839,_0x19e839){return function(_0x2912e3){if(_0x2912e3){return _0x2912e3[_0x41ab('0x24')]()[_0x41ab('0x25')](function(){_0x526839[_0x41ab('0x1d')](0xcc)[_0x41ab('0x18')]();});}};}function handleEntityNotFound(_0x50c001,_0x282a71){return function(_0x51ef22){if(!_0x51ef22){_0x50c001['sendStatus'](0x194);}return _0x51ef22;};}function handleError(_0x3433d0,_0x4ed2b5){_0x4ed2b5=_0x4ed2b5||0x1f4;return function(_0x2e7931){logger['error'](_0x2e7931[_0x41ab('0x26')]);if(_0x2e7931[_0x41ab('0x27')]){delete _0x2e7931[_0x41ab('0x27')];}_0x3433d0[_0x41ab('0x1d')](_0x4ed2b5)[_0x41ab('0x28')](_0x2e7931);};}exports[_0x41ab('0x29')]=function(_0x534aa6,_0x129d0e){var _0x4d5c54={'raw':![],'where':{'id':_0x534aa6[_0x41ab('0x2a')]['id']}},_0xff21a0={};_0xff21a0[_0x41ab('0x2b')]=_[_0x41ab('0x2c')](db[_0x41ab('0x2d')][_0x41ab('0x2e')]);_0xff21a0[_0x41ab('0x2f')]=_[_0x41ab('0x2c')](_0x534aa6['query']);_0xff21a0['filters']=_['intersection'](_0xff21a0[_0x41ab('0x2b')],_0xff21a0[_0x41ab('0x2f')]);_0x4d5c54[_0x41ab('0x30')]=_[_0x41ab('0x31')](_0xff21a0[_0x41ab('0x2b')],qs[_0x41ab('0x32')](_0x534aa6['query'][_0x41ab('0x32')]));_0x4d5c54['attributes']=_0x4d5c54[_0x41ab('0x30')][_0x41ab('0x33')]?_0x4d5c54[_0x41ab('0x30')]:_0xff21a0['model'];if(_0x534aa6[_0x41ab('0x2f')][_0x41ab('0x34')]){_0x4d5c54['include']=[{'all':!![]}];}_0x4d5c54=_[_0x41ab('0x35')]({},_0x4d5c54,_0x534aa6[_0x41ab('0x36')]);return db[_0x41ab('0x2d')][_0x41ab('0x37')](_0x4d5c54)[_0x41ab('0x25')](handleEntityNotFound(_0x129d0e,null))['then'](respondWithResult(_0x129d0e,null))[_0x41ab('0x38')](handleError(_0x129d0e,null));};exports[_0x41ab('0x24')]=function(_0x2a782d,_0x58bb2d){return db[_0x41ab('0x2d')][_0x41ab('0x37')]({'where':{'id':_0x2a782d[_0x41ab('0x2a')]['id']}})['then'](handleEntityNotFound(_0x58bb2d,null))['then'](removeEntity(_0x58bb2d,null))[_0x41ab('0x38')](handleError(_0x58bb2d,null));};function widgetAttributes(_0x4e611a){try{switch(_0x4e611a[_0x41ab('0x39')]){case _0x41ab('0x3a'):return[{'name':_0x41ab('0x3b'),'value':_0x4e611a['attrUrl']||(_0x4e611a[_0x41ab('0x3c')]&&_0x4e611a[_0x41ab('0x3c')][0x0]?_0x4e611a['attrs'][0x0][_0x41ab('0x3d')]:undefined)||_0x41ab('0x3e')}];case _0x41ab('0x3f'):return[{'name':_0x41ab('0x40'),'value':_0x4e611a[_0x41ab('0x40')]||(_0x4e611a[_0x41ab('0x3c')]&&_0x4e611a[_0x41ab('0x3c')][0x0]?_0x4e611a[_0x41ab('0x3c')][0x0][_0x41ab('0x3d')]:undefined)||''}];case _0x41ab('0x41'):return[{'name':_0x41ab('0x42'),'value':_0x4e611a[_0x41ab('0x42')]||(_0x4e611a['attrs']&&_0x4e611a[_0x41ab('0x3c')][0x0]?_0x4e611a[_0x41ab('0x3c')][0x0][_0x41ab('0x3d')]:undefined)||_0x41ab('0x43')},{'name':'attrTimezone','value':_0x4e611a[_0x41ab('0x44')]||(_0x4e611a['attrs']&&_0x4e611a['attrs'][0x1]?_0x4e611a['attrs'][0x1][_0x41ab('0x3d')]:undefined)||_0x41ab('0x45')},{'name':'attrFontSize','value':_0x4e611a[_0x41ab('0x46')]||(_0x4e611a['attrs']&&_0x4e611a[_0x41ab('0x3c')][0x2]?_0x4e611a['attrs'][0x2][_0x41ab('0x3d')]:undefined)||0xc}];case _0x41ab('0x47'):return[{'name':_0x41ab('0x48'),'value':_0x4e611a['attrMetric']||(_0x4e611a[_0x41ab('0x3c')]&&_0x4e611a[_0x41ab('0x3c')][0x0]?_0x4e611a[_0x41ab('0x3c')][0x0]['value']:undefined)||_0x41ab('0x49')},{'name':_0x41ab('0x4a'),'value':_0x4e611a[_0x41ab('0x4a')]||(_0x4e611a[_0x41ab('0x3c')]&&_0x4e611a[_0x41ab('0x3c')][0x1]?_0x4e611a[_0x41ab('0x3c')][0x1][_0x41ab('0x3d')]:undefined)||[]},{'name':_0x41ab('0x46'),'value':_0x4e611a[_0x41ab('0x46')]||(_0x4e611a[_0x41ab('0x3c')]&&_0x4e611a[_0x41ab('0x3c')][0x2]?_0x4e611a[_0x41ab('0x3c')][0x2]['value']:undefined)||0x14}];case _0x41ab('0x4b'):case _0x41ab('0x4c'):return[{'name':_0x41ab('0x4d'),'value':_0x4e611a[_0x41ab('0x4d')]||(_0x4e611a[_0x41ab('0x3c')]&&_0x4e611a[_0x41ab('0x3c')][0x0]?_0x4e611a[_0x41ab('0x3c')][0x0][_0x41ab('0x3d')]:undefined)||'total'},{'name':'attrSerie2','value':_0x4e611a[_0x41ab('0x4e')]||(_0x4e611a['attrs']&&_0x4e611a['attrs'][0x1]?_0x4e611a[_0x41ab('0x3c')][0x1][_0x41ab('0x3d')]:undefined)||null},{'name':_0x41ab('0x4f'),'value':_0x4e611a['attrSerie3']||(_0x4e611a['attrs']&&_0x4e611a[_0x41ab('0x3c')][0x2]?_0x4e611a[_0x41ab('0x3c')][0x2][_0x41ab('0x3d')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x4e611a[_0x41ab('0x4a')]||(_0x4e611a[_0x41ab('0x3c')]&&_0x4e611a[_0x41ab('0x3c')][0x3]?_0x4e611a['attrs'][0x3]['value']:undefined)||[]}];case _0x41ab('0x50'):return[{'name':_0x41ab('0x51'),'type':_0x4e611a[_0x41ab('0x52')]||(_0x4e611a[_0x41ab('0x3c')]&&_0x4e611a['attrs'][0x0]?_0x4e611a[_0x41ab('0x3c')][0x0]['type']:undefined)||null,'value':_0x4e611a[_0x41ab('0x51')]||(_0x4e611a[_0x41ab('0x3c')]&&_0x4e611a['attrs'][0x0]?_0x4e611a[_0x41ab('0x3c')][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x4e611a['attrRefresh']||(_0x4e611a[_0x41ab('0x3c')]&&_0x4e611a[_0x41ab('0x3c')][0x1]?_0x4e611a[_0x41ab('0x3c')][0x1][_0x41ab('0x3d')]:undefined)||0x0}];default:return[];}}catch(_0x243f5c){logger[_0x41ab('0x53')](_0x41ab('0x54'),JSON['stringify'](_0x243f5c));return[];}}exports['create']=function(_0x470917,_0x10dbde){if(_0x470917[_0x41ab('0x55')]){_0x470917['body'][_0x41ab('0x3c')]=widgetAttributes(_0x470917[_0x41ab('0x55')]);}return db[_0x41ab('0x2d')]['create'](_0x470917['body'],{})[_0x41ab('0x25')](respondWithResult(_0x10dbde,0xc9))[_0x41ab('0x38')](handleError(_0x10dbde,null));};exports[_0x41ab('0x23')]=function(_0xbad18b,_0x211097){if(_0xbad18b['body']['id']){delete _0xbad18b[_0x41ab('0x55')]['id'];}_0xbad18b[_0x41ab('0x55')][_0x41ab('0x3c')]=widgetAttributes(_0xbad18b[_0x41ab('0x55')]);return db[_0x41ab('0x2d')]['find']({'where':{'id':_0xbad18b['params']['id']}})[_0x41ab('0x25')](handleEntityNotFound(_0x211097,null))[_0x41ab('0x25')](saveUpdates(_0xbad18b[_0x41ab('0x55')],null))['then'](respondWithResult(_0x211097,null))[_0x41ab('0x38')](handleError(_0x211097,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index db89361..feb5cec 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 _0xd248=['../../mysqldb','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x115159,_0xbb2343){var _0x4b886d=function(_0x3fafe1){while(--_0x3fafe1){_0x115159['push'](_0x115159['shift']());}};_0x4b886d(++_0xbb2343);}(_0xd248,0x11f));var _0x8d24=function(_0x2debb4,_0xdcc685){_0x2debb4=_0x2debb4-0x0;var _0x427de3=_0xd248[_0x2debb4];return _0x427de3;};'use strict';var EventEmitter=require(_0x8d24('0x0'));var DashboardItem=require(_0x8d24('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8d24('0x2'),'afterUpdate':_0x8d24('0x3'),'afterDestroy':_0x8d24('0x4')};function emitEvent(_0x39c48f){return function(_0x9ea700,_0x4952f1,_0x287b7c){DashboardItemEvents['emit'](_0x39c48f+':'+_0x9ea700['id'],_0x9ea700);DashboardItemEvents[_0x8d24('0x5')](_0x39c48f,_0x9ea700);_0x287b7c(null);};}for(var e in events){if(events[_0x8d24('0x6')](e)){var event=events[e];DashboardItem[_0x8d24('0x7')](e,emitEvent(event));}}module[_0x8d24('0x8')]=DashboardItemEvents; \ No newline at end of file +var _0xb0cb=['DashboardItem','emit','hook','../../mysqldb'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0xb0cb,0x1c3));var _0xbb0c=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xb0cb[_0x88cd7b];return _0x56fcc8;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0xbb0c('0x0'))['db'][_0xbb0c('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xbd5330){return function(_0x4a10f9,_0x2143ce,_0x100cfd){DashboardItemEvents[_0xbb0c('0x2')](_0xbd5330+':'+_0x4a10f9['id'],_0x4a10f9);DashboardItemEvents[_0xbb0c('0x2')](_0xbd5330,_0x4a10f9);_0x100cfd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0xbb0c('0x3')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 454d6ac..ed9170b 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 _0x8d02=['moment','bluebird','request-promise','path','rimraf','./dashboardItem.attributes','exports','DashboardItem','dashboard_items'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x8d02,0x13b));var _0x28d0=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x8d02[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x28d0('0x0'));var BPromise=require(_0x28d0('0x1'));var rp=require(_0x28d0('0x2'));var fs=require('fs');var path=require(_0x28d0('0x3'));var rimraf=require(_0x28d0('0x4'));var config=require('../../config/environment');var attributes=require(_0x28d0('0x5'));module[_0x28d0('0x6')]=function(_0x1543c0,_0x23b77c){return _0x1543c0['define'](_0x28d0('0x7'),attributes,{'tableName':_0x28d0('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0830=['api','bluebird','request-promise','path','../../config/environment','exports','define','dashboard_items','lodash','util'];(function(_0x113a80,_0x5f02bf){var _0x3bcbda=function(_0x1e5533){while(--_0x1e5533){_0x113a80['push'](_0x113a80['shift']());}};_0x3bcbda(++_0x5f02bf);}(_0x0830,0xd0));var _0x0083=function(_0x43f9fd,_0x3bb23c){_0x43f9fd=_0x43f9fd-0x0;var _0x15360e=_0x0830[_0x43f9fd];return _0x15360e;};'use strict';var _=require(_0x0083('0x0'));var util=require(_0x0083('0x1'));var logger=require('../../config/logger')(_0x0083('0x2'));var moment=require('moment');var BPromise=require(_0x0083('0x3'));var rp=require(_0x0083('0x4'));var fs=require('fs');var path=require(_0x0083('0x5'));var rimraf=require('rimraf');var config=require(_0x0083('0x6'));var attributes=require('./dashboardItem.attributes');module[_0x0083('0x7')]=function(_0x2c47aa,_0x325a7a){return _0x2c47aa[_0x0083('0x8')]('DashboardItem',attributes,{'tableName':_0x0083('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 10f92a6..3f24518 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 _0x3de9=['randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./dashboardItem.socket','register','request','info','request\x20sent','debug','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','result','catch','util'];(function(_0x4dc095,_0x2e510e){var _0x37b1b1=function(_0x3e6001){while(--_0x3e6001){_0x4dc095['push'](_0x4dc095['shift']());}};_0x37b1b1(++_0x2e510e);}(_0x3de9,0x1f3));var _0x93de=function(_0x522f80,_0x1f8ebb){_0x522f80=_0x522f80-0x0;var _0x8f37e3=_0x3de9[_0x522f80];return _0x8f37e3;};'use strict';var _=require('lodash');var util=require(_0x93de('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x93de('0x1'));var fs=require('fs');var Redis=require(_0x93de('0x2'));var db=require(_0x93de('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x93de('0x4'));var config=require(_0x93de('0x5'));var jayson=require(_0x93de('0x6'));var client=jayson[_0x93de('0x7')][_0x93de('0x8')]({'port':0x232a});config[_0x93de('0x9')]=_[_0x93de('0xa')](config[_0x93de('0x9')],{'host':_0x93de('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x93de('0x9')]));require(_0x93de('0xc'))[_0x93de('0xd')](socket);function respondWithRpcPromise(_0x39bdf8,_0x3ce8b0,_0x19a504){return new BPromise(function(_0x13f359,_0x180b21){return client[_0x93de('0xe')](_0x39bdf8,_0x19a504)['then'](function(_0x37dfa4){logger[_0x93de('0xf')]('DashboardItem,\x20%s,\x20%s',_0x3ce8b0,_0x93de('0x10'));logger[_0x93de('0x11')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x3ce8b0,'request\x20sent',JSON[_0x93de('0x12')](_0x37dfa4));if(_0x37dfa4[_0x93de('0x13')]){if(_0x37dfa4[_0x93de('0x13')][_0x93de('0x14')]===0x1f4){logger[_0x93de('0x13')](_0x93de('0x15'),_0x3ce8b0,_0x37dfa4[_0x93de('0x13')]['message']);return _0x180b21(_0x37dfa4['error'][_0x93de('0x16')]);}logger[_0x93de('0x13')](_0x93de('0x15'),_0x3ce8b0,_0x37dfa4['error'][_0x93de('0x16')]);return _0x13f359(_0x37dfa4['error']['message']);}else{logger[_0x93de('0xf')](_0x93de('0x15'),_0x3ce8b0,_0x93de('0x10'));_0x13f359(_0x37dfa4[_0x93de('0x17')][_0x93de('0x16')]);}})[_0x93de('0x18')](function(_0x28f081){logger[_0x93de('0x13')](_0x93de('0x15'),_0x3ce8b0,_0x28f081);_0x180b21(_0x28f081);});});} \ No newline at end of file +var _0x61e0=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','defaults','redis','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','util'];(function(_0x4778bc,_0x49e9d5){var _0x49a73a=function(_0x277e22){while(--_0x277e22){_0x4778bc['push'](_0x4778bc['shift']());}};_0x49a73a(++_0x49e9d5);}(_0x61e0,0x95));var _0x061e=function(_0x564ec3,_0x4d2d88){_0x564ec3=_0x564ec3-0x0;var _0x5bb1a1=_0x61e0[_0x564ec3];return _0x5bb1a1;};'use strict';var _=require('lodash');var util=require(_0x061e('0x0'));var moment=require(_0x061e('0x1'));var BPromise=require(_0x061e('0x2'));var rs=require(_0x061e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x061e('0x4'))['db'];var utils=require(_0x061e('0x5'));var logger=require(_0x061e('0x6'))(_0x061e('0x7'));var config=require(_0x061e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x061e('0x9')]['http']({'port':0x232a});config['redis']=_[_0x061e('0xa')](config[_0x061e('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x061e('0xc'))[_0x061e('0xd')](socket);function respondWithRpcPromise(_0xcc25,_0x13e063,_0x1d6bcf){return new BPromise(function(_0x1f6ef2,_0x406273){return client[_0x061e('0xe')](_0xcc25,_0x1d6bcf)[_0x061e('0xf')](function(_0x32b485){logger[_0x061e('0x10')](_0x061e('0x11'),_0x13e063,'request\x20sent');logger[_0x061e('0x12')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x13e063,_0x061e('0x13'),JSON[_0x061e('0x14')](_0x32b485));if(_0x32b485[_0x061e('0x15')]){if(_0x32b485[_0x061e('0x15')]['code']===0x1f4){logger[_0x061e('0x15')](_0x061e('0x11'),_0x13e063,_0x32b485[_0x061e('0x15')]['message']);return _0x406273(_0x32b485[_0x061e('0x15')][_0x061e('0x16')]);}logger['error'](_0x061e('0x11'),_0x13e063,_0x32b485['error'][_0x061e('0x16')]);return _0x1f6ef2(_0x32b485['error'][_0x061e('0x16')]);}else{logger[_0x061e('0x10')](_0x061e('0x11'),_0x13e063,_0x061e('0x13'));_0x1f6ef2(_0x32b485[_0x061e('0x17')][_0x061e('0x16')]);}})[_0x061e('0x18')](function(_0x14efe1){logger[_0x061e('0x15')](_0x061e('0x11'),_0x13e063,_0x14efe1);_0x406273(_0x14efe1);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index a9d8b05..41f5257 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 _0x8c24=['register','length','dashboardItem:','./dashboardItem.events','save','emit','removeListener'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x8c24,0x130));var _0x48c2=function(_0x3ee9d6,_0x11b438){_0x3ee9d6=_0x3ee9d6-0x0;var _0x3cda3b=_0x8c24[_0x3ee9d6];return _0x3cda3b;};'use strict';var DashboardItemEvents=require(_0x48c2('0x0'));var events=[_0x48c2('0x1'),'remove','update'];function createListener(_0x4e637c,_0x2087e8){return function(_0x30e6d2){_0x2087e8[_0x48c2('0x2')](_0x4e637c,_0x30e6d2);};}function removeListener(_0x58b0c0,_0x2d2bfe){return function(){DashboardItemEvents[_0x48c2('0x3')](_0x58b0c0,_0x2d2bfe);};}exports[_0x48c2('0x4')]=function(_0x284a61){for(var _0x24f903=0x0,_0x57c864=events[_0x48c2('0x5')];_0x24f903<_0x57c864;_0x24f903++){var _0x17a91=events[_0x24f903];var _0x3b7e58=createListener(_0x48c2('0x6')+_0x17a91,_0x284a61);DashboardItemEvents['on'](_0x17a91,_0x3b7e58);}}; \ No newline at end of file +var _0xf493=['removeListener','register','length','save','remove','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf493,0x130));var _0x3f49=function(_0x29ecce,_0x549ae1){_0x29ecce=_0x29ecce-0x0;var _0x3d6c1a=_0xf493[_0x29ecce];return _0x3d6c1a;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x3f49('0x0'),_0x3f49('0x1'),_0x3f49('0x2')];function createListener(_0x3a446f,_0x5072fc){return function(_0xb7a8a2){_0x5072fc[_0x3f49('0x3')](_0x3a446f,_0xb7a8a2);};}function removeListener(_0x38e181,_0x129b82){return function(){DashboardItemEvents[_0x3f49('0x4')](_0x38e181,_0x129b82);};}exports[_0x3f49('0x5')]=function(_0x4b7111){for(var _0x4ae392=0x0,_0x395055=events[_0x3f49('0x6')];_0x4ae392<_0x395055;_0x4ae392++){var _0x4a0d9c=events[_0x4ae392];var _0x509898=createListener('dashboardItem:'+_0x4a0d9c,_0x4b7111);DashboardItemEvents['on'](_0x4a0d9c,_0x509898);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index fb8838f..a9e5f88 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 _0x649a=['create','put','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','isAuthenticated','show','post'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0x649a,0x1df));var _0xa649=function(_0x21eb3c,_0x7ce88b){_0x21eb3c=_0x21eb3c-0x0;var _0x4bd2aa=_0x649a[_0x21eb3c];return _0x4bd2aa;};'use strict';var multer=require(_0xa649('0x0'));var util=require(_0xa649('0x1'));var path=require(_0xa649('0x2'));var timeout=require(_0xa649('0x3'));var express=require(_0xa649('0x4'));var router=express[_0xa649('0x5')]();var fs_extra=require(_0xa649('0x6'));var auth=require(_0xa649('0x7'));var interaction=require(_0xa649('0x8'));var config=require(_0xa649('0x9'));var controller=require(_0xa649('0xa'));router[_0xa649('0xb')]('/:id',auth[_0xa649('0xc')](),controller[_0xa649('0xd')]);router[_0xa649('0xe')]('/',auth[_0xa649('0xc')](),controller[_0xa649('0xf')]);router[_0xa649('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xa649('0x11')]('/:id',auth[_0xa649('0xc')](),controller[_0xa649('0x12')]);module['exports']=router; \ No newline at end of file +var _0x9358=['delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','post','create','put','update'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x9358,0x1ca));var _0x8935=function(_0x533c83,_0x1b5c63){_0x533c83=_0x533c83-0x0;var _0x16a68d=_0x9358[_0x533c83];return _0x16a68d;};'use strict';var multer=require(_0x8935('0x0'));var util=require(_0x8935('0x1'));var path=require(_0x8935('0x2'));var timeout=require(_0x8935('0x3'));var express=require('express');var router=express[_0x8935('0x4')]();var fs_extra=require(_0x8935('0x5'));var auth=require(_0x8935('0x6'));var interaction=require(_0x8935('0x7'));var config=require(_0x8935('0x8'));var controller=require('./dashboardItem.controller');router[_0x8935('0x9')](_0x8935('0xa'),auth[_0x8935('0xb')](),controller[_0x8935('0xc')]);router[_0x8935('0xd')]('/',auth[_0x8935('0xb')](),controller[_0x8935('0xe')]);router[_0x8935('0xf')](_0x8935('0xa'),auth[_0x8935('0xb')](),controller[_0x8935('0x10')]);router[_0x8935('0x11')](_0x8935('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x8935('0x12')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 821366c..ee37293 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 _0x4116=['first','second','third','sequelize','exports','STRING'];(function(_0x15ec4e,_0x40b7e0){var _0xb5e5dd=function(_0x42bdd7){while(--_0x42bdd7){_0x15ec4e['push'](_0x15ec4e['shift']());}};_0xb5e5dd(++_0x40b7e0);}(_0x4116,0x1d1));var _0x6411=function(_0x35d291,_0x1a131b){_0x35d291=_0x35d291-0x0;var _0x370b86=_0x4116[_0x35d291];return _0x370b86;};'use strict';var Sequelize=require(_0x6411('0x0'));module[_0x6411('0x1')]={'name':{'type':Sequelize[_0x6411('0x2')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0x6411('0x3'),_0x6411('0x4'),_0x6411('0x5')),'allowNull':![],'defaultValue':_0x6411('0x3')},'description':{'type':Sequelize[_0x6411('0x2')]}}; \ No newline at end of file +var _0xf431=['first','second','third','sequelize','exports','STRING','ENUM'];(function(_0x8afdd0,_0x548ad1){var _0x3de7ac=function(_0x2dc2c4){while(--_0x2dc2c4){_0x8afdd0['push'](_0x8afdd0['shift']());}};_0x3de7ac(++_0x548ad1);}(_0xf431,0x1d1));var _0x1f43=function(_0x5ee244,_0x3cfee0){_0x5ee244=_0x5ee244-0x0;var _0x30f5c8=_0xf431[_0x5ee244];return _0x30f5c8;};'use strict';var Sequelize=require(_0x1f43('0x0'));module[_0x1f43('0x1')]={'name':{'type':Sequelize[_0x1f43('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x1f43('0x3')](_0x1f43('0x4'),_0x1f43('0x5'),_0x1f43('0x6')),'allowNull':![],'defaultValue':_0x1f43('0x4')},'description':{'type':Sequelize[_0x1f43('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 2ad4564..dfda148 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 _0x3d46=['map','Disposition','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','rawAttributes','catch','create','body','user','get','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','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','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','Dispositions','sendStatus','error','stack','name','send','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3d46,0x170));var _0x63d4=function(_0x52ce97,_0xd348c5){_0x52ce97=_0x52ce97-0x0;var _0x23d707=_0x3d46[_0x52ce97];return _0x23d707;};'use strict';var emlformat=require(_0x63d4('0x0'));var rimraf=require(_0x63d4('0x1'));var zipdir=require(_0x63d4('0x2'));var jsonpatch=require(_0x63d4('0x3'));var rp=require(_0x63d4('0x4'));var moment=require(_0x63d4('0x5'));var BPromise=require(_0x63d4('0x6'));var Mustache=require(_0x63d4('0x7'));var util=require('util');var path=require(_0x63d4('0x8'));var sox=require('sox');var csv=require(_0x63d4('0x9'));var ejs=require(_0x63d4('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x63d4('0xb'));var squel=require(_0x63d4('0xc'));var crypto=require(_0x63d4('0xd'));var jsforce=require(_0x63d4('0xe'));var deskjs=require(_0x63d4('0xf'));var toCsv=require(_0x63d4('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x63d4('0x10'));var authService=require(_0x63d4('0x11'));var qs=require(_0x63d4('0x12'));var as=require(_0x63d4('0x13'));var hardwareService=require(_0x63d4('0x14'));var logger=require('../../config/logger')(_0x63d4('0x15'));var utils=require(_0x63d4('0x16'));var config=require(_0x63d4('0x17'));var licenseUtil=require(_0x63d4('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20a885,_0x3366d2){_0x3366d2=_0x3366d2||0xcc;return function(_0x5c85e8){if(_0x5c85e8){return _0x20a885['sendStatus'](_0x3366d2);}return _0x20a885[_0x63d4('0x19')](_0x3366d2)[_0x63d4('0x1a')]();};}function respondWithResult(_0x3005c4,_0x2d4c59){_0x2d4c59=_0x2d4c59||0xc8;return function(_0x1739f5){if(_0x1739f5){return _0x3005c4[_0x63d4('0x19')](_0x2d4c59)[_0x63d4('0x1b')](_0x1739f5);}};}function respondWithFilteredResult(_0x415f31,_0x4c57d3){return function(_0x5a63cf){if(_0x5a63cf){var _0x39b9f1=typeof _0x4c57d3[_0x63d4('0x1c')]===_0x63d4('0x1d')&&typeof _0x4c57d3[_0x63d4('0x1e')]===_0x63d4('0x1d');var _0x181243=_0x5a63cf['count'];var _0xdfd0da=_0x39b9f1?0x0:_0x4c57d3[_0x63d4('0x1c')];var _0x258999=_0x39b9f1?_0x5a63cf[_0x63d4('0x1f')]:_0x4c57d3[_0x63d4('0x1c')]+_0x4c57d3['limit'];var _0x103482;if(_0x258999>=_0x181243){_0x258999=_0x181243;_0x103482=0xc8;}else{_0x103482=0xce;}_0x415f31[_0x63d4('0x19')](_0x103482);return _0x415f31[_0x63d4('0x20')](_0x63d4('0x21'),_0xdfd0da+'-'+_0x258999+'/'+_0x181243)[_0x63d4('0x1b')](_0x5a63cf);}return null;};}function patchUpdates(_0x11e7b3){return function(_0x19a46a){try{jsonpatch[_0x63d4('0x22')](_0x19a46a,_0x11e7b3,!![]);}catch(_0x4a719e){return BPromise[_0x63d4('0x23')](_0x4a719e);}return _0x19a46a[_0x63d4('0x24')]();};}function saveUpdates(_0x562c5b,_0x3c7f5a){return function(_0x29a277){if(_0x29a277){return _0x29a277[_0x63d4('0x25')](_0x562c5b)['then'](function(_0x1ef28d){return _0x1ef28d;});}return null;};}function removeEntity(_0x34618c,_0x13143f){return function(_0x46206d){if(_0x46206d){return _0x46206d[_0x63d4('0x26')]()[_0x63d4('0x27')](function(){var _0x5df662=_0x46206d['get']({'plain':!![]});var _0x18bfe6=_0x63d4('0x28');return db['UserProfileResource'][_0x63d4('0x26')]({'where':{'type':_0x18bfe6,'resourceId':_0x5df662['id']}})[_0x63d4('0x27')](function(){return _0x46206d;});})[_0x63d4('0x27')](function(){_0x34618c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xc93809,_0x3b38a0){return function(_0x4d22ec){if(!_0x4d22ec){_0xc93809[_0x63d4('0x29')](0x194);}return _0x4d22ec;};}function handleError(_0x4cfd35,_0x233a23){_0x233a23=_0x233a23||0x1f4;return function(_0x17d3eb){logger[_0x63d4('0x2a')](_0x17d3eb[_0x63d4('0x2b')]);if(_0x17d3eb[_0x63d4('0x2c')]){delete _0x17d3eb[_0x63d4('0x2c')];}_0x4cfd35[_0x63d4('0x19')](_0x233a23)[_0x63d4('0x2d')](_0x17d3eb);};}exports[_0x63d4('0x2e')]=function(_0x474115,_0x1c33f6){var _0x55a105={},_0x1a90b0={},_0x5e287b={'count':0x0,'rows':[]};var _0x1fb3e4=_[_0x63d4('0x2f')](db[_0x63d4('0x30')]['rawAttributes'],function(_0x4d7ff1){return{'name':_0x4d7ff1[_0x63d4('0x31')],'type':_0x4d7ff1[_0x63d4('0x32')][_0x63d4('0x33')]};});_0x1a90b0[_0x63d4('0x34')]=_[_0x63d4('0x2f')](_0x1fb3e4,_0x63d4('0x2c'));_0x1a90b0[_0x63d4('0x35')]=_[_0x63d4('0x36')](_0x474115[_0x63d4('0x35')]);_0x1a90b0[_0x63d4('0x37')]=_[_0x63d4('0x38')](_0x1a90b0[_0x63d4('0x34')],_0x1a90b0['query']);_0x55a105['attributes']=_[_0x63d4('0x38')](_0x1a90b0['model'],qs['fields'](_0x474115['query'][_0x63d4('0x39')]));_0x55a105[_0x63d4('0x3a')]=_0x55a105[_0x63d4('0x3a')][_0x63d4('0x3b')]?_0x55a105[_0x63d4('0x3a')]:_0x1a90b0[_0x63d4('0x34')];if(!_0x474115[_0x63d4('0x35')][_0x63d4('0x3c')]('nolimit')){_0x55a105[_0x63d4('0x1e')]=qs['limit'](_0x474115[_0x63d4('0x35')][_0x63d4('0x1e')]);_0x55a105[_0x63d4('0x1c')]=qs['offset'](_0x474115[_0x63d4('0x35')][_0x63d4('0x1c')]);}_0x55a105['order']=qs[_0x63d4('0x3d')](_0x474115['query'][_0x63d4('0x3d')]);_0x55a105[_0x63d4('0x3e')]=qs[_0x63d4('0x37')](_['pick'](_0x474115[_0x63d4('0x35')],_0x1a90b0[_0x63d4('0x37')]),_0x1fb3e4);if(_0x474115[_0x63d4('0x35')]['filter']){_0x55a105['where']=_[_0x63d4('0x3f')](_0x55a105[_0x63d4('0x3e')],{'$or':_[_0x63d4('0x2f')](_0x1fb3e4,function(_0x7571c6){if(_0x7571c6[_0x63d4('0x32')]!==_0x63d4('0x40')){var _0x34769f={};_0x34769f[_0x7571c6[_0x63d4('0x2c')]]={'$like':'%'+_0x474115[_0x63d4('0x35')][_0x63d4('0x41')]+'%'};return _0x34769f;}})});}_0x55a105=_['merge']({},_0x55a105,_0x474115[_0x63d4('0x42')]);var _0x44556e={'where':_0x55a105['where']};return db['Disposition'][_0x63d4('0x1f')](_0x44556e)[_0x63d4('0x27')](function(_0x3aec5a){_0x5e287b[_0x63d4('0x1f')]=_0x3aec5a;if(_0x474115[_0x63d4('0x35')][_0x63d4('0x43')]){_0x55a105[_0x63d4('0x44')]=[{'all':!![]}];}return db['Disposition'][_0x63d4('0x45')](_0x55a105);})[_0x63d4('0x27')](function(_0x47c5cf){_0x5e287b[_0x63d4('0x46')]=_0x47c5cf;return _0x5e287b;})[_0x63d4('0x27')](respondWithFilteredResult(_0x1c33f6,_0x55a105))['catch'](handleError(_0x1c33f6,null));};exports[_0x63d4('0x47')]=function(_0x9bb1e4,_0x5d5ee5){var _0x137bf8={'raw':!![],'where':{'id':_0x9bb1e4[_0x63d4('0x48')]['id']}},_0x2db127={};_0x2db127['model']=_['keys'](db[_0x63d4('0x30')][_0x63d4('0x49')]);_0x2db127[_0x63d4('0x35')]=_['keys'](_0x9bb1e4[_0x63d4('0x35')]);_0x2db127[_0x63d4('0x37')]=_[_0x63d4('0x38')](_0x2db127[_0x63d4('0x34')],_0x2db127[_0x63d4('0x35')]);_0x137bf8[_0x63d4('0x3a')]=_[_0x63d4('0x38')](_0x2db127[_0x63d4('0x34')],qs['fields'](_0x9bb1e4[_0x63d4('0x35')][_0x63d4('0x39')]));_0x137bf8[_0x63d4('0x3a')]=_0x137bf8[_0x63d4('0x3a')][_0x63d4('0x3b')]?_0x137bf8[_0x63d4('0x3a')]:_0x2db127[_0x63d4('0x34')];if(_0x9bb1e4[_0x63d4('0x35')][_0x63d4('0x43')]){_0x137bf8['include']=[{'all':!![]}];}_0x137bf8=_[_0x63d4('0x3f')]({},_0x137bf8,_0x9bb1e4[_0x63d4('0x42')]);return db[_0x63d4('0x30')]['find'](_0x137bf8)[_0x63d4('0x27')](handleEntityNotFound(_0x5d5ee5,null))[_0x63d4('0x27')](respondWithResult(_0x5d5ee5,null))[_0x63d4('0x4a')](handleError(_0x5d5ee5,null));};exports[_0x63d4('0x4b')]=function(_0x258eda,_0x2050c2){return db['Disposition'][_0x63d4('0x4b')](_0x258eda[_0x63d4('0x4c')],{})['then'](function(_0x1f1d31){var _0x3e1a15=_0x258eda[_0x63d4('0x4d')][_0x63d4('0x4e')]({'plain':!![]});if(!_0x3e1a15)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e1a15['role']===_0x63d4('0x4d')){var _0x165641=_0x1f1d31[_0x63d4('0x4e')]({'plain':!![]});var _0x3cf3bf=_0x63d4('0x28');return db['UserProfileSection'][_0x63d4('0x4f')]({'where':{'name':_0x3cf3bf,'userProfileId':_0x3e1a15['userProfileId']},'raw':!![]})[_0x63d4('0x27')](function(_0x4117fc){if(_0x4117fc&&_0x4117fc[_0x63d4('0x50')]===0x0){return db[_0x63d4('0x51')]['create']({'name':_0x165641[_0x63d4('0x2c')],'resourceId':_0x165641['id'],'type':_0x4117fc['name'],'sectionId':_0x4117fc['id']},{})[_0x63d4('0x27')](function(){return _0x1f1d31;});}else{return _0x1f1d31;}})[_0x63d4('0x4a')](function(_0x1f650b){logger[_0x63d4('0x2a')](_0x63d4('0x52'),_0x1f650b);throw _0x1f650b;});}return _0x1f1d31;})[_0x63d4('0x27')](respondWithResult(_0x2050c2,0xc9))[_0x63d4('0x4a')](handleError(_0x2050c2,null));};exports[_0x63d4('0x25')]=function(_0x195755,_0x19d401){if(_0x195755['body']['id']){delete _0x195755[_0x63d4('0x4c')]['id'];}return db['Disposition'][_0x63d4('0x4f')]({'where':{'id':_0x195755[_0x63d4('0x48')]['id']}})[_0x63d4('0x27')](handleEntityNotFound(_0x19d401,null))['then'](saveUpdates(_0x195755['body'],null))[_0x63d4('0x27')](respondWithResult(_0x19d401,null))['catch'](handleError(_0x19d401,null));};exports['destroy']=function(_0x32d45c,_0x1a2564){return db[_0x63d4('0x30')][_0x63d4('0x4f')]({'where':{'id':_0x32d45c['params']['id']}})['then'](handleEntityNotFound(_0x1a2564,null))[_0x63d4('0x27')](removeEntity(_0x1a2564,null))[_0x63d4('0x4a')](handleError(_0x1a2564,null));}; \ No newline at end of file +var _0x6990=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','Dispositions','UserProfileResource','sendStatus','stack','name','index','Disposition','rawAttributes','type','key','map','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','sort','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','find'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x6990,0x199));var _0x0699=function(_0x12594f,_0x3561ef){_0x12594f=_0x12594f-0x0;var _0xd56422=_0x6990[_0x12594f];return _0xd56422;};'use strict';var emlformat=require(_0x0699('0x0'));var rimraf=require(_0x0699('0x1'));var zipdir=require(_0x0699('0x2'));var jsonpatch=require(_0x0699('0x3'));var rp=require(_0x0699('0x4'));var moment=require('moment');var BPromise=require(_0x0699('0x5'));var Mustache=require(_0x0699('0x6'));var util=require(_0x0699('0x7'));var path=require(_0x0699('0x8'));var sox=require(_0x0699('0x9'));var csv=require(_0x0699('0xa'));var ejs=require(_0x0699('0xb'));var fs=require('fs');var fs_extra=require(_0x0699('0xc'));var _=require(_0x0699('0xd'));var squel=require(_0x0699('0xe'));var crypto=require(_0x0699('0xf'));var jsforce=require(_0x0699('0x10'));var deskjs=require(_0x0699('0x11'));var toCsv=require(_0x0699('0xa'));var querystring=require('querystring');var Papa=require(_0x0699('0x12'));var Redis=require(_0x0699('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0699('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0699('0x15'))('api');var utils=require(_0x0699('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0699('0x17'));var db=require(_0x0699('0x18'))['db'];function respondWithStatusCode(_0x223f96,_0x465a2a){_0x465a2a=_0x465a2a||0xcc;return function(_0x245c65){if(_0x245c65){return _0x223f96['sendStatus'](_0x465a2a);}return _0x223f96[_0x0699('0x19')](_0x465a2a)[_0x0699('0x1a')]();};}function respondWithResult(_0x21aedd,_0x2fc0ac){_0x2fc0ac=_0x2fc0ac||0xc8;return function(_0x5d5935){if(_0x5d5935){return _0x21aedd[_0x0699('0x19')](_0x2fc0ac)['json'](_0x5d5935);}};}function respondWithFilteredResult(_0x1fdbc8,_0x40952e){return function(_0x50441b){if(_0x50441b){var _0x1862f8=typeof _0x40952e[_0x0699('0x1b')]===_0x0699('0x1c')&&typeof _0x40952e[_0x0699('0x1d')]===_0x0699('0x1c');var _0x4cae97=_0x50441b[_0x0699('0x1e')];var _0x1abf53=_0x1862f8?0x0:_0x40952e[_0x0699('0x1b')];var _0x52f34e=_0x1862f8?_0x50441b[_0x0699('0x1e')]:_0x40952e[_0x0699('0x1b')]+_0x40952e['limit'];var _0x38d952;if(_0x52f34e>=_0x4cae97){_0x52f34e=_0x4cae97;_0x38d952=0xc8;}else{_0x38d952=0xce;}_0x1fdbc8['status'](_0x38d952);return _0x1fdbc8[_0x0699('0x1f')](_0x0699('0x20'),_0x1abf53+'-'+_0x52f34e+'/'+_0x4cae97)['json'](_0x50441b);}return null;};}function patchUpdates(_0x4bc5e9){return function(_0x4311e2){try{jsonpatch[_0x0699('0x21')](_0x4311e2,_0x4bc5e9,!![]);}catch(_0x1fcf12){return BPromise['reject'](_0x1fcf12);}return _0x4311e2[_0x0699('0x22')]();};}function saveUpdates(_0x220a88,_0x1e3cc3){return function(_0x27388e){if(_0x27388e){return _0x27388e[_0x0699('0x23')](_0x220a88)[_0x0699('0x24')](function(_0x269115){return _0x269115;});}return null;};}function removeEntity(_0x516235,_0x5399c4){return function(_0x1b1246){if(_0x1b1246){return _0x1b1246[_0x0699('0x25')]()[_0x0699('0x24')](function(){var _0x48be6e=_0x1b1246[_0x0699('0x26')]({'plain':!![]});var _0x3bcd25=_0x0699('0x27');return db[_0x0699('0x28')][_0x0699('0x25')]({'where':{'type':_0x3bcd25,'resourceId':_0x48be6e['id']}})[_0x0699('0x24')](function(){return _0x1b1246;});})['then'](function(){_0x516235[_0x0699('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x235cbc,_0x3739bf){return function(_0x14f09d){if(!_0x14f09d){_0x235cbc[_0x0699('0x29')](0x194);}return _0x14f09d;};}function handleError(_0x2d3d49,_0x37741e){_0x37741e=_0x37741e||0x1f4;return function(_0xefab9e){logger['error'](_0xefab9e[_0x0699('0x2a')]);if(_0xefab9e['name']){delete _0xefab9e[_0x0699('0x2b')];}_0x2d3d49[_0x0699('0x19')](_0x37741e)['send'](_0xefab9e);};}exports[_0x0699('0x2c')]=function(_0x95fb42,_0x5987ce){var _0x4a8e9a={},_0x59b44a={},_0x3d27c1={'count':0x0,'rows':[]};var _0x7598ef=_['map'](db[_0x0699('0x2d')][_0x0699('0x2e')],function(_0x4c58b5){return{'name':_0x4c58b5['fieldName'],'type':_0x4c58b5[_0x0699('0x2f')][_0x0699('0x30')]};});_0x59b44a['model']=_[_0x0699('0x31')](_0x7598ef,'name');_0x59b44a[_0x0699('0x32')]=_[_0x0699('0x33')](_0x95fb42[_0x0699('0x32')]);_0x59b44a[_0x0699('0x34')]=_[_0x0699('0x35')](_0x59b44a['model'],_0x59b44a[_0x0699('0x32')]);_0x4a8e9a[_0x0699('0x36')]=_[_0x0699('0x35')](_0x59b44a[_0x0699('0x37')],qs[_0x0699('0x38')](_0x95fb42['query'][_0x0699('0x38')]));_0x4a8e9a['attributes']=_0x4a8e9a[_0x0699('0x36')]['length']?_0x4a8e9a[_0x0699('0x36')]:_0x59b44a['model'];if(!_0x95fb42['query'][_0x0699('0x39')]('nolimit')){_0x4a8e9a[_0x0699('0x1d')]=qs[_0x0699('0x1d')](_0x95fb42[_0x0699('0x32')][_0x0699('0x1d')]);_0x4a8e9a[_0x0699('0x1b')]=qs[_0x0699('0x1b')](_0x95fb42[_0x0699('0x32')][_0x0699('0x1b')]);}_0x4a8e9a['order']=qs['sort'](_0x95fb42[_0x0699('0x32')][_0x0699('0x3a')]);_0x4a8e9a[_0x0699('0x3b')]=qs[_0x0699('0x34')](_['pick'](_0x95fb42[_0x0699('0x32')],_0x59b44a[_0x0699('0x34')]),_0x7598ef);if(_0x95fb42[_0x0699('0x32')]['filter']){_0x4a8e9a[_0x0699('0x3b')]=_[_0x0699('0x3c')](_0x4a8e9a['where'],{'$or':_['map'](_0x7598ef,function(_0x1a8ce8){if(_0x1a8ce8[_0x0699('0x2f')]!==_0x0699('0x3d')){var _0x3f54a1={};_0x3f54a1[_0x1a8ce8[_0x0699('0x2b')]]={'$like':'%'+_0x95fb42[_0x0699('0x32')]['filter']+'%'};return _0x3f54a1;}})});}_0x4a8e9a=_[_0x0699('0x3c')]({},_0x4a8e9a,_0x95fb42[_0x0699('0x3e')]);var _0x13840d={'where':_0x4a8e9a[_0x0699('0x3b')]};return db[_0x0699('0x2d')][_0x0699('0x1e')](_0x13840d)[_0x0699('0x24')](function(_0x492ff3){_0x3d27c1[_0x0699('0x1e')]=_0x492ff3;if(_0x95fb42[_0x0699('0x32')][_0x0699('0x3f')]){_0x4a8e9a['include']=[{'all':!![]}];}return db[_0x0699('0x2d')][_0x0699('0x40')](_0x4a8e9a);})[_0x0699('0x24')](function(_0x377c22){_0x3d27c1[_0x0699('0x41')]=_0x377c22;return _0x3d27c1;})[_0x0699('0x24')](respondWithFilteredResult(_0x5987ce,_0x4a8e9a))[_0x0699('0x42')](handleError(_0x5987ce,null));};exports[_0x0699('0x43')]=function(_0x452fc7,_0x11032d){var _0x16b764={'raw':!![],'where':{'id':_0x452fc7[_0x0699('0x44')]['id']}},_0x271338={};_0x271338['model']=_['keys'](db['Disposition'][_0x0699('0x2e')]);_0x271338[_0x0699('0x32')]=_[_0x0699('0x33')](_0x452fc7[_0x0699('0x32')]);_0x271338[_0x0699('0x34')]=_[_0x0699('0x35')](_0x271338[_0x0699('0x37')],_0x271338[_0x0699('0x32')]);_0x16b764[_0x0699('0x36')]=_[_0x0699('0x35')](_0x271338[_0x0699('0x37')],qs['fields'](_0x452fc7[_0x0699('0x32')][_0x0699('0x38')]));_0x16b764[_0x0699('0x36')]=_0x16b764[_0x0699('0x36')][_0x0699('0x45')]?_0x16b764[_0x0699('0x36')]:_0x271338[_0x0699('0x37')];if(_0x452fc7['query'][_0x0699('0x3f')]){_0x16b764['include']=[{'all':!![]}];}_0x16b764=_[_0x0699('0x3c')]({},_0x16b764,_0x452fc7[_0x0699('0x3e')]);return db[_0x0699('0x2d')][_0x0699('0x46')](_0x16b764)[_0x0699('0x24')](handleEntityNotFound(_0x11032d,null))[_0x0699('0x24')](respondWithResult(_0x11032d,null))[_0x0699('0x42')](handleError(_0x11032d,null));};exports[_0x0699('0x47')]=function(_0x57dddf,_0x2afa38){return db[_0x0699('0x2d')][_0x0699('0x47')](_0x57dddf[_0x0699('0x48')],{})[_0x0699('0x24')](function(_0x2e82d6){var _0x257835=_0x57dddf[_0x0699('0x49')][_0x0699('0x26')]({'plain':!![]});if(!_0x257835)throw new Error(_0x0699('0x4a'));if(_0x257835['role']==='user'){var _0x2923f7=_0x2e82d6[_0x0699('0x26')]({'plain':!![]});var _0x374b9c=_0x0699('0x27');return db[_0x0699('0x4b')][_0x0699('0x46')]({'where':{'name':_0x374b9c,'userProfileId':_0x257835[_0x0699('0x4c')]},'raw':!![]})[_0x0699('0x24')](function(_0x5d1edb){if(_0x5d1edb&&_0x5d1edb[_0x0699('0x4d')]===0x0){return db[_0x0699('0x28')][_0x0699('0x47')]({'name':_0x2923f7[_0x0699('0x2b')],'resourceId':_0x2923f7['id'],'type':_0x5d1edb[_0x0699('0x2b')],'sectionId':_0x5d1edb['id']},{})['then'](function(){return _0x2e82d6;});}else{return _0x2e82d6;}})[_0x0699('0x42')](function(_0x6ef245){logger[_0x0699('0x4e')](_0x0699('0x4f'),_0x6ef245);throw _0x6ef245;});}return _0x2e82d6;})[_0x0699('0x24')](respondWithResult(_0x2afa38,0xc9))[_0x0699('0x42')](handleError(_0x2afa38,null));};exports[_0x0699('0x23')]=function(_0x53bac5,_0x3eb7f9){if(_0x53bac5[_0x0699('0x48')]['id']){delete _0x53bac5[_0x0699('0x48')]['id'];}return db['Disposition']['find']({'where':{'id':_0x53bac5['params']['id']}})[_0x0699('0x24')](handleEntityNotFound(_0x3eb7f9,null))['then'](saveUpdates(_0x53bac5[_0x0699('0x48')],null))[_0x0699('0x24')](respondWithResult(_0x3eb7f9,null))[_0x0699('0x42')](handleError(_0x3eb7f9,null));};exports['destroy']=function(_0x8ba5a8,_0x2b6c89){return db[_0x0699('0x2d')][_0x0699('0x46')]({'where':{'id':_0x8ba5a8[_0x0699('0x44')]['id']}})[_0x0699('0x24')](handleEntityNotFound(_0x2b6c89,null))[_0x0699('0x24')](removeEntity(_0x2b6c89,null))[_0x0699('0x42')](handleError(_0x2b6c89,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 0855b97..f1288e2 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 _0x53e2=['lodash','util','api','request-promise','path','rimraf','../../config/environment','./disposition.attributes','define','Disposition','name_voice','name','ListId','name_chat','ChatWebsiteId','name_sms','SmsAccountId','FaxAccountId','WhatsappAccountId'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x53e2,0xd1));var _0x253e=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x53e2[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x253e('0x0'));var util=require(_0x253e('0x1'));var logger=require('../../config/logger')(_0x253e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x253e('0x3'));var fs=require('fs');var path=require(_0x253e('0x4'));var rimraf=require(_0x253e('0x5'));var config=require(_0x253e('0x6'));var attributes=require(_0x253e('0x7'));module['exports']=function(_0x3beb7b,_0x425762){return _0x3beb7b[_0x253e('0x8')](_0x253e('0x9'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x253e('0xa'),'fields':[_0x253e('0xb'),_0x253e('0xc')]},{'unique':!![],'name':_0x253e('0xd'),'fields':[_0x253e('0xb'),_0x253e('0xe')]},{'unique':!![],'name':'name_mail','fields':[_0x253e('0xb'),'MailAccountId']},{'unique':!![],'name':_0x253e('0xf'),'fields':[_0x253e('0xb'),_0x253e('0x10')]},{'unique':!![],'name':'name_fax','fields':[_0x253e('0xb'),_0x253e('0x11')]},{'unique':!![],'name':'name_openchannel','fields':[_0x253e('0xb'),'OpenchannelAccountId']},{'unique':!![],'name':'name_whatsapp','fields':[_0x253e('0xb'),_0x253e('0x12')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9b7b=['rimraf','../../config/environment','exports','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','util','../../config/logger','api','request-promise','path'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x9b7b,0x85));var _0xb9b7=function(_0x2786b3,_0x41b4ac){_0x2786b3=_0x2786b3-0x0;var _0x4d2f16=_0x9b7b[_0x2786b3];return _0x4d2f16;};'use strict';var _=require('lodash');var util=require(_0xb9b7('0x0'));var logger=require(_0xb9b7('0x1'))(_0xb9b7('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb9b7('0x3'));var fs=require('fs');var path=require(_0xb9b7('0x4'));var rimraf=require(_0xb9b7('0x5'));var config=require(_0xb9b7('0x6'));var attributes=require('./disposition.attributes');module[_0xb9b7('0x7')]=function(_0x46fe5b,_0x1ff3f4){return _0x46fe5b['define']('Disposition',attributes,{'tableName':_0xb9b7('0x8'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xb9b7('0x9'),'fields':[_0xb9b7('0xa'),_0xb9b7('0xb')]},{'unique':!![],'name':_0xb9b7('0xc'),'fields':[_0xb9b7('0xa'),_0xb9b7('0xd')]},{'unique':!![],'name':_0xb9b7('0xe'),'fields':[_0xb9b7('0xa'),_0xb9b7('0xf')]},{'unique':!![],'name':_0xb9b7('0x10'),'fields':['name','SmsAccountId']},{'unique':!![],'name':_0xb9b7('0x11'),'fields':['name',_0xb9b7('0x12')]},{'unique':!![],'name':_0xb9b7('0x13'),'fields':[_0xb9b7('0xa'),_0xb9b7('0x14')]},{'unique':!![],'name':_0xb9b7('0x15'),'fields':[_0xb9b7('0xa'),_0xb9b7('0x16')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 7d7dcc6..256f3f5 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(_0x573aa8,_0x5242b9){var _0x397576=function(_0x298b43){while(--_0x298b43){_0x573aa8['push'](_0x573aa8['shift']());}};_0x397576(++_0x5242b9);}(_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 +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(_0x119fd0,_0x3b7d7d){var _0x566132=function(_0x203705){while(--_0x203705){_0x119fd0['push'](_0x119fd0['shift']());}};_0x566132(++_0x3b7d7d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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 8384f0d..5aef7b9 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 _0x9999=['fs-extra','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','path','connect-timeout','express','Router'];(function(_0x4b2d4a,_0x2bf2fc){var _0x517874=function(_0x3849e3){while(--_0x3849e3){_0x4b2d4a['push'](_0x4b2d4a['shift']());}};_0x517874(++_0x2bf2fc);}(_0x9999,0xa7));var _0x9999=function(_0x1d9661,_0x56b058){_0x1d9661=_0x1d9661-0x0;var _0x55b2c8=_0x9999[_0x1d9661];return _0x55b2c8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9999('0x0'));var timeout=require(_0x9999('0x1'));var express=require(_0x9999('0x2'));var router=express[_0x9999('0x3')]();var fs_extra=require(_0x9999('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9999('0x5'));var config=require(_0x9999('0x6'));var controller=require(_0x9999('0x7'));router[_0x9999('0x8')]('/',auth[_0x9999('0x9')](),controller[_0x9999('0xa')]);router['get'](_0x9999('0xb'),auth['isAuthenticated'](),controller[_0x9999('0xc')]);router[_0x9999('0xd')]('/',auth[_0x9999('0x9')](),controller[_0x9999('0xe')]);router[_0x9999('0xf')](_0x9999('0xb'),auth[_0x9999('0x9')](),controller[_0x9999('0x10')]);router[_0x9999('0x11')](_0x9999('0xb'),auth[_0x9999('0x9')](),controller[_0x9999('0x12')]);module['exports']=router; \ No newline at end of file +var _0xf2be=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','show','post','create','put','update','delete','/:id','exports','multer'];(function(_0x393112,_0x299a1b){var _0xd73e8a=function(_0x2c9ea1){while(--_0x2c9ea1){_0x393112['push'](_0x393112['shift']());}};_0xd73e8a(++_0x299a1b);}(_0xf2be,0x164));var _0xef2b=function(_0x33461f,_0x30cd68){_0x33461f=_0x33461f-0x0;var _0x1b373d=_0xf2be[_0x33461f];return _0x1b373d;};'use strict';var multer=require(_0xef2b('0x0'));var util=require(_0xef2b('0x1'));var path=require(_0xef2b('0x2'));var timeout=require('connect-timeout');var express=require(_0xef2b('0x3'));var router=express[_0xef2b('0x4')]();var fs_extra=require(_0xef2b('0x5'));var auth=require(_0xef2b('0x6'));var interaction=require(_0xef2b('0x7'));var config=require(_0xef2b('0x8'));var controller=require(_0xef2b('0x9'));router[_0xef2b('0xa')]('/',auth[_0xef2b('0xb')](),controller[_0xef2b('0xc')]);router[_0xef2b('0xa')]('/:id',auth[_0xef2b('0xb')](),controller[_0xef2b('0xd')]);router[_0xef2b('0xe')]('/',auth[_0xef2b('0xb')](),controller[_0xef2b('0xf')]);router[_0xef2b('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xef2b('0x11')]);router[_0xef2b('0x12')](_0xef2b('0x13'),auth[_0xef2b('0xb')](),controller['destroy']);module[_0xef2b('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index a4e73bd..e96ffee 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 _0x4ea9=['4800','7200','9600','12000','2400','14400','v17,v27,v29','INTEGER','IAX','DADHI','KHOMP','SIP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid'];(function(_0x536261,_0x1e3489){var _0x2df67f=function(_0x5e00a6){while(--_0x5e00a6){_0x536261['push'](_0x536261['shift']());}};_0x2df67f(++_0x1e3489);}(_0x4ea9,0xfd));var _0x94ea=function(_0x34d81e,_0x86c65c){_0x34d81e=_0x34d81e-0x0;var _0x1d4f25=_0x4ea9[_0x34d81e];return _0x1d4f25;};'use strict';var Sequelize=require(_0x94ea('0x0'));module[_0x94ea('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x94ea('0x2')]},'ecm':{'type':Sequelize[_0x94ea('0x3')](_0x94ea('0x4'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x94ea('0x2')],'defaultValue':_0x94ea('0x5')},'localstationid':{'type':Sequelize[_0x94ea('0x2')],'unique':_0x94ea('0x6')},'minrate':{'type':Sequelize['ENUM']('2400',_0x94ea('0x7'),_0x94ea('0x8'),_0x94ea('0x9'),_0x94ea('0xa'),'14400'),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x94ea('0x3')](_0x94ea('0xb'),_0x94ea('0x7'),_0x94ea('0x8'),_0x94ea('0x9'),_0x94ea('0xa'),_0x94ea('0xc')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x94ea('0x2')],'defaultValue':_0x94ea('0xd')},'gateway':{'type':Sequelize[_0x94ea('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[_0x94ea('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x94ea('0x3')]('SIP',_0x94ea('0xf'),_0x94ea('0x10'),_0x94ea('0x11')),'defaultValue':_0x94ea('0x12')},'key':{'type':Sequelize[_0x94ea('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x94ea('0x13')],'defaultValue':function(){return _0x94ea('0x14');}},'notificationSound':{'type':Sequelize[_0x94ea('0x15')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x94ea('0x15')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x94ea('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x94ea('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x94ea('0x15')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x94ea('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x94ea('0xe')],'allowNull':!![],'defaultValue':null,'comment':_0x94ea('0x16')},'mandatoryDisposition':{'type':Sequelize[_0x94ea('0x15')],'defaultValue':![],'comment':_0x94ea('0x17'),'set':function(_0x57a90f){if(!_0x57a90f)this['setDataValue'](_0x94ea('0x18'),null);this['setDataValue'](_0x94ea('0x19'),_0x57a90f);}}}; \ No newline at end of file +var _0xe3e8=['localstationid','2400','4800','7200','9600','12000','14400','v17,v27,v29','INTEGER','SIP','IAX','DADHI','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax'];(function(_0x2d2bcb,_0x3051fc){var _0x303f0f=function(_0x3fd68f){while(--_0x3fd68f){_0x2d2bcb['push'](_0x2d2bcb['shift']());}};_0x303f0f(++_0x3051fc);}(_0xe3e8,0x68));var _0x8e3e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xe3e8[_0x40ac5e];return _0x2839d6;};'use strict';var Sequelize=require(_0x8e3e('0x0'));module[_0x8e3e('0x1')]={'name':{'type':Sequelize[_0x8e3e('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8e3e('0x2')]},'ecm':{'type':Sequelize[_0x8e3e('0x3')]('yes','no'),'defaultValue':_0x8e3e('0x4')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x8e3e('0x5')},'localstationid':{'type':Sequelize[_0x8e3e('0x2')],'unique':_0x8e3e('0x6')},'minrate':{'type':Sequelize[_0x8e3e('0x3')](_0x8e3e('0x7'),_0x8e3e('0x8'),_0x8e3e('0x9'),_0x8e3e('0xa'),_0x8e3e('0xb'),'14400'),'defaultValue':_0x8e3e('0x8')},'maxrate':{'type':Sequelize[_0x8e3e('0x3')](_0x8e3e('0x7'),_0x8e3e('0x8'),'7200','9600',_0x8e3e('0xb'),_0x8e3e('0xc')),'defaultValue':_0x8e3e('0xc')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x8e3e('0xd')},'gateway':{'type':Sequelize[_0x8e3e('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[_0x8e3e('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x8e3e('0x3')](_0x8e3e('0xf'),_0x8e3e('0x10'),_0x8e3e('0x11'),'KHOMP'),'defaultValue':_0x8e3e('0xf')},'key':{'type':Sequelize[_0x8e3e('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x8e3e('0x12')],'defaultValue':function(){return _0x8e3e('0x13');}},'notificationSound':{'type':Sequelize[_0x8e3e('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8e3e('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8e3e('0x14')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8e3e('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8e3e('0x14')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8e3e('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8e3e('0xe')],'allowNull':!![],'defaultValue':null,'comment':_0x8e3e('0x15')},'mandatoryDisposition':{'type':Sequelize[_0x8e3e('0x14')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2ce754){if(!_0x2ce754)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue']('mandatoryDisposition',_0x2ce754);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index bf84818..f1f4841 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 _0x300d=['jayson/promise','http','client','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','FaxAccount','rawAttributes','fieldName','type','key','query','model','attributes','intersection','fields','length','order','sort','where','filters','merge','map','options','includeAll','include','findAll','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','hasOwnProperty','pick','filter','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','nolimit','removeAnswers','addInteraction','omit','FaxInteraction','Contact','User','Owner','Tag','color','tag','addApplications','transaction','bulkCreate','FaxApplication','findAndCountAll','priority','getApplications','context','exten','localstationid','system','description','push','Answer','CDR(type)=inbound-fax','Set','gateway','maxrate','minrate','modem','t38timeout','Wait','ReceiveFax','addAccountApplications','sequelize','updateAccountApplications','VoiceExtension','tech','createdAt','updatedAt','TrunkId','ListId','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','CmContact','defaults','List\x20not\x20found','Send\x20Fax\x20failed','filename','Messages','Contact\x20not\x20found','spread','out','ContactId','dataValues','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./faxAccount.socket','register'];(function(_0x1de2f3,_0x4100ad){var _0x562cb8=function(_0x24edb){while(--_0x24edb){_0x1de2f3['push'](_0x1de2f3['shift']());}};_0x562cb8(++_0x4100ad);}(_0x300d,0xa5));var _0xd300=function(_0x43bbde,_0x310be1){_0x43bbde=_0x43bbde-0x0;var _0x134d52=_0x300d[_0x43bbde];return _0x134d52;};'use strict';var emlformat=require(_0xd300('0x0'));var rimraf=require(_0xd300('0x1'));var zipdir=require(_0xd300('0x2'));var jsonpatch=require(_0xd300('0x3'));var rp=require(_0xd300('0x4'));var moment=require(_0xd300('0x5'));var BPromise=require(_0xd300('0x6'));var Mustache=require(_0xd300('0x7'));var util=require(_0xd300('0x8'));var path=require(_0xd300('0x9'));var sox=require(_0xd300('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd300('0xb'));var _=require(_0xd300('0xc'));var squel=require(_0xd300('0xd'));var crypto=require(_0xd300('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xd300('0xf'));var toCsv=require(_0xd300('0x10'));var querystring=require(_0xd300('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd300('0x12'));var qs=require(_0xd300('0x13'));var as=require(_0xd300('0x14'));var hardwareService=require(_0xd300('0x15'));var logger=require(_0xd300('0x16'))(_0xd300('0x17'));var utils=require(_0xd300('0x18'));var config=require(_0xd300('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xd300('0x1a'))['db'];config[_0xd300('0x1b')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd300('0x1c'))(new Redis(config[_0xd300('0x1b')]));require(_0xd300('0x1d'))[_0xd300('0x1e')](socket);var jayson=require(_0xd300('0x1f'));var client=jayson['client'][_0xd300('0x20')]({'port':0x232c});var client9002=jayson[_0xd300('0x21')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ff5e1,_0x3e2ce9,_0x4bbfc4,_0x26cd61){return new BPromise(function(_0x576736,_0x514a35){var _0xa8777c=_0x26cd61||client;return _0xa8777c[_0xd300('0x22')](_0x4ff5e1,_0x4bbfc4)[_0xd300('0x23')](function(_0x8bddc7){logger[_0xd300('0x24')](_0xd300('0x25'),_0x3e2ce9,_0xd300('0x26'));logger[_0xd300('0x27')](_0xd300('0x28'),_0x3e2ce9,_0xd300('0x26'),JSON[_0xd300('0x29')](_0x8bddc7));if(_0x8bddc7['error']){if(_0x8bddc7[_0xd300('0x2a')][_0xd300('0x2b')]===0x1f4){logger['error'](_0xd300('0x25'),_0x3e2ce9,_0x8bddc7[_0xd300('0x2a')]['message']);return _0x514a35(_0x8bddc7[_0xd300('0x2a')][_0xd300('0x2c')]);}logger[_0xd300('0x2a')](_0xd300('0x25'),_0x3e2ce9,_0x8bddc7['error'][_0xd300('0x2c')]);return _0x576736(_0x8bddc7[_0xd300('0x2a')][_0xd300('0x2c')]);}else{logger['info'](_0xd300('0x25'),_0x3e2ce9,'request\x20sent');_0x576736(_0x8bddc7['result'][_0xd300('0x2c')]);}})[_0xd300('0x2d')](function(_0x1b138a){logger[_0xd300('0x2a')]('FaxAccount,\x20%s,\x20%s',_0x3e2ce9,_0x1b138a);_0x514a35(_0x1b138a);});});}function respondWithStatusCode(_0x59e43a,_0x151dbf){_0x151dbf=_0x151dbf||0xcc;return function(_0x23a03b){if(_0x23a03b){return _0x59e43a[_0xd300('0x2e')](_0x151dbf);}return _0x59e43a[_0xd300('0x2f')](_0x151dbf)[_0xd300('0x30')]();};}function respondWithResult(_0x5e2671,_0x20f17c){_0x20f17c=_0x20f17c||0xc8;return function(_0x19d724){if(_0x19d724){return _0x5e2671[_0xd300('0x2f')](_0x20f17c)['json'](_0x19d724);}};}function respondWithFilteredResult(_0x402343,_0x5bc235){return function(_0xb36fe8){if(_0xb36fe8){var _0x4dabc4=typeof _0x5bc235[_0xd300('0x31')]===_0xd300('0x32')&&typeof _0x5bc235[_0xd300('0x33')]===_0xd300('0x32');var _0x1cf855=_0xb36fe8[_0xd300('0x34')];var _0x10508c=_0x4dabc4?0x0:_0x5bc235[_0xd300('0x31')];var _0x39f7ff=_0x4dabc4?_0xb36fe8['count']:_0x5bc235[_0xd300('0x31')]+_0x5bc235[_0xd300('0x33')];var _0x6eb980;if(_0x39f7ff>=_0x1cf855){_0x39f7ff=_0x1cf855;_0x6eb980=0xc8;}else{_0x6eb980=0xce;}_0x402343[_0xd300('0x2f')](_0x6eb980);return _0x402343[_0xd300('0x35')](_0xd300('0x36'),_0x10508c+'-'+_0x39f7ff+'/'+_0x1cf855)[_0xd300('0x37')](_0xb36fe8);}return null;};}function patchUpdates(_0x1d5aca){return function(_0x9ae6e0){try{jsonpatch[_0xd300('0x38')](_0x9ae6e0,_0x1d5aca,!![]);}catch(_0x1807ff){return BPromise[_0xd300('0x39')](_0x1807ff);}return _0x9ae6e0[_0xd300('0x3a')]();};}function saveUpdates(_0x365f5b,_0x45c3db){return function(_0x1935dc){if(_0x1935dc){return _0x1935dc[_0xd300('0x3b')](_0x365f5b)['then'](function(_0x313f23){return _0x313f23;});}return null;};}function removeEntity(_0x357016,_0x57c0b9){return function(_0x35d392){if(_0x35d392){return _0x35d392[_0xd300('0x3c')]()[_0xd300('0x23')](function(){var _0x41f0ae=_0x35d392[_0xd300('0x3d')]({'plain':!![]});var _0x80ab20=_0xd300('0x3e');return db[_0xd300('0x3f')][_0xd300('0x3c')]({'where':{'type':_0x80ab20,'resourceId':_0x41f0ae['id']}})[_0xd300('0x23')](function(){return _0x35d392;});})[_0xd300('0x23')](function(){_0x357016[_0xd300('0x2f')](0xcc)[_0xd300('0x30')]();});}};}function handleEntityNotFound(_0x1fc62b,_0x49c09e){return function(_0x937b49){if(!_0x937b49){_0x1fc62b['sendStatus'](0x194);}return _0x937b49;};}function handleError(_0x36f0e2,_0x538447){_0x538447=_0x538447||0x1f4;return function(_0x564ad0){logger[_0xd300('0x2a')](_0x564ad0['stack']);if(_0x564ad0[_0xd300('0x40')]){delete _0x564ad0[_0xd300('0x40')];}_0x36f0e2[_0xd300('0x2f')](_0x538447)[_0xd300('0x41')](_0x564ad0);};}exports[_0xd300('0x42')]=function(_0x882b62,_0x34fc00){var _0x2ea22d={'include':[{'model':db[_0xd300('0x43')],'as':_0xd300('0x44')}]},_0x475683={},_0x396dbb={'count':0x0,'rows':[]};var _0x2b8f50=_['map'](db[_0xd300('0x45')][_0xd300('0x46')],function(_0x286cf7){return{'name':_0x286cf7[_0xd300('0x47')],'type':_0x286cf7[_0xd300('0x48')][_0xd300('0x49')]};});_0x475683['model']=_['map'](_0x2b8f50,_0xd300('0x40'));_0x475683[_0xd300('0x4a')]=_['keys'](_0x882b62[_0xd300('0x4a')]);_0x475683['filters']=_['intersection'](_0x475683[_0xd300('0x4b')],_0x475683[_0xd300('0x4a')]);_0x2ea22d[_0xd300('0x4c')]=_[_0xd300('0x4d')](_0x475683[_0xd300('0x4b')],qs[_0xd300('0x4e')](_0x882b62[_0xd300('0x4a')][_0xd300('0x4e')]));_0x2ea22d[_0xd300('0x4c')]=_0x2ea22d['attributes'][_0xd300('0x4f')]?_0x2ea22d[_0xd300('0x4c')]:_0x475683[_0xd300('0x4b')];if(!_0x882b62[_0xd300('0x4a')]['hasOwnProperty']('nolimit')){_0x2ea22d[_0xd300('0x33')]=qs[_0xd300('0x33')](_0x882b62['query'][_0xd300('0x33')]);_0x2ea22d[_0xd300('0x31')]=qs[_0xd300('0x31')](_0x882b62[_0xd300('0x4a')][_0xd300('0x31')]);}_0x2ea22d[_0xd300('0x50')]=qs['sort'](_0x882b62[_0xd300('0x4a')][_0xd300('0x51')]);_0x2ea22d[_0xd300('0x52')]=qs['filters'](_['pick'](_0x882b62[_0xd300('0x4a')],_0x475683[_0xd300('0x53')]),_0x2b8f50);if(_0x882b62[_0xd300('0x4a')]['filter']){_0x2ea22d[_0xd300('0x52')]=_[_0xd300('0x54')](_0x2ea22d[_0xd300('0x52')],{'$or':_[_0xd300('0x55')](_0x2b8f50,function(_0x4eccfc){if(_0x4eccfc[_0xd300('0x48')]!=='VIRTUAL'){var _0x4e4970={};_0x4e4970[_0x4eccfc[_0xd300('0x40')]]={'$like':'%'+_0x882b62[_0xd300('0x4a')]['filter']+'%'};return _0x4e4970;}})});}_0x2ea22d=_[_0xd300('0x54')]({},_0x2ea22d,_0x882b62[_0xd300('0x56')]);var _0x4b4dd5={'where':_0x2ea22d[_0xd300('0x52')]};return db[_0xd300('0x45')][_0xd300('0x34')](_0x4b4dd5)[_0xd300('0x23')](function(_0x20a4d4){_0x396dbb['count']=_0x20a4d4;if(_0x882b62[_0xd300('0x4a')][_0xd300('0x57')]){_0x2ea22d[_0xd300('0x58')]=[{'all':!![]}];}return db[_0xd300('0x45')][_0xd300('0x59')](_0x2ea22d);})[_0xd300('0x23')](function(_0x310669){_0x396dbb['rows']=_0x310669;return _0x396dbb;})[_0xd300('0x23')](respondWithFilteredResult(_0x34fc00,_0x2ea22d))[_0xd300('0x2d')](handleError(_0x34fc00,null));};exports['show']=function(_0x1c670d,_0x4ca325){var _0x542be5={'raw':![],'where':{'id':_0x1c670d[_0xd300('0x5a')]['id']},'include':[{'model':db[_0xd300('0x43')],'as':_0xd300('0x44')}]},_0xf79626={};_0xf79626[_0xd300('0x4b')]=_['keys'](db['FaxAccount'][_0xd300('0x46')]);_0xf79626[_0xd300('0x4a')]=_[_0xd300('0x5b')](_0x1c670d['query']);_0xf79626[_0xd300('0x53')]=_[_0xd300('0x4d')](_0xf79626[_0xd300('0x4b')],_0xf79626[_0xd300('0x4a')]);_0x542be5[_0xd300('0x4c')]=_[_0xd300('0x4d')](_0xf79626[_0xd300('0x4b')],qs[_0xd300('0x4e')](_0x1c670d[_0xd300('0x4a')][_0xd300('0x4e')]));_0x542be5['attributes']=_0x542be5[_0xd300('0x4c')][_0xd300('0x4f')]?_0x542be5['attributes']:_0xf79626[_0xd300('0x4b')];if(_0x1c670d[_0xd300('0x4a')][_0xd300('0x57')]){_0x542be5[_0xd300('0x58')]=[{'all':!![]}];}_0x542be5=_[_0xd300('0x54')]({},_0x542be5,_0x1c670d[_0xd300('0x56')]);return db[_0xd300('0x45')]['find'](_0x542be5)[_0xd300('0x23')](handleEntityNotFound(_0x4ca325,null))[_0xd300('0x23')](respondWithResult(_0x4ca325,null))[_0xd300('0x2d')](handleError(_0x4ca325,null));};exports[_0xd300('0x5c')]=function(_0x4e170a,_0x5c7d73){return db['FaxAccount'][_0xd300('0x5c')](_0x4e170a[_0xd300('0x5d')],{})[_0xd300('0x23')](function(_0x2a5952){var _0x527742=_0x4e170a[_0xd300('0x5e')][_0xd300('0x3d')]({'plain':!![]});if(!_0x527742)throw new Error(_0xd300('0x5f'));if(_0x527742[_0xd300('0x60')]===_0xd300('0x5e')){var _0x5e4d87=_0x2a5952[_0xd300('0x3d')]({'plain':!![]});var _0x327e6d=_0xd300('0x3e');return db['UserProfileSection'][_0xd300('0x61')]({'where':{'name':_0x327e6d,'userProfileId':_0x527742['userProfileId']},'raw':!![]})[_0xd300('0x23')](function(_0xff147f){if(_0xff147f&&_0xff147f[_0xd300('0x62')]===0x0){return db[_0xd300('0x3f')][_0xd300('0x5c')]({'name':_0x5e4d87[_0xd300('0x40')],'resourceId':_0x5e4d87['id'],'type':_0xff147f[_0xd300('0x40')],'sectionId':_0xff147f['id']},{})['then'](function(){return _0x2a5952;});}else{return _0x2a5952;}})['catch'](function(_0x1a3e6d){logger[_0xd300('0x2a')](_0xd300('0x63'),_0x1a3e6d);throw _0x1a3e6d;});}return _0x2a5952;})[_0xd300('0x23')](respondWithResult(_0x5c7d73,0xc9))[_0xd300('0x2d')](handleError(_0x5c7d73,null));};exports[_0xd300('0x3b')]=function(_0x4deecd,_0x11320e){if(_0x4deecd[_0xd300('0x5d')]['id']){delete _0x4deecd[_0xd300('0x5d')]['id'];}return db[_0xd300('0x45')][_0xd300('0x61')]({'where':{'id':_0x4deecd[_0xd300('0x5a')]['id']},'include':[{'model':db[_0xd300('0x43')],'as':'mandatoryDispositionPause'}]})[_0xd300('0x23')](handleEntityNotFound(_0x11320e,null))[_0xd300('0x23')](saveUpdates(_0x4deecd[_0xd300('0x5d')],null))[_0xd300('0x23')](respondWithResult(_0x11320e,null))[_0xd300('0x2d')](handleError(_0x11320e,null));};exports['destroy']=function(_0x4c588c,_0x921ddb){return db[_0xd300('0x45')][_0xd300('0x61')]({'where':{'id':_0x4c588c[_0xd300('0x5a')]['id']}})['then'](handleEntityNotFound(_0x921ddb,null))[_0xd300('0x23')](removeEntity(_0x921ddb,null))[_0xd300('0x2d')](handleError(_0x921ddb,null));};exports[_0xd300('0x64')]=function(_0x63758f,_0xa39c2){return db['FaxAccount']['describe']()[_0xd300('0x23')](respondWithResult(_0xa39c2,null))[_0xd300('0x2d')](handleError(_0xa39c2,null));};exports[_0xd300('0x65')]=function(_0x3d4e07,_0x136e6a,_0x3f3574){if(_0x3d4e07[_0xd300('0x5d')]['id']){delete _0x3d4e07[_0xd300('0x5d')]['id'];}return db[_0xd300('0x45')]['find']({'where':{'id':_0x3d4e07['params']['id']}})['then'](handleEntityNotFound(_0x136e6a,null))[_0xd300('0x23')](function(_0x8cc6f3){if(_0x8cc6f3){_0x3d4e07[_0xd300('0x5d')][_0xd300('0x66')]=_0x8cc6f3['id'];return db[_0xd300('0x67')][_0xd300('0x5c')](_0x3d4e07['body']);}})[_0xd300('0x23')](respondWithResult(_0x136e6a,null))[_0xd300('0x2d')](handleError(_0x136e6a,null));};exports[_0xd300('0x68')]=function(_0x23c847,_0x4ea503,_0x25d6e8){var _0x51d063={'raw':![],'where':{}};var _0x1ae85d={};var _0x38d00b={'count':0x0,'rows':[]};return db[_0xd300('0x45')][_0xd300('0x69')]({'where':{'id':_0x23c847[_0xd300('0x5a')]['id']}})[_0xd300('0x23')](handleEntityNotFound(_0x4ea503,null))[_0xd300('0x23')](function(_0x3b567c){if(_0x3b567c){_0x1ae85d['model']=_[_0xd300('0x5b')](db[_0xd300('0x67')][_0xd300('0x46')]);_0x1ae85d[_0xd300('0x4a')]=_[_0xd300('0x5b')](_0x23c847[_0xd300('0x4a')]);_0x1ae85d[_0xd300('0x53')]=_[_0xd300('0x4d')](_0x1ae85d['model'],_0x1ae85d['query']);_0x51d063[_0xd300('0x4c')]=_[_0xd300('0x4d')](_0x1ae85d[_0xd300('0x4b')],qs['fields'](_0x23c847['query'][_0xd300('0x4e')]));_0x51d063[_0xd300('0x4c')]=_0x51d063[_0xd300('0x4c')][_0xd300('0x4f')]?_0x51d063[_0xd300('0x4c')]:_0x1ae85d[_0xd300('0x4b')];if(!_0x23c847[_0xd300('0x4a')][_0xd300('0x6a')]('nolimit')){_0x51d063['limit']=qs[_0xd300('0x33')](_0x23c847[_0xd300('0x4a')]['limit']);_0x51d063[_0xd300('0x31')]=qs['offset'](_0x23c847[_0xd300('0x4a')]['offset']);}_0x51d063['order']=qs[_0xd300('0x51')](_0x23c847[_0xd300('0x4a')][_0xd300('0x51')]);_0x51d063[_0xd300('0x52')]=qs[_0xd300('0x53')](_[_0xd300('0x6b')](_0x23c847[_0xd300('0x4a')],_0x1ae85d[_0xd300('0x53')]));_0x51d063[_0xd300('0x52')]['FaxAccountId']=_0x3b567c['id'];if(_0x23c847[_0xd300('0x4a')]['filter']){_0x51d063[_0xd300('0x52')]=_[_0xd300('0x54')](_0x51d063[_0xd300('0x52')],{'$or':_[_0xd300('0x55')](_0x51d063[_0xd300('0x4c')],function(_0x324a5a){var _0x5550ae={};_0x5550ae[_0x324a5a]={'$like':'%'+_0x23c847[_0xd300('0x4a')][_0xd300('0x6c')]+'%'};return _0x5550ae;})});}_0x51d063=_['merge']({},_0x51d063,_0x23c847[_0xd300('0x56')]);return db['Disposition'][_0xd300('0x34')]({'where':_0x51d063[_0xd300('0x52')]})[_0xd300('0x23')](function(_0x56511c){_0x38d00b['count']=_0x56511c;if(_0x23c847[_0xd300('0x4a')][_0xd300('0x57')]){_0x51d063[_0xd300('0x58')]=[{'all':!![]}];}return db['Disposition'][_0xd300('0x59')](_0x51d063);})['then'](function(_0x58cb32){_0x38d00b[_0xd300('0x6d')]=_0x58cb32;return _0x38d00b;});}})[_0xd300('0x23')](respondWithFilteredResult(_0x4ea503,_0x51d063))['catch'](handleError(_0x4ea503,null));};exports['removeDispositions']=function(_0xc9d018,_0x262ca1,_0x922bd7){return db[_0xd300('0x45')][_0xd300('0x61')]({'where':{'id':_0xc9d018[_0xd300('0x5a')]['id']}})['then'](handleEntityNotFound(_0x262ca1,null))['then'](function(_0x6a1bde){if(_0x6a1bde){return _0x6a1bde[_0xd300('0x6e')](_0xc9d018['query'][_0xd300('0x6f')]);}})[_0xd300('0x23')](respondWithStatusCode(_0x262ca1,null))[_0xd300('0x2d')](handleError(_0x262ca1,null));};exports[_0xd300('0x70')]=function(_0x319512,_0x1bb5e5,_0x3acf5e){if(_0x319512[_0xd300('0x5d')]['id']){delete _0x319512[_0xd300('0x5d')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x319512[_0xd300('0x5a')]['id']}})[_0xd300('0x23')](handleEntityNotFound(_0x1bb5e5,null))['then'](function(_0x5a9873){if(_0x5a9873){_0x319512[_0xd300('0x5d')]['FaxAccountId']=_0x5a9873['id'];return db[_0xd300('0x71')]['create'](_0x319512[_0xd300('0x5d')]);}})[_0xd300('0x23')](respondWithResult(_0x1bb5e5,null))[_0xd300('0x2d')](handleError(_0x1bb5e5,null));};exports[_0xd300('0x72')]=function(_0x5ed157,_0x2e0b2e,_0x19bef0){var _0x162e97={'raw':![],'where':{}};var _0x22df56={};var _0x199965={'count':0x0,'rows':[]};return db[_0xd300('0x45')][_0xd300('0x69')]({'where':{'id':_0x5ed157[_0xd300('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2e0b2e,null))[_0xd300('0x23')](function(_0x14f942){if(_0x14f942){_0x22df56[_0xd300('0x4b')]=_[_0xd300('0x5b')](db[_0xd300('0x71')][_0xd300('0x46')]);_0x22df56[_0xd300('0x4a')]=_[_0xd300('0x5b')](_0x5ed157[_0xd300('0x4a')]);_0x22df56[_0xd300('0x53')]=_[_0xd300('0x4d')](_0x22df56[_0xd300('0x4b')],_0x22df56[_0xd300('0x4a')]);_0x162e97[_0xd300('0x4c')]=_[_0xd300('0x4d')](_0x22df56[_0xd300('0x4b')],qs[_0xd300('0x4e')](_0x5ed157[_0xd300('0x4a')][_0xd300('0x4e')]));_0x162e97['attributes']=_0x162e97[_0xd300('0x4c')][_0xd300('0x4f')]?_0x162e97[_0xd300('0x4c')]:_0x22df56[_0xd300('0x4b')];if(!_0x5ed157[_0xd300('0x4a')][_0xd300('0x6a')](_0xd300('0x73'))){_0x162e97[_0xd300('0x33')]=qs['limit'](_0x5ed157[_0xd300('0x4a')][_0xd300('0x33')]);_0x162e97['offset']=qs['offset'](_0x5ed157['query'][_0xd300('0x31')]);}_0x162e97[_0xd300('0x50')]=qs[_0xd300('0x51')](_0x5ed157[_0xd300('0x4a')]['sort']);_0x162e97['where']=qs['filters'](_[_0xd300('0x6b')](_0x5ed157['query'],_0x22df56[_0xd300('0x53')]));_0x162e97[_0xd300('0x52')][_0xd300('0x66')]=_0x14f942['id'];if(_0x5ed157[_0xd300('0x4a')][_0xd300('0x6c')]){_0x162e97[_0xd300('0x52')]=_[_0xd300('0x54')](_0x162e97[_0xd300('0x52')],{'$or':_[_0xd300('0x55')](_0x162e97[_0xd300('0x4c')],function(_0x24d30f){var _0x467296={};_0x467296[_0x24d30f]={'$like':'%'+_0x5ed157['query'][_0xd300('0x6c')]+'%'};return _0x467296;})});}_0x162e97=_['merge']({},_0x162e97,_0x5ed157[_0xd300('0x56')]);return db['CannedAnswer'][_0xd300('0x34')]({'where':_0x162e97[_0xd300('0x52')]})[_0xd300('0x23')](function(_0x24d889){_0x199965[_0xd300('0x34')]=_0x24d889;if(_0x5ed157[_0xd300('0x4a')][_0xd300('0x57')]){_0x162e97[_0xd300('0x58')]=[{'all':!![]}];}return db[_0xd300('0x71')][_0xd300('0x59')](_0x162e97);})['then'](function(_0x22925f){_0x199965['rows']=_0x22925f;return _0x199965;});}})[_0xd300('0x23')](respondWithFilteredResult(_0x2e0b2e,_0x162e97))[_0xd300('0x2d')](handleError(_0x2e0b2e,null));};exports['removeAnswers']=function(_0x4ee90c,_0x43518e,_0x586ea1){return db[_0xd300('0x45')][_0xd300('0x61')]({'where':{'id':_0x4ee90c[_0xd300('0x5a')]['id']}})[_0xd300('0x23')](handleEntityNotFound(_0x43518e,null))['then'](function(_0x284cea){if(_0x284cea){return _0x284cea[_0xd300('0x74')](_0x4ee90c[_0xd300('0x4a')][_0xd300('0x6f')]);}})[_0xd300('0x23')](respondWithStatusCode(_0x43518e,null))['catch'](handleError(_0x43518e,null));};exports[_0xd300('0x75')]=function(_0x182236,_0x724fc2,_0x560963){return db['FaxInteraction']['find']({'where':{'id':_0x182236[_0xd300('0x5a')]['id']}})['then'](handleEntityNotFound(_0x724fc2,null))[_0xd300('0x23')](function(_0x640573){if(_0x640573){return _0x640573[_0xd300('0x75')](_0x182236[_0xd300('0x5d')][_0xd300('0x6f')],_[_0xd300('0x76')](_0x182236['body'],[_0xd300('0x6f'),'id'])||{});}})[_0xd300('0x23')](respondWithResult(_0x724fc2,null))['catch'](handleError(_0x724fc2,null));};exports['getInteractions']=function(_0xb277a5,_0x1cedcd,_0x3bcd79){var _0x30ae14={'raw':![],'where':{}};var _0x19aba0={};var _0x243cc9={'count':0x0,'rows':[]};return db[_0xd300('0x45')][_0xd300('0x69')]({'where':{'id':_0xb277a5[_0xd300('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1cedcd,null))[_0xd300('0x23')](function(_0x30741a){if(_0x30741a){_0x19aba0[_0xd300('0x4b')]=_[_0xd300('0x5b')](db[_0xd300('0x77')]['rawAttributes']);_0x19aba0[_0xd300('0x4a')]=_[_0xd300('0x5b')](_0xb277a5[_0xd300('0x4a')]);_0x19aba0[_0xd300('0x53')]=_[_0xd300('0x4d')](_0x19aba0[_0xd300('0x4b')],_0x19aba0[_0xd300('0x4a')]);_0x30ae14[_0xd300('0x4c')]=_['intersection'](_0x19aba0['model'],qs['fields'](_0xb277a5[_0xd300('0x4a')]['fields']));_0x30ae14[_0xd300('0x4c')]=_0x30ae14[_0xd300('0x4c')][_0xd300('0x4f')]?_0x30ae14[_0xd300('0x4c')]:_0x19aba0[_0xd300('0x4b')];if(!_0xb277a5[_0xd300('0x4a')]['hasOwnProperty'](_0xd300('0x73'))){_0x30ae14[_0xd300('0x33')]=qs[_0xd300('0x33')](_0xb277a5[_0xd300('0x4a')]['limit']);_0x30ae14[_0xd300('0x31')]=qs[_0xd300('0x31')](_0xb277a5['query'][_0xd300('0x31')]);}_0x30ae14[_0xd300('0x50')]=qs['sort'](_0xb277a5['query'][_0xd300('0x51')]);_0x30ae14[_0xd300('0x52')]=qs[_0xd300('0x53')](_[_0xd300('0x6b')](_0xb277a5[_0xd300('0x4a')],_0x19aba0[_0xd300('0x53')]));_0x30ae14[_0xd300('0x52')][_0xd300('0x66')]=_0x30741a['id'];if(_0xb277a5[_0xd300('0x4a')][_0xd300('0x6c')]){_0x30ae14[_0xd300('0x52')]=_[_0xd300('0x54')](_0x30ae14[_0xd300('0x52')],{'$or':_[_0xd300('0x55')](_0x30ae14[_0xd300('0x4c')],function(_0x501f1a){var _0x129d7b={};_0x129d7b[_0x501f1a]={'$like':'%'+_0xb277a5[_0xd300('0x4a')][_0xd300('0x6c')]+'%'};return _0x129d7b;})});}_0x30ae14=_['merge']({},_0x30ae14,_0xb277a5[_0xd300('0x56')]);return db[_0xd300('0x77')][_0xd300('0x34')]({'where':_0x30ae14['where']})[_0xd300('0x23')](function(_0x5e1007){_0x243cc9['count']=_0x5e1007;if(_0xb277a5[_0xd300('0x4a')][_0xd300('0x57')]){_0x30ae14[_0xd300('0x58')]=[{'model':db['CmContact'],'as':_0xd300('0x78'),'required':![]},{'model':db[_0xd300('0x79')],'as':_0xd300('0x7a'),'attributes':['name','fullname','internal'],'required':![]},{'model':db[_0xd300('0x7b')],'as':'Tags','attributes':['id',_0xd300('0x40'),_0xd300('0x7c')],'where':_0xb277a5[_0xd300('0x4a')]['tag']?{'id':_0xb277a5[_0xd300('0x4a')][_0xd300('0x7d')]}:undefined,'required':_0xb277a5[_0xd300('0x4a')][_0xd300('0x7d')]?!![]:![]}];}return db[_0xd300('0x77')]['findAll'](_0x30ae14);})[_0xd300('0x23')](function(_0xff7517){_0x243cc9[_0xd300('0x6d')]=_0xff7517;return _0x243cc9;});}})[_0xd300('0x23')](respondWithFilteredResult(_0x1cedcd,_0x30ae14))[_0xd300('0x2d')](handleError(_0x1cedcd,null));};exports[_0xd300('0x7e')]=function(_0x46e9f2,_0x4647d8,_0x5c27e0){return db[_0xd300('0x45')][_0xd300('0x69')]({'where':{'id':_0x46e9f2[_0xd300('0x5a')]['id']}})[_0xd300('0x23')](handleEntityNotFound(_0x4647d8,null))[_0xd300('0x23')](function(_0x50a8c3){if(_0x50a8c3){return db['sequelize'][_0xd300('0x7f')](function(_0x184f94){return db['FaxApplication'][_0xd300('0x3c')]({'where':{'FaxAccountId':_0x46e9f2[_0xd300('0x5a')]['id']},'transaction':_0x184f94})[_0xd300('0x23')](function(_0x1d8866){var _0x21aeae=_[_0xd300('0x55')](_0x46e9f2[_0xd300('0x5d')],function(_0x2eef89){_0x2eef89[_0xd300('0x66')]=_0x46e9f2[_0xd300('0x5a')]['id'];return _0x2eef89;});return db['FaxApplication'][_0xd300('0x80')](_0x21aeae,{'transaction':_0x184f94});});})[_0xd300('0x23')](function(){return db[_0xd300('0x81')][_0xd300('0x82')]({'where':{'FaxAccountId':_0x46e9f2[_0xd300('0x5a')]['id']},'order':_0xd300('0x83')});});}})[_0xd300('0x23')](respondWithResult(_0x4647d8,null))['catch'](handleError(_0x4647d8,null));};exports[_0xd300('0x84')]=function(_0x10a8e8,_0x2fbb81,_0x340f69){var _0xd8c3fb={};var _0x3ff2a7={};var _0x4d23d0;var _0x3b8cf6;return db[_0xd300('0x45')][_0xd300('0x69')]({'where':{'id':_0x10a8e8[_0xd300('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2fbb81,null))[_0xd300('0x23')](function(_0x59f8b1){if(_0x59f8b1){_0x4d23d0=_0x59f8b1;_0x3ff2a7[_0xd300('0x4b')]=_['keys'](db['FaxApplication'][_0xd300('0x46')]);_0x3ff2a7[_0xd300('0x4a')]=_[_0xd300('0x5b')](_0x10a8e8[_0xd300('0x4a')]);_0x3ff2a7[_0xd300('0x53')]=_[_0xd300('0x4d')](_0x3ff2a7[_0xd300('0x4b')],_0x3ff2a7['query']);_0xd8c3fb[_0xd300('0x4c')]=_[_0xd300('0x4d')](_0x3ff2a7[_0xd300('0x4b')],qs[_0xd300('0x4e')](_0x10a8e8['query'][_0xd300('0x4e')]));_0xd8c3fb[_0xd300('0x4c')]=_0xd8c3fb['attributes']['length']?_0xd8c3fb[_0xd300('0x4c')]:_0x3ff2a7[_0xd300('0x4b')];_0xd8c3fb[_0xd300('0x50')]=qs[_0xd300('0x51')](_0x10a8e8[_0xd300('0x4a')][_0xd300('0x51')]);_0xd8c3fb['where']=qs[_0xd300('0x53')](_['pick'](_0x10a8e8[_0xd300('0x4a')],_0x3ff2a7[_0xd300('0x53')]));if(_0x10a8e8[_0xd300('0x4a')]['filter']){_0xd8c3fb[_0xd300('0x52')]=_[_0xd300('0x54')](_0xd8c3fb['where'],{'$or':_[_0xd300('0x55')](_0xd8c3fb[_0xd300('0x4c')],function(_0x55ac14){var _0x3e1858={};_0x3e1858[_0x55ac14]={'$like':'%'+_0x10a8e8[_0xd300('0x4a')][_0xd300('0x6c')]+'%'};return _0x3e1858;})});}_0xd8c3fb=_[_0xd300('0x54')]({},_0xd8c3fb,_0x10a8e8[_0xd300('0x56')]);return _0x4d23d0[_0xd300('0x84')](_0xd8c3fb);}})[_0xd300('0x23')](function(_0x2db9b){if(_0x2db9b){_0x3b8cf6=_0x2db9b[_0xd300('0x4f')];if(!_0x10a8e8[_0xd300('0x4a')][_0xd300('0x6a')]('nolimit')){_0xd8c3fb[_0xd300('0x33')]=qs[_0xd300('0x33')](_0x10a8e8['query'][_0xd300('0x33')]);_0xd8c3fb['offset']=qs['offset'](_0x10a8e8['query'][_0xd300('0x31')]);}return _0x4d23d0['getApplications'](_0xd8c3fb);}})['then'](function(_0x1b6408){if(_0x1b6408){return _0x1b6408?{'count':_0x3b8cf6,'rows':_0x1b6408}:null;}})[_0xd300('0x23')](respondWithResult(_0x2fbb81,null))[_0xd300('0x2d')](handleError(_0x2fbb81,null));};function Extension(_0x7b0afb,_0x2869cf,_0x359c69,_0x1d0ed1){this[_0xd300('0x85')]='from-voip-provider';this[_0xd300('0x86')]=_0x7b0afb[_0xd300('0x87')];this['app']=_0x1d0ed1;this['type']=_0xd300('0x88');this[_0xd300('0x89')]='Fax\x20Extension';this[_0xd300('0x66')]=_0x7b0afb['id'];this['priority']=_0x2869cf;this['appdata']=_0x359c69;}function createExtensionsReciveFax(_0x1fdf60){var _0x42f2c0=0x1;var _0xc31d6a=[];_0xc31d6a[_0xd300('0x8a')](new Extension(_0x1fdf60,_0x42f2c0,'',_0xd300('0x8b')));_0x42f2c0+=0x1;_0xc31d6a[_0xd300('0x8a')](new Extension(_0x1fdf60,_0x42f2c0,_0xd300('0x8c'),_0xd300('0x8d')));_0x42f2c0+=0x1;for(var _0x578b5e in _0x1fdf60){if(_0x1fdf60[_0xd300('0x6a')](_0x578b5e)&&(_0x578b5e==='ecm'||_0x578b5e===_0xd300('0x87')||_0x578b5e===_0xd300('0x8e')||_0x578b5e==='faxdetect'||_0x578b5e==='headerinfo'||_0x578b5e===_0xd300('0x8f')||_0x578b5e===_0xd300('0x90')||_0x578b5e===_0xd300('0x91')||_0x578b5e===_0xd300('0x92'))){_0xc31d6a[_0xd300('0x8a')](new Extension(_0x1fdf60,_0x42f2c0,'FAXOPT('+_0x578b5e+')='+_0x1fdf60[_0x578b5e],'Set'));_0x42f2c0+=0x1;}}_0xc31d6a['push'](new Extension(_0x1fdf60,_0x42f2c0,'6',_0xd300('0x93')));_0x42f2c0+=0x1;_0xc31d6a[_0xd300('0x8a')](new Extension(_0x1fdf60,_0x42f2c0,'/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',_0xd300('0x94')));_0x42f2c0=0x0;return _0xc31d6a;}exports[_0xd300('0x95')]=function(_0x3ee5c9,_0x180394,_0x13d821){var _0x1b5148;return db[_0xd300('0x96')][_0xd300('0x7f')](function(_0x53e4c6){return db['FaxAccount']['create'](_0x3ee5c9['body'],{'transaction':_0x53e4c6})[_0xd300('0x23')](function(_0x4c1a27){_0x1b5148=_0x4c1a27[_0xd300('0x3d')]({'plain':!![]});return db['VoiceExtension'][_0xd300('0x80')](createExtensionsReciveFax(_0x1b5148),{'transaction':_0x53e4c6});});})[_0xd300('0x23')](function(){return _0x1b5148;})['then'](respondWithResult(_0x180394,null))['catch'](handleError(_0x180394,null));};exports[_0xd300('0x97')]=function(_0x43948c,_0x47bb78,_0x3169c5){var _0x283b71;return db[_0xd300('0x96')]['transaction'](function(_0x3ee693){return db[_0xd300('0x45')][_0xd300('0x3b')](_0x43948c['body'],{'where':{'id':_0x43948c[_0xd300('0x5d')]['id']},'transaction':_0x3ee693})[_0xd300('0x23')](function(_0x3054bc){return db[_0xd300('0x98')][_0xd300('0x3c')]({'where':{'FaxAccountId':_0x43948c[_0xd300('0x5d')]['id']},'transaction':_0x3ee693})['then'](function(_0x2bfb30){return db[_0xd300('0x98')][_0xd300('0x80')](createExtensionsReciveFax(_[_0xd300('0x76')](_0x43948c[_0xd300('0x5d')],[_0xd300('0x99'),_0xd300('0x49'),_0xd300('0x9a'),_0xd300('0x9b'),_0xd300('0x9c'),_0xd300('0x9d')])),{'transaction':_0x3ee693});});});})[_0xd300('0x23')](function(){return db[_0xd300('0x45')]['findById'](_0x43948c[_0xd300('0x5d')]['id']);})[_0xd300('0x23')](respondWithResult(_0x47bb78,null))[_0xd300('0x2d')](handleError(_0x47bb78,null));};exports['getMessages']=function(_0x3df20d,_0x3e35fe,_0x1f976c){var _0x4dda38={'raw':!![],'where':{}};var _0x54205f={};var _0x39257a={'count':0x0,'rows':[]};return db[_0xd300('0x45')][_0xd300('0x69')]({'where':{'id':_0x3df20d['params']['id']}})[_0xd300('0x23')](handleEntityNotFound(_0x3e35fe,null))[_0xd300('0x23')](function(_0x2fe6b0){if(_0x2fe6b0){_0x54205f[_0xd300('0x4b')]=_[_0xd300('0x5b')](db[_0xd300('0x9e')][_0xd300('0x46')]);_0x54205f[_0xd300('0x4a')]=_[_0xd300('0x5b')](_0x3df20d[_0xd300('0x4a')]);_0x54205f[_0xd300('0x53')]=_['intersection'](_0x54205f[_0xd300('0x4b')],_0x54205f[_0xd300('0x4a')]);_0x4dda38[_0xd300('0x4c')]=_[_0xd300('0x4d')](_0x54205f[_0xd300('0x4b')],qs[_0xd300('0x4e')](_0x3df20d[_0xd300('0x4a')][_0xd300('0x4e')]));_0x4dda38[_0xd300('0x4c')]=_0x4dda38[_0xd300('0x4c')][_0xd300('0x4f')]?_0x4dda38[_0xd300('0x4c')]:_0x54205f['model'];if(!_0x3df20d['query'][_0xd300('0x6a')](_0xd300('0x73'))){_0x4dda38[_0xd300('0x33')]=qs['limit'](_0x3df20d['query']['limit']);_0x4dda38['offset']=qs[_0xd300('0x31')](_0x3df20d[_0xd300('0x4a')][_0xd300('0x31')]);}_0x4dda38[_0xd300('0x50')]=qs[_0xd300('0x51')](_0x3df20d['query']['sort']);_0x4dda38['where']=qs[_0xd300('0x53')](_[_0xd300('0x6b')](_0x3df20d[_0xd300('0x4a')],_0x54205f[_0xd300('0x53')]));_0x4dda38['where'][_0xd300('0x66')]=_0x2fe6b0['id'];if(_0x3df20d[_0xd300('0x4a')][_0xd300('0x6c')]){_0x4dda38[_0xd300('0x52')]=_[_0xd300('0x54')](_0x4dda38[_0xd300('0x52')],{'$or':_[_0xd300('0x55')](_0x4dda38[_0xd300('0x4c')],function(_0x59d903){var _0x25fe09={};_0x25fe09[_0x59d903]={'$like':'%'+_0x3df20d[_0xd300('0x4a')]['filter']+'%'};return _0x25fe09;})});}if(_0x3df20d[_0xd300('0x4a')][_0xd300('0x9f')]){var _0x5e3387=_0x3df20d[_0xd300('0x4a')]['$gte'][_0xd300('0xa0')](',');var _0x87c75a={};_0x87c75a[_0x5e3387[0x0]]={'$gte':moment(_0x5e3387[0x1])[_0xd300('0xa1')](_0xd300('0xa2'))};_0x4dda38[_0xd300('0x52')]=_[_0xd300('0x54')](_0x4dda38[_0xd300('0x52')],_0x87c75a);}_0x4dda38=_[_0xd300('0x54')]({},_0x4dda38,_0x3df20d[_0xd300('0x56')]);return db['FaxMessage']['count']({'where':_0x4dda38[_0xd300('0x52')]})[_0xd300('0x23')](function(_0x3ee012){_0x39257a[_0xd300('0x34')]=_0x3ee012;if(_0x3df20d[_0xd300('0x4a')][_0xd300('0x57')]){_0x4dda38[_0xd300('0x58')]=[{'all':!![]}];}return db[_0xd300('0x9e')][_0xd300('0x59')](_0x4dda38);})[_0xd300('0x23')](function(_0x156b0a){_0x39257a[_0xd300('0x6d')]=_0x156b0a;return _0x39257a;});}})[_0xd300('0x23')](respondWithFilteredResult(_0x3e35fe,_0x4dda38))['catch'](handleError(_0x3e35fe,null));};exports[_0xd300('0x41')]=function(_0x11087a,_0x4fd6ee,_0x59472b){var _0x32ff82,_0x59c2bd={},_0xf6b4ea;if(_0x11087a[_0xd300('0x5d')]['to']){_0xf6b4ea=_0x11087a[_0xd300('0x5d')]['to'][0x0];}return db[_0xd300('0x45')][_0xd300('0x61')]({'where':{'id':_0x11087a['params']['id']},'include':[{'model':db[_0xd300('0xa3')],'as':_0xd300('0xa4'),'include':[{'model':db['CmContact'],'as':_0xd300('0xa5'),'where':{'fax':_0xf6b4ea},'limit':0x1,'order':[[_0xd300('0x9b'),_0xd300('0xa6')]]}]}]})[_0xd300('0x23')](handleEntityNotFound(_0x4fd6ee,null))[_0xd300('0x23')](function(_0x317ee4){_0x32ff82=_0x317ee4;if(_0x11087a[_0xd300('0x5d')][_0xd300('0xa7')]&&_0x11087a[_0xd300('0x5d')]['attachments']['length']){for(var _0x37280c=0x0;_0x37280c<_0x11087a[_0xd300('0x5d')]['attachments']['length'];_0x37280c+=0x1){_0x11087a[_0xd300('0x5d')][_0xd300('0xa7')][_0x37280c]={'filename':_0x11087a[_0xd300('0x5d')]['attachments'][_0x37280c]['name'],'id':_0x11087a[_0xd300('0x5d')][_0xd300('0xa7')][_0x37280c]['id'],'path':path[_0xd300('0xa8')](config[_0xd300('0xa9')],_0xd300('0xaa'),_0x11087a[_0xd300('0x5d')][_0xd300('0xa7')][_0x37280c][_0xd300('0xab')])};}}return respondWithRpcPromise(_0xd300('0xac'),_0xd300('0xac'),{'FaxAccountId':_[_0xd300('0xad')](_0x11087a[_0xd300('0x5a')]['id'])?undefined:_0x11087a[_0xd300('0x5a')]['id'],'path':_[_0xd300('0xad')](_0x11087a['body'][_0xd300('0xa7')][0x0][_0xd300('0x9')])?undefined:_0x11087a[_0xd300('0x5d')]['attachments'][0x0][_0xd300('0x9')],'fax':_[_0xd300('0xad')](_0x11087a['body']['to'][0x0])?undefined:_0x11087a[_0xd300('0x5d')]['to'][0x0]},client9002);})[_0xd300('0x23')](function(){if(_0x32ff82){if(_[_0xd300('0xad')](_0x11087a[_0xd300('0x5d')][_0xd300('0xae')])){_0x11087a['body'][_0xd300('0xae')]=util[_0xd300('0xa1')](_0xd300('0xaf'),_0x32ff82[_0xd300('0x40')],_0x32ff82[_0xd300('0xb0')]);}if(_0x32ff82[_0xd300('0xa4')]){if(_0x32ff82[_0xd300('0xa4')][_0xd300('0xa5')]['length']){return _0x32ff82[_0xd300('0xa4')][_0xd300('0xa5')][0x0];}else{return db[_0xd300('0xb1')][_0xd300('0x5c')](_[_0xd300('0xb2')](_0x11087a[_0xd300('0x5d')],{'firstName':_0x11087a[_0xd300('0x5d')]['to'][0x0],'phone':_0x11087a[_0xd300('0x5d')]['to'][0x0],'fax':_0x11087a['body']['to'][0x0],'ListId':_0x32ff82['ListId']}));}}else{throw new Error(_0xd300('0xb3'));}}else{throw new Error(_0xd300('0xb4'));}})['then'](function(_0x5691a2){if(_0x5691a2){return db['FaxInteraction'][_0xd300('0x61')]({'where':{'ContactId':_0x5691a2['id'],'closed':![],'FaxAccountId':_0x32ff82['id']}})[_0xd300('0x23')](function(_0x154ada){if(_0x154ada){return[_0x154ada,![]];}return db[_0xd300('0x77')][_0xd300('0x5c')]({'UserId':_0x11087a['user']['id'],'ContactId':_0x5691a2['id'],'FaxAccountId':_0x32ff82['id'],'fax':_0x11087a[_0xd300('0x5d')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0xd300('0x54')](_0x11087a['body'],{'read':![],'body':_0x11087a[_0xd300('0x5d')][_0xd300('0xa7')][0x0][_0xd300('0xb5')],'FaxAccountId':_0x32ff82['id'],'UserId':_0x11087a[_0xd300('0x5e')]['id'],'ContactId':_0x5691a2['id'],'AttachmentId':_0x11087a[_0xd300('0x5d')][_0xd300('0xa7')][0x0]['id']})]},{'include':[{'model':db[_0xd300('0x9e')],'as':_0xd300('0xb6')}]})['then'](function(_0x2f8191){return[_0x2f8191,!![]];});});}else{throw new Error(_0xd300('0xb7'));}})[_0xd300('0xb8')](function(_0x49475c,_0x1e0d9b){if(_0x1e0d9b){return _0x49475c;}return db[_0xd300('0x9e')][_0xd300('0x5c')]({'direction':_0xd300('0xb9'),'read':![],'body':_0x11087a[_0xd300('0x5d')]['attachments'][0x0]['filename'],'FaxAccountId':_0x32ff82['id'],'FaxInteractionId':_0x49475c['id'],'UserId':_0x11087a[_0xd300('0x5e')]['id'],'ContactId':_0x49475c[_0xd300('0xba')],'AttachmentId':_0x11087a[_0xd300('0x5d')]['attachments'][0x0]['id']})[_0xd300('0x23')](function(_0x20e08b){_0x49475c[_0xd300('0xbb')][_0xd300('0xb6')]=[];_0x49475c['dataValues'][_0xd300('0xb6')][_0xd300('0x8a')](_0x20e08b[_0xd300('0xbb')]);return _0x49475c;});})[_0xd300('0x23')](function(_0x36b89e){respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0xd300('0xad')](_0x11087a[_0xd300('0x5a')]['id'])?undefined:_0x11087a[_0xd300('0x5a')]['id'],'path':_[_0xd300('0xad')](_0x11087a[_0xd300('0x5d')][_0xd300('0xa7')][0x0][_0xd300('0x9')])?undefined:_0x11087a[_0xd300('0x5d')][_0xd300('0xa7')][0x0]['path'],'fax':_[_0xd300('0xad')](_0x11087a[_0xd300('0x5d')]['to'][0x0])?undefined:_0x11087a['body']['to'][0x0],'AttachmentId':_0x11087a[_0xd300('0x5d')]['attachments'][0x0]['id']},client9002)['then'](function(_0x58acf3){logger[_0xd300('0x24')](_0xd300('0xbc'),_0x58acf3);})['catch'](function(_0x943e87){logger[_0xd300('0x24')](_0xd300('0xbc'),_0x943e87);});return _0x36b89e;})[_0xd300('0x23')](respondWithResult(_0x4fd6ee,null))[_0xd300('0x2d')](handleError(_0x4fd6ee,null));};exports[_0xd300('0xbd')]=function(_0x2a91c7,_0xa07a77,_0x442b2c){return db[_0xd300('0x45')][_0xd300('0x61')]({'where':{'id':_0x2a91c7[_0xd300('0x5a')]['id']}})[_0xd300('0x23')](handleEntityNotFound(_0xa07a77,null))[_0xd300('0x23')](function(_0x365e50){if(_0x365e50){return _0x365e50[_0xd300('0xbd')](_0x2a91c7[_0xd300('0x5d')][_0xd300('0x6f')],_[_0xd300('0x76')](_0x2a91c7[_0xd300('0x5d')],[_0xd300('0x6f'),'id'])||{})[_0xd300('0xb8')](function(_0x476647){for(var _0x21e6f7=0x0;_0x21e6f7<_0x2a91c7[_0xd300('0x5d')][_0xd300('0x6f')][_0xd300('0x4f')];_0x21e6f7+=0x1){socket[_0xd300('0xbe')](_0xd300('0xbf'),{'UserId':Number(_0x2a91c7['body'][_0xd300('0x6f')][_0x21e6f7]),'FaxAccountId':Number(_0x2a91c7[_0xd300('0x5a')]['id'])});}return _0x476647;});}})[_0xd300('0x23')](respondWithResult(_0xa07a77,null))[_0xd300('0x2d')](handleError(_0xa07a77,null));};exports[_0xd300('0xc0')]=function(_0x3d773c,_0x2f30a4,_0x5abd58){return db[_0xd300('0x45')]['find']({'where':{'id':_0x3d773c[_0xd300('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2f30a4,null))[_0xd300('0x23')](function(_0x169b3f){if(_0x169b3f){return _0x169b3f[_0xd300('0xc0')](_0x3d773c[_0xd300('0x4a')][_0xd300('0x6f')])['then'](function(){if(_[_0xd300('0xc1')](_0x3d773c[_0xd300('0x4a')][_0xd300('0x6f')])){for(var _0x154e18=0x0;_0x154e18<_0x3d773c['query'][_0xd300('0x6f')][_0xd300('0x4f')];_0x154e18+=0x1){socket[_0xd300('0xbe')](_0xd300('0xc2'),{'UserId':Number(_0x3d773c[_0xd300('0x4a')][_0xd300('0x6f')][_0x154e18]),'FaxAccountId':Number(_0x3d773c[_0xd300('0x5a')]['id'])});}}else{socket[_0xd300('0xbe')]('userFaxAccount:remove',{'UserId':Number(_0x3d773c['query'][_0xd300('0x6f')]),'FaxAccountId':Number(_0x3d773c[_0xd300('0x5a')]['id'])});}});}})[_0xd300('0x23')](respondWithStatusCode(_0x2f30a4,null))[_0xd300('0x2d')](handleError(_0x2f30a4,null));};exports[_0xd300('0xc3')]=function(_0x3c9dfc,_0x21b204,_0x53767e){var _0x5d1bc1={};var _0x2e95cb={};var _0x38d71b;var _0x5d0311;return db[_0xd300('0x45')][_0xd300('0x69')]({'where':{'id':_0x3c9dfc[_0xd300('0x5a')]['id']}})['then'](handleEntityNotFound(_0x21b204,null))[_0xd300('0x23')](function(_0x2d718f){if(_0x2d718f){_0x38d71b=_0x2d718f;_0x2e95cb['model']=_[_0xd300('0x5b')](db[_0xd300('0x79')][_0xd300('0x46')]);_0x2e95cb[_0xd300('0x4a')]=_[_0xd300('0x5b')](_0x3c9dfc[_0xd300('0x4a')]);_0x2e95cb[_0xd300('0x53')]=_[_0xd300('0x4d')](_0x2e95cb[_0xd300('0x4b')],_0x2e95cb[_0xd300('0x4a')]);_0x5d1bc1['attributes']=_['intersection'](_0x2e95cb['model'],qs[_0xd300('0x4e')](_0x3c9dfc[_0xd300('0x4a')]['fields']));_0x5d1bc1['attributes']=_0x5d1bc1[_0xd300('0x4c')]['length']?_0x5d1bc1[_0xd300('0x4c')]:_0x2e95cb[_0xd300('0x4b')];_0x5d1bc1[_0xd300('0x50')]=qs[_0xd300('0x51')](_0x3c9dfc[_0xd300('0x4a')][_0xd300('0x51')]);_0x5d1bc1[_0xd300('0x52')]=qs[_0xd300('0x53')](_[_0xd300('0x6b')](_0x3c9dfc[_0xd300('0x4a')],_0x2e95cb[_0xd300('0x53')]));if(_0x3c9dfc[_0xd300('0x4a')]['filter']){_0x5d1bc1[_0xd300('0x52')]=_[_0xd300('0x54')](_0x5d1bc1['where'],{'$or':_[_0xd300('0x55')](_0x5d1bc1['attributes'],function(_0x379dd4){var _0x5ac373={};_0x5ac373[_0x379dd4]={'$like':'%'+_0x3c9dfc[_0xd300('0x4a')][_0xd300('0x6c')]+'%'};return _0x5ac373;})});}_0x5d1bc1=_['merge']({},_0x5d1bc1,_0x3c9dfc[_0xd300('0x56')]);return _0x38d71b[_0xd300('0xc3')](_0x5d1bc1);}})[_0xd300('0x23')](function(_0x16db2b){if(_0x16db2b){_0x5d0311=_0x16db2b['length'];if(!_0x3c9dfc[_0xd300('0x4a')]['hasOwnProperty'](_0xd300('0x73'))){_0x5d1bc1[_0xd300('0x33')]=qs[_0xd300('0x33')](_0x3c9dfc[_0xd300('0x4a')][_0xd300('0x33')]);_0x5d1bc1['offset']=qs[_0xd300('0x31')](_0x3c9dfc[_0xd300('0x4a')]['offset']);}return _0x38d71b['getAgents'](_0x5d1bc1);}})['then'](function(_0x488998){if(_0x488998){return _0x488998?{'count':_0x5d0311,'rows':_0x488998}:null;}})[_0xd300('0x23')](respondWithResult(_0x21b204,null))['catch'](handleError(_0x21b204,null));}; \ No newline at end of file +var _0x3547=['userFaxAccount:remove','getAgents','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','FaxAccount,\x20%s,\x20%s','message','catch','status','end','json','offset','limit','undefined','count','set','apply','save','update','destroy','FaxAccounts','stack','name','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','Disposition','getDispositions','findOne','nolimit','FaxAccountId','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','FaxInteraction','ids','order','CmContact','Contact','User','Owner','fullname','internal','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','from-voip-provider','localstationid','app','description','Fax\x20Extension','appdata','Answer','push','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','maxrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','omit','key','createdAt','updatedAt','getMessages','FaxMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','send','CmList','List','Contacts','DESC','attachments','join','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','ListId','filename','Messages','Contact\x20not\x20found','spread','out','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','isArray','emit'];(function(_0x26e87a,_0x14c227){var _0x211c55=function(_0x304a0a){while(--_0x304a0a){_0x26e87a['push'](_0x26e87a['shift']());}};_0x211c55(++_0x14c227);}(_0x3547,0xc0));var _0x7354=function(_0x4dbfa3,_0x3b74b5){_0x4dbfa3=_0x4dbfa3-0x0;var _0x40de91=_0x3547[_0x4dbfa3];return _0x40de91;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7354('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7354('0x1'));var rp=require(_0x7354('0x2'));var moment=require(_0x7354('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7354('0x4'));var util=require(_0x7354('0x5'));var path=require(_0x7354('0x6'));var sox=require(_0x7354('0x7'));var csv=require(_0x7354('0x8'));var ejs=require(_0x7354('0x9'));var fs=require('fs');var fs_extra=require(_0x7354('0xa'));var _=require(_0x7354('0xb'));var squel=require('squel');var crypto=require(_0x7354('0xc'));var jsforce=require(_0x7354('0xd'));var deskjs=require(_0x7354('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7354('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7354('0x10'));var qs=require(_0x7354('0x11'));var as=require(_0x7354('0x12'));var hardwareService=require(_0x7354('0x13'));var logger=require(_0x7354('0x14'))('api');var utils=require(_0x7354('0x15'));var config=require(_0x7354('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7354('0x17'))['db'];config[_0x7354('0x18')]=_[_0x7354('0x19')](config[_0x7354('0x18')],{'host':_0x7354('0x1a'),'port':0x18eb});var socket=require(_0x7354('0x1b'))(new Redis(config[_0x7354('0x18')]));require('./faxAccount.socket')[_0x7354('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x7354('0x1d')][_0x7354('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x7354('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x53b4b4,_0x498339,_0x1bee27,_0x2df8bb){return new BPromise(function(_0x33d6cc,_0x51cf02){var _0x26db2e=_0x2df8bb||client;return _0x26db2e[_0x7354('0x1f')](_0x53b4b4,_0x1bee27)[_0x7354('0x20')](function(_0x40116e){logger[_0x7354('0x21')]('FaxAccount,\x20%s,\x20%s',_0x498339,_0x7354('0x22'));logger[_0x7354('0x23')](_0x7354('0x24'),_0x498339,_0x7354('0x22'),JSON[_0x7354('0x25')](_0x40116e));if(_0x40116e['error']){if(_0x40116e['error']['code']===0x1f4){logger[_0x7354('0x26')](_0x7354('0x27'),_0x498339,_0x40116e['error'][_0x7354('0x28')]);return _0x51cf02(_0x40116e[_0x7354('0x26')][_0x7354('0x28')]);}logger[_0x7354('0x26')](_0x7354('0x27'),_0x498339,_0x40116e[_0x7354('0x26')][_0x7354('0x28')]);return _0x33d6cc(_0x40116e['error'][_0x7354('0x28')]);}else{logger[_0x7354('0x21')](_0x7354('0x27'),_0x498339,_0x7354('0x22'));_0x33d6cc(_0x40116e['result']['message']);}})[_0x7354('0x29')](function(_0x1b1f63){logger[_0x7354('0x26')](_0x7354('0x27'),_0x498339,_0x1b1f63);_0x51cf02(_0x1b1f63);});});}function respondWithStatusCode(_0x1f13b3,_0x57f9dc){_0x57f9dc=_0x57f9dc||0xcc;return function(_0x3679d8){if(_0x3679d8){return _0x1f13b3['sendStatus'](_0x57f9dc);}return _0x1f13b3[_0x7354('0x2a')](_0x57f9dc)[_0x7354('0x2b')]();};}function respondWithResult(_0x1c5c77,_0xa52f47){_0xa52f47=_0xa52f47||0xc8;return function(_0x236f81){if(_0x236f81){return _0x1c5c77[_0x7354('0x2a')](_0xa52f47)[_0x7354('0x2c')](_0x236f81);}};}function respondWithFilteredResult(_0x2a3aca,_0x13773a){return function(_0x1b9fcf){if(_0x1b9fcf){var _0xf9826a=typeof _0x13773a[_0x7354('0x2d')]==='undefined'&&typeof _0x13773a[_0x7354('0x2e')]===_0x7354('0x2f');var _0x1da286=_0x1b9fcf[_0x7354('0x30')];var _0x80e2de=_0xf9826a?0x0:_0x13773a[_0x7354('0x2d')];var _0x1a0978=_0xf9826a?_0x1b9fcf[_0x7354('0x30')]:_0x13773a[_0x7354('0x2d')]+_0x13773a[_0x7354('0x2e')];var _0x2d34b6;if(_0x1a0978>=_0x1da286){_0x1a0978=_0x1da286;_0x2d34b6=0xc8;}else{_0x2d34b6=0xce;}_0x2a3aca[_0x7354('0x2a')](_0x2d34b6);return _0x2a3aca[_0x7354('0x31')]('Content-Range',_0x80e2de+'-'+_0x1a0978+'/'+_0x1da286)[_0x7354('0x2c')](_0x1b9fcf);}return null;};}function patchUpdates(_0x421fcb){return function(_0xd504b4){try{jsonpatch[_0x7354('0x32')](_0xd504b4,_0x421fcb,!![]);}catch(_0x3753dc){return BPromise['reject'](_0x3753dc);}return _0xd504b4[_0x7354('0x33')]();};}function saveUpdates(_0x595899,_0x580fa6){return function(_0x32266b){if(_0x32266b){return _0x32266b[_0x7354('0x34')](_0x595899)['then'](function(_0x5311b4){return _0x5311b4;});}return null;};}function removeEntity(_0x1dd28f,_0x2d9693){return function(_0x5635ed){if(_0x5635ed){return _0x5635ed[_0x7354('0x35')]()['then'](function(){var _0x1ea1b3=_0x5635ed['get']({'plain':!![]});var _0x5aecd3=_0x7354('0x36');return db['UserProfileResource']['destroy']({'where':{'type':_0x5aecd3,'resourceId':_0x1ea1b3['id']}})[_0x7354('0x20')](function(){return _0x5635ed;});})[_0x7354('0x20')](function(){_0x1dd28f[_0x7354('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29dae6,_0x579afe){return function(_0x2b60fd){if(!_0x2b60fd){_0x29dae6['sendStatus'](0x194);}return _0x2b60fd;};}function handleError(_0x25c035,_0x4f6ba6){_0x4f6ba6=_0x4f6ba6||0x1f4;return function(_0xed3de6){logger[_0x7354('0x26')](_0xed3de6[_0x7354('0x37')]);if(_0xed3de6[_0x7354('0x38')]){delete _0xed3de6['name'];}_0x25c035[_0x7354('0x2a')](_0x4f6ba6)['send'](_0xed3de6);};}exports[_0x7354('0x39')]=function(_0x406d3d,_0x8eaa7e){var _0x6bad5d={'include':[{'model':db[_0x7354('0x3a')],'as':_0x7354('0x3b')}]},_0x36189c={},_0x25807e={'count':0x0,'rows':[]};var _0xc6e427=_[_0x7354('0x3c')](db[_0x7354('0x3d')][_0x7354('0x3e')],function(_0x49f480){return{'name':_0x49f480[_0x7354('0x3f')],'type':_0x49f480[_0x7354('0x40')]['key']};});_0x36189c['model']=_['map'](_0xc6e427,_0x7354('0x38'));_0x36189c[_0x7354('0x41')]=_[_0x7354('0x42')](_0x406d3d['query']);_0x36189c[_0x7354('0x43')]=_[_0x7354('0x44')](_0x36189c[_0x7354('0x45')],_0x36189c[_0x7354('0x41')]);_0x6bad5d[_0x7354('0x46')]=_[_0x7354('0x44')](_0x36189c[_0x7354('0x45')],qs['fields'](_0x406d3d[_0x7354('0x41')][_0x7354('0x47')]));_0x6bad5d[_0x7354('0x46')]=_0x6bad5d[_0x7354('0x46')]['length']?_0x6bad5d[_0x7354('0x46')]:_0x36189c[_0x7354('0x45')];if(!_0x406d3d[_0x7354('0x41')][_0x7354('0x48')]('nolimit')){_0x6bad5d['limit']=qs[_0x7354('0x2e')](_0x406d3d[_0x7354('0x41')]['limit']);_0x6bad5d[_0x7354('0x2d')]=qs[_0x7354('0x2d')](_0x406d3d[_0x7354('0x41')][_0x7354('0x2d')]);}_0x6bad5d['order']=qs[_0x7354('0x49')](_0x406d3d[_0x7354('0x41')][_0x7354('0x49')]);_0x6bad5d[_0x7354('0x4a')]=qs['filters'](_[_0x7354('0x4b')](_0x406d3d['query'],_0x36189c[_0x7354('0x43')]),_0xc6e427);if(_0x406d3d['query'][_0x7354('0x4c')]){_0x6bad5d[_0x7354('0x4a')]=_['merge'](_0x6bad5d['where'],{'$or':_[_0x7354('0x3c')](_0xc6e427,function(_0x2a05ae){if(_0x2a05ae[_0x7354('0x40')]!=='VIRTUAL'){var _0x546635={};_0x546635[_0x2a05ae[_0x7354('0x38')]]={'$like':'%'+_0x406d3d[_0x7354('0x41')][_0x7354('0x4c')]+'%'};return _0x546635;}})});}_0x6bad5d=_[_0x7354('0x4d')]({},_0x6bad5d,_0x406d3d[_0x7354('0x4e')]);var _0x4f9d39={'where':_0x6bad5d[_0x7354('0x4a')]};return db['FaxAccount'][_0x7354('0x30')](_0x4f9d39)[_0x7354('0x20')](function(_0x1e316c){_0x25807e['count']=_0x1e316c;if(_0x406d3d[_0x7354('0x41')][_0x7354('0x4f')]){_0x6bad5d[_0x7354('0x50')]=[{'all':!![]}];}return db[_0x7354('0x3d')][_0x7354('0x51')](_0x6bad5d);})[_0x7354('0x20')](function(_0x1fbeaf){_0x25807e[_0x7354('0x52')]=_0x1fbeaf;return _0x25807e;})[_0x7354('0x20')](respondWithFilteredResult(_0x8eaa7e,_0x6bad5d))[_0x7354('0x29')](handleError(_0x8eaa7e,null));};exports['show']=function(_0x314e39,_0x3ee9c4){var _0x33ec3b={'raw':![],'where':{'id':_0x314e39['params']['id']},'include':[{'model':db[_0x7354('0x3a')],'as':'mandatoryDispositionPause'}]},_0x5a8aba={};_0x5a8aba[_0x7354('0x45')]=_[_0x7354('0x42')](db['FaxAccount']['rawAttributes']);_0x5a8aba[_0x7354('0x41')]=_[_0x7354('0x42')](_0x314e39[_0x7354('0x41')]);_0x5a8aba[_0x7354('0x43')]=_[_0x7354('0x44')](_0x5a8aba['model'],_0x5a8aba[_0x7354('0x41')]);_0x33ec3b['attributes']=_[_0x7354('0x44')](_0x5a8aba[_0x7354('0x45')],qs[_0x7354('0x47')](_0x314e39[_0x7354('0x41')][_0x7354('0x47')]));_0x33ec3b[_0x7354('0x46')]=_0x33ec3b[_0x7354('0x46')][_0x7354('0x53')]?_0x33ec3b[_0x7354('0x46')]:_0x5a8aba['model'];if(_0x314e39[_0x7354('0x41')]['includeAll']){_0x33ec3b[_0x7354('0x50')]=[{'all':!![]}];}_0x33ec3b=_[_0x7354('0x4d')]({},_0x33ec3b,_0x314e39[_0x7354('0x4e')]);return db[_0x7354('0x3d')][_0x7354('0x54')](_0x33ec3b)[_0x7354('0x20')](handleEntityNotFound(_0x3ee9c4,null))[_0x7354('0x20')](respondWithResult(_0x3ee9c4,null))[_0x7354('0x29')](handleError(_0x3ee9c4,null));};exports[_0x7354('0x55')]=function(_0x27c1b3,_0x3842da){return db[_0x7354('0x3d')][_0x7354('0x55')](_0x27c1b3[_0x7354('0x56')],{})['then'](function(_0x5a1100){var _0x43d21d=_0x27c1b3[_0x7354('0x57')][_0x7354('0x58')]({'plain':!![]});if(!_0x43d21d)throw new Error(_0x7354('0x59'));if(_0x43d21d[_0x7354('0x5a')]===_0x7354('0x57')){var _0x403740=_0x5a1100['get']({'plain':!![]});var _0x3d0721=_0x7354('0x36');return db[_0x7354('0x5b')][_0x7354('0x54')]({'where':{'name':_0x3d0721,'userProfileId':_0x43d21d[_0x7354('0x5c')]},'raw':!![]})[_0x7354('0x20')](function(_0xe02f95){if(_0xe02f95&&_0xe02f95['autoAssociation']===0x0){return db[_0x7354('0x5d')][_0x7354('0x55')]({'name':_0x403740[_0x7354('0x38')],'resourceId':_0x403740['id'],'type':_0xe02f95[_0x7354('0x38')],'sectionId':_0xe02f95['id']},{})['then'](function(){return _0x5a1100;});}else{return _0x5a1100;}})['catch'](function(_0x6d2c1){logger['error'](_0x7354('0x5e'),_0x6d2c1);throw _0x6d2c1;});}return _0x5a1100;})[_0x7354('0x20')](respondWithResult(_0x3842da,0xc9))[_0x7354('0x29')](handleError(_0x3842da,null));};exports['update']=function(_0x242308,_0x16f228){if(_0x242308['body']['id']){delete _0x242308['body']['id'];}return db[_0x7354('0x3d')]['find']({'where':{'id':_0x242308[_0x7354('0x5f')]['id']},'include':[{'model':db[_0x7354('0x3a')],'as':'mandatoryDispositionPause'}]})[_0x7354('0x20')](handleEntityNotFound(_0x16f228,null))[_0x7354('0x20')](saveUpdates(_0x242308[_0x7354('0x56')],null))['then'](respondWithResult(_0x16f228,null))[_0x7354('0x29')](handleError(_0x16f228,null));};exports['destroy']=function(_0x1982c9,_0x4dbb13){return db[_0x7354('0x3d')]['find']({'where':{'id':_0x1982c9[_0x7354('0x5f')]['id']}})['then'](handleEntityNotFound(_0x4dbb13,null))[_0x7354('0x20')](removeEntity(_0x4dbb13,null))[_0x7354('0x29')](handleError(_0x4dbb13,null));};exports[_0x7354('0x60')]=function(_0x3a73b9,_0x64193b){return db[_0x7354('0x3d')][_0x7354('0x60')]()[_0x7354('0x20')](respondWithResult(_0x64193b,null))[_0x7354('0x29')](handleError(_0x64193b,null));};exports['addDisposition']=function(_0x5c1696,_0x14438f,_0x281bea){if(_0x5c1696[_0x7354('0x56')]['id']){delete _0x5c1696[_0x7354('0x56')]['id'];}return db[_0x7354('0x3d')][_0x7354('0x54')]({'where':{'id':_0x5c1696['params']['id']}})['then'](handleEntityNotFound(_0x14438f,null))[_0x7354('0x20')](function(_0x49f332){if(_0x49f332){_0x5c1696['body']['FaxAccountId']=_0x49f332['id'];return db[_0x7354('0x61')][_0x7354('0x55')](_0x5c1696[_0x7354('0x56')]);}})['then'](respondWithResult(_0x14438f,null))[_0x7354('0x29')](handleError(_0x14438f,null));};exports[_0x7354('0x62')]=function(_0x5896f3,_0x1314f2,_0x5b0b64){var _0x425b0a={'raw':![],'where':{}};var _0x2ecb45={};var _0x38d4f6={'count':0x0,'rows':[]};return db[_0x7354('0x3d')][_0x7354('0x63')]({'where':{'id':_0x5896f3[_0x7354('0x5f')]['id']}})['then'](handleEntityNotFound(_0x1314f2,null))[_0x7354('0x20')](function(_0x2bbf6e){if(_0x2bbf6e){_0x2ecb45['model']=_[_0x7354('0x42')](db[_0x7354('0x61')][_0x7354('0x3e')]);_0x2ecb45[_0x7354('0x41')]=_[_0x7354('0x42')](_0x5896f3[_0x7354('0x41')]);_0x2ecb45[_0x7354('0x43')]=_[_0x7354('0x44')](_0x2ecb45['model'],_0x2ecb45[_0x7354('0x41')]);_0x425b0a[_0x7354('0x46')]=_[_0x7354('0x44')](_0x2ecb45[_0x7354('0x45')],qs[_0x7354('0x47')](_0x5896f3[_0x7354('0x41')][_0x7354('0x47')]));_0x425b0a[_0x7354('0x46')]=_0x425b0a['attributes']['length']?_0x425b0a[_0x7354('0x46')]:_0x2ecb45['model'];if(!_0x5896f3[_0x7354('0x41')][_0x7354('0x48')](_0x7354('0x64'))){_0x425b0a[_0x7354('0x2e')]=qs[_0x7354('0x2e')](_0x5896f3[_0x7354('0x41')][_0x7354('0x2e')]);_0x425b0a[_0x7354('0x2d')]=qs['offset'](_0x5896f3[_0x7354('0x41')][_0x7354('0x2d')]);}_0x425b0a['order']=qs[_0x7354('0x49')](_0x5896f3[_0x7354('0x41')][_0x7354('0x49')]);_0x425b0a[_0x7354('0x4a')]=qs[_0x7354('0x43')](_['pick'](_0x5896f3['query'],_0x2ecb45['filters']));_0x425b0a[_0x7354('0x4a')][_0x7354('0x65')]=_0x2bbf6e['id'];if(_0x5896f3[_0x7354('0x41')]['filter']){_0x425b0a[_0x7354('0x4a')]=_[_0x7354('0x4d')](_0x425b0a[_0x7354('0x4a')],{'$or':_[_0x7354('0x3c')](_0x425b0a[_0x7354('0x46')],function(_0x1a5e34){var _0x25470d={};_0x25470d[_0x1a5e34]={'$like':'%'+_0x5896f3['query'][_0x7354('0x4c')]+'%'};return _0x25470d;})});}_0x425b0a=_[_0x7354('0x4d')]({},_0x425b0a,_0x5896f3['options']);return db['Disposition']['count']({'where':_0x425b0a[_0x7354('0x4a')]})[_0x7354('0x20')](function(_0x524241){_0x38d4f6[_0x7354('0x30')]=_0x524241;if(_0x5896f3[_0x7354('0x41')][_0x7354('0x4f')]){_0x425b0a[_0x7354('0x50')]=[{'all':!![]}];}return db[_0x7354('0x61')][_0x7354('0x51')](_0x425b0a);})[_0x7354('0x20')](function(_0x37defb){_0x38d4f6[_0x7354('0x52')]=_0x37defb;return _0x38d4f6;});}})[_0x7354('0x20')](respondWithFilteredResult(_0x1314f2,_0x425b0a))['catch'](handleError(_0x1314f2,null));};exports[_0x7354('0x66')]=function(_0x4b3de7,_0x25682f,_0x114990){return db[_0x7354('0x3d')][_0x7354('0x54')]({'where':{'id':_0x4b3de7[_0x7354('0x5f')]['id']}})[_0x7354('0x20')](handleEntityNotFound(_0x25682f,null))['then'](function(_0x41134){if(_0x41134){return _0x41134[_0x7354('0x66')](_0x4b3de7[_0x7354('0x41')]['ids']);}})['then'](respondWithStatusCode(_0x25682f,null))[_0x7354('0x29')](handleError(_0x25682f,null));};exports[_0x7354('0x67')]=function(_0x4ba06d,_0x8af00e,_0x5784f7){if(_0x4ba06d['body']['id']){delete _0x4ba06d[_0x7354('0x56')]['id'];}return db[_0x7354('0x3d')][_0x7354('0x54')]({'where':{'id':_0x4ba06d[_0x7354('0x5f')]['id']}})[_0x7354('0x20')](handleEntityNotFound(_0x8af00e,null))[_0x7354('0x20')](function(_0xdcd463){if(_0xdcd463){_0x4ba06d[_0x7354('0x56')][_0x7354('0x65')]=_0xdcd463['id'];return db[_0x7354('0x68')][_0x7354('0x55')](_0x4ba06d[_0x7354('0x56')]);}})[_0x7354('0x20')](respondWithResult(_0x8af00e,null))[_0x7354('0x29')](handleError(_0x8af00e,null));};exports[_0x7354('0x69')]=function(_0x367534,_0x2a461f,_0x4f6d5c){var _0x16e8eb={'raw':![],'where':{}};var _0x2f8485={};var _0x58c42b={'count':0x0,'rows':[]};return db[_0x7354('0x3d')][_0x7354('0x63')]({'where':{'id':_0x367534[_0x7354('0x5f')]['id']}})[_0x7354('0x20')](handleEntityNotFound(_0x2a461f,null))[_0x7354('0x20')](function(_0x59032a){if(_0x59032a){_0x2f8485['model']=_[_0x7354('0x42')](db[_0x7354('0x68')]['rawAttributes']);_0x2f8485[_0x7354('0x41')]=_[_0x7354('0x42')](_0x367534['query']);_0x2f8485[_0x7354('0x43')]=_['intersection'](_0x2f8485['model'],_0x2f8485[_0x7354('0x41')]);_0x16e8eb[_0x7354('0x46')]=_[_0x7354('0x44')](_0x2f8485['model'],qs[_0x7354('0x47')](_0x367534[_0x7354('0x41')][_0x7354('0x47')]));_0x16e8eb['attributes']=_0x16e8eb[_0x7354('0x46')][_0x7354('0x53')]?_0x16e8eb[_0x7354('0x46')]:_0x2f8485[_0x7354('0x45')];if(!_0x367534[_0x7354('0x41')][_0x7354('0x48')](_0x7354('0x64'))){_0x16e8eb['limit']=qs[_0x7354('0x2e')](_0x367534['query'][_0x7354('0x2e')]);_0x16e8eb[_0x7354('0x2d')]=qs[_0x7354('0x2d')](_0x367534[_0x7354('0x41')][_0x7354('0x2d')]);}_0x16e8eb['order']=qs[_0x7354('0x49')](_0x367534[_0x7354('0x41')]['sort']);_0x16e8eb[_0x7354('0x4a')]=qs['filters'](_[_0x7354('0x4b')](_0x367534['query'],_0x2f8485[_0x7354('0x43')]));_0x16e8eb[_0x7354('0x4a')]['FaxAccountId']=_0x59032a['id'];if(_0x367534[_0x7354('0x41')]['filter']){_0x16e8eb[_0x7354('0x4a')]=_[_0x7354('0x4d')](_0x16e8eb['where'],{'$or':_[_0x7354('0x3c')](_0x16e8eb['attributes'],function(_0x1a2d25){var _0x1e76f7={};_0x1e76f7[_0x1a2d25]={'$like':'%'+_0x367534[_0x7354('0x41')]['filter']+'%'};return _0x1e76f7;})});}_0x16e8eb=_[_0x7354('0x4d')]({},_0x16e8eb,_0x367534[_0x7354('0x4e')]);return db[_0x7354('0x68')]['count']({'where':_0x16e8eb[_0x7354('0x4a')]})[_0x7354('0x20')](function(_0x23f5ec){_0x58c42b[_0x7354('0x30')]=_0x23f5ec;if(_0x367534['query'][_0x7354('0x4f')]){_0x16e8eb[_0x7354('0x50')]=[{'all':!![]}];}return db['CannedAnswer'][_0x7354('0x51')](_0x16e8eb);})[_0x7354('0x20')](function(_0x37a7c6){_0x58c42b[_0x7354('0x52')]=_0x37a7c6;return _0x58c42b;});}})[_0x7354('0x20')](respondWithFilteredResult(_0x2a461f,_0x16e8eb))['catch'](handleError(_0x2a461f,null));};exports['removeAnswers']=function(_0x1a53e4,_0x5eac4a,_0x14c3b8){return db['FaxAccount'][_0x7354('0x54')]({'where':{'id':_0x1a53e4[_0x7354('0x5f')]['id']}})[_0x7354('0x20')](handleEntityNotFound(_0x5eac4a,null))[_0x7354('0x20')](function(_0x19b9b6){if(_0x19b9b6){return _0x19b9b6[_0x7354('0x6a')](_0x1a53e4['query']['ids']);}})[_0x7354('0x20')](respondWithStatusCode(_0x5eac4a,null))[_0x7354('0x29')](handleError(_0x5eac4a,null));};exports['addInteraction']=function(_0x1353df,_0x4eaba5,_0xe8d45d){return db[_0x7354('0x6b')]['find']({'where':{'id':_0x1353df[_0x7354('0x5f')]['id']}})[_0x7354('0x20')](handleEntityNotFound(_0x4eaba5,null))[_0x7354('0x20')](function(_0x13c021){if(_0x13c021){return _0x13c021['addInteraction'](_0x1353df[_0x7354('0x56')][_0x7354('0x6c')],_['omit'](_0x1353df[_0x7354('0x56')],['ids','id'])||{});}})[_0x7354('0x20')](respondWithResult(_0x4eaba5,null))[_0x7354('0x29')](handleError(_0x4eaba5,null));};exports['getInteractions']=function(_0x2d4cd3,_0x4895af,_0xc2f8f1){var _0x5aac9c={'raw':![],'where':{}};var _0x34afe3={};var _0x29f097={'count':0x0,'rows':[]};return db[_0x7354('0x3d')][_0x7354('0x63')]({'where':{'id':_0x2d4cd3[_0x7354('0x5f')]['id']}})[_0x7354('0x20')](handleEntityNotFound(_0x4895af,null))['then'](function(_0xede0c){if(_0xede0c){_0x34afe3[_0x7354('0x45')]=_[_0x7354('0x42')](db[_0x7354('0x6b')][_0x7354('0x3e')]);_0x34afe3[_0x7354('0x41')]=_[_0x7354('0x42')](_0x2d4cd3[_0x7354('0x41')]);_0x34afe3[_0x7354('0x43')]=_[_0x7354('0x44')](_0x34afe3['model'],_0x34afe3['query']);_0x5aac9c[_0x7354('0x46')]=_[_0x7354('0x44')](_0x34afe3[_0x7354('0x45')],qs[_0x7354('0x47')](_0x2d4cd3[_0x7354('0x41')]['fields']));_0x5aac9c[_0x7354('0x46')]=_0x5aac9c[_0x7354('0x46')][_0x7354('0x53')]?_0x5aac9c['attributes']:_0x34afe3[_0x7354('0x45')];if(!_0x2d4cd3[_0x7354('0x41')]['hasOwnProperty'](_0x7354('0x64'))){_0x5aac9c[_0x7354('0x2e')]=qs[_0x7354('0x2e')](_0x2d4cd3['query'][_0x7354('0x2e')]);_0x5aac9c['offset']=qs[_0x7354('0x2d')](_0x2d4cd3['query'][_0x7354('0x2d')]);}_0x5aac9c[_0x7354('0x6d')]=qs[_0x7354('0x49')](_0x2d4cd3[_0x7354('0x41')][_0x7354('0x49')]);_0x5aac9c['where']=qs['filters'](_['pick'](_0x2d4cd3[_0x7354('0x41')],_0x34afe3['filters']));_0x5aac9c[_0x7354('0x4a')]['FaxAccountId']=_0xede0c['id'];if(_0x2d4cd3[_0x7354('0x41')][_0x7354('0x4c')]){_0x5aac9c['where']=_[_0x7354('0x4d')](_0x5aac9c[_0x7354('0x4a')],{'$or':_['map'](_0x5aac9c[_0x7354('0x46')],function(_0x4f33d1){var _0x253589={};_0x253589[_0x4f33d1]={'$like':'%'+_0x2d4cd3['query'][_0x7354('0x4c')]+'%'};return _0x253589;})});}_0x5aac9c=_[_0x7354('0x4d')]({},_0x5aac9c,_0x2d4cd3[_0x7354('0x4e')]);return db['FaxInteraction']['count']({'where':_0x5aac9c[_0x7354('0x4a')]})[_0x7354('0x20')](function(_0x55a654){_0x29f097['count']=_0x55a654;if(_0x2d4cd3[_0x7354('0x41')][_0x7354('0x4f')]){_0x5aac9c[_0x7354('0x50')]=[{'model':db[_0x7354('0x6e')],'as':_0x7354('0x6f'),'required':![]},{'model':db[_0x7354('0x70')],'as':_0x7354('0x71'),'attributes':['name',_0x7354('0x72'),_0x7354('0x73')],'required':![]},{'model':db['Tag'],'as':_0x7354('0x74'),'attributes':['id',_0x7354('0x38'),_0x7354('0x75')],'where':_0x2d4cd3[_0x7354('0x41')][_0x7354('0x76')]?{'id':_0x2d4cd3['query']['tag']}:undefined,'required':_0x2d4cd3[_0x7354('0x41')][_0x7354('0x76')]?!![]:![]}];}return db[_0x7354('0x6b')]['findAll'](_0x5aac9c);})['then'](function(_0x444735){_0x29f097[_0x7354('0x52')]=_0x444735;return _0x29f097;});}})[_0x7354('0x20')](respondWithFilteredResult(_0x4895af,_0x5aac9c))[_0x7354('0x29')](handleError(_0x4895af,null));};exports[_0x7354('0x77')]=function(_0x5367f9,_0x5c9a5a,_0x23e439){return db['FaxAccount'][_0x7354('0x63')]({'where':{'id':_0x5367f9[_0x7354('0x5f')]['id']}})[_0x7354('0x20')](handleEntityNotFound(_0x5c9a5a,null))[_0x7354('0x20')](function(_0x554159){if(_0x554159){return db[_0x7354('0x78')][_0x7354('0x79')](function(_0x1cd1ef){return db[_0x7354('0x7a')][_0x7354('0x35')]({'where':{'FaxAccountId':_0x5367f9[_0x7354('0x5f')]['id']},'transaction':_0x1cd1ef})[_0x7354('0x20')](function(_0x707d8a){var _0xea8dc6=_[_0x7354('0x3c')](_0x5367f9[_0x7354('0x56')],function(_0x14c2a5){_0x14c2a5[_0x7354('0x65')]=_0x5367f9[_0x7354('0x5f')]['id'];return _0x14c2a5;});return db[_0x7354('0x7a')][_0x7354('0x7b')](_0xea8dc6,{'transaction':_0x1cd1ef});});})['then'](function(){return db[_0x7354('0x7a')][_0x7354('0x7c')]({'where':{'FaxAccountId':_0x5367f9[_0x7354('0x5f')]['id']},'order':_0x7354('0x7d')});});}})[_0x7354('0x20')](respondWithResult(_0x5c9a5a,null))[_0x7354('0x29')](handleError(_0x5c9a5a,null));};exports[_0x7354('0x7e')]=function(_0x5001dd,_0x138a6e,_0x1023de){var _0x595dfa={};var _0x59f0a5={};var _0x35305e;var _0x396fc8;return db[_0x7354('0x3d')][_0x7354('0x63')]({'where':{'id':_0x5001dd['params']['id']}})[_0x7354('0x20')](handleEntityNotFound(_0x138a6e,null))[_0x7354('0x20')](function(_0x5f3d5c){if(_0x5f3d5c){_0x35305e=_0x5f3d5c;_0x59f0a5[_0x7354('0x45')]=_[_0x7354('0x42')](db[_0x7354('0x7a')][_0x7354('0x3e')]);_0x59f0a5['query']=_[_0x7354('0x42')](_0x5001dd['query']);_0x59f0a5[_0x7354('0x43')]=_[_0x7354('0x44')](_0x59f0a5[_0x7354('0x45')],_0x59f0a5[_0x7354('0x41')]);_0x595dfa[_0x7354('0x46')]=_[_0x7354('0x44')](_0x59f0a5[_0x7354('0x45')],qs['fields'](_0x5001dd[_0x7354('0x41')][_0x7354('0x47')]));_0x595dfa[_0x7354('0x46')]=_0x595dfa[_0x7354('0x46')]['length']?_0x595dfa[_0x7354('0x46')]:_0x59f0a5['model'];_0x595dfa['order']=qs[_0x7354('0x49')](_0x5001dd[_0x7354('0x41')][_0x7354('0x49')]);_0x595dfa[_0x7354('0x4a')]=qs[_0x7354('0x43')](_[_0x7354('0x4b')](_0x5001dd['query'],_0x59f0a5[_0x7354('0x43')]));if(_0x5001dd[_0x7354('0x41')][_0x7354('0x4c')]){_0x595dfa[_0x7354('0x4a')]=_[_0x7354('0x4d')](_0x595dfa[_0x7354('0x4a')],{'$or':_[_0x7354('0x3c')](_0x595dfa[_0x7354('0x46')],function(_0x507b82){var _0xbfc4ba={};_0xbfc4ba[_0x507b82]={'$like':'%'+_0x5001dd['query'][_0x7354('0x4c')]+'%'};return _0xbfc4ba;})});}_0x595dfa=_['merge']({},_0x595dfa,_0x5001dd[_0x7354('0x4e')]);return _0x35305e[_0x7354('0x7e')](_0x595dfa);}})[_0x7354('0x20')](function(_0x22d033){if(_0x22d033){_0x396fc8=_0x22d033[_0x7354('0x53')];if(!_0x5001dd[_0x7354('0x41')][_0x7354('0x48')](_0x7354('0x64'))){_0x595dfa[_0x7354('0x2e')]=qs[_0x7354('0x2e')](_0x5001dd[_0x7354('0x41')][_0x7354('0x2e')]);_0x595dfa[_0x7354('0x2d')]=qs['offset'](_0x5001dd[_0x7354('0x41')]['offset']);}return _0x35305e['getApplications'](_0x595dfa);}})[_0x7354('0x20')](function(_0x5ca366){if(_0x5ca366){return _0x5ca366?{'count':_0x396fc8,'rows':_0x5ca366}:null;}})[_0x7354('0x20')](respondWithResult(_0x138a6e,null))['catch'](handleError(_0x138a6e,null));};function Extension(_0x316597,_0x5b2216,_0x395815,_0x97b38b){this[_0x7354('0x7f')]=_0x7354('0x80');this['exten']=_0x316597[_0x7354('0x81')];this[_0x7354('0x82')]=_0x97b38b;this[_0x7354('0x40')]='system';this[_0x7354('0x83')]=_0x7354('0x84');this[_0x7354('0x65')]=_0x316597['id'];this[_0x7354('0x7d')]=_0x5b2216;this[_0x7354('0x85')]=_0x395815;}function createExtensionsReciveFax(_0xe49b4d){var _0x26418c=0x1;var _0x3bf481=[];_0x3bf481['push'](new Extension(_0xe49b4d,_0x26418c,'',_0x7354('0x86')));_0x26418c+=0x1;_0x3bf481[_0x7354('0x87')](new Extension(_0xe49b4d,_0x26418c,_0x7354('0x88'),_0x7354('0x89')));_0x26418c+=0x1;for(var _0x34720c in _0xe49b4d){if(_0xe49b4d[_0x7354('0x48')](_0x34720c)&&(_0x34720c===_0x7354('0x8a')||_0x34720c===_0x7354('0x81')||_0x34720c===_0x7354('0x8b')||_0x34720c===_0x7354('0x8c')||_0x34720c===_0x7354('0x8d')||_0x34720c===_0x7354('0x8e')||_0x34720c==='minrate'||_0x34720c===_0x7354('0x8f')||_0x34720c===_0x7354('0x90'))){_0x3bf481[_0x7354('0x87')](new Extension(_0xe49b4d,_0x26418c,_0x7354('0x91')+_0x34720c+')='+_0xe49b4d[_0x34720c],_0x7354('0x89')));_0x26418c+=0x1;}}_0x3bf481[_0x7354('0x87')](new Extension(_0xe49b4d,_0x26418c,'6',_0x7354('0x92')));_0x26418c+=0x1;_0x3bf481[_0x7354('0x87')](new Extension(_0xe49b4d,_0x26418c,_0x7354('0x93'),_0x7354('0x94')));_0x26418c=0x0;return _0x3bf481;}exports[_0x7354('0x95')]=function(_0x489693,_0x29b53f,_0x83a8e6){var _0x1759eb;return db[_0x7354('0x78')]['transaction'](function(_0x37904e){return db[_0x7354('0x3d')][_0x7354('0x55')](_0x489693[_0x7354('0x56')],{'transaction':_0x37904e})[_0x7354('0x20')](function(_0x375a8f){_0x1759eb=_0x375a8f[_0x7354('0x58')]({'plain':!![]});return db[_0x7354('0x96')][_0x7354('0x7b')](createExtensionsReciveFax(_0x1759eb),{'transaction':_0x37904e});});})[_0x7354('0x20')](function(){return _0x1759eb;})[_0x7354('0x20')](respondWithResult(_0x29b53f,null))[_0x7354('0x29')](handleError(_0x29b53f,null));};exports[_0x7354('0x97')]=function(_0x325ae7,_0x8e6a1a,_0x308762){var _0x4b6674;return db['sequelize'][_0x7354('0x79')](function(_0x132597){return db['FaxAccount'][_0x7354('0x34')](_0x325ae7['body'],{'where':{'id':_0x325ae7[_0x7354('0x56')]['id']},'transaction':_0x132597})[_0x7354('0x20')](function(_0x5020ee){return db[_0x7354('0x96')][_0x7354('0x35')]({'where':{'FaxAccountId':_0x325ae7[_0x7354('0x56')]['id']},'transaction':_0x132597})[_0x7354('0x20')](function(_0xebc5b2){return db['VoiceExtension'][_0x7354('0x7b')](createExtensionsReciveFax(_[_0x7354('0x98')](_0x325ae7[_0x7354('0x56')],['tech',_0x7354('0x99'),_0x7354('0x9a'),_0x7354('0x9b'),'TrunkId','ListId'])),{'transaction':_0x132597});});});})[_0x7354('0x20')](function(){return db[_0x7354('0x3d')]['findById'](_0x325ae7[_0x7354('0x56')]['id']);})['then'](respondWithResult(_0x8e6a1a,null))[_0x7354('0x29')](handleError(_0x8e6a1a,null));};exports[_0x7354('0x9c')]=function(_0x29bc25,_0x26f2c2,_0x2d4be7){var _0x1db69c={'raw':!![],'where':{}};var _0x1c14ee={};var _0x2ad0e7={'count':0x0,'rows':[]};return db[_0x7354('0x3d')][_0x7354('0x63')]({'where':{'id':_0x29bc25[_0x7354('0x5f')]['id']}})['then'](handleEntityNotFound(_0x26f2c2,null))[_0x7354('0x20')](function(_0x543891){if(_0x543891){_0x1c14ee[_0x7354('0x45')]=_[_0x7354('0x42')](db[_0x7354('0x9d')][_0x7354('0x3e')]);_0x1c14ee[_0x7354('0x41')]=_[_0x7354('0x42')](_0x29bc25['query']);_0x1c14ee[_0x7354('0x43')]=_['intersection'](_0x1c14ee[_0x7354('0x45')],_0x1c14ee['query']);_0x1db69c[_0x7354('0x46')]=_[_0x7354('0x44')](_0x1c14ee[_0x7354('0x45')],qs[_0x7354('0x47')](_0x29bc25[_0x7354('0x41')][_0x7354('0x47')]));_0x1db69c[_0x7354('0x46')]=_0x1db69c['attributes'][_0x7354('0x53')]?_0x1db69c[_0x7354('0x46')]:_0x1c14ee[_0x7354('0x45')];if(!_0x29bc25[_0x7354('0x41')][_0x7354('0x48')](_0x7354('0x64'))){_0x1db69c[_0x7354('0x2e')]=qs[_0x7354('0x2e')](_0x29bc25[_0x7354('0x41')][_0x7354('0x2e')]);_0x1db69c[_0x7354('0x2d')]=qs[_0x7354('0x2d')](_0x29bc25[_0x7354('0x41')][_0x7354('0x2d')]);}_0x1db69c[_0x7354('0x6d')]=qs['sort'](_0x29bc25[_0x7354('0x41')][_0x7354('0x49')]);_0x1db69c[_0x7354('0x4a')]=qs[_0x7354('0x43')](_[_0x7354('0x4b')](_0x29bc25[_0x7354('0x41')],_0x1c14ee['filters']));_0x1db69c[_0x7354('0x4a')][_0x7354('0x65')]=_0x543891['id'];if(_0x29bc25[_0x7354('0x41')][_0x7354('0x4c')]){_0x1db69c[_0x7354('0x4a')]=_['merge'](_0x1db69c[_0x7354('0x4a')],{'$or':_[_0x7354('0x3c')](_0x1db69c[_0x7354('0x46')],function(_0xc50b6b){var _0x1f72d4={};_0x1f72d4[_0xc50b6b]={'$like':'%'+_0x29bc25[_0x7354('0x41')]['filter']+'%'};return _0x1f72d4;})});}if(_0x29bc25[_0x7354('0x41')][_0x7354('0x9e')]){var _0x36e44b=_0x29bc25[_0x7354('0x41')][_0x7354('0x9e')]['split'](',');var _0x591985={};_0x591985[_0x36e44b[0x0]]={'$gte':moment(_0x36e44b[0x1])[_0x7354('0x9f')](_0x7354('0xa0'))};_0x1db69c[_0x7354('0x4a')]=_['merge'](_0x1db69c[_0x7354('0x4a')],_0x591985);}_0x1db69c=_[_0x7354('0x4d')]({},_0x1db69c,_0x29bc25[_0x7354('0x4e')]);return db[_0x7354('0x9d')][_0x7354('0x30')]({'where':_0x1db69c[_0x7354('0x4a')]})['then'](function(_0x2aa9b8){_0x2ad0e7[_0x7354('0x30')]=_0x2aa9b8;if(_0x29bc25[_0x7354('0x41')][_0x7354('0x4f')]){_0x1db69c[_0x7354('0x50')]=[{'all':!![]}];}return db[_0x7354('0x9d')]['findAll'](_0x1db69c);})['then'](function(_0x54c823){_0x2ad0e7['rows']=_0x54c823;return _0x2ad0e7;});}})[_0x7354('0x20')](respondWithFilteredResult(_0x26f2c2,_0x1db69c))['catch'](handleError(_0x26f2c2,null));};exports[_0x7354('0xa1')]=function(_0x422a65,_0x1c76d7,_0x4d64ae){var _0x556b9f,_0x28e0fb={},_0x666791;if(_0x422a65['body']['to']){_0x666791=_0x422a65[_0x7354('0x56')]['to'][0x0];}return db['FaxAccount']['find']({'where':{'id':_0x422a65[_0x7354('0x5f')]['id']},'include':[{'model':db[_0x7354('0xa2')],'as':_0x7354('0xa3'),'include':[{'model':db[_0x7354('0x6e')],'as':_0x7354('0xa4'),'where':{'fax':_0x666791},'limit':0x1,'order':[[_0x7354('0x9b'),_0x7354('0xa5')]]}]}]})['then'](handleEntityNotFound(_0x1c76d7,null))['then'](function(_0x1cc0d6){_0x556b9f=_0x1cc0d6;if(_0x422a65['body'][_0x7354('0xa6')]&&_0x422a65[_0x7354('0x56')]['attachments']['length']){for(var _0x50c0b7=0x0;_0x50c0b7<_0x422a65['body'][_0x7354('0xa6')][_0x7354('0x53')];_0x50c0b7+=0x1){_0x422a65['body'][_0x7354('0xa6')][_0x50c0b7]={'filename':_0x422a65['body'][_0x7354('0xa6')][_0x50c0b7][_0x7354('0x38')],'id':_0x422a65['body'][_0x7354('0xa6')][_0x50c0b7]['id'],'path':path[_0x7354('0xa7')](config['root'],'server/files/attachments',_0x422a65[_0x7354('0x56')][_0x7354('0xa6')][_0x50c0b7][_0x7354('0xa8')])};}}return respondWithRpcPromise(_0x7354('0xa9'),_0x7354('0xa9'),{'FaxAccountId':_[_0x7354('0xaa')](_0x422a65[_0x7354('0x5f')]['id'])?undefined:_0x422a65['params']['id'],'path':_[_0x7354('0xaa')](_0x422a65[_0x7354('0x56')][_0x7354('0xa6')][0x0]['path'])?undefined:_0x422a65[_0x7354('0x56')][_0x7354('0xa6')][0x0][_0x7354('0x6')],'fax':_[_0x7354('0xaa')](_0x422a65[_0x7354('0x56')]['to'][0x0])?undefined:_0x422a65[_0x7354('0x56')]['to'][0x0]},client9002);})[_0x7354('0x20')](function(){if(_0x556b9f){if(_[_0x7354('0xaa')](_0x422a65['body'][_0x7354('0xab')])){_0x422a65['body'][_0x7354('0xab')]=util[_0x7354('0x9f')](_0x7354('0xac'),_0x556b9f[_0x7354('0x38')],_0x556b9f[_0x7354('0xad')]);}if(_0x556b9f[_0x7354('0xa3')]){if(_0x556b9f[_0x7354('0xa3')][_0x7354('0xa4')]['length']){return _0x556b9f[_0x7354('0xa3')][_0x7354('0xa4')][0x0];}else{return db[_0x7354('0x6e')][_0x7354('0x55')](_[_0x7354('0x19')](_0x422a65[_0x7354('0x56')],{'firstName':_0x422a65[_0x7354('0x56')]['to'][0x0],'phone':_0x422a65[_0x7354('0x56')]['to'][0x0],'fax':_0x422a65[_0x7354('0x56')]['to'][0x0],'ListId':_0x556b9f[_0x7354('0xae')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x7354('0x20')](function(_0x4c62b6){if(_0x4c62b6){return db['FaxInteraction'][_0x7354('0x54')]({'where':{'ContactId':_0x4c62b6['id'],'closed':![],'FaxAccountId':_0x556b9f['id']}})['then'](function(_0x3d6a85){if(_0x3d6a85){return[_0x3d6a85,![]];}return db[_0x7354('0x6b')][_0x7354('0x55')]({'UserId':_0x422a65[_0x7354('0x57')]['id'],'ContactId':_0x4c62b6['id'],'FaxAccountId':_0x556b9f['id'],'fax':_0x422a65[_0x7354('0x56')]['to'][0x0],'firstMsgDirection':'out','Messages':[_['merge'](_0x422a65['body'],{'read':![],'body':_0x422a65[_0x7354('0x56')][_0x7354('0xa6')][0x0][_0x7354('0xaf')],'FaxAccountId':_0x556b9f['id'],'UserId':_0x422a65[_0x7354('0x57')]['id'],'ContactId':_0x4c62b6['id'],'AttachmentId':_0x422a65[_0x7354('0x56')][_0x7354('0xa6')][0x0]['id']})]},{'include':[{'model':db[_0x7354('0x9d')],'as':_0x7354('0xb0')}]})[_0x7354('0x20')](function(_0x14d89b){return[_0x14d89b,!![]];});});}else{throw new Error(_0x7354('0xb1'));}})[_0x7354('0xb2')](function(_0x1a0e11,_0x24d35f){if(_0x24d35f){return _0x1a0e11;}return db[_0x7354('0x9d')][_0x7354('0x55')]({'direction':_0x7354('0xb3'),'read':![],'body':_0x422a65[_0x7354('0x56')][_0x7354('0xa6')][0x0]['filename'],'FaxAccountId':_0x556b9f['id'],'FaxInteractionId':_0x1a0e11['id'],'UserId':_0x422a65[_0x7354('0x57')]['id'],'ContactId':_0x1a0e11['ContactId'],'AttachmentId':_0x422a65[_0x7354('0x56')][_0x7354('0xa6')][0x0]['id']})[_0x7354('0x20')](function(_0x16c0bd){_0x1a0e11['dataValues'][_0x7354('0xb0')]=[];_0x1a0e11[_0x7354('0xb4')]['Messages'][_0x7354('0x87')](_0x16c0bd['dataValues']);return _0x1a0e11;});})['then'](function(_0x660148){respondWithRpcPromise('SendFax',_0x7354('0xb5'),{'FaxAccountId':_[_0x7354('0xaa')](_0x422a65[_0x7354('0x5f')]['id'])?undefined:_0x422a65['params']['id'],'path':_[_0x7354('0xaa')](_0x422a65['body'][_0x7354('0xa6')][0x0][_0x7354('0x6')])?undefined:_0x422a65[_0x7354('0x56')][_0x7354('0xa6')][0x0]['path'],'fax':_[_0x7354('0xaa')](_0x422a65[_0x7354('0x56')]['to'][0x0])?undefined:_0x422a65[_0x7354('0x56')]['to'][0x0],'AttachmentId':_0x422a65[_0x7354('0x56')][_0x7354('0xa6')][0x0]['id']},client9002)['then'](function(_0x19f644){logger[_0x7354('0x21')]('SendFaxRpc,\x20%s',_0x19f644);})[_0x7354('0x29')](function(_0x470a95){logger['info'](_0x7354('0xb6'),_0x470a95);});return _0x660148;})[_0x7354('0x20')](respondWithResult(_0x1c76d7,null))[_0x7354('0x29')](handleError(_0x1c76d7,null));};exports[_0x7354('0xb7')]=function(_0x36b3ce,_0x370540,_0x417708){return db[_0x7354('0x3d')][_0x7354('0x54')]({'where':{'id':_0x36b3ce['params']['id']}})[_0x7354('0x20')](handleEntityNotFound(_0x370540,null))['then'](function(_0x192420){if(_0x192420){return _0x192420[_0x7354('0xb7')](_0x36b3ce[_0x7354('0x56')][_0x7354('0x6c')],_[_0x7354('0x98')](_0x36b3ce[_0x7354('0x56')],['ids','id'])||{})[_0x7354('0xb2')](function(_0x2b8631){for(var _0xd20290=0x0;_0xd20290<_0x36b3ce[_0x7354('0x56')][_0x7354('0x6c')][_0x7354('0x53')];_0xd20290+=0x1){socket['emit'](_0x7354('0xb8'),{'UserId':Number(_0x36b3ce['body'][_0x7354('0x6c')][_0xd20290]),'FaxAccountId':Number(_0x36b3ce[_0x7354('0x5f')]['id'])});}return _0x2b8631;});}})[_0x7354('0x20')](respondWithResult(_0x370540,null))[_0x7354('0x29')](handleError(_0x370540,null));};exports[_0x7354('0xb9')]=function(_0x42a5a5,_0x4eeeed,_0x206a0b){return db['FaxAccount'][_0x7354('0x54')]({'where':{'id':_0x42a5a5[_0x7354('0x5f')]['id']}})[_0x7354('0x20')](handleEntityNotFound(_0x4eeeed,null))['then'](function(_0x2d6460){if(_0x2d6460){return _0x2d6460['removeAgents'](_0x42a5a5[_0x7354('0x41')][_0x7354('0x6c')])[_0x7354('0x20')](function(){if(_[_0x7354('0xba')](_0x42a5a5[_0x7354('0x41')][_0x7354('0x6c')])){for(var _0x8c1c90=0x0;_0x8c1c90<_0x42a5a5['query'][_0x7354('0x6c')]['length'];_0x8c1c90+=0x1){socket[_0x7354('0xbb')]('userFaxAccount:remove',{'UserId':Number(_0x42a5a5[_0x7354('0x41')][_0x7354('0x6c')][_0x8c1c90]),'FaxAccountId':Number(_0x42a5a5[_0x7354('0x5f')]['id'])});}}else{socket[_0x7354('0xbb')](_0x7354('0xbc'),{'UserId':Number(_0x42a5a5[_0x7354('0x41')][_0x7354('0x6c')]),'FaxAccountId':Number(_0x42a5a5[_0x7354('0x5f')]['id'])});}});}})[_0x7354('0x20')](respondWithStatusCode(_0x4eeeed,null))['catch'](handleError(_0x4eeeed,null));};exports[_0x7354('0xbd')]=function(_0x3bd2d4,_0x412048,_0x633e24){var _0x1713c6={};var _0x8516df={};var _0x133371;var _0x7edffc;return db[_0x7354('0x3d')][_0x7354('0x63')]({'where':{'id':_0x3bd2d4[_0x7354('0x5f')]['id']}})[_0x7354('0x20')](handleEntityNotFound(_0x412048,null))[_0x7354('0x20')](function(_0x2a561f){if(_0x2a561f){_0x133371=_0x2a561f;_0x8516df[_0x7354('0x45')]=_['keys'](db[_0x7354('0x70')][_0x7354('0x3e')]);_0x8516df[_0x7354('0x41')]=_[_0x7354('0x42')](_0x3bd2d4[_0x7354('0x41')]);_0x8516df['filters']=_[_0x7354('0x44')](_0x8516df['model'],_0x8516df[_0x7354('0x41')]);_0x1713c6[_0x7354('0x46')]=_[_0x7354('0x44')](_0x8516df[_0x7354('0x45')],qs['fields'](_0x3bd2d4[_0x7354('0x41')][_0x7354('0x47')]));_0x1713c6[_0x7354('0x46')]=_0x1713c6[_0x7354('0x46')][_0x7354('0x53')]?_0x1713c6[_0x7354('0x46')]:_0x8516df['model'];_0x1713c6['order']=qs['sort'](_0x3bd2d4[_0x7354('0x41')][_0x7354('0x49')]);_0x1713c6[_0x7354('0x4a')]=qs[_0x7354('0x43')](_[_0x7354('0x4b')](_0x3bd2d4['query'],_0x8516df[_0x7354('0x43')]));if(_0x3bd2d4['query'][_0x7354('0x4c')]){_0x1713c6[_0x7354('0x4a')]=_[_0x7354('0x4d')](_0x1713c6['where'],{'$or':_[_0x7354('0x3c')](_0x1713c6['attributes'],function(_0x160692){var _0x32a150={};_0x32a150[_0x160692]={'$like':'%'+_0x3bd2d4['query'][_0x7354('0x4c')]+'%'};return _0x32a150;})});}_0x1713c6=_[_0x7354('0x4d')]({},_0x1713c6,_0x3bd2d4[_0x7354('0x4e')]);return _0x133371[_0x7354('0xbd')](_0x1713c6);}})['then'](function(_0x3fc18a){if(_0x3fc18a){_0x7edffc=_0x3fc18a[_0x7354('0x53')];if(!_0x3bd2d4[_0x7354('0x41')][_0x7354('0x48')]('nolimit')){_0x1713c6[_0x7354('0x2e')]=qs[_0x7354('0x2e')](_0x3bd2d4['query'][_0x7354('0x2e')]);_0x1713c6['offset']=qs[_0x7354('0x2d')](_0x3bd2d4[_0x7354('0x41')][_0x7354('0x2d')]);}return _0x133371['getAgents'](_0x1713c6);}})[_0x7354('0x20')](function(_0x44f294){if(_0x44f294){return _0x44f294?{'count':_0x7edffc,'rows':_0x44f294}:null;}})['then'](respondWithResult(_0x412048,null))['catch'](handleError(_0x412048,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 8f15a87..b6753a4 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 _0x333a=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x333a,0xe0));var _0xa333=function(_0x1a80e8,_0x3bb766){_0x1a80e8=_0x1a80e8-0x0;var _0x563d21=_0x333a[_0x1a80e8];return _0x563d21;};'use strict';var EventEmitter=require(_0xa333('0x0'));var FaxAccount=require(_0xa333('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xa333('0x2')](0x0);var events={'afterCreate':_0xa333('0x3'),'afterUpdate':_0xa333('0x4'),'afterDestroy':_0xa333('0x5')};function emitEvent(_0x59ca82){return function(_0x3d7ad1,_0x1d0c16,_0x476ac4){FaxAccountEvents[_0xa333('0x6')](_0x59ca82+':'+_0x3d7ad1['id'],_0x3d7ad1);FaxAccountEvents[_0xa333('0x6')](_0x59ca82,_0x3d7ad1);_0x476ac4(null);};}for(var e in events){if(events[_0xa333('0x7')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0xa333('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0x656c=['save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners'];(function(_0x41c4ab,_0x380526){var _0x1f47cf=function(_0x596e46){while(--_0x596e46){_0x41c4ab['push'](_0x41c4ab['shift']());}};_0x1f47cf(++_0x380526);}(_0x656c,0x74));var _0xc656=function(_0x4a13b6,_0x2587d1){_0x4a13b6=_0x4a13b6-0x0;var _0x4b4183=_0x656c[_0x4a13b6];return _0x4b4183;};'use strict';var EventEmitter=require(_0xc656('0x0'));var FaxAccount=require(_0xc656('0x1'))['db'][_0xc656('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xc656('0x3')](0x0);var events={'afterCreate':_0xc656('0x4'),'afterUpdate':_0xc656('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4803f9){return function(_0x573dae,_0xdc2333,_0x95fb0d){FaxAccountEvents[_0xc656('0x6')](_0x4803f9+':'+_0x573dae['id'],_0x573dae);FaxAccountEvents[_0xc656('0x6')](_0x4803f9,_0x573dae);_0x95fb0d(null);};}for(var e in events){if(events[_0xc656('0x7')](e)){var event=events[e];FaxAccount[_0xc656('0x8')](e,emitEvent(event));}}module[_0xc656('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 0e924b5..6a2758a 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 _0x55c0=['../../config/environment','exports','define','FaxAccount','fax_accounts','lodash','../../config/logger','moment','bluebird','path'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0x55c0,0x131));var _0x055c=function(_0x2a07c9,_0x185c10){_0x2a07c9=_0x2a07c9-0x0;var _0x4e5723=_0x55c0[_0x2a07c9];return _0x4e5723;};'use strict';var _=require(_0x055c('0x0'));var util=require('util');var logger=require(_0x055c('0x1'))('api');var moment=require(_0x055c('0x2'));var BPromise=require(_0x055c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x055c('0x4'));var rimraf=require('rimraf');var config=require(_0x055c('0x5'));var attributes=require('./faxAccount.attributes');module[_0x055c('0x6')]=function(_0xc09765,_0x2c47b4){return _0xc09765[_0x055c('0x7')](_0x055c('0x8'),attributes,{'tableName':_0x055c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2268=['moment','bluebird','request-promise','path','../../config/environment','./faxAccount.attributes','exports','define','fax_accounts','lodash','util','api'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0x2268,0xe1));var _0x8226=function(_0x152718,_0x7f0d81){_0x152718=_0x152718-0x0;var _0x290406=_0x2268[_0x152718];return _0x290406;};'use strict';var _=require(_0x8226('0x0'));var util=require(_0x8226('0x1'));var logger=require('../../config/logger')(_0x8226('0x2'));var moment=require(_0x8226('0x3'));var BPromise=require(_0x8226('0x4'));var rp=require(_0x8226('0x5'));var fs=require('fs');var path=require(_0x8226('0x6'));var rimraf=require('rimraf');var config=require(_0x8226('0x7'));var attributes=require(_0x8226('0x8'));module[_0x8226('0x9')]=function(_0x4b4117,_0x2fe76a){return _0x4b4117[_0x8226('0xa')]('FaxAccount',attributes,{'tableName':_0x8226('0xb'),'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 b878dd7..ae51c76 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 _0x70c9=['ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','from','FaxAccount','find','account','CmList','Contacts','DESC','FaxApplication','Applications','List','get','applications','list','asc','length','create','fax','FaxInteraction','Contact\x20not\x20found','spread','push','close','unmanaged','*,*,*,*','created','FaxMessage','ContactId','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','defaults','redis','localhost','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxAccount','findAll','options','where','limit','include','model','attributes','NotifyFaxAccount','body','CmContact','describe','Sequelize'];(function(_0x51639a,_0x35f006){var _0x3abae4=function(_0x89b35e){while(--_0x89b35e){_0x51639a['push'](_0x51639a['shift']());}};_0x3abae4(++_0x35f006);}(_0x70c9,0x190));var _0x970c=function(_0x2e1593,_0x59e9b7){_0x2e1593=_0x2e1593-0x0;var _0x71d483=_0x70c9[_0x2e1593];return _0x71d483;};'use strict';var _=require(_0x970c('0x0'));var util=require(_0x970c('0x1'));var moment=require(_0x970c('0x2'));var BPromise=require(_0x970c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x970c('0x4'));var db=require(_0x970c('0x5'))['db'];var utils=require(_0x970c('0x6'));var logger=require(_0x970c('0x7'))(_0x970c('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x970c('0x9')]({'port':0x232c});config['redis']=_[_0x970c('0xa')](config[_0x970c('0xb')],{'host':_0x970c('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x970c('0xb')]));require(_0x970c('0xd'))[_0x970c('0xe')](socket);function respondWithRpcPromise(_0x5cacf0,_0x2738fe,_0x34cb61){return new BPromise(function(_0x243293,_0x3040aa){return client[_0x970c('0xf')](_0x5cacf0,_0x34cb61)[_0x970c('0x10')](function(_0x22dc85){logger[_0x970c('0x11')](_0x970c('0x12'),_0x2738fe,_0x970c('0x13'));logger['debug'](_0x970c('0x14'),_0x2738fe,_0x970c('0x13'),JSON[_0x970c('0x15')](_0x22dc85));if(_0x22dc85['error']){if(_0x22dc85[_0x970c('0x16')][_0x970c('0x17')]===0x1f4){logger[_0x970c('0x16')](_0x970c('0x12'),_0x2738fe,_0x22dc85['error'][_0x970c('0x18')]);return _0x3040aa(_0x22dc85[_0x970c('0x16')]['message']);}logger[_0x970c('0x16')](_0x970c('0x12'),_0x2738fe,_0x22dc85['error']['message']);return _0x243293(_0x22dc85[_0x970c('0x16')][_0x970c('0x18')]);}else{logger[_0x970c('0x11')](_0x970c('0x12'),_0x2738fe,_0x970c('0x13'));_0x243293(_0x22dc85[_0x970c('0x19')][_0x970c('0x18')]);}})[_0x970c('0x1a')](function(_0x55e8f8){logger['error'](_0x970c('0x12'),_0x2738fe,_0x55e8f8);_0x3040aa(_0x55e8f8);});});}exports[_0x970c('0x1b')]=function(_0x1ef0dc){var _0x3d7af2=this;return new Promise(function(_0x5172cd,_0x5922c6){return db['FaxAccount'][_0x970c('0x1c')]({'raw':_0x1ef0dc['options']?_0x1ef0dc[_0x970c('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x1ef0dc[_0x970c('0x1d')]?_0x1ef0dc[_0x970c('0x1d')][_0x970c('0x1e')]||null:null,'attributes':_0x1ef0dc['options']?_0x1ef0dc[_0x970c('0x1d')]['attributes']||null:null,'limit':_0x1ef0dc[_0x970c('0x1d')]?_0x1ef0dc[_0x970c('0x1d')][_0x970c('0x1f')]||null:null,'include':_0x1ef0dc['options']?_0x1ef0dc[_0x970c('0x1d')]['include']?_['map'](_0x1ef0dc['options'][_0x970c('0x20')],function(_0x1c58bb){return{'model':db[_0x1c58bb[_0x970c('0x21')]],'as':_0x1c58bb['as'],'attributes':_0x1c58bb['attributes'],'include':_0x1c58bb[_0x970c('0x20')]?_['map'](_0x1c58bb[_0x970c('0x20')],function(_0x3000ff){return{'model':db[_0x3000ff[_0x970c('0x21')]],'as':_0x3000ff['as'],'attributes':_0x3000ff[_0x970c('0x22')],'include':_0x3000ff[_0x970c('0x20')]?_['map'](_0x3000ff[_0x970c('0x20')],function(_0x2edad5){return{'model':db[_0x2edad5['model']],'as':_0x2edad5['as'],'attributes':_0x2edad5['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x348282){logger['info'](_0x970c('0x1b'),_0x1ef0dc);logger['debug'](_0x970c('0x1b'),_0x1ef0dc,JSON['stringify'](_0x348282));_0x5172cd(_0x348282);})['catch'](function(_0x352bec){logger[_0x970c('0x16')]('GetFaxAccount',_0x352bec[_0x970c('0x18')],_0x1ef0dc);_0x5922c6(_0x3d7af2[_0x970c('0x16')](0x1f4,_0x352bec[_0x970c('0x18')]));});});};exports[_0x970c('0x23')]=function(_0x4d12c7,_0x1e16ac,_0x409c72){var _0x2849a9=this;return new Promise(function(_0x313a79,_0x323b86){var _0x1f6975={'body':_0x4d12c7[_0x970c('0x24')],'channel':'fax'};var _0x19455e=[];var _0x164324=[];var _0x2b0017={};return db[_0x970c('0x25')][_0x970c('0x26')]()['then'](function(_0x22338c){if(!_0x22338c){throw new db[(_0x970c('0x27'))][(_0x970c('0x28'))](_0x970c('0x29'));}_0x19455e=_[_0x970c('0x2a')](_[_0x970c('0x2b')](_0x22338c),[_0x970c('0x2c'),_0x970c('0x2d')]);_0x164324=_[_0x970c('0x2a')](_[_0x970c('0x2b')](_0x22338c),[_0x970c('0x2c'),'updatedAt',_0x970c('0x2e'),_0x970c('0x2f')]);if(_0x4d12c7[_0x970c('0x24')]['id']){delete _0x4d12c7[_0x970c('0x24')]['id'];}if(_[_0x970c('0x30')](_0x4d12c7[_0x970c('0x24')]['from'])){throw new db['Sequelize'][(_0x970c('0x28'))](_0x970c('0x31'));}if(_[_0x970c('0x30')](_0x4d12c7[_0x970c('0x24')]['body'])||_0x4d12c7[_0x970c('0x24')][_0x970c('0x24')]===''){throw new db[(_0x970c('0x27'))][(_0x970c('0x28'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x970c('0x30')](_0x4d12c7['body']['mapKey'])){throw new db['Sequelize'][(_0x970c('0x28'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x164324);}if(!_[_0x970c('0x32')](_0x164324,_0x4d12c7['body']['mapKey'])){throw new db[(_0x970c('0x27'))][(_0x970c('0x28'))](_0x970c('0x33')+_0x164324);}_0x2b0017[_0x4d12c7[_0x970c('0x24')][_0x970c('0x34')]]=_0x4d12c7[_0x970c('0x24')][_0x970c('0x35')];})[_0x970c('0x10')](function(){return db[_0x970c('0x36')][_0x970c('0x37')]({'where':{'id':_0x4d12c7[_0x970c('0x38')]['id']},'include':[{'model':db[_0x970c('0x39')],'as':'List','include':[{'model':db[_0x970c('0x25')],'as':_0x970c('0x3a'),'where':_0x2b0017,'limit':0x1,'order':[['updatedAt',_0x970c('0x3b')]]}]},{'model':db[_0x970c('0x3c')],'as':_0x970c('0x3d')}]});})[_0x970c('0x10')](function(_0x4f5728){if(_0x4f5728&&_0x4f5728[_0x970c('0x3e')]){var _0x3cd199=_0x4f5728[_0x970c('0x3f')]({'plain':!![]});_0x1f6975[_0x970c('0x38')]=_0x3cd199;_0x1f6975[_0x970c('0x40')]=_0x3cd199['Applications'];_0x1f6975[_0x970c('0x41')]=_0x3cd199[_0x970c('0x3e')];_0x1f6975['applications']=_['orderBy'](_0x1f6975[_0x970c('0x40')],['priority'],[_0x970c('0x42')]);if(_0x1f6975[_0x970c('0x38')]['Applications']){delete _0x1f6975[_0x970c('0x38')][_0x970c('0x3d')];}if(_0x1f6975['account'][_0x970c('0x3e')]&&_0x1f6975[_0x970c('0x38')][_0x970c('0x3e')][_0x970c('0x3a')][_0x970c('0x43')]){return _0x1f6975[_0x970c('0x38')][_0x970c('0x3e')]['Contacts'][0x0];}var _0x54efdf=_[_0x970c('0xa')](_0x4d12c7[_0x970c('0x24')],{'firstName':_0x4d12c7['body'][_0x970c('0x35')],'ListId':_0x3cd199[_0x970c('0x2f')]});_0x54efdf[_0x4d12c7[_0x970c('0x24')][_0x970c('0x34')]]=_0x4d12c7[_0x970c('0x24')][_0x970c('0x35')];return db['CmContact'][_0x970c('0x44')](_0x54efdf,{'fields':_0x19455e,'raw':!![]});}})['then'](function(_0x24094b){_0x1f6975['contact']=_0x24094b;if(_0x24094b){var _0x55d6d6={'ContactId':_0x24094b['id'],'FaxAccountId':_0x4d12c7[_0x970c('0x38')]['id'],'fax':_0x24094b[_0x970c('0x45')]};return db[_0x970c('0x46')][_0x970c('0x37')]({'where':{'ContactId':_0x24094b['id'],'closed':![],'FaxAccountId':_0x4d12c7[_0x970c('0x38')]['id']}})[_0x970c('0x10')](function(_0x36545d){if(_0x36545d){return[_0x36545d,![]];}return db[_0x970c('0x46')][_0x970c('0x44')](_0x55d6d6)[_0x970c('0x10')](function(_0x41fd59){return[_0x41fd59,!![]];});});}else{throw new Error(_0x970c('0x47'));}})[_0x970c('0x48')](function(_0x46b236,_0x439f8e){var _0x35f66b=_0x46b236[_0x970c('0x3f')]({'plain':!![]});if(_0x439f8e){if(_0x1f6975[_0x970c('0x38')]['autoclose']){_0x1f6975[_0x970c('0x40')][_0x970c('0x49')]({'id':0x0,'priority':_0x1f6975[_0x970c('0x40')][_0x970c('0x43')]+0x1,'app':_0x970c('0x4a'),'appdata':_0x970c('0x4b'),'interval':_0x970c('0x4c')});}_0x35f66b[_0x970c('0x4d')]=!![];}else{_0x35f66b[_0x970c('0x4d')]=![];}_0x1f6975['interaction']=_0x35f66b;return db[_0x970c('0x4e')]['create']({'body':_0x4d12c7[_0x970c('0x24')]['body'],'FaxAccountId':_0x4d12c7[_0x970c('0x38')]['id'],'FaxInteractionId':_0x46b236['id'],'direction':'in','ContactId':_0x46b236[_0x970c('0x4f')],'AttachmentId':_0x4d12c7['body'][_0x970c('0x50')]});})[_0x970c('0x10')](function(_0x1ae8c4){_0x1f6975['message']=_0x1ae8c4;if(_0x1f6975['interaction']['UserId']){return db[_0x970c('0x51')][_0x970c('0x37')]({'attributes':['id','name'],'where':{'id':_0x1f6975['interaction'][_0x970c('0x52')]}})[_0x970c('0x10')](function(_0x357abe){if(_0x357abe){_0x1f6975[_0x970c('0x40')][_0x970c('0x53')]({'id':0x0,'priority':0x0,'app':_0x970c('0x54'),'appdata':_0x357abe['name']+','+(_0x1f6975[_0x970c('0x38')][_0x970c('0x55')]||0xa),'interval':_0x970c('0x4c')});}return respondWithRpcPromise(_0x970c('0x56'),'startRouting',_0x1f6975);});}return respondWithRpcPromise('Start',_0x970c('0x57'),_0x1f6975);})[_0x970c('0x10')](function(_0x3d0385){_0x313a79(_0x3d0385);})['catch'](function(_0x1c26f6){_0x323b86(_0x2849a9['error'](0x1f4,_0x1c26f6['message']));});});}; \ No newline at end of file +var _0xa655=['autoclose','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','no\x20available\x20attributes','difference','keys','updatedAt','CompanyId','ListId','ValidationError','from\x20is\x20mandatory','isNil','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','find','account','Contacts','DESC','FaxApplication','Applications','List','applications','list','orderBy','priority','contact','FaxInteraction','create','Contact\x20not\x20found','spread','get'];(function(_0x5da869,_0x2a9395){var _0x336c5c=function(_0x25c15a){while(--_0x25c15a){_0x5da869['push'](_0x5da869['shift']());}};_0x336c5c(++_0x2a9395);}(_0xa655,0x6e));var _0x5a65=function(_0x383552,_0x5db2de){_0x383552=_0x383552-0x0;var _0x338ff7=_0xa655[_0x383552];return _0x338ff7;};'use strict';var _=require('lodash');var util=require(_0x5a65('0x0'));var moment=require(_0x5a65('0x1'));var BPromise=require(_0x5a65('0x2'));var rs=require(_0x5a65('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5a65('0x4'))['db'];var utils=require(_0x5a65('0x5'));var logger=require(_0x5a65('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5a65('0x7'));var client=jayson[_0x5a65('0x8')][_0x5a65('0x9')]({'port':0x232c});config[_0x5a65('0xa')]=_[_0x5a65('0xb')](config[_0x5a65('0xa')],{'host':_0x5a65('0xc'),'port':0x18eb});var socket=require(_0x5a65('0xd'))(new Redis(config[_0x5a65('0xa')]));require(_0x5a65('0xe'))['register'](socket);function respondWithRpcPromise(_0x49ffc6,_0x159e3a,_0x4d6542){return new BPromise(function(_0x1d1e19,_0x58ebe5){return client[_0x5a65('0xf')](_0x49ffc6,_0x4d6542)['then'](function(_0xf82796){logger[_0x5a65('0x10')](_0x5a65('0x11'),_0x159e3a,_0x5a65('0x12'));logger[_0x5a65('0x13')](_0x5a65('0x14'),_0x159e3a,_0x5a65('0x12'),JSON[_0x5a65('0x15')](_0xf82796));if(_0xf82796['error']){if(_0xf82796['error'][_0x5a65('0x16')]===0x1f4){logger[_0x5a65('0x17')]('FaxAccount,\x20%s,\x20%s',_0x159e3a,_0xf82796[_0x5a65('0x17')][_0x5a65('0x18')]);return _0x58ebe5(_0xf82796[_0x5a65('0x17')][_0x5a65('0x18')]);}logger[_0x5a65('0x17')]('FaxAccount,\x20%s,\x20%s',_0x159e3a,_0xf82796['error']['message']);return _0x1d1e19(_0xf82796[_0x5a65('0x17')][_0x5a65('0x18')]);}else{logger['info'](_0x5a65('0x11'),_0x159e3a,_0x5a65('0x12'));_0x1d1e19(_0xf82796['result'][_0x5a65('0x18')]);}})[_0x5a65('0x19')](function(_0x3c184d){logger['error']('FaxAccount,\x20%s,\x20%s',_0x159e3a,_0x3c184d);_0x58ebe5(_0x3c184d);});});}exports[_0x5a65('0x1a')]=function(_0x8417aa){var _0x3097d0=this;return new Promise(function(_0x2211a2,_0x303f88){return db[_0x5a65('0x1b')][_0x5a65('0x1c')]({'raw':_0x8417aa['options']?_0x8417aa[_0x5a65('0x1d')][_0x5a65('0x1e')]===undefined?!![]:![]:!![],'where':_0x8417aa['options']?_0x8417aa[_0x5a65('0x1d')][_0x5a65('0x1f')]||null:null,'attributes':_0x8417aa[_0x5a65('0x1d')]?_0x8417aa['options'][_0x5a65('0x20')]||null:null,'limit':_0x8417aa[_0x5a65('0x1d')]?_0x8417aa[_0x5a65('0x1d')][_0x5a65('0x21')]||null:null,'include':_0x8417aa[_0x5a65('0x1d')]?_0x8417aa[_0x5a65('0x1d')][_0x5a65('0x22')]?_[_0x5a65('0x23')](_0x8417aa['options']['include'],function(_0x4e195a){return{'model':db[_0x4e195a[_0x5a65('0x24')]],'as':_0x4e195a['as'],'attributes':_0x4e195a[_0x5a65('0x20')],'include':_0x4e195a['include']?_['map'](_0x4e195a[_0x5a65('0x22')],function(_0x369683){return{'model':db[_0x369683[_0x5a65('0x24')]],'as':_0x369683['as'],'attributes':_0x369683[_0x5a65('0x20')],'include':_0x369683[_0x5a65('0x22')]?_['map'](_0x369683[_0x5a65('0x22')],function(_0x198f31){return{'model':db[_0x198f31['model']],'as':_0x198f31['as'],'attributes':_0x198f31[_0x5a65('0x20')]};}):[]};}):[]};}):[]:[]})[_0x5a65('0x25')](function(_0x149286){logger[_0x5a65('0x10')](_0x5a65('0x1a'),_0x8417aa);logger[_0x5a65('0x13')](_0x5a65('0x1a'),_0x8417aa,JSON[_0x5a65('0x15')](_0x149286));_0x2211a2(_0x149286);})['catch'](function(_0x5ae1b0){logger[_0x5a65('0x17')](_0x5a65('0x1a'),_0x5ae1b0[_0x5a65('0x18')],_0x8417aa);_0x303f88(_0x3097d0[_0x5a65('0x17')](0x1f4,_0x5ae1b0[_0x5a65('0x18')]));});});};exports[_0x5a65('0x26')]=function(_0x3d2576,_0x144a95,_0x55dc13){var _0x1a4434=this;return new Promise(function(_0x22ede8,_0x45be63){var _0x73e45b={'body':_0x3d2576[_0x5a65('0x27')],'channel':_0x5a65('0x28')};var _0xc8256a=[];var _0x3da7ed=[];var _0xefaba3={};return db[_0x5a65('0x29')][_0x5a65('0x2a')]()[_0x5a65('0x25')](function(_0x19c65d){if(!_0x19c65d){throw new db[(_0x5a65('0x2b'))]['ValidationError'](_0x5a65('0x2c'));}_0xc8256a=_[_0x5a65('0x2d')](_[_0x5a65('0x2e')](_0x19c65d),['createdAt',_0x5a65('0x2f')]);_0x3da7ed=_[_0x5a65('0x2d')](_[_0x5a65('0x2e')](_0x19c65d),['createdAt',_0x5a65('0x2f'),_0x5a65('0x30'),_0x5a65('0x31')]);if(_0x3d2576['body']['id']){delete _0x3d2576[_0x5a65('0x27')]['id'];}if(_['isNil'](_0x3d2576[_0x5a65('0x27')]['from'])){throw new db[(_0x5a65('0x2b'))][(_0x5a65('0x32'))](_0x5a65('0x33'));}if(_[_0x5a65('0x34')](_0x3d2576[_0x5a65('0x27')][_0x5a65('0x27')])||_0x3d2576[_0x5a65('0x27')][_0x5a65('0x27')]===''){throw new db[(_0x5a65('0x2b'))][(_0x5a65('0x32'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x5a65('0x34')](_0x3d2576[_0x5a65('0x27')][_0x5a65('0x35')])){throw new db[(_0x5a65('0x2b'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3da7ed);}if(!_[_0x5a65('0x36')](_0x3da7ed,_0x3d2576[_0x5a65('0x27')][_0x5a65('0x35')])){throw new db[(_0x5a65('0x2b'))][(_0x5a65('0x32'))](_0x5a65('0x37')+_0x3da7ed);}_0xefaba3[_0x3d2576[_0x5a65('0x27')][_0x5a65('0x35')]]=_0x3d2576[_0x5a65('0x27')][_0x5a65('0x38')];})[_0x5a65('0x25')](function(){return db[_0x5a65('0x1b')][_0x5a65('0x39')]({'where':{'id':_0x3d2576[_0x5a65('0x3a')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0x5a65('0x3b'),'where':_0xefaba3,'limit':0x1,'order':[[_0x5a65('0x2f'),_0x5a65('0x3c')]]}]},{'model':db[_0x5a65('0x3d')],'as':_0x5a65('0x3e')}]});})[_0x5a65('0x25')](function(_0x2145f8){if(_0x2145f8&&_0x2145f8[_0x5a65('0x3f')]){var _0x5116df=_0x2145f8['get']({'plain':!![]});_0x73e45b[_0x5a65('0x3a')]=_0x5116df;_0x73e45b[_0x5a65('0x40')]=_0x5116df[_0x5a65('0x3e')];_0x73e45b[_0x5a65('0x41')]=_0x5116df['List'];_0x73e45b['applications']=_[_0x5a65('0x42')](_0x73e45b[_0x5a65('0x40')],[_0x5a65('0x43')],['asc']);if(_0x73e45b[_0x5a65('0x3a')][_0x5a65('0x3e')]){delete _0x73e45b['account'][_0x5a65('0x3e')];}if(_0x73e45b[_0x5a65('0x3a')][_0x5a65('0x3f')]&&_0x73e45b['account'][_0x5a65('0x3f')][_0x5a65('0x3b')]['length']){return _0x73e45b[_0x5a65('0x3a')][_0x5a65('0x3f')]['Contacts'][0x0];}var _0x1c8cde=_[_0x5a65('0xb')](_0x3d2576['body'],{'firstName':_0x3d2576['body'][_0x5a65('0x38')],'ListId':_0x5116df[_0x5a65('0x31')]});_0x1c8cde[_0x3d2576[_0x5a65('0x27')][_0x5a65('0x35')]]=_0x3d2576[_0x5a65('0x27')]['from'];return db[_0x5a65('0x29')]['create'](_0x1c8cde,{'fields':_0xc8256a,'raw':!![]});}})[_0x5a65('0x25')](function(_0x5a9537){_0x73e45b[_0x5a65('0x44')]=_0x5a9537;if(_0x5a9537){var _0x1c4090={'ContactId':_0x5a9537['id'],'FaxAccountId':_0x3d2576[_0x5a65('0x3a')]['id'],'fax':_0x5a9537[_0x5a65('0x28')]};return db[_0x5a65('0x45')][_0x5a65('0x39')]({'where':{'ContactId':_0x5a9537['id'],'closed':![],'FaxAccountId':_0x3d2576[_0x5a65('0x3a')]['id']}})['then'](function(_0x4fed2a){if(_0x4fed2a){return[_0x4fed2a,![]];}return db[_0x5a65('0x45')][_0x5a65('0x46')](_0x1c4090)[_0x5a65('0x25')](function(_0x328fb0){return[_0x328fb0,!![]];});});}else{throw new Error(_0x5a65('0x47'));}})[_0x5a65('0x48')](function(_0x32da4e,_0x3eac22){var _0x4c135f=_0x32da4e[_0x5a65('0x49')]({'plain':!![]});if(_0x3eac22){if(_0x73e45b[_0x5a65('0x3a')][_0x5a65('0x4a')]){_0x73e45b[_0x5a65('0x40')][_0x5a65('0x4b')]({'id':0x0,'priority':_0x73e45b['applications']['length']+0x1,'app':_0x5a65('0x4c'),'appdata':_0x5a65('0x4d'),'interval':_0x5a65('0x4e')});}_0x4c135f['created']=!![];}else{_0x4c135f[_0x5a65('0x4f')]=![];}_0x73e45b[_0x5a65('0x50')]=_0x4c135f;return db[_0x5a65('0x51')][_0x5a65('0x46')]({'body':_0x3d2576[_0x5a65('0x27')][_0x5a65('0x27')],'FaxAccountId':_0x3d2576['account']['id'],'FaxInteractionId':_0x32da4e['id'],'direction':'in','ContactId':_0x32da4e[_0x5a65('0x52')],'AttachmentId':_0x3d2576[_0x5a65('0x27')][_0x5a65('0x53')]});})[_0x5a65('0x25')](function(_0x1bc08d){_0x73e45b[_0x5a65('0x18')]=_0x1bc08d;if(_0x73e45b['interaction'][_0x5a65('0x54')]){return db[_0x5a65('0x55')]['find']({'attributes':['id',_0x5a65('0x56')],'where':{'id':_0x73e45b[_0x5a65('0x50')][_0x5a65('0x54')]}})[_0x5a65('0x25')](function(_0x434d8e){if(_0x434d8e){_0x73e45b[_0x5a65('0x40')][_0x5a65('0x57')]({'id':0x0,'priority':0x0,'app':_0x5a65('0x58'),'appdata':_0x434d8e[_0x5a65('0x56')]+','+(_0x73e45b[_0x5a65('0x3a')][_0x5a65('0x59')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start','startRouting',_0x73e45b);});}return respondWithRpcPromise(_0x5a65('0x5a'),_0x5a65('0x5b'),_0x73e45b);})[_0x5a65('0x25')](function(_0x2f58f2){_0x22ede8(_0x2f58f2);})[_0x5a65('0x19')](function(_0x16c22d){_0x45be63(_0x1a4434[_0x5a65('0x17')](0x1f4,_0x16c22d[_0x5a65('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 7293f41..163c5e3 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 _0x2853=['update','emit','removeListener','register','length','faxAccount:','./faxAccount.events','save','remove'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0x2853,0xd5));var _0x3285=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0x2853[_0x68ee8b];return _0x5148f7;};'use strict';var FaxAccountEvents=require(_0x3285('0x0'));var events=[_0x3285('0x1'),_0x3285('0x2'),_0x3285('0x3')];function createListener(_0x2673fb,_0x3532c8){return function(_0x4d0dac){_0x3532c8[_0x3285('0x4')](_0x2673fb,_0x4d0dac);};}function removeListener(_0x555f51,_0xa8b089){return function(){FaxAccountEvents[_0x3285('0x5')](_0x555f51,_0xa8b089);};}exports[_0x3285('0x6')]=function(_0x10f90c){for(var _0x55ffd9=0x0,_0x432b01=events[_0x3285('0x7')];_0x55ffd9<_0x432b01;_0x55ffd9++){var _0x36ccb9=events[_0x55ffd9];var _0xb27f1e=createListener(_0x3285('0x8')+_0x36ccb9,_0x10f90c);FaxAccountEvents['on'](_0x36ccb9,_0xb27f1e);}}; \ No newline at end of file +var _0x9d15=['remove','update','emit','removeListener','./faxAccount.events','save'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x9d15,0xd0));var _0x59d1=function(_0x3b6194,_0x127855){_0x3b6194=_0x3b6194-0x0;var _0x291980=_0x9d15[_0x3b6194];return _0x291980;};'use strict';var FaxAccountEvents=require(_0x59d1('0x0'));var events=[_0x59d1('0x1'),_0x59d1('0x2'),_0x59d1('0x3')];function createListener(_0x48013b,_0x28aa73){return function(_0x521efe){_0x28aa73[_0x59d1('0x4')](_0x48013b,_0x521efe);};}function removeListener(_0x4a0842,_0x4f9712){return function(){FaxAccountEvents[_0x59d1('0x5')](_0x4a0842,_0x4f9712);};}exports['register']=function(_0x59780b){for(var _0x1f2c26=0x0,_0x4d9570=events['length'];_0x1f2c26<_0x4d9570;_0x1f2c26++){var _0x40a8a2=events[_0x1f2c26];var _0x396d73=createListener('faxAccount:'+_0x40a8a2,_0x59780b);FaxAccountEvents['on'](_0x40a8a2,_0x396d73);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index bca0ca2..219af11 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(_0x30ee45,_0x514bf0){var _0x1a0dbd=function(_0x12b405){while(--_0x12b405){_0x30ee45['push'](_0x30ee45['shift']());}};_0x1a0dbd(++_0x514bf0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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(_0x41c94e,_0x5bc19f){var _0x547c29=function(_0x4e4b6e){while(--_0x4e4b6e){_0x41c94e['push'](_0x41c94e['shift']());}};_0x547c29(++_0x5bc19f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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 1bb52b0..7e025cb 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 _0x713e=['STRING','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x2b1305,_0x381ddb){var _0x435623=function(_0x52060e){while(--_0x52060e){_0x2b1305['push'](_0x2b1305['shift']());}};_0x435623(++_0x381ddb);}(_0x713e,0x147));var _0xe713=function(_0x50445d,_0x4e568c){_0x50445d=_0x50445d-0x0;var _0x1bfa93=_0x713e[_0x50445d];return _0x1bfa93;};'use strict';var Sequelize=require(_0xe713('0x0'));module[_0xe713('0x1')]={'priority':{'type':Sequelize[_0xe713('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xe713('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xe713('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xe713('0x3')],'defaultValue':_0xe713('0x5')}}; \ No newline at end of file +var _0x5aab=['exports','INTEGER','STRING','*,*,*,*'];(function(_0x40f122,_0x5bc9b8){var _0xb28b02=function(_0x1bb487){while(--_0x1bb487){_0x40f122['push'](_0x40f122['shift']());}};_0xb28b02(++_0x5bc9b8);}(_0x5aab,0x168));var _0xb5aa=function(_0x23e6a0,_0x498803){_0x23e6a0=_0x23e6a0-0x0;var _0x433cd8=_0x5aab[_0x23e6a0];return _0x433cd8;};'use strict';var Sequelize=require('sequelize');module[_0xb5aa('0x0')]={'priority':{'type':Sequelize[_0xb5aa('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xb5aa('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xb5aa('0x3')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 4e3fe41..bdb5702 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 _0x41d9=['where','filters','pick','filter','VIRTUAL','merge','findAll','catch','show','includeAll','include','find','create','body','params','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','map','FaxApplication','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort'];(function(_0x453ba9,_0x41b71a){var _0x2cc439=function(_0x4cb664){while(--_0x4cb664){_0x453ba9['push'](_0x453ba9['shift']());}};_0x2cc439(++_0x41b71a);}(_0x41d9,0x9d));var _0x941d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x41d9[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x941d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x941d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x941d('0x2'));var moment=require('moment');var BPromise=require(_0x941d('0x3'));var Mustache=require(_0x941d('0x4'));var util=require(_0x941d('0x5'));var path=require(_0x941d('0x6'));var sox=require(_0x941d('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x941d('0x8'));var _=require('lodash');var squel=require(_0x941d('0x9'));var crypto=require(_0x941d('0xa'));var jsforce=require(_0x941d('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x941d('0xc'));var Redis=require(_0x941d('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x941d('0xe'));var as=require(_0x941d('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x941d('0x10'))(_0x941d('0x11'));var utils=require(_0x941d('0x12'));var config=require(_0x941d('0x13'));var licenseUtil=require(_0x941d('0x14'));var db=require(_0x941d('0x15'))['db'];function respondWithStatusCode(_0x35b577,_0x25fd34){_0x25fd34=_0x25fd34||0xcc;return function(_0x5e2039){if(_0x5e2039){return _0x35b577[_0x941d('0x16')](_0x25fd34);}return _0x35b577['status'](_0x25fd34)['end']();};}function respondWithResult(_0x5000a2,_0x40879d){_0x40879d=_0x40879d||0xc8;return function(_0x5e314f){if(_0x5e314f){return _0x5000a2[_0x941d('0x17')](_0x40879d)[_0x941d('0x18')](_0x5e314f);}};}function respondWithFilteredResult(_0x1cf11f,_0x2ba97d){return function(_0x103525){if(_0x103525){var _0xfea36=typeof _0x2ba97d[_0x941d('0x19')]===_0x941d('0x1a')&&typeof _0x2ba97d[_0x941d('0x1b')]===_0x941d('0x1a');var _0x23e559=_0x103525[_0x941d('0x1c')];var _0x213d24=_0xfea36?0x0:_0x2ba97d[_0x941d('0x19')];var _0x538383=_0xfea36?_0x103525[_0x941d('0x1c')]:_0x2ba97d['offset']+_0x2ba97d['limit'];var _0xaac076;if(_0x538383>=_0x23e559){_0x538383=_0x23e559;_0xaac076=0xc8;}else{_0xaac076=0xce;}_0x1cf11f[_0x941d('0x17')](_0xaac076);return _0x1cf11f[_0x941d('0x1d')](_0x941d('0x1e'),_0x213d24+'-'+_0x538383+'/'+_0x23e559)[_0x941d('0x18')](_0x103525);}return null;};}function patchUpdates(_0x23519e){return function(_0x562152){try{jsonpatch[_0x941d('0x1f')](_0x562152,_0x23519e,!![]);}catch(_0x2c9626){return BPromise[_0x941d('0x20')](_0x2c9626);}return _0x562152['save']();};}function saveUpdates(_0x3b3a20,_0x399c8a){return function(_0x100210){if(_0x100210){return _0x100210[_0x941d('0x21')](_0x3b3a20)[_0x941d('0x22')](function(_0x561c98){return _0x561c98;});}return null;};}function removeEntity(_0x3c7cc4,_0x1f3c2c){return function(_0x2c56e0){if(_0x2c56e0){return _0x2c56e0[_0x941d('0x23')]()['then'](function(){_0x3c7cc4[_0x941d('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xeca1b6,_0x87d9af){return function(_0x2891ef){if(!_0x2891ef){_0xeca1b6[_0x941d('0x16')](0x194);}return _0x2891ef;};}function handleError(_0x335839,_0xb58045){_0xb58045=_0xb58045||0x1f4;return function(_0x22cae2){logger[_0x941d('0x24')](_0x22cae2[_0x941d('0x25')]);if(_0x22cae2[_0x941d('0x26')]){delete _0x22cae2[_0x941d('0x26')];}_0x335839[_0x941d('0x17')](_0xb58045)[_0x941d('0x27')](_0x22cae2);};}exports['index']=function(_0x391a0e,_0xaeff9){var _0x4a7b4b={},_0x5cc76b={},_0x3067ee={'count':0x0,'rows':[]};var _0x5a6e96=_[_0x941d('0x28')](db[_0x941d('0x29')][_0x941d('0x2a')],function(_0x3ccffc){return{'name':_0x3ccffc[_0x941d('0x2b')],'type':_0x3ccffc[_0x941d('0x2c')][_0x941d('0x2d')]};});_0x5cc76b[_0x941d('0x2e')]=_[_0x941d('0x28')](_0x5a6e96,_0x941d('0x26'));_0x5cc76b[_0x941d('0x2f')]=_[_0x941d('0x30')](_0x391a0e['query']);_0x5cc76b['filters']=_[_0x941d('0x31')](_0x5cc76b[_0x941d('0x2e')],_0x5cc76b[_0x941d('0x2f')]);_0x4a7b4b[_0x941d('0x32')]=_[_0x941d('0x31')](_0x5cc76b[_0x941d('0x2e')],qs[_0x941d('0x33')](_0x391a0e[_0x941d('0x2f')][_0x941d('0x33')]));_0x4a7b4b[_0x941d('0x32')]=_0x4a7b4b[_0x941d('0x32')][_0x941d('0x34')]?_0x4a7b4b[_0x941d('0x32')]:_0x5cc76b[_0x941d('0x2e')];if(!_0x391a0e['query'][_0x941d('0x35')]('nolimit')){_0x4a7b4b[_0x941d('0x1b')]=qs[_0x941d('0x1b')](_0x391a0e[_0x941d('0x2f')][_0x941d('0x1b')]);_0x4a7b4b[_0x941d('0x19')]=qs[_0x941d('0x19')](_0x391a0e['query'][_0x941d('0x19')]);}_0x4a7b4b[_0x941d('0x36')]=qs['sort'](_0x391a0e[_0x941d('0x2f')][_0x941d('0x37')]);_0x4a7b4b[_0x941d('0x38')]=qs[_0x941d('0x39')](_[_0x941d('0x3a')](_0x391a0e[_0x941d('0x2f')],_0x5cc76b[_0x941d('0x39')]),_0x5a6e96);if(_0x391a0e[_0x941d('0x2f')][_0x941d('0x3b')]){_0x4a7b4b[_0x941d('0x38')]=_['merge'](_0x4a7b4b[_0x941d('0x38')],{'$or':_[_0x941d('0x28')](_0x5a6e96,function(_0x5da7ca){if(_0x5da7ca[_0x941d('0x2c')]!==_0x941d('0x3c')){var _0x28ca35={};_0x28ca35[_0x5da7ca[_0x941d('0x26')]]={'$like':'%'+_0x391a0e[_0x941d('0x2f')]['filter']+'%'};return _0x28ca35;}})});}_0x4a7b4b=_[_0x941d('0x3d')]({},_0x4a7b4b,_0x391a0e['options']);var _0x5c2dc7={'where':_0x4a7b4b[_0x941d('0x38')]};return db[_0x941d('0x29')]['count'](_0x5c2dc7)[_0x941d('0x22')](function(_0x45e749){_0x3067ee[_0x941d('0x1c')]=_0x45e749;if(_0x391a0e[_0x941d('0x2f')]['includeAll']){_0x4a7b4b['include']=[{'all':!![]}];}return db[_0x941d('0x29')][_0x941d('0x3e')](_0x4a7b4b);})['then'](function(_0x461b3c){_0x3067ee['rows']=_0x461b3c;return _0x3067ee;})[_0x941d('0x22')](respondWithFilteredResult(_0xaeff9,_0x4a7b4b))[_0x941d('0x3f')](handleError(_0xaeff9,null));};exports[_0x941d('0x40')]=function(_0x33287c,_0x320590){var _0xa73095={'raw':!![],'where':{'id':_0x33287c['params']['id']}},_0x3fbe7e={};_0x3fbe7e[_0x941d('0x2e')]=_['keys'](db[_0x941d('0x29')][_0x941d('0x2a')]);_0x3fbe7e[_0x941d('0x2f')]=_[_0x941d('0x30')](_0x33287c[_0x941d('0x2f')]);_0x3fbe7e[_0x941d('0x39')]=_['intersection'](_0x3fbe7e[_0x941d('0x2e')],_0x3fbe7e[_0x941d('0x2f')]);_0xa73095['attributes']=_[_0x941d('0x31')](_0x3fbe7e['model'],qs[_0x941d('0x33')](_0x33287c[_0x941d('0x2f')][_0x941d('0x33')]));_0xa73095[_0x941d('0x32')]=_0xa73095['attributes'][_0x941d('0x34')]?_0xa73095[_0x941d('0x32')]:_0x3fbe7e[_0x941d('0x2e')];if(_0x33287c[_0x941d('0x2f')][_0x941d('0x41')]){_0xa73095[_0x941d('0x42')]=[{'all':!![]}];}_0xa73095=_[_0x941d('0x3d')]({},_0xa73095,_0x33287c['options']);return db['FaxApplication'][_0x941d('0x43')](_0xa73095)[_0x941d('0x22')](handleEntityNotFound(_0x320590,null))['then'](respondWithResult(_0x320590,null))['catch'](handleError(_0x320590,null));};exports['create']=function(_0x3751fb,_0xc8976f){return db[_0x941d('0x29')][_0x941d('0x44')](_0x3751fb[_0x941d('0x45')],{})[_0x941d('0x22')](respondWithResult(_0xc8976f,0xc9))['catch'](handleError(_0xc8976f,null));};exports['update']=function(_0x3a9dd6,_0x3e9815){if(_0x3a9dd6[_0x941d('0x45')]['id']){delete _0x3a9dd6[_0x941d('0x45')]['id'];}return db[_0x941d('0x29')]['find']({'where':{'id':_0x3a9dd6[_0x941d('0x46')]['id']}})[_0x941d('0x22')](handleEntityNotFound(_0x3e9815,null))[_0x941d('0x22')](saveUpdates(_0x3a9dd6[_0x941d('0x45')],null))[_0x941d('0x22')](respondWithResult(_0x3e9815,null))[_0x941d('0x3f')](handleError(_0x3e9815,null));};exports['destroy']=function(_0x2c775d,_0x3304e9){return db[_0x941d('0x29')][_0x941d('0x43')]({'where':{'id':_0x2c775d[_0x941d('0x46')]['id']}})['then'](handleEntityNotFound(_0x3304e9,null))['then'](removeEntity(_0x3304e9,null))[_0x941d('0x3f')](handleError(_0x3304e9,null));}; \ No newline at end of file +var _0xe442=['attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','FaxApplication','rawAttributes','fieldName','model','map','query','filters'];(function(_0x310eb9,_0x1aed15){var _0x28915c=function(_0x457fd6){while(--_0x457fd6){_0x310eb9['push'](_0x310eb9['shift']());}};_0x28915c(++_0x1aed15);}(_0xe442,0x1e7));var _0x2e44=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xe442[_0x4e676e];return _0x336a3c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2e44('0x0'));var zipdir=require(_0x2e44('0x1'));var jsonpatch=require(_0x2e44('0x2'));var rp=require(_0x2e44('0x3'));var moment=require(_0x2e44('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2e44('0x5'));var util=require(_0x2e44('0x6'));var path=require('path');var sox=require(_0x2e44('0x7'));var csv=require(_0x2e44('0x8'));var ejs=require(_0x2e44('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2e44('0xa'));var squel=require(_0x2e44('0xb'));var crypto=require(_0x2e44('0xc'));var jsforce=require(_0x2e44('0xd'));var deskjs=require(_0x2e44('0xe'));var toCsv=require(_0x2e44('0x8'));var querystring=require(_0x2e44('0xf'));var Papa=require(_0x2e44('0x10'));var Redis=require('ioredis');var authService=require(_0x2e44('0x11'));var qs=require(_0x2e44('0x12'));var as=require(_0x2e44('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2e44('0x14'))(_0x2e44('0x15'));var utils=require(_0x2e44('0x16'));var config=require(_0x2e44('0x17'));var licenseUtil=require(_0x2e44('0x18'));var db=require(_0x2e44('0x19'))['db'];function respondWithStatusCode(_0x22a951,_0x198d2f){_0x198d2f=_0x198d2f||0xcc;return function(_0x598657){if(_0x598657){return _0x22a951[_0x2e44('0x1a')](_0x198d2f);}return _0x22a951[_0x2e44('0x1b')](_0x198d2f)[_0x2e44('0x1c')]();};}function respondWithResult(_0x4adabe,_0x3979b3){_0x3979b3=_0x3979b3||0xc8;return function(_0x16b30e){if(_0x16b30e){return _0x4adabe[_0x2e44('0x1b')](_0x3979b3)[_0x2e44('0x1d')](_0x16b30e);}};}function respondWithFilteredResult(_0x114e44,_0x5226f2){return function(_0x651fdd){if(_0x651fdd){var _0x5168df=typeof _0x5226f2['offset']===_0x2e44('0x1e')&&typeof _0x5226f2['limit']===_0x2e44('0x1e');var _0x48a645=_0x651fdd[_0x2e44('0x1f')];var _0xba4425=_0x5168df?0x0:_0x5226f2[_0x2e44('0x20')];var _0x124f2e=_0x5168df?_0x651fdd[_0x2e44('0x1f')]:_0x5226f2[_0x2e44('0x20')]+_0x5226f2[_0x2e44('0x21')];var _0x5b2406;if(_0x124f2e>=_0x48a645){_0x124f2e=_0x48a645;_0x5b2406=0xc8;}else{_0x5b2406=0xce;}_0x114e44[_0x2e44('0x1b')](_0x5b2406);return _0x114e44[_0x2e44('0x22')](_0x2e44('0x23'),_0xba4425+'-'+_0x124f2e+'/'+_0x48a645)['json'](_0x651fdd);}return null;};}function patchUpdates(_0x124304){return function(_0x496ea1){try{jsonpatch['apply'](_0x496ea1,_0x124304,!![]);}catch(_0x430031){return BPromise[_0x2e44('0x24')](_0x430031);}return _0x496ea1[_0x2e44('0x25')]();};}function saveUpdates(_0x5ee216,_0x40a9e1){return function(_0x5f1577){if(_0x5f1577){return _0x5f1577[_0x2e44('0x26')](_0x5ee216)[_0x2e44('0x27')](function(_0x17028f){return _0x17028f;});}return null;};}function removeEntity(_0x2ef2a5,_0x8ad192){return function(_0x1369f1){if(_0x1369f1){return _0x1369f1[_0x2e44('0x28')]()[_0x2e44('0x27')](function(){_0x2ef2a5[_0x2e44('0x1b')](0xcc)[_0x2e44('0x1c')]();});}};}function handleEntityNotFound(_0x2dd49f,_0x5e98cf){return function(_0x539851){if(!_0x539851){_0x2dd49f[_0x2e44('0x1a')](0x194);}return _0x539851;};}function handleError(_0xd5aeb7,_0x3632e9){_0x3632e9=_0x3632e9||0x1f4;return function(_0x520a72){logger['error'](_0x520a72[_0x2e44('0x29')]);if(_0x520a72[_0x2e44('0x2a')]){delete _0x520a72[_0x2e44('0x2a')];}_0xd5aeb7[_0x2e44('0x1b')](_0x3632e9)[_0x2e44('0x2b')](_0x520a72);};}exports[_0x2e44('0x2c')]=function(_0x162bc3,_0x5afb75){var _0x2b4008={},_0x96fbe5={},_0x8f37cc={'count':0x0,'rows':[]};var _0x29431f=_['map'](db[_0x2e44('0x2d')][_0x2e44('0x2e')],function(_0x8534e8){return{'name':_0x8534e8[_0x2e44('0x2f')],'type':_0x8534e8['type']['key']};});_0x96fbe5[_0x2e44('0x30')]=_[_0x2e44('0x31')](_0x29431f,_0x2e44('0x2a'));_0x96fbe5[_0x2e44('0x32')]=_['keys'](_0x162bc3[_0x2e44('0x32')]);_0x96fbe5[_0x2e44('0x33')]=_['intersection'](_0x96fbe5[_0x2e44('0x30')],_0x96fbe5[_0x2e44('0x32')]);_0x2b4008[_0x2e44('0x34')]=_[_0x2e44('0x35')](_0x96fbe5[_0x2e44('0x30')],qs[_0x2e44('0x36')](_0x162bc3[_0x2e44('0x32')]['fields']));_0x2b4008['attributes']=_0x2b4008['attributes'][_0x2e44('0x37')]?_0x2b4008[_0x2e44('0x34')]:_0x96fbe5[_0x2e44('0x30')];if(!_0x162bc3[_0x2e44('0x32')][_0x2e44('0x38')](_0x2e44('0x39'))){_0x2b4008[_0x2e44('0x21')]=qs[_0x2e44('0x21')](_0x162bc3[_0x2e44('0x32')][_0x2e44('0x21')]);_0x2b4008[_0x2e44('0x20')]=qs[_0x2e44('0x20')](_0x162bc3[_0x2e44('0x32')][_0x2e44('0x20')]);}_0x2b4008[_0x2e44('0x3a')]=qs[_0x2e44('0x3b')](_0x162bc3[_0x2e44('0x32')][_0x2e44('0x3b')]);_0x2b4008['where']=qs[_0x2e44('0x33')](_['pick'](_0x162bc3[_0x2e44('0x32')],_0x96fbe5[_0x2e44('0x33')]),_0x29431f);if(_0x162bc3[_0x2e44('0x32')][_0x2e44('0x3c')]){_0x2b4008[_0x2e44('0x3d')]=_[_0x2e44('0x3e')](_0x2b4008[_0x2e44('0x3d')],{'$or':_['map'](_0x29431f,function(_0x1da724){if(_0x1da724[_0x2e44('0x3f')]!==_0x2e44('0x40')){var _0x442e77={};_0x442e77[_0x1da724[_0x2e44('0x2a')]]={'$like':'%'+_0x162bc3[_0x2e44('0x32')]['filter']+'%'};return _0x442e77;}})});}_0x2b4008=_['merge']({},_0x2b4008,_0x162bc3[_0x2e44('0x41')]);var _0x4c241c={'where':_0x2b4008[_0x2e44('0x3d')]};return db[_0x2e44('0x2d')][_0x2e44('0x1f')](_0x4c241c)[_0x2e44('0x27')](function(_0x276e2b){_0x8f37cc[_0x2e44('0x1f')]=_0x276e2b;if(_0x162bc3['query'][_0x2e44('0x42')]){_0x2b4008[_0x2e44('0x43')]=[{'all':!![]}];}return db[_0x2e44('0x2d')][_0x2e44('0x44')](_0x2b4008);})[_0x2e44('0x27')](function(_0x542b12){_0x8f37cc[_0x2e44('0x45')]=_0x542b12;return _0x8f37cc;})['then'](respondWithFilteredResult(_0x5afb75,_0x2b4008))['catch'](handleError(_0x5afb75,null));};exports[_0x2e44('0x46')]=function(_0x4f5767,_0x137d33){var _0x936f03={'raw':!![],'where':{'id':_0x4f5767[_0x2e44('0x47')]['id']}},_0x525438={};_0x525438[_0x2e44('0x30')]=_[_0x2e44('0x48')](db[_0x2e44('0x2d')][_0x2e44('0x2e')]);_0x525438[_0x2e44('0x32')]=_[_0x2e44('0x48')](_0x4f5767['query']);_0x525438[_0x2e44('0x33')]=_['intersection'](_0x525438[_0x2e44('0x30')],_0x525438[_0x2e44('0x32')]);_0x936f03[_0x2e44('0x34')]=_[_0x2e44('0x35')](_0x525438[_0x2e44('0x30')],qs['fields'](_0x4f5767[_0x2e44('0x32')]['fields']));_0x936f03[_0x2e44('0x34')]=_0x936f03[_0x2e44('0x34')][_0x2e44('0x37')]?_0x936f03['attributes']:_0x525438[_0x2e44('0x30')];if(_0x4f5767[_0x2e44('0x32')][_0x2e44('0x42')]){_0x936f03['include']=[{'all':!![]}];}_0x936f03=_[_0x2e44('0x3e')]({},_0x936f03,_0x4f5767[_0x2e44('0x41')]);return db[_0x2e44('0x2d')][_0x2e44('0x49')](_0x936f03)[_0x2e44('0x27')](handleEntityNotFound(_0x137d33,null))[_0x2e44('0x27')](respondWithResult(_0x137d33,null))[_0x2e44('0x4a')](handleError(_0x137d33,null));};exports[_0x2e44('0x4b')]=function(_0x4f3e08,_0x985ed){return db[_0x2e44('0x2d')]['create'](_0x4f3e08[_0x2e44('0x4c')],{})['then'](respondWithResult(_0x985ed,0xc9))[_0x2e44('0x4a')](handleError(_0x985ed,null));};exports[_0x2e44('0x26')]=function(_0x43d349,_0x15a94c){if(_0x43d349['body']['id']){delete _0x43d349['body']['id'];}return db[_0x2e44('0x2d')][_0x2e44('0x49')]({'where':{'id':_0x43d349[_0x2e44('0x47')]['id']}})[_0x2e44('0x27')](handleEntityNotFound(_0x15a94c,null))['then'](saveUpdates(_0x43d349[_0x2e44('0x4c')],null))[_0x2e44('0x27')](respondWithResult(_0x15a94c,null))[_0x2e44('0x4a')](handleError(_0x15a94c,null));};exports[_0x2e44('0x28')]=function(_0x370224,_0x40c18c){return db[_0x2e44('0x2d')][_0x2e44('0x49')]({'where':{'id':_0x370224[_0x2e44('0x47')]['id']}})[_0x2e44('0x27')](handleEntityNotFound(_0x40c18c,null))[_0x2e44('0x27')](removeEntity(_0x40c18c,null))[_0x2e44('0x4a')](handleError(_0x40c18c,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index dc3240a..2baab50 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 _0x3291=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x3ffe3f,_0x464d70){var _0x130c0b=function(_0x4d137e){while(--_0x4d137e){_0x3ffe3f['push'](_0x3ffe3f['shift']());}};_0x130c0b(++_0x464d70);}(_0x3291,0x1f0));var _0x1329=function(_0x529008,_0x25d31b){_0x529008=_0x529008-0x0;var _0x3206a1=_0x3291[_0x529008];return _0x3206a1;};'use strict';var _=require(_0x1329('0x0'));var util=require(_0x1329('0x1'));var logger=require('../../config/logger')(_0x1329('0x2'));var moment=require(_0x1329('0x3'));var BPromise=require(_0x1329('0x4'));var rp=require(_0x1329('0x5'));var fs=require('fs');var path=require(_0x1329('0x6'));var rimraf=require(_0x1329('0x7'));var config=require(_0x1329('0x8'));var attributes=require(_0x1329('0x9'));module[_0x1329('0xa')]=function(_0x109ae6,_0x79c41f){return _0x109ae6[_0x1329('0xb')](_0x1329('0xc'),attributes,{'tableName':_0x1329('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1329('0xe'),'collate':_0x1329('0xf')});}; \ No newline at end of file +var _0x8870=['FaxApplication','fax_applications','lodash','util','../../config/logger','moment','bluebird','path','rimraf','./faxApplication.attributes','exports','define'];(function(_0x3bcb39,_0x2e1bd0){var _0x158bc4=function(_0x5570d3){while(--_0x5570d3){_0x3bcb39['push'](_0x3bcb39['shift']());}};_0x158bc4(++_0x2e1bd0);}(_0x8870,0x16a));var _0x0887=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x8870[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x0887('0x0'));var util=require(_0x0887('0x1'));var logger=require(_0x0887('0x2'))('api');var moment=require(_0x0887('0x3'));var BPromise=require(_0x0887('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0887('0x5'));var rimraf=require(_0x0887('0x6'));var config=require('../../config/environment');var attributes=require(_0x0887('0x7'));module[_0x0887('0x8')]=function(_0x133051,_0xc3cd2){return _0x133051[_0x0887('0x9')](_0x0887('0xa'),attributes,{'tableName':_0x0887('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index d19fe98..7426778 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 _0xbf22=['stringify','error','message','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','attributes','limit','info','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','FaxApplication,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x2c0241,_0x21542e){var _0x269049=function(_0x6d4208){while(--_0x6d4208){_0x2c0241['push'](_0x2c0241['shift']());}};_0x269049(++_0x21542e);}(_0xbf22,0x11c));var _0x2bf2=function(_0x70dee5,_0x3b711b){_0x70dee5=_0x70dee5-0x0;var _0x14d387=_0xbf22[_0x70dee5];return _0x14d387;};'use strict';var _=require(_0x2bf2('0x0'));var util=require(_0x2bf2('0x1'));var moment=require('moment');var BPromise=require(_0x2bf2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2bf2('0x3'));var db=require(_0x2bf2('0x4'))['db'];var utils=require(_0x2bf2('0x5'));var logger=require('../../config/logger')(_0x2bf2('0x6'));var config=require(_0x2bf2('0x7'));var jayson=require(_0x2bf2('0x8'));var client=jayson[_0x2bf2('0x9')][_0x2bf2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f21ea,_0x580950,_0xb3a43f){return new BPromise(function(_0xf0d6e8,_0x18a129){return client[_0x2bf2('0xb')](_0x1f21ea,_0xb3a43f)[_0x2bf2('0xc')](function(_0x36aad9){logger['info'](_0x2bf2('0xd'),_0x580950,'request\x20sent');logger[_0x2bf2('0xe')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x580950,_0x2bf2('0xf'),JSON[_0x2bf2('0x10')](_0x36aad9));if(_0x36aad9[_0x2bf2('0x11')]){if(_0x36aad9[_0x2bf2('0x11')]['code']===0x1f4){logger[_0x2bf2('0x11')]('FaxApplication,\x20%s,\x20%s',_0x580950,_0x36aad9[_0x2bf2('0x11')][_0x2bf2('0x12')]);return _0x18a129(_0x36aad9[_0x2bf2('0x11')]['message']);}logger[_0x2bf2('0x11')](_0x2bf2('0xd'),_0x580950,_0x36aad9[_0x2bf2('0x11')][_0x2bf2('0x12')]);return _0xf0d6e8(_0x36aad9[_0x2bf2('0x11')][_0x2bf2('0x12')]);}else{logger['info']('FaxApplication,\x20%s,\x20%s',_0x580950,_0x2bf2('0xf'));_0xf0d6e8(_0x36aad9['result'][_0x2bf2('0x12')]);}})['catch'](function(_0x5dae46){logger[_0x2bf2('0x11')](_0x2bf2('0xd'),_0x580950,_0x5dae46);_0x18a129(_0x5dae46);});});}exports[_0x2bf2('0x13')]=function(_0x34d1a2){var _0x5da642=this;return new Promise(function(_0x2b6773,_0x10a2f7){return db[_0x2bf2('0x14')][_0x2bf2('0x15')](_0x34d1a2[_0x2bf2('0x16')],{'raw':_0x34d1a2[_0x2bf2('0x17')]?_0x34d1a2[_0x2bf2('0x17')][_0x2bf2('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34d1a2['options']?_0x34d1a2[_0x2bf2('0x17')][_0x2bf2('0x19')]||null:null,'attributes':_0x34d1a2[_0x2bf2('0x17')]?_0x34d1a2['options'][_0x2bf2('0x1a')]||null:null,'limit':_0x34d1a2['options']?_0x34d1a2[_0x2bf2('0x17')][_0x2bf2('0x1b')]||null:null})[_0x2bf2('0xc')](function(_0x9a89a6){logger[_0x2bf2('0x1c')]('UpdateFaxApplication',_0x34d1a2);logger[_0x2bf2('0xe')](_0x2bf2('0x13'),_0x34d1a2,JSON[_0x2bf2('0x10')](_0x9a89a6));_0x2b6773(_0x9a89a6);})[_0x2bf2('0x1d')](function(_0x7da2b2){logger[_0x2bf2('0x11')]('UpdateFaxApplication',_0x7da2b2[_0x2bf2('0x12')],_0x34d1a2);_0x10a2f7(_0x5da642[_0x2bf2('0x11')](0x1f4,_0x7da2b2[_0x2bf2('0x12')]));});});}; \ No newline at end of file +var _0x6787=['where','attributes','limit','UpdateFaxApplication','debug','stringify','lodash','util','moment','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','FaxApplication,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','FaxApplication','update','body','options','raw'];(function(_0x42e394,_0x4392e3){var _0x1fd797=function(_0x42f0ca){while(--_0x42f0ca){_0x42e394['push'](_0x42e394['shift']());}};_0x1fd797(++_0x4392e3);}(_0x6787,0xb4));var _0x7678=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x6787[_0x42245d];return _0x4b211a;};'use strict';var _=require(_0x7678('0x0'));var util=require(_0x7678('0x1'));var moment=require(_0x7678('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7678('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7678('0x4'))(_0x7678('0x5'));var config=require(_0x7678('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7678('0x7')][_0x7678('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x32df8b,_0x3d9afa,_0x32d08c){return new BPromise(function(_0x11d2e9,_0x2b3341){return client['request'](_0x32df8b,_0x32d08c)[_0x7678('0x9')](function(_0x6442ae){logger['info'](_0x7678('0xa'),_0x3d9afa,_0x7678('0xb'));logger['debug']('FaxApplication,\x20%s,\x20%s,\x20%s',_0x3d9afa,'request\x20sent',JSON['stringify'](_0x6442ae));if(_0x6442ae[_0x7678('0xc')]){if(_0x6442ae[_0x7678('0xc')][_0x7678('0xd')]===0x1f4){logger[_0x7678('0xc')](_0x7678('0xa'),_0x3d9afa,_0x6442ae['error'][_0x7678('0xe')]);return _0x2b3341(_0x6442ae[_0x7678('0xc')][_0x7678('0xe')]);}logger[_0x7678('0xc')]('FaxApplication,\x20%s,\x20%s',_0x3d9afa,_0x6442ae[_0x7678('0xc')][_0x7678('0xe')]);return _0x11d2e9(_0x6442ae['error'][_0x7678('0xe')]);}else{logger[_0x7678('0xf')](_0x7678('0xa'),_0x3d9afa,'request\x20sent');_0x11d2e9(_0x6442ae[_0x7678('0x10')][_0x7678('0xe')]);}})[_0x7678('0x11')](function(_0xd22204){logger[_0x7678('0xc')](_0x7678('0xa'),_0x3d9afa,_0xd22204);_0x2b3341(_0xd22204);});});}exports['UpdateFaxApplication']=function(_0x10113f){var _0x383c67=this;return new Promise(function(_0x15792c,_0x584247){return db[_0x7678('0x12')][_0x7678('0x13')](_0x10113f[_0x7678('0x14')],{'raw':_0x10113f[_0x7678('0x15')]?_0x10113f[_0x7678('0x15')][_0x7678('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10113f['options']?_0x10113f[_0x7678('0x15')][_0x7678('0x17')]||null:null,'attributes':_0x10113f[_0x7678('0x15')]?_0x10113f[_0x7678('0x15')][_0x7678('0x18')]||null:null,'limit':_0x10113f[_0x7678('0x15')]?_0x10113f['options'][_0x7678('0x19')]||null:null})[_0x7678('0x9')](function(_0x46cea9){logger[_0x7678('0xf')](_0x7678('0x1a'),_0x10113f);logger[_0x7678('0x1b')](_0x7678('0x1a'),_0x10113f,JSON[_0x7678('0x1c')](_0x46cea9));_0x15792c(_0x46cea9);})[_0x7678('0x11')](function(_0x1b1565){logger[_0x7678('0xc')](_0x7678('0x1a'),_0x1b1565[_0x7678('0xe')],_0x10113f);_0x584247(_0x383c67[_0x7678('0xc')](0x1f4,_0x1b1565[_0x7678('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index cd719fb..01c16f4 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 _0xe605=['../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','create','put','/:id','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x6c434,_0x2508c5){var _0x25d130=function(_0x14b3c5){while(--_0x14b3c5){_0x6c434['push'](_0x6c434['shift']());}};_0x25d130(++_0x2508c5);}(_0xe605,0x92));var _0x5e60=function(_0x51f72a,_0x3d9f14){_0x51f72a=_0x51f72a-0x0;var _0x51b514=_0xe605[_0x51f72a];return _0x51b514;};'use strict';var multer=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var path=require('path');var timeout=require(_0x5e60('0x2'));var express=require(_0x5e60('0x3'));var router=express[_0x5e60('0x4')]();var fs_extra=require(_0x5e60('0x5'));var auth=require(_0x5e60('0x6'));var interaction=require(_0x5e60('0x7'));var config=require(_0x5e60('0x8'));var controller=require(_0x5e60('0x9'));router[_0x5e60('0xa')]('/',auth[_0x5e60('0xb')](),controller[_0x5e60('0xc')]);router[_0x5e60('0xa')]('/:id',auth[_0x5e60('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x5e60('0xd')]);router[_0x5e60('0xe')](_0x5e60('0xf'),auth[_0x5e60('0xb')](),controller[_0x5e60('0x10')]);router[_0x5e60('0x11')]('/:id',auth[_0x5e60('0xb')](),controller['destroy']);module[_0x5e60('0x12')]=router; \ No newline at end of file +var _0xd7d1=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x549278,_0x450754){var _0x1ea9a1=function(_0x2e559d){while(--_0x2e559d){_0x549278['push'](_0x549278['shift']());}};_0x1ea9a1(++_0x450754);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x50a15d,_0x13b30f){_0x50a15d=_0x50a15d-0x0;var _0x3b026d=_0xd7d1[_0x50a15d];return _0x3b026d;};'use strict';var multer=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var path=require(_0x1d7d('0x2'));var timeout=require(_0x1d7d('0x3'));var express=require(_0x1d7d('0x4'));var router=express[_0x1d7d('0x5')]();var fs_extra=require(_0x1d7d('0x6'));var auth=require(_0x1d7d('0x7'));var interaction=require(_0x1d7d('0x8'));var config=require(_0x1d7d('0x9'));var controller=require(_0x1d7d('0xa'));router[_0x1d7d('0xb')]('/',auth[_0x1d7d('0xc')](),controller['index']);router[_0x1d7d('0xb')](_0x1d7d('0xd'),auth[_0x1d7d('0xc')](),controller[_0x1d7d('0xe')]);router[_0x1d7d('0xf')]('/',auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x10')]);router[_0x1d7d('0x11')](_0x1d7d('0xd'),auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x12')]);router['delete'](_0x1d7d('0xd'),auth['isAuthenticated'](),controller[_0x1d7d('0x13')]);module[_0x1d7d('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 344e0c5..09a35eb 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 _0x38d3=['STRING','out','sequelize','DATE'];(function(_0x1dfa63,_0x362bd4){var _0x26f2a9=function(_0x31cc52){while(--_0x31cc52){_0x1dfa63['push'](_0x1dfa63['shift']());}};_0x26f2a9(++_0x362bd4);}(_0x38d3,0x176));var _0x338d=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x38d3[_0x187ee1];return _0x388160;};'use strict';var Sequelize=require(_0x338d('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x338d('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x338d('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x338d('0x2')]},'read1stAt':{'type':Sequelize[_0x338d('0x1')]},'fax':{'type':Sequelize[_0x338d('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x338d('0x3')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xfdf6=['DATE','STRING','ENUM','out','sequelize','BOOLEAN'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xfdf6,0xa0));var _0x6fdf=function(_0x846eb8,_0x4733fa){_0x846eb8=_0x846eb8-0x0;var _0x2a15e0=_0xfdf6[_0x846eb8];return _0x2a15e0;};'use strict';var Sequelize=require(_0x6fdf('0x0'));module['exports']={'closed':{'type':Sequelize[_0x6fdf('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6fdf('0x2')]},'disposition':{'type':Sequelize[_0x6fdf('0x3')]},'secondDisposition':{'type':Sequelize[_0x6fdf('0x3')]},'thirdDisposition':{'type':Sequelize[_0x6fdf('0x3')]},'note':{'type':Sequelize[_0x6fdf('0x3')]},'read1stAt':{'type':Sequelize[_0x6fdf('0x2')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x6fdf('0x4')]('in',_0x6fdf('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6fdf('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x6fdf('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index c7b22be..177192f 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 _0x3720=['format','YYYY-MM-DD\x20HH:mm:ss','options','include','rows','addTags','setTags','omit','spread','findAll','emit','removeTags','download','unix','join','root','server','files','transcript-%d-%s.zip','Attachment','Messages','mkdirSync','basename','existsSync','pipe','createWriteStream','resolve','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./faxInteraction.socket','register','sendStatus','end','status','json','undefined','count','offset','limit','set','apply','save','then','error','stack','name','Users','map','TagIds','split','forEach','Tags','push','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','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','it.FaxInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','UserId','buildExpression','type','body','some','compact','isEmpty','FaxAccountId','concat','createdAt','parse','$gte','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','role','toString','sequelize','keyBy','merge','FaxInteraction','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.*','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','catch','show','includeAll','create','update','params','destroy','describe','addMessage','ids','findOne','FaxMessage'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x3720,0x1ca));var _0x0372=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x3720[_0xa1e3e3];return _0xc980e9;};'use strict';var emlformat=require(_0x0372('0x0'));var rimraf=require(_0x0372('0x1'));var zipdir=require(_0x0372('0x2'));var jsonpatch=require(_0x0372('0x3'));var rp=require(_0x0372('0x4'));var moment=require(_0x0372('0x5'));var BPromise=require(_0x0372('0x6'));var Mustache=require(_0x0372('0x7'));var util=require(_0x0372('0x8'));var path=require(_0x0372('0x9'));var sox=require(_0x0372('0xa'));var csv=require(_0x0372('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0372('0xc'));var _=require('lodash');var squel=require(_0x0372('0xd'));var crypto=require(_0x0372('0xe'));var jsforce=require(_0x0372('0xf'));var deskjs=require(_0x0372('0x10'));var toCsv=require(_0x0372('0xb'));var querystring=require(_0x0372('0x11'));var Papa=require(_0x0372('0x12'));var Redis=require(_0x0372('0x13'));var authService=require(_0x0372('0x14'));var qs=require(_0x0372('0x15'));var as=require(_0x0372('0x16'));var hardwareService=require(_0x0372('0x17'));var logger=require(_0x0372('0x18'))(_0x0372('0x19'));var utils=require(_0x0372('0x1a'));var config=require(_0x0372('0x1b'));var licenseUtil=require(_0x0372('0x1c'));var db=require(_0x0372('0x1d'))['db'];config[_0x0372('0x1e')]=_[_0x0372('0x1f')](config[_0x0372('0x1e')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0372('0x20'))[_0x0372('0x21')](socket);function respondWithStatusCode(_0x4b2fcc,_0x4310e0){_0x4310e0=_0x4310e0||0xcc;return function(_0x101ce2){if(_0x101ce2){return _0x4b2fcc[_0x0372('0x22')](_0x4310e0);}return _0x4b2fcc['status'](_0x4310e0)[_0x0372('0x23')]();};}function respondWithResult(_0x56a3b2,_0x130364){_0x130364=_0x130364||0xc8;return function(_0x22ee79){if(_0x22ee79){return _0x56a3b2[_0x0372('0x24')](_0x130364)[_0x0372('0x25')](_0x22ee79);}};}function respondWithFilteredResult(_0x3fb5b7,_0x539343){return function(_0x5bc052){if(_0x5bc052){var _0x5a4bb3=typeof _0x539343['offset']===_0x0372('0x26')&&typeof _0x539343['limit']==='undefined';var _0x5efae5=_0x5bc052[_0x0372('0x27')];var _0x1ec299=_0x5a4bb3?0x0:_0x539343[_0x0372('0x28')];var _0x1051d0=_0x5a4bb3?_0x5bc052[_0x0372('0x27')]:_0x539343[_0x0372('0x28')]+_0x539343[_0x0372('0x29')];var _0x559cc9;if(_0x1051d0>=_0x5efae5){_0x1051d0=_0x5efae5;_0x559cc9=0xc8;}else{_0x559cc9=0xce;}_0x3fb5b7[_0x0372('0x24')](_0x559cc9);return _0x3fb5b7[_0x0372('0x2a')]('Content-Range',_0x1ec299+'-'+_0x1051d0+'/'+_0x5efae5)[_0x0372('0x25')](_0x5bc052);}return null;};}function patchUpdates(_0x3ac2d0){return function(_0x4dcb90){try{jsonpatch[_0x0372('0x2b')](_0x4dcb90,_0x3ac2d0,!![]);}catch(_0x34b1c1){return BPromise['reject'](_0x34b1c1);}return _0x4dcb90[_0x0372('0x2c')]();};}function saveUpdates(_0x47249f,_0x2c3076){return function(_0x35ac0c){if(_0x35ac0c){return _0x35ac0c['update'](_0x47249f)['then'](function(_0x3bc6d5){return _0x3bc6d5;});}return null;};}function removeEntity(_0x110381,_0x42ae87){return function(_0x49b848){if(_0x49b848){return _0x49b848['destroy']()[_0x0372('0x2d')](function(){_0x110381['status'](0xcc)[_0x0372('0x23')]();});}};}function handleEntityNotFound(_0x4efd14,_0x53f905){return function(_0x543496){if(!_0x543496){_0x4efd14[_0x0372('0x22')](0x194);}return _0x543496;};}function handleError(_0x43e5b1,_0xff42b4){_0xff42b4=_0xff42b4||0x1f4;return function(_0x32ce1c){logger[_0x0372('0x2e')](_0x32ce1c[_0x0372('0x2f')]);if(_0x32ce1c['name']){delete _0x32ce1c[_0x0372('0x30')];}_0x43e5b1[_0x0372('0x24')](_0xff42b4)['send'](_0x32ce1c);};}function getInteractionUsers(_0x156d7c,_0x35fa76){return new BPromise(function(_0x4f6323,_0x50ef16){try{if(_0x35fa76[_0x156d7c['id']]){_0x156d7c[_0x0372('0x31')]=_[_0x0372('0x32')](_0x35fa76[_0x156d7c['id']],function(_0x2dffe2){return{'id':_0x2dffe2['id'],'fullname':_0x2dffe2['fullname']};});}}catch(_0x2a7c02){_0x50ef16(_0x2a7c02);}_0x4f6323(_0x156d7c);});}function getInteractionTags(_0x30444d,_0x5decb3){return new BPromise(function(_0x11cef3,_0x477d95){try{if(_0x30444d[_0x0372('0x33')]){_0x30444d['Tags']=[];_0x30444d[_0x0372('0x33')][_0x0372('0x34')](',')[_0x0372('0x35')](function(_0x433568){_0x30444d[_0x0372('0x36')][_0x0372('0x37')](_0x5decb3[_0x433568]);});}delete _0x30444d[_0x0372('0x33')];}catch(_0x1de53b){_0x477d95(_0x1de53b);}_0x11cef3(_0x30444d);});}function updateFaxInteraction(_0x61cb07,_0x291e1e,_0x1631ac){return new BPromise(function(_0x4bf622,_0x3a6636){return getInteractionUsers(_0x61cb07,_0x1631ac)[_0x0372('0x2d')](function(_0x52561f){return getInteractionTags(_0x52561f,_0x291e1e);})[_0x0372('0x2d')](function(_0x3c2f33){_0x4bf622(_0x3c2f33);})['catch'](function(_0xc93575){_0x3a6636(_0xc93575);});});}exports['index']=function(_0x4c9f7d,_0x407e73){var _0x316554={},_0x17d5f9={},_0x47c80b={'count':0x0,'rows':[]};var _0x33e6a6=_[_0x0372('0x32')](db['FaxInteraction'][_0x0372('0x38')],function(_0x548716){return{'name':_0x548716[_0x0372('0x39')],'type':_0x548716['type'][_0x0372('0x3a')]};});_0x17d5f9[_0x0372('0x3b')]=_['map'](_0x33e6a6,_0x0372('0x30'));_0x17d5f9['query']=_[_0x0372('0x3c')](_0x4c9f7d[_0x0372('0x3d')]);_0x17d5f9[_0x0372('0x3e')]=_[_0x0372('0x3f')](_0x17d5f9['model'],_0x17d5f9[_0x0372('0x3d')]);_0x316554[_0x0372('0x40')]=_[_0x0372('0x3f')](_0x17d5f9['model'],qs[_0x0372('0x41')](_0x4c9f7d[_0x0372('0x3d')]['fields']));_0x316554[_0x0372('0x40')]=_0x316554['attributes'][_0x0372('0x42')]?_0x316554[_0x0372('0x40')]:_0x17d5f9['model'];if(!_0x4c9f7d[_0x0372('0x3d')]['hasOwnProperty'](_0x0372('0x43'))){_0x316554[_0x0372('0x29')]=qs[_0x0372('0x29')](_0x4c9f7d['query'][_0x0372('0x29')]);_0x316554['offset']=qs[_0x0372('0x28')](_0x4c9f7d['query'][_0x0372('0x28')]);}_0x316554[_0x0372('0x44')]=qs[_0x0372('0x45')](_0x4c9f7d[_0x0372('0x3d')]['sort']);_0x316554[_0x0372('0x46')]=qs[_0x0372('0x3e')](_[_0x0372('0x47')](_0x4c9f7d[_0x0372('0x3d')],_0x17d5f9[_0x0372('0x3e')]),_0x33e6a6);var _0x592f14=[];var _0x569e81=squel[_0x0372('0x48')]()['field']('id')['field'](_0x0372('0x30'))[_0x0372('0x49')](_0x0372('0x4a'))[_0x0372('0x4b')](_0x0372('0x4c'));var _0x385ef6=squel[_0x0372('0x48')]()[_0x0372('0x49')](_0x0372('0x4d'))[_0x0372('0x49')](_0x0372('0x4e'))[_0x0372('0x49')](_0x0372('0x4f'))[_0x0372('0x4b')](_0x0372('0x50'),'ui')[_0x0372('0x51')](_0x0372('0x52'),'u',_0x0372('0x53'));var _0x8f38fd=squel[_0x0372('0x48')]()['from']('fax_interactions','i')[_0x0372('0x51')](_0x0372('0x54'),'c',_0x0372('0x55'))[_0x0372('0x51')]('users','o',_0x0372('0x56'))[_0x0372('0x51')](_0x0372('0x57'),'a',_0x0372('0x58'))[_0x0372('0x51')](_0x0372('0x59'),'me',_0x0372('0x5a'))['left_join'](_0x0372('0x5b'),'it',_0x0372('0x5c'))[_0x0372('0x51')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x5ab659=squel['expr']();var _0x10d2d1=[];var _0xe1a3d7=squel[_0x0372('0x5d')]();var _0x30cbc4;if(_0x4c9f7d[_0x0372('0x3d')][_0x0372('0x5e')]){_0x30cbc4=as[_0x0372('0x5f')](_0x4c9f7d[_0x0372('0x3d')][_0x0372('0x5e')]);var _0x5aac4e=_0x30cbc4[_0x0372('0x60')];for(var _0xa3f2b6=0x0;_0xa3f2b6<_0x30cbc4[_0x0372('0x61')]['length'];_0xa3f2b6++){var _0x4c2740=_0x30cbc4[_0x0372('0x61')][_0xa3f2b6];var _0x24a575='i';var _0x40c4c1=_[_0x0372('0x62')](_0x33e6a6,[_0x0372('0x30'),_0x4c2740[_0x0372('0x49')]]);if(!_0x40c4c1){switch(_0x4c2740[_0x0372('0x49')]){case _0x0372('0x63'):if(_0x4c2740[_0x0372('0x64')]==0x1){_0x8f38fd[_0x0372('0x65')]('`'+_0x4c2740[_0x0372('0x49')]+_0x0372('0x66'));}else{_0x8f38fd[_0x0372('0x65')]('`'+_0x4c2740[_0x0372('0x49')]+_0x0372('0x67'));}break;case _0x0372('0x68'):if(_0x4c2740[_0x0372('0x69')]===_0x0372('0x6a')){if(_0x4c2740['value'][_0x0372('0x34')]('\x20')[_0x0372('0x42')]>0x1){_0x5ab659[_0x5aac4e](_0x0372('0x6b'),qs['getFullTextValue'](_0x4c2740[_0x0372('0x64')]),null);}else{var _0x28d4d5='%'+_0x4c2740['value']+'%';_0x5ab659[_0x5aac4e](_0x0372('0x6c'),_0x28d4d5,_0x28d4d5,_0x28d4d5);}}else{_0x40c4c1=_[_0x0372('0x62')](_0x33e6a6,[_0x0372('0x30'),_0x0372('0x6d')]);_0x4c2740[_0x0372('0x49')]=_0x0372('0x6d');_0x33b9ae=as['buildExpression'](_0x24a575,_0x40c4c1['type'],_0x4c2740);_0x5ab659[_0x5aac4e](_0x33b9ae[_0x0372('0x6e')],_0x33b9ae[_0x0372('0x64')][_0x0372('0x6f')],_0x33b9ae[_0x0372('0x64')][_0x0372('0x23')]);}break;case _0x0372('0x70'):var _0x10d81c=_0x4c2740[_0x0372('0x64')][_0x0372('0x34')](',')['map'](function(_0x84b7f9){return Number(_0x84b7f9);});_0x10d81c['forEach'](function(_0x5ab16c){_0xe1a3d7['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5ab16c+',%');});_0x10d2d1=_['union'](_0x10d2d1,_0x10d81c);break;case'User':if(_0x4c2740['operator']===_0x0372('0x6a')){_0x5ab659[_0x5aac4e]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x4c2740['value']+'%',null);}else{_0x40c4c1=_[_0x0372('0x62')](_0x33e6a6,['name','UserId']);_0x4c2740[_0x0372('0x49')]=_0x0372('0x71');_0x33b9ae=as[_0x0372('0x72')](_0x24a575,_0x40c4c1[_0x0372('0x73')],_0x4c2740);_0x5ab659[_0x5aac4e](_0x33b9ae['text'],_0x33b9ae['value'][_0x0372('0x6f')],_0x33b9ae[_0x0372('0x64')][_0x0372('0x23')]);}break;case _0x0372('0x74'):_0x33b9ae=as[_0x0372('0x72')]('me',null,_0x4c2740);_0x5ab659[_0x5aac4e](_0x33b9ae[_0x0372('0x6e')],_0x33b9ae[_0x0372('0x64')][_0x0372('0x6f')],_0x33b9ae[_0x0372('0x64')][_0x0372('0x23')]);break;}}else{var _0x33b9ae=as[_0x0372('0x72')](_0x24a575,_0x40c4c1[_0x0372('0x73')],_0x4c2740);_0x5ab659[_0x5aac4e](_0x33b9ae['text'],_0x33b9ae[_0x0372('0x64')][_0x0372('0x6f')],_0x33b9ae[_0x0372('0x64')][_0x0372('0x23')]);}}}else{var _0x441832=_(_0x4c9f7d[_0x0372('0x3d')])['keys']()['map'](function(_0xc482c1){return _[_0x0372('0x75')](_0x33e6a6,[_0x0372('0x30'),_0xc482c1])?_0xc482c1:undefined;})[_0x0372('0x76')]()[_0x0372('0x64')]();if(!_[_0x0372('0x77')](_0x441832)){_0x441832[_0x0372('0x35')](function(_0xd7fe5c){if(_0xd7fe5c===_0x0372('0x78')){_0x8f38fd[_0x0372('0x46')]('i.FaxAccountId\x20IN\x20?',[][_0x0372('0x79')](_0x4c9f7d[_0x0372('0x3d')][_0xd7fe5c]));}else if(_0xd7fe5c===_0x0372('0x7a')){var _0x23a4fc=JSON[_0x0372('0x7b')](_0x4c9f7d[_0x0372('0x3d')][_0xd7fe5c])[_0x0372('0x7c')];var _0xcec295=JSON['parse'](_0x4c9f7d[_0x0372('0x3d')][_0xd7fe5c])['$lte'];_0x8f38fd['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x23a4fc,_0xcec295);}else{if(_0x4c9f7d['query'][_0xd7fe5c]===_0x0372('0x7d')){_0x8f38fd[_0x0372('0x46')]('i.'+_0xd7fe5c+_0x0372('0x7e'));}else{_0x8f38fd[_0x0372('0x46')]('i.'+_0xd7fe5c+'\x20=\x20?',_0x4c9f7d[_0x0372('0x3d')][_0xd7fe5c]);}}});}if(_0x4c9f7d[_0x0372('0x3d')][_0x0372('0x7f')]){if(_0x4c9f7d['query']['read']==0x1){_0x8f38fd[_0x0372('0x65')](_0x0372('0x80'));}else{_0x8f38fd['having'](_0x0372('0x81'));}}if(_0x4c9f7d[_0x0372('0x3d')]['tag']){_0x10d2d1=_['isArray'](_0x4c9f7d[_0x0372('0x3d')][_0x0372('0x82')])?_0x4c9f7d[_0x0372('0x3d')][_0x0372('0x82')]:new Array(_0x4c9f7d[_0x0372('0x3d')]['tag']);_0x10d2d1[_0x0372('0x35')](function(_0x37a69d){_0xe1a3d7['or'](_0x0372('0x83'),'%,'+_0x37a69d+',%');});}if(_0x4c9f7d[_0x0372('0x3d')]['filter']){var _0x2dd938=_0x4c9f7d[_0x0372('0x3d')][_0x0372('0x84')]['replace']('\x5c','\x5c\x5c')[_0x0372('0x85')](/'/g,'\x27\x27');if(qs[_0x0372('0x86')](_0x2dd938)){_0x5ab659['or']('i.id\x20LIKE\x20?',_0x2dd938+'%')['or'](_0x0372('0x87'),_0x2dd938+'%');}_0x5ab659['or'](_0x0372('0x88'),_0x2dd938+'%');}}_0x8f38fd[_0x0372('0x46')](_0x5ab659);_0x8f38fd['group'](_0x0372('0x89'));var _0x3b8a35={'type':db[_0x0372('0x8a')]['QueryTypes']['SELECT'],'raw':!![]};var _0x395168=_0x8f38fd['clone']();_0x395168[_0x0372('0x49')](_0x0372('0x89'));_0x395168[_0x0372('0x49')](_0x0372('0x8b'),_0x0372('0x63'));if(_0x316554[_0x0372('0x44')]){_0x316554[_0x0372('0x44')][_0x0372('0x35')](function(_0xb958c5){var _0x5058d2=_0xb958c5[0x0]===_0x0372('0x8c')?_0xb958c5[0x0]:'i.'+_0xb958c5[0x0];_0x8f38fd[_0x0372('0x44')](_0x5058d2,_0xb958c5[0x1]==='DESC'?![]:!![]);});}if(!_[_0x0372('0x77')](_0x10d2d1)){_0x8f38fd[_0x0372('0x65')](_0xe1a3d7);_0x395168[_0x0372('0x46')](_0x0372('0x8d'),_0x10d2d1);}BPromise['resolve']()[_0x0372('0x2d')](function(){if(!_0x30cbc4){if(_0x4c9f7d['query'][_0x0372('0x78')])return;_0x395168[_0x0372('0x46')](_0x0372('0x8e'));_0x8f38fd[_0x0372('0x46')](_0x0372('0x8e'));return;}if(_0x4c9f7d[_0x0372('0x8f')]['role']!==_0x0372('0x90'))return;return _0x4c9f7d['user'][_0x0372('0x91')]({'attributes':['id'],'raw':!![]})[_0x0372('0x2d')](function(_0x2172c3){if(_[_0x0372('0x77')](_0x2172c3)){_0x395168[_0x0372('0x46')](_0x0372('0x92'));_0x8f38fd['where'](_0x0372('0x92'));}else{_0x395168['where'](_0x0372('0x93'),_[_0x0372('0x32')](_0x2172c3,'id'));_0x8f38fd[_0x0372('0x46')]('i.FaxAccountId\x20IN\x20?',_[_0x0372('0x32')](_0x2172c3,'id'));}});})[_0x0372('0x2d')](function(){if(_0x4c9f7d[_0x0372('0x8f')][_0x0372('0x94')]===_0x0372('0x90')&&!_0x30cbc4&&!_0x4c9f7d[_0x0372('0x3d')][_0x0372('0x78')])return[];return db['sequelize']['query'](_0x395168[_0x0372('0x95')](),_0x3b8a35);})[_0x0372('0x2d')](function(_0x377329){_0x47c80b[_0x0372('0x27')]=_0x377329['length'];if(_0x47c80b[_0x0372('0x27')]===0x0)return[];return db[_0x0372('0x96')][_0x0372('0x3d')](_0x569e81[_0x0372('0x95')](),_0x3b8a35)[_0x0372('0x2d')](function(_0x4ce930){_0x592f14=_[_0x0372('0x97')](_0x4ce930,'id');_0x3b8a35=_[_0x0372('0x98')](_0x3b8a35,{'model':db[_0x0372('0x99')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4c9f7d[_0x0372('0x3d')][_0x0372('0x41')]){_0x316554[_0x0372('0x40')][_0x0372('0x35')](function(_0x1971de){_0x8f38fd[_0x0372('0x49')]('i.'+_0x1971de);});}else{_0x8f38fd[_0x0372('0x49')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0372('0x63'));_0x8f38fd[_0x0372('0x49')](_0x0372('0x9a'),_0x0372('0x9b'));_0x8f38fd[_0x0372('0x49')]('a.mandatoryDisposition',_0x0372('0x9c'));_0x8f38fd['field'](_0x0372('0x9d'),_0x0372('0x8c'));_0x8f38fd[_0x0372('0x49')](_0x0372('0x9e'));_0x8f38fd[_0x0372('0x49')]('c.firstName',_0x0372('0x9f'));_0x8f38fd[_0x0372('0x49')]('c.lastName',_0x0372('0xa0'));_0x8f38fd[_0x0372('0x49')](_0x0372('0xa1'),_0x0372('0xa2'));_0x8f38fd[_0x0372('0x49')](_0x0372('0xa3'),_0x0372('0xa4'));_0x8f38fd[_0x0372('0x49')]('c.mobile','Contact.mobile');_0x8f38fd[_0x0372('0x49')]('c.fax',_0x0372('0xa5'));_0x8f38fd['field']('o.fullname','Owner.fullname');_0x8f38fd['field'](_0x0372('0xa6'),_0x0372('0xa7'));_0x8f38fd[_0x0372('0x49')](_0x0372('0xa8'),_0x0372('0x33'));}if(_0x316554[_0x0372('0x29')])_0x8f38fd[_0x0372('0x29')](_0x316554['limit']);if(_0x316554[_0x0372('0x28')])_0x8f38fd['offset'](_0x316554[_0x0372('0x28')]);return db[_0x0372('0x96')][_0x0372('0x3d')](_0x8f38fd[_0x0372('0x95')](),_0x3b8a35);})[_0x0372('0x2d')](function(_0x5ec68e){if(_0x5ec68e['length']>0x0)_0x385ef6[_0x0372('0x46')](_0x0372('0xa9'),_[_0x0372('0x32')](_0x5ec68e,'id'));return db[_0x0372('0x96')][_0x0372('0x3d')](_0x385ef6['toString'](),_0x3b8a35)[_0x0372('0x2d')](function(_0x3b9bb6){var _0x5a0400=_[_0x0372('0xaa')](_0x3b9bb6,_0x0372('0xab'));var _0x4bd323=[];_0x5ec68e[_0x0372('0x35')](function(_0x2eef57){_0x4bd323[_0x0372('0x37')](updateFaxInteraction(_0x2eef57,_0x592f14,_0x5a0400));});return BPromise['all'](_0x4bd323);});});})['then'](function(_0x5954c3){_0x47c80b['rows']=_0x5954c3;return _0x47c80b;})['then'](respondWithFilteredResult(_0x407e73,_0x316554))[_0x0372('0xac')](handleError(_0x407e73,null));};exports[_0x0372('0xad')]=function(_0x1129d9,_0x2a637b){var _0x43d922={'raw':![],'where':{'id':_0x1129d9['params']['id']}},_0x4eaa6e={};_0x4eaa6e[_0x0372('0x3b')]=_['keys'](db[_0x0372('0x99')]['rawAttributes']);_0x4eaa6e[_0x0372('0x3d')]=_[_0x0372('0x3c')](_0x1129d9[_0x0372('0x3d')]);_0x4eaa6e['filters']=_[_0x0372('0x3f')](_0x4eaa6e['model'],_0x4eaa6e[_0x0372('0x3d')]);_0x43d922[_0x0372('0x40')]=_[_0x0372('0x3f')](_0x4eaa6e['model'],qs[_0x0372('0x41')](_0x1129d9[_0x0372('0x3d')][_0x0372('0x41')]));_0x43d922[_0x0372('0x40')]=_0x43d922[_0x0372('0x40')]['length']?_0x43d922['attributes']:_0x4eaa6e[_0x0372('0x3b')];if(_0x1129d9[_0x0372('0x3d')][_0x0372('0xae')]){_0x43d922['include']=[{'all':!![]}];}_0x43d922=_[_0x0372('0x98')]({},_0x43d922,_0x1129d9['options']);return db[_0x0372('0x99')][_0x0372('0x62')](_0x43d922)[_0x0372('0x2d')](handleEntityNotFound(_0x2a637b,null))[_0x0372('0x2d')](respondWithResult(_0x2a637b,null))['catch'](handleError(_0x2a637b,null));};exports[_0x0372('0xaf')]=function(_0x15c420,_0x1acb6a){return db[_0x0372('0x99')][_0x0372('0xaf')](_0x15c420['body'],{})[_0x0372('0x2d')](respondWithResult(_0x1acb6a,0xc9))[_0x0372('0xac')](handleError(_0x1acb6a,null));};exports[_0x0372('0xb0')]=function(_0xad6f05,_0x5b62f5){if(_0xad6f05['body']['id']){delete _0xad6f05[_0x0372('0x74')]['id'];}return db[_0x0372('0x99')][_0x0372('0x62')]({'where':{'id':_0xad6f05[_0x0372('0xb1')]['id']}})[_0x0372('0x2d')](handleEntityNotFound(_0x5b62f5,null))[_0x0372('0x2d')](saveUpdates(_0xad6f05[_0x0372('0x74')],null))[_0x0372('0x2d')](respondWithResult(_0x5b62f5,null))[_0x0372('0xac')](handleError(_0x5b62f5,null));};exports[_0x0372('0xb2')]=function(_0x55aabe,_0x5766f3){return db[_0x0372('0x99')][_0x0372('0x62')]({'where':{'id':_0x55aabe[_0x0372('0xb1')]['id']}})['then'](handleEntityNotFound(_0x5766f3,null))[_0x0372('0x2d')](removeEntity(_0x5766f3,null))[_0x0372('0xac')](handleError(_0x5766f3,null));};exports[_0x0372('0xb3')]=function(_0x3971a8,_0x351d05){return db['FaxInteraction'][_0x0372('0xb3')]()[_0x0372('0x2d')](respondWithResult(_0x351d05,null))[_0x0372('0xac')](handleError(_0x351d05,null));};exports[_0x0372('0xb4')]=function(_0x43d26d,_0x36d755,_0x5b1c0a){return db['FaxMessage'][_0x0372('0x62')]({'where':{'id':_0x43d26d[_0x0372('0xb1')]['id']}})[_0x0372('0x2d')](handleEntityNotFound(_0x36d755,null))['then'](function(_0x285dea){if(_0x285dea){return _0x285dea['addMessage'](_0x43d26d['body'][_0x0372('0xb5')],_['omit'](_0x43d26d[_0x0372('0x74')],[_0x0372('0xb5'),'id'])||{});}})[_0x0372('0x2d')](respondWithResult(_0x36d755,null))[_0x0372('0xac')](handleError(_0x36d755,null));};exports['getMessages']=function(_0x5aa522,_0x2a0719,_0x3db6db){var _0x19c351={'raw':![],'where':{}};var _0x50ede4={};var _0x2dd982={'count':0x0,'rows':[]};return db[_0x0372('0x99')][_0x0372('0xb6')]({'where':{'id':_0x5aa522[_0x0372('0xb1')]['id']}})[_0x0372('0x2d')](handleEntityNotFound(_0x2a0719,null))[_0x0372('0x2d')](function(_0x5f5b3f){if(_0x5f5b3f){_0x50ede4[_0x0372('0x3b')]=_[_0x0372('0x3c')](db[_0x0372('0xb7')][_0x0372('0x38')]);_0x50ede4['query']=_['keys'](_0x5aa522[_0x0372('0x3d')]);_0x50ede4[_0x0372('0x3e')]=_[_0x0372('0x3f')](_0x50ede4[_0x0372('0x3b')],_0x50ede4['query']);_0x19c351[_0x0372('0x40')]=_[_0x0372('0x3f')](_0x50ede4[_0x0372('0x3b')],qs[_0x0372('0x41')](_0x5aa522['query'][_0x0372('0x41')]));_0x19c351['attributes']=_0x19c351[_0x0372('0x40')][_0x0372('0x42')]?_0x19c351['attributes']:_0x50ede4[_0x0372('0x3b')];if(!_0x5aa522['query']['hasOwnProperty'](_0x0372('0x43'))){_0x19c351['limit']=qs[_0x0372('0x29')](_0x5aa522[_0x0372('0x3d')][_0x0372('0x29')]);_0x19c351['offset']=qs[_0x0372('0x28')](_0x5aa522[_0x0372('0x3d')]['offset']);}_0x19c351[_0x0372('0x44')]=qs[_0x0372('0x45')](_0x5aa522[_0x0372('0x3d')][_0x0372('0x45')]);_0x19c351[_0x0372('0x46')]=qs[_0x0372('0x3e')](_[_0x0372('0x47')](_0x5aa522['query'],_0x50ede4[_0x0372('0x3e')]));_0x19c351['where']['FaxInteractionId']=_0x5f5b3f['id'];if(_0x5aa522[_0x0372('0x3d')][_0x0372('0x84')]){_0x19c351[_0x0372('0x46')]=_['merge'](_0x19c351['where'],{'$or':_[_0x0372('0x32')](_0x19c351[_0x0372('0x40')],function(_0xdacfa7){var _0x3cb397={};_0x3cb397[_0xdacfa7]={'$like':'%'+_0x5aa522['query'][_0x0372('0x84')]+'%'};return _0x3cb397;})});}if(_0x5aa522[_0x0372('0x3d')][_0x0372('0x7c')]){var _0x58491d=_0x5aa522['query']['$gte'][_0x0372('0x34')](',');var _0x56c770={};_0x56c770[_0x58491d[0x0]]={'$gte':moment(_0x58491d[0x1])[_0x0372('0xb8')](_0x0372('0xb9'))};_0x19c351[_0x0372('0x46')]=_[_0x0372('0x98')](_0x19c351['where'],_0x56c770);}_0x19c351=_[_0x0372('0x98')]({},_0x19c351,_0x5aa522[_0x0372('0xba')]);return db[_0x0372('0xb7')][_0x0372('0x27')]({'where':_0x19c351[_0x0372('0x46')]})[_0x0372('0x2d')](function(_0xf9754){_0x2dd982[_0x0372('0x27')]=_0xf9754;if(_0x5aa522[_0x0372('0x3d')]['includeAll']){_0x19c351[_0x0372('0xbb')]=[{'all':!![]}];}return db[_0x0372('0xb7')]['findAll'](_0x19c351);})[_0x0372('0x2d')](function(_0x40fc68){_0x2dd982[_0x0372('0xbc')]=_0x40fc68;return _0x2dd982;});}})[_0x0372('0x2d')](respondWithFilteredResult(_0x2a0719,_0x19c351))[_0x0372('0xac')](handleError(_0x2a0719,null));};exports[_0x0372('0xbd')]=function(_0xdbbcc7,_0x50a53c,_0x48d04a){return db[_0x0372('0x99')][_0x0372('0x62')]({'where':{'id':_0xdbbcc7[_0x0372('0xb1')]['id']}})[_0x0372('0x2d')](handleEntityNotFound(_0x50a53c,null))[_0x0372('0x2d')](function(_0x5abbc1){if(_0x5abbc1){return _0x5abbc1[_0x0372('0xbe')](_0xdbbcc7[_0x0372('0x74')][_0x0372('0xb5')],_[_0x0372('0xbf')](_0xdbbcc7[_0x0372('0x74')],['ids','id'])||{})[_0x0372('0xc0')](function(){return db[_0x0372('0x70')][_0x0372('0xc1')]({'attributes':['id',_0x0372('0x30'),_0x0372('0x4a')],'where':{'id':_0xdbbcc7[_0x0372('0x74')][_0x0372('0xb5')]}});})['then'](function(_0x5bd345){socket[_0x0372('0xc2')]('faxInteractionTags:save',{'id':Number(_0xdbbcc7[_0x0372('0xb1')]['id']),'tags':_0x5bd345||[]});return{'id':Number(_0xdbbcc7[_0x0372('0xb1')]['id']),'tags':_0x5bd345||[]};});}})[_0x0372('0x2d')](respondWithResult(_0x50a53c,null))[_0x0372('0xac')](handleError(_0x50a53c,null));};exports[_0x0372('0xc3')]=function(_0x24fc6c,_0x142003,_0x940c43){return db[_0x0372('0x99')][_0x0372('0x62')]({'where':{'id':_0x24fc6c[_0x0372('0xb1')]['id']}})['then'](handleEntityNotFound(_0x142003,null))[_0x0372('0x2d')](function(_0x23ae81){if(_0x23ae81){return _0x23ae81[_0x0372('0xc3')](_0x24fc6c[_0x0372('0x3d')][_0x0372('0xb5')]);}})[_0x0372('0x2d')](respondWithStatusCode(_0x142003,null))[_0x0372('0xac')](handleError(_0x142003,null));};exports[_0x0372('0xc4')]=function(_0x32a5bb,_0x22c69e){var _0x13bf04=moment()[_0x0372('0xc5')]()[_0x0372('0x95')]();var _0x789a34=path[_0x0372('0xc6')](config[_0x0372('0xc7')],_0x0372('0xc8'),_0x0372('0xc9'),'tmp');var _0x3d4538=path[_0x0372('0xc6')](config[_0x0372('0xc7')],_0x0372('0xc8'),_0x0372('0xc9'),'attachments');var _0x49db8d=path[_0x0372('0xc6')](_0x789a34,_0x13bf04);var _0x1ac944=util[_0x0372('0xb8')](_0x0372('0xca'),_0x32a5bb[_0x0372('0xb1')]['id'],_0x13bf04);var _0x47ee47=path[_0x0372('0xc6')](_0x789a34,_0x1ac944);var _0x5c17f5=[];_0x5c17f5[_0x0372('0x37')]({'model':db[_0x0372('0xcb')],'as':_0x0372('0xcb'),'raw':!![]});var _0x48d62a=[{'model':db['FaxMessage'],'as':_0x0372('0xcc'),'attributes':['id',_0x0372('0x74'),_0x0372('0x7a')],'include':_0x5c17f5}];return db['FaxInteraction'][_0x0372('0x62')]({'where':{'id':_0x32a5bb[_0x0372('0xb1')]['id']},'include':_0x48d62a})[_0x0372('0x2d')](handleEntityNotFound(_0x22c69e,null))[_0x0372('0x2d')](function(_0x5814ac){if(_0x5814ac&&_0x5814ac[_0x0372('0xcc')]){var _0x14c950=_0x5814ac['get']({'plain':!![]});fs[_0x0372('0xcd')](_0x49db8d);for(var _0x4dde0c=0x0;_0x4dde0c<_0x14c950[_0x0372('0xcc')][_0x0372('0x42')];_0x4dde0c++){var _0x45aa8c=_0x14c950[_0x0372('0xcc')][_0x4dde0c]['Attachment'];if(_0x45aa8c){var _0x4fc2ab=path['join'](_0x3d4538,_0x45aa8c[_0x0372('0xce')]);if(fs[_0x0372('0xcf')](_0x4fc2ab)){fs['createReadStream'](_0x4fc2ab)[_0x0372('0xd0')](fs[_0x0372('0xd1')](path['join'](_0x49db8d,_0x45aa8c[_0x0372('0xce')])));}}}return BPromise[_0x0372('0xd2')]()[_0x0372('0x2d')](function(){return new BPromise(function(_0x338661,_0xb5bee4){zipdir(_0x49db8d,{'saveTo':_0x47ee47},function(_0x1c4c6a,_0x339dc3){if(_0x1c4c6a)return _0xb5bee4(_0x1c4c6a);return _0x338661(_0x339dc3);});})[_0x0372('0x2d')](function(){return new BPromise(function(_0x5d362b,_0x5d1a8e){rimraf(_0x49db8d,function(_0xf069e0){if(_0xf069e0)_0x5d1a8e(_0xf069e0);return _0x5d362b();});});})[_0x0372('0x2d')](function(){return _0x22c69e[_0x0372('0xc4')](_0x47ee47,_0x1ac944,function(_0x240824){if(_0x240824){console[_0x0372('0xd3')](_0x0372('0xd4'),_0x240824);}else{fs[_0x0372('0xd5')](_0x47ee47);}});});});}else{return _0x22c69e['sendStatus'](0xc8);}})[_0x0372('0xac')](handleError(_0x22c69e,null));}; \ No newline at end of file +var _0x73ef=['bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','destroy','stack','name','Users','fullname','TagIds','split','forEach','Tags','index','map','FaxInteraction','rawAttributes','type','key','query','keys','filters','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','field','tools_tags','select','u.id','ui.FaxInteractionId','from','user_has_fax_interactions','users','u.id\x20=\x20ui.UserId','fax_interactions','left_join','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','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','unreadMessages','value','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?','find','ContactId','buildExpression','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?','UserId','some','isEmpty','concat','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','contactName','t.id\x20IN\x20?','resolve','FaxAccountId','i.FaxAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','FaxInteractionId','all','rows','catch','show','params','intersection','options','create','body','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','pick','$gte','format','YYYY-MM-DD\x20HH:mm:ss','setTags','spread','color','faxInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','Attachment','Messages','get','mkdirSync','existsSync','createReadStream','createWriteStream','basename','log','err','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x3e8b98,_0x36f504){var _0x53a413=function(_0x479152){while(--_0x479152){_0x3e8b98['push'](_0x3e8b98['shift']());}};_0x53a413(++_0x36f504);}(_0x73ef,0x1a0));var _0xf73e=function(_0x906d2e,_0x54a52f){_0x906d2e=_0x906d2e-0x0;var _0x2903f9=_0x73ef[_0x906d2e];return _0x2903f9;};'use strict';var emlformat=require(_0xf73e('0x0'));var rimraf=require(_0xf73e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf73e('0x2'));var rp=require(_0xf73e('0x3'));var moment=require('moment');var BPromise=require(_0xf73e('0x4'));var Mustache=require(_0xf73e('0x5'));var util=require('util');var path=require(_0xf73e('0x6'));var sox=require('sox');var csv=require(_0xf73e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf73e('0x8'));var _=require(_0xf73e('0x9'));var squel=require(_0xf73e('0xa'));var crypto=require(_0xf73e('0xb'));var jsforce=require(_0xf73e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf73e('0x7'));var querystring=require(_0xf73e('0xd'));var Papa=require('papaparse');var Redis=require(_0xf73e('0xe'));var authService=require(_0xf73e('0xf'));var qs=require(_0xf73e('0x10'));var as=require(_0xf73e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf73e('0x12'))(_0xf73e('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf73e('0x14'));var db=require(_0xf73e('0x15'))['db'];config['redis']=_[_0xf73e('0x16')](config[_0xf73e('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xf73e('0x18'))(new Redis(config[_0xf73e('0x17')]));require(_0xf73e('0x19'))[_0xf73e('0x1a')](socket);function respondWithStatusCode(_0xa7630b,_0x4cca6d){_0x4cca6d=_0x4cca6d||0xcc;return function(_0x4dae05){if(_0x4dae05){return _0xa7630b[_0xf73e('0x1b')](_0x4cca6d);}return _0xa7630b[_0xf73e('0x1c')](_0x4cca6d)[_0xf73e('0x1d')]();};}function respondWithResult(_0xc3f900,_0x374b45){_0x374b45=_0x374b45||0xc8;return function(_0x4c0b9e){if(_0x4c0b9e){return _0xc3f900['status'](_0x374b45)[_0xf73e('0x1e')](_0x4c0b9e);}};}function respondWithFilteredResult(_0x39fdb8,_0x7c9cdc){return function(_0x38ee3e){if(_0x38ee3e){var _0x5ba1e4=typeof _0x7c9cdc[_0xf73e('0x1f')]===_0xf73e('0x20')&&typeof _0x7c9cdc['limit']===_0xf73e('0x20');var _0x2ec9ea=_0x38ee3e[_0xf73e('0x21')];var _0x2d189f=_0x5ba1e4?0x0:_0x7c9cdc[_0xf73e('0x1f')];var _0x24aa8d=_0x5ba1e4?_0x38ee3e[_0xf73e('0x21')]:_0x7c9cdc['offset']+_0x7c9cdc[_0xf73e('0x22')];var _0x37e50d;if(_0x24aa8d>=_0x2ec9ea){_0x24aa8d=_0x2ec9ea;_0x37e50d=0xc8;}else{_0x37e50d=0xce;}_0x39fdb8[_0xf73e('0x1c')](_0x37e50d);return _0x39fdb8[_0xf73e('0x23')](_0xf73e('0x24'),_0x2d189f+'-'+_0x24aa8d+'/'+_0x2ec9ea)[_0xf73e('0x1e')](_0x38ee3e);}return null;};}function patchUpdates(_0x53314d){return function(_0x29dec1){try{jsonpatch[_0xf73e('0x25')](_0x29dec1,_0x53314d,!![]);}catch(_0x3ea0bd){return BPromise['reject'](_0x3ea0bd);}return _0x29dec1['save']();};}function saveUpdates(_0x3174e9,_0x33f011){return function(_0x29f34b){if(_0x29f34b){return _0x29f34b[_0xf73e('0x26')](_0x3174e9)[_0xf73e('0x27')](function(_0x3b7384){return _0x3b7384;});}return null;};}function removeEntity(_0x590602,_0x54844a){return function(_0x1916f5){if(_0x1916f5){return _0x1916f5[_0xf73e('0x28')]()['then'](function(){_0x590602[_0xf73e('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x248401,_0x4a1b9f){return function(_0x4f598e){if(!_0x4f598e){_0x248401[_0xf73e('0x1b')](0x194);}return _0x4f598e;};}function handleError(_0x1ad0a1,_0x5e179e){_0x5e179e=_0x5e179e||0x1f4;return function(_0x259e80){logger['error'](_0x259e80[_0xf73e('0x29')]);if(_0x259e80[_0xf73e('0x2a')]){delete _0x259e80[_0xf73e('0x2a')];}_0x1ad0a1[_0xf73e('0x1c')](_0x5e179e)['send'](_0x259e80);};}function getInteractionUsers(_0x51b21c,_0x367318){return new BPromise(function(_0x1e09d4,_0x33424e){try{if(_0x367318[_0x51b21c['id']]){_0x51b21c[_0xf73e('0x2b')]=_['map'](_0x367318[_0x51b21c['id']],function(_0x191ec0){return{'id':_0x191ec0['id'],'fullname':_0x191ec0[_0xf73e('0x2c')]};});}}catch(_0x3f9410){_0x33424e(_0x3f9410);}_0x1e09d4(_0x51b21c);});}function getInteractionTags(_0x23d07b,_0x5ade39){return new BPromise(function(_0x575f95,_0x1cba04){try{if(_0x23d07b[_0xf73e('0x2d')]){_0x23d07b['Tags']=[];_0x23d07b['TagIds'][_0xf73e('0x2e')](',')[_0xf73e('0x2f')](function(_0x39f65f){_0x23d07b[_0xf73e('0x30')]['push'](_0x5ade39[_0x39f65f]);});}delete _0x23d07b['TagIds'];}catch(_0x1cc193){_0x1cba04(_0x1cc193);}_0x575f95(_0x23d07b);});}function updateFaxInteraction(_0x127b13,_0x29f642,_0x2fe4f6){return new BPromise(function(_0x2ab247,_0x2894fe){return getInteractionUsers(_0x127b13,_0x2fe4f6)[_0xf73e('0x27')](function(_0x34dbee){return getInteractionTags(_0x34dbee,_0x29f642);})[_0xf73e('0x27')](function(_0x543271){_0x2ab247(_0x543271);})['catch'](function(_0x2811d4){_0x2894fe(_0x2811d4);});});}exports[_0xf73e('0x31')]=function(_0x4ad292,_0x35d02b){var _0x598195={},_0x21c1d0={},_0x535eaf={'count':0x0,'rows':[]};var _0x1b958c=_[_0xf73e('0x32')](db[_0xf73e('0x33')][_0xf73e('0x34')],function(_0x3c6297){return{'name':_0x3c6297['fieldName'],'type':_0x3c6297[_0xf73e('0x35')][_0xf73e('0x36')]};});_0x21c1d0['model']=_[_0xf73e('0x32')](_0x1b958c,_0xf73e('0x2a'));_0x21c1d0[_0xf73e('0x37')]=_[_0xf73e('0x38')](_0x4ad292[_0xf73e('0x37')]);_0x21c1d0[_0xf73e('0x39')]=_['intersection'](_0x21c1d0[_0xf73e('0x3a')],_0x21c1d0['query']);_0x598195['attributes']=_['intersection'](_0x21c1d0[_0xf73e('0x3a')],qs[_0xf73e('0x3b')](_0x4ad292[_0xf73e('0x37')][_0xf73e('0x3b')]));_0x598195['attributes']=_0x598195[_0xf73e('0x3c')][_0xf73e('0x3d')]?_0x598195['attributes']:_0x21c1d0[_0xf73e('0x3a')];if(!_0x4ad292[_0xf73e('0x37')][_0xf73e('0x3e')](_0xf73e('0x3f'))){_0x598195[_0xf73e('0x22')]=qs[_0xf73e('0x22')](_0x4ad292[_0xf73e('0x37')][_0xf73e('0x22')]);_0x598195[_0xf73e('0x1f')]=qs[_0xf73e('0x1f')](_0x4ad292[_0xf73e('0x37')][_0xf73e('0x1f')]);}_0x598195[_0xf73e('0x40')]=qs[_0xf73e('0x41')](_0x4ad292[_0xf73e('0x37')]['sort']);_0x598195[_0xf73e('0x42')]=qs[_0xf73e('0x39')](_['pick'](_0x4ad292[_0xf73e('0x37')],_0x21c1d0[_0xf73e('0x39')]),_0x1b958c);var _0x50ab92=[];var _0x53bc07=squel['select']()[_0xf73e('0x43')]('id')['field'](_0xf73e('0x2a'))[_0xf73e('0x43')]('color')['from'](_0xf73e('0x44'));var _0x4f35c3=squel[_0xf73e('0x45')]()['field'](_0xf73e('0x46'))[_0xf73e('0x43')]('u.fullname')[_0xf73e('0x43')](_0xf73e('0x47'))[_0xf73e('0x48')](_0xf73e('0x49'),'ui')['left_join'](_0xf73e('0x4a'),'u',_0xf73e('0x4b'));var _0x362938=squel['select']()['from'](_0xf73e('0x4c'),'i')[_0xf73e('0x4d')]('cm_contacts','c',_0xf73e('0x4e'))[_0xf73e('0x4d')](_0xf73e('0x4a'),'o',_0xf73e('0x4f'))[_0xf73e('0x4d')](_0xf73e('0x50'),'a',_0xf73e('0x51'))['left_join'](_0xf73e('0x52'),'me',_0xf73e('0x53'))[_0xf73e('0x4d')](_0xf73e('0x54'),'it',_0xf73e('0x55'))[_0xf73e('0x4d')](_0xf73e('0x44'),'t',_0xf73e('0x56'));var _0x4cbfbe=squel['expr']();var _0x22b087=[];var _0x4c6b03=squel[_0xf73e('0x57')]();var _0x3051af;if(_0x4ad292[_0xf73e('0x37')]['search']){_0x3051af=as[_0xf73e('0x58')](_0x4ad292[_0xf73e('0x37')][_0xf73e('0x59')]);var _0xce9447=_0x3051af[_0xf73e('0x5a')];for(var _0x338131=0x0;_0x338131<_0x3051af[_0xf73e('0x5b')][_0xf73e('0x3d')];_0x338131++){var _0x1f2e44=_0x3051af[_0xf73e('0x5b')][_0x338131];var _0x190618='i';var _0xc20eb9=_['find'](_0x1b958c,[_0xf73e('0x2a'),_0x1f2e44[_0xf73e('0x43')]]);if(!_0xc20eb9){switch(_0x1f2e44[_0xf73e('0x43')]){case _0xf73e('0x5c'):if(_0x1f2e44[_0xf73e('0x5d')]==0x1){_0x362938[_0xf73e('0x5e')]('`'+_0x1f2e44[_0xf73e('0x43')]+'`\x20=\x200');}else{_0x362938[_0xf73e('0x5e')]('`'+_0x1f2e44[_0xf73e('0x43')]+'`\x20>\x200');}break;case _0xf73e('0x5f'):if(_0x1f2e44[_0xf73e('0x60')]===_0xf73e('0x61')){if(_0x1f2e44['value'][_0xf73e('0x2e')]('\x20')['length']>0x1){_0x4cbfbe[_0xce9447](_0xf73e('0x62'),qs['getFullTextValue'](_0x1f2e44[_0xf73e('0x5d')]),null);}else{var _0x27d379='%'+_0x1f2e44['value']+'%';_0x4cbfbe[_0xce9447](_0xf73e('0x63'),_0x27d379,_0x27d379,_0x27d379);}}else{_0xc20eb9=_[_0xf73e('0x64')](_0x1b958c,['name','ContactId']);_0x1f2e44[_0xf73e('0x43')]=_0xf73e('0x65');_0x33f4e0=as[_0xf73e('0x66')](_0x190618,_0xc20eb9[_0xf73e('0x35')],_0x1f2e44);_0x4cbfbe[_0xce9447](_0x33f4e0[_0xf73e('0x67')],_0x33f4e0[_0xf73e('0x5d')][_0xf73e('0x68')],_0x33f4e0['value']['end']);}break;case _0xf73e('0x69'):var _0x484f0a=_0x1f2e44[_0xf73e('0x5d')]['split'](',')['map'](function(_0x5e3a08){return Number(_0x5e3a08);});_0x484f0a[_0xf73e('0x2f')](function(_0x2ff304){_0x4c6b03['or'](_0xf73e('0x6a'),'%,'+_0x2ff304+',%');});_0x22b087=_[_0xf73e('0x6b')](_0x22b087,_0x484f0a);break;case _0xf73e('0x6c'):if(_0x1f2e44[_0xf73e('0x60')]===_0xf73e('0x61')){_0x4cbfbe[_0xce9447](_0xf73e('0x6d'),'%'+_0x1f2e44[_0xf73e('0x5d')]+'%',null);}else{_0xc20eb9=_[_0xf73e('0x64')](_0x1b958c,[_0xf73e('0x2a'),_0xf73e('0x6e')]);_0x1f2e44[_0xf73e('0x43')]=_0xf73e('0x6e');_0x33f4e0=as[_0xf73e('0x66')](_0x190618,_0xc20eb9[_0xf73e('0x35')],_0x1f2e44);_0x4cbfbe[_0xce9447](_0x33f4e0['text'],_0x33f4e0['value'][_0xf73e('0x68')],_0x33f4e0[_0xf73e('0x5d')][_0xf73e('0x1d')]);}break;case'body':_0x33f4e0=as['buildExpression']('me',null,_0x1f2e44);_0x4cbfbe[_0xce9447](_0x33f4e0[_0xf73e('0x67')],_0x33f4e0['value'][_0xf73e('0x68')],_0x33f4e0['value']['end']);break;}}else{var _0x33f4e0=as[_0xf73e('0x66')](_0x190618,_0xc20eb9['type'],_0x1f2e44);_0x4cbfbe[_0xce9447](_0x33f4e0[_0xf73e('0x67')],_0x33f4e0[_0xf73e('0x5d')][_0xf73e('0x68')],_0x33f4e0[_0xf73e('0x5d')][_0xf73e('0x1d')]);}}}else{var _0x407114=_(_0x4ad292['query'])[_0xf73e('0x38')]()[_0xf73e('0x32')](function(_0x195ef7){return _[_0xf73e('0x6f')](_0x1b958c,[_0xf73e('0x2a'),_0x195ef7])?_0x195ef7:undefined;})['compact']()[_0xf73e('0x5d')]();if(!_[_0xf73e('0x70')](_0x407114)){_0x407114[_0xf73e('0x2f')](function(_0x2c2a4e){if(_0x2c2a4e==='FaxAccountId'){_0x362938[_0xf73e('0x42')]('i.FaxAccountId\x20IN\x20?',[][_0xf73e('0x71')](_0x4ad292['query'][_0x2c2a4e]));}else if(_0x2c2a4e===_0xf73e('0x72')){var _0xcb29db=JSON['parse'](_0x4ad292[_0xf73e('0x37')][_0x2c2a4e])['$gte'];var _0x5a30c6=JSON[_0xf73e('0x73')](_0x4ad292[_0xf73e('0x37')][_0x2c2a4e])['$lte'];_0x362938[_0xf73e('0x42')](_0xf73e('0x74'),_0xcb29db,_0x5a30c6);}else{if(_0x4ad292['query'][_0x2c2a4e]===_0xf73e('0x75')){_0x362938[_0xf73e('0x42')]('i.'+_0x2c2a4e+'\x20IS\x20NULL');}else{_0x362938[_0xf73e('0x42')]('i.'+_0x2c2a4e+_0xf73e('0x76'),_0x4ad292[_0xf73e('0x37')][_0x2c2a4e]);}}});}if(_0x4ad292['query'][_0xf73e('0x77')]){if(_0x4ad292['query'][_0xf73e('0x77')]==0x1){_0x362938[_0xf73e('0x5e')]('`unreadMessages`\x20=\x200');}else{_0x362938[_0xf73e('0x5e')]('`unreadMessages`\x20>\x200');}}if(_0x4ad292[_0xf73e('0x37')][_0xf73e('0x78')]){_0x22b087=_[_0xf73e('0x79')](_0x4ad292['query'][_0xf73e('0x78')])?_0x4ad292[_0xf73e('0x37')]['tag']:new Array(_0x4ad292[_0xf73e('0x37')][_0xf73e('0x78')]);_0x22b087['forEach'](function(_0x22b130){_0x4c6b03['or'](_0xf73e('0x6a'),'%,'+_0x22b130+',%');});}if(_0x4ad292[_0xf73e('0x37')]['filter']){var _0x1a8eaf=_0x4ad292['query'][_0xf73e('0x7a')][_0xf73e('0x7b')]('\x5c','\x5c\x5c')[_0xf73e('0x7b')](/'/g,'\x27\x27');if(qs[_0xf73e('0x7c')](_0x1a8eaf)){_0x4cbfbe['or'](_0xf73e('0x7d'),_0x1a8eaf+'%')['or']('i.fax\x20LIKE\x20?',_0x1a8eaf+'%');}_0x4cbfbe['or'](_0xf73e('0x7e'),_0x1a8eaf+'%');}}_0x362938['where'](_0x4cbfbe);_0x362938[_0xf73e('0x7f')](_0xf73e('0x80'));var _0x1438a0={'type':db[_0xf73e('0x81')]['QueryTypes'][_0xf73e('0x82')],'raw':!![]};var _0x4050d3=_0x362938[_0xf73e('0x83')]();_0x4050d3[_0xf73e('0x43')](_0xf73e('0x80'));_0x4050d3[_0xf73e('0x43')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xf73e('0x5c'));if(_0x598195[_0xf73e('0x40')]){_0x598195[_0xf73e('0x40')][_0xf73e('0x2f')](function(_0x218eac){var _0x41defe=_0x218eac[0x0]===_0xf73e('0x84')?_0x218eac[0x0]:'i.'+_0x218eac[0x0];_0x362938[_0xf73e('0x40')](_0x41defe,_0x218eac[0x1]==='DESC'?![]:!![]);});}if(!_[_0xf73e('0x70')](_0x22b087)){_0x362938[_0xf73e('0x5e')](_0x4c6b03);_0x4050d3[_0xf73e('0x42')](_0xf73e('0x85'),_0x22b087);}BPromise[_0xf73e('0x86')]()[_0xf73e('0x27')](function(){if(!_0x3051af){if(_0x4ad292[_0xf73e('0x37')][_0xf73e('0x87')])return;_0x4050d3[_0xf73e('0x42')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x362938['where'](_0xf73e('0x88'));return;}if(_0x4ad292['user'][_0xf73e('0x89')]!==_0xf73e('0x8a'))return;return _0x4ad292[_0xf73e('0x8b')][_0xf73e('0x8c')]({'attributes':['id'],'raw':!![]})['then'](function(_0x43e0b1){if(_[_0xf73e('0x70')](_0x43e0b1)){_0x4050d3[_0xf73e('0x42')]('i.FaxAccountId\x20IS\x20NULL');_0x362938['where'](_0xf73e('0x8d'));}else{_0x4050d3[_0xf73e('0x42')](_0xf73e('0x8e'),_[_0xf73e('0x32')](_0x43e0b1,'id'));_0x362938['where'](_0xf73e('0x8e'),_[_0xf73e('0x32')](_0x43e0b1,'id'));}});})[_0xf73e('0x27')](function(){if(_0x4ad292['user'][_0xf73e('0x89')]===_0xf73e('0x8a')&&!_0x3051af&&!_0x4ad292[_0xf73e('0x37')][_0xf73e('0x87')])return[];return db[_0xf73e('0x8f')][_0xf73e('0x37')](_0x4050d3[_0xf73e('0x90')](),_0x1438a0);})['then'](function(_0x4f85b0){_0x535eaf[_0xf73e('0x21')]=_0x4f85b0[_0xf73e('0x3d')];if(_0x535eaf[_0xf73e('0x21')]===0x0)return[];return db[_0xf73e('0x8f')][_0xf73e('0x37')](_0x53bc07['toString'](),_0x1438a0)[_0xf73e('0x27')](function(_0x2fa9cb){_0x50ab92=_[_0xf73e('0x91')](_0x2fa9cb,'id');_0x1438a0=_[_0xf73e('0x92')](_0x1438a0,{'model':db[_0xf73e('0x33')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4ad292[_0xf73e('0x37')][_0xf73e('0x3b')]){_0x598195[_0xf73e('0x3c')][_0xf73e('0x2f')](function(_0x376a7f){_0x362938[_0xf73e('0x43')]('i.'+_0x376a7f);});}else{_0x362938['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xf73e('0x5c'));_0x362938[_0xf73e('0x43')](_0xf73e('0x93'),_0xf73e('0x94'));_0x362938[_0xf73e('0x43')](_0xf73e('0x95'),_0xf73e('0x96'));_0x362938['field'](_0xf73e('0x97'),_0xf73e('0x84'));_0x362938[_0xf73e('0x43')](_0xf73e('0x98'));_0x362938['field'](_0xf73e('0x99'),_0xf73e('0x9a'));_0x362938[_0xf73e('0x43')](_0xf73e('0x9b'),_0xf73e('0x9c'));_0x362938[_0xf73e('0x43')](_0xf73e('0x9d'),_0xf73e('0x9e'));_0x362938[_0xf73e('0x43')]('c.phone',_0xf73e('0x9f'));_0x362938[_0xf73e('0x43')](_0xf73e('0xa0'),_0xf73e('0xa1'));_0x362938['field']('c.fax','Contact.fax');_0x362938['field'](_0xf73e('0xa2'),_0xf73e('0xa3'));_0x362938[_0xf73e('0x43')](_0xf73e('0xa4'),'Owner.internal');_0x362938[_0xf73e('0x43')](_0xf73e('0xa5'),_0xf73e('0x2d'));}if(_0x598195[_0xf73e('0x22')])_0x362938['limit'](_0x598195[_0xf73e('0x22')]);if(_0x598195[_0xf73e('0x1f')])_0x362938['offset'](_0x598195[_0xf73e('0x1f')]);return db[_0xf73e('0x8f')][_0xf73e('0x37')](_0x362938[_0xf73e('0x90')](),_0x1438a0);})[_0xf73e('0x27')](function(_0x25b439){if(_0x25b439[_0xf73e('0x3d')]>0x0)_0x4f35c3[_0xf73e('0x42')]('ui.FaxInteractionId\x20IN\x20?',_[_0xf73e('0x32')](_0x25b439,'id'));return db[_0xf73e('0x8f')][_0xf73e('0x37')](_0x4f35c3[_0xf73e('0x90')](),_0x1438a0)[_0xf73e('0x27')](function(_0x118264){var _0x1f6fb0=_[_0xf73e('0xa6')](_0x118264,_0xf73e('0xa7'));var _0x20b63b=[];_0x25b439[_0xf73e('0x2f')](function(_0x213d63){_0x20b63b['push'](updateFaxInteraction(_0x213d63,_0x50ab92,_0x1f6fb0));});return BPromise[_0xf73e('0xa8')](_0x20b63b);});});})[_0xf73e('0x27')](function(_0x4e42ed){_0x535eaf[_0xf73e('0xa9')]=_0x4e42ed;return _0x535eaf;})['then'](respondWithFilteredResult(_0x35d02b,_0x598195))[_0xf73e('0xaa')](handleError(_0x35d02b,null));};exports[_0xf73e('0xab')]=function(_0x4e0ade,_0x6cae36){var _0x23d4e1={'raw':![],'where':{'id':_0x4e0ade[_0xf73e('0xac')]['id']}},_0x4ce01a={};_0x4ce01a[_0xf73e('0x3a')]=_[_0xf73e('0x38')](db['FaxInteraction'][_0xf73e('0x34')]);_0x4ce01a[_0xf73e('0x37')]=_[_0xf73e('0x38')](_0x4e0ade[_0xf73e('0x37')]);_0x4ce01a[_0xf73e('0x39')]=_['intersection'](_0x4ce01a[_0xf73e('0x3a')],_0x4ce01a['query']);_0x23d4e1[_0xf73e('0x3c')]=_[_0xf73e('0xad')](_0x4ce01a['model'],qs['fields'](_0x4e0ade[_0xf73e('0x37')][_0xf73e('0x3b')]));_0x23d4e1['attributes']=_0x23d4e1[_0xf73e('0x3c')]['length']?_0x23d4e1[_0xf73e('0x3c')]:_0x4ce01a[_0xf73e('0x3a')];if(_0x4e0ade[_0xf73e('0x37')]['includeAll']){_0x23d4e1['include']=[{'all':!![]}];}_0x23d4e1=_[_0xf73e('0x92')]({},_0x23d4e1,_0x4e0ade[_0xf73e('0xae')]);return db[_0xf73e('0x33')][_0xf73e('0x64')](_0x23d4e1)[_0xf73e('0x27')](handleEntityNotFound(_0x6cae36,null))[_0xf73e('0x27')](respondWithResult(_0x6cae36,null))[_0xf73e('0xaa')](handleError(_0x6cae36,null));};exports[_0xf73e('0xaf')]=function(_0x8eb518,_0x4c840b){return db[_0xf73e('0x33')][_0xf73e('0xaf')](_0x8eb518[_0xf73e('0xb0')],{})[_0xf73e('0x27')](respondWithResult(_0x4c840b,0xc9))[_0xf73e('0xaa')](handleError(_0x4c840b,null));};exports['update']=function(_0x5d6d07,_0x5db45a){if(_0x5d6d07[_0xf73e('0xb0')]['id']){delete _0x5d6d07[_0xf73e('0xb0')]['id'];}return db[_0xf73e('0x33')][_0xf73e('0x64')]({'where':{'id':_0x5d6d07[_0xf73e('0xac')]['id']}})[_0xf73e('0x27')](handleEntityNotFound(_0x5db45a,null))[_0xf73e('0x27')](saveUpdates(_0x5d6d07[_0xf73e('0xb0')],null))[_0xf73e('0x27')](respondWithResult(_0x5db45a,null))[_0xf73e('0xaa')](handleError(_0x5db45a,null));};exports[_0xf73e('0x28')]=function(_0x280fa8,_0x528264){return db[_0xf73e('0x33')][_0xf73e('0x64')]({'where':{'id':_0x280fa8[_0xf73e('0xac')]['id']}})['then'](handleEntityNotFound(_0x528264,null))['then'](removeEntity(_0x528264,null))[_0xf73e('0xaa')](handleError(_0x528264,null));};exports[_0xf73e('0xb1')]=function(_0x222f40,_0x1d7ec9){return db[_0xf73e('0x33')][_0xf73e('0xb1')]()[_0xf73e('0x27')](respondWithResult(_0x1d7ec9,null))[_0xf73e('0xaa')](handleError(_0x1d7ec9,null));};exports[_0xf73e('0xb2')]=function(_0x1b04ec,_0x3d377b,_0x58cc5c){return db[_0xf73e('0xb3')][_0xf73e('0x64')]({'where':{'id':_0x1b04ec[_0xf73e('0xac')]['id']}})[_0xf73e('0x27')](handleEntityNotFound(_0x3d377b,null))[_0xf73e('0x27')](function(_0x3b5f1c){if(_0x3b5f1c){return _0x3b5f1c[_0xf73e('0xb2')](_0x1b04ec['body'][_0xf73e('0xb4')],_[_0xf73e('0xb5')](_0x1b04ec[_0xf73e('0xb0')],[_0xf73e('0xb4'),'id'])||{});}})[_0xf73e('0x27')](respondWithResult(_0x3d377b,null))['catch'](handleError(_0x3d377b,null));};exports[_0xf73e('0xb6')]=function(_0x45b9c8,_0x3139dc,_0x1b8155){var _0x4e2774={'raw':![],'where':{}};var _0x1f6dd0={};var _0x2e76c5={'count':0x0,'rows':[]};return db[_0xf73e('0x33')][_0xf73e('0xb7')]({'where':{'id':_0x45b9c8[_0xf73e('0xac')]['id']}})[_0xf73e('0x27')](handleEntityNotFound(_0x3139dc,null))['then'](function(_0x385964){if(_0x385964){_0x1f6dd0[_0xf73e('0x3a')]=_[_0xf73e('0x38')](db[_0xf73e('0xb3')][_0xf73e('0x34')]);_0x1f6dd0['query']=_[_0xf73e('0x38')](_0x45b9c8[_0xf73e('0x37')]);_0x1f6dd0[_0xf73e('0x39')]=_[_0xf73e('0xad')](_0x1f6dd0[_0xf73e('0x3a')],_0x1f6dd0[_0xf73e('0x37')]);_0x4e2774['attributes']=_[_0xf73e('0xad')](_0x1f6dd0[_0xf73e('0x3a')],qs[_0xf73e('0x3b')](_0x45b9c8[_0xf73e('0x37')][_0xf73e('0x3b')]));_0x4e2774[_0xf73e('0x3c')]=_0x4e2774[_0xf73e('0x3c')][_0xf73e('0x3d')]?_0x4e2774[_0xf73e('0x3c')]:_0x1f6dd0[_0xf73e('0x3a')];if(!_0x45b9c8['query'][_0xf73e('0x3e')](_0xf73e('0x3f'))){_0x4e2774['limit']=qs[_0xf73e('0x22')](_0x45b9c8[_0xf73e('0x37')][_0xf73e('0x22')]);_0x4e2774[_0xf73e('0x1f')]=qs['offset'](_0x45b9c8[_0xf73e('0x37')][_0xf73e('0x1f')]);}_0x4e2774[_0xf73e('0x40')]=qs['sort'](_0x45b9c8[_0xf73e('0x37')][_0xf73e('0x41')]);_0x4e2774[_0xf73e('0x42')]=qs[_0xf73e('0x39')](_[_0xf73e('0xb8')](_0x45b9c8['query'],_0x1f6dd0[_0xf73e('0x39')]));_0x4e2774['where']['FaxInteractionId']=_0x385964['id'];if(_0x45b9c8[_0xf73e('0x37')]['filter']){_0x4e2774[_0xf73e('0x42')]=_['merge'](_0x4e2774[_0xf73e('0x42')],{'$or':_[_0xf73e('0x32')](_0x4e2774['attributes'],function(_0x48815d){var _0x334cd1={};_0x334cd1[_0x48815d]={'$like':'%'+_0x45b9c8[_0xf73e('0x37')]['filter']+'%'};return _0x334cd1;})});}if(_0x45b9c8['query'][_0xf73e('0xb9')]){var _0xac2046=_0x45b9c8[_0xf73e('0x37')][_0xf73e('0xb9')][_0xf73e('0x2e')](',');var _0x185f73={};_0x185f73[_0xac2046[0x0]]={'$gte':moment(_0xac2046[0x1])[_0xf73e('0xba')](_0xf73e('0xbb'))};_0x4e2774['where']=_['merge'](_0x4e2774['where'],_0x185f73);}_0x4e2774=_[_0xf73e('0x92')]({},_0x4e2774,_0x45b9c8[_0xf73e('0xae')]);return db[_0xf73e('0xb3')][_0xf73e('0x21')]({'where':_0x4e2774[_0xf73e('0x42')]})['then'](function(_0x33aeb7){_0x2e76c5[_0xf73e('0x21')]=_0x33aeb7;if(_0x45b9c8['query']['includeAll']){_0x4e2774['include']=[{'all':!![]}];}return db[_0xf73e('0xb3')]['findAll'](_0x4e2774);})[_0xf73e('0x27')](function(_0x2c0a47){_0x2e76c5[_0xf73e('0xa9')]=_0x2c0a47;return _0x2e76c5;});}})[_0xf73e('0x27')](respondWithFilteredResult(_0x3139dc,_0x4e2774))[_0xf73e('0xaa')](handleError(_0x3139dc,null));};exports['addTags']=function(_0x375256,_0x59d105,_0x2c1937){return db[_0xf73e('0x33')][_0xf73e('0x64')]({'where':{'id':_0x375256[_0xf73e('0xac')]['id']}})['then'](handleEntityNotFound(_0x59d105,null))['then'](function(_0x4c35db){if(_0x4c35db){return _0x4c35db[_0xf73e('0xbc')](_0x375256[_0xf73e('0xb0')][_0xf73e('0xb4')],_['omit'](_0x375256[_0xf73e('0xb0')],[_0xf73e('0xb4'),'id'])||{})[_0xf73e('0xbd')](function(){return db[_0xf73e('0x69')]['findAll']({'attributes':['id','name',_0xf73e('0xbe')],'where':{'id':_0x375256[_0xf73e('0xb0')]['ids']}});})[_0xf73e('0x27')](function(_0x30d186){socket['emit'](_0xf73e('0xbf'),{'id':Number(_0x375256[_0xf73e('0xac')]['id']),'tags':_0x30d186||[]});return{'id':Number(_0x375256[_0xf73e('0xac')]['id']),'tags':_0x30d186||[]};});}})[_0xf73e('0x27')](respondWithResult(_0x59d105,null))[_0xf73e('0xaa')](handleError(_0x59d105,null));};exports[_0xf73e('0xc0')]=function(_0x7be3ab,_0x5dd6e8,_0x3fd090){return db[_0xf73e('0x33')][_0xf73e('0x64')]({'where':{'id':_0x7be3ab[_0xf73e('0xac')]['id']}})[_0xf73e('0x27')](handleEntityNotFound(_0x5dd6e8,null))['then'](function(_0x3f77ad){if(_0x3f77ad){return _0x3f77ad[_0xf73e('0xc0')](_0x7be3ab[_0xf73e('0x37')][_0xf73e('0xb4')]);}})['then'](respondWithStatusCode(_0x5dd6e8,null))['catch'](handleError(_0x5dd6e8,null));};exports[_0xf73e('0xc1')]=function(_0xd973ca,_0x238a9c){var _0x52382c=moment()[_0xf73e('0xc2')]()[_0xf73e('0x90')]();var _0x4ca473=path[_0xf73e('0xc3')](config[_0xf73e('0xc4')],_0xf73e('0xc5'),_0xf73e('0xc6'),_0xf73e('0xc7'));var _0x270a66=path[_0xf73e('0xc3')](config['root'],_0xf73e('0xc5'),_0xf73e('0xc6'),'attachments');var _0x4a36dc=path[_0xf73e('0xc3')](_0x4ca473,_0x52382c);var _0x30b1f1=util[_0xf73e('0xba')]('transcript-%d-%s.zip',_0xd973ca[_0xf73e('0xac')]['id'],_0x52382c);var _0x2cc222=path['join'](_0x4ca473,_0x30b1f1);var _0x3da47d=[];_0x3da47d['push']({'model':db[_0xf73e('0xc8')],'as':'Attachment','raw':!![]});var _0x30b9d4=[{'model':db[_0xf73e('0xb3')],'as':_0xf73e('0xc9'),'attributes':['id',_0xf73e('0xb0'),'createdAt'],'include':_0x3da47d}];return db['FaxInteraction']['find']({'where':{'id':_0xd973ca[_0xf73e('0xac')]['id']},'include':_0x30b9d4})[_0xf73e('0x27')](handleEntityNotFound(_0x238a9c,null))[_0xf73e('0x27')](function(_0x52aed6){if(_0x52aed6&&_0x52aed6[_0xf73e('0xc9')]){var _0x5a5bbf=_0x52aed6[_0xf73e('0xca')]({'plain':!![]});fs[_0xf73e('0xcb')](_0x4a36dc);for(var _0x100f52=0x0;_0x100f52<_0x5a5bbf[_0xf73e('0xc9')][_0xf73e('0x3d')];_0x100f52++){var _0xe56782=_0x5a5bbf[_0xf73e('0xc9')][_0x100f52][_0xf73e('0xc8')];if(_0xe56782){var _0x3d87fc=path[_0xf73e('0xc3')](_0x270a66,_0xe56782['basename']);if(fs[_0xf73e('0xcc')](_0x3d87fc)){fs[_0xf73e('0xcd')](_0x3d87fc)['pipe'](fs[_0xf73e('0xce')](path[_0xf73e('0xc3')](_0x4a36dc,_0xe56782[_0xf73e('0xcf')])));}}}return BPromise[_0xf73e('0x86')]()[_0xf73e('0x27')](function(){return new BPromise(function(_0x13d13f,_0x3511e2){zipdir(_0x4a36dc,{'saveTo':_0x2cc222},function(_0x23e172,_0x37afcc){if(_0x23e172)return _0x3511e2(_0x23e172);return _0x13d13f(_0x37afcc);});})['then'](function(){return new BPromise(function(_0x588bd0,_0x390c48){rimraf(_0x4a36dc,function(_0x2bf15f){if(_0x2bf15f)_0x390c48(_0x2bf15f);return _0x588bd0();});});})[_0xf73e('0x27')](function(){return _0x238a9c[_0xf73e('0xc1')](_0x2cc222,_0x30b1f1,function(_0x208ea7){if(_0x208ea7){console[_0xf73e('0xd0')](_0xf73e('0xd1'),_0x208ea7);}else{fs['unlinkSync'](_0x2cc222);}});});});}else{return _0x238a9c[_0xf73e('0x1b')](0xc8);}})['catch'](handleError(_0x238a9c,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 4ed8a6b..ec9def0 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 _0x89d4=['exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','remove','then','setDataValue','Users','unreadMessages','length','emit','catch','hasOwnProperty','hook'];(function(_0x3dd0b9,_0x1d6c92){var _0x4c0351=function(_0x2cf6a8){while(--_0x2cf6a8){_0x3dd0b9['push'](_0x3dd0b9['shift']());}};_0x4c0351(++_0x1d6c92);}(_0x89d4,0x1e1));var _0x489d=function(_0x235482,_0x14b833){_0x235482=_0x235482-0x0;var _0x5f5bea=_0x89d4[_0x235482];return _0x5f5bea;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x489d('0x0'))['db'][_0x489d('0x1')];var FaxMessage=require(_0x489d('0x0'))['db'][_0x489d('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x489d('0x3')](0x0);var events={'afterCreate':_0x489d('0x4'),'afterUpdate':'update','afterDestroy':_0x489d('0x5')};function emitEvent(_0x509322){return function(_0x2667af,_0x4fd180,_0x398cae){_0x2667af['getUsers']({'attributes':['id'],'raw':!![]})[_0x489d('0x6')](function(_0x898e20){_0x2667af[_0x489d('0x7')](_0x489d('0x8'),_0x898e20['map'](function(_0x24d6a8){return{'id':_0x24d6a8['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x2667af['id'],'direction':'in','read':![]},'raw':!![]});})[_0x489d('0x6')](function(_0x4c7ccf){_0x2667af[_0x489d('0x7')](_0x489d('0x9'),_0x4c7ccf[_0x489d('0xa')]);FaxInteractionEvents[_0x489d('0xb')](_0x509322+':'+_0x2667af['id'],_0x2667af);FaxInteractionEvents['emit'](_0x509322,_0x2667af);_0x398cae(null);})[_0x489d('0xc')](_0x398cae(null));};}for(var e in events){if(events[_0x489d('0xd')](e)){var event=events[e];FaxInteraction[_0x489d('0xe')](e,emitEvent(event));}}module[_0x489d('0xf')]=FaxInteractionEvents; \ No newline at end of file +var _0xace3=['getUsers','then','setDataValue','Users','map','unreadMessages','emit','catch','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','update'];(function(_0x45b49a,_0x16c879){var _0x338f2e=function(_0x3c324c){while(--_0x3c324c){_0x45b49a['push'](_0x45b49a['shift']());}};_0x338f2e(++_0x16c879);}(_0xace3,0x1e6));var _0x3ace=function(_0x549e33,_0x180d3a){_0x549e33=_0x549e33-0x0;var _0x449adb=_0xace3[_0x549e33];return _0x449adb;};'use strict';var EventEmitter=require(_0x3ace('0x0'));var FaxInteraction=require(_0x3ace('0x1'))['db']['FaxInteraction'];var FaxMessage=require(_0x3ace('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x3ace('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3ace('0x3'),'afterDestroy':'remove'};function emitEvent(_0x28eeae){return function(_0x1ebf0c,_0x4dd252,_0x17a179){_0x1ebf0c[_0x3ace('0x4')]({'attributes':['id'],'raw':!![]})[_0x3ace('0x5')](function(_0x341860){_0x1ebf0c[_0x3ace('0x6')](_0x3ace('0x7'),_0x341860[_0x3ace('0x8')](function(_0x390200){return{'id':_0x390200['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x1ebf0c['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x38402e){_0x1ebf0c[_0x3ace('0x6')](_0x3ace('0x9'),_0x38402e['length']);FaxInteractionEvents[_0x3ace('0xa')](_0x28eeae+':'+_0x1ebf0c['id'],_0x1ebf0c);FaxInteractionEvents[_0x3ace('0xa')](_0x28eeae,_0x1ebf0c);_0x17a179(null);})[_0x3ace('0xb')](_0x17a179(null));};}for(var e in events){if(events[_0x3ace('0xc')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x3ace('0xd')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 6e6e2da..f791128 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 _0x8742=['./faxInteraction.attributes','exports','FaxInteraction','fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment'];(function(_0x5c02a8,_0x323419){var _0x157ea7=function(_0x1e99ea){while(--_0x1e99ea){_0x5c02a8['push'](_0x5c02a8['shift']());}};_0x157ea7(++_0x323419);}(_0x8742,0xe9));var _0x2874=function(_0x105c50,_0x29ba3e){_0x105c50=_0x105c50-0x0;var _0x570327=_0x8742[_0x105c50];return _0x570327;};'use strict';var _=require(_0x2874('0x0'));var util=require(_0x2874('0x1'));var logger=require(_0x2874('0x2'))('api');var moment=require(_0x2874('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2874('0x4'));var rimraf=require(_0x2874('0x5'));var config=require(_0x2874('0x6'));var attributes=require(_0x2874('0x7'));module[_0x2874('0x8')]=function(_0x28fdb7,_0xb3ba8){return _0x28fdb7['define'](_0x2874('0x9'),attributes,{'tableName':_0x2874('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x56730c,_0x317517,_0x23f55b){if(_0x56730c[_0x2874('0xb')](_0x2874('0xc'))){_0x56730c[_0x2874('0xd')]=moment()[_0x2874('0xe')](_0x2874('0xf'));}_0x23f55b(null,_0x56730c);}}});}; \ No newline at end of file +var _0xab54=['format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','path','exports','define','fax_interactions'];(function(_0x3aebe1,_0x4eb7af){var _0x34791d=function(_0x4465fc){while(--_0x4465fc){_0x3aebe1['push'](_0x3aebe1['shift']());}};_0x34791d(++_0x4eb7af);}(_0xab54,0x115));var _0x4ab5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xab54[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x4ab5('0x0'));var logger=require(_0x4ab5('0x1'))(_0x4ab5('0x2'));var moment=require(_0x4ab5('0x3'));var BPromise=require(_0x4ab5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4ab5('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxInteraction.attributes');module[_0x4ab5('0x6')]=function(_0x2a1a6a,_0x5f1b80){return _0x2a1a6a[_0x4ab5('0x7')]('FaxInteraction',attributes,{'tableName':_0x4ab5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x600112,_0xd57886,_0x3aef7c){if(_0x600112['changed']('closed')){_0x600112['closedAt']=moment()[_0x4ab5('0x9')](_0x4ab5('0xa'));}_0x3aef7c(null,_0x600112);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 88bfd99..6aec5d7 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 _0xf1ab=['find','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','where','attributes','AddTagsToFaxInteraction'];(function(_0x10a353,_0x4a85fb){var _0x52d01f=function(_0x5eb8d8){while(--_0x5eb8d8){_0x10a353['push'](_0x10a353['shift']());}};_0x52d01f(++_0x4a85fb);}(_0xf1ab,0xa9));var _0xbf1a=function(_0x3a6523,_0x5b012d){_0x3a6523=_0x3a6523-0x0;var _0x12a982=_0xf1ab[_0x3a6523];return _0x12a982;};'use strict';var _=require(_0xbf1a('0x0'));var util=require(_0xbf1a('0x1'));var moment=require(_0xbf1a('0x2'));var BPromise=require(_0xbf1a('0x3'));var rs=require(_0xbf1a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbf1a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbf1a('0x6'));var config=require(_0xbf1a('0x7'));var jayson=require(_0xbf1a('0x8'));var client=jayson[_0xbf1a('0x9')][_0xbf1a('0xa')]({'port':0x232a});config[_0xbf1a('0xb')]=_[_0xbf1a('0xc')](config[_0xbf1a('0xb')],{'host':_0xbf1a('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbf1a('0xb')]));require(_0xbf1a('0xe'))[_0xbf1a('0xf')](socket);function respondWithRpcPromise(_0x50ad52,_0x174231,_0xcf4b34){return new BPromise(function(_0x4d9f56,_0x4482bb){return client[_0xbf1a('0x10')](_0x50ad52,_0xcf4b34)[_0xbf1a('0x11')](function(_0xfcd0e6){logger[_0xbf1a('0x12')](_0xbf1a('0x13'),_0x174231,_0xbf1a('0x14'));logger[_0xbf1a('0x15')](_0xbf1a('0x16'),_0x174231,_0xbf1a('0x14'),JSON[_0xbf1a('0x17')](_0xfcd0e6));if(_0xfcd0e6[_0xbf1a('0x18')]){if(_0xfcd0e6['error'][_0xbf1a('0x19')]===0x1f4){logger[_0xbf1a('0x18')](_0xbf1a('0x13'),_0x174231,_0xfcd0e6[_0xbf1a('0x18')][_0xbf1a('0x1a')]);return _0x4482bb(_0xfcd0e6[_0xbf1a('0x18')][_0xbf1a('0x1a')]);}logger[_0xbf1a('0x18')]('FaxInteraction,\x20%s,\x20%s',_0x174231,_0xfcd0e6['error'][_0xbf1a('0x1a')]);return _0x4d9f56(_0xfcd0e6[_0xbf1a('0x18')][_0xbf1a('0x1a')]);}else{logger[_0xbf1a('0x12')](_0xbf1a('0x13'),_0x174231,_0xbf1a('0x14'));_0x4d9f56(_0xfcd0e6['result'][_0xbf1a('0x1a')]);}})[_0xbf1a('0x1b')](function(_0x1a8d6a){logger['error'](_0xbf1a('0x13'),_0x174231,_0x1a8d6a);_0x4482bb(_0x1a8d6a);});});}exports[_0xbf1a('0x1c')]=function(_0x404eda){var _0x466b2e=this;return new Promise(function(_0x18c713,_0x3dd7fa){return db[_0xbf1a('0x1d')][_0xbf1a('0x1e')](_0x404eda[_0xbf1a('0x1f')],{'raw':_0x404eda[_0xbf1a('0x20')]?_0x404eda[_0xbf1a('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x404eda[_0xbf1a('0x20')]?_0x404eda[_0xbf1a('0x20')][_0xbf1a('0x21')]||null:null,'attributes':_0x404eda[_0xbf1a('0x20')]?_0x404eda[_0xbf1a('0x20')][_0xbf1a('0x22')]||null:null,'limit':_0x404eda[_0xbf1a('0x20')]?_0x404eda[_0xbf1a('0x20')]['limit']||null:null})[_0xbf1a('0x11')](function(_0x5b9315){logger[_0xbf1a('0x12')](_0xbf1a('0x1c'),_0x404eda);logger[_0xbf1a('0x15')](_0xbf1a('0x1c'),_0x404eda,JSON[_0xbf1a('0x17')](_0x5b9315));_0x18c713(_0x5b9315);})[_0xbf1a('0x1b')](function(_0xc0c6c8){logger[_0xbf1a('0x18')](_0xbf1a('0x1c'),_0xc0c6c8[_0xbf1a('0x1a')],_0x404eda);_0x3dd7fa(_0x466b2e['error'](0x1f4,_0xc0c6c8['message']));});});};exports[_0xbf1a('0x23')]=function(_0x59feae){return new Promise(function(_0x29ff1b,_0x1aa2eb){return db[_0xbf1a('0x1d')][_0xbf1a('0x24')]({'where':_0x59feae['options']?_0x59feae[_0xbf1a('0x20')]['where']||null:null})[_0xbf1a('0x11')](function(_0x5958f4){if(_0x5958f4){return _0x5958f4[_0xbf1a('0x25')](_0x59feae[_0xbf1a('0x1f')][_0xbf1a('0x26')],_['omit'](_0x59feae[_0xbf1a('0x1f')],[_0xbf1a('0x26'),'id'])||{});}})[_0xbf1a('0x27')](function(_0x44b92a){logger[_0xbf1a('0x12')](_0xbf1a('0x28'),_0x59feae);logger[_0xbf1a('0x15')](_0xbf1a('0x28'),_0x59feae,JSON[_0xbf1a('0x17')](_0x44b92a));_0x29ff1b(_0x44b92a);})[_0xbf1a('0x1b')](function(_0x36f1d3){logger[_0xbf1a('0x18')](_0xbf1a('0x28'),_0x36f1d3['message'],_0x59feae);_0x1aa2eb(_this[_0xbf1a('0x18')](0x1f4,_0x36f1d3[_0xbf1a('0x1a')]));});});}; \ No newline at end of file +var _0xa085=['socket.io-emitter','register','request','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','limit','debug','AddTagsToFaxInteraction','find','addTags','ids','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','jayson/promise','http','redis','localhost'];(function(_0x3e3f27,_0x2c2ecf){var _0x15c868=function(_0x4b348d){while(--_0x4b348d){_0x3e3f27['push'](_0x3e3f27['shift']());}};_0x15c868(++_0x2c2ecf);}(_0xa085,0x1ad));var _0x5a08=function(_0x265133,_0x4f78ad){_0x265133=_0x265133-0x0;var _0x514f86=_0xa085[_0x265133];return _0x514f86;};'use strict';var _=require(_0x5a08('0x0'));var util=require(_0x5a08('0x1'));var moment=require(_0x5a08('0x2'));var BPromise=require('bluebird');var rs=require(_0x5a08('0x3'));var fs=require('fs');var Redis=require(_0x5a08('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5a08('0x5'));var logger=require('../../config/logger')(_0x5a08('0x6'));var config=require('../../config/environment');var jayson=require(_0x5a08('0x7'));var client=jayson['client'][_0x5a08('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0x5a08('0x9')],{'host':_0x5a08('0xa'),'port':0x18eb});var socket=require(_0x5a08('0xb'))(new Redis(config[_0x5a08('0x9')]));require('./faxInteraction.socket')[_0x5a08('0xc')](socket);function respondWithRpcPromise(_0x438bc5,_0x27e5dc,_0x4a93da){return new BPromise(function(_0x370a05,_0x36f242){return client[_0x5a08('0xd')](_0x438bc5,_0x4a93da)[_0x5a08('0xe')](function(_0x3eef6e){logger['info'](_0x5a08('0xf'),_0x27e5dc,_0x5a08('0x10'));logger['debug'](_0x5a08('0x11'),_0x27e5dc,_0x5a08('0x10'),JSON[_0x5a08('0x12')](_0x3eef6e));if(_0x3eef6e['error']){if(_0x3eef6e[_0x5a08('0x13')]['code']===0x1f4){logger[_0x5a08('0x13')](_0x5a08('0xf'),_0x27e5dc,_0x3eef6e['error'][_0x5a08('0x14')]);return _0x36f242(_0x3eef6e[_0x5a08('0x13')]['message']);}logger[_0x5a08('0x13')](_0x5a08('0xf'),_0x27e5dc,_0x3eef6e['error'][_0x5a08('0x14')]);return _0x370a05(_0x3eef6e[_0x5a08('0x13')][_0x5a08('0x14')]);}else{logger[_0x5a08('0x15')](_0x5a08('0xf'),_0x27e5dc,_0x5a08('0x10'));_0x370a05(_0x3eef6e[_0x5a08('0x16')][_0x5a08('0x14')]);}})[_0x5a08('0x17')](function(_0x379a1e){logger[_0x5a08('0x13')](_0x5a08('0xf'),_0x27e5dc,_0x379a1e);_0x36f242(_0x379a1e);});});}exports[_0x5a08('0x18')]=function(_0x12ad58){var _0x1af7ec=this;return new Promise(function(_0x13d103,_0x36f4b2){return db[_0x5a08('0x19')][_0x5a08('0x1a')](_0x12ad58[_0x5a08('0x1b')],{'raw':_0x12ad58[_0x5a08('0x1c')]?_0x12ad58[_0x5a08('0x1c')][_0x5a08('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12ad58['options']?_0x12ad58[_0x5a08('0x1c')][_0x5a08('0x1e')]||null:null,'attributes':_0x12ad58['options']?_0x12ad58[_0x5a08('0x1c')][_0x5a08('0x1f')]||null:null,'limit':_0x12ad58[_0x5a08('0x1c')]?_0x12ad58['options'][_0x5a08('0x20')]||null:null})['then'](function(_0x546bad){logger['info'](_0x5a08('0x18'),_0x12ad58);logger[_0x5a08('0x21')](_0x5a08('0x18'),_0x12ad58,JSON[_0x5a08('0x12')](_0x546bad));_0x13d103(_0x546bad);})[_0x5a08('0x17')](function(_0x1a9e4c){logger[_0x5a08('0x13')](_0x5a08('0x18'),_0x1a9e4c[_0x5a08('0x14')],_0x12ad58);_0x36f4b2(_0x1af7ec[_0x5a08('0x13')](0x1f4,_0x1a9e4c['message']));});});};exports[_0x5a08('0x22')]=function(_0x21121e){return new Promise(function(_0x39b46c,_0x4d6919){return db[_0x5a08('0x19')][_0x5a08('0x23')]({'where':_0x21121e[_0x5a08('0x1c')]?_0x21121e[_0x5a08('0x1c')][_0x5a08('0x1e')]||null:null})[_0x5a08('0xe')](function(_0x40dcf8){if(_0x40dcf8){return _0x40dcf8[_0x5a08('0x24')](_0x21121e[_0x5a08('0x1b')][_0x5a08('0x25')],_['omit'](_0x21121e[_0x5a08('0x1b')],['ids','id'])||{});}})[_0x5a08('0x26')](function(_0x353903){logger[_0x5a08('0x15')](_0x5a08('0x27'),_0x21121e);logger[_0x5a08('0x21')](_0x5a08('0x27'),_0x21121e,JSON[_0x5a08('0x12')](_0x353903));_0x39b46c(_0x353903);})['catch'](function(_0x40c6e5){logger['error']('AddTags',_0x40c6e5['message'],_0x21121e);_0x4d6919(_this[_0x5a08('0x13')](0x1f4,_0x40c6e5['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 9506652..73bf21e 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 _0xd10e=['update','removeListener','register','length','faxInteraction:','./faxInteraction.events','save'];(function(_0x3bd111,_0x368984){var _0x45f678=function(_0x471477){while(--_0x471477){_0x3bd111['push'](_0x3bd111['shift']());}};_0x45f678(++_0x368984);}(_0xd10e,0x10f));var _0xed10=function(_0x34325b,_0x5e5afe){_0x34325b=_0x34325b-0x0;var _0x3da348=_0xd10e[_0x34325b];return _0x3da348;};'use strict';var FaxInteractionEvents=require(_0xed10('0x0'));var events=[_0xed10('0x1'),'remove',_0xed10('0x2')];function createListener(_0x474135,_0x5f5b7a){return function(_0x16bf5d){_0x5f5b7a['emit'](_0x474135,_0x16bf5d);};}function removeListener(_0x5754fa,_0x14ccce){return function(){FaxInteractionEvents[_0xed10('0x3')](_0x5754fa,_0x14ccce);};}exports[_0xed10('0x4')]=function(_0x3a49d6){for(var _0x33d4f1=0x0,_0x2a79f9=events[_0xed10('0x5')];_0x33d4f1<_0x2a79f9;_0x33d4f1++){var _0x5f5285=events[_0x33d4f1];var _0x423827=createListener(_0xed10('0x6')+_0x5f5285,_0x3a49d6);FaxInteractionEvents['on'](_0x5f5285,_0x423827);}}; \ No newline at end of file +var _0x8450=['update','emit','removeListener','register','length','faxInteraction:','./faxInteraction.events','save','remove'];(function(_0x426604,_0x58ac40){var _0x55396d=function(_0x20b85a){while(--_0x20b85a){_0x426604['push'](_0x426604['shift']());}};_0x55396d(++_0x58ac40);}(_0x8450,0x177));var _0x0845=function(_0x1b7ac8,_0x549d64){_0x1b7ac8=_0x1b7ac8-0x0;var _0xc2e13c=_0x8450[_0x1b7ac8];return _0xc2e13c;};'use strict';var FaxInteractionEvents=require(_0x0845('0x0'));var events=[_0x0845('0x1'),_0x0845('0x2'),_0x0845('0x3')];function createListener(_0x11954c,_0x28ad89){return function(_0xfa5f53){_0x28ad89[_0x0845('0x4')](_0x11954c,_0xfa5f53);};}function removeListener(_0xbcd000,_0x594891){return function(){FaxInteractionEvents[_0x0845('0x5')](_0xbcd000,_0x594891);};}exports[_0x0845('0x6')]=function(_0x1ef2dd){for(var _0x1d04e7=0x0,_0x1fb1ed=events[_0x0845('0x7')];_0x1d04e7<_0x1fb1ed;_0x1d04e7++){var _0x8bcb50=events[_0x1d04e7];var _0x31b59c=createListener(_0x0845('0x8')+_0x8bcb50,_0x1ef2dd);FaxInteractionEvents['on'](_0x8bcb50,_0x31b59c);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 9723160..6c53725 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 _0xcbef=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','isAuthenticated','get','/describe','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','faxinteraction:addtags','addTags','put','/:id','faxinteraction:update','update','fax','faxinteraction:destroy','destroy','removeTags','util','path','connect-timeout','express'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xcbef,0x78));var _0xfcbe=function(_0x241de8,_0x24c165){_0x241de8=_0x241de8-0x0;var _0x19fb75=_0xcbef[_0x241de8];return _0x19fb75;};'use strict';var multer=require('multer');var util=require(_0xfcbe('0x0'));var path=require(_0xfcbe('0x1'));var timeout=require(_0xfcbe('0x2'));var express=require(_0xfcbe('0x3'));var router=express[_0xfcbe('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xfcbe('0x5'));var interaction=require(_0xfcbe('0x6'));var config=require(_0xfcbe('0x7'));var controller=require(_0xfcbe('0x8'));router['get']('/',auth[_0xfcbe('0x9')](),controller['index']);router[_0xfcbe('0xa')](_0xfcbe('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xfcbe('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xfcbe('0xa')](_0xfcbe('0xc'),auth['isAuthenticated'](),controller[_0xfcbe('0xd')]);router[_0xfcbe('0xa')](_0xfcbe('0xe'),auth['isAuthenticated'](),controller[_0xfcbe('0xf')]);router[_0xfcbe('0x10')]('/',auth[_0xfcbe('0x9')](),controller[_0xfcbe('0x11')]);router[_0xfcbe('0x10')](_0xfcbe('0xc'),auth[_0xfcbe('0x9')](),controller[_0xfcbe('0x12')]);router['post'](_0xfcbe('0x13'),auth['isAuthenticated'](),interaction[_0xfcbe('0x14')]('fax',_0xfcbe('0x15')),controller[_0xfcbe('0x16')]);router[_0xfcbe('0x17')](_0xfcbe('0x18'),auth[_0xfcbe('0x9')](),interaction['tracked']('fax',_0xfcbe('0x19')),controller[_0xfcbe('0x1a')]);router['delete']('/:id',auth[_0xfcbe('0x9')](),interaction[_0xfcbe('0x14')](_0xfcbe('0x1b'),_0xfcbe('0x1c')),controller[_0xfcbe('0x1d')]);router['delete'](_0xfcbe('0x13'),auth['isAuthenticated'](),controller[_0xfcbe('0x1e')]);module['exports']=router; \ No newline at end of file +var _0xbc3a=['create','addMessage','/:id/tags','tracked','faxinteraction:addtags','addTags','put','fax','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./faxInteraction.controller','get','isAuthenticated','index','describe','/:id','show','/:id/messages','getMessages','post'];(function(_0x3625d6,_0x57f4c4){var _0x8df4d8=function(_0x7ba668){while(--_0x7ba668){_0x3625d6['push'](_0x3625d6['shift']());}};_0x8df4d8(++_0x57f4c4);}(_0xbc3a,0xb4));var _0xabc3=function(_0x40a251,_0x4bd160){_0x40a251=_0x40a251-0x0;var _0x445b41=_0xbc3a[_0x40a251];return _0x445b41;};'use strict';var multer=require(_0xabc3('0x0'));var util=require(_0xabc3('0x1'));var path=require(_0xabc3('0x2'));var timeout=require(_0xabc3('0x3'));var express=require(_0xabc3('0x4'));var router=express[_0xabc3('0x5')]();var fs_extra=require(_0xabc3('0x6'));var auth=require(_0xabc3('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xabc3('0x8'));router[_0xabc3('0x9')]('/',auth[_0xabc3('0xa')](),controller[_0xabc3('0xb')]);router['get']('/describe',auth[_0xabc3('0xa')](),controller[_0xabc3('0xc')]);router[_0xabc3('0x9')](_0xabc3('0xd'),auth[_0xabc3('0xa')](),controller[_0xabc3('0xe')]);router[_0xabc3('0x9')](_0xabc3('0xf'),auth[_0xabc3('0xa')](),controller[_0xabc3('0x10')]);router[_0xabc3('0x9')]('/:id/download',auth[_0xabc3('0xa')](),controller['download']);router[_0xabc3('0x11')]('/',auth[_0xabc3('0xa')](),controller[_0xabc3('0x12')]);router[_0xabc3('0x11')](_0xabc3('0xf'),auth[_0xabc3('0xa')](),controller[_0xabc3('0x13')]);router[_0xabc3('0x11')](_0xabc3('0x14'),auth[_0xabc3('0xa')](),interaction[_0xabc3('0x15')]('fax',_0xabc3('0x16')),controller[_0xabc3('0x17')]);router[_0xabc3('0x18')](_0xabc3('0xd'),auth[_0xabc3('0xa')](),interaction[_0xabc3('0x15')](_0xabc3('0x19'),_0xabc3('0x1a')),controller[_0xabc3('0x1b')]);router[_0xabc3('0x1c')](_0xabc3('0xd'),auth[_0xabc3('0xa')](),interaction['tracked']('fax',_0xabc3('0x1d')),controller[_0xabc3('0x1e')]);router[_0xabc3('0x1c')](_0xabc3('0x14'),auth[_0xabc3('0xa')](),controller[_0xabc3('0x1f')]);module[_0xabc3('0x20')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 2ab8cc5..51b9150 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 _0x56e6=['ENUM','out','DATE','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x5280e6,_0x4121c6){var _0x3c8d3e=function(_0x313fb2){while(--_0x313fb2){_0x5280e6['push'](_0x5280e6['shift']());}};_0x3c8d3e(++_0x4121c6);}(_0x56e6,0x6b));var _0x656e=function(_0x5e4fdc,_0x183475){_0x5e4fdc=_0x5e4fdc-0x0;var _0xe2d401=_0x56e6[_0x5e4fdc];return _0xe2d401;};'use strict';var Sequelize=require(_0x656e('0x0'));module[_0x656e('0x1')]={'body':{'type':Sequelize[_0x656e('0x2')](_0x656e('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x656e('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x656e('0x5')]('in','out'),'defaultValue':_0x656e('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x656e('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x656e('0x7')]}}; \ No newline at end of file +var _0x4876=['TEXT','ENUM','out','DATE'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x4876,0x84));var _0x6487=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4876[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x6487('0x0')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x6487('0x1')]('in','out'),'defaultValue':_0x6487('0x2'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x6487('0x0')],'defaultValue':null},'readAt':{'type':Sequelize[_0x6487('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 8ada178..729b8ee 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 _0x43a6=['readAt','format','UserId','agent','FaxInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','User','fullname','internal','manual','interface','channel','EventManager','acceptmessage','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','Sequelize','contact','event','rejectmessage','create','CmContact','findOne','Attachment','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download','join','root','server','files','attachments','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./faxMessage.socket','jayson/promise','client','http','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','end','stack','name','send','index','FaxMessage','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','include','rows','show','rawAttributes','find','body','params','destroy','describe','fax-interactions','accept','fax','read'];(function(_0xd8c6d,_0x21aeaa){var _0x42c38f=function(_0x1e1c8f){while(--_0x1e1c8f){_0xd8c6d['push'](_0xd8c6d['shift']());}};_0x42c38f(++_0x21aeaa);}(_0x43a6,0x148));var _0x643a=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0x43a6[_0x9fd887];return _0x1a54ab;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x643a('0x0'));var zipdir=require(_0x643a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x643a('0x2'));var moment=require(_0x643a('0x3'));var BPromise=require(_0x643a('0x4'));var Mustache=require('mustache');var util=require(_0x643a('0x5'));var path=require('path');var sox=require(_0x643a('0x6'));var csv=require(_0x643a('0x7'));var ejs=require(_0x643a('0x8'));var fs=require('fs');var fs_extra=require(_0x643a('0x9'));var _=require(_0x643a('0xa'));var squel=require(_0x643a('0xb'));var crypto=require(_0x643a('0xc'));var jsforce=require(_0x643a('0xd'));var deskjs=require(_0x643a('0xe'));var toCsv=require(_0x643a('0x7'));var querystring=require(_0x643a('0xf'));var Papa=require(_0x643a('0x10'));var Redis=require(_0x643a('0x11'));var authService=require(_0x643a('0x12'));var qs=require(_0x643a('0x13'));var as=require(_0x643a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x643a('0x15'))('api');var utils=require(_0x643a('0x16'));var config=require(_0x643a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x643a('0x18'))['db'];config[_0x643a('0x19')]=_[_0x643a('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x643a('0x19')]));require(_0x643a('0x1b'))['register'](socket);var jayson=require(_0x643a('0x1c'));var client=jayson[_0x643a('0x1d')][_0x643a('0x1e')]({'port':0x232c});var client9002=jayson[_0x643a('0x1d')][_0x643a('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x42689d,_0x41bade,_0x2f704c,_0x298ce9){return new BPromise(function(_0x245f25,_0x5d6b4a){var _0x5145a9=_0x298ce9||client;return _0x5145a9['request'](_0x42689d,_0x2f704c)[_0x643a('0x1f')](function(_0xe2f4b8){logger[_0x643a('0x20')](_0x643a('0x21'),_0x41bade,_0x643a('0x22'));logger[_0x643a('0x23')](_0x643a('0x24'),_0x41bade,_0x643a('0x22'),JSON[_0x643a('0x25')](_0xe2f4b8));if(_0xe2f4b8[_0x643a('0x26')]){if(_0xe2f4b8[_0x643a('0x26')][_0x643a('0x27')]===0x1f4){logger['error'](_0x643a('0x21'),_0x41bade,_0xe2f4b8['error'][_0x643a('0x28')]);return _0x5d6b4a(_0xe2f4b8[_0x643a('0x26')][_0x643a('0x28')]);}logger['error'](_0x643a('0x21'),_0x41bade,_0xe2f4b8[_0x643a('0x26')]['message']);return _0x245f25(_0xe2f4b8[_0x643a('0x26')][_0x643a('0x28')]);}else{logger[_0x643a('0x20')](_0x643a('0x21'),_0x41bade,'request\x20sent');_0x245f25(_0xe2f4b8['result'][_0x643a('0x28')]);}})[_0x643a('0x29')](function(_0x38c838){logger['error'](_0x643a('0x21'),_0x41bade,_0x38c838);_0x5d6b4a(_0x38c838);});});}function respondWithStatusCode(_0x62dbad,_0x5b530c){_0x5b530c=_0x5b530c||0xcc;return function(_0x430c5a){if(_0x430c5a){return _0x62dbad[_0x643a('0x2a')](_0x5b530c);}return _0x62dbad[_0x643a('0x2b')](_0x5b530c)['end']();};}function respondWithResult(_0xbe7056,_0x493c83){_0x493c83=_0x493c83||0xc8;return function(_0x3c02e1){if(_0x3c02e1){return _0xbe7056[_0x643a('0x2b')](_0x493c83)[_0x643a('0x2c')](_0x3c02e1);}};}function respondWithFilteredResult(_0x5843b0,_0x3869d8){return function(_0xe04752){if(_0xe04752){var _0x166e65=typeof _0x3869d8[_0x643a('0x2d')]===_0x643a('0x2e')&&typeof _0x3869d8[_0x643a('0x2f')]===_0x643a('0x2e');var _0x3065c9=_0xe04752['count'];var _0x25b122=_0x166e65?0x0:_0x3869d8[_0x643a('0x2d')];var _0x1a7faa=_0x166e65?_0xe04752[_0x643a('0x30')]:_0x3869d8[_0x643a('0x2d')]+_0x3869d8[_0x643a('0x2f')];var _0x53cff6;if(_0x1a7faa>=_0x3065c9){_0x1a7faa=_0x3065c9;_0x53cff6=0xc8;}else{_0x53cff6=0xce;}_0x5843b0[_0x643a('0x2b')](_0x53cff6);return _0x5843b0['set'](_0x643a('0x31'),_0x25b122+'-'+_0x1a7faa+'/'+_0x3065c9)['json'](_0xe04752);}return null;};}function patchUpdates(_0x22adaa){return function(_0x4aaada){try{jsonpatch[_0x643a('0x32')](_0x4aaada,_0x22adaa,!![]);}catch(_0xa49fc5){return BPromise[_0x643a('0x33')](_0xa49fc5);}return _0x4aaada[_0x643a('0x34')]();};}function saveUpdates(_0xfff0bf,_0x4ed87b){return function(_0x3b70e7){if(_0x3b70e7){return _0x3b70e7[_0x643a('0x35')](_0xfff0bf)[_0x643a('0x1f')](function(_0x3d0b68){return _0x3d0b68;});}return null;};}function removeEntity(_0x5e6b38,_0xd0f13a){return function(_0x1c4eeb){if(_0x1c4eeb){return _0x1c4eeb['destroy']()[_0x643a('0x1f')](function(){_0x5e6b38['status'](0xcc)[_0x643a('0x36')]();});}};}function handleEntityNotFound(_0x39c210,_0x16b4f5){return function(_0x3fc979){if(!_0x3fc979){_0x39c210['sendStatus'](0x194);}return _0x3fc979;};}function handleError(_0x5ee269,_0xa4edd8){_0xa4edd8=_0xa4edd8||0x1f4;return function(_0x2bb6a4){logger[_0x643a('0x26')](_0x2bb6a4[_0x643a('0x37')]);if(_0x2bb6a4[_0x643a('0x38')]){delete _0x2bb6a4[_0x643a('0x38')];}_0x5ee269[_0x643a('0x2b')](_0xa4edd8)[_0x643a('0x39')](_0x2bb6a4);};}exports[_0x643a('0x3a')]=function(_0x4c44b0,_0x100b7d){var _0x49a29e={},_0xd91f11={},_0x4e3604={'count':0x0,'rows':[]};var _0x4c8c7e=_['map'](db[_0x643a('0x3b')]['rawAttributes'],function(_0x3b8e5f){return{'name':_0x3b8e5f[_0x643a('0x3c')],'type':_0x3b8e5f[_0x643a('0x3d')][_0x643a('0x3e')]};});_0xd91f11['model']=_['map'](_0x4c8c7e,'name');_0xd91f11[_0x643a('0x3f')]=_[_0x643a('0x40')](_0x4c44b0[_0x643a('0x3f')]);_0xd91f11['filters']=_[_0x643a('0x41')](_0xd91f11[_0x643a('0x42')],_0xd91f11[_0x643a('0x3f')]);_0x49a29e[_0x643a('0x43')]=_['intersection'](_0xd91f11[_0x643a('0x42')],qs[_0x643a('0x44')](_0x4c44b0['query'][_0x643a('0x44')]));_0x49a29e[_0x643a('0x43')]=_0x49a29e[_0x643a('0x43')][_0x643a('0x45')]?_0x49a29e[_0x643a('0x43')]:_0xd91f11[_0x643a('0x42')];if(!_0x4c44b0[_0x643a('0x3f')][_0x643a('0x46')]('nolimit')){_0x49a29e['limit']=qs[_0x643a('0x2f')](_0x4c44b0[_0x643a('0x3f')][_0x643a('0x2f')]);_0x49a29e[_0x643a('0x2d')]=qs[_0x643a('0x2d')](_0x4c44b0['query'][_0x643a('0x2d')]);}_0x49a29e[_0x643a('0x47')]=qs[_0x643a('0x48')](_0x4c44b0['query'][_0x643a('0x48')]);_0x49a29e[_0x643a('0x49')]=qs[_0x643a('0x4a')](_[_0x643a('0x4b')](_0x4c44b0[_0x643a('0x3f')],_0xd91f11[_0x643a('0x4a')]),_0x4c8c7e);if(_0x4c44b0[_0x643a('0x3f')][_0x643a('0x4c')]){_0x49a29e[_0x643a('0x49')]=_[_0x643a('0x4d')](_0x49a29e['where'],{'$or':_['map'](_0x4c8c7e,function(_0x1ed700){if(_0x1ed700[_0x643a('0x3d')]!=='VIRTUAL'){var _0x3d722f={};_0x3d722f[_0x1ed700[_0x643a('0x38')]]={'$like':'%'+_0x4c44b0['query'][_0x643a('0x4c')]+'%'};return _0x3d722f;}})});}_0x49a29e=_['merge']({},_0x49a29e,_0x4c44b0[_0x643a('0x4e')]);var _0x1c32a7={'where':_0x49a29e[_0x643a('0x49')]};return db['FaxMessage'][_0x643a('0x30')](_0x1c32a7)[_0x643a('0x1f')](function(_0x4293c2){_0x4e3604[_0x643a('0x30')]=_0x4293c2;if(_0x4c44b0[_0x643a('0x3f')]['includeAll']){_0x49a29e[_0x643a('0x4f')]=[{'all':!![]}];}return db[_0x643a('0x3b')]['findAll'](_0x49a29e);})[_0x643a('0x1f')](function(_0x978baa){_0x4e3604[_0x643a('0x50')]=_0x978baa;return _0x4e3604;})[_0x643a('0x1f')](respondWithFilteredResult(_0x100b7d,_0x49a29e))['catch'](handleError(_0x100b7d,null));};exports[_0x643a('0x51')]=function(_0x2f9ee0,_0x4144a3){var _0x2aab45={'raw':!![],'where':{'id':_0x2f9ee0['params']['id']}},_0xf80397={};_0xf80397[_0x643a('0x42')]=_[_0x643a('0x40')](db[_0x643a('0x3b')][_0x643a('0x52')]);_0xf80397[_0x643a('0x3f')]=_[_0x643a('0x40')](_0x2f9ee0[_0x643a('0x3f')]);_0xf80397[_0x643a('0x4a')]=_[_0x643a('0x41')](_0xf80397[_0x643a('0x42')],_0xf80397[_0x643a('0x3f')]);_0x2aab45[_0x643a('0x43')]=_[_0x643a('0x41')](_0xf80397[_0x643a('0x42')],qs[_0x643a('0x44')](_0x2f9ee0[_0x643a('0x3f')]['fields']));_0x2aab45['attributes']=_0x2aab45[_0x643a('0x43')]['length']?_0x2aab45['attributes']:_0xf80397['model'];if(_0x2f9ee0[_0x643a('0x3f')]['includeAll']){_0x2aab45['include']=[{'all':!![]}];}_0x2aab45=_['merge']({},_0x2aab45,_0x2f9ee0[_0x643a('0x4e')]);return db[_0x643a('0x3b')][_0x643a('0x53')](_0x2aab45)[_0x643a('0x1f')](handleEntityNotFound(_0x4144a3,null))[_0x643a('0x1f')](respondWithResult(_0x4144a3,null))[_0x643a('0x29')](handleError(_0x4144a3,null));};exports[_0x643a('0x35')]=function(_0x563b94,_0x204f27){if(_0x563b94[_0x643a('0x54')]['id']){delete _0x563b94[_0x643a('0x54')]['id'];}return db[_0x643a('0x3b')][_0x643a('0x53')]({'where':{'id':_0x563b94[_0x643a('0x55')]['id']}})['then'](handleEntityNotFound(_0x204f27,null))['then'](saveUpdates(_0x563b94['body'],null))['then'](respondWithResult(_0x204f27,null))[_0x643a('0x29')](handleError(_0x204f27,null));};exports[_0x643a('0x56')]=function(_0x3681aa,_0x3b9259){return db[_0x643a('0x3b')][_0x643a('0x53')]({'where':{'id':_0x3681aa['params']['id']}})['then'](handleEntityNotFound(_0x3b9259,null))['then'](removeEntity(_0x3b9259,null))[_0x643a('0x29')](handleError(_0x3b9259,null));};exports[_0x643a('0x57')]=function(_0x1a097f,_0x19d053){return db[_0x643a('0x3b')]['describe']()['then'](respondWithResult(_0x19d053,null))['catch'](handleError(_0x19d053,null));};var interaction_log=require(_0x643a('0x15'))(_0x643a('0x58'));exports[_0x643a('0x59')]=function(_0x5e590d,_0xd5cf45,_0x272d38){var _0x35c099={'agent':{},'channel':_0x643a('0x5a')};if(_0x5e590d[_0x643a('0x54')]['id']){delete _0x5e590d[_0x643a('0x54')]['id'];}_0x5e590d['body'][_0x643a('0x5b')]=!![];_0x5e590d[_0x643a('0x54')][_0x643a('0x5c')]=moment()[_0x643a('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x5e590d[_0x643a('0x54')][_0x643a('0x5e')]=_0x5e590d[_0x643a('0x54')][_0x643a('0x5e')]||_0x5e590d['user']['id'];_0x35c099[_0x643a('0x5f')]['id']=_0x5e590d[_0x643a('0x54')][_0x643a('0x5e')];return db[_0x643a('0x3b')]['find']({'where':{'id':_0x5e590d['params']['id'],'UserId':null}})[_0x643a('0x1f')](handleEntityNotFound(_0xd5cf45,null))[_0x643a('0x1f')](saveUpdates(_0x5e590d[_0x643a('0x54')],null))[_0x643a('0x1f')](function(_0x49d7fe){if(_0x49d7fe){_0x35c099[_0x643a('0x28')]=_0x49d7fe['get']({'plain':!![]});return db['FaxInteraction'][_0x643a('0x53')]({'where':{'id':_0x49d7fe[_0x643a('0x60')]}});}return null;})['then'](handleEntityNotFound(_0xd5cf45,null))[_0x643a('0x1f')](function(_0x51fb7d){if(_0x51fb7d){return _0x51fb7d[_0x643a('0x35')]({'UserId':_0x5e590d[_0x643a('0x54')][_0x643a('0x5e')],'read1stAt':_[_0x643a('0x61')](_0x51fb7d['read1stAt'])?moment()[_0x643a('0x5d')](_0x643a('0x62')):undefined});}return null;})[_0x643a('0x1f')](function(_0x24dd17){if(_0x24dd17){_0x35c099[_0x643a('0x63')]=_0x24dd17[_0x643a('0x64')]({'plain':!![]});interaction_log[_0x643a('0x20')](_0x643a('0x65'),_0x5e590d[_0x643a('0x66')]['id'],_0x5e590d[_0x643a('0x66')][_0x643a('0x38')],_0x5e590d[_0x643a('0x66')][_0x643a('0x67')],_0x35c099[_0x643a('0x63')]['id'],_0x5e590d['body']?JSON['stringify'](_0x5e590d[_0x643a('0x54')]):_0x643a('0x68'));return respondWithRpcPromise(_0x643a('0x69'),_0x643a('0x6a'),_0x35c099);}return null;})[_0x643a('0x1f')](function(_0x4739f2){var _0xaafd70=_0x643a('0x6b')+_0x4739f2[_0x643a('0x28')][_0x643a('0x6c')];return db[_0x643a('0x6d')]['query'](_0xaafd70,{'type':db['Sequelize'][_0x643a('0x6e')]['SELECT'],'raw':!![]})[_0x643a('0x1f')](function(_0x223b33){return _0x223b33;});})['then'](function(_0x53bd92){if(_0x53bd92){_0x35c099[_0x643a('0x28')]['contact']=_0x53bd92[0x0];if(!_0x5e590d['body'][_0x643a('0x5e')])return;return db[_0x643a('0x6f')]['find']({'where':{'id':_0x5e590d[_0x643a('0x54')][_0x643a('0x5e')],'role':_0x643a('0x5f')},'attributes':['id',_0x643a('0x38'),_0x643a('0x70'),'email',_0x643a('0x71')],'raw':!![]});}return null;})['then'](function(_0x2d3b1f){if(!_0x2d3b1f)return null;_0x35c099[_0x643a('0x28')]['agent']=_0x2d3b1f;return _0x35c099;})['then'](function(_0x2f803f){if(_0x2f803f){if(_0x5e590d[_0x643a('0x54')][_0x643a('0x72')]){_0x35c099[_0x643a('0x28')][_0x643a('0x73')]=util[_0x643a('0x5d')]('SIP/%s',_0x5e590d['user']['name']);_0x35c099['message'][_0x643a('0x74')]=_0x35c099[_0x643a('0x74')];_0x35c099[_0x643a('0x28')]['event']=_0x643a('0x59');return respondWithRpcPromise(_0x643a('0x75'),_0x643a('0x75'),{'event':_0x643a('0x76'),'message':_0x35c099[_0x643a('0x28')]},client9002)[_0x643a('0x1f')](function(){return _0x35c099;});}return _0x35c099;}return null;})['then'](respondWithResult(_0xd5cf45,null))[_0x643a('0x29')](handleError(_0xd5cf45,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0x643a('0x33')]=function(_0x42956d,_0x359e21,_0x5196b8){var _0x1f274e={'agent':{},'channel':'fax'};if(_0x42956d[_0x643a('0x54')]['id']){delete _0x42956d[_0x643a('0x54')]['id'];}_0x42956d[_0x643a('0x54')][_0x643a('0x5e')]=_0x42956d[_0x643a('0x54')][_0x643a('0x5e')]||_0x42956d['user']['id'];_0x1f274e[_0x643a('0x5f')]['id']=_0x42956d['body'][_0x643a('0x5e')];return db[_0x643a('0x3b')][_0x643a('0x53')]({'where':{'id':_0x42956d[_0x643a('0x55')]['id'],'UserId':null}})[_0x643a('0x1f')](handleEntityNotFound(_0x359e21,null))[_0x643a('0x1f')](function(_0x39ac75){if(_0x39ac75){_0x1f274e[_0x643a('0x28')]=_0x39ac75[_0x643a('0x64')]({'plain':!![]});return db[_0x643a('0x77')][_0x643a('0x53')]({'where':{'id':_0x39ac75[_0x643a('0x60')]}});}return null;})['then'](handleEntityNotFound(_0x359e21,null))[_0x643a('0x1f')](function(_0x4b3d8c){if(_0x4b3d8c){_0x1f274e['interaction']=_0x4b3d8c[_0x643a('0x64')]({'plain':!![]});interaction_log[_0x643a('0x20')](_0x643a('0x78'),_0x42956d['user']['id'],_0x42956d['user']['name'],_0x42956d[_0x643a('0x66')][_0x643a('0x67')],_0x1f274e['interaction']['id'],_0x42956d[_0x643a('0x54')]?JSON[_0x643a('0x25')](_0x42956d[_0x643a('0x54')]):_0x643a('0x68'));return respondWithRpcPromise(_0x643a('0x79'),'rejectMessage',_0x1f274e);}return null;})[_0x643a('0x1f')](function(_0x2a96b5){var _0x24acc2=_0x643a('0x6b')+_0x2a96b5[_0x643a('0x28')][_0x643a('0x6c')];return db[_0x643a('0x6d')][_0x643a('0x3f')](_0x24acc2,{'type':db[_0x643a('0x7a')][_0x643a('0x6e')]['SELECT'],'raw':!![]})['then'](function(_0x118365){return _0x118365;});})[_0x643a('0x1f')](function(_0x1f340f){if(_0x1f340f){_0x1f274e['message'][_0x643a('0x7b')]=_0x1f340f[0x0];if(!_0x42956d['body'][_0x643a('0x5e')])return;return db[_0x643a('0x6f')][_0x643a('0x53')]({'where':{'id':_0x42956d[_0x643a('0x54')]['UserId'],'role':_0x643a('0x5f')},'attributes':['id',_0x643a('0x38'),'fullname','email',_0x643a('0x71')],'raw':!![]});}return null;})[_0x643a('0x1f')](function(_0x31d57c){if(!_0x31d57c)return null;_0x1f274e['message'][_0x643a('0x5f')]=_0x31d57c;return _0x1f274e;})[_0x643a('0x1f')](function(_0x1d9f06){if(_0x1d9f06){_0x1d9f06[_0x643a('0x28')]['interface']=util[_0x643a('0x5d')]('SIP/%s',_0x42956d[_0x643a('0x66')]['name']);_0x1d9f06[_0x643a('0x28')]['channel']=_0x1f274e['channel'];_0x1d9f06[_0x643a('0x28')][_0x643a('0x7c')]=_0x643a('0x33');respondWithRpcPromise(_0x643a('0x75'),_0x643a('0x75'),{'event':_0x643a('0x7d'),'message':_0x1d9f06[_0x643a('0x28')]},client9002);return _0x1f274e;}return null;})['then'](respondWithResult(_0x359e21,null))[_0x643a('0x29')](handleError(_0x359e21,null));};exports[_0x643a('0x7e')]=function(_0x588527,_0x400169){var _0x13ea33;return db[_0x643a('0x3b')][_0x643a('0x7e')](_0x588527[_0x643a('0x54')],{})[_0x643a('0x1f')](function(_0x4072f8){_0x13ea33=_0x4072f8;return db[_0x643a('0x7f')][_0x643a('0x80')]({'where':{'id':_0x13ea33[_0x643a('0x6c')]}});})[_0x643a('0x1f')](function(_0x25bb04){if(_['isNil'](_0x25bb04)){return;}else{_0x13ea33[_0x643a('0x5a')]=_0x25bb04[_0x643a('0x5a')];return db[_0x643a('0x81')][_0x643a('0x80')]({'where':{'id':_0x13ea33['AttachmentId']}});}})[_0x643a('0x1f')](function(_0x523c67){return respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0x643a('0x61')](_0x588527[_0x643a('0x54')])?undefined:_0x588527['body'][_0x643a('0x82')],'path':_['isNil'](_0x523c67)?undefined:util['format'](_0x643a('0x83'),_0x523c67[_0x643a('0x84')]),'fax':_[_0x643a('0x61')](_0x13ea33[_0x643a('0x5a')])?undefined:_0x13ea33[_0x643a('0x5a')],'AttachmentId':_0x13ea33[_0x643a('0x85')]},client9002);})['then'](respondWithResult(_0x400169,0xc9))[_0x643a('0x29')](handleError(_0x400169,null));};exports[_0x643a('0x86')]=function(_0x31da87,_0x2035ca){var _0x4b7350=path[_0x643a('0x87')](config[_0x643a('0x88')],_0x643a('0x89'),_0x643a('0x8a'),_0x643a('0x8b'));return db[_0x643a('0x3b')][_0x643a('0x53')]({'where':{'id':_0x31da87[_0x643a('0x55')]['id']},'include':[{'model':db['Attachment'],'as':_0x643a('0x81')}]})['then'](handleEntityNotFound(_0x2035ca,null))[_0x643a('0x1f')](function(_0x506a62){if(_0x506a62){return _0x2035ca['download'](path['join'](_0x4b7350,_0x506a62[_0x643a('0x81')][_0x643a('0x84')]));}})[_0x643a('0x29')](handleError(_0x2035ca,null));}; \ No newline at end of file +var _0x2058=['SIP/%s','event','accept','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','email','interface','format','channel','create','findOne','fax','AttachmentId','SendFax','FaxAccountId','download','join','root','files','attachments','Attachment','basename','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','http','client','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','key','filters','intersection','model','query','attributes','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','keys','fields','length','find','body','describe','../../config/logger','fax-interactions','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','internal','manual'];(function(_0x29f9af,_0x4f3d10){var _0x56e4a8=function(_0x2e2554){while(--_0x2e2554){_0x29f9af['push'](_0x29f9af['shift']());}};_0x56e4a8(++_0x4f3d10);}(_0x2058,0xaf));var _0x8205=function(_0x1abb11,_0xd68915){_0x1abb11=_0x1abb11-0x0;var _0x149a9f=_0x2058[_0x1abb11];return _0x149a9f;};'use strict';var emlformat=require(_0x8205('0x0'));var rimraf=require(_0x8205('0x1'));var zipdir=require(_0x8205('0x2'));var jsonpatch=require(_0x8205('0x3'));var rp=require(_0x8205('0x4'));var moment=require(_0x8205('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8205('0x6'));var util=require(_0x8205('0x7'));var path=require(_0x8205('0x8'));var sox=require(_0x8205('0x9'));var csv=require('to-csv');var ejs=require(_0x8205('0xa'));var fs=require('fs');var fs_extra=require(_0x8205('0xb'));var _=require(_0x8205('0xc'));var squel=require(_0x8205('0xd'));var crypto=require('crypto');var jsforce=require(_0x8205('0xe'));var deskjs=require(_0x8205('0xf'));var toCsv=require('to-csv');var querystring=require(_0x8205('0x10'));var Papa=require('papaparse');var Redis=require(_0x8205('0x11'));var authService=require(_0x8205('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x8205('0x13'));var hardwareService=require(_0x8205('0x14'));var logger=require('../../config/logger')(_0x8205('0x15'));var utils=require(_0x8205('0x16'));var config=require(_0x8205('0x17'));var licenseUtil=require(_0x8205('0x18'));var db=require('../../mysqldb')['db'];config[_0x8205('0x19')]=_[_0x8205('0x1a')](config[_0x8205('0x19')],{'host':_0x8205('0x1b'),'port':0x18eb});var socket=require(_0x8205('0x1c'))(new Redis(config['redis']));require(_0x8205('0x1d'))[_0x8205('0x1e')](socket);var jayson=require(_0x8205('0x1f'));var client=jayson['client'][_0x8205('0x20')]({'port':0x232c});var client9002=jayson[_0x8205('0x21')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfd6f1d,_0x5d8089,_0x27313e,_0xd2bb8d){return new BPromise(function(_0x18f866,_0x1e38a9){var _0x3ba818=_0xd2bb8d||client;return _0x3ba818['request'](_0xfd6f1d,_0x27313e)[_0x8205('0x22')](function(_0x12f2a8){logger['info'](_0x8205('0x23'),_0x5d8089,_0x8205('0x24'));logger[_0x8205('0x25')](_0x8205('0x26'),_0x5d8089,_0x8205('0x24'),JSON[_0x8205('0x27')](_0x12f2a8));if(_0x12f2a8[_0x8205('0x28')]){if(_0x12f2a8['error'][_0x8205('0x29')]===0x1f4){logger[_0x8205('0x28')]('FaxMessage,\x20%s,\x20%s',_0x5d8089,_0x12f2a8[_0x8205('0x28')][_0x8205('0x2a')]);return _0x1e38a9(_0x12f2a8[_0x8205('0x28')][_0x8205('0x2a')]);}logger[_0x8205('0x28')]('FaxMessage,\x20%s,\x20%s',_0x5d8089,_0x12f2a8[_0x8205('0x28')][_0x8205('0x2a')]);return _0x18f866(_0x12f2a8[_0x8205('0x28')][_0x8205('0x2a')]);}else{logger[_0x8205('0x2b')](_0x8205('0x23'),_0x5d8089,'request\x20sent');_0x18f866(_0x12f2a8[_0x8205('0x2c')]['message']);}})[_0x8205('0x2d')](function(_0xb97b08){logger['error'](_0x8205('0x23'),_0x5d8089,_0xb97b08);_0x1e38a9(_0xb97b08);});});}function respondWithStatusCode(_0x71676b,_0x127fd3){_0x127fd3=_0x127fd3||0xcc;return function(_0x50ee6a){if(_0x50ee6a){return _0x71676b[_0x8205('0x2e')](_0x127fd3);}return _0x71676b[_0x8205('0x2f')](_0x127fd3)[_0x8205('0x30')]();};}function respondWithResult(_0xf53aed,_0x190105){_0x190105=_0x190105||0xc8;return function(_0x24ab72){if(_0x24ab72){return _0xf53aed[_0x8205('0x2f')](_0x190105)[_0x8205('0x31')](_0x24ab72);}};}function respondWithFilteredResult(_0x2e3860,_0x2eec06){return function(_0x300c4c){if(_0x300c4c){var _0x5c4838=typeof _0x2eec06[_0x8205('0x32')]===_0x8205('0x33')&&typeof _0x2eec06[_0x8205('0x34')]==='undefined';var _0x4c3e86=_0x300c4c[_0x8205('0x35')];var _0x5d0082=_0x5c4838?0x0:_0x2eec06[_0x8205('0x32')];var _0x2d60f1=_0x5c4838?_0x300c4c[_0x8205('0x35')]:_0x2eec06[_0x8205('0x32')]+_0x2eec06[_0x8205('0x34')];var _0x3de476;if(_0x2d60f1>=_0x4c3e86){_0x2d60f1=_0x4c3e86;_0x3de476=0xc8;}else{_0x3de476=0xce;}_0x2e3860[_0x8205('0x2f')](_0x3de476);return _0x2e3860[_0x8205('0x36')](_0x8205('0x37'),_0x5d0082+'-'+_0x2d60f1+'/'+_0x4c3e86)[_0x8205('0x31')](_0x300c4c);}return null;};}function patchUpdates(_0x1fc100){return function(_0x292d00){try{jsonpatch['apply'](_0x292d00,_0x1fc100,!![]);}catch(_0x1a4dd6){return BPromise[_0x8205('0x38')](_0x1a4dd6);}return _0x292d00[_0x8205('0x39')]();};}function saveUpdates(_0x3ab011,_0x1b794f){return function(_0x2be241){if(_0x2be241){return _0x2be241[_0x8205('0x3a')](_0x3ab011)[_0x8205('0x22')](function(_0x1aff59){return _0x1aff59;});}return null;};}function removeEntity(_0x2cfa46,_0x5af77){return function(_0x52e646){if(_0x52e646){return _0x52e646[_0x8205('0x3b')]()['then'](function(){_0x2cfa46[_0x8205('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4736d2,_0x1356b6){return function(_0x56855f){if(!_0x56855f){_0x4736d2[_0x8205('0x2e')](0x194);}return _0x56855f;};}function handleError(_0x1cab7e,_0x504311){_0x504311=_0x504311||0x1f4;return function(_0x5b7358){logger[_0x8205('0x28')](_0x5b7358[_0x8205('0x3c')]);if(_0x5b7358[_0x8205('0x3d')]){delete _0x5b7358['name'];}_0x1cab7e['status'](_0x504311)[_0x8205('0x3e')](_0x5b7358);};}exports[_0x8205('0x3f')]=function(_0x1c6428,_0x39e01a){var _0x2c9f4d={},_0x4cffe8={},_0x361e14={'count':0x0,'rows':[]};var _0x265000=_[_0x8205('0x40')](db[_0x8205('0x41')][_0x8205('0x42')],function(_0x17b554){return{'name':_0x17b554[_0x8205('0x43')],'type':_0x17b554[_0x8205('0x44')][_0x8205('0x45')]};});_0x4cffe8['model']=_[_0x8205('0x40')](_0x265000,_0x8205('0x3d'));_0x4cffe8['query']=_['keys'](_0x1c6428['query']);_0x4cffe8[_0x8205('0x46')]=_[_0x8205('0x47')](_0x4cffe8[_0x8205('0x48')],_0x4cffe8[_0x8205('0x49')]);_0x2c9f4d[_0x8205('0x4a')]=_[_0x8205('0x47')](_0x4cffe8['model'],qs['fields'](_0x1c6428[_0x8205('0x49')]['fields']));_0x2c9f4d['attributes']=_0x2c9f4d[_0x8205('0x4a')]['length']?_0x2c9f4d[_0x8205('0x4a')]:_0x4cffe8[_0x8205('0x48')];if(!_0x1c6428[_0x8205('0x49')][_0x8205('0x4b')](_0x8205('0x4c'))){_0x2c9f4d['limit']=qs[_0x8205('0x34')](_0x1c6428[_0x8205('0x49')]['limit']);_0x2c9f4d[_0x8205('0x32')]=qs['offset'](_0x1c6428['query'][_0x8205('0x32')]);}_0x2c9f4d['order']=qs[_0x8205('0x4d')](_0x1c6428[_0x8205('0x49')][_0x8205('0x4d')]);_0x2c9f4d[_0x8205('0x4e')]=qs[_0x8205('0x46')](_[_0x8205('0x4f')](_0x1c6428[_0x8205('0x49')],_0x4cffe8[_0x8205('0x46')]),_0x265000);if(_0x1c6428[_0x8205('0x49')]['filter']){_0x2c9f4d[_0x8205('0x4e')]=_['merge'](_0x2c9f4d[_0x8205('0x4e')],{'$or':_[_0x8205('0x40')](_0x265000,function(_0x1844a5){if(_0x1844a5['type']!==_0x8205('0x50')){var _0x37824b={};_0x37824b[_0x1844a5[_0x8205('0x3d')]]={'$like':'%'+_0x1c6428[_0x8205('0x49')]['filter']+'%'};return _0x37824b;}})});}_0x2c9f4d=_[_0x8205('0x51')]({},_0x2c9f4d,_0x1c6428['options']);var _0x435393={'where':_0x2c9f4d[_0x8205('0x4e')]};return db['FaxMessage'][_0x8205('0x35')](_0x435393)['then'](function(_0x2872ae){_0x361e14[_0x8205('0x35')]=_0x2872ae;if(_0x1c6428[_0x8205('0x49')][_0x8205('0x52')]){_0x2c9f4d[_0x8205('0x53')]=[{'all':!![]}];}return db[_0x8205('0x41')][_0x8205('0x54')](_0x2c9f4d);})[_0x8205('0x22')](function(_0x40ca5f){_0x361e14[_0x8205('0x55')]=_0x40ca5f;return _0x361e14;})[_0x8205('0x22')](respondWithFilteredResult(_0x39e01a,_0x2c9f4d))[_0x8205('0x2d')](handleError(_0x39e01a,null));};exports[_0x8205('0x56')]=function(_0x50313,_0x11c71f){var _0x3f52e9={'raw':!![],'where':{'id':_0x50313[_0x8205('0x57')]['id']}},_0x503aa1={};_0x503aa1[_0x8205('0x48')]=_[_0x8205('0x58')](db[_0x8205('0x41')][_0x8205('0x42')]);_0x503aa1[_0x8205('0x49')]=_[_0x8205('0x58')](_0x50313[_0x8205('0x49')]);_0x503aa1[_0x8205('0x46')]=_[_0x8205('0x47')](_0x503aa1[_0x8205('0x48')],_0x503aa1['query']);_0x3f52e9[_0x8205('0x4a')]=_[_0x8205('0x47')](_0x503aa1[_0x8205('0x48')],qs[_0x8205('0x59')](_0x50313[_0x8205('0x49')]['fields']));_0x3f52e9[_0x8205('0x4a')]=_0x3f52e9['attributes'][_0x8205('0x5a')]?_0x3f52e9[_0x8205('0x4a')]:_0x503aa1['model'];if(_0x50313['query'][_0x8205('0x52')]){_0x3f52e9[_0x8205('0x53')]=[{'all':!![]}];}_0x3f52e9=_[_0x8205('0x51')]({},_0x3f52e9,_0x50313['options']);return db['FaxMessage'][_0x8205('0x5b')](_0x3f52e9)[_0x8205('0x22')](handleEntityNotFound(_0x11c71f,null))[_0x8205('0x22')](respondWithResult(_0x11c71f,null))['catch'](handleError(_0x11c71f,null));};exports[_0x8205('0x3a')]=function(_0x25c67f,_0x3f052e){if(_0x25c67f['body']['id']){delete _0x25c67f[_0x8205('0x5c')]['id'];}return db[_0x8205('0x41')][_0x8205('0x5b')]({'where':{'id':_0x25c67f['params']['id']}})['then'](handleEntityNotFound(_0x3f052e,null))['then'](saveUpdates(_0x25c67f[_0x8205('0x5c')],null))[_0x8205('0x22')](respondWithResult(_0x3f052e,null))[_0x8205('0x2d')](handleError(_0x3f052e,null));};exports[_0x8205('0x3b')]=function(_0x42d13f,_0x503233){return db[_0x8205('0x41')][_0x8205('0x5b')]({'where':{'id':_0x42d13f[_0x8205('0x57')]['id']}})[_0x8205('0x22')](handleEntityNotFound(_0x503233,null))[_0x8205('0x22')](removeEntity(_0x503233,null))['catch'](handleError(_0x503233,null));};exports['describe']=function(_0x3f8705,_0x2996ee){return db['FaxMessage'][_0x8205('0x5d')]()[_0x8205('0x22')](respondWithResult(_0x2996ee,null))['catch'](handleError(_0x2996ee,null));};var interaction_log=require(_0x8205('0x5e'))(_0x8205('0x5f'));exports['accept']=function(_0x2963e2,_0x4f9c0d,_0x2083ff){var _0x101a2f={'agent':{},'channel':'fax'};if(_0x2963e2[_0x8205('0x5c')]['id']){delete _0x2963e2['body']['id'];}_0x2963e2['body'][_0x8205('0x60')]=!![];_0x2963e2[_0x8205('0x5c')][_0x8205('0x61')]=moment()['format'](_0x8205('0x62'));_0x2963e2[_0x8205('0x5c')][_0x8205('0x63')]=_0x2963e2[_0x8205('0x5c')][_0x8205('0x63')]||_0x2963e2['user']['id'];_0x101a2f['agent']['id']=_0x2963e2[_0x8205('0x5c')][_0x8205('0x63')];return db[_0x8205('0x41')][_0x8205('0x5b')]({'where':{'id':_0x2963e2[_0x8205('0x57')]['id'],'UserId':null}})[_0x8205('0x22')](handleEntityNotFound(_0x4f9c0d,null))['then'](saveUpdates(_0x2963e2[_0x8205('0x5c')],null))[_0x8205('0x22')](function(_0x174f5a){if(_0x174f5a){_0x101a2f[_0x8205('0x2a')]=_0x174f5a[_0x8205('0x64')]({'plain':!![]});return db[_0x8205('0x65')][_0x8205('0x5b')]({'where':{'id':_0x174f5a[_0x8205('0x66')]}});}return null;})[_0x8205('0x22')](handleEntityNotFound(_0x4f9c0d,null))[_0x8205('0x22')](function(_0x4dfc91){if(_0x4dfc91){return _0x4dfc91['update']({'UserId':_0x2963e2['body'][_0x8205('0x63')],'read1stAt':_[_0x8205('0x67')](_0x4dfc91[_0x8205('0x68')])?moment()['format'](_0x8205('0x62')):undefined});}return null;})[_0x8205('0x22')](function(_0x5320ce){if(_0x5320ce){_0x101a2f['interaction']=_0x5320ce['get']({'plain':!![]});interaction_log[_0x8205('0x2b')](_0x8205('0x69'),_0x2963e2[_0x8205('0x6a')]['id'],_0x2963e2[_0x8205('0x6a')][_0x8205('0x3d')],_0x2963e2[_0x8205('0x6a')][_0x8205('0x6b')],_0x101a2f['interaction']['id'],_0x2963e2['body']?JSON[_0x8205('0x27')](_0x2963e2[_0x8205('0x5c')]):_0x8205('0x6c'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x101a2f);}return null;})[_0x8205('0x22')](function(_0x31f74f){var _0x3b16b3='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x31f74f[_0x8205('0x2a')]['ContactId'];return db[_0x8205('0x6d')][_0x8205('0x49')](_0x3b16b3,{'type':db[_0x8205('0x6e')][_0x8205('0x6f')][_0x8205('0x70')],'raw':!![]})['then'](function(_0x449a97){return _0x449a97;});})[_0x8205('0x22')](function(_0x1b9299){if(_0x1b9299){_0x101a2f['message'][_0x8205('0x71')]=_0x1b9299[0x0];if(!_0x2963e2[_0x8205('0x5c')][_0x8205('0x63')])return;return db[_0x8205('0x72')][_0x8205('0x5b')]({'where':{'id':_0x2963e2[_0x8205('0x5c')]['UserId'],'role':_0x8205('0x73')},'attributes':['id',_0x8205('0x3d'),_0x8205('0x74'),'email',_0x8205('0x75')],'raw':!![]});}return null;})['then'](function(_0x2562c3){if(!_0x2562c3)return null;_0x101a2f[_0x8205('0x2a')][_0x8205('0x73')]=_0x2562c3;return _0x101a2f;})[_0x8205('0x22')](function(_0xf590cf){if(_0xf590cf){if(_0x2963e2['body'][_0x8205('0x76')]){_0x101a2f[_0x8205('0x2a')]['interface']=util['format'](_0x8205('0x77'),_0x2963e2[_0x8205('0x6a')][_0x8205('0x3d')]);_0x101a2f[_0x8205('0x2a')]['channel']=_0x101a2f['channel'];_0x101a2f['message'][_0x8205('0x78')]=_0x8205('0x79');return respondWithRpcPromise('EventManager',_0x8205('0x7a'),{'event':_0x8205('0x7b'),'message':_0x101a2f[_0x8205('0x2a')]},client9002)[_0x8205('0x22')](function(){return _0x101a2f;});}return _0x101a2f;}return null;})[_0x8205('0x22')](respondWithResult(_0x4f9c0d,null))['catch'](handleError(_0x4f9c0d,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0x8205('0x38')]=function(_0x45658e,_0x4955e3,_0x587f6c){var _0x390c33={'agent':{},'channel':'fax'};if(_0x45658e[_0x8205('0x5c')]['id']){delete _0x45658e[_0x8205('0x5c')]['id'];}_0x45658e[_0x8205('0x5c')][_0x8205('0x63')]=_0x45658e[_0x8205('0x5c')][_0x8205('0x63')]||_0x45658e[_0x8205('0x6a')]['id'];_0x390c33['agent']['id']=_0x45658e['body'][_0x8205('0x63')];return db[_0x8205('0x41')]['find']({'where':{'id':_0x45658e[_0x8205('0x57')]['id'],'UserId':null}})[_0x8205('0x22')](handleEntityNotFound(_0x4955e3,null))[_0x8205('0x22')](function(_0x239194){if(_0x239194){_0x390c33[_0x8205('0x2a')]=_0x239194[_0x8205('0x64')]({'plain':!![]});return db[_0x8205('0x65')][_0x8205('0x5b')]({'where':{'id':_0x239194[_0x8205('0x66')]}});}return null;})[_0x8205('0x22')](handleEntityNotFound(_0x4955e3,null))[_0x8205('0x22')](function(_0x73c5b0){if(_0x73c5b0){_0x390c33['interaction']=_0x73c5b0[_0x8205('0x64')]({'plain':!![]});interaction_log[_0x8205('0x2b')](_0x8205('0x7c'),_0x45658e['user']['id'],_0x45658e[_0x8205('0x6a')][_0x8205('0x3d')],_0x45658e[_0x8205('0x6a')][_0x8205('0x6b')],_0x390c33[_0x8205('0x7d')]['id'],_0x45658e[_0x8205('0x5c')]?JSON[_0x8205('0x27')](_0x45658e[_0x8205('0x5c')]):_0x8205('0x6c'));return respondWithRpcPromise(_0x8205('0x7e'),_0x8205('0x7f'),_0x390c33);}return null;})[_0x8205('0x22')](function(_0x12c889){var _0x2f7cc2=_0x8205('0x80')+_0x12c889[_0x8205('0x2a')][_0x8205('0x81')];return db[_0x8205('0x6d')]['query'](_0x2f7cc2,{'type':db[_0x8205('0x6e')][_0x8205('0x6f')]['SELECT'],'raw':!![]})[_0x8205('0x22')](function(_0x2da02d){return _0x2da02d;});})[_0x8205('0x22')](function(_0x5a538e){if(_0x5a538e){_0x390c33[_0x8205('0x2a')][_0x8205('0x71')]=_0x5a538e[0x0];if(!_0x45658e['body']['UserId'])return;return db[_0x8205('0x72')][_0x8205('0x5b')]({'where':{'id':_0x45658e[_0x8205('0x5c')][_0x8205('0x63')],'role':_0x8205('0x73')},'attributes':['id',_0x8205('0x3d'),_0x8205('0x74'),_0x8205('0x82'),'internal'],'raw':!![]});}return null;})['then'](function(_0x30679a){if(!_0x30679a)return null;_0x390c33[_0x8205('0x2a')][_0x8205('0x73')]=_0x30679a;return _0x390c33;})[_0x8205('0x22')](function(_0x25e7d){if(_0x25e7d){_0x25e7d[_0x8205('0x2a')][_0x8205('0x83')]=util[_0x8205('0x84')](_0x8205('0x77'),_0x45658e[_0x8205('0x6a')][_0x8205('0x3d')]);_0x25e7d['message']['channel']=_0x390c33[_0x8205('0x85')];_0x25e7d['message'][_0x8205('0x78')]='reject';respondWithRpcPromise(_0x8205('0x7a'),'EventManager',{'event':'rejectmessage','message':_0x25e7d['message']},client9002);return _0x390c33;}return null;})['then'](respondWithResult(_0x4955e3,null))[_0x8205('0x2d')](handleError(_0x4955e3,null));};exports[_0x8205('0x86')]=function(_0xc80a2f,_0x5962fc){var _0xc5a37;return db[_0x8205('0x41')]['create'](_0xc80a2f['body'],{})['then'](function(_0xcba733){_0xc5a37=_0xcba733;return db['CmContact'][_0x8205('0x87')]({'where':{'id':_0xc5a37[_0x8205('0x81')]}});})['then'](function(_0x407f6a){if(_[_0x8205('0x67')](_0x407f6a)){return;}else{_0xc5a37[_0x8205('0x88')]=_0x407f6a[_0x8205('0x88')];return db['Attachment'][_0x8205('0x87')]({'where':{'id':_0xc5a37[_0x8205('0x89')]}});}})[_0x8205('0x22')](function(_0x110e20){return respondWithRpcPromise(_0x8205('0x8a'),_0x8205('0x8a'),{'FaxAccountId':_[_0x8205('0x67')](_0xc80a2f[_0x8205('0x5c')])?undefined:_0xc80a2f[_0x8205('0x5c')][_0x8205('0x8b')],'path':_['isNil'](_0x110e20)?undefined:util[_0x8205('0x84')]('/var/opt/motion2/server/files/attachments/%s',_0x110e20['basename']),'fax':_['isNil'](_0xc5a37[_0x8205('0x88')])?undefined:_0xc5a37[_0x8205('0x88')],'AttachmentId':_0xc5a37['AttachmentId']},client9002);})[_0x8205('0x22')](respondWithResult(_0x5962fc,0xc9))[_0x8205('0x2d')](handleError(_0x5962fc,null));};exports[_0x8205('0x8c')]=function(_0x4b2a40,_0x480cc8){var _0x2a8f3d=path[_0x8205('0x8d')](config[_0x8205('0x8e')],'server',_0x8205('0x8f'),_0x8205('0x90'));return db['FaxMessage'][_0x8205('0x5b')]({'where':{'id':_0x4b2a40[_0x8205('0x57')]['id']},'include':[{'model':db[_0x8205('0x91')],'as':_0x8205('0x91')}]})[_0x8205('0x22')](handleEntityNotFound(_0x480cc8,null))['then'](function(_0x47e6e6){if(_0x47e6e6){return _0x480cc8[_0x8205('0x8c')](path[_0x8205('0x8d')](_0x2a8f3d,_0x47e6e6['Attachment'][_0x8205('0x92')]));}})['catch'](handleError(_0x480cc8,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 2debcb1..9849eb5 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 _0x11c8=['hook','exports','../../mysqldb','FaxMessage','save','update','remove','emit'];(function(_0x2dcf6e,_0x379f35){var _0x2ddf90=function(_0x321810){while(--_0x321810){_0x2dcf6e['push'](_0x2dcf6e['shift']());}};_0x2ddf90(++_0x379f35);}(_0x11c8,0x19a));var _0x811c=function(_0x1f52f5,_0x404fcc){_0x1f52f5=_0x1f52f5-0x0;var _0x3921be=_0x11c8[_0x1f52f5];return _0x3921be;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0x811c('0x0'))['db'][_0x811c('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x811c('0x2'),'afterUpdate':_0x811c('0x3'),'afterDestroy':_0x811c('0x4')};function emitEvent(_0x85a54c){return function(_0x16f1d6,_0x432f5b,_0x49a07c){FaxMessageEvents[_0x811c('0x5')](_0x85a54c+':'+_0x16f1d6['id'],_0x16f1d6);FaxMessageEvents[_0x811c('0x5')](_0x85a54c,_0x16f1d6);_0x49a07c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x811c('0x6')](e,emitEvent(event));}}module[_0x811c('0x7')]=FaxMessageEvents; \ No newline at end of file +var _0x4753=['update','emit','hasOwnProperty','exports','events','../../mysqldb','FaxMessage','save'];(function(_0x138d93,_0x4b0fb5){var _0x410432=function(_0x3501c4){while(--_0x3501c4){_0x138d93['push'](_0x138d93['shift']());}};_0x410432(++_0x4b0fb5);}(_0x4753,0x1f4));var _0x3475=function(_0xbe3d6e,_0x3b362c){_0xbe3d6e=_0xbe3d6e-0x0;var _0x5606f6=_0x4753[_0xbe3d6e];return _0x5606f6;};'use strict';var EventEmitter=require(_0x3475('0x0'));var FaxMessage=require(_0x3475('0x1'))['db'][_0x3475('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3475('0x3'),'afterUpdate':_0x3475('0x4'),'afterDestroy':'remove'};function emitEvent(_0x212d98){return function(_0x4c6fd2,_0x5a801b,_0x5de37e){FaxMessageEvents['emit'](_0x212d98+':'+_0x4c6fd2['id'],_0x4c6fd2);FaxMessageEvents[_0x3475('0x5')](_0x212d98,_0x4c6fd2);_0x5de37e(null);};}for(var e in events){if(events[_0x3475('0x6')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x3475('0x7')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index af02656..6451729 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 _0x810e=['rimraf','../../config/environment','./faxMessage.attributes','exports','FaxMessage','fti_fax_messages','FULLTEXT','models','direction','toLowerCase','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','path'];(function(_0x38172a,_0x2b1d49){var _0x10123c=function(_0x26976d){while(--_0x26976d){_0x38172a['push'](_0x38172a['shift']());}};_0x10123c(++_0x2b1d49);}(_0x810e,0x1e7));var _0xe810=function(_0x4cc765,_0x3cc6fc){_0x4cc765=_0x4cc765-0x0;var _0xfae330=_0x810e[_0x4cc765];return _0xfae330;};'use strict';var _=require(_0xe810('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe810('0x1'));var moment=require(_0xe810('0x2'));var BPromise=require(_0xe810('0x3'));var rp=require(_0xe810('0x4'));var fs=require('fs');var path=require(_0xe810('0x5'));var rimraf=require(_0xe810('0x6'));var config=require(_0xe810('0x7'));var attributes=require(_0xe810('0x8'));module[_0xe810('0x9')]=function(_0x2d1439,_0x36acdc){return _0x2d1439['define'](_0xe810('0xa'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0xe810('0xb'),'fields':['body'],'type':_0xe810('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2b0466,_0x60ea35,_0x109d5e){var _0x3b7828=_0x2d1439[_0xe810('0xd')];var _0x52d370=_0x2b0466['get']({'plain':!![]});if(_0x52d370[_0xe810('0xe')][_0xe810('0xf')]()==='in'||_0x52d370[_0xe810('0xe')]['toLowerCase']()==='out'&&!_0x52d370[_0xe810('0x10')]&&!_[_0xe810('0x11')](_0x52d370[_0xe810('0x12')])){_0x3b7828[_0xe810('0x13')][_0xe810('0x14')]({'where':{'id':_0x52d370[_0xe810('0x15')]}})[_0xe810('0x16')](function(_0x361d35){if(_0x361d35){_0x361d35[_0xe810('0x17')]({'lastMsgAt':_0x52d370[_0xe810('0x18')],'lastMsgDirection':_0x52d370[_0xe810('0xe')]['toLowerCase']()});}})[_0xe810('0x19')](function(_0x2daac3){console[_0xe810('0x1a')](_0x2daac3);});}_0x109d5e();}},'charset':_0xe810('0x1b'),'collate':_0xe810('0x1c')});}; \ No newline at end of file +var _0xf5ba=['out','isNil','FaxInteraction','FaxInteractionId','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','rimraf','exports','define','FaxMessage','fax_messages','fti_fax_messages','FULLTEXT','get','direction','toLowerCase'];(function(_0x50d8da,_0xe56e5b){var _0x1b55bb=function(_0x5c15eb){while(--_0x5c15eb){_0x50d8da['push'](_0x50d8da['shift']());}};_0x1b55bb(++_0xe56e5b);}(_0xf5ba,0x81));var _0xaf5b=function(_0xf4c1e4,_0x24c75c){_0xf4c1e4=_0xf4c1e4-0x0;var _0x408aa7=_0xf5ba[_0xf4c1e4];return _0x408aa7;};'use strict';var _=require(_0xaf5b('0x0'));var util=require(_0xaf5b('0x1'));var logger=require(_0xaf5b('0x2'))(_0xaf5b('0x3'));var moment=require('moment');var BPromise=require(_0xaf5b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xaf5b('0x5'));var config=require('../../config/environment');var attributes=require('./faxMessage.attributes');module[_0xaf5b('0x6')]=function(_0x1f5dcd,_0x239493){return _0x1f5dcd[_0xaf5b('0x7')](_0xaf5b('0x8'),attributes,{'tableName':_0xaf5b('0x9'),'paranoid':![],'indexes':[{'name':_0xaf5b('0xa'),'fields':['body'],'type':_0xaf5b('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x179390,_0xd0e588,_0xf860e9){var _0x4981d4=_0x1f5dcd['models'];var _0x1343d3=_0x179390[_0xaf5b('0xc')]({'plain':!![]});if(_0x1343d3[_0xaf5b('0xd')][_0xaf5b('0xe')]()==='in'||_0x1343d3[_0xaf5b('0xd')]['toLowerCase']()===_0xaf5b('0xf')&&!_0x1343d3['secret']&&!_[_0xaf5b('0x10')](_0x1343d3['UserId'])){_0x4981d4[_0xaf5b('0x11')]['findOne']({'where':{'id':_0x1343d3[_0xaf5b('0x12')]}})['then'](function(_0x57c47e){if(_0x57c47e){_0x57c47e[_0xaf5b('0x13')]({'lastMsgAt':_0x1343d3[_0xaf5b('0x14')],'lastMsgDirection':_0x1343d3['direction'][_0xaf5b('0xe')]()});}})[_0xaf5b('0x15')](function(_0x3646ee){console['error'](_0x3646ee);});}_0xf860e9();}},'charset':_0xaf5b('0x16'),'collate':_0xaf5b('0x17')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 8e231e3..5ce8374 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 _0x9f62=['util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','request','info','request\x20sent','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','CreateFaxMessage','FaxMessage','body','raw','then','debug','catch','UpdateFaxMessage','update','options','where','attributes','limit'];(function(_0x40bd1f,_0x2b974f){var _0x40f6ca=function(_0x1a29d6){while(--_0x1a29d6){_0x40bd1f['push'](_0x40bd1f['shift']());}};_0x40f6ca(++_0x2b974f);}(_0x9f62,0x154));var _0x29f6=function(_0x116aed,_0x302e54){_0x116aed=_0x116aed-0x0;var _0x564e21=_0x9f62[_0x116aed];return _0x564e21;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var moment=require('moment');var BPromise=require(_0x29f6('0x1'));var rs=require(_0x29f6('0x2'));var fs=require('fs');var Redis=require(_0x29f6('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x29f6('0x4'))(_0x29f6('0x5'));var config=require(_0x29f6('0x6'));var jayson=require(_0x29f6('0x7'));var client=jayson['client'][_0x29f6('0x8')]({'port':0x232a});config[_0x29f6('0x9')]=_[_0x29f6('0xa')](config[_0x29f6('0x9')],{'host':_0x29f6('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0xe25841,_0x44db16,_0x4fb455){return new BPromise(function(_0x5a0724,_0x29b3f5){return client[_0x29f6('0xc')](_0xe25841,_0x4fb455)['then'](function(_0x17b69c){logger[_0x29f6('0xd')]('FaxMessage,\x20%s,\x20%s',_0x44db16,'request\x20sent');logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x44db16,_0x29f6('0xe'),JSON[_0x29f6('0xf')](_0x17b69c));if(_0x17b69c[_0x29f6('0x10')]){if(_0x17b69c[_0x29f6('0x10')][_0x29f6('0x11')]===0x1f4){logger[_0x29f6('0x10')](_0x29f6('0x12'),_0x44db16,_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);return _0x29b3f5(_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);}logger[_0x29f6('0x10')](_0x29f6('0x12'),_0x44db16,_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);return _0x5a0724(_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x44db16,_0x29f6('0xe'));_0x5a0724(_0x17b69c[_0x29f6('0x14')][_0x29f6('0x13')]);}})['catch'](function(_0xcb90){logger[_0x29f6('0x10')]('FaxMessage,\x20%s,\x20%s',_0x44db16,_0xcb90);_0x29b3f5(_0xcb90);});});}exports[_0x29f6('0x15')]=function(_0x3e81af){var _0x42a8fa=this;return new Promise(function(_0x41b9f0,_0xb6e7a9){return db[_0x29f6('0x16')]['create'](_0x3e81af[_0x29f6('0x17')],{'raw':_0x3e81af['options']?_0x3e81af['options'][_0x29f6('0x18')]===undefined?!![]:![]:!![]})[_0x29f6('0x19')](function(_0x39c6b3){logger[_0x29f6('0xd')]('CreateFaxMessage',_0x3e81af);logger[_0x29f6('0x1a')]('CreateFaxMessage',_0x3e81af,JSON[_0x29f6('0xf')](_0x39c6b3));_0x41b9f0(_0x39c6b3);})[_0x29f6('0x1b')](function(_0x4200cc){logger[_0x29f6('0x10')]('CreateFaxMessage',_0x4200cc[_0x29f6('0x13')],_0x3e81af);_0xb6e7a9(_0x42a8fa[_0x29f6('0x10')](0x1f4,_0x4200cc['message']));});});};exports[_0x29f6('0x1c')]=function(_0x45f792){var _0x2519ac=this;return new Promise(function(_0x342038,_0x84ccb7){return db[_0x29f6('0x16')][_0x29f6('0x1d')](_0x45f792['body'],{'raw':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x1f')]||null:null,'attributes':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x20')]||null:null,'limit':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x21')]||null:null})[_0x29f6('0x19')](function(_0x304c28){logger[_0x29f6('0xd')](_0x29f6('0x1c'),_0x45f792);logger[_0x29f6('0x1a')]('UpdateFaxMessage',_0x45f792,JSON['stringify'](_0x304c28));_0x342038(_0x304c28);})[_0x29f6('0x1b')](function(_0x489897){logger[_0x29f6('0x10')](_0x29f6('0x1c'),_0x489897[_0x29f6('0x13')],_0x45f792);_0x84ccb7(_0x2519ac[_0x29f6('0x10')](0x1f4,_0x489897['message']));});});}; \ No newline at end of file +var _0x81bd=['debug','request\x20sent','stringify','error','message','result','catch','CreateFaxMessage','create','body','options','raw','FaxMessage','update','limit','UpdateFaxMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s'];(function(_0x17194f,_0xda8d83){var _0x5da92d=function(_0x4a86b8){while(--_0x4a86b8){_0x17194f['push'](_0x17194f['shift']());}};_0x5da92d(++_0xda8d83);}(_0x81bd,0x7c));var _0xd81b=function(_0x4ae5d3,_0x3f65fe){_0x4ae5d3=_0x4ae5d3-0x0;var _0x38bb02=_0x81bd[_0x4ae5d3];return _0x38bb02;};'use strict';var _=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var moment=require(_0xd81b('0x2'));var BPromise=require(_0xd81b('0x3'));var rs=require(_0xd81b('0x4'));var fs=require('fs');var Redis=require(_0xd81b('0x5'));var db=require(_0xd81b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd81b('0x7'))(_0xd81b('0x8'));var config=require(_0xd81b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd81b('0xa')][_0xd81b('0xb')]({'port':0x232a});config[_0xd81b('0xc')]=_['defaults'](config['redis'],{'host':_0xd81b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd81b('0xc')]));require(_0xd81b('0xe'))[_0xd81b('0xf')](socket);function respondWithRpcPromise(_0x86dab6,_0x17fba4,_0x1ff60f){return new BPromise(function(_0x4391be,_0x17e09f){return client[_0xd81b('0x10')](_0x86dab6,_0x1ff60f)[_0xd81b('0x11')](function(_0x215b92){logger[_0xd81b('0x12')](_0xd81b('0x13'),_0x17fba4,'request\x20sent');logger[_0xd81b('0x14')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x17fba4,_0xd81b('0x15'),JSON[_0xd81b('0x16')](_0x215b92));if(_0x215b92['error']){if(_0x215b92[_0xd81b('0x17')]['code']===0x1f4){logger[_0xd81b('0x17')](_0xd81b('0x13'),_0x17fba4,_0x215b92[_0xd81b('0x17')][_0xd81b('0x18')]);return _0x17e09f(_0x215b92[_0xd81b('0x17')]['message']);}logger[_0xd81b('0x17')](_0xd81b('0x13'),_0x17fba4,_0x215b92['error'][_0xd81b('0x18')]);return _0x4391be(_0x215b92[_0xd81b('0x17')][_0xd81b('0x18')]);}else{logger[_0xd81b('0x12')](_0xd81b('0x13'),_0x17fba4,_0xd81b('0x15'));_0x4391be(_0x215b92[_0xd81b('0x19')][_0xd81b('0x18')]);}})[_0xd81b('0x1a')](function(_0x285164){logger[_0xd81b('0x17')](_0xd81b('0x13'),_0x17fba4,_0x285164);_0x17e09f(_0x285164);});});}exports[_0xd81b('0x1b')]=function(_0x3518f0){var _0x156894=this;return new Promise(function(_0x4f8c0b,_0x5f101a){return db['FaxMessage'][_0xd81b('0x1c')](_0x3518f0[_0xd81b('0x1d')],{'raw':_0x3518f0[_0xd81b('0x1e')]?_0x3518f0['options'][_0xd81b('0x1f')]===undefined?!![]:![]:!![]})[_0xd81b('0x11')](function(_0x542ee2){logger[_0xd81b('0x12')](_0xd81b('0x1b'),_0x3518f0);logger[_0xd81b('0x14')](_0xd81b('0x1b'),_0x3518f0,JSON[_0xd81b('0x16')](_0x542ee2));_0x4f8c0b(_0x542ee2);})[_0xd81b('0x1a')](function(_0x255011){logger[_0xd81b('0x17')](_0xd81b('0x1b'),_0x255011[_0xd81b('0x18')],_0x3518f0);_0x5f101a(_0x156894[_0xd81b('0x17')](0x1f4,_0x255011[_0xd81b('0x18')]));});});};exports['UpdateFaxMessage']=function(_0x28768f){var _0x99dbc9=this;return new Promise(function(_0xe3637a,_0x31b9fd){return db[_0xd81b('0x20')][_0xd81b('0x21')](_0x28768f[_0xd81b('0x1d')],{'raw':_0x28768f[_0xd81b('0x1e')]?_0x28768f[_0xd81b('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28768f[_0xd81b('0x1e')]?_0x28768f['options']['where']||null:null,'attributes':_0x28768f[_0xd81b('0x1e')]?_0x28768f[_0xd81b('0x1e')]['attributes']||null:null,'limit':_0x28768f['options']?_0x28768f[_0xd81b('0x1e')][_0xd81b('0x22')]||null:null})[_0xd81b('0x11')](function(_0x289f54){logger[_0xd81b('0x12')](_0xd81b('0x23'),_0x28768f);logger['debug'](_0xd81b('0x23'),_0x28768f,JSON[_0xd81b('0x16')](_0x289f54));_0xe3637a(_0x289f54);})['catch'](function(_0x56d80b){logger[_0xd81b('0x17')](_0xd81b('0x23'),_0x56d80b['message'],_0x28768f);_0x31b9fd(_0x99dbc9['error'](0x1f4,_0x56d80b['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 07c471c..44cfb91 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 _0xd5d6=['update','emit','removeListener','register','length','faxMessage:','./faxMessage.events','remove'];(function(_0x1a07e1,_0x14df72){var _0x1e2a3e=function(_0xec3201){while(--_0xec3201){_0x1a07e1['push'](_0x1a07e1['shift']());}};_0x1e2a3e(++_0x14df72);}(_0xd5d6,0x12e));var _0x6d5d=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xd5d6[_0x167cc1];return _0x10bc4b;};'use strict';var FaxMessageEvents=require(_0x6d5d('0x0'));var events=['save',_0x6d5d('0x1'),_0x6d5d('0x2')];function createListener(_0x3a1fd8,_0x3b9356){return function(_0x267b6e){_0x3b9356[_0x6d5d('0x3')](_0x3a1fd8,_0x267b6e);};}function removeListener(_0x45bd86,_0x1bbaba){return function(){FaxMessageEvents[_0x6d5d('0x4')](_0x45bd86,_0x1bbaba);};}exports[_0x6d5d('0x5')]=function(_0x53ba2a){for(var _0x501f95=0x0,_0x4a8a41=events[_0x6d5d('0x6')];_0x501f95<_0x4a8a41;_0x501f95++){var _0x2abb0b=events[_0x501f95];var _0x343c33=createListener(_0x6d5d('0x7')+_0x2abb0b,_0x53ba2a);FaxMessageEvents['on'](_0x2abb0b,_0x343c33);}}; \ No newline at end of file +var _0x2f7d=['save','emit','removeListener','register','length','./faxMessage.events'];(function(_0x295a3d,_0x56d487){var _0x23a732=function(_0x15cfc2){while(--_0x15cfc2){_0x295a3d['push'](_0x295a3d['shift']());}};_0x23a732(++_0x56d487);}(_0x2f7d,0x1a9));var _0xd2f7=function(_0xf5f974,_0x4e1aad){_0xf5f974=_0xf5f974-0x0;var _0x2287db=_0x2f7d[_0xf5f974];return _0x2287db;};'use strict';var FaxMessageEvents=require(_0xd2f7('0x0'));var events=[_0xd2f7('0x1'),'remove','update'];function createListener(_0x3ed0a5,_0x5245b8){return function(_0xc08b6f){_0x5245b8[_0xd2f7('0x2')](_0x3ed0a5,_0xc08b6f);};}function removeListener(_0x44a664,_0x51e27a){return function(){FaxMessageEvents[_0xd2f7('0x3')](_0x44a664,_0x51e27a);};}exports[_0xd2f7('0x4')]=function(_0x138fde){for(var _0x5b09f6=0x0,_0x57123e=events[_0xd2f7('0x5')];_0x5b09f6<_0x57123e;_0x5b09f6++){var _0x20545a=events[_0x5b09f6];var _0x196af5=createListener('faxMessage:'+_0x20545a,_0x138fde);FaxMessageEvents['on'](_0x20545a,_0x196af5);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 83c6bf8..aeebc19 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 _0xec56=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','tracked','fax','create','put','update','/:id/accept','reject','delete','exports','multer','connect-timeout','express'];(function(_0x222424,_0x27e416){var _0x24d19a=function(_0x1418e2){while(--_0x1418e2){_0x222424['push'](_0x222424['shift']());}};_0x24d19a(++_0x27e416);}(_0xec56,0x1bd));var _0x6ec5=function(_0x178af7,_0x16a17c){_0x178af7=_0x178af7-0x0;var _0x46ea16=_0xec56[_0x178af7];return _0x46ea16;};'use strict';var multer=require(_0x6ec5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6ec5('0x1'));var express=require(_0x6ec5('0x2'));var router=express[_0x6ec5('0x3')]();var fs_extra=require(_0x6ec5('0x4'));var auth=require(_0x6ec5('0x5'));var interaction=require(_0x6ec5('0x6'));var config=require(_0x6ec5('0x7'));var controller=require(_0x6ec5('0x8'));router[_0x6ec5('0x9')]('/',auth[_0x6ec5('0xa')](),controller[_0x6ec5('0xb')]);router[_0x6ec5('0x9')](_0x6ec5('0xc'),auth[_0x6ec5('0xa')](),controller[_0x6ec5('0xd')]);router[_0x6ec5('0x9')](_0x6ec5('0xe'),auth[_0x6ec5('0xa')](),controller[_0x6ec5('0xf')]);router['get'](_0x6ec5('0x10'),auth[_0x6ec5('0xa')](),controller[_0x6ec5('0x11')]);router[_0x6ec5('0x12')]('/',auth[_0x6ec5('0xa')](),interaction[_0x6ec5('0x13')](_0x6ec5('0x14'),'faxmessage:create'),controller[_0x6ec5('0x15')]);router[_0x6ec5('0x16')](_0x6ec5('0xe'),auth[_0x6ec5('0xa')](),controller[_0x6ec5('0x17')]);router[_0x6ec5('0x16')](_0x6ec5('0x18'),auth[_0x6ec5('0xa')](),controller['accept']);router[_0x6ec5('0x16')]('/:id/reject',auth[_0x6ec5('0xa')](),controller[_0x6ec5('0x19')]);router[_0x6ec5('0x1a')](_0x6ec5('0xe'),auth[_0x6ec5('0xa')](),controller['destroy']);module[_0x6ec5('0x1b')]=router; \ No newline at end of file +var _0x5ff3=['/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxMessage.controller','get','isAuthenticated','index','/:id','download','tracked','put','update'];(function(_0x3814a6,_0x268c55){var _0x4a4a49=function(_0xb9f914){while(--_0xb9f914){_0x3814a6['push'](_0x3814a6['shift']());}};_0x4a4a49(++_0x268c55);}(_0x5ff3,0x17d));var _0x35ff=function(_0x45f43e,_0x3c37de){_0x45f43e=_0x45f43e-0x0;var _0x4137d2=_0x5ff3[_0x45f43e];return _0x4137d2;};'use strict';var multer=require('multer');var util=require(_0x35ff('0x0'));var path=require('path');var timeout=require(_0x35ff('0x1'));var express=require('express');var router=express[_0x35ff('0x2')]();var fs_extra=require(_0x35ff('0x3'));var auth=require(_0x35ff('0x4'));var interaction=require(_0x35ff('0x5'));var config=require('../../config/environment');var controller=require(_0x35ff('0x6'));router[_0x35ff('0x7')]('/',auth[_0x35ff('0x8')](),controller[_0x35ff('0x9')]);router[_0x35ff('0x7')]('/describe',auth[_0x35ff('0x8')](),controller['describe']);router[_0x35ff('0x7')](_0x35ff('0xa'),auth[_0x35ff('0x8')](),controller['show']);router[_0x35ff('0x7')]('/:id/download',auth[_0x35ff('0x8')](),controller[_0x35ff('0xb')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x35ff('0xc')]('fax','faxmessage:create'),controller['create']);router[_0x35ff('0xd')](_0x35ff('0xa'),auth[_0x35ff('0x8')](),controller[_0x35ff('0xe')]);router['put'](_0x35ff('0xf'),auth[_0x35ff('0x8')](),controller[_0x35ff('0x10')]);router['put'](_0x35ff('0x11'),auth[_0x35ff('0x8')](),controller[_0x35ff('0x12')]);router[_0x35ff('0x13')](_0x35ff('0xa'),auth[_0x35ff('0x8')](),controller[_0x35ff('0x14')]);module[_0x35ff('0x15')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 2713288..72b1720 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 _0xb8ee=['exports','STRING','name','ENUM','rrmemory','beepall','roundrobin','INTEGER','sequelize'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xb8ee,0x14c));var _0xeb8e=function(_0xb36843,_0x57c1f4){_0xb36843=_0xb36843-0x0;var _0x227b83=_0xb8ee[_0xb36843];return _0x227b83;};'use strict';var Sequelize=require(_0xeb8e('0x0'));module[_0xeb8e('0x1')]={'name':{'type':Sequelize[_0xeb8e('0x2')],'unique':_0xeb8e('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xeb8e('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xeb8e('0x4')](_0xeb8e('0x5'),_0xeb8e('0x6'),_0xeb8e('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xeb8e('0x8')],'defaultValue':0x0}}; \ No newline at end of file +var _0x01aa=['name','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x36b1e8,_0x61dc1a){var _0x31746e=function(_0x1e5bc0){while(--_0x1e5bc0){_0x36b1e8['push'](_0x36b1e8['shift']());}};_0x31746e(++_0x61dc1a);}(_0x01aa,0x1ef));var _0xa01a=function(_0x21252c,_0x6953f4){_0x21252c=_0x21252c-0x0;var _0x111cd7=_0x01aa[_0x21252c];return _0x111cd7;};'use strict';var Sequelize=require(_0xa01a('0x0'));module[_0xa01a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xa01a('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa01a('0x3')](_0xa01a('0x4'),_0xa01a('0x5'),_0xa01a('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 81e4262..558e043 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 _0xc189=['removeAgents','addAgents','omit','spread','isArray','userFaxQueue:remove','getAgents','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxQueue.socket','register','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','FaxQueues','UserProfileResource','end','sendStatus','stack','name','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','filter','where','merge','VIRTUAL','FaxQueue','includeAll','include','findAll','catch','params','keys','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','getMembers','findOne','UserFaxQueue','hasOwnProperty','sort','pick','FaxQueueId','options','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','rows','%s/%s','Team','getTeams','addTeams','ids','online','interface','flatMap','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','User','Agents','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','FaxQueueId\x20=\x20?','clone','push','toString','sequelize','QueryTypes','TeamId','includes','union','compact','value','isEmpty'];(function(_0xf17e6,_0x4fe6d6){var _0x2635b4=function(_0x4c1a08){while(--_0x4c1a08){_0xf17e6['push'](_0xf17e6['shift']());}};_0x2635b4(++_0x4fe6d6);}(_0xc189,0x91));var _0x9c18=function(_0x487f15,_0x1cf5fb){_0x487f15=_0x487f15-0x0;var _0x32c8a1=_0xc189[_0x487f15];return _0x32c8a1;};'use strict';var emlformat=require(_0x9c18('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9c18('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9c18('0x2'));var moment=require(_0x9c18('0x3'));var BPromise=require(_0x9c18('0x4'));var Mustache=require(_0x9c18('0x5'));var util=require(_0x9c18('0x6'));var path=require(_0x9c18('0x7'));var sox=require(_0x9c18('0x8'));var csv=require(_0x9c18('0x9'));var ejs=require(_0x9c18('0xa'));var fs=require('fs');var fs_extra=require(_0x9c18('0xb'));var _=require('lodash');var squel=require(_0x9c18('0xc'));var crypto=require(_0x9c18('0xd'));var jsforce=require(_0x9c18('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9c18('0x9'));var querystring=require(_0x9c18('0xf'));var Papa=require(_0x9c18('0x10'));var Redis=require(_0x9c18('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9c18('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9c18('0x13'))('api');var utils=require(_0x9c18('0x14'));var config=require(_0x9c18('0x15'));var licenseUtil=require(_0x9c18('0x16'));var db=require(_0x9c18('0x17'))['db'];config[_0x9c18('0x18')]=_[_0x9c18('0x19')](config[_0x9c18('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x9c18('0x1a'))(new Redis(config['redis']));require(_0x9c18('0x1b'))[_0x9c18('0x1c')](socket);function respondWithStatusCode(_0x162154,_0x5da40a){_0x5da40a=_0x5da40a||0xcc;return function(_0x2ab37c){if(_0x2ab37c){return _0x162154['sendStatus'](_0x5da40a);}return _0x162154[_0x9c18('0x1d')](_0x5da40a)['end']();};}function respondWithResult(_0x2eded4,_0x14fd02){_0x14fd02=_0x14fd02||0xc8;return function(_0x3c8fa8){if(_0x3c8fa8){return _0x2eded4['status'](_0x14fd02)[_0x9c18('0x1e')](_0x3c8fa8);}};}function respondWithFilteredResult(_0x2a3a5f,_0x559d92){return function(_0x3bc066){if(_0x3bc066){var _0x4ae540=typeof _0x559d92[_0x9c18('0x1f')]===_0x9c18('0x20')&&typeof _0x559d92['limit']===_0x9c18('0x20');var _0x704170=_0x3bc066[_0x9c18('0x21')];var _0x47696d=_0x4ae540?0x0:_0x559d92[_0x9c18('0x1f')];var _0xfdb743=_0x4ae540?_0x3bc066[_0x9c18('0x21')]:_0x559d92[_0x9c18('0x1f')]+_0x559d92[_0x9c18('0x22')];var _0x48d65d;if(_0xfdb743>=_0x704170){_0xfdb743=_0x704170;_0x48d65d=0xc8;}else{_0x48d65d=0xce;}_0x2a3a5f[_0x9c18('0x1d')](_0x48d65d);return _0x2a3a5f[_0x9c18('0x23')](_0x9c18('0x24'),_0x47696d+'-'+_0xfdb743+'/'+_0x704170)[_0x9c18('0x1e')](_0x3bc066);}return null;};}function patchUpdates(_0x9feff7){return function(_0x21025b){try{jsonpatch[_0x9c18('0x25')](_0x21025b,_0x9feff7,!![]);}catch(_0x332fad){return BPromise['reject'](_0x332fad);}return _0x21025b[_0x9c18('0x26')]();};}function saveUpdates(_0x3e26c3,_0x3e311c){return function(_0x29c9b5){if(_0x29c9b5){return _0x29c9b5['update'](_0x3e26c3)[_0x9c18('0x27')](function(_0x4ad782){return _0x4ad782;});}return null;};}function removeEntity(_0x4498f1,_0x5b9082){return function(_0x20f90c){if(_0x20f90c){return _0x20f90c[_0x9c18('0x28')]()['then'](function(){var _0x3424b4=_0x20f90c['get']({'plain':!![]});var _0x10232f=_0x9c18('0x29');return db[_0x9c18('0x2a')][_0x9c18('0x28')]({'where':{'type':_0x10232f,'resourceId':_0x3424b4['id']}})[_0x9c18('0x27')](function(){return _0x20f90c;});})[_0x9c18('0x27')](function(){_0x4498f1[_0x9c18('0x1d')](0xcc)[_0x9c18('0x2b')]();});}};}function handleEntityNotFound(_0x12467e,_0xe289d7){return function(_0x45800b){if(!_0x45800b){_0x12467e[_0x9c18('0x2c')](0x194);}return _0x45800b;};}function handleError(_0x1e363f,_0x38a2ba){_0x38a2ba=_0x38a2ba||0x1f4;return function(_0x34abb2){logger['error'](_0x34abb2[_0x9c18('0x2d')]);if(_0x34abb2[_0x9c18('0x2e')]){delete _0x34abb2['name'];}_0x1e363f[_0x9c18('0x1d')](_0x38a2ba)['send'](_0x34abb2);};}exports[_0x9c18('0x2f')]=function(_0x33971f,_0x46a0af){var _0x239536={},_0x5e8c7e={},_0x3692b0={'count':0x0,'rows':[]};var _0x235c58=_[_0x9c18('0x30')](db['FaxQueue'][_0x9c18('0x31')],function(_0x2e2166){return{'name':_0x2e2166['fieldName'],'type':_0x2e2166[_0x9c18('0x32')][_0x9c18('0x33')]};});_0x5e8c7e[_0x9c18('0x34')]=_[_0x9c18('0x30')](_0x235c58,_0x9c18('0x2e'));_0x5e8c7e[_0x9c18('0x35')]=_['keys'](_0x33971f[_0x9c18('0x35')]);_0x5e8c7e[_0x9c18('0x36')]=_[_0x9c18('0x37')](_0x5e8c7e[_0x9c18('0x34')],_0x5e8c7e[_0x9c18('0x35')]);_0x239536[_0x9c18('0x38')]=_[_0x9c18('0x37')](_0x5e8c7e[_0x9c18('0x34')],qs[_0x9c18('0x39')](_0x33971f[_0x9c18('0x35')][_0x9c18('0x39')]));_0x239536[_0x9c18('0x38')]=_0x239536[_0x9c18('0x38')][_0x9c18('0x3a')]?_0x239536[_0x9c18('0x38')]:_0x5e8c7e['model'];if(!_0x33971f[_0x9c18('0x35')]['hasOwnProperty'](_0x9c18('0x3b'))){_0x239536[_0x9c18('0x22')]=qs[_0x9c18('0x22')](_0x33971f['query']['limit']);_0x239536[_0x9c18('0x1f')]=qs[_0x9c18('0x1f')](_0x33971f[_0x9c18('0x35')][_0x9c18('0x1f')]);}_0x239536[_0x9c18('0x3c')]=qs['sort'](_0x33971f[_0x9c18('0x35')]['sort']);_0x239536['where']=qs[_0x9c18('0x36')](_['pick'](_0x33971f['query'],_0x5e8c7e[_0x9c18('0x36')]),_0x235c58);if(_0x33971f[_0x9c18('0x35')][_0x9c18('0x3d')]){_0x239536[_0x9c18('0x3e')]=_[_0x9c18('0x3f')](_0x239536[_0x9c18('0x3e')],{'$or':_[_0x9c18('0x30')](_0x235c58,function(_0x13bd4c){if(_0x13bd4c[_0x9c18('0x32')]!==_0x9c18('0x40')){var _0x1edc92={};_0x1edc92[_0x13bd4c[_0x9c18('0x2e')]]={'$like':'%'+_0x33971f['query'][_0x9c18('0x3d')]+'%'};return _0x1edc92;}})});}_0x239536=_['merge']({},_0x239536,_0x33971f['options']);var _0x1c8c49={'where':_0x239536[_0x9c18('0x3e')]};return db[_0x9c18('0x41')][_0x9c18('0x21')](_0x1c8c49)[_0x9c18('0x27')](function(_0x3ca8ad){_0x3692b0['count']=_0x3ca8ad;if(_0x33971f[_0x9c18('0x35')][_0x9c18('0x42')]){_0x239536[_0x9c18('0x43')]=[{'all':!![]}];}return db[_0x9c18('0x41')][_0x9c18('0x44')](_0x239536);})[_0x9c18('0x27')](function(_0x273924){_0x3692b0['rows']=_0x273924;return _0x3692b0;})['then'](respondWithFilteredResult(_0x46a0af,_0x239536))[_0x9c18('0x45')](handleError(_0x46a0af,null));};exports['show']=function(_0x3158e8,_0x13f9ef){var _0x185e17={'raw':!![],'where':{'id':_0x3158e8[_0x9c18('0x46')]['id']}},_0x20b739={};_0x20b739[_0x9c18('0x34')]=_[_0x9c18('0x47')](db[_0x9c18('0x41')][_0x9c18('0x31')]);_0x20b739[_0x9c18('0x35')]=_['keys'](_0x3158e8[_0x9c18('0x35')]);_0x20b739[_0x9c18('0x36')]=_[_0x9c18('0x37')](_0x20b739[_0x9c18('0x34')],_0x20b739[_0x9c18('0x35')]);_0x185e17[_0x9c18('0x38')]=_['intersection'](_0x20b739[_0x9c18('0x34')],qs['fields'](_0x3158e8[_0x9c18('0x35')][_0x9c18('0x39')]));_0x185e17[_0x9c18('0x38')]=_0x185e17[_0x9c18('0x38')][_0x9c18('0x3a')]?_0x185e17[_0x9c18('0x38')]:_0x20b739[_0x9c18('0x34')];if(_0x3158e8[_0x9c18('0x35')][_0x9c18('0x42')]){_0x185e17[_0x9c18('0x43')]=[{'all':!![]}];}_0x185e17=_['merge']({},_0x185e17,_0x3158e8['options']);return db[_0x9c18('0x41')][_0x9c18('0x48')](_0x185e17)[_0x9c18('0x27')](handleEntityNotFound(_0x13f9ef,null))[_0x9c18('0x27')](respondWithResult(_0x13f9ef,null))[_0x9c18('0x45')](handleError(_0x13f9ef,null));};exports[_0x9c18('0x49')]=function(_0x5d9326,_0x59c5c3){return db[_0x9c18('0x41')][_0x9c18('0x49')](_0x5d9326[_0x9c18('0x4a')],{})[_0x9c18('0x27')](function(_0x4aa59c){var _0x3da561=_0x5d9326['user'][_0x9c18('0x4b')]({'plain':!![]});if(!_0x3da561)throw new Error(_0x9c18('0x4c'));if(_0x3da561[_0x9c18('0x4d')]==='user'){var _0x15c68c=_0x4aa59c[_0x9c18('0x4b')]({'plain':!![]});var _0x1ffa69=_0x9c18('0x29');return db['UserProfileSection'][_0x9c18('0x48')]({'where':{'name':_0x1ffa69,'userProfileId':_0x3da561[_0x9c18('0x4e')]},'raw':!![]})['then'](function(_0x39a0d6){if(_0x39a0d6&&_0x39a0d6[_0x9c18('0x4f')]===0x0){return db['UserProfileResource'][_0x9c18('0x49')]({'name':_0x15c68c['name'],'resourceId':_0x15c68c['id'],'type':_0x39a0d6[_0x9c18('0x2e')],'sectionId':_0x39a0d6['id']},{})['then'](function(){return _0x4aa59c;});}else{return _0x4aa59c;}})[_0x9c18('0x45')](function(_0xadfbf8){logger[_0x9c18('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xadfbf8);throw _0xadfbf8;});}return _0x4aa59c;})['then'](respondWithResult(_0x59c5c3,0xc9))[_0x9c18('0x45')](handleError(_0x59c5c3,null));};exports['update']=function(_0x21cb47,_0x3a1134){if(_0x21cb47[_0x9c18('0x4a')]['id']){delete _0x21cb47[_0x9c18('0x4a')]['id'];}return db[_0x9c18('0x41')]['find']({'where':{'id':_0x21cb47[_0x9c18('0x46')]['id']}})['then'](handleEntityNotFound(_0x3a1134,null))[_0x9c18('0x27')](saveUpdates(_0x21cb47[_0x9c18('0x4a')],null))[_0x9c18('0x27')](respondWithResult(_0x3a1134,null))[_0x9c18('0x45')](handleError(_0x3a1134,null));};exports[_0x9c18('0x28')]=function(_0x5d1483,_0xc209c1){return db[_0x9c18('0x41')][_0x9c18('0x48')]({'where':{'id':_0x5d1483['params']['id']}})[_0x9c18('0x27')](handleEntityNotFound(_0xc209c1,null))[_0x9c18('0x27')](removeEntity(_0xc209c1,null))[_0x9c18('0x45')](handleError(_0xc209c1,null));};exports['describe']=function(_0xd217ba,_0x38af1e){return db[_0x9c18('0x41')]['describe']()['then'](respondWithResult(_0x38af1e,null))['catch'](handleError(_0x38af1e,null));};exports[_0x9c18('0x51')]=function(_0xf663f1,_0x5c3e6b,_0x2ed998){var _0xa9ef5c={'raw':!![],'where':{}},_0x54052a={},_0x132610;return db['FaxQueue'][_0x9c18('0x52')]({'where':{'id':_0xf663f1[_0x9c18('0x46')]['id']}})[_0x9c18('0x27')](handleEntityNotFound(_0x5c3e6b,null))[_0x9c18('0x27')](function(_0x3c2889){if(_0x3c2889){_0x132610=_0x3c2889['get']({'plain':!![]});_0x54052a[_0x9c18('0x34')]=_[_0x9c18('0x47')](db[_0x9c18('0x53')][_0x9c18('0x31')]);_0x54052a['query']=_['keys'](_0xf663f1[_0x9c18('0x35')]);_0x54052a[_0x9c18('0x36')]=_[_0x9c18('0x37')](_0x54052a[_0x9c18('0x34')],_0x54052a[_0x9c18('0x35')]);_0xa9ef5c[_0x9c18('0x38')]=_[_0x9c18('0x37')](_0x54052a[_0x9c18('0x34')],qs[_0x9c18('0x39')](_0xf663f1['query']['fields']));_0xa9ef5c[_0x9c18('0x38')]=_0xa9ef5c[_0x9c18('0x38')][_0x9c18('0x3a')]?_0xa9ef5c[_0x9c18('0x38')]:_0x54052a[_0x9c18('0x34')];if(!_0xf663f1[_0x9c18('0x35')][_0x9c18('0x54')]('nolimit')){_0xa9ef5c[_0x9c18('0x22')]=qs[_0x9c18('0x22')](_0xf663f1['query'][_0x9c18('0x22')]);_0xa9ef5c['offset']=qs[_0x9c18('0x1f')](_0xf663f1[_0x9c18('0x35')]['offset']);}_0xa9ef5c[_0x9c18('0x3c')]=qs[_0x9c18('0x55')](_0xf663f1['query'][_0x9c18('0x55')]);_0xa9ef5c[_0x9c18('0x3e')]=qs[_0x9c18('0x36')](_[_0x9c18('0x56')](_0xf663f1[_0x9c18('0x35')],_0x54052a[_0x9c18('0x36')]));_0xa9ef5c['where'][_0x9c18('0x57')]=_0x3c2889['id'];if(_0xf663f1[_0x9c18('0x35')][_0x9c18('0x3d')]){_0xa9ef5c[_0x9c18('0x3e')]=_[_0x9c18('0x3f')](_0xa9ef5c[_0x9c18('0x3e')],{'$or':_[_0x9c18('0x30')](_0xa9ef5c['attributes'],function(_0x49edde){var _0x43c200={};_0x43c200[_0x49edde]={'$like':'%'+_0xf663f1[_0x9c18('0x35')][_0x9c18('0x3d')]+'%'};return _0x43c200;})});}_0xa9ef5c=_[_0x9c18('0x3f')]({},_0xa9ef5c,_0xf663f1[_0x9c18('0x58')]);return db['UserFaxQueue']['findAll'](_0xa9ef5c);}})['then'](function(_0x39f242){if(_0x39f242){return db['User'][_0x9c18('0x59')]({'where':{'id':_['map'](_0x39f242,_0x9c18('0x5a')),'role':_0x9c18('0x5b')},'attributes':['id',_0x9c18('0x2e'),_0x9c18('0x5c'),_0x9c18('0x5d'),_0x9c18('0x5e')]});}})[_0x9c18('0x27')](function(_0x59c9af){if(_0x59c9af){return{'count':_0x59c9af['count'],'rows':_[_0x9c18('0x30')](_0x59c9af[_0x9c18('0x5f')],function(_0x38d48b){return{'membername':_0x38d48b[_0x9c18('0x2e')],'UserId':_0x38d48b['id'],'queue_name':_0x132610[_0x9c18('0x2e')],'FaxQueueId':_0x132610['id'],'interface':util['format'](_0x9c18('0x60'),'SIP',_0x38d48b[_0x9c18('0x2e')]),'penalty':0x0,'paused':_0x38d48b['faxPause'],'createdAt':_0x38d48b[_0x9c18('0x5e')],'updatedAt':_0x38d48b[_0x9c18('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x5c3e6b,_0xa9ef5c))['catch'](handleError(_0x5c3e6b,null));};exports['getTeams']=function(_0x21f63c,_0x1e2847,_0x3f8cb1){var _0x548b83={};var _0x263b3c={};var _0x549652;var _0x1a9940;return db[_0x9c18('0x41')][_0x9c18('0x52')]({'where':{'id':_0x21f63c[_0x9c18('0x46')]['id']}})['then'](handleEntityNotFound(_0x1e2847,null))['then'](function(_0x21c33e){if(_0x21c33e){_0x549652=_0x21c33e;_0x263b3c['model']=_[_0x9c18('0x47')](db[_0x9c18('0x61')][_0x9c18('0x31')]);_0x263b3c['query']=_[_0x9c18('0x47')](_0x21f63c['query']);_0x263b3c[_0x9c18('0x36')]=_['intersection'](_0x263b3c[_0x9c18('0x34')],_0x263b3c[_0x9c18('0x35')]);_0x548b83[_0x9c18('0x38')]=_[_0x9c18('0x37')](_0x263b3c[_0x9c18('0x34')],qs['fields'](_0x21f63c[_0x9c18('0x35')]['fields']));_0x548b83[_0x9c18('0x38')]=_0x548b83[_0x9c18('0x38')]['length']?_0x548b83[_0x9c18('0x38')]:_0x263b3c[_0x9c18('0x34')];_0x548b83[_0x9c18('0x3c')]=qs[_0x9c18('0x55')](_0x21f63c[_0x9c18('0x35')][_0x9c18('0x55')]);_0x548b83[_0x9c18('0x3e')]=qs[_0x9c18('0x36')](_[_0x9c18('0x56')](_0x21f63c['query'],_0x263b3c[_0x9c18('0x36')]));if(_0x21f63c[_0x9c18('0x35')][_0x9c18('0x3d')]){_0x548b83['where']=_[_0x9c18('0x3f')](_0x548b83['where'],{'$or':_[_0x9c18('0x30')](_0x548b83[_0x9c18('0x38')],function(_0x5d9445){var _0x142a6f={};_0x142a6f[_0x5d9445]={'$like':'%'+_0x21f63c['query'][_0x9c18('0x3d')]+'%'};return _0x142a6f;})});}_0x548b83=_['merge']({},_0x548b83,_0x21f63c[_0x9c18('0x58')]);return _0x549652[_0x9c18('0x62')](_0x548b83);}})[_0x9c18('0x27')](function(_0x36a4e3){if(_0x36a4e3){_0x1a9940=_0x36a4e3['length'];if(!_0x21f63c['query'][_0x9c18('0x54')]('nolimit')){_0x548b83[_0x9c18('0x22')]=qs[_0x9c18('0x22')](_0x21f63c[_0x9c18('0x35')][_0x9c18('0x22')]);_0x548b83[_0x9c18('0x1f')]=qs[_0x9c18('0x1f')](_0x21f63c[_0x9c18('0x35')]['offset']);}return _0x549652['getTeams'](_0x548b83);}})[_0x9c18('0x27')](function(_0x30b43a){if(_0x30b43a){return _0x30b43a?{'count':_0x1a9940,'rows':_0x30b43a}:null;}})[_0x9c18('0x27')](respondWithResult(_0x1e2847,null))[_0x9c18('0x45')](handleError(_0x1e2847,null));};exports[_0x9c18('0x63')]=function(_0x3e0a28,_0x466589,_0x3650f2){var _0x58c450=_0x3e0a28[_0x9c18('0x4a')][_0x9c18('0x64')];return db[_0x9c18('0x61')][_0x9c18('0x44')]({'where':{'id':_0x58c450},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x9c18('0x2e'),_0x9c18('0x65'),'voicePause',_0x9c18('0x66')],'raw':!![]}]})[_0x9c18('0x27')](function(_0x3717f6){if(_0x3717f6){var _0x13ee1e=_[_0x9c18('0x67')](_0x3717f6,function(_0x41e6cd){var _0x52b95e=_0x41e6cd['get']({'plain':!![]});return _0x52b95e['Agents'];});return db[_0x9c18('0x41')]['find']({'where':{'id':_0x3e0a28[_0x9c18('0x46')]['id']}})[_0x9c18('0x27')](function(_0x184633){return db['sequelize']['transaction'](function(_0x5bc04a){return _0x184633[_0x9c18('0x63')](_0x58c450,{'transaction':_0x5bc04a})[_0x9c18('0x27')](function(){return BPromise[_0x9c18('0x68')](_0x13ee1e,function(_0x1c180a){return db[_0x9c18('0x53')][_0x9c18('0x69')]({'where':{'UserId':_0x1c180a['id'],'FaxQueueId':_0x3e0a28[_0x9c18('0x46')]['id']},'transaction':_0x5bc04a});});})[_0x9c18('0x27')](function(){_0x13ee1e[_0x9c18('0x6a')](function(_0x4bd5ee){socket[_0x9c18('0x6b')](_0x9c18('0x6c'),{'UserId':_0x4bd5ee['id'],'FaxQueueId':_0x184633['id']});});});});});}})[_0x9c18('0x27')](respondWithStatusCode(_0x466589,null))[_0x9c18('0x45')](handleError(_0x466589,null));};exports[_0x9c18('0x6d')]=function(_0x33ed7c,_0x6969ea,_0x264e47){return db[_0x9c18('0x61')][_0x9c18('0x44')]({'where':{'id':_0x33ed7c[_0x9c18('0x35')]['ids']},'attributes':['id'],'include':[{'model':db[_0x9c18('0x6e')],'as':_0x9c18('0x6f'),'attributes':['id'],'raw':!![]}]})[_0x9c18('0x27')](handleEntityNotFound(_0x6969ea,null))['then'](function(_0x221f27){var _0x323956=_[_0x9c18('0x30')](_0x221f27,'id');var _0x47e040=[];var _0x32af8a=[];var _0x3f053d=squel[_0x9c18('0x70')]();_0x3f053d[_0x9c18('0x71')](_0x9c18('0x72'))[_0x9c18('0x73')](_0x9c18('0x74'),'tq')[_0x9c18('0x75')](_0x9c18('0x76'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x9c18('0x3e')](_0x9c18('0x77'),_0x33ed7c[_0x9c18('0x46')]['id']);for(var _0x51db7b=0x0;_0x51db7b<_0x221f27[_0x9c18('0x3a')];_0x51db7b+=0x1){let _0x1e1cb4=_0x221f27[_0x51db7b];for(var _0x2241c5=0x0;_0x2241c5<_0x1e1cb4[_0x9c18('0x6f')]['length'];_0x2241c5+=0x1){let _0x195654=_0x1e1cb4[_0x9c18('0x6f')][_0x2241c5];var _0x5988d3=_0x3f053d[_0x9c18('0x78')]();_0x5988d3[_0x9c18('0x3e')]('ut.UserId\x20=\x20?',_0x195654['id']);_0x32af8a[_0x9c18('0x79')](db['sequelize'][_0x9c18('0x35')](_0x5988d3[_0x9c18('0x7a')](),{'type':db[_0x9c18('0x7b')][_0x9c18('0x7c')]['SELECT']})[_0x9c18('0x27')](function(_0x9750aa){if(_0x9750aa[_0x9c18('0x3a')]===0x1){return _0x195654['id'];}else{var _0xf2d4ef=_['every'](_[_0x9c18('0x30')](_0x9750aa,_0x9c18('0x7d')),function(_0x52b401){return _[_0x9c18('0x7e')](_0x323956,_0x52b401);});if(_0xf2d4ef){return _0x195654['id'];}}}));}}return BPromise['all'](_0x32af8a)[_0x9c18('0x27')](function(_0x4dd7f4){_0x47e040=_(_0x47e040)[_0x9c18('0x7f')](_0x4dd7f4)[_0x9c18('0x80')]()[_0x9c18('0x81')]();return db[_0x9c18('0x41')][_0x9c18('0x48')]({'where':{'id':_0x33ed7c[_0x9c18('0x46')]['id']}})[_0x9c18('0x27')](function(_0x3adff7){return db[_0x9c18('0x7b')]['transaction'](function(_0x4e326c){return _0x3adff7[_0x9c18('0x6d')](_0x33ed7c['query'][_0x9c18('0x64')],{'transaction':_0x4e326c})[_0x9c18('0x27')](function(){if(!_[_0x9c18('0x82')](_0x47e040)){return _0x3adff7[_0x9c18('0x83')](_0x47e040,{'transaction':_0x4e326c});}})[_0x9c18('0x27')](function(){_0x47e040[_0x9c18('0x6a')](function(_0x282944){socket[_0x9c18('0x6b')]('userFaxQueue:remove',{'UserId':_0x282944,'FaxQueueId':_0x3adff7['id']});});});});});});})[_0x9c18('0x27')](respondWithStatusCode(_0x6969ea,null))[_0x9c18('0x45')](handleError(_0x6969ea,null));};exports[_0x9c18('0x84')]=function(_0x3caa90,_0xaa829c,_0x1dc25f){return db[_0x9c18('0x41')]['find']({'where':{'id':_0x3caa90[_0x9c18('0x46')]['id']}})[_0x9c18('0x27')](handleEntityNotFound(_0xaa829c,null))[_0x9c18('0x27')](function(_0x4f7fe6){if(_0x4f7fe6){return _0x4f7fe6[_0x9c18('0x84')](_0x3caa90['body']['ids'],_[_0x9c18('0x85')](_0x3caa90['body'],['ids','id'])||{})[_0x9c18('0x86')](function(_0x409949){for(var _0x427f57=0x0;_0x427f57<_0x3caa90[_0x9c18('0x4a')][_0x9c18('0x64')]['length'];_0x427f57+=0x1){socket['emit'](_0x9c18('0x6c'),{'UserId':Number(_0x3caa90[_0x9c18('0x4a')][_0x9c18('0x64')][_0x427f57]),'FaxQueueId':Number(_0x3caa90[_0x9c18('0x46')]['id'])});}return _0x409949;});}})[_0x9c18('0x27')](respondWithResult(_0xaa829c,null))['catch'](handleError(_0xaa829c,null));};exports['removeAgents']=function(_0x5e2510,_0xaffbe5,_0x2b8efe){return db[_0x9c18('0x41')][_0x9c18('0x48')]({'where':{'id':_0x5e2510['params']['id']}})[_0x9c18('0x27')](handleEntityNotFound(_0xaffbe5,null))['then'](function(_0x2f8c80){if(_0x2f8c80){return _0x2f8c80[_0x9c18('0x83')](_0x5e2510['query']['ids'])[_0x9c18('0x27')](function(){if(_[_0x9c18('0x87')](_0x5e2510['query'][_0x9c18('0x64')])){for(var _0x4558b4=0x0;_0x4558b4<_0x5e2510[_0x9c18('0x35')][_0x9c18('0x64')][_0x9c18('0x3a')];_0x4558b4+=0x1){socket['emit'](_0x9c18('0x88'),{'UserId':Number(_0x5e2510[_0x9c18('0x35')][_0x9c18('0x64')][_0x4558b4]),'FaxQueueId':Number(_0x5e2510[_0x9c18('0x46')]['id'])});}}else{socket[_0x9c18('0x6b')](_0x9c18('0x88'),{'UserId':Number(_0x5e2510[_0x9c18('0x35')][_0x9c18('0x64')]),'FaxQueueId':Number(_0x5e2510[_0x9c18('0x46')]['id'])});}});}})[_0x9c18('0x27')](respondWithStatusCode(_0xaffbe5,null))[_0x9c18('0x45')](handleError(_0xaffbe5,null));};exports[_0x9c18('0x89')]=function(_0x1ee5c9,_0xff8d35,_0x5ae1ab){var _0x9fd8ba={};var _0x2abb49={};var _0x3dc4f7;var _0x5c214a;return db[_0x9c18('0x41')][_0x9c18('0x52')]({'where':{'id':_0x1ee5c9[_0x9c18('0x46')]['id']}})[_0x9c18('0x27')](handleEntityNotFound(_0xff8d35,null))[_0x9c18('0x27')](function(_0x501e32){if(_0x501e32){_0x3dc4f7=_0x501e32;_0x2abb49[_0x9c18('0x34')]=_[_0x9c18('0x47')](db['User'][_0x9c18('0x31')]);_0x2abb49[_0x9c18('0x35')]=_[_0x9c18('0x47')](_0x1ee5c9[_0x9c18('0x35')]);_0x2abb49[_0x9c18('0x36')]=_[_0x9c18('0x37')](_0x2abb49[_0x9c18('0x34')],_0x2abb49[_0x9c18('0x35')]);_0x9fd8ba[_0x9c18('0x38')]=_[_0x9c18('0x37')](_0x2abb49[_0x9c18('0x34')],qs[_0x9c18('0x39')](_0x1ee5c9[_0x9c18('0x35')][_0x9c18('0x39')]));_0x9fd8ba['attributes']=_0x9fd8ba['attributes'][_0x9c18('0x3a')]?_0x9fd8ba[_0x9c18('0x38')]:_0x2abb49[_0x9c18('0x34')];_0x9fd8ba[_0x9c18('0x3c')]=qs[_0x9c18('0x55')](_0x1ee5c9[_0x9c18('0x35')]['sort']);_0x9fd8ba[_0x9c18('0x3e')]=qs[_0x9c18('0x36')](_[_0x9c18('0x56')](_0x1ee5c9[_0x9c18('0x35')],_0x2abb49[_0x9c18('0x36')]));if(_0x1ee5c9[_0x9c18('0x35')][_0x9c18('0x3d')]){_0x9fd8ba['where']=_['merge'](_0x9fd8ba['where'],{'$or':_[_0x9c18('0x30')](_0x9fd8ba[_0x9c18('0x38')],function(_0x5ca25a){var _0x247425={};_0x247425[_0x5ca25a]={'$like':'%'+_0x1ee5c9[_0x9c18('0x35')]['filter']+'%'};return _0x247425;})});}_0x9fd8ba=_[_0x9c18('0x3f')]({},_0x9fd8ba,_0x1ee5c9[_0x9c18('0x58')]);return _0x3dc4f7[_0x9c18('0x89')](_0x9fd8ba);}})[_0x9c18('0x27')](function(_0x5358e5){if(_0x5358e5){_0x5c214a=_0x5358e5['length'];if(!_0x1ee5c9[_0x9c18('0x35')][_0x9c18('0x54')](_0x9c18('0x3b'))){_0x9fd8ba['limit']=qs[_0x9c18('0x22')](_0x1ee5c9[_0x9c18('0x35')]['limit']);_0x9fd8ba[_0x9c18('0x1f')]=qs['offset'](_0x1ee5c9[_0x9c18('0x35')][_0x9c18('0x1f')]);}return _0x3dc4f7['getAgents'](_0x9fd8ba);}})['then'](function(_0xbaf056){if(_0xbaf056){return _0xbaf056?{'count':_0x5c214a,'rows':_0xbaf056}:null;}})[_0x9c18('0x27')](respondWithResult(_0xff8d35,null))[_0x9c18('0x45')](handleError(_0xff8d35,null));}; \ No newline at end of file +var _0x2d18=['status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','map','FaxQueue','rawAttributes','fieldName','type','key','query','keys','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','filter','options','findAll','rows','show','params','intersection','length','includeAll','include','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserFaxQueue','FaxQueueId','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','online','voicePause','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','ids','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','removeAgents','addAgents','spread','isArray','userFaxQueue:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','to-csv','fs-extra','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus'];(function(_0x304bf7,_0x4fcafc){var _0x5036cd=function(_0x39e810){while(--_0x39e810){_0x304bf7['push'](_0x304bf7['shift']());}};_0x5036cd(++_0x4fcafc);}(_0x2d18,0x17f));var _0x82d1=function(_0x208971,_0x53abf1){_0x208971=_0x208971-0x0;var _0x26e457=_0x2d18[_0x208971];return _0x26e457;};'use strict';var emlformat=require(_0x82d1('0x0'));var rimraf=require(_0x82d1('0x1'));var zipdir=require(_0x82d1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x82d1('0x3'));var moment=require(_0x82d1('0x4'));var BPromise=require(_0x82d1('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x82d1('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x82d1('0x7'));var _=require('lodash');var squel=require(_0x82d1('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x82d1('0x9'));var toCsv=require(_0x82d1('0x6'));var querystring=require('querystring');var Papa=require(_0x82d1('0xa'));var Redis=require(_0x82d1('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x82d1('0xc'));var as=require(_0x82d1('0xd'));var hardwareService=require(_0x82d1('0xe'));var logger=require(_0x82d1('0xf'))(_0x82d1('0x10'));var utils=require(_0x82d1('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x82d1('0x12'));var db=require(_0x82d1('0x13'))['db'];config[_0x82d1('0x14')]=_[_0x82d1('0x15')](config['redis'],{'host':_0x82d1('0x16'),'port':0x18eb});var socket=require(_0x82d1('0x17'))(new Redis(config[_0x82d1('0x14')]));require('./faxQueue.socket')['register'](socket);function respondWithStatusCode(_0x5b4f94,_0x3bcd69){_0x3bcd69=_0x3bcd69||0xcc;return function(_0x33e2a6){if(_0x33e2a6){return _0x5b4f94[_0x82d1('0x18')](_0x3bcd69);}return _0x5b4f94[_0x82d1('0x19')](_0x3bcd69)['end']();};}function respondWithResult(_0x1439f6,_0x379240){_0x379240=_0x379240||0xc8;return function(_0x30665c){if(_0x30665c){return _0x1439f6[_0x82d1('0x19')](_0x379240)[_0x82d1('0x1a')](_0x30665c);}};}function respondWithFilteredResult(_0x1c1840,_0x151915){return function(_0x2f8f63){if(_0x2f8f63){var _0x23c963=typeof _0x151915[_0x82d1('0x1b')]===_0x82d1('0x1c')&&typeof _0x151915[_0x82d1('0x1d')]===_0x82d1('0x1c');var _0x4ddf46=_0x2f8f63[_0x82d1('0x1e')];var _0x2f5f60=_0x23c963?0x0:_0x151915[_0x82d1('0x1b')];var _0x4414f5=_0x23c963?_0x2f8f63[_0x82d1('0x1e')]:_0x151915[_0x82d1('0x1b')]+_0x151915['limit'];var _0x1dab23;if(_0x4414f5>=_0x4ddf46){_0x4414f5=_0x4ddf46;_0x1dab23=0xc8;}else{_0x1dab23=0xce;}_0x1c1840['status'](_0x1dab23);return _0x1c1840['set'](_0x82d1('0x1f'),_0x2f5f60+'-'+_0x4414f5+'/'+_0x4ddf46)[_0x82d1('0x1a')](_0x2f8f63);}return null;};}function patchUpdates(_0x44faaf){return function(_0x55354a){try{jsonpatch[_0x82d1('0x20')](_0x55354a,_0x44faaf,!![]);}catch(_0x95b187){return BPromise['reject'](_0x95b187);}return _0x55354a[_0x82d1('0x21')]();};}function saveUpdates(_0x3a41f4,_0x227e71){return function(_0x2911e8){if(_0x2911e8){return _0x2911e8[_0x82d1('0x22')](_0x3a41f4)[_0x82d1('0x23')](function(_0x2ebb6f){return _0x2ebb6f;});}return null;};}function removeEntity(_0x2c2d09,_0x4cd727){return function(_0x29fab7){if(_0x29fab7){return _0x29fab7[_0x82d1('0x24')]()[_0x82d1('0x23')](function(){var _0x234917=_0x29fab7[_0x82d1('0x25')]({'plain':!![]});var _0x11d8ce='FaxQueues';return db[_0x82d1('0x26')][_0x82d1('0x24')]({'where':{'type':_0x11d8ce,'resourceId':_0x234917['id']}})[_0x82d1('0x23')](function(){return _0x29fab7;});})[_0x82d1('0x23')](function(){_0x2c2d09[_0x82d1('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52c1e7,_0x2bcf3b){return function(_0x2acb72){if(!_0x2acb72){_0x52c1e7[_0x82d1('0x18')](0x194);}return _0x2acb72;};}function handleError(_0x2fbf96,_0x554d3b){_0x554d3b=_0x554d3b||0x1f4;return function(_0x20b97f){logger[_0x82d1('0x27')](_0x20b97f[_0x82d1('0x28')]);if(_0x20b97f[_0x82d1('0x29')]){delete _0x20b97f[_0x82d1('0x29')];}_0x2fbf96[_0x82d1('0x19')](_0x554d3b)[_0x82d1('0x2a')](_0x20b97f);};}exports['index']=function(_0x51aec2,_0x35c656){var _0x4bfa0d={},_0x36254a={},_0x4f51ce={'count':0x0,'rows':[]};var _0x3e8018=_[_0x82d1('0x2b')](db[_0x82d1('0x2c')][_0x82d1('0x2d')],function(_0x4f6cbd){return{'name':_0x4f6cbd[_0x82d1('0x2e')],'type':_0x4f6cbd[_0x82d1('0x2f')][_0x82d1('0x30')]};});_0x36254a['model']=_[_0x82d1('0x2b')](_0x3e8018,_0x82d1('0x29'));_0x36254a[_0x82d1('0x31')]=_[_0x82d1('0x32')](_0x51aec2[_0x82d1('0x31')]);_0x36254a['filters']=_['intersection'](_0x36254a[_0x82d1('0x33')],_0x36254a['query']);_0x4bfa0d[_0x82d1('0x34')]=_['intersection'](_0x36254a[_0x82d1('0x33')],qs[_0x82d1('0x35')](_0x51aec2[_0x82d1('0x31')][_0x82d1('0x35')]));_0x4bfa0d[_0x82d1('0x34')]=_0x4bfa0d[_0x82d1('0x34')]['length']?_0x4bfa0d[_0x82d1('0x34')]:_0x36254a['model'];if(!_0x51aec2[_0x82d1('0x31')][_0x82d1('0x36')](_0x82d1('0x37'))){_0x4bfa0d[_0x82d1('0x1d')]=qs[_0x82d1('0x1d')](_0x51aec2[_0x82d1('0x31')][_0x82d1('0x1d')]);_0x4bfa0d[_0x82d1('0x1b')]=qs[_0x82d1('0x1b')](_0x51aec2['query'][_0x82d1('0x1b')]);}_0x4bfa0d[_0x82d1('0x38')]=qs[_0x82d1('0x39')](_0x51aec2[_0x82d1('0x31')][_0x82d1('0x39')]);_0x4bfa0d['where']=qs[_0x82d1('0x3a')](_[_0x82d1('0x3b')](_0x51aec2[_0x82d1('0x31')],_0x36254a['filters']),_0x3e8018);if(_0x51aec2[_0x82d1('0x31')]['filter']){_0x4bfa0d[_0x82d1('0x3c')]=_[_0x82d1('0x3d')](_0x4bfa0d[_0x82d1('0x3c')],{'$or':_[_0x82d1('0x2b')](_0x3e8018,function(_0x20a822){if(_0x20a822[_0x82d1('0x2f')]!=='VIRTUAL'){var _0x3832d7={};_0x3832d7[_0x20a822['name']]={'$like':'%'+_0x51aec2[_0x82d1('0x31')][_0x82d1('0x3e')]+'%'};return _0x3832d7;}})});}_0x4bfa0d=_[_0x82d1('0x3d')]({},_0x4bfa0d,_0x51aec2[_0x82d1('0x3f')]);var _0x2405ef={'where':_0x4bfa0d['where']};return db[_0x82d1('0x2c')][_0x82d1('0x1e')](_0x2405ef)['then'](function(_0x470d90){_0x4f51ce[_0x82d1('0x1e')]=_0x470d90;if(_0x51aec2[_0x82d1('0x31')]['includeAll']){_0x4bfa0d['include']=[{'all':!![]}];}return db[_0x82d1('0x2c')][_0x82d1('0x40')](_0x4bfa0d);})[_0x82d1('0x23')](function(_0x4dafd2){_0x4f51ce[_0x82d1('0x41')]=_0x4dafd2;return _0x4f51ce;})['then'](respondWithFilteredResult(_0x35c656,_0x4bfa0d))['catch'](handleError(_0x35c656,null));};exports[_0x82d1('0x42')]=function(_0xf3b326,_0x1064ae){var _0x797280={'raw':!![],'where':{'id':_0xf3b326[_0x82d1('0x43')]['id']}},_0x4939cf={};_0x4939cf[_0x82d1('0x33')]=_['keys'](db[_0x82d1('0x2c')]['rawAttributes']);_0x4939cf[_0x82d1('0x31')]=_[_0x82d1('0x32')](_0xf3b326['query']);_0x4939cf[_0x82d1('0x3a')]=_[_0x82d1('0x44')](_0x4939cf['model'],_0x4939cf['query']);_0x797280['attributes']=_['intersection'](_0x4939cf['model'],qs[_0x82d1('0x35')](_0xf3b326[_0x82d1('0x31')][_0x82d1('0x35')]));_0x797280['attributes']=_0x797280[_0x82d1('0x34')][_0x82d1('0x45')]?_0x797280[_0x82d1('0x34')]:_0x4939cf[_0x82d1('0x33')];if(_0xf3b326[_0x82d1('0x31')][_0x82d1('0x46')]){_0x797280[_0x82d1('0x47')]=[{'all':!![]}];}_0x797280=_[_0x82d1('0x3d')]({},_0x797280,_0xf3b326[_0x82d1('0x3f')]);return db[_0x82d1('0x2c')]['find'](_0x797280)[_0x82d1('0x23')](handleEntityNotFound(_0x1064ae,null))[_0x82d1('0x23')](respondWithResult(_0x1064ae,null))[_0x82d1('0x48')](handleError(_0x1064ae,null));};exports[_0x82d1('0x49')]=function(_0x30fd07,_0x23bc5d){return db['FaxQueue'][_0x82d1('0x49')](_0x30fd07['body'],{})[_0x82d1('0x23')](function(_0x3d84fe){var _0x5adfc8=_0x30fd07[_0x82d1('0x4a')][_0x82d1('0x25')]({'plain':!![]});if(!_0x5adfc8)throw new Error(_0x82d1('0x4b'));if(_0x5adfc8[_0x82d1('0x4c')]==='user'){var _0xda4ac5=_0x3d84fe['get']({'plain':!![]});var _0x374150=_0x82d1('0x4d');return db['UserProfileSection'][_0x82d1('0x4e')]({'where':{'name':_0x374150,'userProfileId':_0x5adfc8['userProfileId']},'raw':!![]})[_0x82d1('0x23')](function(_0x3b17ce){if(_0x3b17ce&&_0x3b17ce['autoAssociation']===0x0){return db['UserProfileResource'][_0x82d1('0x49')]({'name':_0xda4ac5['name'],'resourceId':_0xda4ac5['id'],'type':_0x3b17ce[_0x82d1('0x29')],'sectionId':_0x3b17ce['id']},{})['then'](function(){return _0x3d84fe;});}else{return _0x3d84fe;}})[_0x82d1('0x48')](function(_0x59b0a2){logger['error'](_0x82d1('0x4f'),_0x59b0a2);throw _0x59b0a2;});}return _0x3d84fe;})[_0x82d1('0x23')](respondWithResult(_0x23bc5d,0xc9))['catch'](handleError(_0x23bc5d,null));};exports['update']=function(_0xb35ea5,_0x2bdc61){if(_0xb35ea5[_0x82d1('0x50')]['id']){delete _0xb35ea5[_0x82d1('0x50')]['id'];}return db['FaxQueue'][_0x82d1('0x4e')]({'where':{'id':_0xb35ea5['params']['id']}})[_0x82d1('0x23')](handleEntityNotFound(_0x2bdc61,null))[_0x82d1('0x23')](saveUpdates(_0xb35ea5[_0x82d1('0x50')],null))[_0x82d1('0x23')](respondWithResult(_0x2bdc61,null))['catch'](handleError(_0x2bdc61,null));};exports[_0x82d1('0x24')]=function(_0x145c21,_0x566981){return db[_0x82d1('0x2c')]['find']({'where':{'id':_0x145c21['params']['id']}})['then'](handleEntityNotFound(_0x566981,null))['then'](removeEntity(_0x566981,null))[_0x82d1('0x48')](handleError(_0x566981,null));};exports['describe']=function(_0x3f812d,_0x94d3){return db[_0x82d1('0x2c')][_0x82d1('0x51')]()['then'](respondWithResult(_0x94d3,null))[_0x82d1('0x48')](handleError(_0x94d3,null));};exports[_0x82d1('0x52')]=function(_0x42f880,_0x25d4b3,_0x5e910d){var _0xf08457={'raw':!![],'where':{}},_0x1b7bda={},_0xdc70cf;return db['FaxQueue'][_0x82d1('0x53')]({'where':{'id':_0x42f880[_0x82d1('0x43')]['id']}})['then'](handleEntityNotFound(_0x25d4b3,null))['then'](function(_0x204cef){if(_0x204cef){_0xdc70cf=_0x204cef['get']({'plain':!![]});_0x1b7bda['model']=_['keys'](db[_0x82d1('0x54')][_0x82d1('0x2d')]);_0x1b7bda['query']=_[_0x82d1('0x32')](_0x42f880[_0x82d1('0x31')]);_0x1b7bda[_0x82d1('0x3a')]=_[_0x82d1('0x44')](_0x1b7bda[_0x82d1('0x33')],_0x1b7bda['query']);_0xf08457[_0x82d1('0x34')]=_[_0x82d1('0x44')](_0x1b7bda['model'],qs[_0x82d1('0x35')](_0x42f880[_0x82d1('0x31')]['fields']));_0xf08457[_0x82d1('0x34')]=_0xf08457[_0x82d1('0x34')][_0x82d1('0x45')]?_0xf08457[_0x82d1('0x34')]:_0x1b7bda[_0x82d1('0x33')];if(!_0x42f880[_0x82d1('0x31')][_0x82d1('0x36')](_0x82d1('0x37'))){_0xf08457[_0x82d1('0x1d')]=qs[_0x82d1('0x1d')](_0x42f880[_0x82d1('0x31')][_0x82d1('0x1d')]);_0xf08457['offset']=qs[_0x82d1('0x1b')](_0x42f880[_0x82d1('0x31')][_0x82d1('0x1b')]);}_0xf08457[_0x82d1('0x38')]=qs['sort'](_0x42f880[_0x82d1('0x31')][_0x82d1('0x39')]);_0xf08457[_0x82d1('0x3c')]=qs['filters'](_[_0x82d1('0x3b')](_0x42f880[_0x82d1('0x31')],_0x1b7bda[_0x82d1('0x3a')]));_0xf08457[_0x82d1('0x3c')][_0x82d1('0x55')]=_0x204cef['id'];if(_0x42f880[_0x82d1('0x31')][_0x82d1('0x3e')]){_0xf08457[_0x82d1('0x3c')]=_[_0x82d1('0x3d')](_0xf08457['where'],{'$or':_[_0x82d1('0x2b')](_0xf08457[_0x82d1('0x34')],function(_0x51cdd9){var _0x242628={};_0x242628[_0x51cdd9]={'$like':'%'+_0x42f880['query']['filter']+'%'};return _0x242628;})});}_0xf08457=_['merge']({},_0xf08457,_0x42f880['options']);return db['UserFaxQueue'][_0x82d1('0x40')](_0xf08457);}})['then'](function(_0xf9eead){if(_0xf9eead){return db[_0x82d1('0x56')][_0x82d1('0x57')]({'where':{'id':_[_0x82d1('0x2b')](_0xf9eead,_0x82d1('0x58')),'role':_0x82d1('0x59')},'attributes':['id',_0x82d1('0x29'),_0x82d1('0x5a'),_0x82d1('0x5b'),_0x82d1('0x5c')]});}})['then'](function(_0x3e3f7d){if(_0x3e3f7d){return{'count':_0x3e3f7d[_0x82d1('0x1e')],'rows':_[_0x82d1('0x2b')](_0x3e3f7d[_0x82d1('0x41')],function(_0x64998f){return{'membername':_0x64998f[_0x82d1('0x29')],'UserId':_0x64998f['id'],'queue_name':_0xdc70cf['name'],'FaxQueueId':_0xdc70cf['id'],'interface':util[_0x82d1('0x5d')](_0x82d1('0x5e'),_0x82d1('0x5f'),_0x64998f[_0x82d1('0x29')]),'penalty':0x0,'paused':_0x64998f[_0x82d1('0x5a')],'createdAt':_0x64998f[_0x82d1('0x5c')],'updatedAt':_0x64998f[_0x82d1('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x25d4b3,_0xf08457))[_0x82d1('0x48')](handleError(_0x25d4b3,null));};exports[_0x82d1('0x60')]=function(_0x216dd3,_0x1e6e6c,_0x58d61b){var _0x545b44={};var _0x43efd2={};var _0x3aa903;var _0x3ee14b;return db[_0x82d1('0x2c')][_0x82d1('0x53')]({'where':{'id':_0x216dd3['params']['id']}})[_0x82d1('0x23')](handleEntityNotFound(_0x1e6e6c,null))[_0x82d1('0x23')](function(_0x5f5776){if(_0x5f5776){_0x3aa903=_0x5f5776;_0x43efd2['model']=_['keys'](db[_0x82d1('0x61')][_0x82d1('0x2d')]);_0x43efd2['query']=_[_0x82d1('0x32')](_0x216dd3[_0x82d1('0x31')]);_0x43efd2[_0x82d1('0x3a')]=_['intersection'](_0x43efd2['model'],_0x43efd2[_0x82d1('0x31')]);_0x545b44[_0x82d1('0x34')]=_['intersection'](_0x43efd2['model'],qs['fields'](_0x216dd3[_0x82d1('0x31')][_0x82d1('0x35')]));_0x545b44['attributes']=_0x545b44[_0x82d1('0x34')][_0x82d1('0x45')]?_0x545b44[_0x82d1('0x34')]:_0x43efd2[_0x82d1('0x33')];_0x545b44['order']=qs[_0x82d1('0x39')](_0x216dd3[_0x82d1('0x31')][_0x82d1('0x39')]);_0x545b44[_0x82d1('0x3c')]=qs['filters'](_[_0x82d1('0x3b')](_0x216dd3[_0x82d1('0x31')],_0x43efd2[_0x82d1('0x3a')]));if(_0x216dd3[_0x82d1('0x31')][_0x82d1('0x3e')]){_0x545b44[_0x82d1('0x3c')]=_[_0x82d1('0x3d')](_0x545b44[_0x82d1('0x3c')],{'$or':_[_0x82d1('0x2b')](_0x545b44['attributes'],function(_0x6357f7){var _0xe229e7={};_0xe229e7[_0x6357f7]={'$like':'%'+_0x216dd3[_0x82d1('0x31')]['filter']+'%'};return _0xe229e7;})});}_0x545b44=_[_0x82d1('0x3d')]({},_0x545b44,_0x216dd3[_0x82d1('0x3f')]);return _0x3aa903['getTeams'](_0x545b44);}})[_0x82d1('0x23')](function(_0x215297){if(_0x215297){_0x3ee14b=_0x215297[_0x82d1('0x45')];if(!_0x216dd3[_0x82d1('0x31')]['hasOwnProperty'](_0x82d1('0x37'))){_0x545b44[_0x82d1('0x1d')]=qs[_0x82d1('0x1d')](_0x216dd3['query'][_0x82d1('0x1d')]);_0x545b44[_0x82d1('0x1b')]=qs[_0x82d1('0x1b')](_0x216dd3[_0x82d1('0x31')]['offset']);}return _0x3aa903['getTeams'](_0x545b44);}})[_0x82d1('0x23')](function(_0x28b963){if(_0x28b963){return _0x28b963?{'count':_0x3ee14b,'rows':_0x28b963}:null;}})[_0x82d1('0x23')](respondWithResult(_0x1e6e6c,null))[_0x82d1('0x48')](handleError(_0x1e6e6c,null));};exports['addTeams']=function(_0xbd6a0e,_0x5a7dd3,_0x567c52){var _0x387dee=_0xbd6a0e['body']['ids'];return db[_0x82d1('0x61')]['findAll']({'where':{'id':_0x387dee},'attributes':['id'],'include':[{'model':db[_0x82d1('0x56')],'as':'Agents','attributes':['id',_0x82d1('0x29'),_0x82d1('0x62'),_0x82d1('0x63'),'interface'],'raw':!![]}]})['then'](function(_0x4cd525){if(_0x4cd525){var _0x1d0082=_[_0x82d1('0x64')](_0x4cd525,function(_0x9fb92){var _0x43fa5f=_0x9fb92[_0x82d1('0x25')]({'plain':!![]});return _0x43fa5f[_0x82d1('0x65')];});return db[_0x82d1('0x2c')]['find']({'where':{'id':_0xbd6a0e[_0x82d1('0x43')]['id']}})['then'](function(_0x3f73bc){return db[_0x82d1('0x66')][_0x82d1('0x67')](function(_0x1b3f46){return _0x3f73bc['addTeams'](_0x387dee,{'transaction':_0x1b3f46})[_0x82d1('0x23')](function(){return BPromise[_0x82d1('0x68')](_0x1d0082,function(_0x298945){return db[_0x82d1('0x54')][_0x82d1('0x69')]({'where':{'UserId':_0x298945['id'],'FaxQueueId':_0xbd6a0e[_0x82d1('0x43')]['id']},'transaction':_0x1b3f46});});})[_0x82d1('0x23')](function(){_0x1d0082[_0x82d1('0x6a')](function(_0x20e893){socket[_0x82d1('0x6b')]('userFaxQueue:save',{'UserId':_0x20e893['id'],'FaxQueueId':_0x3f73bc['id']});});});});});}})[_0x82d1('0x23')](respondWithStatusCode(_0x5a7dd3,null))[_0x82d1('0x48')](handleError(_0x5a7dd3,null));};exports[_0x82d1('0x6c')]=function(_0xb59c31,_0x726244,_0x395179){return db['Team'][_0x82d1('0x40')]({'where':{'id':_0xb59c31['query'][_0x82d1('0x6d')]},'attributes':['id'],'include':[{'model':db[_0x82d1('0x56')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x726244,null))[_0x82d1('0x23')](function(_0x211b92){var _0x19b278=_['map'](_0x211b92,'id');var _0x32e582=[];var _0x634941=[];var _0x3dc375=squel[_0x82d1('0x6e')]();_0x3dc375[_0x82d1('0x6f')](_0x82d1('0x70'))[_0x82d1('0x71')](_0x82d1('0x72'),'tq')[_0x82d1('0x73')](_0x82d1('0x74'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x82d1('0x3c')](_0x82d1('0x75'),_0xb59c31[_0x82d1('0x43')]['id']);for(var _0x501af9=0x0;_0x501af9<_0x211b92[_0x82d1('0x45')];_0x501af9+=0x1){let _0x5177ee=_0x211b92[_0x501af9];for(var _0x452144=0x0;_0x452144<_0x5177ee['Agents'][_0x82d1('0x45')];_0x452144+=0x1){let _0x5f4f03=_0x5177ee[_0x82d1('0x65')][_0x452144];var _0x4bd115=_0x3dc375[_0x82d1('0x76')]();_0x4bd115[_0x82d1('0x3c')](_0x82d1('0x77'),_0x5f4f03['id']);_0x634941['push'](db['sequelize'][_0x82d1('0x31')](_0x4bd115[_0x82d1('0x78')](),{'type':db[_0x82d1('0x66')][_0x82d1('0x79')][_0x82d1('0x7a')]})[_0x82d1('0x23')](function(_0x4ff471){if(_0x4ff471[_0x82d1('0x45')]===0x1){return _0x5f4f03['id'];}else{var _0x32863b=_[_0x82d1('0x7b')](_['map'](_0x4ff471,_0x82d1('0x7c')),function(_0x5a71b6){return _[_0x82d1('0x7d')](_0x19b278,_0x5a71b6);});if(_0x32863b){return _0x5f4f03['id'];}}}));}}return BPromise[_0x82d1('0x7e')](_0x634941)[_0x82d1('0x23')](function(_0x3b13fe){_0x32e582=_(_0x32e582)[_0x82d1('0x7f')](_0x3b13fe)[_0x82d1('0x80')]()[_0x82d1('0x81')]();return db[_0x82d1('0x2c')][_0x82d1('0x4e')]({'where':{'id':_0xb59c31[_0x82d1('0x43')]['id']}})['then'](function(_0x56c7e0){return db[_0x82d1('0x66')][_0x82d1('0x67')](function(_0x3ac20e){return _0x56c7e0['removeTeams'](_0xb59c31[_0x82d1('0x31')][_0x82d1('0x6d')],{'transaction':_0x3ac20e})['then'](function(){if(!_['isEmpty'](_0x32e582)){return _0x56c7e0[_0x82d1('0x82')](_0x32e582,{'transaction':_0x3ac20e});}})[_0x82d1('0x23')](function(){_0x32e582[_0x82d1('0x6a')](function(_0x297f50){socket[_0x82d1('0x6b')]('userFaxQueue:remove',{'UserId':_0x297f50,'FaxQueueId':_0x56c7e0['id']});});});});});});})['then'](respondWithStatusCode(_0x726244,null))['catch'](handleError(_0x726244,null));};exports['addAgents']=function(_0x36aad8,_0x25b192,_0x563479){return db[_0x82d1('0x2c')][_0x82d1('0x4e')]({'where':{'id':_0x36aad8[_0x82d1('0x43')]['id']}})['then'](handleEntityNotFound(_0x25b192,null))[_0x82d1('0x23')](function(_0x452de9){if(_0x452de9){return _0x452de9[_0x82d1('0x83')](_0x36aad8[_0x82d1('0x50')][_0x82d1('0x6d')],_['omit'](_0x36aad8[_0x82d1('0x50')],[_0x82d1('0x6d'),'id'])||{})[_0x82d1('0x84')](function(_0x3260c4){for(var _0x1bde95=0x0;_0x1bde95<_0x36aad8['body'][_0x82d1('0x6d')]['length'];_0x1bde95+=0x1){socket['emit']('userFaxQueue:save',{'UserId':Number(_0x36aad8[_0x82d1('0x50')]['ids'][_0x1bde95]),'FaxQueueId':Number(_0x36aad8[_0x82d1('0x43')]['id'])});}return _0x3260c4;});}})[_0x82d1('0x23')](respondWithResult(_0x25b192,null))[_0x82d1('0x48')](handleError(_0x25b192,null));};exports[_0x82d1('0x82')]=function(_0x3b364c,_0x428267,_0x40bf3f){return db[_0x82d1('0x2c')][_0x82d1('0x4e')]({'where':{'id':_0x3b364c[_0x82d1('0x43')]['id']}})[_0x82d1('0x23')](handleEntityNotFound(_0x428267,null))[_0x82d1('0x23')](function(_0x181992){if(_0x181992){return _0x181992['removeAgents'](_0x3b364c['query'][_0x82d1('0x6d')])[_0x82d1('0x23')](function(){if(_[_0x82d1('0x85')](_0x3b364c[_0x82d1('0x31')][_0x82d1('0x6d')])){for(var _0xaf4c69=0x0;_0xaf4c69<_0x3b364c[_0x82d1('0x31')]['ids'][_0x82d1('0x45')];_0xaf4c69+=0x1){socket[_0x82d1('0x6b')](_0x82d1('0x86'),{'UserId':Number(_0x3b364c[_0x82d1('0x31')][_0x82d1('0x6d')][_0xaf4c69]),'FaxQueueId':Number(_0x3b364c[_0x82d1('0x43')]['id'])});}}else{socket['emit'](_0x82d1('0x86'),{'UserId':Number(_0x3b364c[_0x82d1('0x31')][_0x82d1('0x6d')]),'FaxQueueId':Number(_0x3b364c['params']['id'])});}});}})[_0x82d1('0x23')](respondWithStatusCode(_0x428267,null))['catch'](handleError(_0x428267,null));};exports[_0x82d1('0x87')]=function(_0x19e83d,_0x911f40,_0x245f5b){var _0x30286b={};var _0x34202c={};var _0x2e3799;var _0x3cafd1;return db['FaxQueue']['findOne']({'where':{'id':_0x19e83d[_0x82d1('0x43')]['id']}})[_0x82d1('0x23')](handleEntityNotFound(_0x911f40,null))[_0x82d1('0x23')](function(_0xcccc55){if(_0xcccc55){_0x2e3799=_0xcccc55;_0x34202c[_0x82d1('0x33')]=_[_0x82d1('0x32')](db['User']['rawAttributes']);_0x34202c[_0x82d1('0x31')]=_[_0x82d1('0x32')](_0x19e83d[_0x82d1('0x31')]);_0x34202c[_0x82d1('0x3a')]=_[_0x82d1('0x44')](_0x34202c[_0x82d1('0x33')],_0x34202c[_0x82d1('0x31')]);_0x30286b[_0x82d1('0x34')]=_[_0x82d1('0x44')](_0x34202c[_0x82d1('0x33')],qs['fields'](_0x19e83d[_0x82d1('0x31')]['fields']));_0x30286b[_0x82d1('0x34')]=_0x30286b[_0x82d1('0x34')][_0x82d1('0x45')]?_0x30286b[_0x82d1('0x34')]:_0x34202c[_0x82d1('0x33')];_0x30286b[_0x82d1('0x38')]=qs[_0x82d1('0x39')](_0x19e83d[_0x82d1('0x31')]['sort']);_0x30286b['where']=qs['filters'](_[_0x82d1('0x3b')](_0x19e83d[_0x82d1('0x31')],_0x34202c[_0x82d1('0x3a')]));if(_0x19e83d[_0x82d1('0x31')][_0x82d1('0x3e')]){_0x30286b[_0x82d1('0x3c')]=_[_0x82d1('0x3d')](_0x30286b[_0x82d1('0x3c')],{'$or':_[_0x82d1('0x2b')](_0x30286b[_0x82d1('0x34')],function(_0x57e291){var _0x30eab5={};_0x30eab5[_0x57e291]={'$like':'%'+_0x19e83d['query']['filter']+'%'};return _0x30eab5;})});}_0x30286b=_[_0x82d1('0x3d')]({},_0x30286b,_0x19e83d[_0x82d1('0x3f')]);return _0x2e3799['getAgents'](_0x30286b);}})[_0x82d1('0x23')](function(_0xf28318){if(_0xf28318){_0x3cafd1=_0xf28318['length'];if(!_0x19e83d[_0x82d1('0x31')][_0x82d1('0x36')](_0x82d1('0x37'))){_0x30286b[_0x82d1('0x1d')]=qs['limit'](_0x19e83d[_0x82d1('0x31')][_0x82d1('0x1d')]);_0x30286b[_0x82d1('0x1b')]=qs[_0x82d1('0x1b')](_0x19e83d[_0x82d1('0x31')][_0x82d1('0x1b')]);}return _0x2e3799[_0x82d1('0x87')](_0x30286b);}})[_0x82d1('0x23')](function(_0x5838e4){if(_0x5838e4){return _0x5838e4?{'count':_0x3cafd1,'rows':_0x5838e4}:null;}})[_0x82d1('0x23')](respondWithResult(_0x911f40,null))[_0x82d1('0x48')](handleError(_0x911f40,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 0864e53..99c0b96 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 _0xa37d=['hasOwnProperty','hook','exports','../../mysqldb','FaxQueue','setMaxListeners','save','update','remove','emit'];(function(_0x320cd2,_0x563ec1){var _0x49bc84=function(_0x433155){while(--_0x433155){_0x320cd2['push'](_0x320cd2['shift']());}};_0x49bc84(++_0x563ec1);}(_0xa37d,0x19d));var _0xda37=function(_0x4fde9a,_0x5d1eda){_0x4fde9a=_0x4fde9a-0x0;var _0x58f321=_0xa37d[_0x4fde9a];return _0x58f321;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0xda37('0x0'))['db'][_0xda37('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xda37('0x2')](0x0);var events={'afterCreate':_0xda37('0x3'),'afterUpdate':_0xda37('0x4'),'afterDestroy':_0xda37('0x5')};function emitEvent(_0x15171b){return function(_0x4865c7,_0x30ba5e,_0xc1de9f){FaxQueueEvents[_0xda37('0x6')](_0x15171b+':'+_0x4865c7['id'],_0x4865c7);FaxQueueEvents[_0xda37('0x6')](_0x15171b,_0x4865c7);_0xc1de9f(null);};}for(var e in events){if(events[_0xda37('0x7')](e)){var event=events[e];FaxQueue[_0xda37('0x8')](e,emitEvent(event));}}module[_0xda37('0x9')]=FaxQueueEvents; \ No newline at end of file +var _0x2af6=['hook','exports','events','FaxQueue','setMaxListeners','save','update','hasOwnProperty'];(function(_0x1e4a4a,_0x625229){var _0x215c1d=function(_0x2d6a79){while(--_0x2d6a79){_0x1e4a4a['push'](_0x1e4a4a['shift']());}};_0x215c1d(++_0x625229);}(_0x2af6,0x19a));var _0x62af=function(_0x475526,_0x46dd5f){_0x475526=_0x475526-0x0;var _0x112ce8=_0x2af6[_0x475526];return _0x112ce8;};'use strict';var EventEmitter=require(_0x62af('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x62af('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x62af('0x2')](0x0);var events={'afterCreate':_0x62af('0x3'),'afterUpdate':_0x62af('0x4'),'afterDestroy':'remove'};function emitEvent(_0x530ac6){return function(_0x545a83,_0x4e7c2d,_0x345673){FaxQueueEvents['emit'](_0x530ac6+':'+_0x545a83['id'],_0x545a83);FaxQueueEvents['emit'](_0x530ac6,_0x545a83);_0x345673(null);};}for(var e in events){if(events[_0x62af('0x5')](e)){var event=events[e];FaxQueue[_0x62af('0x6')](e,emitEvent(event));}}module[_0x62af('0x7')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index a96930d..f884a20 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 _0xf87e=['path','../../config/environment','define','FaxQueue','fax_queues','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x2bf5c0,_0x116255){var _0x36c63c=function(_0x9cc164){while(--_0x9cc164){_0x2bf5c0['push'](_0x2bf5c0['shift']());}};_0x36c63c(++_0x116255);}(_0xf87e,0x11d));var _0xef87=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0xf87e[_0x409353];return _0x4f4b59;};'use strict';var _=require(_0xef87('0x0'));var util=require('util');var logger=require(_0xef87('0x1'))(_0xef87('0x2'));var moment=require('moment');var BPromise=require(_0xef87('0x3'));var rp=require(_0xef87('0x4'));var fs=require('fs');var path=require(_0xef87('0x5'));var rimraf=require('rimraf');var config=require(_0xef87('0x6'));var attributes=require('./faxQueue.attributes');module['exports']=function(_0x31626e,_0x299501){return _0x31626e[_0xef87('0x7')](_0xef87('0x8'),attributes,{'tableName':_0xef87('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed71=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xed71,0xc3));var _0x1ed7=function(_0x57e18a,_0x199383){_0x57e18a=_0x57e18a-0x0;var _0x1181c7=_0xed71[_0x57e18a];return _0x1181c7;};'use strict';var _=require(_0x1ed7('0x0'));var util=require(_0x1ed7('0x1'));var logger=require(_0x1ed7('0x2'))(_0x1ed7('0x3'));var moment=require(_0x1ed7('0x4'));var BPromise=require(_0x1ed7('0x5'));var rp=require(_0x1ed7('0x6'));var fs=require('fs');var path=require(_0x1ed7('0x7'));var rimraf=require(_0x1ed7('0x8'));var config=require('../../config/environment');var attributes=require(_0x1ed7('0x9'));module[_0x1ed7('0xa')]=function(_0x399bff,_0x1e2770){return _0x399bff[_0x1ed7('0xb')](_0x1ed7('0xc'),attributes,{'tableName':_0x1ed7('0xd'),'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 75b2958..6f03aff 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 _0xe110=['result','catch','FaxQueue','findAll','options','raw','attributes','include','map','model','GetFaxQueue','find','ShowFaxQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','register','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1fcaf1,_0x21c3c2){var _0x55f464=function(_0x348eb3){while(--_0x348eb3){_0x1fcaf1['push'](_0x1fcaf1['shift']());}};_0x55f464(++_0x21c3c2);}(_0xe110,0x1d5));var _0x0e11=function(_0x2e5cfd,_0x3e18a1){_0x2e5cfd=_0x2e5cfd-0x0;var _0x171636=_0xe110[_0x2e5cfd];return _0x171636;};'use strict';var _=require(_0x0e11('0x0'));var util=require(_0x0e11('0x1'));var moment=require(_0x0e11('0x2'));var BPromise=require(_0x0e11('0x3'));var rs=require(_0x0e11('0x4'));var fs=require('fs');var Redis=require(_0x0e11('0x5'));var db=require(_0x0e11('0x6'))['db'];var utils=require(_0x0e11('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x0e11('0x8'));var jayson=require(_0x0e11('0x9'));var client=jayson[_0x0e11('0xa')][_0x0e11('0xb')]({'port':0x232a});config[_0x0e11('0xc')]=_['defaults'](config[_0x0e11('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x0e11('0xd'))(new Redis(config['redis']));require('./faxQueue.socket')[_0x0e11('0xe')](socket);function respondWithRpcPromise(_0x579b1a,_0x248a1f,_0x4da43b){return new BPromise(function(_0x2ce440,_0x140ec3){return client['request'](_0x579b1a,_0x4da43b)[_0x0e11('0xf')](function(_0x443804){logger[_0x0e11('0x10')](_0x0e11('0x11'),_0x248a1f,_0x0e11('0x12'));logger[_0x0e11('0x13')](_0x0e11('0x14'),_0x248a1f,_0x0e11('0x12'),JSON[_0x0e11('0x15')](_0x443804));if(_0x443804[_0x0e11('0x16')]){if(_0x443804[_0x0e11('0x16')][_0x0e11('0x17')]===0x1f4){logger[_0x0e11('0x16')](_0x0e11('0x11'),_0x248a1f,_0x443804['error'][_0x0e11('0x18')]);return _0x140ec3(_0x443804[_0x0e11('0x16')][_0x0e11('0x18')]);}logger[_0x0e11('0x16')](_0x0e11('0x11'),_0x248a1f,_0x443804['error'][_0x0e11('0x18')]);return _0x2ce440(_0x443804[_0x0e11('0x16')]['message']);}else{logger[_0x0e11('0x10')](_0x0e11('0x11'),_0x248a1f,_0x0e11('0x12'));_0x2ce440(_0x443804[_0x0e11('0x19')]['message']);}})[_0x0e11('0x1a')](function(_0x2cb008){logger[_0x0e11('0x16')](_0x0e11('0x11'),_0x248a1f,_0x2cb008);_0x140ec3(_0x2cb008);});});}exports['GetFaxQueue']=function(_0x38a525){var _0x3b4846=this;return new Promise(function(_0x40320c,_0x485e49){return db[_0x0e11('0x1b')][_0x0e11('0x1c')]({'raw':_0x38a525[_0x0e11('0x1d')]?_0x38a525[_0x0e11('0x1d')][_0x0e11('0x1e')]===undefined?!![]:![]:!![],'where':_0x38a525['options']?_0x38a525[_0x0e11('0x1d')]['where']||null:null,'attributes':_0x38a525['options']?_0x38a525[_0x0e11('0x1d')][_0x0e11('0x1f')]||null:null,'limit':_0x38a525[_0x0e11('0x1d')]?_0x38a525['options']['limit']||null:null,'include':_0x38a525['options']?_0x38a525[_0x0e11('0x1d')][_0x0e11('0x20')]?_[_0x0e11('0x21')](_0x38a525['options']['include'],function(_0x29d2e6){return{'model':db[_0x29d2e6[_0x0e11('0x22')]],'as':_0x29d2e6['as'],'attributes':_0x29d2e6[_0x0e11('0x1f')],'include':_0x29d2e6[_0x0e11('0x20')]?_['map'](_0x29d2e6[_0x0e11('0x20')],function(_0x58309b){return{'model':db[_0x58309b[_0x0e11('0x22')]],'as':_0x58309b['as'],'attributes':_0x58309b[_0x0e11('0x1f')],'include':_0x58309b[_0x0e11('0x20')]?_[_0x0e11('0x21')](_0x58309b[_0x0e11('0x20')],function(_0x444785){return{'model':db[_0x444785[_0x0e11('0x22')]],'as':_0x444785['as'],'attributes':_0x444785[_0x0e11('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0e11('0xf')](function(_0x211203){logger[_0x0e11('0x10')](_0x0e11('0x23'),_0x38a525);logger['debug'](_0x0e11('0x23'),_0x38a525,JSON['stringify'](_0x211203));_0x40320c(_0x211203);})[_0x0e11('0x1a')](function(_0x70cdc0){logger[_0x0e11('0x16')](_0x0e11('0x23'),_0x70cdc0[_0x0e11('0x18')],_0x38a525);_0x485e49(_0x3b4846[_0x0e11('0x16')](0x1f4,_0x70cdc0['message']));});});};exports['ShowFaxQueue']=function(_0x31735e){var _0x210e55=this;return new Promise(function(_0x21555b,_0x1c9c48){return db[_0x0e11('0x1b')][_0x0e11('0x24')]({'raw':_0x31735e['options']?_0x31735e[_0x0e11('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x31735e['options']?_0x31735e['options']['where']||null:null,'attributes':_0x31735e[_0x0e11('0x1d')]?_0x31735e[_0x0e11('0x1d')]['attributes']||null:null,'include':_0x31735e['options']?_0x31735e[_0x0e11('0x1d')]['include']?_['map'](_0x31735e['options'][_0x0e11('0x20')],function(_0x3e3f61){return{'model':db[_0x3e3f61[_0x0e11('0x22')]],'as':_0x3e3f61['as'],'attributes':_0x3e3f61['attributes'],'include':_0x3e3f61[_0x0e11('0x20')]?_[_0x0e11('0x21')](_0x3e3f61['include'],function(_0x3e6280){return{'model':db[_0x3e6280['model']],'as':_0x3e6280['as'],'attributes':_0x3e6280[_0x0e11('0x1f')],'include':_0x3e6280['include']?_[_0x0e11('0x21')](_0x3e6280[_0x0e11('0x20')],function(_0x4a95fe){return{'model':db[_0x4a95fe['model']],'as':_0x4a95fe['as'],'attributes':_0x4a95fe[_0x0e11('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0e11('0xf')](function(_0x3ec829){logger[_0x0e11('0x10')](_0x0e11('0x25'),_0x31735e);logger[_0x0e11('0x13')](_0x0e11('0x25'),_0x31735e,JSON[_0x0e11('0x15')](_0x3ec829));_0x21555b(_0x3ec829);})[_0x0e11('0x1a')](function(_0x4ef598){logger[_0x0e11('0x16')](_0x0e11('0x25'),_0x4ef598[_0x0e11('0x18')],_0x31735e);_0x1c9c48(_0x210e55[_0x0e11('0x16')](0x1f4,_0x4ef598[_0x0e11('0x18')]));});});}; \ No newline at end of file +var _0x8b74=['FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','FaxQueue,\x20%s,\x20%s','result','catch','FaxQueue','findAll','options','raw','where','attributes','include','model','map','then','GetFaxQueue','ShowFaxQueue','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./faxQueue.socket','register','request','info','request\x20sent','debug'];(function(_0x2e7c96,_0x27804d){var _0x36008e=function(_0xd03b6b){while(--_0xd03b6b){_0x2e7c96['push'](_0x2e7c96['shift']());}};_0x36008e(++_0x27804d);}(_0x8b74,0x1cb));var _0x48b7=function(_0x2e7313,_0x2ce034){_0x2e7313=_0x2e7313-0x0;var _0x3dfa6e=_0x8b74[_0x2e7313];return _0x3dfa6e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x48b7('0x0'));var BPromise=require(_0x48b7('0x1'));var rs=require(_0x48b7('0x2'));var fs=require('fs');var Redis=require(_0x48b7('0x3'));var db=require(_0x48b7('0x4'))['db'];var utils=require(_0x48b7('0x5'));var logger=require(_0x48b7('0x6'))(_0x48b7('0x7'));var config=require(_0x48b7('0x8'));var jayson=require(_0x48b7('0x9'));var client=jayson[_0x48b7('0xa')][_0x48b7('0xb')]({'port':0x232a});config[_0x48b7('0xc')]=_[_0x48b7('0xd')](config[_0x48b7('0xc')],{'host':_0x48b7('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x48b7('0xc')]));require(_0x48b7('0xf'))[_0x48b7('0x10')](socket);function respondWithRpcPromise(_0x48964b,_0x5cf8ed,_0x5f5827){return new BPromise(function(_0x172203,_0x2719f8){return client[_0x48b7('0x11')](_0x48964b,_0x5f5827)['then'](function(_0x4093a5){logger[_0x48b7('0x12')]('FaxQueue,\x20%s,\x20%s',_0x5cf8ed,_0x48b7('0x13'));logger[_0x48b7('0x14')](_0x48b7('0x15'),_0x5cf8ed,_0x48b7('0x13'),JSON[_0x48b7('0x16')](_0x4093a5));if(_0x4093a5[_0x48b7('0x17')]){if(_0x4093a5[_0x48b7('0x17')]['code']===0x1f4){logger[_0x48b7('0x17')]('FaxQueue,\x20%s,\x20%s',_0x5cf8ed,_0x4093a5['error'][_0x48b7('0x18')]);return _0x2719f8(_0x4093a5[_0x48b7('0x17')][_0x48b7('0x18')]);}logger[_0x48b7('0x17')]('FaxQueue,\x20%s,\x20%s',_0x5cf8ed,_0x4093a5['error'][_0x48b7('0x18')]);return _0x172203(_0x4093a5[_0x48b7('0x17')][_0x48b7('0x18')]);}else{logger['info'](_0x48b7('0x19'),_0x5cf8ed,_0x48b7('0x13'));_0x172203(_0x4093a5[_0x48b7('0x1a')][_0x48b7('0x18')]);}})[_0x48b7('0x1b')](function(_0x3a627b){logger['error'](_0x48b7('0x19'),_0x5cf8ed,_0x3a627b);_0x2719f8(_0x3a627b);});});}exports['GetFaxQueue']=function(_0x1bb040){var _0x369be=this;return new Promise(function(_0x357a0c,_0x154fa9){return db[_0x48b7('0x1c')][_0x48b7('0x1d')]({'raw':_0x1bb040[_0x48b7('0x1e')]?_0x1bb040[_0x48b7('0x1e')][_0x48b7('0x1f')]===undefined?!![]:![]:!![],'where':_0x1bb040[_0x48b7('0x1e')]?_0x1bb040[_0x48b7('0x1e')][_0x48b7('0x20')]||null:null,'attributes':_0x1bb040['options']?_0x1bb040[_0x48b7('0x1e')][_0x48b7('0x21')]||null:null,'limit':_0x1bb040[_0x48b7('0x1e')]?_0x1bb040[_0x48b7('0x1e')]['limit']||null:null,'include':_0x1bb040[_0x48b7('0x1e')]?_0x1bb040['options'][_0x48b7('0x22')]?_['map'](_0x1bb040[_0x48b7('0x1e')][_0x48b7('0x22')],function(_0x49ea78){return{'model':db[_0x49ea78[_0x48b7('0x23')]],'as':_0x49ea78['as'],'attributes':_0x49ea78['attributes'],'include':_0x49ea78[_0x48b7('0x22')]?_[_0x48b7('0x24')](_0x49ea78[_0x48b7('0x22')],function(_0x2e584f){return{'model':db[_0x2e584f[_0x48b7('0x23')]],'as':_0x2e584f['as'],'attributes':_0x2e584f['attributes'],'include':_0x2e584f[_0x48b7('0x22')]?_[_0x48b7('0x24')](_0x2e584f[_0x48b7('0x22')],function(_0x13b058){return{'model':db[_0x13b058[_0x48b7('0x23')]],'as':_0x13b058['as'],'attributes':_0x13b058[_0x48b7('0x21')]};}):[]};}):[]};}):[]:[]})[_0x48b7('0x25')](function(_0x49cb50){logger[_0x48b7('0x12')](_0x48b7('0x26'),_0x1bb040);logger[_0x48b7('0x14')](_0x48b7('0x26'),_0x1bb040,JSON[_0x48b7('0x16')](_0x49cb50));_0x357a0c(_0x49cb50);})[_0x48b7('0x1b')](function(_0x103567){logger['error'](_0x48b7('0x26'),_0x103567[_0x48b7('0x18')],_0x1bb040);_0x154fa9(_0x369be[_0x48b7('0x17')](0x1f4,_0x103567[_0x48b7('0x18')]));});});};exports[_0x48b7('0x27')]=function(_0x46e978){var _0x2d142a=this;return new Promise(function(_0x2c768e,_0x3f6c55){return db[_0x48b7('0x1c')]['find']({'raw':_0x46e978[_0x48b7('0x1e')]?_0x46e978[_0x48b7('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x46e978['options']?_0x46e978[_0x48b7('0x1e')]['where']||null:null,'attributes':_0x46e978[_0x48b7('0x1e')]?_0x46e978[_0x48b7('0x1e')]['attributes']||null:null,'include':_0x46e978['options']?_0x46e978[_0x48b7('0x1e')][_0x48b7('0x22')]?_[_0x48b7('0x24')](_0x46e978[_0x48b7('0x1e')]['include'],function(_0x1a08d1){return{'model':db[_0x1a08d1[_0x48b7('0x23')]],'as':_0x1a08d1['as'],'attributes':_0x1a08d1[_0x48b7('0x21')],'include':_0x1a08d1[_0x48b7('0x22')]?_[_0x48b7('0x24')](_0x1a08d1['include'],function(_0x3181bd){return{'model':db[_0x3181bd[_0x48b7('0x23')]],'as':_0x3181bd['as'],'attributes':_0x3181bd[_0x48b7('0x21')],'include':_0x3181bd[_0x48b7('0x22')]?_['map'](_0x3181bd[_0x48b7('0x22')],function(_0x37ceb0){return{'model':db[_0x37ceb0[_0x48b7('0x23')]],'as':_0x37ceb0['as'],'attributes':_0x37ceb0[_0x48b7('0x21')]};}):[]};}):[]};}):[]:[]})[_0x48b7('0x25')](function(_0x2fb443){logger[_0x48b7('0x12')](_0x48b7('0x27'),_0x46e978);logger[_0x48b7('0x14')](_0x48b7('0x27'),_0x46e978,JSON[_0x48b7('0x16')](_0x2fb443));_0x2c768e(_0x2fb443);})[_0x48b7('0x1b')](function(_0x19a38f){logger[_0x48b7('0x17')](_0x48b7('0x27'),_0x19a38f[_0x48b7('0x18')],_0x46e978);_0x3f6c55(_0x2d142a[_0x48b7('0x17')](0x1f4,_0x19a38f[_0x48b7('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index da6d41c..fc995d2 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 _0xd0a4=['remove','update','./faxQueue.events','save'];(function(_0x505d3b,_0x26b68f){var _0x4b108a=function(_0x275daa){while(--_0x275daa){_0x505d3b['push'](_0x505d3b['shift']());}};_0x4b108a(++_0x26b68f);}(_0xd0a4,0x13e));var _0x4d0a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd0a4[_0x3dd15e];return _0x231fd0;};'use strict';var FaxQueueEvents=require(_0x4d0a('0x0'));var events=[_0x4d0a('0x1'),_0x4d0a('0x2'),_0x4d0a('0x3')];function createListener(_0x34644b,_0x1d4d97){return function(_0xe486d0){_0x1d4d97['emit'](_0x34644b,_0xe486d0);};}function removeListener(_0x344180,_0x98ca03){return function(){FaxQueueEvents['removeListener'](_0x344180,_0x98ca03);};}exports['register']=function(_0x4dae1f){for(var _0x44c7a7=0x0,_0x5ebbb3=events['length'];_0x44c7a7<_0x5ebbb3;_0x44c7a7++){var _0x2491d0=events[_0x44c7a7];var _0x5b1797=createListener('faxQueue:'+_0x2491d0,_0x4dae1f);FaxQueueEvents['on'](_0x2491d0,_0x5b1797);}}; \ No newline at end of file +var _0xbc1c=['update','emit','removeListener','register','length','faxQueue:','save'];(function(_0x1100ec,_0x4c97b1){var _0x9d4dee=function(_0x2bf8a9){while(--_0x2bf8a9){_0x1100ec['push'](_0x1100ec['shift']());}};_0x9d4dee(++_0x4c97b1);}(_0xbc1c,0xd8));var _0xcbc1=function(_0x2ca616,_0x384ec8){_0x2ca616=_0x2ca616-0x0;var _0x53155f=_0xbc1c[_0x2ca616];return _0x53155f;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0xcbc1('0x0'),'remove',_0xcbc1('0x1')];function createListener(_0x520b06,_0x4566f7){return function(_0x4108fb){_0x4566f7[_0xcbc1('0x2')](_0x520b06,_0x4108fb);};}function removeListener(_0x2d19b9,_0x55e7ed){return function(){FaxQueueEvents[_0xcbc1('0x3')](_0x2d19b9,_0x55e7ed);};}exports[_0xcbc1('0x4')]=function(_0x54c13c){for(var _0x27da8d=0x0,_0x39cb56=events[_0xcbc1('0x5')];_0x27da8d<_0x39cb56;_0x27da8d++){var _0x4837b7=events[_0x27da8d];var _0x40fa2d=createListener(_0xcbc1('0x6')+_0x4837b7,_0x54c13c);FaxQueueEvents['on'](_0x4837b7,_0x40fa2d);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 628e272..483bac0 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 _0xb091=['/:id','show','/:id/members','getMembers','getTeams','getAgents','post','create','/:id/teams','addTeams','/:id/users','addAgents','put','update','delete','destroy','removeTeams','removeAgents','util','path','connect-timeout','express','fs-extra','../../config/environment','./faxQueue.controller','isAuthenticated','index','get','describe'];(function(_0x576197,_0x21ffeb){var _0x53c2ee=function(_0x3f0c3c){while(--_0x3f0c3c){_0x576197['push'](_0x576197['shift']());}};_0x53c2ee(++_0x21ffeb);}(_0xb091,0x16e));var _0x1b09=function(_0x1a0a37,_0x11dc36){_0x1a0a37=_0x1a0a37-0x0;var _0xf9983b=_0xb091[_0x1a0a37];return _0xf9983b;};'use strict';var multer=require('multer');var util=require(_0x1b09('0x0'));var path=require(_0x1b09('0x1'));var timeout=require(_0x1b09('0x2'));var express=require(_0x1b09('0x3'));var router=express['Router']();var fs_extra=require(_0x1b09('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1b09('0x5'));var controller=require(_0x1b09('0x6'));router['get']('/',auth[_0x1b09('0x7')](),controller[_0x1b09('0x8')]);router[_0x1b09('0x9')]('/describe',auth[_0x1b09('0x7')](),controller[_0x1b09('0xa')]);router[_0x1b09('0x9')](_0x1b09('0xb'),auth[_0x1b09('0x7')](),controller[_0x1b09('0xc')]);router[_0x1b09('0x9')](_0x1b09('0xd'),auth[_0x1b09('0x7')](),controller[_0x1b09('0xe')]);router[_0x1b09('0x9')]('/:id/teams',auth[_0x1b09('0x7')](),controller[_0x1b09('0xf')]);router['get']('/:id/users',auth[_0x1b09('0x7')](),controller[_0x1b09('0x10')]);router[_0x1b09('0x11')]('/',auth[_0x1b09('0x7')](),controller[_0x1b09('0x12')]);router[_0x1b09('0x11')](_0x1b09('0x13'),auth['isAuthenticated'](),controller[_0x1b09('0x14')]);router['post'](_0x1b09('0x15'),auth[_0x1b09('0x7')](),controller[_0x1b09('0x16')]);router[_0x1b09('0x17')](_0x1b09('0xb'),auth[_0x1b09('0x7')](),controller[_0x1b09('0x18')]);router[_0x1b09('0x19')](_0x1b09('0xb'),auth[_0x1b09('0x7')](),controller[_0x1b09('0x1a')]);router[_0x1b09('0x19')](_0x1b09('0x13'),auth['isAuthenticated'](),controller[_0x1b09('0x1b')]);router[_0x1b09('0x19')]('/:id/users',auth['isAuthenticated'](),controller[_0x1b09('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xee3c=['./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','put','delete','destroy','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0xee3c,0x14a));var _0xcee3=function(_0x3cca2a,_0x3a7577){_0x3cca2a=_0x3cca2a-0x0;var _0x105692=_0xee3c[_0x3cca2a];return _0x105692;};'use strict';var multer=require(_0xcee3('0x0'));var util=require(_0xcee3('0x1'));var path=require(_0xcee3('0x2'));var timeout=require(_0xcee3('0x3'));var express=require(_0xcee3('0x4'));var router=express[_0xcee3('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xcee3('0x6'));var config=require(_0xcee3('0x7'));var controller=require(_0xcee3('0x8'));router[_0xcee3('0x9')]('/',auth[_0xcee3('0xa')](),controller[_0xcee3('0xb')]);router[_0xcee3('0x9')](_0xcee3('0xc'),auth[_0xcee3('0xa')](),controller[_0xcee3('0xd')]);router[_0xcee3('0x9')](_0xcee3('0xe'),auth[_0xcee3('0xa')](),controller[_0xcee3('0xf')]);router[_0xcee3('0x9')]('/:id/members',auth[_0xcee3('0xa')](),controller[_0xcee3('0x10')]);router[_0xcee3('0x9')](_0xcee3('0x11'),auth[_0xcee3('0xa')](),controller[_0xcee3('0x12')]);router['get'](_0xcee3('0x13'),auth[_0xcee3('0xa')](),controller[_0xcee3('0x14')]);router[_0xcee3('0x15')]('/',auth[_0xcee3('0xa')](),controller['create']);router[_0xcee3('0x15')]('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router[_0xcee3('0x15')](_0xcee3('0x13'),auth['isAuthenticated'](),controller['addAgents']);router[_0xcee3('0x16')]('/:id',auth[_0xcee3('0xa')](),controller['update']);router[_0xcee3('0x17')](_0xcee3('0xe'),auth['isAuthenticated'](),controller[_0xcee3('0x18')]);router[_0xcee3('0x17')](_0xcee3('0x11'),auth[_0xcee3('0xa')](),controller['removeTeams']);router[_0xcee3('0x17')](_0xcee3('0x13'),auth[_0xcee3('0xa')](),controller[_0xcee3('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 99d219a..ae8afc6 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 _0x4af4=['sequelize','exports','STRING','DATE','moment'];(function(_0x2e8fd1,_0x17377c){var _0x1d6927=function(_0x4743fc){while(--_0x4743fc){_0x2e8fd1['push'](_0x2e8fd1['shift']());}};_0x1d6927(++_0x17377c);}(_0x4af4,0x13f));var _0x44af=function(_0x4d60ee,_0x2f5206){_0x4d60ee=_0x4d60ee-0x0;var _0x4d772c=_0x4af4[_0x4d60ee];return _0x4d772c;};'use strict';var moment=require(_0x44af('0x0'));var Sequelize=require(_0x44af('0x1'));module[_0x44af('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x44af('0x3')]},'joinAt':{'type':Sequelize[_0x44af('0x4')]},'leaveAt':{'type':Sequelize[_0x44af('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x44af('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1d01=['exports','STRING','DATE','moment','sequelize'];(function(_0x4b49ad,_0x5cae3f){var _0x10fffe=function(_0x4cf4fc){while(--_0x4cf4fc){_0x4b49ad['push'](_0x4b49ad['shift']());}};_0x10fffe(++_0x5cae3f);}(_0x1d01,0xb7));var _0x11d0=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1d01[_0x2641f9];return _0x585741;};'use strict';var moment=require(_0x11d0('0x0'));var Sequelize=require(_0x11d0('0x1'));module[_0x11d0('0x2')]={'uniqueid':{'type':Sequelize[_0x11d0('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x11d0('0x3')]},'joinAt':{'type':Sequelize[_0x11d0('0x4')]},'leaveAt':{'type':Sequelize[_0x11d0('0x4')]},'acceptAt':{'type':Sequelize[_0x11d0('0x4')]},'exitAt':{'type':Sequelize[_0x11d0('0x4')]},'reason':{'type':Sequelize[_0x11d0('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index faca1b0..12a50a8 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 _0x0eec=['limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','offset','json','apply','reject','update','destroy','then','end','stack','name','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty'];(function(_0x3f4315,_0xd6ec89){var _0x5842e3=function(_0x4b12f5){while(--_0x4b12f5){_0x3f4315['push'](_0x3f4315['shift']());}};_0x5842e3(++_0xd6ec89);}(_0x0eec,0xac));var _0xc0ee=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0eec[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xc0ee('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc0ee('0x1'));var rp=require(_0xc0ee('0x2'));var moment=require(_0xc0ee('0x3'));var BPromise=require(_0xc0ee('0x4'));var Mustache=require(_0xc0ee('0x5'));var util=require(_0xc0ee('0x6'));var path=require(_0xc0ee('0x7'));var sox=require('sox');var csv=require(_0xc0ee('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc0ee('0x9'));var _=require(_0xc0ee('0xa'));var squel=require(_0xc0ee('0xb'));var crypto=require(_0xc0ee('0xc'));var jsforce=require(_0xc0ee('0xd'));var deskjs=require(_0xc0ee('0xe'));var toCsv=require(_0xc0ee('0x8'));var querystring=require('querystring');var Papa=require(_0xc0ee('0xf'));var Redis=require(_0xc0ee('0x10'));var authService=require(_0xc0ee('0x11'));var qs=require(_0xc0ee('0x12'));var as=require(_0xc0ee('0x13'));var hardwareService=require(_0xc0ee('0x14'));var logger=require(_0xc0ee('0x15'))('api');var utils=require(_0xc0ee('0x16'));var config=require(_0xc0ee('0x17'));var licenseUtil=require(_0xc0ee('0x18'));var db=require(_0xc0ee('0x19'))['db'];function respondWithStatusCode(_0x22d46b,_0x2d4e3c){_0x2d4e3c=_0x2d4e3c||0xcc;return function(_0x454f5d){if(_0x454f5d){return _0x22d46b[_0xc0ee('0x1a')](_0x2d4e3c);}return _0x22d46b[_0xc0ee('0x1b')](_0x2d4e3c)['end']();};}function respondWithResult(_0x51ae2e,_0x1f3ad9){_0x1f3ad9=_0x1f3ad9||0xc8;return function(_0x325193){if(_0x325193){return _0x51ae2e[_0xc0ee('0x1b')](_0x1f3ad9)['json'](_0x325193);}};}function respondWithFilteredResult(_0x170bf9,_0x30c324){return function(_0x448448){if(_0x448448){var _0x58e1f0=typeof _0x30c324['offset']===_0xc0ee('0x1c')&&typeof _0x30c324['limit']===_0xc0ee('0x1c');var _0x20195b=_0x448448[_0xc0ee('0x1d')];var _0x59aad9=_0x58e1f0?0x0:_0x30c324['offset'];var _0x16d050=_0x58e1f0?_0x448448[_0xc0ee('0x1d')]:_0x30c324[_0xc0ee('0x1e')]+_0x30c324['limit'];var _0x390ee4;if(_0x16d050>=_0x20195b){_0x16d050=_0x20195b;_0x390ee4=0xc8;}else{_0x390ee4=0xce;}_0x170bf9[_0xc0ee('0x1b')](_0x390ee4);return _0x170bf9['set']('Content-Range',_0x59aad9+'-'+_0x16d050+'/'+_0x20195b)[_0xc0ee('0x1f')](_0x448448);}return null;};}function patchUpdates(_0x233333){return function(_0x4dd8c9){try{jsonpatch[_0xc0ee('0x20')](_0x4dd8c9,_0x233333,!![]);}catch(_0x30a00c){return BPromise[_0xc0ee('0x21')](_0x30a00c);}return _0x4dd8c9['save']();};}function saveUpdates(_0x49be2a,_0x5af925){return function(_0x7ec74){if(_0x7ec74){return _0x7ec74[_0xc0ee('0x22')](_0x49be2a)['then'](function(_0x2c3d95){return _0x2c3d95;});}return null;};}function removeEntity(_0x453490,_0x20b657){return function(_0x11b6a4){if(_0x11b6a4){return _0x11b6a4[_0xc0ee('0x23')]()[_0xc0ee('0x24')](function(){_0x453490[_0xc0ee('0x1b')](0xcc)[_0xc0ee('0x25')]();});}};}function handleEntityNotFound(_0x38abc9,_0x6d1087){return function(_0x2b0584){if(!_0x2b0584){_0x38abc9[_0xc0ee('0x1a')](0x194);}return _0x2b0584;};}function handleError(_0x168ab5,_0x30582e){_0x30582e=_0x30582e||0x1f4;return function(_0x4288e1){logger['error'](_0x4288e1[_0xc0ee('0x26')]);if(_0x4288e1[_0xc0ee('0x27')]){delete _0x4288e1['name'];}_0x168ab5[_0xc0ee('0x1b')](_0x30582e)['send'](_0x4288e1);};}exports[_0xc0ee('0x28')]=function(_0x410fb2,_0x44b511){var _0x1d3594={},_0x46ca29={},_0x369764={'count':0x0,'rows':[]};var _0x24a67a=_[_0xc0ee('0x29')](db[_0xc0ee('0x2a')][_0xc0ee('0x2b')],function(_0x394777){return{'name':_0x394777[_0xc0ee('0x2c')],'type':_0x394777[_0xc0ee('0x2d')][_0xc0ee('0x2e')]};});_0x46ca29['model']=_['map'](_0x24a67a,_0xc0ee('0x27'));_0x46ca29[_0xc0ee('0x2f')]=_[_0xc0ee('0x30')](_0x410fb2[_0xc0ee('0x2f')]);_0x46ca29[_0xc0ee('0x31')]=_[_0xc0ee('0x32')](_0x46ca29[_0xc0ee('0x33')],_0x46ca29[_0xc0ee('0x2f')]);_0x1d3594[_0xc0ee('0x34')]=_[_0xc0ee('0x32')](_0x46ca29[_0xc0ee('0x33')],qs['fields'](_0x410fb2[_0xc0ee('0x2f')][_0xc0ee('0x35')]));_0x1d3594[_0xc0ee('0x34')]=_0x1d3594[_0xc0ee('0x34')][_0xc0ee('0x36')]?_0x1d3594['attributes']:_0x46ca29[_0xc0ee('0x33')];if(!_0x410fb2[_0xc0ee('0x2f')][_0xc0ee('0x37')]('nolimit')){_0x1d3594[_0xc0ee('0x38')]=qs[_0xc0ee('0x38')](_0x410fb2[_0xc0ee('0x2f')][_0xc0ee('0x38')]);_0x1d3594['offset']=qs[_0xc0ee('0x1e')](_0x410fb2['query'][_0xc0ee('0x1e')]);}_0x1d3594[_0xc0ee('0x39')]=qs[_0xc0ee('0x3a')](_0x410fb2[_0xc0ee('0x2f')][_0xc0ee('0x3a')]);_0x1d3594[_0xc0ee('0x3b')]=qs[_0xc0ee('0x31')](_[_0xc0ee('0x3c')](_0x410fb2[_0xc0ee('0x2f')],_0x46ca29[_0xc0ee('0x31')]),_0x24a67a);if(_0x410fb2[_0xc0ee('0x2f')]['filter']){_0x1d3594[_0xc0ee('0x3b')]=_[_0xc0ee('0x3d')](_0x1d3594[_0xc0ee('0x3b')],{'$or':_[_0xc0ee('0x29')](_0x24a67a,function(_0x1cb120){if(_0x1cb120[_0xc0ee('0x2d')]!==_0xc0ee('0x3e')){var _0x2d7b9e={};_0x2d7b9e[_0x1cb120['name']]={'$like':'%'+_0x410fb2['query'][_0xc0ee('0x3f')]+'%'};return _0x2d7b9e;}})});}_0x1d3594=_['merge']({},_0x1d3594,_0x410fb2[_0xc0ee('0x40')]);var _0xf46dc5={'where':_0x1d3594['where']};return db[_0xc0ee('0x2a')]['count'](_0xf46dc5)[_0xc0ee('0x24')](function(_0x4f385a){_0x369764['count']=_0x4f385a;if(_0x410fb2['query'][_0xc0ee('0x41')]){_0x1d3594[_0xc0ee('0x42')]=[{'all':!![]}];}return db[_0xc0ee('0x2a')][_0xc0ee('0x43')](_0x1d3594);})['then'](function(_0x3c0c7b){_0x369764[_0xc0ee('0x44')]=_0x3c0c7b;return _0x369764;})[_0xc0ee('0x24')](respondWithFilteredResult(_0x44b511,_0x1d3594))[_0xc0ee('0x45')](handleError(_0x44b511,null));};exports[_0xc0ee('0x46')]=function(_0x5c2111,_0x388c7b){var _0x264a41={'raw':!![],'where':{'id':_0x5c2111[_0xc0ee('0x47')]['id']}},_0x5577aa={};_0x5577aa['model']=_[_0xc0ee('0x30')](db[_0xc0ee('0x2a')]['rawAttributes']);_0x5577aa[_0xc0ee('0x2f')]=_[_0xc0ee('0x30')](_0x5c2111['query']);_0x5577aa[_0xc0ee('0x31')]=_[_0xc0ee('0x32')](_0x5577aa['model'],_0x5577aa[_0xc0ee('0x2f')]);_0x264a41[_0xc0ee('0x34')]=_[_0xc0ee('0x32')](_0x5577aa[_0xc0ee('0x33')],qs[_0xc0ee('0x35')](_0x5c2111['query']['fields']));_0x264a41[_0xc0ee('0x34')]=_0x264a41[_0xc0ee('0x34')][_0xc0ee('0x36')]?_0x264a41[_0xc0ee('0x34')]:_0x5577aa['model'];if(_0x5c2111['query'][_0xc0ee('0x41')]){_0x264a41[_0xc0ee('0x42')]=[{'all':!![]}];}_0x264a41=_[_0xc0ee('0x3d')]({},_0x264a41,_0x5c2111['options']);return db['FaxQueueReport'][_0xc0ee('0x48')](_0x264a41)[_0xc0ee('0x24')](handleEntityNotFound(_0x388c7b,null))[_0xc0ee('0x24')](respondWithResult(_0x388c7b,null))['catch'](handleError(_0x388c7b,null));};exports[_0xc0ee('0x49')]=function(_0x3d6a10,_0x5e5f5e){return db[_0xc0ee('0x2a')][_0xc0ee('0x49')](_0x3d6a10[_0xc0ee('0x4a')],{})[_0xc0ee('0x24')](respondWithResult(_0x5e5f5e,0xc9))['catch'](handleError(_0x5e5f5e,null));};exports['update']=function(_0x22c742,_0x5ca93b){if(_0x22c742['body']['id']){delete _0x22c742['body']['id'];}return db[_0xc0ee('0x2a')]['find']({'where':{'id':_0x22c742[_0xc0ee('0x47')]['id']}})[_0xc0ee('0x24')](handleEntityNotFound(_0x5ca93b,null))[_0xc0ee('0x24')](saveUpdates(_0x22c742['body'],null))[_0xc0ee('0x24')](respondWithResult(_0x5ca93b,null))['catch'](handleError(_0x5ca93b,null));};exports[_0xc0ee('0x23')]=function(_0x4b2fcc,_0x3bb5ae){return db[_0xc0ee('0x2a')][_0xc0ee('0x48')]({'where':{'id':_0x4b2fcc[_0xc0ee('0x47')]['id']}})[_0xc0ee('0x24')](handleEntityNotFound(_0x3bb5ae,null))[_0xc0ee('0x24')](removeEntity(_0x3bb5ae,null))['catch'](handleError(_0x3bb5ae,null));};exports['describe']=function(_0x6e6b2c,_0x497ed9){return db[_0xc0ee('0x2a')][_0xc0ee('0x4b')]()[_0xc0ee('0x24')](respondWithResult(_0x497ed9,null))[_0xc0ee('0x45')](handleError(_0x497ed9,null));}; \ No newline at end of file +var _0x1542=['undefined','count','offset','limit','set','Content-Range','apply','reject','then','error','stack','name','send','index','map','FaxQueueReport','rawAttributes','type','key','keys','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','update','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json'];(function(_0x3f6dcd,_0x469d2c){var _0x410c69=function(_0x3f8c8c){while(--_0x3f8c8c){_0x3f6dcd['push'](_0x3f6dcd['shift']());}};_0x410c69(++_0x469d2c);}(_0x1542,0x116));var _0x2154=function(_0x2023bd,_0xc09229){_0x2023bd=_0x2023bd-0x0;var _0x179caf=_0x1542[_0x2023bd];return _0x179caf;};'use strict';var emlformat=require(_0x2154('0x0'));var rimraf=require(_0x2154('0x1'));var zipdir=require(_0x2154('0x2'));var jsonpatch=require(_0x2154('0x3'));var rp=require(_0x2154('0x4'));var moment=require('moment');var BPromise=require(_0x2154('0x5'));var Mustache=require(_0x2154('0x6'));var util=require(_0x2154('0x7'));var path=require('path');var sox=require(_0x2154('0x8'));var csv=require(_0x2154('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2154('0xa'));var _=require(_0x2154('0xb'));var squel=require(_0x2154('0xc'));var crypto=require(_0x2154('0xd'));var jsforce=require(_0x2154('0xe'));var deskjs=require(_0x2154('0xf'));var toCsv=require(_0x2154('0x9'));var querystring=require(_0x2154('0x10'));var Papa=require(_0x2154('0x11'));var Redis=require(_0x2154('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x2154('0x13'));var as=require(_0x2154('0x14'));var hardwareService=require(_0x2154('0x15'));var logger=require(_0x2154('0x16'))('api');var utils=require(_0x2154('0x17'));var config=require(_0x2154('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x2154('0x19'))['db'];function respondWithStatusCode(_0x44c713,_0x3daa7d){_0x3daa7d=_0x3daa7d||0xcc;return function(_0x2a79eb){if(_0x2a79eb){return _0x44c713[_0x2154('0x1a')](_0x3daa7d);}return _0x44c713[_0x2154('0x1b')](_0x3daa7d)[_0x2154('0x1c')]();};}function respondWithResult(_0x587627,_0x5363f6){_0x5363f6=_0x5363f6||0xc8;return function(_0x160517){if(_0x160517){return _0x587627['status'](_0x5363f6)[_0x2154('0x1d')](_0x160517);}};}function respondWithFilteredResult(_0x59a389,_0x48f188){return function(_0x5b34b9){if(_0x5b34b9){var _0x46c995=typeof _0x48f188['offset']===_0x2154('0x1e')&&typeof _0x48f188['limit']===_0x2154('0x1e');var _0x369ab6=_0x5b34b9[_0x2154('0x1f')];var _0x35b468=_0x46c995?0x0:_0x48f188[_0x2154('0x20')];var _0x46b72c=_0x46c995?_0x5b34b9[_0x2154('0x1f')]:_0x48f188[_0x2154('0x20')]+_0x48f188[_0x2154('0x21')];var _0x286dc8;if(_0x46b72c>=_0x369ab6){_0x46b72c=_0x369ab6;_0x286dc8=0xc8;}else{_0x286dc8=0xce;}_0x59a389['status'](_0x286dc8);return _0x59a389[_0x2154('0x22')](_0x2154('0x23'),_0x35b468+'-'+_0x46b72c+'/'+_0x369ab6)[_0x2154('0x1d')](_0x5b34b9);}return null;};}function patchUpdates(_0x57bc6a){return function(_0x2af3dd){try{jsonpatch[_0x2154('0x24')](_0x2af3dd,_0x57bc6a,!![]);}catch(_0x3b71){return BPromise[_0x2154('0x25')](_0x3b71);}return _0x2af3dd['save']();};}function saveUpdates(_0x338185,_0xb10044){return function(_0x3f4387){if(_0x3f4387){return _0x3f4387['update'](_0x338185)['then'](function(_0x3e85c0){return _0x3e85c0;});}return null;};}function removeEntity(_0xa40b17,_0x166b0d){return function(_0x4ef4f7){if(_0x4ef4f7){return _0x4ef4f7['destroy']()[_0x2154('0x26')](function(){_0xa40b17[_0x2154('0x1b')](0xcc)[_0x2154('0x1c')]();});}};}function handleEntityNotFound(_0x3b4fa8,_0x5c954c){return function(_0x1b3f89){if(!_0x1b3f89){_0x3b4fa8[_0x2154('0x1a')](0x194);}return _0x1b3f89;};}function handleError(_0x4224e1,_0x5c5dbb){_0x5c5dbb=_0x5c5dbb||0x1f4;return function(_0x4afbb4){logger[_0x2154('0x27')](_0x4afbb4[_0x2154('0x28')]);if(_0x4afbb4[_0x2154('0x29')]){delete _0x4afbb4['name'];}_0x4224e1[_0x2154('0x1b')](_0x5c5dbb)[_0x2154('0x2a')](_0x4afbb4);};}exports[_0x2154('0x2b')]=function(_0x83263d,_0x375a57){var _0x5cd152={},_0x23f1bc={},_0x215a2c={'count':0x0,'rows':[]};var _0x661cff=_[_0x2154('0x2c')](db[_0x2154('0x2d')][_0x2154('0x2e')],function(_0xe5c717){return{'name':_0xe5c717['fieldName'],'type':_0xe5c717[_0x2154('0x2f')][_0x2154('0x30')]};});_0x23f1bc['model']=_[_0x2154('0x2c')](_0x661cff,'name');_0x23f1bc['query']=_[_0x2154('0x31')](_0x83263d[_0x2154('0x32')]);_0x23f1bc[_0x2154('0x33')]=_['intersection'](_0x23f1bc[_0x2154('0x34')],_0x23f1bc[_0x2154('0x32')]);_0x5cd152[_0x2154('0x35')]=_[_0x2154('0x36')](_0x23f1bc[_0x2154('0x34')],qs[_0x2154('0x37')](_0x83263d[_0x2154('0x32')][_0x2154('0x37')]));_0x5cd152['attributes']=_0x5cd152[_0x2154('0x35')]['length']?_0x5cd152[_0x2154('0x35')]:_0x23f1bc[_0x2154('0x34')];if(!_0x83263d[_0x2154('0x32')][_0x2154('0x38')](_0x2154('0x39'))){_0x5cd152['limit']=qs['limit'](_0x83263d[_0x2154('0x32')][_0x2154('0x21')]);_0x5cd152[_0x2154('0x20')]=qs[_0x2154('0x20')](_0x83263d[_0x2154('0x32')][_0x2154('0x20')]);}_0x5cd152[_0x2154('0x3a')]=qs[_0x2154('0x3b')](_0x83263d[_0x2154('0x32')][_0x2154('0x3b')]);_0x5cd152['where']=qs[_0x2154('0x33')](_['pick'](_0x83263d[_0x2154('0x32')],_0x23f1bc[_0x2154('0x33')]),_0x661cff);if(_0x83263d[_0x2154('0x32')][_0x2154('0x3c')]){_0x5cd152[_0x2154('0x3d')]=_[_0x2154('0x3e')](_0x5cd152['where'],{'$or':_[_0x2154('0x2c')](_0x661cff,function(_0x2ccbb5){if(_0x2ccbb5[_0x2154('0x2f')]!==_0x2154('0x3f')){var _0x1a4167={};_0x1a4167[_0x2ccbb5[_0x2154('0x29')]]={'$like':'%'+_0x83263d[_0x2154('0x32')][_0x2154('0x3c')]+'%'};return _0x1a4167;}})});}_0x5cd152=_[_0x2154('0x3e')]({},_0x5cd152,_0x83263d[_0x2154('0x40')]);var _0x593e35={'where':_0x5cd152['where']};return db[_0x2154('0x2d')][_0x2154('0x1f')](_0x593e35)['then'](function(_0x273196){_0x215a2c[_0x2154('0x1f')]=_0x273196;if(_0x83263d['query'][_0x2154('0x41')]){_0x5cd152[_0x2154('0x42')]=[{'all':!![]}];}return db['FaxQueueReport']['findAll'](_0x5cd152);})[_0x2154('0x26')](function(_0x3f0098){_0x215a2c[_0x2154('0x43')]=_0x3f0098;return _0x215a2c;})[_0x2154('0x26')](respondWithFilteredResult(_0x375a57,_0x5cd152))[_0x2154('0x44')](handleError(_0x375a57,null));};exports[_0x2154('0x45')]=function(_0x2bc5e4,_0x2f0bba){var _0x337296={'raw':!![],'where':{'id':_0x2bc5e4[_0x2154('0x46')]['id']}},_0x417663={};_0x417663['model']=_['keys'](db[_0x2154('0x2d')]['rawAttributes']);_0x417663[_0x2154('0x32')]=_[_0x2154('0x31')](_0x2bc5e4[_0x2154('0x32')]);_0x417663[_0x2154('0x33')]=_['intersection'](_0x417663[_0x2154('0x34')],_0x417663[_0x2154('0x32')]);_0x337296[_0x2154('0x35')]=_[_0x2154('0x36')](_0x417663[_0x2154('0x34')],qs[_0x2154('0x37')](_0x2bc5e4['query']['fields']));_0x337296['attributes']=_0x337296[_0x2154('0x35')]['length']?_0x337296['attributes']:_0x417663[_0x2154('0x34')];if(_0x2bc5e4[_0x2154('0x32')][_0x2154('0x41')]){_0x337296[_0x2154('0x42')]=[{'all':!![]}];}_0x337296=_[_0x2154('0x3e')]({},_0x337296,_0x2bc5e4[_0x2154('0x40')]);return db[_0x2154('0x2d')][_0x2154('0x47')](_0x337296)['then'](handleEntityNotFound(_0x2f0bba,null))[_0x2154('0x26')](respondWithResult(_0x2f0bba,null))[_0x2154('0x44')](handleError(_0x2f0bba,null));};exports[_0x2154('0x48')]=function(_0x528a86,_0x5a82b0){return db[_0x2154('0x2d')][_0x2154('0x48')](_0x528a86[_0x2154('0x49')],{})['then'](respondWithResult(_0x5a82b0,0xc9))[_0x2154('0x44')](handleError(_0x5a82b0,null));};exports[_0x2154('0x4a')]=function(_0x24f13b,_0x7027c1){if(_0x24f13b[_0x2154('0x49')]['id']){delete _0x24f13b[_0x2154('0x49')]['id'];}return db[_0x2154('0x2d')][_0x2154('0x47')]({'where':{'id':_0x24f13b['params']['id']}})[_0x2154('0x26')](handleEntityNotFound(_0x7027c1,null))[_0x2154('0x26')](saveUpdates(_0x24f13b[_0x2154('0x49')],null))[_0x2154('0x26')](respondWithResult(_0x7027c1,null))['catch'](handleError(_0x7027c1,null));};exports[_0x2154('0x4b')]=function(_0x557f56,_0x5e4c51){return db[_0x2154('0x2d')][_0x2154('0x47')]({'where':{'id':_0x557f56[_0x2154('0x46')]['id']}})[_0x2154('0x26')](handleEntityNotFound(_0x5e4c51,null))[_0x2154('0x26')](removeEntity(_0x5e4c51,null))[_0x2154('0x44')](handleError(_0x5e4c51,null));};exports[_0x2154('0x4c')]=function(_0x146a81,_0x2049c9){return db[_0x2154('0x2d')]['describe']()['then'](respondWithResult(_0x2049c9,null))[_0x2154('0x44')](handleError(_0x2049c9,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 682ac3d..5aa094d 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 _0xf494=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','uniqueid','lodash'];(function(_0x3e6b66,_0x558128){var _0x4bb516=function(_0x3e4134){while(--_0x3e4134){_0x3e6b66['push'](_0x3e6b66['shift']());}};_0x4bb516(++_0x558128);}(_0xf494,0x1c6));var _0x4f49=function(_0x11ba6e,_0x3e07a2){_0x11ba6e=_0x11ba6e-0x0;var _0x3a1937=_0xf494[_0x11ba6e];return _0x3a1937;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));module[_0x4f49('0xa')]=function(_0xc5e778,_0x413530){return _0xc5e778[_0x4f49('0xb')]('FaxQueueReport',attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x4f49('0xc'),'fields':[_0x4f49('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf494=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','uniqueid','lodash'];(function(_0x32e3ca,_0x701e59){var _0x38a970=function(_0x3f0727){while(--_0x3f0727){_0x32e3ca['push'](_0x32e3ca['shift']());}};_0x38a970(++_0x701e59);}(_0xf494,0x1c6));var _0x4f49=function(_0x16c8c3,_0x9dde1c){_0x16c8c3=_0x16c8c3-0x0;var _0x3cb87e=_0xf494[_0x16c8c3];return _0x3cb87e;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));module[_0x4f49('0xa')]=function(_0xc5e778,_0x413530){return _0xc5e778[_0x4f49('0xb')]('FaxQueueReport',attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x4f49('0xc'),'fields':[_0x4f49('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 3a9ac0a..05108bb 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 _0x7196=['request','info','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxQueueReport,\x20%s,\x20%s','result','catch','CreateFaxQueueReport','create','options','raw','FaxQueueReport','body','where','attributes','limit','then','UpdateFaxQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x99692,_0x32528e){var _0xe5fbb4=function(_0x58a4e1){while(--_0x58a4e1){_0x99692['push'](_0x99692['shift']());}};_0xe5fbb4(++_0x32528e);}(_0x7196,0x10c));var _0x6719=function(_0x8978e5,_0xd5e61d){_0x8978e5=_0x8978e5-0x0;var _0x178b81=_0x7196[_0x8978e5];return _0x178b81;};'use strict';var _=require(_0x6719('0x0'));var util=require(_0x6719('0x1'));var moment=require(_0x6719('0x2'));var BPromise=require(_0x6719('0x3'));var rs=require(_0x6719('0x4'));var fs=require('fs');var Redis=require(_0x6719('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6719('0x6'))(_0x6719('0x7'));var config=require(_0x6719('0x8'));var jayson=require(_0x6719('0x9'));var client=jayson[_0x6719('0xa')][_0x6719('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1af09c,_0x2dd302,_0x12891d){return new BPromise(function(_0x53f537,_0x227fd9){return client[_0x6719('0xc')](_0x1af09c,_0x12891d)['then'](function(_0x39697f){logger[_0x6719('0xd')]('FaxQueueReport,\x20%s,\x20%s',_0x2dd302,_0x6719('0xe'));logger[_0x6719('0xf')](_0x6719('0x10'),_0x2dd302,_0x6719('0xe'),JSON[_0x6719('0x11')](_0x39697f));if(_0x39697f[_0x6719('0x12')]){if(_0x39697f[_0x6719('0x12')][_0x6719('0x13')]===0x1f4){logger[_0x6719('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x2dd302,_0x39697f[_0x6719('0x12')][_0x6719('0x14')]);return _0x227fd9(_0x39697f[_0x6719('0x12')]['message']);}logger[_0x6719('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x2dd302,_0x39697f[_0x6719('0x12')][_0x6719('0x14')]);return _0x53f537(_0x39697f[_0x6719('0x12')][_0x6719('0x14')]);}else{logger[_0x6719('0xd')](_0x6719('0x15'),_0x2dd302,_0x6719('0xe'));_0x53f537(_0x39697f[_0x6719('0x16')]['message']);}})[_0x6719('0x17')](function(_0x5b72a4){logger[_0x6719('0x12')](_0x6719('0x15'),_0x2dd302,_0x5b72a4);_0x227fd9(_0x5b72a4);});});}exports[_0x6719('0x18')]=function(_0x1e7b7a){var _0x273595=this;return new Promise(function(_0x180653,_0x394f85){return db['FaxQueueReport'][_0x6719('0x19')](_0x1e7b7a['body'],{'raw':_0x1e7b7a[_0x6719('0x1a')]?_0x1e7b7a['options'][_0x6719('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x3c93df){logger[_0x6719('0xd')](_0x6719('0x18'),_0x1e7b7a);logger['debug'](_0x6719('0x18'),_0x1e7b7a,JSON['stringify'](_0x3c93df));_0x180653(_0x3c93df);})[_0x6719('0x17')](function(_0x4ab430){logger[_0x6719('0x12')]('CreateFaxQueueReport',_0x4ab430['message'],_0x1e7b7a);_0x394f85(_0x273595[_0x6719('0x12')](0x1f4,_0x4ab430[_0x6719('0x14')]));});});};exports['UpdateFaxQueueReport']=function(_0x26131f){var _0x414416=this;return new Promise(function(_0x42ca27,_0x345e61){return db[_0x6719('0x1c')]['update'](_0x26131f[_0x6719('0x1d')],{'raw':_0x26131f[_0x6719('0x1a')]?_0x26131f[_0x6719('0x1a')][_0x6719('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26131f[_0x6719('0x1a')]?_0x26131f['options'][_0x6719('0x1e')]||null:null,'attributes':_0x26131f[_0x6719('0x1a')]?_0x26131f[_0x6719('0x1a')][_0x6719('0x1f')]||null:null,'limit':_0x26131f[_0x6719('0x1a')]?_0x26131f[_0x6719('0x1a')][_0x6719('0x20')]||null:null})[_0x6719('0x21')](function(_0x30f4d4){logger[_0x6719('0xd')](_0x6719('0x22'),_0x26131f);logger[_0x6719('0xf')](_0x6719('0x22'),_0x26131f,JSON[_0x6719('0x11')](_0x30f4d4));_0x42ca27(_0x30f4d4);})[_0x6719('0x17')](function(_0x2a772f){logger[_0x6719('0x12')](_0x6719('0x22'),_0x2a772f[_0x6719('0x14')],_0x26131f);_0x345e61(_0x414416[_0x6719('0x12')](0x1f4,_0x2a772f[_0x6719('0x14')]));});});}; \ No newline at end of file +var _0x50a5=['then','CreateFaxQueueReport','UpdateFaxQueueReport','update','body','where','attributes','lodash','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','create','options','raw'];(function(_0x48f29a,_0x1f9f1a){var _0x467232=function(_0xf1ae7e){while(--_0xf1ae7e){_0x48f29a['push'](_0x48f29a['shift']());}};_0x467232(++_0x1f9f1a);}(_0x50a5,0xd2));var _0x550a=function(_0xfe003f,_0x36e078){_0xfe003f=_0xfe003f-0x0;var _0x489a14=_0x50a5[_0xfe003f];return _0x489a14;};'use strict';var _=require(_0x550a('0x0'));var util=require('util');var moment=require(_0x550a('0x1'));var BPromise=require(_0x550a('0x2'));var rs=require(_0x550a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x550a('0x4'))(_0x550a('0x5'));var config=require(_0x550a('0x6'));var jayson=require(_0x550a('0x7'));var client=jayson['client'][_0x550a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4bae00,_0x10e461,_0x2830d4){return new BPromise(function(_0xd684c6,_0x339a42){return client['request'](_0x4bae00,_0x2830d4)['then'](function(_0x42264b){logger[_0x550a('0x9')](_0x550a('0xa'),_0x10e461,_0x550a('0xb'));logger[_0x550a('0xc')](_0x550a('0xd'),_0x10e461,_0x550a('0xb'),JSON['stringify'](_0x42264b));if(_0x42264b[_0x550a('0xe')]){if(_0x42264b[_0x550a('0xe')][_0x550a('0xf')]===0x1f4){logger['error'](_0x550a('0xa'),_0x10e461,_0x42264b[_0x550a('0xe')]['message']);return _0x339a42(_0x42264b['error'][_0x550a('0x10')]);}logger[_0x550a('0xe')](_0x550a('0xa'),_0x10e461,_0x42264b[_0x550a('0xe')][_0x550a('0x10')]);return _0xd684c6(_0x42264b['error']['message']);}else{logger[_0x550a('0x9')]('FaxQueueReport,\x20%s,\x20%s',_0x10e461,'request\x20sent');_0xd684c6(_0x42264b[_0x550a('0x11')][_0x550a('0x10')]);}})[_0x550a('0x12')](function(_0x5a4b0b){logger['error'](_0x550a('0xa'),_0x10e461,_0x5a4b0b);_0x339a42(_0x5a4b0b);});});}exports['CreateFaxQueueReport']=function(_0x1a4085){var _0x2086c9=this;return new Promise(function(_0xc2e066,_0x58440b){return db['FaxQueueReport'][_0x550a('0x13')](_0x1a4085['body'],{'raw':_0x1a4085[_0x550a('0x14')]?_0x1a4085['options'][_0x550a('0x15')]===undefined?!![]:![]:!![]})[_0x550a('0x16')](function(_0xed8f8d){logger[_0x550a('0x9')](_0x550a('0x17'),_0x1a4085);logger['debug'](_0x550a('0x17'),_0x1a4085,JSON['stringify'](_0xed8f8d));_0xc2e066(_0xed8f8d);})[_0x550a('0x12')](function(_0x400553){logger[_0x550a('0xe')](_0x550a('0x17'),_0x400553[_0x550a('0x10')],_0x1a4085);_0x58440b(_0x2086c9['error'](0x1f4,_0x400553[_0x550a('0x10')]));});});};exports[_0x550a('0x18')]=function(_0x4928c4){var _0x57bb0a=this;return new Promise(function(_0x1c6398,_0x5586c8){return db['FaxQueueReport'][_0x550a('0x19')](_0x4928c4[_0x550a('0x1a')],{'raw':_0x4928c4['options']?_0x4928c4[_0x550a('0x14')][_0x550a('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4928c4[_0x550a('0x14')]?_0x4928c4[_0x550a('0x14')][_0x550a('0x1b')]||null:null,'attributes':_0x4928c4['options']?_0x4928c4[_0x550a('0x14')][_0x550a('0x1c')]||null:null,'limit':_0x4928c4[_0x550a('0x14')]?_0x4928c4[_0x550a('0x14')]['limit']||null:null})[_0x550a('0x16')](function(_0x5ae183){logger[_0x550a('0x9')](_0x550a('0x18'),_0x4928c4);logger[_0x550a('0xc')](_0x550a('0x18'),_0x4928c4,JSON['stringify'](_0x5ae183));_0x1c6398(_0x5ae183);})[_0x550a('0x12')](function(_0x3c02d8){logger[_0x550a('0xe')](_0x550a('0x18'),_0x3c02d8[_0x550a('0x10')],_0x4928c4);_0x5586c8(_0x57bb0a[_0x550a('0xe')](0x1f4,_0x3c02d8[_0x550a('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 2a9238f..f6ea6b2 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 _0x4d38=['put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./faxQueueReport.controller','index','get','/describe','isAuthenticated','show','post','create'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0x4d38,0x84));var _0x84d3=function(_0x44d9e8,_0x2f0bc2){_0x44d9e8=_0x44d9e8-0x0;var _0x64816e=_0x4d38[_0x44d9e8];return _0x64816e;};'use strict';var multer=require(_0x84d3('0x0'));var util=require('util');var path=require(_0x84d3('0x1'));var timeout=require(_0x84d3('0x2'));var express=require(_0x84d3('0x3'));var router=express[_0x84d3('0x4')]();var fs_extra=require(_0x84d3('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x84d3('0x6'));var controller=require(_0x84d3('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x84d3('0x8')]);router[_0x84d3('0x9')](_0x84d3('0xa'),auth[_0x84d3('0xb')](),controller['describe']);router[_0x84d3('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x84d3('0xc')]);router[_0x84d3('0xd')]('/',auth[_0x84d3('0xb')](),controller[_0x84d3('0xe')]);router[_0x84d3('0xf')](_0x84d3('0x10'),auth[_0x84d3('0xb')](),controller[_0x84d3('0x11')]);router[_0x84d3('0x12')](_0x84d3('0x10'),auth['isAuthenticated'](),controller[_0x84d3('0x13')]);module[_0x84d3('0x14')]=router; \ No newline at end of file +var _0x3fba=['describe','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index'];(function(_0x355371,_0x1669e8){var _0x19949d=function(_0x53e9d4){while(--_0x53e9d4){_0x355371['push'](_0x355371['shift']());}};_0x19949d(++_0x1669e8);}(_0x3fba,0xfb));var _0xa3fb=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x3fba[_0x273c39];return _0x46d6b5;};'use strict';var multer=require(_0xa3fb('0x0'));var util=require(_0xa3fb('0x1'));var path=require(_0xa3fb('0x2'));var timeout=require(_0xa3fb('0x3'));var express=require(_0xa3fb('0x4'));var router=express[_0xa3fb('0x5')]();var fs_extra=require(_0xa3fb('0x6'));var auth=require(_0xa3fb('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xa3fb('0x8'));var controller=require(_0xa3fb('0x9'));router[_0xa3fb('0xa')]('/',auth[_0xa3fb('0xb')](),controller[_0xa3fb('0xc')]);router[_0xa3fb('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xa3fb('0xd')]);router[_0xa3fb('0xa')](_0xa3fb('0xe'),auth[_0xa3fb('0xb')](),controller[_0xa3fb('0xf')]);router[_0xa3fb('0x10')]('/',auth[_0xa3fb('0xb')](),controller[_0xa3fb('0x11')]);router[_0xa3fb('0x12')](_0xa3fb('0xe'),auth['isAuthenticated'](),controller[_0xa3fb('0x13')]);router[_0xa3fb('0x14')](_0xa3fb('0xe'),auth['isAuthenticated'](),controller[_0xa3fb('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 761cbb6..6469bae 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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x57dff9,_0x37bd67){var _0x346ae6=function(_0x14197b){while(--_0x14197b){_0x57dff9['push'](_0x57dff9['shift']());}};_0x346ae6(++_0x37bd67);}(_0x34e8,0x12c));var _0x834e=function(_0x254a58,_0x21afc4){_0x254a58=_0x254a58-0x0;var _0x33d045=_0x34e8[_0x254a58];return _0x33d045;};'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 +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x20fa63,_0x65c8d3){var _0x4c37ae=function(_0x4f1038){while(--_0x4f1038){_0x20fa63['push'](_0x20fa63['shift']());}};_0x4c37ae(++_0x65c8d3);}(_0x9c44,0x178));var _0x49c4=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x9c44[_0x13b02f];return _0x12e9a6;};'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 diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 271908c..30514f0 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 _0x9a69=['type','key','model','map','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','FaxTransferReport','include','findAll','rows','catch','params','keys','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','update','destroy','then','end','error','stack','name','send','rawAttributes'];(function(_0x2afdc1,_0x4770ef){var _0x5bafef=function(_0x1ec904){while(--_0x1ec904){_0x2afdc1['push'](_0x2afdc1['shift']());}};_0x5bafef(++_0x4770ef);}(_0x9a69,0x6b));var _0x99a6=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9a69[_0xfae23b];return _0x200640;};'use strict';var emlformat=require(_0x99a6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x99a6('0x1'));var jsonpatch=require(_0x99a6('0x2'));var rp=require(_0x99a6('0x3'));var moment=require(_0x99a6('0x4'));var BPromise=require(_0x99a6('0x5'));var Mustache=require(_0x99a6('0x6'));var util=require('util');var path=require('path');var sox=require(_0x99a6('0x7'));var csv=require('to-csv');var ejs=require(_0x99a6('0x8'));var fs=require('fs');var fs_extra=require(_0x99a6('0x9'));var _=require(_0x99a6('0xa'));var squel=require(_0x99a6('0xb'));var crypto=require(_0x99a6('0xc'));var jsforce=require(_0x99a6('0xd'));var deskjs=require(_0x99a6('0xe'));var toCsv=require(_0x99a6('0xf'));var querystring=require(_0x99a6('0x10'));var Papa=require(_0x99a6('0x11'));var Redis=require(_0x99a6('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x99a6('0x13'));var as=require(_0x99a6('0x14'));var hardwareService=require(_0x99a6('0x15'));var logger=require(_0x99a6('0x16'))(_0x99a6('0x17'));var utils=require(_0x99a6('0x18'));var config=require(_0x99a6('0x19'));var licenseUtil=require(_0x99a6('0x1a'));var db=require(_0x99a6('0x1b'))['db'];function respondWithStatusCode(_0x6d27e6,_0x24beae){_0x24beae=_0x24beae||0xcc;return function(_0x329862){if(_0x329862){return _0x6d27e6[_0x99a6('0x1c')](_0x24beae);}return _0x6d27e6[_0x99a6('0x1d')](_0x24beae)['end']();};}function respondWithResult(_0xf4b0b8,_0x146e56){_0x146e56=_0x146e56||0xc8;return function(_0x3fe90c){if(_0x3fe90c){return _0xf4b0b8[_0x99a6('0x1d')](_0x146e56)[_0x99a6('0x1e')](_0x3fe90c);}};}function respondWithFilteredResult(_0x5bc179,_0x146f3e){return function(_0x54be81){if(_0x54be81){var _0xf178a3=typeof _0x146f3e[_0x99a6('0x1f')]==='undefined'&&typeof _0x146f3e[_0x99a6('0x20')]===_0x99a6('0x21');var _0x426970=_0x54be81[_0x99a6('0x22')];var _0x24ff58=_0xf178a3?0x0:_0x146f3e[_0x99a6('0x1f')];var _0x3048c9=_0xf178a3?_0x54be81[_0x99a6('0x22')]:_0x146f3e[_0x99a6('0x1f')]+_0x146f3e['limit'];var _0x15b27a;if(_0x3048c9>=_0x426970){_0x3048c9=_0x426970;_0x15b27a=0xc8;}else{_0x15b27a=0xce;}_0x5bc179['status'](_0x15b27a);return _0x5bc179[_0x99a6('0x23')](_0x99a6('0x24'),_0x24ff58+'-'+_0x3048c9+'/'+_0x426970)[_0x99a6('0x1e')](_0x54be81);}return null;};}function patchUpdates(_0x337798){return function(_0x974c35){try{jsonpatch[_0x99a6('0x25')](_0x974c35,_0x337798,!![]);}catch(_0x162c27){return BPromise['reject'](_0x162c27);}return _0x974c35['save']();};}function saveUpdates(_0x123525,_0x5ae83e){return function(_0x48b1f0){if(_0x48b1f0){return _0x48b1f0[_0x99a6('0x26')](_0x123525)['then'](function(_0x7e1314){return _0x7e1314;});}return null;};}function removeEntity(_0x6a1c39,_0x3b0346){return function(_0x213096){if(_0x213096){return _0x213096[_0x99a6('0x27')]()[_0x99a6('0x28')](function(){_0x6a1c39[_0x99a6('0x1d')](0xcc)[_0x99a6('0x29')]();});}};}function handleEntityNotFound(_0x2bf86c,_0x234b1e){return function(_0x34cb6e){if(!_0x34cb6e){_0x2bf86c[_0x99a6('0x1c')](0x194);}return _0x34cb6e;};}function handleError(_0x4e5237,_0x264c9){_0x264c9=_0x264c9||0x1f4;return function(_0x57ffef){logger[_0x99a6('0x2a')](_0x57ffef[_0x99a6('0x2b')]);if(_0x57ffef[_0x99a6('0x2c')]){delete _0x57ffef['name'];}_0x4e5237[_0x99a6('0x1d')](_0x264c9)[_0x99a6('0x2d')](_0x57ffef);};}exports['index']=function(_0x170447,_0x1d9095){var _0x590bb9={},_0x23d04c={},_0x4c9b40={'count':0x0,'rows':[]};var _0x24933a=_['map'](db['FaxTransferReport'][_0x99a6('0x2e')],function(_0x185fd3){return{'name':_0x185fd3['fieldName'],'type':_0x185fd3[_0x99a6('0x2f')][_0x99a6('0x30')]};});_0x23d04c[_0x99a6('0x31')]=_[_0x99a6('0x32')](_0x24933a,_0x99a6('0x2c'));_0x23d04c[_0x99a6('0x33')]=_['keys'](_0x170447['query']);_0x23d04c['filters']=_['intersection'](_0x23d04c[_0x99a6('0x31')],_0x23d04c[_0x99a6('0x33')]);_0x590bb9[_0x99a6('0x34')]=_[_0x99a6('0x35')](_0x23d04c[_0x99a6('0x31')],qs[_0x99a6('0x36')](_0x170447['query'][_0x99a6('0x36')]));_0x590bb9['attributes']=_0x590bb9[_0x99a6('0x34')][_0x99a6('0x37')]?_0x590bb9[_0x99a6('0x34')]:_0x23d04c[_0x99a6('0x31')];if(!_0x170447[_0x99a6('0x33')][_0x99a6('0x38')](_0x99a6('0x39'))){_0x590bb9[_0x99a6('0x20')]=qs[_0x99a6('0x20')](_0x170447['query'][_0x99a6('0x20')]);_0x590bb9[_0x99a6('0x1f')]=qs[_0x99a6('0x1f')](_0x170447['query'][_0x99a6('0x1f')]);}_0x590bb9[_0x99a6('0x3a')]=qs[_0x99a6('0x3b')](_0x170447['query'][_0x99a6('0x3b')]);_0x590bb9[_0x99a6('0x3c')]=qs[_0x99a6('0x3d')](_['pick'](_0x170447[_0x99a6('0x33')],_0x23d04c[_0x99a6('0x3d')]),_0x24933a);if(_0x170447[_0x99a6('0x33')][_0x99a6('0x3e')]){_0x590bb9['where']=_[_0x99a6('0x3f')](_0x590bb9[_0x99a6('0x3c')],{'$or':_[_0x99a6('0x32')](_0x24933a,function(_0x2906da){if(_0x2906da[_0x99a6('0x2f')]!==_0x99a6('0x40')){var _0x8b373e={};_0x8b373e[_0x2906da[_0x99a6('0x2c')]]={'$like':'%'+_0x170447[_0x99a6('0x33')][_0x99a6('0x3e')]+'%'};return _0x8b373e;}})});}_0x590bb9=_['merge']({},_0x590bb9,_0x170447[_0x99a6('0x41')]);var _0x44da4c={'where':_0x590bb9[_0x99a6('0x3c')]};return db[_0x99a6('0x42')][_0x99a6('0x22')](_0x44da4c)[_0x99a6('0x28')](function(_0x2daec1){_0x4c9b40[_0x99a6('0x22')]=_0x2daec1;if(_0x170447[_0x99a6('0x33')]['includeAll']){_0x590bb9[_0x99a6('0x43')]=[{'all':!![]}];}return db[_0x99a6('0x42')][_0x99a6('0x44')](_0x590bb9);})[_0x99a6('0x28')](function(_0x2d6ba2){_0x4c9b40[_0x99a6('0x45')]=_0x2d6ba2;return _0x4c9b40;})[_0x99a6('0x28')](respondWithFilteredResult(_0x1d9095,_0x590bb9))[_0x99a6('0x46')](handleError(_0x1d9095,null));};exports['show']=function(_0x37d55b,_0x513b1d){var _0x3670c9={'raw':!![],'where':{'id':_0x37d55b[_0x99a6('0x47')]['id']}},_0x3e735b={};_0x3e735b['model']=_[_0x99a6('0x48')](db['FaxTransferReport'][_0x99a6('0x2e')]);_0x3e735b[_0x99a6('0x33')]=_[_0x99a6('0x48')](_0x37d55b['query']);_0x3e735b[_0x99a6('0x3d')]=_[_0x99a6('0x35')](_0x3e735b['model'],_0x3e735b[_0x99a6('0x33')]);_0x3670c9[_0x99a6('0x34')]=_[_0x99a6('0x35')](_0x3e735b[_0x99a6('0x31')],qs[_0x99a6('0x36')](_0x37d55b[_0x99a6('0x33')][_0x99a6('0x36')]));_0x3670c9[_0x99a6('0x34')]=_0x3670c9[_0x99a6('0x34')][_0x99a6('0x37')]?_0x3670c9[_0x99a6('0x34')]:_0x3e735b[_0x99a6('0x31')];if(_0x37d55b[_0x99a6('0x33')]['includeAll']){_0x3670c9[_0x99a6('0x43')]=[{'all':!![]}];}_0x3670c9=_[_0x99a6('0x3f')]({},_0x3670c9,_0x37d55b[_0x99a6('0x41')]);return db[_0x99a6('0x42')]['find'](_0x3670c9)[_0x99a6('0x28')](handleEntityNotFound(_0x513b1d,null))['then'](respondWithResult(_0x513b1d,null))['catch'](handleError(_0x513b1d,null));};exports[_0x99a6('0x49')]=function(_0x19a9d9,_0x3c9a8e){return db[_0x99a6('0x42')][_0x99a6('0x49')](_0x19a9d9['body'],{})[_0x99a6('0x28')](respondWithResult(_0x3c9a8e,0xc9))[_0x99a6('0x46')](handleError(_0x3c9a8e,null));};exports[_0x99a6('0x26')]=function(_0x4b7a6b,_0x4903c4){if(_0x4b7a6b[_0x99a6('0x4a')]['id']){delete _0x4b7a6b[_0x99a6('0x4a')]['id'];}return db['FaxTransferReport']['find']({'where':{'id':_0x4b7a6b[_0x99a6('0x47')]['id']}})[_0x99a6('0x28')](handleEntityNotFound(_0x4903c4,null))[_0x99a6('0x28')](saveUpdates(_0x4b7a6b['body'],null))[_0x99a6('0x28')](respondWithResult(_0x4903c4,null))['catch'](handleError(_0x4903c4,null));};exports[_0x99a6('0x27')]=function(_0x4f6262,_0x2399bd){return db[_0x99a6('0x42')][_0x99a6('0x4b')]({'where':{'id':_0x4f6262[_0x99a6('0x47')]['id']}})[_0x99a6('0x28')](handleEntityNotFound(_0x2399bd,null))['then'](removeEntity(_0x2399bd,null))[_0x99a6('0x46')](handleError(_0x2399bd,null));};exports['describe']=function(_0x141b00,_0x2034eb){return db[_0x99a6('0x42')][_0x99a6('0x4c')]()[_0x99a6('0x28')](respondWithResult(_0x2034eb,null))['catch'](handleError(_0x2034eb,null));}; \ No newline at end of file +var _0x0507=['rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','FaxTransferReport','rawAttributes','fieldName','type','key','map','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0507,0x1be));var _0x7050=function(_0x2b3614,_0x221880){_0x2b3614=_0x2b3614-0x0;var _0x464edb=_0x0507[_0x2b3614];return _0x464edb;};'use strict';var emlformat=require(_0x7050('0x0'));var rimraf=require(_0x7050('0x1'));var zipdir=require(_0x7050('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7050('0x3'));var moment=require(_0x7050('0x4'));var BPromise=require(_0x7050('0x5'));var Mustache=require(_0x7050('0x6'));var util=require('util');var path=require(_0x7050('0x7'));var sox=require(_0x7050('0x8'));var csv=require(_0x7050('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7050('0xa'));var _=require(_0x7050('0xb'));var squel=require(_0x7050('0xc'));var crypto=require(_0x7050('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7050('0x9'));var querystring=require(_0x7050('0xe'));var Papa=require(_0x7050('0xf'));var Redis=require(_0x7050('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7050('0x11'));var hardwareService=require(_0x7050('0x12'));var logger=require(_0x7050('0x13'))(_0x7050('0x14'));var utils=require('../../config/utils');var config=require(_0x7050('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x39de0e,_0x35daa1){_0x35daa1=_0x35daa1||0xcc;return function(_0x489cc9){if(_0x489cc9){return _0x39de0e[_0x7050('0x16')](_0x35daa1);}return _0x39de0e[_0x7050('0x17')](_0x35daa1)[_0x7050('0x18')]();};}function respondWithResult(_0x13bbbc,_0x424ee8){_0x424ee8=_0x424ee8||0xc8;return function(_0x1265b0){if(_0x1265b0){return _0x13bbbc[_0x7050('0x17')](_0x424ee8)['json'](_0x1265b0);}};}function respondWithFilteredResult(_0x3abcdd,_0x121f0a){return function(_0xeb36ea){if(_0xeb36ea){var _0x1156e0=typeof _0x121f0a[_0x7050('0x19')]===_0x7050('0x1a')&&typeof _0x121f0a[_0x7050('0x1b')]===_0x7050('0x1a');var _0x256c68=_0xeb36ea[_0x7050('0x1c')];var _0x33ac7b=_0x1156e0?0x0:_0x121f0a[_0x7050('0x19')];var _0x676ad3=_0x1156e0?_0xeb36ea[_0x7050('0x1c')]:_0x121f0a['offset']+_0x121f0a[_0x7050('0x1b')];var _0x1ce3e6;if(_0x676ad3>=_0x256c68){_0x676ad3=_0x256c68;_0x1ce3e6=0xc8;}else{_0x1ce3e6=0xce;}_0x3abcdd[_0x7050('0x17')](_0x1ce3e6);return _0x3abcdd['set'](_0x7050('0x1d'),_0x33ac7b+'-'+_0x676ad3+'/'+_0x256c68)[_0x7050('0x1e')](_0xeb36ea);}return null;};}function patchUpdates(_0x589c6f){return function(_0x1ed5a0){try{jsonpatch[_0x7050('0x1f')](_0x1ed5a0,_0x589c6f,!![]);}catch(_0x52147b){return BPromise[_0x7050('0x20')](_0x52147b);}return _0x1ed5a0['save']();};}function saveUpdates(_0x5cbc60,_0x55e521){return function(_0x22af73){if(_0x22af73){return _0x22af73[_0x7050('0x21')](_0x5cbc60)[_0x7050('0x22')](function(_0x10d681){return _0x10d681;});}return null;};}function removeEntity(_0x4bd682,_0xe9cfff){return function(_0xbb1c68){if(_0xbb1c68){return _0xbb1c68[_0x7050('0x23')]()[_0x7050('0x22')](function(){_0x4bd682['status'](0xcc)[_0x7050('0x18')]();});}};}function handleEntityNotFound(_0x10b15d,_0x31c5f6){return function(_0x41df9d){if(!_0x41df9d){_0x10b15d[_0x7050('0x16')](0x194);}return _0x41df9d;};}function handleError(_0x9207f7,_0x3268b5){_0x3268b5=_0x3268b5||0x1f4;return function(_0x293aaf){logger[_0x7050('0x24')](_0x293aaf[_0x7050('0x25')]);if(_0x293aaf[_0x7050('0x26')]){delete _0x293aaf[_0x7050('0x26')];}_0x9207f7[_0x7050('0x17')](_0x3268b5)[_0x7050('0x27')](_0x293aaf);};}exports['index']=function(_0x104e3d,_0x543408){var _0x4dcaf2={},_0x4d33c2={},_0x145c9a={'count':0x0,'rows':[]};var _0x3d9993=_['map'](db[_0x7050('0x28')][_0x7050('0x29')],function(_0x205923){return{'name':_0x205923[_0x7050('0x2a')],'type':_0x205923[_0x7050('0x2b')][_0x7050('0x2c')]};});_0x4d33c2['model']=_[_0x7050('0x2d')](_0x3d9993,_0x7050('0x26'));_0x4d33c2[_0x7050('0x2e')]=_[_0x7050('0x2f')](_0x104e3d[_0x7050('0x2e')]);_0x4d33c2[_0x7050('0x30')]=_['intersection'](_0x4d33c2[_0x7050('0x31')],_0x4d33c2[_0x7050('0x2e')]);_0x4dcaf2['attributes']=_[_0x7050('0x32')](_0x4d33c2['model'],qs['fields'](_0x104e3d[_0x7050('0x2e')][_0x7050('0x33')]));_0x4dcaf2[_0x7050('0x34')]=_0x4dcaf2['attributes'][_0x7050('0x35')]?_0x4dcaf2[_0x7050('0x34')]:_0x4d33c2['model'];if(!_0x104e3d[_0x7050('0x2e')][_0x7050('0x36')](_0x7050('0x37'))){_0x4dcaf2[_0x7050('0x1b')]=qs[_0x7050('0x1b')](_0x104e3d['query'][_0x7050('0x1b')]);_0x4dcaf2[_0x7050('0x19')]=qs[_0x7050('0x19')](_0x104e3d[_0x7050('0x2e')][_0x7050('0x19')]);}_0x4dcaf2['order']=qs['sort'](_0x104e3d[_0x7050('0x2e')][_0x7050('0x38')]);_0x4dcaf2[_0x7050('0x39')]=qs[_0x7050('0x30')](_['pick'](_0x104e3d['query'],_0x4d33c2['filters']),_0x3d9993);if(_0x104e3d['query'][_0x7050('0x3a')]){_0x4dcaf2[_0x7050('0x39')]=_['merge'](_0x4dcaf2[_0x7050('0x39')],{'$or':_[_0x7050('0x2d')](_0x3d9993,function(_0xa6f053){if(_0xa6f053[_0x7050('0x2b')]!==_0x7050('0x3b')){var _0x55d022={};_0x55d022[_0xa6f053[_0x7050('0x26')]]={'$like':'%'+_0x104e3d[_0x7050('0x2e')]['filter']+'%'};return _0x55d022;}})});}_0x4dcaf2=_[_0x7050('0x3c')]({},_0x4dcaf2,_0x104e3d[_0x7050('0x3d')]);var _0x2f9f17={'where':_0x4dcaf2[_0x7050('0x39')]};return db[_0x7050('0x28')][_0x7050('0x1c')](_0x2f9f17)[_0x7050('0x22')](function(_0x458cb0){_0x145c9a[_0x7050('0x1c')]=_0x458cb0;if(_0x104e3d[_0x7050('0x2e')][_0x7050('0x3e')]){_0x4dcaf2[_0x7050('0x3f')]=[{'all':!![]}];}return db[_0x7050('0x28')][_0x7050('0x40')](_0x4dcaf2);})['then'](function(_0x5c5ac3){_0x145c9a[_0x7050('0x41')]=_0x5c5ac3;return _0x145c9a;})['then'](respondWithFilteredResult(_0x543408,_0x4dcaf2))[_0x7050('0x42')](handleError(_0x543408,null));};exports[_0x7050('0x43')]=function(_0x58a6b3,_0x5224cc){var _0x1dde01={'raw':!![],'where':{'id':_0x58a6b3[_0x7050('0x44')]['id']}},_0x58299c={};_0x58299c[_0x7050('0x31')]=_['keys'](db[_0x7050('0x28')]['rawAttributes']);_0x58299c[_0x7050('0x2e')]=_[_0x7050('0x2f')](_0x58a6b3['query']);_0x58299c[_0x7050('0x30')]=_[_0x7050('0x32')](_0x58299c['model'],_0x58299c[_0x7050('0x2e')]);_0x1dde01['attributes']=_[_0x7050('0x32')](_0x58299c[_0x7050('0x31')],qs[_0x7050('0x33')](_0x58a6b3[_0x7050('0x2e')][_0x7050('0x33')]));_0x1dde01[_0x7050('0x34')]=_0x1dde01['attributes'][_0x7050('0x35')]?_0x1dde01['attributes']:_0x58299c[_0x7050('0x31')];if(_0x58a6b3[_0x7050('0x2e')][_0x7050('0x3e')]){_0x1dde01[_0x7050('0x3f')]=[{'all':!![]}];}_0x1dde01=_['merge']({},_0x1dde01,_0x58a6b3[_0x7050('0x3d')]);return db[_0x7050('0x28')][_0x7050('0x45')](_0x1dde01)[_0x7050('0x22')](handleEntityNotFound(_0x5224cc,null))[_0x7050('0x22')](respondWithResult(_0x5224cc,null))[_0x7050('0x42')](handleError(_0x5224cc,null));};exports[_0x7050('0x46')]=function(_0x15efc0,_0x328d8c){return db[_0x7050('0x28')]['create'](_0x15efc0[_0x7050('0x47')],{})[_0x7050('0x22')](respondWithResult(_0x328d8c,0xc9))[_0x7050('0x42')](handleError(_0x328d8c,null));};exports['update']=function(_0x2877d0,_0x5aab34){if(_0x2877d0['body']['id']){delete _0x2877d0[_0x7050('0x47')]['id'];}return db['FaxTransferReport'][_0x7050('0x45')]({'where':{'id':_0x2877d0['params']['id']}})[_0x7050('0x22')](handleEntityNotFound(_0x5aab34,null))[_0x7050('0x22')](saveUpdates(_0x2877d0[_0x7050('0x47')],null))[_0x7050('0x22')](respondWithResult(_0x5aab34,null))['catch'](handleError(_0x5aab34,null));};exports[_0x7050('0x23')]=function(_0x16b847,_0x970f19){return db['FaxTransferReport'][_0x7050('0x45')]({'where':{'id':_0x16b847[_0x7050('0x44')]['id']}})[_0x7050('0x22')](handleEntityNotFound(_0x970f19,null))[_0x7050('0x22')](removeEntity(_0x970f19,null))[_0x7050('0x42')](handleError(_0x970f19,null));};exports[_0x7050('0x48')]=function(_0x2f57c,_0xa520e7){return db[_0x7050('0x28')][_0x7050('0x48')]()['then'](respondWithResult(_0xa520e7,null))[_0x7050('0x42')](handleError(_0xa520e7,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 025ecc5..5d515a2 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 _0xa469=['../../config/logger','api','moment','bluebird','request-promise','path','exports','define','report_fax_transfer','uniqueid','util'];(function(_0x5b1409,_0x1f317d){var _0x138c6a=function(_0x53d556){while(--_0x53d556){_0x5b1409['push'](_0x5b1409['shift']());}};_0x138c6a(++_0x1f317d);}(_0xa469,0x128));var _0x9a46=function(_0x38377b,_0x2fc985){_0x38377b=_0x38377b-0x0;var _0x21a923=_0xa469[_0x38377b];return _0x21a923;};'use strict';var _=require('lodash');var util=require(_0x9a46('0x0'));var logger=require(_0x9a46('0x1'))(_0x9a46('0x2'));var moment=require(_0x9a46('0x3'));var BPromise=require(_0x9a46('0x4'));var rp=require(_0x9a46('0x5'));var fs=require('fs');var path=require(_0x9a46('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxTransferReport.attributes');module[_0x9a46('0x7')]=function(_0x41af38,_0x3b658b){return _0x41af38[_0x9a46('0x8')]('FaxTransferReport',attributes,{'tableName':_0x9a46('0x9'),'paranoid':![],'indexes':[{'name':_0x9a46('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2dcf=['exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes'];(function(_0x4307d0,_0x31ae0){var _0x4bb86f=function(_0x4e2fc0){while(--_0x4e2fc0){_0x4307d0['push'](_0x4307d0['shift']());}};_0x4bb86f(++_0x31ae0);}(_0x2dcf,0x1c5));var _0xf2dc=function(_0x4029b3,_0x50061f){_0x4029b3=_0x4029b3-0x0;var _0x5a429e=_0x2dcf[_0x4029b3];return _0x5a429e;};'use strict';var _=require(_0xf2dc('0x0'));var util=require(_0xf2dc('0x1'));var logger=require(_0xf2dc('0x2'))(_0xf2dc('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf2dc('0x4'));var fs=require('fs');var path=require(_0xf2dc('0x5'));var rimraf=require(_0xf2dc('0x6'));var config=require(_0xf2dc('0x7'));var attributes=require(_0xf2dc('0x8'));module[_0xf2dc('0x9')]=function(_0x2b380d,_0x27cfac){return _0x2b380d[_0xf2dc('0xa')](_0xf2dc('0xb'),attributes,{'tableName':_0xf2dc('0xc'),'paranoid':![],'indexes':[{'name':_0xf2dc('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 982f7f0..4b96944 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 _0xd233=['result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','FaxTransferReport,\x20%s,\x20%s','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x406bce,_0x20c4f2){var _0x4d70a7=function(_0x28a32){while(--_0x28a32){_0x406bce['push'](_0x406bce['shift']());}};_0x4d70a7(++_0x20c4f2);}(_0xd233,0x70));var _0x3d23=function(_0x3d8f92,_0x14017a){_0x3d8f92=_0x3d8f92-0x0;var _0x1e7b44=_0xd233[_0x3d8f92];return _0x1e7b44;};'use strict';var _=require(_0x3d23('0x0'));var util=require(_0x3d23('0x1'));var moment=require(_0x3d23('0x2'));var BPromise=require(_0x3d23('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d23('0x4'));var db=require(_0x3d23('0x5'))['db'];var utils=require(_0x3d23('0x6'));var logger=require(_0x3d23('0x7'))(_0x3d23('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d23('0x9')][_0x3d23('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a6d7f,_0x4db2d4,_0x429956){return new BPromise(function(_0x13344a,_0x171764){return client[_0x3d23('0xb')](_0x3a6d7f,_0x429956)['then'](function(_0x2b72fd){logger[_0x3d23('0xc')](_0x3d23('0xd'),_0x4db2d4,'request\x20sent');logger[_0x3d23('0xe')](_0x3d23('0xf'),_0x4db2d4,_0x3d23('0x10'),JSON['stringify'](_0x2b72fd));if(_0x2b72fd[_0x3d23('0x11')]){if(_0x2b72fd[_0x3d23('0x11')][_0x3d23('0x12')]===0x1f4){logger[_0x3d23('0x11')](_0x3d23('0xd'),_0x4db2d4,_0x2b72fd['error'][_0x3d23('0x13')]);return _0x171764(_0x2b72fd[_0x3d23('0x11')][_0x3d23('0x13')]);}logger['error'](_0x3d23('0xd'),_0x4db2d4,_0x2b72fd[_0x3d23('0x11')]['message']);return _0x13344a(_0x2b72fd[_0x3d23('0x11')][_0x3d23('0x13')]);}else{logger[_0x3d23('0xc')](_0x3d23('0xd'),_0x4db2d4,'request\x20sent');_0x13344a(_0x2b72fd[_0x3d23('0x14')][_0x3d23('0x13')]);}})[_0x3d23('0x15')](function(_0xe0ab8b){logger[_0x3d23('0x11')](_0x3d23('0xd'),_0x4db2d4,_0xe0ab8b);_0x171764(_0xe0ab8b);});});} \ No newline at end of file +var _0x6a4d=['FaxTransferReport,\x20%s,\x20%s','message','info','catch','moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x846250,_0x3ae5c2){var _0x3bb0c2=function(_0x37b316){while(--_0x37b316){_0x846250['push'](_0x846250['shift']());}};_0x3bb0c2(++_0x3ae5c2);}(_0x6a4d,0x193));var _0xd6a4=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x6a4d[_0x2e4aa2];return _0x5e6092;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd6a4('0x0'));var BPromise=require('bluebird');var rs=require(_0xd6a4('0x1'));var fs=require('fs');var Redis=require(_0xd6a4('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xd6a4('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0xd6a4('0x4'));var jayson=require(_0xd6a4('0x5'));var client=jayson[_0xd6a4('0x6')][_0xd6a4('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1e3f78,_0x288314,_0x5c3a71){return new BPromise(function(_0x31684c,_0x1025a8){return client[_0xd6a4('0x8')](_0x1e3f78,_0x5c3a71)[_0xd6a4('0x9')](function(_0x1de477){logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x288314,_0xd6a4('0xa'));logger[_0xd6a4('0xb')](_0xd6a4('0xc'),_0x288314,_0xd6a4('0xa'),JSON['stringify'](_0x1de477));if(_0x1de477[_0xd6a4('0xd')]){if(_0x1de477[_0xd6a4('0xd')][_0xd6a4('0xe')]===0x1f4){logger[_0xd6a4('0xd')](_0xd6a4('0xf'),_0x288314,_0x1de477[_0xd6a4('0xd')]['message']);return _0x1025a8(_0x1de477[_0xd6a4('0xd')]['message']);}logger[_0xd6a4('0xd')](_0xd6a4('0xf'),_0x288314,_0x1de477[_0xd6a4('0xd')][_0xd6a4('0x10')]);return _0x31684c(_0x1de477[_0xd6a4('0xd')]['message']);}else{logger[_0xd6a4('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x288314,_0xd6a4('0xa'));_0x31684c(_0x1de477['result'][_0xd6a4('0x10')]);}})[_0xd6a4('0x12')](function(_0x582fba){logger[_0xd6a4('0xd')]('FaxTransferReport,\x20%s,\x20%s',_0x288314,_0x582fba);_0x1025a8(_0x582fba);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 79156e8..6bda31a 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 _0x1cfb=['delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update'];(function(_0x1d85f6,_0x47715b){var _0x2ead20=function(_0x2568c9){while(--_0x2568c9){_0x1d85f6['push'](_0x1d85f6['shift']());}};_0x2ead20(++_0x47715b);}(_0x1cfb,0x17f));var _0xb1cf=function(_0x5b6375,_0x563718){_0x5b6375=_0x5b6375-0x0;var _0x4045b4=_0x1cfb[_0x5b6375];return _0x4045b4;};'use strict';var multer=require(_0xb1cf('0x0'));var util=require('util');var path=require(_0xb1cf('0x1'));var timeout=require(_0xb1cf('0x2'));var express=require('express');var router=express[_0xb1cf('0x3')]();var fs_extra=require(_0xb1cf('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb1cf('0x5'));var controller=require('./faxTransferReport.controller');router[_0xb1cf('0x6')]('/',auth[_0xb1cf('0x7')](),controller[_0xb1cf('0x8')]);router[_0xb1cf('0x6')](_0xb1cf('0x9'),auth[_0xb1cf('0x7')](),controller[_0xb1cf('0xa')]);router[_0xb1cf('0x6')](_0xb1cf('0xb'),auth[_0xb1cf('0x7')](),controller[_0xb1cf('0xc')]);router[_0xb1cf('0xd')]('/',auth[_0xb1cf('0x7')](),controller[_0xb1cf('0xe')]);router[_0xb1cf('0xf')](_0xb1cf('0xb'),auth['isAuthenticated'](),controller[_0xb1cf('0x10')]);router[_0xb1cf('0x11')](_0xb1cf('0xb'),auth[_0xb1cf('0x7')](),controller[_0xb1cf('0x12')]);module[_0xb1cf('0x13')]=router; \ No newline at end of file +var _0x0f0e=['../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','post','put','update','delete','multer','util','path','connect-timeout','fs-extra'];(function(_0x3598bb,_0x24befa){var _0x13c837=function(_0x3de578){while(--_0x3de578){_0x3598bb['push'](_0x3598bb['shift']());}};_0x13c837(++_0x24befa);}(_0x0f0e,0x13f));var _0xe0f0=function(_0x3fbed6,_0x39a990){_0x3fbed6=_0x3fbed6-0x0;var _0x54bf2f=_0x0f0e[_0x3fbed6];return _0x54bf2f;};'use strict';var multer=require(_0xe0f0('0x0'));var util=require(_0xe0f0('0x1'));var path=require(_0xe0f0('0x2'));var timeout=require(_0xe0f0('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe0f0('0x4'));var auth=require(_0xe0f0('0x5'));var interaction=require(_0xe0f0('0x6'));var config=require(_0xe0f0('0x7'));var controller=require(_0xe0f0('0x8'));router[_0xe0f0('0x9')]('/',auth[_0xe0f0('0xa')](),controller['index']);router[_0xe0f0('0x9')](_0xe0f0('0xb'),auth['isAuthenticated'](),controller[_0xe0f0('0xc')]);router[_0xe0f0('0x9')](_0xe0f0('0xd'),auth[_0xe0f0('0xa')](),controller['show']);router[_0xe0f0('0xe')]('/',auth[_0xe0f0('0xa')](),controller['create']);router[_0xe0f0('0xf')](_0xe0f0('0xd'),auth[_0xe0f0('0xa')](),controller[_0xe0f0('0x10')]);router[_0xe0f0('0x11')](_0xe0f0('0xd'),auth[_0xe0f0('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index e59e446..5c3ac7a 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 _0xcdcb=['express','Router','../../components/auth/service','../../components/interaction/service','get','/:id','show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields','post','addConfiguration','update','delete','destroy','util','path','connect-timeout'];(function(_0xf13970,_0xd0f3a0){var _0x25fa5f=function(_0x3d5eb8){while(--_0x3d5eb8){_0xf13970['push'](_0xf13970['shift']());}};_0x25fa5f(++_0xd0f3a0);}(_0xcdcb,0x75));var _0xbcdc=function(_0x5c1fd6,_0x32fe90){_0x5c1fd6=_0x5c1fd6-0x0;var _0x59ae81=_0xcdcb[_0x5c1fd6];return _0x59ae81;};'use strict';var multer=require('multer');var util=require(_0xbcdc('0x0'));var path=require(_0xbcdc('0x1'));var timeout=require(_0xbcdc('0x2'));var express=require(_0xbcdc('0x3'));var router=express[_0xbcdc('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbcdc('0x5'));var interaction=require(_0xbcdc('0x6'));var config=require('../../config/environment');var controller=require('./intDeskAccount.controller');router[_0xbcdc('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xbcdc('0x7')](_0xbcdc('0x8'),auth['isAuthenticated'](),controller[_0xbcdc('0x9')]);router[_0xbcdc('0x7')](_0xbcdc('0xa'),auth[_0xbcdc('0xb')](),controller[_0xbcdc('0xc')]);router[_0xbcdc('0x7')](_0xbcdc('0xd'),auth[_0xbcdc('0xb')](),controller[_0xbcdc('0xe')]);router['post']('/',auth[_0xbcdc('0xb')](),controller['create']);router[_0xbcdc('0xf')](_0xbcdc('0xa'),auth[_0xbcdc('0xb')](),controller[_0xbcdc('0x10')]);router['put'](_0xbcdc('0x8'),auth[_0xbcdc('0xb')](),controller[_0xbcdc('0x11')]);router[_0xbcdc('0x12')](_0xbcdc('0x8'),auth[_0xbcdc('0xb')](),controller[_0xbcdc('0x13')]);module['exports']=router; \ No newline at end of file +var _0xc137=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','/:id','show','getConfigurations','/:id/fields','getFields','create','/:id/configurations','put','update','delete'];(function(_0x3d2044,_0xfdcf28){var _0x166f69=function(_0x31c7c7){while(--_0x31c7c7){_0x3d2044['push'](_0x3d2044['shift']());}};_0x166f69(++_0xfdcf28);}(_0xc137,0x1b7));var _0x7c13=function(_0x1e3ca4,_0x490830){_0x1e3ca4=_0x1e3ca4-0x0;var _0x179d1c=_0xc137[_0x1e3ca4];return _0x179d1c;};'use strict';var multer=require(_0x7c13('0x0'));var util=require(_0x7c13('0x1'));var path=require('path');var timeout=require(_0x7c13('0x2'));var express=require(_0x7c13('0x3'));var router=express[_0x7c13('0x4')]();var fs_extra=require(_0x7c13('0x5'));var auth=require(_0x7c13('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7c13('0x7'));var controller=require(_0x7c13('0x8'));router[_0x7c13('0x9')]('/',auth[_0x7c13('0xa')](),controller['index']);router[_0x7c13('0x9')](_0x7c13('0xb'),auth[_0x7c13('0xa')](),controller[_0x7c13('0xc')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0x7c13('0xd')]);router[_0x7c13('0x9')](_0x7c13('0xe'),auth[_0x7c13('0xa')](),controller[_0x7c13('0xf')]);router['post']('/',auth[_0x7c13('0xa')](),controller[_0x7c13('0x10')]);router['post'](_0x7c13('0x11'),auth[_0x7c13('0xa')](),controller['addConfiguration']);router[_0x7c13('0x12')]('/:id',auth[_0x7c13('0xa')](),controller[_0x7c13('0x13')]);router[_0x7c13('0x14')](_0x7c13('0xb'),auth[_0x7c13('0xa')](),controller[_0x7c13('0x15')]);module[_0x7c13('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 3420ca8..a22a41c 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 _0x595e=['exports','STRING','ENUM','basic','integrationTab','sequelize'];(function(_0x54edc9,_0x345f01){var _0x2ae7a9=function(_0x24a545){while(--_0x24a545){_0x54edc9['push'](_0x54edc9['shift']());}};_0x2ae7a9(++_0x345f01);}(_0x595e,0x15b));var _0xe595=function(_0x1b28ff,_0x31c576){_0x1b28ff=_0x1b28ff-0x0;var _0x51ca03=_0x595e[_0x1b28ff];return _0x51ca03;};'use strict';var Sequelize=require(_0xe595('0x0'));module[_0xe595('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe595('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xe595('0x2')]},'authType':{'type':Sequelize[_0xe595('0x3')]('basic'),'defaultValue':_0xe595('0x4')},'password':{'type':Sequelize[_0xe595('0x2')]},'consumerKey':{'type':Sequelize[_0xe595('0x2')]},'consumerSecret':{'type':Sequelize[_0xe595('0x2')]},'token':{'type':Sequelize[_0xe595('0x2')]},'tokenSecret':{'type':Sequelize[_0xe595('0x2')]},'serverUrl':{'type':Sequelize[_0xe595('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe595('0x5'),'newTab'),'defaultValue':_0xe595('0x5')}}; \ No newline at end of file +var _0xa672=['STRING','ENUM','basic','integrationTab','newTab','exports'];(function(_0x28ab1a,_0x41638e){var _0x2db742=function(_0x5f5d8f){while(--_0x5f5d8f){_0x28ab1a['push'](_0x28ab1a['shift']());}};_0x2db742(++_0x41638e);}(_0xa672,0x1f1));var _0x2a67=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xa672[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require('sequelize');module[_0x2a67('0x0')]={'name':{'type':Sequelize[_0x2a67('0x1')]},'description':{'type':Sequelize[_0x2a67('0x1')]},'username':{'type':Sequelize[_0x2a67('0x1')]},'remoteUri':{'type':Sequelize[_0x2a67('0x1')]},'authType':{'type':Sequelize[_0x2a67('0x2')](_0x2a67('0x3')),'defaultValue':'basic'},'password':{'type':Sequelize[_0x2a67('0x1')]},'consumerKey':{'type':Sequelize[_0x2a67('0x1')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x2a67('0x1')]},'tokenSecret':{'type':Sequelize[_0x2a67('0x1')]},'serverUrl':{'type':Sequelize[_0x2a67('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x2a67('0x2')](_0x2a67('0x4'),_0x2a67('0x5')),'defaultValue':_0x2a67('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index a31ed11..b15a642 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 _0x1e77=['update','destroy','then','error','stack','send','map','DeskAccount','rawAttributes','type','key','model','name','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','catch','show','params','length','find','create','body','getConfigurations','findOne','addConfiguration','getSubjects','channel','DeskField','Subjects','Descriptions','priority','authType','username','consumerKey','consumerSecret','token','slice','substring','lastIndexOf','format','%s/custom_fields','application/json','basic','Authorization','Basic\x20%s','%s:%s','password','toString','entries','active','label','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','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','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save'];(function(_0x3952da,_0x248115){var _0x4c8cd0=function(_0x415ce3){while(--_0x415ce3){_0x3952da['push'](_0x3952da['shift']());}};_0x4c8cd0(++_0x248115);}(_0x1e77,0x19c));var _0x71e7=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x1e77[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x71e7('0x0'));var rimraf=require(_0x71e7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x71e7('0x2'));var rp=require(_0x71e7('0x3'));var moment=require(_0x71e7('0x4'));var BPromise=require(_0x71e7('0x5'));var Mustache=require('mustache');var util=require(_0x71e7('0x6'));var path=require(_0x71e7('0x7'));var sox=require(_0x71e7('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x71e7('0x9'));var _=require(_0x71e7('0xa'));var squel=require(_0x71e7('0xb'));var crypto=require(_0x71e7('0xc'));var jsforce=require(_0x71e7('0xd'));var deskjs=require(_0x71e7('0xe'));var toCsv=require(_0x71e7('0xf'));var querystring=require('querystring');var Papa=require(_0x71e7('0x10'));var Redis=require(_0x71e7('0x11'));var authService=require(_0x71e7('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x71e7('0x13'));var hardwareService=require(_0x71e7('0x14'));var logger=require(_0x71e7('0x15'))(_0x71e7('0x16'));var utils=require(_0x71e7('0x17'));var config=require(_0x71e7('0x18'));var licenseUtil=require(_0x71e7('0x19'));var db=require(_0x71e7('0x1a'))['db'];var integrations=require(_0x71e7('0x1b'));function respondWithStatusCode(_0x219832,_0x568137){_0x568137=_0x568137||0xcc;return function(_0x3fde63){if(_0x3fde63){return _0x219832[_0x71e7('0x1c')](_0x568137);}return _0x219832['status'](_0x568137)[_0x71e7('0x1d')]();};}function respondWithResult(_0x1dd33f,_0xa1bf61){_0xa1bf61=_0xa1bf61||0xc8;return function(_0x306fde){if(_0x306fde){return _0x1dd33f[_0x71e7('0x1e')](_0xa1bf61)[_0x71e7('0x1f')](_0x306fde);}};}function respondWithFilteredResult(_0x2a3206,_0x2d5e59){return function(_0x22bac6){if(_0x22bac6){var _0xd71a51=typeof _0x2d5e59[_0x71e7('0x20')]===_0x71e7('0x21')&&typeof _0x2d5e59[_0x71e7('0x22')]===_0x71e7('0x21');var _0x427cca=_0x22bac6[_0x71e7('0x23')];var _0x2d8023=_0xd71a51?0x0:_0x2d5e59[_0x71e7('0x20')];var _0x34ad4e=_0xd71a51?_0x22bac6['count']:_0x2d5e59[_0x71e7('0x20')]+_0x2d5e59[_0x71e7('0x22')];var _0x443be4;if(_0x34ad4e>=_0x427cca){_0x34ad4e=_0x427cca;_0x443be4=0xc8;}else{_0x443be4=0xce;}_0x2a3206[_0x71e7('0x1e')](_0x443be4);return _0x2a3206[_0x71e7('0x24')](_0x71e7('0x25'),_0x2d8023+'-'+_0x34ad4e+'/'+_0x427cca)[_0x71e7('0x1f')](_0x22bac6);}return null;};}function patchUpdates(_0x468b2f){return function(_0x2ebf67){try{jsonpatch[_0x71e7('0x26')](_0x2ebf67,_0x468b2f,!![]);}catch(_0x1632db){return BPromise['reject'](_0x1632db);}return _0x2ebf67[_0x71e7('0x27')]();};}function saveUpdates(_0x99f91c,_0x29ab5c){return function(_0xca0662){if(_0xca0662){return _0xca0662[_0x71e7('0x28')](_0x99f91c)['then'](function(_0x227802){return _0x227802;});}return null;};}function removeEntity(_0x63e1,_0x563683){return function(_0x22d923){if(_0x22d923){return _0x22d923[_0x71e7('0x29')]()[_0x71e7('0x2a')](function(){_0x63e1[_0x71e7('0x1e')](0xcc)[_0x71e7('0x1d')]();});}};}function handleEntityNotFound(_0x26a29d,_0x3e1f44){return function(_0x3c8629){if(!_0x3c8629){_0x26a29d[_0x71e7('0x1c')](0x194);}return _0x3c8629;};}function handleError(_0x341ab0,_0xd79267){_0xd79267=_0xd79267||0x1f4;return function(_0x5ca906){logger[_0x71e7('0x2b')](_0x5ca906[_0x71e7('0x2c')]);if(_0x5ca906['name']){delete _0x5ca906['name'];}_0x341ab0[_0x71e7('0x1e')](_0xd79267)[_0x71e7('0x2d')](_0x5ca906);};}exports['index']=function(_0x329a24,_0x4cd4a1){var _0x171f38={},_0x4bd7af={},_0x477b0a={'count':0x0,'rows':[]};var _0x1ffec6=_[_0x71e7('0x2e')](db[_0x71e7('0x2f')][_0x71e7('0x30')],function(_0x2d4721){return{'name':_0x2d4721['fieldName'],'type':_0x2d4721[_0x71e7('0x31')][_0x71e7('0x32')]};});_0x4bd7af[_0x71e7('0x33')]=_[_0x71e7('0x2e')](_0x1ffec6,_0x71e7('0x34'));_0x4bd7af[_0x71e7('0x35')]=_[_0x71e7('0x36')](_0x329a24['query']);_0x4bd7af[_0x71e7('0x37')]=_['intersection'](_0x4bd7af[_0x71e7('0x33')],_0x4bd7af[_0x71e7('0x35')]);_0x171f38[_0x71e7('0x38')]=_[_0x71e7('0x39')](_0x4bd7af[_0x71e7('0x33')],qs[_0x71e7('0x3a')](_0x329a24[_0x71e7('0x35')][_0x71e7('0x3a')]));_0x171f38[_0x71e7('0x38')]=_0x171f38['attributes']['length']?_0x171f38['attributes']:_0x4bd7af['model'];if(!_0x329a24[_0x71e7('0x35')][_0x71e7('0x3b')](_0x71e7('0x3c'))){_0x171f38['limit']=qs[_0x71e7('0x22')](_0x329a24[_0x71e7('0x35')][_0x71e7('0x22')]);_0x171f38[_0x71e7('0x20')]=qs[_0x71e7('0x20')](_0x329a24['query']['offset']);}_0x171f38[_0x71e7('0x3d')]=qs[_0x71e7('0x3e')](_0x329a24[_0x71e7('0x35')]['sort']);_0x171f38[_0x71e7('0x3f')]=qs[_0x71e7('0x37')](_[_0x71e7('0x40')](_0x329a24[_0x71e7('0x35')],_0x4bd7af[_0x71e7('0x37')]),_0x1ffec6);if(_0x329a24['query']['filter']){_0x171f38[_0x71e7('0x3f')]=_[_0x71e7('0x41')](_0x171f38[_0x71e7('0x3f')],{'$or':_[_0x71e7('0x2e')](_0x1ffec6,function(_0x58f8dc){if(_0x58f8dc[_0x71e7('0x31')]!=='VIRTUAL'){var _0x3cbdbe={};_0x3cbdbe[_0x58f8dc['name']]={'$like':'%'+_0x329a24[_0x71e7('0x35')][_0x71e7('0x42')]+'%'};return _0x3cbdbe;}})});}_0x171f38=_['merge']({},_0x171f38,_0x329a24[_0x71e7('0x43')]);var _0x47e3d8={'where':_0x171f38[_0x71e7('0x3f')]};return db[_0x71e7('0x2f')][_0x71e7('0x23')](_0x47e3d8)[_0x71e7('0x2a')](function(_0x4e293c){_0x477b0a['count']=_0x4e293c;if(_0x329a24[_0x71e7('0x35')][_0x71e7('0x44')]){_0x171f38[_0x71e7('0x45')]=[{'all':!![]}];}return db['DeskAccount'][_0x71e7('0x46')](_0x171f38);})[_0x71e7('0x2a')](function(_0x285ced){_0x477b0a['rows']=_0x285ced;return _0x477b0a;})[_0x71e7('0x2a')](respondWithFilteredResult(_0x4cd4a1,_0x171f38))[_0x71e7('0x47')](handleError(_0x4cd4a1,null));};exports[_0x71e7('0x48')]=function(_0x55a408,_0x6efbbd){var _0x531cbf={'raw':![],'where':{'id':_0x55a408[_0x71e7('0x49')]['id']}},_0xd047f6={};_0xd047f6[_0x71e7('0x33')]=_['keys'](db[_0x71e7('0x2f')][_0x71e7('0x30')]);_0xd047f6['query']=_[_0x71e7('0x36')](_0x55a408[_0x71e7('0x35')]);_0xd047f6[_0x71e7('0x37')]=_['intersection'](_0xd047f6[_0x71e7('0x33')],_0xd047f6[_0x71e7('0x35')]);_0x531cbf[_0x71e7('0x38')]=_['intersection'](_0xd047f6[_0x71e7('0x33')],qs[_0x71e7('0x3a')](_0x55a408[_0x71e7('0x35')][_0x71e7('0x3a')]));_0x531cbf[_0x71e7('0x38')]=_0x531cbf[_0x71e7('0x38')][_0x71e7('0x4a')]?_0x531cbf[_0x71e7('0x38')]:_0xd047f6[_0x71e7('0x33')];if(_0x55a408[_0x71e7('0x35')][_0x71e7('0x44')]){_0x531cbf[_0x71e7('0x45')]=[{'all':!![]}];}_0x531cbf=_[_0x71e7('0x41')]({},_0x531cbf,_0x55a408[_0x71e7('0x43')]);return db[_0x71e7('0x2f')][_0x71e7('0x4b')](_0x531cbf)['then'](handleEntityNotFound(_0x6efbbd,null))['then'](respondWithResult(_0x6efbbd,null))[_0x71e7('0x47')](handleError(_0x6efbbd,null));};exports[_0x71e7('0x4c')]=function(_0x5d1d8c,_0x2757f8){return db['DeskAccount'][_0x71e7('0x4c')](_0x5d1d8c[_0x71e7('0x4d')],{})[_0x71e7('0x2a')](respondWithResult(_0x2757f8,0xc9))['catch'](handleError(_0x2757f8,null));};exports[_0x71e7('0x28')]=function(_0x495caf,_0x2c9310){if(_0x495caf[_0x71e7('0x4d')]['id']){delete _0x495caf[_0x71e7('0x4d')]['id'];}return db[_0x71e7('0x2f')][_0x71e7('0x4b')]({'where':{'id':_0x495caf[_0x71e7('0x49')]['id']}})[_0x71e7('0x2a')](handleEntityNotFound(_0x2c9310,null))[_0x71e7('0x2a')](saveUpdates(_0x495caf[_0x71e7('0x4d')],null))[_0x71e7('0x2a')](respondWithResult(_0x2c9310,null))[_0x71e7('0x47')](handleError(_0x2c9310,null));};exports[_0x71e7('0x29')]=function(_0x42b856,_0x27ecca){return db['DeskAccount'][_0x71e7('0x4b')]({'where':{'id':_0x42b856['params']['id']}})[_0x71e7('0x2a')](handleEntityNotFound(_0x27ecca,null))[_0x71e7('0x2a')](removeEntity(_0x27ecca,null))[_0x71e7('0x47')](handleError(_0x27ecca,null));};exports[_0x71e7('0x4e')]=function(_0x5bd4af,_0x1258e6,_0x312dc8){var _0x583611={};var _0x8c9b98={};var _0x1227b5;var _0x106721;return db['DeskAccount'][_0x71e7('0x4f')]({'where':{'id':_0x5bd4af[_0x71e7('0x49')]['id']}})['then'](handleEntityNotFound(_0x1258e6,null))[_0x71e7('0x2a')](function(_0x2fc0a7){if(_0x2fc0a7){_0x1227b5=_0x2fc0a7;_0x8c9b98[_0x71e7('0x33')]=_['keys'](db['DeskConfiguration'][_0x71e7('0x30')]);_0x8c9b98[_0x71e7('0x35')]=_[_0x71e7('0x36')](_0x5bd4af[_0x71e7('0x35')]);_0x8c9b98[_0x71e7('0x37')]=_[_0x71e7('0x39')](_0x8c9b98[_0x71e7('0x33')],_0x8c9b98[_0x71e7('0x35')]);_0x583611[_0x71e7('0x38')]=_[_0x71e7('0x39')](_0x8c9b98[_0x71e7('0x33')],qs['fields'](_0x5bd4af[_0x71e7('0x35')][_0x71e7('0x3a')]));_0x583611[_0x71e7('0x38')]=_0x583611[_0x71e7('0x38')]['length']?_0x583611['attributes']:_0x8c9b98[_0x71e7('0x33')];_0x583611[_0x71e7('0x3d')]=qs[_0x71e7('0x3e')](_0x5bd4af[_0x71e7('0x35')][_0x71e7('0x3e')]);_0x583611[_0x71e7('0x3f')]=qs[_0x71e7('0x37')](_[_0x71e7('0x40')](_0x5bd4af[_0x71e7('0x35')],_0x8c9b98['filters']));if(_0x5bd4af[_0x71e7('0x35')]['filter']){_0x583611[_0x71e7('0x3f')]=_[_0x71e7('0x41')](_0x583611[_0x71e7('0x3f')],{'$or':_[_0x71e7('0x2e')](_0x583611[_0x71e7('0x38')],function(_0x205352){var _0x2b47ca={};_0x2b47ca[_0x205352]={'$like':'%'+_0x5bd4af[_0x71e7('0x35')][_0x71e7('0x42')]+'%'};return _0x2b47ca;})});}_0x583611=_['merge']({},_0x583611,_0x5bd4af[_0x71e7('0x43')]);return _0x1227b5[_0x71e7('0x4e')](_0x583611);}})[_0x71e7('0x2a')](function(_0x29c87b){if(_0x29c87b){_0x106721=_0x29c87b[_0x71e7('0x4a')];if(!_0x5bd4af[_0x71e7('0x35')][_0x71e7('0x3b')](_0x71e7('0x3c'))){_0x583611['limit']=qs[_0x71e7('0x22')](_0x5bd4af[_0x71e7('0x35')][_0x71e7('0x22')]);_0x583611['offset']=qs[_0x71e7('0x20')](_0x5bd4af[_0x71e7('0x35')][_0x71e7('0x20')]);}return _0x1227b5[_0x71e7('0x4e')](_0x583611);}})[_0x71e7('0x2a')](function(_0x13b7af){if(_0x13b7af){return _0x13b7af?{'count':_0x106721,'rows':_0x13b7af}:null;}})[_0x71e7('0x2a')](respondWithResult(_0x1258e6,null))[_0x71e7('0x47')](handleError(_0x1258e6,null));};exports[_0x71e7('0x50')]=function(_0xcc0f30,_0xc1605,_0x12afc0){if(_0xcc0f30['body']['id']){delete _0xcc0f30[_0x71e7('0x4d')]['id'];}return db[_0x71e7('0x2f')]['findOne']({'where':{'id':_0xcc0f30[_0x71e7('0x49')]['id']}})[_0x71e7('0x2a')](handleEntityNotFound(_0xc1605,null))[_0x71e7('0x2a')](function(_0x2ae3cf){if(_0x2ae3cf){_0xcc0f30['body']['AccountId']=_0x2ae3cf['id'];_0xcc0f30['body']['Subjects']=integrations[_0x71e7('0x51')](_0xcc0f30[_0x71e7('0x4d')]['channel'],_0xcc0f30[_0x71e7('0x4d')][_0x71e7('0x31')]);_0xcc0f30[_0x71e7('0x4d')]['Descriptions']=integrations['getDescriptions'](_0xcc0f30[_0x71e7('0x4d')][_0x71e7('0x52')],_0xcc0f30['body']['type']);return db['DeskConfiguration']['create'](_0xcc0f30[_0x71e7('0x4d')],{'include':[{'model':db[_0x71e7('0x53')],'as':_0x71e7('0x54')},{'model':db[_0x71e7('0x53')],'as':_0x71e7('0x55')}]});}return null;})[_0x71e7('0x2a')](respondWithResult(_0xc1605,null))[_0x71e7('0x47')](handleError(_0xc1605,null));};exports['getFields']=function(_0x4c1645,_0x461714,_0x2199a2){var _0x1ea779=[{'name':_0x71e7('0x56'),'label':_0x71e7('0x56'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x33dfbb='';return db[_0x71e7('0x2f')][_0x71e7('0x4f')]({'where':{'id':_0x4c1645[_0x71e7('0x49')]['id']},'attributes':['id','remoteUri',_0x71e7('0x57'),_0x71e7('0x58'),'password',_0x71e7('0x59'),_0x71e7('0x5a'),_0x71e7('0x5b'),'tokenSecret']})[_0x71e7('0x2a')](handleEntityNotFound(_0x461714,null))[_0x71e7('0x2a')](function(_0x5c9a20){if(_0x5c9a20){_0x33dfbb=_0x5c9a20['remoteUri'];var _0xc589ea=_0x33dfbb[_0x71e7('0x5c')](-0x1);if(_0xc589ea==='/'){_0x33dfbb=_0x33dfbb[_0x71e7('0x5d')](0x0,_0x33dfbb[_0x71e7('0x5e')](_0xc589ea));}var _0x24781f={'method':'GET','uri':util[_0x71e7('0x5f')](_0x71e7('0x60'),_0x33dfbb),'headers':{'Content-Type':'application/json','Accept':_0x71e7('0x61')},'json':!![]};if(_0x5c9a20['authType']===_0x71e7('0x62')){_0x24781f['headers'][_0x71e7('0x63')]=util[_0x71e7('0x5f')](_0x71e7('0x64'),new Buffer(util['format'](_0x71e7('0x65'),_0x5c9a20[_0x71e7('0x58')],_0x5c9a20[_0x71e7('0x66')]))[_0x71e7('0x67')]('base64'));}return rp(_0x24781f)[_0x71e7('0x2a')](function(_0x5a70cc){return _0x1ea779['concat'](_['map'](_0x5a70cc['_embedded'][_0x71e7('0x68')],function(_0x46b566){return{'id':_0x46b566[_0x71e7('0x34')],'name':_0x46b566[_0x71e7('0x34')],'type':_0x46b566[_0x71e7('0x31')],'active':_0x46b566[_0x71e7('0x69')],'label':_0x46b566[_0x71e7('0x6a')],'custom':!![]};}));});}})['then'](function(_0x5985db){return{'count':_0x5985db['length'],'rows':_0x5985db};})[_0x71e7('0x2a')](respondWithResult(_0x461714,null))[_0x71e7('0x47')](function(_0x3c8508){var _0x5151ee=_0x4c1645['query']['test']?0x1f4:_0x3c8508['statusCode']||0x1f4;logger[_0x71e7('0x2b')](_0x71e7('0x6b'),_0x71e7('0x6c'),_0x5151ee,JSON[_0x71e7('0x6d')](_0x3c8508));delete _0x3c8508[_0x71e7('0x34')];if(_0x5151ee===0x191){_0x5151ee=0x190;}_0x461714[_0x71e7('0x1e')](_0x5151ee)[_0x71e7('0x2d')](_0x4c1645[_0x71e7('0x35')][_0x71e7('0x6e')]?{'message':_0x71e7('0x6f'),'statusCode':_0x3c8508[_0x71e7('0x70')]}:_0x3c8508);});}; \ No newline at end of file +var _0x0cd7=['priority','username','consumerKey','tokenSecret','slice','substring','lastIndexOf','%s/custom_fields','application/json','authType','headers','Authorization','format','Basic\x20%s','%s:%s','password','toString','base64','concat','_embedded','entries','label','test','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','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','status','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','DeskAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','count','includeAll','include','findAll','rows','catch','params','rawAttributes','length','find','create','body','getConfigurations','findOne','DeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField'];(function(_0x9df3d8,_0x4074e3){var _0x366da1=function(_0x5af940){while(--_0x5af940){_0x9df3d8['push'](_0x9df3d8['shift']());}};_0x366da1(++_0x4074e3);}(_0x0cd7,0xf9));var _0x70cd=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x0cd7[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0x70cd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x70cd('0x1'));var jsonpatch=require(_0x70cd('0x2'));var rp=require('request-promise');var moment=require(_0x70cd('0x3'));var BPromise=require(_0x70cd('0x4'));var Mustache=require(_0x70cd('0x5'));var util=require(_0x70cd('0x6'));var path=require(_0x70cd('0x7'));var sox=require(_0x70cd('0x8'));var csv=require(_0x70cd('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x70cd('0xa'));var _=require(_0x70cd('0xb'));var squel=require(_0x70cd('0xc'));var crypto=require(_0x70cd('0xd'));var jsforce=require(_0x70cd('0xe'));var deskjs=require(_0x70cd('0xf'));var toCsv=require('to-csv');var querystring=require(_0x70cd('0x10'));var Papa=require('papaparse');var Redis=require(_0x70cd('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x70cd('0x12'));var as=require(_0x70cd('0x13'));var hardwareService=require(_0x70cd('0x14'));var logger=require('../../config/logger')(_0x70cd('0x15'));var utils=require(_0x70cd('0x16'));var config=require(_0x70cd('0x17'));var licenseUtil=require(_0x70cd('0x18'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x477213,_0x247581){_0x247581=_0x247581||0xcc;return function(_0x180f69){if(_0x180f69){return _0x477213['sendStatus'](_0x247581);}return _0x477213[_0x70cd('0x19')](_0x247581)['end']();};}function respondWithResult(_0x3d3ee4,_0x196d4c){_0x196d4c=_0x196d4c||0xc8;return function(_0x3cd9e5){if(_0x3cd9e5){return _0x3d3ee4[_0x70cd('0x19')](_0x196d4c)[_0x70cd('0x1a')](_0x3cd9e5);}};}function respondWithFilteredResult(_0x5151db,_0x1100cf){return function(_0xa2662){if(_0xa2662){var _0x41e081=typeof _0x1100cf[_0x70cd('0x1b')]===_0x70cd('0x1c')&&typeof _0x1100cf[_0x70cd('0x1d')]===_0x70cd('0x1c');var _0x23d465=_0xa2662['count'];var _0x3a4aab=_0x41e081?0x0:_0x1100cf[_0x70cd('0x1b')];var _0x1554e8=_0x41e081?_0xa2662['count']:_0x1100cf[_0x70cd('0x1b')]+_0x1100cf[_0x70cd('0x1d')];var _0x2c3f28;if(_0x1554e8>=_0x23d465){_0x1554e8=_0x23d465;_0x2c3f28=0xc8;}else{_0x2c3f28=0xce;}_0x5151db[_0x70cd('0x19')](_0x2c3f28);return _0x5151db[_0x70cd('0x1e')](_0x70cd('0x1f'),_0x3a4aab+'-'+_0x1554e8+'/'+_0x23d465)[_0x70cd('0x1a')](_0xa2662);}return null;};}function patchUpdates(_0x4fd229){return function(_0x37eb3e){try{jsonpatch[_0x70cd('0x20')](_0x37eb3e,_0x4fd229,!![]);}catch(_0x316775){return BPromise['reject'](_0x316775);}return _0x37eb3e[_0x70cd('0x21')]();};}function saveUpdates(_0x57ac79,_0x377ce8){return function(_0x1647a6){if(_0x1647a6){return _0x1647a6[_0x70cd('0x22')](_0x57ac79)[_0x70cd('0x23')](function(_0x3ffc31){return _0x3ffc31;});}return null;};}function removeEntity(_0x43b739,_0x1eaced){return function(_0x424501){if(_0x424501){return _0x424501[_0x70cd('0x24')]()[_0x70cd('0x23')](function(){_0x43b739['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x86937b,_0x456b08){return function(_0x3143b7){if(!_0x3143b7){_0x86937b[_0x70cd('0x25')](0x194);}return _0x3143b7;};}function handleError(_0x276e4c,_0x495b5d){_0x495b5d=_0x495b5d||0x1f4;return function(_0x443c7f){logger[_0x70cd('0x26')](_0x443c7f[_0x70cd('0x27')]);if(_0x443c7f['name']){delete _0x443c7f[_0x70cd('0x28')];}_0x276e4c[_0x70cd('0x19')](_0x495b5d)[_0x70cd('0x29')](_0x443c7f);};}exports[_0x70cd('0x2a')]=function(_0x3495ba,_0x4ebdc2){var _0x2c0c97={},_0x3c2881={},_0x3d576f={'count':0x0,'rows':[]};var _0x177918=_[_0x70cd('0x2b')](db[_0x70cd('0x2c')]['rawAttributes'],function(_0x15898a){return{'name':_0x15898a[_0x70cd('0x2d')],'type':_0x15898a[_0x70cd('0x2e')][_0x70cd('0x2f')]};});_0x3c2881[_0x70cd('0x30')]=_[_0x70cd('0x2b')](_0x177918,_0x70cd('0x28'));_0x3c2881[_0x70cd('0x31')]=_[_0x70cd('0x32')](_0x3495ba['query']);_0x3c2881[_0x70cd('0x33')]=_[_0x70cd('0x34')](_0x3c2881[_0x70cd('0x30')],_0x3c2881[_0x70cd('0x31')]);_0x2c0c97[_0x70cd('0x35')]=_[_0x70cd('0x34')](_0x3c2881[_0x70cd('0x30')],qs[_0x70cd('0x36')](_0x3495ba[_0x70cd('0x31')][_0x70cd('0x36')]));_0x2c0c97[_0x70cd('0x35')]=_0x2c0c97[_0x70cd('0x35')]['length']?_0x2c0c97[_0x70cd('0x35')]:_0x3c2881[_0x70cd('0x30')];if(!_0x3495ba[_0x70cd('0x31')][_0x70cd('0x37')](_0x70cd('0x38'))){_0x2c0c97[_0x70cd('0x1d')]=qs['limit'](_0x3495ba[_0x70cd('0x31')][_0x70cd('0x1d')]);_0x2c0c97[_0x70cd('0x1b')]=qs[_0x70cd('0x1b')](_0x3495ba['query'][_0x70cd('0x1b')]);}_0x2c0c97[_0x70cd('0x39')]=qs[_0x70cd('0x3a')](_0x3495ba['query']['sort']);_0x2c0c97[_0x70cd('0x3b')]=qs[_0x70cd('0x33')](_[_0x70cd('0x3c')](_0x3495ba[_0x70cd('0x31')],_0x3c2881[_0x70cd('0x33')]),_0x177918);if(_0x3495ba[_0x70cd('0x31')][_0x70cd('0x3d')]){_0x2c0c97[_0x70cd('0x3b')]=_['merge'](_0x2c0c97[_0x70cd('0x3b')],{'$or':_[_0x70cd('0x2b')](_0x177918,function(_0x984944){if(_0x984944['type']!==_0x70cd('0x3e')){var _0x484159={};_0x484159[_0x984944['name']]={'$like':'%'+_0x3495ba['query']['filter']+'%'};return _0x484159;}})});}_0x2c0c97=_[_0x70cd('0x3f')]({},_0x2c0c97,_0x3495ba['options']);var _0x2ea7e9={'where':_0x2c0c97[_0x70cd('0x3b')]};return db['DeskAccount'][_0x70cd('0x40')](_0x2ea7e9)[_0x70cd('0x23')](function(_0x11b6fe){_0x3d576f[_0x70cd('0x40')]=_0x11b6fe;if(_0x3495ba['query'][_0x70cd('0x41')]){_0x2c0c97[_0x70cd('0x42')]=[{'all':!![]}];}return db[_0x70cd('0x2c')][_0x70cd('0x43')](_0x2c0c97);})['then'](function(_0xa37b8d){_0x3d576f[_0x70cd('0x44')]=_0xa37b8d;return _0x3d576f;})['then'](respondWithFilteredResult(_0x4ebdc2,_0x2c0c97))[_0x70cd('0x45')](handleError(_0x4ebdc2,null));};exports['show']=function(_0x1f2c08,_0x3e553b){var _0x884646={'raw':![],'where':{'id':_0x1f2c08[_0x70cd('0x46')]['id']}},_0x1afa92={};_0x1afa92[_0x70cd('0x30')]=_[_0x70cd('0x32')](db[_0x70cd('0x2c')][_0x70cd('0x47')]);_0x1afa92[_0x70cd('0x31')]=_[_0x70cd('0x32')](_0x1f2c08['query']);_0x1afa92['filters']=_[_0x70cd('0x34')](_0x1afa92['model'],_0x1afa92[_0x70cd('0x31')]);_0x884646[_0x70cd('0x35')]=_[_0x70cd('0x34')](_0x1afa92[_0x70cd('0x30')],qs[_0x70cd('0x36')](_0x1f2c08['query']['fields']));_0x884646[_0x70cd('0x35')]=_0x884646['attributes'][_0x70cd('0x48')]?_0x884646[_0x70cd('0x35')]:_0x1afa92[_0x70cd('0x30')];if(_0x1f2c08['query']['includeAll']){_0x884646[_0x70cd('0x42')]=[{'all':!![]}];}_0x884646=_[_0x70cd('0x3f')]({},_0x884646,_0x1f2c08['options']);return db[_0x70cd('0x2c')][_0x70cd('0x49')](_0x884646)[_0x70cd('0x23')](handleEntityNotFound(_0x3e553b,null))[_0x70cd('0x23')](respondWithResult(_0x3e553b,null))[_0x70cd('0x45')](handleError(_0x3e553b,null));};exports['create']=function(_0x7da294,_0x35f126){return db[_0x70cd('0x2c')][_0x70cd('0x4a')](_0x7da294[_0x70cd('0x4b')],{})[_0x70cd('0x23')](respondWithResult(_0x35f126,0xc9))[_0x70cd('0x45')](handleError(_0x35f126,null));};exports[_0x70cd('0x22')]=function(_0x3269ea,_0x175499){if(_0x3269ea[_0x70cd('0x4b')]['id']){delete _0x3269ea[_0x70cd('0x4b')]['id'];}return db[_0x70cd('0x2c')][_0x70cd('0x49')]({'where':{'id':_0x3269ea[_0x70cd('0x46')]['id']}})[_0x70cd('0x23')](handleEntityNotFound(_0x175499,null))[_0x70cd('0x23')](saveUpdates(_0x3269ea['body'],null))[_0x70cd('0x23')](respondWithResult(_0x175499,null))['catch'](handleError(_0x175499,null));};exports[_0x70cd('0x24')]=function(_0x30e4ef,_0x3c543e){return db['DeskAccount'][_0x70cd('0x49')]({'where':{'id':_0x30e4ef[_0x70cd('0x46')]['id']}})['then'](handleEntityNotFound(_0x3c543e,null))[_0x70cd('0x23')](removeEntity(_0x3c543e,null))[_0x70cd('0x45')](handleError(_0x3c543e,null));};exports[_0x70cd('0x4c')]=function(_0x508522,_0x57a219,_0x20ec82){var _0x481097={};var _0x284a44={};var _0x3c24dd;var _0x18f3ee;return db['DeskAccount'][_0x70cd('0x4d')]({'where':{'id':_0x508522['params']['id']}})[_0x70cd('0x23')](handleEntityNotFound(_0x57a219,null))[_0x70cd('0x23')](function(_0x59bbf5){if(_0x59bbf5){_0x3c24dd=_0x59bbf5;_0x284a44[_0x70cd('0x30')]=_[_0x70cd('0x32')](db[_0x70cd('0x4e')][_0x70cd('0x47')]);_0x284a44['query']=_['keys'](_0x508522[_0x70cd('0x31')]);_0x284a44['filters']=_[_0x70cd('0x34')](_0x284a44[_0x70cd('0x30')],_0x284a44['query']);_0x481097[_0x70cd('0x35')]=_[_0x70cd('0x34')](_0x284a44[_0x70cd('0x30')],qs[_0x70cd('0x36')](_0x508522['query'][_0x70cd('0x36')]));_0x481097[_0x70cd('0x35')]=_0x481097[_0x70cd('0x35')][_0x70cd('0x48')]?_0x481097['attributes']:_0x284a44[_0x70cd('0x30')];_0x481097['order']=qs['sort'](_0x508522[_0x70cd('0x31')][_0x70cd('0x3a')]);_0x481097[_0x70cd('0x3b')]=qs['filters'](_[_0x70cd('0x3c')](_0x508522['query'],_0x284a44[_0x70cd('0x33')]));if(_0x508522[_0x70cd('0x31')]['filter']){_0x481097['where']=_[_0x70cd('0x3f')](_0x481097[_0x70cd('0x3b')],{'$or':_[_0x70cd('0x2b')](_0x481097[_0x70cd('0x35')],function(_0x482d45){var _0x1976a3={};_0x1976a3[_0x482d45]={'$like':'%'+_0x508522[_0x70cd('0x31')][_0x70cd('0x3d')]+'%'};return _0x1976a3;})});}_0x481097=_[_0x70cd('0x3f')]({},_0x481097,_0x508522['options']);return _0x3c24dd[_0x70cd('0x4c')](_0x481097);}})[_0x70cd('0x23')](function(_0x2d8e99){if(_0x2d8e99){_0x18f3ee=_0x2d8e99['length'];if(!_0x508522[_0x70cd('0x31')][_0x70cd('0x37')](_0x70cd('0x38'))){_0x481097[_0x70cd('0x1d')]=qs[_0x70cd('0x1d')](_0x508522[_0x70cd('0x31')]['limit']);_0x481097['offset']=qs['offset'](_0x508522[_0x70cd('0x31')]['offset']);}return _0x3c24dd[_0x70cd('0x4c')](_0x481097);}})[_0x70cd('0x23')](function(_0x372e9a){if(_0x372e9a){return _0x372e9a?{'count':_0x18f3ee,'rows':_0x372e9a}:null;}})[_0x70cd('0x23')](respondWithResult(_0x57a219,null))[_0x70cd('0x45')](handleError(_0x57a219,null));};exports[_0x70cd('0x4f')]=function(_0x2f902,_0x2bff24,_0x4da21b){if(_0x2f902['body']['id']){delete _0x2f902[_0x70cd('0x4b')]['id'];}return db[_0x70cd('0x2c')][_0x70cd('0x4d')]({'where':{'id':_0x2f902[_0x70cd('0x46')]['id']}})[_0x70cd('0x23')](handleEntityNotFound(_0x2bff24,null))['then'](function(_0x5d7b74){if(_0x5d7b74){_0x2f902['body'][_0x70cd('0x50')]=_0x5d7b74['id'];_0x2f902['body'][_0x70cd('0x51')]=integrations[_0x70cd('0x52')](_0x2f902[_0x70cd('0x4b')][_0x70cd('0x53')],_0x2f902[_0x70cd('0x4b')]['type']);_0x2f902[_0x70cd('0x4b')][_0x70cd('0x54')]=integrations[_0x70cd('0x55')](_0x2f902[_0x70cd('0x4b')][_0x70cd('0x53')],_0x2f902[_0x70cd('0x4b')][_0x70cd('0x2e')]);return db['DeskConfiguration'][_0x70cd('0x4a')](_0x2f902[_0x70cd('0x4b')],{'include':[{'model':db[_0x70cd('0x56')],'as':_0x70cd('0x51')},{'model':db[_0x70cd('0x56')],'as':_0x70cd('0x54')}]});}return null;})[_0x70cd('0x23')](respondWithResult(_0x2bff24,null))[_0x70cd('0x45')](handleError(_0x2bff24,null));};exports['getFields']=function(_0x1c71be,_0x3d7974,_0x5e2f2d){var _0x4df6f8=[{'name':_0x70cd('0x57'),'label':_0x70cd('0x57'),'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 _0x338216='';return db[_0x70cd('0x2c')]['findOne']({'where':{'id':_0x1c71be['params']['id']},'attributes':['id','remoteUri','authType',_0x70cd('0x58'),'password',_0x70cd('0x59'),'consumerSecret','token',_0x70cd('0x5a')]})[_0x70cd('0x23')](handleEntityNotFound(_0x3d7974,null))[_0x70cd('0x23')](function(_0x5418f1){if(_0x5418f1){_0x338216=_0x5418f1['remoteUri'];var _0x19e5fd=_0x338216[_0x70cd('0x5b')](-0x1);if(_0x19e5fd==='/'){_0x338216=_0x338216[_0x70cd('0x5c')](0x0,_0x338216[_0x70cd('0x5d')](_0x19e5fd));}var _0xc9ca62={'method':'GET','uri':util['format'](_0x70cd('0x5e'),_0x338216),'headers':{'Content-Type':_0x70cd('0x5f'),'Accept':_0x70cd('0x5f')},'json':!![]};if(_0x5418f1[_0x70cd('0x60')]==='basic'){_0xc9ca62[_0x70cd('0x61')][_0x70cd('0x62')]=util[_0x70cd('0x63')](_0x70cd('0x64'),new Buffer(util[_0x70cd('0x63')](_0x70cd('0x65'),_0x5418f1[_0x70cd('0x58')],_0x5418f1[_0x70cd('0x66')]))[_0x70cd('0x67')](_0x70cd('0x68')));}return rp(_0xc9ca62)[_0x70cd('0x23')](function(_0x1c5d90){return _0x4df6f8[_0x70cd('0x69')](_[_0x70cd('0x2b')](_0x1c5d90[_0x70cd('0x6a')][_0x70cd('0x6b')],function(_0x23abc1){return{'id':_0x23abc1[_0x70cd('0x28')],'name':_0x23abc1[_0x70cd('0x28')],'type':_0x23abc1[_0x70cd('0x2e')],'active':_0x23abc1['active'],'label':_0x23abc1[_0x70cd('0x6c')],'custom':!![]};}));});}})[_0x70cd('0x23')](function(_0x2fa9d4){return{'count':_0x2fa9d4['length'],'rows':_0x2fa9d4};})[_0x70cd('0x23')](respondWithResult(_0x3d7974,null))[_0x70cd('0x45')](function(_0x23ed54){var _0x39d6a3=_0x1c71be[_0x70cd('0x31')][_0x70cd('0x6d')]?0x1f4:_0x23ed54['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x39d6a3,JSON[_0x70cd('0x6e')](_0x23ed54));delete _0x23ed54[_0x70cd('0x28')];if(_0x39d6a3===0x191){_0x39d6a3=0x190;}_0x3d7974[_0x70cd('0x19')](_0x39d6a3)[_0x70cd('0x29')](_0x1c71be[_0x70cd('0x31')][_0x70cd('0x6d')]?{'message':_0x70cd('0x6f'),'statusCode':_0x23ed54['statusCode']}:_0x23ed54);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 688fa9e..b49fd1d 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 _0x60d9=['path','rimraf','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x396795,_0xaa9d18){var _0x2f8e87=function(_0x178850){while(--_0x178850){_0x396795['push'](_0x396795['shift']());}};_0x2f8e87(++_0xaa9d18);}(_0x60d9,0x6f));var _0x960d=function(_0xc495,_0x33d8da){_0xc495=_0xc495-0x0;var _0xd10a11=_0x60d9[_0xc495];return _0xd10a11;};'use strict';var _=require(_0x960d('0x0'));var util=require(_0x960d('0x1'));var logger=require(_0x960d('0x2'))(_0x960d('0x3'));var moment=require(_0x960d('0x4'));var BPromise=require('bluebird');var rp=require(_0x960d('0x5'));var fs=require('fs');var path=require(_0x960d('0x6'));var rimraf=require(_0x960d('0x7'));var config=require('../../config/environment');var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x960d('0x8'));module[_0x960d('0x9')]=function(_0x969c4a,_0x4887f6){return _0x969c4a[_0x960d('0xa')](_0x960d('0xb'),attributes,{'tableName':_0x960d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb04b=['exports','int_desk_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration'];(function(_0x1e2b93,_0x474e96){var _0x5a66d5=function(_0x52256a){while(--_0x52256a){_0x1e2b93['push'](_0x1e2b93['shift']());}};_0x5a66d5(++_0x474e96);}(_0xb04b,0x86));var _0xbb04=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xb04b[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xbb04('0x0'));var util=require('util');var logger=require(_0xbb04('0x1'))(_0xbb04('0x2'));var moment=require(_0xbb04('0x3'));var BPromise=require(_0xbb04('0x4'));var rp=require(_0xbb04('0x5'));var fs=require('fs');var path=require(_0xbb04('0x6'));var rimraf=require(_0xbb04('0x7'));var config=require(_0xbb04('0x8'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0xbb04('0x9'));module[_0xbb04('0xa')]=function(_0x231a36,_0x39a98f){return _0x231a36['define']('DeskAccount',attributes,{'tableName':_0xbb04('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 bf4ef37..b746781 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 _0xbce2=['map','model','attributes','ShowDeskAccount','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','where','limit','include'];(function(_0x47e815,_0x347f27){var _0x595994=function(_0x2c7e4b){while(--_0x2c7e4b){_0x47e815['push'](_0x47e815['shift']());}};_0x595994(++_0x347f27);}(_0xbce2,0xf0));var _0x2bce=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xbce2[_0x1caf6a];return _0x1bf493;};'use strict';var _=require(_0x2bce('0x0'));var util=require(_0x2bce('0x1'));var moment=require(_0x2bce('0x2'));var BPromise=require(_0x2bce('0x3'));var rs=require(_0x2bce('0x4'));var fs=require('fs');var Redis=require(_0x2bce('0x5'));var db=require(_0x2bce('0x6'))['db'];var utils=require(_0x2bce('0x7'));var logger=require(_0x2bce('0x8'))(_0x2bce('0x9'));var config=require('../../config/environment');var jayson=require(_0x2bce('0xa'));var client=jayson[_0x2bce('0xb')][_0x2bce('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x24bf31,_0x5a7900,_0x4f4bfd){return new BPromise(function(_0x2f9a3b,_0x465375){return client[_0x2bce('0xd')](_0x24bf31,_0x4f4bfd)[_0x2bce('0xe')](function(_0x575ccd){logger[_0x2bce('0xf')](_0x2bce('0x10'),_0x5a7900,_0x2bce('0x11'));logger[_0x2bce('0x12')](_0x2bce('0x13'),_0x5a7900,'request\x20sent',JSON[_0x2bce('0x14')](_0x575ccd));if(_0x575ccd[_0x2bce('0x15')]){if(_0x575ccd[_0x2bce('0x15')][_0x2bce('0x16')]===0x1f4){logger[_0x2bce('0x15')](_0x2bce('0x10'),_0x5a7900,_0x575ccd[_0x2bce('0x15')][_0x2bce('0x17')]);return _0x465375(_0x575ccd[_0x2bce('0x15')][_0x2bce('0x17')]);}logger[_0x2bce('0x15')](_0x2bce('0x10'),_0x5a7900,_0x575ccd[_0x2bce('0x15')]['message']);return _0x2f9a3b(_0x575ccd['error'][_0x2bce('0x17')]);}else{logger[_0x2bce('0xf')](_0x2bce('0x10'),_0x5a7900,_0x2bce('0x11'));_0x2f9a3b(_0x575ccd[_0x2bce('0x18')][_0x2bce('0x17')]);}})[_0x2bce('0x19')](function(_0x1ec44b){logger['error'](_0x2bce('0x10'),_0x5a7900,_0x1ec44b);_0x465375(_0x1ec44b);});});}exports[_0x2bce('0x1a')]=function(_0x4a761d){var _0x330ee7=this;return new Promise(function(_0x39dbfd,_0x1aa106){return db[_0x2bce('0x1b')][_0x2bce('0x1c')]({'raw':_0x4a761d[_0x2bce('0x1d')]?_0x4a761d[_0x2bce('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x4a761d[_0x2bce('0x1d')]?_0x4a761d[_0x2bce('0x1d')][_0x2bce('0x1e')]||null:null,'attributes':_0x4a761d['options']?_0x4a761d[_0x2bce('0x1d')]['attributes']||null:null,'limit':_0x4a761d[_0x2bce('0x1d')]?_0x4a761d[_0x2bce('0x1d')][_0x2bce('0x1f')]||null:null,'include':_0x4a761d[_0x2bce('0x1d')]?_0x4a761d[_0x2bce('0x1d')][_0x2bce('0x20')]?_[_0x2bce('0x21')](_0x4a761d['options']['include'],function(_0x4030d5){return{'model':db[_0x4030d5[_0x2bce('0x22')]],'as':_0x4030d5['as'],'attributes':_0x4030d5[_0x2bce('0x23')],'include':_0x4030d5['include']?_[_0x2bce('0x21')](_0x4030d5['include'],function(_0x148513){return{'model':db[_0x148513[_0x2bce('0x22')]],'as':_0x148513['as'],'attributes':_0x148513[_0x2bce('0x23')],'include':_0x148513['include']?_[_0x2bce('0x21')](_0x148513[_0x2bce('0x20')],function(_0x3e7f22){return{'model':db[_0x3e7f22[_0x2bce('0x22')]],'as':_0x3e7f22['as'],'attributes':_0x3e7f22['attributes']};}):[]};}):[]};}):[]:[]})[_0x2bce('0xe')](function(_0x359337){logger[_0x2bce('0xf')]('GetDeskAccount',_0x4a761d);logger['debug'](_0x2bce('0x1a'),_0x4a761d,JSON[_0x2bce('0x14')](_0x359337));_0x39dbfd(_0x359337);})[_0x2bce('0x19')](function(_0x196451){logger[_0x2bce('0x15')](_0x2bce('0x1a'),_0x196451[_0x2bce('0x17')],_0x4a761d);_0x1aa106(_0x330ee7[_0x2bce('0x15')](0x1f4,_0x196451[_0x2bce('0x17')]));});});};exports[_0x2bce('0x24')]=function(_0x4184b8){var _0x2515d2=this;return new Promise(function(_0xbc1d48,_0x124260){return db['DeskAccount'][_0x2bce('0x25')]({'raw':_0x4184b8[_0x2bce('0x1d')]?_0x4184b8[_0x2bce('0x1d')][_0x2bce('0x26')]===undefined?!![]:![]:!![],'where':_0x4184b8[_0x2bce('0x1d')]?_0x4184b8[_0x2bce('0x1d')][_0x2bce('0x1e')]||null:null,'attributes':_0x4184b8[_0x2bce('0x1d')]?_0x4184b8[_0x2bce('0x1d')][_0x2bce('0x23')]||null:null,'include':_0x4184b8['options']?_0x4184b8[_0x2bce('0x1d')][_0x2bce('0x20')]?_[_0x2bce('0x21')](_0x4184b8[_0x2bce('0x1d')][_0x2bce('0x20')],function(_0x237c79){return{'model':db[_0x237c79[_0x2bce('0x22')]],'as':_0x237c79['as'],'attributes':_0x237c79[_0x2bce('0x23')],'include':_0x237c79[_0x2bce('0x20')]?_[_0x2bce('0x21')](_0x237c79[_0x2bce('0x20')],function(_0x432721){return{'model':db[_0x432721[_0x2bce('0x22')]],'as':_0x432721['as'],'attributes':_0x432721[_0x2bce('0x23')],'include':_0x432721[_0x2bce('0x20')]?_[_0x2bce('0x21')](_0x432721[_0x2bce('0x20')],function(_0x2a5c30){return{'model':db[_0x2a5c30[_0x2bce('0x22')]],'as':_0x2a5c30['as'],'attributes':_0x2a5c30['attributes']};}):[]};}):[]};}):[]:[]})[_0x2bce('0xe')](function(_0xa140){logger[_0x2bce('0xf')](_0x2bce('0x24'),_0x4184b8);logger[_0x2bce('0x12')](_0x2bce('0x24'),_0x4184b8,JSON['stringify'](_0xa140));_0xbc1d48(_0xa140);})[_0x2bce('0x19')](function(_0x88c9c1){logger[_0x2bce('0x15')](_0x2bce('0x24'),_0x88c9c1['message'],_0x4184b8);_0x124260(_0x2515d2[_0x2bce('0x15')](0x1f4,_0x88c9c1[_0x2bce('0x17')]));});});}; \ No newline at end of file +var _0xfce1=['ShowDeskAccount','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','GetDeskAccount','DeskAccount','findAll','options','raw','where','limit','include','attributes','map','model','catch'];(function(_0x12b977,_0x3557e8){var _0x474f7f=function(_0x3caa5d){while(--_0x3caa5d){_0x12b977['push'](_0x12b977['shift']());}};_0x474f7f(++_0x3557e8);}(_0xfce1,0x8e));var _0x1fce=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xfce1[_0x2be8c2];return _0x97f531;};'use strict';var _=require('lodash');var util=require(_0x1fce('0x0'));var moment=require(_0x1fce('0x1'));var BPromise=require(_0x1fce('0x2'));var rs=require(_0x1fce('0x3'));var fs=require('fs');var Redis=require(_0x1fce('0x4'));var db=require(_0x1fce('0x5'))['db'];var utils=require(_0x1fce('0x6'));var logger=require('../../config/logger')(_0x1fce('0x7'));var config=require(_0x1fce('0x8'));var jayson=require(_0x1fce('0x9'));var client=jayson['client'][_0x1fce('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x108c42,_0x46bbcc,_0x3196fb){return new BPromise(function(_0xff17cd,_0x29f932){return client[_0x1fce('0xb')](_0x108c42,_0x3196fb)[_0x1fce('0xc')](function(_0x4679f1){logger['info'](_0x1fce('0xd'),_0x46bbcc,_0x1fce('0xe'));logger[_0x1fce('0xf')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x46bbcc,_0x1fce('0xe'),JSON[_0x1fce('0x10')](_0x4679f1));if(_0x4679f1[_0x1fce('0x11')]){if(_0x4679f1[_0x1fce('0x11')][_0x1fce('0x12')]===0x1f4){logger[_0x1fce('0x11')](_0x1fce('0xd'),_0x46bbcc,_0x4679f1[_0x1fce('0x11')][_0x1fce('0x13')]);return _0x29f932(_0x4679f1[_0x1fce('0x11')][_0x1fce('0x13')]);}logger[_0x1fce('0x11')](_0x1fce('0xd'),_0x46bbcc,_0x4679f1[_0x1fce('0x11')]['message']);return _0xff17cd(_0x4679f1[_0x1fce('0x11')][_0x1fce('0x13')]);}else{logger[_0x1fce('0x14')](_0x1fce('0xd'),_0x46bbcc,_0x1fce('0xe'));_0xff17cd(_0x4679f1['result']['message']);}})['catch'](function(_0x437bcb){logger[_0x1fce('0x11')]('DeskAccount,\x20%s,\x20%s',_0x46bbcc,_0x437bcb);_0x29f932(_0x437bcb);});});}exports[_0x1fce('0x15')]=function(_0x4a3f84){var _0x2ee145=this;return new Promise(function(_0x587b89,_0x2287f8){return db[_0x1fce('0x16')][_0x1fce('0x17')]({'raw':_0x4a3f84[_0x1fce('0x18')]?_0x4a3f84['options'][_0x1fce('0x19')]===undefined?!![]:![]:!![],'where':_0x4a3f84[_0x1fce('0x18')]?_0x4a3f84[_0x1fce('0x18')][_0x1fce('0x1a')]||null:null,'attributes':_0x4a3f84[_0x1fce('0x18')]?_0x4a3f84[_0x1fce('0x18')]['attributes']||null:null,'limit':_0x4a3f84['options']?_0x4a3f84[_0x1fce('0x18')][_0x1fce('0x1b')]||null:null,'include':_0x4a3f84[_0x1fce('0x18')]?_0x4a3f84[_0x1fce('0x18')][_0x1fce('0x1c')]?_['map'](_0x4a3f84[_0x1fce('0x18')][_0x1fce('0x1c')],function(_0x6c2470){return{'model':db[_0x6c2470['model']],'as':_0x6c2470['as'],'attributes':_0x6c2470[_0x1fce('0x1d')],'include':_0x6c2470[_0x1fce('0x1c')]?_[_0x1fce('0x1e')](_0x6c2470[_0x1fce('0x1c')],function(_0x47e6be){return{'model':db[_0x47e6be[_0x1fce('0x1f')]],'as':_0x47e6be['as'],'attributes':_0x47e6be[_0x1fce('0x1d')],'include':_0x47e6be['include']?_[_0x1fce('0x1e')](_0x47e6be['include'],function(_0x251170){return{'model':db[_0x251170[_0x1fce('0x1f')]],'as':_0x251170['as'],'attributes':_0x251170['attributes']};}):[]};}):[]};}):[]:[]})[_0x1fce('0xc')](function(_0x58e0a3){logger['info'](_0x1fce('0x15'),_0x4a3f84);logger[_0x1fce('0xf')]('GetDeskAccount',_0x4a3f84,JSON['stringify'](_0x58e0a3));_0x587b89(_0x58e0a3);})[_0x1fce('0x20')](function(_0x1555bf){logger[_0x1fce('0x11')](_0x1fce('0x15'),_0x1555bf[_0x1fce('0x13')],_0x4a3f84);_0x2287f8(_0x2ee145[_0x1fce('0x11')](0x1f4,_0x1555bf[_0x1fce('0x13')]));});});};exports[_0x1fce('0x21')]=function(_0x593ff3){var _0x5ebab8=this;return new Promise(function(_0x427e73,_0x2518fc){return db[_0x1fce('0x16')][_0x1fce('0x22')]({'raw':_0x593ff3[_0x1fce('0x18')]?_0x593ff3[_0x1fce('0x18')][_0x1fce('0x19')]===undefined?!![]:![]:!![],'where':_0x593ff3[_0x1fce('0x18')]?_0x593ff3[_0x1fce('0x18')]['where']||null:null,'attributes':_0x593ff3[_0x1fce('0x18')]?_0x593ff3['options'][_0x1fce('0x1d')]||null:null,'include':_0x593ff3['options']?_0x593ff3[_0x1fce('0x18')][_0x1fce('0x1c')]?_['map'](_0x593ff3['options']['include'],function(_0x1cfffd){return{'model':db[_0x1cfffd[_0x1fce('0x1f')]],'as':_0x1cfffd['as'],'attributes':_0x1cfffd['attributes'],'include':_0x1cfffd[_0x1fce('0x1c')]?_[_0x1fce('0x1e')](_0x1cfffd[_0x1fce('0x1c')],function(_0x5c5a77){return{'model':db[_0x5c5a77[_0x1fce('0x1f')]],'as':_0x5c5a77['as'],'attributes':_0x5c5a77[_0x1fce('0x1d')],'include':_0x5c5a77[_0x1fce('0x1c')]?_['map'](_0x5c5a77[_0x1fce('0x1c')],function(_0x4145d4){return{'model':db[_0x4145d4[_0x1fce('0x1f')]],'as':_0x4145d4['as'],'attributes':_0x4145d4[_0x1fce('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1fce('0xc')](function(_0x25973d){logger[_0x1fce('0x14')](_0x1fce('0x21'),_0x593ff3);logger[_0x1fce('0xf')](_0x1fce('0x21'),_0x593ff3,JSON[_0x1fce('0x10')](_0x25973d));_0x427e73(_0x25973d);})[_0x1fce('0x20')](function(_0x2f8faa){logger[_0x1fce('0x11')]('ShowDeskAccount',_0x2f8faa[_0x1fce('0x13')],_0x593ff3);_0x2518fc(_0x5ebab8[_0x1fce('0x11')](0x1f4,_0x2f8faa[_0x1fce('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 23f83b0..389cf3f 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 _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(_0x11c1a4,_0x2238b1){var _0x137ac5=function(_0x22fb55){while(--_0x22fb55){_0x11c1a4['push'](_0x11c1a4['shift']());}};_0x137ac5(++_0x2238b1);}(_0x34e8,0x12c));var _0x834e=function(_0x48533d,_0x50171a){_0x48533d=_0x48533d-0x0;var _0x475381=_0x34e8[_0x48533d];return _0x475381;};'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 +var _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x4b935a,_0x327ee3){var _0xa298f0=function(_0x3e07c2){while(--_0x3e07c2){_0x4b935a['push'](_0x4b935a['shift']());}};_0xa298f0(++_0x327ee3);}(_0x55ca,0x126));var _0xa55c=function(_0x54d2fb,_0x31fd9e){_0x54d2fb=_0x54d2fb-0x0;var _0x10cb87=_0x55ca[_0x54d2fb];return _0x10cb87;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index cbaa045..bdc5616 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 _0x10cc=['sequelize','exports','STRING'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x10cc,0xc9));var _0xc10c=function(_0x29c2bb,_0x1bde54){_0x29c2bb=_0x29c2bb-0x0;var _0x5446f1=_0x10cc[_0x29c2bb];return _0x5446f1;};'use strict';var Sequelize=require(_0xc10c('0x0'));module[_0xc10c('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc10c('0x2')]}}; \ No newline at end of file +var _0xb2f3=['sequelize','exports','STRING'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xb2f3,0xe1));var _0x3b2f=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xb2f3[_0x46698a];return _0x356db0;};'use strict';var Sequelize=require(_0x3b2f('0x0'));module[_0x3b2f('0x1')]={'name':{'type':Sequelize[_0x3b2f('0x2')]},'description':{'type':Sequelize[_0x3b2f('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index e99b111..c4f885c 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 _0x49eb=['sox','to-csv','fs-extra','squel','crypto','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','options','find','create','body','params','getFields','DeskField','hasOwnProperty','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','mustache','util','path'];(function(_0x2856af,_0xc60fec){var _0x4f153e=function(_0x53e896){while(--_0x53e896){_0x2856af['push'](_0x2856af['shift']());}};_0x4f153e(++_0xc60fec);}(_0x49eb,0x9a));var _0xb49e=function(_0x1d9922,_0x5c6f6f){_0x1d9922=_0x1d9922-0x0;var _0x164afb=_0x49eb[_0x1d9922];return _0x164afb;};'use strict';var emlformat=require(_0xb49e('0x0'));var rimraf=require(_0xb49e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb49e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb49e('0x3'));var util=require(_0xb49e('0x4'));var path=require(_0xb49e('0x5'));var sox=require(_0xb49e('0x6'));var csv=require(_0xb49e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb49e('0x8'));var _=require('lodash');var squel=require(_0xb49e('0x9'));var crypto=require(_0xb49e('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb49e('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb49e('0xb'));var qs=require(_0xb49e('0xc'));var as=require(_0xb49e('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb49e('0xe'));var utils=require(_0xb49e('0xf'));var config=require(_0xb49e('0x10'));var licenseUtil=require(_0xb49e('0x11'));var db=require(_0xb49e('0x12'))['db'];function respondWithStatusCode(_0x254ce9,_0x244c96){_0x244c96=_0x244c96||0xcc;return function(_0x6a47cb){if(_0x6a47cb){return _0x254ce9[_0xb49e('0x13')](_0x244c96);}return _0x254ce9['status'](_0x244c96)[_0xb49e('0x14')]();};}function respondWithResult(_0x735981,_0x41163b){_0x41163b=_0x41163b||0xc8;return function(_0x553198){if(_0x553198){return _0x735981[_0xb49e('0x15')](_0x41163b)['json'](_0x553198);}};}function respondWithFilteredResult(_0x54f68b,_0x280fb8){return function(_0x1b9f45){if(_0x1b9f45){var _0x7078f6=typeof _0x280fb8[_0xb49e('0x16')]===_0xb49e('0x17')&&typeof _0x280fb8[_0xb49e('0x18')]===_0xb49e('0x17');var _0x173783=_0x1b9f45[_0xb49e('0x19')];var _0x50c6f5=_0x7078f6?0x0:_0x280fb8[_0xb49e('0x16')];var _0x1da889=_0x7078f6?_0x1b9f45[_0xb49e('0x19')]:_0x280fb8[_0xb49e('0x16')]+_0x280fb8['limit'];var _0xa77497;if(_0x1da889>=_0x173783){_0x1da889=_0x173783;_0xa77497=0xc8;}else{_0xa77497=0xce;}_0x54f68b['status'](_0xa77497);return _0x54f68b[_0xb49e('0x1a')](_0xb49e('0x1b'),_0x50c6f5+'-'+_0x1da889+'/'+_0x173783)[_0xb49e('0x1c')](_0x1b9f45);}return null;};}function patchUpdates(_0x4dea51){return function(_0x51e26b){try{jsonpatch[_0xb49e('0x1d')](_0x51e26b,_0x4dea51,!![]);}catch(_0x1f585c){return BPromise[_0xb49e('0x1e')](_0x1f585c);}return _0x51e26b[_0xb49e('0x1f')]();};}function saveUpdates(_0x48308e,_0x19864c){return function(_0x357a4e){if(_0x357a4e){return _0x357a4e[_0xb49e('0x20')](_0x48308e)[_0xb49e('0x21')](function(_0x2aa3eb){return _0x2aa3eb;});}return null;};}function removeEntity(_0x3f1f2f,_0x120a5e){return function(_0x1d8481){if(_0x1d8481){return _0x1d8481[_0xb49e('0x22')]()['then'](function(){_0x3f1f2f[_0xb49e('0x15')](0xcc)[_0xb49e('0x14')]();});}};}function handleEntityNotFound(_0x466519,_0x3bf8cf){return function(_0x281d37){if(!_0x281d37){_0x466519[_0xb49e('0x13')](0x194);}return _0x281d37;};}function handleError(_0x407537,_0xdf320f){_0xdf320f=_0xdf320f||0x1f4;return function(_0x1422b0){logger[_0xb49e('0x23')](_0x1422b0[_0xb49e('0x24')]);if(_0x1422b0[_0xb49e('0x25')]){delete _0x1422b0[_0xb49e('0x25')];}_0x407537[_0xb49e('0x15')](_0xdf320f)['send'](_0x1422b0);};}exports['index']=function(_0x206819,_0x41a9c1){var _0x7d3bff={},_0x5dee5b={},_0x434dd0={'count':0x0,'rows':[]};var _0x298dfa=_[_0xb49e('0x26')](db[_0xb49e('0x27')][_0xb49e('0x28')],function(_0x26a8ed){return{'name':_0x26a8ed[_0xb49e('0x29')],'type':_0x26a8ed[_0xb49e('0x2a')][_0xb49e('0x2b')]};});_0x5dee5b[_0xb49e('0x2c')]=_[_0xb49e('0x26')](_0x298dfa,_0xb49e('0x25'));_0x5dee5b[_0xb49e('0x2d')]=_[_0xb49e('0x2e')](_0x206819[_0xb49e('0x2d')]);_0x5dee5b[_0xb49e('0x2f')]=_[_0xb49e('0x30')](_0x5dee5b[_0xb49e('0x2c')],_0x5dee5b[_0xb49e('0x2d')]);_0x7d3bff['attributes']=_[_0xb49e('0x30')](_0x5dee5b[_0xb49e('0x2c')],qs[_0xb49e('0x31')](_0x206819[_0xb49e('0x2d')]['fields']));_0x7d3bff['attributes']=_0x7d3bff[_0xb49e('0x32')][_0xb49e('0x33')]?_0x7d3bff[_0xb49e('0x32')]:_0x5dee5b[_0xb49e('0x2c')];if(!_0x206819[_0xb49e('0x2d')]['hasOwnProperty'](_0xb49e('0x34'))){_0x7d3bff[_0xb49e('0x18')]=qs[_0xb49e('0x18')](_0x206819[_0xb49e('0x2d')][_0xb49e('0x18')]);_0x7d3bff[_0xb49e('0x16')]=qs[_0xb49e('0x16')](_0x206819[_0xb49e('0x2d')][_0xb49e('0x16')]);}_0x7d3bff[_0xb49e('0x35')]=qs[_0xb49e('0x36')](_0x206819[_0xb49e('0x2d')][_0xb49e('0x36')]);_0x7d3bff['where']=qs[_0xb49e('0x2f')](_[_0xb49e('0x37')](_0x206819[_0xb49e('0x2d')],_0x5dee5b[_0xb49e('0x2f')]),_0x298dfa);if(_0x206819[_0xb49e('0x2d')][_0xb49e('0x38')]){_0x7d3bff[_0xb49e('0x39')]=_[_0xb49e('0x3a')](_0x7d3bff[_0xb49e('0x39')],{'$or':_[_0xb49e('0x26')](_0x298dfa,function(_0x554fd0){if(_0x554fd0[_0xb49e('0x2a')]!==_0xb49e('0x3b')){var _0x47b4f5={};_0x47b4f5[_0x554fd0['name']]={'$like':'%'+_0x206819[_0xb49e('0x2d')][_0xb49e('0x38')]+'%'};return _0x47b4f5;}})});}_0x7d3bff=_[_0xb49e('0x3a')]({},_0x7d3bff,_0x206819['options']);var _0xe8c415={'where':_0x7d3bff[_0xb49e('0x39')]};return db['DeskConfiguration'][_0xb49e('0x19')](_0xe8c415)['then'](function(_0x3249b0){_0x434dd0[_0xb49e('0x19')]=_0x3249b0;if(_0x206819[_0xb49e('0x2d')][_0xb49e('0x3c')]){_0x7d3bff[_0xb49e('0x3d')]=[{'all':!![]}];}return db[_0xb49e('0x27')][_0xb49e('0x3e')](_0x7d3bff);})[_0xb49e('0x21')](function(_0x1930a9){_0x434dd0[_0xb49e('0x3f')]=_0x1930a9;return _0x434dd0;})[_0xb49e('0x21')](respondWithFilteredResult(_0x41a9c1,_0x7d3bff))[_0xb49e('0x40')](handleError(_0x41a9c1,null));};exports['show']=function(_0x39c05c,_0x27f8f5){var _0x90dc8a={'raw':![],'where':{'id':_0x39c05c['params']['id']}},_0xdddd19={};_0xdddd19['model']=_[_0xb49e('0x2e')](db[_0xb49e('0x27')][_0xb49e('0x28')]);_0xdddd19[_0xb49e('0x2d')]=_[_0xb49e('0x2e')](_0x39c05c[_0xb49e('0x2d')]);_0xdddd19[_0xb49e('0x2f')]=_['intersection'](_0xdddd19[_0xb49e('0x2c')],_0xdddd19[_0xb49e('0x2d')]);_0x90dc8a[_0xb49e('0x32')]=_[_0xb49e('0x30')](_0xdddd19[_0xb49e('0x2c')],qs[_0xb49e('0x31')](_0x39c05c['query']['fields']));_0x90dc8a['attributes']=_0x90dc8a[_0xb49e('0x32')]['length']?_0x90dc8a['attributes']:_0xdddd19[_0xb49e('0x2c')];if(_0x39c05c['query']['includeAll']){_0x90dc8a[_0xb49e('0x3d')]=[{'all':!![]}];}_0x90dc8a=_[_0xb49e('0x3a')]({},_0x90dc8a,_0x39c05c[_0xb49e('0x41')]);return db['DeskConfiguration'][_0xb49e('0x42')](_0x90dc8a)[_0xb49e('0x21')](handleEntityNotFound(_0x27f8f5,null))[_0xb49e('0x21')](respondWithResult(_0x27f8f5,null))['catch'](handleError(_0x27f8f5,null));};exports[_0xb49e('0x43')]=function(_0x37cebb,_0x21a239){return db[_0xb49e('0x27')]['create'](_0x37cebb[_0xb49e('0x44')],{})['then'](respondWithResult(_0x21a239,0xc9))[_0xb49e('0x40')](handleError(_0x21a239,null));};exports[_0xb49e('0x20')]=function(_0x5503d1,_0x581e0b){if(_0x5503d1[_0xb49e('0x44')]['id']){delete _0x5503d1[_0xb49e('0x44')]['id'];}return db['DeskConfiguration'][_0xb49e('0x42')]({'where':{'id':_0x5503d1['params']['id']}})[_0xb49e('0x21')](handleEntityNotFound(_0x581e0b,null))[_0xb49e('0x21')](saveUpdates(_0x5503d1[_0xb49e('0x44')],null))[_0xb49e('0x21')](respondWithResult(_0x581e0b,null))[_0xb49e('0x40')](handleError(_0x581e0b,null));};exports[_0xb49e('0x22')]=function(_0x321f55,_0x33282f){return db[_0xb49e('0x27')]['find']({'where':{'id':_0x321f55[_0xb49e('0x45')]['id']}})[_0xb49e('0x21')](handleEntityNotFound(_0x33282f,null))[_0xb49e('0x21')](removeEntity(_0x33282f,null))[_0xb49e('0x40')](handleError(_0x33282f,null));};exports[_0xb49e('0x46')]=function(_0x3fb81f,_0x3bff05,_0x197795){var _0x3cdd01={};var _0x241425={};var _0x230ce8;var _0x42de63;return db[_0xb49e('0x27')]['findOne']({'where':{'id':_0x3fb81f[_0xb49e('0x45')]['id']}})[_0xb49e('0x21')](handleEntityNotFound(_0x3bff05,null))[_0xb49e('0x21')](function(_0x40c24b){if(_0x40c24b){_0x230ce8=_0x40c24b;_0x241425[_0xb49e('0x2c')]=_[_0xb49e('0x2e')](db[_0xb49e('0x47')][_0xb49e('0x28')]);_0x241425['query']=_['keys'](_0x3fb81f[_0xb49e('0x2d')]);_0x241425['filters']=_['intersection'](_0x241425[_0xb49e('0x2c')],_0x241425[_0xb49e('0x2d')]);_0x3cdd01[_0xb49e('0x32')]=_[_0xb49e('0x30')](_0x241425['model'],qs[_0xb49e('0x31')](_0x3fb81f[_0xb49e('0x2d')][_0xb49e('0x31')]));_0x3cdd01[_0xb49e('0x32')]=_0x3cdd01[_0xb49e('0x32')][_0xb49e('0x33')]?_0x3cdd01['attributes']:_0x241425[_0xb49e('0x2c')];_0x3cdd01[_0xb49e('0x35')]=qs[_0xb49e('0x36')](_0x3fb81f[_0xb49e('0x2d')][_0xb49e('0x36')]);_0x3cdd01[_0xb49e('0x39')]=qs[_0xb49e('0x2f')](_[_0xb49e('0x37')](_0x3fb81f[_0xb49e('0x2d')],_0x241425[_0xb49e('0x2f')]));if(_0x3fb81f[_0xb49e('0x2d')][_0xb49e('0x38')]){_0x3cdd01['where']=_[_0xb49e('0x3a')](_0x3cdd01['where'],{'$or':_['map'](_0x3cdd01['attributes'],function(_0x58d566){var _0x30e183={};_0x30e183[_0x58d566]={'$like':'%'+_0x3fb81f['query'][_0xb49e('0x38')]+'%'};return _0x30e183;})});}_0x3cdd01=_[_0xb49e('0x3a')]({},_0x3cdd01,_0x3fb81f['options']);return _0x230ce8['getFields'](_0x3cdd01);}})[_0xb49e('0x21')](function(_0x157781){if(_0x157781){_0x42de63=_0x157781[_0xb49e('0x33')];if(!_0x3fb81f['query'][_0xb49e('0x48')](_0xb49e('0x34'))){_0x3cdd01['limit']=qs['limit'](_0x3fb81f[_0xb49e('0x2d')][_0xb49e('0x18')]);_0x3cdd01[_0xb49e('0x16')]=qs[_0xb49e('0x16')](_0x3fb81f[_0xb49e('0x2d')][_0xb49e('0x16')]);}return _0x230ce8[_0xb49e('0x46')](_0x3cdd01);}})[_0xb49e('0x21')](function(_0x2be929){if(_0x2be929){return _0x2be929?{'count':_0x42de63,'rows':_0x2be929}:null;}})[_0xb49e('0x21')](respondWithResult(_0x3bff05,null))[_0xb49e('0x40')](handleError(_0x3bff05,null));};exports[_0xb49e('0x49')]=function(_0x5b55db,_0x4c200c,_0x4ae469){var _0x151af4={};var _0x370c33={};var _0x401f24;var _0x200728;return db[_0xb49e('0x27')]['findOne']({'where':{'id':_0x5b55db[_0xb49e('0x45')]['id']}})[_0xb49e('0x21')](handleEntityNotFound(_0x4c200c,null))['then'](function(_0x4bace4){if(_0x4bace4){_0x401f24=_0x4bace4;_0x370c33[_0xb49e('0x2c')]=_['keys'](db[_0xb49e('0x47')]['rawAttributes']);_0x370c33[_0xb49e('0x2d')]=_[_0xb49e('0x2e')](_0x5b55db[_0xb49e('0x2d')]);_0x370c33[_0xb49e('0x2f')]=_[_0xb49e('0x30')](_0x370c33['model'],_0x370c33[_0xb49e('0x2d')]);_0x151af4[_0xb49e('0x32')]=_[_0xb49e('0x30')](_0x370c33[_0xb49e('0x2c')],qs[_0xb49e('0x31')](_0x5b55db[_0xb49e('0x2d')][_0xb49e('0x31')]));_0x151af4['attributes']=_0x151af4[_0xb49e('0x32')][_0xb49e('0x33')]?_0x151af4[_0xb49e('0x32')]:_0x370c33[_0xb49e('0x2c')];_0x151af4['order']=qs[_0xb49e('0x36')](_0x5b55db[_0xb49e('0x2d')][_0xb49e('0x36')]);_0x151af4[_0xb49e('0x39')]=qs[_0xb49e('0x2f')](_[_0xb49e('0x37')](_0x5b55db[_0xb49e('0x2d')],_0x370c33[_0xb49e('0x2f')]));if(_0x5b55db[_0xb49e('0x2d')][_0xb49e('0x38')]){_0x151af4[_0xb49e('0x39')]=_[_0xb49e('0x3a')](_0x151af4[_0xb49e('0x39')],{'$or':_['map'](_0x151af4['attributes'],function(_0x41370e){var _0x486961={};_0x486961[_0x41370e]={'$like':'%'+_0x5b55db[_0xb49e('0x2d')]['filter']+'%'};return _0x486961;})});}_0x151af4=_[_0xb49e('0x3a')]({},_0x151af4,_0x5b55db[_0xb49e('0x41')]);return _0x401f24[_0xb49e('0x49')](_0x151af4);}})[_0xb49e('0x21')](function(_0x4559c6){if(_0x4559c6){_0x200728=_0x4559c6[_0xb49e('0x33')];if(!_0x5b55db['query']['hasOwnProperty'](_0xb49e('0x34'))){_0x151af4['limit']=qs[_0xb49e('0x18')](_0x5b55db[_0xb49e('0x2d')][_0xb49e('0x18')]);_0x151af4[_0xb49e('0x16')]=qs[_0xb49e('0x16')](_0x5b55db['query']['offset']);}return _0x401f24['getSubjects'](_0x151af4);}})[_0xb49e('0x21')](function(_0x3efe31){if(_0x3efe31){return _0x3efe31?{'count':_0x200728,'rows':_0x3efe31}:null;}})['then'](respondWithResult(_0x4c200c,null))[_0xb49e('0x40')](handleError(_0x4c200c,null));};exports['getDescriptions']=function(_0x4069de,_0x24cef2,_0x55a844){var _0x41fa12={};var _0x1f4023={};var _0x18f9ba;var _0x1d2ca0;return db[_0xb49e('0x27')][_0xb49e('0x4a')]({'where':{'id':_0x4069de[_0xb49e('0x45')]['id']}})['then'](handleEntityNotFound(_0x24cef2,null))[_0xb49e('0x21')](function(_0x196f04){if(_0x196f04){_0x18f9ba=_0x196f04;_0x1f4023[_0xb49e('0x2c')]=_[_0xb49e('0x2e')](db['DeskField'][_0xb49e('0x28')]);_0x1f4023['query']=_[_0xb49e('0x2e')](_0x4069de[_0xb49e('0x2d')]);_0x1f4023['filters']=_['intersection'](_0x1f4023[_0xb49e('0x2c')],_0x1f4023['query']);_0x41fa12[_0xb49e('0x32')]=_[_0xb49e('0x30')](_0x1f4023[_0xb49e('0x2c')],qs['fields'](_0x4069de[_0xb49e('0x2d')][_0xb49e('0x31')]));_0x41fa12['attributes']=_0x41fa12['attributes'][_0xb49e('0x33')]?_0x41fa12[_0xb49e('0x32')]:_0x1f4023[_0xb49e('0x2c')];_0x41fa12[_0xb49e('0x35')]=qs[_0xb49e('0x36')](_0x4069de['query'][_0xb49e('0x36')]);_0x41fa12[_0xb49e('0x39')]=qs[_0xb49e('0x2f')](_['pick'](_0x4069de[_0xb49e('0x2d')],_0x1f4023[_0xb49e('0x2f')]));if(_0x4069de[_0xb49e('0x2d')]['filter']){_0x41fa12['where']=_['merge'](_0x41fa12[_0xb49e('0x39')],{'$or':_['map'](_0x41fa12[_0xb49e('0x32')],function(_0x5d3459){var _0x108fb8={};_0x108fb8[_0x5d3459]={'$like':'%'+_0x4069de['query']['filter']+'%'};return _0x108fb8;})});}_0x41fa12=_['merge']({},_0x41fa12,_0x4069de[_0xb49e('0x41')]);return _0x18f9ba[_0xb49e('0x4b')](_0x41fa12);}})['then'](function(_0x37c0f8){if(_0x37c0f8){_0x1d2ca0=_0x37c0f8[_0xb49e('0x33')];if(!_0x4069de[_0xb49e('0x2d')][_0xb49e('0x48')](_0xb49e('0x34'))){_0x41fa12['limit']=qs[_0xb49e('0x18')](_0x4069de['query'][_0xb49e('0x18')]);_0x41fa12[_0xb49e('0x16')]=qs[_0xb49e('0x16')](_0x4069de[_0xb49e('0x2d')][_0xb49e('0x16')]);}return _0x18f9ba[_0xb49e('0x4b')](_0x41fa12);}})[_0xb49e('0x21')](function(_0x3f516a){if(_0x3f516a){return _0x3f516a?{'count':_0x1d2ca0,'rows':_0x3f516a}:null;}})[_0xb49e('0x21')](respondWithResult(_0x24cef2,null))[_0xb49e('0x40')](handleError(_0x24cef2,null));};exports[_0xb49e('0x4c')]=function(_0x1d64c1,_0x431c17,_0x4fcc46){var _0x4011cd={};var _0x2920a8={};var _0x580fdf;var _0x4fda34;return db['DeskConfiguration']['findOne']({'where':{'id':_0x1d64c1['params']['id']}})['then'](handleEntityNotFound(_0x431c17,null))['then'](function(_0xea72d8){if(_0xea72d8){_0x580fdf=_0xea72d8;_0x2920a8[_0xb49e('0x2c')]=_[_0xb49e('0x2e')](db[_0xb49e('0x4d')][_0xb49e('0x28')]);_0x2920a8[_0xb49e('0x2d')]=_['keys'](_0x1d64c1[_0xb49e('0x2d')]);_0x2920a8[_0xb49e('0x2f')]=_['intersection'](_0x2920a8[_0xb49e('0x2c')],_0x2920a8['query']);_0x4011cd[_0xb49e('0x32')]=_[_0xb49e('0x30')](_0x2920a8[_0xb49e('0x2c')],qs[_0xb49e('0x31')](_0x1d64c1[_0xb49e('0x2d')][_0xb49e('0x31')]));_0x4011cd[_0xb49e('0x32')]=_0x4011cd[_0xb49e('0x32')][_0xb49e('0x33')]?_0x4011cd['attributes']:_0x2920a8[_0xb49e('0x2c')];_0x4011cd[_0xb49e('0x35')]=qs['sort'](_0x1d64c1[_0xb49e('0x2d')][_0xb49e('0x36')]);_0x4011cd[_0xb49e('0x39')]=qs[_0xb49e('0x2f')](_[_0xb49e('0x37')](_0x1d64c1[_0xb49e('0x2d')],_0x2920a8[_0xb49e('0x2f')]));if(_0x1d64c1[_0xb49e('0x2d')][_0xb49e('0x38')]){_0x4011cd[_0xb49e('0x39')]=_['merge'](_0x4011cd[_0xb49e('0x39')],{'$or':_[_0xb49e('0x26')](_0x4011cd[_0xb49e('0x32')],function(_0x681160){var _0x3a82c3={};_0x3a82c3[_0x681160]={'$like':'%'+_0x1d64c1[_0xb49e('0x2d')][_0xb49e('0x38')]+'%'};return _0x3a82c3;})});}_0x4011cd=_['merge']({},_0x4011cd,_0x1d64c1['options']);return _0x580fdf[_0xb49e('0x4c')](_0x4011cd);}})[_0xb49e('0x21')](function(_0x5bb789){if(_0x5bb789){_0x4fda34=_0x5bb789['length'];if(!_0x1d64c1['query'][_0xb49e('0x48')](_0xb49e('0x34'))){_0x4011cd['limit']=qs[_0xb49e('0x18')](_0x1d64c1[_0xb49e('0x2d')][_0xb49e('0x18')]);_0x4011cd[_0xb49e('0x16')]=qs[_0xb49e('0x16')](_0x1d64c1[_0xb49e('0x2d')]['offset']);}return _0x580fdf[_0xb49e('0x4c')](_0x4011cd);}})[_0xb49e('0x21')](function(_0x2fca76){if(_0x2fca76){return _0x2fca76?{'count':_0x4fda34,'rows':_0x2fca76}:null;}})[_0xb49e('0x21')](respondWithResult(_0x431c17,null))[_0xb49e('0x40')](handleError(_0x431c17,null));};exports[_0xb49e('0x4e')]=function(_0xfb1566,_0xac473e,_0x557a72){if(_0xfb1566[_0xb49e('0x44')]['id']){delete _0xfb1566[_0xb49e('0x44')]['id'];}return db[_0xb49e('0x27')][_0xb49e('0x4a')]({'where':{'id':_0xfb1566[_0xb49e('0x45')]['id']}})[_0xb49e('0x21')](handleEntityNotFound(_0xac473e,null))['then'](function(_0x58799d){if(_0x58799d){return _0x58799d[_0xb49e('0x4e')](_0xfb1566[_0xb49e('0x44')][_0xb49e('0x4f')]||[]);}return null;})[_0xb49e('0x21')](respondWithResult(_0xac473e,null))[_0xb49e('0x40')](handleError(_0xac473e,null));}; \ No newline at end of file +var _0x7fb2=['sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','then','destroy','error','stack','name','send','map','DeskConfiguration','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','rows','show','params','keys','includeAll','include','find','catch','body','findOne','getFields','getSubjects','DeskField','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path'];(function(_0x39c3d3,_0x15a3a6){var _0x3175af=function(_0x466948){while(--_0x466948){_0x39c3d3['push'](_0x39c3d3['shift']());}};_0x3175af(++_0x15a3a6);}(_0x7fb2,0x9b));var _0x27fb=function(_0x121460,_0x48443d){_0x121460=_0x121460-0x0;var _0x53edf5=_0x7fb2[_0x121460];return _0x53edf5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x27fb('0x0'));var zipdir=require(_0x27fb('0x1'));var jsonpatch=require(_0x27fb('0x2'));var rp=require(_0x27fb('0x3'));var moment=require('moment');var BPromise=require(_0x27fb('0x4'));var Mustache=require('mustache');var util=require(_0x27fb('0x5'));var path=require(_0x27fb('0x6'));var sox=require(_0x27fb('0x7'));var csv=require(_0x27fb('0x8'));var ejs=require(_0x27fb('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x27fb('0xa'));var crypto=require(_0x27fb('0xb'));var jsforce=require(_0x27fb('0xc'));var deskjs=require(_0x27fb('0xd'));var toCsv=require(_0x27fb('0x8'));var querystring=require(_0x27fb('0xe'));var Papa=require(_0x27fb('0xf'));var Redis=require(_0x27fb('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x27fb('0x11'));var as=require(_0x27fb('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x27fb('0x13'))(_0x27fb('0x14'));var utils=require(_0x27fb('0x15'));var config=require(_0x27fb('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x27fb('0x17'))['db'];function respondWithStatusCode(_0x49485f,_0x595428){_0x595428=_0x595428||0xcc;return function(_0x32a41c){if(_0x32a41c){return _0x49485f[_0x27fb('0x18')](_0x595428);}return _0x49485f[_0x27fb('0x19')](_0x595428)[_0x27fb('0x1a')]();};}function respondWithResult(_0x342852,_0x21abeb){_0x21abeb=_0x21abeb||0xc8;return function(_0x5218ec){if(_0x5218ec){return _0x342852[_0x27fb('0x19')](_0x21abeb)[_0x27fb('0x1b')](_0x5218ec);}};}function respondWithFilteredResult(_0x155f94,_0x2682a0){return function(_0x2620f9){if(_0x2620f9){var _0x3056f2=typeof _0x2682a0[_0x27fb('0x1c')]===_0x27fb('0x1d')&&typeof _0x2682a0[_0x27fb('0x1e')]===_0x27fb('0x1d');var _0x15db6b=_0x2620f9[_0x27fb('0x1f')];var _0x5e3f30=_0x3056f2?0x0:_0x2682a0[_0x27fb('0x1c')];var _0x22227b=_0x3056f2?_0x2620f9[_0x27fb('0x1f')]:_0x2682a0['offset']+_0x2682a0[_0x27fb('0x1e')];var _0x3bc8ca;if(_0x22227b>=_0x15db6b){_0x22227b=_0x15db6b;_0x3bc8ca=0xc8;}else{_0x3bc8ca=0xce;}_0x155f94[_0x27fb('0x19')](_0x3bc8ca);return _0x155f94[_0x27fb('0x20')]('Content-Range',_0x5e3f30+'-'+_0x22227b+'/'+_0x15db6b)[_0x27fb('0x1b')](_0x2620f9);}return null;};}function patchUpdates(_0xa59955){return function(_0x28867a){try{jsonpatch[_0x27fb('0x21')](_0x28867a,_0xa59955,!![]);}catch(_0x45d1cc){return BPromise[_0x27fb('0x22')](_0x45d1cc);}return _0x28867a['save']();};}function saveUpdates(_0x171894,_0x53c7b2){return function(_0x2a5936){if(_0x2a5936){return _0x2a5936['update'](_0x171894)[_0x27fb('0x23')](function(_0x31843e){return _0x31843e;});}return null;};}function removeEntity(_0x2864cf,_0x4f15a0){return function(_0xeecf94){if(_0xeecf94){return _0xeecf94[_0x27fb('0x24')]()[_0x27fb('0x23')](function(){_0x2864cf[_0x27fb('0x19')](0xcc)[_0x27fb('0x1a')]();});}};}function handleEntityNotFound(_0x1fd083,_0x2319a9){return function(_0x585558){if(!_0x585558){_0x1fd083[_0x27fb('0x18')](0x194);}return _0x585558;};}function handleError(_0x277ccf,_0x42a1c5){_0x42a1c5=_0x42a1c5||0x1f4;return function(_0xdbc818){logger[_0x27fb('0x25')](_0xdbc818[_0x27fb('0x26')]);if(_0xdbc818[_0x27fb('0x27')]){delete _0xdbc818['name'];}_0x277ccf[_0x27fb('0x19')](_0x42a1c5)[_0x27fb('0x28')](_0xdbc818);};}exports['index']=function(_0x2c70d8,_0x29db4c){var _0x1787d0={},_0x3b4c38={},_0x4d7007={'count':0x0,'rows':[]};var _0x3aaca9=_[_0x27fb('0x29')](db[_0x27fb('0x2a')][_0x27fb('0x2b')],function(_0x33a27e){return{'name':_0x33a27e['fieldName'],'type':_0x33a27e[_0x27fb('0x2c')][_0x27fb('0x2d')]};});_0x3b4c38[_0x27fb('0x2e')]=_['map'](_0x3aaca9,_0x27fb('0x27'));_0x3b4c38[_0x27fb('0x2f')]=_['keys'](_0x2c70d8['query']);_0x3b4c38[_0x27fb('0x30')]=_[_0x27fb('0x31')](_0x3b4c38['model'],_0x3b4c38[_0x27fb('0x2f')]);_0x1787d0[_0x27fb('0x32')]=_[_0x27fb('0x31')](_0x3b4c38[_0x27fb('0x2e')],qs[_0x27fb('0x33')](_0x2c70d8[_0x27fb('0x2f')]['fields']));_0x1787d0['attributes']=_0x1787d0[_0x27fb('0x32')][_0x27fb('0x34')]?_0x1787d0[_0x27fb('0x32')]:_0x3b4c38[_0x27fb('0x2e')];if(!_0x2c70d8[_0x27fb('0x2f')][_0x27fb('0x35')](_0x27fb('0x36'))){_0x1787d0[_0x27fb('0x1e')]=qs[_0x27fb('0x1e')](_0x2c70d8[_0x27fb('0x2f')]['limit']);_0x1787d0[_0x27fb('0x1c')]=qs[_0x27fb('0x1c')](_0x2c70d8['query'][_0x27fb('0x1c')]);}_0x1787d0[_0x27fb('0x37')]=qs[_0x27fb('0x38')](_0x2c70d8['query'][_0x27fb('0x38')]);_0x1787d0[_0x27fb('0x39')]=qs['filters'](_[_0x27fb('0x3a')](_0x2c70d8[_0x27fb('0x2f')],_0x3b4c38[_0x27fb('0x30')]),_0x3aaca9);if(_0x2c70d8[_0x27fb('0x2f')]['filter']){_0x1787d0[_0x27fb('0x39')]=_[_0x27fb('0x3b')](_0x1787d0[_0x27fb('0x39')],{'$or':_[_0x27fb('0x29')](_0x3aaca9,function(_0x19fa6e){if(_0x19fa6e['type']!==_0x27fb('0x3c')){var _0x5ca065={};_0x5ca065[_0x19fa6e[_0x27fb('0x27')]]={'$like':'%'+_0x2c70d8['query'][_0x27fb('0x3d')]+'%'};return _0x5ca065;}})});}_0x1787d0=_[_0x27fb('0x3b')]({},_0x1787d0,_0x2c70d8[_0x27fb('0x3e')]);var _0x2845fc={'where':_0x1787d0[_0x27fb('0x39')]};return db[_0x27fb('0x2a')][_0x27fb('0x1f')](_0x2845fc)[_0x27fb('0x23')](function(_0x4cf2c3){_0x4d7007[_0x27fb('0x1f')]=_0x4cf2c3;if(_0x2c70d8[_0x27fb('0x2f')]['includeAll']){_0x1787d0['include']=[{'all':!![]}];}return db[_0x27fb('0x2a')]['findAll'](_0x1787d0);})['then'](function(_0x2f69a4){_0x4d7007[_0x27fb('0x3f')]=_0x2f69a4;return _0x4d7007;})[_0x27fb('0x23')](respondWithFilteredResult(_0x29db4c,_0x1787d0))['catch'](handleError(_0x29db4c,null));};exports[_0x27fb('0x40')]=function(_0x8ea61c,_0x30fd4e){var _0x274459={'raw':![],'where':{'id':_0x8ea61c[_0x27fb('0x41')]['id']}},_0x3598c8={};_0x3598c8['model']=_['keys'](db[_0x27fb('0x2a')]['rawAttributes']);_0x3598c8['query']=_[_0x27fb('0x42')](_0x8ea61c[_0x27fb('0x2f')]);_0x3598c8[_0x27fb('0x30')]=_[_0x27fb('0x31')](_0x3598c8[_0x27fb('0x2e')],_0x3598c8[_0x27fb('0x2f')]);_0x274459['attributes']=_['intersection'](_0x3598c8[_0x27fb('0x2e')],qs['fields'](_0x8ea61c['query'][_0x27fb('0x33')]));_0x274459[_0x27fb('0x32')]=_0x274459['attributes'][_0x27fb('0x34')]?_0x274459['attributes']:_0x3598c8[_0x27fb('0x2e')];if(_0x8ea61c['query'][_0x27fb('0x43')]){_0x274459[_0x27fb('0x44')]=[{'all':!![]}];}_0x274459=_[_0x27fb('0x3b')]({},_0x274459,_0x8ea61c[_0x27fb('0x3e')]);return db[_0x27fb('0x2a')][_0x27fb('0x45')](_0x274459)[_0x27fb('0x23')](handleEntityNotFound(_0x30fd4e,null))[_0x27fb('0x23')](respondWithResult(_0x30fd4e,null))[_0x27fb('0x46')](handleError(_0x30fd4e,null));};exports['create']=function(_0x29dbd2,_0x100109){return db[_0x27fb('0x2a')]['create'](_0x29dbd2[_0x27fb('0x47')],{})[_0x27fb('0x23')](respondWithResult(_0x100109,0xc9))[_0x27fb('0x46')](handleError(_0x100109,null));};exports['update']=function(_0x3d9f4f,_0x2ce480){if(_0x3d9f4f[_0x27fb('0x47')]['id']){delete _0x3d9f4f[_0x27fb('0x47')]['id'];}return db[_0x27fb('0x2a')][_0x27fb('0x45')]({'where':{'id':_0x3d9f4f[_0x27fb('0x41')]['id']}})[_0x27fb('0x23')](handleEntityNotFound(_0x2ce480,null))['then'](saveUpdates(_0x3d9f4f[_0x27fb('0x47')],null))[_0x27fb('0x23')](respondWithResult(_0x2ce480,null))[_0x27fb('0x46')](handleError(_0x2ce480,null));};exports[_0x27fb('0x24')]=function(_0x5ebeb1,_0x30cbd0){return db[_0x27fb('0x2a')][_0x27fb('0x45')]({'where':{'id':_0x5ebeb1['params']['id']}})[_0x27fb('0x23')](handleEntityNotFound(_0x30cbd0,null))['then'](removeEntity(_0x30cbd0,null))[_0x27fb('0x46')](handleError(_0x30cbd0,null));};exports['getFields']=function(_0x5f67a6,_0x4cc1c3,_0x284e06){var _0x5de0b8={};var _0x30d77a={};var _0x2f2bab;var _0x159eb8;return db['DeskConfiguration'][_0x27fb('0x48')]({'where':{'id':_0x5f67a6[_0x27fb('0x41')]['id']}})[_0x27fb('0x23')](handleEntityNotFound(_0x4cc1c3,null))[_0x27fb('0x23')](function(_0x334a17){if(_0x334a17){_0x2f2bab=_0x334a17;_0x30d77a['model']=_[_0x27fb('0x42')](db['DeskField'][_0x27fb('0x2b')]);_0x30d77a['query']=_[_0x27fb('0x42')](_0x5f67a6[_0x27fb('0x2f')]);_0x30d77a[_0x27fb('0x30')]=_[_0x27fb('0x31')](_0x30d77a['model'],_0x30d77a[_0x27fb('0x2f')]);_0x5de0b8[_0x27fb('0x32')]=_['intersection'](_0x30d77a[_0x27fb('0x2e')],qs[_0x27fb('0x33')](_0x5f67a6[_0x27fb('0x2f')][_0x27fb('0x33')]));_0x5de0b8[_0x27fb('0x32')]=_0x5de0b8[_0x27fb('0x32')]['length']?_0x5de0b8[_0x27fb('0x32')]:_0x30d77a[_0x27fb('0x2e')];_0x5de0b8['order']=qs['sort'](_0x5f67a6[_0x27fb('0x2f')][_0x27fb('0x38')]);_0x5de0b8['where']=qs[_0x27fb('0x30')](_[_0x27fb('0x3a')](_0x5f67a6[_0x27fb('0x2f')],_0x30d77a[_0x27fb('0x30')]));if(_0x5f67a6[_0x27fb('0x2f')][_0x27fb('0x3d')]){_0x5de0b8[_0x27fb('0x39')]=_[_0x27fb('0x3b')](_0x5de0b8[_0x27fb('0x39')],{'$or':_[_0x27fb('0x29')](_0x5de0b8[_0x27fb('0x32')],function(_0x31488d){var _0x435ccb={};_0x435ccb[_0x31488d]={'$like':'%'+_0x5f67a6[_0x27fb('0x2f')]['filter']+'%'};return _0x435ccb;})});}_0x5de0b8=_[_0x27fb('0x3b')]({},_0x5de0b8,_0x5f67a6[_0x27fb('0x3e')]);return _0x2f2bab['getFields'](_0x5de0b8);}})[_0x27fb('0x23')](function(_0x244b29){if(_0x244b29){_0x159eb8=_0x244b29[_0x27fb('0x34')];if(!_0x5f67a6[_0x27fb('0x2f')][_0x27fb('0x35')](_0x27fb('0x36'))){_0x5de0b8[_0x27fb('0x1e')]=qs[_0x27fb('0x1e')](_0x5f67a6[_0x27fb('0x2f')]['limit']);_0x5de0b8[_0x27fb('0x1c')]=qs[_0x27fb('0x1c')](_0x5f67a6[_0x27fb('0x2f')][_0x27fb('0x1c')]);}return _0x2f2bab[_0x27fb('0x49')](_0x5de0b8);}})['then'](function(_0x3072c7){if(_0x3072c7){return _0x3072c7?{'count':_0x159eb8,'rows':_0x3072c7}:null;}})[_0x27fb('0x23')](respondWithResult(_0x4cc1c3,null))['catch'](handleError(_0x4cc1c3,null));};exports[_0x27fb('0x4a')]=function(_0x5ba18d,_0x34248f,_0x58400d){var _0x148338={};var _0x261059={};var _0x56e326;var _0x4b7d60;return db[_0x27fb('0x2a')][_0x27fb('0x48')]({'where':{'id':_0x5ba18d[_0x27fb('0x41')]['id']}})[_0x27fb('0x23')](handleEntityNotFound(_0x34248f,null))['then'](function(_0x293f9c){if(_0x293f9c){_0x56e326=_0x293f9c;_0x261059[_0x27fb('0x2e')]=_[_0x27fb('0x42')](db[_0x27fb('0x4b')]['rawAttributes']);_0x261059[_0x27fb('0x2f')]=_[_0x27fb('0x42')](_0x5ba18d['query']);_0x261059[_0x27fb('0x30')]=_['intersection'](_0x261059[_0x27fb('0x2e')],_0x261059[_0x27fb('0x2f')]);_0x148338[_0x27fb('0x32')]=_['intersection'](_0x261059[_0x27fb('0x2e')],qs[_0x27fb('0x33')](_0x5ba18d[_0x27fb('0x2f')][_0x27fb('0x33')]));_0x148338[_0x27fb('0x32')]=_0x148338[_0x27fb('0x32')]['length']?_0x148338[_0x27fb('0x32')]:_0x261059[_0x27fb('0x2e')];_0x148338[_0x27fb('0x37')]=qs[_0x27fb('0x38')](_0x5ba18d[_0x27fb('0x2f')]['sort']);_0x148338[_0x27fb('0x39')]=qs[_0x27fb('0x30')](_[_0x27fb('0x3a')](_0x5ba18d[_0x27fb('0x2f')],_0x261059[_0x27fb('0x30')]));if(_0x5ba18d[_0x27fb('0x2f')][_0x27fb('0x3d')]){_0x148338[_0x27fb('0x39')]=_[_0x27fb('0x3b')](_0x148338['where'],{'$or':_[_0x27fb('0x29')](_0x148338['attributes'],function(_0x471870){var _0x51b22c={};_0x51b22c[_0x471870]={'$like':'%'+_0x5ba18d[_0x27fb('0x2f')]['filter']+'%'};return _0x51b22c;})});}_0x148338=_[_0x27fb('0x3b')]({},_0x148338,_0x5ba18d[_0x27fb('0x3e')]);return _0x56e326[_0x27fb('0x4a')](_0x148338);}})[_0x27fb('0x23')](function(_0xc78814){if(_0xc78814){_0x4b7d60=_0xc78814['length'];if(!_0x5ba18d[_0x27fb('0x2f')]['hasOwnProperty']('nolimit')){_0x148338[_0x27fb('0x1e')]=qs[_0x27fb('0x1e')](_0x5ba18d[_0x27fb('0x2f')]['limit']);_0x148338[_0x27fb('0x1c')]=qs['offset'](_0x5ba18d['query']['offset']);}return _0x56e326[_0x27fb('0x4a')](_0x148338);}})[_0x27fb('0x23')](function(_0x3fdf8b){if(_0x3fdf8b){return _0x3fdf8b?{'count':_0x4b7d60,'rows':_0x3fdf8b}:null;}})[_0x27fb('0x23')](respondWithResult(_0x34248f,null))[_0x27fb('0x46')](handleError(_0x34248f,null));};exports[_0x27fb('0x4c')]=function(_0x20e6f0,_0x190065,_0xebcd41){var _0x2f6d04={};var _0xae99bf={};var _0x276258;var _0x196321;return db[_0x27fb('0x2a')][_0x27fb('0x48')]({'where':{'id':_0x20e6f0['params']['id']}})['then'](handleEntityNotFound(_0x190065,null))[_0x27fb('0x23')](function(_0x537a83){if(_0x537a83){_0x276258=_0x537a83;_0xae99bf['model']=_['keys'](db[_0x27fb('0x4b')][_0x27fb('0x2b')]);_0xae99bf[_0x27fb('0x2f')]=_[_0x27fb('0x42')](_0x20e6f0[_0x27fb('0x2f')]);_0xae99bf['filters']=_[_0x27fb('0x31')](_0xae99bf[_0x27fb('0x2e')],_0xae99bf[_0x27fb('0x2f')]);_0x2f6d04['attributes']=_[_0x27fb('0x31')](_0xae99bf['model'],qs['fields'](_0x20e6f0[_0x27fb('0x2f')][_0x27fb('0x33')]));_0x2f6d04[_0x27fb('0x32')]=_0x2f6d04[_0x27fb('0x32')]['length']?_0x2f6d04['attributes']:_0xae99bf[_0x27fb('0x2e')];_0x2f6d04[_0x27fb('0x37')]=qs[_0x27fb('0x38')](_0x20e6f0['query'][_0x27fb('0x38')]);_0x2f6d04['where']=qs[_0x27fb('0x30')](_[_0x27fb('0x3a')](_0x20e6f0[_0x27fb('0x2f')],_0xae99bf[_0x27fb('0x30')]));if(_0x20e6f0[_0x27fb('0x2f')][_0x27fb('0x3d')]){_0x2f6d04[_0x27fb('0x39')]=_[_0x27fb('0x3b')](_0x2f6d04['where'],{'$or':_[_0x27fb('0x29')](_0x2f6d04[_0x27fb('0x32')],function(_0x310209){var _0x487d96={};_0x487d96[_0x310209]={'$like':'%'+_0x20e6f0[_0x27fb('0x2f')][_0x27fb('0x3d')]+'%'};return _0x487d96;})});}_0x2f6d04=_[_0x27fb('0x3b')]({},_0x2f6d04,_0x20e6f0['options']);return _0x276258[_0x27fb('0x4c')](_0x2f6d04);}})[_0x27fb('0x23')](function(_0x18a779){if(_0x18a779){_0x196321=_0x18a779[_0x27fb('0x34')];if(!_0x20e6f0[_0x27fb('0x2f')]['hasOwnProperty']('nolimit')){_0x2f6d04[_0x27fb('0x1e')]=qs[_0x27fb('0x1e')](_0x20e6f0['query'][_0x27fb('0x1e')]);_0x2f6d04[_0x27fb('0x1c')]=qs[_0x27fb('0x1c')](_0x20e6f0[_0x27fb('0x2f')][_0x27fb('0x1c')]);}return _0x276258['getDescriptions'](_0x2f6d04);}})[_0x27fb('0x23')](function(_0x431969){if(_0x431969){return _0x431969?{'count':_0x196321,'rows':_0x431969}:null;}})[_0x27fb('0x23')](respondWithResult(_0x190065,null))['catch'](handleError(_0x190065,null));};exports[_0x27fb('0x4d')]=function(_0x1e8c8b,_0x653b01,_0x301b12){var _0x364d22={};var _0x185167={};var _0x9f336d;var _0x2eb9a6;return db[_0x27fb('0x2a')][_0x27fb('0x48')]({'where':{'id':_0x1e8c8b['params']['id']}})['then'](handleEntityNotFound(_0x653b01,null))[_0x27fb('0x23')](function(_0x4bb73c){if(_0x4bb73c){_0x9f336d=_0x4bb73c;_0x185167[_0x27fb('0x2e')]=_[_0x27fb('0x42')](db[_0x27fb('0x4e')]['rawAttributes']);_0x185167[_0x27fb('0x2f')]=_[_0x27fb('0x42')](_0x1e8c8b[_0x27fb('0x2f')]);_0x185167[_0x27fb('0x30')]=_[_0x27fb('0x31')](_0x185167[_0x27fb('0x2e')],_0x185167[_0x27fb('0x2f')]);_0x364d22[_0x27fb('0x32')]=_[_0x27fb('0x31')](_0x185167[_0x27fb('0x2e')],qs['fields'](_0x1e8c8b[_0x27fb('0x2f')]['fields']));_0x364d22[_0x27fb('0x32')]=_0x364d22[_0x27fb('0x32')][_0x27fb('0x34')]?_0x364d22['attributes']:_0x185167[_0x27fb('0x2e')];_0x364d22[_0x27fb('0x37')]=qs[_0x27fb('0x38')](_0x1e8c8b['query'][_0x27fb('0x38')]);_0x364d22[_0x27fb('0x39')]=qs[_0x27fb('0x30')](_[_0x27fb('0x3a')](_0x1e8c8b['query'],_0x185167[_0x27fb('0x30')]));if(_0x1e8c8b[_0x27fb('0x2f')][_0x27fb('0x3d')]){_0x364d22[_0x27fb('0x39')]=_['merge'](_0x364d22[_0x27fb('0x39')],{'$or':_[_0x27fb('0x29')](_0x364d22[_0x27fb('0x32')],function(_0x1fd8ce){var _0x91235={};_0x91235[_0x1fd8ce]={'$like':'%'+_0x1e8c8b[_0x27fb('0x2f')][_0x27fb('0x3d')]+'%'};return _0x91235;})});}_0x364d22=_[_0x27fb('0x3b')]({},_0x364d22,_0x1e8c8b['options']);return _0x9f336d[_0x27fb('0x4d')](_0x364d22);}})['then'](function(_0xc7069a){if(_0xc7069a){_0x2eb9a6=_0xc7069a[_0x27fb('0x34')];if(!_0x1e8c8b[_0x27fb('0x2f')]['hasOwnProperty'](_0x27fb('0x36'))){_0x364d22[_0x27fb('0x1e')]=qs[_0x27fb('0x1e')](_0x1e8c8b[_0x27fb('0x2f')][_0x27fb('0x1e')]);_0x364d22[_0x27fb('0x1c')]=qs['offset'](_0x1e8c8b[_0x27fb('0x2f')][_0x27fb('0x1c')]);}return _0x9f336d[_0x27fb('0x4d')](_0x364d22);}})[_0x27fb('0x23')](function(_0x250318){if(_0x250318){return _0x250318?{'count':_0x2eb9a6,'rows':_0x250318}:null;}})[_0x27fb('0x23')](respondWithResult(_0x653b01,null))[_0x27fb('0x46')](handleError(_0x653b01,null));};exports[_0x27fb('0x4f')]=function(_0x1770d8,_0x22aa4c,_0x2b7f90){if(_0x1770d8[_0x27fb('0x47')]['id']){delete _0x1770d8[_0x27fb('0x47')]['id'];}return db[_0x27fb('0x2a')][_0x27fb('0x48')]({'where':{'id':_0x1770d8[_0x27fb('0x41')]['id']}})[_0x27fb('0x23')](handleEntityNotFound(_0x22aa4c,null))['then'](function(_0xfcd978){if(_0xfcd978){return _0xfcd978[_0x27fb('0x4f')](_0x1770d8[_0x27fb('0x47')][_0x27fb('0x50')]||[]);}return null;})[_0x27fb('0x23')](respondWithResult(_0x22aa4c,null))[_0x27fb('0x46')](handleError(_0x22aa4c,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 945175b..49d3438 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 _0x9a43=['bluebird','../../config/environment','./intDeskConfiguration.attributes','exports','define','int_desk_configurations','util','../../config/logger','api','moment'];(function(_0x5e9817,_0xa29439){var _0x25b437=function(_0x46851b){while(--_0x46851b){_0x5e9817['push'](_0x5e9817['shift']());}};_0x25b437(++_0xa29439);}(_0x9a43,0x15a));var _0x39a4=function(_0x147497,_0x43e433){_0x147497=_0x147497-0x0;var _0x35f45=_0x9a43[_0x147497];return _0x35f45;};'use strict';var _=require('lodash');var util=require(_0x39a4('0x0'));var logger=require(_0x39a4('0x1'))(_0x39a4('0x2'));var moment=require(_0x39a4('0x3'));var BPromise=require(_0x39a4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x39a4('0x5'));var attributes=require(_0x39a4('0x6'));module[_0x39a4('0x7')]=function(_0x52b622,_0x3b728f){return _0x52b622[_0x39a4('0x8')]('DeskConfiguration',attributes,{'tableName':_0x39a4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb793=['request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','define','DeskConfiguration','lodash','util','../../config/logger','api','bluebird'];(function(_0x316310,_0x322d48){var _0xe00294=function(_0x5889ea){while(--_0x5889ea){_0x316310['push'](_0x316310['shift']());}};_0xe00294(++_0x322d48);}(_0xb793,0x19f));var _0x3b79=function(_0x4da10c,_0x15094f){_0x4da10c=_0x4da10c-0x0;var _0x3f22ea=_0xb793[_0x4da10c];return _0x3f22ea;};'use strict';var _=require(_0x3b79('0x0'));var util=require(_0x3b79('0x1'));var logger=require(_0x3b79('0x2'))(_0x3b79('0x3'));var moment=require('moment');var BPromise=require(_0x3b79('0x4'));var rp=require(_0x3b79('0x5'));var fs=require('fs');var path=require(_0x3b79('0x6'));var rimraf=require(_0x3b79('0x7'));var config=require(_0x3b79('0x8'));var attributes=require(_0x3b79('0x9'));module['exports']=function(_0x224bce,_0x542c96){return _0x224bce[_0x3b79('0xa')](_0x3b79('0xb'),attributes,{'tableName':'int_desk_configurations','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 454adf9..e8deccc 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 _0x8d5e=['util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','DeskConfiguration,\x20%s,\x20%s','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','lodash'];(function(_0x2e1cf1,_0xac9c91){var _0x4a0556=function(_0x4a107a){while(--_0x4a107a){_0x2e1cf1['push'](_0x2e1cf1['shift']());}};_0x4a0556(++_0xac9c91);}(_0x8d5e,0xf6));var _0xe8d5=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x8d5e[_0x243b2f];return _0xcb3c2d;};'use strict';var _=require(_0xe8d5('0x0'));var util=require(_0xe8d5('0x1'));var moment=require(_0xe8d5('0x2'));var BPromise=require(_0xe8d5('0x3'));var rs=require(_0xe8d5('0x4'));var fs=require('fs');var Redis=require(_0xe8d5('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe8d5('0x6'))(_0xe8d5('0x7'));var config=require(_0xe8d5('0x8'));var jayson=require(_0xe8d5('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x31ff1a,_0x1c1b96,_0x5252a8){return new BPromise(function(_0x262fae,_0x4348a4){return client[_0xe8d5('0xa')](_0x31ff1a,_0x5252a8)[_0xe8d5('0xb')](function(_0x4e4eae){logger[_0xe8d5('0xc')](_0xe8d5('0xd'),_0x1c1b96,'request\x20sent');logger['debug'](_0xe8d5('0xe'),_0x1c1b96,_0xe8d5('0xf'),JSON['stringify'](_0x4e4eae));if(_0x4e4eae[_0xe8d5('0x10')]){if(_0x4e4eae['error']['code']===0x1f4){logger['error'](_0xe8d5('0xd'),_0x1c1b96,_0x4e4eae[_0xe8d5('0x10')][_0xe8d5('0x11')]);return _0x4348a4(_0x4e4eae[_0xe8d5('0x10')][_0xe8d5('0x11')]);}logger[_0xe8d5('0x10')](_0xe8d5('0xd'),_0x1c1b96,_0x4e4eae[_0xe8d5('0x10')][_0xe8d5('0x11')]);return _0x262fae(_0x4e4eae[_0xe8d5('0x10')][_0xe8d5('0x11')]);}else{logger['info'](_0xe8d5('0xd'),_0x1c1b96,_0xe8d5('0xf'));_0x262fae(_0x4e4eae['result'][_0xe8d5('0x11')]);}})[_0xe8d5('0x12')](function(_0xc877c0){logger[_0xe8d5('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x1c1b96,_0xc877c0);_0x4348a4(_0xc877c0);});});} \ No newline at end of file +var _0x8374=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment'];(function(_0x5c1b15,_0x40e3c7){var _0x52c9e0=function(_0x570cff){while(--_0x570cff){_0x5c1b15['push'](_0x5c1b15['shift']());}};_0x52c9e0(++_0x40e3c7);}(_0x8374,0x174));var _0x4837=function(_0x39235d,_0x435d35){_0x39235d=_0x39235d-0x0;var _0x357067=_0x8374[_0x39235d];return _0x357067;};'use strict';var _=require(_0x4837('0x0'));var util=require(_0x4837('0x1'));var moment=require(_0x4837('0x2'));var BPromise=require(_0x4837('0x3'));var rs=require(_0x4837('0x4'));var fs=require('fs');var Redis=require(_0x4837('0x5'));var db=require(_0x4837('0x6'))['db'];var utils=require(_0x4837('0x7'));var logger=require(_0x4837('0x8'))(_0x4837('0x9'));var config=require(_0x4837('0xa'));var jayson=require(_0x4837('0xb'));var client=jayson[_0x4837('0xc')][_0x4837('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4e0e60,_0x2036a4,_0x560c37){return new BPromise(function(_0x408c14,_0x476a1d){return client[_0x4837('0xe')](_0x4e0e60,_0x560c37)[_0x4837('0xf')](function(_0x2f0ca6){logger[_0x4837('0x10')](_0x4837('0x11'),_0x2036a4,_0x4837('0x12'));logger[_0x4837('0x13')](_0x4837('0x14'),_0x2036a4,'request\x20sent',JSON['stringify'](_0x2f0ca6));if(_0x2f0ca6[_0x4837('0x15')]){if(_0x2f0ca6['error'][_0x4837('0x16')]===0x1f4){logger[_0x4837('0x15')]('DeskConfiguration,\x20%s,\x20%s',_0x2036a4,_0x2f0ca6['error']['message']);return _0x476a1d(_0x2f0ca6[_0x4837('0x15')][_0x4837('0x17')]);}logger[_0x4837('0x15')](_0x4837('0x11'),_0x2036a4,_0x2f0ca6['error'][_0x4837('0x17')]);return _0x408c14(_0x2f0ca6[_0x4837('0x15')][_0x4837('0x17')]);}else{logger['info'](_0x4837('0x11'),_0x2036a4,_0x4837('0x12'));_0x408c14(_0x2f0ca6['result'][_0x4837('0x17')]);}})[_0x4837('0x18')](function(_0xb95296){logger[_0x4837('0x15')](_0x4837('0x11'),_0x2036a4,_0xb95296);_0x476a1d(_0xb95296);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 6e39c65..8175676 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 _0x005f=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','exports','multer','util','path','express','Router','fs-extra'];(function(_0x383627,_0x5be16e){var _0x2c16a0=function(_0x569b72){while(--_0x569b72){_0x383627['push'](_0x383627['shift']());}};_0x2c16a0(++_0x5be16e);}(_0x005f,0x19e));var _0xf005=function(_0xc98b6c,_0x1985f3){_0xc98b6c=_0xc98b6c-0x0;var _0x11a2cb=_0x005f[_0xc98b6c];return _0x11a2cb;};'use strict';var multer=require(_0xf005('0x0'));var util=require(_0xf005('0x1'));var path=require(_0xf005('0x2'));var timeout=require('connect-timeout');var express=require(_0xf005('0x3'));var router=express[_0xf005('0x4')]();var fs_extra=require(_0xf005('0x5'));var auth=require(_0xf005('0x6'));var interaction=require(_0xf005('0x7'));var config=require(_0xf005('0x8'));var controller=require(_0xf005('0x9'));router[_0xf005('0xa')]('/',auth[_0xf005('0xb')](),controller[_0xf005('0xc')]);router[_0xf005('0xa')](_0xf005('0xd'),auth[_0xf005('0xb')](),controller[_0xf005('0xe')]);router[_0xf005('0xf')]('/',auth[_0xf005('0xb')](),controller[_0xf005('0x10')]);router['put']('/:id',auth[_0xf005('0xb')](),controller[_0xf005('0x11')]);router[_0xf005('0x12')]('/:id',auth[_0xf005('0xb')](),controller['destroy']);module[_0xf005('0x13')]=router; \ No newline at end of file +var _0xe1fc=['Router','fs-extra','../../components/auth/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','post','create','put','/:id','update','delete','destroy','multer','path','connect-timeout'];(function(_0x3bf925,_0x4dd8e4){var _0x2128a1=function(_0x4d2049){while(--_0x4d2049){_0x3bf925['push'](_0x3bf925['shift']());}};_0x2128a1(++_0x4dd8e4);}(_0xe1fc,0x1e3));var _0xce1f=function(_0x478414,_0xcf142d){_0x478414=_0x478414-0x0;var _0x5eb6b9=_0xe1fc[_0x478414];return _0x5eb6b9;};'use strict';var multer=require(_0xce1f('0x0'));var util=require('util');var path=require(_0xce1f('0x1'));var timeout=require(_0xce1f('0x2'));var express=require('express');var router=express[_0xce1f('0x3')]();var fs_extra=require(_0xce1f('0x4'));var auth=require(_0xce1f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xce1f('0x6'));var controller=require(_0xce1f('0x7'));router[_0xce1f('0x8')]('/',auth[_0xce1f('0x9')](),controller[_0xce1f('0xa')]);router[_0xce1f('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xce1f('0xb')]('/',auth[_0xce1f('0x9')](),controller[_0xce1f('0xc')]);router[_0xce1f('0xd')](_0xce1f('0xe'),auth[_0xce1f('0x9')](),controller[_0xce1f('0xf')]);router[_0xce1f('0x10')](_0xce1f('0xe'),auth[_0xce1f('0x9')](),controller[_0xce1f('0x11')]);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 7889f84..d87027b 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 _0x66aa=['picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue'];(function(_0x5206f1,_0x28d4e3){var _0x299e50=function(_0x3f8594){while(--_0x3f8594){_0x5206f1['push'](_0x5206f1['shift']());}};_0x299e50(++_0x28d4e3);}(_0x66aa,0xe4));var _0xa66a=function(_0x19d0f4,_0x38b420){_0x19d0f4=_0x19d0f4-0x0;var _0x186ed6=_0x66aa[_0x19d0f4];return _0x186ed6;};'use strict';var Sequelize=require(_0xa66a('0x0'));module[_0xa66a('0x1')]={'type':{'type':Sequelize[_0xa66a('0x2')](_0xa66a('0x3'),_0xa66a('0x4'),'customVariable',_0xa66a('0x5'),_0xa66a('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xa66a('0x7')]},'keyType':{'type':Sequelize[_0xa66a('0x2')](_0xa66a('0x3'),_0xa66a('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xa66a('0x7')]},'idField':{'type':Sequelize[_0xa66a('0x7')]},'nameField':{'type':Sequelize[_0xa66a('0x7')]},'customField':{'type':Sequelize[_0xa66a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa66a('0x7')]}}; \ No newline at end of file +var _0x8e58=['picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x5aee2d,_0x192af8){var _0x43ab2c=function(_0x4d0972){while(--_0x4d0972){_0x5aee2d['push'](_0x5aee2d['shift']());}};_0x43ab2c(++_0x192af8);}(_0x8e58,0x16b));var _0x88e5=function(_0x3a427e,_0x4df5a5){_0x3a427e=_0x3a427e-0x0;var _0x3a255d=_0x8e58[_0x3a427e];return _0x3a255d;};'use strict';var Sequelize=require(_0x88e5('0x0'));module[_0x88e5('0x1')]={'type':{'type':Sequelize[_0x88e5('0x2')](_0x88e5('0x3'),_0x88e5('0x4'),_0x88e5('0x5'),_0x88e5('0x6'),_0x88e5('0x7')),'defaultValue':_0x88e5('0x3')},'content':{'type':Sequelize[_0x88e5('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x88e5('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x88e5('0x8')]},'idField':{'type':Sequelize[_0x88e5('0x8')]},'nameField':{'type':Sequelize[_0x88e5('0x8')]},'customField':{'type':Sequelize[_0x88e5('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x88e5('0x8')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 6d42c20..1ea0658 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 _0x4da5=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','index','map','DeskField','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash'];(function(_0x7872ea,_0xa530f3){var _0x42eec9=function(_0x267c77){while(--_0x267c77){_0x7872ea['push'](_0x7872ea['shift']());}};_0x42eec9(++_0xa530f3);}(_0x4da5,0x1b7));var _0x54da=function(_0x31f470,_0x48cce8){_0x31f470=_0x31f470-0x0;var _0x5b79b8=_0x4da5[_0x31f470];return _0x5b79b8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x54da('0x0'));var zipdir=require(_0x54da('0x1'));var jsonpatch=require(_0x54da('0x2'));var rp=require('request-promise');var moment=require(_0x54da('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x54da('0x4'));var util=require(_0x54da('0x5'));var path=require(_0x54da('0x6'));var sox=require(_0x54da('0x7'));var csv=require('to-csv');var ejs=require(_0x54da('0x8'));var fs=require('fs');var fs_extra=require(_0x54da('0x9'));var _=require(_0x54da('0xa'));var squel=require(_0x54da('0xb'));var crypto=require(_0x54da('0xc'));var jsforce=require(_0x54da('0xd'));var deskjs=require(_0x54da('0xe'));var toCsv=require('to-csv');var querystring=require(_0x54da('0xf'));var Papa=require(_0x54da('0x10'));var Redis=require(_0x54da('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x54da('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x54da('0x13'))(_0x54da('0x14'));var utils=require(_0x54da('0x15'));var config=require(_0x54da('0x16'));var licenseUtil=require(_0x54da('0x17'));var db=require(_0x54da('0x18'))['db'];function respondWithStatusCode(_0x1b4244,_0x2c6240){_0x2c6240=_0x2c6240||0xcc;return function(_0x1963fe){if(_0x1963fe){return _0x1b4244[_0x54da('0x19')](_0x2c6240);}return _0x1b4244[_0x54da('0x1a')](_0x2c6240)[_0x54da('0x1b')]();};}function respondWithResult(_0x425756,_0x58c020){_0x58c020=_0x58c020||0xc8;return function(_0x411e66){if(_0x411e66){return _0x425756[_0x54da('0x1a')](_0x58c020)[_0x54da('0x1c')](_0x411e66);}};}function respondWithFilteredResult(_0x2754fd,_0x5ef918){return function(_0xe142b){if(_0xe142b){var _0x34fab6=typeof _0x5ef918[_0x54da('0x1d')]===_0x54da('0x1e')&&typeof _0x5ef918[_0x54da('0x1f')]===_0x54da('0x1e');var _0x5e17e1=_0xe142b[_0x54da('0x20')];var _0x14aa08=_0x34fab6?0x0:_0x5ef918['offset'];var _0x2cad22=_0x34fab6?_0xe142b[_0x54da('0x20')]:_0x5ef918['offset']+_0x5ef918['limit'];var _0x363334;if(_0x2cad22>=_0x5e17e1){_0x2cad22=_0x5e17e1;_0x363334=0xc8;}else{_0x363334=0xce;}_0x2754fd['status'](_0x363334);return _0x2754fd[_0x54da('0x21')](_0x54da('0x22'),_0x14aa08+'-'+_0x2cad22+'/'+_0x5e17e1)['json'](_0xe142b);}return null;};}function patchUpdates(_0x123cac){return function(_0x4c9f9d){try{jsonpatch[_0x54da('0x23')](_0x4c9f9d,_0x123cac,!![]);}catch(_0x1e9a5d){return BPromise[_0x54da('0x24')](_0x1e9a5d);}return _0x4c9f9d[_0x54da('0x25')]();};}function saveUpdates(_0x348c56,_0x415598){return function(_0x340d26){if(_0x340d26){return _0x340d26[_0x54da('0x26')](_0x348c56)['then'](function(_0x17dfb8){return _0x17dfb8;});}return null;};}function removeEntity(_0xb67cbf,_0x16b09a){return function(_0x3d062b){if(_0x3d062b){return _0x3d062b[_0x54da('0x27')]()[_0x54da('0x28')](function(){_0xb67cbf['status'](0xcc)[_0x54da('0x1b')]();});}};}function handleEntityNotFound(_0xef179d,_0x1f42ec){return function(_0x18d1bd){if(!_0x18d1bd){_0xef179d[_0x54da('0x19')](0x194);}return _0x18d1bd;};}function handleError(_0x126da9,_0x58eee9){_0x58eee9=_0x58eee9||0x1f4;return function(_0x9ea13f){logger['error'](_0x9ea13f[_0x54da('0x29')]);if(_0x9ea13f[_0x54da('0x2a')]){delete _0x9ea13f[_0x54da('0x2a')];}_0x126da9['status'](_0x58eee9)['send'](_0x9ea13f);};}exports[_0x54da('0x2b')]=function(_0x3cc6cc,_0x43610e){var _0x4f7f84={},_0x1f69e6={},_0x1ef2ac={'count':0x0,'rows':[]};var _0x56942a=_[_0x54da('0x2c')](db[_0x54da('0x2d')][_0x54da('0x2e')],function(_0x4f7ee2){return{'name':_0x4f7ee2['fieldName'],'type':_0x4f7ee2[_0x54da('0x2f')]['key']};});_0x1f69e6[_0x54da('0x30')]=_[_0x54da('0x2c')](_0x56942a,_0x54da('0x2a'));_0x1f69e6[_0x54da('0x31')]=_[_0x54da('0x32')](_0x3cc6cc[_0x54da('0x31')]);_0x1f69e6[_0x54da('0x33')]=_[_0x54da('0x34')](_0x1f69e6['model'],_0x1f69e6[_0x54da('0x31')]);_0x4f7f84[_0x54da('0x35')]=_['intersection'](_0x1f69e6['model'],qs[_0x54da('0x36')](_0x3cc6cc[_0x54da('0x31')][_0x54da('0x36')]));_0x4f7f84[_0x54da('0x35')]=_0x4f7f84[_0x54da('0x35')][_0x54da('0x37')]?_0x4f7f84[_0x54da('0x35')]:_0x1f69e6[_0x54da('0x30')];if(!_0x3cc6cc[_0x54da('0x31')][_0x54da('0x38')](_0x54da('0x39'))){_0x4f7f84[_0x54da('0x1f')]=qs['limit'](_0x3cc6cc[_0x54da('0x31')][_0x54da('0x1f')]);_0x4f7f84['offset']=qs[_0x54da('0x1d')](_0x3cc6cc[_0x54da('0x31')][_0x54da('0x1d')]);}_0x4f7f84[_0x54da('0x3a')]=qs[_0x54da('0x3b')](_0x3cc6cc['query']['sort']);_0x4f7f84[_0x54da('0x3c')]=qs['filters'](_['pick'](_0x3cc6cc['query'],_0x1f69e6[_0x54da('0x33')]),_0x56942a);if(_0x3cc6cc[_0x54da('0x31')][_0x54da('0x3d')]){_0x4f7f84[_0x54da('0x3c')]=_[_0x54da('0x3e')](_0x4f7f84[_0x54da('0x3c')],{'$or':_[_0x54da('0x2c')](_0x56942a,function(_0x1c2268){if(_0x1c2268[_0x54da('0x2f')]!==_0x54da('0x3f')){var _0x27b65e={};_0x27b65e[_0x1c2268[_0x54da('0x2a')]]={'$like':'%'+_0x3cc6cc[_0x54da('0x31')][_0x54da('0x3d')]+'%'};return _0x27b65e;}})});}_0x4f7f84=_[_0x54da('0x3e')]({},_0x4f7f84,_0x3cc6cc[_0x54da('0x40')]);var _0x33464a={'where':_0x4f7f84[_0x54da('0x3c')]};return db['DeskField'][_0x54da('0x20')](_0x33464a)['then'](function(_0x33dd65){_0x1ef2ac['count']=_0x33dd65;if(_0x3cc6cc[_0x54da('0x31')][_0x54da('0x41')]){_0x4f7f84[_0x54da('0x42')]=[{'all':!![]}];}return db['DeskField'][_0x54da('0x43')](_0x4f7f84);})['then'](function(_0x28cad0){_0x1ef2ac[_0x54da('0x44')]=_0x28cad0;return _0x1ef2ac;})[_0x54da('0x28')](respondWithFilteredResult(_0x43610e,_0x4f7f84))['catch'](handleError(_0x43610e,null));};exports[_0x54da('0x45')]=function(_0x3f990b,_0x333f0a){var _0x314af0={'raw':!![],'where':{'id':_0x3f990b[_0x54da('0x46')]['id']}},_0x260c32={};_0x260c32[_0x54da('0x30')]=_[_0x54da('0x32')](db[_0x54da('0x2d')]['rawAttributes']);_0x260c32[_0x54da('0x31')]=_[_0x54da('0x32')](_0x3f990b[_0x54da('0x31')]);_0x260c32['filters']=_[_0x54da('0x34')](_0x260c32['model'],_0x260c32[_0x54da('0x31')]);_0x314af0[_0x54da('0x35')]=_['intersection'](_0x260c32[_0x54da('0x30')],qs['fields'](_0x3f990b['query'][_0x54da('0x36')]));_0x314af0['attributes']=_0x314af0[_0x54da('0x35')]['length']?_0x314af0['attributes']:_0x260c32[_0x54da('0x30')];if(_0x3f990b[_0x54da('0x31')][_0x54da('0x41')]){_0x314af0[_0x54da('0x42')]=[{'all':!![]}];}_0x314af0=_[_0x54da('0x3e')]({},_0x314af0,_0x3f990b['options']);return db[_0x54da('0x2d')][_0x54da('0x47')](_0x314af0)[_0x54da('0x28')](handleEntityNotFound(_0x333f0a,null))[_0x54da('0x28')](respondWithResult(_0x333f0a,null))[_0x54da('0x48')](handleError(_0x333f0a,null));};exports[_0x54da('0x49')]=function(_0x48675a,_0x32cbac){return db[_0x54da('0x2d')][_0x54da('0x49')](_0x48675a['body'],{})[_0x54da('0x28')](respondWithResult(_0x32cbac,0xc9))['catch'](handleError(_0x32cbac,null));};exports[_0x54da('0x26')]=function(_0x604a93,_0xddb15d){if(_0x604a93['body']['id']){delete _0x604a93[_0x54da('0x4a')]['id'];}return db[_0x54da('0x2d')][_0x54da('0x47')]({'where':{'id':_0x604a93[_0x54da('0x46')]['id']}})[_0x54da('0x28')](handleEntityNotFound(_0xddb15d,null))[_0x54da('0x28')](saveUpdates(_0x604a93[_0x54da('0x4a')],null))['then'](respondWithResult(_0xddb15d,null))[_0x54da('0x48')](handleError(_0xddb15d,null));};exports[_0x54da('0x27')]=function(_0x361577,_0xa5cdd6){return db['DeskField']['find']({'where':{'id':_0x361577[_0x54da('0x46')]['id']}})['then'](handleEntityNotFound(_0xa5cdd6,null))[_0x54da('0x28')](removeEntity(_0xa5cdd6,null))['catch'](handleError(_0xa5cdd6,null));}; \ No newline at end of file +var _0x853e=['sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','map','DeskField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','include','findAll','rows','show','params','includeAll','create','body','catch','find','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x348450,_0x479b88){var _0x3552a0=function(_0x229bb2){while(--_0x229bb2){_0x348450['push'](_0x348450['shift']());}};_0x3552a0(++_0x479b88);}(_0x853e,0x1ea));var _0xe853=function(_0x228dc2,_0x4d7955){_0x228dc2=_0x228dc2-0x0;var _0x54a442=_0x853e[_0x228dc2];return _0x54a442;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe853('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe853('0x1'));var rp=require('request-promise');var moment=require(_0xe853('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xe853('0x3'));var util=require(_0xe853('0x4'));var path=require(_0xe853('0x5'));var sox=require(_0xe853('0x6'));var csv=require(_0xe853('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe853('0x8'));var _=require(_0xe853('0x9'));var squel=require(_0xe853('0xa'));var crypto=require(_0xe853('0xb'));var jsforce=require(_0xe853('0xc'));var deskjs=require(_0xe853('0xd'));var toCsv=require(_0xe853('0x7'));var querystring=require(_0xe853('0xe'));var Papa=require(_0xe853('0xf'));var Redis=require(_0xe853('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe853('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xe853('0x12'));var config=require(_0xe853('0x13'));var licenseUtil=require(_0xe853('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x88883f,_0x476f20){_0x476f20=_0x476f20||0xcc;return function(_0x43c64b){if(_0x43c64b){return _0x88883f[_0xe853('0x15')](_0x476f20);}return _0x88883f[_0xe853('0x16')](_0x476f20)[_0xe853('0x17')]();};}function respondWithResult(_0x1ebf13,_0x4c92c6){_0x4c92c6=_0x4c92c6||0xc8;return function(_0x4b8e2c){if(_0x4b8e2c){return _0x1ebf13['status'](_0x4c92c6)['json'](_0x4b8e2c);}};}function respondWithFilteredResult(_0x156940,_0x3840b5){return function(_0x41c489){if(_0x41c489){var _0x11e4a0=typeof _0x3840b5[_0xe853('0x18')]===_0xe853('0x19')&&typeof _0x3840b5[_0xe853('0x1a')]===_0xe853('0x19');var _0x2a98fa=_0x41c489[_0xe853('0x1b')];var _0x30d868=_0x11e4a0?0x0:_0x3840b5[_0xe853('0x18')];var _0x459007=_0x11e4a0?_0x41c489[_0xe853('0x1b')]:_0x3840b5[_0xe853('0x18')]+_0x3840b5[_0xe853('0x1a')];var _0x5f45cf;if(_0x459007>=_0x2a98fa){_0x459007=_0x2a98fa;_0x5f45cf=0xc8;}else{_0x5f45cf=0xce;}_0x156940[_0xe853('0x16')](_0x5f45cf);return _0x156940[_0xe853('0x1c')](_0xe853('0x1d'),_0x30d868+'-'+_0x459007+'/'+_0x2a98fa)[_0xe853('0x1e')](_0x41c489);}return null;};}function patchUpdates(_0x3cd77f){return function(_0x1ade8a){try{jsonpatch[_0xe853('0x1f')](_0x1ade8a,_0x3cd77f,!![]);}catch(_0x3d9e77){return BPromise[_0xe853('0x20')](_0x3d9e77);}return _0x1ade8a[_0xe853('0x21')]();};}function saveUpdates(_0x163b62,_0x4d895e){return function(_0x110362){if(_0x110362){return _0x110362[_0xe853('0x22')](_0x163b62)[_0xe853('0x23')](function(_0x209049){return _0x209049;});}return null;};}function removeEntity(_0x1af209,_0xc875b2){return function(_0x3fa0e3){if(_0x3fa0e3){return _0x3fa0e3[_0xe853('0x24')]()['then'](function(){_0x1af209[_0xe853('0x16')](0xcc)[_0xe853('0x17')]();});}};}function handleEntityNotFound(_0x198895,_0x2cb2f1){return function(_0x105ce2){if(!_0x105ce2){_0x198895['sendStatus'](0x194);}return _0x105ce2;};}function handleError(_0x1fdaaf,_0x33e0b0){_0x33e0b0=_0x33e0b0||0x1f4;return function(_0x49d8ed){logger[_0xe853('0x25')](_0x49d8ed['stack']);if(_0x49d8ed[_0xe853('0x26')]){delete _0x49d8ed['name'];}_0x1fdaaf['status'](_0x33e0b0)[_0xe853('0x27')](_0x49d8ed);};}exports[_0xe853('0x28')]=function(_0x438b5b,_0x5d268f){var _0x397301={},_0x1e99c8={},_0x15db55={'count':0x0,'rows':[]};var _0x7f858c=_[_0xe853('0x29')](db[_0xe853('0x2a')][_0xe853('0x2b')],function(_0x5d4876){return{'name':_0x5d4876[_0xe853('0x2c')],'type':_0x5d4876[_0xe853('0x2d')]['key']};});_0x1e99c8[_0xe853('0x2e')]=_['map'](_0x7f858c,_0xe853('0x26'));_0x1e99c8[_0xe853('0x2f')]=_[_0xe853('0x30')](_0x438b5b['query']);_0x1e99c8[_0xe853('0x31')]=_[_0xe853('0x32')](_0x1e99c8[_0xe853('0x2e')],_0x1e99c8[_0xe853('0x2f')]);_0x397301[_0xe853('0x33')]=_[_0xe853('0x32')](_0x1e99c8[_0xe853('0x2e')],qs[_0xe853('0x34')](_0x438b5b[_0xe853('0x2f')][_0xe853('0x34')]));_0x397301[_0xe853('0x33')]=_0x397301['attributes'][_0xe853('0x35')]?_0x397301['attributes']:_0x1e99c8[_0xe853('0x2e')];if(!_0x438b5b[_0xe853('0x2f')][_0xe853('0x36')](_0xe853('0x37'))){_0x397301['limit']=qs[_0xe853('0x1a')](_0x438b5b[_0xe853('0x2f')][_0xe853('0x1a')]);_0x397301[_0xe853('0x18')]=qs[_0xe853('0x18')](_0x438b5b[_0xe853('0x2f')]['offset']);}_0x397301[_0xe853('0x38')]=qs[_0xe853('0x39')](_0x438b5b[_0xe853('0x2f')][_0xe853('0x39')]);_0x397301[_0xe853('0x3a')]=qs[_0xe853('0x31')](_[_0xe853('0x3b')](_0x438b5b[_0xe853('0x2f')],_0x1e99c8[_0xe853('0x31')]),_0x7f858c);if(_0x438b5b['query']['filter']){_0x397301[_0xe853('0x3a')]=_[_0xe853('0x3c')](_0x397301[_0xe853('0x3a')],{'$or':_['map'](_0x7f858c,function(_0x1ed61e){if(_0x1ed61e['type']!=='VIRTUAL'){var _0x4af4fc={};_0x4af4fc[_0x1ed61e[_0xe853('0x26')]]={'$like':'%'+_0x438b5b[_0xe853('0x2f')][_0xe853('0x3d')]+'%'};return _0x4af4fc;}})});}_0x397301=_['merge']({},_0x397301,_0x438b5b[_0xe853('0x3e')]);var _0x1c0696={'where':_0x397301[_0xe853('0x3a')]};return db[_0xe853('0x2a')][_0xe853('0x1b')](_0x1c0696)[_0xe853('0x23')](function(_0x54884d){_0x15db55['count']=_0x54884d;if(_0x438b5b[_0xe853('0x2f')]['includeAll']){_0x397301[_0xe853('0x3f')]=[{'all':!![]}];}return db[_0xe853('0x2a')][_0xe853('0x40')](_0x397301);})[_0xe853('0x23')](function(_0x1c6cc2){_0x15db55[_0xe853('0x41')]=_0x1c6cc2;return _0x15db55;})[_0xe853('0x23')](respondWithFilteredResult(_0x5d268f,_0x397301))['catch'](handleError(_0x5d268f,null));};exports[_0xe853('0x42')]=function(_0x2f97fe,_0x17662e){var _0x4c50d5={'raw':!![],'where':{'id':_0x2f97fe[_0xe853('0x43')]['id']}},_0x14fa6a={};_0x14fa6a['model']=_[_0xe853('0x30')](db[_0xe853('0x2a')]['rawAttributes']);_0x14fa6a[_0xe853('0x2f')]=_[_0xe853('0x30')](_0x2f97fe[_0xe853('0x2f')]);_0x14fa6a[_0xe853('0x31')]=_['intersection'](_0x14fa6a[_0xe853('0x2e')],_0x14fa6a['query']);_0x4c50d5[_0xe853('0x33')]=_[_0xe853('0x32')](_0x14fa6a[_0xe853('0x2e')],qs['fields'](_0x2f97fe[_0xe853('0x2f')][_0xe853('0x34')]));_0x4c50d5['attributes']=_0x4c50d5[_0xe853('0x33')]['length']?_0x4c50d5[_0xe853('0x33')]:_0x14fa6a[_0xe853('0x2e')];if(_0x2f97fe[_0xe853('0x2f')][_0xe853('0x44')]){_0x4c50d5['include']=[{'all':!![]}];}_0x4c50d5=_['merge']({},_0x4c50d5,_0x2f97fe[_0xe853('0x3e')]);return db[_0xe853('0x2a')]['find'](_0x4c50d5)[_0xe853('0x23')](handleEntityNotFound(_0x17662e,null))[_0xe853('0x23')](respondWithResult(_0x17662e,null))['catch'](handleError(_0x17662e,null));};exports['create']=function(_0x230d53,_0x21f5e4){return db[_0xe853('0x2a')][_0xe853('0x45')](_0x230d53[_0xe853('0x46')],{})[_0xe853('0x23')](respondWithResult(_0x21f5e4,0xc9))[_0xe853('0x47')](handleError(_0x21f5e4,null));};exports[_0xe853('0x22')]=function(_0x1f07f6,_0x276c62){if(_0x1f07f6['body']['id']){delete _0x1f07f6['body']['id'];}return db[_0xe853('0x2a')][_0xe853('0x48')]({'where':{'id':_0x1f07f6['params']['id']}})[_0xe853('0x23')](handleEntityNotFound(_0x276c62,null))[_0xe853('0x23')](saveUpdates(_0x1f07f6['body'],null))[_0xe853('0x23')](respondWithResult(_0x276c62,null))[_0xe853('0x47')](handleError(_0x276c62,null));};exports[_0xe853('0x24')]=function(_0x5eeb43,_0x42f38a){return db[_0xe853('0x2a')]['find']({'where':{'id':_0x5eeb43[_0xe853('0x43')]['id']}})[_0xe853('0x23')](handleEntityNotFound(_0x42f38a,null))[_0xe853('0x23')](removeEntity(_0x42f38a,null))[_0xe853('0x47')](handleError(_0x42f38a,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 41facac..9efa036 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 _0x0e34=['define','int_desk_fields','desk_unique_index','lodash','api','moment','bluebird','request-promise','path','rimraf','./intDeskField.attributes','exports'];(function(_0x42a8c0,_0x36c472){var _0x426d7b=function(_0x71cca2){while(--_0x71cca2){_0x42a8c0['push'](_0x42a8c0['shift']());}};_0x426d7b(++_0x36c472);}(_0x0e34,0xab));var _0x40e3=function(_0x3f0474,_0xb79c2e){_0x3f0474=_0x3f0474-0x0;var _0x7b9b05=_0x0e34[_0x3f0474];return _0x7b9b05;};'use strict';var _=require(_0x40e3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x40e3('0x1'));var moment=require(_0x40e3('0x2'));var BPromise=require(_0x40e3('0x3'));var rp=require(_0x40e3('0x4'));var fs=require('fs');var path=require(_0x40e3('0x5'));var rimraf=require(_0x40e3('0x6'));var config=require('../../config/environment');var attributes=require(_0x40e3('0x7'));module[_0x40e3('0x8')]=function(_0x12d1bf,_0x1bffbb){return _0x12d1bf[_0x40e3('0x9')]('DeskField',attributes,{'tableName':_0x40e3('0xa'),'paranoid':![],'indexes':[{'name':_0x40e3('0xb'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfb7e=['api','moment','bluebird','./intDeskField.attributes','define','DeskField','int_desk_fields','desk_unique_index','FieldId','util'];(function(_0x4fda04,_0x503892){var _0x1d98f9=function(_0x48ba82){while(--_0x48ba82){_0x4fda04['push'](_0x4fda04['shift']());}};_0x1d98f9(++_0x503892);}(_0xfb7e,0xef));var _0xefb7=function(_0x2dfdb8,_0x2367ce){_0x2dfdb8=_0x2dfdb8-0x0;var _0x131797=_0xfb7e[_0x2dfdb8];return _0x131797;};'use strict';var _=require('lodash');var util=require(_0xefb7('0x0'));var logger=require('../../config/logger')(_0xefb7('0x1'));var moment=require(_0xefb7('0x2'));var BPromise=require(_0xefb7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xefb7('0x4'));module['exports']=function(_0x5ed0d1,_0x57f3ff){return _0x5ed0d1[_0xefb7('0x5')](_0xefb7('0x6'),attributes,{'tableName':_0xefb7('0x7'),'paranoid':![],'indexes':[{'name':_0xefb7('0x8'),'fields':['idField',_0xefb7('0x9')],'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 8960dc3..1d6b177 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 _0xdf7c=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird'];(function(_0x1f5890,_0x599bd3){var _0x5dde01=function(_0x59bcb2){while(--_0x59bcb2){_0x1f5890['push'](_0x1f5890['shift']());}};_0x5dde01(++_0x599bd3);}(_0xdf7c,0x179));var _0xcdf7=function(_0x22b8a3,_0x2a79a7){_0x22b8a3=_0x22b8a3-0x0;var _0x199a0c=_0xdf7c[_0x22b8a3];return _0x199a0c;};'use strict';var _=require('lodash');var util=require(_0xcdf7('0x0'));var moment=require(_0xcdf7('0x1'));var BPromise=require(_0xcdf7('0x2'));var rs=require(_0xcdf7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcdf7('0x4'));var logger=require(_0xcdf7('0x5'))(_0xcdf7('0x6'));var config=require(_0xcdf7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xcdf7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23a6f2,_0x311484,_0x3e2c5e){return new BPromise(function(_0x10919a,_0x547503){return client[_0xcdf7('0x9')](_0x23a6f2,_0x3e2c5e)['then'](function(_0x27c3de){logger[_0xcdf7('0xa')](_0xcdf7('0xb'),_0x311484,_0xcdf7('0xc'));logger[_0xcdf7('0xd')](_0xcdf7('0xe'),_0x311484,'request\x20sent',JSON[_0xcdf7('0xf')](_0x27c3de));if(_0x27c3de[_0xcdf7('0x10')]){if(_0x27c3de[_0xcdf7('0x10')][_0xcdf7('0x11')]===0x1f4){logger['error'](_0xcdf7('0xb'),_0x311484,_0x27c3de[_0xcdf7('0x10')][_0xcdf7('0x12')]);return _0x547503(_0x27c3de['error'][_0xcdf7('0x12')]);}logger[_0xcdf7('0x10')](_0xcdf7('0xb'),_0x311484,_0x27c3de[_0xcdf7('0x10')]['message']);return _0x10919a(_0x27c3de[_0xcdf7('0x10')]['message']);}else{logger[_0xcdf7('0xa')](_0xcdf7('0xb'),_0x311484,'request\x20sent');_0x10919a(_0x27c3de['result'][_0xcdf7('0x12')]);}})['catch'](function(_0x17288e){logger['error'](_0xcdf7('0xb'),_0x311484,_0x17288e);_0x547503(_0x17288e);});});} \ No newline at end of file +var _0xadca=['DeskField,\x20%s,\x20%s','message','result','catch','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x5045f3,_0x9084e1){var _0x867321=function(_0x17f342){while(--_0x17f342){_0x5045f3['push'](_0x5045f3['shift']());}};_0x867321(++_0x9084e1);}(_0xadca,0x138));var _0xaadc=function(_0x545150,_0x2c2b6c){_0x545150=_0x545150-0x0;var _0xff7fd6=_0xadca[_0x545150];return _0xff7fd6;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xaadc('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaadc('0x1'))['db'];var utils=require(_0xaadc('0x2'));var logger=require(_0xaadc('0x3'))(_0xaadc('0x4'));var config=require(_0xaadc('0x5'));var jayson=require(_0xaadc('0x6'));var client=jayson[_0xaadc('0x7')][_0xaadc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2ebc80,_0x5b413d,_0x84499f){return new BPromise(function(_0x57a2f1,_0x47750f){return client[_0xaadc('0x9')](_0x2ebc80,_0x84499f)[_0xaadc('0xa')](function(_0x222a11){logger[_0xaadc('0xb')]('DeskField,\x20%s,\x20%s',_0x5b413d,'request\x20sent');logger[_0xaadc('0xc')](_0xaadc('0xd'),_0x5b413d,_0xaadc('0xe'),JSON[_0xaadc('0xf')](_0x222a11));if(_0x222a11[_0xaadc('0x10')]){if(_0x222a11[_0xaadc('0x10')][_0xaadc('0x11')]===0x1f4){logger[_0xaadc('0x10')](_0xaadc('0x12'),_0x5b413d,_0x222a11[_0xaadc('0x10')][_0xaadc('0x13')]);return _0x47750f(_0x222a11['error'][_0xaadc('0x13')]);}logger['error'](_0xaadc('0x12'),_0x5b413d,_0x222a11[_0xaadc('0x10')][_0xaadc('0x13')]);return _0x57a2f1(_0x222a11['error'][_0xaadc('0x13')]);}else{logger[_0xaadc('0xb')]('DeskField,\x20%s,\x20%s',_0x5b413d,_0xaadc('0xe'));_0x57a2f1(_0x222a11[_0xaadc('0x14')][_0xaadc('0x13')]);}})[_0xaadc('0x15')](function(_0x5e2622){logger[_0xaadc('0x10')](_0xaadc('0x12'),_0x5b413d,_0x5e2622);_0x47750f(_0x5e2622);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 01cb30d..13f7411 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 _0xd752=['../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','/:id','update','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x4d704e,_0x256541){var _0x16dbb1=function(_0x42d65a){while(--_0x42d65a){_0x4d704e['push'](_0x4d704e['shift']());}};_0x16dbb1(++_0x256541);}(_0xd752,0xa9));var _0x2d75=function(_0x46a59e,_0x4bf9ff){_0x46a59e=_0x46a59e-0x0;var _0x35aae0=_0xd752[_0x46a59e];return _0x35aae0;};'use strict';var multer=require(_0x2d75('0x0'));var util=require(_0x2d75('0x1'));var path=require('path');var timeout=require(_0x2d75('0x2'));var express=require(_0x2d75('0x3'));var router=express[_0x2d75('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2d75('0x5'));var interaction=require(_0x2d75('0x6'));var config=require(_0x2d75('0x7'));var controller=require(_0x2d75('0x8'));router[_0x2d75('0x9')]('/',auth[_0x2d75('0xa')](),controller[_0x2d75('0xb')]);router[_0x2d75('0x9')]('/:id',auth[_0x2d75('0xa')](),controller[_0x2d75('0xc')]);router['get']('/:id/configurations',auth[_0x2d75('0xa')](),controller[_0x2d75('0xd')]);router[_0x2d75('0x9')](_0x2d75('0xe'),auth[_0x2d75('0xa')](),controller[_0x2d75('0xf')]);router[_0x2d75('0x10')]('/',auth[_0x2d75('0xa')](),controller[_0x2d75('0x11')]);router[_0x2d75('0x10')](_0x2d75('0x12'),auth[_0x2d75('0xa')](),controller[_0x2d75('0x13')]);router[_0x2d75('0x14')](_0x2d75('0x15'),auth[_0x2d75('0xa')](),controller[_0x2d75('0x16')]);router['delete'](_0x2d75('0x15'),auth[_0x2d75('0xa')](),controller[_0x2d75('0x17')]);module[_0x2d75('0x18')]=router; \ No newline at end of file +var _0x38d8=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','index','/:id','/:id/configurations','isAuthenticated','/:id/fields','getFields','post','put','update','delete'];(function(_0x5b004f,_0xd4d052){var _0x3b42b3=function(_0x2f727f){while(--_0x2f727f){_0x5b004f['push'](_0x5b004f['shift']());}};_0x3b42b3(++_0xd4d052);}(_0x38d8,0xe8));var _0x838d=function(_0x4b03c9,_0x17ce03){_0x4b03c9=_0x4b03c9-0x0;var _0x161ba2=_0x38d8[_0x4b03c9];return _0x161ba2;};'use strict';var multer=require(_0x838d('0x0'));var util=require('util');var path=require(_0x838d('0x1'));var timeout=require(_0x838d('0x2'));var express=require(_0x838d('0x3'));var router=express[_0x838d('0x4')]();var fs_extra=require(_0x838d('0x5'));var auth=require(_0x838d('0x6'));var interaction=require(_0x838d('0x7'));var config=require(_0x838d('0x8'));var controller=require(_0x838d('0x9'));router[_0x838d('0xa')]('/',auth['isAuthenticated'](),controller[_0x838d('0xb')]);router[_0x838d('0xa')](_0x838d('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x838d('0xa')](_0x838d('0xd'),auth[_0x838d('0xe')](),controller['getConfigurations']);router['get'](_0x838d('0xf'),auth['isAuthenticated'](),controller[_0x838d('0x10')]);router[_0x838d('0x11')]('/',auth[_0x838d('0xe')](),controller['create']);router[_0x838d('0x11')](_0x838d('0xd'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x838d('0x12')](_0x838d('0xc'),auth[_0x838d('0xe')](),controller[_0x838d('0x13')]);router[_0x838d('0x14')](_0x838d('0xc'),auth[_0x838d('0xe')](),controller[_0x838d('0x15')]);module[_0x838d('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index d658846..ea0f281 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 _0x6ce7=['STRING','sequelize','exports'];(function(_0x2382bb,_0x3552e9){var _0x25c761=function(_0x469456){while(--_0x469456){_0x2382bb['push'](_0x2382bb['shift']());}};_0x25c761(++_0x3552e9);}(_0x6ce7,0x76));var _0x76ce=function(_0x406aa9,_0x47a602){_0x406aa9=_0x406aa9-0x0;var _0x1848f5=_0x6ce7[_0x406aa9];return _0x1848f5;};'use strict';var Sequelize=require(_0x76ce('0x0'));module[_0x76ce('0x1')]={'name':{'type':Sequelize[_0x76ce('0x2')]},'username':{'type':Sequelize[_0x76ce('0x2')]},'password':{'type':Sequelize[_0x76ce('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x76ce('0x2')]},'clientId':{'type':Sequelize[_0x76ce('0x2')]},'clientSecret':{'type':Sequelize[_0x76ce('0x2')]},'serverUrl':{'type':Sequelize[_0x76ce('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4024=['exports','STRING','sequelize'];(function(_0x51ad8d,_0x1e8365){var _0x20b3f2=function(_0x58dcf6){while(--_0x58dcf6){_0x51ad8d['push'](_0x51ad8d['shift']());}};_0x20b3f2(++_0x1e8365);}(_0x4024,0x152));var _0x4402=function(_0x173043,_0x209e6e){_0x173043=_0x173043-0x0;var _0x3354ae=_0x4024[_0x173043];return _0x3354ae;};'use strict';var Sequelize=require(_0x4402('0x0'));module[_0x4402('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x4402('0x2')]},'password':{'type':Sequelize[_0x4402('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x4402('0x2')]},'clientSecret':{'type':Sequelize[_0x4402('0x2')]},'serverUrl':{'type':Sequelize[_0x4402('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x4402('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 7e3bdd5..85342b0 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 _0x3140=['../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','stack','send','Dynamics365Account','rawAttributes','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','filter','merge','includeAll','include','rows','catch','show','params','keys','options','create','body','find','getConfigurations','findOne','Dynamics365Configuration','sort','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','ticketType','incident','PhoneCall','customerid','ownerid','caseorigincode','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','parentcaseidname','primarycontactidyominame','productserialnumber','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','slaname','statecode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','concat','username','password','remoteUri','tenantId','clientSecret','substring','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','clientId','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','MetadataId','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','Attributes','includes','forEach','@odata.type','lastIndexOf','PicklistAttributeMetadata','isNil','BooleanAttributeMetadata','push','all','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Options','Label','UserLocalizedLabel','Value','LogicalName','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x4e9749,_0x2ddac7){var _0x3cfc03=function(_0x420d0e){while(--_0x420d0e){_0x4e9749['push'](_0x4e9749['shift']());}};_0x3cfc03(++_0x2ddac7);}(_0x3140,0xaf));var _0x0314=function(_0x478708,_0x816b6c){_0x478708=_0x478708-0x0;var _0x5c4bf0=_0x3140[_0x478708];return _0x5c4bf0;};'use strict';var emlformat=require(_0x0314('0x0'));var rimraf=require(_0x0314('0x1'));var zipdir=require(_0x0314('0x2'));var jsonpatch=require(_0x0314('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0314('0x4'));var Mustache=require(_0x0314('0x5'));var util=require(_0x0314('0x6'));var path=require(_0x0314('0x7'));var sox=require(_0x0314('0x8'));var csv=require(_0x0314('0x9'));var ejs=require(_0x0314('0xa'));var fs=require('fs');var fs_extra=require(_0x0314('0xb'));var _=require(_0x0314('0xc'));var squel=require(_0x0314('0xd'));var crypto=require(_0x0314('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0314('0xf'));var toCsv=require(_0x0314('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0314('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0314('0x11'));var as=require(_0x0314('0x12'));var hardwareService=require(_0x0314('0x13'));var logger=require(_0x0314('0x14'))(_0x0314('0x15'));var utils=require(_0x0314('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0314('0x17'));var db=require(_0x0314('0x18'))['db'];var integrations=require(_0x0314('0x19'));function respondWithStatusCode(_0x4602ec,_0x153077){_0x153077=_0x153077||0xcc;return function(_0x4318d6){if(_0x4318d6){return _0x4602ec[_0x0314('0x1a')](_0x153077);}return _0x4602ec['status'](_0x153077)[_0x0314('0x1b')]();};}function respondWithResult(_0xbe0b07,_0x1316a0){_0x1316a0=_0x1316a0||0xc8;return function(_0x12d026){if(_0x12d026){return _0xbe0b07[_0x0314('0x1c')](_0x1316a0)[_0x0314('0x1d')](_0x12d026);}};}function respondWithFilteredResult(_0x413bfa,_0x3ea356){return function(_0x5e460f){if(_0x5e460f){var _0xb9730b=typeof _0x3ea356[_0x0314('0x1e')]===_0x0314('0x1f')&&typeof _0x3ea356['limit']===_0x0314('0x1f');var _0x5f2e82=_0x5e460f['count'];var _0x39db0b=_0xb9730b?0x0:_0x3ea356[_0x0314('0x1e')];var _0x583d39=_0xb9730b?_0x5e460f[_0x0314('0x20')]:_0x3ea356[_0x0314('0x1e')]+_0x3ea356['limit'];var _0x1a25cf;if(_0x583d39>=_0x5f2e82){_0x583d39=_0x5f2e82;_0x1a25cf=0xc8;}else{_0x1a25cf=0xce;}_0x413bfa['status'](_0x1a25cf);return _0x413bfa[_0x0314('0x21')](_0x0314('0x22'),_0x39db0b+'-'+_0x583d39+'/'+_0x5f2e82)[_0x0314('0x1d')](_0x5e460f);}return null;};}function patchUpdates(_0x77ddfd){return function(_0x3bdb1){try{jsonpatch[_0x0314('0x23')](_0x3bdb1,_0x77ddfd,!![]);}catch(_0x4d3bc6){return BPromise['reject'](_0x4d3bc6);}return _0x3bdb1[_0x0314('0x24')]();};}function saveUpdates(_0xbd3ad0,_0x1945f8){return function(_0x174119){if(_0x174119){return _0x174119[_0x0314('0x25')](_0xbd3ad0)[_0x0314('0x26')](function(_0x58a1c9){return _0x58a1c9;});}return null;};}function removeEntity(_0x3c743e,_0x43fb0e){return function(_0x590e94){if(_0x590e94){return _0x590e94[_0x0314('0x27')]()[_0x0314('0x26')](function(){_0x3c743e[_0x0314('0x1c')](0xcc)[_0x0314('0x1b')]();});}};}function handleEntityNotFound(_0x867cf7,_0x3af9d3){return function(_0x5d5b13){if(!_0x5d5b13){_0x867cf7[_0x0314('0x1a')](0x194);}return _0x5d5b13;};}function handleError(_0x2e0c77,_0x2d636b){_0x2d636b=_0x2d636b||0x1f4;return function(_0x47c2d1){logger[_0x0314('0x28')](_0x47c2d1[_0x0314('0x29')]);if(_0x47c2d1['name']){delete _0x47c2d1['name'];}_0x2e0c77[_0x0314('0x1c')](_0x2d636b)[_0x0314('0x2a')](_0x47c2d1);};}exports['index']=function(_0x1c3dfd,_0x288535){var _0x5291c2={},_0x547ab3={},_0x15fbfb={'count':0x0,'rows':[]};var _0x345cef=_['map'](db[_0x0314('0x2b')][_0x0314('0x2c')],function(_0x3d6652){return{'name':_0x3d6652['fieldName'],'type':_0x3d6652[_0x0314('0x2d')][_0x0314('0x2e')]};});_0x547ab3[_0x0314('0x2f')]=_[_0x0314('0x30')](_0x345cef,'name');_0x547ab3[_0x0314('0x31')]=_['keys'](_0x1c3dfd['query']);_0x547ab3[_0x0314('0x32')]=_[_0x0314('0x33')](_0x547ab3[_0x0314('0x2f')],_0x547ab3['query']);_0x5291c2[_0x0314('0x34')]=_['intersection'](_0x547ab3[_0x0314('0x2f')],qs['fields'](_0x1c3dfd['query'][_0x0314('0x35')]));_0x5291c2['attributes']=_0x5291c2[_0x0314('0x34')][_0x0314('0x36')]?_0x5291c2[_0x0314('0x34')]:_0x547ab3[_0x0314('0x2f')];if(!_0x1c3dfd[_0x0314('0x31')][_0x0314('0x37')](_0x0314('0x38'))){_0x5291c2['limit']=qs[_0x0314('0x39')](_0x1c3dfd[_0x0314('0x31')][_0x0314('0x39')]);_0x5291c2[_0x0314('0x1e')]=qs[_0x0314('0x1e')](_0x1c3dfd[_0x0314('0x31')]['offset']);}_0x5291c2[_0x0314('0x3a')]=qs['sort'](_0x1c3dfd[_0x0314('0x31')]['sort']);_0x5291c2[_0x0314('0x3b')]=qs['filters'](_['pick'](_0x1c3dfd['query'],_0x547ab3[_0x0314('0x32')]),_0x345cef);if(_0x1c3dfd[_0x0314('0x31')][_0x0314('0x3c')]){_0x5291c2[_0x0314('0x3b')]=_[_0x0314('0x3d')](_0x5291c2['where'],{'$or':_[_0x0314('0x30')](_0x345cef,function(_0x2457b4){if(_0x2457b4[_0x0314('0x2d')]!=='VIRTUAL'){var _0x273f2c={};_0x273f2c[_0x2457b4['name']]={'$like':'%'+_0x1c3dfd[_0x0314('0x31')]['filter']+'%'};return _0x273f2c;}})});}_0x5291c2=_[_0x0314('0x3d')]({},_0x5291c2,_0x1c3dfd['options']);var _0x57c748={'where':_0x5291c2[_0x0314('0x3b')]};return db[_0x0314('0x2b')]['count'](_0x57c748)[_0x0314('0x26')](function(_0x522055){_0x15fbfb[_0x0314('0x20')]=_0x522055;if(_0x1c3dfd[_0x0314('0x31')][_0x0314('0x3e')]){_0x5291c2[_0x0314('0x3f')]=[{'all':!![]}];}return db[_0x0314('0x2b')]['findAll'](_0x5291c2);})[_0x0314('0x26')](function(_0x37c07e){_0x15fbfb[_0x0314('0x40')]=_0x37c07e;return _0x15fbfb;})['then'](respondWithFilteredResult(_0x288535,_0x5291c2))[_0x0314('0x41')](handleError(_0x288535,null));};exports[_0x0314('0x42')]=function(_0x47525f,_0x599473){var _0x2b328c={'raw':![],'where':{'id':_0x47525f[_0x0314('0x43')]['id']}},_0x596216={};_0x596216[_0x0314('0x2f')]=_[_0x0314('0x44')](db['Dynamics365Account'][_0x0314('0x2c')]);_0x596216[_0x0314('0x31')]=_['keys'](_0x47525f['query']);_0x596216['filters']=_[_0x0314('0x33')](_0x596216[_0x0314('0x2f')],_0x596216[_0x0314('0x31')]);_0x2b328c['attributes']=_[_0x0314('0x33')](_0x596216[_0x0314('0x2f')],qs[_0x0314('0x35')](_0x47525f[_0x0314('0x31')][_0x0314('0x35')]));_0x2b328c['attributes']=_0x2b328c[_0x0314('0x34')][_0x0314('0x36')]?_0x2b328c[_0x0314('0x34')]:_0x596216[_0x0314('0x2f')];if(_0x47525f[_0x0314('0x31')][_0x0314('0x3e')]){_0x2b328c[_0x0314('0x3f')]=[{'all':!![]}];}_0x2b328c=_['merge']({},_0x2b328c,_0x47525f[_0x0314('0x45')]);return db[_0x0314('0x2b')]['find'](_0x2b328c)[_0x0314('0x26')](handleEntityNotFound(_0x599473,null))[_0x0314('0x26')](respondWithResult(_0x599473,null))[_0x0314('0x41')](handleError(_0x599473,null));};exports['create']=function(_0x4a1850,_0x128889){return db[_0x0314('0x2b')][_0x0314('0x46')](_0x4a1850[_0x0314('0x47')],{})[_0x0314('0x26')](respondWithResult(_0x128889,0xc9))[_0x0314('0x41')](handleError(_0x128889,null));};exports[_0x0314('0x25')]=function(_0x478b8b,_0x3fc699){if(_0x478b8b['body']['id']){delete _0x478b8b[_0x0314('0x47')]['id'];}return db[_0x0314('0x2b')][_0x0314('0x48')]({'where':{'id':_0x478b8b[_0x0314('0x43')]['id']}})[_0x0314('0x26')](handleEntityNotFound(_0x3fc699,null))['then'](saveUpdates(_0x478b8b['body'],null))[_0x0314('0x26')](respondWithResult(_0x3fc699,null))[_0x0314('0x41')](handleError(_0x3fc699,null));};exports[_0x0314('0x27')]=function(_0x26ecb7,_0x5b3c49){return db[_0x0314('0x2b')][_0x0314('0x48')]({'where':{'id':_0x26ecb7[_0x0314('0x43')]['id']}})[_0x0314('0x26')](handleEntityNotFound(_0x5b3c49,null))[_0x0314('0x26')](removeEntity(_0x5b3c49,null))[_0x0314('0x41')](handleError(_0x5b3c49,null));};exports[_0x0314('0x49')]=function(_0x55f806,_0x28ca8f,_0x9d4b1e){var _0x2fed7d={};var _0x577a91={};var _0x123916;var _0x11695d;return db['Dynamics365Account'][_0x0314('0x4a')]({'where':{'id':_0x55f806[_0x0314('0x43')]['id']}})[_0x0314('0x26')](handleEntityNotFound(_0x28ca8f,null))[_0x0314('0x26')](function(_0x544a03){if(_0x544a03){_0x123916=_0x544a03;_0x577a91[_0x0314('0x2f')]=_[_0x0314('0x44')](db[_0x0314('0x4b')][_0x0314('0x2c')]);_0x577a91[_0x0314('0x31')]=_[_0x0314('0x44')](_0x55f806[_0x0314('0x31')]);_0x577a91[_0x0314('0x32')]=_[_0x0314('0x33')](_0x577a91[_0x0314('0x2f')],_0x577a91['query']);_0x2fed7d[_0x0314('0x34')]=_[_0x0314('0x33')](_0x577a91[_0x0314('0x2f')],qs[_0x0314('0x35')](_0x55f806[_0x0314('0x31')][_0x0314('0x35')]));_0x2fed7d[_0x0314('0x34')]=_0x2fed7d['attributes']['length']?_0x2fed7d['attributes']:_0x577a91[_0x0314('0x2f')];_0x2fed7d[_0x0314('0x3a')]=qs['sort'](_0x55f806[_0x0314('0x31')][_0x0314('0x4c')]);_0x2fed7d[_0x0314('0x3b')]=qs['filters'](_['pick'](_0x55f806[_0x0314('0x31')],_0x577a91[_0x0314('0x32')]));if(_0x55f806['query'][_0x0314('0x3c')]){_0x2fed7d['where']=_[_0x0314('0x3d')](_0x2fed7d[_0x0314('0x3b')],{'$or':_[_0x0314('0x30')](_0x2fed7d[_0x0314('0x34')],function(_0x4c4420){var _0x9c35f1={};_0x9c35f1[_0x4c4420]={'$like':'%'+_0x55f806[_0x0314('0x31')][_0x0314('0x3c')]+'%'};return _0x9c35f1;})});}_0x2fed7d=_['merge']({},_0x2fed7d,_0x55f806[_0x0314('0x45')]);return _0x123916[_0x0314('0x49')](_0x2fed7d);}})[_0x0314('0x26')](function(_0x1ed23a){if(_0x1ed23a){_0x11695d=_0x1ed23a[_0x0314('0x36')];if(!_0x55f806[_0x0314('0x31')][_0x0314('0x37')]('nolimit')){_0x2fed7d[_0x0314('0x39')]=qs['limit'](_0x55f806['query'][_0x0314('0x39')]);_0x2fed7d['offset']=qs[_0x0314('0x1e')](_0x55f806[_0x0314('0x31')][_0x0314('0x1e')]);}return _0x123916[_0x0314('0x49')](_0x2fed7d);}})[_0x0314('0x26')](function(_0x308985){if(_0x308985){return _0x308985?{'count':_0x11695d,'rows':_0x308985}:null;}})[_0x0314('0x26')](respondWithResult(_0x28ca8f,null))[_0x0314('0x41')](handleError(_0x28ca8f,null));};exports['addConfiguration']=function(_0x545bd8,_0x524fce,_0x277979){if(_0x545bd8[_0x0314('0x47')]['id']){delete _0x545bd8['body']['id'];}return db['Dynamics365Account']['findOne']({'where':{'id':_0x545bd8[_0x0314('0x43')]['id']}})[_0x0314('0x26')](handleEntityNotFound(_0x524fce,null))['then'](function(_0x273dc6){if(_0x273dc6){_0x545bd8[_0x0314('0x47')][_0x0314('0x4d')]=_0x273dc6['id'];_0x545bd8[_0x0314('0x47')][_0x0314('0x4e')]=integrations[_0x0314('0x4f')](_0x545bd8['body'][_0x0314('0x50')],_0x545bd8[_0x0314('0x47')][_0x0314('0x2d')]);_0x545bd8['body'][_0x0314('0x51')]=integrations[_0x0314('0x52')](_0x545bd8[_0x0314('0x47')]['channel'],_0x545bd8[_0x0314('0x47')][_0x0314('0x2d')]);return db['Dynamics365Configuration'][_0x0314('0x46')](_0x545bd8[_0x0314('0x47')],{'include':[{'model':db[_0x0314('0x53')],'as':_0x0314('0x4e')},{'model':db[_0x0314('0x53')],'as':'Descriptions'}]});}return null;})[_0x0314('0x26')](respondWithResult(_0x524fce,null))[_0x0314('0x41')](handleError(_0x524fce,null));};exports['getFields']=function(_0x58f666,_0x186dde,_0x381a5d){var _0x30726f=_0x58f666[_0x0314('0x31')][_0x0314('0x54')];var _0x2bcaf5=_0x30726f===_0x0314('0x55')?'Incident':_0x0314('0x56');var _0x1b6cc5='';var _0x1cbdd7='';var _0x11fb3f='';var _0x5d990c='';var _0xfc1bbe='';var _0x10c942='';var _0x576190='';var _0xf38fa4='';var _0x24a6a5=['title','description',_0x0314('0x57'),_0x0314('0x58'),_0x0314('0x59'),'subject','phonenumber',_0x0314('0x5a'),_0x0314('0x5b'),_0x0314('0x5c')];var _0xd5c054=[_0x0314('0x5d'),'accountidyominame',_0x0314('0x5e'),_0x0314('0x5f'),_0x0314('0x60'),_0x0314('0x61'),_0x0314('0x62'),_0x0314('0x63'),_0x0314('0x64'),_0x0314('0x65'),_0x0314('0x66'),'createdbyyominame',_0x0314('0x67'),_0x0314('0x68'),_0x0314('0x69'),_0x0314('0x6a'),_0x0314('0x6b'),_0x0314('0x6c'),_0x0314('0x6d'),_0x0314('0x6e'),_0x0314('0x6f'),_0x0314('0x70'),_0x0314('0x71'),'exchangerate',_0x0314('0x72'),_0x0314('0x73'),_0x0314('0x74'),'influencescore',_0x0314('0x75'),_0x0314('0x76'),_0x0314('0x77'),_0x0314('0x78'),_0x0314('0x79'),_0x0314('0x7a'),_0x0314('0x7b'),_0x0314('0x7c'),_0x0314('0x7d'),_0x0314('0x7e'),_0x0314('0x7f'),'msdyn_iotalertname',_0x0314('0x80'),_0x0314('0x81'),_0x0314('0x82'),_0x0314('0x83'),_0x0314('0x84'),'owneridyominame',_0x0314('0x85'),'primarycontactidname',_0x0314('0x86'),'prioritycodename','productidname',_0x0314('0x87'),'resolveby',_0x0314('0x88'),_0x0314('0x89'),_0x0314('0x8a'),_0x0314('0x8b'),'sentimentvalue',_0x0314('0x8c'),_0x0314('0x8d'),'socialprofileidname',_0x0314('0x8e'),'statuscode',_0x0314('0x8f'),_0x0314('0x90'),_0x0314('0x91'),_0x0314('0x92'),_0x0314('0x93'),_0x0314('0x94'),'versionnumber'];var _0x2bd970=_0x24a6a5[_0x0314('0x95')](_0xd5c054);return db[_0x0314('0x2b')][_0x0314('0x4a')]({'where':{'id':_0x58f666[_0x0314('0x43')]['id']},'attributes':['id',_0x0314('0x96'),_0x0314('0x97'),_0x0314('0x98'),_0x0314('0x99'),'clientId',_0x0314('0x9a')]})[_0x0314('0x26')](handleEntityNotFound(_0x186dde,null))[_0x0314('0x26')](function(_0x182909){if(_0x182909){_0xf38fa4=_0x182909[_0x0314('0x98')];var _0x3c06e4=_0xf38fa4['slice'](-0x1);if(_0x3c06e4==='/'){_0xf38fa4=_0xf38fa4[_0x0314('0x9b')](0x0,_0xf38fa4['lastIndexOf'](_0x3c06e4));}_0x576190=util[_0x0314('0x9c')](_0x0314('0x9d'),_0xf38fa4);var _0x242c5a={'method':_0x0314('0x9e'),'uri':_0x0314('0x9f')+_0x182909[_0x0314('0x99')]+_0x0314('0xa0'),'form':{'client_id':_0x182909[_0x0314('0xa1')],'resource':_0xf38fa4,'username':_0x182909['username'],'password':_0x182909[_0x0314('0x97')],'grant_type':_0x0314('0x97'),'client_secret':_0x182909[_0x0314('0x9a')]},'json':!![]};return rp(_0x242c5a);}})[_0x0314('0x26')](function(_0x4c0d7e){_0x10c942=_0x4c0d7e[_0x0314('0xa2')];var _0x1a1192={'method':'GET','uri':encodeURI(_0x576190+_0x0314('0xa3')+_0x2bcaf5+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x10c942,'If-None-Match':null,'OData-Version':_0x0314('0xa4')},'json':!![]};return rp(_0x1a1192);})[_0x0314('0x26')](function(_0x4e4a44){var _0x3941e3=_0x4e4a44['value'][0x0];var _0x292bdb=_0x3941e3[_0x0314('0xa5')];var _0x914260={'method':_0x0314('0xa6'),'uri':_0x576190+_0x0314('0xa7')+_0x292bdb+_0x0314('0xa8'),'headers':{'Authorization':_0x0314('0xa9')+_0x10c942,'If-None-Match':null,'OData-Version':_0x0314('0xa4')},'json':!![]};return rp(_0x914260);})[_0x0314('0x26')](function(_0x18131e){_0x1b6cc5=_0x18131e;_0x1cbdd7=_0x1b6cc5[_0x0314('0xaa')];_0x1cbdd7=_['remove'](_0x1cbdd7,function(_0x547d8c){return!_0x2bd970[_0x0314('0xab')](_0x547d8c['LogicalName']);});var _0x2a6579=[];var _0x20589c=[];_0x1cbdd7[_0x0314('0xac')](function(_0x4e808c){if(_0x4e808c[_0x0314('0xad')]){var _0x235013=_0x4e808c[_0x0314('0xad')][_0x0314('0x9b')](_0x4e808c[_0x0314('0xad')][_0x0314('0xae')]('.')+0x1);if(_0x235013===_0x0314('0xaf')){_0x2a6579['push'](getSelectList(_0x576190,_0x30726f,_0x20589c,_0x1b6cc5[_0x0314('0xa5')],_0x4e808c['MetadataId'],_0x10c942));}}});return Promise['all'](_0x2a6579);})[_0x0314('0x26')](function(_0x3f09e8){_0x11fb3f=_0x3f09e8[0x0];var _0x2bbcbc=[];var _0x41210a=[];_0x1cbdd7[_0x0314('0xac')](function(_0x8aaa2a){if(!_[_0x0314('0xb0')](_0x8aaa2a[_0x0314('0xad')])){var _0x2b8982=_0x8aaa2a[_0x0314('0xad')][_0x0314('0x9b')](_0x8aaa2a['@odata.type'][_0x0314('0xae')]('.')+0x1);if(_0x2b8982===_0x0314('0xb1')){_0x2bbcbc[_0x0314('0xb2')](getBooleanList(_0x576190,_0x30726f,_0x41210a,_0x1b6cc5['MetadataId'],_0x8aaa2a['MetadataId'],_0x10c942));}}});return Promise[_0x0314('0xb3')](_0x2bbcbc);})['then'](function(_0x4c952e){_0x5d990c=_0x4c952e[0x0];var _0xa9774c=[];var _0x239fbd=[];_0x1cbdd7[_0x0314('0xac')](function(_0x135062){if(_0x135062[_0x0314('0xad')]){var _0x36cfaf=_0x135062['@odata.type'][_0x0314('0x9b')](_0x135062['@odata.type'][_0x0314('0xae')]('.')+0x1);if(_0x36cfaf===_0x0314('0xb4')||_0x36cfaf===_0x0314('0xb5')||_0x36cfaf===_0x0314('0xb6')||_0x36cfaf===_0x0314('0xb7')||_0x36cfaf===_0x0314('0xb8')||_0x36cfaf==='DateTimeAttributeMetadata'||_0x36cfaf==='StatusAttributeMetadata'||_0x36cfaf===_0x0314('0xb9')||_0x36cfaf===_0x0314('0xba')||_0x36cfaf===_0x0314('0xbb')){_0xa9774c[_0x0314('0xb2')](getInputList(_0x576190,_0x30726f,_0x36cfaf,_0x239fbd,_0x1b6cc5[_0x0314('0xa5')],_0x135062[_0x0314('0xa5')],_0x10c942));}}});return Promise[_0x0314('0xb3')](_0xa9774c);})['then'](function(_0x26f3da){_0xfc1bbe=_0x26f3da[0x0];var _0x5bcb8d=_0x11fb3f['concat'](_0x5d990c)[_0x0314('0x95')](_0xfc1bbe);var _0xb5728e={'count':_0x5bcb8d['length'],'rows':_0x5bcb8d};return _0xb5728e;})[_0x0314('0x26')](respondWithResult(_0x186dde,null))[_0x0314('0x41')](function(_0x1e3b8e){var _0x39d4a4=_0x58f666['query'][_0x0314('0xbc')]?0x1f4:_0x1e3b8e[_0x0314('0xbd')]||0x1f4;logger[_0x0314('0x28')](_0x1e3b8e['stack']);delete _0x1e3b8e['name'];if(_0x39d4a4===0x191){_0x39d4a4=0x190;}_0x186dde['status'](_0x39d4a4)[_0x0314('0x2a')](_0x58f666[_0x0314('0x31')][_0x0314('0xbc')]?{'message':'Wrong\x20credentials','statusCode':_0x1e3b8e[_0x0314('0xbd')]}:_0x1e3b8e);});};function getSelectList(_0x5c7cbd,_0x522143,_0x480164,_0x26d5ab,_0x2df492,_0x25c3d5){var _0xa44687={'method':_0x0314('0xa6'),'uri':_0x5c7cbd+_0x0314('0xa7')+_0x26d5ab+_0x0314('0xbe')+_0x2df492+_0x0314('0xbf')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':'Bearer\x20'+_0x25c3d5,'If-None-Match':null,'OData-Version':_0x0314('0xa4')},'json':!![]};return rp(_0xa44687)[_0x0314('0x26')](function(_0x305807){var _0x14dc00=[];var _0x479060=_0x305807[_0x0314('0xc0')][_0x0314('0xc1')];_0x479060[_0x0314('0xac')](function(_0x3d6bbd){_0x14dc00[_0x0314('0xb2')]({'name':_0x3d6bbd[_0x0314('0xc2')][_0x0314('0xc3')]['Label'],'value':String(_0x3d6bbd[_0x0314('0xc4')])});});var _0x59c9fb={'id':_0x522143+'_'+_0x305807[_0x0314('0xc5')],'name':_0x305807[_0x0314('0xc6')][_0x0314('0xc3')]['Label'],'custom':![],'options':_0x14dc00};_0x480164[_0x0314('0xb2')](_0x59c9fb);return _0x480164;});}function getBooleanList(_0x1503ab,_0x59787b,_0x1734ca,_0x3e3a43,_0x4c144a,_0xdf5fbc){var _0x3737b8={'method':_0x0314('0xa6'),'uri':_0x1503ab+'EntityDefinitions('+_0x3e3a43+_0x0314('0xbe')+_0x4c144a+_0x0314('0xc7'),'headers':{'Authorization':'Bearer\x20'+_0xdf5fbc,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3737b8)[_0x0314('0x26')](function(_0x91fc94){var _0x103475=[];_0x103475[_0x0314('0xb2')]({'name':_0x91fc94[_0x0314('0xc0')]['TrueOption']['Label'][_0x0314('0xc3')]['Label'],'value':'true'},{'name':_0x91fc94['OptionSet']['FalseOption'][_0x0314('0xc2')][_0x0314('0xc3')]['Label'],'value':'false'});var _0x38724c={'id':_0x59787b+'_'+_0x91fc94[_0x0314('0xc5')],'name':_0x91fc94[_0x0314('0xc6')]['UserLocalizedLabel'][_0x0314('0xc2')],'custom':![],'options':_0x103475};_0x1734ca[_0x0314('0xb2')](_0x38724c);return _0x1734ca;});}function getInputList(_0x306c61,_0x1cd3c9,_0x30f3fd,_0x2347fe,_0x27d22d,_0x4fb439,_0x225937){var _0x48081a={'method':_0x0314('0xa6'),'uri':_0x306c61+_0x0314('0xa7')+_0x27d22d+_0x0314('0xbe')+_0x4fb439+')/Microsoft.Dynamics.CRM.'+_0x30f3fd+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x0314('0xa9')+_0x225937,'If-None-Match':null,'OData-Version':_0x0314('0xa4')},'json':!![]};return rp(_0x48081a)[_0x0314('0x26')](function(_0x54c988){var _0x41a51b={'id':_0x1cd3c9+'_'+_0x54c988[_0x0314('0xc5')],'name':_0x54c988[_0x0314('0xc6')][_0x0314('0xc3')]?_0x54c988['DisplayName'][_0x0314('0xc3')][_0x0314('0xc2')]:_0x54c988[_0x0314('0xc5')],'custom':![],'options':[]};_0x2347fe['push'](_0x41a51b);return _0x2347fe;});} \ No newline at end of file +var _0x0911=['UserLocalizedLabel','Value','LogicalName','DisplayName','EntityDefinitions(',')/Attributes(','OptionSet','TrueOption','true','FalseOption','false','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','apply','reject','save','update','then','destroy','error','name','send','index','rawAttributes','fieldName','type','map','keys','query','filters','intersection','model','fields','attributes','nolimit','order','sort','where','filter','merge','options','Dynamics365Account','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','getConfigurations','findOne','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Configuration','Dynamics365Field','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','contactidname','contactidyominame','contractidname','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entityimage_url','exchangerate','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','concat','username','password','tenantId','clientSecret','remoteUri','slice','lastIndexOf','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','clientId','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','substring','@odata.type','PicklistAttributeMetadata','MetadataId','isNil','BooleanAttributeMetadata','push','forEach','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','all','test','statusCode','stack','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','4.0','Label'];(function(_0x4cb808,_0xf2ab17){var _0x3b8519=function(_0x16e022){while(--_0x16e022){_0x4cb808['push'](_0x4cb808['shift']());}};_0x3b8519(++_0xf2ab17);}(_0x0911,0x1a9));var _0x1091=function(_0x2567f0,_0x4fa60){_0x2567f0=_0x2567f0-0x0;var _0x14852a=_0x0911[_0x2567f0];return _0x14852a;};'use strict';var emlformat=require(_0x1091('0x0'));var rimraf=require(_0x1091('0x1'));var zipdir=require(_0x1091('0x2'));var jsonpatch=require(_0x1091('0x3'));var rp=require(_0x1091('0x4'));var moment=require('moment');var BPromise=require(_0x1091('0x5'));var Mustache=require('mustache');var util=require(_0x1091('0x6'));var path=require(_0x1091('0x7'));var sox=require(_0x1091('0x8'));var csv=require(_0x1091('0x9'));var ejs=require(_0x1091('0xa'));var fs=require('fs');var fs_extra=require(_0x1091('0xb'));var _=require(_0x1091('0xc'));var squel=require(_0x1091('0xd'));var crypto=require(_0x1091('0xe'));var jsforce=require(_0x1091('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x1091('0x9'));var querystring=require(_0x1091('0x10'));var Papa=require(_0x1091('0x11'));var Redis=require(_0x1091('0x12'));var authService=require(_0x1091('0x13'));var qs=require(_0x1091('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1091('0x15'));var logger=require(_0x1091('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x1091('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x1091('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3e9a52,_0x37a27c){_0x37a27c=_0x37a27c||0xcc;return function(_0x390560){if(_0x390560){return _0x3e9a52[_0x1091('0x19')](_0x37a27c);}return _0x3e9a52['status'](_0x37a27c)[_0x1091('0x1a')]();};}function respondWithResult(_0x11c894,_0x5d34e7){_0x5d34e7=_0x5d34e7||0xc8;return function(_0x5815db){if(_0x5815db){return _0x11c894['status'](_0x5d34e7)['json'](_0x5815db);}};}function respondWithFilteredResult(_0x4483c4,_0x9c92e5){return function(_0x3607e5){if(_0x3607e5){var _0x58c366=typeof _0x9c92e5[_0x1091('0x1b')]===_0x1091('0x1c')&&typeof _0x9c92e5[_0x1091('0x1d')]===_0x1091('0x1c');var _0x14f787=_0x3607e5['count'];var _0x841623=_0x58c366?0x0:_0x9c92e5[_0x1091('0x1b')];var _0x2b0fda=_0x58c366?_0x3607e5[_0x1091('0x1e')]:_0x9c92e5[_0x1091('0x1b')]+_0x9c92e5['limit'];var _0x2d9a4a;if(_0x2b0fda>=_0x14f787){_0x2b0fda=_0x14f787;_0x2d9a4a=0xc8;}else{_0x2d9a4a=0xce;}_0x4483c4[_0x1091('0x1f')](_0x2d9a4a);return _0x4483c4['set']('Content-Range',_0x841623+'-'+_0x2b0fda+'/'+_0x14f787)['json'](_0x3607e5);}return null;};}function patchUpdates(_0x250718){return function(_0x3a5014){try{jsonpatch[_0x1091('0x20')](_0x3a5014,_0x250718,!![]);}catch(_0x2f84d2){return BPromise[_0x1091('0x21')](_0x2f84d2);}return _0x3a5014[_0x1091('0x22')]();};}function saveUpdates(_0x30792f,_0xfb48c6){return function(_0x3daff2){if(_0x3daff2){return _0x3daff2[_0x1091('0x23')](_0x30792f)[_0x1091('0x24')](function(_0x197355){return _0x197355;});}return null;};}function removeEntity(_0x1925fc,_0x142597){return function(_0xffe7a6){if(_0xffe7a6){return _0xffe7a6[_0x1091('0x25')]()['then'](function(){_0x1925fc[_0x1091('0x1f')](0xcc)[_0x1091('0x1a')]();});}};}function handleEntityNotFound(_0x266d34,_0x5a4886){return function(_0x2a74cc){if(!_0x2a74cc){_0x266d34['sendStatus'](0x194);}return _0x2a74cc;};}function handleError(_0x26c91b,_0x306165){_0x306165=_0x306165||0x1f4;return function(_0x15eb8d){logger[_0x1091('0x26')](_0x15eb8d['stack']);if(_0x15eb8d[_0x1091('0x27')]){delete _0x15eb8d[_0x1091('0x27')];}_0x26c91b[_0x1091('0x1f')](_0x306165)[_0x1091('0x28')](_0x15eb8d);};}exports[_0x1091('0x29')]=function(_0x40a8b4,_0x56dc27){var _0x2be598={},_0x2068b6={},_0x170684={'count':0x0,'rows':[]};var _0x39326e=_['map'](db['Dynamics365Account'][_0x1091('0x2a')],function(_0x2ef4a9){return{'name':_0x2ef4a9[_0x1091('0x2b')],'type':_0x2ef4a9[_0x1091('0x2c')]['key']};});_0x2068b6['model']=_[_0x1091('0x2d')](_0x39326e,'name');_0x2068b6['query']=_[_0x1091('0x2e')](_0x40a8b4[_0x1091('0x2f')]);_0x2068b6[_0x1091('0x30')]=_[_0x1091('0x31')](_0x2068b6[_0x1091('0x32')],_0x2068b6[_0x1091('0x2f')]);_0x2be598['attributes']=_[_0x1091('0x31')](_0x2068b6[_0x1091('0x32')],qs[_0x1091('0x33')](_0x40a8b4[_0x1091('0x2f')]['fields']));_0x2be598[_0x1091('0x34')]=_0x2be598[_0x1091('0x34')]['length']?_0x2be598[_0x1091('0x34')]:_0x2068b6[_0x1091('0x32')];if(!_0x40a8b4[_0x1091('0x2f')]['hasOwnProperty'](_0x1091('0x35'))){_0x2be598[_0x1091('0x1d')]=qs['limit'](_0x40a8b4[_0x1091('0x2f')][_0x1091('0x1d')]);_0x2be598[_0x1091('0x1b')]=qs[_0x1091('0x1b')](_0x40a8b4['query'][_0x1091('0x1b')]);}_0x2be598[_0x1091('0x36')]=qs[_0x1091('0x37')](_0x40a8b4['query'][_0x1091('0x37')]);_0x2be598[_0x1091('0x38')]=qs[_0x1091('0x30')](_['pick'](_0x40a8b4[_0x1091('0x2f')],_0x2068b6[_0x1091('0x30')]),_0x39326e);if(_0x40a8b4[_0x1091('0x2f')][_0x1091('0x39')]){_0x2be598[_0x1091('0x38')]=_[_0x1091('0x3a')](_0x2be598['where'],{'$or':_[_0x1091('0x2d')](_0x39326e,function(_0x3f93b2){if(_0x3f93b2[_0x1091('0x2c')]!=='VIRTUAL'){var _0x3af339={};_0x3af339[_0x3f93b2[_0x1091('0x27')]]={'$like':'%'+_0x40a8b4[_0x1091('0x2f')][_0x1091('0x39')]+'%'};return _0x3af339;}})});}_0x2be598=_[_0x1091('0x3a')]({},_0x2be598,_0x40a8b4[_0x1091('0x3b')]);var _0x123363={'where':_0x2be598['where']};return db[_0x1091('0x3c')][_0x1091('0x1e')](_0x123363)[_0x1091('0x24')](function(_0x5e1390){_0x170684[_0x1091('0x1e')]=_0x5e1390;if(_0x40a8b4['query'][_0x1091('0x3d')]){_0x2be598[_0x1091('0x3e')]=[{'all':!![]}];}return db[_0x1091('0x3c')][_0x1091('0x3f')](_0x2be598);})[_0x1091('0x24')](function(_0x448d5d){_0x170684[_0x1091('0x40')]=_0x448d5d;return _0x170684;})['then'](respondWithFilteredResult(_0x56dc27,_0x2be598))[_0x1091('0x41')](handleError(_0x56dc27,null));};exports[_0x1091('0x42')]=function(_0x4b2048,_0x8985f7){var _0x1f29ea={'raw':![],'where':{'id':_0x4b2048['params']['id']}},_0x24bbd0={};_0x24bbd0[_0x1091('0x32')]=_[_0x1091('0x2e')](db[_0x1091('0x3c')][_0x1091('0x2a')]);_0x24bbd0[_0x1091('0x2f')]=_['keys'](_0x4b2048['query']);_0x24bbd0['filters']=_['intersection'](_0x24bbd0[_0x1091('0x32')],_0x24bbd0[_0x1091('0x2f')]);_0x1f29ea[_0x1091('0x34')]=_[_0x1091('0x31')](_0x24bbd0[_0x1091('0x32')],qs[_0x1091('0x33')](_0x4b2048[_0x1091('0x2f')][_0x1091('0x33')]));_0x1f29ea['attributes']=_0x1f29ea['attributes'][_0x1091('0x43')]?_0x1f29ea[_0x1091('0x34')]:_0x24bbd0[_0x1091('0x32')];if(_0x4b2048[_0x1091('0x2f')][_0x1091('0x3d')]){_0x1f29ea['include']=[{'all':!![]}];}_0x1f29ea=_[_0x1091('0x3a')]({},_0x1f29ea,_0x4b2048['options']);return db[_0x1091('0x3c')][_0x1091('0x44')](_0x1f29ea)[_0x1091('0x24')](handleEntityNotFound(_0x8985f7,null))[_0x1091('0x24')](respondWithResult(_0x8985f7,null))[_0x1091('0x41')](handleError(_0x8985f7,null));};exports[_0x1091('0x45')]=function(_0x4fc761,_0x1a3883){return db[_0x1091('0x3c')][_0x1091('0x45')](_0x4fc761[_0x1091('0x46')],{})[_0x1091('0x24')](respondWithResult(_0x1a3883,0xc9))[_0x1091('0x41')](handleError(_0x1a3883,null));};exports['update']=function(_0x36f93a,_0xf57822){if(_0x36f93a[_0x1091('0x46')]['id']){delete _0x36f93a[_0x1091('0x46')]['id'];}return db[_0x1091('0x3c')][_0x1091('0x44')]({'where':{'id':_0x36f93a[_0x1091('0x47')]['id']}})[_0x1091('0x24')](handleEntityNotFound(_0xf57822,null))[_0x1091('0x24')](saveUpdates(_0x36f93a[_0x1091('0x46')],null))[_0x1091('0x24')](respondWithResult(_0xf57822,null))[_0x1091('0x41')](handleError(_0xf57822,null));};exports[_0x1091('0x25')]=function(_0x33816a,_0x8980d9){return db[_0x1091('0x3c')][_0x1091('0x44')]({'where':{'id':_0x33816a[_0x1091('0x47')]['id']}})[_0x1091('0x24')](handleEntityNotFound(_0x8980d9,null))['then'](removeEntity(_0x8980d9,null))['catch'](handleError(_0x8980d9,null));};exports[_0x1091('0x48')]=function(_0x9a9747,_0x22cca1,_0x127979){var _0x1f21c0={};var _0x540813={};var _0x3a1d25;var _0x217d4f;return db[_0x1091('0x3c')][_0x1091('0x49')]({'where':{'id':_0x9a9747[_0x1091('0x47')]['id']}})['then'](handleEntityNotFound(_0x22cca1,null))[_0x1091('0x24')](function(_0x4084cb){if(_0x4084cb){_0x3a1d25=_0x4084cb;_0x540813['model']=_[_0x1091('0x2e')](db['Dynamics365Configuration']['rawAttributes']);_0x540813[_0x1091('0x2f')]=_['keys'](_0x9a9747[_0x1091('0x2f')]);_0x540813['filters']=_[_0x1091('0x31')](_0x540813[_0x1091('0x32')],_0x540813[_0x1091('0x2f')]);_0x1f21c0[_0x1091('0x34')]=_[_0x1091('0x31')](_0x540813[_0x1091('0x32')],qs[_0x1091('0x33')](_0x9a9747[_0x1091('0x2f')][_0x1091('0x33')]));_0x1f21c0[_0x1091('0x34')]=_0x1f21c0[_0x1091('0x34')][_0x1091('0x43')]?_0x1f21c0['attributes']:_0x540813[_0x1091('0x32')];_0x1f21c0[_0x1091('0x36')]=qs['sort'](_0x9a9747[_0x1091('0x2f')]['sort']);_0x1f21c0[_0x1091('0x38')]=qs[_0x1091('0x30')](_[_0x1091('0x4a')](_0x9a9747[_0x1091('0x2f')],_0x540813[_0x1091('0x30')]));if(_0x9a9747['query'][_0x1091('0x39')]){_0x1f21c0[_0x1091('0x38')]=_['merge'](_0x1f21c0['where'],{'$or':_[_0x1091('0x2d')](_0x1f21c0['attributes'],function(_0x6467fd){var _0x33e8cf={};_0x33e8cf[_0x6467fd]={'$like':'%'+_0x9a9747[_0x1091('0x2f')][_0x1091('0x39')]+'%'};return _0x33e8cf;})});}_0x1f21c0=_[_0x1091('0x3a')]({},_0x1f21c0,_0x9a9747['options']);return _0x3a1d25['getConfigurations'](_0x1f21c0);}})[_0x1091('0x24')](function(_0x110218){if(_0x110218){_0x217d4f=_0x110218[_0x1091('0x43')];if(!_0x9a9747['query']['hasOwnProperty'](_0x1091('0x35'))){_0x1f21c0[_0x1091('0x1d')]=qs[_0x1091('0x1d')](_0x9a9747[_0x1091('0x2f')][_0x1091('0x1d')]);_0x1f21c0[_0x1091('0x1b')]=qs['offset'](_0x9a9747[_0x1091('0x2f')][_0x1091('0x1b')]);}return _0x3a1d25['getConfigurations'](_0x1f21c0);}})[_0x1091('0x24')](function(_0x353b77){if(_0x353b77){return _0x353b77?{'count':_0x217d4f,'rows':_0x353b77}:null;}})[_0x1091('0x24')](respondWithResult(_0x22cca1,null))['catch'](handleError(_0x22cca1,null));};exports[_0x1091('0x4b')]=function(_0x425326,_0x327399,_0x2400f2){if(_0x425326[_0x1091('0x46')]['id']){delete _0x425326[_0x1091('0x46')]['id'];}return db[_0x1091('0x3c')][_0x1091('0x49')]({'where':{'id':_0x425326['params']['id']}})['then'](handleEntityNotFound(_0x327399,null))['then'](function(_0x2ea4cd){if(_0x2ea4cd){_0x425326[_0x1091('0x46')][_0x1091('0x4c')]=_0x2ea4cd['id'];_0x425326[_0x1091('0x46')][_0x1091('0x4d')]=integrations[_0x1091('0x4e')](_0x425326[_0x1091('0x46')][_0x1091('0x4f')],_0x425326[_0x1091('0x46')][_0x1091('0x2c')]);_0x425326['body'][_0x1091('0x50')]=integrations[_0x1091('0x51')](_0x425326[_0x1091('0x46')][_0x1091('0x4f')],_0x425326[_0x1091('0x46')]['type']);return db[_0x1091('0x52')][_0x1091('0x45')](_0x425326[_0x1091('0x46')],{'include':[{'model':db[_0x1091('0x53')],'as':_0x1091('0x4d')},{'model':db['Dynamics365Field'],'as':'Descriptions'}]});}return null;})[_0x1091('0x24')](respondWithResult(_0x327399,null))[_0x1091('0x41')](handleError(_0x327399,null));};exports['getFields']=function(_0x10ef74,_0x5a6e40,_0x1a7dd5){var _0x19036f=_0x10ef74['query'][_0x1091('0x54')];var _0x112a8f=_0x19036f===_0x1091('0x55')?_0x1091('0x56'):_0x1091('0x57');var _0x2f905f='';var _0x13de6c='';var _0x3c5714='';var _0x195f27='';var _0x23de01='';var _0x2df47a='';var _0x5e1df4='';var _0x227e1='';var _0x108a7c=[_0x1091('0x58'),_0x1091('0x59'),_0x1091('0x5a'),_0x1091('0x5b'),_0x1091('0x5c'),_0x1091('0x5d'),_0x1091('0x5e'),_0x1091('0x5f'),_0x1091('0x60'),_0x1091('0x61')];var _0x405674=[_0x1091('0x62'),_0x1091('0x63'),_0x1091('0x64'),'billedserviceunits',_0x1091('0x65'),_0x1091('0x66'),'contractdetailidname',_0x1091('0x67'),'createdbyexternalpartyname','createdbyexternalpartyyominame',_0x1091('0x68'),_0x1091('0x69'),_0x1091('0x6a'),_0x1091('0x6b'),_0x1091('0x6c'),_0x1091('0x6d'),_0x1091('0x6e'),_0x1091('0x6f'),_0x1091('0x70'),'entitlementidname','entityimage_timestamp',_0x1091('0x71'),'escalatedon',_0x1091('0x72'),'firstresponsebykpiidname','followupby',_0x1091('0x73'),'influencescore',_0x1091('0x74'),_0x1091('0x75'),_0x1091('0x76'),_0x1091('0x77'),_0x1091('0x78'),_0x1091('0x79'),_0x1091('0x7a'),_0x1091('0x7b'),_0x1091('0x7c'),_0x1091('0x7d'),'msdyn_incidenttypename',_0x1091('0x7e'),_0x1091('0x7f'),_0x1091('0x80'),_0x1091('0x81'),_0x1091('0x82'),_0x1091('0x83'),'owneridyominame','parentcaseidname',_0x1091('0x84'),_0x1091('0x85'),_0x1091('0x86'),_0x1091('0x87'),_0x1091('0x88'),_0x1091('0x89'),_0x1091('0x8a'),_0x1091('0x8b'),_0x1091('0x8c'),_0x1091('0x8d'),_0x1091('0x8e'),_0x1091('0x8f'),_0x1091('0x90'),_0x1091('0x91'),_0x1091('0x92'),_0x1091('0x93'),_0x1091('0x94'),'ticketnumber','timezoneruleversionnumber',_0x1091('0x95'),_0x1091('0x96'),_0x1091('0x97'),'versionnumber'];var _0x511132=_0x108a7c[_0x1091('0x98')](_0x405674);return db[_0x1091('0x3c')][_0x1091('0x49')]({'where':{'id':_0x10ef74[_0x1091('0x47')]['id']},'attributes':['id',_0x1091('0x99'),_0x1091('0x9a'),'remoteUri',_0x1091('0x9b'),'clientId',_0x1091('0x9c')]})[_0x1091('0x24')](handleEntityNotFound(_0x5a6e40,null))[_0x1091('0x24')](function(_0x1a2731){if(_0x1a2731){_0x227e1=_0x1a2731[_0x1091('0x9d')];var _0x313b37=_0x227e1[_0x1091('0x9e')](-0x1);if(_0x313b37==='/'){_0x227e1=_0x227e1['substring'](0x0,_0x227e1[_0x1091('0x9f')](_0x313b37));}_0x5e1df4=util['format'](_0x1091('0xa0'),_0x227e1);var _0x1e6d9d={'method':_0x1091('0xa1'),'uri':_0x1091('0xa2')+_0x1a2731[_0x1091('0x9b')]+_0x1091('0xa3'),'form':{'client_id':_0x1a2731[_0x1091('0xa4')],'resource':_0x227e1,'username':_0x1a2731[_0x1091('0x99')],'password':_0x1a2731[_0x1091('0x9a')],'grant_type':'password','client_secret':_0x1a2731[_0x1091('0x9c')]},'json':!![]};return rp(_0x1e6d9d);}})[_0x1091('0x24')](function(_0x51a993){_0x2df47a=_0x51a993['access_token'];var _0x14d358={'method':_0x1091('0xa5'),'uri':encodeURI(_0x5e1df4+_0x1091('0xa6')+_0x112a8f+'\x27'),'headers':{'Authorization':_0x1091('0xa7')+_0x2df47a,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x14d358);})['then'](function(_0x501b39){var _0x2abba6=_0x501b39['value'][0x0];var _0x3e468c=_0x2abba6['MetadataId'];var _0xd1e2af={'method':_0x1091('0xa5'),'uri':_0x5e1df4+'EntityDefinitions('+_0x3e468c+_0x1091('0xa8'),'headers':{'Authorization':'Bearer\x20'+_0x2df47a,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xd1e2af);})['then'](function(_0x18899d){_0x2f905f=_0x18899d;_0x13de6c=_0x2f905f[_0x1091('0xa9')];_0x13de6c=_[_0x1091('0xaa')](_0x13de6c,function(_0x1f0c64){return!_0x511132[_0x1091('0xab')](_0x1f0c64['LogicalName']);});var _0x4b545f=[];var _0xad7ea3=[];_0x13de6c['forEach'](function(_0x2dfd57){if(_0x2dfd57['@odata.type']){var _0x196fa1=_0x2dfd57['@odata.type'][_0x1091('0xac')](_0x2dfd57[_0x1091('0xad')]['lastIndexOf']('.')+0x1);if(_0x196fa1===_0x1091('0xae')){_0x4b545f['push'](getSelectList(_0x5e1df4,_0x19036f,_0xad7ea3,_0x2f905f['MetadataId'],_0x2dfd57[_0x1091('0xaf')],_0x2df47a));}}});return Promise['all'](_0x4b545f);})[_0x1091('0x24')](function(_0x27a482){_0x3c5714=_0x27a482[0x0];var _0xd30b68=[];var _0x25d7a4=[];_0x13de6c['forEach'](function(_0x1756c0){if(!_[_0x1091('0xb0')](_0x1756c0['@odata.type'])){var _0x184679=_0x1756c0[_0x1091('0xad')][_0x1091('0xac')](_0x1756c0['@odata.type'][_0x1091('0x9f')]('.')+0x1);if(_0x184679===_0x1091('0xb1')){_0xd30b68[_0x1091('0xb2')](getBooleanList(_0x5e1df4,_0x19036f,_0x25d7a4,_0x2f905f[_0x1091('0xaf')],_0x1756c0['MetadataId'],_0x2df47a));}}});return Promise['all'](_0xd30b68);})[_0x1091('0x24')](function(_0x33a6eb){_0x195f27=_0x33a6eb[0x0];var _0x4f963c=[];var _0x25822b=[];_0x13de6c[_0x1091('0xb3')](function(_0x40998a){if(_0x40998a[_0x1091('0xad')]){var _0x26caae=_0x40998a[_0x1091('0xad')]['substring'](_0x40998a[_0x1091('0xad')]['lastIndexOf']('.')+0x1);if(_0x26caae==='StringAttributeMetadata'||_0x26caae===_0x1091('0xb4')||_0x26caae===_0x1091('0xb5')||_0x26caae===_0x1091('0xb6')||_0x26caae==='MemoAttributeMetadata'||_0x26caae===_0x1091('0xb7')||_0x26caae===_0x1091('0xb8')||_0x26caae===_0x1091('0xb9')||_0x26caae==='StateAttributeMetadata'||_0x26caae===_0x1091('0xba')){_0x4f963c[_0x1091('0xb2')](getInputList(_0x5e1df4,_0x19036f,_0x26caae,_0x25822b,_0x2f905f[_0x1091('0xaf')],_0x40998a[_0x1091('0xaf')],_0x2df47a));}}});return Promise[_0x1091('0xbb')](_0x4f963c);})[_0x1091('0x24')](function(_0x500bdb){_0x23de01=_0x500bdb[0x0];var _0x2c50cf=_0x3c5714[_0x1091('0x98')](_0x195f27)[_0x1091('0x98')](_0x23de01);var _0x390b1b={'count':_0x2c50cf[_0x1091('0x43')],'rows':_0x2c50cf};return _0x390b1b;})[_0x1091('0x24')](respondWithResult(_0x5a6e40,null))[_0x1091('0x41')](function(_0x2a1411){var _0x23828a=_0x10ef74['query'][_0x1091('0xbc')]?0x1f4:_0x2a1411[_0x1091('0xbd')]||0x1f4;logger[_0x1091('0x26')](_0x2a1411[_0x1091('0xbe')]);delete _0x2a1411['name'];if(_0x23828a===0x191){_0x23828a=0x190;}_0x5a6e40[_0x1091('0x1f')](_0x23828a)['send'](_0x10ef74['query'][_0x1091('0xbc')]?{'message':_0x1091('0xbf'),'statusCode':_0x2a1411[_0x1091('0xbd')]}:_0x2a1411);});};function getSelectList(_0x1adf4b,_0xfb790e,_0x31b0fe,_0x160682,_0x3b371c,_0xd322dd){var _0x114b9e={'method':_0x1091('0xa5'),'uri':_0x1adf4b+'EntityDefinitions('+_0x160682+')/Attributes('+_0x3b371c+_0x1091('0xc0')+_0x1091('0xc1'),'headers':{'Authorization':_0x1091('0xa7')+_0xd322dd,'If-None-Match':null,'OData-Version':_0x1091('0xc2')},'json':!![]};return rp(_0x114b9e)[_0x1091('0x24')](function(_0x4d6e60){var _0x3b2c93=[];var _0x1f1b69=_0x4d6e60['OptionSet']['Options'];_0x1f1b69[_0x1091('0xb3')](function(_0x5d8e34){_0x3b2c93[_0x1091('0xb2')]({'name':_0x5d8e34[_0x1091('0xc3')][_0x1091('0xc4')][_0x1091('0xc3')],'value':String(_0x5d8e34[_0x1091('0xc5')])});});var _0x350be4={'id':_0xfb790e+'_'+_0x4d6e60[_0x1091('0xc6')],'name':_0x4d6e60[_0x1091('0xc7')]['UserLocalizedLabel'][_0x1091('0xc3')],'custom':![],'options':_0x3b2c93};_0x31b0fe[_0x1091('0xb2')](_0x350be4);return _0x31b0fe;});}function getBooleanList(_0x5b712b,_0x57209e,_0xdfe781,_0x4ecceb,_0x3c8d49,_0x11905a){var _0xed0bd6={'method':'GET','uri':_0x5b712b+_0x1091('0xc8')+_0x4ecceb+_0x1091('0xc9')+_0x3c8d49+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x1091('0xa7')+_0x11905a,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xed0bd6)[_0x1091('0x24')](function(_0xffdbde){var _0x41c73d=[];_0x41c73d[_0x1091('0xb2')]({'name':_0xffdbde[_0x1091('0xca')][_0x1091('0xcb')][_0x1091('0xc3')][_0x1091('0xc4')][_0x1091('0xc3')],'value':_0x1091('0xcc')},{'name':_0xffdbde[_0x1091('0xca')][_0x1091('0xcd')][_0x1091('0xc3')]['UserLocalizedLabel'][_0x1091('0xc3')],'value':_0x1091('0xce')});var _0x2be033={'id':_0x57209e+'_'+_0xffdbde[_0x1091('0xc6')],'name':_0xffdbde['DisplayName'][_0x1091('0xc4')]['Label'],'custom':![],'options':_0x41c73d};_0xdfe781['push'](_0x2be033);return _0xdfe781;});}function getInputList(_0x31e911,_0x3a8c2d,_0x30bd6a,_0x592d3e,_0x33bc86,_0x21a2ec,_0x2f9576){var _0x53f418={'method':_0x1091('0xa5'),'uri':_0x31e911+_0x1091('0xc8')+_0x33bc86+_0x1091('0xc9')+_0x21a2ec+')/Microsoft.Dynamics.CRM.'+_0x30bd6a+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x1091('0xa7')+_0x2f9576,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x53f418)['then'](function(_0x53d2b3){var _0x289faf={'id':_0x3a8c2d+'_'+_0x53d2b3['LogicalName'],'name':_0x53d2b3[_0x1091('0xc7')]['UserLocalizedLabel']?_0x53d2b3[_0x1091('0xc7')][_0x1091('0xc4')][_0x1091('0xc3')]:_0x53d2b3[_0x1091('0xc6')],'custom':![],'options':[]};_0x592d3e[_0x1091('0xb2')](_0x289faf);return _0x592d3e;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 5ae86d7..c1b1575 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 _0xa9e0=['define','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x17cf1e,_0x1a089d){var _0x51e8c8=function(_0x1772bb){while(--_0x1772bb){_0x17cf1e['push'](_0x17cf1e['shift']());}};_0x51e8c8(++_0x1a089d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));var integrations=require(_0x0a9e('0x8'));module['exports']=function(_0x219af0,_0x441e3a){return _0x219af0[_0x0a9e('0x9')]('Dynamics365Account',attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['define','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x104fd6,_0x29b3f3){var _0x238b97=function(_0x916bf8){while(--_0x916bf8){_0x104fd6['push'](_0x104fd6['shift']());}};_0x238b97(++_0x29b3f3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));var integrations=require(_0x0a9e('0x8'));module['exports']=function(_0x219af0,_0x441e3a){return _0x219af0[_0x0a9e('0x9')]('Dynamics365Account',attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index ebc89ba..1844377 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 _0x07ae=['then','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','limit','include','map','model','attributes','ShowDynamics365Account'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x07ae,0x1bd));var _0xe07a=function(_0x1233e1,_0x1259e0){_0x1233e1=_0x1233e1-0x0;var _0x5d5824=_0x07ae[_0x1233e1];return _0x5d5824;};'use strict';var _=require(_0xe07a('0x0'));var util=require(_0xe07a('0x1'));var moment=require(_0xe07a('0x2'));var BPromise=require(_0xe07a('0x3'));var rs=require(_0xe07a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe07a('0x5'))['db'];var utils=require(_0xe07a('0x6'));var logger=require(_0xe07a('0x7'))(_0xe07a('0x8'));var config=require(_0xe07a('0x9'));var jayson=require(_0xe07a('0xa'));var client=jayson[_0xe07a('0xb')][_0xe07a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4066ed,_0x556460,_0xef4717){return new BPromise(function(_0xc77e64,_0x3e1ba3){return client[_0xe07a('0xd')](_0x4066ed,_0xef4717)['then'](function(_0x326087){logger[_0xe07a('0xe')](_0xe07a('0xf'),_0x556460,_0xe07a('0x10'));logger[_0xe07a('0x11')](_0xe07a('0x12'),_0x556460,_0xe07a('0x10'),JSON[_0xe07a('0x13')](_0x326087));if(_0x326087['error']){if(_0x326087[_0xe07a('0x14')][_0xe07a('0x15')]===0x1f4){logger[_0xe07a('0x14')](_0xe07a('0xf'),_0x556460,_0x326087['error'][_0xe07a('0x16')]);return _0x3e1ba3(_0x326087[_0xe07a('0x14')]['message']);}logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x556460,_0x326087['error']['message']);return _0xc77e64(_0x326087['error']['message']);}else{logger[_0xe07a('0xe')](_0xe07a('0xf'),_0x556460,_0xe07a('0x10'));_0xc77e64(_0x326087['result'][_0xe07a('0x16')]);}})[_0xe07a('0x17')](function(_0x23369c){logger[_0xe07a('0x14')](_0xe07a('0xf'),_0x556460,_0x23369c);_0x3e1ba3(_0x23369c);});});}exports[_0xe07a('0x18')]=function(_0x5bd196){var _0x2d5787=this;return new Promise(function(_0x8c8677,_0xb2d15a){return db[_0xe07a('0x19')][_0xe07a('0x1a')]({'raw':_0x5bd196[_0xe07a('0x1b')]?_0x5bd196[_0xe07a('0x1b')][_0xe07a('0x1c')]===undefined?!![]:![]:!![],'where':_0x5bd196[_0xe07a('0x1b')]?_0x5bd196[_0xe07a('0x1b')][_0xe07a('0x1d')]||null:null,'attributes':_0x5bd196[_0xe07a('0x1b')]?_0x5bd196['options']['attributes']||null:null,'limit':_0x5bd196[_0xe07a('0x1b')]?_0x5bd196[_0xe07a('0x1b')][_0xe07a('0x1e')]||null:null,'include':_0x5bd196['options']?_0x5bd196[_0xe07a('0x1b')][_0xe07a('0x1f')]?_[_0xe07a('0x20')](_0x5bd196[_0xe07a('0x1b')]['include'],function(_0xe9cae5){return{'model':db[_0xe9cae5[_0xe07a('0x21')]],'as':_0xe9cae5['as'],'attributes':_0xe9cae5[_0xe07a('0x22')],'include':_0xe9cae5[_0xe07a('0x1f')]?_[_0xe07a('0x20')](_0xe9cae5['include'],function(_0x277b31){return{'model':db[_0x277b31['model']],'as':_0x277b31['as'],'attributes':_0x277b31[_0xe07a('0x22')],'include':_0x277b31[_0xe07a('0x1f')]?_[_0xe07a('0x20')](_0x277b31[_0xe07a('0x1f')],function(_0x73223d){return{'model':db[_0x73223d[_0xe07a('0x21')]],'as':_0x73223d['as'],'attributes':_0x73223d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x507f26){logger[_0xe07a('0xe')]('GetDynamics365Account',_0x5bd196);logger[_0xe07a('0x11')]('GetDynamics365Account',_0x5bd196,JSON[_0xe07a('0x13')](_0x507f26));_0x8c8677(_0x507f26);})['catch'](function(_0x27b0d6){logger['error'](_0xe07a('0x18'),_0x27b0d6[_0xe07a('0x16')],_0x5bd196);_0xb2d15a(_0x2d5787['error'](0x1f4,_0x27b0d6[_0xe07a('0x16')]));});});};exports[_0xe07a('0x23')]=function(_0x1ab895){var _0x2a1ecd=this;return new Promise(function(_0x1b1ed1,_0x1fa400){return db[_0xe07a('0x19')]['find']({'raw':_0x1ab895[_0xe07a('0x1b')]?_0x1ab895[_0xe07a('0x1b')][_0xe07a('0x1c')]===undefined?!![]:![]:!![],'where':_0x1ab895[_0xe07a('0x1b')]?_0x1ab895[_0xe07a('0x1b')][_0xe07a('0x1d')]||null:null,'attributes':_0x1ab895['options']?_0x1ab895[_0xe07a('0x1b')][_0xe07a('0x22')]||null:null,'include':_0x1ab895['options']?_0x1ab895['options'][_0xe07a('0x1f')]?_[_0xe07a('0x20')](_0x1ab895[_0xe07a('0x1b')][_0xe07a('0x1f')],function(_0x6e2313){return{'model':db[_0x6e2313[_0xe07a('0x21')]],'as':_0x6e2313['as'],'attributes':_0x6e2313[_0xe07a('0x22')],'include':_0x6e2313[_0xe07a('0x1f')]?_[_0xe07a('0x20')](_0x6e2313[_0xe07a('0x1f')],function(_0x1b56b3){return{'model':db[_0x1b56b3[_0xe07a('0x21')]],'as':_0x1b56b3['as'],'attributes':_0x1b56b3[_0xe07a('0x22')],'include':_0x1b56b3['include']?_[_0xe07a('0x20')](_0x1b56b3[_0xe07a('0x1f')],function(_0x1a1f7d){return{'model':db[_0x1a1f7d[_0xe07a('0x21')]],'as':_0x1a1f7d['as'],'attributes':_0x1a1f7d[_0xe07a('0x22')]};}):[]};}):[]};}):[]:[]})[_0xe07a('0x24')](function(_0x461c17){logger['info'](_0xe07a('0x23'),_0x1ab895);logger[_0xe07a('0x11')](_0xe07a('0x23'),_0x1ab895,JSON['stringify'](_0x461c17));_0x1b1ed1(_0x461c17);})[_0xe07a('0x17')](function(_0x2fb970){logger[_0xe07a('0x14')]('ShowDynamics365Account',_0x2fb970[_0xe07a('0x16')],_0x1ab895);_0x1fa400(_0x2a1ecd[_0xe07a('0x14')](0x1f4,_0x2fb970[_0xe07a('0x16')]));});});}; \ No newline at end of file +var _0x6b62=['Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','Dynamics365Account,\x20%s,\x20%s','message','catch','Dynamics365Account','findAll','options','where','attributes','limit','include','map','model','GetDynamics365Account','ShowDynamics365Account','find','raw','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x6b62,0x7c));var _0x26b6=function(_0x9de36,_0x112bc9){_0x9de36=_0x9de36-0x0;var _0x5b60ab=_0x6b62[_0x9de36];return _0x5b60ab;};'use strict';var _=require(_0x26b6('0x0'));var util=require('util');var moment=require(_0x26b6('0x1'));var BPromise=require(_0x26b6('0x2'));var rs=require(_0x26b6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x26b6('0x4'))['db'];var utils=require(_0x26b6('0x5'));var logger=require(_0x26b6('0x6'))(_0x26b6('0x7'));var config=require('../../config/environment');var jayson=require(_0x26b6('0x8'));var client=jayson[_0x26b6('0x9')][_0x26b6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11ebea,_0x5e6814,_0x1f5adb){return new BPromise(function(_0x597519,_0x33b8ed){return client[_0x26b6('0xb')](_0x11ebea,_0x1f5adb)[_0x26b6('0xc')](function(_0x2f8dbb){logger[_0x26b6('0xd')]('Dynamics365Account,\x20%s,\x20%s',_0x5e6814,_0x26b6('0xe'));logger[_0x26b6('0xf')](_0x26b6('0x10'),_0x5e6814,_0x26b6('0xe'),JSON[_0x26b6('0x11')](_0x2f8dbb));if(_0x2f8dbb[_0x26b6('0x12')]){if(_0x2f8dbb[_0x26b6('0x12')]['code']===0x1f4){logger['error'](_0x26b6('0x13'),_0x5e6814,_0x2f8dbb['error']['message']);return _0x33b8ed(_0x2f8dbb[_0x26b6('0x12')]['message']);}logger[_0x26b6('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0x5e6814,_0x2f8dbb[_0x26b6('0x12')][_0x26b6('0x14')]);return _0x597519(_0x2f8dbb['error'][_0x26b6('0x14')]);}else{logger[_0x26b6('0xd')]('Dynamics365Account,\x20%s,\x20%s',_0x5e6814,_0x26b6('0xe'));_0x597519(_0x2f8dbb['result'][_0x26b6('0x14')]);}})[_0x26b6('0x15')](function(_0x22c676){logger[_0x26b6('0x12')](_0x26b6('0x13'),_0x5e6814,_0x22c676);_0x33b8ed(_0x22c676);});});}exports['GetDynamics365Account']=function(_0x3fe0f5){var _0x2774d7=this;return new Promise(function(_0x440ed5,_0xab9b39){return db[_0x26b6('0x16')][_0x26b6('0x17')]({'raw':_0x3fe0f5[_0x26b6('0x18')]?_0x3fe0f5[_0x26b6('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3fe0f5[_0x26b6('0x18')]?_0x3fe0f5['options'][_0x26b6('0x19')]||null:null,'attributes':_0x3fe0f5[_0x26b6('0x18')]?_0x3fe0f5[_0x26b6('0x18')][_0x26b6('0x1a')]||null:null,'limit':_0x3fe0f5[_0x26b6('0x18')]?_0x3fe0f5[_0x26b6('0x18')][_0x26b6('0x1b')]||null:null,'include':_0x3fe0f5[_0x26b6('0x18')]?_0x3fe0f5[_0x26b6('0x18')][_0x26b6('0x1c')]?_[_0x26b6('0x1d')](_0x3fe0f5[_0x26b6('0x18')][_0x26b6('0x1c')],function(_0x1a10aa){return{'model':db[_0x1a10aa[_0x26b6('0x1e')]],'as':_0x1a10aa['as'],'attributes':_0x1a10aa[_0x26b6('0x1a')],'include':_0x1a10aa[_0x26b6('0x1c')]?_[_0x26b6('0x1d')](_0x1a10aa[_0x26b6('0x1c')],function(_0x73cdcf){return{'model':db[_0x73cdcf['model']],'as':_0x73cdcf['as'],'attributes':_0x73cdcf[_0x26b6('0x1a')],'include':_0x73cdcf['include']?_[_0x26b6('0x1d')](_0x73cdcf['include'],function(_0x32fcf){return{'model':db[_0x32fcf[_0x26b6('0x1e')]],'as':_0x32fcf['as'],'attributes':_0x32fcf[_0x26b6('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x524a9c){logger[_0x26b6('0xd')](_0x26b6('0x1f'),_0x3fe0f5);logger[_0x26b6('0xf')](_0x26b6('0x1f'),_0x3fe0f5,JSON['stringify'](_0x524a9c));_0x440ed5(_0x524a9c);})['catch'](function(_0x17f10c){logger[_0x26b6('0x12')]('GetDynamics365Account',_0x17f10c['message'],_0x3fe0f5);_0xab9b39(_0x2774d7[_0x26b6('0x12')](0x1f4,_0x17f10c[_0x26b6('0x14')]));});});};exports[_0x26b6('0x20')]=function(_0x46f0ec){var _0x505e0e=this;return new Promise(function(_0x3d16c3,_0x39839e){return db['Dynamics365Account'][_0x26b6('0x21')]({'raw':_0x46f0ec[_0x26b6('0x18')]?_0x46f0ec[_0x26b6('0x18')][_0x26b6('0x22')]===undefined?!![]:![]:!![],'where':_0x46f0ec[_0x26b6('0x18')]?_0x46f0ec[_0x26b6('0x18')][_0x26b6('0x19')]||null:null,'attributes':_0x46f0ec[_0x26b6('0x18')]?_0x46f0ec[_0x26b6('0x18')]['attributes']||null:null,'include':_0x46f0ec['options']?_0x46f0ec[_0x26b6('0x18')][_0x26b6('0x1c')]?_[_0x26b6('0x1d')](_0x46f0ec['options'][_0x26b6('0x1c')],function(_0x453660){return{'model':db[_0x453660[_0x26b6('0x1e')]],'as':_0x453660['as'],'attributes':_0x453660[_0x26b6('0x1a')],'include':_0x453660[_0x26b6('0x1c')]?_[_0x26b6('0x1d')](_0x453660[_0x26b6('0x1c')],function(_0x4eb8f8){return{'model':db[_0x4eb8f8[_0x26b6('0x1e')]],'as':_0x4eb8f8['as'],'attributes':_0x4eb8f8[_0x26b6('0x1a')],'include':_0x4eb8f8[_0x26b6('0x1c')]?_[_0x26b6('0x1d')](_0x4eb8f8[_0x26b6('0x1c')],function(_0x4c09ba){return{'model':db[_0x4c09ba['model']],'as':_0x4c09ba['as'],'attributes':_0x4c09ba[_0x26b6('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x26b6('0xc')](function(_0x1775c7){logger[_0x26b6('0xd')](_0x26b6('0x20'),_0x46f0ec);logger[_0x26b6('0xf')](_0x26b6('0x20'),_0x46f0ec,JSON[_0x26b6('0x11')](_0x1775c7));_0x3d16c3(_0x1775c7);})[_0x26b6('0x15')](function(_0x1ff2ef){logger[_0x26b6('0x12')](_0x26b6('0x20'),_0x1ff2ef[_0x26b6('0x14')],_0x46f0ec);_0x39839e(_0x505e0e[_0x26b6('0x12')](0x1f4,_0x1ff2ef[_0x26b6('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 559e4b4..dae6acf 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 _0x6c79=['connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','/:id','show','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','delete','destroy','exports','multer','util','path'];(function(_0x50db94,_0x536efd){var _0x320e48=function(_0x577a7d){while(--_0x577a7d){_0x50db94['push'](_0x50db94['shift']());}};_0x320e48(++_0x536efd);}(_0x6c79,0x184));var _0x96c7=function(_0x92713a,_0x68f8b0){_0x92713a=_0x92713a-0x0;var _0x1893e1=_0x6c79[_0x92713a];return _0x1893e1;};'use strict';var multer=require(_0x96c7('0x0'));var util=require(_0x96c7('0x1'));var path=require(_0x96c7('0x2'));var timeout=require(_0x96c7('0x3'));var express=require(_0x96c7('0x4'));var router=express['Router']();var fs_extra=require(_0x96c7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x96c7('0x6'));var config=require(_0x96c7('0x7'));var controller=require(_0x96c7('0x8'));router[_0x96c7('0x9')]('/',auth[_0x96c7('0xa')](),controller['index']);router[_0x96c7('0x9')](_0x96c7('0xb'),auth[_0x96c7('0xa')](),controller[_0x96c7('0xc')]);router[_0x96c7('0x9')]('/:id/fields',auth[_0x96c7('0xa')](),controller[_0x96c7('0xd')]);router[_0x96c7('0x9')](_0x96c7('0xe'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x96c7('0x9')](_0x96c7('0xf'),auth['isAuthenticated'](),controller[_0x96c7('0x10')]);router[_0x96c7('0x11')]('/',auth['isAuthenticated'](),controller[_0x96c7('0x12')]);router[_0x96c7('0x13')]('/:id',auth[_0x96c7('0xa')](),controller['update']);router[_0x96c7('0x14')](_0x96c7('0xb'),auth[_0x96c7('0xa')](),controller[_0x96c7('0x15')]);module[_0x96c7('0x16')]=router; \ No newline at end of file +var _0x6f83=['delete','/:id','destroy','exports','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./intDynamics365Configuration.controller','isAuthenticated','index','get','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','put'];(function(_0x3d113c,_0x2af312){var _0x13570c=function(_0x509dbd){while(--_0x509dbd){_0x3d113c['push'](_0x3d113c['shift']());}};_0x13570c(++_0x2af312);}(_0x6f83,0x154));var _0x36f8=function(_0x14b62f,_0x8e5712){_0x14b62f=_0x14b62f-0x0;var _0x4ae938=_0x6f83[_0x14b62f];return _0x4ae938;};'use strict';var multer=require('multer');var util=require(_0x36f8('0x0'));var path=require('path');var timeout=require(_0x36f8('0x1'));var express=require(_0x36f8('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x36f8('0x3'));var interaction=require(_0x36f8('0x4'));var config=require('../../config/environment');var controller=require(_0x36f8('0x5'));router['get']('/',auth[_0x36f8('0x6')](),controller[_0x36f8('0x7')]);router[_0x36f8('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x36f8('0x9')]);router[_0x36f8('0x8')](_0x36f8('0xa'),auth[_0x36f8('0x6')](),controller[_0x36f8('0xb')]);router[_0x36f8('0x8')](_0x36f8('0xc'),auth[_0x36f8('0x6')](),controller['getSubjects']);router[_0x36f8('0x8')](_0x36f8('0xd'),auth['isAuthenticated'](),controller[_0x36f8('0xe')]);router[_0x36f8('0xf')]('/',auth[_0x36f8('0x6')](),controller['create']);router[_0x36f8('0x10')]('/:id',auth[_0x36f8('0x6')](),controller['update']);router[_0x36f8('0x11')](_0x36f8('0x12'),auth[_0x36f8('0x6')](),controller[_0x36f8('0x13')]);module[_0x36f8('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index c262329..4af4490 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 _0xc46c=['incident','phonecall','sequelize','exports','STRING','ENUM'];(function(_0x4df7c6,_0x1b537a){var _0x5e58ce=function(_0x32ced9){while(--_0x32ced9){_0x4df7c6['push'](_0x4df7c6['shift']());}};_0x5e58ce(++_0x1b537a);}(_0xc46c,0x158));var _0xcc46=function(_0x322522,_0x4db288){_0x322522=_0x322522-0x0;var _0x293bcf=_0xc46c[_0x322522];return _0x293bcf;};'use strict';var Sequelize=require(_0xcc46('0x0'));module[_0xcc46('0x1')]={'name':{'type':Sequelize[_0xcc46('0x2')]},'description':{'type':Sequelize[_0xcc46('0x2')]},'ticketType':{'type':Sequelize[_0xcc46('0x3')](_0xcc46('0x4'),_0xcc46('0x5')),'defaultValue':_0xcc46('0x4')}}; \ No newline at end of file +var _0x239e=['incident','sequelize','exports','STRING'];(function(_0x396965,_0x449109){var _0x44e345=function(_0x2edca9){while(--_0x2edca9){_0x396965['push'](_0x396965['shift']());}};_0x44e345(++_0x449109);}(_0x239e,0x199));var _0xe239=function(_0x59162a,_0x10e547){_0x59162a=_0x59162a-0x0;var _0x35e50d=_0x239e[_0x59162a];return _0x35e50d;};'use strict';var Sequelize=require(_0xe239('0x0'));module[_0xe239('0x1')]={'name':{'type':Sequelize[_0xe239('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0xe239('0x3'),'phonecall'),'defaultValue':_0xe239('0x3')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 502f6b4..cf794f5 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 _0x1418=['fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','Dynamics365Configuration','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','keys','catch','create','body','update','find','getFields','findOne','Dynamics365Field','rawAttributes','sort','nolimit','getSubjects','getDescriptions','order','rimraf','request-promise','moment','util','ejs'];(function(_0x37e2a6,_0xc52f3d){var _0x3c4754=function(_0x2d8ffb){while(--_0x2d8ffb){_0x37e2a6['push'](_0x37e2a6['shift']());}};_0x3c4754(++_0xc52f3d);}(_0x1418,0x12f));var _0x8141=function(_0x322bf2,_0x675eaf){_0x322bf2=_0x322bf2-0x0;var _0x5bbda9=_0x1418[_0x322bf2];return _0x5bbda9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8141('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8141('0x1'));var moment=require(_0x8141('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8141('0x3'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8141('0x4'));var fs=require('fs');var fs_extra=require(_0x8141('0x5'));var _=require(_0x8141('0x6'));var squel=require(_0x8141('0x7'));var crypto=require(_0x8141('0x8'));var jsforce=require(_0x8141('0x9'));var deskjs=require(_0x8141('0xa'));var toCsv=require('to-csv');var querystring=require(_0x8141('0xb'));var Papa=require(_0x8141('0xc'));var Redis=require(_0x8141('0xd'));var authService=require(_0x8141('0xe'));var qs=require(_0x8141('0xf'));var as=require(_0x8141('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x8141('0x11'));var config=require(_0x8141('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x8141('0x13'))['db'];function respondWithStatusCode(_0x52be76,_0x129f9b){_0x129f9b=_0x129f9b||0xcc;return function(_0x20860f){if(_0x20860f){return _0x52be76[_0x8141('0x14')](_0x129f9b);}return _0x52be76[_0x8141('0x15')](_0x129f9b)[_0x8141('0x16')]();};}function respondWithResult(_0x343a5e,_0x3a9af5){_0x3a9af5=_0x3a9af5||0xc8;return function(_0x3eeccb){if(_0x3eeccb){return _0x343a5e[_0x8141('0x15')](_0x3a9af5)[_0x8141('0x17')](_0x3eeccb);}};}function respondWithFilteredResult(_0x36e814,_0x2a5b70){return function(_0x359be9){if(_0x359be9){var _0x16f541=typeof _0x2a5b70['offset']===_0x8141('0x18')&&typeof _0x2a5b70['limit']==='undefined';var _0x1fa78c=_0x359be9[_0x8141('0x19')];var _0x2e32c1=_0x16f541?0x0:_0x2a5b70[_0x8141('0x1a')];var _0x2b2190=_0x16f541?_0x359be9[_0x8141('0x19')]:_0x2a5b70['offset']+_0x2a5b70['limit'];var _0x892cc2;if(_0x2b2190>=_0x1fa78c){_0x2b2190=_0x1fa78c;_0x892cc2=0xc8;}else{_0x892cc2=0xce;}_0x36e814['status'](_0x892cc2);return _0x36e814[_0x8141('0x1b')](_0x8141('0x1c'),_0x2e32c1+'-'+_0x2b2190+'/'+_0x1fa78c)['json'](_0x359be9);}return null;};}function patchUpdates(_0x19a801){return function(_0x30ea1b){try{jsonpatch[_0x8141('0x1d')](_0x30ea1b,_0x19a801,!![]);}catch(_0x5d7faf){return BPromise[_0x8141('0x1e')](_0x5d7faf);}return _0x30ea1b[_0x8141('0x1f')]();};}function saveUpdates(_0x3ee7c0,_0x450612){return function(_0x1fd942){if(_0x1fd942){return _0x1fd942['update'](_0x3ee7c0)['then'](function(_0x4aa490){return _0x4aa490;});}return null;};}function removeEntity(_0x31a5fe,_0x3d764b){return function(_0x4449c9){if(_0x4449c9){return _0x4449c9[_0x8141('0x20')]()[_0x8141('0x21')](function(){_0x31a5fe['status'](0xcc)[_0x8141('0x16')]();});}};}function handleEntityNotFound(_0x261d5d,_0x25be8a){return function(_0x952cc5){if(!_0x952cc5){_0x261d5d[_0x8141('0x14')](0x194);}return _0x952cc5;};}function handleError(_0x374513,_0x5ed58d){_0x5ed58d=_0x5ed58d||0x1f4;return function(_0x27c3e1){logger[_0x8141('0x22')](_0x27c3e1['stack']);if(_0x27c3e1[_0x8141('0x23')]){delete _0x27c3e1['name'];}_0x374513['status'](_0x5ed58d)[_0x8141('0x24')](_0x27c3e1);};}exports[_0x8141('0x25')]=function(_0x38b090,_0xfaec65){var _0x472db9={},_0x211ddb={},_0x52b604={'count':0x0,'rows':[]};var _0x4c8437=_[_0x8141('0x26')](db[_0x8141('0x27')]['rawAttributes'],function(_0x8061a6){return{'name':_0x8061a6[_0x8141('0x28')],'type':_0x8061a6[_0x8141('0x29')]['key']};});_0x211ddb[_0x8141('0x2a')]=_[_0x8141('0x26')](_0x4c8437,_0x8141('0x23'));_0x211ddb[_0x8141('0x2b')]=_['keys'](_0x38b090['query']);_0x211ddb[_0x8141('0x2c')]=_[_0x8141('0x2d')](_0x211ddb[_0x8141('0x2a')],_0x211ddb[_0x8141('0x2b')]);_0x472db9[_0x8141('0x2e')]=_[_0x8141('0x2d')](_0x211ddb['model'],qs['fields'](_0x38b090['query'][_0x8141('0x2f')]));_0x472db9[_0x8141('0x2e')]=_0x472db9[_0x8141('0x2e')][_0x8141('0x30')]?_0x472db9[_0x8141('0x2e')]:_0x211ddb[_0x8141('0x2a')];if(!_0x38b090[_0x8141('0x2b')][_0x8141('0x31')]('nolimit')){_0x472db9[_0x8141('0x32')]=qs[_0x8141('0x32')](_0x38b090['query'][_0x8141('0x32')]);_0x472db9[_0x8141('0x1a')]=qs[_0x8141('0x1a')](_0x38b090[_0x8141('0x2b')][_0x8141('0x1a')]);}_0x472db9['order']=qs['sort'](_0x38b090[_0x8141('0x2b')]['sort']);_0x472db9[_0x8141('0x33')]=qs['filters'](_[_0x8141('0x34')](_0x38b090[_0x8141('0x2b')],_0x211ddb[_0x8141('0x2c')]),_0x4c8437);if(_0x38b090[_0x8141('0x2b')][_0x8141('0x35')]){_0x472db9['where']=_[_0x8141('0x36')](_0x472db9['where'],{'$or':_['map'](_0x4c8437,function(_0x2c3832){if(_0x2c3832[_0x8141('0x29')]!=='VIRTUAL'){var _0x59c681={};_0x59c681[_0x2c3832['name']]={'$like':'%'+_0x38b090['query']['filter']+'%'};return _0x59c681;}})});}_0x472db9=_[_0x8141('0x36')]({},_0x472db9,_0x38b090[_0x8141('0x37')]);var _0x4dee38={'where':_0x472db9[_0x8141('0x33')]};return db[_0x8141('0x27')][_0x8141('0x19')](_0x4dee38)['then'](function(_0x2f8180){_0x52b604[_0x8141('0x19')]=_0x2f8180;if(_0x38b090['query'][_0x8141('0x38')]){_0x472db9[_0x8141('0x39')]=[{'all':!![]}];}return db[_0x8141('0x27')][_0x8141('0x3a')](_0x472db9);})[_0x8141('0x21')](function(_0x1adcdd){_0x52b604[_0x8141('0x3b')]=_0x1adcdd;return _0x52b604;})[_0x8141('0x21')](respondWithFilteredResult(_0xfaec65,_0x472db9))['catch'](handleError(_0xfaec65,null));};exports[_0x8141('0x3c')]=function(_0x49a767,_0x9afa0){var _0x336fe5={'raw':![],'where':{'id':_0x49a767[_0x8141('0x3d')]['id']}},_0x336f21={};_0x336f21[_0x8141('0x2a')]=_[_0x8141('0x3e')](db[_0x8141('0x27')]['rawAttributes']);_0x336f21[_0x8141('0x2b')]=_[_0x8141('0x3e')](_0x49a767['query']);_0x336f21[_0x8141('0x2c')]=_[_0x8141('0x2d')](_0x336f21['model'],_0x336f21['query']);_0x336fe5[_0x8141('0x2e')]=_[_0x8141('0x2d')](_0x336f21[_0x8141('0x2a')],qs['fields'](_0x49a767[_0x8141('0x2b')]['fields']));_0x336fe5[_0x8141('0x2e')]=_0x336fe5[_0x8141('0x2e')][_0x8141('0x30')]?_0x336fe5[_0x8141('0x2e')]:_0x336f21[_0x8141('0x2a')];if(_0x49a767[_0x8141('0x2b')][_0x8141('0x38')]){_0x336fe5[_0x8141('0x39')]=[{'all':!![]}];}_0x336fe5=_[_0x8141('0x36')]({},_0x336fe5,_0x49a767[_0x8141('0x37')]);return db['Dynamics365Configuration']['find'](_0x336fe5)[_0x8141('0x21')](handleEntityNotFound(_0x9afa0,null))[_0x8141('0x21')](respondWithResult(_0x9afa0,null))[_0x8141('0x3f')](handleError(_0x9afa0,null));};exports[_0x8141('0x40')]=function(_0x45a721,_0x302d77){return db[_0x8141('0x27')]['create'](_0x45a721[_0x8141('0x41')],{})[_0x8141('0x21')](respondWithResult(_0x302d77,0xc9))[_0x8141('0x3f')](handleError(_0x302d77,null));};exports[_0x8141('0x42')]=function(_0x21fd9d,_0x198999){if(_0x21fd9d[_0x8141('0x41')]['id']){delete _0x21fd9d['body']['id'];}return db[_0x8141('0x27')][_0x8141('0x43')]({'where':{'id':_0x21fd9d[_0x8141('0x3d')]['id']}})[_0x8141('0x21')](handleEntityNotFound(_0x198999,null))[_0x8141('0x21')](saveUpdates(_0x21fd9d[_0x8141('0x41')],null))[_0x8141('0x21')](respondWithResult(_0x198999,null))[_0x8141('0x3f')](handleError(_0x198999,null));};exports['destroy']=function(_0xc4c8b2,_0x5c551e){return db['Dynamics365Configuration'][_0x8141('0x43')]({'where':{'id':_0xc4c8b2['params']['id']}})[_0x8141('0x21')](handleEntityNotFound(_0x5c551e,null))[_0x8141('0x21')](removeEntity(_0x5c551e,null))[_0x8141('0x3f')](handleError(_0x5c551e,null));};exports[_0x8141('0x44')]=function(_0x38a899,_0x46ee22,_0x5b7b15){var _0x4a0722={};var _0x1369dc={};var _0x292e51;var _0x4dc006;return db[_0x8141('0x27')][_0x8141('0x45')]({'where':{'id':_0x38a899[_0x8141('0x3d')]['id']}})[_0x8141('0x21')](handleEntityNotFound(_0x46ee22,null))[_0x8141('0x21')](function(_0x3dc0c8){if(_0x3dc0c8){_0x292e51=_0x3dc0c8;_0x1369dc['model']=_[_0x8141('0x3e')](db[_0x8141('0x46')][_0x8141('0x47')]);_0x1369dc[_0x8141('0x2b')]=_[_0x8141('0x3e')](_0x38a899[_0x8141('0x2b')]);_0x1369dc['filters']=_[_0x8141('0x2d')](_0x1369dc['model'],_0x1369dc[_0x8141('0x2b')]);_0x4a0722[_0x8141('0x2e')]=_['intersection'](_0x1369dc[_0x8141('0x2a')],qs[_0x8141('0x2f')](_0x38a899[_0x8141('0x2b')][_0x8141('0x2f')]));_0x4a0722[_0x8141('0x2e')]=_0x4a0722['attributes'][_0x8141('0x30')]?_0x4a0722['attributes']:_0x1369dc['model'];_0x4a0722['order']=qs[_0x8141('0x48')](_0x38a899[_0x8141('0x2b')]['sort']);_0x4a0722[_0x8141('0x33')]=qs[_0x8141('0x2c')](_['pick'](_0x38a899['query'],_0x1369dc[_0x8141('0x2c')]));if(_0x38a899[_0x8141('0x2b')][_0x8141('0x35')]){_0x4a0722[_0x8141('0x33')]=_['merge'](_0x4a0722[_0x8141('0x33')],{'$or':_[_0x8141('0x26')](_0x4a0722[_0x8141('0x2e')],function(_0x1193e9){var _0x58f704={};_0x58f704[_0x1193e9]={'$like':'%'+_0x38a899[_0x8141('0x2b')][_0x8141('0x35')]+'%'};return _0x58f704;})});}_0x4a0722=_[_0x8141('0x36')]({},_0x4a0722,_0x38a899[_0x8141('0x37')]);return _0x292e51[_0x8141('0x44')](_0x4a0722);}})[_0x8141('0x21')](function(_0x4df9af){if(_0x4df9af){_0x4dc006=_0x4df9af['length'];if(!_0x38a899[_0x8141('0x2b')][_0x8141('0x31')](_0x8141('0x49'))){_0x4a0722[_0x8141('0x32')]=qs[_0x8141('0x32')](_0x38a899[_0x8141('0x2b')][_0x8141('0x32')]);_0x4a0722[_0x8141('0x1a')]=qs[_0x8141('0x1a')](_0x38a899[_0x8141('0x2b')][_0x8141('0x1a')]);}return _0x292e51[_0x8141('0x44')](_0x4a0722);}})[_0x8141('0x21')](function(_0x5c1073){if(_0x5c1073){return _0x5c1073?{'count':_0x4dc006,'rows':_0x5c1073}:null;}})['then'](respondWithResult(_0x46ee22,null))[_0x8141('0x3f')](handleError(_0x46ee22,null));};exports[_0x8141('0x4a')]=function(_0x4a45e8,_0x4dfe71,_0x54ba7f){var _0x59034f={};var _0x4e0394={};var _0x2bbc8b;var _0x4bb89c;return db[_0x8141('0x27')][_0x8141('0x45')]({'where':{'id':_0x4a45e8[_0x8141('0x3d')]['id']}})[_0x8141('0x21')](handleEntityNotFound(_0x4dfe71,null))['then'](function(_0x3e3f67){if(_0x3e3f67){_0x2bbc8b=_0x3e3f67;_0x4e0394[_0x8141('0x2a')]=_[_0x8141('0x3e')](db[_0x8141('0x46')]['rawAttributes']);_0x4e0394[_0x8141('0x2b')]=_[_0x8141('0x3e')](_0x4a45e8[_0x8141('0x2b')]);_0x4e0394[_0x8141('0x2c')]=_[_0x8141('0x2d')](_0x4e0394['model'],_0x4e0394[_0x8141('0x2b')]);_0x59034f[_0x8141('0x2e')]=_['intersection'](_0x4e0394[_0x8141('0x2a')],qs[_0x8141('0x2f')](_0x4a45e8[_0x8141('0x2b')][_0x8141('0x2f')]));_0x59034f[_0x8141('0x2e')]=_0x59034f[_0x8141('0x2e')][_0x8141('0x30')]?_0x59034f[_0x8141('0x2e')]:_0x4e0394[_0x8141('0x2a')];_0x59034f['order']=qs[_0x8141('0x48')](_0x4a45e8[_0x8141('0x2b')]['sort']);_0x59034f[_0x8141('0x33')]=qs[_0x8141('0x2c')](_[_0x8141('0x34')](_0x4a45e8['query'],_0x4e0394['filters']));if(_0x4a45e8[_0x8141('0x2b')][_0x8141('0x35')]){_0x59034f[_0x8141('0x33')]=_[_0x8141('0x36')](_0x59034f[_0x8141('0x33')],{'$or':_[_0x8141('0x26')](_0x59034f[_0x8141('0x2e')],function(_0x497730){var _0x335c3f={};_0x335c3f[_0x497730]={'$like':'%'+_0x4a45e8[_0x8141('0x2b')][_0x8141('0x35')]+'%'};return _0x335c3f;})});}_0x59034f=_[_0x8141('0x36')]({},_0x59034f,_0x4a45e8[_0x8141('0x37')]);return _0x2bbc8b[_0x8141('0x4a')](_0x59034f);}})[_0x8141('0x21')](function(_0x26fb71){if(_0x26fb71){_0x4bb89c=_0x26fb71['length'];if(!_0x4a45e8[_0x8141('0x2b')][_0x8141('0x31')](_0x8141('0x49'))){_0x59034f[_0x8141('0x32')]=qs[_0x8141('0x32')](_0x4a45e8[_0x8141('0x2b')]['limit']);_0x59034f['offset']=qs[_0x8141('0x1a')](_0x4a45e8['query'][_0x8141('0x1a')]);}return _0x2bbc8b['getSubjects'](_0x59034f);}})[_0x8141('0x21')](function(_0x47be71){if(_0x47be71){return _0x47be71?{'count':_0x4bb89c,'rows':_0x47be71}:null;}})[_0x8141('0x21')](respondWithResult(_0x4dfe71,null))[_0x8141('0x3f')](handleError(_0x4dfe71,null));};exports[_0x8141('0x4b')]=function(_0x272099,_0x309a7a,_0x286bc6){var _0x263fe7={};var _0x3154b8={};var _0x119687;var _0x28a6ca;return db[_0x8141('0x27')][_0x8141('0x45')]({'where':{'id':_0x272099[_0x8141('0x3d')]['id']}})['then'](handleEntityNotFound(_0x309a7a,null))[_0x8141('0x21')](function(_0x4002bc){if(_0x4002bc){_0x119687=_0x4002bc;_0x3154b8[_0x8141('0x2a')]=_[_0x8141('0x3e')](db[_0x8141('0x46')][_0x8141('0x47')]);_0x3154b8[_0x8141('0x2b')]=_[_0x8141('0x3e')](_0x272099['query']);_0x3154b8[_0x8141('0x2c')]=_[_0x8141('0x2d')](_0x3154b8[_0x8141('0x2a')],_0x3154b8[_0x8141('0x2b')]);_0x263fe7['attributes']=_[_0x8141('0x2d')](_0x3154b8[_0x8141('0x2a')],qs[_0x8141('0x2f')](_0x272099[_0x8141('0x2b')]['fields']));_0x263fe7[_0x8141('0x2e')]=_0x263fe7[_0x8141('0x2e')][_0x8141('0x30')]?_0x263fe7['attributes']:_0x3154b8[_0x8141('0x2a')];_0x263fe7[_0x8141('0x4c')]=qs[_0x8141('0x48')](_0x272099[_0x8141('0x2b')]['sort']);_0x263fe7['where']=qs['filters'](_[_0x8141('0x34')](_0x272099[_0x8141('0x2b')],_0x3154b8[_0x8141('0x2c')]));if(_0x272099[_0x8141('0x2b')][_0x8141('0x35')]){_0x263fe7[_0x8141('0x33')]=_['merge'](_0x263fe7[_0x8141('0x33')],{'$or':_['map'](_0x263fe7[_0x8141('0x2e')],function(_0x1eee34){var _0x317c7d={};_0x317c7d[_0x1eee34]={'$like':'%'+_0x272099[_0x8141('0x2b')]['filter']+'%'};return _0x317c7d;})});}_0x263fe7=_[_0x8141('0x36')]({},_0x263fe7,_0x272099[_0x8141('0x37')]);return _0x119687[_0x8141('0x4b')](_0x263fe7);}})[_0x8141('0x21')](function(_0x5a6183){if(_0x5a6183){_0x28a6ca=_0x5a6183[_0x8141('0x30')];if(!_0x272099['query'][_0x8141('0x31')](_0x8141('0x49'))){_0x263fe7['limit']=qs[_0x8141('0x32')](_0x272099[_0x8141('0x2b')][_0x8141('0x32')]);_0x263fe7[_0x8141('0x1a')]=qs[_0x8141('0x1a')](_0x272099['query'][_0x8141('0x1a')]);}return _0x119687[_0x8141('0x4b')](_0x263fe7);}})['then'](function(_0x1af713){if(_0x1af713){return _0x1af713?{'count':_0x28a6ca,'rows':_0x1af713}:null;}})[_0x8141('0x21')](respondWithResult(_0x309a7a,null))[_0x8141('0x3f')](handleError(_0x309a7a,null));}; \ No newline at end of file +var _0xd070=['querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','include','catch','show','params','length','includeAll','find','create','body','getFields','findOne','Dynamics365Field','getSubjects','order','pick','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv'];(function(_0x84f57c,_0x2ea321){var _0x37507a=function(_0x2fc746){while(--_0x2fc746){_0x84f57c['push'](_0x84f57c['shift']());}};_0x37507a(++_0x2ea321);}(_0xd070,0xe2));var _0x0d07=function(_0x4391ba,_0x3370a4){_0x4391ba=_0x4391ba-0x0;var _0x59af1d=_0xd070[_0x4391ba];return _0x59af1d;};'use strict';var emlformat=require(_0x0d07('0x0'));var rimraf=require(_0x0d07('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0d07('0x2'));var rp=require(_0x0d07('0x3'));var moment=require(_0x0d07('0x4'));var BPromise=require(_0x0d07('0x5'));var Mustache=require(_0x0d07('0x6'));var util=require(_0x0d07('0x7'));var path=require(_0x0d07('0x8'));var sox=require(_0x0d07('0x9'));var csv=require('to-csv');var ejs=require(_0x0d07('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0d07('0xb'));var squel=require(_0x0d07('0xc'));var crypto=require(_0x0d07('0xd'));var jsforce=require(_0x0d07('0xe'));var deskjs=require(_0x0d07('0xf'));var toCsv=require(_0x0d07('0x10'));var querystring=require(_0x0d07('0x11'));var Papa=require('papaparse');var Redis=require(_0x0d07('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x0d07('0x13'));var as=require(_0x0d07('0x14'));var hardwareService=require(_0x0d07('0x15'));var logger=require(_0x0d07('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x0d07('0x17'));var licenseUtil=require(_0x0d07('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d3bb4,_0x2c5197){_0x2c5197=_0x2c5197||0xcc;return function(_0x20864a){if(_0x20864a){return _0x2d3bb4['sendStatus'](_0x2c5197);}return _0x2d3bb4[_0x0d07('0x19')](_0x2c5197)[_0x0d07('0x1a')]();};}function respondWithResult(_0x2e9b0e,_0x37c033){_0x37c033=_0x37c033||0xc8;return function(_0x2fbcd8){if(_0x2fbcd8){return _0x2e9b0e[_0x0d07('0x19')](_0x37c033)[_0x0d07('0x1b')](_0x2fbcd8);}};}function respondWithFilteredResult(_0x191e7b,_0x17bf7c){return function(_0x48dbab){if(_0x48dbab){var _0x3b6172=typeof _0x17bf7c[_0x0d07('0x1c')]===_0x0d07('0x1d')&&typeof _0x17bf7c[_0x0d07('0x1e')]===_0x0d07('0x1d');var _0x3ce127=_0x48dbab[_0x0d07('0x1f')];var _0x68ef6b=_0x3b6172?0x0:_0x17bf7c[_0x0d07('0x1c')];var _0xbe7672=_0x3b6172?_0x48dbab[_0x0d07('0x1f')]:_0x17bf7c[_0x0d07('0x1c')]+_0x17bf7c[_0x0d07('0x1e')];var _0xeb26f;if(_0xbe7672>=_0x3ce127){_0xbe7672=_0x3ce127;_0xeb26f=0xc8;}else{_0xeb26f=0xce;}_0x191e7b['status'](_0xeb26f);return _0x191e7b[_0x0d07('0x20')](_0x0d07('0x21'),_0x68ef6b+'-'+_0xbe7672+'/'+_0x3ce127)[_0x0d07('0x1b')](_0x48dbab);}return null;};}function patchUpdates(_0x4ab3a5){return function(_0x3d5b65){try{jsonpatch[_0x0d07('0x22')](_0x3d5b65,_0x4ab3a5,!![]);}catch(_0x54afb4){return BPromise[_0x0d07('0x23')](_0x54afb4);}return _0x3d5b65[_0x0d07('0x24')]();};}function saveUpdates(_0x5e978a,_0x278caa){return function(_0x4c2543){if(_0x4c2543){return _0x4c2543[_0x0d07('0x25')](_0x5e978a)['then'](function(_0x172f6e){return _0x172f6e;});}return null;};}function removeEntity(_0x34fd4a,_0x489e78){return function(_0x40445e){if(_0x40445e){return _0x40445e[_0x0d07('0x26')]()[_0x0d07('0x27')](function(){_0x34fd4a[_0x0d07('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44b8ae,_0x548ffe){return function(_0x5f4d45){if(!_0x5f4d45){_0x44b8ae['sendStatus'](0x194);}return _0x5f4d45;};}function handleError(_0x512f4d,_0x438af3){_0x438af3=_0x438af3||0x1f4;return function(_0xdd6f5a){logger[_0x0d07('0x28')](_0xdd6f5a[_0x0d07('0x29')]);if(_0xdd6f5a[_0x0d07('0x2a')]){delete _0xdd6f5a[_0x0d07('0x2a')];}_0x512f4d[_0x0d07('0x19')](_0x438af3)[_0x0d07('0x2b')](_0xdd6f5a);};}exports[_0x0d07('0x2c')]=function(_0x639c56,_0x11ee61){var _0x4988a8={},_0x37f2f8={},_0x49fc1e={'count':0x0,'rows':[]};var _0x196c45=_[_0x0d07('0x2d')](db[_0x0d07('0x2e')][_0x0d07('0x2f')],function(_0x5104c8){return{'name':_0x5104c8[_0x0d07('0x30')],'type':_0x5104c8['type']['key']};});_0x37f2f8['model']=_[_0x0d07('0x2d')](_0x196c45,_0x0d07('0x2a'));_0x37f2f8[_0x0d07('0x31')]=_[_0x0d07('0x32')](_0x639c56[_0x0d07('0x31')]);_0x37f2f8[_0x0d07('0x33')]=_[_0x0d07('0x34')](_0x37f2f8['model'],_0x37f2f8['query']);_0x4988a8[_0x0d07('0x35')]=_[_0x0d07('0x34')](_0x37f2f8[_0x0d07('0x36')],qs[_0x0d07('0x37')](_0x639c56[_0x0d07('0x31')][_0x0d07('0x37')]));_0x4988a8[_0x0d07('0x35')]=_0x4988a8[_0x0d07('0x35')]['length']?_0x4988a8[_0x0d07('0x35')]:_0x37f2f8[_0x0d07('0x36')];if(!_0x639c56[_0x0d07('0x31')][_0x0d07('0x38')](_0x0d07('0x39'))){_0x4988a8['limit']=qs[_0x0d07('0x1e')](_0x639c56['query'][_0x0d07('0x1e')]);_0x4988a8[_0x0d07('0x1c')]=qs['offset'](_0x639c56[_0x0d07('0x31')]['offset']);}_0x4988a8['order']=qs[_0x0d07('0x3a')](_0x639c56[_0x0d07('0x31')]['sort']);_0x4988a8[_0x0d07('0x3b')]=qs[_0x0d07('0x33')](_['pick'](_0x639c56[_0x0d07('0x31')],_0x37f2f8[_0x0d07('0x33')]),_0x196c45);if(_0x639c56[_0x0d07('0x31')][_0x0d07('0x3c')]){_0x4988a8[_0x0d07('0x3b')]=_[_0x0d07('0x3d')](_0x4988a8['where'],{'$or':_[_0x0d07('0x2d')](_0x196c45,function(_0x12d5d4){if(_0x12d5d4[_0x0d07('0x3e')]!==_0x0d07('0x3f')){var _0x397c8f={};_0x397c8f[_0x12d5d4[_0x0d07('0x2a')]]={'$like':'%'+_0x639c56['query']['filter']+'%'};return _0x397c8f;}})});}_0x4988a8=_[_0x0d07('0x3d')]({},_0x4988a8,_0x639c56[_0x0d07('0x40')]);var _0x278ba6={'where':_0x4988a8[_0x0d07('0x3b')]};return db[_0x0d07('0x2e')][_0x0d07('0x1f')](_0x278ba6)[_0x0d07('0x27')](function(_0x4cee29){_0x49fc1e[_0x0d07('0x1f')]=_0x4cee29;if(_0x639c56[_0x0d07('0x31')]['includeAll']){_0x4988a8[_0x0d07('0x41')]=[{'all':!![]}];}return db[_0x0d07('0x2e')]['findAll'](_0x4988a8);})[_0x0d07('0x27')](function(_0x4071c8){_0x49fc1e['rows']=_0x4071c8;return _0x49fc1e;})['then'](respondWithFilteredResult(_0x11ee61,_0x4988a8))[_0x0d07('0x42')](handleError(_0x11ee61,null));};exports[_0x0d07('0x43')]=function(_0x419b6d,_0x22db1e){var _0x4b4d98={'raw':![],'where':{'id':_0x419b6d[_0x0d07('0x44')]['id']}},_0x4a7e53={};_0x4a7e53[_0x0d07('0x36')]=_['keys'](db['Dynamics365Configuration'][_0x0d07('0x2f')]);_0x4a7e53[_0x0d07('0x31')]=_[_0x0d07('0x32')](_0x419b6d[_0x0d07('0x31')]);_0x4a7e53[_0x0d07('0x33')]=_[_0x0d07('0x34')](_0x4a7e53[_0x0d07('0x36')],_0x4a7e53[_0x0d07('0x31')]);_0x4b4d98[_0x0d07('0x35')]=_[_0x0d07('0x34')](_0x4a7e53[_0x0d07('0x36')],qs[_0x0d07('0x37')](_0x419b6d['query']['fields']));_0x4b4d98[_0x0d07('0x35')]=_0x4b4d98[_0x0d07('0x35')][_0x0d07('0x45')]?_0x4b4d98['attributes']:_0x4a7e53[_0x0d07('0x36')];if(_0x419b6d[_0x0d07('0x31')][_0x0d07('0x46')]){_0x4b4d98['include']=[{'all':!![]}];}_0x4b4d98=_[_0x0d07('0x3d')]({},_0x4b4d98,_0x419b6d[_0x0d07('0x40')]);return db[_0x0d07('0x2e')][_0x0d07('0x47')](_0x4b4d98)[_0x0d07('0x27')](handleEntityNotFound(_0x22db1e,null))[_0x0d07('0x27')](respondWithResult(_0x22db1e,null))['catch'](handleError(_0x22db1e,null));};exports['create']=function(_0x643e46,_0x8e8174){return db['Dynamics365Configuration'][_0x0d07('0x48')](_0x643e46[_0x0d07('0x49')],{})[_0x0d07('0x27')](respondWithResult(_0x8e8174,0xc9))[_0x0d07('0x42')](handleError(_0x8e8174,null));};exports[_0x0d07('0x25')]=function(_0x440e2d,_0x6d1db0){if(_0x440e2d[_0x0d07('0x49')]['id']){delete _0x440e2d[_0x0d07('0x49')]['id'];}return db['Dynamics365Configuration'][_0x0d07('0x47')]({'where':{'id':_0x440e2d[_0x0d07('0x44')]['id']}})[_0x0d07('0x27')](handleEntityNotFound(_0x6d1db0,null))['then'](saveUpdates(_0x440e2d[_0x0d07('0x49')],null))['then'](respondWithResult(_0x6d1db0,null))[_0x0d07('0x42')](handleError(_0x6d1db0,null));};exports['destroy']=function(_0x28f90b,_0x3c7fc3){return db[_0x0d07('0x2e')][_0x0d07('0x47')]({'where':{'id':_0x28f90b[_0x0d07('0x44')]['id']}})[_0x0d07('0x27')](handleEntityNotFound(_0x3c7fc3,null))[_0x0d07('0x27')](removeEntity(_0x3c7fc3,null))[_0x0d07('0x42')](handleError(_0x3c7fc3,null));};exports[_0x0d07('0x4a')]=function(_0x59c082,_0x194b6d,_0x1c5d1f){var _0x141e1d={};var _0x3c192d={};var _0x35bf34;var _0x9095c7;return db[_0x0d07('0x2e')][_0x0d07('0x4b')]({'where':{'id':_0x59c082[_0x0d07('0x44')]['id']}})[_0x0d07('0x27')](handleEntityNotFound(_0x194b6d,null))[_0x0d07('0x27')](function(_0x3022a3){if(_0x3022a3){_0x35bf34=_0x3022a3;_0x3c192d[_0x0d07('0x36')]=_[_0x0d07('0x32')](db[_0x0d07('0x4c')][_0x0d07('0x2f')]);_0x3c192d[_0x0d07('0x31')]=_[_0x0d07('0x32')](_0x59c082[_0x0d07('0x31')]);_0x3c192d[_0x0d07('0x33')]=_[_0x0d07('0x34')](_0x3c192d[_0x0d07('0x36')],_0x3c192d[_0x0d07('0x31')]);_0x141e1d['attributes']=_[_0x0d07('0x34')](_0x3c192d['model'],qs[_0x0d07('0x37')](_0x59c082[_0x0d07('0x31')][_0x0d07('0x37')]));_0x141e1d[_0x0d07('0x35')]=_0x141e1d[_0x0d07('0x35')][_0x0d07('0x45')]?_0x141e1d[_0x0d07('0x35')]:_0x3c192d['model'];_0x141e1d['order']=qs[_0x0d07('0x3a')](_0x59c082[_0x0d07('0x31')][_0x0d07('0x3a')]);_0x141e1d[_0x0d07('0x3b')]=qs[_0x0d07('0x33')](_['pick'](_0x59c082[_0x0d07('0x31')],_0x3c192d['filters']));if(_0x59c082[_0x0d07('0x31')]['filter']){_0x141e1d[_0x0d07('0x3b')]=_[_0x0d07('0x3d')](_0x141e1d['where'],{'$or':_[_0x0d07('0x2d')](_0x141e1d['attributes'],function(_0x46745a){var _0x4e11ab={};_0x4e11ab[_0x46745a]={'$like':'%'+_0x59c082[_0x0d07('0x31')]['filter']+'%'};return _0x4e11ab;})});}_0x141e1d=_[_0x0d07('0x3d')]({},_0x141e1d,_0x59c082[_0x0d07('0x40')]);return _0x35bf34[_0x0d07('0x4a')](_0x141e1d);}})[_0x0d07('0x27')](function(_0x5e92ff){if(_0x5e92ff){_0x9095c7=_0x5e92ff['length'];if(!_0x59c082[_0x0d07('0x31')]['hasOwnProperty'](_0x0d07('0x39'))){_0x141e1d['limit']=qs['limit'](_0x59c082[_0x0d07('0x31')][_0x0d07('0x1e')]);_0x141e1d[_0x0d07('0x1c')]=qs[_0x0d07('0x1c')](_0x59c082[_0x0d07('0x31')][_0x0d07('0x1c')]);}return _0x35bf34[_0x0d07('0x4a')](_0x141e1d);}})['then'](function(_0xc9440){if(_0xc9440){return _0xc9440?{'count':_0x9095c7,'rows':_0xc9440}:null;}})[_0x0d07('0x27')](respondWithResult(_0x194b6d,null))[_0x0d07('0x42')](handleError(_0x194b6d,null));};exports[_0x0d07('0x4d')]=function(_0x4ff190,_0x47579c,_0x195000){var _0x20c0fd={};var _0xeef7f3={};var _0x388643;var _0x4196d7;return db[_0x0d07('0x2e')][_0x0d07('0x4b')]({'where':{'id':_0x4ff190[_0x0d07('0x44')]['id']}})[_0x0d07('0x27')](handleEntityNotFound(_0x47579c,null))[_0x0d07('0x27')](function(_0x1b576d){if(_0x1b576d){_0x388643=_0x1b576d;_0xeef7f3[_0x0d07('0x36')]=_['keys'](db[_0x0d07('0x4c')][_0x0d07('0x2f')]);_0xeef7f3[_0x0d07('0x31')]=_[_0x0d07('0x32')](_0x4ff190[_0x0d07('0x31')]);_0xeef7f3['filters']=_[_0x0d07('0x34')](_0xeef7f3[_0x0d07('0x36')],_0xeef7f3['query']);_0x20c0fd[_0x0d07('0x35')]=_[_0x0d07('0x34')](_0xeef7f3['model'],qs[_0x0d07('0x37')](_0x4ff190[_0x0d07('0x31')][_0x0d07('0x37')]));_0x20c0fd['attributes']=_0x20c0fd[_0x0d07('0x35')][_0x0d07('0x45')]?_0x20c0fd[_0x0d07('0x35')]:_0xeef7f3[_0x0d07('0x36')];_0x20c0fd[_0x0d07('0x4e')]=qs[_0x0d07('0x3a')](_0x4ff190[_0x0d07('0x31')]['sort']);_0x20c0fd[_0x0d07('0x3b')]=qs[_0x0d07('0x33')](_[_0x0d07('0x4f')](_0x4ff190[_0x0d07('0x31')],_0xeef7f3[_0x0d07('0x33')]));if(_0x4ff190[_0x0d07('0x31')][_0x0d07('0x3c')]){_0x20c0fd[_0x0d07('0x3b')]=_[_0x0d07('0x3d')](_0x20c0fd['where'],{'$or':_['map'](_0x20c0fd[_0x0d07('0x35')],function(_0x1b212c){var _0x11e7f4={};_0x11e7f4[_0x1b212c]={'$like':'%'+_0x4ff190[_0x0d07('0x31')]['filter']+'%'};return _0x11e7f4;})});}_0x20c0fd=_[_0x0d07('0x3d')]({},_0x20c0fd,_0x4ff190[_0x0d07('0x40')]);return _0x388643[_0x0d07('0x4d')](_0x20c0fd);}})[_0x0d07('0x27')](function(_0x4d6eb8){if(_0x4d6eb8){_0x4196d7=_0x4d6eb8[_0x0d07('0x45')];if(!_0x4ff190['query'][_0x0d07('0x38')](_0x0d07('0x39'))){_0x20c0fd[_0x0d07('0x1e')]=qs[_0x0d07('0x1e')](_0x4ff190[_0x0d07('0x31')]['limit']);_0x20c0fd[_0x0d07('0x1c')]=qs[_0x0d07('0x1c')](_0x4ff190['query'][_0x0d07('0x1c')]);}return _0x388643[_0x0d07('0x4d')](_0x20c0fd);}})[_0x0d07('0x27')](function(_0x3cff06){if(_0x3cff06){return _0x3cff06?{'count':_0x4196d7,'rows':_0x3cff06}:null;}})[_0x0d07('0x27')](respondWithResult(_0x47579c,null))[_0x0d07('0x42')](handleError(_0x47579c,null));};exports[_0x0d07('0x50')]=function(_0x15b8e3,_0x3f23af,_0xc1abeb){var _0x106921={};var _0x16bcc={};var _0x440c5b;var _0x4e3037;return db[_0x0d07('0x2e')][_0x0d07('0x4b')]({'where':{'id':_0x15b8e3['params']['id']}})[_0x0d07('0x27')](handleEntityNotFound(_0x3f23af,null))[_0x0d07('0x27')](function(_0x53deba){if(_0x53deba){_0x440c5b=_0x53deba;_0x16bcc[_0x0d07('0x36')]=_[_0x0d07('0x32')](db[_0x0d07('0x4c')]['rawAttributes']);_0x16bcc[_0x0d07('0x31')]=_[_0x0d07('0x32')](_0x15b8e3['query']);_0x16bcc[_0x0d07('0x33')]=_[_0x0d07('0x34')](_0x16bcc[_0x0d07('0x36')],_0x16bcc[_0x0d07('0x31')]);_0x106921[_0x0d07('0x35')]=_[_0x0d07('0x34')](_0x16bcc['model'],qs[_0x0d07('0x37')](_0x15b8e3[_0x0d07('0x31')][_0x0d07('0x37')]));_0x106921[_0x0d07('0x35')]=_0x106921['attributes'][_0x0d07('0x45')]?_0x106921[_0x0d07('0x35')]:_0x16bcc['model'];_0x106921['order']=qs[_0x0d07('0x3a')](_0x15b8e3[_0x0d07('0x31')]['sort']);_0x106921[_0x0d07('0x3b')]=qs[_0x0d07('0x33')](_['pick'](_0x15b8e3[_0x0d07('0x31')],_0x16bcc[_0x0d07('0x33')]));if(_0x15b8e3['query'][_0x0d07('0x3c')]){_0x106921['where']=_[_0x0d07('0x3d')](_0x106921['where'],{'$or':_[_0x0d07('0x2d')](_0x106921[_0x0d07('0x35')],function(_0xbcf5a1){var _0x4ca961={};_0x4ca961[_0xbcf5a1]={'$like':'%'+_0x15b8e3[_0x0d07('0x31')]['filter']+'%'};return _0x4ca961;})});}_0x106921=_[_0x0d07('0x3d')]({},_0x106921,_0x15b8e3['options']);return _0x440c5b[_0x0d07('0x50')](_0x106921);}})[_0x0d07('0x27')](function(_0x528776){if(_0x528776){_0x4e3037=_0x528776[_0x0d07('0x45')];if(!_0x15b8e3[_0x0d07('0x31')][_0x0d07('0x38')]('nolimit')){_0x106921[_0x0d07('0x1e')]=qs[_0x0d07('0x1e')](_0x15b8e3[_0x0d07('0x31')][_0x0d07('0x1e')]);_0x106921[_0x0d07('0x1c')]=qs[_0x0d07('0x1c')](_0x15b8e3[_0x0d07('0x31')][_0x0d07('0x1c')]);}return _0x440c5b['getDescriptions'](_0x106921);}})[_0x0d07('0x27')](function(_0x4b2eb2){if(_0x4b2eb2){return _0x4b2eb2?{'count':_0x4e3037,'rows':_0x4b2eb2}:null;}})[_0x0d07('0x27')](respondWithResult(_0x3f23af,null))[_0x0d07('0x42')](handleError(_0x3f23af,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 26a0674..b043589 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 _0x9bde=['request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util','api','bluebird'];(function(_0x2c67a9,_0x37c2df){var _0x578b9c=function(_0x335f3d){while(--_0x335f3d){_0x2c67a9['push'](_0x2c67a9['shift']());}};_0x578b9c(++_0x37c2df);}(_0x9bde,0xe1));var _0xe9bd=function(_0x58b6fe,_0x80c95d){_0x58b6fe=_0x58b6fe-0x0;var _0x442ad2=_0x9bde[_0x58b6fe];return _0x442ad2;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var moment=require('moment');var BPromise=require(_0xe9bd('0x2'));var rp=require(_0xe9bd('0x3'));var fs=require('fs');var path=require(_0xe9bd('0x4'));var rimraf=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var attributes=require(_0xe9bd('0x7'));module[_0xe9bd('0x8')]=function(_0x4fd7b8,_0x4763e9){return _0x4fd7b8[_0xe9bd('0x9')](_0xe9bd('0xa'),attributes,{'tableName':_0xe9bd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e74=['exports','Dynamics365Configuration','int_dynamics365_configurations','lodash','../../config/logger','api','moment','path','../../config/environment','./intDynamics365Configuration.attributes'];(function(_0x56418e,_0x362812){var _0x5b160c=function(_0x5b44cb){while(--_0x5b44cb){_0x56418e['push'](_0x56418e['shift']());}};_0x5b160c(++_0x362812);}(_0x3e74,0x175));var _0x43e7=function(_0x4f1feb,_0x210f6a){_0x4f1feb=_0x4f1feb-0x0;var _0x2a9060=_0x3e74[_0x4f1feb];return _0x2a9060;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 1cb61a5..e227144 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 _0xc64d=['info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','util','moment','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x37dcf8,_0x50437b){var _0x1d121c=function(_0x5bf87f){while(--_0x5bf87f){_0x37dcf8['push'](_0x37dcf8['shift']());}};_0x1d121c(++_0x50437b);}(_0xc64d,0x100));var _0xdc64=function(_0x4ac256,_0x2b6e15){_0x4ac256=_0x4ac256-0x0;var _0x25478e=_0xc64d[_0x4ac256];return _0x25478e;};'use strict';var _=require('lodash');var util=require(_0xdc64('0x0'));var moment=require(_0xdc64('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdc64('0x2'));var logger=require(_0xdc64('0x3'))(_0xdc64('0x4'));var config=require(_0xdc64('0x5'));var jayson=require(_0xdc64('0x6'));var client=jayson[_0xdc64('0x7')][_0xdc64('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x51bf13,_0x2fdac8,_0x5ba6d9){return new BPromise(function(_0x186935,_0x1e3857){return client['request'](_0x51bf13,_0x5ba6d9)[_0xdc64('0x9')](function(_0xcedda1){logger[_0xdc64('0xa')](_0xdc64('0xb'),_0x2fdac8,_0xdc64('0xc'));logger[_0xdc64('0xd')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x2fdac8,'request\x20sent',JSON[_0xdc64('0xe')](_0xcedda1));if(_0xcedda1['error']){if(_0xcedda1[_0xdc64('0xf')]['code']===0x1f4){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x2fdac8,_0xcedda1[_0xdc64('0xf')][_0xdc64('0x10')]);return _0x1e3857(_0xcedda1[_0xdc64('0xf')][_0xdc64('0x10')]);}logger['error'](_0xdc64('0xb'),_0x2fdac8,_0xcedda1['error'][_0xdc64('0x10')]);return _0x186935(_0xcedda1[_0xdc64('0xf')][_0xdc64('0x10')]);}else{logger[_0xdc64('0xa')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2fdac8,'request\x20sent');_0x186935(_0xcedda1[_0xdc64('0x11')][_0xdc64('0x10')]);}})[_0xdc64('0x12')](function(_0x407160){logger[_0xdc64('0xf')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2fdac8,_0x407160);_0x1e3857(_0x407160);});});} \ No newline at end of file +var _0x12e7=['catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result'];(function(_0x160393,_0x39ebd2){var _0xe5321=function(_0x39cd4b){while(--_0x39cd4b){_0x160393['push'](_0x160393['shift']());}};_0xe5321(++_0x39ebd2);}(_0x12e7,0x135));var _0x712e=function(_0x1b14e1,_0xed7e6a){_0x1b14e1=_0x1b14e1-0x0;var _0x46d4ae=_0x12e7[_0x1b14e1];return _0x46d4ae;};'use strict';var _=require(_0x712e('0x0'));var util=require('util');var moment=require(_0x712e('0x1'));var BPromise=require(_0x712e('0x2'));var rs=require(_0x712e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x712e('0x4'));var logger=require(_0x712e('0x5'))(_0x712e('0x6'));var config=require(_0x712e('0x7'));var jayson=require(_0x712e('0x8'));var client=jayson[_0x712e('0x9')][_0x712e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x471766,_0x5bc79b,_0x28dd26){return new BPromise(function(_0x1cb191,_0x5acfdb){return client[_0x712e('0xb')](_0x471766,_0x28dd26)['then'](function(_0x17c70b){logger[_0x712e('0xc')](_0x712e('0xd'),_0x5bc79b,_0x712e('0xe'));logger['debug'](_0x712e('0xf'),_0x5bc79b,_0x712e('0xe'),JSON[_0x712e('0x10')](_0x17c70b));if(_0x17c70b['error']){if(_0x17c70b['error'][_0x712e('0x11')]===0x1f4){logger['error'](_0x712e('0xd'),_0x5bc79b,_0x17c70b[_0x712e('0x12')][_0x712e('0x13')]);return _0x5acfdb(_0x17c70b[_0x712e('0x12')][_0x712e('0x13')]);}logger[_0x712e('0x12')](_0x712e('0xd'),_0x5bc79b,_0x17c70b[_0x712e('0x12')][_0x712e('0x13')]);return _0x1cb191(_0x17c70b[_0x712e('0x12')][_0x712e('0x13')]);}else{logger[_0x712e('0xc')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5bc79b,_0x712e('0xe'));_0x1cb191(_0x17c70b[_0x712e('0x14')][_0x712e('0x13')]);}})[_0x712e('0x15')](function(_0x1c4d25){logger['error'](_0x712e('0xd'),_0x5bc79b,_0x1c4d25);_0x5acfdb(_0x1c4d25);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index d01fe9c..613197c 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 _0x28c6=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','post','create','update','destroy'];(function(_0x2d3f28,_0x58fdf4){var _0x456b31=function(_0x5a4154){while(--_0x5a4154){_0x2d3f28['push'](_0x2d3f28['shift']());}};_0x456b31(++_0x58fdf4);}(_0x28c6,0x132));var _0x628c=function(_0x2468b5,_0x506b9e){_0x2468b5=_0x2468b5-0x0;var _0x1056e4=_0x28c6[_0x2468b5];return _0x1056e4;};'use strict';var multer=require(_0x628c('0x0'));var util=require(_0x628c('0x1'));var path=require(_0x628c('0x2'));var timeout=require(_0x628c('0x3'));var express=require(_0x628c('0x4'));var router=express[_0x628c('0x5')]();var fs_extra=require(_0x628c('0x6'));var auth=require(_0x628c('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x628c('0x8'));var controller=require(_0x628c('0x9'));router[_0x628c('0xa')]('/',auth[_0x628c('0xb')](),controller[_0x628c('0xc')]);router['get'](_0x628c('0xd'),auth[_0x628c('0xb')](),controller['show']);router[_0x628c('0xe')]('/',auth[_0x628c('0xb')](),controller[_0x628c('0xf')]);router['put']('/:id',auth[_0x628c('0xb')](),controller[_0x628c('0x10')]);router['delete'](_0x628c('0xd'),auth[_0x628c('0xb')](),controller[_0x628c('0x11')]);module['exports']=router; \ No newline at end of file +var _0x0137=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x5a42d9,_0x2d397e){var _0x190cf2=function(_0x57430a){while(--_0x57430a){_0x5a42d9['push'](_0x5a42d9['shift']());}};_0x190cf2(++_0x2d397e);}(_0x0137,0x1c9));var _0x7013=function(_0x35d294,_0x3a9b4){_0x35d294=_0x35d294-0x0;var _0xb9ae9a=_0x0137[_0x35d294];return _0xb9ae9a;};'use strict';var multer=require(_0x7013('0x0'));var util=require(_0x7013('0x1'));var path=require(_0x7013('0x2'));var timeout=require(_0x7013('0x3'));var express=require(_0x7013('0x4'));var router=express[_0x7013('0x5')]();var fs_extra=require(_0x7013('0x6'));var auth=require(_0x7013('0x7'));var interaction=require(_0x7013('0x8'));var config=require(_0x7013('0x9'));var controller=require(_0x7013('0xa'));router[_0x7013('0xb')]('/',auth[_0x7013('0xc')](),controller[_0x7013('0xd')]);router['get'](_0x7013('0xe'),auth[_0x7013('0xc')](),controller[_0x7013('0xf')]);router[_0x7013('0x10')]('/',auth[_0x7013('0xc')](),controller[_0x7013('0x11')]);router[_0x7013('0x12')](_0x7013('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x7013('0x13')](_0x7013('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x7013('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index e4820f2..2431d76 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 _0x80ba=['sequelize','ENUM','string','variable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x2da357,_0x1f9b2f){var _0x138fdd=function(_0xe3077d){while(--_0xe3077d){_0x2da357['push'](_0x2da357['shift']());}};_0x138fdd(++_0x1f9b2f);}(_0x80ba,0x1a0));var _0xa80b=function(_0x30810d,_0x519cbe){_0x30810d=_0x30810d-0x0;var _0x56388f=_0x80ba[_0x30810d];return _0x56388f;};'use strict';var Sequelize=require(_0xa80b('0x0'));module['exports']={'type':{'type':Sequelize[_0xa80b('0x1')](_0xa80b('0x2'),_0xa80b('0x3'),'customVariable',_0xa80b('0x4'),_0xa80b('0x5')),'defaultValue':_0xa80b('0x2')},'content':{'type':Sequelize[_0xa80b('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xa80b('0x1')](_0xa80b('0x2'),_0xa80b('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xa80b('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xa80b('0x6')]},'customField':{'type':Sequelize[_0xa80b('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa80b('0x6')]}}; \ No newline at end of file +var _0xaba9=['picklist','string','STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue'];(function(_0x187f46,_0x43754f){var _0x1acf6b=function(_0x3204bd){while(--_0x3204bd){_0x187f46['push'](_0x187f46['shift']());}};_0x1acf6b(++_0x43754f);}(_0xaba9,0x1bc));var _0x9aba=function(_0x4c9250,_0x2acdd8){_0x4c9250=_0x4c9250-0x0;var _0x41bae8=_0xaba9[_0x4c9250];return _0x41bae8;};'use strict';var Sequelize=require(_0x9aba('0x0'));module[_0x9aba('0x1')]={'type':{'type':Sequelize[_0x9aba('0x2')]('string',_0x9aba('0x3'),_0x9aba('0x4'),_0x9aba('0x5'),_0x9aba('0x6')),'defaultValue':_0x9aba('0x7')},'content':{'type':Sequelize[_0x9aba('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x9aba('0x2')](_0x9aba('0x7'),'variable',_0x9aba('0x4'))},'keyContent':{'type':Sequelize[_0x9aba('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x9aba('0x8')]},'customField':{'type':Sequelize[_0x9aba('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9aba('0x8')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index accc8bf..976a7ac 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 _0x9224=['includeAll','include','Dynamics365Field','findAll','rows','catch','show','attributes','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options'];(function(_0x431b45,_0x40b3c8){var _0x21b559=function(_0x25fb10){while(--_0x25fb10){_0x431b45['push'](_0x431b45['shift']());}};_0x21b559(++_0x40b3c8);}(_0x9224,0x1bc));var _0x4922=function(_0x3853e9,_0x4bc67e){_0x3853e9=_0x3853e9-0x0;var _0x46e85f=_0x9224[_0x3853e9];return _0x46e85f;};'use strict';var emlformat=require(_0x4922('0x0'));var rimraf=require(_0x4922('0x1'));var zipdir=require(_0x4922('0x2'));var jsonpatch=require(_0x4922('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4922('0x4'));var Mustache=require(_0x4922('0x5'));var util=require('util');var path=require(_0x4922('0x6'));var sox=require('sox');var csv=require(_0x4922('0x7'));var ejs=require(_0x4922('0x8'));var fs=require('fs');var fs_extra=require(_0x4922('0x9'));var _=require(_0x4922('0xa'));var squel=require(_0x4922('0xb'));var crypto=require(_0x4922('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4922('0xd'));var Papa=require(_0x4922('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4922('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4922('0x10'))(_0x4922('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4922('0x12'));var db=require(_0x4922('0x13'))['db'];function respondWithStatusCode(_0x4ced26,_0x931925){_0x931925=_0x931925||0xcc;return function(_0x367f89){if(_0x367f89){return _0x4ced26[_0x4922('0x14')](_0x931925);}return _0x4ced26['status'](_0x931925)[_0x4922('0x15')]();};}function respondWithResult(_0x3a3230,_0x3da736){_0x3da736=_0x3da736||0xc8;return function(_0x45828b){if(_0x45828b){return _0x3a3230[_0x4922('0x16')](_0x3da736)[_0x4922('0x17')](_0x45828b);}};}function respondWithFilteredResult(_0x42acd3,_0x1558d8){return function(_0x57565a){if(_0x57565a){var _0x239f2e=typeof _0x1558d8[_0x4922('0x18')]===_0x4922('0x19')&&typeof _0x1558d8['limit']===_0x4922('0x19');var _0x2834f4=_0x57565a[_0x4922('0x1a')];var _0x2fc825=_0x239f2e?0x0:_0x1558d8[_0x4922('0x18')];var _0x28819d=_0x239f2e?_0x57565a[_0x4922('0x1a')]:_0x1558d8[_0x4922('0x18')]+_0x1558d8[_0x4922('0x1b')];var _0x57bbc4;if(_0x28819d>=_0x2834f4){_0x28819d=_0x2834f4;_0x57bbc4=0xc8;}else{_0x57bbc4=0xce;}_0x42acd3[_0x4922('0x16')](_0x57bbc4);return _0x42acd3['set'](_0x4922('0x1c'),_0x2fc825+'-'+_0x28819d+'/'+_0x2834f4)[_0x4922('0x17')](_0x57565a);}return null;};}function patchUpdates(_0x47e033){return function(_0x12b682){try{jsonpatch[_0x4922('0x1d')](_0x12b682,_0x47e033,!![]);}catch(_0x59a31f){return BPromise[_0x4922('0x1e')](_0x59a31f);}return _0x12b682[_0x4922('0x1f')]();};}function saveUpdates(_0x4e5211,_0x2febe0){return function(_0x4d9e98){if(_0x4d9e98){return _0x4d9e98[_0x4922('0x20')](_0x4e5211)[_0x4922('0x21')](function(_0x229e88){return _0x229e88;});}return null;};}function removeEntity(_0x37b6cb,_0xf3fc32){return function(_0xfbfd5e){if(_0xfbfd5e){return _0xfbfd5e[_0x4922('0x22')]()[_0x4922('0x21')](function(){_0x37b6cb[_0x4922('0x16')](0xcc)[_0x4922('0x15')]();});}};}function handleEntityNotFound(_0x1ca234,_0x1be276){return function(_0x508458){if(!_0x508458){_0x1ca234[_0x4922('0x14')](0x194);}return _0x508458;};}function handleError(_0x2bdc26,_0x67fd90){_0x67fd90=_0x67fd90||0x1f4;return function(_0x3d1771){logger['error'](_0x3d1771[_0x4922('0x23')]);if(_0x3d1771[_0x4922('0x24')]){delete _0x3d1771[_0x4922('0x24')];}_0x2bdc26[_0x4922('0x16')](_0x67fd90)[_0x4922('0x25')](_0x3d1771);};}exports[_0x4922('0x26')]=function(_0x36b961,_0x426528){var _0x41252b={},_0x262307={},_0x40e815={'count':0x0,'rows':[]};var _0x53ad4e=_[_0x4922('0x27')](db['Dynamics365Field'][_0x4922('0x28')],function(_0x8be362){return{'name':_0x8be362[_0x4922('0x29')],'type':_0x8be362[_0x4922('0x2a')][_0x4922('0x2b')]};});_0x262307[_0x4922('0x2c')]=_[_0x4922('0x27')](_0x53ad4e,'name');_0x262307['query']=_[_0x4922('0x2d')](_0x36b961[_0x4922('0x2e')]);_0x262307[_0x4922('0x2f')]=_[_0x4922('0x30')](_0x262307['model'],_0x262307[_0x4922('0x2e')]);_0x41252b['attributes']=_[_0x4922('0x30')](_0x262307[_0x4922('0x2c')],qs[_0x4922('0x31')](_0x36b961[_0x4922('0x2e')][_0x4922('0x31')]));_0x41252b['attributes']=_0x41252b['attributes'][_0x4922('0x32')]?_0x41252b['attributes']:_0x262307['model'];if(!_0x36b961[_0x4922('0x2e')][_0x4922('0x33')](_0x4922('0x34'))){_0x41252b[_0x4922('0x1b')]=qs[_0x4922('0x1b')](_0x36b961[_0x4922('0x2e')][_0x4922('0x1b')]);_0x41252b[_0x4922('0x18')]=qs[_0x4922('0x18')](_0x36b961[_0x4922('0x2e')]['offset']);}_0x41252b[_0x4922('0x35')]=qs[_0x4922('0x36')](_0x36b961[_0x4922('0x2e')][_0x4922('0x36')]);_0x41252b[_0x4922('0x37')]=qs[_0x4922('0x2f')](_['pick'](_0x36b961['query'],_0x262307[_0x4922('0x2f')]),_0x53ad4e);if(_0x36b961['query'][_0x4922('0x38')]){_0x41252b[_0x4922('0x37')]=_[_0x4922('0x39')](_0x41252b[_0x4922('0x37')],{'$or':_['map'](_0x53ad4e,function(_0x50180f){if(_0x50180f[_0x4922('0x2a')]!==_0x4922('0x3a')){var _0x2ae276={};_0x2ae276[_0x50180f[_0x4922('0x24')]]={'$like':'%'+_0x36b961[_0x4922('0x2e')][_0x4922('0x38')]+'%'};return _0x2ae276;}})});}_0x41252b=_[_0x4922('0x39')]({},_0x41252b,_0x36b961[_0x4922('0x3b')]);var _0x400ce2={'where':_0x41252b[_0x4922('0x37')]};return db['Dynamics365Field'][_0x4922('0x1a')](_0x400ce2)[_0x4922('0x21')](function(_0x23c576){_0x40e815[_0x4922('0x1a')]=_0x23c576;if(_0x36b961['query'][_0x4922('0x3c')]){_0x41252b[_0x4922('0x3d')]=[{'all':!![]}];}return db[_0x4922('0x3e')][_0x4922('0x3f')](_0x41252b);})[_0x4922('0x21')](function(_0x130ac7){_0x40e815[_0x4922('0x40')]=_0x130ac7;return _0x40e815;})[_0x4922('0x21')](respondWithFilteredResult(_0x426528,_0x41252b))[_0x4922('0x41')](handleError(_0x426528,null));};exports[_0x4922('0x42')]=function(_0x4fedaf,_0x398f9c){var _0x1d83db={'raw':!![],'where':{'id':_0x4fedaf['params']['id']}},_0x7ab5e={};_0x7ab5e[_0x4922('0x2c')]=_[_0x4922('0x2d')](db[_0x4922('0x3e')][_0x4922('0x28')]);_0x7ab5e[_0x4922('0x2e')]=_[_0x4922('0x2d')](_0x4fedaf[_0x4922('0x2e')]);_0x7ab5e[_0x4922('0x2f')]=_[_0x4922('0x30')](_0x7ab5e[_0x4922('0x2c')],_0x7ab5e[_0x4922('0x2e')]);_0x1d83db[_0x4922('0x43')]=_[_0x4922('0x30')](_0x7ab5e['model'],qs['fields'](_0x4fedaf[_0x4922('0x2e')]['fields']));_0x1d83db['attributes']=_0x1d83db[_0x4922('0x43')][_0x4922('0x32')]?_0x1d83db[_0x4922('0x43')]:_0x7ab5e['model'];if(_0x4fedaf[_0x4922('0x2e')][_0x4922('0x3c')]){_0x1d83db[_0x4922('0x3d')]=[{'all':!![]}];}_0x1d83db=_[_0x4922('0x39')]({},_0x1d83db,_0x4fedaf['options']);return db['Dynamics365Field'][_0x4922('0x44')](_0x1d83db)[_0x4922('0x21')](handleEntityNotFound(_0x398f9c,null))[_0x4922('0x21')](respondWithResult(_0x398f9c,null))[_0x4922('0x41')](handleError(_0x398f9c,null));};exports[_0x4922('0x45')]=function(_0xc50983,_0xed5b3a){return db[_0x4922('0x3e')][_0x4922('0x45')](_0xc50983[_0x4922('0x46')],{})[_0x4922('0x21')](respondWithResult(_0xed5b3a,0xc9))[_0x4922('0x41')](handleError(_0xed5b3a,null));};exports[_0x4922('0x20')]=function(_0x194074,_0xc177a1){if(_0x194074[_0x4922('0x46')]['id']){delete _0x194074[_0x4922('0x46')]['id'];}return db['Dynamics365Field'][_0x4922('0x44')]({'where':{'id':_0x194074['params']['id']}})[_0x4922('0x21')](handleEntityNotFound(_0xc177a1,null))[_0x4922('0x21')](saveUpdates(_0x194074[_0x4922('0x46')],null))[_0x4922('0x21')](respondWithResult(_0xc177a1,null))[_0x4922('0x41')](handleError(_0xc177a1,null));};exports[_0x4922('0x22')]=function(_0x1f5d6a,_0xaf4966){return db[_0x4922('0x3e')][_0x4922('0x44')]({'where':{'id':_0x1f5d6a[_0x4922('0x47')]['id']}})['then'](handleEntityNotFound(_0xaf4966,null))['then'](removeEntity(_0xaf4966,null))['catch'](handleError(_0xaf4966,null));}; \ No newline at end of file +var _0x44a0=['create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','rows','catch','params','includeAll','find'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x44a0,0xe0));var _0x044a=function(_0x14a1b4,_0x2c72b0){_0x14a1b4=_0x14a1b4-0x0;var _0x3cb209=_0x44a0[_0x14a1b4];return _0x3cb209;};'use strict';var emlformat=require(_0x044a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x044a('0x1'));var jsonpatch=require(_0x044a('0x2'));var rp=require('request-promise');var moment=require(_0x044a('0x3'));var BPromise=require(_0x044a('0x4'));var Mustache=require(_0x044a('0x5'));var util=require(_0x044a('0x6'));var path=require(_0x044a('0x7'));var sox=require(_0x044a('0x8'));var csv=require(_0x044a('0x9'));var ejs=require(_0x044a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x044a('0xb'));var crypto=require('crypto');var jsforce=require(_0x044a('0xc'));var deskjs=require(_0x044a('0xd'));var toCsv=require('to-csv');var querystring=require(_0x044a('0xe'));var Papa=require(_0x044a('0xf'));var Redis=require('ioredis');var authService=require(_0x044a('0x10'));var qs=require(_0x044a('0x11'));var as=require(_0x044a('0x12'));var hardwareService=require(_0x044a('0x13'));var logger=require(_0x044a('0x14'))('api');var utils=require(_0x044a('0x15'));var config=require(_0x044a('0x16'));var licenseUtil=require(_0x044a('0x17'));var db=require(_0x044a('0x18'))['db'];function respondWithStatusCode(_0x27371e,_0x55a5e1){_0x55a5e1=_0x55a5e1||0xcc;return function(_0x543390){if(_0x543390){return _0x27371e[_0x044a('0x19')](_0x55a5e1);}return _0x27371e[_0x044a('0x1a')](_0x55a5e1)['end']();};}function respondWithResult(_0xbd7197,_0x358835){_0x358835=_0x358835||0xc8;return function(_0x44442b){if(_0x44442b){return _0xbd7197[_0x044a('0x1a')](_0x358835)[_0x044a('0x1b')](_0x44442b);}};}function respondWithFilteredResult(_0x52c0ab,_0x44e21d){return function(_0xdad96f){if(_0xdad96f){var _0x5b6c71=typeof _0x44e21d[_0x044a('0x1c')]===_0x044a('0x1d')&&typeof _0x44e21d[_0x044a('0x1e')]==='undefined';var _0x2b28f3=_0xdad96f[_0x044a('0x1f')];var _0x44dbc2=_0x5b6c71?0x0:_0x44e21d[_0x044a('0x1c')];var _0x125e43=_0x5b6c71?_0xdad96f[_0x044a('0x1f')]:_0x44e21d[_0x044a('0x1c')]+_0x44e21d[_0x044a('0x1e')];var _0x23420a;if(_0x125e43>=_0x2b28f3){_0x125e43=_0x2b28f3;_0x23420a=0xc8;}else{_0x23420a=0xce;}_0x52c0ab['status'](_0x23420a);return _0x52c0ab[_0x044a('0x20')](_0x044a('0x21'),_0x44dbc2+'-'+_0x125e43+'/'+_0x2b28f3)[_0x044a('0x1b')](_0xdad96f);}return null;};}function patchUpdates(_0x456474){return function(_0x1bf753){try{jsonpatch[_0x044a('0x22')](_0x1bf753,_0x456474,!![]);}catch(_0x46f37f){return BPromise[_0x044a('0x23')](_0x46f37f);}return _0x1bf753[_0x044a('0x24')]();};}function saveUpdates(_0x2bcd37,_0x59aedf){return function(_0x59a788){if(_0x59a788){return _0x59a788[_0x044a('0x25')](_0x2bcd37)[_0x044a('0x26')](function(_0x43ae9b){return _0x43ae9b;});}return null;};}function removeEntity(_0x397e52,_0x5e9987){return function(_0x278b89){if(_0x278b89){return _0x278b89[_0x044a('0x27')]()[_0x044a('0x26')](function(){_0x397e52[_0x044a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xec1e72,_0x14f157){return function(_0x21d6ba){if(!_0x21d6ba){_0xec1e72['sendStatus'](0x194);}return _0x21d6ba;};}function handleError(_0x2f9510,_0x6a46bf){_0x6a46bf=_0x6a46bf||0x1f4;return function(_0x4737d1){logger['error'](_0x4737d1[_0x044a('0x28')]);if(_0x4737d1[_0x044a('0x29')]){delete _0x4737d1[_0x044a('0x29')];}_0x2f9510[_0x044a('0x1a')](_0x6a46bf)[_0x044a('0x2a')](_0x4737d1);};}exports['index']=function(_0x47b3d9,_0x462eea){var _0x127b87={},_0x5658e0={},_0x590ee2={'count':0x0,'rows':[]};var _0x1ae27a=_[_0x044a('0x2b')](db[_0x044a('0x2c')][_0x044a('0x2d')],function(_0x2da931){return{'name':_0x2da931[_0x044a('0x2e')],'type':_0x2da931[_0x044a('0x2f')][_0x044a('0x30')]};});_0x5658e0[_0x044a('0x31')]=_['map'](_0x1ae27a,_0x044a('0x29'));_0x5658e0[_0x044a('0x32')]=_[_0x044a('0x33')](_0x47b3d9['query']);_0x5658e0['filters']=_[_0x044a('0x34')](_0x5658e0[_0x044a('0x31')],_0x5658e0[_0x044a('0x32')]);_0x127b87[_0x044a('0x35')]=_[_0x044a('0x34')](_0x5658e0[_0x044a('0x31')],qs[_0x044a('0x36')](_0x47b3d9[_0x044a('0x32')][_0x044a('0x36')]));_0x127b87[_0x044a('0x35')]=_0x127b87[_0x044a('0x35')][_0x044a('0x37')]?_0x127b87[_0x044a('0x35')]:_0x5658e0[_0x044a('0x31')];if(!_0x47b3d9[_0x044a('0x32')]['hasOwnProperty'](_0x044a('0x38'))){_0x127b87[_0x044a('0x1e')]=qs['limit'](_0x47b3d9[_0x044a('0x32')][_0x044a('0x1e')]);_0x127b87[_0x044a('0x1c')]=qs[_0x044a('0x1c')](_0x47b3d9[_0x044a('0x32')][_0x044a('0x1c')]);}_0x127b87[_0x044a('0x39')]=qs[_0x044a('0x3a')](_0x47b3d9[_0x044a('0x32')]['sort']);_0x127b87[_0x044a('0x3b')]=qs[_0x044a('0x3c')](_[_0x044a('0x3d')](_0x47b3d9[_0x044a('0x32')],_0x5658e0['filters']),_0x1ae27a);if(_0x47b3d9['query'][_0x044a('0x3e')]){_0x127b87['where']=_[_0x044a('0x3f')](_0x127b87[_0x044a('0x3b')],{'$or':_[_0x044a('0x2b')](_0x1ae27a,function(_0x2de065){if(_0x2de065[_0x044a('0x2f')]!==_0x044a('0x40')){var _0x42c7a4={};_0x42c7a4[_0x2de065['name']]={'$like':'%'+_0x47b3d9[_0x044a('0x32')][_0x044a('0x3e')]+'%'};return _0x42c7a4;}})});}_0x127b87=_[_0x044a('0x3f')]({},_0x127b87,_0x47b3d9[_0x044a('0x41')]);var _0x195fc3={'where':_0x127b87[_0x044a('0x3b')]};return db[_0x044a('0x2c')][_0x044a('0x1f')](_0x195fc3)[_0x044a('0x26')](function(_0x442711){_0x590ee2[_0x044a('0x1f')]=_0x442711;if(_0x47b3d9[_0x044a('0x32')]['includeAll']){_0x127b87[_0x044a('0x42')]=[{'all':!![]}];}return db[_0x044a('0x2c')]['findAll'](_0x127b87);})[_0x044a('0x26')](function(_0x27b433){_0x590ee2[_0x044a('0x43')]=_0x27b433;return _0x590ee2;})[_0x044a('0x26')](respondWithFilteredResult(_0x462eea,_0x127b87))[_0x044a('0x44')](handleError(_0x462eea,null));};exports['show']=function(_0x39d720,_0x16cd50){var _0x4d432f={'raw':!![],'where':{'id':_0x39d720[_0x044a('0x45')]['id']}},_0x38ebef={};_0x38ebef[_0x044a('0x31')]=_[_0x044a('0x33')](db[_0x044a('0x2c')][_0x044a('0x2d')]);_0x38ebef[_0x044a('0x32')]=_['keys'](_0x39d720[_0x044a('0x32')]);_0x38ebef[_0x044a('0x3c')]=_[_0x044a('0x34')](_0x38ebef[_0x044a('0x31')],_0x38ebef['query']);_0x4d432f[_0x044a('0x35')]=_[_0x044a('0x34')](_0x38ebef[_0x044a('0x31')],qs[_0x044a('0x36')](_0x39d720[_0x044a('0x32')][_0x044a('0x36')]));_0x4d432f[_0x044a('0x35')]=_0x4d432f[_0x044a('0x35')][_0x044a('0x37')]?_0x4d432f[_0x044a('0x35')]:_0x38ebef[_0x044a('0x31')];if(_0x39d720[_0x044a('0x32')][_0x044a('0x46')]){_0x4d432f['include']=[{'all':!![]}];}_0x4d432f=_['merge']({},_0x4d432f,_0x39d720['options']);return db[_0x044a('0x2c')][_0x044a('0x47')](_0x4d432f)[_0x044a('0x26')](handleEntityNotFound(_0x16cd50,null))[_0x044a('0x26')](respondWithResult(_0x16cd50,null))[_0x044a('0x44')](handleError(_0x16cd50,null));};exports[_0x044a('0x48')]=function(_0x898c6d,_0x5cb5b8){return db[_0x044a('0x2c')][_0x044a('0x48')](_0x898c6d[_0x044a('0x49')],{})[_0x044a('0x26')](respondWithResult(_0x5cb5b8,0xc9))[_0x044a('0x44')](handleError(_0x5cb5b8,null));};exports['update']=function(_0x27510b,_0x3d2c37){if(_0x27510b['body']['id']){delete _0x27510b[_0x044a('0x49')]['id'];}return db[_0x044a('0x2c')]['find']({'where':{'id':_0x27510b['params']['id']}})[_0x044a('0x26')](handleEntityNotFound(_0x3d2c37,null))[_0x044a('0x26')](saveUpdates(_0x27510b['body'],null))[_0x044a('0x26')](respondWithResult(_0x3d2c37,null))[_0x044a('0x44')](handleError(_0x3d2c37,null));};exports[_0x044a('0x27')]=function(_0x16e8fa,_0x42ac6a){return db['Dynamics365Field']['find']({'where':{'id':_0x16e8fa['params']['id']}})[_0x044a('0x26')](handleEntityNotFound(_0x42ac6a,null))['then'](removeEntity(_0x42ac6a,null))[_0x044a('0x44')](handleError(_0x42ac6a,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 3b8a02c..1ceaf50 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 _0xa268=['rimraf','./intDynamics365Field.attributes','exports','define','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','util','moment','request-promise','path'];(function(_0x1266e5,_0x414df8){var _0x13c49b=function(_0x9c22e1){while(--_0x9c22e1){_0x1266e5['push'](_0x1266e5['shift']());}};_0x13c49b(++_0x414df8);}(_0xa268,0x98));var _0x8a26=function(_0x5a0b57,_0x2ebef9){_0x5a0b57=_0x5a0b57-0x0;var _0x49404b=_0xa268[_0x5a0b57];return _0x49404b;};'use strict';var _=require('lodash');var util=require(_0x8a26('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x8a26('0x1'));var BPromise=require('bluebird');var rp=require(_0x8a26('0x2'));var fs=require('fs');var path=require(_0x8a26('0x3'));var rimraf=require(_0x8a26('0x4'));var config=require('../../config/environment');var attributes=require(_0x8a26('0x5'));module[_0x8a26('0x6')]=function(_0x19656f,_0x49ec93){return _0x19656f[_0x8a26('0x7')]('Dynamics365Field',attributes,{'tableName':_0x8a26('0x8'),'paranoid':![],'indexes':[{'name':_0x8a26('0x9'),'fields':[_0x8a26('0xa'),_0x8a26('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9f05=['bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','Dynamics365Field','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x19e2c7,_0xac99df){var _0x13cbcb=function(_0x44e8ff){while(--_0x44e8ff){_0x19e2c7['push'](_0x19e2c7['shift']());}};_0x13cbcb(++_0xac99df);}(_0x9f05,0x14e));var _0x59f0=function(_0x407700,_0x92e265){_0x407700=_0x407700-0x0;var _0x4d0d69=_0x9f05[_0x407700];return _0x4d0d69;};'use strict';var _=require(_0x59f0('0x0'));var util=require(_0x59f0('0x1'));var logger=require(_0x59f0('0x2'))(_0x59f0('0x3'));var moment=require('moment');var BPromise=require(_0x59f0('0x4'));var rp=require(_0x59f0('0x5'));var fs=require('fs');var path=require(_0x59f0('0x6'));var rimraf=require(_0x59f0('0x7'));var config=require(_0x59f0('0x8'));var attributes=require(_0x59f0('0x9'));module['exports']=function(_0x43d3f9,_0x3a3fc9){return _0x43d3f9['define'](_0x59f0('0xa'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x59f0('0xb'),_0x59f0('0xc')],'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 f141b86..3fed1c1 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 _0x2a94=['error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x2a94,0x139));var _0x42a9=function(_0x30283d,_0x4104a1){_0x30283d=_0x30283d-0x0;var _0x449f51=_0x2a94[_0x30283d];return _0x449f51;};'use strict';var _=require(_0x42a9('0x0'));var util=require(_0x42a9('0x1'));var moment=require(_0x42a9('0x2'));var BPromise=require('bluebird');var rs=require(_0x42a9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x42a9('0x4'))['db'];var utils=require(_0x42a9('0x5'));var logger=require(_0x42a9('0x6'))(_0x42a9('0x7'));var config=require(_0x42a9('0x8'));var jayson=require(_0x42a9('0x9'));var client=jayson[_0x42a9('0xa')][_0x42a9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x348139,_0x39ae59,_0x345363){return new BPromise(function(_0x10d189,_0x3654ee){return client[_0x42a9('0xc')](_0x348139,_0x345363)['then'](function(_0x543a1e){logger['info'](_0x42a9('0xd'),_0x39ae59,'request\x20sent');logger[_0x42a9('0xe')](_0x42a9('0xf'),_0x39ae59,_0x42a9('0x10'),JSON['stringify'](_0x543a1e));if(_0x543a1e[_0x42a9('0x11')]){if(_0x543a1e[_0x42a9('0x11')][_0x42a9('0x12')]===0x1f4){logger[_0x42a9('0x11')](_0x42a9('0xd'),_0x39ae59,_0x543a1e[_0x42a9('0x11')][_0x42a9('0x13')]);return _0x3654ee(_0x543a1e[_0x42a9('0x11')][_0x42a9('0x13')]);}logger[_0x42a9('0x11')](_0x42a9('0xd'),_0x39ae59,_0x543a1e['error'][_0x42a9('0x13')]);return _0x10d189(_0x543a1e[_0x42a9('0x11')][_0x42a9('0x13')]);}else{logger['info'](_0x42a9('0xd'),_0x39ae59,_0x42a9('0x10'));_0x10d189(_0x543a1e[_0x42a9('0x14')][_0x42a9('0x13')]);}})[_0x42a9('0x15')](function(_0x4cbd97){logger[_0x42a9('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x39ae59,_0x4cbd97);_0x3654ee(_0x4cbd97);});});} \ No newline at end of file +var _0x3844=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3844,0x1a2));var _0x4384=function(_0x255a96,_0x1d86f6){_0x255a96=_0x255a96-0x0;var _0x27c957=_0x3844[_0x255a96];return _0x27c957;};'use strict';var _=require(_0x4384('0x0'));var util=require(_0x4384('0x1'));var moment=require(_0x4384('0x2'));var BPromise=require(_0x4384('0x3'));var rs=require(_0x4384('0x4'));var fs=require('fs');var Redis=require(_0x4384('0x5'));var db=require(_0x4384('0x6'))['db'];var utils=require(_0x4384('0x7'));var logger=require(_0x4384('0x8'))('rpc');var config=require(_0x4384('0x9'));var jayson=require(_0x4384('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x500d4,_0x176ead,_0x2c4b7b){return new BPromise(function(_0x36535e,_0x470491){return client[_0x4384('0xb')](_0x500d4,_0x2c4b7b)['then'](function(_0x462d0a){logger[_0x4384('0xc')](_0x4384('0xd'),_0x176ead,_0x4384('0xe'));logger['debug'](_0x4384('0xf'),_0x176ead,_0x4384('0xe'),JSON[_0x4384('0x10')](_0x462d0a));if(_0x462d0a[_0x4384('0x11')]){if(_0x462d0a[_0x4384('0x11')][_0x4384('0x12')]===0x1f4){logger[_0x4384('0x11')](_0x4384('0xd'),_0x176ead,_0x462d0a['error'][_0x4384('0x13')]);return _0x470491(_0x462d0a[_0x4384('0x11')][_0x4384('0x13')]);}logger[_0x4384('0x11')](_0x4384('0xd'),_0x176ead,_0x462d0a[_0x4384('0x11')]['message']);return _0x36535e(_0x462d0a[_0x4384('0x11')][_0x4384('0x13')]);}else{logger[_0x4384('0xc')]('Dynamics365Field,\x20%s,\x20%s',_0x176ead,'request\x20sent');_0x36535e(_0x462d0a['result']['message']);}})['catch'](function(_0x783525){logger[_0x4384('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x176ead,_0x783525);_0x470491(_0x783525);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index be25abd..f4b5b85 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 _0xb55d=['index','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','/:id','update','delete','destroy','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','get','isAuthenticated'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xb55d,0x12b));var _0xdb55=function(_0x2abe18,_0x258093){_0x2abe18=_0x2abe18-0x0;var _0x2c686d=_0xb55d[_0x2abe18];return _0x2c686d;};'use strict';var multer=require(_0xdb55('0x0'));var util=require('util');var path=require(_0xdb55('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdb55('0x2')]();var fs_extra=require(_0xdb55('0x3'));var auth=require(_0xdb55('0x4'));var interaction=require(_0xdb55('0x5'));var config=require('../../config/environment');var controller=require(_0xdb55('0x6'));router[_0xdb55('0x7')]('/',auth[_0xdb55('0x8')](),controller[_0xdb55('0x9')]);router[_0xdb55('0x7')]('/:id',auth[_0xdb55('0x8')](),controller['show']);router[_0xdb55('0x7')](_0xdb55('0xa'),auth[_0xdb55('0x8')](),controller[_0xdb55('0xb')]);router[_0xdb55('0x7')](_0xdb55('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0xdb55('0xd')]('/',auth[_0xdb55('0x8')](),controller[_0xdb55('0xe')]);router[_0xdb55('0xd')](_0xdb55('0xa'),auth[_0xdb55('0x8')](),controller[_0xdb55('0xf')]);router[_0xdb55('0x10')](_0xdb55('0x11'),auth['isAuthenticated'](),controller[_0xdb55('0x12')]);router[_0xdb55('0x13')](_0xdb55('0x11'),auth[_0xdb55('0x8')](),controller[_0xdb55('0x14')]);module[_0xdb55('0x15')]=router; \ No newline at end of file +var _0x81f7=['../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0x81f7,0x157));var _0x781f=function(_0x208fe5,_0x4ab999){_0x208fe5=_0x208fe5-0x0;var _0x43baec=_0x81f7[_0x208fe5];return _0x43baec;};'use strict';var multer=require(_0x781f('0x0'));var util=require(_0x781f('0x1'));var path=require(_0x781f('0x2'));var timeout=require(_0x781f('0x3'));var express=require(_0x781f('0x4'));var router=express['Router']();var fs_extra=require(_0x781f('0x5'));var auth=require(_0x781f('0x6'));var interaction=require(_0x781f('0x7'));var config=require(_0x781f('0x8'));var controller=require(_0x781f('0x9'));router[_0x781f('0xa')]('/',auth[_0x781f('0xb')](),controller[_0x781f('0xc')]);router['get'](_0x781f('0xd'),auth[_0x781f('0xb')](),controller[_0x781f('0xe')]);router[_0x781f('0xa')](_0x781f('0xf'),auth['isAuthenticated'](),controller[_0x781f('0x10')]);router[_0x781f('0xa')]('/:id/fields',auth[_0x781f('0xb')](),controller[_0x781f('0x11')]);router[_0x781f('0x12')]('/',auth[_0x781f('0xb')](),controller[_0x781f('0x13')]);router[_0x781f('0x12')](_0x781f('0xf'),auth[_0x781f('0xb')](),controller[_0x781f('0x14')]);router[_0x781f('0x15')](_0x781f('0xd'),auth[_0x781f('0xb')](),controller[_0x781f('0x16')]);router[_0x781f('0x17')]('/:id',auth[_0x781f('0xb')](),controller[_0x781f('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 58aa782..05abf71 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 _0x6a55=['STRING','sequelize'];(function(_0x485408,_0x30732d){var _0x377466=function(_0x4f8502){while(--_0x4f8502){_0x485408['push'](_0x485408['shift']());}};_0x377466(++_0x30732d);}(_0x6a55,0xdb));var _0x56a5=function(_0x4a6156,_0x2b8ce6){_0x4a6156=_0x4a6156-0x0;var _0x12c1f6=_0x6a55[_0x4a6156];return _0x12c1f6;};'use strict';var Sequelize=require(_0x56a5('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x56a5('0x1')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x56a5('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x56a5('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xb016=['remoteUri','sequelize','exports','STRING'];(function(_0x5519a9,_0x1c5147){var _0x32f2cc=function(_0x52ed58){while(--_0x52ed58){_0x5519a9['push'](_0x5519a9['shift']());}};_0x32f2cc(++_0x1c5147);}(_0xb016,0x159));var _0x6b01=function(_0x1a7757,_0x3c091e){_0x1a7757=_0x1a7757-0x0;var _0x29ddfc=_0xb016[_0x1a7757];return _0x29ddfc;};'use strict';var Sequelize=require(_0x6b01('0x0'));module[_0x6b01('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x6b01('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x6b01('0x2')]},'remoteUri':{'type':Sequelize[_0x6b01('0x2')],'unique':_0x6b01('0x3')},'serverUrl':{'type':Sequelize[_0x6b01('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 76355f9..94dc069 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 _0x3308=['AccountId','Subjects','channel','Descriptions','FreshdeskField','remoteUri','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','apiKey','requester','agent','description','priority','ticket_type','group','company','remove','includes','default','label','choices','statusCode','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','json','offset','limit','undefined','count','set','reject','save','update','then','error','name','send','index','FreshdeskAccount','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','fields','catch','create','body','find','destroy','getConfigurations','findOne','FreshdeskConfiguration','nolimit','addConfiguration'];(function(_0x5b880d,_0x77fc89){var _0x15c40e=function(_0x432c67){while(--_0x432c67){_0x5b880d['push'](_0x5b880d['shift']());}};_0x15c40e(++_0x77fc89);}(_0x3308,0x160));var _0x8330=function(_0x552beb,_0x3cde51){_0x552beb=_0x552beb-0x0;var _0x40b9f0=_0x3308[_0x552beb];return _0x40b9f0;};'use strict';var emlformat=require(_0x8330('0x0'));var rimraf=require(_0x8330('0x1'));var zipdir=require(_0x8330('0x2'));var jsonpatch=require(_0x8330('0x3'));var rp=require(_0x8330('0x4'));var moment=require(_0x8330('0x5'));var BPromise=require(_0x8330('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8330('0x7'));var sox=require('sox');var csv=require(_0x8330('0x8'));var ejs=require(_0x8330('0x9'));var fs=require('fs');var fs_extra=require(_0x8330('0xa'));var _=require('lodash');var squel=require(_0x8330('0xb'));var crypto=require(_0x8330('0xc'));var jsforce=require(_0x8330('0xd'));var deskjs=require(_0x8330('0xe'));var toCsv=require(_0x8330('0x8'));var querystring=require(_0x8330('0xf'));var Papa=require('papaparse');var Redis=require(_0x8330('0x10'));var authService=require(_0x8330('0x11'));var qs=require(_0x8330('0x12'));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 licenseUtil=require(_0x8330('0x13'));var db=require('../../mysqldb')['db'];var integrations=require(_0x8330('0x14'));function respondWithStatusCode(_0x1da381,_0x252953){_0x252953=_0x252953||0xcc;return function(_0x3ceb1e){if(_0x3ceb1e){return _0x1da381[_0x8330('0x15')](_0x252953);}return _0x1da381['status'](_0x252953)[_0x8330('0x16')]();};}function respondWithResult(_0x4f0cf0,_0x293658){_0x293658=_0x293658||0xc8;return function(_0x2d7e87){if(_0x2d7e87){return _0x4f0cf0[_0x8330('0x17')](_0x293658)[_0x8330('0x18')](_0x2d7e87);}};}function respondWithFilteredResult(_0x432aca,_0x28998e){return function(_0x2c3e2f){if(_0x2c3e2f){var _0x1f230a=typeof _0x28998e[_0x8330('0x19')]==='undefined'&&typeof _0x28998e[_0x8330('0x1a')]===_0x8330('0x1b');var _0x47895b=_0x2c3e2f[_0x8330('0x1c')];var _0x3c9e7b=_0x1f230a?0x0:_0x28998e[_0x8330('0x19')];var _0x56fc18=_0x1f230a?_0x2c3e2f[_0x8330('0x1c')]:_0x28998e['offset']+_0x28998e[_0x8330('0x1a')];var _0x58e614;if(_0x56fc18>=_0x47895b){_0x56fc18=_0x47895b;_0x58e614=0xc8;}else{_0x58e614=0xce;}_0x432aca[_0x8330('0x17')](_0x58e614);return _0x432aca[_0x8330('0x1d')]('Content-Range',_0x3c9e7b+'-'+_0x56fc18+'/'+_0x47895b)[_0x8330('0x18')](_0x2c3e2f);}return null;};}function patchUpdates(_0x518236){return function(_0x3320fb){try{jsonpatch['apply'](_0x3320fb,_0x518236,!![]);}catch(_0x239822){return BPromise[_0x8330('0x1e')](_0x239822);}return _0x3320fb[_0x8330('0x1f')]();};}function saveUpdates(_0x350895,_0x317045){return function(_0x1ebee7){if(_0x1ebee7){return _0x1ebee7[_0x8330('0x20')](_0x350895)[_0x8330('0x21')](function(_0x21ddaf){return _0x21ddaf;});}return null;};}function removeEntity(_0x2770ca,_0x3fa722){return function(_0x5cb80c){if(_0x5cb80c){return _0x5cb80c['destroy']()['then'](function(){_0x2770ca[_0x8330('0x17')](0xcc)[_0x8330('0x16')]();});}};}function handleEntityNotFound(_0x36db54,_0xa04d8){return function(_0x44adb5){if(!_0x44adb5){_0x36db54[_0x8330('0x15')](0x194);}return _0x44adb5;};}function handleError(_0x19465b,_0x4e7aaa){_0x4e7aaa=_0x4e7aaa||0x1f4;return function(_0x339b99){logger[_0x8330('0x22')](_0x339b99['stack']);if(_0x339b99[_0x8330('0x23')]){delete _0x339b99[_0x8330('0x23')];}_0x19465b[_0x8330('0x17')](_0x4e7aaa)[_0x8330('0x24')](_0x339b99);};}exports[_0x8330('0x25')]=function(_0x5297af,_0x38e8d2){var _0x4baceb={},_0x3cce2f={},_0x162436={'count':0x0,'rows':[]};var _0x2cf1e2=_['map'](db[_0x8330('0x26')][_0x8330('0x27')],function(_0x553ca2){return{'name':_0x553ca2[_0x8330('0x28')],'type':_0x553ca2['type'][_0x8330('0x29')]};});_0x3cce2f[_0x8330('0x2a')]=_[_0x8330('0x2b')](_0x2cf1e2,_0x8330('0x23'));_0x3cce2f[_0x8330('0x2c')]=_[_0x8330('0x2d')](_0x5297af[_0x8330('0x2c')]);_0x3cce2f[_0x8330('0x2e')]=_[_0x8330('0x2f')](_0x3cce2f[_0x8330('0x2a')],_0x3cce2f[_0x8330('0x2c')]);_0x4baceb['attributes']=_['intersection'](_0x3cce2f[_0x8330('0x2a')],qs['fields'](_0x5297af[_0x8330('0x2c')]['fields']));_0x4baceb['attributes']=_0x4baceb[_0x8330('0x30')][_0x8330('0x31')]?_0x4baceb[_0x8330('0x30')]:_0x3cce2f[_0x8330('0x2a')];if(!_0x5297af['query'][_0x8330('0x32')]('nolimit')){_0x4baceb[_0x8330('0x1a')]=qs[_0x8330('0x1a')](_0x5297af[_0x8330('0x2c')][_0x8330('0x1a')]);_0x4baceb[_0x8330('0x19')]=qs[_0x8330('0x19')](_0x5297af['query'][_0x8330('0x19')]);}_0x4baceb[_0x8330('0x33')]=qs[_0x8330('0x34')](_0x5297af[_0x8330('0x2c')][_0x8330('0x34')]);_0x4baceb[_0x8330('0x35')]=qs[_0x8330('0x2e')](_[_0x8330('0x36')](_0x5297af['query'],_0x3cce2f['filters']),_0x2cf1e2);if(_0x5297af[_0x8330('0x2c')][_0x8330('0x37')]){_0x4baceb[_0x8330('0x35')]=_[_0x8330('0x38')](_0x4baceb[_0x8330('0x35')],{'$or':_[_0x8330('0x2b')](_0x2cf1e2,function(_0x18bfd0){if(_0x18bfd0[_0x8330('0x39')]!==_0x8330('0x3a')){var _0x4a7634={};_0x4a7634[_0x18bfd0[_0x8330('0x23')]]={'$like':'%'+_0x5297af[_0x8330('0x2c')][_0x8330('0x37')]+'%'};return _0x4a7634;}})});}_0x4baceb=_[_0x8330('0x38')]({},_0x4baceb,_0x5297af[_0x8330('0x3b')]);var _0x297fd3={'where':_0x4baceb[_0x8330('0x35')]};return db[_0x8330('0x26')][_0x8330('0x1c')](_0x297fd3)[_0x8330('0x21')](function(_0x8adf86){_0x162436[_0x8330('0x1c')]=_0x8adf86;if(_0x5297af[_0x8330('0x2c')][_0x8330('0x3c')]){_0x4baceb[_0x8330('0x3d')]=[{'all':!![]}];}return db[_0x8330('0x26')]['findAll'](_0x4baceb);})[_0x8330('0x21')](function(_0x41fb20){_0x162436[_0x8330('0x3e')]=_0x41fb20;return _0x162436;})[_0x8330('0x21')](respondWithFilteredResult(_0x38e8d2,_0x4baceb))['catch'](handleError(_0x38e8d2,null));};exports[_0x8330('0x3f')]=function(_0x752941,_0x1e71df){var _0x11dabe={'raw':![],'where':{'id':_0x752941[_0x8330('0x40')]['id']}},_0x4fa1d1={};_0x4fa1d1['model']=_['keys'](db[_0x8330('0x26')]['rawAttributes']);_0x4fa1d1['query']=_['keys'](_0x752941[_0x8330('0x2c')]);_0x4fa1d1[_0x8330('0x2e')]=_[_0x8330('0x2f')](_0x4fa1d1[_0x8330('0x2a')],_0x4fa1d1[_0x8330('0x2c')]);_0x11dabe[_0x8330('0x30')]=_[_0x8330('0x2f')](_0x4fa1d1[_0x8330('0x2a')],qs[_0x8330('0x41')](_0x752941['query'][_0x8330('0x41')]));_0x11dabe[_0x8330('0x30')]=_0x11dabe[_0x8330('0x30')][_0x8330('0x31')]?_0x11dabe[_0x8330('0x30')]:_0x4fa1d1[_0x8330('0x2a')];if(_0x752941[_0x8330('0x2c')][_0x8330('0x3c')]){_0x11dabe[_0x8330('0x3d')]=[{'all':!![]}];}_0x11dabe=_[_0x8330('0x38')]({},_0x11dabe,_0x752941[_0x8330('0x3b')]);return db[_0x8330('0x26')]['find'](_0x11dabe)[_0x8330('0x21')](handleEntityNotFound(_0x1e71df,null))[_0x8330('0x21')](respondWithResult(_0x1e71df,null))[_0x8330('0x42')](handleError(_0x1e71df,null));};exports[_0x8330('0x43')]=function(_0x3afffc,_0x5279d4){return db[_0x8330('0x26')][_0x8330('0x43')](_0x3afffc[_0x8330('0x44')],{})['then'](respondWithResult(_0x5279d4,0xc9))[_0x8330('0x42')](handleError(_0x5279d4,null));};exports['update']=function(_0x4d5466,_0xe4cd8b){if(_0x4d5466[_0x8330('0x44')]['id']){delete _0x4d5466[_0x8330('0x44')]['id'];}return db['FreshdeskAccount'][_0x8330('0x45')]({'where':{'id':_0x4d5466[_0x8330('0x40')]['id']}})[_0x8330('0x21')](handleEntityNotFound(_0xe4cd8b,null))[_0x8330('0x21')](saveUpdates(_0x4d5466['body'],null))[_0x8330('0x21')](respondWithResult(_0xe4cd8b,null))[_0x8330('0x42')](handleError(_0xe4cd8b,null));};exports[_0x8330('0x46')]=function(_0x5df830,_0x411ad1){return db['FreshdeskAccount'][_0x8330('0x45')]({'where':{'id':_0x5df830[_0x8330('0x40')]['id']}})[_0x8330('0x21')](handleEntityNotFound(_0x411ad1,null))['then'](removeEntity(_0x411ad1,null))[_0x8330('0x42')](handleError(_0x411ad1,null));};exports[_0x8330('0x47')]=function(_0xc20baa,_0x2a3e84,_0x211e77){var _0x4d976f={};var _0x9b36c6={};var _0x3d1636;var _0x2b4a09;return db[_0x8330('0x26')][_0x8330('0x48')]({'where':{'id':_0xc20baa[_0x8330('0x40')]['id']}})[_0x8330('0x21')](handleEntityNotFound(_0x2a3e84,null))[_0x8330('0x21')](function(_0x2e5ebe){if(_0x2e5ebe){_0x3d1636=_0x2e5ebe;_0x9b36c6[_0x8330('0x2a')]=_[_0x8330('0x2d')](db[_0x8330('0x49')][_0x8330('0x27')]);_0x9b36c6['query']=_[_0x8330('0x2d')](_0xc20baa['query']);_0x9b36c6['filters']=_[_0x8330('0x2f')](_0x9b36c6[_0x8330('0x2a')],_0x9b36c6[_0x8330('0x2c')]);_0x4d976f[_0x8330('0x30')]=_['intersection'](_0x9b36c6[_0x8330('0x2a')],qs[_0x8330('0x41')](_0xc20baa[_0x8330('0x2c')]['fields']));_0x4d976f[_0x8330('0x30')]=_0x4d976f[_0x8330('0x30')][_0x8330('0x31')]?_0x4d976f['attributes']:_0x9b36c6['model'];_0x4d976f[_0x8330('0x33')]=qs[_0x8330('0x34')](_0xc20baa[_0x8330('0x2c')][_0x8330('0x34')]);_0x4d976f[_0x8330('0x35')]=qs[_0x8330('0x2e')](_[_0x8330('0x36')](_0xc20baa[_0x8330('0x2c')],_0x9b36c6[_0x8330('0x2e')]));if(_0xc20baa[_0x8330('0x2c')]['filter']){_0x4d976f[_0x8330('0x35')]=_['merge'](_0x4d976f['where'],{'$or':_[_0x8330('0x2b')](_0x4d976f['attributes'],function(_0x864763){var _0x484c25={};_0x484c25[_0x864763]={'$like':'%'+_0xc20baa[_0x8330('0x2c')][_0x8330('0x37')]+'%'};return _0x484c25;})});}_0x4d976f=_[_0x8330('0x38')]({},_0x4d976f,_0xc20baa[_0x8330('0x3b')]);return _0x3d1636['getConfigurations'](_0x4d976f);}})[_0x8330('0x21')](function(_0x250e47){if(_0x250e47){_0x2b4a09=_0x250e47['length'];if(!_0xc20baa[_0x8330('0x2c')]['hasOwnProperty'](_0x8330('0x4a'))){_0x4d976f[_0x8330('0x1a')]=qs[_0x8330('0x1a')](_0xc20baa[_0x8330('0x2c')][_0x8330('0x1a')]);_0x4d976f[_0x8330('0x19')]=qs['offset'](_0xc20baa[_0x8330('0x2c')][_0x8330('0x19')]);}return _0x3d1636[_0x8330('0x47')](_0x4d976f);}})[_0x8330('0x21')](function(_0x4988b5){if(_0x4988b5){return _0x4988b5?{'count':_0x2b4a09,'rows':_0x4988b5}:null;}})['then'](respondWithResult(_0x2a3e84,null))[_0x8330('0x42')](handleError(_0x2a3e84,null));};exports[_0x8330('0x4b')]=function(_0x2af35b,_0x44b83e,_0x19362f){if(_0x2af35b['body']['id']){delete _0x2af35b['body']['id'];}return db[_0x8330('0x26')]['findOne']({'where':{'id':_0x2af35b[_0x8330('0x40')]['id']}})['then'](handleEntityNotFound(_0x44b83e,null))[_0x8330('0x21')](function(_0x324a36){if(_0x324a36){_0x2af35b[_0x8330('0x44')][_0x8330('0x4c')]=_0x324a36['id'];_0x2af35b[_0x8330('0x44')][_0x8330('0x4d')]=integrations['getSubjects'](_0x2af35b[_0x8330('0x44')][_0x8330('0x4e')],_0x2af35b[_0x8330('0x44')]['type']);_0x2af35b[_0x8330('0x44')][_0x8330('0x4f')]=integrations['getDescriptions'](_0x2af35b[_0x8330('0x44')]['channel'],_0x2af35b[_0x8330('0x44')][_0x8330('0x39')]);return db[_0x8330('0x49')][_0x8330('0x43')](_0x2af35b[_0x8330('0x44')],{'include':[{'model':db[_0x8330('0x50')],'as':'Subjects'},{'model':db[_0x8330('0x50')],'as':'Descriptions'}]});}return null;})[_0x8330('0x21')](respondWithResult(_0x44b83e,null))[_0x8330('0x42')](handleError(_0x44b83e,null));};exports['getFields']=function(_0x1ad7f6,_0x27ceb2,_0x3a3981){var _0x4d8511='';return db[_0x8330('0x26')][_0x8330('0x48')]({'where':{'id':_0x1ad7f6[_0x8330('0x40')]['id']},'attributes':['id',_0x8330('0x51'),'apiKey']})[_0x8330('0x21')](handleEntityNotFound(_0x27ceb2,null))[_0x8330('0x21')](function(_0x10825c){if(_0x10825c){_0x4d8511=_0x10825c['remoteUri'];var _0x4765e9=_0x4d8511['slice'](-0x1);if(_0x4765e9==='/'){_0x4d8511=_0x4d8511[_0x8330('0x52')](0x0,_0x4d8511[_0x8330('0x53')](_0x4765e9));}return rp({'method':_0x8330('0x54'),'uri':util[_0x8330('0x55')](_0x8330('0x56'),_0x4d8511,_0x8330('0x57')),'headers':{'Authorization':util[_0x8330('0x55')](_0x8330('0x58'),new Buffer(util[_0x8330('0x55')](_0x8330('0x59'),_0x10825c[_0x8330('0x5a')]))['toString']('base64'))},'json':!![]});}})['then'](function(_0x1c2417){if(_0x1c2417){var _0x3340ca=[_0x8330('0x5b'),'subject',_0x8330('0x5c'),_0x8330('0x5d'),_0x8330('0x17'),_0x8330('0x5e'),'group','source',_0x8330('0x5f'),_0x8330('0x60'),_0x8330('0x61')];_[_0x8330('0x62')](_0x1c2417,function(_0x3dcab8){return _0x3340ca[_0x8330('0x63')](_0x3dcab8[_0x8330('0x23')])||!_0x3dcab8[_0x8330('0x64')]&&_0x3dcab8[_0x8330('0x39')]!=='custom_text'&&_0x3dcab8[_0x8330('0x39')]!=='custom_dropdown';});return{'count':_0x1c2417[_0x8330('0x31')],'rows':_['map'](_0x1c2417,function(_0x3ccb74){return{'id':_0x3ccb74[_0x8330('0x23')],'name':_0x3ccb74[_0x8330('0x65')],'custom':!_0x3ccb74[_0x8330('0x64')],'options':_0x3ccb74[_0x8330('0x66')]?_[_0x8330('0x2b')](_0x3ccb74['choices'],function(_0xf58aba){return{'name':_['capitalize'](_0xf58aba),'value':_0xf58aba};}):[]};})};}})[_0x8330('0x21')](respondWithResult(_0x27ceb2,null))[_0x8330('0x42')](function(_0x6d1882){var _0x551b05=_0x1ad7f6[_0x8330('0x2c')]['test']?0x1f4:_0x6d1882[_0x8330('0x67')]||0x1f4;logger[_0x8330('0x22')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x551b05,JSON[_0x8330('0x68')](_0x6d1882));delete _0x6d1882[_0x8330('0x23')];if(_0x551b05===0x191){_0x551b05=0x190;}_0x27ceb2[_0x8330('0x17')](_0x551b05)[_0x8330('0x24')](_0x1ad7f6['query'][_0x8330('0x69')]?{'message':_0x8330('0x6a'),'statusCode':_0x6d1882['statusCode']}:_0x6d1882);});}; \ No newline at end of file +var _0x1db3=['source','company','remove','includes','default','custom_text','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','map','fieldName','type','model','query','keys','attributes','intersection','fields','hasOwnProperty','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','FreshdeskAccount','then','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','length','nolimit','AccountId','getSubjects','Descriptions','getDescriptions','channel','Subjects','FreshdeskField','getFields','remoteUri','slice','GET','format','%s/%s','Basic\x20%s','%s:X','apiKey','toString','requester','agent','description','priority','group'];(function(_0x556101,_0x2401cf){var _0x1f1b32=function(_0x549d11){while(--_0x549d11){_0x556101['push'](_0x556101['shift']());}};_0x1f1b32(++_0x2401cf);}(_0x1db3,0x1e5));var _0x31db=function(_0x78ba10,_0x46d3b8){_0x78ba10=_0x78ba10-0x0;var _0x581a51=_0x1db3[_0x78ba10];return _0x581a51;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x31db('0x0'));var zipdir=require(_0x31db('0x1'));var jsonpatch=require(_0x31db('0x2'));var rp=require(_0x31db('0x3'));var moment=require(_0x31db('0x4'));var BPromise=require(_0x31db('0x5'));var Mustache=require(_0x31db('0x6'));var util=require(_0x31db('0x7'));var path=require(_0x31db('0x8'));var sox=require(_0x31db('0x9'));var csv=require(_0x31db('0xa'));var ejs=require(_0x31db('0xb'));var fs=require('fs');var fs_extra=require(_0x31db('0xc'));var _=require(_0x31db('0xd'));var squel=require(_0x31db('0xe'));var crypto=require(_0x31db('0xf'));var jsforce=require(_0x31db('0x10'));var deskjs=require(_0x31db('0x11'));var toCsv=require(_0x31db('0xa'));var querystring=require('querystring');var Papa=require(_0x31db('0x12'));var Redis=require(_0x31db('0x13'));var authService=require(_0x31db('0x14'));var qs=require(_0x31db('0x15'));var as=require(_0x31db('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x31db('0x17'))(_0x31db('0x18'));var utils=require(_0x31db('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x31db('0x1a'));var db=require(_0x31db('0x1b'))['db'];var integrations=require(_0x31db('0x1c'));function respondWithStatusCode(_0x1ca88f,_0x298707){_0x298707=_0x298707||0xcc;return function(_0x98c3d0){if(_0x98c3d0){return _0x1ca88f['sendStatus'](_0x298707);}return _0x1ca88f['status'](_0x298707)[_0x31db('0x1d')]();};}function respondWithResult(_0x5706dc,_0x1ccc17){_0x1ccc17=_0x1ccc17||0xc8;return function(_0x14dc43){if(_0x14dc43){return _0x5706dc[_0x31db('0x1e')](_0x1ccc17)[_0x31db('0x1f')](_0x14dc43);}};}function respondWithFilteredResult(_0x29f691,_0x4ccb3d){return function(_0x557907){if(_0x557907){var _0x509ea3=typeof _0x4ccb3d[_0x31db('0x20')]===_0x31db('0x21')&&typeof _0x4ccb3d[_0x31db('0x22')]===_0x31db('0x21');var _0xb54695=_0x557907[_0x31db('0x23')];var _0x9f2780=_0x509ea3?0x0:_0x4ccb3d[_0x31db('0x20')];var _0x2d9dd7=_0x509ea3?_0x557907[_0x31db('0x23')]:_0x4ccb3d[_0x31db('0x20')]+_0x4ccb3d['limit'];var _0x2182c7;if(_0x2d9dd7>=_0xb54695){_0x2d9dd7=_0xb54695;_0x2182c7=0xc8;}else{_0x2182c7=0xce;}_0x29f691['status'](_0x2182c7);return _0x29f691['set'](_0x31db('0x24'),_0x9f2780+'-'+_0x2d9dd7+'/'+_0xb54695)[_0x31db('0x1f')](_0x557907);}return null;};}function patchUpdates(_0x168002){return function(_0x2d11b2){try{jsonpatch[_0x31db('0x25')](_0x2d11b2,_0x168002,!![]);}catch(_0x20264f){return BPromise[_0x31db('0x26')](_0x20264f);}return _0x2d11b2[_0x31db('0x27')]();};}function saveUpdates(_0x204781,_0x1f00f7){return function(_0xfa19ca){if(_0xfa19ca){return _0xfa19ca[_0x31db('0x28')](_0x204781)['then'](function(_0x358d1d){return _0x358d1d;});}return null;};}function removeEntity(_0x335cc9,_0x303cf4){return function(_0x5e44b8){if(_0x5e44b8){return _0x5e44b8[_0x31db('0x29')]()['then'](function(){_0x335cc9['status'](0xcc)[_0x31db('0x1d')]();});}};}function handleEntityNotFound(_0x28d247,_0x47e34b){return function(_0x4a2dbc){if(!_0x4a2dbc){_0x28d247['sendStatus'](0x194);}return _0x4a2dbc;};}function handleError(_0x313917,_0x48668b){_0x48668b=_0x48668b||0x1f4;return function(_0x2d06de){logger[_0x31db('0x2a')](_0x2d06de[_0x31db('0x2b')]);if(_0x2d06de[_0x31db('0x2c')]){delete _0x2d06de[_0x31db('0x2c')];}_0x313917[_0x31db('0x1e')](_0x48668b)[_0x31db('0x2d')](_0x2d06de);};}exports[_0x31db('0x2e')]=function(_0x4275fb,_0x4df070){var _0x1a1124={},_0x3a7386={},_0x5e9952={'count':0x0,'rows':[]};var _0x57f5a9=_[_0x31db('0x2f')](db['FreshdeskAccount']['rawAttributes'],function(_0x5a6368){return{'name':_0x5a6368[_0x31db('0x30')],'type':_0x5a6368[_0x31db('0x31')]['key']};});_0x3a7386[_0x31db('0x32')]=_['map'](_0x57f5a9,'name');_0x3a7386[_0x31db('0x33')]=_[_0x31db('0x34')](_0x4275fb[_0x31db('0x33')]);_0x3a7386['filters']=_['intersection'](_0x3a7386[_0x31db('0x32')],_0x3a7386[_0x31db('0x33')]);_0x1a1124[_0x31db('0x35')]=_[_0x31db('0x36')](_0x3a7386[_0x31db('0x32')],qs['fields'](_0x4275fb['query'][_0x31db('0x37')]));_0x1a1124['attributes']=_0x1a1124[_0x31db('0x35')]['length']?_0x1a1124[_0x31db('0x35')]:_0x3a7386[_0x31db('0x32')];if(!_0x4275fb[_0x31db('0x33')][_0x31db('0x38')]('nolimit')){_0x1a1124[_0x31db('0x22')]=qs[_0x31db('0x22')](_0x4275fb['query']['limit']);_0x1a1124[_0x31db('0x20')]=qs[_0x31db('0x20')](_0x4275fb['query']['offset']);}_0x1a1124[_0x31db('0x39')]=qs[_0x31db('0x3a')](_0x4275fb[_0x31db('0x33')][_0x31db('0x3a')]);_0x1a1124['where']=qs[_0x31db('0x3b')](_[_0x31db('0x3c')](_0x4275fb[_0x31db('0x33')],_0x3a7386['filters']),_0x57f5a9);if(_0x4275fb[_0x31db('0x33')]['filter']){_0x1a1124[_0x31db('0x3d')]=_[_0x31db('0x3e')](_0x1a1124[_0x31db('0x3d')],{'$or':_[_0x31db('0x2f')](_0x57f5a9,function(_0x593638){if(_0x593638[_0x31db('0x31')]!==_0x31db('0x3f')){var _0x22254a={};_0x22254a[_0x593638[_0x31db('0x2c')]]={'$like':'%'+_0x4275fb['query'][_0x31db('0x40')]+'%'};return _0x22254a;}})});}_0x1a1124=_[_0x31db('0x3e')]({},_0x1a1124,_0x4275fb[_0x31db('0x41')]);var _0x14aa99={'where':_0x1a1124['where']};return db[_0x31db('0x42')][_0x31db('0x23')](_0x14aa99)[_0x31db('0x43')](function(_0x219e7f){_0x5e9952[_0x31db('0x23')]=_0x219e7f;if(_0x4275fb[_0x31db('0x33')][_0x31db('0x44')]){_0x1a1124[_0x31db('0x45')]=[{'all':!![]}];}return db[_0x31db('0x42')][_0x31db('0x46')](_0x1a1124);})[_0x31db('0x43')](function(_0x4836e2){_0x5e9952[_0x31db('0x47')]=_0x4836e2;return _0x5e9952;})[_0x31db('0x43')](respondWithFilteredResult(_0x4df070,_0x1a1124))[_0x31db('0x48')](handleError(_0x4df070,null));};exports[_0x31db('0x49')]=function(_0x3c2705,_0x405361){var _0x17d9b8={'raw':![],'where':{'id':_0x3c2705[_0x31db('0x4a')]['id']}},_0x50720e={};_0x50720e[_0x31db('0x32')]=_['keys'](db[_0x31db('0x42')]['rawAttributes']);_0x50720e[_0x31db('0x33')]=_[_0x31db('0x34')](_0x3c2705[_0x31db('0x33')]);_0x50720e['filters']=_[_0x31db('0x36')](_0x50720e[_0x31db('0x32')],_0x50720e['query']);_0x17d9b8[_0x31db('0x35')]=_[_0x31db('0x36')](_0x50720e[_0x31db('0x32')],qs[_0x31db('0x37')](_0x3c2705[_0x31db('0x33')][_0x31db('0x37')]));_0x17d9b8[_0x31db('0x35')]=_0x17d9b8[_0x31db('0x35')]['length']?_0x17d9b8[_0x31db('0x35')]:_0x50720e[_0x31db('0x32')];if(_0x3c2705[_0x31db('0x33')][_0x31db('0x44')]){_0x17d9b8[_0x31db('0x45')]=[{'all':!![]}];}_0x17d9b8=_['merge']({},_0x17d9b8,_0x3c2705['options']);return db[_0x31db('0x42')][_0x31db('0x4b')](_0x17d9b8)[_0x31db('0x43')](handleEntityNotFound(_0x405361,null))[_0x31db('0x43')](respondWithResult(_0x405361,null))[_0x31db('0x48')](handleError(_0x405361,null));};exports[_0x31db('0x4c')]=function(_0x41a9e1,_0xfa9006){return db[_0x31db('0x42')][_0x31db('0x4c')](_0x41a9e1['body'],{})[_0x31db('0x43')](respondWithResult(_0xfa9006,0xc9))[_0x31db('0x48')](handleError(_0xfa9006,null));};exports[_0x31db('0x28')]=function(_0x180021,_0x337cc3){if(_0x180021[_0x31db('0x4d')]['id']){delete _0x180021[_0x31db('0x4d')]['id'];}return db[_0x31db('0x42')]['find']({'where':{'id':_0x180021[_0x31db('0x4a')]['id']}})['then'](handleEntityNotFound(_0x337cc3,null))[_0x31db('0x43')](saveUpdates(_0x180021[_0x31db('0x4d')],null))[_0x31db('0x43')](respondWithResult(_0x337cc3,null))[_0x31db('0x48')](handleError(_0x337cc3,null));};exports['destroy']=function(_0x495e72,_0x55db42){return db[_0x31db('0x42')][_0x31db('0x4b')]({'where':{'id':_0x495e72[_0x31db('0x4a')]['id']}})[_0x31db('0x43')](handleEntityNotFound(_0x55db42,null))['then'](removeEntity(_0x55db42,null))[_0x31db('0x48')](handleError(_0x55db42,null));};exports[_0x31db('0x4e')]=function(_0x264acf,_0x484670,_0x3937ac){var _0x517094={};var _0x271e11={};var _0x17a846;var _0x51fe21;return db[_0x31db('0x42')][_0x31db('0x4f')]({'where':{'id':_0x264acf['params']['id']}})[_0x31db('0x43')](handleEntityNotFound(_0x484670,null))['then'](function(_0x919425){if(_0x919425){_0x17a846=_0x919425;_0x271e11[_0x31db('0x32')]=_['keys'](db[_0x31db('0x50')]['rawAttributes']);_0x271e11[_0x31db('0x33')]=_[_0x31db('0x34')](_0x264acf[_0x31db('0x33')]);_0x271e11[_0x31db('0x3b')]=_[_0x31db('0x36')](_0x271e11[_0x31db('0x32')],_0x271e11[_0x31db('0x33')]);_0x517094[_0x31db('0x35')]=_['intersection'](_0x271e11[_0x31db('0x32')],qs[_0x31db('0x37')](_0x264acf[_0x31db('0x33')][_0x31db('0x37')]));_0x517094[_0x31db('0x35')]=_0x517094[_0x31db('0x35')][_0x31db('0x51')]?_0x517094[_0x31db('0x35')]:_0x271e11['model'];_0x517094[_0x31db('0x39')]=qs['sort'](_0x264acf[_0x31db('0x33')][_0x31db('0x3a')]);_0x517094[_0x31db('0x3d')]=qs[_0x31db('0x3b')](_[_0x31db('0x3c')](_0x264acf[_0x31db('0x33')],_0x271e11[_0x31db('0x3b')]));if(_0x264acf[_0x31db('0x33')]['filter']){_0x517094[_0x31db('0x3d')]=_['merge'](_0x517094[_0x31db('0x3d')],{'$or':_[_0x31db('0x2f')](_0x517094[_0x31db('0x35')],function(_0x319740){var _0x22a2cf={};_0x22a2cf[_0x319740]={'$like':'%'+_0x264acf[_0x31db('0x33')][_0x31db('0x40')]+'%'};return _0x22a2cf;})});}_0x517094=_[_0x31db('0x3e')]({},_0x517094,_0x264acf[_0x31db('0x41')]);return _0x17a846[_0x31db('0x4e')](_0x517094);}})[_0x31db('0x43')](function(_0x4ced2f){if(_0x4ced2f){_0x51fe21=_0x4ced2f[_0x31db('0x51')];if(!_0x264acf['query'][_0x31db('0x38')](_0x31db('0x52'))){_0x517094[_0x31db('0x22')]=qs[_0x31db('0x22')](_0x264acf[_0x31db('0x33')][_0x31db('0x22')]);_0x517094[_0x31db('0x20')]=qs[_0x31db('0x20')](_0x264acf['query'][_0x31db('0x20')]);}return _0x17a846['getConfigurations'](_0x517094);}})[_0x31db('0x43')](function(_0x5d448b){if(_0x5d448b){return _0x5d448b?{'count':_0x51fe21,'rows':_0x5d448b}:null;}})[_0x31db('0x43')](respondWithResult(_0x484670,null))[_0x31db('0x48')](handleError(_0x484670,null));};exports['addConfiguration']=function(_0x17fe57,_0xfa95d6,_0x95c8c1){if(_0x17fe57[_0x31db('0x4d')]['id']){delete _0x17fe57[_0x31db('0x4d')]['id'];}return db[_0x31db('0x42')][_0x31db('0x4f')]({'where':{'id':_0x17fe57[_0x31db('0x4a')]['id']}})[_0x31db('0x43')](handleEntityNotFound(_0xfa95d6,null))[_0x31db('0x43')](function(_0x1526af){if(_0x1526af){_0x17fe57['body'][_0x31db('0x53')]=_0x1526af['id'];_0x17fe57[_0x31db('0x4d')]['Subjects']=integrations[_0x31db('0x54')](_0x17fe57[_0x31db('0x4d')]['channel'],_0x17fe57[_0x31db('0x4d')]['type']);_0x17fe57[_0x31db('0x4d')][_0x31db('0x55')]=integrations[_0x31db('0x56')](_0x17fe57[_0x31db('0x4d')][_0x31db('0x57')],_0x17fe57[_0x31db('0x4d')][_0x31db('0x31')]);return db['FreshdeskConfiguration']['create'](_0x17fe57['body'],{'include':[{'model':db['FreshdeskField'],'as':_0x31db('0x58')},{'model':db[_0x31db('0x59')],'as':_0x31db('0x55')}]});}return null;})[_0x31db('0x43')](respondWithResult(_0xfa95d6,null))[_0x31db('0x48')](handleError(_0xfa95d6,null));};exports[_0x31db('0x5a')]=function(_0x38cc83,_0x5dd9ab,_0x33843f){var _0xb4f67e='';return db[_0x31db('0x42')][_0x31db('0x4f')]({'where':{'id':_0x38cc83[_0x31db('0x4a')]['id']},'attributes':['id','remoteUri','apiKey']})[_0x31db('0x43')](handleEntityNotFound(_0x5dd9ab,null))[_0x31db('0x43')](function(_0x32a9bd){if(_0x32a9bd){_0xb4f67e=_0x32a9bd[_0x31db('0x5b')];var _0x107daa=_0xb4f67e[_0x31db('0x5c')](-0x1);if(_0x107daa==='/'){_0xb4f67e=_0xb4f67e['substring'](0x0,_0xb4f67e['lastIndexOf'](_0x107daa));}return rp({'method':_0x31db('0x5d'),'uri':util[_0x31db('0x5e')](_0x31db('0x5f'),_0xb4f67e,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x31db('0x5e')](_0x31db('0x60'),new Buffer(util[_0x31db('0x5e')](_0x31db('0x61'),_0x32a9bd[_0x31db('0x62')]))[_0x31db('0x63')]('base64'))},'json':!![]});}})['then'](function(_0x496478){if(_0x496478){var _0x2bfec8=[_0x31db('0x64'),'subject',_0x31db('0x65'),_0x31db('0x66'),_0x31db('0x1e'),_0x31db('0x67'),_0x31db('0x68'),_0x31db('0x69'),'ticket_type',_0x31db('0x68'),_0x31db('0x6a')];_[_0x31db('0x6b')](_0x496478,function(_0xfb23f9){return _0x2bfec8[_0x31db('0x6c')](_0xfb23f9[_0x31db('0x2c')])||!_0xfb23f9[_0x31db('0x6d')]&&_0xfb23f9[_0x31db('0x31')]!==_0x31db('0x6e')&&_0xfb23f9[_0x31db('0x31')]!=='custom_dropdown';});return{'count':_0x496478[_0x31db('0x51')],'rows':_[_0x31db('0x2f')](_0x496478,function(_0x507763){return{'id':_0x507763[_0x31db('0x2c')],'name':_0x507763[_0x31db('0x6f')],'custom':!_0x507763[_0x31db('0x6d')],'options':_0x507763[_0x31db('0x70')]?_['map'](_0x507763[_0x31db('0x70')],function(_0x5290ab){return{'name':_[_0x31db('0x71')](_0x5290ab),'value':_0x5290ab};}):[]};})};}})['then'](respondWithResult(_0x5dd9ab,null))['catch'](function(_0x1bbdc4){var _0x3a3f77=_0x38cc83['query'][_0x31db('0x72')]?0x1f4:_0x1bbdc4[_0x31db('0x73')]||0x1f4;logger[_0x31db('0x2a')](_0x31db('0x74'),_0x31db('0x5a'),_0x3a3f77,JSON[_0x31db('0x75')](_0x1bbdc4));delete _0x1bbdc4[_0x31db('0x2c')];if(_0x3a3f77===0x191){_0x3a3f77=0x190;}_0x5dd9ab[_0x31db('0x1e')](_0x3a3f77)[_0x31db('0x2d')](_0x38cc83[_0x31db('0x33')][_0x31db('0x72')]?{'message':'Wrong\x20credentials','statusCode':_0x1bbdc4[_0x31db('0x73')]}:_0x1bbdc4);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index d42dae7..df5ed6b 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 _0x6de6=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x6de6,0x8f));var _0x66de=function(_0x3c8893,_0x3bb73e){_0x3c8893=_0x3c8893-0x0;var _0x3f9f4b=_0x6de6[_0x3c8893];return _0x3f9f4b;};'use strict';var _=require(_0x66de('0x0'));var util=require(_0x66de('0x1'));var logger=require(_0x66de('0x2'))(_0x66de('0x3'));var moment=require(_0x66de('0x4'));var BPromise=require(_0x66de('0x5'));var rp=require(_0x66de('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x66de('0x7'));var attributes=require(_0x66de('0x8'));var integrations=require(_0x66de('0x9'));module[_0x66de('0xa')]=function(_0x192634,_0x134a5b){return _0x192634[_0x66de('0xb')](_0x66de('0xc'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d78=['define','FreshdeskAccount','int_freshdesk_accounts','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x7d78,0x183));var _0x87d7=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x7d78[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x87d7('0x0'));var util=require('util');var logger=require(_0x87d7('0x1'))('api');var moment=require(_0x87d7('0x2'));var BPromise=require(_0x87d7('0x3'));var rp=require(_0x87d7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x87d7('0x5'));var config=require('../../config/environment');var attributes=require(_0x87d7('0x6'));var integrations=require(_0x87d7('0x7'));module[_0x87d7('0x8')]=function(_0x7a83a5,_0x258f22){return _0x7a83a5[_0x87d7('0x9')](_0x87d7('0xa'),attributes,{'tableName':_0x87d7('0xb'),'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 5b3879c..44b69e3 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 _0xd6cb=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','limit','include','map','model','attributes','find','ShowFreshdeskAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x40b3d7,_0x2ea362){var _0x44eb89=function(_0x16c424){while(--_0x16c424){_0x40b3d7['push'](_0x40b3d7['shift']());}};_0x44eb89(++_0x2ea362);}(_0xd6cb,0xde));var _0xbd6c=function(_0x2e6516,_0x125bc3){_0x2e6516=_0x2e6516-0x0;var _0xafbb16=_0xd6cb[_0x2e6516];return _0xafbb16;};'use strict';var _=require(_0xbd6c('0x0'));var util=require(_0xbd6c('0x1'));var moment=require(_0xbd6c('0x2'));var BPromise=require(_0xbd6c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbd6c('0x4'));var db=require(_0xbd6c('0x5'))['db'];var utils=require(_0xbd6c('0x6'));var logger=require(_0xbd6c('0x7'))(_0xbd6c('0x8'));var config=require(_0xbd6c('0x9'));var jayson=require(_0xbd6c('0xa'));var client=jayson[_0xbd6c('0xb')][_0xbd6c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x23af88,_0x758b3e,_0x31a732){return new BPromise(function(_0x3cb386,_0x2f701c){return client['request'](_0x23af88,_0x31a732)[_0xbd6c('0xd')](function(_0x191b5a){logger[_0xbd6c('0xe')](_0xbd6c('0xf'),_0x758b3e,_0xbd6c('0x10'));logger[_0xbd6c('0x11')](_0xbd6c('0x12'),_0x758b3e,_0xbd6c('0x10'),JSON[_0xbd6c('0x13')](_0x191b5a));if(_0x191b5a[_0xbd6c('0x14')]){if(_0x191b5a[_0xbd6c('0x14')][_0xbd6c('0x15')]===0x1f4){logger[_0xbd6c('0x14')](_0xbd6c('0xf'),_0x758b3e,_0x191b5a['error'][_0xbd6c('0x16')]);return _0x2f701c(_0x191b5a['error'][_0xbd6c('0x16')]);}logger[_0xbd6c('0x14')](_0xbd6c('0xf'),_0x758b3e,_0x191b5a['error']['message']);return _0x3cb386(_0x191b5a[_0xbd6c('0x14')][_0xbd6c('0x16')]);}else{logger[_0xbd6c('0xe')](_0xbd6c('0xf'),_0x758b3e,_0xbd6c('0x10'));_0x3cb386(_0x191b5a[_0xbd6c('0x17')][_0xbd6c('0x16')]);}})[_0xbd6c('0x18')](function(_0x55a034){logger['error'](_0xbd6c('0xf'),_0x758b3e,_0x55a034);_0x2f701c(_0x55a034);});});}exports[_0xbd6c('0x19')]=function(_0x38c006){var _0x488725=this;return new Promise(function(_0x28c989,_0x5e349f){return db[_0xbd6c('0x1a')][_0xbd6c('0x1b')]({'raw':_0x38c006[_0xbd6c('0x1c')]?_0x38c006[_0xbd6c('0x1c')][_0xbd6c('0x1d')]===undefined?!![]:![]:!![],'where':_0x38c006['options']?_0x38c006[_0xbd6c('0x1c')][_0xbd6c('0x1e')]||null:null,'attributes':_0x38c006[_0xbd6c('0x1c')]?_0x38c006[_0xbd6c('0x1c')]['attributes']||null:null,'limit':_0x38c006[_0xbd6c('0x1c')]?_0x38c006[_0xbd6c('0x1c')][_0xbd6c('0x1f')]||null:null,'include':_0x38c006[_0xbd6c('0x1c')]?_0x38c006[_0xbd6c('0x1c')][_0xbd6c('0x20')]?_[_0xbd6c('0x21')](_0x38c006[_0xbd6c('0x1c')]['include'],function(_0xac147b){return{'model':db[_0xac147b[_0xbd6c('0x22')]],'as':_0xac147b['as'],'attributes':_0xac147b['attributes'],'include':_0xac147b[_0xbd6c('0x20')]?_[_0xbd6c('0x21')](_0xac147b[_0xbd6c('0x20')],function(_0x33576e){return{'model':db[_0x33576e['model']],'as':_0x33576e['as'],'attributes':_0x33576e[_0xbd6c('0x23')],'include':_0x33576e['include']?_['map'](_0x33576e['include'],function(_0x20dc9e){return{'model':db[_0x20dc9e['model']],'as':_0x20dc9e['as'],'attributes':_0x20dc9e[_0xbd6c('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x17fa7e){logger[_0xbd6c('0xe')](_0xbd6c('0x19'),_0x38c006);logger['debug'](_0xbd6c('0x19'),_0x38c006,JSON['stringify'](_0x17fa7e));_0x28c989(_0x17fa7e);})[_0xbd6c('0x18')](function(_0x27cea0){logger[_0xbd6c('0x14')](_0xbd6c('0x19'),_0x27cea0[_0xbd6c('0x16')],_0x38c006);_0x5e349f(_0x488725[_0xbd6c('0x14')](0x1f4,_0x27cea0[_0xbd6c('0x16')]));});});};exports['ShowFreshdeskAccount']=function(_0x4abe74){var _0x11c529=this;return new Promise(function(_0x4560d7,_0x5f45af){return db[_0xbd6c('0x1a')][_0xbd6c('0x24')]({'raw':_0x4abe74[_0xbd6c('0x1c')]?_0x4abe74[_0xbd6c('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x4abe74[_0xbd6c('0x1c')]?_0x4abe74[_0xbd6c('0x1c')][_0xbd6c('0x1e')]||null:null,'attributes':_0x4abe74[_0xbd6c('0x1c')]?_0x4abe74[_0xbd6c('0x1c')][_0xbd6c('0x23')]||null:null,'include':_0x4abe74['options']?_0x4abe74[_0xbd6c('0x1c')][_0xbd6c('0x20')]?_[_0xbd6c('0x21')](_0x4abe74[_0xbd6c('0x1c')][_0xbd6c('0x20')],function(_0x3b6d97){return{'model':db[_0x3b6d97['model']],'as':_0x3b6d97['as'],'attributes':_0x3b6d97[_0xbd6c('0x23')],'include':_0x3b6d97['include']?_[_0xbd6c('0x21')](_0x3b6d97['include'],function(_0x97fae){return{'model':db[_0x97fae[_0xbd6c('0x22')]],'as':_0x97fae['as'],'attributes':_0x97fae[_0xbd6c('0x23')],'include':_0x97fae['include']?_[_0xbd6c('0x21')](_0x97fae[_0xbd6c('0x20')],function(_0x6f4552){return{'model':db[_0x6f4552[_0xbd6c('0x22')]],'as':_0x6f4552['as'],'attributes':_0x6f4552[_0xbd6c('0x23')]};}):[]};}):[]};}):[]:[]})[_0xbd6c('0xd')](function(_0x458ac4){logger['info'](_0xbd6c('0x25'),_0x4abe74);logger[_0xbd6c('0x11')](_0xbd6c('0x25'),_0x4abe74,JSON[_0xbd6c('0x13')](_0x458ac4));_0x4560d7(_0x458ac4);})[_0xbd6c('0x18')](function(_0x4eee8f){logger[_0xbd6c('0x14')](_0xbd6c('0x25'),_0x4eee8f[_0xbd6c('0x16')],_0x4abe74);_0x5f45af(_0x11c529[_0xbd6c('0x14')](0x1f4,_0x4eee8f['message']));});});}; \ No newline at end of file +var _0x4899=['then','ShowFreshdeskAccount','find','where','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','FreshdeskAccount,\x20%s,\x20%s','message','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','attributes','include','map','model'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x4899,0x10c));var _0x9489=function(_0x4b0c68,_0x3e9302){_0x4b0c68=_0x4b0c68-0x0;var _0x4cb075=_0x4899[_0x4b0c68];return _0x4cb075;};'use strict';var _=require('lodash');var util=require(_0x9489('0x0'));var moment=require(_0x9489('0x1'));var BPromise=require('bluebird');var rs=require(_0x9489('0x2'));var fs=require('fs');var Redis=require(_0x9489('0x3'));var db=require(_0x9489('0x4'))['db'];var utils=require(_0x9489('0x5'));var logger=require(_0x9489('0x6'))(_0x9489('0x7'));var config=require('../../config/environment');var jayson=require(_0x9489('0x8'));var client=jayson[_0x9489('0x9')][_0x9489('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d4d8d,_0xd6c6fd,_0x1dfbe9){return new BPromise(function(_0x4fa2fb,_0x2721b6){return client['request'](_0x5d4d8d,_0x1dfbe9)['then'](function(_0x22c3b4){logger[_0x9489('0xb')]('FreshdeskAccount,\x20%s,\x20%s',_0xd6c6fd,'request\x20sent');logger[_0x9489('0xc')](_0x9489('0xd'),_0xd6c6fd,_0x9489('0xe'),JSON[_0x9489('0xf')](_0x22c3b4));if(_0x22c3b4['error']){if(_0x22c3b4[_0x9489('0x10')]['code']===0x1f4){logger[_0x9489('0x10')](_0x9489('0x11'),_0xd6c6fd,_0x22c3b4[_0x9489('0x10')][_0x9489('0x12')]);return _0x2721b6(_0x22c3b4[_0x9489('0x10')]['message']);}logger[_0x9489('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0xd6c6fd,_0x22c3b4[_0x9489('0x10')]['message']);return _0x4fa2fb(_0x22c3b4[_0x9489('0x10')][_0x9489('0x12')]);}else{logger[_0x9489('0xb')](_0x9489('0x11'),_0xd6c6fd,_0x9489('0xe'));_0x4fa2fb(_0x22c3b4['result'][_0x9489('0x12')]);}})[_0x9489('0x13')](function(_0x1bfa1d){logger['error'](_0x9489('0x11'),_0xd6c6fd,_0x1bfa1d);_0x2721b6(_0x1bfa1d);});});}exports[_0x9489('0x14')]=function(_0x611fe8){var _0x30de5d=this;return new Promise(function(_0x3c4442,_0x26b747){return db[_0x9489('0x15')][_0x9489('0x16')]({'raw':_0x611fe8['options']?_0x611fe8[_0x9489('0x17')][_0x9489('0x18')]===undefined?!![]:![]:!![],'where':_0x611fe8[_0x9489('0x17')]?_0x611fe8[_0x9489('0x17')]['where']||null:null,'attributes':_0x611fe8[_0x9489('0x17')]?_0x611fe8['options'][_0x9489('0x19')]||null:null,'limit':_0x611fe8[_0x9489('0x17')]?_0x611fe8['options']['limit']||null:null,'include':_0x611fe8[_0x9489('0x17')]?_0x611fe8['options'][_0x9489('0x1a')]?_[_0x9489('0x1b')](_0x611fe8[_0x9489('0x17')][_0x9489('0x1a')],function(_0x513ab9){return{'model':db[_0x513ab9['model']],'as':_0x513ab9['as'],'attributes':_0x513ab9[_0x9489('0x19')],'include':_0x513ab9[_0x9489('0x1a')]?_[_0x9489('0x1b')](_0x513ab9[_0x9489('0x1a')],function(_0x432f44){return{'model':db[_0x432f44[_0x9489('0x1c')]],'as':_0x432f44['as'],'attributes':_0x432f44[_0x9489('0x19')],'include':_0x432f44['include']?_[_0x9489('0x1b')](_0x432f44[_0x9489('0x1a')],function(_0x4d88d4){return{'model':db[_0x4d88d4['model']],'as':_0x4d88d4['as'],'attributes':_0x4d88d4['attributes']};}):[]};}):[]};}):[]:[]})[_0x9489('0x1d')](function(_0x236bbd){logger[_0x9489('0xb')](_0x9489('0x14'),_0x611fe8);logger['debug'](_0x9489('0x14'),_0x611fe8,JSON['stringify'](_0x236bbd));_0x3c4442(_0x236bbd);})['catch'](function(_0x28c63){logger['error']('GetFreshdeskAccount',_0x28c63[_0x9489('0x12')],_0x611fe8);_0x26b747(_0x30de5d[_0x9489('0x10')](0x1f4,_0x28c63[_0x9489('0x12')]));});});};exports[_0x9489('0x1e')]=function(_0x421b1a){var _0x474245=this;return new Promise(function(_0x1ff630,_0x209c50){return db[_0x9489('0x15')][_0x9489('0x1f')]({'raw':_0x421b1a['options']?_0x421b1a[_0x9489('0x17')][_0x9489('0x18')]===undefined?!![]:![]:!![],'where':_0x421b1a[_0x9489('0x17')]?_0x421b1a[_0x9489('0x17')][_0x9489('0x20')]||null:null,'attributes':_0x421b1a[_0x9489('0x17')]?_0x421b1a[_0x9489('0x17')]['attributes']||null:null,'include':_0x421b1a[_0x9489('0x17')]?_0x421b1a['options']['include']?_[_0x9489('0x1b')](_0x421b1a[_0x9489('0x17')][_0x9489('0x1a')],function(_0x3cd144){return{'model':db[_0x3cd144['model']],'as':_0x3cd144['as'],'attributes':_0x3cd144[_0x9489('0x19')],'include':_0x3cd144['include']?_[_0x9489('0x1b')](_0x3cd144[_0x9489('0x1a')],function(_0x4362d2){return{'model':db[_0x4362d2['model']],'as':_0x4362d2['as'],'attributes':_0x4362d2[_0x9489('0x19')],'include':_0x4362d2['include']?_[_0x9489('0x1b')](_0x4362d2['include'],function(_0x44923f){return{'model':db[_0x44923f['model']],'as':_0x44923f['as'],'attributes':_0x44923f[_0x9489('0x19')]};}):[]};}):[]};}):[]:[]})[_0x9489('0x1d')](function(_0x42772e){logger[_0x9489('0xb')]('ShowFreshdeskAccount',_0x421b1a);logger[_0x9489('0xc')]('ShowFreshdeskAccount',_0x421b1a,JSON[_0x9489('0xf')](_0x42772e));_0x1ff630(_0x42772e);})[_0x9489('0x13')](function(_0x1e04b9){logger['error'](_0x9489('0x1e'),_0x1e04b9['message'],_0x421b1a);_0x209c50(_0x474245['error'](0x1f4,_0x1e04b9[_0x9489('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 2cc2280..667d2fe 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 _0x56a8=['/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x56a8,0xe2));var _0x856a=function(_0x5de598,_0x1b2a84){_0x5de598=_0x5de598-0x0;var _0x16289a=_0x56a8[_0x5de598];return _0x16289a;};'use strict';var multer=require('multer');var util=require(_0x856a('0x0'));var path=require(_0x856a('0x1'));var timeout=require(_0x856a('0x2'));var express=require(_0x856a('0x3'));var router=express[_0x856a('0x4')]();var fs_extra=require(_0x856a('0x5'));var auth=require(_0x856a('0x6'));var interaction=require(_0x856a('0x7'));var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router['get']('/',auth[_0x856a('0x8')](),controller[_0x856a('0x9')]);router[_0x856a('0xa')](_0x856a('0xb'),auth[_0x856a('0x8')](),controller[_0x856a('0xc')]);router[_0x856a('0xa')](_0x856a('0xd'),auth[_0x856a('0x8')](),controller[_0x856a('0xe')]);router[_0x856a('0xa')](_0x856a('0xf'),auth[_0x856a('0x8')](),controller[_0x856a('0x10')]);router[_0x856a('0xa')](_0x856a('0x11'),auth['isAuthenticated'](),controller[_0x856a('0x12')]);router[_0x856a('0xa')](_0x856a('0x13'),auth[_0x856a('0x8')](),controller[_0x856a('0x14')]);router[_0x856a('0x15')]('/',auth['isAuthenticated'](),controller[_0x856a('0x16')]);router[_0x856a('0x15')](_0x856a('0x13'),auth[_0x856a('0x8')](),controller[_0x856a('0x17')]);router[_0x856a('0x18')](_0x856a('0xb'),auth[_0x856a('0x8')](),controller[_0x856a('0x19')]);router['delete'](_0x856a('0xb'),auth[_0x856a('0x8')](),controller['destroy']);module[_0x856a('0x1a')]=router; \ No newline at end of file +var _0x0260=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','index','/:id','isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','create','post','put','update','delete','destroy','exports','multer','path','express','Router'];(function(_0x5e462b,_0x187b06){var _0xb01a65=function(_0x2cc9a3){while(--_0x2cc9a3){_0x5e462b['push'](_0x5e462b['shift']());}};_0xb01a65(++_0x187b06);}(_0x0260,0xcc));var _0x0026=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0x0260[_0x166d93];return _0xba708;};'use strict';var multer=require(_0x0026('0x0'));var util=require('util');var path=require(_0x0026('0x1'));var timeout=require('connect-timeout');var express=require(_0x0026('0x2'));var router=express[_0x0026('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0026('0x4'));var interaction=require(_0x0026('0x5'));var config=require(_0x0026('0x6'));var controller=require(_0x0026('0x7'));router[_0x0026('0x8')]('/',auth['isAuthenticated'](),controller[_0x0026('0x9')]);router['get'](_0x0026('0xa'),auth[_0x0026('0xb')](),controller['show']);router[_0x0026('0x8')](_0x0026('0xc'),auth[_0x0026('0xb')](),controller[_0x0026('0xd')]);router['get'](_0x0026('0xe'),auth[_0x0026('0xb')](),controller[_0x0026('0xf')]);router[_0x0026('0x8')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x0026('0x10')]);router[_0x0026('0x8')](_0x0026('0x11'),auth[_0x0026('0xb')](),controller[_0x0026('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0026('0x13')]);router[_0x0026('0x14')]('/:id/tags',auth[_0x0026('0xb')](),controller['setTags']);router[_0x0026('0x15')](_0x0026('0xa'),auth['isAuthenticated'](),controller[_0x0026('0x16')]);router[_0x0026('0x17')]('/:id',auth[_0x0026('0xb')](),controller[_0x0026('0x18')]);module[_0x0026('0x19')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 0db2af6..13e66b2 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 _0xa303=['sequelize','exports','STRING'];(function(_0x42c118,_0x197006){var _0x112ebd=function(_0x337411){while(--_0x337411){_0x42c118['push'](_0x42c118['shift']());}};_0x112ebd(++_0x197006);}(_0xa303,0x13b));var _0x3a30=function(_0x374cf4,_0x458dfe){_0x374cf4=_0x374cf4-0x0;var _0x55df79=_0xa303[_0x374cf4];return _0x55df79;};'use strict';var Sequelize=require(_0x3a30('0x0'));module[_0x3a30('0x1')]={'name':{'type':Sequelize[_0x3a30('0x2')]},'description':{'type':Sequelize[_0x3a30('0x2')]}}; \ No newline at end of file +var _0xcb43=['STRING','exports'];(function(_0x49052c,_0x5c14df){var _0x2d74f2=function(_0x3972d0){while(--_0x3972d0){_0x49052c['push'](_0x49052c['shift']());}};_0x2d74f2(++_0x5c14df);}(_0xcb43,0x159));var _0x3cb4=function(_0x5a4400,_0xfae3b6){_0x5a4400=_0x5a4400-0x0;var _0xf9b532=_0xcb43[_0x5a4400];return _0xf9b532;};'use strict';var Sequelize=require('sequelize');module[_0x3cb4('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3cb4('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 82ecfdf..718976d 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 _0x581e=['../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','options','include','findAll','catch','show','params','find','create','body','getFields','FreshdeskField','pick','getSubjects','findOne','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x454321,_0x551e07){var _0x1dd220=function(_0x3e652b){while(--_0x3e652b){_0x454321['push'](_0x454321['shift']());}};_0x1dd220(++_0x551e07);}(_0x581e,0x1db));var _0xe581=function(_0x27660b,_0x14148f){_0x27660b=_0x27660b-0x0;var _0xbc5762=_0x581e[_0x27660b];return _0xbc5762;};'use strict';var emlformat=require(_0xe581('0x0'));var rimraf=require(_0xe581('0x1'));var zipdir=require(_0xe581('0x2'));var jsonpatch=require(_0xe581('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe581('0x4'));var Mustache=require('mustache');var util=require(_0xe581('0x5'));var path=require(_0xe581('0x6'));var sox=require(_0xe581('0x7'));var csv=require(_0xe581('0x8'));var ejs=require(_0xe581('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe581('0xa'));var squel=require(_0xe581('0xb'));var crypto=require(_0xe581('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe581('0xd'));var toCsv=require(_0xe581('0x8'));var querystring=require(_0xe581('0xe'));var Papa=require(_0xe581('0xf'));var Redis=require(_0xe581('0x10'));var authService=require(_0xe581('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe581('0x12'));var logger=require(_0xe581('0x13'))(_0xe581('0x14'));var utils=require(_0xe581('0x15'));var config=require(_0xe581('0x16'));var licenseUtil=require(_0xe581('0x17'));var db=require(_0xe581('0x18'))['db'];function respondWithStatusCode(_0x269f6a,_0x2939e1){_0x2939e1=_0x2939e1||0xcc;return function(_0x208967){if(_0x208967){return _0x269f6a[_0xe581('0x19')](_0x2939e1);}return _0x269f6a[_0xe581('0x1a')](_0x2939e1)['end']();};}function respondWithResult(_0x264665,_0x255dd4){_0x255dd4=_0x255dd4||0xc8;return function(_0x2f95e4){if(_0x2f95e4){return _0x264665[_0xe581('0x1a')](_0x255dd4)[_0xe581('0x1b')](_0x2f95e4);}};}function respondWithFilteredResult(_0x496150,_0x344437){return function(_0x389f0c){if(_0x389f0c){var _0x4e1ab4=typeof _0x344437[_0xe581('0x1c')]===_0xe581('0x1d')&&typeof _0x344437['limit']===_0xe581('0x1d');var _0x346398=_0x389f0c[_0xe581('0x1e')];var _0x1d56fe=_0x4e1ab4?0x0:_0x344437[_0xe581('0x1c')];var _0x4f1fdb=_0x4e1ab4?_0x389f0c['count']:_0x344437[_0xe581('0x1c')]+_0x344437[_0xe581('0x1f')];var _0x570922;if(_0x4f1fdb>=_0x346398){_0x4f1fdb=_0x346398;_0x570922=0xc8;}else{_0x570922=0xce;}_0x496150[_0xe581('0x1a')](_0x570922);return _0x496150['set']('Content-Range',_0x1d56fe+'-'+_0x4f1fdb+'/'+_0x346398)['json'](_0x389f0c);}return null;};}function patchUpdates(_0x5d5afd){return function(_0x2af38e){try{jsonpatch[_0xe581('0x20')](_0x2af38e,_0x5d5afd,!![]);}catch(_0x2223ad){return BPromise[_0xe581('0x21')](_0x2223ad);}return _0x2af38e[_0xe581('0x22')]();};}function saveUpdates(_0x22d9c3,_0x29b522){return function(_0x34a8e4){if(_0x34a8e4){return _0x34a8e4[_0xe581('0x23')](_0x22d9c3)[_0xe581('0x24')](function(_0x46eeb6){return _0x46eeb6;});}return null;};}function removeEntity(_0x3f36d1,_0x11c829){return function(_0x155f60){if(_0x155f60){return _0x155f60[_0xe581('0x25')]()['then'](function(){_0x3f36d1[_0xe581('0x1a')](0xcc)[_0xe581('0x26')]();});}};}function handleEntityNotFound(_0x429596,_0x5249d4){return function(_0x103f5b){if(!_0x103f5b){_0x429596[_0xe581('0x19')](0x194);}return _0x103f5b;};}function handleError(_0x45fa8d,_0x4058e0){_0x4058e0=_0x4058e0||0x1f4;return function(_0x155c7d){logger[_0xe581('0x27')](_0x155c7d[_0xe581('0x28')]);if(_0x155c7d[_0xe581('0x29')]){delete _0x155c7d[_0xe581('0x29')];}_0x45fa8d[_0xe581('0x1a')](_0x4058e0)[_0xe581('0x2a')](_0x155c7d);};}exports[_0xe581('0x2b')]=function(_0xe7b54f,_0x5192cb){var _0x2473fb={},_0x36318a={},_0x5a0b36={'count':0x0,'rows':[]};var _0x3599c8=_[_0xe581('0x2c')](db[_0xe581('0x2d')][_0xe581('0x2e')],function(_0x328778){return{'name':_0x328778['fieldName'],'type':_0x328778['type'][_0xe581('0x2f')]};});_0x36318a[_0xe581('0x30')]=_[_0xe581('0x2c')](_0x3599c8,_0xe581('0x29'));_0x36318a[_0xe581('0x31')]=_[_0xe581('0x32')](_0xe7b54f[_0xe581('0x31')]);_0x36318a[_0xe581('0x33')]=_[_0xe581('0x34')](_0x36318a[_0xe581('0x30')],_0x36318a[_0xe581('0x31')]);_0x2473fb['attributes']=_[_0xe581('0x34')](_0x36318a[_0xe581('0x30')],qs['fields'](_0xe7b54f[_0xe581('0x31')][_0xe581('0x35')]));_0x2473fb[_0xe581('0x36')]=_0x2473fb[_0xe581('0x36')][_0xe581('0x37')]?_0x2473fb['attributes']:_0x36318a[_0xe581('0x30')];if(!_0xe7b54f[_0xe581('0x31')][_0xe581('0x38')](_0xe581('0x39'))){_0x2473fb[_0xe581('0x1f')]=qs[_0xe581('0x1f')](_0xe7b54f[_0xe581('0x31')]['limit']);_0x2473fb[_0xe581('0x1c')]=qs[_0xe581('0x1c')](_0xe7b54f[_0xe581('0x31')]['offset']);}_0x2473fb[_0xe581('0x3a')]=qs[_0xe581('0x3b')](_0xe7b54f[_0xe581('0x31')][_0xe581('0x3b')]);_0x2473fb[_0xe581('0x3c')]=qs[_0xe581('0x33')](_['pick'](_0xe7b54f[_0xe581('0x31')],_0x36318a['filters']),_0x3599c8);if(_0xe7b54f[_0xe581('0x31')][_0xe581('0x3d')]){_0x2473fb[_0xe581('0x3c')]=_[_0xe581('0x3e')](_0x2473fb[_0xe581('0x3c')],{'$or':_['map'](_0x3599c8,function(_0xebf077){if(_0xebf077[_0xe581('0x3f')]!=='VIRTUAL'){var _0x39068e={};_0x39068e[_0xebf077[_0xe581('0x29')]]={'$like':'%'+_0xe7b54f[_0xe581('0x31')][_0xe581('0x3d')]+'%'};return _0x39068e;}})});}_0x2473fb=_['merge']({},_0x2473fb,_0xe7b54f[_0xe581('0x40')]);var _0x28f5f7={'where':_0x2473fb[_0xe581('0x3c')]};return db[_0xe581('0x2d')][_0xe581('0x1e')](_0x28f5f7)[_0xe581('0x24')](function(_0x3ad037){_0x5a0b36['count']=_0x3ad037;if(_0xe7b54f[_0xe581('0x31')]['includeAll']){_0x2473fb[_0xe581('0x41')]=[{'all':!![]}];}return db[_0xe581('0x2d')][_0xe581('0x42')](_0x2473fb);})[_0xe581('0x24')](function(_0x5777c9){_0x5a0b36['rows']=_0x5777c9;return _0x5a0b36;})['then'](respondWithFilteredResult(_0x5192cb,_0x2473fb))[_0xe581('0x43')](handleError(_0x5192cb,null));};exports[_0xe581('0x44')]=function(_0x5cd0ce,_0x79484e){var _0x586830={'raw':![],'where':{'id':_0x5cd0ce[_0xe581('0x45')]['id']}},_0x243b35={};_0x243b35[_0xe581('0x30')]=_[_0xe581('0x32')](db[_0xe581('0x2d')]['rawAttributes']);_0x243b35[_0xe581('0x31')]=_[_0xe581('0x32')](_0x5cd0ce[_0xe581('0x31')]);_0x243b35[_0xe581('0x33')]=_[_0xe581('0x34')](_0x243b35[_0xe581('0x30')],_0x243b35[_0xe581('0x31')]);_0x586830['attributes']=_[_0xe581('0x34')](_0x243b35[_0xe581('0x30')],qs[_0xe581('0x35')](_0x5cd0ce[_0xe581('0x31')][_0xe581('0x35')]));_0x586830[_0xe581('0x36')]=_0x586830[_0xe581('0x36')][_0xe581('0x37')]?_0x586830[_0xe581('0x36')]:_0x243b35[_0xe581('0x30')];if(_0x5cd0ce[_0xe581('0x31')]['includeAll']){_0x586830[_0xe581('0x41')]=[{'all':!![]}];}_0x586830=_[_0xe581('0x3e')]({},_0x586830,_0x5cd0ce[_0xe581('0x40')]);return db['FreshdeskConfiguration'][_0xe581('0x46')](_0x586830)[_0xe581('0x24')](handleEntityNotFound(_0x79484e,null))[_0xe581('0x24')](respondWithResult(_0x79484e,null))[_0xe581('0x43')](handleError(_0x79484e,null));};exports[_0xe581('0x47')]=function(_0x346a2c,_0x3c7293){return db[_0xe581('0x2d')][_0xe581('0x47')](_0x346a2c[_0xe581('0x48')],{})[_0xe581('0x24')](respondWithResult(_0x3c7293,0xc9))[_0xe581('0x43')](handleError(_0x3c7293,null));};exports[_0xe581('0x23')]=function(_0x1deec4,_0x502e1e){if(_0x1deec4[_0xe581('0x48')]['id']){delete _0x1deec4['body']['id'];}return db[_0xe581('0x2d')][_0xe581('0x46')]({'where':{'id':_0x1deec4[_0xe581('0x45')]['id']}})[_0xe581('0x24')](handleEntityNotFound(_0x502e1e,null))['then'](saveUpdates(_0x1deec4[_0xe581('0x48')],null))[_0xe581('0x24')](respondWithResult(_0x502e1e,null))[_0xe581('0x43')](handleError(_0x502e1e,null));};exports[_0xe581('0x25')]=function(_0x2b8e69,_0x1e836a){return db[_0xe581('0x2d')][_0xe581('0x46')]({'where':{'id':_0x2b8e69[_0xe581('0x45')]['id']}})['then'](handleEntityNotFound(_0x1e836a,null))['then'](removeEntity(_0x1e836a,null))[_0xe581('0x43')](handleError(_0x1e836a,null));};exports[_0xe581('0x49')]=function(_0x11c576,_0xf91f7,_0x154c51){var _0x355748={};var _0x228c9f={};var _0x1ea49d;var _0x55b2aa;return db[_0xe581('0x2d')]['findOne']({'where':{'id':_0x11c576[_0xe581('0x45')]['id']}})['then'](handleEntityNotFound(_0xf91f7,null))[_0xe581('0x24')](function(_0x10f474){if(_0x10f474){_0x1ea49d=_0x10f474;_0x228c9f[_0xe581('0x30')]=_[_0xe581('0x32')](db[_0xe581('0x4a')][_0xe581('0x2e')]);_0x228c9f[_0xe581('0x31')]=_[_0xe581('0x32')](_0x11c576['query']);_0x228c9f['filters']=_[_0xe581('0x34')](_0x228c9f[_0xe581('0x30')],_0x228c9f['query']);_0x355748[_0xe581('0x36')]=_[_0xe581('0x34')](_0x228c9f['model'],qs[_0xe581('0x35')](_0x11c576[_0xe581('0x31')][_0xe581('0x35')]));_0x355748['attributes']=_0x355748[_0xe581('0x36')][_0xe581('0x37')]?_0x355748[_0xe581('0x36')]:_0x228c9f['model'];_0x355748['order']=qs[_0xe581('0x3b')](_0x11c576[_0xe581('0x31')][_0xe581('0x3b')]);_0x355748['where']=qs[_0xe581('0x33')](_[_0xe581('0x4b')](_0x11c576[_0xe581('0x31')],_0x228c9f[_0xe581('0x33')]));if(_0x11c576[_0xe581('0x31')][_0xe581('0x3d')]){_0x355748[_0xe581('0x3c')]=_[_0xe581('0x3e')](_0x355748[_0xe581('0x3c')],{'$or':_[_0xe581('0x2c')](_0x355748[_0xe581('0x36')],function(_0x2c855a){var _0x2ed9ae={};_0x2ed9ae[_0x2c855a]={'$like':'%'+_0x11c576[_0xe581('0x31')][_0xe581('0x3d')]+'%'};return _0x2ed9ae;})});}_0x355748=_[_0xe581('0x3e')]({},_0x355748,_0x11c576[_0xe581('0x40')]);return _0x1ea49d[_0xe581('0x49')](_0x355748);}})[_0xe581('0x24')](function(_0x2145fc){if(_0x2145fc){_0x55b2aa=_0x2145fc[_0xe581('0x37')];if(!_0x11c576[_0xe581('0x31')][_0xe581('0x38')](_0xe581('0x39'))){_0x355748[_0xe581('0x1f')]=qs[_0xe581('0x1f')](_0x11c576[_0xe581('0x31')][_0xe581('0x1f')]);_0x355748[_0xe581('0x1c')]=qs[_0xe581('0x1c')](_0x11c576['query'][_0xe581('0x1c')]);}return _0x1ea49d['getFields'](_0x355748);}})[_0xe581('0x24')](function(_0x443108){if(_0x443108){return _0x443108?{'count':_0x55b2aa,'rows':_0x443108}:null;}})[_0xe581('0x24')](respondWithResult(_0xf91f7,null))[_0xe581('0x43')](handleError(_0xf91f7,null));};exports[_0xe581('0x4c')]=function(_0xfecf36,_0x5a80f0,_0x3131a4){var _0x994ca={};var _0x444fc0={};var _0x59e396;var _0x22a834;return db[_0xe581('0x2d')][_0xe581('0x4d')]({'where':{'id':_0xfecf36[_0xe581('0x45')]['id']}})[_0xe581('0x24')](handleEntityNotFound(_0x5a80f0,null))[_0xe581('0x24')](function(_0x3ccf95){if(_0x3ccf95){_0x59e396=_0x3ccf95;_0x444fc0[_0xe581('0x30')]=_['keys'](db[_0xe581('0x4a')]['rawAttributes']);_0x444fc0[_0xe581('0x31')]=_[_0xe581('0x32')](_0xfecf36[_0xe581('0x31')]);_0x444fc0[_0xe581('0x33')]=_[_0xe581('0x34')](_0x444fc0[_0xe581('0x30')],_0x444fc0[_0xe581('0x31')]);_0x994ca[_0xe581('0x36')]=_['intersection'](_0x444fc0[_0xe581('0x30')],qs['fields'](_0xfecf36[_0xe581('0x31')][_0xe581('0x35')]));_0x994ca['attributes']=_0x994ca['attributes'][_0xe581('0x37')]?_0x994ca[_0xe581('0x36')]:_0x444fc0[_0xe581('0x30')];_0x994ca[_0xe581('0x3a')]=qs[_0xe581('0x3b')](_0xfecf36[_0xe581('0x31')][_0xe581('0x3b')]);_0x994ca[_0xe581('0x3c')]=qs[_0xe581('0x33')](_[_0xe581('0x4b')](_0xfecf36[_0xe581('0x31')],_0x444fc0[_0xe581('0x33')]));if(_0xfecf36['query'][_0xe581('0x3d')]){_0x994ca['where']=_['merge'](_0x994ca[_0xe581('0x3c')],{'$or':_[_0xe581('0x2c')](_0x994ca[_0xe581('0x36')],function(_0xbda27d){var _0x450c8b={};_0x450c8b[_0xbda27d]={'$like':'%'+_0xfecf36[_0xe581('0x31')][_0xe581('0x3d')]+'%'};return _0x450c8b;})});}_0x994ca=_['merge']({},_0x994ca,_0xfecf36[_0xe581('0x40')]);return _0x59e396[_0xe581('0x4c')](_0x994ca);}})[_0xe581('0x24')](function(_0x1ec050){if(_0x1ec050){_0x22a834=_0x1ec050[_0xe581('0x37')];if(!_0xfecf36[_0xe581('0x31')][_0xe581('0x38')](_0xe581('0x39'))){_0x994ca[_0xe581('0x1f')]=qs[_0xe581('0x1f')](_0xfecf36[_0xe581('0x31')][_0xe581('0x1f')]);_0x994ca[_0xe581('0x1c')]=qs[_0xe581('0x1c')](_0xfecf36[_0xe581('0x31')][_0xe581('0x1c')]);}return _0x59e396[_0xe581('0x4c')](_0x994ca);}})['then'](function(_0xc64087){if(_0xc64087){return _0xc64087?{'count':_0x22a834,'rows':_0xc64087}:null;}})[_0xe581('0x24')](respondWithResult(_0x5a80f0,null))['catch'](handleError(_0x5a80f0,null));};exports['getDescriptions']=function(_0x49237c,_0x385e29,_0x2aa54f){var _0x116536={};var _0x5bdb12={};var _0x348cc4;var _0x26c343;return db[_0xe581('0x2d')][_0xe581('0x4d')]({'where':{'id':_0x49237c[_0xe581('0x45')]['id']}})[_0xe581('0x24')](handleEntityNotFound(_0x385e29,null))['then'](function(_0x5c1aa7){if(_0x5c1aa7){_0x348cc4=_0x5c1aa7;_0x5bdb12[_0xe581('0x30')]=_[_0xe581('0x32')](db[_0xe581('0x4a')][_0xe581('0x2e')]);_0x5bdb12[_0xe581('0x31')]=_['keys'](_0x49237c[_0xe581('0x31')]);_0x5bdb12[_0xe581('0x33')]=_[_0xe581('0x34')](_0x5bdb12[_0xe581('0x30')],_0x5bdb12[_0xe581('0x31')]);_0x116536[_0xe581('0x36')]=_[_0xe581('0x34')](_0x5bdb12[_0xe581('0x30')],qs[_0xe581('0x35')](_0x49237c[_0xe581('0x31')][_0xe581('0x35')]));_0x116536[_0xe581('0x36')]=_0x116536['attributes'][_0xe581('0x37')]?_0x116536[_0xe581('0x36')]:_0x5bdb12[_0xe581('0x30')];_0x116536[_0xe581('0x3a')]=qs[_0xe581('0x3b')](_0x49237c[_0xe581('0x31')][_0xe581('0x3b')]);_0x116536[_0xe581('0x3c')]=qs[_0xe581('0x33')](_[_0xe581('0x4b')](_0x49237c['query'],_0x5bdb12[_0xe581('0x33')]));if(_0x49237c['query'][_0xe581('0x3d')]){_0x116536['where']=_[_0xe581('0x3e')](_0x116536[_0xe581('0x3c')],{'$or':_['map'](_0x116536[_0xe581('0x36')],function(_0x5e14e2){var _0x4361b5={};_0x4361b5[_0x5e14e2]={'$like':'%'+_0x49237c[_0xe581('0x31')][_0xe581('0x3d')]+'%'};return _0x4361b5;})});}_0x116536=_[_0xe581('0x3e')]({},_0x116536,_0x49237c['options']);return _0x348cc4[_0xe581('0x4e')](_0x116536);}})[_0xe581('0x24')](function(_0x3c943e){if(_0x3c943e){_0x26c343=_0x3c943e[_0xe581('0x37')];if(!_0x49237c['query'][_0xe581('0x38')]('nolimit')){_0x116536['limit']=qs[_0xe581('0x1f')](_0x49237c[_0xe581('0x31')]['limit']);_0x116536[_0xe581('0x1c')]=qs[_0xe581('0x1c')](_0x49237c[_0xe581('0x31')][_0xe581('0x1c')]);}return _0x348cc4[_0xe581('0x4e')](_0x116536);}})[_0xe581('0x24')](function(_0x46eb1a){if(_0x46eb1a){return _0x46eb1a?{'count':_0x26c343,'rows':_0x46eb1a}:null;}})[_0xe581('0x24')](respondWithResult(_0x385e29,null))[_0xe581('0x43')](handleError(_0x385e29,null));};exports['getTags']=function(_0x569474,_0x13dff3,_0x9c095){var _0x3f8b83={};var _0x5c4df1={};var _0x32bafd;var _0xc18c64;return db[_0xe581('0x2d')][_0xe581('0x4d')]({'where':{'id':_0x569474[_0xe581('0x45')]['id']}})[_0xe581('0x24')](handleEntityNotFound(_0x13dff3,null))[_0xe581('0x24')](function(_0x1cfa3e){if(_0x1cfa3e){_0x32bafd=_0x1cfa3e;_0x5c4df1['model']=_[_0xe581('0x32')](db[_0xe581('0x4f')][_0xe581('0x2e')]);_0x5c4df1[_0xe581('0x31')]=_[_0xe581('0x32')](_0x569474[_0xe581('0x31')]);_0x5c4df1[_0xe581('0x33')]=_[_0xe581('0x34')](_0x5c4df1['model'],_0x5c4df1['query']);_0x3f8b83[_0xe581('0x36')]=_[_0xe581('0x34')](_0x5c4df1[_0xe581('0x30')],qs['fields'](_0x569474[_0xe581('0x31')]['fields']));_0x3f8b83[_0xe581('0x36')]=_0x3f8b83[_0xe581('0x36')][_0xe581('0x37')]?_0x3f8b83['attributes']:_0x5c4df1['model'];_0x3f8b83[_0xe581('0x3a')]=qs[_0xe581('0x3b')](_0x569474[_0xe581('0x31')][_0xe581('0x3b')]);_0x3f8b83['where']=qs[_0xe581('0x33')](_['pick'](_0x569474[_0xe581('0x31')],_0x5c4df1['filters']));if(_0x569474['query'][_0xe581('0x3d')]){_0x3f8b83['where']=_['merge'](_0x3f8b83['where'],{'$or':_[_0xe581('0x2c')](_0x3f8b83[_0xe581('0x36')],function(_0x2fbf01){var _0x25bf9c={};_0x25bf9c[_0x2fbf01]={'$like':'%'+_0x569474['query'][_0xe581('0x3d')]+'%'};return _0x25bf9c;})});}_0x3f8b83=_['merge']({},_0x3f8b83,_0x569474[_0xe581('0x40')]);return _0x32bafd[_0xe581('0x50')](_0x3f8b83);}})[_0xe581('0x24')](function(_0x42e8c6){if(_0x42e8c6){_0xc18c64=_0x42e8c6[_0xe581('0x37')];if(!_0x569474[_0xe581('0x31')][_0xe581('0x38')]('nolimit')){_0x3f8b83[_0xe581('0x1f')]=qs[_0xe581('0x1f')](_0x569474[_0xe581('0x31')][_0xe581('0x1f')]);_0x3f8b83['offset']=qs['offset'](_0x569474[_0xe581('0x31')]['offset']);}return _0x32bafd[_0xe581('0x50')](_0x3f8b83);}})['then'](function(_0x48ba26){if(_0x48ba26){return _0x48ba26?{'count':_0xc18c64,'rows':_0x48ba26}:null;}})[_0xe581('0x24')](respondWithResult(_0x13dff3,null))[_0xe581('0x43')](handleError(_0x13dff3,null));};exports[_0xe581('0x51')]=function(_0x3426cd,_0x3979d5,_0x2aa97b){if(_0x3426cd[_0xe581('0x48')]['id']){delete _0x3426cd[_0xe581('0x48')]['id'];}return db[_0xe581('0x2d')]['findOne']({'where':{'id':_0x3426cd[_0xe581('0x45')]['id']}})['then'](handleEntityNotFound(_0x3979d5,null))['then'](function(_0x32ac3f){if(_0x32ac3f){return _0x32ac3f[_0xe581('0x51')](_0x3426cd[_0xe581('0x48')][_0xe581('0x52')]||[]);}return null;})[_0xe581('0x24')](respondWithResult(_0x3979d5,null))[_0xe581('0x43')](handleError(_0x3979d5,null));}; \ No newline at end of file +var _0x929e=['undefined','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','FreshdeskConfiguration','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','rawAttributes','catch','create','body','update','find','params','getFields','findOne','FreshdeskField','order','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json'];(function(_0x25a136,_0x57320e){var _0x5b7159=function(_0x32c8f9){while(--_0x32c8f9){_0x25a136['push'](_0x25a136['shift']());}};_0x5b7159(++_0x57320e);}(_0x929e,0xeb));var _0xe929=function(_0x3834a9,_0x2807c4){_0x3834a9=_0x3834a9-0x0;var _0x584e3d=_0x929e[_0x3834a9];return _0x584e3d;};'use strict';var emlformat=require(_0xe929('0x0'));var rimraf=require(_0xe929('0x1'));var zipdir=require(_0xe929('0x2'));var jsonpatch=require(_0xe929('0x3'));var rp=require(_0xe929('0x4'));var moment=require(_0xe929('0x5'));var BPromise=require(_0xe929('0x6'));var Mustache=require(_0xe929('0x7'));var util=require('util');var path=require(_0xe929('0x8'));var sox=require(_0xe929('0x9'));var csv=require(_0xe929('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe929('0xb'));var _=require(_0xe929('0xc'));var squel=require(_0xe929('0xd'));var crypto=require(_0xe929('0xe'));var jsforce=require(_0xe929('0xf'));var deskjs=require(_0xe929('0x10'));var toCsv=require(_0xe929('0xa'));var querystring=require(_0xe929('0x11'));var Papa=require(_0xe929('0x12'));var Redis=require(_0xe929('0x13'));var authService=require(_0xe929('0x14'));var qs=require(_0xe929('0x15'));var as=require(_0xe929('0x16'));var hardwareService=require(_0xe929('0x17'));var logger=require(_0xe929('0x18'))(_0xe929('0x19'));var utils=require(_0xe929('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0xe929('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fe4c8,_0x2bcbf7){_0x2bcbf7=_0x2bcbf7||0xcc;return function(_0x24e084){if(_0x24e084){return _0x3fe4c8[_0xe929('0x1c')](_0x2bcbf7);}return _0x3fe4c8[_0xe929('0x1d')](_0x2bcbf7)[_0xe929('0x1e')]();};}function respondWithResult(_0xafa630,_0x2aedc8){_0x2aedc8=_0x2aedc8||0xc8;return function(_0x32fa5f){if(_0x32fa5f){return _0xafa630['status'](_0x2aedc8)[_0xe929('0x1f')](_0x32fa5f);}};}function respondWithFilteredResult(_0x2371da,_0xe076b1){return function(_0x38e16a){if(_0x38e16a){var _0x270caa=typeof _0xe076b1['offset']===_0xe929('0x20')&&typeof _0xe076b1['limit']==='undefined';var _0x2b205e=_0x38e16a[_0xe929('0x21')];var _0xb3a8f3=_0x270caa?0x0:_0xe076b1[_0xe929('0x22')];var _0x2ffb67=_0x270caa?_0x38e16a[_0xe929('0x21')]:_0xe076b1[_0xe929('0x22')]+_0xe076b1[_0xe929('0x23')];var _0x20258e;if(_0x2ffb67>=_0x2b205e){_0x2ffb67=_0x2b205e;_0x20258e=0xc8;}else{_0x20258e=0xce;}_0x2371da[_0xe929('0x1d')](_0x20258e);return _0x2371da[_0xe929('0x24')](_0xe929('0x25'),_0xb3a8f3+'-'+_0x2ffb67+'/'+_0x2b205e)[_0xe929('0x1f')](_0x38e16a);}return null;};}function patchUpdates(_0x31f389){return function(_0x46bdc8){try{jsonpatch[_0xe929('0x26')](_0x46bdc8,_0x31f389,!![]);}catch(_0x3f35ed){return BPromise[_0xe929('0x27')](_0x3f35ed);}return _0x46bdc8[_0xe929('0x28')]();};}function saveUpdates(_0x3d4b00,_0x2b5294){return function(_0x142189){if(_0x142189){return _0x142189['update'](_0x3d4b00)[_0xe929('0x29')](function(_0x23d43d){return _0x23d43d;});}return null;};}function removeEntity(_0xbaabd3,_0x1ca99b){return function(_0x4ffe43){if(_0x4ffe43){return _0x4ffe43[_0xe929('0x2a')]()[_0xe929('0x29')](function(){_0xbaabd3[_0xe929('0x1d')](0xcc)[_0xe929('0x1e')]();});}};}function handleEntityNotFound(_0x371163,_0x2ce09e){return function(_0x5733e6){if(!_0x5733e6){_0x371163[_0xe929('0x1c')](0x194);}return _0x5733e6;};}function handleError(_0x5087bb,_0x48f13b){_0x48f13b=_0x48f13b||0x1f4;return function(_0xd4d20d){logger[_0xe929('0x2b')](_0xd4d20d[_0xe929('0x2c')]);if(_0xd4d20d[_0xe929('0x2d')]){delete _0xd4d20d[_0xe929('0x2d')];}_0x5087bb[_0xe929('0x1d')](_0x48f13b)['send'](_0xd4d20d);};}exports[_0xe929('0x2e')]=function(_0x4a65ad,_0x3a45e6){var _0x275293={},_0x5ef072={},_0x12bf47={'count':0x0,'rows':[]};var _0x14cc8f=_[_0xe929('0x2f')](db[_0xe929('0x30')]['rawAttributes'],function(_0x5e5c04){return{'name':_0x5e5c04['fieldName'],'type':_0x5e5c04[_0xe929('0x31')]['key']};});_0x5ef072[_0xe929('0x32')]=_[_0xe929('0x2f')](_0x14cc8f,_0xe929('0x2d'));_0x5ef072[_0xe929('0x33')]=_[_0xe929('0x34')](_0x4a65ad[_0xe929('0x33')]);_0x5ef072[_0xe929('0x35')]=_[_0xe929('0x36')](_0x5ef072[_0xe929('0x32')],_0x5ef072[_0xe929('0x33')]);_0x275293['attributes']=_[_0xe929('0x36')](_0x5ef072[_0xe929('0x32')],qs['fields'](_0x4a65ad[_0xe929('0x33')][_0xe929('0x37')]));_0x275293[_0xe929('0x38')]=_0x275293[_0xe929('0x38')][_0xe929('0x39')]?_0x275293[_0xe929('0x38')]:_0x5ef072[_0xe929('0x32')];if(!_0x4a65ad[_0xe929('0x33')][_0xe929('0x3a')](_0xe929('0x3b'))){_0x275293[_0xe929('0x23')]=qs['limit'](_0x4a65ad[_0xe929('0x33')][_0xe929('0x23')]);_0x275293[_0xe929('0x22')]=qs[_0xe929('0x22')](_0x4a65ad[_0xe929('0x33')]['offset']);}_0x275293['order']=qs[_0xe929('0x3c')](_0x4a65ad[_0xe929('0x33')][_0xe929('0x3c')]);_0x275293[_0xe929('0x3d')]=qs[_0xe929('0x35')](_[_0xe929('0x3e')](_0x4a65ad[_0xe929('0x33')],_0x5ef072[_0xe929('0x35')]),_0x14cc8f);if(_0x4a65ad[_0xe929('0x33')][_0xe929('0x3f')]){_0x275293['where']=_[_0xe929('0x40')](_0x275293[_0xe929('0x3d')],{'$or':_['map'](_0x14cc8f,function(_0x4a61e9){if(_0x4a61e9[_0xe929('0x31')]!==_0xe929('0x41')){var _0x26cf11={};_0x26cf11[_0x4a61e9[_0xe929('0x2d')]]={'$like':'%'+_0x4a65ad[_0xe929('0x33')][_0xe929('0x3f')]+'%'};return _0x26cf11;}})});}_0x275293=_[_0xe929('0x40')]({},_0x275293,_0x4a65ad[_0xe929('0x42')]);var _0x5ccdba={'where':_0x275293['where']};return db[_0xe929('0x30')][_0xe929('0x21')](_0x5ccdba)['then'](function(_0x5ab2e6){_0x12bf47[_0xe929('0x21')]=_0x5ab2e6;if(_0x4a65ad[_0xe929('0x33')][_0xe929('0x43')]){_0x275293[_0xe929('0x44')]=[{'all':!![]}];}return db[_0xe929('0x30')][_0xe929('0x45')](_0x275293);})[_0xe929('0x29')](function(_0x400e9d){_0x12bf47[_0xe929('0x46')]=_0x400e9d;return _0x12bf47;})['then'](respondWithFilteredResult(_0x3a45e6,_0x275293))['catch'](handleError(_0x3a45e6,null));};exports[_0xe929('0x47')]=function(_0x207477,_0x58005d){var _0xbc13fe={'raw':![],'where':{'id':_0x207477['params']['id']}},_0x475851={};_0x475851[_0xe929('0x32')]=_['keys'](db['FreshdeskConfiguration'][_0xe929('0x48')]);_0x475851['query']=_[_0xe929('0x34')](_0x207477['query']);_0x475851[_0xe929('0x35')]=_[_0xe929('0x36')](_0x475851[_0xe929('0x32')],_0x475851[_0xe929('0x33')]);_0xbc13fe['attributes']=_[_0xe929('0x36')](_0x475851[_0xe929('0x32')],qs[_0xe929('0x37')](_0x207477[_0xe929('0x33')][_0xe929('0x37')]));_0xbc13fe[_0xe929('0x38')]=_0xbc13fe[_0xe929('0x38')][_0xe929('0x39')]?_0xbc13fe[_0xe929('0x38')]:_0x475851[_0xe929('0x32')];if(_0x207477[_0xe929('0x33')][_0xe929('0x43')]){_0xbc13fe['include']=[{'all':!![]}];}_0xbc13fe=_['merge']({},_0xbc13fe,_0x207477[_0xe929('0x42')]);return db[_0xe929('0x30')]['find'](_0xbc13fe)['then'](handleEntityNotFound(_0x58005d,null))[_0xe929('0x29')](respondWithResult(_0x58005d,null))[_0xe929('0x49')](handleError(_0x58005d,null));};exports[_0xe929('0x4a')]=function(_0x3541d7,_0x50ef00){return db[_0xe929('0x30')][_0xe929('0x4a')](_0x3541d7[_0xe929('0x4b')],{})[_0xe929('0x29')](respondWithResult(_0x50ef00,0xc9))['catch'](handleError(_0x50ef00,null));};exports[_0xe929('0x4c')]=function(_0x4b8e07,_0x28695c){if(_0x4b8e07[_0xe929('0x4b')]['id']){delete _0x4b8e07[_0xe929('0x4b')]['id'];}return db[_0xe929('0x30')][_0xe929('0x4d')]({'where':{'id':_0x4b8e07[_0xe929('0x4e')]['id']}})['then'](handleEntityNotFound(_0x28695c,null))['then'](saveUpdates(_0x4b8e07['body'],null))[_0xe929('0x29')](respondWithResult(_0x28695c,null))[_0xe929('0x49')](handleError(_0x28695c,null));};exports[_0xe929('0x2a')]=function(_0x5bfff7,_0x3b6bda){return db[_0xe929('0x30')][_0xe929('0x4d')]({'where':{'id':_0x5bfff7['params']['id']}})['then'](handleEntityNotFound(_0x3b6bda,null))[_0xe929('0x29')](removeEntity(_0x3b6bda,null))[_0xe929('0x49')](handleError(_0x3b6bda,null));};exports[_0xe929('0x4f')]=function(_0x72acd6,_0xc2d45d,_0x4d7653){var _0x525150={};var _0x2f19d7={};var _0x1b8756;var _0x547678;return db[_0xe929('0x30')][_0xe929('0x50')]({'where':{'id':_0x72acd6[_0xe929('0x4e')]['id']}})['then'](handleEntityNotFound(_0xc2d45d,null))[_0xe929('0x29')](function(_0x44477d){if(_0x44477d){_0x1b8756=_0x44477d;_0x2f19d7[_0xe929('0x32')]=_['keys'](db[_0xe929('0x51')][_0xe929('0x48')]);_0x2f19d7['query']=_[_0xe929('0x34')](_0x72acd6[_0xe929('0x33')]);_0x2f19d7[_0xe929('0x35')]=_[_0xe929('0x36')](_0x2f19d7[_0xe929('0x32')],_0x2f19d7[_0xe929('0x33')]);_0x525150[_0xe929('0x38')]=_[_0xe929('0x36')](_0x2f19d7[_0xe929('0x32')],qs['fields'](_0x72acd6[_0xe929('0x33')]['fields']));_0x525150[_0xe929('0x38')]=_0x525150[_0xe929('0x38')][_0xe929('0x39')]?_0x525150[_0xe929('0x38')]:_0x2f19d7[_0xe929('0x32')];_0x525150[_0xe929('0x52')]=qs['sort'](_0x72acd6[_0xe929('0x33')][_0xe929('0x3c')]);_0x525150['where']=qs[_0xe929('0x35')](_['pick'](_0x72acd6[_0xe929('0x33')],_0x2f19d7[_0xe929('0x35')]));if(_0x72acd6[_0xe929('0x33')][_0xe929('0x3f')]){_0x525150['where']=_[_0xe929('0x40')](_0x525150[_0xe929('0x3d')],{'$or':_[_0xe929('0x2f')](_0x525150[_0xe929('0x38')],function(_0x3978cd){var _0x1d6214={};_0x1d6214[_0x3978cd]={'$like':'%'+_0x72acd6[_0xe929('0x33')][_0xe929('0x3f')]+'%'};return _0x1d6214;})});}_0x525150=_[_0xe929('0x40')]({},_0x525150,_0x72acd6['options']);return _0x1b8756[_0xe929('0x4f')](_0x525150);}})[_0xe929('0x29')](function(_0x362b7d){if(_0x362b7d){_0x547678=_0x362b7d[_0xe929('0x39')];if(!_0x72acd6[_0xe929('0x33')]['hasOwnProperty']('nolimit')){_0x525150['limit']=qs[_0xe929('0x23')](_0x72acd6[_0xe929('0x33')][_0xe929('0x23')]);_0x525150[_0xe929('0x22')]=qs[_0xe929('0x22')](_0x72acd6[_0xe929('0x33')]['offset']);}return _0x1b8756[_0xe929('0x4f')](_0x525150);}})[_0xe929('0x29')](function(_0x1cb532){if(_0x1cb532){return _0x1cb532?{'count':_0x547678,'rows':_0x1cb532}:null;}})[_0xe929('0x29')](respondWithResult(_0xc2d45d,null))['catch'](handleError(_0xc2d45d,null));};exports[_0xe929('0x53')]=function(_0x3ff7be,_0x113e76,_0x4164ee){var _0x4c651e={};var _0x1da9ff={};var _0x3b566e;var _0x135278;return db['FreshdeskConfiguration'][_0xe929('0x50')]({'where':{'id':_0x3ff7be['params']['id']}})[_0xe929('0x29')](handleEntityNotFound(_0x113e76,null))[_0xe929('0x29')](function(_0x398e69){if(_0x398e69){_0x3b566e=_0x398e69;_0x1da9ff[_0xe929('0x32')]=_['keys'](db['FreshdeskField'][_0xe929('0x48')]);_0x1da9ff[_0xe929('0x33')]=_[_0xe929('0x34')](_0x3ff7be[_0xe929('0x33')]);_0x1da9ff[_0xe929('0x35')]=_['intersection'](_0x1da9ff[_0xe929('0x32')],_0x1da9ff['query']);_0x4c651e['attributes']=_[_0xe929('0x36')](_0x1da9ff[_0xe929('0x32')],qs[_0xe929('0x37')](_0x3ff7be['query']['fields']));_0x4c651e[_0xe929('0x38')]=_0x4c651e[_0xe929('0x38')]['length']?_0x4c651e['attributes']:_0x1da9ff[_0xe929('0x32')];_0x4c651e[_0xe929('0x52')]=qs[_0xe929('0x3c')](_0x3ff7be[_0xe929('0x33')][_0xe929('0x3c')]);_0x4c651e[_0xe929('0x3d')]=qs[_0xe929('0x35')](_[_0xe929('0x3e')](_0x3ff7be[_0xe929('0x33')],_0x1da9ff['filters']));if(_0x3ff7be[_0xe929('0x33')][_0xe929('0x3f')]){_0x4c651e['where']=_[_0xe929('0x40')](_0x4c651e[_0xe929('0x3d')],{'$or':_[_0xe929('0x2f')](_0x4c651e[_0xe929('0x38')],function(_0x18f35d){var _0x4ad8d7={};_0x4ad8d7[_0x18f35d]={'$like':'%'+_0x3ff7be[_0xe929('0x33')]['filter']+'%'};return _0x4ad8d7;})});}_0x4c651e=_[_0xe929('0x40')]({},_0x4c651e,_0x3ff7be[_0xe929('0x42')]);return _0x3b566e[_0xe929('0x53')](_0x4c651e);}})[_0xe929('0x29')](function(_0x20f92e){if(_0x20f92e){_0x135278=_0x20f92e[_0xe929('0x39')];if(!_0x3ff7be[_0xe929('0x33')][_0xe929('0x3a')](_0xe929('0x3b'))){_0x4c651e[_0xe929('0x23')]=qs[_0xe929('0x23')](_0x3ff7be[_0xe929('0x33')][_0xe929('0x23')]);_0x4c651e[_0xe929('0x22')]=qs[_0xe929('0x22')](_0x3ff7be['query'][_0xe929('0x22')]);}return _0x3b566e['getSubjects'](_0x4c651e);}})[_0xe929('0x29')](function(_0x3257c2){if(_0x3257c2){return _0x3257c2?{'count':_0x135278,'rows':_0x3257c2}:null;}})[_0xe929('0x29')](respondWithResult(_0x113e76,null))['catch'](handleError(_0x113e76,null));};exports[_0xe929('0x54')]=function(_0x3e889a,_0x197c5a,_0x2ef747){var _0x11680c={};var _0x27a365={};var _0x23cbb7;var _0x3a84de;return db['FreshdeskConfiguration'][_0xe929('0x50')]({'where':{'id':_0x3e889a[_0xe929('0x4e')]['id']}})['then'](handleEntityNotFound(_0x197c5a,null))[_0xe929('0x29')](function(_0x25d8e5){if(_0x25d8e5){_0x23cbb7=_0x25d8e5;_0x27a365[_0xe929('0x32')]=_[_0xe929('0x34')](db[_0xe929('0x51')][_0xe929('0x48')]);_0x27a365[_0xe929('0x33')]=_['keys'](_0x3e889a['query']);_0x27a365[_0xe929('0x35')]=_[_0xe929('0x36')](_0x27a365['model'],_0x27a365['query']);_0x11680c[_0xe929('0x38')]=_[_0xe929('0x36')](_0x27a365['model'],qs['fields'](_0x3e889a['query'][_0xe929('0x37')]));_0x11680c['attributes']=_0x11680c['attributes'][_0xe929('0x39')]?_0x11680c[_0xe929('0x38')]:_0x27a365[_0xe929('0x32')];_0x11680c['order']=qs['sort'](_0x3e889a[_0xe929('0x33')][_0xe929('0x3c')]);_0x11680c[_0xe929('0x3d')]=qs['filters'](_[_0xe929('0x3e')](_0x3e889a[_0xe929('0x33')],_0x27a365['filters']));if(_0x3e889a['query'][_0xe929('0x3f')]){_0x11680c[_0xe929('0x3d')]=_[_0xe929('0x40')](_0x11680c[_0xe929('0x3d')],{'$or':_[_0xe929('0x2f')](_0x11680c[_0xe929('0x38')],function(_0x479b57){var _0x41ce2c={};_0x41ce2c[_0x479b57]={'$like':'%'+_0x3e889a[_0xe929('0x33')][_0xe929('0x3f')]+'%'};return _0x41ce2c;})});}_0x11680c=_['merge']({},_0x11680c,_0x3e889a[_0xe929('0x42')]);return _0x23cbb7[_0xe929('0x54')](_0x11680c);}})[_0xe929('0x29')](function(_0x44c2dc){if(_0x44c2dc){_0x3a84de=_0x44c2dc['length'];if(!_0x3e889a[_0xe929('0x33')][_0xe929('0x3a')](_0xe929('0x3b'))){_0x11680c[_0xe929('0x23')]=qs[_0xe929('0x23')](_0x3e889a[_0xe929('0x33')][_0xe929('0x23')]);_0x11680c[_0xe929('0x22')]=qs['offset'](_0x3e889a['query']['offset']);}return _0x23cbb7[_0xe929('0x54')](_0x11680c);}})[_0xe929('0x29')](function(_0x1d1c1a){if(_0x1d1c1a){return _0x1d1c1a?{'count':_0x3a84de,'rows':_0x1d1c1a}:null;}})[_0xe929('0x29')](respondWithResult(_0x197c5a,null))[_0xe929('0x49')](handleError(_0x197c5a,null));};exports[_0xe929('0x55')]=function(_0x2d109b,_0x30bc45,_0x10a1bf){var _0x273c63={};var _0x43afd6={};var _0x24dbd9;var _0x6c4640;return db[_0xe929('0x30')][_0xe929('0x50')]({'where':{'id':_0x2d109b['params']['id']}})[_0xe929('0x29')](handleEntityNotFound(_0x30bc45,null))[_0xe929('0x29')](function(_0x535ed6){if(_0x535ed6){_0x24dbd9=_0x535ed6;_0x43afd6[_0xe929('0x32')]=_['keys'](db[_0xe929('0x56')][_0xe929('0x48')]);_0x43afd6[_0xe929('0x33')]=_[_0xe929('0x34')](_0x2d109b[_0xe929('0x33')]);_0x43afd6[_0xe929('0x35')]=_[_0xe929('0x36')](_0x43afd6['model'],_0x43afd6[_0xe929('0x33')]);_0x273c63['attributes']=_[_0xe929('0x36')](_0x43afd6[_0xe929('0x32')],qs[_0xe929('0x37')](_0x2d109b['query'][_0xe929('0x37')]));_0x273c63[_0xe929('0x38')]=_0x273c63['attributes'][_0xe929('0x39')]?_0x273c63[_0xe929('0x38')]:_0x43afd6[_0xe929('0x32')];_0x273c63[_0xe929('0x52')]=qs[_0xe929('0x3c')](_0x2d109b['query'][_0xe929('0x3c')]);_0x273c63[_0xe929('0x3d')]=qs[_0xe929('0x35')](_[_0xe929('0x3e')](_0x2d109b[_0xe929('0x33')],_0x43afd6[_0xe929('0x35')]));if(_0x2d109b['query'][_0xe929('0x3f')]){_0x273c63[_0xe929('0x3d')]=_[_0xe929('0x40')](_0x273c63[_0xe929('0x3d')],{'$or':_[_0xe929('0x2f')](_0x273c63['attributes'],function(_0x4cfc9c){var _0x2671de={};_0x2671de[_0x4cfc9c]={'$like':'%'+_0x2d109b[_0xe929('0x33')][_0xe929('0x3f')]+'%'};return _0x2671de;})});}_0x273c63=_[_0xe929('0x40')]({},_0x273c63,_0x2d109b[_0xe929('0x42')]);return _0x24dbd9[_0xe929('0x55')](_0x273c63);}})['then'](function(_0x59f2b1){if(_0x59f2b1){_0x6c4640=_0x59f2b1[_0xe929('0x39')];if(!_0x2d109b[_0xe929('0x33')][_0xe929('0x3a')](_0xe929('0x3b'))){_0x273c63[_0xe929('0x23')]=qs[_0xe929('0x23')](_0x2d109b[_0xe929('0x33')][_0xe929('0x23')]);_0x273c63[_0xe929('0x22')]=qs[_0xe929('0x22')](_0x2d109b[_0xe929('0x33')]['offset']);}return _0x24dbd9[_0xe929('0x55')](_0x273c63);}})[_0xe929('0x29')](function(_0x4737d8){if(_0x4737d8){return _0x4737d8?{'count':_0x6c4640,'rows':_0x4737d8}:null;}})[_0xe929('0x29')](respondWithResult(_0x30bc45,null))[_0xe929('0x49')](handleError(_0x30bc45,null));};exports[_0xe929('0x57')]=function(_0x1afe45,_0x13e3a9,_0x9e4e2){if(_0x1afe45[_0xe929('0x4b')]['id']){delete _0x1afe45[_0xe929('0x4b')]['id'];}return db[_0xe929('0x30')][_0xe929('0x50')]({'where':{'id':_0x1afe45['params']['id']}})[_0xe929('0x29')](handleEntityNotFound(_0x13e3a9,null))[_0xe929('0x29')](function(_0x55ca62){if(_0x55ca62){return _0x55ca62['setTags'](_0x1afe45[_0xe929('0x4b')][_0xe929('0x58')]||[]);}return null;})[_0xe929('0x29')](respondWithResult(_0x13e3a9,null))[_0xe929('0x49')](handleError(_0x13e3a9,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 86a497d..2cce200 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 _0xe398=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','int_freshdesk_configurations','lodash','util','../../config/logger','api'];(function(_0x40ddc0,_0x41c082){var _0x1aebf1=function(_0x3ba1f6){while(--_0x3ba1f6){_0x40ddc0['push'](_0x40ddc0['shift']());}};_0x1aebf1(++_0x41c082);}(_0xe398,0x1ae));var _0x8e39=function(_0x4ca0b5,_0x3a5c1d){_0x4ca0b5=_0x4ca0b5-0x0;var _0x3b9d77=_0xe398[_0x4ca0b5];return _0x3b9d77;};'use strict';var _=require(_0x8e39('0x0'));var util=require(_0x8e39('0x1'));var logger=require(_0x8e39('0x2'))(_0x8e39('0x3'));var moment=require(_0x8e39('0x4'));var BPromise=require(_0x8e39('0x5'));var rp=require(_0x8e39('0x6'));var fs=require('fs');var path=require(_0x8e39('0x7'));var rimraf=require(_0x8e39('0x8'));var config=require(_0x8e39('0x9'));var attributes=require(_0x8e39('0xa'));module[_0x8e39('0xb')]=function(_0x534cfd,_0x227e46){return _0x534cfd[_0x8e39('0xc')]('FreshdeskConfiguration',attributes,{'tableName':_0x8e39('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1143=['define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports'];(function(_0x540eb8,_0x4c9bb4){var _0x587e07=function(_0x46f617){while(--_0x46f617){_0x540eb8['push'](_0x540eb8['shift']());}};_0x587e07(++_0x4c9bb4);}(_0x1143,0x11b));var _0x3114=function(_0x568eca,_0x549174){_0x568eca=_0x568eca-0x0;var _0x767192=_0x1143[_0x568eca];return _0x767192;};'use strict';var _=require(_0x3114('0x0'));var util=require(_0x3114('0x1'));var logger=require(_0x3114('0x2'))(_0x3114('0x3'));var moment=require(_0x3114('0x4'));var BPromise=require('bluebird');var rp=require(_0x3114('0x5'));var fs=require('fs');var path=require(_0x3114('0x6'));var rimraf=require(_0x3114('0x7'));var config=require(_0x3114('0x8'));var attributes=require(_0x3114('0x9'));module[_0x3114('0xa')]=function(_0x58863b,_0x24f647){return _0x58863b[_0x3114('0xb')](_0x3114('0xc'),attributes,{'tableName':_0x3114('0xd'),'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 2af33e3..c76e79d 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 _0x5da3=['info','debug','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','request\x20sent','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request'];(function(_0x34dd3c,_0x12616c){var _0x19beab=function(_0x327c96){while(--_0x327c96){_0x34dd3c['push'](_0x34dd3c['shift']());}};_0x19beab(++_0x12616c);}(_0x5da3,0x116));var _0x35da=function(_0x458b0,_0x15f01d){_0x458b0=_0x458b0-0x0;var _0x294e1f=_0x5da3[_0x458b0];return _0x294e1f;};'use strict';var _=require('lodash');var util=require(_0x35da('0x0'));var moment=require(_0x35da('0x1'));var BPromise=require(_0x35da('0x2'));var rs=require(_0x35da('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x35da('0x4'))['db'];var utils=require(_0x35da('0x5'));var logger=require('../../config/logger')(_0x35da('0x6'));var config=require(_0x35da('0x7'));var jayson=require(_0x35da('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x34843e,_0x5285f1,_0x3f125b){return new BPromise(function(_0xc821f7,_0x4d2d1e){return client[_0x35da('0x9')](_0x34843e,_0x3f125b)['then'](function(_0x24a757){logger[_0x35da('0xa')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x5285f1,'request\x20sent');logger[_0x35da('0xb')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x5285f1,'request\x20sent',JSON['stringify'](_0x24a757));if(_0x24a757['error']){if(_0x24a757[_0x35da('0xc')][_0x35da('0xd')]===0x1f4){logger[_0x35da('0xc')](_0x35da('0xe'),_0x5285f1,_0x24a757[_0x35da('0xc')][_0x35da('0xf')]);return _0x4d2d1e(_0x24a757[_0x35da('0xc')]['message']);}logger[_0x35da('0xc')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x5285f1,_0x24a757[_0x35da('0xc')][_0x35da('0xf')]);return _0xc821f7(_0x24a757[_0x35da('0xc')][_0x35da('0xf')]);}else{logger[_0x35da('0xa')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x5285f1,_0x35da('0x10'));_0xc821f7(_0x24a757['result'][_0x35da('0xf')]);}})[_0x35da('0x11')](function(_0x27ad46){logger['error'](_0x35da('0xe'),_0x5285f1,_0x27ad46);_0x4d2d1e(_0x27ad46);});});} \ No newline at end of file +var _0x06e9=['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','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x42d5dc,_0x3bfab8){var _0x55ccb8=function(_0x19cabb){while(--_0x19cabb){_0x42d5dc['push'](_0x42d5dc['shift']());}};_0x55ccb8(++_0x3bfab8);}(_0x06e9,0x1c2));var _0x906e=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x06e9[_0x13e741];return _0x3f8bb3;};'use strict';var _=require('lodash');var util=require(_0x906e('0x0'));var moment=require(_0x906e('0x1'));var BPromise=require(_0x906e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x906e('0x3'));var db=require(_0x906e('0x4'))['db'];var utils=require(_0x906e('0x5'));var logger=require('../../config/logger')(_0x906e('0x6'));var config=require(_0x906e('0x7'));var jayson=require(_0x906e('0x8'));var client=jayson[_0x906e('0x9')][_0x906e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e7bab,_0x1ac478,_0x874190){return new BPromise(function(_0x106519,_0x5d6c44){return client[_0x906e('0xb')](_0x2e7bab,_0x874190)[_0x906e('0xc')](function(_0x1c0acd){logger[_0x906e('0xd')](_0x906e('0xe'),_0x1ac478,_0x906e('0xf'));logger[_0x906e('0x10')](_0x906e('0x11'),_0x1ac478,_0x906e('0xf'),JSON[_0x906e('0x12')](_0x1c0acd));if(_0x1c0acd[_0x906e('0x13')]){if(_0x1c0acd[_0x906e('0x13')][_0x906e('0x14')]===0x1f4){logger[_0x906e('0x13')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1ac478,_0x1c0acd[_0x906e('0x13')]['message']);return _0x5d6c44(_0x1c0acd[_0x906e('0x13')][_0x906e('0x15')]);}logger[_0x906e('0x13')](_0x906e('0xe'),_0x1ac478,_0x1c0acd[_0x906e('0x13')][_0x906e('0x15')]);return _0x106519(_0x1c0acd[_0x906e('0x13')][_0x906e('0x15')]);}else{logger[_0x906e('0xd')](_0x906e('0xe'),_0x1ac478,_0x906e('0xf'));_0x106519(_0x1c0acd[_0x906e('0x16')][_0x906e('0x15')]);}})[_0x906e('0x17')](function(_0x1cd196){logger[_0x906e('0x13')](_0x906e('0xe'),_0x1ac478,_0x1cd196);_0x5d6c44(_0x1cd196);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 630ef2d..5354de6 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 _0x3083=['../../components/auth/service','../../config/environment','./intFreshdeskField.controller','get','index','/:id','show','post','create','put','isAuthenticated','update','delete','destroy','exports','util','path','express','Router','fs-extra'];(function(_0x1a7550,_0x1edace){var _0x426e22=function(_0x1c10a1){while(--_0x1c10a1){_0x1a7550['push'](_0x1a7550['shift']());}};_0x426e22(++_0x1edace);}(_0x3083,0x127));var _0x3308=function(_0xce6f11,_0x3c3137){_0xce6f11=_0xce6f11-0x0;var _0x35b709=_0x3083[_0xce6f11];return _0x35b709;};'use strict';var multer=require('multer');var util=require(_0x3308('0x0'));var path=require(_0x3308('0x1'));var timeout=require('connect-timeout');var express=require(_0x3308('0x2'));var router=express[_0x3308('0x3')]();var fs_extra=require(_0x3308('0x4'));var auth=require(_0x3308('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3308('0x6'));var controller=require(_0x3308('0x7'));router[_0x3308('0x8')]('/',auth['isAuthenticated'](),controller[_0x3308('0x9')]);router['get'](_0x3308('0xa'),auth['isAuthenticated'](),controller[_0x3308('0xb')]);router[_0x3308('0xc')]('/',auth['isAuthenticated'](),controller[_0x3308('0xd')]);router[_0x3308('0xe')]('/:id',auth[_0x3308('0xf')](),controller[_0x3308('0x10')]);router[_0x3308('0x11')](_0x3308('0xa'),auth[_0x3308('0xf')](),controller[_0x3308('0x12')]);module[_0x3308('0x13')]=router; \ No newline at end of file +var _0x6610=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post'];(function(_0x4c4eb4,_0x5a9271){var _0x408113=function(_0x5d4762){while(--_0x5d4762){_0x4c4eb4['push'](_0x4c4eb4['shift']());}};_0x408113(++_0x5a9271);}(_0x6610,0xea));var _0x0661=function(_0x7f4671,_0x1d043c){_0x7f4671=_0x7f4671-0x0;var _0x701ed5=_0x6610[_0x7f4671];return _0x701ed5;};'use strict';var multer=require(_0x0661('0x0'));var util=require(_0x0661('0x1'));var path=require(_0x0661('0x2'));var timeout=require(_0x0661('0x3'));var express=require(_0x0661('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0661('0x5'));var interaction=require(_0x0661('0x6'));var config=require('../../config/environment');var controller=require('./intFreshdeskField.controller');router[_0x0661('0x7')]('/',auth[_0x0661('0x8')](),controller[_0x0661('0x9')]);router[_0x0661('0x7')](_0x0661('0xa'),auth[_0x0661('0x8')](),controller[_0x0661('0xb')]);router[_0x0661('0xc')]('/',auth['isAuthenticated'](),controller[_0x0661('0xd')]);router[_0x0661('0xe')]('/:id',auth[_0x0661('0x8')](),controller[_0x0661('0xf')]);router[_0x0661('0x10')](_0x0661('0xa'),auth[_0x0661('0x8')](),controller[_0x0661('0x11')]);module[_0x0661('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 5879322..6d07fba 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 _0x8bc2=['variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable','picklist','STRING'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0x8bc2,0x134));var _0x28bc=function(_0x28923f,_0x1c4dd0){_0x28923f=_0x28923f-0x0;var _0x495ca1=_0x8bc2[_0x28923f];return _0x495ca1;};'use strict';var Sequelize=require(_0x28bc('0x0'));module[_0x28bc('0x1')]={'type':{'type':Sequelize[_0x28bc('0x2')](_0x28bc('0x3'),'variable',_0x28bc('0x4'),'keyValue',_0x28bc('0x5')),'defaultValue':_0x28bc('0x3')},'content':{'type':Sequelize[_0x28bc('0x6')]},'key':{'type':Sequelize[_0x28bc('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x28bc('0x7'),_0x28bc('0x4'))},'keyContent':{'type':Sequelize[_0x28bc('0x6')]},'idField':{'type':Sequelize[_0x28bc('0x6')]},'nameField':{'type':Sequelize[_0x28bc('0x6')]},'customField':{'type':Sequelize[_0x28bc('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x70b5=['picklist','STRING','ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue'];(function(_0x133fab,_0x5ee28d){var _0x17d96f=function(_0x4a90b5){while(--_0x4a90b5){_0x133fab['push'](_0x133fab['shift']());}};_0x17d96f(++_0x5ee28d);}(_0x70b5,0x13a));var _0x570b=function(_0x3b3210,_0x25e8ed){_0x3b3210=_0x3b3210-0x0;var _0x5b5484=_0x70b5[_0x3b3210];return _0x5b5484;};'use strict';var Sequelize=require(_0x570b('0x0'));module[_0x570b('0x1')]={'type':{'type':Sequelize['ENUM'](_0x570b('0x2'),_0x570b('0x3'),_0x570b('0x4'),_0x570b('0x5'),_0x570b('0x6')),'defaultValue':_0x570b('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x570b('0x7')]},'keyType':{'type':Sequelize[_0x570b('0x8')](_0x570b('0x2'),_0x570b('0x3'),_0x570b('0x4'))},'keyContent':{'type':Sequelize[_0x570b('0x7')]},'idField':{'type':Sequelize[_0x570b('0x7')]},'nameField':{'type':Sequelize[_0x570b('0x7')]},'customField':{'type':Sequelize[_0x570b('0x9')],'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 9552de6..8a0a787 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 _0x1339=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','undefined','limit','offset','Content-Range','then','destroy','end','sendStatus','error','name','send','index','map','FreshdeskField','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','create','body','update','params','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x5ad220,_0x27407e){var _0xdec77d=function(_0x58d736){while(--_0x58d736){_0x5ad220['push'](_0x5ad220['shift']());}};_0xdec77d(++_0x27407e);}(_0x1339,0x1ed));var _0x9133=function(_0x41f277,_0x851c9b){_0x41f277=_0x41f277-0x0;var _0x30c40f=_0x1339[_0x41f277];return _0x30c40f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9133('0x0'));var jsonpatch=require(_0x9133('0x1'));var rp=require(_0x9133('0x2'));var moment=require(_0x9133('0x3'));var BPromise=require(_0x9133('0x4'));var Mustache=require(_0x9133('0x5'));var util=require(_0x9133('0x6'));var path=require(_0x9133('0x7'));var sox=require('sox');var csv=require(_0x9133('0x8'));var ejs=require(_0x9133('0x9'));var fs=require('fs');var fs_extra=require(_0x9133('0xa'));var _=require('lodash');var squel=require(_0x9133('0xb'));var crypto=require(_0x9133('0xc'));var jsforce=require(_0x9133('0xd'));var deskjs=require(_0x9133('0xe'));var toCsv=require(_0x9133('0x8'));var querystring=require(_0x9133('0xf'));var Papa=require(_0x9133('0x10'));var Redis=require(_0x9133('0x11'));var authService=require(_0x9133('0x12'));var qs=require(_0x9133('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9133('0x14'));var logger=require(_0x9133('0x15'))(_0x9133('0x16'));var utils=require(_0x9133('0x17'));var config=require(_0x9133('0x18'));var licenseUtil=require(_0x9133('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb64550,_0x7cc59e){_0x7cc59e=_0x7cc59e||0xcc;return function(_0x4bbfdc){if(_0x4bbfdc){return _0xb64550['sendStatus'](_0x7cc59e);}return _0xb64550[_0x9133('0x1a')](_0x7cc59e)['end']();};}function respondWithResult(_0x22132a,_0x439e1a){_0x439e1a=_0x439e1a||0xc8;return function(_0x17dfd1){if(_0x17dfd1){return _0x22132a[_0x9133('0x1a')](_0x439e1a)[_0x9133('0x1b')](_0x17dfd1);}};}function respondWithFilteredResult(_0x4327b3,_0x49cc5d){return function(_0x13f8fc){if(_0x13f8fc){var _0x1e23ce=typeof _0x49cc5d['offset']===_0x9133('0x1c')&&typeof _0x49cc5d[_0x9133('0x1d')]===_0x9133('0x1c');var _0x427663=_0x13f8fc['count'];var _0x1f3484=_0x1e23ce?0x0:_0x49cc5d['offset'];var _0x3c48ef=_0x1e23ce?_0x13f8fc['count']:_0x49cc5d[_0x9133('0x1e')]+_0x49cc5d[_0x9133('0x1d')];var _0x5e8620;if(_0x3c48ef>=_0x427663){_0x3c48ef=_0x427663;_0x5e8620=0xc8;}else{_0x5e8620=0xce;}_0x4327b3[_0x9133('0x1a')](_0x5e8620);return _0x4327b3['set'](_0x9133('0x1f'),_0x1f3484+'-'+_0x3c48ef+'/'+_0x427663)['json'](_0x13f8fc);}return null;};}function patchUpdates(_0x5e4f0c){return function(_0x2f7354){try{jsonpatch['apply'](_0x2f7354,_0x5e4f0c,!![]);}catch(_0x12c2d4){return BPromise['reject'](_0x12c2d4);}return _0x2f7354['save']();};}function saveUpdates(_0x4c846e,_0x2e99a1){return function(_0x2dcfb8){if(_0x2dcfb8){return _0x2dcfb8['update'](_0x4c846e)[_0x9133('0x20')](function(_0x3f5d0e){return _0x3f5d0e;});}return null;};}function removeEntity(_0xff08d5,_0x26190c){return function(_0x4f26e8){if(_0x4f26e8){return _0x4f26e8[_0x9133('0x21')]()['then'](function(){_0xff08d5[_0x9133('0x1a')](0xcc)[_0x9133('0x22')]();});}};}function handleEntityNotFound(_0x3f278d,_0x14c1cb){return function(_0x4483ef){if(!_0x4483ef){_0x3f278d[_0x9133('0x23')](0x194);}return _0x4483ef;};}function handleError(_0x294332,_0x313d43){_0x313d43=_0x313d43||0x1f4;return function(_0x1b6b3e){logger[_0x9133('0x24')](_0x1b6b3e['stack']);if(_0x1b6b3e['name']){delete _0x1b6b3e[_0x9133('0x25')];}_0x294332[_0x9133('0x1a')](_0x313d43)[_0x9133('0x26')](_0x1b6b3e);};}exports[_0x9133('0x27')]=function(_0x4de894,_0x4ecd9e){var _0x3e2404={},_0x45966d={},_0x188c49={'count':0x0,'rows':[]};var _0x26d351=_[_0x9133('0x28')](db[_0x9133('0x29')]['rawAttributes'],function(_0x58afe0){return{'name':_0x58afe0['fieldName'],'type':_0x58afe0[_0x9133('0x2a')]['key']};});_0x45966d[_0x9133('0x2b')]=_[_0x9133('0x28')](_0x26d351,'name');_0x45966d[_0x9133('0x2c')]=_['keys'](_0x4de894[_0x9133('0x2c')]);_0x45966d[_0x9133('0x2d')]=_[_0x9133('0x2e')](_0x45966d['model'],_0x45966d[_0x9133('0x2c')]);_0x3e2404[_0x9133('0x2f')]=_[_0x9133('0x2e')](_0x45966d['model'],qs[_0x9133('0x30')](_0x4de894[_0x9133('0x2c')][_0x9133('0x30')]));_0x3e2404['attributes']=_0x3e2404[_0x9133('0x2f')][_0x9133('0x31')]?_0x3e2404[_0x9133('0x2f')]:_0x45966d[_0x9133('0x2b')];if(!_0x4de894['query'][_0x9133('0x32')](_0x9133('0x33'))){_0x3e2404['limit']=qs[_0x9133('0x1d')](_0x4de894[_0x9133('0x2c')][_0x9133('0x1d')]);_0x3e2404[_0x9133('0x1e')]=qs[_0x9133('0x1e')](_0x4de894[_0x9133('0x2c')][_0x9133('0x1e')]);}_0x3e2404[_0x9133('0x34')]=qs[_0x9133('0x35')](_0x4de894[_0x9133('0x2c')][_0x9133('0x35')]);_0x3e2404['where']=qs[_0x9133('0x2d')](_[_0x9133('0x36')](_0x4de894['query'],_0x45966d[_0x9133('0x2d')]),_0x26d351);if(_0x4de894[_0x9133('0x2c')][_0x9133('0x37')]){_0x3e2404[_0x9133('0x38')]=_[_0x9133('0x39')](_0x3e2404[_0x9133('0x38')],{'$or':_['map'](_0x26d351,function(_0x4e16d2){if(_0x4e16d2[_0x9133('0x2a')]!==_0x9133('0x3a')){var _0x156905={};_0x156905[_0x4e16d2[_0x9133('0x25')]]={'$like':'%'+_0x4de894[_0x9133('0x2c')][_0x9133('0x37')]+'%'};return _0x156905;}})});}_0x3e2404=_[_0x9133('0x39')]({},_0x3e2404,_0x4de894[_0x9133('0x3b')]);var _0x720048={'where':_0x3e2404['where']};return db[_0x9133('0x29')][_0x9133('0x3c')](_0x720048)[_0x9133('0x20')](function(_0x199ae9){_0x188c49[_0x9133('0x3c')]=_0x199ae9;if(_0x4de894['query'][_0x9133('0x3d')]){_0x3e2404[_0x9133('0x3e')]=[{'all':!![]}];}return db[_0x9133('0x29')][_0x9133('0x3f')](_0x3e2404);})['then'](function(_0x146734){_0x188c49[_0x9133('0x40')]=_0x146734;return _0x188c49;})[_0x9133('0x20')](respondWithFilteredResult(_0x4ecd9e,_0x3e2404))[_0x9133('0x41')](handleError(_0x4ecd9e,null));};exports[_0x9133('0x42')]=function(_0x338049,_0x3b2287){var _0x4ca1a3={'raw':!![],'where':{'id':_0x338049['params']['id']}},_0x7f6cd9={};_0x7f6cd9['model']=_[_0x9133('0x43')](db[_0x9133('0x29')][_0x9133('0x44')]);_0x7f6cd9[_0x9133('0x2c')]=_[_0x9133('0x43')](_0x338049[_0x9133('0x2c')]);_0x7f6cd9[_0x9133('0x2d')]=_[_0x9133('0x2e')](_0x7f6cd9[_0x9133('0x2b')],_0x7f6cd9['query']);_0x4ca1a3[_0x9133('0x2f')]=_[_0x9133('0x2e')](_0x7f6cd9[_0x9133('0x2b')],qs['fields'](_0x338049['query'][_0x9133('0x30')]));_0x4ca1a3[_0x9133('0x2f')]=_0x4ca1a3['attributes'][_0x9133('0x31')]?_0x4ca1a3[_0x9133('0x2f')]:_0x7f6cd9[_0x9133('0x2b')];if(_0x338049[_0x9133('0x2c')][_0x9133('0x3d')]){_0x4ca1a3['include']=[{'all':!![]}];}_0x4ca1a3=_[_0x9133('0x39')]({},_0x4ca1a3,_0x338049[_0x9133('0x3b')]);return db[_0x9133('0x29')]['find'](_0x4ca1a3)[_0x9133('0x20')](handleEntityNotFound(_0x3b2287,null))[_0x9133('0x20')](respondWithResult(_0x3b2287,null))['catch'](handleError(_0x3b2287,null));};exports['create']=function(_0x42c188,_0x2cd935){return db[_0x9133('0x29')][_0x9133('0x45')](_0x42c188[_0x9133('0x46')],{})[_0x9133('0x20')](respondWithResult(_0x2cd935,0xc9))[_0x9133('0x41')](handleError(_0x2cd935,null));};exports[_0x9133('0x47')]=function(_0x23f134,_0xf07fbb){if(_0x23f134[_0x9133('0x46')]['id']){delete _0x23f134[_0x9133('0x46')]['id'];}return db['FreshdeskField']['find']({'where':{'id':_0x23f134[_0x9133('0x48')]['id']}})['then'](handleEntityNotFound(_0xf07fbb,null))[_0x9133('0x20')](saveUpdates(_0x23f134[_0x9133('0x46')],null))[_0x9133('0x20')](respondWithResult(_0xf07fbb,null))[_0x9133('0x41')](handleError(_0xf07fbb,null));};exports['destroy']=function(_0x2a3848,_0x25750f){return db[_0x9133('0x29')]['find']({'where':{'id':_0x2a3848[_0x9133('0x48')]['id']}})[_0x9133('0x20')](handleEntityNotFound(_0x25750f,null))[_0x9133('0x20')](removeEntity(_0x25750f,null))['catch'](handleError(_0x25750f,null));}; \ No newline at end of file +var _0xd52d=['where','pick','filter','merge','VIRTUAL','options','includeAll','include','FreshdeskField','findAll','rows','catch','params','rawAttributes','find','create','body','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','apply','reject','update','then','destroy','sendStatus','error','stack','index','map','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','order','sort'];(function(_0x2d318e,_0x3fd3b8){var _0x365b1d=function(_0x11755c){while(--_0x11755c){_0x2d318e['push'](_0x2d318e['shift']());}};_0x365b1d(++_0x3fd3b8);}(_0xd52d,0x1c7));var _0xdd52=function(_0x3031e2,_0x9fca98){_0x3031e2=_0x3031e2-0x0;var _0x15e295=_0xd52d[_0x3031e2];return _0x15e295;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdd52('0x0'));var zipdir=require(_0xdd52('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdd52('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xdd52('0x3'));var util=require(_0xdd52('0x4'));var path=require(_0xdd52('0x5'));var sox=require(_0xdd52('0x6'));var csv=require(_0xdd52('0x7'));var ejs=require(_0xdd52('0x8'));var fs=require('fs');var fs_extra=require(_0xdd52('0x9'));var _=require(_0xdd52('0xa'));var squel=require('squel');var crypto=require(_0xdd52('0xb'));var jsforce=require(_0xdd52('0xc'));var deskjs=require(_0xdd52('0xd'));var toCsv=require(_0xdd52('0x7'));var querystring=require(_0xdd52('0xe'));var Papa=require(_0xdd52('0xf'));var Redis=require(_0xdd52('0x10'));var authService=require(_0xdd52('0x11'));var qs=require(_0xdd52('0x12'));var as=require(_0xdd52('0x13'));var hardwareService=require(_0xdd52('0x14'));var logger=require(_0xdd52('0x15'))(_0xdd52('0x16'));var utils=require('../../config/utils');var config=require(_0xdd52('0x17'));var licenseUtil=require(_0xdd52('0x18'));var db=require(_0xdd52('0x19'))['db'];function respondWithStatusCode(_0x2e940f,_0x19283f){_0x19283f=_0x19283f||0xcc;return function(_0xee8463){if(_0xee8463){return _0x2e940f['sendStatus'](_0x19283f);}return _0x2e940f[_0xdd52('0x1a')](_0x19283f)[_0xdd52('0x1b')]();};}function respondWithResult(_0x2e5642,_0x55b823){_0x55b823=_0x55b823||0xc8;return function(_0x3f6585){if(_0x3f6585){return _0x2e5642[_0xdd52('0x1a')](_0x55b823)[_0xdd52('0x1c')](_0x3f6585);}};}function respondWithFilteredResult(_0x181876,_0x336797){return function(_0x12c6da){if(_0x12c6da){var _0x25a2b7=typeof _0x336797[_0xdd52('0x1d')]==='undefined'&&typeof _0x336797[_0xdd52('0x1e')]==='undefined';var _0x2822be=_0x12c6da[_0xdd52('0x1f')];var _0x4568dc=_0x25a2b7?0x0:_0x336797[_0xdd52('0x1d')];var _0x4dc017=_0x25a2b7?_0x12c6da[_0xdd52('0x1f')]:_0x336797[_0xdd52('0x1d')]+_0x336797[_0xdd52('0x1e')];var _0x13f667;if(_0x4dc017>=_0x2822be){_0x4dc017=_0x2822be;_0x13f667=0xc8;}else{_0x13f667=0xce;}_0x181876['status'](_0x13f667);return _0x181876[_0xdd52('0x20')]('Content-Range',_0x4568dc+'-'+_0x4dc017+'/'+_0x2822be)[_0xdd52('0x1c')](_0x12c6da);}return null;};}function patchUpdates(_0x56e1db){return function(_0x30c411){try{jsonpatch[_0xdd52('0x21')](_0x30c411,_0x56e1db,!![]);}catch(_0x5a671a){return BPromise[_0xdd52('0x22')](_0x5a671a);}return _0x30c411['save']();};}function saveUpdates(_0x38c153,_0x59a041){return function(_0x14cd54){if(_0x14cd54){return _0x14cd54[_0xdd52('0x23')](_0x38c153)[_0xdd52('0x24')](function(_0xfd321){return _0xfd321;});}return null;};}function removeEntity(_0x1e8dbb,_0x455e74){return function(_0x3ce226){if(_0x3ce226){return _0x3ce226[_0xdd52('0x25')]()['then'](function(){_0x1e8dbb[_0xdd52('0x1a')](0xcc)[_0xdd52('0x1b')]();});}};}function handleEntityNotFound(_0x592f15,_0x1156cc){return function(_0x353fde){if(!_0x353fde){_0x592f15[_0xdd52('0x26')](0x194);}return _0x353fde;};}function handleError(_0x2f2dfa,_0x4ee66d){_0x4ee66d=_0x4ee66d||0x1f4;return function(_0x41c7e5){logger[_0xdd52('0x27')](_0x41c7e5[_0xdd52('0x28')]);if(_0x41c7e5['name']){delete _0x41c7e5['name'];}_0x2f2dfa[_0xdd52('0x1a')](_0x4ee66d)['send'](_0x41c7e5);};}exports[_0xdd52('0x29')]=function(_0x3f96bd,_0xeb81a0){var _0x539418={},_0x499e14={},_0x2a0a2d={'count':0x0,'rows':[]};var _0x3a0e0d=_[_0xdd52('0x2a')](db['FreshdeskField']['rawAttributes'],function(_0x9b6070){return{'name':_0x9b6070['fieldName'],'type':_0x9b6070[_0xdd52('0x2b')][_0xdd52('0x2c')]};});_0x499e14[_0xdd52('0x2d')]=_[_0xdd52('0x2a')](_0x3a0e0d,_0xdd52('0x2e'));_0x499e14[_0xdd52('0x2f')]=_[_0xdd52('0x30')](_0x3f96bd[_0xdd52('0x2f')]);_0x499e14[_0xdd52('0x31')]=_[_0xdd52('0x32')](_0x499e14[_0xdd52('0x2d')],_0x499e14[_0xdd52('0x2f')]);_0x539418[_0xdd52('0x33')]=_[_0xdd52('0x32')](_0x499e14[_0xdd52('0x2d')],qs[_0xdd52('0x34')](_0x3f96bd[_0xdd52('0x2f')][_0xdd52('0x34')]));_0x539418[_0xdd52('0x33')]=_0x539418[_0xdd52('0x33')][_0xdd52('0x35')]?_0x539418['attributes']:_0x499e14[_0xdd52('0x2d')];if(!_0x3f96bd[_0xdd52('0x2f')]['hasOwnProperty']('nolimit')){_0x539418['limit']=qs[_0xdd52('0x1e')](_0x3f96bd[_0xdd52('0x2f')][_0xdd52('0x1e')]);_0x539418[_0xdd52('0x1d')]=qs[_0xdd52('0x1d')](_0x3f96bd[_0xdd52('0x2f')][_0xdd52('0x1d')]);}_0x539418[_0xdd52('0x36')]=qs[_0xdd52('0x37')](_0x3f96bd[_0xdd52('0x2f')]['sort']);_0x539418[_0xdd52('0x38')]=qs[_0xdd52('0x31')](_[_0xdd52('0x39')](_0x3f96bd[_0xdd52('0x2f')],_0x499e14[_0xdd52('0x31')]),_0x3a0e0d);if(_0x3f96bd[_0xdd52('0x2f')][_0xdd52('0x3a')]){_0x539418[_0xdd52('0x38')]=_[_0xdd52('0x3b')](_0x539418[_0xdd52('0x38')],{'$or':_[_0xdd52('0x2a')](_0x3a0e0d,function(_0x16deae){if(_0x16deae[_0xdd52('0x2b')]!==_0xdd52('0x3c')){var _0x2e1c23={};_0x2e1c23[_0x16deae[_0xdd52('0x2e')]]={'$like':'%'+_0x3f96bd[_0xdd52('0x2f')][_0xdd52('0x3a')]+'%'};return _0x2e1c23;}})});}_0x539418=_[_0xdd52('0x3b')]({},_0x539418,_0x3f96bd[_0xdd52('0x3d')]);var _0x2112cb={'where':_0x539418['where']};return db['FreshdeskField'][_0xdd52('0x1f')](_0x2112cb)[_0xdd52('0x24')](function(_0x1462b0){_0x2a0a2d[_0xdd52('0x1f')]=_0x1462b0;if(_0x3f96bd[_0xdd52('0x2f')][_0xdd52('0x3e')]){_0x539418[_0xdd52('0x3f')]=[{'all':!![]}];}return db[_0xdd52('0x40')][_0xdd52('0x41')](_0x539418);})[_0xdd52('0x24')](function(_0x4efd40){_0x2a0a2d[_0xdd52('0x42')]=_0x4efd40;return _0x2a0a2d;})[_0xdd52('0x24')](respondWithFilteredResult(_0xeb81a0,_0x539418))[_0xdd52('0x43')](handleError(_0xeb81a0,null));};exports['show']=function(_0x220587,_0x1857d1){var _0x1949d6={'raw':!![],'where':{'id':_0x220587[_0xdd52('0x44')]['id']}},_0x2968b5={};_0x2968b5[_0xdd52('0x2d')]=_['keys'](db[_0xdd52('0x40')][_0xdd52('0x45')]);_0x2968b5[_0xdd52('0x2f')]=_['keys'](_0x220587[_0xdd52('0x2f')]);_0x2968b5[_0xdd52('0x31')]=_['intersection'](_0x2968b5[_0xdd52('0x2d')],_0x2968b5['query']);_0x1949d6[_0xdd52('0x33')]=_['intersection'](_0x2968b5['model'],qs['fields'](_0x220587[_0xdd52('0x2f')][_0xdd52('0x34')]));_0x1949d6[_0xdd52('0x33')]=_0x1949d6[_0xdd52('0x33')][_0xdd52('0x35')]?_0x1949d6[_0xdd52('0x33')]:_0x2968b5['model'];if(_0x220587[_0xdd52('0x2f')][_0xdd52('0x3e')]){_0x1949d6[_0xdd52('0x3f')]=[{'all':!![]}];}_0x1949d6=_['merge']({},_0x1949d6,_0x220587[_0xdd52('0x3d')]);return db[_0xdd52('0x40')][_0xdd52('0x46')](_0x1949d6)[_0xdd52('0x24')](handleEntityNotFound(_0x1857d1,null))['then'](respondWithResult(_0x1857d1,null))[_0xdd52('0x43')](handleError(_0x1857d1,null));};exports[_0xdd52('0x47')]=function(_0x579377,_0x299def){return db[_0xdd52('0x40')][_0xdd52('0x47')](_0x579377['body'],{})['then'](respondWithResult(_0x299def,0xc9))[_0xdd52('0x43')](handleError(_0x299def,null));};exports[_0xdd52('0x23')]=function(_0x1017d6,_0x5adb59){if(_0x1017d6[_0xdd52('0x48')]['id']){delete _0x1017d6['body']['id'];}return db[_0xdd52('0x40')][_0xdd52('0x46')]({'where':{'id':_0x1017d6[_0xdd52('0x44')]['id']}})['then'](handleEntityNotFound(_0x5adb59,null))['then'](saveUpdates(_0x1017d6[_0xdd52('0x48')],null))['then'](respondWithResult(_0x5adb59,null))[_0xdd52('0x43')](handleError(_0x5adb59,null));};exports[_0xdd52('0x25')]=function(_0x1ff2c3,_0x45e052){return db[_0xdd52('0x40')][_0xdd52('0x46')]({'where':{'id':_0x1ff2c3['params']['id']}})[_0xdd52('0x24')](handleEntityNotFound(_0x45e052,null))[_0xdd52('0x24')](removeEntity(_0x45e052,null))[_0xdd52('0x43')](handleError(_0x45e052,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 2f5c292..6d94ecc 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 _0x8c39=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskField.attributes','FreshdeskField','freshdesk_unique_index','idField','lodash'];(function(_0x294f38,_0x4452f9){var _0x223bef=function(_0xe615fb){while(--_0xe615fb){_0x294f38['push'](_0x294f38['shift']());}};_0x223bef(++_0x4452f9);}(_0x8c39,0x1df));var _0x98c3=function(_0x429d5d,_0x4a8a1f){_0x429d5d=_0x429d5d-0x0;var _0x4bcced=_0x8c39[_0x429d5d];return _0x4bcced;};'use strict';var _=require(_0x98c3('0x0'));var util=require('util');var logger=require(_0x98c3('0x1'))(_0x98c3('0x2'));var moment=require(_0x98c3('0x3'));var BPromise=require(_0x98c3('0x4'));var rp=require(_0x98c3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x98c3('0x6'));var config=require(_0x98c3('0x7'));var attributes=require(_0x98c3('0x8'));module['exports']=function(_0x1bee5c,_0xfc9011){return _0x1bee5c['define'](_0x98c3('0x9'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x98c3('0xa'),'fields':[_0x98c3('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1af1=['path','rimraf','../../config/environment','exports','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','lodash','util','moment','bluebird','request-promise'];(function(_0x57a115,_0x12fda8){var _0x88158f=function(_0x5ce7c9){while(--_0x5ce7c9){_0x57a115['push'](_0x57a115['shift']());}};_0x88158f(++_0x12fda8);}(_0x1af1,0x1e9));var _0x11af=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1af1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x11af('0x0'));var util=require(_0x11af('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x11af('0x2'));var BPromise=require(_0x11af('0x3'));var rp=require(_0x11af('0x4'));var fs=require('fs');var path=require(_0x11af('0x5'));var rimraf=require(_0x11af('0x6'));var config=require(_0x11af('0x7'));var attributes=require('./intFreshdeskField.attributes');module[_0x11af('0x8')]=function(_0x1534f0,_0x17830a){return _0x1534f0['define'](_0x11af('0x9'),attributes,{'tableName':_0x11af('0xa'),'paranoid':![],'indexes':[{'name':_0x11af('0xb'),'fields':[_0x11af('0xc'),'FieldId'],'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 d3ac430..e00bc76 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 _0xb950=['then','info','FreshdeskField,\x20%s,\x20%s','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request'];(function(_0x2d9a23,_0x481dc4){var _0x5198ee=function(_0x27d373){while(--_0x27d373){_0x2d9a23['push'](_0x2d9a23['shift']());}};_0x5198ee(++_0x481dc4);}(_0xb950,0x165));var _0x0b95=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xb950[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0b95('0x0'));var util=require('util');var moment=require(_0x0b95('0x1'));var BPromise=require(_0x0b95('0x2'));var rs=require(_0x0b95('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0b95('0x4'))['db'];var utils=require(_0x0b95('0x5'));var logger=require(_0x0b95('0x6'))('rpc');var config=require(_0x0b95('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0b95('0x8')][_0x0b95('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19a91a,_0x3275a8,_0x24646b){return new BPromise(function(_0x5e4371,_0x2bf46c){return client[_0x0b95('0xa')](_0x19a91a,_0x24646b)[_0x0b95('0xb')](function(_0x17dbb9){logger[_0x0b95('0xc')](_0x0b95('0xd'),_0x3275a8,'request\x20sent');logger[_0x0b95('0xe')](_0x0b95('0xf'),_0x3275a8,_0x0b95('0x10'),JSON[_0x0b95('0x11')](_0x17dbb9));if(_0x17dbb9['error']){if(_0x17dbb9['error'][_0x0b95('0x12')]===0x1f4){logger[_0x0b95('0x13')](_0x0b95('0xd'),_0x3275a8,_0x17dbb9[_0x0b95('0x13')][_0x0b95('0x14')]);return _0x2bf46c(_0x17dbb9[_0x0b95('0x13')][_0x0b95('0x14')]);}logger[_0x0b95('0x13')](_0x0b95('0xd'),_0x3275a8,_0x17dbb9[_0x0b95('0x13')][_0x0b95('0x14')]);return _0x5e4371(_0x17dbb9['error'][_0x0b95('0x14')]);}else{logger[_0x0b95('0xc')](_0x0b95('0xd'),_0x3275a8,_0x0b95('0x10'));_0x5e4371(_0x17dbb9[_0x0b95('0x15')][_0x0b95('0x14')]);}})[_0x0b95('0x16')](function(_0x42364d){logger[_0x0b95('0x13')]('FreshdeskField,\x20%s,\x20%s',_0x3275a8,_0x42364d);_0x2bf46c(_0x42364d);});});} \ No newline at end of file +var _0x8c5a=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x4504eb,_0x5bef66){var _0x5e5147=function(_0x34f063){while(--_0x34f063){_0x4504eb['push'](_0x4504eb['shift']());}};_0x5e5147(++_0x5bef66);}(_0x8c5a,0xf2));var _0xa8c5=function(_0x44102e,_0x2cbced){_0x44102e=_0x44102e-0x0;var _0x561572=_0x8c5a[_0x44102e];return _0x561572;};'use strict';var _=require(_0xa8c5('0x0'));var util=require(_0xa8c5('0x1'));var moment=require(_0xa8c5('0x2'));var BPromise=require(_0xa8c5('0x3'));var rs=require(_0xa8c5('0x4'));var fs=require('fs');var Redis=require(_0xa8c5('0x5'));var db=require(_0xa8c5('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa8c5('0x7'));var config=require(_0xa8c5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa8c5('0x9')][_0xa8c5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e9485,_0xf8f1f3,_0x53aa58){return new BPromise(function(_0x1e7b9a,_0x4ed831){return client['request'](_0x2e9485,_0x53aa58)[_0xa8c5('0xb')](function(_0x288b7d){logger[_0xa8c5('0xc')](_0xa8c5('0xd'),_0xf8f1f3,_0xa8c5('0xe'));logger[_0xa8c5('0xf')](_0xa8c5('0x10'),_0xf8f1f3,_0xa8c5('0xe'),JSON['stringify'](_0x288b7d));if(_0x288b7d[_0xa8c5('0x11')]){if(_0x288b7d[_0xa8c5('0x11')][_0xa8c5('0x12')]===0x1f4){logger['error'](_0xa8c5('0xd'),_0xf8f1f3,_0x288b7d[_0xa8c5('0x11')][_0xa8c5('0x13')]);return _0x4ed831(_0x288b7d['error'][_0xa8c5('0x13')]);}logger[_0xa8c5('0x11')]('FreshdeskField,\x20%s,\x20%s',_0xf8f1f3,_0x288b7d[_0xa8c5('0x11')][_0xa8c5('0x13')]);return _0x1e7b9a(_0x288b7d[_0xa8c5('0x11')][_0xa8c5('0x13')]);}else{logger['info']('FreshdeskField,\x20%s,\x20%s',_0xf8f1f3,_0xa8c5('0xe'));_0x1e7b9a(_0x288b7d[_0xa8c5('0x14')][_0xa8c5('0x13')]);}})[_0xa8c5('0x15')](function(_0xce39d2){logger[_0xa8c5('0x11')](_0xa8c5('0xd'),_0xf8f1f3,_0xce39d2);_0x4ed831(_0xce39d2);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 0229f16..d8415a8 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 _0xe1e3=['get','isAuthenticated','index','/:id','show','/:id/configurations','post','create','update','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x440f8b,_0x143979){_0x440f8b=_0x440f8b-0x0;var _0x3502b6=_0xe1e3[_0x440f8b];return _0x3502b6;};'use strict';var multer=require(_0x3e1e('0x0'));var util=require(_0x3e1e('0x1'));var path=require('path');var timeout=require(_0x3e1e('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3e1e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x3e1e('0x4'));var config=require(_0x3e1e('0x5'));var controller=require(_0x3e1e('0x6'));router[_0x3e1e('0x7')]('/',auth[_0x3e1e('0x8')](),controller[_0x3e1e('0x9')]);router['get'](_0x3e1e('0xa'),auth[_0x3e1e('0x8')](),controller[_0x3e1e('0xb')]);router[_0x3e1e('0x7')](_0x3e1e('0xc'),auth[_0x3e1e('0x8')](),controller['getConfigurations']);router['get']('/:id/fields',auth[_0x3e1e('0x8')](),controller['getFields']);router[_0x3e1e('0xd')]('/',auth[_0x3e1e('0x8')](),controller[_0x3e1e('0xe')]);router['post'](_0x3e1e('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x3e1e('0xf')]);router['delete']('/:id',auth[_0x3e1e('0x8')](),controller[_0x3e1e('0x10')]);module[_0x3e1e('0x11')]=router; \ No newline at end of file +var _0xee5b=['multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','delete','/:id'];(function(_0x5043ed,_0x1c3dfa){var _0x11ca92=function(_0x13966e){while(--_0x13966e){_0x5043ed['push'](_0x5043ed['shift']());}};_0x11ca92(++_0x1c3dfa);}(_0xee5b,0x1f4));var _0xbee5=function(_0x19f8d8,_0x1936b4){_0x19f8d8=_0x19f8d8-0x0;var _0x1b0dc9=_0xee5b[_0x19f8d8];return _0x1b0dc9;};'use strict';var multer=require(_0xbee5('0x0'));var util=require('util');var path=require(_0xbee5('0x1'));var timeout=require(_0xbee5('0x2'));var express=require('express');var router=express[_0xbee5('0x3')]();var fs_extra=require(_0xbee5('0x4'));var auth=require(_0xbee5('0x5'));var interaction=require(_0xbee5('0x6'));var config=require('../../config/environment');var controller=require('./intFreshsalesAccount.controller');router[_0xbee5('0x7')]('/',auth[_0xbee5('0x8')](),controller[_0xbee5('0x9')]);router[_0xbee5('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router['get']('/:id/configurations',auth[_0xbee5('0x8')](),controller[_0xbee5('0xa')]);router[_0xbee5('0x7')](_0xbee5('0xb'),auth['isAuthenticated'](),controller[_0xbee5('0xc')]);router[_0xbee5('0xd')]('/',auth[_0xbee5('0x8')](),controller[_0xbee5('0xe')]);router[_0xbee5('0xd')](_0xbee5('0xf'),auth[_0xbee5('0x8')](),controller[_0xbee5('0x10')]);router[_0xbee5('0x11')]('/:id',auth[_0xbee5('0x8')](),controller['update']);router[_0xbee5('0x12')](_0xbee5('0x13'),auth[_0xbee5('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 8a6fb94..b2a9012 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 _0x583c=['exports','STRING','username','sequelize'];(function(_0xdc1723,_0x4aed6b){var _0x39da46=function(_0x597001){while(--_0x597001){_0xdc1723['push'](_0xdc1723['shift']());}};_0x39da46(++_0x4aed6b);}(_0x583c,0x12b));var _0xc583=function(_0x189c9e,_0x1c3b55){_0x189c9e=_0x189c9e-0x0;var _0x3f38ca=_0x583c[_0x189c9e];return _0x3f38ca;};'use strict';var Sequelize=require(_0xc583('0x0'));module[_0xc583('0x1')]={'name':{'type':Sequelize[_0xc583('0x2')]},'description':{'type':Sequelize[_0xc583('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xc583('0x3')},'apiKey':{'type':Sequelize[_0xc583('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xc583('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xb78e=['username','remoteUri','sequelize','exports','STRING'];(function(_0x16e9b5,_0x192142){var _0x206df0=function(_0x1a0a8f){while(--_0x1a0a8f){_0x16e9b5['push'](_0x16e9b5['shift']());}};_0x206df0(++_0x192142);}(_0xb78e,0x1c9));var _0xeb78=function(_0x66da57,_0xa9832a){_0x66da57=_0x66da57-0x0;var _0x590414=_0xb78e[_0x66da57];return _0x590414;};'use strict';var Sequelize=require(_0xeb78('0x0'));module[_0xeb78('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xeb78('0x2')]},'username':{'type':Sequelize[_0xeb78('0x2')],'unique':_0xeb78('0x3')},'apiKey':{'type':Sequelize[_0xeb78('0x2')]},'remoteUri':{'type':Sequelize[_0xeb78('0x2')],'unique':_0xeb78('0x4')},'serverUrl':{'type':Sequelize[_0xeb78('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index e0e3927..f7d7864 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 _0x1193=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','FreshsalesAccount','then','includeAll','findAll','rows','catch','options','find','create','body','params','getConfigurations','findOne','FreshsalesConfiguration','length','addConfiguration','Subjects','channel','getDescriptions','FreshsalesField','Descriptions','username','remoteUri','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','apiKey','users','email','Requested\x20Resource\x20not\x20Found','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0x1193,0xc0));var _0x3119=function(_0x1eefa5,_0x35fdd3){_0x1eefa5=_0x1eefa5-0x0;var _0x53e478=_0x1193[_0x1eefa5];return _0x53e478;};'use strict';var emlformat=require(_0x3119('0x0'));var rimraf=require(_0x3119('0x1'));var zipdir=require(_0x3119('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3119('0x3'));var moment=require('moment');var BPromise=require(_0x3119('0x4'));var Mustache=require(_0x3119('0x5'));var util=require(_0x3119('0x6'));var path=require(_0x3119('0x7'));var sox=require(_0x3119('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3119('0x9'));var _=require(_0x3119('0xa'));var squel=require(_0x3119('0xb'));var crypto=require(_0x3119('0xc'));var jsforce=require(_0x3119('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3119('0xe'));var querystring=require(_0x3119('0xf'));var Papa=require('papaparse');var Redis=require(_0x3119('0x10'));var authService=require(_0x3119('0x11'));var qs=require(_0x3119('0x12'));var as=require(_0x3119('0x13'));var hardwareService=require(_0x3119('0x14'));var logger=require(_0x3119('0x15'))(_0x3119('0x16'));var utils=require(_0x3119('0x17'));var config=require(_0x3119('0x18'));var licenseUtil=require(_0x3119('0x19'));var db=require(_0x3119('0x1a'))['db'];var integrations=require(_0x3119('0x1b'));function respondWithStatusCode(_0x31a867,_0x50806a){_0x50806a=_0x50806a||0xcc;return function(_0x166250){if(_0x166250){return _0x31a867[_0x3119('0x1c')](_0x50806a);}return _0x31a867[_0x3119('0x1d')](_0x50806a)['end']();};}function respondWithResult(_0x54965b,_0x5eb6b3){_0x5eb6b3=_0x5eb6b3||0xc8;return function(_0x51cbbf){if(_0x51cbbf){return _0x54965b[_0x3119('0x1d')](_0x5eb6b3)[_0x3119('0x1e')](_0x51cbbf);}};}function respondWithFilteredResult(_0x5d0037,_0x4f13cd){return function(_0x414977){if(_0x414977){var _0x40be25=typeof _0x4f13cd[_0x3119('0x1f')]===_0x3119('0x20')&&typeof _0x4f13cd[_0x3119('0x21')]===_0x3119('0x20');var _0x46efe8=_0x414977[_0x3119('0x22')];var _0x2766e5=_0x40be25?0x0:_0x4f13cd[_0x3119('0x1f')];var _0x4b0a8e=_0x40be25?_0x414977['count']:_0x4f13cd['offset']+_0x4f13cd[_0x3119('0x21')];var _0x4f26cf;if(_0x4b0a8e>=_0x46efe8){_0x4b0a8e=_0x46efe8;_0x4f26cf=0xc8;}else{_0x4f26cf=0xce;}_0x5d0037[_0x3119('0x1d')](_0x4f26cf);return _0x5d0037[_0x3119('0x23')](_0x3119('0x24'),_0x2766e5+'-'+_0x4b0a8e+'/'+_0x46efe8)['json'](_0x414977);}return null;};}function patchUpdates(_0x4ca943){return function(_0x397ee3){try{jsonpatch[_0x3119('0x25')](_0x397ee3,_0x4ca943,!![]);}catch(_0x47e831){return BPromise[_0x3119('0x26')](_0x47e831);}return _0x397ee3[_0x3119('0x27')]();};}function saveUpdates(_0x28255c,_0x5d574f){return function(_0xd95b84){if(_0xd95b84){return _0xd95b84[_0x3119('0x28')](_0x28255c)['then'](function(_0x515d34){return _0x515d34;});}return null;};}function removeEntity(_0x352505,_0x1adfc8){return function(_0x4fc6dd){if(_0x4fc6dd){return _0x4fc6dd[_0x3119('0x29')]()['then'](function(){_0x352505[_0x3119('0x1d')](0xcc)[_0x3119('0x2a')]();});}};}function handleEntityNotFound(_0x108e00,_0x502b3e){return function(_0x5dcb48){if(!_0x5dcb48){_0x108e00['sendStatus'](0x194);}return _0x5dcb48;};}function handleError(_0x5e1c14,_0xcba87c){_0xcba87c=_0xcba87c||0x1f4;return function(_0x3aa80e){logger[_0x3119('0x2b')](_0x3aa80e[_0x3119('0x2c')]);if(_0x3aa80e[_0x3119('0x2d')]){delete _0x3aa80e[_0x3119('0x2d')];}_0x5e1c14[_0x3119('0x1d')](_0xcba87c)[_0x3119('0x2e')](_0x3aa80e);};}exports[_0x3119('0x2f')]=function(_0x1feda0,_0x329870){var _0x49ad53={},_0x388f21={},_0x48ecb6={'count':0x0,'rows':[]};var _0xc88d82=_[_0x3119('0x30')](db['FreshsalesAccount'][_0x3119('0x31')],function(_0x1ddcd6){return{'name':_0x1ddcd6[_0x3119('0x32')],'type':_0x1ddcd6[_0x3119('0x33')][_0x3119('0x34')]};});_0x388f21['model']=_[_0x3119('0x30')](_0xc88d82,_0x3119('0x2d'));_0x388f21[_0x3119('0x35')]=_[_0x3119('0x36')](_0x1feda0[_0x3119('0x35')]);_0x388f21[_0x3119('0x37')]=_['intersection'](_0x388f21[_0x3119('0x38')],_0x388f21['query']);_0x49ad53['attributes']=_[_0x3119('0x39')](_0x388f21[_0x3119('0x38')],qs[_0x3119('0x3a')](_0x1feda0[_0x3119('0x35')][_0x3119('0x3a')]));_0x49ad53['attributes']=_0x49ad53[_0x3119('0x3b')]['length']?_0x49ad53[_0x3119('0x3b')]:_0x388f21['model'];if(!_0x1feda0[_0x3119('0x35')][_0x3119('0x3c')]('nolimit')){_0x49ad53[_0x3119('0x21')]=qs['limit'](_0x1feda0[_0x3119('0x35')][_0x3119('0x21')]);_0x49ad53['offset']=qs[_0x3119('0x1f')](_0x1feda0[_0x3119('0x35')][_0x3119('0x1f')]);}_0x49ad53[_0x3119('0x3d')]=qs['sort'](_0x1feda0[_0x3119('0x35')][_0x3119('0x3e')]);_0x49ad53['where']=qs[_0x3119('0x37')](_[_0x3119('0x3f')](_0x1feda0['query'],_0x388f21['filters']),_0xc88d82);if(_0x1feda0['query']['filter']){_0x49ad53[_0x3119('0x40')]=_[_0x3119('0x41')](_0x49ad53[_0x3119('0x40')],{'$or':_[_0x3119('0x30')](_0xc88d82,function(_0x64cb5b){if(_0x64cb5b['type']!==_0x3119('0x42')){var _0x32a86c={};_0x32a86c[_0x64cb5b['name']]={'$like':'%'+_0x1feda0[_0x3119('0x35')][_0x3119('0x43')]+'%'};return _0x32a86c;}})});}_0x49ad53=_[_0x3119('0x41')]({},_0x49ad53,_0x1feda0['options']);var _0x2c126c={'where':_0x49ad53[_0x3119('0x40')]};return db[_0x3119('0x44')][_0x3119('0x22')](_0x2c126c)[_0x3119('0x45')](function(_0x3b6271){_0x48ecb6[_0x3119('0x22')]=_0x3b6271;if(_0x1feda0[_0x3119('0x35')][_0x3119('0x46')]){_0x49ad53['include']=[{'all':!![]}];}return db[_0x3119('0x44')][_0x3119('0x47')](_0x49ad53);})[_0x3119('0x45')](function(_0x130426){_0x48ecb6[_0x3119('0x48')]=_0x130426;return _0x48ecb6;})[_0x3119('0x45')](respondWithFilteredResult(_0x329870,_0x49ad53))[_0x3119('0x49')](handleError(_0x329870,null));};exports['show']=function(_0x527ad9,_0x31d012){var _0x4ee556={'raw':![],'where':{'id':_0x527ad9['params']['id']}},_0x23513a={};_0x23513a[_0x3119('0x38')]=_['keys'](db[_0x3119('0x44')][_0x3119('0x31')]);_0x23513a[_0x3119('0x35')]=_[_0x3119('0x36')](_0x527ad9[_0x3119('0x35')]);_0x23513a[_0x3119('0x37')]=_[_0x3119('0x39')](_0x23513a['model'],_0x23513a['query']);_0x4ee556[_0x3119('0x3b')]=_[_0x3119('0x39')](_0x23513a[_0x3119('0x38')],qs[_0x3119('0x3a')](_0x527ad9[_0x3119('0x35')][_0x3119('0x3a')]));_0x4ee556[_0x3119('0x3b')]=_0x4ee556[_0x3119('0x3b')]['length']?_0x4ee556[_0x3119('0x3b')]:_0x23513a[_0x3119('0x38')];if(_0x527ad9['query'][_0x3119('0x46')]){_0x4ee556['include']=[{'all':!![]}];}_0x4ee556=_[_0x3119('0x41')]({},_0x4ee556,_0x527ad9[_0x3119('0x4a')]);return db[_0x3119('0x44')][_0x3119('0x4b')](_0x4ee556)['then'](handleEntityNotFound(_0x31d012,null))['then'](respondWithResult(_0x31d012,null))[_0x3119('0x49')](handleError(_0x31d012,null));};exports[_0x3119('0x4c')]=function(_0x42a01c,_0x13ec9e){return db[_0x3119('0x44')]['create'](_0x42a01c[_0x3119('0x4d')],{})[_0x3119('0x45')](respondWithResult(_0x13ec9e,0xc9))[_0x3119('0x49')](handleError(_0x13ec9e,null));};exports['update']=function(_0x10ee79,_0x3f85b1){if(_0x10ee79['body']['id']){delete _0x10ee79[_0x3119('0x4d')]['id'];}return db[_0x3119('0x44')][_0x3119('0x4b')]({'where':{'id':_0x10ee79[_0x3119('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3f85b1,null))[_0x3119('0x45')](saveUpdates(_0x10ee79[_0x3119('0x4d')],null))[_0x3119('0x45')](respondWithResult(_0x3f85b1,null))[_0x3119('0x49')](handleError(_0x3f85b1,null));};exports[_0x3119('0x29')]=function(_0x8c2b1f,_0x5cb9ea){return db[_0x3119('0x44')][_0x3119('0x4b')]({'where':{'id':_0x8c2b1f[_0x3119('0x4e')]['id']}})[_0x3119('0x45')](handleEntityNotFound(_0x5cb9ea,null))[_0x3119('0x45')](removeEntity(_0x5cb9ea,null))[_0x3119('0x49')](handleError(_0x5cb9ea,null));};exports[_0x3119('0x4f')]=function(_0x2624a0,_0x2a0737,_0x25a897){var _0x3a7f31={};var _0x40ed51={};var _0x20de7f;var _0x4541fd;return db[_0x3119('0x44')][_0x3119('0x50')]({'where':{'id':_0x2624a0[_0x3119('0x4e')]['id']}})[_0x3119('0x45')](handleEntityNotFound(_0x2a0737,null))[_0x3119('0x45')](function(_0x5b0660){if(_0x5b0660){_0x20de7f=_0x5b0660;_0x40ed51[_0x3119('0x38')]=_['keys'](db[_0x3119('0x51')][_0x3119('0x31')]);_0x40ed51['query']=_[_0x3119('0x36')](_0x2624a0[_0x3119('0x35')]);_0x40ed51['filters']=_[_0x3119('0x39')](_0x40ed51[_0x3119('0x38')],_0x40ed51['query']);_0x3a7f31[_0x3119('0x3b')]=_['intersection'](_0x40ed51[_0x3119('0x38')],qs[_0x3119('0x3a')](_0x2624a0[_0x3119('0x35')]['fields']));_0x3a7f31[_0x3119('0x3b')]=_0x3a7f31['attributes'][_0x3119('0x52')]?_0x3a7f31[_0x3119('0x3b')]:_0x40ed51['model'];_0x3a7f31[_0x3119('0x3d')]=qs[_0x3119('0x3e')](_0x2624a0['query'][_0x3119('0x3e')]);_0x3a7f31['where']=qs['filters'](_[_0x3119('0x3f')](_0x2624a0[_0x3119('0x35')],_0x40ed51[_0x3119('0x37')]));if(_0x2624a0[_0x3119('0x35')]['filter']){_0x3a7f31[_0x3119('0x40')]=_['merge'](_0x3a7f31[_0x3119('0x40')],{'$or':_[_0x3119('0x30')](_0x3a7f31['attributes'],function(_0x3a5b23){var _0x53b4a4={};_0x53b4a4[_0x3a5b23]={'$like':'%'+_0x2624a0[_0x3119('0x35')][_0x3119('0x43')]+'%'};return _0x53b4a4;})});}_0x3a7f31=_['merge']({},_0x3a7f31,_0x2624a0['options']);return _0x20de7f['getConfigurations'](_0x3a7f31);}})[_0x3119('0x45')](function(_0x20c6ab){if(_0x20c6ab){_0x4541fd=_0x20c6ab[_0x3119('0x52')];if(!_0x2624a0['query']['hasOwnProperty']('nolimit')){_0x3a7f31['limit']=qs[_0x3119('0x21')](_0x2624a0[_0x3119('0x35')][_0x3119('0x21')]);_0x3a7f31['offset']=qs['offset'](_0x2624a0[_0x3119('0x35')][_0x3119('0x1f')]);}return _0x20de7f['getConfigurations'](_0x3a7f31);}})[_0x3119('0x45')](function(_0x501334){if(_0x501334){return _0x501334?{'count':_0x4541fd,'rows':_0x501334}:null;}})[_0x3119('0x45')](respondWithResult(_0x2a0737,null))['catch'](handleError(_0x2a0737,null));};exports[_0x3119('0x53')]=function(_0x2ac855,_0x4e5db8,_0x2c0fa7){if(_0x2ac855[_0x3119('0x4d')]['id']){delete _0x2ac855[_0x3119('0x4d')]['id'];}return db[_0x3119('0x44')][_0x3119('0x50')]({'where':{'id':_0x2ac855['params']['id']}})['then'](handleEntityNotFound(_0x4e5db8,null))[_0x3119('0x45')](function(_0x40cb25){if(_0x40cb25){_0x2ac855[_0x3119('0x4d')]['AccountId']=_0x40cb25['id'];_0x2ac855[_0x3119('0x4d')][_0x3119('0x54')]=integrations['getSubjects'](_0x2ac855[_0x3119('0x4d')][_0x3119('0x55')],_0x2ac855[_0x3119('0x4d')][_0x3119('0x33')]);_0x2ac855[_0x3119('0x4d')]['Descriptions']=integrations[_0x3119('0x56')](_0x2ac855[_0x3119('0x4d')][_0x3119('0x55')],_0x2ac855[_0x3119('0x4d')][_0x3119('0x33')]);return db['FreshsalesConfiguration']['create'](_0x2ac855[_0x3119('0x4d')],{'include':[{'model':db[_0x3119('0x57')],'as':_0x3119('0x54')},{'model':db['FreshsalesField'],'as':_0x3119('0x58')}]});}return null;})[_0x3119('0x45')](respondWithResult(_0x4e5db8,null))[_0x3119('0x49')](handleError(_0x4e5db8,null));};exports['getFields']=function(_0x70e551,_0x51a55f,_0x1737bb){var _0x4773cc='';var _0x166897='';return db[_0x3119('0x44')][_0x3119('0x50')]({'where':{'id':_0x70e551[_0x3119('0x4e')]['id']},'attributes':['id',_0x3119('0x59'),_0x3119('0x5a'),'apiKey']})[_0x3119('0x45')](handleEntityNotFound(_0x51a55f,null))[_0x3119('0x45')](function(_0x476d1b){if(_0x476d1b){_0x166897=_0x476d1b[_0x3119('0x59')];_0x4773cc=_0x476d1b[_0x3119('0x5a')];var _0x458bd2=_0x476d1b[_0x3119('0x5a')]['slice'](-0x1);if(_0x458bd2==='/'){_0x4773cc=_0x4773cc[_0x3119('0x5b')](0x0,_0x4773cc[_0x3119('0x5c')](_0x458bd2));}return rp({'method':_0x3119('0x5d'),'uri':util[_0x3119('0x5e')](_0x3119('0x5f'),_0x4773cc,_0x3119('0x60')),'headers':{'Authorization':_0x3119('0x61')+_0x476d1b[_0x3119('0x62')]},'json':!![]});}})[_0x3119('0x45')](function(_0x4e25bb){if(_0x4e25bb){var _0x34727a=_0x4e25bb[_0x3119('0x63')];var _0x56c893=![];var _0x1487bb=null;for(_0x1487bb=0x0;_0x1487bb<_0x34727a[_0x3119('0x52')];_0x1487bb++){if(_0x34727a[_0x1487bb][_0x3119('0x64')]===_0x166897){_0x56c893=!![];}}if(_0x56c893){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x3119('0x65')});}}})[_0x3119('0x45')](respondWithResult(_0x51a55f,null))[_0x3119('0x49')](function(_0x2e68c1){var _0x3097db=_0x70e551[_0x3119('0x35')]['test']?0x1f4:_0x2e68c1[_0x3119('0x66')]||0x1f4;logger[_0x3119('0x2b')](_0x3119('0x67'),_0x3119('0x68'),_0x3097db,JSON[_0x3119('0x69')](_0x2e68c1));delete _0x2e68c1[_0x3119('0x2d')];if(_0x3097db===0x191){_0x3097db=0x190;}_0x51a55f[_0x3119('0x1d')](_0x3097db)[_0x3119('0x2e')](_0x70e551[_0x3119('0x35')][_0x3119('0x6a')]?{'message':'Wrong\x20credentials','statusCode':_0x2e68c1[_0x3119('0x66')]}:_0x2e68c1);});}; \ No newline at end of file +var _0x9586=['model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','includeAll','include','FreshsalesAccount','catch','show','fields','find','create','body','params','getConfigurations','FreshsalesConfiguration','options','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshsalesField','Descriptions','remoteUri','apiKey','username','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields','stringify','send','Wrong\x20credentials','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','offset','undefined','count','Content-Range','json','reject','save','then','destroy','sendStatus','stack','name','index','map','rawAttributes','type','key'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0x9586,0x168));var _0x6958=function(_0x13ed1b,_0x21db13){_0x13ed1b=_0x13ed1b-0x0;var _0x494a34=_0x9586[_0x13ed1b];return _0x494a34;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6958('0x0'));var zipdir=require(_0x6958('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6958('0x2'));var BPromise=require(_0x6958('0x3'));var Mustache=require(_0x6958('0x4'));var util=require(_0x6958('0x5'));var path=require(_0x6958('0x6'));var sox=require(_0x6958('0x7'));var csv=require(_0x6958('0x8'));var ejs=require(_0x6958('0x9'));var fs=require('fs');var fs_extra=require(_0x6958('0xa'));var _=require(_0x6958('0xb'));var squel=require(_0x6958('0xc'));var crypto=require('crypto');var jsforce=require(_0x6958('0xd'));var deskjs=require(_0x6958('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6958('0xf'));var Papa=require('papaparse');var Redis=require(_0x6958('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6958('0x11'));var as=require(_0x6958('0x12'));var hardwareService=require(_0x6958('0x13'));var logger=require(_0x6958('0x14'))('api');var utils=require(_0x6958('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6958('0x16'));var db=require(_0x6958('0x17'))['db'];var integrations=require(_0x6958('0x18'));function respondWithStatusCode(_0x18021d,_0x2c9052){_0x2c9052=_0x2c9052||0xcc;return function(_0xbacffa){if(_0xbacffa){return _0x18021d['sendStatus'](_0x2c9052);}return _0x18021d[_0x6958('0x19')](_0x2c9052)[_0x6958('0x1a')]();};}function respondWithResult(_0x15cba2,_0x8868e1){_0x8868e1=_0x8868e1||0xc8;return function(_0x259a03){if(_0x259a03){return _0x15cba2['status'](_0x8868e1)['json'](_0x259a03);}};}function respondWithFilteredResult(_0x56cb71,_0x23689b){return function(_0x4c70a4){if(_0x4c70a4){var _0x302e9d=typeof _0x23689b[_0x6958('0x1b')]===_0x6958('0x1c')&&typeof _0x23689b['limit']==='undefined';var _0x272bbd=_0x4c70a4[_0x6958('0x1d')];var _0x1bb6f1=_0x302e9d?0x0:_0x23689b['offset'];var _0x474005=_0x302e9d?_0x4c70a4['count']:_0x23689b[_0x6958('0x1b')]+_0x23689b['limit'];var _0x4276b0;if(_0x474005>=_0x272bbd){_0x474005=_0x272bbd;_0x4276b0=0xc8;}else{_0x4276b0=0xce;}_0x56cb71[_0x6958('0x19')](_0x4276b0);return _0x56cb71['set'](_0x6958('0x1e'),_0x1bb6f1+'-'+_0x474005+'/'+_0x272bbd)[_0x6958('0x1f')](_0x4c70a4);}return null;};}function patchUpdates(_0x5db0e2){return function(_0x14b631){try{jsonpatch['apply'](_0x14b631,_0x5db0e2,!![]);}catch(_0x490f99){return BPromise[_0x6958('0x20')](_0x490f99);}return _0x14b631[_0x6958('0x21')]();};}function saveUpdates(_0x1593f0,_0x2a191){return function(_0x418a92){if(_0x418a92){return _0x418a92['update'](_0x1593f0)[_0x6958('0x22')](function(_0x3cef99){return _0x3cef99;});}return null;};}function removeEntity(_0x18333b,_0x49aaa5){return function(_0x2909a3){if(_0x2909a3){return _0x2909a3[_0x6958('0x23')]()['then'](function(){_0x18333b['status'](0xcc)[_0x6958('0x1a')]();});}};}function handleEntityNotFound(_0x46649e,_0x16aed4){return function(_0x4d9f8a){if(!_0x4d9f8a){_0x46649e[_0x6958('0x24')](0x194);}return _0x4d9f8a;};}function handleError(_0x575f9a,_0x16eaf5){_0x16eaf5=_0x16eaf5||0x1f4;return function(_0x19f12e){logger['error'](_0x19f12e[_0x6958('0x25')]);if(_0x19f12e[_0x6958('0x26')]){delete _0x19f12e[_0x6958('0x26')];}_0x575f9a[_0x6958('0x19')](_0x16eaf5)['send'](_0x19f12e);};}exports[_0x6958('0x27')]=function(_0x3466dd,_0x3d731c){var _0x5beede={},_0x37792c={},_0x194a63={'count':0x0,'rows':[]};var _0x5e3763=_[_0x6958('0x28')](db['FreshsalesAccount'][_0x6958('0x29')],function(_0x4851d5){return{'name':_0x4851d5['fieldName'],'type':_0x4851d5[_0x6958('0x2a')][_0x6958('0x2b')]};});_0x37792c[_0x6958('0x2c')]=_[_0x6958('0x28')](_0x5e3763,'name');_0x37792c[_0x6958('0x2d')]=_[_0x6958('0x2e')](_0x3466dd['query']);_0x37792c['filters']=_[_0x6958('0x2f')](_0x37792c['model'],_0x37792c[_0x6958('0x2d')]);_0x5beede[_0x6958('0x30')]=_[_0x6958('0x2f')](_0x37792c[_0x6958('0x2c')],qs['fields'](_0x3466dd[_0x6958('0x2d')]['fields']));_0x5beede[_0x6958('0x30')]=_0x5beede[_0x6958('0x30')][_0x6958('0x31')]?_0x5beede[_0x6958('0x30')]:_0x37792c['model'];if(!_0x3466dd[_0x6958('0x2d')][_0x6958('0x32')](_0x6958('0x33'))){_0x5beede['limit']=qs[_0x6958('0x34')](_0x3466dd[_0x6958('0x2d')][_0x6958('0x34')]);_0x5beede[_0x6958('0x1b')]=qs[_0x6958('0x1b')](_0x3466dd[_0x6958('0x2d')][_0x6958('0x1b')]);}_0x5beede[_0x6958('0x35')]=qs[_0x6958('0x36')](_0x3466dd['query'][_0x6958('0x36')]);_0x5beede['where']=qs[_0x6958('0x37')](_[_0x6958('0x38')](_0x3466dd[_0x6958('0x2d')],_0x37792c['filters']),_0x5e3763);if(_0x3466dd[_0x6958('0x2d')][_0x6958('0x39')]){_0x5beede[_0x6958('0x3a')]=_[_0x6958('0x3b')](_0x5beede[_0x6958('0x3a')],{'$or':_[_0x6958('0x28')](_0x5e3763,function(_0x4530a3){if(_0x4530a3['type']!=='VIRTUAL'){var _0x1dd3ed={};_0x1dd3ed[_0x4530a3[_0x6958('0x26')]]={'$like':'%'+_0x3466dd[_0x6958('0x2d')][_0x6958('0x39')]+'%'};return _0x1dd3ed;}})});}_0x5beede=_[_0x6958('0x3b')]({},_0x5beede,_0x3466dd['options']);var _0x224c4c={'where':_0x5beede[_0x6958('0x3a')]};return db['FreshsalesAccount'][_0x6958('0x1d')](_0x224c4c)[_0x6958('0x22')](function(_0x3943d9){_0x194a63[_0x6958('0x1d')]=_0x3943d9;if(_0x3466dd[_0x6958('0x2d')][_0x6958('0x3c')]){_0x5beede[_0x6958('0x3d')]=[{'all':!![]}];}return db[_0x6958('0x3e')]['findAll'](_0x5beede);})[_0x6958('0x22')](function(_0x47506c){_0x194a63['rows']=_0x47506c;return _0x194a63;})['then'](respondWithFilteredResult(_0x3d731c,_0x5beede))[_0x6958('0x3f')](handleError(_0x3d731c,null));};exports[_0x6958('0x40')]=function(_0x13508e,_0x2f468b){var _0x3e9b06={'raw':![],'where':{'id':_0x13508e['params']['id']}},_0x2260f9={};_0x2260f9[_0x6958('0x2c')]=_['keys'](db['FreshsalesAccount'][_0x6958('0x29')]);_0x2260f9[_0x6958('0x2d')]=_['keys'](_0x13508e['query']);_0x2260f9[_0x6958('0x37')]=_[_0x6958('0x2f')](_0x2260f9['model'],_0x2260f9[_0x6958('0x2d')]);_0x3e9b06[_0x6958('0x30')]=_[_0x6958('0x2f')](_0x2260f9[_0x6958('0x2c')],qs['fields'](_0x13508e[_0x6958('0x2d')][_0x6958('0x41')]));_0x3e9b06[_0x6958('0x30')]=_0x3e9b06[_0x6958('0x30')][_0x6958('0x31')]?_0x3e9b06[_0x6958('0x30')]:_0x2260f9[_0x6958('0x2c')];if(_0x13508e['query'][_0x6958('0x3c')]){_0x3e9b06['include']=[{'all':!![]}];}_0x3e9b06=_[_0x6958('0x3b')]({},_0x3e9b06,_0x13508e['options']);return db[_0x6958('0x3e')][_0x6958('0x42')](_0x3e9b06)[_0x6958('0x22')](handleEntityNotFound(_0x2f468b,null))[_0x6958('0x22')](respondWithResult(_0x2f468b,null))[_0x6958('0x3f')](handleError(_0x2f468b,null));};exports['create']=function(_0x2fe622,_0x2d16bc){return db[_0x6958('0x3e')][_0x6958('0x43')](_0x2fe622['body'],{})['then'](respondWithResult(_0x2d16bc,0xc9))[_0x6958('0x3f')](handleError(_0x2d16bc,null));};exports['update']=function(_0x545e33,_0x9b3a08){if(_0x545e33[_0x6958('0x44')]['id']){delete _0x545e33[_0x6958('0x44')]['id'];}return db[_0x6958('0x3e')][_0x6958('0x42')]({'where':{'id':_0x545e33[_0x6958('0x45')]['id']}})[_0x6958('0x22')](handleEntityNotFound(_0x9b3a08,null))[_0x6958('0x22')](saveUpdates(_0x545e33[_0x6958('0x44')],null))['then'](respondWithResult(_0x9b3a08,null))[_0x6958('0x3f')](handleError(_0x9b3a08,null));};exports[_0x6958('0x23')]=function(_0x527efc,_0x49ff93){return db['FreshsalesAccount'][_0x6958('0x42')]({'where':{'id':_0x527efc[_0x6958('0x45')]['id']}})[_0x6958('0x22')](handleEntityNotFound(_0x49ff93,null))[_0x6958('0x22')](removeEntity(_0x49ff93,null))[_0x6958('0x3f')](handleError(_0x49ff93,null));};exports[_0x6958('0x46')]=function(_0x338c39,_0x47899c,_0x23bdfe){var _0x3932e2={};var _0x737bd6={};var _0xa3dcc5;var _0x57d1fe;return db['FreshsalesAccount']['findOne']({'where':{'id':_0x338c39[_0x6958('0x45')]['id']}})[_0x6958('0x22')](handleEntityNotFound(_0x47899c,null))[_0x6958('0x22')](function(_0x1bbb31){if(_0x1bbb31){_0xa3dcc5=_0x1bbb31;_0x737bd6[_0x6958('0x2c')]=_[_0x6958('0x2e')](db[_0x6958('0x47')][_0x6958('0x29')]);_0x737bd6[_0x6958('0x2d')]=_[_0x6958('0x2e')](_0x338c39['query']);_0x737bd6[_0x6958('0x37')]=_[_0x6958('0x2f')](_0x737bd6['model'],_0x737bd6[_0x6958('0x2d')]);_0x3932e2[_0x6958('0x30')]=_['intersection'](_0x737bd6[_0x6958('0x2c')],qs['fields'](_0x338c39['query'][_0x6958('0x41')]));_0x3932e2[_0x6958('0x30')]=_0x3932e2[_0x6958('0x30')][_0x6958('0x31')]?_0x3932e2[_0x6958('0x30')]:_0x737bd6[_0x6958('0x2c')];_0x3932e2[_0x6958('0x35')]=qs[_0x6958('0x36')](_0x338c39[_0x6958('0x2d')][_0x6958('0x36')]);_0x3932e2[_0x6958('0x3a')]=qs[_0x6958('0x37')](_[_0x6958('0x38')](_0x338c39['query'],_0x737bd6[_0x6958('0x37')]));if(_0x338c39[_0x6958('0x2d')][_0x6958('0x39')]){_0x3932e2[_0x6958('0x3a')]=_[_0x6958('0x3b')](_0x3932e2[_0x6958('0x3a')],{'$or':_['map'](_0x3932e2[_0x6958('0x30')],function(_0x2313ee){var _0x31f146={};_0x31f146[_0x2313ee]={'$like':'%'+_0x338c39['query'][_0x6958('0x39')]+'%'};return _0x31f146;})});}_0x3932e2=_[_0x6958('0x3b')]({},_0x3932e2,_0x338c39[_0x6958('0x48')]);return _0xa3dcc5['getConfigurations'](_0x3932e2);}})['then'](function(_0x46d519){if(_0x46d519){_0x57d1fe=_0x46d519[_0x6958('0x31')];if(!_0x338c39['query'][_0x6958('0x32')](_0x6958('0x33'))){_0x3932e2[_0x6958('0x34')]=qs[_0x6958('0x34')](_0x338c39[_0x6958('0x2d')][_0x6958('0x34')]);_0x3932e2[_0x6958('0x1b')]=qs[_0x6958('0x1b')](_0x338c39['query'][_0x6958('0x1b')]);}return _0xa3dcc5[_0x6958('0x46')](_0x3932e2);}})['then'](function(_0x4850f9){if(_0x4850f9){return _0x4850f9?{'count':_0x57d1fe,'rows':_0x4850f9}:null;}})[_0x6958('0x22')](respondWithResult(_0x47899c,null))['catch'](handleError(_0x47899c,null));};exports[_0x6958('0x49')]=function(_0x2f5ff2,_0x478ead,_0x1aeb2b){if(_0x2f5ff2[_0x6958('0x44')]['id']){delete _0x2f5ff2[_0x6958('0x44')]['id'];}return db['FreshsalesAccount'][_0x6958('0x4a')]({'where':{'id':_0x2f5ff2[_0x6958('0x45')]['id']}})[_0x6958('0x22')](handleEntityNotFound(_0x478ead,null))['then'](function(_0x3c97dc){if(_0x3c97dc){_0x2f5ff2[_0x6958('0x44')][_0x6958('0x4b')]=_0x3c97dc['id'];_0x2f5ff2['body'][_0x6958('0x4c')]=integrations[_0x6958('0x4d')](_0x2f5ff2['body'][_0x6958('0x4e')],_0x2f5ff2[_0x6958('0x44')][_0x6958('0x2a')]);_0x2f5ff2['body']['Descriptions']=integrations[_0x6958('0x4f')](_0x2f5ff2[_0x6958('0x44')][_0x6958('0x4e')],_0x2f5ff2[_0x6958('0x44')]['type']);return db['FreshsalesConfiguration'][_0x6958('0x43')](_0x2f5ff2[_0x6958('0x44')],{'include':[{'model':db[_0x6958('0x50')],'as':_0x6958('0x4c')},{'model':db[_0x6958('0x50')],'as':_0x6958('0x51')}]});}return null;})[_0x6958('0x22')](respondWithResult(_0x478ead,null))[_0x6958('0x3f')](handleError(_0x478ead,null));};exports['getFields']=function(_0x1361f3,_0x3cb99e,_0x49187b){var _0x1a4fce='';var _0x194946='';return db['FreshsalesAccount'][_0x6958('0x4a')]({'where':{'id':_0x1361f3[_0x6958('0x45')]['id']},'attributes':['id','username',_0x6958('0x52'),_0x6958('0x53')]})[_0x6958('0x22')](handleEntityNotFound(_0x3cb99e,null))['then'](function(_0x1ea42a){if(_0x1ea42a){_0x194946=_0x1ea42a[_0x6958('0x54')];_0x1a4fce=_0x1ea42a[_0x6958('0x52')];var _0xfce8f9=_0x1ea42a[_0x6958('0x52')][_0x6958('0x55')](-0x1);if(_0xfce8f9==='/'){_0x1a4fce=_0x1a4fce[_0x6958('0x56')](0x0,_0x1a4fce[_0x6958('0x57')](_0xfce8f9));}return rp({'method':_0x6958('0x58'),'uri':util[_0x6958('0x59')](_0x6958('0x5a'),_0x1a4fce,_0x6958('0x5b')),'headers':{'Authorization':_0x6958('0x5c')+_0x1ea42a['apiKey']},'json':!![]});}})[_0x6958('0x22')](function(_0x34b746){if(_0x34b746){var _0x1d0626=_0x34b746[_0x6958('0x5d')];var _0x4cb2fc=![];var _0x533357=null;for(_0x533357=0x0;_0x533357<_0x1d0626[_0x6958('0x31')];_0x533357++){if(_0x1d0626[_0x533357]['email']===_0x194946){_0x4cb2fc=!![];}}if(_0x4cb2fc){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x6958('0x5e')});}}})[_0x6958('0x22')](respondWithResult(_0x3cb99e,null))[_0x6958('0x3f')](function(_0x3acfdb){var _0x2e1db6=_0x1361f3['query'][_0x6958('0x5f')]?0x1f4:_0x3acfdb[_0x6958('0x60')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x6958('0x61'),_0x2e1db6,JSON[_0x6958('0x62')](_0x3acfdb));delete _0x3acfdb[_0x6958('0x26')];if(_0x2e1db6===0x191){_0x2e1db6=0x190;}_0x3cb99e[_0x6958('0x19')](_0x2e1db6)[_0x6958('0x63')](_0x1361f3[_0x6958('0x2d')][_0x6958('0x5f')]?{'message':_0x6958('0x64'),'statusCode':_0x3acfdb[_0x6958('0x60')]}:_0x3acfdb);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 041bbc5..e1ad5e2 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 _0x1a85=['moment','path','rimraf','../../config/environment','../../components/integrations/configuration','define','FreshsalesAccount','../../config/logger','api'];(function(_0x169dd5,_0x353e02){var _0x1fb73c=function(_0x33751a){while(--_0x33751a){_0x169dd5['push'](_0x169dd5['shift']());}};_0x1fb73c(++_0x353e02);}(_0x1a85,0x178));var _0x51a8=function(_0x4d934b,_0x52f8e9){_0x4d934b=_0x4d934b-0x0;var _0xc0338b=_0x1a85[_0x4d934b];return _0xc0338b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x51a8('0x0'))(_0x51a8('0x1'));var moment=require(_0x51a8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x51a8('0x3'));var rimraf=require(_0x51a8('0x4'));var config=require(_0x51a8('0x5'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x51a8('0x6'));module['exports']=function(_0x2c1180,_0x5cf430){return _0x2c1180[_0x51a8('0x7')](_0x51a8('0x8'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1883=['../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4fe99f,_0x5e352e){var _0x196e80=function(_0x92f04){while(--_0x92f04){_0x4fe99f['push'](_0x4fe99f['shift']());}};_0x196e80(++_0x5e352e);}(_0x1883,0xab));var _0x3188=function(_0x1ebbcd,_0x18bf2d){_0x1ebbcd=_0x1ebbcd-0x0;var _0x55f0ee=_0x1883[_0x1ebbcd];return _0x55f0ee;};'use strict';var _=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var logger=require(_0x3188('0x2'))(_0x3188('0x3'));var moment=require(_0x3188('0x4'));var BPromise=require(_0x3188('0x5'));var rp=require(_0x3188('0x6'));var fs=require('fs');var path=require(_0x3188('0x7'));var rimraf=require(_0x3188('0x8'));var config=require(_0x3188('0x9'));var attributes=require(_0x3188('0xa'));var integrations=require(_0x3188('0xb'));module[_0x3188('0xc')]=function(_0x33b62d,_0x24f2f1){return _0x33b62d[_0x3188('0xd')](_0x3188('0xe'),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 9487b8f..701534d 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 _0x4bd3=['where','attributes','limit','include','model','map','stringify','find','ShowFreshsalesAccount','lodash','moment','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw'];(function(_0x4dcc2d,_0x422839){var _0x1bbd79=function(_0x173341){while(--_0x173341){_0x4dcc2d['push'](_0x4dcc2d['shift']());}};_0x1bbd79(++_0x422839);}(_0x4bd3,0x174));var _0x34bd=function(_0x3952e7,_0x583213){_0x3952e7=_0x3952e7-0x0;var _0x103081=_0x4bd3[_0x3952e7];return _0x103081;};'use strict';var _=require(_0x34bd('0x0'));var util=require('util');var moment=require(_0x34bd('0x1'));var BPromise=require(_0x34bd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x34bd('0x3'));var logger=require(_0x34bd('0x4'))(_0x34bd('0x5'));var config=require('../../config/environment');var jayson=require(_0x34bd('0x6'));var client=jayson[_0x34bd('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e8744,_0x213716,_0x51a4d7){return new BPromise(function(_0xd600e1,_0x76de8d){return client[_0x34bd('0x8')](_0x3e8744,_0x51a4d7)[_0x34bd('0x9')](function(_0x1ac77f){logger[_0x34bd('0xa')]('FreshsalesAccount,\x20%s,\x20%s',_0x213716,_0x34bd('0xb'));logger[_0x34bd('0xc')](_0x34bd('0xd'),_0x213716,_0x34bd('0xb'),JSON['stringify'](_0x1ac77f));if(_0x1ac77f['error']){if(_0x1ac77f[_0x34bd('0xe')]['code']===0x1f4){logger['error'](_0x34bd('0xf'),_0x213716,_0x1ac77f[_0x34bd('0xe')][_0x34bd('0x10')]);return _0x76de8d(_0x1ac77f[_0x34bd('0xe')][_0x34bd('0x10')]);}logger[_0x34bd('0xe')](_0x34bd('0xf'),_0x213716,_0x1ac77f[_0x34bd('0xe')][_0x34bd('0x10')]);return _0xd600e1(_0x1ac77f['error'][_0x34bd('0x10')]);}else{logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x213716,_0x34bd('0xb'));_0xd600e1(_0x1ac77f[_0x34bd('0x11')][_0x34bd('0x10')]);}})[_0x34bd('0x12')](function(_0x34b91b){logger[_0x34bd('0xe')](_0x34bd('0xf'),_0x213716,_0x34b91b);_0x76de8d(_0x34b91b);});});}exports[_0x34bd('0x13')]=function(_0x3b4bf8){var _0x72b197=this;return new Promise(function(_0x4b5ebb,_0x48d2ba){return db[_0x34bd('0x14')][_0x34bd('0x15')]({'raw':_0x3b4bf8[_0x34bd('0x16')]?_0x3b4bf8[_0x34bd('0x16')][_0x34bd('0x17')]===undefined?!![]:![]:!![],'where':_0x3b4bf8[_0x34bd('0x16')]?_0x3b4bf8[_0x34bd('0x16')][_0x34bd('0x18')]||null:null,'attributes':_0x3b4bf8[_0x34bd('0x16')]?_0x3b4bf8['options'][_0x34bd('0x19')]||null:null,'limit':_0x3b4bf8[_0x34bd('0x16')]?_0x3b4bf8[_0x34bd('0x16')][_0x34bd('0x1a')]||null:null,'include':_0x3b4bf8[_0x34bd('0x16')]?_0x3b4bf8['options']['include']?_['map'](_0x3b4bf8['options'][_0x34bd('0x1b')],function(_0x503a60){return{'model':db[_0x503a60[_0x34bd('0x1c')]],'as':_0x503a60['as'],'attributes':_0x503a60[_0x34bd('0x19')],'include':_0x503a60[_0x34bd('0x1b')]?_['map'](_0x503a60[_0x34bd('0x1b')],function(_0x14479a){return{'model':db[_0x14479a[_0x34bd('0x1c')]],'as':_0x14479a['as'],'attributes':_0x14479a[_0x34bd('0x19')],'include':_0x14479a['include']?_[_0x34bd('0x1d')](_0x14479a[_0x34bd('0x1b')],function(_0x264c94){return{'model':db[_0x264c94[_0x34bd('0x1c')]],'as':_0x264c94['as'],'attributes':_0x264c94['attributes']};}):[]};}):[]};}):[]:[]})[_0x34bd('0x9')](function(_0x3fe8b0){logger['info'](_0x34bd('0x13'),_0x3b4bf8);logger[_0x34bd('0xc')](_0x34bd('0x13'),_0x3b4bf8,JSON[_0x34bd('0x1e')](_0x3fe8b0));_0x4b5ebb(_0x3fe8b0);})[_0x34bd('0x12')](function(_0x4500c8){logger[_0x34bd('0xe')]('GetFreshsalesAccount',_0x4500c8[_0x34bd('0x10')],_0x3b4bf8);_0x48d2ba(_0x72b197[_0x34bd('0xe')](0x1f4,_0x4500c8['message']));});});};exports['ShowFreshsalesAccount']=function(_0x38bdba){var _0xca9897=this;return new Promise(function(_0xd176f7,_0x536b2c){return db['FreshsalesAccount'][_0x34bd('0x1f')]({'raw':_0x38bdba[_0x34bd('0x16')]?_0x38bdba[_0x34bd('0x16')][_0x34bd('0x17')]===undefined?!![]:![]:!![],'where':_0x38bdba['options']?_0x38bdba[_0x34bd('0x16')][_0x34bd('0x18')]||null:null,'attributes':_0x38bdba[_0x34bd('0x16')]?_0x38bdba[_0x34bd('0x16')][_0x34bd('0x19')]||null:null,'include':_0x38bdba[_0x34bd('0x16')]?_0x38bdba['options'][_0x34bd('0x1b')]?_['map'](_0x38bdba[_0x34bd('0x16')][_0x34bd('0x1b')],function(_0xf12ee6){return{'model':db[_0xf12ee6['model']],'as':_0xf12ee6['as'],'attributes':_0xf12ee6[_0x34bd('0x19')],'include':_0xf12ee6[_0x34bd('0x1b')]?_['map'](_0xf12ee6[_0x34bd('0x1b')],function(_0x21c7d6){return{'model':db[_0x21c7d6[_0x34bd('0x1c')]],'as':_0x21c7d6['as'],'attributes':_0x21c7d6['attributes'],'include':_0x21c7d6[_0x34bd('0x1b')]?_[_0x34bd('0x1d')](_0x21c7d6['include'],function(_0x117188){return{'model':db[_0x117188[_0x34bd('0x1c')]],'as':_0x117188['as'],'attributes':_0x117188[_0x34bd('0x19')]};}):[]};}):[]};}):[]:[]})[_0x34bd('0x9')](function(_0x320643){logger[_0x34bd('0xa')]('ShowFreshsalesAccount',_0x38bdba);logger['debug']('ShowFreshsalesAccount',_0x38bdba,JSON[_0x34bd('0x1e')](_0x320643));_0xd176f7(_0x320643);})[_0x34bd('0x12')](function(_0x5e30c5){logger['error'](_0x34bd('0x20'),_0x5e30c5['message'],_0x38bdba);_0x536b2c(_0xca9897['error'](0x1f4,_0x5e30c5[_0x34bd('0x10')]));});});}; \ No newline at end of file +var _0x9582=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','FreshsalesAccount','options','raw','limit','include','map','model','attributes','then','GetFreshsalesAccount','ShowFreshsalesAccount','find'];(function(_0x5cbeea,_0x5b0862){var _0x55ddd1=function(_0x1d7eda){while(--_0x1d7eda){_0x5cbeea['push'](_0x5cbeea['shift']());}};_0x55ddd1(++_0x5b0862);}(_0x9582,0x95));var _0x2958=function(_0x5e6db5,_0x3b37ab){_0x5e6db5=_0x5e6db5-0x0;var _0x48e02f=_0x9582[_0x5e6db5];return _0x48e02f;};'use strict';var _=require(_0x2958('0x0'));var util=require(_0x2958('0x1'));var moment=require(_0x2958('0x2'));var BPromise=require(_0x2958('0x3'));var rs=require(_0x2958('0x4'));var fs=require('fs');var Redis=require(_0x2958('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2958('0x6'));var logger=require(_0x2958('0x7'))(_0x2958('0x8'));var config=require(_0x2958('0x9'));var jayson=require(_0x2958('0xa'));var client=jayson[_0x2958('0xb')][_0x2958('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x309525,_0xa385ec,_0x2e571b){return new BPromise(function(_0x56ca85,_0x5ec1b3){return client[_0x2958('0xd')](_0x309525,_0x2e571b)['then'](function(_0x10db1e){logger['info'](_0x2958('0xe'),_0xa385ec,'request\x20sent');logger[_0x2958('0xf')](_0x2958('0x10'),_0xa385ec,_0x2958('0x11'),JSON[_0x2958('0x12')](_0x10db1e));if(_0x10db1e[_0x2958('0x13')]){if(_0x10db1e['error'][_0x2958('0x14')]===0x1f4){logger[_0x2958('0x13')](_0x2958('0xe'),_0xa385ec,_0x10db1e[_0x2958('0x13')][_0x2958('0x15')]);return _0x5ec1b3(_0x10db1e[_0x2958('0x13')][_0x2958('0x15')]);}logger[_0x2958('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0xa385ec,_0x10db1e[_0x2958('0x13')][_0x2958('0x15')]);return _0x56ca85(_0x10db1e['error']['message']);}else{logger[_0x2958('0x16')](_0x2958('0xe'),_0xa385ec,'request\x20sent');_0x56ca85(_0x10db1e[_0x2958('0x17')]['message']);}})['catch'](function(_0x429d42){logger[_0x2958('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0xa385ec,_0x429d42);_0x5ec1b3(_0x429d42);});});}exports['GetFreshsalesAccount']=function(_0x28a92c){var _0x160949=this;return new Promise(function(_0x310d07,_0x42bb99){return db[_0x2958('0x18')]['findAll']({'raw':_0x28a92c[_0x2958('0x19')]?_0x28a92c[_0x2958('0x19')][_0x2958('0x1a')]===undefined?!![]:![]:!![],'where':_0x28a92c['options']?_0x28a92c[_0x2958('0x19')]['where']||null:null,'attributes':_0x28a92c[_0x2958('0x19')]?_0x28a92c['options']['attributes']||null:null,'limit':_0x28a92c[_0x2958('0x19')]?_0x28a92c[_0x2958('0x19')][_0x2958('0x1b')]||null:null,'include':_0x28a92c[_0x2958('0x19')]?_0x28a92c[_0x2958('0x19')][_0x2958('0x1c')]?_[_0x2958('0x1d')](_0x28a92c[_0x2958('0x19')][_0x2958('0x1c')],function(_0x2aa514){return{'model':db[_0x2aa514[_0x2958('0x1e')]],'as':_0x2aa514['as'],'attributes':_0x2aa514[_0x2958('0x1f')],'include':_0x2aa514[_0x2958('0x1c')]?_[_0x2958('0x1d')](_0x2aa514[_0x2958('0x1c')],function(_0x4f811a){return{'model':db[_0x4f811a['model']],'as':_0x4f811a['as'],'attributes':_0x4f811a[_0x2958('0x1f')],'include':_0x4f811a[_0x2958('0x1c')]?_[_0x2958('0x1d')](_0x4f811a[_0x2958('0x1c')],function(_0x52bd32){return{'model':db[_0x52bd32[_0x2958('0x1e')]],'as':_0x52bd32['as'],'attributes':_0x52bd32['attributes']};}):[]};}):[]};}):[]:[]})[_0x2958('0x20')](function(_0x40adce){logger[_0x2958('0x16')](_0x2958('0x21'),_0x28a92c);logger[_0x2958('0xf')](_0x2958('0x21'),_0x28a92c,JSON[_0x2958('0x12')](_0x40adce));_0x310d07(_0x40adce);})['catch'](function(_0x21b919){logger['error']('GetFreshsalesAccount',_0x21b919[_0x2958('0x15')],_0x28a92c);_0x42bb99(_0x160949[_0x2958('0x13')](0x1f4,_0x21b919[_0x2958('0x15')]));});});};exports[_0x2958('0x22')]=function(_0x584179){var _0x2d9472=this;return new Promise(function(_0x222b83,_0x2c73e9){return db['FreshsalesAccount'][_0x2958('0x23')]({'raw':_0x584179[_0x2958('0x19')]?_0x584179['options'][_0x2958('0x1a')]===undefined?!![]:![]:!![],'where':_0x584179['options']?_0x584179[_0x2958('0x19')]['where']||null:null,'attributes':_0x584179[_0x2958('0x19')]?_0x584179['options'][_0x2958('0x1f')]||null:null,'include':_0x584179[_0x2958('0x19')]?_0x584179[_0x2958('0x19')][_0x2958('0x1c')]?_[_0x2958('0x1d')](_0x584179[_0x2958('0x19')][_0x2958('0x1c')],function(_0x58f9b4){return{'model':db[_0x58f9b4[_0x2958('0x1e')]],'as':_0x58f9b4['as'],'attributes':_0x58f9b4['attributes'],'include':_0x58f9b4[_0x2958('0x1c')]?_['map'](_0x58f9b4[_0x2958('0x1c')],function(_0x517f55){return{'model':db[_0x517f55[_0x2958('0x1e')]],'as':_0x517f55['as'],'attributes':_0x517f55[_0x2958('0x1f')],'include':_0x517f55[_0x2958('0x1c')]?_[_0x2958('0x1d')](_0x517f55[_0x2958('0x1c')],function(_0x24aca5){return{'model':db[_0x24aca5[_0x2958('0x1e')]],'as':_0x24aca5['as'],'attributes':_0x24aca5[_0x2958('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x2958('0x20')](function(_0xc4a303){logger[_0x2958('0x16')](_0x2958('0x22'),_0x584179);logger[_0x2958('0xf')]('ShowFreshsalesAccount',_0x584179,JSON[_0x2958('0x12')](_0xc4a303));_0x222b83(_0xc4a303);})[_0x2958('0x24')](function(_0x281817){logger[_0x2958('0x13')]('ShowFreshsalesAccount',_0x281817[_0x2958('0x15')],_0x584179);_0x2c73e9(_0x2d9472[_0x2958('0x13')](0x1f4,_0x281817[_0x2958('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 153acac..7d09e14 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 _0x52a8=['isAuthenticated','index','get','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','create','put','update','exports','multer','path','express','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller'];(function(_0x596921,_0x71146d){var _0x4b3ed0=function(_0x4c591c){while(--_0x4c591c){_0x596921['push'](_0x596921['shift']());}};_0x4b3ed0(++_0x71146d);}(_0x52a8,0x1ee));var _0x852a=function(_0x29c7b0,_0x1b0793){_0x29c7b0=_0x29c7b0-0x0;var _0x2c0b65=_0x52a8[_0x29c7b0];return _0x2c0b65;};'use strict';var multer=require(_0x852a('0x0'));var util=require('util');var path=require(_0x852a('0x1'));var timeout=require('connect-timeout');var express=require(_0x852a('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x852a('0x3'));var config=require(_0x852a('0x4'));var controller=require(_0x852a('0x5'));router['get']('/',auth[_0x852a('0x6')](),controller[_0x852a('0x7')]);router[_0x852a('0x8')](_0x852a('0x9'),auth[_0x852a('0x6')](),controller[_0x852a('0xa')]);router[_0x852a('0x8')](_0x852a('0xb'),auth[_0x852a('0x6')](),controller[_0x852a('0xc')]);router[_0x852a('0x8')](_0x852a('0xd'),auth[_0x852a('0x6')](),controller[_0x852a('0xe')]);router[_0x852a('0x8')](_0x852a('0xf'),auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth[_0x852a('0x6')](),controller[_0x852a('0x10')]);router[_0x852a('0x11')](_0x852a('0x9'),auth['isAuthenticated'](),controller[_0x852a('0x12')]);router['delete'](_0x852a('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x852a('0x13')]=router; \ No newline at end of file +var _0x0fb6=['/:id/subjects','isAuthenticated','getSubjects','getDescriptions','/:id/fields','create','update','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','get','index','/:id','show'];(function(_0x1f16de,_0x548eb9){var _0x36cd80=function(_0x4e1a45){while(--_0x4e1a45){_0x1f16de['push'](_0x1f16de['shift']());}};_0x36cd80(++_0x548eb9);}(_0x0fb6,0x9f));var _0x60fb=function(_0x11387a,_0x9d398e){_0x11387a=_0x11387a-0x0;var _0x54fc5c=_0x0fb6[_0x11387a];return _0x54fc5c;};'use strict';var multer=require(_0x60fb('0x0'));var util=require('util');var path=require(_0x60fb('0x1'));var timeout=require(_0x60fb('0x2'));var express=require('express');var router=express[_0x60fb('0x3')]();var fs_extra=require(_0x60fb('0x4'));var auth=require(_0x60fb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x60fb('0x6'));var controller=require(_0x60fb('0x7'));router[_0x60fb('0x8')]('/',auth['isAuthenticated'](),controller[_0x60fb('0x9')]);router[_0x60fb('0x8')](_0x60fb('0xa'),auth['isAuthenticated'](),controller[_0x60fb('0xb')]);router[_0x60fb('0x8')](_0x60fb('0xc'),auth[_0x60fb('0xd')](),controller[_0x60fb('0xe')]);router[_0x60fb('0x8')]('/:id/descriptions',auth[_0x60fb('0xd')](),controller[_0x60fb('0xf')]);router['get'](_0x60fb('0x10'),auth[_0x60fb('0xd')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller[_0x60fb('0x11')]);router['put'](_0x60fb('0xa'),auth[_0x60fb('0xd')](),controller[_0x60fb('0x12')]);router['delete'](_0x60fb('0xa'),auth[_0x60fb('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 268b167..03256f9 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 _0x0dd6=['sequelize','STRING'];(function(_0x3b3cc6,_0x1a6e24){var _0x1161e4=function(_0x19cc52){while(--_0x19cc52){_0x3b3cc6['push'](_0x3b3cc6['shift']());}};_0x1161e4(++_0x1a6e24);}(_0x0dd6,0x1de));var _0x60dd=function(_0x3216f7,_0x45a5cd){_0x3216f7=_0x3216f7-0x0;var _0x1ea482=_0x0dd6[_0x3216f7];return _0x1ea482;};'use strict';var Sequelize=require(_0x60dd('0x0'));module['exports']={'name':{'type':Sequelize[_0x60dd('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3d17=['sequelize','exports','STRING'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x3d17,0xc9));var _0x73d1=function(_0x413727,_0x17adb1){_0x413727=_0x413727-0x0;var _0x5f46d7=_0x3d17[_0x413727];return _0x5f46d7;};'use strict';var Sequelize=require(_0x73d1('0x0'));module[_0x73d1('0x1')]={'name':{'type':Sequelize[_0x73d1('0x2')]},'description':{'type':Sequelize[_0x73d1('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 57d73e2..d0059ec 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 _0x5b17=['json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','length','find','create','body','getSubjects','FreshsalesField','pick','getDescriptions','findOne','getFields','eml-format','fast-json-patch','request-promise','util','path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x87f102,_0x4a0419){var _0x55049d=function(_0x47f245){while(--_0x47f245){_0x87f102['push'](_0x87f102['shift']());}};_0x55049d(++_0x4a0419);}(_0x5b17,0x1be));var _0x75b1=function(_0x1e651a,_0x4ef85d){_0x1e651a=_0x1e651a-0x0;var _0x266949=_0x5b17[_0x1e651a];return _0x266949;};'use strict';var emlformat=require(_0x75b1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x75b1('0x1'));var rp=require(_0x75b1('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x75b1('0x3'));var path=require(_0x75b1('0x4'));var sox=require(_0x75b1('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x75b1('0x6'));var squel=require('squel');var crypto=require(_0x75b1('0x7'));var jsforce=require(_0x75b1('0x8'));var deskjs=require(_0x75b1('0x9'));var toCsv=require(_0x75b1('0xa'));var querystring=require(_0x75b1('0xb'));var Papa=require(_0x75b1('0xc'));var Redis=require('ioredis');var authService=require(_0x75b1('0xd'));var qs=require(_0x75b1('0xe'));var as=require(_0x75b1('0xf'));var hardwareService=require(_0x75b1('0x10'));var logger=require(_0x75b1('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x75b1('0x12'));var db=require(_0x75b1('0x13'))['db'];function respondWithStatusCode(_0x171c29,_0x225833){_0x225833=_0x225833||0xcc;return function(_0x3bc7b6){if(_0x3bc7b6){return _0x171c29[_0x75b1('0x14')](_0x225833);}return _0x171c29['status'](_0x225833)['end']();};}function respondWithResult(_0x8479b,_0x540d72){_0x540d72=_0x540d72||0xc8;return function(_0x53d1e1){if(_0x53d1e1){return _0x8479b[_0x75b1('0x15')](_0x540d72)[_0x75b1('0x16')](_0x53d1e1);}};}function respondWithFilteredResult(_0x151c4b,_0x39123a){return function(_0x2a3945){if(_0x2a3945){var _0x3c7145=typeof _0x39123a['offset']===_0x75b1('0x17')&&typeof _0x39123a[_0x75b1('0x18')]==='undefined';var _0x5a232b=_0x2a3945[_0x75b1('0x19')];var _0x49b922=_0x3c7145?0x0:_0x39123a[_0x75b1('0x1a')];var _0x365a5e=_0x3c7145?_0x2a3945['count']:_0x39123a['offset']+_0x39123a[_0x75b1('0x18')];var _0x2b6c1a;if(_0x365a5e>=_0x5a232b){_0x365a5e=_0x5a232b;_0x2b6c1a=0xc8;}else{_0x2b6c1a=0xce;}_0x151c4b['status'](_0x2b6c1a);return _0x151c4b[_0x75b1('0x1b')](_0x75b1('0x1c'),_0x49b922+'-'+_0x365a5e+'/'+_0x5a232b)[_0x75b1('0x16')](_0x2a3945);}return null;};}function patchUpdates(_0x1e8b32){return function(_0x50fdee){try{jsonpatch[_0x75b1('0x1d')](_0x50fdee,_0x1e8b32,!![]);}catch(_0x4612f4){return BPromise[_0x75b1('0x1e')](_0x4612f4);}return _0x50fdee[_0x75b1('0x1f')]();};}function saveUpdates(_0x5ed77d,_0xedd0){return function(_0x4b07d6){if(_0x4b07d6){return _0x4b07d6[_0x75b1('0x20')](_0x5ed77d)[_0x75b1('0x21')](function(_0x172aaa){return _0x172aaa;});}return null;};}function removeEntity(_0x5dfcc4,_0x3dfd72){return function(_0x5ca483){if(_0x5ca483){return _0x5ca483[_0x75b1('0x22')]()['then'](function(){_0x5dfcc4[_0x75b1('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5184b4,_0x34d3ac){return function(_0x81cf85){if(!_0x81cf85){_0x5184b4[_0x75b1('0x14')](0x194);}return _0x81cf85;};}function handleError(_0x1f9d2b,_0x313164){_0x313164=_0x313164||0x1f4;return function(_0x2d5991){logger[_0x75b1('0x23')](_0x2d5991[_0x75b1('0x24')]);if(_0x2d5991[_0x75b1('0x25')]){delete _0x2d5991[_0x75b1('0x25')];}_0x1f9d2b['status'](_0x313164)[_0x75b1('0x26')](_0x2d5991);};}exports[_0x75b1('0x27')]=function(_0x23ecad,_0x31c29f){var _0x43931d={},_0x16d967={},_0x2cc6ce={'count':0x0,'rows':[]};var _0x3b2bc3=_['map'](db[_0x75b1('0x28')][_0x75b1('0x29')],function(_0x4bade6){return{'name':_0x4bade6[_0x75b1('0x2a')],'type':_0x4bade6[_0x75b1('0x2b')][_0x75b1('0x2c')]};});_0x16d967[_0x75b1('0x2d')]=_[_0x75b1('0x2e')](_0x3b2bc3,'name');_0x16d967['query']=_[_0x75b1('0x2f')](_0x23ecad[_0x75b1('0x30')]);_0x16d967[_0x75b1('0x31')]=_[_0x75b1('0x32')](_0x16d967[_0x75b1('0x2d')],_0x16d967[_0x75b1('0x30')]);_0x43931d['attributes']=_[_0x75b1('0x32')](_0x16d967[_0x75b1('0x2d')],qs['fields'](_0x23ecad[_0x75b1('0x30')][_0x75b1('0x33')]));_0x43931d[_0x75b1('0x34')]=_0x43931d['attributes']['length']?_0x43931d[_0x75b1('0x34')]:_0x16d967[_0x75b1('0x2d')];if(!_0x23ecad[_0x75b1('0x30')][_0x75b1('0x35')](_0x75b1('0x36'))){_0x43931d[_0x75b1('0x18')]=qs[_0x75b1('0x18')](_0x23ecad[_0x75b1('0x30')][_0x75b1('0x18')]);_0x43931d['offset']=qs[_0x75b1('0x1a')](_0x23ecad[_0x75b1('0x30')]['offset']);}_0x43931d[_0x75b1('0x37')]=qs[_0x75b1('0x38')](_0x23ecad[_0x75b1('0x30')][_0x75b1('0x38')]);_0x43931d[_0x75b1('0x39')]=qs[_0x75b1('0x31')](_['pick'](_0x23ecad[_0x75b1('0x30')],_0x16d967[_0x75b1('0x31')]),_0x3b2bc3);if(_0x23ecad[_0x75b1('0x30')][_0x75b1('0x3a')]){_0x43931d[_0x75b1('0x39')]=_[_0x75b1('0x3b')](_0x43931d[_0x75b1('0x39')],{'$or':_[_0x75b1('0x2e')](_0x3b2bc3,function(_0x15e3ec){if(_0x15e3ec[_0x75b1('0x2b')]!==_0x75b1('0x3c')){var _0x2225f2={};_0x2225f2[_0x15e3ec[_0x75b1('0x25')]]={'$like':'%'+_0x23ecad[_0x75b1('0x30')][_0x75b1('0x3a')]+'%'};return _0x2225f2;}})});}_0x43931d=_[_0x75b1('0x3b')]({},_0x43931d,_0x23ecad[_0x75b1('0x3d')]);var _0x482f98={'where':_0x43931d[_0x75b1('0x39')]};return db['FreshsalesConfiguration'][_0x75b1('0x19')](_0x482f98)[_0x75b1('0x21')](function(_0x46bd6b){_0x2cc6ce[_0x75b1('0x19')]=_0x46bd6b;if(_0x23ecad[_0x75b1('0x30')]['includeAll']){_0x43931d[_0x75b1('0x3e')]=[{'all':!![]}];}return db[_0x75b1('0x28')][_0x75b1('0x3f')](_0x43931d);})[_0x75b1('0x21')](function(_0x23211d){_0x2cc6ce[_0x75b1('0x40')]=_0x23211d;return _0x2cc6ce;})['then'](respondWithFilteredResult(_0x31c29f,_0x43931d))[_0x75b1('0x41')](handleError(_0x31c29f,null));};exports[_0x75b1('0x42')]=function(_0xfc5724,_0x2a6905){var _0xcc1b9a={'raw':![],'where':{'id':_0xfc5724[_0x75b1('0x43')]['id']}},_0xaf18b6={};_0xaf18b6[_0x75b1('0x2d')]=_['keys'](db[_0x75b1('0x28')][_0x75b1('0x29')]);_0xaf18b6['query']=_[_0x75b1('0x2f')](_0xfc5724[_0x75b1('0x30')]);_0xaf18b6[_0x75b1('0x31')]=_[_0x75b1('0x32')](_0xaf18b6[_0x75b1('0x2d')],_0xaf18b6['query']);_0xcc1b9a[_0x75b1('0x34')]=_[_0x75b1('0x32')](_0xaf18b6[_0x75b1('0x2d')],qs[_0x75b1('0x33')](_0xfc5724[_0x75b1('0x30')][_0x75b1('0x33')]));_0xcc1b9a[_0x75b1('0x34')]=_0xcc1b9a[_0x75b1('0x34')][_0x75b1('0x44')]?_0xcc1b9a['attributes']:_0xaf18b6[_0x75b1('0x2d')];if(_0xfc5724[_0x75b1('0x30')]['includeAll']){_0xcc1b9a['include']=[{'all':!![]}];}_0xcc1b9a=_[_0x75b1('0x3b')]({},_0xcc1b9a,_0xfc5724['options']);return db[_0x75b1('0x28')][_0x75b1('0x45')](_0xcc1b9a)[_0x75b1('0x21')](handleEntityNotFound(_0x2a6905,null))[_0x75b1('0x21')](respondWithResult(_0x2a6905,null))[_0x75b1('0x41')](handleError(_0x2a6905,null));};exports[_0x75b1('0x46')]=function(_0x1d5cf5,_0x4ff846){return db['FreshsalesConfiguration'][_0x75b1('0x46')](_0x1d5cf5[_0x75b1('0x47')],{})[_0x75b1('0x21')](respondWithResult(_0x4ff846,0xc9))[_0x75b1('0x41')](handleError(_0x4ff846,null));};exports[_0x75b1('0x20')]=function(_0x21c5e,_0x58c779){if(_0x21c5e['body']['id']){delete _0x21c5e[_0x75b1('0x47')]['id'];}return db[_0x75b1('0x28')]['find']({'where':{'id':_0x21c5e[_0x75b1('0x43')]['id']}})[_0x75b1('0x21')](handleEntityNotFound(_0x58c779,null))[_0x75b1('0x21')](saveUpdates(_0x21c5e[_0x75b1('0x47')],null))['then'](respondWithResult(_0x58c779,null))['catch'](handleError(_0x58c779,null));};exports[_0x75b1('0x22')]=function(_0x1095e1,_0x187d97){return db[_0x75b1('0x28')][_0x75b1('0x45')]({'where':{'id':_0x1095e1[_0x75b1('0x43')]['id']}})['then'](handleEntityNotFound(_0x187d97,null))[_0x75b1('0x21')](removeEntity(_0x187d97,null))[_0x75b1('0x41')](handleError(_0x187d97,null));};exports[_0x75b1('0x48')]=function(_0x18d4f4,_0x53571b,_0x4f8f02){var _0x2a17e4={};var _0x32a360={};var _0x3e814d;var _0x303c9f;return db[_0x75b1('0x28')]['findOne']({'where':{'id':_0x18d4f4[_0x75b1('0x43')]['id']}})[_0x75b1('0x21')](handleEntityNotFound(_0x53571b,null))[_0x75b1('0x21')](function(_0x329767){if(_0x329767){_0x3e814d=_0x329767;_0x32a360[_0x75b1('0x2d')]=_[_0x75b1('0x2f')](db[_0x75b1('0x49')][_0x75b1('0x29')]);_0x32a360[_0x75b1('0x30')]=_['keys'](_0x18d4f4[_0x75b1('0x30')]);_0x32a360['filters']=_[_0x75b1('0x32')](_0x32a360[_0x75b1('0x2d')],_0x32a360['query']);_0x2a17e4[_0x75b1('0x34')]=_[_0x75b1('0x32')](_0x32a360[_0x75b1('0x2d')],qs[_0x75b1('0x33')](_0x18d4f4[_0x75b1('0x30')][_0x75b1('0x33')]));_0x2a17e4[_0x75b1('0x34')]=_0x2a17e4[_0x75b1('0x34')][_0x75b1('0x44')]?_0x2a17e4[_0x75b1('0x34')]:_0x32a360[_0x75b1('0x2d')];_0x2a17e4[_0x75b1('0x37')]=qs[_0x75b1('0x38')](_0x18d4f4[_0x75b1('0x30')][_0x75b1('0x38')]);_0x2a17e4[_0x75b1('0x39')]=qs[_0x75b1('0x31')](_[_0x75b1('0x4a')](_0x18d4f4[_0x75b1('0x30')],_0x32a360[_0x75b1('0x31')]));if(_0x18d4f4[_0x75b1('0x30')][_0x75b1('0x3a')]){_0x2a17e4[_0x75b1('0x39')]=_[_0x75b1('0x3b')](_0x2a17e4[_0x75b1('0x39')],{'$or':_[_0x75b1('0x2e')](_0x2a17e4['attributes'],function(_0x3303cb){var _0x23cb05={};_0x23cb05[_0x3303cb]={'$like':'%'+_0x18d4f4[_0x75b1('0x30')]['filter']+'%'};return _0x23cb05;})});}_0x2a17e4=_[_0x75b1('0x3b')]({},_0x2a17e4,_0x18d4f4[_0x75b1('0x3d')]);return _0x3e814d[_0x75b1('0x48')](_0x2a17e4);}})[_0x75b1('0x21')](function(_0x15dcbf){if(_0x15dcbf){_0x303c9f=_0x15dcbf[_0x75b1('0x44')];if(!_0x18d4f4[_0x75b1('0x30')][_0x75b1('0x35')](_0x75b1('0x36'))){_0x2a17e4[_0x75b1('0x18')]=qs[_0x75b1('0x18')](_0x18d4f4[_0x75b1('0x30')][_0x75b1('0x18')]);_0x2a17e4['offset']=qs[_0x75b1('0x1a')](_0x18d4f4[_0x75b1('0x30')][_0x75b1('0x1a')]);}return _0x3e814d[_0x75b1('0x48')](_0x2a17e4);}})[_0x75b1('0x21')](function(_0xb3d669){if(_0xb3d669){return _0xb3d669?{'count':_0x303c9f,'rows':_0xb3d669}:null;}})[_0x75b1('0x21')](respondWithResult(_0x53571b,null))[_0x75b1('0x41')](handleError(_0x53571b,null));};exports[_0x75b1('0x4b')]=function(_0x10a9a7,_0x284d46,_0x13dfd7){var _0x516ee4={};var _0x43c957={};var _0x4ee993;var _0x28bd14;return db[_0x75b1('0x28')][_0x75b1('0x4c')]({'where':{'id':_0x10a9a7[_0x75b1('0x43')]['id']}})[_0x75b1('0x21')](handleEntityNotFound(_0x284d46,null))[_0x75b1('0x21')](function(_0x13f33a){if(_0x13f33a){_0x4ee993=_0x13f33a;_0x43c957[_0x75b1('0x2d')]=_[_0x75b1('0x2f')](db['FreshsalesField'][_0x75b1('0x29')]);_0x43c957['query']=_[_0x75b1('0x2f')](_0x10a9a7['query']);_0x43c957[_0x75b1('0x31')]=_[_0x75b1('0x32')](_0x43c957[_0x75b1('0x2d')],_0x43c957[_0x75b1('0x30')]);_0x516ee4[_0x75b1('0x34')]=_['intersection'](_0x43c957[_0x75b1('0x2d')],qs['fields'](_0x10a9a7[_0x75b1('0x30')][_0x75b1('0x33')]));_0x516ee4[_0x75b1('0x34')]=_0x516ee4[_0x75b1('0x34')][_0x75b1('0x44')]?_0x516ee4[_0x75b1('0x34')]:_0x43c957[_0x75b1('0x2d')];_0x516ee4['order']=qs[_0x75b1('0x38')](_0x10a9a7[_0x75b1('0x30')][_0x75b1('0x38')]);_0x516ee4[_0x75b1('0x39')]=qs[_0x75b1('0x31')](_[_0x75b1('0x4a')](_0x10a9a7[_0x75b1('0x30')],_0x43c957[_0x75b1('0x31')]));if(_0x10a9a7[_0x75b1('0x30')][_0x75b1('0x3a')]){_0x516ee4['where']=_[_0x75b1('0x3b')](_0x516ee4[_0x75b1('0x39')],{'$or':_[_0x75b1('0x2e')](_0x516ee4['attributes'],function(_0x32224e){var _0x2ab494={};_0x2ab494[_0x32224e]={'$like':'%'+_0x10a9a7[_0x75b1('0x30')][_0x75b1('0x3a')]+'%'};return _0x2ab494;})});}_0x516ee4=_[_0x75b1('0x3b')]({},_0x516ee4,_0x10a9a7[_0x75b1('0x3d')]);return _0x4ee993[_0x75b1('0x4b')](_0x516ee4);}})[_0x75b1('0x21')](function(_0x51b3ee){if(_0x51b3ee){_0x28bd14=_0x51b3ee[_0x75b1('0x44')];if(!_0x10a9a7[_0x75b1('0x30')][_0x75b1('0x35')](_0x75b1('0x36'))){_0x516ee4[_0x75b1('0x18')]=qs[_0x75b1('0x18')](_0x10a9a7[_0x75b1('0x30')]['limit']);_0x516ee4[_0x75b1('0x1a')]=qs[_0x75b1('0x1a')](_0x10a9a7[_0x75b1('0x30')][_0x75b1('0x1a')]);}return _0x4ee993[_0x75b1('0x4b')](_0x516ee4);}})[_0x75b1('0x21')](function(_0x25d688){if(_0x25d688){return _0x25d688?{'count':_0x28bd14,'rows':_0x25d688}:null;}})[_0x75b1('0x21')](respondWithResult(_0x284d46,null))[_0x75b1('0x41')](handleError(_0x284d46,null));};exports['getFields']=function(_0x4f01d3,_0x2290f8,_0x1c7215){var _0x355878={};var _0x3b6fea={};var _0x2f5d0c;var _0x9d74d9;return db[_0x75b1('0x28')]['findOne']({'where':{'id':_0x4f01d3[_0x75b1('0x43')]['id']}})[_0x75b1('0x21')](handleEntityNotFound(_0x2290f8,null))[_0x75b1('0x21')](function(_0x175570){if(_0x175570){_0x2f5d0c=_0x175570;_0x3b6fea['model']=_[_0x75b1('0x2f')](db[_0x75b1('0x49')][_0x75b1('0x29')]);_0x3b6fea[_0x75b1('0x30')]=_[_0x75b1('0x2f')](_0x4f01d3[_0x75b1('0x30')]);_0x3b6fea[_0x75b1('0x31')]=_[_0x75b1('0x32')](_0x3b6fea['model'],_0x3b6fea['query']);_0x355878[_0x75b1('0x34')]=_['intersection'](_0x3b6fea[_0x75b1('0x2d')],qs[_0x75b1('0x33')](_0x4f01d3[_0x75b1('0x30')][_0x75b1('0x33')]));_0x355878['attributes']=_0x355878[_0x75b1('0x34')]['length']?_0x355878[_0x75b1('0x34')]:_0x3b6fea[_0x75b1('0x2d')];_0x355878[_0x75b1('0x37')]=qs[_0x75b1('0x38')](_0x4f01d3[_0x75b1('0x30')]['sort']);_0x355878[_0x75b1('0x39')]=qs[_0x75b1('0x31')](_['pick'](_0x4f01d3[_0x75b1('0x30')],_0x3b6fea[_0x75b1('0x31')]));if(_0x4f01d3[_0x75b1('0x30')][_0x75b1('0x3a')]){_0x355878[_0x75b1('0x39')]=_['merge'](_0x355878[_0x75b1('0x39')],{'$or':_['map'](_0x355878[_0x75b1('0x34')],function(_0x3b7426){var _0x1e6bdf={};_0x1e6bdf[_0x3b7426]={'$like':'%'+_0x4f01d3[_0x75b1('0x30')][_0x75b1('0x3a')]+'%'};return _0x1e6bdf;})});}_0x355878=_[_0x75b1('0x3b')]({},_0x355878,_0x4f01d3[_0x75b1('0x3d')]);return _0x2f5d0c[_0x75b1('0x4d')](_0x355878);}})['then'](function(_0x6bd58a){if(_0x6bd58a){_0x9d74d9=_0x6bd58a[_0x75b1('0x44')];if(!_0x4f01d3[_0x75b1('0x30')][_0x75b1('0x35')](_0x75b1('0x36'))){_0x355878[_0x75b1('0x18')]=qs['limit'](_0x4f01d3[_0x75b1('0x30')][_0x75b1('0x18')]);_0x355878['offset']=qs[_0x75b1('0x1a')](_0x4f01d3[_0x75b1('0x30')][_0x75b1('0x1a')]);}return _0x2f5d0c[_0x75b1('0x4d')](_0x355878);}})[_0x75b1('0x21')](function(_0x3887c5){if(_0x3887c5){return _0x3887c5?{'count':_0x9d74d9,'rows':_0x3887c5}:null;}})[_0x75b1('0x21')](respondWithResult(_0x2290f8,null))[_0x75b1('0x41')](handleError(_0x2290f8,null));}; \ No newline at end of file +var _0x68bb=['squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','set','Content-Range','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','type','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','show','params','create','body','find','getSubjects','findOne','FreshsalesField','length','pick','getDescriptions','getFields','eml-format','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x4df238,_0x1b6ea2){var _0x33a9a9=function(_0x36520e){while(--_0x36520e){_0x4df238['push'](_0x4df238['shift']());}};_0x33a9a9(++_0x1b6ea2);}(_0x68bb,0x1d6));var _0xb68b=function(_0x5a583b,_0x4af265){_0x5a583b=_0x5a583b-0x0;var _0x484a2d=_0x68bb[_0x5a583b];return _0x484a2d;};'use strict';var emlformat=require(_0xb68b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb68b('0x1'));var moment=require(_0xb68b('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xb68b('0x3'));var util=require('util');var path=require(_0xb68b('0x4'));var sox=require(_0xb68b('0x5'));var csv=require(_0xb68b('0x6'));var ejs=require(_0xb68b('0x7'));var fs=require('fs');var fs_extra=require(_0xb68b('0x8'));var _=require(_0xb68b('0x9'));var squel=require(_0xb68b('0xa'));var crypto=require(_0xb68b('0xb'));var jsforce=require(_0xb68b('0xc'));var deskjs=require(_0xb68b('0xd'));var toCsv=require(_0xb68b('0x6'));var querystring=require(_0xb68b('0xe'));var Papa=require('papaparse');var Redis=require(_0xb68b('0xf'));var authService=require(_0xb68b('0x10'));var qs=require(_0xb68b('0x11'));var as=require(_0xb68b('0x12'));var hardwareService=require(_0xb68b('0x13'));var logger=require(_0xb68b('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xb68b('0x15'));var licenseUtil=require(_0xb68b('0x16'));var db=require(_0xb68b('0x17'))['db'];function respondWithStatusCode(_0x5d1450,_0x395f42){_0x395f42=_0x395f42||0xcc;return function(_0x21e1c1){if(_0x21e1c1){return _0x5d1450['sendStatus'](_0x395f42);}return _0x5d1450[_0xb68b('0x18')](_0x395f42)[_0xb68b('0x19')]();};}function respondWithResult(_0x964e03,_0x10ab2a){_0x10ab2a=_0x10ab2a||0xc8;return function(_0x49cd94){if(_0x49cd94){return _0x964e03[_0xb68b('0x18')](_0x10ab2a)[_0xb68b('0x1a')](_0x49cd94);}};}function respondWithFilteredResult(_0x3d559e,_0x21b059){return function(_0x55271a){if(_0x55271a){var _0x5e7a6b=typeof _0x21b059[_0xb68b('0x1b')]==='undefined'&&typeof _0x21b059['limit']===_0xb68b('0x1c');var _0x14e2e1=_0x55271a['count'];var _0x1c84d2=_0x5e7a6b?0x0:_0x21b059['offset'];var _0x111895=_0x5e7a6b?_0x55271a['count']:_0x21b059[_0xb68b('0x1b')]+_0x21b059[_0xb68b('0x1d')];var _0x3c78cf;if(_0x111895>=_0x14e2e1){_0x111895=_0x14e2e1;_0x3c78cf=0xc8;}else{_0x3c78cf=0xce;}_0x3d559e[_0xb68b('0x18')](_0x3c78cf);return _0x3d559e[_0xb68b('0x1e')](_0xb68b('0x1f'),_0x1c84d2+'-'+_0x111895+'/'+_0x14e2e1)[_0xb68b('0x1a')](_0x55271a);}return null;};}function patchUpdates(_0x5631c6){return function(_0x354c32){try{jsonpatch['apply'](_0x354c32,_0x5631c6,!![]);}catch(_0x1eebf1){return BPromise[_0xb68b('0x20')](_0x1eebf1);}return _0x354c32[_0xb68b('0x21')]();};}function saveUpdates(_0x282a11,_0x5f3f75){return function(_0x442632){if(_0x442632){return _0x442632[_0xb68b('0x22')](_0x282a11)[_0xb68b('0x23')](function(_0x3f5f95){return _0x3f5f95;});}return null;};}function removeEntity(_0x95aa65,_0x57fffe){return function(_0x253af4){if(_0x253af4){return _0x253af4[_0xb68b('0x24')]()[_0xb68b('0x23')](function(){_0x95aa65[_0xb68b('0x18')](0xcc)[_0xb68b('0x19')]();});}};}function handleEntityNotFound(_0x3b273d,_0x4c9bde){return function(_0x16225c){if(!_0x16225c){_0x3b273d[_0xb68b('0x25')](0x194);}return _0x16225c;};}function handleError(_0x1f6d45,_0x1cb77c){_0x1cb77c=_0x1cb77c||0x1f4;return function(_0x1739ae){logger['error'](_0x1739ae[_0xb68b('0x26')]);if(_0x1739ae[_0xb68b('0x27')]){delete _0x1739ae['name'];}_0x1f6d45[_0xb68b('0x18')](_0x1cb77c)[_0xb68b('0x28')](_0x1739ae);};}exports[_0xb68b('0x29')]=function(_0x22648a,_0x363982){var _0x1aaaab={},_0x4142fe={},_0x4b053d={'count':0x0,'rows':[]};var _0x1e646e=_[_0xb68b('0x2a')](db[_0xb68b('0x2b')][_0xb68b('0x2c')],function(_0x53601b){return{'name':_0x53601b['fieldName'],'type':_0x53601b['type']['key']};});_0x4142fe[_0xb68b('0x2d')]=_['map'](_0x1e646e,_0xb68b('0x27'));_0x4142fe[_0xb68b('0x2e')]=_[_0xb68b('0x2f')](_0x22648a[_0xb68b('0x2e')]);_0x4142fe['filters']=_[_0xb68b('0x30')](_0x4142fe[_0xb68b('0x2d')],_0x4142fe[_0xb68b('0x2e')]);_0x1aaaab[_0xb68b('0x31')]=_['intersection'](_0x4142fe['model'],qs[_0xb68b('0x32')](_0x22648a[_0xb68b('0x2e')]['fields']));_0x1aaaab[_0xb68b('0x31')]=_0x1aaaab[_0xb68b('0x31')]['length']?_0x1aaaab[_0xb68b('0x31')]:_0x4142fe['model'];if(!_0x22648a[_0xb68b('0x2e')][_0xb68b('0x33')](_0xb68b('0x34'))){_0x1aaaab['limit']=qs[_0xb68b('0x1d')](_0x22648a['query'][_0xb68b('0x1d')]);_0x1aaaab[_0xb68b('0x1b')]=qs[_0xb68b('0x1b')](_0x22648a[_0xb68b('0x2e')][_0xb68b('0x1b')]);}_0x1aaaab[_0xb68b('0x35')]=qs[_0xb68b('0x36')](_0x22648a['query'][_0xb68b('0x36')]);_0x1aaaab[_0xb68b('0x37')]=qs[_0xb68b('0x38')](_['pick'](_0x22648a[_0xb68b('0x2e')],_0x4142fe['filters']),_0x1e646e);if(_0x22648a[_0xb68b('0x2e')][_0xb68b('0x39')]){_0x1aaaab[_0xb68b('0x37')]=_['merge'](_0x1aaaab[_0xb68b('0x37')],{'$or':_[_0xb68b('0x2a')](_0x1e646e,function(_0x15133a){if(_0x15133a[_0xb68b('0x3a')]!==_0xb68b('0x3b')){var _0x29985b={};_0x29985b[_0x15133a['name']]={'$like':'%'+_0x22648a[_0xb68b('0x2e')][_0xb68b('0x39')]+'%'};return _0x29985b;}})});}_0x1aaaab=_[_0xb68b('0x3c')]({},_0x1aaaab,_0x22648a[_0xb68b('0x3d')]);var _0x42bd58={'where':_0x1aaaab[_0xb68b('0x37')]};return db[_0xb68b('0x2b')][_0xb68b('0x3e')](_0x42bd58)['then'](function(_0x3aff0d){_0x4b053d[_0xb68b('0x3e')]=_0x3aff0d;if(_0x22648a[_0xb68b('0x2e')][_0xb68b('0x3f')]){_0x1aaaab[_0xb68b('0x40')]=[{'all':!![]}];}return db[_0xb68b('0x2b')][_0xb68b('0x41')](_0x1aaaab);})[_0xb68b('0x23')](function(_0x4202e4){_0x4b053d[_0xb68b('0x42')]=_0x4202e4;return _0x4b053d;})['then'](respondWithFilteredResult(_0x363982,_0x1aaaab))[_0xb68b('0x43')](handleError(_0x363982,null));};exports[_0xb68b('0x44')]=function(_0x485471,_0x14d146){var _0x162ca5={'raw':![],'where':{'id':_0x485471[_0xb68b('0x45')]['id']}},_0x18587d={};_0x18587d[_0xb68b('0x2d')]=_[_0xb68b('0x2f')](db['FreshsalesConfiguration'][_0xb68b('0x2c')]);_0x18587d['query']=_['keys'](_0x485471[_0xb68b('0x2e')]);_0x18587d['filters']=_['intersection'](_0x18587d[_0xb68b('0x2d')],_0x18587d[_0xb68b('0x2e')]);_0x162ca5[_0xb68b('0x31')]=_[_0xb68b('0x30')](_0x18587d['model'],qs[_0xb68b('0x32')](_0x485471[_0xb68b('0x2e')][_0xb68b('0x32')]));_0x162ca5[_0xb68b('0x31')]=_0x162ca5[_0xb68b('0x31')]['length']?_0x162ca5[_0xb68b('0x31')]:_0x18587d['model'];if(_0x485471[_0xb68b('0x2e')][_0xb68b('0x3f')]){_0x162ca5['include']=[{'all':!![]}];}_0x162ca5=_[_0xb68b('0x3c')]({},_0x162ca5,_0x485471['options']);return db[_0xb68b('0x2b')]['find'](_0x162ca5)[_0xb68b('0x23')](handleEntityNotFound(_0x14d146,null))[_0xb68b('0x23')](respondWithResult(_0x14d146,null))[_0xb68b('0x43')](handleError(_0x14d146,null));};exports[_0xb68b('0x46')]=function(_0x2e9b8e,_0x1ba8f6){return db[_0xb68b('0x2b')]['create'](_0x2e9b8e[_0xb68b('0x47')],{})[_0xb68b('0x23')](respondWithResult(_0x1ba8f6,0xc9))[_0xb68b('0x43')](handleError(_0x1ba8f6,null));};exports[_0xb68b('0x22')]=function(_0x2c8d3c,_0x2b7394){if(_0x2c8d3c[_0xb68b('0x47')]['id']){delete _0x2c8d3c[_0xb68b('0x47')]['id'];}return db[_0xb68b('0x2b')][_0xb68b('0x48')]({'where':{'id':_0x2c8d3c[_0xb68b('0x45')]['id']}})[_0xb68b('0x23')](handleEntityNotFound(_0x2b7394,null))[_0xb68b('0x23')](saveUpdates(_0x2c8d3c[_0xb68b('0x47')],null))[_0xb68b('0x23')](respondWithResult(_0x2b7394,null))[_0xb68b('0x43')](handleError(_0x2b7394,null));};exports[_0xb68b('0x24')]=function(_0xfb9562,_0x5ecbf2){return db['FreshsalesConfiguration']['find']({'where':{'id':_0xfb9562[_0xb68b('0x45')]['id']}})[_0xb68b('0x23')](handleEntityNotFound(_0x5ecbf2,null))[_0xb68b('0x23')](removeEntity(_0x5ecbf2,null))[_0xb68b('0x43')](handleError(_0x5ecbf2,null));};exports[_0xb68b('0x49')]=function(_0x2ae48b,_0x58fe74,_0x2d4fd8){var _0xe86248={};var _0x54a4d1={};var _0x1a1bf2;var _0x530472;return db[_0xb68b('0x2b')][_0xb68b('0x4a')]({'where':{'id':_0x2ae48b['params']['id']}})['then'](handleEntityNotFound(_0x58fe74,null))['then'](function(_0x5638fc){if(_0x5638fc){_0x1a1bf2=_0x5638fc;_0x54a4d1[_0xb68b('0x2d')]=_[_0xb68b('0x2f')](db[_0xb68b('0x4b')][_0xb68b('0x2c')]);_0x54a4d1[_0xb68b('0x2e')]=_[_0xb68b('0x2f')](_0x2ae48b[_0xb68b('0x2e')]);_0x54a4d1['filters']=_[_0xb68b('0x30')](_0x54a4d1[_0xb68b('0x2d')],_0x54a4d1[_0xb68b('0x2e')]);_0xe86248[_0xb68b('0x31')]=_[_0xb68b('0x30')](_0x54a4d1[_0xb68b('0x2d')],qs[_0xb68b('0x32')](_0x2ae48b[_0xb68b('0x2e')]['fields']));_0xe86248[_0xb68b('0x31')]=_0xe86248[_0xb68b('0x31')][_0xb68b('0x4c')]?_0xe86248['attributes']:_0x54a4d1['model'];_0xe86248[_0xb68b('0x35')]=qs['sort'](_0x2ae48b[_0xb68b('0x2e')]['sort']);_0xe86248['where']=qs[_0xb68b('0x38')](_[_0xb68b('0x4d')](_0x2ae48b[_0xb68b('0x2e')],_0x54a4d1[_0xb68b('0x38')]));if(_0x2ae48b[_0xb68b('0x2e')]['filter']){_0xe86248['where']=_[_0xb68b('0x3c')](_0xe86248['where'],{'$or':_['map'](_0xe86248[_0xb68b('0x31')],function(_0x3bea8f){var _0x32fbf1={};_0x32fbf1[_0x3bea8f]={'$like':'%'+_0x2ae48b[_0xb68b('0x2e')]['filter']+'%'};return _0x32fbf1;})});}_0xe86248=_[_0xb68b('0x3c')]({},_0xe86248,_0x2ae48b[_0xb68b('0x3d')]);return _0x1a1bf2[_0xb68b('0x49')](_0xe86248);}})[_0xb68b('0x23')](function(_0x5c33a3){if(_0x5c33a3){_0x530472=_0x5c33a3[_0xb68b('0x4c')];if(!_0x2ae48b[_0xb68b('0x2e')][_0xb68b('0x33')]('nolimit')){_0xe86248[_0xb68b('0x1d')]=qs[_0xb68b('0x1d')](_0x2ae48b['query'][_0xb68b('0x1d')]);_0xe86248[_0xb68b('0x1b')]=qs[_0xb68b('0x1b')](_0x2ae48b[_0xb68b('0x2e')][_0xb68b('0x1b')]);}return _0x1a1bf2['getSubjects'](_0xe86248);}})[_0xb68b('0x23')](function(_0x53a385){if(_0x53a385){return _0x53a385?{'count':_0x530472,'rows':_0x53a385}:null;}})[_0xb68b('0x23')](respondWithResult(_0x58fe74,null))['catch'](handleError(_0x58fe74,null));};exports[_0xb68b('0x4e')]=function(_0x16a32c,_0x5e94ba,_0x5a8e01){var _0x2c6bc8={};var _0x1d6eea={};var _0x140f44;var _0x2d67ca;return db[_0xb68b('0x2b')][_0xb68b('0x4a')]({'where':{'id':_0x16a32c[_0xb68b('0x45')]['id']}})[_0xb68b('0x23')](handleEntityNotFound(_0x5e94ba,null))['then'](function(_0x4f87c1){if(_0x4f87c1){_0x140f44=_0x4f87c1;_0x1d6eea['model']=_[_0xb68b('0x2f')](db[_0xb68b('0x4b')][_0xb68b('0x2c')]);_0x1d6eea[_0xb68b('0x2e')]=_[_0xb68b('0x2f')](_0x16a32c[_0xb68b('0x2e')]);_0x1d6eea[_0xb68b('0x38')]=_['intersection'](_0x1d6eea[_0xb68b('0x2d')],_0x1d6eea[_0xb68b('0x2e')]);_0x2c6bc8[_0xb68b('0x31')]=_[_0xb68b('0x30')](_0x1d6eea['model'],qs[_0xb68b('0x32')](_0x16a32c['query'][_0xb68b('0x32')]));_0x2c6bc8[_0xb68b('0x31')]=_0x2c6bc8[_0xb68b('0x31')][_0xb68b('0x4c')]?_0x2c6bc8[_0xb68b('0x31')]:_0x1d6eea[_0xb68b('0x2d')];_0x2c6bc8['order']=qs[_0xb68b('0x36')](_0x16a32c[_0xb68b('0x2e')][_0xb68b('0x36')]);_0x2c6bc8['where']=qs['filters'](_[_0xb68b('0x4d')](_0x16a32c[_0xb68b('0x2e')],_0x1d6eea[_0xb68b('0x38')]));if(_0x16a32c[_0xb68b('0x2e')][_0xb68b('0x39')]){_0x2c6bc8['where']=_[_0xb68b('0x3c')](_0x2c6bc8[_0xb68b('0x37')],{'$or':_[_0xb68b('0x2a')](_0x2c6bc8[_0xb68b('0x31')],function(_0xf8ae6e){var _0x4987f2={};_0x4987f2[_0xf8ae6e]={'$like':'%'+_0x16a32c[_0xb68b('0x2e')][_0xb68b('0x39')]+'%'};return _0x4987f2;})});}_0x2c6bc8=_[_0xb68b('0x3c')]({},_0x2c6bc8,_0x16a32c[_0xb68b('0x3d')]);return _0x140f44['getDescriptions'](_0x2c6bc8);}})[_0xb68b('0x23')](function(_0x4eaa6a){if(_0x4eaa6a){_0x2d67ca=_0x4eaa6a[_0xb68b('0x4c')];if(!_0x16a32c[_0xb68b('0x2e')][_0xb68b('0x33')]('nolimit')){_0x2c6bc8[_0xb68b('0x1d')]=qs['limit'](_0x16a32c[_0xb68b('0x2e')][_0xb68b('0x1d')]);_0x2c6bc8['offset']=qs[_0xb68b('0x1b')](_0x16a32c[_0xb68b('0x2e')][_0xb68b('0x1b')]);}return _0x140f44[_0xb68b('0x4e')](_0x2c6bc8);}})[_0xb68b('0x23')](function(_0x2476fc){if(_0x2476fc){return _0x2476fc?{'count':_0x2d67ca,'rows':_0x2476fc}:null;}})['then'](respondWithResult(_0x5e94ba,null))[_0xb68b('0x43')](handleError(_0x5e94ba,null));};exports[_0xb68b('0x4f')]=function(_0xa0d35,_0x3f2f44,_0xeb514c){var _0xba5897={};var _0x12a44e={};var _0x359765;var _0x13ecc3;return db[_0xb68b('0x2b')][_0xb68b('0x4a')]({'where':{'id':_0xa0d35[_0xb68b('0x45')]['id']}})[_0xb68b('0x23')](handleEntityNotFound(_0x3f2f44,null))[_0xb68b('0x23')](function(_0x4745ec){if(_0x4745ec){_0x359765=_0x4745ec;_0x12a44e[_0xb68b('0x2d')]=_[_0xb68b('0x2f')](db[_0xb68b('0x4b')][_0xb68b('0x2c')]);_0x12a44e['query']=_['keys'](_0xa0d35['query']);_0x12a44e[_0xb68b('0x38')]=_[_0xb68b('0x30')](_0x12a44e['model'],_0x12a44e[_0xb68b('0x2e')]);_0xba5897[_0xb68b('0x31')]=_['intersection'](_0x12a44e[_0xb68b('0x2d')],qs[_0xb68b('0x32')](_0xa0d35[_0xb68b('0x2e')][_0xb68b('0x32')]));_0xba5897['attributes']=_0xba5897['attributes'][_0xb68b('0x4c')]?_0xba5897[_0xb68b('0x31')]:_0x12a44e[_0xb68b('0x2d')];_0xba5897['order']=qs[_0xb68b('0x36')](_0xa0d35[_0xb68b('0x2e')][_0xb68b('0x36')]);_0xba5897['where']=qs[_0xb68b('0x38')](_[_0xb68b('0x4d')](_0xa0d35[_0xb68b('0x2e')],_0x12a44e[_0xb68b('0x38')]));if(_0xa0d35['query'][_0xb68b('0x39')]){_0xba5897[_0xb68b('0x37')]=_['merge'](_0xba5897[_0xb68b('0x37')],{'$or':_[_0xb68b('0x2a')](_0xba5897[_0xb68b('0x31')],function(_0x537447){var _0xddd7ba={};_0xddd7ba[_0x537447]={'$like':'%'+_0xa0d35[_0xb68b('0x2e')][_0xb68b('0x39')]+'%'};return _0xddd7ba;})});}_0xba5897=_['merge']({},_0xba5897,_0xa0d35[_0xb68b('0x3d')]);return _0x359765['getFields'](_0xba5897);}})[_0xb68b('0x23')](function(_0x5d9182){if(_0x5d9182){_0x13ecc3=_0x5d9182[_0xb68b('0x4c')];if(!_0xa0d35[_0xb68b('0x2e')][_0xb68b('0x33')](_0xb68b('0x34'))){_0xba5897[_0xb68b('0x1d')]=qs[_0xb68b('0x1d')](_0xa0d35[_0xb68b('0x2e')]['limit']);_0xba5897[_0xb68b('0x1b')]=qs[_0xb68b('0x1b')](_0xa0d35[_0xb68b('0x2e')][_0xb68b('0x1b')]);}return _0x359765[_0xb68b('0x4f')](_0xba5897);}})['then'](function(_0x4c8d48){if(_0x4c8d48){return _0x4c8d48?{'count':_0x13ecc3,'rows':_0x4c8d48}:null;}})[_0xb68b('0x23')](respondWithResult(_0x3f2f44,null))[_0xb68b('0x43')](handleError(_0x3f2f44,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 2757ad8..4536261 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 _0x2add=['FreshsalesConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intFreshsalesConfiguration.attributes','exports','define'];(function(_0x2f5677,_0x570730){var _0x1f4c72=function(_0x2feffa){while(--_0x2feffa){_0x2f5677['push'](_0x2f5677['shift']());}};_0x1f4c72(++_0x570730);}(_0x2add,0xeb));var _0xd2ad=function(_0x3d7da2,_0x46f1ff){_0x3d7da2=_0x3d7da2-0x0;var _0x3bf4c7=_0x2add[_0x3d7da2];return _0x3bf4c7;};'use strict';var _=require(_0xd2ad('0x0'));var util=require(_0xd2ad('0x1'));var logger=require(_0xd2ad('0x2'))(_0xd2ad('0x3'));var moment=require(_0xd2ad('0x4'));var BPromise=require(_0xd2ad('0x5'));var rp=require(_0xd2ad('0x6'));var fs=require('fs');var path=require(_0xd2ad('0x7'));var rimraf=require(_0xd2ad('0x8'));var config=require('../../config/environment');var attributes=require(_0xd2ad('0x9'));module[_0xd2ad('0xa')]=function(_0x14093d,_0x971bc0){return _0x14093d[_0xd2ad('0xb')](_0xd2ad('0xc'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6e8f=['FreshsalesConfiguration','int_freshsales_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x6e8f,0x92));var _0xf6e8=function(_0x14ecd5,_0x3855da){_0x14ecd5=_0x14ecd5-0x0;var _0x4f7c22=_0x6e8f[_0x14ecd5];return _0x4f7c22;};'use strict';var _=require(_0xf6e8('0x0'));var util=require('util');var logger=require(_0xf6e8('0x1'))(_0xf6e8('0x2'));var moment=require(_0xf6e8('0x3'));var BPromise=require(_0xf6e8('0x4'));var rp=require(_0xf6e8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf6e8('0x6'));var config=require(_0xf6e8('0x7'));var attributes=require(_0xf6e8('0x8'));module[_0xf6e8('0x9')]=function(_0x331387,_0x4d550b){return _0x331387['define'](_0xf6e8('0xa'),attributes,{'tableName':_0xf6e8('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 7b2bd34..820da05 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 _0x9671=['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','randomstring','ioredis','../../config/utils','rpc','jayson/promise'];(function(_0x576914,_0x4f6861){var _0x393184=function(_0x5c4236){while(--_0x5c4236){_0x576914['push'](_0x576914['shift']());}};_0x393184(++_0x4f6861);}(_0x9671,0x1b2));var _0x1967=function(_0x13319e,_0x383335){_0x13319e=_0x13319e-0x0;var _0x30b027=_0x9671[_0x13319e];return _0x30b027;};'use strict';var _=require(_0x1967('0x0'));var util=require('util');var moment=require(_0x1967('0x1'));var BPromise=require('bluebird');var rs=require(_0x1967('0x2'));var fs=require('fs');var Redis=require(_0x1967('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1967('0x4'));var logger=require('../../config/logger')(_0x1967('0x5'));var config=require('../../config/environment');var jayson=require(_0x1967('0x6'));var client=jayson['client'][_0x1967('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4812f2,_0x49e542,_0x487a26){return new BPromise(function(_0x15d2f1,_0x1b81f9){return client[_0x1967('0x8')](_0x4812f2,_0x487a26)[_0x1967('0x9')](function(_0x3a2c14){logger[_0x1967('0xa')](_0x1967('0xb'),_0x49e542,_0x1967('0xc'));logger[_0x1967('0xd')](_0x1967('0xe'),_0x49e542,'request\x20sent',JSON[_0x1967('0xf')](_0x3a2c14));if(_0x3a2c14['error']){if(_0x3a2c14[_0x1967('0x10')][_0x1967('0x11')]===0x1f4){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x49e542,_0x3a2c14[_0x1967('0x10')][_0x1967('0x12')]);return _0x1b81f9(_0x3a2c14[_0x1967('0x10')][_0x1967('0x12')]);}logger[_0x1967('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x49e542,_0x3a2c14[_0x1967('0x10')][_0x1967('0x12')]);return _0x15d2f1(_0x3a2c14['error']['message']);}else{logger['info'](_0x1967('0xb'),_0x49e542,_0x1967('0xc'));_0x15d2f1(_0x3a2c14[_0x1967('0x13')][_0x1967('0x12')]);}})[_0x1967('0x14')](function(_0x115895){logger[_0x1967('0x10')](_0x1967('0xb'),_0x49e542,_0x115895);_0x1b81f9(_0x115895);});});} \ No newline at end of file +var _0x8c38=['error','code','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x174d0b,_0x2a4e8c){var _0x21e5b0=function(_0x2391fd){while(--_0x2391fd){_0x174d0b['push'](_0x174d0b['shift']());}};_0x21e5b0(++_0x2a4e8c);}(_0x8c38,0x90));var _0x88c3=function(_0x29945a,_0x53d0a3){_0x29945a=_0x29945a-0x0;var _0x33bb73=_0x8c38[_0x29945a];return _0x33bb73;};'use strict';var _=require(_0x88c3('0x0'));var util=require('util');var moment=require(_0x88c3('0x1'));var BPromise=require('bluebird');var rs=require(_0x88c3('0x2'));var fs=require('fs');var Redis=require(_0x88c3('0x3'));var db=require(_0x88c3('0x4'))['db'];var utils=require(_0x88c3('0x5'));var logger=require(_0x88c3('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x88c3('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x377193,_0x2d8ef5,_0xc359eb){return new BPromise(function(_0x1fd91e,_0x3511dc){return client[_0x88c3('0x8')](_0x377193,_0xc359eb)[_0x88c3('0x9')](function(_0x3d46ee){logger[_0x88c3('0xa')](_0x88c3('0xb'),_0x2d8ef5,_0x88c3('0xc'));logger[_0x88c3('0xd')](_0x88c3('0xe'),_0x2d8ef5,_0x88c3('0xc'),JSON[_0x88c3('0xf')](_0x3d46ee));if(_0x3d46ee['error']){if(_0x3d46ee[_0x88c3('0x10')][_0x88c3('0x11')]===0x1f4){logger[_0x88c3('0x10')](_0x88c3('0xb'),_0x2d8ef5,_0x3d46ee[_0x88c3('0x10')][_0x88c3('0x12')]);return _0x3511dc(_0x3d46ee[_0x88c3('0x10')][_0x88c3('0x12')]);}logger['error'](_0x88c3('0xb'),_0x2d8ef5,_0x3d46ee[_0x88c3('0x10')][_0x88c3('0x12')]);return _0x1fd91e(_0x3d46ee[_0x88c3('0x10')]['message']);}else{logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x2d8ef5,_0x88c3('0xc'));_0x1fd91e(_0x3d46ee['result']['message']);}})[_0x88c3('0x13')](function(_0x3542dd){logger[_0x88c3('0x10')](_0x88c3('0xb'),_0x2d8ef5,_0x3542dd);_0x3511dc(_0x3542dd);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index db7b818..0112ed2 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 _0xd353=['multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy'];(function(_0x1a3ee2,_0x2194f0){var _0x1e729f=function(_0x9d6846){while(--_0x9d6846){_0x1a3ee2['push'](_0x1a3ee2['shift']());}};_0x1e729f(++_0x2194f0);}(_0xd353,0x7e));var _0x3d35=function(_0x3c6799,_0x55a34c){_0x3c6799=_0x3c6799-0x0;var _0xd75d86=_0xd353[_0x3c6799];return _0xd75d86;};'use strict';var multer=require(_0x3d35('0x0'));var util=require(_0x3d35('0x1'));var path=require('path');var timeout=require(_0x3d35('0x2'));var express=require(_0x3d35('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3d35('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3d35('0x5'));var controller=require(_0x3d35('0x6'));router[_0x3d35('0x7')]('/',auth[_0x3d35('0x8')](),controller[_0x3d35('0x9')]);router[_0x3d35('0x7')](_0x3d35('0xa'),auth['isAuthenticated'](),controller[_0x3d35('0xb')]);router[_0x3d35('0xc')]('/',auth[_0x3d35('0x8')](),controller[_0x3d35('0xd')]);router[_0x3d35('0xe')](_0x3d35('0xa'),auth[_0x3d35('0x8')](),controller[_0x3d35('0xf')]);router[_0x3d35('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x3d35('0x11')]);module['exports']=router; \ No newline at end of file +var _0x6f0d=['put','update','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','isAuthenticated','get','/:id','show','create'];(function(_0x5aba6a,_0x4ea175){var _0x1c2812=function(_0x2cda50){while(--_0x2cda50){_0x5aba6a['push'](_0x5aba6a['shift']());}};_0x1c2812(++_0x4ea175);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x46ba82,_0xf3b3dd){_0x46ba82=_0x46ba82-0x0;var _0xe78431=_0x6f0d[_0x46ba82];return _0xe78431;};'use strict';var multer=require('multer');var util=require(_0xd6f0('0x0'));var path=require(_0xd6f0('0x1'));var timeout=require(_0xd6f0('0x2'));var express=require(_0xd6f0('0x3'));var router=express['Router']();var fs_extra=require(_0xd6f0('0x4'));var auth=require(_0xd6f0('0x5'));var interaction=require(_0xd6f0('0x6'));var config=require(_0xd6f0('0x7'));var controller=require(_0xd6f0('0x8'));router['get']('/',auth[_0xd6f0('0x9')](),controller['index']);router[_0xd6f0('0xa')](_0xd6f0('0xb'),auth[_0xd6f0('0x9')](),controller[_0xd6f0('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd6f0('0xd')]);router[_0xd6f0('0xe')](_0xd6f0('0xb'),auth[_0xd6f0('0x9')](),controller[_0xd6f0('0xf')]);router['delete'](_0xd6f0('0xb'),auth[_0xd6f0('0x9')](),controller[_0xd6f0('0x10')]);module[_0xd6f0('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index f76588f..32ba8a3 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 _0x64a9=['picklist','STRING','string','customVariable','BOOLEAN','sequelize','exports','variable','keyValue'];(function(_0x252d51,_0x1774e3){var _0x43fa9c=function(_0x192078){while(--_0x192078){_0x252d51['push'](_0x252d51['shift']());}};_0x43fa9c(++_0x1774e3);}(_0x64a9,0x1ac));var _0x964a=function(_0x1a7348,_0x1b95bf){_0x1a7348=_0x1a7348-0x0;var _0x238890=_0x64a9[_0x1a7348];return _0x238890;};'use strict';var Sequelize=require(_0x964a('0x0'));module[_0x964a('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x964a('0x2'),'customVariable',_0x964a('0x3'),_0x964a('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x964a('0x5')]},'key':{'type':Sequelize[_0x964a('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x964a('0x6'),_0x964a('0x2'),_0x964a('0x7'))},'keyContent':{'type':Sequelize[_0x964a('0x5')]},'idField':{'type':Sequelize[_0x964a('0x5')]},'nameField':{'type':Sequelize[_0x964a('0x5')]},'customField':{'type':Sequelize[_0x964a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb510=['BOOLEAN','sequelize','exports','variable','customVariable','keyValue','picklist','string','STRING','ENUM'];(function(_0x4f15c6,_0x3eb56a){var _0x5cd110=function(_0x8bd15e){while(--_0x8bd15e){_0x4f15c6['push'](_0x4f15c6['shift']());}};_0x5cd110(++_0x3eb56a);}(_0xb510,0x17d));var _0x0b51=function(_0x41d901,_0x2296de){_0x41d901=_0x41d901-0x0;var _0x43fc8f=_0xb510[_0x41d901];return _0x43fc8f;};'use strict';var Sequelize=require(_0x0b51('0x0'));module[_0x0b51('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x0b51('0x2'),_0x0b51('0x3'),_0x0b51('0x4'),_0x0b51('0x5')),'defaultValue':_0x0b51('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x0b51('0x7')]},'keyType':{'type':Sequelize[_0x0b51('0x8')](_0x0b51('0x6'),_0x0b51('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x0b51('0x7')]},'idField':{'type':Sequelize[_0x0b51('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x0b51('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0b51('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 900085c..6ae72b0 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 _0x4beb=['save','then','destroy','name','index','map','fieldName','key','model','query','intersection','attributes','length','hasOwnProperty','sort','where','pick','filters','type','VIRTUAL','FreshsalesField','includeAll','findAll','catch','show','params','keys','rawAttributes','fields','merge','find','create','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','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','limit','count','set','Content-Range','apply','reject'];(function(_0x441f7a,_0x576321){var _0x4821da=function(_0x5c5b52){while(--_0x5c5b52){_0x441f7a['push'](_0x441f7a['shift']());}};_0x4821da(++_0x576321);}(_0x4beb,0x66));var _0xb4be=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4beb[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xb4be('0x0'));var rimraf=require(_0xb4be('0x1'));var zipdir=require(_0xb4be('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb4be('0x3'));var moment=require('moment');var BPromise=require(_0xb4be('0x4'));var Mustache=require(_0xb4be('0x5'));var util=require(_0xb4be('0x6'));var path=require(_0xb4be('0x7'));var sox=require(_0xb4be('0x8'));var csv=require('to-csv');var ejs=require(_0xb4be('0x9'));var fs=require('fs');var fs_extra=require(_0xb4be('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb4be('0xb'));var jsforce=require(_0xb4be('0xc'));var deskjs=require(_0xb4be('0xd'));var toCsv=require(_0xb4be('0xe'));var querystring=require(_0xb4be('0xf'));var Papa=require(_0xb4be('0x10'));var Redis=require('ioredis');var authService=require(_0xb4be('0x11'));var qs=require(_0xb4be('0x12'));var as=require(_0xb4be('0x13'));var hardwareService=require(_0xb4be('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xb4be('0x15'));var config=require(_0xb4be('0x16'));var licenseUtil=require(_0xb4be('0x17'));var db=require(_0xb4be('0x18'))['db'];function respondWithStatusCode(_0x55180c,_0x446c67){_0x446c67=_0x446c67||0xcc;return function(_0xd74e2b){if(_0xd74e2b){return _0x55180c[_0xb4be('0x19')](_0x446c67);}return _0x55180c[_0xb4be('0x1a')](_0x446c67)[_0xb4be('0x1b')]();};}function respondWithResult(_0x2b7b97,_0x5ba723){_0x5ba723=_0x5ba723||0xc8;return function(_0x21d648){if(_0x21d648){return _0x2b7b97['status'](_0x5ba723)[_0xb4be('0x1c')](_0x21d648);}};}function respondWithFilteredResult(_0x16ee19,_0x591e7a){return function(_0x5be860){if(_0x5be860){var _0x584fa2=typeof _0x591e7a[_0xb4be('0x1d')]==='undefined'&&typeof _0x591e7a[_0xb4be('0x1e')]==='undefined';var _0x500438=_0x5be860['count'];var _0x5a794a=_0x584fa2?0x0:_0x591e7a[_0xb4be('0x1d')];var _0x5464e6=_0x584fa2?_0x5be860[_0xb4be('0x1f')]:_0x591e7a[_0xb4be('0x1d')]+_0x591e7a[_0xb4be('0x1e')];var _0x24df40;if(_0x5464e6>=_0x500438){_0x5464e6=_0x500438;_0x24df40=0xc8;}else{_0x24df40=0xce;}_0x16ee19['status'](_0x24df40);return _0x16ee19[_0xb4be('0x20')](_0xb4be('0x21'),_0x5a794a+'-'+_0x5464e6+'/'+_0x500438)[_0xb4be('0x1c')](_0x5be860);}return null;};}function patchUpdates(_0x44b5d6){return function(_0x13ae59){try{jsonpatch[_0xb4be('0x22')](_0x13ae59,_0x44b5d6,!![]);}catch(_0x30c611){return BPromise[_0xb4be('0x23')](_0x30c611);}return _0x13ae59[_0xb4be('0x24')]();};}function saveUpdates(_0x39afca,_0x453420){return function(_0x3a1e42){if(_0x3a1e42){return _0x3a1e42['update'](_0x39afca)[_0xb4be('0x25')](function(_0xa59ca6){return _0xa59ca6;});}return null;};}function removeEntity(_0x5e3b5d,_0x3c6b51){return function(_0x9826cb){if(_0x9826cb){return _0x9826cb[_0xb4be('0x26')]()['then'](function(){_0x5e3b5d[_0xb4be('0x1a')](0xcc)[_0xb4be('0x1b')]();});}};}function handleEntityNotFound(_0x389d47,_0xd5395b){return function(_0x214d4f){if(!_0x214d4f){_0x389d47[_0xb4be('0x19')](0x194);}return _0x214d4f;};}function handleError(_0xf7156,_0x339857){_0x339857=_0x339857||0x1f4;return function(_0x16c8a4){logger['error'](_0x16c8a4['stack']);if(_0x16c8a4[_0xb4be('0x27')]){delete _0x16c8a4[_0xb4be('0x27')];}_0xf7156[_0xb4be('0x1a')](_0x339857)['send'](_0x16c8a4);};}exports[_0xb4be('0x28')]=function(_0x3c70e1,_0x17215a){var _0x65a510={},_0x1aa6c2={},_0x42872a={'count':0x0,'rows':[]};var _0x1d2814=_[_0xb4be('0x29')](db['FreshsalesField']['rawAttributes'],function(_0x160aa2){return{'name':_0x160aa2[_0xb4be('0x2a')],'type':_0x160aa2['type'][_0xb4be('0x2b')]};});_0x1aa6c2[_0xb4be('0x2c')]=_[_0xb4be('0x29')](_0x1d2814,_0xb4be('0x27'));_0x1aa6c2[_0xb4be('0x2d')]=_['keys'](_0x3c70e1['query']);_0x1aa6c2['filters']=_[_0xb4be('0x2e')](_0x1aa6c2[_0xb4be('0x2c')],_0x1aa6c2[_0xb4be('0x2d')]);_0x65a510[_0xb4be('0x2f')]=_['intersection'](_0x1aa6c2[_0xb4be('0x2c')],qs['fields'](_0x3c70e1['query']['fields']));_0x65a510[_0xb4be('0x2f')]=_0x65a510[_0xb4be('0x2f')][_0xb4be('0x30')]?_0x65a510['attributes']:_0x1aa6c2[_0xb4be('0x2c')];if(!_0x3c70e1[_0xb4be('0x2d')][_0xb4be('0x31')]('nolimit')){_0x65a510[_0xb4be('0x1e')]=qs[_0xb4be('0x1e')](_0x3c70e1[_0xb4be('0x2d')][_0xb4be('0x1e')]);_0x65a510['offset']=qs['offset'](_0x3c70e1[_0xb4be('0x2d')][_0xb4be('0x1d')]);}_0x65a510['order']=qs[_0xb4be('0x32')](_0x3c70e1[_0xb4be('0x2d')]['sort']);_0x65a510[_0xb4be('0x33')]=qs['filters'](_[_0xb4be('0x34')](_0x3c70e1[_0xb4be('0x2d')],_0x1aa6c2[_0xb4be('0x35')]),_0x1d2814);if(_0x3c70e1[_0xb4be('0x2d')]['filter']){_0x65a510[_0xb4be('0x33')]=_['merge'](_0x65a510['where'],{'$or':_[_0xb4be('0x29')](_0x1d2814,function(_0x57a597){if(_0x57a597[_0xb4be('0x36')]!==_0xb4be('0x37')){var _0x5d8a7e={};_0x5d8a7e[_0x57a597[_0xb4be('0x27')]]={'$like':'%'+_0x3c70e1[_0xb4be('0x2d')]['filter']+'%'};return _0x5d8a7e;}})});}_0x65a510=_['merge']({},_0x65a510,_0x3c70e1['options']);var _0x178297={'where':_0x65a510[_0xb4be('0x33')]};return db[_0xb4be('0x38')][_0xb4be('0x1f')](_0x178297)[_0xb4be('0x25')](function(_0x5614fa){_0x42872a[_0xb4be('0x1f')]=_0x5614fa;if(_0x3c70e1[_0xb4be('0x2d')][_0xb4be('0x39')]){_0x65a510['include']=[{'all':!![]}];}return db[_0xb4be('0x38')][_0xb4be('0x3a')](_0x65a510);})[_0xb4be('0x25')](function(_0x1a1328){_0x42872a['rows']=_0x1a1328;return _0x42872a;})[_0xb4be('0x25')](respondWithFilteredResult(_0x17215a,_0x65a510))[_0xb4be('0x3b')](handleError(_0x17215a,null));};exports[_0xb4be('0x3c')]=function(_0x2c3d2,_0x447e89){var _0x288926={'raw':!![],'where':{'id':_0x2c3d2[_0xb4be('0x3d')]['id']}},_0x8dd376={};_0x8dd376[_0xb4be('0x2c')]=_[_0xb4be('0x3e')](db[_0xb4be('0x38')][_0xb4be('0x3f')]);_0x8dd376[_0xb4be('0x2d')]=_[_0xb4be('0x3e')](_0x2c3d2[_0xb4be('0x2d')]);_0x8dd376[_0xb4be('0x35')]=_[_0xb4be('0x2e')](_0x8dd376[_0xb4be('0x2c')],_0x8dd376[_0xb4be('0x2d')]);_0x288926['attributes']=_[_0xb4be('0x2e')](_0x8dd376['model'],qs[_0xb4be('0x40')](_0x2c3d2[_0xb4be('0x2d')]['fields']));_0x288926[_0xb4be('0x2f')]=_0x288926['attributes'][_0xb4be('0x30')]?_0x288926[_0xb4be('0x2f')]:_0x8dd376[_0xb4be('0x2c')];if(_0x2c3d2[_0xb4be('0x2d')]['includeAll']){_0x288926['include']=[{'all':!![]}];}_0x288926=_[_0xb4be('0x41')]({},_0x288926,_0x2c3d2['options']);return db[_0xb4be('0x38')][_0xb4be('0x42')](_0x288926)[_0xb4be('0x25')](handleEntityNotFound(_0x447e89,null))[_0xb4be('0x25')](respondWithResult(_0x447e89,null))[_0xb4be('0x3b')](handleError(_0x447e89,null));};exports[_0xb4be('0x43')]=function(_0x5e452f,_0x472f29){return db[_0xb4be('0x38')]['create'](_0x5e452f[_0xb4be('0x44')],{})['then'](respondWithResult(_0x472f29,0xc9))['catch'](handleError(_0x472f29,null));};exports['update']=function(_0x4f6e41,_0x4c300a){if(_0x4f6e41[_0xb4be('0x44')]['id']){delete _0x4f6e41[_0xb4be('0x44')]['id'];}return db[_0xb4be('0x38')][_0xb4be('0x42')]({'where':{'id':_0x4f6e41[_0xb4be('0x3d')]['id']}})[_0xb4be('0x25')](handleEntityNotFound(_0x4c300a,null))['then'](saveUpdates(_0x4f6e41[_0xb4be('0x44')],null))[_0xb4be('0x25')](respondWithResult(_0x4c300a,null))[_0xb4be('0x3b')](handleError(_0x4c300a,null));};exports[_0xb4be('0x26')]=function(_0x29a4d6,_0x45b7f7){return db[_0xb4be('0x38')][_0xb4be('0x42')]({'where':{'id':_0x29a4d6['params']['id']}})[_0xb4be('0x25')](handleEntityNotFound(_0x45b7f7,null))['then'](removeEntity(_0x45b7f7,null))[_0xb4be('0x3b')](handleError(_0x45b7f7,null));}; \ No newline at end of file +var _0x2e2a=['end','json','offset','limit','undefined','count','Content-Range','reject','save','update','error','stack','name','map','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','hasOwnProperty','order','sort','where','filters','merge','VIRTUAL','options','FreshsalesField','then','findAll','catch','params','length','includeAll','include','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status'];(function(_0x2fdce0,_0x496242){var _0x36f07e=function(_0x44c8c6){while(--_0x44c8c6){_0x2fdce0['push'](_0x2fdce0['shift']());}};_0x36f07e(++_0x496242);}(_0x2e2a,0x18f));var _0xa2e2=function(_0x56ff5e,_0x257c79){_0x56ff5e=_0x56ff5e-0x0;var _0x26d7c6=_0x2e2a[_0x56ff5e];return _0x26d7c6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa2e2('0x0'));var zipdir=require(_0xa2e2('0x1'));var jsonpatch=require(_0xa2e2('0x2'));var rp=require(_0xa2e2('0x3'));var moment=require(_0xa2e2('0x4'));var BPromise=require(_0xa2e2('0x5'));var Mustache=require(_0xa2e2('0x6'));var util=require(_0xa2e2('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xa2e2('0x8'));var ejs=require(_0xa2e2('0x9'));var fs=require('fs');var fs_extra=require(_0xa2e2('0xa'));var _=require(_0xa2e2('0xb'));var squel=require('squel');var crypto=require(_0xa2e2('0xc'));var jsforce=require(_0xa2e2('0xd'));var deskjs=require(_0xa2e2('0xe'));var toCsv=require(_0xa2e2('0x8'));var querystring=require(_0xa2e2('0xf'));var Papa=require(_0xa2e2('0x10'));var Redis=require(_0xa2e2('0x11'));var authService=require(_0xa2e2('0x12'));var qs=require(_0xa2e2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa2e2('0x14'))(_0xa2e2('0x15'));var utils=require(_0xa2e2('0x16'));var config=require(_0xa2e2('0x17'));var licenseUtil=require(_0xa2e2('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x232c72,_0x59b776){_0x59b776=_0x59b776||0xcc;return function(_0x22701c){if(_0x22701c){return _0x232c72[_0xa2e2('0x19')](_0x59b776);}return _0x232c72[_0xa2e2('0x1a')](_0x59b776)[_0xa2e2('0x1b')]();};}function respondWithResult(_0x39be17,_0x555eb9){_0x555eb9=_0x555eb9||0xc8;return function(_0x242c56){if(_0x242c56){return _0x39be17[_0xa2e2('0x1a')](_0x555eb9)[_0xa2e2('0x1c')](_0x242c56);}};}function respondWithFilteredResult(_0x58a7a4,_0x1c3860){return function(_0x4ab2b1){if(_0x4ab2b1){var _0x21b7f0=typeof _0x1c3860[_0xa2e2('0x1d')]==='undefined'&&typeof _0x1c3860[_0xa2e2('0x1e')]===_0xa2e2('0x1f');var _0x4e56f2=_0x4ab2b1['count'];var _0x3e1047=_0x21b7f0?0x0:_0x1c3860['offset'];var _0x43f8e1=_0x21b7f0?_0x4ab2b1[_0xa2e2('0x20')]:_0x1c3860[_0xa2e2('0x1d')]+_0x1c3860[_0xa2e2('0x1e')];var _0x3dd1ff;if(_0x43f8e1>=_0x4e56f2){_0x43f8e1=_0x4e56f2;_0x3dd1ff=0xc8;}else{_0x3dd1ff=0xce;}_0x58a7a4[_0xa2e2('0x1a')](_0x3dd1ff);return _0x58a7a4['set'](_0xa2e2('0x21'),_0x3e1047+'-'+_0x43f8e1+'/'+_0x4e56f2)['json'](_0x4ab2b1);}return null;};}function patchUpdates(_0x3eeaa3){return function(_0x1124e0){try{jsonpatch['apply'](_0x1124e0,_0x3eeaa3,!![]);}catch(_0x4b5b99){return BPromise[_0xa2e2('0x22')](_0x4b5b99);}return _0x1124e0[_0xa2e2('0x23')]();};}function saveUpdates(_0x5e474e,_0x455553){return function(_0x100665){if(_0x100665){return _0x100665[_0xa2e2('0x24')](_0x5e474e)['then'](function(_0x2f62bd){return _0x2f62bd;});}return null;};}function removeEntity(_0x412344,_0x17809d){return function(_0x173e0d){if(_0x173e0d){return _0x173e0d['destroy']()['then'](function(){_0x412344[_0xa2e2('0x1a')](0xcc)[_0xa2e2('0x1b')]();});}};}function handleEntityNotFound(_0x2d9040,_0x2389a3){return function(_0x1a079a){if(!_0x1a079a){_0x2d9040[_0xa2e2('0x19')](0x194);}return _0x1a079a;};}function handleError(_0x290663,_0x59123c){_0x59123c=_0x59123c||0x1f4;return function(_0xa897da){logger[_0xa2e2('0x25')](_0xa897da[_0xa2e2('0x26')]);if(_0xa897da[_0xa2e2('0x27')]){delete _0xa897da[_0xa2e2('0x27')];}_0x290663[_0xa2e2('0x1a')](_0x59123c)['send'](_0xa897da);};}exports['index']=function(_0x7e4a75,_0xe43a99){var _0x5abb65={},_0x455684={},_0x23cbb9={'count':0x0,'rows':[]};var _0x4c9230=_[_0xa2e2('0x28')](db['FreshsalesField'][_0xa2e2('0x29')],function(_0x167c64){return{'name':_0x167c64[_0xa2e2('0x2a')],'type':_0x167c64[_0xa2e2('0x2b')][_0xa2e2('0x2c')]};});_0x455684[_0xa2e2('0x2d')]=_[_0xa2e2('0x28')](_0x4c9230,_0xa2e2('0x27'));_0x455684['query']=_[_0xa2e2('0x2e')](_0x7e4a75['query']);_0x455684['filters']=_['intersection'](_0x455684[_0xa2e2('0x2d')],_0x455684[_0xa2e2('0x2f')]);_0x5abb65[_0xa2e2('0x30')]=_[_0xa2e2('0x31')](_0x455684[_0xa2e2('0x2d')],qs[_0xa2e2('0x32')](_0x7e4a75[_0xa2e2('0x2f')][_0xa2e2('0x32')]));_0x5abb65[_0xa2e2('0x30')]=_0x5abb65[_0xa2e2('0x30')]['length']?_0x5abb65[_0xa2e2('0x30')]:_0x455684[_0xa2e2('0x2d')];if(!_0x7e4a75[_0xa2e2('0x2f')][_0xa2e2('0x33')]('nolimit')){_0x5abb65[_0xa2e2('0x1e')]=qs[_0xa2e2('0x1e')](_0x7e4a75[_0xa2e2('0x2f')][_0xa2e2('0x1e')]);_0x5abb65['offset']=qs[_0xa2e2('0x1d')](_0x7e4a75[_0xa2e2('0x2f')]['offset']);}_0x5abb65[_0xa2e2('0x34')]=qs[_0xa2e2('0x35')](_0x7e4a75[_0xa2e2('0x2f')]['sort']);_0x5abb65[_0xa2e2('0x36')]=qs[_0xa2e2('0x37')](_['pick'](_0x7e4a75['query'],_0x455684['filters']),_0x4c9230);if(_0x7e4a75[_0xa2e2('0x2f')]['filter']){_0x5abb65[_0xa2e2('0x36')]=_[_0xa2e2('0x38')](_0x5abb65[_0xa2e2('0x36')],{'$or':_['map'](_0x4c9230,function(_0x7201b2){if(_0x7201b2[_0xa2e2('0x2b')]!==_0xa2e2('0x39')){var _0x4c109d={};_0x4c109d[_0x7201b2[_0xa2e2('0x27')]]={'$like':'%'+_0x7e4a75[_0xa2e2('0x2f')]['filter']+'%'};return _0x4c109d;}})});}_0x5abb65=_[_0xa2e2('0x38')]({},_0x5abb65,_0x7e4a75[_0xa2e2('0x3a')]);var _0x5b11a8={'where':_0x5abb65[_0xa2e2('0x36')]};return db[_0xa2e2('0x3b')][_0xa2e2('0x20')](_0x5b11a8)[_0xa2e2('0x3c')](function(_0x32adae){_0x23cbb9[_0xa2e2('0x20')]=_0x32adae;if(_0x7e4a75[_0xa2e2('0x2f')]['includeAll']){_0x5abb65['include']=[{'all':!![]}];}return db[_0xa2e2('0x3b')][_0xa2e2('0x3d')](_0x5abb65);})[_0xa2e2('0x3c')](function(_0x254b4b){_0x23cbb9['rows']=_0x254b4b;return _0x23cbb9;})[_0xa2e2('0x3c')](respondWithFilteredResult(_0xe43a99,_0x5abb65))[_0xa2e2('0x3e')](handleError(_0xe43a99,null));};exports['show']=function(_0x358ef8,_0x16e91f){var _0xab66aa={'raw':!![],'where':{'id':_0x358ef8[_0xa2e2('0x3f')]['id']}},_0x5ec9b2={};_0x5ec9b2[_0xa2e2('0x2d')]=_[_0xa2e2('0x2e')](db[_0xa2e2('0x3b')][_0xa2e2('0x29')]);_0x5ec9b2['query']=_[_0xa2e2('0x2e')](_0x358ef8[_0xa2e2('0x2f')]);_0x5ec9b2[_0xa2e2('0x37')]=_['intersection'](_0x5ec9b2[_0xa2e2('0x2d')],_0x5ec9b2[_0xa2e2('0x2f')]);_0xab66aa[_0xa2e2('0x30')]=_[_0xa2e2('0x31')](_0x5ec9b2['model'],qs[_0xa2e2('0x32')](_0x358ef8['query'][_0xa2e2('0x32')]));_0xab66aa[_0xa2e2('0x30')]=_0xab66aa[_0xa2e2('0x30')][_0xa2e2('0x40')]?_0xab66aa[_0xa2e2('0x30')]:_0x5ec9b2[_0xa2e2('0x2d')];if(_0x358ef8[_0xa2e2('0x2f')][_0xa2e2('0x41')]){_0xab66aa[_0xa2e2('0x42')]=[{'all':!![]}];}_0xab66aa=_['merge']({},_0xab66aa,_0x358ef8[_0xa2e2('0x3a')]);return db[_0xa2e2('0x3b')][_0xa2e2('0x43')](_0xab66aa)[_0xa2e2('0x3c')](handleEntityNotFound(_0x16e91f,null))[_0xa2e2('0x3c')](respondWithResult(_0x16e91f,null))[_0xa2e2('0x3e')](handleError(_0x16e91f,null));};exports['create']=function(_0x219b69,_0x227b51){return db['FreshsalesField'][_0xa2e2('0x44')](_0x219b69[_0xa2e2('0x45')],{})[_0xa2e2('0x3c')](respondWithResult(_0x227b51,0xc9))[_0xa2e2('0x3e')](handleError(_0x227b51,null));};exports['update']=function(_0x3647c7,_0x43897a){if(_0x3647c7[_0xa2e2('0x45')]['id']){delete _0x3647c7[_0xa2e2('0x45')]['id'];}return db['FreshsalesField']['find']({'where':{'id':_0x3647c7[_0xa2e2('0x3f')]['id']}})[_0xa2e2('0x3c')](handleEntityNotFound(_0x43897a,null))[_0xa2e2('0x3c')](saveUpdates(_0x3647c7[_0xa2e2('0x45')],null))[_0xa2e2('0x3c')](respondWithResult(_0x43897a,null))[_0xa2e2('0x3e')](handleError(_0x43897a,null));};exports[_0xa2e2('0x46')]=function(_0x3b4587,_0x395f1d){return db[_0xa2e2('0x3b')][_0xa2e2('0x43')]({'where':{'id':_0x3b4587[_0xa2e2('0x3f')]['id']}})[_0xa2e2('0x3c')](handleEntityNotFound(_0x395f1d,null))[_0xa2e2('0x3c')](removeEntity(_0x395f1d,null))[_0xa2e2('0x3e')](handleError(_0x395f1d,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index c1b817d..591e170 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 _0xc933=['api','moment','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','FreshsalesField','freshsales_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x410707,_0x46d17e){var _0x2b7037=function(_0xb440c4){while(--_0xb440c4){_0x410707['push'](_0x410707['shift']());}};_0x2b7037(++_0x46d17e);}(_0xc933,0xf9));var _0x3c93=function(_0x4aa43d,_0x3fe952){_0x4aa43d=_0x4aa43d-0x0;var _0x1285dd=_0xc933[_0x4aa43d];return _0x1285dd;};'use strict';var _=require(_0x3c93('0x0'));var util=require(_0x3c93('0x1'));var logger=require(_0x3c93('0x2'))(_0x3c93('0x3'));var moment=require(_0x3c93('0x4'));var BPromise=require('bluebird');var rp=require(_0x3c93('0x5'));var fs=require('fs');var path=require(_0x3c93('0x6'));var rimraf=require(_0x3c93('0x7'));var config=require(_0x3c93('0x8'));var attributes=require(_0x3c93('0x9'));module['exports']=function(_0x1f2667,_0x19939f){return _0x1f2667['define'](_0x3c93('0xa'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x3c93('0xb'),'fields':[_0x3c93('0xc'),_0x3c93('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5713=['lodash','util','api','bluebird','request-promise','path','rimraf','exports','define','FreshsalesField','int_freshsales_fields','idField','FieldId'];(function(_0x4c5920,_0x3a748f){var _0x145703=function(_0x25aae0){while(--_0x25aae0){_0x4c5920['push'](_0x4c5920['shift']());}};_0x145703(++_0x3a748f);}(_0x5713,0x1c7));var _0x3571=function(_0x50f35c,_0x531d4c){_0x50f35c=_0x50f35c-0x0;var _0x1a4473=_0x5713[_0x50f35c];return _0x1a4473;};'use strict';var _=require(_0x3571('0x0'));var util=require(_0x3571('0x1'));var logger=require('../../config/logger')(_0x3571('0x2'));var moment=require('moment');var BPromise=require(_0x3571('0x3'));var rp=require(_0x3571('0x4'));var fs=require('fs');var path=require(_0x3571('0x5'));var rimraf=require(_0x3571('0x6'));var config=require('../../config/environment');var attributes=require('./intFreshsalesField.attributes');module[_0x3571('0x7')]=function(_0x415378,_0x3e114a){return _0x415378[_0x3571('0x8')](_0x3571('0x9'),attributes,{'tableName':_0x3571('0xa'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x3571('0xb'),_0x3571('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 2e2cc8b..ab7fb61 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 _0xc6ac=['http','request','then','info','FreshsalesField,\x20%s,\x20%s','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2ad6eb,_0x26e819){var _0x3bf37c=function(_0x469e62){while(--_0x469e62){_0x2ad6eb['push'](_0x2ad6eb['shift']());}};_0x3bf37c(++_0x26e819);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x4a4002,_0x4c2cbd){_0x4a4002=_0x4a4002-0x0;var _0x1cac5e=_0xc6ac[_0x4a4002];return _0x1cac5e;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var moment=require(_0xcc6a('0x2'));var BPromise=require(_0xcc6a('0x3'));var rs=require(_0xcc6a('0x4'));var fs=require('fs');var Redis=require(_0xcc6a('0x5'));var db=require(_0xcc6a('0x6'))['db'];var utils=require(_0xcc6a('0x7'));var logger=require(_0xcc6a('0x8'))(_0xcc6a('0x9'));var config=require(_0xcc6a('0xa'));var jayson=require(_0xcc6a('0xb'));var client=jayson[_0xcc6a('0xc')][_0xcc6a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5f3887,_0x3dd497,_0x11b919){return new BPromise(function(_0xf02261,_0x560cc4){return client[_0xcc6a('0xe')](_0x5f3887,_0x11b919)[_0xcc6a('0xf')](function(_0x7806a0){logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,'request\x20sent');logger[_0xcc6a('0x12')](_0xcc6a('0x13'),_0x3dd497,_0xcc6a('0x14'),JSON['stringify'](_0x7806a0));if(_0x7806a0[_0xcc6a('0x15')]){if(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x16')]===0x1f4){logger['error']('FreshsalesField,\x20%s,\x20%s',_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0x560cc4(_0x7806a0[_0xcc6a('0x15')]['message']);}logger['error'](_0xcc6a('0x11'),_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0xf02261(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);}else{logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,_0xcc6a('0x14'));_0xf02261(_0x7806a0['result']['message']);}})['catch'](function(_0x395a55){logger[_0xcc6a('0x15')](_0xcc6a('0x11'),_0x3dd497,_0x395a55);_0x560cc4(_0x395a55);});});} \ No newline at end of file +var _0x2542=['info','FreshsalesField,\x20%s,\x20%s','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x4e4f42,_0x3f4216){var _0x2e8e79=function(_0x267d1c){while(--_0x267d1c){_0x4e4f42['push'](_0x4e4f42['shift']());}};_0x2e8e79(++_0x3f4216);}(_0x2542,0x169));var _0x2254=function(_0x427b53,_0x140bb2){_0x427b53=_0x427b53-0x0;var _0x4a76da=_0x2542[_0x427b53];return _0x4a76da;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var moment=require(_0x2254('0x2'));var BPromise=require(_0x2254('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2254('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2254('0x5'));var logger=require(_0x2254('0x6'))(_0x2254('0x7'));var config=require(_0x2254('0x8'));var jayson=require(_0x2254('0x9'));var client=jayson['client'][_0x2254('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe8ca50,_0x2ee7ee,_0x3c45ec){return new BPromise(function(_0x1637ad,_0x477b47){return client[_0x2254('0xb')](_0xe8ca50,_0x3c45ec)[_0x2254('0xc')](function(_0xb395da){logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,'request\x20sent');logger[_0x2254('0xf')](_0x2254('0x10'),_0x2ee7ee,_0x2254('0x11'),JSON[_0x2254('0x12')](_0xb395da));if(_0xb395da['error']){if(_0xb395da['error'][_0x2254('0x13')]===0x1f4){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);return _0x477b47(_0xb395da[_0x2254('0x14')]['message']);}logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da['error'][_0x2254('0x15')]);return _0x1637ad(_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);}else{logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,_0x2254('0x11'));_0x1637ad(_0xb395da['result'][_0x2254('0x15')]);}})['catch'](function(_0x327d6d){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0x327d6d);_0x477b47(_0x327d6d);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index c61d937..74e5ac9 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x4708eb,_0x572847){var _0x1385fd=function(_0x1e57cf){while(--_0x1e57cf){_0x4708eb['push'](_0x4708eb['shift']());}};_0x1385fd(++_0x572847);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x1156d3,_0x1899b4){var _0x146fe2=function(_0x806d3f){while(--_0x806d3f){_0x1156d3['push'](_0x1156d3['shift']());}};_0x146fe2(++_0x1899b4);}(_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'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 9bc6253..e34c5c3 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 _0x36d3=['exports','STRING','username','ENUM','integrationTab','newTab','sequelize'];(function(_0x27e811,_0x20137c){var _0x1627fa=function(_0x4498ca){while(--_0x4498ca){_0x27e811['push'](_0x27e811['shift']());}};_0x1627fa(++_0x20137c);}(_0x36d3,0xb5));var _0x336d=function(_0x449616,_0x1cf413){_0x449616=_0x449616-0x0;var _0x5d9a7c=_0x36d3[_0x449616];return _0x5d9a7c;};'use strict';var Sequelize=require(_0x336d('0x0'));module[_0x336d('0x1')]={'name':{'type':Sequelize[_0x336d('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x336d('0x3')},'remoteUri':{'type':Sequelize[_0x336d('0x2')]},'password':{'type':Sequelize[_0x336d('0x2')]},'clientId':{'type':Sequelize[_0x336d('0x2')]},'clientSecret':{'type':Sequelize[_0x336d('0x2')]},'securityToken':{'type':Sequelize[_0x336d('0x2')]},'serverUrl':{'type':Sequelize[_0x336d('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x336d('0x4')](_0x336d('0x5'),_0x336d('0x6')),'defaultValue':_0x336d('0x5')}}; \ No newline at end of file +var _0x078f=['username','ENUM','integrationTab','newTab','exports','STRING'];(function(_0x36bfe3,_0x358938){var _0x9b0436=function(_0x86e47d){while(--_0x86e47d){_0x36bfe3['push'](_0x36bfe3['shift']());}};_0x9b0436(++_0x358938);}(_0x078f,0x1b4));var _0xf078=function(_0x4fb84d,_0xf64e58){_0x4fb84d=_0x4fb84d-0x0;var _0x37ab00=_0x078f[_0x4fb84d];return _0x37ab00;};'use strict';var Sequelize=require('sequelize');module[_0xf078('0x0')]={'name':{'type':Sequelize[_0xf078('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xf078('0x1')],'unique':_0xf078('0x2')},'remoteUri':{'type':Sequelize[_0xf078('0x1')]},'password':{'type':Sequelize[_0xf078('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xf078('0x1')]},'securityToken':{'type':Sequelize[_0xf078('0x1')]},'serverUrl':{'type':Sequelize[_0xf078('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xf078('0x3')](_0xf078('0x4'),_0xf078('0x5')),'defaultValue':_0xf078('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 73b0d40..01ce005 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 _0xeeb1=['attributes','length','order','sort','where','filter','merge','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','options','hasOwnProperty','nolimit','addConfiguration','findOne','AccountId','channel','Descriptions','SalesforceField','Subjects','getFields','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','Connection','login','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsRecurrence','Subject','Description','string','int','picklist','boolean','email','phone','remove','includes','label','picklistValues','true','False','false','test','statusCode','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','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/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','SalesforceAccount','rawAttributes','type','key','query','keys','filters','intersection','model','fields'];(function(_0x58791f,_0x368df3){var _0x1255d6=function(_0x1bc5cf){while(--_0x1bc5cf){_0x58791f['push'](_0x58791f['shift']());}};_0x1255d6(++_0x368df3);}(_0xeeb1,0x1b4));var _0x1eeb=function(_0x3b5e9f,_0x29601e){_0x3b5e9f=_0x3b5e9f-0x0;var _0x1e9a49=_0xeeb1[_0x3b5e9f];return _0x1e9a49;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1eeb('0x0'));var zipdir=require(_0x1eeb('0x1'));var jsonpatch=require(_0x1eeb('0x2'));var rp=require(_0x1eeb('0x3'));var moment=require(_0x1eeb('0x4'));var BPromise=require(_0x1eeb('0x5'));var Mustache=require(_0x1eeb('0x6'));var util=require(_0x1eeb('0x7'));var path=require(_0x1eeb('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1eeb('0x9'));var fs=require('fs');var fs_extra=require(_0x1eeb('0xa'));var _=require(_0x1eeb('0xb'));var squel=require(_0x1eeb('0xc'));var crypto=require(_0x1eeb('0xd'));var jsforce=require(_0x1eeb('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1eeb('0xf'));var Papa=require(_0x1eeb('0x10'));var Redis=require('ioredis');var authService=require(_0x1eeb('0x11'));var qs=require(_0x1eeb('0x12'));var as=require(_0x1eeb('0x13'));var hardwareService=require(_0x1eeb('0x14'));var logger=require(_0x1eeb('0x15'))(_0x1eeb('0x16'));var utils=require(_0x1eeb('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x1eeb('0x18'));var db=require(_0x1eeb('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5614a9,_0x5c5ad1){_0x5c5ad1=_0x5c5ad1||0xcc;return function(_0xd74329){if(_0xd74329){return _0x5614a9[_0x1eeb('0x1a')](_0x5c5ad1);}return _0x5614a9['status'](_0x5c5ad1)[_0x1eeb('0x1b')]();};}function respondWithResult(_0x2ea45c,_0x299234){_0x299234=_0x299234||0xc8;return function(_0x220b9b){if(_0x220b9b){return _0x2ea45c[_0x1eeb('0x1c')](_0x299234)[_0x1eeb('0x1d')](_0x220b9b);}};}function respondWithFilteredResult(_0x55f88e,_0x484562){return function(_0x23136a){if(_0x23136a){var _0x4cdba1=typeof _0x484562[_0x1eeb('0x1e')]==='undefined'&&typeof _0x484562[_0x1eeb('0x1f')]===_0x1eeb('0x20');var _0x2b05eb=_0x23136a[_0x1eeb('0x21')];var _0x46a40e=_0x4cdba1?0x0:_0x484562[_0x1eeb('0x1e')];var _0x14a1fa=_0x4cdba1?_0x23136a['count']:_0x484562['offset']+_0x484562['limit'];var _0x35970b;if(_0x14a1fa>=_0x2b05eb){_0x14a1fa=_0x2b05eb;_0x35970b=0xc8;}else{_0x35970b=0xce;}_0x55f88e[_0x1eeb('0x1c')](_0x35970b);return _0x55f88e[_0x1eeb('0x22')](_0x1eeb('0x23'),_0x46a40e+'-'+_0x14a1fa+'/'+_0x2b05eb)[_0x1eeb('0x1d')](_0x23136a);}return null;};}function patchUpdates(_0x40d38b){return function(_0x5286e9){try{jsonpatch[_0x1eeb('0x24')](_0x5286e9,_0x40d38b,!![]);}catch(_0x139dfa){return BPromise['reject'](_0x139dfa);}return _0x5286e9[_0x1eeb('0x25')]();};}function saveUpdates(_0x3fa5f9,_0x27ff21){return function(_0x1e4aea){if(_0x1e4aea){return _0x1e4aea[_0x1eeb('0x26')](_0x3fa5f9)[_0x1eeb('0x27')](function(_0x5dd50c){return _0x5dd50c;});}return null;};}function removeEntity(_0x48c033,_0x104b7e){return function(_0xaa2a21){if(_0xaa2a21){return _0xaa2a21[_0x1eeb('0x28')]()[_0x1eeb('0x27')](function(){_0x48c033[_0x1eeb('0x1c')](0xcc)[_0x1eeb('0x1b')]();});}};}function handleEntityNotFound(_0x18b420,_0x282401){return function(_0x4e56ec){if(!_0x4e56ec){_0x18b420['sendStatus'](0x194);}return _0x4e56ec;};}function handleError(_0x384bac,_0x4ba4fc){_0x4ba4fc=_0x4ba4fc||0x1f4;return function(_0x2d1281){logger[_0x1eeb('0x29')](_0x2d1281['stack']);if(_0x2d1281[_0x1eeb('0x2a')]){delete _0x2d1281[_0x1eeb('0x2a')];}_0x384bac[_0x1eeb('0x1c')](_0x4ba4fc)[_0x1eeb('0x2b')](_0x2d1281);};}exports[_0x1eeb('0x2c')]=function(_0x5ae815,_0x51bff1){var _0x3362b3={},_0x3fcba6={},_0x18fb34={'count':0x0,'rows':[]};var _0x503798=_[_0x1eeb('0x2d')](db[_0x1eeb('0x2e')][_0x1eeb('0x2f')],function(_0x5567b1){return{'name':_0x5567b1['fieldName'],'type':_0x5567b1[_0x1eeb('0x30')][_0x1eeb('0x31')]};});_0x3fcba6['model']=_[_0x1eeb('0x2d')](_0x503798,_0x1eeb('0x2a'));_0x3fcba6[_0x1eeb('0x32')]=_[_0x1eeb('0x33')](_0x5ae815[_0x1eeb('0x32')]);_0x3fcba6[_0x1eeb('0x34')]=_[_0x1eeb('0x35')](_0x3fcba6['model'],_0x3fcba6['query']);_0x3362b3['attributes']=_[_0x1eeb('0x35')](_0x3fcba6[_0x1eeb('0x36')],qs[_0x1eeb('0x37')](_0x5ae815[_0x1eeb('0x32')][_0x1eeb('0x37')]));_0x3362b3[_0x1eeb('0x38')]=_0x3362b3[_0x1eeb('0x38')][_0x1eeb('0x39')]?_0x3362b3['attributes']:_0x3fcba6['model'];if(!_0x5ae815[_0x1eeb('0x32')]['hasOwnProperty']('nolimit')){_0x3362b3[_0x1eeb('0x1f')]=qs[_0x1eeb('0x1f')](_0x5ae815[_0x1eeb('0x32')][_0x1eeb('0x1f')]);_0x3362b3[_0x1eeb('0x1e')]=qs[_0x1eeb('0x1e')](_0x5ae815['query']['offset']);}_0x3362b3[_0x1eeb('0x3a')]=qs[_0x1eeb('0x3b')](_0x5ae815['query']['sort']);_0x3362b3[_0x1eeb('0x3c')]=qs['filters'](_['pick'](_0x5ae815['query'],_0x3fcba6[_0x1eeb('0x34')]),_0x503798);if(_0x5ae815[_0x1eeb('0x32')][_0x1eeb('0x3d')]){_0x3362b3[_0x1eeb('0x3c')]=_['merge'](_0x3362b3[_0x1eeb('0x3c')],{'$or':_['map'](_0x503798,function(_0x5a35f5){if(_0x5a35f5[_0x1eeb('0x30')]!=='VIRTUAL'){var _0x58e1f5={};_0x58e1f5[_0x5a35f5[_0x1eeb('0x2a')]]={'$like':'%'+_0x5ae815[_0x1eeb('0x32')][_0x1eeb('0x3d')]+'%'};return _0x58e1f5;}})});}_0x3362b3=_[_0x1eeb('0x3e')]({},_0x3362b3,_0x5ae815['options']);var _0x587c04={'where':_0x3362b3['where']};return db['SalesforceAccount'][_0x1eeb('0x21')](_0x587c04)[_0x1eeb('0x27')](function(_0x51ab8e){_0x18fb34[_0x1eeb('0x21')]=_0x51ab8e;if(_0x5ae815['query'][_0x1eeb('0x3f')]){_0x3362b3[_0x1eeb('0x40')]=[{'all':!![]}];}return db[_0x1eeb('0x2e')][_0x1eeb('0x41')](_0x3362b3);})[_0x1eeb('0x27')](function(_0x5314f1){_0x18fb34[_0x1eeb('0x42')]=_0x5314f1;return _0x18fb34;})[_0x1eeb('0x27')](respondWithFilteredResult(_0x51bff1,_0x3362b3))[_0x1eeb('0x43')](handleError(_0x51bff1,null));};exports[_0x1eeb('0x44')]=function(_0x3aafd0,_0x3dc7f2){var _0x38b4d4={'raw':![],'where':{'id':_0x3aafd0[_0x1eeb('0x45')]['id']}},_0x4b5078={};_0x4b5078[_0x1eeb('0x36')]=_[_0x1eeb('0x33')](db['SalesforceAccount'][_0x1eeb('0x2f')]);_0x4b5078[_0x1eeb('0x32')]=_[_0x1eeb('0x33')](_0x3aafd0[_0x1eeb('0x32')]);_0x4b5078['filters']=_[_0x1eeb('0x35')](_0x4b5078[_0x1eeb('0x36')],_0x4b5078[_0x1eeb('0x32')]);_0x38b4d4[_0x1eeb('0x38')]=_[_0x1eeb('0x35')](_0x4b5078['model'],qs[_0x1eeb('0x37')](_0x3aafd0['query'][_0x1eeb('0x37')]));_0x38b4d4[_0x1eeb('0x38')]=_0x38b4d4[_0x1eeb('0x38')][_0x1eeb('0x39')]?_0x38b4d4['attributes']:_0x4b5078[_0x1eeb('0x36')];if(_0x3aafd0[_0x1eeb('0x32')][_0x1eeb('0x3f')]){_0x38b4d4[_0x1eeb('0x40')]=[{'all':!![]}];}_0x38b4d4=_[_0x1eeb('0x3e')]({},_0x38b4d4,_0x3aafd0['options']);return db[_0x1eeb('0x2e')][_0x1eeb('0x46')](_0x38b4d4)[_0x1eeb('0x27')](handleEntityNotFound(_0x3dc7f2,null))[_0x1eeb('0x27')](respondWithResult(_0x3dc7f2,null))[_0x1eeb('0x43')](handleError(_0x3dc7f2,null));};exports[_0x1eeb('0x47')]=function(_0x1a683d,_0x103a1c){return db['SalesforceAccount'][_0x1eeb('0x47')](_0x1a683d[_0x1eeb('0x48')],{})[_0x1eeb('0x27')](respondWithResult(_0x103a1c,0xc9))[_0x1eeb('0x43')](handleError(_0x103a1c,null));};exports[_0x1eeb('0x26')]=function(_0x3da10c,_0x3243bf){if(_0x3da10c['body']['id']){delete _0x3da10c[_0x1eeb('0x48')]['id'];}return db[_0x1eeb('0x2e')][_0x1eeb('0x46')]({'where':{'id':_0x3da10c[_0x1eeb('0x45')]['id']}})[_0x1eeb('0x27')](handleEntityNotFound(_0x3243bf,null))[_0x1eeb('0x27')](saveUpdates(_0x3da10c['body'],null))[_0x1eeb('0x27')](respondWithResult(_0x3243bf,null))[_0x1eeb('0x43')](handleError(_0x3243bf,null));};exports['destroy']=function(_0x5ac642,_0x399ae0){return db['SalesforceAccount'][_0x1eeb('0x46')]({'where':{'id':_0x5ac642['params']['id']}})[_0x1eeb('0x27')](handleEntityNotFound(_0x399ae0,null))['then'](removeEntity(_0x399ae0,null))[_0x1eeb('0x43')](handleError(_0x399ae0,null));};exports[_0x1eeb('0x49')]=function(_0x5a07cd,_0x52a986,_0x209e5a){var _0x3ab9fb={};var _0x41f668={};var _0xd49610;var _0x89e6bd;return db[_0x1eeb('0x2e')]['findOne']({'where':{'id':_0x5a07cd[_0x1eeb('0x45')]['id']}})[_0x1eeb('0x27')](handleEntityNotFound(_0x52a986,null))[_0x1eeb('0x27')](function(_0x57bdd9){if(_0x57bdd9){_0xd49610=_0x57bdd9;_0x41f668[_0x1eeb('0x36')]=_[_0x1eeb('0x33')](db['SalesforceConfiguration']['rawAttributes']);_0x41f668[_0x1eeb('0x32')]=_[_0x1eeb('0x33')](_0x5a07cd[_0x1eeb('0x32')]);_0x41f668[_0x1eeb('0x34')]=_['intersection'](_0x41f668['model'],_0x41f668[_0x1eeb('0x32')]);_0x3ab9fb[_0x1eeb('0x38')]=_[_0x1eeb('0x35')](_0x41f668[_0x1eeb('0x36')],qs[_0x1eeb('0x37')](_0x5a07cd[_0x1eeb('0x32')][_0x1eeb('0x37')]));_0x3ab9fb[_0x1eeb('0x38')]=_0x3ab9fb[_0x1eeb('0x38')][_0x1eeb('0x39')]?_0x3ab9fb[_0x1eeb('0x38')]:_0x41f668[_0x1eeb('0x36')];_0x3ab9fb[_0x1eeb('0x3a')]=qs['sort'](_0x5a07cd[_0x1eeb('0x32')][_0x1eeb('0x3b')]);_0x3ab9fb[_0x1eeb('0x3c')]=qs[_0x1eeb('0x34')](_['pick'](_0x5a07cd['query'],_0x41f668[_0x1eeb('0x34')]));if(_0x5a07cd[_0x1eeb('0x32')][_0x1eeb('0x3d')]){_0x3ab9fb[_0x1eeb('0x3c')]=_[_0x1eeb('0x3e')](_0x3ab9fb['where'],{'$or':_['map'](_0x3ab9fb['attributes'],function(_0x53cf45){var _0x32119d={};_0x32119d[_0x53cf45]={'$like':'%'+_0x5a07cd[_0x1eeb('0x32')][_0x1eeb('0x3d')]+'%'};return _0x32119d;})});}_0x3ab9fb=_['merge']({},_0x3ab9fb,_0x5a07cd[_0x1eeb('0x4a')]);return _0xd49610[_0x1eeb('0x49')](_0x3ab9fb);}})[_0x1eeb('0x27')](function(_0x2154d5){if(_0x2154d5){_0x89e6bd=_0x2154d5[_0x1eeb('0x39')];if(!_0x5a07cd['query'][_0x1eeb('0x4b')](_0x1eeb('0x4c'))){_0x3ab9fb[_0x1eeb('0x1f')]=qs[_0x1eeb('0x1f')](_0x5a07cd['query'][_0x1eeb('0x1f')]);_0x3ab9fb['offset']=qs[_0x1eeb('0x1e')](_0x5a07cd[_0x1eeb('0x32')][_0x1eeb('0x1e')]);}return _0xd49610[_0x1eeb('0x49')](_0x3ab9fb);}})[_0x1eeb('0x27')](function(_0x3e17c7){if(_0x3e17c7){return _0x3e17c7?{'count':_0x89e6bd,'rows':_0x3e17c7}:null;}})[_0x1eeb('0x27')](respondWithResult(_0x52a986,null))[_0x1eeb('0x43')](handleError(_0x52a986,null));};exports[_0x1eeb('0x4d')]=function(_0x2ec502,_0x4f1421,_0x54959c){if(_0x2ec502[_0x1eeb('0x48')]['id']){delete _0x2ec502[_0x1eeb('0x48')]['id'];}return db[_0x1eeb('0x2e')][_0x1eeb('0x4e')]({'where':{'id':_0x2ec502[_0x1eeb('0x45')]['id']}})['then'](handleEntityNotFound(_0x4f1421,null))[_0x1eeb('0x27')](function(_0x54309){if(_0x54309){_0x2ec502[_0x1eeb('0x48')][_0x1eeb('0x4f')]=_0x54309['id'];_0x2ec502[_0x1eeb('0x48')]['Subjects']=integrations['getSubjects'](_0x2ec502[_0x1eeb('0x48')][_0x1eeb('0x50')],_0x2ec502['body']['type']);_0x2ec502['body'][_0x1eeb('0x51')]=integrations['getDescriptions'](_0x2ec502['body'][_0x1eeb('0x50')],_0x2ec502[_0x1eeb('0x48')][_0x1eeb('0x30')]);return db['SalesforceConfiguration'][_0x1eeb('0x47')](_0x2ec502[_0x1eeb('0x48')],{'include':[{'model':db[_0x1eeb('0x52')],'as':_0x1eeb('0x53')},{'model':db[_0x1eeb('0x52')],'as':'Descriptions'}]});}return null;})[_0x1eeb('0x27')](respondWithResult(_0x4f1421,null))[_0x1eeb('0x43')](handleError(_0x4f1421,null));};exports[_0x1eeb('0x54')]=function(_0x3f2d5f,_0x20c43f,_0x62cc1){var _0x212582;var _0x363045='';var _0x3f3a85=_0x1eeb('0x55');return db[_0x1eeb('0x2e')][_0x1eeb('0x4e')]({'where':{'id':_0x3f2d5f['params']['id']},'attributes':['id',_0x1eeb('0x56'),_0x1eeb('0x57'),_0x1eeb('0x58'),_0x1eeb('0x59'),_0x1eeb('0x5a'),_0x1eeb('0x5b')]})[_0x1eeb('0x27')](handleEntityNotFound(_0x20c43f,null))['then'](function(_0x291c50){if(_0x291c50){_0x363045=_0x291c50[_0x1eeb('0x56')];var _0x594eb1=_0x363045[_0x1eeb('0x5c')](-0x1);if(_0x594eb1==='/'){_0x363045=_0x363045[_0x1eeb('0x5d')](0x0,_0x363045[_0x1eeb('0x5e')](_0x594eb1));}_0x212582=new jsforce[(_0x1eeb('0x5f'))]({'oauth2':{'loginUrl':_0x363045,'clientId':_0x291c50[_0x1eeb('0x57')],'clientSecret':_0x291c50[_0x1eeb('0x58')]}});return _0x212582[_0x1eeb('0x60')](_0x291c50[_0x1eeb('0x59')],_0x291c50[_0x1eeb('0x5a')][_0x1eeb('0x61')](_0x291c50[_0x1eeb('0x5b')]));}})[_0x1eeb('0x27')](function(_0x4f50d1){if(_0x4f50d1){if(!_[_0x1eeb('0x62')](_0x3f2d5f['query'][_0x1eeb('0x63')])){_0x3f3a85=_0x3f2d5f[_0x1eeb('0x32')]['ticketType'];}return _0x212582[_0x1eeb('0x64')](_0x3f3a85)[_0x1eeb('0x65')]();}})['then'](function(_0xdd8322){var _0x4bfcf9=[_0x1eeb('0x66'),_0x1eeb('0x67'),'IsReminderSet',_0x1eeb('0x68'),_0x1eeb('0x69'),_0x1eeb('0x6a')];var _0x43d031=[_0x1eeb('0x6b'),_0x1eeb('0x6c'),_0x1eeb('0x6d'),_0x1eeb('0x6e'),_0x1eeb('0x6f'),'textarea',_0x1eeb('0x70')];if(_0xdd8322){_[_0x1eeb('0x71')](_0xdd8322['fields'],function(_0x48ef7b){return _0x4bfcf9[_0x1eeb('0x72')](_0x48ef7b[_0x1eeb('0x2a')])||!_0x43d031[_0x1eeb('0x72')](_0x48ef7b[_0x1eeb('0x30')]);});return{'count':_0xdd8322[_0x1eeb('0x37')][_0x1eeb('0x39')],'rows':_[_0x1eeb('0x2d')](_0xdd8322[_0x1eeb('0x37')],function(_0x481b60){return{'id':_0x481b60[_0x1eeb('0x2a')],'name':_0x481b60[_0x1eeb('0x73')],'custom':_0x481b60['custom'],'options':_0x481b60[_0x1eeb('0x74')][_0x1eeb('0x39')]>0x0?_[_0x1eeb('0x2d')](_0x481b60[_0x1eeb('0x74')],function(_0x5ef273){return{'name':_0x5ef273[_0x1eeb('0x73')],'value':_0x5ef273['value']};}):_0x481b60[_0x1eeb('0x30')]==_0x1eeb('0x6e')?[{'name':'True','value':_0x1eeb('0x75')},{'name':_0x1eeb('0x76'),'value':_0x1eeb('0x77')}]:[]};})};}})[_0x1eeb('0x27')](respondWithResult(_0x20c43f,null))[_0x1eeb('0x43')](function(_0x51c186){var _0x11fbbf=_0x3f2d5f[_0x1eeb('0x32')][_0x1eeb('0x78')]?0x1f4:_0x51c186[_0x1eeb('0x79')]||0x1f4;logger[_0x1eeb('0x29')]('getFields,\x20%s,\x20%s,\x20%s',_0x1eeb('0x54'),_0x11fbbf,JSON['stringify'](_0x51c186));delete _0x51c186['name'];if(_0x11fbbf===0x191){_0x11fbbf=0x190;}_0x20c43f['status'](_0x11fbbf)[_0x1eeb('0x2b')](_0x3f2d5f['query']['test']?{'message':_0x1eeb('0x7a'),'statusCode':_0x51c186['statusCode']}:_0x51c186);});}; \ No newline at end of file +var _0x03b0=['int','picklist','boolean','email','textarea','remove','includes','label','custom','picklistValues','value','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','error','name','send','index','SalesforceAccount','fieldName','key','model','map','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','findOne','getConfigurations','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','remoteUri','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','clientId','login','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','string'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x03b0,0x8a));var _0x003b=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x03b0[_0x2c7618];return _0x5ce3f0;};'use strict';var emlformat=require(_0x003b('0x0'));var rimraf=require(_0x003b('0x1'));var zipdir=require(_0x003b('0x2'));var jsonpatch=require(_0x003b('0x3'));var rp=require(_0x003b('0x4'));var moment=require(_0x003b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x003b('0x6'));var util=require('util');var path=require('path');var sox=require(_0x003b('0x7'));var csv=require(_0x003b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x003b('0x9'));var crypto=require('crypto');var jsforce=require(_0x003b('0xa'));var deskjs=require(_0x003b('0xb'));var toCsv=require(_0x003b('0x8'));var querystring=require('querystring');var Papa=require(_0x003b('0xc'));var Redis=require(_0x003b('0xd'));var authService=require(_0x003b('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x003b('0xf'));var hardwareService=require(_0x003b('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x003b('0x11'));var licenseUtil=require(_0x003b('0x12'));var db=require(_0x003b('0x13'))['db'];var integrations=require(_0x003b('0x14'));function respondWithStatusCode(_0x4e86de,_0x46f895){_0x46f895=_0x46f895||0xcc;return function(_0x53059f){if(_0x53059f){return _0x4e86de['sendStatus'](_0x46f895);}return _0x4e86de[_0x003b('0x15')](_0x46f895)['end']();};}function respondWithResult(_0x5d05fe,_0x2f2d5e){_0x2f2d5e=_0x2f2d5e||0xc8;return function(_0xbda861){if(_0xbda861){return _0x5d05fe['status'](_0x2f2d5e)[_0x003b('0x16')](_0xbda861);}};}function respondWithFilteredResult(_0xdc37fa,_0x3ad7e3){return function(_0x447cbc){if(_0x447cbc){var _0x4243fd=typeof _0x3ad7e3[_0x003b('0x17')]===_0x003b('0x18')&&typeof _0x3ad7e3[_0x003b('0x19')]===_0x003b('0x18');var _0x28d82f=_0x447cbc[_0x003b('0x1a')];var _0x319846=_0x4243fd?0x0:_0x3ad7e3[_0x003b('0x17')];var _0x297c09=_0x4243fd?_0x447cbc['count']:_0x3ad7e3[_0x003b('0x17')]+_0x3ad7e3['limit'];var _0x399178;if(_0x297c09>=_0x28d82f){_0x297c09=_0x28d82f;_0x399178=0xc8;}else{_0x399178=0xce;}_0xdc37fa[_0x003b('0x15')](_0x399178);return _0xdc37fa[_0x003b('0x1b')](_0x003b('0x1c'),_0x319846+'-'+_0x297c09+'/'+_0x28d82f)[_0x003b('0x16')](_0x447cbc);}return null;};}function patchUpdates(_0x27c9c4){return function(_0xfd8a44){try{jsonpatch['apply'](_0xfd8a44,_0x27c9c4,!![]);}catch(_0x533f58){return BPromise['reject'](_0x533f58);}return _0xfd8a44[_0x003b('0x1d')]();};}function saveUpdates(_0x28cb42,_0x437d53){return function(_0x3ec5dd){if(_0x3ec5dd){return _0x3ec5dd[_0x003b('0x1e')](_0x28cb42)[_0x003b('0x1f')](function(_0x2ab627){return _0x2ab627;});}return null;};}function removeEntity(_0x2c69bf,_0x1f7784){return function(_0x2ea8b3){if(_0x2ea8b3){return _0x2ea8b3[_0x003b('0x20')]()[_0x003b('0x1f')](function(){_0x2c69bf[_0x003b('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e642b,_0x2dc4e8){return function(_0x5f34d3){if(!_0x5f34d3){_0x5e642b['sendStatus'](0x194);}return _0x5f34d3;};}function handleError(_0x13878c,_0x2c1460){_0x2c1460=_0x2c1460||0x1f4;return function(_0x4c3276){logger[_0x003b('0x21')](_0x4c3276['stack']);if(_0x4c3276[_0x003b('0x22')]){delete _0x4c3276[_0x003b('0x22')];}_0x13878c[_0x003b('0x15')](_0x2c1460)[_0x003b('0x23')](_0x4c3276);};}exports[_0x003b('0x24')]=function(_0x27bd42,_0x222e41){var _0x5aa6ed={},_0x10f491={},_0x566982={'count':0x0,'rows':[]};var _0xef33f8=_['map'](db[_0x003b('0x25')]['rawAttributes'],function(_0x3df553){return{'name':_0x3df553[_0x003b('0x26')],'type':_0x3df553['type'][_0x003b('0x27')]};});_0x10f491[_0x003b('0x28')]=_[_0x003b('0x29')](_0xef33f8,_0x003b('0x22'));_0x10f491[_0x003b('0x2a')]=_['keys'](_0x27bd42[_0x003b('0x2a')]);_0x10f491['filters']=_['intersection'](_0x10f491[_0x003b('0x28')],_0x10f491[_0x003b('0x2a')]);_0x5aa6ed[_0x003b('0x2b')]=_[_0x003b('0x2c')](_0x10f491[_0x003b('0x28')],qs[_0x003b('0x2d')](_0x27bd42[_0x003b('0x2a')][_0x003b('0x2d')]));_0x5aa6ed[_0x003b('0x2b')]=_0x5aa6ed[_0x003b('0x2b')][_0x003b('0x2e')]?_0x5aa6ed[_0x003b('0x2b')]:_0x10f491[_0x003b('0x28')];if(!_0x27bd42['query'][_0x003b('0x2f')](_0x003b('0x30'))){_0x5aa6ed[_0x003b('0x19')]=qs['limit'](_0x27bd42[_0x003b('0x2a')][_0x003b('0x19')]);_0x5aa6ed[_0x003b('0x17')]=qs[_0x003b('0x17')](_0x27bd42[_0x003b('0x2a')][_0x003b('0x17')]);}_0x5aa6ed[_0x003b('0x31')]=qs[_0x003b('0x32')](_0x27bd42[_0x003b('0x2a')][_0x003b('0x32')]);_0x5aa6ed[_0x003b('0x33')]=qs[_0x003b('0x34')](_[_0x003b('0x35')](_0x27bd42[_0x003b('0x2a')],_0x10f491['filters']),_0xef33f8);if(_0x27bd42[_0x003b('0x2a')][_0x003b('0x36')]){_0x5aa6ed['where']=_[_0x003b('0x37')](_0x5aa6ed[_0x003b('0x33')],{'$or':_[_0x003b('0x29')](_0xef33f8,function(_0x3a0837){if(_0x3a0837[_0x003b('0x38')]!=='VIRTUAL'){var _0x20fc82={};_0x20fc82[_0x3a0837[_0x003b('0x22')]]={'$like':'%'+_0x27bd42[_0x003b('0x2a')][_0x003b('0x36')]+'%'};return _0x20fc82;}})});}_0x5aa6ed=_[_0x003b('0x37')]({},_0x5aa6ed,_0x27bd42[_0x003b('0x39')]);var _0x3f87a7={'where':_0x5aa6ed[_0x003b('0x33')]};return db['SalesforceAccount'][_0x003b('0x1a')](_0x3f87a7)['then'](function(_0x5119bf){_0x566982['count']=_0x5119bf;if(_0x27bd42['query'][_0x003b('0x3a')]){_0x5aa6ed[_0x003b('0x3b')]=[{'all':!![]}];}return db[_0x003b('0x25')][_0x003b('0x3c')](_0x5aa6ed);})[_0x003b('0x1f')](function(_0x19d911){_0x566982[_0x003b('0x3d')]=_0x19d911;return _0x566982;})[_0x003b('0x1f')](respondWithFilteredResult(_0x222e41,_0x5aa6ed))[_0x003b('0x3e')](handleError(_0x222e41,null));};exports[_0x003b('0x3f')]=function(_0x176f63,_0x1ecb9f){var _0x24ba46={'raw':![],'where':{'id':_0x176f63[_0x003b('0x40')]['id']}},_0x44658a={};_0x44658a[_0x003b('0x28')]=_['keys'](db[_0x003b('0x25')]['rawAttributes']);_0x44658a[_0x003b('0x2a')]=_[_0x003b('0x41')](_0x176f63['query']);_0x44658a[_0x003b('0x34')]=_[_0x003b('0x2c')](_0x44658a[_0x003b('0x28')],_0x44658a['query']);_0x24ba46[_0x003b('0x2b')]=_[_0x003b('0x2c')](_0x44658a[_0x003b('0x28')],qs[_0x003b('0x2d')](_0x176f63[_0x003b('0x2a')][_0x003b('0x2d')]));_0x24ba46[_0x003b('0x2b')]=_0x24ba46[_0x003b('0x2b')][_0x003b('0x2e')]?_0x24ba46[_0x003b('0x2b')]:_0x44658a['model'];if(_0x176f63[_0x003b('0x2a')][_0x003b('0x3a')]){_0x24ba46['include']=[{'all':!![]}];}_0x24ba46=_[_0x003b('0x37')]({},_0x24ba46,_0x176f63[_0x003b('0x39')]);return db['SalesforceAccount']['find'](_0x24ba46)[_0x003b('0x1f')](handleEntityNotFound(_0x1ecb9f,null))['then'](respondWithResult(_0x1ecb9f,null))[_0x003b('0x3e')](handleError(_0x1ecb9f,null));};exports[_0x003b('0x42')]=function(_0x46eab3,_0x310f14){return db[_0x003b('0x25')][_0x003b('0x42')](_0x46eab3[_0x003b('0x43')],{})[_0x003b('0x1f')](respondWithResult(_0x310f14,0xc9))[_0x003b('0x3e')](handleError(_0x310f14,null));};exports['update']=function(_0x528427,_0x20184b){if(_0x528427[_0x003b('0x43')]['id']){delete _0x528427[_0x003b('0x43')]['id'];}return db[_0x003b('0x25')][_0x003b('0x44')]({'where':{'id':_0x528427[_0x003b('0x40')]['id']}})['then'](handleEntityNotFound(_0x20184b,null))['then'](saveUpdates(_0x528427['body'],null))[_0x003b('0x1f')](respondWithResult(_0x20184b,null))['catch'](handleError(_0x20184b,null));};exports[_0x003b('0x20')]=function(_0x200f79,_0x496a43){return db[_0x003b('0x25')]['find']({'where':{'id':_0x200f79[_0x003b('0x40')]['id']}})[_0x003b('0x1f')](handleEntityNotFound(_0x496a43,null))[_0x003b('0x1f')](removeEntity(_0x496a43,null))[_0x003b('0x3e')](handleError(_0x496a43,null));};exports['getConfigurations']=function(_0x2472c8,_0x17e59d,_0x48a81b){var _0x311a83={};var _0x53e370={};var _0x1b55c5;var _0x1d153d;return db[_0x003b('0x25')][_0x003b('0x45')]({'where':{'id':_0x2472c8[_0x003b('0x40')]['id']}})['then'](handleEntityNotFound(_0x17e59d,null))[_0x003b('0x1f')](function(_0x359cf5){if(_0x359cf5){_0x1b55c5=_0x359cf5;_0x53e370[_0x003b('0x28')]=_[_0x003b('0x41')](db['SalesforceConfiguration']['rawAttributes']);_0x53e370[_0x003b('0x2a')]=_[_0x003b('0x41')](_0x2472c8[_0x003b('0x2a')]);_0x53e370[_0x003b('0x34')]=_[_0x003b('0x2c')](_0x53e370[_0x003b('0x28')],_0x53e370[_0x003b('0x2a')]);_0x311a83[_0x003b('0x2b')]=_[_0x003b('0x2c')](_0x53e370[_0x003b('0x28')],qs[_0x003b('0x2d')](_0x2472c8['query'][_0x003b('0x2d')]));_0x311a83[_0x003b('0x2b')]=_0x311a83[_0x003b('0x2b')][_0x003b('0x2e')]?_0x311a83[_0x003b('0x2b')]:_0x53e370[_0x003b('0x28')];_0x311a83[_0x003b('0x31')]=qs[_0x003b('0x32')](_0x2472c8[_0x003b('0x2a')][_0x003b('0x32')]);_0x311a83[_0x003b('0x33')]=qs[_0x003b('0x34')](_[_0x003b('0x35')](_0x2472c8[_0x003b('0x2a')],_0x53e370[_0x003b('0x34')]));if(_0x2472c8[_0x003b('0x2a')][_0x003b('0x36')]){_0x311a83['where']=_[_0x003b('0x37')](_0x311a83['where'],{'$or':_[_0x003b('0x29')](_0x311a83[_0x003b('0x2b')],function(_0x5b968f){var _0x5cc512={};_0x5cc512[_0x5b968f]={'$like':'%'+_0x2472c8[_0x003b('0x2a')][_0x003b('0x36')]+'%'};return _0x5cc512;})});}_0x311a83=_['merge']({},_0x311a83,_0x2472c8['options']);return _0x1b55c5[_0x003b('0x46')](_0x311a83);}})[_0x003b('0x1f')](function(_0x433be2){if(_0x433be2){_0x1d153d=_0x433be2[_0x003b('0x2e')];if(!_0x2472c8[_0x003b('0x2a')][_0x003b('0x2f')](_0x003b('0x30'))){_0x311a83[_0x003b('0x19')]=qs[_0x003b('0x19')](_0x2472c8[_0x003b('0x2a')]['limit']);_0x311a83[_0x003b('0x17')]=qs[_0x003b('0x17')](_0x2472c8['query']['offset']);}return _0x1b55c5[_0x003b('0x46')](_0x311a83);}})['then'](function(_0x340a9a){if(_0x340a9a){return _0x340a9a?{'count':_0x1d153d,'rows':_0x340a9a}:null;}})[_0x003b('0x1f')](respondWithResult(_0x17e59d,null))['catch'](handleError(_0x17e59d,null));};exports['addConfiguration']=function(_0x3da525,_0x5f2b11,_0x3a8502){if(_0x3da525[_0x003b('0x43')]['id']){delete _0x3da525['body']['id'];}return db[_0x003b('0x25')][_0x003b('0x45')]({'where':{'id':_0x3da525[_0x003b('0x40')]['id']}})[_0x003b('0x1f')](handleEntityNotFound(_0x5f2b11,null))[_0x003b('0x1f')](function(_0x241cf9){if(_0x241cf9){_0x3da525[_0x003b('0x43')][_0x003b('0x47')]=_0x241cf9['id'];_0x3da525[_0x003b('0x43')][_0x003b('0x48')]=integrations[_0x003b('0x49')](_0x3da525[_0x003b('0x43')][_0x003b('0x4a')],_0x3da525[_0x003b('0x43')][_0x003b('0x38')]);_0x3da525[_0x003b('0x43')][_0x003b('0x4b')]=integrations[_0x003b('0x4c')](_0x3da525['body']['channel'],_0x3da525[_0x003b('0x43')]['type']);return db['SalesforceConfiguration'][_0x003b('0x42')](_0x3da525['body'],{'include':[{'model':db[_0x003b('0x4d')],'as':_0x003b('0x48')},{'model':db[_0x003b('0x4d')],'as':_0x003b('0x4b')}]});}return null;})['then'](respondWithResult(_0x5f2b11,null))[_0x003b('0x3e')](handleError(_0x5f2b11,null));};exports[_0x003b('0x4e')]=function(_0x2a2b65,_0x342537,_0x8abdc1){var _0x22217e;var _0x48be08='';var _0x466d08=_0x003b('0x4f');return db[_0x003b('0x25')]['findOne']({'where':{'id':_0x2a2b65[_0x003b('0x40')]['id']},'attributes':['id',_0x003b('0x50'),'clientId',_0x003b('0x51'),_0x003b('0x52'),_0x003b('0x53'),_0x003b('0x54')]})[_0x003b('0x1f')](handleEntityNotFound(_0x342537,null))[_0x003b('0x1f')](function(_0xcc1e06){if(_0xcc1e06){_0x48be08=_0xcc1e06[_0x003b('0x50')];var _0x584b31=_0x48be08[_0x003b('0x55')](-0x1);if(_0x584b31==='/'){_0x48be08=_0x48be08[_0x003b('0x56')](0x0,_0x48be08[_0x003b('0x57')](_0x584b31));}_0x22217e=new jsforce['Connection']({'oauth2':{'loginUrl':_0x48be08,'clientId':_0xcc1e06[_0x003b('0x58')],'clientSecret':_0xcc1e06[_0x003b('0x51')]}});return _0x22217e[_0x003b('0x59')](_0xcc1e06['username'],_0xcc1e06[_0x003b('0x53')]['concat'](_0xcc1e06[_0x003b('0x54')]));}})['then'](function(_0x2090bd){if(_0x2090bd){if(!_[_0x003b('0x5a')](_0x2a2b65[_0x003b('0x2a')][_0x003b('0x5b')])){_0x466d08=_0x2a2b65[_0x003b('0x2a')]['ticketType'];}return _0x22217e[_0x003b('0x5c')](_0x466d08)[_0x003b('0x5d')]();}})[_0x003b('0x1f')](function(_0x2bb488){var _0x6b6336=[_0x003b('0x5e'),_0x003b('0x5f'),_0x003b('0x60'),_0x003b('0x61'),_0x003b('0x62'),'Description'];var _0x57511e=[_0x003b('0x63'),_0x003b('0x64'),_0x003b('0x65'),_0x003b('0x66'),_0x003b('0x67'),_0x003b('0x68'),'phone'];if(_0x2bb488){_[_0x003b('0x69')](_0x2bb488[_0x003b('0x2d')],function(_0x1b3d4d){return _0x6b6336[_0x003b('0x6a')](_0x1b3d4d[_0x003b('0x22')])||!_0x57511e[_0x003b('0x6a')](_0x1b3d4d[_0x003b('0x38')]);});return{'count':_0x2bb488[_0x003b('0x2d')][_0x003b('0x2e')],'rows':_[_0x003b('0x29')](_0x2bb488[_0x003b('0x2d')],function(_0x47fba6){return{'id':_0x47fba6[_0x003b('0x22')],'name':_0x47fba6[_0x003b('0x6b')],'custom':_0x47fba6[_0x003b('0x6c')],'options':_0x47fba6[_0x003b('0x6d')][_0x003b('0x2e')]>0x0?_[_0x003b('0x29')](_0x47fba6['picklistValues'],function(_0x2dd39a){return{'name':_0x2dd39a[_0x003b('0x6b')],'value':_0x2dd39a[_0x003b('0x6e')]};}):_0x47fba6[_0x003b('0x38')]==_0x003b('0x66')?[{'name':_0x003b('0x6f'),'value':_0x003b('0x70')},{'name':_0x003b('0x71'),'value':_0x003b('0x72')}]:[]};})};}})[_0x003b('0x1f')](respondWithResult(_0x342537,null))[_0x003b('0x3e')](function(_0x3cfda4){var _0x3c0a38=_0x2a2b65[_0x003b('0x2a')][_0x003b('0x73')]?0x1f4:_0x3cfda4[_0x003b('0x74')]||0x1f4;logger['error'](_0x003b('0x75'),_0x003b('0x4e'),_0x3c0a38,JSON[_0x003b('0x76')](_0x3cfda4));delete _0x3cfda4[_0x003b('0x22')];if(_0x3c0a38===0x191){_0x3c0a38=0x190;}_0x342537[_0x003b('0x15')](_0x3c0a38)[_0x003b('0x23')](_0x2a2b65['query'][_0x003b('0x73')]?{'message':'Wrong\x20credentials','statusCode':_0x3cfda4[_0x003b('0x74')]}:_0x3cfda4);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 143c81e..e7b6076 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 _0x32d1=['bluebird','request-promise','path','rimraf','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api'];(function(_0x267f9b,_0x22441c){var _0x3ea5a6=function(_0x1e0361){while(--_0x1e0361){_0x267f9b['push'](_0x267f9b['shift']());}};_0x3ea5a6(++_0x22441c);}(_0x32d1,0x1ae));var _0x132d=function(_0x2d7827,_0x5afb3d){_0x2d7827=_0x2d7827-0x0;var _0x2ef080=_0x32d1[_0x2d7827];return _0x2ef080;};'use strict';var _=require(_0x132d('0x0'));var util=require(_0x132d('0x1'));var logger=require(_0x132d('0x2'))(_0x132d('0x3'));var moment=require('moment');var BPromise=require(_0x132d('0x4'));var rp=require(_0x132d('0x5'));var fs=require('fs');var path=require(_0x132d('0x6'));var rimraf=require(_0x132d('0x7'));var config=require('../../config/environment');var attributes=require(_0x132d('0x8'));var integrations=require(_0x132d('0x9'));module[_0x132d('0xa')]=function(_0x1937bf,_0x1085ff){return _0x1937bf[_0x132d('0xb')](_0x132d('0xc'),attributes,{'tableName':_0x132d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb13=['SalesforceAccount','int_salesforce_accounts','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x4408d5,_0x42c1ab){var _0x22c585=function(_0x23020e){while(--_0x23020e){_0x4408d5['push'](_0x4408d5['shift']());}};_0x22c585(++_0x42c1ab);}(_0xdb13,0x10c));var _0x3db1=function(_0x49a310,_0xfb9616){_0x49a310=_0x49a310-0x0;var _0xc329f8=_0xdb13[_0x49a310];return _0xc329f8;};'use strict';var _=require('lodash');var util=require(_0x3db1('0x0'));var logger=require(_0x3db1('0x1'))(_0x3db1('0x2'));var moment=require(_0x3db1('0x3'));var BPromise=require(_0x3db1('0x4'));var rp=require(_0x3db1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3db1('0x6'));var config=require(_0x3db1('0x7'));var attributes=require(_0x3db1('0x8'));var integrations=require(_0x3db1('0x9'));module[_0x3db1('0xa')]=function(_0x5a2345,_0x37ae52){return _0x5a2345[_0x3db1('0xb')](_0x3db1('0xc'),attributes,{'tableName':_0x3db1('0xd'),'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 a7eb802..8301e08 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 _0xccad=['options','where','limit','include','attributes','map','model','debug','find','raw','ShowSalesforceAccount','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetSalesforceAccount'];(function(_0x141fce,_0xbb33ff){var _0x569f4a=function(_0x3b21ef){while(--_0x3b21ef){_0x141fce['push'](_0x141fce['shift']());}};_0x569f4a(++_0xbb33ff);}(_0xccad,0x10b));var _0xdcca=function(_0x2906e6,_0x5ccd59){_0x2906e6=_0x2906e6-0x0;var _0x12517a=_0xccad[_0x2906e6];return _0x12517a;};'use strict';var _=require(_0xdcca('0x0'));var util=require(_0xdcca('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdcca('0x2'));var db=require(_0xdcca('0x3'))['db'];var utils=require(_0xdcca('0x4'));var logger=require(_0xdcca('0x5'))('rpc');var config=require(_0xdcca('0x6'));var jayson=require(_0xdcca('0x7'));var client=jayson['client'][_0xdcca('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5c6ed4,_0x4713d8,_0x4ba009){return new BPromise(function(_0x15ffb1,_0x3f1c64){return client[_0xdcca('0x9')](_0x5c6ed4,_0x4ba009)[_0xdcca('0xa')](function(_0x2ec45b){logger[_0xdcca('0xb')](_0xdcca('0xc'),_0x4713d8,_0xdcca('0xd'));logger['debug'](_0xdcca('0xe'),_0x4713d8,'request\x20sent',JSON[_0xdcca('0xf')](_0x2ec45b));if(_0x2ec45b[_0xdcca('0x10')]){if(_0x2ec45b[_0xdcca('0x10')][_0xdcca('0x11')]===0x1f4){logger[_0xdcca('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x4713d8,_0x2ec45b[_0xdcca('0x10')][_0xdcca('0x12')]);return _0x3f1c64(_0x2ec45b[_0xdcca('0x10')][_0xdcca('0x12')]);}logger[_0xdcca('0x10')](_0xdcca('0xc'),_0x4713d8,_0x2ec45b[_0xdcca('0x10')][_0xdcca('0x12')]);return _0x15ffb1(_0x2ec45b['error'][_0xdcca('0x12')]);}else{logger[_0xdcca('0xb')]('SalesforceAccount,\x20%s,\x20%s',_0x4713d8,_0xdcca('0xd'));_0x15ffb1(_0x2ec45b['result']['message']);}})[_0xdcca('0x13')](function(_0x18ceb6){logger[_0xdcca('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x4713d8,_0x18ceb6);_0x3f1c64(_0x18ceb6);});});}exports[_0xdcca('0x14')]=function(_0xe0942a){var _0xb755c1=this;return new Promise(function(_0x5a7285,_0x44dcae){return db['SalesforceAccount']['findAll']({'raw':_0xe0942a[_0xdcca('0x15')]?_0xe0942a['options']['raw']===undefined?!![]:![]:!![],'where':_0xe0942a['options']?_0xe0942a[_0xdcca('0x15')][_0xdcca('0x16')]||null:null,'attributes':_0xe0942a[_0xdcca('0x15')]?_0xe0942a[_0xdcca('0x15')]['attributes']||null:null,'limit':_0xe0942a[_0xdcca('0x15')]?_0xe0942a[_0xdcca('0x15')][_0xdcca('0x17')]||null:null,'include':_0xe0942a[_0xdcca('0x15')]?_0xe0942a[_0xdcca('0x15')]['include']?_['map'](_0xe0942a['options'][_0xdcca('0x18')],function(_0x2d2092){return{'model':db[_0x2d2092['model']],'as':_0x2d2092['as'],'attributes':_0x2d2092[_0xdcca('0x19')],'include':_0x2d2092['include']?_[_0xdcca('0x1a')](_0x2d2092[_0xdcca('0x18')],function(_0x59ad27){return{'model':db[_0x59ad27[_0xdcca('0x1b')]],'as':_0x59ad27['as'],'attributes':_0x59ad27[_0xdcca('0x19')],'include':_0x59ad27['include']?_['map'](_0x59ad27[_0xdcca('0x18')],function(_0x503dd3){return{'model':db[_0x503dd3[_0xdcca('0x1b')]],'as':_0x503dd3['as'],'attributes':_0x503dd3[_0xdcca('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f6b32){logger[_0xdcca('0xb')](_0xdcca('0x14'),_0xe0942a);logger[_0xdcca('0x1c')]('GetSalesforceAccount',_0xe0942a,JSON[_0xdcca('0xf')](_0x4f6b32));_0x5a7285(_0x4f6b32);})[_0xdcca('0x13')](function(_0x697975){logger['error']('GetSalesforceAccount',_0x697975['message'],_0xe0942a);_0x44dcae(_0xb755c1['error'](0x1f4,_0x697975[_0xdcca('0x12')]));});});};exports['ShowSalesforceAccount']=function(_0xef4d49){var _0x3f082e=this;return new Promise(function(_0x9150e7,_0x2646ab){return db['SalesforceAccount'][_0xdcca('0x1d')]({'raw':_0xef4d49[_0xdcca('0x15')]?_0xef4d49[_0xdcca('0x15')][_0xdcca('0x1e')]===undefined?!![]:![]:!![],'where':_0xef4d49['options']?_0xef4d49[_0xdcca('0x15')]['where']||null:null,'attributes':_0xef4d49[_0xdcca('0x15')]?_0xef4d49['options']['attributes']||null:null,'include':_0xef4d49[_0xdcca('0x15')]?_0xef4d49[_0xdcca('0x15')][_0xdcca('0x18')]?_[_0xdcca('0x1a')](_0xef4d49[_0xdcca('0x15')][_0xdcca('0x18')],function(_0xb1df5e){return{'model':db[_0xb1df5e[_0xdcca('0x1b')]],'as':_0xb1df5e['as'],'attributes':_0xb1df5e[_0xdcca('0x19')],'include':_0xb1df5e[_0xdcca('0x18')]?_[_0xdcca('0x1a')](_0xb1df5e[_0xdcca('0x18')],function(_0xa736c7){return{'model':db[_0xa736c7['model']],'as':_0xa736c7['as'],'attributes':_0xa736c7[_0xdcca('0x19')],'include':_0xa736c7[_0xdcca('0x18')]?_[_0xdcca('0x1a')](_0xa736c7[_0xdcca('0x18')],function(_0x1be3fd){return{'model':db[_0x1be3fd[_0xdcca('0x1b')]],'as':_0x1be3fd['as'],'attributes':_0x1be3fd['attributes']};}):[]};}):[]};}):[]:[]})[_0xdcca('0xa')](function(_0x514f07){logger[_0xdcca('0xb')](_0xdcca('0x1f'),_0xef4d49);logger[_0xdcca('0x1c')]('ShowSalesforceAccount',_0xef4d49,JSON[_0xdcca('0xf')](_0x514f07));_0x9150e7(_0x514f07);})['catch'](function(_0x3740d5){logger[_0xdcca('0x10')](_0xdcca('0x1f'),_0x3740d5[_0xdcca('0x12')],_0xef4d49);_0x2646ab(_0x3f082e[_0xdcca('0x10')](0x1f4,_0x3740d5[_0xdcca('0x12')]));});});}; \ No newline at end of file +var _0x6068=['SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowSalesforceAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info'];(function(_0x555882,_0x263448){var _0x31c915=function(_0x53bb19){while(--_0x53bb19){_0x555882['push'](_0x555882['shift']());}};_0x31c915(++_0x263448);}(_0x6068,0x81));var _0x8606=function(_0x3e149c,_0x53c1d1){_0x3e149c=_0x3e149c-0x0;var _0xcb8a2d=_0x6068[_0x3e149c];return _0xcb8a2d;};'use strict';var _=require(_0x8606('0x0'));var util=require(_0x8606('0x1'));var moment=require(_0x8606('0x2'));var BPromise=require(_0x8606('0x3'));var rs=require(_0x8606('0x4'));var fs=require('fs');var Redis=require(_0x8606('0x5'));var db=require(_0x8606('0x6'))['db'];var utils=require(_0x8606('0x7'));var logger=require(_0x8606('0x8'))(_0x8606('0x9'));var config=require(_0x8606('0xa'));var jayson=require(_0x8606('0xb'));var client=jayson['client'][_0x8606('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3139ef,_0x56c790,_0x44e01c){return new BPromise(function(_0x1b9ed4,_0x13959d){return client['request'](_0x3139ef,_0x44e01c)[_0x8606('0xd')](function(_0x22b92b){logger[_0x8606('0xe')](_0x8606('0xf'),_0x56c790,_0x8606('0x10'));logger['debug'](_0x8606('0x11'),_0x56c790,'request\x20sent',JSON['stringify'](_0x22b92b));if(_0x22b92b[_0x8606('0x12')]){if(_0x22b92b[_0x8606('0x12')][_0x8606('0x13')]===0x1f4){logger['error'](_0x8606('0xf'),_0x56c790,_0x22b92b[_0x8606('0x12')][_0x8606('0x14')]);return _0x13959d(_0x22b92b['error']['message']);}logger[_0x8606('0x12')]('SalesforceAccount,\x20%s,\x20%s',_0x56c790,_0x22b92b[_0x8606('0x12')][_0x8606('0x14')]);return _0x1b9ed4(_0x22b92b[_0x8606('0x12')][_0x8606('0x14')]);}else{logger[_0x8606('0xe')](_0x8606('0xf'),_0x56c790,_0x8606('0x10'));_0x1b9ed4(_0x22b92b[_0x8606('0x15')][_0x8606('0x14')]);}})[_0x8606('0x16')](function(_0xd7559f){logger[_0x8606('0x12')](_0x8606('0xf'),_0x56c790,_0xd7559f);_0x13959d(_0xd7559f);});});}exports[_0x8606('0x17')]=function(_0x58cd73){var _0x1a3693=this;return new Promise(function(_0x237d82,_0x57d902){return db[_0x8606('0x18')][_0x8606('0x19')]({'raw':_0x58cd73[_0x8606('0x1a')]?_0x58cd73[_0x8606('0x1a')][_0x8606('0x1b')]===undefined?!![]:![]:!![],'where':_0x58cd73['options']?_0x58cd73['options'][_0x8606('0x1c')]||null:null,'attributes':_0x58cd73[_0x8606('0x1a')]?_0x58cd73['options'][_0x8606('0x1d')]||null:null,'limit':_0x58cd73[_0x8606('0x1a')]?_0x58cd73[_0x8606('0x1a')][_0x8606('0x1e')]||null:null,'include':_0x58cd73[_0x8606('0x1a')]?_0x58cd73[_0x8606('0x1a')][_0x8606('0x1f')]?_[_0x8606('0x20')](_0x58cd73[_0x8606('0x1a')][_0x8606('0x1f')],function(_0x5bf43e){return{'model':db[_0x5bf43e[_0x8606('0x21')]],'as':_0x5bf43e['as'],'attributes':_0x5bf43e[_0x8606('0x1d')],'include':_0x5bf43e[_0x8606('0x1f')]?_[_0x8606('0x20')](_0x5bf43e['include'],function(_0x3747e3){return{'model':db[_0x3747e3[_0x8606('0x21')]],'as':_0x3747e3['as'],'attributes':_0x3747e3['attributes'],'include':_0x3747e3[_0x8606('0x1f')]?_[_0x8606('0x20')](_0x3747e3[_0x8606('0x1f')],function(_0x2a4e16){return{'model':db[_0x2a4e16[_0x8606('0x21')]],'as':_0x2a4e16['as'],'attributes':_0x2a4e16[_0x8606('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8606('0xd')](function(_0x323f8c){logger[_0x8606('0xe')]('GetSalesforceAccount',_0x58cd73);logger['debug'](_0x8606('0x17'),_0x58cd73,JSON[_0x8606('0x22')](_0x323f8c));_0x237d82(_0x323f8c);})[_0x8606('0x16')](function(_0x73f8d1){logger[_0x8606('0x12')]('GetSalesforceAccount',_0x73f8d1[_0x8606('0x14')],_0x58cd73);_0x57d902(_0x1a3693[_0x8606('0x12')](0x1f4,_0x73f8d1['message']));});});};exports[_0x8606('0x23')]=function(_0x5d4631){var _0x339703=this;return new Promise(function(_0x346a7c,_0x2c463b){return db[_0x8606('0x18')]['find']({'raw':_0x5d4631[_0x8606('0x1a')]?_0x5d4631[_0x8606('0x1a')][_0x8606('0x1b')]===undefined?!![]:![]:!![],'where':_0x5d4631[_0x8606('0x1a')]?_0x5d4631['options'][_0x8606('0x1c')]||null:null,'attributes':_0x5d4631[_0x8606('0x1a')]?_0x5d4631[_0x8606('0x1a')][_0x8606('0x1d')]||null:null,'include':_0x5d4631[_0x8606('0x1a')]?_0x5d4631[_0x8606('0x1a')][_0x8606('0x1f')]?_[_0x8606('0x20')](_0x5d4631[_0x8606('0x1a')][_0x8606('0x1f')],function(_0x480d46){return{'model':db[_0x480d46[_0x8606('0x21')]],'as':_0x480d46['as'],'attributes':_0x480d46[_0x8606('0x1d')],'include':_0x480d46['include']?_['map'](_0x480d46[_0x8606('0x1f')],function(_0x3ef36d){return{'model':db[_0x3ef36d['model']],'as':_0x3ef36d['as'],'attributes':_0x3ef36d[_0x8606('0x1d')],'include':_0x3ef36d[_0x8606('0x1f')]?_[_0x8606('0x20')](_0x3ef36d[_0x8606('0x1f')],function(_0x4fa57a){return{'model':db[_0x4fa57a[_0x8606('0x21')]],'as':_0x4fa57a['as'],'attributes':_0x4fa57a['attributes']};}):[]};}):[]};}):[]:[]})[_0x8606('0xd')](function(_0x1f8b35){logger[_0x8606('0xe')](_0x8606('0x23'),_0x5d4631);logger['debug'](_0x8606('0x23'),_0x5d4631,JSON[_0x8606('0x22')](_0x1f8b35));_0x346a7c(_0x1f8b35);})[_0x8606('0x16')](function(_0x467163){logger['error'](_0x8606('0x23'),_0x467163[_0x8606('0x14')],_0x5d4631);_0x2c463b(_0x339703[_0x8606('0x12')](0x1f4,_0x467163[_0x8606('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index d4fb3de..dfd4a0a 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xdb28,0x106));var _0x8db2=function(_0x4b8d76,_0x50a2ce){_0x4b8d76=_0x4b8d76-0x0;var _0x579903=_0xdb28[_0x4b8d76];return _0x579903;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./intSalesforceConfiguration.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('0x17')]=router; \ No newline at end of file +var _0x7a54=['getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','index','/:id','isAuthenticated','/:id/subjects'];(function(_0x323f2e,_0x1b10da){var _0x4b3539=function(_0x487322){while(--_0x487322){_0x323f2e['push'](_0x323f2e['shift']());}};_0x4b3539(++_0x1b10da);}(_0x7a54,0x106));var _0x47a5=function(_0x39d1ff,_0x5b3bbd){_0x39d1ff=_0x39d1ff-0x0;var _0x3422e3=_0x7a54[_0x39d1ff];return _0x3422e3;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/descriptions',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x12')](_0x47a5('0xb'),auth['isAuthenticated'](),controller[_0x47a5('0x13')]);router[_0x47a5('0x14')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x15')]);module[_0x47a5('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 44f78d0..fc422a7 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 _0xb1f8=['account_contact_lead','account','nothing','exports','STRING','ENUM','Task','Case','contact_lead','contact','lead'];(function(_0x4742d7,_0x356348){var _0x3c7599=function(_0x4de742){while(--_0x4de742){_0x4742d7['push'](_0x4742d7['shift']());}};_0x3c7599(++_0x356348);}(_0xb1f8,0x1a5));var _0x8b1f=function(_0x53d855,_0x94e72a){_0x53d855=_0x53d855-0x0;var _0x41ea0a=_0xb1f8[_0x53d855];return _0x41ea0a;};'use strict';var Sequelize=require('sequelize');module[_0x8b1f('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8b1f('0x1')]},'ticketType':{'type':Sequelize[_0x8b1f('0x2')](_0x8b1f('0x3'),_0x8b1f('0x4')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x8b1f('0x2')](_0x8b1f('0x5'),_0x8b1f('0x6'),_0x8b1f('0x7'),_0x8b1f('0x8'),_0x8b1f('0x9')),'defaultValue':_0x8b1f('0x5')},'moduleCreate':{'type':Sequelize[_0x8b1f('0x2')](_0x8b1f('0xa'),'contact',_0x8b1f('0x7'),_0x8b1f('0x9')),'defaultValue':_0x8b1f('0x7')},'leadId':{'type':Sequelize[_0x8b1f('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x8b1f('0x1')]},'additionalSearchContact':{'type':Sequelize[_0x8b1f('0x1')]},'additionalSearchLead':{'type':Sequelize[_0x8b1f('0x1')]}}; \ No newline at end of file +var _0x6d11=['nothing','sequelize','exports','STRING','ENUM','Task','Case','contact','lead','account','contact_lead'];(function(_0x1a4c27,_0x5a4b45){var _0x578d9=function(_0x10b6df){while(--_0x10b6df){_0x1a4c27['push'](_0x1a4c27['shift']());}};_0x578d9(++_0x5a4b45);}(_0x6d11,0x1c4));var _0x16d1=function(_0x18417a,_0x1376af){_0x18417a=_0x18417a-0x0;var _0x39e00c=_0x6d11[_0x18417a];return _0x39e00c;};'use strict';var Sequelize=require(_0x16d1('0x0'));module[_0x16d1('0x1')]={'name':{'type':Sequelize[_0x16d1('0x2')]},'description':{'type':Sequelize[_0x16d1('0x2')]},'ticketType':{'type':Sequelize[_0x16d1('0x3')](_0x16d1('0x4'),_0x16d1('0x5')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0x16d1('0x6'),_0x16d1('0x7'),'account_contact_lead',_0x16d1('0x8')),'defaultValue':_0x16d1('0x9')},'moduleCreate':{'type':Sequelize[_0x16d1('0x3')](_0x16d1('0xa'),'contact','lead','account'),'defaultValue':_0x16d1('0x7')},'leadId':{'type':Sequelize[_0x16d1('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x16d1('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x16d1('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x16d1('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index ef6e073..2e99000 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 _0x15b6=['type','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','catch','create','body','find','getFields','SalesforceField','order','hasOwnProperty','getSubjects','getDescriptions','options','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge'];(function(_0x46e570,_0x42f992){var _0x1bd1ab=function(_0x4cbcaf){while(--_0x4cbcaf){_0x46e570['push'](_0x46e570['shift']());}};_0x1bd1ab(++_0x42f992);}(_0x15b6,0x1a9));var _0x615b=function(_0x3bbc1e,_0x2dfc0e){_0x3bbc1e=_0x3bbc1e-0x0;var _0x373bc2=_0x15b6[_0x3bbc1e];return _0x373bc2;};'use strict';var emlformat=require(_0x615b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x615b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x615b('0x2'));var moment=require(_0x615b('0x3'));var BPromise=require(_0x615b('0x4'));var Mustache=require('mustache');var util=require(_0x615b('0x5'));var path=require(_0x615b('0x6'));var sox=require(_0x615b('0x7'));var csv=require(_0x615b('0x8'));var ejs=require(_0x615b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x615b('0xa'));var squel=require('squel');var crypto=require(_0x615b('0xb'));var jsforce=require(_0x615b('0xc'));var deskjs=require(_0x615b('0xd'));var toCsv=require(_0x615b('0x8'));var querystring=require(_0x615b('0xe'));var Papa=require('papaparse');var Redis=require(_0x615b('0xf'));var authService=require(_0x615b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x615b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x615b('0x12'))(_0x615b('0x13'));var utils=require(_0x615b('0x14'));var config=require(_0x615b('0x15'));var licenseUtil=require(_0x615b('0x16'));var db=require(_0x615b('0x17'))['db'];function respondWithStatusCode(_0x1c842c,_0x582371){_0x582371=_0x582371||0xcc;return function(_0x742072){if(_0x742072){return _0x1c842c[_0x615b('0x18')](_0x582371);}return _0x1c842c[_0x615b('0x19')](_0x582371)[_0x615b('0x1a')]();};}function respondWithResult(_0x170f14,_0x29a888){_0x29a888=_0x29a888||0xc8;return function(_0x2065a4){if(_0x2065a4){return _0x170f14[_0x615b('0x19')](_0x29a888)[_0x615b('0x1b')](_0x2065a4);}};}function respondWithFilteredResult(_0xb9539e,_0x2f6ba1){return function(_0x2a6b24){if(_0x2a6b24){var _0x7c25df=typeof _0x2f6ba1[_0x615b('0x1c')]===_0x615b('0x1d')&&typeof _0x2f6ba1[_0x615b('0x1e')]===_0x615b('0x1d');var _0x50609a=_0x2a6b24[_0x615b('0x1f')];var _0x1e93ae=_0x7c25df?0x0:_0x2f6ba1[_0x615b('0x1c')];var _0x319949=_0x7c25df?_0x2a6b24[_0x615b('0x1f')]:_0x2f6ba1['offset']+_0x2f6ba1[_0x615b('0x1e')];var _0x39d175;if(_0x319949>=_0x50609a){_0x319949=_0x50609a;_0x39d175=0xc8;}else{_0x39d175=0xce;}_0xb9539e[_0x615b('0x19')](_0x39d175);return _0xb9539e[_0x615b('0x20')]('Content-Range',_0x1e93ae+'-'+_0x319949+'/'+_0x50609a)['json'](_0x2a6b24);}return null;};}function patchUpdates(_0x51cf57){return function(_0x293df8){try{jsonpatch[_0x615b('0x21')](_0x293df8,_0x51cf57,!![]);}catch(_0x562daa){return BPromise[_0x615b('0x22')](_0x562daa);}return _0x293df8[_0x615b('0x23')]();};}function saveUpdates(_0x280136,_0x1f5fb0){return function(_0x51c4c9){if(_0x51c4c9){return _0x51c4c9[_0x615b('0x24')](_0x280136)[_0x615b('0x25')](function(_0x49a4a3){return _0x49a4a3;});}return null;};}function removeEntity(_0xb82355,_0x26d258){return function(_0x586d74){if(_0x586d74){return _0x586d74[_0x615b('0x26')]()[_0x615b('0x25')](function(){_0xb82355[_0x615b('0x19')](0xcc)[_0x615b('0x1a')]();});}};}function handleEntityNotFound(_0x34faa2,_0x92ec32){return function(_0x39c126){if(!_0x39c126){_0x34faa2[_0x615b('0x18')](0x194);}return _0x39c126;};}function handleError(_0x1f0c62,_0x27b066){_0x27b066=_0x27b066||0x1f4;return function(_0x1a5b69){logger[_0x615b('0x27')](_0x1a5b69['stack']);if(_0x1a5b69[_0x615b('0x28')]){delete _0x1a5b69[_0x615b('0x28')];}_0x1f0c62['status'](_0x27b066)[_0x615b('0x29')](_0x1a5b69);};}exports[_0x615b('0x2a')]=function(_0x499e94,_0x2d5fe9){var _0x307c99={},_0xfff2f4={},_0xb67d5c={'count':0x0,'rows':[]};var _0x488f55=_[_0x615b('0x2b')](db[_0x615b('0x2c')][_0x615b('0x2d')],function(_0x3c6f0c){return{'name':_0x3c6f0c[_0x615b('0x2e')],'type':_0x3c6f0c['type'][_0x615b('0x2f')]};});_0xfff2f4[_0x615b('0x30')]=_[_0x615b('0x2b')](_0x488f55,_0x615b('0x28'));_0xfff2f4[_0x615b('0x31')]=_['keys'](_0x499e94[_0x615b('0x31')]);_0xfff2f4[_0x615b('0x32')]=_[_0x615b('0x33')](_0xfff2f4[_0x615b('0x30')],_0xfff2f4[_0x615b('0x31')]);_0x307c99[_0x615b('0x34')]=_[_0x615b('0x33')](_0xfff2f4[_0x615b('0x30')],qs[_0x615b('0x35')](_0x499e94[_0x615b('0x31')][_0x615b('0x35')]));_0x307c99[_0x615b('0x34')]=_0x307c99['attributes'][_0x615b('0x36')]?_0x307c99['attributes']:_0xfff2f4['model'];if(!_0x499e94['query']['hasOwnProperty'](_0x615b('0x37'))){_0x307c99[_0x615b('0x1e')]=qs[_0x615b('0x1e')](_0x499e94[_0x615b('0x31')][_0x615b('0x1e')]);_0x307c99[_0x615b('0x1c')]=qs['offset'](_0x499e94[_0x615b('0x31')][_0x615b('0x1c')]);}_0x307c99['order']=qs['sort'](_0x499e94['query'][_0x615b('0x38')]);_0x307c99[_0x615b('0x39')]=qs[_0x615b('0x32')](_[_0x615b('0x3a')](_0x499e94[_0x615b('0x31')],_0xfff2f4[_0x615b('0x32')]),_0x488f55);if(_0x499e94[_0x615b('0x31')][_0x615b('0x3b')]){_0x307c99[_0x615b('0x39')]=_[_0x615b('0x3c')](_0x307c99['where'],{'$or':_[_0x615b('0x2b')](_0x488f55,function(_0x46e28d){if(_0x46e28d[_0x615b('0x3d')]!==_0x615b('0x3e')){var _0x146008={};_0x146008[_0x46e28d[_0x615b('0x28')]]={'$like':'%'+_0x499e94[_0x615b('0x31')]['filter']+'%'};return _0x146008;}})});}_0x307c99=_[_0x615b('0x3c')]({},_0x307c99,_0x499e94['options']);var _0x3e50fe={'where':_0x307c99[_0x615b('0x39')]};return db[_0x615b('0x2c')][_0x615b('0x1f')](_0x3e50fe)['then'](function(_0x42d5d5){_0xb67d5c[_0x615b('0x1f')]=_0x42d5d5;if(_0x499e94['query'][_0x615b('0x3f')]){_0x307c99[_0x615b('0x40')]=[{'all':!![]}];}return db[_0x615b('0x2c')][_0x615b('0x41')](_0x307c99);})[_0x615b('0x25')](function(_0x490f5e){_0xb67d5c[_0x615b('0x42')]=_0x490f5e;return _0xb67d5c;})[_0x615b('0x25')](respondWithFilteredResult(_0x2d5fe9,_0x307c99))['catch'](handleError(_0x2d5fe9,null));};exports[_0x615b('0x43')]=function(_0x29482b,_0x48ed54){var _0x3ff478={'raw':![],'where':{'id':_0x29482b[_0x615b('0x44')]['id']}},_0x59d3ba={};_0x59d3ba[_0x615b('0x30')]=_[_0x615b('0x45')](db['SalesforceConfiguration'][_0x615b('0x2d')]);_0x59d3ba[_0x615b('0x31')]=_['keys'](_0x29482b[_0x615b('0x31')]);_0x59d3ba[_0x615b('0x32')]=_[_0x615b('0x33')](_0x59d3ba[_0x615b('0x30')],_0x59d3ba['query']);_0x3ff478['attributes']=_['intersection'](_0x59d3ba[_0x615b('0x30')],qs[_0x615b('0x35')](_0x29482b[_0x615b('0x31')][_0x615b('0x35')]));_0x3ff478['attributes']=_0x3ff478[_0x615b('0x34')][_0x615b('0x36')]?_0x3ff478[_0x615b('0x34')]:_0x59d3ba[_0x615b('0x30')];if(_0x29482b[_0x615b('0x31')][_0x615b('0x3f')]){_0x3ff478['include']=[{'all':!![]}];}_0x3ff478=_[_0x615b('0x3c')]({},_0x3ff478,_0x29482b['options']);return db[_0x615b('0x2c')]['find'](_0x3ff478)['then'](handleEntityNotFound(_0x48ed54,null))[_0x615b('0x25')](respondWithResult(_0x48ed54,null))[_0x615b('0x46')](handleError(_0x48ed54,null));};exports[_0x615b('0x47')]=function(_0x1d98ec,_0xb67051){return db[_0x615b('0x2c')][_0x615b('0x47')](_0x1d98ec['body'],{})[_0x615b('0x25')](respondWithResult(_0xb67051,0xc9))['catch'](handleError(_0xb67051,null));};exports[_0x615b('0x24')]=function(_0x56a2d5,_0x409907){if(_0x56a2d5['body']['id']){delete _0x56a2d5[_0x615b('0x48')]['id'];}return db[_0x615b('0x2c')][_0x615b('0x49')]({'where':{'id':_0x56a2d5[_0x615b('0x44')]['id']}})['then'](handleEntityNotFound(_0x409907,null))[_0x615b('0x25')](saveUpdates(_0x56a2d5[_0x615b('0x48')],null))[_0x615b('0x25')](respondWithResult(_0x409907,null))[_0x615b('0x46')](handleError(_0x409907,null));};exports[_0x615b('0x26')]=function(_0x40d168,_0x58e861){return db[_0x615b('0x2c')]['find']({'where':{'id':_0x40d168[_0x615b('0x44')]['id']}})[_0x615b('0x25')](handleEntityNotFound(_0x58e861,null))[_0x615b('0x25')](removeEntity(_0x58e861,null))[_0x615b('0x46')](handleError(_0x58e861,null));};exports[_0x615b('0x4a')]=function(_0x3a2330,_0xdd6873,_0x3490f2){var _0x459739={};var _0x46291e={};var _0x33f461;var _0x5deca8;return db[_0x615b('0x2c')]['findOne']({'where':{'id':_0x3a2330['params']['id']}})['then'](handleEntityNotFound(_0xdd6873,null))[_0x615b('0x25')](function(_0x46b0a0){if(_0x46b0a0){_0x33f461=_0x46b0a0;_0x46291e[_0x615b('0x30')]=_[_0x615b('0x45')](db[_0x615b('0x4b')]['rawAttributes']);_0x46291e[_0x615b('0x31')]=_[_0x615b('0x45')](_0x3a2330['query']);_0x46291e[_0x615b('0x32')]=_[_0x615b('0x33')](_0x46291e['model'],_0x46291e['query']);_0x459739[_0x615b('0x34')]=_[_0x615b('0x33')](_0x46291e[_0x615b('0x30')],qs[_0x615b('0x35')](_0x3a2330[_0x615b('0x31')][_0x615b('0x35')]));_0x459739[_0x615b('0x34')]=_0x459739['attributes']['length']?_0x459739[_0x615b('0x34')]:_0x46291e[_0x615b('0x30')];_0x459739[_0x615b('0x4c')]=qs['sort'](_0x3a2330[_0x615b('0x31')][_0x615b('0x38')]);_0x459739['where']=qs[_0x615b('0x32')](_[_0x615b('0x3a')](_0x3a2330[_0x615b('0x31')],_0x46291e[_0x615b('0x32')]));if(_0x3a2330[_0x615b('0x31')]['filter']){_0x459739['where']=_[_0x615b('0x3c')](_0x459739[_0x615b('0x39')],{'$or':_[_0x615b('0x2b')](_0x459739[_0x615b('0x34')],function(_0x4ef576){var _0x13849c={};_0x13849c[_0x4ef576]={'$like':'%'+_0x3a2330['query'][_0x615b('0x3b')]+'%'};return _0x13849c;})});}_0x459739=_[_0x615b('0x3c')]({},_0x459739,_0x3a2330['options']);return _0x33f461[_0x615b('0x4a')](_0x459739);}})[_0x615b('0x25')](function(_0x249532){if(_0x249532){_0x5deca8=_0x249532[_0x615b('0x36')];if(!_0x3a2330['query'][_0x615b('0x4d')](_0x615b('0x37'))){_0x459739[_0x615b('0x1e')]=qs[_0x615b('0x1e')](_0x3a2330[_0x615b('0x31')][_0x615b('0x1e')]);_0x459739[_0x615b('0x1c')]=qs[_0x615b('0x1c')](_0x3a2330['query'][_0x615b('0x1c')]);}return _0x33f461[_0x615b('0x4a')](_0x459739);}})[_0x615b('0x25')](function(_0xe60d12){if(_0xe60d12){return _0xe60d12?{'count':_0x5deca8,'rows':_0xe60d12}:null;}})[_0x615b('0x25')](respondWithResult(_0xdd6873,null))[_0x615b('0x46')](handleError(_0xdd6873,null));};exports['getSubjects']=function(_0x505d34,_0x4fc1f4,_0x57dd01){var _0x1f6ff3={};var _0x558808={};var _0x2f8125;var _0x3c710e;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x505d34[_0x615b('0x44')]['id']}})[_0x615b('0x25')](handleEntityNotFound(_0x4fc1f4,null))[_0x615b('0x25')](function(_0x199188){if(_0x199188){_0x2f8125=_0x199188;_0x558808[_0x615b('0x30')]=_['keys'](db[_0x615b('0x4b')][_0x615b('0x2d')]);_0x558808[_0x615b('0x31')]=_[_0x615b('0x45')](_0x505d34[_0x615b('0x31')]);_0x558808[_0x615b('0x32')]=_['intersection'](_0x558808[_0x615b('0x30')],_0x558808[_0x615b('0x31')]);_0x1f6ff3[_0x615b('0x34')]=_[_0x615b('0x33')](_0x558808[_0x615b('0x30')],qs[_0x615b('0x35')](_0x505d34[_0x615b('0x31')][_0x615b('0x35')]));_0x1f6ff3[_0x615b('0x34')]=_0x1f6ff3[_0x615b('0x34')][_0x615b('0x36')]?_0x1f6ff3[_0x615b('0x34')]:_0x558808[_0x615b('0x30')];_0x1f6ff3['order']=qs[_0x615b('0x38')](_0x505d34[_0x615b('0x31')]['sort']);_0x1f6ff3['where']=qs['filters'](_[_0x615b('0x3a')](_0x505d34[_0x615b('0x31')],_0x558808['filters']));if(_0x505d34[_0x615b('0x31')][_0x615b('0x3b')]){_0x1f6ff3[_0x615b('0x39')]=_[_0x615b('0x3c')](_0x1f6ff3[_0x615b('0x39')],{'$or':_['map'](_0x1f6ff3['attributes'],function(_0x5851d9){var _0xc5f01f={};_0xc5f01f[_0x5851d9]={'$like':'%'+_0x505d34[_0x615b('0x31')][_0x615b('0x3b')]+'%'};return _0xc5f01f;})});}_0x1f6ff3=_[_0x615b('0x3c')]({},_0x1f6ff3,_0x505d34['options']);return _0x2f8125[_0x615b('0x4e')](_0x1f6ff3);}})[_0x615b('0x25')](function(_0x32ceff){if(_0x32ceff){_0x3c710e=_0x32ceff[_0x615b('0x36')];if(!_0x505d34['query'][_0x615b('0x4d')]('nolimit')){_0x1f6ff3[_0x615b('0x1e')]=qs[_0x615b('0x1e')](_0x505d34[_0x615b('0x31')][_0x615b('0x1e')]);_0x1f6ff3[_0x615b('0x1c')]=qs[_0x615b('0x1c')](_0x505d34[_0x615b('0x31')][_0x615b('0x1c')]);}return _0x2f8125[_0x615b('0x4e')](_0x1f6ff3);}})[_0x615b('0x25')](function(_0x72cbb8){if(_0x72cbb8){return _0x72cbb8?{'count':_0x3c710e,'rows':_0x72cbb8}:null;}})['then'](respondWithResult(_0x4fc1f4,null))[_0x615b('0x46')](handleError(_0x4fc1f4,null));};exports[_0x615b('0x4f')]=function(_0x5f29ff,_0xb32b2b,_0x483114){var _0x3af3b4={};var _0x29a94a={};var _0x2ac8ef;var _0x55ed3f;return db[_0x615b('0x2c')]['findOne']({'where':{'id':_0x5f29ff[_0x615b('0x44')]['id']}})[_0x615b('0x25')](handleEntityNotFound(_0xb32b2b,null))[_0x615b('0x25')](function(_0x5d0e80){if(_0x5d0e80){_0x2ac8ef=_0x5d0e80;_0x29a94a[_0x615b('0x30')]=_['keys'](db['SalesforceField'][_0x615b('0x2d')]);_0x29a94a['query']=_['keys'](_0x5f29ff[_0x615b('0x31')]);_0x29a94a['filters']=_[_0x615b('0x33')](_0x29a94a[_0x615b('0x30')],_0x29a94a['query']);_0x3af3b4[_0x615b('0x34')]=_[_0x615b('0x33')](_0x29a94a[_0x615b('0x30')],qs[_0x615b('0x35')](_0x5f29ff[_0x615b('0x31')]['fields']));_0x3af3b4[_0x615b('0x34')]=_0x3af3b4['attributes'][_0x615b('0x36')]?_0x3af3b4[_0x615b('0x34')]:_0x29a94a[_0x615b('0x30')];_0x3af3b4['order']=qs[_0x615b('0x38')](_0x5f29ff['query'][_0x615b('0x38')]);_0x3af3b4[_0x615b('0x39')]=qs['filters'](_['pick'](_0x5f29ff['query'],_0x29a94a[_0x615b('0x32')]));if(_0x5f29ff[_0x615b('0x31')][_0x615b('0x3b')]){_0x3af3b4[_0x615b('0x39')]=_['merge'](_0x3af3b4[_0x615b('0x39')],{'$or':_[_0x615b('0x2b')](_0x3af3b4['attributes'],function(_0x4a1785){var _0x16a56b={};_0x16a56b[_0x4a1785]={'$like':'%'+_0x5f29ff['query']['filter']+'%'};return _0x16a56b;})});}_0x3af3b4=_['merge']({},_0x3af3b4,_0x5f29ff[_0x615b('0x50')]);return _0x2ac8ef[_0x615b('0x4f')](_0x3af3b4);}})[_0x615b('0x25')](function(_0x3c8e81){if(_0x3c8e81){_0x55ed3f=_0x3c8e81[_0x615b('0x36')];if(!_0x5f29ff[_0x615b('0x31')][_0x615b('0x4d')](_0x615b('0x37'))){_0x3af3b4[_0x615b('0x1e')]=qs[_0x615b('0x1e')](_0x5f29ff['query']['limit']);_0x3af3b4['offset']=qs['offset'](_0x5f29ff[_0x615b('0x31')][_0x615b('0x1c')]);}return _0x2ac8ef[_0x615b('0x4f')](_0x3af3b4);}})[_0x615b('0x25')](function(_0x3ce046){if(_0x3ce046){return _0x3ce046?{'count':_0x55ed3f,'rows':_0x3ce046}:null;}})['then'](respondWithResult(_0xb32b2b,null))[_0x615b('0x46')](handleError(_0xb32b2b,null));}; \ No newline at end of file +var _0xc26a=['save','then','destroy','error','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','attributes','intersection','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','fields','length','find','create','body','update','getFields','SalesforceField','pick','hasOwnProperty','getSubjects','getDescriptions','findOne','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','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','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject'];(function(_0x279643,_0xa4e19b){var _0x292d3d=function(_0x5ccac5){while(--_0x5ccac5){_0x279643['push'](_0x279643['shift']());}};_0x292d3d(++_0xa4e19b);}(_0xc26a,0x1c9));var _0xac26=function(_0x38e901,_0x19814e){_0x38e901=_0x38e901-0x0;var _0x1366dc=_0xc26a[_0x38e901];return _0x1366dc;};'use strict';var emlformat=require(_0xac26('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xac26('0x1'));var jsonpatch=require(_0xac26('0x2'));var rp=require(_0xac26('0x3'));var moment=require(_0xac26('0x4'));var BPromise=require(_0xac26('0x5'));var Mustache=require(_0xac26('0x6'));var util=require('util');var path=require('path');var sox=require(_0xac26('0x7'));var csv=require(_0xac26('0x8'));var ejs=require(_0xac26('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xac26('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xac26('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xac26('0xc'));var Redis=require(_0xac26('0xd'));var authService=require(_0xac26('0xe'));var qs=require(_0xac26('0xf'));var as=require(_0xac26('0x10'));var hardwareService=require(_0xac26('0x11'));var logger=require(_0xac26('0x12'))(_0xac26('0x13'));var utils=require('../../config/utils');var config=require(_0xac26('0x14'));var licenseUtil=require(_0xac26('0x15'));var db=require(_0xac26('0x16'))['db'];function respondWithStatusCode(_0x4533d9,_0x4982b7){_0x4982b7=_0x4982b7||0xcc;return function(_0x5732bd){if(_0x5732bd){return _0x4533d9[_0xac26('0x17')](_0x4982b7);}return _0x4533d9['status'](_0x4982b7)[_0xac26('0x18')]();};}function respondWithResult(_0x3f33bc,_0x4e4e39){_0x4e4e39=_0x4e4e39||0xc8;return function(_0x122b9d){if(_0x122b9d){return _0x3f33bc[_0xac26('0x19')](_0x4e4e39)[_0xac26('0x1a')](_0x122b9d);}};}function respondWithFilteredResult(_0x3fe050,_0x1f6b6e){return function(_0x5d926c){if(_0x5d926c){var _0x2ac8cf=typeof _0x1f6b6e['offset']===_0xac26('0x1b')&&typeof _0x1f6b6e[_0xac26('0x1c')]===_0xac26('0x1b');var _0x117f78=_0x5d926c[_0xac26('0x1d')];var _0x5bd24e=_0x2ac8cf?0x0:_0x1f6b6e[_0xac26('0x1e')];var _0x622705=_0x2ac8cf?_0x5d926c[_0xac26('0x1d')]:_0x1f6b6e[_0xac26('0x1e')]+_0x1f6b6e[_0xac26('0x1c')];var _0x2a6b51;if(_0x622705>=_0x117f78){_0x622705=_0x117f78;_0x2a6b51=0xc8;}else{_0x2a6b51=0xce;}_0x3fe050[_0xac26('0x19')](_0x2a6b51);return _0x3fe050[_0xac26('0x1f')](_0xac26('0x20'),_0x5bd24e+'-'+_0x622705+'/'+_0x117f78)[_0xac26('0x1a')](_0x5d926c);}return null;};}function patchUpdates(_0x3b214d){return function(_0x5b01fd){try{jsonpatch[_0xac26('0x21')](_0x5b01fd,_0x3b214d,!![]);}catch(_0x264a4d){return BPromise[_0xac26('0x22')](_0x264a4d);}return _0x5b01fd[_0xac26('0x23')]();};}function saveUpdates(_0x2bd2a6,_0x41cb73){return function(_0x1bb2e3){if(_0x1bb2e3){return _0x1bb2e3['update'](_0x2bd2a6)[_0xac26('0x24')](function(_0x3ebdb6){return _0x3ebdb6;});}return null;};}function removeEntity(_0xeebdd3,_0xddd25){return function(_0x3c955f){if(_0x3c955f){return _0x3c955f[_0xac26('0x25')]()[_0xac26('0x24')](function(){_0xeebdd3['status'](0xcc)[_0xac26('0x18')]();});}};}function handleEntityNotFound(_0x3807b6,_0x46f8c1){return function(_0x565462){if(!_0x565462){_0x3807b6[_0xac26('0x17')](0x194);}return _0x565462;};}function handleError(_0xaea7a3,_0x20c67e){_0x20c67e=_0x20c67e||0x1f4;return function(_0x37a9cf){logger[_0xac26('0x26')](_0x37a9cf['stack']);if(_0x37a9cf[_0xac26('0x27')]){delete _0x37a9cf['name'];}_0xaea7a3[_0xac26('0x19')](_0x20c67e)[_0xac26('0x28')](_0x37a9cf);};}exports[_0xac26('0x29')]=function(_0x454843,_0x4b00a5){var _0xc05fe0={},_0x1c4432={},_0xe805a0={'count':0x0,'rows':[]};var _0xa6b9f7=_[_0xac26('0x2a')](db[_0xac26('0x2b')][_0xac26('0x2c')],function(_0x4cb65a){return{'name':_0x4cb65a[_0xac26('0x2d')],'type':_0x4cb65a[_0xac26('0x2e')][_0xac26('0x2f')]};});_0x1c4432[_0xac26('0x30')]=_[_0xac26('0x2a')](_0xa6b9f7,'name');_0x1c4432['query']=_['keys'](_0x454843[_0xac26('0x31')]);_0x1c4432['filters']=_['intersection'](_0x1c4432[_0xac26('0x30')],_0x1c4432['query']);_0xc05fe0[_0xac26('0x32')]=_[_0xac26('0x33')](_0x1c4432[_0xac26('0x30')],qs['fields'](_0x454843[_0xac26('0x31')]['fields']));_0xc05fe0[_0xac26('0x32')]=_0xc05fe0[_0xac26('0x32')]['length']?_0xc05fe0['attributes']:_0x1c4432['model'];if(!_0x454843['query']['hasOwnProperty'](_0xac26('0x34'))){_0xc05fe0[_0xac26('0x1c')]=qs[_0xac26('0x1c')](_0x454843[_0xac26('0x31')][_0xac26('0x1c')]);_0xc05fe0[_0xac26('0x1e')]=qs['offset'](_0x454843['query'][_0xac26('0x1e')]);}_0xc05fe0[_0xac26('0x35')]=qs[_0xac26('0x36')](_0x454843[_0xac26('0x31')][_0xac26('0x36')]);_0xc05fe0[_0xac26('0x37')]=qs[_0xac26('0x38')](_['pick'](_0x454843[_0xac26('0x31')],_0x1c4432['filters']),_0xa6b9f7);if(_0x454843[_0xac26('0x31')][_0xac26('0x39')]){_0xc05fe0['where']=_[_0xac26('0x3a')](_0xc05fe0[_0xac26('0x37')],{'$or':_['map'](_0xa6b9f7,function(_0x382b52){if(_0x382b52[_0xac26('0x2e')]!==_0xac26('0x3b')){var _0x29c691={};_0x29c691[_0x382b52[_0xac26('0x27')]]={'$like':'%'+_0x454843[_0xac26('0x31')]['filter']+'%'};return _0x29c691;}})});}_0xc05fe0=_[_0xac26('0x3a')]({},_0xc05fe0,_0x454843[_0xac26('0x3c')]);var _0x5d0b5b={'where':_0xc05fe0[_0xac26('0x37')]};return db[_0xac26('0x2b')][_0xac26('0x1d')](_0x5d0b5b)[_0xac26('0x24')](function(_0x106ed1){_0xe805a0[_0xac26('0x1d')]=_0x106ed1;if(_0x454843[_0xac26('0x31')][_0xac26('0x3d')]){_0xc05fe0[_0xac26('0x3e')]=[{'all':!![]}];}return db[_0xac26('0x2b')][_0xac26('0x3f')](_0xc05fe0);})[_0xac26('0x24')](function(_0x3c5f77){_0xe805a0[_0xac26('0x40')]=_0x3c5f77;return _0xe805a0;})[_0xac26('0x24')](respondWithFilteredResult(_0x4b00a5,_0xc05fe0))[_0xac26('0x41')](handleError(_0x4b00a5,null));};exports[_0xac26('0x42')]=function(_0x28e5b4,_0x139111){var _0x422533={'raw':![],'where':{'id':_0x28e5b4[_0xac26('0x43')]['id']}},_0x5c9170={};_0x5c9170[_0xac26('0x30')]=_[_0xac26('0x44')](db[_0xac26('0x2b')][_0xac26('0x2c')]);_0x5c9170[_0xac26('0x31')]=_[_0xac26('0x44')](_0x28e5b4[_0xac26('0x31')]);_0x5c9170['filters']=_['intersection'](_0x5c9170[_0xac26('0x30')],_0x5c9170[_0xac26('0x31')]);_0x422533[_0xac26('0x32')]=_[_0xac26('0x33')](_0x5c9170[_0xac26('0x30')],qs[_0xac26('0x45')](_0x28e5b4[_0xac26('0x31')][_0xac26('0x45')]));_0x422533['attributes']=_0x422533[_0xac26('0x32')][_0xac26('0x46')]?_0x422533[_0xac26('0x32')]:_0x5c9170[_0xac26('0x30')];if(_0x28e5b4['query'][_0xac26('0x3d')]){_0x422533['include']=[{'all':!![]}];}_0x422533=_[_0xac26('0x3a')]({},_0x422533,_0x28e5b4[_0xac26('0x3c')]);return db['SalesforceConfiguration'][_0xac26('0x47')](_0x422533)[_0xac26('0x24')](handleEntityNotFound(_0x139111,null))[_0xac26('0x24')](respondWithResult(_0x139111,null))[_0xac26('0x41')](handleError(_0x139111,null));};exports[_0xac26('0x48')]=function(_0x5bdc52,_0x49eb3a){return db[_0xac26('0x2b')][_0xac26('0x48')](_0x5bdc52[_0xac26('0x49')],{})[_0xac26('0x24')](respondWithResult(_0x49eb3a,0xc9))[_0xac26('0x41')](handleError(_0x49eb3a,null));};exports[_0xac26('0x4a')]=function(_0x3d286e,_0x4344af){if(_0x3d286e[_0xac26('0x49')]['id']){delete _0x3d286e[_0xac26('0x49')]['id'];}return db[_0xac26('0x2b')]['find']({'where':{'id':_0x3d286e[_0xac26('0x43')]['id']}})[_0xac26('0x24')](handleEntityNotFound(_0x4344af,null))[_0xac26('0x24')](saveUpdates(_0x3d286e['body'],null))[_0xac26('0x24')](respondWithResult(_0x4344af,null))[_0xac26('0x41')](handleError(_0x4344af,null));};exports[_0xac26('0x25')]=function(_0x26267c,_0x481b20){return db['SalesforceConfiguration']['find']({'where':{'id':_0x26267c[_0xac26('0x43')]['id']}})[_0xac26('0x24')](handleEntityNotFound(_0x481b20,null))[_0xac26('0x24')](removeEntity(_0x481b20,null))[_0xac26('0x41')](handleError(_0x481b20,null));};exports[_0xac26('0x4b')]=function(_0x63c55d,_0x29a0dd,_0x3bbcab){var _0x544c9e={};var _0x1a43d1={};var _0x443146;var _0x560bfc;return db[_0xac26('0x2b')]['findOne']({'where':{'id':_0x63c55d['params']['id']}})[_0xac26('0x24')](handleEntityNotFound(_0x29a0dd,null))[_0xac26('0x24')](function(_0x5c7c29){if(_0x5c7c29){_0x443146=_0x5c7c29;_0x1a43d1[_0xac26('0x30')]=_[_0xac26('0x44')](db[_0xac26('0x4c')][_0xac26('0x2c')]);_0x1a43d1[_0xac26('0x31')]=_[_0xac26('0x44')](_0x63c55d[_0xac26('0x31')]);_0x1a43d1['filters']=_[_0xac26('0x33')](_0x1a43d1['model'],_0x1a43d1[_0xac26('0x31')]);_0x544c9e['attributes']=_[_0xac26('0x33')](_0x1a43d1[_0xac26('0x30')],qs[_0xac26('0x45')](_0x63c55d[_0xac26('0x31')][_0xac26('0x45')]));_0x544c9e['attributes']=_0x544c9e[_0xac26('0x32')]['length']?_0x544c9e['attributes']:_0x1a43d1[_0xac26('0x30')];_0x544c9e[_0xac26('0x35')]=qs[_0xac26('0x36')](_0x63c55d[_0xac26('0x31')][_0xac26('0x36')]);_0x544c9e[_0xac26('0x37')]=qs[_0xac26('0x38')](_[_0xac26('0x4d')](_0x63c55d['query'],_0x1a43d1['filters']));if(_0x63c55d[_0xac26('0x31')][_0xac26('0x39')]){_0x544c9e[_0xac26('0x37')]=_['merge'](_0x544c9e[_0xac26('0x37')],{'$or':_[_0xac26('0x2a')](_0x544c9e[_0xac26('0x32')],function(_0x3dff63){var _0x268322={};_0x268322[_0x3dff63]={'$like':'%'+_0x63c55d[_0xac26('0x31')][_0xac26('0x39')]+'%'};return _0x268322;})});}_0x544c9e=_[_0xac26('0x3a')]({},_0x544c9e,_0x63c55d[_0xac26('0x3c')]);return _0x443146['getFields'](_0x544c9e);}})[_0xac26('0x24')](function(_0x553502){if(_0x553502){_0x560bfc=_0x553502[_0xac26('0x46')];if(!_0x63c55d[_0xac26('0x31')][_0xac26('0x4e')](_0xac26('0x34'))){_0x544c9e[_0xac26('0x1c')]=qs[_0xac26('0x1c')](_0x63c55d['query'][_0xac26('0x1c')]);_0x544c9e[_0xac26('0x1e')]=qs['offset'](_0x63c55d[_0xac26('0x31')][_0xac26('0x1e')]);}return _0x443146[_0xac26('0x4b')](_0x544c9e);}})['then'](function(_0x16daf4){if(_0x16daf4){return _0x16daf4?{'count':_0x560bfc,'rows':_0x16daf4}:null;}})[_0xac26('0x24')](respondWithResult(_0x29a0dd,null))[_0xac26('0x41')](handleError(_0x29a0dd,null));};exports[_0xac26('0x4f')]=function(_0x45c6ac,_0x3f1804,_0x4978c8){var _0x292c56={};var _0xd2ed92={};var _0x2adc11;var _0x40cd87;return db[_0xac26('0x2b')]['findOne']({'where':{'id':_0x45c6ac[_0xac26('0x43')]['id']}})[_0xac26('0x24')](handleEntityNotFound(_0x3f1804,null))['then'](function(_0x5c5898){if(_0x5c5898){_0x2adc11=_0x5c5898;_0xd2ed92[_0xac26('0x30')]=_[_0xac26('0x44')](db[_0xac26('0x4c')][_0xac26('0x2c')]);_0xd2ed92[_0xac26('0x31')]=_['keys'](_0x45c6ac['query']);_0xd2ed92[_0xac26('0x38')]=_[_0xac26('0x33')](_0xd2ed92[_0xac26('0x30')],_0xd2ed92[_0xac26('0x31')]);_0x292c56[_0xac26('0x32')]=_[_0xac26('0x33')](_0xd2ed92[_0xac26('0x30')],qs[_0xac26('0x45')](_0x45c6ac[_0xac26('0x31')][_0xac26('0x45')]));_0x292c56['attributes']=_0x292c56['attributes'][_0xac26('0x46')]?_0x292c56[_0xac26('0x32')]:_0xd2ed92['model'];_0x292c56[_0xac26('0x35')]=qs[_0xac26('0x36')](_0x45c6ac[_0xac26('0x31')][_0xac26('0x36')]);_0x292c56[_0xac26('0x37')]=qs[_0xac26('0x38')](_[_0xac26('0x4d')](_0x45c6ac[_0xac26('0x31')],_0xd2ed92[_0xac26('0x38')]));if(_0x45c6ac['query'][_0xac26('0x39')]){_0x292c56['where']=_[_0xac26('0x3a')](_0x292c56[_0xac26('0x37')],{'$or':_['map'](_0x292c56[_0xac26('0x32')],function(_0x1bb4b7){var _0x205e53={};_0x205e53[_0x1bb4b7]={'$like':'%'+_0x45c6ac[_0xac26('0x31')][_0xac26('0x39')]+'%'};return _0x205e53;})});}_0x292c56=_[_0xac26('0x3a')]({},_0x292c56,_0x45c6ac[_0xac26('0x3c')]);return _0x2adc11[_0xac26('0x4f')](_0x292c56);}})[_0xac26('0x24')](function(_0x4bbeea){if(_0x4bbeea){_0x40cd87=_0x4bbeea[_0xac26('0x46')];if(!_0x45c6ac[_0xac26('0x31')][_0xac26('0x4e')]('nolimit')){_0x292c56[_0xac26('0x1c')]=qs[_0xac26('0x1c')](_0x45c6ac[_0xac26('0x31')]['limit']);_0x292c56[_0xac26('0x1e')]=qs[_0xac26('0x1e')](_0x45c6ac[_0xac26('0x31')][_0xac26('0x1e')]);}return _0x2adc11['getSubjects'](_0x292c56);}})[_0xac26('0x24')](function(_0x2fad0a){if(_0x2fad0a){return _0x2fad0a?{'count':_0x40cd87,'rows':_0x2fad0a}:null;}})['then'](respondWithResult(_0x3f1804,null))[_0xac26('0x41')](handleError(_0x3f1804,null));};exports[_0xac26('0x50')]=function(_0x5c92c2,_0x3c9f9b,_0x22ab65){var _0x1753f1={};var _0x445562={};var _0x31bcda;var _0x32b0d9;return db[_0xac26('0x2b')][_0xac26('0x51')]({'where':{'id':_0x5c92c2[_0xac26('0x43')]['id']}})[_0xac26('0x24')](handleEntityNotFound(_0x3c9f9b,null))[_0xac26('0x24')](function(_0x57ac4d){if(_0x57ac4d){_0x31bcda=_0x57ac4d;_0x445562[_0xac26('0x30')]=_['keys'](db[_0xac26('0x4c')][_0xac26('0x2c')]);_0x445562[_0xac26('0x31')]=_[_0xac26('0x44')](_0x5c92c2[_0xac26('0x31')]);_0x445562[_0xac26('0x38')]=_[_0xac26('0x33')](_0x445562[_0xac26('0x30')],_0x445562['query']);_0x1753f1[_0xac26('0x32')]=_[_0xac26('0x33')](_0x445562['model'],qs[_0xac26('0x45')](_0x5c92c2[_0xac26('0x31')][_0xac26('0x45')]));_0x1753f1[_0xac26('0x32')]=_0x1753f1[_0xac26('0x32')][_0xac26('0x46')]?_0x1753f1[_0xac26('0x32')]:_0x445562[_0xac26('0x30')];_0x1753f1[_0xac26('0x35')]=qs['sort'](_0x5c92c2[_0xac26('0x31')][_0xac26('0x36')]);_0x1753f1[_0xac26('0x37')]=qs[_0xac26('0x38')](_['pick'](_0x5c92c2['query'],_0x445562[_0xac26('0x38')]));if(_0x5c92c2[_0xac26('0x31')][_0xac26('0x39')]){_0x1753f1[_0xac26('0x37')]=_[_0xac26('0x3a')](_0x1753f1[_0xac26('0x37')],{'$or':_[_0xac26('0x2a')](_0x1753f1['attributes'],function(_0x1a93c6){var _0x2ee975={};_0x2ee975[_0x1a93c6]={'$like':'%'+_0x5c92c2['query'][_0xac26('0x39')]+'%'};return _0x2ee975;})});}_0x1753f1=_[_0xac26('0x3a')]({},_0x1753f1,_0x5c92c2[_0xac26('0x3c')]);return _0x31bcda[_0xac26('0x50')](_0x1753f1);}})[_0xac26('0x24')](function(_0x437eb4){if(_0x437eb4){_0x32b0d9=_0x437eb4[_0xac26('0x46')];if(!_0x5c92c2[_0xac26('0x31')][_0xac26('0x4e')](_0xac26('0x34'))){_0x1753f1[_0xac26('0x1c')]=qs[_0xac26('0x1c')](_0x5c92c2[_0xac26('0x31')]['limit']);_0x1753f1[_0xac26('0x1e')]=qs[_0xac26('0x1e')](_0x5c92c2['query'][_0xac26('0x1e')]);}return _0x31bcda[_0xac26('0x50')](_0x1753f1);}})['then'](function(_0x3ea868){if(_0x3ea868){return _0x3ea868?{'count':_0x32b0d9,'rows':_0x3ea868}:null;}})[_0xac26('0x24')](respondWithResult(_0x3c9f9b,null))[_0xac26('0x41')](handleError(_0x3c9f9b,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 120a530..dde06ea 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 _0x0cb4=['define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x38ea0a,_0x1dfb4d){var _0x43375a=function(_0x289a9c){while(--_0x289a9c){_0x38ea0a['push'](_0x38ea0a['shift']());}};_0x43375a(++_0x1dfb4d);}(_0x0cb4,0x196));var _0x40cb=function(_0x4dd7d7,_0x3eab2e){_0x4dd7d7=_0x4dd7d7-0x0;var _0x1abd98=_0x0cb4[_0x4dd7d7];return _0x1abd98;};'use strict';var _=require(_0x40cb('0x0'));var util=require(_0x40cb('0x1'));var logger=require(_0x40cb('0x2'))(_0x40cb('0x3'));var moment=require(_0x40cb('0x4'));var BPromise=require('bluebird');var rp=require(_0x40cb('0x5'));var fs=require('fs');var path=require(_0x40cb('0x6'));var rimraf=require(_0x40cb('0x7'));var config=require(_0x40cb('0x8'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0x40cb('0x9')]=function(_0x19ae69,_0x2a7857){return _0x19ae69[_0x40cb('0xa')](_0x40cb('0xb'),attributes,{'tableName':_0x40cb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe3db=['path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','lodash','api','moment','bluebird','request-promise'];(function(_0x1ee7a7,_0x2478b0){var _0x291a52=function(_0x54718c){while(--_0x54718c){_0x1ee7a7['push'](_0x1ee7a7['shift']());}};_0x291a52(++_0x2478b0);}(_0xe3db,0x1c3));var _0xbe3d=function(_0xa80cdd,_0x34147e){_0xa80cdd=_0xa80cdd-0x0;var _0x105bda=_0xe3db[_0xa80cdd];return _0x105bda;};'use strict';var _=require(_0xbe3d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xbe3d('0x1'));var moment=require(_0xbe3d('0x2'));var BPromise=require(_0xbe3d('0x3'));var rp=require(_0xbe3d('0x4'));var fs=require('fs');var path=require(_0xbe3d('0x5'));var rimraf=require(_0xbe3d('0x6'));var config=require(_0xbe3d('0x7'));var attributes=require(_0xbe3d('0x8'));module[_0xbe3d('0x9')]=function(_0x1b818e,_0x49fc07){return _0x1b818e[_0xbe3d('0xa')](_0xbe3d('0xb'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 29d4d46..f8f9e26 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 _0x39cd=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x4e8c93,_0x1c3c74){var _0xc35342=function(_0x29599b){while(--_0x29599b){_0x4e8c93['push'](_0x4e8c93['shift']());}};_0xc35342(++_0x1c3c74);}(_0x39cd,0xc0));var _0xd39c=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x39cd[_0x5a776b];return _0xbbef59;};'use strict';var _=require(_0xd39c('0x0'));var util=require(_0xd39c('0x1'));var moment=require(_0xd39c('0x2'));var BPromise=require('bluebird');var rs=require(_0xd39c('0x3'));var fs=require('fs');var Redis=require(_0xd39c('0x4'));var db=require(_0xd39c('0x5'))['db'];var utils=require(_0xd39c('0x6'));var logger=require(_0xd39c('0x7'))(_0xd39c('0x8'));var config=require(_0xd39c('0x9'));var jayson=require(_0xd39c('0xa'));var client=jayson['client'][_0xd39c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x30f837,_0x1202e7,_0x359820){return new BPromise(function(_0x33cf8a,_0xcdcbe5){return client[_0xd39c('0xc')](_0x30f837,_0x359820)[_0xd39c('0xd')](function(_0x4b2a9e){logger[_0xd39c('0xe')](_0xd39c('0xf'),_0x1202e7,_0xd39c('0x10'));logger[_0xd39c('0x11')](_0xd39c('0x12'),_0x1202e7,_0xd39c('0x10'),JSON[_0xd39c('0x13')](_0x4b2a9e));if(_0x4b2a9e['error']){if(_0x4b2a9e[_0xd39c('0x14')][_0xd39c('0x15')]===0x1f4){logger[_0xd39c('0x14')](_0xd39c('0xf'),_0x1202e7,_0x4b2a9e[_0xd39c('0x14')][_0xd39c('0x16')]);return _0xcdcbe5(_0x4b2a9e[_0xd39c('0x14')][_0xd39c('0x16')]);}logger[_0xd39c('0x14')](_0xd39c('0xf'),_0x1202e7,_0x4b2a9e['error'][_0xd39c('0x16')]);return _0x33cf8a(_0x4b2a9e[_0xd39c('0x14')][_0xd39c('0x16')]);}else{logger[_0xd39c('0xe')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1202e7,_0xd39c('0x10'));_0x33cf8a(_0x4b2a9e['result'][_0xd39c('0x16')]);}})[_0xd39c('0x17')](function(_0x558fc9){logger[_0xd39c('0x14')](_0xd39c('0xf'),_0x1202e7,_0x558fc9);_0xcdcbe5(_0x558fc9);});});} \ No newline at end of file +var _0x41a2=['randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment'];(function(_0x15a3ad,_0x4fb716){var _0x3e98fe=function(_0x1c2c34){while(--_0x1c2c34){_0x15a3ad['push'](_0x15a3ad['shift']());}};_0x3e98fe(++_0x4fb716);}(_0x41a2,0xe8));var _0x241a=function(_0x23902e,_0x2bcb4e){_0x23902e=_0x23902e-0x0;var _0x28f007=_0x41a2[_0x23902e];return _0x28f007;};'use strict';var _=require('lodash');var util=require(_0x241a('0x0'));var moment=require(_0x241a('0x1'));var BPromise=require('bluebird');var rs=require(_0x241a('0x2'));var fs=require('fs');var Redis=require(_0x241a('0x3'));var db=require(_0x241a('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x241a('0x5'));var jayson=require(_0x241a('0x6'));var client=jayson[_0x241a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x58e577,_0x51279f,_0x36b422){return new BPromise(function(_0x179e3f,_0x1ef21f){return client['request'](_0x58e577,_0x36b422)[_0x241a('0x8')](function(_0x460167){logger[_0x241a('0x9')](_0x241a('0xa'),_0x51279f,_0x241a('0xb'));logger['debug'](_0x241a('0xc'),_0x51279f,_0x241a('0xb'),JSON['stringify'](_0x460167));if(_0x460167[_0x241a('0xd')]){if(_0x460167[_0x241a('0xd')][_0x241a('0xe')]===0x1f4){logger[_0x241a('0xd')](_0x241a('0xa'),_0x51279f,_0x460167[_0x241a('0xd')][_0x241a('0xf')]);return _0x1ef21f(_0x460167[_0x241a('0xd')]['message']);}logger[_0x241a('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x51279f,_0x460167[_0x241a('0xd')][_0x241a('0xf')]);return _0x179e3f(_0x460167[_0x241a('0xd')][_0x241a('0xf')]);}else{logger[_0x241a('0x9')](_0x241a('0xa'),_0x51279f,'request\x20sent');_0x179e3f(_0x460167[_0x241a('0x10')]['message']);}})[_0x241a('0x11')](function(_0x2a0c90){logger[_0x241a('0xd')](_0x241a('0xa'),_0x51279f,_0x2a0c90);_0x1ef21f(_0x2a0c90);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 0826b79..d5c440e 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 _0x301c=['../../config/environment','index','get','/:id','show','post','put','update','isAuthenticated','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x301c,0x83));var _0xc301=function(_0x56be45,_0x10cd0e){_0x56be45=_0x56be45-0x0;var _0x1b75d3=_0x301c[_0x56be45];return _0x1b75d3;};'use strict';var multer=require(_0xc301('0x0'));var util=require(_0xc301('0x1'));var path=require(_0xc301('0x2'));var timeout=require(_0xc301('0x3'));var express=require(_0xc301('0x4'));var router=express[_0xc301('0x5')]();var fs_extra=require(_0xc301('0x6'));var auth=require(_0xc301('0x7'));var interaction=require(_0xc301('0x8'));var config=require(_0xc301('0x9'));var controller=require('./intSalesforceField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xc301('0xa')]);router[_0xc301('0xb')](_0xc301('0xc'),auth['isAuthenticated'](),controller[_0xc301('0xd')]);router[_0xc301('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc301('0xf')](_0xc301('0xc'),auth['isAuthenticated'](),controller[_0xc301('0x10')]);router['delete'](_0xc301('0xc'),auth[_0xc301('0x11')](),controller[_0xc301('0x12')]);module[_0xc301('0x13')]=router; \ No newline at end of file +var _0x69ab=['fs-extra','../../components/auth/service','../../config/environment','./intSalesforceField.controller','isAuthenticated','index','get','/:id','post','create','put','update','delete','multer','path','connect-timeout','Router'];(function(_0x30491b,_0x5371b1){var _0x4604e3=function(_0x36fba6){while(--_0x36fba6){_0x30491b['push'](_0x30491b['shift']());}};_0x4604e3(++_0x5371b1);}(_0x69ab,0xd9));var _0xb69a=function(_0x530b09,_0x534376){_0x530b09=_0x530b09-0x0;var _0x2da2c7=_0x69ab[_0x530b09];return _0x2da2c7;};'use strict';var multer=require(_0xb69a('0x0'));var util=require('util');var path=require(_0xb69a('0x1'));var timeout=require(_0xb69a('0x2'));var express=require('express');var router=express[_0xb69a('0x3')]();var fs_extra=require(_0xb69a('0x4'));var auth=require(_0xb69a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb69a('0x6'));var controller=require(_0xb69a('0x7'));router['get']('/',auth[_0xb69a('0x8')](),controller[_0xb69a('0x9')]);router[_0xb69a('0xa')](_0xb69a('0xb'),auth[_0xb69a('0x8')](),controller['show']);router[_0xb69a('0xc')]('/',auth[_0xb69a('0x8')](),controller[_0xb69a('0xd')]);router[_0xb69a('0xe')](_0xb69a('0xb'),auth[_0xb69a('0x8')](),controller[_0xb69a('0xf')]);router[_0xb69a('0x10')](_0xb69a('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index dd91ff3..edef7ee 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 _0x86e9=['picklist','variable','customVariable','STRING','ENUM','string','keyValue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x86e9,0xcf));var _0x986e=function(_0x33654f,_0x1313a8){_0x33654f=_0x33654f-0x0;var _0x1e01b4=_0x86e9[_0x33654f];return _0x1e01b4;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x986e('0x0')](_0x986e('0x1'),'variable','customVariable',_0x986e('0x2'),_0x986e('0x3')),'defaultValue':_0x986e('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x986e('0x1'),_0x986e('0x4'),_0x986e('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x986e('0x6')]},'variableName':{'type':Sequelize[_0x986e('0x6')]}}; \ No newline at end of file +var _0xe5fb=['string','STRING','sequelize','exports','ENUM','variable','customVariable'];(function(_0x4e171f,_0x5d91df){var _0x46aff3=function(_0x321c6b){while(--_0x321c6b){_0x4e171f['push'](_0x4e171f['shift']());}};_0x46aff3(++_0x5d91df);}(_0xe5fb,0x1ad));var _0xbe5f=function(_0x13c70c,_0x546b34){_0x13c70c=_0x13c70c-0x0;var _0x50f0f2=_0xe5fb[_0x13c70c];return _0x50f0f2;};'use strict';var Sequelize=require(_0xbe5f('0x0'));module[_0xbe5f('0x1')]={'type':{'type':Sequelize[_0xbe5f('0x2')]('string',_0xbe5f('0x3'),_0xbe5f('0x4'),'keyValue','picklist'),'defaultValue':_0xbe5f('0x5')},'content':{'type':Sequelize[_0xbe5f('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xbe5f('0x5'),_0xbe5f('0x3'),_0xbe5f('0x4'))},'keyContent':{'type':Sequelize[_0xbe5f('0x6')]},'idField':{'type':Sequelize[_0xbe5f('0x6')]},'variableName':{'type':Sequelize[_0xbe5f('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index b913d97..3111030 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 _0x9e6e=['jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','error','stack','name','send','SalesforceField','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','includeAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel'];(function(_0x4db1ba,_0x235fad){var _0x2b3548=function(_0x3f19ca){while(--_0x3f19ca){_0x4db1ba['push'](_0x4db1ba['shift']());}};_0x2b3548(++_0x235fad);}(_0x9e6e,0x160));var _0xe9e6=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0x9e6e[_0x58afd5];return _0x3e503b;};'use strict';var emlformat=require(_0xe9e6('0x0'));var rimraf=require(_0xe9e6('0x1'));var zipdir=require(_0xe9e6('0x2'));var jsonpatch=require(_0xe9e6('0x3'));var rp=require('request-promise');var moment=require(_0xe9e6('0x4'));var BPromise=require(_0xe9e6('0x5'));var Mustache=require(_0xe9e6('0x6'));var util=require(_0xe9e6('0x7'));var path=require(_0xe9e6('0x8'));var sox=require(_0xe9e6('0x9'));var csv=require('to-csv');var ejs=require(_0xe9e6('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe9e6('0xb'));var squel=require(_0xe9e6('0xc'));var crypto=require('crypto');var jsforce=require(_0xe9e6('0xd'));var deskjs=require(_0xe9e6('0xe'));var toCsv=require(_0xe9e6('0xf'));var querystring=require(_0xe9e6('0x10'));var Papa=require(_0xe9e6('0x11'));var Redis=require(_0xe9e6('0x12'));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(_0xe9e6('0x13'))(_0xe9e6('0x14'));var utils=require(_0xe9e6('0x15'));var config=require(_0xe9e6('0x16'));var licenseUtil=require(_0xe9e6('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4fca79,_0x3327f7){_0x3327f7=_0x3327f7||0xcc;return function(_0x34661f){if(_0x34661f){return _0x4fca79[_0xe9e6('0x18')](_0x3327f7);}return _0x4fca79[_0xe9e6('0x19')](_0x3327f7)[_0xe9e6('0x1a')]();};}function respondWithResult(_0x3af3eb,_0x20d538){_0x20d538=_0x20d538||0xc8;return function(_0x2dced1){if(_0x2dced1){return _0x3af3eb[_0xe9e6('0x19')](_0x20d538)[_0xe9e6('0x1b')](_0x2dced1);}};}function respondWithFilteredResult(_0x5ae331,_0x4b5ffe){return function(_0x3422dc){if(_0x3422dc){var _0x24b251=typeof _0x4b5ffe[_0xe9e6('0x1c')]===_0xe9e6('0x1d')&&typeof _0x4b5ffe[_0xe9e6('0x1e')]==='undefined';var _0x2042d3=_0x3422dc[_0xe9e6('0x1f')];var _0x14f35a=_0x24b251?0x0:_0x4b5ffe[_0xe9e6('0x1c')];var _0x5f29c1=_0x24b251?_0x3422dc['count']:_0x4b5ffe['offset']+_0x4b5ffe['limit'];var _0x1846e8;if(_0x5f29c1>=_0x2042d3){_0x5f29c1=_0x2042d3;_0x1846e8=0xc8;}else{_0x1846e8=0xce;}_0x5ae331[_0xe9e6('0x19')](_0x1846e8);return _0x5ae331[_0xe9e6('0x20')]('Content-Range',_0x14f35a+'-'+_0x5f29c1+'/'+_0x2042d3)[_0xe9e6('0x1b')](_0x3422dc);}return null;};}function patchUpdates(_0x480c11){return function(_0x402275){try{jsonpatch[_0xe9e6('0x21')](_0x402275,_0x480c11,!![]);}catch(_0x34c522){return BPromise[_0xe9e6('0x22')](_0x34c522);}return _0x402275[_0xe9e6('0x23')]();};}function saveUpdates(_0x1397b8,_0x2cebac){return function(_0x53be66){if(_0x53be66){return _0x53be66[_0xe9e6('0x24')](_0x1397b8)['then'](function(_0x4bb502){return _0x4bb502;});}return null;};}function removeEntity(_0x212fb8,_0xd6209e){return function(_0x2b1230){if(_0x2b1230){return _0x2b1230[_0xe9e6('0x25')]()[_0xe9e6('0x26')](function(){_0x212fb8['status'](0xcc)[_0xe9e6('0x1a')]();});}};}function handleEntityNotFound(_0x2d45a0,_0x148f56){return function(_0x3cba18){if(!_0x3cba18){_0x2d45a0[_0xe9e6('0x18')](0x194);}return _0x3cba18;};}function handleError(_0x594939,_0x1ef867){_0x1ef867=_0x1ef867||0x1f4;return function(_0x1f3b3e){logger[_0xe9e6('0x27')](_0x1f3b3e[_0xe9e6('0x28')]);if(_0x1f3b3e['name']){delete _0x1f3b3e[_0xe9e6('0x29')];}_0x594939['status'](_0x1ef867)[_0xe9e6('0x2a')](_0x1f3b3e);};}exports['index']=function(_0xc04c3a,_0x59931a){var _0x26d055={},_0x3f7753={},_0x18cdce={'count':0x0,'rows':[]};var _0x22ae6c=_['map'](db[_0xe9e6('0x2b')][_0xe9e6('0x2c')],function(_0x201fc6){return{'name':_0x201fc6[_0xe9e6('0x2d')],'type':_0x201fc6['type'][_0xe9e6('0x2e')]};});_0x3f7753[_0xe9e6('0x2f')]=_[_0xe9e6('0x30')](_0x22ae6c,_0xe9e6('0x29'));_0x3f7753['query']=_[_0xe9e6('0x31')](_0xc04c3a[_0xe9e6('0x32')]);_0x3f7753[_0xe9e6('0x33')]=_[_0xe9e6('0x34')](_0x3f7753[_0xe9e6('0x2f')],_0x3f7753['query']);_0x26d055[_0xe9e6('0x35')]=_[_0xe9e6('0x34')](_0x3f7753[_0xe9e6('0x2f')],qs[_0xe9e6('0x36')](_0xc04c3a[_0xe9e6('0x32')][_0xe9e6('0x36')]));_0x26d055[_0xe9e6('0x35')]=_0x26d055['attributes'][_0xe9e6('0x37')]?_0x26d055[_0xe9e6('0x35')]:_0x3f7753[_0xe9e6('0x2f')];if(!_0xc04c3a[_0xe9e6('0x32')][_0xe9e6('0x38')]('nolimit')){_0x26d055[_0xe9e6('0x1e')]=qs[_0xe9e6('0x1e')](_0xc04c3a['query'][_0xe9e6('0x1e')]);_0x26d055[_0xe9e6('0x1c')]=qs['offset'](_0xc04c3a[_0xe9e6('0x32')][_0xe9e6('0x1c')]);}_0x26d055[_0xe9e6('0x39')]=qs[_0xe9e6('0x3a')](_0xc04c3a[_0xe9e6('0x32')]['sort']);_0x26d055[_0xe9e6('0x3b')]=qs[_0xe9e6('0x33')](_[_0xe9e6('0x3c')](_0xc04c3a[_0xe9e6('0x32')],_0x3f7753[_0xe9e6('0x33')]),_0x22ae6c);if(_0xc04c3a[_0xe9e6('0x32')][_0xe9e6('0x3d')]){_0x26d055[_0xe9e6('0x3b')]=_[_0xe9e6('0x3e')](_0x26d055['where'],{'$or':_[_0xe9e6('0x30')](_0x22ae6c,function(_0xdea38d){if(_0xdea38d[_0xe9e6('0x3f')]!=='VIRTUAL'){var _0x50f4f7={};_0x50f4f7[_0xdea38d['name']]={'$like':'%'+_0xc04c3a[_0xe9e6('0x32')][_0xe9e6('0x3d')]+'%'};return _0x50f4f7;}})});}_0x26d055=_['merge']({},_0x26d055,_0xc04c3a[_0xe9e6('0x40')]);var _0x21bc24={'where':_0x26d055['where']};return db['SalesforceField'][_0xe9e6('0x1f')](_0x21bc24)['then'](function(_0x444e45){_0x18cdce[_0xe9e6('0x1f')]=_0x444e45;if(_0xc04c3a['query'][_0xe9e6('0x41')]){_0x26d055['include']=[{'all':!![]}];}return db[_0xe9e6('0x2b')]['findAll'](_0x26d055);})[_0xe9e6('0x26')](function(_0x171b46){_0x18cdce[_0xe9e6('0x42')]=_0x171b46;return _0x18cdce;})[_0xe9e6('0x26')](respondWithFilteredResult(_0x59931a,_0x26d055))[_0xe9e6('0x43')](handleError(_0x59931a,null));};exports[_0xe9e6('0x44')]=function(_0x3e73e3,_0x47a5d7){var _0xd75bd5={'raw':!![],'where':{'id':_0x3e73e3[_0xe9e6('0x45')]['id']}},_0x5008c9={};_0x5008c9['model']=_[_0xe9e6('0x31')](db['SalesforceField'][_0xe9e6('0x2c')]);_0x5008c9[_0xe9e6('0x32')]=_['keys'](_0x3e73e3[_0xe9e6('0x32')]);_0x5008c9['filters']=_[_0xe9e6('0x34')](_0x5008c9[_0xe9e6('0x2f')],_0x5008c9['query']);_0xd75bd5[_0xe9e6('0x35')]=_[_0xe9e6('0x34')](_0x5008c9[_0xe9e6('0x2f')],qs['fields'](_0x3e73e3[_0xe9e6('0x32')][_0xe9e6('0x36')]));_0xd75bd5[_0xe9e6('0x35')]=_0xd75bd5[_0xe9e6('0x35')][_0xe9e6('0x37')]?_0xd75bd5['attributes']:_0x5008c9[_0xe9e6('0x2f')];if(_0x3e73e3[_0xe9e6('0x32')]['includeAll']){_0xd75bd5['include']=[{'all':!![]}];}_0xd75bd5=_['merge']({},_0xd75bd5,_0x3e73e3[_0xe9e6('0x40')]);return db['SalesforceField'][_0xe9e6('0x46')](_0xd75bd5)[_0xe9e6('0x26')](handleEntityNotFound(_0x47a5d7,null))[_0xe9e6('0x26')](respondWithResult(_0x47a5d7,null))[_0xe9e6('0x43')](handleError(_0x47a5d7,null));};exports[_0xe9e6('0x47')]=function(_0x18cdca,_0x5cab66){return db['SalesforceField'][_0xe9e6('0x47')](_0x18cdca[_0xe9e6('0x48')],{})[_0xe9e6('0x26')](respondWithResult(_0x5cab66,0xc9))[_0xe9e6('0x43')](handleError(_0x5cab66,null));};exports['update']=function(_0x47ede9,_0x11c304){if(_0x47ede9[_0xe9e6('0x48')]['id']){delete _0x47ede9[_0xe9e6('0x48')]['id'];}return db[_0xe9e6('0x2b')][_0xe9e6('0x46')]({'where':{'id':_0x47ede9[_0xe9e6('0x45')]['id']}})[_0xe9e6('0x26')](handleEntityNotFound(_0x11c304,null))[_0xe9e6('0x26')](saveUpdates(_0x47ede9[_0xe9e6('0x48')],null))[_0xe9e6('0x26')](respondWithResult(_0x11c304,null))[_0xe9e6('0x43')](handleError(_0x11c304,null));};exports[_0xe9e6('0x25')]=function(_0x708b8a,_0x2c1860){return db[_0xe9e6('0x2b')][_0xe9e6('0x46')]({'where':{'id':_0x708b8a[_0xe9e6('0x45')]['id']}})['then'](handleEntityNotFound(_0x2c1860,null))[_0xe9e6('0x26')](removeEntity(_0x2c1860,null))['catch'](handleError(_0x2c1860,null));}; \ No newline at end of file +var _0xa4fc=['sox','to-csv','ejs','fs-extra','lodash','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','SalesforceField','includeAll','include','findAll','rows','catch','show','params','create','update','body','find','eml-format','zip-dir','request-promise','moment','bluebird','path'];(function(_0x5c273f,_0x31b473){var _0xd5eace=function(_0x3bc0ad){while(--_0x3bc0ad){_0x5c273f['push'](_0x5c273f['shift']());}};_0xd5eace(++_0x31b473);}(_0xa4fc,0x12a));var _0xca4f=function(_0x3b2050,_0xccbf14){_0x3b2050=_0x3b2050-0x0;var _0x59f839=_0xa4fc[_0x3b2050];return _0x59f839;};'use strict';var emlformat=require(_0xca4f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xca4f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xca4f('0x2'));var moment=require(_0xca4f('0x3'));var BPromise=require(_0xca4f('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xca4f('0x5'));var sox=require(_0xca4f('0x6'));var csv=require(_0xca4f('0x7'));var ejs=require(_0xca4f('0x8'));var fs=require('fs');var fs_extra=require(_0xca4f('0x9'));var _=require(_0xca4f('0xa'));var squel=require(_0xca4f('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xca4f('0x7'));var querystring=require('querystring');var Papa=require(_0xca4f('0xc'));var Redis=require(_0xca4f('0xd'));var authService=require(_0xca4f('0xe'));var qs=require(_0xca4f('0xf'));var as=require(_0xca4f('0x10'));var hardwareService=require(_0xca4f('0x11'));var logger=require(_0xca4f('0x12'))('api');var utils=require(_0xca4f('0x13'));var config=require(_0xca4f('0x14'));var licenseUtil=require(_0xca4f('0x15'));var db=require(_0xca4f('0x16'))['db'];function respondWithStatusCode(_0x15495b,_0x10db1b){_0x10db1b=_0x10db1b||0xcc;return function(_0x32afd8){if(_0x32afd8){return _0x15495b[_0xca4f('0x17')](_0x10db1b);}return _0x15495b['status'](_0x10db1b)[_0xca4f('0x18')]();};}function respondWithResult(_0x394185,_0x188a2a){_0x188a2a=_0x188a2a||0xc8;return function(_0x101945){if(_0x101945){return _0x394185[_0xca4f('0x19')](_0x188a2a)['json'](_0x101945);}};}function respondWithFilteredResult(_0x1b44e0,_0x100be3){return function(_0x3e817b){if(_0x3e817b){var _0x2c55e1=typeof _0x100be3[_0xca4f('0x1a')]===_0xca4f('0x1b')&&typeof _0x100be3[_0xca4f('0x1c')]===_0xca4f('0x1b');var _0xf8d203=_0x3e817b[_0xca4f('0x1d')];var _0x4bf2f4=_0x2c55e1?0x0:_0x100be3[_0xca4f('0x1a')];var _0x3e84d0=_0x2c55e1?_0x3e817b[_0xca4f('0x1d')]:_0x100be3['offset']+_0x100be3[_0xca4f('0x1c')];var _0x1fb1c8;if(_0x3e84d0>=_0xf8d203){_0x3e84d0=_0xf8d203;_0x1fb1c8=0xc8;}else{_0x1fb1c8=0xce;}_0x1b44e0[_0xca4f('0x19')](_0x1fb1c8);return _0x1b44e0[_0xca4f('0x1e')](_0xca4f('0x1f'),_0x4bf2f4+'-'+_0x3e84d0+'/'+_0xf8d203)[_0xca4f('0x20')](_0x3e817b);}return null;};}function patchUpdates(_0x18f1f8){return function(_0x5dc3ae){try{jsonpatch[_0xca4f('0x21')](_0x5dc3ae,_0x18f1f8,!![]);}catch(_0x2e01e5){return BPromise[_0xca4f('0x22')](_0x2e01e5);}return _0x5dc3ae[_0xca4f('0x23')]();};}function saveUpdates(_0x2f2042,_0x35e518){return function(_0x3f4bb4){if(_0x3f4bb4){return _0x3f4bb4['update'](_0x2f2042)[_0xca4f('0x24')](function(_0x50b135){return _0x50b135;});}return null;};}function removeEntity(_0x129f65,_0x10644e){return function(_0x58a5c1){if(_0x58a5c1){return _0x58a5c1[_0xca4f('0x25')]()['then'](function(){_0x129f65[_0xca4f('0x19')](0xcc)[_0xca4f('0x18')]();});}};}function handleEntityNotFound(_0x1de48a,_0x532bf9){return function(_0xe50f9a){if(!_0xe50f9a){_0x1de48a[_0xca4f('0x17')](0x194);}return _0xe50f9a;};}function handleError(_0x590398,_0x352454){_0x352454=_0x352454||0x1f4;return function(_0x537aa2){logger[_0xca4f('0x26')](_0x537aa2[_0xca4f('0x27')]);if(_0x537aa2[_0xca4f('0x28')]){delete _0x537aa2[_0xca4f('0x28')];}_0x590398[_0xca4f('0x19')](_0x352454)[_0xca4f('0x29')](_0x537aa2);};}exports[_0xca4f('0x2a')]=function(_0x34b4ff,_0x11ab51){var _0x342dd5={},_0x2f8ae7={},_0x11be84={'count':0x0,'rows':[]};var _0x48af93=_[_0xca4f('0x2b')](db['SalesforceField'][_0xca4f('0x2c')],function(_0x44d8f6){return{'name':_0x44d8f6[_0xca4f('0x2d')],'type':_0x44d8f6[_0xca4f('0x2e')][_0xca4f('0x2f')]};});_0x2f8ae7[_0xca4f('0x30')]=_[_0xca4f('0x2b')](_0x48af93,_0xca4f('0x28'));_0x2f8ae7[_0xca4f('0x31')]=_[_0xca4f('0x32')](_0x34b4ff[_0xca4f('0x31')]);_0x2f8ae7[_0xca4f('0x33')]=_[_0xca4f('0x34')](_0x2f8ae7[_0xca4f('0x30')],_0x2f8ae7[_0xca4f('0x31')]);_0x342dd5[_0xca4f('0x35')]=_[_0xca4f('0x34')](_0x2f8ae7['model'],qs['fields'](_0x34b4ff['query'][_0xca4f('0x36')]));_0x342dd5[_0xca4f('0x35')]=_0x342dd5[_0xca4f('0x35')][_0xca4f('0x37')]?_0x342dd5[_0xca4f('0x35')]:_0x2f8ae7[_0xca4f('0x30')];if(!_0x34b4ff[_0xca4f('0x31')]['hasOwnProperty'](_0xca4f('0x38'))){_0x342dd5[_0xca4f('0x1c')]=qs[_0xca4f('0x1c')](_0x34b4ff[_0xca4f('0x31')][_0xca4f('0x1c')]);_0x342dd5[_0xca4f('0x1a')]=qs[_0xca4f('0x1a')](_0x34b4ff[_0xca4f('0x31')]['offset']);}_0x342dd5['order']=qs['sort'](_0x34b4ff[_0xca4f('0x31')][_0xca4f('0x39')]);_0x342dd5['where']=qs[_0xca4f('0x33')](_[_0xca4f('0x3a')](_0x34b4ff['query'],_0x2f8ae7['filters']),_0x48af93);if(_0x34b4ff['query'][_0xca4f('0x3b')]){_0x342dd5['where']=_[_0xca4f('0x3c')](_0x342dd5[_0xca4f('0x3d')],{'$or':_[_0xca4f('0x2b')](_0x48af93,function(_0x43bb82){if(_0x43bb82[_0xca4f('0x2e')]!==_0xca4f('0x3e')){var _0x34f480={};_0x34f480[_0x43bb82[_0xca4f('0x28')]]={'$like':'%'+_0x34b4ff[_0xca4f('0x31')][_0xca4f('0x3b')]+'%'};return _0x34f480;}})});}_0x342dd5=_[_0xca4f('0x3c')]({},_0x342dd5,_0x34b4ff[_0xca4f('0x3f')]);var _0x20ff9e={'where':_0x342dd5['where']};return db[_0xca4f('0x40')][_0xca4f('0x1d')](_0x20ff9e)[_0xca4f('0x24')](function(_0xe344a){_0x11be84[_0xca4f('0x1d')]=_0xe344a;if(_0x34b4ff[_0xca4f('0x31')][_0xca4f('0x41')]){_0x342dd5[_0xca4f('0x42')]=[{'all':!![]}];}return db[_0xca4f('0x40')][_0xca4f('0x43')](_0x342dd5);})[_0xca4f('0x24')](function(_0x23e1e2){_0x11be84[_0xca4f('0x44')]=_0x23e1e2;return _0x11be84;})[_0xca4f('0x24')](respondWithFilteredResult(_0x11ab51,_0x342dd5))[_0xca4f('0x45')](handleError(_0x11ab51,null));};exports[_0xca4f('0x46')]=function(_0x48aeea,_0x1ba483){var _0x56c798={'raw':!![],'where':{'id':_0x48aeea[_0xca4f('0x47')]['id']}},_0x2d4ac6={};_0x2d4ac6['model']=_['keys'](db['SalesforceField'][_0xca4f('0x2c')]);_0x2d4ac6['query']=_[_0xca4f('0x32')](_0x48aeea['query']);_0x2d4ac6['filters']=_[_0xca4f('0x34')](_0x2d4ac6[_0xca4f('0x30')],_0x2d4ac6[_0xca4f('0x31')]);_0x56c798[_0xca4f('0x35')]=_[_0xca4f('0x34')](_0x2d4ac6['model'],qs[_0xca4f('0x36')](_0x48aeea['query']['fields']));_0x56c798[_0xca4f('0x35')]=_0x56c798[_0xca4f('0x35')][_0xca4f('0x37')]?_0x56c798['attributes']:_0x2d4ac6[_0xca4f('0x30')];if(_0x48aeea[_0xca4f('0x31')][_0xca4f('0x41')]){_0x56c798[_0xca4f('0x42')]=[{'all':!![]}];}_0x56c798=_[_0xca4f('0x3c')]({},_0x56c798,_0x48aeea[_0xca4f('0x3f')]);return db[_0xca4f('0x40')]['find'](_0x56c798)[_0xca4f('0x24')](handleEntityNotFound(_0x1ba483,null))[_0xca4f('0x24')](respondWithResult(_0x1ba483,null))[_0xca4f('0x45')](handleError(_0x1ba483,null));};exports[_0xca4f('0x48')]=function(_0x4bb4a0,_0x3e48df){return db['SalesforceField'][_0xca4f('0x48')](_0x4bb4a0['body'],{})[_0xca4f('0x24')](respondWithResult(_0x3e48df,0xc9))[_0xca4f('0x45')](handleError(_0x3e48df,null));};exports[_0xca4f('0x49')]=function(_0x2ae61f,_0x2fdd10){if(_0x2ae61f[_0xca4f('0x4a')]['id']){delete _0x2ae61f[_0xca4f('0x4a')]['id'];}return db[_0xca4f('0x40')][_0xca4f('0x4b')]({'where':{'id':_0x2ae61f[_0xca4f('0x47')]['id']}})[_0xca4f('0x24')](handleEntityNotFound(_0x2fdd10,null))[_0xca4f('0x24')](saveUpdates(_0x2ae61f[_0xca4f('0x4a')],null))[_0xca4f('0x24')](respondWithResult(_0x2fdd10,null))[_0xca4f('0x45')](handleError(_0x2fdd10,null));};exports[_0xca4f('0x25')]=function(_0x25c444,_0x30b0a0){return db['SalesforceField']['find']({'where':{'id':_0x25c444[_0xca4f('0x47')]['id']}})[_0xca4f('0x24')](handleEntityNotFound(_0x30b0a0,null))[_0xca4f('0x24')](removeEntity(_0x30b0a0,null))[_0xca4f('0x45')](handleError(_0x30b0a0,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 446573a..ef05189 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 _0xc00f=['path','rimraf','../../config/environment','./intSalesforceField.attributes','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','request-promise'];(function(_0x3c9920,_0x6abc8c){var _0x487e20=function(_0x5dbfad){while(--_0x5dbfad){_0x3c9920['push'](_0x3c9920['shift']());}};_0x487e20(++_0x6abc8c);}(_0xc00f,0xfa));var _0xfc00=function(_0x2ecf03,_0x2adccf){_0x2ecf03=_0x2ecf03-0x0;var _0x4418ab=_0xc00f[_0x2ecf03];return _0x4418ab;};'use strict';var _=require(_0xfc00('0x0'));var util=require('util');var logger=require(_0xfc00('0x1'))(_0xfc00('0x2'));var moment=require(_0xfc00('0x3'));var BPromise=require('bluebird');var rp=require(_0xfc00('0x4'));var fs=require('fs');var path=require(_0xfc00('0x5'));var rimraf=require(_0xfc00('0x6'));var config=require(_0xfc00('0x7'));var attributes=require(_0xfc00('0x8'));module['exports']=function(_0x548069,_0x3aabdc){return _0x548069[_0xfc00('0x9')](_0xfc00('0xa'),attributes,{'tableName':_0xfc00('0xb'),'paranoid':![],'indexes':[{'name':_0xfc00('0xc'),'fields':[_0xfc00('0xd'),_0xfc00('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0dce=['util','../../config/logger','api','moment','bluebird','request-promise','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField'];(function(_0x10234b,_0x5cb5ca){var _0x482a9a=function(_0x382d4d){while(--_0x382d4d){_0x10234b['push'](_0x10234b['shift']());}};_0x482a9a(++_0x5cb5ca);}(_0x0dce,0x108));var _0xe0dc=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x0dce[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var util=require(_0xe0dc('0x0'));var logger=require(_0xe0dc('0x1'))(_0xe0dc('0x2'));var moment=require(_0xe0dc('0x3'));var BPromise=require(_0xe0dc('0x4'));var rp=require(_0xe0dc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intSalesforceField.attributes');module[_0xe0dc('0x6')]=function(_0x3293d1,_0x2c3b23){return _0x3293d1[_0xe0dc('0x7')](_0xe0dc('0x8'),attributes,{'tableName':_0xe0dc('0x9'),'paranoid':![],'indexes':[{'name':_0xe0dc('0xa'),'fields':[_0xe0dc('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index ea71752..1c32f56 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 _0xef05=['request','then','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x487ab4,_0x1e24e8){var _0x3bef77=function(_0x5ce664){while(--_0x5ce664){_0x487ab4['push'](_0x487ab4['shift']());}};_0x3bef77(++_0x1e24e8);}(_0xef05,0x1d8));var _0x5ef0=function(_0x397b1b,_0x1af983){_0x397b1b=_0x397b1b-0x0;var _0x11bcd4=_0xef05[_0x397b1b];return _0x11bcd4;};'use strict';var _=require(_0x5ef0('0x0'));var util=require(_0x5ef0('0x1'));var moment=require(_0x5ef0('0x2'));var BPromise=require(_0x5ef0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5ef0('0x4'));var db=require(_0x5ef0('0x5'))['db'];var utils=require(_0x5ef0('0x6'));var logger=require(_0x5ef0('0x7'))(_0x5ef0('0x8'));var config=require(_0x5ef0('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5ef0('0xa')][_0x5ef0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x74657a,_0x4f1833,_0x71eeb3){return new BPromise(function(_0x34ca94,_0x36aa2b){return client[_0x5ef0('0xc')](_0x74657a,_0x71eeb3)[_0x5ef0('0xd')](function(_0x28d9df){logger['info'](_0x5ef0('0xe'),_0x4f1833,_0x5ef0('0xf'));logger[_0x5ef0('0x10')](_0x5ef0('0x11'),_0x4f1833,_0x5ef0('0xf'),JSON['stringify'](_0x28d9df));if(_0x28d9df[_0x5ef0('0x12')]){if(_0x28d9df[_0x5ef0('0x12')][_0x5ef0('0x13')]===0x1f4){logger[_0x5ef0('0x12')](_0x5ef0('0xe'),_0x4f1833,_0x28d9df['error'][_0x5ef0('0x14')]);return _0x36aa2b(_0x28d9df[_0x5ef0('0x12')][_0x5ef0('0x14')]);}logger[_0x5ef0('0x12')](_0x5ef0('0xe'),_0x4f1833,_0x28d9df['error'][_0x5ef0('0x14')]);return _0x34ca94(_0x28d9df[_0x5ef0('0x12')][_0x5ef0('0x14')]);}else{logger['info']('SalesforceField,\x20%s,\x20%s',_0x4f1833,'request\x20sent');_0x34ca94(_0x28d9df['result'][_0x5ef0('0x14')]);}})[_0x5ef0('0x15')](function(_0x4fdc62){logger[_0x5ef0('0x12')](_0x5ef0('0xe'),_0x4f1833,_0x4fdc62);_0x36aa2b(_0x4fdc62);});});} \ No newline at end of file +var _0x7146=['lodash','util','moment','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result'];(function(_0x22ba6,_0x18dc12){var _0x4dca2e=function(_0xaa542c){while(--_0xaa542c){_0x22ba6['push'](_0x22ba6['shift']());}};_0x4dca2e(++_0x18dc12);}(_0x7146,0x17c));var _0x6714=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x7146[_0x2dadb9];return _0x2f0097;};'use strict';var _=require(_0x6714('0x0'));var util=require(_0x6714('0x1'));var moment=require(_0x6714('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6714('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6714('0x4'))(_0x6714('0x5'));var config=require('../../config/environment');var jayson=require(_0x6714('0x6'));var client=jayson[_0x6714('0x7')][_0x6714('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x176766,_0x294c59,_0x3dc2fc){return new BPromise(function(_0x4f39b9,_0x10d6e7){return client[_0x6714('0x9')](_0x176766,_0x3dc2fc)[_0x6714('0xa')](function(_0x437682){logger['info'](_0x6714('0xb'),_0x294c59,_0x6714('0xc'));logger[_0x6714('0xd')](_0x6714('0xe'),_0x294c59,_0x6714('0xc'),JSON[_0x6714('0xf')](_0x437682));if(_0x437682[_0x6714('0x10')]){if(_0x437682[_0x6714('0x10')]['code']===0x1f4){logger['error'](_0x6714('0xb'),_0x294c59,_0x437682['error']['message']);return _0x10d6e7(_0x437682[_0x6714('0x10')][_0x6714('0x11')]);}logger[_0x6714('0x10')]('SalesforceField,\x20%s,\x20%s',_0x294c59,_0x437682[_0x6714('0x10')][_0x6714('0x11')]);return _0x4f39b9(_0x437682['error']['message']);}else{logger[_0x6714('0x12')](_0x6714('0xb'),_0x294c59,_0x6714('0xc'));_0x4f39b9(_0x437682[_0x6714('0x13')]['message']);}})['catch'](function(_0x555d4d){logger['error'](_0x6714('0xb'),_0x294c59,_0x555d4d);_0x10d6e7(_0x555d4d);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index d450b9e..5f2badc 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 _0x3b59=['/:id/configurations','getConfigurations','getFields','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','/:id'];(function(_0x100823,_0x18a17f){var _0x391ab2=function(_0xebc441){while(--_0xebc441){_0x100823['push'](_0x100823['shift']());}};_0x391ab2(++_0x18a17f);}(_0x3b59,0x9c));var _0x93b5=function(_0x46733d,_0x28cc9a){_0x46733d=_0x46733d-0x0;var _0xb37111=_0x3b59[_0x46733d];return _0xb37111;};'use strict';var multer=require(_0x93b5('0x0'));var util=require(_0x93b5('0x1'));var path=require(_0x93b5('0x2'));var timeout=require(_0x93b5('0x3'));var express=require(_0x93b5('0x4'));var router=express[_0x93b5('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x93b5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x93b5('0x7'));var controller=require(_0x93b5('0x8'));router[_0x93b5('0x9')]('/',auth[_0x93b5('0xa')](),controller['index']);router[_0x93b5('0x9')](_0x93b5('0xb'),auth[_0x93b5('0xa')](),controller['show']);router[_0x93b5('0x9')](_0x93b5('0xc'),auth[_0x93b5('0xa')](),controller[_0x93b5('0xd')]);router[_0x93b5('0x9')]('/:id/fields',auth[_0x93b5('0xa')](),controller[_0x93b5('0xe')]);router[_0x93b5('0xf')]('/',auth[_0x93b5('0xa')](),controller[_0x93b5('0x10')]);router['post'](_0x93b5('0xc'),auth[_0x93b5('0xa')](),controller['addConfiguration']);router[_0x93b5('0x11')](_0x93b5('0xb'),auth[_0x93b5('0xa')](),controller[_0x93b5('0x12')]);router[_0x93b5('0x13')]('/:id',auth[_0x93b5('0xa')](),controller[_0x93b5('0x14')]);module['exports']=router; \ No newline at end of file +var _0x5ee7=['multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','destroy'];(function(_0xa28b28,_0x188dd7){var _0x5f47d9=function(_0x180e53){while(--_0x180e53){_0xa28b28['push'](_0xa28b28['shift']());}};_0x5f47d9(++_0x188dd7);}(_0x5ee7,0xdc));var _0x75ee=function(_0x419ba6,_0x3c832a){_0x419ba6=_0x419ba6-0x0;var _0x556cee=_0x5ee7[_0x419ba6];return _0x556cee;};'use strict';var multer=require(_0x75ee('0x0'));var util=require(_0x75ee('0x1'));var path=require(_0x75ee('0x2'));var timeout=require('connect-timeout');var express=require(_0x75ee('0x3'));var router=express['Router']();var fs_extra=require(_0x75ee('0x4'));var auth=require(_0x75ee('0x5'));var interaction=require(_0x75ee('0x6'));var config=require('../../config/environment');var controller=require('./intServicenowAccount.controller');router['get']('/',auth[_0x75ee('0x7')](),controller[_0x75ee('0x8')]);router[_0x75ee('0x9')]('/:id',auth[_0x75ee('0x7')](),controller[_0x75ee('0xa')]);router[_0x75ee('0x9')](_0x75ee('0xb'),auth[_0x75ee('0x7')](),controller[_0x75ee('0xc')]);router[_0x75ee('0x9')](_0x75ee('0xd'),auth[_0x75ee('0x7')](),controller[_0x75ee('0xe')]);router[_0x75ee('0xf')]('/',auth[_0x75ee('0x7')](),controller[_0x75ee('0x10')]);router[_0x75ee('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x75ee('0x11')]);router[_0x75ee('0x12')](_0x75ee('0x13'),auth['isAuthenticated'](),controller[_0x75ee('0x14')]);router['delete'](_0x75ee('0x13'),auth[_0x75ee('0x7')](),controller[_0x75ee('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 9a02f3c..392ffa3 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 _0xdba0=['STRING','username','remoteUri','sequelize'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0xdba0,0xcb));var _0x0dba=function(_0x962fc5,_0x58f074){_0x962fc5=_0x962fc5-0x0;var _0x43667c=_0xdba0[_0x962fc5];return _0x43667c;};'use strict';var Sequelize=require(_0x0dba('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0dba('0x1')]},'username':{'type':Sequelize[_0x0dba('0x1')],'unique':_0x0dba('0x2')},'password':{'type':Sequelize[_0x0dba('0x1')]},'email':{'type':Sequelize[_0x0dba('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x0dba('0x3')},'serverUrl':{'type':Sequelize[_0x0dba('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x5753=['remoteUri','sequelize','exports','STRING','username'];(function(_0x5103a4,_0x4b7f5c){var _0x4f99e0=function(_0x1fb571){while(--_0x1fb571){_0x5103a4['push'](_0x5103a4['shift']());}};_0x4f99e0(++_0x4b7f5c);}(_0x5753,0x1af));var _0x3575=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x5753[_0x4b055c];return _0x4b62bb;};'use strict';var Sequelize=require(_0x3575('0x0'));module[_0x3575('0x1')]={'name':{'type':Sequelize[_0x3575('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x3575('0x2')],'unique':_0x3575('0x3')},'password':{'type':Sequelize[_0x3575('0x2')]},'email':{'type':Sequelize[_0x3575('0x2')]},'remoteUri':{'type':Sequelize[_0x3575('0x2')],'unique':_0x3575('0x4')},'serverUrl':{'type':Sequelize[_0x3575('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index a51e18a..3ea2d7d 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 _0xed44=['all','test','statusCode','error','Wrong\x20credentials','boolean','true','false','GET','sys_choice?sysparm_query=name=incident^element=','inactive','value','push','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','ServicenowAccount','fieldName','type','key','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','length','find','create','body','findOne','ServicenowConfiguration','getConfigurations','addConfiguration','AccountId','getSubjects','channel','Descriptions','ServicenowField','Subjects','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent','caused_by','watch_list','child_incidents','approval_history','sys_updated_by','user_input','state','calendar_stc','closed_at','cmdb_ci','impact','active','work_notes_list','business_service','priority','sys_domain_path','time_worked','expected_start','opened_at','business_duration','group_list','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','problem_id','company','reassignment_count','activity_due','comments','sla_due','approval','due_date','upon_approval','correlation_id','location','username','password','remoteUri','serverUrl','substring','%s/api/now/doc/table/schema/','format','%s/api/now/table/','incident?sysparm_display_value=all','result','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','log','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label'];(function(_0x2e6dbf,_0x57dd06){var _0x2680e5=function(_0x4018f4){while(--_0x4018f4){_0x2e6dbf['push'](_0x2e6dbf['shift']());}};_0x2680e5(++_0x57dd06);}(_0xed44,0xc5));var _0x4ed4=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xed44[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0x4ed4('0x0'));var rimraf=require(_0x4ed4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4ed4('0x2'));var rp=require(_0x4ed4('0x3'));var moment=require(_0x4ed4('0x4'));var BPromise=require(_0x4ed4('0x5'));var Mustache=require('mustache');var util=require(_0x4ed4('0x6'));var path=require('path');var sox=require(_0x4ed4('0x7'));var csv=require(_0x4ed4('0x8'));var ejs=require(_0x4ed4('0x9'));var fs=require('fs');var fs_extra=require(_0x4ed4('0xa'));var _=require(_0x4ed4('0xb'));var squel=require(_0x4ed4('0xc'));var crypto=require(_0x4ed4('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4ed4('0xe'));var toCsv=require(_0x4ed4('0x8'));var querystring=require(_0x4ed4('0xf'));var Papa=require(_0x4ed4('0x10'));var Redis=require(_0x4ed4('0x11'));var authService=require(_0x4ed4('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x4ed4('0x13'));var hardwareService=require(_0x4ed4('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x4ed4('0x15'));var config=require(_0x4ed4('0x16'));var licenseUtil=require(_0x4ed4('0x17'));var db=require(_0x4ed4('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xe4a50d,_0x31a446){_0x31a446=_0x31a446||0xcc;return function(_0x14d2d8){if(_0x14d2d8){return _0xe4a50d[_0x4ed4('0x19')](_0x31a446);}return _0xe4a50d[_0x4ed4('0x1a')](_0x31a446)[_0x4ed4('0x1b')]();};}function respondWithResult(_0xe2222a,_0x14ab36){_0x14ab36=_0x14ab36||0xc8;return function(_0x54c078){if(_0x54c078){return _0xe2222a['status'](_0x14ab36)[_0x4ed4('0x1c')](_0x54c078);}};}function respondWithFilteredResult(_0x5eacc5,_0x15e233){return function(_0x28224c){if(_0x28224c){var _0x3b277e=typeof _0x15e233[_0x4ed4('0x1d')]===_0x4ed4('0x1e')&&typeof _0x15e233[_0x4ed4('0x1f')]===_0x4ed4('0x1e');var _0x1ba018=_0x28224c[_0x4ed4('0x20')];var _0x12202a=_0x3b277e?0x0:_0x15e233[_0x4ed4('0x1d')];var _0x5aba19=_0x3b277e?_0x28224c[_0x4ed4('0x20')]:_0x15e233[_0x4ed4('0x1d')]+_0x15e233[_0x4ed4('0x1f')];var _0x59bf14;if(_0x5aba19>=_0x1ba018){_0x5aba19=_0x1ba018;_0x59bf14=0xc8;}else{_0x59bf14=0xce;}_0x5eacc5['status'](_0x59bf14);return _0x5eacc5[_0x4ed4('0x21')]('Content-Range',_0x12202a+'-'+_0x5aba19+'/'+_0x1ba018)[_0x4ed4('0x1c')](_0x28224c);}return null;};}function patchUpdates(_0x331612){return function(_0x480584){try{jsonpatch[_0x4ed4('0x22')](_0x480584,_0x331612,!![]);}catch(_0x8a20fa){return BPromise[_0x4ed4('0x23')](_0x8a20fa);}return _0x480584[_0x4ed4('0x24')]();};}function saveUpdates(_0x5f1dbf,_0x1fc131){return function(_0x2cffca){if(_0x2cffca){return _0x2cffca[_0x4ed4('0x25')](_0x5f1dbf)[_0x4ed4('0x26')](function(_0x16229f){return _0x16229f;});}return null;};}function removeEntity(_0x3243c1,_0x48eeef){return function(_0x252ab9){if(_0x252ab9){return _0x252ab9[_0x4ed4('0x27')]()[_0x4ed4('0x26')](function(){_0x3243c1[_0x4ed4('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31cca1,_0x3bef6a){return function(_0x364f5e){if(!_0x364f5e){_0x31cca1['sendStatus'](0x194);}return _0x364f5e;};}function handleError(_0x107ec0,_0x6c2dc){_0x6c2dc=_0x6c2dc||0x1f4;return function(_0x48cd0a){logger['error'](_0x48cd0a[_0x4ed4('0x28')]);if(_0x48cd0a[_0x4ed4('0x29')]){delete _0x48cd0a['name'];}_0x107ec0['status'](_0x6c2dc)[_0x4ed4('0x2a')](_0x48cd0a);};}exports[_0x4ed4('0x2b')]=function(_0x24dee0,_0x1f25a5){var _0xe9b17={},_0x121803={},_0x47c10b={'count':0x0,'rows':[]};var _0x556e3a=_[_0x4ed4('0x2c')](db[_0x4ed4('0x2d')]['rawAttributes'],function(_0x174d9){return{'name':_0x174d9[_0x4ed4('0x2e')],'type':_0x174d9[_0x4ed4('0x2f')][_0x4ed4('0x30')]};});_0x121803['model']=_[_0x4ed4('0x2c')](_0x556e3a,'name');_0x121803[_0x4ed4('0x31')]=_['keys'](_0x24dee0[_0x4ed4('0x31')]);_0x121803[_0x4ed4('0x32')]=_[_0x4ed4('0x33')](_0x121803[_0x4ed4('0x34')],_0x121803[_0x4ed4('0x31')]);_0xe9b17['attributes']=_[_0x4ed4('0x33')](_0x121803['model'],qs[_0x4ed4('0x35')](_0x24dee0['query'][_0x4ed4('0x35')]));_0xe9b17[_0x4ed4('0x36')]=_0xe9b17[_0x4ed4('0x36')]['length']?_0xe9b17['attributes']:_0x121803[_0x4ed4('0x34')];if(!_0x24dee0[_0x4ed4('0x31')][_0x4ed4('0x37')](_0x4ed4('0x38'))){_0xe9b17['limit']=qs[_0x4ed4('0x1f')](_0x24dee0[_0x4ed4('0x31')][_0x4ed4('0x1f')]);_0xe9b17[_0x4ed4('0x1d')]=qs[_0x4ed4('0x1d')](_0x24dee0[_0x4ed4('0x31')][_0x4ed4('0x1d')]);}_0xe9b17[_0x4ed4('0x39')]=qs[_0x4ed4('0x3a')](_0x24dee0[_0x4ed4('0x31')][_0x4ed4('0x3a')]);_0xe9b17[_0x4ed4('0x3b')]=qs['filters'](_[_0x4ed4('0x3c')](_0x24dee0[_0x4ed4('0x31')],_0x121803[_0x4ed4('0x32')]),_0x556e3a);if(_0x24dee0[_0x4ed4('0x31')][_0x4ed4('0x3d')]){_0xe9b17[_0x4ed4('0x3b')]=_[_0x4ed4('0x3e')](_0xe9b17[_0x4ed4('0x3b')],{'$or':_[_0x4ed4('0x2c')](_0x556e3a,function(_0x5d345a){if(_0x5d345a[_0x4ed4('0x2f')]!==_0x4ed4('0x3f')){var _0xc7e6f4={};_0xc7e6f4[_0x5d345a['name']]={'$like':'%'+_0x24dee0['query'][_0x4ed4('0x3d')]+'%'};return _0xc7e6f4;}})});}_0xe9b17=_[_0x4ed4('0x3e')]({},_0xe9b17,_0x24dee0[_0x4ed4('0x40')]);var _0x5b3ca5={'where':_0xe9b17[_0x4ed4('0x3b')]};return db[_0x4ed4('0x2d')][_0x4ed4('0x20')](_0x5b3ca5)[_0x4ed4('0x26')](function(_0x13adca){_0x47c10b[_0x4ed4('0x20')]=_0x13adca;if(_0x24dee0[_0x4ed4('0x31')][_0x4ed4('0x41')]){_0xe9b17[_0x4ed4('0x42')]=[{'all':!![]}];}return db[_0x4ed4('0x2d')][_0x4ed4('0x43')](_0xe9b17);})[_0x4ed4('0x26')](function(_0xf6a2de){_0x47c10b[_0x4ed4('0x44')]=_0xf6a2de;return _0x47c10b;})[_0x4ed4('0x26')](respondWithFilteredResult(_0x1f25a5,_0xe9b17))[_0x4ed4('0x45')](handleError(_0x1f25a5,null));};exports[_0x4ed4('0x46')]=function(_0x439e0d,_0x180ffb){var _0x29571d={'raw':![],'where':{'id':_0x439e0d[_0x4ed4('0x47')]['id']}},_0x4ec447={};_0x4ec447[_0x4ed4('0x34')]=_[_0x4ed4('0x48')](db[_0x4ed4('0x2d')][_0x4ed4('0x49')]);_0x4ec447[_0x4ed4('0x31')]=_[_0x4ed4('0x48')](_0x439e0d[_0x4ed4('0x31')]);_0x4ec447[_0x4ed4('0x32')]=_[_0x4ed4('0x33')](_0x4ec447[_0x4ed4('0x34')],_0x4ec447[_0x4ed4('0x31')]);_0x29571d[_0x4ed4('0x36')]=_['intersection'](_0x4ec447['model'],qs['fields'](_0x439e0d[_0x4ed4('0x31')][_0x4ed4('0x35')]));_0x29571d[_0x4ed4('0x36')]=_0x29571d['attributes'][_0x4ed4('0x4a')]?_0x29571d[_0x4ed4('0x36')]:_0x4ec447[_0x4ed4('0x34')];if(_0x439e0d[_0x4ed4('0x31')][_0x4ed4('0x41')]){_0x29571d[_0x4ed4('0x42')]=[{'all':!![]}];}_0x29571d=_[_0x4ed4('0x3e')]({},_0x29571d,_0x439e0d[_0x4ed4('0x40')]);return db['ServicenowAccount'][_0x4ed4('0x4b')](_0x29571d)[_0x4ed4('0x26')](handleEntityNotFound(_0x180ffb,null))[_0x4ed4('0x26')](respondWithResult(_0x180ffb,null))[_0x4ed4('0x45')](handleError(_0x180ffb,null));};exports[_0x4ed4('0x4c')]=function(_0x4bfbdf,_0x31532b){return db['ServicenowAccount'][_0x4ed4('0x4c')](_0x4bfbdf['body'],{})[_0x4ed4('0x26')](respondWithResult(_0x31532b,0xc9))[_0x4ed4('0x45')](handleError(_0x31532b,null));};exports[_0x4ed4('0x25')]=function(_0x3e9596,_0x522a60){if(_0x3e9596[_0x4ed4('0x4d')]['id']){delete _0x3e9596[_0x4ed4('0x4d')]['id'];}return db['ServicenowAccount']['find']({'where':{'id':_0x3e9596['params']['id']}})['then'](handleEntityNotFound(_0x522a60,null))[_0x4ed4('0x26')](saveUpdates(_0x3e9596[_0x4ed4('0x4d')],null))[_0x4ed4('0x26')](respondWithResult(_0x522a60,null))['catch'](handleError(_0x522a60,null));};exports[_0x4ed4('0x27')]=function(_0x4db12d,_0x18013e){return db[_0x4ed4('0x2d')][_0x4ed4('0x4b')]({'where':{'id':_0x4db12d['params']['id']}})[_0x4ed4('0x26')](handleEntityNotFound(_0x18013e,null))['then'](removeEntity(_0x18013e,null))['catch'](handleError(_0x18013e,null));};exports['getConfigurations']=function(_0xe89d0e,_0x3dcec3,_0x1c4279){var _0x19a388={};var _0x5c59bf={};var _0x17cea4;var _0x1c9207;return db['ServicenowAccount'][_0x4ed4('0x4e')]({'where':{'id':_0xe89d0e['params']['id']}})[_0x4ed4('0x26')](handleEntityNotFound(_0x3dcec3,null))[_0x4ed4('0x26')](function(_0xc8a3d8){if(_0xc8a3d8){_0x17cea4=_0xc8a3d8;_0x5c59bf[_0x4ed4('0x34')]=_[_0x4ed4('0x48')](db[_0x4ed4('0x4f')]['rawAttributes']);_0x5c59bf[_0x4ed4('0x31')]=_[_0x4ed4('0x48')](_0xe89d0e['query']);_0x5c59bf[_0x4ed4('0x32')]=_['intersection'](_0x5c59bf['model'],_0x5c59bf[_0x4ed4('0x31')]);_0x19a388[_0x4ed4('0x36')]=_[_0x4ed4('0x33')](_0x5c59bf[_0x4ed4('0x34')],qs[_0x4ed4('0x35')](_0xe89d0e[_0x4ed4('0x31')]['fields']));_0x19a388[_0x4ed4('0x36')]=_0x19a388['attributes']['length']?_0x19a388[_0x4ed4('0x36')]:_0x5c59bf['model'];_0x19a388[_0x4ed4('0x39')]=qs[_0x4ed4('0x3a')](_0xe89d0e[_0x4ed4('0x31')][_0x4ed4('0x3a')]);_0x19a388[_0x4ed4('0x3b')]=qs[_0x4ed4('0x32')](_[_0x4ed4('0x3c')](_0xe89d0e[_0x4ed4('0x31')],_0x5c59bf[_0x4ed4('0x32')]));if(_0xe89d0e[_0x4ed4('0x31')][_0x4ed4('0x3d')]){_0x19a388[_0x4ed4('0x3b')]=_[_0x4ed4('0x3e')](_0x19a388[_0x4ed4('0x3b')],{'$or':_[_0x4ed4('0x2c')](_0x19a388[_0x4ed4('0x36')],function(_0x43209b){var _0x1ba103={};_0x1ba103[_0x43209b]={'$like':'%'+_0xe89d0e[_0x4ed4('0x31')]['filter']+'%'};return _0x1ba103;})});}_0x19a388=_[_0x4ed4('0x3e')]({},_0x19a388,_0xe89d0e[_0x4ed4('0x40')]);return _0x17cea4[_0x4ed4('0x50')](_0x19a388);}})[_0x4ed4('0x26')](function(_0x22d06e){if(_0x22d06e){_0x1c9207=_0x22d06e[_0x4ed4('0x4a')];if(!_0xe89d0e[_0x4ed4('0x31')][_0x4ed4('0x37')]('nolimit')){_0x19a388['limit']=qs[_0x4ed4('0x1f')](_0xe89d0e[_0x4ed4('0x31')]['limit']);_0x19a388[_0x4ed4('0x1d')]=qs[_0x4ed4('0x1d')](_0xe89d0e[_0x4ed4('0x31')][_0x4ed4('0x1d')]);}return _0x17cea4['getConfigurations'](_0x19a388);}})[_0x4ed4('0x26')](function(_0x37ce59){if(_0x37ce59){return _0x37ce59?{'count':_0x1c9207,'rows':_0x37ce59}:null;}})[_0x4ed4('0x26')](respondWithResult(_0x3dcec3,null))[_0x4ed4('0x45')](handleError(_0x3dcec3,null));};exports[_0x4ed4('0x51')]=function(_0xf8969e,_0x390cdd,_0x2622ec){if(_0xf8969e['body']['id']){delete _0xf8969e['body']['id'];}return db[_0x4ed4('0x2d')][_0x4ed4('0x4e')]({'where':{'id':_0xf8969e['params']['id']}})[_0x4ed4('0x26')](handleEntityNotFound(_0x390cdd,null))[_0x4ed4('0x26')](function(_0x35b320){if(_0x35b320){_0xf8969e[_0x4ed4('0x4d')][_0x4ed4('0x52')]=_0x35b320['id'];_0xf8969e[_0x4ed4('0x4d')]['Subjects']=integrations[_0x4ed4('0x53')](_0xf8969e[_0x4ed4('0x4d')][_0x4ed4('0x54')],_0xf8969e[_0x4ed4('0x4d')]['type']);_0xf8969e[_0x4ed4('0x4d')][_0x4ed4('0x55')]=integrations['getDescriptions'](_0xf8969e[_0x4ed4('0x4d')][_0x4ed4('0x54')],_0xf8969e[_0x4ed4('0x4d')][_0x4ed4('0x2f')]);return db[_0x4ed4('0x4f')]['create'](_0xf8969e[_0x4ed4('0x4d')],{'include':[{'model':db[_0x4ed4('0x56')],'as':_0x4ed4('0x57')},{'model':db[_0x4ed4('0x56')],'as':_0x4ed4('0x55')}]});}return null;})[_0x4ed4('0x26')](respondWithResult(_0x390cdd,null))[_0x4ed4('0x45')](handleError(_0x390cdd,null));};exports[_0x4ed4('0x58')]=function(_0x3ff1dd,_0x2aa5ae,_0x24a0e5){var _0x2d95f0=[_0x4ed4('0x59'),_0x4ed4('0x5a'),_0x4ed4('0x5b'),_0x4ed4('0x5c'),_0x4ed4('0x5d'),_0x4ed4('0x5e'),_0x4ed4('0x5f'),_0x4ed4('0x60'),_0x4ed4('0x61')];var _0x2d84c9=[_0x4ed4('0x62'),'made_sla',_0x4ed4('0x63'),_0x4ed4('0x64'),'upon_reject','sys_updated_on',_0x4ed4('0x65'),_0x4ed4('0x5a'),_0x4ed4('0x66'),'number','resolved_by',_0x4ed4('0x67'),'opened_by',_0x4ed4('0x68'),'sys_created_on','sys_domain',_0x4ed4('0x69'),'sys_created_by',_0x4ed4('0x5b'),_0x4ed4('0x39'),_0x4ed4('0x6a'),_0x4ed4('0x6b'),_0x4ed4('0x6c'),'delivery_plan',_0x4ed4('0x6d'),_0x4ed4('0x6e'),_0x4ed4('0x6f'),_0x4ed4('0x70'),_0x4ed4('0x71'),_0x4ed4('0x72'),'rfc',_0x4ed4('0x73'),_0x4ed4('0x74'),_0x4ed4('0x75'),_0x4ed4('0x76'),_0x4ed4('0x77'),'work_end',_0x4ed4('0x78'),_0x4ed4('0x79'),_0x4ed4('0x7a'),_0x4ed4('0x7b'),_0x4ed4('0x5c'),_0x4ed4('0x7c'),_0x4ed4('0x7d'),'close_code',_0x4ed4('0x7e'),_0x4ed4('0x7f'),_0x4ed4('0x80'),_0x4ed4('0x81'),_0x4ed4('0x82'),_0x4ed4('0x83'),'description',_0x4ed4('0x84'),_0x4ed4('0x5e'),_0x4ed4('0x85'),_0x4ed4('0x86'),_0x4ed4('0x87'),_0x4ed4('0x88'),_0x4ed4('0x89'),_0x4ed4('0x8a'),_0x4ed4('0x8b'),_0x4ed4('0x8c'),_0x4ed4('0x5f'),'urgency',_0x4ed4('0x8d'),_0x4ed4('0x8e'),_0x4ed4('0x8f'),_0x4ed4('0x90'),'assigned_to',_0x4ed4('0x60'),_0x4ed4('0x91'),_0x4ed4('0x92'),_0x4ed4('0x93'),'comments_and_work_notes',_0x4ed4('0x94'),'sys_mod_count','reopen_count','sys_tags','escalation',_0x4ed4('0x95'),_0x4ed4('0x96'),_0x4ed4('0x97'),_0x4ed4('0x61')];var _0x298551='';var _0x349dbc='';var _0x2b1760=[];var _0x75059e='';var _0xf55e46='';var _0x4d3591=[];var _0x4992f8='';var _0x5c9c48='';var _0x4d698b={};var _0x515158='';return db[_0x4ed4('0x2d')][_0x4ed4('0x4e')]({'where':{'id':_0x3ff1dd['params']['id']},'attributes':['id',_0x4ed4('0x98'),_0x4ed4('0x99'),'email',_0x4ed4('0x9a'),_0x4ed4('0x9b')]})[_0x4ed4('0x26')](handleEntityNotFound(_0x2aa5ae,null))[_0x4ed4('0x26')](function(_0x56cacf){if(_0x56cacf){_0x515158=_0x56cacf[_0x4ed4('0x9a')];var _0x4bf7e9=_0x515158['slice'](-0x1);if(_0x4bf7e9==='/'){_0x515158=_0x515158[_0x4ed4('0x9c')](0x0,_0x515158['lastIndexOf'](_0x4bf7e9));}_0x5c9c48=util['format'](_0x4ed4('0x9d'),_0x515158);_0x4992f8=util[_0x4ed4('0x9e')](_0x4ed4('0x9f'),_0x515158);_0x4d698b={'user':_0x56cacf[_0x4ed4('0x98')],'pass':_0x56cacf[_0x4ed4('0x99')]};var _0x5b3d22={'method':'GET','uri':_0x5c9c48+_0x4ed4('0xa0'),'auth':_0x4d698b,'json':!![]};return rp(_0x5b3d22);}})['then'](function(_0x45702e){if(_0x45702e[_0x4ed4('0xa1')]['length']>0x0){_0x298551=_0x45702e[_0x4ed4('0xa1')];}console['log'](_0x4ed4('0xa2'),_0x298551);_0x4d3591=[];_0x349dbc=Object[_0x4ed4('0xa3')]([],_0x298551);_[_0x4ed4('0xa4')](_0x349dbc,function(_0x72ea34){return!_0x2d95f0[_0x4ed4('0xa5')](_0x72ea34[_0x4ed4('0x29')]);});_0x349dbc[_0x4ed4('0xa6')](function(_0x598760){var _0x2b7d69=createFieldObject(_0x4992f8,_0x4d698b,_0x598760[_0x4ed4('0xa7')],_0x598760[_0x4ed4('0x29')],_0x598760['label'],![]);_0x4d3591['push'](_0x2b7d69);});return Promise['all'](_0x4d3591);})[_0x4ed4('0x26')](function(_0xead7e4){_0x2b1760=_0xead7e4;_0x75059e=Object[_0x4ed4('0xa3')]([],_0x298551);console[_0x4ed4('0xa8')]('TCL:\x20_object',_0x298551);_[_0x4ed4('0xa4')](_0x75059e,function(_0x45b96b){return _0x2d84c9[_0x4ed4('0xa5')](_0x45b96b[_0x4ed4('0x29')]);});console['log'](_0x4ed4('0xa9'),_0x75059e);_0x4d3591=[];_0x75059e[_0x4ed4('0xa6')](function(_0x5b63af){var _0x1eee0f=createFieldObject(_0x4992f8,_0x4d698b,_0x5b63af['internalType'],_0x5b63af['name'],_0x5b63af[_0x4ed4('0xaa')],!![]);_0x4d3591['push'](_0x1eee0f);});return Promise[_0x4ed4('0xab')](_0x4d3591);})[_0x4ed4('0x26')](function(_0x1a65a3){_0xf55e46=_0x1a65a3;var _0x828d74=_0x2b1760['concat'](_0xf55e46);return{'count':_0x828d74[_0x4ed4('0x4a')],'rows':_0x828d74};})[_0x4ed4('0x26')](respondWithResult(_0x2aa5ae,null))[_0x4ed4('0x45')](function(_0x516f40){console[_0x4ed4('0xa8')]('ServiceNow\x20error:\x20'+_0x516f40);var _0x4a5f10=_0x3ff1dd[_0x4ed4('0x31')][_0x4ed4('0xac')]?0x1f4:_0x516f40[_0x4ed4('0xad')]||0x1f4;logger[_0x4ed4('0xae')](_0x516f40['stack']);delete _0x516f40['name'];if(_0x4a5f10===0x191){_0x4a5f10=0x190;}_0x2aa5ae[_0x4ed4('0x1a')](_0x4a5f10)[_0x4ed4('0x2a')](_0x3ff1dd[_0x4ed4('0x31')][_0x4ed4('0xac')]?{'message':_0x4ed4('0xaf'),'statusCode':_0x516f40['statusCode']}:_0x516f40);});};function createFieldObject(_0x34cc8a,_0x5d766b,_0x5b65ea,_0x3c37b4,_0x3bfc4a,_0x2209bc){return new Promise(function(_0x28474d,_0x487eac){var _0x4dd542={'id':_0x3c37b4,'name':_0x3bfc4a,'custom':_0x2209bc};if(_0x5b65ea===_0x4ed4('0xb0')){_0x4dd542[_0x4ed4('0x40')]=[{'name':'True','value':_0x4ed4('0xb1')},{'name':'False','value':_0x4ed4('0xb2')}];_0x28474d(_0x4dd542);}else{var _0x207181={'method':_0x4ed4('0xb3'),'uri':_0x34cc8a+_0x4ed4('0xb4')+_0x3c37b4,'auth':_0x5d766b,'json':!![]};return rp(_0x207181)[_0x4ed4('0x26')](function(_0x3478e4){var _0x47dd7f=[];if(_0x3478e4[_0x4ed4('0xa1')][_0x4ed4('0x4a')]>0x0){_0x3478e4[_0x4ed4('0xa1')]['forEach'](function(_0x522c7b){if(_0x522c7b[_0x4ed4('0xb5')]===_0x4ed4('0xb2')){var _0x2e94b1={'name':_0x522c7b['label'],'value':_0x522c7b[_0x4ed4('0xb6')]};_0x47dd7f[_0x4ed4('0xb7')](_0x2e94b1);}});}_0x4dd542[_0x4ed4('0x40')]=_0x47dd7f;if(_0x4dd542[_0x4ed4('0x40')][_0x4ed4('0x4a')]>0x0){_0x28474d(_0x4dd542);}else{if(_0x2209bc==![]){_0x28474d();}else{_0x28474d(_0x4dd542);}}});}});} \ No newline at end of file +var _0xa328=['json','apply','reject','update','then','end','sendStatus','stack','send','index','ServicenowAccount','rawAttributes','fieldName','type','model','map','name','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','findAll','rows','catch','show','params','intersection','include','find','create','body','destroy','findOne','ServicenowConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','knowledge','subcategory','close_code','notify','incident_state','severity','parent','caused_by','watch_list','upon_reject','sys_updated_on','number','sys_updated_by','opened_by','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','impact','active','business_service','priority','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','short_description','correlation_display','delivery_task','additional_assignee_list','description','sys_class_name','close_notes','closed_by','follow_up','sys_id','contact_type','reopened_by','problem_id','company','reassignment_count','activity_due','comments','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','correlation_id','location','username','password','email','serverUrl','slice','substring','lastIndexOf','%s/api/now/doc/table/schema/','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','label','push','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','all','concat','ServiceNow\x20error:\x20','test','statusCode','error','boolean','True','False','false','inactive','value','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','status','offset','undefined','limit','count','set','Content-Range'];(function(_0x4c6ca2,_0x4c657a){var _0x2c1591=function(_0x5064ce){while(--_0x5064ce){_0x4c6ca2['push'](_0x4c6ca2['shift']());}};_0x2c1591(++_0x4c657a);}(_0xa328,0x97));var _0x8a32=function(_0x5edbac,_0xa54f78){_0x5edbac=_0x5edbac-0x0;var _0x2a5b78=_0xa328[_0x5edbac];return _0x2a5b78;};'use strict';var emlformat=require(_0x8a32('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8a32('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8a32('0x2'));var moment=require(_0x8a32('0x3'));var BPromise=require(_0x8a32('0x4'));var Mustache=require(_0x8a32('0x5'));var util=require(_0x8a32('0x6'));var path=require('path');var sox=require(_0x8a32('0x7'));var csv=require(_0x8a32('0x8'));var ejs=require(_0x8a32('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8a32('0xa'));var squel=require(_0x8a32('0xb'));var crypto=require(_0x8a32('0xc'));var jsforce=require(_0x8a32('0xd'));var deskjs=require(_0x8a32('0xe'));var toCsv=require(_0x8a32('0x8'));var querystring=require('querystring');var Papa=require(_0x8a32('0xf'));var Redis=require(_0x8a32('0x10'));var authService=require(_0x8a32('0x11'));var qs=require(_0x8a32('0x12'));var as=require(_0x8a32('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8a32('0x14'))(_0x8a32('0x15'));var utils=require(_0x8a32('0x16'));var config=require(_0x8a32('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x8a32('0x18'));function respondWithStatusCode(_0x220948,_0x18a68e){_0x18a68e=_0x18a68e||0xcc;return function(_0x4c08ae){if(_0x4c08ae){return _0x220948['sendStatus'](_0x18a68e);}return _0x220948[_0x8a32('0x19')](_0x18a68e)['end']();};}function respondWithResult(_0x41ac5c,_0x4c37e5){_0x4c37e5=_0x4c37e5||0xc8;return function(_0x14f14e){if(_0x14f14e){return _0x41ac5c['status'](_0x4c37e5)['json'](_0x14f14e);}};}function respondWithFilteredResult(_0x17ca2e,_0x2ba113){return function(_0x467ee7){if(_0x467ee7){var _0x322915=typeof _0x2ba113[_0x8a32('0x1a')]===_0x8a32('0x1b')&&typeof _0x2ba113[_0x8a32('0x1c')]===_0x8a32('0x1b');var _0x1691b9=_0x467ee7[_0x8a32('0x1d')];var _0x1fd701=_0x322915?0x0:_0x2ba113[_0x8a32('0x1a')];var _0x2a8b60=_0x322915?_0x467ee7['count']:_0x2ba113[_0x8a32('0x1a')]+_0x2ba113[_0x8a32('0x1c')];var _0x25af9c;if(_0x2a8b60>=_0x1691b9){_0x2a8b60=_0x1691b9;_0x25af9c=0xc8;}else{_0x25af9c=0xce;}_0x17ca2e[_0x8a32('0x19')](_0x25af9c);return _0x17ca2e[_0x8a32('0x1e')](_0x8a32('0x1f'),_0x1fd701+'-'+_0x2a8b60+'/'+_0x1691b9)[_0x8a32('0x20')](_0x467ee7);}return null;};}function patchUpdates(_0x2495df){return function(_0x1fbd83){try{jsonpatch[_0x8a32('0x21')](_0x1fbd83,_0x2495df,!![]);}catch(_0x26ba4d){return BPromise[_0x8a32('0x22')](_0x26ba4d);}return _0x1fbd83['save']();};}function saveUpdates(_0x156549,_0x3afbea){return function(_0x5dc7d5){if(_0x5dc7d5){return _0x5dc7d5[_0x8a32('0x23')](_0x156549)['then'](function(_0x11487a){return _0x11487a;});}return null;};}function removeEntity(_0x275716,_0x3ee0c3){return function(_0x5bc3d9){if(_0x5bc3d9){return _0x5bc3d9['destroy']()[_0x8a32('0x24')](function(){_0x275716[_0x8a32('0x19')](0xcc)[_0x8a32('0x25')]();});}};}function handleEntityNotFound(_0x5f1bf9,_0x516289){return function(_0x29aaf2){if(!_0x29aaf2){_0x5f1bf9[_0x8a32('0x26')](0x194);}return _0x29aaf2;};}function handleError(_0x68d0ff,_0x381214){_0x381214=_0x381214||0x1f4;return function(_0x4259a1){logger['error'](_0x4259a1[_0x8a32('0x27')]);if(_0x4259a1['name']){delete _0x4259a1['name'];}_0x68d0ff[_0x8a32('0x19')](_0x381214)[_0x8a32('0x28')](_0x4259a1);};}exports[_0x8a32('0x29')]=function(_0x4535c4,_0x20e25f){var _0x26de2f={},_0x2d008f={},_0x426476={'count':0x0,'rows':[]};var _0x20952=_['map'](db[_0x8a32('0x2a')][_0x8a32('0x2b')],function(_0x21bf26){return{'name':_0x21bf26[_0x8a32('0x2c')],'type':_0x21bf26[_0x8a32('0x2d')]['key']};});_0x2d008f[_0x8a32('0x2e')]=_[_0x8a32('0x2f')](_0x20952,_0x8a32('0x30'));_0x2d008f['query']=_[_0x8a32('0x31')](_0x4535c4[_0x8a32('0x32')]);_0x2d008f[_0x8a32('0x33')]=_['intersection'](_0x2d008f[_0x8a32('0x2e')],_0x2d008f[_0x8a32('0x32')]);_0x26de2f[_0x8a32('0x34')]=_['intersection'](_0x2d008f[_0x8a32('0x2e')],qs[_0x8a32('0x35')](_0x4535c4['query'][_0x8a32('0x35')]));_0x26de2f['attributes']=_0x26de2f[_0x8a32('0x34')][_0x8a32('0x36')]?_0x26de2f[_0x8a32('0x34')]:_0x2d008f[_0x8a32('0x2e')];if(!_0x4535c4['query'][_0x8a32('0x37')](_0x8a32('0x38'))){_0x26de2f[_0x8a32('0x1c')]=qs[_0x8a32('0x1c')](_0x4535c4[_0x8a32('0x32')]['limit']);_0x26de2f[_0x8a32('0x1a')]=qs[_0x8a32('0x1a')](_0x4535c4['query'][_0x8a32('0x1a')]);}_0x26de2f[_0x8a32('0x39')]=qs[_0x8a32('0x3a')](_0x4535c4[_0x8a32('0x32')]['sort']);_0x26de2f[_0x8a32('0x3b')]=qs[_0x8a32('0x33')](_[_0x8a32('0x3c')](_0x4535c4[_0x8a32('0x32')],_0x2d008f[_0x8a32('0x33')]),_0x20952);if(_0x4535c4[_0x8a32('0x32')]['filter']){_0x26de2f[_0x8a32('0x3b')]=_[_0x8a32('0x3d')](_0x26de2f[_0x8a32('0x3b')],{'$or':_[_0x8a32('0x2f')](_0x20952,function(_0x13cfe6){if(_0x13cfe6[_0x8a32('0x2d')]!=='VIRTUAL'){var _0x5ce3dd={};_0x5ce3dd[_0x13cfe6['name']]={'$like':'%'+_0x4535c4['query'][_0x8a32('0x3e')]+'%'};return _0x5ce3dd;}})});}_0x26de2f=_[_0x8a32('0x3d')]({},_0x26de2f,_0x4535c4[_0x8a32('0x3f')]);var _0x326715={'where':_0x26de2f['where']};return db[_0x8a32('0x2a')][_0x8a32('0x1d')](_0x326715)['then'](function(_0x102baa){_0x426476[_0x8a32('0x1d')]=_0x102baa;if(_0x4535c4[_0x8a32('0x32')][_0x8a32('0x40')]){_0x26de2f['include']=[{'all':!![]}];}return db[_0x8a32('0x2a')][_0x8a32('0x41')](_0x26de2f);})['then'](function(_0x4f24bc){_0x426476[_0x8a32('0x42')]=_0x4f24bc;return _0x426476;})[_0x8a32('0x24')](respondWithFilteredResult(_0x20e25f,_0x26de2f))[_0x8a32('0x43')](handleError(_0x20e25f,null));};exports[_0x8a32('0x44')]=function(_0xcace85,_0x52bf52){var _0x238b1d={'raw':![],'where':{'id':_0xcace85[_0x8a32('0x45')]['id']}},_0xc2369b={};_0xc2369b[_0x8a32('0x2e')]=_[_0x8a32('0x31')](db[_0x8a32('0x2a')][_0x8a32('0x2b')]);_0xc2369b[_0x8a32('0x32')]=_[_0x8a32('0x31')](_0xcace85[_0x8a32('0x32')]);_0xc2369b[_0x8a32('0x33')]=_[_0x8a32('0x46')](_0xc2369b[_0x8a32('0x2e')],_0xc2369b['query']);_0x238b1d['attributes']=_[_0x8a32('0x46')](_0xc2369b[_0x8a32('0x2e')],qs[_0x8a32('0x35')](_0xcace85[_0x8a32('0x32')][_0x8a32('0x35')]));_0x238b1d[_0x8a32('0x34')]=_0x238b1d['attributes'][_0x8a32('0x36')]?_0x238b1d['attributes']:_0xc2369b[_0x8a32('0x2e')];if(_0xcace85[_0x8a32('0x32')]['includeAll']){_0x238b1d[_0x8a32('0x47')]=[{'all':!![]}];}_0x238b1d=_[_0x8a32('0x3d')]({},_0x238b1d,_0xcace85[_0x8a32('0x3f')]);return db['ServicenowAccount'][_0x8a32('0x48')](_0x238b1d)[_0x8a32('0x24')](handleEntityNotFound(_0x52bf52,null))[_0x8a32('0x24')](respondWithResult(_0x52bf52,null))['catch'](handleError(_0x52bf52,null));};exports[_0x8a32('0x49')]=function(_0x348620,_0xf3b239){return db['ServicenowAccount'][_0x8a32('0x49')](_0x348620[_0x8a32('0x4a')],{})[_0x8a32('0x24')](respondWithResult(_0xf3b239,0xc9))[_0x8a32('0x43')](handleError(_0xf3b239,null));};exports[_0x8a32('0x23')]=function(_0x443b7d,_0x17d4bf){if(_0x443b7d[_0x8a32('0x4a')]['id']){delete _0x443b7d[_0x8a32('0x4a')]['id'];}return db['ServicenowAccount'][_0x8a32('0x48')]({'where':{'id':_0x443b7d[_0x8a32('0x45')]['id']}})[_0x8a32('0x24')](handleEntityNotFound(_0x17d4bf,null))['then'](saveUpdates(_0x443b7d[_0x8a32('0x4a')],null))[_0x8a32('0x24')](respondWithResult(_0x17d4bf,null))['catch'](handleError(_0x17d4bf,null));};exports[_0x8a32('0x4b')]=function(_0x7e7f98,_0x501b61){return db[_0x8a32('0x2a')][_0x8a32('0x48')]({'where':{'id':_0x7e7f98[_0x8a32('0x45')]['id']}})[_0x8a32('0x24')](handleEntityNotFound(_0x501b61,null))[_0x8a32('0x24')](removeEntity(_0x501b61,null))[_0x8a32('0x43')](handleError(_0x501b61,null));};exports['getConfigurations']=function(_0x2893a3,_0x28f7d1,_0x323f13){var _0x643a4e={};var _0x48f336={};var _0xf85ecc;var _0x95dfd6;return db[_0x8a32('0x2a')][_0x8a32('0x4c')]({'where':{'id':_0x2893a3[_0x8a32('0x45')]['id']}})[_0x8a32('0x24')](handleEntityNotFound(_0x28f7d1,null))[_0x8a32('0x24')](function(_0x5caf24){if(_0x5caf24){_0xf85ecc=_0x5caf24;_0x48f336[_0x8a32('0x2e')]=_[_0x8a32('0x31')](db[_0x8a32('0x4d')][_0x8a32('0x2b')]);_0x48f336['query']=_[_0x8a32('0x31')](_0x2893a3['query']);_0x48f336[_0x8a32('0x33')]=_['intersection'](_0x48f336[_0x8a32('0x2e')],_0x48f336[_0x8a32('0x32')]);_0x643a4e[_0x8a32('0x34')]=_['intersection'](_0x48f336[_0x8a32('0x2e')],qs[_0x8a32('0x35')](_0x2893a3[_0x8a32('0x32')]['fields']));_0x643a4e['attributes']=_0x643a4e[_0x8a32('0x34')][_0x8a32('0x36')]?_0x643a4e[_0x8a32('0x34')]:_0x48f336[_0x8a32('0x2e')];_0x643a4e[_0x8a32('0x39')]=qs[_0x8a32('0x3a')](_0x2893a3['query'][_0x8a32('0x3a')]);_0x643a4e[_0x8a32('0x3b')]=qs[_0x8a32('0x33')](_[_0x8a32('0x3c')](_0x2893a3[_0x8a32('0x32')],_0x48f336[_0x8a32('0x33')]));if(_0x2893a3['query'][_0x8a32('0x3e')]){_0x643a4e['where']=_['merge'](_0x643a4e['where'],{'$or':_[_0x8a32('0x2f')](_0x643a4e[_0x8a32('0x34')],function(_0x12e946){var _0x4e1fa0={};_0x4e1fa0[_0x12e946]={'$like':'%'+_0x2893a3[_0x8a32('0x32')][_0x8a32('0x3e')]+'%'};return _0x4e1fa0;})});}_0x643a4e=_['merge']({},_0x643a4e,_0x2893a3[_0x8a32('0x3f')]);return _0xf85ecc[_0x8a32('0x4e')](_0x643a4e);}})[_0x8a32('0x24')](function(_0x2604d3){if(_0x2604d3){_0x95dfd6=_0x2604d3[_0x8a32('0x36')];if(!_0x2893a3[_0x8a32('0x32')][_0x8a32('0x37')](_0x8a32('0x38'))){_0x643a4e[_0x8a32('0x1c')]=qs[_0x8a32('0x1c')](_0x2893a3['query'][_0x8a32('0x1c')]);_0x643a4e[_0x8a32('0x1a')]=qs['offset'](_0x2893a3[_0x8a32('0x32')][_0x8a32('0x1a')]);}return _0xf85ecc[_0x8a32('0x4e')](_0x643a4e);}})[_0x8a32('0x24')](function(_0x5e84c1){if(_0x5e84c1){return _0x5e84c1?{'count':_0x95dfd6,'rows':_0x5e84c1}:null;}})['then'](respondWithResult(_0x28f7d1,null))[_0x8a32('0x43')](handleError(_0x28f7d1,null));};exports[_0x8a32('0x4f')]=function(_0x28a544,_0x3e3860,_0x11544c){if(_0x28a544[_0x8a32('0x4a')]['id']){delete _0x28a544[_0x8a32('0x4a')]['id'];}return db[_0x8a32('0x2a')][_0x8a32('0x4c')]({'where':{'id':_0x28a544[_0x8a32('0x45')]['id']}})['then'](handleEntityNotFound(_0x3e3860,null))[_0x8a32('0x24')](function(_0x428220){if(_0x428220){_0x28a544[_0x8a32('0x4a')][_0x8a32('0x50')]=_0x428220['id'];_0x28a544[_0x8a32('0x4a')][_0x8a32('0x51')]=integrations[_0x8a32('0x52')](_0x28a544[_0x8a32('0x4a')][_0x8a32('0x53')],_0x28a544['body'][_0x8a32('0x2d')]);_0x28a544[_0x8a32('0x4a')][_0x8a32('0x54')]=integrations[_0x8a32('0x55')](_0x28a544[_0x8a32('0x4a')][_0x8a32('0x53')],_0x28a544['body']['type']);return db[_0x8a32('0x4d')]['create'](_0x28a544[_0x8a32('0x4a')],{'include':[{'model':db[_0x8a32('0x56')],'as':_0x8a32('0x51')},{'model':db[_0x8a32('0x56')],'as':_0x8a32('0x54')}]});}return null;})[_0x8a32('0x24')](respondWithResult(_0x3e3860,null))[_0x8a32('0x43')](handleError(_0x3e3860,null));};exports[_0x8a32('0x57')]=function(_0x2c4663,_0x3235c2,_0x136a2b){var _0x58335d=[_0x8a32('0x58'),'hold_reason',_0x8a32('0x59'),_0x8a32('0x5a'),_0x8a32('0x5b'),_0x8a32('0x5c'),_0x8a32('0x5d'),_0x8a32('0x5e'),'category'];var _0x3a5a0b=[_0x8a32('0x5f'),_0x8a32('0x58'),_0x8a32('0x60'),_0x8a32('0x61'),_0x8a32('0x62'),_0x8a32('0x63'),'child_incidents','hold_reason','approval_history',_0x8a32('0x64'),'resolved_by',_0x8a32('0x65'),_0x8a32('0x66'),'user_input','sys_created_on',_0x8a32('0x67'),_0x8a32('0x68'),_0x8a32('0x69'),_0x8a32('0x59'),_0x8a32('0x39'),_0x8a32('0x6a'),_0x8a32('0x6b'),_0x8a32('0x6c'),'delivery_plan',_0x8a32('0x6d'),_0x8a32('0x6e'),'work_notes_list',_0x8a32('0x6f'),_0x8a32('0x70'),'sys_domain_path',_0x8a32('0x71'),_0x8a32('0x72'),_0x8a32('0x73'),_0x8a32('0x74'),_0x8a32('0x75'),_0x8a32('0x76'),_0x8a32('0x77'),_0x8a32('0x78'),_0x8a32('0x79'),_0x8a32('0x7a'),'approval_set',_0x8a32('0x5a'),'work_notes',_0x8a32('0x7b'),_0x8a32('0x5b'),_0x8a32('0x7c'),_0x8a32('0x7d'),'work_start','assignment_group','business_stc',_0x8a32('0x7e'),_0x8a32('0x7f'),'calendar_duration',_0x8a32('0x5c'),_0x8a32('0x80'),_0x8a32('0x81'),_0x8a32('0x82'),_0x8a32('0x83'),'parent_incident',_0x8a32('0x84'),_0x8a32('0x85'),_0x8a32('0x86'),_0x8a32('0x5d'),'urgency',_0x8a32('0x87'),_0x8a32('0x88'),_0x8a32('0x89'),_0x8a32('0x8a'),'assigned_to',_0x8a32('0x5e'),_0x8a32('0x8b'),'sla_due','approval',_0x8a32('0x8c'),_0x8a32('0x8d'),_0x8a32('0x8e'),_0x8a32('0x8f'),_0x8a32('0x90'),_0x8a32('0x91'),'upon_approval',_0x8a32('0x92'),_0x8a32('0x93'),'category'];var _0x100230='';var _0x36f301='';var _0x3dfcb1=[];var _0xf11cd9='';var _0x2d2d75='';var _0x1a25dd=[];var _0x358019='';var _0x370c07='';var _0x281783={};var _0x573792='';return db[_0x8a32('0x2a')][_0x8a32('0x4c')]({'where':{'id':_0x2c4663[_0x8a32('0x45')]['id']},'attributes':['id',_0x8a32('0x94'),_0x8a32('0x95'),_0x8a32('0x96'),'remoteUri',_0x8a32('0x97')]})[_0x8a32('0x24')](handleEntityNotFound(_0x3235c2,null))['then'](function(_0x2cf774){if(_0x2cf774){_0x573792=_0x2cf774['remoteUri'];var _0x3ba6df=_0x573792[_0x8a32('0x98')](-0x1);if(_0x3ba6df==='/'){_0x573792=_0x573792[_0x8a32('0x99')](0x0,_0x573792[_0x8a32('0x9a')](_0x3ba6df));}_0x370c07=util['format'](_0x8a32('0x9b'),_0x573792);_0x358019=util[_0x8a32('0x9c')](_0x8a32('0x9d'),_0x573792);_0x281783={'user':_0x2cf774[_0x8a32('0x94')],'pass':_0x2cf774[_0x8a32('0x95')]};var _0x29e591={'method':_0x8a32('0x9e'),'uri':_0x370c07+_0x8a32('0x9f'),'auth':_0x281783,'json':!![]};return rp(_0x29e591);}})['then'](function(_0x309d4d){if(_0x309d4d[_0x8a32('0xa0')][_0x8a32('0x36')]>0x0){_0x100230=_0x309d4d[_0x8a32('0xa0')];}console[_0x8a32('0xa1')](_0x8a32('0xa2'),_0x100230);_0x1a25dd=[];_0x36f301=Object[_0x8a32('0xa3')]([],_0x100230);_[_0x8a32('0xa4')](_0x36f301,function(_0x500611){return!_0x58335d[_0x8a32('0xa5')](_0x500611[_0x8a32('0x30')]);});_0x36f301['forEach'](function(_0x1b52a1){var _0x1a4900=createFieldObject(_0x358019,_0x281783,_0x1b52a1['internalType'],_0x1b52a1['name'],_0x1b52a1[_0x8a32('0xa6')],![]);_0x1a25dd[_0x8a32('0xa7')](_0x1a4900);});return Promise['all'](_0x1a25dd);})[_0x8a32('0x24')](function(_0x192564){_0x3dfcb1=_0x192564;_0xf11cd9=Object['assign']([],_0x100230);console['log'](_0x8a32('0xa8'),_0x100230);_[_0x8a32('0xa4')](_0xf11cd9,function(_0x52a6c6){return _0x3a5a0b[_0x8a32('0xa5')](_0x52a6c6[_0x8a32('0x30')]);});console['log'](_0x8a32('0xa9'),_0xf11cd9);_0x1a25dd=[];_0xf11cd9[_0x8a32('0xaa')](function(_0x23a79d){var _0x3f271b=createFieldObject(_0x358019,_0x281783,_0x23a79d['internalType'],_0x23a79d[_0x8a32('0x30')],_0x23a79d[_0x8a32('0xa6')],!![]);_0x1a25dd[_0x8a32('0xa7')](_0x3f271b);});return Promise[_0x8a32('0xab')](_0x1a25dd);})['then'](function(_0x277ad2){_0x2d2d75=_0x277ad2;var _0x3c1ca4=_0x3dfcb1[_0x8a32('0xac')](_0x2d2d75);return{'count':_0x3c1ca4['length'],'rows':_0x3c1ca4};})[_0x8a32('0x24')](respondWithResult(_0x3235c2,null))[_0x8a32('0x43')](function(_0x5e7788){console[_0x8a32('0xa1')](_0x8a32('0xad')+_0x5e7788);var _0x35ab8d=_0x2c4663['query'][_0x8a32('0xae')]?0x1f4:_0x5e7788[_0x8a32('0xaf')]||0x1f4;logger[_0x8a32('0xb0')](_0x5e7788[_0x8a32('0x27')]);delete _0x5e7788[_0x8a32('0x30')];if(_0x35ab8d===0x191){_0x35ab8d=0x190;}_0x3235c2['status'](_0x35ab8d)[_0x8a32('0x28')](_0x2c4663[_0x8a32('0x32')][_0x8a32('0xae')]?{'message':'Wrong\x20credentials','statusCode':_0x5e7788[_0x8a32('0xaf')]}:_0x5e7788);});};function createFieldObject(_0x58cf87,_0x1f48ae,_0x1ecdb4,_0x4561fb,_0x46cc49,_0x382799){return new Promise(function(_0x4fb3c9,_0xc370a2){var _0x2ef244={'id':_0x4561fb,'name':_0x46cc49,'custom':_0x382799};if(_0x1ecdb4===_0x8a32('0xb1')){_0x2ef244[_0x8a32('0x3f')]=[{'name':_0x8a32('0xb2'),'value':'true'},{'name':_0x8a32('0xb3'),'value':_0x8a32('0xb4')}];_0x4fb3c9(_0x2ef244);}else{var _0x2711fd={'method':_0x8a32('0x9e'),'uri':_0x58cf87+'sys_choice?sysparm_query=name=incident^element='+_0x4561fb,'auth':_0x1f48ae,'json':!![]};return rp(_0x2711fd)[_0x8a32('0x24')](function(_0x137816){var _0x423a29=[];if(_0x137816[_0x8a32('0xa0')]['length']>0x0){_0x137816['result'][_0x8a32('0xaa')](function(_0x1a5a65){if(_0x1a5a65[_0x8a32('0xb5')]===_0x8a32('0xb4')){var _0x1f2e1d={'name':_0x1a5a65[_0x8a32('0xa6')],'value':_0x1a5a65[_0x8a32('0xb6')]};_0x423a29['push'](_0x1f2e1d);}});}_0x2ef244[_0x8a32('0x3f')]=_0x423a29;if(_0x2ef244['options']['length']>0x0){_0x4fb3c9(_0x2ef244);}else{if(_0x382799==![]){_0x4fb3c9();}else{_0x4fb3c9(_0x2ef244);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 7377785..77a02d7 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 _0x7217=['api','moment','bluebird','request-promise','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','lodash','../../config/logger'];(function(_0x46d964,_0x504922){var _0x17b43f=function(_0x5d9e35){while(--_0x5d9e35){_0x46d964['push'](_0x46d964['shift']());}};_0x17b43f(++_0x504922);}(_0x7217,0x19e));var _0x7721=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x7217[_0x4baae2];return _0x1a2285;};'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'));var integrations=require(_0x7721('0x8'));module[_0x7721('0x9')]=function(_0xb239e0,_0xf7ff37){return _0xb239e0[_0x7721('0xa')](_0x7721('0xb'),attributes,{'tableName':_0x7721('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2675=['path','rimraf','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','int_servicenow_accounts','lodash','moment','bluebird'];(function(_0xc4a545,_0x4f50d9){var _0xfa810a=function(_0x57bbe8){while(--_0x57bbe8){_0xc4a545['push'](_0xc4a545['shift']());}};_0xfa810a(++_0x4f50d9);}(_0x2675,0x75));var _0x5267=function(_0xfa1950,_0x12df7d){_0xfa1950=_0xfa1950-0x0;var _0x4d8f0b=_0x2675[_0xfa1950];return _0x4d8f0b;};'use strict';var _=require(_0x5267('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5267('0x1'));var BPromise=require(_0x5267('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5267('0x3'));var rimraf=require(_0x5267('0x4'));var config=require('../../config/environment');var attributes=require(_0x5267('0x5'));var integrations=require(_0x5267('0x6'));module[_0x5267('0x7')]=function(_0x10f92c,_0x20f065){return _0x10f92c[_0x5267('0x8')]('ServicenowAccount',attributes,{'tableName':_0x5267('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 bc29178..14a41cd 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 _0x9341=['catch','GetServicenowAccount','ServicenowAccount','options','raw','where','attributes','limit','include','model','map','ShowServicenowAccount','stringify','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result'];(function(_0xa0389d,_0x31c0f4){var _0x5d30d9=function(_0x47b181){while(--_0x47b181){_0xa0389d['push'](_0xa0389d['shift']());}};_0x5d30d9(++_0x31c0f4);}(_0x9341,0x16b));var _0x1934=function(_0x380253,_0x1dfbec){_0x380253=_0x380253-0x0;var _0x233bd3=_0x9341[_0x380253];return _0x233bd3;};'use strict';var _=require(_0x1934('0x0'));var util=require('util');var moment=require(_0x1934('0x1'));var BPromise=require(_0x1934('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1934('0x3'));var db=require(_0x1934('0x4'))['db'];var utils=require(_0x1934('0x5'));var logger=require('../../config/logger')(_0x1934('0x6'));var config=require(_0x1934('0x7'));var jayson=require(_0x1934('0x8'));var client=jayson[_0x1934('0x9')][_0x1934('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x440c85,_0x178fc6,_0x391b37){return new BPromise(function(_0x366805,_0x4e69c3){return client[_0x1934('0xb')](_0x440c85,_0x391b37)[_0x1934('0xc')](function(_0x27309c){logger['info'](_0x1934('0xd'),_0x178fc6,_0x1934('0xe'));logger[_0x1934('0xf')](_0x1934('0x10'),_0x178fc6,'request\x20sent',JSON['stringify'](_0x27309c));if(_0x27309c[_0x1934('0x11')]){if(_0x27309c[_0x1934('0x11')][_0x1934('0x12')]===0x1f4){logger[_0x1934('0x11')](_0x1934('0xd'),_0x178fc6,_0x27309c[_0x1934('0x11')][_0x1934('0x13')]);return _0x4e69c3(_0x27309c[_0x1934('0x11')][_0x1934('0x13')]);}logger[_0x1934('0x11')](_0x1934('0xd'),_0x178fc6,_0x27309c[_0x1934('0x11')]['message']);return _0x366805(_0x27309c[_0x1934('0x11')][_0x1934('0x13')]);}else{logger[_0x1934('0x14')]('ServicenowAccount,\x20%s,\x20%s',_0x178fc6,_0x1934('0xe'));_0x366805(_0x27309c[_0x1934('0x15')][_0x1934('0x13')]);}})[_0x1934('0x16')](function(_0x1bbad0){logger['error'](_0x1934('0xd'),_0x178fc6,_0x1bbad0);_0x4e69c3(_0x1bbad0);});});}exports[_0x1934('0x17')]=function(_0xcd6d58){var _0x1a9e68=this;return new Promise(function(_0x2b23d3,_0x11c5e6){return db[_0x1934('0x18')]['findAll']({'raw':_0xcd6d58[_0x1934('0x19')]?_0xcd6d58[_0x1934('0x19')][_0x1934('0x1a')]===undefined?!![]:![]:!![],'where':_0xcd6d58[_0x1934('0x19')]?_0xcd6d58[_0x1934('0x19')][_0x1934('0x1b')]||null:null,'attributes':_0xcd6d58['options']?_0xcd6d58[_0x1934('0x19')][_0x1934('0x1c')]||null:null,'limit':_0xcd6d58['options']?_0xcd6d58[_0x1934('0x19')][_0x1934('0x1d')]||null:null,'include':_0xcd6d58['options']?_0xcd6d58[_0x1934('0x19')][_0x1934('0x1e')]?_['map'](_0xcd6d58['options'][_0x1934('0x1e')],function(_0x178cec){return{'model':db[_0x178cec[_0x1934('0x1f')]],'as':_0x178cec['as'],'attributes':_0x178cec[_0x1934('0x1c')],'include':_0x178cec[_0x1934('0x1e')]?_[_0x1934('0x20')](_0x178cec[_0x1934('0x1e')],function(_0x5270c2){return{'model':db[_0x5270c2[_0x1934('0x1f')]],'as':_0x5270c2['as'],'attributes':_0x5270c2['attributes'],'include':_0x5270c2[_0x1934('0x1e')]?_[_0x1934('0x20')](_0x5270c2[_0x1934('0x1e')],function(_0x2f0fad){return{'model':db[_0x2f0fad[_0x1934('0x1f')]],'as':_0x2f0fad['as'],'attributes':_0x2f0fad[_0x1934('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1934('0xc')](function(_0x984904){logger[_0x1934('0x14')](_0x1934('0x17'),_0xcd6d58);logger[_0x1934('0xf')]('GetServicenowAccount',_0xcd6d58,JSON['stringify'](_0x984904));_0x2b23d3(_0x984904);})[_0x1934('0x16')](function(_0x425b0d){logger[_0x1934('0x11')](_0x1934('0x17'),_0x425b0d['message'],_0xcd6d58);_0x11c5e6(_0x1a9e68[_0x1934('0x11')](0x1f4,_0x425b0d[_0x1934('0x13')]));});});};exports['ShowServicenowAccount']=function(_0x20cf5e){var _0x40b457=this;return new Promise(function(_0x3fe181,_0x18e578){return db[_0x1934('0x18')]['find']({'raw':_0x20cf5e['options']?_0x20cf5e['options'][_0x1934('0x1a')]===undefined?!![]:![]:!![],'where':_0x20cf5e['options']?_0x20cf5e[_0x1934('0x19')][_0x1934('0x1b')]||null:null,'attributes':_0x20cf5e[_0x1934('0x19')]?_0x20cf5e[_0x1934('0x19')][_0x1934('0x1c')]||null:null,'include':_0x20cf5e[_0x1934('0x19')]?_0x20cf5e[_0x1934('0x19')][_0x1934('0x1e')]?_['map'](_0x20cf5e[_0x1934('0x19')][_0x1934('0x1e')],function(_0x10a7a4){return{'model':db[_0x10a7a4[_0x1934('0x1f')]],'as':_0x10a7a4['as'],'attributes':_0x10a7a4[_0x1934('0x1c')],'include':_0x10a7a4[_0x1934('0x1e')]?_[_0x1934('0x20')](_0x10a7a4[_0x1934('0x1e')],function(_0x375068){return{'model':db[_0x375068['model']],'as':_0x375068['as'],'attributes':_0x375068[_0x1934('0x1c')],'include':_0x375068['include']?_[_0x1934('0x20')](_0x375068['include'],function(_0xf8a66){return{'model':db[_0xf8a66[_0x1934('0x1f')]],'as':_0xf8a66['as'],'attributes':_0xf8a66[_0x1934('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xc686e6){logger['info'](_0x1934('0x21'),_0x20cf5e);logger['debug'](_0x1934('0x21'),_0x20cf5e,JSON[_0x1934('0x22')](_0xc686e6));_0x3fe181(_0xc686e6);})[_0x1934('0x16')](function(_0x14e41a){logger[_0x1934('0x11')](_0x1934('0x21'),_0x14e41a['message'],_0x20cf5e);_0x18e578(_0x40b457[_0x1934('0x11')](0x1f4,_0x14e41a['message']));});});}; \ No newline at end of file +var _0x77e6=['then','ShowServicenowAccount','find','where','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetServicenowAccount','ServicenowAccount','findAll','options','raw','include','map','model','attributes'];(function(_0x23e2bb,_0xd82b6d){var _0x2dd8ed=function(_0x4af0ce){while(--_0x4af0ce){_0x23e2bb['push'](_0x23e2bb['shift']());}};_0x2dd8ed(++_0xd82b6d);}(_0x77e6,0x163));var _0x677e=function(_0x4c8e9d,_0xe67e2a){_0x4c8e9d=_0x4c8e9d-0x0;var _0x2e9a1e=_0x77e6[_0x4c8e9d];return _0x2e9a1e;};'use strict';var _=require(_0x677e('0x0'));var util=require(_0x677e('0x1'));var moment=require('moment');var BPromise=require(_0x677e('0x2'));var rs=require(_0x677e('0x3'));var fs=require('fs');var Redis=require(_0x677e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x677e('0x5'));var logger=require(_0x677e('0x6'))('rpc');var config=require(_0x677e('0x7'));var jayson=require(_0x677e('0x8'));var client=jayson[_0x677e('0x9')][_0x677e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x47cc95,_0x2ff616,_0x338a47){return new BPromise(function(_0xb2c618,_0x317762){return client['request'](_0x47cc95,_0x338a47)['then'](function(_0x1f4bdb){logger[_0x677e('0xb')](_0x677e('0xc'),_0x2ff616,_0x677e('0xd'));logger[_0x677e('0xe')](_0x677e('0xf'),_0x2ff616,'request\x20sent',JSON[_0x677e('0x10')](_0x1f4bdb));if(_0x1f4bdb[_0x677e('0x11')]){if(_0x1f4bdb[_0x677e('0x11')][_0x677e('0x12')]===0x1f4){logger[_0x677e('0x11')](_0x677e('0xc'),_0x2ff616,_0x1f4bdb[_0x677e('0x11')]['message']);return _0x317762(_0x1f4bdb[_0x677e('0x11')][_0x677e('0x13')]);}logger[_0x677e('0x11')](_0x677e('0xc'),_0x2ff616,_0x1f4bdb[_0x677e('0x11')][_0x677e('0x13')]);return _0xb2c618(_0x1f4bdb[_0x677e('0x11')][_0x677e('0x13')]);}else{logger[_0x677e('0xb')](_0x677e('0xc'),_0x2ff616,_0x677e('0xd'));_0xb2c618(_0x1f4bdb[_0x677e('0x14')][_0x677e('0x13')]);}})['catch'](function(_0x1436b2){logger[_0x677e('0x11')](_0x677e('0xc'),_0x2ff616,_0x1436b2);_0x317762(_0x1436b2);});});}exports[_0x677e('0x15')]=function(_0xb16d4){var _0x5cf4a8=this;return new Promise(function(_0xbd35e5,_0x58d3e5){return db[_0x677e('0x16')][_0x677e('0x17')]({'raw':_0xb16d4[_0x677e('0x18')]?_0xb16d4[_0x677e('0x18')][_0x677e('0x19')]===undefined?!![]:![]:!![],'where':_0xb16d4[_0x677e('0x18')]?_0xb16d4['options']['where']||null:null,'attributes':_0xb16d4[_0x677e('0x18')]?_0xb16d4[_0x677e('0x18')]['attributes']||null:null,'limit':_0xb16d4[_0x677e('0x18')]?_0xb16d4[_0x677e('0x18')]['limit']||null:null,'include':_0xb16d4[_0x677e('0x18')]?_0xb16d4[_0x677e('0x18')][_0x677e('0x1a')]?_[_0x677e('0x1b')](_0xb16d4[_0x677e('0x18')][_0x677e('0x1a')],function(_0x90d90c){return{'model':db[_0x90d90c[_0x677e('0x1c')]],'as':_0x90d90c['as'],'attributes':_0x90d90c[_0x677e('0x1d')],'include':_0x90d90c[_0x677e('0x1a')]?_[_0x677e('0x1b')](_0x90d90c[_0x677e('0x1a')],function(_0x4091f8){return{'model':db[_0x4091f8[_0x677e('0x1c')]],'as':_0x4091f8['as'],'attributes':_0x4091f8[_0x677e('0x1d')],'include':_0x4091f8['include']?_[_0x677e('0x1b')](_0x4091f8[_0x677e('0x1a')],function(_0x52aca6){return{'model':db[_0x52aca6[_0x677e('0x1c')]],'as':_0x52aca6['as'],'attributes':_0x52aca6[_0x677e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x677e('0x1e')](function(_0x38423f){logger['info'](_0x677e('0x15'),_0xb16d4);logger['debug'](_0x677e('0x15'),_0xb16d4,JSON[_0x677e('0x10')](_0x38423f));_0xbd35e5(_0x38423f);})['catch'](function(_0x18a2b1){logger[_0x677e('0x11')](_0x677e('0x15'),_0x18a2b1[_0x677e('0x13')],_0xb16d4);_0x58d3e5(_0x5cf4a8[_0x677e('0x11')](0x1f4,_0x18a2b1[_0x677e('0x13')]));});});};exports[_0x677e('0x1f')]=function(_0x2eaa08){var _0x42bbbd=this;return new Promise(function(_0x553c27,_0x15deaa){return db[_0x677e('0x16')][_0x677e('0x20')]({'raw':_0x2eaa08[_0x677e('0x18')]?_0x2eaa08[_0x677e('0x18')][_0x677e('0x19')]===undefined?!![]:![]:!![],'where':_0x2eaa08[_0x677e('0x18')]?_0x2eaa08[_0x677e('0x18')][_0x677e('0x21')]||null:null,'attributes':_0x2eaa08[_0x677e('0x18')]?_0x2eaa08[_0x677e('0x18')][_0x677e('0x1d')]||null:null,'include':_0x2eaa08[_0x677e('0x18')]?_0x2eaa08[_0x677e('0x18')][_0x677e('0x1a')]?_[_0x677e('0x1b')](_0x2eaa08[_0x677e('0x18')][_0x677e('0x1a')],function(_0x5ec1f5){return{'model':db[_0x5ec1f5[_0x677e('0x1c')]],'as':_0x5ec1f5['as'],'attributes':_0x5ec1f5['attributes'],'include':_0x5ec1f5[_0x677e('0x1a')]?_[_0x677e('0x1b')](_0x5ec1f5[_0x677e('0x1a')],function(_0x2c28bd){return{'model':db[_0x2c28bd[_0x677e('0x1c')]],'as':_0x2c28bd['as'],'attributes':_0x2c28bd[_0x677e('0x1d')],'include':_0x2c28bd[_0x677e('0x1a')]?_[_0x677e('0x1b')](_0x2c28bd[_0x677e('0x1a')],function(_0x2e317e){return{'model':db[_0x2e317e[_0x677e('0x1c')]],'as':_0x2e317e['as'],'attributes':_0x2e317e[_0x677e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x677e('0x1e')](function(_0x58f246){logger[_0x677e('0xb')]('ShowServicenowAccount',_0x2eaa08);logger[_0x677e('0xe')](_0x677e('0x1f'),_0x2eaa08,JSON[_0x677e('0x10')](_0x58f246));_0x553c27(_0x58f246);})[_0x677e('0x22')](function(_0x4fd8c9){logger[_0x677e('0x11')]('ShowServicenowAccount',_0x4fd8c9[_0x677e('0x13')],_0x2eaa08);_0x15deaa(_0x42bbbd[_0x677e('0x11')](0x1f4,_0x4fd8c9[_0x677e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 45d60b8..670c1fe 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 _0x5e74=['update','destroy','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/descriptions','getDescriptions','post','create','put'];(function(_0x5dcde3,_0x274c46){var _0x41b8f0=function(_0x2c1f53){while(--_0x2c1f53){_0x5dcde3['push'](_0x5dcde3['shift']());}};_0x41b8f0(++_0x274c46);}(_0x5e74,0x158));var _0x45e7=function(_0x237fd7,_0x28850b){_0x237fd7=_0x237fd7-0x0;var _0x25bc63=_0x5e74[_0x237fd7];return _0x25bc63;};'use strict';var multer=require(_0x45e7('0x0'));var util=require('util');var path=require(_0x45e7('0x1'));var timeout=require(_0x45e7('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x45e7('0x3'));var interaction=require(_0x45e7('0x4'));var config=require(_0x45e7('0x5'));var controller=require('./intServicenowConfiguration.controller');router[_0x45e7('0x6')]('/',auth[_0x45e7('0x7')](),controller['index']);router[_0x45e7('0x6')](_0x45e7('0x8'),auth['isAuthenticated'](),controller[_0x45e7('0x9')]);router[_0x45e7('0x6')](_0x45e7('0xa'),auth['isAuthenticated'](),controller[_0x45e7('0xb')]);router[_0x45e7('0x6')]('/:id/subjects',auth[_0x45e7('0x7')](),controller['getSubjects']);router[_0x45e7('0x6')](_0x45e7('0xc'),auth[_0x45e7('0x7')](),controller[_0x45e7('0xd')]);router[_0x45e7('0xe')]('/',auth[_0x45e7('0x7')](),controller[_0x45e7('0xf')]);router[_0x45e7('0x10')](_0x45e7('0x8'),auth[_0x45e7('0x7')](),controller[_0x45e7('0x11')]);router['delete'](_0x45e7('0x8'),auth[_0x45e7('0x7')](),controller[_0x45e7('0x12')]);module['exports']=router; \ No newline at end of file +var _0xd363=['get','isAuthenticated','index','/:id','show','/:id/subjects','/:id/descriptions','post','create','put','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intServicenowConfiguration.controller'];(function(_0x5bf7f2,_0x341dbe){var _0x55ac3b=function(_0x428bec){while(--_0x428bec){_0x5bf7f2['push'](_0x5bf7f2['shift']());}};_0x55ac3b(++_0x341dbe);}(_0xd363,0xc0));var _0x3d36=function(_0x1d87fc,_0x1e5321){_0x1d87fc=_0x1d87fc-0x0;var _0x492b56=_0xd363[_0x1d87fc];return _0x492b56;};'use strict';var multer=require(_0x3d36('0x0'));var util=require('util');var path=require(_0x3d36('0x1'));var timeout=require(_0x3d36('0x2'));var express=require(_0x3d36('0x3'));var router=express[_0x3d36('0x4')]();var fs_extra=require(_0x3d36('0x5'));var auth=require(_0x3d36('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3d36('0x7'));router[_0x3d36('0x8')]('/',auth[_0x3d36('0x9')](),controller[_0x3d36('0xa')]);router[_0x3d36('0x8')](_0x3d36('0xb'),auth[_0x3d36('0x9')](),controller[_0x3d36('0xc')]);router[_0x3d36('0x8')]('/:id/fields',auth[_0x3d36('0x9')](),controller['getFields']);router[_0x3d36('0x8')](_0x3d36('0xd'),auth[_0x3d36('0x9')](),controller['getSubjects']);router[_0x3d36('0x8')](_0x3d36('0xe'),auth[_0x3d36('0x9')](),controller['getDescriptions']);router[_0x3d36('0xf')]('/',auth[_0x3d36('0x9')](),controller[_0x3d36('0x10')]);router[_0x3d36('0x11')](_0x3d36('0xb'),auth[_0x3d36('0x9')](),controller['update']);router[_0x3d36('0x12')](_0x3d36('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x3d36('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 05a85fb..341aaf4 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 _0x0c11=['exports','STRING','sequelize'];(function(_0x1c4ca0,_0x6ae943){var _0x5334a3=function(_0x4dfa6a){while(--_0x4dfa6a){_0x1c4ca0['push'](_0x1c4ca0['shift']());}};_0x5334a3(++_0x6ae943);}(_0x0c11,0x1b5));var _0x10c1=function(_0x1030ce,_0xbe3f74){_0x1030ce=_0x1030ce-0x0;var _0x3367fd=_0x0c11[_0x1030ce];return _0x3367fd;};'use strict';var Sequelize=require(_0x10c1('0x0'));module[_0x10c1('0x1')]={'name':{'type':Sequelize[_0x10c1('0x2')]},'description':{'type':Sequelize[_0x10c1('0x2')]}}; \ No newline at end of file +var _0x4ee0=['STRING','exports'];(function(_0x2396f4,_0x5d1086){var _0x2ad9d8=function(_0xdde5da){while(--_0xdde5da){_0x2396f4['push'](_0x2396f4['shift']());}};_0x2ad9d8(++_0x5d1086);}(_0x4ee0,0x1d3));var _0x04ee=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x4ee0[_0x4792c8];return _0x35edb1;};'use strict';var Sequelize=require('sequelize');module[_0x04ee('0x0')]={'name':{'type':Sequelize[_0x04ee('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 8840c07..522cdb9 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 _0x32ea=['to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','save','update','then','destroy','error','name','send','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','options','ServicenowConfiguration','count','includeAll','include','findAll','rows','show','params','find','catch','create','body','getFields','findOne','ServicenowField','filter','nolimit','getSubjects','getDescriptions','fast-json-patch','request-promise','bluebird','sox'];(function(_0x280754,_0x33fd89){var _0x536e68=function(_0x40d1e7){while(--_0x40d1e7){_0x280754['push'](_0x280754['shift']());}};_0x536e68(++_0x33fd89);}(_0x32ea,0x187));var _0xa32e=function(_0x4bd950,_0x184ed5){_0x4bd950=_0x4bd950-0x0;var _0x5dc59a=_0x32ea[_0x4bd950];return _0x5dc59a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa32e('0x0'));var rp=require(_0xa32e('0x1'));var moment=require('moment');var BPromise=require(_0xa32e('0x2'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xa32e('0x3'));var csv=require(_0xa32e('0x4'));var ejs=require(_0xa32e('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa32e('0x6'));var squel=require(_0xa32e('0x7'));var crypto=require(_0xa32e('0x8'));var jsforce=require(_0xa32e('0x9'));var deskjs=require(_0xa32e('0xa'));var toCsv=require(_0xa32e('0x4'));var querystring=require(_0xa32e('0xb'));var Papa=require(_0xa32e('0xc'));var Redis=require(_0xa32e('0xd'));var authService=require(_0xa32e('0xe'));var qs=require(_0xa32e('0xf'));var as=require(_0xa32e('0x10'));var hardwareService=require(_0xa32e('0x11'));var logger=require(_0xa32e('0x12'))(_0xa32e('0x13'));var utils=require('../../config/utils');var config=require(_0xa32e('0x14'));var licenseUtil=require(_0xa32e('0x15'));var db=require(_0xa32e('0x16'))['db'];function respondWithStatusCode(_0x143e9d,_0x3b6d69){_0x3b6d69=_0x3b6d69||0xcc;return function(_0x54e60c){if(_0x54e60c){return _0x143e9d[_0xa32e('0x17')](_0x3b6d69);}return _0x143e9d[_0xa32e('0x18')](_0x3b6d69)[_0xa32e('0x19')]();};}function respondWithResult(_0x18fccc,_0x3a2826){_0x3a2826=_0x3a2826||0xc8;return function(_0x5b34a1){if(_0x5b34a1){return _0x18fccc[_0xa32e('0x18')](_0x3a2826)[_0xa32e('0x1a')](_0x5b34a1);}};}function respondWithFilteredResult(_0x4e5237,_0x5d0d51){return function(_0x1057d1){if(_0x1057d1){var _0xc9debe=typeof _0x5d0d51[_0xa32e('0x1b')]===_0xa32e('0x1c')&&typeof _0x5d0d51[_0xa32e('0x1d')]==='undefined';var _0x1af9e1=_0x1057d1['count'];var _0xa13347=_0xc9debe?0x0:_0x5d0d51['offset'];var _0x72b3d8=_0xc9debe?_0x1057d1['count']:_0x5d0d51[_0xa32e('0x1b')]+_0x5d0d51[_0xa32e('0x1d')];var _0x13ed8a;if(_0x72b3d8>=_0x1af9e1){_0x72b3d8=_0x1af9e1;_0x13ed8a=0xc8;}else{_0x13ed8a=0xce;}_0x4e5237[_0xa32e('0x18')](_0x13ed8a);return _0x4e5237['set'](_0xa32e('0x1e'),_0xa13347+'-'+_0x72b3d8+'/'+_0x1af9e1)[_0xa32e('0x1a')](_0x1057d1);}return null;};}function patchUpdates(_0x31ab79){return function(_0xca4b9a){try{jsonpatch[_0xa32e('0x1f')](_0xca4b9a,_0x31ab79,!![]);}catch(_0x545d1d){return BPromise['reject'](_0x545d1d);}return _0xca4b9a[_0xa32e('0x20')]();};}function saveUpdates(_0x4ed72c,_0x33c108){return function(_0x35fe73){if(_0x35fe73){return _0x35fe73[_0xa32e('0x21')](_0x4ed72c)[_0xa32e('0x22')](function(_0x4d5013){return _0x4d5013;});}return null;};}function removeEntity(_0x1ac67c,_0x5c6b97){return function(_0x23d91c){if(_0x23d91c){return _0x23d91c[_0xa32e('0x23')]()['then'](function(){_0x1ac67c[_0xa32e('0x18')](0xcc)[_0xa32e('0x19')]();});}};}function handleEntityNotFound(_0x102a94,_0x1cab60){return function(_0x1bbeb9){if(!_0x1bbeb9){_0x102a94[_0xa32e('0x17')](0x194);}return _0x1bbeb9;};}function handleError(_0x402f8b,_0x3b0edc){_0x3b0edc=_0x3b0edc||0x1f4;return function(_0x2b68e2){logger[_0xa32e('0x24')](_0x2b68e2['stack']);if(_0x2b68e2[_0xa32e('0x25')]){delete _0x2b68e2[_0xa32e('0x25')];}_0x402f8b[_0xa32e('0x18')](_0x3b0edc)[_0xa32e('0x26')](_0x2b68e2);};}exports['index']=function(_0x5212e1,_0x21e116){var _0x277b6c={},_0x235ed6={},_0x20c0e8={'count':0x0,'rows':[]};var _0x4f373f=_['map'](db['ServicenowConfiguration'][_0xa32e('0x27')],function(_0xf55028){return{'name':_0xf55028[_0xa32e('0x28')],'type':_0xf55028['type'][_0xa32e('0x29')]};});_0x235ed6[_0xa32e('0x2a')]=_[_0xa32e('0x2b')](_0x4f373f,'name');_0x235ed6['query']=_[_0xa32e('0x2c')](_0x5212e1[_0xa32e('0x2d')]);_0x235ed6[_0xa32e('0x2e')]=_[_0xa32e('0x2f')](_0x235ed6[_0xa32e('0x2a')],_0x235ed6[_0xa32e('0x2d')]);_0x277b6c['attributes']=_[_0xa32e('0x2f')](_0x235ed6['model'],qs[_0xa32e('0x30')](_0x5212e1[_0xa32e('0x2d')][_0xa32e('0x30')]));_0x277b6c[_0xa32e('0x31')]=_0x277b6c['attributes'][_0xa32e('0x32')]?_0x277b6c[_0xa32e('0x31')]:_0x235ed6[_0xa32e('0x2a')];if(!_0x5212e1[_0xa32e('0x2d')][_0xa32e('0x33')]('nolimit')){_0x277b6c[_0xa32e('0x1d')]=qs['limit'](_0x5212e1['query'][_0xa32e('0x1d')]);_0x277b6c[_0xa32e('0x1b')]=qs[_0xa32e('0x1b')](_0x5212e1[_0xa32e('0x2d')][_0xa32e('0x1b')]);}_0x277b6c[_0xa32e('0x34')]=qs[_0xa32e('0x35')](_0x5212e1[_0xa32e('0x2d')]['sort']);_0x277b6c[_0xa32e('0x36')]=qs[_0xa32e('0x2e')](_[_0xa32e('0x37')](_0x5212e1[_0xa32e('0x2d')],_0x235ed6['filters']),_0x4f373f);if(_0x5212e1[_0xa32e('0x2d')]['filter']){_0x277b6c['where']=_[_0xa32e('0x38')](_0x277b6c[_0xa32e('0x36')],{'$or':_['map'](_0x4f373f,function(_0x32ae81){if(_0x32ae81[_0xa32e('0x39')]!==_0xa32e('0x3a')){var _0x38fc85={};_0x38fc85[_0x32ae81[_0xa32e('0x25')]]={'$like':'%'+_0x5212e1['query']['filter']+'%'};return _0x38fc85;}})});}_0x277b6c=_[_0xa32e('0x38')]({},_0x277b6c,_0x5212e1[_0xa32e('0x3b')]);var _0x3d7aa8={'where':_0x277b6c['where']};return db[_0xa32e('0x3c')][_0xa32e('0x3d')](_0x3d7aa8)[_0xa32e('0x22')](function(_0x1deaa4){_0x20c0e8[_0xa32e('0x3d')]=_0x1deaa4;if(_0x5212e1['query'][_0xa32e('0x3e')]){_0x277b6c[_0xa32e('0x3f')]=[{'all':!![]}];}return db[_0xa32e('0x3c')][_0xa32e('0x40')](_0x277b6c);})[_0xa32e('0x22')](function(_0x4579bc){_0x20c0e8[_0xa32e('0x41')]=_0x4579bc;return _0x20c0e8;})[_0xa32e('0x22')](respondWithFilteredResult(_0x21e116,_0x277b6c))['catch'](handleError(_0x21e116,null));};exports[_0xa32e('0x42')]=function(_0xef020c,_0x5917e2){var _0x5f274b={'raw':![],'where':{'id':_0xef020c[_0xa32e('0x43')]['id']}},_0x25f47f={};_0x25f47f[_0xa32e('0x2a')]=_['keys'](db[_0xa32e('0x3c')][_0xa32e('0x27')]);_0x25f47f['query']=_[_0xa32e('0x2c')](_0xef020c[_0xa32e('0x2d')]);_0x25f47f[_0xa32e('0x2e')]=_[_0xa32e('0x2f')](_0x25f47f['model'],_0x25f47f[_0xa32e('0x2d')]);_0x5f274b['attributes']=_[_0xa32e('0x2f')](_0x25f47f[_0xa32e('0x2a')],qs[_0xa32e('0x30')](_0xef020c[_0xa32e('0x2d')][_0xa32e('0x30')]));_0x5f274b['attributes']=_0x5f274b[_0xa32e('0x31')][_0xa32e('0x32')]?_0x5f274b['attributes']:_0x25f47f[_0xa32e('0x2a')];if(_0xef020c[_0xa32e('0x2d')][_0xa32e('0x3e')]){_0x5f274b[_0xa32e('0x3f')]=[{'all':!![]}];}_0x5f274b=_[_0xa32e('0x38')]({},_0x5f274b,_0xef020c[_0xa32e('0x3b')]);return db['ServicenowConfiguration'][_0xa32e('0x44')](_0x5f274b)[_0xa32e('0x22')](handleEntityNotFound(_0x5917e2,null))[_0xa32e('0x22')](respondWithResult(_0x5917e2,null))[_0xa32e('0x45')](handleError(_0x5917e2,null));};exports[_0xa32e('0x46')]=function(_0x19648f,_0x36e16b){return db[_0xa32e('0x3c')]['create'](_0x19648f[_0xa32e('0x47')],{})[_0xa32e('0x22')](respondWithResult(_0x36e16b,0xc9))['catch'](handleError(_0x36e16b,null));};exports[_0xa32e('0x21')]=function(_0x4fac88,_0x3dd59e){if(_0x4fac88[_0xa32e('0x47')]['id']){delete _0x4fac88[_0xa32e('0x47')]['id'];}return db[_0xa32e('0x3c')][_0xa32e('0x44')]({'where':{'id':_0x4fac88[_0xa32e('0x43')]['id']}})[_0xa32e('0x22')](handleEntityNotFound(_0x3dd59e,null))['then'](saveUpdates(_0x4fac88[_0xa32e('0x47')],null))[_0xa32e('0x22')](respondWithResult(_0x3dd59e,null))[_0xa32e('0x45')](handleError(_0x3dd59e,null));};exports[_0xa32e('0x23')]=function(_0x9e9e61,_0x2d749f){return db['ServicenowConfiguration'][_0xa32e('0x44')]({'where':{'id':_0x9e9e61[_0xa32e('0x43')]['id']}})[_0xa32e('0x22')](handleEntityNotFound(_0x2d749f,null))[_0xa32e('0x22')](removeEntity(_0x2d749f,null))['catch'](handleError(_0x2d749f,null));};exports[_0xa32e('0x48')]=function(_0x45c442,_0x5157ca,_0x4cdd3d){var _0x4857cf={};var _0x59bc3f={};var _0x303d23;var _0x3426ac;return db[_0xa32e('0x3c')][_0xa32e('0x49')]({'where':{'id':_0x45c442[_0xa32e('0x43')]['id']}})[_0xa32e('0x22')](handleEntityNotFound(_0x5157ca,null))[_0xa32e('0x22')](function(_0x4ed00b){if(_0x4ed00b){_0x303d23=_0x4ed00b;_0x59bc3f[_0xa32e('0x2a')]=_['keys'](db[_0xa32e('0x4a')][_0xa32e('0x27')]);_0x59bc3f[_0xa32e('0x2d')]=_[_0xa32e('0x2c')](_0x45c442[_0xa32e('0x2d')]);_0x59bc3f[_0xa32e('0x2e')]=_['intersection'](_0x59bc3f[_0xa32e('0x2a')],_0x59bc3f[_0xa32e('0x2d')]);_0x4857cf[_0xa32e('0x31')]=_[_0xa32e('0x2f')](_0x59bc3f[_0xa32e('0x2a')],qs[_0xa32e('0x30')](_0x45c442[_0xa32e('0x2d')][_0xa32e('0x30')]));_0x4857cf[_0xa32e('0x31')]=_0x4857cf[_0xa32e('0x31')][_0xa32e('0x32')]?_0x4857cf[_0xa32e('0x31')]:_0x59bc3f[_0xa32e('0x2a')];_0x4857cf[_0xa32e('0x34')]=qs[_0xa32e('0x35')](_0x45c442[_0xa32e('0x2d')]['sort']);_0x4857cf[_0xa32e('0x36')]=qs[_0xa32e('0x2e')](_[_0xa32e('0x37')](_0x45c442[_0xa32e('0x2d')],_0x59bc3f[_0xa32e('0x2e')]));if(_0x45c442[_0xa32e('0x2d')][_0xa32e('0x4b')]){_0x4857cf['where']=_['merge'](_0x4857cf[_0xa32e('0x36')],{'$or':_[_0xa32e('0x2b')](_0x4857cf[_0xa32e('0x31')],function(_0x386f45){var _0x39a935={};_0x39a935[_0x386f45]={'$like':'%'+_0x45c442[_0xa32e('0x2d')][_0xa32e('0x4b')]+'%'};return _0x39a935;})});}_0x4857cf=_[_0xa32e('0x38')]({},_0x4857cf,_0x45c442[_0xa32e('0x3b')]);return _0x303d23[_0xa32e('0x48')](_0x4857cf);}})[_0xa32e('0x22')](function(_0x4f7da9){if(_0x4f7da9){_0x3426ac=_0x4f7da9[_0xa32e('0x32')];if(!_0x45c442[_0xa32e('0x2d')][_0xa32e('0x33')](_0xa32e('0x4c'))){_0x4857cf[_0xa32e('0x1d')]=qs['limit'](_0x45c442[_0xa32e('0x2d')][_0xa32e('0x1d')]);_0x4857cf[_0xa32e('0x1b')]=qs[_0xa32e('0x1b')](_0x45c442[_0xa32e('0x2d')][_0xa32e('0x1b')]);}return _0x303d23[_0xa32e('0x48')](_0x4857cf);}})[_0xa32e('0x22')](function(_0xda9634){if(_0xda9634){return _0xda9634?{'count':_0x3426ac,'rows':_0xda9634}:null;}})[_0xa32e('0x22')](respondWithResult(_0x5157ca,null))[_0xa32e('0x45')](handleError(_0x5157ca,null));};exports[_0xa32e('0x4d')]=function(_0x101ca9,_0x9d9b9b,_0x4237d5){var _0x23c2b2={};var _0x2e1b75={};var _0xcd010c;var _0x2aa919;return db[_0xa32e('0x3c')][_0xa32e('0x49')]({'where':{'id':_0x101ca9[_0xa32e('0x43')]['id']}})[_0xa32e('0x22')](handleEntityNotFound(_0x9d9b9b,null))['then'](function(_0x2111ae){if(_0x2111ae){_0xcd010c=_0x2111ae;_0x2e1b75['model']=_['keys'](db[_0xa32e('0x4a')][_0xa32e('0x27')]);_0x2e1b75[_0xa32e('0x2d')]=_[_0xa32e('0x2c')](_0x101ca9[_0xa32e('0x2d')]);_0x2e1b75[_0xa32e('0x2e')]=_[_0xa32e('0x2f')](_0x2e1b75[_0xa32e('0x2a')],_0x2e1b75[_0xa32e('0x2d')]);_0x23c2b2[_0xa32e('0x31')]=_[_0xa32e('0x2f')](_0x2e1b75[_0xa32e('0x2a')],qs[_0xa32e('0x30')](_0x101ca9[_0xa32e('0x2d')][_0xa32e('0x30')]));_0x23c2b2[_0xa32e('0x31')]=_0x23c2b2['attributes'][_0xa32e('0x32')]?_0x23c2b2[_0xa32e('0x31')]:_0x2e1b75[_0xa32e('0x2a')];_0x23c2b2[_0xa32e('0x34')]=qs[_0xa32e('0x35')](_0x101ca9[_0xa32e('0x2d')][_0xa32e('0x35')]);_0x23c2b2[_0xa32e('0x36')]=qs[_0xa32e('0x2e')](_[_0xa32e('0x37')](_0x101ca9['query'],_0x2e1b75['filters']));if(_0x101ca9[_0xa32e('0x2d')][_0xa32e('0x4b')]){_0x23c2b2[_0xa32e('0x36')]=_[_0xa32e('0x38')](_0x23c2b2[_0xa32e('0x36')],{'$or':_['map'](_0x23c2b2[_0xa32e('0x31')],function(_0x1d7a08){var _0x11db0c={};_0x11db0c[_0x1d7a08]={'$like':'%'+_0x101ca9['query'][_0xa32e('0x4b')]+'%'};return _0x11db0c;})});}_0x23c2b2=_[_0xa32e('0x38')]({},_0x23c2b2,_0x101ca9[_0xa32e('0x3b')]);return _0xcd010c[_0xa32e('0x4d')](_0x23c2b2);}})[_0xa32e('0x22')](function(_0x371f15){if(_0x371f15){_0x2aa919=_0x371f15['length'];if(!_0x101ca9[_0xa32e('0x2d')][_0xa32e('0x33')](_0xa32e('0x4c'))){_0x23c2b2[_0xa32e('0x1d')]=qs[_0xa32e('0x1d')](_0x101ca9[_0xa32e('0x2d')]['limit']);_0x23c2b2[_0xa32e('0x1b')]=qs['offset'](_0x101ca9[_0xa32e('0x2d')]['offset']);}return _0xcd010c[_0xa32e('0x4d')](_0x23c2b2);}})[_0xa32e('0x22')](function(_0x11fa45){if(_0x11fa45){return _0x11fa45?{'count':_0x2aa919,'rows':_0x11fa45}:null;}})[_0xa32e('0x22')](respondWithResult(_0x9d9b9b,null))[_0xa32e('0x45')](handleError(_0x9d9b9b,null));};exports['getDescriptions']=function(_0xfbcaef,_0x3fdd65,_0x359263){var _0x2bef73={};var _0x302682={};var _0x2dd96a;var _0x510900;return db[_0xa32e('0x3c')]['findOne']({'where':{'id':_0xfbcaef['params']['id']}})['then'](handleEntityNotFound(_0x3fdd65,null))[_0xa32e('0x22')](function(_0x302fc8){if(_0x302fc8){_0x2dd96a=_0x302fc8;_0x302682['model']=_['keys'](db[_0xa32e('0x4a')][_0xa32e('0x27')]);_0x302682[_0xa32e('0x2d')]=_[_0xa32e('0x2c')](_0xfbcaef['query']);_0x302682[_0xa32e('0x2e')]=_[_0xa32e('0x2f')](_0x302682['model'],_0x302682['query']);_0x2bef73['attributes']=_[_0xa32e('0x2f')](_0x302682[_0xa32e('0x2a')],qs['fields'](_0xfbcaef['query'][_0xa32e('0x30')]));_0x2bef73[_0xa32e('0x31')]=_0x2bef73['attributes'][_0xa32e('0x32')]?_0x2bef73[_0xa32e('0x31')]:_0x302682[_0xa32e('0x2a')];_0x2bef73[_0xa32e('0x34')]=qs['sort'](_0xfbcaef[_0xa32e('0x2d')]['sort']);_0x2bef73[_0xa32e('0x36')]=qs['filters'](_[_0xa32e('0x37')](_0xfbcaef[_0xa32e('0x2d')],_0x302682[_0xa32e('0x2e')]));if(_0xfbcaef[_0xa32e('0x2d')][_0xa32e('0x4b')]){_0x2bef73[_0xa32e('0x36')]=_[_0xa32e('0x38')](_0x2bef73[_0xa32e('0x36')],{'$or':_['map'](_0x2bef73[_0xa32e('0x31')],function(_0x1aafa6){var _0x542f62={};_0x542f62[_0x1aafa6]={'$like':'%'+_0xfbcaef[_0xa32e('0x2d')][_0xa32e('0x4b')]+'%'};return _0x542f62;})});}_0x2bef73=_[_0xa32e('0x38')]({},_0x2bef73,_0xfbcaef[_0xa32e('0x3b')]);return _0x2dd96a[_0xa32e('0x4e')](_0x2bef73);}})['then'](function(_0x42a307){if(_0x42a307){_0x510900=_0x42a307[_0xa32e('0x32')];if(!_0xfbcaef['query'][_0xa32e('0x33')](_0xa32e('0x4c'))){_0x2bef73[_0xa32e('0x1d')]=qs['limit'](_0xfbcaef[_0xa32e('0x2d')][_0xa32e('0x1d')]);_0x2bef73[_0xa32e('0x1b')]=qs[_0xa32e('0x1b')](_0xfbcaef[_0xa32e('0x2d')][_0xa32e('0x1b')]);}return _0x2dd96a[_0xa32e('0x4e')](_0x2bef73);}})['then'](function(_0x2e6f18){if(_0x2e6f18){return _0x2e6f18?{'count':_0x510900,'rows':_0x2e6f18}:null;}})['then'](respondWithResult(_0x3fdd65,null))[_0xa32e('0x45')](handleError(_0x3fdd65,null));}; \ No newline at end of file +var _0xda12=['filter','merge','includeAll','findAll','catch','show','params','options','find','create','body','getFields','ServicenowField','order','getSubjects','findOne','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters'];(function(_0x10a888,_0x46f254){var _0x176df6=function(_0x2ddee0){while(--_0x2ddee0){_0x10a888['push'](_0x10a888['shift']());}};_0x176df6(++_0x46f254);}(_0xda12,0xf5));var _0x2da1=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0xda12[_0x11c573];return _0x6b72de;};'use strict';var emlformat=require(_0x2da1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2da1('0x1'));var jsonpatch=require(_0x2da1('0x2'));var rp=require(_0x2da1('0x3'));var moment=require(_0x2da1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2da1('0x5'));var util=require(_0x2da1('0x6'));var path=require(_0x2da1('0x7'));var sox=require(_0x2da1('0x8'));var csv=require(_0x2da1('0x9'));var ejs=require(_0x2da1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2da1('0xb'));var crypto=require('crypto');var jsforce=require(_0x2da1('0xc'));var deskjs=require(_0x2da1('0xd'));var toCsv=require(_0x2da1('0x9'));var querystring=require('querystring');var Papa=require(_0x2da1('0xe'));var Redis=require(_0x2da1('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2da1('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2da1('0x11'))(_0x2da1('0x12'));var utils=require(_0x2da1('0x13'));var config=require(_0x2da1('0x14'));var licenseUtil=require(_0x2da1('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d71b7,_0x1d7731){_0x1d7731=_0x1d7731||0xcc;return function(_0x52795f){if(_0x52795f){return _0x4d71b7[_0x2da1('0x16')](_0x1d7731);}return _0x4d71b7[_0x2da1('0x17')](_0x1d7731)[_0x2da1('0x18')]();};}function respondWithResult(_0x3baa36,_0x4907bf){_0x4907bf=_0x4907bf||0xc8;return function(_0x5f4471){if(_0x5f4471){return _0x3baa36[_0x2da1('0x17')](_0x4907bf)[_0x2da1('0x19')](_0x5f4471);}};}function respondWithFilteredResult(_0x15b218,_0x4f47ae){return function(_0x193db8){if(_0x193db8){var _0x458ec0=typeof _0x4f47ae[_0x2da1('0x1a')]===_0x2da1('0x1b')&&typeof _0x4f47ae[_0x2da1('0x1c')]==='undefined';var _0x5d83f7=_0x193db8['count'];var _0x514b9d=_0x458ec0?0x0:_0x4f47ae[_0x2da1('0x1a')];var _0x2cf7a1=_0x458ec0?_0x193db8[_0x2da1('0x1d')]:_0x4f47ae['offset']+_0x4f47ae[_0x2da1('0x1c')];var _0x565aa6;if(_0x2cf7a1>=_0x5d83f7){_0x2cf7a1=_0x5d83f7;_0x565aa6=0xc8;}else{_0x565aa6=0xce;}_0x15b218[_0x2da1('0x17')](_0x565aa6);return _0x15b218[_0x2da1('0x1e')](_0x2da1('0x1f'),_0x514b9d+'-'+_0x2cf7a1+'/'+_0x5d83f7)[_0x2da1('0x19')](_0x193db8);}return null;};}function patchUpdates(_0x5804cf){return function(_0x3f21f5){try{jsonpatch['apply'](_0x3f21f5,_0x5804cf,!![]);}catch(_0x26a47c){return BPromise[_0x2da1('0x20')](_0x26a47c);}return _0x3f21f5[_0x2da1('0x21')]();};}function saveUpdates(_0x85013d,_0x554b1a){return function(_0x585a96){if(_0x585a96){return _0x585a96[_0x2da1('0x22')](_0x85013d)[_0x2da1('0x23')](function(_0x18e3ad){return _0x18e3ad;});}return null;};}function removeEntity(_0x269108,_0x4bd17d){return function(_0x347025){if(_0x347025){return _0x347025[_0x2da1('0x24')]()[_0x2da1('0x23')](function(){_0x269108[_0x2da1('0x17')](0xcc)[_0x2da1('0x18')]();});}};}function handleEntityNotFound(_0x32d234,_0x36d9f2){return function(_0x185e1e){if(!_0x185e1e){_0x32d234[_0x2da1('0x16')](0x194);}return _0x185e1e;};}function handleError(_0x188447,_0x111015){_0x111015=_0x111015||0x1f4;return function(_0x5d57d7){logger['error'](_0x5d57d7[_0x2da1('0x25')]);if(_0x5d57d7[_0x2da1('0x26')]){delete _0x5d57d7[_0x2da1('0x26')];}_0x188447[_0x2da1('0x17')](_0x111015)[_0x2da1('0x27')](_0x5d57d7);};}exports[_0x2da1('0x28')]=function(_0x314415,_0x67c3c7){var _0x522580={},_0x520666={},_0x349fa2={'count':0x0,'rows':[]};var _0x5c28a9=_[_0x2da1('0x29')](db[_0x2da1('0x2a')][_0x2da1('0x2b')],function(_0x56ea25){return{'name':_0x56ea25[_0x2da1('0x2c')],'type':_0x56ea25['type'][_0x2da1('0x2d')]};});_0x520666[_0x2da1('0x2e')]=_[_0x2da1('0x29')](_0x5c28a9,_0x2da1('0x26'));_0x520666[_0x2da1('0x2f')]=_[_0x2da1('0x30')](_0x314415[_0x2da1('0x2f')]);_0x520666['filters']=_['intersection'](_0x520666[_0x2da1('0x2e')],_0x520666[_0x2da1('0x2f')]);_0x522580[_0x2da1('0x31')]=_[_0x2da1('0x32')](_0x520666[_0x2da1('0x2e')],qs[_0x2da1('0x33')](_0x314415[_0x2da1('0x2f')]['fields']));_0x522580[_0x2da1('0x31')]=_0x522580[_0x2da1('0x31')][_0x2da1('0x34')]?_0x522580[_0x2da1('0x31')]:_0x520666['model'];if(!_0x314415['query'][_0x2da1('0x35')](_0x2da1('0x36'))){_0x522580[_0x2da1('0x1c')]=qs['limit'](_0x314415[_0x2da1('0x2f')][_0x2da1('0x1c')]);_0x522580['offset']=qs[_0x2da1('0x1a')](_0x314415[_0x2da1('0x2f')][_0x2da1('0x1a')]);}_0x522580['order']=qs[_0x2da1('0x37')](_0x314415[_0x2da1('0x2f')][_0x2da1('0x37')]);_0x522580[_0x2da1('0x38')]=qs['filters'](_[_0x2da1('0x39')](_0x314415[_0x2da1('0x2f')],_0x520666[_0x2da1('0x3a')]),_0x5c28a9);if(_0x314415[_0x2da1('0x2f')][_0x2da1('0x3b')]){_0x522580[_0x2da1('0x38')]=_[_0x2da1('0x3c')](_0x522580[_0x2da1('0x38')],{'$or':_['map'](_0x5c28a9,function(_0xe3f82a){if(_0xe3f82a['type']!=='VIRTUAL'){var _0x3b25d7={};_0x3b25d7[_0xe3f82a[_0x2da1('0x26')]]={'$like':'%'+_0x314415['query']['filter']+'%'};return _0x3b25d7;}})});}_0x522580=_[_0x2da1('0x3c')]({},_0x522580,_0x314415['options']);var _0x42f04f={'where':_0x522580[_0x2da1('0x38')]};return db['ServicenowConfiguration'][_0x2da1('0x1d')](_0x42f04f)[_0x2da1('0x23')](function(_0x5c5958){_0x349fa2[_0x2da1('0x1d')]=_0x5c5958;if(_0x314415['query'][_0x2da1('0x3d')]){_0x522580['include']=[{'all':!![]}];}return db[_0x2da1('0x2a')][_0x2da1('0x3e')](_0x522580);})[_0x2da1('0x23')](function(_0x33e9e5){_0x349fa2['rows']=_0x33e9e5;return _0x349fa2;})[_0x2da1('0x23')](respondWithFilteredResult(_0x67c3c7,_0x522580))[_0x2da1('0x3f')](handleError(_0x67c3c7,null));};exports[_0x2da1('0x40')]=function(_0x14ada5,_0x3191c6){var _0x5714b0={'raw':![],'where':{'id':_0x14ada5[_0x2da1('0x41')]['id']}},_0x48244e={};_0x48244e['model']=_[_0x2da1('0x30')](db[_0x2da1('0x2a')][_0x2da1('0x2b')]);_0x48244e[_0x2da1('0x2f')]=_[_0x2da1('0x30')](_0x14ada5[_0x2da1('0x2f')]);_0x48244e[_0x2da1('0x3a')]=_[_0x2da1('0x32')](_0x48244e[_0x2da1('0x2e')],_0x48244e['query']);_0x5714b0[_0x2da1('0x31')]=_['intersection'](_0x48244e[_0x2da1('0x2e')],qs['fields'](_0x14ada5['query'][_0x2da1('0x33')]));_0x5714b0[_0x2da1('0x31')]=_0x5714b0['attributes'][_0x2da1('0x34')]?_0x5714b0[_0x2da1('0x31')]:_0x48244e['model'];if(_0x14ada5[_0x2da1('0x2f')][_0x2da1('0x3d')]){_0x5714b0['include']=[{'all':!![]}];}_0x5714b0=_[_0x2da1('0x3c')]({},_0x5714b0,_0x14ada5[_0x2da1('0x42')]);return db[_0x2da1('0x2a')][_0x2da1('0x43')](_0x5714b0)[_0x2da1('0x23')](handleEntityNotFound(_0x3191c6,null))[_0x2da1('0x23')](respondWithResult(_0x3191c6,null))['catch'](handleError(_0x3191c6,null));};exports[_0x2da1('0x44')]=function(_0x57e3ac,_0xf69ecc){return db[_0x2da1('0x2a')][_0x2da1('0x44')](_0x57e3ac[_0x2da1('0x45')],{})[_0x2da1('0x23')](respondWithResult(_0xf69ecc,0xc9))['catch'](handleError(_0xf69ecc,null));};exports[_0x2da1('0x22')]=function(_0x40a85c,_0x523a72){if(_0x40a85c[_0x2da1('0x45')]['id']){delete _0x40a85c[_0x2da1('0x45')]['id'];}return db[_0x2da1('0x2a')]['find']({'where':{'id':_0x40a85c['params']['id']}})['then'](handleEntityNotFound(_0x523a72,null))['then'](saveUpdates(_0x40a85c[_0x2da1('0x45')],null))['then'](respondWithResult(_0x523a72,null))[_0x2da1('0x3f')](handleError(_0x523a72,null));};exports[_0x2da1('0x24')]=function(_0x3fe229,_0x1c514f){return db[_0x2da1('0x2a')][_0x2da1('0x43')]({'where':{'id':_0x3fe229[_0x2da1('0x41')]['id']}})[_0x2da1('0x23')](handleEntityNotFound(_0x1c514f,null))[_0x2da1('0x23')](removeEntity(_0x1c514f,null))['catch'](handleError(_0x1c514f,null));};exports[_0x2da1('0x46')]=function(_0xd48dc8,_0xfcb449,_0x23f4f4){var _0x1d60f1={};var _0xa930d0={};var _0x21548f;var _0xab2d88;return db[_0x2da1('0x2a')]['findOne']({'where':{'id':_0xd48dc8['params']['id']}})[_0x2da1('0x23')](handleEntityNotFound(_0xfcb449,null))[_0x2da1('0x23')](function(_0x35eeed){if(_0x35eeed){_0x21548f=_0x35eeed;_0xa930d0[_0x2da1('0x2e')]=_['keys'](db[_0x2da1('0x47')][_0x2da1('0x2b')]);_0xa930d0['query']=_[_0x2da1('0x30')](_0xd48dc8[_0x2da1('0x2f')]);_0xa930d0[_0x2da1('0x3a')]=_['intersection'](_0xa930d0[_0x2da1('0x2e')],_0xa930d0[_0x2da1('0x2f')]);_0x1d60f1[_0x2da1('0x31')]=_['intersection'](_0xa930d0[_0x2da1('0x2e')],qs[_0x2da1('0x33')](_0xd48dc8[_0x2da1('0x2f')][_0x2da1('0x33')]));_0x1d60f1[_0x2da1('0x31')]=_0x1d60f1[_0x2da1('0x31')]['length']?_0x1d60f1[_0x2da1('0x31')]:_0xa930d0[_0x2da1('0x2e')];_0x1d60f1[_0x2da1('0x48')]=qs[_0x2da1('0x37')](_0xd48dc8[_0x2da1('0x2f')][_0x2da1('0x37')]);_0x1d60f1[_0x2da1('0x38')]=qs[_0x2da1('0x3a')](_[_0x2da1('0x39')](_0xd48dc8[_0x2da1('0x2f')],_0xa930d0[_0x2da1('0x3a')]));if(_0xd48dc8[_0x2da1('0x2f')]['filter']){_0x1d60f1[_0x2da1('0x38')]=_[_0x2da1('0x3c')](_0x1d60f1[_0x2da1('0x38')],{'$or':_[_0x2da1('0x29')](_0x1d60f1[_0x2da1('0x31')],function(_0x1418c6){var _0x5d6d96={};_0x5d6d96[_0x1418c6]={'$like':'%'+_0xd48dc8['query'][_0x2da1('0x3b')]+'%'};return _0x5d6d96;})});}_0x1d60f1=_[_0x2da1('0x3c')]({},_0x1d60f1,_0xd48dc8[_0x2da1('0x42')]);return _0x21548f[_0x2da1('0x46')](_0x1d60f1);}})[_0x2da1('0x23')](function(_0x5eda85){if(_0x5eda85){_0xab2d88=_0x5eda85[_0x2da1('0x34')];if(!_0xd48dc8[_0x2da1('0x2f')][_0x2da1('0x35')]('nolimit')){_0x1d60f1[_0x2da1('0x1c')]=qs[_0x2da1('0x1c')](_0xd48dc8['query']['limit']);_0x1d60f1[_0x2da1('0x1a')]=qs[_0x2da1('0x1a')](_0xd48dc8[_0x2da1('0x2f')]['offset']);}return _0x21548f['getFields'](_0x1d60f1);}})[_0x2da1('0x23')](function(_0x57c37e){if(_0x57c37e){return _0x57c37e?{'count':_0xab2d88,'rows':_0x57c37e}:null;}})[_0x2da1('0x23')](respondWithResult(_0xfcb449,null))[_0x2da1('0x3f')](handleError(_0xfcb449,null));};exports[_0x2da1('0x49')]=function(_0x441ae2,_0x13d600,_0x394ed9){var _0x3ec5ef={};var _0x1d6a52={};var _0x258c38;var _0x42ee5c;return db[_0x2da1('0x2a')][_0x2da1('0x4a')]({'where':{'id':_0x441ae2[_0x2da1('0x41')]['id']}})['then'](handleEntityNotFound(_0x13d600,null))[_0x2da1('0x23')](function(_0x1c94d9){if(_0x1c94d9){_0x258c38=_0x1c94d9;_0x1d6a52[_0x2da1('0x2e')]=_[_0x2da1('0x30')](db[_0x2da1('0x47')][_0x2da1('0x2b')]);_0x1d6a52[_0x2da1('0x2f')]=_[_0x2da1('0x30')](_0x441ae2[_0x2da1('0x2f')]);_0x1d6a52[_0x2da1('0x3a')]=_['intersection'](_0x1d6a52[_0x2da1('0x2e')],_0x1d6a52['query']);_0x3ec5ef[_0x2da1('0x31')]=_['intersection'](_0x1d6a52['model'],qs['fields'](_0x441ae2[_0x2da1('0x2f')][_0x2da1('0x33')]));_0x3ec5ef[_0x2da1('0x31')]=_0x3ec5ef[_0x2da1('0x31')]['length']?_0x3ec5ef[_0x2da1('0x31')]:_0x1d6a52[_0x2da1('0x2e')];_0x3ec5ef[_0x2da1('0x48')]=qs[_0x2da1('0x37')](_0x441ae2['query'][_0x2da1('0x37')]);_0x3ec5ef['where']=qs['filters'](_[_0x2da1('0x39')](_0x441ae2['query'],_0x1d6a52[_0x2da1('0x3a')]));if(_0x441ae2[_0x2da1('0x2f')]['filter']){_0x3ec5ef['where']=_['merge'](_0x3ec5ef[_0x2da1('0x38')],{'$or':_[_0x2da1('0x29')](_0x3ec5ef[_0x2da1('0x31')],function(_0x2a063b){var _0x34a24c={};_0x34a24c[_0x2a063b]={'$like':'%'+_0x441ae2[_0x2da1('0x2f')][_0x2da1('0x3b')]+'%'};return _0x34a24c;})});}_0x3ec5ef=_[_0x2da1('0x3c')]({},_0x3ec5ef,_0x441ae2[_0x2da1('0x42')]);return _0x258c38[_0x2da1('0x49')](_0x3ec5ef);}})[_0x2da1('0x23')](function(_0x47e889){if(_0x47e889){_0x42ee5c=_0x47e889[_0x2da1('0x34')];if(!_0x441ae2[_0x2da1('0x2f')][_0x2da1('0x35')]('nolimit')){_0x3ec5ef[_0x2da1('0x1c')]=qs[_0x2da1('0x1c')](_0x441ae2[_0x2da1('0x2f')][_0x2da1('0x1c')]);_0x3ec5ef[_0x2da1('0x1a')]=qs['offset'](_0x441ae2['query'][_0x2da1('0x1a')]);}return _0x258c38[_0x2da1('0x49')](_0x3ec5ef);}})[_0x2da1('0x23')](function(_0x525bda){if(_0x525bda){return _0x525bda?{'count':_0x42ee5c,'rows':_0x525bda}:null;}})[_0x2da1('0x23')](respondWithResult(_0x13d600,null))[_0x2da1('0x3f')](handleError(_0x13d600,null));};exports[_0x2da1('0x4b')]=function(_0x288e40,_0x1a00db,_0x424df4){var _0x1e259d={};var _0x3d80ea={};var _0x4a3636;var _0x75cf5d;return db[_0x2da1('0x2a')][_0x2da1('0x4a')]({'where':{'id':_0x288e40[_0x2da1('0x41')]['id']}})[_0x2da1('0x23')](handleEntityNotFound(_0x1a00db,null))[_0x2da1('0x23')](function(_0x4707ec){if(_0x4707ec){_0x4a3636=_0x4707ec;_0x3d80ea[_0x2da1('0x2e')]=_[_0x2da1('0x30')](db['ServicenowField'][_0x2da1('0x2b')]);_0x3d80ea['query']=_['keys'](_0x288e40[_0x2da1('0x2f')]);_0x3d80ea[_0x2da1('0x3a')]=_[_0x2da1('0x32')](_0x3d80ea[_0x2da1('0x2e')],_0x3d80ea[_0x2da1('0x2f')]);_0x1e259d[_0x2da1('0x31')]=_[_0x2da1('0x32')](_0x3d80ea[_0x2da1('0x2e')],qs[_0x2da1('0x33')](_0x288e40[_0x2da1('0x2f')][_0x2da1('0x33')]));_0x1e259d[_0x2da1('0x31')]=_0x1e259d[_0x2da1('0x31')][_0x2da1('0x34')]?_0x1e259d['attributes']:_0x3d80ea[_0x2da1('0x2e')];_0x1e259d[_0x2da1('0x48')]=qs['sort'](_0x288e40[_0x2da1('0x2f')]['sort']);_0x1e259d[_0x2da1('0x38')]=qs[_0x2da1('0x3a')](_[_0x2da1('0x39')](_0x288e40[_0x2da1('0x2f')],_0x3d80ea[_0x2da1('0x3a')]));if(_0x288e40['query'][_0x2da1('0x3b')]){_0x1e259d[_0x2da1('0x38')]=_[_0x2da1('0x3c')](_0x1e259d['where'],{'$or':_[_0x2da1('0x29')](_0x1e259d[_0x2da1('0x31')],function(_0x153873){var _0x8cbaa={};_0x8cbaa[_0x153873]={'$like':'%'+_0x288e40[_0x2da1('0x2f')][_0x2da1('0x3b')]+'%'};return _0x8cbaa;})});}_0x1e259d=_['merge']({},_0x1e259d,_0x288e40[_0x2da1('0x42')]);return _0x4a3636[_0x2da1('0x4b')](_0x1e259d);}})[_0x2da1('0x23')](function(_0x2e3929){if(_0x2e3929){_0x75cf5d=_0x2e3929[_0x2da1('0x34')];if(!_0x288e40[_0x2da1('0x2f')][_0x2da1('0x35')](_0x2da1('0x36'))){_0x1e259d['limit']=qs['limit'](_0x288e40[_0x2da1('0x2f')][_0x2da1('0x1c')]);_0x1e259d['offset']=qs[_0x2da1('0x1a')](_0x288e40[_0x2da1('0x2f')][_0x2da1('0x1a')]);}return _0x4a3636[_0x2da1('0x4b')](_0x1e259d);}})['then'](function(_0xfa64c6){if(_0xfa64c6){return _0xfa64c6?{'count':_0x75cf5d,'rows':_0xfa64c6}:null;}})[_0x2da1('0x23')](respondWithResult(_0x1a00db,null))[_0x2da1('0x3f')](handleError(_0x1a00db,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index dda67e3..ae5546a 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 _0xce3a=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash'];(function(_0x2f506e,_0x2bef86){var _0x1a67b2=function(_0x59dd14){while(--_0x59dd14){_0x2f506e['push'](_0x2f506e['shift']());}};_0x1a67b2(++_0x2bef86);}(_0xce3a,0x194));var _0xace3=function(_0x25de8c,_0x321461){_0x25de8c=_0x25de8c-0x0;var _0x2f2101=_0xce3a[_0x25de8c];return _0x2f2101;};'use strict';var _=require(_0xace3('0x0'));var util=require(_0xace3('0x1'));var logger=require(_0xace3('0x2'))(_0xace3('0x3'));var moment=require(_0xace3('0x4'));var BPromise=require(_0xace3('0x5'));var rp=require(_0xace3('0x6'));var fs=require('fs');var path=require(_0xace3('0x7'));var rimraf=require(_0xace3('0x8'));var config=require(_0xace3('0x9'));var attributes=require(_0xace3('0xa'));module[_0xace3('0xb')]=function(_0x4c3ae9,_0x3ee264){return _0x4c3ae9[_0xace3('0xc')](_0xace3('0xd'),attributes,{'tableName':_0xace3('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x80c4=['path','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1c4506,_0x1093e2){var _0x47ffa1=function(_0x391589){while(--_0x391589){_0x1c4506['push'](_0x1c4506['shift']());}};_0x47ffa1(++_0x1093e2);}(_0x80c4,0xa3));var _0x480c=function(_0x35770d,_0x353ea5){_0x35770d=_0x35770d-0x0;var _0x275e79=_0x80c4[_0x35770d];return _0x275e79;};'use strict';var _=require(_0x480c('0x0'));var util=require('util');var logger=require(_0x480c('0x1'))(_0x480c('0x2'));var moment=require(_0x480c('0x3'));var BPromise=require(_0x480c('0x4'));var rp=require(_0x480c('0x5'));var fs=require('fs');var path=require(_0x480c('0x6'));var rimraf=require('rimraf');var config=require(_0x480c('0x7'));var attributes=require(_0x480c('0x8'));module[_0x480c('0x9')]=function(_0x1813b6,_0x9805b5){return _0x1813b6[_0x480c('0xa')](_0x480c('0xb'),attributes,{'tableName':_0x480c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 332b6de..ad8e590 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 _0x9d79=['../../config/environment','jayson/promise','client','http','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4a0b21,_0x1d310d){var _0xbc48b8=function(_0x584461){while(--_0x584461){_0x4a0b21['push'](_0x4a0b21['shift']());}};_0xbc48b8(++_0x1d310d);}(_0x9d79,0x1c5));var _0x99d7=function(_0x8b3f96,_0x552ad4){_0x8b3f96=_0x8b3f96-0x0;var _0x49f185=_0x9d79[_0x8b3f96];return _0x49f185;};'use strict';var _=require(_0x99d7('0x0'));var util=require('util');var moment=require(_0x99d7('0x1'));var BPromise=require(_0x99d7('0x2'));var rs=require(_0x99d7('0x3'));var fs=require('fs');var Redis=require(_0x99d7('0x4'));var db=require(_0x99d7('0x5'))['db'];var utils=require(_0x99d7('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x99d7('0x7'));var jayson=require(_0x99d7('0x8'));var client=jayson[_0x99d7('0x9')][_0x99d7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x49b612,_0x48ad55,_0xf04311){return new BPromise(function(_0x33dec5,_0x181570){return client['request'](_0x49b612,_0xf04311)['then'](function(_0x52febe){logger[_0x99d7('0xb')](_0x99d7('0xc'),_0x48ad55,_0x99d7('0xd'));logger['debug'](_0x99d7('0xe'),_0x48ad55,_0x99d7('0xd'),JSON[_0x99d7('0xf')](_0x52febe));if(_0x52febe[_0x99d7('0x10')]){if(_0x52febe['error'][_0x99d7('0x11')]===0x1f4){logger[_0x99d7('0x10')](_0x99d7('0xc'),_0x48ad55,_0x52febe[_0x99d7('0x10')]['message']);return _0x181570(_0x52febe[_0x99d7('0x10')][_0x99d7('0x12')]);}logger[_0x99d7('0x10')](_0x99d7('0xc'),_0x48ad55,_0x52febe[_0x99d7('0x10')][_0x99d7('0x12')]);return _0x33dec5(_0x52febe[_0x99d7('0x10')]['message']);}else{logger[_0x99d7('0xb')]('ServicenowConfiguration,\x20%s,\x20%s',_0x48ad55,'request\x20sent');_0x33dec5(_0x52febe[_0x99d7('0x13')][_0x99d7('0x12')]);}})['catch'](function(_0x581399){logger[_0x99d7('0x10')](_0x99d7('0xc'),_0x48ad55,_0x581399);_0x181570(_0x581399);});});} \ No newline at end of file +var _0xd965=['info','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','result','catch','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then'];(function(_0x329a5d,_0x4a886d){var _0x56d83d=function(_0x310cbc){while(--_0x310cbc){_0x329a5d['push'](_0x329a5d['shift']());}};_0x56d83d(++_0x4a886d);}(_0xd965,0x15b));var _0x5d96=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd965[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x5d96('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5d96('0x1'));var fs=require('fs');var Redis=require(_0x5d96('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x5d96('0x3'));var logger=require(_0x5d96('0x4'))(_0x5d96('0x5'));var config=require('../../config/environment');var jayson=require(_0x5d96('0x6'));var client=jayson[_0x5d96('0x7')][_0x5d96('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3d5928,_0x3e3fc6,_0x648253){return new BPromise(function(_0x2ed1b4,_0x19808f){return client['request'](_0x3d5928,_0x648253)[_0x5d96('0x9')](function(_0x2797d4){logger[_0x5d96('0xa')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3e3fc6,_0x5d96('0xb'));logger[_0x5d96('0xc')](_0x5d96('0xd'),_0x3e3fc6,_0x5d96('0xb'),JSON[_0x5d96('0xe')](_0x2797d4));if(_0x2797d4[_0x5d96('0xf')]){if(_0x2797d4[_0x5d96('0xf')][_0x5d96('0x10')]===0x1f4){logger['error'](_0x5d96('0x11'),_0x3e3fc6,_0x2797d4[_0x5d96('0xf')][_0x5d96('0x12')]);return _0x19808f(_0x2797d4['error'][_0x5d96('0x12')]);}logger[_0x5d96('0xf')](_0x5d96('0x11'),_0x3e3fc6,_0x2797d4[_0x5d96('0xf')][_0x5d96('0x12')]);return _0x2ed1b4(_0x2797d4[_0x5d96('0xf')][_0x5d96('0x12')]);}else{logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x3e3fc6,_0x5d96('0xb'));_0x2ed1b4(_0x2797d4[_0x5d96('0x13')]['message']);}})[_0x5d96('0x14')](function(_0x36ee00){logger['error'](_0x5d96('0x11'),_0x3e3fc6,_0x36ee00);_0x19808f(_0x36ee00);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 3ef1707..1e44edf 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 _0x3b76=['put','update','delete','destroy','multer','util','path','express','Router','../../config/environment','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x10f6e8,_0x351db6){var _0x35bb3c=function(_0x30a39b){while(--_0x30a39b){_0x10f6e8['push'](_0x10f6e8['shift']());}};_0x35bb3c(++_0x351db6);}(_0x3b76,0x18b));var _0x63b7=function(_0x502f5c,_0x43e51c){_0x502f5c=_0x502f5c-0x0;var _0x3b64fb=_0x3b76[_0x502f5c];return _0x3b64fb;};'use strict';var multer=require(_0x63b7('0x0'));var util=require(_0x63b7('0x1'));var path=require(_0x63b7('0x2'));var timeout=require('connect-timeout');var express=require(_0x63b7('0x3'));var router=express[_0x63b7('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x63b7('0x5'));var controller=require('./intServicenowField.controller');router[_0x63b7('0x6')]('/',auth[_0x63b7('0x7')](),controller[_0x63b7('0x8')]);router['get'](_0x63b7('0x9'),auth[_0x63b7('0x7')](),controller[_0x63b7('0xa')]);router[_0x63b7('0xb')]('/',auth['isAuthenticated'](),controller[_0x63b7('0xc')]);router[_0x63b7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x63b7('0xe')]);router[_0x63b7('0xf')](_0x63b7('0x9'),auth[_0x63b7('0x7')](),controller[_0x63b7('0x10')]);module['exports']=router; \ No newline at end of file +var _0x3de8=['create','update','delete','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','show','post','isAuthenticated'];(function(_0x2b7bc5,_0x39688a){var _0x1fd7e1=function(_0x4c9ea6){while(--_0x4c9ea6){_0x2b7bc5['push'](_0x2b7bc5['shift']());}};_0x1fd7e1(++_0x39688a);}(_0x3de8,0xd5));var _0x83de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3de8[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x83de('0x0'));var path=require(_0x83de('0x1'));var timeout=require('connect-timeout');var express=require(_0x83de('0x2'));var router=express[_0x83de('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x83de('0x4'));var interaction=require(_0x83de('0x5'));var config=require(_0x83de('0x6'));var controller=require('./intServicenowField.controller');router[_0x83de('0x7')]('/',auth['isAuthenticated'](),controller[_0x83de('0x8')]);router[_0x83de('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x83de('0x9')]);router[_0x83de('0xa')]('/',auth[_0x83de('0xb')](),controller[_0x83de('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x83de('0xd')]);router[_0x83de('0xe')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index e689c88..6c27207 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 _0xe9aa=['customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x4ad6ca,_0x490434){var _0x89eaf3=function(_0x43c7c1){while(--_0x43c7c1){_0x4ad6ca['push'](_0x4ad6ca['shift']());}};_0x89eaf3(++_0x490434);}(_0xe9aa,0x177));var _0xae9a=function(_0x524ec3,_0x3a047d){_0x524ec3=_0x524ec3-0x0;var _0x322635=_0xe9aa[_0x524ec3];return _0x322635;};'use strict';var Sequelize=require(_0xae9a('0x0'));module[_0xae9a('0x1')]={'type':{'type':Sequelize[_0xae9a('0x2')](_0xae9a('0x3'),_0xae9a('0x4'),_0xae9a('0x5'),_0xae9a('0x6'),_0xae9a('0x7')),'defaultValue':_0xae9a('0x3')},'content':{'type':Sequelize[_0xae9a('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xae9a('0x3'),_0xae9a('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xae9a('0x8')]},'idField':{'type':Sequelize[_0xae9a('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xae9a('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xae9a('0x8')]}}; \ No newline at end of file +var _0x884d=['sequelize','ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x884d,0x158));var _0xd884=function(_0x3a4574,_0x1c541b){_0x3a4574=_0x3a4574-0x0;var _0x4beb90=_0x884d[_0x3a4574];return _0x4beb90;};'use strict';var Sequelize=require(_0xd884('0x0'));module['exports']={'type':{'type':Sequelize[_0xd884('0x1')](_0xd884('0x2'),_0xd884('0x3'),_0xd884('0x4'),'keyValue',_0xd884('0x5')),'defaultValue':_0xd884('0x2')},'content':{'type':Sequelize[_0xd884('0x6')]},'key':{'type':Sequelize[_0xd884('0x6')]},'keyType':{'type':Sequelize[_0xd884('0x1')](_0xd884('0x2'),'variable',_0xd884('0x4'))},'keyContent':{'type':Sequelize[_0xd884('0x6')]},'idField':{'type':Sequelize[_0xd884('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xd884('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd884('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 18f0913..08a191d 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 _0x1136=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','ServicenowField','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x1136,0x1d9));var _0x6113=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1136[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x6113('0x0'));var rimraf=require(_0x6113('0x1'));var zipdir=require(_0x6113('0x2'));var jsonpatch=require(_0x6113('0x3'));var rp=require(_0x6113('0x4'));var moment=require('moment');var BPromise=require(_0x6113('0x5'));var Mustache=require(_0x6113('0x6'));var util=require(_0x6113('0x7'));var path=require(_0x6113('0x8'));var sox=require(_0x6113('0x9'));var csv=require(_0x6113('0xa'));var ejs=require(_0x6113('0xb'));var fs=require('fs');var fs_extra=require(_0x6113('0xc'));var _=require(_0x6113('0xd'));var squel=require(_0x6113('0xe'));var crypto=require(_0x6113('0xf'));var jsforce=require(_0x6113('0x10'));var deskjs=require(_0x6113('0x11'));var toCsv=require(_0x6113('0xa'));var querystring=require(_0x6113('0x12'));var Papa=require(_0x6113('0x13'));var Redis=require(_0x6113('0x14'));var authService=require(_0x6113('0x15'));var qs=require(_0x6113('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6113('0x17'));var logger=require(_0x6113('0x18'))('api');var utils=require('../../config/utils');var config=require(_0x6113('0x19'));var licenseUtil=require(_0x6113('0x1a'));var db=require(_0x6113('0x1b'))['db'];function respondWithStatusCode(_0xde6b44,_0x39d46d){_0x39d46d=_0x39d46d||0xcc;return function(_0x2ecc9b){if(_0x2ecc9b){return _0xde6b44[_0x6113('0x1c')](_0x39d46d);}return _0xde6b44[_0x6113('0x1d')](_0x39d46d)['end']();};}function respondWithResult(_0x227a4f,_0x30d4f7){_0x30d4f7=_0x30d4f7||0xc8;return function(_0x4cfaa9){if(_0x4cfaa9){return _0x227a4f['status'](_0x30d4f7)['json'](_0x4cfaa9);}};}function respondWithFilteredResult(_0x2f81e4,_0x7de3cd){return function(_0x4fff0a){if(_0x4fff0a){var _0x32871a=typeof _0x7de3cd[_0x6113('0x1e')]===_0x6113('0x1f')&&typeof _0x7de3cd['limit']===_0x6113('0x1f');var _0x492a0c=_0x4fff0a[_0x6113('0x20')];var _0x452fec=_0x32871a?0x0:_0x7de3cd[_0x6113('0x1e')];var _0x567629=_0x32871a?_0x4fff0a['count']:_0x7de3cd['offset']+_0x7de3cd['limit'];var _0x306ff3;if(_0x567629>=_0x492a0c){_0x567629=_0x492a0c;_0x306ff3=0xc8;}else{_0x306ff3=0xce;}_0x2f81e4[_0x6113('0x1d')](_0x306ff3);return _0x2f81e4['set'](_0x6113('0x21'),_0x452fec+'-'+_0x567629+'/'+_0x492a0c)[_0x6113('0x22')](_0x4fff0a);}return null;};}function patchUpdates(_0x48f5a1){return function(_0x9d9877){try{jsonpatch[_0x6113('0x23')](_0x9d9877,_0x48f5a1,!![]);}catch(_0x2f2cdb){return BPromise[_0x6113('0x24')](_0x2f2cdb);}return _0x9d9877[_0x6113('0x25')]();};}function saveUpdates(_0x5933a0,_0x4f08f6){return function(_0x1f5a32){if(_0x1f5a32){return _0x1f5a32[_0x6113('0x26')](_0x5933a0)[_0x6113('0x27')](function(_0x1c1040){return _0x1c1040;});}return null;};}function removeEntity(_0x5d3834,_0x30230f){return function(_0x53d7d4){if(_0x53d7d4){return _0x53d7d4[_0x6113('0x28')]()[_0x6113('0x27')](function(){_0x5d3834[_0x6113('0x1d')](0xcc)[_0x6113('0x29')]();});}};}function handleEntityNotFound(_0x3daf05,_0xb62322){return function(_0x3ad0e0){if(!_0x3ad0e0){_0x3daf05[_0x6113('0x1c')](0x194);}return _0x3ad0e0;};}function handleError(_0x2dcf93,_0x56a774){_0x56a774=_0x56a774||0x1f4;return function(_0x1d982e){logger[_0x6113('0x2a')](_0x1d982e[_0x6113('0x2b')]);if(_0x1d982e['name']){delete _0x1d982e[_0x6113('0x2c')];}_0x2dcf93[_0x6113('0x1d')](_0x56a774)[_0x6113('0x2d')](_0x1d982e);};}exports[_0x6113('0x2e')]=function(_0x1f983b,_0x45409b){var _0x5db708={},_0xcb9119={},_0x1acf7a={'count':0x0,'rows':[]};var _0x52009b=_['map'](db[_0x6113('0x2f')][_0x6113('0x30')],function(_0x43c2ce){return{'name':_0x43c2ce[_0x6113('0x31')],'type':_0x43c2ce[_0x6113('0x32')]['key']};});_0xcb9119['model']=_[_0x6113('0x33')](_0x52009b,_0x6113('0x2c'));_0xcb9119[_0x6113('0x34')]=_['keys'](_0x1f983b[_0x6113('0x34')]);_0xcb9119[_0x6113('0x35')]=_[_0x6113('0x36')](_0xcb9119[_0x6113('0x37')],_0xcb9119[_0x6113('0x34')]);_0x5db708[_0x6113('0x38')]=_['intersection'](_0xcb9119[_0x6113('0x37')],qs[_0x6113('0x39')](_0x1f983b[_0x6113('0x34')]['fields']));_0x5db708['attributes']=_0x5db708[_0x6113('0x38')][_0x6113('0x3a')]?_0x5db708[_0x6113('0x38')]:_0xcb9119[_0x6113('0x37')];if(!_0x1f983b[_0x6113('0x34')][_0x6113('0x3b')](_0x6113('0x3c'))){_0x5db708['limit']=qs['limit'](_0x1f983b[_0x6113('0x34')][_0x6113('0x3d')]);_0x5db708[_0x6113('0x1e')]=qs[_0x6113('0x1e')](_0x1f983b[_0x6113('0x34')][_0x6113('0x1e')]);}_0x5db708[_0x6113('0x3e')]=qs[_0x6113('0x3f')](_0x1f983b[_0x6113('0x34')][_0x6113('0x3f')]);_0x5db708[_0x6113('0x40')]=qs[_0x6113('0x35')](_[_0x6113('0x41')](_0x1f983b['query'],_0xcb9119[_0x6113('0x35')]),_0x52009b);if(_0x1f983b[_0x6113('0x34')][_0x6113('0x42')]){_0x5db708[_0x6113('0x40')]=_[_0x6113('0x43')](_0x5db708[_0x6113('0x40')],{'$or':_[_0x6113('0x33')](_0x52009b,function(_0x132288){if(_0x132288[_0x6113('0x32')]!==_0x6113('0x44')){var _0x3a8f8b={};_0x3a8f8b[_0x132288['name']]={'$like':'%'+_0x1f983b[_0x6113('0x34')][_0x6113('0x42')]+'%'};return _0x3a8f8b;}})});}_0x5db708=_[_0x6113('0x43')]({},_0x5db708,_0x1f983b['options']);var _0x555b5b={'where':_0x5db708['where']};return db[_0x6113('0x2f')]['count'](_0x555b5b)[_0x6113('0x27')](function(_0x4da3c6){_0x1acf7a[_0x6113('0x20')]=_0x4da3c6;if(_0x1f983b[_0x6113('0x34')][_0x6113('0x45')]){_0x5db708[_0x6113('0x46')]=[{'all':!![]}];}return db[_0x6113('0x2f')][_0x6113('0x47')](_0x5db708);})[_0x6113('0x27')](function(_0x488dbe){_0x1acf7a[_0x6113('0x48')]=_0x488dbe;return _0x1acf7a;})[_0x6113('0x27')](respondWithFilteredResult(_0x45409b,_0x5db708))[_0x6113('0x49')](handleError(_0x45409b,null));};exports[_0x6113('0x4a')]=function(_0x1b2d6c,_0x1c3d48){var _0x4cb7c0={'raw':!![],'where':{'id':_0x1b2d6c[_0x6113('0x4b')]['id']}},_0x1c394f={};_0x1c394f['model']=_[_0x6113('0x4c')](db[_0x6113('0x2f')][_0x6113('0x30')]);_0x1c394f[_0x6113('0x34')]=_[_0x6113('0x4c')](_0x1b2d6c['query']);_0x1c394f['filters']=_[_0x6113('0x36')](_0x1c394f[_0x6113('0x37')],_0x1c394f['query']);_0x4cb7c0[_0x6113('0x38')]=_['intersection'](_0x1c394f[_0x6113('0x37')],qs['fields'](_0x1b2d6c[_0x6113('0x34')][_0x6113('0x39')]));_0x4cb7c0[_0x6113('0x38')]=_0x4cb7c0['attributes'][_0x6113('0x3a')]?_0x4cb7c0[_0x6113('0x38')]:_0x1c394f[_0x6113('0x37')];if(_0x1b2d6c[_0x6113('0x34')]['includeAll']){_0x4cb7c0['include']=[{'all':!![]}];}_0x4cb7c0=_['merge']({},_0x4cb7c0,_0x1b2d6c['options']);return db['ServicenowField'][_0x6113('0x4d')](_0x4cb7c0)[_0x6113('0x27')](handleEntityNotFound(_0x1c3d48,null))[_0x6113('0x27')](respondWithResult(_0x1c3d48,null))[_0x6113('0x49')](handleError(_0x1c3d48,null));};exports[_0x6113('0x4e')]=function(_0x5a6e6d,_0x1ee30a){return db[_0x6113('0x2f')][_0x6113('0x4e')](_0x5a6e6d[_0x6113('0x4f')],{})[_0x6113('0x27')](respondWithResult(_0x1ee30a,0xc9))[_0x6113('0x49')](handleError(_0x1ee30a,null));};exports[_0x6113('0x26')]=function(_0x125a08,_0x3e5467){if(_0x125a08[_0x6113('0x4f')]['id']){delete _0x125a08['body']['id'];}return db[_0x6113('0x2f')][_0x6113('0x4d')]({'where':{'id':_0x125a08[_0x6113('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3e5467,null))[_0x6113('0x27')](saveUpdates(_0x125a08['body'],null))[_0x6113('0x27')](respondWithResult(_0x3e5467,null))[_0x6113('0x49')](handleError(_0x3e5467,null));};exports[_0x6113('0x28')]=function(_0x3c1a04,_0x300537){return db[_0x6113('0x2f')]['find']({'where':{'id':_0x3c1a04[_0x6113('0x4b')]['id']}})[_0x6113('0x27')](handleEntityNotFound(_0x300537,null))[_0x6113('0x27')](removeEntity(_0x300537,null))['catch'](handleError(_0x300537,null));}; \ No newline at end of file +var _0x55ef=['sendStatus','status','end','json','offset','limit','count','set','apply','reject','save','update','then','stack','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x539d7b,_0x5f2eba){var _0x31953c=function(_0x2c792a){while(--_0x2c792a){_0x539d7b['push'](_0x539d7b['shift']());}};_0x31953c(++_0x5f2eba);}(_0x55ef,0x7b));var _0xf55e=function(_0x3feef0,_0x437228){_0x3feef0=_0x3feef0-0x0;var _0x25cdf3=_0x55ef[_0x3feef0];return _0x25cdf3;};'use strict';var emlformat=require(_0xf55e('0x0'));var rimraf=require(_0xf55e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf55e('0x2'));var rp=require(_0xf55e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf55e('0x4'));var util=require(_0xf55e('0x5'));var path=require(_0xf55e('0x6'));var sox=require(_0xf55e('0x7'));var csv=require(_0xf55e('0x8'));var ejs=require(_0xf55e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf55e('0xa'));var squel=require(_0xf55e('0xb'));var crypto=require(_0xf55e('0xc'));var jsforce=require(_0xf55e('0xd'));var deskjs=require(_0xf55e('0xe'));var toCsv=require(_0xf55e('0x8'));var querystring=require(_0xf55e('0xf'));var Papa=require(_0xf55e('0x10'));var Redis=require(_0xf55e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf55e('0x12'));var as=require(_0xf55e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf55e('0x14'))(_0xf55e('0x15'));var utils=require(_0xf55e('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf55e('0x17'));var db=require(_0xf55e('0x18'))['db'];function respondWithStatusCode(_0x1b8412,_0x4caabf){_0x4caabf=_0x4caabf||0xcc;return function(_0x6561b5){if(_0x6561b5){return _0x1b8412[_0xf55e('0x19')](_0x4caabf);}return _0x1b8412[_0xf55e('0x1a')](_0x4caabf)[_0xf55e('0x1b')]();};}function respondWithResult(_0x234e9f,_0x20939c){_0x20939c=_0x20939c||0xc8;return function(_0x19b690){if(_0x19b690){return _0x234e9f[_0xf55e('0x1a')](_0x20939c)[_0xf55e('0x1c')](_0x19b690);}};}function respondWithFilteredResult(_0x508f56,_0x475257){return function(_0x4df34e){if(_0x4df34e){var _0xc6d3a0=typeof _0x475257[_0xf55e('0x1d')]==='undefined'&&typeof _0x475257[_0xf55e('0x1e')]==='undefined';var _0x5e0d8a=_0x4df34e[_0xf55e('0x1f')];var _0x376df3=_0xc6d3a0?0x0:_0x475257[_0xf55e('0x1d')];var _0x256142=_0xc6d3a0?_0x4df34e[_0xf55e('0x1f')]:_0x475257[_0xf55e('0x1d')]+_0x475257[_0xf55e('0x1e')];var _0x87a873;if(_0x256142>=_0x5e0d8a){_0x256142=_0x5e0d8a;_0x87a873=0xc8;}else{_0x87a873=0xce;}_0x508f56[_0xf55e('0x1a')](_0x87a873);return _0x508f56[_0xf55e('0x20')]('Content-Range',_0x376df3+'-'+_0x256142+'/'+_0x5e0d8a)[_0xf55e('0x1c')](_0x4df34e);}return null;};}function patchUpdates(_0x38ada0){return function(_0x4c5cd2){try{jsonpatch[_0xf55e('0x21')](_0x4c5cd2,_0x38ada0,!![]);}catch(_0x13246d){return BPromise[_0xf55e('0x22')](_0x13246d);}return _0x4c5cd2[_0xf55e('0x23')]();};}function saveUpdates(_0x4150ec,_0x297af3){return function(_0x2bdf8e){if(_0x2bdf8e){return _0x2bdf8e[_0xf55e('0x24')](_0x4150ec)[_0xf55e('0x25')](function(_0x541f38){return _0x541f38;});}return null;};}function removeEntity(_0x1bb7c9,_0x2997af){return function(_0x33e848){if(_0x33e848){return _0x33e848['destroy']()['then'](function(){_0x1bb7c9[_0xf55e('0x1a')](0xcc)[_0xf55e('0x1b')]();});}};}function handleEntityNotFound(_0x41a5b6,_0x19583d){return function(_0x56374f){if(!_0x56374f){_0x41a5b6[_0xf55e('0x19')](0x194);}return _0x56374f;};}function handleError(_0x55467a,_0x2ff666){_0x2ff666=_0x2ff666||0x1f4;return function(_0x26ab09){logger['error'](_0x26ab09[_0xf55e('0x26')]);if(_0x26ab09[_0xf55e('0x27')]){delete _0x26ab09[_0xf55e('0x27')];}_0x55467a[_0xf55e('0x1a')](_0x2ff666)[_0xf55e('0x28')](_0x26ab09);};}exports[_0xf55e('0x29')]=function(_0x4441a0,_0xe9a771){var _0x2c97b9={},_0x35537e={},_0x8277c9={'count':0x0,'rows':[]};var _0x25de78=_[_0xf55e('0x2a')](db[_0xf55e('0x2b')][_0xf55e('0x2c')],function(_0x16da6b){return{'name':_0x16da6b[_0xf55e('0x2d')],'type':_0x16da6b[_0xf55e('0x2e')]['key']};});_0x35537e[_0xf55e('0x2f')]=_['map'](_0x25de78,_0xf55e('0x27'));_0x35537e['query']=_[_0xf55e('0x30')](_0x4441a0[_0xf55e('0x31')]);_0x35537e[_0xf55e('0x32')]=_[_0xf55e('0x33')](_0x35537e['model'],_0x35537e['query']);_0x2c97b9[_0xf55e('0x34')]=_[_0xf55e('0x33')](_0x35537e[_0xf55e('0x2f')],qs[_0xf55e('0x35')](_0x4441a0[_0xf55e('0x31')][_0xf55e('0x35')]));_0x2c97b9[_0xf55e('0x34')]=_0x2c97b9[_0xf55e('0x34')]['length']?_0x2c97b9[_0xf55e('0x34')]:_0x35537e[_0xf55e('0x2f')];if(!_0x4441a0[_0xf55e('0x31')]['hasOwnProperty'](_0xf55e('0x36'))){_0x2c97b9['limit']=qs['limit'](_0x4441a0[_0xf55e('0x31')]['limit']);_0x2c97b9[_0xf55e('0x1d')]=qs[_0xf55e('0x1d')](_0x4441a0[_0xf55e('0x31')][_0xf55e('0x1d')]);}_0x2c97b9[_0xf55e('0x37')]=qs[_0xf55e('0x38')](_0x4441a0['query'][_0xf55e('0x38')]);_0x2c97b9[_0xf55e('0x39')]=qs[_0xf55e('0x32')](_[_0xf55e('0x3a')](_0x4441a0[_0xf55e('0x31')],_0x35537e['filters']),_0x25de78);if(_0x4441a0['query'][_0xf55e('0x3b')]){_0x2c97b9[_0xf55e('0x39')]=_['merge'](_0x2c97b9['where'],{'$or':_['map'](_0x25de78,function(_0x37e507){if(_0x37e507[_0xf55e('0x2e')]!==_0xf55e('0x3c')){var _0x5760af={};_0x5760af[_0x37e507[_0xf55e('0x27')]]={'$like':'%'+_0x4441a0[_0xf55e('0x31')][_0xf55e('0x3b')]+'%'};return _0x5760af;}})});}_0x2c97b9=_[_0xf55e('0x3d')]({},_0x2c97b9,_0x4441a0[_0xf55e('0x3e')]);var _0x141c2f={'where':_0x2c97b9[_0xf55e('0x39')]};return db[_0xf55e('0x2b')][_0xf55e('0x1f')](_0x141c2f)['then'](function(_0x5d33fa){_0x8277c9['count']=_0x5d33fa;if(_0x4441a0[_0xf55e('0x31')][_0xf55e('0x3f')]){_0x2c97b9[_0xf55e('0x40')]=[{'all':!![]}];}return db['ServicenowField'][_0xf55e('0x41')](_0x2c97b9);})['then'](function(_0x300cb7){_0x8277c9[_0xf55e('0x42')]=_0x300cb7;return _0x8277c9;})[_0xf55e('0x25')](respondWithFilteredResult(_0xe9a771,_0x2c97b9))[_0xf55e('0x43')](handleError(_0xe9a771,null));};exports[_0xf55e('0x44')]=function(_0x356609,_0x29decb){var _0x3e13b4={'raw':!![],'where':{'id':_0x356609[_0xf55e('0x45')]['id']}},_0x19877b={};_0x19877b['model']=_[_0xf55e('0x30')](db[_0xf55e('0x2b')][_0xf55e('0x2c')]);_0x19877b[_0xf55e('0x31')]=_[_0xf55e('0x30')](_0x356609['query']);_0x19877b[_0xf55e('0x32')]=_[_0xf55e('0x33')](_0x19877b[_0xf55e('0x2f')],_0x19877b[_0xf55e('0x31')]);_0x3e13b4[_0xf55e('0x34')]=_['intersection'](_0x19877b[_0xf55e('0x2f')],qs['fields'](_0x356609[_0xf55e('0x31')][_0xf55e('0x35')]));_0x3e13b4[_0xf55e('0x34')]=_0x3e13b4[_0xf55e('0x34')][_0xf55e('0x46')]?_0x3e13b4['attributes']:_0x19877b[_0xf55e('0x2f')];if(_0x356609['query'][_0xf55e('0x3f')]){_0x3e13b4[_0xf55e('0x40')]=[{'all':!![]}];}_0x3e13b4=_[_0xf55e('0x3d')]({},_0x3e13b4,_0x356609[_0xf55e('0x3e')]);return db['ServicenowField'][_0xf55e('0x47')](_0x3e13b4)['then'](handleEntityNotFound(_0x29decb,null))[_0xf55e('0x25')](respondWithResult(_0x29decb,null))[_0xf55e('0x43')](handleError(_0x29decb,null));};exports['create']=function(_0xc76c71,_0x374dee){return db[_0xf55e('0x2b')]['create'](_0xc76c71[_0xf55e('0x48')],{})[_0xf55e('0x25')](respondWithResult(_0x374dee,0xc9))[_0xf55e('0x43')](handleError(_0x374dee,null));};exports[_0xf55e('0x24')]=function(_0x1dc2fd,_0x391569){if(_0x1dc2fd[_0xf55e('0x48')]['id']){delete _0x1dc2fd['body']['id'];}return db[_0xf55e('0x2b')][_0xf55e('0x47')]({'where':{'id':_0x1dc2fd[_0xf55e('0x45')]['id']}})[_0xf55e('0x25')](handleEntityNotFound(_0x391569,null))[_0xf55e('0x25')](saveUpdates(_0x1dc2fd[_0xf55e('0x48')],null))[_0xf55e('0x25')](respondWithResult(_0x391569,null))[_0xf55e('0x43')](handleError(_0x391569,null));};exports[_0xf55e('0x49')]=function(_0x42f117,_0x360a02){return db[_0xf55e('0x2b')][_0xf55e('0x47')]({'where':{'id':_0x42f117['params']['id']}})[_0xf55e('0x25')](handleEntityNotFound(_0x360a02,null))[_0xf55e('0x25')](removeEntity(_0x360a02,null))['catch'](handleError(_0x360a02,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index f144cb6..34e8b6f 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 _0x612b=['int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','exports','define','ServicenowField'];(function(_0x27431c,_0x5d28a1){var _0x4bd29b=function(_0x3c1685){while(--_0x3c1685){_0x27431c['push'](_0x27431c['shift']());}};_0x4bd29b(++_0x5d28a1);}(_0x612b,0x1d2));var _0xb612=function(_0x40e347,_0x235371){_0x40e347=_0x40e347-0x0;var _0x1ef408=_0x612b[_0x40e347];return _0x1ef408;};'use strict';var _=require(_0xb612('0x0'));var util=require(_0xb612('0x1'));var logger=require(_0xb612('0x2'))(_0xb612('0x3'));var moment=require(_0xb612('0x4'));var BPromise=require('bluebird');var rp=require(_0xb612('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb612('0x6'));var attributes=require('./intServicenowField.attributes');module[_0xb612('0x7')]=function(_0x3397fb,_0x174e60){return _0x3397fb[_0xb612('0x8')](_0xb612('0x9'),attributes,{'tableName':_0xb612('0xa'),'paranoid':![],'indexes':[{'name':_0xb612('0xb'),'fields':[_0xb612('0xc'),_0xb612('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4f5c=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','define','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash'];(function(_0x550f9c,_0x15c89a){var _0x59bc26=function(_0x57b988){while(--_0x57b988){_0x550f9c['push'](_0x550f9c['shift']());}};_0x59bc26(++_0x15c89a);}(_0x4f5c,0xe9));var _0xc4f5=function(_0x267432,_0xce11db){_0x267432=_0x267432-0x0;var _0x264b0b=_0x4f5c[_0x267432];return _0x264b0b;};'use strict';var _=require(_0xc4f5('0x0'));var util=require('util');var logger=require(_0xc4f5('0x1'))('api');var moment=require(_0xc4f5('0x2'));var BPromise=require('bluebird');var rp=require(_0xc4f5('0x3'));var fs=require('fs');var path=require(_0xc4f5('0x4'));var rimraf=require(_0xc4f5('0x5'));var config=require(_0xc4f5('0x6'));var attributes=require(_0xc4f5('0x7'));module['exports']=function(_0xa68ef7,_0x14c46e){return _0xa68ef7[_0xc4f5('0x8')]('ServicenowField',attributes,{'tableName':_0xc4f5('0x9'),'paranoid':![],'indexes':[{'name':_0xc4f5('0xa'),'fields':[_0xc4f5('0xb'),_0xc4f5('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 92ac55e..0f5b592 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 _0x0713=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x2e6c4c,_0x215202){var _0x1bdc56=function(_0x2aaa2a){while(--_0x2aaa2a){_0x2e6c4c['push'](_0x2e6c4c['shift']());}};_0x1bdc56(++_0x215202);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('ServicenowField,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('ServicenowField,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('ServicenowField,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x2ffa67,_0x482dab){var _0x7422=function(_0x58ee33){while(--_0x58ee33){_0x2ffa67['push'](_0x2ffa67['shift']());}};_0x7422(++_0x482dab);}(_0xb43b,0x1b2));var _0xbb43=function(_0x2bf464,_0x57822a){_0x2bf464=_0x2bf464-0x0;var _0x1f65d3=_0xb43b[_0x2bf464];return _0x1f65d3;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index dd4363e..1d0a4ef 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x338eb3,_0x18cff6){var _0x2ff2c5=function(_0x518e7d){while(--_0x518e7d){_0x338eb3['push'](_0x338eb3['shift']());}};_0x2ff2c5(++_0x18cff6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x548c5c,_0x4bb9d4){var _0x1ed5f4=function(_0x1419c9){while(--_0x1419c9){_0x548c5c['push'](_0x548c5c['shift']());}};_0x1ed5f4(++_0x4bb9d4);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index e6d5cc6..f4a7a41 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(_0xe54d9d,_0x1bced4){var _0x415b6a=function(_0x24fbc8){while(--_0x24fbc8){_0xe54d9d['push'](_0xe54d9d['shift']());}};_0x415b6a(++_0x1bced4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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(_0x18dc8d,_0x4fb71d){var _0x143d22=function(_0x4ddb73){while(--_0x4ddb73){_0x18dc8d['push'](_0x18dc8d['shift']());}};_0x143d22(++_0x4fb71d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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 4aff197..dfde0f6 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 _0xc860=['moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','then','end','error','stack','name','send','index','SugarcrmAccount','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','keys','options','create','body','find','params','findOne','SugarcrmConfiguration','rawAttributes','order','getConfigurations','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','assigned_user_id','created_by','description','date_start','parent_id','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','%s%s','get_module_fields','Calls','remove','includes','label','endsWith','values','value','test','statusCode','getFields','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch'];(function(_0x238830,_0x545f75){var _0x5917f0=function(_0x12f821){while(--_0x12f821){_0x238830['push'](_0x238830['shift']());}};_0x5917f0(++_0x545f75);}(_0xc860,0x78));var _0x0c86=function(_0x25248b,_0x3c8491){_0x25248b=_0x25248b-0x0;var _0x509939=_0xc860[_0x25248b];return _0x509939;};'use strict';var emlformat=require(_0x0c86('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0c86('0x1'));var jsonpatch=require(_0x0c86('0x2'));var rp=require('request-promise');var moment=require(_0x0c86('0x3'));var BPromise=require(_0x0c86('0x4'));var Mustache=require(_0x0c86('0x5'));var util=require(_0x0c86('0x6'));var path=require(_0x0c86('0x7'));var sox=require(_0x0c86('0x8'));var csv=require('to-csv');var ejs=require(_0x0c86('0x9'));var fs=require('fs');var fs_extra=require(_0x0c86('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0c86('0xb'));var jsforce=require(_0x0c86('0xc'));var deskjs=require(_0x0c86('0xd'));var toCsv=require(_0x0c86('0xe'));var querystring=require(_0x0c86('0xf'));var Papa=require(_0x0c86('0x10'));var Redis=require(_0x0c86('0x11'));var authService=require(_0x0c86('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0c86('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0c86('0x14'))(_0x0c86('0x15'));var utils=require(_0x0c86('0x16'));var config=require(_0x0c86('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0c86('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x285563,_0x103693){_0x103693=_0x103693||0xcc;return function(_0x53c2d7){if(_0x53c2d7){return _0x285563[_0x0c86('0x19')](_0x103693);}return _0x285563['status'](_0x103693)['end']();};}function respondWithResult(_0x346e1f,_0x2b84e5){_0x2b84e5=_0x2b84e5||0xc8;return function(_0x388353){if(_0x388353){return _0x346e1f[_0x0c86('0x1a')](_0x2b84e5)[_0x0c86('0x1b')](_0x388353);}};}function respondWithFilteredResult(_0x1b3fbf,_0x355f68){return function(_0x56f668){if(_0x56f668){var _0x591512=typeof _0x355f68[_0x0c86('0x1c')]===_0x0c86('0x1d')&&typeof _0x355f68[_0x0c86('0x1e')]===_0x0c86('0x1d');var _0xc6b054=_0x56f668[_0x0c86('0x1f')];var _0x429bc6=_0x591512?0x0:_0x355f68['offset'];var _0x1b72e3=_0x591512?_0x56f668[_0x0c86('0x1f')]:_0x355f68['offset']+_0x355f68[_0x0c86('0x1e')];var _0x96e24b;if(_0x1b72e3>=_0xc6b054){_0x1b72e3=_0xc6b054;_0x96e24b=0xc8;}else{_0x96e24b=0xce;}_0x1b3fbf[_0x0c86('0x1a')](_0x96e24b);return _0x1b3fbf[_0x0c86('0x20')](_0x0c86('0x21'),_0x429bc6+'-'+_0x1b72e3+'/'+_0xc6b054)['json'](_0x56f668);}return null;};}function patchUpdates(_0x5f365d){return function(_0x4d9fd3){try{jsonpatch['apply'](_0x4d9fd3,_0x5f365d,!![]);}catch(_0x541abe){return BPromise[_0x0c86('0x22')](_0x541abe);}return _0x4d9fd3[_0x0c86('0x23')]();};}function saveUpdates(_0x2047c2,_0x18807d){return function(_0x410c51){if(_0x410c51){return _0x410c51['update'](_0x2047c2)['then'](function(_0x532dac){return _0x532dac;});}return null;};}function removeEntity(_0x5d2fb4,_0x55ae28){return function(_0x20ac6a){if(_0x20ac6a){return _0x20ac6a[_0x0c86('0x24')]()[_0x0c86('0x25')](function(){_0x5d2fb4[_0x0c86('0x1a')](0xcc)[_0x0c86('0x26')]();});}};}function handleEntityNotFound(_0x429f97,_0x25e1c7){return function(_0x2ee4f5){if(!_0x2ee4f5){_0x429f97[_0x0c86('0x19')](0x194);}return _0x2ee4f5;};}function handleError(_0x5c57ad,_0x3fc77a){_0x3fc77a=_0x3fc77a||0x1f4;return function(_0x26f6b9){logger[_0x0c86('0x27')](_0x26f6b9[_0x0c86('0x28')]);if(_0x26f6b9[_0x0c86('0x29')]){delete _0x26f6b9[_0x0c86('0x29')];}_0x5c57ad['status'](_0x3fc77a)[_0x0c86('0x2a')](_0x26f6b9);};}exports[_0x0c86('0x2b')]=function(_0x5f9f48,_0x54e8c8){var _0x94c162={},_0x4b9d0d={},_0x1bc9d7={'count':0x0,'rows':[]};var _0x1cb3a5=_['map'](db[_0x0c86('0x2c')]['rawAttributes'],function(_0x59f025){return{'name':_0x59f025['fieldName'],'type':_0x59f025[_0x0c86('0x2d')][_0x0c86('0x2e')]};});_0x4b9d0d[_0x0c86('0x2f')]=_[_0x0c86('0x30')](_0x1cb3a5,_0x0c86('0x29'));_0x4b9d0d[_0x0c86('0x31')]=_['keys'](_0x5f9f48['query']);_0x4b9d0d[_0x0c86('0x32')]=_[_0x0c86('0x33')](_0x4b9d0d['model'],_0x4b9d0d[_0x0c86('0x31')]);_0x94c162[_0x0c86('0x34')]=_[_0x0c86('0x33')](_0x4b9d0d[_0x0c86('0x2f')],qs[_0x0c86('0x35')](_0x5f9f48[_0x0c86('0x31')]['fields']));_0x94c162['attributes']=_0x94c162[_0x0c86('0x34')][_0x0c86('0x36')]?_0x94c162[_0x0c86('0x34')]:_0x4b9d0d['model'];if(!_0x5f9f48['query'][_0x0c86('0x37')](_0x0c86('0x38'))){_0x94c162[_0x0c86('0x1e')]=qs['limit'](_0x5f9f48[_0x0c86('0x31')][_0x0c86('0x1e')]);_0x94c162[_0x0c86('0x1c')]=qs[_0x0c86('0x1c')](_0x5f9f48[_0x0c86('0x31')][_0x0c86('0x1c')]);}_0x94c162['order']=qs[_0x0c86('0x39')](_0x5f9f48[_0x0c86('0x31')]['sort']);_0x94c162[_0x0c86('0x3a')]=qs[_0x0c86('0x32')](_[_0x0c86('0x3b')](_0x5f9f48[_0x0c86('0x31')],_0x4b9d0d[_0x0c86('0x32')]),_0x1cb3a5);if(_0x5f9f48[_0x0c86('0x31')][_0x0c86('0x3c')]){_0x94c162[_0x0c86('0x3a')]=_[_0x0c86('0x3d')](_0x94c162['where'],{'$or':_[_0x0c86('0x30')](_0x1cb3a5,function(_0x562ab8){if(_0x562ab8['type']!==_0x0c86('0x3e')){var _0x25ceba={};_0x25ceba[_0x562ab8['name']]={'$like':'%'+_0x5f9f48[_0x0c86('0x31')][_0x0c86('0x3c')]+'%'};return _0x25ceba;}})});}_0x94c162=_['merge']({},_0x94c162,_0x5f9f48['options']);var _0x5bc190={'where':_0x94c162[_0x0c86('0x3a')]};return db[_0x0c86('0x2c')][_0x0c86('0x1f')](_0x5bc190)[_0x0c86('0x25')](function(_0x1f2eef){_0x1bc9d7[_0x0c86('0x1f')]=_0x1f2eef;if(_0x5f9f48[_0x0c86('0x31')][_0x0c86('0x3f')]){_0x94c162[_0x0c86('0x40')]=[{'all':!![]}];}return db[_0x0c86('0x2c')][_0x0c86('0x41')](_0x94c162);})[_0x0c86('0x25')](function(_0xa6f3b0){_0x1bc9d7[_0x0c86('0x42')]=_0xa6f3b0;return _0x1bc9d7;})[_0x0c86('0x25')](respondWithFilteredResult(_0x54e8c8,_0x94c162))[_0x0c86('0x43')](handleError(_0x54e8c8,null));};exports[_0x0c86('0x44')]=function(_0x24bd2d,_0x213404){var _0x37c82f={'raw':![],'where':{'id':_0x24bd2d['params']['id']}},_0x2c8245={};_0x2c8245['model']=_[_0x0c86('0x45')](db['SugarcrmAccount']['rawAttributes']);_0x2c8245[_0x0c86('0x31')]=_[_0x0c86('0x45')](_0x24bd2d['query']);_0x2c8245[_0x0c86('0x32')]=_['intersection'](_0x2c8245[_0x0c86('0x2f')],_0x2c8245[_0x0c86('0x31')]);_0x37c82f[_0x0c86('0x34')]=_['intersection'](_0x2c8245[_0x0c86('0x2f')],qs[_0x0c86('0x35')](_0x24bd2d['query'][_0x0c86('0x35')]));_0x37c82f[_0x0c86('0x34')]=_0x37c82f[_0x0c86('0x34')][_0x0c86('0x36')]?_0x37c82f[_0x0c86('0x34')]:_0x2c8245[_0x0c86('0x2f')];if(_0x24bd2d[_0x0c86('0x31')][_0x0c86('0x3f')]){_0x37c82f['include']=[{'all':!![]}];}_0x37c82f=_[_0x0c86('0x3d')]({},_0x37c82f,_0x24bd2d[_0x0c86('0x46')]);return db[_0x0c86('0x2c')]['find'](_0x37c82f)['then'](handleEntityNotFound(_0x213404,null))[_0x0c86('0x25')](respondWithResult(_0x213404,null))[_0x0c86('0x43')](handleError(_0x213404,null));};exports[_0x0c86('0x47')]=function(_0x27ba7d,_0x5e9ae0){return db['SugarcrmAccount']['create'](_0x27ba7d['body'],{})['then'](respondWithResult(_0x5e9ae0,0xc9))[_0x0c86('0x43')](handleError(_0x5e9ae0,null));};exports['update']=function(_0x21499c,_0x58af95){if(_0x21499c[_0x0c86('0x48')]['id']){delete _0x21499c[_0x0c86('0x48')]['id'];}return db[_0x0c86('0x2c')][_0x0c86('0x49')]({'where':{'id':_0x21499c[_0x0c86('0x4a')]['id']}})[_0x0c86('0x25')](handleEntityNotFound(_0x58af95,null))[_0x0c86('0x25')](saveUpdates(_0x21499c[_0x0c86('0x48')],null))[_0x0c86('0x25')](respondWithResult(_0x58af95,null))[_0x0c86('0x43')](handleError(_0x58af95,null));};exports[_0x0c86('0x24')]=function(_0x474735,_0x218e44){return db[_0x0c86('0x2c')][_0x0c86('0x49')]({'where':{'id':_0x474735[_0x0c86('0x4a')]['id']}})['then'](handleEntityNotFound(_0x218e44,null))['then'](removeEntity(_0x218e44,null))['catch'](handleError(_0x218e44,null));};exports['getConfigurations']=function(_0x43ba85,_0x4207d7,_0x2c8cb2){var _0x505304={};var _0x4e644b={};var _0x3cca14;var _0xabc0a7;return db[_0x0c86('0x2c')][_0x0c86('0x4b')]({'where':{'id':_0x43ba85['params']['id']}})[_0x0c86('0x25')](handleEntityNotFound(_0x4207d7,null))[_0x0c86('0x25')](function(_0x422c92){if(_0x422c92){_0x3cca14=_0x422c92;_0x4e644b[_0x0c86('0x2f')]=_['keys'](db[_0x0c86('0x4c')][_0x0c86('0x4d')]);_0x4e644b['query']=_[_0x0c86('0x45')](_0x43ba85[_0x0c86('0x31')]);_0x4e644b[_0x0c86('0x32')]=_[_0x0c86('0x33')](_0x4e644b[_0x0c86('0x2f')],_0x4e644b[_0x0c86('0x31')]);_0x505304[_0x0c86('0x34')]=_[_0x0c86('0x33')](_0x4e644b['model'],qs[_0x0c86('0x35')](_0x43ba85['query']['fields']));_0x505304[_0x0c86('0x34')]=_0x505304[_0x0c86('0x34')][_0x0c86('0x36')]?_0x505304['attributes']:_0x4e644b[_0x0c86('0x2f')];_0x505304[_0x0c86('0x4e')]=qs['sort'](_0x43ba85[_0x0c86('0x31')][_0x0c86('0x39')]);_0x505304[_0x0c86('0x3a')]=qs[_0x0c86('0x32')](_['pick'](_0x43ba85[_0x0c86('0x31')],_0x4e644b[_0x0c86('0x32')]));if(_0x43ba85['query'][_0x0c86('0x3c')]){_0x505304[_0x0c86('0x3a')]=_[_0x0c86('0x3d')](_0x505304[_0x0c86('0x3a')],{'$or':_['map'](_0x505304[_0x0c86('0x34')],function(_0x4addf4){var _0x29fb40={};_0x29fb40[_0x4addf4]={'$like':'%'+_0x43ba85['query'][_0x0c86('0x3c')]+'%'};return _0x29fb40;})});}_0x505304=_[_0x0c86('0x3d')]({},_0x505304,_0x43ba85[_0x0c86('0x46')]);return _0x3cca14[_0x0c86('0x4f')](_0x505304);}})[_0x0c86('0x25')](function(_0x24a971){if(_0x24a971){_0xabc0a7=_0x24a971[_0x0c86('0x36')];if(!_0x43ba85[_0x0c86('0x31')][_0x0c86('0x37')](_0x0c86('0x38'))){_0x505304[_0x0c86('0x1e')]=qs[_0x0c86('0x1e')](_0x43ba85[_0x0c86('0x31')]['limit']);_0x505304['offset']=qs[_0x0c86('0x1c')](_0x43ba85[_0x0c86('0x31')][_0x0c86('0x1c')]);}return _0x3cca14[_0x0c86('0x4f')](_0x505304);}})[_0x0c86('0x25')](function(_0x57c9f3){if(_0x57c9f3){return _0x57c9f3?{'count':_0xabc0a7,'rows':_0x57c9f3}:null;}})[_0x0c86('0x25')](respondWithResult(_0x4207d7,null))['catch'](handleError(_0x4207d7,null));};exports['addConfiguration']=function(_0x418bcd,_0x2bb407,_0x5dae4a){if(_0x418bcd[_0x0c86('0x48')]['id']){delete _0x418bcd[_0x0c86('0x48')]['id'];}return db['SugarcrmAccount'][_0x0c86('0x4b')]({'where':{'id':_0x418bcd[_0x0c86('0x4a')]['id']}})[_0x0c86('0x25')](handleEntityNotFound(_0x2bb407,null))[_0x0c86('0x25')](function(_0x2f8702){if(_0x2f8702){_0x418bcd[_0x0c86('0x48')][_0x0c86('0x50')]=_0x2f8702['id'];_0x418bcd[_0x0c86('0x48')][_0x0c86('0x51')]=integrations[_0x0c86('0x52')](_0x418bcd[_0x0c86('0x48')][_0x0c86('0x53')],_0x418bcd[_0x0c86('0x48')][_0x0c86('0x2d')]);_0x418bcd[_0x0c86('0x48')][_0x0c86('0x54')]=integrations[_0x0c86('0x55')](_0x418bcd[_0x0c86('0x48')][_0x0c86('0x53')],_0x418bcd[_0x0c86('0x48')][_0x0c86('0x2d')]);return db[_0x0c86('0x4c')]['create'](_0x418bcd[_0x0c86('0x48')],{'include':[{'model':db[_0x0c86('0x56')],'as':_0x0c86('0x51')},{'model':db[_0x0c86('0x56')],'as':_0x0c86('0x54')}]});}return null;})[_0x0c86('0x25')](respondWithResult(_0x2bb407,null))[_0x0c86('0x43')](handleError(_0x2bb407,null));};exports['getFields']=function(_0x3ec610,_0x13933f,_0x1786e0){var _0x241091='';var _0x2b7536=['id',_0x0c86('0x29'),_0x0c86('0x57'),_0x0c86('0x58'),_0x0c86('0x59'),_0x0c86('0x5a'),'duration_hours','duration_minutes',_0x0c86('0x5b'),'parent_type',_0x0c86('0x5c'),_0x0c86('0x5d')];return db[_0x0c86('0x2c')][_0x0c86('0x4b')]({'where':{'id':_0x3ec610['params']['id']},'attributes':['id',_0x0c86('0x5e'),_0x0c86('0x5f'),_0x0c86('0x60')]})[_0x0c86('0x25')](handleEntityNotFound(_0x13933f,null))[_0x0c86('0x25')](function(_0x253a20){if(_0x253a20){_0x241091=_0x253a20[_0x0c86('0x60')];var _0x3bff02=_0x241091[_0x0c86('0x61')](-0x1);if(_0x3bff02==='/'){_0x241091=_0x241091[_0x0c86('0x62')](0x0,_0x241091[_0x0c86('0x63')](_0x3bff02));}return rp({'method':_0x0c86('0x64'),'uri':util[_0x0c86('0x65')]('%s%s',_0x241091,_0x0c86('0x66')),'json':!![],'form':{'method':_0x0c86('0x67'),'input_type':_0x0c86('0x68'),'response_type':_0x0c86('0x68'),'rest_data':JSON[_0x0c86('0x69')]({'user_auth':{'user_name':_0x253a20[_0x0c86('0x5e')],'password':_0x253a20[_0x0c86('0x5f')],'encryption':_0x0c86('0x6a')},'application':_0x0c86('0x6b')})}});}})[_0x0c86('0x25')](function(_0x2336a0){if(_0x2336a0&&_0x2336a0['name']!==_0x0c86('0x6c')&&_0x2336a0['name']!==_0x0c86('0x6d')){return rp({'method':'POST','uri':util[_0x0c86('0x65')](_0x0c86('0x6e'),_0x241091,_0x0c86('0x66')),'json':!![],'form':{'method':_0x0c86('0x6f'),'input_type':'JSON','response_type':_0x0c86('0x68'),'rest_data':JSON[_0x0c86('0x69')]({'session':_0x2336a0['id'],'module_name':_0x0c86('0x70')})}})['then'](function(_0x3f7ea9){if(_0x3f7ea9){var _0x47fd49=_['values'](_0x3f7ea9['module_fields']);_[_0x0c86('0x71')](_0x47fd49,function(_0x16e693){return _0x2b7536[_0x0c86('0x72')](_0x16e693[_0x0c86('0x29')]);});return{'count':_0x47fd49['length'],'rows':_['map'](_0x47fd49,function(_0x23a147){return{'id':_0x23a147['name'],'name':_0x23a147[_0x0c86('0x73')],'custom':_[_0x0c86('0x74')](_0x23a147['name'],'_c')?!![]:![],'options':_0x23a147[_0x0c86('0x46')]?_['map'](_[_0x0c86('0x75')](_0x23a147[_0x0c86('0x46')]),function(_0xae4fee){return{'name':_0xae4fee[_0x0c86('0x76')],'value':_0xae4fee[_0x0c86('0x29')]};}):[]};})};}})[_0x0c86('0x25')](respondWithResult(_0x13933f,null))[_0x0c86('0x43')](function(_0x2eb39a){var _0x4ee15d=_0x3ec610['query'][_0x0c86('0x77')]?0x1f4:_0x2eb39a[_0x0c86('0x78')]||0x1f4;logger[_0x0c86('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0x0c86('0x79'),_0x4ee15d,JSON[_0x0c86('0x69')](_0x2eb39a));delete _0x2eb39a[_0x0c86('0x29')];if(_0x4ee15d===0x191){_0x4ee15d=0x190;}_0x13933f[_0x0c86('0x1a')](_0x4ee15d)[_0x0c86('0x2a')](_0x3ec610[_0x0c86('0x31')][_0x0c86('0x77')]?{'message':_0x0c86('0x7a'),'statusCode':_0x2eb39a[_0x0c86('0x78')]}:_0x2eb39a);});}else{var _0x1ea2b3=0x1f4;_0x13933f['status'](_0x1ea2b3)['send']({'message':_0x0c86('0x7a'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x72b1=['slice','substring','lastIndexOf','POST','JSON','stringify','username','password','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','format','/service/v4_1/rest.php','get_module_fields','Calls','values','module_fields','remove','label','value','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','offset','undefined','limit','count','set','json','apply','update','then','destroy','error','send','index','rawAttributes','fieldName','type','key','map','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','include','SugarcrmAccount','rows','catch','show','params','options','find','create','body','getConfigurations','findOne','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_name','remoteUri'];(function(_0xee4eed,_0x53280e){var _0x3e428c=function(_0x4d7094){while(--_0x4d7094){_0xee4eed['push'](_0xee4eed['shift']());}};_0x3e428c(++_0x53280e);}(_0x72b1,0x103));var _0x172b=function(_0xcc3fa,_0xfdbcdb){_0xcc3fa=_0xcc3fa-0x0;var _0x4c9a1e=_0x72b1[_0xcc3fa];return _0x4c9a1e;};'use strict';var emlformat=require(_0x172b('0x0'));var rimraf=require(_0x172b('0x1'));var zipdir=require(_0x172b('0x2'));var jsonpatch=require(_0x172b('0x3'));var rp=require(_0x172b('0x4'));var moment=require(_0x172b('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x172b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x172b('0x7'));var ejs=require(_0x172b('0x8'));var fs=require('fs');var fs_extra=require(_0x172b('0x9'));var _=require(_0x172b('0xa'));var squel=require('squel');var crypto=require(_0x172b('0xb'));var jsforce=require(_0x172b('0xc'));var deskjs=require(_0x172b('0xd'));var toCsv=require(_0x172b('0x7'));var querystring=require(_0x172b('0xe'));var Papa=require(_0x172b('0xf'));var Redis=require(_0x172b('0x10'));var authService=require(_0x172b('0x11'));var qs=require(_0x172b('0x12'));var as=require(_0x172b('0x13'));var hardwareService=require(_0x172b('0x14'));var logger=require(_0x172b('0x15'))(_0x172b('0x16'));var utils=require(_0x172b('0x17'));var config=require(_0x172b('0x18'));var licenseUtil=require(_0x172b('0x19'));var db=require(_0x172b('0x1a'))['db'];var integrations=require(_0x172b('0x1b'));function respondWithStatusCode(_0x298fcf,_0x38de78){_0x38de78=_0x38de78||0xcc;return function(_0xc5ce27){if(_0xc5ce27){return _0x298fcf['sendStatus'](_0x38de78);}return _0x298fcf[_0x172b('0x1c')](_0x38de78)[_0x172b('0x1d')]();};}function respondWithResult(_0x4c497d,_0x41fd64){_0x41fd64=_0x41fd64||0xc8;return function(_0x55e27b){if(_0x55e27b){return _0x4c497d[_0x172b('0x1c')](_0x41fd64)['json'](_0x55e27b);}};}function respondWithFilteredResult(_0x2447e6,_0x185a5c){return function(_0x34c637){if(_0x34c637){var _0x388697=typeof _0x185a5c[_0x172b('0x1e')]===_0x172b('0x1f')&&typeof _0x185a5c[_0x172b('0x20')]===_0x172b('0x1f');var _0x41edce=_0x34c637[_0x172b('0x21')];var _0x36e4ef=_0x388697?0x0:_0x185a5c[_0x172b('0x1e')];var _0x1d9000=_0x388697?_0x34c637[_0x172b('0x21')]:_0x185a5c[_0x172b('0x1e')]+_0x185a5c[_0x172b('0x20')];var _0x443dfb;if(_0x1d9000>=_0x41edce){_0x1d9000=_0x41edce;_0x443dfb=0xc8;}else{_0x443dfb=0xce;}_0x2447e6['status'](_0x443dfb);return _0x2447e6[_0x172b('0x22')]('Content-Range',_0x36e4ef+'-'+_0x1d9000+'/'+_0x41edce)[_0x172b('0x23')](_0x34c637);}return null;};}function patchUpdates(_0x52e4df){return function(_0x805f10){try{jsonpatch[_0x172b('0x24')](_0x805f10,_0x52e4df,!![]);}catch(_0x2c8329){return BPromise['reject'](_0x2c8329);}return _0x805f10['save']();};}function saveUpdates(_0x2071ad,_0x2ceb4e){return function(_0x3af3f2){if(_0x3af3f2){return _0x3af3f2[_0x172b('0x25')](_0x2071ad)[_0x172b('0x26')](function(_0x3b3dfb){return _0x3b3dfb;});}return null;};}function removeEntity(_0x2a279c,_0x222a1a){return function(_0x2a195b){if(_0x2a195b){return _0x2a195b[_0x172b('0x27')]()[_0x172b('0x26')](function(){_0x2a279c[_0x172b('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x341062,_0x3b3180){return function(_0x926be3){if(!_0x926be3){_0x341062['sendStatus'](0x194);}return _0x926be3;};}function handleError(_0x1b9da3,_0x463ed7){_0x463ed7=_0x463ed7||0x1f4;return function(_0x233303){logger[_0x172b('0x28')](_0x233303['stack']);if(_0x233303['name']){delete _0x233303['name'];}_0x1b9da3[_0x172b('0x1c')](_0x463ed7)[_0x172b('0x29')](_0x233303);};}exports[_0x172b('0x2a')]=function(_0xeb66e0,_0x4e83a5){var _0x3288d8={},_0x3fc06f={},_0x4be16a={'count':0x0,'rows':[]};var _0x1950ce=_['map'](db['SugarcrmAccount'][_0x172b('0x2b')],function(_0x76cc9){return{'name':_0x76cc9[_0x172b('0x2c')],'type':_0x76cc9[_0x172b('0x2d')][_0x172b('0x2e')]};});_0x3fc06f['model']=_[_0x172b('0x2f')](_0x1950ce,_0x172b('0x30'));_0x3fc06f[_0x172b('0x31')]=_[_0x172b('0x32')](_0xeb66e0[_0x172b('0x31')]);_0x3fc06f[_0x172b('0x33')]=_[_0x172b('0x34')](_0x3fc06f[_0x172b('0x35')],_0x3fc06f[_0x172b('0x31')]);_0x3288d8[_0x172b('0x36')]=_[_0x172b('0x34')](_0x3fc06f[_0x172b('0x35')],qs['fields'](_0xeb66e0[_0x172b('0x31')][_0x172b('0x37')]));_0x3288d8[_0x172b('0x36')]=_0x3288d8[_0x172b('0x36')][_0x172b('0x38')]?_0x3288d8[_0x172b('0x36')]:_0x3fc06f[_0x172b('0x35')];if(!_0xeb66e0[_0x172b('0x31')][_0x172b('0x39')]('nolimit')){_0x3288d8[_0x172b('0x20')]=qs['limit'](_0xeb66e0[_0x172b('0x31')]['limit']);_0x3288d8[_0x172b('0x1e')]=qs[_0x172b('0x1e')](_0xeb66e0['query']['offset']);}_0x3288d8[_0x172b('0x3a')]=qs['sort'](_0xeb66e0['query'][_0x172b('0x3b')]);_0x3288d8[_0x172b('0x3c')]=qs[_0x172b('0x33')](_[_0x172b('0x3d')](_0xeb66e0[_0x172b('0x31')],_0x3fc06f['filters']),_0x1950ce);if(_0xeb66e0[_0x172b('0x31')][_0x172b('0x3e')]){_0x3288d8[_0x172b('0x3c')]=_[_0x172b('0x3f')](_0x3288d8[_0x172b('0x3c')],{'$or':_[_0x172b('0x2f')](_0x1950ce,function(_0x2b51ad){if(_0x2b51ad[_0x172b('0x2d')]!==_0x172b('0x40')){var _0x45103a={};_0x45103a[_0x2b51ad[_0x172b('0x30')]]={'$like':'%'+_0xeb66e0[_0x172b('0x31')][_0x172b('0x3e')]+'%'};return _0x45103a;}})});}_0x3288d8=_[_0x172b('0x3f')]({},_0x3288d8,_0xeb66e0['options']);var _0x25eb27={'where':_0x3288d8[_0x172b('0x3c')]};return db['SugarcrmAccount'][_0x172b('0x21')](_0x25eb27)[_0x172b('0x26')](function(_0x8949ee){_0x4be16a[_0x172b('0x21')]=_0x8949ee;if(_0xeb66e0['query']['includeAll']){_0x3288d8[_0x172b('0x41')]=[{'all':!![]}];}return db[_0x172b('0x42')]['findAll'](_0x3288d8);})['then'](function(_0xf8bb96){_0x4be16a[_0x172b('0x43')]=_0xf8bb96;return _0x4be16a;})[_0x172b('0x26')](respondWithFilteredResult(_0x4e83a5,_0x3288d8))[_0x172b('0x44')](handleError(_0x4e83a5,null));};exports[_0x172b('0x45')]=function(_0x14baf0,_0x3f7afd){var _0x4c0050={'raw':![],'where':{'id':_0x14baf0[_0x172b('0x46')]['id']}},_0x5b716d={};_0x5b716d[_0x172b('0x35')]=_['keys'](db['SugarcrmAccount']['rawAttributes']);_0x5b716d[_0x172b('0x31')]=_[_0x172b('0x32')](_0x14baf0[_0x172b('0x31')]);_0x5b716d[_0x172b('0x33')]=_[_0x172b('0x34')](_0x5b716d['model'],_0x5b716d[_0x172b('0x31')]);_0x4c0050[_0x172b('0x36')]=_[_0x172b('0x34')](_0x5b716d[_0x172b('0x35')],qs['fields'](_0x14baf0[_0x172b('0x31')][_0x172b('0x37')]));_0x4c0050['attributes']=_0x4c0050[_0x172b('0x36')]['length']?_0x4c0050[_0x172b('0x36')]:_0x5b716d[_0x172b('0x35')];if(_0x14baf0['query']['includeAll']){_0x4c0050[_0x172b('0x41')]=[{'all':!![]}];}_0x4c0050=_[_0x172b('0x3f')]({},_0x4c0050,_0x14baf0[_0x172b('0x47')]);return db[_0x172b('0x42')][_0x172b('0x48')](_0x4c0050)[_0x172b('0x26')](handleEntityNotFound(_0x3f7afd,null))[_0x172b('0x26')](respondWithResult(_0x3f7afd,null))['catch'](handleError(_0x3f7afd,null));};exports[_0x172b('0x49')]=function(_0x320cc6,_0x36dd65){return db['SugarcrmAccount'][_0x172b('0x49')](_0x320cc6[_0x172b('0x4a')],{})['then'](respondWithResult(_0x36dd65,0xc9))[_0x172b('0x44')](handleError(_0x36dd65,null));};exports[_0x172b('0x25')]=function(_0x716e8,_0x24945e){if(_0x716e8[_0x172b('0x4a')]['id']){delete _0x716e8[_0x172b('0x4a')]['id'];}return db[_0x172b('0x42')][_0x172b('0x48')]({'where':{'id':_0x716e8[_0x172b('0x46')]['id']}})[_0x172b('0x26')](handleEntityNotFound(_0x24945e,null))[_0x172b('0x26')](saveUpdates(_0x716e8['body'],null))['then'](respondWithResult(_0x24945e,null))[_0x172b('0x44')](handleError(_0x24945e,null));};exports[_0x172b('0x27')]=function(_0x2a1f86,_0x46d794){return db['SugarcrmAccount'][_0x172b('0x48')]({'where':{'id':_0x2a1f86[_0x172b('0x46')]['id']}})['then'](handleEntityNotFound(_0x46d794,null))[_0x172b('0x26')](removeEntity(_0x46d794,null))['catch'](handleError(_0x46d794,null));};exports[_0x172b('0x4b')]=function(_0x5b5ede,_0x27e23d,_0x37827f){var _0x2eee6c={};var _0x94d5ce={};var _0x3123ff;var _0x4db2e8;return db[_0x172b('0x42')][_0x172b('0x4c')]({'where':{'id':_0x5b5ede['params']['id']}})[_0x172b('0x26')](handleEntityNotFound(_0x27e23d,null))[_0x172b('0x26')](function(_0x432856){if(_0x432856){_0x3123ff=_0x432856;_0x94d5ce[_0x172b('0x35')]=_[_0x172b('0x32')](db['SugarcrmConfiguration'][_0x172b('0x2b')]);_0x94d5ce[_0x172b('0x31')]=_[_0x172b('0x32')](_0x5b5ede[_0x172b('0x31')]);_0x94d5ce[_0x172b('0x33')]=_[_0x172b('0x34')](_0x94d5ce['model'],_0x94d5ce[_0x172b('0x31')]);_0x2eee6c['attributes']=_[_0x172b('0x34')](_0x94d5ce[_0x172b('0x35')],qs['fields'](_0x5b5ede[_0x172b('0x31')][_0x172b('0x37')]));_0x2eee6c[_0x172b('0x36')]=_0x2eee6c['attributes'][_0x172b('0x38')]?_0x2eee6c[_0x172b('0x36')]:_0x94d5ce[_0x172b('0x35')];_0x2eee6c[_0x172b('0x3a')]=qs['sort'](_0x5b5ede['query'][_0x172b('0x3b')]);_0x2eee6c[_0x172b('0x3c')]=qs[_0x172b('0x33')](_[_0x172b('0x3d')](_0x5b5ede[_0x172b('0x31')],_0x94d5ce['filters']));if(_0x5b5ede[_0x172b('0x31')][_0x172b('0x3e')]){_0x2eee6c[_0x172b('0x3c')]=_[_0x172b('0x3f')](_0x2eee6c[_0x172b('0x3c')],{'$or':_['map'](_0x2eee6c[_0x172b('0x36')],function(_0x4834b1){var _0x2ca88b={};_0x2ca88b[_0x4834b1]={'$like':'%'+_0x5b5ede['query']['filter']+'%'};return _0x2ca88b;})});}_0x2eee6c=_['merge']({},_0x2eee6c,_0x5b5ede[_0x172b('0x47')]);return _0x3123ff['getConfigurations'](_0x2eee6c);}})['then'](function(_0x2ddc37){if(_0x2ddc37){_0x4db2e8=_0x2ddc37['length'];if(!_0x5b5ede[_0x172b('0x31')][_0x172b('0x39')](_0x172b('0x4d'))){_0x2eee6c[_0x172b('0x20')]=qs[_0x172b('0x20')](_0x5b5ede[_0x172b('0x31')][_0x172b('0x20')]);_0x2eee6c[_0x172b('0x1e')]=qs[_0x172b('0x1e')](_0x5b5ede[_0x172b('0x31')][_0x172b('0x1e')]);}return _0x3123ff[_0x172b('0x4b')](_0x2eee6c);}})[_0x172b('0x26')](function(_0x115ea2){if(_0x115ea2){return _0x115ea2?{'count':_0x4db2e8,'rows':_0x115ea2}:null;}})[_0x172b('0x26')](respondWithResult(_0x27e23d,null))[_0x172b('0x44')](handleError(_0x27e23d,null));};exports[_0x172b('0x4e')]=function(_0x2ef221,_0x28f176,_0x3ab94c){if(_0x2ef221[_0x172b('0x4a')]['id']){delete _0x2ef221['body']['id'];}return db[_0x172b('0x42')][_0x172b('0x4c')]({'where':{'id':_0x2ef221[_0x172b('0x46')]['id']}})[_0x172b('0x26')](handleEntityNotFound(_0x28f176,null))[_0x172b('0x26')](function(_0x35773b){if(_0x35773b){_0x2ef221[_0x172b('0x4a')][_0x172b('0x4f')]=_0x35773b['id'];_0x2ef221[_0x172b('0x4a')][_0x172b('0x50')]=integrations[_0x172b('0x51')](_0x2ef221[_0x172b('0x4a')][_0x172b('0x52')],_0x2ef221[_0x172b('0x4a')][_0x172b('0x2d')]);_0x2ef221['body'][_0x172b('0x53')]=integrations['getDescriptions'](_0x2ef221[_0x172b('0x4a')][_0x172b('0x52')],_0x2ef221[_0x172b('0x4a')][_0x172b('0x2d')]);return db['SugarcrmConfiguration'][_0x172b('0x49')](_0x2ef221[_0x172b('0x4a')],{'include':[{'model':db[_0x172b('0x54')],'as':_0x172b('0x50')},{'model':db['SugarcrmField'],'as':'Descriptions'}]});}return null;})[_0x172b('0x26')](respondWithResult(_0x28f176,null))[_0x172b('0x44')](handleError(_0x28f176,null));};exports[_0x172b('0x55')]=function(_0x529471,_0x3a618a,_0x8dede5){var _0xf0b8ef='';var _0x15cd22=['id',_0x172b('0x30'),_0x172b('0x56'),_0x172b('0x57'),_0x172b('0x58'),_0x172b('0x59'),_0x172b('0x5a'),_0x172b('0x5b'),_0x172b('0x5c'),'parent_type',_0x172b('0x5d'),'direction'];return db['SugarcrmAccount']['findOne']({'where':{'id':_0x529471['params']['id']},'attributes':['id','username','password','remoteUri']})[_0x172b('0x26')](handleEntityNotFound(_0x3a618a,null))['then'](function(_0x5988f8){if(_0x5988f8){_0xf0b8ef=_0x5988f8[_0x172b('0x5e')];var _0x554896=_0xf0b8ef[_0x172b('0x5f')](-0x1);if(_0x554896==='/'){_0xf0b8ef=_0xf0b8ef[_0x172b('0x60')](0x0,_0xf0b8ef[_0x172b('0x61')](_0x554896));}return rp({'method':_0x172b('0x62'),'uri':util['format']('%s%s',_0xf0b8ef,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'login','input_type':_0x172b('0x63'),'response_type':'JSON','rest_data':JSON[_0x172b('0x64')]({'user_auth':{'user_name':_0x5988f8[_0x172b('0x65')],'password':_0x5988f8[_0x172b('0x66')],'encryption':_0x172b('0x67')},'application':_0x172b('0x68')})}});}})[_0x172b('0x26')](function(_0x46a45f){if(_0x46a45f&&_0x46a45f['name']!==_0x172b('0x69')&&_0x46a45f['name']!==_0x172b('0x6a')){return rp({'method':'POST','uri':util[_0x172b('0x6b')]('%s%s',_0xf0b8ef,_0x172b('0x6c')),'json':!![],'form':{'method':_0x172b('0x6d'),'input_type':'JSON','response_type':_0x172b('0x63'),'rest_data':JSON['stringify']({'session':_0x46a45f['id'],'module_name':_0x172b('0x6e')})}})[_0x172b('0x26')](function(_0x2e3bdd){if(_0x2e3bdd){var _0xb50e06=_[_0x172b('0x6f')](_0x2e3bdd[_0x172b('0x70')]);_[_0x172b('0x71')](_0xb50e06,function(_0x4bfdb2){return _0x15cd22['includes'](_0x4bfdb2[_0x172b('0x30')]);});return{'count':_0xb50e06[_0x172b('0x38')],'rows':_['map'](_0xb50e06,function(_0x227e5e){return{'id':_0x227e5e[_0x172b('0x30')],'name':_0x227e5e[_0x172b('0x72')],'custom':_['endsWith'](_0x227e5e[_0x172b('0x30')],'_c')?!![]:![],'options':_0x227e5e[_0x172b('0x47')]?_['map'](_[_0x172b('0x6f')](_0x227e5e[_0x172b('0x47')]),function(_0x5d55dd){return{'name':_0x5d55dd[_0x172b('0x73')],'value':_0x5d55dd[_0x172b('0x30')]};}):[]};})};}})[_0x172b('0x26')](respondWithResult(_0x3a618a,null))[_0x172b('0x44')](function(_0x38ed9f){var _0x391956=_0x529471[_0x172b('0x31')][_0x172b('0x74')]?0x1f4:_0x38ed9f['statusCode']||0x1f4;logger[_0x172b('0x28')]('getFields,\x20%s,\x20%s,\x20%s',_0x172b('0x55'),_0x391956,JSON[_0x172b('0x64')](_0x38ed9f));delete _0x38ed9f[_0x172b('0x30')];if(_0x391956===0x191){_0x391956=0x190;}_0x3a618a[_0x172b('0x1c')](_0x391956)['send'](_0x529471[_0x172b('0x31')][_0x172b('0x74')]?{'message':_0x172b('0x75'),'statusCode':_0x38ed9f['statusCode']}:_0x38ed9f);});}else{var _0x5afa30=0x1f4;_0x3a618a[_0x172b('0x1c')](_0x5afa30)['send']({'message':_0x172b('0x75'),'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 ad166a7..66d497e 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 _0xeeaf=['path','../../config/environment','./intSugarcrmAccount.attributes','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x3de90a,_0x1771b4){var _0x5af411=function(_0x2d768a){while(--_0x2d768a){_0x3de90a['push'](_0x3de90a['shift']());}};_0x5af411(++_0x1771b4);}(_0xeeaf,0x159));var _0xfeea=function(_0x568c2a,_0x40066e){_0x568c2a=_0x568c2a-0x0;var _0x286cfa=_0xeeaf[_0x568c2a];return _0x286cfa;};'use strict';var _=require(_0xfeea('0x0'));var util=require(_0xfeea('0x1'));var logger=require(_0xfeea('0x2'))(_0xfeea('0x3'));var moment=require('moment');var BPromise=require(_0xfeea('0x4'));var rp=require(_0xfeea('0x5'));var fs=require('fs');var path=require(_0xfeea('0x6'));var rimraf=require('rimraf');var config=require(_0xfeea('0x7'));var attributes=require(_0xfeea('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xfeea('0x9')]=function(_0x1d9b94,_0x3f4f5b){return _0x1d9b94[_0xfeea('0xa')](_0xfeea('0xb'),attributes,{'tableName':_0xfeea('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x45d8=['lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./intSugarcrmAccount.attributes','define','SugarcrmAccount','int_sugarcrm_accounts'];(function(_0xf794f4,_0x50535e){var _0x559eff=function(_0xa9264a){while(--_0xa9264a){_0xf794f4['push'](_0xf794f4['shift']());}};_0x559eff(++_0x50535e);}(_0x45d8,0x174));var _0x845d=function(_0x23945f,_0x9d3e4e){_0x23945f=_0x23945f-0x0;var _0xa38592=_0x45d8[_0x23945f];return _0xa38592;};'use strict';var _=require(_0x845d('0x0'));var util=require(_0x845d('0x1'));var logger=require(_0x845d('0x2'))(_0x845d('0x3'));var moment=require(_0x845d('0x4'));var BPromise=require(_0x845d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x845d('0x6'));var rimraf=require('rimraf');var config=require(_0x845d('0x7'));var attributes=require(_0x845d('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x312806,_0x4a59a2){return _0x312806[_0x845d('0x9')](_0x845d('0xa'),attributes,{'tableName':_0x845d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index e851697..afd49da 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 _0xf1ae=['catch','GetSugarcrmAccount','findAll','options','raw','where','limit','include','attributes','model','map','info','ShowSugarcrmAccount','find','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result'];(function(_0x15449d,_0x537b1d){var _0x55cf8c=function(_0x4fc014){while(--_0x4fc014){_0x15449d['push'](_0x15449d['shift']());}};_0x55cf8c(++_0x537b1d);}(_0xf1ae,0xc8));var _0xef1a=function(_0x545e39,_0xb32a2){_0x545e39=_0x545e39-0x0;var _0x2e1417=_0xf1ae[_0x545e39];return _0x2e1417;};'use strict';var _=require(_0xef1a('0x0'));var util=require(_0xef1a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xef1a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xef1a('0x3'))['db'];var utils=require(_0xef1a('0x4'));var logger=require(_0xef1a('0x5'))(_0xef1a('0x6'));var config=require(_0xef1a('0x7'));var jayson=require(_0xef1a('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x94b6ed,_0x417d8f,_0x2b42f4){return new BPromise(function(_0x13153b,_0x3c211a){return client['request'](_0x94b6ed,_0x2b42f4)[_0xef1a('0x9')](function(_0x1c32fb){logger['info'](_0xef1a('0xa'),_0x417d8f,_0xef1a('0xb'));logger[_0xef1a('0xc')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x417d8f,'request\x20sent',JSON[_0xef1a('0xd')](_0x1c32fb));if(_0x1c32fb[_0xef1a('0xe')]){if(_0x1c32fb[_0xef1a('0xe')]['code']===0x1f4){logger[_0xef1a('0xe')]('SugarcrmAccount,\x20%s,\x20%s',_0x417d8f,_0x1c32fb[_0xef1a('0xe')][_0xef1a('0xf')]);return _0x3c211a(_0x1c32fb[_0xef1a('0xe')][_0xef1a('0xf')]);}logger[_0xef1a('0xe')]('SugarcrmAccount,\x20%s,\x20%s',_0x417d8f,_0x1c32fb['error'][_0xef1a('0xf')]);return _0x13153b(_0x1c32fb[_0xef1a('0xe')][_0xef1a('0xf')]);}else{logger['info'](_0xef1a('0xa'),_0x417d8f,_0xef1a('0xb'));_0x13153b(_0x1c32fb[_0xef1a('0x10')]['message']);}})[_0xef1a('0x11')](function(_0xad699){logger[_0xef1a('0xe')](_0xef1a('0xa'),_0x417d8f,_0xad699);_0x3c211a(_0xad699);});});}exports[_0xef1a('0x12')]=function(_0x4e927b){var _0x3c189b=this;return new Promise(function(_0x110a9f,_0x1cceb7){return db['SugarcrmAccount'][_0xef1a('0x13')]({'raw':_0x4e927b[_0xef1a('0x14')]?_0x4e927b[_0xef1a('0x14')][_0xef1a('0x15')]===undefined?!![]:![]:!![],'where':_0x4e927b['options']?_0x4e927b[_0xef1a('0x14')][_0xef1a('0x16')]||null:null,'attributes':_0x4e927b[_0xef1a('0x14')]?_0x4e927b['options']['attributes']||null:null,'limit':_0x4e927b[_0xef1a('0x14')]?_0x4e927b[_0xef1a('0x14')][_0xef1a('0x17')]||null:null,'include':_0x4e927b['options']?_0x4e927b['options'][_0xef1a('0x18')]?_['map'](_0x4e927b[_0xef1a('0x14')][_0xef1a('0x18')],function(_0x31e5a9){return{'model':db[_0x31e5a9['model']],'as':_0x31e5a9['as'],'attributes':_0x31e5a9[_0xef1a('0x19')],'include':_0x31e5a9[_0xef1a('0x18')]?_['map'](_0x31e5a9['include'],function(_0x2cdbbf){return{'model':db[_0x2cdbbf[_0xef1a('0x1a')]],'as':_0x2cdbbf['as'],'attributes':_0x2cdbbf['attributes'],'include':_0x2cdbbf[_0xef1a('0x18')]?_[_0xef1a('0x1b')](_0x2cdbbf['include'],function(_0x1f9c7f){return{'model':db[_0x1f9c7f[_0xef1a('0x1a')]],'as':_0x1f9c7f['as'],'attributes':_0x1f9c7f[_0xef1a('0x19')]};}):[]};}):[]};}):[]:[]})[_0xef1a('0x9')](function(_0xe3bd4){logger[_0xef1a('0x1c')]('GetSugarcrmAccount',_0x4e927b);logger[_0xef1a('0xc')](_0xef1a('0x12'),_0x4e927b,JSON['stringify'](_0xe3bd4));_0x110a9f(_0xe3bd4);})[_0xef1a('0x11')](function(_0x5adbc2){logger[_0xef1a('0xe')](_0xef1a('0x12'),_0x5adbc2['message'],_0x4e927b);_0x1cceb7(_0x3c189b[_0xef1a('0xe')](0x1f4,_0x5adbc2['message']));});});};exports[_0xef1a('0x1d')]=function(_0x1510c0){var _0x46cfd2=this;return new Promise(function(_0x3c2487,_0xa83471){return db['SugarcrmAccount'][_0xef1a('0x1e')]({'raw':_0x1510c0['options']?_0x1510c0[_0xef1a('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x1510c0[_0xef1a('0x14')]?_0x1510c0[_0xef1a('0x14')][_0xef1a('0x16')]||null:null,'attributes':_0x1510c0[_0xef1a('0x14')]?_0x1510c0[_0xef1a('0x14')][_0xef1a('0x19')]||null:null,'include':_0x1510c0[_0xef1a('0x14')]?_0x1510c0[_0xef1a('0x14')][_0xef1a('0x18')]?_[_0xef1a('0x1b')](_0x1510c0[_0xef1a('0x14')][_0xef1a('0x18')],function(_0x3359eb){return{'model':db[_0x3359eb[_0xef1a('0x1a')]],'as':_0x3359eb['as'],'attributes':_0x3359eb[_0xef1a('0x19')],'include':_0x3359eb[_0xef1a('0x18')]?_[_0xef1a('0x1b')](_0x3359eb[_0xef1a('0x18')],function(_0x26e63f){return{'model':db[_0x26e63f[_0xef1a('0x1a')]],'as':_0x26e63f['as'],'attributes':_0x26e63f[_0xef1a('0x19')],'include':_0x26e63f['include']?_['map'](_0x26e63f[_0xef1a('0x18')],function(_0x1819d9){return{'model':db[_0x1819d9[_0xef1a('0x1a')]],'as':_0x1819d9['as'],'attributes':_0x1819d9[_0xef1a('0x19')]};}):[]};}):[]};}):[]:[]})[_0xef1a('0x9')](function(_0x550c65){logger[_0xef1a('0x1c')](_0xef1a('0x1d'),_0x1510c0);logger[_0xef1a('0xc')](_0xef1a('0x1d'),_0x1510c0,JSON[_0xef1a('0xd')](_0x550c65));_0x3c2487(_0x550c65);})['catch'](function(_0x29cb6){logger[_0xef1a('0xe')](_0xef1a('0x1d'),_0x29cb6[_0xef1a('0xf')],_0x1510c0);_0xa83471(_0x46cfd2[_0xef1a('0xe')](0x1f4,_0x29cb6[_0xef1a('0xf')]));});});}; \ No newline at end of file +var _0x46e9=['util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SugarcrmAccount,\x20%s,\x20%s','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetSugarcrmAccount','SugarcrmAccount','options','raw','limit','include','model','attributes','map','then','debug','catch','where','ShowSugarcrmAccount','lodash'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x46e9,0x68));var _0x946e=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x46e9[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x946e('0x0'));var util=require(_0x946e('0x1'));var moment=require(_0x946e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x946e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x946e('0x4'));var logger=require(_0x946e('0x5'))(_0x946e('0x6'));var config=require(_0x946e('0x7'));var jayson=require(_0x946e('0x8'));var client=jayson[_0x946e('0x9')][_0x946e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x91f1d8,_0x43dfe4,_0x240367){return new BPromise(function(_0x203644,_0x54b940){return client[_0x946e('0xb')](_0x91f1d8,_0x240367)['then'](function(_0x179f65){logger[_0x946e('0xc')](_0x946e('0xd'),_0x43dfe4,'request\x20sent');logger['debug'](_0x946e('0xe'),_0x43dfe4,_0x946e('0xf'),JSON[_0x946e('0x10')](_0x179f65));if(_0x179f65[_0x946e('0x11')]){if(_0x179f65['error'][_0x946e('0x12')]===0x1f4){logger[_0x946e('0x11')](_0x946e('0xd'),_0x43dfe4,_0x179f65[_0x946e('0x11')][_0x946e('0x13')]);return _0x54b940(_0x179f65['error'][_0x946e('0x13')]);}logger[_0x946e('0x11')](_0x946e('0xd'),_0x43dfe4,_0x179f65[_0x946e('0x11')]['message']);return _0x203644(_0x179f65[_0x946e('0x11')][_0x946e('0x13')]);}else{logger[_0x946e('0xc')](_0x946e('0xd'),_0x43dfe4,_0x946e('0xf'));_0x203644(_0x179f65[_0x946e('0x14')][_0x946e('0x13')]);}})['catch'](function(_0x714dd1){logger[_0x946e('0x11')](_0x946e('0xd'),_0x43dfe4,_0x714dd1);_0x54b940(_0x714dd1);});});}exports[_0x946e('0x15')]=function(_0x104b94){var _0x68309f=this;return new Promise(function(_0x2e513d,_0x27da8f){return db[_0x946e('0x16')]['findAll']({'raw':_0x104b94[_0x946e('0x17')]?_0x104b94['options'][_0x946e('0x18')]===undefined?!![]:![]:!![],'where':_0x104b94[_0x946e('0x17')]?_0x104b94[_0x946e('0x17')]['where']||null:null,'attributes':_0x104b94[_0x946e('0x17')]?_0x104b94[_0x946e('0x17')]['attributes']||null:null,'limit':_0x104b94['options']?_0x104b94['options'][_0x946e('0x19')]||null:null,'include':_0x104b94[_0x946e('0x17')]?_0x104b94['options'][_0x946e('0x1a')]?_['map'](_0x104b94[_0x946e('0x17')]['include'],function(_0x2afd65){return{'model':db[_0x2afd65[_0x946e('0x1b')]],'as':_0x2afd65['as'],'attributes':_0x2afd65[_0x946e('0x1c')],'include':_0x2afd65[_0x946e('0x1a')]?_[_0x946e('0x1d')](_0x2afd65['include'],function(_0x2df878){return{'model':db[_0x2df878['model']],'as':_0x2df878['as'],'attributes':_0x2df878[_0x946e('0x1c')],'include':_0x2df878[_0x946e('0x1a')]?_[_0x946e('0x1d')](_0x2df878['include'],function(_0x3dbaaf){return{'model':db[_0x3dbaaf[_0x946e('0x1b')]],'as':_0x3dbaaf['as'],'attributes':_0x3dbaaf['attributes']};}):[]};}):[]};}):[]:[]})[_0x946e('0x1e')](function(_0xd34246){logger[_0x946e('0xc')](_0x946e('0x15'),_0x104b94);logger[_0x946e('0x1f')]('GetSugarcrmAccount',_0x104b94,JSON['stringify'](_0xd34246));_0x2e513d(_0xd34246);})[_0x946e('0x20')](function(_0x388cde){logger['error'](_0x946e('0x15'),_0x388cde[_0x946e('0x13')],_0x104b94);_0x27da8f(_0x68309f[_0x946e('0x11')](0x1f4,_0x388cde[_0x946e('0x13')]));});});};exports['ShowSugarcrmAccount']=function(_0x353ae9){var _0x1d63c8=this;return new Promise(function(_0xc03d35,_0x58050b){return db['SugarcrmAccount']['find']({'raw':_0x353ae9[_0x946e('0x17')]?_0x353ae9[_0x946e('0x17')][_0x946e('0x18')]===undefined?!![]:![]:!![],'where':_0x353ae9[_0x946e('0x17')]?_0x353ae9[_0x946e('0x17')][_0x946e('0x21')]||null:null,'attributes':_0x353ae9[_0x946e('0x17')]?_0x353ae9[_0x946e('0x17')][_0x946e('0x1c')]||null:null,'include':_0x353ae9[_0x946e('0x17')]?_0x353ae9[_0x946e('0x17')][_0x946e('0x1a')]?_[_0x946e('0x1d')](_0x353ae9[_0x946e('0x17')]['include'],function(_0x463876){return{'model':db[_0x463876[_0x946e('0x1b')]],'as':_0x463876['as'],'attributes':_0x463876[_0x946e('0x1c')],'include':_0x463876[_0x946e('0x1a')]?_[_0x946e('0x1d')](_0x463876[_0x946e('0x1a')],function(_0x21cd8b){return{'model':db[_0x21cd8b[_0x946e('0x1b')]],'as':_0x21cd8b['as'],'attributes':_0x21cd8b[_0x946e('0x1c')],'include':_0x21cd8b['include']?_['map'](_0x21cd8b[_0x946e('0x1a')],function(_0x58928f){return{'model':db[_0x58928f[_0x946e('0x1b')]],'as':_0x58928f['as'],'attributes':_0x58928f['attributes']};}):[]};}):[]};}):[]:[]})[_0x946e('0x1e')](function(_0x321300){logger['info'](_0x946e('0x22'),_0x353ae9);logger[_0x946e('0x1f')](_0x946e('0x22'),_0x353ae9,JSON['stringify'](_0x321300));_0xc03d35(_0x321300);})[_0x946e('0x20')](function(_0xebec17){logger[_0x946e('0x11')](_0x946e('0x22'),_0xebec17[_0x946e('0x13')],_0x353ae9);_0x58050b(_0x1d63c8[_0x946e('0x11')](0x1f4,_0xebec17[_0x946e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 0304e16..aec0f3d 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 _0x1209=['/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','connect-timeout','express','../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index'];(function(_0x2eab2b,_0x2b09c0){var _0x4f9aad=function(_0x22f349){while(--_0x22f349){_0x2eab2b['push'](_0x2eab2b['shift']());}};_0x4f9aad(++_0x2b09c0);}(_0x1209,0x15f));var _0x9120=function(_0x3b71a9,_0x3baa89){_0x3b71a9=_0x3b71a9-0x0;var _0x2bfea9=_0x1209[_0x3b71a9];return _0x2bfea9;};'use strict';var multer=require(_0x9120('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9120('0x1'));var express=require(_0x9120('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9120('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x9120('0x4'));var controller=require(_0x9120('0x5'));router[_0x9120('0x6')]('/',auth[_0x9120('0x7')](),controller[_0x9120('0x8')]);router['get'](_0x9120('0x9'),auth[_0x9120('0x7')](),controller[_0x9120('0xa')]);router['get'](_0x9120('0xb'),auth[_0x9120('0x7')](),controller[_0x9120('0xc')]);router[_0x9120('0x6')](_0x9120('0xd'),auth[_0x9120('0x7')](),controller[_0x9120('0xe')]);router[_0x9120('0x6')](_0x9120('0xf'),auth['isAuthenticated'](),controller[_0x9120('0x10')]);router[_0x9120('0x11')]('/',auth[_0x9120('0x7')](),controller[_0x9120('0x12')]);router[_0x9120('0x13')]('/:id',auth[_0x9120('0x7')](),controller[_0x9120('0x14')]);router[_0x9120('0x15')](_0x9120('0x9'),auth['isAuthenticated'](),controller[_0x9120('0x16')]);module[_0x9120('0x17')]=router; \ No newline at end of file +var _0xd772=['get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','delete','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xd772,0x1c4));var _0x2d77=function(_0x3eb9eb,_0x212975){_0x3eb9eb=_0x3eb9eb-0x0;var _0x2a02f8=_0xd772[_0x3eb9eb];return _0x2a02f8;};'use strict';var multer=require('multer');var util=require(_0x2d77('0x0'));var path=require(_0x2d77('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2d77('0x2')]();var fs_extra=require(_0x2d77('0x3'));var auth=require(_0x2d77('0x4'));var interaction=require(_0x2d77('0x5'));var config=require(_0x2d77('0x6'));var controller=require(_0x2d77('0x7'));router[_0x2d77('0x8')]('/',auth[_0x2d77('0x9')](),controller[_0x2d77('0xa')]);router[_0x2d77('0x8')](_0x2d77('0xb'),auth[_0x2d77('0x9')](),controller['show']);router[_0x2d77('0x8')](_0x2d77('0xc'),auth[_0x2d77('0x9')](),controller[_0x2d77('0xd')]);router[_0x2d77('0x8')](_0x2d77('0xe'),auth[_0x2d77('0x9')](),controller['getSubjects']);router[_0x2d77('0x8')](_0x2d77('0xf'),auth[_0x2d77('0x9')](),controller[_0x2d77('0x10')]);router[_0x2d77('0x11')]('/',auth['isAuthenticated'](),controller[_0x2d77('0x12')]);router['put'](_0x2d77('0xb'),auth[_0x2d77('0x9')](),controller['update']);router[_0x2d77('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index f23262b..a67d744 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 _0x6a1f=['sequelize','STRING'];(function(_0x2b2f88,_0x3a3639){var _0x464c0a=function(_0x38d7ff){while(--_0x38d7ff){_0x2b2f88['push'](_0x2b2f88['shift']());}};_0x464c0a(++_0x3a3639);}(_0x6a1f,0x16e));var _0xf6a1=function(_0x5d61a7,_0x12738f){_0x5d61a7=_0x5d61a7-0x0;var _0x51bc1d=_0x6a1f[_0x5d61a7];return _0x51bc1d;};'use strict';var Sequelize=require(_0xf6a1('0x0'));module['exports']={'name':{'type':Sequelize[_0xf6a1('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc61f=['STRING','exports'];(function(_0x3ae3aa,_0x546b22){var _0x3a11ff=function(_0x2ad97d){while(--_0x2ad97d){_0x3ae3aa['push'](_0x3ae3aa['shift']());}};_0x3a11ff(++_0x546b22);}(_0xc61f,0x17b));var _0xfc61=function(_0x322f5d,_0x104c4d){_0x322f5d=_0x322f5d-0x0;var _0xec353b=_0xc61f[_0x322f5d];return _0xec353b;};'use strict';var Sequelize=require('sequelize');module[_0xfc61('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xfc61('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index a1f0666..3ac84fd 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 _0xf828=['nolimit','order','sort','where','pick','filter','merge','VIRTUAL','SugarcrmConfiguration','count','includeAll','include','findAll','catch','show','params','keys','length','options','find','create','body','destroy','getFields','findOne','SugarcrmField','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','set','Content-Range','json','apply','reject','save','then','stack','name','send','map','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','hasOwnProperty'];(function(_0x1aef24,_0x1f1c07){var _0xe2626d=function(_0x43a953){while(--_0x43a953){_0x1aef24['push'](_0x1aef24['shift']());}};_0xe2626d(++_0x1f1c07);}(_0xf828,0x6a));var _0x8f82=function(_0x3dba3a,_0x72e6e8){_0x3dba3a=_0x3dba3a-0x0;var _0x2981f0=_0xf828[_0x3dba3a];return _0x2981f0;};'use strict';var emlformat=require(_0x8f82('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8f82('0x1'));var jsonpatch=require(_0x8f82('0x2'));var rp=require(_0x8f82('0x3'));var moment=require(_0x8f82('0x4'));var BPromise=require(_0x8f82('0x5'));var Mustache=require('mustache');var util=require(_0x8f82('0x6'));var path=require('path');var sox=require(_0x8f82('0x7'));var csv=require('to-csv');var ejs=require(_0x8f82('0x8'));var fs=require('fs');var fs_extra=require(_0x8f82('0x9'));var _=require(_0x8f82('0xa'));var squel=require(_0x8f82('0xb'));var crypto=require('crypto');var jsforce=require(_0x8f82('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8f82('0xd'));var querystring=require('querystring');var Papa=require(_0x8f82('0xe'));var Redis=require(_0x8f82('0xf'));var authService=require(_0x8f82('0x10'));var qs=require(_0x8f82('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8f82('0x12'));var logger=require(_0x8f82('0x13'))('api');var utils=require(_0x8f82('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x8f82('0x15'));var db=require(_0x8f82('0x16'))['db'];function respondWithStatusCode(_0x185383,_0x4dbaf2){_0x4dbaf2=_0x4dbaf2||0xcc;return function(_0x49bcc1){if(_0x49bcc1){return _0x185383[_0x8f82('0x17')](_0x4dbaf2);}return _0x185383[_0x8f82('0x18')](_0x4dbaf2)[_0x8f82('0x19')]();};}function respondWithResult(_0x1a42a7,_0x1c54ad){_0x1c54ad=_0x1c54ad||0xc8;return function(_0x3cf02d){if(_0x3cf02d){return _0x1a42a7['status'](_0x1c54ad)['json'](_0x3cf02d);}};}function respondWithFilteredResult(_0x373557,_0x68926b){return function(_0x4e6e8b){if(_0x4e6e8b){var _0x1d84b1=typeof _0x68926b[_0x8f82('0x1a')]==='undefined'&&typeof _0x68926b[_0x8f82('0x1b')]===_0x8f82('0x1c');var _0x5e8a82=_0x4e6e8b['count'];var _0x4de308=_0x1d84b1?0x0:_0x68926b[_0x8f82('0x1a')];var _0x246dd0=_0x1d84b1?_0x4e6e8b['count']:_0x68926b[_0x8f82('0x1a')]+_0x68926b[_0x8f82('0x1b')];var _0x5c9f70;if(_0x246dd0>=_0x5e8a82){_0x246dd0=_0x5e8a82;_0x5c9f70=0xc8;}else{_0x5c9f70=0xce;}_0x373557[_0x8f82('0x18')](_0x5c9f70);return _0x373557[_0x8f82('0x1d')](_0x8f82('0x1e'),_0x4de308+'-'+_0x246dd0+'/'+_0x5e8a82)[_0x8f82('0x1f')](_0x4e6e8b);}return null;};}function patchUpdates(_0x202778){return function(_0x2c0587){try{jsonpatch[_0x8f82('0x20')](_0x2c0587,_0x202778,!![]);}catch(_0x4aec7d){return BPromise[_0x8f82('0x21')](_0x4aec7d);}return _0x2c0587[_0x8f82('0x22')]();};}function saveUpdates(_0x4edfcf,_0x428215){return function(_0x271180){if(_0x271180){return _0x271180['update'](_0x4edfcf)['then'](function(_0x450d0e){return _0x450d0e;});}return null;};}function removeEntity(_0x14543b,_0x455c2e){return function(_0x4407af){if(_0x4407af){return _0x4407af['destroy']()[_0x8f82('0x23')](function(){_0x14543b[_0x8f82('0x18')](0xcc)[_0x8f82('0x19')]();});}};}function handleEntityNotFound(_0x2757c8,_0x4a0d05){return function(_0x342c48){if(!_0x342c48){_0x2757c8[_0x8f82('0x17')](0x194);}return _0x342c48;};}function handleError(_0x9fac87,_0x2171ee){_0x2171ee=_0x2171ee||0x1f4;return function(_0x59c088){logger['error'](_0x59c088[_0x8f82('0x24')]);if(_0x59c088[_0x8f82('0x25')]){delete _0x59c088[_0x8f82('0x25')];}_0x9fac87[_0x8f82('0x18')](_0x2171ee)[_0x8f82('0x26')](_0x59c088);};}exports['index']=function(_0x326c84,_0x172d8f){var _0x3c7eb3={},_0x3ffe8c={},_0x5e64ea={'count':0x0,'rows':[]};var _0x4d6a5a=_[_0x8f82('0x27')](db['SugarcrmConfiguration'][_0x8f82('0x28')],function(_0x162c1c){return{'name':_0x162c1c[_0x8f82('0x29')],'type':_0x162c1c[_0x8f82('0x2a')]['key']};});_0x3ffe8c[_0x8f82('0x2b')]=_[_0x8f82('0x27')](_0x4d6a5a,_0x8f82('0x25'));_0x3ffe8c[_0x8f82('0x2c')]=_['keys'](_0x326c84['query']);_0x3ffe8c[_0x8f82('0x2d')]=_[_0x8f82('0x2e')](_0x3ffe8c[_0x8f82('0x2b')],_0x3ffe8c[_0x8f82('0x2c')]);_0x3c7eb3['attributes']=_[_0x8f82('0x2e')](_0x3ffe8c['model'],qs[_0x8f82('0x2f')](_0x326c84[_0x8f82('0x2c')][_0x8f82('0x2f')]));_0x3c7eb3[_0x8f82('0x30')]=_0x3c7eb3[_0x8f82('0x30')]['length']?_0x3c7eb3[_0x8f82('0x30')]:_0x3ffe8c[_0x8f82('0x2b')];if(!_0x326c84[_0x8f82('0x2c')][_0x8f82('0x31')](_0x8f82('0x32'))){_0x3c7eb3[_0x8f82('0x1b')]=qs['limit'](_0x326c84[_0x8f82('0x2c')][_0x8f82('0x1b')]);_0x3c7eb3[_0x8f82('0x1a')]=qs[_0x8f82('0x1a')](_0x326c84[_0x8f82('0x2c')]['offset']);}_0x3c7eb3[_0x8f82('0x33')]=qs['sort'](_0x326c84['query'][_0x8f82('0x34')]);_0x3c7eb3[_0x8f82('0x35')]=qs[_0x8f82('0x2d')](_[_0x8f82('0x36')](_0x326c84['query'],_0x3ffe8c[_0x8f82('0x2d')]),_0x4d6a5a);if(_0x326c84['query'][_0x8f82('0x37')]){_0x3c7eb3[_0x8f82('0x35')]=_[_0x8f82('0x38')](_0x3c7eb3[_0x8f82('0x35')],{'$or':_[_0x8f82('0x27')](_0x4d6a5a,function(_0x266f04){if(_0x266f04[_0x8f82('0x2a')]!==_0x8f82('0x39')){var _0x4b62a5={};_0x4b62a5[_0x266f04[_0x8f82('0x25')]]={'$like':'%'+_0x326c84['query'][_0x8f82('0x37')]+'%'};return _0x4b62a5;}})});}_0x3c7eb3=_[_0x8f82('0x38')]({},_0x3c7eb3,_0x326c84['options']);var _0x1c385d={'where':_0x3c7eb3['where']};return db[_0x8f82('0x3a')][_0x8f82('0x3b')](_0x1c385d)[_0x8f82('0x23')](function(_0x4324d6){_0x5e64ea[_0x8f82('0x3b')]=_0x4324d6;if(_0x326c84[_0x8f82('0x2c')][_0x8f82('0x3c')]){_0x3c7eb3[_0x8f82('0x3d')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x8f82('0x3e')](_0x3c7eb3);})['then'](function(_0x2d9fc0){_0x5e64ea['rows']=_0x2d9fc0;return _0x5e64ea;})[_0x8f82('0x23')](respondWithFilteredResult(_0x172d8f,_0x3c7eb3))[_0x8f82('0x3f')](handleError(_0x172d8f,null));};exports[_0x8f82('0x40')]=function(_0x5ddb81,_0x86fbb3){var _0x3f2f67={'raw':![],'where':{'id':_0x5ddb81[_0x8f82('0x41')]['id']}},_0x3cac15={};_0x3cac15[_0x8f82('0x2b')]=_[_0x8f82('0x42')](db['SugarcrmConfiguration'][_0x8f82('0x28')]);_0x3cac15[_0x8f82('0x2c')]=_['keys'](_0x5ddb81[_0x8f82('0x2c')]);_0x3cac15['filters']=_[_0x8f82('0x2e')](_0x3cac15[_0x8f82('0x2b')],_0x3cac15[_0x8f82('0x2c')]);_0x3f2f67['attributes']=_[_0x8f82('0x2e')](_0x3cac15[_0x8f82('0x2b')],qs[_0x8f82('0x2f')](_0x5ddb81[_0x8f82('0x2c')]['fields']));_0x3f2f67[_0x8f82('0x30')]=_0x3f2f67['attributes'][_0x8f82('0x43')]?_0x3f2f67['attributes']:_0x3cac15['model'];if(_0x5ddb81[_0x8f82('0x2c')][_0x8f82('0x3c')]){_0x3f2f67[_0x8f82('0x3d')]=[{'all':!![]}];}_0x3f2f67=_[_0x8f82('0x38')]({},_0x3f2f67,_0x5ddb81[_0x8f82('0x44')]);return db[_0x8f82('0x3a')][_0x8f82('0x45')](_0x3f2f67)[_0x8f82('0x23')](handleEntityNotFound(_0x86fbb3,null))['then'](respondWithResult(_0x86fbb3,null))[_0x8f82('0x3f')](handleError(_0x86fbb3,null));};exports[_0x8f82('0x46')]=function(_0x29c51b,_0x5a136f){return db[_0x8f82('0x3a')][_0x8f82('0x46')](_0x29c51b[_0x8f82('0x47')],{})[_0x8f82('0x23')](respondWithResult(_0x5a136f,0xc9))[_0x8f82('0x3f')](handleError(_0x5a136f,null));};exports['update']=function(_0x1c8cda,_0x22210d){if(_0x1c8cda[_0x8f82('0x47')]['id']){delete _0x1c8cda[_0x8f82('0x47')]['id'];}return db[_0x8f82('0x3a')][_0x8f82('0x45')]({'where':{'id':_0x1c8cda[_0x8f82('0x41')]['id']}})[_0x8f82('0x23')](handleEntityNotFound(_0x22210d,null))[_0x8f82('0x23')](saveUpdates(_0x1c8cda['body'],null))['then'](respondWithResult(_0x22210d,null))[_0x8f82('0x3f')](handleError(_0x22210d,null));};exports[_0x8f82('0x48')]=function(_0x57c0b7,_0x31583c){return db[_0x8f82('0x3a')][_0x8f82('0x45')]({'where':{'id':_0x57c0b7['params']['id']}})[_0x8f82('0x23')](handleEntityNotFound(_0x31583c,null))[_0x8f82('0x23')](removeEntity(_0x31583c,null))['catch'](handleError(_0x31583c,null));};exports[_0x8f82('0x49')]=function(_0x374cdf,_0xf8e557,_0x10b6f0){var _0x55a87a={};var _0x232135={};var _0x78b29f;var _0x49c7d9;return db['SugarcrmConfiguration'][_0x8f82('0x4a')]({'where':{'id':_0x374cdf['params']['id']}})['then'](handleEntityNotFound(_0xf8e557,null))['then'](function(_0x55d3cf){if(_0x55d3cf){_0x78b29f=_0x55d3cf;_0x232135[_0x8f82('0x2b')]=_[_0x8f82('0x42')](db[_0x8f82('0x4b')][_0x8f82('0x28')]);_0x232135[_0x8f82('0x2c')]=_['keys'](_0x374cdf['query']);_0x232135[_0x8f82('0x2d')]=_[_0x8f82('0x2e')](_0x232135['model'],_0x232135['query']);_0x55a87a['attributes']=_[_0x8f82('0x2e')](_0x232135['model'],qs[_0x8f82('0x2f')](_0x374cdf[_0x8f82('0x2c')]['fields']));_0x55a87a[_0x8f82('0x30')]=_0x55a87a['attributes'][_0x8f82('0x43')]?_0x55a87a['attributes']:_0x232135[_0x8f82('0x2b')];_0x55a87a[_0x8f82('0x33')]=qs[_0x8f82('0x34')](_0x374cdf['query']['sort']);_0x55a87a[_0x8f82('0x35')]=qs[_0x8f82('0x2d')](_['pick'](_0x374cdf[_0x8f82('0x2c')],_0x232135['filters']));if(_0x374cdf[_0x8f82('0x2c')][_0x8f82('0x37')]){_0x55a87a[_0x8f82('0x35')]=_[_0x8f82('0x38')](_0x55a87a[_0x8f82('0x35')],{'$or':_['map'](_0x55a87a['attributes'],function(_0x289db0){var _0x5a87e9={};_0x5a87e9[_0x289db0]={'$like':'%'+_0x374cdf[_0x8f82('0x2c')][_0x8f82('0x37')]+'%'};return _0x5a87e9;})});}_0x55a87a=_[_0x8f82('0x38')]({},_0x55a87a,_0x374cdf[_0x8f82('0x44')]);return _0x78b29f['getFields'](_0x55a87a);}})['then'](function(_0x4bb49e){if(_0x4bb49e){_0x49c7d9=_0x4bb49e[_0x8f82('0x43')];if(!_0x374cdf['query']['hasOwnProperty'](_0x8f82('0x32'))){_0x55a87a[_0x8f82('0x1b')]=qs[_0x8f82('0x1b')](_0x374cdf[_0x8f82('0x2c')][_0x8f82('0x1b')]);_0x55a87a['offset']=qs[_0x8f82('0x1a')](_0x374cdf[_0x8f82('0x2c')][_0x8f82('0x1a')]);}return _0x78b29f[_0x8f82('0x49')](_0x55a87a);}})[_0x8f82('0x23')](function(_0x3e3bf1){if(_0x3e3bf1){return _0x3e3bf1?{'count':_0x49c7d9,'rows':_0x3e3bf1}:null;}})[_0x8f82('0x23')](respondWithResult(_0xf8e557,null))[_0x8f82('0x3f')](handleError(_0xf8e557,null));};exports[_0x8f82('0x4c')]=function(_0x2a0788,_0x2d8251,_0x35cb73){var _0x47ab98={};var _0x2131e9={};var _0x480102;var _0x14c053;return db[_0x8f82('0x3a')][_0x8f82('0x4a')]({'where':{'id':_0x2a0788['params']['id']}})[_0x8f82('0x23')](handleEntityNotFound(_0x2d8251,null))['then'](function(_0x44c4c7){if(_0x44c4c7){_0x480102=_0x44c4c7;_0x2131e9['model']=_[_0x8f82('0x42')](db['SugarcrmField'][_0x8f82('0x28')]);_0x2131e9[_0x8f82('0x2c')]=_['keys'](_0x2a0788['query']);_0x2131e9['filters']=_['intersection'](_0x2131e9[_0x8f82('0x2b')],_0x2131e9[_0x8f82('0x2c')]);_0x47ab98[_0x8f82('0x30')]=_['intersection'](_0x2131e9[_0x8f82('0x2b')],qs['fields'](_0x2a0788[_0x8f82('0x2c')][_0x8f82('0x2f')]));_0x47ab98[_0x8f82('0x30')]=_0x47ab98[_0x8f82('0x30')][_0x8f82('0x43')]?_0x47ab98[_0x8f82('0x30')]:_0x2131e9[_0x8f82('0x2b')];_0x47ab98[_0x8f82('0x33')]=qs[_0x8f82('0x34')](_0x2a0788[_0x8f82('0x2c')][_0x8f82('0x34')]);_0x47ab98['where']=qs[_0x8f82('0x2d')](_[_0x8f82('0x36')](_0x2a0788[_0x8f82('0x2c')],_0x2131e9[_0x8f82('0x2d')]));if(_0x2a0788[_0x8f82('0x2c')]['filter']){_0x47ab98['where']=_[_0x8f82('0x38')](_0x47ab98[_0x8f82('0x35')],{'$or':_[_0x8f82('0x27')](_0x47ab98['attributes'],function(_0x35048d){var _0x54fad0={};_0x54fad0[_0x35048d]={'$like':'%'+_0x2a0788[_0x8f82('0x2c')][_0x8f82('0x37')]+'%'};return _0x54fad0;})});}_0x47ab98=_[_0x8f82('0x38')]({},_0x47ab98,_0x2a0788[_0x8f82('0x44')]);return _0x480102[_0x8f82('0x4c')](_0x47ab98);}})[_0x8f82('0x23')](function(_0x185aaf){if(_0x185aaf){_0x14c053=_0x185aaf[_0x8f82('0x43')];if(!_0x2a0788[_0x8f82('0x2c')][_0x8f82('0x31')]('nolimit')){_0x47ab98[_0x8f82('0x1b')]=qs['limit'](_0x2a0788[_0x8f82('0x2c')][_0x8f82('0x1b')]);_0x47ab98[_0x8f82('0x1a')]=qs[_0x8f82('0x1a')](_0x2a0788[_0x8f82('0x2c')]['offset']);}return _0x480102[_0x8f82('0x4c')](_0x47ab98);}})[_0x8f82('0x23')](function(_0x5d1868){if(_0x5d1868){return _0x5d1868?{'count':_0x14c053,'rows':_0x5d1868}:null;}})['then'](respondWithResult(_0x2d8251,null))['catch'](handleError(_0x2d8251,null));};exports[_0x8f82('0x4d')]=function(_0xf0a09c,_0x31e1be,_0x1de8cd){var _0x4484ff={};var _0x5d8457={};var _0x155dac;var _0x4277cb;return db[_0x8f82('0x3a')]['findOne']({'where':{'id':_0xf0a09c[_0x8f82('0x41')]['id']}})[_0x8f82('0x23')](handleEntityNotFound(_0x31e1be,null))[_0x8f82('0x23')](function(_0x215fe7){if(_0x215fe7){_0x155dac=_0x215fe7;_0x5d8457[_0x8f82('0x2b')]=_[_0x8f82('0x42')](db['SugarcrmField'][_0x8f82('0x28')]);_0x5d8457['query']=_[_0x8f82('0x42')](_0xf0a09c['query']);_0x5d8457[_0x8f82('0x2d')]=_[_0x8f82('0x2e')](_0x5d8457[_0x8f82('0x2b')],_0x5d8457[_0x8f82('0x2c')]);_0x4484ff[_0x8f82('0x30')]=_[_0x8f82('0x2e')](_0x5d8457[_0x8f82('0x2b')],qs[_0x8f82('0x2f')](_0xf0a09c[_0x8f82('0x2c')][_0x8f82('0x2f')]));_0x4484ff[_0x8f82('0x30')]=_0x4484ff[_0x8f82('0x30')][_0x8f82('0x43')]?_0x4484ff[_0x8f82('0x30')]:_0x5d8457['model'];_0x4484ff['order']=qs['sort'](_0xf0a09c['query'][_0x8f82('0x34')]);_0x4484ff[_0x8f82('0x35')]=qs[_0x8f82('0x2d')](_[_0x8f82('0x36')](_0xf0a09c[_0x8f82('0x2c')],_0x5d8457['filters']));if(_0xf0a09c['query']['filter']){_0x4484ff[_0x8f82('0x35')]=_[_0x8f82('0x38')](_0x4484ff[_0x8f82('0x35')],{'$or':_[_0x8f82('0x27')](_0x4484ff[_0x8f82('0x30')],function(_0x1ae064){var _0x1bdfdb={};_0x1bdfdb[_0x1ae064]={'$like':'%'+_0xf0a09c[_0x8f82('0x2c')][_0x8f82('0x37')]+'%'};return _0x1bdfdb;})});}_0x4484ff=_[_0x8f82('0x38')]({},_0x4484ff,_0xf0a09c[_0x8f82('0x44')]);return _0x155dac[_0x8f82('0x4d')](_0x4484ff);}})[_0x8f82('0x23')](function(_0x138af7){if(_0x138af7){_0x4277cb=_0x138af7[_0x8f82('0x43')];if(!_0xf0a09c['query']['hasOwnProperty'](_0x8f82('0x32'))){_0x4484ff[_0x8f82('0x1b')]=qs[_0x8f82('0x1b')](_0xf0a09c['query'][_0x8f82('0x1b')]);_0x4484ff[_0x8f82('0x1a')]=qs[_0x8f82('0x1a')](_0xf0a09c['query'][_0x8f82('0x1a')]);}return _0x155dac['getDescriptions'](_0x4484ff);}})[_0x8f82('0x23')](function(_0x54e1e1){if(_0x54e1e1){return _0x54e1e1?{'count':_0x4277cb,'rows':_0x54e1e1}:null;}})[_0x8f82('0x23')](respondWithResult(_0x31e1be,null))['catch'](handleError(_0x31e1be,null));}; \ No newline at end of file +var _0xb99d=['send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','length','find','create','body','getFields','order','SugarcrmField','getSubjects','findOne','getDescriptions','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','stack','name'];(function(_0x121052,_0xd3535){var _0x57b922=function(_0xa361d8){while(--_0xa361d8){_0x121052['push'](_0x121052['shift']());}};_0x57b922(++_0xd3535);}(_0xb99d,0x1b3));var _0xdb99=function(_0x564ea1,_0x2be3fd){_0x564ea1=_0x564ea1-0x0;var _0x519a53=_0xb99d[_0x564ea1];return _0x519a53;};'use strict';var emlformat=require(_0xdb99('0x0'));var rimraf=require(_0xdb99('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdb99('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdb99('0x3'));var Mustache=require(_0xdb99('0x4'));var util=require(_0xdb99('0x5'));var path=require(_0xdb99('0x6'));var sox=require(_0xdb99('0x7'));var csv=require(_0xdb99('0x8'));var ejs=require(_0xdb99('0x9'));var fs=require('fs');var fs_extra=require(_0xdb99('0xa'));var _=require('lodash');var squel=require(_0xdb99('0xb'));var crypto=require('crypto');var jsforce=require(_0xdb99('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xdb99('0x8'));var querystring=require(_0xdb99('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdb99('0xe'));var qs=require(_0xdb99('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xdb99('0x10'))(_0xdb99('0x11'));var utils=require(_0xdb99('0x12'));var config=require(_0xdb99('0x13'));var licenseUtil=require(_0xdb99('0x14'));var db=require(_0xdb99('0x15'))['db'];function respondWithStatusCode(_0x289571,_0xa82e04){_0xa82e04=_0xa82e04||0xcc;return function(_0x199bed){if(_0x199bed){return _0x289571[_0xdb99('0x16')](_0xa82e04);}return _0x289571[_0xdb99('0x17')](_0xa82e04)[_0xdb99('0x18')]();};}function respondWithResult(_0x4e468f,_0x116eef){_0x116eef=_0x116eef||0xc8;return function(_0x365a60){if(_0x365a60){return _0x4e468f[_0xdb99('0x17')](_0x116eef)[_0xdb99('0x19')](_0x365a60);}};}function respondWithFilteredResult(_0x570160,_0x475577){return function(_0x556f5f){if(_0x556f5f){var _0x2042a6=typeof _0x475577['offset']===_0xdb99('0x1a')&&typeof _0x475577[_0xdb99('0x1b')]===_0xdb99('0x1a');var _0x1b9e48=_0x556f5f[_0xdb99('0x1c')];var _0x605df0=_0x2042a6?0x0:_0x475577[_0xdb99('0x1d')];var _0xb42ec5=_0x2042a6?_0x556f5f[_0xdb99('0x1c')]:_0x475577[_0xdb99('0x1d')]+_0x475577[_0xdb99('0x1b')];var _0x4f1b25;if(_0xb42ec5>=_0x1b9e48){_0xb42ec5=_0x1b9e48;_0x4f1b25=0xc8;}else{_0x4f1b25=0xce;}_0x570160[_0xdb99('0x17')](_0x4f1b25);return _0x570160[_0xdb99('0x1e')](_0xdb99('0x1f'),_0x605df0+'-'+_0xb42ec5+'/'+_0x1b9e48)[_0xdb99('0x19')](_0x556f5f);}return null;};}function patchUpdates(_0x50e283){return function(_0x42a673){try{jsonpatch['apply'](_0x42a673,_0x50e283,!![]);}catch(_0x10d555){return BPromise[_0xdb99('0x20')](_0x10d555);}return _0x42a673[_0xdb99('0x21')]();};}function saveUpdates(_0x46f470,_0x3d4f4a){return function(_0x9a4a91){if(_0x9a4a91){return _0x9a4a91[_0xdb99('0x22')](_0x46f470)[_0xdb99('0x23')](function(_0x44e7ff){return _0x44e7ff;});}return null;};}function removeEntity(_0x4f46fc,_0x497862){return function(_0x5b1f1f){if(_0x5b1f1f){return _0x5b1f1f[_0xdb99('0x24')]()['then'](function(){_0x4f46fc[_0xdb99('0x17')](0xcc)[_0xdb99('0x18')]();});}};}function handleEntityNotFound(_0x13a8c3,_0x1c81d7){return function(_0x1a98f6){if(!_0x1a98f6){_0x13a8c3['sendStatus'](0x194);}return _0x1a98f6;};}function handleError(_0x3910b6,_0x49a556){_0x49a556=_0x49a556||0x1f4;return function(_0x23ecba){logger['error'](_0x23ecba[_0xdb99('0x25')]);if(_0x23ecba[_0xdb99('0x26')]){delete _0x23ecba[_0xdb99('0x26')];}_0x3910b6[_0xdb99('0x17')](_0x49a556)[_0xdb99('0x27')](_0x23ecba);};}exports[_0xdb99('0x28')]=function(_0x1159a8,_0x47290f){var _0x187a14={},_0x1096e0={},_0x235849={'count':0x0,'rows':[]};var _0x136b9b=_[_0xdb99('0x29')](db[_0xdb99('0x2a')][_0xdb99('0x2b')],function(_0xa41592){return{'name':_0xa41592[_0xdb99('0x2c')],'type':_0xa41592[_0xdb99('0x2d')][_0xdb99('0x2e')]};});_0x1096e0[_0xdb99('0x2f')]=_[_0xdb99('0x29')](_0x136b9b,'name');_0x1096e0[_0xdb99('0x30')]=_['keys'](_0x1159a8[_0xdb99('0x30')]);_0x1096e0[_0xdb99('0x31')]=_['intersection'](_0x1096e0[_0xdb99('0x2f')],_0x1096e0['query']);_0x187a14[_0xdb99('0x32')]=_[_0xdb99('0x33')](_0x1096e0[_0xdb99('0x2f')],qs['fields'](_0x1159a8['query'][_0xdb99('0x34')]));_0x187a14[_0xdb99('0x32')]=_0x187a14['attributes']['length']?_0x187a14[_0xdb99('0x32')]:_0x1096e0[_0xdb99('0x2f')];if(!_0x1159a8[_0xdb99('0x30')][_0xdb99('0x35')](_0xdb99('0x36'))){_0x187a14[_0xdb99('0x1b')]=qs[_0xdb99('0x1b')](_0x1159a8[_0xdb99('0x30')][_0xdb99('0x1b')]);_0x187a14['offset']=qs[_0xdb99('0x1d')](_0x1159a8['query'][_0xdb99('0x1d')]);}_0x187a14['order']=qs[_0xdb99('0x37')](_0x1159a8['query'][_0xdb99('0x37')]);_0x187a14['where']=qs[_0xdb99('0x31')](_[_0xdb99('0x38')](_0x1159a8[_0xdb99('0x30')],_0x1096e0['filters']),_0x136b9b);if(_0x1159a8[_0xdb99('0x30')][_0xdb99('0x39')]){_0x187a14[_0xdb99('0x3a')]=_[_0xdb99('0x3b')](_0x187a14[_0xdb99('0x3a')],{'$or':_[_0xdb99('0x29')](_0x136b9b,function(_0x4ea70b){if(_0x4ea70b[_0xdb99('0x2d')]!==_0xdb99('0x3c')){var _0x3beba5={};_0x3beba5[_0x4ea70b[_0xdb99('0x26')]]={'$like':'%'+_0x1159a8[_0xdb99('0x30')]['filter']+'%'};return _0x3beba5;}})});}_0x187a14=_[_0xdb99('0x3b')]({},_0x187a14,_0x1159a8[_0xdb99('0x3d')]);var _0xbbea7={'where':_0x187a14[_0xdb99('0x3a')]};return db[_0xdb99('0x2a')][_0xdb99('0x1c')](_0xbbea7)[_0xdb99('0x23')](function(_0x19442f){_0x235849['count']=_0x19442f;if(_0x1159a8[_0xdb99('0x30')][_0xdb99('0x3e')]){_0x187a14[_0xdb99('0x3f')]=[{'all':!![]}];}return db[_0xdb99('0x2a')][_0xdb99('0x40')](_0x187a14);})[_0xdb99('0x23')](function(_0x1877b3){_0x235849[_0xdb99('0x41')]=_0x1877b3;return _0x235849;})[_0xdb99('0x23')](respondWithFilteredResult(_0x47290f,_0x187a14))[_0xdb99('0x42')](handleError(_0x47290f,null));};exports['show']=function(_0x2ed3ee,_0x5401a1){var _0x17b638={'raw':![],'where':{'id':_0x2ed3ee[_0xdb99('0x43')]['id']}},_0x52c9e1={};_0x52c9e1[_0xdb99('0x2f')]=_['keys'](db[_0xdb99('0x2a')][_0xdb99('0x2b')]);_0x52c9e1[_0xdb99('0x30')]=_[_0xdb99('0x44')](_0x2ed3ee[_0xdb99('0x30')]);_0x52c9e1[_0xdb99('0x31')]=_[_0xdb99('0x33')](_0x52c9e1['model'],_0x52c9e1[_0xdb99('0x30')]);_0x17b638[_0xdb99('0x32')]=_[_0xdb99('0x33')](_0x52c9e1[_0xdb99('0x2f')],qs[_0xdb99('0x34')](_0x2ed3ee[_0xdb99('0x30')][_0xdb99('0x34')]));_0x17b638[_0xdb99('0x32')]=_0x17b638['attributes'][_0xdb99('0x45')]?_0x17b638[_0xdb99('0x32')]:_0x52c9e1[_0xdb99('0x2f')];if(_0x2ed3ee[_0xdb99('0x30')][_0xdb99('0x3e')]){_0x17b638['include']=[{'all':!![]}];}_0x17b638=_[_0xdb99('0x3b')]({},_0x17b638,_0x2ed3ee['options']);return db[_0xdb99('0x2a')][_0xdb99('0x46')](_0x17b638)[_0xdb99('0x23')](handleEntityNotFound(_0x5401a1,null))[_0xdb99('0x23')](respondWithResult(_0x5401a1,null))[_0xdb99('0x42')](handleError(_0x5401a1,null));};exports[_0xdb99('0x47')]=function(_0x3a8e53,_0x12df2b){return db[_0xdb99('0x2a')][_0xdb99('0x47')](_0x3a8e53[_0xdb99('0x48')],{})['then'](respondWithResult(_0x12df2b,0xc9))[_0xdb99('0x42')](handleError(_0x12df2b,null));};exports[_0xdb99('0x22')]=function(_0x14cd11,_0x470f2d){if(_0x14cd11['body']['id']){delete _0x14cd11['body']['id'];}return db[_0xdb99('0x2a')]['find']({'where':{'id':_0x14cd11[_0xdb99('0x43')]['id']}})[_0xdb99('0x23')](handleEntityNotFound(_0x470f2d,null))[_0xdb99('0x23')](saveUpdates(_0x14cd11[_0xdb99('0x48')],null))[_0xdb99('0x23')](respondWithResult(_0x470f2d,null))[_0xdb99('0x42')](handleError(_0x470f2d,null));};exports[_0xdb99('0x24')]=function(_0x2517fb,_0x50cb4c){return db[_0xdb99('0x2a')][_0xdb99('0x46')]({'where':{'id':_0x2517fb[_0xdb99('0x43')]['id']}})[_0xdb99('0x23')](handleEntityNotFound(_0x50cb4c,null))[_0xdb99('0x23')](removeEntity(_0x50cb4c,null))['catch'](handleError(_0x50cb4c,null));};exports[_0xdb99('0x49')]=function(_0x196aa5,_0x300625,_0x208fd3){var _0x1d642c={};var _0x44c893={};var _0x368930;var _0x47cf79;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x196aa5[_0xdb99('0x43')]['id']}})[_0xdb99('0x23')](handleEntityNotFound(_0x300625,null))[_0xdb99('0x23')](function(_0x53c836){if(_0x53c836){_0x368930=_0x53c836;_0x44c893[_0xdb99('0x2f')]=_[_0xdb99('0x44')](db['SugarcrmField'][_0xdb99('0x2b')]);_0x44c893['query']=_[_0xdb99('0x44')](_0x196aa5[_0xdb99('0x30')]);_0x44c893[_0xdb99('0x31')]=_[_0xdb99('0x33')](_0x44c893[_0xdb99('0x2f')],_0x44c893[_0xdb99('0x30')]);_0x1d642c[_0xdb99('0x32')]=_['intersection'](_0x44c893[_0xdb99('0x2f')],qs[_0xdb99('0x34')](_0x196aa5[_0xdb99('0x30')][_0xdb99('0x34')]));_0x1d642c[_0xdb99('0x32')]=_0x1d642c[_0xdb99('0x32')]['length']?_0x1d642c[_0xdb99('0x32')]:_0x44c893[_0xdb99('0x2f')];_0x1d642c[_0xdb99('0x4a')]=qs[_0xdb99('0x37')](_0x196aa5[_0xdb99('0x30')][_0xdb99('0x37')]);_0x1d642c['where']=qs['filters'](_['pick'](_0x196aa5[_0xdb99('0x30')],_0x44c893[_0xdb99('0x31')]));if(_0x196aa5['query'][_0xdb99('0x39')]){_0x1d642c[_0xdb99('0x3a')]=_[_0xdb99('0x3b')](_0x1d642c['where'],{'$or':_[_0xdb99('0x29')](_0x1d642c[_0xdb99('0x32')],function(_0x453636){var _0x515dc6={};_0x515dc6[_0x453636]={'$like':'%'+_0x196aa5[_0xdb99('0x30')][_0xdb99('0x39')]+'%'};return _0x515dc6;})});}_0x1d642c=_[_0xdb99('0x3b')]({},_0x1d642c,_0x196aa5[_0xdb99('0x3d')]);return _0x368930[_0xdb99('0x49')](_0x1d642c);}})['then'](function(_0x4c37da){if(_0x4c37da){_0x47cf79=_0x4c37da[_0xdb99('0x45')];if(!_0x196aa5[_0xdb99('0x30')]['hasOwnProperty'](_0xdb99('0x36'))){_0x1d642c['limit']=qs['limit'](_0x196aa5['query'][_0xdb99('0x1b')]);_0x1d642c['offset']=qs[_0xdb99('0x1d')](_0x196aa5[_0xdb99('0x30')][_0xdb99('0x1d')]);}return _0x368930[_0xdb99('0x49')](_0x1d642c);}})[_0xdb99('0x23')](function(_0x5b4ba7){if(_0x5b4ba7){return _0x5b4ba7?{'count':_0x47cf79,'rows':_0x5b4ba7}:null;}})[_0xdb99('0x23')](respondWithResult(_0x300625,null))['catch'](handleError(_0x300625,null));};exports['getSubjects']=function(_0x68ff6a,_0x18d9ab,_0x4b4a4b){var _0x1a5ed5={};var _0x22c57b={};var _0x26fdca;var _0x1666f2;return db[_0xdb99('0x2a')]['findOne']({'where':{'id':_0x68ff6a[_0xdb99('0x43')]['id']}})[_0xdb99('0x23')](handleEntityNotFound(_0x18d9ab,null))[_0xdb99('0x23')](function(_0x421f6d){if(_0x421f6d){_0x26fdca=_0x421f6d;_0x22c57b['model']=_[_0xdb99('0x44')](db[_0xdb99('0x4b')][_0xdb99('0x2b')]);_0x22c57b['query']=_[_0xdb99('0x44')](_0x68ff6a[_0xdb99('0x30')]);_0x22c57b[_0xdb99('0x31')]=_[_0xdb99('0x33')](_0x22c57b[_0xdb99('0x2f')],_0x22c57b[_0xdb99('0x30')]);_0x1a5ed5[_0xdb99('0x32')]=_[_0xdb99('0x33')](_0x22c57b[_0xdb99('0x2f')],qs['fields'](_0x68ff6a[_0xdb99('0x30')]['fields']));_0x1a5ed5[_0xdb99('0x32')]=_0x1a5ed5[_0xdb99('0x32')][_0xdb99('0x45')]?_0x1a5ed5[_0xdb99('0x32')]:_0x22c57b['model'];_0x1a5ed5[_0xdb99('0x4a')]=qs[_0xdb99('0x37')](_0x68ff6a[_0xdb99('0x30')]['sort']);_0x1a5ed5['where']=qs[_0xdb99('0x31')](_[_0xdb99('0x38')](_0x68ff6a[_0xdb99('0x30')],_0x22c57b[_0xdb99('0x31')]));if(_0x68ff6a[_0xdb99('0x30')]['filter']){_0x1a5ed5[_0xdb99('0x3a')]=_[_0xdb99('0x3b')](_0x1a5ed5[_0xdb99('0x3a')],{'$or':_['map'](_0x1a5ed5[_0xdb99('0x32')],function(_0x129e10){var _0x30a167={};_0x30a167[_0x129e10]={'$like':'%'+_0x68ff6a[_0xdb99('0x30')][_0xdb99('0x39')]+'%'};return _0x30a167;})});}_0x1a5ed5=_[_0xdb99('0x3b')]({},_0x1a5ed5,_0x68ff6a[_0xdb99('0x3d')]);return _0x26fdca[_0xdb99('0x4c')](_0x1a5ed5);}})[_0xdb99('0x23')](function(_0x26a0f8){if(_0x26a0f8){_0x1666f2=_0x26a0f8[_0xdb99('0x45')];if(!_0x68ff6a[_0xdb99('0x30')][_0xdb99('0x35')](_0xdb99('0x36'))){_0x1a5ed5[_0xdb99('0x1b')]=qs['limit'](_0x68ff6a[_0xdb99('0x30')][_0xdb99('0x1b')]);_0x1a5ed5[_0xdb99('0x1d')]=qs[_0xdb99('0x1d')](_0x68ff6a[_0xdb99('0x30')]['offset']);}return _0x26fdca[_0xdb99('0x4c')](_0x1a5ed5);}})[_0xdb99('0x23')](function(_0x1026df){if(_0x1026df){return _0x1026df?{'count':_0x1666f2,'rows':_0x1026df}:null;}})['then'](respondWithResult(_0x18d9ab,null))[_0xdb99('0x42')](handleError(_0x18d9ab,null));};exports['getDescriptions']=function(_0x2bc629,_0x2fb48a,_0x4f399c){var _0x7c907b={};var _0x4c7fb7={};var _0x2d8679;var _0x52dbfc;return db[_0xdb99('0x2a')][_0xdb99('0x4d')]({'where':{'id':_0x2bc629['params']['id']}})['then'](handleEntityNotFound(_0x2fb48a,null))[_0xdb99('0x23')](function(_0x1dcd8f){if(_0x1dcd8f){_0x2d8679=_0x1dcd8f;_0x4c7fb7[_0xdb99('0x2f')]=_[_0xdb99('0x44')](db[_0xdb99('0x4b')][_0xdb99('0x2b')]);_0x4c7fb7[_0xdb99('0x30')]=_['keys'](_0x2bc629['query']);_0x4c7fb7[_0xdb99('0x31')]=_[_0xdb99('0x33')](_0x4c7fb7[_0xdb99('0x2f')],_0x4c7fb7['query']);_0x7c907b[_0xdb99('0x32')]=_[_0xdb99('0x33')](_0x4c7fb7[_0xdb99('0x2f')],qs[_0xdb99('0x34')](_0x2bc629['query']['fields']));_0x7c907b['attributes']=_0x7c907b[_0xdb99('0x32')][_0xdb99('0x45')]?_0x7c907b[_0xdb99('0x32')]:_0x4c7fb7['model'];_0x7c907b[_0xdb99('0x4a')]=qs[_0xdb99('0x37')](_0x2bc629[_0xdb99('0x30')][_0xdb99('0x37')]);_0x7c907b[_0xdb99('0x3a')]=qs[_0xdb99('0x31')](_[_0xdb99('0x38')](_0x2bc629[_0xdb99('0x30')],_0x4c7fb7['filters']));if(_0x2bc629['query']['filter']){_0x7c907b[_0xdb99('0x3a')]=_['merge'](_0x7c907b['where'],{'$or':_['map'](_0x7c907b['attributes'],function(_0x19793e){var _0x337416={};_0x337416[_0x19793e]={'$like':'%'+_0x2bc629[_0xdb99('0x30')][_0xdb99('0x39')]+'%'};return _0x337416;})});}_0x7c907b=_[_0xdb99('0x3b')]({},_0x7c907b,_0x2bc629[_0xdb99('0x3d')]);return _0x2d8679[_0xdb99('0x4e')](_0x7c907b);}})[_0xdb99('0x23')](function(_0x14bcfa){if(_0x14bcfa){_0x52dbfc=_0x14bcfa[_0xdb99('0x45')];if(!_0x2bc629[_0xdb99('0x30')][_0xdb99('0x35')]('nolimit')){_0x7c907b['limit']=qs[_0xdb99('0x1b')](_0x2bc629['query'][_0xdb99('0x1b')]);_0x7c907b[_0xdb99('0x1d')]=qs[_0xdb99('0x1d')](_0x2bc629[_0xdb99('0x30')][_0xdb99('0x1d')]);}return _0x2d8679[_0xdb99('0x4e')](_0x7c907b);}})[_0xdb99('0x23')](function(_0x27fa98){if(_0x27fa98){return _0x27fa98?{'count':_0x52dbfc,'rows':_0x27fa98}:null;}})['then'](respondWithResult(_0x2fb48a,null))[_0xdb99('0x42')](handleError(_0x2fb48a,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index f5284be..3c64f56 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 _0x8323=['bluebird','request-promise','path','exports','define','SugarcrmConfiguration','lodash','util','api','moment'];(function(_0x2b66ed,_0x3ece7f){var _0x860fe6=function(_0x5a2ff7){while(--_0x5a2ff7){_0x2b66ed['push'](_0x2b66ed['shift']());}};_0x860fe6(++_0x3ece7f);}(_0x8323,0x150));var _0x3832=function(_0x40979f,_0x4a2427){_0x40979f=_0x40979f-0x0;var _0x31db53=_0x8323[_0x40979f];return _0x31db53;};'use strict';var _=require(_0x3832('0x0'));var util=require(_0x3832('0x1'));var logger=require('../../config/logger')(_0x3832('0x2'));var moment=require(_0x3832('0x3'));var BPromise=require(_0x3832('0x4'));var rp=require(_0x3832('0x5'));var fs=require('fs');var path=require(_0x3832('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x3832('0x7')]=function(_0x4370cb,_0xa2ec8a){return _0x4370cb[_0x3832('0x8')](_0x3832('0x9'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x683d=['bluebird','request-promise','path','./intSugarcrmConfiguration.attributes','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x683d,0x67));var _0xd683=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0x683d[_0x485b5a];return _0xd2b34d;};'use strict';var _=require(_0xd683('0x0'));var util=require(_0xd683('0x1'));var logger=require(_0xd683('0x2'))(_0xd683('0x3'));var moment=require(_0xd683('0x4'));var BPromise=require(_0xd683('0x5'));var rp=require(_0xd683('0x6'));var fs=require('fs');var path=require(_0xd683('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd683('0x8'));module['exports']=function(_0x276744,_0x2e381e){return _0x276744[_0xd683('0x9')](_0xd683('0xa'),attributes,{'tableName':_0xd683('0xb'),'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 f7123f1..f8471ab 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 _0x893c=['../../config/environment','client','http','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x333d25,_0x248bbc){var _0x5d084f=function(_0x28175f){while(--_0x28175f){_0x333d25['push'](_0x333d25['shift']());}};_0x5d084f(++_0x248bbc);}(_0x893c,0xc6));var _0xc893=function(_0x27dc6f,_0x5dbea8){_0x27dc6f=_0x27dc6f-0x0;var _0x461137=_0x893c[_0x27dc6f];return _0x461137;};'use strict';var _=require(_0xc893('0x0'));var util=require(_0xc893('0x1'));var moment=require(_0xc893('0x2'));var BPromise=require(_0xc893('0x3'));var rs=require(_0xc893('0x4'));var fs=require('fs');var Redis=require(_0xc893('0x5'));var db=require(_0xc893('0x6'))['db'];var utils=require(_0xc893('0x7'));var logger=require(_0xc893('0x8'))('rpc');var config=require(_0xc893('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc893('0xa')][_0xc893('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xe0ccc2,_0x1d2e27,_0x4c69cb){return new BPromise(function(_0x2429db,_0x329bc5){return client['request'](_0xe0ccc2,_0x4c69cb)[_0xc893('0xc')](function(_0x5784c1){logger[_0xc893('0xd')](_0xc893('0xe'),_0x1d2e27,_0xc893('0xf'));logger[_0xc893('0x10')](_0xc893('0x11'),_0x1d2e27,_0xc893('0xf'),JSON[_0xc893('0x12')](_0x5784c1));if(_0x5784c1[_0xc893('0x13')]){if(_0x5784c1[_0xc893('0x13')][_0xc893('0x14')]===0x1f4){logger['error'](_0xc893('0xe'),_0x1d2e27,_0x5784c1[_0xc893('0x13')][_0xc893('0x15')]);return _0x329bc5(_0x5784c1[_0xc893('0x13')][_0xc893('0x15')]);}logger[_0xc893('0x13')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1d2e27,_0x5784c1[_0xc893('0x13')][_0xc893('0x15')]);return _0x2429db(_0x5784c1['error'][_0xc893('0x15')]);}else{logger[_0xc893('0xd')](_0xc893('0xe'),_0x1d2e27,'request\x20sent');_0x2429db(_0x5784c1['result'][_0xc893('0x15')]);}})[_0xc893('0x16')](function(_0x552e27){logger['error'](_0xc893('0xe'),_0x1d2e27,_0x552e27);_0x329bc5(_0x552e27);});});} \ No newline at end of file +var _0x7333=['request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x5ac84c,_0x287781){var _0x3c53d2=function(_0x40cde0){while(--_0x40cde0){_0x5ac84c['push'](_0x5ac84c['shift']());}};_0x3c53d2(++_0x287781);}(_0x7333,0xb3));var _0x3733=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x7333[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x3733('0x0'));var util=require('util');var moment=require(_0x3733('0x1'));var BPromise=require(_0x3733('0x2'));var rs=require(_0x3733('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3733('0x4'))['db'];var utils=require(_0x3733('0x5'));var logger=require(_0x3733('0x6'))(_0x3733('0x7'));var config=require(_0x3733('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3733('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x57c4b7,_0x22bca1,_0x4c7d13){return new BPromise(function(_0x208bec,_0x195c80){return client[_0x3733('0xa')](_0x57c4b7,_0x4c7d13)[_0x3733('0xb')](function(_0x5d5092){logger[_0x3733('0xc')](_0x3733('0xd'),_0x22bca1,_0x3733('0xe'));logger[_0x3733('0xf')](_0x3733('0x10'),_0x22bca1,_0x3733('0xe'),JSON['stringify'](_0x5d5092));if(_0x5d5092[_0x3733('0x11')]){if(_0x5d5092['error']['code']===0x1f4){logger[_0x3733('0x11')](_0x3733('0xd'),_0x22bca1,_0x5d5092[_0x3733('0x11')]['message']);return _0x195c80(_0x5d5092['error']['message']);}logger[_0x3733('0x11')](_0x3733('0xd'),_0x22bca1,_0x5d5092[_0x3733('0x11')][_0x3733('0x12')]);return _0x208bec(_0x5d5092[_0x3733('0x11')][_0x3733('0x12')]);}else{logger[_0x3733('0xc')](_0x3733('0xd'),_0x22bca1,_0x3733('0xe'));_0x208bec(_0x5d5092[_0x3733('0x13')][_0x3733('0x12')]);}})[_0x3733('0x14')](function(_0x52a9bd){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x22bca1,_0x52a9bd);_0x195c80(_0x52a9bd);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 32f92d7..6a85eeb 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 _0x101f=['/:id','create','put','update','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index'];(function(_0xf7e6d9,_0xd2d728){var _0x2fed24=function(_0x2123d2){while(--_0x2123d2){_0xf7e6d9['push'](_0xf7e6d9['shift']());}};_0x2fed24(++_0xd2d728);}(_0x101f,0x180));var _0xf101=function(_0xefc793,_0x5a5199){_0xefc793=_0xefc793-0x0;var _0x37e31b=_0x101f[_0xefc793];return _0x37e31b;};'use strict';var multer=require(_0xf101('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf101('0x1'));var express=require(_0xf101('0x2'));var router=express[_0xf101('0x3')]();var fs_extra=require(_0xf101('0x4'));var auth=require(_0xf101('0x5'));var interaction=require(_0xf101('0x6'));var config=require(_0xf101('0x7'));var controller=require(_0xf101('0x8'));router[_0xf101('0x9')]('/',auth[_0xf101('0xa')](),controller[_0xf101('0xb')]);router[_0xf101('0x9')](_0xf101('0xc'),auth[_0xf101('0xa')](),controller['show']);router['post']('/',auth[_0xf101('0xa')](),controller[_0xf101('0xd')]);router[_0xf101('0xe')](_0xf101('0xc'),auth[_0xf101('0xa')](),controller[_0xf101('0xf')]);router[_0xf101('0x10')](_0xf101('0xc'),auth[_0xf101('0xa')](),controller[_0xf101('0x11')]);module['exports']=router; \ No newline at end of file +var _0x2baf=['delete','destroy','exports','multer','util','path','fs-extra','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x2a2a21,_0x1483f9){var _0x289a7e=function(_0x27a3ed){while(--_0x27a3ed){_0x2a2a21['push'](_0x2a2a21['shift']());}};_0x289a7e(++_0x1483f9);}(_0x2baf,0x17f));var _0xf2ba=function(_0x251d9c,_0x580977){_0x251d9c=_0x251d9c-0x0;var _0x16ae64=_0x2baf[_0x251d9c];return _0x16ae64;};'use strict';var multer=require(_0xf2ba('0x0'));var util=require(_0xf2ba('0x1'));var path=require(_0xf2ba('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xf2ba('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xf2ba('0x4'));var config=require(_0xf2ba('0x5'));var controller=require(_0xf2ba('0x6'));router[_0xf2ba('0x7')]('/',auth[_0xf2ba('0x8')](),controller[_0xf2ba('0x9')]);router[_0xf2ba('0x7')](_0xf2ba('0xa'),auth['isAuthenticated'](),controller[_0xf2ba('0xb')]);router[_0xf2ba('0xc')]('/',auth[_0xf2ba('0x8')](),controller[_0xf2ba('0xd')]);router[_0xf2ba('0xe')]('/:id',auth[_0xf2ba('0x8')](),controller[_0xf2ba('0xf')]);router[_0xf2ba('0x10')](_0xf2ba('0xa'),auth[_0xf2ba('0x8')](),controller[_0xf2ba('0x11')]);module[_0xf2ba('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 8138df8..8003cd0 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 _0x5f74=['ENUM','string','variable','customVariable','STRING','sequelize','exports'];(function(_0x5d631e,_0x328c72){var _0x1d2650=function(_0x3aba0b){while(--_0x3aba0b){_0x5d631e['push'](_0x5d631e['shift']());}};_0x1d2650(++_0x328c72);}(_0x5f74,0xec));var _0x45f7=function(_0x4263d9,_0x1675ea){_0x4263d9=_0x4263d9-0x0;var _0x9807f5=_0x5f74[_0x4263d9];return _0x9807f5;};'use strict';var Sequelize=require(_0x45f7('0x0'));module[_0x45f7('0x1')]={'type':{'type':Sequelize[_0x45f7('0x2')](_0x45f7('0x3'),_0x45f7('0x4'),_0x45f7('0x5'),'keyValue','picklist'),'defaultValue':_0x45f7('0x3')},'content':{'type':Sequelize[_0x45f7('0x6')]},'key':{'type':Sequelize[_0x45f7('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x45f7('0x3'),'variable',_0x45f7('0x5'))},'keyContent':{'type':Sequelize[_0x45f7('0x6')]},'idField':{'type':Sequelize[_0x45f7('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x45f7('0x6')]}}; \ No newline at end of file +var _0x9978=['picklist','STRING','BOOLEAN','exports','ENUM','string','customVariable','keyValue'];(function(_0x5162e9,_0x55c047){var _0xea59da=function(_0x5e71ed){while(--_0x5e71ed){_0x5162e9['push'](_0x5162e9['shift']());}};_0xea59da(++_0x55c047);}(_0x9978,0x103));var _0x8997=function(_0x1e29a9,_0x3b695a){_0x1e29a9=_0x1e29a9-0x0;var _0x48786a=_0x9978[_0x1e29a9];return _0x48786a;};'use strict';var Sequelize=require('sequelize');module[_0x8997('0x0')]={'type':{'type':Sequelize[_0x8997('0x1')](_0x8997('0x2'),'variable',_0x8997('0x3'),_0x8997('0x4'),_0x8997('0x5')),'defaultValue':_0x8997('0x2')},'content':{'type':Sequelize[_0x8997('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8997('0x1')](_0x8997('0x2'),'variable',_0x8997('0x3'))},'keyContent':{'type':Sequelize[_0x8997('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x8997('0x6')]},'customField':{'type':Sequelize[_0x8997('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8997('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index e0b1c00..df5c294 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 _0x431f=['util','path','to-csv','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','SugarcrmField','includeAll','findAll','rows','catch','show','include','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x4e68f8,_0x4592f8){var _0x253218=function(_0x35d12f){while(--_0x35d12f){_0x4e68f8['push'](_0x4e68f8['shift']());}};_0x253218(++_0x4592f8);}(_0x431f,0xde));var _0xf431=function(_0x586d12,_0x44383c){_0x586d12=_0x586d12-0x0;var _0x217a33=_0x431f[_0x586d12];return _0x217a33;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf431('0x0'));var zipdir=require(_0xf431('0x1'));var jsonpatch=require(_0xf431('0x2'));var rp=require(_0xf431('0x3'));var moment=require(_0xf431('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf431('0x5'));var util=require(_0xf431('0x6'));var path=require(_0xf431('0x7'));var sox=require('sox');var csv=require(_0xf431('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf431('0x9'));var _=require('lodash');var squel=require(_0xf431('0xa'));var crypto=require(_0xf431('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf431('0xc'));var toCsv=require(_0xf431('0x8'));var querystring=require('querystring');var Papa=require(_0xf431('0xd'));var Redis=require(_0xf431('0xe'));var authService=require(_0xf431('0xf'));var qs=require(_0xf431('0x10'));var as=require(_0xf431('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf431('0x12'));var utils=require(_0xf431('0x13'));var config=require(_0xf431('0x14'));var licenseUtil=require(_0xf431('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25cb4d,_0x137835){_0x137835=_0x137835||0xcc;return function(_0x2233e1){if(_0x2233e1){return _0x25cb4d[_0xf431('0x16')](_0x137835);}return _0x25cb4d[_0xf431('0x17')](_0x137835)[_0xf431('0x18')]();};}function respondWithResult(_0x27bb8f,_0x26d5d2){_0x26d5d2=_0x26d5d2||0xc8;return function(_0x4f1910){if(_0x4f1910){return _0x27bb8f[_0xf431('0x17')](_0x26d5d2)[_0xf431('0x19')](_0x4f1910);}};}function respondWithFilteredResult(_0x260ec5,_0x412237){return function(_0x2a4e7d){if(_0x2a4e7d){var _0x42eb21=typeof _0x412237[_0xf431('0x1a')]===_0xf431('0x1b')&&typeof _0x412237[_0xf431('0x1c')]==='undefined';var _0x51b8c7=_0x2a4e7d['count'];var _0x370602=_0x42eb21?0x0:_0x412237['offset'];var _0x3fd7a2=_0x42eb21?_0x2a4e7d[_0xf431('0x1d')]:_0x412237[_0xf431('0x1a')]+_0x412237[_0xf431('0x1c')];var _0x42f1ef;if(_0x3fd7a2>=_0x51b8c7){_0x3fd7a2=_0x51b8c7;_0x42f1ef=0xc8;}else{_0x42f1ef=0xce;}_0x260ec5[_0xf431('0x17')](_0x42f1ef);return _0x260ec5[_0xf431('0x1e')]('Content-Range',_0x370602+'-'+_0x3fd7a2+'/'+_0x51b8c7)[_0xf431('0x19')](_0x2a4e7d);}return null;};}function patchUpdates(_0xa194b8){return function(_0x5ec6c0){try{jsonpatch[_0xf431('0x1f')](_0x5ec6c0,_0xa194b8,!![]);}catch(_0x468556){return BPromise[_0xf431('0x20')](_0x468556);}return _0x5ec6c0[_0xf431('0x21')]();};}function saveUpdates(_0x555681,_0x5a81b9){return function(_0x160bdf){if(_0x160bdf){return _0x160bdf[_0xf431('0x22')](_0x555681)[_0xf431('0x23')](function(_0x3d4dfa){return _0x3d4dfa;});}return null;};}function removeEntity(_0x4efb26,_0x2f881a){return function(_0x5c530f){if(_0x5c530f){return _0x5c530f[_0xf431('0x24')]()[_0xf431('0x23')](function(){_0x4efb26[_0xf431('0x17')](0xcc)[_0xf431('0x18')]();});}};}function handleEntityNotFound(_0x4feaa2,_0x55caa9){return function(_0x1f8b82){if(!_0x1f8b82){_0x4feaa2[_0xf431('0x16')](0x194);}return _0x1f8b82;};}function handleError(_0x440531,_0x24331c){_0x24331c=_0x24331c||0x1f4;return function(_0x6f8b98){logger[_0xf431('0x25')](_0x6f8b98[_0xf431('0x26')]);if(_0x6f8b98[_0xf431('0x27')]){delete _0x6f8b98[_0xf431('0x27')];}_0x440531['status'](_0x24331c)[_0xf431('0x28')](_0x6f8b98);};}exports[_0xf431('0x29')]=function(_0x596984,_0x5dfc06){var _0xef1a5c={},_0x49e16b={},_0x504b4c={'count':0x0,'rows':[]};var _0x580cf3=_[_0xf431('0x2a')](db['SugarcrmField'][_0xf431('0x2b')],function(_0x379452){return{'name':_0x379452[_0xf431('0x2c')],'type':_0x379452[_0xf431('0x2d')][_0xf431('0x2e')]};});_0x49e16b[_0xf431('0x2f')]=_['map'](_0x580cf3,_0xf431('0x27'));_0x49e16b[_0xf431('0x30')]=_[_0xf431('0x31')](_0x596984[_0xf431('0x30')]);_0x49e16b[_0xf431('0x32')]=_[_0xf431('0x33')](_0x49e16b[_0xf431('0x2f')],_0x49e16b['query']);_0xef1a5c[_0xf431('0x34')]=_[_0xf431('0x33')](_0x49e16b[_0xf431('0x2f')],qs[_0xf431('0x35')](_0x596984[_0xf431('0x30')]['fields']));_0xef1a5c[_0xf431('0x34')]=_0xef1a5c[_0xf431('0x34')][_0xf431('0x36')]?_0xef1a5c[_0xf431('0x34')]:_0x49e16b[_0xf431('0x2f')];if(!_0x596984[_0xf431('0x30')][_0xf431('0x37')](_0xf431('0x38'))){_0xef1a5c['limit']=qs[_0xf431('0x1c')](_0x596984[_0xf431('0x30')][_0xf431('0x1c')]);_0xef1a5c['offset']=qs[_0xf431('0x1a')](_0x596984[_0xf431('0x30')][_0xf431('0x1a')]);}_0xef1a5c[_0xf431('0x39')]=qs[_0xf431('0x3a')](_0x596984['query'][_0xf431('0x3a')]);_0xef1a5c[_0xf431('0x3b')]=qs[_0xf431('0x32')](_[_0xf431('0x3c')](_0x596984['query'],_0x49e16b[_0xf431('0x32')]),_0x580cf3);if(_0x596984[_0xf431('0x30')][_0xf431('0x3d')]){_0xef1a5c[_0xf431('0x3b')]=_['merge'](_0xef1a5c[_0xf431('0x3b')],{'$or':_['map'](_0x580cf3,function(_0x4c6cdc){if(_0x4c6cdc[_0xf431('0x2d')]!==_0xf431('0x3e')){var _0x114942={};_0x114942[_0x4c6cdc[_0xf431('0x27')]]={'$like':'%'+_0x596984[_0xf431('0x30')]['filter']+'%'};return _0x114942;}})});}_0xef1a5c=_[_0xf431('0x3f')]({},_0xef1a5c,_0x596984[_0xf431('0x40')]);var _0x3a41ac={'where':_0xef1a5c['where']};return db[_0xf431('0x41')][_0xf431('0x1d')](_0x3a41ac)[_0xf431('0x23')](function(_0x44f5a1){_0x504b4c[_0xf431('0x1d')]=_0x44f5a1;if(_0x596984['query'][_0xf431('0x42')]){_0xef1a5c['include']=[{'all':!![]}];}return db[_0xf431('0x41')][_0xf431('0x43')](_0xef1a5c);})[_0xf431('0x23')](function(_0x472b29){_0x504b4c[_0xf431('0x44')]=_0x472b29;return _0x504b4c;})[_0xf431('0x23')](respondWithFilteredResult(_0x5dfc06,_0xef1a5c))[_0xf431('0x45')](handleError(_0x5dfc06,null));};exports[_0xf431('0x46')]=function(_0x423215,_0x12903d){var _0x4b2daf={'raw':!![],'where':{'id':_0x423215['params']['id']}},_0x4b34b6={};_0x4b34b6[_0xf431('0x2f')]=_[_0xf431('0x31')](db['SugarcrmField'][_0xf431('0x2b')]);_0x4b34b6['query']=_[_0xf431('0x31')](_0x423215['query']);_0x4b34b6[_0xf431('0x32')]=_['intersection'](_0x4b34b6[_0xf431('0x2f')],_0x4b34b6[_0xf431('0x30')]);_0x4b2daf['attributes']=_[_0xf431('0x33')](_0x4b34b6[_0xf431('0x2f')],qs[_0xf431('0x35')](_0x423215[_0xf431('0x30')][_0xf431('0x35')]));_0x4b2daf[_0xf431('0x34')]=_0x4b2daf['attributes'][_0xf431('0x36')]?_0x4b2daf['attributes']:_0x4b34b6[_0xf431('0x2f')];if(_0x423215[_0xf431('0x30')][_0xf431('0x42')]){_0x4b2daf[_0xf431('0x47')]=[{'all':!![]}];}_0x4b2daf=_[_0xf431('0x3f')]({},_0x4b2daf,_0x423215[_0xf431('0x40')]);return db[_0xf431('0x41')][_0xf431('0x48')](_0x4b2daf)[_0xf431('0x23')](handleEntityNotFound(_0x12903d,null))[_0xf431('0x23')](respondWithResult(_0x12903d,null))[_0xf431('0x45')](handleError(_0x12903d,null));};exports[_0xf431('0x49')]=function(_0x30d606,_0x272e36){return db[_0xf431('0x41')][_0xf431('0x49')](_0x30d606[_0xf431('0x4a')],{})[_0xf431('0x23')](respondWithResult(_0x272e36,0xc9))[_0xf431('0x45')](handleError(_0x272e36,null));};exports[_0xf431('0x22')]=function(_0x329cc1,_0x2ba8f1){if(_0x329cc1[_0xf431('0x4a')]['id']){delete _0x329cc1[_0xf431('0x4a')]['id'];}return db[_0xf431('0x41')][_0xf431('0x48')]({'where':{'id':_0x329cc1[_0xf431('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2ba8f1,null))[_0xf431('0x23')](saveUpdates(_0x329cc1[_0xf431('0x4a')],null))[_0xf431('0x23')](respondWithResult(_0x2ba8f1,null))[_0xf431('0x45')](handleError(_0x2ba8f1,null));};exports[_0xf431('0x24')]=function(_0x21f723,_0xfe3f32){return db[_0xf431('0x41')]['find']({'where':{'id':_0x21f723[_0xf431('0x4b')]['id']}})[_0xf431('0x23')](handleEntityNotFound(_0xfe3f32,null))['then'](removeEntity(_0xfe3f32,null))[_0xf431('0x45')](handleError(_0xfe3f32,null));}; \ No newline at end of file +var _0xb1b2=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','VIRTUAL','options','findAll','rows','catch','params','includeAll','include','merge','find','body','update','eml-format','rimraf','zip-dir','request-promise','moment','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x46a671,_0x758e9a){var _0x526d75=function(_0xde3640){while(--_0xde3640){_0x46a671['push'](_0x46a671['shift']());}};_0x526d75(++_0x758e9a);}(_0xb1b2,0x1ae));var _0x2b1b=function(_0x6c0e22,_0x282ecb){_0x6c0e22=_0x6c0e22-0x0;var _0x215f08=_0xb1b2[_0x6c0e22];return _0x215f08;};'use strict';var emlformat=require(_0x2b1b('0x0'));var rimraf=require(_0x2b1b('0x1'));var zipdir=require(_0x2b1b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2b1b('0x3'));var moment=require(_0x2b1b('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2b1b('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x2b1b('0x6'));var ejs=require(_0x2b1b('0x7'));var fs=require('fs');var fs_extra=require(_0x2b1b('0x8'));var _=require(_0x2b1b('0x9'));var squel=require(_0x2b1b('0xa'));var crypto=require(_0x2b1b('0xb'));var jsforce=require(_0x2b1b('0xc'));var deskjs=require(_0x2b1b('0xd'));var toCsv=require(_0x2b1b('0x6'));var querystring=require(_0x2b1b('0xe'));var Papa=require(_0x2b1b('0xf'));var Redis=require(_0x2b1b('0x10'));var authService=require(_0x2b1b('0x11'));var qs=require(_0x2b1b('0x12'));var as=require(_0x2b1b('0x13'));var hardwareService=require(_0x2b1b('0x14'));var logger=require(_0x2b1b('0x15'))('api');var utils=require(_0x2b1b('0x16'));var config=require(_0x2b1b('0x17'));var licenseUtil=require(_0x2b1b('0x18'));var db=require(_0x2b1b('0x19'))['db'];function respondWithStatusCode(_0x572e1f,_0x461b40){_0x461b40=_0x461b40||0xcc;return function(_0x3b3c05){if(_0x3b3c05){return _0x572e1f[_0x2b1b('0x1a')](_0x461b40);}return _0x572e1f[_0x2b1b('0x1b')](_0x461b40)[_0x2b1b('0x1c')]();};}function respondWithResult(_0xcbdaf5,_0x4afe7f){_0x4afe7f=_0x4afe7f||0xc8;return function(_0x52ac7a){if(_0x52ac7a){return _0xcbdaf5[_0x2b1b('0x1b')](_0x4afe7f)[_0x2b1b('0x1d')](_0x52ac7a);}};}function respondWithFilteredResult(_0x4483f1,_0x5f0fa2){return function(_0x1faf65){if(_0x1faf65){var _0x177eb3=typeof _0x5f0fa2[_0x2b1b('0x1e')]===_0x2b1b('0x1f')&&typeof _0x5f0fa2[_0x2b1b('0x20')]===_0x2b1b('0x1f');var _0x536190=_0x1faf65[_0x2b1b('0x21')];var _0x203d16=_0x177eb3?0x0:_0x5f0fa2['offset'];var _0xfbd695=_0x177eb3?_0x1faf65[_0x2b1b('0x21')]:_0x5f0fa2[_0x2b1b('0x1e')]+_0x5f0fa2[_0x2b1b('0x20')];var _0x27424f;if(_0xfbd695>=_0x536190){_0xfbd695=_0x536190;_0x27424f=0xc8;}else{_0x27424f=0xce;}_0x4483f1[_0x2b1b('0x1b')](_0x27424f);return _0x4483f1[_0x2b1b('0x22')](_0x2b1b('0x23'),_0x203d16+'-'+_0xfbd695+'/'+_0x536190)[_0x2b1b('0x1d')](_0x1faf65);}return null;};}function patchUpdates(_0x1f6f6f){return function(_0x594d33){try{jsonpatch['apply'](_0x594d33,_0x1f6f6f,!![]);}catch(_0x35edf0){return BPromise[_0x2b1b('0x24')](_0x35edf0);}return _0x594d33[_0x2b1b('0x25')]();};}function saveUpdates(_0x1fd90d,_0x49e4ec){return function(_0x178adf){if(_0x178adf){return _0x178adf['update'](_0x1fd90d)[_0x2b1b('0x26')](function(_0x183ce9){return _0x183ce9;});}return null;};}function removeEntity(_0x5b22e2,_0x38437c){return function(_0x3b8ec4){if(_0x3b8ec4){return _0x3b8ec4[_0x2b1b('0x27')]()[_0x2b1b('0x26')](function(){_0x5b22e2[_0x2b1b('0x1b')](0xcc)[_0x2b1b('0x1c')]();});}};}function handleEntityNotFound(_0x5a86b7,_0x4ab983){return function(_0x420780){if(!_0x420780){_0x5a86b7[_0x2b1b('0x1a')](0x194);}return _0x420780;};}function handleError(_0x4031d6,_0x5c13ba){_0x5c13ba=_0x5c13ba||0x1f4;return function(_0x3328cd){logger[_0x2b1b('0x28')](_0x3328cd[_0x2b1b('0x29')]);if(_0x3328cd[_0x2b1b('0x2a')]){delete _0x3328cd[_0x2b1b('0x2a')];}_0x4031d6['status'](_0x5c13ba)[_0x2b1b('0x2b')](_0x3328cd);};}exports[_0x2b1b('0x2c')]=function(_0x29cca,_0x3cefe9){var _0x599726={},_0x4f4490={},_0x499086={'count':0x0,'rows':[]};var _0x508d90=_[_0x2b1b('0x2d')](db[_0x2b1b('0x2e')][_0x2b1b('0x2f')],function(_0x2a3f10){return{'name':_0x2a3f10[_0x2b1b('0x30')],'type':_0x2a3f10[_0x2b1b('0x31')]['key']};});_0x4f4490[_0x2b1b('0x32')]=_[_0x2b1b('0x2d')](_0x508d90,'name');_0x4f4490[_0x2b1b('0x33')]=_[_0x2b1b('0x34')](_0x29cca[_0x2b1b('0x33')]);_0x4f4490[_0x2b1b('0x35')]=_[_0x2b1b('0x36')](_0x4f4490[_0x2b1b('0x32')],_0x4f4490[_0x2b1b('0x33')]);_0x599726[_0x2b1b('0x37')]=_[_0x2b1b('0x36')](_0x4f4490[_0x2b1b('0x32')],qs[_0x2b1b('0x38')](_0x29cca[_0x2b1b('0x33')]['fields']));_0x599726[_0x2b1b('0x37')]=_0x599726[_0x2b1b('0x37')]['length']?_0x599726[_0x2b1b('0x37')]:_0x4f4490[_0x2b1b('0x32')];if(!_0x29cca[_0x2b1b('0x33')][_0x2b1b('0x39')]('nolimit')){_0x599726[_0x2b1b('0x20')]=qs[_0x2b1b('0x20')](_0x29cca[_0x2b1b('0x33')][_0x2b1b('0x20')]);_0x599726['offset']=qs[_0x2b1b('0x1e')](_0x29cca[_0x2b1b('0x33')][_0x2b1b('0x1e')]);}_0x599726[_0x2b1b('0x3a')]=qs['sort'](_0x29cca['query'][_0x2b1b('0x3b')]);_0x599726[_0x2b1b('0x3c')]=qs[_0x2b1b('0x35')](_['pick'](_0x29cca[_0x2b1b('0x33')],_0x4f4490['filters']),_0x508d90);if(_0x29cca[_0x2b1b('0x33')][_0x2b1b('0x3d')]){_0x599726[_0x2b1b('0x3c')]=_['merge'](_0x599726['where'],{'$or':_[_0x2b1b('0x2d')](_0x508d90,function(_0xf1e781){if(_0xf1e781['type']!==_0x2b1b('0x3e')){var _0x2e2366={};_0x2e2366[_0xf1e781[_0x2b1b('0x2a')]]={'$like':'%'+_0x29cca[_0x2b1b('0x33')][_0x2b1b('0x3d')]+'%'};return _0x2e2366;}})});}_0x599726=_['merge']({},_0x599726,_0x29cca[_0x2b1b('0x3f')]);var _0x39f9bb={'where':_0x599726['where']};return db[_0x2b1b('0x2e')][_0x2b1b('0x21')](_0x39f9bb)[_0x2b1b('0x26')](function(_0x5739e0){_0x499086[_0x2b1b('0x21')]=_0x5739e0;if(_0x29cca[_0x2b1b('0x33')]['includeAll']){_0x599726['include']=[{'all':!![]}];}return db['SugarcrmField'][_0x2b1b('0x40')](_0x599726);})[_0x2b1b('0x26')](function(_0x56b91a){_0x499086[_0x2b1b('0x41')]=_0x56b91a;return _0x499086;})[_0x2b1b('0x26')](respondWithFilteredResult(_0x3cefe9,_0x599726))[_0x2b1b('0x42')](handleError(_0x3cefe9,null));};exports['show']=function(_0x5093cd,_0x37aefa){var _0x31af3d={'raw':!![],'where':{'id':_0x5093cd[_0x2b1b('0x43')]['id']}},_0x167b38={};_0x167b38[_0x2b1b('0x32')]=_[_0x2b1b('0x34')](db['SugarcrmField'][_0x2b1b('0x2f')]);_0x167b38['query']=_['keys'](_0x5093cd[_0x2b1b('0x33')]);_0x167b38[_0x2b1b('0x35')]=_[_0x2b1b('0x36')](_0x167b38[_0x2b1b('0x32')],_0x167b38['query']);_0x31af3d[_0x2b1b('0x37')]=_['intersection'](_0x167b38['model'],qs[_0x2b1b('0x38')](_0x5093cd[_0x2b1b('0x33')][_0x2b1b('0x38')]));_0x31af3d[_0x2b1b('0x37')]=_0x31af3d[_0x2b1b('0x37')]['length']?_0x31af3d[_0x2b1b('0x37')]:_0x167b38[_0x2b1b('0x32')];if(_0x5093cd[_0x2b1b('0x33')][_0x2b1b('0x44')]){_0x31af3d[_0x2b1b('0x45')]=[{'all':!![]}];}_0x31af3d=_[_0x2b1b('0x46')]({},_0x31af3d,_0x5093cd[_0x2b1b('0x3f')]);return db[_0x2b1b('0x2e')][_0x2b1b('0x47')](_0x31af3d)[_0x2b1b('0x26')](handleEntityNotFound(_0x37aefa,null))[_0x2b1b('0x26')](respondWithResult(_0x37aefa,null))[_0x2b1b('0x42')](handleError(_0x37aefa,null));};exports['create']=function(_0x22e04e,_0x64ddf6){return db[_0x2b1b('0x2e')]['create'](_0x22e04e[_0x2b1b('0x48')],{})[_0x2b1b('0x26')](respondWithResult(_0x64ddf6,0xc9))[_0x2b1b('0x42')](handleError(_0x64ddf6,null));};exports[_0x2b1b('0x49')]=function(_0x50e8a5,_0x340832){if(_0x50e8a5[_0x2b1b('0x48')]['id']){delete _0x50e8a5[_0x2b1b('0x48')]['id'];}return db[_0x2b1b('0x2e')][_0x2b1b('0x47')]({'where':{'id':_0x50e8a5[_0x2b1b('0x43')]['id']}})[_0x2b1b('0x26')](handleEntityNotFound(_0x340832,null))['then'](saveUpdates(_0x50e8a5[_0x2b1b('0x48')],null))['then'](respondWithResult(_0x340832,null))[_0x2b1b('0x42')](handleError(_0x340832,null));};exports['destroy']=function(_0x12d82a,_0x5eee8d){return db[_0x2b1b('0x2e')][_0x2b1b('0x47')]({'where':{'id':_0x12d82a[_0x2b1b('0x43')]['id']}})['then'](handleEntityNotFound(_0x5eee8d,null))[_0x2b1b('0x26')](removeEntity(_0x5eee8d,null))[_0x2b1b('0x42')](handleError(_0x5eee8d,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index a33fc6c..8ea144d 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 _0xc368=['path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','sugarcrm_unique_index','lodash','util','../../config/logger','api','bluebird'];(function(_0x3aec8e,_0x5dd749){var _0x598313=function(_0x3c3ac4){while(--_0x3c3ac4){_0x3aec8e['push'](_0x3aec8e['shift']());}};_0x598313(++_0x5dd749);}(_0xc368,0x18e));var _0x8c36=function(_0x50d89f,_0x43bcc6){_0x50d89f=_0x50d89f-0x0;var _0x228769=_0xc368[_0x50d89f];return _0x228769;};'use strict';var _=require(_0x8c36('0x0'));var util=require(_0x8c36('0x1'));var logger=require(_0x8c36('0x2'))(_0x8c36('0x3'));var moment=require('moment');var BPromise=require(_0x8c36('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8c36('0x5'));var rimraf=require(_0x8c36('0x6'));var config=require(_0x8c36('0x7'));var attributes=require(_0x8c36('0x8'));module[_0x8c36('0x9')]=function(_0x368583,_0xc059ed){return _0x368583[_0x8c36('0xa')](_0x8c36('0xb'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x8c36('0xc'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x92bb=['idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','int_sugarcrm_fields','sugarcrm_unique_index'];(function(_0x226d49,_0xece90b){var _0x1e1ced=function(_0x243a8d){while(--_0x243a8d){_0x226d49['push'](_0x226d49['shift']());}};_0x1e1ced(++_0xece90b);}(_0x92bb,0x1c1));var _0xb92b=function(_0x47f7ec,_0x369f9d){_0x47f7ec=_0x47f7ec-0x0;var _0x415101=_0x92bb[_0x47f7ec];return _0x415101;};'use strict';var _=require(_0xb92b('0x0'));var util=require(_0xb92b('0x1'));var logger=require(_0xb92b('0x2'))(_0xb92b('0x3'));var moment=require(_0xb92b('0x4'));var BPromise=require(_0xb92b('0x5'));var rp=require(_0xb92b('0x6'));var fs=require('fs');var path=require(_0xb92b('0x7'));var rimraf=require(_0xb92b('0x8'));var config=require(_0xb92b('0x9'));var attributes=require(_0xb92b('0xa'));module[_0xb92b('0xb')]=function(_0x44cdf8,_0xec2c3b){return _0x44cdf8[_0xb92b('0xc')]('SugarcrmField',attributes,{'tableName':_0xb92b('0xd'),'paranoid':![],'indexes':[{'name':_0xb92b('0xe'),'fields':[_0xb92b('0xf'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 46109f0..492ef0c 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 _0xa2da=['SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','SugarcrmField,\x20%s,\x20%s','request\x20sent'];(function(_0xdb4955,_0x145b00){var _0x39daf9=function(_0x183327){while(--_0x183327){_0xdb4955['push'](_0xdb4955['shift']());}};_0x39daf9(++_0x145b00);}(_0xa2da,0x70));var _0xaa2d=function(_0x1ff2ec,_0x386e86){_0x1ff2ec=_0x1ff2ec-0x0;var _0x405683=_0xa2da[_0x1ff2ec];return _0x405683;};'use strict';var _=require('lodash');var util=require(_0xaa2d('0x0'));var moment=require(_0xaa2d('0x1'));var BPromise=require(_0xaa2d('0x2'));var rs=require(_0xaa2d('0x3'));var fs=require('fs');var Redis=require(_0xaa2d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xaa2d('0x5'));var logger=require(_0xaa2d('0x6'))(_0xaa2d('0x7'));var config=require(_0xaa2d('0x8'));var jayson=require(_0xaa2d('0x9'));var client=jayson[_0xaa2d('0xa')][_0xaa2d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x433103,_0x4c9020,_0x443d32){return new BPromise(function(_0x41530d,_0x466e77){return client['request'](_0x433103,_0x443d32)['then'](function(_0x470c35){logger['info'](_0xaa2d('0xc'),_0x4c9020,_0xaa2d('0xd'));logger['debug'](_0xaa2d('0xe'),_0x4c9020,'request\x20sent',JSON[_0xaa2d('0xf')](_0x470c35));if(_0x470c35[_0xaa2d('0x10')]){if(_0x470c35[_0xaa2d('0x10')][_0xaa2d('0x11')]===0x1f4){logger[_0xaa2d('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x4c9020,_0x470c35[_0xaa2d('0x10')]['message']);return _0x466e77(_0x470c35[_0xaa2d('0x10')][_0xaa2d('0x12')]);}logger[_0xaa2d('0x10')](_0xaa2d('0xc'),_0x4c9020,_0x470c35[_0xaa2d('0x10')][_0xaa2d('0x12')]);return _0x41530d(_0x470c35[_0xaa2d('0x10')]['message']);}else{logger['info']('SugarcrmField,\x20%s,\x20%s',_0x4c9020,_0xaa2d('0xd'));_0x41530d(_0x470c35[_0xaa2d('0x13')][_0xaa2d('0x12')]);}})[_0xaa2d('0x14')](function(_0x1e78dd){logger[_0xaa2d('0x10')](_0xaa2d('0xc'),_0x4c9020,_0x1e78dd);_0x466e77(_0x1e78dd);});});} \ No newline at end of file +var _0xdef1=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0xdef1,0x11e));var _0x1def=function(_0x7416d8,_0x1a46dc){_0x7416d8=_0x7416d8-0x0;var _0x114f8c=_0xdef1[_0x7416d8];return _0x114f8c;};'use strict';var _=require(_0x1def('0x0'));var util=require(_0x1def('0x1'));var moment=require('moment');var BPromise=require(_0x1def('0x2'));var rs=require(_0x1def('0x3'));var fs=require('fs');var Redis=require(_0x1def('0x4'));var db=require(_0x1def('0x5'))['db'];var utils=require(_0x1def('0x6'));var logger=require(_0x1def('0x7'))(_0x1def('0x8'));var config=require(_0x1def('0x9'));var jayson=require(_0x1def('0xa'));var client=jayson[_0x1def('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x58bd58,_0xbf0acc,_0x54aba1){return new BPromise(function(_0xa0e39a,_0x3d02d6){return client[_0x1def('0xc')](_0x58bd58,_0x54aba1)[_0x1def('0xd')](function(_0x4172d7){logger[_0x1def('0xe')](_0x1def('0xf'),_0xbf0acc,_0x1def('0x10'));logger['debug'](_0x1def('0x11'),_0xbf0acc,'request\x20sent',JSON[_0x1def('0x12')](_0x4172d7));if(_0x4172d7[_0x1def('0x13')]){if(_0x4172d7[_0x1def('0x13')][_0x1def('0x14')]===0x1f4){logger['error'](_0x1def('0xf'),_0xbf0acc,_0x4172d7[_0x1def('0x13')][_0x1def('0x15')]);return _0x3d02d6(_0x4172d7[_0x1def('0x13')][_0x1def('0x15')]);}logger[_0x1def('0x13')]('SugarcrmField,\x20%s,\x20%s',_0xbf0acc,_0x4172d7[_0x1def('0x13')][_0x1def('0x15')]);return _0xa0e39a(_0x4172d7[_0x1def('0x13')][_0x1def('0x15')]);}else{logger['info'](_0x1def('0xf'),_0xbf0acc,_0x1def('0x10'));_0xa0e39a(_0x4172d7[_0x1def('0x16')]['message']);}})[_0x1def('0x17')](function(_0x38f75d){logger[_0x1def('0x13')](_0x1def('0xf'),_0xbf0acc,_0x38f75d);_0x3d02d6(_0x38f75d);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 83695eb..1937576 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 _0x594d=['isAuthenticated','show','getConfigurations','/:id/fields','post','create','addConfiguration','update','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','/:id'];(function(_0x5774be,_0x2259d3){var _0x4914b4=function(_0x1eebc3){while(--_0x1eebc3){_0x5774be['push'](_0x5774be['shift']());}};_0x4914b4(++_0x2259d3);}(_0x594d,0x172));var _0xd594=function(_0x38036b,_0x540584){_0x38036b=_0x38036b-0x0;var _0x3f8528=_0x594d[_0x38036b];return _0x3f8528;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd594('0x0'));var timeout=require(_0xd594('0x1'));var express=require(_0xd594('0x2'));var router=express[_0xd594('0x3')]();var fs_extra=require(_0xd594('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd594('0x5'));var config=require(_0xd594('0x6'));var controller=require(_0xd594('0x7'));router[_0xd594('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xd594('0x9'),auth[_0xd594('0xa')](),controller[_0xd594('0xb')]);router[_0xd594('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xd594('0xc')]);router[_0xd594('0x8')](_0xd594('0xd'),auth[_0xd594('0xa')](),controller['getFields']);router[_0xd594('0xe')]('/',auth[_0xd594('0xa')](),controller[_0xd594('0xf')]);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0xd594('0x10')]);router['put'](_0xd594('0x9'),auth[_0xd594('0xa')](),controller[_0xd594('0x11')]);router['delete'](_0xd594('0x9'),auth['isAuthenticated'](),controller[_0xd594('0x12')]);module[_0xd594('0x13')]=router; \ No newline at end of file +var _0x607b=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','/:id','get','/:id/configurations','getConfigurations','/:id/fields','getFields','create','addConfiguration','delete','destroy','exports'];(function(_0x50f697,_0x11e9cf){var _0x46e0cb=function(_0xafeeb8){while(--_0xafeeb8){_0x50f697['push'](_0x50f697['shift']());}};_0x46e0cb(++_0x11e9cf);}(_0x607b,0x18f));var _0xb607=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x607b[_0xb0f7c3];return _0x28ea68;};'use strict';var multer=require(_0xb607('0x0'));var util=require('util');var path=require(_0xb607('0x1'));var timeout=require(_0xb607('0x2'));var express=require(_0xb607('0x3'));var router=express[_0xb607('0x4')]();var fs_extra=require(_0xb607('0x5'));var auth=require(_0xb607('0x6'));var interaction=require(_0xb607('0x7'));var config=require(_0xb607('0x8'));var controller=require('./intVtigerAccount.controller');router['get']('/',auth[_0xb607('0x9')](),controller['index']);router['get'](_0xb607('0xa'),auth[_0xb607('0x9')](),controller['show']);router[_0xb607('0xb')](_0xb607('0xc'),auth[_0xb607('0x9')](),controller[_0xb607('0xd')]);router['get'](_0xb607('0xe'),auth[_0xb607('0x9')](),controller[_0xb607('0xf')]);router['post']('/',auth[_0xb607('0x9')](),controller[_0xb607('0x10')]);router['post'](_0xb607('0xc'),auth['isAuthenticated'](),controller[_0xb607('0x11')]);router['put'](_0xb607('0xa'),auth[_0xb607('0x9')](),controller['update']);router[_0xb607('0x12')](_0xb607('0xa'),auth[_0xb607('0x9')](),controller[_0xb607('0x13')]);module[_0xb607('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index aaf88fc..df35b21 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 _0x44d8=['STRING','HelpDesk','exports'];(function(_0xa14d8c,_0x14759b){var _0x3facda=function(_0x13c866){while(--_0x13c866){_0xa14d8c['push'](_0xa14d8c['shift']());}};_0x3facda(++_0x14759b);}(_0x44d8,0x1ee));var _0x844d=function(_0x21aba4,_0x9665b8){_0x21aba4=_0x21aba4-0x0;var _0x4757bd=_0x44d8[_0x21aba4];return _0x4757bd;};'use strict';var Sequelize=require('sequelize');module[_0x844d('0x0')]={'name':{'type':Sequelize[_0x844d('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x844d('0x1')]},'username':{'type':Sequelize[_0x844d('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x844d('0x1')],'allowNull':![],'defaultValue':_0x844d('0x2')},'remoteUri':{'type':Sequelize[_0x844d('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x844d('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x844d('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xa4fe=['STRING','HelpDesk'];(function(_0x533fd0,_0x1481e8){var _0x202736=function(_0x1dff66){while(--_0x1dff66){_0x533fd0['push'](_0x533fd0['shift']());}};_0x202736(++_0x1481e8);}(_0xa4fe,0x108));var _0xea4f=function(_0x57e17c,_0x3b99be){_0x57e17c=_0x57e17c-0x0;var _0x3bb416=_0xa4fe[_0x57e17c];return _0x3bb416;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xea4f('0x0')]},'username':{'type':Sequelize[_0xea4f('0x0')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xea4f('0x1')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xea4f('0x0')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xea4f('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 647cb75..24c1edb 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 _0x1610=['path','sox','to-csv','ejs','lodash','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','then','sendStatus','error','name','send','map','VtigerAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','catch','show','params','length','include','find','create','body','destroy','VtigerConfiguration','pick','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','GET','success','POST','login','result','token','describe','sessionName','autogenerated','reference','remove','includes','false','label','startsWith','cf_','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1610,0x157));var _0x0161=function(_0x11038a,_0x12aca0){_0x11038a=_0x11038a-0x0;var _0x16d770=_0x1610[_0x11038a];return _0x16d770;};'use strict';var emlformat=require(_0x0161('0x0'));var rimraf=require(_0x0161('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0161('0x2'));var rp=require(_0x0161('0x3'));var moment=require(_0x0161('0x4'));var BPromise=require(_0x0161('0x5'));var Mustache=require(_0x0161('0x6'));var util=require(_0x0161('0x7'));var path=require(_0x0161('0x8'));var sox=require(_0x0161('0x9'));var csv=require(_0x0161('0xa'));var ejs=require(_0x0161('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0161('0xc'));var squel=require('squel');var crypto=require(_0x0161('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0161('0xa'));var querystring=require('querystring');var Papa=require(_0x0161('0xe'));var Redis=require(_0x0161('0xf'));var authService=require(_0x0161('0x10'));var qs=require(_0x0161('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0161('0x12'));var logger=require(_0x0161('0x13'))('api');var utils=require(_0x0161('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x0161('0x15'));var db=require(_0x0161('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5dfbc8,_0x4a5e77){_0x4a5e77=_0x4a5e77||0xcc;return function(_0x4f7450){if(_0x4f7450){return _0x5dfbc8['sendStatus'](_0x4a5e77);}return _0x5dfbc8['status'](_0x4a5e77)[_0x0161('0x17')]();};}function respondWithResult(_0x35f03c,_0x13f907){_0x13f907=_0x13f907||0xc8;return function(_0x362f77){if(_0x362f77){return _0x35f03c[_0x0161('0x18')](_0x13f907)['json'](_0x362f77);}};}function respondWithFilteredResult(_0x11136b,_0x126268){return function(_0x500a43){if(_0x500a43){var _0xd8ee18=typeof _0x126268[_0x0161('0x19')]==='undefined'&&typeof _0x126268['limit']===_0x0161('0x1a');var _0x15c7bf=_0x500a43['count'];var _0x45c904=_0xd8ee18?0x0:_0x126268['offset'];var _0x12f1a2=_0xd8ee18?_0x500a43[_0x0161('0x1b')]:_0x126268[_0x0161('0x19')]+_0x126268[_0x0161('0x1c')];var _0x161d86;if(_0x12f1a2>=_0x15c7bf){_0x12f1a2=_0x15c7bf;_0x161d86=0xc8;}else{_0x161d86=0xce;}_0x11136b[_0x0161('0x18')](_0x161d86);return _0x11136b[_0x0161('0x1d')](_0x0161('0x1e'),_0x45c904+'-'+_0x12f1a2+'/'+_0x15c7bf)[_0x0161('0x1f')](_0x500a43);}return null;};}function patchUpdates(_0x124db7){return function(_0x41aeb0){try{jsonpatch[_0x0161('0x20')](_0x41aeb0,_0x124db7,!![]);}catch(_0x17c88a){return BPromise['reject'](_0x17c88a);}return _0x41aeb0[_0x0161('0x21')]();};}function saveUpdates(_0xdcca85,_0x357c7b){return function(_0x3a0679){if(_0x3a0679){return _0x3a0679[_0x0161('0x22')](_0xdcca85)['then'](function(_0x3f78a9){return _0x3f78a9;});}return null;};}function removeEntity(_0x44f608,_0x579b74){return function(_0x5e0bc7){if(_0x5e0bc7){return _0x5e0bc7['destroy']()[_0x0161('0x23')](function(){_0x44f608[_0x0161('0x18')](0xcc)[_0x0161('0x17')]();});}};}function handleEntityNotFound(_0x1a3d56,_0x26b5d4){return function(_0x2409ee){if(!_0x2409ee){_0x1a3d56[_0x0161('0x24')](0x194);}return _0x2409ee;};}function handleError(_0x5780c1,_0x447f7b){_0x447f7b=_0x447f7b||0x1f4;return function(_0x417a33){logger[_0x0161('0x25')](_0x417a33['stack']);if(_0x417a33[_0x0161('0x26')]){delete _0x417a33[_0x0161('0x26')];}_0x5780c1[_0x0161('0x18')](_0x447f7b)[_0x0161('0x27')](_0x417a33);};}exports['index']=function(_0x1a6d7b,_0x55582f){var _0x16b64c={},_0x434fcb={},_0x28a2c3={'count':0x0,'rows':[]};var _0x16d486=_[_0x0161('0x28')](db[_0x0161('0x29')][_0x0161('0x2a')],function(_0x207009){return{'name':_0x207009[_0x0161('0x2b')],'type':_0x207009[_0x0161('0x2c')]['key']};});_0x434fcb[_0x0161('0x2d')]=_[_0x0161('0x28')](_0x16d486,'name');_0x434fcb[_0x0161('0x2e')]=_[_0x0161('0x2f')](_0x1a6d7b[_0x0161('0x2e')]);_0x434fcb[_0x0161('0x30')]=_[_0x0161('0x31')](_0x434fcb[_0x0161('0x2d')],_0x434fcb[_0x0161('0x2e')]);_0x16b64c['attributes']=_['intersection'](_0x434fcb[_0x0161('0x2d')],qs[_0x0161('0x32')](_0x1a6d7b[_0x0161('0x2e')]['fields']));_0x16b64c[_0x0161('0x33')]=_0x16b64c[_0x0161('0x33')]['length']?_0x16b64c['attributes']:_0x434fcb[_0x0161('0x2d')];if(!_0x1a6d7b[_0x0161('0x2e')][_0x0161('0x34')](_0x0161('0x35'))){_0x16b64c['limit']=qs['limit'](_0x1a6d7b[_0x0161('0x2e')][_0x0161('0x1c')]);_0x16b64c[_0x0161('0x19')]=qs[_0x0161('0x19')](_0x1a6d7b[_0x0161('0x2e')][_0x0161('0x19')]);}_0x16b64c[_0x0161('0x36')]=qs[_0x0161('0x37')](_0x1a6d7b[_0x0161('0x2e')][_0x0161('0x37')]);_0x16b64c[_0x0161('0x38')]=qs[_0x0161('0x30')](_['pick'](_0x1a6d7b[_0x0161('0x2e')],_0x434fcb['filters']),_0x16d486);if(_0x1a6d7b['query'][_0x0161('0x39')]){_0x16b64c[_0x0161('0x38')]=_[_0x0161('0x3a')](_0x16b64c[_0x0161('0x38')],{'$or':_[_0x0161('0x28')](_0x16d486,function(_0x1449c0){if(_0x1449c0[_0x0161('0x2c')]!==_0x0161('0x3b')){var _0xc25695={};_0xc25695[_0x1449c0[_0x0161('0x26')]]={'$like':'%'+_0x1a6d7b[_0x0161('0x2e')][_0x0161('0x39')]+'%'};return _0xc25695;}})});}_0x16b64c=_[_0x0161('0x3a')]({},_0x16b64c,_0x1a6d7b[_0x0161('0x3c')]);var _0x194325={'where':_0x16b64c[_0x0161('0x38')]};return db[_0x0161('0x29')]['count'](_0x194325)['then'](function(_0x53e024){_0x28a2c3[_0x0161('0x1b')]=_0x53e024;if(_0x1a6d7b[_0x0161('0x2e')][_0x0161('0x3d')]){_0x16b64c['include']=[{'all':!![]}];}return db[_0x0161('0x29')]['findAll'](_0x16b64c);})[_0x0161('0x23')](function(_0x3f0cd6){_0x28a2c3['rows']=_0x3f0cd6;return _0x28a2c3;})[_0x0161('0x23')](respondWithFilteredResult(_0x55582f,_0x16b64c))[_0x0161('0x3e')](handleError(_0x55582f,null));};exports[_0x0161('0x3f')]=function(_0x3c461e,_0x4c39f9){var _0x381876={'raw':![],'where':{'id':_0x3c461e[_0x0161('0x40')]['id']}},_0x527d7e={};_0x527d7e[_0x0161('0x2d')]=_[_0x0161('0x2f')](db[_0x0161('0x29')]['rawAttributes']);_0x527d7e['query']=_[_0x0161('0x2f')](_0x3c461e[_0x0161('0x2e')]);_0x527d7e['filters']=_[_0x0161('0x31')](_0x527d7e[_0x0161('0x2d')],_0x527d7e[_0x0161('0x2e')]);_0x381876[_0x0161('0x33')]=_[_0x0161('0x31')](_0x527d7e[_0x0161('0x2d')],qs[_0x0161('0x32')](_0x3c461e['query'][_0x0161('0x32')]));_0x381876[_0x0161('0x33')]=_0x381876[_0x0161('0x33')][_0x0161('0x41')]?_0x381876[_0x0161('0x33')]:_0x527d7e[_0x0161('0x2d')];if(_0x3c461e['query'][_0x0161('0x3d')]){_0x381876[_0x0161('0x42')]=[{'all':!![]}];}_0x381876=_[_0x0161('0x3a')]({},_0x381876,_0x3c461e['options']);return db[_0x0161('0x29')][_0x0161('0x43')](_0x381876)[_0x0161('0x23')](handleEntityNotFound(_0x4c39f9,null))['then'](respondWithResult(_0x4c39f9,null))[_0x0161('0x3e')](handleError(_0x4c39f9,null));};exports[_0x0161('0x44')]=function(_0x2ce9c8,_0xc5431){return db[_0x0161('0x29')][_0x0161('0x44')](_0x2ce9c8[_0x0161('0x45')],{})[_0x0161('0x23')](respondWithResult(_0xc5431,0xc9))[_0x0161('0x3e')](handleError(_0xc5431,null));};exports[_0x0161('0x22')]=function(_0x2639d4,_0x2ecd){if(_0x2639d4[_0x0161('0x45')]['id']){delete _0x2639d4[_0x0161('0x45')]['id'];}return db[_0x0161('0x29')][_0x0161('0x43')]({'where':{'id':_0x2639d4[_0x0161('0x40')]['id']}})['then'](handleEntityNotFound(_0x2ecd,null))[_0x0161('0x23')](saveUpdates(_0x2639d4[_0x0161('0x45')],null))[_0x0161('0x23')](respondWithResult(_0x2ecd,null))[_0x0161('0x3e')](handleError(_0x2ecd,null));};exports[_0x0161('0x46')]=function(_0x4e79d3,_0xa90749){return db['VtigerAccount'][_0x0161('0x43')]({'where':{'id':_0x4e79d3[_0x0161('0x40')]['id']}})[_0x0161('0x23')](handleEntityNotFound(_0xa90749,null))[_0x0161('0x23')](removeEntity(_0xa90749,null))[_0x0161('0x3e')](handleError(_0xa90749,null));};exports['getConfigurations']=function(_0x40fbdb,_0x3e2f5c,_0x587835){var _0x425f8a={};var _0x25af4c={};var _0x4e4ad6;var _0x2b4b64;return db[_0x0161('0x29')]['findOne']({'where':{'id':_0x40fbdb[_0x0161('0x40')]['id']}})['then'](handleEntityNotFound(_0x3e2f5c,null))['then'](function(_0x3905f0){if(_0x3905f0){_0x4e4ad6=_0x3905f0;_0x25af4c[_0x0161('0x2d')]=_[_0x0161('0x2f')](db[_0x0161('0x47')][_0x0161('0x2a')]);_0x25af4c[_0x0161('0x2e')]=_['keys'](_0x40fbdb[_0x0161('0x2e')]);_0x25af4c[_0x0161('0x30')]=_[_0x0161('0x31')](_0x25af4c['model'],_0x25af4c['query']);_0x425f8a[_0x0161('0x33')]=_['intersection'](_0x25af4c[_0x0161('0x2d')],qs[_0x0161('0x32')](_0x40fbdb[_0x0161('0x2e')]['fields']));_0x425f8a['attributes']=_0x425f8a[_0x0161('0x33')][_0x0161('0x41')]?_0x425f8a[_0x0161('0x33')]:_0x25af4c[_0x0161('0x2d')];_0x425f8a['order']=qs[_0x0161('0x37')](_0x40fbdb['query'][_0x0161('0x37')]);_0x425f8a[_0x0161('0x38')]=qs[_0x0161('0x30')](_[_0x0161('0x48')](_0x40fbdb[_0x0161('0x2e')],_0x25af4c[_0x0161('0x30')]));if(_0x40fbdb['query'][_0x0161('0x39')]){_0x425f8a[_0x0161('0x38')]=_['merge'](_0x425f8a[_0x0161('0x38')],{'$or':_['map'](_0x425f8a['attributes'],function(_0x114d0a){var _0x20348d={};_0x20348d[_0x114d0a]={'$like':'%'+_0x40fbdb[_0x0161('0x2e')][_0x0161('0x39')]+'%'};return _0x20348d;})});}_0x425f8a=_['merge']({},_0x425f8a,_0x40fbdb[_0x0161('0x3c')]);return _0x4e4ad6['getConfigurations'](_0x425f8a);}})[_0x0161('0x23')](function(_0x10b84c){if(_0x10b84c){_0x2b4b64=_0x10b84c[_0x0161('0x41')];if(!_0x40fbdb['query'][_0x0161('0x34')](_0x0161('0x35'))){_0x425f8a[_0x0161('0x1c')]=qs[_0x0161('0x1c')](_0x40fbdb[_0x0161('0x2e')]['limit']);_0x425f8a[_0x0161('0x19')]=qs[_0x0161('0x19')](_0x40fbdb['query'][_0x0161('0x19')]);}return _0x4e4ad6[_0x0161('0x49')](_0x425f8a);}})['then'](function(_0x4a9a9e){if(_0x4a9a9e){return _0x4a9a9e?{'count':_0x2b4b64,'rows':_0x4a9a9e}:null;}})['then'](respondWithResult(_0x3e2f5c,null))[_0x0161('0x3e')](handleError(_0x3e2f5c,null));};exports[_0x0161('0x4a')]=function(_0xf453fc,_0x2972ae,_0xa62215){if(_0xf453fc[_0x0161('0x45')]['id']){delete _0xf453fc[_0x0161('0x45')]['id'];}return db[_0x0161('0x29')][_0x0161('0x4b')]({'where':{'id':_0xf453fc['params']['id']}})[_0x0161('0x23')](handleEntityNotFound(_0x2972ae,null))['then'](function(_0x42ff99){if(_0x42ff99){_0xf453fc[_0x0161('0x45')][_0x0161('0x4c')]=_0x42ff99['id'];_0xf453fc[_0x0161('0x45')][_0x0161('0x4d')]=integrations[_0x0161('0x4e')](_0xf453fc[_0x0161('0x45')][_0x0161('0x4f')],_0xf453fc[_0x0161('0x45')][_0x0161('0x2c')]);_0xf453fc[_0x0161('0x45')][_0x0161('0x50')]=integrations[_0x0161('0x51')](_0xf453fc[_0x0161('0x45')]['channel'],_0xf453fc[_0x0161('0x45')][_0x0161('0x2c')]);return db[_0x0161('0x47')]['create'](_0xf453fc[_0x0161('0x45')],{'include':[{'model':db[_0x0161('0x52')],'as':_0x0161('0x4d')},{'model':db[_0x0161('0x52')],'as':_0x0161('0x50')}]});}return null;})[_0x0161('0x23')](respondWithResult(_0x2972ae,null))[_0x0161('0x3e')](handleError(_0x2972ae,null));};var md5=require(_0x0161('0x53'));exports[_0x0161('0x54')]=function(_0x525d50,_0x4bc825,_0x8914b4){var _0x599b0f=null;var _0x9e3b6f=null;var _0x55fa5c=null;var _0x4760bd=null;var _0x568ef8='';return db[_0x0161('0x29')]['findOne']({'where':{'id':_0x525d50[_0x0161('0x40')]['id']},'attributes':['id',_0x0161('0x26'),_0x0161('0x55'),'description',_0x0161('0x56'),_0x0161('0x57'),_0x0161('0x58'),_0x0161('0x59')]})[_0x0161('0x23')](handleEntityNotFound(_0x4bc825,null))[_0x0161('0x23')](function(_0x383f5a){if(_0x383f5a){_0x599b0f=_0x383f5a[_0x0161('0x55')];_0x9e3b6f=_0x383f5a[_0x0161('0x59')];_0x55fa5c=_0x383f5a[_0x0161('0x56')];_0x568ef8=_0x383f5a['remoteUri'];var _0x2706d2=_0x568ef8[_0x0161('0x5a')](-0x1);if(_0x2706d2==='/'){_0x568ef8=_0x568ef8[_0x0161('0x5b')](0x0,_0x568ef8[_0x0161('0x5c')](_0x2706d2));}_0x4760bd=util[_0x0161('0x5d')](_0x0161('0x5e'),_0x568ef8);var _0x33329c={'method':_0x0161('0x5f'),'uri':_0x4760bd,'qs':{'operation':'getchallenge','username':_0x383f5a[_0x0161('0x55')]},'json':!![]};return rp(_0x33329c);}})[_0x0161('0x23')](function(_0x5a61d9){if(_0x5a61d9[_0x0161('0x60')]){var _0x4d7d72={'method':_0x0161('0x61'),'uri':_0x4760bd,'form':{'operation':_0x0161('0x62'),'username':_0x599b0f,'accessKey':md5(_0x5a61d9[_0x0161('0x63')][_0x0161('0x64')]+_0x9e3b6f)},'json':!![]};return rp(_0x4d7d72);}})[_0x0161('0x23')](function(_0x45a8a7){if(_0x45a8a7[_0x0161('0x60')]){var _0x11125a={'method':'GET','uri':_0x4760bd,'qs':{'operation':_0x0161('0x65'),'username':_0x599b0f,'sessionName':_0x45a8a7[_0x0161('0x63')][_0x0161('0x66')],'elementType':_0x55fa5c},'json':!![]};return rp(_0x11125a);}})[_0x0161('0x23')](function(_0x37b3ce){if(_0x37b3ce['success']){var _0x1166b9=[_0x0161('0x67'),_0x0161('0x68'),'owner'];_[_0x0161('0x69')](_0x37b3ce[_0x0161('0x63')][_0x0161('0x32')],function(_0x4d3c43){return _0x1166b9[_0x0161('0x6a')](_0x4d3c43['type']['name']);});_['remove'](_0x37b3ce[_0x0161('0x63')][_0x0161('0x32')],function(_0x42b48c){return _0x42b48c['editable']===_0x0161('0x6b');});return{'count':_0x37b3ce[_0x0161('0x63')]['fields']['length'],'rows':_[_0x0161('0x28')](_0x37b3ce[_0x0161('0x63')][_0x0161('0x32')],function(_0x3c573d){return{'id':_0x3c573d[_0x0161('0x26')],'name':_0x3c573d[_0x0161('0x6c')],'custom':_[_0x0161('0x6d')](_0x3c573d[_0x0161('0x26')],_0x0161('0x6e'))?!![]:![],'options':_0x3c573d[_0x0161('0x2c')]['name']==='picklist'&&_0x3c573d[_0x0161('0x2c')]['picklistValues'][_0x0161('0x41')]>0x0?_[_0x0161('0x28')](_0x3c573d[_0x0161('0x2c')]['picklistValues'],function(_0x236783){return{'name':_0x236783['label'],'value':_0x236783['value']};}):[]};})};}})['then'](respondWithResult(_0x4bc825,null))['catch'](function(_0x29da2b){console[_0x0161('0x6f')](_0x0161('0x70')+_0x29da2b);var _0xfaa22e=_0x525d50[_0x0161('0x2e')][_0x0161('0x71')]?0x1f4:_0x29da2b[_0x0161('0x72')]||0x1f4;logger['error'](_0x0161('0x73'),_0x0161('0x54'),_0xfaa22e,JSON['stringify'](_0x29da2b));delete _0x29da2b['name'];if(_0xfaa22e===0x191){_0xfaa22e=0x190;}_0x4bc825[_0x0161('0x18')](_0xfaa22e)['send'](_0x525d50[_0x0161('0x2e')][_0x0161('0x71')]?{'message':_0x0161('0x74'),'statusCode':_0x29da2b[_0x0161('0x72')]}:_0x29da2b);});}; \ No newline at end of file +var _0xb3ec=['stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','length','catch','create','body','find','params','getConfigurations','findOne','VtigerConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','moduleName','serverUrl','remoteUri','lastIndexOf','format','%s/webservice.php','GET','getchallenge','POST','login','token','result','sessionName','autogenerated','remove','includes','false','label','startsWith','cf_','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','error'];(function(_0x1030ce,_0xbe3f74){var _0x3367fd=function(_0x387153){while(--_0x387153){_0x1030ce['push'](_0x1030ce['shift']());}};_0x3367fd(++_0xbe3f74);}(_0xb3ec,0x1b1));var _0xcb3e=function(_0x405300,_0x512d8c){_0x405300=_0x405300-0x0;var _0x3d0086=_0xb3ec[_0x405300];return _0x3d0086;};'use strict';var emlformat=require(_0xcb3e('0x0'));var rimraf=require(_0xcb3e('0x1'));var zipdir=require(_0xcb3e('0x2'));var jsonpatch=require(_0xcb3e('0x3'));var rp=require(_0xcb3e('0x4'));var moment=require(_0xcb3e('0x5'));var BPromise=require(_0xcb3e('0x6'));var Mustache=require(_0xcb3e('0x7'));var util=require(_0xcb3e('0x8'));var path=require('path');var sox=require(_0xcb3e('0x9'));var csv=require(_0xcb3e('0xa'));var ejs=require(_0xcb3e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcb3e('0xc'));var squel=require('squel');var crypto=require(_0xcb3e('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcb3e('0xe'));var authService=require(_0xcb3e('0xf'));var qs=require(_0xcb3e('0x10'));var as=require(_0xcb3e('0x11'));var hardwareService=require(_0xcb3e('0x12'));var logger=require(_0xcb3e('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xcb3e('0x14'));var licenseUtil=require(_0xcb3e('0x15'));var db=require(_0xcb3e('0x16'))['db'];var integrations=require(_0xcb3e('0x17'));function respondWithStatusCode(_0x5436da,_0x28ed61){_0x28ed61=_0x28ed61||0xcc;return function(_0x2f958f){if(_0x2f958f){return _0x5436da[_0xcb3e('0x18')](_0x28ed61);}return _0x5436da['status'](_0x28ed61)[_0xcb3e('0x19')]();};}function respondWithResult(_0x139ead,_0x414ad2){_0x414ad2=_0x414ad2||0xc8;return function(_0x115132){if(_0x115132){return _0x139ead[_0xcb3e('0x1a')](_0x414ad2)[_0xcb3e('0x1b')](_0x115132);}};}function respondWithFilteredResult(_0x2cca82,_0x41c03e){return function(_0x36425e){if(_0x36425e){var _0x2f590d=typeof _0x41c03e[_0xcb3e('0x1c')]===_0xcb3e('0x1d')&&typeof _0x41c03e[_0xcb3e('0x1e')]===_0xcb3e('0x1d');var _0x3be8bd=_0x36425e[_0xcb3e('0x1f')];var _0x339735=_0x2f590d?0x0:_0x41c03e[_0xcb3e('0x1c')];var _0x3cf620=_0x2f590d?_0x36425e['count']:_0x41c03e[_0xcb3e('0x1c')]+_0x41c03e[_0xcb3e('0x1e')];var _0x53bd25;if(_0x3cf620>=_0x3be8bd){_0x3cf620=_0x3be8bd;_0x53bd25=0xc8;}else{_0x53bd25=0xce;}_0x2cca82[_0xcb3e('0x1a')](_0x53bd25);return _0x2cca82['set'](_0xcb3e('0x20'),_0x339735+'-'+_0x3cf620+'/'+_0x3be8bd)[_0xcb3e('0x1b')](_0x36425e);}return null;};}function patchUpdates(_0x2aae71){return function(_0x37b597){try{jsonpatch['apply'](_0x37b597,_0x2aae71,!![]);}catch(_0x4d2909){return BPromise[_0xcb3e('0x21')](_0x4d2909);}return _0x37b597[_0xcb3e('0x22')]();};}function saveUpdates(_0x4baaa9,_0x103e45){return function(_0x76f2b7){if(_0x76f2b7){return _0x76f2b7[_0xcb3e('0x23')](_0x4baaa9)[_0xcb3e('0x24')](function(_0x6864a6){return _0x6864a6;});}return null;};}function removeEntity(_0x1c3a1b,_0x158b0e){return function(_0x52eca8){if(_0x52eca8){return _0x52eca8[_0xcb3e('0x25')]()['then'](function(){_0x1c3a1b[_0xcb3e('0x1a')](0xcc)[_0xcb3e('0x19')]();});}};}function handleEntityNotFound(_0x234864,_0x41e5ba){return function(_0x4d2b3e){if(!_0x4d2b3e){_0x234864[_0xcb3e('0x18')](0x194);}return _0x4d2b3e;};}function handleError(_0x445fc7,_0x251de1){_0x251de1=_0x251de1||0x1f4;return function(_0x598377){logger[_0xcb3e('0x26')](_0x598377[_0xcb3e('0x27')]);if(_0x598377[_0xcb3e('0x28')]){delete _0x598377[_0xcb3e('0x28')];}_0x445fc7[_0xcb3e('0x1a')](_0x251de1)[_0xcb3e('0x29')](_0x598377);};}exports[_0xcb3e('0x2a')]=function(_0x9be4bd,_0x21e4df){var _0x61eed0={},_0x5357f2={},_0x1f0489={'count':0x0,'rows':[]};var _0x4c752b=_[_0xcb3e('0x2b')](db[_0xcb3e('0x2c')][_0xcb3e('0x2d')],function(_0x55bf3d){return{'name':_0x55bf3d[_0xcb3e('0x2e')],'type':_0x55bf3d[_0xcb3e('0x2f')][_0xcb3e('0x30')]};});_0x5357f2[_0xcb3e('0x31')]=_[_0xcb3e('0x2b')](_0x4c752b,_0xcb3e('0x28'));_0x5357f2[_0xcb3e('0x32')]=_[_0xcb3e('0x33')](_0x9be4bd['query']);_0x5357f2[_0xcb3e('0x34')]=_['intersection'](_0x5357f2[_0xcb3e('0x31')],_0x5357f2['query']);_0x61eed0[_0xcb3e('0x35')]=_[_0xcb3e('0x36')](_0x5357f2[_0xcb3e('0x31')],qs[_0xcb3e('0x37')](_0x9be4bd[_0xcb3e('0x32')]['fields']));_0x61eed0['attributes']=_0x61eed0[_0xcb3e('0x35')]['length']?_0x61eed0[_0xcb3e('0x35')]:_0x5357f2[_0xcb3e('0x31')];if(!_0x9be4bd['query'][_0xcb3e('0x38')](_0xcb3e('0x39'))){_0x61eed0[_0xcb3e('0x1e')]=qs[_0xcb3e('0x1e')](_0x9be4bd[_0xcb3e('0x32')][_0xcb3e('0x1e')]);_0x61eed0[_0xcb3e('0x1c')]=qs[_0xcb3e('0x1c')](_0x9be4bd[_0xcb3e('0x32')][_0xcb3e('0x1c')]);}_0x61eed0[_0xcb3e('0x3a')]=qs[_0xcb3e('0x3b')](_0x9be4bd[_0xcb3e('0x32')][_0xcb3e('0x3b')]);_0x61eed0[_0xcb3e('0x3c')]=qs['filters'](_[_0xcb3e('0x3d')](_0x9be4bd[_0xcb3e('0x32')],_0x5357f2[_0xcb3e('0x34')]),_0x4c752b);if(_0x9be4bd[_0xcb3e('0x32')][_0xcb3e('0x3e')]){_0x61eed0[_0xcb3e('0x3c')]=_[_0xcb3e('0x3f')](_0x61eed0[_0xcb3e('0x3c')],{'$or':_['map'](_0x4c752b,function(_0x11180c){if(_0x11180c[_0xcb3e('0x2f')]!==_0xcb3e('0x40')){var _0x41f60e={};_0x41f60e[_0x11180c[_0xcb3e('0x28')]]={'$like':'%'+_0x9be4bd[_0xcb3e('0x32')][_0xcb3e('0x3e')]+'%'};return _0x41f60e;}})});}_0x61eed0=_['merge']({},_0x61eed0,_0x9be4bd[_0xcb3e('0x41')]);var _0x87c537={'where':_0x61eed0['where']};return db['VtigerAccount'][_0xcb3e('0x1f')](_0x87c537)[_0xcb3e('0x24')](function(_0xe913e5){_0x1f0489['count']=_0xe913e5;if(_0x9be4bd[_0xcb3e('0x32')][_0xcb3e('0x42')]){_0x61eed0[_0xcb3e('0x43')]=[{'all':!![]}];}return db['VtigerAccount'][_0xcb3e('0x44')](_0x61eed0);})[_0xcb3e('0x24')](function(_0xaba8bf){_0x1f0489[_0xcb3e('0x45')]=_0xaba8bf;return _0x1f0489;})[_0xcb3e('0x24')](respondWithFilteredResult(_0x21e4df,_0x61eed0))['catch'](handleError(_0x21e4df,null));};exports[_0xcb3e('0x46')]=function(_0x265597,_0x46b4d1){var _0xb02c58={'raw':![],'where':{'id':_0x265597['params']['id']}},_0x28192f={};_0x28192f[_0xcb3e('0x31')]=_[_0xcb3e('0x33')](db[_0xcb3e('0x2c')][_0xcb3e('0x2d')]);_0x28192f['query']=_['keys'](_0x265597['query']);_0x28192f[_0xcb3e('0x34')]=_[_0xcb3e('0x36')](_0x28192f[_0xcb3e('0x31')],_0x28192f['query']);_0xb02c58[_0xcb3e('0x35')]=_[_0xcb3e('0x36')](_0x28192f[_0xcb3e('0x31')],qs[_0xcb3e('0x37')](_0x265597[_0xcb3e('0x32')][_0xcb3e('0x37')]));_0xb02c58['attributes']=_0xb02c58['attributes'][_0xcb3e('0x47')]?_0xb02c58[_0xcb3e('0x35')]:_0x28192f['model'];if(_0x265597[_0xcb3e('0x32')][_0xcb3e('0x42')]){_0xb02c58[_0xcb3e('0x43')]=[{'all':!![]}];}_0xb02c58=_[_0xcb3e('0x3f')]({},_0xb02c58,_0x265597[_0xcb3e('0x41')]);return db[_0xcb3e('0x2c')]['find'](_0xb02c58)[_0xcb3e('0x24')](handleEntityNotFound(_0x46b4d1,null))['then'](respondWithResult(_0x46b4d1,null))[_0xcb3e('0x48')](handleError(_0x46b4d1,null));};exports['create']=function(_0x159bac,_0x198487){return db[_0xcb3e('0x2c')][_0xcb3e('0x49')](_0x159bac['body'],{})[_0xcb3e('0x24')](respondWithResult(_0x198487,0xc9))['catch'](handleError(_0x198487,null));};exports[_0xcb3e('0x23')]=function(_0x3725b8,_0x58e466){if(_0x3725b8[_0xcb3e('0x4a')]['id']){delete _0x3725b8[_0xcb3e('0x4a')]['id'];}return db['VtigerAccount'][_0xcb3e('0x4b')]({'where':{'id':_0x3725b8[_0xcb3e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x58e466,null))[_0xcb3e('0x24')](saveUpdates(_0x3725b8[_0xcb3e('0x4a')],null))[_0xcb3e('0x24')](respondWithResult(_0x58e466,null))[_0xcb3e('0x48')](handleError(_0x58e466,null));};exports[_0xcb3e('0x25')]=function(_0x151517,_0x3d8740){return db[_0xcb3e('0x2c')]['find']({'where':{'id':_0x151517[_0xcb3e('0x4c')]['id']}})[_0xcb3e('0x24')](handleEntityNotFound(_0x3d8740,null))[_0xcb3e('0x24')](removeEntity(_0x3d8740,null))[_0xcb3e('0x48')](handleError(_0x3d8740,null));};exports[_0xcb3e('0x4d')]=function(_0x1f9878,_0x26b27a,_0x2c67fd){var _0xce7cdf={};var _0x1b5507={};var _0x4a0e1e;var _0x5a036d;return db['VtigerAccount'][_0xcb3e('0x4e')]({'where':{'id':_0x1f9878['params']['id']}})[_0xcb3e('0x24')](handleEntityNotFound(_0x26b27a,null))[_0xcb3e('0x24')](function(_0x3949e8){if(_0x3949e8){_0x4a0e1e=_0x3949e8;_0x1b5507[_0xcb3e('0x31')]=_['keys'](db[_0xcb3e('0x4f')][_0xcb3e('0x2d')]);_0x1b5507[_0xcb3e('0x32')]=_['keys'](_0x1f9878[_0xcb3e('0x32')]);_0x1b5507[_0xcb3e('0x34')]=_[_0xcb3e('0x36')](_0x1b5507[_0xcb3e('0x31')],_0x1b5507[_0xcb3e('0x32')]);_0xce7cdf[_0xcb3e('0x35')]=_[_0xcb3e('0x36')](_0x1b5507['model'],qs[_0xcb3e('0x37')](_0x1f9878['query']['fields']));_0xce7cdf[_0xcb3e('0x35')]=_0xce7cdf[_0xcb3e('0x35')][_0xcb3e('0x47')]?_0xce7cdf[_0xcb3e('0x35')]:_0x1b5507[_0xcb3e('0x31')];_0xce7cdf[_0xcb3e('0x3a')]=qs['sort'](_0x1f9878[_0xcb3e('0x32')][_0xcb3e('0x3b')]);_0xce7cdf[_0xcb3e('0x3c')]=qs[_0xcb3e('0x34')](_[_0xcb3e('0x3d')](_0x1f9878[_0xcb3e('0x32')],_0x1b5507[_0xcb3e('0x34')]));if(_0x1f9878['query'][_0xcb3e('0x3e')]){_0xce7cdf['where']=_[_0xcb3e('0x3f')](_0xce7cdf[_0xcb3e('0x3c')],{'$or':_[_0xcb3e('0x2b')](_0xce7cdf['attributes'],function(_0x17cb28){var _0x4f6183={};_0x4f6183[_0x17cb28]={'$like':'%'+_0x1f9878[_0xcb3e('0x32')][_0xcb3e('0x3e')]+'%'};return _0x4f6183;})});}_0xce7cdf=_[_0xcb3e('0x3f')]({},_0xce7cdf,_0x1f9878[_0xcb3e('0x41')]);return _0x4a0e1e[_0xcb3e('0x4d')](_0xce7cdf);}})[_0xcb3e('0x24')](function(_0x5dd273){if(_0x5dd273){_0x5a036d=_0x5dd273[_0xcb3e('0x47')];if(!_0x1f9878[_0xcb3e('0x32')][_0xcb3e('0x38')]('nolimit')){_0xce7cdf['limit']=qs[_0xcb3e('0x1e')](_0x1f9878[_0xcb3e('0x32')][_0xcb3e('0x1e')]);_0xce7cdf['offset']=qs[_0xcb3e('0x1c')](_0x1f9878[_0xcb3e('0x32')][_0xcb3e('0x1c')]);}return _0x4a0e1e[_0xcb3e('0x4d')](_0xce7cdf);}})[_0xcb3e('0x24')](function(_0x2ba926){if(_0x2ba926){return _0x2ba926?{'count':_0x5a036d,'rows':_0x2ba926}:null;}})['then'](respondWithResult(_0x26b27a,null))['catch'](handleError(_0x26b27a,null));};exports['addConfiguration']=function(_0x20efbc,_0x99bc9e,_0xd3f19d){if(_0x20efbc[_0xcb3e('0x4a')]['id']){delete _0x20efbc[_0xcb3e('0x4a')]['id'];}return db[_0xcb3e('0x2c')][_0xcb3e('0x4e')]({'where':{'id':_0x20efbc[_0xcb3e('0x4c')]['id']}})[_0xcb3e('0x24')](handleEntityNotFound(_0x99bc9e,null))[_0xcb3e('0x24')](function(_0x3a16af){if(_0x3a16af){_0x20efbc['body']['AccountId']=_0x3a16af['id'];_0x20efbc[_0xcb3e('0x4a')][_0xcb3e('0x50')]=integrations[_0xcb3e('0x51')](_0x20efbc[_0xcb3e('0x4a')][_0xcb3e('0x52')],_0x20efbc[_0xcb3e('0x4a')][_0xcb3e('0x2f')]);_0x20efbc['body'][_0xcb3e('0x53')]=integrations[_0xcb3e('0x54')](_0x20efbc[_0xcb3e('0x4a')][_0xcb3e('0x52')],_0x20efbc['body'][_0xcb3e('0x2f')]);return db[_0xcb3e('0x4f')][_0xcb3e('0x49')](_0x20efbc[_0xcb3e('0x4a')],{'include':[{'model':db['VtigerField'],'as':_0xcb3e('0x50')},{'model':db[_0xcb3e('0x55')],'as':_0xcb3e('0x53')}]});}return null;})[_0xcb3e('0x24')](respondWithResult(_0x99bc9e,null))[_0xcb3e('0x48')](handleError(_0x99bc9e,null));};var md5=require(_0xcb3e('0x56'));exports[_0xcb3e('0x57')]=function(_0xb741bb,_0x1c2bc1,_0xdd7a8a){var _0x40acde=null;var _0x5442d0=null;var _0x5dfe4f=null;var _0x48808e=null;var _0x25a3dd='';return db[_0xcb3e('0x2c')][_0xcb3e('0x4e')]({'where':{'id':_0xb741bb[_0xcb3e('0x4c')]['id']},'attributes':['id',_0xcb3e('0x28'),_0xcb3e('0x58'),_0xcb3e('0x59'),_0xcb3e('0x5a'),'remoteUri',_0xcb3e('0x5b'),'accessKey']})[_0xcb3e('0x24')](handleEntityNotFound(_0x1c2bc1,null))[_0xcb3e('0x24')](function(_0x1fe137){if(_0x1fe137){_0x40acde=_0x1fe137[_0xcb3e('0x58')];_0x5442d0=_0x1fe137['accessKey'];_0x5dfe4f=_0x1fe137[_0xcb3e('0x5a')];_0x25a3dd=_0x1fe137[_0xcb3e('0x5c')];var _0x178960=_0x25a3dd['slice'](-0x1);if(_0x178960==='/'){_0x25a3dd=_0x25a3dd['substring'](0x0,_0x25a3dd[_0xcb3e('0x5d')](_0x178960));}_0x48808e=util[_0xcb3e('0x5e')](_0xcb3e('0x5f'),_0x25a3dd);var _0x11eb4a={'method':_0xcb3e('0x60'),'uri':_0x48808e,'qs':{'operation':_0xcb3e('0x61'),'username':_0x1fe137[_0xcb3e('0x58')]},'json':!![]};return rp(_0x11eb4a);}})['then'](function(_0xca9b3e){if(_0xca9b3e['success']){var _0x1a4e50={'method':_0xcb3e('0x62'),'uri':_0x48808e,'form':{'operation':_0xcb3e('0x63'),'username':_0x40acde,'accessKey':md5(_0xca9b3e['result'][_0xcb3e('0x64')]+_0x5442d0)},'json':!![]};return rp(_0x1a4e50);}})['then'](function(_0x2047f8){if(_0x2047f8['success']){var _0x32ae26={'method':_0xcb3e('0x60'),'uri':_0x48808e,'qs':{'operation':'describe','username':_0x40acde,'sessionName':_0x2047f8[_0xcb3e('0x65')][_0xcb3e('0x66')],'elementType':_0x5dfe4f},'json':!![]};return rp(_0x32ae26);}})[_0xcb3e('0x24')](function(_0x1de531){if(_0x1de531['success']){var _0x21fd71=[_0xcb3e('0x67'),'reference','owner'];_[_0xcb3e('0x68')](_0x1de531[_0xcb3e('0x65')]['fields'],function(_0x522d51){return _0x21fd71[_0xcb3e('0x69')](_0x522d51[_0xcb3e('0x2f')][_0xcb3e('0x28')]);});_[_0xcb3e('0x68')](_0x1de531[_0xcb3e('0x65')][_0xcb3e('0x37')],function(_0x950ed6){return _0x950ed6['editable']===_0xcb3e('0x6a');});return{'count':_0x1de531[_0xcb3e('0x65')][_0xcb3e('0x37')][_0xcb3e('0x47')],'rows':_[_0xcb3e('0x2b')](_0x1de531[_0xcb3e('0x65')]['fields'],function(_0x4e4932){return{'id':_0x4e4932['name'],'name':_0x4e4932[_0xcb3e('0x6b')],'custom':_[_0xcb3e('0x6c')](_0x4e4932[_0xcb3e('0x28')],_0xcb3e('0x6d'))?!![]:![],'options':_0x4e4932['type'][_0xcb3e('0x28')]==='picklist'&&_0x4e4932[_0xcb3e('0x2f')][_0xcb3e('0x6e')][_0xcb3e('0x47')]>0x0?_[_0xcb3e('0x2b')](_0x4e4932['type']['picklistValues'],function(_0x5a994c){return{'name':_0x5a994c['label'],'value':_0x5a994c[_0xcb3e('0x6f')]};}):[]};})};}})[_0xcb3e('0x24')](respondWithResult(_0x1c2bc1,null))[_0xcb3e('0x48')](function(_0x3361ff){console[_0xcb3e('0x70')](_0xcb3e('0x71')+_0x3361ff);var _0x267d01=_0xb741bb[_0xcb3e('0x32')][_0xcb3e('0x72')]?0x1f4:_0x3361ff[_0xcb3e('0x73')]||0x1f4;logger[_0xcb3e('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0xcb3e('0x57'),_0x267d01,JSON[_0xcb3e('0x74')](_0x3361ff));delete _0x3361ff['name'];if(_0x267d01===0x191){_0x267d01=0x190;}_0x1c2bc1[_0xcb3e('0x1a')](_0x267d01)[_0xcb3e('0x29')](_0xb741bb['query'][_0xcb3e('0x72')]?{'message':_0xcb3e('0x75'),'statusCode':_0x3361ff[_0xcb3e('0x73')]}:_0x3361ff);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 711a535..0f773ee 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 _0x4656=['int_vtiger_accounts','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4656,0x1e2));var _0x6465=function(_0xf16b1,_0x33c637){_0xf16b1=_0xf16b1-0x0;var _0x26f94d=_0x4656[_0xf16b1];return _0x26f94d;};'use strict';var _=require('lodash');var util=require(_0x6465('0x0'));var logger=require(_0x6465('0x1'))(_0x6465('0x2'));var moment=require(_0x6465('0x3'));var BPromise=require(_0x6465('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6465('0x5'));var rimraf=require('rimraf');var config=require(_0x6465('0x6'));var attributes=require(_0x6465('0x7'));var integrations=require(_0x6465('0x8'));module[_0x6465('0x9')]=function(_0x53ec10,_0x383b47){return _0x53ec10[_0x6465('0xa')](_0x6465('0xb'),attributes,{'tableName':_0x6465('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0bb0=['bluebird','request-promise','../../components/integrations/configuration','exports','define','VtigerAccount','lodash','../../config/logger','api','moment'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x0bb0,0x11e));var _0x00bb=function(_0x11d406,_0x366fcb){_0x11d406=_0x11d406-0x0;var _0x411305=_0x0bb0[_0x11d406];return _0x411305;};'use strict';var _=require(_0x00bb('0x0'));var util=require('util');var logger=require(_0x00bb('0x1'))(_0x00bb('0x2'));var moment=require(_0x00bb('0x3'));var BPromise=require(_0x00bb('0x4'));var rp=require(_0x00bb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x00bb('0x6'));module[_0x00bb('0x7')]=function(_0x2cbaa5,_0x237e7c){return _0x2cbaa5[_0x00bb('0x8')](_0x00bb('0x9'),attributes,{'tableName':'int_vtiger_accounts','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 4f2c713..bc2e81f 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 _0x1775=['stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','result','catch','GetVtigerAccount','VtigerAccount','options','raw','where','attributes','limit','map','include','model','ShowVtigerAccount','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0xf9b042,_0x452962){var _0x4a5894=function(_0x47a0e1){while(--_0x47a0e1){_0xf9b042['push'](_0xf9b042['shift']());}};_0x4a5894(++_0x452962);}(_0x1775,0x1db));var _0x5177=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x1775[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x5177('0x0'));var moment=require(_0x5177('0x1'));var BPromise=require(_0x5177('0x2'));var rs=require(_0x5177('0x3'));var fs=require('fs');var Redis=require(_0x5177('0x4'));var db=require(_0x5177('0x5'))['db'];var utils=require(_0x5177('0x6'));var logger=require(_0x5177('0x7'))(_0x5177('0x8'));var config=require(_0x5177('0x9'));var jayson=require(_0x5177('0xa'));var client=jayson[_0x5177('0xb')][_0x5177('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2ac1c6,_0x300b43,_0x245c12){return new BPromise(function(_0x363611,_0x3ce288){return client[_0x5177('0xd')](_0x2ac1c6,_0x245c12)[_0x5177('0xe')](function(_0x2c23d8){logger[_0x5177('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x300b43,'request\x20sent');logger[_0x5177('0x10')](_0x5177('0x11'),_0x300b43,_0x5177('0x12'),JSON[_0x5177('0x13')](_0x2c23d8));if(_0x2c23d8[_0x5177('0x14')]){if(_0x2c23d8['error'][_0x5177('0x15')]===0x1f4){logger[_0x5177('0x14')](_0x5177('0x16'),_0x300b43,_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);return _0x3ce288(_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);}logger[_0x5177('0x14')](_0x5177('0x16'),_0x300b43,_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);return _0x363611(_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);}else{logger[_0x5177('0xf')](_0x5177('0x16'),_0x300b43,_0x5177('0x12'));_0x363611(_0x2c23d8[_0x5177('0x18')][_0x5177('0x17')]);}})[_0x5177('0x19')](function(_0x50ce2c){logger[_0x5177('0x14')](_0x5177('0x16'),_0x300b43,_0x50ce2c);_0x3ce288(_0x50ce2c);});});}exports[_0x5177('0x1a')]=function(_0x1b4102){var _0x5f5bd4=this;return new Promise(function(_0x3e6944,_0x2ebf91){return db[_0x5177('0x1b')]['findAll']({'raw':_0x1b4102[_0x5177('0x1c')]?_0x1b4102['options'][_0x5177('0x1d')]===undefined?!![]:![]:!![],'where':_0x1b4102[_0x5177('0x1c')]?_0x1b4102[_0x5177('0x1c')][_0x5177('0x1e')]||null:null,'attributes':_0x1b4102[_0x5177('0x1c')]?_0x1b4102[_0x5177('0x1c')][_0x5177('0x1f')]||null:null,'limit':_0x1b4102[_0x5177('0x1c')]?_0x1b4102[_0x5177('0x1c')][_0x5177('0x20')]||null:null,'include':_0x1b4102[_0x5177('0x1c')]?_0x1b4102[_0x5177('0x1c')]['include']?_[_0x5177('0x21')](_0x1b4102['options'][_0x5177('0x22')],function(_0x2c68d8){return{'model':db[_0x2c68d8[_0x5177('0x23')]],'as':_0x2c68d8['as'],'attributes':_0x2c68d8[_0x5177('0x1f')],'include':_0x2c68d8['include']?_[_0x5177('0x21')](_0x2c68d8['include'],function(_0x564139){return{'model':db[_0x564139[_0x5177('0x23')]],'as':_0x564139['as'],'attributes':_0x564139[_0x5177('0x1f')],'include':_0x564139['include']?_[_0x5177('0x21')](_0x564139['include'],function(_0x231d35){return{'model':db[_0x231d35[_0x5177('0x23')]],'as':_0x231d35['as'],'attributes':_0x231d35['attributes']};}):[]};}):[]};}):[]:[]})[_0x5177('0xe')](function(_0x2554ec){logger[_0x5177('0xf')](_0x5177('0x1a'),_0x1b4102);logger[_0x5177('0x10')](_0x5177('0x1a'),_0x1b4102,JSON['stringify'](_0x2554ec));_0x3e6944(_0x2554ec);})['catch'](function(_0x45cf20){logger[_0x5177('0x14')](_0x5177('0x1a'),_0x45cf20[_0x5177('0x17')],_0x1b4102);_0x2ebf91(_0x5f5bd4[_0x5177('0x14')](0x1f4,_0x45cf20[_0x5177('0x17')]));});});};exports[_0x5177('0x24')]=function(_0x72dced){var _0x49f6f1=this;return new Promise(function(_0x42e1db,_0x2233a2){return db['VtigerAccount'][_0x5177('0x25')]({'raw':_0x72dced['options']?_0x72dced[_0x5177('0x1c')][_0x5177('0x1d')]===undefined?!![]:![]:!![],'where':_0x72dced[_0x5177('0x1c')]?_0x72dced['options']['where']||null:null,'attributes':_0x72dced[_0x5177('0x1c')]?_0x72dced[_0x5177('0x1c')][_0x5177('0x1f')]||null:null,'include':_0x72dced[_0x5177('0x1c')]?_0x72dced[_0x5177('0x1c')][_0x5177('0x22')]?_[_0x5177('0x21')](_0x72dced[_0x5177('0x1c')]['include'],function(_0x459ac6){return{'model':db[_0x459ac6[_0x5177('0x23')]],'as':_0x459ac6['as'],'attributes':_0x459ac6['attributes'],'include':_0x459ac6[_0x5177('0x22')]?_[_0x5177('0x21')](_0x459ac6[_0x5177('0x22')],function(_0x8727c6){return{'model':db[_0x8727c6[_0x5177('0x23')]],'as':_0x8727c6['as'],'attributes':_0x8727c6[_0x5177('0x1f')],'include':_0x8727c6['include']?_[_0x5177('0x21')](_0x8727c6[_0x5177('0x22')],function(_0x28b1d5){return{'model':db[_0x28b1d5[_0x5177('0x23')]],'as':_0x28b1d5['as'],'attributes':_0x28b1d5[_0x5177('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5177('0xe')](function(_0x1bb1e3){logger['info'](_0x5177('0x24'),_0x72dced);logger[_0x5177('0x10')]('ShowVtigerAccount',_0x72dced,JSON['stringify'](_0x1bb1e3));_0x42e1db(_0x1bb1e3);})[_0x5177('0x19')](function(_0x188cec){logger[_0x5177('0x14')](_0x5177('0x24'),_0x188cec[_0x5177('0x17')],_0x72dced);_0x2233a2(_0x49f6f1[_0x5177('0x14')](0x1f4,_0x188cec[_0x5177('0x17')]));});});}; \ No newline at end of file +var _0x0565=['request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','code','message','error','GetVtigerAccount','options','raw','where','attributes','limit','map','model','include','debug','catch','ShowVtigerAccount','VtigerAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s'];(function(_0x5691f7,_0x1e5dbe){var _0xaa65ed=function(_0x5c0ef4){while(--_0x5c0ef4){_0x5691f7['push'](_0x5691f7['shift']());}};_0xaa65ed(++_0x1e5dbe);}(_0x0565,0xf2));var _0x5056=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x0565[_0x411017];return _0x2adeea;};'use strict';var _=require(_0x5056('0x0'));var util=require(_0x5056('0x1'));var moment=require(_0x5056('0x2'));var BPromise=require(_0x5056('0x3'));var rs=require(_0x5056('0x4'));var fs=require('fs');var Redis=require(_0x5056('0x5'));var db=require(_0x5056('0x6'))['db'];var utils=require(_0x5056('0x7'));var logger=require(_0x5056('0x8'))(_0x5056('0x9'));var config=require('../../config/environment');var jayson=require(_0x5056('0xa'));var client=jayson[_0x5056('0xb')][_0x5056('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x22afb7,_0x4b8280,_0x52b01f){return new BPromise(function(_0x38f74,_0x223c92){return client[_0x5056('0xd')](_0x22afb7,_0x52b01f)[_0x5056('0xe')](function(_0x2144a9){logger[_0x5056('0xf')](_0x5056('0x10'),_0x4b8280,_0x5056('0x11'));logger['debug'](_0x5056('0x12'),_0x4b8280,_0x5056('0x11'),JSON[_0x5056('0x13')](_0x2144a9));if(_0x2144a9['error']){if(_0x2144a9['error'][_0x5056('0x14')]===0x1f4){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x4b8280,_0x2144a9['error'][_0x5056('0x15')]);return _0x223c92(_0x2144a9['error'][_0x5056('0x15')]);}logger[_0x5056('0x16')](_0x5056('0x10'),_0x4b8280,_0x2144a9['error'][_0x5056('0x15')]);return _0x38f74(_0x2144a9[_0x5056('0x16')][_0x5056('0x15')]);}else{logger[_0x5056('0xf')](_0x5056('0x10'),_0x4b8280,_0x5056('0x11'));_0x38f74(_0x2144a9['result'][_0x5056('0x15')]);}})['catch'](function(_0x43db77){logger[_0x5056('0x16')](_0x5056('0x10'),_0x4b8280,_0x43db77);_0x223c92(_0x43db77);});});}exports[_0x5056('0x17')]=function(_0x4056ce){var _0x51b21e=this;return new Promise(function(_0x9ea88,_0x56537e){return db['VtigerAccount']['findAll']({'raw':_0x4056ce[_0x5056('0x18')]?_0x4056ce[_0x5056('0x18')][_0x5056('0x19')]===undefined?!![]:![]:!![],'where':_0x4056ce[_0x5056('0x18')]?_0x4056ce[_0x5056('0x18')][_0x5056('0x1a')]||null:null,'attributes':_0x4056ce[_0x5056('0x18')]?_0x4056ce['options'][_0x5056('0x1b')]||null:null,'limit':_0x4056ce[_0x5056('0x18')]?_0x4056ce['options'][_0x5056('0x1c')]||null:null,'include':_0x4056ce[_0x5056('0x18')]?_0x4056ce[_0x5056('0x18')]['include']?_[_0x5056('0x1d')](_0x4056ce[_0x5056('0x18')]['include'],function(_0x4a64be){return{'model':db[_0x4a64be[_0x5056('0x1e')]],'as':_0x4a64be['as'],'attributes':_0x4a64be[_0x5056('0x1b')],'include':_0x4a64be[_0x5056('0x1f')]?_[_0x5056('0x1d')](_0x4a64be['include'],function(_0x267048){return{'model':db[_0x267048[_0x5056('0x1e')]],'as':_0x267048['as'],'attributes':_0x267048['attributes'],'include':_0x267048[_0x5056('0x1f')]?_['map'](_0x267048[_0x5056('0x1f')],function(_0x39d539){return{'model':db[_0x39d539[_0x5056('0x1e')]],'as':_0x39d539['as'],'attributes':_0x39d539[_0x5056('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5056('0xe')](function(_0x50f2a8){logger[_0x5056('0xf')](_0x5056('0x17'),_0x4056ce);logger[_0x5056('0x20')](_0x5056('0x17'),_0x4056ce,JSON['stringify'](_0x50f2a8));_0x9ea88(_0x50f2a8);})[_0x5056('0x21')](function(_0x5b0270){logger[_0x5056('0x16')]('GetVtigerAccount',_0x5b0270['message'],_0x4056ce);_0x56537e(_0x51b21e['error'](0x1f4,_0x5b0270[_0x5056('0x15')]));});});};exports[_0x5056('0x22')]=function(_0x482939){var _0x27f4be=this;return new Promise(function(_0x2c5728,_0x9e2986){return db[_0x5056('0x23')][_0x5056('0x24')]({'raw':_0x482939[_0x5056('0x18')]?_0x482939[_0x5056('0x18')][_0x5056('0x19')]===undefined?!![]:![]:!![],'where':_0x482939[_0x5056('0x18')]?_0x482939[_0x5056('0x18')][_0x5056('0x1a')]||null:null,'attributes':_0x482939['options']?_0x482939['options'][_0x5056('0x1b')]||null:null,'include':_0x482939[_0x5056('0x18')]?_0x482939['options'][_0x5056('0x1f')]?_[_0x5056('0x1d')](_0x482939['options'][_0x5056('0x1f')],function(_0x378b33){return{'model':db[_0x378b33[_0x5056('0x1e')]],'as':_0x378b33['as'],'attributes':_0x378b33[_0x5056('0x1b')],'include':_0x378b33[_0x5056('0x1f')]?_[_0x5056('0x1d')](_0x378b33[_0x5056('0x1f')],function(_0x2f1d27){return{'model':db[_0x2f1d27[_0x5056('0x1e')]],'as':_0x2f1d27['as'],'attributes':_0x2f1d27[_0x5056('0x1b')],'include':_0x2f1d27[_0x5056('0x1f')]?_[_0x5056('0x1d')](_0x2f1d27[_0x5056('0x1f')],function(_0x3d7d78){return{'model':db[_0x3d7d78[_0x5056('0x1e')]],'as':_0x3d7d78['as'],'attributes':_0x3d7d78['attributes']};}):[]};}):[]};}):[]:[]})[_0x5056('0xe')](function(_0x483d1e){logger[_0x5056('0xf')](_0x5056('0x22'),_0x482939);logger[_0x5056('0x20')](_0x5056('0x22'),_0x482939,JSON['stringify'](_0x483d1e));_0x2c5728(_0x483d1e);})[_0x5056('0x21')](function(_0x32fecc){logger['error'](_0x5056('0x22'),_0x32fecc['message'],_0x482939);_0x9e2986(_0x27f4be[_0x5056('0x16')](0x1f4,_0x32fecc[_0x5056('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 3c8086d..8ffce16 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 _0xf6bd=['index','show','/:id/fields','getFields','getSubjects','isAuthenticated','getDescriptions','create','put','update','delete','destroy','exports','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf6bd,0xb8));var _0xdf6b=function(_0x2e5405,_0x42ec09){_0x2e5405=_0x2e5405-0x0;var _0x2f0270=_0xf6bd[_0x2e5405];return _0x2f0270;};'use strict';var multer=require('multer');var util=require(_0xdf6b('0x0'));var path=require(_0xdf6b('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdf6b('0x2'));var interaction=require(_0xdf6b('0x3'));var config=require(_0xdf6b('0x4'));var controller=require('./intVtigerConfiguration.controller');router[_0xdf6b('0x5')]('/',auth['isAuthenticated'](),controller[_0xdf6b('0x6')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xdf6b('0x7')]);router[_0xdf6b('0x5')](_0xdf6b('0x8'),auth['isAuthenticated'](),controller[_0xdf6b('0x9')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0xdf6b('0xa')]);router[_0xdf6b('0x5')]('/:id/descriptions',auth[_0xdf6b('0xb')](),controller[_0xdf6b('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xdf6b('0xd')]);router[_0xdf6b('0xe')]('/:id',auth[_0xdf6b('0xb')](),controller[_0xdf6b('0xf')]);router[_0xdf6b('0x10')]('/:id',auth[_0xdf6b('0xb')](),controller[_0xdf6b('0x11')]);module[_0xdf6b('0x12')]=router; \ No newline at end of file +var _0xf9e1=['destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','put','delete'];(function(_0x42a147,_0x256026){var _0x1f3803=function(_0x38673c){while(--_0x38673c){_0x42a147['push'](_0x42a147['shift']());}};_0x1f3803(++_0x256026);}(_0xf9e1,0x136));var _0x1f9e=function(_0x1c95e7,_0x3c3aaa){_0x1c95e7=_0x1c95e7-0x0;var _0x19807a=_0xf9e1[_0x1c95e7];return _0x19807a;};'use strict';var multer=require(_0x1f9e('0x0'));var util=require('util');var path=require(_0x1f9e('0x1'));var timeout=require('connect-timeout');var express=require(_0x1f9e('0x2'));var router=express[_0x1f9e('0x3')]();var fs_extra=require(_0x1f9e('0x4'));var auth=require(_0x1f9e('0x5'));var interaction=require(_0x1f9e('0x6'));var config=require(_0x1f9e('0x7'));var controller=require(_0x1f9e('0x8'));router[_0x1f9e('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1f9e('0x9')](_0x1f9e('0xa'),auth[_0x1f9e('0xb')](),controller[_0x1f9e('0xc')]);router[_0x1f9e('0x9')](_0x1f9e('0xd'),auth[_0x1f9e('0xb')](),controller[_0x1f9e('0xe')]);router[_0x1f9e('0x9')]('/:id/subjects',auth[_0x1f9e('0xb')](),controller[_0x1f9e('0xf')]);router[_0x1f9e('0x9')](_0x1f9e('0x10'),auth[_0x1f9e('0xb')](),controller[_0x1f9e('0x11')]);router['post']('/',auth[_0x1f9e('0xb')](),controller['create']);router[_0x1f9e('0x12')]('/:id',auth[_0x1f9e('0xb')](),controller['update']);router[_0x1f9e('0x13')]('/:id',auth[_0x1f9e('0xb')](),controller[_0x1f9e('0x14')]);module[_0x1f9e('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 2162a71..d8dc315 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 _0xee52=['exports','STRING','sequelize'];(function(_0x1aa936,_0x5da2b8){var _0x616742=function(_0x2f1fb8){while(--_0x2f1fb8){_0x1aa936['push'](_0x1aa936['shift']());}};_0x616742(++_0x5da2b8);}(_0xee52,0x80));var _0x2ee5=function(_0x3d782c,_0x58b420){_0x3d782c=_0x3d782c-0x0;var _0x170b98=_0xee52[_0x3d782c];return _0x170b98;};'use strict';var Sequelize=require(_0x2ee5('0x0'));module[_0x2ee5('0x1')]={'name':{'type':Sequelize[_0x2ee5('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x667e=['exports','STRING','sequelize'];(function(_0x1b1a3b,_0x52a88a){var _0x385347=function(_0x4ca60a){while(--_0x4ca60a){_0x1b1a3b['push'](_0x1b1a3b['shift']());}};_0x385347(++_0x52a88a);}(_0x667e,0x1a9));var _0xe667=function(_0x4a5f6a,_0x3a16d1){_0x4a5f6a=_0x4a5f6a-0x0;var _0x58cf87=_0x667e[_0x4a5f6a];return _0x58cf87;};'use strict';var Sequelize=require(_0xe667('0x0'));module[_0xe667('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe667('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index d0b1a7d..1edc283 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 _0xd19f=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','apply','save','update','then','error','stack','name','send','index','map','VtigerConfiguration','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','limit','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','destroy','getFields','findOne','VtigerField','order','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xd19f,0x1e4));var _0xfd19=function(_0x228ac9,_0x42f065){_0x228ac9=_0x228ac9-0x0;var _0x69fe02=_0xd19f[_0x228ac9];return _0x69fe02;};'use strict';var emlformat=require(_0xfd19('0x0'));var rimraf=require(_0xfd19('0x1'));var zipdir=require(_0xfd19('0x2'));var jsonpatch=require(_0xfd19('0x3'));var rp=require(_0xfd19('0x4'));var moment=require(_0xfd19('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfd19('0x6'));var util=require(_0xfd19('0x7'));var path=require(_0xfd19('0x8'));var sox=require('sox');var csv=require(_0xfd19('0x9'));var ejs=require(_0xfd19('0xa'));var fs=require('fs');var fs_extra=require(_0xfd19('0xb'));var _=require(_0xfd19('0xc'));var squel=require(_0xfd19('0xd'));var crypto=require('crypto');var jsforce=require(_0xfd19('0xe'));var deskjs=require(_0xfd19('0xf'));var toCsv=require('to-csv');var querystring=require(_0xfd19('0x10'));var Papa=require(_0xfd19('0x11'));var Redis=require(_0xfd19('0x12'));var authService=require(_0xfd19('0x13'));var qs=require(_0xfd19('0x14'));var as=require(_0xfd19('0x15'));var hardwareService=require(_0xfd19('0x16'));var logger=require(_0xfd19('0x17'))('api');var utils=require(_0xfd19('0x18'));var config=require(_0xfd19('0x19'));var licenseUtil=require(_0xfd19('0x1a'));var db=require(_0xfd19('0x1b'))['db'];function respondWithStatusCode(_0x5f2f3d,_0x27a2d5){_0x27a2d5=_0x27a2d5||0xcc;return function(_0x4e7469){if(_0x4e7469){return _0x5f2f3d[_0xfd19('0x1c')](_0x27a2d5);}return _0x5f2f3d[_0xfd19('0x1d')](_0x27a2d5)[_0xfd19('0x1e')]();};}function respondWithResult(_0x53b92f,_0x3ae489){_0x3ae489=_0x3ae489||0xc8;return function(_0x52ab7b){if(_0x52ab7b){return _0x53b92f[_0xfd19('0x1d')](_0x3ae489)[_0xfd19('0x1f')](_0x52ab7b);}};}function respondWithFilteredResult(_0x34c13d,_0x3f15b8){return function(_0x5c7575){if(_0x5c7575){var _0x54e50e=typeof _0x3f15b8['offset']===_0xfd19('0x20')&&typeof _0x3f15b8['limit']===_0xfd19('0x20');var _0x3bdc0d=_0x5c7575[_0xfd19('0x21')];var _0x3cb6e9=_0x54e50e?0x0:_0x3f15b8[_0xfd19('0x22')];var _0x6ebde7=_0x54e50e?_0x5c7575[_0xfd19('0x21')]:_0x3f15b8['offset']+_0x3f15b8['limit'];var _0x13b126;if(_0x6ebde7>=_0x3bdc0d){_0x6ebde7=_0x3bdc0d;_0x13b126=0xc8;}else{_0x13b126=0xce;}_0x34c13d[_0xfd19('0x1d')](_0x13b126);return _0x34c13d['set']('Content-Range',_0x3cb6e9+'-'+_0x6ebde7+'/'+_0x3bdc0d)['json'](_0x5c7575);}return null;};}function patchUpdates(_0x54e703){return function(_0x5084bc){try{jsonpatch[_0xfd19('0x23')](_0x5084bc,_0x54e703,!![]);}catch(_0x7f854a){return BPromise['reject'](_0x7f854a);}return _0x5084bc[_0xfd19('0x24')]();};}function saveUpdates(_0x50e94e,_0x1e0543){return function(_0x219e0d){if(_0x219e0d){return _0x219e0d[_0xfd19('0x25')](_0x50e94e)[_0xfd19('0x26')](function(_0x35d424){return _0x35d424;});}return null;};}function removeEntity(_0x1e8be0,_0x2bcc68){return function(_0x5116f9){if(_0x5116f9){return _0x5116f9['destroy']()[_0xfd19('0x26')](function(){_0x1e8be0[_0xfd19('0x1d')](0xcc)[_0xfd19('0x1e')]();});}};}function handleEntityNotFound(_0x4e535d,_0x32151e){return function(_0x5e5711){if(!_0x5e5711){_0x4e535d['sendStatus'](0x194);}return _0x5e5711;};}function handleError(_0x56278,_0x1ef3a5){_0x1ef3a5=_0x1ef3a5||0x1f4;return function(_0x435e39){logger[_0xfd19('0x27')](_0x435e39[_0xfd19('0x28')]);if(_0x435e39[_0xfd19('0x29')]){delete _0x435e39['name'];}_0x56278[_0xfd19('0x1d')](_0x1ef3a5)[_0xfd19('0x2a')](_0x435e39);};}exports[_0xfd19('0x2b')]=function(_0x295c7b,_0x54c48f){var _0x2b2f4b={},_0x4b260c={},_0x188f92={'count':0x0,'rows':[]};var _0x14b8ab=_[_0xfd19('0x2c')](db[_0xfd19('0x2d')][_0xfd19('0x2e')],function(_0x41632d){return{'name':_0x41632d['fieldName'],'type':_0x41632d['type'][_0xfd19('0x2f')]};});_0x4b260c['model']=_[_0xfd19('0x2c')](_0x14b8ab,_0xfd19('0x29'));_0x4b260c[_0xfd19('0x30')]=_[_0xfd19('0x31')](_0x295c7b[_0xfd19('0x30')]);_0x4b260c[_0xfd19('0x32')]=_[_0xfd19('0x33')](_0x4b260c[_0xfd19('0x34')],_0x4b260c[_0xfd19('0x30')]);_0x2b2f4b[_0xfd19('0x35')]=_[_0xfd19('0x33')](_0x4b260c[_0xfd19('0x34')],qs['fields'](_0x295c7b[_0xfd19('0x30')][_0xfd19('0x36')]));_0x2b2f4b[_0xfd19('0x35')]=_0x2b2f4b[_0xfd19('0x35')][_0xfd19('0x37')]?_0x2b2f4b[_0xfd19('0x35')]:_0x4b260c[_0xfd19('0x34')];if(!_0x295c7b[_0xfd19('0x30')]['hasOwnProperty'](_0xfd19('0x38'))){_0x2b2f4b[_0xfd19('0x39')]=qs[_0xfd19('0x39')](_0x295c7b[_0xfd19('0x30')]['limit']);_0x2b2f4b[_0xfd19('0x22')]=qs[_0xfd19('0x22')](_0x295c7b['query']['offset']);}_0x2b2f4b['order']=qs[_0xfd19('0x3a')](_0x295c7b['query'][_0xfd19('0x3a')]);_0x2b2f4b[_0xfd19('0x3b')]=qs[_0xfd19('0x32')](_[_0xfd19('0x3c')](_0x295c7b[_0xfd19('0x30')],_0x4b260c['filters']),_0x14b8ab);if(_0x295c7b[_0xfd19('0x30')][_0xfd19('0x3d')]){_0x2b2f4b[_0xfd19('0x3b')]=_[_0xfd19('0x3e')](_0x2b2f4b[_0xfd19('0x3b')],{'$or':_[_0xfd19('0x2c')](_0x14b8ab,function(_0x29f69f){if(_0x29f69f[_0xfd19('0x3f')]!==_0xfd19('0x40')){var _0x4fa9cf={};_0x4fa9cf[_0x29f69f[_0xfd19('0x29')]]={'$like':'%'+_0x295c7b['query'][_0xfd19('0x3d')]+'%'};return _0x4fa9cf;}})});}_0x2b2f4b=_[_0xfd19('0x3e')]({},_0x2b2f4b,_0x295c7b['options']);var _0x1d4845={'where':_0x2b2f4b[_0xfd19('0x3b')]};return db['VtigerConfiguration'][_0xfd19('0x21')](_0x1d4845)[_0xfd19('0x26')](function(_0x5bebb9){_0x188f92[_0xfd19('0x21')]=_0x5bebb9;if(_0x295c7b[_0xfd19('0x30')][_0xfd19('0x41')]){_0x2b2f4b[_0xfd19('0x42')]=[{'all':!![]}];}return db[_0xfd19('0x2d')][_0xfd19('0x43')](_0x2b2f4b);})['then'](function(_0x72f606){_0x188f92[_0xfd19('0x44')]=_0x72f606;return _0x188f92;})[_0xfd19('0x26')](respondWithFilteredResult(_0x54c48f,_0x2b2f4b))[_0xfd19('0x45')](handleError(_0x54c48f,null));};exports[_0xfd19('0x46')]=function(_0x31d68c,_0x5797cd){var _0x49af18={'raw':![],'where':{'id':_0x31d68c[_0xfd19('0x47')]['id']}},_0x395780={};_0x395780[_0xfd19('0x34')]=_['keys'](db['VtigerConfiguration'][_0xfd19('0x2e')]);_0x395780[_0xfd19('0x30')]=_['keys'](_0x31d68c[_0xfd19('0x30')]);_0x395780[_0xfd19('0x32')]=_[_0xfd19('0x33')](_0x395780[_0xfd19('0x34')],_0x395780[_0xfd19('0x30')]);_0x49af18[_0xfd19('0x35')]=_[_0xfd19('0x33')](_0x395780[_0xfd19('0x34')],qs[_0xfd19('0x36')](_0x31d68c['query'][_0xfd19('0x36')]));_0x49af18['attributes']=_0x49af18['attributes'][_0xfd19('0x37')]?_0x49af18[_0xfd19('0x35')]:_0x395780[_0xfd19('0x34')];if(_0x31d68c[_0xfd19('0x30')][_0xfd19('0x41')]){_0x49af18[_0xfd19('0x42')]=[{'all':!![]}];}_0x49af18=_['merge']({},_0x49af18,_0x31d68c[_0xfd19('0x48')]);return db[_0xfd19('0x2d')][_0xfd19('0x49')](_0x49af18)['then'](handleEntityNotFound(_0x5797cd,null))[_0xfd19('0x26')](respondWithResult(_0x5797cd,null))[_0xfd19('0x45')](handleError(_0x5797cd,null));};exports[_0xfd19('0x4a')]=function(_0xb13b1d,_0x32e5b6){return db['VtigerConfiguration'][_0xfd19('0x4a')](_0xb13b1d[_0xfd19('0x4b')],{})['then'](respondWithResult(_0x32e5b6,0xc9))[_0xfd19('0x45')](handleError(_0x32e5b6,null));};exports[_0xfd19('0x25')]=function(_0xee7132,_0x54357d){if(_0xee7132[_0xfd19('0x4b')]['id']){delete _0xee7132['body']['id'];}return db[_0xfd19('0x2d')][_0xfd19('0x49')]({'where':{'id':_0xee7132['params']['id']}})['then'](handleEntityNotFound(_0x54357d,null))[_0xfd19('0x26')](saveUpdates(_0xee7132['body'],null))[_0xfd19('0x26')](respondWithResult(_0x54357d,null))[_0xfd19('0x45')](handleError(_0x54357d,null));};exports[_0xfd19('0x4c')]=function(_0x5359d7,_0x7bff66){return db['VtigerConfiguration'][_0xfd19('0x49')]({'where':{'id':_0x5359d7[_0xfd19('0x47')]['id']}})['then'](handleEntityNotFound(_0x7bff66,null))[_0xfd19('0x26')](removeEntity(_0x7bff66,null))[_0xfd19('0x45')](handleError(_0x7bff66,null));};exports[_0xfd19('0x4d')]=function(_0x3ccf8d,_0x149fee,_0x1ba037){var _0x1ffba1={};var _0x5bf6c3={};var _0xa873cc;var _0xaa19c3;return db['VtigerConfiguration'][_0xfd19('0x4e')]({'where':{'id':_0x3ccf8d['params']['id']}})[_0xfd19('0x26')](handleEntityNotFound(_0x149fee,null))[_0xfd19('0x26')](function(_0x500978){if(_0x500978){_0xa873cc=_0x500978;_0x5bf6c3['model']=_[_0xfd19('0x31')](db[_0xfd19('0x4f')]['rawAttributes']);_0x5bf6c3['query']=_[_0xfd19('0x31')](_0x3ccf8d[_0xfd19('0x30')]);_0x5bf6c3[_0xfd19('0x32')]=_['intersection'](_0x5bf6c3[_0xfd19('0x34')],_0x5bf6c3[_0xfd19('0x30')]);_0x1ffba1[_0xfd19('0x35')]=_[_0xfd19('0x33')](_0x5bf6c3[_0xfd19('0x34')],qs['fields'](_0x3ccf8d[_0xfd19('0x30')][_0xfd19('0x36')]));_0x1ffba1[_0xfd19('0x35')]=_0x1ffba1[_0xfd19('0x35')][_0xfd19('0x37')]?_0x1ffba1[_0xfd19('0x35')]:_0x5bf6c3[_0xfd19('0x34')];_0x1ffba1[_0xfd19('0x50')]=qs['sort'](_0x3ccf8d[_0xfd19('0x30')][_0xfd19('0x3a')]);_0x1ffba1[_0xfd19('0x3b')]=qs['filters'](_[_0xfd19('0x3c')](_0x3ccf8d[_0xfd19('0x30')],_0x5bf6c3[_0xfd19('0x32')]));if(_0x3ccf8d[_0xfd19('0x30')][_0xfd19('0x3d')]){_0x1ffba1[_0xfd19('0x3b')]=_[_0xfd19('0x3e')](_0x1ffba1[_0xfd19('0x3b')],{'$or':_[_0xfd19('0x2c')](_0x1ffba1[_0xfd19('0x35')],function(_0x34ee2e){var _0x698010={};_0x698010[_0x34ee2e]={'$like':'%'+_0x3ccf8d[_0xfd19('0x30')][_0xfd19('0x3d')]+'%'};return _0x698010;})});}_0x1ffba1=_[_0xfd19('0x3e')]({},_0x1ffba1,_0x3ccf8d[_0xfd19('0x48')]);return _0xa873cc[_0xfd19('0x4d')](_0x1ffba1);}})['then'](function(_0x49aa63){if(_0x49aa63){_0xaa19c3=_0x49aa63[_0xfd19('0x37')];if(!_0x3ccf8d[_0xfd19('0x30')][_0xfd19('0x51')]('nolimit')){_0x1ffba1[_0xfd19('0x39')]=qs['limit'](_0x3ccf8d[_0xfd19('0x30')][_0xfd19('0x39')]);_0x1ffba1[_0xfd19('0x22')]=qs[_0xfd19('0x22')](_0x3ccf8d[_0xfd19('0x30')][_0xfd19('0x22')]);}return _0xa873cc[_0xfd19('0x4d')](_0x1ffba1);}})[_0xfd19('0x26')](function(_0x37cbed){if(_0x37cbed){return _0x37cbed?{'count':_0xaa19c3,'rows':_0x37cbed}:null;}})[_0xfd19('0x26')](respondWithResult(_0x149fee,null))[_0xfd19('0x45')](handleError(_0x149fee,null));};exports[_0xfd19('0x52')]=function(_0x27d256,_0x1dd88e,_0x2c499d){var _0x30ac06={};var _0x158bcc={};var _0x52f0d0;var _0x43c332;return db[_0xfd19('0x2d')][_0xfd19('0x4e')]({'where':{'id':_0x27d256[_0xfd19('0x47')]['id']}})['then'](handleEntityNotFound(_0x1dd88e,null))['then'](function(_0x98dd9f){if(_0x98dd9f){_0x52f0d0=_0x98dd9f;_0x158bcc[_0xfd19('0x34')]=_[_0xfd19('0x31')](db['VtigerField'][_0xfd19('0x2e')]);_0x158bcc[_0xfd19('0x30')]=_[_0xfd19('0x31')](_0x27d256['query']);_0x158bcc[_0xfd19('0x32')]=_['intersection'](_0x158bcc[_0xfd19('0x34')],_0x158bcc[_0xfd19('0x30')]);_0x30ac06['attributes']=_[_0xfd19('0x33')](_0x158bcc[_0xfd19('0x34')],qs[_0xfd19('0x36')](_0x27d256[_0xfd19('0x30')][_0xfd19('0x36')]));_0x30ac06[_0xfd19('0x35')]=_0x30ac06[_0xfd19('0x35')]['length']?_0x30ac06[_0xfd19('0x35')]:_0x158bcc[_0xfd19('0x34')];_0x30ac06['order']=qs[_0xfd19('0x3a')](_0x27d256[_0xfd19('0x30')]['sort']);_0x30ac06[_0xfd19('0x3b')]=qs[_0xfd19('0x32')](_[_0xfd19('0x3c')](_0x27d256['query'],_0x158bcc[_0xfd19('0x32')]));if(_0x27d256[_0xfd19('0x30')]['filter']){_0x30ac06[_0xfd19('0x3b')]=_[_0xfd19('0x3e')](_0x30ac06[_0xfd19('0x3b')],{'$or':_['map'](_0x30ac06['attributes'],function(_0x4a2e0c){var _0x4ebfa0={};_0x4ebfa0[_0x4a2e0c]={'$like':'%'+_0x27d256['query'][_0xfd19('0x3d')]+'%'};return _0x4ebfa0;})});}_0x30ac06=_['merge']({},_0x30ac06,_0x27d256[_0xfd19('0x48')]);return _0x52f0d0['getSubjects'](_0x30ac06);}})[_0xfd19('0x26')](function(_0x47d598){if(_0x47d598){_0x43c332=_0x47d598[_0xfd19('0x37')];if(!_0x27d256[_0xfd19('0x30')]['hasOwnProperty']('nolimit')){_0x30ac06[_0xfd19('0x39')]=qs['limit'](_0x27d256[_0xfd19('0x30')]['limit']);_0x30ac06[_0xfd19('0x22')]=qs['offset'](_0x27d256[_0xfd19('0x30')][_0xfd19('0x22')]);}return _0x52f0d0['getSubjects'](_0x30ac06);}})[_0xfd19('0x26')](function(_0x3d934a){if(_0x3d934a){return _0x3d934a?{'count':_0x43c332,'rows':_0x3d934a}:null;}})['then'](respondWithResult(_0x1dd88e,null))[_0xfd19('0x45')](handleError(_0x1dd88e,null));};exports['getDescriptions']=function(_0x4e2e19,_0x156a05,_0x46f625){var _0x395442={};var _0x1f4313={};var _0x26a212;var _0x3d2e03;return db[_0xfd19('0x2d')][_0xfd19('0x4e')]({'where':{'id':_0x4e2e19['params']['id']}})[_0xfd19('0x26')](handleEntityNotFound(_0x156a05,null))[_0xfd19('0x26')](function(_0xaaef6d){if(_0xaaef6d){_0x26a212=_0xaaef6d;_0x1f4313['model']=_[_0xfd19('0x31')](db[_0xfd19('0x4f')][_0xfd19('0x2e')]);_0x1f4313[_0xfd19('0x30')]=_['keys'](_0x4e2e19[_0xfd19('0x30')]);_0x1f4313[_0xfd19('0x32')]=_[_0xfd19('0x33')](_0x1f4313['model'],_0x1f4313['query']);_0x395442[_0xfd19('0x35')]=_[_0xfd19('0x33')](_0x1f4313[_0xfd19('0x34')],qs[_0xfd19('0x36')](_0x4e2e19[_0xfd19('0x30')]['fields']));_0x395442[_0xfd19('0x35')]=_0x395442[_0xfd19('0x35')]['length']?_0x395442['attributes']:_0x1f4313[_0xfd19('0x34')];_0x395442[_0xfd19('0x50')]=qs['sort'](_0x4e2e19[_0xfd19('0x30')]['sort']);_0x395442[_0xfd19('0x3b')]=qs[_0xfd19('0x32')](_[_0xfd19('0x3c')](_0x4e2e19[_0xfd19('0x30')],_0x1f4313[_0xfd19('0x32')]));if(_0x4e2e19[_0xfd19('0x30')][_0xfd19('0x3d')]){_0x395442[_0xfd19('0x3b')]=_['merge'](_0x395442[_0xfd19('0x3b')],{'$or':_[_0xfd19('0x2c')](_0x395442[_0xfd19('0x35')],function(_0x5f57ad){var _0x4c00dc={};_0x4c00dc[_0x5f57ad]={'$like':'%'+_0x4e2e19[_0xfd19('0x30')][_0xfd19('0x3d')]+'%'};return _0x4c00dc;})});}_0x395442=_[_0xfd19('0x3e')]({},_0x395442,_0x4e2e19['options']);return _0x26a212[_0xfd19('0x53')](_0x395442);}})[_0xfd19('0x26')](function(_0x4736f1){if(_0x4736f1){_0x3d2e03=_0x4736f1[_0xfd19('0x37')];if(!_0x4e2e19[_0xfd19('0x30')]['hasOwnProperty']('nolimit')){_0x395442[_0xfd19('0x39')]=qs[_0xfd19('0x39')](_0x4e2e19['query'][_0xfd19('0x39')]);_0x395442['offset']=qs[_0xfd19('0x22')](_0x4e2e19[_0xfd19('0x30')]['offset']);}return _0x26a212[_0xfd19('0x53')](_0x395442);}})[_0xfd19('0x26')](function(_0x367db3){if(_0x367db3){return _0x367db3?{'count':_0x3d2e03,'rows':_0x367db3}:null;}})[_0xfd19('0x26')](respondWithResult(_0x156a05,null))[_0xfd19('0x45')](handleError(_0x156a05,null));}; \ No newline at end of file +var _0xb332=['fs-extra','lodash','jsforce','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','set','apply','reject','save','update','then','error','name','index','map','VtigerConfiguration','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','keys','find','body','params','destroy','catch','findOne','pick','getFields','getSubjects','VtigerField','getDescriptions','eml-format','zip-dir','fast-json-patch','moment','mustache','path','to-csv','ejs'];(function(_0x48026e,_0x2bb295){var _0x4b42aa=function(_0x42c647){while(--_0x42c647){_0x48026e['push'](_0x48026e['shift']());}};_0x4b42aa(++_0x2bb295);}(_0xb332,0xd9));var _0x2b33=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xb332[_0x4ea69d];return _0x5318e0;};'use strict';var emlformat=require(_0x2b33('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2b33('0x1'));var jsonpatch=require(_0x2b33('0x2'));var rp=require('request-promise');var moment=require(_0x2b33('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2b33('0x4'));var util=require('util');var path=require(_0x2b33('0x5'));var sox=require('sox');var csv=require(_0x2b33('0x6'));var ejs=require(_0x2b33('0x7'));var fs=require('fs');var fs_extra=require(_0x2b33('0x8'));var _=require(_0x2b33('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2b33('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x2b33('0x6'));var querystring=require(_0x2b33('0xb'));var Papa=require(_0x2b33('0xc'));var Redis=require(_0x2b33('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x2b33('0xe'));var as=require(_0x2b33('0xf'));var hardwareService=require(_0x2b33('0x10'));var logger=require(_0x2b33('0x11'))(_0x2b33('0x12'));var utils=require(_0x2b33('0x13'));var config=require(_0x2b33('0x14'));var licenseUtil=require(_0x2b33('0x15'));var db=require(_0x2b33('0x16'))['db'];function respondWithStatusCode(_0x3969cb,_0xca2248){_0xca2248=_0xca2248||0xcc;return function(_0x4df129){if(_0x4df129){return _0x3969cb[_0x2b33('0x17')](_0xca2248);}return _0x3969cb[_0x2b33('0x18')](_0xca2248)[_0x2b33('0x19')]();};}function respondWithResult(_0x4ef886,_0x173c75){_0x173c75=_0x173c75||0xc8;return function(_0x4d39db){if(_0x4d39db){return _0x4ef886[_0x2b33('0x18')](_0x173c75)[_0x2b33('0x1a')](_0x4d39db);}};}function respondWithFilteredResult(_0x233cd9,_0x57aea7){return function(_0x52693f){if(_0x52693f){var _0x1d8e75=typeof _0x57aea7[_0x2b33('0x1b')]===_0x2b33('0x1c')&&typeof _0x57aea7[_0x2b33('0x1d')]===_0x2b33('0x1c');var _0x4d69d0=_0x52693f['count'];var _0x59f0b6=_0x1d8e75?0x0:_0x57aea7[_0x2b33('0x1b')];var _0x4f10c4=_0x1d8e75?_0x52693f['count']:_0x57aea7[_0x2b33('0x1b')]+_0x57aea7[_0x2b33('0x1d')];var _0x205d8f;if(_0x4f10c4>=_0x4d69d0){_0x4f10c4=_0x4d69d0;_0x205d8f=0xc8;}else{_0x205d8f=0xce;}_0x233cd9['status'](_0x205d8f);return _0x233cd9[_0x2b33('0x1e')]('Content-Range',_0x59f0b6+'-'+_0x4f10c4+'/'+_0x4d69d0)[_0x2b33('0x1a')](_0x52693f);}return null;};}function patchUpdates(_0x2565be){return function(_0x8c8dc2){try{jsonpatch[_0x2b33('0x1f')](_0x8c8dc2,_0x2565be,!![]);}catch(_0x233ba6){return BPromise[_0x2b33('0x20')](_0x233ba6);}return _0x8c8dc2[_0x2b33('0x21')]();};}function saveUpdates(_0x4fb725,_0x23024c){return function(_0x1d9c98){if(_0x1d9c98){return _0x1d9c98[_0x2b33('0x22')](_0x4fb725)[_0x2b33('0x23')](function(_0x58998e){return _0x58998e;});}return null;};}function removeEntity(_0x1c27d4,_0x27f1b8){return function(_0x2605e6){if(_0x2605e6){return _0x2605e6['destroy']()[_0x2b33('0x23')](function(){_0x1c27d4[_0x2b33('0x18')](0xcc)[_0x2b33('0x19')]();});}};}function handleEntityNotFound(_0x32b835,_0x4df3d4){return function(_0x2ec9db){if(!_0x2ec9db){_0x32b835['sendStatus'](0x194);}return _0x2ec9db;};}function handleError(_0x373e27,_0x483cf4){_0x483cf4=_0x483cf4||0x1f4;return function(_0x2e74d0){logger[_0x2b33('0x24')](_0x2e74d0['stack']);if(_0x2e74d0[_0x2b33('0x25')]){delete _0x2e74d0['name'];}_0x373e27[_0x2b33('0x18')](_0x483cf4)['send'](_0x2e74d0);};}exports[_0x2b33('0x26')]=function(_0xa109f4,_0x9482a){var _0x268c1d={},_0xaa6643={},_0x312d4d={'count':0x0,'rows':[]};var _0x2be034=_[_0x2b33('0x27')](db[_0x2b33('0x28')][_0x2b33('0x29')],function(_0x4cf72f){return{'name':_0x4cf72f['fieldName'],'type':_0x4cf72f[_0x2b33('0x2a')][_0x2b33('0x2b')]};});_0xaa6643[_0x2b33('0x2c')]=_[_0x2b33('0x27')](_0x2be034,_0x2b33('0x25'));_0xaa6643['query']=_['keys'](_0xa109f4[_0x2b33('0x2d')]);_0xaa6643[_0x2b33('0x2e')]=_[_0x2b33('0x2f')](_0xaa6643[_0x2b33('0x2c')],_0xaa6643[_0x2b33('0x2d')]);_0x268c1d[_0x2b33('0x30')]=_['intersection'](_0xaa6643[_0x2b33('0x2c')],qs['fields'](_0xa109f4[_0x2b33('0x2d')][_0x2b33('0x31')]));_0x268c1d[_0x2b33('0x30')]=_0x268c1d[_0x2b33('0x30')][_0x2b33('0x32')]?_0x268c1d[_0x2b33('0x30')]:_0xaa6643[_0x2b33('0x2c')];if(!_0xa109f4[_0x2b33('0x2d')][_0x2b33('0x33')](_0x2b33('0x34'))){_0x268c1d[_0x2b33('0x1d')]=qs[_0x2b33('0x1d')](_0xa109f4[_0x2b33('0x2d')][_0x2b33('0x1d')]);_0x268c1d[_0x2b33('0x1b')]=qs[_0x2b33('0x1b')](_0xa109f4['query']['offset']);}_0x268c1d['order']=qs[_0x2b33('0x35')](_0xa109f4[_0x2b33('0x2d')][_0x2b33('0x35')]);_0x268c1d[_0x2b33('0x36')]=qs[_0x2b33('0x2e')](_['pick'](_0xa109f4['query'],_0xaa6643[_0x2b33('0x2e')]),_0x2be034);if(_0xa109f4['query'][_0x2b33('0x37')]){_0x268c1d[_0x2b33('0x36')]=_[_0x2b33('0x38')](_0x268c1d[_0x2b33('0x36')],{'$or':_[_0x2b33('0x27')](_0x2be034,function(_0x40a109){if(_0x40a109[_0x2b33('0x2a')]!==_0x2b33('0x39')){var _0x21557c={};_0x21557c[_0x40a109[_0x2b33('0x25')]]={'$like':'%'+_0xa109f4['query'][_0x2b33('0x37')]+'%'};return _0x21557c;}})});}_0x268c1d=_[_0x2b33('0x38')]({},_0x268c1d,_0xa109f4[_0x2b33('0x3a')]);var _0x5b7c32={'where':_0x268c1d['where']};return db[_0x2b33('0x28')]['count'](_0x5b7c32)[_0x2b33('0x23')](function(_0x23a27c){_0x312d4d['count']=_0x23a27c;if(_0xa109f4[_0x2b33('0x2d')][_0x2b33('0x3b')]){_0x268c1d['include']=[{'all':!![]}];}return db[_0x2b33('0x28')][_0x2b33('0x3c')](_0x268c1d);})['then'](function(_0x2168b6){_0x312d4d[_0x2b33('0x3d')]=_0x2168b6;return _0x312d4d;})[_0x2b33('0x23')](respondWithFilteredResult(_0x9482a,_0x268c1d))['catch'](handleError(_0x9482a,null));};exports[_0x2b33('0x3e')]=function(_0x26928a,_0x2b1c29){var _0x22f321={'raw':![],'where':{'id':_0x26928a['params']['id']}},_0x22ce0c={};_0x22ce0c[_0x2b33('0x2c')]=_[_0x2b33('0x3f')](db[_0x2b33('0x28')]['rawAttributes']);_0x22ce0c[_0x2b33('0x2d')]=_[_0x2b33('0x3f')](_0x26928a[_0x2b33('0x2d')]);_0x22ce0c[_0x2b33('0x2e')]=_['intersection'](_0x22ce0c[_0x2b33('0x2c')],_0x22ce0c[_0x2b33('0x2d')]);_0x22f321['attributes']=_['intersection'](_0x22ce0c['model'],qs[_0x2b33('0x31')](_0x26928a['query'][_0x2b33('0x31')]));_0x22f321[_0x2b33('0x30')]=_0x22f321[_0x2b33('0x30')][_0x2b33('0x32')]?_0x22f321[_0x2b33('0x30')]:_0x22ce0c[_0x2b33('0x2c')];if(_0x26928a[_0x2b33('0x2d')][_0x2b33('0x3b')]){_0x22f321['include']=[{'all':!![]}];}_0x22f321=_[_0x2b33('0x38')]({},_0x22f321,_0x26928a[_0x2b33('0x3a')]);return db[_0x2b33('0x28')][_0x2b33('0x40')](_0x22f321)[_0x2b33('0x23')](handleEntityNotFound(_0x2b1c29,null))[_0x2b33('0x23')](respondWithResult(_0x2b1c29,null))['catch'](handleError(_0x2b1c29,null));};exports['create']=function(_0x57cb02,_0x493123){return db[_0x2b33('0x28')]['create'](_0x57cb02[_0x2b33('0x41')],{})['then'](respondWithResult(_0x493123,0xc9))['catch'](handleError(_0x493123,null));};exports[_0x2b33('0x22')]=function(_0xd15da9,_0x357724){if(_0xd15da9['body']['id']){delete _0xd15da9[_0x2b33('0x41')]['id'];}return db['VtigerConfiguration'][_0x2b33('0x40')]({'where':{'id':_0xd15da9[_0x2b33('0x42')]['id']}})[_0x2b33('0x23')](handleEntityNotFound(_0x357724,null))[_0x2b33('0x23')](saveUpdates(_0xd15da9[_0x2b33('0x41')],null))[_0x2b33('0x23')](respondWithResult(_0x357724,null))['catch'](handleError(_0x357724,null));};exports[_0x2b33('0x43')]=function(_0x27f766,_0xc3fd2e){return db['VtigerConfiguration'][_0x2b33('0x40')]({'where':{'id':_0x27f766[_0x2b33('0x42')]['id']}})[_0x2b33('0x23')](handleEntityNotFound(_0xc3fd2e,null))['then'](removeEntity(_0xc3fd2e,null))[_0x2b33('0x44')](handleError(_0xc3fd2e,null));};exports['getFields']=function(_0x5efc74,_0x353224,_0x108d9a){var _0x24dc4c={};var _0xae5ffe={};var _0x307370;var _0x3022ca;return db[_0x2b33('0x28')][_0x2b33('0x45')]({'where':{'id':_0x5efc74['params']['id']}})[_0x2b33('0x23')](handleEntityNotFound(_0x353224,null))[_0x2b33('0x23')](function(_0x4808d5){if(_0x4808d5){_0x307370=_0x4808d5;_0xae5ffe[_0x2b33('0x2c')]=_[_0x2b33('0x3f')](db['VtigerField'][_0x2b33('0x29')]);_0xae5ffe[_0x2b33('0x2d')]=_[_0x2b33('0x3f')](_0x5efc74[_0x2b33('0x2d')]);_0xae5ffe['filters']=_[_0x2b33('0x2f')](_0xae5ffe[_0x2b33('0x2c')],_0xae5ffe['query']);_0x24dc4c[_0x2b33('0x30')]=_[_0x2b33('0x2f')](_0xae5ffe[_0x2b33('0x2c')],qs[_0x2b33('0x31')](_0x5efc74[_0x2b33('0x2d')][_0x2b33('0x31')]));_0x24dc4c[_0x2b33('0x30')]=_0x24dc4c['attributes']['length']?_0x24dc4c[_0x2b33('0x30')]:_0xae5ffe[_0x2b33('0x2c')];_0x24dc4c['order']=qs[_0x2b33('0x35')](_0x5efc74[_0x2b33('0x2d')][_0x2b33('0x35')]);_0x24dc4c['where']=qs[_0x2b33('0x2e')](_[_0x2b33('0x46')](_0x5efc74[_0x2b33('0x2d')],_0xae5ffe[_0x2b33('0x2e')]));if(_0x5efc74[_0x2b33('0x2d')][_0x2b33('0x37')]){_0x24dc4c[_0x2b33('0x36')]=_[_0x2b33('0x38')](_0x24dc4c['where'],{'$or':_['map'](_0x24dc4c[_0x2b33('0x30')],function(_0x138d2f){var _0x30d28f={};_0x30d28f[_0x138d2f]={'$like':'%'+_0x5efc74[_0x2b33('0x2d')][_0x2b33('0x37')]+'%'};return _0x30d28f;})});}_0x24dc4c=_[_0x2b33('0x38')]({},_0x24dc4c,_0x5efc74['options']);return _0x307370[_0x2b33('0x47')](_0x24dc4c);}})[_0x2b33('0x23')](function(_0x2eafb2){if(_0x2eafb2){_0x3022ca=_0x2eafb2[_0x2b33('0x32')];if(!_0x5efc74[_0x2b33('0x2d')][_0x2b33('0x33')]('nolimit')){_0x24dc4c[_0x2b33('0x1d')]=qs[_0x2b33('0x1d')](_0x5efc74[_0x2b33('0x2d')][_0x2b33('0x1d')]);_0x24dc4c[_0x2b33('0x1b')]=qs['offset'](_0x5efc74[_0x2b33('0x2d')][_0x2b33('0x1b')]);}return _0x307370[_0x2b33('0x47')](_0x24dc4c);}})[_0x2b33('0x23')](function(_0x49745e){if(_0x49745e){return _0x49745e?{'count':_0x3022ca,'rows':_0x49745e}:null;}})[_0x2b33('0x23')](respondWithResult(_0x353224,null))['catch'](handleError(_0x353224,null));};exports[_0x2b33('0x48')]=function(_0x23cb0b,_0x348ace,_0x24ad81){var _0x2904ab={};var _0x321940={};var _0x23fdb7;var _0x472db3;return db['VtigerConfiguration'][_0x2b33('0x45')]({'where':{'id':_0x23cb0b[_0x2b33('0x42')]['id']}})[_0x2b33('0x23')](handleEntityNotFound(_0x348ace,null))[_0x2b33('0x23')](function(_0x311c62){if(_0x311c62){_0x23fdb7=_0x311c62;_0x321940[_0x2b33('0x2c')]=_[_0x2b33('0x3f')](db[_0x2b33('0x49')][_0x2b33('0x29')]);_0x321940[_0x2b33('0x2d')]=_[_0x2b33('0x3f')](_0x23cb0b[_0x2b33('0x2d')]);_0x321940['filters']=_[_0x2b33('0x2f')](_0x321940['model'],_0x321940['query']);_0x2904ab[_0x2b33('0x30')]=_[_0x2b33('0x2f')](_0x321940[_0x2b33('0x2c')],qs['fields'](_0x23cb0b[_0x2b33('0x2d')][_0x2b33('0x31')]));_0x2904ab[_0x2b33('0x30')]=_0x2904ab[_0x2b33('0x30')]['length']?_0x2904ab['attributes']:_0x321940['model'];_0x2904ab['order']=qs['sort'](_0x23cb0b['query']['sort']);_0x2904ab[_0x2b33('0x36')]=qs[_0x2b33('0x2e')](_[_0x2b33('0x46')](_0x23cb0b['query'],_0x321940[_0x2b33('0x2e')]));if(_0x23cb0b[_0x2b33('0x2d')][_0x2b33('0x37')]){_0x2904ab[_0x2b33('0x36')]=_[_0x2b33('0x38')](_0x2904ab[_0x2b33('0x36')],{'$or':_['map'](_0x2904ab['attributes'],function(_0x57ef17){var _0x594f75={};_0x594f75[_0x57ef17]={'$like':'%'+_0x23cb0b['query']['filter']+'%'};return _0x594f75;})});}_0x2904ab=_[_0x2b33('0x38')]({},_0x2904ab,_0x23cb0b[_0x2b33('0x3a')]);return _0x23fdb7['getSubjects'](_0x2904ab);}})[_0x2b33('0x23')](function(_0xc06357){if(_0xc06357){_0x472db3=_0xc06357[_0x2b33('0x32')];if(!_0x23cb0b[_0x2b33('0x2d')][_0x2b33('0x33')](_0x2b33('0x34'))){_0x2904ab[_0x2b33('0x1d')]=qs['limit'](_0x23cb0b['query'][_0x2b33('0x1d')]);_0x2904ab[_0x2b33('0x1b')]=qs[_0x2b33('0x1b')](_0x23cb0b[_0x2b33('0x2d')][_0x2b33('0x1b')]);}return _0x23fdb7['getSubjects'](_0x2904ab);}})['then'](function(_0x51b862){if(_0x51b862){return _0x51b862?{'count':_0x472db3,'rows':_0x51b862}:null;}})[_0x2b33('0x23')](respondWithResult(_0x348ace,null))[_0x2b33('0x44')](handleError(_0x348ace,null));};exports[_0x2b33('0x4a')]=function(_0x5b2363,_0x5b9df0,_0x31d155){var _0x3e3f1f={};var _0x47fad0={};var _0x29571e;var _0x30e078;return db[_0x2b33('0x28')]['findOne']({'where':{'id':_0x5b2363[_0x2b33('0x42')]['id']}})[_0x2b33('0x23')](handleEntityNotFound(_0x5b9df0,null))[_0x2b33('0x23')](function(_0x44cec5){if(_0x44cec5){_0x29571e=_0x44cec5;_0x47fad0['model']=_[_0x2b33('0x3f')](db['VtigerField'][_0x2b33('0x29')]);_0x47fad0[_0x2b33('0x2d')]=_[_0x2b33('0x3f')](_0x5b2363[_0x2b33('0x2d')]);_0x47fad0[_0x2b33('0x2e')]=_['intersection'](_0x47fad0['model'],_0x47fad0[_0x2b33('0x2d')]);_0x3e3f1f['attributes']=_['intersection'](_0x47fad0[_0x2b33('0x2c')],qs[_0x2b33('0x31')](_0x5b2363[_0x2b33('0x2d')][_0x2b33('0x31')]));_0x3e3f1f[_0x2b33('0x30')]=_0x3e3f1f[_0x2b33('0x30')][_0x2b33('0x32')]?_0x3e3f1f[_0x2b33('0x30')]:_0x47fad0['model'];_0x3e3f1f['order']=qs['sort'](_0x5b2363[_0x2b33('0x2d')][_0x2b33('0x35')]);_0x3e3f1f['where']=qs[_0x2b33('0x2e')](_[_0x2b33('0x46')](_0x5b2363['query'],_0x47fad0[_0x2b33('0x2e')]));if(_0x5b2363['query'][_0x2b33('0x37')]){_0x3e3f1f[_0x2b33('0x36')]=_['merge'](_0x3e3f1f[_0x2b33('0x36')],{'$or':_[_0x2b33('0x27')](_0x3e3f1f['attributes'],function(_0x13f99c){var _0x56acea={};_0x56acea[_0x13f99c]={'$like':'%'+_0x5b2363[_0x2b33('0x2d')]['filter']+'%'};return _0x56acea;})});}_0x3e3f1f=_['merge']({},_0x3e3f1f,_0x5b2363['options']);return _0x29571e[_0x2b33('0x4a')](_0x3e3f1f);}})['then'](function(_0x190cc7){if(_0x190cc7){_0x30e078=_0x190cc7[_0x2b33('0x32')];if(!_0x5b2363[_0x2b33('0x2d')][_0x2b33('0x33')](_0x2b33('0x34'))){_0x3e3f1f[_0x2b33('0x1d')]=qs[_0x2b33('0x1d')](_0x5b2363[_0x2b33('0x2d')][_0x2b33('0x1d')]);_0x3e3f1f[_0x2b33('0x1b')]=qs[_0x2b33('0x1b')](_0x5b2363['query'][_0x2b33('0x1b')]);}return _0x29571e[_0x2b33('0x4a')](_0x3e3f1f);}})['then'](function(_0x20537f){if(_0x20537f){return _0x20537f?{'count':_0x30e078,'rows':_0x20537f}:null;}})['then'](respondWithResult(_0x5b9df0,null))[_0x2b33('0x44')](handleError(_0x5b9df0,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 39f97e9..9a302bc 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 _0x5c72=['moment','bluebird','request-promise','rimraf','../../config/environment','./intVtigerConfiguration.attributes','define','VtigerConfiguration','util','../../config/logger'];(function(_0x40401b,_0x52964f){var _0x12a63a=function(_0x1784a6){while(--_0x1784a6){_0x40401b['push'](_0x40401b['shift']());}};_0x12a63a(++_0x52964f);}(_0x5c72,0x120));var _0x25c7=function(_0x412e5c,_0x54b121){_0x412e5c=_0x412e5c-0x0;var _0x24f9a2=_0x5c72[_0x412e5c];return _0x24f9a2;};'use strict';var _=require('lodash');var util=require(_0x25c7('0x0'));var logger=require(_0x25c7('0x1'))('api');var moment=require(_0x25c7('0x2'));var BPromise=require(_0x25c7('0x3'));var rp=require(_0x25c7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x25c7('0x5'));var config=require(_0x25c7('0x6'));var attributes=require(_0x25c7('0x7'));module['exports']=function(_0x49013c,_0x65b6c9){return _0x49013c[_0x25c7('0x8')](_0x25c7('0x9'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb15=['./intVtigerConfiguration.attributes','exports','define','int_vtiger_configurations','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x44ff29,_0x3d1abe){var _0x2d4c40=function(_0x308837){while(--_0x308837){_0x44ff29['push'](_0x44ff29['shift']());}};_0x2d4c40(++_0x3d1abe);}(_0xcb15,0x1a6));var _0x5cb1=function(_0x14f41c,_0x3becf3){_0x14f41c=_0x14f41c-0x0;var _0x18fcd8=_0xcb15[_0x14f41c];return _0x18fcd8;};'use strict';var _=require('lodash');var util=require(_0x5cb1('0x0'));var logger=require(_0x5cb1('0x1'))('api');var moment=require(_0x5cb1('0x2'));var BPromise=require('bluebird');var rp=require(_0x5cb1('0x3'));var fs=require('fs');var path=require(_0x5cb1('0x4'));var rimraf=require(_0x5cb1('0x5'));var config=require(_0x5cb1('0x6'));var attributes=require(_0x5cb1('0x7'));module[_0x5cb1('0x8')]=function(_0x4cffc6,_0x366edb){return _0x4cffc6[_0x5cb1('0x9')]('VtigerConfiguration',attributes,{'tableName':_0x5cb1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 10acf02..c7f5568 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 _0x2551=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x2490ad,_0x33836e){var _0x38262d=function(_0x159a42){while(--_0x159a42){_0x2490ad['push'](_0x2490ad['shift']());}};_0x38262d(++_0x33836e);}(_0x2551,0xd7));var _0x1255=function(_0x441563,_0x1d4a28){_0x441563=_0x441563-0x0;var _0x2369ec=_0x2551[_0x441563];return _0x2369ec;};'use strict';var _=require(_0x1255('0x0'));var util=require(_0x1255('0x1'));var moment=require(_0x1255('0x2'));var BPromise=require(_0x1255('0x3'));var rs=require(_0x1255('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1255('0x5'))['db'];var utils=require(_0x1255('0x6'));var logger=require(_0x1255('0x7'))(_0x1255('0x8'));var config=require(_0x1255('0x9'));var jayson=require(_0x1255('0xa'));var client=jayson['client'][_0x1255('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x515040,_0x28fe85,_0x41c4e6){return new BPromise(function(_0x47eb82,_0x2d7783){return client['request'](_0x515040,_0x41c4e6)[_0x1255('0xc')](function(_0xaad351){logger[_0x1255('0xd')](_0x1255('0xe'),_0x28fe85,_0x1255('0xf'));logger[_0x1255('0x10')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x28fe85,_0x1255('0xf'),JSON['stringify'](_0xaad351));if(_0xaad351[_0x1255('0x11')]){if(_0xaad351[_0x1255('0x11')][_0x1255('0x12')]===0x1f4){logger[_0x1255('0x11')](_0x1255('0xe'),_0x28fe85,_0xaad351[_0x1255('0x11')][_0x1255('0x13')]);return _0x2d7783(_0xaad351[_0x1255('0x11')][_0x1255('0x13')]);}logger[_0x1255('0x11')](_0x1255('0xe'),_0x28fe85,_0xaad351[_0x1255('0x11')][_0x1255('0x13')]);return _0x47eb82(_0xaad351['error']['message']);}else{logger[_0x1255('0xd')](_0x1255('0xe'),_0x28fe85,_0x1255('0xf'));_0x47eb82(_0xaad351[_0x1255('0x14')][_0x1255('0x13')]);}})[_0x1255('0x15')](function(_0x2f34da){logger[_0x1255('0x11')](_0x1255('0xe'),_0x28fe85,_0x2f34da);_0x2d7783(_0x2f34da);});});} \ No newline at end of file +var _0xd93e=['code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x1050ae,_0x130aa6){var _0x2db33f=function(_0x170610){while(--_0x170610){_0x1050ae['push'](_0x1050ae['shift']());}};_0x2db33f(++_0x130aa6);}(_0xd93e,0x102));var _0xed93=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xd93e[_0x51020b];return _0x371e47;};'use strict';var _=require(_0xed93('0x0'));var util=require(_0xed93('0x1'));var moment=require(_0xed93('0x2'));var BPromise=require(_0xed93('0x3'));var rs=require(_0xed93('0x4'));var fs=require('fs');var Redis=require(_0xed93('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xed93('0x6'));var logger=require(_0xed93('0x7'))(_0xed93('0x8'));var config=require(_0xed93('0x9'));var jayson=require(_0xed93('0xa'));var client=jayson['client'][_0xed93('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f3afa,_0x5d5f36,_0x13bdbd){return new BPromise(function(_0x58e55e,_0x25492c){return client[_0xed93('0xc')](_0x4f3afa,_0x13bdbd)[_0xed93('0xd')](function(_0x5bd6c3){logger['info'](_0xed93('0xe'),_0x5d5f36,_0xed93('0xf'));logger[_0xed93('0x10')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x5d5f36,_0xed93('0xf'),JSON['stringify'](_0x5bd6c3));if(_0x5bd6c3[_0xed93('0x11')]){if(_0x5bd6c3[_0xed93('0x11')][_0xed93('0x12')]===0x1f4){logger[_0xed93('0x11')](_0xed93('0xe'),_0x5d5f36,_0x5bd6c3[_0xed93('0x11')][_0xed93('0x13')]);return _0x25492c(_0x5bd6c3[_0xed93('0x11')]['message']);}logger[_0xed93('0x11')](_0xed93('0xe'),_0x5d5f36,_0x5bd6c3['error'][_0xed93('0x13')]);return _0x58e55e(_0x5bd6c3[_0xed93('0x11')]['message']);}else{logger[_0xed93('0x14')](_0xed93('0xe'),_0x5d5f36,_0xed93('0xf'));_0x58e55e(_0x5bd6c3[_0xed93('0x15')][_0xed93('0x13')]);}})[_0xed93('0x16')](function(_0x1dca43){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x5d5f36,_0x1dca43);_0x25492c(_0x1dca43);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index c6f40ae..f60913f 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 _0xb330=['./intVtigerField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service'];(function(_0x5178fb,_0x121e19){var _0x348183=function(_0x52c2ec){while(--_0x52c2ec){_0x5178fb['push'](_0x5178fb['shift']());}};_0x348183(++_0x121e19);}(_0xb330,0x175));var _0x0b33=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb330[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0b33('0x0'));var util=require(_0x0b33('0x1'));var path=require(_0x0b33('0x2'));var timeout=require('connect-timeout');var express=require(_0x0b33('0x3'));var router=express[_0x0b33('0x4')]();var fs_extra=require(_0x0b33('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0b33('0x6'));var config=require('../../config/environment');var controller=require(_0x0b33('0x7'));router[_0x0b33('0x8')]('/',auth[_0x0b33('0x9')](),controller['index']);router[_0x0b33('0x8')](_0x0b33('0xa'),auth[_0x0b33('0x9')](),controller[_0x0b33('0xb')]);router[_0x0b33('0xc')]('/',auth[_0x0b33('0x9')](),controller[_0x0b33('0xd')]);router[_0x0b33('0xe')](_0x0b33('0xa'),auth['isAuthenticated'](),controller[_0x0b33('0xf')]);router[_0x0b33('0x10')]('/:id',auth[_0x0b33('0x9')](),controller[_0x0b33('0x11')]);module[_0x0b33('0x12')]=router; \ No newline at end of file +var _0xbd85=['../../config/environment','get','isAuthenticated','index','/:id','show','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0xbd85,0x13b));var _0x5bd8=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0xbd85[_0x3740fe];return _0x55492b;};'use strict';var multer=require(_0x5bd8('0x0'));var util=require(_0x5bd8('0x1'));var path=require('path');var timeout=require(_0x5bd8('0x2'));var express=require(_0x5bd8('0x3'));var router=express[_0x5bd8('0x4')]();var fs_extra=require(_0x5bd8('0x5'));var auth=require(_0x5bd8('0x6'));var interaction=require(_0x5bd8('0x7'));var config=require(_0x5bd8('0x8'));var controller=require('./intVtigerField.controller');router[_0x5bd8('0x9')]('/',auth[_0x5bd8('0xa')](),controller[_0x5bd8('0xb')]);router['get'](_0x5bd8('0xc'),auth['isAuthenticated'](),controller[_0x5bd8('0xd')]);router['post']('/',auth[_0x5bd8('0xa')](),controller[_0x5bd8('0xe')]);router[_0x5bd8('0xf')]('/:id',auth[_0x5bd8('0xa')](),controller[_0x5bd8('0x10')]);router[_0x5bd8('0x11')](_0x5bd8('0xc'),auth[_0x5bd8('0xa')](),controller['destroy']);module[_0x5bd8('0x12')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index bcba91e..027b06f 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 _0x6bbd=['variable','customVariable','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x9dfc30,_0x5b5fbf){var _0x299e3a=function(_0x3bf3ee){while(--_0x3bf3ee){_0x9dfc30['push'](_0x9dfc30['shift']());}};_0x299e3a(++_0x5b5fbf);}(_0x6bbd,0x17f));var _0xd6bb=function(_0x30f272,_0x401f2d){_0x30f272=_0x30f272-0x0;var _0x1969ce=_0x6bbd[_0x30f272];return _0x1969ce;};'use strict';var Sequelize=require(_0xd6bb('0x0'));module[_0xd6bb('0x1')]={'type':{'type':Sequelize[_0xd6bb('0x2')](_0xd6bb('0x3'),_0xd6bb('0x4'),_0xd6bb('0x5'),'keyValue',_0xd6bb('0x6')),'defaultValue':_0xd6bb('0x3')},'content':{'type':Sequelize[_0xd6bb('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xd6bb('0x2')]('string',_0xd6bb('0x4'),_0xd6bb('0x5'))},'keyContent':{'type':Sequelize[_0xd6bb('0x7')]},'idField':{'type':Sequelize[_0xd6bb('0x7')]},'nameField':{'type':Sequelize[_0xd6bb('0x7')]},'customField':{'type':Sequelize[_0xd6bb('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd6bb('0x7')]}}; \ No newline at end of file +var _0x1d40=['customVariable','keyValue','picklist','string','STRING','sequelize','exports','ENUM','variable'];(function(_0x555847,_0x533bc4){var _0x2ada83=function(_0x121ce3){while(--_0x121ce3){_0x555847['push'](_0x555847['shift']());}};_0x2ada83(++_0x533bc4);}(_0x1d40,0x11c));var _0x01d4=function(_0x4207a6,_0x3a3110){_0x4207a6=_0x4207a6-0x0;var _0x42b37a=_0x1d40[_0x4207a6];return _0x42b37a;};'use strict';var Sequelize=require(_0x01d4('0x0'));module[_0x01d4('0x1')]={'type':{'type':Sequelize[_0x01d4('0x2')]('string',_0x01d4('0x3'),_0x01d4('0x4'),_0x01d4('0x5'),_0x01d4('0x6')),'defaultValue':_0x01d4('0x7')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x01d4('0x8')]},'keyType':{'type':Sequelize[_0x01d4('0x2')]('string','variable',_0x01d4('0x4'))},'keyContent':{'type':Sequelize[_0x01d4('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x01d4('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x01d4('0x8')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 860f88a..31b6090 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 _0xd414=['model','query','filters','intersection','fields','attributes','nolimit','sort','where','filter','merge','VIRTUAL','options','VtigerField','includeAll','include','findAll','rows','catch','params','keys','length','find','create','body','rimraf','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','rawAttributes','fieldName','type','key'];(function(_0x4991d6,_0x348deb){var _0x50faf7=function(_0x14c7f8){while(--_0x14c7f8){_0x4991d6['push'](_0x4991d6['shift']());}};_0x50faf7(++_0x348deb);}(_0xd414,0x1cf));var _0x4d41=function(_0x59c0a8,_0x5b5428){_0x59c0a8=_0x59c0a8-0x0;var _0x30e308=_0xd414[_0x59c0a8];return _0x30e308;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4d41('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4d41('0x1'));var moment=require('moment');var BPromise=require(_0x4d41('0x2'));var Mustache=require(_0x4d41('0x3'));var util=require(_0x4d41('0x4'));var path=require(_0x4d41('0x5'));var sox=require('sox');var csv=require(_0x4d41('0x6'));var ejs=require(_0x4d41('0x7'));var fs=require('fs');var fs_extra=require(_0x4d41('0x8'));var _=require(_0x4d41('0x9'));var squel=require('squel');var crypto=require(_0x4d41('0xa'));var jsforce=require(_0x4d41('0xb'));var deskjs=require(_0x4d41('0xc'));var toCsv=require('to-csv');var querystring=require(_0x4d41('0xd'));var Papa=require(_0x4d41('0xe'));var Redis=require(_0x4d41('0xf'));var authService=require(_0x4d41('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4d41('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4d41('0x12'))(_0x4d41('0x13'));var utils=require(_0x4d41('0x14'));var config=require(_0x4d41('0x15'));var licenseUtil=require(_0x4d41('0x16'));var db=require(_0x4d41('0x17'))['db'];function respondWithStatusCode(_0x3391df,_0x761ee5){_0x761ee5=_0x761ee5||0xcc;return function(_0x178cd2){if(_0x178cd2){return _0x3391df[_0x4d41('0x18')](_0x761ee5);}return _0x3391df[_0x4d41('0x19')](_0x761ee5)[_0x4d41('0x1a')]();};}function respondWithResult(_0x131128,_0x539d34){_0x539d34=_0x539d34||0xc8;return function(_0x4b66d2){if(_0x4b66d2){return _0x131128['status'](_0x539d34)[_0x4d41('0x1b')](_0x4b66d2);}};}function respondWithFilteredResult(_0x296587,_0x4a0e47){return function(_0x551d1f){if(_0x551d1f){var _0x2dfd4a=typeof _0x4a0e47[_0x4d41('0x1c')]===_0x4d41('0x1d')&&typeof _0x4a0e47[_0x4d41('0x1e')]==='undefined';var _0x3d68b3=_0x551d1f[_0x4d41('0x1f')];var _0x2739b9=_0x2dfd4a?0x0:_0x4a0e47[_0x4d41('0x1c')];var _0x548c47=_0x2dfd4a?_0x551d1f['count']:_0x4a0e47[_0x4d41('0x1c')]+_0x4a0e47['limit'];var _0x1f2d45;if(_0x548c47>=_0x3d68b3){_0x548c47=_0x3d68b3;_0x1f2d45=0xc8;}else{_0x1f2d45=0xce;}_0x296587[_0x4d41('0x19')](_0x1f2d45);return _0x296587[_0x4d41('0x20')](_0x4d41('0x21'),_0x2739b9+'-'+_0x548c47+'/'+_0x3d68b3)[_0x4d41('0x1b')](_0x551d1f);}return null;};}function patchUpdates(_0x2ea09b){return function(_0x497b5e){try{jsonpatch[_0x4d41('0x22')](_0x497b5e,_0x2ea09b,!![]);}catch(_0x14f713){return BPromise[_0x4d41('0x23')](_0x14f713);}return _0x497b5e[_0x4d41('0x24')]();};}function saveUpdates(_0x1a6257,_0x69bf2b){return function(_0x27eb90){if(_0x27eb90){return _0x27eb90[_0x4d41('0x25')](_0x1a6257)[_0x4d41('0x26')](function(_0x422012){return _0x422012;});}return null;};}function removeEntity(_0x43d67e,_0x2697ba){return function(_0x3b62bf){if(_0x3b62bf){return _0x3b62bf[_0x4d41('0x27')]()[_0x4d41('0x26')](function(){_0x43d67e[_0x4d41('0x19')](0xcc)[_0x4d41('0x1a')]();});}};}function handleEntityNotFound(_0x5ce6a7,_0x2497f2){return function(_0x238e11){if(!_0x238e11){_0x5ce6a7[_0x4d41('0x18')](0x194);}return _0x238e11;};}function handleError(_0x29105a,_0x2d1b14){_0x2d1b14=_0x2d1b14||0x1f4;return function(_0x54c4bb){logger[_0x4d41('0x28')](_0x54c4bb['stack']);if(_0x54c4bb[_0x4d41('0x29')]){delete _0x54c4bb[_0x4d41('0x29')];}_0x29105a[_0x4d41('0x19')](_0x2d1b14)['send'](_0x54c4bb);};}exports[_0x4d41('0x2a')]=function(_0x53509c,_0x15c724){var _0x1c45a4={},_0x46d810={},_0x2bf628={'count':0x0,'rows':[]};var _0x21dad5=_[_0x4d41('0x2b')](db['VtigerField'][_0x4d41('0x2c')],function(_0x16c6e5){return{'name':_0x16c6e5[_0x4d41('0x2d')],'type':_0x16c6e5[_0x4d41('0x2e')][_0x4d41('0x2f')]};});_0x46d810[_0x4d41('0x30')]=_['map'](_0x21dad5,_0x4d41('0x29'));_0x46d810[_0x4d41('0x31')]=_['keys'](_0x53509c['query']);_0x46d810[_0x4d41('0x32')]=_[_0x4d41('0x33')](_0x46d810['model'],_0x46d810[_0x4d41('0x31')]);_0x1c45a4['attributes']=_[_0x4d41('0x33')](_0x46d810[_0x4d41('0x30')],qs[_0x4d41('0x34')](_0x53509c[_0x4d41('0x31')][_0x4d41('0x34')]));_0x1c45a4[_0x4d41('0x35')]=_0x1c45a4[_0x4d41('0x35')]['length']?_0x1c45a4[_0x4d41('0x35')]:_0x46d810['model'];if(!_0x53509c[_0x4d41('0x31')]['hasOwnProperty'](_0x4d41('0x36'))){_0x1c45a4[_0x4d41('0x1e')]=qs[_0x4d41('0x1e')](_0x53509c[_0x4d41('0x31')][_0x4d41('0x1e')]);_0x1c45a4[_0x4d41('0x1c')]=qs[_0x4d41('0x1c')](_0x53509c[_0x4d41('0x31')]['offset']);}_0x1c45a4['order']=qs[_0x4d41('0x37')](_0x53509c['query'][_0x4d41('0x37')]);_0x1c45a4[_0x4d41('0x38')]=qs[_0x4d41('0x32')](_['pick'](_0x53509c[_0x4d41('0x31')],_0x46d810[_0x4d41('0x32')]),_0x21dad5);if(_0x53509c[_0x4d41('0x31')][_0x4d41('0x39')]){_0x1c45a4[_0x4d41('0x38')]=_[_0x4d41('0x3a')](_0x1c45a4[_0x4d41('0x38')],{'$or':_['map'](_0x21dad5,function(_0x2d616b){if(_0x2d616b[_0x4d41('0x2e')]!==_0x4d41('0x3b')){var _0x5409da={};_0x5409da[_0x2d616b[_0x4d41('0x29')]]={'$like':'%'+_0x53509c[_0x4d41('0x31')][_0x4d41('0x39')]+'%'};return _0x5409da;}})});}_0x1c45a4=_[_0x4d41('0x3a')]({},_0x1c45a4,_0x53509c[_0x4d41('0x3c')]);var _0x28a55d={'where':_0x1c45a4[_0x4d41('0x38')]};return db[_0x4d41('0x3d')]['count'](_0x28a55d)[_0x4d41('0x26')](function(_0x11dd16){_0x2bf628[_0x4d41('0x1f')]=_0x11dd16;if(_0x53509c['query'][_0x4d41('0x3e')]){_0x1c45a4[_0x4d41('0x3f')]=[{'all':!![]}];}return db[_0x4d41('0x3d')][_0x4d41('0x40')](_0x1c45a4);})[_0x4d41('0x26')](function(_0x5486d0){_0x2bf628[_0x4d41('0x41')]=_0x5486d0;return _0x2bf628;})[_0x4d41('0x26')](respondWithFilteredResult(_0x15c724,_0x1c45a4))[_0x4d41('0x42')](handleError(_0x15c724,null));};exports['show']=function(_0x11a83c,_0x14a8dc){var _0x35ab57={'raw':!![],'where':{'id':_0x11a83c[_0x4d41('0x43')]['id']}},_0x13e398={};_0x13e398[_0x4d41('0x30')]=_[_0x4d41('0x44')](db[_0x4d41('0x3d')][_0x4d41('0x2c')]);_0x13e398[_0x4d41('0x31')]=_['keys'](_0x11a83c[_0x4d41('0x31')]);_0x13e398[_0x4d41('0x32')]=_[_0x4d41('0x33')](_0x13e398[_0x4d41('0x30')],_0x13e398[_0x4d41('0x31')]);_0x35ab57[_0x4d41('0x35')]=_[_0x4d41('0x33')](_0x13e398[_0x4d41('0x30')],qs['fields'](_0x11a83c['query'][_0x4d41('0x34')]));_0x35ab57[_0x4d41('0x35')]=_0x35ab57[_0x4d41('0x35')][_0x4d41('0x45')]?_0x35ab57[_0x4d41('0x35')]:_0x13e398[_0x4d41('0x30')];if(_0x11a83c['query']['includeAll']){_0x35ab57[_0x4d41('0x3f')]=[{'all':!![]}];}_0x35ab57=_[_0x4d41('0x3a')]({},_0x35ab57,_0x11a83c['options']);return db[_0x4d41('0x3d')][_0x4d41('0x46')](_0x35ab57)['then'](handleEntityNotFound(_0x14a8dc,null))[_0x4d41('0x26')](respondWithResult(_0x14a8dc,null))[_0x4d41('0x42')](handleError(_0x14a8dc,null));};exports[_0x4d41('0x47')]=function(_0x3bf3c8,_0x217c54){return db[_0x4d41('0x3d')][_0x4d41('0x47')](_0x3bf3c8[_0x4d41('0x48')],{})[_0x4d41('0x26')](respondWithResult(_0x217c54,0xc9))['catch'](handleError(_0x217c54,null));};exports[_0x4d41('0x25')]=function(_0x28f58a,_0x430ae5){if(_0x28f58a['body']['id']){delete _0x28f58a['body']['id'];}return db[_0x4d41('0x3d')]['find']({'where':{'id':_0x28f58a[_0x4d41('0x43')]['id']}})[_0x4d41('0x26')](handleEntityNotFound(_0x430ae5,null))[_0x4d41('0x26')](saveUpdates(_0x28f58a[_0x4d41('0x48')],null))[_0x4d41('0x26')](respondWithResult(_0x430ae5,null))[_0x4d41('0x42')](handleError(_0x430ae5,null));};exports[_0x4d41('0x27')]=function(_0x15608c,_0x14cad0){return db[_0x4d41('0x3d')][_0x4d41('0x46')]({'where':{'id':_0x15608c[_0x4d41('0x43')]['id']}})[_0x4d41('0x26')](handleEntityNotFound(_0x14cad0,null))[_0x4d41('0x26')](removeEntity(_0x14cad0,null))['catch'](handleError(_0x14cad0,null));}; \ No newline at end of file +var _0xb971=['limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','options','includeAll','findAll','rows','catch','params','keys','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset'];(function(_0x68096d,_0x4897b8){var _0x1c4b54=function(_0x468e06){while(--_0x468e06){_0x68096d['push'](_0x68096d['shift']());}};_0x1c4b54(++_0x4897b8);}(_0xb971,0x1c9));var _0x1b97=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb971[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x1b97('0x0'));var rimraf=require(_0x1b97('0x1'));var zipdir=require(_0x1b97('0x2'));var jsonpatch=require(_0x1b97('0x3'));var rp=require('request-promise');var moment=require(_0x1b97('0x4'));var BPromise=require(_0x1b97('0x5'));var Mustache=require(_0x1b97('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x1b97('0x7'));var ejs=require(_0x1b97('0x8'));var fs=require('fs');var fs_extra=require(_0x1b97('0x9'));var _=require('lodash');var squel=require(_0x1b97('0xa'));var crypto=require(_0x1b97('0xb'));var jsforce=require(_0x1b97('0xc'));var deskjs=require(_0x1b97('0xd'));var toCsv=require(_0x1b97('0x7'));var querystring=require('querystring');var Papa=require(_0x1b97('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1b97('0xf'));var as=require(_0x1b97('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1b97('0x11'))(_0x1b97('0x12'));var utils=require(_0x1b97('0x13'));var config=require(_0x1b97('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x1b97('0x15'))['db'];function respondWithStatusCode(_0x2a3103,_0x37d370){_0x37d370=_0x37d370||0xcc;return function(_0x19b749){if(_0x19b749){return _0x2a3103['sendStatus'](_0x37d370);}return _0x2a3103[_0x1b97('0x16')](_0x37d370)[_0x1b97('0x17')]();};}function respondWithResult(_0x2047d0,_0x1f2921){_0x1f2921=_0x1f2921||0xc8;return function(_0xfcd466){if(_0xfcd466){return _0x2047d0[_0x1b97('0x16')](_0x1f2921)[_0x1b97('0x18')](_0xfcd466);}};}function respondWithFilteredResult(_0x430ee5,_0x3d40f7){return function(_0x5ec6f4){if(_0x5ec6f4){var _0xda1117=typeof _0x3d40f7[_0x1b97('0x19')]==='undefined'&&typeof _0x3d40f7[_0x1b97('0x1a')]==='undefined';var _0x1fb544=_0x5ec6f4[_0x1b97('0x1b')];var _0x56663d=_0xda1117?0x0:_0x3d40f7[_0x1b97('0x19')];var _0x538bfc=_0xda1117?_0x5ec6f4['count']:_0x3d40f7[_0x1b97('0x19')]+_0x3d40f7[_0x1b97('0x1a')];var _0x5fc304;if(_0x538bfc>=_0x1fb544){_0x538bfc=_0x1fb544;_0x5fc304=0xc8;}else{_0x5fc304=0xce;}_0x430ee5[_0x1b97('0x16')](_0x5fc304);return _0x430ee5['set'](_0x1b97('0x1c'),_0x56663d+'-'+_0x538bfc+'/'+_0x1fb544)[_0x1b97('0x18')](_0x5ec6f4);}return null;};}function patchUpdates(_0x2e8b69){return function(_0xda6186){try{jsonpatch[_0x1b97('0x1d')](_0xda6186,_0x2e8b69,!![]);}catch(_0x4f813a){return BPromise[_0x1b97('0x1e')](_0x4f813a);}return _0xda6186[_0x1b97('0x1f')]();};}function saveUpdates(_0x3504e3,_0x5a150d){return function(_0x1d7bbc){if(_0x1d7bbc){return _0x1d7bbc[_0x1b97('0x20')](_0x3504e3)[_0x1b97('0x21')](function(_0x187e13){return _0x187e13;});}return null;};}function removeEntity(_0x35e83d,_0x9f5efd){return function(_0x3d1c5a){if(_0x3d1c5a){return _0x3d1c5a[_0x1b97('0x22')]()[_0x1b97('0x21')](function(){_0x35e83d[_0x1b97('0x16')](0xcc)[_0x1b97('0x17')]();});}};}function handleEntityNotFound(_0x19e115,_0x546b0b){return function(_0xea3590){if(!_0xea3590){_0x19e115['sendStatus'](0x194);}return _0xea3590;};}function handleError(_0x5a3279,_0x36bbeb){_0x36bbeb=_0x36bbeb||0x1f4;return function(_0x22adb4){logger[_0x1b97('0x23')](_0x22adb4[_0x1b97('0x24')]);if(_0x22adb4['name']){delete _0x22adb4[_0x1b97('0x25')];}_0x5a3279[_0x1b97('0x16')](_0x36bbeb)[_0x1b97('0x26')](_0x22adb4);};}exports[_0x1b97('0x27')]=function(_0x50f558,_0x1505c3){var _0x3bd292={},_0x4ce136={},_0x151d34={'count':0x0,'rows':[]};var _0x821c5a=_[_0x1b97('0x28')](db[_0x1b97('0x29')][_0x1b97('0x2a')],function(_0xe0583b){return{'name':_0xe0583b[_0x1b97('0x2b')],'type':_0xe0583b['type']['key']};});_0x4ce136[_0x1b97('0x2c')]=_[_0x1b97('0x28')](_0x821c5a,_0x1b97('0x25'));_0x4ce136[_0x1b97('0x2d')]=_['keys'](_0x50f558['query']);_0x4ce136[_0x1b97('0x2e')]=_[_0x1b97('0x2f')](_0x4ce136[_0x1b97('0x2c')],_0x4ce136[_0x1b97('0x2d')]);_0x3bd292[_0x1b97('0x30')]=_['intersection'](_0x4ce136[_0x1b97('0x2c')],qs[_0x1b97('0x31')](_0x50f558['query'][_0x1b97('0x31')]));_0x3bd292['attributes']=_0x3bd292[_0x1b97('0x30')]['length']?_0x3bd292[_0x1b97('0x30')]:_0x4ce136[_0x1b97('0x2c')];if(!_0x50f558[_0x1b97('0x2d')][_0x1b97('0x32')](_0x1b97('0x33'))){_0x3bd292[_0x1b97('0x1a')]=qs['limit'](_0x50f558[_0x1b97('0x2d')][_0x1b97('0x1a')]);_0x3bd292[_0x1b97('0x19')]=qs[_0x1b97('0x19')](_0x50f558[_0x1b97('0x2d')]['offset']);}_0x3bd292[_0x1b97('0x34')]=qs['sort'](_0x50f558['query'][_0x1b97('0x35')]);_0x3bd292[_0x1b97('0x36')]=qs[_0x1b97('0x2e')](_['pick'](_0x50f558['query'],_0x4ce136['filters']),_0x821c5a);if(_0x50f558[_0x1b97('0x2d')][_0x1b97('0x37')]){_0x3bd292[_0x1b97('0x36')]=_[_0x1b97('0x38')](_0x3bd292['where'],{'$or':_[_0x1b97('0x28')](_0x821c5a,function(_0x7e1401){if(_0x7e1401[_0x1b97('0x39')]!=='VIRTUAL'){var _0x2e8ae9={};_0x2e8ae9[_0x7e1401[_0x1b97('0x25')]]={'$like':'%'+_0x50f558['query']['filter']+'%'};return _0x2e8ae9;}})});}_0x3bd292=_[_0x1b97('0x38')]({},_0x3bd292,_0x50f558[_0x1b97('0x3a')]);var _0x24f2bc={'where':_0x3bd292['where']};return db[_0x1b97('0x29')][_0x1b97('0x1b')](_0x24f2bc)[_0x1b97('0x21')](function(_0x5bfaf5){_0x151d34['count']=_0x5bfaf5;if(_0x50f558['query'][_0x1b97('0x3b')]){_0x3bd292['include']=[{'all':!![]}];}return db[_0x1b97('0x29')][_0x1b97('0x3c')](_0x3bd292);})[_0x1b97('0x21')](function(_0xe1db12){_0x151d34[_0x1b97('0x3d')]=_0xe1db12;return _0x151d34;})[_0x1b97('0x21')](respondWithFilteredResult(_0x1505c3,_0x3bd292))[_0x1b97('0x3e')](handleError(_0x1505c3,null));};exports['show']=function(_0x59ec3a,_0x3dcb3a){var _0x5e96c0={'raw':!![],'where':{'id':_0x59ec3a[_0x1b97('0x3f')]['id']}},_0x335031={};_0x335031[_0x1b97('0x2c')]=_[_0x1b97('0x40')](db[_0x1b97('0x29')][_0x1b97('0x2a')]);_0x335031[_0x1b97('0x2d')]=_[_0x1b97('0x40')](_0x59ec3a['query']);_0x335031[_0x1b97('0x2e')]=_[_0x1b97('0x2f')](_0x335031[_0x1b97('0x2c')],_0x335031[_0x1b97('0x2d')]);_0x5e96c0['attributes']=_[_0x1b97('0x2f')](_0x335031[_0x1b97('0x2c')],qs[_0x1b97('0x31')](_0x59ec3a[_0x1b97('0x2d')][_0x1b97('0x31')]));_0x5e96c0[_0x1b97('0x30')]=_0x5e96c0['attributes']['length']?_0x5e96c0[_0x1b97('0x30')]:_0x335031[_0x1b97('0x2c')];if(_0x59ec3a['query'][_0x1b97('0x3b')]){_0x5e96c0[_0x1b97('0x41')]=[{'all':!![]}];}_0x5e96c0=_[_0x1b97('0x38')]({},_0x5e96c0,_0x59ec3a[_0x1b97('0x3a')]);return db['VtigerField'][_0x1b97('0x42')](_0x5e96c0)[_0x1b97('0x21')](handleEntityNotFound(_0x3dcb3a,null))['then'](respondWithResult(_0x3dcb3a,null))[_0x1b97('0x3e')](handleError(_0x3dcb3a,null));};exports[_0x1b97('0x43')]=function(_0x3a5371,_0x4b564b){return db['VtigerField'][_0x1b97('0x43')](_0x3a5371[_0x1b97('0x44')],{})[_0x1b97('0x21')](respondWithResult(_0x4b564b,0xc9))[_0x1b97('0x3e')](handleError(_0x4b564b,null));};exports[_0x1b97('0x20')]=function(_0x102c63,_0x3189e6){if(_0x102c63['body']['id']){delete _0x102c63['body']['id'];}return db['VtigerField'][_0x1b97('0x42')]({'where':{'id':_0x102c63[_0x1b97('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3189e6,null))['then'](saveUpdates(_0x102c63[_0x1b97('0x44')],null))['then'](respondWithResult(_0x3189e6,null))['catch'](handleError(_0x3189e6,null));};exports['destroy']=function(_0x57075b,_0x2bb468){return db['VtigerField'][_0x1b97('0x42')]({'where':{'id':_0x57075b[_0x1b97('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2bb468,null))[_0x1b97('0x21')](removeEntity(_0x2bb468,null))[_0x1b97('0x3e')](handleError(_0x2bb468,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 07e077b..ca9579c 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 _0x9433=['../../config/logger','api','moment','bluebird','request-promise','path','./intVtigerField.attributes','exports','define','VtigerField','vtiger_unique_index','idField','FieldId','lodash','util'];(function(_0xc7b4e2,_0xe6145a){var _0x1f01c7=function(_0x9427a7){while(--_0x9427a7){_0xc7b4e2['push'](_0xc7b4e2['shift']());}};_0x1f01c7(++_0xe6145a);}(_0x9433,0x193));var _0x3943=function(_0x396474,_0x58ec28){_0x396474=_0x396474-0x0;var _0x59542d=_0x9433[_0x396474];return _0x59542d;};'use strict';var _=require(_0x3943('0x0'));var util=require(_0x3943('0x1'));var logger=require(_0x3943('0x2'))(_0x3943('0x3'));var moment=require(_0x3943('0x4'));var BPromise=require(_0x3943('0x5'));var rp=require(_0x3943('0x6'));var fs=require('fs');var path=require(_0x3943('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3943('0x8'));module[_0x3943('0x9')]=function(_0x1b6f02,_0x437d3e){return _0x1b6f02[_0x3943('0xa')](_0x3943('0xb'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x3943('0xc'),'fields':[_0x3943('0xd'),_0x3943('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x277e=['define','idField','FieldId','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intVtigerField.attributes'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x277e,0x11b));var _0xe277=function(_0x646c39,_0x11fc2a){_0x646c39=_0x646c39-0x0;var _0x637be6=_0x277e[_0x646c39];return _0x637be6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe277('0x0'))(_0xe277('0x1'));var moment=require('moment');var BPromise=require(_0xe277('0x2'));var rp=require(_0xe277('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe277('0x4'));var config=require(_0xe277('0x5'));var attributes=require(_0xe277('0x6'));module['exports']=function(_0x592bca,_0x40fa4f){return _0x592bca[_0xe277('0x7')]('VtigerField',attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0xe277('0x8'),_0xe277('0x9')],'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 e99274a..f8ac7b5 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 _0xc5c2=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerField,\x20%s,\x20%s','message','result','catch'];(function(_0x228a28,_0x33a4c2){var _0x57b41a=function(_0x4ed298){while(--_0x4ed298){_0x228a28['push'](_0x228a28['shift']());}};_0x57b41a(++_0x33a4c2);}(_0xc5c2,0x73));var _0x2c5c=function(_0x2df8c7,_0x101d49){_0x2df8c7=_0x2df8c7-0x0;var _0x54a823=_0xc5c2[_0x2df8c7];return _0x54a823;};'use strict';var _=require(_0x2c5c('0x0'));var util=require(_0x2c5c('0x1'));var moment=require(_0x2c5c('0x2'));var BPromise=require('bluebird');var rs=require(_0x2c5c('0x3'));var fs=require('fs');var Redis=require(_0x2c5c('0x4'));var db=require(_0x2c5c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2c5c('0x6'))(_0x2c5c('0x7'));var config=require(_0x2c5c('0x8'));var jayson=require(_0x2c5c('0x9'));var client=jayson[_0x2c5c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b1134,_0x3d7304,_0x662a41){return new BPromise(function(_0x27f729,_0x43533a){return client['request'](_0x5b1134,_0x662a41)[_0x2c5c('0xb')](function(_0x4688aa){logger[_0x2c5c('0xc')]('VtigerField,\x20%s,\x20%s',_0x3d7304,_0x2c5c('0xd'));logger[_0x2c5c('0xe')](_0x2c5c('0xf'),_0x3d7304,_0x2c5c('0xd'),JSON[_0x2c5c('0x10')](_0x4688aa));if(_0x4688aa['error']){if(_0x4688aa[_0x2c5c('0x11')][_0x2c5c('0x12')]===0x1f4){logger[_0x2c5c('0x11')](_0x2c5c('0x13'),_0x3d7304,_0x4688aa[_0x2c5c('0x11')][_0x2c5c('0x14')]);return _0x43533a(_0x4688aa[_0x2c5c('0x11')][_0x2c5c('0x14')]);}logger[_0x2c5c('0x11')]('VtigerField,\x20%s,\x20%s',_0x3d7304,_0x4688aa[_0x2c5c('0x11')][_0x2c5c('0x14')]);return _0x27f729(_0x4688aa[_0x2c5c('0x11')][_0x2c5c('0x14')]);}else{logger['info']('VtigerField,\x20%s,\x20%s',_0x3d7304,_0x2c5c('0xd'));_0x27f729(_0x4688aa[_0x2c5c('0x15')]['message']);}})[_0x2c5c('0x16')](function(_0x24f904){logger['error'](_0x2c5c('0x13'),_0x3d7304,_0x24f904);_0x43533a(_0x24f904);});});} \ No newline at end of file +var _0xe6b9=['stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s'];(function(_0x296972,_0x49ee01){var _0x183ca8=function(_0x47185e){while(--_0x47185e){_0x296972['push'](_0x296972['shift']());}};_0x183ca8(++_0x49ee01);}(_0xe6b9,0x1cd));var _0x9e6b=function(_0x16629d,_0x492375){_0x16629d=_0x16629d-0x0;var _0x56ccee=_0xe6b9[_0x16629d];return _0x56ccee;};'use strict';var _=require(_0x9e6b('0x0'));var util=require(_0x9e6b('0x1'));var moment=require(_0x9e6b('0x2'));var BPromise=require(_0x9e6b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9e6b('0x4'));var db=require(_0x9e6b('0x5'))['db'];var utils=require(_0x9e6b('0x6'));var logger=require(_0x9e6b('0x7'))(_0x9e6b('0x8'));var config=require(_0x9e6b('0x9'));var jayson=require(_0x9e6b('0xa'));var client=jayson[_0x9e6b('0xb')][_0x9e6b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x885139,_0x2c59d4,_0x17888b){return new BPromise(function(_0x50bc15,_0x232225){return client['request'](_0x885139,_0x17888b)[_0x9e6b('0xd')](function(_0x33c49f){logger[_0x9e6b('0xe')](_0x9e6b('0xf'),_0x2c59d4,_0x9e6b('0x10'));logger[_0x9e6b('0x11')](_0x9e6b('0x12'),_0x2c59d4,_0x9e6b('0x10'),JSON[_0x9e6b('0x13')](_0x33c49f));if(_0x33c49f[_0x9e6b('0x14')]){if(_0x33c49f[_0x9e6b('0x14')][_0x9e6b('0x15')]===0x1f4){logger[_0x9e6b('0x14')](_0x9e6b('0xf'),_0x2c59d4,_0x33c49f['error'][_0x9e6b('0x16')]);return _0x232225(_0x33c49f[_0x9e6b('0x14')][_0x9e6b('0x16')]);}logger['error'](_0x9e6b('0xf'),_0x2c59d4,_0x33c49f[_0x9e6b('0x14')][_0x9e6b('0x16')]);return _0x50bc15(_0x33c49f['error'][_0x9e6b('0x16')]);}else{logger[_0x9e6b('0xe')](_0x9e6b('0xf'),_0x2c59d4,_0x9e6b('0x10'));_0x50bc15(_0x33c49f[_0x9e6b('0x17')]['message']);}})['catch'](function(_0x1126df){logger[_0x9e6b('0x14')]('VtigerField,\x20%s,\x20%s',_0x2c59d4,_0x1126df);_0x232225(_0x1126df);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 70ad775..dd0a4b1 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 _0x8406=['getConfigurations','/:id/fields','getFields','post','addConfiguration','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations'];(function(_0x378720,_0xa711f1){var _0x47920a=function(_0xc5056){while(--_0xc5056){_0x378720['push'](_0x378720['shift']());}};_0x47920a(++_0xa711f1);}(_0x8406,0x1b9));var _0x6840=function(_0x1f41bd,_0x26aafe){_0x1f41bd=_0x1f41bd-0x0;var _0x2718ef=_0x8406[_0x1f41bd];return _0x2718ef;};'use strict';var multer=require(_0x6840('0x0'));var util=require(_0x6840('0x1'));var path=require(_0x6840('0x2'));var timeout=require('connect-timeout');var express=require(_0x6840('0x3'));var router=express[_0x6840('0x4')]();var fs_extra=require(_0x6840('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6840('0x6'));var config=require(_0x6840('0x7'));var controller=require(_0x6840('0x8'));router[_0x6840('0x9')]('/',auth['isAuthenticated'](),controller[_0x6840('0xa')]);router[_0x6840('0x9')](_0x6840('0xb'),auth[_0x6840('0xc')](),controller[_0x6840('0xd')]);router[_0x6840('0x9')](_0x6840('0xe'),auth['isAuthenticated'](),controller[_0x6840('0xf')]);router[_0x6840('0x9')](_0x6840('0x10'),auth[_0x6840('0xc')](),controller[_0x6840('0x11')]);router[_0x6840('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6840('0x12')]('/:id/configurations',auth[_0x6840('0xc')](),controller[_0x6840('0x13')]);router[_0x6840('0x14')](_0x6840('0xb'),auth[_0x6840('0xc')](),controller['update']);router[_0x6840('0x15')]('/:id',auth[_0x6840('0xc')](),controller[_0x6840('0x16')]);module[_0x6840('0x17')]=router; \ No newline at end of file +var _0xbabb=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','post','/:id/configurations','addConfiguration','put','delete','exports','multer','util'];(function(_0x435ce7,_0x5bf1ef){var _0x47edc0=function(_0x3510a8){while(--_0x3510a8){_0x435ce7['push'](_0x435ce7['shift']());}};_0x47edc0(++_0x5bf1ef);}(_0xbabb,0x106));var _0xbbab=function(_0x5bb2b0,_0x49d606){_0x5bb2b0=_0x5bb2b0-0x0;var _0x2e0359=_0xbabb[_0x5bb2b0];return _0x2e0359;};'use strict';var multer=require(_0xbbab('0x0'));var util=require(_0xbbab('0x1'));var path=require('path');var timeout=require(_0xbbab('0x2'));var express=require(_0xbbab('0x3'));var router=express[_0xbbab('0x4')]();var fs_extra=require(_0xbbab('0x5'));var auth=require(_0xbbab('0x6'));var interaction=require(_0xbbab('0x7'));var config=require('../../config/environment');var controller=require(_0xbbab('0x8'));router[_0xbbab('0x9')]('/',auth[_0xbbab('0xa')](),controller[_0xbbab('0xb')]);router['get'](_0xbbab('0xc'),auth[_0xbbab('0xa')](),controller[_0xbbab('0xd')]);router[_0xbbab('0x9')]('/:id/configurations',auth[_0xbbab('0xa')](),controller[_0xbbab('0xe')]);router[_0xbbab('0x9')](_0xbbab('0xf'),auth[_0xbbab('0xa')](),controller['getFields']);router[_0xbbab('0x10')]('/',auth[_0xbbab('0xa')](),controller['create']);router[_0xbbab('0x10')](_0xbbab('0x11'),auth[_0xbbab('0xa')](),controller[_0xbbab('0x12')]);router[_0xbbab('0x13')]('/:id',auth[_0xbbab('0xa')](),controller['update']);router[_0xbbab('0x14')](_0xbbab('0xc'),auth[_0xbbab('0xa')](),controller['destroy']);module[_0xbbab('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index b902df5..d551103 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 _0x0120=['password','integrationTab','newTab','sequelize','exports','STRING','username','remoteUri','ENUM'];(function(_0x1162f9,_0x35f87c){var _0x75257c=function(_0x11ac6b){while(--_0x11ac6b){_0x1162f9['push'](_0x1162f9['shift']());}};_0x75257c(++_0x35f87c);}(_0x0120,0x6f));var _0x0012=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x0120[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0x0012('0x0'));module[_0x0012('0x1')]={'name':{'type':Sequelize[_0x0012('0x2')]},'description':{'type':Sequelize[_0x0012('0x2')]},'username':{'type':Sequelize[_0x0012('0x2')],'unique':_0x0012('0x3')},'password':{'type':Sequelize[_0x0012('0x2')]},'token':{'type':Sequelize[_0x0012('0x2')]},'remoteUri':{'type':Sequelize[_0x0012('0x2')],'unique':_0x0012('0x4')},'authType':{'type':Sequelize[_0x0012('0x5')](_0x0012('0x6'),'token'),'defaultValue':'password'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x0012('0x5')](_0x0012('0x7'),_0x0012('0x8')),'defaultValue':_0x0012('0x7')}}; \ No newline at end of file +var _0x2272=['sequelize','exports','STRING','password','token','ENUM','integrationTab','newTab'];(function(_0x12652e,_0x491d02){var _0x1a13b6=function(_0x4c7b50){while(--_0x4c7b50){_0x12652e['push'](_0x12652e['shift']());}};_0x1a13b6(++_0x491d02);}(_0x2272,0xd8));var _0x2227=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x2272[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x2227('0x0'));module[_0x2227('0x1')]={'name':{'type':Sequelize[_0x2227('0x2')]},'description':{'type':Sequelize[_0x2227('0x2')]},'username':{'type':Sequelize[_0x2227('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x2227('0x2')]},'token':{'type':Sequelize[_0x2227('0x2')]},'remoteUri':{'type':Sequelize[_0x2227('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize['ENUM'](_0x2227('0x3'),_0x2227('0x4')),'defaultValue':_0x2227('0x3')},'serverUrl':{'type':Sequelize[_0x2227('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x2227('0x5')](_0x2227('0x6'),_0x2227('0x7')),'defaultValue':_0x2227('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 3b85716..7d740f3 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 _0x750a=['crypto','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','destroy','then','error','name','index','map','ZendeskAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','type','merge','options','includeAll','include','rows','catch','show','params','find','create','body','ZendeskConfiguration','getConfigurations','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','authType','remoteUri','slice','substring','lastIndexOf','GET','ticket_fields','password','headers','format','Basic\x20%s','%s:%s','token','%s/token:%s','toString','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','remove','includes','title','position','system_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x339129,_0x86dcc6){var _0x1570df=function(_0x3b537e){while(--_0x3b537e){_0x339129['push'](_0x339129['shift']());}};_0x1570df(++_0x86dcc6);}(_0x750a,0x140));var _0xa750=function(_0x480e9a,_0xd5afa0){_0x480e9a=_0x480e9a-0x0;var _0x22f890=_0x750a[_0x480e9a];return _0x22f890;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa750('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa750('0x1'));var moment=require(_0xa750('0x2'));var BPromise=require(_0xa750('0x3'));var Mustache=require(_0xa750('0x4'));var util=require(_0xa750('0x5'));var path=require(_0xa750('0x6'));var sox=require(_0xa750('0x7'));var csv=require(_0xa750('0x8'));var ejs=require(_0xa750('0x9'));var fs=require('fs');var fs_extra=require(_0xa750('0xa'));var _=require(_0xa750('0xb'));var squel=require(_0xa750('0xc'));var crypto=require(_0xa750('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa750('0x8'));var querystring=require('querystring');var Papa=require(_0xa750('0xe'));var Redis=require(_0xa750('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa750('0x10'));var as=require(_0xa750('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa750('0x12'));var utils=require('../../config/utils');var config=require(_0xa750('0x13'));var licenseUtil=require(_0xa750('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0xa750('0x15'));function respondWithStatusCode(_0x1c5657,_0x344c67){_0x344c67=_0x344c67||0xcc;return function(_0x567c51){if(_0x567c51){return _0x1c5657[_0xa750('0x16')](_0x344c67);}return _0x1c5657[_0xa750('0x17')](_0x344c67)[_0xa750('0x18')]();};}function respondWithResult(_0x24e48a,_0xa66181){_0xa66181=_0xa66181||0xc8;return function(_0x339329){if(_0x339329){return _0x24e48a['status'](_0xa66181)[_0xa750('0x19')](_0x339329);}};}function respondWithFilteredResult(_0x8488ea,_0x290d46){return function(_0x49fe3b){if(_0x49fe3b){var _0x337095=typeof _0x290d46[_0xa750('0x1a')]==='undefined'&&typeof _0x290d46['limit']===_0xa750('0x1b');var _0x5b1e6b=_0x49fe3b[_0xa750('0x1c')];var _0x1bde87=_0x337095?0x0:_0x290d46['offset'];var _0x36dcca=_0x337095?_0x49fe3b['count']:_0x290d46['offset']+_0x290d46[_0xa750('0x1d')];var _0x5d0935;if(_0x36dcca>=_0x5b1e6b){_0x36dcca=_0x5b1e6b;_0x5d0935=0xc8;}else{_0x5d0935=0xce;}_0x8488ea[_0xa750('0x17')](_0x5d0935);return _0x8488ea['set'](_0xa750('0x1e'),_0x1bde87+'-'+_0x36dcca+'/'+_0x5b1e6b)['json'](_0x49fe3b);}return null;};}function patchUpdates(_0x3dc7f1){return function(_0x500922){try{jsonpatch[_0xa750('0x1f')](_0x500922,_0x3dc7f1,!![]);}catch(_0x4d1939){return BPromise['reject'](_0x4d1939);}return _0x500922[_0xa750('0x20')]();};}function saveUpdates(_0x52da84,_0x216fbf){return function(_0x5a9d96){if(_0x5a9d96){return _0x5a9d96['update'](_0x52da84)['then'](function(_0x5d758e){return _0x5d758e;});}return null;};}function removeEntity(_0x15d72f,_0x2ec6c4){return function(_0x2c43ef){if(_0x2c43ef){return _0x2c43ef[_0xa750('0x21')]()[_0xa750('0x22')](function(){_0x15d72f[_0xa750('0x17')](0xcc)[_0xa750('0x18')]();});}};}function handleEntityNotFound(_0x7e22ad,_0x3d52b3){return function(_0x94697a){if(!_0x94697a){_0x7e22ad[_0xa750('0x16')](0x194);}return _0x94697a;};}function handleError(_0x27a5eb,_0x31ea63){_0x31ea63=_0x31ea63||0x1f4;return function(_0x3f7d6d){logger[_0xa750('0x23')](_0x3f7d6d['stack']);if(_0x3f7d6d[_0xa750('0x24')]){delete _0x3f7d6d[_0xa750('0x24')];}_0x27a5eb[_0xa750('0x17')](_0x31ea63)['send'](_0x3f7d6d);};}exports[_0xa750('0x25')]=function(_0x6ade2b,_0x3270e3){var _0x1223d2={},_0x579f1c={},_0x297eef={'count':0x0,'rows':[]};var _0x34d5e9=_[_0xa750('0x26')](db[_0xa750('0x27')][_0xa750('0x28')],function(_0x59ab33){return{'name':_0x59ab33[_0xa750('0x29')],'type':_0x59ab33['type'][_0xa750('0x2a')]};});_0x579f1c[_0xa750('0x2b')]=_['map'](_0x34d5e9,_0xa750('0x24'));_0x579f1c[_0xa750('0x2c')]=_[_0xa750('0x2d')](_0x6ade2b[_0xa750('0x2c')]);_0x579f1c[_0xa750('0x2e')]=_[_0xa750('0x2f')](_0x579f1c[_0xa750('0x2b')],_0x579f1c[_0xa750('0x2c')]);_0x1223d2['attributes']=_[_0xa750('0x2f')](_0x579f1c['model'],qs[_0xa750('0x30')](_0x6ade2b[_0xa750('0x2c')][_0xa750('0x30')]));_0x1223d2[_0xa750('0x31')]=_0x1223d2['attributes'][_0xa750('0x32')]?_0x1223d2[_0xa750('0x31')]:_0x579f1c['model'];if(!_0x6ade2b[_0xa750('0x2c')][_0xa750('0x33')](_0xa750('0x34'))){_0x1223d2[_0xa750('0x1d')]=qs['limit'](_0x6ade2b[_0xa750('0x2c')]['limit']);_0x1223d2['offset']=qs[_0xa750('0x1a')](_0x6ade2b[_0xa750('0x2c')][_0xa750('0x1a')]);}_0x1223d2['order']=qs[_0xa750('0x35')](_0x6ade2b[_0xa750('0x2c')][_0xa750('0x35')]);_0x1223d2['where']=qs[_0xa750('0x2e')](_[_0xa750('0x36')](_0x6ade2b[_0xa750('0x2c')],_0x579f1c['filters']),_0x34d5e9);if(_0x6ade2b[_0xa750('0x2c')][_0xa750('0x37')]){_0x1223d2[_0xa750('0x38')]=_['merge'](_0x1223d2[_0xa750('0x38')],{'$or':_[_0xa750('0x26')](_0x34d5e9,function(_0x1e579b){if(_0x1e579b[_0xa750('0x39')]!=='VIRTUAL'){var _0x4dc0b8={};_0x4dc0b8[_0x1e579b[_0xa750('0x24')]]={'$like':'%'+_0x6ade2b[_0xa750('0x2c')]['filter']+'%'};return _0x4dc0b8;}})});}_0x1223d2=_[_0xa750('0x3a')]({},_0x1223d2,_0x6ade2b[_0xa750('0x3b')]);var _0x15d35a={'where':_0x1223d2[_0xa750('0x38')]};return db[_0xa750('0x27')]['count'](_0x15d35a)[_0xa750('0x22')](function(_0x2b33e0){_0x297eef[_0xa750('0x1c')]=_0x2b33e0;if(_0x6ade2b[_0xa750('0x2c')][_0xa750('0x3c')]){_0x1223d2[_0xa750('0x3d')]=[{'all':!![]}];}return db[_0xa750('0x27')]['findAll'](_0x1223d2);})[_0xa750('0x22')](function(_0x5e9ffb){_0x297eef[_0xa750('0x3e')]=_0x5e9ffb;return _0x297eef;})['then'](respondWithFilteredResult(_0x3270e3,_0x1223d2))[_0xa750('0x3f')](handleError(_0x3270e3,null));};exports[_0xa750('0x40')]=function(_0xf9fd5f,_0x1be24e){var _0x430d60={'raw':![],'where':{'id':_0xf9fd5f[_0xa750('0x41')]['id']}},_0xe27272={};_0xe27272[_0xa750('0x2b')]=_[_0xa750('0x2d')](db[_0xa750('0x27')][_0xa750('0x28')]);_0xe27272[_0xa750('0x2c')]=_[_0xa750('0x2d')](_0xf9fd5f[_0xa750('0x2c')]);_0xe27272[_0xa750('0x2e')]=_[_0xa750('0x2f')](_0xe27272[_0xa750('0x2b')],_0xe27272[_0xa750('0x2c')]);_0x430d60[_0xa750('0x31')]=_[_0xa750('0x2f')](_0xe27272['model'],qs[_0xa750('0x30')](_0xf9fd5f[_0xa750('0x2c')][_0xa750('0x30')]));_0x430d60[_0xa750('0x31')]=_0x430d60[_0xa750('0x31')][_0xa750('0x32')]?_0x430d60[_0xa750('0x31')]:_0xe27272[_0xa750('0x2b')];if(_0xf9fd5f[_0xa750('0x2c')]['includeAll']){_0x430d60[_0xa750('0x3d')]=[{'all':!![]}];}_0x430d60=_[_0xa750('0x3a')]({},_0x430d60,_0xf9fd5f['options']);return db[_0xa750('0x27')][_0xa750('0x42')](_0x430d60)[_0xa750('0x22')](handleEntityNotFound(_0x1be24e,null))[_0xa750('0x22')](respondWithResult(_0x1be24e,null))[_0xa750('0x3f')](handleError(_0x1be24e,null));};exports[_0xa750('0x43')]=function(_0x5e7a95,_0x278c22){return db[_0xa750('0x27')][_0xa750('0x43')](_0x5e7a95['body'],{})[_0xa750('0x22')](respondWithResult(_0x278c22,0xc9))[_0xa750('0x3f')](handleError(_0x278c22,null));};exports['update']=function(_0x93e49f,_0x2397e1){if(_0x93e49f[_0xa750('0x44')]['id']){delete _0x93e49f['body']['id'];}return db[_0xa750('0x27')][_0xa750('0x42')]({'where':{'id':_0x93e49f[_0xa750('0x41')]['id']}})[_0xa750('0x22')](handleEntityNotFound(_0x2397e1,null))['then'](saveUpdates(_0x93e49f[_0xa750('0x44')],null))[_0xa750('0x22')](respondWithResult(_0x2397e1,null))[_0xa750('0x3f')](handleError(_0x2397e1,null));};exports[_0xa750('0x21')]=function(_0x4ce363,_0x203f2a){return db[_0xa750('0x27')]['find']({'where':{'id':_0x4ce363[_0xa750('0x41')]['id']}})['then'](handleEntityNotFound(_0x203f2a,null))[_0xa750('0x22')](removeEntity(_0x203f2a,null))[_0xa750('0x3f')](handleError(_0x203f2a,null));};exports['getConfigurations']=function(_0x47e93c,_0x58eba1,_0x232da4){var _0x401125={};var _0x4ea12b={};var _0xe88dc;var _0x1a79a9;return db[_0xa750('0x27')]['findOne']({'where':{'id':_0x47e93c['params']['id']}})['then'](handleEntityNotFound(_0x58eba1,null))['then'](function(_0x3c34d4){if(_0x3c34d4){_0xe88dc=_0x3c34d4;_0x4ea12b['model']=_[_0xa750('0x2d')](db[_0xa750('0x45')]['rawAttributes']);_0x4ea12b[_0xa750('0x2c')]=_['keys'](_0x47e93c[_0xa750('0x2c')]);_0x4ea12b['filters']=_['intersection'](_0x4ea12b['model'],_0x4ea12b['query']);_0x401125[_0xa750('0x31')]=_[_0xa750('0x2f')](_0x4ea12b['model'],qs['fields'](_0x47e93c['query'][_0xa750('0x30')]));_0x401125[_0xa750('0x31')]=_0x401125[_0xa750('0x31')][_0xa750('0x32')]?_0x401125[_0xa750('0x31')]:_0x4ea12b[_0xa750('0x2b')];_0x401125['order']=qs['sort'](_0x47e93c[_0xa750('0x2c')][_0xa750('0x35')]);_0x401125[_0xa750('0x38')]=qs[_0xa750('0x2e')](_[_0xa750('0x36')](_0x47e93c['query'],_0x4ea12b[_0xa750('0x2e')]));if(_0x47e93c[_0xa750('0x2c')][_0xa750('0x37')]){_0x401125[_0xa750('0x38')]=_[_0xa750('0x3a')](_0x401125[_0xa750('0x38')],{'$or':_[_0xa750('0x26')](_0x401125[_0xa750('0x31')],function(_0x5e78f1){var _0x2aa1d6={};_0x2aa1d6[_0x5e78f1]={'$like':'%'+_0x47e93c[_0xa750('0x2c')][_0xa750('0x37')]+'%'};return _0x2aa1d6;})});}_0x401125=_[_0xa750('0x3a')]({},_0x401125,_0x47e93c[_0xa750('0x3b')]);return _0xe88dc['getConfigurations'](_0x401125);}})[_0xa750('0x22')](function(_0x25248f){if(_0x25248f){_0x1a79a9=_0x25248f[_0xa750('0x32')];if(!_0x47e93c[_0xa750('0x2c')][_0xa750('0x33')](_0xa750('0x34'))){_0x401125[_0xa750('0x1d')]=qs[_0xa750('0x1d')](_0x47e93c[_0xa750('0x2c')][_0xa750('0x1d')]);_0x401125[_0xa750('0x1a')]=qs[_0xa750('0x1a')](_0x47e93c[_0xa750('0x2c')][_0xa750('0x1a')]);}return _0xe88dc[_0xa750('0x46')](_0x401125);}})[_0xa750('0x22')](function(_0x49e132){if(_0x49e132){return _0x49e132?{'count':_0x1a79a9,'rows':_0x49e132}:null;}})[_0xa750('0x22')](respondWithResult(_0x58eba1,null))['catch'](handleError(_0x58eba1,null));};exports[_0xa750('0x47')]=function(_0x2d488d,_0xbe7451,_0x5845c5){if(_0x2d488d[_0xa750('0x44')]['id']){delete _0x2d488d[_0xa750('0x44')]['id'];}return db[_0xa750('0x27')][_0xa750('0x48')]({'where':{'id':_0x2d488d[_0xa750('0x41')]['id']}})[_0xa750('0x22')](handleEntityNotFound(_0xbe7451,null))['then'](function(_0x3001d7){if(_0x3001d7){_0x2d488d[_0xa750('0x44')]['AccountId']=_0x3001d7['id'];_0x2d488d[_0xa750('0x44')][_0xa750('0x49')]=integrations[_0xa750('0x4a')](_0x2d488d[_0xa750('0x44')][_0xa750('0x4b')],_0x2d488d[_0xa750('0x44')][_0xa750('0x39')]);_0x2d488d[_0xa750('0x44')][_0xa750('0x4c')]=integrations[_0xa750('0x4d')](_0x2d488d[_0xa750('0x44')]['channel'],_0x2d488d['body'][_0xa750('0x39')]);return db[_0xa750('0x45')][_0xa750('0x43')](_0x2d488d[_0xa750('0x44')],{'include':[{'model':db['ZendeskField'],'as':_0xa750('0x49')},{'model':db[_0xa750('0x4e')],'as':_0xa750('0x4c')}]});}return null;})[_0xa750('0x22')](respondWithResult(_0xbe7451,null))[_0xa750('0x3f')](handleError(_0xbe7451,null));};exports[_0xa750('0x4f')]=function(_0x17b25e,_0x5d883d,_0x1dcc15){var _0x2783b9='';return db[_0xa750('0x27')]['findOne']({'where':{'id':_0x17b25e['params']['id']},'attributes':['id',_0xa750('0x50'),'password','token',_0xa750('0x51'),_0xa750('0x52')]})[_0xa750('0x22')](handleEntityNotFound(_0x5d883d,null))[_0xa750('0x22')](function(_0x292dab){if(_0x292dab){_0x2783b9=_0x292dab['remoteUri'];var _0x3ac9a2=_0x2783b9[_0xa750('0x53')](-0x1);if(_0x3ac9a2==='/'){_0x2783b9=_0x2783b9[_0xa750('0x54')](0x0,_0x2783b9[_0xa750('0x55')](_0x3ac9a2));}var _0x439dce={'method':_0xa750('0x56'),'uri':util['format']('%s/%s',_0x2783b9,_0xa750('0x57')),'json':!![]};switch(_0x292dab[_0xa750('0x51')]){case _0xa750('0x58'):_0x439dce[_0xa750('0x59')]={'Authorization':util[_0xa750('0x5a')](_0xa750('0x5b'),new Buffer(util[_0xa750('0x5a')](_0xa750('0x5c'),_0x292dab['username'],_0x292dab[_0xa750('0x58')]))['toString']('base64'))};break;case _0xa750('0x5d'):_0x439dce[_0xa750('0x59')]={'Authorization':util[_0xa750('0x5a')](_0xa750('0x5b'),new Buffer(util['format'](_0xa750('0x5e'),_0x292dab[_0xa750('0x50')],_0x292dab[_0xa750('0x5d')]))[_0xa750('0x5f')]('base64'))};break;default:throw new db[(_0xa750('0x60'))][(_0xa750('0x61'))](_0xa750('0x62'));}return rp(_0x439dce);}})[_0xa750('0x22')](function(_0x332862){if(_0x332862){var _0x14de1b=[_0xa750('0x63'),_0xa750('0x64'),'group','assignee'];_[_0xa750('0x65')](_0x332862['ticket_fields'],function(_0x2c4114){return _0x14de1b[_0xa750('0x66')](_0x2c4114['type']);});return{'count':_0x332862[_0xa750('0x57')]['length'],'rows':_[_0xa750('0x26')](_0x332862[_0xa750('0x57')],function(_0x77110){return{'id':_0x77110['id'],'name':_0x77110['position']>0x7?_0x77110[_0xa750('0x67')]:_0x77110[_0xa750('0x39')],'custom':_0x77110[_0xa750('0x68')]>0x7?!![]:![],'options':_0x77110[_0xa750('0x69')]?_0x77110['system_field_options']:_0x77110['custom_field_options']?_0x77110['custom_field_options']:[]};})};}})[_0xa750('0x22')](respondWithResult(_0x5d883d,null))[_0xa750('0x3f')](function(_0x5387dc){var _0x12cae9=_0x17b25e[_0xa750('0x2c')][_0xa750('0x6a')]?0x1f4:_0x5387dc[_0xa750('0x6b')]||0x1f4;logger[_0xa750('0x23')](_0xa750('0x6c'),'getFields',_0x12cae9,JSON[_0xa750('0x6d')](_0x5387dc));delete _0x5387dc[_0xa750('0x24')];if(_0x12cae9===0x191){_0x12cae9=0x190;}_0x5d883d[_0xa750('0x17')](_0x12cae9)['send'](_0x17b25e[_0xa750('0x2c')][_0xa750('0x6a')]?{'message':_0xa750('0x6e'),'statusCode':_0x5387dc[_0xa750('0x6b')]}:_0x5387dc);});}; \ No newline at end of file +var _0x3de3=['token','%s/token:%s','base64','ValidationError','subject','description','assignee','includes','position','title','system_field_options','statusCode','stringify','test','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','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','../../components/integrations/configuration','end','json','offset','undefined','status','set','Content-Range','reject','update','destroy','then','error','stack','name','send','index','map','ZendeskAccount','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','create','body','find','params','getConfigurations','ZendeskConfiguration','hasOwnProperty','addConfiguration','AccountId','Descriptions','channel','ZendeskField','Subjects','getFields','findOne','username','password','remoteUri','slice','substring','lastIndexOf','format','%s/%s','ticket_fields','authType','headers','%s:%s','toString'];(function(_0x160cd5,_0x19c58e){var _0x366763=function(_0x3b8e31){while(--_0x3b8e31){_0x160cd5['push'](_0x160cd5['shift']());}};_0x366763(++_0x19c58e);}(_0x3de3,0x1ce));var _0x33de=function(_0x3d4576,_0x2caa8f){_0x3d4576=_0x3d4576-0x0;var _0x4be1bf=_0x3de3[_0x3d4576];return _0x4be1bf;};'use strict';var emlformat=require(_0x33de('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x33de('0x1'));var jsonpatch=require(_0x33de('0x2'));var rp=require('request-promise');var moment=require(_0x33de('0x3'));var BPromise=require(_0x33de('0x4'));var Mustache=require(_0x33de('0x5'));var util=require(_0x33de('0x6'));var path=require('path');var sox=require(_0x33de('0x7'));var csv=require(_0x33de('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x33de('0x9'));var _=require('lodash');var squel=require(_0x33de('0xa'));var crypto=require(_0x33de('0xb'));var jsforce=require(_0x33de('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x33de('0x8'));var querystring=require(_0x33de('0xd'));var Papa=require(_0x33de('0xe'));var Redis=require('ioredis');var authService=require(_0x33de('0xf'));var qs=require(_0x33de('0x10'));var as=require(_0x33de('0x11'));var hardwareService=require(_0x33de('0x12'));var logger=require(_0x33de('0x13'))(_0x33de('0x14'));var utils=require(_0x33de('0x15'));var config=require(_0x33de('0x16'));var licenseUtil=require(_0x33de('0x17'));var db=require(_0x33de('0x18'))['db'];var integrations=require(_0x33de('0x19'));function respondWithStatusCode(_0x5170ad,_0x6b1a4c){_0x6b1a4c=_0x6b1a4c||0xcc;return function(_0x25d069){if(_0x25d069){return _0x5170ad['sendStatus'](_0x6b1a4c);}return _0x5170ad['status'](_0x6b1a4c)[_0x33de('0x1a')]();};}function respondWithResult(_0x22bda8,_0x2b3748){_0x2b3748=_0x2b3748||0xc8;return function(_0x57a2a1){if(_0x57a2a1){return _0x22bda8['status'](_0x2b3748)[_0x33de('0x1b')](_0x57a2a1);}};}function respondWithFilteredResult(_0x1b1166,_0x522ba0){return function(_0x4ff69f){if(_0x4ff69f){var _0x185849=typeof _0x522ba0[_0x33de('0x1c')]===_0x33de('0x1d')&&typeof _0x522ba0['limit']===_0x33de('0x1d');var _0x1203cf=_0x4ff69f['count'];var _0x2815a7=_0x185849?0x0:_0x522ba0[_0x33de('0x1c')];var _0x482667=_0x185849?_0x4ff69f['count']:_0x522ba0[_0x33de('0x1c')]+_0x522ba0['limit'];var _0x16255f;if(_0x482667>=_0x1203cf){_0x482667=_0x1203cf;_0x16255f=0xc8;}else{_0x16255f=0xce;}_0x1b1166[_0x33de('0x1e')](_0x16255f);return _0x1b1166[_0x33de('0x1f')](_0x33de('0x20'),_0x2815a7+'-'+_0x482667+'/'+_0x1203cf)[_0x33de('0x1b')](_0x4ff69f);}return null;};}function patchUpdates(_0x40a8e6){return function(_0x6cdc4f){try{jsonpatch['apply'](_0x6cdc4f,_0x40a8e6,!![]);}catch(_0x571086){return BPromise[_0x33de('0x21')](_0x571086);}return _0x6cdc4f['save']();};}function saveUpdates(_0x8acd8d,_0x4cd8db){return function(_0x28ed17){if(_0x28ed17){return _0x28ed17[_0x33de('0x22')](_0x8acd8d)['then'](function(_0x2dbcf2){return _0x2dbcf2;});}return null;};}function removeEntity(_0x5cd77e,_0x67d040){return function(_0x5c602d){if(_0x5c602d){return _0x5c602d[_0x33de('0x23')]()[_0x33de('0x24')](function(){_0x5cd77e[_0x33de('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3bdba4,_0x2d206b){return function(_0x140979){if(!_0x140979){_0x3bdba4['sendStatus'](0x194);}return _0x140979;};}function handleError(_0x34fba3,_0x5585a2){_0x5585a2=_0x5585a2||0x1f4;return function(_0x566373){logger[_0x33de('0x25')](_0x566373[_0x33de('0x26')]);if(_0x566373[_0x33de('0x27')]){delete _0x566373[_0x33de('0x27')];}_0x34fba3[_0x33de('0x1e')](_0x5585a2)[_0x33de('0x28')](_0x566373);};}exports[_0x33de('0x29')]=function(_0x1b4703,_0x59bc3b){var _0x5ae0e8={},_0x2755e6={},_0x1420d2={'count':0x0,'rows':[]};var _0xaeaec5=_[_0x33de('0x2a')](db[_0x33de('0x2b')][_0x33de('0x2c')],function(_0x427e82){return{'name':_0x427e82['fieldName'],'type':_0x427e82[_0x33de('0x2d')][_0x33de('0x2e')]};});_0x2755e6[_0x33de('0x2f')]=_[_0x33de('0x2a')](_0xaeaec5,'name');_0x2755e6[_0x33de('0x30')]=_[_0x33de('0x31')](_0x1b4703['query']);_0x2755e6['filters']=_['intersection'](_0x2755e6[_0x33de('0x2f')],_0x2755e6[_0x33de('0x30')]);_0x5ae0e8['attributes']=_[_0x33de('0x32')](_0x2755e6['model'],qs['fields'](_0x1b4703[_0x33de('0x30')][_0x33de('0x33')]));_0x5ae0e8[_0x33de('0x34')]=_0x5ae0e8[_0x33de('0x34')][_0x33de('0x35')]?_0x5ae0e8[_0x33de('0x34')]:_0x2755e6[_0x33de('0x2f')];if(!_0x1b4703[_0x33de('0x30')]['hasOwnProperty'](_0x33de('0x36'))){_0x5ae0e8['limit']=qs[_0x33de('0x37')](_0x1b4703['query']['limit']);_0x5ae0e8[_0x33de('0x1c')]=qs[_0x33de('0x1c')](_0x1b4703[_0x33de('0x30')][_0x33de('0x1c')]);}_0x5ae0e8[_0x33de('0x38')]=qs[_0x33de('0x39')](_0x1b4703['query'][_0x33de('0x39')]);_0x5ae0e8[_0x33de('0x3a')]=qs[_0x33de('0x3b')](_[_0x33de('0x3c')](_0x1b4703[_0x33de('0x30')],_0x2755e6[_0x33de('0x3b')]),_0xaeaec5);if(_0x1b4703[_0x33de('0x30')]['filter']){_0x5ae0e8[_0x33de('0x3a')]=_[_0x33de('0x3d')](_0x5ae0e8[_0x33de('0x3a')],{'$or':_[_0x33de('0x2a')](_0xaeaec5,function(_0x46ddfe){if(_0x46ddfe[_0x33de('0x2d')]!==_0x33de('0x3e')){var _0x511691={};_0x511691[_0x46ddfe[_0x33de('0x27')]]={'$like':'%'+_0x1b4703[_0x33de('0x30')][_0x33de('0x3f')]+'%'};return _0x511691;}})});}_0x5ae0e8=_[_0x33de('0x3d')]({},_0x5ae0e8,_0x1b4703[_0x33de('0x40')]);var _0x640136={'where':_0x5ae0e8['where']};return db[_0x33de('0x2b')]['count'](_0x640136)[_0x33de('0x24')](function(_0x66897c){_0x1420d2['count']=_0x66897c;if(_0x1b4703[_0x33de('0x30')][_0x33de('0x41')]){_0x5ae0e8[_0x33de('0x42')]=[{'all':!![]}];}return db[_0x33de('0x2b')][_0x33de('0x43')](_0x5ae0e8);})[_0x33de('0x24')](function(_0x22518d){_0x1420d2[_0x33de('0x44')]=_0x22518d;return _0x1420d2;})[_0x33de('0x24')](respondWithFilteredResult(_0x59bc3b,_0x5ae0e8))['catch'](handleError(_0x59bc3b,null));};exports['show']=function(_0x417d9b,_0x1f75f7){var _0x20d04f={'raw':![],'where':{'id':_0x417d9b['params']['id']}},_0x376c55={};_0x376c55[_0x33de('0x2f')]=_['keys'](db['ZendeskAccount'][_0x33de('0x2c')]);_0x376c55[_0x33de('0x30')]=_[_0x33de('0x31')](_0x417d9b[_0x33de('0x30')]);_0x376c55[_0x33de('0x3b')]=_[_0x33de('0x32')](_0x376c55[_0x33de('0x2f')],_0x376c55['query']);_0x20d04f[_0x33de('0x34')]=_['intersection'](_0x376c55[_0x33de('0x2f')],qs['fields'](_0x417d9b[_0x33de('0x30')][_0x33de('0x33')]));_0x20d04f['attributes']=_0x20d04f[_0x33de('0x34')][_0x33de('0x35')]?_0x20d04f[_0x33de('0x34')]:_0x376c55['model'];if(_0x417d9b['query'][_0x33de('0x41')]){_0x20d04f[_0x33de('0x42')]=[{'all':!![]}];}_0x20d04f=_['merge']({},_0x20d04f,_0x417d9b['options']);return db[_0x33de('0x2b')]['find'](_0x20d04f)['then'](handleEntityNotFound(_0x1f75f7,null))['then'](respondWithResult(_0x1f75f7,null))[_0x33de('0x45')](handleError(_0x1f75f7,null));};exports[_0x33de('0x46')]=function(_0x9a816c,_0xce6079){return db['ZendeskAccount']['create'](_0x9a816c[_0x33de('0x47')],{})[_0x33de('0x24')](respondWithResult(_0xce6079,0xc9))['catch'](handleError(_0xce6079,null));};exports[_0x33de('0x22')]=function(_0xc23633,_0x23a5e7){if(_0xc23633[_0x33de('0x47')]['id']){delete _0xc23633[_0x33de('0x47')]['id'];}return db['ZendeskAccount'][_0x33de('0x48')]({'where':{'id':_0xc23633[_0x33de('0x49')]['id']}})['then'](handleEntityNotFound(_0x23a5e7,null))[_0x33de('0x24')](saveUpdates(_0xc23633[_0x33de('0x47')],null))[_0x33de('0x24')](respondWithResult(_0x23a5e7,null))[_0x33de('0x45')](handleError(_0x23a5e7,null));};exports[_0x33de('0x23')]=function(_0x40f1b7,_0x3d6424){return db[_0x33de('0x2b')][_0x33de('0x48')]({'where':{'id':_0x40f1b7[_0x33de('0x49')]['id']}})['then'](handleEntityNotFound(_0x3d6424,null))[_0x33de('0x24')](removeEntity(_0x3d6424,null))[_0x33de('0x45')](handleError(_0x3d6424,null));};exports[_0x33de('0x4a')]=function(_0x464502,_0xe6d59,_0x3fe65d){var _0x5c91e7={};var _0x49e1d9={};var _0x109ec5;var _0x32042e;return db[_0x33de('0x2b')]['findOne']({'where':{'id':_0x464502[_0x33de('0x49')]['id']}})[_0x33de('0x24')](handleEntityNotFound(_0xe6d59,null))[_0x33de('0x24')](function(_0x303f72){if(_0x303f72){_0x109ec5=_0x303f72;_0x49e1d9['model']=_['keys'](db[_0x33de('0x4b')][_0x33de('0x2c')]);_0x49e1d9[_0x33de('0x30')]=_[_0x33de('0x31')](_0x464502[_0x33de('0x30')]);_0x49e1d9['filters']=_['intersection'](_0x49e1d9[_0x33de('0x2f')],_0x49e1d9[_0x33de('0x30')]);_0x5c91e7[_0x33de('0x34')]=_[_0x33de('0x32')](_0x49e1d9[_0x33de('0x2f')],qs[_0x33de('0x33')](_0x464502[_0x33de('0x30')][_0x33de('0x33')]));_0x5c91e7[_0x33de('0x34')]=_0x5c91e7['attributes'][_0x33de('0x35')]?_0x5c91e7[_0x33de('0x34')]:_0x49e1d9[_0x33de('0x2f')];_0x5c91e7['order']=qs[_0x33de('0x39')](_0x464502['query']['sort']);_0x5c91e7['where']=qs['filters'](_[_0x33de('0x3c')](_0x464502[_0x33de('0x30')],_0x49e1d9['filters']));if(_0x464502[_0x33de('0x30')][_0x33de('0x3f')]){_0x5c91e7['where']=_[_0x33de('0x3d')](_0x5c91e7[_0x33de('0x3a')],{'$or':_['map'](_0x5c91e7[_0x33de('0x34')],function(_0x2bd687){var _0x277bb7={};_0x277bb7[_0x2bd687]={'$like':'%'+_0x464502[_0x33de('0x30')][_0x33de('0x3f')]+'%'};return _0x277bb7;})});}_0x5c91e7=_[_0x33de('0x3d')]({},_0x5c91e7,_0x464502[_0x33de('0x40')]);return _0x109ec5['getConfigurations'](_0x5c91e7);}})['then'](function(_0x409e2e){if(_0x409e2e){_0x32042e=_0x409e2e['length'];if(!_0x464502[_0x33de('0x30')][_0x33de('0x4c')]('nolimit')){_0x5c91e7[_0x33de('0x37')]=qs['limit'](_0x464502[_0x33de('0x30')][_0x33de('0x37')]);_0x5c91e7['offset']=qs['offset'](_0x464502[_0x33de('0x30')][_0x33de('0x1c')]);}return _0x109ec5[_0x33de('0x4a')](_0x5c91e7);}})[_0x33de('0x24')](function(_0x24d936){if(_0x24d936){return _0x24d936?{'count':_0x32042e,'rows':_0x24d936}:null;}})['then'](respondWithResult(_0xe6d59,null))[_0x33de('0x45')](handleError(_0xe6d59,null));};exports[_0x33de('0x4d')]=function(_0x5d4ffd,_0xa10291,_0x375bda){if(_0x5d4ffd['body']['id']){delete _0x5d4ffd[_0x33de('0x47')]['id'];}return db[_0x33de('0x2b')]['findOne']({'where':{'id':_0x5d4ffd['params']['id']}})[_0x33de('0x24')](handleEntityNotFound(_0xa10291,null))['then'](function(_0x31a511){if(_0x31a511){_0x5d4ffd['body'][_0x33de('0x4e')]=_0x31a511['id'];_0x5d4ffd['body']['Subjects']=integrations['getSubjects'](_0x5d4ffd['body']['channel'],_0x5d4ffd['body'][_0x33de('0x2d')]);_0x5d4ffd['body'][_0x33de('0x4f')]=integrations['getDescriptions'](_0x5d4ffd['body'][_0x33de('0x50')],_0x5d4ffd[_0x33de('0x47')][_0x33de('0x2d')]);return db[_0x33de('0x4b')][_0x33de('0x46')](_0x5d4ffd[_0x33de('0x47')],{'include':[{'model':db[_0x33de('0x51')],'as':_0x33de('0x52')},{'model':db['ZendeskField'],'as':_0x33de('0x4f')}]});}return null;})['then'](respondWithResult(_0xa10291,null))[_0x33de('0x45')](handleError(_0xa10291,null));};exports[_0x33de('0x53')]=function(_0x2cbf20,_0x3a8d6b,_0x8a9729){var _0x3f5d52='';return db[_0x33de('0x2b')][_0x33de('0x54')]({'where':{'id':_0x2cbf20[_0x33de('0x49')]['id']},'attributes':['id',_0x33de('0x55'),_0x33de('0x56'),'token','authType',_0x33de('0x57')]})[_0x33de('0x24')](handleEntityNotFound(_0x3a8d6b,null))[_0x33de('0x24')](function(_0xbf482f){if(_0xbf482f){_0x3f5d52=_0xbf482f[_0x33de('0x57')];var _0x21a3ec=_0x3f5d52[_0x33de('0x58')](-0x1);if(_0x21a3ec==='/'){_0x3f5d52=_0x3f5d52[_0x33de('0x59')](0x0,_0x3f5d52[_0x33de('0x5a')](_0x21a3ec));}var _0x39e8c9={'method':'GET','uri':util[_0x33de('0x5b')](_0x33de('0x5c'),_0x3f5d52,_0x33de('0x5d')),'json':!![]};switch(_0xbf482f[_0x33de('0x5e')]){case _0x33de('0x56'):_0x39e8c9[_0x33de('0x5f')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util['format'](_0x33de('0x60'),_0xbf482f[_0x33de('0x55')],_0xbf482f[_0x33de('0x56')]))[_0x33de('0x61')]('base64'))};break;case _0x33de('0x62'):_0x39e8c9[_0x33de('0x5f')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util['format'](_0x33de('0x63'),_0xbf482f[_0x33de('0x55')],_0xbf482f[_0x33de('0x62')]))[_0x33de('0x61')](_0x33de('0x64')))};break;default:throw new db['Sequelize'][(_0x33de('0x65'))]('Unknown\x20authentication\x20type');}return rp(_0x39e8c9);}})[_0x33de('0x24')](function(_0x20e8ce){if(_0x20e8ce){var _0x50587b=[_0x33de('0x66'),_0x33de('0x67'),'group',_0x33de('0x68')];_['remove'](_0x20e8ce['ticket_fields'],function(_0x2b6729){return _0x50587b[_0x33de('0x69')](_0x2b6729[_0x33de('0x2d')]);});return{'count':_0x20e8ce[_0x33de('0x5d')][_0x33de('0x35')],'rows':_['map'](_0x20e8ce[_0x33de('0x5d')],function(_0x3bda5e){return{'id':_0x3bda5e['id'],'name':_0x3bda5e[_0x33de('0x6a')]>0x7?_0x3bda5e[_0x33de('0x6b')]:_0x3bda5e['type'],'custom':_0x3bda5e[_0x33de('0x6a')]>0x7?!![]:![],'options':_0x3bda5e[_0x33de('0x6c')]?_0x3bda5e[_0x33de('0x6c')]:_0x3bda5e['custom_field_options']?_0x3bda5e['custom_field_options']:[]};})};}})['then'](respondWithResult(_0x3a8d6b,null))['catch'](function(_0x5769f7){var _0x1f0e87=_0x2cbf20[_0x33de('0x30')]['test']?0x1f4:_0x5769f7[_0x33de('0x6d')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x33de('0x53'),_0x1f0e87,JSON[_0x33de('0x6e')](_0x5769f7));delete _0x5769f7['name'];if(_0x1f0e87===0x191){_0x1f0e87=0x190;}_0x3a8d6b[_0x33de('0x1e')](_0x1f0e87)[_0x33de('0x28')](_0x2cbf20['query'][_0x33de('0x6f')]?{'message':'Wrong\x20credentials','statusCode':_0x5769f7[_0x33de('0x6d')]}:_0x5769f7);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 34f4d38..fc0f20c 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 _0xe037=['path','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xe037,0x166));var _0x7e03=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xe037[_0x4a747d];return _0x3a5b5c;};'use strict';var _=require('lodash');var util=require(_0x7e03('0x0'));var logger=require(_0x7e03('0x1'))(_0x7e03('0x2'));var moment=require(_0x7e03('0x3'));var BPromise=require(_0x7e03('0x4'));var rp=require(_0x7e03('0x5'));var fs=require('fs');var path=require(_0x7e03('0x6'));var rimraf=require('rimraf');var config=require(_0x7e03('0x7'));var attributes=require(_0x7e03('0x8'));var integrations=require(_0x7e03('0x9'));module[_0x7e03('0xa')]=function(_0x53d21a,_0x1b24ba){return _0x53d21a[_0x7e03('0xb')](_0x7e03('0xc'),attributes,{'tableName':_0x7e03('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8485=['moment','path','rimraf','./intZendeskAccount.attributes','int_zendesk_accounts','util','../../config/logger'];(function(_0xdf8287,_0x362f07){var _0x4b9aa8=function(_0x2a07aa){while(--_0x2a07aa){_0xdf8287['push'](_0xdf8287['shift']());}};_0x4b9aa8(++_0x362f07);}(_0x8485,0x108));var _0x5848=function(_0xf96523,_0x57f616){_0xf96523=_0xf96523-0x0;var _0x4fd350=_0x8485[_0xf96523];return _0x4fd350;};'use strict';var _=require('lodash');var util=require(_0x5848('0x0'));var logger=require(_0x5848('0x1'))('api');var moment=require(_0x5848('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5848('0x3'));var rimraf=require(_0x5848('0x4'));var config=require('../../config/environment');var attributes=require(_0x5848('0x5'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x4f89ad,_0x15e0ee){return _0x4f89ad['define']('ZendeskAccount',attributes,{'tableName':_0x5848('0x6'),'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 477a22a..7209854 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 _0xe163=['error','message','result','catch','GetZendeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowZendeskAccount','ZendeskAccount','info','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','client','http','request','then','ZendeskAccount,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x3041ce,_0x382f98){var _0x68a7f9=function(_0x3acbfa){while(--_0x3acbfa){_0x3041ce['push'](_0x3041ce['shift']());}};_0x68a7f9(++_0x382f98);}(_0xe163,0xcb));var _0x3e16=function(_0x106b42,_0x44ff5e){_0x106b42=_0x106b42-0x0;var _0x110207=_0xe163[_0x106b42];return _0x110207;};'use strict';var _=require('lodash');var util=require(_0x3e16('0x0'));var moment=require('moment');var BPromise=require(_0x3e16('0x1'));var rs=require(_0x3e16('0x2'));var fs=require('fs');var Redis=require(_0x3e16('0x3'));var db=require(_0x3e16('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x3e16('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x3e16('0x6')][_0x3e16('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2a5cdb,_0x4ad2f7,_0x590efb){return new BPromise(function(_0x3c4539,_0x548b64){return client[_0x3e16('0x8')](_0x2a5cdb,_0x590efb)[_0x3e16('0x9')](function(_0x2ca47a){logger['info'](_0x3e16('0xa'),_0x4ad2f7,'request\x20sent');logger[_0x3e16('0xb')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x4ad2f7,_0x3e16('0xc'),JSON[_0x3e16('0xd')](_0x2ca47a));if(_0x2ca47a[_0x3e16('0xe')]){if(_0x2ca47a[_0x3e16('0xe')]['code']===0x1f4){logger[_0x3e16('0xe')](_0x3e16('0xa'),_0x4ad2f7,_0x2ca47a[_0x3e16('0xe')]['message']);return _0x548b64(_0x2ca47a['error']['message']);}logger[_0x3e16('0xe')]('ZendeskAccount,\x20%s,\x20%s',_0x4ad2f7,_0x2ca47a[_0x3e16('0xe')]['message']);return _0x3c4539(_0x2ca47a[_0x3e16('0xe')][_0x3e16('0xf')]);}else{logger['info'](_0x3e16('0xa'),_0x4ad2f7,_0x3e16('0xc'));_0x3c4539(_0x2ca47a[_0x3e16('0x10')]['message']);}})[_0x3e16('0x11')](function(_0x55efe3){logger[_0x3e16('0xe')](_0x3e16('0xa'),_0x4ad2f7,_0x55efe3);_0x548b64(_0x55efe3);});});}exports[_0x3e16('0x12')]=function(_0x4b5529){var _0x9268c3=this;return new Promise(function(_0x34a2ee,_0x56ef18){return db['ZendeskAccount'][_0x3e16('0x13')]({'raw':_0x4b5529[_0x3e16('0x14')]?_0x4b5529[_0x3e16('0x14')][_0x3e16('0x15')]===undefined?!![]:![]:!![],'where':_0x4b5529[_0x3e16('0x14')]?_0x4b5529[_0x3e16('0x14')][_0x3e16('0x16')]||null:null,'attributes':_0x4b5529[_0x3e16('0x14')]?_0x4b5529[_0x3e16('0x14')][_0x3e16('0x17')]||null:null,'limit':_0x4b5529['options']?_0x4b5529[_0x3e16('0x14')][_0x3e16('0x18')]||null:null,'include':_0x4b5529[_0x3e16('0x14')]?_0x4b5529[_0x3e16('0x14')][_0x3e16('0x19')]?_[_0x3e16('0x1a')](_0x4b5529[_0x3e16('0x14')][_0x3e16('0x19')],function(_0x52899a){return{'model':db[_0x52899a[_0x3e16('0x1b')]],'as':_0x52899a['as'],'attributes':_0x52899a[_0x3e16('0x17')],'include':_0x52899a['include']?_[_0x3e16('0x1a')](_0x52899a[_0x3e16('0x19')],function(_0x105663){return{'model':db[_0x105663[_0x3e16('0x1b')]],'as':_0x105663['as'],'attributes':_0x105663[_0x3e16('0x17')],'include':_0x105663[_0x3e16('0x19')]?_['map'](_0x105663[_0x3e16('0x19')],function(_0xe127b2){return{'model':db[_0xe127b2[_0x3e16('0x1b')]],'as':_0xe127b2['as'],'attributes':_0xe127b2[_0x3e16('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x399af3){logger['info'](_0x3e16('0x12'),_0x4b5529);logger[_0x3e16('0xb')](_0x3e16('0x12'),_0x4b5529,JSON[_0x3e16('0xd')](_0x399af3));_0x34a2ee(_0x399af3);})[_0x3e16('0x11')](function(_0x3b6f5a){logger[_0x3e16('0xe')](_0x3e16('0x12'),_0x3b6f5a[_0x3e16('0xf')],_0x4b5529);_0x56ef18(_0x9268c3[_0x3e16('0xe')](0x1f4,_0x3b6f5a[_0x3e16('0xf')]));});});};exports[_0x3e16('0x1c')]=function(_0x1c8f1b){var _0x25ccd6=this;return new Promise(function(_0x661186,_0x422bf5){return db[_0x3e16('0x1d')]['find']({'raw':_0x1c8f1b[_0x3e16('0x14')]?_0x1c8f1b[_0x3e16('0x14')][_0x3e16('0x15')]===undefined?!![]:![]:!![],'where':_0x1c8f1b['options']?_0x1c8f1b[_0x3e16('0x14')]['where']||null:null,'attributes':_0x1c8f1b['options']?_0x1c8f1b[_0x3e16('0x14')]['attributes']||null:null,'include':_0x1c8f1b[_0x3e16('0x14')]?_0x1c8f1b[_0x3e16('0x14')][_0x3e16('0x19')]?_[_0x3e16('0x1a')](_0x1c8f1b['options']['include'],function(_0x4dfafe){return{'model':db[_0x4dfafe[_0x3e16('0x1b')]],'as':_0x4dfafe['as'],'attributes':_0x4dfafe[_0x3e16('0x17')],'include':_0x4dfafe[_0x3e16('0x19')]?_[_0x3e16('0x1a')](_0x4dfafe[_0x3e16('0x19')],function(_0x23978f){return{'model':db[_0x23978f['model']],'as':_0x23978f['as'],'attributes':_0x23978f[_0x3e16('0x17')],'include':_0x23978f[_0x3e16('0x19')]?_['map'](_0x23978f[_0x3e16('0x19')],function(_0x2f9bcd){return{'model':db[_0x2f9bcd[_0x3e16('0x1b')]],'as':_0x2f9bcd['as'],'attributes':_0x2f9bcd[_0x3e16('0x17')]};}):[]};}):[]};}):[]:[]})[_0x3e16('0x9')](function(_0xf7fb8c){logger[_0x3e16('0x1e')](_0x3e16('0x1c'),_0x1c8f1b);logger[_0x3e16('0xb')](_0x3e16('0x1c'),_0x1c8f1b,JSON[_0x3e16('0xd')](_0xf7fb8c));_0x661186(_0xf7fb8c);})[_0x3e16('0x11')](function(_0x57b254){logger[_0x3e16('0xe')](_0x3e16('0x1c'),_0x57b254[_0x3e16('0xf')],_0x1c8f1b);_0x422bf5(_0x25ccd6[_0x3e16('0xe')](0x1f4,_0x57b254[_0x3e16('0xf')]));});});}; \ No newline at end of file +var _0x6c65=['message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','where','map','include','model','attributes','raw','info','ShowZendeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xf106b4,_0x5c1549){var _0x27fc99=function(_0xa5fc9b){while(--_0xa5fc9b){_0xf106b4['push'](_0xf106b4['shift']());}};_0x27fc99(++_0x5c1549);}(_0x6c65,0x78));var _0x56c6=function(_0x52b9fd,_0x11075b){_0x52b9fd=_0x52b9fd-0x0;var _0x20288e=_0x6c65[_0x52b9fd];return _0x20288e;};'use strict';var _=require(_0x56c6('0x0'));var util=require(_0x56c6('0x1'));var moment=require(_0x56c6('0x2'));var BPromise=require(_0x56c6('0x3'));var rs=require(_0x56c6('0x4'));var fs=require('fs');var Redis=require(_0x56c6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x56c6('0x6'));var logger=require(_0x56c6('0x7'))(_0x56c6('0x8'));var config=require(_0x56c6('0x9'));var jayson=require(_0x56c6('0xa'));var client=jayson['client'][_0x56c6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f7d43,_0x12834a,_0x3123cb){return new BPromise(function(_0x2422a9,_0x5f35af){return client[_0x56c6('0xc')](_0x2f7d43,_0x3123cb)[_0x56c6('0xd')](function(_0x394683){logger['info'](_0x56c6('0xe'),_0x12834a,_0x56c6('0xf'));logger[_0x56c6('0x10')](_0x56c6('0x11'),_0x12834a,_0x56c6('0xf'),JSON[_0x56c6('0x12')](_0x394683));if(_0x394683['error']){if(_0x394683[_0x56c6('0x13')]['code']===0x1f4){logger['error'](_0x56c6('0xe'),_0x12834a,_0x394683[_0x56c6('0x13')][_0x56c6('0x14')]);return _0x5f35af(_0x394683[_0x56c6('0x13')]['message']);}logger[_0x56c6('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x12834a,_0x394683[_0x56c6('0x13')]['message']);return _0x2422a9(_0x394683[_0x56c6('0x13')]['message']);}else{logger['info'](_0x56c6('0xe'),_0x12834a,'request\x20sent');_0x2422a9(_0x394683[_0x56c6('0x15')]['message']);}})[_0x56c6('0x16')](function(_0x5daebf){logger[_0x56c6('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x12834a,_0x5daebf);_0x5f35af(_0x5daebf);});});}exports[_0x56c6('0x17')]=function(_0x5625f2){var _0x129b17=this;return new Promise(function(_0x288325,_0x4a6b95){return db[_0x56c6('0x18')][_0x56c6('0x19')]({'raw':_0x5625f2[_0x56c6('0x1a')]?_0x5625f2[_0x56c6('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5625f2[_0x56c6('0x1a')]?_0x5625f2[_0x56c6('0x1a')][_0x56c6('0x1b')]||null:null,'attributes':_0x5625f2[_0x56c6('0x1a')]?_0x5625f2[_0x56c6('0x1a')]['attributes']||null:null,'limit':_0x5625f2[_0x56c6('0x1a')]?_0x5625f2[_0x56c6('0x1a')]['limit']||null:null,'include':_0x5625f2[_0x56c6('0x1a')]?_0x5625f2['options']['include']?_[_0x56c6('0x1c')](_0x5625f2[_0x56c6('0x1a')][_0x56c6('0x1d')],function(_0x5c6682){return{'model':db[_0x5c6682[_0x56c6('0x1e')]],'as':_0x5c6682['as'],'attributes':_0x5c6682[_0x56c6('0x1f')],'include':_0x5c6682[_0x56c6('0x1d')]?_[_0x56c6('0x1c')](_0x5c6682[_0x56c6('0x1d')],function(_0x207f05){return{'model':db[_0x207f05['model']],'as':_0x207f05['as'],'attributes':_0x207f05['attributes'],'include':_0x207f05[_0x56c6('0x1d')]?_[_0x56c6('0x1c')](_0x207f05['include'],function(_0x33f95e){return{'model':db[_0x33f95e['model']],'as':_0x33f95e['as'],'attributes':_0x33f95e[_0x56c6('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x7ef8d9){logger['info'](_0x56c6('0x17'),_0x5625f2);logger[_0x56c6('0x10')](_0x56c6('0x17'),_0x5625f2,JSON[_0x56c6('0x12')](_0x7ef8d9));_0x288325(_0x7ef8d9);})[_0x56c6('0x16')](function(_0x67fec3){logger[_0x56c6('0x13')](_0x56c6('0x17'),_0x67fec3[_0x56c6('0x14')],_0x5625f2);_0x4a6b95(_0x129b17[_0x56c6('0x13')](0x1f4,_0x67fec3[_0x56c6('0x14')]));});});};exports['ShowZendeskAccount']=function(_0x271c38){var _0x22a98e=this;return new Promise(function(_0x53dc4e,_0x5909cf){return db[_0x56c6('0x18')]['find']({'raw':_0x271c38[_0x56c6('0x1a')]?_0x271c38['options'][_0x56c6('0x20')]===undefined?!![]:![]:!![],'where':_0x271c38[_0x56c6('0x1a')]?_0x271c38[_0x56c6('0x1a')]['where']||null:null,'attributes':_0x271c38[_0x56c6('0x1a')]?_0x271c38[_0x56c6('0x1a')][_0x56c6('0x1f')]||null:null,'include':_0x271c38[_0x56c6('0x1a')]?_0x271c38[_0x56c6('0x1a')][_0x56c6('0x1d')]?_[_0x56c6('0x1c')](_0x271c38[_0x56c6('0x1a')][_0x56c6('0x1d')],function(_0x35572b){return{'model':db[_0x35572b['model']],'as':_0x35572b['as'],'attributes':_0x35572b[_0x56c6('0x1f')],'include':_0x35572b[_0x56c6('0x1d')]?_['map'](_0x35572b[_0x56c6('0x1d')],function(_0x23e2d7){return{'model':db[_0x23e2d7[_0x56c6('0x1e')]],'as':_0x23e2d7['as'],'attributes':_0x23e2d7[_0x56c6('0x1f')],'include':_0x23e2d7[_0x56c6('0x1d')]?_[_0x56c6('0x1c')](_0x23e2d7[_0x56c6('0x1d')],function(_0x5aa1d7){return{'model':db[_0x5aa1d7[_0x56c6('0x1e')]],'as':_0x5aa1d7['as'],'attributes':_0x5aa1d7[_0x56c6('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x56c6('0xd')](function(_0x475f50){logger[_0x56c6('0x21')](_0x56c6('0x22'),_0x271c38);logger[_0x56c6('0x10')]('ShowZendeskAccount',_0x271c38,JSON['stringify'](_0x475f50));_0x53dc4e(_0x475f50);})[_0x56c6('0x16')](function(_0x13a927){logger[_0x56c6('0x13')](_0x56c6('0x22'),_0x13a927[_0x56c6('0x14')],_0x271c38);_0x5909cf(_0x22a98e[_0x56c6('0x13')](0x1f4,_0x13a927[_0x56c6('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 097b8ed..15da380 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 _0x0713=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','post','setTags','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields'];(function(_0x931e05,_0x1ab7ff){var _0x26fdfa=function(_0x54aeb2){while(--_0x54aeb2){_0x931e05['push'](_0x931e05['shift']());}};_0x26fdfa(++_0x1ab7ff);}(_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'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['getFields']);router[_0x3071('0x8')](_0x3071('0xe'),auth[_0x3071('0x9')](),controller[_0x3071('0xf')]);router[_0x3071('0x8')]('/:id/descriptions',auth[_0x3071('0x9')](),controller[_0x3071('0x10')]);router[_0x3071('0x8')](_0x3071('0x11'),auth[_0x3071('0x9')](),controller['getTags']);router['post']('/',auth[_0x3071('0x9')](),controller['create']);router[_0x3071('0x12')](_0x3071('0x11'),auth['isAuthenticated'](),controller[_0x3071('0x13')]);router['put'](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0x14')]);router[_0x3071('0x15')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0x16')]);module[_0x3071('0x17')]=router; \ No newline at end of file +var _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','getTags','post','create','put','update','delete','exports','multer','util','path','express','Router'];(function(_0x43c121,_0x321b95){var _0x514a43=function(_0x4d2d74){while(--_0x4d2d74){_0x43c121['push'](_0x43c121['shift']());}};_0x514a43(++_0x321b95);}(_0xe706,0xa3));var _0x6e70=function(_0x454165,_0x1f3e74){_0x454165=_0x454165-0x0;var _0x56db53=_0xe706[_0x454165];return _0x56db53;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0xa')](_0x6e70('0x11'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0xa')](_0x6e70('0x13'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x6e70('0xa')](_0x6e70('0x14'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x15')]);router[_0x6e70('0x16')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x17')]);router[_0x6e70('0x16')]('/:id/tags',auth['isAuthenticated'](),controller['setTags']);router[_0x6e70('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x6e70('0x19')]);router[_0x6e70('0x1a')]('/:id',auth[_0x6e70('0xb')](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 488b67e..656652a 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 _0xf020=['exports','STRING','sequelize'];(function(_0x347f98,_0x23b964){var _0x5c8bfc=function(_0x2c997f){while(--_0x2c997f){_0x347f98['push'](_0x347f98['shift']());}};_0x5c8bfc(++_0x23b964);}(_0xf020,0x185));var _0x0f02=function(_0xffab8f,_0x33847a){_0xffab8f=_0xffab8f-0x0;var _0x4ada85=_0xf020[_0xffab8f];return _0x4ada85;};'use strict';var Sequelize=require(_0x0f02('0x0'));module[_0x0f02('0x1')]={'name':{'type':Sequelize[_0x0f02('0x2')]},'description':{'type':Sequelize[_0x0f02('0x2')]}}; \ No newline at end of file +var _0x42e5=['STRING','exports'];(function(_0xf1bd1f,_0x5211b4){var _0x759524=function(_0x4cc98b){while(--_0x4cc98b){_0xf1bd1f['push'](_0xf1bd1f['shift']());}};_0x759524(++_0x5211b4);}(_0x42e5,0x9f));var _0x542e=function(_0x3cfd57,_0x537cf5){_0x3cfd57=_0x3cfd57-0x0;var _0x527d26=_0x42e5[_0x3cfd57];return _0x527d26;};'use strict';var Sequelize=require('sequelize');module[_0x542e('0x0')]={'name':{'type':Sequelize[_0x542e('0x1')]},'description':{'type':Sequelize[_0x542e('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index d6f27a9..eb0bbf5 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 _0x706a=['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','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','sendStatus','error','stack','send','index','map','rawAttributes','fieldName','key','name','query','keys','filters','attributes','intersection','fields','model','hasOwnProperty','nolimit','order','where','pick','merge','type','VIRTUAL','options','ZendeskConfiguration','includeAll','findAll','rows','catch','params','find','create','body','update','findOne','sort','filter','getFields','length','getSubjects','ZendeskField','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x166d02,_0x44d70b){var _0x21d635=function(_0x22bdec){while(--_0x22bdec){_0x166d02['push'](_0x166d02['shift']());}};_0x21d635(++_0x44d70b);}(_0x706a,0x9d));var _0xa706=function(_0x30b0d8,_0x57470c){_0x30b0d8=_0x30b0d8-0x0;var _0x459c09=_0x706a[_0x30b0d8];return _0x459c09;};'use strict';var emlformat=require(_0xa706('0x0'));var rimraf=require(_0xa706('0x1'));var zipdir=require(_0xa706('0x2'));var jsonpatch=require(_0xa706('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xa706('0x4'));var csv=require(_0xa706('0x5'));var ejs=require(_0xa706('0x6'));var fs=require('fs');var fs_extra=require(_0xa706('0x7'));var _=require(_0xa706('0x8'));var squel=require(_0xa706('0x9'));var crypto=require(_0xa706('0xa'));var jsforce=require(_0xa706('0xb'));var deskjs=require(_0xa706('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa706('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa706('0xe'));var qs=require(_0xa706('0xf'));var as=require(_0xa706('0x10'));var hardwareService=require(_0xa706('0x11'));var logger=require(_0xa706('0x12'))(_0xa706('0x13'));var utils=require(_0xa706('0x14'));var config=require(_0xa706('0x15'));var licenseUtil=require(_0xa706('0x16'));var db=require(_0xa706('0x17'))['db'];function respondWithStatusCode(_0x31030e,_0x160924){_0x160924=_0x160924||0xcc;return function(_0x243cfc){if(_0x243cfc){return _0x31030e['sendStatus'](_0x160924);}return _0x31030e[_0xa706('0x18')](_0x160924)[_0xa706('0x19')]();};}function respondWithResult(_0x8b1f8d,_0x241e15){_0x241e15=_0x241e15||0xc8;return function(_0x380181){if(_0x380181){return _0x8b1f8d[_0xa706('0x18')](_0x241e15)[_0xa706('0x1a')](_0x380181);}};}function respondWithFilteredResult(_0xa306ac,_0x3b5527){return function(_0x3178c1){if(_0x3178c1){var _0x39944c=typeof _0x3b5527[_0xa706('0x1b')]===_0xa706('0x1c')&&typeof _0x3b5527[_0xa706('0x1d')]===_0xa706('0x1c');var _0x3a3bf4=_0x3178c1[_0xa706('0x1e')];var _0x2ecbbc=_0x39944c?0x0:_0x3b5527[_0xa706('0x1b')];var _0x191846=_0x39944c?_0x3178c1[_0xa706('0x1e')]:_0x3b5527[_0xa706('0x1b')]+_0x3b5527[_0xa706('0x1d')];var _0x36c738;if(_0x191846>=_0x3a3bf4){_0x191846=_0x3a3bf4;_0x36c738=0xc8;}else{_0x36c738=0xce;}_0xa306ac[_0xa706('0x18')](_0x36c738);return _0xa306ac[_0xa706('0x1f')](_0xa706('0x20'),_0x2ecbbc+'-'+_0x191846+'/'+_0x3a3bf4)[_0xa706('0x1a')](_0x3178c1);}return null;};}function patchUpdates(_0x127d44){return function(_0xed8051){try{jsonpatch[_0xa706('0x21')](_0xed8051,_0x127d44,!![]);}catch(_0x32d8bb){return BPromise[_0xa706('0x22')](_0x32d8bb);}return _0xed8051['save']();};}function saveUpdates(_0xce50b4,_0x57e37d){return function(_0x341040){if(_0x341040){return _0x341040['update'](_0xce50b4)[_0xa706('0x23')](function(_0x4f3b82){return _0x4f3b82;});}return null;};}function removeEntity(_0x476c58,_0x1ba169){return function(_0x4f062e){if(_0x4f062e){return _0x4f062e[_0xa706('0x24')]()[_0xa706('0x23')](function(){_0x476c58[_0xa706('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18bdd6,_0x365a7b){return function(_0x515eb1){if(!_0x515eb1){_0x18bdd6[_0xa706('0x25')](0x194);}return _0x515eb1;};}function handleError(_0xa3b08d,_0x3c4d68){_0x3c4d68=_0x3c4d68||0x1f4;return function(_0x412f81){logger[_0xa706('0x26')](_0x412f81[_0xa706('0x27')]);if(_0x412f81['name']){delete _0x412f81['name'];}_0xa3b08d['status'](_0x3c4d68)[_0xa706('0x28')](_0x412f81);};}exports[_0xa706('0x29')]=function(_0x2ab81c,_0x4c1280){var _0x3eda26={},_0x5094eb={},_0x5cac22={'count':0x0,'rows':[]};var _0x1e636c=_[_0xa706('0x2a')](db['ZendeskConfiguration'][_0xa706('0x2b')],function(_0x425def){return{'name':_0x425def[_0xa706('0x2c')],'type':_0x425def['type'][_0xa706('0x2d')]};});_0x5094eb['model']=_[_0xa706('0x2a')](_0x1e636c,_0xa706('0x2e'));_0x5094eb[_0xa706('0x2f')]=_[_0xa706('0x30')](_0x2ab81c[_0xa706('0x2f')]);_0x5094eb[_0xa706('0x31')]=_['intersection'](_0x5094eb['model'],_0x5094eb[_0xa706('0x2f')]);_0x3eda26[_0xa706('0x32')]=_[_0xa706('0x33')](_0x5094eb['model'],qs[_0xa706('0x34')](_0x2ab81c['query'][_0xa706('0x34')]));_0x3eda26[_0xa706('0x32')]=_0x3eda26['attributes']['length']?_0x3eda26['attributes']:_0x5094eb[_0xa706('0x35')];if(!_0x2ab81c[_0xa706('0x2f')][_0xa706('0x36')](_0xa706('0x37'))){_0x3eda26['limit']=qs[_0xa706('0x1d')](_0x2ab81c[_0xa706('0x2f')][_0xa706('0x1d')]);_0x3eda26[_0xa706('0x1b')]=qs[_0xa706('0x1b')](_0x2ab81c[_0xa706('0x2f')][_0xa706('0x1b')]);}_0x3eda26[_0xa706('0x38')]=qs['sort'](_0x2ab81c[_0xa706('0x2f')]['sort']);_0x3eda26[_0xa706('0x39')]=qs[_0xa706('0x31')](_[_0xa706('0x3a')](_0x2ab81c['query'],_0x5094eb[_0xa706('0x31')]),_0x1e636c);if(_0x2ab81c[_0xa706('0x2f')]['filter']){_0x3eda26[_0xa706('0x39')]=_[_0xa706('0x3b')](_0x3eda26[_0xa706('0x39')],{'$or':_[_0xa706('0x2a')](_0x1e636c,function(_0x3fb1c5){if(_0x3fb1c5[_0xa706('0x3c')]!==_0xa706('0x3d')){var _0x72af16={};_0x72af16[_0x3fb1c5['name']]={'$like':'%'+_0x2ab81c[_0xa706('0x2f')]['filter']+'%'};return _0x72af16;}})});}_0x3eda26=_[_0xa706('0x3b')]({},_0x3eda26,_0x2ab81c[_0xa706('0x3e')]);var _0xb92242={'where':_0x3eda26[_0xa706('0x39')]};return db[_0xa706('0x3f')][_0xa706('0x1e')](_0xb92242)['then'](function(_0x331716){_0x5cac22[_0xa706('0x1e')]=_0x331716;if(_0x2ab81c['query'][_0xa706('0x40')]){_0x3eda26['include']=[{'all':!![]}];}return db[_0xa706('0x3f')][_0xa706('0x41')](_0x3eda26);})[_0xa706('0x23')](function(_0x49955b){_0x5cac22[_0xa706('0x42')]=_0x49955b;return _0x5cac22;})['then'](respondWithFilteredResult(_0x4c1280,_0x3eda26))[_0xa706('0x43')](handleError(_0x4c1280,null));};exports['show']=function(_0x5da8a5,_0xb5f179){var _0xcc4421={'raw':![],'where':{'id':_0x5da8a5[_0xa706('0x44')]['id']}},_0x158efe={};_0x158efe[_0xa706('0x35')]=_[_0xa706('0x30')](db[_0xa706('0x3f')]['rawAttributes']);_0x158efe[_0xa706('0x2f')]=_[_0xa706('0x30')](_0x5da8a5['query']);_0x158efe['filters']=_[_0xa706('0x33')](_0x158efe[_0xa706('0x35')],_0x158efe[_0xa706('0x2f')]);_0xcc4421[_0xa706('0x32')]=_[_0xa706('0x33')](_0x158efe[_0xa706('0x35')],qs['fields'](_0x5da8a5['query'][_0xa706('0x34')]));_0xcc4421[_0xa706('0x32')]=_0xcc4421[_0xa706('0x32')]['length']?_0xcc4421[_0xa706('0x32')]:_0x158efe[_0xa706('0x35')];if(_0x5da8a5[_0xa706('0x2f')][_0xa706('0x40')]){_0xcc4421['include']=[{'all':!![]}];}_0xcc4421=_[_0xa706('0x3b')]({},_0xcc4421,_0x5da8a5[_0xa706('0x3e')]);return db[_0xa706('0x3f')][_0xa706('0x45')](_0xcc4421)[_0xa706('0x23')](handleEntityNotFound(_0xb5f179,null))[_0xa706('0x23')](respondWithResult(_0xb5f179,null))[_0xa706('0x43')](handleError(_0xb5f179,null));};exports[_0xa706('0x46')]=function(_0xd1181d,_0x58a198){return db[_0xa706('0x3f')][_0xa706('0x46')](_0xd1181d[_0xa706('0x47')],{})[_0xa706('0x23')](respondWithResult(_0x58a198,0xc9))['catch'](handleError(_0x58a198,null));};exports[_0xa706('0x48')]=function(_0x5e3b27,_0xe2d10a){if(_0x5e3b27[_0xa706('0x47')]['id']){delete _0x5e3b27[_0xa706('0x47')]['id'];}return db[_0xa706('0x3f')][_0xa706('0x45')]({'where':{'id':_0x5e3b27[_0xa706('0x44')]['id']}})[_0xa706('0x23')](handleEntityNotFound(_0xe2d10a,null))[_0xa706('0x23')](saveUpdates(_0x5e3b27[_0xa706('0x47')],null))[_0xa706('0x23')](respondWithResult(_0xe2d10a,null))[_0xa706('0x43')](handleError(_0xe2d10a,null));};exports[_0xa706('0x24')]=function(_0x14d551,_0x130e3d){return db['ZendeskConfiguration'][_0xa706('0x45')]({'where':{'id':_0x14d551[_0xa706('0x44')]['id']}})[_0xa706('0x23')](handleEntityNotFound(_0x130e3d,null))[_0xa706('0x23')](removeEntity(_0x130e3d,null))[_0xa706('0x43')](handleError(_0x130e3d,null));};exports['getFields']=function(_0x227f45,_0x4017d4,_0x1aaf9a){var _0x58b1ee={};var _0x443bbd={};var _0x5a9432;var _0x6cb4d4;return db[_0xa706('0x3f')][_0xa706('0x49')]({'where':{'id':_0x227f45[_0xa706('0x44')]['id']}})[_0xa706('0x23')](handleEntityNotFound(_0x4017d4,null))['then'](function(_0x634e16){if(_0x634e16){_0x5a9432=_0x634e16;_0x443bbd[_0xa706('0x35')]=_[_0xa706('0x30')](db['ZendeskField'][_0xa706('0x2b')]);_0x443bbd['query']=_['keys'](_0x227f45[_0xa706('0x2f')]);_0x443bbd[_0xa706('0x31')]=_[_0xa706('0x33')](_0x443bbd[_0xa706('0x35')],_0x443bbd[_0xa706('0x2f')]);_0x58b1ee[_0xa706('0x32')]=_[_0xa706('0x33')](_0x443bbd[_0xa706('0x35')],qs[_0xa706('0x34')](_0x227f45[_0xa706('0x2f')][_0xa706('0x34')]));_0x58b1ee[_0xa706('0x32')]=_0x58b1ee['attributes']['length']?_0x58b1ee[_0xa706('0x32')]:_0x443bbd[_0xa706('0x35')];_0x58b1ee[_0xa706('0x38')]=qs[_0xa706('0x4a')](_0x227f45[_0xa706('0x2f')][_0xa706('0x4a')]);_0x58b1ee[_0xa706('0x39')]=qs[_0xa706('0x31')](_[_0xa706('0x3a')](_0x227f45[_0xa706('0x2f')],_0x443bbd['filters']));if(_0x227f45['query'][_0xa706('0x4b')]){_0x58b1ee[_0xa706('0x39')]=_[_0xa706('0x3b')](_0x58b1ee['where'],{'$or':_[_0xa706('0x2a')](_0x58b1ee[_0xa706('0x32')],function(_0x540429){var _0xe9c49f={};_0xe9c49f[_0x540429]={'$like':'%'+_0x227f45['query'][_0xa706('0x4b')]+'%'};return _0xe9c49f;})});}_0x58b1ee=_['merge']({},_0x58b1ee,_0x227f45[_0xa706('0x3e')]);return _0x5a9432[_0xa706('0x4c')](_0x58b1ee);}})['then'](function(_0x4bd7ac){if(_0x4bd7ac){_0x6cb4d4=_0x4bd7ac[_0xa706('0x4d')];if(!_0x227f45[_0xa706('0x2f')]['hasOwnProperty'](_0xa706('0x37'))){_0x58b1ee[_0xa706('0x1d')]=qs['limit'](_0x227f45['query'][_0xa706('0x1d')]);_0x58b1ee['offset']=qs[_0xa706('0x1b')](_0x227f45[_0xa706('0x2f')]['offset']);}return _0x5a9432[_0xa706('0x4c')](_0x58b1ee);}})[_0xa706('0x23')](function(_0x1c220c){if(_0x1c220c){return _0x1c220c?{'count':_0x6cb4d4,'rows':_0x1c220c}:null;}})[_0xa706('0x23')](respondWithResult(_0x4017d4,null))[_0xa706('0x43')](handleError(_0x4017d4,null));};exports[_0xa706('0x4e')]=function(_0x1f0c7e,_0x82a034,_0x51d555){var _0x568caf={};var _0xc50481={};var _0x500d8f;var _0x123083;return db[_0xa706('0x3f')][_0xa706('0x49')]({'where':{'id':_0x1f0c7e['params']['id']}})['then'](handleEntityNotFound(_0x82a034,null))[_0xa706('0x23')](function(_0x5bcc52){if(_0x5bcc52){_0x500d8f=_0x5bcc52;_0xc50481[_0xa706('0x35')]=_[_0xa706('0x30')](db[_0xa706('0x4f')][_0xa706('0x2b')]);_0xc50481[_0xa706('0x2f')]=_['keys'](_0x1f0c7e[_0xa706('0x2f')]);_0xc50481['filters']=_[_0xa706('0x33')](_0xc50481[_0xa706('0x35')],_0xc50481['query']);_0x568caf['attributes']=_[_0xa706('0x33')](_0xc50481[_0xa706('0x35')],qs[_0xa706('0x34')](_0x1f0c7e['query'][_0xa706('0x34')]));_0x568caf[_0xa706('0x32')]=_0x568caf['attributes'][_0xa706('0x4d')]?_0x568caf['attributes']:_0xc50481[_0xa706('0x35')];_0x568caf['order']=qs[_0xa706('0x4a')](_0x1f0c7e[_0xa706('0x2f')][_0xa706('0x4a')]);_0x568caf[_0xa706('0x39')]=qs[_0xa706('0x31')](_['pick'](_0x1f0c7e[_0xa706('0x2f')],_0xc50481['filters']));if(_0x1f0c7e['query'][_0xa706('0x4b')]){_0x568caf['where']=_[_0xa706('0x3b')](_0x568caf[_0xa706('0x39')],{'$or':_[_0xa706('0x2a')](_0x568caf[_0xa706('0x32')],function(_0x3edae9){var _0x3a4339={};_0x3a4339[_0x3edae9]={'$like':'%'+_0x1f0c7e[_0xa706('0x2f')][_0xa706('0x4b')]+'%'};return _0x3a4339;})});}_0x568caf=_[_0xa706('0x3b')]({},_0x568caf,_0x1f0c7e[_0xa706('0x3e')]);return _0x500d8f[_0xa706('0x4e')](_0x568caf);}})[_0xa706('0x23')](function(_0x521f5b){if(_0x521f5b){_0x123083=_0x521f5b[_0xa706('0x4d')];if(!_0x1f0c7e[_0xa706('0x2f')][_0xa706('0x36')](_0xa706('0x37'))){_0x568caf[_0xa706('0x1d')]=qs[_0xa706('0x1d')](_0x1f0c7e[_0xa706('0x2f')]['limit']);_0x568caf[_0xa706('0x1b')]=qs[_0xa706('0x1b')](_0x1f0c7e['query'][_0xa706('0x1b')]);}return _0x500d8f[_0xa706('0x4e')](_0x568caf);}})['then'](function(_0x3f4fb5){if(_0x3f4fb5){return _0x3f4fb5?{'count':_0x123083,'rows':_0x3f4fb5}:null;}})[_0xa706('0x23')](respondWithResult(_0x82a034,null))[_0xa706('0x43')](handleError(_0x82a034,null));};exports[_0xa706('0x50')]=function(_0x570afd,_0xe0c8f3,_0x5f42dd){var _0x10a3d8={};var _0x59800a={};var _0xd0a2b6;var _0x3f79d5;return db[_0xa706('0x3f')][_0xa706('0x49')]({'where':{'id':_0x570afd['params']['id']}})['then'](handleEntityNotFound(_0xe0c8f3,null))[_0xa706('0x23')](function(_0x22d4b8){if(_0x22d4b8){_0xd0a2b6=_0x22d4b8;_0x59800a[_0xa706('0x35')]=_['keys'](db[_0xa706('0x4f')][_0xa706('0x2b')]);_0x59800a[_0xa706('0x2f')]=_[_0xa706('0x30')](_0x570afd['query']);_0x59800a[_0xa706('0x31')]=_[_0xa706('0x33')](_0x59800a['model'],_0x59800a[_0xa706('0x2f')]);_0x10a3d8[_0xa706('0x32')]=_[_0xa706('0x33')](_0x59800a[_0xa706('0x35')],qs[_0xa706('0x34')](_0x570afd[_0xa706('0x2f')][_0xa706('0x34')]));_0x10a3d8[_0xa706('0x32')]=_0x10a3d8['attributes']['length']?_0x10a3d8[_0xa706('0x32')]:_0x59800a[_0xa706('0x35')];_0x10a3d8['order']=qs[_0xa706('0x4a')](_0x570afd[_0xa706('0x2f')][_0xa706('0x4a')]);_0x10a3d8[_0xa706('0x39')]=qs[_0xa706('0x31')](_[_0xa706('0x3a')](_0x570afd[_0xa706('0x2f')],_0x59800a['filters']));if(_0x570afd[_0xa706('0x2f')][_0xa706('0x4b')]){_0x10a3d8[_0xa706('0x39')]=_[_0xa706('0x3b')](_0x10a3d8[_0xa706('0x39')],{'$or':_['map'](_0x10a3d8['attributes'],function(_0x55b420){var _0xa3f19a={};_0xa3f19a[_0x55b420]={'$like':'%'+_0x570afd['query']['filter']+'%'};return _0xa3f19a;})});}_0x10a3d8=_[_0xa706('0x3b')]({},_0x10a3d8,_0x570afd[_0xa706('0x3e')]);return _0xd0a2b6[_0xa706('0x50')](_0x10a3d8);}})[_0xa706('0x23')](function(_0x4b85c0){if(_0x4b85c0){_0x3f79d5=_0x4b85c0[_0xa706('0x4d')];if(!_0x570afd[_0xa706('0x2f')][_0xa706('0x36')](_0xa706('0x37'))){_0x10a3d8['limit']=qs[_0xa706('0x1d')](_0x570afd[_0xa706('0x2f')][_0xa706('0x1d')]);_0x10a3d8[_0xa706('0x1b')]=qs[_0xa706('0x1b')](_0x570afd[_0xa706('0x2f')][_0xa706('0x1b')]);}return _0xd0a2b6[_0xa706('0x50')](_0x10a3d8);}})[_0xa706('0x23')](function(_0x5df798){if(_0x5df798){return _0x5df798?{'count':_0x3f79d5,'rows':_0x5df798}:null;}})['then'](respondWithResult(_0xe0c8f3,null))['catch'](handleError(_0xe0c8f3,null));};exports[_0xa706('0x51')]=function(_0x54663c,_0x12c6bc,_0x4f87e6){var _0x17cbfa={};var _0x5b0ada={};var _0x40431a;var _0x1d3a77;return db[_0xa706('0x3f')][_0xa706('0x49')]({'where':{'id':_0x54663c['params']['id']}})[_0xa706('0x23')](handleEntityNotFound(_0x12c6bc,null))[_0xa706('0x23')](function(_0x42aaf1){if(_0x42aaf1){_0x40431a=_0x42aaf1;_0x5b0ada[_0xa706('0x35')]=_[_0xa706('0x30')](db[_0xa706('0x52')][_0xa706('0x2b')]);_0x5b0ada['query']=_[_0xa706('0x30')](_0x54663c[_0xa706('0x2f')]);_0x5b0ada['filters']=_[_0xa706('0x33')](_0x5b0ada['model'],_0x5b0ada[_0xa706('0x2f')]);_0x17cbfa[_0xa706('0x32')]=_[_0xa706('0x33')](_0x5b0ada[_0xa706('0x35')],qs['fields'](_0x54663c[_0xa706('0x2f')][_0xa706('0x34')]));_0x17cbfa[_0xa706('0x32')]=_0x17cbfa[_0xa706('0x32')]['length']?_0x17cbfa[_0xa706('0x32')]:_0x5b0ada[_0xa706('0x35')];_0x17cbfa[_0xa706('0x38')]=qs[_0xa706('0x4a')](_0x54663c[_0xa706('0x2f')]['sort']);_0x17cbfa[_0xa706('0x39')]=qs[_0xa706('0x31')](_[_0xa706('0x3a')](_0x54663c['query'],_0x5b0ada[_0xa706('0x31')]));if(_0x54663c[_0xa706('0x2f')][_0xa706('0x4b')]){_0x17cbfa['where']=_[_0xa706('0x3b')](_0x17cbfa[_0xa706('0x39')],{'$or':_[_0xa706('0x2a')](_0x17cbfa[_0xa706('0x32')],function(_0x371046){var _0x5a949e={};_0x5a949e[_0x371046]={'$like':'%'+_0x54663c[_0xa706('0x2f')][_0xa706('0x4b')]+'%'};return _0x5a949e;})});}_0x17cbfa=_['merge']({},_0x17cbfa,_0x54663c[_0xa706('0x3e')]);return _0x40431a[_0xa706('0x51')](_0x17cbfa);}})[_0xa706('0x23')](function(_0x4209e5){if(_0x4209e5){_0x1d3a77=_0x4209e5[_0xa706('0x4d')];if(!_0x54663c[_0xa706('0x2f')][_0xa706('0x36')](_0xa706('0x37'))){_0x17cbfa[_0xa706('0x1d')]=qs['limit'](_0x54663c['query']['limit']);_0x17cbfa['offset']=qs[_0xa706('0x1b')](_0x54663c[_0xa706('0x2f')][_0xa706('0x1b')]);}return _0x40431a[_0xa706('0x51')](_0x17cbfa);}})[_0xa706('0x23')](function(_0x23a9c5){if(_0x23a9c5){return _0x23a9c5?{'count':_0x1d3a77,'rows':_0x23a9c5}:null;}})[_0xa706('0x23')](respondWithResult(_0x12c6bc,null))[_0xa706('0x43')](handleError(_0x12c6bc,null));};exports[_0xa706('0x53')]=function(_0x926409,_0x145145,_0x48ad3e){if(_0x926409['body']['id']){delete _0x926409[_0xa706('0x47')]['id'];}return db[_0xa706('0x3f')][_0xa706('0x49')]({'where':{'id':_0x926409[_0xa706('0x44')]['id']}})[_0xa706('0x23')](handleEntityNotFound(_0x145145,null))['then'](function(_0x12240c){if(_0x12240c){return _0x12240c['setTags'](_0x926409[_0xa706('0x47')]['ids']||[]);}return null;})[_0xa706('0x23')](respondWithResult(_0x145145,null))['catch'](handleError(_0x145145,null));}; \ No newline at end of file +var _0x33ab=['json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','map','ZendeskConfiguration','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','show','params','rawAttributes','length','find','catch','create','body','destroy','getFields','findOne','ZendeskField','order','getSubjects','getDescriptions','Tag','getTags','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x142009,_0x302ec6){var _0x43454b=function(_0x2b4a20){while(--_0x2b4a20){_0x142009['push'](_0x142009['shift']());}};_0x43454b(++_0x302ec6);}(_0x33ab,0x1df));var _0xb33a=function(_0x258f5b,_0x14e13f){_0x258f5b=_0x258f5b-0x0;var _0xfb3fb8=_0x33ab[_0x258f5b];return _0xfb3fb8;};'use strict';var emlformat=require(_0xb33a('0x0'));var rimraf=require(_0xb33a('0x1'));var zipdir=require(_0xb33a('0x2'));var jsonpatch=require(_0xb33a('0x3'));var rp=require(_0xb33a('0x4'));var moment=require(_0xb33a('0x5'));var BPromise=require(_0xb33a('0x6'));var Mustache=require(_0xb33a('0x7'));var util=require('util');var path=require(_0xb33a('0x8'));var sox=require('sox');var csv=require(_0xb33a('0x9'));var ejs=require(_0xb33a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb33a('0xb'));var crypto=require(_0xb33a('0xc'));var jsforce=require(_0xb33a('0xd'));var deskjs=require(_0xb33a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb33a('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb33a('0x10'));var qs=require(_0xb33a('0x11'));var as=require(_0xb33a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb33a('0x13'))('api');var utils=require(_0xb33a('0x14'));var config=require(_0xb33a('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xb33a('0x16'))['db'];function respondWithStatusCode(_0x197085,_0x42ace9){_0x42ace9=_0x42ace9||0xcc;return function(_0x5675ea){if(_0x5675ea){return _0x197085[_0xb33a('0x17')](_0x42ace9);}return _0x197085[_0xb33a('0x18')](_0x42ace9)['end']();};}function respondWithResult(_0x221a4b,_0x548e5c){_0x548e5c=_0x548e5c||0xc8;return function(_0x794dec){if(_0x794dec){return _0x221a4b[_0xb33a('0x18')](_0x548e5c)[_0xb33a('0x19')](_0x794dec);}};}function respondWithFilteredResult(_0xd41261,_0x485115){return function(_0x35b1cd){if(_0x35b1cd){var _0x4ebafb=typeof _0x485115['offset']===_0xb33a('0x1a')&&typeof _0x485115[_0xb33a('0x1b')]===_0xb33a('0x1a');var _0x18ed23=_0x35b1cd[_0xb33a('0x1c')];var _0x38f8df=_0x4ebafb?0x0:_0x485115[_0xb33a('0x1d')];var _0x2ec0fe=_0x4ebafb?_0x35b1cd['count']:_0x485115['offset']+_0x485115[_0xb33a('0x1b')];var _0x1efdaf;if(_0x2ec0fe>=_0x18ed23){_0x2ec0fe=_0x18ed23;_0x1efdaf=0xc8;}else{_0x1efdaf=0xce;}_0xd41261['status'](_0x1efdaf);return _0xd41261[_0xb33a('0x1e')](_0xb33a('0x1f'),_0x38f8df+'-'+_0x2ec0fe+'/'+_0x18ed23)['json'](_0x35b1cd);}return null;};}function patchUpdates(_0x242396){return function(_0xa167da){try{jsonpatch[_0xb33a('0x20')](_0xa167da,_0x242396,!![]);}catch(_0xf7e6d0){return BPromise[_0xb33a('0x21')](_0xf7e6d0);}return _0xa167da[_0xb33a('0x22')]();};}function saveUpdates(_0x5dad8e,_0x458b4f){return function(_0x19f0df){if(_0x19f0df){return _0x19f0df[_0xb33a('0x23')](_0x5dad8e)[_0xb33a('0x24')](function(_0x3eb3b5){return _0x3eb3b5;});}return null;};}function removeEntity(_0x2e12b5,_0x56f3db){return function(_0x68b593){if(_0x68b593){return _0x68b593['destroy']()['then'](function(){_0x2e12b5[_0xb33a('0x18')](0xcc)[_0xb33a('0x25')]();});}};}function handleEntityNotFound(_0x1b69aa,_0x2c216d){return function(_0x5d4294){if(!_0x5d4294){_0x1b69aa[_0xb33a('0x17')](0x194);}return _0x5d4294;};}function handleError(_0x3dc8a6,_0x204c11){_0x204c11=_0x204c11||0x1f4;return function(_0x7034e0){logger[_0xb33a('0x26')](_0x7034e0[_0xb33a('0x27')]);if(_0x7034e0[_0xb33a('0x28')]){delete _0x7034e0['name'];}_0x3dc8a6['status'](_0x204c11)[_0xb33a('0x29')](_0x7034e0);};}exports[_0xb33a('0x2a')]=function(_0x37a016,_0x283c8d){var _0x1174b5={},_0x57713b={},_0x2b5789={'count':0x0,'rows':[]};var _0x3802c7=_[_0xb33a('0x2b')](db[_0xb33a('0x2c')]['rawAttributes'],function(_0x107434){return{'name':_0x107434[_0xb33a('0x2d')],'type':_0x107434['type'][_0xb33a('0x2e')]};});_0x57713b['model']=_[_0xb33a('0x2b')](_0x3802c7,_0xb33a('0x28'));_0x57713b[_0xb33a('0x2f')]=_[_0xb33a('0x30')](_0x37a016[_0xb33a('0x2f')]);_0x57713b[_0xb33a('0x31')]=_[_0xb33a('0x32')](_0x57713b[_0xb33a('0x33')],_0x57713b[_0xb33a('0x2f')]);_0x1174b5[_0xb33a('0x34')]=_[_0xb33a('0x32')](_0x57713b['model'],qs[_0xb33a('0x35')](_0x37a016[_0xb33a('0x2f')]['fields']));_0x1174b5['attributes']=_0x1174b5[_0xb33a('0x34')]['length']?_0x1174b5[_0xb33a('0x34')]:_0x57713b['model'];if(!_0x37a016['query'][_0xb33a('0x36')](_0xb33a('0x37'))){_0x1174b5['limit']=qs[_0xb33a('0x1b')](_0x37a016[_0xb33a('0x2f')]['limit']);_0x1174b5['offset']=qs[_0xb33a('0x1d')](_0x37a016[_0xb33a('0x2f')][_0xb33a('0x1d')]);}_0x1174b5['order']=qs[_0xb33a('0x38')](_0x37a016[_0xb33a('0x2f')]['sort']);_0x1174b5[_0xb33a('0x39')]=qs[_0xb33a('0x31')](_[_0xb33a('0x3a')](_0x37a016[_0xb33a('0x2f')],_0x57713b['filters']),_0x3802c7);if(_0x37a016[_0xb33a('0x2f')]['filter']){_0x1174b5[_0xb33a('0x39')]=_[_0xb33a('0x3b')](_0x1174b5[_0xb33a('0x39')],{'$or':_[_0xb33a('0x2b')](_0x3802c7,function(_0xf814e){if(_0xf814e[_0xb33a('0x3c')]!==_0xb33a('0x3d')){var _0x8663c8={};_0x8663c8[_0xf814e['name']]={'$like':'%'+_0x37a016['query'][_0xb33a('0x3e')]+'%'};return _0x8663c8;}})});}_0x1174b5=_[_0xb33a('0x3b')]({},_0x1174b5,_0x37a016[_0xb33a('0x3f')]);var _0x184e58={'where':_0x1174b5[_0xb33a('0x39')]};return db[_0xb33a('0x2c')][_0xb33a('0x1c')](_0x184e58)['then'](function(_0x4adb0f){_0x2b5789[_0xb33a('0x1c')]=_0x4adb0f;if(_0x37a016[_0xb33a('0x2f')][_0xb33a('0x40')]){_0x1174b5[_0xb33a('0x41')]=[{'all':!![]}];}return db['ZendeskConfiguration']['findAll'](_0x1174b5);})[_0xb33a('0x24')](function(_0x2b3674){_0x2b5789['rows']=_0x2b3674;return _0x2b5789;})[_0xb33a('0x24')](respondWithFilteredResult(_0x283c8d,_0x1174b5))['catch'](handleError(_0x283c8d,null));};exports[_0xb33a('0x42')]=function(_0x13d61d,_0x2a0276){var _0x2f4b09={'raw':![],'where':{'id':_0x13d61d[_0xb33a('0x43')]['id']}},_0x5560e9={};_0x5560e9[_0xb33a('0x33')]=_[_0xb33a('0x30')](db['ZendeskConfiguration'][_0xb33a('0x44')]);_0x5560e9[_0xb33a('0x2f')]=_[_0xb33a('0x30')](_0x13d61d['query']);_0x5560e9['filters']=_[_0xb33a('0x32')](_0x5560e9['model'],_0x5560e9[_0xb33a('0x2f')]);_0x2f4b09[_0xb33a('0x34')]=_[_0xb33a('0x32')](_0x5560e9[_0xb33a('0x33')],qs['fields'](_0x13d61d[_0xb33a('0x2f')]['fields']));_0x2f4b09[_0xb33a('0x34')]=_0x2f4b09[_0xb33a('0x34')][_0xb33a('0x45')]?_0x2f4b09[_0xb33a('0x34')]:_0x5560e9[_0xb33a('0x33')];if(_0x13d61d['query'][_0xb33a('0x40')]){_0x2f4b09[_0xb33a('0x41')]=[{'all':!![]}];}_0x2f4b09=_['merge']({},_0x2f4b09,_0x13d61d[_0xb33a('0x3f')]);return db['ZendeskConfiguration'][_0xb33a('0x46')](_0x2f4b09)[_0xb33a('0x24')](handleEntityNotFound(_0x2a0276,null))['then'](respondWithResult(_0x2a0276,null))[_0xb33a('0x47')](handleError(_0x2a0276,null));};exports[_0xb33a('0x48')]=function(_0x507605,_0x57a85c){return db[_0xb33a('0x2c')]['create'](_0x507605[_0xb33a('0x49')],{})['then'](respondWithResult(_0x57a85c,0xc9))[_0xb33a('0x47')](handleError(_0x57a85c,null));};exports['update']=function(_0x4f6c7a,_0x153feb){if(_0x4f6c7a[_0xb33a('0x49')]['id']){delete _0x4f6c7a[_0xb33a('0x49')]['id'];}return db[_0xb33a('0x2c')][_0xb33a('0x46')]({'where':{'id':_0x4f6c7a[_0xb33a('0x43')]['id']}})[_0xb33a('0x24')](handleEntityNotFound(_0x153feb,null))['then'](saveUpdates(_0x4f6c7a['body'],null))[_0xb33a('0x24')](respondWithResult(_0x153feb,null))['catch'](handleError(_0x153feb,null));};exports[_0xb33a('0x4a')]=function(_0x4c082d,_0x588847){return db[_0xb33a('0x2c')]['find']({'where':{'id':_0x4c082d[_0xb33a('0x43')]['id']}})[_0xb33a('0x24')](handleEntityNotFound(_0x588847,null))['then'](removeEntity(_0x588847,null))[_0xb33a('0x47')](handleError(_0x588847,null));};exports[_0xb33a('0x4b')]=function(_0x2ed837,_0x4a2eeb,_0x52da5f){var _0x31fc87={};var _0x17fd4d={};var _0x11ee26;var _0x508795;return db[_0xb33a('0x2c')][_0xb33a('0x4c')]({'where':{'id':_0x2ed837[_0xb33a('0x43')]['id']}})[_0xb33a('0x24')](handleEntityNotFound(_0x4a2eeb,null))[_0xb33a('0x24')](function(_0x536345){if(_0x536345){_0x11ee26=_0x536345;_0x17fd4d[_0xb33a('0x33')]=_[_0xb33a('0x30')](db[_0xb33a('0x4d')][_0xb33a('0x44')]);_0x17fd4d[_0xb33a('0x2f')]=_[_0xb33a('0x30')](_0x2ed837[_0xb33a('0x2f')]);_0x17fd4d[_0xb33a('0x31')]=_[_0xb33a('0x32')](_0x17fd4d[_0xb33a('0x33')],_0x17fd4d['query']);_0x31fc87['attributes']=_['intersection'](_0x17fd4d[_0xb33a('0x33')],qs['fields'](_0x2ed837[_0xb33a('0x2f')][_0xb33a('0x35')]));_0x31fc87[_0xb33a('0x34')]=_0x31fc87['attributes'][_0xb33a('0x45')]?_0x31fc87[_0xb33a('0x34')]:_0x17fd4d[_0xb33a('0x33')];_0x31fc87[_0xb33a('0x4e')]=qs['sort'](_0x2ed837[_0xb33a('0x2f')][_0xb33a('0x38')]);_0x31fc87[_0xb33a('0x39')]=qs[_0xb33a('0x31')](_[_0xb33a('0x3a')](_0x2ed837['query'],_0x17fd4d[_0xb33a('0x31')]));if(_0x2ed837[_0xb33a('0x2f')][_0xb33a('0x3e')]){_0x31fc87[_0xb33a('0x39')]=_[_0xb33a('0x3b')](_0x31fc87[_0xb33a('0x39')],{'$or':_[_0xb33a('0x2b')](_0x31fc87[_0xb33a('0x34')],function(_0x2c8267){var _0xa87b6b={};_0xa87b6b[_0x2c8267]={'$like':'%'+_0x2ed837[_0xb33a('0x2f')][_0xb33a('0x3e')]+'%'};return _0xa87b6b;})});}_0x31fc87=_['merge']({},_0x31fc87,_0x2ed837[_0xb33a('0x3f')]);return _0x11ee26['getFields'](_0x31fc87);}})[_0xb33a('0x24')](function(_0x3a26db){if(_0x3a26db){_0x508795=_0x3a26db['length'];if(!_0x2ed837[_0xb33a('0x2f')][_0xb33a('0x36')](_0xb33a('0x37'))){_0x31fc87[_0xb33a('0x1b')]=qs[_0xb33a('0x1b')](_0x2ed837['query'][_0xb33a('0x1b')]);_0x31fc87[_0xb33a('0x1d')]=qs[_0xb33a('0x1d')](_0x2ed837[_0xb33a('0x2f')][_0xb33a('0x1d')]);}return _0x11ee26[_0xb33a('0x4b')](_0x31fc87);}})[_0xb33a('0x24')](function(_0x1dd75b){if(_0x1dd75b){return _0x1dd75b?{'count':_0x508795,'rows':_0x1dd75b}:null;}})[_0xb33a('0x24')](respondWithResult(_0x4a2eeb,null))['catch'](handleError(_0x4a2eeb,null));};exports[_0xb33a('0x4f')]=function(_0x394ea5,_0x33f7e8,_0x5a56e1){var _0x337409={};var _0x4c41d6={};var _0x2f0c1a;var _0x49146d;return db['ZendeskConfiguration'][_0xb33a('0x4c')]({'where':{'id':_0x394ea5[_0xb33a('0x43')]['id']}})[_0xb33a('0x24')](handleEntityNotFound(_0x33f7e8,null))[_0xb33a('0x24')](function(_0x29b51f){if(_0x29b51f){_0x2f0c1a=_0x29b51f;_0x4c41d6[_0xb33a('0x33')]=_['keys'](db[_0xb33a('0x4d')][_0xb33a('0x44')]);_0x4c41d6[_0xb33a('0x2f')]=_['keys'](_0x394ea5['query']);_0x4c41d6[_0xb33a('0x31')]=_['intersection'](_0x4c41d6['model'],_0x4c41d6[_0xb33a('0x2f')]);_0x337409[_0xb33a('0x34')]=_[_0xb33a('0x32')](_0x4c41d6[_0xb33a('0x33')],qs[_0xb33a('0x35')](_0x394ea5['query'][_0xb33a('0x35')]));_0x337409[_0xb33a('0x34')]=_0x337409['attributes'][_0xb33a('0x45')]?_0x337409[_0xb33a('0x34')]:_0x4c41d6[_0xb33a('0x33')];_0x337409[_0xb33a('0x4e')]=qs['sort'](_0x394ea5['query'][_0xb33a('0x38')]);_0x337409['where']=qs[_0xb33a('0x31')](_[_0xb33a('0x3a')](_0x394ea5[_0xb33a('0x2f')],_0x4c41d6[_0xb33a('0x31')]));if(_0x394ea5[_0xb33a('0x2f')]['filter']){_0x337409[_0xb33a('0x39')]=_['merge'](_0x337409[_0xb33a('0x39')],{'$or':_[_0xb33a('0x2b')](_0x337409[_0xb33a('0x34')],function(_0x15c968){var _0x3d7424={};_0x3d7424[_0x15c968]={'$like':'%'+_0x394ea5[_0xb33a('0x2f')]['filter']+'%'};return _0x3d7424;})});}_0x337409=_['merge']({},_0x337409,_0x394ea5[_0xb33a('0x3f')]);return _0x2f0c1a[_0xb33a('0x4f')](_0x337409);}})[_0xb33a('0x24')](function(_0x100ed4){if(_0x100ed4){_0x49146d=_0x100ed4[_0xb33a('0x45')];if(!_0x394ea5[_0xb33a('0x2f')][_0xb33a('0x36')]('nolimit')){_0x337409[_0xb33a('0x1b')]=qs[_0xb33a('0x1b')](_0x394ea5[_0xb33a('0x2f')][_0xb33a('0x1b')]);_0x337409[_0xb33a('0x1d')]=qs[_0xb33a('0x1d')](_0x394ea5['query']['offset']);}return _0x2f0c1a['getSubjects'](_0x337409);}})['then'](function(_0x309b86){if(_0x309b86){return _0x309b86?{'count':_0x49146d,'rows':_0x309b86}:null;}})['then'](respondWithResult(_0x33f7e8,null))[_0xb33a('0x47')](handleError(_0x33f7e8,null));};exports[_0xb33a('0x50')]=function(_0x5d0e5f,_0x32bec4,_0x464a0b){var _0x3e22e5={};var _0x15a828={};var _0x46d2eb;var _0x168c3a;return db[_0xb33a('0x2c')]['findOne']({'where':{'id':_0x5d0e5f['params']['id']}})['then'](handleEntityNotFound(_0x32bec4,null))[_0xb33a('0x24')](function(_0x4306b4){if(_0x4306b4){_0x46d2eb=_0x4306b4;_0x15a828[_0xb33a('0x33')]=_[_0xb33a('0x30')](db[_0xb33a('0x4d')][_0xb33a('0x44')]);_0x15a828[_0xb33a('0x2f')]=_[_0xb33a('0x30')](_0x5d0e5f[_0xb33a('0x2f')]);_0x15a828[_0xb33a('0x31')]=_[_0xb33a('0x32')](_0x15a828[_0xb33a('0x33')],_0x15a828['query']);_0x3e22e5['attributes']=_['intersection'](_0x15a828[_0xb33a('0x33')],qs[_0xb33a('0x35')](_0x5d0e5f[_0xb33a('0x2f')][_0xb33a('0x35')]));_0x3e22e5['attributes']=_0x3e22e5[_0xb33a('0x34')][_0xb33a('0x45')]?_0x3e22e5[_0xb33a('0x34')]:_0x15a828[_0xb33a('0x33')];_0x3e22e5[_0xb33a('0x4e')]=qs[_0xb33a('0x38')](_0x5d0e5f[_0xb33a('0x2f')][_0xb33a('0x38')]);_0x3e22e5[_0xb33a('0x39')]=qs[_0xb33a('0x31')](_[_0xb33a('0x3a')](_0x5d0e5f[_0xb33a('0x2f')],_0x15a828[_0xb33a('0x31')]));if(_0x5d0e5f['query'][_0xb33a('0x3e')]){_0x3e22e5[_0xb33a('0x39')]=_[_0xb33a('0x3b')](_0x3e22e5[_0xb33a('0x39')],{'$or':_[_0xb33a('0x2b')](_0x3e22e5[_0xb33a('0x34')],function(_0x532cf7){var _0x37a22b={};_0x37a22b[_0x532cf7]={'$like':'%'+_0x5d0e5f[_0xb33a('0x2f')][_0xb33a('0x3e')]+'%'};return _0x37a22b;})});}_0x3e22e5=_[_0xb33a('0x3b')]({},_0x3e22e5,_0x5d0e5f[_0xb33a('0x3f')]);return _0x46d2eb[_0xb33a('0x50')](_0x3e22e5);}})['then'](function(_0x1980c7){if(_0x1980c7){_0x168c3a=_0x1980c7[_0xb33a('0x45')];if(!_0x5d0e5f[_0xb33a('0x2f')]['hasOwnProperty'](_0xb33a('0x37'))){_0x3e22e5[_0xb33a('0x1b')]=qs[_0xb33a('0x1b')](_0x5d0e5f[_0xb33a('0x2f')][_0xb33a('0x1b')]);_0x3e22e5[_0xb33a('0x1d')]=qs[_0xb33a('0x1d')](_0x5d0e5f[_0xb33a('0x2f')][_0xb33a('0x1d')]);}return _0x46d2eb[_0xb33a('0x50')](_0x3e22e5);}})['then'](function(_0x3323f1){if(_0x3323f1){return _0x3323f1?{'count':_0x168c3a,'rows':_0x3323f1}:null;}})[_0xb33a('0x24')](respondWithResult(_0x32bec4,null))[_0xb33a('0x47')](handleError(_0x32bec4,null));};exports['getTags']=function(_0x2306a8,_0x299da8,_0x3d2427){var _0x3d0aa8={};var _0x4cc960={};var _0x3932a9;var _0x346168;return db[_0xb33a('0x2c')][_0xb33a('0x4c')]({'where':{'id':_0x2306a8[_0xb33a('0x43')]['id']}})[_0xb33a('0x24')](handleEntityNotFound(_0x299da8,null))['then'](function(_0x1b9556){if(_0x1b9556){_0x3932a9=_0x1b9556;_0x4cc960[_0xb33a('0x33')]=_[_0xb33a('0x30')](db[_0xb33a('0x51')]['rawAttributes']);_0x4cc960['query']=_['keys'](_0x2306a8[_0xb33a('0x2f')]);_0x4cc960[_0xb33a('0x31')]=_[_0xb33a('0x32')](_0x4cc960[_0xb33a('0x33')],_0x4cc960[_0xb33a('0x2f')]);_0x3d0aa8[_0xb33a('0x34')]=_[_0xb33a('0x32')](_0x4cc960[_0xb33a('0x33')],qs[_0xb33a('0x35')](_0x2306a8[_0xb33a('0x2f')]['fields']));_0x3d0aa8[_0xb33a('0x34')]=_0x3d0aa8['attributes']['length']?_0x3d0aa8['attributes']:_0x4cc960[_0xb33a('0x33')];_0x3d0aa8[_0xb33a('0x4e')]=qs[_0xb33a('0x38')](_0x2306a8['query'][_0xb33a('0x38')]);_0x3d0aa8[_0xb33a('0x39')]=qs['filters'](_[_0xb33a('0x3a')](_0x2306a8['query'],_0x4cc960[_0xb33a('0x31')]));if(_0x2306a8[_0xb33a('0x2f')]['filter']){_0x3d0aa8[_0xb33a('0x39')]=_[_0xb33a('0x3b')](_0x3d0aa8[_0xb33a('0x39')],{'$or':_[_0xb33a('0x2b')](_0x3d0aa8[_0xb33a('0x34')],function(_0x27c4da){var _0x4b18a7={};_0x4b18a7[_0x27c4da]={'$like':'%'+_0x2306a8[_0xb33a('0x2f')][_0xb33a('0x3e')]+'%'};return _0x4b18a7;})});}_0x3d0aa8=_[_0xb33a('0x3b')]({},_0x3d0aa8,_0x2306a8[_0xb33a('0x3f')]);return _0x3932a9[_0xb33a('0x52')](_0x3d0aa8);}})['then'](function(_0x58858e){if(_0x58858e){_0x346168=_0x58858e['length'];if(!_0x2306a8[_0xb33a('0x2f')]['hasOwnProperty']('nolimit')){_0x3d0aa8['limit']=qs[_0xb33a('0x1b')](_0x2306a8['query'][_0xb33a('0x1b')]);_0x3d0aa8[_0xb33a('0x1d')]=qs[_0xb33a('0x1d')](_0x2306a8[_0xb33a('0x2f')]['offset']);}return _0x3932a9['getTags'](_0x3d0aa8);}})[_0xb33a('0x24')](function(_0x96d809){if(_0x96d809){return _0x96d809?{'count':_0x346168,'rows':_0x96d809}:null;}})[_0xb33a('0x24')](respondWithResult(_0x299da8,null))['catch'](handleError(_0x299da8,null));};exports[_0xb33a('0x53')]=function(_0x2bfc8d,_0x128032,_0xbdd0bf){if(_0x2bfc8d[_0xb33a('0x49')]['id']){delete _0x2bfc8d[_0xb33a('0x49')]['id'];}return db[_0xb33a('0x2c')]['findOne']({'where':{'id':_0x2bfc8d[_0xb33a('0x43')]['id']}})[_0xb33a('0x24')](handleEntityNotFound(_0x128032,null))['then'](function(_0x34e8a3){if(_0x34e8a3){return _0x34e8a3[_0xb33a('0x53')](_0x2bfc8d[_0xb33a('0x49')]['ids']||[]);}return null;})['then'](respondWithResult(_0x128032,null))['catch'](handleError(_0x128032,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 54a37c2..8046d49 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 _0xb7e7=['ZendeskConfiguration','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes','define'];(function(_0x5b7aa4,_0x4a2bc7){var _0x58a3b3=function(_0x1d31b2){while(--_0x1d31b2){_0x5b7aa4['push'](_0x5b7aa4['shift']());}};_0x58a3b3(++_0x4a2bc7);}(_0xb7e7,0x121));var _0x7b7e=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0xb7e7[_0x16d10f];return _0x50c823;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfff0=['./intZendeskConfiguration.attributes','define','int_zendesk_configurations','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xfff0,0x139));var _0x0fff=function(_0x57eb33,_0x2d9503){_0x57eb33=_0x57eb33-0x0;var _0x136e58=_0xfff0[_0x57eb33];return _0x136e58;};'use strict';var _=require('lodash');var util=require(_0x0fff('0x0'));var logger=require(_0x0fff('0x1'))(_0x0fff('0x2'));var moment=require('moment');var BPromise=require(_0x0fff('0x3'));var rp=require(_0x0fff('0x4'));var fs=require('fs');var path=require(_0x0fff('0x5'));var rimraf=require('rimraf');var config=require(_0x0fff('0x6'));var attributes=require(_0x0fff('0x7'));module['exports']=function(_0x33c813,_0x4c2221){return _0x33c813[_0x0fff('0x8')]('ZendeskConfiguration',attributes,{'tableName':_0x0fff('0x9'),'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 742a962..4f14821 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 _0x6afa=['request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s'];(function(_0xfb813,_0x1634cb){var _0x1266eb=function(_0xb3bf9e){while(--_0xb3bf9e){_0xfb813['push'](_0xfb813['shift']());}};_0x1266eb(++_0x1634cb);}(_0x6afa,0x76));var _0xa6af=function(_0x54a3bb,_0x4c0c34){_0x54a3bb=_0x54a3bb-0x0;var _0x1e8288=_0x6afa[_0x54a3bb];return _0x1e8288;};'use strict';var _=require(_0xa6af('0x0'));var util=require(_0xa6af('0x1'));var moment=require(_0xa6af('0x2'));var BPromise=require('bluebird');var rs=require(_0xa6af('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa6af('0x4'))['db'];var utils=require(_0xa6af('0x5'));var logger=require(_0xa6af('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa6af('0x7'));var client=jayson[_0xa6af('0x8')][_0xa6af('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52bc93,_0xc2c260,_0x359381){return new BPromise(function(_0xac091e,_0x21be67){return client[_0xa6af('0xa')](_0x52bc93,_0x359381)[_0xa6af('0xb')](function(_0xbdd92c){logger[_0xa6af('0xc')](_0xa6af('0xd'),_0xc2c260,_0xa6af('0xe'));logger[_0xa6af('0xf')](_0xa6af('0x10'),_0xc2c260,_0xa6af('0xe'),JSON['stringify'](_0xbdd92c));if(_0xbdd92c[_0xa6af('0x11')]){if(_0xbdd92c['error'][_0xa6af('0x12')]===0x1f4){logger[_0xa6af('0x11')](_0xa6af('0xd'),_0xc2c260,_0xbdd92c[_0xa6af('0x11')]['message']);return _0x21be67(_0xbdd92c[_0xa6af('0x11')]['message']);}logger['error'](_0xa6af('0xd'),_0xc2c260,_0xbdd92c[_0xa6af('0x11')][_0xa6af('0x13')]);return _0xac091e(_0xbdd92c[_0xa6af('0x11')]['message']);}else{logger[_0xa6af('0xc')]('ZendeskConfiguration,\x20%s,\x20%s',_0xc2c260,_0xa6af('0xe'));_0xac091e(_0xbdd92c[_0xa6af('0x14')]['message']);}})[_0xa6af('0x15')](function(_0xfdb97b){logger[_0xa6af('0x11')](_0xa6af('0xd'),_0xc2c260,_0xfdb97b);_0x21be67(_0xfdb97b);});});} \ No newline at end of file +var _0x780a=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0xc7348b,_0x145880){var _0x307cec=function(_0x4f1554){while(--_0x4f1554){_0xc7348b['push'](_0xc7348b['shift']());}};_0x307cec(++_0x145880);}(_0x780a,0x17f));var _0xa780=function(_0x5e1c16,_0x34d87e){_0x5e1c16=_0x5e1c16-0x0;var _0x27c433=_0x780a[_0x5e1c16];return _0x27c433;};'use strict';var _=require(_0xa780('0x0'));var util=require(_0xa780('0x1'));var moment=require(_0xa780('0x2'));var BPromise=require(_0xa780('0x3'));var rs=require(_0xa780('0x4'));var fs=require('fs');var Redis=require(_0xa780('0x5'));var db=require(_0xa780('0x6'))['db'];var utils=require(_0xa780('0x7'));var logger=require('../../config/logger')(_0xa780('0x8'));var config=require(_0xa780('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa780('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2057e2,_0x196252,_0x5583ce){return new BPromise(function(_0x53a741,_0x8ee440){return client[_0xa780('0xb')](_0x2057e2,_0x5583ce)[_0xa780('0xc')](function(_0x4d7493){logger['info'](_0xa780('0xd'),_0x196252,_0xa780('0xe'));logger[_0xa780('0xf')](_0xa780('0x10'),_0x196252,'request\x20sent',JSON[_0xa780('0x11')](_0x4d7493));if(_0x4d7493[_0xa780('0x12')]){if(_0x4d7493['error'][_0xa780('0x13')]===0x1f4){logger[_0xa780('0x12')](_0xa780('0xd'),_0x196252,_0x4d7493[_0xa780('0x12')][_0xa780('0x14')]);return _0x8ee440(_0x4d7493['error'][_0xa780('0x14')]);}logger['error'](_0xa780('0xd'),_0x196252,_0x4d7493[_0xa780('0x12')][_0xa780('0x14')]);return _0x53a741(_0x4d7493['error'][_0xa780('0x14')]);}else{logger[_0xa780('0x15')]('ZendeskConfiguration,\x20%s,\x20%s',_0x196252,_0xa780('0xe'));_0x53a741(_0x4d7493[_0xa780('0x16')][_0xa780('0x14')]);}})[_0xa780('0x17')](function(_0x33ce2c){logger[_0xa780('0x12')]('ZendeskConfiguration,\x20%s,\x20%s',_0x196252,_0x33ce2c);_0x8ee440(_0x33ce2c);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 2640e09..fd043a2 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 _0x5e53=['Router','fs-extra','./intZendeskField.controller','get','isAuthenticated','index','post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x2ff022,_0x183a9c){var _0x1cbaa5=function(_0x342bd9){while(--_0x342bd9){_0x2ff022['push'](_0x2ff022['shift']());}};_0x1cbaa5(++_0x183a9c);}(_0x5e53,0x199));var _0x35e5=function(_0x323677,_0x2e7962){_0x323677=_0x323677-0x0;var _0x2566c7=_0x5e53[_0x323677];return _0x2566c7;};'use strict';var multer=require(_0x35e5('0x0'));var util=require(_0x35e5('0x1'));var path=require(_0x35e5('0x2'));var timeout=require(_0x35e5('0x3'));var express=require(_0x35e5('0x4'));var router=express[_0x35e5('0x5')]();var fs_extra=require(_0x35e5('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x35e5('0x7'));router[_0x35e5('0x8')]('/',auth[_0x35e5('0x9')](),controller[_0x35e5('0xa')]);router[_0x35e5('0x8')]('/:id',auth[_0x35e5('0x9')](),controller['show']);router[_0x35e5('0xb')]('/',auth[_0x35e5('0x9')](),controller[_0x35e5('0xc')]);router[_0x35e5('0xd')](_0x35e5('0xe'),auth['isAuthenticated'](),controller[_0x35e5('0xf')]);router[_0x35e5('0x10')](_0x35e5('0xe'),auth[_0x35e5('0x9')](),controller['destroy']);module[_0x35e5('0x11')]=router; \ No newline at end of file +var _0xef06=['delete','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','update'];(function(_0x59d7d7,_0x474560){var _0x547d2c=function(_0x558bbe){while(--_0x558bbe){_0x59d7d7['push'](_0x59d7d7['shift']());}};_0x547d2c(++_0x474560);}(_0xef06,0x89));var _0x6ef0=function(_0x31dde9,_0x12e816){_0x31dde9=_0x31dde9-0x0;var _0x1fbf2d=_0xef06[_0x31dde9];return _0x1fbf2d;};'use strict';var multer=require('multer');var util=require(_0x6ef0('0x0'));var path=require(_0x6ef0('0x1'));var timeout=require(_0x6ef0('0x2'));var express=require(_0x6ef0('0x3'));var router=express[_0x6ef0('0x4')]();var fs_extra=require(_0x6ef0('0x5'));var auth=require(_0x6ef0('0x6'));var interaction=require(_0x6ef0('0x7'));var config=require(_0x6ef0('0x8'));var controller=require('./intZendeskField.controller');router[_0x6ef0('0x9')]('/',auth[_0x6ef0('0xa')](),controller['index']);router[_0x6ef0('0x9')](_0x6ef0('0xb'),auth[_0x6ef0('0xa')](),controller[_0x6ef0('0xc')]);router[_0x6ef0('0xd')]('/',auth[_0x6ef0('0xa')](),controller[_0x6ef0('0xe')]);router['put'](_0x6ef0('0xb'),auth[_0x6ef0('0xa')](),controller[_0x6ef0('0xf')]);router[_0x6ef0('0x10')](_0x6ef0('0xb'),auth[_0x6ef0('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 5e86570..d21facc 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 _0xb5a5=['customVariable','keyValue','picklist','STRING','BOOLEAN','exports','ENUM','string','variable'];(function(_0x4af108,_0x3c29d5){var _0x2e7ea1=function(_0x4ddd10){while(--_0x4ddd10){_0x4af108['push'](_0x4af108['shift']());}};_0x2e7ea1(++_0x3c29d5);}(_0xb5a5,0x125));var _0x5b5a=function(_0x54aef5,_0x55600f){_0x54aef5=_0x54aef5-0x0;var _0x50cf31=_0xb5a5[_0x54aef5];return _0x50cf31;};'use strict';var Sequelize=require('sequelize');module[_0x5b5a('0x0')]={'type':{'type':Sequelize[_0x5b5a('0x1')](_0x5b5a('0x2'),_0x5b5a('0x3'),_0x5b5a('0x4'),_0x5b5a('0x5'),_0x5b5a('0x6')),'defaultValue':_0x5b5a('0x2')},'content':{'type':Sequelize[_0x5b5a('0x7')]},'key':{'type':Sequelize[_0x5b5a('0x7')]},'keyType':{'type':Sequelize['ENUM']('string',_0x5b5a('0x3'),_0x5b5a('0x4'))},'keyContent':{'type':Sequelize[_0x5b5a('0x7')]},'idField':{'type':Sequelize[_0x5b5a('0x7')]},'nameField':{'type':Sequelize[_0x5b5a('0x7')]},'customField':{'type':Sequelize[_0x5b5a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xaca3=['string','variable','customVariable','keyValue','STRING','ENUM','BOOLEAN','sequelize'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xaca3,0x117));var _0x3aca=function(_0x49adbd,_0x3513c9){_0x49adbd=_0x49adbd-0x0;var _0x591bb7=_0xaca3[_0x49adbd];return _0x591bb7;};'use strict';var Sequelize=require(_0x3aca('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x3aca('0x1'),_0x3aca('0x2'),_0x3aca('0x3'),_0x3aca('0x4'),'picklist'),'defaultValue':_0x3aca('0x1')},'content':{'type':Sequelize[_0x3aca('0x5')]},'key':{'type':Sequelize[_0x3aca('0x5')]},'keyType':{'type':Sequelize[_0x3aca('0x6')](_0x3aca('0x1'),_0x3aca('0x2'),_0x3aca('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x3aca('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x3aca('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3aca('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index d29a480..cce451e 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 _0xb74e=['where','filters','pick','filter','VIRTUAL','merge','options','ZendeskField','includeAll','include','findAll','catch','length','find','create','body','params','rimraf','zip-dir','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','keys','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','order','sort'];(function(_0x42c835,_0x11aed3){var _0x2e9638=function(_0x243a61){while(--_0x243a61){_0x42c835['push'](_0x42c835['shift']());}};_0x2e9638(++_0x11aed3);}(_0xb74e,0xe9));var _0xeb74=function(_0x1b0679,_0x44e7b2){_0x1b0679=_0x1b0679-0x0;var _0x5d6c3d=_0xb74e[_0x1b0679];return _0x5d6c3d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeb74('0x0'));var zipdir=require(_0xeb74('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xeb74('0x2'));var Mustache=require(_0xeb74('0x3'));var util=require(_0xeb74('0x4'));var path=require('path');var sox=require(_0xeb74('0x5'));var csv=require(_0xeb74('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeb74('0x7'));var _=require(_0xeb74('0x8'));var squel=require(_0xeb74('0x9'));var crypto=require(_0xeb74('0xa'));var jsforce=require(_0xeb74('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xeb74('0x6'));var querystring=require(_0xeb74('0xc'));var Papa=require(_0xeb74('0xd'));var Redis=require(_0xeb74('0xe'));var authService=require(_0xeb74('0xf'));var qs=require(_0xeb74('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeb74('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xeb74('0x12'));var config=require(_0xeb74('0x13'));var licenseUtil=require(_0xeb74('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e4650,_0x1da2b8){_0x1da2b8=_0x1da2b8||0xcc;return function(_0x30711c){if(_0x30711c){return _0x1e4650[_0xeb74('0x15')](_0x1da2b8);}return _0x1e4650[_0xeb74('0x16')](_0x1da2b8)[_0xeb74('0x17')]();};}function respondWithResult(_0x403d99,_0x5d88ca){_0x5d88ca=_0x5d88ca||0xc8;return function(_0x44cda0){if(_0x44cda0){return _0x403d99[_0xeb74('0x16')](_0x5d88ca)[_0xeb74('0x18')](_0x44cda0);}};}function respondWithFilteredResult(_0x504021,_0x134817){return function(_0x4f8212){if(_0x4f8212){var _0x30d5c1=typeof _0x134817[_0xeb74('0x19')]==='undefined'&&typeof _0x134817[_0xeb74('0x1a')]===_0xeb74('0x1b');var _0x30cf30=_0x4f8212[_0xeb74('0x1c')];var _0x34b468=_0x30d5c1?0x0:_0x134817[_0xeb74('0x19')];var _0x2e246c=_0x30d5c1?_0x4f8212[_0xeb74('0x1c')]:_0x134817[_0xeb74('0x19')]+_0x134817['limit'];var _0x48e505;if(_0x2e246c>=_0x30cf30){_0x2e246c=_0x30cf30;_0x48e505=0xc8;}else{_0x48e505=0xce;}_0x504021['status'](_0x48e505);return _0x504021['set'](_0xeb74('0x1d'),_0x34b468+'-'+_0x2e246c+'/'+_0x30cf30)[_0xeb74('0x18')](_0x4f8212);}return null;};}function patchUpdates(_0x1e7ab6){return function(_0x869f45){try{jsonpatch[_0xeb74('0x1e')](_0x869f45,_0x1e7ab6,!![]);}catch(_0x21cab1){return BPromise['reject'](_0x21cab1);}return _0x869f45[_0xeb74('0x1f')]();};}function saveUpdates(_0x30950a,_0x1db0de){return function(_0x53aa27){if(_0x53aa27){return _0x53aa27[_0xeb74('0x20')](_0x30950a)[_0xeb74('0x21')](function(_0x2399ea){return _0x2399ea;});}return null;};}function removeEntity(_0x6ae784,_0x77b207){return function(_0x3d4e1e){if(_0x3d4e1e){return _0x3d4e1e[_0xeb74('0x22')]()[_0xeb74('0x21')](function(){_0x6ae784[_0xeb74('0x16')](0xcc)[_0xeb74('0x17')]();});}};}function handleEntityNotFound(_0x14ee82,_0x21ff21){return function(_0x95855a){if(!_0x95855a){_0x14ee82[_0xeb74('0x15')](0x194);}return _0x95855a;};}function handleError(_0x54112a,_0x26d0e1){_0x26d0e1=_0x26d0e1||0x1f4;return function(_0x5baa7b){logger[_0xeb74('0x23')](_0x5baa7b[_0xeb74('0x24')]);if(_0x5baa7b[_0xeb74('0x25')]){delete _0x5baa7b[_0xeb74('0x25')];}_0x54112a[_0xeb74('0x16')](_0x26d0e1)[_0xeb74('0x26')](_0x5baa7b);};}exports[_0xeb74('0x27')]=function(_0x44478e,_0x3b3eb1){var _0x2c912e={},_0x2b1857={},_0x4cbb41={'count':0x0,'rows':[]};var _0x33e9d1=_[_0xeb74('0x28')](db['ZendeskField'][_0xeb74('0x29')],function(_0x5bf1a8){return{'name':_0x5bf1a8[_0xeb74('0x2a')],'type':_0x5bf1a8[_0xeb74('0x2b')][_0xeb74('0x2c')]};});_0x2b1857['model']=_[_0xeb74('0x28')](_0x33e9d1,_0xeb74('0x25'));_0x2b1857['query']=_[_0xeb74('0x2d')](_0x44478e['query']);_0x2b1857['filters']=_[_0xeb74('0x2e')](_0x2b1857[_0xeb74('0x2f')],_0x2b1857[_0xeb74('0x30')]);_0x2c912e[_0xeb74('0x31')]=_[_0xeb74('0x2e')](_0x2b1857['model'],qs[_0xeb74('0x32')](_0x44478e['query']['fields']));_0x2c912e[_0xeb74('0x31')]=_0x2c912e[_0xeb74('0x31')]['length']?_0x2c912e[_0xeb74('0x31')]:_0x2b1857[_0xeb74('0x2f')];if(!_0x44478e['query'][_0xeb74('0x33')](_0xeb74('0x34'))){_0x2c912e[_0xeb74('0x1a')]=qs[_0xeb74('0x1a')](_0x44478e[_0xeb74('0x30')]['limit']);_0x2c912e[_0xeb74('0x19')]=qs[_0xeb74('0x19')](_0x44478e['query'][_0xeb74('0x19')]);}_0x2c912e[_0xeb74('0x35')]=qs[_0xeb74('0x36')](_0x44478e['query'][_0xeb74('0x36')]);_0x2c912e[_0xeb74('0x37')]=qs[_0xeb74('0x38')](_[_0xeb74('0x39')](_0x44478e[_0xeb74('0x30')],_0x2b1857[_0xeb74('0x38')]),_0x33e9d1);if(_0x44478e[_0xeb74('0x30')][_0xeb74('0x3a')]){_0x2c912e[_0xeb74('0x37')]=_['merge'](_0x2c912e[_0xeb74('0x37')],{'$or':_[_0xeb74('0x28')](_0x33e9d1,function(_0x2f0efb){if(_0x2f0efb[_0xeb74('0x2b')]!==_0xeb74('0x3b')){var _0x428f61={};_0x428f61[_0x2f0efb['name']]={'$like':'%'+_0x44478e[_0xeb74('0x30')][_0xeb74('0x3a')]+'%'};return _0x428f61;}})});}_0x2c912e=_[_0xeb74('0x3c')]({},_0x2c912e,_0x44478e[_0xeb74('0x3d')]);var _0x24e595={'where':_0x2c912e[_0xeb74('0x37')]};return db[_0xeb74('0x3e')][_0xeb74('0x1c')](_0x24e595)[_0xeb74('0x21')](function(_0x14186f){_0x4cbb41[_0xeb74('0x1c')]=_0x14186f;if(_0x44478e['query'][_0xeb74('0x3f')]){_0x2c912e[_0xeb74('0x40')]=[{'all':!![]}];}return db[_0xeb74('0x3e')][_0xeb74('0x41')](_0x2c912e);})[_0xeb74('0x21')](function(_0x3c8479){_0x4cbb41['rows']=_0x3c8479;return _0x4cbb41;})['then'](respondWithFilteredResult(_0x3b3eb1,_0x2c912e))[_0xeb74('0x42')](handleError(_0x3b3eb1,null));};exports['show']=function(_0x272e1d,_0x3a83bc){var _0x5f1f61={'raw':!![],'where':{'id':_0x272e1d['params']['id']}},_0x53eb75={};_0x53eb75[_0xeb74('0x2f')]=_['keys'](db[_0xeb74('0x3e')]['rawAttributes']);_0x53eb75[_0xeb74('0x30')]=_[_0xeb74('0x2d')](_0x272e1d[_0xeb74('0x30')]);_0x53eb75['filters']=_[_0xeb74('0x2e')](_0x53eb75[_0xeb74('0x2f')],_0x53eb75[_0xeb74('0x30')]);_0x5f1f61[_0xeb74('0x31')]=_[_0xeb74('0x2e')](_0x53eb75[_0xeb74('0x2f')],qs[_0xeb74('0x32')](_0x272e1d[_0xeb74('0x30')][_0xeb74('0x32')]));_0x5f1f61[_0xeb74('0x31')]=_0x5f1f61[_0xeb74('0x31')][_0xeb74('0x43')]?_0x5f1f61[_0xeb74('0x31')]:_0x53eb75[_0xeb74('0x2f')];if(_0x272e1d[_0xeb74('0x30')][_0xeb74('0x3f')]){_0x5f1f61[_0xeb74('0x40')]=[{'all':!![]}];}_0x5f1f61=_[_0xeb74('0x3c')]({},_0x5f1f61,_0x272e1d[_0xeb74('0x3d')]);return db['ZendeskField'][_0xeb74('0x44')](_0x5f1f61)[_0xeb74('0x21')](handleEntityNotFound(_0x3a83bc,null))[_0xeb74('0x21')](respondWithResult(_0x3a83bc,null))[_0xeb74('0x42')](handleError(_0x3a83bc,null));};exports[_0xeb74('0x45')]=function(_0x552cc6,_0x43d1ea){return db[_0xeb74('0x3e')][_0xeb74('0x45')](_0x552cc6[_0xeb74('0x46')],{})['then'](respondWithResult(_0x43d1ea,0xc9))[_0xeb74('0x42')](handleError(_0x43d1ea,null));};exports[_0xeb74('0x20')]=function(_0xe1c0f3,_0x325686){if(_0xe1c0f3[_0xeb74('0x46')]['id']){delete _0xe1c0f3['body']['id'];}return db[_0xeb74('0x3e')][_0xeb74('0x44')]({'where':{'id':_0xe1c0f3[_0xeb74('0x47')]['id']}})[_0xeb74('0x21')](handleEntityNotFound(_0x325686,null))['then'](saveUpdates(_0xe1c0f3[_0xeb74('0x46')],null))[_0xeb74('0x21')](respondWithResult(_0x325686,null))['catch'](handleError(_0x325686,null));};exports[_0xeb74('0x22')]=function(_0x520a26,_0xb0d949){return db[_0xeb74('0x3e')][_0xeb74('0x44')]({'where':{'id':_0x520a26['params']['id']}})[_0xeb74('0x21')](handleEntityNotFound(_0xb0d949,null))[_0xeb74('0x21')](removeEntity(_0xb0d949,null))[_0xeb74('0x42')](handleError(_0xb0d949,null));}; \ No newline at end of file +var _0x20a9=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','save','update','then','destroy','stack','name','index','map','rawAttributes','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','merge','options','ZendeskField','findAll','show','params','keys','includeAll','include','find','create','body','catch','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service'];(function(_0x36bfe3,_0x358938){var _0x9b0436=function(_0x86e47d){while(--_0x86e47d){_0x36bfe3['push'](_0x36bfe3['shift']());}};_0x9b0436(++_0x358938);}(_0x20a9,0x113));var _0x920a=function(_0x21f3bf,_0xfb0f59){_0x21f3bf=_0x21f3bf-0x0;var _0x249d08=_0x20a9[_0x21f3bf];return _0x249d08;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x920a('0x0'));var jsonpatch=require(_0x920a('0x1'));var rp=require(_0x920a('0x2'));var moment=require(_0x920a('0x3'));var BPromise=require(_0x920a('0x4'));var Mustache=require(_0x920a('0x5'));var util=require(_0x920a('0x6'));var path=require(_0x920a('0x7'));var sox=require(_0x920a('0x8'));var csv=require(_0x920a('0x9'));var ejs=require(_0x920a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x920a('0xb'));var squel=require(_0x920a('0xc'));var crypto=require('crypto');var jsforce=require(_0x920a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x920a('0x9'));var querystring=require('querystring');var Papa=require(_0x920a('0xe'));var Redis=require(_0x920a('0xf'));var authService=require(_0x920a('0x10'));var qs=require(_0x920a('0x11'));var as=require(_0x920a('0x12'));var hardwareService=require(_0x920a('0x13'));var logger=require(_0x920a('0x14'))(_0x920a('0x15'));var utils=require(_0x920a('0x16'));var config=require(_0x920a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x920a('0x18'))['db'];function respondWithStatusCode(_0x3ce1aa,_0x2cf126){_0x2cf126=_0x2cf126||0xcc;return function(_0x2877a3){if(_0x2877a3){return _0x3ce1aa[_0x920a('0x19')](_0x2cf126);}return _0x3ce1aa[_0x920a('0x1a')](_0x2cf126)[_0x920a('0x1b')]();};}function respondWithResult(_0x179e7d,_0x27e099){_0x27e099=_0x27e099||0xc8;return function(_0x2513b1){if(_0x2513b1){return _0x179e7d[_0x920a('0x1a')](_0x27e099)[_0x920a('0x1c')](_0x2513b1);}};}function respondWithFilteredResult(_0x2bf252,_0x375e64){return function(_0x4c9198){if(_0x4c9198){var _0x5e5605=typeof _0x375e64[_0x920a('0x1d')]==='undefined'&&typeof _0x375e64[_0x920a('0x1e')]===_0x920a('0x1f');var _0x3871a7=_0x4c9198[_0x920a('0x20')];var _0x2349e5=_0x5e5605?0x0:_0x375e64[_0x920a('0x1d')];var _0x51c22e=_0x5e5605?_0x4c9198[_0x920a('0x20')]:_0x375e64[_0x920a('0x1d')]+_0x375e64[_0x920a('0x1e')];var _0x430eb6;if(_0x51c22e>=_0x3871a7){_0x51c22e=_0x3871a7;_0x430eb6=0xc8;}else{_0x430eb6=0xce;}_0x2bf252[_0x920a('0x1a')](_0x430eb6);return _0x2bf252['set'](_0x920a('0x21'),_0x2349e5+'-'+_0x51c22e+'/'+_0x3871a7)[_0x920a('0x1c')](_0x4c9198);}return null;};}function patchUpdates(_0x1c0c55){return function(_0x5319ea){try{jsonpatch['apply'](_0x5319ea,_0x1c0c55,!![]);}catch(_0x34d78f){return BPromise[_0x920a('0x22')](_0x34d78f);}return _0x5319ea[_0x920a('0x23')]();};}function saveUpdates(_0x3cd9f5,_0xf57c51){return function(_0x52532a){if(_0x52532a){return _0x52532a[_0x920a('0x24')](_0x3cd9f5)[_0x920a('0x25')](function(_0x2b97dc){return _0x2b97dc;});}return null;};}function removeEntity(_0x3a3254,_0x26462f){return function(_0x2fb14e){if(_0x2fb14e){return _0x2fb14e[_0x920a('0x26')]()[_0x920a('0x25')](function(){_0x3a3254['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x420637,_0x4d8852){return function(_0x36d050){if(!_0x36d050){_0x420637[_0x920a('0x19')](0x194);}return _0x36d050;};}function handleError(_0x5f0a39,_0x546606){_0x546606=_0x546606||0x1f4;return function(_0x45d0e1){logger['error'](_0x45d0e1[_0x920a('0x27')]);if(_0x45d0e1[_0x920a('0x28')]){delete _0x45d0e1[_0x920a('0x28')];}_0x5f0a39[_0x920a('0x1a')](_0x546606)['send'](_0x45d0e1);};}exports[_0x920a('0x29')]=function(_0x5d19fb,_0x158a7d){var _0x304c0b={},_0x1aeaba={},_0x357cda={'count':0x0,'rows':[]};var _0x2705c7=_[_0x920a('0x2a')](db['ZendeskField'][_0x920a('0x2b')],function(_0x37f5a3){return{'name':_0x37f5a3['fieldName'],'type':_0x37f5a3['type'][_0x920a('0x2c')]};});_0x1aeaba[_0x920a('0x2d')]=_[_0x920a('0x2a')](_0x2705c7,_0x920a('0x28'));_0x1aeaba[_0x920a('0x2e')]=_['keys'](_0x5d19fb[_0x920a('0x2e')]);_0x1aeaba[_0x920a('0x2f')]=_[_0x920a('0x30')](_0x1aeaba[_0x920a('0x2d')],_0x1aeaba['query']);_0x304c0b['attributes']=_['intersection'](_0x1aeaba[_0x920a('0x2d')],qs['fields'](_0x5d19fb[_0x920a('0x2e')][_0x920a('0x31')]));_0x304c0b[_0x920a('0x32')]=_0x304c0b['attributes'][_0x920a('0x33')]?_0x304c0b['attributes']:_0x1aeaba[_0x920a('0x2d')];if(!_0x5d19fb[_0x920a('0x2e')][_0x920a('0x34')]('nolimit')){_0x304c0b[_0x920a('0x1e')]=qs['limit'](_0x5d19fb['query'][_0x920a('0x1e')]);_0x304c0b[_0x920a('0x1d')]=qs[_0x920a('0x1d')](_0x5d19fb[_0x920a('0x2e')][_0x920a('0x1d')]);}_0x304c0b[_0x920a('0x35')]=qs[_0x920a('0x36')](_0x5d19fb['query'][_0x920a('0x36')]);_0x304c0b[_0x920a('0x37')]=qs[_0x920a('0x2f')](_[_0x920a('0x38')](_0x5d19fb[_0x920a('0x2e')],_0x1aeaba[_0x920a('0x2f')]),_0x2705c7);if(_0x5d19fb[_0x920a('0x2e')][_0x920a('0x39')]){_0x304c0b[_0x920a('0x37')]=_['merge'](_0x304c0b[_0x920a('0x37')],{'$or':_[_0x920a('0x2a')](_0x2705c7,function(_0xe2ae23){if(_0xe2ae23[_0x920a('0x3a')]!==_0x920a('0x3b')){var _0x5dd799={};_0x5dd799[_0xe2ae23['name']]={'$like':'%'+_0x5d19fb[_0x920a('0x2e')][_0x920a('0x39')]+'%'};return _0x5dd799;}})});}_0x304c0b=_[_0x920a('0x3c')]({},_0x304c0b,_0x5d19fb[_0x920a('0x3d')]);var _0xc92e28={'where':_0x304c0b[_0x920a('0x37')]};return db['ZendeskField'][_0x920a('0x20')](_0xc92e28)[_0x920a('0x25')](function(_0x566d12){_0x357cda[_0x920a('0x20')]=_0x566d12;if(_0x5d19fb['query']['includeAll']){_0x304c0b['include']=[{'all':!![]}];}return db[_0x920a('0x3e')][_0x920a('0x3f')](_0x304c0b);})['then'](function(_0x566f53){_0x357cda['rows']=_0x566f53;return _0x357cda;})[_0x920a('0x25')](respondWithFilteredResult(_0x158a7d,_0x304c0b))['catch'](handleError(_0x158a7d,null));};exports[_0x920a('0x40')]=function(_0x27d23f,_0x2c2705){var _0x1d296a={'raw':!![],'where':{'id':_0x27d23f[_0x920a('0x41')]['id']}},_0x2383c3={};_0x2383c3[_0x920a('0x2d')]=_[_0x920a('0x42')](db[_0x920a('0x3e')][_0x920a('0x2b')]);_0x2383c3[_0x920a('0x2e')]=_[_0x920a('0x42')](_0x27d23f['query']);_0x2383c3['filters']=_['intersection'](_0x2383c3['model'],_0x2383c3['query']);_0x1d296a[_0x920a('0x32')]=_[_0x920a('0x30')](_0x2383c3[_0x920a('0x2d')],qs[_0x920a('0x31')](_0x27d23f[_0x920a('0x2e')][_0x920a('0x31')]));_0x1d296a['attributes']=_0x1d296a[_0x920a('0x32')]['length']?_0x1d296a['attributes']:_0x2383c3[_0x920a('0x2d')];if(_0x27d23f[_0x920a('0x2e')][_0x920a('0x43')]){_0x1d296a[_0x920a('0x44')]=[{'all':!![]}];}_0x1d296a=_[_0x920a('0x3c')]({},_0x1d296a,_0x27d23f[_0x920a('0x3d')]);return db[_0x920a('0x3e')][_0x920a('0x45')](_0x1d296a)['then'](handleEntityNotFound(_0x2c2705,null))[_0x920a('0x25')](respondWithResult(_0x2c2705,null))['catch'](handleError(_0x2c2705,null));};exports[_0x920a('0x46')]=function(_0x2088fd,_0x2e42ee){return db[_0x920a('0x3e')][_0x920a('0x46')](_0x2088fd[_0x920a('0x47')],{})[_0x920a('0x25')](respondWithResult(_0x2e42ee,0xc9))[_0x920a('0x48')](handleError(_0x2e42ee,null));};exports[_0x920a('0x24')]=function(_0x43c6c3,_0x302390){if(_0x43c6c3[_0x920a('0x47')]['id']){delete _0x43c6c3['body']['id'];}return db['ZendeskField'][_0x920a('0x45')]({'where':{'id':_0x43c6c3['params']['id']}})[_0x920a('0x25')](handleEntityNotFound(_0x302390,null))['then'](saveUpdates(_0x43c6c3['body'],null))[_0x920a('0x25')](respondWithResult(_0x302390,null))[_0x920a('0x48')](handleError(_0x302390,null));};exports[_0x920a('0x26')]=function(_0x535bc0,_0x22fb90){return db[_0x920a('0x3e')][_0x920a('0x45')]({'where':{'id':_0x535bc0[_0x920a('0x41')]['id']}})[_0x920a('0x25')](handleEntityNotFound(_0x22fb90,null))[_0x920a('0x25')](removeEntity(_0x22fb90,null))[_0x920a('0x48')](handleError(_0x22fb90,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index d0ff87a..3640be3 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 _0x4d2e=['int_zendesk_fields','idField','util','api','moment','bluebird','request-promise','../../config/environment','./intZendeskField.attributes','define','ZendeskField'];(function(_0x219c8b,_0x4f7ba2){var _0x405093=function(_0x352495){while(--_0x352495){_0x219c8b['push'](_0x219c8b['shift']());}};_0x405093(++_0x4f7ba2);}(_0x4d2e,0x136));var _0xe4d2=function(_0x365900,_0x5d7fb5){_0x365900=_0x365900-0x0;var _0x9e23d3=_0x4d2e[_0x365900];return _0x9e23d3;};'use strict';var _=require('lodash');var util=require(_0xe4d2('0x0'));var logger=require('../../config/logger')(_0xe4d2('0x1'));var moment=require(_0xe4d2('0x2'));var BPromise=require(_0xe4d2('0x3'));var rp=require(_0xe4d2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe4d2('0x5'));var attributes=require(_0xe4d2('0x6'));module['exports']=function(_0x218ff2,_0xcdaef1){return _0x218ff2[_0xe4d2('0x7')](_0xe4d2('0x8'),attributes,{'tableName':_0xe4d2('0x9'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0xe4d2('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4dde=['../../config/environment','./intZendeskField.attributes','exports','define','int_zendesk_fields','zendesk_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x108ffa,_0x2f7bcd){var _0x2e4cf3=function(_0x3ea2a4){while(--_0x3ea2a4){_0x108ffa['push'](_0x108ffa['shift']());}};_0x2e4cf3(++_0x2f7bcd);}(_0x4dde,0xe8));var _0xe4dd=function(_0x6ddad1,_0x577c62){_0x6ddad1=_0x6ddad1-0x0;var _0x3564d4=_0x4dde[_0x6ddad1];return _0x3564d4;};'use strict';var _=require('lodash');var util=require(_0xe4dd('0x0'));var logger=require(_0xe4dd('0x1'))(_0xe4dd('0x2'));var moment=require(_0xe4dd('0x3'));var BPromise=require(_0xe4dd('0x4'));var rp=require(_0xe4dd('0x5'));var fs=require('fs');var path=require(_0xe4dd('0x6'));var rimraf=require(_0xe4dd('0x7'));var config=require(_0xe4dd('0x8'));var attributes=require(_0xe4dd('0x9'));module[_0xe4dd('0xa')]=function(_0x160841,_0x41c8a3){return _0x160841[_0xe4dd('0xb')]('ZendeskField',attributes,{'tableName':_0xe4dd('0xc'),'paranoid':![],'indexes':[{'name':_0xe4dd('0xd'),'fields':[_0xe4dd('0xe'),_0xe4dd('0xf')],'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 85ca989..e5d1e66 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 _0xfc6b=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','info','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ZendeskField,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x245855,_0x1506f0){var _0x3548bf=function(_0x9d4949){while(--_0x9d4949){_0x245855['push'](_0x245855['shift']());}};_0x3548bf(++_0x1506f0);}(_0xfc6b,0x14b));var _0xbfc6=function(_0x1a6fee,_0x2d6eaf){_0x1a6fee=_0x1a6fee-0x0;var _0x177943=_0xfc6b[_0x1a6fee];return _0x177943;};'use strict';var _=require(_0xbfc6('0x0'));var util=require(_0xbfc6('0x1'));var moment=require(_0xbfc6('0x2'));var BPromise=require(_0xbfc6('0x3'));var rs=require(_0xbfc6('0x4'));var fs=require('fs');var Redis=require(_0xbfc6('0x5'));var db=require(_0xbfc6('0x6'))['db'];var utils=require(_0xbfc6('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xbfc6('0x8'));var jayson=require(_0xbfc6('0x9'));var client=jayson[_0xbfc6('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x313958,_0x216eef,_0x5034bd){return new BPromise(function(_0x38fe04,_0x25cfaf){return client[_0xbfc6('0xb')](_0x313958,_0x5034bd)['then'](function(_0x22989c){logger[_0xbfc6('0xc')]('ZendeskField,\x20%s,\x20%s',_0x216eef,'request\x20sent');logger[_0xbfc6('0xd')](_0xbfc6('0xe'),_0x216eef,_0xbfc6('0xf'),JSON[_0xbfc6('0x10')](_0x22989c));if(_0x22989c[_0xbfc6('0x11')]){if(_0x22989c['error']['code']===0x1f4){logger['error'](_0xbfc6('0x12'),_0x216eef,_0x22989c[_0xbfc6('0x11')][_0xbfc6('0x13')]);return _0x25cfaf(_0x22989c[_0xbfc6('0x11')]['message']);}logger[_0xbfc6('0x11')](_0xbfc6('0x12'),_0x216eef,_0x22989c[_0xbfc6('0x11')]['message']);return _0x38fe04(_0x22989c[_0xbfc6('0x11')]['message']);}else{logger[_0xbfc6('0xc')]('ZendeskField,\x20%s,\x20%s',_0x216eef,_0xbfc6('0xf'));_0x38fe04(_0x22989c['result'][_0xbfc6('0x13')]);}})[_0xbfc6('0x14')](function(_0x40fb4a){logger[_0xbfc6('0x11')](_0xbfc6('0x12'),_0x216eef,_0x40fb4a);_0x25cfaf(_0x40fb4a);});});} \ No newline at end of file +var _0xef81=['../../config/utils','../../config/logger','../../config/environment','client','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x4d0472,_0x163cdb){var _0x283e7c=function(_0xf0bc68){while(--_0xf0bc68){_0x4d0472['push'](_0x4d0472['shift']());}};_0x283e7c(++_0x163cdb);}(_0xef81,0x162));var _0x1ef8=function(_0x1cadbd,_0x45700e){_0x1cadbd=_0x1cadbd-0x0;var _0x58a82f=_0xef81[_0x1cadbd];return _0x58a82f;};'use strict';var _=require(_0x1ef8('0x0'));var util=require(_0x1ef8('0x1'));var moment=require(_0x1ef8('0x2'));var BPromise=require(_0x1ef8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1ef8('0x4'));var db=require(_0x1ef8('0x5'))['db'];var utils=require(_0x1ef8('0x6'));var logger=require(_0x1ef8('0x7'))('rpc');var config=require(_0x1ef8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1ef8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b13e3,_0xe4682f,_0x76bb58){return new BPromise(function(_0x4132ff,_0x60c28){return client['request'](_0x4b13e3,_0x76bb58)[_0x1ef8('0xa')](function(_0x523c47){logger[_0x1ef8('0xb')](_0x1ef8('0xc'),_0xe4682f,_0x1ef8('0xd'));logger['debug'](_0x1ef8('0xe'),_0xe4682f,_0x1ef8('0xd'),JSON[_0x1ef8('0xf')](_0x523c47));if(_0x523c47[_0x1ef8('0x10')]){if(_0x523c47['error'][_0x1ef8('0x11')]===0x1f4){logger['error'](_0x1ef8('0xc'),_0xe4682f,_0x523c47['error']['message']);return _0x60c28(_0x523c47[_0x1ef8('0x10')]['message']);}logger['error'](_0x1ef8('0xc'),_0xe4682f,_0x523c47[_0x1ef8('0x10')][_0x1ef8('0x12')]);return _0x4132ff(_0x523c47['error'][_0x1ef8('0x12')]);}else{logger['info'](_0x1ef8('0xc'),_0xe4682f,_0x1ef8('0xd'));_0x4132ff(_0x523c47[_0x1ef8('0x13')]['message']);}})['catch'](function(_0x24e482){logger[_0x1ef8('0x10')](_0x1ef8('0xc'),_0xe4682f,_0x24e482);_0x60c28(_0x24e482);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index da01a91..ea4a657 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 _0xbdb9=['put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration'];(function(_0x3121f8,_0x125a1b){var _0x553d2c=function(_0x3b9634){while(--_0x3b9634){_0x3121f8['push'](_0x3121f8['shift']());}};_0x553d2c(++_0x125a1b);}(_0xbdb9,0xac));var _0x9bdb=function(_0x48c17a,_0x57489c){_0x48c17a=_0x48c17a-0x0;var _0x4a91bc=_0xbdb9[_0x48c17a];return _0x4a91bc;};'use strict';var multer=require(_0x9bdb('0x0'));var util=require(_0x9bdb('0x1'));var path=require(_0x9bdb('0x2'));var timeout=require(_0x9bdb('0x3'));var express=require(_0x9bdb('0x4'));var router=express['Router']();var fs_extra=require(_0x9bdb('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intZohoAccount.controller');router[_0x9bdb('0x6')]('/',auth['isAuthenticated'](),controller[_0x9bdb('0x7')]);router['get'](_0x9bdb('0x8'),auth[_0x9bdb('0x9')](),controller[_0x9bdb('0xa')]);router[_0x9bdb('0x6')](_0x9bdb('0xb'),auth[_0x9bdb('0x9')](),controller[_0x9bdb('0xc')]);router['get'](_0x9bdb('0xd'),auth[_0x9bdb('0x9')](),controller[_0x9bdb('0xe')]);router[_0x9bdb('0xf')]('/',auth[_0x9bdb('0x9')](),controller['create']);router['post'](_0x9bdb('0xb'),auth[_0x9bdb('0x9')](),controller[_0x9bdb('0x10')]);router[_0x9bdb('0x11')](_0x9bdb('0x8'),auth[_0x9bdb('0x9')](),controller['update']);router[_0x9bdb('0x12')](_0x9bdb('0x8'),auth[_0x9bdb('0x9')](),controller[_0x9bdb('0x13')]);module[_0x9bdb('0x14')]=router; \ No newline at end of file +var _0x0558=['post','create','addConfiguration','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoAccount.controller','get','index','isAuthenticated','/:id/configurations','/:id/fields','getFields'];(function(_0x11e05d,_0x3a4491){var _0x335588=function(_0x35ec3f){while(--_0x35ec3f){_0x11e05d['push'](_0x11e05d['shift']());}};_0x335588(++_0x3a4491);}(_0x0558,0x1a1));var _0x8055=function(_0x24618a,_0x2cd0f4){_0x24618a=_0x24618a-0x0;var _0x2e3d64=_0x0558[_0x24618a];return _0x2e3d64;};'use strict';var multer=require(_0x8055('0x0'));var util=require(_0x8055('0x1'));var path=require('path');var timeout=require(_0x8055('0x2'));var express=require(_0x8055('0x3'));var router=express[_0x8055('0x4')]();var fs_extra=require(_0x8055('0x5'));var auth=require(_0x8055('0x6'));var interaction=require(_0x8055('0x7'));var config=require('../../config/environment');var controller=require(_0x8055('0x8'));router[_0x8055('0x9')]('/',auth['isAuthenticated'](),controller[_0x8055('0xa')]);router['get']('/:id',auth[_0x8055('0xb')](),controller['show']);router[_0x8055('0x9')](_0x8055('0xc'),auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0x8055('0xd'),auth[_0x8055('0xb')](),controller[_0x8055('0xe')]);router[_0x8055('0xf')]('/',auth['isAuthenticated'](),controller[_0x8055('0x10')]);router[_0x8055('0xf')](_0x8055('0xc'),auth[_0x8055('0xb')](),controller[_0x8055('0x11')]);router[_0x8055('0x12')](_0x8055('0x13'),auth[_0x8055('0xb')](),controller[_0x8055('0x14')]);router[_0x8055('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x8055('0x16')]);module[_0x8055('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 579911d..4620df1 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 _0x4c4e=['sequelize','STRING'];(function(_0x4b737f,_0x88441f){var _0x880889=function(_0x53b64e){while(--_0x53b64e){_0x4b737f['push'](_0x4b737f['shift']());}};_0x880889(++_0x88441f);}(_0x4c4e,0x152));var _0xe4c4=function(_0x18a8c2,_0x164f72){_0x18a8c2=_0x18a8c2-0x0;var _0x5624c9=_0x4c4e[_0x18a8c2];return _0x5624c9;};'use strict';var Sequelize=require(_0xe4c4('0x0'));module['exports']={'name':{'type':Sequelize[_0xe4c4('0x1')]},'description':{'type':Sequelize[_0xe4c4('0x1')]},'host':{'type':Sequelize[_0xe4c4('0x1')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xe4c4('0x1')]},'clientSecret':{'type':Sequelize[_0xe4c4('0x1')]},'serverUrl':{'type':Sequelize[_0xe4c4('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0xe4c4('0x1')]}}; \ No newline at end of file +var _0xb903=['exports','STRING','sequelize'];(function(_0x3c35fe,_0x3d6f11){var _0x546e20=function(_0x1d5d56){while(--_0x1d5d56){_0x3c35fe['push'](_0x3c35fe['shift']());}};_0x546e20(++_0x3d6f11);}(_0xb903,0x185));var _0x3b90=function(_0x469d0b,_0x39370a){_0x469d0b=_0x469d0b-0x0;var _0x307fa3=_0xb903[_0x469d0b];return _0x307fa3;};'use strict';var Sequelize=require(_0x3b90('0x0'));module[_0x3b90('0x1')]={'name':{'type':Sequelize[_0x3b90('0x2')]},'description':{'type':Sequelize[_0x3b90('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x3b90('0x2')]},'clientId':{'type':Sequelize[_0x3b90('0x2')]},'clientSecret':{'type':Sequelize[_0x3b90('0x2')]},'serverUrl':{'type':Sequelize[_0x3b90('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x3b90('0x2')]},'refreshToken':{'type':Sequelize[_0x3b90('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index bf10509..6565336 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 _0xaacf=['offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','status','name','send','index','ZohoAccount','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','merge','map','VIRTUAL','options','includeAll','findAll','catch','show','include','find','create','body','params','getConfigurations','findOne','ZohoConfiguration','filter','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','getFields','host','code','com','serverUrl','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','Zoho-oauthtoken\x20','response','error','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','includes','api_name','push','display_label','custom_field','data_type','picklist','pick_list_values','test','stringify','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','json'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xaacf,0x1f0));var _0xfaac=function(_0x29bafc,_0x519f84){_0x29bafc=_0x29bafc-0x0;var _0x17d8fa=_0xaacf[_0x29bafc];return _0x17d8fa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfaac('0x0'));var zipdir=require(_0xfaac('0x1'));var jsonpatch=require(_0xfaac('0x2'));var rp=require('request-promise');var moment=require(_0xfaac('0x3'));var BPromise=require(_0xfaac('0x4'));var Mustache=require('mustache');var util=require(_0xfaac('0x5'));var path=require('path');var sox=require(_0xfaac('0x6'));var csv=require(_0xfaac('0x7'));var ejs=require(_0xfaac('0x8'));var fs=require('fs');var fs_extra=require(_0xfaac('0x9'));var _=require(_0xfaac('0xa'));var squel=require(_0xfaac('0xb'));var crypto=require(_0xfaac('0xc'));var jsforce=require(_0xfaac('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfaac('0x7'));var querystring=require(_0xfaac('0xe'));var Papa=require(_0xfaac('0xf'));var Redis=require(_0xfaac('0x10'));var authService=require(_0xfaac('0x11'));var qs=require(_0xfaac('0x12'));var as=require(_0xfaac('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfaac('0x14'));var utils=require('../../config/utils');var config=require(_0xfaac('0x15'));var licenseUtil=require(_0xfaac('0x16'));var db=require(_0xfaac('0x17'))['db'];var integrations=require(_0xfaac('0x18'));function respondWithStatusCode(_0xedbe1b,_0x697bfc){_0x697bfc=_0x697bfc||0xcc;return function(_0xb9fb71){if(_0xb9fb71){return _0xedbe1b[_0xfaac('0x19')](_0x697bfc);}return _0xedbe1b['status'](_0x697bfc)[_0xfaac('0x1a')]();};}function respondWithResult(_0x113bed,_0x2fd9ab){_0x2fd9ab=_0x2fd9ab||0xc8;return function(_0x258f54){if(_0x258f54){return _0x113bed['status'](_0x2fd9ab)[_0xfaac('0x1b')](_0x258f54);}};}function respondWithFilteredResult(_0x3fef7e,_0x24e121){return function(_0x2f0e79){if(_0x2f0e79){var _0x508759=typeof _0x24e121[_0xfaac('0x1c')]===_0xfaac('0x1d')&&typeof _0x24e121[_0xfaac('0x1e')]===_0xfaac('0x1d');var _0x3b05a7=_0x2f0e79[_0xfaac('0x1f')];var _0x50be82=_0x508759?0x0:_0x24e121['offset'];var _0x49761f=_0x508759?_0x2f0e79[_0xfaac('0x1f')]:_0x24e121[_0xfaac('0x1c')]+_0x24e121[_0xfaac('0x1e')];var _0x33b51e;if(_0x49761f>=_0x3b05a7){_0x49761f=_0x3b05a7;_0x33b51e=0xc8;}else{_0x33b51e=0xce;}_0x3fef7e['status'](_0x33b51e);return _0x3fef7e[_0xfaac('0x20')](_0xfaac('0x21'),_0x50be82+'-'+_0x49761f+'/'+_0x3b05a7)[_0xfaac('0x1b')](_0x2f0e79);}return null;};}function patchUpdates(_0x313996){return function(_0x3be2bd){try{jsonpatch[_0xfaac('0x22')](_0x3be2bd,_0x313996,!![]);}catch(_0x3c2898){return BPromise['reject'](_0x3c2898);}return _0x3be2bd[_0xfaac('0x23')]();};}function saveUpdates(_0x32982d,_0x287eef){return function(_0x3c9195){if(_0x3c9195){return _0x3c9195[_0xfaac('0x24')](_0x32982d)[_0xfaac('0x25')](function(_0x5a081c){return _0x5a081c;});}return null;};}function removeEntity(_0x1c96d7,_0x9ae790){return function(_0x1d6350){if(_0x1d6350){return _0x1d6350[_0xfaac('0x26')]()['then'](function(){_0x1c96d7[_0xfaac('0x27')](0xcc)[_0xfaac('0x1a')]();});}};}function handleEntityNotFound(_0x3fbff1,_0x49448d){return function(_0x365b9e){if(!_0x365b9e){_0x3fbff1['sendStatus'](0x194);}return _0x365b9e;};}function handleError(_0x407434,_0x291f92){_0x291f92=_0x291f92||0x1f4;return function(_0x13af40){logger['error'](_0x13af40['stack']);if(_0x13af40[_0xfaac('0x28')]){delete _0x13af40['name'];}_0x407434[_0xfaac('0x27')](_0x291f92)[_0xfaac('0x29')](_0x13af40);};}exports[_0xfaac('0x2a')]=function(_0xc72396,_0x245106){var _0x5d84b3={},_0x167f2b={},_0x40c23c={'count':0x0,'rows':[]};var _0x2d96b9=_['map'](db[_0xfaac('0x2b')][_0xfaac('0x2c')],function(_0x40024e){return{'name':_0x40024e[_0xfaac('0x2d')],'type':_0x40024e[_0xfaac('0x2e')]['key']};});_0x167f2b['model']=_['map'](_0x2d96b9,_0xfaac('0x28'));_0x167f2b['query']=_[_0xfaac('0x2f')](_0xc72396[_0xfaac('0x30')]);_0x167f2b[_0xfaac('0x31')]=_[_0xfaac('0x32')](_0x167f2b[_0xfaac('0x33')],_0x167f2b['query']);_0x5d84b3[_0xfaac('0x34')]=_[_0xfaac('0x32')](_0x167f2b[_0xfaac('0x33')],qs[_0xfaac('0x35')](_0xc72396[_0xfaac('0x30')][_0xfaac('0x35')]));_0x5d84b3['attributes']=_0x5d84b3[_0xfaac('0x34')][_0xfaac('0x36')]?_0x5d84b3[_0xfaac('0x34')]:_0x167f2b[_0xfaac('0x33')];if(!_0xc72396[_0xfaac('0x30')]['hasOwnProperty'](_0xfaac('0x37'))){_0x5d84b3[_0xfaac('0x1e')]=qs[_0xfaac('0x1e')](_0xc72396[_0xfaac('0x30')][_0xfaac('0x1e')]);_0x5d84b3[_0xfaac('0x1c')]=qs[_0xfaac('0x1c')](_0xc72396[_0xfaac('0x30')][_0xfaac('0x1c')]);}_0x5d84b3[_0xfaac('0x38')]=qs['sort'](_0xc72396[_0xfaac('0x30')][_0xfaac('0x39')]);_0x5d84b3[_0xfaac('0x3a')]=qs[_0xfaac('0x31')](_[_0xfaac('0x3b')](_0xc72396[_0xfaac('0x30')],_0x167f2b['filters']),_0x2d96b9);if(_0xc72396['query']['filter']){_0x5d84b3[_0xfaac('0x3a')]=_[_0xfaac('0x3c')](_0x5d84b3[_0xfaac('0x3a')],{'$or':_[_0xfaac('0x3d')](_0x2d96b9,function(_0x5a3c7a){if(_0x5a3c7a[_0xfaac('0x2e')]!==_0xfaac('0x3e')){var _0x53c64b={};_0x53c64b[_0x5a3c7a[_0xfaac('0x28')]]={'$like':'%'+_0xc72396[_0xfaac('0x30')]['filter']+'%'};return _0x53c64b;}})});}_0x5d84b3=_[_0xfaac('0x3c')]({},_0x5d84b3,_0xc72396[_0xfaac('0x3f')]);var _0x4229cf={'where':_0x5d84b3[_0xfaac('0x3a')]};return db[_0xfaac('0x2b')]['count'](_0x4229cf)[_0xfaac('0x25')](function(_0x56e35f){_0x40c23c['count']=_0x56e35f;if(_0xc72396[_0xfaac('0x30')][_0xfaac('0x40')]){_0x5d84b3['include']=[{'all':!![]}];}return db['ZohoAccount'][_0xfaac('0x41')](_0x5d84b3);})['then'](function(_0x45ee75){_0x40c23c['rows']=_0x45ee75;return _0x40c23c;})[_0xfaac('0x25')](respondWithFilteredResult(_0x245106,_0x5d84b3))[_0xfaac('0x42')](handleError(_0x245106,null));};exports[_0xfaac('0x43')]=function(_0x198694,_0x561098){var _0x5a14d1={'raw':![],'where':{'id':_0x198694['params']['id']}},_0x177eab={};_0x177eab['model']=_[_0xfaac('0x2f')](db[_0xfaac('0x2b')][_0xfaac('0x2c')]);_0x177eab['query']=_[_0xfaac('0x2f')](_0x198694[_0xfaac('0x30')]);_0x177eab[_0xfaac('0x31')]=_[_0xfaac('0x32')](_0x177eab[_0xfaac('0x33')],_0x177eab['query']);_0x5a14d1['attributes']=_['intersection'](_0x177eab[_0xfaac('0x33')],qs[_0xfaac('0x35')](_0x198694[_0xfaac('0x30')][_0xfaac('0x35')]));_0x5a14d1['attributes']=_0x5a14d1['attributes'][_0xfaac('0x36')]?_0x5a14d1[_0xfaac('0x34')]:_0x177eab[_0xfaac('0x33')];if(_0x198694[_0xfaac('0x30')][_0xfaac('0x40')]){_0x5a14d1[_0xfaac('0x44')]=[{'all':!![]}];}_0x5a14d1=_[_0xfaac('0x3c')]({},_0x5a14d1,_0x198694[_0xfaac('0x3f')]);return db[_0xfaac('0x2b')][_0xfaac('0x45')](_0x5a14d1)['then'](handleEntityNotFound(_0x561098,null))['then'](respondWithResult(_0x561098,null))[_0xfaac('0x42')](handleError(_0x561098,null));};exports['create']=function(_0x5a3d99,_0x40e9b9){return db['ZohoAccount'][_0xfaac('0x46')](_0x5a3d99[_0xfaac('0x47')],{})[_0xfaac('0x25')](respondWithResult(_0x40e9b9,0xc9))[_0xfaac('0x42')](handleError(_0x40e9b9,null));};exports[_0xfaac('0x24')]=function(_0x32c651,_0x41c071){if(_0x32c651[_0xfaac('0x47')]['id']){delete _0x32c651['body']['id'];}return db[_0xfaac('0x2b')][_0xfaac('0x45')]({'where':{'id':_0x32c651[_0xfaac('0x48')]['id']}})[_0xfaac('0x25')](handleEntityNotFound(_0x41c071,null))[_0xfaac('0x25')](saveUpdates(_0x32c651['body'],null))[_0xfaac('0x25')](respondWithResult(_0x41c071,null))['catch'](handleError(_0x41c071,null));};exports[_0xfaac('0x26')]=function(_0x27d645,_0x5359a0){return db[_0xfaac('0x2b')][_0xfaac('0x45')]({'where':{'id':_0x27d645['params']['id']}})[_0xfaac('0x25')](handleEntityNotFound(_0x5359a0,null))[_0xfaac('0x25')](removeEntity(_0x5359a0,null))[_0xfaac('0x42')](handleError(_0x5359a0,null));};exports[_0xfaac('0x49')]=function(_0x4fe665,_0x300005,_0x7dce62){var _0x13e60c={};var _0x10b946={};var _0x3c6490;var _0x3c0bd5;return db[_0xfaac('0x2b')][_0xfaac('0x4a')]({'where':{'id':_0x4fe665[_0xfaac('0x48')]['id']}})[_0xfaac('0x25')](handleEntityNotFound(_0x300005,null))[_0xfaac('0x25')](function(_0x467125){if(_0x467125){_0x3c6490=_0x467125;_0x10b946[_0xfaac('0x33')]=_[_0xfaac('0x2f')](db[_0xfaac('0x4b')][_0xfaac('0x2c')]);_0x10b946[_0xfaac('0x30')]=_['keys'](_0x4fe665[_0xfaac('0x30')]);_0x10b946[_0xfaac('0x31')]=_[_0xfaac('0x32')](_0x10b946[_0xfaac('0x33')],_0x10b946[_0xfaac('0x30')]);_0x13e60c['attributes']=_['intersection'](_0x10b946['model'],qs[_0xfaac('0x35')](_0x4fe665[_0xfaac('0x30')][_0xfaac('0x35')]));_0x13e60c['attributes']=_0x13e60c['attributes'][_0xfaac('0x36')]?_0x13e60c[_0xfaac('0x34')]:_0x10b946[_0xfaac('0x33')];_0x13e60c[_0xfaac('0x38')]=qs[_0xfaac('0x39')](_0x4fe665[_0xfaac('0x30')][_0xfaac('0x39')]);_0x13e60c[_0xfaac('0x3a')]=qs[_0xfaac('0x31')](_[_0xfaac('0x3b')](_0x4fe665['query'],_0x10b946[_0xfaac('0x31')]));if(_0x4fe665['query']['filter']){_0x13e60c[_0xfaac('0x3a')]=_[_0xfaac('0x3c')](_0x13e60c[_0xfaac('0x3a')],{'$or':_[_0xfaac('0x3d')](_0x13e60c[_0xfaac('0x34')],function(_0x4c6f67){var _0xc957ed={};_0xc957ed[_0x4c6f67]={'$like':'%'+_0x4fe665[_0xfaac('0x30')][_0xfaac('0x4c')]+'%'};return _0xc957ed;})});}_0x13e60c=_[_0xfaac('0x3c')]({},_0x13e60c,_0x4fe665[_0xfaac('0x3f')]);return _0x3c6490[_0xfaac('0x49')](_0x13e60c);}})[_0xfaac('0x25')](function(_0x23407c){if(_0x23407c){_0x3c0bd5=_0x23407c[_0xfaac('0x36')];if(!_0x4fe665[_0xfaac('0x30')][_0xfaac('0x4d')](_0xfaac('0x37'))){_0x13e60c['limit']=qs['limit'](_0x4fe665[_0xfaac('0x30')][_0xfaac('0x1e')]);_0x13e60c['offset']=qs[_0xfaac('0x1c')](_0x4fe665[_0xfaac('0x30')][_0xfaac('0x1c')]);}return _0x3c6490[_0xfaac('0x49')](_0x13e60c);}})[_0xfaac('0x25')](function(_0x3991ba){if(_0x3991ba){return _0x3991ba?{'count':_0x3c0bd5,'rows':_0x3991ba}:null;}})['then'](respondWithResult(_0x300005,null))[_0xfaac('0x42')](handleError(_0x300005,null));};exports[_0xfaac('0x4e')]=function(_0x2922cd,_0x7ae79a,_0x4374d3){if(_0x2922cd['body']['id']){delete _0x2922cd['body']['id'];}return db[_0xfaac('0x2b')][_0xfaac('0x4a')]({'where':{'id':_0x2922cd['params']['id']}})[_0xfaac('0x25')](handleEntityNotFound(_0x7ae79a,null))[_0xfaac('0x25')](function(_0x224109){if(_0x224109){_0x2922cd[_0xfaac('0x47')][_0xfaac('0x4f')]=_0x224109['id'];_0x2922cd['body'][_0xfaac('0x50')]=integrations[_0xfaac('0x51')](_0x2922cd[_0xfaac('0x47')][_0xfaac('0x52')],_0x2922cd[_0xfaac('0x47')][_0xfaac('0x2e')]);_0x2922cd[_0xfaac('0x47')][_0xfaac('0x53')]=integrations[_0xfaac('0x54')](_0x2922cd[_0xfaac('0x47')][_0xfaac('0x52')],_0x2922cd['body'][_0xfaac('0x2e')]);return db[_0xfaac('0x4b')][_0xfaac('0x46')](_0x2922cd['body'],{'include':[{'model':db[_0xfaac('0x55')],'as':_0xfaac('0x50')},{'model':db['ZohoField'],'as':_0xfaac('0x53')}]});}return null;})[_0xfaac('0x25')](respondWithResult(_0x7ae79a,null))['catch'](handleError(_0x7ae79a,null));};function getAccessToken(_0x5cbcb0){return new Promise(function(_0x626ba2,_0x727342){var _0x8633e;switch(_0x5cbcb0[_0xfaac('0x56')]){case'US':_0x8633e=_0xfaac('0x57');break;case'AU':_0x8633e=_0xfaac('0x58');break;case'EU':_0x8633e='https://accounts.zoho.eu';break;case'IN':_0x8633e=_0xfaac('0x59');break;case'CN':_0x8633e='https://accounts.zoho.com.cn';break;default:_0x8633e=_0xfaac('0x5a');break;}var _0x1b0061={'method':'POST','uri':_0x8633e+_0xfaac('0x5b'),'qs':{'refresh_token':_0x5cbcb0[_0xfaac('0x5c')],'client_id':_0x5cbcb0[_0xfaac('0x5d')],'client_secret':_0x5cbcb0[_0xfaac('0x5e')],'grant_type':_0xfaac('0x5f')},'json':!![]};return rp(_0x1b0061)[_0xfaac('0x25')](function(_0x4b8807){if(_0x4b8807[_0xfaac('0x60')]){_0x626ba2(_0x4b8807[_0xfaac('0x60')]);}else{_0x727342('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})['catch'](function(_0x2ff9b0){_0x727342(_0x2ff9b0);});});}exports[_0xfaac('0x61')]=function(_0x1ce876,_0x2b0132,_0x545518){var _0x1f22bc,_0x50a752,_0x28df8d,_0x4ca90e,_0xc9ebe9;return db[_0xfaac('0x2b')][_0xfaac('0x4a')]({'where':{'id':_0x1ce876[_0xfaac('0x48')]['id']},'attributes':['id',_0xfaac('0x62'),_0xfaac('0x56'),_0xfaac('0x5d'),_0xfaac('0x5e'),'serverUrl',_0xfaac('0x63'),_0xfaac('0x5c')]})[_0xfaac('0x25')](handleEntityNotFound(_0x2b0132,null))[_0xfaac('0x25')](function(_0x12fb87){_0xc9ebe9=_0x12fb87;_0x1f22bc=_0xc9ebe9['host'];_0x50a752=_0x1f22bc==='zoho.eu'?'eu':_0xfaac('0x64');_0x28df8d=_0xc9ebe9[_0xfaac('0x65')];var _0x3af424=_0x28df8d[_0xfaac('0x66')](-0x1);if(_0x3af424==='/'||_0x3af424==='\x5c'||_0x3af424===':'){_0x28df8d=_0x28df8d[_0xfaac('0x67')](0x0,_0x28df8d[_0xfaac('0x68')](_0x3af424));}if(!_0xc9ebe9['refreshToken']){throw new Error(_0xfaac('0x69'));}return getAccessToken(_0xc9ebe9);})['then'](function(_0x3253d3){if(_0x3253d3){return rp({'method':_0xfaac('0x6a'),'uri':util[_0xfaac('0x6b')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x50a752),'qs':{'module':_0xfaac('0x6c')},'headers':{'Authorization':_0xfaac('0x6d')+_0x3253d3},'json':!![]});}})[_0xfaac('0x25')](function(_0x3def29){if(_0x3def29){if(_0x3def29[_0xfaac('0x6e')]&&_0x3def29[_0xfaac('0x6e')][_0xfaac('0x6f')]){throw new Error(_0x3def29[_0xfaac('0x6e')][_0xfaac('0x6f')][_0xfaac('0x70')]);}var _0x3b818e=[];var _0x257ec2=[];var _0x2e2d3a=[_0xfaac('0x71'),_0xfaac('0x72'),_0xfaac('0x73'),_0xfaac('0x74'),_0xfaac('0x75'),_0xfaac('0x76'),_0xfaac('0x77'),_0xfaac('0x78')];_0x257ec2=_['remove'](_0x3def29[_0xfaac('0x35')],function(_0x4c0690){return _0x2e2d3a[_0xfaac('0x79')](_0x4c0690[_0xfaac('0x7a')]);});for(var _0x4dc3cb=0x0;_0x4dc3cb<_0x257ec2[_0xfaac('0x36')];_0x4dc3cb++){if(_0x257ec2[_0x4dc3cb]['system_mandatory']===![]){_0x3b818e[_0xfaac('0x7b')]({'id':_0x257ec2[_0x4dc3cb]['id'],'name':_0x257ec2[_0x4dc3cb][_0xfaac('0x7c')],'custom':_0x257ec2[_0x4dc3cb][_0xfaac('0x7d')],'options':_0x257ec2[_0x4dc3cb][_0xfaac('0x7e')]===_0xfaac('0x7f')&&_0x257ec2[_0x4dc3cb][_0xfaac('0x80')][_0xfaac('0x36')]>-0x1?_[_0xfaac('0x3d')](_0x257ec2[_0x4dc3cb][_0xfaac('0x80')],function(_0x43ec1a){return{'name':_0x43ec1a,'value':_0x43ec1a};}):[]});}}return{'count':_0x3b818e[_0xfaac('0x36')],'rows':_0x3b818e};}else{return{'count':0x0,'rows':[]};}})[_0xfaac('0x25')](respondWithResult(_0x2b0132,null))[_0xfaac('0x42')](function(_0x2444ee){var _0x53890b=_0x1ce876[_0xfaac('0x30')][_0xfaac('0x81')]?0x1f4:_0x2444ee['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xfaac('0x61'),_0x53890b,JSON[_0xfaac('0x82')](_0x2444ee));delete _0x2444ee[_0xfaac('0x28')];if(_0x53890b===0x191){_0x53890b=0x190;}_0x2b0132[_0xfaac('0x27')](_0x53890b)[_0xfaac('0x29')](_0x1ce876[_0xfaac('0x30')][_0xfaac('0x81')]?{'message':'Wrong\x20credentials','statusCode':_0x2444ee['statusCode']}:_0x2444ee);});}; \ No newline at end of file +var _0xa5d9=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','json','offset','undefined','limit','count','status','set','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','ZohoAccount','includeAll','findAll','rows','catch','show','params','include','find','body','ZohoConfiguration','options','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','clientSecret','serverUrl','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','Zoho-oauthtoken\x20','response','error','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Type','remove','includes','api_name','system_mandatory','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','lodash','squel','crypto'];(function(_0x23078b,_0x2ba791){var _0x522681=function(_0x5ed5f1){while(--_0x5ed5f1){_0x23078b['push'](_0x23078b['shift']());}};_0x522681(++_0x2ba791);}(_0xa5d9,0xfe));var _0x9a5d=function(_0x181239,_0x455432){_0x181239=_0x181239-0x0;var _0x39775c=_0xa5d9[_0x181239];return _0x39775c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9a5d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9a5d('0x1'));var rp=require(_0x9a5d('0x2'));var moment=require(_0x9a5d('0x3'));var BPromise=require(_0x9a5d('0x4'));var Mustache=require(_0x9a5d('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x9a5d('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9a5d('0x7'));var squel=require(_0x9a5d('0x8'));var crypto=require(_0x9a5d('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x9a5d('0xa'));var toCsv=require('to-csv');var querystring=require(_0x9a5d('0xb'));var Papa=require(_0x9a5d('0xc'));var Redis=require(_0x9a5d('0xd'));var authService=require(_0x9a5d('0xe'));var qs=require(_0x9a5d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9a5d('0x10'));var logger=require('../../config/logger')(_0x9a5d('0x11'));var utils=require('../../config/utils');var config=require(_0x9a5d('0x12'));var licenseUtil=require(_0x9a5d('0x13'));var db=require(_0x9a5d('0x14'))['db'];var integrations=require(_0x9a5d('0x15'));function respondWithStatusCode(_0xdcf652,_0x5c606c){_0x5c606c=_0x5c606c||0xcc;return function(_0x380e71){if(_0x380e71){return _0xdcf652[_0x9a5d('0x16')](_0x5c606c);}return _0xdcf652['status'](_0x5c606c)['end']();};}function respondWithResult(_0x5b34c7,_0x5369de){_0x5369de=_0x5369de||0xc8;return function(_0x27c69b){if(_0x27c69b){return _0x5b34c7['status'](_0x5369de)[_0x9a5d('0x17')](_0x27c69b);}};}function respondWithFilteredResult(_0x2ea9bb,_0x1358f9){return function(_0x405c11){if(_0x405c11){var _0x54eb61=typeof _0x1358f9[_0x9a5d('0x18')]===_0x9a5d('0x19')&&typeof _0x1358f9[_0x9a5d('0x1a')]==='undefined';var _0x44cb12=_0x405c11[_0x9a5d('0x1b')];var _0x4ca36b=_0x54eb61?0x0:_0x1358f9[_0x9a5d('0x18')];var _0x1604cd=_0x54eb61?_0x405c11[_0x9a5d('0x1b')]:_0x1358f9['offset']+_0x1358f9[_0x9a5d('0x1a')];var _0x52801a;if(_0x1604cd>=_0x44cb12){_0x1604cd=_0x44cb12;_0x52801a=0xc8;}else{_0x52801a=0xce;}_0x2ea9bb[_0x9a5d('0x1c')](_0x52801a);return _0x2ea9bb[_0x9a5d('0x1d')]('Content-Range',_0x4ca36b+'-'+_0x1604cd+'/'+_0x44cb12)[_0x9a5d('0x17')](_0x405c11);}return null;};}function patchUpdates(_0x4dbb4e){return function(_0x6307b1){try{jsonpatch[_0x9a5d('0x1e')](_0x6307b1,_0x4dbb4e,!![]);}catch(_0x5759e9){return BPromise[_0x9a5d('0x1f')](_0x5759e9);}return _0x6307b1[_0x9a5d('0x20')]();};}function saveUpdates(_0x71579b,_0x40b625){return function(_0x2f7e53){if(_0x2f7e53){return _0x2f7e53[_0x9a5d('0x21')](_0x71579b)[_0x9a5d('0x22')](function(_0xa763ad){return _0xa763ad;});}return null;};}function removeEntity(_0x48b8bd,_0x29a99c){return function(_0x3a683f){if(_0x3a683f){return _0x3a683f[_0x9a5d('0x23')]()[_0x9a5d('0x22')](function(){_0x48b8bd[_0x9a5d('0x1c')](0xcc)[_0x9a5d('0x24')]();});}};}function handleEntityNotFound(_0xc3903,_0x533bfb){return function(_0x5037df){if(!_0x5037df){_0xc3903[_0x9a5d('0x16')](0x194);}return _0x5037df;};}function handleError(_0x877d50,_0x3a31fd){_0x3a31fd=_0x3a31fd||0x1f4;return function(_0x50a1ac){logger['error'](_0x50a1ac[_0x9a5d('0x25')]);if(_0x50a1ac[_0x9a5d('0x26')]){delete _0x50a1ac[_0x9a5d('0x26')];}_0x877d50['status'](_0x3a31fd)[_0x9a5d('0x27')](_0x50a1ac);};}exports[_0x9a5d('0x28')]=function(_0x5048b7,_0x354aa8){var _0x39523c={},_0x27c672={},_0x3b4787={'count':0x0,'rows':[]};var _0x10e428=_[_0x9a5d('0x29')](db['ZohoAccount'][_0x9a5d('0x2a')],function(_0x19a738){return{'name':_0x19a738[_0x9a5d('0x2b')],'type':_0x19a738[_0x9a5d('0x2c')][_0x9a5d('0x2d')]};});_0x27c672[_0x9a5d('0x2e')]=_[_0x9a5d('0x29')](_0x10e428,'name');_0x27c672[_0x9a5d('0x2f')]=_[_0x9a5d('0x30')](_0x5048b7[_0x9a5d('0x2f')]);_0x27c672[_0x9a5d('0x31')]=_[_0x9a5d('0x32')](_0x27c672[_0x9a5d('0x2e')],_0x27c672['query']);_0x39523c[_0x9a5d('0x33')]=_['intersection'](_0x27c672[_0x9a5d('0x2e')],qs[_0x9a5d('0x34')](_0x5048b7[_0x9a5d('0x2f')][_0x9a5d('0x34')]));_0x39523c[_0x9a5d('0x33')]=_0x39523c[_0x9a5d('0x33')][_0x9a5d('0x35')]?_0x39523c[_0x9a5d('0x33')]:_0x27c672[_0x9a5d('0x2e')];if(!_0x5048b7['query'][_0x9a5d('0x36')](_0x9a5d('0x37'))){_0x39523c[_0x9a5d('0x1a')]=qs[_0x9a5d('0x1a')](_0x5048b7[_0x9a5d('0x2f')][_0x9a5d('0x1a')]);_0x39523c[_0x9a5d('0x18')]=qs[_0x9a5d('0x18')](_0x5048b7[_0x9a5d('0x2f')]['offset']);}_0x39523c[_0x9a5d('0x38')]=qs[_0x9a5d('0x39')](_0x5048b7['query'][_0x9a5d('0x39')]);_0x39523c[_0x9a5d('0x3a')]=qs[_0x9a5d('0x31')](_[_0x9a5d('0x3b')](_0x5048b7[_0x9a5d('0x2f')],_0x27c672[_0x9a5d('0x31')]),_0x10e428);if(_0x5048b7[_0x9a5d('0x2f')][_0x9a5d('0x3c')]){_0x39523c[_0x9a5d('0x3a')]=_[_0x9a5d('0x3d')](_0x39523c[_0x9a5d('0x3a')],{'$or':_[_0x9a5d('0x29')](_0x10e428,function(_0x2a3721){if(_0x2a3721[_0x9a5d('0x2c')]!==_0x9a5d('0x3e')){var _0x44a3d5={};_0x44a3d5[_0x2a3721[_0x9a5d('0x26')]]={'$like':'%'+_0x5048b7[_0x9a5d('0x2f')][_0x9a5d('0x3c')]+'%'};return _0x44a3d5;}})});}_0x39523c=_[_0x9a5d('0x3d')]({},_0x39523c,_0x5048b7['options']);var _0x208d41={'where':_0x39523c[_0x9a5d('0x3a')]};return db[_0x9a5d('0x3f')][_0x9a5d('0x1b')](_0x208d41)[_0x9a5d('0x22')](function(_0x4c5417){_0x3b4787[_0x9a5d('0x1b')]=_0x4c5417;if(_0x5048b7[_0x9a5d('0x2f')][_0x9a5d('0x40')]){_0x39523c['include']=[{'all':!![]}];}return db[_0x9a5d('0x3f')][_0x9a5d('0x41')](_0x39523c);})[_0x9a5d('0x22')](function(_0x2ad00e){_0x3b4787[_0x9a5d('0x42')]=_0x2ad00e;return _0x3b4787;})[_0x9a5d('0x22')](respondWithFilteredResult(_0x354aa8,_0x39523c))[_0x9a5d('0x43')](handleError(_0x354aa8,null));};exports[_0x9a5d('0x44')]=function(_0x3f358a,_0x3e89d0){var _0x40caa9={'raw':![],'where':{'id':_0x3f358a[_0x9a5d('0x45')]['id']}},_0x4ece39={};_0x4ece39['model']=_[_0x9a5d('0x30')](db[_0x9a5d('0x3f')]['rawAttributes']);_0x4ece39[_0x9a5d('0x2f')]=_[_0x9a5d('0x30')](_0x3f358a[_0x9a5d('0x2f')]);_0x4ece39[_0x9a5d('0x31')]=_[_0x9a5d('0x32')](_0x4ece39[_0x9a5d('0x2e')],_0x4ece39[_0x9a5d('0x2f')]);_0x40caa9[_0x9a5d('0x33')]=_['intersection'](_0x4ece39[_0x9a5d('0x2e')],qs[_0x9a5d('0x34')](_0x3f358a[_0x9a5d('0x2f')][_0x9a5d('0x34')]));_0x40caa9[_0x9a5d('0x33')]=_0x40caa9['attributes'][_0x9a5d('0x35')]?_0x40caa9[_0x9a5d('0x33')]:_0x4ece39[_0x9a5d('0x2e')];if(_0x3f358a[_0x9a5d('0x2f')][_0x9a5d('0x40')]){_0x40caa9[_0x9a5d('0x46')]=[{'all':!![]}];}_0x40caa9=_[_0x9a5d('0x3d')]({},_0x40caa9,_0x3f358a['options']);return db[_0x9a5d('0x3f')][_0x9a5d('0x47')](_0x40caa9)[_0x9a5d('0x22')](handleEntityNotFound(_0x3e89d0,null))[_0x9a5d('0x22')](respondWithResult(_0x3e89d0,null))['catch'](handleError(_0x3e89d0,null));};exports['create']=function(_0x15650e,_0x53e9f1){return db[_0x9a5d('0x3f')]['create'](_0x15650e['body'],{})[_0x9a5d('0x22')](respondWithResult(_0x53e9f1,0xc9))[_0x9a5d('0x43')](handleError(_0x53e9f1,null));};exports[_0x9a5d('0x21')]=function(_0x9c661b,_0x2dc4a4){if(_0x9c661b[_0x9a5d('0x48')]['id']){delete _0x9c661b['body']['id'];}return db['ZohoAccount'][_0x9a5d('0x47')]({'where':{'id':_0x9c661b[_0x9a5d('0x45')]['id']}})[_0x9a5d('0x22')](handleEntityNotFound(_0x2dc4a4,null))[_0x9a5d('0x22')](saveUpdates(_0x9c661b[_0x9a5d('0x48')],null))[_0x9a5d('0x22')](respondWithResult(_0x2dc4a4,null))[_0x9a5d('0x43')](handleError(_0x2dc4a4,null));};exports['destroy']=function(_0x3b62a6,_0x37947b){return db[_0x9a5d('0x3f')][_0x9a5d('0x47')]({'where':{'id':_0x3b62a6[_0x9a5d('0x45')]['id']}})['then'](handleEntityNotFound(_0x37947b,null))[_0x9a5d('0x22')](removeEntity(_0x37947b,null))[_0x9a5d('0x43')](handleError(_0x37947b,null));};exports['getConfigurations']=function(_0x2d6a8b,_0x21e02f,_0x1c1ef0){var _0x246f8e={};var _0x15568d={};var _0x3ae993;var _0x52062c;return db[_0x9a5d('0x3f')]['findOne']({'where':{'id':_0x2d6a8b[_0x9a5d('0x45')]['id']}})[_0x9a5d('0x22')](handleEntityNotFound(_0x21e02f,null))[_0x9a5d('0x22')](function(_0x802dd1){if(_0x802dd1){_0x3ae993=_0x802dd1;_0x15568d['model']=_[_0x9a5d('0x30')](db[_0x9a5d('0x49')][_0x9a5d('0x2a')]);_0x15568d[_0x9a5d('0x2f')]=_[_0x9a5d('0x30')](_0x2d6a8b[_0x9a5d('0x2f')]);_0x15568d['filters']=_[_0x9a5d('0x32')](_0x15568d[_0x9a5d('0x2e')],_0x15568d['query']);_0x246f8e[_0x9a5d('0x33')]=_[_0x9a5d('0x32')](_0x15568d[_0x9a5d('0x2e')],qs[_0x9a5d('0x34')](_0x2d6a8b['query'][_0x9a5d('0x34')]));_0x246f8e[_0x9a5d('0x33')]=_0x246f8e[_0x9a5d('0x33')][_0x9a5d('0x35')]?_0x246f8e[_0x9a5d('0x33')]:_0x15568d[_0x9a5d('0x2e')];_0x246f8e['order']=qs[_0x9a5d('0x39')](_0x2d6a8b['query'][_0x9a5d('0x39')]);_0x246f8e[_0x9a5d('0x3a')]=qs['filters'](_[_0x9a5d('0x3b')](_0x2d6a8b[_0x9a5d('0x2f')],_0x15568d[_0x9a5d('0x31')]));if(_0x2d6a8b[_0x9a5d('0x2f')][_0x9a5d('0x3c')]){_0x246f8e[_0x9a5d('0x3a')]=_['merge'](_0x246f8e['where'],{'$or':_[_0x9a5d('0x29')](_0x246f8e[_0x9a5d('0x33')],function(_0x2dfa14){var _0x4b860d={};_0x4b860d[_0x2dfa14]={'$like':'%'+_0x2d6a8b[_0x9a5d('0x2f')][_0x9a5d('0x3c')]+'%'};return _0x4b860d;})});}_0x246f8e=_['merge']({},_0x246f8e,_0x2d6a8b[_0x9a5d('0x4a')]);return _0x3ae993[_0x9a5d('0x4b')](_0x246f8e);}})['then'](function(_0x46f02f){if(_0x46f02f){_0x52062c=_0x46f02f[_0x9a5d('0x35')];if(!_0x2d6a8b[_0x9a5d('0x2f')][_0x9a5d('0x36')](_0x9a5d('0x37'))){_0x246f8e[_0x9a5d('0x1a')]=qs[_0x9a5d('0x1a')](_0x2d6a8b[_0x9a5d('0x2f')][_0x9a5d('0x1a')]);_0x246f8e['offset']=qs[_0x9a5d('0x18')](_0x2d6a8b[_0x9a5d('0x2f')][_0x9a5d('0x18')]);}return _0x3ae993[_0x9a5d('0x4b')](_0x246f8e);}})['then'](function(_0x2a229b){if(_0x2a229b){return _0x2a229b?{'count':_0x52062c,'rows':_0x2a229b}:null;}})[_0x9a5d('0x22')](respondWithResult(_0x21e02f,null))[_0x9a5d('0x43')](handleError(_0x21e02f,null));};exports[_0x9a5d('0x4c')]=function(_0x433fed,_0x3404e5,_0xc778e3){if(_0x433fed[_0x9a5d('0x48')]['id']){delete _0x433fed['body']['id'];}return db[_0x9a5d('0x3f')][_0x9a5d('0x4d')]({'where':{'id':_0x433fed[_0x9a5d('0x45')]['id']}})[_0x9a5d('0x22')](handleEntityNotFound(_0x3404e5,null))[_0x9a5d('0x22')](function(_0x32261d){if(_0x32261d){_0x433fed[_0x9a5d('0x48')][_0x9a5d('0x4e')]=_0x32261d['id'];_0x433fed[_0x9a5d('0x48')][_0x9a5d('0x4f')]=integrations[_0x9a5d('0x50')](_0x433fed[_0x9a5d('0x48')][_0x9a5d('0x51')],_0x433fed[_0x9a5d('0x48')]['type']);_0x433fed['body'][_0x9a5d('0x52')]=integrations[_0x9a5d('0x53')](_0x433fed[_0x9a5d('0x48')]['channel'],_0x433fed['body'][_0x9a5d('0x2c')]);return db[_0x9a5d('0x49')]['create'](_0x433fed[_0x9a5d('0x48')],{'include':[{'model':db[_0x9a5d('0x54')],'as':_0x9a5d('0x4f')},{'model':db['ZohoField'],'as':_0x9a5d('0x52')}]});}return null;})[_0x9a5d('0x22')](respondWithResult(_0x3404e5,null))['catch'](handleError(_0x3404e5,null));};function getAccessToken(_0x3c9441){return new Promise(function(_0xeff2c1,_0x310d61){var _0x2e1938;switch(_0x3c9441[_0x9a5d('0x55')]){case'US':_0x2e1938=_0x9a5d('0x56');break;case'AU':_0x2e1938=_0x9a5d('0x57');break;case'EU':_0x2e1938='https://accounts.zoho.eu';break;case'IN':_0x2e1938=_0x9a5d('0x58');break;case'CN':_0x2e1938=_0x9a5d('0x59');break;default:_0x2e1938=_0x9a5d('0x5a');break;}var _0x3ba913={'method':_0x9a5d('0x5b'),'uri':_0x2e1938+_0x9a5d('0x5c'),'qs':{'refresh_token':_0x3c9441[_0x9a5d('0x5d')],'client_id':_0x3c9441[_0x9a5d('0x5e')],'client_secret':_0x3c9441['clientSecret'],'grant_type':_0x9a5d('0x5f')},'json':!![]};return rp(_0x3ba913)[_0x9a5d('0x22')](function(_0x1999c0){if(_0x1999c0[_0x9a5d('0x60')]){_0xeff2c1(_0x1999c0[_0x9a5d('0x60')]);}else{_0x310d61(_0x9a5d('0x61'));}})[_0x9a5d('0x43')](function(_0x5204aa){_0x310d61(_0x5204aa);});});}exports[_0x9a5d('0x62')]=function(_0x4e3376,_0x2c9fad,_0x34747c){var _0x178ed6,_0x2da6a6,_0x23b603,_0x39b28a,_0x5fab4d;return db['ZohoAccount']['findOne']({'where':{'id':_0x4e3376[_0x9a5d('0x45')]['id']},'attributes':['id','host',_0x9a5d('0x55'),_0x9a5d('0x5e'),_0x9a5d('0x63'),_0x9a5d('0x64'),'code',_0x9a5d('0x5d')]})[_0x9a5d('0x22')](handleEntityNotFound(_0x2c9fad,null))[_0x9a5d('0x22')](function(_0x528363){_0x5fab4d=_0x528363;_0x178ed6=_0x5fab4d['host'];_0x2da6a6=_0x178ed6===_0x9a5d('0x65')?'eu':_0x9a5d('0x66');_0x23b603=_0x5fab4d[_0x9a5d('0x64')];var _0x19722d=_0x23b603[_0x9a5d('0x67')](-0x1);if(_0x19722d==='/'||_0x19722d==='\x5c'||_0x19722d===':'){_0x23b603=_0x23b603[_0x9a5d('0x68')](0x0,_0x23b603[_0x9a5d('0x69')](_0x19722d));}if(!_0x5fab4d[_0x9a5d('0x5d')]){throw new Error(_0x9a5d('0x6a'));}return getAccessToken(_0x5fab4d);})[_0x9a5d('0x22')](function(_0x48bbcb){if(_0x48bbcb){return rp({'method':_0x9a5d('0x6b'),'uri':util[_0x9a5d('0x6c')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x2da6a6),'qs':{'module':_0x9a5d('0x6d')},'headers':{'Authorization':_0x9a5d('0x6e')+_0x48bbcb},'json':!![]});}})[_0x9a5d('0x22')](function(_0x39d0a4){if(_0x39d0a4){if(_0x39d0a4[_0x9a5d('0x6f')]&&_0x39d0a4[_0x9a5d('0x6f')][_0x9a5d('0x70')]){throw new Error(_0x39d0a4[_0x9a5d('0x6f')][_0x9a5d('0x70')]['message']);}var _0x2c25d0=[];var _0x5e2e9=[];var _0x50ff44=[_0x9a5d('0x71'),_0x9a5d('0x72'),_0x9a5d('0x73'),_0x9a5d('0x74'),_0x9a5d('0x75'),_0x9a5d('0x76'),'Call_Start_Time',_0x9a5d('0x77')];_0x5e2e9=_[_0x9a5d('0x78')](_0x39d0a4['fields'],function(_0x492d4a){return _0x50ff44[_0x9a5d('0x79')](_0x492d4a[_0x9a5d('0x7a')]);});for(var _0x2e3653=0x0;_0x2e3653<_0x5e2e9[_0x9a5d('0x35')];_0x2e3653++){if(_0x5e2e9[_0x2e3653][_0x9a5d('0x7b')]===![]){_0x2c25d0['push']({'id':_0x5e2e9[_0x2e3653]['id'],'name':_0x5e2e9[_0x2e3653]['display_label'],'custom':_0x5e2e9[_0x2e3653][_0x9a5d('0x7c')],'options':_0x5e2e9[_0x2e3653][_0x9a5d('0x7d')]===_0x9a5d('0x7e')&&_0x5e2e9[_0x2e3653][_0x9a5d('0x7f')][_0x9a5d('0x35')]>-0x1?_[_0x9a5d('0x29')](_0x5e2e9[_0x2e3653]['pick_list_values'],function(_0x6551a6){return{'name':_0x6551a6,'value':_0x6551a6};}):[]});}}return{'count':_0x2c25d0[_0x9a5d('0x35')],'rows':_0x2c25d0};}else{return{'count':0x0,'rows':[]};}})[_0x9a5d('0x22')](respondWithResult(_0x2c9fad,null))[_0x9a5d('0x43')](function(_0x3c9979){var _0xb4ec4=_0x4e3376[_0x9a5d('0x2f')][_0x9a5d('0x80')]?0x1f4:_0x3c9979[_0x9a5d('0x81')]||0x1f4;logger[_0x9a5d('0x70')](_0x9a5d('0x82'),_0x9a5d('0x62'),_0xb4ec4,JSON[_0x9a5d('0x83')](_0x3c9979));delete _0x3c9979['name'];if(_0xb4ec4===0x191){_0xb4ec4=0x190;}_0x2c9fad[_0x9a5d('0x1c')](_0xb4ec4)[_0x9a5d('0x27')](_0x4e3376[_0x9a5d('0x2f')][_0x9a5d('0x80')]?{'message':'Wrong\x20credentials','statusCode':_0x3c9979[_0x9a5d('0x81')]}:_0x3c9979);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 0ddeb6c..014b6c0 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 _0xf688=['ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','error','code','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','util','api','moment','request-promise','path','../../config/environment','../../components/integrations/configuration','exports','ZohoAccount','changed','zone','serverUrl','clientId','clientSecret','host','slice','substring','lastIndexOf','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','refresh_token','refreshToken','info','name','format'];(function(_0x4f321c,_0x27505a){var _0x27f506=function(_0x17d3c5){while(--_0x17d3c5){_0x4f321c['push'](_0x4f321c['shift']());}};_0x27f506(++_0x27505a);}(_0xf688,0x1b6));var _0x8f68=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf688[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8f68('0x0'));var util=require(_0x8f68('0x1'));var logger=require('../../config/logger')(_0x8f68('0x2'));var moment=require(_0x8f68('0x3'));var BPromise=require('bluebird');var rp=require(_0x8f68('0x4'));var fs=require('fs');var path=require(_0x8f68('0x5'));var rimraf=require('rimraf');var config=require(_0x8f68('0x6'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x8f68('0x7'));module[_0x8f68('0x8')]=function(_0x45c47b,_0x255a6e){return _0x45c47b['define'](_0x8f68('0x9'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3470a9,_0x1c399e,_0xe0b2e7){if(_0x3470a9[_0x8f68('0xa')](_0x8f68('0xb'))||_0x3470a9[_0x8f68('0xa')](_0x8f68('0xc'))||_0x3470a9[_0x8f68('0xa')](_0x8f68('0xd'))||_0x3470a9['changed'](_0x8f68('0xe'))||_0x3470a9[_0x8f68('0xa')]('code')||_0x3470a9[_0x8f68('0xa')](_0x8f68('0xf'))){var _0x37f262,_0x232bec;_0x37f262=_0x3470a9[_0x8f68('0xc')];var _0x14344a=_0x37f262[_0x8f68('0x10')](-0x1);if(_0x14344a==='/'||_0x14344a==='\x5c'||_0x14344a===':'){_0x37f262=_0x37f262[_0x8f68('0x11')](0x0,_0x37f262[_0x8f68('0x12')](_0x14344a));}switch(_0x3470a9[_0x8f68('0xb')]){case'US':_0x232bec='https://accounts.zoho.com';break;case'AU':_0x232bec='https://accounts.zoho.com.au';break;case'IN':_0x232bec=_0x8f68('0x13');break;case'CN':_0x232bec=_0x8f68('0x14');break;default:_0x232bec='https://accounts.zoho.eu';break;}var _0x23cb3e={'method':'POST','uri':_0x232bec+_0x8f68('0x15'),'form':{'grant_type':_0x8f68('0x16'),'client_id':_0x3470a9[_0x8f68('0xd')],'client_secret':_0x3470a9[_0x8f68('0xe')],'redirect_uri':_0x3470a9[_0x8f68('0xc')],'code':_0x3470a9['code']},'headers':{'Content-Type':_0x8f68('0x17')}};return rp(_0x23cb3e)[_0x8f68('0x18')](function(_0x4d7005){var _0x558927=JSON['parse'](_0x4d7005);if(_0x558927[_0x8f68('0x19')]){_0x3470a9[_0x8f68('0x1a')]=_0x558927['refresh_token'];logger[_0x8f68('0x1b')](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3470a9[_0x8f68('0x1c')],_0x3470a9['id']));}else{logger['error'](util[_0x8f68('0x1d')](_0x8f68('0x1e'),_0x3470a9[_0x8f68('0x1c')],_0x3470a9['id']),util[_0x8f68('0x1f')](_0x558927,{'showHidden':![],'depth':null}));}return _0xe0b2e7(null,_0x1c399e);})[_0x8f68('0x20')](function(_0x676ae6){logger[_0x8f68('0x21')](util[_0x8f68('0x1d')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3470a9['name'],_0x3470a9['id']),util[_0x8f68('0x1f')](parsedResult,{'showHidden':![],'depth':null}));return _0xe0b2e7(_0x676ae6);});}else{return _0xe0b2e7(null,_0x1c399e);}},'beforeUpdate':function(_0x61cbf0,_0x265c2c,_0x38cca0){if(_0x61cbf0[_0x8f68('0xa')](_0x8f68('0xb'))||_0x61cbf0[_0x8f68('0xa')](_0x8f68('0xc'))||_0x61cbf0[_0x8f68('0xa')](_0x8f68('0xd'))||_0x61cbf0[_0x8f68('0xa')](_0x8f68('0xe'))||_0x61cbf0[_0x8f68('0xa')](_0x8f68('0x22'))||_0x61cbf0[_0x8f68('0xa')](_0x8f68('0xf'))){var _0xb78e84,_0x1f8715;_0xb78e84=_0x61cbf0['serverUrl'];var _0x53c1f3=_0xb78e84[_0x8f68('0x10')](-0x1);if(_0x53c1f3==='/'||_0x53c1f3==='\x5c'||_0x53c1f3===':'){_0xb78e84=_0xb78e84[_0x8f68('0x11')](0x0,_0xb78e84[_0x8f68('0x12')](_0x53c1f3));}switch(_0x61cbf0[_0x8f68('0xb')]){case'US':_0x1f8715=_0x8f68('0x23');break;case'AU':_0x1f8715=_0x8f68('0x24');break;case'IN':_0x1f8715=_0x8f68('0x13');break;case'CN':_0x1f8715=_0x8f68('0x14');break;default:_0x1f8715=_0x8f68('0x25');break;}var _0x3a1c45={'method':'POST','uri':_0x1f8715+_0x8f68('0x15'),'form':{'grant_type':_0x8f68('0x16'),'client_id':_0x61cbf0[_0x8f68('0xd')],'client_secret':_0x61cbf0['clientSecret'],'redirect_uri':_0x61cbf0[_0x8f68('0xc')],'code':_0x61cbf0[_0x8f68('0x22')]},'headers':{'Content-Type':_0x8f68('0x17')}};return rp(_0x3a1c45)[_0x8f68('0x18')](function(_0x22ba68){var _0xaad476=JSON['parse'](_0x22ba68);if(_0xaad476['refresh_token']){_0x61cbf0['refreshToken']=_0xaad476[_0x8f68('0x19')];logger['info'](util['format'](_0x8f68('0x26'),_0x61cbf0[_0x8f68('0x1c')],_0x61cbf0['id']));}else{logger['error'](util[_0x8f68('0x1d')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x61cbf0[_0x8f68('0x1c')],_0x61cbf0['id']),util['inspect'](_0xaad476,{'showHidden':![],'depth':null}));}return _0x38cca0(null,_0x265c2c);})[_0x8f68('0x20')](function(_0x3548bf){logger['error'](util[_0x8f68('0x1d')](_0x8f68('0x1e'),_0x61cbf0[_0x8f68('0x1c')],_0x61cbf0['id']),util[_0x8f68('0x1f')](parsedResult,{'showHidden':![],'depth':null}));return _0x38cca0(_0x3548bf);});}else{return _0x38cca0(null,_0x265c2c);}}}});}; \ No newline at end of file +var _0xbadd=['zone','serverUrl','clientSecret','code','host','substring','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','clientId','application/x-www-form-urlencoded','then','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','slice','lastIndexOf','authorization_code','refreshToken','error','inspect','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','changed'];(function(_0x471961,_0x15cb1b){var _0xf08c7d=function(_0x54de51){while(--_0x54de51){_0x471961['push'](_0x471961['shift']());}};_0xf08c7d(++_0x15cb1b);}(_0xbadd,0xef));var _0xdbad=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0xbadd[_0x44946b];return _0x249bc4;};'use strict';var _=require(_0xdbad('0x0'));var util=require('util');var logger=require(_0xdbad('0x1'))('api');var moment=require(_0xdbad('0x2'));var BPromise=require(_0xdbad('0x3'));var rp=require(_0xdbad('0x4'));var fs=require('fs');var path=require(_0xdbad('0x5'));var rimraf=require('rimraf');var config=require(_0xdbad('0x6'));var attributes=require(_0xdbad('0x7'));var integrations=require(_0xdbad('0x8'));module[_0xdbad('0x9')]=function(_0x25cc0c,_0x7f4cf6){return _0x25cc0c[_0xdbad('0xa')](_0xdbad('0xb'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x57826f,_0x1a5857,_0x2fea84){if(_0x57826f[_0xdbad('0xc')](_0xdbad('0xd'))||_0x57826f[_0xdbad('0xc')](_0xdbad('0xe'))||_0x57826f['changed']('clientId')||_0x57826f[_0xdbad('0xc')](_0xdbad('0xf'))||_0x57826f[_0xdbad('0xc')](_0xdbad('0x10'))||_0x57826f[_0xdbad('0xc')](_0xdbad('0x11'))){var _0x17a0ad,_0x5947d7;_0x17a0ad=_0x57826f[_0xdbad('0xe')];var _0x4794a8=_0x17a0ad['slice'](-0x1);if(_0x4794a8==='/'||_0x4794a8==='\x5c'||_0x4794a8===':'){_0x17a0ad=_0x17a0ad[_0xdbad('0x12')](0x0,_0x17a0ad['lastIndexOf'](_0x4794a8));}switch(_0x57826f[_0xdbad('0xd')]){case'US':_0x5947d7=_0xdbad('0x13');break;case'AU':_0x5947d7=_0xdbad('0x14');break;case'IN':_0x5947d7=_0xdbad('0x15');break;case'CN':_0x5947d7=_0xdbad('0x16');break;default:_0x5947d7=_0xdbad('0x17');break;}var _0x31878c={'method':_0xdbad('0x18'),'uri':_0x5947d7+_0xdbad('0x19'),'form':{'grant_type':'authorization_code','client_id':_0x57826f[_0xdbad('0x1a')],'client_secret':_0x57826f['clientSecret'],'redirect_uri':_0x57826f[_0xdbad('0xe')],'code':_0x57826f['code']},'headers':{'Content-Type':_0xdbad('0x1b')}};return rp(_0x31878c)[_0xdbad('0x1c')](function(_0x237d15){var _0x4741df=JSON['parse'](_0x237d15);if(_0x4741df[_0xdbad('0x1d')]){_0x57826f['refreshToken']=_0x4741df[_0xdbad('0x1d')];logger[_0xdbad('0x1e')](util[_0xdbad('0x1f')](_0xdbad('0x20'),_0x57826f[_0xdbad('0x21')],_0x57826f['id']));}else{logger['error'](util[_0xdbad('0x1f')](_0xdbad('0x22'),_0x57826f[_0xdbad('0x21')],_0x57826f['id']),util['inspect'](_0x4741df,{'showHidden':![],'depth':null}));}return _0x2fea84(null,_0x1a5857);})[_0xdbad('0x23')](function(_0x2dd1d5){logger['error'](util[_0xdbad('0x1f')](_0xdbad('0x22'),_0x57826f[_0xdbad('0x21')],_0x57826f['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x2fea84(_0x2dd1d5);});}else{return _0x2fea84(null,_0x1a5857);}},'beforeUpdate':function(_0x1a5322,_0x2644c0,_0xbf8015){if(_0x1a5322['changed'](_0xdbad('0xd'))||_0x1a5322['changed'](_0xdbad('0xe'))||_0x1a5322[_0xdbad('0xc')](_0xdbad('0x1a'))||_0x1a5322['changed'](_0xdbad('0xf'))||_0x1a5322['changed'](_0xdbad('0x10'))||_0x1a5322[_0xdbad('0xc')](_0xdbad('0x11'))){var _0x3353a1,_0x4f2647;_0x3353a1=_0x1a5322[_0xdbad('0xe')];var _0x3e7ddb=_0x3353a1[_0xdbad('0x24')](-0x1);if(_0x3e7ddb==='/'||_0x3e7ddb==='\x5c'||_0x3e7ddb===':'){_0x3353a1=_0x3353a1[_0xdbad('0x12')](0x0,_0x3353a1[_0xdbad('0x25')](_0x3e7ddb));}switch(_0x1a5322[_0xdbad('0xd')]){case'US':_0x4f2647='https://accounts.zoho.com';break;case'AU':_0x4f2647=_0xdbad('0x14');break;case'IN':_0x4f2647=_0xdbad('0x15');break;case'CN':_0x4f2647=_0xdbad('0x16');break;default:_0x4f2647=_0xdbad('0x17');break;}var _0x5b7879={'method':'POST','uri':_0x4f2647+'/oauth/v2/token','form':{'grant_type':_0xdbad('0x26'),'client_id':_0x1a5322[_0xdbad('0x1a')],'client_secret':_0x1a5322['clientSecret'],'redirect_uri':_0x1a5322[_0xdbad('0xe')],'code':_0x1a5322['code']},'headers':{'Content-Type':_0xdbad('0x1b')}};return rp(_0x5b7879)[_0xdbad('0x1c')](function(_0x1b7d45){var _0x4b3c57=JSON['parse'](_0x1b7d45);if(_0x4b3c57[_0xdbad('0x1d')]){_0x1a5322[_0xdbad('0x27')]=_0x4b3c57['refresh_token'];logger[_0xdbad('0x1e')](util[_0xdbad('0x1f')](_0xdbad('0x20'),_0x1a5322['name'],_0x1a5322['id']));}else{logger[_0xdbad('0x28')](util['format'](_0xdbad('0x22'),_0x1a5322[_0xdbad('0x21')],_0x1a5322['id']),util[_0xdbad('0x29')](_0x4b3c57,{'showHidden':![],'depth':null}));}return _0xbf8015(null,_0x2644c0);})[_0xdbad('0x23')](function(_0x125405){logger['error'](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1a5322[_0xdbad('0x21')],_0x1a5322['id']),util[_0xdbad('0x29')](parsedResult,{'showHidden':![],'depth':null}));return _0xbf8015(_0x125405);});}else{return _0xbf8015(null,_0x2644c0);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 0c03edf..cfaef0c 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 _0x4910=['attributes','include','model','map','ShowZohoAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','result','catch','GetZohoAccount','ZohoAccount','findAll','raw','options','where'];(function(_0x118da4,_0x2e192e){var _0x40dfbb=function(_0x43b165){while(--_0x43b165){_0x118da4['push'](_0x118da4['shift']());}};_0x40dfbb(++_0x2e192e);}(_0x4910,0x1d9));var _0x0491=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x4910[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x0491('0x0'));var util=require(_0x0491('0x1'));var moment=require(_0x0491('0x2'));var BPromise=require('bluebird');var rs=require(_0x0491('0x3'));var fs=require('fs');var Redis=require(_0x0491('0x4'));var db=require(_0x0491('0x5'))['db'];var utils=require(_0x0491('0x6'));var logger=require(_0x0491('0x7'))('rpc');var config=require(_0x0491('0x8'));var jayson=require(_0x0491('0x9'));var client=jayson[_0x0491('0xa')][_0x0491('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x27e7d5,_0x4ba9e5,_0x3b7b10){return new BPromise(function(_0x29c0d0,_0xf50a53){return client[_0x0491('0xc')](_0x27e7d5,_0x3b7b10)[_0x0491('0xd')](function(_0x4822d5){logger[_0x0491('0xe')]('ZohoAccount,\x20%s,\x20%s',_0x4ba9e5,_0x0491('0xf'));logger[_0x0491('0x10')](_0x0491('0x11'),_0x4ba9e5,_0x0491('0xf'),JSON[_0x0491('0x12')](_0x4822d5));if(_0x4822d5[_0x0491('0x13')]){if(_0x4822d5[_0x0491('0x13')][_0x0491('0x14')]===0x1f4){logger[_0x0491('0x13')](_0x0491('0x15'),_0x4ba9e5,_0x4822d5['error'][_0x0491('0x16')]);return _0xf50a53(_0x4822d5['error'][_0x0491('0x16')]);}logger['error']('ZohoAccount,\x20%s,\x20%s',_0x4ba9e5,_0x4822d5[_0x0491('0x13')][_0x0491('0x16')]);return _0x29c0d0(_0x4822d5[_0x0491('0x13')][_0x0491('0x16')]);}else{logger[_0x0491('0xe')](_0x0491('0x15'),_0x4ba9e5,_0x0491('0xf'));_0x29c0d0(_0x4822d5[_0x0491('0x17')][_0x0491('0x16')]);}})[_0x0491('0x18')](function(_0x527415){logger[_0x0491('0x13')](_0x0491('0x15'),_0x4ba9e5,_0x527415);_0xf50a53(_0x527415);});});}exports[_0x0491('0x19')]=function(_0x31bc2c){var _0x3b536e=this;return new Promise(function(_0xc02328,_0x4ba009){return db[_0x0491('0x1a')][_0x0491('0x1b')]({'raw':_0x31bc2c['options']?_0x31bc2c['options'][_0x0491('0x1c')]===undefined?!![]:![]:!![],'where':_0x31bc2c['options']?_0x31bc2c[_0x0491('0x1d')][_0x0491('0x1e')]||null:null,'attributes':_0x31bc2c['options']?_0x31bc2c[_0x0491('0x1d')][_0x0491('0x1f')]||null:null,'limit':_0x31bc2c[_0x0491('0x1d')]?_0x31bc2c[_0x0491('0x1d')]['limit']||null:null,'include':_0x31bc2c[_0x0491('0x1d')]?_0x31bc2c[_0x0491('0x1d')][_0x0491('0x20')]?_['map'](_0x31bc2c[_0x0491('0x1d')][_0x0491('0x20')],function(_0x31c4ba){return{'model':db[_0x31c4ba[_0x0491('0x21')]],'as':_0x31c4ba['as'],'attributes':_0x31c4ba[_0x0491('0x1f')],'include':_0x31c4ba[_0x0491('0x20')]?_[_0x0491('0x22')](_0x31c4ba['include'],function(_0x7c03ef){return{'model':db[_0x7c03ef[_0x0491('0x21')]],'as':_0x7c03ef['as'],'attributes':_0x7c03ef[_0x0491('0x1f')],'include':_0x7c03ef[_0x0491('0x20')]?_[_0x0491('0x22')](_0x7c03ef['include'],function(_0x12ebdb){return{'model':db[_0x12ebdb[_0x0491('0x21')]],'as':_0x12ebdb['as'],'attributes':_0x12ebdb[_0x0491('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0491('0xd')](function(_0xe0e31e){logger[_0x0491('0xe')](_0x0491('0x19'),_0x31bc2c);logger[_0x0491('0x10')](_0x0491('0x19'),_0x31bc2c,JSON[_0x0491('0x12')](_0xe0e31e));_0xc02328(_0xe0e31e);})['catch'](function(_0x4fbeb8){logger['error']('GetZohoAccount',_0x4fbeb8[_0x0491('0x16')],_0x31bc2c);_0x4ba009(_0x3b536e['error'](0x1f4,_0x4fbeb8[_0x0491('0x16')]));});});};exports[_0x0491('0x23')]=function(_0x3b66d0){var _0x7d4feb=this;return new Promise(function(_0x2e3223,_0x18278b){return db[_0x0491('0x1a')]['find']({'raw':_0x3b66d0[_0x0491('0x1d')]?_0x3b66d0[_0x0491('0x1d')][_0x0491('0x1c')]===undefined?!![]:![]:!![],'where':_0x3b66d0[_0x0491('0x1d')]?_0x3b66d0['options']['where']||null:null,'attributes':_0x3b66d0['options']?_0x3b66d0[_0x0491('0x1d')]['attributes']||null:null,'include':_0x3b66d0[_0x0491('0x1d')]?_0x3b66d0[_0x0491('0x1d')][_0x0491('0x20')]?_[_0x0491('0x22')](_0x3b66d0[_0x0491('0x1d')][_0x0491('0x20')],function(_0x17b4ee){return{'model':db[_0x17b4ee[_0x0491('0x21')]],'as':_0x17b4ee['as'],'attributes':_0x17b4ee['attributes'],'include':_0x17b4ee[_0x0491('0x20')]?_['map'](_0x17b4ee[_0x0491('0x20')],function(_0x16ef85){return{'model':db[_0x16ef85['model']],'as':_0x16ef85['as'],'attributes':_0x16ef85[_0x0491('0x1f')],'include':_0x16ef85['include']?_[_0x0491('0x22')](_0x16ef85[_0x0491('0x20')],function(_0x404b74){return{'model':db[_0x404b74[_0x0491('0x21')]],'as':_0x404b74['as'],'attributes':_0x404b74['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2bff9c){logger[_0x0491('0xe')](_0x0491('0x23'),_0x3b66d0);logger['debug'](_0x0491('0x23'),_0x3b66d0,JSON['stringify'](_0x2bff9c));_0x2e3223(_0x2bff9c);})[_0x0491('0x18')](function(_0x524387){logger[_0x0491('0x13')](_0x0491('0x23'),_0x524387[_0x0491('0x16')],_0x3b66d0);_0x18278b(_0x7d4feb['error'](0x1f4,_0x524387['message']));});});}; \ No newline at end of file +var _0xd290=['limit','include','map','model','ShowZohoAccount','find','raw','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','GetZohoAccount','ZohoAccount','findAll','options','where','attributes'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0xd290,0x165));var _0x0d29=function(_0xc3f0c0,_0x257d2c){_0xc3f0c0=_0xc3f0c0-0x0;var _0xb98dbb=_0xd290[_0xc3f0c0];return _0xb98dbb;};'use strict';var _=require(_0x0d29('0x0'));var util=require(_0x0d29('0x1'));var moment=require('moment');var BPromise=require(_0x0d29('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0d29('0x3'))['db'];var utils=require(_0x0d29('0x4'));var logger=require(_0x0d29('0x5'))(_0x0d29('0x6'));var config=require(_0x0d29('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0d29('0x8')][_0x0d29('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x151d32,_0x376d19,_0x276aeb){return new BPromise(function(_0x4edfcd,_0x3ee63c){return client[_0x0d29('0xa')](_0x151d32,_0x276aeb)[_0x0d29('0xb')](function(_0x4b876e){logger[_0x0d29('0xc')](_0x0d29('0xd'),_0x376d19,'request\x20sent');logger[_0x0d29('0xe')](_0x0d29('0xf'),_0x376d19,'request\x20sent',JSON[_0x0d29('0x10')](_0x4b876e));if(_0x4b876e['error']){if(_0x4b876e[_0x0d29('0x11')][_0x0d29('0x12')]===0x1f4){logger[_0x0d29('0x11')](_0x0d29('0xd'),_0x376d19,_0x4b876e[_0x0d29('0x11')]['message']);return _0x3ee63c(_0x4b876e[_0x0d29('0x11')][_0x0d29('0x13')]);}logger[_0x0d29('0x11')](_0x0d29('0xd'),_0x376d19,_0x4b876e[_0x0d29('0x11')]['message']);return _0x4edfcd(_0x4b876e['error']['message']);}else{logger[_0x0d29('0xc')]('ZohoAccount,\x20%s,\x20%s',_0x376d19,_0x0d29('0x14'));_0x4edfcd(_0x4b876e['result'][_0x0d29('0x13')]);}})[_0x0d29('0x15')](function(_0x2a04d6){logger[_0x0d29('0x11')](_0x0d29('0xd'),_0x376d19,_0x2a04d6);_0x3ee63c(_0x2a04d6);});});}exports[_0x0d29('0x16')]=function(_0x488fa2){var _0x319a36=this;return new Promise(function(_0x2600b3,_0xca30af){return db[_0x0d29('0x17')][_0x0d29('0x18')]({'raw':_0x488fa2[_0x0d29('0x19')]?_0x488fa2[_0x0d29('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x488fa2[_0x0d29('0x19')]?_0x488fa2[_0x0d29('0x19')][_0x0d29('0x1a')]||null:null,'attributes':_0x488fa2[_0x0d29('0x19')]?_0x488fa2[_0x0d29('0x19')][_0x0d29('0x1b')]||null:null,'limit':_0x488fa2[_0x0d29('0x19')]?_0x488fa2[_0x0d29('0x19')][_0x0d29('0x1c')]||null:null,'include':_0x488fa2[_0x0d29('0x19')]?_0x488fa2[_0x0d29('0x19')][_0x0d29('0x1d')]?_[_0x0d29('0x1e')](_0x488fa2['options'][_0x0d29('0x1d')],function(_0x1b78b7){return{'model':db[_0x1b78b7[_0x0d29('0x1f')]],'as':_0x1b78b7['as'],'attributes':_0x1b78b7[_0x0d29('0x1b')],'include':_0x1b78b7['include']?_[_0x0d29('0x1e')](_0x1b78b7[_0x0d29('0x1d')],function(_0x24e781){return{'model':db[_0x24e781[_0x0d29('0x1f')]],'as':_0x24e781['as'],'attributes':_0x24e781[_0x0d29('0x1b')],'include':_0x24e781[_0x0d29('0x1d')]?_[_0x0d29('0x1e')](_0x24e781['include'],function(_0x511281){return{'model':db[_0x511281[_0x0d29('0x1f')]],'as':_0x511281['as'],'attributes':_0x511281['attributes']};}):[]};}):[]};}):[]:[]})[_0x0d29('0xb')](function(_0x50e519){logger['info'](_0x0d29('0x16'),_0x488fa2);logger['debug'](_0x0d29('0x16'),_0x488fa2,JSON['stringify'](_0x50e519));_0x2600b3(_0x50e519);})[_0x0d29('0x15')](function(_0x2f7202){logger['error'](_0x0d29('0x16'),_0x2f7202[_0x0d29('0x13')],_0x488fa2);_0xca30af(_0x319a36[_0x0d29('0x11')](0x1f4,_0x2f7202['message']));});});};exports[_0x0d29('0x20')]=function(_0x3a22a1){var _0xac69ac=this;return new Promise(function(_0x174c09,_0x2ca4cb){return db[_0x0d29('0x17')][_0x0d29('0x21')]({'raw':_0x3a22a1[_0x0d29('0x19')]?_0x3a22a1[_0x0d29('0x19')][_0x0d29('0x22')]===undefined?!![]:![]:!![],'where':_0x3a22a1['options']?_0x3a22a1[_0x0d29('0x19')][_0x0d29('0x1a')]||null:null,'attributes':_0x3a22a1[_0x0d29('0x19')]?_0x3a22a1[_0x0d29('0x19')][_0x0d29('0x1b')]||null:null,'include':_0x3a22a1[_0x0d29('0x19')]?_0x3a22a1['options'][_0x0d29('0x1d')]?_[_0x0d29('0x1e')](_0x3a22a1[_0x0d29('0x19')][_0x0d29('0x1d')],function(_0x402fa1){return{'model':db[_0x402fa1[_0x0d29('0x1f')]],'as':_0x402fa1['as'],'attributes':_0x402fa1[_0x0d29('0x1b')],'include':_0x402fa1['include']?_[_0x0d29('0x1e')](_0x402fa1[_0x0d29('0x1d')],function(_0x139082){return{'model':db[_0x139082[_0x0d29('0x1f')]],'as':_0x139082['as'],'attributes':_0x139082[_0x0d29('0x1b')],'include':_0x139082[_0x0d29('0x1d')]?_['map'](_0x139082[_0x0d29('0x1d')],function(_0x485e5e){return{'model':db[_0x485e5e[_0x0d29('0x1f')]],'as':_0x485e5e['as'],'attributes':_0x485e5e[_0x0d29('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0d29('0xb')](function(_0x10d1fc){logger[_0x0d29('0xc')]('ShowZohoAccount',_0x3a22a1);logger[_0x0d29('0xe')](_0x0d29('0x20'),_0x3a22a1,JSON[_0x0d29('0x10')](_0x10d1fc));_0x174c09(_0x10d1fc);})['catch'](function(_0x44dcb8){logger[_0x0d29('0x11')](_0x0d29('0x20'),_0x44dcb8['message'],_0x3a22a1);_0x2ca4cb(_0xac69ac['error'](0x1f4,_0x44dcb8[_0x0d29('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 0609c3f..37d2bd0 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 _0x360e=['../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x4e9e4b,_0x9e3236){var _0x2eb8f3=function(_0x49683e){while(--_0x49683e){_0x4e9e4b['push'](_0x4e9e4b['shift']());}};_0x2eb8f3(++_0x9e3236);}(_0x360e,0x1c5));var _0xe360=function(_0x5a5395,_0x5361f6){_0x5a5395=_0x5a5395-0x0;var _0x4da43d=_0x360e[_0x5a5395];return _0x4da43d;};'use strict';var multer=require(_0xe360('0x0'));var util=require(_0xe360('0x1'));var path=require(_0xe360('0x2'));var timeout=require(_0xe360('0x3'));var express=require(_0xe360('0x4'));var router=express[_0xe360('0x5')]();var fs_extra=require(_0xe360('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe360('0x7'));var controller=require('./intZohoConfiguration.controller');router[_0xe360('0x8')]('/',auth[_0xe360('0x9')](),controller[_0xe360('0xa')]);router['get'](_0xe360('0xb'),auth['isAuthenticated'](),controller[_0xe360('0xc')]);router[_0xe360('0x8')](_0xe360('0xd'),auth[_0xe360('0x9')](),controller[_0xe360('0xe')]);router[_0xe360('0x8')]('/:id/subjects',auth[_0xe360('0x9')](),controller[_0xe360('0xf')]);router['get'](_0xe360('0x10'),auth[_0xe360('0x9')](),controller['getDescriptions']);router[_0xe360('0x11')]('/',auth[_0xe360('0x9')](),controller['create']);router[_0xe360('0x12')](_0xe360('0xb'),auth[_0xe360('0x9')](),controller[_0xe360('0x13')]);router[_0xe360('0x14')]('/:id',auth[_0xe360('0x9')](),controller[_0xe360('0x15')]);module[_0xe360('0x16')]=router; \ No newline at end of file +var _0xf589=['index','show','/:id/fields','getFields','getSubjects','/:id/descriptions','post','create','update','delete','/:id','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated'];(function(_0x2761c5,_0x2587af){var _0x378f89=function(_0x14dec4){while(--_0x14dec4){_0x2761c5['push'](_0x2761c5['shift']());}};_0x378f89(++_0x2587af);}(_0xf589,0x6d));var _0x9f58=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xf589[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x9f58('0x0'));var util=require(_0x9f58('0x1'));var path=require('path');var timeout=require(_0x9f58('0x2'));var express=require(_0x9f58('0x3'));var router=express[_0x9f58('0x4')]();var fs_extra=require(_0x9f58('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9f58('0x6'));var config=require(_0x9f58('0x7'));var controller=require(_0x9f58('0x8'));router[_0x9f58('0x9')]('/',auth[_0x9f58('0xa')](),controller[_0x9f58('0xb')]);router['get']('/:id',auth[_0x9f58('0xa')](),controller[_0x9f58('0xc')]);router[_0x9f58('0x9')](_0x9f58('0xd'),auth[_0x9f58('0xa')](),controller[_0x9f58('0xe')]);router[_0x9f58('0x9')]('/:id/subjects',auth[_0x9f58('0xa')](),controller[_0x9f58('0xf')]);router[_0x9f58('0x9')](_0x9f58('0x10'),auth[_0x9f58('0xa')](),controller['getDescriptions']);router[_0x9f58('0x11')]('/',auth[_0x9f58('0xa')](),controller[_0x9f58('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x9f58('0x13')]);router[_0x9f58('0x14')](_0x9f58('0x15'),auth[_0x9f58('0xa')](),controller[_0x9f58('0x16')]);module[_0x9f58('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 6249c09..4ef445f 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 _0x7d2f=['exports','STRING','ENUM','contact_lead','contact','lead'];(function(_0x2402f7,_0x4feadf){var _0x4ab190=function(_0x35e9de){while(--_0x35e9de){_0x2402f7['push'](_0x2402f7['shift']());}};_0x4ab190(++_0x4feadf);}(_0x7d2f,0xba));var _0xf7d2=function(_0x550434,_0x54c359){_0x550434=_0x550434-0x0;var _0x4efa3a=_0x7d2f[_0x550434];return _0x4efa3a;};'use strict';var Sequelize=require('sequelize');module[_0xf7d2('0x0')]={'name':{'type':Sequelize[_0xf7d2('0x1')]},'moduleCreate':{'type':Sequelize[_0xf7d2('0x2')]('lead','contact','nothing'),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0xf7d2('0x2')](_0xf7d2('0x3'),_0xf7d2('0x4'),_0xf7d2('0x5')),'defaultValue':_0xf7d2('0x3')},'description':{'type':Sequelize[_0xf7d2('0x1')]}}; \ No newline at end of file +var _0x4404=['contact','nothing','lead','ENUM','contact_lead','sequelize','STRING'];(function(_0x4f2304,_0x498023){var _0x5900db=function(_0x498e5){while(--_0x498e5){_0x4f2304['push'](_0x4f2304['shift']());}};_0x5900db(++_0x498023);}(_0x4404,0x1ef));var _0x4440=function(_0x59ef5c,_0x57d183){_0x59ef5c=_0x59ef5c-0x0;var _0x4a5eed=_0x4404[_0x59ef5c];return _0x4a5eed;};'use strict';var Sequelize=require(_0x4440('0x0'));module['exports']={'name':{'type':Sequelize[_0x4440('0x1')]},'moduleCreate':{'type':Sequelize['ENUM']('lead',_0x4440('0x2'),_0x4440('0x3')),'defaultValue':_0x4440('0x4')},'moduleSearch':{'type':Sequelize[_0x4440('0x5')](_0x4440('0x6'),_0x4440('0x2'),_0x4440('0x4')),'defaultValue':_0x4440('0x6')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index d0bccb6..0949df8 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 _0x63dd=['where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','getFields','ZohoField','hasOwnProperty','getSubjects','findOne','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','sendStatus','name','send','index','map','ZohoConfiguration','rawAttributes','type','key','keys','query','intersection','model','attributes','length','nolimit','order','sort','filters','pick'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x63dd,0x1a1));var _0xd63d=function(_0x3d1545,_0x32d043){_0x3d1545=_0x3d1545-0x0;var _0x24b9c4=_0x63dd[_0x3d1545];return _0x24b9c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd63d('0x0'));var zipdir=require(_0xd63d('0x1'));var jsonpatch=require(_0xd63d('0x2'));var rp=require(_0xd63d('0x3'));var moment=require(_0xd63d('0x4'));var BPromise=require(_0xd63d('0x5'));var Mustache=require(_0xd63d('0x6'));var util=require(_0xd63d('0x7'));var path=require(_0xd63d('0x8'));var sox=require(_0xd63d('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd63d('0xa'));var squel=require(_0xd63d('0xb'));var crypto=require('crypto');var jsforce=require(_0xd63d('0xc'));var deskjs=require(_0xd63d('0xd'));var toCsv=require(_0xd63d('0xe'));var querystring=require(_0xd63d('0xf'));var Papa=require('papaparse');var Redis=require(_0xd63d('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd63d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd63d('0x12'))(_0xd63d('0x13'));var utils=require(_0xd63d('0x14'));var config=require(_0xd63d('0x15'));var licenseUtil=require(_0xd63d('0x16'));var db=require(_0xd63d('0x17'))['db'];function respondWithStatusCode(_0x39aecf,_0x2b78e6){_0x2b78e6=_0x2b78e6||0xcc;return function(_0x4a6f1c){if(_0x4a6f1c){return _0x39aecf['sendStatus'](_0x2b78e6);}return _0x39aecf[_0xd63d('0x18')](_0x2b78e6)[_0xd63d('0x19')]();};}function respondWithResult(_0x5a6944,_0x173fc9){_0x173fc9=_0x173fc9||0xc8;return function(_0x32f1f5){if(_0x32f1f5){return _0x5a6944['status'](_0x173fc9)[_0xd63d('0x1a')](_0x32f1f5);}};}function respondWithFilteredResult(_0xe0bc1d,_0xbcb204){return function(_0x5d10dc){if(_0x5d10dc){var _0x23e502=typeof _0xbcb204[_0xd63d('0x1b')]===_0xd63d('0x1c')&&typeof _0xbcb204[_0xd63d('0x1d')]===_0xd63d('0x1c');var _0x2c1daa=_0x5d10dc['count'];var _0x28d529=_0x23e502?0x0:_0xbcb204[_0xd63d('0x1b')];var _0x17c568=_0x23e502?_0x5d10dc[_0xd63d('0x1e')]:_0xbcb204[_0xd63d('0x1b')]+_0xbcb204[_0xd63d('0x1d')];var _0x147b11;if(_0x17c568>=_0x2c1daa){_0x17c568=_0x2c1daa;_0x147b11=0xc8;}else{_0x147b11=0xce;}_0xe0bc1d[_0xd63d('0x18')](_0x147b11);return _0xe0bc1d[_0xd63d('0x1f')]('Content-Range',_0x28d529+'-'+_0x17c568+'/'+_0x2c1daa)[_0xd63d('0x1a')](_0x5d10dc);}return null;};}function patchUpdates(_0x1e34ed){return function(_0xffefe6){try{jsonpatch['apply'](_0xffefe6,_0x1e34ed,!![]);}catch(_0x5246e2){return BPromise[_0xd63d('0x20')](_0x5246e2);}return _0xffefe6[_0xd63d('0x21')]();};}function saveUpdates(_0x587b1f,_0x4cc314){return function(_0x3b2939){if(_0x3b2939){return _0x3b2939[_0xd63d('0x22')](_0x587b1f)[_0xd63d('0x23')](function(_0x25a2a1){return _0x25a2a1;});}return null;};}function removeEntity(_0x57f368,_0x35ea5e){return function(_0x112079){if(_0x112079){return _0x112079[_0xd63d('0x24')]()[_0xd63d('0x23')](function(){_0x57f368[_0xd63d('0x18')](0xcc)[_0xd63d('0x19')]();});}};}function handleEntityNotFound(_0x32961d,_0x165654){return function(_0x32dbc4){if(!_0x32dbc4){_0x32961d[_0xd63d('0x25')](0x194);}return _0x32dbc4;};}function handleError(_0x2b7f9a,_0x2c3e59){_0x2c3e59=_0x2c3e59||0x1f4;return function(_0x4c3cf2){logger['error'](_0x4c3cf2['stack']);if(_0x4c3cf2[_0xd63d('0x26')]){delete _0x4c3cf2[_0xd63d('0x26')];}_0x2b7f9a['status'](_0x2c3e59)[_0xd63d('0x27')](_0x4c3cf2);};}exports[_0xd63d('0x28')]=function(_0x4287e6,_0x39007e){var _0x142a5a={},_0x2b088c={},_0x590b2c={'count':0x0,'rows':[]};var _0x4f9b9b=_[_0xd63d('0x29')](db[_0xd63d('0x2a')][_0xd63d('0x2b')],function(_0x7580e9){return{'name':_0x7580e9['fieldName'],'type':_0x7580e9[_0xd63d('0x2c')][_0xd63d('0x2d')]};});_0x2b088c['model']=_['map'](_0x4f9b9b,_0xd63d('0x26'));_0x2b088c['query']=_[_0xd63d('0x2e')](_0x4287e6[_0xd63d('0x2f')]);_0x2b088c['filters']=_[_0xd63d('0x30')](_0x2b088c[_0xd63d('0x31')],_0x2b088c[_0xd63d('0x2f')]);_0x142a5a['attributes']=_['intersection'](_0x2b088c['model'],qs['fields'](_0x4287e6[_0xd63d('0x2f')]['fields']));_0x142a5a['attributes']=_0x142a5a[_0xd63d('0x32')][_0xd63d('0x33')]?_0x142a5a[_0xd63d('0x32')]:_0x2b088c['model'];if(!_0x4287e6[_0xd63d('0x2f')]['hasOwnProperty'](_0xd63d('0x34'))){_0x142a5a[_0xd63d('0x1d')]=qs[_0xd63d('0x1d')](_0x4287e6['query']['limit']);_0x142a5a[_0xd63d('0x1b')]=qs[_0xd63d('0x1b')](_0x4287e6['query'][_0xd63d('0x1b')]);}_0x142a5a[_0xd63d('0x35')]=qs[_0xd63d('0x36')](_0x4287e6['query'][_0xd63d('0x36')]);_0x142a5a['where']=qs[_0xd63d('0x37')](_[_0xd63d('0x38')](_0x4287e6['query'],_0x2b088c[_0xd63d('0x37')]),_0x4f9b9b);if(_0x4287e6[_0xd63d('0x2f')]['filter']){_0x142a5a[_0xd63d('0x39')]=_[_0xd63d('0x3a')](_0x142a5a['where'],{'$or':_[_0xd63d('0x29')](_0x4f9b9b,function(_0x57b4d6){if(_0x57b4d6[_0xd63d('0x2c')]!==_0xd63d('0x3b')){var _0x4fb9b5={};_0x4fb9b5[_0x57b4d6[_0xd63d('0x26')]]={'$like':'%'+_0x4287e6['query'][_0xd63d('0x3c')]+'%'};return _0x4fb9b5;}})});}_0x142a5a=_[_0xd63d('0x3a')]({},_0x142a5a,_0x4287e6[_0xd63d('0x3d')]);var _0x32beb9={'where':_0x142a5a[_0xd63d('0x39')]};return db[_0xd63d('0x2a')]['count'](_0x32beb9)[_0xd63d('0x23')](function(_0x48f0c3){_0x590b2c['count']=_0x48f0c3;if(_0x4287e6[_0xd63d('0x2f')][_0xd63d('0x3e')]){_0x142a5a[_0xd63d('0x3f')]=[{'all':!![]}];}return db[_0xd63d('0x2a')][_0xd63d('0x40')](_0x142a5a);})[_0xd63d('0x23')](function(_0x6462b9){_0x590b2c[_0xd63d('0x41')]=_0x6462b9;return _0x590b2c;})[_0xd63d('0x23')](respondWithFilteredResult(_0x39007e,_0x142a5a))[_0xd63d('0x42')](handleError(_0x39007e,null));};exports[_0xd63d('0x43')]=function(_0x4b9403,_0x25f49f){var _0x1d3169={'raw':![],'where':{'id':_0x4b9403[_0xd63d('0x44')]['id']}},_0x57a2ac={};_0x57a2ac['model']=_[_0xd63d('0x2e')](db[_0xd63d('0x2a')]['rawAttributes']);_0x57a2ac[_0xd63d('0x2f')]=_['keys'](_0x4b9403[_0xd63d('0x2f')]);_0x57a2ac[_0xd63d('0x37')]=_[_0xd63d('0x30')](_0x57a2ac['model'],_0x57a2ac[_0xd63d('0x2f')]);_0x1d3169['attributes']=_[_0xd63d('0x30')](_0x57a2ac[_0xd63d('0x31')],qs[_0xd63d('0x45')](_0x4b9403[_0xd63d('0x2f')]['fields']));_0x1d3169[_0xd63d('0x32')]=_0x1d3169[_0xd63d('0x32')][_0xd63d('0x33')]?_0x1d3169[_0xd63d('0x32')]:_0x57a2ac['model'];if(_0x4b9403[_0xd63d('0x2f')]['includeAll']){_0x1d3169[_0xd63d('0x3f')]=[{'all':!![]}];}_0x1d3169=_[_0xd63d('0x3a')]({},_0x1d3169,_0x4b9403[_0xd63d('0x3d')]);return db[_0xd63d('0x2a')][_0xd63d('0x46')](_0x1d3169)[_0xd63d('0x23')](handleEntityNotFound(_0x25f49f,null))[_0xd63d('0x23')](respondWithResult(_0x25f49f,null))[_0xd63d('0x42')](handleError(_0x25f49f,null));};exports[_0xd63d('0x47')]=function(_0xbaa62c,_0x2c77fb){return db[_0xd63d('0x2a')][_0xd63d('0x47')](_0xbaa62c[_0xd63d('0x48')],{})[_0xd63d('0x23')](respondWithResult(_0x2c77fb,0xc9))[_0xd63d('0x42')](handleError(_0x2c77fb,null));};exports[_0xd63d('0x22')]=function(_0x32273,_0x1d7416){if(_0x32273[_0xd63d('0x48')]['id']){delete _0x32273[_0xd63d('0x48')]['id'];}return db[_0xd63d('0x2a')]['find']({'where':{'id':_0x32273[_0xd63d('0x44')]['id']}})['then'](handleEntityNotFound(_0x1d7416,null))['then'](saveUpdates(_0x32273['body'],null))[_0xd63d('0x23')](respondWithResult(_0x1d7416,null))[_0xd63d('0x42')](handleError(_0x1d7416,null));};exports['destroy']=function(_0x29a697,_0x33deec){return db[_0xd63d('0x2a')][_0xd63d('0x46')]({'where':{'id':_0x29a697[_0xd63d('0x44')]['id']}})['then'](handleEntityNotFound(_0x33deec,null))[_0xd63d('0x23')](removeEntity(_0x33deec,null))[_0xd63d('0x42')](handleError(_0x33deec,null));};exports[_0xd63d('0x49')]=function(_0x49abb7,_0x5b0f1c,_0x376add){var _0x42cd7e={};var _0x581df2={};var _0x567cca;var _0x50b965;return db[_0xd63d('0x2a')]['findOne']({'where':{'id':_0x49abb7[_0xd63d('0x44')]['id']}})[_0xd63d('0x23')](handleEntityNotFound(_0x5b0f1c,null))[_0xd63d('0x23')](function(_0x1c2552){if(_0x1c2552){_0x567cca=_0x1c2552;_0x581df2[_0xd63d('0x31')]=_[_0xd63d('0x2e')](db[_0xd63d('0x4a')][_0xd63d('0x2b')]);_0x581df2[_0xd63d('0x2f')]=_[_0xd63d('0x2e')](_0x49abb7[_0xd63d('0x2f')]);_0x581df2['filters']=_[_0xd63d('0x30')](_0x581df2[_0xd63d('0x31')],_0x581df2['query']);_0x42cd7e[_0xd63d('0x32')]=_[_0xd63d('0x30')](_0x581df2[_0xd63d('0x31')],qs['fields'](_0x49abb7[_0xd63d('0x2f')][_0xd63d('0x45')]));_0x42cd7e[_0xd63d('0x32')]=_0x42cd7e[_0xd63d('0x32')][_0xd63d('0x33')]?_0x42cd7e[_0xd63d('0x32')]:_0x581df2['model'];_0x42cd7e['order']=qs['sort'](_0x49abb7[_0xd63d('0x2f')][_0xd63d('0x36')]);_0x42cd7e[_0xd63d('0x39')]=qs[_0xd63d('0x37')](_[_0xd63d('0x38')](_0x49abb7[_0xd63d('0x2f')],_0x581df2['filters']));if(_0x49abb7['query'][_0xd63d('0x3c')]){_0x42cd7e[_0xd63d('0x39')]=_[_0xd63d('0x3a')](_0x42cd7e[_0xd63d('0x39')],{'$or':_[_0xd63d('0x29')](_0x42cd7e[_0xd63d('0x32')],function(_0x2801d1){var _0x28dee3={};_0x28dee3[_0x2801d1]={'$like':'%'+_0x49abb7[_0xd63d('0x2f')][_0xd63d('0x3c')]+'%'};return _0x28dee3;})});}_0x42cd7e=_[_0xd63d('0x3a')]({},_0x42cd7e,_0x49abb7[_0xd63d('0x3d')]);return _0x567cca[_0xd63d('0x49')](_0x42cd7e);}})[_0xd63d('0x23')](function(_0x235ba3){if(_0x235ba3){_0x50b965=_0x235ba3[_0xd63d('0x33')];if(!_0x49abb7['query'][_0xd63d('0x4b')](_0xd63d('0x34'))){_0x42cd7e[_0xd63d('0x1d')]=qs[_0xd63d('0x1d')](_0x49abb7[_0xd63d('0x2f')][_0xd63d('0x1d')]);_0x42cd7e[_0xd63d('0x1b')]=qs[_0xd63d('0x1b')](_0x49abb7[_0xd63d('0x2f')][_0xd63d('0x1b')]);}return _0x567cca['getFields'](_0x42cd7e);}})['then'](function(_0xdcb3e1){if(_0xdcb3e1){return _0xdcb3e1?{'count':_0x50b965,'rows':_0xdcb3e1}:null;}})[_0xd63d('0x23')](respondWithResult(_0x5b0f1c,null))['catch'](handleError(_0x5b0f1c,null));};exports[_0xd63d('0x4c')]=function(_0x4a1a33,_0xd4da60,_0x47b71f){var _0x54207d={};var _0x4be12f={};var _0x43f1f2;var _0x2b8886;return db['ZohoConfiguration'][_0xd63d('0x4d')]({'where':{'id':_0x4a1a33[_0xd63d('0x44')]['id']}})[_0xd63d('0x23')](handleEntityNotFound(_0xd4da60,null))[_0xd63d('0x23')](function(_0x3a7d7f){if(_0x3a7d7f){_0x43f1f2=_0x3a7d7f;_0x4be12f[_0xd63d('0x31')]=_[_0xd63d('0x2e')](db[_0xd63d('0x4a')]['rawAttributes']);_0x4be12f['query']=_['keys'](_0x4a1a33[_0xd63d('0x2f')]);_0x4be12f[_0xd63d('0x37')]=_[_0xd63d('0x30')](_0x4be12f[_0xd63d('0x31')],_0x4be12f[_0xd63d('0x2f')]);_0x54207d['attributes']=_[_0xd63d('0x30')](_0x4be12f[_0xd63d('0x31')],qs[_0xd63d('0x45')](_0x4a1a33['query'][_0xd63d('0x45')]));_0x54207d['attributes']=_0x54207d[_0xd63d('0x32')][_0xd63d('0x33')]?_0x54207d[_0xd63d('0x32')]:_0x4be12f[_0xd63d('0x31')];_0x54207d[_0xd63d('0x35')]=qs[_0xd63d('0x36')](_0x4a1a33[_0xd63d('0x2f')]['sort']);_0x54207d[_0xd63d('0x39')]=qs[_0xd63d('0x37')](_[_0xd63d('0x38')](_0x4a1a33['query'],_0x4be12f[_0xd63d('0x37')]));if(_0x4a1a33[_0xd63d('0x2f')][_0xd63d('0x3c')]){_0x54207d[_0xd63d('0x39')]=_[_0xd63d('0x3a')](_0x54207d[_0xd63d('0x39')],{'$or':_[_0xd63d('0x29')](_0x54207d[_0xd63d('0x32')],function(_0x53619f){var _0x97872f={};_0x97872f[_0x53619f]={'$like':'%'+_0x4a1a33[_0xd63d('0x2f')]['filter']+'%'};return _0x97872f;})});}_0x54207d=_[_0xd63d('0x3a')]({},_0x54207d,_0x4a1a33[_0xd63d('0x3d')]);return _0x43f1f2['getSubjects'](_0x54207d);}})['then'](function(_0x50a01a){if(_0x50a01a){_0x2b8886=_0x50a01a[_0xd63d('0x33')];if(!_0x4a1a33[_0xd63d('0x2f')]['hasOwnProperty'](_0xd63d('0x34'))){_0x54207d['limit']=qs[_0xd63d('0x1d')](_0x4a1a33[_0xd63d('0x2f')][_0xd63d('0x1d')]);_0x54207d['offset']=qs[_0xd63d('0x1b')](_0x4a1a33['query'][_0xd63d('0x1b')]);}return _0x43f1f2[_0xd63d('0x4c')](_0x54207d);}})['then'](function(_0x1fda82){if(_0x1fda82){return _0x1fda82?{'count':_0x2b8886,'rows':_0x1fda82}:null;}})[_0xd63d('0x23')](respondWithResult(_0xd4da60,null))[_0xd63d('0x42')](handleError(_0xd4da60,null));};exports[_0xd63d('0x4e')]=function(_0x16b43c,_0x581057,_0x5db672){var _0x1f00f5={};var _0x73f507={};var _0x3eb9c0;var _0x406b4e;return db['ZohoConfiguration'][_0xd63d('0x4d')]({'where':{'id':_0x16b43c['params']['id']}})[_0xd63d('0x23')](handleEntityNotFound(_0x581057,null))[_0xd63d('0x23')](function(_0x251f22){if(_0x251f22){_0x3eb9c0=_0x251f22;_0x73f507[_0xd63d('0x31')]=_[_0xd63d('0x2e')](db[_0xd63d('0x4a')][_0xd63d('0x2b')]);_0x73f507[_0xd63d('0x2f')]=_[_0xd63d('0x2e')](_0x16b43c[_0xd63d('0x2f')]);_0x73f507[_0xd63d('0x37')]=_[_0xd63d('0x30')](_0x73f507['model'],_0x73f507['query']);_0x1f00f5[_0xd63d('0x32')]=_[_0xd63d('0x30')](_0x73f507['model'],qs[_0xd63d('0x45')](_0x16b43c[_0xd63d('0x2f')][_0xd63d('0x45')]));_0x1f00f5['attributes']=_0x1f00f5[_0xd63d('0x32')][_0xd63d('0x33')]?_0x1f00f5['attributes']:_0x73f507['model'];_0x1f00f5['order']=qs[_0xd63d('0x36')](_0x16b43c[_0xd63d('0x2f')]['sort']);_0x1f00f5[_0xd63d('0x39')]=qs[_0xd63d('0x37')](_['pick'](_0x16b43c[_0xd63d('0x2f')],_0x73f507[_0xd63d('0x37')]));if(_0x16b43c[_0xd63d('0x2f')][_0xd63d('0x3c')]){_0x1f00f5[_0xd63d('0x39')]=_[_0xd63d('0x3a')](_0x1f00f5['where'],{'$or':_[_0xd63d('0x29')](_0x1f00f5[_0xd63d('0x32')],function(_0x46fc4b){var _0x161097={};_0x161097[_0x46fc4b]={'$like':'%'+_0x16b43c['query'][_0xd63d('0x3c')]+'%'};return _0x161097;})});}_0x1f00f5=_[_0xd63d('0x3a')]({},_0x1f00f5,_0x16b43c['options']);return _0x3eb9c0['getDescriptions'](_0x1f00f5);}})[_0xd63d('0x23')](function(_0x2038e4){if(_0x2038e4){_0x406b4e=_0x2038e4[_0xd63d('0x33')];if(!_0x16b43c[_0xd63d('0x2f')][_0xd63d('0x4b')](_0xd63d('0x34'))){_0x1f00f5[_0xd63d('0x1d')]=qs['limit'](_0x16b43c[_0xd63d('0x2f')][_0xd63d('0x1d')]);_0x1f00f5[_0xd63d('0x1b')]=qs[_0xd63d('0x1b')](_0x16b43c[_0xd63d('0x2f')]['offset']);}return _0x3eb9c0[_0xd63d('0x4e')](_0x1f00f5);}})[_0xd63d('0x23')](function(_0x6677f8){if(_0x6677f8){return _0x6677f8?{'count':_0x406b4e,'rows':_0x6677f8}:null;}})[_0xd63d('0x23')](respondWithResult(_0x581057,null))[_0xd63d('0x42')](handleError(_0x581057,null));}; \ No newline at end of file +var _0xb457=['fs-extra','lodash','crypto','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','end','status','json','limit','undefined','count','offset','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','ZohoConfiguration','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','where','VIRTUAL','filter','merge','options','include','findAll','rows','catch','params','rawAttributes','includeAll','find','create','update','body','findOne','getFields','getSubjects','ZohoField','hasOwnProperty','getDescriptions','pick','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x12b965,_0x373f8e){var _0xd84e18=function(_0x3d9a67){while(--_0x3d9a67){_0x12b965['push'](_0x12b965['shift']());}};_0xd84e18(++_0x373f8e);}(_0xb457,0x1c8));var _0x7b45=function(_0x44b3bd,_0x44c97d){_0x44b3bd=_0x44b3bd-0x0;var _0x1efc4a=_0xb457[_0x44b3bd];return _0x1efc4a;};'use strict';var emlformat=require(_0x7b45('0x0'));var rimraf=require(_0x7b45('0x1'));var zipdir=require(_0x7b45('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7b45('0x3'));var moment=require(_0x7b45('0x4'));var BPromise=require(_0x7b45('0x5'));var Mustache=require(_0x7b45('0x6'));var util=require(_0x7b45('0x7'));var path=require(_0x7b45('0x8'));var sox=require(_0x7b45('0x9'));var csv=require(_0x7b45('0xa'));var ejs=require(_0x7b45('0xb'));var fs=require('fs');var fs_extra=require(_0x7b45('0xc'));var _=require(_0x7b45('0xd'));var squel=require('squel');var crypto=require(_0x7b45('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7b45('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7b45('0xf'));var authService=require(_0x7b45('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7b45('0x11'));var hardwareService=require(_0x7b45('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x7b45('0x13'));var licenseUtil=require(_0x7b45('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x461ddc,_0x203fe1){_0x203fe1=_0x203fe1||0xcc;return function(_0x57f8fe){if(_0x57f8fe){return _0x461ddc[_0x7b45('0x15')](_0x203fe1);}return _0x461ddc['status'](_0x203fe1)[_0x7b45('0x16')]();};}function respondWithResult(_0x709370,_0x3fb689){_0x3fb689=_0x3fb689||0xc8;return function(_0x2fd6f5){if(_0x2fd6f5){return _0x709370[_0x7b45('0x17')](_0x3fb689)[_0x7b45('0x18')](_0x2fd6f5);}};}function respondWithFilteredResult(_0x5726bd,_0x35bdca){return function(_0x75da2c){if(_0x75da2c){var _0x556df2=typeof _0x35bdca['offset']==='undefined'&&typeof _0x35bdca[_0x7b45('0x19')]===_0x7b45('0x1a');var _0x1db797=_0x75da2c[_0x7b45('0x1b')];var _0x58a2cc=_0x556df2?0x0:_0x35bdca[_0x7b45('0x1c')];var _0x8691ae=_0x556df2?_0x75da2c[_0x7b45('0x1b')]:_0x35bdca[_0x7b45('0x1c')]+_0x35bdca['limit'];var _0x5ced05;if(_0x8691ae>=_0x1db797){_0x8691ae=_0x1db797;_0x5ced05=0xc8;}else{_0x5ced05=0xce;}_0x5726bd[_0x7b45('0x17')](_0x5ced05);return _0x5726bd['set'](_0x7b45('0x1d'),_0x58a2cc+'-'+_0x8691ae+'/'+_0x1db797)[_0x7b45('0x18')](_0x75da2c);}return null;};}function patchUpdates(_0xfeddbe){return function(_0x1533d3){try{jsonpatch[_0x7b45('0x1e')](_0x1533d3,_0xfeddbe,!![]);}catch(_0x1bc055){return BPromise[_0x7b45('0x1f')](_0x1bc055);}return _0x1533d3[_0x7b45('0x20')]();};}function saveUpdates(_0x3edbe9,_0x300244){return function(_0x57bb50){if(_0x57bb50){return _0x57bb50['update'](_0x3edbe9)[_0x7b45('0x21')](function(_0x15c0f0){return _0x15c0f0;});}return null;};}function removeEntity(_0x31ee3e,_0x36cb73){return function(_0x57d243){if(_0x57d243){return _0x57d243[_0x7b45('0x22')]()[_0x7b45('0x21')](function(){_0x31ee3e[_0x7b45('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c61e2,_0x3f11c2){return function(_0x68d8d0){if(!_0x68d8d0){_0x1c61e2[_0x7b45('0x15')](0x194);}return _0x68d8d0;};}function handleError(_0x20b57a,_0x480b19){_0x480b19=_0x480b19||0x1f4;return function(_0x201187){logger[_0x7b45('0x23')](_0x201187[_0x7b45('0x24')]);if(_0x201187[_0x7b45('0x25')]){delete _0x201187['name'];}_0x20b57a['status'](_0x480b19)[_0x7b45('0x26')](_0x201187);};}exports[_0x7b45('0x27')]=function(_0x5322c8,_0xa57382){var _0x379dbd={},_0x4522d7={},_0x39a139={'count':0x0,'rows':[]};var _0x202ff5=_[_0x7b45('0x28')](db[_0x7b45('0x29')]['rawAttributes'],function(_0x392b0e){return{'name':_0x392b0e['fieldName'],'type':_0x392b0e[_0x7b45('0x2a')][_0x7b45('0x2b')]};});_0x4522d7[_0x7b45('0x2c')]=_['map'](_0x202ff5,_0x7b45('0x25'));_0x4522d7[_0x7b45('0x2d')]=_[_0x7b45('0x2e')](_0x5322c8[_0x7b45('0x2d')]);_0x4522d7['filters']=_[_0x7b45('0x2f')](_0x4522d7['model'],_0x4522d7[_0x7b45('0x2d')]);_0x379dbd[_0x7b45('0x30')]=_[_0x7b45('0x2f')](_0x4522d7[_0x7b45('0x2c')],qs[_0x7b45('0x31')](_0x5322c8['query'][_0x7b45('0x31')]));_0x379dbd[_0x7b45('0x30')]=_0x379dbd['attributes'][_0x7b45('0x32')]?_0x379dbd['attributes']:_0x4522d7[_0x7b45('0x2c')];if(!_0x5322c8[_0x7b45('0x2d')]['hasOwnProperty'](_0x7b45('0x33'))){_0x379dbd[_0x7b45('0x19')]=qs[_0x7b45('0x19')](_0x5322c8[_0x7b45('0x2d')][_0x7b45('0x19')]);_0x379dbd['offset']=qs[_0x7b45('0x1c')](_0x5322c8[_0x7b45('0x2d')][_0x7b45('0x1c')]);}_0x379dbd[_0x7b45('0x34')]=qs[_0x7b45('0x35')](_0x5322c8[_0x7b45('0x2d')][_0x7b45('0x35')]);_0x379dbd['where']=qs['filters'](_['pick'](_0x5322c8[_0x7b45('0x2d')],_0x4522d7[_0x7b45('0x36')]),_0x202ff5);if(_0x5322c8[_0x7b45('0x2d')]['filter']){_0x379dbd[_0x7b45('0x37')]=_['merge'](_0x379dbd[_0x7b45('0x37')],{'$or':_[_0x7b45('0x28')](_0x202ff5,function(_0x10062b){if(_0x10062b[_0x7b45('0x2a')]!==_0x7b45('0x38')){var _0x26d2f6={};_0x26d2f6[_0x10062b[_0x7b45('0x25')]]={'$like':'%'+_0x5322c8['query'][_0x7b45('0x39')]+'%'};return _0x26d2f6;}})});}_0x379dbd=_[_0x7b45('0x3a')]({},_0x379dbd,_0x5322c8[_0x7b45('0x3b')]);var _0x1517f1={'where':_0x379dbd[_0x7b45('0x37')]};return db[_0x7b45('0x29')][_0x7b45('0x1b')](_0x1517f1)['then'](function(_0x445e95){_0x39a139[_0x7b45('0x1b')]=_0x445e95;if(_0x5322c8[_0x7b45('0x2d')]['includeAll']){_0x379dbd[_0x7b45('0x3c')]=[{'all':!![]}];}return db[_0x7b45('0x29')][_0x7b45('0x3d')](_0x379dbd);})['then'](function(_0x3e7f11){_0x39a139[_0x7b45('0x3e')]=_0x3e7f11;return _0x39a139;})[_0x7b45('0x21')](respondWithFilteredResult(_0xa57382,_0x379dbd))[_0x7b45('0x3f')](handleError(_0xa57382,null));};exports['show']=function(_0x5cc48c,_0x1d47dc){var _0x2c3935={'raw':![],'where':{'id':_0x5cc48c[_0x7b45('0x40')]['id']}},_0x31ee4c={};_0x31ee4c[_0x7b45('0x2c')]=_[_0x7b45('0x2e')](db['ZohoConfiguration'][_0x7b45('0x41')]);_0x31ee4c[_0x7b45('0x2d')]=_['keys'](_0x5cc48c[_0x7b45('0x2d')]);_0x31ee4c[_0x7b45('0x36')]=_[_0x7b45('0x2f')](_0x31ee4c[_0x7b45('0x2c')],_0x31ee4c['query']);_0x2c3935[_0x7b45('0x30')]=_[_0x7b45('0x2f')](_0x31ee4c[_0x7b45('0x2c')],qs[_0x7b45('0x31')](_0x5cc48c[_0x7b45('0x2d')][_0x7b45('0x31')]));_0x2c3935[_0x7b45('0x30')]=_0x2c3935[_0x7b45('0x30')]['length']?_0x2c3935[_0x7b45('0x30')]:_0x31ee4c[_0x7b45('0x2c')];if(_0x5cc48c[_0x7b45('0x2d')][_0x7b45('0x42')]){_0x2c3935['include']=[{'all':!![]}];}_0x2c3935=_[_0x7b45('0x3a')]({},_0x2c3935,_0x5cc48c[_0x7b45('0x3b')]);return db[_0x7b45('0x29')][_0x7b45('0x43')](_0x2c3935)[_0x7b45('0x21')](handleEntityNotFound(_0x1d47dc,null))[_0x7b45('0x21')](respondWithResult(_0x1d47dc,null))[_0x7b45('0x3f')](handleError(_0x1d47dc,null));};exports['create']=function(_0x20592b,_0x4c4763){return db['ZohoConfiguration'][_0x7b45('0x44')](_0x20592b['body'],{})['then'](respondWithResult(_0x4c4763,0xc9))[_0x7b45('0x3f')](handleError(_0x4c4763,null));};exports[_0x7b45('0x45')]=function(_0x511fbd,_0x168c23){if(_0x511fbd[_0x7b45('0x46')]['id']){delete _0x511fbd[_0x7b45('0x46')]['id'];}return db[_0x7b45('0x29')][_0x7b45('0x43')]({'where':{'id':_0x511fbd['params']['id']}})[_0x7b45('0x21')](handleEntityNotFound(_0x168c23,null))[_0x7b45('0x21')](saveUpdates(_0x511fbd[_0x7b45('0x46')],null))[_0x7b45('0x21')](respondWithResult(_0x168c23,null))[_0x7b45('0x3f')](handleError(_0x168c23,null));};exports[_0x7b45('0x22')]=function(_0x5c7516,_0xa47340){return db[_0x7b45('0x29')][_0x7b45('0x43')]({'where':{'id':_0x5c7516['params']['id']}})[_0x7b45('0x21')](handleEntityNotFound(_0xa47340,null))[_0x7b45('0x21')](removeEntity(_0xa47340,null))['catch'](handleError(_0xa47340,null));};exports['getFields']=function(_0x144ba1,_0x4e45a8,_0xd35c8e){var _0x389b6b={};var _0x14fa98={};var _0x2d8af7;var _0x576e56;return db[_0x7b45('0x29')][_0x7b45('0x47')]({'where':{'id':_0x144ba1[_0x7b45('0x40')]['id']}})[_0x7b45('0x21')](handleEntityNotFound(_0x4e45a8,null))['then'](function(_0xd6f73c){if(_0xd6f73c){_0x2d8af7=_0xd6f73c;_0x14fa98[_0x7b45('0x2c')]=_[_0x7b45('0x2e')](db['ZohoField'][_0x7b45('0x41')]);_0x14fa98[_0x7b45('0x2d')]=_[_0x7b45('0x2e')](_0x144ba1[_0x7b45('0x2d')]);_0x14fa98[_0x7b45('0x36')]=_[_0x7b45('0x2f')](_0x14fa98['model'],_0x14fa98[_0x7b45('0x2d')]);_0x389b6b[_0x7b45('0x30')]=_[_0x7b45('0x2f')](_0x14fa98[_0x7b45('0x2c')],qs['fields'](_0x144ba1[_0x7b45('0x2d')]['fields']));_0x389b6b[_0x7b45('0x30')]=_0x389b6b[_0x7b45('0x30')][_0x7b45('0x32')]?_0x389b6b[_0x7b45('0x30')]:_0x14fa98[_0x7b45('0x2c')];_0x389b6b[_0x7b45('0x34')]=qs[_0x7b45('0x35')](_0x144ba1[_0x7b45('0x2d')][_0x7b45('0x35')]);_0x389b6b[_0x7b45('0x37')]=qs[_0x7b45('0x36')](_['pick'](_0x144ba1[_0x7b45('0x2d')],_0x14fa98[_0x7b45('0x36')]));if(_0x144ba1[_0x7b45('0x2d')][_0x7b45('0x39')]){_0x389b6b['where']=_[_0x7b45('0x3a')](_0x389b6b[_0x7b45('0x37')],{'$or':_[_0x7b45('0x28')](_0x389b6b['attributes'],function(_0x811056){var _0x5687b8={};_0x5687b8[_0x811056]={'$like':'%'+_0x144ba1['query'][_0x7b45('0x39')]+'%'};return _0x5687b8;})});}_0x389b6b=_[_0x7b45('0x3a')]({},_0x389b6b,_0x144ba1[_0x7b45('0x3b')]);return _0x2d8af7[_0x7b45('0x48')](_0x389b6b);}})[_0x7b45('0x21')](function(_0x2169f4){if(_0x2169f4){_0x576e56=_0x2169f4[_0x7b45('0x32')];if(!_0x144ba1[_0x7b45('0x2d')]['hasOwnProperty'](_0x7b45('0x33'))){_0x389b6b[_0x7b45('0x19')]=qs[_0x7b45('0x19')](_0x144ba1[_0x7b45('0x2d')][_0x7b45('0x19')]);_0x389b6b[_0x7b45('0x1c')]=qs['offset'](_0x144ba1['query']['offset']);}return _0x2d8af7[_0x7b45('0x48')](_0x389b6b);}})[_0x7b45('0x21')](function(_0x3dd177){if(_0x3dd177){return _0x3dd177?{'count':_0x576e56,'rows':_0x3dd177}:null;}})[_0x7b45('0x21')](respondWithResult(_0x4e45a8,null))[_0x7b45('0x3f')](handleError(_0x4e45a8,null));};exports[_0x7b45('0x49')]=function(_0x338452,_0x29e267,_0x17ee9f){var _0x464c26={};var _0x1c2baa={};var _0x1ec387;var _0x2f93ce;return db[_0x7b45('0x29')][_0x7b45('0x47')]({'where':{'id':_0x338452[_0x7b45('0x40')]['id']}})['then'](handleEntityNotFound(_0x29e267,null))['then'](function(_0x414e3c){if(_0x414e3c){_0x1ec387=_0x414e3c;_0x1c2baa[_0x7b45('0x2c')]=_[_0x7b45('0x2e')](db[_0x7b45('0x4a')][_0x7b45('0x41')]);_0x1c2baa['query']=_[_0x7b45('0x2e')](_0x338452['query']);_0x1c2baa[_0x7b45('0x36')]=_[_0x7b45('0x2f')](_0x1c2baa[_0x7b45('0x2c')],_0x1c2baa['query']);_0x464c26[_0x7b45('0x30')]=_[_0x7b45('0x2f')](_0x1c2baa[_0x7b45('0x2c')],qs[_0x7b45('0x31')](_0x338452[_0x7b45('0x2d')][_0x7b45('0x31')]));_0x464c26[_0x7b45('0x30')]=_0x464c26[_0x7b45('0x30')][_0x7b45('0x32')]?_0x464c26[_0x7b45('0x30')]:_0x1c2baa['model'];_0x464c26[_0x7b45('0x34')]=qs['sort'](_0x338452[_0x7b45('0x2d')][_0x7b45('0x35')]);_0x464c26[_0x7b45('0x37')]=qs[_0x7b45('0x36')](_['pick'](_0x338452[_0x7b45('0x2d')],_0x1c2baa['filters']));if(_0x338452[_0x7b45('0x2d')][_0x7b45('0x39')]){_0x464c26[_0x7b45('0x37')]=_[_0x7b45('0x3a')](_0x464c26[_0x7b45('0x37')],{'$or':_['map'](_0x464c26[_0x7b45('0x30')],function(_0x6f8001){var _0x246650={};_0x246650[_0x6f8001]={'$like':'%'+_0x338452[_0x7b45('0x2d')]['filter']+'%'};return _0x246650;})});}_0x464c26=_[_0x7b45('0x3a')]({},_0x464c26,_0x338452[_0x7b45('0x3b')]);return _0x1ec387[_0x7b45('0x49')](_0x464c26);}})[_0x7b45('0x21')](function(_0x18a36d){if(_0x18a36d){_0x2f93ce=_0x18a36d[_0x7b45('0x32')];if(!_0x338452[_0x7b45('0x2d')][_0x7b45('0x4b')]('nolimit')){_0x464c26[_0x7b45('0x19')]=qs['limit'](_0x338452['query']['limit']);_0x464c26[_0x7b45('0x1c')]=qs[_0x7b45('0x1c')](_0x338452[_0x7b45('0x2d')][_0x7b45('0x1c')]);}return _0x1ec387[_0x7b45('0x49')](_0x464c26);}})[_0x7b45('0x21')](function(_0x456e5c){if(_0x456e5c){return _0x456e5c?{'count':_0x2f93ce,'rows':_0x456e5c}:null;}})['then'](respondWithResult(_0x29e267,null))['catch'](handleError(_0x29e267,null));};exports[_0x7b45('0x4c')]=function(_0x5d3a62,_0x5bbdab,_0x2061a9){var _0x4d87c7={};var _0x66654b={};var _0x3e0916;var _0x2f920b;return db['ZohoConfiguration'][_0x7b45('0x47')]({'where':{'id':_0x5d3a62[_0x7b45('0x40')]['id']}})[_0x7b45('0x21')](handleEntityNotFound(_0x5bbdab,null))[_0x7b45('0x21')](function(_0x424b25){if(_0x424b25){_0x3e0916=_0x424b25;_0x66654b[_0x7b45('0x2c')]=_['keys'](db[_0x7b45('0x4a')]['rawAttributes']);_0x66654b[_0x7b45('0x2d')]=_[_0x7b45('0x2e')](_0x5d3a62[_0x7b45('0x2d')]);_0x66654b[_0x7b45('0x36')]=_['intersection'](_0x66654b['model'],_0x66654b[_0x7b45('0x2d')]);_0x4d87c7[_0x7b45('0x30')]=_[_0x7b45('0x2f')](_0x66654b[_0x7b45('0x2c')],qs[_0x7b45('0x31')](_0x5d3a62[_0x7b45('0x2d')][_0x7b45('0x31')]));_0x4d87c7[_0x7b45('0x30')]=_0x4d87c7['attributes']['length']?_0x4d87c7[_0x7b45('0x30')]:_0x66654b[_0x7b45('0x2c')];_0x4d87c7[_0x7b45('0x34')]=qs[_0x7b45('0x35')](_0x5d3a62['query']['sort']);_0x4d87c7['where']=qs['filters'](_[_0x7b45('0x4d')](_0x5d3a62[_0x7b45('0x2d')],_0x66654b[_0x7b45('0x36')]));if(_0x5d3a62[_0x7b45('0x2d')][_0x7b45('0x39')]){_0x4d87c7[_0x7b45('0x37')]=_['merge'](_0x4d87c7[_0x7b45('0x37')],{'$or':_[_0x7b45('0x28')](_0x4d87c7['attributes'],function(_0x2028b5){var _0x5ee81c={};_0x5ee81c[_0x2028b5]={'$like':'%'+_0x5d3a62[_0x7b45('0x2d')][_0x7b45('0x39')]+'%'};return _0x5ee81c;})});}_0x4d87c7=_['merge']({},_0x4d87c7,_0x5d3a62[_0x7b45('0x3b')]);return _0x3e0916[_0x7b45('0x4c')](_0x4d87c7);}})['then'](function(_0x24f965){if(_0x24f965){_0x2f920b=_0x24f965[_0x7b45('0x32')];if(!_0x5d3a62[_0x7b45('0x2d')]['hasOwnProperty'](_0x7b45('0x33'))){_0x4d87c7['limit']=qs['limit'](_0x5d3a62[_0x7b45('0x2d')][_0x7b45('0x19')]);_0x4d87c7['offset']=qs[_0x7b45('0x1c')](_0x5d3a62[_0x7b45('0x2d')]['offset']);}return _0x3e0916['getDescriptions'](_0x4d87c7);}})[_0x7b45('0x21')](function(_0x3510bf){if(_0x3510bf){return _0x3510bf?{'count':_0x2f920b,'rows':_0x3510bf}:null;}})[_0x7b45('0x21')](respondWithResult(_0x5bbdab,null))[_0x7b45('0x3f')](handleError(_0x5bbdab,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index ae6cdef..c9b15a5 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 _0x419c=['./intZohoConfiguration.attributes','exports','define','int_zoho_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x208b04,_0x875510){var _0x49151d=function(_0x18af9b){while(--_0x18af9b){_0x208b04['push'](_0x208b04['shift']());}};_0x49151d(++_0x875510);}(_0x419c,0x79));var _0xc419=function(_0x2d8434,_0x43d781){_0x2d8434=_0x2d8434-0x0;var _0x26b9e4=_0x419c[_0x2d8434];return _0x26b9e4;};'use strict';var _=require(_0xc419('0x0'));var util=require(_0xc419('0x1'));var logger=require(_0xc419('0x2'))(_0xc419('0x3'));var moment=require(_0xc419('0x4'));var BPromise=require(_0xc419('0x5'));var rp=require(_0xc419('0x6'));var fs=require('fs');var path=require(_0xc419('0x7'));var rimraf=require(_0xc419('0x8'));var config=require('../../config/environment');var attributes=require(_0xc419('0x9'));module[_0xc419('0xa')]=function(_0xf058fe,_0x20290d){return _0xf058fe[_0xc419('0xb')]('ZohoConfiguration',attributes,{'tableName':_0xc419('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x58de=['define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x33f255,_0x596d0a){var _0x251611=function(_0x28c973){while(--_0x28c973){_0x33f255['push'](_0x33f255['shift']());}};_0x251611(++_0x596d0a);}(_0x58de,0x145));var _0xe58d=function(_0x59b2c3,_0x1fc340){_0x59b2c3=_0x59b2c3-0x0;var _0x3dfdcd=_0x58de[_0x59b2c3];return _0x3dfdcd;};'use strict';var _=require(_0xe58d('0x0'));var util=require(_0xe58d('0x1'));var logger=require(_0xe58d('0x2'))(_0xe58d('0x3'));var moment=require(_0xe58d('0x4'));var BPromise=require(_0xe58d('0x5'));var rp=require(_0xe58d('0x6'));var fs=require('fs');var path=require(_0xe58d('0x7'));var rimraf=require(_0xe58d('0x8'));var config=require(_0xe58d('0x9'));var attributes=require('./intZohoConfiguration.attributes');module[_0xe58d('0xa')]=function(_0xdc5d4a,_0x3d988b){return _0xdc5d4a[_0xe58d('0xb')](_0xe58d('0xc'),attributes,{'tableName':_0xe58d('0xd'),'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 d5a1c66..1abb2c8 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 _0xe1dc=['stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x287a47,_0x2f731c){var _0x3fb726=function(_0xbedc33){while(--_0xbedc33){_0x287a47['push'](_0x287a47['shift']());}};_0x3fb726(++_0x2f731c);}(_0xe1dc,0x17d));var _0xce1d=function(_0x37f51b,_0x1ff25b){_0x37f51b=_0x37f51b-0x0;var _0x52a199=_0xe1dc[_0x37f51b];return _0x52a199;};'use strict';var _=require(_0xce1d('0x0'));var util=require(_0xce1d('0x1'));var moment=require(_0xce1d('0x2'));var BPromise=require('bluebird');var rs=require(_0xce1d('0x3'));var fs=require('fs');var Redis=require(_0xce1d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xce1d('0x5'));var config=require(_0xce1d('0x6'));var jayson=require(_0xce1d('0x7'));var client=jayson[_0xce1d('0x8')][_0xce1d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a26a9,_0xe91a8c,_0xcf86a8){return new BPromise(function(_0x1ed672,_0x825862){return client[_0xce1d('0xa')](_0x4a26a9,_0xcf86a8)['then'](function(_0x5576d7){logger['info'](_0xce1d('0xb'),_0xe91a8c,_0xce1d('0xc'));logger[_0xce1d('0xd')](_0xce1d('0xe'),_0xe91a8c,_0xce1d('0xc'),JSON[_0xce1d('0xf')](_0x5576d7));if(_0x5576d7[_0xce1d('0x10')]){if(_0x5576d7['error'][_0xce1d('0x11')]===0x1f4){logger[_0xce1d('0x10')](_0xce1d('0xb'),_0xe91a8c,_0x5576d7[_0xce1d('0x10')][_0xce1d('0x12')]);return _0x825862(_0x5576d7[_0xce1d('0x10')][_0xce1d('0x12')]);}logger[_0xce1d('0x10')](_0xce1d('0xb'),_0xe91a8c,_0x5576d7[_0xce1d('0x10')][_0xce1d('0x12')]);return _0x1ed672(_0x5576d7['error'][_0xce1d('0x12')]);}else{logger[_0xce1d('0x13')](_0xce1d('0xb'),_0xe91a8c,_0xce1d('0xc'));_0x1ed672(_0x5576d7[_0xce1d('0x14')][_0xce1d('0x12')]);}})[_0xce1d('0x15')](function(_0xc1f007){logger[_0xce1d('0x10')](_0xce1d('0xb'),_0xe91a8c,_0xc1f007);_0x825862(_0xc1f007);});});} \ No newline at end of file +var _0xc80a=['info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','moment','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x39ee6d,_0xa4b8e0){var _0x208d2e=function(_0x1c9c80){while(--_0x1c9c80){_0x39ee6d['push'](_0x39ee6d['shift']());}};_0x208d2e(++_0xa4b8e0);}(_0xc80a,0x171));var _0xac80=function(_0x4f528d,_0x57c304){_0x4f528d=_0x4f528d-0x0;var _0x51d091=_0xc80a[_0x4f528d];return _0x51d091;};'use strict';var _=require(_0xac80('0x0'));var util=require('util');var moment=require(_0xac80('0x1'));var BPromise=require(_0xac80('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xac80('0x3'));var logger=require('../../config/logger')(_0xac80('0x4'));var config=require(_0xac80('0x5'));var jayson=require(_0xac80('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2806c3,_0x1175aa,_0x5c1346){return new BPromise(function(_0x541c41,_0x32fc4b){return client[_0xac80('0x7')](_0x2806c3,_0x5c1346)[_0xac80('0x8')](function(_0x264a80){logger[_0xac80('0x9')](_0xac80('0xa'),_0x1175aa,_0xac80('0xb'));logger['debug'](_0xac80('0xc'),_0x1175aa,_0xac80('0xb'),JSON['stringify'](_0x264a80));if(_0x264a80['error']){if(_0x264a80['error'][_0xac80('0xd')]===0x1f4){logger[_0xac80('0xe')](_0xac80('0xa'),_0x1175aa,_0x264a80[_0xac80('0xe')][_0xac80('0xf')]);return _0x32fc4b(_0x264a80[_0xac80('0xe')][_0xac80('0xf')]);}logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x1175aa,_0x264a80['error']['message']);return _0x541c41(_0x264a80[_0xac80('0xe')][_0xac80('0xf')]);}else{logger['info'](_0xac80('0xa'),_0x1175aa,'request\x20sent');_0x541c41(_0x264a80[_0xac80('0x10')]['message']);}})[_0xac80('0x11')](function(_0x1a1d3d){logger[_0xac80('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0x1175aa,_0x1a1d3d);_0x32fc4b(_0x1a1d3d);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index b03436a..4f27fef 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 _0xd901=['isAuthenticated','/:id','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0x48831f,_0x1d9a71){var _0x329fcd=function(_0x1bc8e9){while(--_0x1bc8e9){_0x48831f['push'](_0x48831f['shift']());}};_0x329fcd(++_0x1d9a71);}(_0xd901,0x14c));var _0x1d90=function(_0x3358c9,_0x38dd5b){_0x3358c9=_0x3358c9-0x0;var _0x4cfbc1=_0xd901[_0x3358c9];return _0x4cfbc1;};'use strict';var multer=require(_0x1d90('0x0'));var util=require(_0x1d90('0x1'));var path=require(_0x1d90('0x2'));var timeout=require(_0x1d90('0x3'));var express=require(_0x1d90('0x4'));var router=express[_0x1d90('0x5')]();var fs_extra=require(_0x1d90('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1d90('0x7'));var config=require(_0x1d90('0x8'));var controller=require('./intZohoField.controller');router[_0x1d90('0x9')]('/',auth[_0x1d90('0xa')](),controller['index']);router['get'](_0x1d90('0xb'),auth[_0x1d90('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x1d90('0xc')]);router[_0x1d90('0xd')](_0x1d90('0xb'),auth['isAuthenticated'](),controller[_0x1d90('0xe')]);router[_0x1d90('0xf')](_0x1d90('0xb'),auth[_0x1d90('0xa')](),controller[_0x1d90('0x10')]);module[_0x1d90('0x11')]=router; \ No newline at end of file +var _0xa73e=['delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','isAuthenticated','index','get','/:id','show','post','create','put','update'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xa73e,0xab));var _0xea73=function(_0x37d5e0,_0xc6bc86){_0x37d5e0=_0x37d5e0-0x0;var _0xea572=_0xa73e[_0x37d5e0];return _0xea572;};'use strict';var multer=require(_0xea73('0x0'));var util=require('util');var path=require(_0xea73('0x1'));var timeout=require(_0xea73('0x2'));var express=require(_0xea73('0x3'));var router=express[_0xea73('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xea73('0x5'));var interaction=require(_0xea73('0x6'));var config=require(_0xea73('0x7'));var controller=require(_0xea73('0x8'));router['get']('/',auth[_0xea73('0x9')](),controller[_0xea73('0xa')]);router[_0xea73('0xb')](_0xea73('0xc'),auth['isAuthenticated'](),controller[_0xea73('0xd')]);router[_0xea73('0xe')]('/',auth['isAuthenticated'](),controller[_0xea73('0xf')]);router[_0xea73('0x10')](_0xea73('0xc'),auth[_0xea73('0x9')](),controller[_0xea73('0x11')]);router[_0xea73('0x12')]('/:id',auth[_0xea73('0x9')](),controller[_0xea73('0x13')]);module[_0xea73('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index d665b85..332717f 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 _0xe16d=['keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x37d0ab,_0x100eba){var _0x695b57=function(_0x4bc09e){while(--_0x4bc09e){_0x37d0ab['push'](_0x37d0ab['shift']());}};_0x695b57(++_0x100eba);}(_0xe16d,0x72));var _0xde16=function(_0x372d83,_0x50419e){_0x372d83=_0x372d83-0x0;var _0x4a8227=_0xe16d[_0x372d83];return _0x4a8227;};'use strict';var Sequelize=require(_0xde16('0x0'));module[_0xde16('0x1')]={'type':{'type':Sequelize[_0xde16('0x2')](_0xde16('0x3'),_0xde16('0x4'),_0xde16('0x5'),_0xde16('0x6'),_0xde16('0x7')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xde16('0x8')]},'keyType':{'type':Sequelize[_0xde16('0x2')](_0xde16('0x3'),_0xde16('0x4'),_0xde16('0x5'))},'keyContent':{'type':Sequelize[_0xde16('0x8')]},'idField':{'type':Sequelize[_0xde16('0x8')]},'nameField':{'type':Sequelize[_0xde16('0x8')]},'customField':{'type':Sequelize[_0xde16('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xde16('0x8')]}}; \ No newline at end of file +var _0x8f7f=['BOOLEAN','exports','ENUM','string','picklist','STRING','customVariable'];(function(_0x1120ad,_0x60d17e){var _0x4ea249=function(_0x4c92eb){while(--_0x4c92eb){_0x1120ad['push'](_0x1120ad['shift']());}};_0x4ea249(++_0x60d17e);}(_0x8f7f,0xd3));var _0xf8f7=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x8f7f[_0x209941];return _0x1e8729;};'use strict';var Sequelize=require('sequelize');module[_0xf8f7('0x0')]={'type':{'type':Sequelize[_0xf8f7('0x1')](_0xf8f7('0x2'),'variable','customVariable','keyValue',_0xf8f7('0x3')),'defaultValue':_0xf8f7('0x2')},'content':{'type':Sequelize[_0xf8f7('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xf8f7('0x1')](_0xf8f7('0x2'),'variable',_0xf8f7('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xf8f7('0x4')]},'nameField':{'type':Sequelize[_0xf8f7('0x4')]},'customField':{'type':Sequelize[_0xf8f7('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 8c93019..06df7c0 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 _0xccfe=['keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','ZohoField','rawAttributes','type','key','query'];(function(_0x3c9974,_0x1c35fe){var _0x47100a=function(_0x3233cb){while(--_0x3233cb){_0x3c9974['push'](_0x3c9974['shift']());}};_0x47100a(++_0x1c35fe);}(_0xccfe,0x186));var _0xeccf=function(_0x4b9d1f,_0x2f1b05){_0x4b9d1f=_0x4b9d1f-0x0;var _0x3d9b0b=_0xccfe[_0x4b9d1f];return _0x3d9b0b;};'use strict';var emlformat=require(_0xeccf('0x0'));var rimraf=require(_0xeccf('0x1'));var zipdir=require(_0xeccf('0x2'));var jsonpatch=require(_0xeccf('0x3'));var rp=require(_0xeccf('0x4'));var moment=require(_0xeccf('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xeccf('0x6'));var util=require(_0xeccf('0x7'));var path=require('path');var sox=require(_0xeccf('0x8'));var csv=require(_0xeccf('0x9'));var ejs=require(_0xeccf('0xa'));var fs=require('fs');var fs_extra=require(_0xeccf('0xb'));var _=require(_0xeccf('0xc'));var squel=require('squel');var crypto=require(_0xeccf('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xeccf('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xeccf('0xf'));var Redis=require('ioredis');var authService=require(_0xeccf('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xeccf('0x11'));var hardwareService=require(_0xeccf('0x12'));var logger=require(_0xeccf('0x13'))(_0xeccf('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xeccf('0x15'));var db=require(_0xeccf('0x16'))['db'];function respondWithStatusCode(_0x5575c6,_0x327eab){_0x327eab=_0x327eab||0xcc;return function(_0x1d7de4){if(_0x1d7de4){return _0x5575c6[_0xeccf('0x17')](_0x327eab);}return _0x5575c6[_0xeccf('0x18')](_0x327eab)[_0xeccf('0x19')]();};}function respondWithResult(_0x3675fc,_0x55c7da){_0x55c7da=_0x55c7da||0xc8;return function(_0x4fa1d1){if(_0x4fa1d1){return _0x3675fc[_0xeccf('0x18')](_0x55c7da)[_0xeccf('0x1a')](_0x4fa1d1);}};}function respondWithFilteredResult(_0x5a6ce2,_0x30a026){return function(_0x2f1444){if(_0x2f1444){var _0x5b44d7=typeof _0x30a026[_0xeccf('0x1b')]===_0xeccf('0x1c')&&typeof _0x30a026[_0xeccf('0x1d')]===_0xeccf('0x1c');var _0x16f2fb=_0x2f1444[_0xeccf('0x1e')];var _0x30faa5=_0x5b44d7?0x0:_0x30a026[_0xeccf('0x1b')];var _0x2d33b1=_0x5b44d7?_0x2f1444[_0xeccf('0x1e')]:_0x30a026[_0xeccf('0x1b')]+_0x30a026[_0xeccf('0x1d')];var _0x1ced73;if(_0x2d33b1>=_0x16f2fb){_0x2d33b1=_0x16f2fb;_0x1ced73=0xc8;}else{_0x1ced73=0xce;}_0x5a6ce2[_0xeccf('0x18')](_0x1ced73);return _0x5a6ce2['set'](_0xeccf('0x1f'),_0x30faa5+'-'+_0x2d33b1+'/'+_0x16f2fb)[_0xeccf('0x1a')](_0x2f1444);}return null;};}function patchUpdates(_0x3e6ae2){return function(_0x3423fa){try{jsonpatch[_0xeccf('0x20')](_0x3423fa,_0x3e6ae2,!![]);}catch(_0x25e144){return BPromise[_0xeccf('0x21')](_0x25e144);}return _0x3423fa['save']();};}function saveUpdates(_0x13378f,_0x326957){return function(_0x546739){if(_0x546739){return _0x546739[_0xeccf('0x22')](_0x13378f)[_0xeccf('0x23')](function(_0x419c3b){return _0x419c3b;});}return null;};}function removeEntity(_0x2243f8,_0x73fd95){return function(_0x38b35f){if(_0x38b35f){return _0x38b35f[_0xeccf('0x24')]()[_0xeccf('0x23')](function(){_0x2243f8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bb217,_0x3e101e){return function(_0x760376){if(!_0x760376){_0x2bb217[_0xeccf('0x17')](0x194);}return _0x760376;};}function handleError(_0x517b38,_0x1406e1){_0x1406e1=_0x1406e1||0x1f4;return function(_0x3b2fd7){logger[_0xeccf('0x25')](_0x3b2fd7[_0xeccf('0x26')]);if(_0x3b2fd7[_0xeccf('0x27')]){delete _0x3b2fd7['name'];}_0x517b38[_0xeccf('0x18')](_0x1406e1)[_0xeccf('0x28')](_0x3b2fd7);};}exports[_0xeccf('0x29')]=function(_0x2157ba,_0x45274c){var _0xf8f14={},_0x3fa7e0={},_0x5a76e6={'count':0x0,'rows':[]};var _0x59cc6d=_[_0xeccf('0x2a')](db[_0xeccf('0x2b')][_0xeccf('0x2c')],function(_0x510975){return{'name':_0x510975['fieldName'],'type':_0x510975[_0xeccf('0x2d')][_0xeccf('0x2e')]};});_0x3fa7e0['model']=_[_0xeccf('0x2a')](_0x59cc6d,_0xeccf('0x27'));_0x3fa7e0[_0xeccf('0x2f')]=_[_0xeccf('0x30')](_0x2157ba[_0xeccf('0x2f')]);_0x3fa7e0[_0xeccf('0x31')]=_['intersection'](_0x3fa7e0[_0xeccf('0x32')],_0x3fa7e0['query']);_0xf8f14[_0xeccf('0x33')]=_[_0xeccf('0x34')](_0x3fa7e0['model'],qs['fields'](_0x2157ba[_0xeccf('0x2f')][_0xeccf('0x35')]));_0xf8f14[_0xeccf('0x33')]=_0xf8f14['attributes'][_0xeccf('0x36')]?_0xf8f14[_0xeccf('0x33')]:_0x3fa7e0['model'];if(!_0x2157ba['query'][_0xeccf('0x37')]('nolimit')){_0xf8f14['limit']=qs[_0xeccf('0x1d')](_0x2157ba['query'][_0xeccf('0x1d')]);_0xf8f14['offset']=qs['offset'](_0x2157ba['query'][_0xeccf('0x1b')]);}_0xf8f14[_0xeccf('0x38')]=qs['sort'](_0x2157ba['query'][_0xeccf('0x39')]);_0xf8f14[_0xeccf('0x3a')]=qs[_0xeccf('0x31')](_[_0xeccf('0x3b')](_0x2157ba[_0xeccf('0x2f')],_0x3fa7e0[_0xeccf('0x31')]),_0x59cc6d);if(_0x2157ba['query'][_0xeccf('0x3c')]){_0xf8f14[_0xeccf('0x3a')]=_[_0xeccf('0x3d')](_0xf8f14[_0xeccf('0x3a')],{'$or':_[_0xeccf('0x2a')](_0x59cc6d,function(_0x4f7fca){if(_0x4f7fca[_0xeccf('0x2d')]!==_0xeccf('0x3e')){var _0x51da0e={};_0x51da0e[_0x4f7fca['name']]={'$like':'%'+_0x2157ba[_0xeccf('0x2f')][_0xeccf('0x3c')]+'%'};return _0x51da0e;}})});}_0xf8f14=_[_0xeccf('0x3d')]({},_0xf8f14,_0x2157ba[_0xeccf('0x3f')]);var _0x164bf={'where':_0xf8f14[_0xeccf('0x3a')]};return db[_0xeccf('0x2b')][_0xeccf('0x1e')](_0x164bf)[_0xeccf('0x23')](function(_0x2af792){_0x5a76e6[_0xeccf('0x1e')]=_0x2af792;if(_0x2157ba[_0xeccf('0x2f')][_0xeccf('0x40')]){_0xf8f14[_0xeccf('0x41')]=[{'all':!![]}];}return db[_0xeccf('0x2b')][_0xeccf('0x42')](_0xf8f14);})[_0xeccf('0x23')](function(_0x1b9c02){_0x5a76e6['rows']=_0x1b9c02;return _0x5a76e6;})[_0xeccf('0x23')](respondWithFilteredResult(_0x45274c,_0xf8f14))[_0xeccf('0x43')](handleError(_0x45274c,null));};exports[_0xeccf('0x44')]=function(_0x111cbb,_0x987f43){var _0x4667b8={'raw':!![],'where':{'id':_0x111cbb[_0xeccf('0x45')]['id']}},_0x576131={};_0x576131[_0xeccf('0x32')]=_[_0xeccf('0x30')](db[_0xeccf('0x2b')][_0xeccf('0x2c')]);_0x576131[_0xeccf('0x2f')]=_[_0xeccf('0x30')](_0x111cbb['query']);_0x576131[_0xeccf('0x31')]=_[_0xeccf('0x34')](_0x576131[_0xeccf('0x32')],_0x576131[_0xeccf('0x2f')]);_0x4667b8[_0xeccf('0x33')]=_[_0xeccf('0x34')](_0x576131[_0xeccf('0x32')],qs['fields'](_0x111cbb[_0xeccf('0x2f')]['fields']));_0x4667b8['attributes']=_0x4667b8[_0xeccf('0x33')][_0xeccf('0x36')]?_0x4667b8[_0xeccf('0x33')]:_0x576131[_0xeccf('0x32')];if(_0x111cbb[_0xeccf('0x2f')][_0xeccf('0x40')]){_0x4667b8[_0xeccf('0x41')]=[{'all':!![]}];}_0x4667b8=_[_0xeccf('0x3d')]({},_0x4667b8,_0x111cbb[_0xeccf('0x3f')]);return db[_0xeccf('0x2b')][_0xeccf('0x46')](_0x4667b8)[_0xeccf('0x23')](handleEntityNotFound(_0x987f43,null))[_0xeccf('0x23')](respondWithResult(_0x987f43,null))['catch'](handleError(_0x987f43,null));};exports[_0xeccf('0x47')]=function(_0x167fac,_0x34f427){return db['ZohoField']['create'](_0x167fac['body'],{})[_0xeccf('0x23')](respondWithResult(_0x34f427,0xc9))[_0xeccf('0x43')](handleError(_0x34f427,null));};exports[_0xeccf('0x22')]=function(_0x4391a5,_0x2cf3f3){if(_0x4391a5[_0xeccf('0x48')]['id']){delete _0x4391a5[_0xeccf('0x48')]['id'];}return db[_0xeccf('0x2b')][_0xeccf('0x46')]({'where':{'id':_0x4391a5[_0xeccf('0x45')]['id']}})[_0xeccf('0x23')](handleEntityNotFound(_0x2cf3f3,null))['then'](saveUpdates(_0x4391a5[_0xeccf('0x48')],null))[_0xeccf('0x23')](respondWithResult(_0x2cf3f3,null))[_0xeccf('0x43')](handleError(_0x2cf3f3,null));};exports['destroy']=function(_0x5c3405,_0x46d339){return db[_0xeccf('0x2b')][_0xeccf('0x46')]({'where':{'id':_0x5c3405[_0xeccf('0x45')]['id']}})[_0xeccf('0x23')](handleEntityNotFound(_0x46d339,null))[_0xeccf('0x23')](removeEntity(_0x46d339,null))[_0xeccf('0x43')](handleError(_0x46d339,null));}; \ No newline at end of file +var _0x33af=['where','pick','filter','merge','VIRTUAL','options','ZohoField','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','to-csv','ejs','fs-extra','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','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort'];(function(_0xcfeff4,_0x3f2e19){var _0xb2fadc=function(_0x4cd013){while(--_0x4cd013){_0xcfeff4['push'](_0xcfeff4['shift']());}};_0xb2fadc(++_0x3f2e19);}(_0x33af,0x184));var _0xf33a=function(_0x1075b8,_0xd606e2){_0x1075b8=_0x1075b8-0x0;var _0x5d047f=_0x33af[_0x1075b8];return _0x5d047f;};'use strict';var emlformat=require(_0xf33a('0x0'));var rimraf=require(_0xf33a('0x1'));var zipdir=require(_0xf33a('0x2'));var jsonpatch=require(_0xf33a('0x3'));var rp=require(_0xf33a('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf33a('0x5'));var util=require('util');var path=require(_0xf33a('0x6'));var sox=require('sox');var csv=require(_0xf33a('0x7'));var ejs=require(_0xf33a('0x8'));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(_0xf33a('0x7'));var querystring=require(_0xf33a('0xf'));var Papa=require('papaparse');var Redis=require(_0xf33a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf33a('0x11'));var as=require(_0xf33a('0x12'));var hardwareService=require(_0xf33a('0x13'));var logger=require('../../config/logger')(_0xf33a('0x14'));var utils=require(_0xf33a('0x15'));var config=require(_0xf33a('0x16'));var licenseUtil=require(_0xf33a('0x17'));var db=require(_0xf33a('0x18'))['db'];function respondWithStatusCode(_0x1b163a,_0x44cf67){_0x44cf67=_0x44cf67||0xcc;return function(_0x42f54a){if(_0x42f54a){return _0x1b163a[_0xf33a('0x19')](_0x44cf67);}return _0x1b163a[_0xf33a('0x1a')](_0x44cf67)[_0xf33a('0x1b')]();};}function respondWithResult(_0x4af3ed,_0x2c3f20){_0x2c3f20=_0x2c3f20||0xc8;return function(_0x385b5f){if(_0x385b5f){return _0x4af3ed['status'](_0x2c3f20)[_0xf33a('0x1c')](_0x385b5f);}};}function respondWithFilteredResult(_0x14b15e,_0x16074e){return function(_0x2db6c1){if(_0x2db6c1){var _0xb67107=typeof _0x16074e['offset']==='undefined'&&typeof _0x16074e[_0xf33a('0x1d')]===_0xf33a('0x1e');var _0x12a2a3=_0x2db6c1[_0xf33a('0x1f')];var _0x4eb32d=_0xb67107?0x0:_0x16074e[_0xf33a('0x20')];var _0x45d121=_0xb67107?_0x2db6c1[_0xf33a('0x1f')]:_0x16074e[_0xf33a('0x20')]+_0x16074e[_0xf33a('0x1d')];var _0x471a2b;if(_0x45d121>=_0x12a2a3){_0x45d121=_0x12a2a3;_0x471a2b=0xc8;}else{_0x471a2b=0xce;}_0x14b15e[_0xf33a('0x1a')](_0x471a2b);return _0x14b15e[_0xf33a('0x21')](_0xf33a('0x22'),_0x4eb32d+'-'+_0x45d121+'/'+_0x12a2a3)['json'](_0x2db6c1);}return null;};}function patchUpdates(_0x2bca3d){return function(_0x9b419a){try{jsonpatch[_0xf33a('0x23')](_0x9b419a,_0x2bca3d,!![]);}catch(_0x449629){return BPromise[_0xf33a('0x24')](_0x449629);}return _0x9b419a[_0xf33a('0x25')]();};}function saveUpdates(_0x256f11,_0x2b7035){return function(_0x4fb357){if(_0x4fb357){return _0x4fb357[_0xf33a('0x26')](_0x256f11)[_0xf33a('0x27')](function(_0x4c29d4){return _0x4c29d4;});}return null;};}function removeEntity(_0x4ea295,_0x1f477a){return function(_0x5d3966){if(_0x5d3966){return _0x5d3966[_0xf33a('0x28')]()[_0xf33a('0x27')](function(){_0x4ea295[_0xf33a('0x1a')](0xcc)[_0xf33a('0x1b')]();});}};}function handleEntityNotFound(_0xb73a71,_0x5f00ab){return function(_0x2425f3){if(!_0x2425f3){_0xb73a71['sendStatus'](0x194);}return _0x2425f3;};}function handleError(_0xcaabb7,_0x315331){_0x315331=_0x315331||0x1f4;return function(_0x661e7c){logger[_0xf33a('0x29')](_0x661e7c['stack']);if(_0x661e7c[_0xf33a('0x2a')]){delete _0x661e7c['name'];}_0xcaabb7[_0xf33a('0x1a')](_0x315331)[_0xf33a('0x2b')](_0x661e7c);};}exports['index']=function(_0xfe3f09,_0xaaa0a){var _0x6f7625={},_0x15172c={},_0x57c703={'count':0x0,'rows':[]};var _0xbc100=_[_0xf33a('0x2c')](db['ZohoField']['rawAttributes'],function(_0x2ca432){return{'name':_0x2ca432['fieldName'],'type':_0x2ca432['type']['key']};});_0x15172c[_0xf33a('0x2d')]=_['map'](_0xbc100,_0xf33a('0x2a'));_0x15172c[_0xf33a('0x2e')]=_[_0xf33a('0x2f')](_0xfe3f09[_0xf33a('0x2e')]);_0x15172c[_0xf33a('0x30')]=_[_0xf33a('0x31')](_0x15172c['model'],_0x15172c[_0xf33a('0x2e')]);_0x6f7625[_0xf33a('0x32')]=_[_0xf33a('0x31')](_0x15172c[_0xf33a('0x2d')],qs['fields'](_0xfe3f09[_0xf33a('0x2e')][_0xf33a('0x33')]));_0x6f7625[_0xf33a('0x32')]=_0x6f7625[_0xf33a('0x32')][_0xf33a('0x34')]?_0x6f7625['attributes']:_0x15172c[_0xf33a('0x2d')];if(!_0xfe3f09[_0xf33a('0x2e')]['hasOwnProperty'](_0xf33a('0x35'))){_0x6f7625[_0xf33a('0x1d')]=qs['limit'](_0xfe3f09['query'][_0xf33a('0x1d')]);_0x6f7625['offset']=qs[_0xf33a('0x20')](_0xfe3f09[_0xf33a('0x2e')][_0xf33a('0x20')]);}_0x6f7625[_0xf33a('0x36')]=qs[_0xf33a('0x37')](_0xfe3f09[_0xf33a('0x2e')][_0xf33a('0x37')]);_0x6f7625[_0xf33a('0x38')]=qs['filters'](_[_0xf33a('0x39')](_0xfe3f09['query'],_0x15172c[_0xf33a('0x30')]),_0xbc100);if(_0xfe3f09['query'][_0xf33a('0x3a')]){_0x6f7625[_0xf33a('0x38')]=_[_0xf33a('0x3b')](_0x6f7625[_0xf33a('0x38')],{'$or':_['map'](_0xbc100,function(_0x3b103c){if(_0x3b103c['type']!==_0xf33a('0x3c')){var _0x52e14b={};_0x52e14b[_0x3b103c['name']]={'$like':'%'+_0xfe3f09['query'][_0xf33a('0x3a')]+'%'};return _0x52e14b;}})});}_0x6f7625=_[_0xf33a('0x3b')]({},_0x6f7625,_0xfe3f09[_0xf33a('0x3d')]);var _0x4ac366={'where':_0x6f7625['where']};return db[_0xf33a('0x3e')][_0xf33a('0x1f')](_0x4ac366)[_0xf33a('0x27')](function(_0x3a9a7a){_0x57c703[_0xf33a('0x1f')]=_0x3a9a7a;if(_0xfe3f09[_0xf33a('0x2e')][_0xf33a('0x3f')]){_0x6f7625[_0xf33a('0x40')]=[{'all':!![]}];}return db[_0xf33a('0x3e')][_0xf33a('0x41')](_0x6f7625);})[_0xf33a('0x27')](function(_0xb5280){_0x57c703[_0xf33a('0x42')]=_0xb5280;return _0x57c703;})[_0xf33a('0x27')](respondWithFilteredResult(_0xaaa0a,_0x6f7625))[_0xf33a('0x43')](handleError(_0xaaa0a,null));};exports[_0xf33a('0x44')]=function(_0xf56d5,_0x4d7f5e){var _0x1ff76b={'raw':!![],'where':{'id':_0xf56d5[_0xf33a('0x45')]['id']}},_0xa36f28={};_0xa36f28[_0xf33a('0x2d')]=_[_0xf33a('0x2f')](db['ZohoField'][_0xf33a('0x46')]);_0xa36f28['query']=_[_0xf33a('0x2f')](_0xf56d5['query']);_0xa36f28[_0xf33a('0x30')]=_[_0xf33a('0x31')](_0xa36f28[_0xf33a('0x2d')],_0xa36f28[_0xf33a('0x2e')]);_0x1ff76b[_0xf33a('0x32')]=_[_0xf33a('0x31')](_0xa36f28[_0xf33a('0x2d')],qs['fields'](_0xf56d5[_0xf33a('0x2e')][_0xf33a('0x33')]));_0x1ff76b[_0xf33a('0x32')]=_0x1ff76b[_0xf33a('0x32')][_0xf33a('0x34')]?_0x1ff76b['attributes']:_0xa36f28[_0xf33a('0x2d')];if(_0xf56d5['query']['includeAll']){_0x1ff76b[_0xf33a('0x40')]=[{'all':!![]}];}_0x1ff76b=_[_0xf33a('0x3b')]({},_0x1ff76b,_0xf56d5[_0xf33a('0x3d')]);return db['ZohoField'][_0xf33a('0x47')](_0x1ff76b)[_0xf33a('0x27')](handleEntityNotFound(_0x4d7f5e,null))[_0xf33a('0x27')](respondWithResult(_0x4d7f5e,null))['catch'](handleError(_0x4d7f5e,null));};exports[_0xf33a('0x48')]=function(_0x1a2e7c,_0x46f7bf){return db[_0xf33a('0x3e')]['create'](_0x1a2e7c[_0xf33a('0x49')],{})[_0xf33a('0x27')](respondWithResult(_0x46f7bf,0xc9))[_0xf33a('0x43')](handleError(_0x46f7bf,null));};exports['update']=function(_0x5c71b1,_0x1ce729){if(_0x5c71b1[_0xf33a('0x49')]['id']){delete _0x5c71b1[_0xf33a('0x49')]['id'];}return db['ZohoField'][_0xf33a('0x47')]({'where':{'id':_0x5c71b1['params']['id']}})['then'](handleEntityNotFound(_0x1ce729,null))[_0xf33a('0x27')](saveUpdates(_0x5c71b1['body'],null))[_0xf33a('0x27')](respondWithResult(_0x1ce729,null))[_0xf33a('0x43')](handleError(_0x1ce729,null));};exports['destroy']=function(_0x4e82a3,_0x51d89a){return db[_0xf33a('0x3e')]['find']({'where':{'id':_0x4e82a3[_0xf33a('0x45')]['id']}})[_0xf33a('0x27')](handleEntityNotFound(_0x51d89a,null))[_0xf33a('0x27')](removeEntity(_0x51d89a,null))[_0xf33a('0x43')](handleError(_0x51d89a,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 325a441..aa09d1e 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 _0x6d11=['exports','define','ZohoField','int_zoho_fields','lodash','util','../../config/logger','moment','request-promise','path','./intZohoField.attributes'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x6d11,0xbf));var _0x16d1=function(_0x23c025,_0x2cf181){_0x23c025=_0x23c025-0x0;var _0x2c21f5=_0x6d11[_0x23c025];return _0x2c21f5;};'use strict';var _=require(_0x16d1('0x0'));var util=require(_0x16d1('0x1'));var logger=require(_0x16d1('0x2'))('api');var moment=require(_0x16d1('0x3'));var BPromise=require('bluebird');var rp=require(_0x16d1('0x4'));var fs=require('fs');var path=require(_0x16d1('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x16d1('0x6'));module[_0x16d1('0x7')]=function(_0x3eb9e2,_0x38626d){return _0x3eb9e2[_0x16d1('0x8')](_0x16d1('0x9'),attributes,{'tableName':_0x16d1('0xa'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9582=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','FieldId','lodash'];(function(_0x222fe6,_0x3ee400){var _0xfcd601=function(_0x51649f){while(--_0x51649f){_0x222fe6['push'](_0x222fe6['shift']());}};_0xfcd601(++_0x3ee400);}(_0x9582,0x95));var _0x2958=function(_0x2f2fd8,_0x3f6f30){_0x2f2fd8=_0x2f2fd8-0x0;var _0x2aac3b=_0x9582[_0x2f2fd8];return _0x2aac3b;};'use strict';var _=require(_0x2958('0x0'));var util=require(_0x2958('0x1'));var logger=require(_0x2958('0x2'))(_0x2958('0x3'));var moment=require(_0x2958('0x4'));var BPromise=require(_0x2958('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2958('0x6'));var rimraf=require(_0x2958('0x7'));var config=require(_0x2958('0x8'));var attributes=require(_0x2958('0x9'));module[_0x2958('0xa')]=function(_0xbde128,_0x88ffaa){return _0xbde128[_0x2958('0xb')](_0x2958('0xc'),attributes,{'tableName':_0x2958('0xd'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':['idField',_0x2958('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 149980c..d238f78 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 _0xb37d=['then','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','request'];(function(_0xf5d2af,_0x512c78){var _0x30ec40=function(_0x32de0f){while(--_0x32de0f){_0xf5d2af['push'](_0xf5d2af['shift']());}};_0x30ec40(++_0x512c78);}(_0xb37d,0x1e4));var _0xdb37=function(_0x91eec6,_0xc46f10){_0x91eec6=_0x91eec6-0x0;var _0x4d38de=_0xb37d[_0x91eec6];return _0x4d38de;};'use strict';var _=require('lodash');var util=require(_0xdb37('0x0'));var moment=require('moment');var BPromise=require(_0xdb37('0x1'));var rs=require(_0xdb37('0x2'));var fs=require('fs');var Redis=require(_0xdb37('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdb37('0x4'))('rpc');var config=require(_0xdb37('0x5'));var jayson=require(_0xdb37('0x6'));var client=jayson[_0xdb37('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3535b8,_0x29724c,_0x22f4a0){return new BPromise(function(_0x38530d,_0x3d0602){return client[_0xdb37('0x8')](_0x3535b8,_0x22f4a0)[_0xdb37('0x9')](function(_0x37b877){logger['info'](_0xdb37('0xa'),_0x29724c,_0xdb37('0xb'));logger['debug'](_0xdb37('0xc'),_0x29724c,_0xdb37('0xb'),JSON[_0xdb37('0xd')](_0x37b877));if(_0x37b877[_0xdb37('0xe')]){if(_0x37b877['error']['code']===0x1f4){logger['error'](_0xdb37('0xa'),_0x29724c,_0x37b877[_0xdb37('0xe')][_0xdb37('0xf')]);return _0x3d0602(_0x37b877[_0xdb37('0xe')][_0xdb37('0xf')]);}logger[_0xdb37('0xe')](_0xdb37('0xa'),_0x29724c,_0x37b877[_0xdb37('0xe')][_0xdb37('0xf')]);return _0x38530d(_0x37b877[_0xdb37('0xe')][_0xdb37('0xf')]);}else{logger['info'](_0xdb37('0xa'),_0x29724c,_0xdb37('0xb'));_0x38530d(_0x37b877[_0xdb37('0x10')][_0xdb37('0xf')]);}})['catch'](function(_0x497fa1){logger[_0xdb37('0xe')](_0xdb37('0xa'),_0x29724c,_0x497fa1);_0x3d0602(_0x497fa1);});});} \ No newline at end of file +var _0xf77f=['debug','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ZohoField,\x20%s,\x20%s'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xf77f,0x166));var _0xff77=function(_0x1ac120,_0x3e7e45){_0x1ac120=_0x1ac120-0x0;var _0x19b703=_0xf77f[_0x1ac120];return _0x19b703;};'use strict';var _=require(_0xff77('0x0'));var util=require(_0xff77('0x1'));var moment=require(_0xff77('0x2'));var BPromise=require(_0xff77('0x3'));var rs=require(_0xff77('0x4'));var fs=require('fs');var Redis=require(_0xff77('0x5'));var db=require(_0xff77('0x6'))['db'];var utils=require(_0xff77('0x7'));var logger=require(_0xff77('0x8'))(_0xff77('0x9'));var config=require(_0xff77('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xff77('0xb')][_0xff77('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x264d80,_0x34f3ff,_0x3351c9){return new BPromise(function(_0x10a5e0,_0x3ea95d){return client[_0xff77('0xd')](_0x264d80,_0x3351c9)[_0xff77('0xe')](function(_0x4ea94){logger[_0xff77('0xf')](_0xff77('0x10'),_0x34f3ff,'request\x20sent');logger[_0xff77('0x11')](_0xff77('0x12'),_0x34f3ff,_0xff77('0x13'),JSON[_0xff77('0x14')](_0x4ea94));if(_0x4ea94[_0xff77('0x15')]){if(_0x4ea94['error']['code']===0x1f4){logger[_0xff77('0x15')](_0xff77('0x10'),_0x34f3ff,_0x4ea94[_0xff77('0x15')][_0xff77('0x16')]);return _0x3ea95d(_0x4ea94[_0xff77('0x15')][_0xff77('0x16')]);}logger['error'](_0xff77('0x10'),_0x34f3ff,_0x4ea94[_0xff77('0x15')][_0xff77('0x16')]);return _0x10a5e0(_0x4ea94[_0xff77('0x15')][_0xff77('0x16')]);}else{logger[_0xff77('0xf')](_0xff77('0x10'),_0x34f3ff,_0xff77('0x13'));_0x10a5e0(_0x4ea94[_0xff77('0x17')][_0xff77('0x16')]);}})[_0xff77('0x18')](function(_0xbd0df9){logger['error']('ZohoField,\x20%s,\x20%s',_0x34f3ff,_0xbd0df9);_0x3ea95d(_0xbd0df9);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 26676bc..1035461 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x3cf673,_0x12e347){var _0x45a5b8=function(_0x346cec){while(--_0x346cec){_0x3cf673['push'](_0x3cf673['shift']());}};_0x45a5b8(++_0x12e347);}(_0xedd9,0xfc));var _0x9edd=function(_0x19ad68,_0x4d61e8){_0x19ad68=_0x19ad68-0x0;var _0x27cc30=_0xedd9[_0x19ad68];return _0x27cc30;};'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(_0x14196e,_0x935389){var _0x579fd1=function(_0x4e0647){while(--_0x4e0647){_0x14196e['push'](_0x14196e['shift']());}};_0x579fd1(++_0x935389);}(_0x70e0,0x17b));var _0x070e=function(_0x561db9,_0x22c8e0){_0x561db9=_0x561db9-0x0;var _0x4dd8a=_0x70e0[_0x561db9];return _0x4dd8a;};'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 ede49f7..7eb84fe 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 _0xb627=['sequelize','unique_name_and_version','STRING','app.js','INTEGER','state'];(function(_0x2de0a7,_0x38d3e7){var _0x429437=function(_0x23c148){while(--_0x23c148){_0x2de0a7['push'](_0x2de0a7['shift']());}};_0x429437(++_0x38d3e7);}(_0xb627,0x144));var _0x7b62=function(_0x9e65a3,_0x3fbfda){_0x9e65a3=_0x9e65a3-0x0;var _0x149f6c=_0xb627[_0x9e65a3];return _0x149f6c;};'use strict';var Sequelize=require(_0x7b62('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x7b62('0x1')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x7b62('0x1')},'main':{'type':Sequelize[_0x7b62('0x2')],'defaultValue':_0x7b62('0x3')},'filename':{'type':Sequelize[_0x7b62('0x2')]},'path':{'type':Sequelize[_0x7b62('0x2')]},'type':{'type':Sequelize[_0x7b62('0x2')]},'size':{'type':Sequelize[_0x7b62('0x4')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x7b62('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x7b62('0x2')],'unique':_0x7b62('0x5')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x7b62('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x7b62('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0xb584=['app.js','INTEGER','BOOLEAN','state','STRING'];(function(_0x33f153,_0x39d65d){var _0x12ac15=function(_0x1603c1){while(--_0x1603c1){_0x33f153['push'](_0x33f153['shift']());}};_0x12ac15(++_0x39d65d);}(_0xb584,0x1c1));var _0x4b58=function(_0x594313,_0x39f887){_0x594313=_0x594313-0x0;var _0x36e471=_0xb584[_0x594313];return _0x36e471;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4b58('0x0')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x4b58('0x0')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x4b58('0x0')],'defaultValue':_0x4b58('0x1')},'filename':{'type':Sequelize[_0x4b58('0x0')]},'path':{'type':Sequelize[_0x4b58('0x0')]},'type':{'type':Sequelize[_0x4b58('0x0')]},'size':{'type':Sequelize[_0x4b58('0x2')]},'active':{'type':Sequelize[_0x4b58('0x3')],'defaultValue':![]},'author':{'type':Sequelize[_0x4b58('0x0')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize['STRING'],'unique':_0x4b58('0x4')},'description':{'type':Sequelize[_0x4b58('0x0')]},'title':{'type':Sequelize[_0x4b58('0x0')]},'remoteUri':{'type':Sequelize[_0x4b58('0x0')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index f099b1b..0ac3b13 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 _0xadb5=['model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','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','Integration','fieldName','type','key'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xadb5,0xad));var _0x5adb=function(_0x4d81cf,_0xf09d85){_0x4d81cf=_0x4d81cf-0x0;var _0x2606ad=_0xadb5[_0x4d81cf];return _0x2606ad;};'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['Integration']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'all':!![]}];}return db[_0x5adb('0x2a')][_0x5adb('0x40')](_0x5d457e);})['then'](function(_0x53f2c6){_0x1eac55[_0x5adb('0x41')]=_0x53f2c6;return _0x1eac55;})['then'](respondWithFilteredResult(_0x49992e,_0x5d457e))[_0x5adb('0x42')](handleError(_0x49992e,null));};exports[_0x5adb('0x43')]=function(_0x299746,_0x121714){var _0xdfecfd={'raw':![],'where':{'id':_0x299746[_0x5adb('0x44')]['id']}},_0x522ee5={};_0x522ee5[_0x5adb('0x2e')]=_['keys'](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x522ee5['query']=_[_0x5adb('0x30')](_0x299746[_0x5adb('0x2f')]);_0x522ee5[_0x5adb('0x39')]=_[_0x5adb('0x31')](_0x522ee5[_0x5adb('0x2e')],_0x522ee5[_0x5adb('0x2f')]);_0xdfecfd[_0x5adb('0x32')]=_['intersection'](_0x522ee5['model'],qs[_0x5adb('0x33')](_0x299746[_0x5adb('0x2f')][_0x5adb('0x33')]));_0xdfecfd[_0x5adb('0x32')]=_0xdfecfd['attributes']['length']?_0xdfecfd[_0x5adb('0x32')]:_0x522ee5[_0x5adb('0x2e')];if(_0x299746[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0xdfecfd[_0x5adb('0x3f')]=[{'all':!![]}];}_0xdfecfd=_['merge']({},_0xdfecfd,_0x299746[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')]['find'](_0xdfecfd)[_0x5adb('0x22')](handleEntityNotFound(_0x121714,null))[_0x5adb('0x22')](respondWithResult(_0x121714,null))[_0x5adb('0x42')](handleError(_0x121714,null));};exports[_0x5adb('0x46')]=function(_0x186bd2,_0x3a5409){return db[_0x5adb('0x2a')][_0x5adb('0x46')](_0x186bd2['body'],{})[_0x5adb('0x22')](respondWithResult(_0x3a5409,0xc9))['catch'](handleError(_0x3a5409,null));};exports['update']=function(_0x5015ee,_0x3cd211){if(_0x5015ee[_0x5adb('0x47')]['id']){delete _0x5015ee[_0x5adb('0x47')]['id'];}return db['Integration'][_0x5adb('0x48')]({'where':{'id':_0x5015ee['params']['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x3cd211,null))[_0x5adb('0x22')](saveUpdates(_0x5015ee[_0x5adb('0x47')],null))['then'](respondWithResult(_0x3cd211,null))[_0x5adb('0x42')](handleError(_0x3cd211,null));};exports['destroy']=function(_0x22fa54,_0x6dc067){return db['Integration'][_0x5adb('0x48')]({'where':{'id':_0x22fa54[_0x5adb('0x44')]['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x6dc067,null))[_0x5adb('0x22')](removeEntity(_0x6dc067,null))[_0x5adb('0x42')](handleError(_0x6dc067,null));}; \ No newline at end of file +var _0xacf4=['VIRTUAL','merge','options','include','findAll','rows','catch','show','params','intersection','length','includeAll','find','create','body','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','reject','update','then','destroy','error','stack','name','send','index','map','Integration','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','hasOwnProperty','sort','where','pick','filter','type'];(function(_0x2173a3,_0x31458f){var _0x16880d=function(_0x3c0df3){while(--_0x3c0df3){_0x2173a3['push'](_0x2173a3['shift']());}};_0x16880d(++_0x31458f);}(_0xacf4,0xe7));var _0x4acf=function(_0x2eefb5,_0x4b29ab){_0x2eefb5=_0x2eefb5-0x0;var _0x451691=_0xacf4[_0x2eefb5];return _0x451691;};'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['Integration'][_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['Integration']['create'](_0x1bd7d0[_0x4acf('0x47')],{})[_0x4acf('0x21')](respondWithResult(_0x2d946c,0xc9))[_0x4acf('0x3f')](handleError(_0x2d946c,null));};exports[_0x4acf('0x20')]=function(_0x287406,_0x859247){if(_0x287406[_0x4acf('0x47')]['id']){delete _0x287406[_0x4acf('0x47')]['id'];}return db[_0x4acf('0x29')][_0x4acf('0x45')]({'where':{'id':_0x287406[_0x4acf('0x41')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x859247,null))['then'](saveUpdates(_0x287406[_0x4acf('0x47')],null))[_0x4acf('0x21')](respondWithResult(_0x859247,null))[_0x4acf('0x3f')](handleError(_0x859247,null));};exports[_0x4acf('0x22')]=function(_0x392dac,_0x3cf54a){return db[_0x4acf('0x29')][_0x4acf('0x45')]({'where':{'id':_0x392dac[_0x4acf('0x41')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x3cf54a,null))[_0x4acf('0x21')](removeEntity(_0x3cf54a,null))[_0x4acf('0x3f')](handleError(_0x3cf54a,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 0587f37..5240b32 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 _0x6030=['util','../../config/logger','api','moment','request-promise','path','rimraf','./integration.attributes','exports','Integration','integrations'];(function(_0x593bce,_0x484075){var _0x4f56c9=function(_0x583a02){while(--_0x583a02){_0x593bce['push'](_0x593bce['shift']());}};_0x4f56c9(++_0x484075);}(_0x6030,0x197));var _0x0603=function(_0x3221a4,_0xedb080){_0x3221a4=_0x3221a4-0x0;var _0x221ada=_0x6030[_0x3221a4];return _0x221ada;};'use strict';var _=require('lodash');var util=require(_0x0603('0x0'));var logger=require(_0x0603('0x1'))(_0x0603('0x2'));var moment=require(_0x0603('0x3'));var BPromise=require('bluebird');var rp=require(_0x0603('0x4'));var fs=require('fs');var path=require(_0x0603('0x5'));var rimraf=require(_0x0603('0x6'));var config=require('../../config/environment');var attributes=require(_0x0603('0x7'));module[_0x0603('0x8')]=function(_0x419785,_0x16eccb){return _0x419785['define'](_0x0603('0x9'),attributes,{'tableName':_0x0603('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4347=['rimraf','./integration.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x356029,_0x2b63c2){var _0x195fed=function(_0xc2053a){while(--_0xc2053a){_0x356029['push'](_0x356029['shift']());}};_0x195fed(++_0x2b63c2);}(_0x4347,0x1cc));var _0x7434=function(_0xa9bb04,_0x24b455){_0xa9bb04=_0xa9bb04-0x0;var _0x5bae40=_0x4347[_0xa9bb04];return _0x5bae40;};'use strict';var _=require(_0x7434('0x0'));var util=require(_0x7434('0x1'));var logger=require(_0x7434('0x2'))(_0x7434('0x3'));var moment=require(_0x7434('0x4'));var BPromise=require(_0x7434('0x5'));var rp=require(_0x7434('0x6'));var fs=require('fs');var path=require(_0x7434('0x7'));var rimraf=require(_0x7434('0x8'));var config=require('../../config/environment');var attributes=require(_0x7434('0x9'));module[_0x7434('0xa')]=function(_0x2a7311,_0x5d7d49){return _0x2a7311[_0x7434('0xb')]('Integration',attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 1602b5f..b1dfa5a 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 _0xe2fe=['then','info','Integration,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x5a0c7b,_0x1c383a){var _0x32c174=function(_0x21fbb4){while(--_0x21fbb4){_0x5a0c7b['push'](_0x5a0c7b['shift']());}};_0x32c174(++_0x1c383a);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xee2f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee2f('0x2'));var db=require(_0xee2f('0x3'))['db'];var utils=require(_0xee2f('0x4'));var logger=require(_0xee2f('0x5'))(_0xee2f('0x6'));var config=require('../../config/environment');var jayson=require(_0xee2f('0x7'));var client=jayson[_0xee2f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1533a0,_0x2e1c8c,_0x5a7975){return new BPromise(function(_0x3c4095,_0x5ea796){return client[_0xee2f('0x9')](_0x1533a0,_0x5a7975)[_0xee2f('0xa')](function(_0x53f7dd){logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,'request\x20sent');logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0x2e1c8c,'request\x20sent',JSON[_0xee2f('0xd')](_0x53f7dd));if(_0x53f7dd['error']){if(_0x53f7dd['error']['code']===0x1f4){logger[_0xee2f('0xe')](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);return _0x5ea796(_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);}logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd['error'][_0xee2f('0xf')]);return _0x3c4095(_0x53f7dd[_0xee2f('0xe')]['message']);}else{logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,_0xee2f('0x10'));_0x3c4095(_0x53f7dd[_0xee2f('0x11')][_0xee2f('0xf')]);}})['catch'](function(_0x3f6372){logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x3f6372);_0x5ea796(_0x3f6372);});});} \ No newline at end of file +var _0xef0f=['lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0xd65e1b,_0x4642d0){var _0x8b3ed4=function(_0x16dc62){while(--_0x16dc62){_0xd65e1b['push'](_0xd65e1b['shift']());}};_0x8b3ed4(++_0x4642d0);}(_0xef0f,0x168));var _0xfef0=function(_0xd0e639,_0x60783b){_0xd0e639=_0xd0e639-0x0;var _0x1a6948=_0xef0f[_0xd0e639];return _0x1a6948;};'use strict';var _=require(_0xfef0('0x0'));var util=require('util');var moment=require(_0xfef0('0x1'));var BPromise=require(_0xfef0('0x2'));var rs=require(_0xfef0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfef0('0x4'))['db'];var utils=require(_0xfef0('0x5'));var logger=require(_0xfef0('0x6'))('rpc');var config=require(_0xfef0('0x7'));var jayson=require(_0xfef0('0x8'));var client=jayson[_0xfef0('0x9')][_0xfef0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xad43e,_0x11dfd7,_0x5130bd){return new BPromise(function(_0x41ec94,_0x58cf6d){return client[_0xfef0('0xb')](_0xad43e,_0x5130bd)[_0xfef0('0xc')](function(_0x3a81cc){logger[_0xfef0('0xd')](_0xfef0('0xe'),_0x11dfd7,_0xfef0('0xf'));logger[_0xfef0('0x10')](_0xfef0('0x11'),_0x11dfd7,_0xfef0('0xf'),JSON[_0xfef0('0x12')](_0x3a81cc));if(_0x3a81cc[_0xfef0('0x13')]){if(_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x14')]===0x1f4){logger[_0xfef0('0x13')]('Integration,\x20%s,\x20%s',_0x11dfd7,_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x15')]);return _0x58cf6d(_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x15')]);}logger[_0xfef0('0x13')](_0xfef0('0xe'),_0x11dfd7,_0x3a81cc[_0xfef0('0x13')]['message']);return _0x41ec94(_0x3a81cc[_0xfef0('0x13')]['message']);}else{logger['info']('Integration,\x20%s,\x20%s',_0x11dfd7,_0xfef0('0xf'));_0x41ec94(_0x3a81cc[_0xfef0('0x16')][_0xfef0('0x15')]);}})[_0xfef0('0x17')](function(_0x2a96d9){logger[_0xfef0('0x13')](_0xfef0('0xe'),_0x11dfd7,_0x2a96d9);_0x58cf6d(_0x2a96d9);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 9015c73..5d1aa34 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 _0x2542=['put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post'];(function(_0x312ba6,_0x584157){var _0xfe3882=function(_0x5a6deb){while(--_0x5a6deb){_0x312ba6['push'](_0x312ba6['shift']());}};_0xfe3882(++_0x584157);}(_0x2542,0x169));var _0x2254=function(_0x452edb,_0x16dba6){_0x452edb=_0x452edb-0x0;var _0x182554=_0x2542[_0x452edb];return _0x182554;};'use strict';var multer=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var path=require(_0x2254('0x2'));var timeout=require(_0x2254('0x3'));var express=require('express');var router=express[_0x2254('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2254('0x5'));var interaction=require(_0x2254('0x6'));var config=require(_0x2254('0x7'));var controller=require(_0x2254('0x8'));router[_0x2254('0x9')]('/',auth['isAuthenticated'](),controller[_0x2254('0xa')]);router[_0x2254('0x9')](_0x2254('0xb'),auth[_0x2254('0xc')](),controller[_0x2254('0xd')]);router[_0x2254('0x9')](_0x2254('0xe'),auth[_0x2254('0xc')](),controller[_0x2254('0xf')]);router[_0x2254('0x10')]('/',auth[_0x2254('0xc')](),controller['create']);router[_0x2254('0x11')](_0x2254('0xe'),auth[_0x2254('0xc')](),controller[_0x2254('0x12')]);router['delete']('/:id',auth[_0x2254('0xc')](),controller[_0x2254('0x13')]);module[_0x2254('0x14')]=router; \ No newline at end of file +var _0xadb5=['delete','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update'];(function(_0x329d13,_0x1aff27){var _0x33efd9=function(_0x265b7d){while(--_0x265b7d){_0x329d13['push'](_0x329d13['shift']());}};_0x33efd9(++_0x1aff27);}(_0xadb5,0xad));var _0x5adb=function(_0x2163cb,_0x28435f){_0x2163cb=_0x2163cb-0x0;var _0x22411f=_0xadb5[_0x2163cb];return _0x22411f;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./integrationReport.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0xf')]);router['put']('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller['destroy']);module[_0x5adb('0x12')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index f644244..c3ac389 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 _0xe618=['INTEGER','TEXT','SENT','SENDING','FAILED','sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe618,0x1ef));var _0x8e61=function(_0x5e31f3,_0x26086d){_0x5e31f3=_0x5e31f3-0x0;var _0xe8f38b=_0xe618[_0x5e31f3];return _0xe8f38b;};'use strict';var Sequelize=require(_0x8e61('0x0'));module[_0x8e61('0x1')]={'integration':{'type':Sequelize[_0x8e61('0x2')]},'eventChannel':{'type':Sequelize[_0x8e61('0x2')]},'exitStatus':{'type':Sequelize[_0x8e61('0x2')]},'ticketId':{'type':Sequelize[_0x8e61('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0x8e61('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x8e61('0x2')]},'calleridname':{'type':Sequelize[_0x8e61('0x2')]},'queue':{'type':Sequelize[_0x8e61('0x2')]},'interface':{'type':Sequelize[_0x8e61('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x8e61('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x8e61('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x8e61('0x3')]},'talktime':{'type':Sequelize[_0x8e61('0x5')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x8e61('0x5')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x8e61('0x3')]},'agentdump':{'type':Sequelize[_0x8e61('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x8e61('0x3')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x8e61('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x8e61('0x2')]},'connectedlinenum':{'type':Sequelize[_0x8e61('0x2')]},'connectedlinename':{'type':Sequelize[_0x8e61('0x2')]},'language':{'type':Sequelize[_0x8e61('0x2')]},'accountcode':{'type':Sequelize[_0x8e61('0x2')]},'context':{'type':Sequelize[_0x8e61('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x8e61('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x8e61('0x2')]},'destcalleridnum':{'type':Sequelize[_0x8e61('0x2')]},'destcalleridname':{'type':Sequelize[_0x8e61('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x8e61('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x8e61('0x2')]},'destaccountcode':{'type':Sequelize[_0x8e61('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x8e61('0x2')]},'destuniqueid':{'type':Sequelize[_0x8e61('0x2')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x8e61('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x8e61('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x8e61('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x8e61('0x6')]},'status':{'type':Sequelize['ENUM'](_0x8e61('0x7'),_0x8e61('0x8'),'RECEIVED',_0x8e61('0x9'))},'url':{'type':Sequelize[_0x8e61('0x2')]},'app':{'type':Sequelize[_0x8e61('0x2')]},'appdata':{'type':Sequelize[_0x8e61('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x0a2c=['RECEIVED','FAILED','sequelize','STRING','DATE','INTEGER','BOOLEAN','TEXT','SENDING'];(function(_0x45cca0,_0x1e6b16){var _0x368f0d=function(_0x81a5fc){while(--_0x81a5fc){_0x45cca0['push'](_0x45cca0['shift']());}};_0x368f0d(++_0x1e6b16);}(_0x0a2c,0x1df));var _0xc0a2=function(_0x494b06,_0x35776c){_0x494b06=_0x494b06-0x0;var _0x2f4e00=_0x0a2c[_0x494b06];return _0x2f4e00;};'use strict';var Sequelize=require(_0xc0a2('0x0'));module['exports']={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0xc0a2('0x1')]},'exitStatus':{'type':Sequelize[_0xc0a2('0x1')]},'ticketId':{'type':Sequelize[_0xc0a2('0x1')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0xc0a2('0x1')]},'uniqueid':{'type':Sequelize[_0xc0a2('0x1')]},'calleridnum':{'type':Sequelize[_0xc0a2('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xc0a2('0x1')]},'agentcalledAt':{'type':Sequelize[_0xc0a2('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xc0a2('0x3')]},'agentcomplete':{'type':Sequelize[_0xc0a2('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xc0a2('0x2')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xc0a2('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xc0a2('0x3')]},'reason':{'type':Sequelize[_0xc0a2('0x1')]},'agentringnoanswer':{'type':Sequelize[_0xc0a2('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xc0a2('0x2')]},'agentdump':{'type':Sequelize[_0xc0a2('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xc0a2('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xc0a2('0x3')]},'channelstatedesc':{'type':Sequelize[_0xc0a2('0x1')]},'connectedlinenum':{'type':Sequelize[_0xc0a2('0x1')]},'connectedlinename':{'type':Sequelize[_0xc0a2('0x1')]},'language':{'type':Sequelize[_0xc0a2('0x1')]},'accountcode':{'type':Sequelize[_0xc0a2('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xc0a2('0x1')]},'priority':{'type':Sequelize[_0xc0a2('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xc0a2('0x1')]},'destcalleridnum':{'type':Sequelize[_0xc0a2('0x1')]},'destcalleridname':{'type':Sequelize[_0xc0a2('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xc0a2('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xc0a2('0x1')]},'destcontext':{'type':Sequelize[_0xc0a2('0x1')]},'destexten':{'type':Sequelize[_0xc0a2('0x1')]},'destpriority':{'type':Sequelize[_0xc0a2('0x1')]},'destuniqueid':{'type':Sequelize[_0xc0a2('0x1')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0xc0a2('0x1')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xc0a2('0x1')]},'cc':{'type':Sequelize[_0xc0a2('0x1')]},'attachment':{'type':Sequelize[_0xc0a2('0x5')]},'html':{'type':Sequelize[_0xc0a2('0x5')]},'text':{'type':Sequelize[_0xc0a2('0x5')]},'status':{'type':Sequelize['ENUM']('SENT',_0xc0a2('0x6'),_0xc0a2('0x7'),_0xc0a2('0x8'))},'url':{'type':Sequelize[_0xc0a2('0x1')]},'app':{'type':Sequelize[_0xc0a2('0x1')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0xc0a2('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index b3d7f40..d61bd63 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 _0x967e=['query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','filter','merge','options','includeAll','include','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','error','name','send','index','IntegrationReport','rawAttributes','fieldName','key','model','map','keys'];(function(_0x1058f9,_0x11212f){var _0x11f40a=function(_0x1b1f19){while(--_0x1b1f19){_0x1058f9['push'](_0x1058f9['shift']());}};_0x11f40a(++_0x11212f);}(_0x967e,0x14a));var _0xe967=function(_0x13f577,_0x5ea2cb){_0x13f577=_0x13f577-0x0;var _0xde1b7d=_0x967e[_0x13f577];return _0xde1b7d;};'use strict';var emlformat=require(_0xe967('0x0'));var rimraf=require(_0xe967('0x1'));var zipdir=require(_0xe967('0x2'));var jsonpatch=require(_0xe967('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe967('0x4'));var util=require(_0xe967('0x5'));var path=require(_0xe967('0x6'));var sox=require(_0xe967('0x7'));var csv=require(_0xe967('0x8'));var ejs=require(_0xe967('0x9'));var fs=require('fs');var fs_extra=require(_0xe967('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe967('0xb'));var jsforce=require(_0xe967('0xc'));var deskjs=require(_0xe967('0xd'));var toCsv=require(_0xe967('0x8'));var querystring=require(_0xe967('0xe'));var Papa=require(_0xe967('0xf'));var Redis=require(_0xe967('0x10'));var authService=require(_0xe967('0x11'));var qs=require(_0xe967('0x12'));var as=require(_0xe967('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe967('0x14'))(_0xe967('0x15'));var utils=require(_0xe967('0x16'));var config=require(_0xe967('0x17'));var licenseUtil=require(_0xe967('0x18'));var db=require(_0xe967('0x19'))['db'];function respondWithStatusCode(_0x515eae,_0x48709d){_0x48709d=_0x48709d||0xcc;return function(_0x10950f){if(_0x10950f){return _0x515eae[_0xe967('0x1a')](_0x48709d);}return _0x515eae['status'](_0x48709d)[_0xe967('0x1b')]();};}function respondWithResult(_0x52edb6,_0x14b9ad){_0x14b9ad=_0x14b9ad||0xc8;return function(_0x149f5a){if(_0x149f5a){return _0x52edb6[_0xe967('0x1c')](_0x14b9ad)[_0xe967('0x1d')](_0x149f5a);}};}function respondWithFilteredResult(_0x133c00,_0x596d15){return function(_0x144bc1){if(_0x144bc1){var _0x425096=typeof _0x596d15['offset']===_0xe967('0x1e')&&typeof _0x596d15[_0xe967('0x1f')]===_0xe967('0x1e');var _0x45fe1a=_0x144bc1[_0xe967('0x20')];var _0x2292e1=_0x425096?0x0:_0x596d15['offset'];var _0xbe9152=_0x425096?_0x144bc1['count']:_0x596d15[_0xe967('0x21')]+_0x596d15[_0xe967('0x1f')];var _0x4a17f1;if(_0xbe9152>=_0x45fe1a){_0xbe9152=_0x45fe1a;_0x4a17f1=0xc8;}else{_0x4a17f1=0xce;}_0x133c00[_0xe967('0x1c')](_0x4a17f1);return _0x133c00[_0xe967('0x22')](_0xe967('0x23'),_0x2292e1+'-'+_0xbe9152+'/'+_0x45fe1a)[_0xe967('0x1d')](_0x144bc1);}return null;};}function patchUpdates(_0x577d37){return function(_0x4c0a26){try{jsonpatch['apply'](_0x4c0a26,_0x577d37,!![]);}catch(_0x5b78ee){return BPromise[_0xe967('0x24')](_0x5b78ee);}return _0x4c0a26[_0xe967('0x25')]();};}function saveUpdates(_0x5b21fd,_0x3ff4a3){return function(_0x5b6c50){if(_0x5b6c50){return _0x5b6c50['update'](_0x5b21fd)[_0xe967('0x26')](function(_0x39ec67){return _0x39ec67;});}return null;};}function removeEntity(_0x1c7b92,_0x24e2f8){return function(_0x29cfea){if(_0x29cfea){return _0x29cfea['destroy']()['then'](function(){_0x1c7b92[_0xe967('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c9749,_0x40712a){return function(_0x5734c5){if(!_0x5734c5){_0x2c9749[_0xe967('0x1a')](0x194);}return _0x5734c5;};}function handleError(_0x10e43d,_0x3b4e6e){_0x3b4e6e=_0x3b4e6e||0x1f4;return function(_0x2da55e){logger[_0xe967('0x27')](_0x2da55e['stack']);if(_0x2da55e[_0xe967('0x28')]){delete _0x2da55e[_0xe967('0x28')];}_0x10e43d['status'](_0x3b4e6e)[_0xe967('0x29')](_0x2da55e);};}exports[_0xe967('0x2a')]=function(_0x6ddf4d,_0x39f79c){var _0xd3895a={},_0x12fa62={},_0x3266e8={'count':0x0,'rows':[]};var _0x420349=_['map'](db[_0xe967('0x2b')][_0xe967('0x2c')],function(_0x46f0bc){return{'name':_0x46f0bc[_0xe967('0x2d')],'type':_0x46f0bc['type'][_0xe967('0x2e')]};});_0x12fa62[_0xe967('0x2f')]=_[_0xe967('0x30')](_0x420349,_0xe967('0x28'));_0x12fa62['query']=_[_0xe967('0x31')](_0x6ddf4d[_0xe967('0x32')]);_0x12fa62[_0xe967('0x33')]=_[_0xe967('0x34')](_0x12fa62['model'],_0x12fa62[_0xe967('0x32')]);_0xd3895a[_0xe967('0x35')]=_[_0xe967('0x34')](_0x12fa62[_0xe967('0x2f')],qs[_0xe967('0x36')](_0x6ddf4d[_0xe967('0x32')][_0xe967('0x36')]));_0xd3895a['attributes']=_0xd3895a['attributes'][_0xe967('0x37')]?_0xd3895a[_0xe967('0x35')]:_0x12fa62[_0xe967('0x2f')];if(!_0x6ddf4d[_0xe967('0x32')][_0xe967('0x38')](_0xe967('0x39'))){_0xd3895a[_0xe967('0x1f')]=qs[_0xe967('0x1f')](_0x6ddf4d[_0xe967('0x32')][_0xe967('0x1f')]);_0xd3895a[_0xe967('0x21')]=qs[_0xe967('0x21')](_0x6ddf4d[_0xe967('0x32')][_0xe967('0x21')]);}_0xd3895a[_0xe967('0x3a')]=qs['sort'](_0x6ddf4d[_0xe967('0x32')][_0xe967('0x3b')]);_0xd3895a[_0xe967('0x3c')]=qs[_0xe967('0x33')](_[_0xe967('0x3d')](_0x6ddf4d['query'],_0x12fa62['filters']),_0x420349);if(_0x6ddf4d[_0xe967('0x32')]['filter']){_0xd3895a['where']=_['merge'](_0xd3895a[_0xe967('0x3c')],{'$or':_[_0xe967('0x30')](_0x420349,function(_0xb5d77e){if(_0xb5d77e[_0xe967('0x3e')]!=='VIRTUAL'){var _0x49673a={};_0x49673a[_0xb5d77e['name']]={'$like':'%'+_0x6ddf4d[_0xe967('0x32')][_0xe967('0x3f')]+'%'};return _0x49673a;}})});}_0xd3895a=_[_0xe967('0x40')]({},_0xd3895a,_0x6ddf4d[_0xe967('0x41')]);var _0x3da51e={'where':_0xd3895a[_0xe967('0x3c')]};return db[_0xe967('0x2b')][_0xe967('0x20')](_0x3da51e)[_0xe967('0x26')](function(_0x4b7991){_0x3266e8[_0xe967('0x20')]=_0x4b7991;if(_0x6ddf4d['query'][_0xe967('0x42')]){_0xd3895a[_0xe967('0x43')]=[{'all':!![]}];}return db['IntegrationReport']['findAll'](_0xd3895a);})[_0xe967('0x26')](function(_0x330c34){_0x3266e8[_0xe967('0x44')]=_0x330c34;return _0x3266e8;})['then'](respondWithFilteredResult(_0x39f79c,_0xd3895a))[_0xe967('0x45')](handleError(_0x39f79c,null));};exports[_0xe967('0x46')]=function(_0x1437d9,_0x396a0e){var _0x3d3436={'raw':![],'where':{'id':_0x1437d9[_0xe967('0x47')]['id']}},_0x3cbbd1={};_0x3cbbd1[_0xe967('0x2f')]=_['keys'](db[_0xe967('0x2b')][_0xe967('0x2c')]);_0x3cbbd1[_0xe967('0x32')]=_[_0xe967('0x31')](_0x1437d9[_0xe967('0x32')]);_0x3cbbd1[_0xe967('0x33')]=_[_0xe967('0x34')](_0x3cbbd1['model'],_0x3cbbd1[_0xe967('0x32')]);_0x3d3436[_0xe967('0x35')]=_[_0xe967('0x34')](_0x3cbbd1[_0xe967('0x2f')],qs[_0xe967('0x36')](_0x1437d9[_0xe967('0x32')]['fields']));_0x3d3436[_0xe967('0x35')]=_0x3d3436['attributes']['length']?_0x3d3436[_0xe967('0x35')]:_0x3cbbd1[_0xe967('0x2f')];if(_0x1437d9[_0xe967('0x32')][_0xe967('0x42')]){_0x3d3436[_0xe967('0x43')]=[{'all':!![]}];}_0x3d3436=_[_0xe967('0x40')]({},_0x3d3436,_0x1437d9[_0xe967('0x41')]);return db[_0xe967('0x2b')][_0xe967('0x48')](_0x3d3436)[_0xe967('0x26')](handleEntityNotFound(_0x396a0e,null))[_0xe967('0x26')](respondWithResult(_0x396a0e,null))[_0xe967('0x45')](handleError(_0x396a0e,null));};exports[_0xe967('0x49')]=function(_0x4b09a2,_0x17a82d){return db[_0xe967('0x2b')]['create'](_0x4b09a2[_0xe967('0x4a')],{})[_0xe967('0x26')](respondWithResult(_0x17a82d,0xc9))[_0xe967('0x45')](handleError(_0x17a82d,null));};exports['update']=function(_0x2ddcb7,_0x34cd76){if(_0x2ddcb7['body']['id']){delete _0x2ddcb7['body']['id'];}return db['IntegrationReport']['find']({'where':{'id':_0x2ddcb7[_0xe967('0x47')]['id']}})[_0xe967('0x26')](handleEntityNotFound(_0x34cd76,null))['then'](saveUpdates(_0x2ddcb7[_0xe967('0x4a')],null))[_0xe967('0x26')](respondWithResult(_0x34cd76,null))[_0xe967('0x45')](handleError(_0x34cd76,null));};exports['destroy']=function(_0x2388f1,_0x20171a){return db['IntegrationReport']['find']({'where':{'id':_0x2388f1[_0xe967('0x47')]['id']}})['then'](handleEntityNotFound(_0x20171a,null))['then'](removeEntity(_0x20171a,null))[_0xe967('0x45')](handleError(_0x20171a,null));};exports[_0xe967('0x4b')]=function(_0x48612e,_0x54f157){return db[_0xe967('0x2b')]['describe']()[_0xe967('0x26')](respondWithResult(_0x54f157,null))[_0xe967('0x45')](handleError(_0x54f157,null));}; \ No newline at end of file +var _0x9a78=['intersection','fields','length','limit','sort','pick','filter','where','merge','options','includeAll','include','IntegrationReport','findAll','rows','then','catch','show','params','find','create','body','describe','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','filters','attributes'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x9a78,0xfb));var _0x89a7=function(_0x54987c,_0x49fa54){_0x54987c=_0x54987c-0x0;var _0x3bba06=_0x9a78[_0x54987c];return _0x3bba06;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x89a7('0x0'));var zipdir=require(_0x89a7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x89a7('0x2'));var moment=require(_0x89a7('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x89a7('0x4'));var util=require('util');var path=require(_0x89a7('0x5'));var sox=require(_0x89a7('0x6'));var csv=require(_0x89a7('0x7'));var ejs=require(_0x89a7('0x8'));var fs=require('fs');var fs_extra=require(_0x89a7('0x9'));var _=require(_0x89a7('0xa'));var squel=require('squel');var crypto=require(_0x89a7('0xb'));var jsforce=require(_0x89a7('0xc'));var deskjs=require(_0x89a7('0xd'));var toCsv=require(_0x89a7('0x7'));var querystring=require(_0x89a7('0xe'));var Papa=require(_0x89a7('0xf'));var Redis=require(_0x89a7('0x10'));var authService=require(_0x89a7('0x11'));var qs=require(_0x89a7('0x12'));var as=require(_0x89a7('0x13'));var hardwareService=require(_0x89a7('0x14'));var logger=require(_0x89a7('0x15'))(_0x89a7('0x16'));var utils=require('../../config/utils');var config=require(_0x89a7('0x17'));var licenseUtil=require(_0x89a7('0x18'));var db=require(_0x89a7('0x19'))['db'];function respondWithStatusCode(_0x64fb58,_0x2e24e1){_0x2e24e1=_0x2e24e1||0xcc;return function(_0xe78821){if(_0xe78821){return _0x64fb58['sendStatus'](_0x2e24e1);}return _0x64fb58[_0x89a7('0x1a')](_0x2e24e1)[_0x89a7('0x1b')]();};}function respondWithResult(_0x42a213,_0x5b9e7c){_0x5b9e7c=_0x5b9e7c||0xc8;return function(_0x518df7){if(_0x518df7){return _0x42a213[_0x89a7('0x1a')](_0x5b9e7c)[_0x89a7('0x1c')](_0x518df7);}};}function respondWithFilteredResult(_0xe0c0ab,_0x1d5513){return function(_0x256fdf){if(_0x256fdf){var _0x1b78fb=typeof _0x1d5513[_0x89a7('0x1d')]===_0x89a7('0x1e')&&typeof _0x1d5513['limit']===_0x89a7('0x1e');var _0x13ae43=_0x256fdf['count'];var _0xa52046=_0x1b78fb?0x0:_0x1d5513[_0x89a7('0x1d')];var _0x37f55b=_0x1b78fb?_0x256fdf[_0x89a7('0x1f')]:_0x1d5513[_0x89a7('0x1d')]+_0x1d5513['limit'];var _0x234ecd;if(_0x37f55b>=_0x13ae43){_0x37f55b=_0x13ae43;_0x234ecd=0xc8;}else{_0x234ecd=0xce;}_0xe0c0ab[_0x89a7('0x1a')](_0x234ecd);return _0xe0c0ab[_0x89a7('0x20')](_0x89a7('0x21'),_0xa52046+'-'+_0x37f55b+'/'+_0x13ae43)[_0x89a7('0x1c')](_0x256fdf);}return null;};}function patchUpdates(_0x495f9d){return function(_0x52349d){try{jsonpatch[_0x89a7('0x22')](_0x52349d,_0x495f9d,!![]);}catch(_0x290a48){return BPromise[_0x89a7('0x23')](_0x290a48);}return _0x52349d[_0x89a7('0x24')]();};}function saveUpdates(_0x3456af,_0x330e5c){return function(_0x56784e){if(_0x56784e){return _0x56784e[_0x89a7('0x25')](_0x3456af)['then'](function(_0x2ad16a){return _0x2ad16a;});}return null;};}function removeEntity(_0x4ad911,_0x3e88e8){return function(_0x3622cb){if(_0x3622cb){return _0x3622cb[_0x89a7('0x26')]()['then'](function(){_0x4ad911[_0x89a7('0x1a')](0xcc)[_0x89a7('0x1b')]();});}};}function handleEntityNotFound(_0x53eb4a,_0x3926e1){return function(_0x232b44){if(!_0x232b44){_0x53eb4a[_0x89a7('0x27')](0x194);}return _0x232b44;};}function handleError(_0x2a08e1,_0x379558){_0x379558=_0x379558||0x1f4;return function(_0x558384){logger['error'](_0x558384[_0x89a7('0x28')]);if(_0x558384[_0x89a7('0x29')]){delete _0x558384['name'];}_0x2a08e1[_0x89a7('0x1a')](_0x379558)[_0x89a7('0x2a')](_0x558384);};}exports[_0x89a7('0x2b')]=function(_0x11383c,_0x569d6a){var _0x4c9bce={},_0x3ea7f0={},_0x25b234={'count':0x0,'rows':[]};var _0x414774=_[_0x89a7('0x2c')](db['IntegrationReport'][_0x89a7('0x2d')],function(_0x459ae6){return{'name':_0x459ae6[_0x89a7('0x2e')],'type':_0x459ae6[_0x89a7('0x2f')]['key']};});_0x3ea7f0[_0x89a7('0x30')]=_['map'](_0x414774,_0x89a7('0x29'));_0x3ea7f0['query']=_[_0x89a7('0x31')](_0x11383c[_0x89a7('0x32')]);_0x3ea7f0[_0x89a7('0x33')]=_['intersection'](_0x3ea7f0[_0x89a7('0x30')],_0x3ea7f0[_0x89a7('0x32')]);_0x4c9bce[_0x89a7('0x34')]=_[_0x89a7('0x35')](_0x3ea7f0[_0x89a7('0x30')],qs[_0x89a7('0x36')](_0x11383c[_0x89a7('0x32')]['fields']));_0x4c9bce[_0x89a7('0x34')]=_0x4c9bce['attributes'][_0x89a7('0x37')]?_0x4c9bce[_0x89a7('0x34')]:_0x3ea7f0[_0x89a7('0x30')];if(!_0x11383c[_0x89a7('0x32')]['hasOwnProperty']('nolimit')){_0x4c9bce[_0x89a7('0x38')]=qs[_0x89a7('0x38')](_0x11383c[_0x89a7('0x32')][_0x89a7('0x38')]);_0x4c9bce['offset']=qs['offset'](_0x11383c[_0x89a7('0x32')][_0x89a7('0x1d')]);}_0x4c9bce['order']=qs[_0x89a7('0x39')](_0x11383c[_0x89a7('0x32')][_0x89a7('0x39')]);_0x4c9bce['where']=qs[_0x89a7('0x33')](_[_0x89a7('0x3a')](_0x11383c[_0x89a7('0x32')],_0x3ea7f0[_0x89a7('0x33')]),_0x414774);if(_0x11383c[_0x89a7('0x32')][_0x89a7('0x3b')]){_0x4c9bce[_0x89a7('0x3c')]=_[_0x89a7('0x3d')](_0x4c9bce[_0x89a7('0x3c')],{'$or':_[_0x89a7('0x2c')](_0x414774,function(_0x4e73c6){if(_0x4e73c6[_0x89a7('0x2f')]!=='VIRTUAL'){var _0x4c41d9={};_0x4c41d9[_0x4e73c6[_0x89a7('0x29')]]={'$like':'%'+_0x11383c['query']['filter']+'%'};return _0x4c41d9;}})});}_0x4c9bce=_[_0x89a7('0x3d')]({},_0x4c9bce,_0x11383c[_0x89a7('0x3e')]);var _0xe49e52={'where':_0x4c9bce[_0x89a7('0x3c')]};return db['IntegrationReport'][_0x89a7('0x1f')](_0xe49e52)['then'](function(_0xa5b935){_0x25b234['count']=_0xa5b935;if(_0x11383c[_0x89a7('0x32')][_0x89a7('0x3f')]){_0x4c9bce[_0x89a7('0x40')]=[{'all':!![]}];}return db[_0x89a7('0x41')][_0x89a7('0x42')](_0x4c9bce);})['then'](function(_0x2f45aa){_0x25b234[_0x89a7('0x43')]=_0x2f45aa;return _0x25b234;})[_0x89a7('0x44')](respondWithFilteredResult(_0x569d6a,_0x4c9bce))[_0x89a7('0x45')](handleError(_0x569d6a,null));};exports[_0x89a7('0x46')]=function(_0x4e3f3d,_0x545ecf){var _0x285103={'raw':![],'where':{'id':_0x4e3f3d[_0x89a7('0x47')]['id']}},_0x97840a={};_0x97840a[_0x89a7('0x30')]=_[_0x89a7('0x31')](db[_0x89a7('0x41')]['rawAttributes']);_0x97840a['query']=_[_0x89a7('0x31')](_0x4e3f3d['query']);_0x97840a[_0x89a7('0x33')]=_[_0x89a7('0x35')](_0x97840a[_0x89a7('0x30')],_0x97840a[_0x89a7('0x32')]);_0x285103[_0x89a7('0x34')]=_[_0x89a7('0x35')](_0x97840a[_0x89a7('0x30')],qs['fields'](_0x4e3f3d[_0x89a7('0x32')]['fields']));_0x285103[_0x89a7('0x34')]=_0x285103['attributes'][_0x89a7('0x37')]?_0x285103[_0x89a7('0x34')]:_0x97840a[_0x89a7('0x30')];if(_0x4e3f3d[_0x89a7('0x32')]['includeAll']){_0x285103[_0x89a7('0x40')]=[{'all':!![]}];}_0x285103=_['merge']({},_0x285103,_0x4e3f3d['options']);return db['IntegrationReport'][_0x89a7('0x48')](_0x285103)[_0x89a7('0x44')](handleEntityNotFound(_0x545ecf,null))[_0x89a7('0x44')](respondWithResult(_0x545ecf,null))['catch'](handleError(_0x545ecf,null));};exports[_0x89a7('0x49')]=function(_0x4c4991,_0x786ead){return db['IntegrationReport']['create'](_0x4c4991[_0x89a7('0x4a')],{})[_0x89a7('0x44')](respondWithResult(_0x786ead,0xc9))[_0x89a7('0x45')](handleError(_0x786ead,null));};exports['update']=function(_0x4137b2,_0x1055de){if(_0x4137b2[_0x89a7('0x4a')]['id']){delete _0x4137b2[_0x89a7('0x4a')]['id'];}return db[_0x89a7('0x41')][_0x89a7('0x48')]({'where':{'id':_0x4137b2[_0x89a7('0x47')]['id']}})['then'](handleEntityNotFound(_0x1055de,null))[_0x89a7('0x44')](saveUpdates(_0x4137b2[_0x89a7('0x4a')],null))[_0x89a7('0x44')](respondWithResult(_0x1055de,null))[_0x89a7('0x45')](handleError(_0x1055de,null));};exports[_0x89a7('0x26')]=function(_0x10c155,_0x4585d0){return db[_0x89a7('0x41')]['find']({'where':{'id':_0x10c155['params']['id']}})['then'](handleEntityNotFound(_0x4585d0,null))[_0x89a7('0x44')](removeEntity(_0x4585d0,null))[_0x89a7('0x45')](handleError(_0x4585d0,null));};exports['describe']=function(_0x5debb0,_0x40424d){return db[_0x89a7('0x41')][_0x89a7('0x4b')]()[_0x89a7('0x44')](respondWithResult(_0x40424d,null))[_0x89a7('0x45')](handleError(_0x40424d,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index ab5a4a9..aa23e37 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 _0xc56e=['define','IntegrationReport','report_integration','util','../../config/logger','api','bluebird','path','rimraf','./integrationReport.attributes','exports'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xc56e,0x158));var _0xec56=function(_0xeb63b,_0x1403f5){_0xeb63b=_0xeb63b-0x0;var _0x1f2722=_0xc56e[_0xeb63b];return _0x1f2722;};'use strict';var _=require('lodash');var util=require(_0xec56('0x0'));var logger=require(_0xec56('0x1'))(_0xec56('0x2'));var moment=require('moment');var BPromise=require(_0xec56('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xec56('0x4'));var rimraf=require(_0xec56('0x5'));var config=require('../../config/environment');var attributes=require(_0xec56('0x6'));module[_0xec56('0x7')]=function(_0x1e77c2,_0x3af276){return _0x1e77c2[_0xec56('0x8')](_0xec56('0x9'),attributes,{'tableName':_0xec56('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f0d=['define','report_integration','util','../../config/logger','api','moment','bluebird','exports'];(function(_0xdeafdd,_0x26e6f4){var _0x18be12=function(_0x28d610){while(--_0x28d610){_0xdeafdd['push'](_0xdeafdd['shift']());}};_0x18be12(++_0x26e6f4);}(_0x6f0d,0x142));var _0xd6f0=function(_0x25bbdd,_0x4137ed){_0x25bbdd=_0x25bbdd-0x0;var _0x20ec55=_0x6f0d[_0x25bbdd];return _0x20ec55;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var logger=require(_0xd6f0('0x1'))(_0xd6f0('0x2'));var moment=require(_0xd6f0('0x3'));var BPromise=require(_0xd6f0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./integrationReport.attributes');module[_0xd6f0('0x5')]=function(_0x232be2,_0x19f46c){return _0x232be2[_0xd6f0('0x6')]('IntegrationReport',attributes,{'tableName':_0xd6f0('0x7'),'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 8e07b34..4926993 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(_0x105c6a,_0x48c736){var _0x5b844d=function(_0x181f09){while(--_0x181f09){_0x105c6a['push'](_0x105c6a['shift']());}};_0x5b844d(++_0x48c736);}(_0x5fab,0x177));var _0xb5fa=function(_0x294b7a,_0x51b167){_0x294b7a=_0x294b7a-0x0;var _0x30d2a3=_0x5fab[_0x294b7a];return _0x30d2a3;};'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 _0x31f0=['../../config/environment','request','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x1c9671,_0x3cf964){var _0x1dd552=function(_0x4e5c7f){while(--_0x4e5c7f){_0x1c9671['push'](_0x1c9671['shift']());}};_0x1dd552(++_0x3cf964);}(_0x31f0,0xb7));var _0x031f=function(_0x1a8ccd,_0x2ce1a5){_0x1a8ccd=_0x1a8ccd-0x0;var _0x28743f=_0x31f0[_0x1a8ccd];return _0x28743f;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var moment=require(_0x031f('0x1'));var BPromise=require('bluebird');var rs=require(_0x031f('0x2'));var fs=require('fs');var Redis=require(_0x031f('0x3'));var db=require(_0x031f('0x4'))['db'];var utils=require(_0x031f('0x5'));var logger=require('../../config/logger')(_0x031f('0x6'));var config=require(_0x031f('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3dc98e,_0x487e65,_0x365f59){return new BPromise(function(_0x4300b4,_0x2569b6){return client[_0x031f('0x8')](_0x3dc98e,_0x365f59)['then'](function(_0x2e5624){logger[_0x031f('0x9')](_0x031f('0xa'),_0x487e65,_0x031f('0xb'));logger[_0x031f('0xc')](_0x031f('0xd'),_0x487e65,_0x031f('0xb'),JSON[_0x031f('0xe')](_0x2e5624));if(_0x2e5624['error']){if(_0x2e5624[_0x031f('0xf')][_0x031f('0x10')]===0x1f4){logger[_0x031f('0xf')](_0x031f('0xa'),_0x487e65,_0x2e5624[_0x031f('0xf')][_0x031f('0x11')]);return _0x2569b6(_0x2e5624[_0x031f('0xf')]['message']);}logger[_0x031f('0xf')](_0x031f('0xa'),_0x487e65,_0x2e5624[_0x031f('0xf')][_0x031f('0x11')]);return _0x4300b4(_0x2e5624[_0x031f('0xf')]['message']);}else{logger['info'](_0x031f('0xa'),_0x487e65,_0x031f('0xb'));_0x4300b4(_0x2e5624[_0x031f('0x12')][_0x031f('0x11')]);}})['catch'](function(_0x1dc4a7){logger[_0x031f('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x487e65,_0x1dc4a7);_0x2569b6(_0x1dc4a7);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 91b7734..982eeec 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 _0xdca7=['isAuthenticated','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','put','/:id','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','./interval.controller','get','show','/:id/sub_intervals'];(function(_0x256422,_0x2cdf18){var _0x41d8b3=function(_0x1f20ac){while(--_0x1f20ac){_0x256422['push'](_0x256422['shift']());}};_0x41d8b3(++_0x2cdf18);}(_0xdca7,0xe6));var _0x7dca=function(_0x32a4c3,_0x5396f9){_0x32a4c3=_0x32a4c3-0x0;var _0x47979f=_0xdca7[_0x32a4c3];return _0x47979f;};'use strict';var multer=require(_0x7dca('0x0'));var util=require('util');var path=require(_0x7dca('0x1'));var timeout=require(_0x7dca('0x2'));var express=require(_0x7dca('0x3'));var router=express['Router']();var fs_extra=require(_0x7dca('0x4'));var auth=require(_0x7dca('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7dca('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x7dca('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x7dca('0x8')]);router[_0x7dca('0x7')](_0x7dca('0x9'),auth[_0x7dca('0xa')](),controller[_0x7dca('0xb')]);router[_0x7dca('0xc')]('/',auth[_0x7dca('0xa')](),controller[_0x7dca('0xd')]);router[_0x7dca('0xc')](_0x7dca('0x9'),auth[_0x7dca('0xa')](),controller[_0x7dca('0xe')]);router['post'](_0x7dca('0xf'),auth[_0x7dca('0xa')](),controller['addIntervals']);router[_0x7dca('0x10')](_0x7dca('0x11'),auth[_0x7dca('0xa')](),controller['update']);router['delete'](_0x7dca('0x11'),auth[_0x7dca('0xa')](),controller[_0x7dca('0x12')]);module[_0x7dca('0x13')]=router; \ No newline at end of file +var _0x3b74=['isAuthenticated','index','/:id','/:id/sub_intervals','getIntervals','post','create','/:id/sub_intervals/create_many','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./interval.controller','get'];(function(_0x3bd53e,_0x456399){var _0x42797c=function(_0x284c93){while(--_0x284c93){_0x3bd53e['push'](_0x3bd53e['shift']());}};_0x42797c(++_0x456399);}(_0x3b74,0x80));var _0x43b7=function(_0x2a7e6f,_0x3418c5){_0x2a7e6f=_0x2a7e6f-0x0;var _0x4e4167=_0x3b74[_0x2a7e6f];return _0x4e4167;};'use strict';var multer=require(_0x43b7('0x0'));var util=require(_0x43b7('0x1'));var path=require(_0x43b7('0x2'));var timeout=require(_0x43b7('0x3'));var express=require('express');var router=express[_0x43b7('0x4')]();var fs_extra=require(_0x43b7('0x5'));var auth=require(_0x43b7('0x6'));var interaction=require(_0x43b7('0x7'));var config=require('../../config/environment');var controller=require(_0x43b7('0x8'));router[_0x43b7('0x9')]('/',auth[_0x43b7('0xa')](),controller[_0x43b7('0xb')]);router[_0x43b7('0x9')](_0x43b7('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x43b7('0x9')](_0x43b7('0xd'),auth['isAuthenticated'](),controller[_0x43b7('0xe')]);router[_0x43b7('0xf')]('/',auth['isAuthenticated'](),controller[_0x43b7('0x10')]);router['post'](_0x43b7('0xd'),auth[_0x43b7('0xa')](),controller['addInterval']);router['post'](_0x43b7('0x11'),auth[_0x43b7('0xa')](),controller['addIntervals']);router[_0x43b7('0x12')]('/:id',auth[_0x43b7('0xa')](),controller[_0x43b7('0x13')]);router[_0x43b7('0x14')]('/:id',auth[_0x43b7('0xa')](),controller[_0x43b7('0x15')]);module[_0x43b7('0x16')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 33c918c..5acc6af 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 _0xdc69=['exports','STRING','sequelize'];(function(_0x5154fa,_0x3667fe){var _0x488ad9=function(_0x343d56){while(--_0x343d56){_0x5154fa['push'](_0x5154fa['shift']());}};_0x488ad9(++_0x3667fe);}(_0xdc69,0x122));var _0x9dc6=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0xdc69[_0x2555d0];return _0x3bb486;};'use strict';var Sequelize=require(_0x9dc6('0x0'));module[_0x9dc6('0x1')]={'name':{'type':Sequelize[_0x9dc6('0x2')]},'description':{'type':Sequelize[_0x9dc6('0x2')]},'interval':{'type':Sequelize[_0x9dc6('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x5190=['STRING','sequelize','exports'];(function(_0x7be910,_0x2b381b){var _0x496ddf=function(_0x3ac518){while(--_0x3ac518){_0x7be910['push'](_0x7be910['shift']());}};_0x496ddf(++_0x2b381b);}(_0x5190,0x82));var _0x0519=function(_0x16bb4b,_0x5fe431){_0x16bb4b=_0x16bb4b-0x0;var _0x8aeb84=_0x5190[_0x16bb4b];return _0x8aeb84;};'use strict';var Sequelize=require(_0x0519('0x0'));module[_0x0519('0x1')]={'name':{'type':Sequelize[_0x0519('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0519('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 1ffca4e..6074a64 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 _0xb53d=['fieldName','type','key','model','map','query','filters','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','intersection','merge','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','addInterval','IntervalId','findOne','order','pick','getIntervals','addIntervals','transaction','findAll','rimraf','zip-dir','request-promise','moment','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','save','update','then','get','Intervals','UserProfileResource','error','name','index','Interval','rawAttributes'];(function(_0x1880ad,_0x47cb55){var _0x3c8b35=function(_0x525a7d){while(--_0x525a7d){_0x1880ad['push'](_0x1880ad['shift']());}};_0x3c8b35(++_0x47cb55);}(_0xb53d,0x88));var _0xdb53=function(_0xfc01a3,_0x1376a5){_0xfc01a3=_0xfc01a3-0x0;var _0x1983a5=_0xb53d[_0xfc01a3];return _0x1983a5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdb53('0x0'));var zipdir=require(_0xdb53('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdb53('0x2'));var moment=require(_0xdb53('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xdb53('0x4'));var sox=require(_0xdb53('0x5'));var csv=require('to-csv');var ejs=require(_0xdb53('0x6'));var fs=require('fs');var fs_extra=require(_0xdb53('0x7'));var _=require('lodash');var squel=require(_0xdb53('0x8'));var crypto=require('crypto');var jsforce=require(_0xdb53('0x9'));var deskjs=require(_0xdb53('0xa'));var toCsv=require(_0xdb53('0xb'));var querystring=require(_0xdb53('0xc'));var Papa=require(_0xdb53('0xd'));var Redis=require(_0xdb53('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xdb53('0xf'));var as=require(_0xdb53('0x10'));var hardwareService=require(_0xdb53('0x11'));var logger=require(_0xdb53('0x12'))(_0xdb53('0x13'));var utils=require(_0xdb53('0x14'));var config=require(_0xdb53('0x15'));var licenseUtil=require(_0xdb53('0x16'));var db=require(_0xdb53('0x17'))['db'];var extensions=require(_0xdb53('0x18'));function respondWithStatusCode(_0x49b62,_0x403954){_0x403954=_0x403954||0xcc;return function(_0xfbdbf0){if(_0xfbdbf0){return _0x49b62[_0xdb53('0x19')](_0x403954);}return _0x49b62[_0xdb53('0x1a')](_0x403954)[_0xdb53('0x1b')]();};}function respondWithResult(_0x4fd16a,_0x562d45){_0x562d45=_0x562d45||0xc8;return function(_0x7b2b82){if(_0x7b2b82){return _0x4fd16a[_0xdb53('0x1a')](_0x562d45)[_0xdb53('0x1c')](_0x7b2b82);}};}function respondWithFilteredResult(_0x1ac0fc,_0x4a3b70){return function(_0x8ab050){if(_0x8ab050){var _0x1d706=typeof _0x4a3b70[_0xdb53('0x1d')]===_0xdb53('0x1e')&&typeof _0x4a3b70['limit']===_0xdb53('0x1e');var _0x252f57=_0x8ab050[_0xdb53('0x1f')];var _0x31185a=_0x1d706?0x0:_0x4a3b70['offset'];var _0x4dac27=_0x1d706?_0x8ab050[_0xdb53('0x1f')]:_0x4a3b70[_0xdb53('0x1d')]+_0x4a3b70[_0xdb53('0x20')];var _0x1178db;if(_0x4dac27>=_0x252f57){_0x4dac27=_0x252f57;_0x1178db=0xc8;}else{_0x1178db=0xce;}_0x1ac0fc[_0xdb53('0x1a')](_0x1178db);return _0x1ac0fc[_0xdb53('0x21')](_0xdb53('0x22'),_0x31185a+'-'+_0x4dac27+'/'+_0x252f57)[_0xdb53('0x1c')](_0x8ab050);}return null;};}function patchUpdates(_0x158655){return function(_0x22e876){try{jsonpatch['apply'](_0x22e876,_0x158655,!![]);}catch(_0x3da73f){return BPromise['reject'](_0x3da73f);}return _0x22e876[_0xdb53('0x23')]();};}function saveUpdates(_0x15059c,_0xba99c2){return function(_0x28f78f){if(_0x28f78f){return _0x28f78f[_0xdb53('0x24')](_0x15059c)[_0xdb53('0x25')](function(_0x1083de){return _0x1083de;});}return null;};}function removeEntity(_0x2ba12d,_0x1bfef7){return function(_0x464f5f){if(_0x464f5f){return _0x464f5f['destroy']()[_0xdb53('0x25')](function(){var _0x10ef5f=_0x464f5f[_0xdb53('0x26')]({'plain':!![]});var _0x571066=_0xdb53('0x27');return db[_0xdb53('0x28')]['destroy']({'where':{'type':_0x571066,'resourceId':_0x10ef5f['id']}})[_0xdb53('0x25')](function(){return _0x464f5f;});})[_0xdb53('0x25')](function(){_0x2ba12d['status'](0xcc)[_0xdb53('0x1b')]();});}};}function handleEntityNotFound(_0x4738cf,_0x1a43e3){return function(_0x3db9d2){if(!_0x3db9d2){_0x4738cf['sendStatus'](0x194);}return _0x3db9d2;};}function handleError(_0x3caf76,_0x4ac54e){_0x4ac54e=_0x4ac54e||0x1f4;return function(_0x5af183){logger[_0xdb53('0x29')](_0x5af183['stack']);if(_0x5af183[_0xdb53('0x2a')]){delete _0x5af183[_0xdb53('0x2a')];}_0x3caf76['status'](_0x4ac54e)['send'](_0x5af183);};}exports[_0xdb53('0x2b')]=function(_0x5b85e0,_0x424277){var _0x3d9643={},_0x1d1790={},_0x198729={'count':0x0,'rows':[]};var _0x523ead=_['map'](db[_0xdb53('0x2c')][_0xdb53('0x2d')],function(_0x37cba0){return{'name':_0x37cba0[_0xdb53('0x2e')],'type':_0x37cba0[_0xdb53('0x2f')][_0xdb53('0x30')]};});_0x1d1790[_0xdb53('0x31')]=_[_0xdb53('0x32')](_0x523ead,_0xdb53('0x2a'));_0x1d1790['query']=_['keys'](_0x5b85e0[_0xdb53('0x33')]);_0x1d1790[_0xdb53('0x34')]=_['intersection'](_0x1d1790[_0xdb53('0x31')],_0x1d1790[_0xdb53('0x33')]);_0x3d9643['attributes']=_['intersection'](_0x1d1790['model'],qs[_0xdb53('0x35')](_0x5b85e0[_0xdb53('0x33')]['fields']));_0x3d9643[_0xdb53('0x36')]=_0x3d9643[_0xdb53('0x36')][_0xdb53('0x37')]?_0x3d9643[_0xdb53('0x36')]:_0x1d1790['model'];if(!_0x5b85e0['query'][_0xdb53('0x38')](_0xdb53('0x39'))){_0x3d9643[_0xdb53('0x20')]=qs[_0xdb53('0x20')](_0x5b85e0[_0xdb53('0x33')]['limit']);_0x3d9643['offset']=qs['offset'](_0x5b85e0[_0xdb53('0x33')]['offset']);}_0x3d9643['order']=qs[_0xdb53('0x3a')](_0x5b85e0[_0xdb53('0x33')]['sort']);_0x3d9643[_0xdb53('0x3b')]=qs[_0xdb53('0x34')](_['pick'](_0x5b85e0['query'],_0x1d1790[_0xdb53('0x34')]),_0x523ead);if(_0x5b85e0[_0xdb53('0x33')][_0xdb53('0x3c')]){_0x3d9643['where']=_['merge'](_0x3d9643[_0xdb53('0x3b')],{'$or':_[_0xdb53('0x32')](_0x523ead,function(_0x209172){if(_0x209172[_0xdb53('0x2f')]!==_0xdb53('0x3d')){var _0x18a70f={};_0x18a70f[_0x209172[_0xdb53('0x2a')]]={'$like':'%'+_0x5b85e0[_0xdb53('0x33')][_0xdb53('0x3c')]+'%'};return _0x18a70f;}})});}_0x3d9643=_['merge']({},_0x3d9643,_0x5b85e0[_0xdb53('0x3e')]);var _0x1124c5={'where':_0x3d9643[_0xdb53('0x3b')]};return db[_0xdb53('0x2c')][_0xdb53('0x1f')](_0x1124c5)[_0xdb53('0x25')](function(_0x59032e){_0x198729[_0xdb53('0x1f')]=_0x59032e;if(_0x5b85e0[_0xdb53('0x33')][_0xdb53('0x3f')]){_0x3d9643[_0xdb53('0x40')]=[{'all':!![]}];}return db[_0xdb53('0x2c')]['findAll'](_0x3d9643);})['then'](function(_0x6417d4){_0x198729[_0xdb53('0x41')]=_0x6417d4;return _0x198729;})[_0xdb53('0x25')](respondWithFilteredResult(_0x424277,_0x3d9643))[_0xdb53('0x42')](handleError(_0x424277,null));};exports[_0xdb53('0x43')]=function(_0x3cdcf3,_0x557019){var _0x739213={'raw':!![],'where':{'id':_0x3cdcf3[_0xdb53('0x44')]['id']}},_0x355f00={};_0x355f00[_0xdb53('0x31')]=_[_0xdb53('0x45')](db[_0xdb53('0x2c')][_0xdb53('0x2d')]);_0x355f00[_0xdb53('0x33')]=_[_0xdb53('0x45')](_0x3cdcf3[_0xdb53('0x33')]);_0x355f00[_0xdb53('0x34')]=_[_0xdb53('0x46')](_0x355f00['model'],_0x355f00['query']);_0x739213[_0xdb53('0x36')]=_[_0xdb53('0x46')](_0x355f00[_0xdb53('0x31')],qs[_0xdb53('0x35')](_0x3cdcf3[_0xdb53('0x33')][_0xdb53('0x35')]));_0x739213['attributes']=_0x739213[_0xdb53('0x36')]['length']?_0x739213[_0xdb53('0x36')]:_0x355f00[_0xdb53('0x31')];if(_0x3cdcf3['query'][_0xdb53('0x3f')]){_0x739213[_0xdb53('0x40')]=[{'all':!![]}];}_0x739213=_[_0xdb53('0x47')]({},_0x739213,_0x3cdcf3[_0xdb53('0x3e')]);return db[_0xdb53('0x2c')]['find'](_0x739213)[_0xdb53('0x25')](handleEntityNotFound(_0x557019,null))['then'](respondWithResult(_0x557019,null))['catch'](handleError(_0x557019,null));};exports[_0xdb53('0x48')]=function(_0xbabacc,_0x4edbf1){return db[_0xdb53('0x2c')]['create'](_0xbabacc['body'],{})['then'](function(_0x4775f3){var _0xddddcf=_0xbabacc[_0xdb53('0x49')][_0xdb53('0x26')]({'plain':!![]});if(!_0xddddcf)throw new Error(_0xdb53('0x4a'));if(_0xddddcf[_0xdb53('0x4b')]===_0xdb53('0x49')){var _0x129b59=_0x4775f3[_0xdb53('0x26')]({'plain':!![]});var _0x35d55d='Intervals';return db[_0xdb53('0x4c')][_0xdb53('0x4d')]({'where':{'name':_0x35d55d,'userProfileId':_0xddddcf['userProfileId']},'raw':!![]})['then'](function(_0x149ef3){if(_0x149ef3&&_0x149ef3[_0xdb53('0x4e')]===0x0){return db[_0xdb53('0x28')]['create']({'name':_0x129b59['name'],'resourceId':_0x129b59['id'],'type':_0x149ef3[_0xdb53('0x2a')],'sectionId':_0x149ef3['id']},{})[_0xdb53('0x25')](function(){return _0x4775f3;});}else{return _0x4775f3;}})['catch'](function(_0x2d4f23){logger[_0xdb53('0x29')](_0xdb53('0x4f'),_0x2d4f23);throw _0x2d4f23;});}return _0x4775f3;})[_0xdb53('0x25')](respondWithResult(_0x4edbf1,0xc9))[_0xdb53('0x42')](handleError(_0x4edbf1,null));};exports['update']=function(_0x3350b6,_0x2448f3){if(_0x3350b6['body']['id']){delete _0x3350b6['body']['id'];}return db[_0xdb53('0x2c')][_0xdb53('0x4d')]({'where':{'id':_0x3350b6[_0xdb53('0x44')]['id']}})[_0xdb53('0x25')](handleEntityNotFound(_0x2448f3,null))[_0xdb53('0x25')](saveUpdates(_0x3350b6[_0xdb53('0x50')],null))[_0xdb53('0x25')](respondWithResult(_0x2448f3,null))[_0xdb53('0x42')](handleError(_0x2448f3,null));};exports[_0xdb53('0x51')]=function(_0x3465c9,_0x1e55e1){return db[_0xdb53('0x2c')]['find']({'where':{'id':_0x3465c9['params']['id']}})['then'](handleEntityNotFound(_0x1e55e1,null))['then'](removeEntity(_0x1e55e1,null))['catch'](handleError(_0x1e55e1,null));};exports[_0xdb53('0x52')]=function(_0xeab7c2,_0x4d5436,_0x1a5a61){if(_0xeab7c2[_0xdb53('0x50')]['id']){delete _0xeab7c2[_0xdb53('0x50')]['id'];}return db[_0xdb53('0x2c')][_0xdb53('0x4d')]({'where':{'id':_0xeab7c2[_0xdb53('0x44')]['id']}})[_0xdb53('0x25')](handleEntityNotFound(_0x4d5436,null))[_0xdb53('0x25')](function(_0x1bbd45){if(_0x1bbd45){_0xeab7c2[_0xdb53('0x50')][_0xdb53('0x53')]=_0x1bbd45['id'];return db[_0xdb53('0x2c')][_0xdb53('0x48')](_0xeab7c2[_0xdb53('0x50')]);}})['then'](respondWithResult(_0x4d5436,null))[_0xdb53('0x42')](handleError(_0x4d5436,null));};exports['getIntervals']=function(_0x1c2e56,_0x3f4449,_0x9ee393){var _0x2070c4={};var _0x3ea66b={};var _0x2c56fe;var _0x964b10;return db[_0xdb53('0x2c')][_0xdb53('0x54')]({'where':{'id':_0x1c2e56[_0xdb53('0x44')]['id']}})['then'](handleEntityNotFound(_0x3f4449,null))[_0xdb53('0x25')](function(_0x28658b){if(_0x28658b){_0x2c56fe=_0x28658b;_0x3ea66b['model']=_[_0xdb53('0x45')](db[_0xdb53('0x2c')]['rawAttributes']);_0x3ea66b[_0xdb53('0x33')]=_[_0xdb53('0x45')](_0x1c2e56[_0xdb53('0x33')]);_0x3ea66b[_0xdb53('0x34')]=_[_0xdb53('0x46')](_0x3ea66b[_0xdb53('0x31')],_0x3ea66b[_0xdb53('0x33')]);_0x2070c4[_0xdb53('0x36')]=_[_0xdb53('0x46')](_0x3ea66b[_0xdb53('0x31')],qs['fields'](_0x1c2e56[_0xdb53('0x33')][_0xdb53('0x35')]));_0x2070c4[_0xdb53('0x36')]=_0x2070c4[_0xdb53('0x36')][_0xdb53('0x37')]?_0x2070c4[_0xdb53('0x36')]:_0x3ea66b['model'];_0x2070c4[_0xdb53('0x55')]=qs[_0xdb53('0x3a')](_0x1c2e56['query'][_0xdb53('0x3a')]);_0x2070c4[_0xdb53('0x3b')]=qs['filters'](_[_0xdb53('0x56')](_0x1c2e56[_0xdb53('0x33')],_0x3ea66b[_0xdb53('0x34')]));if(_0x1c2e56[_0xdb53('0x33')][_0xdb53('0x3c')]){_0x2070c4[_0xdb53('0x3b')]=_[_0xdb53('0x47')](_0x2070c4[_0xdb53('0x3b')],{'$or':_[_0xdb53('0x32')](_0x2070c4[_0xdb53('0x36')],function(_0x2cd2a2){var _0x29eab4={};_0x29eab4[_0x2cd2a2]={'$like':'%'+_0x1c2e56[_0xdb53('0x33')]['filter']+'%'};return _0x29eab4;})});}_0x2070c4=_['merge']({},_0x2070c4,_0x1c2e56[_0xdb53('0x3e')]);return _0x2c56fe[_0xdb53('0x57')](_0x2070c4);}})[_0xdb53('0x25')](function(_0x1e5c2b){if(_0x1e5c2b){_0x964b10=_0x1e5c2b[_0xdb53('0x37')];if(!_0x1c2e56[_0xdb53('0x33')][_0xdb53('0x38')]('nolimit')){_0x2070c4[_0xdb53('0x20')]=qs[_0xdb53('0x20')](_0x1c2e56[_0xdb53('0x33')][_0xdb53('0x20')]);_0x2070c4[_0xdb53('0x1d')]=qs['offset'](_0x1c2e56[_0xdb53('0x33')][_0xdb53('0x1d')]);}return _0x2c56fe[_0xdb53('0x57')](_0x2070c4);}})[_0xdb53('0x25')](function(_0x96fa16){if(_0x96fa16){return _0x96fa16?{'count':_0x964b10,'rows':_0x96fa16}:null;}})[_0xdb53('0x25')](respondWithResult(_0x3f4449,null))['catch'](handleError(_0x3f4449,null));};exports[_0xdb53('0x58')]=function(_0x1a7919,_0x109960,_0x471a35){return db[_0xdb53('0x2c')][_0xdb53('0x54')]({'where':{'id':_0x1a7919[_0xdb53('0x44')]['id']}})[_0xdb53('0x25')](handleEntityNotFound(_0x109960,null))['then'](function(_0x354cb4){if(_0x354cb4){return db['sequelize'][_0xdb53('0x59')](function(_0x40d248){return db[_0xdb53('0x2c')][_0xdb53('0x51')]({'where':{'IntervalId':_0x1a7919[_0xdb53('0x44')]['id']},'transaction':_0x40d248})[_0xdb53('0x25')](function(_0x247b3d){var _0x34bb38=_[_0xdb53('0x32')](_0x1a7919[_0xdb53('0x50')],function(_0x338e9d){delete _0x338e9d['id'];_0x338e9d[_0xdb53('0x53')]=_0x1a7919[_0xdb53('0x44')]['id'];return _0x338e9d;});return db[_0xdb53('0x2c')]['bulkCreate'](_0x34bb38,{'transaction':_0x40d248});});})[_0xdb53('0x25')](function(){return db[_0xdb53('0x2c')][_0xdb53('0x5a')]({'where':{'IntervalId':_0x1a7919[_0xdb53('0x44')]['id']}});});}})['then'](respondWithResult(_0x109960,null))[_0xdb53('0x42')](handleError(_0x109960,null));}; \ No newline at end of file +var _0x0a81=['nolimit','sort','filters','pick','filter','where','map','options','includeAll','rows','catch','params','keys','include','merge','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','findOne','getIntervals','addIntervals','sequelize','transaction','findAll','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','status','json','offset','undefined','count','limit','set','Content-Range','apply','destroy','then','Intervals','UserProfileResource','end','error','stack','name','Interval','rawAttributes','fieldName','model','query','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x2c9427,_0x331c7b){var _0x1b6dc8=function(_0x2b6bb0){while(--_0x2b6bb0){_0x2c9427['push'](_0x2c9427['shift']());}};_0x1b6dc8(++_0x331c7b);}(_0x0a81,0x73));var _0x10a8=function(_0x3ca14d,_0x30e971){_0x3ca14d=_0x3ca14d-0x0;var _0x1ba343=_0x0a81[_0x3ca14d];return _0x1ba343;};'use strict';var emlformat=require(_0x10a8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x10a8('0x1'));var jsonpatch=require(_0x10a8('0x2'));var rp=require(_0x10a8('0x3'));var moment=require(_0x10a8('0x4'));var BPromise=require(_0x10a8('0x5'));var Mustache=require(_0x10a8('0x6'));var util=require('util');var path=require(_0x10a8('0x7'));var sox=require(_0x10a8('0x8'));var csv=require(_0x10a8('0x9'));var ejs=require(_0x10a8('0xa'));var fs=require('fs');var fs_extra=require(_0x10a8('0xb'));var _=require(_0x10a8('0xc'));var squel=require(_0x10a8('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x10a8('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x10a8('0xf'));var authService=require(_0x10a8('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x10a8('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x10a8('0x12'))('api');var utils=require(_0x10a8('0x13'));var config=require(_0x10a8('0x14'));var licenseUtil=require(_0x10a8('0x15'));var db=require(_0x10a8('0x16'))['db'];var extensions=require(_0x10a8('0x17'));function respondWithStatusCode(_0x5f0a28,_0x5b8b3b){_0x5b8b3b=_0x5b8b3b||0xcc;return function(_0x19c485){if(_0x19c485){return _0x5f0a28['sendStatus'](_0x5b8b3b);}return _0x5f0a28[_0x10a8('0x18')](_0x5b8b3b)['end']();};}function respondWithResult(_0xf4cc4,_0x1c1075){_0x1c1075=_0x1c1075||0xc8;return function(_0x7846e8){if(_0x7846e8){return _0xf4cc4[_0x10a8('0x18')](_0x1c1075)[_0x10a8('0x19')](_0x7846e8);}};}function respondWithFilteredResult(_0x13c817,_0x52e6a8){return function(_0x3ac33e){if(_0x3ac33e){var _0x58c810=typeof _0x52e6a8[_0x10a8('0x1a')]===_0x10a8('0x1b')&&typeof _0x52e6a8['limit']==='undefined';var _0x2bade4=_0x3ac33e[_0x10a8('0x1c')];var _0x15a839=_0x58c810?0x0:_0x52e6a8[_0x10a8('0x1a')];var _0x56735f=_0x58c810?_0x3ac33e[_0x10a8('0x1c')]:_0x52e6a8[_0x10a8('0x1a')]+_0x52e6a8[_0x10a8('0x1d')];var _0x4d33b9;if(_0x56735f>=_0x2bade4){_0x56735f=_0x2bade4;_0x4d33b9=0xc8;}else{_0x4d33b9=0xce;}_0x13c817[_0x10a8('0x18')](_0x4d33b9);return _0x13c817[_0x10a8('0x1e')](_0x10a8('0x1f'),_0x15a839+'-'+_0x56735f+'/'+_0x2bade4)[_0x10a8('0x19')](_0x3ac33e);}return null;};}function patchUpdates(_0x328af8){return function(_0x230d45){try{jsonpatch[_0x10a8('0x20')](_0x230d45,_0x328af8,!![]);}catch(_0x9692bd){return BPromise['reject'](_0x9692bd);}return _0x230d45['save']();};}function saveUpdates(_0x465397,_0x8c8644){return function(_0x544af0){if(_0x544af0){return _0x544af0['update'](_0x465397)['then'](function(_0x738063){return _0x738063;});}return null;};}function removeEntity(_0x565554,_0x4f0b22){return function(_0x29e637){if(_0x29e637){return _0x29e637[_0x10a8('0x21')]()[_0x10a8('0x22')](function(){var _0x15d54e=_0x29e637['get']({'plain':!![]});var _0x4cfa67=_0x10a8('0x23');return db[_0x10a8('0x24')]['destroy']({'where':{'type':_0x4cfa67,'resourceId':_0x15d54e['id']}})[_0x10a8('0x22')](function(){return _0x29e637;});})[_0x10a8('0x22')](function(){_0x565554[_0x10a8('0x18')](0xcc)[_0x10a8('0x25')]();});}};}function handleEntityNotFound(_0x5c6c52,_0x5e53e1){return function(_0x219569){if(!_0x219569){_0x5c6c52['sendStatus'](0x194);}return _0x219569;};}function handleError(_0x206742,_0x36fdbd){_0x36fdbd=_0x36fdbd||0x1f4;return function(_0x5c9405){logger[_0x10a8('0x26')](_0x5c9405[_0x10a8('0x27')]);if(_0x5c9405[_0x10a8('0x28')]){delete _0x5c9405['name'];}_0x206742[_0x10a8('0x18')](_0x36fdbd)['send'](_0x5c9405);};}exports['index']=function(_0x2334fb,_0x4d29ef){var _0x132417={},_0x3ce808={},_0x52367f={'count':0x0,'rows':[]};var _0x582c3a=_['map'](db[_0x10a8('0x29')][_0x10a8('0x2a')],function(_0x51772f){return{'name':_0x51772f[_0x10a8('0x2b')],'type':_0x51772f['type']['key']};});_0x3ce808[_0x10a8('0x2c')]=_['map'](_0x582c3a,_0x10a8('0x28'));_0x3ce808['query']=_['keys'](_0x2334fb[_0x10a8('0x2d')]);_0x3ce808['filters']=_[_0x10a8('0x2e')](_0x3ce808[_0x10a8('0x2c')],_0x3ce808[_0x10a8('0x2d')]);_0x132417['attributes']=_[_0x10a8('0x2e')](_0x3ce808[_0x10a8('0x2c')],qs[_0x10a8('0x2f')](_0x2334fb[_0x10a8('0x2d')][_0x10a8('0x2f')]));_0x132417[_0x10a8('0x30')]=_0x132417[_0x10a8('0x30')][_0x10a8('0x31')]?_0x132417[_0x10a8('0x30')]:_0x3ce808['model'];if(!_0x2334fb[_0x10a8('0x2d')][_0x10a8('0x32')](_0x10a8('0x33'))){_0x132417[_0x10a8('0x1d')]=qs[_0x10a8('0x1d')](_0x2334fb[_0x10a8('0x2d')][_0x10a8('0x1d')]);_0x132417['offset']=qs[_0x10a8('0x1a')](_0x2334fb['query'][_0x10a8('0x1a')]);}_0x132417['order']=qs[_0x10a8('0x34')](_0x2334fb['query'][_0x10a8('0x34')]);_0x132417['where']=qs[_0x10a8('0x35')](_[_0x10a8('0x36')](_0x2334fb[_0x10a8('0x2d')],_0x3ce808['filters']),_0x582c3a);if(_0x2334fb[_0x10a8('0x2d')][_0x10a8('0x37')]){_0x132417['where']=_['merge'](_0x132417[_0x10a8('0x38')],{'$or':_[_0x10a8('0x39')](_0x582c3a,function(_0x11cfc8){if(_0x11cfc8['type']!=='VIRTUAL'){var _0x328db9={};_0x328db9[_0x11cfc8[_0x10a8('0x28')]]={'$like':'%'+_0x2334fb['query']['filter']+'%'};return _0x328db9;}})});}_0x132417=_['merge']({},_0x132417,_0x2334fb[_0x10a8('0x3a')]);var _0x21ef0c={'where':_0x132417[_0x10a8('0x38')]};return db[_0x10a8('0x29')][_0x10a8('0x1c')](_0x21ef0c)[_0x10a8('0x22')](function(_0x11bb8b){_0x52367f['count']=_0x11bb8b;if(_0x2334fb[_0x10a8('0x2d')][_0x10a8('0x3b')]){_0x132417['include']=[{'all':!![]}];}return db[_0x10a8('0x29')]['findAll'](_0x132417);})[_0x10a8('0x22')](function(_0x10e5da){_0x52367f[_0x10a8('0x3c')]=_0x10e5da;return _0x52367f;})[_0x10a8('0x22')](respondWithFilteredResult(_0x4d29ef,_0x132417))[_0x10a8('0x3d')](handleError(_0x4d29ef,null));};exports['show']=function(_0xcc6546,_0x4e1bb0){var _0x458287={'raw':!![],'where':{'id':_0xcc6546[_0x10a8('0x3e')]['id']}},_0x14d816={};_0x14d816[_0x10a8('0x2c')]=_[_0x10a8('0x3f')](db['Interval']['rawAttributes']);_0x14d816[_0x10a8('0x2d')]=_[_0x10a8('0x3f')](_0xcc6546[_0x10a8('0x2d')]);_0x14d816[_0x10a8('0x35')]=_[_0x10a8('0x2e')](_0x14d816[_0x10a8('0x2c')],_0x14d816['query']);_0x458287[_0x10a8('0x30')]=_[_0x10a8('0x2e')](_0x14d816[_0x10a8('0x2c')],qs[_0x10a8('0x2f')](_0xcc6546[_0x10a8('0x2d')][_0x10a8('0x2f')]));_0x458287[_0x10a8('0x30')]=_0x458287[_0x10a8('0x30')]['length']?_0x458287[_0x10a8('0x30')]:_0x14d816[_0x10a8('0x2c')];if(_0xcc6546[_0x10a8('0x2d')][_0x10a8('0x3b')]){_0x458287[_0x10a8('0x40')]=[{'all':!![]}];}_0x458287=_[_0x10a8('0x41')]({},_0x458287,_0xcc6546[_0x10a8('0x3a')]);return db[_0x10a8('0x29')][_0x10a8('0x42')](_0x458287)['then'](handleEntityNotFound(_0x4e1bb0,null))[_0x10a8('0x22')](respondWithResult(_0x4e1bb0,null))[_0x10a8('0x3d')](handleError(_0x4e1bb0,null));};exports[_0x10a8('0x43')]=function(_0x3344cc,_0x11ae3b){return db[_0x10a8('0x29')][_0x10a8('0x43')](_0x3344cc[_0x10a8('0x44')],{})[_0x10a8('0x22')](function(_0x1c8cba){var _0x2c2739=_0x3344cc['user'][_0x10a8('0x45')]({'plain':!![]});if(!_0x2c2739)throw new Error(_0x10a8('0x46'));if(_0x2c2739['role']===_0x10a8('0x47')){var _0x35ae00=_0x1c8cba[_0x10a8('0x45')]({'plain':!![]});var _0x42ee1d=_0x10a8('0x23');return db['UserProfileSection'][_0x10a8('0x42')]({'where':{'name':_0x42ee1d,'userProfileId':_0x2c2739[_0x10a8('0x48')]},'raw':!![]})[_0x10a8('0x22')](function(_0x3844ee){if(_0x3844ee&&_0x3844ee[_0x10a8('0x49')]===0x0){return db['UserProfileResource'][_0x10a8('0x43')]({'name':_0x35ae00[_0x10a8('0x28')],'resourceId':_0x35ae00['id'],'type':_0x3844ee['name'],'sectionId':_0x3844ee['id']},{})['then'](function(){return _0x1c8cba;});}else{return _0x1c8cba;}})[_0x10a8('0x3d')](function(_0x5389cb){logger['error'](_0x10a8('0x4a'),_0x5389cb);throw _0x5389cb;});}return _0x1c8cba;})[_0x10a8('0x22')](respondWithResult(_0x11ae3b,0xc9))[_0x10a8('0x3d')](handleError(_0x11ae3b,null));};exports['update']=function(_0x3cbde5,_0x1b42d3){if(_0x3cbde5[_0x10a8('0x44')]['id']){delete _0x3cbde5['body']['id'];}return db[_0x10a8('0x29')][_0x10a8('0x42')]({'where':{'id':_0x3cbde5[_0x10a8('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1b42d3,null))[_0x10a8('0x22')](saveUpdates(_0x3cbde5[_0x10a8('0x44')],null))['then'](respondWithResult(_0x1b42d3,null))['catch'](handleError(_0x1b42d3,null));};exports[_0x10a8('0x21')]=function(_0x132791,_0x23397f){return db[_0x10a8('0x29')][_0x10a8('0x42')]({'where':{'id':_0x132791[_0x10a8('0x3e')]['id']}})[_0x10a8('0x22')](handleEntityNotFound(_0x23397f,null))[_0x10a8('0x22')](removeEntity(_0x23397f,null))['catch'](handleError(_0x23397f,null));};exports[_0x10a8('0x4b')]=function(_0x229779,_0x41cde8,_0x1857f2){if(_0x229779[_0x10a8('0x44')]['id']){delete _0x229779[_0x10a8('0x44')]['id'];}return db[_0x10a8('0x29')][_0x10a8('0x42')]({'where':{'id':_0x229779['params']['id']}})[_0x10a8('0x22')](handleEntityNotFound(_0x41cde8,null))['then'](function(_0xca8e78){if(_0xca8e78){_0x229779[_0x10a8('0x44')][_0x10a8('0x4c')]=_0xca8e78['id'];return db['Interval'][_0x10a8('0x43')](_0x229779[_0x10a8('0x44')]);}})[_0x10a8('0x22')](respondWithResult(_0x41cde8,null))[_0x10a8('0x3d')](handleError(_0x41cde8,null));};exports['getIntervals']=function(_0x2ec520,_0x1c3977,_0x447e7a){var _0x4fbca3={};var _0x15b6f5={};var _0x2b6961;var _0x1c5d28;return db['Interval'][_0x10a8('0x4d')]({'where':{'id':_0x2ec520[_0x10a8('0x3e')]['id']}})[_0x10a8('0x22')](handleEntityNotFound(_0x1c3977,null))['then'](function(_0x112c54){if(_0x112c54){_0x2b6961=_0x112c54;_0x15b6f5[_0x10a8('0x2c')]=_[_0x10a8('0x3f')](db[_0x10a8('0x29')][_0x10a8('0x2a')]);_0x15b6f5['query']=_[_0x10a8('0x3f')](_0x2ec520[_0x10a8('0x2d')]);_0x15b6f5[_0x10a8('0x35')]=_['intersection'](_0x15b6f5['model'],_0x15b6f5[_0x10a8('0x2d')]);_0x4fbca3[_0x10a8('0x30')]=_[_0x10a8('0x2e')](_0x15b6f5['model'],qs[_0x10a8('0x2f')](_0x2ec520[_0x10a8('0x2d')][_0x10a8('0x2f')]));_0x4fbca3[_0x10a8('0x30')]=_0x4fbca3[_0x10a8('0x30')]['length']?_0x4fbca3[_0x10a8('0x30')]:_0x15b6f5[_0x10a8('0x2c')];_0x4fbca3['order']=qs[_0x10a8('0x34')](_0x2ec520[_0x10a8('0x2d')][_0x10a8('0x34')]);_0x4fbca3[_0x10a8('0x38')]=qs[_0x10a8('0x35')](_[_0x10a8('0x36')](_0x2ec520['query'],_0x15b6f5[_0x10a8('0x35')]));if(_0x2ec520[_0x10a8('0x2d')][_0x10a8('0x37')]){_0x4fbca3[_0x10a8('0x38')]=_[_0x10a8('0x41')](_0x4fbca3[_0x10a8('0x38')],{'$or':_[_0x10a8('0x39')](_0x4fbca3[_0x10a8('0x30')],function(_0x238134){var _0xcc3fea={};_0xcc3fea[_0x238134]={'$like':'%'+_0x2ec520['query'][_0x10a8('0x37')]+'%'};return _0xcc3fea;})});}_0x4fbca3=_['merge']({},_0x4fbca3,_0x2ec520[_0x10a8('0x3a')]);return _0x2b6961[_0x10a8('0x4e')](_0x4fbca3);}})[_0x10a8('0x22')](function(_0x2f05bd){if(_0x2f05bd){_0x1c5d28=_0x2f05bd[_0x10a8('0x31')];if(!_0x2ec520[_0x10a8('0x2d')]['hasOwnProperty'](_0x10a8('0x33'))){_0x4fbca3[_0x10a8('0x1d')]=qs[_0x10a8('0x1d')](_0x2ec520['query'][_0x10a8('0x1d')]);_0x4fbca3[_0x10a8('0x1a')]=qs[_0x10a8('0x1a')](_0x2ec520[_0x10a8('0x2d')][_0x10a8('0x1a')]);}return _0x2b6961[_0x10a8('0x4e')](_0x4fbca3);}})[_0x10a8('0x22')](function(_0x2a32a3){if(_0x2a32a3){return _0x2a32a3?{'count':_0x1c5d28,'rows':_0x2a32a3}:null;}})[_0x10a8('0x22')](respondWithResult(_0x1c3977,null))['catch'](handleError(_0x1c3977,null));};exports[_0x10a8('0x4f')]=function(_0x312b3c,_0x134cac,_0x10c554){return db['Interval'][_0x10a8('0x4d')]({'where':{'id':_0x312b3c[_0x10a8('0x3e')]['id']}})[_0x10a8('0x22')](handleEntityNotFound(_0x134cac,null))[_0x10a8('0x22')](function(_0x5ba695){if(_0x5ba695){return db[_0x10a8('0x50')][_0x10a8('0x51')](function(_0x43be55){return db[_0x10a8('0x29')][_0x10a8('0x21')]({'where':{'IntervalId':_0x312b3c['params']['id']},'transaction':_0x43be55})['then'](function(_0x5c418b){var _0x3cb19b=_[_0x10a8('0x39')](_0x312b3c[_0x10a8('0x44')],function(_0x40bfbb){delete _0x40bfbb['id'];_0x40bfbb[_0x10a8('0x4c')]=_0x312b3c[_0x10a8('0x3e')]['id'];return _0x40bfbb;});return db[_0x10a8('0x29')]['bulkCreate'](_0x3cb19b,{'transaction':_0x43be55});});})['then'](function(){return db[_0x10a8('0x29')][_0x10a8('0x52')]({'where':{'IntervalId':_0x312b3c[_0x10a8('0x3e')]['id']}});});}})['then'](respondWithResult(_0x134cac,null))[_0x10a8('0x3d')](handleError(_0x134cac,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 7f32f3e..b2695d8 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 _0xc405=['Interval','rewrite','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0xc405,0x1f2));var _0x5c40=function(_0x852450,_0xd2456e){_0x852450=_0x852450-0x0;var _0x329404=_0xc405[_0x852450];return _0x329404;};'use strict';var _=require(_0x5c40('0x0'));var util=require(_0x5c40('0x1'));var logger=require(_0x5c40('0x2'))(_0x5c40('0x3'));var moment=require(_0x5c40('0x4'));var BPromise=require(_0x5c40('0x5'));var rp=require(_0x5c40('0x6'));var fs=require('fs');var path=require(_0x5c40('0x7'));var rimraf=require(_0x5c40('0x8'));var config=require(_0x5c40('0x9'));var attributes=require(_0x5c40('0xa'));var extensions=require(_0x5c40('0xb'));module[_0x5c40('0xc')]=function(_0x59446b,_0x2f02f4){return _0x59446b[_0x5c40('0xd')](_0x5c40('0xe'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x447f7c,_0x345544){extensions[_0x5c40('0xf')](_0x59446b,_0x447f7c);},'afterBulkCreate':function(_0x4956d6,_0x55aaff,_0x394d17){_0x394d17();extensions['rewrite'](_0x59446b,_0x4956d6[0x0]);},'afterUpdate':function(_0x3eb534,_0x48c529){extensions[_0x5c40('0xf')](_0x59446b,_0x3eb534);},'afterDestroy':function(_0x6c8767,_0x75e01c){extensions[_0x5c40('0xf')](_0x59446b,_0x6c8767);}}});}; \ No newline at end of file +var _0xe0d6=['path','rimraf','../../config/environment','../../components/extensions/rewrite','define','Interval','rewrite','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe0d6,0xa3));var _0x6e0d=function(_0x13f978,_0x331cb0){_0x13f978=_0x13f978-0x0;var _0x2e99b1=_0xe0d6[_0x13f978];return _0x2e99b1;};'use strict';var _=require('lodash');var util=require(_0x6e0d('0x0'));var logger=require(_0x6e0d('0x1'))(_0x6e0d('0x2'));var moment=require(_0x6e0d('0x3'));var BPromise=require(_0x6e0d('0x4'));var rp=require(_0x6e0d('0x5'));var fs=require('fs');var path=require(_0x6e0d('0x6'));var rimraf=require(_0x6e0d('0x7'));var config=require(_0x6e0d('0x8'));var attributes=require('./interval.attributes');var extensions=require(_0x6e0d('0x9'));module['exports']=function(_0x1db4f0,_0x161f21){return _0x1db4f0[_0x6e0d('0xa')](_0x6e0d('0xb'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4159b7,_0x4ff11c){extensions[_0x6e0d('0xc')](_0x1db4f0,_0x4159b7);},'afterBulkCreate':function(_0x5f5a73,_0x437147,_0x5479a8){_0x5479a8();extensions[_0x6e0d('0xc')](_0x1db4f0,_0x5f5a73[0x0]);},'afterUpdate':function(_0x4cbe35,_0x54c1ea){extensions[_0x6e0d('0xc')](_0x1db4f0,_0x4cbe35);},'afterDestroy':function(_0x5850e1,_0x320b8c){extensions[_0x6e0d('0xc')](_0x1db4f0,_0x5850e1);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index e561fa4..88504e3 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(_0x40d8d7,_0x30dd5e){var _0x3454cc=function(_0x512c1b){while(--_0x512c1b){_0x40d8d7['push'](_0x40d8d7['shift']());}};_0x3454cc(++_0x30dd5e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'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(_0x3cfb0d,_0x4df584){var _0x3486b4=function(_0x1b0939){while(--_0x1b0939){_0x3cfb0d['push'](_0x3cfb0d['shift']());}};_0x3486b4(++_0x4df584);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 d7ecce3..86fdeab 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller'];(function(_0x52e3ac,_0x2e77f9){var _0x418e8c=function(_0x25cfcc){while(--_0x25cfcc){_0x52e3ac['push'](_0x52e3ac['shift']());}};_0x418e8c(++_0x2e77f9);}(_0xdb28,0x106));var _0x8db2=function(_0xbd14e,_0x556d1f){_0xbd14e=_0xbd14e-0x0;var _0xf040ba=_0xdb28[_0xbd14e];return _0xf040ba;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['post']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);module[_0x8db2('0x6')]=router; \ No newline at end of file +var _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0x585254,_0x215075){var _0x4ea244=function(_0x47a033){while(--_0x47a033){_0x585254['push'](_0x585254['shift']());}};_0x4ea244(++_0x215075);}(_0xadb5,0xad));var _0x5adb=function(_0xf8311b,_0xa0a8c7){_0xf8311b=_0xf8311b-0x0;var _0x3a5169=_0xadb5[_0xf8311b];return _0x3a5169;};'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 diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index e5ce716..a36f87d 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 _0x929a=['issuetype','Bug','fields','customfield_11500','email','customfield_11501','customfield_11502','newToken','customfield_11503','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','application/json','toString','setEncoding','data','end','status','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','x-forwarded-for','connection','socket','remoteAddress','https','../../config/logger','api','support','3eAmWpBVP0','MOTGUI','summary','Report','\x20from\x20','description','stringify'];(function(_0x506532,_0x505786){var _0x20892a=function(_0x1cd555){while(--_0x1cd555){_0x506532['push'](_0x506532['shift']());}};_0x20892a(++_0x505786);}(_0x929a,0x155));var _0xa929=function(_0x191d5c,_0xdc7b24){_0x191d5c=_0x191d5c-0x0;var _0x5ca940=_0x929a[_0x191d5c];return _0x5ca940;};'use strict';var BPromise=require('bluebird');var https=require(_0xa929('0x0'));var logger=require(_0xa929('0x1'))(_0xa929('0x2'));var USERNAME=_0xa929('0x3');var PASSWORD=_0xa929('0x4');function openIssue(_0x5a5a1e,_0x259171){var _0x35d6c7={'fields':{'project':{'key':_0x5a5a1e['key']||_0xa929('0x5')},'summary':(_0x5a5a1e[_0xa929('0x6')]||_0xa929('0x7'))+_0xa929('0x8')+_0x5a5a1e['ip'],'description':_0x5a5a1e[_0xa929('0x9')]||JSON[_0xa929('0xa')](_0x5a5a1e),'issuetype':{'name':_0x5a5a1e[_0xa929('0xb')]||_0xa929('0xc')}}};_0x35d6c7[_0xa929('0xd')][_0xa929('0xe')]=_0x5a5a1e[_0xa929('0xf')];_0x35d6c7[_0xa929('0xd')][_0xa929('0x10')]=_0x5a5a1e['oldToken'];_0x35d6c7['fields'][_0xa929('0x11')]=_0x5a5a1e[_0xa929('0x12')];_0x35d6c7['fields'][_0xa929('0x13')]=_0x5a5a1e['name'];_0x35d6c7[_0xa929('0xd')][_0xa929('0x14')]=_0x5a5a1e[_0xa929('0x15')];_0x35d6c7['fields'][_0xa929('0x16')]=_0x5a5a1e['ip'];var _0x364f3c={'host':_0xa929('0x17'),'port':0x1bb,'path':_0xa929('0x18'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0xa929('0x19'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0xa929('0x1a')]('base64')}};var _0x5bc1fb=JSON[_0xa929('0xa')](_0x35d6c7);var _0x2fccad=https['request'](_0x364f3c,function(_0x4902be){_0x4902be[_0xa929('0x1b')]('utf8');var _0x1e3cdb='';_0x4902be['on'](_0xa929('0x1c'),function(_0x4448ff){_0x1e3cdb+=_0x4448ff;});_0x4902be['on'](_0xa929('0x1d'),function(){if(_0x259171){return _0x259171[_0xa929('0x1e')](_0x4902be['statusCode'])[_0xa929('0x1f')](JSON[_0xa929('0x20')](_0x1e3cdb));}});});_0x2fccad['on'](_0xa929('0x21'),function(_0x1e065d){if(_0x259171){return _0x259171[_0xa929('0x1e')](0x1f4)[_0xa929('0x1f')]({'errors':[{'message':_0xa929('0x22'),'type':_0xa929('0x23')}]});}});_0x2fccad[_0xa929('0x24')](_0x5bc1fb);_0x2fccad[_0xa929('0x1d')]();}exports[_0xa929('0x25')]=openIssue;exports[_0xa929('0x26')]=function(_0x36c586,_0x581fcb){_0x36c586[_0xa929('0x27')]['ip']=_0x36c586['headers'][_0xa929('0x28')]||_0x36c586[_0xa929('0x29')]['remoteAddress']||_0x36c586[_0xa929('0x2a')]['remoteAddress']||_0x36c586['connection'][_0xa929('0x2a')][_0xa929('0x2b')];return openIssue(_0x36c586[_0xa929('0x27')],_0x581fcb);}; \ No newline at end of file +var _0x6585=['parse','api.jira','openIssue','body','headers','x-forwarded-for','remoteAddress','socket','connection','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','email','customfield_11501','customfield_11502','newToken','name','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','base64','setEncoding','utf8','data','end','status','statusCode','json'];(function(_0x44ff3c,_0x3bec04){var _0x1af4d5=function(_0x4aab79){while(--_0x4aab79){_0x44ff3c['push'](_0x44ff3c['shift']());}};_0x1af4d5(++_0x3bec04);}(_0x6585,0x1ed));var _0x5658=function(_0x347999,_0x315e31){_0x347999=_0x347999-0x0;var _0x48aec3=_0x6585[_0x347999];return _0x48aec3;};'use strict';var BPromise=require(_0x5658('0x0'));var https=require(_0x5658('0x1'));var logger=require(_0x5658('0x2'))(_0x5658('0x3'));var USERNAME=_0x5658('0x4');var PASSWORD=_0x5658('0x5');function openIssue(_0x1cf604,_0x11ed7d){var _0x24bb1a={'fields':{'project':{'key':_0x1cf604[_0x5658('0x6')]||_0x5658('0x7')},'summary':(_0x1cf604[_0x5658('0x8')]||_0x5658('0x9'))+_0x5658('0xa')+_0x1cf604['ip'],'description':_0x1cf604[_0x5658('0xb')]||JSON[_0x5658('0xc')](_0x1cf604),'issuetype':{'name':_0x1cf604[_0x5658('0xd')]||_0x5658('0xe')}}};_0x24bb1a[_0x5658('0xf')]['customfield_11500']=_0x1cf604[_0x5658('0x10')];_0x24bb1a[_0x5658('0xf')][_0x5658('0x11')]=_0x1cf604['oldToken'];_0x24bb1a[_0x5658('0xf')][_0x5658('0x12')]=_0x1cf604[_0x5658('0x13')];_0x24bb1a[_0x5658('0xf')]['customfield_11503']=_0x1cf604[_0x5658('0x14')];_0x24bb1a['fields']['customfield_11504']=_0x1cf604['reason'];_0x24bb1a[_0x5658('0xf')][_0x5658('0x15')]=_0x1cf604['ip'];var _0x2359a0={'host':_0x5658('0x16'),'port':0x1bb,'path':_0x5658('0x17'),'method':_0x5658('0x18'),'timeout':0x4e20,'headers':{'Content-Type':_0x5658('0x19'),'Authorization':_0x5658('0x1a')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x5658('0x1b'))}};var _0x2355d5=JSON[_0x5658('0xc')](_0x24bb1a);var _0x3eedb0=https['request'](_0x2359a0,function(_0x2370c0){_0x2370c0[_0x5658('0x1c')](_0x5658('0x1d'));var _0x577d13='';_0x2370c0['on'](_0x5658('0x1e'),function(_0x5662b0){_0x577d13+=_0x5662b0;});_0x2370c0['on'](_0x5658('0x1f'),function(){if(_0x11ed7d){return _0x11ed7d[_0x5658('0x20')](_0x2370c0[_0x5658('0x21')])[_0x5658('0x22')](JSON[_0x5658('0x23')](_0x577d13));}});});_0x3eedb0['on']('error',function(_0x49c947){if(_0x11ed7d){return _0x11ed7d['status'](0x1f4)['json']({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x5658('0x24')}]});}});_0x3eedb0['write'](_0x2355d5);_0x3eedb0[_0x5658('0x1f')]();}exports[_0x5658('0x25')]=openIssue;exports['send']=function(_0x558393,_0x4601ab){_0x558393[_0x5658('0x26')]['ip']=_0x558393[_0x5658('0x27')][_0x5658('0x28')]||_0x558393['connection'][_0x5658('0x29')]||_0x558393[_0x5658('0x2a')]['remoteAddress']||_0x558393[_0x5658('0x2b')][_0x5658('0x2a')][_0x5658('0x29')];return openIssue(_0x558393[_0x5658('0x26')],_0x4601ab);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 409e93e..d8d99e1 100644 --- a/server/api/jscriptyAnswerReport/index.js +++ b/server/api/jscriptyAnswerReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x153f=['Router','fs-extra','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x20a47c,_0x576c02){var _0x16b31f=function(_0x54f04c){while(--_0x54f04c){_0x20a47c['push'](_0x20a47c['shift']());}};_0x16b31f(++_0x576c02);}(_0x153f,0x15b));var _0xf153=function(_0x33803b,_0x80f585){_0x33803b=_0x33803b-0x0;var _0x17a484=_0x153f[_0x33803b];return _0x17a484;};'use strict';var multer=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var path=require(_0xf153('0x2'));var timeout=require(_0xf153('0x3'));var express=require(_0xf153('0x4'));var router=express[_0xf153('0x5')]();var fs_extra=require(_0xf153('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf153('0x7'));var config=require('../../config/environment');var controller=require(_0xf153('0x8'));router[_0xf153('0x9')]('/',auth[_0xf153('0xa')](),controller[_0xf153('0xb')]);router[_0xf153('0x9')]('/describe',auth[_0xf153('0xa')](),controller[_0xf153('0xc')]);router[_0xf153('0x9')](_0xf153('0xd'),auth[_0xf153('0xa')](),controller[_0xf153('0xe')]);router[_0xf153('0xf')]('/',auth[_0xf153('0xa')](),controller[_0xf153('0x10')]);router[_0xf153('0x11')]('/:id',auth[_0xf153('0xa')](),controller[_0xf153('0x12')]);router[_0xf153('0x13')]('/:id',auth[_0xf153('0xa')](),controller[_0xf153('0x14')]);module[_0xf153('0x15')]=router; \ No newline at end of file +var _0x1339=['../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xcd8290,_0x5201e4){var _0x503b3a=function(_0x4f65f7){while(--_0x4f65f7){_0xcd8290['push'](_0xcd8290['shift']());}};_0x503b3a(++_0x5201e4);}(_0x1339,0x1ed));var _0x9133=function(_0x203480,_0x3edb5c){_0x203480=_0x203480-0x0;var _0x358e14=_0x1339[_0x203480];return _0x358e14;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9133('0x0'));var timeout=require(_0x9133('0x1'));var express=require(_0x9133('0x2'));var router=express[_0x9133('0x3')]();var fs_extra=require(_0x9133('0x4'));var auth=require(_0x9133('0x5'));var interaction=require(_0x9133('0x6'));var config=require(_0x9133('0x7'));var controller=require('./jscriptyAnswerReport.controller');router[_0x9133('0x8')]('/',auth[_0x9133('0x9')](),controller[_0x9133('0xa')]);router['get'](_0x9133('0xb'),auth[_0x9133('0x9')](),controller[_0x9133('0xc')]);router[_0x9133('0x8')](_0x9133('0xd'),auth[_0x9133('0x9')](),controller[_0x9133('0xe')]);router[_0x9133('0xf')]('/',auth[_0x9133('0x9')](),controller[_0x9133('0x10')]);router['put'](_0x9133('0xd'),auth[_0x9133('0x9')](),controller[_0x9133('0x11')]);router[_0x9133('0x12')](_0x9133('0xd'),auth[_0x9133('0x9')](),controller['destroy']);module[_0x9133('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 22fb2c8..17824cd 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x7a54,0x106));var _0x47a5=function(_0x4b05be,_0x42c04f){_0x4b05be=_0x4b05be-0x0;var _0xcf0c08=_0x7a54[_0x4b05be];return _0xcf0c08;};'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(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x7a54,0x106));var _0x47a5=function(_0x22113a,_0x5d899b){_0x22113a=_0x22113a-0x0;var _0x5b6ca1=_0x7a54[_0x22113a];return _0x5b6ca1;};'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 6593530..62c7ab5 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 _0x6aa7=['includeAll','find','create','body','catch','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','JscriptyAnswerReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','length','attributes','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','show'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0x6aa7,0x178));var _0x76aa=function(_0x549761,_0x2b78cd){_0x549761=_0x549761-0x0;var _0x4eb4c3=_0x6aa7[_0x549761];return _0x4eb4c3;};'use strict';var emlformat=require(_0x76aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x76aa('0x1'));var jsonpatch=require(_0x76aa('0x2'));var rp=require(_0x76aa('0x3'));var moment=require(_0x76aa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x76aa('0x5'));var util=require(_0x76aa('0x6'));var path=require(_0x76aa('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x76aa('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76aa('0x9'));var squel=require(_0x76aa('0xa'));var crypto=require(_0x76aa('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x76aa('0xc'));var toCsv=require(_0x76aa('0xd'));var querystring=require(_0x76aa('0xe'));var Papa=require('papaparse');var Redis=require(_0x76aa('0xf'));var authService=require(_0x76aa('0x10'));var qs=require(_0x76aa('0x11'));var as=require(_0x76aa('0x12'));var hardwareService=require(_0x76aa('0x13'));var logger=require(_0x76aa('0x14'))(_0x76aa('0x15'));var utils=require(_0x76aa('0x16'));var config=require(_0x76aa('0x17'));var licenseUtil=require(_0x76aa('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x112c39,_0x5df49c){_0x5df49c=_0x5df49c||0xcc;return function(_0x226536){if(_0x226536){return _0x112c39[_0x76aa('0x19')](_0x5df49c);}return _0x112c39[_0x76aa('0x1a')](_0x5df49c)[_0x76aa('0x1b')]();};}function respondWithResult(_0x10432c,_0x4e309f){_0x4e309f=_0x4e309f||0xc8;return function(_0x5f5b59){if(_0x5f5b59){return _0x10432c[_0x76aa('0x1a')](_0x4e309f)['json'](_0x5f5b59);}};}function respondWithFilteredResult(_0x180d92,_0x319bf1){return function(_0x5cf594){if(_0x5cf594){var _0x2111c7=typeof _0x319bf1['offset']===_0x76aa('0x1c')&&typeof _0x319bf1['limit']===_0x76aa('0x1c');var _0x413cf6=_0x5cf594[_0x76aa('0x1d')];var _0x21c16d=_0x2111c7?0x0:_0x319bf1[_0x76aa('0x1e')];var _0x3ead3f=_0x2111c7?_0x5cf594['count']:_0x319bf1['offset']+_0x319bf1[_0x76aa('0x1f')];var _0x454dd3;if(_0x3ead3f>=_0x413cf6){_0x3ead3f=_0x413cf6;_0x454dd3=0xc8;}else{_0x454dd3=0xce;}_0x180d92[_0x76aa('0x1a')](_0x454dd3);return _0x180d92[_0x76aa('0x20')](_0x76aa('0x21'),_0x21c16d+'-'+_0x3ead3f+'/'+_0x413cf6)[_0x76aa('0x22')](_0x5cf594);}return null;};}function patchUpdates(_0x19af92){return function(_0x2eaf48){try{jsonpatch[_0x76aa('0x23')](_0x2eaf48,_0x19af92,!![]);}catch(_0x5990c1){return BPromise[_0x76aa('0x24')](_0x5990c1);}return _0x2eaf48[_0x76aa('0x25')]();};}function saveUpdates(_0x338a6b,_0x5b3f55){return function(_0x41463a){if(_0x41463a){return _0x41463a[_0x76aa('0x26')](_0x338a6b)[_0x76aa('0x27')](function(_0x2bd2c6){return _0x2bd2c6;});}return null;};}function removeEntity(_0x29c50c,_0xc1044c){return function(_0x3cd039){if(_0x3cd039){return _0x3cd039[_0x76aa('0x28')]()[_0x76aa('0x27')](function(){_0x29c50c[_0x76aa('0x1a')](0xcc)[_0x76aa('0x1b')]();});}};}function handleEntityNotFound(_0x26b75e,_0x3599a9){return function(_0x4ef9b0){if(!_0x4ef9b0){_0x26b75e[_0x76aa('0x19')](0x194);}return _0x4ef9b0;};}function handleError(_0x1d6d15,_0x25c614){_0x25c614=_0x25c614||0x1f4;return function(_0x2e7ab4){logger[_0x76aa('0x29')](_0x2e7ab4[_0x76aa('0x2a')]);if(_0x2e7ab4[_0x76aa('0x2b')]){delete _0x2e7ab4[_0x76aa('0x2b')];}_0x1d6d15[_0x76aa('0x1a')](_0x25c614)[_0x76aa('0x2c')](_0x2e7ab4);};}exports['index']=function(_0x3fcb7f,_0x5a8030){var _0x994550={},_0x365ff8={},_0x2dec94={'count':0x0,'rows':[]};var _0x1e90b9=_[_0x76aa('0x2d')](db[_0x76aa('0x2e')][_0x76aa('0x2f')],function(_0x3827ec){return{'name':_0x3827ec[_0x76aa('0x30')],'type':_0x3827ec[_0x76aa('0x31')]['key']};});_0x365ff8[_0x76aa('0x32')]=_[_0x76aa('0x2d')](_0x1e90b9,_0x76aa('0x2b'));_0x365ff8[_0x76aa('0x33')]=_[_0x76aa('0x34')](_0x3fcb7f[_0x76aa('0x33')]);_0x365ff8[_0x76aa('0x35')]=_['intersection'](_0x365ff8[_0x76aa('0x32')],_0x365ff8[_0x76aa('0x33')]);_0x994550['attributes']=_[_0x76aa('0x36')](_0x365ff8['model'],qs[_0x76aa('0x37')](_0x3fcb7f['query'][_0x76aa('0x37')]));_0x994550['attributes']=_0x994550['attributes'][_0x76aa('0x38')]?_0x994550[_0x76aa('0x39')]:_0x365ff8[_0x76aa('0x32')];if(!_0x3fcb7f[_0x76aa('0x33')]['hasOwnProperty']('nolimit')){_0x994550[_0x76aa('0x1f')]=qs[_0x76aa('0x1f')](_0x3fcb7f[_0x76aa('0x33')][_0x76aa('0x1f')]);_0x994550[_0x76aa('0x1e')]=qs['offset'](_0x3fcb7f[_0x76aa('0x33')]['offset']);}_0x994550['order']=qs[_0x76aa('0x3a')](_0x3fcb7f[_0x76aa('0x33')][_0x76aa('0x3a')]);_0x994550[_0x76aa('0x3b')]=qs['filters'](_[_0x76aa('0x3c')](_0x3fcb7f[_0x76aa('0x33')],_0x365ff8[_0x76aa('0x35')]),_0x1e90b9);if(_0x3fcb7f['query'][_0x76aa('0x3d')]){_0x994550[_0x76aa('0x3b')]=_[_0x76aa('0x3e')](_0x994550[_0x76aa('0x3b')],{'$or':_[_0x76aa('0x2d')](_0x1e90b9,function(_0x982e62){if(_0x982e62[_0x76aa('0x31')]!==_0x76aa('0x3f')){var _0x283179={};_0x283179[_0x982e62['name']]={'$like':'%'+_0x3fcb7f[_0x76aa('0x33')][_0x76aa('0x3d')]+'%'};return _0x283179;}})});}_0x994550=_[_0x76aa('0x3e')]({},_0x994550,_0x3fcb7f[_0x76aa('0x40')]);var _0x64612e={'where':_0x994550[_0x76aa('0x3b')]};return db['JscriptyAnswerReport']['count'](_0x64612e)[_0x76aa('0x27')](function(_0x262906){_0x2dec94[_0x76aa('0x1d')]=_0x262906;if(_0x3fcb7f[_0x76aa('0x33')]['includeAll']){_0x994550[_0x76aa('0x41')]=[{'all':!![]}];}return db[_0x76aa('0x2e')][_0x76aa('0x42')](_0x994550);})[_0x76aa('0x27')](function(_0x1138b5){_0x2dec94['rows']=_0x1138b5;return _0x2dec94;})[_0x76aa('0x27')](respondWithFilteredResult(_0x5a8030,_0x994550))['catch'](handleError(_0x5a8030,null));};exports[_0x76aa('0x43')]=function(_0x54b8fd,_0x496304){var _0x4f7f3a={'raw':!![],'where':{'id':_0x54b8fd['params']['id']}},_0x144f0a={};_0x144f0a['model']=_['keys'](db[_0x76aa('0x2e')][_0x76aa('0x2f')]);_0x144f0a[_0x76aa('0x33')]=_[_0x76aa('0x34')](_0x54b8fd[_0x76aa('0x33')]);_0x144f0a['filters']=_[_0x76aa('0x36')](_0x144f0a[_0x76aa('0x32')],_0x144f0a[_0x76aa('0x33')]);_0x4f7f3a[_0x76aa('0x39')]=_[_0x76aa('0x36')](_0x144f0a['model'],qs[_0x76aa('0x37')](_0x54b8fd[_0x76aa('0x33')]['fields']));_0x4f7f3a[_0x76aa('0x39')]=_0x4f7f3a['attributes'][_0x76aa('0x38')]?_0x4f7f3a[_0x76aa('0x39')]:_0x144f0a[_0x76aa('0x32')];if(_0x54b8fd[_0x76aa('0x33')][_0x76aa('0x44')]){_0x4f7f3a[_0x76aa('0x41')]=[{'all':!![]}];}_0x4f7f3a=_[_0x76aa('0x3e')]({},_0x4f7f3a,_0x54b8fd[_0x76aa('0x40')]);return db[_0x76aa('0x2e')][_0x76aa('0x45')](_0x4f7f3a)['then'](handleEntityNotFound(_0x496304,null))[_0x76aa('0x27')](respondWithResult(_0x496304,null))['catch'](handleError(_0x496304,null));};exports[_0x76aa('0x46')]=function(_0x3d3332,_0x5e95f5){return db[_0x76aa('0x2e')]['create'](_0x3d3332['body'],{})[_0x76aa('0x27')](respondWithResult(_0x5e95f5,0xc9))['catch'](handleError(_0x5e95f5,null));};exports[_0x76aa('0x26')]=function(_0x302a0c,_0x4315b3){if(_0x302a0c[_0x76aa('0x47')]['id']){delete _0x302a0c[_0x76aa('0x47')]['id'];}return db[_0x76aa('0x2e')]['find']({'where':{'id':_0x302a0c['params']['id']}})[_0x76aa('0x27')](handleEntityNotFound(_0x4315b3,null))[_0x76aa('0x27')](saveUpdates(_0x302a0c[_0x76aa('0x47')],null))[_0x76aa('0x27')](respondWithResult(_0x4315b3,null))[_0x76aa('0x48')](handleError(_0x4315b3,null));};exports[_0x76aa('0x28')]=function(_0x4c52d5,_0x95b7c5){return db[_0x76aa('0x2e')][_0x76aa('0x45')]({'where':{'id':_0x4c52d5['params']['id']}})[_0x76aa('0x27')](handleEntityNotFound(_0x95b7c5,null))['then'](removeEntity(_0x95b7c5,null))[_0x76aa('0x48')](handleError(_0x95b7c5,null));};exports['describe']=function(_0x339b0d,_0x4449c1){return db[_0x76aa('0x2e')][_0x76aa('0x49')]()[_0x76aa('0x27')](respondWithResult(_0x4449c1,null))[_0x76aa('0x48')](handleError(_0x4449c1,null));}; \ No newline at end of file +var _0x0f89=['sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','where','merge','filter','includeAll','include','findAll','rows','show','params','keys','options','catch','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x540356,_0x1ad929){var _0x448202=function(_0x1c7e81){while(--_0x1c7e81){_0x540356['push'](_0x540356['shift']());}};_0x448202(++_0x1ad929);}(_0x0f89,0x111));var _0x90f8=function(_0x397b8c,_0x2c8d54){_0x397b8c=_0x397b8c-0x0;var _0x218110=_0x0f89[_0x397b8c];return _0x218110;};'use strict';var emlformat=require(_0x90f8('0x0'));var rimraf=require(_0x90f8('0x1'));var zipdir=require(_0x90f8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x90f8('0x3'));var moment=require(_0x90f8('0x4'));var BPromise=require(_0x90f8('0x5'));var Mustache=require(_0x90f8('0x6'));var util=require('util');var path=require(_0x90f8('0x7'));var sox=require(_0x90f8('0x8'));var csv=require('to-csv');var ejs=require(_0x90f8('0x9'));var fs=require('fs');var fs_extra=require(_0x90f8('0xa'));var _=require(_0x90f8('0xb'));var squel=require(_0x90f8('0xc'));var crypto=require(_0x90f8('0xd'));var jsforce=require(_0x90f8('0xe'));var deskjs=require(_0x90f8('0xf'));var toCsv=require(_0x90f8('0x10'));var querystring=require(_0x90f8('0x11'));var Papa=require(_0x90f8('0x12'));var Redis=require(_0x90f8('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x90f8('0x14'));var hardwareService=require(_0x90f8('0x15'));var logger=require(_0x90f8('0x16'))(_0x90f8('0x17'));var utils=require(_0x90f8('0x18'));var config=require(_0x90f8('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x90f8('0x1a'))['db'];function respondWithStatusCode(_0x4a1c3d,_0x4b31e6){_0x4b31e6=_0x4b31e6||0xcc;return function(_0x329f26){if(_0x329f26){return _0x4a1c3d[_0x90f8('0x1b')](_0x4b31e6);}return _0x4a1c3d['status'](_0x4b31e6)[_0x90f8('0x1c')]();};}function respondWithResult(_0x4e230b,_0x270a7d){_0x270a7d=_0x270a7d||0xc8;return function(_0x3f357f){if(_0x3f357f){return _0x4e230b[_0x90f8('0x1d')](_0x270a7d)[_0x90f8('0x1e')](_0x3f357f);}};}function respondWithFilteredResult(_0x4a36f9,_0x7bdc62){return function(_0x2767b3){if(_0x2767b3){var _0xec9212=typeof _0x7bdc62[_0x90f8('0x1f')]==='undefined'&&typeof _0x7bdc62[_0x90f8('0x20')]===_0x90f8('0x21');var _0x5615d2=_0x2767b3[_0x90f8('0x22')];var _0x31cc49=_0xec9212?0x0:_0x7bdc62[_0x90f8('0x1f')];var _0xae253e=_0xec9212?_0x2767b3[_0x90f8('0x22')]:_0x7bdc62[_0x90f8('0x1f')]+_0x7bdc62[_0x90f8('0x20')];var _0x1c3e04;if(_0xae253e>=_0x5615d2){_0xae253e=_0x5615d2;_0x1c3e04=0xc8;}else{_0x1c3e04=0xce;}_0x4a36f9[_0x90f8('0x1d')](_0x1c3e04);return _0x4a36f9[_0x90f8('0x23')](_0x90f8('0x24'),_0x31cc49+'-'+_0xae253e+'/'+_0x5615d2)[_0x90f8('0x1e')](_0x2767b3);}return null;};}function patchUpdates(_0x2994f9){return function(_0x4e9104){try{jsonpatch['apply'](_0x4e9104,_0x2994f9,!![]);}catch(_0xb207f5){return BPromise[_0x90f8('0x25')](_0xb207f5);}return _0x4e9104[_0x90f8('0x26')]();};}function saveUpdates(_0x1892f0,_0x26b420){return function(_0x17dfe7){if(_0x17dfe7){return _0x17dfe7[_0x90f8('0x27')](_0x1892f0)[_0x90f8('0x28')](function(_0x487236){return _0x487236;});}return null;};}function removeEntity(_0xa07586,_0x2a78b8){return function(_0x30e5ed){if(_0x30e5ed){return _0x30e5ed[_0x90f8('0x29')]()['then'](function(){_0xa07586['status'](0xcc)[_0x90f8('0x1c')]();});}};}function handleEntityNotFound(_0x153d61,_0x48a21e){return function(_0x6115fc){if(!_0x6115fc){_0x153d61[_0x90f8('0x1b')](0x194);}return _0x6115fc;};}function handleError(_0x39c465,_0x5e1e07){_0x5e1e07=_0x5e1e07||0x1f4;return function(_0xf1606f){logger[_0x90f8('0x2a')](_0xf1606f[_0x90f8('0x2b')]);if(_0xf1606f[_0x90f8('0x2c')]){delete _0xf1606f[_0x90f8('0x2c')];}_0x39c465[_0x90f8('0x1d')](_0x5e1e07)[_0x90f8('0x2d')](_0xf1606f);};}exports[_0x90f8('0x2e')]=function(_0x3877e5,_0x507efa){var _0x277ead={},_0x5304e6={},_0x461bf6={'count':0x0,'rows':[]};var _0x4fb78c=_[_0x90f8('0x2f')](db[_0x90f8('0x30')][_0x90f8('0x31')],function(_0x340658){return{'name':_0x340658['fieldName'],'type':_0x340658[_0x90f8('0x32')][_0x90f8('0x33')]};});_0x5304e6[_0x90f8('0x34')]=_[_0x90f8('0x2f')](_0x4fb78c,_0x90f8('0x2c'));_0x5304e6[_0x90f8('0x35')]=_['keys'](_0x3877e5[_0x90f8('0x35')]);_0x5304e6[_0x90f8('0x36')]=_[_0x90f8('0x37')](_0x5304e6[_0x90f8('0x34')],_0x5304e6['query']);_0x277ead[_0x90f8('0x38')]=_[_0x90f8('0x37')](_0x5304e6[_0x90f8('0x34')],qs[_0x90f8('0x39')](_0x3877e5['query'][_0x90f8('0x39')]));_0x277ead['attributes']=_0x277ead[_0x90f8('0x38')][_0x90f8('0x3a')]?_0x277ead[_0x90f8('0x38')]:_0x5304e6[_0x90f8('0x34')];if(!_0x3877e5[_0x90f8('0x35')]['hasOwnProperty']('nolimit')){_0x277ead[_0x90f8('0x20')]=qs[_0x90f8('0x20')](_0x3877e5['query']['limit']);_0x277ead[_0x90f8('0x1f')]=qs[_0x90f8('0x1f')](_0x3877e5['query'][_0x90f8('0x1f')]);}_0x277ead['order']=qs['sort'](_0x3877e5[_0x90f8('0x35')]['sort']);_0x277ead[_0x90f8('0x3b')]=qs[_0x90f8('0x36')](_['pick'](_0x3877e5[_0x90f8('0x35')],_0x5304e6[_0x90f8('0x36')]),_0x4fb78c);if(_0x3877e5[_0x90f8('0x35')]['filter']){_0x277ead[_0x90f8('0x3b')]=_[_0x90f8('0x3c')](_0x277ead[_0x90f8('0x3b')],{'$or':_['map'](_0x4fb78c,function(_0x331263){if(_0x331263[_0x90f8('0x32')]!=='VIRTUAL'){var _0x241308={};_0x241308[_0x331263['name']]={'$like':'%'+_0x3877e5[_0x90f8('0x35')][_0x90f8('0x3d')]+'%'};return _0x241308;}})});}_0x277ead=_[_0x90f8('0x3c')]({},_0x277ead,_0x3877e5['options']);var _0x4ed477={'where':_0x277ead['where']};return db[_0x90f8('0x30')][_0x90f8('0x22')](_0x4ed477)[_0x90f8('0x28')](function(_0x3600ce){_0x461bf6[_0x90f8('0x22')]=_0x3600ce;if(_0x3877e5[_0x90f8('0x35')][_0x90f8('0x3e')]){_0x277ead[_0x90f8('0x3f')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x90f8('0x40')](_0x277ead);})[_0x90f8('0x28')](function(_0x1b208c){_0x461bf6[_0x90f8('0x41')]=_0x1b208c;return _0x461bf6;})['then'](respondWithFilteredResult(_0x507efa,_0x277ead))['catch'](handleError(_0x507efa,null));};exports[_0x90f8('0x42')]=function(_0x3f556f,_0x464c34){var _0x1214f9={'raw':!![],'where':{'id':_0x3f556f[_0x90f8('0x43')]['id']}},_0x5f0a86={};_0x5f0a86[_0x90f8('0x34')]=_[_0x90f8('0x44')](db[_0x90f8('0x30')][_0x90f8('0x31')]);_0x5f0a86[_0x90f8('0x35')]=_['keys'](_0x3f556f['query']);_0x5f0a86[_0x90f8('0x36')]=_[_0x90f8('0x37')](_0x5f0a86['model'],_0x5f0a86['query']);_0x1214f9[_0x90f8('0x38')]=_[_0x90f8('0x37')](_0x5f0a86[_0x90f8('0x34')],qs[_0x90f8('0x39')](_0x3f556f[_0x90f8('0x35')][_0x90f8('0x39')]));_0x1214f9[_0x90f8('0x38')]=_0x1214f9[_0x90f8('0x38')][_0x90f8('0x3a')]?_0x1214f9[_0x90f8('0x38')]:_0x5f0a86['model'];if(_0x3f556f['query'][_0x90f8('0x3e')]){_0x1214f9['include']=[{'all':!![]}];}_0x1214f9=_[_0x90f8('0x3c')]({},_0x1214f9,_0x3f556f[_0x90f8('0x45')]);return db[_0x90f8('0x30')]['find'](_0x1214f9)[_0x90f8('0x28')](handleEntityNotFound(_0x464c34,null))['then'](respondWithResult(_0x464c34,null))[_0x90f8('0x46')](handleError(_0x464c34,null));};exports[_0x90f8('0x47')]=function(_0x10819d,_0x5a1bec){return db[_0x90f8('0x30')][_0x90f8('0x47')](_0x10819d[_0x90f8('0x48')],{})[_0x90f8('0x28')](respondWithResult(_0x5a1bec,0xc9))['catch'](handleError(_0x5a1bec,null));};exports[_0x90f8('0x27')]=function(_0x35c2b9,_0x461913){if(_0x35c2b9[_0x90f8('0x48')]['id']){delete _0x35c2b9['body']['id'];}return db['JscriptyAnswerReport']['find']({'where':{'id':_0x35c2b9['params']['id']}})[_0x90f8('0x28')](handleEntityNotFound(_0x461913,null))[_0x90f8('0x28')](saveUpdates(_0x35c2b9['body'],null))[_0x90f8('0x28')](respondWithResult(_0x461913,null))[_0x90f8('0x46')](handleError(_0x461913,null));};exports[_0x90f8('0x29')]=function(_0x3da03c,_0x1c915a){return db['JscriptyAnswerReport'][_0x90f8('0x49')]({'where':{'id':_0x3da03c['params']['id']}})[_0x90f8('0x28')](handleEntityNotFound(_0x1c915a,null))[_0x90f8('0x28')](removeEntity(_0x1c915a,null))['catch'](handleError(_0x1c915a,null));};exports[_0x90f8('0x4a')]=function(_0x17f635,_0x8751a8){return db[_0x90f8('0x30')][_0x90f8('0x4a')]()[_0x90f8('0x28')](respondWithResult(_0x8751a8,null))[_0x90f8('0x46')](handleError(_0x8751a8,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index f43afa4..fc8a015 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 _0x0c33=['../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3d46a0,_0xb42b0d){var _0x4a5c0e=function(_0x4c2c49){while(--_0x4c2c49){_0x3d46a0['push'](_0x3d46a0['shift']());}};_0x4a5c0e(++_0xb42b0d);}(_0x0c33,0xfd));var _0x30c3=function(_0x132558,_0x521d93){_0x132558=_0x132558-0x0;var _0x34f138=_0x0c33[_0x132558];return _0x34f138;};'use strict';var _=require(_0x30c3('0x0'));var util=require('util');var logger=require(_0x30c3('0x1'))(_0x30c3('0x2'));var moment=require(_0x30c3('0x3'));var BPromise=require(_0x30c3('0x4'));var rp=require(_0x30c3('0x5'));var fs=require('fs');var path=require(_0x30c3('0x6'));var rimraf=require('rimraf');var config=require(_0x30c3('0x7'));var attributes=require(_0x30c3('0x8'));module[_0x30c3('0x9')]=function(_0x4dbeac,_0x4e1b70){return _0x4dbeac[_0x30c3('0xa')](_0x30c3('0xb'),attributes,{'tableName':_0x30c3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x593c=['exports','define','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x593c,0xb6));var _0xc593=function(_0x4c440b,_0x3ea627){_0x4c440b=_0x4c440b-0x0;var _0x2d48cf=_0x593c[_0x4c440b];return _0x2d48cf;};'use strict';var _=require('lodash');var util=require(_0xc593('0x0'));var logger=require(_0xc593('0x1'))(_0xc593('0x2'));var moment=require(_0xc593('0x3'));var BPromise=require(_0xc593('0x4'));var rp=require(_0xc593('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc593('0x6'));var config=require(_0xc593('0x7'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0xc593('0x8')]=function(_0x2c22bb,_0x1684e9){return _0x2c22bb[_0xc593('0x9')]('JscriptyAnswerReport',attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 3908aba..2bee488 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 _0x0c66=['../../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','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x5088df,_0x7dcab5){var _0x47316d=function(_0x170b65){while(--_0x170b65){_0x5088df['push'](_0x5088df['shift']());}};_0x47316d(++_0x7dcab5);}(_0x0c66,0x1d4));var _0x60c6=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x0c66[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require(_0x60c6('0x0'));var util=require(_0x60c6('0x1'));var moment=require(_0x60c6('0x2'));var BPromise=require(_0x60c6('0x3'));var rs=require(_0x60c6('0x4'));var fs=require('fs');var Redis=require(_0x60c6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x60c6('0x6'));var logger=require(_0x60c6('0x7'))(_0x60c6('0x8'));var config=require(_0x60c6('0x9'));var jayson=require(_0x60c6('0xa'));var client=jayson[_0x60c6('0xb')][_0x60c6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5f0335,_0xa0a40a,_0x1642e7){return new BPromise(function(_0x583da6,_0x4c9958){return client[_0x60c6('0xd')](_0x5f0335,_0x1642e7)[_0x60c6('0xe')](function(_0x624724){logger[_0x60c6('0xf')](_0x60c6('0x10'),_0xa0a40a,_0x60c6('0x11'));logger[_0x60c6('0x12')](_0x60c6('0x13'),_0xa0a40a,_0x60c6('0x11'),JSON['stringify'](_0x624724));if(_0x624724['error']){if(_0x624724['error'][_0x60c6('0x14')]===0x1f4){logger[_0x60c6('0x15')](_0x60c6('0x10'),_0xa0a40a,_0x624724[_0x60c6('0x15')][_0x60c6('0x16')]);return _0x4c9958(_0x624724[_0x60c6('0x15')][_0x60c6('0x16')]);}logger[_0x60c6('0x15')](_0x60c6('0x10'),_0xa0a40a,_0x624724[_0x60c6('0x15')][_0x60c6('0x16')]);return _0x583da6(_0x624724[_0x60c6('0x15')][_0x60c6('0x16')]);}else{logger[_0x60c6('0xf')](_0x60c6('0x10'),_0xa0a40a,_0x60c6('0x11'));_0x583da6(_0x624724[_0x60c6('0x17')][_0x60c6('0x16')]);}})[_0x60c6('0x18')](function(_0x10741b){logger[_0x60c6('0x15')](_0x60c6('0x10'),_0xa0a40a,_0x10741b);_0x4c9958(_0x10741b);});});} \ No newline at end of file +var _0xd12b=['JscriptyAnswerReport,\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','http','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4f6b8b,_0x49f044){var _0x6473a6=function(_0x1319e8){while(--_0x1319e8){_0x4f6b8b['push'](_0x4f6b8b['shift']());}};_0x6473a6(++_0x49f044);}(_0xd12b,0x17e));var _0xbd12=function(_0x226ad1,_0x2858e2){_0x226ad1=_0x226ad1-0x0;var _0x16b625=_0xd12b[_0x226ad1];return _0x16b625;};'use strict';var _=require(_0xbd12('0x0'));var util=require(_0xbd12('0x1'));var moment=require(_0xbd12('0x2'));var BPromise=require(_0xbd12('0x3'));var rs=require(_0xbd12('0x4'));var fs=require('fs');var Redis=require(_0xbd12('0x5'));var db=require(_0xbd12('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xbd12('0x7'))(_0xbd12('0x8'));var config=require(_0xbd12('0x9'));var jayson=require(_0xbd12('0xa'));var client=jayson[_0xbd12('0xb')][_0xbd12('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3c7dcf,_0x21c0d7,_0x1ea3ba){return new BPromise(function(_0x4886d6,_0x2e1b23){return client['request'](_0x3c7dcf,_0x1ea3ba)[_0xbd12('0xd')](function(_0x289298){logger[_0xbd12('0xe')](_0xbd12('0xf'),_0x21c0d7,_0xbd12('0x10'));logger[_0xbd12('0x11')](_0xbd12('0x12'),_0x21c0d7,'request\x20sent',JSON[_0xbd12('0x13')](_0x289298));if(_0x289298['error']){if(_0x289298[_0xbd12('0x14')][_0xbd12('0x15')]===0x1f4){logger[_0xbd12('0x14')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x21c0d7,_0x289298[_0xbd12('0x14')]['message']);return _0x2e1b23(_0x289298['error'][_0xbd12('0x16')]);}logger['error'](_0xbd12('0xf'),_0x21c0d7,_0x289298['error']['message']);return _0x4886d6(_0x289298[_0xbd12('0x14')][_0xbd12('0x16')]);}else{logger[_0xbd12('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x21c0d7,_0xbd12('0x10'));_0x4886d6(_0x289298[_0xbd12('0x17')][_0xbd12('0x16')]);}})[_0xbd12('0x18')](function(_0xeaa7f8){logger[_0xbd12('0x14')](_0xbd12('0xf'),_0x21c0d7,_0xeaa7f8);_0x2e1b23(_0xeaa7f8);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index bd9c2d4..24fa72b 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 _0x2224=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptyProject.controller','isAuthenticated','index','get','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','getSummary','post','create','/:id/clone','clone','put','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x43979,_0x5d527a){var _0x2fada3=function(_0x54f13c){while(--_0x54f13c){_0x43979['push'](_0x43979['shift']());}};_0x2fada3(++_0x5d527a);}(_0x2224,0x176));var _0x4222=function(_0x575b72,_0x1a7eb1){_0x575b72=_0x575b72-0x0;var _0x561c57=_0x2224[_0x575b72];return _0x561c57;};'use strict';var multer=require('multer');var util=require(_0x4222('0x0'));var path=require(_0x4222('0x1'));var timeout=require(_0x4222('0x2'));var express=require(_0x4222('0x3'));var router=express[_0x4222('0x4')]();var fs_extra=require(_0x4222('0x5'));var auth=require(_0x4222('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4222('0x7'));var controller=require(_0x4222('0x8'));router['get']('/',auth[_0x4222('0x9')](),controller[_0x4222('0xa')]);router[_0x4222('0xb')](_0x4222('0xc'),auth[_0x4222('0x9')](),controller[_0x4222('0xd')]);router[_0x4222('0xb')](_0x4222('0xe'),auth[_0x4222('0x9')](),controller[_0x4222('0xf')]);router[_0x4222('0xb')](_0x4222('0x10'),auth['isAuthenticated'](),controller[_0x4222('0x11')]);router[_0x4222('0xb')](_0x4222('0x12'),auth[_0x4222('0x9')](),timeout('30s'),controller[_0x4222('0x13')]);router[_0x4222('0x14')]('/',auth['isAuthenticated'](),controller[_0x4222('0x15')]);router['post'](_0x4222('0x16'),auth[_0x4222('0x9')](),controller[_0x4222('0x17')]);router[_0x4222('0x18')](_0x4222('0xc'),auth[_0x4222('0x9')](),controller[_0x4222('0x19')]);router[_0x4222('0x1a')](_0x4222('0xc'),auth[_0x4222('0x9')](),controller[_0x4222('0x1b')]);module[_0x4222('0x1c')]=router; \ No newline at end of file +var _0x2b7b=['../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','get','isAuthenticated','index','/:id','/:id/sessions','getSessions','/:id/answers','/:id/summary','30s','getSummary','create','post','/:id/clone','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra'];(function(_0x3a8db5,_0x31cff7){var _0x2c03cd=function(_0x47dba0){while(--_0x47dba0){_0x3a8db5['push'](_0x3a8db5['shift']());}};_0x2c03cd(++_0x31cff7);}(_0x2b7b,0x172));var _0xb2b7=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0x2b7b[_0xd09668];return _0x68726;};'use strict';var multer=require(_0xb2b7('0x0'));var util=require('util');var path=require(_0xb2b7('0x1'));var timeout=require(_0xb2b7('0x2'));var express=require(_0xb2b7('0x3'));var router=express['Router']();var fs_extra=require(_0xb2b7('0x4'));var auth=require(_0xb2b7('0x5'));var interaction=require(_0xb2b7('0x6'));var config=require('../../config/environment');var controller=require(_0xb2b7('0x7'));router[_0xb2b7('0x8')]('/',auth[_0xb2b7('0x9')](),controller[_0xb2b7('0xa')]);router[_0xb2b7('0x8')](_0xb2b7('0xb'),auth[_0xb2b7('0x9')](),controller['show']);router[_0xb2b7('0x8')](_0xb2b7('0xc'),auth[_0xb2b7('0x9')](),controller[_0xb2b7('0xd')]);router[_0xb2b7('0x8')](_0xb2b7('0xe'),auth['isAuthenticated'](),controller['getAnswers']);router[_0xb2b7('0x8')](_0xb2b7('0xf'),auth[_0xb2b7('0x9')](),timeout(_0xb2b7('0x10')),controller[_0xb2b7('0x11')]);router['post']('/',auth[_0xb2b7('0x9')](),controller[_0xb2b7('0x12')]);router[_0xb2b7('0x13')](_0xb2b7('0x14'),auth[_0xb2b7('0x9')](),controller['clone']);router['put'](_0xb2b7('0xb'),auth[_0xb2b7('0x9')](),controller[_0xb2b7('0x15')]);router[_0xb2b7('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xb2b7('0x17')]);module[_0xb2b7('0x18')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index da78c9b..616ad5f 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 _0x1cb5=['setDataValue','stringify','isString','formData','getDataValue','BOOLEAN','sequelize','lodash','util','exports','STRING','name','TEXT','isObjectLike'];(function(_0x5c4e05,_0x6eb642){var _0x241132=function(_0x258a15){while(--_0x258a15){_0x5c4e05['push'](_0x5c4e05['shift']());}};_0x241132(++_0x6eb642);}(_0x1cb5,0x1aa));var _0x51cb=function(_0x551c03,_0x270696){_0x551c03=_0x551c03-0x0;var _0x58ddab=_0x1cb5[_0x551c03];return _0x58ddab;};'use strict';var Sequelize=require(_0x51cb('0x0'));var _=require(_0x51cb('0x1'));var util=require(_0x51cb('0x2'));module[_0x51cb('0x3')]={'name':{'type':Sequelize[_0x51cb('0x4')],'unique':_0x51cb('0x5')},'description':{'type':Sequelize[_0x51cb('0x4')]},'formData':{'type':Sequelize[_0x51cb('0x6')]('long'),'set':function(_0x50f54a){if(_[_0x51cb('0x7')](_0x50f54a)){this[_0x51cb('0x8')]('formData',JSON[_0x51cb('0x9')](_0x50f54a));}else if(_[_0x51cb('0xa')](_0x50f54a)){this[_0x51cb('0x8')](_0x51cb('0xb'),_0x50f54a);}else{this[_0x51cb('0x8')](_0x51cb('0xb'),util['format']('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0x51cb('0xc')](_0x51cb('0x5'))||'',this[_0x51cb('0xc')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x51cb('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x51cb('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0x7fac=['sequelize','lodash','util','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','formData','stringify','isString','format','getDataValue','description','BOOLEAN'];(function(_0xe7eb89,_0x151868){var _0x13a06b=function(_0x1affec){while(--_0x1affec){_0xe7eb89['push'](_0xe7eb89['shift']());}};_0x13a06b(++_0x151868);}(_0x7fac,0x99));var _0xc7fa=function(_0x15b399,_0x59db1a){_0x15b399=_0x15b399-0x0;var _0x199f2d=_0x7fac[_0x15b399];return _0x199f2d;};'use strict';var Sequelize=require(_0xc7fa('0x0'));var _=require(_0xc7fa('0x1'));var util=require(_0xc7fa('0x2'));module[_0xc7fa('0x3')]={'name':{'type':Sequelize[_0xc7fa('0x4')],'unique':_0xc7fa('0x5')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xc7fa('0x6')](_0xc7fa('0x7')),'set':function(_0xadd933){if(_[_0xc7fa('0x8')](_0xadd933)){this[_0xc7fa('0x9')](_0xc7fa('0xa'),JSON[_0xc7fa('0xb')](_0xadd933));}else if(_[_0xc7fa('0xc')](_0xadd933)){this[_0xc7fa('0x9')](_0xc7fa('0xa'),_0xadd933);}else{this[_0xc7fa('0x9')](_0xc7fa('0xa'),util[_0xc7fa('0xd')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0xc7fa('0xe')]('name')||'',this[_0xc7fa('0xe')](_0xc7fa('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xc7fa('0x10')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xc7fa('0x10')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 0356bde..136c4f1 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 _0xe605=['indexOf','replace','startTime','starttime','parse','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','writeFileSync','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','Projects','UserProfileResource','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','JscriptyProject','findAll','rows','show','params','intersection','find','catch','create','body','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','error','getSessions','findOne','JscriptySessionReport','hasOwnProperty','ProjectId','getAnswers','JscriptyAnswerReport','fromCharCode','toString'];(function(_0x4d6ba5,_0x28b811){var _0x4ed42a=function(_0x55f219){while(--_0x55f219){_0x4d6ba5['push'](_0x4d6ba5['shift']());}};_0x4ed42a(++_0x28b811);}(_0xe605,0x92));var _0x5e60=function(_0x64894e,_0x37f494){_0x64894e=_0x64894e-0x0;var _0x54ebaf=_0xe605[_0x64894e];return _0x54ebaf;};'use strict';var emlformat=require(_0x5e60('0x0'));var rimraf=require(_0x5e60('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5e60('0x2'));var rp=require(_0x5e60('0x3'));var moment=require(_0x5e60('0x4'));var BPromise=require(_0x5e60('0x5'));var Mustache=require(_0x5e60('0x6'));var util=require(_0x5e60('0x7'));var path=require(_0x5e60('0x8'));var sox=require(_0x5e60('0x9'));var csv=require(_0x5e60('0xa'));var ejs=require(_0x5e60('0xb'));var fs=require('fs');var fs_extra=require(_0x5e60('0xc'));var _=require(_0x5e60('0xd'));var squel=require('squel');var crypto=require(_0x5e60('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5e60('0xf'));var Papa=require(_0x5e60('0x10'));var Redis=require(_0x5e60('0x11'));var authService=require(_0x5e60('0x12'));var qs=require(_0x5e60('0x13'));var as=require(_0x5e60('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5e60('0x15'))('api');var utils=require(_0x5e60('0x16'));var config=require(_0x5e60('0x17'));var licenseUtil=require(_0x5e60('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x371df7,_0x178782){_0x178782=_0x178782||0xcc;return function(_0x1f4e14){if(_0x1f4e14){return _0x371df7[_0x5e60('0x19')](_0x178782);}return _0x371df7[_0x5e60('0x1a')](_0x178782)[_0x5e60('0x1b')]();};}function respondWithResult(_0x4fd10e,_0x209adb){_0x209adb=_0x209adb||0xc8;return function(_0x45304f){if(_0x45304f){return _0x4fd10e[_0x5e60('0x1a')](_0x209adb)[_0x5e60('0x1c')](_0x45304f);}};}function respondWithFilteredResult(_0x5b028f,_0x20af5f){return function(_0x529ffe){if(_0x529ffe){var _0x1ffd77=typeof _0x20af5f[_0x5e60('0x1d')]==='undefined'&&typeof _0x20af5f[_0x5e60('0x1e')]===_0x5e60('0x1f');var _0xaa7d05=_0x529ffe[_0x5e60('0x20')];var _0x5c485d=_0x1ffd77?0x0:_0x20af5f[_0x5e60('0x1d')];var _0x22d718=_0x1ffd77?_0x529ffe['count']:_0x20af5f[_0x5e60('0x1d')]+_0x20af5f[_0x5e60('0x1e')];var _0x17c630;if(_0x22d718>=_0xaa7d05){_0x22d718=_0xaa7d05;_0x17c630=0xc8;}else{_0x17c630=0xce;}_0x5b028f[_0x5e60('0x1a')](_0x17c630);return _0x5b028f[_0x5e60('0x21')](_0x5e60('0x22'),_0x5c485d+'-'+_0x22d718+'/'+_0xaa7d05)[_0x5e60('0x1c')](_0x529ffe);}return null;};}function patchUpdates(_0x524c93){return function(_0x3282e4){try{jsonpatch[_0x5e60('0x23')](_0x3282e4,_0x524c93,!![]);}catch(_0x228f13){return BPromise['reject'](_0x228f13);}return _0x3282e4[_0x5e60('0x24')]();};}function saveUpdates(_0x5d77dd,_0x376069){return function(_0x1a44e5){if(_0x1a44e5){return _0x1a44e5[_0x5e60('0x25')](_0x5d77dd)[_0x5e60('0x26')](function(_0x34e98d){return _0x34e98d;});}return null;};}function removeEntity(_0x2a499e,_0x2636f1){return function(_0x5d2c03){if(_0x5d2c03){return _0x5d2c03[_0x5e60('0x27')]()[_0x5e60('0x26')](function(){var _0x19f37b=_0x5d2c03['get']({'plain':!![]});var _0x45cb62=_0x5e60('0x28');return db[_0x5e60('0x29')][_0x5e60('0x27')]({'where':{'type':_0x45cb62,'resourceId':_0x19f37b['id']}})['then'](function(){return _0x5d2c03;});})[_0x5e60('0x26')](function(){_0x2a499e['status'](0xcc)[_0x5e60('0x1b')]();});}};}function handleEntityNotFound(_0x221322,_0x4ba727){return function(_0x46691f){if(!_0x46691f){_0x221322[_0x5e60('0x19')](0x194);}return _0x46691f;};}function handleError(_0x5b1b46,_0x1ee931){_0x1ee931=_0x1ee931||0x1f4;return function(_0xac9c7a){logger['error'](_0xac9c7a['stack']);if(_0xac9c7a['name']){delete _0xac9c7a[_0x5e60('0x2a')];}_0x5b1b46[_0x5e60('0x1a')](_0x1ee931)[_0x5e60('0x2b')](_0xac9c7a);};}exports[_0x5e60('0x2c')]=function(_0x3ccfee,_0x558197){var _0x168ce6={},_0x405461={},_0x4d4b55={'count':0x0,'rows':[]};var _0x11fc87=_['map'](db['JscriptyProject'][_0x5e60('0x2d')],function(_0x3c4340){return{'name':_0x3c4340[_0x5e60('0x2e')],'type':_0x3c4340[_0x5e60('0x2f')][_0x5e60('0x30')]};});_0x405461[_0x5e60('0x31')]=_[_0x5e60('0x32')](_0x11fc87,_0x5e60('0x2a'));_0x405461[_0x5e60('0x33')]=_[_0x5e60('0x34')](_0x3ccfee['query']);_0x405461[_0x5e60('0x35')]=_['intersection'](_0x405461['model'],_0x405461[_0x5e60('0x33')]);_0x168ce6[_0x5e60('0x36')]=_['intersection'](_0x405461[_0x5e60('0x31')],qs['fields'](_0x3ccfee[_0x5e60('0x33')][_0x5e60('0x37')]));_0x168ce6[_0x5e60('0x36')]=_0x168ce6[_0x5e60('0x36')][_0x5e60('0x38')]?_0x168ce6[_0x5e60('0x36')]:_0x405461[_0x5e60('0x31')];if(!_0x3ccfee[_0x5e60('0x33')]['hasOwnProperty'](_0x5e60('0x39'))){_0x168ce6[_0x5e60('0x1e')]=qs[_0x5e60('0x1e')](_0x3ccfee[_0x5e60('0x33')][_0x5e60('0x1e')]);_0x168ce6[_0x5e60('0x1d')]=qs[_0x5e60('0x1d')](_0x3ccfee['query'][_0x5e60('0x1d')]);}_0x168ce6[_0x5e60('0x3a')]=qs['sort'](_0x3ccfee['query'][_0x5e60('0x3b')]);_0x168ce6[_0x5e60('0x3c')]=qs[_0x5e60('0x35')](_[_0x5e60('0x3d')](_0x3ccfee[_0x5e60('0x33')],_0x405461['filters']),_0x11fc87);if(_0x3ccfee[_0x5e60('0x33')][_0x5e60('0x3e')]){_0x168ce6[_0x5e60('0x3c')]=_[_0x5e60('0x3f')](_0x168ce6[_0x5e60('0x3c')],{'$or':_[_0x5e60('0x32')](_0x11fc87,function(_0x2b635a){if(_0x2b635a['type']!==_0x5e60('0x40')){var _0x1f95b2={};_0x1f95b2[_0x2b635a['name']]={'$like':'%'+_0x3ccfee['query']['filter']+'%'};return _0x1f95b2;}})});}_0x168ce6=_[_0x5e60('0x3f')]({},_0x168ce6,_0x3ccfee[_0x5e60('0x41')]);var _0x2c6d5b={'where':_0x168ce6[_0x5e60('0x3c')]};return db['JscriptyProject'][_0x5e60('0x20')](_0x2c6d5b)[_0x5e60('0x26')](function(_0x4b6192){_0x4d4b55['count']=_0x4b6192;if(_0x3ccfee[_0x5e60('0x33')][_0x5e60('0x42')]){_0x168ce6[_0x5e60('0x43')]=[{'all':!![]}];}return db[_0x5e60('0x44')][_0x5e60('0x45')](_0x168ce6);})[_0x5e60('0x26')](function(_0x2522d2){_0x4d4b55[_0x5e60('0x46')]=_0x2522d2;return _0x4d4b55;})[_0x5e60('0x26')](respondWithFilteredResult(_0x558197,_0x168ce6))['catch'](handleError(_0x558197,null));};exports[_0x5e60('0x47')]=function(_0x2bb154,_0x59a2eb){var _0x1b1567={'raw':![],'where':{'id':_0x2bb154[_0x5e60('0x48')]['id']}},_0x4aac07={};_0x4aac07[_0x5e60('0x31')]=_[_0x5e60('0x34')](db['JscriptyProject'][_0x5e60('0x2d')]);_0x4aac07[_0x5e60('0x33')]=_[_0x5e60('0x34')](_0x2bb154[_0x5e60('0x33')]);_0x4aac07['filters']=_['intersection'](_0x4aac07['model'],_0x4aac07[_0x5e60('0x33')]);_0x1b1567[_0x5e60('0x36')]=_[_0x5e60('0x49')](_0x4aac07[_0x5e60('0x31')],qs[_0x5e60('0x37')](_0x2bb154[_0x5e60('0x33')]['fields']));_0x1b1567[_0x5e60('0x36')]=_0x1b1567[_0x5e60('0x36')][_0x5e60('0x38')]?_0x1b1567[_0x5e60('0x36')]:_0x4aac07[_0x5e60('0x31')];if(_0x2bb154[_0x5e60('0x33')][_0x5e60('0x42')]){_0x1b1567['include']=[{'all':!![]}];}_0x1b1567=_[_0x5e60('0x3f')]({},_0x1b1567,_0x2bb154[_0x5e60('0x41')]);return db[_0x5e60('0x44')][_0x5e60('0x4a')](_0x1b1567)[_0x5e60('0x26')](handleEntityNotFound(_0x59a2eb,null))[_0x5e60('0x26')](respondWithResult(_0x59a2eb,null))[_0x5e60('0x4b')](handleError(_0x59a2eb,null));};exports[_0x5e60('0x4c')]=function(_0x1518bd,_0x350d6d){return db[_0x5e60('0x44')][_0x5e60('0x4c')](_0x1518bd[_0x5e60('0x4d')],{})[_0x5e60('0x26')](function(_0x1aa381){var _0x176ef3=_0x1518bd[_0x5e60('0x4e')][_0x5e60('0x4f')]({'plain':!![]});if(!_0x176ef3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x176ef3['role']===_0x5e60('0x4e')){var _0x4d3588=_0x1aa381[_0x5e60('0x4f')]({'plain':!![]});var _0x1d247e=_0x5e60('0x28');return db[_0x5e60('0x50')][_0x5e60('0x4a')]({'where':{'name':_0x1d247e,'userProfileId':_0x176ef3[_0x5e60('0x51')]},'raw':!![]})['then'](function(_0x48bea6){if(_0x48bea6&&_0x48bea6[_0x5e60('0x52')]===0x0){return db[_0x5e60('0x29')][_0x5e60('0x4c')]({'name':_0x4d3588['name'],'resourceId':_0x4d3588['id'],'type':_0x48bea6['name'],'sectionId':_0x48bea6['id']},{})[_0x5e60('0x26')](function(){return _0x1aa381;});}else{return _0x1aa381;}})[_0x5e60('0x4b')](function(_0x179cc6){logger['error'](_0x5e60('0x53'),_0x179cc6);throw _0x179cc6;});}return _0x1aa381;})[_0x5e60('0x26')](respondWithResult(_0x350d6d,0xc9))[_0x5e60('0x4b')](handleError(_0x350d6d,null));};exports[_0x5e60('0x54')]=function(_0x17d002,_0x148204){var _0x4ae313={'where':{'id':_0x17d002[_0x5e60('0x48')]['id']}},_0x412be1={};_0x412be1['model']=_[_0x5e60('0x34')](db[_0x5e60('0x44')][_0x5e60('0x2d')]);_0x4ae313['attributes']=_[_0x5e60('0x49')](_0x412be1[_0x5e60('0x31')],qs['fields'](_0x17d002[_0x5e60('0x33')][_0x5e60('0x37')]));_0x4ae313[_0x5e60('0x36')]=_0x4ae313[_0x5e60('0x36')]['length']?_0x4ae313[_0x5e60('0x36')]:_0x412be1[_0x5e60('0x31')];if(_0x17d002['query'][_0x5e60('0x42')]){_0x4ae313['include']=[{'all':!![]}];}_0x4ae313=_[_0x5e60('0x3f')]({},_0x4ae313,_0x17d002['options']);return db[_0x5e60('0x44')][_0x5e60('0x4a')](_0x4ae313)['then'](handleEntityNotFound(_0x148204,null))[_0x5e60('0x26')](function(_0x4b52d1){if(_0x4b52d1){var _0x1a2094=_0x4b52d1['get']({'plain':!![]});_0x1a2094=qs[_0x5e60('0x55')](_0x1a2094,['id','createdAt',_0x5e60('0x56')]);_0x17d002[_0x5e60('0x4d')]=_[_0x5e60('0x55')](_0x17d002[_0x5e60('0x4d')],['id',_0x5e60('0x57'),_0x5e60('0x56')]);return db[_0x5e60('0x44')]['create'](_[_0x5e60('0x3f')](_0x1a2094,_0x17d002[_0x5e60('0x4d')]),{'include':_0x17d002[_0x5e60('0x33')][_0x5e60('0x42')]?[{'all':!![]}]:undefined})[_0x5e60('0x26')](function(_0x35aad7){var _0x4a59bd=_0x17d002['user']['get']({'plain':!![]});if(!_0x4a59bd)throw new Error(_0x5e60('0x58'));if(_0x4a59bd[_0x5e60('0x59')]==='user'){var _0x15bb11=_0x35aad7[_0x5e60('0x4f')]({'plain':!![]});var _0x557f74=_0x5e60('0x28');return db[_0x5e60('0x50')][_0x5e60('0x4a')]({'where':{'name':_0x557f74,'userProfileId':_0x4a59bd[_0x5e60('0x51')]},'raw':!![]})[_0x5e60('0x26')](function(_0xcd2232){if(_0xcd2232&&_0xcd2232[_0x5e60('0x52')]===0x0){return db[_0x5e60('0x29')][_0x5e60('0x4c')]({'name':_0x15bb11[_0x5e60('0x2a')],'resourceId':_0x15bb11['id'],'type':_0xcd2232[_0x5e60('0x2a')],'sectionId':_0xcd2232['id']},{})[_0x5e60('0x26')](function(){return _0x35aad7;});}else{return _0x35aad7;}})[_0x5e60('0x4b')](function(_0x2826f7){logger[_0x5e60('0x5a')](_0x5e60('0x53'),_0x2826f7);throw _0x2826f7;});}return _0x35aad7;});}})[_0x5e60('0x26')](respondWithResult(_0x148204,0xc9))['catch'](handleError(_0x148204,null));};exports[_0x5e60('0x25')]=function(_0x1706d6,_0x16e7e9){if(_0x1706d6['body']['id']){delete _0x1706d6[_0x5e60('0x4d')]['id'];}return db[_0x5e60('0x44')]['find']({'where':{'id':_0x1706d6[_0x5e60('0x48')]['id']}})[_0x5e60('0x26')](handleEntityNotFound(_0x16e7e9,null))['then'](saveUpdates(_0x1706d6[_0x5e60('0x4d')],null))[_0x5e60('0x26')](respondWithResult(_0x16e7e9,null))[_0x5e60('0x4b')](handleError(_0x16e7e9,null));};exports[_0x5e60('0x27')]=function(_0x1db659,_0x711888){return db[_0x5e60('0x44')][_0x5e60('0x4a')]({'where':{'id':_0x1db659[_0x5e60('0x48')]['id']}})['then'](handleEntityNotFound(_0x711888,null))[_0x5e60('0x26')](removeEntity(_0x711888,null))[_0x5e60('0x4b')](handleError(_0x711888,null));};exports[_0x5e60('0x5b')]=function(_0x4d79e2,_0x27065d,_0x39fa74){var _0x155db0={'raw':!![],'where':{}};var _0x15d975={};var _0x3e85fe={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x5e60('0x5c')]({'where':{'id':_0x4d79e2[_0x5e60('0x48')]['id']}})[_0x5e60('0x26')](handleEntityNotFound(_0x27065d,null))['then'](function(_0x565d53){if(_0x565d53){_0x15d975[_0x5e60('0x31')]=_[_0x5e60('0x34')](db[_0x5e60('0x5d')][_0x5e60('0x2d')]);_0x15d975[_0x5e60('0x33')]=_[_0x5e60('0x34')](_0x4d79e2[_0x5e60('0x33')]);_0x15d975['filters']=_[_0x5e60('0x49')](_0x15d975[_0x5e60('0x31')],_0x15d975[_0x5e60('0x33')]);_0x155db0['attributes']=_['intersection'](_0x15d975[_0x5e60('0x31')],qs[_0x5e60('0x37')](_0x4d79e2[_0x5e60('0x33')]['fields']));_0x155db0['attributes']=_0x155db0[_0x5e60('0x36')][_0x5e60('0x38')]?_0x155db0[_0x5e60('0x36')]:_0x15d975[_0x5e60('0x31')];if(!_0x4d79e2[_0x5e60('0x33')][_0x5e60('0x5e')]('nolimit')){_0x155db0[_0x5e60('0x1e')]=qs[_0x5e60('0x1e')](_0x4d79e2[_0x5e60('0x33')][_0x5e60('0x1e')]);_0x155db0[_0x5e60('0x1d')]=qs[_0x5e60('0x1d')](_0x4d79e2[_0x5e60('0x33')][_0x5e60('0x1d')]);}_0x155db0[_0x5e60('0x3a')]=qs['sort'](_0x4d79e2[_0x5e60('0x33')][_0x5e60('0x3b')]);_0x155db0['where']=qs[_0x5e60('0x35')](_[_0x5e60('0x3d')](_0x4d79e2['query'],_0x15d975[_0x5e60('0x35')]));_0x155db0[_0x5e60('0x3c')][_0x5e60('0x5f')]=_0x565d53['id'];if(_0x4d79e2[_0x5e60('0x33')][_0x5e60('0x3e')]){_0x155db0[_0x5e60('0x3c')]=_['merge'](_0x155db0[_0x5e60('0x3c')],{'$or':_[_0x5e60('0x32')](_0x155db0[_0x5e60('0x36')],function(_0x222d94){var _0x95d1c5={};_0x95d1c5[_0x222d94]={'$like':'%'+_0x4d79e2[_0x5e60('0x33')][_0x5e60('0x3e')]+'%'};return _0x95d1c5;})});}_0x155db0=_[_0x5e60('0x3f')]({},_0x155db0,_0x4d79e2[_0x5e60('0x41')]);return db['JscriptySessionReport'][_0x5e60('0x20')]({'where':_0x155db0[_0x5e60('0x3c')]})[_0x5e60('0x26')](function(_0x3fae7f){_0x3e85fe[_0x5e60('0x20')]=_0x3fae7f;if(_0x4d79e2[_0x5e60('0x33')][_0x5e60('0x42')]){_0x155db0[_0x5e60('0x43')]=[{'all':!![]}];}return db[_0x5e60('0x5d')][_0x5e60('0x45')](_0x155db0);})['then'](function(_0x5ab78f){_0x3e85fe['rows']=_0x5ab78f;return _0x3e85fe;});}})[_0x5e60('0x26')](respondWithFilteredResult(_0x27065d,_0x155db0))[_0x5e60('0x4b')](handleError(_0x27065d,null));};exports[_0x5e60('0x60')]=function(_0x1a911a,_0x4744b7,_0x462875){var _0x3ea45e={'raw':!![],'where':{}};var _0x58640c={};var _0x120fab={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x5e60('0x5c')]({'where':{'id':_0x1a911a[_0x5e60('0x48')]['id']}})[_0x5e60('0x26')](handleEntityNotFound(_0x4744b7,null))['then'](function(_0x1976f2){if(_0x1976f2){_0x58640c['model']=_['keys'](db['JscriptyAnswerReport'][_0x5e60('0x2d')]);_0x58640c[_0x5e60('0x33')]=_[_0x5e60('0x34')](_0x1a911a[_0x5e60('0x33')]);_0x58640c[_0x5e60('0x35')]=_[_0x5e60('0x49')](_0x58640c[_0x5e60('0x31')],_0x58640c[_0x5e60('0x33')]);_0x3ea45e[_0x5e60('0x36')]=_['intersection'](_0x58640c[_0x5e60('0x31')],qs[_0x5e60('0x37')](_0x1a911a[_0x5e60('0x33')][_0x5e60('0x37')]));_0x3ea45e[_0x5e60('0x36')]=_0x3ea45e[_0x5e60('0x36')][_0x5e60('0x38')]?_0x3ea45e[_0x5e60('0x36')]:_0x58640c[_0x5e60('0x31')];if(!_0x1a911a[_0x5e60('0x33')][_0x5e60('0x5e')](_0x5e60('0x39'))){_0x3ea45e['limit']=qs[_0x5e60('0x1e')](_0x1a911a[_0x5e60('0x33')][_0x5e60('0x1e')]);_0x3ea45e[_0x5e60('0x1d')]=qs[_0x5e60('0x1d')](_0x1a911a[_0x5e60('0x33')][_0x5e60('0x1d')]);}_0x3ea45e[_0x5e60('0x3a')]=qs[_0x5e60('0x3b')](_0x1a911a[_0x5e60('0x33')][_0x5e60('0x3b')]);_0x3ea45e[_0x5e60('0x3c')]=qs[_0x5e60('0x35')](_[_0x5e60('0x3d')](_0x1a911a[_0x5e60('0x33')],_0x58640c[_0x5e60('0x35')]));_0x3ea45e[_0x5e60('0x3c')][_0x5e60('0x5f')]=_0x1976f2['id'];if(_0x1a911a[_0x5e60('0x33')][_0x5e60('0x3e')]){_0x3ea45e['where']=_[_0x5e60('0x3f')](_0x3ea45e[_0x5e60('0x3c')],{'$or':_[_0x5e60('0x32')](_0x3ea45e['attributes'],function(_0x4a4417){var _0x1b5e2c={};_0x1b5e2c[_0x4a4417]={'$like':'%'+_0x1a911a[_0x5e60('0x33')][_0x5e60('0x3e')]+'%'};return _0x1b5e2c;})});}_0x3ea45e=_[_0x5e60('0x3f')]({},_0x3ea45e,_0x1a911a[_0x5e60('0x41')]);return db[_0x5e60('0x61')][_0x5e60('0x20')]({'where':_0x3ea45e[_0x5e60('0x3c')]})[_0x5e60('0x26')](function(_0x668dbd){_0x120fab[_0x5e60('0x20')]=_0x668dbd;if(_0x1a911a[_0x5e60('0x33')][_0x5e60('0x42')]){_0x3ea45e[_0x5e60('0x43')]=[{'all':!![]}];}return db[_0x5e60('0x61')][_0x5e60('0x45')](_0x3ea45e);})[_0x5e60('0x26')](function(_0x4cbbe4){_0x120fab[_0x5e60('0x46')]=_0x4cbbe4;return _0x120fab;});}})[_0x5e60('0x26')](respondWithFilteredResult(_0x4744b7,_0x3ea45e))[_0x5e60('0x4b')](handleError(_0x4744b7,null));};function char(_0x2ba733){return'number'===typeof _0x2ba733?String[_0x5e60('0x62')][_0x5e60('0x23')](null,arguments):_0x2ba733;}function needsEncapsulation(_0x3799de){return!!_0x3799de&&(_0x3799de['toString']()['indexOf'](char(0xd))>=0x0||_0x3799de[_0x5e60('0x63')]()[_0x5e60('0x64')](char(0xa))>=0x0||_0x3799de[_0x5e60('0x63')]()[_0x5e60('0x64')](char(0x2c))>=0x0||_0x3799de['toString']()[_0x5e60('0x64')](char(0x22))>=0x0);}function encapsulate(_0xe367b1){var _0x4f5f9c=char(0x22),_0x47d623='\x5c'+char(0x22),_0x69e5b5=_0xe367b1[_0x5e60('0x63')]()[_0x5e60('0x65')](new RegExp(_0x4f5f9c,'g'),_0x47d623);return _0x4f5f9c+_0x69e5b5+_0x4f5f9c;}exports['getSummary']=function(_0x5cf999,_0x551802,_0x34d0bf){var _0x45d19d,_0x2a0841;var _0x9f7ad8={'where':{'ProjectId':_0x5cf999['params']['id']}};if(_0x5cf999[_0x5e60('0x33')][_0x5e60('0x66')]){_0x9f7ad8[_0x5e60('0x3c')][_0x5e60('0x67')]=JSON[_0x5e60('0x68')](_0x5cf999[_0x5e60('0x33')]['startTime']);}return db[_0x5e60('0x5d')]['findAll'](_0x9f7ad8)[_0x5e60('0x26')](handleEntityNotFound(_0x551802,null))['then'](function(_0x33af24){if(_0x33af24){_0x45d19d=_0x33af24;return db['JscriptyQuestionReport'][_0x5e60('0x45')]({'where':{'SessionId':{'$in':_[_0x5e60('0x32')](_0x45d19d,'id')},'ProjectId':_0x5cf999[_0x5e60('0x48')]['id']},'order':_0x5e60('0x69')});}})[_0x5e60('0x26')](handleEntityNotFound(_0x551802,null))[_0x5e60('0x26')](function(_0x2a0571){if(_0x2a0571){_0x2a0841=_0x2a0571;var _0x297981={};for(var _0x3cb824=0x0,_0x59cdb7=_0x2a0841['length'];_0x3cb824<_0x59cdb7;_0x3cb824++){if(!_0x297981[_0x5e60('0x5e')](_0x2a0841[_0x3cb824]['questionId'])){_0x297981[_0x2a0841[_0x3cb824][_0x5e60('0x6a')]]=needsEncapsulation(_0x2a0841[_0x3cb824][_0x5e60('0x6b')])?encapsulate(_0x2a0841[_0x3cb824]['question']):_0x2a0841[_0x3cb824]['question'];}}var _0x34bf41=[],_0x29ab78={};for(var _0x37c9c3=0x0,_0x5428c4=_0x45d19d[_0x5e60('0x38')];_0x37c9c3<_0x5428c4;_0x37c9c3++){_0x29ab78={'ProjectId':_0x5cf999[_0x5e60('0x48')]['id'],'SessionId':_0x45d19d[_0x37c9c3]['id'],'StartTime':moment(_0x45d19d[_0x37c9c3][_0x5e60('0x67')])[_0x5e60('0x6c')](_0x5e60('0x6d'))};for(var _0x220a31=0x0,_0x110527=_0x2a0841[_0x5e60('0x38')];_0x220a31<_0x110527;_0x220a31++){if(_0x2a0841[_0x220a31][_0x5e60('0x6e')]==_0x45d19d[_0x37c9c3]['id']&&_0x297981[_0x5e60('0x5e')](_0x2a0841[_0x220a31]['questionId'])){_0x29ab78[_0x297981[_0x2a0841[_0x220a31][_0x5e60('0x6a')]]]=_0x2a0841[_0x220a31][_0x5e60('0x6f')];}}for(var _0x320035 in _0x297981){if(!_0x29ab78[_0x5e60('0x5e')](_0x297981[_0x320035])){_0x29ab78[_0x297981[_0x320035]]=null;}}_0x34bf41[_0x5e60('0x70')](_0x29ab78);}return _0x34bf41;}})[_0x5e60('0x26')](function(_0x27a4f5){if(!_[_0x5e60('0x71')](_0x27a4f5)){var _0x15b6c5=toCsv(_0x27a4f5);var _0x2f84f3=Date['now']();fs[_0x5e60('0x72')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x5cf999[_0x5e60('0x48')]['id'],_0x2f84f3),_0x15b6c5);_0x551802['setHeader'](_0x5e60('0x73'),_0x5e60('0x74')+util[_0x5e60('0x6c')](_0x5e60('0x75'),_0x5cf999[_0x5e60('0x48')]['id'],_0x2f84f3));_0x551802[_0x5e60('0x76')](_0x5e60('0x77'),_0x5e60('0x78'));return _0x551802[_0x5e60('0x79')](util['format'](_0x5e60('0x7a'),_0x5cf999[_0x5e60('0x48')]['id'],_0x2f84f3));}else{return _0x551802[_0x5e60('0x19')](0xcc);}})['catch'](handleError(_0x551802,null));}; \ No newline at end of file +var _0xce2e=['YYYY-MM-DD\x20HH:mm:ss','answer','push','isEmpty','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','get','Projects','UserProfileResource','error','stack','name','send','index','map','JscriptyProject','fieldName','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','omit','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','getSessions','findOne','JscriptySessionReport','hasOwnProperty','ProjectId','getAnswers','JscriptyAnswerReport','fromCharCode','toString','indexOf','getSummary','startTime','parse','JscriptyQuestionReport','-createdAt','questionId','question','starttime'];(function(_0x38ad8e,_0x33ebc2){var _0xe17df5=function(_0x235752){while(--_0x235752){_0x38ad8e['push'](_0x38ad8e['shift']());}};_0xe17df5(++_0x33ebc2);}(_0xce2e,0x1d8));var _0xece2=function(_0x4430b8,_0x37992c){_0x4430b8=_0x4430b8-0x0;var _0x390cee=_0xce2e[_0x4430b8];return _0x390cee;};'use strict';var emlformat=require(_0xece2('0x0'));var rimraf=require(_0xece2('0x1'));var zipdir=require(_0xece2('0x2'));var jsonpatch=require(_0xece2('0x3'));var rp=require(_0xece2('0x4'));var moment=require(_0xece2('0x5'));var BPromise=require(_0xece2('0x6'));var Mustache=require('mustache');var util=require(_0xece2('0x7'));var path=require(_0xece2('0x8'));var sox=require(_0xece2('0x9'));var csv=require(_0xece2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xece2('0xb'));var squel=require(_0xece2('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xece2('0xd'));var toCsv=require(_0xece2('0xa'));var querystring=require(_0xece2('0xe'));var Papa=require('papaparse');var Redis=require(_0xece2('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xece2('0x10'));var hardwareService=require(_0xece2('0x11'));var logger=require('../../config/logger')(_0xece2('0x12'));var utils=require(_0xece2('0x13'));var config=require(_0xece2('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xcebd89,_0x3d327d){_0x3d327d=_0x3d327d||0xcc;return function(_0x1c2063){if(_0x1c2063){return _0xcebd89[_0xece2('0x15')](_0x3d327d);}return _0xcebd89['status'](_0x3d327d)['end']();};}function respondWithResult(_0x5ba8ae,_0x14ffa4){_0x14ffa4=_0x14ffa4||0xc8;return function(_0xa6adef){if(_0xa6adef){return _0x5ba8ae[_0xece2('0x16')](_0x14ffa4)[_0xece2('0x17')](_0xa6adef);}};}function respondWithFilteredResult(_0x31ef78,_0x596c20){return function(_0x4489ed){if(_0x4489ed){var _0x3f5874=typeof _0x596c20[_0xece2('0x18')]===_0xece2('0x19')&&typeof _0x596c20[_0xece2('0x1a')]===_0xece2('0x19');var _0x5d281b=_0x4489ed[_0xece2('0x1b')];var _0x1df828=_0x3f5874?0x0:_0x596c20[_0xece2('0x18')];var _0x37bfe0=_0x3f5874?_0x4489ed[_0xece2('0x1b')]:_0x596c20[_0xece2('0x18')]+_0x596c20[_0xece2('0x1a')];var _0x252140;if(_0x37bfe0>=_0x5d281b){_0x37bfe0=_0x5d281b;_0x252140=0xc8;}else{_0x252140=0xce;}_0x31ef78[_0xece2('0x16')](_0x252140);return _0x31ef78[_0xece2('0x1c')](_0xece2('0x1d'),_0x1df828+'-'+_0x37bfe0+'/'+_0x5d281b)[_0xece2('0x17')](_0x4489ed);}return null;};}function patchUpdates(_0x235ae0){return function(_0x1c2a67){try{jsonpatch[_0xece2('0x1e')](_0x1c2a67,_0x235ae0,!![]);}catch(_0x3b6001){return BPromise[_0xece2('0x1f')](_0x3b6001);}return _0x1c2a67['save']();};}function saveUpdates(_0x5acb31,_0x27c58f){return function(_0x2cdc3b){if(_0x2cdc3b){return _0x2cdc3b[_0xece2('0x20')](_0x5acb31)[_0xece2('0x21')](function(_0x44975e){return _0x44975e;});}return null;};}function removeEntity(_0x34fa4c,_0x1b93b6){return function(_0x36a099){if(_0x36a099){return _0x36a099['destroy']()['then'](function(){var _0x2af4b7=_0x36a099[_0xece2('0x22')]({'plain':!![]});var _0x47b78f=_0xece2('0x23');return db[_0xece2('0x24')]['destroy']({'where':{'type':_0x47b78f,'resourceId':_0x2af4b7['id']}})[_0xece2('0x21')](function(){return _0x36a099;});})[_0xece2('0x21')](function(){_0x34fa4c[_0xece2('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f0409,_0x315d6b){return function(_0x48d632){if(!_0x48d632){_0x4f0409[_0xece2('0x15')](0x194);}return _0x48d632;};}function handleError(_0x1bd740,_0x68570d){_0x68570d=_0x68570d||0x1f4;return function(_0x57650d){logger[_0xece2('0x25')](_0x57650d[_0xece2('0x26')]);if(_0x57650d['name']){delete _0x57650d[_0xece2('0x27')];}_0x1bd740['status'](_0x68570d)[_0xece2('0x28')](_0x57650d);};}exports[_0xece2('0x29')]=function(_0x23c850,_0x500fc9){var _0x21d6bb={},_0x1f6e45={},_0x40ec57={'count':0x0,'rows':[]};var _0x9c9171=_[_0xece2('0x2a')](db[_0xece2('0x2b')]['rawAttributes'],function(_0x151d9a){return{'name':_0x151d9a[_0xece2('0x2c')],'type':_0x151d9a['type'][_0xece2('0x2d')]};});_0x1f6e45[_0xece2('0x2e')]=_['map'](_0x9c9171,_0xece2('0x27'));_0x1f6e45[_0xece2('0x2f')]=_[_0xece2('0x30')](_0x23c850[_0xece2('0x2f')]);_0x1f6e45[_0xece2('0x31')]=_[_0xece2('0x32')](_0x1f6e45[_0xece2('0x2e')],_0x1f6e45['query']);_0x21d6bb[_0xece2('0x33')]=_[_0xece2('0x32')](_0x1f6e45[_0xece2('0x2e')],qs[_0xece2('0x34')](_0x23c850['query'][_0xece2('0x34')]));_0x21d6bb[_0xece2('0x33')]=_0x21d6bb[_0xece2('0x33')]['length']?_0x21d6bb['attributes']:_0x1f6e45[_0xece2('0x2e')];if(!_0x23c850[_0xece2('0x2f')]['hasOwnProperty'](_0xece2('0x35'))){_0x21d6bb['limit']=qs[_0xece2('0x1a')](_0x23c850['query'][_0xece2('0x1a')]);_0x21d6bb['offset']=qs[_0xece2('0x18')](_0x23c850[_0xece2('0x2f')][_0xece2('0x18')]);}_0x21d6bb[_0xece2('0x36')]=qs[_0xece2('0x37')](_0x23c850[_0xece2('0x2f')][_0xece2('0x37')]);_0x21d6bb[_0xece2('0x38')]=qs[_0xece2('0x31')](_[_0xece2('0x39')](_0x23c850[_0xece2('0x2f')],_0x1f6e45[_0xece2('0x31')]),_0x9c9171);if(_0x23c850[_0xece2('0x2f')]['filter']){_0x21d6bb[_0xece2('0x38')]=_[_0xece2('0x3a')](_0x21d6bb[_0xece2('0x38')],{'$or':_['map'](_0x9c9171,function(_0x4f8fad){if(_0x4f8fad[_0xece2('0x3b')]!=='VIRTUAL'){var _0x41adee={};_0x41adee[_0x4f8fad[_0xece2('0x27')]]={'$like':'%'+_0x23c850[_0xece2('0x2f')][_0xece2('0x3c')]+'%'};return _0x41adee;}})});}_0x21d6bb=_[_0xece2('0x3a')]({},_0x21d6bb,_0x23c850[_0xece2('0x3d')]);var _0x2e088d={'where':_0x21d6bb['where']};return db['JscriptyProject'][_0xece2('0x1b')](_0x2e088d)[_0xece2('0x21')](function(_0x1de9f7){_0x40ec57[_0xece2('0x1b')]=_0x1de9f7;if(_0x23c850['query'][_0xece2('0x3e')]){_0x21d6bb[_0xece2('0x3f')]=[{'all':!![]}];}return db[_0xece2('0x2b')][_0xece2('0x40')](_0x21d6bb);})[_0xece2('0x21')](function(_0x219b4f){_0x40ec57[_0xece2('0x41')]=_0x219b4f;return _0x40ec57;})['then'](respondWithFilteredResult(_0x500fc9,_0x21d6bb))[_0xece2('0x42')](handleError(_0x500fc9,null));};exports[_0xece2('0x43')]=function(_0x44df58,_0x3aaaa2){var _0x4702e8={'raw':![],'where':{'id':_0x44df58[_0xece2('0x44')]['id']}},_0x687290={};_0x687290['model']=_[_0xece2('0x30')](db[_0xece2('0x2b')][_0xece2('0x45')]);_0x687290[_0xece2('0x2f')]=_[_0xece2('0x30')](_0x44df58[_0xece2('0x2f')]);_0x687290[_0xece2('0x31')]=_[_0xece2('0x32')](_0x687290[_0xece2('0x2e')],_0x687290[_0xece2('0x2f')]);_0x4702e8[_0xece2('0x33')]=_[_0xece2('0x32')](_0x687290[_0xece2('0x2e')],qs['fields'](_0x44df58[_0xece2('0x2f')]['fields']));_0x4702e8[_0xece2('0x33')]=_0x4702e8[_0xece2('0x33')][_0xece2('0x46')]?_0x4702e8[_0xece2('0x33')]:_0x687290[_0xece2('0x2e')];if(_0x44df58[_0xece2('0x2f')][_0xece2('0x3e')]){_0x4702e8[_0xece2('0x3f')]=[{'all':!![]}];}_0x4702e8=_[_0xece2('0x3a')]({},_0x4702e8,_0x44df58['options']);return db['JscriptyProject'][_0xece2('0x47')](_0x4702e8)[_0xece2('0x21')](handleEntityNotFound(_0x3aaaa2,null))[_0xece2('0x21')](respondWithResult(_0x3aaaa2,null))[_0xece2('0x42')](handleError(_0x3aaaa2,null));};exports[_0xece2('0x48')]=function(_0xe6fef6,_0x298b78){return db[_0xece2('0x2b')][_0xece2('0x48')](_0xe6fef6[_0xece2('0x49')],{})['then'](function(_0x13bf00){var _0x1edfee=_0xe6fef6['user'][_0xece2('0x22')]({'plain':!![]});if(!_0x1edfee)throw new Error(_0xece2('0x4a'));if(_0x1edfee[_0xece2('0x4b')]===_0xece2('0x4c')){var _0x3fbdde=_0x13bf00[_0xece2('0x22')]({'plain':!![]});var _0x4bf40b='Projects';return db[_0xece2('0x4d')]['find']({'where':{'name':_0x4bf40b,'userProfileId':_0x1edfee[_0xece2('0x4e')]},'raw':!![]})[_0xece2('0x21')](function(_0x3fe4c1){if(_0x3fe4c1&&_0x3fe4c1[_0xece2('0x4f')]===0x0){return db['UserProfileResource'][_0xece2('0x48')]({'name':_0x3fbdde[_0xece2('0x27')],'resourceId':_0x3fbdde['id'],'type':_0x3fe4c1[_0xece2('0x27')],'sectionId':_0x3fe4c1['id']},{})['then'](function(){return _0x13bf00;});}else{return _0x13bf00;}})[_0xece2('0x42')](function(_0x522e9a){logger[_0xece2('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x522e9a);throw _0x522e9a;});}return _0x13bf00;})[_0xece2('0x21')](respondWithResult(_0x298b78,0xc9))[_0xece2('0x42')](handleError(_0x298b78,null));};exports['clone']=function(_0x3ca140,_0xdce358){var _0x481316={'where':{'id':_0x3ca140[_0xece2('0x44')]['id']}},_0x3880cb={};_0x3880cb[_0xece2('0x2e')]=_[_0xece2('0x30')](db[_0xece2('0x2b')][_0xece2('0x45')]);_0x481316['attributes']=_['intersection'](_0x3880cb[_0xece2('0x2e')],qs[_0xece2('0x34')](_0x3ca140[_0xece2('0x2f')][_0xece2('0x34')]));_0x481316[_0xece2('0x33')]=_0x481316[_0xece2('0x33')][_0xece2('0x46')]?_0x481316[_0xece2('0x33')]:_0x3880cb['model'];if(_0x3ca140[_0xece2('0x2f')][_0xece2('0x3e')]){_0x481316[_0xece2('0x3f')]=[{'all':!![]}];}_0x481316=_['merge']({},_0x481316,_0x3ca140['options']);return db[_0xece2('0x2b')][_0xece2('0x47')](_0x481316)[_0xece2('0x21')](handleEntityNotFound(_0xdce358,null))['then'](function(_0x491521){if(_0x491521){var _0x4517f4=_0x491521[_0xece2('0x22')]({'plain':!![]});_0x4517f4=qs[_0xece2('0x50')](_0x4517f4,['id',_0xece2('0x51'),_0xece2('0x52')]);_0x3ca140[_0xece2('0x49')]=_[_0xece2('0x50')](_0x3ca140[_0xece2('0x49')],['id',_0xece2('0x51'),_0xece2('0x52')]);return db[_0xece2('0x2b')]['create'](_[_0xece2('0x3a')](_0x4517f4,_0x3ca140['body']),{'include':_0x3ca140[_0xece2('0x2f')][_0xece2('0x3e')]?[{'all':!![]}]:undefined})['then'](function(_0x483503){var _0x1eb02f=_0x3ca140[_0xece2('0x4c')][_0xece2('0x22')]({'plain':!![]});if(!_0x1eb02f)throw new Error(_0xece2('0x4a'));if(_0x1eb02f[_0xece2('0x4b')]===_0xece2('0x4c')){var _0x6eb976=_0x483503[_0xece2('0x22')]({'plain':!![]});var _0x2a5bd0=_0xece2('0x23');return db[_0xece2('0x4d')][_0xece2('0x47')]({'where':{'name':_0x2a5bd0,'userProfileId':_0x1eb02f[_0xece2('0x4e')]},'raw':!![]})[_0xece2('0x21')](function(_0xee7760){if(_0xee7760&&_0xee7760[_0xece2('0x4f')]===0x0){return db[_0xece2('0x24')][_0xece2('0x48')]({'name':_0x6eb976[_0xece2('0x27')],'resourceId':_0x6eb976['id'],'type':_0xee7760[_0xece2('0x27')],'sectionId':_0xee7760['id']},{})[_0xece2('0x21')](function(){return _0x483503;});}else{return _0x483503;}})[_0xece2('0x42')](function(_0x1c1380){logger[_0xece2('0x25')](_0xece2('0x53'),_0x1c1380);throw _0x1c1380;});}return _0x483503;});}})[_0xece2('0x21')](respondWithResult(_0xdce358,0xc9))[_0xece2('0x42')](handleError(_0xdce358,null));};exports[_0xece2('0x20')]=function(_0x369252,_0x3ca6da){if(_0x369252[_0xece2('0x49')]['id']){delete _0x369252['body']['id'];}return db[_0xece2('0x2b')][_0xece2('0x47')]({'where':{'id':_0x369252[_0xece2('0x44')]['id']}})[_0xece2('0x21')](handleEntityNotFound(_0x3ca6da,null))['then'](saveUpdates(_0x369252[_0xece2('0x49')],null))['then'](respondWithResult(_0x3ca6da,null))[_0xece2('0x42')](handleError(_0x3ca6da,null));};exports[_0xece2('0x54')]=function(_0x10d69d,_0x533b43){return db['JscriptyProject'][_0xece2('0x47')]({'where':{'id':_0x10d69d[_0xece2('0x44')]['id']}})[_0xece2('0x21')](handleEntityNotFound(_0x533b43,null))[_0xece2('0x21')](removeEntity(_0x533b43,null))[_0xece2('0x42')](handleError(_0x533b43,null));};exports[_0xece2('0x55')]=function(_0x59a645,_0x4df654,_0x5c4e21){var _0x453a28={'raw':!![],'where':{}};var _0x3ed0a2={};var _0x1299b5={'count':0x0,'rows':[]};return db[_0xece2('0x2b')][_0xece2('0x56')]({'where':{'id':_0x59a645[_0xece2('0x44')]['id']}})[_0xece2('0x21')](handleEntityNotFound(_0x4df654,null))[_0xece2('0x21')](function(_0x2202bd){if(_0x2202bd){_0x3ed0a2[_0xece2('0x2e')]=_[_0xece2('0x30')](db[_0xece2('0x57')][_0xece2('0x45')]);_0x3ed0a2[_0xece2('0x2f')]=_['keys'](_0x59a645[_0xece2('0x2f')]);_0x3ed0a2[_0xece2('0x31')]=_['intersection'](_0x3ed0a2[_0xece2('0x2e')],_0x3ed0a2['query']);_0x453a28[_0xece2('0x33')]=_[_0xece2('0x32')](_0x3ed0a2[_0xece2('0x2e')],qs['fields'](_0x59a645[_0xece2('0x2f')][_0xece2('0x34')]));_0x453a28[_0xece2('0x33')]=_0x453a28['attributes'][_0xece2('0x46')]?_0x453a28[_0xece2('0x33')]:_0x3ed0a2['model'];if(!_0x59a645[_0xece2('0x2f')][_0xece2('0x58')](_0xece2('0x35'))){_0x453a28[_0xece2('0x1a')]=qs[_0xece2('0x1a')](_0x59a645['query'][_0xece2('0x1a')]);_0x453a28[_0xece2('0x18')]=qs[_0xece2('0x18')](_0x59a645['query'][_0xece2('0x18')]);}_0x453a28[_0xece2('0x36')]=qs[_0xece2('0x37')](_0x59a645[_0xece2('0x2f')]['sort']);_0x453a28[_0xece2('0x38')]=qs[_0xece2('0x31')](_[_0xece2('0x39')](_0x59a645[_0xece2('0x2f')],_0x3ed0a2[_0xece2('0x31')]));_0x453a28[_0xece2('0x38')][_0xece2('0x59')]=_0x2202bd['id'];if(_0x59a645[_0xece2('0x2f')]['filter']){_0x453a28[_0xece2('0x38')]=_['merge'](_0x453a28[_0xece2('0x38')],{'$or':_['map'](_0x453a28['attributes'],function(_0x2e4850){var _0x1be9ab={};_0x1be9ab[_0x2e4850]={'$like':'%'+_0x59a645['query'][_0xece2('0x3c')]+'%'};return _0x1be9ab;})});}_0x453a28=_[_0xece2('0x3a')]({},_0x453a28,_0x59a645['options']);return db[_0xece2('0x57')][_0xece2('0x1b')]({'where':_0x453a28[_0xece2('0x38')]})[_0xece2('0x21')](function(_0x14e590){_0x1299b5[_0xece2('0x1b')]=_0x14e590;if(_0x59a645['query']['includeAll']){_0x453a28[_0xece2('0x3f')]=[{'all':!![]}];}return db[_0xece2('0x57')][_0xece2('0x40')](_0x453a28);})[_0xece2('0x21')](function(_0x339495){_0x1299b5[_0xece2('0x41')]=_0x339495;return _0x1299b5;});}})[_0xece2('0x21')](respondWithFilteredResult(_0x4df654,_0x453a28))[_0xece2('0x42')](handleError(_0x4df654,null));};exports[_0xece2('0x5a')]=function(_0x3b5de3,_0x3fff55,_0x33f706){var _0x175e17={'raw':!![],'where':{}};var _0xd40ab3={};var _0x205bb4={'count':0x0,'rows':[]};return db[_0xece2('0x2b')][_0xece2('0x56')]({'where':{'id':_0x3b5de3[_0xece2('0x44')]['id']}})[_0xece2('0x21')](handleEntityNotFound(_0x3fff55,null))['then'](function(_0x4090eb){if(_0x4090eb){_0xd40ab3[_0xece2('0x2e')]=_[_0xece2('0x30')](db[_0xece2('0x5b')][_0xece2('0x45')]);_0xd40ab3[_0xece2('0x2f')]=_['keys'](_0x3b5de3['query']);_0xd40ab3['filters']=_['intersection'](_0xd40ab3[_0xece2('0x2e')],_0xd40ab3[_0xece2('0x2f')]);_0x175e17[_0xece2('0x33')]=_[_0xece2('0x32')](_0xd40ab3[_0xece2('0x2e')],qs['fields'](_0x3b5de3[_0xece2('0x2f')][_0xece2('0x34')]));_0x175e17[_0xece2('0x33')]=_0x175e17[_0xece2('0x33')][_0xece2('0x46')]?_0x175e17[_0xece2('0x33')]:_0xd40ab3['model'];if(!_0x3b5de3['query'][_0xece2('0x58')](_0xece2('0x35'))){_0x175e17[_0xece2('0x1a')]=qs[_0xece2('0x1a')](_0x3b5de3[_0xece2('0x2f')][_0xece2('0x1a')]);_0x175e17[_0xece2('0x18')]=qs[_0xece2('0x18')](_0x3b5de3[_0xece2('0x2f')]['offset']);}_0x175e17[_0xece2('0x36')]=qs[_0xece2('0x37')](_0x3b5de3[_0xece2('0x2f')][_0xece2('0x37')]);_0x175e17[_0xece2('0x38')]=qs[_0xece2('0x31')](_[_0xece2('0x39')](_0x3b5de3['query'],_0xd40ab3['filters']));_0x175e17[_0xece2('0x38')]['ProjectId']=_0x4090eb['id'];if(_0x3b5de3['query'][_0xece2('0x3c')]){_0x175e17['where']=_[_0xece2('0x3a')](_0x175e17[_0xece2('0x38')],{'$or':_['map'](_0x175e17['attributes'],function(_0x4598a5){var _0x53f4e9={};_0x53f4e9[_0x4598a5]={'$like':'%'+_0x3b5de3[_0xece2('0x2f')][_0xece2('0x3c')]+'%'};return _0x53f4e9;})});}_0x175e17=_[_0xece2('0x3a')]({},_0x175e17,_0x3b5de3[_0xece2('0x3d')]);return db[_0xece2('0x5b')][_0xece2('0x1b')]({'where':_0x175e17['where']})[_0xece2('0x21')](function(_0x1f4a09){_0x205bb4[_0xece2('0x1b')]=_0x1f4a09;if(_0x3b5de3[_0xece2('0x2f')][_0xece2('0x3e')]){_0x175e17[_0xece2('0x3f')]=[{'all':!![]}];}return db[_0xece2('0x5b')][_0xece2('0x40')](_0x175e17);})[_0xece2('0x21')](function(_0x673cf7){_0x205bb4['rows']=_0x673cf7;return _0x205bb4;});}})[_0xece2('0x21')](respondWithFilteredResult(_0x3fff55,_0x175e17))['catch'](handleError(_0x3fff55,null));};function char(_0x242d84){return'number'===typeof _0x242d84?String[_0xece2('0x5c')][_0xece2('0x1e')](null,arguments):_0x242d84;}function needsEncapsulation(_0x23758f){return!!_0x23758f&&(_0x23758f[_0xece2('0x5d')]()['indexOf'](char(0xd))>=0x0||_0x23758f[_0xece2('0x5d')]()[_0xece2('0x5e')](char(0xa))>=0x0||_0x23758f[_0xece2('0x5d')]()[_0xece2('0x5e')](char(0x2c))>=0x0||_0x23758f['toString']()[_0xece2('0x5e')](char(0x22))>=0x0);}function encapsulate(_0x53845f){var _0x3e5ce7=char(0x22),_0x19c8dc='\x5c'+char(0x22),_0x19a59d=_0x53845f[_0xece2('0x5d')]()['replace'](new RegExp(_0x3e5ce7,'g'),_0x19c8dc);return _0x3e5ce7+_0x19a59d+_0x3e5ce7;}exports[_0xece2('0x5f')]=function(_0x40a769,_0x51a2b0,_0x5546b8){var _0x3b6569,_0x59f61f;var _0x5bdcdc={'where':{'ProjectId':_0x40a769[_0xece2('0x44')]['id']}};if(_0x40a769[_0xece2('0x2f')][_0xece2('0x60')]){_0x5bdcdc[_0xece2('0x38')]['starttime']=JSON[_0xece2('0x61')](_0x40a769[_0xece2('0x2f')][_0xece2('0x60')]);}return db['JscriptySessionReport'][_0xece2('0x40')](_0x5bdcdc)[_0xece2('0x21')](handleEntityNotFound(_0x51a2b0,null))['then'](function(_0x5eceee){if(_0x5eceee){_0x3b6569=_0x5eceee;return db[_0xece2('0x62')]['findAll']({'where':{'SessionId':{'$in':_[_0xece2('0x2a')](_0x3b6569,'id')},'ProjectId':_0x40a769[_0xece2('0x44')]['id']},'order':_0xece2('0x63')});}})[_0xece2('0x21')](handleEntityNotFound(_0x51a2b0,null))[_0xece2('0x21')](function(_0x5c5c4b){if(_0x5c5c4b){_0x59f61f=_0x5c5c4b;var _0x570b1c={};for(var _0x29220f=0x0,_0x3d090c=_0x59f61f[_0xece2('0x46')];_0x29220f<_0x3d090c;_0x29220f++){if(!_0x570b1c['hasOwnProperty'](_0x59f61f[_0x29220f][_0xece2('0x64')])){_0x570b1c[_0x59f61f[_0x29220f][_0xece2('0x64')]]=needsEncapsulation(_0x59f61f[_0x29220f]['question'])?encapsulate(_0x59f61f[_0x29220f][_0xece2('0x65')]):_0x59f61f[_0x29220f][_0xece2('0x65')];}}var _0x2449b0=[],_0x24b91a={};for(var _0x153d40=0x0,_0x520114=_0x3b6569[_0xece2('0x46')];_0x153d40<_0x520114;_0x153d40++){_0x24b91a={'ProjectId':_0x40a769[_0xece2('0x44')]['id'],'SessionId':_0x3b6569[_0x153d40]['id'],'StartTime':moment(_0x3b6569[_0x153d40][_0xece2('0x66')])['format'](_0xece2('0x67'))};for(var _0x4a2e14=0x0,_0x4450b1=_0x59f61f[_0xece2('0x46')];_0x4a2e14<_0x4450b1;_0x4a2e14++){if(_0x59f61f[_0x4a2e14]['SessionId']==_0x3b6569[_0x153d40]['id']&&_0x570b1c[_0xece2('0x58')](_0x59f61f[_0x4a2e14]['questionId'])){_0x24b91a[_0x570b1c[_0x59f61f[_0x4a2e14][_0xece2('0x64')]]]=_0x59f61f[_0x4a2e14][_0xece2('0x68')];}}for(var _0x5b9ad1 in _0x570b1c){if(!_0x24b91a[_0xece2('0x58')](_0x570b1c[_0x5b9ad1])){_0x24b91a[_0x570b1c[_0x5b9ad1]]=null;}}_0x2449b0[_0xece2('0x69')](_0x24b91a);}return _0x2449b0;}})['then'](function(_0x2d6e8d){if(!_[_0xece2('0x6a')](_0x2d6e8d)){var _0xc0f2e7=toCsv(_0x2d6e8d);var _0x2e7309=Date[_0xece2('0x6b')]();fs['writeFileSync'](util['format'](_0xece2('0x6c'),_0x40a769[_0xece2('0x44')]['id'],_0x2e7309),_0xc0f2e7);_0x51a2b0[_0xece2('0x6d')](_0xece2('0x6e'),_0xece2('0x6f')+util['format'](_0xece2('0x70'),_0x40a769[_0xece2('0x44')]['id'],_0x2e7309));_0x51a2b0[_0xece2('0x6d')](_0xece2('0x71'),'text/csv');return _0x51a2b0['download'](util[_0xece2('0x72')](_0xece2('0x6c'),_0x40a769['params']['id'],_0x2e7309));}else{return _0x51a2b0[_0xece2('0x15')](0xcc);}})[_0xece2('0x42')](handleError(_0x51a2b0,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 8dd3ade..07ff020 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 _0x9c5a=['define','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x5ca49a,_0x1cd1f6){var _0xc08b66=function(_0x41d215){while(--_0x41d215){_0x5ca49a['push'](_0x5ca49a['shift']());}};_0xc08b66(++_0x1cd1f6);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x3a182c,_0x295c76){_0x3a182c=_0x3a182c-0x0;var _0x4cc967=_0x9c5a[_0x3a182c];return _0x4cc967;};'use strict';var _=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var logger=require('../../config/logger')(_0xa9c5('0x2'));var moment=require(_0xa9c5('0x3'));var BPromise=require(_0xa9c5('0x4'));var rp=require(_0xa9c5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa9c5('0x6'));var config=require(_0xa9c5('0x7'));var attributes=require('./jscriptyProject.attributes');module[_0xa9c5('0x8')]=function(_0x4d9c7a,_0x394d84){return _0x4d9c7a[_0xa9c5('0x9')]('JscriptyProject',attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbdfd=['jscripty_projects','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','JscriptyProject'];(function(_0x2ddbaa,_0x4ca78f){var _0x4c730a=function(_0x24bba2){while(--_0x24bba2){_0x2ddbaa['push'](_0x2ddbaa['shift']());}};_0x4c730a(++_0x4ca78f);}(_0xbdfd,0x135));var _0xdbdf=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xbdfd[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xdbdf('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xdbdf('0x1'));var moment=require(_0xdbdf('0x2'));var BPromise=require(_0xdbdf('0x3'));var rp=require(_0xdbdf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdbdf('0x5'));var config=require(_0xdbdf('0x6'));var attributes=require('./jscriptyProject.attributes');module[_0xdbdf('0x7')]=function(_0xa743ff,_0x484034){return _0xa743ff[_0xdbdf('0x8')](_0xdbdf('0x9'),attributes,{'tableName':_0xdbdf('0xa'),'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 44f5b1e..1457eb0 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 _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptyProject,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x5e5bf2,_0x540d21){var _0x4fc118=function(_0x2565fa){while(--_0x2565fa){_0x5e5bf2['push'](_0x5e5bf2['shift']());}};_0x4fc118(++_0x540d21);}(_0xb43b,0x1b2));var _0xbb43=function(_0xc1d0c1,_0x412e54){_0xc1d0c1=_0xc1d0c1-0x0;var _0x1a6c17=_0xb43b[_0xc1d0c1];return _0x1a6c17;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file +var _0x0713=['JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x597146,_0x5c2892){var _0x554ad7=function(_0x1416e8){while(--_0x1416e8){_0x597146['push'](_0x597146['shift']());}};_0x554ad7(++_0x5c2892);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index faa4000..448558c 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 _0x08fb=['multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','/describe','post','put','/:id','delete','destroy','exports'];(function(_0x319268,_0x19626a){var _0x413da1=function(_0xb9aa37){while(--_0xb9aa37){_0x319268['push'](_0x319268['shift']());}};_0x413da1(++_0x19626a);}(_0x08fb,0x176));var _0xb08f=function(_0x3d4c28,_0x46e815){_0x3d4c28=_0x3d4c28-0x0;var _0x76b68d=_0x08fb[_0x3d4c28];return _0x76b68d;};'use strict';var multer=require(_0xb08f('0x0'));var util=require(_0xb08f('0x1'));var path=require(_0xb08f('0x2'));var timeout=require('connect-timeout');var express=require(_0xb08f('0x3'));var router=express['Router']();var fs_extra=require(_0xb08f('0x4'));var auth=require(_0xb08f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb08f('0x6'));var controller=require(_0xb08f('0x7'));router[_0xb08f('0x8')]('/',auth[_0xb08f('0x9')](),controller['index']);router[_0xb08f('0x8')](_0xb08f('0xa'),auth[_0xb08f('0x9')](),controller['describe']);router[_0xb08f('0x8')]('/:id',auth[_0xb08f('0x9')](),controller['show']);router[_0xb08f('0xb')]('/',auth[_0xb08f('0x9')](),controller['create']);router[_0xb08f('0xc')](_0xb08f('0xd'),auth[_0xb08f('0x9')](),controller['update']);router[_0xb08f('0xe')](_0xb08f('0xd'),auth[_0xb08f('0x9')](),controller[_0xb08f('0xf')]);module[_0xb08f('0x10')]=router; \ No newline at end of file +var _0x6b06=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','describe','/:id','show','create','put','delete','exports','path'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0x6b06,0x9f));var _0x66b0=function(_0x347e31,_0x49832b){_0x347e31=_0x347e31-0x0;var _0x316a7a=_0x6b06[_0x347e31];return _0x316a7a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x66b0('0x0'));var timeout=require(_0x66b0('0x1'));var express=require(_0x66b0('0x2'));var router=express[_0x66b0('0x3')]();var fs_extra=require(_0x66b0('0x4'));var auth=require(_0x66b0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x66b0('0x6'));var controller=require('./jscriptyQuestionReport.controller');router[_0x66b0('0x7')]('/',auth[_0x66b0('0x8')](),controller['index']);router[_0x66b0('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x66b0('0x9')]);router['get'](_0x66b0('0xa'),auth[_0x66b0('0x8')](),controller[_0x66b0('0xb')]);router['post']('/',auth[_0x66b0('0x8')](),controller[_0x66b0('0xc')]);router[_0x66b0('0xd')](_0x66b0('0xa'),auth[_0x66b0('0x8')](),controller['update']);router[_0x66b0('0xe')](_0x66b0('0xa'),auth[_0x66b0('0x8')](),controller['destroy']);module[_0x66b0('0xf')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index d7443bb..35f716b 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(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x7a54,0x106));var _0x47a5=function(_0x49e58f,_0x5d5ffa){_0x49e58f=_0x49e58f-0x0;var _0x316106=_0x7a54[_0x49e58f];return _0x316106;};'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(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x7a54,0x106));var _0x47a5=function(_0x467bb0,_0x1136d7){_0x467bb0=_0x467bb0-0x0;var _0x6b811c=_0x7a54[_0x467bb0];return _0x6b811c;};'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 c388ed3..c0855f5 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 _0x3ed8=['findAll','catch','show','params','intersection','options','create','body','update','find','describe','eml-format','rimraf','zip-dir','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/logger','api','../../config/utils','../../config/environment','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','sendStatus','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','type','includeAll','include'];(function(_0x530e30,_0x3a6fd8){var _0x3fbcd9=function(_0x3e7b8a){while(--_0x3e7b8a){_0x530e30['push'](_0x530e30['shift']());}};_0x3fbcd9(++_0x3a6fd8);}(_0x3ed8,0x191));var _0x83ed=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0x3ed8[_0x307d86];return _0x361745;};'use strict';var emlformat=require(_0x83ed('0x0'));var rimraf=require(_0x83ed('0x1'));var zipdir=require(_0x83ed('0x2'));var jsonpatch=require(_0x83ed('0x3'));var rp=require(_0x83ed('0x4'));var moment=require(_0x83ed('0x5'));var BPromise=require(_0x83ed('0x6'));var Mustache=require(_0x83ed('0x7'));var util=require(_0x83ed('0x8'));var path=require('path');var sox=require(_0x83ed('0x9'));var csv=require('to-csv');var ejs=require(_0x83ed('0xa'));var fs=require('fs');var fs_extra=require(_0x83ed('0xb'));var _=require(_0x83ed('0xc'));var squel=require(_0x83ed('0xd'));var crypto=require(_0x83ed('0xe'));var jsforce=require(_0x83ed('0xf'));var deskjs=require(_0x83ed('0x10'));var toCsv=require(_0x83ed('0x11'));var querystring=require('querystring');var Papa=require(_0x83ed('0x12'));var Redis=require(_0x83ed('0x13'));var authService=require(_0x83ed('0x14'));var qs=require(_0x83ed('0x15'));var as=require(_0x83ed('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x83ed('0x17'))(_0x83ed('0x18'));var utils=require(_0x83ed('0x19'));var config=require(_0x83ed('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e104a,_0x342e27){_0x342e27=_0x342e27||0xcc;return function(_0x1b12d9){if(_0x1b12d9){return _0x2e104a['sendStatus'](_0x342e27);}return _0x2e104a[_0x83ed('0x1b')](_0x342e27)[_0x83ed('0x1c')]();};}function respondWithResult(_0x281ca6,_0x2b29bd){_0x2b29bd=_0x2b29bd||0xc8;return function(_0x346c28){if(_0x346c28){return _0x281ca6[_0x83ed('0x1b')](_0x2b29bd)[_0x83ed('0x1d')](_0x346c28);}};}function respondWithFilteredResult(_0x345471,_0x512e0c){return function(_0x53f6bd){if(_0x53f6bd){var _0x5bfc0b=typeof _0x512e0c[_0x83ed('0x1e')]===_0x83ed('0x1f')&&typeof _0x512e0c[_0x83ed('0x20')]===_0x83ed('0x1f');var _0x574049=_0x53f6bd[_0x83ed('0x21')];var _0x1cb073=_0x5bfc0b?0x0:_0x512e0c[_0x83ed('0x1e')];var _0x5441af=_0x5bfc0b?_0x53f6bd[_0x83ed('0x21')]:_0x512e0c[_0x83ed('0x1e')]+_0x512e0c[_0x83ed('0x20')];var _0x11308b;if(_0x5441af>=_0x574049){_0x5441af=_0x574049;_0x11308b=0xc8;}else{_0x11308b=0xce;}_0x345471['status'](_0x11308b);return _0x345471[_0x83ed('0x22')](_0x83ed('0x23'),_0x1cb073+'-'+_0x5441af+'/'+_0x574049)[_0x83ed('0x1d')](_0x53f6bd);}return null;};}function patchUpdates(_0x23487d){return function(_0x1308de){try{jsonpatch[_0x83ed('0x24')](_0x1308de,_0x23487d,!![]);}catch(_0x498b11){return BPromise[_0x83ed('0x25')](_0x498b11);}return _0x1308de['save']();};}function saveUpdates(_0x2b2658,_0x593e03){return function(_0x3ad803){if(_0x3ad803){return _0x3ad803['update'](_0x2b2658)[_0x83ed('0x26')](function(_0x42f89e){return _0x42f89e;});}return null;};}function removeEntity(_0x50b48c,_0x56c1da){return function(_0x25b1cd){if(_0x25b1cd){return _0x25b1cd[_0x83ed('0x27')]()[_0x83ed('0x26')](function(){_0x50b48c[_0x83ed('0x1b')](0xcc)[_0x83ed('0x1c')]();});}};}function handleEntityNotFound(_0xce2d59,_0x7077a6){return function(_0x1662df){if(!_0x1662df){_0xce2d59[_0x83ed('0x28')](0x194);}return _0x1662df;};}function handleError(_0x4655e3,_0x35156d){_0x35156d=_0x35156d||0x1f4;return function(_0x58f75a){logger['error'](_0x58f75a[_0x83ed('0x29')]);if(_0x58f75a[_0x83ed('0x2a')]){delete _0x58f75a['name'];}_0x4655e3['status'](_0x35156d)[_0x83ed('0x2b')](_0x58f75a);};}exports[_0x83ed('0x2c')]=function(_0x4cbadf,_0x44d9f5){var _0x38a74a={},_0x5bd536={},_0x58be7c={'count':0x0,'rows':[]};var _0x5182ab=_[_0x83ed('0x2d')](db[_0x83ed('0x2e')][_0x83ed('0x2f')],function(_0x317bcf){return{'name':_0x317bcf[_0x83ed('0x30')],'type':_0x317bcf['type'][_0x83ed('0x31')]};});_0x5bd536[_0x83ed('0x32')]=_[_0x83ed('0x2d')](_0x5182ab,'name');_0x5bd536[_0x83ed('0x33')]=_[_0x83ed('0x34')](_0x4cbadf['query']);_0x5bd536[_0x83ed('0x35')]=_['intersection'](_0x5bd536['model'],_0x5bd536[_0x83ed('0x33')]);_0x38a74a[_0x83ed('0x36')]=_['intersection'](_0x5bd536[_0x83ed('0x32')],qs[_0x83ed('0x37')](_0x4cbadf['query'][_0x83ed('0x37')]));_0x38a74a[_0x83ed('0x36')]=_0x38a74a['attributes'][_0x83ed('0x38')]?_0x38a74a[_0x83ed('0x36')]:_0x5bd536['model'];if(!_0x4cbadf[_0x83ed('0x33')]['hasOwnProperty'](_0x83ed('0x39'))){_0x38a74a[_0x83ed('0x20')]=qs['limit'](_0x4cbadf[_0x83ed('0x33')][_0x83ed('0x20')]);_0x38a74a['offset']=qs[_0x83ed('0x1e')](_0x4cbadf['query'][_0x83ed('0x1e')]);}_0x38a74a[_0x83ed('0x3a')]=qs[_0x83ed('0x3b')](_0x4cbadf[_0x83ed('0x33')]['sort']);_0x38a74a['where']=qs['filters'](_[_0x83ed('0x3c')](_0x4cbadf[_0x83ed('0x33')],_0x5bd536['filters']),_0x5182ab);if(_0x4cbadf[_0x83ed('0x33')][_0x83ed('0x3d')]){_0x38a74a[_0x83ed('0x3e')]=_[_0x83ed('0x3f')](_0x38a74a[_0x83ed('0x3e')],{'$or':_[_0x83ed('0x2d')](_0x5182ab,function(_0x474139){if(_0x474139[_0x83ed('0x40')]!=='VIRTUAL'){var _0x54e56c={};_0x54e56c[_0x474139[_0x83ed('0x2a')]]={'$like':'%'+_0x4cbadf[_0x83ed('0x33')][_0x83ed('0x3d')]+'%'};return _0x54e56c;}})});}_0x38a74a=_['merge']({},_0x38a74a,_0x4cbadf['options']);var _0x3479c8={'where':_0x38a74a['where']};return db[_0x83ed('0x2e')]['count'](_0x3479c8)[_0x83ed('0x26')](function(_0x166b93){_0x58be7c[_0x83ed('0x21')]=_0x166b93;if(_0x4cbadf[_0x83ed('0x33')][_0x83ed('0x41')]){_0x38a74a[_0x83ed('0x42')]=[{'all':!![]}];}return db[_0x83ed('0x2e')][_0x83ed('0x43')](_0x38a74a);})[_0x83ed('0x26')](function(_0x29269f){_0x58be7c['rows']=_0x29269f;return _0x58be7c;})[_0x83ed('0x26')](respondWithFilteredResult(_0x44d9f5,_0x38a74a))[_0x83ed('0x44')](handleError(_0x44d9f5,null));};exports[_0x83ed('0x45')]=function(_0x59bb7d,_0x50a29d){var _0x3da622={'raw':!![],'where':{'id':_0x59bb7d[_0x83ed('0x46')]['id']}},_0x540908={};_0x540908[_0x83ed('0x32')]=_['keys'](db[_0x83ed('0x2e')][_0x83ed('0x2f')]);_0x540908[_0x83ed('0x33')]=_[_0x83ed('0x34')](_0x59bb7d[_0x83ed('0x33')]);_0x540908[_0x83ed('0x35')]=_['intersection'](_0x540908[_0x83ed('0x32')],_0x540908[_0x83ed('0x33')]);_0x3da622[_0x83ed('0x36')]=_[_0x83ed('0x47')](_0x540908[_0x83ed('0x32')],qs[_0x83ed('0x37')](_0x59bb7d[_0x83ed('0x33')]['fields']));_0x3da622[_0x83ed('0x36')]=_0x3da622[_0x83ed('0x36')][_0x83ed('0x38')]?_0x3da622[_0x83ed('0x36')]:_0x540908[_0x83ed('0x32')];if(_0x59bb7d[_0x83ed('0x33')][_0x83ed('0x41')]){_0x3da622['include']=[{'all':!![]}];}_0x3da622=_[_0x83ed('0x3f')]({},_0x3da622,_0x59bb7d[_0x83ed('0x48')]);return db[_0x83ed('0x2e')]['find'](_0x3da622)[_0x83ed('0x26')](handleEntityNotFound(_0x50a29d,null))[_0x83ed('0x26')](respondWithResult(_0x50a29d,null))[_0x83ed('0x44')](handleError(_0x50a29d,null));};exports[_0x83ed('0x49')]=function(_0x566ce0,_0x19c3a8){return db[_0x83ed('0x2e')][_0x83ed('0x49')](_0x566ce0[_0x83ed('0x4a')],{})[_0x83ed('0x26')](respondWithResult(_0x19c3a8,0xc9))[_0x83ed('0x44')](handleError(_0x19c3a8,null));};exports[_0x83ed('0x4b')]=function(_0x204062,_0x5a0d49){if(_0x204062[_0x83ed('0x4a')]['id']){delete _0x204062[_0x83ed('0x4a')]['id'];}return db[_0x83ed('0x2e')][_0x83ed('0x4c')]({'where':{'id':_0x204062['params']['id']}})[_0x83ed('0x26')](handleEntityNotFound(_0x5a0d49,null))['then'](saveUpdates(_0x204062[_0x83ed('0x4a')],null))['then'](respondWithResult(_0x5a0d49,null))[_0x83ed('0x44')](handleError(_0x5a0d49,null));};exports[_0x83ed('0x27')]=function(_0x3ae805,_0x280ef6){return db['JscriptyQuestionReport'][_0x83ed('0x4c')]({'where':{'id':_0x3ae805[_0x83ed('0x46')]['id']}})[_0x83ed('0x26')](handleEntityNotFound(_0x280ef6,null))[_0x83ed('0x26')](removeEntity(_0x280ef6,null))['catch'](handleError(_0x280ef6,null));};exports[_0x83ed('0x4d')]=function(_0x5310d3,_0x123a48){return db[_0x83ed('0x2e')][_0x83ed('0x4d')]()[_0x83ed('0x26')](respondWithResult(_0x123a48,null))['catch'](handleError(_0x123a48,null));}; \ No newline at end of file +var _0x5551=['type','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','pick','filter','merge','where','VIRTUAL','options','includeAll','JscriptyQuestionReport','findAll','rows','show','params','rawAttributes','length','include','find','catch','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x5551,0xb2));var _0x1555=function(_0x2fd3b8,_0x18a6c7){_0x2fd3b8=_0x2fd3b8-0x0;var _0xc4a833=_0x5551[_0x2fd3b8];return _0xc4a833;};'use strict';var emlformat=require(_0x1555('0x0'));var rimraf=require(_0x1555('0x1'));var zipdir=require(_0x1555('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1555('0x3'));var moment=require('moment');var BPromise=require(_0x1555('0x4'));var Mustache=require(_0x1555('0x5'));var util=require(_0x1555('0x6'));var path=require(_0x1555('0x7'));var sox=require(_0x1555('0x8'));var csv=require('to-csv');var ejs=require(_0x1555('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1555('0xa'));var squel=require(_0x1555('0xb'));var crypto=require('crypto');var jsforce=require(_0x1555('0xc'));var deskjs=require(_0x1555('0xd'));var toCsv=require(_0x1555('0xe'));var querystring=require(_0x1555('0xf'));var Papa=require('papaparse');var Redis=require(_0x1555('0x10'));var authService=require(_0x1555('0x11'));var qs=require(_0x1555('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1555('0x13'));var logger=require(_0x1555('0x14'))(_0x1555('0x15'));var utils=require(_0x1555('0x16'));var config=require(_0x1555('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x1555('0x18'))['db'];function respondWithStatusCode(_0x50422,_0x4e3065){_0x4e3065=_0x4e3065||0xcc;return function(_0x395970){if(_0x395970){return _0x50422['sendStatus'](_0x4e3065);}return _0x50422[_0x1555('0x19')](_0x4e3065)['end']();};}function respondWithResult(_0x439687,_0x37b20d){_0x37b20d=_0x37b20d||0xc8;return function(_0x1404b5){if(_0x1404b5){return _0x439687[_0x1555('0x19')](_0x37b20d)[_0x1555('0x1a')](_0x1404b5);}};}function respondWithFilteredResult(_0xaea3b8,_0xd20610){return function(_0x165670){if(_0x165670){var _0x3f14b0=typeof _0xd20610['offset']===_0x1555('0x1b')&&typeof _0xd20610['limit']===_0x1555('0x1b');var _0x21e054=_0x165670[_0x1555('0x1c')];var _0x2da30f=_0x3f14b0?0x0:_0xd20610['offset'];var _0x3225c4=_0x3f14b0?_0x165670[_0x1555('0x1c')]:_0xd20610[_0x1555('0x1d')]+_0xd20610[_0x1555('0x1e')];var _0xd6dc0d;if(_0x3225c4>=_0x21e054){_0x3225c4=_0x21e054;_0xd6dc0d=0xc8;}else{_0xd6dc0d=0xce;}_0xaea3b8[_0x1555('0x19')](_0xd6dc0d);return _0xaea3b8[_0x1555('0x1f')](_0x1555('0x20'),_0x2da30f+'-'+_0x3225c4+'/'+_0x21e054)[_0x1555('0x1a')](_0x165670);}return null;};}function patchUpdates(_0x383c50){return function(_0x3ab562){try{jsonpatch[_0x1555('0x21')](_0x3ab562,_0x383c50,!![]);}catch(_0x244361){return BPromise[_0x1555('0x22')](_0x244361);}return _0x3ab562['save']();};}function saveUpdates(_0x5efd18,_0x41c17a){return function(_0x2ce099){if(_0x2ce099){return _0x2ce099[_0x1555('0x23')](_0x5efd18)[_0x1555('0x24')](function(_0x211013){return _0x211013;});}return null;};}function removeEntity(_0x49970a,_0x2bc306){return function(_0x118547){if(_0x118547){return _0x118547[_0x1555('0x25')]()['then'](function(){_0x49970a[_0x1555('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa8e3f1,_0x2600ca){return function(_0x473423){if(!_0x473423){_0xa8e3f1[_0x1555('0x26')](0x194);}return _0x473423;};}function handleError(_0x5a0593,_0x216349){_0x216349=_0x216349||0x1f4;return function(_0x3ae053){logger[_0x1555('0x27')](_0x3ae053[_0x1555('0x28')]);if(_0x3ae053[_0x1555('0x29')]){delete _0x3ae053[_0x1555('0x29')];}_0x5a0593[_0x1555('0x19')](_0x216349)[_0x1555('0x2a')](_0x3ae053);};}exports[_0x1555('0x2b')]=function(_0x509cbe,_0x334af2){var _0x278c62={},_0x55089b={},_0x4b78da={'count':0x0,'rows':[]};var _0x167098=_['map'](db['JscriptyQuestionReport']['rawAttributes'],function(_0x50545){return{'name':_0x50545['fieldName'],'type':_0x50545[_0x1555('0x2c')]['key']};});_0x55089b['model']=_[_0x1555('0x2d')](_0x167098,'name');_0x55089b[_0x1555('0x2e')]=_[_0x1555('0x2f')](_0x509cbe['query']);_0x55089b[_0x1555('0x30')]=_[_0x1555('0x31')](_0x55089b[_0x1555('0x32')],_0x55089b[_0x1555('0x2e')]);_0x278c62[_0x1555('0x33')]=_[_0x1555('0x31')](_0x55089b[_0x1555('0x32')],qs[_0x1555('0x34')](_0x509cbe['query'][_0x1555('0x34')]));_0x278c62[_0x1555('0x33')]=_0x278c62[_0x1555('0x33')]['length']?_0x278c62[_0x1555('0x33')]:_0x55089b[_0x1555('0x32')];if(!_0x509cbe[_0x1555('0x2e')][_0x1555('0x35')]('nolimit')){_0x278c62[_0x1555('0x1e')]=qs['limit'](_0x509cbe[_0x1555('0x2e')][_0x1555('0x1e')]);_0x278c62[_0x1555('0x1d')]=qs[_0x1555('0x1d')](_0x509cbe[_0x1555('0x2e')][_0x1555('0x1d')]);}_0x278c62['order']=qs['sort'](_0x509cbe['query']['sort']);_0x278c62['where']=qs[_0x1555('0x30')](_[_0x1555('0x36')](_0x509cbe[_0x1555('0x2e')],_0x55089b[_0x1555('0x30')]),_0x167098);if(_0x509cbe[_0x1555('0x2e')][_0x1555('0x37')]){_0x278c62['where']=_[_0x1555('0x38')](_0x278c62[_0x1555('0x39')],{'$or':_[_0x1555('0x2d')](_0x167098,function(_0x460f2d){if(_0x460f2d[_0x1555('0x2c')]!==_0x1555('0x3a')){var _0x1b1256={};_0x1b1256[_0x460f2d[_0x1555('0x29')]]={'$like':'%'+_0x509cbe[_0x1555('0x2e')][_0x1555('0x37')]+'%'};return _0x1b1256;}})});}_0x278c62=_[_0x1555('0x38')]({},_0x278c62,_0x509cbe[_0x1555('0x3b')]);var _0x2ddbf0={'where':_0x278c62[_0x1555('0x39')]};return db['JscriptyQuestionReport'][_0x1555('0x1c')](_0x2ddbf0)['then'](function(_0x5d3464){_0x4b78da[_0x1555('0x1c')]=_0x5d3464;if(_0x509cbe[_0x1555('0x2e')][_0x1555('0x3c')]){_0x278c62['include']=[{'all':!![]}];}return db[_0x1555('0x3d')][_0x1555('0x3e')](_0x278c62);})[_0x1555('0x24')](function(_0x236d12){_0x4b78da[_0x1555('0x3f')]=_0x236d12;return _0x4b78da;})[_0x1555('0x24')](respondWithFilteredResult(_0x334af2,_0x278c62))['catch'](handleError(_0x334af2,null));};exports[_0x1555('0x40')]=function(_0xfb57d5,_0x381857){var _0x2816a0={'raw':!![],'where':{'id':_0xfb57d5[_0x1555('0x41')]['id']}},_0x59d426={};_0x59d426[_0x1555('0x32')]=_[_0x1555('0x2f')](db[_0x1555('0x3d')][_0x1555('0x42')]);_0x59d426['query']=_[_0x1555('0x2f')](_0xfb57d5['query']);_0x59d426[_0x1555('0x30')]=_['intersection'](_0x59d426[_0x1555('0x32')],_0x59d426[_0x1555('0x2e')]);_0x2816a0[_0x1555('0x33')]=_[_0x1555('0x31')](_0x59d426['model'],qs[_0x1555('0x34')](_0xfb57d5[_0x1555('0x2e')]['fields']));_0x2816a0['attributes']=_0x2816a0['attributes'][_0x1555('0x43')]?_0x2816a0['attributes']:_0x59d426[_0x1555('0x32')];if(_0xfb57d5[_0x1555('0x2e')][_0x1555('0x3c')]){_0x2816a0[_0x1555('0x44')]=[{'all':!![]}];}_0x2816a0=_[_0x1555('0x38')]({},_0x2816a0,_0xfb57d5['options']);return db[_0x1555('0x3d')][_0x1555('0x45')](_0x2816a0)[_0x1555('0x24')](handleEntityNotFound(_0x381857,null))[_0x1555('0x24')](respondWithResult(_0x381857,null))[_0x1555('0x46')](handleError(_0x381857,null));};exports[_0x1555('0x47')]=function(_0x229233,_0x52af32){return db[_0x1555('0x3d')]['create'](_0x229233[_0x1555('0x48')],{})[_0x1555('0x24')](respondWithResult(_0x52af32,0xc9))[_0x1555('0x46')](handleError(_0x52af32,null));};exports[_0x1555('0x23')]=function(_0x55b753,_0x1a5126){if(_0x55b753[_0x1555('0x48')]['id']){delete _0x55b753[_0x1555('0x48')]['id'];}return db[_0x1555('0x3d')][_0x1555('0x45')]({'where':{'id':_0x55b753[_0x1555('0x41')]['id']}})['then'](handleEntityNotFound(_0x1a5126,null))[_0x1555('0x24')](saveUpdates(_0x55b753[_0x1555('0x48')],null))['then'](respondWithResult(_0x1a5126,null))[_0x1555('0x46')](handleError(_0x1a5126,null));};exports[_0x1555('0x25')]=function(_0x4cc44b,_0x5700b4){return db['JscriptyQuestionReport'][_0x1555('0x45')]({'where':{'id':_0x4cc44b['params']['id']}})[_0x1555('0x24')](handleEntityNotFound(_0x5700b4,null))[_0x1555('0x24')](removeEntity(_0x5700b4,null))[_0x1555('0x46')](handleError(_0x5700b4,null));};exports[_0x1555('0x49')]=function(_0x34a2ce,_0x3c50e0){return db[_0x1555('0x3d')][_0x1555('0x49')]()[_0x1555('0x24')](respondWithResult(_0x3c50e0,null))[_0x1555('0x46')](handleError(_0x3c50e0,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 1bebaca..d7b52be 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 _0xc034=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport'];(function(_0x1ae9e4,_0x38d3dd){var _0x5521f5=function(_0x2b98d7){while(--_0x2b98d7){_0x1ae9e4['push'](_0x1ae9e4['shift']());}};_0x5521f5(++_0x38d3dd);}(_0xc034,0x1b0));var _0x4c03=function(_0x5a7d81,_0x5c14c5){_0x5a7d81=_0x5a7d81-0x0;var _0x3dca70=_0xc034[_0x5a7d81];return _0x3dca70;};'use strict';var _=require('lodash');var util=require(_0x4c03('0x0'));var logger=require(_0x4c03('0x1'))(_0x4c03('0x2'));var moment=require(_0x4c03('0x3'));var BPromise=require(_0x4c03('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4c03('0x5'));var rimraf=require(_0x4c03('0x6'));var config=require(_0x4c03('0x7'));var attributes=require(_0x4c03('0x8'));module[_0x4c03('0x9')]=function(_0x3dab83,_0x55301f){return _0x3dab83[_0x4c03('0xa')](_0x4c03('0xb'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b09=['request-promise','path','rimraf','../../config/environment','exports','define','report_jscripty_questions','lodash','../../config/logger','api','moment','bluebird'];(function(_0x5aac90,_0x4adf0f){var _0x181674=function(_0x2867fc){while(--_0x2867fc){_0x5aac90['push'](_0x5aac90['shift']());}};_0x181674(++_0x4adf0f);}(_0x5b09,0xeb));var _0x95b0=function(_0x3e237b,_0x13fd58){_0x3e237b=_0x3e237b-0x0;var _0x202bbb=_0x5b09[_0x3e237b];return _0x202bbb;};'use strict';var _=require(_0x95b0('0x0'));var util=require('util');var logger=require(_0x95b0('0x1'))(_0x95b0('0x2'));var moment=require(_0x95b0('0x3'));var BPromise=require(_0x95b0('0x4'));var rp=require(_0x95b0('0x5'));var fs=require('fs');var path=require(_0x95b0('0x6'));var rimraf=require(_0x95b0('0x7'));var config=require(_0x95b0('0x8'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0x95b0('0x9')]=function(_0x957aec,_0x37d1cb){return _0x957aec[_0x95b0('0xa')]('JscriptyQuestionReport',attributes,{'tableName':_0x95b0('0xb'),'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 bd46729..1184c31 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 _0xbde6=['then','JscriptyQuestionReport,\x20%s,\x20%s','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request'];(function(_0x19ee23,_0x341ac){var _0x1b9578=function(_0x40365f){while(--_0x40365f){_0x19ee23['push'](_0x19ee23['shift']());}};_0x1b9578(++_0x341ac);}(_0xbde6,0x107));var _0x6bde=function(_0x14fa12,_0x47582e){_0x14fa12=_0x14fa12-0x0;var _0x3cbdb0=_0xbde6[_0x14fa12];return _0x3cbdb0;};'use strict';var _=require(_0x6bde('0x0'));var util=require(_0x6bde('0x1'));var moment=require(_0x6bde('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6bde('0x3'));var db=require(_0x6bde('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6bde('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6bde('0x6'));var client=jayson[_0x6bde('0x7')][_0x6bde('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x386f5c,_0x5de823,_0x4feede){return new BPromise(function(_0x3c5ec7,_0x1ed396){return client[_0x6bde('0x9')](_0x386f5c,_0x4feede)[_0x6bde('0xa')](function(_0x12c126){logger['info'](_0x6bde('0xb'),_0x5de823,'request\x20sent');logger['debug'](_0x6bde('0xc'),_0x5de823,_0x6bde('0xd'),JSON[_0x6bde('0xe')](_0x12c126));if(_0x12c126[_0x6bde('0xf')]){if(_0x12c126[_0x6bde('0xf')][_0x6bde('0x10')]===0x1f4){logger[_0x6bde('0xf')](_0x6bde('0xb'),_0x5de823,_0x12c126[_0x6bde('0xf')]['message']);return _0x1ed396(_0x12c126['error']['message']);}logger[_0x6bde('0xf')](_0x6bde('0xb'),_0x5de823,_0x12c126[_0x6bde('0xf')]['message']);return _0x3c5ec7(_0x12c126[_0x6bde('0xf')][_0x6bde('0x11')]);}else{logger[_0x6bde('0x12')](_0x6bde('0xb'),_0x5de823,'request\x20sent');_0x3c5ec7(_0x12c126[_0x6bde('0x13')]['message']);}})[_0x6bde('0x14')](function(_0x4cf4d3){logger[_0x6bde('0xf')](_0x6bde('0xb'),_0x5de823,_0x4cf4d3);_0x1ed396(_0x4cf4d3);});});} \ No newline at end of file +var _0xe8a4=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','JscriptyQuestionReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0xe8a4,0x90));var _0x4e8a=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xe8a4[_0x3635ce];return _0x97ecd0;};'use strict';var _=require(_0x4e8a('0x0'));var util=require(_0x4e8a('0x1'));var moment=require(_0x4e8a('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(_0x4e8a('0x3'));var logger=require(_0x4e8a('0x4'))(_0x4e8a('0x5'));var config=require(_0x4e8a('0x6'));var jayson=require(_0x4e8a('0x7'));var client=jayson[_0x4e8a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20d506,_0x3cbdae,_0x4b24a9){return new BPromise(function(_0x5aa3e9,_0x22ab71){return client[_0x4e8a('0x9')](_0x20d506,_0x4b24a9)[_0x4e8a('0xa')](function(_0x37c58b){logger['info'](_0x4e8a('0xb'),_0x3cbdae,'request\x20sent');logger[_0x4e8a('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x3cbdae,_0x4e8a('0xd'),JSON[_0x4e8a('0xe')](_0x37c58b));if(_0x37c58b[_0x4e8a('0xf')]){if(_0x37c58b[_0x4e8a('0xf')][_0x4e8a('0x10')]===0x1f4){logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x3cbdae,_0x37c58b['error'][_0x4e8a('0x11')]);return _0x22ab71(_0x37c58b[_0x4e8a('0xf')]['message']);}logger['error'](_0x4e8a('0xb'),_0x3cbdae,_0x37c58b[_0x4e8a('0xf')][_0x4e8a('0x11')]);return _0x5aa3e9(_0x37c58b['error'][_0x4e8a('0x11')]);}else{logger[_0x4e8a('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x3cbdae,_0x4e8a('0xd'));_0x5aa3e9(_0x37c58b[_0x4e8a('0x13')][_0x4e8a('0x11')]);}})[_0x4e8a('0x14')](function(_0x48e7f5){logger['error'](_0x4e8a('0xb'),_0x3cbdae,_0x48e7f5);_0x22ab71(_0x48e7f5);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index f7d326f..b52443a 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 _0x482d=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','getQuestions','destroy','multer','util','path'];(function(_0x38de33,_0x4361bb){var _0x40f16d=function(_0x25975c){while(--_0x25975c){_0x38de33['push'](_0x38de33['shift']());}};_0x40f16d(++_0x4361bb);}(_0x482d,0x140));var _0xd482=function(_0x49d3db,_0x3aaf58){_0x49d3db=_0x49d3db-0x0;var _0xa57f2c=_0x482d[_0x49d3db];return _0xa57f2c;};'use strict';var multer=require(_0xd482('0x0'));var util=require(_0xd482('0x1'));var path=require(_0xd482('0x2'));var timeout=require(_0xd482('0x3'));var express=require(_0xd482('0x4'));var router=express[_0xd482('0x5')]();var fs_extra=require(_0xd482('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd482('0x7'));var config=require('../../config/environment');var controller=require('./jscriptySessionReport.controller');router[_0xd482('0x8')]('/',auth[_0xd482('0x9')](),controller[_0xd482('0xa')]);router[_0xd482('0x8')](_0xd482('0xb'),auth[_0xd482('0x9')](),controller[_0xd482('0xc')]);router[_0xd482('0x8')](_0xd482('0xd'),auth[_0xd482('0x9')](),controller[_0xd482('0xe')]);router[_0xd482('0x8')]('/:id/questions',auth[_0xd482('0x9')](),controller[_0xd482('0xf')]);router['post']('/',auth[_0xd482('0x9')](),controller['create']);router['put']('/:id',auth[_0xd482('0x9')](),controller['update']);router['delete'](_0xd482('0xd'),auth[_0xd482('0x9')](),controller[_0xd482('0x10')]);module['exports']=router; \ No newline at end of file +var _0x2ea8=['../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','describe','/:id','/:id/questions','getQuestions','post','create','put','destroy','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x2ea8,0x1f1));var _0x82ea=function(_0x3ce53b,_0x30bbcc){_0x3ce53b=_0x3ce53b-0x0;var _0x7fa584=_0x2ea8[_0x3ce53b];return _0x7fa584;};'use strict';var multer=require(_0x82ea('0x0'));var util=require(_0x82ea('0x1'));var path=require(_0x82ea('0x2'));var timeout=require(_0x82ea('0x3'));var express=require(_0x82ea('0x4'));var router=express[_0x82ea('0x5')]();var fs_extra=require(_0x82ea('0x6'));var auth=require(_0x82ea('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x82ea('0x8'));var controller=require(_0x82ea('0x9'));router[_0x82ea('0xa')]('/',auth[_0x82ea('0xb')](),controller[_0x82ea('0xc')]);router[_0x82ea('0xa')]('/describe',auth[_0x82ea('0xb')](),controller[_0x82ea('0xd')]);router['get'](_0x82ea('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x82ea('0xa')](_0x82ea('0xf'),auth[_0x82ea('0xb')](),controller[_0x82ea('0x10')]);router[_0x82ea('0x11')]('/',auth['isAuthenticated'](),controller[_0x82ea('0x12')]);router[_0x82ea('0x13')](_0x82ea('0xe'),auth[_0x82ea('0xb')](),controller['update']);router['delete'](_0x82ea('0xe'),auth[_0x82ea('0xb')](),controller[_0x82ea('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 309c88c..5ae3feb 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 _0xc65a=['YYYY-MM-DD\x20HH:mm:ss','STRING','moment','sequelize','DATE','setDataValue','endtime','format'];(function(_0x546c68,_0x5c0116){var _0x4a2389=function(_0x5aa205){while(--_0x5aa205){_0x546c68['push'](_0x546c68['shift']());}};_0x4a2389(++_0x5c0116);}(_0xc65a,0x1ca));var _0xac65=function(_0x561b3b,_0x171372){_0x561b3b=_0x561b3b-0x0;var _0x5752f4=_0xc65a[_0x561b3b];return _0x5752f4;};'use strict';var moment=require(_0xac65('0x0'));var Sequelize=require(_0xac65('0x1'));module['exports']={'starttime':{'type':Sequelize[_0xac65('0x2')],'set':function(_0x53048e){this[_0xac65('0x3')]('starttime',_0x53048e);this['setDataValue'](_0xac65('0x4'),moment()[_0xac65('0x5')](_0xac65('0x6')));}},'endtime':{'type':Sequelize[_0xac65('0x2')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xac65('0x7')]},'uniqueid':{'type':Sequelize[_0xac65('0x7')]},'calleridname':{'type':Sequelize[_0xac65('0x7')]},'calleridnum':{'type':Sequelize[_0xac65('0x7')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x81a5=['setDataValue','format','STRING','BOOLEAN','sequelize','exports','DATE','starttime'];(function(_0x5e8e27,_0x537a87){var _0x1558be=function(_0x31200a){while(--_0x31200a){_0x5e8e27['push'](_0x5e8e27['shift']());}};_0x1558be(++_0x537a87);}(_0x81a5,0x17c));var _0x581a=function(_0xf15f28,_0x6762fd){_0xf15f28=_0xf15f28-0x0;var _0x4351c9=_0x81a5[_0xf15f28];return _0x4351c9;};'use strict';var moment=require('moment');var Sequelize=require(_0x581a('0x0'));module[_0x581a('0x1')]={'starttime':{'type':Sequelize[_0x581a('0x2')],'set':function(_0x1a3cf7){this['setDataValue'](_0x581a('0x3'),_0x1a3cf7);this[_0x581a('0x4')]('endtime',moment()[_0x581a('0x5')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x581a('0x2')]},'membername':{'type':Sequelize[_0x581a('0x6')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x581a('0x6')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x581a('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index e09b4b0..014a8fe 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 _0x6ee8=['util','path','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','JscriptySessionReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','rawAttributes','find','create','body','params','describe','nolimit','SessionId','JscriptyQuestionReport','eml-format','zip-dir','request-promise','bluebird','mustache'];(function(_0x3ccdb2,_0x593f2f){var _0x1369f8=function(_0x5627e9){while(--_0x5627e9){_0x3ccdb2['push'](_0x3ccdb2['shift']());}};_0x1369f8(++_0x593f2f);}(_0x6ee8,0x1cf));var _0x86ee=function(_0x50fd3c,_0x1e44ff){_0x50fd3c=_0x50fd3c-0x0;var _0x57fe9e=_0x6ee8[_0x50fd3c];return _0x57fe9e;};'use strict';var emlformat=require(_0x86ee('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x86ee('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x86ee('0x2'));var moment=require('moment');var BPromise=require(_0x86ee('0x3'));var Mustache=require(_0x86ee('0x4'));var util=require(_0x86ee('0x5'));var path=require(_0x86ee('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x86ee('0x7'));var fs=require('fs');var fs_extra=require(_0x86ee('0x8'));var _=require(_0x86ee('0x9'));var squel=require(_0x86ee('0xa'));var crypto=require('crypto');var jsforce=require(_0x86ee('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x86ee('0xc'));var querystring=require(_0x86ee('0xd'));var Papa=require(_0x86ee('0xe'));var Redis=require(_0x86ee('0xf'));var authService=require(_0x86ee('0x10'));var qs=require(_0x86ee('0x11'));var as=require(_0x86ee('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x86ee('0x13'))('api');var utils=require(_0x86ee('0x14'));var config=require(_0x86ee('0x15'));var licenseUtil=require(_0x86ee('0x16'));var db=require(_0x86ee('0x17'))['db'];function respondWithStatusCode(_0x189fc0,_0x361a0f){_0x361a0f=_0x361a0f||0xcc;return function(_0x434042){if(_0x434042){return _0x189fc0[_0x86ee('0x18')](_0x361a0f);}return _0x189fc0[_0x86ee('0x19')](_0x361a0f)[_0x86ee('0x1a')]();};}function respondWithResult(_0x3ffbd3,_0x149125){_0x149125=_0x149125||0xc8;return function(_0x37d6ac){if(_0x37d6ac){return _0x3ffbd3[_0x86ee('0x19')](_0x149125)[_0x86ee('0x1b')](_0x37d6ac);}};}function respondWithFilteredResult(_0x2882eb,_0x529e89){return function(_0x2cffb8){if(_0x2cffb8){var _0x4e792b=typeof _0x529e89[_0x86ee('0x1c')]==='undefined'&&typeof _0x529e89[_0x86ee('0x1d')]==='undefined';var _0x1a7f5b=_0x2cffb8[_0x86ee('0x1e')];var _0x38c477=_0x4e792b?0x0:_0x529e89[_0x86ee('0x1c')];var _0x23e4cc=_0x4e792b?_0x2cffb8['count']:_0x529e89[_0x86ee('0x1c')]+_0x529e89[_0x86ee('0x1d')];var _0x54dcd3;if(_0x23e4cc>=_0x1a7f5b){_0x23e4cc=_0x1a7f5b;_0x54dcd3=0xc8;}else{_0x54dcd3=0xce;}_0x2882eb[_0x86ee('0x19')](_0x54dcd3);return _0x2882eb[_0x86ee('0x1f')](_0x86ee('0x20'),_0x38c477+'-'+_0x23e4cc+'/'+_0x1a7f5b)['json'](_0x2cffb8);}return null;};}function patchUpdates(_0x199de0){return function(_0x46cf1e){try{jsonpatch['apply'](_0x46cf1e,_0x199de0,!![]);}catch(_0x6bbad){return BPromise[_0x86ee('0x21')](_0x6bbad);}return _0x46cf1e[_0x86ee('0x22')]();};}function saveUpdates(_0x21adb3,_0x526295){return function(_0x208bc0){if(_0x208bc0){return _0x208bc0[_0x86ee('0x23')](_0x21adb3)[_0x86ee('0x24')](function(_0x1094f3){return _0x1094f3;});}return null;};}function removeEntity(_0x18bc04,_0xc009bb){return function(_0x13cf3e){if(_0x13cf3e){return _0x13cf3e[_0x86ee('0x25')]()[_0x86ee('0x24')](function(){_0x18bc04[_0x86ee('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cc0df,_0xccc9c9){return function(_0x11fa93){if(!_0x11fa93){_0x3cc0df[_0x86ee('0x18')](0x194);}return _0x11fa93;};}function handleError(_0x2adadb,_0x279abf){_0x279abf=_0x279abf||0x1f4;return function(_0x3d352e){logger['error'](_0x3d352e[_0x86ee('0x26')]);if(_0x3d352e[_0x86ee('0x27')]){delete _0x3d352e[_0x86ee('0x27')];}_0x2adadb['status'](_0x279abf)[_0x86ee('0x28')](_0x3d352e);};}exports[_0x86ee('0x29')]=function(_0x3078fe,_0x30cdbe){var _0x4d0183={},_0x2f2e26={},_0x2fdefa={'count':0x0,'rows':[]};var _0x5925c8=_[_0x86ee('0x2a')](db[_0x86ee('0x2b')]['rawAttributes'],function(_0x2b55dd){return{'name':_0x2b55dd[_0x86ee('0x2c')],'type':_0x2b55dd[_0x86ee('0x2d')][_0x86ee('0x2e')]};});_0x2f2e26[_0x86ee('0x2f')]=_[_0x86ee('0x2a')](_0x5925c8,'name');_0x2f2e26[_0x86ee('0x30')]=_[_0x86ee('0x31')](_0x3078fe[_0x86ee('0x30')]);_0x2f2e26['filters']=_[_0x86ee('0x32')](_0x2f2e26[_0x86ee('0x2f')],_0x2f2e26[_0x86ee('0x30')]);_0x4d0183[_0x86ee('0x33')]=_[_0x86ee('0x32')](_0x2f2e26[_0x86ee('0x2f')],qs[_0x86ee('0x34')](_0x3078fe[_0x86ee('0x30')][_0x86ee('0x34')]));_0x4d0183[_0x86ee('0x33')]=_0x4d0183[_0x86ee('0x33')][_0x86ee('0x35')]?_0x4d0183[_0x86ee('0x33')]:_0x2f2e26[_0x86ee('0x2f')];if(!_0x3078fe[_0x86ee('0x30')][_0x86ee('0x36')]('nolimit')){_0x4d0183[_0x86ee('0x1d')]=qs[_0x86ee('0x1d')](_0x3078fe[_0x86ee('0x30')][_0x86ee('0x1d')]);_0x4d0183[_0x86ee('0x1c')]=qs[_0x86ee('0x1c')](_0x3078fe[_0x86ee('0x30')][_0x86ee('0x1c')]);}_0x4d0183[_0x86ee('0x37')]=qs[_0x86ee('0x38')](_0x3078fe[_0x86ee('0x30')][_0x86ee('0x38')]);_0x4d0183[_0x86ee('0x39')]=qs[_0x86ee('0x3a')](_[_0x86ee('0x3b')](_0x3078fe[_0x86ee('0x30')],_0x2f2e26[_0x86ee('0x3a')]),_0x5925c8);if(_0x3078fe[_0x86ee('0x30')]['filter']){_0x4d0183['where']=_[_0x86ee('0x3c')](_0x4d0183[_0x86ee('0x39')],{'$or':_[_0x86ee('0x2a')](_0x5925c8,function(_0x1ff64a){if(_0x1ff64a[_0x86ee('0x2d')]!==_0x86ee('0x3d')){var _0x4c3b3d={};_0x4c3b3d[_0x1ff64a[_0x86ee('0x27')]]={'$like':'%'+_0x3078fe[_0x86ee('0x30')][_0x86ee('0x3e')]+'%'};return _0x4c3b3d;}})});}_0x4d0183=_[_0x86ee('0x3c')]({},_0x4d0183,_0x3078fe[_0x86ee('0x3f')]);var _0x3da6e0={'where':_0x4d0183[_0x86ee('0x39')]};return db['JscriptySessionReport'][_0x86ee('0x1e')](_0x3da6e0)[_0x86ee('0x24')](function(_0x32365c){_0x2fdefa[_0x86ee('0x1e')]=_0x32365c;if(_0x3078fe['query'][_0x86ee('0x40')]){_0x4d0183[_0x86ee('0x41')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x86ee('0x42')](_0x4d0183);})['then'](function(_0x23a8fd){_0x2fdefa['rows']=_0x23a8fd;return _0x2fdefa;})['then'](respondWithFilteredResult(_0x30cdbe,_0x4d0183))[_0x86ee('0x43')](handleError(_0x30cdbe,null));};exports[_0x86ee('0x44')]=function(_0x1a9ae1,_0x5d7da9){var _0x2b9949={'raw':!![],'where':{'id':_0x1a9ae1['params']['id']}},_0x28486f={};_0x28486f['model']=_[_0x86ee('0x31')](db[_0x86ee('0x2b')][_0x86ee('0x45')]);_0x28486f['query']=_[_0x86ee('0x31')](_0x1a9ae1[_0x86ee('0x30')]);_0x28486f['filters']=_['intersection'](_0x28486f[_0x86ee('0x2f')],_0x28486f[_0x86ee('0x30')]);_0x2b9949[_0x86ee('0x33')]=_['intersection'](_0x28486f[_0x86ee('0x2f')],qs[_0x86ee('0x34')](_0x1a9ae1[_0x86ee('0x30')][_0x86ee('0x34')]));_0x2b9949[_0x86ee('0x33')]=_0x2b9949[_0x86ee('0x33')]['length']?_0x2b9949['attributes']:_0x28486f['model'];if(_0x1a9ae1['query'][_0x86ee('0x40')]){_0x2b9949[_0x86ee('0x41')]=[{'all':!![]}];}_0x2b9949=_['merge']({},_0x2b9949,_0x1a9ae1[_0x86ee('0x3f')]);return db[_0x86ee('0x2b')][_0x86ee('0x46')](_0x2b9949)[_0x86ee('0x24')](handleEntityNotFound(_0x5d7da9,null))[_0x86ee('0x24')](respondWithResult(_0x5d7da9,null))[_0x86ee('0x43')](handleError(_0x5d7da9,null));};exports[_0x86ee('0x47')]=function(_0x8d1f66,_0x6de673){return db[_0x86ee('0x2b')][_0x86ee('0x47')](_0x8d1f66[_0x86ee('0x48')],{})[_0x86ee('0x24')](respondWithResult(_0x6de673,0xc9))[_0x86ee('0x43')](handleError(_0x6de673,null));};exports[_0x86ee('0x23')]=function(_0x93d470,_0x198b5c){if(_0x93d470[_0x86ee('0x48')]['id']){delete _0x93d470[_0x86ee('0x48')]['id'];}return db[_0x86ee('0x2b')][_0x86ee('0x46')]({'where':{'id':_0x93d470[_0x86ee('0x49')]['id']}})[_0x86ee('0x24')](handleEntityNotFound(_0x198b5c,null))[_0x86ee('0x24')](saveUpdates(_0x93d470[_0x86ee('0x48')],null))['then'](respondWithResult(_0x198b5c,null))[_0x86ee('0x43')](handleError(_0x198b5c,null));};exports[_0x86ee('0x25')]=function(_0xbdd811,_0x46e43f){return db[_0x86ee('0x2b')][_0x86ee('0x46')]({'where':{'id':_0xbdd811[_0x86ee('0x49')]['id']}})[_0x86ee('0x24')](handleEntityNotFound(_0x46e43f,null))[_0x86ee('0x24')](removeEntity(_0x46e43f,null))[_0x86ee('0x43')](handleError(_0x46e43f,null));};exports[_0x86ee('0x4a')]=function(_0x32f096,_0x4e954b){return db[_0x86ee('0x2b')][_0x86ee('0x4a')]()['then'](respondWithResult(_0x4e954b,null))[_0x86ee('0x43')](handleError(_0x4e954b,null));};exports['getQuestions']=function(_0x4b3832,_0x2f13e8,_0x1ba6f5){var _0x142ada={'raw':!![],'where':{}};var _0x37c22f={};var _0xba03d4={'count':0x0,'rows':[]};return db['JscriptySessionReport']['findOne']({'where':{'id':_0x4b3832['params']['id']}})['then'](handleEntityNotFound(_0x2f13e8,null))[_0x86ee('0x24')](function(_0x3c6a44){if(_0x3c6a44){_0x37c22f['model']=_['keys'](db['JscriptyQuestionReport'][_0x86ee('0x45')]);_0x37c22f[_0x86ee('0x30')]=_[_0x86ee('0x31')](_0x4b3832['query']);_0x37c22f['filters']=_[_0x86ee('0x32')](_0x37c22f['model'],_0x37c22f[_0x86ee('0x30')]);_0x142ada[_0x86ee('0x33')]=_[_0x86ee('0x32')](_0x37c22f['model'],qs['fields'](_0x4b3832['query']['fields']));_0x142ada[_0x86ee('0x33')]=_0x142ada['attributes'][_0x86ee('0x35')]?_0x142ada[_0x86ee('0x33')]:_0x37c22f[_0x86ee('0x2f')];if(!_0x4b3832[_0x86ee('0x30')]['hasOwnProperty'](_0x86ee('0x4b'))){_0x142ada[_0x86ee('0x1d')]=qs[_0x86ee('0x1d')](_0x4b3832[_0x86ee('0x30')][_0x86ee('0x1d')]);_0x142ada[_0x86ee('0x1c')]=qs[_0x86ee('0x1c')](_0x4b3832[_0x86ee('0x30')][_0x86ee('0x1c')]);}_0x142ada[_0x86ee('0x37')]=qs[_0x86ee('0x38')](_0x4b3832['query'][_0x86ee('0x38')]);_0x142ada[_0x86ee('0x39')]=qs[_0x86ee('0x3a')](_[_0x86ee('0x3b')](_0x4b3832[_0x86ee('0x30')],_0x37c22f[_0x86ee('0x3a')]));_0x142ada[_0x86ee('0x39')][_0x86ee('0x4c')]=_0x3c6a44['id'];if(_0x4b3832[_0x86ee('0x30')][_0x86ee('0x3e')]){_0x142ada[_0x86ee('0x39')]=_[_0x86ee('0x3c')](_0x142ada[_0x86ee('0x39')],{'$or':_[_0x86ee('0x2a')](_0x142ada['attributes'],function(_0x2782fe){var _0x4481a7={};_0x4481a7[_0x2782fe]={'$like':'%'+_0x4b3832['query']['filter']+'%'};return _0x4481a7;})});}_0x142ada=_[_0x86ee('0x3c')]({},_0x142ada,_0x4b3832[_0x86ee('0x3f')]);return db['JscriptyQuestionReport'][_0x86ee('0x1e')]({'where':_0x142ada['where']})[_0x86ee('0x24')](function(_0x86adfb){_0xba03d4[_0x86ee('0x1e')]=_0x86adfb;if(_0x4b3832[_0x86ee('0x30')][_0x86ee('0x40')]){_0x142ada[_0x86ee('0x41')]=[{'all':!![]}];}return db[_0x86ee('0x4d')][_0x86ee('0x42')](_0x142ada);})['then'](function(_0x4768cc){_0xba03d4['rows']=_0x4768cc;return _0xba03d4;});}})[_0x86ee('0x24')](respondWithFilteredResult(_0x2f13e8,_0x142ada))[_0x86ee('0x43')](handleError(_0x2f13e8,null));}; \ No newline at end of file +var _0xe2d6=['moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','update','then','destroy','end','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','JscriptySessionReport','includeAll','include','rows','find','create','body','catch','params','describe','getQuestions','findOne','JscriptyQuestionReport','filter','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0xe2d6,0x1e7));var _0x6e2d=function(_0xcfc44,_0x179bc1){_0xcfc44=_0xcfc44-0x0;var _0x307a25=_0xe2d6[_0xcfc44];return _0x307a25;};'use strict';var emlformat=require(_0x6e2d('0x0'));var rimraf=require(_0x6e2d('0x1'));var zipdir=require(_0x6e2d('0x2'));var jsonpatch=require(_0x6e2d('0x3'));var rp=require(_0x6e2d('0x4'));var moment=require(_0x6e2d('0x5'));var BPromise=require(_0x6e2d('0x6'));var Mustache=require(_0x6e2d('0x7'));var util=require(_0x6e2d('0x8'));var path=require(_0x6e2d('0x9'));var sox=require(_0x6e2d('0xa'));var csv=require('to-csv');var ejs=require(_0x6e2d('0xb'));var fs=require('fs');var fs_extra=require(_0x6e2d('0xc'));var _=require('lodash');var squel=require(_0x6e2d('0xd'));var crypto=require('crypto');var jsforce=require(_0x6e2d('0xe'));var deskjs=require(_0x6e2d('0xf'));var toCsv=require(_0x6e2d('0x10'));var querystring=require(_0x6e2d('0x11'));var Papa=require(_0x6e2d('0x12'));var Redis=require(_0x6e2d('0x13'));var authService=require(_0x6e2d('0x14'));var qs=require(_0x6e2d('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6e2d('0x16'));var logger=require(_0x6e2d('0x17'))(_0x6e2d('0x18'));var utils=require(_0x6e2d('0x19'));var config=require(_0x6e2d('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x6e2d('0x1b'))['db'];function respondWithStatusCode(_0x548045,_0x17b8d1){_0x17b8d1=_0x17b8d1||0xcc;return function(_0x56572b){if(_0x56572b){return _0x548045[_0x6e2d('0x1c')](_0x17b8d1);}return _0x548045['status'](_0x17b8d1)['end']();};}function respondWithResult(_0x159f8d,_0x1c0899){_0x1c0899=_0x1c0899||0xc8;return function(_0x493637){if(_0x493637){return _0x159f8d['status'](_0x1c0899)[_0x6e2d('0x1d')](_0x493637);}};}function respondWithFilteredResult(_0x1849b5,_0x4aa846){return function(_0x3b37d2){if(_0x3b37d2){var _0x52ce4f=typeof _0x4aa846['offset']===_0x6e2d('0x1e')&&typeof _0x4aa846[_0x6e2d('0x1f')]===_0x6e2d('0x1e');var _0x5d300e=_0x3b37d2[_0x6e2d('0x20')];var _0x201339=_0x52ce4f?0x0:_0x4aa846['offset'];var _0xd9c0a7=_0x52ce4f?_0x3b37d2[_0x6e2d('0x20')]:_0x4aa846[_0x6e2d('0x21')]+_0x4aa846[_0x6e2d('0x1f')];var _0x2966d0;if(_0xd9c0a7>=_0x5d300e){_0xd9c0a7=_0x5d300e;_0x2966d0=0xc8;}else{_0x2966d0=0xce;}_0x1849b5[_0x6e2d('0x22')](_0x2966d0);return _0x1849b5[_0x6e2d('0x23')](_0x6e2d('0x24'),_0x201339+'-'+_0xd9c0a7+'/'+_0x5d300e)[_0x6e2d('0x1d')](_0x3b37d2);}return null;};}function patchUpdates(_0x40436b){return function(_0x19e63b){try{jsonpatch[_0x6e2d('0x25')](_0x19e63b,_0x40436b,!![]);}catch(_0x293ab3){return BPromise[_0x6e2d('0x26')](_0x293ab3);}return _0x19e63b['save']();};}function saveUpdates(_0x2e3357,_0x5db144){return function(_0x18a58f){if(_0x18a58f){return _0x18a58f[_0x6e2d('0x27')](_0x2e3357)[_0x6e2d('0x28')](function(_0x47c6dd){return _0x47c6dd;});}return null;};}function removeEntity(_0x29c970,_0x13a341){return function(_0x1910e3){if(_0x1910e3){return _0x1910e3[_0x6e2d('0x29')]()[_0x6e2d('0x28')](function(){_0x29c970[_0x6e2d('0x22')](0xcc)[_0x6e2d('0x2a')]();});}};}function handleEntityNotFound(_0x1fefa7,_0x46e0fe){return function(_0x155cf1){if(!_0x155cf1){_0x1fefa7[_0x6e2d('0x1c')](0x194);}return _0x155cf1;};}function handleError(_0x36c0ff,_0x2d6948){_0x2d6948=_0x2d6948||0x1f4;return function(_0x58a65c){logger['error'](_0x58a65c['stack']);if(_0x58a65c[_0x6e2d('0x2b')]){delete _0x58a65c[_0x6e2d('0x2b')];}_0x36c0ff[_0x6e2d('0x22')](_0x2d6948)[_0x6e2d('0x2c')](_0x58a65c);};}exports[_0x6e2d('0x2d')]=function(_0x1fe287,_0x333b17){var _0x144438={},_0x26208e={},_0x5b2494={'count':0x0,'rows':[]};var _0x541e04=_[_0x6e2d('0x2e')](db['JscriptySessionReport'][_0x6e2d('0x2f')],function(_0x477c9f){return{'name':_0x477c9f[_0x6e2d('0x30')],'type':_0x477c9f[_0x6e2d('0x31')][_0x6e2d('0x32')]};});_0x26208e[_0x6e2d('0x33')]=_['map'](_0x541e04,'name');_0x26208e[_0x6e2d('0x34')]=_[_0x6e2d('0x35')](_0x1fe287[_0x6e2d('0x34')]);_0x26208e['filters']=_[_0x6e2d('0x36')](_0x26208e[_0x6e2d('0x33')],_0x26208e['query']);_0x144438[_0x6e2d('0x37')]=_[_0x6e2d('0x36')](_0x26208e[_0x6e2d('0x33')],qs[_0x6e2d('0x38')](_0x1fe287[_0x6e2d('0x34')][_0x6e2d('0x38')]));_0x144438[_0x6e2d('0x37')]=_0x144438[_0x6e2d('0x37')][_0x6e2d('0x39')]?_0x144438['attributes']:_0x26208e[_0x6e2d('0x33')];if(!_0x1fe287['query'][_0x6e2d('0x3a')](_0x6e2d('0x3b'))){_0x144438[_0x6e2d('0x1f')]=qs[_0x6e2d('0x1f')](_0x1fe287[_0x6e2d('0x34')][_0x6e2d('0x1f')]);_0x144438[_0x6e2d('0x21')]=qs[_0x6e2d('0x21')](_0x1fe287[_0x6e2d('0x34')][_0x6e2d('0x21')]);}_0x144438[_0x6e2d('0x3c')]=qs[_0x6e2d('0x3d')](_0x1fe287[_0x6e2d('0x34')]['sort']);_0x144438[_0x6e2d('0x3e')]=qs[_0x6e2d('0x3f')](_[_0x6e2d('0x40')](_0x1fe287[_0x6e2d('0x34')],_0x26208e['filters']),_0x541e04);if(_0x1fe287['query']['filter']){_0x144438['where']=_[_0x6e2d('0x41')](_0x144438[_0x6e2d('0x3e')],{'$or':_[_0x6e2d('0x2e')](_0x541e04,function(_0x2526a1){if(_0x2526a1[_0x6e2d('0x31')]!==_0x6e2d('0x42')){var _0x164c30={};_0x164c30[_0x2526a1[_0x6e2d('0x2b')]]={'$like':'%'+_0x1fe287[_0x6e2d('0x34')]['filter']+'%'};return _0x164c30;}})});}_0x144438=_[_0x6e2d('0x41')]({},_0x144438,_0x1fe287[_0x6e2d('0x43')]);var _0x35cede={'where':_0x144438[_0x6e2d('0x3e')]};return db[_0x6e2d('0x44')][_0x6e2d('0x20')](_0x35cede)['then'](function(_0x3001ab){_0x5b2494[_0x6e2d('0x20')]=_0x3001ab;if(_0x1fe287[_0x6e2d('0x34')][_0x6e2d('0x45')]){_0x144438[_0x6e2d('0x46')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x144438);})[_0x6e2d('0x28')](function(_0xa2718){_0x5b2494[_0x6e2d('0x47')]=_0xa2718;return _0x5b2494;})[_0x6e2d('0x28')](respondWithFilteredResult(_0x333b17,_0x144438))['catch'](handleError(_0x333b17,null));};exports['show']=function(_0x17499b,_0x56f0dd){var _0x2800b7={'raw':!![],'where':{'id':_0x17499b['params']['id']}},_0x53f31a={};_0x53f31a[_0x6e2d('0x33')]=_['keys'](db[_0x6e2d('0x44')]['rawAttributes']);_0x53f31a[_0x6e2d('0x34')]=_['keys'](_0x17499b[_0x6e2d('0x34')]);_0x53f31a['filters']=_[_0x6e2d('0x36')](_0x53f31a[_0x6e2d('0x33')],_0x53f31a[_0x6e2d('0x34')]);_0x2800b7[_0x6e2d('0x37')]=_[_0x6e2d('0x36')](_0x53f31a['model'],qs[_0x6e2d('0x38')](_0x17499b[_0x6e2d('0x34')][_0x6e2d('0x38')]));_0x2800b7['attributes']=_0x2800b7[_0x6e2d('0x37')]['length']?_0x2800b7[_0x6e2d('0x37')]:_0x53f31a[_0x6e2d('0x33')];if(_0x17499b[_0x6e2d('0x34')]['includeAll']){_0x2800b7[_0x6e2d('0x46')]=[{'all':!![]}];}_0x2800b7=_[_0x6e2d('0x41')]({},_0x2800b7,_0x17499b[_0x6e2d('0x43')]);return db[_0x6e2d('0x44')][_0x6e2d('0x48')](_0x2800b7)[_0x6e2d('0x28')](handleEntityNotFound(_0x56f0dd,null))[_0x6e2d('0x28')](respondWithResult(_0x56f0dd,null))['catch'](handleError(_0x56f0dd,null));};exports[_0x6e2d('0x49')]=function(_0x12b5fc,_0x1cbed6){return db[_0x6e2d('0x44')][_0x6e2d('0x49')](_0x12b5fc[_0x6e2d('0x4a')],{})[_0x6e2d('0x28')](respondWithResult(_0x1cbed6,0xc9))['catch'](handleError(_0x1cbed6,null));};exports[_0x6e2d('0x27')]=function(_0x3a56c5,_0x4d8715){if(_0x3a56c5['body']['id']){delete _0x3a56c5[_0x6e2d('0x4a')]['id'];}return db[_0x6e2d('0x44')]['find']({'where':{'id':_0x3a56c5['params']['id']}})[_0x6e2d('0x28')](handleEntityNotFound(_0x4d8715,null))[_0x6e2d('0x28')](saveUpdates(_0x3a56c5[_0x6e2d('0x4a')],null))['then'](respondWithResult(_0x4d8715,null))[_0x6e2d('0x4b')](handleError(_0x4d8715,null));};exports[_0x6e2d('0x29')]=function(_0x46f862,_0x209eee){return db['JscriptySessionReport'][_0x6e2d('0x48')]({'where':{'id':_0x46f862[_0x6e2d('0x4c')]['id']}})['then'](handleEntityNotFound(_0x209eee,null))[_0x6e2d('0x28')](removeEntity(_0x209eee,null))[_0x6e2d('0x4b')](handleError(_0x209eee,null));};exports[_0x6e2d('0x4d')]=function(_0xc0a396,_0x1479d7){return db['JscriptySessionReport'][_0x6e2d('0x4d')]()[_0x6e2d('0x28')](respondWithResult(_0x1479d7,null))['catch'](handleError(_0x1479d7,null));};exports[_0x6e2d('0x4e')]=function(_0x5d5ae9,_0x9a75a0,_0x52f150){var _0x5aeb7b={'raw':!![],'where':{}};var _0x80c9c6={};var _0x5e12d2={'count':0x0,'rows':[]};return db[_0x6e2d('0x44')][_0x6e2d('0x4f')]({'where':{'id':_0x5d5ae9['params']['id']}})[_0x6e2d('0x28')](handleEntityNotFound(_0x9a75a0,null))[_0x6e2d('0x28')](function(_0x35d395){if(_0x35d395){_0x80c9c6[_0x6e2d('0x33')]=_[_0x6e2d('0x35')](db[_0x6e2d('0x50')]['rawAttributes']);_0x80c9c6[_0x6e2d('0x34')]=_[_0x6e2d('0x35')](_0x5d5ae9[_0x6e2d('0x34')]);_0x80c9c6['filters']=_[_0x6e2d('0x36')](_0x80c9c6['model'],_0x80c9c6[_0x6e2d('0x34')]);_0x5aeb7b['attributes']=_[_0x6e2d('0x36')](_0x80c9c6[_0x6e2d('0x33')],qs[_0x6e2d('0x38')](_0x5d5ae9['query'][_0x6e2d('0x38')]));_0x5aeb7b[_0x6e2d('0x37')]=_0x5aeb7b[_0x6e2d('0x37')][_0x6e2d('0x39')]?_0x5aeb7b['attributes']:_0x80c9c6[_0x6e2d('0x33')];if(!_0x5d5ae9[_0x6e2d('0x34')][_0x6e2d('0x3a')](_0x6e2d('0x3b'))){_0x5aeb7b['limit']=qs[_0x6e2d('0x1f')](_0x5d5ae9['query'][_0x6e2d('0x1f')]);_0x5aeb7b['offset']=qs[_0x6e2d('0x21')](_0x5d5ae9['query']['offset']);}_0x5aeb7b[_0x6e2d('0x3c')]=qs[_0x6e2d('0x3d')](_0x5d5ae9[_0x6e2d('0x34')][_0x6e2d('0x3d')]);_0x5aeb7b[_0x6e2d('0x3e')]=qs[_0x6e2d('0x3f')](_[_0x6e2d('0x40')](_0x5d5ae9[_0x6e2d('0x34')],_0x80c9c6['filters']));_0x5aeb7b[_0x6e2d('0x3e')]['SessionId']=_0x35d395['id'];if(_0x5d5ae9[_0x6e2d('0x34')][_0x6e2d('0x51')]){_0x5aeb7b[_0x6e2d('0x3e')]=_[_0x6e2d('0x41')](_0x5aeb7b[_0x6e2d('0x3e')],{'$or':_[_0x6e2d('0x2e')](_0x5aeb7b['attributes'],function(_0x43bd72){var _0x28b1aa={};_0x28b1aa[_0x43bd72]={'$like':'%'+_0x5d5ae9['query'][_0x6e2d('0x51')]+'%'};return _0x28b1aa;})});}_0x5aeb7b=_[_0x6e2d('0x41')]({},_0x5aeb7b,_0x5d5ae9[_0x6e2d('0x43')]);return db['JscriptyQuestionReport'][_0x6e2d('0x20')]({'where':_0x5aeb7b[_0x6e2d('0x3e')]})['then'](function(_0x3fda11){_0x5e12d2[_0x6e2d('0x20')]=_0x3fda11;if(_0x5d5ae9[_0x6e2d('0x34')]['includeAll']){_0x5aeb7b[_0x6e2d('0x46')]=[{'all':!![]}];}return db[_0x6e2d('0x50')]['findAll'](_0x5aeb7b);})[_0x6e2d('0x28')](function(_0x537286){_0x5e12d2[_0x6e2d('0x47')]=_0x537286;return _0x5e12d2;});}})[_0x6e2d('0x28')](respondWithFilteredResult(_0x9a75a0,_0x5aeb7b))[_0x6e2d('0x4b')](handleError(_0x9a75a0,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index abfa24d..f042688 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 _0x038b=['report_jscripty_sessions','util','../../config/logger','api','bluebird','path','rimraf','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport'];(function(_0x11d4e0,_0x57d757){var _0x6e4dd2=function(_0x2f6c57){while(--_0x2f6c57){_0x11d4e0['push'](_0x11d4e0['shift']());}};_0x6e4dd2(++_0x57d757);}(_0x038b,0x114));var _0xb038=function(_0x50c166,_0x1e4089){_0x50c166=_0x50c166-0x0;var _0xa7b8b5=_0x038b[_0x50c166];return _0xa7b8b5;};'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':[],'timestamps':!![]});}; \ No newline at end of file +var _0x81c6=['JscriptySessionReport','util','bluebird','request-promise','path','../../config/environment','./jscriptySessionReport.attributes','exports','define'];(function(_0x31c6af,_0x4b5e8a){var _0x35ba12=function(_0x37c8e6){while(--_0x37c8e6){_0x31c6af['push'](_0x31c6af['shift']());}};_0x35ba12(++_0x4b5e8a);}(_0x81c6,0x1d5));var _0x681c=function(_0x57a6ce,_0x3d7316){_0x57a6ce=_0x57a6ce-0x0;var _0x38de7e=_0x81c6[_0x57a6ce];return _0x38de7e;};'use strict';var _=require('lodash');var util=require(_0x681c('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x681c('0x1'));var rp=require(_0x681c('0x2'));var fs=require('fs');var path=require(_0x681c('0x3'));var rimraf=require('rimraf');var config=require(_0x681c('0x4'));var attributes=require(_0x681c('0x5'));module[_0x681c('0x6')]=function(_0x1d31c8,_0x4ea522){return _0x1d31c8[_0x681c('0x7')](_0x681c('0x8'),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 d643ec5..1113bdf 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 _0x47c5=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0xd67723,_0x1e576f){var _0x53b62b=function(_0x2460a3){while(--_0x2460a3){_0xd67723['push'](_0xd67723['shift']());}};_0x53b62b(++_0x1e576f);}(_0x47c5,0x165));var _0x547c=function(_0x16d3f8,_0x3f5dd3){_0x16d3f8=_0x16d3f8-0x0;var _0x49a172=_0x47c5[_0x16d3f8];return _0x49a172;};'use strict';var _=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var moment=require(_0x547c('0x2'));var BPromise=require(_0x547c('0x3'));var rs=require(_0x547c('0x4'));var fs=require('fs');var Redis=require(_0x547c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x547c('0x6'));var logger=require(_0x547c('0x7'))('rpc');var config=require(_0x547c('0x8'));var jayson=require(_0x547c('0x9'));var client=jayson['client'][_0x547c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x439f25,_0x381f2e,_0x10a334){return new BPromise(function(_0x12fb7d,_0x4ef079){return client[_0x547c('0xb')](_0x439f25,_0x10a334)[_0x547c('0xc')](function(_0x10dec9){logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));logger[_0x547c('0x10')](_0x547c('0x11'),_0x381f2e,_0x547c('0xf'),JSON[_0x547c('0x12')](_0x10dec9));if(_0x10dec9[_0x547c('0x13')]){if(_0x10dec9['error'][_0x547c('0x14')]===0x1f4){logger[_0x547c('0x13')]('JscriptySessionReport,\x20%s,\x20%s',_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x4ef079(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}logger[_0x547c('0x13')](_0x547c('0xe'),_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x12fb7d(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}else{logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));_0x12fb7d(_0x10dec9[_0x547c('0x16')][_0x547c('0x15')]);}})[_0x547c('0x17')](function(_0x39498d){logger[_0x547c('0x13')]('JscriptySessionReport,\x20%s,\x20%s',_0x381f2e,_0x39498d);_0x4ef079(_0x39498d);});});} \ No newline at end of file +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','JscriptySessionReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x426332,_0x446fc4){var _0x14acfe=function(_0x521c8e){while(--_0x521c8e){_0x426332['push'](_0x426332['shift']());}};_0x14acfe(++_0x446fc4);}(_0x5f2f,0x73));var _0xf5f2=function(_0x113bb4,_0x48e892){_0x113bb4=_0x113bb4-0x0;var _0x1f0efe=_0x5f2f[_0x113bb4];return _0x1f0efe;};'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')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index d6aee72..e4c3d91 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 _0xa87e=['util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./license.controller','get','index','/:id','isAuthenticated','update','exports','multer'];(function(_0x4a2a23,_0x49f5ee){var _0x38c0f9=function(_0x29cb62){while(--_0x29cb62){_0x4a2a23['push'](_0x4a2a23['shift']());}};_0x38c0f9(++_0x49f5ee);}(_0xa87e,0x185));var _0xea87=function(_0x58dc2b,_0x5808f0){_0x58dc2b=_0x58dc2b-0x0;var _0x4f04d7=_0xa87e[_0x58dc2b];return _0x4f04d7;};'use strict';var multer=require(_0xea87('0x0'));var util=require(_0xea87('0x1'));var path=require(_0xea87('0x2'));var timeout=require('connect-timeout');var express=require(_0xea87('0x3'));var router=express[_0xea87('0x4')]();var fs_extra=require(_0xea87('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xea87('0x6'));var config=require(_0xea87('0x7'));var controller=require(_0xea87('0x8'));router[_0xea87('0x9')]('/',controller[_0xea87('0xa')]);router['put'](_0xea87('0xb'),auth[_0xea87('0xc')](),controller[_0xea87('0xd')]);module[_0xea87('0xe')]=router; \ No newline at end of file +var _0xd28c=['update','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./license.controller','get','put','/:id'];(function(_0x1d102f,_0x4244c2){var _0x426389=function(_0x373624){while(--_0x373624){_0x1d102f['push'](_0x1d102f['shift']());}};_0x426389(++_0x4244c2);}(_0xd28c,0x72));var _0xcd28=function(_0x1b96d8,_0x17f176){_0x1b96d8=_0x1b96d8-0x0;var _0x3ca6ef=_0xd28c[_0x1b96d8];return _0x3ca6ef;};'use strict';var multer=require('multer');var util=require(_0xcd28('0x0'));var path=require(_0xcd28('0x1'));var timeout=require(_0xcd28('0x2'));var express=require(_0xcd28('0x3'));var router=express[_0xcd28('0x4')]();var fs_extra=require(_0xcd28('0x5'));var auth=require(_0xcd28('0x6'));var interaction=require(_0xcd28('0x7'));var config=require('../../config/environment');var controller=require(_0xcd28('0x8'));router[_0xcd28('0x9')]('/',controller['index']);router[_0xcd28('0xa')](_0xcd28('0xb'),auth['isAuthenticated'](),controller[_0xcd28('0xc')]);module[_0xcd28('0xd')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 15d63f3..c811da1 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 _0x28d9=['sequelize','TEXT','STRING','INTEGER'];(function(_0x4fb570,_0x21803a){var _0x2d0958=function(_0x54ee71){while(--_0x54ee71){_0x4fb570['push'](_0x4fb570['shift']());}};_0x2d0958(++_0x21803a);}(_0x28d9,0x94));var _0x928d=function(_0x403dfa,_0xcd979){_0x403dfa=_0x403dfa-0x0;var _0x467cc7=_0x28d9[_0x403dfa];return _0x467cc7;};'use strict';var Sequelize=require(_0x928d('0x0'));module['exports']={'license':{'type':Sequelize[_0x928d('0x1')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x928d('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x928d('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe4e7=['STRING','INTEGER','exports','TEXT'];(function(_0x1b0213,_0xc3f544){var _0xadedea=function(_0x1dc61c){while(--_0x1dc61c){_0x1b0213['push'](_0x1b0213['shift']());}};_0xadedea(++_0xc3f544);}(_0xe4e7,0x192));var _0x7e4e=function(_0x49d313,_0x5a6e3b){_0x49d313=_0x49d313-0x0;var _0x2291fd=_0xe4e7[_0x49d313];return _0x2291fd;};'use strict';var Sequelize=require('sequelize');module[_0x7e4e('0x0')]={'license':{'type':Sequelize[_0x7e4e('0x1')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x7e4e('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x7e4e('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 e7177b6..be5ed1d 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 _0xadb5=['query','filters','intersection','attributes','merge','getLicense','body','find','params','key','catch','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','model','keys','License'];(function(_0xf6173e,_0xcad580){var _0x472867=function(_0x18bfd4){while(--_0x18bfd4){_0xf6173e['push'](_0xf6173e['shift']());}};_0x472867(++_0xcad580);}(_0xadb5,0xad));var _0x5adb=function(_0x2a579b,_0x392111){_0x2a579b=_0x2a579b-0x0;var _0x5929c8=_0xadb5[_0x2a579b];return _0x5929c8;};'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);};}var utilLicense=require(_0x5adb('0x17'));exports['index']=function(_0x49992e,_0x5d457e){var _0x39bddd={'raw':!![],'where':{'id':0x1}},_0x1eac55={};_0x1eac55[_0x5adb('0x28')]=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes']);_0x1eac55[_0x5adb('0x2b')]=_[_0x5adb('0x29')](_0x49992e[_0x5adb('0x2b')]);_0x1eac55[_0x5adb('0x2c')]=_[_0x5adb('0x2d')](_0x1eac55[_0x5adb('0x28')],_0x1eac55[_0x5adb('0x2b')]);_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x2d')](_0x1eac55[_0x5adb('0x28')],qs['fields'](_0x49992e[_0x5adb('0x2b')]['fields']));_0x39bddd[_0x5adb('0x2e')]=_0x39bddd[_0x5adb('0x2e')]['length']?_0x39bddd[_0x5adb('0x2e')]:_0x1eac55[_0x5adb('0x28')];_0x39bddd=_[_0x5adb('0x2f')]({},_0x39bddd,_0x49992e['options']);return utilLicense[_0x5adb('0x30')](_0x39bddd)[_0x5adb('0x22')](respondWithResult(_0x5d457e,null))['catch'](handleError(_0x5d457e,null));};exports['update']=function(_0x1ed9ea,_0x49dd03){if(_0x1ed9ea[_0x5adb('0x31')]['id']){delete _0x1ed9ea[_0x5adb('0x31')]['id'];}return db[_0x5adb('0x2a')][_0x5adb('0x32')]({'where':{'id':_0x1ed9ea[_0x5adb('0x33')]['id']}})['then'](handleEntityNotFound(_0x49dd03,null))[_0x5adb('0x22')](function(_0x215b88){var _0x1c3a5c=_0x215b88['get']({'plain':!![]});return utilLicense['checkLicense'](_0x1c3a5c,_0x1ed9ea[_0x5adb('0x31')][_0x5adb('0x34')]);})['then'](function(_0x2355bc){if(!_0x2355bc['demo']){return saveUpdates(_0x1ed9ea[_0x5adb('0x31')],null);}return _0x2355bc;})['then'](respondWithResult(_0x49dd03,null))[_0x5adb('0x35')](handleError(_0x49dd03,null));}; \ No newline at end of file +var _0x814b=['json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','model','keys','rawAttributes','intersection','query','attributes','fields','length','merge','options','getLicense','catch','body','License','params','get','key','demo','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x659042,_0x21e413){var _0x4f7a4a=function(_0x4d6f92){while(--_0x4d6f92){_0x659042['push'](_0x659042['shift']());}};_0x4f7a4a(++_0x21e413);}(_0x814b,0x1a2));var _0xb814=function(_0x17249c,_0x168d62){_0x17249c=_0x17249c-0x0;var _0x324e7b=_0x814b[_0x17249c];return _0x324e7b;};'use strict';var emlformat=require(_0xb814('0x0'));var rimraf=require(_0xb814('0x1'));var zipdir=require(_0xb814('0x2'));var jsonpatch=require(_0xb814('0x3'));var rp=require(_0xb814('0x4'));var moment=require(_0xb814('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb814('0x6'));var util=require(_0xb814('0x7'));var path=require(_0xb814('0x8'));var sox=require(_0xb814('0x9'));var csv=require(_0xb814('0xa'));var ejs=require(_0xb814('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xa'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb814('0x19'));var db=require(_0xb814('0x1a'))['db'];function respondWithStatusCode(_0x35b10d,_0x2cc46b){_0x2cc46b=_0x2cc46b||0xcc;return function(_0x2ce718){if(_0x2ce718){return _0x35b10d[_0xb814('0x1b')](_0x2cc46b);}return _0x35b10d[_0xb814('0x1c')](_0x2cc46b)[_0xb814('0x1d')]();};}function respondWithResult(_0xa0a2e5,_0x2ab627){_0x2ab627=_0x2ab627||0xc8;return function(_0x3f4881){if(_0x3f4881){return _0xa0a2e5[_0xb814('0x1c')](_0x2ab627)[_0xb814('0x1e')](_0x3f4881);}};}function respondWithFilteredResult(_0x39bfcf,_0x303aca){return function(_0x3a71d6){if(_0x3a71d6){var _0x45e0d0=typeof _0x303aca[_0xb814('0x1f')]===_0xb814('0x20')&&typeof _0x303aca[_0xb814('0x21')]===_0xb814('0x20');var _0x48c9df=_0x3a71d6[_0xb814('0x22')];var _0x55ba16=_0x45e0d0?0x0:_0x303aca[_0xb814('0x1f')];var _0xfac75b=_0x45e0d0?_0x3a71d6['count']:_0x303aca['offset']+_0x303aca['limit'];var _0x399b43;if(_0xfac75b>=_0x48c9df){_0xfac75b=_0x48c9df;_0x399b43=0xc8;}else{_0x399b43=0xce;}_0x39bfcf['status'](_0x399b43);return _0x39bfcf['set'](_0xb814('0x23'),_0x55ba16+'-'+_0xfac75b+'/'+_0x48c9df)[_0xb814('0x1e')](_0x3a71d6);}return null;};}function patchUpdates(_0x25b6b6){return function(_0x4e139e){try{jsonpatch[_0xb814('0x24')](_0x4e139e,_0x25b6b6,!![]);}catch(_0x531032){return BPromise[_0xb814('0x25')](_0x531032);}return _0x4e139e[_0xb814('0x26')]();};}function saveUpdates(_0x3b267e,_0x470e81){return function(_0x27352e){if(_0x27352e){return _0x27352e[_0xb814('0x27')](_0x3b267e)[_0xb814('0x28')](function(_0x594470){return _0x594470;});}return null;};}function removeEntity(_0x2ead86,_0x52b7a3){return function(_0x3f81d0){if(_0x3f81d0){return _0x3f81d0[_0xb814('0x29')]()[_0xb814('0x28')](function(){_0x2ead86[_0xb814('0x1c')](0xcc)[_0xb814('0x1d')]();});}};}function handleEntityNotFound(_0xb9e57d,_0x3d836c){return function(_0x5755ea){if(!_0x5755ea){_0xb9e57d[_0xb814('0x1b')](0x194);}return _0x5755ea;};}function handleError(_0xc0ef66,_0x1c2625){_0x1c2625=_0x1c2625||0x1f4;return function(_0x349394){logger[_0xb814('0x2a')](_0x349394[_0xb814('0x2b')]);if(_0x349394[_0xb814('0x2c')]){delete _0x349394[_0xb814('0x2c')];}_0xc0ef66['status'](_0x1c2625)[_0xb814('0x2d')](_0x349394);};}var utilLicense=require(_0xb814('0x19'));exports['index']=function(_0x9008b2,_0x37d24d){var _0x530744={'raw':!![],'where':{'id':0x1}},_0x499f22={};_0x499f22[_0xb814('0x2e')]=_[_0xb814('0x2f')](db['License'][_0xb814('0x30')]);_0x499f22['query']=_[_0xb814('0x2f')](_0x9008b2['query']);_0x499f22['filters']=_[_0xb814('0x31')](_0x499f22['model'],_0x499f22[_0xb814('0x32')]);_0x530744[_0xb814('0x33')]=_[_0xb814('0x31')](_0x499f22['model'],qs['fields'](_0x9008b2[_0xb814('0x32')][_0xb814('0x34')]));_0x530744['attributes']=_0x530744[_0xb814('0x33')][_0xb814('0x35')]?_0x530744[_0xb814('0x33')]:_0x499f22[_0xb814('0x2e')];_0x530744=_[_0xb814('0x36')]({},_0x530744,_0x9008b2[_0xb814('0x37')]);return utilLicense[_0xb814('0x38')](_0x530744)['then'](respondWithResult(_0x37d24d,null))[_0xb814('0x39')](handleError(_0x37d24d,null));};exports[_0xb814('0x27')]=function(_0x30de5a,_0x424e2b){if(_0x30de5a[_0xb814('0x3a')]['id']){delete _0x30de5a['body']['id'];}return db[_0xb814('0x3b')]['find']({'where':{'id':_0x30de5a[_0xb814('0x3c')]['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x424e2b,null))[_0xb814('0x28')](function(_0x492d5e){var _0x40b885=_0x492d5e[_0xb814('0x3d')]({'plain':!![]});return utilLicense['checkLicense'](_0x40b885,_0x30de5a[_0xb814('0x3a')][_0xb814('0x3e')]);})[_0xb814('0x28')](function(_0x1f7cd8){if(!_0x1f7cd8[_0xb814('0x3f')]){return saveUpdates(_0x30de5a[_0xb814('0x3a')],null);}return _0x1f7cd8;})['then'](respondWithResult(_0x424e2b,null))[_0xb814('0x39')](handleError(_0x424e2b,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 93d7c0d..4b42144 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 _0xd8fd=['bluebird','path','rimraf','../../config/environment','./license.attributes','define','License','license','lodash','../../config/logger','moment'];(function(_0x33d838,_0x2dc01f){var _0x13b35e=function(_0x5bbd36){while(--_0x5bbd36){_0x33d838['push'](_0x33d838['shift']());}};_0x13b35e(++_0x2dc01f);}(_0xd8fd,0xe4));var _0xdd8f=function(_0x97435b,_0x3972c7){_0x97435b=_0x97435b-0x0;var _0x30feb9=_0xd8fd[_0x97435b];return _0x30feb9;};'use strict';var _=require(_0xdd8f('0x0'));var util=require('util');var logger=require(_0xdd8f('0x1'))('api');var moment=require(_0xdd8f('0x2'));var BPromise=require(_0xdd8f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdd8f('0x4'));var rimraf=require(_0xdd8f('0x5'));var config=require(_0xdd8f('0x6'));var attributes=require(_0xdd8f('0x7'));module['exports']=function(_0x5c3212,_0x7371bb){return _0x5c3212[_0xdd8f('0x8')](_0xdd8f('0x9'),attributes,{'tableName':_0xdd8f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbe22=['../../config/environment','exports','define','License','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x41aa25,_0x4ab96e){var _0x5eae87=function(_0x2f74aa){while(--_0x2f74aa){_0x41aa25['push'](_0x41aa25['shift']());}};_0x5eae87(++_0x4ab96e);}(_0xbe22,0x86));var _0x2be2=function(_0x26811a,_0x3aa2b7){_0x26811a=_0x26811a-0x0;var _0x3ec1d3=_0xbe22[_0x26811a];return _0x3ec1d3;};'use strict';var _=require('lodash');var util=require(_0x2be2('0x0'));var logger=require(_0x2be2('0x1'))('api');var moment=require('moment');var BPromise=require(_0x2be2('0x2'));var rp=require(_0x2be2('0x3'));var fs=require('fs');var path=require(_0x2be2('0x4'));var rimraf=require(_0x2be2('0x5'));var config=require(_0x2be2('0x6'));var attributes=require('./license.attributes');module[_0x2be2('0x7')]=function(_0x12668e,_0x165aae){return _0x12668e[_0x2be2('0x8')](_0x2be2('0x9'),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 441f8a3..2d533d5 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 _0xe30e=['error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2e58c7,_0x23d092){var _0x26eb00=function(_0x343124){while(--_0x343124){_0x2e58c7['push'](_0x2e58c7['shift']());}};_0x26eb00(++_0x23d092);}(_0xe30e,0x78));var _0xee30=function(_0x37d4ac,_0x4e47d6){_0x37d4ac=_0x37d4ac-0x0;var _0x5e727a=_0xe30e[_0x37d4ac];return _0x5e727a;};'use strict';var _=require('lodash');var util=require(_0xee30('0x0'));var moment=require(_0xee30('0x1'));var BPromise=require(_0xee30('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee30('0x3'));var db=require(_0xee30('0x4'))['db'];var utils=require(_0xee30('0x5'));var logger=require(_0xee30('0x6'))(_0xee30('0x7'));var config=require(_0xee30('0x8'));var jayson=require(_0xee30('0x9'));var client=jayson[_0xee30('0xa')][_0xee30('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x492aca,_0x5479aa,_0x43d875){return new BPromise(function(_0x3b1aab,_0x39c564){return client[_0xee30('0xc')](_0x492aca,_0x43d875)['then'](function(_0x538452){logger[_0xee30('0xd')](_0xee30('0xe'),_0x5479aa,_0xee30('0xf'));logger['debug'](_0xee30('0x10'),_0x5479aa,_0xee30('0xf'),JSON[_0xee30('0x11')](_0x538452));if(_0x538452[_0xee30('0x12')]){if(_0x538452['error'][_0xee30('0x13')]===0x1f4){logger[_0xee30('0x12')]('License,\x20%s,\x20%s',_0x5479aa,_0x538452[_0xee30('0x12')][_0xee30('0x14')]);return _0x39c564(_0x538452['error']['message']);}logger[_0xee30('0x12')](_0xee30('0xe'),_0x5479aa,_0x538452[_0xee30('0x12')]['message']);return _0x3b1aab(_0x538452[_0xee30('0x12')]['message']);}else{logger['info']('License,\x20%s,\x20%s',_0x5479aa,_0xee30('0xf'));_0x3b1aab(_0x538452[_0xee30('0x15')][_0xee30('0x14')]);}})[_0xee30('0x16')](function(_0xa302b3){logger[_0xee30('0x12')]('License,\x20%s,\x20%s',_0x5479aa,_0xa302b3);_0x39c564(_0xa302b3);});});} \ No newline at end of file +var _0x98a1=['License,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','request','then','info','request\x20sent','debug','error','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x98a1,0x17e));var _0x198a=function(_0x133fd5,_0x5d7d8b){_0x133fd5=_0x133fd5-0x0;var _0x482fbd=_0x98a1[_0x133fd5];return _0x482fbd;};'use strict';var _=require(_0x198a('0x0'));var util=require(_0x198a('0x1'));var moment=require(_0x198a('0x2'));var BPromise=require(_0x198a('0x3'));var rs=require(_0x198a('0x4'));var fs=require('fs');var Redis=require(_0x198a('0x5'));var db=require(_0x198a('0x6'))['db'];var utils=require(_0x198a('0x7'));var logger=require(_0x198a('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x198a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55e902,_0x55a4d5,_0x4f3e79){return new BPromise(function(_0x11961b,_0x4dbd21){return client[_0x198a('0xa')](_0x55e902,_0x4f3e79)[_0x198a('0xb')](function(_0x48eb5e){logger[_0x198a('0xc')]('License,\x20%s,\x20%s',_0x55a4d5,_0x198a('0xd'));logger[_0x198a('0xe')]('License,\x20%s,\x20%s,\x20%s',_0x55a4d5,_0x198a('0xd'),JSON['stringify'](_0x48eb5e));if(_0x48eb5e[_0x198a('0xf')]){if(_0x48eb5e[_0x198a('0xf')][_0x198a('0x10')]===0x1f4){logger[_0x198a('0xf')](_0x198a('0x11'),_0x55a4d5,_0x48eb5e[_0x198a('0xf')][_0x198a('0x12')]);return _0x4dbd21(_0x48eb5e[_0x198a('0xf')]['message']);}logger['error'](_0x198a('0x11'),_0x55a4d5,_0x48eb5e[_0x198a('0xf')][_0x198a('0x12')]);return _0x11961b(_0x48eb5e[_0x198a('0xf')]['message']);}else{logger[_0x198a('0xc')](_0x198a('0x11'),_0x55a4d5,'request\x20sent');_0x11961b(_0x48eb5e[_0x198a('0x13')][_0x198a('0x12')]);}})[_0x198a('0x14')](function(_0x534f80){logger[_0x198a('0xf')](_0x198a('0x11'),_0x55a4d5,_0x534f80);_0x4dbd21(_0x534f80);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 9f9ec53..b72c910 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 _0x9d71=['verifySmtp','/:id/users','getAgents','post','addAnswer','create','/:id/out_servers','addSmtp','addInteraction','addApplications','/:id/send','addAgents','/:id','update','delete','removeDispositions','removeAnswers','removeSmtp','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/in_servers','getImap','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify'];(function(_0x3c5735,_0x1f4f53){var _0x2cd61d=function(_0x183e55){while(--_0x183e55){_0x3c5735['push'](_0x3c5735['shift']());}};_0x2cd61d(++_0x1f4f53);}(_0x9d71,0x9b));var _0x19d7=function(_0x22797e,_0x4d58db){_0x22797e=_0x22797e-0x0;var _0x3daee4=_0x9d71[_0x22797e];return _0x3daee4;};'use strict';var multer=require(_0x19d7('0x0'));var util=require(_0x19d7('0x1'));var path=require(_0x19d7('0x2'));var timeout=require(_0x19d7('0x3'));var express=require('express');var router=express[_0x19d7('0x4')]();var fs_extra=require(_0x19d7('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x19d7('0x6'));var controller=require('./mailAccount.controller');router[_0x19d7('0x7')]('/',auth[_0x19d7('0x8')](),controller[_0x19d7('0x9')]);router[_0x19d7('0x7')](_0x19d7('0xa'),auth[_0x19d7('0x8')](),controller[_0x19d7('0xb')]);router[_0x19d7('0x7')]('/:id',auth[_0x19d7('0x8')](),controller['show']);router['get'](_0x19d7('0xc'),auth[_0x19d7('0x8')](),controller[_0x19d7('0xd')]);router[_0x19d7('0x7')](_0x19d7('0xe'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x19d7('0x7')](_0x19d7('0xf'),auth[_0x19d7('0x8')](),controller[_0x19d7('0x10')]);router['get']('/:id/out_servers',auth['isAuthenticated'](),controller[_0x19d7('0x11')]);router[_0x19d7('0x7')](_0x19d7('0x12'),auth[_0x19d7('0x8')](),controller[_0x19d7('0x13')]);router[_0x19d7('0x7')](_0x19d7('0x14'),auth[_0x19d7('0x8')](),controller[_0x19d7('0x15')]);router[_0x19d7('0x7')](_0x19d7('0x16'),auth[_0x19d7('0x8')](),controller[_0x19d7('0x17')]);router[_0x19d7('0x7')](_0x19d7('0x18'),auth[_0x19d7('0x8')](),controller[_0x19d7('0x19')]);router['get'](_0x19d7('0x1a'),auth['isAuthenticated'](),controller[_0x19d7('0x1b')]);router['post'](_0x19d7('0xc'),auth[_0x19d7('0x8')](),controller['addDisposition']);router[_0x19d7('0x1c')](_0x19d7('0xe'),auth[_0x19d7('0x8')](),controller[_0x19d7('0x1d')]);router[_0x19d7('0x1c')]('/',auth['isAuthenticated'](),controller[_0x19d7('0x1e')]);router[_0x19d7('0x1c')](_0x19d7('0xf'),auth['isAuthenticated'](),controller['addImap']);router[_0x19d7('0x1c')](_0x19d7('0x1f'),auth[_0x19d7('0x8')](),controller[_0x19d7('0x20')]);router[_0x19d7('0x1c')](_0x19d7('0x12'),auth[_0x19d7('0x8')](),controller[_0x19d7('0x21')]);router[_0x19d7('0x1c')](_0x19d7('0x14'),auth[_0x19d7('0x8')](),controller[_0x19d7('0x22')]);router[_0x19d7('0x1c')](_0x19d7('0x23'),auth['isAuthenticated'](),controller['send']);router[_0x19d7('0x1c')](_0x19d7('0x1a'),auth[_0x19d7('0x8')](),controller[_0x19d7('0x24')]);router['put'](_0x19d7('0x25'),auth[_0x19d7('0x8')](),controller[_0x19d7('0x26')]);router[_0x19d7('0x27')](_0x19d7('0xc'),auth[_0x19d7('0x8')](),controller[_0x19d7('0x28')]);router[_0x19d7('0x27')](_0x19d7('0xe'),auth[_0x19d7('0x8')](),controller[_0x19d7('0x29')]);router[_0x19d7('0x27')]('/:id/in_servers',auth[_0x19d7('0x8')](),controller['removeImap']);router[_0x19d7('0x27')](_0x19d7('0x1f'),auth['isAuthenticated'](),controller[_0x19d7('0x2a')]);router[_0x19d7('0x27')](_0x19d7('0x25'),auth['isAuthenticated'](),controller[_0x19d7('0x2b')]);router['delete']('/:id/users',auth[_0x19d7('0x8')](),controller['removeAgents']);module[_0x19d7('0x2c')]=router; \ No newline at end of file +var _0x95f1=['/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/verify','verifySmtp','getAgents','post','addAnswer','addImap','addSmtp','addInteraction','addApplications','/:id/send','send','addAgents','put','update','delete','removeDispositions','removeImap','removeSmtp','/:id/users','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe'];(function(_0x502598,_0x1e95c8){var _0xbdee21=function(_0x140feb){while(--_0x140feb){_0x502598['push'](_0x502598['shift']());}};_0xbdee21(++_0x1e95c8);}(_0x95f1,0x1c0));var _0x195f=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x95f1[_0x411017];return _0x2adeea;};'use strict';var multer=require(_0x195f('0x0'));var util=require(_0x195f('0x1'));var path=require(_0x195f('0x2'));var timeout=require('connect-timeout');var express=require(_0x195f('0x3'));var router=express[_0x195f('0x4')]();var fs_extra=require(_0x195f('0x5'));var auth=require(_0x195f('0x6'));var interaction=require(_0x195f('0x7'));var config=require(_0x195f('0x8'));var controller=require('./mailAccount.controller');router['get']('/',auth[_0x195f('0x9')](),controller['index']);router[_0x195f('0xa')](_0x195f('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x195f('0xa')](_0x195f('0xc'),auth[_0x195f('0x9')](),controller['show']);router['get'](_0x195f('0xd'),auth[_0x195f('0x9')](),controller[_0x195f('0xe')]);router[_0x195f('0xa')](_0x195f('0xf'),auth[_0x195f('0x9')](),controller[_0x195f('0x10')]);router[_0x195f('0xa')](_0x195f('0x11'),auth[_0x195f('0x9')](),controller[_0x195f('0x12')]);router['get'](_0x195f('0x13'),auth[_0x195f('0x9')](),controller[_0x195f('0x14')]);router[_0x195f('0xa')](_0x195f('0x15'),auth[_0x195f('0x9')](),controller[_0x195f('0x16')]);router[_0x195f('0xa')](_0x195f('0x17'),auth[_0x195f('0x9')](),controller[_0x195f('0x18')]);router['get']('/:id/messages',auth[_0x195f('0x9')](),controller['getMessages']);router[_0x195f('0xa')](_0x195f('0x19'),auth[_0x195f('0x9')](),controller[_0x195f('0x1a')]);router[_0x195f('0xa')]('/:id/users',auth[_0x195f('0x9')](),controller[_0x195f('0x1b')]);router[_0x195f('0x1c')](_0x195f('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x195f('0x1c')]('/:id/canned_answers',auth[_0x195f('0x9')](),controller[_0x195f('0x1d')]);router[_0x195f('0x1c')]('/',auth[_0x195f('0x9')](),controller['create']);router['post']('/:id/in_servers',auth['isAuthenticated'](),controller[_0x195f('0x1e')]);router['post'](_0x195f('0x13'),auth[_0x195f('0x9')](),controller[_0x195f('0x1f')]);router['post'](_0x195f('0x15'),auth[_0x195f('0x9')](),controller[_0x195f('0x20')]);router[_0x195f('0x1c')](_0x195f('0x17'),auth[_0x195f('0x9')](),controller[_0x195f('0x21')]);router[_0x195f('0x1c')](_0x195f('0x22'),auth[_0x195f('0x9')](),controller[_0x195f('0x23')]);router['post']('/:id/users',auth[_0x195f('0x9')](),controller[_0x195f('0x24')]);router[_0x195f('0x25')](_0x195f('0xc'),auth[_0x195f('0x9')](),controller[_0x195f('0x26')]);router[_0x195f('0x27')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x195f('0x28')]);router[_0x195f('0x27')]('/:id/canned_answers',auth['isAuthenticated'](),controller['removeAnswers']);router[_0x195f('0x27')](_0x195f('0x11'),auth['isAuthenticated'](),controller[_0x195f('0x29')]);router[_0x195f('0x27')](_0x195f('0x13'),auth[_0x195f('0x9')](),controller[_0x195f('0x2a')]);router[_0x195f('0x27')](_0x195f('0xc'),auth[_0x195f('0x9')](),controller['destroy']);router[_0x195f('0x27')](_0x195f('0x2b'),auth[_0x195f('0x9')](),controller[_0x195f('0x2c')]);module[_0x195f('0x2d')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index adbecb1..ff96bb0 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 _0x50a6=['exports','BOOLEAN','STRING','TEXT','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize'];(function(_0x16781e,_0x4b3d74){var _0x5b11af=function(_0x2a7081){while(--_0x2a7081){_0x16781e['push'](_0x16781e['shift']());}};_0x5b11af(++_0x4b3d74);}(_0x50a6,0xa4));var _0x650a=function(_0x1b6ae1,_0x7265ae){_0x1b6ae1=_0x1b6ae1-0x0;var _0x5843a2=_0x50a6[_0x1b6ae1];return _0x5843a2;};'use strict';var Sequelize=require(_0x650a('0x0'));module[_0x650a('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x650a('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x650a('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x650a('0x3')],'allowNull':![]},'template':{'type':Sequelize[_0x650a('0x4')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x650a('0x3')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x650a('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x650a('0x4')],'defaultValue':function(){return _0x650a('0x6');}},'notificationSound':{'type':Sequelize[_0x650a('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x650a('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x650a('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x650a('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x650a('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x650a('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x650a('0x9'),'set':function(_0x526881){if(!_0x526881)this[_0x650a('0xa')]('mandatoryDispositionPauseId',null);this[_0x650a('0xa')]('mandatoryDisposition',_0x526881);}}}; \ No newline at end of file +var _0xd6d2=['exports','STRING','BOOLEAN','TEXT','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize'];(function(_0x30f858,_0x29af1a){var _0x39efa2=function(_0x3a2ce5){while(--_0x3a2ce5){_0x30f858['push'](_0x30f858['shift']());}};_0x39efa2(++_0x29af1a);}(_0xd6d2,0xcb));var _0x2d6d=function(_0xb6843e,_0x1416e5){_0xb6843e=_0xb6843e-0x0;var _0x5b363c=_0xd6d2[_0xb6843e];return _0x5b363c;};'use strict';var Sequelize=require(_0x2d6d('0x0'));module[_0x2d6d('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x2d6d('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x2d6d('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x2d6d('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x2d6d('0x4')]},'markAsUnread':{'type':Sequelize[_0x2d6d('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x2d6d('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x2d6d('0x5')](0x2)[_0x2d6d('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x2d6d('0x4')],'defaultValue':function(){return _0x2d6d('0x7');}},'notificationSound':{'type':Sequelize[_0x2d6d('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2d6d('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2d6d('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x2d6d('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2d6d('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2d6d('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2d6d('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x2d6d('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x2d6d('0x3')],'defaultValue':![],'comment':_0x2d6d('0x9'),'set':function(_0x3cc2fa){if(!_0x3cc2fa)this[_0x2d6d('0xa')]('mandatoryDispositionPauseId',null);this[_0x2d6d('0xa')](_0x2d6d('0xb'),_0x3cc2fa);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 35f19e0..f31b313 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 _0xd879=['index','MailServerIn','Imap','Smtp','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','query','keys','filters','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','MailAccount','includeAll','findAll','rows','MailServerOut','intersection','include','find','body','params','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','attributes','removeDispositions','ids','CannedAnswer','getAnswers','email','ListId','isNil','active','description','cauthentication','user','cuser','password','pass','cpassword','authentication','host','port','service','cservice','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MailAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','$gte','split','format','MailMessage','send','CmList','List','Contacts','DESC','from','attachments','join','root','server/files/attachments','basename','auth','secure','sendMail','List\x20not\x20found','subject','attach','out','YYYY-MM-DD\x20HH:mm:ss','messageId','Interaction','Messages','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','userMailAccount:save','removeAgents','emit','userMailAccount:remove','getAgents','zip-dir','request-promise','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','html-to-text','juice','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./mailAccount.socket','jayson/promise','client','http','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','status','offset','undefined','limit','count','set','json','reject','save','update','destroy','then','get','name'];(function(_0xb912db,_0x5dfdcb){var _0x2aebc2=function(_0x3e2af7){while(--_0x3e2af7){_0xb912db['push'](_0xb912db['shift']());}};_0x2aebc2(++_0x5dfdcb);}(_0xd879,0x14a));var _0x9d87=function(_0x562005,_0x265854){_0x562005=_0x562005-0x0;var _0x49ae99=_0xd879[_0x562005];return _0x49ae99;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9d87('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9d87('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9d87('0x2'));var util=require(_0x9d87('0x3'));var path=require(_0x9d87('0x4'));var sox=require('sox');var csv=require(_0x9d87('0x5'));var ejs=require(_0x9d87('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9d87('0x7'));var squel=require(_0x9d87('0x8'));var crypto=require(_0x9d87('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x9d87('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9d87('0xb'));var htmlToText=require(_0x9d87('0xc'));var juice=require(_0x9d87('0xd'));var Redis=require('ioredis');var authService=require(_0x9d87('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x9d87('0xf'));var hardwareService=require(_0x9d87('0x10'));var logger=require(_0x9d87('0x11'))(_0x9d87('0x12'));var utils=require(_0x9d87('0x13'));var config=require(_0x9d87('0x14'));var licenseUtil=require(_0x9d87('0x15'));var db=require('../../mysqldb')['db'];config[_0x9d87('0x16')]=_[_0x9d87('0x17')](config[_0x9d87('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x9d87('0x18'))(new Redis(config['redis']));require(_0x9d87('0x19'))['register'](socket);var jayson=require(_0x9d87('0x1a'));var client=jayson[_0x9d87('0x1b')][_0x9d87('0x1c')]({'port':0x232b});function respondWithRpcPromise(_0x42e891,_0x4a18f2,_0x249282,_0x247f3b){return new BPromise(function(_0x2c57c2,_0x33b527){var _0x21c20c=_0x247f3b||client;return _0x21c20c['request'](_0x42e891,_0x249282)['then'](function(_0x150aac){logger[_0x9d87('0x1d')](_0x9d87('0x1e'),_0x4a18f2,_0x9d87('0x1f'));logger['debug'](_0x9d87('0x20'),_0x4a18f2,_0x9d87('0x1f'),JSON[_0x9d87('0x21')](_0x150aac));if(_0x150aac[_0x9d87('0x22')]){if(_0x150aac['error']['code']===0x1f4){logger['error'](_0x9d87('0x1e'),_0x4a18f2,_0x150aac[_0x9d87('0x22')][_0x9d87('0x23')]);return _0x33b527(_0x150aac[_0x9d87('0x22')][_0x9d87('0x23')]);}logger[_0x9d87('0x22')](_0x9d87('0x1e'),_0x4a18f2,_0x150aac['error'][_0x9d87('0x23')]);return _0x2c57c2(_0x150aac[_0x9d87('0x22')]['message']);}else{logger[_0x9d87('0x1d')]('MailAccount,\x20%s,\x20%s',_0x4a18f2,'request\x20sent');_0x2c57c2(_0x150aac[_0x9d87('0x24')][_0x9d87('0x23')]);}})[_0x9d87('0x25')](function(_0x520652){logger[_0x9d87('0x22')]('MailAccount,\x20%s,\x20%s',_0x4a18f2,_0x520652);_0x33b527(_0x520652);});});}function respondWithStatusCode(_0x1eab35,_0x1379ec){_0x1379ec=_0x1379ec||0xcc;return function(_0x2271fc){if(_0x2271fc){return _0x1eab35[_0x9d87('0x26')](_0x1379ec);}return _0x1eab35['status'](_0x1379ec)[_0x9d87('0x27')]();};}function respondWithResult(_0x9254d3,_0x433bc0){_0x433bc0=_0x433bc0||0xc8;return function(_0x65cd4d){if(_0x65cd4d){return _0x9254d3[_0x9d87('0x28')](_0x433bc0)['json'](_0x65cd4d);}};}function respondWithFilteredResult(_0x1d27a3,_0x3bdb6a){return function(_0x102d57){if(_0x102d57){var _0x4d1bc5=typeof _0x3bdb6a[_0x9d87('0x29')]===_0x9d87('0x2a')&&typeof _0x3bdb6a[_0x9d87('0x2b')]===_0x9d87('0x2a');var _0x5de196=_0x102d57[_0x9d87('0x2c')];var _0x5cf9ca=_0x4d1bc5?0x0:_0x3bdb6a[_0x9d87('0x29')];var _0x4387a9=_0x4d1bc5?_0x102d57[_0x9d87('0x2c')]:_0x3bdb6a[_0x9d87('0x29')]+_0x3bdb6a['limit'];var _0x6baae9;if(_0x4387a9>=_0x5de196){_0x4387a9=_0x5de196;_0x6baae9=0xc8;}else{_0x6baae9=0xce;}_0x1d27a3[_0x9d87('0x28')](_0x6baae9);return _0x1d27a3[_0x9d87('0x2d')]('Content-Range',_0x5cf9ca+'-'+_0x4387a9+'/'+_0x5de196)[_0x9d87('0x2e')](_0x102d57);}return null;};}function patchUpdates(_0x3e90f3){return function(_0x1b4f66){try{jsonpatch['apply'](_0x1b4f66,_0x3e90f3,!![]);}catch(_0xa1698){return BPromise[_0x9d87('0x2f')](_0xa1698);}return _0x1b4f66[_0x9d87('0x30')]();};}function saveUpdates(_0x552537,_0x51badf){return function(_0x22a3c0){if(_0x22a3c0){return _0x22a3c0[_0x9d87('0x31')](_0x552537)['then'](function(_0x51f4bb){return _0x51f4bb;});}return null;};}function removeEntity(_0x5bf400,_0x46d39d){return function(_0x2a3874){if(_0x2a3874){return _0x2a3874[_0x9d87('0x32')]()[_0x9d87('0x33')](function(){var _0x1cd6b0=_0x2a3874[_0x9d87('0x34')]({'plain':!![]});var _0x59aeb5='MailAccounts';return db['UserProfileResource']['destroy']({'where':{'type':_0x59aeb5,'resourceId':_0x1cd6b0['id']}})[_0x9d87('0x33')](function(){return _0x2a3874;});})[_0x9d87('0x33')](function(){_0x5bf400['status'](0xcc)[_0x9d87('0x27')]();});}};}function handleEntityNotFound(_0x5154e7,_0x910b39){return function(_0x1dadfa){if(!_0x1dadfa){_0x5154e7['sendStatus'](0x194);}return _0x1dadfa;};}function handleError(_0x128b93,_0x3979a7){_0x3979a7=_0x3979a7||0x1f4;return function(_0x425b57){logger[_0x9d87('0x22')](_0x425b57['stack']);if(_0x425b57['name']){delete _0x425b57[_0x9d87('0x35')];}_0x128b93[_0x9d87('0x28')](_0x3979a7)['send'](_0x425b57);};}exports[_0x9d87('0x36')]=function(_0x1715ef,_0x1c773d){var _0x58fbbe={'include':[{'model':db[_0x9d87('0x37')],'as':_0x9d87('0x38')},{'model':db['MailServerOut'],'as':_0x9d87('0x39')},{'model':db[_0x9d87('0x3a')],'as':_0x9d87('0x3b')}]},_0x403d08={},_0x39ef82={'count':0x0,'rows':[]};var _0x2f287e=_[_0x9d87('0x3c')](db['MailAccount'][_0x9d87('0x3d')],function(_0x21c759){return{'name':_0x21c759[_0x9d87('0x3e')],'type':_0x21c759[_0x9d87('0x3f')][_0x9d87('0x40')]};});_0x403d08['model']=_['map'](_0x2f287e,_0x9d87('0x35'));_0x403d08[_0x9d87('0x41')]=_[_0x9d87('0x42')](_0x1715ef[_0x9d87('0x41')]);_0x403d08[_0x9d87('0x43')]=_['intersection'](_0x403d08[_0x9d87('0x44')],_0x403d08[_0x9d87('0x41')]);_0x58fbbe['attributes']=_['intersection'](_0x403d08[_0x9d87('0x44')],qs[_0x9d87('0x45')](_0x1715ef[_0x9d87('0x41')][_0x9d87('0x45')]));_0x58fbbe['attributes']=_0x58fbbe['attributes'][_0x9d87('0x46')]?_0x58fbbe['attributes']:_0x403d08[_0x9d87('0x44')];if(!_0x1715ef[_0x9d87('0x41')][_0x9d87('0x47')](_0x9d87('0x48'))){_0x58fbbe[_0x9d87('0x2b')]=qs[_0x9d87('0x2b')](_0x1715ef[_0x9d87('0x41')]['limit']);_0x58fbbe[_0x9d87('0x29')]=qs['offset'](_0x1715ef['query'][_0x9d87('0x29')]);}_0x58fbbe[_0x9d87('0x49')]=qs[_0x9d87('0x4a')](_0x1715ef['query'][_0x9d87('0x4a')]);_0x58fbbe[_0x9d87('0x4b')]=qs['filters'](_[_0x9d87('0x4c')](_0x1715ef[_0x9d87('0x41')],_0x403d08['filters']),_0x2f287e);if(_0x1715ef[_0x9d87('0x41')]['filter']){_0x58fbbe[_0x9d87('0x4b')]=_['merge'](_0x58fbbe[_0x9d87('0x4b')],{'$or':_['map'](_0x2f287e,function(_0x2fcf88){if(_0x2fcf88['type']!==_0x9d87('0x4d')){var _0x11c8a3={};_0x11c8a3[_0x2fcf88['name']]={'$like':'%'+_0x1715ef[_0x9d87('0x41')][_0x9d87('0x4e')]+'%'};return _0x11c8a3;}})});}_0x58fbbe=_[_0x9d87('0x4f')]({},_0x58fbbe,_0x1715ef[_0x9d87('0x50')]);var _0x4ca658={'where':_0x58fbbe['where']};return db[_0x9d87('0x51')]['count'](_0x4ca658)['then'](function(_0x477452){_0x39ef82['count']=_0x477452;if(_0x1715ef[_0x9d87('0x41')][_0x9d87('0x52')]){_0x58fbbe['include']=[{'all':!![]}];}return db[_0x9d87('0x51')][_0x9d87('0x53')](_0x58fbbe);})[_0x9d87('0x33')](function(_0x1028c2){_0x39ef82[_0x9d87('0x54')]=_0x1028c2;return _0x39ef82;})['then'](respondWithFilteredResult(_0x1c773d,_0x58fbbe))[_0x9d87('0x25')](handleError(_0x1c773d,null));};exports['show']=function(_0x39def5,_0x164f7b){var _0x1a8d43={'raw':![],'where':{'id':_0x39def5['params']['id']},'include':[{'model':db[_0x9d87('0x37')],'as':'Imap'},{'model':db[_0x9d87('0x55')],'as':'Smtp'},{'model':db[_0x9d87('0x3a')],'as':_0x9d87('0x3b')}]},_0x5810cc={};_0x5810cc['model']=_[_0x9d87('0x42')](db[_0x9d87('0x51')][_0x9d87('0x3d')]);_0x5810cc[_0x9d87('0x41')]=_[_0x9d87('0x42')](_0x39def5[_0x9d87('0x41')]);_0x5810cc[_0x9d87('0x43')]=_['intersection'](_0x5810cc['model'],_0x5810cc[_0x9d87('0x41')]);_0x1a8d43['attributes']=_[_0x9d87('0x56')](_0x5810cc[_0x9d87('0x44')],qs[_0x9d87('0x45')](_0x39def5['query'][_0x9d87('0x45')]));_0x1a8d43['attributes']=_0x1a8d43['attributes'][_0x9d87('0x46')]?_0x1a8d43['attributes']:_0x5810cc[_0x9d87('0x44')];if(_0x39def5['query']['includeAll']){_0x1a8d43[_0x9d87('0x57')]=[{'all':!![]}];}_0x1a8d43=_['merge']({},_0x1a8d43,_0x39def5[_0x9d87('0x50')]);return db[_0x9d87('0x51')][_0x9d87('0x58')](_0x1a8d43)[_0x9d87('0x33')](handleEntityNotFound(_0x164f7b,null))[_0x9d87('0x33')](respondWithResult(_0x164f7b,null))[_0x9d87('0x25')](handleError(_0x164f7b,null));};exports[_0x9d87('0x31')]=function(_0x47f963,_0x423114){if(_0x47f963[_0x9d87('0x59')]['id']){delete _0x47f963[_0x9d87('0x59')]['id'];}return db[_0x9d87('0x51')]['find']({'where':{'id':_0x47f963[_0x9d87('0x5a')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x9d87('0x38')},{'model':db[_0x9d87('0x55')],'as':_0x9d87('0x39')},{'model':db[_0x9d87('0x3a')],'as':'mandatoryDispositionPause'}]})[_0x9d87('0x33')](handleEntityNotFound(_0x423114,null))[_0x9d87('0x33')](saveUpdates(_0x47f963[_0x9d87('0x59')],null))[_0x9d87('0x33')](function(_0x1cb257){if(_0x1cb257&&_0x47f963[_0x9d87('0x59')][_0x9d87('0x38')]){return db['MailServerIn']['update'](_0x47f963[_0x9d87('0x59')][_0x9d87('0x38')],{'where':{'MailAccountId':_0x1cb257['id']}})['then'](function(){return _0x1cb257;});}return _0x1cb257;})[_0x9d87('0x33')](function(_0x2d8f85){if(_0x2d8f85&&_0x47f963[_0x9d87('0x59')]['Smtp']){return db['MailServerOut'][_0x9d87('0x31')](_0x47f963[_0x9d87('0x59')]['Smtp'],{'where':{'MailAccountId':_0x2d8f85['id']}})[_0x9d87('0x33')](function(){return _0x2d8f85;});}return _0x2d8f85;})['then'](respondWithResult(_0x423114,null))[_0x9d87('0x25')](handleError(_0x423114,null));};exports[_0x9d87('0x5b')]=function(_0x3d9390,_0x58c326){return db[_0x9d87('0x51')][_0x9d87('0x5b')]()[_0x9d87('0x33')](respondWithResult(_0x58c326,null))[_0x9d87('0x25')](handleError(_0x58c326,null));};exports[_0x9d87('0x5c')]=function(_0x2375ed,_0x46818c,_0x4f6b0c){if(_0x2375ed[_0x9d87('0x59')]['id']){delete _0x2375ed[_0x9d87('0x59')]['id'];}return db['MailAccount'][_0x9d87('0x58')]({'where':{'id':_0x2375ed[_0x9d87('0x5a')]['id']}})[_0x9d87('0x33')](handleEntityNotFound(_0x46818c,null))[_0x9d87('0x33')](function(_0x21bdbb){if(_0x21bdbb){_0x2375ed[_0x9d87('0x59')][_0x9d87('0x5d')]=_0x21bdbb['id'];return db[_0x9d87('0x5e')][_0x9d87('0x5f')](_0x2375ed[_0x9d87('0x59')]);}})[_0x9d87('0x33')](respondWithResult(_0x46818c,null))[_0x9d87('0x25')](handleError(_0x46818c,null));};exports[_0x9d87('0x60')]=function(_0x31faf8,_0x2bb1ff,_0x2af785){var _0x2c67c8={'raw':![],'where':{}};var _0x5ce857={};var _0x573811={'count':0x0,'rows':[]};return db[_0x9d87('0x51')][_0x9d87('0x61')]({'where':{'id':_0x31faf8['params']['id']}})['then'](handleEntityNotFound(_0x2bb1ff,null))[_0x9d87('0x33')](function(_0x1481e8){if(_0x1481e8){_0x5ce857['model']=_[_0x9d87('0x42')](db[_0x9d87('0x5e')][_0x9d87('0x3d')]);_0x5ce857[_0x9d87('0x41')]=_[_0x9d87('0x42')](_0x31faf8[_0x9d87('0x41')]);_0x5ce857[_0x9d87('0x43')]=_[_0x9d87('0x56')](_0x5ce857[_0x9d87('0x44')],_0x5ce857[_0x9d87('0x41')]);_0x2c67c8['attributes']=_[_0x9d87('0x56')](_0x5ce857[_0x9d87('0x44')],qs[_0x9d87('0x45')](_0x31faf8[_0x9d87('0x41')][_0x9d87('0x45')]));_0x2c67c8[_0x9d87('0x62')]=_0x2c67c8[_0x9d87('0x62')]['length']?_0x2c67c8[_0x9d87('0x62')]:_0x5ce857['model'];if(!_0x31faf8[_0x9d87('0x41')][_0x9d87('0x47')](_0x9d87('0x48'))){_0x2c67c8['limit']=qs['limit'](_0x31faf8['query'][_0x9d87('0x2b')]);_0x2c67c8[_0x9d87('0x29')]=qs[_0x9d87('0x29')](_0x31faf8[_0x9d87('0x41')][_0x9d87('0x29')]);}_0x2c67c8['order']=qs[_0x9d87('0x4a')](_0x31faf8[_0x9d87('0x41')]['sort']);_0x2c67c8[_0x9d87('0x4b')]=qs[_0x9d87('0x43')](_['pick'](_0x31faf8['query'],_0x5ce857[_0x9d87('0x43')]));_0x2c67c8['where']['MailAccountId']=_0x1481e8['id'];if(_0x31faf8['query'][_0x9d87('0x4e')]){_0x2c67c8['where']=_[_0x9d87('0x4f')](_0x2c67c8[_0x9d87('0x4b')],{'$or':_[_0x9d87('0x3c')](_0x2c67c8[_0x9d87('0x62')],function(_0x1beba5){var _0x3daeb0={};_0x3daeb0[_0x1beba5]={'$like':'%'+_0x31faf8['query']['filter']+'%'};return _0x3daeb0;})});}_0x2c67c8=_['merge']({},_0x2c67c8,_0x31faf8[_0x9d87('0x50')]);return db[_0x9d87('0x5e')]['count']({'where':_0x2c67c8[_0x9d87('0x4b')]})['then'](function(_0x43f952){_0x573811[_0x9d87('0x2c')]=_0x43f952;if(_0x31faf8['query'][_0x9d87('0x52')]){_0x2c67c8[_0x9d87('0x57')]=[{'all':!![]}];}return db[_0x9d87('0x5e')][_0x9d87('0x53')](_0x2c67c8);})[_0x9d87('0x33')](function(_0x147789){_0x573811['rows']=_0x147789;return _0x573811;});}})[_0x9d87('0x33')](respondWithFilteredResult(_0x2bb1ff,_0x2c67c8))[_0x9d87('0x25')](handleError(_0x2bb1ff,null));};exports[_0x9d87('0x63')]=function(_0x426e7,_0x4d8ad4,_0x52e79a){return db[_0x9d87('0x51')][_0x9d87('0x58')]({'where':{'id':_0x426e7[_0x9d87('0x5a')]['id']}})[_0x9d87('0x33')](handleEntityNotFound(_0x4d8ad4,null))['then'](function(_0x44c491){if(_0x44c491){return _0x44c491[_0x9d87('0x63')](_0x426e7['query'][_0x9d87('0x64')]);}})[_0x9d87('0x33')](respondWithStatusCode(_0x4d8ad4,null))[_0x9d87('0x25')](handleError(_0x4d8ad4,null));};exports['addAnswer']=function(_0xbcf950,_0x9eff64,_0x32f5b6){if(_0xbcf950[_0x9d87('0x59')]['id']){delete _0xbcf950[_0x9d87('0x59')]['id'];}return db['MailAccount'][_0x9d87('0x58')]({'where':{'id':_0xbcf950['params']['id']}})[_0x9d87('0x33')](handleEntityNotFound(_0x9eff64,null))[_0x9d87('0x33')](function(_0x583702){if(_0x583702){_0xbcf950[_0x9d87('0x59')]['MailAccountId']=_0x583702['id'];return db[_0x9d87('0x65')][_0x9d87('0x5f')](_0xbcf950['body']);}})[_0x9d87('0x33')](respondWithResult(_0x9eff64,null))[_0x9d87('0x25')](handleError(_0x9eff64,null));};exports[_0x9d87('0x66')]=function(_0x60368c,_0x14cf52,_0x34f70f){var _0x3512f2={'raw':![],'where':{}};var _0x574a29={};var _0x36228f={'count':0x0,'rows':[]};return db[_0x9d87('0x51')][_0x9d87('0x61')]({'where':{'id':_0x60368c[_0x9d87('0x5a')]['id']}})[_0x9d87('0x33')](handleEntityNotFound(_0x14cf52,null))['then'](function(_0xcb3f51){if(_0xcb3f51){_0x574a29[_0x9d87('0x44')]=_[_0x9d87('0x42')](db['CannedAnswer'][_0x9d87('0x3d')]);_0x574a29[_0x9d87('0x41')]=_[_0x9d87('0x42')](_0x60368c[_0x9d87('0x41')]);_0x574a29[_0x9d87('0x43')]=_[_0x9d87('0x56')](_0x574a29[_0x9d87('0x44')],_0x574a29[_0x9d87('0x41')]);_0x3512f2[_0x9d87('0x62')]=_[_0x9d87('0x56')](_0x574a29[_0x9d87('0x44')],qs[_0x9d87('0x45')](_0x60368c[_0x9d87('0x41')]['fields']));_0x3512f2[_0x9d87('0x62')]=_0x3512f2[_0x9d87('0x62')][_0x9d87('0x46')]?_0x3512f2[_0x9d87('0x62')]:_0x574a29[_0x9d87('0x44')];if(!_0x60368c[_0x9d87('0x41')][_0x9d87('0x47')]('nolimit')){_0x3512f2[_0x9d87('0x2b')]=qs[_0x9d87('0x2b')](_0x60368c[_0x9d87('0x41')][_0x9d87('0x2b')]);_0x3512f2[_0x9d87('0x29')]=qs[_0x9d87('0x29')](_0x60368c['query'][_0x9d87('0x29')]);}_0x3512f2[_0x9d87('0x49')]=qs[_0x9d87('0x4a')](_0x60368c[_0x9d87('0x41')][_0x9d87('0x4a')]);_0x3512f2['where']=qs['filters'](_['pick'](_0x60368c[_0x9d87('0x41')],_0x574a29[_0x9d87('0x43')]));_0x3512f2[_0x9d87('0x4b')][_0x9d87('0x5d')]=_0xcb3f51['id'];if(_0x60368c['query'][_0x9d87('0x4e')]){_0x3512f2[_0x9d87('0x4b')]=_['merge'](_0x3512f2[_0x9d87('0x4b')],{'$or':_[_0x9d87('0x3c')](_0x3512f2[_0x9d87('0x62')],function(_0x7bf1a0){var _0x46a939={};_0x46a939[_0x7bf1a0]={'$like':'%'+_0x60368c[_0x9d87('0x41')][_0x9d87('0x4e')]+'%'};return _0x46a939;})});}_0x3512f2=_['merge']({},_0x3512f2,_0x60368c[_0x9d87('0x50')]);return db[_0x9d87('0x65')]['count']({'where':_0x3512f2[_0x9d87('0x4b')]})[_0x9d87('0x33')](function(_0x41ec20){_0x36228f[_0x9d87('0x2c')]=_0x41ec20;if(_0x60368c[_0x9d87('0x41')]['includeAll']){_0x3512f2[_0x9d87('0x57')]=[{'all':!![]}];}return db[_0x9d87('0x65')][_0x9d87('0x53')](_0x3512f2);})[_0x9d87('0x33')](function(_0x4779d2){_0x36228f['rows']=_0x4779d2;return _0x36228f;});}})[_0x9d87('0x33')](respondWithFilteredResult(_0x14cf52,_0x3512f2))[_0x9d87('0x25')](handleError(_0x14cf52,null));};exports['removeAnswers']=function(_0x2473ea,_0x4541aa,_0x7eac12){return db[_0x9d87('0x51')]['find']({'where':{'id':_0x2473ea[_0x9d87('0x5a')]['id']}})[_0x9d87('0x33')](handleEntityNotFound(_0x4541aa,null))['then'](function(_0x134382){if(_0x134382){return _0x134382['removeAnswers'](_0x2473ea['query'][_0x9d87('0x64')]);}})[_0x9d87('0x33')](respondWithStatusCode(_0x4541aa,null))[_0x9d87('0x25')](handleError(_0x4541aa,null));};exports['create']=function(_0x288773,_0x7e931a){var _0x5e6f1d={'name':_0x288773[_0x9d87('0x59')][_0x9d87('0x35')],'key':_0x288773[_0x9d87('0x59')][_0x9d87('0x40')],'email':_0x288773[_0x9d87('0x59')][_0x9d87('0x67')],'ListId':_0x288773['body'][_0x9d87('0x68')],'active':!_[_0x9d87('0x69')](_0x288773['body'][_0x9d87('0x6a')])?_0x288773['body']['active']:!![],'description':_0x288773['body'][_0x9d87('0x6b')]||null,'Imap':{},'Smtp':{}};if(_[_0x9d87('0x69')](_0x288773[_0x9d87('0x59')]['cservice'])){if(_0x288773[_0x9d87('0x59')][_0x9d87('0x6c')]){_0x5e6f1d[_0x9d87('0x38')][_0x9d87('0x6d')]=_0x5e6f1d[_0x9d87('0x39')][_0x9d87('0x6d')]=_0x288773[_0x9d87('0x59')][_0x9d87('0x6e')];_0x5e6f1d['Imap'][_0x9d87('0x6f')]=_0x5e6f1d[_0x9d87('0x39')][_0x9d87('0x70')]=_0x288773[_0x9d87('0x59')][_0x9d87('0x71')];}else{_0x5e6f1d[_0x9d87('0x38')][_0x9d87('0x72')]=_0x5e6f1d['Smtp'][_0x9d87('0x72')]=![];}_0x5e6f1d[_0x9d87('0x38')]['host']=_0x288773[_0x9d87('0x59')][_0x9d87('0x38')][_0x9d87('0x73')];_0x5e6f1d[_0x9d87('0x38')][_0x9d87('0x74')]=_0x288773['body'][_0x9d87('0x38')]['port'];_0x5e6f1d[_0x9d87('0x39')][_0x9d87('0x73')]=_0x288773[_0x9d87('0x59')]['Smtp'][_0x9d87('0x73')];_0x5e6f1d[_0x9d87('0x39')]['port']=_0x288773[_0x9d87('0x59')][_0x9d87('0x39')][_0x9d87('0x74')];}else{_0x5e6f1d[_0x9d87('0x38')]['service']=_0x5e6f1d[_0x9d87('0x39')][_0x9d87('0x75')]=_0x288773[_0x9d87('0x59')][_0x9d87('0x76')];_0x5e6f1d[_0x9d87('0x38')][_0x9d87('0x6d')]=_0x5e6f1d[_0x9d87('0x39')][_0x9d87('0x6d')]=_0x288773[_0x9d87('0x59')][_0x9d87('0x6e')];_0x5e6f1d[_0x9d87('0x38')][_0x9d87('0x6f')]=_0x5e6f1d[_0x9d87('0x39')][_0x9d87('0x70')]=_0x288773[_0x9d87('0x59')][_0x9d87('0x71')];}return db[_0x9d87('0x51')][_0x9d87('0x5f')](_0x5e6f1d,{'include':[{'model':db[_0x9d87('0x55')],'as':_0x9d87('0x39')},{'model':db[_0x9d87('0x37')],'as':_0x9d87('0x38')}]})[_0x9d87('0x33')](function(_0x7a65a4){var _0x2dbdbe=_0x288773[_0x9d87('0x6d')][_0x9d87('0x34')]({'plain':!![]});if(!_0x2dbdbe)throw new Error(_0x9d87('0x77'));if(_0x2dbdbe[_0x9d87('0x78')]==='user'){var _0x5babc5=_0x7a65a4[_0x9d87('0x34')]({'plain':!![]});return db[_0x9d87('0x79')][_0x9d87('0x58')]({'where':{'name':_0x9d87('0x7a'),'userProfileId':_0x2dbdbe[_0x9d87('0x7b')]},'raw':!![]})['then'](function(_0x350048){if(_0x350048&&_0x350048[_0x9d87('0x7c')]===0x0){return db['UserProfileResource']['create']({'name':_0x5babc5[_0x9d87('0x35')],'resourceId':_0x5babc5['id'],'type':_0x350048[_0x9d87('0x35')],'sectionId':_0x350048['id']},{})[_0x9d87('0x33')](function(){return _0x7a65a4;});}else{return _0x7a65a4;}})[_0x9d87('0x25')](function(_0x25bf28){logger[_0x9d87('0x22')](_0x9d87('0x7d'),_0x25bf28);throw _0x25bf28;});}return _0x7a65a4;})[_0x9d87('0x33')](respondWithResult(_0x7e931a,0xc9))[_0x9d87('0x25')](handleError(_0x7e931a,null));};exports[_0x9d87('0x7e')]=function(_0x472599,_0x200929,_0x48bf34){return db[_0x9d87('0x51')][_0x9d87('0x61')]({'where':{'id':_0x472599[_0x9d87('0x5a')]['id']}})[_0x9d87('0x33')](handleEntityNotFound(_0x200929,null))[_0x9d87('0x33')](function(_0x1923e3){if(_0x1923e3){return _0x1923e3['getImap']();}return null;})[_0x9d87('0x33')](respondWithResult(_0x200929,null))[_0x9d87('0x25')](handleError(_0x200929,null));};exports[_0x9d87('0x7f')]=function(_0x41bbe0,_0x3ddab8,_0x262e84){if(_0x41bbe0['body']['id']){delete _0x41bbe0[_0x9d87('0x59')]['id'];}return db[_0x9d87('0x51')]['find']({'where':{'id':_0x41bbe0[_0x9d87('0x5a')]['id']}})[_0x9d87('0x33')](handleEntityNotFound(_0x3ddab8,null))['then'](function(_0x9e1e89){if(_0x9e1e89){_0x41bbe0['body']['MailAccountId']=_0x9e1e89['id'];return db[_0x9d87('0x37')][_0x9d87('0x5f')](_0x41bbe0[_0x9d87('0x59')]);}})['then'](respondWithResult(_0x3ddab8,null))[_0x9d87('0x25')](handleError(_0x3ddab8,null));};exports[_0x9d87('0x80')]=function(_0x4a4b63,_0x19d9b1,_0x2125e3){return db[_0x9d87('0x51')][_0x9d87('0x61')]({'where':{'id':_0x4a4b63[_0x9d87('0x5a')]['id']}})[_0x9d87('0x33')](handleEntityNotFound(_0x19d9b1,null))[_0x9d87('0x33')](function(_0x3d1cfb){if(_0x3d1cfb){return _0x3d1cfb['setImap'](null);}return null;})['then'](respondWithStatusCode(_0x19d9b1,null))[_0x9d87('0x25')](handleError(_0x19d9b1,null));};exports[_0x9d87('0x81')]=function(_0x40486f,_0x5aa82b,_0x345f68){return db[_0x9d87('0x51')][_0x9d87('0x61')]({'where':{'id':_0x40486f['params']['id']}})[_0x9d87('0x33')](handleEntityNotFound(_0x5aa82b,null))[_0x9d87('0x33')](function(_0x17e0b1){if(_0x17e0b1){return _0x17e0b1['getSmtp']();}return null;})[_0x9d87('0x33')](respondWithResult(_0x5aa82b,null))[_0x9d87('0x25')](handleError(_0x5aa82b,null));};exports[_0x9d87('0x82')]=function(_0x159529,_0x25a030,_0x5b6937){if(_0x159529['body']['id']){delete _0x159529[_0x9d87('0x59')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x159529[_0x9d87('0x5a')]['id']}})[_0x9d87('0x33')](handleEntityNotFound(_0x25a030,null))['then'](function(_0x47be07){if(_0x47be07){_0x159529[_0x9d87('0x59')][_0x9d87('0x5d')]=_0x47be07['id'];return db[_0x9d87('0x55')]['create'](_0x159529['body']);}})[_0x9d87('0x33')](respondWithResult(_0x25a030,null))[_0x9d87('0x25')](handleError(_0x25a030,null));};exports[_0x9d87('0x83')]=function(_0x2b4cd0,_0x513922,_0x3caee8){return db[_0x9d87('0x51')]['findOne']({'where':{'id':_0x2b4cd0[_0x9d87('0x5a')]['id']}})[_0x9d87('0x33')](handleEntityNotFound(_0x513922,null))[_0x9d87('0x33')](function(_0x361af3){if(_0x361af3){return _0x361af3[_0x9d87('0x84')](null);}return null;})[_0x9d87('0x33')](respondWithStatusCode(_0x513922,null))[_0x9d87('0x25')](handleError(_0x513922,null));};exports[_0x9d87('0x85')]=function(_0x3d1881,_0x4786a1,_0x440211){return db[_0x9d87('0x86')][_0x9d87('0x58')]({'where':{'id':_0x3d1881['params']['id']}})[_0x9d87('0x33')](handleEntityNotFound(_0x4786a1,null))[_0x9d87('0x33')](function(_0x21594b){if(_0x21594b){return _0x21594b['addInteraction'](_0x3d1881['body'][_0x9d87('0x64')],_[_0x9d87('0x87')](_0x3d1881[_0x9d87('0x59')],[_0x9d87('0x64'),'id'])||{});}})[_0x9d87('0x33')](respondWithResult(_0x4786a1,null))['catch'](handleError(_0x4786a1,null));};exports[_0x9d87('0x88')]=function(_0x1c8e1f,_0x4ada22,_0x15d724){var _0x17bf52={'raw':![],'where':{}};var _0x225af5={};var _0x24374b={'count':0x0,'rows':[]};return db[_0x9d87('0x51')]['findOne']({'where':{'id':_0x1c8e1f['params']['id']}})['then'](handleEntityNotFound(_0x4ada22,null))['then'](function(_0x2cb022){if(_0x2cb022){_0x225af5['model']=_[_0x9d87('0x42')](db['MailInteraction']['rawAttributes']);_0x225af5[_0x9d87('0x41')]=_[_0x9d87('0x42')](_0x1c8e1f[_0x9d87('0x41')]);_0x225af5[_0x9d87('0x43')]=_[_0x9d87('0x56')](_0x225af5[_0x9d87('0x44')],_0x225af5[_0x9d87('0x41')]);_0x17bf52[_0x9d87('0x62')]=_[_0x9d87('0x56')](_0x225af5[_0x9d87('0x44')],qs[_0x9d87('0x45')](_0x1c8e1f['query'][_0x9d87('0x45')]));_0x17bf52[_0x9d87('0x62')]=_0x17bf52[_0x9d87('0x62')][_0x9d87('0x46')]?_0x17bf52['attributes']:_0x225af5[_0x9d87('0x44')];if(!_0x1c8e1f[_0x9d87('0x41')][_0x9d87('0x47')]('nolimit')){_0x17bf52[_0x9d87('0x2b')]=qs[_0x9d87('0x2b')](_0x1c8e1f['query'][_0x9d87('0x2b')]);_0x17bf52[_0x9d87('0x29')]=qs['offset'](_0x1c8e1f[_0x9d87('0x41')]['offset']);}_0x17bf52[_0x9d87('0x49')]=qs[_0x9d87('0x4a')](_0x1c8e1f[_0x9d87('0x41')][_0x9d87('0x4a')]);_0x17bf52[_0x9d87('0x4b')]=qs[_0x9d87('0x43')](_[_0x9d87('0x4c')](_0x1c8e1f['query'],_0x225af5[_0x9d87('0x43')]));_0x17bf52['where'][_0x9d87('0x5d')]=_0x2cb022['id'];if(_0x1c8e1f['query']['filter']){_0x17bf52[_0x9d87('0x4b')]=_['merge'](_0x17bf52['where'],{'$or':_[_0x9d87('0x3c')](_0x17bf52[_0x9d87('0x62')],function(_0x249157){var _0x4f8235={};_0x4f8235[_0x249157]={'$like':'%'+_0x1c8e1f[_0x9d87('0x41')]['filter']+'%'};return _0x4f8235;})});}_0x17bf52=_[_0x9d87('0x4f')]({},_0x17bf52,_0x1c8e1f[_0x9d87('0x50')]);return db['MailInteraction']['count']({'where':_0x17bf52[_0x9d87('0x4b')]})[_0x9d87('0x33')](function(_0x1298a2){_0x24374b[_0x9d87('0x2c')]=_0x1298a2;if(_0x1c8e1f[_0x9d87('0x41')][_0x9d87('0x52')]){_0x17bf52[_0x9d87('0x57')]=[{'model':db[_0x9d87('0x89')],'as':_0x9d87('0x8a'),'required':![]},{'model':db[_0x9d87('0x8b')],'as':_0x9d87('0x8c'),'attributes':[_0x9d87('0x35'),_0x9d87('0x8d'),_0x9d87('0x8e')],'required':![]},{'model':db[_0x9d87('0x8f')],'as':_0x9d87('0x90'),'attributes':['id',_0x9d87('0x35'),_0x9d87('0x91')],'where':_0x1c8e1f[_0x9d87('0x41')][_0x9d87('0x92')]?{'id':_0x1c8e1f[_0x9d87('0x41')]['tag']}:undefined,'required':_0x1c8e1f[_0x9d87('0x41')][_0x9d87('0x92')]?!![]:![]}];}return db[_0x9d87('0x86')][_0x9d87('0x53')](_0x17bf52);})['then'](function(_0x41ab6a){_0x24374b['rows']=_0x41ab6a;return _0x24374b;});}})[_0x9d87('0x33')](respondWithFilteredResult(_0x4ada22,_0x17bf52))[_0x9d87('0x25')](handleError(_0x4ada22,null));};exports[_0x9d87('0x93')]=function(_0x4a11ba,_0x1dd6e3,_0x12a429){return db[_0x9d87('0x51')]['findOne']({'where':{'id':_0x4a11ba[_0x9d87('0x5a')]['id']}})[_0x9d87('0x33')](handleEntityNotFound(_0x1dd6e3,null))[_0x9d87('0x33')](function(_0x3b0861){if(_0x3b0861){return db[_0x9d87('0x94')][_0x9d87('0x95')](function(_0x232824){return db[_0x9d87('0x96')][_0x9d87('0x32')]({'where':{'MailAccountId':_0x4a11ba['params']['id']},'transaction':_0x232824})[_0x9d87('0x33')](function(_0x582c82){var _0x5d0e28=_[_0x9d87('0x3c')](_0x4a11ba[_0x9d87('0x59')],function(_0x435933){_0x435933[_0x9d87('0x5d')]=_0x4a11ba[_0x9d87('0x5a')]['id'];return _0x435933;});return db[_0x9d87('0x96')][_0x9d87('0x97')](_0x5d0e28,{'transaction':_0x232824});});})[_0x9d87('0x33')](function(){return db[_0x9d87('0x96')][_0x9d87('0x98')]({'where':{'MailAccountId':_0x4a11ba[_0x9d87('0x5a')]['id']},'order':_0x9d87('0x99')});});}})[_0x9d87('0x33')](respondWithResult(_0x1dd6e3,null))[_0x9d87('0x25')](handleError(_0x1dd6e3,null));};exports[_0x9d87('0x9a')]=function(_0x353a46,_0x123a1d,_0x8bdcf2){var _0x442520={};var _0x475412={};var _0x344db6;var _0x39d081;return db[_0x9d87('0x51')][_0x9d87('0x61')]({'where':{'id':_0x353a46[_0x9d87('0x5a')]['id']}})[_0x9d87('0x33')](handleEntityNotFound(_0x123a1d,null))['then'](function(_0x18beca){if(_0x18beca){_0x344db6=_0x18beca;_0x475412[_0x9d87('0x44')]=_[_0x9d87('0x42')](db['MailApplication']['rawAttributes']);_0x475412['query']=_[_0x9d87('0x42')](_0x353a46['query']);_0x475412['filters']=_[_0x9d87('0x56')](_0x475412[_0x9d87('0x44')],_0x475412[_0x9d87('0x41')]);_0x442520['attributes']=_[_0x9d87('0x56')](_0x475412[_0x9d87('0x44')],qs['fields'](_0x353a46[_0x9d87('0x41')][_0x9d87('0x45')]));_0x442520[_0x9d87('0x62')]=_0x442520[_0x9d87('0x62')][_0x9d87('0x46')]?_0x442520['attributes']:_0x475412[_0x9d87('0x44')];_0x442520['order']=qs['sort'](_0x353a46[_0x9d87('0x41')]['sort']);_0x442520[_0x9d87('0x4b')]=qs[_0x9d87('0x43')](_['pick'](_0x353a46['query'],_0x475412['filters']));if(_0x353a46[_0x9d87('0x41')][_0x9d87('0x4e')]){_0x442520[_0x9d87('0x4b')]=_['merge'](_0x442520['where'],{'$or':_['map'](_0x442520[_0x9d87('0x62')],function(_0x2326d1){var _0x33bad5={};_0x33bad5[_0x2326d1]={'$like':'%'+_0x353a46[_0x9d87('0x41')][_0x9d87('0x4e')]+'%'};return _0x33bad5;})});}_0x442520=_[_0x9d87('0x4f')]({},_0x442520,_0x353a46['options']);return _0x344db6[_0x9d87('0x9a')](_0x442520);}})[_0x9d87('0x33')](function(_0x22ef7b){if(_0x22ef7b){_0x39d081=_0x22ef7b[_0x9d87('0x46')];if(!_0x353a46[_0x9d87('0x41')][_0x9d87('0x47')](_0x9d87('0x48'))){_0x442520[_0x9d87('0x2b')]=qs[_0x9d87('0x2b')](_0x353a46[_0x9d87('0x41')][_0x9d87('0x2b')]);_0x442520[_0x9d87('0x29')]=qs[_0x9d87('0x29')](_0x353a46[_0x9d87('0x41')][_0x9d87('0x29')]);}return _0x344db6[_0x9d87('0x9a')](_0x442520);}})[_0x9d87('0x33')](function(_0x1d6bc1){if(_0x1d6bc1){return _0x1d6bc1?{'count':_0x39d081,'rows':_0x1d6bc1}:null;}})[_0x9d87('0x33')](respondWithResult(_0x123a1d,null))[_0x9d87('0x25')](handleError(_0x123a1d,null));};exports['getMessages']=function(_0x14b159,_0x4aff30,_0x59d310){var _0x321599={'raw':!![],'where':{}};var _0x490f7c={};var _0x22657e={'count':0x0,'rows':[]};return db[_0x9d87('0x51')]['findOne']({'where':{'id':_0x14b159[_0x9d87('0x5a')]['id']}})[_0x9d87('0x33')](handleEntityNotFound(_0x4aff30,null))[_0x9d87('0x33')](function(_0x14ea7c){if(_0x14ea7c){_0x490f7c['model']=_[_0x9d87('0x42')](db['MailMessage'][_0x9d87('0x3d')]);_0x490f7c[_0x9d87('0x41')]=_[_0x9d87('0x42')](_0x14b159['query']);_0x490f7c[_0x9d87('0x43')]=_[_0x9d87('0x56')](_0x490f7c[_0x9d87('0x44')],_0x490f7c[_0x9d87('0x41')]);_0x321599[_0x9d87('0x62')]=_[_0x9d87('0x56')](_0x490f7c[_0x9d87('0x44')],qs[_0x9d87('0x45')](_0x14b159['query'][_0x9d87('0x45')]));_0x321599['attributes']=_0x321599[_0x9d87('0x62')][_0x9d87('0x46')]?_0x321599[_0x9d87('0x62')]:_0x490f7c[_0x9d87('0x44')];if(!_0x14b159['query'][_0x9d87('0x47')](_0x9d87('0x48'))){_0x321599[_0x9d87('0x2b')]=qs[_0x9d87('0x2b')](_0x14b159[_0x9d87('0x41')][_0x9d87('0x2b')]);_0x321599[_0x9d87('0x29')]=qs['offset'](_0x14b159[_0x9d87('0x41')][_0x9d87('0x29')]);}_0x321599[_0x9d87('0x49')]=qs[_0x9d87('0x4a')](_0x14b159[_0x9d87('0x41')][_0x9d87('0x4a')]);_0x321599[_0x9d87('0x4b')]=qs['filters'](_[_0x9d87('0x4c')](_0x14b159[_0x9d87('0x41')],_0x490f7c[_0x9d87('0x43')]));_0x321599[_0x9d87('0x4b')][_0x9d87('0x5d')]=_0x14ea7c['id'];if(_0x14b159[_0x9d87('0x41')]['filter']){_0x321599['where']=_[_0x9d87('0x4f')](_0x321599['where'],{'$or':_[_0x9d87('0x3c')](_0x321599[_0x9d87('0x62')],function(_0x2cdb2d){var _0x4737fe={};_0x4737fe[_0x2cdb2d]={'$like':'%'+_0x14b159['query'][_0x9d87('0x4e')]+'%'};return _0x4737fe;})});}if(_0x14b159[_0x9d87('0x41')][_0x9d87('0x9b')]){var _0x3d79df=_0x14b159[_0x9d87('0x41')][_0x9d87('0x9b')][_0x9d87('0x9c')](',');var _0x4cbae0={};_0x4cbae0[_0x3d79df[0x0]]={'$gte':moment(_0x3d79df[0x1])[_0x9d87('0x9d')]('YYYY-MM-DD\x20HH:mm:ss')};_0x321599['where']=_[_0x9d87('0x4f')](_0x321599[_0x9d87('0x4b')],_0x4cbae0);}_0x321599=_['merge']({},_0x321599,_0x14b159[_0x9d87('0x50')]);return db[_0x9d87('0x9e')]['count']({'where':_0x321599[_0x9d87('0x4b')]})[_0x9d87('0x33')](function(_0x1b4b7b){_0x22657e[_0x9d87('0x2c')]=_0x1b4b7b;if(_0x14b159[_0x9d87('0x41')][_0x9d87('0x52')]){_0x321599[_0x9d87('0x57')]=[{'all':!![]}];}return db[_0x9d87('0x9e')]['findAll'](_0x321599);})[_0x9d87('0x33')](function(_0x161270){if(_0x14b159[_0x9d87('0x41')]['inlineCss']==='true'){for(var _0x53ffe5=0x0;_0x53ffe5<_0x161270[_0x9d87('0x46')];_0x53ffe5++){_0x161270[_0x53ffe5][_0x9d87('0x59')]=juice(_0x161270[_0x53ffe5][_0x9d87('0x59')]);}}_0x22657e[_0x9d87('0x54')]=_0x161270;return _0x22657e;});}})[_0x9d87('0x33')](respondWithFilteredResult(_0x4aff30,_0x321599))[_0x9d87('0x25')](handleError(_0x4aff30,null));};exports[_0x9d87('0x9f')]=function(_0x167f7e,_0x4a1acc,_0x2eb58a){var _0x355e58,_0x3b2b18={},_0x3ad3a4;if(_0x167f7e['body']['to']){_0x3ad3a4=_0x167f7e[_0x9d87('0x59')]['to'][_0x9d87('0x9c')](',')[0x0];}return db['MailAccount'][_0x9d87('0x58')]({'where':{'id':_0x167f7e[_0x9d87('0x5a')]['id']},'include':[{'model':db[_0x9d87('0xa0')],'as':_0x9d87('0xa1'),'include':[{'model':db[_0x9d87('0x89')],'as':_0x9d87('0xa2'),'where':{'email':_0x3ad3a4},'limit':0x1,'order':[['updatedAt',_0x9d87('0xa3')]]}]},{'model':db[_0x9d87('0x55')],'as':_0x9d87('0x39'),'raw':!![]}]})[_0x9d87('0x33')](handleEntityNotFound(_0x4a1acc,null))[_0x9d87('0x33')](function(_0x168e5c){if(_0x168e5c){_0x355e58=_0x168e5c;if(_0x168e5c['Smtp']){if(_['isNil'](_0x167f7e['body'][_0x9d87('0xa4')])){_0x167f7e['body'][_0x9d87('0xa4')]=util[_0x9d87('0x9d')]('%s\x20<%s>',_0x168e5c[_0x9d87('0x35')],_0x168e5c[_0x9d87('0x67')]||_0x168e5c[_0x9d87('0x39')]['user']);}if(_0x167f7e[_0x9d87('0x59')]['attachments']&&_0x167f7e['body'][_0x9d87('0xa5')]['length']){for(var _0x319747=0x0;_0x319747<_0x167f7e[_0x9d87('0x59')][_0x9d87('0xa5')][_0x9d87('0x46')];_0x319747+=0x1){_0x167f7e[_0x9d87('0x59')][_0x9d87('0xa5')][_0x319747]={'filename':_0x167f7e[_0x9d87('0x59')]['attachments'][_0x319747]['name'],'path':path[_0x9d87('0xa6')](config[_0x9d87('0xa7')],_0x9d87('0xa8'),_0x167f7e[_0x9d87('0x59')][_0x9d87('0xa5')][_0x319747][_0x9d87('0xa9')])};}}var _0x5f25bb={'tls':{'rejectUnauthorized':![]}};if(_[_0x9d87('0x69')](_0x168e5c['Smtp'][_0x9d87('0x75')])){if(_0x168e5c[_0x9d87('0x39')][_0x9d87('0x72')]){_0x5f25bb[_0x9d87('0xaa')]={'user':_0x168e5c['Smtp'][_0x9d87('0x6d')],'pass':_0x168e5c[_0x9d87('0x39')][_0x9d87('0x70')]};}_0x5f25bb[_0x9d87('0x73')]=_0x168e5c['Smtp']['host'];_0x5f25bb[_0x9d87('0x74')]=_0x168e5c[_0x9d87('0x39')]['port'];_0x5f25bb['secure']=_0x168e5c[_0x9d87('0x39')][_0x9d87('0xab')];}else{_0x5f25bb['service']=_0x168e5c[_0x9d87('0x39')][_0x9d87('0x75')];_0x5f25bb[_0x9d87('0xaa')]={'user':_0x168e5c[_0x9d87('0x39')]['user'],'pass':_0x168e5c['Smtp'][_0x9d87('0x70')]};}return respondWithRpcPromise('SendMail',_0x9d87('0xac'),{'account':_0x5f25bb,'message':_0x167f7e[_0x9d87('0x59')]});}else{throw new Error(_0x9d87('0xad'));}}})[_0x9d87('0x33')](function(_0x4e33ff){if(_0x4e33ff){_0x3b2b18=_0x4e33ff;if(_0x355e58[_0x9d87('0xa1')]){if(_0x355e58['List'][_0x9d87('0xa2')][_0x9d87('0x46')]){return _0x355e58[_0x9d87('0xa1')][_0x9d87('0xa2')][0x0];}else{return db['CmContact'][_0x9d87('0x5f')](_[_0x9d87('0x17')](_0x167f7e[_0x9d87('0x59')],{'firstName':_0x167f7e[_0x9d87('0x59')]['to'],'email':_0x167f7e[_0x9d87('0x59')]['to'],'phone':_0x167f7e[_0x9d87('0x59')]['to'],'ListId':_0x355e58[_0x9d87('0x68')]}));}}else{throw new Error(_0x9d87('0xad'));}}})[_0x9d87('0x33')](function(_0x5e9519){if(_0x5e9519){var _0xfe35a0={'UserId':_0x167f7e[_0x9d87('0x6d')]['id'],'ContactId':_0x5e9519['id'],'MailAccountId':_0x355e58['id'],'inReplyTo':_0x3b2b18['messageId'],'to':_0x167f7e[_0x9d87('0x59')][_0x9d87('0xa4')],'cc':_0x167f7e['body']['cc'],'subject':_0x167f7e['body'][_0x9d87('0xae')],'attach':_0x167f7e[_0x9d87('0x59')][_0x9d87('0xaf')],'firstMsgDirection':_0x9d87('0xb0'),'lastMsgAt':moment()['format'](_0x9d87('0xb1')),'lastMsgDirection':_0x9d87('0xb0'),'Messages':[_[_0x9d87('0x4f')](_0x167f7e['body'],{'messageId':_0x3b2b18[_0x9d87('0xb2')],'sentAt':moment()[_0x9d87('0x9d')](_0x9d87('0xb1')),'read':!![],'MailAccountId':_0x355e58['id'],'UserId':_0x167f7e[_0x9d87('0x6d')]['id'],'ContactId':_0x5e9519['id']})]};if(_0x167f7e[_0x9d87('0x59')][_0x9d87('0xb3')]){_0xfe35a0=_[_0x9d87('0x4f')](_0xfe35a0,_0x167f7e[_0x9d87('0x59')][_0x9d87('0xb3')]);}return db[_0x9d87('0x86')][_0x9d87('0x5f')](_0xfe35a0,{'include':[{'model':db['MailMessage'],'as':_0x9d87('0xb4')}]});}})['then'](respondWithResult(_0x4a1acc,null))[_0x9d87('0x25')](handleError(_0x4a1acc,null));};exports['verifySmtp']=function(_0x3349f2,_0x1eab6e,_0x5b204a){return db['MailAccount'][_0x9d87('0x58')]({'where':{'id':_0x3349f2[_0x9d87('0x5a')]['id']},'include':[{'model':db['MailServerOut'],'as':_0x9d87('0x39'),'raw':!![]}]})[_0x9d87('0x33')](handleEntityNotFound(_0x1eab6e,null))[_0x9d87('0x33')](function(_0x31790d){if(_0x31790d&&_0x31790d[_0x9d87('0x39')]){var _0x2d913e={'id':_0x31790d['id'],'tls':{'rejectUnauthorized':![]}};if(_0x31790d['Smtp'][_0x9d87('0x75')]){_0x2d913e[_0x9d87('0x75')]=_0x31790d[_0x9d87('0x39')][_0x9d87('0x75')];}else{_0x2d913e[_0x9d87('0x73')]=_0x31790d['Smtp'][_0x9d87('0x73')];_0x2d913e[_0x9d87('0x74')]=_0x31790d[_0x9d87('0x39')][_0x9d87('0x74')];_0x2d913e[_0x9d87('0xab')]=_0x31790d[_0x9d87('0x39')]['secure'];}if(_0x31790d[_0x9d87('0x39')]['authentication']){_0x2d913e[_0x9d87('0xaa')]={'user':_0x31790d[_0x9d87('0x39')][_0x9d87('0x6d')],'pass':_0x31790d[_0x9d87('0x39')][_0x9d87('0x70')]};}return respondWithRpcPromise(_0x9d87('0xb5'),'verifySmtp',{'account':_0x2d913e});}})[_0x9d87('0x33')](respondWithResult(_0x1eab6e,null))[_0x9d87('0x25')](handleError(_0x1eab6e,null));};exports[_0x9d87('0x32')]=function(_0xa90907,_0x2c9e1d){return db[_0x9d87('0x51')]['find']({'where':{'id':_0xa90907[_0x9d87('0x5a')]['id']}})[_0x9d87('0x33')](handleEntityNotFound(_0x2c9e1d,null))[_0x9d87('0x33')](function(_0x4c574e){if(_0x4c574e&&_0x4c574e['service']){throw new db[(_0x9d87('0xb6'))][(_0x9d87('0xb7'))](_0x9d87('0xb8'));}return _0x4c574e;})[_0x9d87('0x33')](removeEntity(_0x2c9e1d,null))[_0x9d87('0x25')](handleError(_0x2c9e1d,null));};exports['addAgents']=function(_0x49c081,_0x918bef,_0x2764a3){return db['MailAccount'][_0x9d87('0x58')]({'where':{'id':_0x49c081[_0x9d87('0x5a')]['id']}})[_0x9d87('0x33')](handleEntityNotFound(_0x918bef,null))[_0x9d87('0x33')](function(_0x11893b){if(_0x11893b){return _0x11893b[_0x9d87('0xb9')](_0x49c081['body'][_0x9d87('0x64')],_[_0x9d87('0x87')](_0x49c081[_0x9d87('0x59')],['ids','id'])||{})[_0x9d87('0xba')](function(_0x387b9f){for(var _0x1691c7=0x0;_0x1691c7<_0x49c081[_0x9d87('0x59')][_0x9d87('0x64')][_0x9d87('0x46')];_0x1691c7+=0x1){socket['emit'](_0x9d87('0xbb'),{'UserId':Number(_0x49c081['body'][_0x9d87('0x64')][_0x1691c7]),'MailAccountId':Number(_0x49c081[_0x9d87('0x5a')]['id'])});}return _0x387b9f;});}})[_0x9d87('0x33')](respondWithResult(_0x918bef,null))['catch'](handleError(_0x918bef,null));};exports[_0x9d87('0xbc')]=function(_0x1d7e87,_0x3d45f4,_0x17b34a){return db['MailAccount'][_0x9d87('0x58')]({'where':{'id':_0x1d7e87[_0x9d87('0x5a')]['id']}})[_0x9d87('0x33')](handleEntityNotFound(_0x3d45f4,null))[_0x9d87('0x33')](function(_0x4034ac){if(_0x4034ac){return _0x4034ac[_0x9d87('0xbc')](_0x1d7e87[_0x9d87('0x41')][_0x9d87('0x64')])[_0x9d87('0x33')](function(){if(_['isArray'](_0x1d7e87[_0x9d87('0x41')][_0x9d87('0x64')])){for(var _0x2001a4=0x0;_0x2001a4<_0x1d7e87[_0x9d87('0x41')][_0x9d87('0x64')][_0x9d87('0x46')];_0x2001a4+=0x1){socket[_0x9d87('0xbd')](_0x9d87('0xbe'),{'UserId':Number(_0x1d7e87[_0x9d87('0x41')][_0x9d87('0x64')][_0x2001a4]),'MailAccountId':Number(_0x1d7e87['params']['id'])});}}else{socket[_0x9d87('0xbd')](_0x9d87('0xbe'),{'UserId':Number(_0x1d7e87['query']['ids']),'MailAccountId':Number(_0x1d7e87[_0x9d87('0x5a')]['id'])});}});}})['then'](respondWithStatusCode(_0x3d45f4,null))[_0x9d87('0x25')](handleError(_0x3d45f4,null));};exports[_0x9d87('0xbf')]=function(_0x55bfb1,_0x440f66,_0x59a75c){var _0x2a9779={};var _0x4ea800={};var _0x2587a0;var _0x18bd24;return db[_0x9d87('0x51')]['findOne']({'where':{'id':_0x55bfb1[_0x9d87('0x5a')]['id']}})['then'](handleEntityNotFound(_0x440f66,null))[_0x9d87('0x33')](function(_0x36c073){if(_0x36c073){_0x2587a0=_0x36c073;_0x4ea800[_0x9d87('0x44')]=_['keys'](db['User'][_0x9d87('0x3d')]);_0x4ea800[_0x9d87('0x41')]=_[_0x9d87('0x42')](_0x55bfb1['query']);_0x4ea800[_0x9d87('0x43')]=_[_0x9d87('0x56')](_0x4ea800['model'],_0x4ea800[_0x9d87('0x41')]);_0x2a9779[_0x9d87('0x62')]=_[_0x9d87('0x56')](_0x4ea800[_0x9d87('0x44')],qs[_0x9d87('0x45')](_0x55bfb1[_0x9d87('0x41')][_0x9d87('0x45')]));_0x2a9779[_0x9d87('0x62')]=_0x2a9779[_0x9d87('0x62')][_0x9d87('0x46')]?_0x2a9779[_0x9d87('0x62')]:_0x4ea800[_0x9d87('0x44')];_0x2a9779[_0x9d87('0x49')]=qs['sort'](_0x55bfb1[_0x9d87('0x41')][_0x9d87('0x4a')]);_0x2a9779[_0x9d87('0x4b')]=qs[_0x9d87('0x43')](_[_0x9d87('0x4c')](_0x55bfb1[_0x9d87('0x41')],_0x4ea800['filters']));if(_0x55bfb1[_0x9d87('0x41')][_0x9d87('0x4e')]){_0x2a9779[_0x9d87('0x4b')]=_[_0x9d87('0x4f')](_0x2a9779['where'],{'$or':_['map'](_0x2a9779['attributes'],function(_0x210c2c){var _0x3c0597={};_0x3c0597[_0x210c2c]={'$like':'%'+_0x55bfb1[_0x9d87('0x41')][_0x9d87('0x4e')]+'%'};return _0x3c0597;})});}_0x2a9779=_['merge']({},_0x2a9779,_0x55bfb1[_0x9d87('0x50')]);return _0x2587a0['getAgents'](_0x2a9779);}})[_0x9d87('0x33')](function(_0x5269ed){if(_0x5269ed){_0x18bd24=_0x5269ed['length'];if(!_0x55bfb1[_0x9d87('0x41')][_0x9d87('0x47')](_0x9d87('0x48'))){_0x2a9779['limit']=qs[_0x9d87('0x2b')](_0x55bfb1[_0x9d87('0x41')][_0x9d87('0x2b')]);_0x2a9779[_0x9d87('0x29')]=qs[_0x9d87('0x29')](_0x55bfb1[_0x9d87('0x41')][_0x9d87('0x29')]);}return _0x2587a0[_0x9d87('0xbf')](_0x2a9779);}})[_0x9d87('0x33')](function(_0x49d064){if(_0x49d064){return _0x49d064?{'count':_0x18bd24,'rows':_0x49d064}:null;}})[_0x9d87('0x33')](respondWithResult(_0x440f66,null))[_0x9d87('0x25')](handleError(_0x440f66,null));}; \ No newline at end of file +var _0x96cd=['getApplications','getMessages','MailMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','Contacts','updatedAt','from','%s\x20<%s>','email','attachments','root','server/files/attachments','basename','auth','SendMail','sendMail','List\x20not\x20found','List','CmContact','ListId','messageId','subject','attach','format','out','secure','VerifySmtp','verifySmtp','destroy','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','isArray','userMailAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','html-to-text','juice','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','then','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','get','MailAccounts','UserProfileResource','stack','name','send','index','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','MailServerIn','Imap','find','body','describe','MailAccountId','create','findOne','hasOwnProperty','Disposition','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','isNil','active','description','cservice','cauthentication','user','cuser','password','pass','authentication','host','port','service','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','addInteraction','MailInteraction','omit','getInteractions','Contact','User','Owner','Tag','Tags','color','tag','sequelize','MailApplication','bulkCreate','findAndCountAll','priority'];(function(_0x429855,_0x54afe4){var _0x4a30c8=function(_0x33b236){while(--_0x33b236){_0x429855['push'](_0x429855['shift']());}};_0x4a30c8(++_0x54afe4);}(_0x96cd,0xed));var _0xd96c=function(_0x44c14a,_0x49b950){_0x44c14a=_0x44c14a-0x0;var _0x2c6cab=_0x96cd[_0x44c14a];return _0x2c6cab;};'use strict';var emlformat=require(_0xd96c('0x0'));var rimraf=require(_0xd96c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd96c('0x2'));var rp=require(_0xd96c('0x3'));var moment=require('moment');var BPromise=require(_0xd96c('0x4'));var Mustache=require(_0xd96c('0x5'));var util=require(_0xd96c('0x6'));var path=require('path');var sox=require(_0xd96c('0x7'));var csv=require(_0xd96c('0x8'));var ejs=require(_0xd96c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd96c('0xa'));var squel=require('squel');var crypto=require(_0xd96c('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd96c('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd96c('0xd'));var Papa=require(_0xd96c('0xe'));var htmlToText=require(_0xd96c('0xf'));var juice=require(_0xd96c('0x10'));var Redis=require(_0xd96c('0x11'));var authService=require(_0xd96c('0x12'));var qs=require(_0xd96c('0x13'));var as=require(_0xd96c('0x14'));var hardwareService=require(_0xd96c('0x15'));var logger=require(_0xd96c('0x16'))(_0xd96c('0x17'));var utils=require(_0xd96c('0x18'));var config=require(_0xd96c('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xd96c('0x1a')](config[_0xd96c('0x1b')],{'host':_0xd96c('0x1c'),'port':0x18eb});var socket=require(_0xd96c('0x1d'))(new Redis(config[_0xd96c('0x1b')]));require(_0xd96c('0x1e'))[_0xd96c('0x1f')](socket);var jayson=require(_0xd96c('0x20'));var client=jayson[_0xd96c('0x21')][_0xd96c('0x22')]({'port':0x232b});function respondWithRpcPromise(_0x49302d,_0x3777cd,_0x17d72b,_0x5da030){return new BPromise(function(_0x42279f,_0x5e6b7d){var _0x1ec056=_0x5da030||client;return _0x1ec056[_0xd96c('0x23')](_0x49302d,_0x17d72b)[_0xd96c('0x24')](function(_0xa68c1){logger['info'](_0xd96c('0x25'),_0x3777cd,'request\x20sent');logger[_0xd96c('0x26')](_0xd96c('0x27'),_0x3777cd,_0xd96c('0x28'),JSON[_0xd96c('0x29')](_0xa68c1));if(_0xa68c1[_0xd96c('0x2a')]){if(_0xa68c1['error']['code']===0x1f4){logger[_0xd96c('0x2a')]('MailAccount,\x20%s,\x20%s',_0x3777cd,_0xa68c1[_0xd96c('0x2a')][_0xd96c('0x2b')]);return _0x5e6b7d(_0xa68c1[_0xd96c('0x2a')][_0xd96c('0x2b')]);}logger[_0xd96c('0x2a')]('MailAccount,\x20%s,\x20%s',_0x3777cd,_0xa68c1[_0xd96c('0x2a')][_0xd96c('0x2b')]);return _0x42279f(_0xa68c1['error'][_0xd96c('0x2b')]);}else{logger['info'](_0xd96c('0x25'),_0x3777cd,_0xd96c('0x28'));_0x42279f(_0xa68c1['result']['message']);}})[_0xd96c('0x2c')](function(_0x4093ee){logger[_0xd96c('0x2a')](_0xd96c('0x25'),_0x3777cd,_0x4093ee);_0x5e6b7d(_0x4093ee);});});}function respondWithStatusCode(_0x55594e,_0x600a82){_0x600a82=_0x600a82||0xcc;return function(_0x71338b){if(_0x71338b){return _0x55594e[_0xd96c('0x2d')](_0x600a82);}return _0x55594e['status'](_0x600a82)[_0xd96c('0x2e')]();};}function respondWithResult(_0xc2fe61,_0x3ac8bf){_0x3ac8bf=_0x3ac8bf||0xc8;return function(_0x4a7289){if(_0x4a7289){return _0xc2fe61[_0xd96c('0x2f')](_0x3ac8bf)[_0xd96c('0x30')](_0x4a7289);}};}function respondWithFilteredResult(_0xe66bc2,_0x5a4412){return function(_0x562549){if(_0x562549){var _0xf59ead=typeof _0x5a4412[_0xd96c('0x31')]===_0xd96c('0x32')&&typeof _0x5a4412[_0xd96c('0x33')]===_0xd96c('0x32');var _0x548509=_0x562549[_0xd96c('0x34')];var _0x3d5857=_0xf59ead?0x0:_0x5a4412[_0xd96c('0x31')];var _0x4a82f3=_0xf59ead?_0x562549[_0xd96c('0x34')]:_0x5a4412[_0xd96c('0x31')]+_0x5a4412[_0xd96c('0x33')];var _0x114b50;if(_0x4a82f3>=_0x548509){_0x4a82f3=_0x548509;_0x114b50=0xc8;}else{_0x114b50=0xce;}_0xe66bc2['status'](_0x114b50);return _0xe66bc2[_0xd96c('0x35')](_0xd96c('0x36'),_0x3d5857+'-'+_0x4a82f3+'/'+_0x548509)[_0xd96c('0x30')](_0x562549);}return null;};}function patchUpdates(_0x528d9a){return function(_0x436688){try{jsonpatch[_0xd96c('0x37')](_0x436688,_0x528d9a,!![]);}catch(_0x5a80a1){return BPromise['reject'](_0x5a80a1);}return _0x436688['save']();};}function saveUpdates(_0x41ad12,_0x45e170){return function(_0x2b2a09){if(_0x2b2a09){return _0x2b2a09[_0xd96c('0x38')](_0x41ad12)[_0xd96c('0x24')](function(_0x23cb9b){return _0x23cb9b;});}return null;};}function removeEntity(_0x19bd81,_0x1a9e6a){return function(_0x421b89){if(_0x421b89){return _0x421b89['destroy']()['then'](function(){var _0x39a41f=_0x421b89[_0xd96c('0x39')]({'plain':!![]});var _0x33db83=_0xd96c('0x3a');return db[_0xd96c('0x3b')]['destroy']({'where':{'type':_0x33db83,'resourceId':_0x39a41f['id']}})[_0xd96c('0x24')](function(){return _0x421b89;});})[_0xd96c('0x24')](function(){_0x19bd81['status'](0xcc)[_0xd96c('0x2e')]();});}};}function handleEntityNotFound(_0x37b294,_0x4cdfa0){return function(_0x3611a6){if(!_0x3611a6){_0x37b294['sendStatus'](0x194);}return _0x3611a6;};}function handleError(_0x29ff6d,_0x2b6c71){_0x2b6c71=_0x2b6c71||0x1f4;return function(_0x24a96f){logger[_0xd96c('0x2a')](_0x24a96f[_0xd96c('0x3c')]);if(_0x24a96f[_0xd96c('0x3d')]){delete _0x24a96f['name'];}_0x29ff6d['status'](_0x2b6c71)[_0xd96c('0x3e')](_0x24a96f);};}exports[_0xd96c('0x3f')]=function(_0x1c26bc,_0x30ad27){var _0x2fe6c8={'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0xd96c('0x40')],'as':_0xd96c('0x41')},{'model':db[_0xd96c('0x42')],'as':_0xd96c('0x43')}]},_0x4b0f6d={},_0x5cec48={'count':0x0,'rows':[]};var _0x2bdd89=_[_0xd96c('0x44')](db[_0xd96c('0x45')][_0xd96c('0x46')],function(_0x31cff6){return{'name':_0x31cff6['fieldName'],'type':_0x31cff6[_0xd96c('0x47')][_0xd96c('0x48')]};});_0x4b0f6d[_0xd96c('0x49')]=_[_0xd96c('0x44')](_0x2bdd89,'name');_0x4b0f6d['query']=_[_0xd96c('0x4a')](_0x1c26bc['query']);_0x4b0f6d[_0xd96c('0x4b')]=_[_0xd96c('0x4c')](_0x4b0f6d[_0xd96c('0x49')],_0x4b0f6d[_0xd96c('0x4d')]);_0x2fe6c8[_0xd96c('0x4e')]=_['intersection'](_0x4b0f6d[_0xd96c('0x49')],qs['fields'](_0x1c26bc[_0xd96c('0x4d')][_0xd96c('0x4f')]));_0x2fe6c8[_0xd96c('0x4e')]=_0x2fe6c8[_0xd96c('0x4e')][_0xd96c('0x50')]?_0x2fe6c8[_0xd96c('0x4e')]:_0x4b0f6d[_0xd96c('0x49')];if(!_0x1c26bc[_0xd96c('0x4d')]['hasOwnProperty'](_0xd96c('0x51'))){_0x2fe6c8[_0xd96c('0x33')]=qs[_0xd96c('0x33')](_0x1c26bc['query'][_0xd96c('0x33')]);_0x2fe6c8[_0xd96c('0x31')]=qs[_0xd96c('0x31')](_0x1c26bc[_0xd96c('0x4d')][_0xd96c('0x31')]);}_0x2fe6c8[_0xd96c('0x52')]=qs[_0xd96c('0x53')](_0x1c26bc[_0xd96c('0x4d')][_0xd96c('0x53')]);_0x2fe6c8[_0xd96c('0x54')]=qs[_0xd96c('0x4b')](_[_0xd96c('0x55')](_0x1c26bc[_0xd96c('0x4d')],_0x4b0f6d[_0xd96c('0x4b')]),_0x2bdd89);if(_0x1c26bc['query'][_0xd96c('0x56')]){_0x2fe6c8['where']=_[_0xd96c('0x57')](_0x2fe6c8[_0xd96c('0x54')],{'$or':_[_0xd96c('0x44')](_0x2bdd89,function(_0xf6c9e0){if(_0xf6c9e0[_0xd96c('0x47')]!==_0xd96c('0x58')){var _0x1b187c={};_0x1b187c[_0xf6c9e0[_0xd96c('0x3d')]]={'$like':'%'+_0x1c26bc[_0xd96c('0x4d')][_0xd96c('0x56')]+'%'};return _0x1b187c;}})});}_0x2fe6c8=_[_0xd96c('0x57')]({},_0x2fe6c8,_0x1c26bc[_0xd96c('0x59')]);var _0x216518={'where':_0x2fe6c8[_0xd96c('0x54')]};return db[_0xd96c('0x45')][_0xd96c('0x34')](_0x216518)['then'](function(_0x1a6cfb){_0x5cec48['count']=_0x1a6cfb;if(_0x1c26bc[_0xd96c('0x4d')][_0xd96c('0x5a')]){_0x2fe6c8[_0xd96c('0x5b')]=[{'all':!![]}];}return db[_0xd96c('0x45')][_0xd96c('0x5c')](_0x2fe6c8);})[_0xd96c('0x24')](function(_0x54df41){_0x5cec48[_0xd96c('0x5d')]=_0x54df41;return _0x5cec48;})['then'](respondWithFilteredResult(_0x30ad27,_0x2fe6c8))[_0xd96c('0x2c')](handleError(_0x30ad27,null));};exports['show']=function(_0x2bc95a,_0x2f0796){var _0x45153f={'raw':![],'where':{'id':_0x2bc95a[_0xd96c('0x5e')]['id']},'include':[{'model':db[_0xd96c('0x5f')],'as':_0xd96c('0x60')},{'model':db[_0xd96c('0x40')],'as':_0xd96c('0x41')},{'model':db[_0xd96c('0x42')],'as':_0xd96c('0x43')}]},_0x54544a={};_0x54544a[_0xd96c('0x49')]=_['keys'](db[_0xd96c('0x45')][_0xd96c('0x46')]);_0x54544a[_0xd96c('0x4d')]=_[_0xd96c('0x4a')](_0x2bc95a[_0xd96c('0x4d')]);_0x54544a[_0xd96c('0x4b')]=_[_0xd96c('0x4c')](_0x54544a[_0xd96c('0x49')],_0x54544a['query']);_0x45153f['attributes']=_[_0xd96c('0x4c')](_0x54544a['model'],qs[_0xd96c('0x4f')](_0x2bc95a[_0xd96c('0x4d')]['fields']));_0x45153f[_0xd96c('0x4e')]=_0x45153f[_0xd96c('0x4e')][_0xd96c('0x50')]?_0x45153f[_0xd96c('0x4e')]:_0x54544a[_0xd96c('0x49')];if(_0x2bc95a['query'][_0xd96c('0x5a')]){_0x45153f[_0xd96c('0x5b')]=[{'all':!![]}];}_0x45153f=_[_0xd96c('0x57')]({},_0x45153f,_0x2bc95a[_0xd96c('0x59')]);return db[_0xd96c('0x45')][_0xd96c('0x61')](_0x45153f)[_0xd96c('0x24')](handleEntityNotFound(_0x2f0796,null))[_0xd96c('0x24')](respondWithResult(_0x2f0796,null))[_0xd96c('0x2c')](handleError(_0x2f0796,null));};exports[_0xd96c('0x38')]=function(_0x18700e,_0x54fef7){if(_0x18700e['body']['id']){delete _0x18700e['body']['id'];}return db[_0xd96c('0x45')][_0xd96c('0x61')]({'where':{'id':_0x18700e[_0xd96c('0x5e')]['id']},'include':[{'model':db[_0xd96c('0x5f')],'as':_0xd96c('0x60')},{'model':db[_0xd96c('0x40')],'as':_0xd96c('0x41')},{'model':db[_0xd96c('0x42')],'as':'mandatoryDispositionPause'}]})[_0xd96c('0x24')](handleEntityNotFound(_0x54fef7,null))[_0xd96c('0x24')](saveUpdates(_0x18700e['body'],null))[_0xd96c('0x24')](function(_0x36241c){if(_0x36241c&&_0x18700e['body'][_0xd96c('0x60')]){return db[_0xd96c('0x5f')][_0xd96c('0x38')](_0x18700e[_0xd96c('0x62')]['Imap'],{'where':{'MailAccountId':_0x36241c['id']}})[_0xd96c('0x24')](function(){return _0x36241c;});}return _0x36241c;})['then'](function(_0x2256a8){if(_0x2256a8&&_0x18700e[_0xd96c('0x62')]['Smtp']){return db[_0xd96c('0x40')]['update'](_0x18700e[_0xd96c('0x62')][_0xd96c('0x41')],{'where':{'MailAccountId':_0x2256a8['id']}})[_0xd96c('0x24')](function(){return _0x2256a8;});}return _0x2256a8;})[_0xd96c('0x24')](respondWithResult(_0x54fef7,null))['catch'](handleError(_0x54fef7,null));};exports[_0xd96c('0x63')]=function(_0x3b8f69,_0x298b1c){return db[_0xd96c('0x45')][_0xd96c('0x63')]()[_0xd96c('0x24')](respondWithResult(_0x298b1c,null))[_0xd96c('0x2c')](handleError(_0x298b1c,null));};exports['addDisposition']=function(_0x321abe,_0x5a6452,_0x5cbe48){if(_0x321abe[_0xd96c('0x62')]['id']){delete _0x321abe[_0xd96c('0x62')]['id'];}return db[_0xd96c('0x45')][_0xd96c('0x61')]({'where':{'id':_0x321abe[_0xd96c('0x5e')]['id']}})[_0xd96c('0x24')](handleEntityNotFound(_0x5a6452,null))[_0xd96c('0x24')](function(_0x56a4d5){if(_0x56a4d5){_0x321abe[_0xd96c('0x62')][_0xd96c('0x64')]=_0x56a4d5['id'];return db['Disposition'][_0xd96c('0x65')](_0x321abe['body']);}})['then'](respondWithResult(_0x5a6452,null))['catch'](handleError(_0x5a6452,null));};exports['getDispositions']=function(_0x3147d8,_0x49871a,_0x5e2f92){var _0xcda317={'raw':![],'where':{}};var _0x4e0a85={};var _0x3482b9={'count':0x0,'rows':[]};return db[_0xd96c('0x45')][_0xd96c('0x66')]({'where':{'id':_0x3147d8[_0xd96c('0x5e')]['id']}})[_0xd96c('0x24')](handleEntityNotFound(_0x49871a,null))[_0xd96c('0x24')](function(_0x47242b){if(_0x47242b){_0x4e0a85['model']=_[_0xd96c('0x4a')](db['Disposition']['rawAttributes']);_0x4e0a85[_0xd96c('0x4d')]=_[_0xd96c('0x4a')](_0x3147d8[_0xd96c('0x4d')]);_0x4e0a85[_0xd96c('0x4b')]=_[_0xd96c('0x4c')](_0x4e0a85['model'],_0x4e0a85[_0xd96c('0x4d')]);_0xcda317[_0xd96c('0x4e')]=_['intersection'](_0x4e0a85['model'],qs['fields'](_0x3147d8[_0xd96c('0x4d')][_0xd96c('0x4f')]));_0xcda317[_0xd96c('0x4e')]=_0xcda317[_0xd96c('0x4e')]['length']?_0xcda317['attributes']:_0x4e0a85[_0xd96c('0x49')];if(!_0x3147d8[_0xd96c('0x4d')][_0xd96c('0x67')](_0xd96c('0x51'))){_0xcda317[_0xd96c('0x33')]=qs[_0xd96c('0x33')](_0x3147d8[_0xd96c('0x4d')][_0xd96c('0x33')]);_0xcda317[_0xd96c('0x31')]=qs[_0xd96c('0x31')](_0x3147d8['query'][_0xd96c('0x31')]);}_0xcda317[_0xd96c('0x52')]=qs[_0xd96c('0x53')](_0x3147d8[_0xd96c('0x4d')][_0xd96c('0x53')]);_0xcda317[_0xd96c('0x54')]=qs[_0xd96c('0x4b')](_[_0xd96c('0x55')](_0x3147d8[_0xd96c('0x4d')],_0x4e0a85[_0xd96c('0x4b')]));_0xcda317[_0xd96c('0x54')][_0xd96c('0x64')]=_0x47242b['id'];if(_0x3147d8[_0xd96c('0x4d')][_0xd96c('0x56')]){_0xcda317[_0xd96c('0x54')]=_['merge'](_0xcda317[_0xd96c('0x54')],{'$or':_[_0xd96c('0x44')](_0xcda317[_0xd96c('0x4e')],function(_0x52ce7d){var _0x3daf68={};_0x3daf68[_0x52ce7d]={'$like':'%'+_0x3147d8[_0xd96c('0x4d')][_0xd96c('0x56')]+'%'};return _0x3daf68;})});}_0xcda317=_['merge']({},_0xcda317,_0x3147d8[_0xd96c('0x59')]);return db['Disposition'][_0xd96c('0x34')]({'where':_0xcda317[_0xd96c('0x54')]})[_0xd96c('0x24')](function(_0x3d17b9){_0x3482b9[_0xd96c('0x34')]=_0x3d17b9;if(_0x3147d8[_0xd96c('0x4d')][_0xd96c('0x5a')]){_0xcda317[_0xd96c('0x5b')]=[{'all':!![]}];}return db[_0xd96c('0x68')][_0xd96c('0x5c')](_0xcda317);})[_0xd96c('0x24')](function(_0x7c8ff){_0x3482b9[_0xd96c('0x5d')]=_0x7c8ff;return _0x3482b9;});}})['then'](respondWithFilteredResult(_0x49871a,_0xcda317))[_0xd96c('0x2c')](handleError(_0x49871a,null));};exports['removeDispositions']=function(_0x3baf3d,_0x26286d,_0xe2fb79){return db[_0xd96c('0x45')][_0xd96c('0x61')]({'where':{'id':_0x3baf3d[_0xd96c('0x5e')]['id']}})[_0xd96c('0x24')](handleEntityNotFound(_0x26286d,null))[_0xd96c('0x24')](function(_0x1813c8){if(_0x1813c8){return _0x1813c8['removeDispositions'](_0x3baf3d[_0xd96c('0x4d')][_0xd96c('0x69')]);}})['then'](respondWithStatusCode(_0x26286d,null))['catch'](handleError(_0x26286d,null));};exports[_0xd96c('0x6a')]=function(_0x2a341e,_0x1cd44d,_0x56163d){if(_0x2a341e[_0xd96c('0x62')]['id']){delete _0x2a341e[_0xd96c('0x62')]['id'];}return db[_0xd96c('0x45')]['find']({'where':{'id':_0x2a341e[_0xd96c('0x5e')]['id']}})[_0xd96c('0x24')](handleEntityNotFound(_0x1cd44d,null))['then'](function(_0x3bb3aa){if(_0x3bb3aa){_0x2a341e[_0xd96c('0x62')][_0xd96c('0x64')]=_0x3bb3aa['id'];return db[_0xd96c('0x6b')][_0xd96c('0x65')](_0x2a341e[_0xd96c('0x62')]);}})[_0xd96c('0x24')](respondWithResult(_0x1cd44d,null))[_0xd96c('0x2c')](handleError(_0x1cd44d,null));};exports[_0xd96c('0x6c')]=function(_0x33081d,_0x4f0efc,_0x7b14e5){var _0x506d8e={'raw':![],'where':{}};var _0x24c6f7={};var _0x289642={'count':0x0,'rows':[]};return db[_0xd96c('0x45')][_0xd96c('0x66')]({'where':{'id':_0x33081d[_0xd96c('0x5e')]['id']}})['then'](handleEntityNotFound(_0x4f0efc,null))[_0xd96c('0x24')](function(_0xe85017){if(_0xe85017){_0x24c6f7['model']=_[_0xd96c('0x4a')](db[_0xd96c('0x6b')][_0xd96c('0x46')]);_0x24c6f7[_0xd96c('0x4d')]=_[_0xd96c('0x4a')](_0x33081d[_0xd96c('0x4d')]);_0x24c6f7[_0xd96c('0x4b')]=_[_0xd96c('0x4c')](_0x24c6f7[_0xd96c('0x49')],_0x24c6f7[_0xd96c('0x4d')]);_0x506d8e[_0xd96c('0x4e')]=_[_0xd96c('0x4c')](_0x24c6f7['model'],qs[_0xd96c('0x4f')](_0x33081d[_0xd96c('0x4d')]['fields']));_0x506d8e[_0xd96c('0x4e')]=_0x506d8e['attributes']['length']?_0x506d8e['attributes']:_0x24c6f7['model'];if(!_0x33081d['query'][_0xd96c('0x67')](_0xd96c('0x51'))){_0x506d8e[_0xd96c('0x33')]=qs[_0xd96c('0x33')](_0x33081d[_0xd96c('0x4d')][_0xd96c('0x33')]);_0x506d8e[_0xd96c('0x31')]=qs[_0xd96c('0x31')](_0x33081d[_0xd96c('0x4d')][_0xd96c('0x31')]);}_0x506d8e['order']=qs['sort'](_0x33081d[_0xd96c('0x4d')][_0xd96c('0x53')]);_0x506d8e[_0xd96c('0x54')]=qs[_0xd96c('0x4b')](_[_0xd96c('0x55')](_0x33081d[_0xd96c('0x4d')],_0x24c6f7[_0xd96c('0x4b')]));_0x506d8e[_0xd96c('0x54')]['MailAccountId']=_0xe85017['id'];if(_0x33081d[_0xd96c('0x4d')][_0xd96c('0x56')]){_0x506d8e['where']=_[_0xd96c('0x57')](_0x506d8e['where'],{'$or':_[_0xd96c('0x44')](_0x506d8e['attributes'],function(_0x2a5970){var _0x163483={};_0x163483[_0x2a5970]={'$like':'%'+_0x33081d['query'][_0xd96c('0x56')]+'%'};return _0x163483;})});}_0x506d8e=_[_0xd96c('0x57')]({},_0x506d8e,_0x33081d[_0xd96c('0x59')]);return db[_0xd96c('0x6b')][_0xd96c('0x34')]({'where':_0x506d8e[_0xd96c('0x54')]})[_0xd96c('0x24')](function(_0x33d56d){_0x289642[_0xd96c('0x34')]=_0x33d56d;if(_0x33081d[_0xd96c('0x4d')][_0xd96c('0x5a')]){_0x506d8e[_0xd96c('0x5b')]=[{'all':!![]}];}return db[_0xd96c('0x6b')][_0xd96c('0x5c')](_0x506d8e);})[_0xd96c('0x24')](function(_0x4e193e){_0x289642[_0xd96c('0x5d')]=_0x4e193e;return _0x289642;});}})[_0xd96c('0x24')](respondWithFilteredResult(_0x4f0efc,_0x506d8e))['catch'](handleError(_0x4f0efc,null));};exports[_0xd96c('0x6d')]=function(_0x13e1a4,_0x59ab88,_0x59438b){return db[_0xd96c('0x45')][_0xd96c('0x61')]({'where':{'id':_0x13e1a4[_0xd96c('0x5e')]['id']}})[_0xd96c('0x24')](handleEntityNotFound(_0x59ab88,null))[_0xd96c('0x24')](function(_0xc436d9){if(_0xc436d9){return _0xc436d9['removeAnswers'](_0x13e1a4[_0xd96c('0x4d')]['ids']);}})[_0xd96c('0x24')](respondWithStatusCode(_0x59ab88,null))[_0xd96c('0x2c')](handleError(_0x59ab88,null));};exports['create']=function(_0x3367fb,_0x42be39){var _0x13ed87={'name':_0x3367fb[_0xd96c('0x62')][_0xd96c('0x3d')],'key':_0x3367fb['body']['key'],'email':_0x3367fb[_0xd96c('0x62')]['email'],'ListId':_0x3367fb['body']['ListId'],'active':!_[_0xd96c('0x6e')](_0x3367fb[_0xd96c('0x62')][_0xd96c('0x6f')])?_0x3367fb[_0xd96c('0x62')][_0xd96c('0x6f')]:!![],'description':_0x3367fb['body'][_0xd96c('0x70')]||null,'Imap':{},'Smtp':{}};if(_[_0xd96c('0x6e')](_0x3367fb[_0xd96c('0x62')][_0xd96c('0x71')])){if(_0x3367fb[_0xd96c('0x62')][_0xd96c('0x72')]){_0x13ed87[_0xd96c('0x60')][_0xd96c('0x73')]=_0x13ed87[_0xd96c('0x41')][_0xd96c('0x73')]=_0x3367fb['body'][_0xd96c('0x74')];_0x13ed87[_0xd96c('0x60')][_0xd96c('0x75')]=_0x13ed87['Smtp'][_0xd96c('0x76')]=_0x3367fb['body']['cpassword'];}else{_0x13ed87[_0xd96c('0x60')]['authentication']=_0x13ed87[_0xd96c('0x41')][_0xd96c('0x77')]=![];}_0x13ed87[_0xd96c('0x60')][_0xd96c('0x78')]=_0x3367fb['body']['Imap']['host'];_0x13ed87[_0xd96c('0x60')]['port']=_0x3367fb[_0xd96c('0x62')]['Imap'][_0xd96c('0x79')];_0x13ed87['Smtp'][_0xd96c('0x78')]=_0x3367fb[_0xd96c('0x62')][_0xd96c('0x41')]['host'];_0x13ed87[_0xd96c('0x41')][_0xd96c('0x79')]=_0x3367fb[_0xd96c('0x62')][_0xd96c('0x41')]['port'];}else{_0x13ed87[_0xd96c('0x60')]['service']=_0x13ed87[_0xd96c('0x41')][_0xd96c('0x7a')]=_0x3367fb[_0xd96c('0x62')][_0xd96c('0x71')];_0x13ed87[_0xd96c('0x60')][_0xd96c('0x73')]=_0x13ed87[_0xd96c('0x41')][_0xd96c('0x73')]=_0x3367fb[_0xd96c('0x62')][_0xd96c('0x74')];_0x13ed87['Imap'][_0xd96c('0x75')]=_0x13ed87[_0xd96c('0x41')][_0xd96c('0x76')]=_0x3367fb['body']['cpassword'];}return db[_0xd96c('0x45')][_0xd96c('0x65')](_0x13ed87,{'include':[{'model':db['MailServerOut'],'as':_0xd96c('0x41')},{'model':db['MailServerIn'],'as':_0xd96c('0x60')}]})[_0xd96c('0x24')](function(_0x56999d){var _0x26de78=_0x3367fb[_0xd96c('0x73')][_0xd96c('0x39')]({'plain':!![]});if(!_0x26de78)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26de78[_0xd96c('0x7b')]===_0xd96c('0x73')){var _0x443bf7=_0x56999d[_0xd96c('0x39')]({'plain':!![]});return db[_0xd96c('0x7c')][_0xd96c('0x61')]({'where':{'name':_0xd96c('0x3a'),'userProfileId':_0x26de78[_0xd96c('0x7d')]},'raw':!![]})[_0xd96c('0x24')](function(_0x48f874){if(_0x48f874&&_0x48f874[_0xd96c('0x7e')]===0x0){return db[_0xd96c('0x3b')][_0xd96c('0x65')]({'name':_0x443bf7[_0xd96c('0x3d')],'resourceId':_0x443bf7['id'],'type':_0x48f874['name'],'sectionId':_0x48f874['id']},{})[_0xd96c('0x24')](function(){return _0x56999d;});}else{return _0x56999d;}})['catch'](function(_0x1a8323){logger[_0xd96c('0x2a')](_0xd96c('0x7f'),_0x1a8323);throw _0x1a8323;});}return _0x56999d;})[_0xd96c('0x24')](respondWithResult(_0x42be39,0xc9))[_0xd96c('0x2c')](handleError(_0x42be39,null));};exports[_0xd96c('0x80')]=function(_0x4f345b,_0x4001a9,_0x53ae67){return db['MailAccount'][_0xd96c('0x66')]({'where':{'id':_0x4f345b['params']['id']}})['then'](handleEntityNotFound(_0x4001a9,null))[_0xd96c('0x24')](function(_0x2b5e98){if(_0x2b5e98){return _0x2b5e98[_0xd96c('0x80')]();}return null;})[_0xd96c('0x24')](respondWithResult(_0x4001a9,null))[_0xd96c('0x2c')](handleError(_0x4001a9,null));};exports[_0xd96c('0x81')]=function(_0x20200d,_0x1b95be,_0x4e6bec){if(_0x20200d['body']['id']){delete _0x20200d[_0xd96c('0x62')]['id'];}return db[_0xd96c('0x45')][_0xd96c('0x61')]({'where':{'id':_0x20200d[_0xd96c('0x5e')]['id']}})['then'](handleEntityNotFound(_0x1b95be,null))['then'](function(_0x38a964){if(_0x38a964){_0x20200d[_0xd96c('0x62')][_0xd96c('0x64')]=_0x38a964['id'];return db[_0xd96c('0x5f')][_0xd96c('0x65')](_0x20200d[_0xd96c('0x62')]);}})['then'](respondWithResult(_0x1b95be,null))['catch'](handleError(_0x1b95be,null));};exports[_0xd96c('0x82')]=function(_0x247d06,_0x3d046a,_0x576ef9){return db[_0xd96c('0x45')][_0xd96c('0x66')]({'where':{'id':_0x247d06[_0xd96c('0x5e')]['id']}})['then'](handleEntityNotFound(_0x3d046a,null))[_0xd96c('0x24')](function(_0x18121a){if(_0x18121a){return _0x18121a[_0xd96c('0x83')](null);}return null;})['then'](respondWithStatusCode(_0x3d046a,null))[_0xd96c('0x2c')](handleError(_0x3d046a,null));};exports[_0xd96c('0x84')]=function(_0x52c779,_0x4436d6,_0x51dd15){return db['MailAccount'][_0xd96c('0x66')]({'where':{'id':_0x52c779['params']['id']}})['then'](handleEntityNotFound(_0x4436d6,null))[_0xd96c('0x24')](function(_0x25e828){if(_0x25e828){return _0x25e828[_0xd96c('0x84')]();}return null;})[_0xd96c('0x24')](respondWithResult(_0x4436d6,null))['catch'](handleError(_0x4436d6,null));};exports[_0xd96c('0x85')]=function(_0x5bdb3b,_0xe40785,_0x18d905){if(_0x5bdb3b[_0xd96c('0x62')]['id']){delete _0x5bdb3b['body']['id'];}return db[_0xd96c('0x45')]['find']({'where':{'id':_0x5bdb3b[_0xd96c('0x5e')]['id']}})[_0xd96c('0x24')](handleEntityNotFound(_0xe40785,null))['then'](function(_0x30581d){if(_0x30581d){_0x5bdb3b[_0xd96c('0x62')][_0xd96c('0x64')]=_0x30581d['id'];return db[_0xd96c('0x40')][_0xd96c('0x65')](_0x5bdb3b[_0xd96c('0x62')]);}})[_0xd96c('0x24')](respondWithResult(_0xe40785,null))[_0xd96c('0x2c')](handleError(_0xe40785,null));};exports[_0xd96c('0x86')]=function(_0x17d018,_0x5d1d1c,_0x3f5d00){return db[_0xd96c('0x45')][_0xd96c('0x66')]({'where':{'id':_0x17d018[_0xd96c('0x5e')]['id']}})[_0xd96c('0x24')](handleEntityNotFound(_0x5d1d1c,null))[_0xd96c('0x24')](function(_0x101492){if(_0x101492){return _0x101492['setSmtp'](null);}return null;})[_0xd96c('0x24')](respondWithStatusCode(_0x5d1d1c,null))[_0xd96c('0x2c')](handleError(_0x5d1d1c,null));};exports[_0xd96c('0x87')]=function(_0x175f57,_0x125408,_0x577ef7){return db[_0xd96c('0x88')][_0xd96c('0x61')]({'where':{'id':_0x175f57['params']['id']}})['then'](handleEntityNotFound(_0x125408,null))[_0xd96c('0x24')](function(_0x1da399){if(_0x1da399){return _0x1da399[_0xd96c('0x87')](_0x175f57[_0xd96c('0x62')]['ids'],_[_0xd96c('0x89')](_0x175f57[_0xd96c('0x62')],[_0xd96c('0x69'),'id'])||{});}})[_0xd96c('0x24')](respondWithResult(_0x125408,null))[_0xd96c('0x2c')](handleError(_0x125408,null));};exports[_0xd96c('0x8a')]=function(_0x27c103,_0x72cdf2,_0xaa7a7b){var _0xef5bde={'raw':![],'where':{}};var _0x35f92f={};var _0x334261={'count':0x0,'rows':[]};return db[_0xd96c('0x45')][_0xd96c('0x66')]({'where':{'id':_0x27c103[_0xd96c('0x5e')]['id']}})[_0xd96c('0x24')](handleEntityNotFound(_0x72cdf2,null))[_0xd96c('0x24')](function(_0xd9fa56){if(_0xd9fa56){_0x35f92f[_0xd96c('0x49')]=_['keys'](db[_0xd96c('0x88')][_0xd96c('0x46')]);_0x35f92f[_0xd96c('0x4d')]=_[_0xd96c('0x4a')](_0x27c103[_0xd96c('0x4d')]);_0x35f92f[_0xd96c('0x4b')]=_['intersection'](_0x35f92f['model'],_0x35f92f['query']);_0xef5bde[_0xd96c('0x4e')]=_[_0xd96c('0x4c')](_0x35f92f['model'],qs[_0xd96c('0x4f')](_0x27c103[_0xd96c('0x4d')][_0xd96c('0x4f')]));_0xef5bde[_0xd96c('0x4e')]=_0xef5bde[_0xd96c('0x4e')][_0xd96c('0x50')]?_0xef5bde[_0xd96c('0x4e')]:_0x35f92f[_0xd96c('0x49')];if(!_0x27c103[_0xd96c('0x4d')][_0xd96c('0x67')]('nolimit')){_0xef5bde['limit']=qs[_0xd96c('0x33')](_0x27c103['query'][_0xd96c('0x33')]);_0xef5bde[_0xd96c('0x31')]=qs[_0xd96c('0x31')](_0x27c103[_0xd96c('0x4d')][_0xd96c('0x31')]);}_0xef5bde[_0xd96c('0x52')]=qs[_0xd96c('0x53')](_0x27c103[_0xd96c('0x4d')]['sort']);_0xef5bde[_0xd96c('0x54')]=qs[_0xd96c('0x4b')](_[_0xd96c('0x55')](_0x27c103['query'],_0x35f92f[_0xd96c('0x4b')]));_0xef5bde[_0xd96c('0x54')][_0xd96c('0x64')]=_0xd9fa56['id'];if(_0x27c103[_0xd96c('0x4d')]['filter']){_0xef5bde[_0xd96c('0x54')]=_[_0xd96c('0x57')](_0xef5bde[_0xd96c('0x54')],{'$or':_[_0xd96c('0x44')](_0xef5bde['attributes'],function(_0x41c9a2){var _0x8820a6={};_0x8820a6[_0x41c9a2]={'$like':'%'+_0x27c103['query'][_0xd96c('0x56')]+'%'};return _0x8820a6;})});}_0xef5bde=_[_0xd96c('0x57')]({},_0xef5bde,_0x27c103[_0xd96c('0x59')]);return db[_0xd96c('0x88')]['count']({'where':_0xef5bde[_0xd96c('0x54')]})['then'](function(_0x210833){_0x334261[_0xd96c('0x34')]=_0x210833;if(_0x27c103['query'][_0xd96c('0x5a')]){_0xef5bde[_0xd96c('0x5b')]=[{'model':db['CmContact'],'as':_0xd96c('0x8b'),'required':![]},{'model':db[_0xd96c('0x8c')],'as':_0xd96c('0x8d'),'attributes':['name','fullname','internal'],'required':![]},{'model':db[_0xd96c('0x8e')],'as':_0xd96c('0x8f'),'attributes':['id',_0xd96c('0x3d'),_0xd96c('0x90')],'where':_0x27c103[_0xd96c('0x4d')]['tag']?{'id':_0x27c103['query'][_0xd96c('0x91')]}:undefined,'required':_0x27c103['query'][_0xd96c('0x91')]?!![]:![]}];}return db[_0xd96c('0x88')][_0xd96c('0x5c')](_0xef5bde);})['then'](function(_0x42db86){_0x334261[_0xd96c('0x5d')]=_0x42db86;return _0x334261;});}})[_0xd96c('0x24')](respondWithFilteredResult(_0x72cdf2,_0xef5bde))[_0xd96c('0x2c')](handleError(_0x72cdf2,null));};exports['addApplications']=function(_0x3a0b48,_0x7a02c5,_0x2aacc6){return db[_0xd96c('0x45')]['findOne']({'where':{'id':_0x3a0b48[_0xd96c('0x5e')]['id']}})['then'](handleEntityNotFound(_0x7a02c5,null))[_0xd96c('0x24')](function(_0xbdee7f){if(_0xbdee7f){return db[_0xd96c('0x92')]['transaction'](function(_0x34aa89){return db[_0xd96c('0x93')]['destroy']({'where':{'MailAccountId':_0x3a0b48[_0xd96c('0x5e')]['id']},'transaction':_0x34aa89})[_0xd96c('0x24')](function(_0x55b31c){var _0x18306b=_['map'](_0x3a0b48['body'],function(_0x1ff691){_0x1ff691[_0xd96c('0x64')]=_0x3a0b48['params']['id'];return _0x1ff691;});return db[_0xd96c('0x93')][_0xd96c('0x94')](_0x18306b,{'transaction':_0x34aa89});});})['then'](function(){return db[_0xd96c('0x93')][_0xd96c('0x95')]({'where':{'MailAccountId':_0x3a0b48[_0xd96c('0x5e')]['id']},'order':_0xd96c('0x96')});});}})[_0xd96c('0x24')](respondWithResult(_0x7a02c5,null))[_0xd96c('0x2c')](handleError(_0x7a02c5,null));};exports[_0xd96c('0x97')]=function(_0x2ae7f4,_0x103b2b,_0x5ead5d){var _0x27058c={};var _0x1c7f5e={};var _0x15ba95;var _0x35a781;return db[_0xd96c('0x45')][_0xd96c('0x66')]({'where':{'id':_0x2ae7f4[_0xd96c('0x5e')]['id']}})[_0xd96c('0x24')](handleEntityNotFound(_0x103b2b,null))['then'](function(_0x33b9cc){if(_0x33b9cc){_0x15ba95=_0x33b9cc;_0x1c7f5e[_0xd96c('0x49')]=_[_0xd96c('0x4a')](db[_0xd96c('0x93')][_0xd96c('0x46')]);_0x1c7f5e[_0xd96c('0x4d')]=_[_0xd96c('0x4a')](_0x2ae7f4['query']);_0x1c7f5e[_0xd96c('0x4b')]=_[_0xd96c('0x4c')](_0x1c7f5e[_0xd96c('0x49')],_0x1c7f5e[_0xd96c('0x4d')]);_0x27058c[_0xd96c('0x4e')]=_['intersection'](_0x1c7f5e['model'],qs[_0xd96c('0x4f')](_0x2ae7f4[_0xd96c('0x4d')][_0xd96c('0x4f')]));_0x27058c[_0xd96c('0x4e')]=_0x27058c['attributes'][_0xd96c('0x50')]?_0x27058c[_0xd96c('0x4e')]:_0x1c7f5e[_0xd96c('0x49')];_0x27058c[_0xd96c('0x52')]=qs[_0xd96c('0x53')](_0x2ae7f4[_0xd96c('0x4d')][_0xd96c('0x53')]);_0x27058c[_0xd96c('0x54')]=qs['filters'](_[_0xd96c('0x55')](_0x2ae7f4['query'],_0x1c7f5e[_0xd96c('0x4b')]));if(_0x2ae7f4[_0xd96c('0x4d')][_0xd96c('0x56')]){_0x27058c[_0xd96c('0x54')]=_['merge'](_0x27058c[_0xd96c('0x54')],{'$or':_[_0xd96c('0x44')](_0x27058c['attributes'],function(_0x13aba5){var _0x5254c4={};_0x5254c4[_0x13aba5]={'$like':'%'+_0x2ae7f4[_0xd96c('0x4d')]['filter']+'%'};return _0x5254c4;})});}_0x27058c=_[_0xd96c('0x57')]({},_0x27058c,_0x2ae7f4[_0xd96c('0x59')]);return _0x15ba95[_0xd96c('0x97')](_0x27058c);}})['then'](function(_0x85cfb9){if(_0x85cfb9){_0x35a781=_0x85cfb9['length'];if(!_0x2ae7f4[_0xd96c('0x4d')][_0xd96c('0x67')](_0xd96c('0x51'))){_0x27058c[_0xd96c('0x33')]=qs[_0xd96c('0x33')](_0x2ae7f4[_0xd96c('0x4d')]['limit']);_0x27058c[_0xd96c('0x31')]=qs[_0xd96c('0x31')](_0x2ae7f4[_0xd96c('0x4d')][_0xd96c('0x31')]);}return _0x15ba95[_0xd96c('0x97')](_0x27058c);}})[_0xd96c('0x24')](function(_0x13df9f){if(_0x13df9f){return _0x13df9f?{'count':_0x35a781,'rows':_0x13df9f}:null;}})[_0xd96c('0x24')](respondWithResult(_0x103b2b,null))['catch'](handleError(_0x103b2b,null));};exports[_0xd96c('0x98')]=function(_0x1b3773,_0x573ec2,_0x4765f7){var _0x12374a={'raw':!![],'where':{}};var _0xbb0aef={};var _0x455112={'count':0x0,'rows':[]};return db[_0xd96c('0x45')]['findOne']({'where':{'id':_0x1b3773[_0xd96c('0x5e')]['id']}})['then'](handleEntityNotFound(_0x573ec2,null))[_0xd96c('0x24')](function(_0x45e0d9){if(_0x45e0d9){_0xbb0aef[_0xd96c('0x49')]=_[_0xd96c('0x4a')](db[_0xd96c('0x99')][_0xd96c('0x46')]);_0xbb0aef[_0xd96c('0x4d')]=_['keys'](_0x1b3773[_0xd96c('0x4d')]);_0xbb0aef[_0xd96c('0x4b')]=_[_0xd96c('0x4c')](_0xbb0aef[_0xd96c('0x49')],_0xbb0aef[_0xd96c('0x4d')]);_0x12374a['attributes']=_[_0xd96c('0x4c')](_0xbb0aef[_0xd96c('0x49')],qs['fields'](_0x1b3773[_0xd96c('0x4d')][_0xd96c('0x4f')]));_0x12374a['attributes']=_0x12374a['attributes'][_0xd96c('0x50')]?_0x12374a[_0xd96c('0x4e')]:_0xbb0aef['model'];if(!_0x1b3773['query'][_0xd96c('0x67')](_0xd96c('0x51'))){_0x12374a[_0xd96c('0x33')]=qs[_0xd96c('0x33')](_0x1b3773[_0xd96c('0x4d')][_0xd96c('0x33')]);_0x12374a[_0xd96c('0x31')]=qs[_0xd96c('0x31')](_0x1b3773[_0xd96c('0x4d')][_0xd96c('0x31')]);}_0x12374a[_0xd96c('0x52')]=qs[_0xd96c('0x53')](_0x1b3773['query'][_0xd96c('0x53')]);_0x12374a[_0xd96c('0x54')]=qs[_0xd96c('0x4b')](_[_0xd96c('0x55')](_0x1b3773[_0xd96c('0x4d')],_0xbb0aef[_0xd96c('0x4b')]));_0x12374a[_0xd96c('0x54')][_0xd96c('0x64')]=_0x45e0d9['id'];if(_0x1b3773['query'][_0xd96c('0x56')]){_0x12374a['where']=_[_0xd96c('0x57')](_0x12374a['where'],{'$or':_[_0xd96c('0x44')](_0x12374a[_0xd96c('0x4e')],function(_0x58d36e){var _0x1f71db={};_0x1f71db[_0x58d36e]={'$like':'%'+_0x1b3773[_0xd96c('0x4d')][_0xd96c('0x56')]+'%'};return _0x1f71db;})});}if(_0x1b3773[_0xd96c('0x4d')][_0xd96c('0x9a')]){var _0x3c7e38=_0x1b3773[_0xd96c('0x4d')][_0xd96c('0x9a')][_0xd96c('0x9b')](',');var _0x3b1925={};_0x3b1925[_0x3c7e38[0x0]]={'$gte':moment(_0x3c7e38[0x1])['format'](_0xd96c('0x9c'))};_0x12374a['where']=_[_0xd96c('0x57')](_0x12374a['where'],_0x3b1925);}_0x12374a=_['merge']({},_0x12374a,_0x1b3773['options']);return db[_0xd96c('0x99')][_0xd96c('0x34')]({'where':_0x12374a[_0xd96c('0x54')]})[_0xd96c('0x24')](function(_0x163d71){_0x455112['count']=_0x163d71;if(_0x1b3773[_0xd96c('0x4d')][_0xd96c('0x5a')]){_0x12374a['include']=[{'all':!![]}];}return db['MailMessage'][_0xd96c('0x5c')](_0x12374a);})[_0xd96c('0x24')](function(_0x3538f0){if(_0x1b3773[_0xd96c('0x4d')][_0xd96c('0x9d')]===_0xd96c('0x9e')){for(var _0x19e05f=0x0;_0x19e05f<_0x3538f0[_0xd96c('0x50')];_0x19e05f++){_0x3538f0[_0x19e05f][_0xd96c('0x62')]=juice(_0x3538f0[_0x19e05f]['body']);}}_0x455112[_0xd96c('0x5d')]=_0x3538f0;return _0x455112;});}})['then'](respondWithFilteredResult(_0x573ec2,_0x12374a))[_0xd96c('0x2c')](handleError(_0x573ec2,null));};exports[_0xd96c('0x3e')]=function(_0x3e4477,_0x1193f0,_0xfbfca1){var _0x12eaf4,_0x2e7f9a={},_0x29c415;if(_0x3e4477[_0xd96c('0x62')]['to']){_0x29c415=_0x3e4477['body']['to'][_0xd96c('0x9b')](',')[0x0];}return db[_0xd96c('0x45')][_0xd96c('0x61')]({'where':{'id':_0x3e4477[_0xd96c('0x5e')]['id']},'include':[{'model':db[_0xd96c('0x9f')],'as':'List','include':[{'model':db['CmContact'],'as':_0xd96c('0xa0'),'where':{'email':_0x29c415},'limit':0x1,'order':[[_0xd96c('0xa1'),'DESC']]}]},{'model':db['MailServerOut'],'as':_0xd96c('0x41'),'raw':!![]}]})[_0xd96c('0x24')](handleEntityNotFound(_0x1193f0,null))[_0xd96c('0x24')](function(_0x4eabfa){if(_0x4eabfa){_0x12eaf4=_0x4eabfa;if(_0x4eabfa[_0xd96c('0x41')]){if(_['isNil'](_0x3e4477[_0xd96c('0x62')][_0xd96c('0xa2')])){_0x3e4477[_0xd96c('0x62')][_0xd96c('0xa2')]=util['format'](_0xd96c('0xa3'),_0x4eabfa['name'],_0x4eabfa[_0xd96c('0xa4')]||_0x4eabfa['Smtp']['user']);}if(_0x3e4477[_0xd96c('0x62')][_0xd96c('0xa5')]&&_0x3e4477[_0xd96c('0x62')][_0xd96c('0xa5')][_0xd96c('0x50')]){for(var _0x261614=0x0;_0x261614<_0x3e4477[_0xd96c('0x62')][_0xd96c('0xa5')][_0xd96c('0x50')];_0x261614+=0x1){_0x3e4477[_0xd96c('0x62')][_0xd96c('0xa5')][_0x261614]={'filename':_0x3e4477[_0xd96c('0x62')][_0xd96c('0xa5')][_0x261614][_0xd96c('0x3d')],'path':path['join'](config[_0xd96c('0xa6')],_0xd96c('0xa7'),_0x3e4477[_0xd96c('0x62')][_0xd96c('0xa5')][_0x261614][_0xd96c('0xa8')])};}}var _0x24fd9b={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x4eabfa[_0xd96c('0x41')]['service'])){if(_0x4eabfa['Smtp'][_0xd96c('0x77')]){_0x24fd9b[_0xd96c('0xa9')]={'user':_0x4eabfa['Smtp']['user'],'pass':_0x4eabfa['Smtp'][_0xd96c('0x76')]};}_0x24fd9b['host']=_0x4eabfa[_0xd96c('0x41')][_0xd96c('0x78')];_0x24fd9b[_0xd96c('0x79')]=_0x4eabfa['Smtp'][_0xd96c('0x79')];_0x24fd9b['secure']=_0x4eabfa[_0xd96c('0x41')]['secure'];}else{_0x24fd9b[_0xd96c('0x7a')]=_0x4eabfa[_0xd96c('0x41')][_0xd96c('0x7a')];_0x24fd9b['auth']={'user':_0x4eabfa['Smtp'][_0xd96c('0x73')],'pass':_0x4eabfa[_0xd96c('0x41')][_0xd96c('0x76')]};}return respondWithRpcPromise(_0xd96c('0xaa'),_0xd96c('0xab'),{'account':_0x24fd9b,'message':_0x3e4477['body']});}else{throw new Error(_0xd96c('0xac'));}}})[_0xd96c('0x24')](function(_0x4d5fd1){if(_0x4d5fd1){_0x2e7f9a=_0x4d5fd1;if(_0x12eaf4[_0xd96c('0xad')]){if(_0x12eaf4[_0xd96c('0xad')]['Contacts']['length']){return _0x12eaf4[_0xd96c('0xad')]['Contacts'][0x0];}else{return db[_0xd96c('0xae')][_0xd96c('0x65')](_[_0xd96c('0x1a')](_0x3e4477['body'],{'firstName':_0x3e4477['body']['to'],'email':_0x3e4477[_0xd96c('0x62')]['to'],'phone':_0x3e4477[_0xd96c('0x62')]['to'],'ListId':_0x12eaf4[_0xd96c('0xaf')]}));}}else{throw new Error(_0xd96c('0xac'));}}})[_0xd96c('0x24')](function(_0x37bcfe){if(_0x37bcfe){var _0x25ad96={'UserId':_0x3e4477[_0xd96c('0x73')]['id'],'ContactId':_0x37bcfe['id'],'MailAccountId':_0x12eaf4['id'],'inReplyTo':_0x2e7f9a[_0xd96c('0xb0')],'to':_0x3e4477[_0xd96c('0x62')][_0xd96c('0xa2')],'cc':_0x3e4477[_0xd96c('0x62')]['cc'],'subject':_0x3e4477[_0xd96c('0x62')][_0xd96c('0xb1')],'attach':_0x3e4477[_0xd96c('0x62')][_0xd96c('0xb2')],'firstMsgDirection':'out','lastMsgAt':moment()[_0xd96c('0xb3')](_0xd96c('0x9c')),'lastMsgDirection':_0xd96c('0xb4'),'Messages':[_[_0xd96c('0x57')](_0x3e4477['body'],{'messageId':_0x2e7f9a['messageId'],'sentAt':moment()[_0xd96c('0xb3')](_0xd96c('0x9c')),'read':!![],'MailAccountId':_0x12eaf4['id'],'UserId':_0x3e4477[_0xd96c('0x73')]['id'],'ContactId':_0x37bcfe['id']})]};if(_0x3e4477[_0xd96c('0x62')]['Interaction']){_0x25ad96=_[_0xd96c('0x57')](_0x25ad96,_0x3e4477['body']['Interaction']);}return db[_0xd96c('0x88')]['create'](_0x25ad96,{'include':[{'model':db[_0xd96c('0x99')],'as':'Messages'}]});}})['then'](respondWithResult(_0x1193f0,null))[_0xd96c('0x2c')](handleError(_0x1193f0,null));};exports['verifySmtp']=function(_0x149462,_0x5c9b81,_0x5bee49){return db[_0xd96c('0x45')][_0xd96c('0x61')]({'where':{'id':_0x149462[_0xd96c('0x5e')]['id']},'include':[{'model':db['MailServerOut'],'as':_0xd96c('0x41'),'raw':!![]}]})[_0xd96c('0x24')](handleEntityNotFound(_0x5c9b81,null))[_0xd96c('0x24')](function(_0x20b1f5){if(_0x20b1f5&&_0x20b1f5['Smtp']){var _0x3013c6={'id':_0x20b1f5['id'],'tls':{'rejectUnauthorized':![]}};if(_0x20b1f5[_0xd96c('0x41')][_0xd96c('0x7a')]){_0x3013c6[_0xd96c('0x7a')]=_0x20b1f5[_0xd96c('0x41')][_0xd96c('0x7a')];}else{_0x3013c6[_0xd96c('0x78')]=_0x20b1f5['Smtp'][_0xd96c('0x78')];_0x3013c6[_0xd96c('0x79')]=_0x20b1f5[_0xd96c('0x41')][_0xd96c('0x79')];_0x3013c6[_0xd96c('0xb5')]=_0x20b1f5[_0xd96c('0x41')][_0xd96c('0xb5')];}if(_0x20b1f5[_0xd96c('0x41')][_0xd96c('0x77')]){_0x3013c6[_0xd96c('0xa9')]={'user':_0x20b1f5['Smtp'][_0xd96c('0x73')],'pass':_0x20b1f5[_0xd96c('0x41')][_0xd96c('0x76')]};}return respondWithRpcPromise(_0xd96c('0xb6'),_0xd96c('0xb7'),{'account':_0x3013c6});}})[_0xd96c('0x24')](respondWithResult(_0x5c9b81,null))[_0xd96c('0x2c')](handleError(_0x5c9b81,null));};exports[_0xd96c('0xb8')]=function(_0x5ee95e,_0x14e21c){return db['MailAccount'][_0xd96c('0x61')]({'where':{'id':_0x5ee95e[_0xd96c('0x5e')]['id']}})[_0xd96c('0x24')](handleEntityNotFound(_0x14e21c,null))[_0xd96c('0x24')](function(_0xef86af){if(_0xef86af&&_0xef86af[_0xd96c('0x7a')]){throw new db['Sequelize'][(_0xd96c('0xb9'))](_0xd96c('0xba'));}return _0xef86af;})[_0xd96c('0x24')](removeEntity(_0x14e21c,null))[_0xd96c('0x2c')](handleError(_0x14e21c,null));};exports[_0xd96c('0xbb')]=function(_0x20ec95,_0x384b91,_0x7a6b9c){return db[_0xd96c('0x45')]['find']({'where':{'id':_0x20ec95['params']['id']}})[_0xd96c('0x24')](handleEntityNotFound(_0x384b91,null))[_0xd96c('0x24')](function(_0x52717d){if(_0x52717d){return _0x52717d[_0xd96c('0xbb')](_0x20ec95[_0xd96c('0x62')][_0xd96c('0x69')],_[_0xd96c('0x89')](_0x20ec95[_0xd96c('0x62')],['ids','id'])||{})[_0xd96c('0xbc')](function(_0x126d2e){for(var _0x52a2e0=0x0;_0x52a2e0<_0x20ec95[_0xd96c('0x62')][_0xd96c('0x69')][_0xd96c('0x50')];_0x52a2e0+=0x1){socket[_0xd96c('0xbd')](_0xd96c('0xbe'),{'UserId':Number(_0x20ec95[_0xd96c('0x62')][_0xd96c('0x69')][_0x52a2e0]),'MailAccountId':Number(_0x20ec95[_0xd96c('0x5e')]['id'])});}return _0x126d2e;});}})[_0xd96c('0x24')](respondWithResult(_0x384b91,null))[_0xd96c('0x2c')](handleError(_0x384b91,null));};exports['removeAgents']=function(_0x219520,_0x433b10,_0x324cdb){return db[_0xd96c('0x45')][_0xd96c('0x61')]({'where':{'id':_0x219520[_0xd96c('0x5e')]['id']}})[_0xd96c('0x24')](handleEntityNotFound(_0x433b10,null))[_0xd96c('0x24')](function(_0x5e3fbe){if(_0x5e3fbe){return _0x5e3fbe['removeAgents'](_0x219520[_0xd96c('0x4d')]['ids'])[_0xd96c('0x24')](function(){if(_[_0xd96c('0xbf')](_0x219520[_0xd96c('0x4d')]['ids'])){for(var _0x349130=0x0;_0x349130<_0x219520[_0xd96c('0x4d')]['ids'][_0xd96c('0x50')];_0x349130+=0x1){socket['emit'](_0xd96c('0xc0'),{'UserId':Number(_0x219520[_0xd96c('0x4d')][_0xd96c('0x69')][_0x349130]),'MailAccountId':Number(_0x219520['params']['id'])});}}else{socket[_0xd96c('0xbd')](_0xd96c('0xc0'),{'UserId':Number(_0x219520[_0xd96c('0x4d')][_0xd96c('0x69')]),'MailAccountId':Number(_0x219520[_0xd96c('0x5e')]['id'])});}});}})[_0xd96c('0x24')](respondWithStatusCode(_0x433b10,null))[_0xd96c('0x2c')](handleError(_0x433b10,null));};exports[_0xd96c('0xc1')]=function(_0x4f5acc,_0x5ef2b4,_0x12d379){var _0x38d479={};var _0x558bf7={};var _0xdbfc5f;var _0x289fcc;return db[_0xd96c('0x45')][_0xd96c('0x66')]({'where':{'id':_0x4f5acc[_0xd96c('0x5e')]['id']}})['then'](handleEntityNotFound(_0x5ef2b4,null))['then'](function(_0x11682c){if(_0x11682c){_0xdbfc5f=_0x11682c;_0x558bf7[_0xd96c('0x49')]=_[_0xd96c('0x4a')](db[_0xd96c('0x8c')][_0xd96c('0x46')]);_0x558bf7[_0xd96c('0x4d')]=_[_0xd96c('0x4a')](_0x4f5acc[_0xd96c('0x4d')]);_0x558bf7[_0xd96c('0x4b')]=_['intersection'](_0x558bf7[_0xd96c('0x49')],_0x558bf7['query']);_0x38d479[_0xd96c('0x4e')]=_[_0xd96c('0x4c')](_0x558bf7[_0xd96c('0x49')],qs['fields'](_0x4f5acc[_0xd96c('0x4d')][_0xd96c('0x4f')]));_0x38d479[_0xd96c('0x4e')]=_0x38d479['attributes'][_0xd96c('0x50')]?_0x38d479['attributes']:_0x558bf7[_0xd96c('0x49')];_0x38d479[_0xd96c('0x52')]=qs[_0xd96c('0x53')](_0x4f5acc[_0xd96c('0x4d')][_0xd96c('0x53')]);_0x38d479[_0xd96c('0x54')]=qs[_0xd96c('0x4b')](_['pick'](_0x4f5acc['query'],_0x558bf7[_0xd96c('0x4b')]));if(_0x4f5acc[_0xd96c('0x4d')]['filter']){_0x38d479[_0xd96c('0x54')]=_[_0xd96c('0x57')](_0x38d479[_0xd96c('0x54')],{'$or':_[_0xd96c('0x44')](_0x38d479['attributes'],function(_0x5d4cc0){var _0x49d193={};_0x49d193[_0x5d4cc0]={'$like':'%'+_0x4f5acc[_0xd96c('0x4d')][_0xd96c('0x56')]+'%'};return _0x49d193;})});}_0x38d479=_['merge']({},_0x38d479,_0x4f5acc['options']);return _0xdbfc5f[_0xd96c('0xc1')](_0x38d479);}})[_0xd96c('0x24')](function(_0x2de332){if(_0x2de332){_0x289fcc=_0x2de332['length'];if(!_0x4f5acc[_0xd96c('0x4d')][_0xd96c('0x67')](_0xd96c('0x51'))){_0x38d479['limit']=qs[_0xd96c('0x33')](_0x4f5acc[_0xd96c('0x4d')][_0xd96c('0x33')]);_0x38d479['offset']=qs[_0xd96c('0x31')](_0x4f5acc['query'][_0xd96c('0x31')]);}return _0xdbfc5f[_0xd96c('0xc1')](_0x38d479);}})[_0xd96c('0x24')](function(_0x2d9820){if(_0x2d9820){return _0x2d9820?{'count':_0x289fcc,'rows':_0x2d9820}:null;}})[_0xd96c('0x24')](respondWithResult(_0x5ef2b4,null))['catch'](handleError(_0x5ef2b4,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 6d1d637..f9a084f 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 _0xb89c=['hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount','setMaxListeners','update','remove'];(function(_0x176259,_0x30e46f){var _0x48dc40=function(_0x3aa524){while(--_0x3aa524){_0x176259['push'](_0x176259['shift']());}};_0x48dc40(++_0x30e46f);}(_0xb89c,0x198));var _0xcb89=function(_0x531007,_0x31ec8b){_0x531007=_0x531007-0x0;var _0x1938c5=_0xb89c[_0x531007];return _0x1938c5;};'use strict';var EventEmitter=require(_0xcb89('0x0'));var MailAccount=require(_0xcb89('0x1'))['db'][_0xcb89('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xcb89('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcb89('0x4'),'afterDestroy':_0xcb89('0x5')};function emitEvent(_0x57c08c){return function(_0x387b27,_0x777f33,_0x49bdbe){MailAccountEvents['emit'](_0x57c08c+':'+_0x387b27['id'],_0x387b27);MailAccountEvents['emit'](_0x57c08c,_0x387b27);_0x49bdbe(null);};}for(var e in events){if(events[_0xcb89('0x6')](e)){var event=events[e];MailAccount[_0xcb89('0x7')](e,emitEvent(event));}}module[_0xcb89('0x8')]=MailAccountEvents; \ No newline at end of file +var _0x6f83=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','MailAccount','save'];(function(_0x40baf1,_0x39a1e3){var _0x293477=function(_0xad61f0){while(--_0xad61f0){_0x40baf1['push'](_0x40baf1['shift']());}};_0x293477(++_0x39a1e3);}(_0x6f83,0x72));var _0x36f8=function(_0x323a54,_0x5319b2){_0x323a54=_0x323a54-0x0;var _0x1c3373=_0x6f83[_0x323a54];return _0x1c3373;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0x36f8('0x0'))['db'][_0x36f8('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x36f8('0x2'),'afterUpdate':_0x36f8('0x3'),'afterDestroy':_0x36f8('0x4')};function emitEvent(_0x442b8b){return function(_0x456795,_0xf53947,_0x9ed336){MailAccountEvents[_0x36f8('0x5')](_0x442b8b+':'+_0x456795['id'],_0x456795);MailAccountEvents[_0x36f8('0x5')](_0x442b8b,_0x456795);_0x9ed336(null);};}for(var e in events){if(events[_0x36f8('0x6')](e)){var event=events[e];MailAccount[_0x36f8('0x7')](e,emitEvent(event));}}module[_0x36f8('0x8')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 60ce36a..a98fa19 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 _0x20d0=['MailAccount','lodash','../../config/logger','bluebird','rimraf','exports','define'];(function(_0x2e0108,_0x569adf){var _0xf66b41=function(_0x4caf19){while(--_0x4caf19){_0x2e0108['push'](_0x2e0108['shift']());}};_0xf66b41(++_0x569adf);}(_0x20d0,0x10b));var _0x020d=function(_0xb1cf84,_0x813740){_0xb1cf84=_0xb1cf84-0x0;var _0x4bad2e=_0x20d0[_0xb1cf84];return _0x4bad2e;};'use strict';var _=require(_0x020d('0x0'));var util=require('util');var logger=require(_0x020d('0x1'))('api');var moment=require('moment');var BPromise=require(_0x020d('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x020d('0x3'));var config=require('../../config/environment');var attributes=require('./mailAccount.attributes');module[_0x020d('0x4')]=function(_0x47fa72,_0x772d06){return _0x47fa72[_0x020d('0x5')](_0x020d('0x6'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1787=['bluebird','path','rimraf','../../config/environment','MailAccount','util','../../config/logger','moment'];(function(_0x209fcd,_0x1ecccc){var _0x501d5e=function(_0x8d74fe){while(--_0x8d74fe){_0x209fcd['push'](_0x209fcd['shift']());}};_0x501d5e(++_0x1ecccc);}(_0x1787,0x1ed));var _0x7178=function(_0x1e0d54,_0x46fbec){_0x1e0d54=_0x1e0d54-0x0;var _0x244204=_0x1787[_0x1e0d54];return _0x244204;};'use strict';var _=require('lodash');var util=require(_0x7178('0x0'));var logger=require(_0x7178('0x1'))('api');var moment=require(_0x7178('0x2'));var BPromise=require(_0x7178('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7178('0x4'));var rimraf=require(_0x7178('0x5'));var config=require(_0x7178('0x6'));var attributes=require('./mailAccount.attributes');module['exports']=function(_0x56f4d8,_0x163851){return _0x56f4d8['define'](_0x7178('0x7'),attributes,{'tableName':'mail_accounts','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 2cde9e5..de7459c 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 _0x5845=['priority','asc','length','autoclose','*,*,*,*','List\x20not\x20found','contact','messageId','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Messages','inReplyTo','create','update','interaction','created','attachments','bcc','ChatWebsiteId','originChannel','Email','Attachment','UserId','User','find','name','Start','startRouting','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailAccount.socket','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','error','message','info','catch','GetMailAccount','MailAccount','findAll','options','raw','attributes','limit','include','map','model','debug','stringify','ShowMailAccount','NotifyMailAccount','body','mail','CmContact','rawAttributes','updatedAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','from','account','CmList','List','Contacts','DESC','MailApplication','Applications','Smtp','omit','applications','list','orderBy'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0x5845,0x7b));var _0x5584=function(_0x2ba0f6,_0x4f0200){_0x2ba0f6=_0x2ba0f6-0x0;var _0x48ac6b=_0x5845[_0x2ba0f6];return _0x48ac6b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5584('0x0'));var BPromise=require(_0x5584('0x1'));var rs=require(_0x5584('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5584('0x3'))['db'];var utils=require(_0x5584('0x4'));var logger=require('../../config/logger')(_0x5584('0x5'));var config=require('../../config/environment');var jayson=require(_0x5584('0x6'));var client=jayson[_0x5584('0x7')][_0x5584('0x8')]({'port':0x232c});config[_0x5584('0x9')]=_['defaults'](config[_0x5584('0x9')],{'host':_0x5584('0xa'),'port':0x18eb});var socket=require(_0x5584('0xb'))(new Redis(config[_0x5584('0x9')]));require(_0x5584('0xc'))['register'](socket);function respondWithRpcPromise(_0x1875f7,_0x487c6a,_0x53e5fb){return new BPromise(function(_0x5f52fd,_0x17f725){return client[_0x5584('0xd')](_0x1875f7,_0x53e5fb)[_0x5584('0xe')](function(_0x2c703c){logger['info'](_0x5584('0xf'),_0x487c6a,_0x5584('0x10'));logger['debug'](_0x5584('0x11'),_0x487c6a,_0x5584('0x10'),JSON['stringify'](_0x2c703c));if(_0x2c703c[_0x5584('0x12')]){if(_0x2c703c[_0x5584('0x12')]['code']===0x1f4){logger[_0x5584('0x12')](_0x5584('0xf'),_0x487c6a,_0x2c703c[_0x5584('0x12')]['message']);return _0x17f725(_0x2c703c['error'][_0x5584('0x13')]);}logger[_0x5584('0x12')](_0x5584('0xf'),_0x487c6a,_0x2c703c[_0x5584('0x12')][_0x5584('0x13')]);return _0x5f52fd(_0x2c703c['error'][_0x5584('0x13')]);}else{logger[_0x5584('0x14')](_0x5584('0xf'),_0x487c6a,_0x5584('0x10'));_0x5f52fd(_0x2c703c['result']['message']);}})[_0x5584('0x15')](function(_0x19e4d6){logger[_0x5584('0x12')](_0x5584('0xf'),_0x487c6a,_0x19e4d6);_0x17f725(_0x19e4d6);});});}exports[_0x5584('0x16')]=function(_0x2c5731){var _0xa445c4=this;return new Promise(function(_0x187e5f,_0x2c6a26){return db[_0x5584('0x17')][_0x5584('0x18')]({'raw':_0x2c5731[_0x5584('0x19')]?_0x2c5731[_0x5584('0x19')][_0x5584('0x1a')]===undefined?!![]:![]:!![],'where':_0x2c5731[_0x5584('0x19')]?_0x2c5731[_0x5584('0x19')]['where']||null:null,'attributes':_0x2c5731[_0x5584('0x19')]?_0x2c5731['options'][_0x5584('0x1b')]||null:null,'limit':_0x2c5731['options']?_0x2c5731[_0x5584('0x19')][_0x5584('0x1c')]||null:null,'include':_0x2c5731[_0x5584('0x19')]?_0x2c5731[_0x5584('0x19')][_0x5584('0x1d')]?_[_0x5584('0x1e')](_0x2c5731[_0x5584('0x19')][_0x5584('0x1d')],function(_0x5e71b5){return{'model':db[_0x5e71b5['model']],'as':_0x5e71b5['as'],'attributes':_0x5e71b5[_0x5584('0x1b')],'include':_0x5e71b5[_0x5584('0x1d')]?_['map'](_0x5e71b5[_0x5584('0x1d')],function(_0x255035){return{'model':db[_0x255035[_0x5584('0x1f')]],'as':_0x255035['as'],'attributes':_0x255035[_0x5584('0x1b')],'include':_0x255035[_0x5584('0x1d')]?_[_0x5584('0x1e')](_0x255035[_0x5584('0x1d')],function(_0x17753e){return{'model':db[_0x17753e[_0x5584('0x1f')]],'as':_0x17753e['as'],'attributes':_0x17753e[_0x5584('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5584('0xe')](function(_0x4ed60d){logger[_0x5584('0x14')](_0x5584('0x16'),_0x2c5731);logger[_0x5584('0x20')]('GetMailAccount',_0x2c5731,JSON[_0x5584('0x21')](_0x4ed60d));_0x187e5f(_0x4ed60d);})[_0x5584('0x15')](function(_0x22a668){logger['error']('GetMailAccount',_0x22a668[_0x5584('0x13')],_0x2c5731);_0x2c6a26(_0xa445c4[_0x5584('0x12')](0x1f4,_0x22a668[_0x5584('0x13')]));});});};exports[_0x5584('0x22')]=function(_0x1816a4){var _0xb74ead=this;return new Promise(function(_0x5bf8c6,_0x9cad88){return db[_0x5584('0x17')]['find']({'raw':_0x1816a4[_0x5584('0x19')]?_0x1816a4[_0x5584('0x19')][_0x5584('0x1a')]===undefined?!![]:![]:!![],'where':_0x1816a4[_0x5584('0x19')]?_0x1816a4[_0x5584('0x19')]['where']||null:null,'attributes':_0x1816a4[_0x5584('0x19')]?_0x1816a4[_0x5584('0x19')][_0x5584('0x1b')]||null:null,'include':_0x1816a4[_0x5584('0x19')]?_0x1816a4[_0x5584('0x19')]['include']?_[_0x5584('0x1e')](_0x1816a4[_0x5584('0x19')][_0x5584('0x1d')],function(_0x19b0a1){return{'model':db[_0x19b0a1['model']],'as':_0x19b0a1['as'],'attributes':_0x19b0a1[_0x5584('0x1b')],'include':_0x19b0a1[_0x5584('0x1d')]?_[_0x5584('0x1e')](_0x19b0a1[_0x5584('0x1d')],function(_0x42d7e5){return{'model':db[_0x42d7e5[_0x5584('0x1f')]],'as':_0x42d7e5['as'],'attributes':_0x42d7e5[_0x5584('0x1b')],'include':_0x42d7e5['include']?_[_0x5584('0x1e')](_0x42d7e5[_0x5584('0x1d')],function(_0x4fe8e4){return{'model':db[_0x4fe8e4['model']],'as':_0x4fe8e4['as'],'attributes':_0x4fe8e4[_0x5584('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5584('0xe')](function(_0x4d5b78){logger[_0x5584('0x14')](_0x5584('0x22'),_0x1816a4);logger[_0x5584('0x20')]('ShowMailAccount',_0x1816a4,JSON[_0x5584('0x21')](_0x4d5b78));_0x5bf8c6(_0x4d5b78);})[_0x5584('0x15')](function(_0xf3f850){logger[_0x5584('0x12')](_0x5584('0x22'),_0xf3f850[_0x5584('0x13')],_0x1816a4);_0x9cad88(_0xb74ead['error'](0x1f4,_0xf3f850[_0x5584('0x13')]));});});};exports[_0x5584('0x23')]=function(_0x260c48){var _0x201640=this;return new Promise(function(_0x23eb8c,_0x1e9b41){var _0x4b7c02={'body':_0x260c48[_0x5584('0x24')],'channel':_0x5584('0x25')};var _0x518321=_['difference'](_['keys'](db[_0x5584('0x26')][_0x5584('0x27')]),['createdAt',_0x5584('0x28'),_0x5584('0x29'),_0x5584('0x2a')]);var _0x3c0990=![];if(_0x260c48[_0x5584('0x24')]['id']){delete _0x260c48['body']['id'];}if(_[_0x5584('0x2b')](_0x260c48['body']['from'])){return _0x1e9b41(_0x201640[_0x5584('0x12')](0x1f4,_0x5584('0x2c')));}if(_[_0x5584('0x2b')](_0x260c48[_0x5584('0x24')][_0x5584('0x24')])||_0x260c48[_0x5584('0x24')]['body']===''){return _0x1e9b41(_0x201640['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x5584('0x2b')](_0x260c48[_0x5584('0x24')][_0x5584('0x2d')])){return _0x1e9b41(_0x201640[_0x5584('0x12')](0x1f4,_0x5584('0x2e')+_0x518321));}if(!_[_0x5584('0x2f')](_0x518321,_0x260c48['body'][_0x5584('0x2d')])){return _0x1e9b41(_0x201640['error'](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x518321));}var _0x52783b={};_0x52783b[_0x260c48['body'][_0x5584('0x2d')]]=_0x260c48['body'][_0x5584('0x30')];return db[_0x5584('0x17')]['find']({'where':{'id':_0x260c48[_0x5584('0x31')]['id']},'include':[{'model':db[_0x5584('0x32')],'as':_0x5584('0x33'),'include':[{'model':db[_0x5584('0x26')],'as':_0x5584('0x34'),'where':_0x52783b,'limit':0x1,'order':[[_0x5584('0x28'),_0x5584('0x35')]]}]},{'model':db[_0x5584('0x36')],'as':_0x5584('0x37')},{'model':db['MailServerOut'],'as':_0x5584('0x38')}]})[_0x5584('0xe')](function(_0x3a22b3){if(_0x3a22b3&&_0x3a22b3[_0x5584('0x33')]){var _0x5dcdfb=_0x3a22b3['get']({'plain':!![]});_0x4b7c02['account']=_[_0x5584('0x39')](_0x5dcdfb,[_0x5584('0x37'),_0x5584('0x33')]);_0x4b7c02[_0x5584('0x3a')]=_0x5dcdfb[_0x5584('0x37')];_0x4b7c02[_0x5584('0x3b')]=_0x5dcdfb[_0x5584('0x33')];_0x4b7c02[_0x5584('0x3a')]=_[_0x5584('0x3c')](_0x4b7c02[_0x5584('0x3a')],[_0x5584('0x3d')],[_0x5584('0x3e')]);if(_0x4b7c02[_0x5584('0x31')]&&_0x4b7c02['account']['autoclose']){_0x4b7c02[_0x5584('0x3a')]['push']({'id':0x0,'priority':_0x4b7c02[_0x5584('0x3a')][_0x5584('0x3f')]+0x1,'app':'close','appdata':_0x5584('0x40'),'interval':_0x5584('0x41')});}if(_0x4b7c02[_0x5584('0x31')][_0x5584('0x37')]){delete _0x4b7c02['account']['Applications'];}if(_0x4b7c02[_0x5584('0x31')][_0x5584('0x33')]){delete _0x4b7c02['account'][_0x5584('0x33')];}if(_0x5dcdfb[_0x5584('0x33')]['Contacts'][_0x5584('0x3f')]){return _0x5dcdfb[_0x5584('0x33')][_0x5584('0x34')][0x0];}var _0x1cafad=_['defaults'](_0x260c48[_0x5584('0x24')],{'firstName':_0x260c48[_0x5584('0x24')][_0x5584('0x30')],'ListId':_0x5dcdfb[_0x5584('0x2a')]});_0x1cafad[_0x260c48[_0x5584('0x24')][_0x5584('0x2d')]]=_0x260c48['body'][_0x5584('0x30')];return db[_0x5584('0x26')]['create'](_0x1cafad);}else{throw new Error(_0x5584('0x42'));}})[_0x5584('0xe')](function(_0x5685e3){_0x4b7c02[_0x5584('0x43')]=_0x5685e3;if(_0x5685e3){if(!_0x260c48[_0x5584('0x24')]['message'][_0x5584('0x44')]){_0x260c48[_0x5584('0x24')][_0x5584('0x13')][_0x5584('0x44')]=rs['generate']()+'\x20'+_0x260c48[_0x5584('0x24')][_0x5584('0x13')]['from'];}var _0x4456b6={'ContactId':_0x5685e3['id'],'MailAccountId':_0x260c48[_0x5584('0x31')]['id'],'inReplyTo':_0x260c48[_0x5584('0x24')][_0x5584('0x13')][_0x5584('0x44')],'to':_0x260c48['body'][_0x5584('0x13')]['from'],'cc':_0x260c48[_0x5584('0x24')][_0x5584('0x13')]['cc'],'subject':_0x260c48['body'][_0x5584('0x13')][_0x5584('0x45')],'attach':_0x260c48[_0x5584('0x24')][_0x5584('0x13')][_0x5584('0x46')],'lastMsgAt':moment()[_0x5584('0x47')](_0x5584('0x48')),'lastMsgDirection':'in'};return db[_0x5584('0x49')]['find']({'where':{'closed':![],'MailAccountId':_0x260c48[_0x5584('0x31')]['id']},'include':[{'model':db['MailMessage'],'as':_0x5584('0x4a'),'attributes':[_0x5584('0x44')],'where':{'messageId':_0x260c48['body'][_0x5584('0x13')][_0x5584('0x4b')]}}]})[_0x5584('0xe')](function(_0xb6dd2c){if(_0xb6dd2c){return[_0xb6dd2c,![]];}return db[_0x5584('0x49')][_0x5584('0x4c')](_0x4456b6)['then'](function(_0x261487){return[_0x261487,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x27483f,_0x32ce73){if(_0x27483f){_0x3c0990=_0x32ce73;if(!_0x32ce73){return _0x27483f[_0x5584('0x4d')]({'inReplyTo':_0x260c48[_0x5584('0x24')][_0x5584('0x13')][_0x5584('0x44')],'to':_0x260c48[_0x5584('0x24')][_0x5584('0x13')][_0x5584('0x30')],'cc':_0x260c48[_0x5584('0x24')][_0x5584('0x13')]['cc'],'subject':_0x260c48['body'][_0x5584('0x13')][_0x5584('0x45')],'attach':_0x27483f[_0x5584('0x46')]?_0x27483f[_0x5584('0x46')]:_0x260c48[_0x5584('0x24')][_0x5584('0x13')]['attach'],'substatus':null,'substatusAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()['format'](_0x5584('0x48')),'lastMsgDirection':'in'});}else{return _0x27483f;}}})['then'](function(_0x27c70){_0x4b7c02[_0x5584('0x4e')]=_0x27c70['get']({'plain':!![]});_0x4b7c02[_0x5584('0x4e')][_0x5584('0x4f')]=_0x3c0990;return db['MailMessage'][_0x5584('0x4c')]({'body':_0x260c48['body'][_0x5584('0x24')],'MailAccountId':_0x260c48['account']['id'],'MailInteractionId':_0x27c70['id'],'direction':'in','ContactId':_0x4b7c02[_0x5584('0x43')]['id'],'messageId':_0x260c48['body'][_0x5584('0x13')]['messageId'],'from':_0x260c48['body'][_0x5584('0x13')][_0x5584('0x30')],'to':_0x260c48[_0x5584('0x24')][_0x5584('0x13')]['to'],'cc':_0x260c48[_0x5584('0x24')]['message']['cc'],'subject':_0x260c48['body'][_0x5584('0x13')]['subject'],'attach':_0x260c48[_0x5584('0x24')][_0x5584('0x13')][_0x5584('0x46')],'Attachments':_0x260c48[_0x5584('0x24')][_0x5584('0x13')][_0x5584('0x50')],'originTo':_0x260c48[_0x5584('0x24')]['message']['originTo'],'originCc':_0x260c48['body'][_0x5584('0x13')]['originCc'],'bcc':_0x260c48[_0x5584('0x24')][_0x5584('0x13')][_0x5584('0x51')],'ChatWebsiteId':_0x260c48['body'][_0x5584('0x13')][_0x5584('0x52')]||null,'originChannel':_0x260c48[_0x5584('0x24')][_0x5584('0x13')][_0x5584('0x53')]||_0x5584('0x54'),'ChatOfflineMessageId':_0x260c48[_0x5584('0x24')][_0x5584('0x13')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x5584('0x55')],'as':'Attachments'}]});})[_0x5584('0xe')](function(_0x37037c){_0x4b7c02[_0x5584('0x13')]=_0x37037c;if(_0x4b7c02[_0x5584('0x4e')][_0x5584('0x56')]){return db[_0x5584('0x57')][_0x5584('0x58')]({'attributes':['id','name'],'where':{'id':_0x4b7c02[_0x5584('0x4e')]['UserId']}})[_0x5584('0xe')](function(_0x5cbafe){if(_0x5cbafe){_0x4b7c02[_0x5584('0x3a')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5cbafe[_0x5584('0x59')]+','+(_0x4b7c02[_0x5584('0x31')]['waitForTheAssignedAgent']||0xa),'interval':_0x5584('0x41')});}return respondWithRpcPromise(_0x5584('0x5a'),_0x5584('0x5b'),_0x4b7c02);});}return respondWithRpcPromise('Start',_0x5584('0x5b'),_0x4b7c02);})[_0x5584('0xe')](function(_0x39633d){_0x23eb8c(_0x39633d);})[_0x5584('0x15')](function(_0x21a0b1){_0x1e9b41(_0x201640['error'](0x1f4,_0x21a0b1[_0x5584('0x13')]));});});}; \ No newline at end of file +var _0x9070=['mail','difference','CmContact','createdAt','updatedAt','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','List','Contacts','Applications','Smtp','get','omit','applications','list','orderBy','priority','asc','push','length','close','autoclose','*,*,*,*','List\x20not\x20found','contact','messageId','subject','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','inReplyTo','create','Contact\x20not\x20found','spread','update','attach','interaction','created','MailMessage','attachments','originTo','originCc','ChatWebsiteId','originChannel','Email','Attachment','Attachments','UserId','User','find','name','agent','Start','startRouting','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetMailAccount','MailAccount','options','raw','where','attributes','limit','include','map','model','then','ShowMailAccount','debug','body'];(function(_0x18f917,_0x4d3ae5){var _0x4d013d=function(_0x5c9acc){while(--_0x5c9acc){_0x18f917['push'](_0x18f917['shift']());}};_0x4d013d(++_0x4d3ae5);}(_0x9070,0x16a));var _0x0907=function(_0x120376,_0x571898){_0x120376=_0x120376-0x0;var _0x28c529=_0x9070[_0x120376];return _0x28c529;};'use strict';var _=require(_0x0907('0x0'));var util=require(_0x0907('0x1'));var moment=require(_0x0907('0x2'));var BPromise=require(_0x0907('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0907('0x4'));var db=require(_0x0907('0x5'))['db'];var utils=require(_0x0907('0x6'));var logger=require(_0x0907('0x7'))('rpc');var config=require(_0x0907('0x8'));var jayson=require(_0x0907('0x9'));var client=jayson[_0x0907('0xa')][_0x0907('0xb')]({'port':0x232c});config[_0x0907('0xc')]=_[_0x0907('0xd')](config[_0x0907('0xc')],{'host':_0x0907('0xe'),'port':0x18eb});var socket=require(_0x0907('0xf'))(new Redis(config[_0x0907('0xc')]));require(_0x0907('0x10'))[_0x0907('0x11')](socket);function respondWithRpcPromise(_0x2e2b36,_0x1fe97b,_0x35a0de){return new BPromise(function(_0x77580e,_0x5508e4){return client['request'](_0x2e2b36,_0x35a0de)['then'](function(_0x9cd908){logger[_0x0907('0x12')](_0x0907('0x13'),_0x1fe97b,_0x0907('0x14'));logger['debug'](_0x0907('0x15'),_0x1fe97b,_0x0907('0x14'),JSON[_0x0907('0x16')](_0x9cd908));if(_0x9cd908['error']){if(_0x9cd908['error'][_0x0907('0x17')]===0x1f4){logger[_0x0907('0x18')](_0x0907('0x13'),_0x1fe97b,_0x9cd908[_0x0907('0x18')][_0x0907('0x19')]);return _0x5508e4(_0x9cd908[_0x0907('0x18')][_0x0907('0x19')]);}logger[_0x0907('0x18')]('MailAccount,\x20%s,\x20%s',_0x1fe97b,_0x9cd908[_0x0907('0x18')][_0x0907('0x19')]);return _0x77580e(_0x9cd908[_0x0907('0x18')][_0x0907('0x19')]);}else{logger[_0x0907('0x12')](_0x0907('0x13'),_0x1fe97b,_0x0907('0x14'));_0x77580e(_0x9cd908[_0x0907('0x1a')][_0x0907('0x19')]);}})[_0x0907('0x1b')](function(_0xe84ec4){logger['error'](_0x0907('0x13'),_0x1fe97b,_0xe84ec4);_0x5508e4(_0xe84ec4);});});}exports[_0x0907('0x1c')]=function(_0x3d6095){var _0x30c6d7=this;return new Promise(function(_0x1140b3,_0x106d28){return db[_0x0907('0x1d')]['findAll']({'raw':_0x3d6095[_0x0907('0x1e')]?_0x3d6095[_0x0907('0x1e')][_0x0907('0x1f')]===undefined?!![]:![]:!![],'where':_0x3d6095['options']?_0x3d6095['options'][_0x0907('0x20')]||null:null,'attributes':_0x3d6095[_0x0907('0x1e')]?_0x3d6095[_0x0907('0x1e')][_0x0907('0x21')]||null:null,'limit':_0x3d6095[_0x0907('0x1e')]?_0x3d6095[_0x0907('0x1e')][_0x0907('0x22')]||null:null,'include':_0x3d6095[_0x0907('0x1e')]?_0x3d6095[_0x0907('0x1e')][_0x0907('0x23')]?_[_0x0907('0x24')](_0x3d6095[_0x0907('0x1e')]['include'],function(_0x2b293e){return{'model':db[_0x2b293e[_0x0907('0x25')]],'as':_0x2b293e['as'],'attributes':_0x2b293e[_0x0907('0x21')],'include':_0x2b293e['include']?_[_0x0907('0x24')](_0x2b293e['include'],function(_0x1c276e){return{'model':db[_0x1c276e['model']],'as':_0x1c276e['as'],'attributes':_0x1c276e[_0x0907('0x21')],'include':_0x1c276e[_0x0907('0x23')]?_[_0x0907('0x24')](_0x1c276e['include'],function(_0x5d87e6){return{'model':db[_0x5d87e6[_0x0907('0x25')]],'as':_0x5d87e6['as'],'attributes':_0x5d87e6['attributes']};}):[]};}):[]};}):[]:[]})[_0x0907('0x26')](function(_0x49fde2){logger[_0x0907('0x12')]('GetMailAccount',_0x3d6095);logger['debug'](_0x0907('0x1c'),_0x3d6095,JSON[_0x0907('0x16')](_0x49fde2));_0x1140b3(_0x49fde2);})['catch'](function(_0x465ca2){logger[_0x0907('0x18')]('GetMailAccount',_0x465ca2['message'],_0x3d6095);_0x106d28(_0x30c6d7[_0x0907('0x18')](0x1f4,_0x465ca2[_0x0907('0x19')]));});});};exports[_0x0907('0x27')]=function(_0x15eeeb){var _0x508b25=this;return new Promise(function(_0x5ca4a9,_0x488b7b){return db[_0x0907('0x1d')]['find']({'raw':_0x15eeeb['options']?_0x15eeeb[_0x0907('0x1e')][_0x0907('0x1f')]===undefined?!![]:![]:!![],'where':_0x15eeeb[_0x0907('0x1e')]?_0x15eeeb[_0x0907('0x1e')]['where']||null:null,'attributes':_0x15eeeb['options']?_0x15eeeb['options'][_0x0907('0x21')]||null:null,'include':_0x15eeeb[_0x0907('0x1e')]?_0x15eeeb['options'][_0x0907('0x23')]?_[_0x0907('0x24')](_0x15eeeb['options'][_0x0907('0x23')],function(_0x4daa79){return{'model':db[_0x4daa79[_0x0907('0x25')]],'as':_0x4daa79['as'],'attributes':_0x4daa79[_0x0907('0x21')],'include':_0x4daa79[_0x0907('0x23')]?_['map'](_0x4daa79[_0x0907('0x23')],function(_0x3e69d1){return{'model':db[_0x3e69d1[_0x0907('0x25')]],'as':_0x3e69d1['as'],'attributes':_0x3e69d1[_0x0907('0x21')],'include':_0x3e69d1[_0x0907('0x23')]?_['map'](_0x3e69d1[_0x0907('0x23')],function(_0x481e22){return{'model':db[_0x481e22[_0x0907('0x25')]],'as':_0x481e22['as'],'attributes':_0x481e22['attributes']};}):[]};}):[]};}):[]:[]})[_0x0907('0x26')](function(_0x2188d7){logger[_0x0907('0x12')]('ShowMailAccount',_0x15eeeb);logger[_0x0907('0x28')](_0x0907('0x27'),_0x15eeeb,JSON[_0x0907('0x16')](_0x2188d7));_0x5ca4a9(_0x2188d7);})[_0x0907('0x1b')](function(_0x396ce5){logger['error']('ShowMailAccount',_0x396ce5[_0x0907('0x19')],_0x15eeeb);_0x488b7b(_0x508b25[_0x0907('0x18')](0x1f4,_0x396ce5[_0x0907('0x19')]));});});};exports['NotifyMailAccount']=function(_0x31d371){var _0x6a56d0=this;return new Promise(function(_0xca00f4,_0x4fac22){var _0x425caf={'body':_0x31d371[_0x0907('0x29')],'channel':_0x0907('0x2a')};var _0x4957ca=_[_0x0907('0x2b')](_['keys'](db[_0x0907('0x2c')]['rawAttributes']),[_0x0907('0x2d'),_0x0907('0x2e'),'CompanyId','ListId']);var _0x219665=![];if(_0x31d371[_0x0907('0x29')]['id']){delete _0x31d371[_0x0907('0x29')]['id'];}if(_[_0x0907('0x2f')](_0x31d371[_0x0907('0x29')][_0x0907('0x30')])){return _0x4fac22(_0x6a56d0[_0x0907('0x18')](0x1f4,_0x0907('0x31')));}if(_['isNil'](_0x31d371[_0x0907('0x29')]['body'])||_0x31d371[_0x0907('0x29')][_0x0907('0x29')]===''){return _0x4fac22(_0x6a56d0[_0x0907('0x18')](0x1f4,_0x0907('0x32')));}if(_['isNil'](_0x31d371[_0x0907('0x29')][_0x0907('0x33')])){return _0x4fac22(_0x6a56d0[_0x0907('0x18')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4957ca));}if(!_['includes'](_0x4957ca,_0x31d371[_0x0907('0x29')][_0x0907('0x33')])){return _0x4fac22(_0x6a56d0[_0x0907('0x18')](0x1f4,_0x0907('0x34')+_0x4957ca));}var _0x1c83fa={};_0x1c83fa[_0x31d371[_0x0907('0x29')][_0x0907('0x33')]]=_0x31d371['body'][_0x0907('0x30')];return db[_0x0907('0x1d')]['find']({'where':{'id':_0x31d371[_0x0907('0x35')]['id']},'include':[{'model':db['CmList'],'as':_0x0907('0x36'),'include':[{'model':db[_0x0907('0x2c')],'as':_0x0907('0x37'),'where':_0x1c83fa,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db['MailApplication'],'as':_0x0907('0x38')},{'model':db['MailServerOut'],'as':_0x0907('0x39')}]})[_0x0907('0x26')](function(_0x100601){if(_0x100601&&_0x100601['List']){var _0x1bd335=_0x100601[_0x0907('0x3a')]({'plain':!![]});_0x425caf[_0x0907('0x35')]=_[_0x0907('0x3b')](_0x1bd335,[_0x0907('0x38'),'List']);_0x425caf[_0x0907('0x3c')]=_0x1bd335[_0x0907('0x38')];_0x425caf[_0x0907('0x3d')]=_0x1bd335['List'];_0x425caf[_0x0907('0x3c')]=_[_0x0907('0x3e')](_0x425caf['applications'],[_0x0907('0x3f')],[_0x0907('0x40')]);if(_0x425caf[_0x0907('0x35')]&&_0x425caf[_0x0907('0x35')]['autoclose']){_0x425caf[_0x0907('0x3c')][_0x0907('0x41')]({'id':0x0,'priority':_0x425caf[_0x0907('0x3c')][_0x0907('0x42')]+0x1,'app':_0x0907('0x43'),'appdata':_0x0907('0x44'),'interval':_0x0907('0x45')});}if(_0x425caf[_0x0907('0x35')][_0x0907('0x38')]){delete _0x425caf[_0x0907('0x35')][_0x0907('0x38')];}if(_0x425caf[_0x0907('0x35')][_0x0907('0x36')]){delete _0x425caf[_0x0907('0x35')][_0x0907('0x36')];}if(_0x1bd335[_0x0907('0x36')]['Contacts'][_0x0907('0x42')]){return _0x1bd335[_0x0907('0x36')][_0x0907('0x37')][0x0];}var _0x3b5e44=_[_0x0907('0xd')](_0x31d371[_0x0907('0x29')],{'firstName':_0x31d371[_0x0907('0x29')][_0x0907('0x30')],'ListId':_0x1bd335['ListId']});_0x3b5e44[_0x31d371['body'][_0x0907('0x33')]]=_0x31d371['body']['from'];return db[_0x0907('0x2c')]['create'](_0x3b5e44);}else{throw new Error(_0x0907('0x46'));}})[_0x0907('0x26')](function(_0x552b6f){_0x425caf[_0x0907('0x47')]=_0x552b6f;if(_0x552b6f){if(!_0x31d371['body']['message'][_0x0907('0x48')]){_0x31d371['body'][_0x0907('0x19')][_0x0907('0x48')]=rs['generate']()+'\x20'+_0x31d371['body'][_0x0907('0x19')][_0x0907('0x30')];}var _0x710d90={'ContactId':_0x552b6f['id'],'MailAccountId':_0x31d371[_0x0907('0x35')]['id'],'inReplyTo':_0x31d371[_0x0907('0x29')]['message'][_0x0907('0x48')],'to':_0x31d371['body'][_0x0907('0x19')][_0x0907('0x30')],'cc':_0x31d371[_0x0907('0x29')]['message']['cc'],'subject':_0x31d371['body'][_0x0907('0x19')][_0x0907('0x49')],'attach':_0x31d371[_0x0907('0x29')][_0x0907('0x19')]['attach'],'lastMsgAt':moment()[_0x0907('0x4a')](_0x0907('0x4b')),'lastMsgDirection':'in'};return db[_0x0907('0x4c')]['find']({'where':{'closed':![],'MailAccountId':_0x31d371[_0x0907('0x35')]['id']},'include':[{'model':db['MailMessage'],'as':'Messages','attributes':['messageId'],'where':{'messageId':_0x31d371[_0x0907('0x29')][_0x0907('0x19')][_0x0907('0x4d')]}}]})['then'](function(_0x134fe3){if(_0x134fe3){return[_0x134fe3,![]];}return db['MailInteraction'][_0x0907('0x4e')](_0x710d90)[_0x0907('0x26')](function(_0x42d800){return[_0x42d800,!![]];});});}else{throw new Error(_0x0907('0x4f'));}})[_0x0907('0x50')](function(_0x14717f,_0x24fd16){if(_0x14717f){_0x219665=_0x24fd16;if(!_0x24fd16){return _0x14717f[_0x0907('0x51')]({'inReplyTo':_0x31d371[_0x0907('0x29')][_0x0907('0x19')][_0x0907('0x48')],'to':_0x31d371['body'][_0x0907('0x19')][_0x0907('0x30')],'cc':_0x31d371['body'][_0x0907('0x19')]['cc'],'subject':_0x31d371['body'][_0x0907('0x19')][_0x0907('0x49')],'attach':_0x14717f[_0x0907('0x52')]?_0x14717f[_0x0907('0x52')]:_0x31d371['body'][_0x0907('0x19')]['attach'],'substatus':null,'substatusAt':moment()['format'](_0x0907('0x4b')),'lastMsgAt':moment()[_0x0907('0x4a')](_0x0907('0x4b')),'lastMsgDirection':'in'});}else{return _0x14717f;}}})['then'](function(_0x219dbf){_0x425caf[_0x0907('0x53')]=_0x219dbf[_0x0907('0x3a')]({'plain':!![]});_0x425caf[_0x0907('0x53')][_0x0907('0x54')]=_0x219665;return db[_0x0907('0x55')][_0x0907('0x4e')]({'body':_0x31d371[_0x0907('0x29')][_0x0907('0x29')],'MailAccountId':_0x31d371[_0x0907('0x35')]['id'],'MailInteractionId':_0x219dbf['id'],'direction':'in','ContactId':_0x425caf[_0x0907('0x47')]['id'],'messageId':_0x31d371['body']['message'][_0x0907('0x48')],'from':_0x31d371[_0x0907('0x29')][_0x0907('0x19')][_0x0907('0x30')],'to':_0x31d371[_0x0907('0x29')]['message']['to'],'cc':_0x31d371[_0x0907('0x29')][_0x0907('0x19')]['cc'],'subject':_0x31d371[_0x0907('0x29')][_0x0907('0x19')][_0x0907('0x49')],'attach':_0x31d371[_0x0907('0x29')]['message'][_0x0907('0x52')],'Attachments':_0x31d371[_0x0907('0x29')][_0x0907('0x19')][_0x0907('0x56')],'originTo':_0x31d371[_0x0907('0x29')][_0x0907('0x19')][_0x0907('0x57')],'originCc':_0x31d371[_0x0907('0x29')][_0x0907('0x19')][_0x0907('0x58')],'bcc':_0x31d371[_0x0907('0x29')][_0x0907('0x19')]['bcc'],'ChatWebsiteId':_0x31d371[_0x0907('0x29')][_0x0907('0x19')][_0x0907('0x59')]||null,'originChannel':_0x31d371[_0x0907('0x29')][_0x0907('0x19')][_0x0907('0x5a')]||_0x0907('0x5b'),'ChatOfflineMessageId':_0x31d371[_0x0907('0x29')][_0x0907('0x19')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x0907('0x5c')],'as':_0x0907('0x5d')}]});})[_0x0907('0x26')](function(_0x1e552f){_0x425caf[_0x0907('0x19')]=_0x1e552f;if(_0x425caf[_0x0907('0x53')][_0x0907('0x5e')]){return db[_0x0907('0x5f')][_0x0907('0x60')]({'attributes':['id',_0x0907('0x61')],'where':{'id':_0x425caf['interaction']['UserId']}})[_0x0907('0x26')](function(_0x8f63ee){if(_0x8f63ee){_0x425caf['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x0907('0x62'),'appdata':_0x8f63ee[_0x0907('0x61')]+','+(_0x425caf[_0x0907('0x35')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x0907('0x63'),_0x0907('0x64'),_0x425caf);});}return respondWithRpcPromise(_0x0907('0x63'),'startRouting',_0x425caf);})[_0x0907('0x26')](function(_0x408018){_0xca00f4(_0x408018);})[_0x0907('0x1b')](function(_0x51dfbb){_0x4fac22(_0x6a56d0[_0x0907('0x18')](0x1f4,_0x51dfbb[_0x0907('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index e9ec861..f6af946 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 _0xd350=['update','emit','register','./mailAccount.events','remove'];(function(_0x41373c,_0x41cbb6){var _0x256db0=function(_0x50a681){while(--_0x50a681){_0x41373c['push'](_0x41373c['shift']());}};_0x256db0(++_0x41cbb6);}(_0xd350,0x7b));var _0x0d35=function(_0x2f57b2,_0xa8e91a){_0x2f57b2=_0x2f57b2-0x0;var _0x5ace77=_0xd350[_0x2f57b2];return _0x5ace77;};'use strict';var MailAccountEvents=require(_0x0d35('0x0'));var events=['save',_0x0d35('0x1'),_0x0d35('0x2')];function createListener(_0x4d44a8,_0x22eee7){return function(_0x1b6a18){_0x22eee7[_0x0d35('0x3')](_0x4d44a8,_0x1b6a18);};}function removeListener(_0x58dddb,_0x8866a2){return function(){MailAccountEvents['removeListener'](_0x58dddb,_0x8866a2);};}exports[_0x0d35('0x4')]=function(_0x5d342c){for(var _0x2b5df5=0x0,_0x344975=events['length'];_0x2b5df5<_0x344975;_0x2b5df5++){var _0x93dcf0=events[_0x2b5df5];var _0x22b862=createListener('mailAccount:'+_0x93dcf0,_0x5d342c);MailAccountEvents['on'](_0x93dcf0,_0x22b862);}}; \ No newline at end of file +var _0x85eb=['./mailAccount.events','remove','update','emit','removeListener','register','length'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x85eb,0x150));var _0xb85e=function(_0x5821e2,_0x3aa1f4){_0x5821e2=_0x5821e2-0x0;var _0x4c7867=_0x85eb[_0x5821e2];return _0x4c7867;};'use strict';var MailAccountEvents=require(_0xb85e('0x0'));var events=['save',_0xb85e('0x1'),_0xb85e('0x2')];function createListener(_0x4fe0c2,_0x2b969d){return function(_0x393098){_0x2b969d[_0xb85e('0x3')](_0x4fe0c2,_0x393098);};}function removeListener(_0x1e5088,_0x1a7e16){return function(){MailAccountEvents[_0xb85e('0x4')](_0x1e5088,_0x1a7e16);};}exports[_0xb85e('0x5')]=function(_0x354212){for(var _0x212a1b=0x0,_0x221adc=events[_0xb85e('0x6')];_0x212a1b<_0x221adc;_0x212a1b++){var _0xd078ef=events[_0x212a1b];var _0x125890=createListener('mailAccount:'+_0xd078ef,_0x354212);MailAccountEvents['on'](_0xd078ef,_0x125890);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 83bd5d7..bcd5a96 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 _0xf8c0=['../../config/environment','./mailApplication.controller','/:id','isAuthenticated','show','put','update','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x5a056b,_0x554372){var _0x310109=function(_0x127549){while(--_0x127549){_0x5a056b['push'](_0x5a056b['shift']());}};_0x310109(++_0x554372);}(_0xf8c0,0x81));var _0x0f8c=function(_0x29d6e6,_0x264220){_0x29d6e6=_0x29d6e6-0x0;var _0xc75ff0=_0xf8c0[_0x29d6e6];return _0xc75ff0;};'use strict';var multer=require(_0x0f8c('0x0'));var util=require(_0x0f8c('0x1'));var path=require('path');var timeout=require(_0x0f8c('0x2'));var express=require(_0x0f8c('0x3'));var router=express[_0x0f8c('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0f8c('0x5'));var config=require(_0x0f8c('0x6'));var controller=require(_0x0f8c('0x7'));router['get'](_0x0f8c('0x8'),auth[_0x0f8c('0x9')](),controller[_0x0f8c('0xa')]);router[_0x0f8c('0xb')]('/:id',auth[_0x0f8c('0x9')](),controller[_0x0f8c('0xc')]);router['delete'](_0x0f8c('0x8'),auth[_0x0f8c('0x9')](),controller[_0x0f8c('0xd')]);module[_0x0f8c('0xe')]=router; \ No newline at end of file +var _0xd6e7=['put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show'];(function(_0x58b301,_0x45e991){var _0x2171b3=function(_0x30b475){while(--_0x30b475){_0x58b301['push'](_0x58b301['shift']());}};_0x2171b3(++_0x45e991);}(_0xd6e7,0x18a));var _0x7d6e=function(_0x230bb8,_0xa1718){_0x230bb8=_0x230bb8-0x0;var _0x16cb9a=_0xd6e7[_0x230bb8];return _0x16cb9a;};'use strict';var multer=require(_0x7d6e('0x0'));var util=require(_0x7d6e('0x1'));var path=require(_0x7d6e('0x2'));var timeout=require(_0x7d6e('0x3'));var express=require(_0x7d6e('0x4'));var router=express[_0x7d6e('0x5')]();var fs_extra=require(_0x7d6e('0x6'));var auth=require(_0x7d6e('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x7d6e('0x8'));var controller=require(_0x7d6e('0x9'));router[_0x7d6e('0xa')](_0x7d6e('0xb'),auth[_0x7d6e('0xc')](),controller[_0x7d6e('0xd')]);router[_0x7d6e('0xe')](_0x7d6e('0xb'),auth['isAuthenticated'](),controller[_0x7d6e('0xf')]);router['delete'](_0x7d6e('0xb'),auth[_0x7d6e('0xc')](),controller['destroy']);module[_0x7d6e('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 856ee94..652c298 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 _0xb2bb=['STRING','noop','TEXT','sequelize','exports','INTEGER'];(function(_0x153619,_0x1db1c8){var _0x21fdb3=function(_0x5a35d7){while(--_0x5a35d7){_0x153619['push'](_0x153619['shift']());}};_0x21fdb3(++_0x1db1c8);}(_0xb2bb,0xa5));var _0xbb2b=function(_0x4fc421,_0x94e88){_0x4fc421=_0x4fc421-0x0;var _0x8c6d63=_0xb2bb[_0x4fc421];return _0x8c6d63;};'use strict';var Sequelize=require(_0xbb2b('0x0'));module[_0xbb2b('0x1')]={'priority':{'type':Sequelize[_0xbb2b('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xbb2b('0x3')],'allowNull':![],'defaultValue':_0xbb2b('0x4')},'appdata':{'type':Sequelize[_0xbb2b('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xbb2b('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x995e=['INTEGER','noop','TEXT','STRING','sequelize','exports'];(function(_0x180b2e,_0x255d2e){var _0x4087a6=function(_0x2198e3){while(--_0x2198e3){_0x180b2e['push'](_0x180b2e['shift']());}};_0x4087a6(++_0x255d2e);}(_0x995e,0xe8));var _0xe995=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x995e[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xe995('0x0'));module[_0xe995('0x1')]={'priority':{'type':Sequelize[_0xe995('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xe995('0x3')},'appdata':{'type':Sequelize[_0xe995('0x4')]()},'description':{'type':Sequelize[_0xe995('0x5')]},'interval':{'type':Sequelize[_0xe995('0x5')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 6f4ae9d..a521cb2 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(_0x208505,_0x241a77){var _0x1a985f=function(_0x4a5110){while(--_0x4a5110){_0x208505['push'](_0x208505['shift']());}};_0x1a985f(++_0x241a77);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x2179e3,_0x3f7767){_0x2179e3=_0x2179e3-0x0;var _0x3a350b=_0xbdb7[_0x2179e3];return _0x3a350b;};'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 _0xa9e0=['includeAll','merge','options','find','catch','body','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','show','params','model','MailApplication','rawAttributes','query','keys','filters','intersection','attributes','fields','length'];(function(_0x1bfade,_0x27e2ec){var _0x27f624=function(_0xa704f5){while(--_0xa704f5){_0x1bfade['push'](_0x1bfade['shift']());}};_0x27f624(++_0x27e2ec);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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={'raw':!![],'where':{'id':_0x25fba9[_0x0a9e('0x28')]['id']}},_0x1538a4={};_0x1538a4[_0x0a9e('0x29')]=_['keys'](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x25fba9['query']);_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],_0x1538a4[_0x0a9e('0x2c')]);_0x140511[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],qs[_0x0a9e('0x31')](_0x25fba9[_0x0a9e('0x2c')]['fields']));_0x140511[_0x0a9e('0x30')]=_0x140511['attributes'][_0x0a9e('0x32')]?_0x140511[_0x0a9e('0x30')]:_0x1538a4[_0x0a9e('0x29')];if(_0x25fba9[_0x0a9e('0x2c')][_0x0a9e('0x33')]){_0x140511['include']=[{'all':!![]}];}_0x140511=_[_0x0a9e('0x34')]({},_0x140511,_0x25fba9[_0x0a9e('0x35')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x36')](_0x140511)[_0x0a9e('0x22')](handleEntityNotFound(_0x14433c,null))[_0x0a9e('0x22')](respondWithResult(_0x14433c,null))[_0x0a9e('0x37')](handleError(_0x14433c,null));};exports[_0x0a9e('0x21')]=function(_0x5583a4,_0x44295a){if(_0x5583a4['body']['id']){delete _0x5583a4[_0x0a9e('0x38')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x36')]({'where':{'id':_0x5583a4[_0x0a9e('0x28')]['id']}})['then'](handleEntityNotFound(_0x44295a,null))[_0x0a9e('0x22')](saveUpdates(_0x5583a4[_0x0a9e('0x38')],null))[_0x0a9e('0x22')](respondWithResult(_0x44295a,null))[_0x0a9e('0x37')](handleError(_0x44295a,null));};exports['destroy']=function(_0x54135e,_0x1e8694){return db['MailApplication'][_0x0a9e('0x36')]({'where':{'id':_0x54135e[_0x0a9e('0x28')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1e8694,null))[_0x0a9e('0x22')](removeEntity(_0x1e8694,null))['catch'](handleError(_0x1e8694,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index a82ecf4..8aba835 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 _0x47ec=['util','api','bluebird','request-promise','path','rimraf','./mailApplication.attributes','exports','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x47ec,0x178));var _0xc47e=function(_0x18f4c4,_0x3dabc6){_0x18f4c4=_0x18f4c4-0x0;var _0x492816=_0x47ec[_0x18f4c4];return _0x492816;};'use strict';var _=require(_0xc47e('0x0'));var util=require(_0xc47e('0x1'));var logger=require('../../config/logger')(_0xc47e('0x2'));var moment=require('moment');var BPromise=require(_0xc47e('0x3'));var rp=require(_0xc47e('0x4'));var fs=require('fs');var path=require(_0xc47e('0x5'));var rimraf=require(_0xc47e('0x6'));var config=require('../../config/environment');var attributes=require(_0xc47e('0x7'));module[_0xc47e('0x8')]=function(_0x234a0e,_0x3f7354){return _0x234a0e['define'](_0xc47e('0x9'),attributes,{'tableName':_0xc47e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc47e('0xb'),'collate':_0xc47e('0xc')});}; \ No newline at end of file +var _0x70c2=['api','moment','bluebird','rimraf','../../config/environment','./mailApplication.attributes','exports','define','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x1a22e9,_0x5a2229){var _0x5dafe9=function(_0x5b560f){while(--_0x5b560f){_0x1a22e9['push'](_0x1a22e9['shift']());}};_0x5dafe9(++_0x5a2229);}(_0x70c2,0x123));var _0x270c=function(_0x4881e3,_0x460e88){_0x4881e3=_0x4881e3-0x0;var _0x288a81=_0x70c2[_0x4881e3];return _0x288a81;};'use strict';var _=require(_0x270c('0x0'));var util=require(_0x270c('0x1'));var logger=require(_0x270c('0x2'))(_0x270c('0x3'));var moment=require(_0x270c('0x4'));var BPromise=require(_0x270c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x270c('0x6'));var config=require(_0x270c('0x7'));var attributes=require(_0x270c('0x8'));module[_0x270c('0x9')]=function(_0x1ee4b1,_0x33ea4a){return _0x1ee4b1[_0x270c('0xa')]('MailApplication',attributes,{'tableName':_0x270c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x270c('0xc'),'collate':_0x270c('0xd')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 7e9a8d4..84c4e1d 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 _0xb8d7=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','MailApplication,\x20%s,\x20%s','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','UpdateMailApplication','body','options','raw','where','attributes','debug','lodash','util','moment'];(function(_0x2c36c5,_0x5e95e9){var _0x148d84=function(_0x1d99b4){while(--_0x1d99b4){_0x2c36c5['push'](_0x2c36c5['shift']());}};_0x148d84(++_0x5e95e9);}(_0xb8d7,0x135));var _0x7b8d=function(_0xcd0918,_0x56bdf9){_0xcd0918=_0xcd0918-0x0;var _0x250704=_0xb8d7[_0xcd0918];return _0x250704;};'use strict';var _=require(_0x7b8d('0x0'));var util=require(_0x7b8d('0x1'));var moment=require(_0x7b8d('0x2'));var BPromise=require('bluebird');var rs=require(_0x7b8d('0x3'));var fs=require('fs');var Redis=require(_0x7b8d('0x4'));var db=require(_0x7b8d('0x5'))['db'];var utils=require(_0x7b8d('0x6'));var logger=require(_0x7b8d('0x7'))('rpc');var config=require(_0x7b8d('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b8d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48e601,_0x728834,_0x38af55){return new BPromise(function(_0x368ef9,_0x409e91){return client[_0x7b8d('0xa')](_0x48e601,_0x38af55)[_0x7b8d('0xb')](function(_0x30c2b8){logger[_0x7b8d('0xc')](_0x7b8d('0xd'),_0x728834,'request\x20sent');logger['debug'](_0x7b8d('0xe'),_0x728834,_0x7b8d('0xf'),JSON[_0x7b8d('0x10')](_0x30c2b8));if(_0x30c2b8[_0x7b8d('0x11')]){if(_0x30c2b8[_0x7b8d('0x11')]['code']===0x1f4){logger[_0x7b8d('0x11')](_0x7b8d('0xd'),_0x728834,_0x30c2b8[_0x7b8d('0x11')][_0x7b8d('0x12')]);return _0x409e91(_0x30c2b8[_0x7b8d('0x11')][_0x7b8d('0x12')]);}logger[_0x7b8d('0x11')](_0x7b8d('0xd'),_0x728834,_0x30c2b8['error']['message']);return _0x368ef9(_0x30c2b8[_0x7b8d('0x11')][_0x7b8d('0x12')]);}else{logger[_0x7b8d('0xc')](_0x7b8d('0xd'),_0x728834,_0x7b8d('0xf'));_0x368ef9(_0x30c2b8['result']['message']);}})['catch'](function(_0x31b3ec){logger[_0x7b8d('0x11')](_0x7b8d('0xd'),_0x728834,_0x31b3ec);_0x409e91(_0x31b3ec);});});}exports[_0x7b8d('0x13')]=function(_0x5e537b){var _0x236acd=this;return new Promise(function(_0x55a623,_0x2caff9){return db['MailApplication']['update'](_0x5e537b[_0x7b8d('0x14')],{'raw':_0x5e537b[_0x7b8d('0x15')]?_0x5e537b[_0x7b8d('0x15')][_0x7b8d('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e537b[_0x7b8d('0x15')]?_0x5e537b[_0x7b8d('0x15')][_0x7b8d('0x17')]||null:null,'attributes':_0x5e537b[_0x7b8d('0x15')]?_0x5e537b[_0x7b8d('0x15')][_0x7b8d('0x18')]||null:null,'limit':_0x5e537b[_0x7b8d('0x15')]?_0x5e537b['options']['limit']||null:null})[_0x7b8d('0xb')](function(_0x143694){logger[_0x7b8d('0xc')](_0x7b8d('0x13'),_0x5e537b);logger[_0x7b8d('0x19')](_0x7b8d('0x13'),_0x5e537b,JSON[_0x7b8d('0x10')](_0x143694));_0x55a623(_0x143694);})['catch'](function(_0x3aefd7){logger['error'](_0x7b8d('0x13'),_0x3aefd7[_0x7b8d('0x12')],_0x5e537b);_0x2caff9(_0x236acd['error'](0x1f4,_0x3aefd7[_0x7b8d('0x12')]));});});}; \ No newline at end of file +var _0xc822=['attributes','limit','info','UpdateMailApplication','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','debug','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','MailApplication,\x20%s,\x20%s','catch','MailApplication','update','body','options'];(function(_0x29e7a0,_0x14fc69){var _0x337a21=function(_0x3b4945){while(--_0x3b4945){_0x29e7a0['push'](_0x29e7a0['shift']());}};_0x337a21(++_0x14fc69);}(_0xc822,0x1b7));var _0x2c82=function(_0x152136,_0x4f14f1){_0x152136=_0x152136-0x0;var _0x20df44=_0xc822[_0x152136];return _0x20df44;};'use strict';var _=require(_0x2c82('0x0'));var util=require(_0x2c82('0x1'));var moment=require(_0x2c82('0x2'));var BPromise=require('bluebird');var rs=require(_0x2c82('0x3'));var fs=require('fs');var Redis=require(_0x2c82('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2c82('0x5'));var logger=require(_0x2c82('0x6'))(_0x2c82('0x7'));var config=require(_0x2c82('0x8'));var jayson=require(_0x2c82('0x9'));var client=jayson['client'][_0x2c82('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d7e23,_0xb590cb,_0x312774){return new BPromise(function(_0x3a14fc,_0x4f233b){return client[_0x2c82('0xb')](_0x1d7e23,_0x312774)['then'](function(_0x1f6b0e){logger['info']('MailApplication,\x20%s,\x20%s',_0xb590cb,'request\x20sent');logger[_0x2c82('0xc')](_0x2c82('0xd'),_0xb590cb,_0x2c82('0xe'),JSON[_0x2c82('0xf')](_0x1f6b0e));if(_0x1f6b0e['error']){if(_0x1f6b0e[_0x2c82('0x10')][_0x2c82('0x11')]===0x1f4){logger[_0x2c82('0x10')]('MailApplication,\x20%s,\x20%s',_0xb590cb,_0x1f6b0e[_0x2c82('0x10')][_0x2c82('0x12')]);return _0x4f233b(_0x1f6b0e['error'][_0x2c82('0x12')]);}logger[_0x2c82('0x10')](_0x2c82('0x13'),_0xb590cb,_0x1f6b0e[_0x2c82('0x10')][_0x2c82('0x12')]);return _0x3a14fc(_0x1f6b0e['error'][_0x2c82('0x12')]);}else{logger['info'](_0x2c82('0x13'),_0xb590cb,'request\x20sent');_0x3a14fc(_0x1f6b0e['result']['message']);}})[_0x2c82('0x14')](function(_0x5ed52b){logger['error'](_0x2c82('0x13'),_0xb590cb,_0x5ed52b);_0x4f233b(_0x5ed52b);});});}exports['UpdateMailApplication']=function(_0x46b600){var _0x58ba7d=this;return new Promise(function(_0x49afda,_0x77fa7f){return db[_0x2c82('0x15')][_0x2c82('0x16')](_0x46b600[_0x2c82('0x17')],{'raw':_0x46b600[_0x2c82('0x18')]?_0x46b600['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46b600[_0x2c82('0x18')]?_0x46b600[_0x2c82('0x18')]['where']||null:null,'attributes':_0x46b600[_0x2c82('0x18')]?_0x46b600['options'][_0x2c82('0x19')]||null:null,'limit':_0x46b600[_0x2c82('0x18')]?_0x46b600[_0x2c82('0x18')][_0x2c82('0x1a')]||null:null})['then'](function(_0x1620df){logger[_0x2c82('0x1b')](_0x2c82('0x1c'),_0x46b600);logger[_0x2c82('0xc')](_0x2c82('0x1c'),_0x46b600,JSON[_0x2c82('0xf')](_0x1620df));_0x49afda(_0x1620df);})[_0x2c82('0x14')](function(_0x3d158a){logger['error']('UpdateMailApplication',_0x3d158a[_0x2c82('0x12')],_0x46b600);_0x77fa7f(_0x58ba7d[_0x2c82('0x10')](0x1f4,_0x3d158a['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index d29f360..dbf30ad 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 _0xd222=['/:id','isAuthenticated','/:id/messages','getMessages','download','post','create','mailinteraction:addtags','addTags','mail','mailinteraction:update','delete','tracked','mailinteraction:destroy','destroy','removeTags','exports','express','Router','../../components/interaction/service','./mailInteraction.controller','get','index','describe'];(function(_0x5ff505,_0x53e2bd){var _0x97e96=function(_0x34cf7b){while(--_0x34cf7b){_0x5ff505['push'](_0x5ff505['shift']());}};_0x97e96(++_0x53e2bd);}(_0xd222,0xa1));var _0x2d22=function(_0x48d6a3,_0x37c848){_0x48d6a3=_0x48d6a3-0x0;var _0x38bfa0=_0xd222[_0x48d6a3];return _0x38bfa0;};'use strict';var express=require(_0x2d22('0x0'));var router=express[_0x2d22('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0x2d22('0x2'));var controller=require(_0x2d22('0x3'));router[_0x2d22('0x4')]('/',auth['isAuthenticated'](),controller[_0x2d22('0x5')]);router[_0x2d22('0x4')]('/describe',auth['isAuthenticated'](),controller[_0x2d22('0x6')]);router[_0x2d22('0x4')](_0x2d22('0x7'),auth[_0x2d22('0x8')](),controller['show']);router[_0x2d22('0x4')](_0x2d22('0x9'),auth['isAuthenticated'](),controller[_0x2d22('0xa')]);router[_0x2d22('0x4')]('/:id/download',auth[_0x2d22('0x8')](),controller[_0x2d22('0xb')]);router[_0x2d22('0xc')]('/',auth[_0x2d22('0x8')](),controller[_0x2d22('0xd')]);router[_0x2d22('0xc')](_0x2d22('0x9'),auth[_0x2d22('0x8')](),controller['addMessage']);router[_0x2d22('0xc')]('/:id/tags',auth[_0x2d22('0x8')](),interaction['tracked']('mail',_0x2d22('0xe')),controller[_0x2d22('0xf')]);router['put'](_0x2d22('0x7'),auth[_0x2d22('0x8')](),interaction['tracked'](_0x2d22('0x10'),_0x2d22('0x11')),controller['update']);router[_0x2d22('0x12')](_0x2d22('0x7'),auth[_0x2d22('0x8')](),interaction[_0x2d22('0x13')](_0x2d22('0x10'),_0x2d22('0x14')),controller[_0x2d22('0x15')]);router[_0x2d22('0x12')]('/:id/tags',auth[_0x2d22('0x8')](),controller[_0x2d22('0x16')]);module[_0x2d22('0x17')]=router; \ No newline at end of file +var _0x625e=['tracked','update','delete','mailinteraction:destroy','destroy','removeTags','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','mail','mailinteraction:addtags','put'];(function(_0x392e1d,_0x125aed){var _0x486d9b=function(_0x2223a4){while(--_0x2223a4){_0x392e1d['push'](_0x392e1d['shift']());}};_0x486d9b(++_0x125aed);}(_0x625e,0x145));var _0xe625=function(_0x349148,_0x31eabb){_0x349148=_0x349148-0x0;var _0x2f2b0f=_0x625e[_0x349148];return _0x2f2b0f;};'use strict';var express=require(_0xe625('0x0'));var router=express[_0xe625('0x1')]();var auth=require(_0xe625('0x2'));var interaction=require(_0xe625('0x3'));var controller=require(_0xe625('0x4'));router[_0xe625('0x5')]('/',auth['isAuthenticated'](),controller[_0xe625('0x6')]);router['get'](_0xe625('0x7'),auth[_0xe625('0x8')](),controller[_0xe625('0x9')]);router[_0xe625('0x5')](_0xe625('0xa'),auth['isAuthenticated'](),controller[_0xe625('0xb')]);router[_0xe625('0x5')](_0xe625('0xc'),auth[_0xe625('0x8')](),controller[_0xe625('0xd')]);router[_0xe625('0x5')](_0xe625('0xe'),auth[_0xe625('0x8')](),controller[_0xe625('0xf')]);router[_0xe625('0x10')]('/',auth[_0xe625('0x8')](),controller[_0xe625('0x11')]);router[_0xe625('0x10')](_0xe625('0xc'),auth[_0xe625('0x8')](),controller[_0xe625('0x12')]);router[_0xe625('0x10')](_0xe625('0x13'),auth[_0xe625('0x8')](),interaction['tracked'](_0xe625('0x14'),_0xe625('0x15')),controller['addTags']);router[_0xe625('0x16')](_0xe625('0xa'),auth[_0xe625('0x8')](),interaction[_0xe625('0x17')](_0xe625('0x14'),'mailinteraction:update'),controller[_0xe625('0x18')]);router[_0xe625('0x19')](_0xe625('0xa'),auth[_0xe625('0x8')](),interaction[_0xe625('0x17')]('mail',_0xe625('0x1a')),controller[_0xe625('0x1b')]);router[_0xe625('0x19')](_0xe625('0x13'),auth[_0xe625('0x8')](),controller[_0xe625('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 0b69441..2558bcf 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 _0x62f8=['exports','BOOLEAN','DATE','STRING','TEXT','long','ENUM','out','sequelize','iconv'];(function(_0x5a9770,_0x3d961f){var _0x24fc92=function(_0x239eff){while(--_0x239eff){_0x5a9770['push'](_0x5a9770['shift']());}};_0x24fc92(++_0x3d961f);}(_0x62f8,0x116));var _0x862f=function(_0x7d1554,_0x5d78da){_0x7d1554=_0x7d1554-0x0;var _0x14dbb7=_0x62f8[_0x7d1554];return _0x14dbb7;};'use strict';var Sequelize=require(_0x862f('0x0'));var iconv=require(_0x862f('0x1'));module[_0x862f('0x2')]={'closed':{'type':Sequelize[_0x862f('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x862f('0x4')]},'disposition':{'type':Sequelize[_0x862f('0x5')]},'secondDisposition':{'type':Sequelize[_0x862f('0x5')]},'thirdDisposition':{'type':Sequelize[_0x862f('0x5')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x862f('0x5')]},'cc':{'type':Sequelize[_0x862f('0x6')](_0x862f('0x7'))},'subject':{'type':Sequelize[_0x862f('0x6')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x862f('0x4')]},'substatus':{'type':Sequelize[_0x862f('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0x862f('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x862f('0x8')]('in',_0x862f('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x862f('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x862f('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x6f82=['TEXT','ENUM','out','sequelize','iconv','BOOLEAN','DATE','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6f82,0x13b));var _0x26f8=function(_0x34bc94,_0x74f0fd){_0x34bc94=_0x34bc94-0x0;var _0xee41e7=_0x6f82[_0x34bc94];return _0xee41e7;};'use strict';var Sequelize=require(_0x26f8('0x0'));var iconv=require(_0x26f8('0x1'));module['exports']={'closed':{'type':Sequelize[_0x26f8('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x26f8('0x3')]},'disposition':{'type':Sequelize[_0x26f8('0x4')]},'secondDisposition':{'type':Sequelize[_0x26f8('0x4')]},'thirdDisposition':{'type':Sequelize[_0x26f8('0x4')]},'note':{'type':Sequelize[_0x26f8('0x4')]},'inReplyTo':{'type':Sequelize[_0x26f8('0x4')](0x1fe)},'to':{'type':Sequelize[_0x26f8('0x4')]},'cc':{'type':Sequelize[_0x26f8('0x5')]('long')},'subject':{'type':Sequelize[_0x26f8('0x5')]()},'attach':{'type':Sequelize[_0x26f8('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x26f8('0x6')]('in',_0x26f8('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x26f8('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'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 03b6a67..cb65449 100644 --- a/server/api/mailInteraction/mailInteraction.controller.js +++ b/server/api/mailInteraction/mailInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','Setting','enableEmailPreview','all','rows','show','params','includeAll','include','options','create','body','addMessage','ids','omit','getMessages','nolimit','MailInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','addTags','setTags','Tag','mailInteractionTags:save','download','join','root','server','tmp','attachments','Attachment','Attachments','subject','Messages','get','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','readFileSync','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','util','lodash','squel','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','socket.io-emitter','redis','./mailInteraction.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','send','Users','fullname','Tags','split','forEach','push','TagIds','MailMessage','findOne','out','-id','plainBody','lastMsgText','trimStart','catch','index','MailInteraction','rawAttributes','fieldName','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','sort','filters','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','keys','some','compact','where','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','QueryTypes','SELECT','clone','i.id','order','contactName','DESC','t.id\x20IN\x20?','resolve','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgDirection','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.MailAccountId','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname'];(function(_0xe78356,_0x73106){var _0x418421=function(_0xb19901){while(--_0xb19901){_0xe78356['push'](_0xe78356['shift']());}};_0x418421(++_0x73106);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x0a9e('0x3'));var path=require('path');var fs=require('fs');var _=require(_0x0a9e('0x4'));var squel=require(_0x0a9e('0x5'));var juice=require(_0x0a9e('0x6'));var Redis=require(_0x0a9e('0x7'));var qs=require(_0x0a9e('0x8'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0x0a9e('0x9'))(_0x0a9e('0xa'));var config=require(_0x0a9e('0xb'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x0a9e('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0xd'))(new Redis(config[_0x0a9e('0xe')]));require(_0x0a9e('0xf'))[_0x0a9e('0x10')](socket);function respondWithStatusCode(_0xfeb75b,_0xbd1168){_0xbd1168=_0xbd1168||0xcc;return function(_0x4a4c56){if(_0x4a4c56){return _0xfeb75b['sendStatus'](_0xbd1168);}return _0xfeb75b['status'](_0xbd1168)['end']();};}function respondWithResult(_0x273d4d,_0x36471c){_0x36471c=_0x36471c||0xc8;return function(_0xd5b662){if(_0xd5b662){return _0x273d4d[_0x0a9e('0x11')](_0x36471c)[_0x0a9e('0x12')](_0xd5b662);}};}function respondWithFilteredResult(_0x69aeb7,_0x5db4b0){return function(_0x4283ce){if(_0x4283ce){var _0x239b12=typeof _0x5db4b0[_0x0a9e('0x13')]===_0x0a9e('0x14')&&typeof _0x5db4b0[_0x0a9e('0x15')]===_0x0a9e('0x14');var _0x52a03d=_0x4283ce[_0x0a9e('0x16')];var _0x5d0880=_0x239b12?0x0:_0x5db4b0[_0x0a9e('0x13')];var _0x519dfd=_0x239b12?_0x4283ce[_0x0a9e('0x16')]:_0x5db4b0[_0x0a9e('0x13')]+_0x5db4b0['limit'];var _0x225616;if(_0x519dfd>=_0x52a03d){_0x519dfd=_0x52a03d;_0x225616=0xc8;}else{_0x225616=0xce;}_0x69aeb7['status'](_0x225616);return _0x69aeb7[_0x0a9e('0x17')](_0x0a9e('0x18'),_0x5d0880+'-'+_0x519dfd+'/'+_0x52a03d)[_0x0a9e('0x12')](_0x4283ce);}return null;};}function saveUpdates(_0x205fd6){return function(_0x31b1ca){if(_0x31b1ca){return _0x31b1ca[_0x0a9e('0x19')](_0x205fd6)[_0x0a9e('0x1a')](function(_0x20559e){return _0x20559e;});}return null;};}function removeEntity(_0x1314ae){return function(_0x112016){if(_0x112016){return _0x112016[_0x0a9e('0x1b')]()[_0x0a9e('0x1a')](function(){_0x1314ae['status'](0xcc)[_0x0a9e('0x1c')]();});}};}function handleEntityNotFound(_0x155cce){return function(_0x53682f){if(!_0x53682f){_0x155cce[_0x0a9e('0x1d')](0x194);}return _0x53682f;};}function handleError(_0x5a09ef,_0x588269){_0x588269=_0x588269||0x1f4;return function(_0x3a02e1){logger[_0x0a9e('0x1e')](_0x3a02e1[_0x0a9e('0x1f')]);if(_0x3a02e1[_0x0a9e('0x20')]){delete _0x3a02e1['name'];}_0x5a09ef[_0x0a9e('0x11')](_0x588269)[_0x0a9e('0x21')](_0x3a02e1);};}function getInteractionUsers(_0x3b45bc,_0x4d00e6){return new BPromise(function(_0x370d86,_0x42ac8f){try{if(_0x4d00e6[_0x3b45bc['id']]){_0x3b45bc[_0x0a9e('0x22')]=_['map'](_0x4d00e6[_0x3b45bc['id']],function(_0x59181e){return{'id':_0x59181e['id'],'fullname':_0x59181e[_0x0a9e('0x23')]};});}}catch(_0x3a8e58){_0x42ac8f(_0x3a8e58);}_0x370d86(_0x3b45bc);});}function getInteractionTags(_0x40c424,_0x33161b){return new BPromise(function(_0x526cf3,_0x384319){try{if(_0x40c424['TagIds']){_0x40c424[_0x0a9e('0x24')]=[];_0x40c424['TagIds'][_0x0a9e('0x25')](',')[_0x0a9e('0x26')](function(_0x25fba9){_0x40c424[_0x0a9e('0x24')][_0x0a9e('0x27')](_0x33161b[_0x25fba9]);});}delete _0x40c424[_0x0a9e('0x28')];}catch(_0x11c3b6){_0x384319(_0x11c3b6);}_0x526cf3(_0x40c424);});}function getLastMessageText(_0x14de77){return new BPromise(function(_0x5a101a,_0x3652a7){return db[_0x0a9e('0x29')][_0x0a9e('0x2a')]({'where':{'$and':[{'MailInteractionId':_0x14de77['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x0a9e('0x2b')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x0a9e('0x2c'),'raw':!![]})[_0x0a9e('0x1a')](function(_0x1843b2){if(_0x1843b2&&_0x1843b2[_0x0a9e('0x2d')]){_0x14de77[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1843b2[_0x0a9e('0x2d')]);}_0x5a101a(_0x14de77);})[_0x0a9e('0x30')](function(_0x1dbde2){_0x3652a7(_0x1dbde2);});});}function updateMailInteraction(_0x540530,_0x426950,_0x5d1e0e,_0x2407f9){return new BPromise(function(_0x3ae878,_0x1122db){return getInteractionUsers(_0x540530,_0x5d1e0e)[_0x0a9e('0x1a')](function(_0x25ce3a){return getInteractionTags(_0x25ce3a,_0x426950);})['then'](function(_0x66c1d2){if(_0x2407f9){_0x3ae878(getLastMessageText(_0x66c1d2));}else{_0x3ae878(_0x66c1d2);}})[_0x0a9e('0x30')](function(_0x40cb85){_0x1122db(_0x40cb85);});});}exports[_0x0a9e('0x31')]=function(_0x2b45ea,_0x409319){var _0x332d35={},_0x39e565={},_0x5583a4={'count':0x0,'rows':[]};var _0x44295a=_['map'](db[_0x0a9e('0x32')][_0x0a9e('0x33')],function(_0x2b7e7f){return{'name':_0x2b7e7f[_0x0a9e('0x34')],'type':_0x2b7e7f['type'][_0x0a9e('0x35')]};});_0x39e565[_0x0a9e('0x36')]=_[_0x0a9e('0x37')](_0x44295a,_0x0a9e('0x20'));_0x39e565['query']=_['keys'](_0x2b45ea[_0x0a9e('0x38')]);_0x39e565['filters']=_[_0x0a9e('0x39')](_0x39e565[_0x0a9e('0x36')],_0x39e565[_0x0a9e('0x38')]);_0x332d35[_0x0a9e('0x3a')]=_['intersection'](_0x39e565[_0x0a9e('0x36')],qs[_0x0a9e('0x3b')](_0x2b45ea[_0x0a9e('0x38')]['fields']));_0x332d35[_0x0a9e('0x3a')]=_0x332d35[_0x0a9e('0x3a')][_0x0a9e('0x3c')]?_0x332d35['attributes']:_0x39e565['model'];if(!_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3d')]('nolimit')){_0x332d35[_0x0a9e('0x15')]=qs[_0x0a9e('0x15')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x15')]);_0x332d35['offset']=qs['offset'](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x13')]);}_0x332d35['order']=qs[_0x0a9e('0x3e')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3e')]);_0x332d35['where']=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x40')](_0x2b45ea[_0x0a9e('0x38')],_0x39e565[_0x0a9e('0x3f')]),_0x44295a);var _0x13cb1f=[];var _0xeaa5e5=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')]('id')[_0x0a9e('0x42')](_0x0a9e('0x20'))[_0x0a9e('0x42')](_0x0a9e('0x43'))[_0x0a9e('0x44')](_0x0a9e('0x45'));var _0x37f6cc=squel['select']()['field'](_0x0a9e('0x46'))[_0x0a9e('0x42')](_0x0a9e('0x47'))[_0x0a9e('0x42')](_0x0a9e('0x48'))[_0x0a9e('0x44')](_0x0a9e('0x49'),'ui')[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'u',_0x0a9e('0x4c'));var _0x2c2cb0=squel[_0x0a9e('0x41')]()['from'](_0x0a9e('0x4d'),'i')[_0x0a9e('0x4a')](_0x0a9e('0x4e'),'c',_0x0a9e('0x4f'))[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'o',_0x0a9e('0x50'))[_0x0a9e('0x4a')]('mail_accounts','a',_0x0a9e('0x51'))['left_join'](_0x0a9e('0x52'),'me',_0x0a9e('0x53'))[_0x0a9e('0x4a')]('mail_interaction_has_tags','it',_0x0a9e('0x54'))[_0x0a9e('0x4a')](_0x0a9e('0x45'),'t',_0x0a9e('0x55'));var _0x45c845=squel[_0x0a9e('0x56')]();var _0x45bf7f=[];var _0x5bbcde=squel[_0x0a9e('0x56')]();var _0x1bde3c;if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x57')]){_0x1bde3c=as[_0x0a9e('0x58')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x57')]);var _0x19383e=_0x1bde3c[_0x0a9e('0x59')];for(var _0x58a5c2=0x0;_0x58a5c2<_0x1bde3c[_0x0a9e('0x5a')][_0x0a9e('0x3c')];_0x58a5c2++){var _0x4f7240=_0x1bde3c['conditions'][_0x58a5c2];var _0x5ddf84='i';var _0x1adfee=_[_0x0a9e('0x5b')](_0x44295a,[_0x0a9e('0x20'),_0x4f7240[_0x0a9e('0x42')]]);if(!_0x1adfee){switch(_0x4f7240[_0x0a9e('0x42')]){case _0x0a9e('0x5c'):if(_0x4f7240[_0x0a9e('0x5d')]==0x1){_0x2c2cb0[_0x0a9e('0x5e')]('`'+_0x4f7240['field']+'`\x20=\x200');}else{_0x2c2cb0['having']('`'+_0x4f7240[_0x0a9e('0x42')]+_0x0a9e('0x5f'));}break;case _0x0a9e('0x60'):if(_0x4f7240['operator']===_0x0a9e('0x61')){if(_0x4f7240[_0x0a9e('0x5d')]['split']('\x20')['length']>0x1){_0x45c845[_0x19383e](_0x0a9e('0x62'),qs['getFullTextValue'](_0x4f7240[_0x0a9e('0x5d')]),null);}else{var _0x4c3845='%'+_0x4f7240[_0x0a9e('0x5d')]+'%';_0x45c845[_0x19383e](_0x0a9e('0x63'),_0x4c3845,_0x4c3845,_0x4c3845);}}else{_0x1adfee=_[_0x0a9e('0x5b')](_0x44295a,['name',_0x0a9e('0x64')]);_0x4f7240[_0x0a9e('0x42')]='ContactId';_0x2244d6=as['buildExpression'](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6[_0x0a9e('0x66')],_0x2244d6['value'][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}break;case'Tag':var _0xe22ccc=_0x4f7240['value']['split'](',')['map'](function(_0x2da03c){return Number(_0x2da03c);});_0xe22ccc['forEach'](function(_0x2f7092){_0x5bbcde['or'](_0x0a9e('0x68'),'%,'+_0x2f7092+',%');});_0x45bf7f=_[_0x0a9e('0x69')](_0x45bf7f,_0xe22ccc);break;case _0x0a9e('0x6a'):if(_0x4f7240[_0x0a9e('0x6b')]===_0x0a9e('0x61')){_0x45c845[_0x19383e](_0x0a9e('0x6c'),'%'+_0x4f7240[_0x0a9e('0x5d')]+'%',null);}else{_0x1adfee=_['find'](_0x44295a,[_0x0a9e('0x20'),_0x0a9e('0x6d')]);_0x4f7240[_0x0a9e('0x42')]=_0x0a9e('0x6d');_0x2244d6=as[_0x0a9e('0x6e')](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6['text'],_0x2244d6[_0x0a9e('0x5d')][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}break;case'plainBody':_0x2244d6=as[_0x0a9e('0x6e')]('me',null,_0x4f7240);_0x45c845[_0x19383e](_0x2244d6['text'],_0x2244d6['value']['start'],_0x2244d6[_0x0a9e('0x5d')]['end']);break;}}else{var _0x2244d6=as[_0x0a9e('0x6e')](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6[_0x0a9e('0x66')],_0x2244d6[_0x0a9e('0x5d')][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}}}else{var _0x5854cc=_(_0x2b45ea[_0x0a9e('0x38')])[_0x0a9e('0x6f')]()[_0x0a9e('0x37')](function(_0x5adf8f){return _[_0x0a9e('0x70')](_0x44295a,[_0x0a9e('0x20'),_0x5adf8f])?_0x5adf8f:undefined;})[_0x0a9e('0x71')]()[_0x0a9e('0x5d')]();if(!_['isEmpty'](_0x5854cc)){_0x5854cc[_0x0a9e('0x26')](function(_0xe05a5a){if(_0xe05a5a==='MailAccountId'){_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x73'),[][_0x0a9e('0x74')](_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]));}else if(_0xe05a5a===_0x0a9e('0x75')){var _0x4d4a35=JSON[_0x0a9e('0x76')](_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a])[_0x0a9e('0x77')];var _0x47bb43=JSON[_0x0a9e('0x76')](_0x2b45ea['query'][_0xe05a5a])['$lte'];_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x78'),_0x4d4a35,_0x47bb43);}else{if(_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]===_0x0a9e('0x79')){_0x2c2cb0[_0x0a9e('0x72')]('i.'+_0xe05a5a+_0x0a9e('0x7a'));}else{_0x2c2cb0[_0x0a9e('0x72')]('i.'+_0xe05a5a+_0x0a9e('0x7b'),_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]);}}});}if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x7c')]){if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x7c')]==0x1){_0x2c2cb0[_0x0a9e('0x5e')](_0x0a9e('0x7d'));}else{_0x2c2cb0[_0x0a9e('0x5e')](_0x0a9e('0x7e'));}}if(_0x2b45ea[_0x0a9e('0x38')]['tag']){_0x45bf7f=_[_0x0a9e('0x7f')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x80')])?_0x2b45ea['query'][_0x0a9e('0x80')]:new Array(_0x2b45ea[_0x0a9e('0x38')]['tag']);_0x45bf7f[_0x0a9e('0x26')](function(_0x56e31e){_0x5bbcde['or'](_0x0a9e('0x68'),'%,'+_0x56e31e+',%');});}if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x81')]){var _0x4a43a8=_0x2b45ea['query']['filter'][_0x0a9e('0x82')]('\x5c','\x5c\x5c')[_0x0a9e('0x82')](/'/g,'\x27\x27');if(qs[_0x0a9e('0x83')](_0x4a43a8)){_0x45c845['or'](_0x0a9e('0x84'),_0x4a43a8+'%');}else if(qs[_0x0a9e('0x85')](_0x4a43a8)){_0x45c845['or'](_0x0a9e('0x86'),_0x4a43a8+'%');}else{_0x45c845['or'](_0x0a9e('0x87'),qs[_0x0a9e('0x88')](_0x4a43a8))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0a9e('0x88')](_0x4a43a8));}}}_0x2c2cb0[_0x0a9e('0x72')](_0x45c845);_0x2c2cb0[_0x0a9e('0x89')]('i.id');var _0x2bdc44={'type':db['Sequelize'][_0x0a9e('0x8a')][_0x0a9e('0x8b')],'raw':!![]};var _0x4c46c1=_0x2c2cb0[_0x0a9e('0x8c')]();_0x4c46c1[_0x0a9e('0x42')](_0x0a9e('0x8d'));_0x4c46c1[_0x0a9e('0x42')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0a9e('0x5c'));if(_0x332d35[_0x0a9e('0x8e')]){_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x26')](function(_0x5b7fc3){var _0x109ccb=_0x5b7fc3[0x0]===_0x0a9e('0x8f')?_0x5b7fc3[0x0]:'i.'+_0x5b7fc3[0x0];_0x2c2cb0[_0x0a9e('0x8e')](_0x109ccb,_0x5b7fc3[0x1]===_0x0a9e('0x90')?![]:!![]);});}if(!_['isEmpty'](_0x45bf7f)){_0x2c2cb0[_0x0a9e('0x5e')](_0x5bbcde);_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x91'),_0x45bf7f);}BPromise[_0x0a9e('0x92')]()[_0x0a9e('0x1a')](function(){if(!_0x1bde3c){if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x93')])return;_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x94'));_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x94'));return;}if(_0x2b45ea[_0x0a9e('0x95')][_0x0a9e('0x96')]!==_0x0a9e('0x97'))return;return _0x2b45ea['user'][_0x0a9e('0x98')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x1a')](function(_0xc599b3){if(_['isEmpty'](_0xc599b3)){_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x99'));_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x99'));}else{_0x4c46c1['where']('i.MailAccountId\x20IN\x20?',_[_0x0a9e('0x37')](_0xc599b3,'id'));_0x2c2cb0[_0x0a9e('0x72')]('i.MailAccountId\x20IN\x20?',_[_0x0a9e('0x37')](_0xc599b3,'id'));}});})['then'](function(){if(_0x2b45ea[_0x0a9e('0x95')][_0x0a9e('0x96')]==='agent'&&!_0x1bde3c&&!_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x93')])return[];return db[_0x0a9e('0x9a')][_0x0a9e('0x38')](_0x4c46c1[_0x0a9e('0x9b')](),_0x2bdc44);})[_0x0a9e('0x1a')](function(_0x444f1f){_0x5583a4['count']=_0x444f1f[_0x0a9e('0x3c')];if(_0x5583a4[_0x0a9e('0x16')]===0x0)return[];return db[_0x0a9e('0x9a')][_0x0a9e('0x38')](_0xeaa5e5['toString'](),_0x2bdc44)[_0x0a9e('0x1a')](function(_0xf0db1){_0x13cb1f=_['keyBy'](_0xf0db1,'id');_0x2bdc44=_[_0x0a9e('0x9c')](_0x2bdc44,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3b')]){_0x332d35[_0x0a9e('0x3a')][_0x0a9e('0x26')](function(_0x5af453){_0x2c2cb0['field']('i.'+_0x5af453);});}else{_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0x9d'),_0x0a9e('0x5c'));_0x2c2cb0['field'](_0x0a9e('0x9e'),_0x0a9e('0x9f'));_0x2c2cb0['field']('a.mandatoryDisposition',_0x0a9e('0xa0'));_0x2c2cb0['field']('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0x8d'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa1'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa2'));_0x2c2cb0['field'](_0x0a9e('0xa3'));_0x2c2cb0['field'](_0x0a9e('0xa4'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa5'));_0x2c2cb0[_0x0a9e('0x42')]('i.lastMsgAt');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa6'));_0x2c2cb0[_0x0a9e('0x42')]('i.subject');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa7'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa8'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa9'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xaa'));_0x2c2cb0['field'](_0x0a9e('0xab'));_0x2c2cb0[_0x0a9e('0x42')]('i.ContactId');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xac'));_0x2c2cb0[_0x0a9e('0x42')]('i.UserId');_0x2c2cb0[_0x0a9e('0x42')]('c.firstName',_0x0a9e('0xad'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xae'),_0x0a9e('0xaf'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb0'),_0x0a9e('0xb1'));_0x2c2cb0[_0x0a9e('0x42')]('c.phone',_0x0a9e('0xb2'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb3'),_0x0a9e('0xb4'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb5'),_0x0a9e('0xb6'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb7'),_0x0a9e('0xb8'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb9'),_0x0a9e('0xba'));_0x2c2cb0['field'](_0x0a9e('0xbb'),_0x0a9e('0x28'));}if(_0x332d35[_0x0a9e('0x15')])_0x2c2cb0[_0x0a9e('0x15')](_0x332d35[_0x0a9e('0x15')]);if(_0x332d35['offset'])_0x2c2cb0[_0x0a9e('0x13')](_0x332d35[_0x0a9e('0x13')]);return db['sequelize'][_0x0a9e('0x38')](_0x2c2cb0['toString'](),_0x2bdc44);})[_0x0a9e('0x1a')](function(_0x27041d){if(_0x27041d[_0x0a9e('0x3c')]>0x0)_0x37f6cc[_0x0a9e('0x72')]('ui.MailInteractionId\x20IN\x20?',_[_0x0a9e('0x37')](_0x27041d,'id'));return db['sequelize'][_0x0a9e('0x38')](_0x37f6cc[_0x0a9e('0x9b')](),_0x2bdc44)['then'](function(_0x231c6a){var _0x63c9f7=_[_0x0a9e('0xbc')](_0x231c6a,'MailInteractionId');var _0x4c788f=[];return db[_0x0a9e('0xbd')][_0x0a9e('0x2a')]({'attributes':[_0x0a9e('0xbe')],'raw':!![]})[_0x0a9e('0x1a')](function(_0x3f2f40){var _0x2450a8=_0x3f2f40[_0x0a9e('0xbe')];_0x27041d[_0x0a9e('0x26')](function(_0x3f8124){_0x4c788f['push'](updateMailInteraction(_0x3f8124,_0x13cb1f,_0x63c9f7,_0x2450a8));});return BPromise[_0x0a9e('0xbf')](_0x4c788f);});});});})['then'](function(_0x287324){_0x5583a4[_0x0a9e('0xc0')]=_0x287324;return _0x5583a4;})[_0x0a9e('0x1a')](respondWithFilteredResult(_0x409319,_0x332d35))[_0x0a9e('0x30')](handleError(_0x409319,null));};exports[_0x0a9e('0xc1')]=function(_0x4e7273,_0x436313){var _0x4667bf={'raw':![],'where':{'id':_0x4e7273[_0x0a9e('0xc2')]['id']}},_0x2791c5={};_0x2791c5[_0x0a9e('0x36')]=_['keys'](db['MailInteraction'][_0x0a9e('0x33')]);_0x2791c5['query']=_[_0x0a9e('0x6f')](_0x4e7273[_0x0a9e('0x38')]);_0x2791c5[_0x0a9e('0x3f')]=_[_0x0a9e('0x39')](_0x2791c5[_0x0a9e('0x36')],_0x2791c5[_0x0a9e('0x38')]);_0x4667bf['attributes']=_['intersection'](_0x2791c5[_0x0a9e('0x36')],qs['fields'](_0x4e7273[_0x0a9e('0x38')]['fields']));_0x4667bf[_0x0a9e('0x3a')]=_0x4667bf['attributes']['length']?_0x4667bf[_0x0a9e('0x3a')]:_0x2791c5[_0x0a9e('0x36')];if(_0x4e7273['query'][_0x0a9e('0xc3')]){_0x4667bf[_0x0a9e('0xc4')]=[{'all':!![]}];}_0x4667bf=_[_0x0a9e('0x9c')]({},_0x4667bf,_0x4e7273[_0x0a9e('0xc5')]);return db[_0x0a9e('0x32')]['find'](_0x4667bf)['then'](handleEntityNotFound(_0x436313,null))[_0x0a9e('0x1a')](respondWithResult(_0x436313,null))[_0x0a9e('0x30')](handleError(_0x436313,null));};exports[_0x0a9e('0xc6')]=function(_0x24beb6,_0x59303b){return db['MailInteraction'][_0x0a9e('0xc6')](_0x24beb6[_0x0a9e('0xc7')],{})['then'](respondWithResult(_0x59303b,0xc9))[_0x0a9e('0x30')](handleError(_0x59303b,null));};exports[_0x0a9e('0x19')]=function(_0xcacabb,_0x2427d5){if(_0xcacabb[_0x0a9e('0xc7')]['id']){delete _0xcacabb[_0x0a9e('0xc7')]['id'];}return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0xcacabb[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x2427d5,null))['then'](saveUpdates(_0xcacabb[_0x0a9e('0xc7')],null))[_0x0a9e('0x1a')](respondWithResult(_0x2427d5,null))[_0x0a9e('0x30')](handleError(_0x2427d5,null));};exports[_0x0a9e('0x1b')]=function(_0x1d0b02,_0x547e37){return db['MailInteraction'][_0x0a9e('0x5b')]({'where':{'id':_0x1d0b02[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x547e37,null))[_0x0a9e('0x1a')](removeEntity(_0x547e37,null))[_0x0a9e('0x30')](handleError(_0x547e37,null));};exports['describe']=function(_0x1339d0,_0x3c775a){return db[_0x0a9e('0x32')]['describe']()[_0x0a9e('0x1a')](respondWithResult(_0x3c775a,null))['catch'](handleError(_0x3c775a,null));};exports[_0x0a9e('0xc8')]=function(_0x4799d4,_0x25b745){return db[_0x0a9e('0x29')][_0x0a9e('0x5b')]({'where':{'id':_0x4799d4['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x25b745,null))['then'](function(_0x4383da){if(_0x4383da){return _0x4383da[_0x0a9e('0xc8')](_0x4799d4[_0x0a9e('0xc7')][_0x0a9e('0xc9')],_[_0x0a9e('0xca')](_0x4799d4[_0x0a9e('0xc7')],[_0x0a9e('0xc9'),'id'])||{});}})[_0x0a9e('0x1a')](respondWithResult(_0x25b745,null))[_0x0a9e('0x30')](handleError(_0x25b745,null));};exports[_0x0a9e('0xcb')]=function(_0x4262d0,_0xc876d4){var _0x2415fe={'raw':![],'where':{}};var _0x399def={};var _0x98c62c={'count':0x0,'rows':[]};return db[_0x0a9e('0x32')]['findOne']({'where':{'id':_0x4262d0['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0xc876d4,null))['then'](function(_0x1d999b){if(_0x1d999b){_0x399def[_0x0a9e('0x36')]=_['keys'](db[_0x0a9e('0x29')][_0x0a9e('0x33')]);_0x399def[_0x0a9e('0x38')]=_[_0x0a9e('0x6f')](_0x4262d0['query']);_0x399def[_0x0a9e('0x3f')]=_[_0x0a9e('0x39')](_0x399def[_0x0a9e('0x36')],_0x399def[_0x0a9e('0x38')]);_0x2415fe['attributes']=_[_0x0a9e('0x39')](_0x399def[_0x0a9e('0x36')],qs[_0x0a9e('0x3b')](_0x4262d0['query'][_0x0a9e('0x3b')]));_0x2415fe[_0x0a9e('0x3a')]=_0x2415fe[_0x0a9e('0x3a')]['length']?_0x2415fe[_0x0a9e('0x3a')]:_0x399def[_0x0a9e('0x36')];if(!_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x3d')](_0x0a9e('0xcc'))){_0x2415fe['limit']=qs[_0x0a9e('0x15')](_0x4262d0[_0x0a9e('0x38')]['limit']);_0x2415fe[_0x0a9e('0x13')]=qs[_0x0a9e('0x13')](_0x4262d0[_0x0a9e('0x38')]['offset']);}_0x2415fe['order']=qs['sort'](_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x3e')]);_0x2415fe['where']=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x40')](_0x4262d0[_0x0a9e('0x38')],_0x399def['filters']));_0x2415fe[_0x0a9e('0x72')][_0x0a9e('0xcd')]=_0x1d999b['id'];if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x81')]){_0x2415fe[_0x0a9e('0x72')]=_[_0x0a9e('0x9c')](_0x2415fe[_0x0a9e('0x72')],{'$or':_[_0x0a9e('0x37')](_0x2415fe[_0x0a9e('0x3a')],function(_0x5a1848){var _0x43c397={};_0x43c397[_0x5a1848]={'$like':'%'+_0x4262d0['query'][_0x0a9e('0x81')]+'%'};return _0x43c397;})});}if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x77')]){var _0x3cf222=_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x77')]['split'](',');var _0x1a0314={};_0x1a0314[_0x3cf222[0x0]]={'$gte':moment(_0x3cf222[0x1])[_0x0a9e('0xce')](_0x0a9e('0xcf'))};_0x2415fe[_0x0a9e('0x72')]=_['merge'](_0x2415fe[_0x0a9e('0x72')],_0x1a0314);}_0x2415fe=_[_0x0a9e('0x9c')]({},_0x2415fe,_0x4262d0[_0x0a9e('0xc5')]);return db[_0x0a9e('0x29')][_0x0a9e('0x16')]({'where':_0x2415fe[_0x0a9e('0x72')]})[_0x0a9e('0x1a')](function(_0x25931e){_0x98c62c[_0x0a9e('0x16')]=_0x25931e;if(_0x4262d0[_0x0a9e('0x38')]['includeAll']){_0x2415fe[_0x0a9e('0xc4')]=[{'all':!![]}];}return db[_0x0a9e('0x29')][_0x0a9e('0xd0')](_0x2415fe);})[_0x0a9e('0x1a')](function(_0xea8bd1){if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0xd1')]===_0x0a9e('0xd2')){for(var _0x566b90=0x0;_0x566b90<_0xea8bd1[_0x0a9e('0x3c')];_0x566b90++){_0xea8bd1[_0x566b90][_0x0a9e('0xc7')]=juice(_0xea8bd1[_0x566b90][_0x0a9e('0xc7')]);}}_0x98c62c['rows']=_0xea8bd1;return _0x98c62c;});}})[_0x0a9e('0x1a')](respondWithFilteredResult(_0xc876d4,_0x2415fe))[_0x0a9e('0x30')](handleError(_0xc876d4,null));};exports[_0x0a9e('0xd3')]=function(_0x97d5b5,_0x370b5e){return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x97d5b5[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x370b5e,null))[_0x0a9e('0x1a')](function(_0x5a7dad){if(_0x5a7dad){return _0x5a7dad[_0x0a9e('0xd4')](_0x97d5b5[_0x0a9e('0xc7')][_0x0a9e('0xc9')],_[_0x0a9e('0xca')](_0x97d5b5[_0x0a9e('0xc7')],[_0x0a9e('0xc9'),'id'])||{})['spread'](function(){return db[_0x0a9e('0xd5')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x97d5b5[_0x0a9e('0xc7')][_0x0a9e('0xc9')]}});})[_0x0a9e('0x1a')](function(_0x2a07d0){socket['emit'](_0x0a9e('0xd6'),{'id':Number(_0x97d5b5[_0x0a9e('0xc2')]['id']),'tags':_0x2a07d0||[]});return{'id':Number(_0x97d5b5[_0x0a9e('0xc2')]['id']),'tags':_0x2a07d0||[]};});}})[_0x0a9e('0x1a')](respondWithResult(_0x370b5e,null))[_0x0a9e('0x30')](handleError(_0x370b5e,null));};exports['removeTags']=function(_0x57b1b1,_0x9484c8){return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x57b1b1['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x9484c8,null))[_0x0a9e('0x1a')](function(_0x422f0a){if(_0x422f0a){return _0x422f0a['removeTags'](_0x57b1b1[_0x0a9e('0x38')][_0x0a9e('0xc9')]);}})[_0x0a9e('0x1a')](respondWithStatusCode(_0x9484c8,null))['catch'](handleError(_0x9484c8,null));};exports[_0x0a9e('0xd7')]=function(_0x336b30,_0x3b7213){var _0x549e03=moment()['unix']()['toString']();var _0x3b04fd=path[_0x0a9e('0xd8')](config[_0x0a9e('0xd9')],_0x0a9e('0xda'),'files',_0x0a9e('0xdb'));var _0x532424=path[_0x0a9e('0xd8')](config[_0x0a9e('0xd9')],_0x0a9e('0xda'),'files',_0x0a9e('0xdc'));var _0x33a26c=path[_0x0a9e('0xd8')](_0x3b04fd,_0x549e03);var _0x580dd6=util[_0x0a9e('0xce')]('transcript-%d-%s.zip',_0x336b30[_0x0a9e('0xc2')]['id'],_0x549e03);var _0x5c57e1=path[_0x0a9e('0xd8')](_0x3b04fd,_0x580dd6);var _0x57b7d4=[];if(_0x336b30[_0x0a9e('0x38')][_0x0a9e('0xdc')]){_0x57b7d4[_0x0a9e('0x27')]({'model':db[_0x0a9e('0xdd')],'as':_0x0a9e('0xde'),'raw':!![]});}var _0x251dd9=[{'model':db[_0x0a9e('0x29')],'as':'Messages','attributes':['id',_0x0a9e('0xc7'),_0x0a9e('0x44'),'to','cc','bcc',_0x0a9e('0xdf'),_0x0a9e('0x75')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x57b7d4}];return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x336b30[_0x0a9e('0xc2')]['id']},'include':_0x251dd9})['then'](handleEntityNotFound(_0x3b7213,null))[_0x0a9e('0x1a')](function(_0xf49ed4){if(_0xf49ed4&&_0xf49ed4[_0x0a9e('0xe0')]){var _0x3f0d64=_0xf49ed4[_0x0a9e('0xe1')]({'plain':!![]});fs[_0x0a9e('0xe2')](_0x33a26c);return BPromise[_0x0a9e('0xe3')](_0x3f0d64[_0x0a9e('0xe0')],function(_0x22767f,_0x426c3c){var _0x56e148={'from':_0x22767f[_0x0a9e('0x44')],'to':_0x22767f['to'],'subject':_0x22767f['subject'],'html':_0x22767f[_0x0a9e('0xc7')],'headers':{'Date':moment(_0x22767f[_0x0a9e('0x75')])[_0x0a9e('0xce')](_0x0a9e('0xe4'))},'attachments':[]};if(_0x22767f['cc']){_0x56e148[_0x0a9e('0xe5')]['Cc']=_0x22767f['cc'];}if(_0x22767f[_0x0a9e('0xe6')]){_0x56e148['headers'][_0x0a9e('0xe7')]=_0x22767f[_0x0a9e('0xe6')];}return new BPromise(function(_0x2977a7,_0x55a599){if(_0x22767f[_0x0a9e('0xde')]){for(var _0x402544=0x0;_0x402544<_0x22767f[_0x0a9e('0xde')][_0x0a9e('0x3c')];_0x402544++){var _0x31e1e0=_0x22767f[_0x0a9e('0xde')][_0x402544];var _0x1e93f5=path['join'](_0x532424,_0x31e1e0[_0x0a9e('0xe8')]);if(fs[_0x0a9e('0xe9')](_0x1e93f5)){_0x56e148[_0x0a9e('0xdc')][_0x0a9e('0x27')]({'name':_0x31e1e0[_0x0a9e('0x20')],'contentType':_0x31e1e0[_0x0a9e('0x65')],'data':fs[_0x0a9e('0xea')](_0x1e93f5)});}}}emlformat['build'](_0x56e148,function(_0x5c8720,_0x10aa22){if(_0x5c8720)return _0x55a599(_0x5c8720);fs[_0x0a9e('0xeb')](path[_0x0a9e('0xd8')](_0x33a26c,util[_0x0a9e('0xce')](_0x0a9e('0xec'),_0x426c3c)),_0x10aa22);return _0x2977a7(_0x10aa22);});});})[_0x0a9e('0x1a')](function(){return new BPromise(function(_0x609711,_0x584854){zipdir(_0x33a26c,{'saveTo':_0x5c57e1},function(_0x39ea62,_0x1d7fc4){if(_0x39ea62)return _0x584854(_0x39ea62);return _0x609711(_0x1d7fc4);});})[_0x0a9e('0x1a')](function(){return new BPromise(function(_0x2675a5,_0x1b1757){rimraf(_0x33a26c,function(_0x3c6082){if(_0x3c6082)_0x1b1757(_0x3c6082);return _0x2675a5();});});})[_0x0a9e('0x1a')](function(){return _0x3b7213['download'](_0x5c57e1,_0x580dd6,function(_0x311288){if(!_0x311288)fs[_0x0a9e('0xed')](_0x5c57e1);});});});}else{return _0x3b7213[_0x0a9e('0x1d')](0xc8);}})['catch'](handleError(_0x3b7213,null));}; \ No newline at end of file +var _0xb10b=['Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','findOne','enableEmailPreview','show','params','rawAttributes','includeAll','include','merge','options','create','body','describe','addMessage','ids','omit','getMessages','nolimit','pick','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','rows','spread','emit','mailInteractionTags:save','removeTags','download','unix','join','server','tmp','root','files','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','subject','get','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','build','message%d.eml','unlinkSync','eml-format','zip-dir','moment','bluebird','path','lodash','squel','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','error','stack','name','send','fullname','TagIds','Tags','split','forEach','push','MailMessage','out','-id','trimStart','plainBody','catch','index','map','MailInteraction','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','field','color','tools_tags','u.id','ui.MailInteractionId','from','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','mail_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','expr','search','parseSearch','conditions','length','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','some','compact','isEmpty','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','isEmail','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','role','getMailAccounts','i.MailAccountId\x20IS\x20NULL','agent','toString','sequelize','keyBy','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.updatedAt','i.closed','i.attach','i.lastMsgAt','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.ContactId','i.MailAccountId','Contact.firstName','c.email'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xb10b,0x12a));var _0xbb10=function(_0x5c9e08,_0x14a8e6){_0x5c9e08=_0x5c9e08-0x0;var _0x502e01=_0xb10b[_0x5c9e08];return _0x502e01;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var BPromise=require(_0xbb10('0x3'));var util=require('util');var path=require(_0xbb10('0x4'));var fs=require('fs');var _=require(_0xbb10('0x5'));var squel=require(_0xbb10('0x6'));var juice=require(_0xbb10('0x7'));var Redis=require(_0xbb10('0x8'));var qs=require(_0xbb10('0x9'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0xbb10('0xa'))(_0xbb10('0xb'));var config=require('../../config/environment');var db=require(_0xbb10('0xc'))['db'];config[_0xbb10('0xd')]=_[_0xbb10('0xe')](config[_0xbb10('0xd')],{'host':_0xbb10('0xf'),'port':0x18eb});var socket=require(_0xbb10('0x10'))(new Redis(config[_0xbb10('0xd')]));require(_0xbb10('0x11'))['register'](socket);function respondWithStatusCode(_0x4e47f8,_0x20bd61){_0x20bd61=_0x20bd61||0xcc;return function(_0x118a74){if(_0x118a74){return _0x4e47f8[_0xbb10('0x12')](_0x20bd61);}return _0x4e47f8['status'](_0x20bd61)[_0xbb10('0x13')]();};}function respondWithResult(_0x5be7e0,_0x44fb19){_0x44fb19=_0x44fb19||0xc8;return function(_0x916a32){if(_0x916a32){return _0x5be7e0[_0xbb10('0x14')](_0x44fb19)[_0xbb10('0x15')](_0x916a32);}};}function respondWithFilteredResult(_0x442548,_0x147230){return function(_0x58a612){if(_0x58a612){var _0x26e021=typeof _0x147230[_0xbb10('0x16')]===_0xbb10('0x17')&&typeof _0x147230[_0xbb10('0x18')]===_0xbb10('0x17');var _0x2f2ebf=_0x58a612[_0xbb10('0x19')];var _0x36b5e8=_0x26e021?0x0:_0x147230[_0xbb10('0x16')];var _0x2b184e=_0x26e021?_0x58a612['count']:_0x147230[_0xbb10('0x16')]+_0x147230[_0xbb10('0x18')];var _0x133ac2;if(_0x2b184e>=_0x2f2ebf){_0x2b184e=_0x2f2ebf;_0x133ac2=0xc8;}else{_0x133ac2=0xce;}_0x442548[_0xbb10('0x14')](_0x133ac2);return _0x442548[_0xbb10('0x1a')](_0xbb10('0x1b'),_0x36b5e8+'-'+_0x2b184e+'/'+_0x2f2ebf)[_0xbb10('0x15')](_0x58a612);}return null;};}function saveUpdates(_0x30efc6){return function(_0xbf2906){if(_0xbf2906){return _0xbf2906[_0xbb10('0x1c')](_0x30efc6)['then'](function(_0x5ff0cf){return _0x5ff0cf;});}return null;};}function removeEntity(_0x19f48d){return function(_0x388fab){if(_0x388fab){return _0x388fab[_0xbb10('0x1d')]()[_0xbb10('0x1e')](function(){_0x19f48d[_0xbb10('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12f888){return function(_0x12ef77){if(!_0x12ef77){_0x12f888['sendStatus'](0x194);}return _0x12ef77;};}function handleError(_0x4c4b0d,_0x8e2b97){_0x8e2b97=_0x8e2b97||0x1f4;return function(_0x311abe){logger[_0xbb10('0x1f')](_0x311abe[_0xbb10('0x20')]);if(_0x311abe[_0xbb10('0x21')]){delete _0x311abe[_0xbb10('0x21')];}_0x4c4b0d[_0xbb10('0x14')](_0x8e2b97)[_0xbb10('0x22')](_0x311abe);};}function getInteractionUsers(_0x7f2377,_0x395404){return new BPromise(function(_0x3ba6cd,_0x26ad93){try{if(_0x395404[_0x7f2377['id']]){_0x7f2377['Users']=_['map'](_0x395404[_0x7f2377['id']],function(_0x4fb5e0){return{'id':_0x4fb5e0['id'],'fullname':_0x4fb5e0[_0xbb10('0x23')]};});}}catch(_0x3c5ae7){_0x26ad93(_0x3c5ae7);}_0x3ba6cd(_0x7f2377);});}function getInteractionTags(_0x2c89b9,_0x4e25ff){return new BPromise(function(_0x2fdde9,_0x24d586){try{if(_0x2c89b9[_0xbb10('0x24')]){_0x2c89b9[_0xbb10('0x25')]=[];_0x2c89b9[_0xbb10('0x24')][_0xbb10('0x26')](',')[_0xbb10('0x27')](function(_0x4aabb9){_0x2c89b9[_0xbb10('0x25')][_0xbb10('0x28')](_0x4e25ff[_0x4aabb9]);});}delete _0x2c89b9[_0xbb10('0x24')];}catch(_0x2e0249){_0x24d586(_0x2e0249);}_0x2fdde9(_0x2c89b9);});}function getLastMessageText(_0x1d30aa){return new BPromise(function(_0x2ff4c1,_0x5d5c80){return db[_0xbb10('0x29')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x1d30aa['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xbb10('0x2a')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0xbb10('0x2b'),'raw':!![]})[_0xbb10('0x1e')](function(_0x1b59f9){if(_0x1b59f9&&_0x1b59f9['plainBody']){_0x1d30aa['lastMsgText']=_[_0xbb10('0x2c')](_0x1b59f9[_0xbb10('0x2d')]);}_0x2ff4c1(_0x1d30aa);})['catch'](function(_0x359ad4){_0x5d5c80(_0x359ad4);});});}function updateMailInteraction(_0x37dde7,_0x2f653f,_0x1c0b57,_0x37a83f){return new BPromise(function(_0x138bc6,_0xf85197){return getInteractionUsers(_0x37dde7,_0x1c0b57)['then'](function(_0x25acb3){return getInteractionTags(_0x25acb3,_0x2f653f);})[_0xbb10('0x1e')](function(_0x441d15){if(_0x37a83f){_0x138bc6(getLastMessageText(_0x441d15));}else{_0x138bc6(_0x441d15);}})[_0xbb10('0x2e')](function(_0xfb2c5e){_0xf85197(_0xfb2c5e);});});}exports[_0xbb10('0x2f')]=function(_0x188cbd,_0x10202c){var _0x3c8d7d={},_0x56943c={},_0x2b5352={'count':0x0,'rows':[]};var _0x150107=_[_0xbb10('0x30')](db[_0xbb10('0x31')]['rawAttributes'],function(_0x111762){return{'name':_0x111762['fieldName'],'type':_0x111762['type'][_0xbb10('0x32')]};});_0x56943c[_0xbb10('0x33')]=_[_0xbb10('0x30')](_0x150107,_0xbb10('0x21'));_0x56943c[_0xbb10('0x34')]=_[_0xbb10('0x35')](_0x188cbd['query']);_0x56943c[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x56943c['model'],_0x56943c['query']);_0x3c8d7d['attributes']=_[_0xbb10('0x37')](_0x56943c[_0xbb10('0x33')],qs[_0xbb10('0x38')](_0x188cbd['query'][_0xbb10('0x38')]));_0x3c8d7d[_0xbb10('0x39')]=_0x3c8d7d[_0xbb10('0x39')]['length']?_0x3c8d7d[_0xbb10('0x39')]:_0x56943c[_0xbb10('0x33')];if(!_0x188cbd[_0xbb10('0x34')][_0xbb10('0x3a')]('nolimit')){_0x3c8d7d[_0xbb10('0x18')]=qs[_0xbb10('0x18')](_0x188cbd['query'][_0xbb10('0x18')]);_0x3c8d7d[_0xbb10('0x16')]=qs[_0xbb10('0x16')](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x16')]);}_0x3c8d7d[_0xbb10('0x3b')]=qs['sort'](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x3c')]);_0x3c8d7d[_0xbb10('0x3d')]=qs[_0xbb10('0x36')](_['pick'](_0x188cbd[_0xbb10('0x34')],_0x56943c[_0xbb10('0x36')]),_0x150107);var _0x23dc18=[];var _0x403beb=squel['select']()[_0xbb10('0x3e')]('id')[_0xbb10('0x3e')]('name')['field'](_0xbb10('0x3f'))['from'](_0xbb10('0x40'));var _0x180933=squel['select']()[_0xbb10('0x3e')](_0xbb10('0x41'))[_0xbb10('0x3e')]('u.fullname')[_0xbb10('0x3e')](_0xbb10('0x42'))[_0xbb10('0x43')](_0xbb10('0x44'),'ui')[_0xbb10('0x45')](_0xbb10('0x46'),'u',_0xbb10('0x47'));var _0x3efa96=squel[_0xbb10('0x48')]()[_0xbb10('0x43')](_0xbb10('0x49'),'i')[_0xbb10('0x45')]('cm_contacts','c',_0xbb10('0x4a'))[_0xbb10('0x45')]('users','o',_0xbb10('0x4b'))[_0xbb10('0x45')](_0xbb10('0x4c'),'a',_0xbb10('0x4d'))[_0xbb10('0x45')](_0xbb10('0x4e'),'me',_0xbb10('0x4f'))['left_join']('mail_interaction_has_tags','it',_0xbb10('0x50'))[_0xbb10('0x45')](_0xbb10('0x40'),'t','t.id\x20=\x20it.TagId');var _0x5f0c12=squel[_0xbb10('0x51')]();var _0x34cf4e=[];var _0x1bd054=squel[_0xbb10('0x51')]();var _0x10159b;if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x52')]){_0x10159b=as[_0xbb10('0x53')](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x52')]);var _0x550111=_0x10159b['sqlOperator'];for(var _0x412e13=0x0;_0x412e13<_0x10159b[_0xbb10('0x54')][_0xbb10('0x55')];_0x412e13++){var _0xb014b0=_0x10159b[_0xbb10('0x54')][_0x412e13];var _0x440f9e='i';var _0x358e7e=_[_0xbb10('0x56')](_0x150107,[_0xbb10('0x21'),_0xb014b0[_0xbb10('0x3e')]]);if(!_0x358e7e){switch(_0xb014b0[_0xbb10('0x3e')]){case _0xbb10('0x57'):if(_0xb014b0[_0xbb10('0x58')]==0x1){_0x3efa96[_0xbb10('0x59')]('`'+_0xb014b0[_0xbb10('0x3e')]+'`\x20=\x200');}else{_0x3efa96[_0xbb10('0x59')]('`'+_0xb014b0['field']+_0xbb10('0x5a'));}break;case _0xbb10('0x5b'):if(_0xb014b0[_0xbb10('0x5c')]===_0xbb10('0x5d')){if(_0xb014b0[_0xbb10('0x58')][_0xbb10('0x26')]('\x20')[_0xbb10('0x55')]>0x1){_0x5f0c12[_0x550111](_0xbb10('0x5e'),qs[_0xbb10('0x5f')](_0xb014b0[_0xbb10('0x58')]),null);}else{var _0x44a056='%'+_0xb014b0[_0xbb10('0x58')]+'%';_0x5f0c12[_0x550111](_0xbb10('0x60'),_0x44a056,_0x44a056,_0x44a056);}}else{_0x358e7e=_[_0xbb10('0x56')](_0x150107,[_0xbb10('0x21'),'ContactId']);_0xb014b0[_0xbb10('0x3e')]=_0xbb10('0x61');_0x155dc5=as[_0xbb10('0x62')](_0x440f9e,_0x358e7e[_0xbb10('0x63')],_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5[_0xbb10('0x64')],_0x155dc5[_0xbb10('0x58')]['start'],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x13')]);}break;case _0xbb10('0x65'):var _0x14fed3=_0xb014b0[_0xbb10('0x58')][_0xbb10('0x26')](',')[_0xbb10('0x30')](function(_0x12ec18){return Number(_0x12ec18);});_0x14fed3[_0xbb10('0x27')](function(_0x40c4fb){_0x1bd054['or'](_0xbb10('0x66'),'%,'+_0x40c4fb+',%');});_0x34cf4e=_[_0xbb10('0x67')](_0x34cf4e,_0x14fed3);break;case _0xbb10('0x68'):if(_0xb014b0['operator']==='$substring'){_0x5f0c12[_0x550111](_0xbb10('0x69'),'%'+_0xb014b0[_0xbb10('0x58')]+'%',null);}else{_0x358e7e=_[_0xbb10('0x56')](_0x150107,[_0xbb10('0x21'),'UserId']);_0xb014b0['field']=_0xbb10('0x6a');_0x155dc5=as[_0xbb10('0x62')](_0x440f9e,_0x358e7e[_0xbb10('0x63')],_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5[_0xbb10('0x64')],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x6b')],_0x155dc5[_0xbb10('0x58')]['end']);}break;case _0xbb10('0x2d'):_0x155dc5=as[_0xbb10('0x62')]('me',null,_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5['text'],_0x155dc5['value']['start'],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x13')]);break;}}else{var _0x155dc5=as['buildExpression'](_0x440f9e,_0x358e7e['type'],_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5['text'],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x6b')],_0x155dc5[_0xbb10('0x58')]['end']);}}}else{var _0xa1bbd9=_(_0x188cbd[_0xbb10('0x34')])['keys']()['map'](function(_0x27d7b9){return _[_0xbb10('0x6c')](_0x150107,[_0xbb10('0x21'),_0x27d7b9])?_0x27d7b9:undefined;})[_0xbb10('0x6d')]()['value']();if(!_[_0xbb10('0x6e')](_0xa1bbd9)){_0xa1bbd9[_0xbb10('0x27')](function(_0xa7179d){if(_0xa7179d==='MailAccountId'){_0x3efa96[_0xbb10('0x3d')](_0xbb10('0x6f'),[][_0xbb10('0x70')](_0x188cbd['query'][_0xa7179d]));}else if(_0xa7179d===_0xbb10('0x71')){var _0x31e85e=JSON[_0xbb10('0x72')](_0x188cbd[_0xbb10('0x34')][_0xa7179d])['$gte'];var _0x251417=JSON[_0xbb10('0x72')](_0x188cbd[_0xbb10('0x34')][_0xa7179d])[_0xbb10('0x73')];_0x3efa96['where'](_0xbb10('0x74'),_0x31e85e,_0x251417);}else{if(_0x188cbd[_0xbb10('0x34')][_0xa7179d]===_0xbb10('0x75')){_0x3efa96[_0xbb10('0x3d')]('i.'+_0xa7179d+_0xbb10('0x76'));}else{_0x3efa96[_0xbb10('0x3d')]('i.'+_0xa7179d+_0xbb10('0x77'),_0x188cbd['query'][_0xa7179d]);}}});}if(_0x188cbd['query']['read']){if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x78')]==0x1){_0x3efa96[_0xbb10('0x59')]('`unreadMessages`\x20=\x200');}else{_0x3efa96['having'](_0xbb10('0x79'));}}if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7a')]){_0x34cf4e=_[_0xbb10('0x7b')](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7a')])?_0x188cbd['query'][_0xbb10('0x7a')]:new Array(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7a')]);_0x34cf4e[_0xbb10('0x27')](function(_0x2aaaa6){_0x1bd054['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2aaaa6+',%');});}if(_0x188cbd['query']['filter']){var _0x329da7=_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7c')][_0xbb10('0x7d')]('\x5c','\x5c\x5c')[_0xbb10('0x7d')](/'/g,'\x27\x27');if(qs[_0xbb10('0x7e')](_0x329da7)){_0x5f0c12['or']('i.id\x20LIKE\x20?',_0x329da7+'%');}else if(qs[_0xbb10('0x7f')](_0x329da7)){_0x5f0c12['or']('c.email\x20LIKE\x20?',_0x329da7+'%');}else{_0x5f0c12['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x329da7))['or'](_0xbb10('0x80'),qs[_0xbb10('0x5f')](_0x329da7));}}}_0x3efa96[_0xbb10('0x3d')](_0x5f0c12);_0x3efa96[_0xbb10('0x81')]('i.id');var _0x122d38={'type':db['Sequelize']['QueryTypes'][_0xbb10('0x82')],'raw':!![]};var _0xfe3db0=_0x3efa96[_0xbb10('0x83')]();_0xfe3db0[_0xbb10('0x3e')](_0xbb10('0x84'));_0xfe3db0['field'](_0xbb10('0x85'),_0xbb10('0x57'));if(_0x3c8d7d[_0xbb10('0x3b')]){_0x3c8d7d[_0xbb10('0x3b')][_0xbb10('0x27')](function(_0x27f42f){var _0x174395=_0x27f42f[0x0]==='contactName'?_0x27f42f[0x0]:'i.'+_0x27f42f[0x0];_0x3efa96[_0xbb10('0x3b')](_0x174395,_0x27f42f[0x1]===_0xbb10('0x86')?![]:!![]);});}if(!_[_0xbb10('0x6e')](_0x34cf4e)){_0x3efa96[_0xbb10('0x59')](_0x1bd054);_0xfe3db0[_0xbb10('0x3d')](_0xbb10('0x87'),_0x34cf4e);}BPromise[_0xbb10('0x88')]()[_0xbb10('0x1e')](function(){if(!_0x10159b){if(_0x188cbd['query'][_0xbb10('0x89')])return;_0xfe3db0[_0xbb10('0x3d')](_0xbb10('0x8a'));_0x3efa96['where']('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x188cbd['user'][_0xbb10('0x8b')]!=='agent')return;return _0x188cbd['user'][_0xbb10('0x8c')]({'attributes':['id'],'raw':!![]})[_0xbb10('0x1e')](function(_0x33ff06){if(_[_0xbb10('0x6e')](_0x33ff06)){_0xfe3db0[_0xbb10('0x3d')](_0xbb10('0x8d'));_0x3efa96[_0xbb10('0x3d')](_0xbb10('0x8d'));}else{_0xfe3db0[_0xbb10('0x3d')]('i.MailAccountId\x20IN\x20?',_[_0xbb10('0x30')](_0x33ff06,'id'));_0x3efa96[_0xbb10('0x3d')](_0xbb10('0x6f'),_[_0xbb10('0x30')](_0x33ff06,'id'));}});})['then'](function(){if(_0x188cbd['user'][_0xbb10('0x8b')]===_0xbb10('0x8e')&&!_0x10159b&&!_0x188cbd[_0xbb10('0x34')][_0xbb10('0x89')])return[];return db['sequelize'][_0xbb10('0x34')](_0xfe3db0[_0xbb10('0x8f')](),_0x122d38);})[_0xbb10('0x1e')](function(_0xf7b3e1){_0x2b5352[_0xbb10('0x19')]=_0xf7b3e1['length'];if(_0x2b5352['count']===0x0)return[];return db[_0xbb10('0x90')][_0xbb10('0x34')](_0x403beb[_0xbb10('0x8f')](),_0x122d38)['then'](function(_0x256b35){_0x23dc18=_[_0xbb10('0x91')](_0x256b35,'id');_0x122d38=_['merge'](_0x122d38,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x38')]){_0x3c8d7d[_0xbb10('0x39')]['forEach'](function(_0x32d5a5){_0x3efa96[_0xbb10('0x3e')]('i.'+_0x32d5a5);});}else{_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x85'),_0xbb10('0x57'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x92'),_0xbb10('0x93'));_0x3efa96[_0xbb10('0x3e')]('a.mandatoryDisposition',_0xbb10('0x94'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x95'),_0xbb10('0x96'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x84'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x97'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x98'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x99'));_0x3efa96['field']('i.closedAt');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9a'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9b'));_0x3efa96[_0xbb10('0x3e')]('i.lastMsgDirection');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9c'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9d'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9e'));_0x3efa96['field'](_0xbb10('0x9f'));_0x3efa96[_0xbb10('0x3e')]('i.substatus');_0x3efa96[_0xbb10('0x3e')]('i.to');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa0'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa1'));_0x3efa96[_0xbb10('0x3e')]('i.UserId');_0x3efa96[_0xbb10('0x3e')]('c.firstName',_0xbb10('0xa2'));_0x3efa96[_0xbb10('0x3e')]('c.lastName','Contact.lastName');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa3'),_0xbb10('0xa4'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa5'),_0xbb10('0xa6'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa7'),_0xbb10('0xa8'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa9'),'Contact.fax');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xaa'),_0xbb10('0xab'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xac'),_0xbb10('0xad'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xae'),_0xbb10('0x24'));}if(_0x3c8d7d[_0xbb10('0x18')])_0x3efa96[_0xbb10('0x18')](_0x3c8d7d[_0xbb10('0x18')]);if(_0x3c8d7d['offset'])_0x3efa96[_0xbb10('0x16')](_0x3c8d7d['offset']);return db[_0xbb10('0x90')][_0xbb10('0x34')](_0x3efa96[_0xbb10('0x8f')](),_0x122d38);})[_0xbb10('0x1e')](function(_0x38d369){if(_0x38d369['length']>0x0)_0x180933[_0xbb10('0x3d')](_0xbb10('0xaf'),_[_0xbb10('0x30')](_0x38d369,'id'));return db[_0xbb10('0x90')][_0xbb10('0x34')](_0x180933[_0xbb10('0x8f')](),_0x122d38)['then'](function(_0x4bd470){var _0x5cc9d7=_[_0xbb10('0xb0')](_0x4bd470,_0xbb10('0xb1'));var _0x57d5a1=[];return db[_0xbb10('0xb2')][_0xbb10('0xb3')]({'attributes':['enableEmailPreview'],'raw':!![]})[_0xbb10('0x1e')](function(_0xaede56){var _0x5642c3=_0xaede56[_0xbb10('0xb4')];_0x38d369['forEach'](function(_0x34cec7){_0x57d5a1[_0xbb10('0x28')](updateMailInteraction(_0x34cec7,_0x23dc18,_0x5cc9d7,_0x5642c3));});return BPromise['all'](_0x57d5a1);});});});})[_0xbb10('0x1e')](function(_0x28cc74){_0x2b5352['rows']=_0x28cc74;return _0x2b5352;})['then'](respondWithFilteredResult(_0x10202c,_0x3c8d7d))[_0xbb10('0x2e')](handleError(_0x10202c,null));};exports[_0xbb10('0xb5')]=function(_0x3e0e34,_0x3299bc){var _0x3ceb77={'raw':![],'where':{'id':_0x3e0e34[_0xbb10('0xb6')]['id']}},_0x4c3bdc={};_0x4c3bdc[_0xbb10('0x33')]=_[_0xbb10('0x35')](db['MailInteraction'][_0xbb10('0xb7')]);_0x4c3bdc[_0xbb10('0x34')]=_[_0xbb10('0x35')](_0x3e0e34[_0xbb10('0x34')]);_0x4c3bdc[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x4c3bdc[_0xbb10('0x33')],_0x4c3bdc[_0xbb10('0x34')]);_0x3ceb77[_0xbb10('0x39')]=_['intersection'](_0x4c3bdc['model'],qs[_0xbb10('0x38')](_0x3e0e34[_0xbb10('0x34')][_0xbb10('0x38')]));_0x3ceb77[_0xbb10('0x39')]=_0x3ceb77[_0xbb10('0x39')][_0xbb10('0x55')]?_0x3ceb77[_0xbb10('0x39')]:_0x4c3bdc[_0xbb10('0x33')];if(_0x3e0e34[_0xbb10('0x34')][_0xbb10('0xb8')]){_0x3ceb77[_0xbb10('0xb9')]=[{'all':!![]}];}_0x3ceb77=_[_0xbb10('0xba')]({},_0x3ceb77,_0x3e0e34[_0xbb10('0xbb')]);return db['MailInteraction'][_0xbb10('0x56')](_0x3ceb77)[_0xbb10('0x1e')](handleEntityNotFound(_0x3299bc,null))[_0xbb10('0x1e')](respondWithResult(_0x3299bc,null))[_0xbb10('0x2e')](handleError(_0x3299bc,null));};exports[_0xbb10('0xbc')]=function(_0xd9284e,_0x4258fc){return db[_0xbb10('0x31')][_0xbb10('0xbc')](_0xd9284e[_0xbb10('0xbd')],{})[_0xbb10('0x1e')](respondWithResult(_0x4258fc,0xc9))['catch'](handleError(_0x4258fc,null));};exports[_0xbb10('0x1c')]=function(_0x5e1ac5,_0x3faaca){if(_0x5e1ac5[_0xbb10('0xbd')]['id']){delete _0x5e1ac5[_0xbb10('0xbd')]['id'];}return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x5e1ac5[_0xbb10('0xb6')]['id']}})['then'](handleEntityNotFound(_0x3faaca,null))[_0xbb10('0x1e')](saveUpdates(_0x5e1ac5['body'],null))[_0xbb10('0x1e')](respondWithResult(_0x3faaca,null))[_0xbb10('0x2e')](handleError(_0x3faaca,null));};exports[_0xbb10('0x1d')]=function(_0x576bb6,_0x2b652c){return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x576bb6[_0xbb10('0xb6')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x2b652c,null))[_0xbb10('0x1e')](removeEntity(_0x2b652c,null))[_0xbb10('0x2e')](handleError(_0x2b652c,null));};exports[_0xbb10('0xbe')]=function(_0x589565,_0x3696b3){return db['MailInteraction'][_0xbb10('0xbe')]()[_0xbb10('0x1e')](respondWithResult(_0x3696b3,null))[_0xbb10('0x2e')](handleError(_0x3696b3,null));};exports[_0xbb10('0xbf')]=function(_0x44c229,_0x40271f){return db[_0xbb10('0x29')]['find']({'where':{'id':_0x44c229[_0xbb10('0xb6')]['id']}})['then'](handleEntityNotFound(_0x40271f,null))['then'](function(_0x1513e0){if(_0x1513e0){return _0x1513e0[_0xbb10('0xbf')](_0x44c229[_0xbb10('0xbd')][_0xbb10('0xc0')],_[_0xbb10('0xc1')](_0x44c229[_0xbb10('0xbd')],['ids','id'])||{});}})[_0xbb10('0x1e')](respondWithResult(_0x40271f,null))[_0xbb10('0x2e')](handleError(_0x40271f,null));};exports[_0xbb10('0xc2')]=function(_0xb1b7c8,_0x136520){var _0x28127c={'raw':![],'where':{}};var _0x528aff={};var _0xdfdc42={'count':0x0,'rows':[]};return db[_0xbb10('0x31')][_0xbb10('0xb3')]({'where':{'id':_0xb1b7c8[_0xbb10('0xb6')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x136520,null))[_0xbb10('0x1e')](function(_0x2764e1){if(_0x2764e1){_0x528aff['model']=_[_0xbb10('0x35')](db['MailMessage'][_0xbb10('0xb7')]);_0x528aff['query']=_['keys'](_0xb1b7c8[_0xbb10('0x34')]);_0x528aff[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x528aff[_0xbb10('0x33')],_0x528aff[_0xbb10('0x34')]);_0x28127c['attributes']=_[_0xbb10('0x37')](_0x528aff['model'],qs['fields'](_0xb1b7c8['query'][_0xbb10('0x38')]));_0x28127c[_0xbb10('0x39')]=_0x28127c[_0xbb10('0x39')][_0xbb10('0x55')]?_0x28127c[_0xbb10('0x39')]:_0x528aff['model'];if(!_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x3a')](_0xbb10('0xc3'))){_0x28127c[_0xbb10('0x18')]=qs[_0xbb10('0x18')](_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x18')]);_0x28127c['offset']=qs['offset'](_0xb1b7c8['query'][_0xbb10('0x16')]);}_0x28127c[_0xbb10('0x3b')]=qs[_0xbb10('0x3c')](_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x3c')]);_0x28127c[_0xbb10('0x3d')]=qs[_0xbb10('0x36')](_[_0xbb10('0xc4')](_0xb1b7c8[_0xbb10('0x34')],_0x528aff[_0xbb10('0x36')]));_0x28127c['where']['MailInteractionId']=_0x2764e1['id'];if(_0xb1b7c8['query'][_0xbb10('0x7c')]){_0x28127c[_0xbb10('0x3d')]=_[_0xbb10('0xba')](_0x28127c['where'],{'$or':_[_0xbb10('0x30')](_0x28127c[_0xbb10('0x39')],function(_0x2c638d){var _0x290280={};_0x290280[_0x2c638d]={'$like':'%'+_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x7c')]+'%'};return _0x290280;})});}if(_0xb1b7c8['query']['$gte']){var _0x356660=_0xb1b7c8['query'][_0xbb10('0xc5')][_0xbb10('0x26')](',');var _0x152ca9={};_0x152ca9[_0x356660[0x0]]={'$gte':moment(_0x356660[0x1])[_0xbb10('0xc6')](_0xbb10('0xc7'))};_0x28127c[_0xbb10('0x3d')]=_[_0xbb10('0xba')](_0x28127c[_0xbb10('0x3d')],_0x152ca9);}_0x28127c=_[_0xbb10('0xba')]({},_0x28127c,_0xb1b7c8[_0xbb10('0xbb')]);return db['MailMessage'][_0xbb10('0x19')]({'where':_0x28127c['where']})[_0xbb10('0x1e')](function(_0x5547fa){_0xdfdc42[_0xbb10('0x19')]=_0x5547fa;if(_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0xb8')]){_0x28127c[_0xbb10('0xb9')]=[{'all':!![]}];}return db['MailMessage'][_0xbb10('0xc8')](_0x28127c);})['then'](function(_0xfe1154){if(_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0xc9')]==='true'){for(var _0x298167=0x0;_0x298167<_0xfe1154[_0xbb10('0x55')];_0x298167++){_0xfe1154[_0x298167][_0xbb10('0xbd')]=juice(_0xfe1154[_0x298167][_0xbb10('0xbd')]);}}_0xdfdc42[_0xbb10('0xca')]=_0xfe1154;return _0xdfdc42;});}})[_0xbb10('0x1e')](respondWithFilteredResult(_0x136520,_0x28127c))['catch'](handleError(_0x136520,null));};exports['addTags']=function(_0x522a88,_0x26a752){return db['MailInteraction'][_0xbb10('0x56')]({'where':{'id':_0x522a88['params']['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x26a752,null))[_0xbb10('0x1e')](function(_0x385ad3){if(_0x385ad3){return _0x385ad3['setTags'](_0x522a88['body'][_0xbb10('0xc0')],_[_0xbb10('0xc1')](_0x522a88[_0xbb10('0xbd')],['ids','id'])||{})[_0xbb10('0xcb')](function(){return db[_0xbb10('0x65')][_0xbb10('0xc8')]({'attributes':['id','name','color'],'where':{'id':_0x522a88['body'][_0xbb10('0xc0')]}});})['then'](function(_0x3dfbcd){socket[_0xbb10('0xcc')](_0xbb10('0xcd'),{'id':Number(_0x522a88[_0xbb10('0xb6')]['id']),'tags':_0x3dfbcd||[]});return{'id':Number(_0x522a88[_0xbb10('0xb6')]['id']),'tags':_0x3dfbcd||[]};});}})[_0xbb10('0x1e')](respondWithResult(_0x26a752,null))[_0xbb10('0x2e')](handleError(_0x26a752,null));};exports[_0xbb10('0xce')]=function(_0x2746eb,_0x431792){return db[_0xbb10('0x31')]['find']({'where':{'id':_0x2746eb[_0xbb10('0xb6')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x431792,null))['then'](function(_0x14ef50){if(_0x14ef50){return _0x14ef50['removeTags'](_0x2746eb['query'][_0xbb10('0xc0')]);}})[_0xbb10('0x1e')](respondWithStatusCode(_0x431792,null))[_0xbb10('0x2e')](handleError(_0x431792,null));};exports[_0xbb10('0xcf')]=function(_0x99c4,_0x4ca4ce){var _0x161171=moment()[_0xbb10('0xd0')]()['toString']();var _0xa45726=path[_0xbb10('0xd1')](config['root'],_0xbb10('0xd2'),'files',_0xbb10('0xd3'));var _0x8e8049=path[_0xbb10('0xd1')](config[_0xbb10('0xd4')],_0xbb10('0xd2'),_0xbb10('0xd5'),_0xbb10('0xd6'));var _0x56f902=path[_0xbb10('0xd1')](_0xa45726,_0x161171);var _0x4720a1=util[_0xbb10('0xc6')](_0xbb10('0xd7'),_0x99c4[_0xbb10('0xb6')]['id'],_0x161171);var _0x1301e3=path['join'](_0xa45726,_0x4720a1);var _0x550301=[];if(_0x99c4['query'][_0xbb10('0xd6')]){_0x550301[_0xbb10('0x28')]({'model':db[_0xbb10('0xd8')],'as':_0xbb10('0xd9'),'raw':!![]});}var _0x57700b=[{'model':db[_0xbb10('0x29')],'as':_0xbb10('0xda'),'attributes':['id',_0xbb10('0xbd'),'from','to','cc','bcc',_0xbb10('0xdb'),'createdAt'],'where':{'secret':![]},'order':qs[_0xbb10('0x3c')]('id'),'include':_0x550301}];return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x99c4[_0xbb10('0xb6')]['id']},'include':_0x57700b})[_0xbb10('0x1e')](handleEntityNotFound(_0x4ca4ce,null))[_0xbb10('0x1e')](function(_0x1fe250){if(_0x1fe250&&_0x1fe250['Messages']){var _0x424371=_0x1fe250[_0xbb10('0xdc')]({'plain':!![]});fs['mkdirSync'](_0x56f902);return BPromise[_0xbb10('0xdd')](_0x424371[_0xbb10('0xda')],function(_0x32f261,_0x5b11a2){var _0x4b490a={'from':_0x32f261['from'],'to':_0x32f261['to'],'subject':_0x32f261[_0xbb10('0xdb')],'html':_0x32f261[_0xbb10('0xbd')],'headers':{'Date':moment(_0x32f261['createdAt'])[_0xbb10('0xc6')](_0xbb10('0xde'))},'attachments':[]};if(_0x32f261['cc']){_0x4b490a[_0xbb10('0xdf')]['Cc']=_0x32f261['cc'];}if(_0x32f261[_0xbb10('0xe0')]){_0x4b490a[_0xbb10('0xdf')][_0xbb10('0xe1')]=_0x32f261[_0xbb10('0xe0')];}return new BPromise(function(_0x48f0eb,_0x304603){if(_0x32f261['Attachments']){for(var _0x5a7c4e=0x0;_0x5a7c4e<_0x32f261['Attachments'][_0xbb10('0x55')];_0x5a7c4e++){var _0x572d73=_0x32f261['Attachments'][_0x5a7c4e];var _0x1f09f1=path['join'](_0x8e8049,_0x572d73[_0xbb10('0xe2')]);if(fs[_0xbb10('0xe3')](_0x1f09f1)){_0x4b490a[_0xbb10('0xd6')]['push']({'name':_0x572d73['name'],'contentType':_0x572d73[_0xbb10('0x63')],'data':fs['readFileSync'](_0x1f09f1)});}}}emlformat[_0xbb10('0xe4')](_0x4b490a,function(_0x211172,_0x589ecb){if(_0x211172)return _0x304603(_0x211172);fs['writeFileSync'](path[_0xbb10('0xd1')](_0x56f902,util[_0xbb10('0xc6')](_0xbb10('0xe5'),_0x5b11a2)),_0x589ecb);return _0x48f0eb(_0x589ecb);});});})['then'](function(){return new BPromise(function(_0x4f4aa8,_0x426a4f){zipdir(_0x56f902,{'saveTo':_0x1301e3},function(_0x22f153,_0x4d47cc){if(_0x22f153)return _0x426a4f(_0x22f153);return _0x4f4aa8(_0x4d47cc);});})[_0xbb10('0x1e')](function(){return new BPromise(function(_0x203e5a,_0xe88e90){rimraf(_0x56f902,function(_0x4845b5){if(_0x4845b5)_0xe88e90(_0x4845b5);return _0x203e5a();});});})[_0xbb10('0x1e')](function(){return _0x4ca4ce[_0xbb10('0xcf')](_0x1301e3,_0x4720a1,function(_0x166f4f){if(!_0x166f4f)fs[_0xbb10('0xe6')](_0x1301e3);});});});}else{return _0x4ca4ce[_0xbb10('0x12')](0xc8);}})[_0xbb10('0x2e')](handleError(_0x4ca4ce,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 2ab4dd0..ce370bb 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 _0x30ad=['exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','unreadMessages','emit','hasOwnProperty','hook'];(function(_0x59af6f,_0x5d0248){var _0x3a04e1=function(_0x563bc8){while(--_0x563bc8){_0x59af6f['push'](_0x59af6f['shift']());}};_0x3a04e1(++_0x5d0248);}(_0x30ad,0x6d));var _0xd30a=function(_0x53a689,_0x370316){_0x53a689=_0x53a689-0x0;var _0x12dd35=_0x30ad[_0x53a689];return _0x12dd35;};'use strict';var EventEmitter=require(_0xd30a('0x0'));var MailInteraction=require(_0xd30a('0x1'))['db'][_0xd30a('0x2')];var MailMessage=require('../../mysqldb')['db'][_0xd30a('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xd30a('0x4')](0x0);var events={'afterCreate':_0xd30a('0x5'),'afterUpdate':_0xd30a('0x6'),'afterDestroy':_0xd30a('0x7')};function emitEvent(_0xa2db84){return function(_0x33f64d,_0x5de215,_0x37faac){_0x33f64d[_0xd30a('0x8')]({'attributes':['id'],'raw':!![]})[_0xd30a('0x9')](function(_0x32192d){_0x33f64d[_0xd30a('0xa')](_0xd30a('0xb'),_0x32192d[_0xd30a('0xc')](function(_0x240398){return{'id':_0x240398['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x33f64d['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd30a('0x9')](function(_0x52b0b1){_0x33f64d[_0xd30a('0xa')](_0xd30a('0xd'),_0x52b0b1['length']);MailInteractionEvents[_0xd30a('0xe')](_0xa2db84+':'+_0x33f64d['id'],_0x33f64d);MailInteractionEvents['emit'](_0xa2db84,_0x33f64d);_0x37faac(null);})['catch'](_0x37faac(null));};}for(var e in events){if(events[_0xd30a('0xf')](e)){var event=events[e];MailInteraction[_0xd30a('0x10')](e,emitEvent(event));}}module[_0xd30a('0x11')]=MailInteractionEvents; \ No newline at end of file +var _0xfd53=['length','emit','catch','hook','exports','events','MailInteraction','MailMessage','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages'];(function(_0x3a97cd,_0x5b0109){var _0x84cbcd=function(_0x256123){while(--_0x256123){_0x3a97cd['push'](_0x3a97cd['shift']());}};_0x84cbcd(++_0x5b0109);}(_0xfd53,0x8d));var _0x3fd5=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0xfd53[_0x4e6ae6];return _0x23c108;};'use strict';var EventEmitter=require(_0x3fd5('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0x3fd5('0x1')];var MailMessage=require('../../mysqldb')['db'][_0x3fd5('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x3fd5('0x3'),'afterDestroy':_0x3fd5('0x4')};function emitEvent(_0x33f774){return function(_0x58add5,_0x2786f1,_0x23186a){_0x58add5[_0x3fd5('0x5')]({'attributes':['id'],'raw':!![]})[_0x3fd5('0x6')](function(_0x413bc6){_0x58add5[_0x3fd5('0x7')](_0x3fd5('0x8'),_0x413bc6[_0x3fd5('0x9')](function(_0xd782f1){return{'id':_0xd782f1['id']};}));return MailMessage[_0x3fd5('0xa')]({'where':{'MailInteractionId':_0x58add5['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3fd5('0x6')](function(_0x57ae3a){_0x58add5[_0x3fd5('0x7')](_0x3fd5('0xb'),_0x57ae3a[_0x3fd5('0xc')]);MailInteractionEvents[_0x3fd5('0xd')](_0x33f774+':'+_0x58add5['id'],_0x58add5);MailInteractionEvents[_0x3fd5('0xd')](_0x33f774,_0x58add5);_0x23186a(null);})[_0x3fd5('0xe')](_0x23186a(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x3fd5('0xf')](e,emitEvent(event));}}module[_0x3fd5('0x10')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 387a4e9..0e84f83 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 _0x6a45=['fti_mail_interactions','subject','substatus','substatusAt','format','closed','closedAt','changed','YYYY-MM-DD\x20HH:mm:ss','models','MailMessage','update','catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','define','MailInteraction','mail_interactions'];(function(_0x53e842,_0x2b0346){var _0x3b41bf=function(_0x1d4e61){while(--_0x1d4e61){_0x53e842['push'](_0x53e842['shift']());}};_0x3b41bf(++_0x2b0346);}(_0x6a45,0xcc));var _0x56a4=function(_0x4d8f6f,_0x2f52d3){_0x4d8f6f=_0x4d8f6f-0x0;var _0x12d8f8=_0x6a45[_0x4d8f6f];return _0x12d8f8;};'use strict';var _=require(_0x56a4('0x0'));var util=require('util');var logger=require(_0x56a4('0x1'))(_0x56a4('0x2'));var moment=require(_0x56a4('0x3'));var BPromise=require('bluebird');var rp=require(_0x56a4('0x4'));var fs=require('fs');var path=require(_0x56a4('0x5'));var rimraf=require(_0x56a4('0x6'));var config=require(_0x56a4('0x7'));var attributes=require(_0x56a4('0x8'));module['exports']=function(_0x178555,_0x309422){return _0x178555[_0x56a4('0x9')](_0x56a4('0xa'),attributes,{'tableName':_0x56a4('0xb'),'paranoid':![],'indexes':[{'name':_0x56a4('0xc'),'fields':[_0x56a4('0xd'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2515c4,_0x486a4a,_0x17bb08){if(_0x2515c4[_0x56a4('0xe')]){_0x2515c4[_0x56a4('0xf')]=moment()[_0x56a4('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x2515c4[_0x56a4('0x11')]){_0x2515c4[_0x56a4('0x12')]=moment()[_0x56a4('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x17bb08(null,_0x486a4a);},'beforeUpdate':function(_0x12e0a2,_0x197d01,_0x5debf3){if(_0x12e0a2[_0x56a4('0x13')]('substatus')){_0x12e0a2[_0x56a4('0xf')]=_0x12e0a2[_0x56a4('0xe')]?moment()['format'](_0x56a4('0x14')):null;}if(_0x12e0a2['changed'](_0x56a4('0x11'))){_0x12e0a2[_0x56a4('0x12')]=moment()[_0x56a4('0x10')](_0x56a4('0x14'));_0x12e0a2[_0x56a4('0xe')]=null;_0x12e0a2['substatusAt']=null;}_0x5debf3(null,_0x12e0a2);},'afterUpdate':function(_0x4ba635,_0x342c43,_0x5f4f04){var _0xaa0f91=_0x178555[_0x56a4('0x15')];var _0xe93b3e=_0x4ba635['get']({'plain':!![]});if(_0xe93b3e['closed']){return _0xaa0f91[_0x56a4('0x16')][_0x56a4('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0xe93b3e['id']}})['then'](function(){_0x5f4f04();})[_0x56a4('0x18')](function(_0x3fd6f7){_0x5f4f04(_0x3fd6f7);});}else{_0x5f4f04();}}},'charset':_0x56a4('0x19'),'collate':_0x56a4('0x1a')});}; \ No newline at end of file +var _0x610c=['rimraf','../../config/environment','./mailInteraction.attributes','mail_interactions','fti_mail_interactions','FULLTEXT','substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','format','changed','get','MailMessage','update','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x610c,0x171));var _0xc610=function(_0x25456c,_0x2f4fa9){_0x25456c=_0x25456c-0x0;var _0x4e4a0d=_0x610c[_0x25456c];return _0x4e4a0d;};'use strict';var _=require(_0xc610('0x0'));var util=require(_0xc610('0x1'));var logger=require(_0xc610('0x2'))(_0xc610('0x3'));var moment=require(_0xc610('0x4'));var BPromise=require(_0xc610('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc610('0x6'));var config=require(_0xc610('0x7'));var attributes=require(_0xc610('0x8'));module['exports']=function(_0x44a73e,_0x42b65c){return _0x44a73e['define']('MailInteraction',attributes,{'tableName':_0xc610('0x9'),'paranoid':![],'indexes':[{'name':_0xc610('0xa'),'fields':['subject','to'],'type':_0xc610('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1f102e,_0x240937,_0x5d9af3){if(_0x1f102e[_0xc610('0xc')]){_0x1f102e[_0xc610('0xd')]=moment()['format'](_0xc610('0xe'));}if(_0x1f102e[_0xc610('0xf')]){_0x1f102e[_0xc610('0x10')]=moment()[_0xc610('0x11')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5d9af3(null,_0x240937);},'beforeUpdate':function(_0x595cf5,_0x3704b2,_0x4dbb7c){if(_0x595cf5[_0xc610('0x12')](_0xc610('0xc'))){_0x595cf5[_0xc610('0xd')]=_0x595cf5[_0xc610('0xc')]?moment()[_0xc610('0x11')](_0xc610('0xe')):null;}if(_0x595cf5[_0xc610('0x12')](_0xc610('0xf'))){_0x595cf5[_0xc610('0x10')]=moment()['format'](_0xc610('0xe'));_0x595cf5[_0xc610('0xc')]=null;_0x595cf5[_0xc610('0xd')]=null;}_0x4dbb7c(null,_0x595cf5);},'afterUpdate':function(_0x1b02b4,_0xc25d84,_0x167c74){var _0x382439=_0x44a73e['models'];var _0x42f810=_0x1b02b4[_0xc610('0x13')]({'plain':!![]});if(_0x42f810[_0xc610('0xf')]){return _0x382439[_0xc610('0x14')][_0xc610('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x42f810['id']}})['then'](function(){_0x167c74();})[_0xc610('0x16')](function(_0x22c7f4){_0x167c74(_0x22c7f4);});}else{_0x167c74();}}},'charset':_0xc610('0x17'),'collate':_0xc610('0x18')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 552d936..edd1c10 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 _0x4cad=['UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','limit','debug','AddTagsToMailInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','localhost','socket.io-emitter','redis','./mailInteraction.socket','register','request','then','info','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','MailInteraction,\x20%s,\x20%s','message','result','catch'];(function(_0x583033,_0x37f452){var _0x4f94da=function(_0x14fd08){while(--_0x14fd08){_0x583033['push'](_0x583033['shift']());}};_0x4f94da(++_0x37f452);}(_0x4cad,0x179));var _0xd4ca=function(_0x213e82,_0x1ea3af){_0x213e82=_0x213e82-0x0;var _0x2150e3=_0x4cad[_0x213e82];return _0x2150e3;};'use strict';var _=require(_0xd4ca('0x0'));var util=require(_0xd4ca('0x1'));var moment=require(_0xd4ca('0x2'));var BPromise=require(_0xd4ca('0x3'));var rs=require(_0xd4ca('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd4ca('0x5'))['db'];var utils=require(_0xd4ca('0x6'));var logger=require(_0xd4ca('0x7'))(_0xd4ca('0x8'));var config=require(_0xd4ca('0x9'));var jayson=require(_0xd4ca('0xa'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xd4ca('0xb'),'port':0x18eb});var socket=require(_0xd4ca('0xc'))(new Redis(config[_0xd4ca('0xd')]));require(_0xd4ca('0xe'))[_0xd4ca('0xf')](socket);function respondWithRpcPromise(_0x385132,_0x4e1655,_0x11d8b3){return new BPromise(function(_0x382bb4,_0x4cccee){return client[_0xd4ca('0x10')](_0x385132,_0x11d8b3)[_0xd4ca('0x11')](function(_0x487082){logger[_0xd4ca('0x12')]('MailInteraction,\x20%s,\x20%s',_0x4e1655,_0xd4ca('0x13'));logger['debug'](_0xd4ca('0x14'),_0x4e1655,_0xd4ca('0x13'),JSON[_0xd4ca('0x15')](_0x487082));if(_0x487082[_0xd4ca('0x16')]){if(_0x487082['error'][_0xd4ca('0x17')]===0x1f4){logger[_0xd4ca('0x16')](_0xd4ca('0x18'),_0x4e1655,_0x487082[_0xd4ca('0x16')][_0xd4ca('0x19')]);return _0x4cccee(_0x487082[_0xd4ca('0x16')][_0xd4ca('0x19')]);}logger[_0xd4ca('0x16')](_0xd4ca('0x18'),_0x4e1655,_0x487082['error'][_0xd4ca('0x19')]);return _0x382bb4(_0x487082[_0xd4ca('0x16')][_0xd4ca('0x19')]);}else{logger[_0xd4ca('0x12')](_0xd4ca('0x18'),_0x4e1655,_0xd4ca('0x13'));_0x382bb4(_0x487082[_0xd4ca('0x1a')][_0xd4ca('0x19')]);}})[_0xd4ca('0x1b')](function(_0x4b83c2){logger[_0xd4ca('0x16')](_0xd4ca('0x18'),_0x4e1655,_0x4b83c2);_0x4cccee(_0x4b83c2);});});}exports[_0xd4ca('0x1c')]=function(_0x3661db){var _0x12e211=this;return new Promise(function(_0x5433e9,_0x2b8c16){return db[_0xd4ca('0x1d')][_0xd4ca('0x1e')](_0x3661db[_0xd4ca('0x1f')],{'raw':_0x3661db[_0xd4ca('0x20')]?_0x3661db[_0xd4ca('0x20')][_0xd4ca('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3661db[_0xd4ca('0x20')]?_0x3661db[_0xd4ca('0x20')][_0xd4ca('0x22')]||null:null,'attributes':_0x3661db[_0xd4ca('0x20')]?_0x3661db[_0xd4ca('0x20')][_0xd4ca('0x23')]||null:null,'limit':_0x3661db['options']?_0x3661db[_0xd4ca('0x20')][_0xd4ca('0x24')]||null:null})[_0xd4ca('0x11')](function(_0x3cc6b0){logger['info'](_0xd4ca('0x1c'),_0x3661db);logger[_0xd4ca('0x25')](_0xd4ca('0x1c'),_0x3661db,JSON[_0xd4ca('0x15')](_0x3cc6b0));_0x5433e9(_0x3cc6b0);})[_0xd4ca('0x1b')](function(_0x1135b3){logger[_0xd4ca('0x16')]('UpdateMailInteraction',_0x1135b3[_0xd4ca('0x19')],_0x3661db);_0x2b8c16(_0x12e211[_0xd4ca('0x16')](0x1f4,_0x1135b3[_0xd4ca('0x19')]));});});};exports[_0xd4ca('0x26')]=function(_0x393071){return new Promise(function(_0x51a094,_0x560a44){return db[_0xd4ca('0x1d')][_0xd4ca('0x27')]({'where':_0x393071[_0xd4ca('0x20')]?_0x393071[_0xd4ca('0x20')][_0xd4ca('0x22')]||null:null})[_0xd4ca('0x11')](function(_0x2f4483){if(_0x2f4483){return _0x2f4483[_0xd4ca('0x28')](_0x393071['body'][_0xd4ca('0x29')],_[_0xd4ca('0x2a')](_0x393071[_0xd4ca('0x1f')],[_0xd4ca('0x29'),'id'])||{});}})[_0xd4ca('0x2b')](function(_0x9b0add){logger['info']('AddTags',_0x393071);logger[_0xd4ca('0x25')](_0xd4ca('0x2c'),_0x393071,JSON['stringify'](_0x9b0add));_0x51a094(_0x9b0add);})[_0xd4ca('0x1b')](function(_0x1c9f36){logger['error'](_0xd4ca('0x2c'),_0x1c9f36['message'],_0x393071);_0x560a44(_this[_0xd4ca('0x16')](0x1f4,_0x1c9f36[_0xd4ca('0x19')]));});});}; \ No newline at end of file +var _0xa93a=['./mailInteraction.socket','register','request','then','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','MailInteraction,\x20%s,\x20%s','result','update','options','where','limit','debug','UpdateMailInteraction','MailInteraction','find','addTags','body','ids','omit','spread','AddTags','catch','moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter'];(function(_0xcd877f,_0x472c8d){var _0x3e23a2=function(_0x5ceea8){while(--_0x5ceea8){_0xcd877f['push'](_0xcd877f['shift']());}};_0x3e23a2(++_0x472c8d);}(_0xa93a,0xb8));var _0xaa93=function(_0x42cf68,_0xee86b7){_0x42cf68=_0x42cf68-0x0;var _0x416e8b=_0xa93a[_0x42cf68];return _0x416e8b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xaa93('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaa93('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xaa93('0x2'));var logger=require('../../config/logger')(_0xaa93('0x3'));var config=require(_0xaa93('0x4'));var jayson=require(_0xaa93('0x5'));var client=jayson[_0xaa93('0x6')][_0xaa93('0x7')]({'port':0x232a});config['redis']=_[_0xaa93('0x8')](config[_0xaa93('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xaa93('0xa'))(new Redis(config['redis']));require(_0xaa93('0xb'))[_0xaa93('0xc')](socket);function respondWithRpcPromise(_0x5409d9,_0x4f3681,_0x51001d){return new BPromise(function(_0x194d64,_0x521bfe){return client[_0xaa93('0xd')](_0x5409d9,_0x51001d)[_0xaa93('0xe')](function(_0x35e162){logger['info']('MailInteraction,\x20%s,\x20%s',_0x4f3681,_0xaa93('0xf'));logger['debug'](_0xaa93('0x10'),_0x4f3681,'request\x20sent',JSON[_0xaa93('0x11')](_0x35e162));if(_0x35e162[_0xaa93('0x12')]){if(_0x35e162[_0xaa93('0x12')][_0xaa93('0x13')]===0x1f4){logger[_0xaa93('0x12')]('MailInteraction,\x20%s,\x20%s',_0x4f3681,_0x35e162[_0xaa93('0x12')]['message']);return _0x521bfe(_0x35e162[_0xaa93('0x12')][_0xaa93('0x14')]);}logger['error']('MailInteraction,\x20%s,\x20%s',_0x4f3681,_0x35e162[_0xaa93('0x12')][_0xaa93('0x14')]);return _0x194d64(_0x35e162[_0xaa93('0x12')][_0xaa93('0x14')]);}else{logger[_0xaa93('0x15')](_0xaa93('0x16'),_0x4f3681,_0xaa93('0xf'));_0x194d64(_0x35e162[_0xaa93('0x17')][_0xaa93('0x14')]);}})['catch'](function(_0x142635){logger[_0xaa93('0x12')](_0xaa93('0x16'),_0x4f3681,_0x142635);_0x521bfe(_0x142635);});});}exports['UpdateMailInteraction']=function(_0x12500d){var _0x3bd4b3=this;return new Promise(function(_0x5583bd,_0x3df2f4){return db['MailInteraction'][_0xaa93('0x18')](_0x12500d['body'],{'raw':_0x12500d[_0xaa93('0x19')]?_0x12500d[_0xaa93('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12500d[_0xaa93('0x19')]?_0x12500d['options'][_0xaa93('0x1a')]||null:null,'attributes':_0x12500d[_0xaa93('0x19')]?_0x12500d['options']['attributes']||null:null,'limit':_0x12500d[_0xaa93('0x19')]?_0x12500d[_0xaa93('0x19')][_0xaa93('0x1b')]||null:null})['then'](function(_0x4ab6b6){logger[_0xaa93('0x15')]('UpdateMailInteraction',_0x12500d);logger[_0xaa93('0x1c')](_0xaa93('0x1d'),_0x12500d,JSON[_0xaa93('0x11')](_0x4ab6b6));_0x5583bd(_0x4ab6b6);})['catch'](function(_0x2c2e8f){logger[_0xaa93('0x12')](_0xaa93('0x1d'),_0x2c2e8f[_0xaa93('0x14')],_0x12500d);_0x3df2f4(_0x3bd4b3['error'](0x1f4,_0x2c2e8f[_0xaa93('0x14')]));});});};exports['AddTagsToMailInteraction']=function(_0x5bc190){return new Promise(function(_0x51fd9a,_0x535a92){return db[_0xaa93('0x1e')][_0xaa93('0x1f')]({'where':_0x5bc190[_0xaa93('0x19')]?_0x5bc190[_0xaa93('0x19')]['where']||null:null})[_0xaa93('0xe')](function(_0x1b81d3){if(_0x1b81d3){return _0x1b81d3[_0xaa93('0x20')](_0x5bc190[_0xaa93('0x21')][_0xaa93('0x22')],_[_0xaa93('0x23')](_0x5bc190[_0xaa93('0x21')],[_0xaa93('0x22'),'id'])||{});}})[_0xaa93('0x24')](function(_0x397476){logger['info']('AddTags',_0x5bc190);logger['debug'](_0xaa93('0x25'),_0x5bc190,JSON[_0xaa93('0x11')](_0x397476));_0x51fd9a(_0x397476);})[_0xaa93('0x26')](function(_0x4a1108){logger['error'](_0xaa93('0x25'),_0x4a1108['message'],_0x5bc190);_0x535a92(_this[_0xaa93('0x12')](0x1f4,_0x4a1108[_0xaa93('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index b54342b..64ef299 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 _0x810a=['removeListener','register','length','./mailInteraction.events','save','remove'];(function(_0x435b89,_0x55243b){var _0x26ccd3=function(_0x1263f9){while(--_0x1263f9){_0x435b89['push'](_0x435b89['shift']());}};_0x26ccd3(++_0x55243b);}(_0x810a,0x1a1));var _0xa810=function(_0x5496b3,_0x5bed84){_0x5496b3=_0x5496b3-0x0;var _0xc9c8f7=_0x810a[_0x5496b3];return _0xc9c8f7;};'use strict';var MailInteractionEvents=require(_0xa810('0x0'));var events=[_0xa810('0x1'),_0xa810('0x2'),'update'];function createListener(_0x48207c,_0x208b58){return function(_0x40aae0){_0x208b58['emit'](_0x48207c,_0x40aae0);};}function removeListener(_0x46bc18,_0x5b6cd1){return function(){MailInteractionEvents[_0xa810('0x3')](_0x46bc18,_0x5b6cd1);};}exports[_0xa810('0x4')]=function(_0x3ccd17){for(var _0x4502b2=0x0,_0x28995e=events[_0xa810('0x5')];_0x4502b2<_0x28995e;_0x4502b2++){var _0x3c2df3=events[_0x4502b2];var _0x307d5b=createListener('mailInteraction:'+_0x3c2df3,_0x3ccd17);MailInteractionEvents['on'](_0x3c2df3,_0x307d5b);}}; \ No newline at end of file +var _0x89ca=['mailInteraction:','./mailInteraction.events','save','remove','update','emit','removeListener','register','length'];(function(_0x594ab7,_0x51564b){var _0x3d5916=function(_0x42fd2c){while(--_0x42fd2c){_0x594ab7['push'](_0x594ab7['shift']());}};_0x3d5916(++_0x51564b);}(_0x89ca,0xe2));var _0xa89c=function(_0x324d1b,_0x5ea29d){_0x324d1b=_0x324d1b-0x0;var _0xaddf52=_0x89ca[_0x324d1b];return _0xaddf52;};'use strict';var MailInteractionEvents=require(_0xa89c('0x0'));var events=[_0xa89c('0x1'),_0xa89c('0x2'),_0xa89c('0x3')];function createListener(_0x5428f9,_0x2cb350){return function(_0x183b2a){_0x2cb350[_0xa89c('0x4')](_0x5428f9,_0x183b2a);};}function removeListener(_0x1bb31a,_0x57115e){return function(){MailInteractionEvents[_0xa89c('0x5')](_0x1bb31a,_0x57115e);};}exports[_0xa89c('0x6')]=function(_0xb52d72){for(var _0x11e58d=0x0,_0x2e7521=events[_0xa89c('0x7')];_0x11e58d<_0x2e7521;_0x11e58d++){var _0x1f36c7=events[_0x11e58d];var _0xe49b1b=createListener(_0xa89c('0x8')+_0x1f36c7,_0xb52d72);MailInteractionEvents['on'](_0x1f36c7,_0xe49b1b);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index dc94cf1..ba381a6 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 _0x565c=['describe','/:id','show','/:id/download','post','tracked','mail','mailmessage:create','create','put','accept','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./mailMessage.controller','get','isAuthenticated'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x565c,0x73));var _0xc565=function(_0x2d22aa,_0x3e0d7d){_0x2d22aa=_0x2d22aa-0x0;var _0x51965b=_0x565c[_0x2d22aa];return _0x51965b;};'use strict';var multer=require(_0xc565('0x0'));var util=require(_0xc565('0x1'));var path=require(_0xc565('0x2'));var timeout=require(_0xc565('0x3'));var express=require(_0xc565('0x4'));var router=express[_0xc565('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc565('0x6'));var controller=require(_0xc565('0x7'));router[_0xc565('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc565('0x8')]('/describe',auth[_0xc565('0x9')](),controller[_0xc565('0xa')]);router[_0xc565('0x8')](_0xc565('0xb'),auth[_0xc565('0x9')](),controller[_0xc565('0xc')]);router['get'](_0xc565('0xd'),auth[_0xc565('0x9')](),controller['download']);router[_0xc565('0xe')]('/',auth[_0xc565('0x9')](),interaction[_0xc565('0xf')](_0xc565('0x10'),_0xc565('0x11')),controller[_0xc565('0x12')]);router[_0xc565('0x13')](_0xc565('0xb'),auth[_0xc565('0x9')](),controller['update']);router['put']('/:id/accept',auth['isAuthenticated'](),controller[_0xc565('0x14')]);router[_0xc565('0x13')]('/:id/reject',auth[_0xc565('0x9')](),controller[_0xc565('0x15')]);router[_0xc565('0x16')](_0xc565('0xb'),auth[_0xc565('0x9')](),controller[_0xc565('0x17')]);module[_0xc565('0x18')]=router; \ No newline at end of file +var _0xfe9d=['multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','/describe','describe','show','/:id/download','download','post','tracked','mail','mailmessage:create','create','put','/:id','accept','reject','destroy','exports'];(function(_0x3f9582,_0x3e856e){var _0x4d8f99=function(_0x92d791){while(--_0x92d791){_0x3f9582['push'](_0x3f9582['shift']());}};_0x4d8f99(++_0x3e856e);}(_0xfe9d,0x10e));var _0xdfe9=function(_0x4e87b0,_0x5048fb){_0x4e87b0=_0x4e87b0-0x0;var _0x39d8c1=_0xfe9d[_0x4e87b0];return _0x39d8c1;};'use strict';var multer=require(_0xdfe9('0x0'));var util=require(_0xdfe9('0x1'));var path=require(_0xdfe9('0x2'));var timeout=require(_0xdfe9('0x3'));var express=require(_0xdfe9('0x4'));var router=express['Router']();var fs_extra=require(_0xdfe9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xdfe9('0x6'));var config=require(_0xdfe9('0x7'));var controller=require(_0xdfe9('0x8'));router[_0xdfe9('0x9')]('/',auth[_0xdfe9('0xa')](),controller['index']);router['get'](_0xdfe9('0xb'),auth['isAuthenticated'](),controller[_0xdfe9('0xc')]);router[_0xdfe9('0x9')]('/:id',auth[_0xdfe9('0xa')](),controller[_0xdfe9('0xd')]);router[_0xdfe9('0x9')](_0xdfe9('0xe'),auth['isAuthenticated'](),controller[_0xdfe9('0xf')]);router[_0xdfe9('0x10')]('/',auth[_0xdfe9('0xa')](),interaction[_0xdfe9('0x11')](_0xdfe9('0x12'),_0xdfe9('0x13')),controller[_0xdfe9('0x14')]);router[_0xdfe9('0x15')](_0xdfe9('0x16'),auth[_0xdfe9('0xa')](),controller['update']);router[_0xdfe9('0x15')]('/:id/accept',auth['isAuthenticated'](),controller[_0xdfe9('0x17')]);router[_0xdfe9('0x15')]('/:id/reject',auth[_0xdfe9('0xa')](),controller[_0xdfe9('0x18')]);router['delete'](_0xdfe9('0x16'),auth['isAuthenticated'](),controller[_0xdfe9('0x19')]);module[_0xdfe9('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 9a763e0..a097597 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 _0xbe45=['exports','TEXT','long','BOOLEAN','ENUM','out','STRING','DATE','INTEGER','Email','sequelize','lodash'];(function(_0x34d771,_0x1e6460){var _0x139935=function(_0x51e783){while(--_0x51e783){_0x34d771['push'](_0x34d771['shift']());}};_0x139935(++_0x1e6460);}(_0xbe45,0x1ae));var _0x5be4=function(_0xa8708,_0x5487ae){_0xa8708=_0xa8708-0x0;var _0x4a2789=_0xbe45[_0xa8708];return _0x4a2789;};'use strict';var Sequelize=require(_0x5be4('0x0'));var _=require(_0x5be4('0x1'));module[_0x5be4('0x2')]={'body':{'type':Sequelize[_0x5be4('0x3')](_0x5be4('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x5be4('0x3')]('medium')},'read':{'type':Sequelize[_0x5be4('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5be4('0x6')]('in',_0x5be4('0x7')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x5be4('0x8')]},'to':{'type':Sequelize[_0x5be4('0x3')]('long')},'cc':{'type':Sequelize[_0x5be4('0x3')](_0x5be4('0x4'))},'bcc':{'type':Sequelize[_0x5be4('0x3')]('long')},'subject':{'type':Sequelize[_0x5be4('0x3')]},'sentAt':{'type':Sequelize[_0x5be4('0x9')]},'attach':{'type':Sequelize[_0x5be4('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x5be4('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x5be4('0x9')]},'originTo':{'type':Sequelize[_0x5be4('0x3')](_0x5be4('0x4'))},'originCc':{'type':Sequelize[_0x5be4('0x3')]('long')},'originChannel':{'type':Sequelize[_0x5be4('0x6')](_0x5be4('0xb'),'Chat'),'defaultValue':_0x5be4('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0x436b=['INTEGER','Email','Chat','sequelize','lodash','exports','long','medium','BOOLEAN','ENUM','out','STRING','TEXT','DATE'];(function(_0x5a9674,_0x55bc80){var _0x411ab2=function(_0xf57b25){while(--_0xf57b25){_0x5a9674['push'](_0x5a9674['shift']());}};_0x411ab2(++_0x55bc80);}(_0x436b,0xff));var _0xb436=function(_0x10d244,_0x49c680){_0x10d244=_0x10d244-0x0;var _0x67755d=_0x436b[_0x10d244];return _0x67755d;};'use strict';var Sequelize=require(_0xb436('0x0'));var _=require(_0xb436('0x1'));module[_0xb436('0x2')]={'body':{'type':Sequelize['TEXT'](_0xb436('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0xb436('0x4'))},'read':{'type':Sequelize[_0xb436('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb436('0x6')]('in',_0xb436('0x7')),'defaultValue':_0xb436('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0xb436('0x8')](0x1fe)},'from':{'type':Sequelize[_0xb436('0x8')]},'to':{'type':Sequelize[_0xb436('0x9')](_0xb436('0x3'))},'cc':{'type':Sequelize['TEXT'](_0xb436('0x3'))},'bcc':{'type':Sequelize[_0xb436('0x9')]('long')},'subject':{'type':Sequelize[_0xb436('0x9')]},'sentAt':{'type':Sequelize[_0xb436('0xa')]},'attach':{'type':Sequelize[_0xb436('0xb')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xb436('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xb436('0xa')]},'originTo':{'type':Sequelize[_0xb436('0x9')](_0xb436('0x3'))},'originCc':{'type':Sequelize[_0xb436('0x9')](_0xb436('0x3'))},'originChannel':{'type':Sequelize[_0xb436('0x6')](_0xb436('0xc'),_0xb436('0xd')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 0ebb666..43dea38 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 _0xedd9=['params','describe','create','secret','split','MailAccount','MailAccountId','List','CmContact','updatedAt','DESC','MailServerOut','Smtp','isNil','port','secure','authentication','auth','service','user','pass','attachments','join','server/files/attachments','defaults','ListId','List\x20not\x20found','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','readAt','agent','UserId','MailInteraction','MailInteractionId','read1stAt','interaction','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','sequelize','Sequelize','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','SELECT','reject','fromString','rejectmessage','unix','toString','root','server','files','tmp','message-%s.eml','from','subject','createdAt','headers','bcc','Bcc','Attachments','basename','existsSync','readFileSync','build','download','unlinkSync','moment','bluebird','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','api','../../config/logger','mail-interactions','../../config/environment','redis','localhost','socket.io-emitter','register','client','http','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','json','undefined','limit','count','offset','Content-Range','update','then','destroy','status','end','sendStatus','stack','name','index','map','MailMessage','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','filters','find','body'];(function(_0x3e91c0,_0x49260e){var _0x1eb8db=function(_0x2f192b){while(--_0x2f192b){_0x3e91c0['push'](_0x3e91c0['shift']());}};_0x1eb8db(++_0x49260e);}(_0xedd9,0xfc));var _0x9edd=function(_0x431cc1,_0x1d104d){_0x431cc1=_0x431cc1-0x0;var _0x155efb=_0xedd9[_0x431cc1];return _0x155efb;};'use strict';var emlformat=require('eml-format');var moment=require(_0x9edd('0x0'));var BPromise=require(_0x9edd('0x1'));var util=require(_0x9edd('0x2'));var path=require(_0x9edd('0x3'));var fs=require('fs');var _=require(_0x9edd('0x4'));var Redis=require(_0x9edd('0x5'));var htmlToText=require(_0x9edd('0x6'));var qs=require(_0x9edd('0x7'));var logger=require('../../config/logger')(_0x9edd('0x8'));var interaction_log=require(_0x9edd('0x9'))(_0x9edd('0xa'));var config=require(_0x9edd('0xb'));var db=require('../../mysqldb')['db'];config[_0x9edd('0xc')]=_['defaults'](config[_0x9edd('0xc')],{'host':_0x9edd('0xd'),'port':0x18eb});var socket=require(_0x9edd('0xe'))(new Redis(config[_0x9edd('0xc')]));require('./mailMessage.socket')[_0x9edd('0xf')](socket);var jayson=require('jayson/promise');var client=jayson[_0x9edd('0x10')][_0x9edd('0x11')]({'port':0x232c});var client9003=jayson['client'][_0x9edd('0x11')]({'port':0x232b});var client9002=jayson[_0x9edd('0x10')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30c0d7,_0x1b73d1,_0x25e64c,_0xfd544a){return new BPromise(function(_0x287ddd,_0x3a7b84){var _0xfca576=_0xfd544a||client;return _0xfca576[_0x9edd('0x12')](_0x30c0d7,_0x25e64c)['then'](function(_0x176bfa){logger[_0x9edd('0x13')](_0x9edd('0x14'),_0x1b73d1,_0x9edd('0x15'));logger[_0x9edd('0x16')](_0x9edd('0x17'),_0x1b73d1,_0x9edd('0x15'),JSON[_0x9edd('0x18')](_0x176bfa));if(_0x176bfa['error']){if(_0x176bfa[_0x9edd('0x19')][_0x9edd('0x1a')]===0x1f4){logger[_0x9edd('0x19')]('MailMessage,\x20%s,\x20%s',_0x1b73d1,_0x176bfa[_0x9edd('0x19')][_0x9edd('0x1b')]);return _0x3a7b84(_0x176bfa[_0x9edd('0x19')]['message']);}logger[_0x9edd('0x19')]('MailMessage,\x20%s,\x20%s',_0x1b73d1,_0x176bfa[_0x9edd('0x19')][_0x9edd('0x1b')]);return _0x287ddd(_0x176bfa['error']['message']);}else{logger[_0x9edd('0x13')]('MailMessage,\x20%s,\x20%s',_0x1b73d1,_0x9edd('0x15'));_0x287ddd(_0x176bfa['result']['message']);}})[_0x9edd('0x1c')](function(_0x1c46a8){logger['error']('MailMessage,\x20%s,\x20%s',_0x1b73d1,_0x1c46a8);_0x3a7b84(_0x1c46a8);});});}function respondWithResult(_0x341d67,_0x186186){_0x186186=_0x186186||0xc8;return function(_0x477878){if(_0x477878){return _0x341d67['status'](_0x186186)[_0x9edd('0x1d')](_0x477878);}};}function respondWithFilteredResult(_0x1dca43,_0x44a6c1){return function(_0x2ca65f){if(_0x2ca65f){var _0x339a0d=typeof _0x44a6c1['offset']===_0x9edd('0x1e')&&typeof _0x44a6c1[_0x9edd('0x1f')]===_0x9edd('0x1e');var _0x2f9f86=_0x2ca65f[_0x9edd('0x20')];var _0x4d507f=_0x339a0d?0x0:_0x44a6c1['offset'];var _0x3276ee=_0x339a0d?_0x2ca65f[_0x9edd('0x20')]:_0x44a6c1[_0x9edd('0x21')]+_0x44a6c1[_0x9edd('0x1f')];var _0x3c2227;if(_0x3276ee>=_0x2f9f86){_0x3276ee=_0x2f9f86;_0x3c2227=0xc8;}else{_0x3c2227=0xce;}_0x1dca43['status'](_0x3c2227);return _0x1dca43['set'](_0x9edd('0x22'),_0x4d507f+'-'+_0x3276ee+'/'+_0x2f9f86)[_0x9edd('0x1d')](_0x2ca65f);}return null;};}function saveUpdates(_0x1c762c){return function(_0x52746a){if(_0x52746a){return _0x52746a[_0x9edd('0x23')](_0x1c762c)[_0x9edd('0x24')](function(_0x2ae8dd){return _0x2ae8dd;});}return null;};}function removeEntity(_0x41af53){return function(_0x5eccfb){if(_0x5eccfb){return _0x5eccfb[_0x9edd('0x25')]()[_0x9edd('0x24')](function(){_0x41af53[_0x9edd('0x26')](0xcc)[_0x9edd('0x27')]();});}};}function handleEntityNotFound(_0xbbf08f){return function(_0x42e664){if(!_0x42e664){_0xbbf08f[_0x9edd('0x28')](0x194);}return _0x42e664;};}function handleError(_0x1fba7b,_0x19b6c1){_0x19b6c1=_0x19b6c1||0x1f4;return function(_0x1c2e2b){logger[_0x9edd('0x19')](_0x1c2e2b[_0x9edd('0x29')]);if(_0x1c2e2b[_0x9edd('0x2a')]){delete _0x1c2e2b[_0x9edd('0x2a')];}_0x1fba7b[_0x9edd('0x26')](_0x19b6c1)['send'](_0x1c2e2b);};}exports[_0x9edd('0x2b')]=function(_0x259259,_0x267c74){var _0x5d1707={},_0x2d2f88={},_0x3990fb={'count':0x0,'rows':[]};var _0xde9b13=_[_0x9edd('0x2c')](db[_0x9edd('0x2d')][_0x9edd('0x2e')],function(_0x473068){return{'name':_0x473068[_0x9edd('0x2f')],'type':_0x473068[_0x9edd('0x30')][_0x9edd('0x31')]};});_0x2d2f88[_0x9edd('0x32')]=_[_0x9edd('0x2c')](_0xde9b13,_0x9edd('0x2a'));_0x2d2f88[_0x9edd('0x33')]=_['keys'](_0x259259[_0x9edd('0x33')]);_0x2d2f88['filters']=_[_0x9edd('0x34')](_0x2d2f88[_0x9edd('0x32')],_0x2d2f88[_0x9edd('0x33')]);_0x5d1707[_0x9edd('0x35')]=_[_0x9edd('0x34')](_0x2d2f88['model'],qs[_0x9edd('0x36')](_0x259259[_0x9edd('0x33')][_0x9edd('0x36')]));_0x5d1707[_0x9edd('0x35')]=_0x5d1707[_0x9edd('0x35')][_0x9edd('0x37')]?_0x5d1707[_0x9edd('0x35')]:_0x2d2f88[_0x9edd('0x32')];if(!_0x259259[_0x9edd('0x33')][_0x9edd('0x38')]('nolimit')){_0x5d1707[_0x9edd('0x1f')]=qs['limit'](_0x259259[_0x9edd('0x33')]['limit']);_0x5d1707[_0x9edd('0x21')]=qs[_0x9edd('0x21')](_0x259259[_0x9edd('0x33')]['offset']);}_0x5d1707[_0x9edd('0x39')]=qs[_0x9edd('0x3a')](_0x259259[_0x9edd('0x33')]['sort']);_0x5d1707[_0x9edd('0x3b')]=qs['filters'](_[_0x9edd('0x3c')](_0x259259[_0x9edd('0x33')],_0x2d2f88['filters']),_0xde9b13);if(_0x259259[_0x9edd('0x33')][_0x9edd('0x3d')]){_0x5d1707[_0x9edd('0x3b')]=_[_0x9edd('0x3e')](_0x5d1707['where'],{'$or':_[_0x9edd('0x2c')](_0xde9b13,function(_0x5bbdf8){if(_0x5bbdf8[_0x9edd('0x30')]!==_0x9edd('0x3f')){var _0x587d74={};_0x587d74[_0x5bbdf8[_0x9edd('0x2a')]]={'$like':'%'+_0x259259['query']['filter']+'%'};return _0x587d74;}})});}_0x5d1707=_[_0x9edd('0x3e')]({},_0x5d1707,_0x259259[_0x9edd('0x40')]);var _0x1f276b={'where':_0x5d1707[_0x9edd('0x3b')]};return db[_0x9edd('0x2d')][_0x9edd('0x20')](_0x1f276b)[_0x9edd('0x24')](function(_0x75efbe){_0x3990fb[_0x9edd('0x20')]=_0x75efbe;if(_0x259259[_0x9edd('0x33')][_0x9edd('0x41')]){_0x5d1707[_0x9edd('0x42')]=[{'all':!![]}];}return db[_0x9edd('0x2d')][_0x9edd('0x43')](_0x5d1707);})[_0x9edd('0x24')](function(_0x5416f8){_0x3990fb[_0x9edd('0x44')]=_0x5416f8;return _0x3990fb;})[_0x9edd('0x24')](respondWithFilteredResult(_0x267c74,_0x5d1707))[_0x9edd('0x1c')](handleError(_0x267c74,null));};exports[_0x9edd('0x45')]=function(_0x241929,_0x3ecdfd){var _0x10d41e={'raw':!![],'where':{'id':_0x241929['params']['id']}},_0x4e9ad1={};_0x4e9ad1['model']=_[_0x9edd('0x46')](db['MailMessage'][_0x9edd('0x2e')]);_0x4e9ad1[_0x9edd('0x33')]=_[_0x9edd('0x46')](_0x241929[_0x9edd('0x33')]);_0x4e9ad1[_0x9edd('0x47')]=_['intersection'](_0x4e9ad1[_0x9edd('0x32')],_0x4e9ad1[_0x9edd('0x33')]);_0x10d41e[_0x9edd('0x35')]=_['intersection'](_0x4e9ad1[_0x9edd('0x32')],qs[_0x9edd('0x36')](_0x241929[_0x9edd('0x33')][_0x9edd('0x36')]));_0x10d41e[_0x9edd('0x35')]=_0x10d41e[_0x9edd('0x35')]['length']?_0x10d41e[_0x9edd('0x35')]:_0x4e9ad1[_0x9edd('0x32')];if(_0x241929['query'][_0x9edd('0x41')]){_0x10d41e[_0x9edd('0x42')]=[{'all':!![]}];}_0x10d41e=_['merge']({},_0x10d41e,_0x241929[_0x9edd('0x40')]);return db[_0x9edd('0x2d')][_0x9edd('0x48')](_0x10d41e)['then'](handleEntityNotFound(_0x3ecdfd,null))[_0x9edd('0x24')](respondWithResult(_0x3ecdfd,null))[_0x9edd('0x1c')](handleError(_0x3ecdfd,null));};exports[_0x9edd('0x23')]=function(_0x28c7bd,_0x53f6e3){if(_0x28c7bd[_0x9edd('0x49')]['id']){delete _0x28c7bd[_0x9edd('0x49')]['id'];}return db[_0x9edd('0x2d')]['find']({'where':{'id':_0x28c7bd[_0x9edd('0x4a')]['id']}})[_0x9edd('0x24')](handleEntityNotFound(_0x53f6e3,null))['then'](saveUpdates(_0x28c7bd[_0x9edd('0x49')],null))['then'](respondWithResult(_0x53f6e3,null))[_0x9edd('0x1c')](handleError(_0x53f6e3,null));};exports[_0x9edd('0x25')]=function(_0x24245f,_0x3fcdf5){return db[_0x9edd('0x2d')][_0x9edd('0x48')]({'where':{'id':_0x24245f[_0x9edd('0x4a')]['id']}})[_0x9edd('0x24')](handleEntityNotFound(_0x3fcdf5,null))[_0x9edd('0x24')](removeEntity(_0x3fcdf5,null))[_0x9edd('0x1c')](handleError(_0x3fcdf5,null));};exports[_0x9edd('0x4b')]=function(_0x5a3b1d,_0x161bea){return db[_0x9edd('0x2d')][_0x9edd('0x4b')]()['then'](respondWithResult(_0x161bea,null))[_0x9edd('0x1c')](handleError(_0x161bea,null));};exports['create']=function(_0x54d83d,_0x54ecfa){return db[_0x9edd('0x2d')][_0x9edd('0x4c')](_0x54d83d[_0x9edd('0x49')])[_0x9edd('0x24')](function(_0x48a900){if(_0x48a900){if(_0x48a900['direction']==='out'&&!_0x48a900[_0x9edd('0x4d')]){var _0x5f666b,_0xd5090a,_0x1091ff;if(_0x54d83d[_0x9edd('0x49')]['to']){_0xd5090a=_0x54d83d[_0x9edd('0x49')]['to'][_0x9edd('0x4e')](',')[0x0];}return db[_0x9edd('0x4f')]['findOne']({'where':{'id':_0x48a900[_0x9edd('0x50')]},'include':[{'model':db['CmList'],'as':_0x9edd('0x51'),'include':[{'model':db[_0x9edd('0x52')],'as':'Contacts','where':{'email':_0xd5090a},'limit':0x1,'order':[[_0x9edd('0x53'),_0x9edd('0x54')]]}]},{'model':db[_0x9edd('0x55')],'as':'Smtp','raw':!![]}]})[_0x9edd('0x24')](function(_0x2e1ce3){_0x5f666b=_0x2e1ce3;if(_0x5f666b&&_0x5f666b[_0x9edd('0x56')]){var _0x15ebfa={'tls':{'rejectUnauthorized':![]}};if(_[_0x9edd('0x57')](_0x5f666b[_0x9edd('0x56')]['service'])){_0x15ebfa['host']=_0x5f666b[_0x9edd('0x56')]['host'];_0x15ebfa[_0x9edd('0x58')]=_0x5f666b[_0x9edd('0x56')][_0x9edd('0x58')];_0x15ebfa[_0x9edd('0x59')]=_0x5f666b['Smtp'][_0x9edd('0x59')];if(_0x5f666b['Smtp'][_0x9edd('0x5a')]){_0x15ebfa[_0x9edd('0x5b')]={'user':_0x5f666b[_0x9edd('0x56')]['user'],'pass':_0x5f666b[_0x9edd('0x56')]['pass']};}}else{_0x15ebfa[_0x9edd('0x5c')]=_0x5f666b[_0x9edd('0x56')]['service'];_0x15ebfa[_0x9edd('0x5b')]={'user':_0x5f666b['Smtp'][_0x9edd('0x5d')],'pass':_0x5f666b[_0x9edd('0x56')][_0x9edd('0x5e')]};_0x15ebfa['secure']=_0x5f666b[_0x9edd('0x56')][_0x9edd('0x59')];}if(_0x54d83d[_0x9edd('0x49')][_0x9edd('0x5f')]&&_0x54d83d[_0x9edd('0x49')]['attachments']['length']){for(var _0x2e1a96=0x0;_0x2e1a96<_0x54d83d[_0x9edd('0x49')]['attachments']['length'];_0x2e1a96+=0x1){_0x54d83d['body'][_0x9edd('0x5f')][_0x2e1a96]={'filename':_0x54d83d['body']['attachments'][_0x2e1a96][_0x9edd('0x2a')],'path':path[_0x9edd('0x60')](config['root'],_0x9edd('0x61'),_0x54d83d[_0x9edd('0x49')][_0x9edd('0x5f')][_0x2e1a96]['basename'])};}}_0x1091ff={'account':_0x15ebfa,'message':_0x54d83d[_0x9edd('0x49')]};return;}})['then'](function(){if(_0x5f666b[_0x9edd('0x51')]){if(_0x5f666b[_0x9edd('0x51')]['Contacts'][_0x9edd('0x37')]){return _0x5f666b[_0x9edd('0x51')]['Contacts'][0x0];}else{return db[_0x9edd('0x52')][_0x9edd('0x4c')](_[_0x9edd('0x62')](_0x54d83d[_0x9edd('0x49')],{'firstName':_0x54d83d['body']['to'],'email':_0x54d83d[_0x9edd('0x49')]['to'],'phone':_0x54d83d['body']['to'],'ListId':_0x5f666b[_0x9edd('0x63')]}));}}else{throw new Error(_0x9edd('0x64'));}})[_0x9edd('0x24')](function(){if(_0x1091ff){return respondWithRpcPromise('SendMail',_0x9edd('0x65'),_0x1091ff,client9003)[_0x9edd('0x24')](function(_0x130dba){return _0x48a900[_0x9edd('0x23')]({'read':!![],'messageId':_0x130dba[_0x9edd('0x66')],'sentAt':moment()[_0x9edd('0x67')](_0x9edd('0x68'))});})['catch'](function(_0x5e29d0){logger[_0x9edd('0x19')]('%s',JSON[_0x9edd('0x18')](_0x5e29d0));return _0x48a900;});}return _0x48a900;});}return _0x48a900;}})[_0x9edd('0x24')](respondWithResult(_0x54ecfa,0xc9))[_0x9edd('0x1c')](handleError(_0x54ecfa,null));};exports[_0x9edd('0x69')]=function(_0x52f6f3,_0x2e40c8){var _0x5d56a={'agent':{},'channel':_0x9edd('0x6a')};if(_0x52f6f3['body']['id']){delete _0x52f6f3[_0x9edd('0x49')]['id'];}_0x52f6f3[_0x9edd('0x49')]['read']=!![];_0x52f6f3[_0x9edd('0x49')][_0x9edd('0x6b')]=moment()['format'](_0x9edd('0x68'));_0x52f6f3[_0x9edd('0x49')]['UserId']=_0x52f6f3[_0x9edd('0x49')]['UserId']||_0x52f6f3['user']['id'];_0x5d56a[_0x9edd('0x6c')]['id']=_0x52f6f3[_0x9edd('0x49')][_0x9edd('0x6d')];return db['MailMessage'][_0x9edd('0x48')]({'where':{'id':_0x52f6f3[_0x9edd('0x4a')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2e40c8,null))[_0x9edd('0x24')](saveUpdates(_0x52f6f3[_0x9edd('0x49')],null))[_0x9edd('0x24')](function(_0x1ad198){if(_0x1ad198){_0x5d56a['message']=_0x1ad198['get']({'plain':!![]});return db[_0x9edd('0x6e')]['find']({'where':{'id':_0x1ad198[_0x9edd('0x6f')]}});}return null;})[_0x9edd('0x24')](handleEntityNotFound(_0x2e40c8,null))[_0x9edd('0x24')](function(_0x3cfd35){if(_0x3cfd35){return _0x3cfd35[_0x9edd('0x23')]({'UserId':_0x52f6f3[_0x9edd('0x49')][_0x9edd('0x6d')],'read1stAt':_[_0x9edd('0x57')](_0x3cfd35[_0x9edd('0x70')])?moment()['format'](_0x9edd('0x68')):undefined});}return null;})[_0x9edd('0x24')](function(_0x2c7562){if(_0x2c7562){_0x5d56a[_0x9edd('0x71')]=_0x2c7562[_0x9edd('0x72')]({'plain':!![]});interaction_log[_0x9edd('0x13')](_0x9edd('0x73'),_0x52f6f3['user']['id'],_0x52f6f3[_0x9edd('0x5d')][_0x9edd('0x2a')],_0x52f6f3['user'][_0x9edd('0x74')],_0x5d56a[_0x9edd('0x71')]['id'],_0x52f6f3['body']?JSON[_0x9edd('0x18')](_0x52f6f3[_0x9edd('0x49')]):_0x9edd('0x75'));return respondWithRpcPromise('AcceptMessage',_0x9edd('0x76'),_0x5d56a);}return null;})[_0x9edd('0x24')](function(_0x3f04d3){var _0x5a7de3='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3f04d3['message']['ContactId'];return db[_0x9edd('0x77')][_0x9edd('0x33')](_0x5a7de3,{'type':db[_0x9edd('0x78')]['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x56d794){return _0x56d794;});})[_0x9edd('0x24')](function(_0x20762d){if(_0x20762d){_0x5d56a[_0x9edd('0x1b')][_0x9edd('0x79')]=_0x20762d[0x0];if(!_0x52f6f3[_0x9edd('0x49')][_0x9edd('0x6d')])return;return db[_0x9edd('0x7a')][_0x9edd('0x48')]({'where':{'id':_0x52f6f3[_0x9edd('0x49')][_0x9edd('0x6d')],'role':_0x9edd('0x6c')},'attributes':['id','name',_0x9edd('0x7b'),_0x9edd('0x7c'),_0x9edd('0x7d')],'raw':!![]});}return null;})[_0x9edd('0x24')](function(_0x104afc){if(!_0x104afc)return null;_0x5d56a[_0x9edd('0x1b')][_0x9edd('0x6c')]=_0x104afc;return _0x5d56a;})[_0x9edd('0x24')](function(_0x4a7889){if(_0x4a7889){if(_0x52f6f3['body'][_0x9edd('0x7e')]){_0x5d56a['message'][_0x9edd('0x7f')]=util['format'](_0x9edd('0x80'),_0x52f6f3[_0x9edd('0x5d')]['name']);_0x5d56a[_0x9edd('0x1b')][_0x9edd('0x81')]=_0x5d56a['channel'];_0x5d56a[_0x9edd('0x1b')][_0x9edd('0x82')]=_0x9edd('0x69');_0x5d56a[_0x9edd('0x1b')][_0x9edd('0x49')]=htmlToText['fromString'](_0x5d56a[_0x9edd('0x1b')][_0x9edd('0x49')]);return respondWithRpcPromise(_0x9edd('0x83'),_0x9edd('0x83'),{'event':_0x9edd('0x84'),'message':_0x5d56a['message']},client9002)['then'](function(){return _0x5d56a;});}return _0x5d56a;}return null;})['then'](respondWithResult(_0x2e40c8,null))['catch'](handleError(_0x2e40c8,null));};exports['reject']=function(_0x2da088,_0x5d566e){var _0x58cb3f={'agent':{},'channel':_0x9edd('0x6a')};if(_0x2da088[_0x9edd('0x49')]['id']){delete _0x2da088[_0x9edd('0x49')]['id'];}_0x2da088[_0x9edd('0x49')][_0x9edd('0x6d')]=_0x2da088[_0x9edd('0x49')][_0x9edd('0x6d')]||_0x2da088[_0x9edd('0x5d')]['id'];_0x58cb3f[_0x9edd('0x6c')]['id']=_0x2da088[_0x9edd('0x49')]['UserId'];return db[_0x9edd('0x2d')][_0x9edd('0x48')]({'where':{'id':_0x2da088[_0x9edd('0x4a')]['id'],'UserId':null}})[_0x9edd('0x24')](handleEntityNotFound(_0x5d566e,null))[_0x9edd('0x24')](function(_0x23e925){if(_0x23e925){_0x58cb3f[_0x9edd('0x1b')]=_0x23e925[_0x9edd('0x72')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x23e925[_0x9edd('0x6f')]}});}return null;})[_0x9edd('0x24')](handleEntityNotFound(_0x5d566e,null))[_0x9edd('0x24')](function(_0x120d0f){if(_0x120d0f){_0x58cb3f[_0x9edd('0x71')]=_0x120d0f[_0x9edd('0x72')]({'plain':!![]});interaction_log[_0x9edd('0x13')](_0x9edd('0x85'),_0x2da088[_0x9edd('0x5d')]['id'],_0x2da088[_0x9edd('0x5d')][_0x9edd('0x2a')],_0x2da088[_0x9edd('0x5d')][_0x9edd('0x74')],_0x58cb3f[_0x9edd('0x71')]['id'],_0x2da088['body']?JSON[_0x9edd('0x18')](_0x2da088[_0x9edd('0x49')]):'null');return respondWithRpcPromise(_0x9edd('0x86'),_0x9edd('0x87'),_0x58cb3f);}return null;})[_0x9edd('0x24')](function(_0x2b4d4c){var _0x559503=_0x9edd('0x88')+_0x2b4d4c[_0x9edd('0x1b')][_0x9edd('0x89')];return db[_0x9edd('0x77')][_0x9edd('0x33')](_0x559503,{'type':db['Sequelize'][_0x9edd('0x8a')][_0x9edd('0x8b')],'raw':!![]})[_0x9edd('0x24')](function(_0x4633eb){return _0x4633eb;});})[_0x9edd('0x24')](function(_0x59927d){if(_0x59927d){_0x58cb3f['message'][_0x9edd('0x79')]=_0x59927d[0x0];if(!_0x2da088['body'][_0x9edd('0x6d')])return;return db['User'][_0x9edd('0x48')]({'where':{'id':_0x2da088[_0x9edd('0x49')][_0x9edd('0x6d')],'role':_0x9edd('0x6c')},'attributes':['id',_0x9edd('0x2a'),_0x9edd('0x7b'),'email',_0x9edd('0x7d')],'raw':!![]});}return null;})[_0x9edd('0x24')](function(_0x3aae72){if(!_0x3aae72)return null;_0x58cb3f[_0x9edd('0x1b')][_0x9edd('0x6c')]=_0x3aae72;return _0x58cb3f;})[_0x9edd('0x24')](function(_0x2f8fb6){if(_0x2f8fb6){_0x2f8fb6[_0x9edd('0x1b')]['interface']=util[_0x9edd('0x67')](_0x9edd('0x80'),_0x2da088[_0x9edd('0x5d')][_0x9edd('0x2a')]);_0x2f8fb6[_0x9edd('0x1b')][_0x9edd('0x81')]=_0x58cb3f[_0x9edd('0x81')];_0x2f8fb6[_0x9edd('0x1b')][_0x9edd('0x82')]=_0x9edd('0x8c');_0x2f8fb6[_0x9edd('0x1b')][_0x9edd('0x49')]=htmlToText[_0x9edd('0x8d')](_0x58cb3f[_0x9edd('0x1b')][_0x9edd('0x49')]);respondWithRpcPromise(_0x9edd('0x83'),_0x9edd('0x83'),{'event':_0x9edd('0x8e'),'message':_0x2f8fb6[_0x9edd('0x1b')]},client9002);return _0x58cb3f;}return null;})[_0x9edd('0x24')](respondWithResult(_0x5d566e,null))[_0x9edd('0x1c')](handleError(_0x5d566e,null));};exports['download']=function(_0xa704eb,_0x553018){var _0x4ca7e4=moment()[_0x9edd('0x8f')]()[_0x9edd('0x90')]();var _0x220c00=path[_0x9edd('0x60')](config[_0x9edd('0x91')],_0x9edd('0x92'),_0x9edd('0x93'),_0x9edd('0x94'));var _0x3e5a45=path[_0x9edd('0x60')](config['root'],_0x9edd('0x92'),_0x9edd('0x93'),'attachments');var _0x568067=util[_0x9edd('0x67')](_0x9edd('0x95'),_0x4ca7e4);return db[_0x9edd('0x2d')][_0x9edd('0x48')]({'where':{'id':_0xa704eb['params']['id']},'attributes':['id','body',_0x9edd('0x96'),'to','cc','bcc',_0x9edd('0x97'),_0x9edd('0x98')],'include':_0xa704eb[_0x9edd('0x33')]['attachments']?[{'model':db['Attachment'],'as':'Attachments'}]:undefined})[_0x9edd('0x24')](handleEntityNotFound(_0x553018,null))[_0x9edd('0x24')](function(_0x7b0fc8){if(_0x7b0fc8){var _0x5bfbfd=_0x7b0fc8;var _0xb2e72={'from':_0x5bfbfd[_0x9edd('0x96')],'to':_0x5bfbfd['to'],'subject':_0x5bfbfd['subject'],'html':_0x5bfbfd[_0x9edd('0x49')],'headers':{'Date':moment(_0x5bfbfd[_0x9edd('0x98')])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x7b0fc8['cc']){_0xb2e72[_0x9edd('0x99')]['Cc']=_0x7b0fc8['cc'];}if(_0x7b0fc8[_0x9edd('0x9a')]){_0xb2e72['headers'][_0x9edd('0x9b')]=_0x7b0fc8[_0x9edd('0x9a')];}return new BPromise(function(_0x54c6a0,_0x201d76){if(_0x7b0fc8['Attachments']){for(var _0x308a0f=0x0;_0x308a0f<_0x7b0fc8[_0x9edd('0x9c')][_0x9edd('0x37')];_0x308a0f++){var _0x742e13=_0x7b0fc8[_0x9edd('0x9c')][_0x308a0f];var _0x3e6426=path['join'](_0x3e5a45,_0x742e13[_0x9edd('0x9d')]);if(fs[_0x9edd('0x9e')](_0x3e6426)){_0xb2e72[_0x9edd('0x5f')]['push']({'name':_0x742e13[_0x9edd('0x2a')],'contentType':_0x742e13['type'],'data':fs[_0x9edd('0x9f')](_0x3e6426)});}}}emlformat[_0x9edd('0xa0')](_0xb2e72,function(_0x25da04,_0x41b0ea){if(_0x25da04)return _0x201d76(_0x25da04);fs['writeFileSync'](path['join'](_0x220c00,_0x568067),_0x41b0ea);return _0x54c6a0(_0x41b0ea);});});}})['then'](function(_0x12dcfa){if(_0x12dcfa){return _0x553018[_0x9edd('0xa1')](path[_0x9edd('0x60')](_0x220c00,_0x568067),_0x568067,function(_0x50af78){if(!_0x50af78)fs[_0x9edd('0xa2')](path[_0x9edd('0x60')](_0x220c00,_0x568067));});}})[_0x9edd('0x1c')](handleError(_0x553018,null));}; \ No newline at end of file +var _0x008c=['pass','attachments','join','root','server/files/attachments','basename','ListId','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','stringify','accept','mail','read','UserId','agent','get','MailInteraction','update','read1stAt','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','SELECT','contact','email','manual','channel','event','fromString','EventManager','acceptmessage','reject','MailInteractionId','interaction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','ContactId','sequelize','fullname','interface','SIP/%s','rejectmessage','download','unix','toString','tmp','server','files','from','bcc','subject','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','Bcc','existsSync','push','readFileSync','build','writeFileSync','eml-format','moment','bluebird','util','path','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','defaults','localhost','./mailMessage.socket','register','client','http','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','status','json','offset','undefined','limit','count','sendStatus','stack','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','include','findAll','rows','catch','show','params','includeAll','options','find','body','destroy','describe','create','direction','out','secret','MailAccount','findOne','MailAccountId','List','CmContact','Contacts','DESC','MailServerOut','Smtp','isNil','service','host','secure','authentication','auth','user'];(function(_0x51ebc7,_0x433880){var _0x572462=function(_0x9d5649){while(--_0x9d5649){_0x51ebc7['push'](_0x51ebc7['shift']());}};_0x572462(++_0x433880);}(_0x008c,0x188));var _0xc008=function(_0x367995,_0x129ae2){_0x367995=_0x367995-0x0;var _0x22daa8=_0x008c[_0x367995];return _0x22daa8;};'use strict';var emlformat=require(_0xc008('0x0'));var moment=require(_0xc008('0x1'));var BPromise=require(_0xc008('0x2'));var util=require(_0xc008('0x3'));var path=require(_0xc008('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xc008('0x5'));var htmlToText=require(_0xc008('0x6'));var qs=require(_0xc008('0x7'));var logger=require(_0xc008('0x8'))(_0xc008('0x9'));var interaction_log=require(_0xc008('0x8'))(_0xc008('0xa'));var config=require(_0xc008('0xb'));var db=require(_0xc008('0xc'))['db'];config['redis']=_[_0xc008('0xd')](config['redis'],{'host':_0xc008('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc008('0xf'))[_0xc008('0x10')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9003=jayson[_0xc008('0x11')][_0xc008('0x12')]({'port':0x232b});var client9002=jayson['client'][_0xc008('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x332fd4,_0x2ea200,_0x2a5b4e,_0x9ffa93){return new BPromise(function(_0x1819c6,_0x69726e){var _0x593f7a=_0x9ffa93||client;return _0x593f7a['request'](_0x332fd4,_0x2a5b4e)[_0xc008('0x13')](function(_0x50c1ab){logger[_0xc008('0x14')](_0xc008('0x15'),_0x2ea200,_0xc008('0x16'));logger[_0xc008('0x17')](_0xc008('0x18'),_0x2ea200,'request\x20sent',JSON['stringify'](_0x50c1ab));if(_0x50c1ab['error']){if(_0x50c1ab[_0xc008('0x19')][_0xc008('0x1a')]===0x1f4){logger[_0xc008('0x19')](_0xc008('0x15'),_0x2ea200,_0x50c1ab['error']['message']);return _0x69726e(_0x50c1ab['error']['message']);}logger[_0xc008('0x19')](_0xc008('0x15'),_0x2ea200,_0x50c1ab['error'][_0xc008('0x1b')]);return _0x1819c6(_0x50c1ab['error']['message']);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x2ea200,_0xc008('0x16'));_0x1819c6(_0x50c1ab['result']['message']);}})['catch'](function(_0x4a582d){logger['error'](_0xc008('0x15'),_0x2ea200,_0x4a582d);_0x69726e(_0x4a582d);});});}function respondWithResult(_0x4777a6,_0x251db2){_0x251db2=_0x251db2||0xc8;return function(_0x415af3){if(_0x415af3){return _0x4777a6[_0xc008('0x1c')](_0x251db2)[_0xc008('0x1d')](_0x415af3);}};}function respondWithFilteredResult(_0x4f43e2,_0x459fd9){return function(_0x5c85f2){if(_0x5c85f2){var _0x58a6ea=typeof _0x459fd9[_0xc008('0x1e')]===_0xc008('0x1f')&&typeof _0x459fd9[_0xc008('0x20')]===_0xc008('0x1f');var _0x5410f5=_0x5c85f2['count'];var _0x5de1e9=_0x58a6ea?0x0:_0x459fd9[_0xc008('0x1e')];var _0x15dade=_0x58a6ea?_0x5c85f2[_0xc008('0x21')]:_0x459fd9[_0xc008('0x1e')]+_0x459fd9['limit'];var _0x5e2aca;if(_0x15dade>=_0x5410f5){_0x15dade=_0x5410f5;_0x5e2aca=0xc8;}else{_0x5e2aca=0xce;}_0x4f43e2['status'](_0x5e2aca);return _0x4f43e2['set']('Content-Range',_0x5de1e9+'-'+_0x15dade+'/'+_0x5410f5)[_0xc008('0x1d')](_0x5c85f2);}return null;};}function saveUpdates(_0x29ba43){return function(_0x25eae4){if(_0x25eae4){return _0x25eae4['update'](_0x29ba43)[_0xc008('0x13')](function(_0x32390d){return _0x32390d;});}return null;};}function removeEntity(_0x209591){return function(_0x2a7d4f){if(_0x2a7d4f){return _0x2a7d4f['destroy']()[_0xc008('0x13')](function(){_0x209591[_0xc008('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58db82){return function(_0x539766){if(!_0x539766){_0x58db82[_0xc008('0x22')](0x194);}return _0x539766;};}function handleError(_0x267abd,_0xf831f2){_0xf831f2=_0xf831f2||0x1f4;return function(_0x10889f){logger[_0xc008('0x19')](_0x10889f[_0xc008('0x23')]);if(_0x10889f[_0xc008('0x24')]){delete _0x10889f[_0xc008('0x24')];}_0x267abd[_0xc008('0x1c')](_0xf831f2)[_0xc008('0x25')](_0x10889f);};}exports[_0xc008('0x26')]=function(_0x1ac7c8,_0x596ee8){var _0x334a09={},_0x4b7fd4={},_0x499754={'count':0x0,'rows':[]};var _0xaf4b84=_[_0xc008('0x27')](db[_0xc008('0x28')][_0xc008('0x29')],function(_0xd0e05a){return{'name':_0xd0e05a[_0xc008('0x2a')],'type':_0xd0e05a[_0xc008('0x2b')][_0xc008('0x2c')]};});_0x4b7fd4[_0xc008('0x2d')]=_['map'](_0xaf4b84,_0xc008('0x24'));_0x4b7fd4[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x1ac7c8[_0xc008('0x2e')]);_0x4b7fd4[_0xc008('0x30')]=_[_0xc008('0x31')](_0x4b7fd4[_0xc008('0x2d')],_0x4b7fd4['query']);_0x334a09[_0xc008('0x32')]=_[_0xc008('0x31')](_0x4b7fd4['model'],qs[_0xc008('0x33')](_0x1ac7c8[_0xc008('0x2e')]['fields']));_0x334a09[_0xc008('0x32')]=_0x334a09[_0xc008('0x32')][_0xc008('0x34')]?_0x334a09['attributes']:_0x4b7fd4['model'];if(!_0x1ac7c8['query'][_0xc008('0x35')]('nolimit')){_0x334a09[_0xc008('0x20')]=qs[_0xc008('0x20')](_0x1ac7c8[_0xc008('0x2e')][_0xc008('0x20')]);_0x334a09[_0xc008('0x1e')]=qs[_0xc008('0x1e')](_0x1ac7c8[_0xc008('0x2e')][_0xc008('0x1e')]);}_0x334a09[_0xc008('0x36')]=qs[_0xc008('0x37')](_0x1ac7c8[_0xc008('0x2e')][_0xc008('0x37')]);_0x334a09[_0xc008('0x38')]=qs[_0xc008('0x30')](_['pick'](_0x1ac7c8[_0xc008('0x2e')],_0x4b7fd4[_0xc008('0x30')]),_0xaf4b84);if(_0x1ac7c8[_0xc008('0x2e')][_0xc008('0x39')]){_0x334a09['where']=_[_0xc008('0x3a')](_0x334a09[_0xc008('0x38')],{'$or':_[_0xc008('0x27')](_0xaf4b84,function(_0x36e7ae){if(_0x36e7ae[_0xc008('0x2b')]!=='VIRTUAL'){var _0x398cdd={};_0x398cdd[_0x36e7ae[_0xc008('0x24')]]={'$like':'%'+_0x1ac7c8[_0xc008('0x2e')][_0xc008('0x39')]+'%'};return _0x398cdd;}})});}_0x334a09=_[_0xc008('0x3a')]({},_0x334a09,_0x1ac7c8['options']);var _0xf4cc4b={'where':_0x334a09[_0xc008('0x38')]};return db[_0xc008('0x28')][_0xc008('0x21')](_0xf4cc4b)['then'](function(_0x26cd05){_0x499754[_0xc008('0x21')]=_0x26cd05;if(_0x1ac7c8[_0xc008('0x2e')]['includeAll']){_0x334a09[_0xc008('0x3b')]=[{'all':!![]}];}return db['MailMessage'][_0xc008('0x3c')](_0x334a09);})['then'](function(_0x46fa8f){_0x499754[_0xc008('0x3d')]=_0x46fa8f;return _0x499754;})['then'](respondWithFilteredResult(_0x596ee8,_0x334a09))[_0xc008('0x3e')](handleError(_0x596ee8,null));};exports[_0xc008('0x3f')]=function(_0x6d6d4c,_0x5caaa2){var _0x1cec64={'raw':!![],'where':{'id':_0x6d6d4c[_0xc008('0x40')]['id']}},_0x2a9b5c={};_0x2a9b5c[_0xc008('0x2d')]=_[_0xc008('0x2f')](db[_0xc008('0x28')]['rawAttributes']);_0x2a9b5c['query']=_['keys'](_0x6d6d4c[_0xc008('0x2e')]);_0x2a9b5c[_0xc008('0x30')]=_[_0xc008('0x31')](_0x2a9b5c[_0xc008('0x2d')],_0x2a9b5c[_0xc008('0x2e')]);_0x1cec64[_0xc008('0x32')]=_[_0xc008('0x31')](_0x2a9b5c[_0xc008('0x2d')],qs['fields'](_0x6d6d4c['query']['fields']));_0x1cec64[_0xc008('0x32')]=_0x1cec64[_0xc008('0x32')][_0xc008('0x34')]?_0x1cec64['attributes']:_0x2a9b5c[_0xc008('0x2d')];if(_0x6d6d4c[_0xc008('0x2e')][_0xc008('0x41')]){_0x1cec64[_0xc008('0x3b')]=[{'all':!![]}];}_0x1cec64=_[_0xc008('0x3a')]({},_0x1cec64,_0x6d6d4c[_0xc008('0x42')]);return db[_0xc008('0x28')][_0xc008('0x43')](_0x1cec64)[_0xc008('0x13')](handleEntityNotFound(_0x5caaa2,null))[_0xc008('0x13')](respondWithResult(_0x5caaa2,null))['catch'](handleError(_0x5caaa2,null));};exports['update']=function(_0x223056,_0x51cb14){if(_0x223056[_0xc008('0x44')]['id']){delete _0x223056[_0xc008('0x44')]['id'];}return db[_0xc008('0x28')]['find']({'where':{'id':_0x223056[_0xc008('0x40')]['id']}})[_0xc008('0x13')](handleEntityNotFound(_0x51cb14,null))[_0xc008('0x13')](saveUpdates(_0x223056[_0xc008('0x44')],null))[_0xc008('0x13')](respondWithResult(_0x51cb14,null))['catch'](handleError(_0x51cb14,null));};exports[_0xc008('0x45')]=function(_0x27b022,_0x4b4c6d){return db[_0xc008('0x28')][_0xc008('0x43')]({'where':{'id':_0x27b022['params']['id']}})['then'](handleEntityNotFound(_0x4b4c6d,null))[_0xc008('0x13')](removeEntity(_0x4b4c6d,null))[_0xc008('0x3e')](handleError(_0x4b4c6d,null));};exports[_0xc008('0x46')]=function(_0x30d0aa,_0x14b6a0){return db['MailMessage']['describe']()[_0xc008('0x13')](respondWithResult(_0x14b6a0,null))['catch'](handleError(_0x14b6a0,null));};exports[_0xc008('0x47')]=function(_0x25d351,_0xf94fcb){return db[_0xc008('0x28')][_0xc008('0x47')](_0x25d351[_0xc008('0x44')])['then'](function(_0x2ea742){if(_0x2ea742){if(_0x2ea742[_0xc008('0x48')]===_0xc008('0x49')&&!_0x2ea742[_0xc008('0x4a')]){var _0x4424f5,_0x5aa385,_0x41fae3;if(_0x25d351['body']['to']){_0x5aa385=_0x25d351['body']['to']['split'](',')[0x0];}return db[_0xc008('0x4b')][_0xc008('0x4c')]({'where':{'id':_0x2ea742[_0xc008('0x4d')]},'include':[{'model':db['CmList'],'as':_0xc008('0x4e'),'include':[{'model':db[_0xc008('0x4f')],'as':_0xc008('0x50'),'where':{'email':_0x5aa385},'limit':0x1,'order':[['updatedAt',_0xc008('0x51')]]}]},{'model':db[_0xc008('0x52')],'as':_0xc008('0x53'),'raw':!![]}]})[_0xc008('0x13')](function(_0x5baff1){_0x4424f5=_0x5baff1;if(_0x4424f5&&_0x4424f5[_0xc008('0x53')]){var _0x4eaa6d={'tls':{'rejectUnauthorized':![]}};if(_[_0xc008('0x54')](_0x4424f5[_0xc008('0x53')][_0xc008('0x55')])){_0x4eaa6d[_0xc008('0x56')]=_0x4424f5[_0xc008('0x53')][_0xc008('0x56')];_0x4eaa6d['port']=_0x4424f5[_0xc008('0x53')]['port'];_0x4eaa6d['secure']=_0x4424f5[_0xc008('0x53')][_0xc008('0x57')];if(_0x4424f5['Smtp'][_0xc008('0x58')]){_0x4eaa6d[_0xc008('0x59')]={'user':_0x4424f5[_0xc008('0x53')][_0xc008('0x5a')],'pass':_0x4424f5[_0xc008('0x53')][_0xc008('0x5b')]};}}else{_0x4eaa6d[_0xc008('0x55')]=_0x4424f5['Smtp'][_0xc008('0x55')];_0x4eaa6d[_0xc008('0x59')]={'user':_0x4424f5[_0xc008('0x53')][_0xc008('0x5a')],'pass':_0x4424f5[_0xc008('0x53')][_0xc008('0x5b')]};_0x4eaa6d[_0xc008('0x57')]=_0x4424f5[_0xc008('0x53')][_0xc008('0x57')];}if(_0x25d351[_0xc008('0x44')][_0xc008('0x5c')]&&_0x25d351[_0xc008('0x44')][_0xc008('0x5c')][_0xc008('0x34')]){for(var _0x4e0251=0x0;_0x4e0251<_0x25d351[_0xc008('0x44')][_0xc008('0x5c')][_0xc008('0x34')];_0x4e0251+=0x1){_0x25d351['body'][_0xc008('0x5c')][_0x4e0251]={'filename':_0x25d351[_0xc008('0x44')]['attachments'][_0x4e0251]['name'],'path':path[_0xc008('0x5d')](config[_0xc008('0x5e')],_0xc008('0x5f'),_0x25d351[_0xc008('0x44')][_0xc008('0x5c')][_0x4e0251][_0xc008('0x60')])};}}_0x41fae3={'account':_0x4eaa6d,'message':_0x25d351[_0xc008('0x44')]};return;}})[_0xc008('0x13')](function(){if(_0x4424f5[_0xc008('0x4e')]){if(_0x4424f5[_0xc008('0x4e')][_0xc008('0x50')]['length']){return _0x4424f5[_0xc008('0x4e')][_0xc008('0x50')][0x0];}else{return db[_0xc008('0x4f')][_0xc008('0x47')](_['defaults'](_0x25d351[_0xc008('0x44')],{'firstName':_0x25d351['body']['to'],'email':_0x25d351[_0xc008('0x44')]['to'],'phone':_0x25d351[_0xc008('0x44')]['to'],'ListId':_0x4424f5[_0xc008('0x61')]}));}}else{throw new Error('List\x20not\x20found');}})[_0xc008('0x13')](function(){if(_0x41fae3){return respondWithRpcPromise(_0xc008('0x62'),_0xc008('0x63'),_0x41fae3,client9003)['then'](function(_0x35b28a){return _0x2ea742['update']({'read':!![],'messageId':_0x35b28a[_0xc008('0x64')],'sentAt':moment()[_0xc008('0x65')](_0xc008('0x66'))});})[_0xc008('0x3e')](function(_0x295ec7){logger['error']('%s',JSON[_0xc008('0x67')](_0x295ec7));return _0x2ea742;});}return _0x2ea742;});}return _0x2ea742;}})[_0xc008('0x13')](respondWithResult(_0xf94fcb,0xc9))['catch'](handleError(_0xf94fcb,null));};exports[_0xc008('0x68')]=function(_0x5233bb,_0x278cbe){var _0x50bfe5={'agent':{},'channel':_0xc008('0x69')};if(_0x5233bb['body']['id']){delete _0x5233bb[_0xc008('0x44')]['id'];}_0x5233bb[_0xc008('0x44')][_0xc008('0x6a')]=!![];_0x5233bb[_0xc008('0x44')]['readAt']=moment()[_0xc008('0x65')](_0xc008('0x66'));_0x5233bb[_0xc008('0x44')][_0xc008('0x6b')]=_0x5233bb[_0xc008('0x44')][_0xc008('0x6b')]||_0x5233bb[_0xc008('0x5a')]['id'];_0x50bfe5[_0xc008('0x6c')]['id']=_0x5233bb['body'][_0xc008('0x6b')];return db['MailMessage']['find']({'where':{'id':_0x5233bb['params']['id'],'UserId':null}})[_0xc008('0x13')](handleEntityNotFound(_0x278cbe,null))[_0xc008('0x13')](saveUpdates(_0x5233bb[_0xc008('0x44')],null))[_0xc008('0x13')](function(_0xc2f684){if(_0xc2f684){_0x50bfe5[_0xc008('0x1b')]=_0xc2f684[_0xc008('0x6d')]({'plain':!![]});return db[_0xc008('0x6e')][_0xc008('0x43')]({'where':{'id':_0xc2f684['MailInteractionId']}});}return null;})[_0xc008('0x13')](handleEntityNotFound(_0x278cbe,null))[_0xc008('0x13')](function(_0x2b1b26){if(_0x2b1b26){return _0x2b1b26[_0xc008('0x6f')]({'UserId':_0x5233bb[_0xc008('0x44')][_0xc008('0x6b')],'read1stAt':_[_0xc008('0x54')](_0x2b1b26[_0xc008('0x70')])?moment()[_0xc008('0x65')](_0xc008('0x66')):undefined});}return null;})[_0xc008('0x13')](function(_0x1dd9fe){if(_0x1dd9fe){_0x50bfe5['interaction']=_0x1dd9fe['get']({'plain':!![]});interaction_log[_0xc008('0x14')](_0xc008('0x71'),_0x5233bb[_0xc008('0x5a')]['id'],_0x5233bb['user'][_0xc008('0x24')],_0x5233bb[_0xc008('0x5a')]['role'],_0x50bfe5['interaction']['id'],_0x5233bb['body']?JSON[_0xc008('0x67')](_0x5233bb[_0xc008('0x44')]):_0xc008('0x72'));return respondWithRpcPromise(_0xc008('0x73'),_0xc008('0x74'),_0x50bfe5);}return null;})[_0xc008('0x13')](function(_0x285c09){var _0x43ba59=_0xc008('0x75')+_0x285c09[_0xc008('0x1b')]['ContactId'];return db['sequelize'][_0xc008('0x2e')](_0x43ba59,{'type':db[_0xc008('0x76')][_0xc008('0x77')][_0xc008('0x78')],'raw':!![]})[_0xc008('0x13')](function(_0x37fc2c){return _0x37fc2c;});})['then'](function(_0x5794fe){if(_0x5794fe){_0x50bfe5[_0xc008('0x1b')][_0xc008('0x79')]=_0x5794fe[0x0];if(!_0x5233bb[_0xc008('0x44')]['UserId'])return;return db['User']['find']({'where':{'id':_0x5233bb['body']['UserId'],'role':'agent'},'attributes':['id',_0xc008('0x24'),'fullname',_0xc008('0x7a'),'internal'],'raw':!![]});}return null;})[_0xc008('0x13')](function(_0x41151e){if(!_0x41151e)return null;_0x50bfe5[_0xc008('0x1b')]['agent']=_0x41151e;return _0x50bfe5;})['then'](function(_0x2ff671){if(_0x2ff671){if(_0x5233bb['body'][_0xc008('0x7b')]){_0x50bfe5[_0xc008('0x1b')]['interface']=util[_0xc008('0x65')]('SIP/%s',_0x5233bb['user'][_0xc008('0x24')]);_0x50bfe5[_0xc008('0x1b')]['channel']=_0x50bfe5[_0xc008('0x7c')];_0x50bfe5[_0xc008('0x1b')][_0xc008('0x7d')]='accept';_0x50bfe5[_0xc008('0x1b')][_0xc008('0x44')]=htmlToText[_0xc008('0x7e')](_0x50bfe5[_0xc008('0x1b')][_0xc008('0x44')]);return respondWithRpcPromise(_0xc008('0x7f'),'EventManager',{'event':_0xc008('0x80'),'message':_0x50bfe5[_0xc008('0x1b')]},client9002)[_0xc008('0x13')](function(){return _0x50bfe5;});}return _0x50bfe5;}return null;})['then'](respondWithResult(_0x278cbe,null))[_0xc008('0x3e')](handleError(_0x278cbe,null));};exports[_0xc008('0x81')]=function(_0x4452a8,_0x4914ed){var _0x48c38b={'agent':{},'channel':'mail'};if(_0x4452a8[_0xc008('0x44')]['id']){delete _0x4452a8[_0xc008('0x44')]['id'];}_0x4452a8[_0xc008('0x44')][_0xc008('0x6b')]=_0x4452a8[_0xc008('0x44')][_0xc008('0x6b')]||_0x4452a8[_0xc008('0x5a')]['id'];_0x48c38b[_0xc008('0x6c')]['id']=_0x4452a8['body'][_0xc008('0x6b')];return db[_0xc008('0x28')]['find']({'where':{'id':_0x4452a8['params']['id'],'UserId':null}})[_0xc008('0x13')](handleEntityNotFound(_0x4914ed,null))[_0xc008('0x13')](function(_0x2be063){if(_0x2be063){_0x48c38b[_0xc008('0x1b')]=_0x2be063[_0xc008('0x6d')]({'plain':!![]});return db['MailInteraction'][_0xc008('0x43')]({'where':{'id':_0x2be063[_0xc008('0x82')]}});}return null;})['then'](handleEntityNotFound(_0x4914ed,null))[_0xc008('0x13')](function(_0x1cc68f){if(_0x1cc68f){_0x48c38b[_0xc008('0x83')]=_0x1cc68f[_0xc008('0x6d')]({'plain':!![]});interaction_log['info'](_0xc008('0x84'),_0x4452a8[_0xc008('0x5a')]['id'],_0x4452a8[_0xc008('0x5a')][_0xc008('0x24')],_0x4452a8['user'][_0xc008('0x85')],_0x48c38b[_0xc008('0x83')]['id'],_0x4452a8['body']?JSON['stringify'](_0x4452a8[_0xc008('0x44')]):'null');return respondWithRpcPromise(_0xc008('0x86'),_0xc008('0x87'),_0x48c38b);}return null;})['then'](function(_0x1b6858){var _0x201ffa=_0xc008('0x75')+_0x1b6858[_0xc008('0x1b')][_0xc008('0x88')];return db[_0xc008('0x89')][_0xc008('0x2e')](_0x201ffa,{'type':db[_0xc008('0x76')][_0xc008('0x77')][_0xc008('0x78')],'raw':!![]})['then'](function(_0x49e6d5){return _0x49e6d5;});})[_0xc008('0x13')](function(_0x3d6f70){if(_0x3d6f70){_0x48c38b['message'][_0xc008('0x79')]=_0x3d6f70[0x0];if(!_0x4452a8[_0xc008('0x44')][_0xc008('0x6b')])return;return db['User'][_0xc008('0x43')]({'where':{'id':_0x4452a8[_0xc008('0x44')][_0xc008('0x6b')],'role':_0xc008('0x6c')},'attributes':['id',_0xc008('0x24'),_0xc008('0x8a'),_0xc008('0x7a'),'internal'],'raw':!![]});}return null;})[_0xc008('0x13')](function(_0x49cd29){if(!_0x49cd29)return null;_0x48c38b[_0xc008('0x1b')][_0xc008('0x6c')]=_0x49cd29;return _0x48c38b;})[_0xc008('0x13')](function(_0x583077){if(_0x583077){_0x583077[_0xc008('0x1b')][_0xc008('0x8b')]=util[_0xc008('0x65')](_0xc008('0x8c'),_0x4452a8[_0xc008('0x5a')][_0xc008('0x24')]);_0x583077[_0xc008('0x1b')][_0xc008('0x7c')]=_0x48c38b[_0xc008('0x7c')];_0x583077[_0xc008('0x1b')]['event']=_0xc008('0x81');_0x583077[_0xc008('0x1b')][_0xc008('0x44')]=htmlToText[_0xc008('0x7e')](_0x48c38b[_0xc008('0x1b')]['body']);respondWithRpcPromise(_0xc008('0x7f'),_0xc008('0x7f'),{'event':_0xc008('0x8d'),'message':_0x583077[_0xc008('0x1b')]},client9002);return _0x48c38b;}return null;})[_0xc008('0x13')](respondWithResult(_0x4914ed,null))[_0xc008('0x3e')](handleError(_0x4914ed,null));};exports[_0xc008('0x8e')]=function(_0x220170,_0x2cc170){var _0x3e200b=moment()[_0xc008('0x8f')]()[_0xc008('0x90')]();var _0x2e2c2a=path[_0xc008('0x5d')](config[_0xc008('0x5e')],'server','files',_0xc008('0x91'));var _0x276ced=path[_0xc008('0x5d')](config[_0xc008('0x5e')],_0xc008('0x92'),_0xc008('0x93'),_0xc008('0x5c'));var _0x3eb3de=util[_0xc008('0x65')]('message-%s.eml',_0x3e200b);return db[_0xc008('0x28')][_0xc008('0x43')]({'where':{'id':_0x220170['params']['id']},'attributes':['id',_0xc008('0x44'),_0xc008('0x94'),'to','cc',_0xc008('0x95'),_0xc008('0x96'),_0xc008('0x97')],'include':_0x220170[_0xc008('0x2e')]['attachments']?[{'model':db[_0xc008('0x98')],'as':_0xc008('0x99')}]:undefined})[_0xc008('0x13')](handleEntityNotFound(_0x2cc170,null))[_0xc008('0x13')](function(_0x59e3d0){if(_0x59e3d0){var _0x13a0bd=_0x59e3d0;var _0x5d5d2f={'from':_0x13a0bd[_0xc008('0x94')],'to':_0x13a0bd['to'],'subject':_0x13a0bd[_0xc008('0x96')],'html':_0x13a0bd['body'],'headers':{'Date':moment(_0x13a0bd[_0xc008('0x97')])['format'](_0xc008('0x9a'))},'attachments':[]};if(_0x59e3d0['cc']){_0x5d5d2f['headers']['Cc']=_0x59e3d0['cc'];}if(_0x59e3d0['bcc']){_0x5d5d2f['headers'][_0xc008('0x9b')]=_0x59e3d0[_0xc008('0x95')];}return new BPromise(function(_0x48f40f,_0x4fda8){if(_0x59e3d0[_0xc008('0x99')]){for(var _0x4a7692=0x0;_0x4a7692<_0x59e3d0[_0xc008('0x99')][_0xc008('0x34')];_0x4a7692++){var _0x1564a9=_0x59e3d0['Attachments'][_0x4a7692];var _0x33cad3=path[_0xc008('0x5d')](_0x276ced,_0x1564a9[_0xc008('0x60')]);if(fs[_0xc008('0x9c')](_0x33cad3)){_0x5d5d2f[_0xc008('0x5c')][_0xc008('0x9d')]({'name':_0x1564a9[_0xc008('0x24')],'contentType':_0x1564a9[_0xc008('0x2b')],'data':fs[_0xc008('0x9e')](_0x33cad3)});}}}emlformat[_0xc008('0x9f')](_0x5d5d2f,function(_0x427fd2,_0x4ea18b){if(_0x427fd2)return _0x4fda8(_0x427fd2);fs[_0xc008('0xa0')](path[_0xc008('0x5d')](_0x2e2c2a,_0x3eb3de),_0x4ea18b);return _0x48f40f(_0x4ea18b);});});}})[_0xc008('0x13')](function(_0x4b946a){if(_0x4b946a){return _0x2cc170[_0xc008('0x8e')](path[_0xc008('0x5d')](_0x2e2c2a,_0x3eb3de),_0x3eb3de,function(_0x3f6018){if(!_0x3f6018)fs['unlinkSync'](path[_0xc008('0x5d')](_0x2e2c2a,_0x3eb3de));});}})['catch'](handleError(_0x2cc170,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index c8b441e..334c7da 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 _0x7019=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','MailMessage'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x7019,0x18d));var _0x9701=function(_0x12f08e,_0x21d4e3){_0x12f08e=_0x12f08e-0x0;var _0x5a41c2=_0x7019[_0x12f08e];return _0x5a41c2;};'use strict';var EventEmitter=require(_0x9701('0x0'));var MailMessage=require(_0x9701('0x1'))['db'][_0x9701('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9701('0x3'),'afterUpdate':'update','afterDestroy':_0x9701('0x4')};function emitEvent(_0x5f5197){return function(_0xeef677,_0x358c34,_0x2d6211){MailMessageEvents['emit'](_0x5f5197+':'+_0xeef677['id'],_0xeef677);MailMessageEvents[_0x9701('0x5')](_0x5f5197,_0xeef677);_0x2d6211(null);};}for(var e in events){if(events[_0x9701('0x6')](e)){var event=events[e];MailMessage[_0x9701('0x7')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0x6f9e=['hasOwnProperty','hook','exports','../../mysqldb','MailMessage','setMaxListeners','save','update','remove','emit'];(function(_0x439c4c,_0x44ff84){var _0x30dd4f=function(_0x49f563){while(--_0x49f563){_0x439c4c['push'](_0x439c4c['shift']());}};_0x30dd4f(++_0x44ff84);}(_0x6f9e,0x161));var _0xe6f9=function(_0x427796,_0xf1a007){_0x427796=_0x427796-0x0;var _0xdf645b=_0x6f9e[_0x427796];return _0xdf645b;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0xe6f9('0x0'))['db'][_0xe6f9('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xe6f9('0x2')](0x0);var events={'afterCreate':_0xe6f9('0x3'),'afterUpdate':_0xe6f9('0x4'),'afterDestroy':_0xe6f9('0x5')};function emitEvent(_0x47699e){return function(_0x3038ba,_0x1ae721,_0x4f50ff){MailMessageEvents['emit'](_0x47699e+':'+_0x3038ba['id'],_0x3038ba);MailMessageEvents[_0xe6f9('0x6')](_0x47699e,_0x3038ba);_0x4f50ff(null);};}for(var e in events){if(events[_0xe6f9('0x7')](e)){var event=events[e];MailMessage[_0xe6f9('0x8')](e,emitEvent(event));}}module[_0xe6f9('0x9')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 9040eef..74030b2 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 _0x52a9=['util','../../config/logger','bluebird','request-promise','html-to-text','path','rimraf','exports','MailMessage','mail_messages','messageId','plainBody','subject','FULLTEXT','body','fromString','models','toLowerCase','direction','out','isNil','MailInteraction','findOne','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x39caaa,_0x1f37bc){var _0x9b9c7d=function(_0x2da02c){while(--_0x2da02c){_0x39caaa['push'](_0x39caaa['shift']());}};_0x9b9c7d(++_0x1f37bc);}(_0x52a9,0x15b));var _0x952a=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0x52a9[_0x5c9307];return _0x373e29;};'use strict';var _=require(_0x952a('0x0'));var util=require(_0x952a('0x1'));var logger=require(_0x952a('0x2'))('api');var moment=require('moment');var BPromise=require(_0x952a('0x3'));var rp=require(_0x952a('0x4'));var htmlToText=require(_0x952a('0x5'));var fs=require('fs');var path=require(_0x952a('0x6'));var rimraf=require(_0x952a('0x7'));var config=require('../../config/environment');var attributes=require('./mailMessage.attributes');module[_0x952a('0x8')]=function(_0x50660b,_0x2dd2cf){return _0x50660b['define'](_0x952a('0x9'),attributes,{'tableName':_0x952a('0xa'),'paranoid':![],'indexes':[{'name':_0x952a('0xb'),'fields':[_0x952a('0xb')]},{'name':'fti_mail_messages','fields':[_0x952a('0xc'),_0x952a('0xd')],'type':_0x952a('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2b6970,_0x14be78,_0x3ed5af){if(_0x2b6970[_0x952a('0xf')]){_0x2b6970[_0x952a('0xc')]=htmlToText[_0x952a('0x10')](_0x2b6970[_0x952a('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x3ed5af(null,_0x14be78);},'afterCreate':function(_0xc541b3,_0x58d018,_0x410830){var _0x4dc876=_0x50660b[_0x952a('0x11')];var _0x49f91b=_0xc541b3['get']({'plain':!![]});if(_0x49f91b['direction'][_0x952a('0x12')]()==='in'||_0x49f91b[_0x952a('0x13')][_0x952a('0x12')]()===_0x952a('0x14')&&!_0x49f91b['secret']&&!_[_0x952a('0x15')](_0x49f91b['UserId'])){_0x4dc876[_0x952a('0x16')][_0x952a('0x17')]({'where':{'id':_0x49f91b['MailInteractionId']}})['then'](function(_0x354a5c){if(_0x354a5c){_0x354a5c['update']({'lastMsgAt':_0x49f91b[_0x952a('0x18')],'lastMsgDirection':_0x49f91b[_0x952a('0x13')][_0x952a('0x12')]()});}})[_0x952a('0x19')](function(_0x1f5a29){console[_0x952a('0x1a')](_0x1f5a29);});}_0x410830();}},'charset':_0x952a('0x1b'),'collate':_0x952a('0x1c')});}; \ No newline at end of file +var _0xb05f=['isNil','UserId','MailInteraction','MailInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./mailMessage.attributes','define','MailMessage','messageId','fti_mail_messages','plainBody','subject','body','fromString','get','direction','toLowerCase','out','secret'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xb05f,0x6b));var _0xfb05=function(_0x5039fd,_0x1d2b17){_0x5039fd=_0x5039fd-0x0;var _0x5488a1=_0xb05f[_0x5039fd];return _0x5488a1;};'use strict';var _=require('lodash');var util=require(_0xfb05('0x0'));var logger=require(_0xfb05('0x1'))('api');var moment=require(_0xfb05('0x2'));var BPromise=require(_0xfb05('0x3'));var rp=require('request-promise');var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0xfb05('0x4'));var rimraf=require(_0xfb05('0x5'));var config=require(_0xfb05('0x6'));var attributes=require(_0xfb05('0x7'));module['exports']=function(_0x5d23b2,_0x6d0df6){return _0x5d23b2[_0xfb05('0x8')](_0xfb05('0x9'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0xfb05('0xa')]},{'name':_0xfb05('0xb'),'fields':[_0xfb05('0xc'),_0xfb05('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2ba7c3,_0x47fa8c,_0x20089e){if(_0x2ba7c3[_0xfb05('0xe')]){_0x2ba7c3[_0xfb05('0xc')]=htmlToText[_0xfb05('0xf')](_0x2ba7c3[_0xfb05('0xe')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x20089e(null,_0x47fa8c);},'afterCreate':function(_0x348d76,_0x3d59ac,_0x32b569){var _0x1f913c=_0x5d23b2['models'];var _0x3cc271=_0x348d76[_0xfb05('0x10')]({'plain':!![]});if(_0x3cc271[_0xfb05('0x11')][_0xfb05('0x12')]()==='in'||_0x3cc271[_0xfb05('0x11')][_0xfb05('0x12')]()===_0xfb05('0x13')&&!_0x3cc271[_0xfb05('0x14')]&&!_[_0xfb05('0x15')](_0x3cc271[_0xfb05('0x16')])){_0x1f913c[_0xfb05('0x17')]['findOne']({'where':{'id':_0x3cc271[_0xfb05('0x18')]}})[_0xfb05('0x19')](function(_0x4fad3f){if(_0x4fad3f){_0x4fad3f[_0xfb05('0x1a')]({'lastMsgAt':_0x3cc271[_0xfb05('0x1b')],'lastMsgDirection':_0x3cc271[_0xfb05('0x11')][_0xfb05('0x12')]()});}})[_0xfb05('0x1c')](function(_0x439f1c){console[_0xfb05('0x1d')](_0x439f1c);});}_0x32b569();}},'charset':_0xfb05('0x1e'),'collate':_0xfb05('0x1f')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index dfda7a9..ebcb438 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 _0xaebd=['MailMessage,\x20%s,\x20%s','result','catch','CreateMailMessage','MailMessage','create','body','options','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./mailMessage.socket','then','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x32b5a9,_0x4f1a6e){_0x32b5a9=_0x32b5a9-0x0;var _0x2d49f7=_0xaebd[_0x32b5a9];return _0x2d49f7;};'use strict';var _=require(_0xdaeb('0x0'));var util=require('util');var moment=require(_0xdaeb('0x1'));var BPromise=require(_0xdaeb('0x2'));var rs=require(_0xdaeb('0x3'));var fs=require('fs');var Redis=require(_0xdaeb('0x4'));var db=require(_0xdaeb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdaeb('0x6'))(_0xdaeb('0x7'));var config=require(_0xdaeb('0x8'));var jayson=require(_0xdaeb('0x9'));var client=jayson[_0xdaeb('0xa')]['http']({'port':0x232a});config[_0xdaeb('0xb')]=_[_0xdaeb('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xdaeb('0xd'))(new Redis(config[_0xdaeb('0xb')]));require(_0xdaeb('0xe'))['register'](socket);function respondWithRpcPromise(_0xbb4b72,_0x494d42,_0x3e83f3){return new BPromise(function(_0x4ba89d,_0x2218d6){return client['request'](_0xbb4b72,_0x3e83f3)[_0xdaeb('0xf')](function(_0x3f0e95){logger['info']('MailMessage,\x20%s,\x20%s',_0x494d42,_0xdaeb('0x10'));logger['debug'](_0xdaeb('0x11'),_0x494d42,_0xdaeb('0x10'),JSON[_0xdaeb('0x12')](_0x3f0e95));if(_0x3f0e95[_0xdaeb('0x13')]){if(_0x3f0e95[_0xdaeb('0x13')][_0xdaeb('0x14')]===0x1f4){logger[_0xdaeb('0x13')]('MailMessage,\x20%s,\x20%s',_0x494d42,_0x3f0e95['error'][_0xdaeb('0x15')]);return _0x2218d6(_0x3f0e95[_0xdaeb('0x13')][_0xdaeb('0x15')]);}logger[_0xdaeb('0x13')]('MailMessage,\x20%s,\x20%s',_0x494d42,_0x3f0e95['error'][_0xdaeb('0x15')]);return _0x4ba89d(_0x3f0e95['error']['message']);}else{logger[_0xdaeb('0x16')](_0xdaeb('0x17'),_0x494d42,_0xdaeb('0x10'));_0x4ba89d(_0x3f0e95[_0xdaeb('0x18')][_0xdaeb('0x15')]);}})[_0xdaeb('0x19')](function(_0x501f77){logger[_0xdaeb('0x13')]('MailMessage,\x20%s,\x20%s',_0x494d42,_0x501f77);_0x2218d6(_0x501f77);});});}exports[_0xdaeb('0x1a')]=function(_0x13b3f2){var _0x18bd81=this;return new Promise(function(_0x5360ce,_0x4e97e0){return db[_0xdaeb('0x1b')][_0xdaeb('0x1c')](_0x13b3f2[_0xdaeb('0x1d')],{'raw':_0x13b3f2[_0xdaeb('0x1e')]?_0x13b3f2[_0xdaeb('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2c969d){logger[_0xdaeb('0x16')](_0xdaeb('0x1a'),_0x13b3f2);logger[_0xdaeb('0x1f')](_0xdaeb('0x1a'),_0x13b3f2,JSON['stringify'](_0x2c969d));_0x5360ce(_0x2c969d);})[_0xdaeb('0x19')](function(_0x4dc25f){logger[_0xdaeb('0x13')](_0xdaeb('0x1a'),_0x4dc25f[_0xdaeb('0x15')],_0x13b3f2);_0x4e97e0(_0x18bd81[_0xdaeb('0x13')](0x1f4,_0x4dc25f[_0xdaeb('0x15')]));});});}; \ No newline at end of file +var _0x5f2f=['MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','MailMessage','create','options','raw','CreateMailMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xdea04a,_0x2cafad){var _0x456d82=function(_0x15699d){while(--_0x15699d){_0xdea04a['push'](_0xdea04a['shift']());}};_0x456d82(++_0x2cafad);}(_0x5f2f,0x73));var _0xf5f2=function(_0x59c9f8,_0x271b33){_0x59c9f8=_0x59c9f8-0x0;var _0x5ae7b2=_0x5f2f[_0x59c9f8];return _0x5ae7b2;};'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('./mailMessage.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['CreateMailMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index b69bff6..6cf0420 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 _0xed01=['removeListener','register','length','./mailMessage.events','save','update'];(function(_0x336280,_0x10a45c){var _0x2a1b5b=function(_0x3c99ea){while(--_0x3c99ea){_0x336280['push'](_0x336280['shift']());}};_0x2a1b5b(++_0x10a45c);}(_0xed01,0x111));var _0x1ed0=function(_0x5207a2,_0x316913){_0x5207a2=_0x5207a2-0x0;var _0x314716=_0xed01[_0x5207a2];return _0x314716;};'use strict';var MailMessageEvents=require(_0x1ed0('0x0'));var events=[_0x1ed0('0x1'),'remove',_0x1ed0('0x2')];function createListener(_0x1ab7c1,_0x24595d){return function(_0x549d38){_0x24595d['emit'](_0x1ab7c1,_0x549d38);};}function removeListener(_0x223187,_0x3a5046){return function(){MailMessageEvents[_0x1ed0('0x3')](_0x223187,_0x3a5046);};}exports[_0x1ed0('0x4')]=function(_0x2f9ab4){for(var _0x71de73=0x0,_0x3edc97=events[_0x1ed0('0x5')];_0x71de73<_0x3edc97;_0x71de73++){var _0x1f0bef=events[_0x71de73];var _0x109e31=createListener('mailMessage:'+_0x1f0bef,_0x2f9ab4);MailMessageEvents['on'](_0x1f0bef,_0x109e31);}}; \ No newline at end of file +var _0x5c9b=['removeListener','register','length','./mailMessage.events','save','remove','update','emit'];(function(_0x4d50a1,_0x188247){var _0x2d733f=function(_0x4d104c){while(--_0x4d104c){_0x4d50a1['push'](_0x4d50a1['shift']());}};_0x2d733f(++_0x188247);}(_0x5c9b,0x13b));var _0xb5c9=function(_0x2e0d89,_0x3cd310){_0x2e0d89=_0x2e0d89-0x0;var _0x293645=_0x5c9b[_0x2e0d89];return _0x293645;};'use strict';var MailMessageEvents=require(_0xb5c9('0x0'));var events=[_0xb5c9('0x1'),_0xb5c9('0x2'),_0xb5c9('0x3')];function createListener(_0x221e2b,_0x33fac2){return function(_0x5e6651){_0x33fac2[_0xb5c9('0x4')](_0x221e2b,_0x5e6651);};}function removeListener(_0x69ae8f,_0x4d983b){return function(){MailMessageEvents[_0xb5c9('0x5')](_0x69ae8f,_0x4d983b);};}exports[_0xb5c9('0x6')]=function(_0x975f8a){for(var _0x1cd33c=0x0,_0x46e8e2=events[_0xb5c9('0x7')];_0x1cd33c<_0x46e8e2;_0x1cd33c++){var _0x47e959=events[_0x1cd33c];var _0x16da8b=createListener('mailMessage:'+_0x47e959,_0x975f8a);MailMessageEvents['on'](_0x47e959,_0x16da8b);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 9f3342f..1b0908b 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 _0x21aa=['describe','/:id','show','/:id/members','getAgents','post','create','/:id/teams','addTeams','/:id/users','addAgents','put','update','delete','removeAgents','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe'];(function(_0x339c87,_0x3ae7be){var _0x9ca4fc=function(_0x21d89e){while(--_0x21d89e){_0x339c87['push'](_0x339c87['shift']());}};_0x9ca4fc(++_0x3ae7be);}(_0x21aa,0x148));var _0xa21a=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0x21aa[_0x47fd36];return _0x21a0fc;};'use strict';var multer=require('multer');var util=require(_0xa21a('0x0'));var path=require('path');var timeout=require(_0xa21a('0x1'));var express=require(_0xa21a('0x2'));var router=express[_0xa21a('0x3')]();var fs_extra=require(_0xa21a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa21a('0x5'));var config=require(_0xa21a('0x6'));var controller=require('./mailQueue.controller');router[_0xa21a('0x7')]('/',auth[_0xa21a('0x8')](),controller['index']);router[_0xa21a('0x7')](_0xa21a('0x9'),auth['isAuthenticated'](),controller[_0xa21a('0xa')]);router[_0xa21a('0x7')](_0xa21a('0xb'),auth['isAuthenticated'](),controller[_0xa21a('0xc')]);router[_0xa21a('0x7')](_0xa21a('0xd'),auth['isAuthenticated'](),controller['getMembers']);router[_0xa21a('0x7')]('/:id/teams',auth[_0xa21a('0x8')](),controller['getTeams']);router['get']('/:id/users',auth[_0xa21a('0x8')](),controller[_0xa21a('0xe')]);router[_0xa21a('0xf')]('/',auth['isAuthenticated'](),controller[_0xa21a('0x10')]);router['post'](_0xa21a('0x11'),auth[_0xa21a('0x8')](),controller[_0xa21a('0x12')]);router[_0xa21a('0xf')](_0xa21a('0x13'),auth[_0xa21a('0x8')](),controller[_0xa21a('0x14')]);router[_0xa21a('0x15')]('/:id',auth[_0xa21a('0x8')](),controller[_0xa21a('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0xa21a('0x17')](_0xa21a('0x11'),auth[_0xa21a('0x8')](),controller['removeTeams']);router[_0xa21a('0x17')]('/:id/users',auth[_0xa21a('0x8')](),controller[_0xa21a('0x18')]);module[_0xa21a('0x19')]=router; \ No newline at end of file +var _0x3d29=['put','/:id','delete','destroy','removeAgents','multer','util','express','Router','../../components/auth/service','../../config/environment','./mailQueue.controller','get','index','/describe','describe','show','/:id/members','isAuthenticated','getTeams','/:id/users','post','create','/:id/teams','addAgents'];(function(_0x97d09,_0x48e6d7){var _0x20155a=function(_0x1314a7){while(--_0x1314a7){_0x97d09['push'](_0x97d09['shift']());}};_0x20155a(++_0x48e6d7);}(_0x3d29,0xb4));var _0x93d2=function(_0xb1cf84,_0x813740){_0xb1cf84=_0xb1cf84-0x0;var _0x4bad2e=_0x3d29[_0xb1cf84];return _0x4bad2e;};'use strict';var multer=require(_0x93d2('0x0'));var util=require(_0x93d2('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x93d2('0x2'));var router=express[_0x93d2('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x93d2('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x93d2('0x5'));var controller=require(_0x93d2('0x6'));router[_0x93d2('0x7')]('/',auth['isAuthenticated'](),controller[_0x93d2('0x8')]);router[_0x93d2('0x7')](_0x93d2('0x9'),auth['isAuthenticated'](),controller[_0x93d2('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x93d2('0xb')]);router[_0x93d2('0x7')](_0x93d2('0xc'),auth[_0x93d2('0xd')](),controller['getMembers']);router[_0x93d2('0x7')]('/:id/teams',auth[_0x93d2('0xd')](),controller[_0x93d2('0xe')]);router[_0x93d2('0x7')](_0x93d2('0xf'),auth['isAuthenticated'](),controller['getAgents']);router[_0x93d2('0x10')]('/',auth[_0x93d2('0xd')](),controller[_0x93d2('0x11')]);router[_0x93d2('0x10')](_0x93d2('0x12'),auth[_0x93d2('0xd')](),controller['addTeams']);router[_0x93d2('0x10')](_0x93d2('0xf'),auth[_0x93d2('0xd')](),controller[_0x93d2('0x13')]);router[_0x93d2('0x14')](_0x93d2('0x15'),auth['isAuthenticated'](),controller['update']);router[_0x93d2('0x16')](_0x93d2('0x15'),auth[_0x93d2('0xd')](),controller[_0x93d2('0x17')]);router['delete']('/:id/teams',auth[_0x93d2('0xd')](),controller['removeTeams']);router[_0x93d2('0x16')](_0x93d2('0xf'),auth[_0x93d2('0xd')](),controller[_0x93d2('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 2d32dc5..3385f49 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 _0x3ae7=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x10e92e,_0x2be3f4){var _0x149fb4=function(_0x7f5759){while(--_0x7f5759){_0x10e92e['push'](_0x10e92e['shift']());}};_0x149fb4(++_0x2be3f4);}(_0x3ae7,0x16e));var _0x73ae=function(_0x1c62b6,_0x4fb41f){_0x1c62b6=_0x1c62b6-0x0;var _0x507594=_0x3ae7[_0x1c62b6];return _0x507594;};'use strict';var Sequelize=require(_0x73ae('0x0'));module[_0x73ae('0x1')]={'name':{'type':Sequelize[_0x73ae('0x2')],'unique':_0x73ae('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x73ae('0x2')]},'timeout':{'type':Sequelize[_0x73ae('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x73ae('0x5')](_0x73ae('0x6'),_0x73ae('0x7'),_0x73ae('0x8'))}}; \ No newline at end of file +var _0x0471=['STRING','name','INTEGER','ENUM','rrmemory','beepall','sequelize','exports'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x0471,0x66));var _0x1047=function(_0x37bdc4,_0x3274fb){_0x37bdc4=_0x37bdc4-0x0;var _0x50b736=_0x0471[_0x37bdc4];return _0x50b736;};'use strict';var Sequelize=require(_0x1047('0x0'));module[_0x1047('0x1')]={'name':{'type':Sequelize[_0x1047('0x2')],'unique':_0x1047('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1047('0x2')]},'timeout':{'type':Sequelize[_0x1047('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1047('0x5')](_0x1047('0x6'),_0x1047('0x7'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index a486549..d3ca2be 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 _0x851f=['findOne','rawAttributes','MailQueueId','User','UserId','mailPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','transaction','each','UserMailQueue','findOrCreate','forEach','userMailQueue:save','removeTeams','select','field','tq.TeamId','from','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','emit','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','then','destroy','get','MailQueues','stack','name','send','index','map','type','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','include','MailQueue','findAll','rows','catch','show','params','keys','intersection','includeAll','merge','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','find','describe','getMembers'];(function(_0x83420c,_0x50fd91){var _0x1057d7=function(_0x80befc){while(--_0x80befc){_0x83420c['push'](_0x83420c['shift']());}};_0x1057d7(++_0x50fd91);}(_0x851f,0xbb));var _0xf851=function(_0x1dad92,_0x2f948c){_0x1dad92=_0x1dad92-0x0;var _0x90a9f6=_0x851f[_0x1dad92];return _0x90a9f6;};'use strict';var emlformat=require(_0xf851('0x0'));var rimraf=require(_0xf851('0x1'));var zipdir=require(_0xf851('0x2'));var jsonpatch=require(_0xf851('0x3'));var rp=require('request-promise');var moment=require(_0xf851('0x4'));var BPromise=require(_0xf851('0x5'));var Mustache=require(_0xf851('0x6'));var util=require('util');var path=require('path');var sox=require(_0xf851('0x7'));var csv=require('to-csv');var ejs=require(_0xf851('0x8'));var fs=require('fs');var fs_extra=require(_0xf851('0x9'));var _=require(_0xf851('0xa'));var squel=require('squel');var crypto=require(_0xf851('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf851('0xc'));var toCsv=require(_0xf851('0xd'));var querystring=require(_0xf851('0xe'));var Papa=require(_0xf851('0xf'));var Redis=require('ioredis');var authService=require(_0xf851('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf851('0x11'));var logger=require('../../config/logger')(_0xf851('0x12'));var utils=require(_0xf851('0x13'));var config=require(_0xf851('0x14'));var licenseUtil=require(_0xf851('0x15'));var db=require(_0xf851('0x16'))['db'];config[_0xf851('0x17')]=_['defaults'](config['redis'],{'host':_0xf851('0x18'),'port':0x18eb});var socket=require(_0xf851('0x19'))(new Redis(config['redis']));require(_0xf851('0x1a'))[_0xf851('0x1b')](socket);function respondWithStatusCode(_0x1a3dd6,_0x528984){_0x528984=_0x528984||0xcc;return function(_0x436b22){if(_0x436b22){return _0x1a3dd6[_0xf851('0x1c')](_0x528984);}return _0x1a3dd6[_0xf851('0x1d')](_0x528984)['end']();};}function respondWithResult(_0x311aad,_0x2e6514){_0x2e6514=_0x2e6514||0xc8;return function(_0x49f623){if(_0x49f623){return _0x311aad[_0xf851('0x1d')](_0x2e6514)[_0xf851('0x1e')](_0x49f623);}};}function respondWithFilteredResult(_0x5a3290,_0x59d3a5){return function(_0x5b7b09){if(_0x5b7b09){var _0x112431=typeof _0x59d3a5[_0xf851('0x1f')]===_0xf851('0x20')&&typeof _0x59d3a5[_0xf851('0x21')]===_0xf851('0x20');var _0x56cc50=_0x5b7b09[_0xf851('0x22')];var _0x3b4969=_0x112431?0x0:_0x59d3a5[_0xf851('0x1f')];var _0x35520f=_0x112431?_0x5b7b09[_0xf851('0x22')]:_0x59d3a5[_0xf851('0x1f')]+_0x59d3a5[_0xf851('0x21')];var _0x217a4c;if(_0x35520f>=_0x56cc50){_0x35520f=_0x56cc50;_0x217a4c=0xc8;}else{_0x217a4c=0xce;}_0x5a3290[_0xf851('0x1d')](_0x217a4c);return _0x5a3290['set'](_0xf851('0x23'),_0x3b4969+'-'+_0x35520f+'/'+_0x56cc50)[_0xf851('0x1e')](_0x5b7b09);}return null;};}function patchUpdates(_0x4ac1ae){return function(_0xa5100c){try{jsonpatch[_0xf851('0x24')](_0xa5100c,_0x4ac1ae,!![]);}catch(_0x10b1b9){return BPromise['reject'](_0x10b1b9);}return _0xa5100c[_0xf851('0x25')]();};}function saveUpdates(_0x501acb,_0x541d90){return function(_0xe8e011){if(_0xe8e011){return _0xe8e011['update'](_0x501acb)[_0xf851('0x26')](function(_0x2d26cc){return _0x2d26cc;});}return null;};}function removeEntity(_0x1c43ad,_0x3e7b74){return function(_0x53c200){if(_0x53c200){return _0x53c200[_0xf851('0x27')]()['then'](function(){var _0x23f06b=_0x53c200[_0xf851('0x28')]({'plain':!![]});var _0x61c09=_0xf851('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x61c09,'resourceId':_0x23f06b['id']}})[_0xf851('0x26')](function(){return _0x53c200;});})[_0xf851('0x26')](function(){_0x1c43ad[_0xf851('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5edfeb,_0x776fa8){return function(_0x21664f){if(!_0x21664f){_0x5edfeb[_0xf851('0x1c')](0x194);}return _0x21664f;};}function handleError(_0xc56115,_0x533dc7){_0x533dc7=_0x533dc7||0x1f4;return function(_0xceaf80){logger['error'](_0xceaf80[_0xf851('0x2a')]);if(_0xceaf80['name']){delete _0xceaf80[_0xf851('0x2b')];}_0xc56115['status'](_0x533dc7)[_0xf851('0x2c')](_0xceaf80);};}exports[_0xf851('0x2d')]=function(_0x5f498e,_0x5a86b1){var _0x5bbd63={},_0xae6012={},_0x4dddaa={'count':0x0,'rows':[]};var _0x357be0=_[_0xf851('0x2e')](db['MailQueue']['rawAttributes'],function(_0x1b45ef){return{'name':_0x1b45ef['fieldName'],'type':_0x1b45ef[_0xf851('0x2f')]['key']};});_0xae6012[_0xf851('0x30')]=_[_0xf851('0x2e')](_0x357be0,_0xf851('0x2b'));_0xae6012['query']=_['keys'](_0x5f498e[_0xf851('0x31')]);_0xae6012[_0xf851('0x32')]=_['intersection'](_0xae6012[_0xf851('0x30')],_0xae6012[_0xf851('0x31')]);_0x5bbd63[_0xf851('0x33')]=_['intersection'](_0xae6012[_0xf851('0x30')],qs['fields'](_0x5f498e[_0xf851('0x31')][_0xf851('0x34')]));_0x5bbd63['attributes']=_0x5bbd63[_0xf851('0x33')][_0xf851('0x35')]?_0x5bbd63[_0xf851('0x33')]:_0xae6012[_0xf851('0x30')];if(!_0x5f498e['query'][_0xf851('0x36')](_0xf851('0x37'))){_0x5bbd63['limit']=qs[_0xf851('0x21')](_0x5f498e[_0xf851('0x31')][_0xf851('0x21')]);_0x5bbd63[_0xf851('0x1f')]=qs['offset'](_0x5f498e['query']['offset']);}_0x5bbd63[_0xf851('0x38')]=qs[_0xf851('0x39')](_0x5f498e[_0xf851('0x31')][_0xf851('0x39')]);_0x5bbd63[_0xf851('0x3a')]=qs[_0xf851('0x32')](_[_0xf851('0x3b')](_0x5f498e['query'],_0xae6012[_0xf851('0x32')]),_0x357be0);if(_0x5f498e[_0xf851('0x31')][_0xf851('0x3c')]){_0x5bbd63[_0xf851('0x3a')]=_['merge'](_0x5bbd63['where'],{'$or':_[_0xf851('0x2e')](_0x357be0,function(_0x475de0){if(_0x475de0[_0xf851('0x2f')]!==_0xf851('0x3d')){var _0x352301={};_0x352301[_0x475de0['name']]={'$like':'%'+_0x5f498e[_0xf851('0x31')][_0xf851('0x3c')]+'%'};return _0x352301;}})});}_0x5bbd63=_['merge']({},_0x5bbd63,_0x5f498e[_0xf851('0x3e')]);var _0x5089df={'where':_0x5bbd63[_0xf851('0x3a')]};return db['MailQueue'][_0xf851('0x22')](_0x5089df)['then'](function(_0x287173){_0x4dddaa[_0xf851('0x22')]=_0x287173;if(_0x5f498e[_0xf851('0x31')]['includeAll']){_0x5bbd63[_0xf851('0x3f')]=[{'all':!![]}];}return db[_0xf851('0x40')][_0xf851('0x41')](_0x5bbd63);})[_0xf851('0x26')](function(_0x23da4c){_0x4dddaa[_0xf851('0x42')]=_0x23da4c;return _0x4dddaa;})['then'](respondWithFilteredResult(_0x5a86b1,_0x5bbd63))[_0xf851('0x43')](handleError(_0x5a86b1,null));};exports[_0xf851('0x44')]=function(_0x492cf9,_0x125ce4){var _0x4850e2={'raw':!![],'where':{'id':_0x492cf9[_0xf851('0x45')]['id']}},_0x39b530={};_0x39b530[_0xf851('0x30')]=_[_0xf851('0x46')](db[_0xf851('0x40')]['rawAttributes']);_0x39b530[_0xf851('0x31')]=_[_0xf851('0x46')](_0x492cf9[_0xf851('0x31')]);_0x39b530[_0xf851('0x32')]=_['intersection'](_0x39b530[_0xf851('0x30')],_0x39b530[_0xf851('0x31')]);_0x4850e2[_0xf851('0x33')]=_[_0xf851('0x47')](_0x39b530[_0xf851('0x30')],qs['fields'](_0x492cf9[_0xf851('0x31')][_0xf851('0x34')]));_0x4850e2[_0xf851('0x33')]=_0x4850e2[_0xf851('0x33')][_0xf851('0x35')]?_0x4850e2[_0xf851('0x33')]:_0x39b530[_0xf851('0x30')];if(_0x492cf9[_0xf851('0x31')][_0xf851('0x48')]){_0x4850e2[_0xf851('0x3f')]=[{'all':!![]}];}_0x4850e2=_[_0xf851('0x49')]({},_0x4850e2,_0x492cf9['options']);return db[_0xf851('0x40')]['find'](_0x4850e2)[_0xf851('0x26')](handleEntityNotFound(_0x125ce4,null))[_0xf851('0x26')](respondWithResult(_0x125ce4,null))[_0xf851('0x43')](handleError(_0x125ce4,null));};exports[_0xf851('0x4a')]=function(_0x1ad82e,_0x591a38){return db[_0xf851('0x40')]['create'](_0x1ad82e[_0xf851('0x4b')],{})[_0xf851('0x26')](function(_0x53a9da){var _0x68be30=_0x1ad82e[_0xf851('0x4c')][_0xf851('0x28')]({'plain':!![]});if(!_0x68be30)throw new Error(_0xf851('0x4d'));if(_0x68be30[_0xf851('0x4e')]===_0xf851('0x4c')){var _0x29909e=_0x53a9da['get']({'plain':!![]});var _0x353b00='MailQueues';return db[_0xf851('0x4f')]['find']({'where':{'name':_0x353b00,'userProfileId':_0x68be30[_0xf851('0x50')]},'raw':!![]})[_0xf851('0x26')](function(_0x1dc12){if(_0x1dc12&&_0x1dc12[_0xf851('0x51')]===0x0){return db['UserProfileResource'][_0xf851('0x4a')]({'name':_0x29909e['name'],'resourceId':_0x29909e['id'],'type':_0x1dc12[_0xf851('0x2b')],'sectionId':_0x1dc12['id']},{})[_0xf851('0x26')](function(){return _0x53a9da;});}else{return _0x53a9da;}})[_0xf851('0x43')](function(_0x7e59cc){logger[_0xf851('0x52')](_0xf851('0x53'),_0x7e59cc);throw _0x7e59cc;});}return _0x53a9da;})[_0xf851('0x26')](respondWithResult(_0x591a38,0xc9))['catch'](handleError(_0x591a38,null));};exports['update']=function(_0x588da6,_0x42b807){if(_0x588da6[_0xf851('0x4b')]['id']){delete _0x588da6['body']['id'];}return db['MailQueue'][_0xf851('0x54')]({'where':{'id':_0x588da6[_0xf851('0x45')]['id']}})[_0xf851('0x26')](handleEntityNotFound(_0x42b807,null))['then'](saveUpdates(_0x588da6[_0xf851('0x4b')],null))[_0xf851('0x26')](respondWithResult(_0x42b807,null))['catch'](handleError(_0x42b807,null));};exports[_0xf851('0x27')]=function(_0x537d86,_0x13760b){return db[_0xf851('0x40')][_0xf851('0x54')]({'where':{'id':_0x537d86['params']['id']}})[_0xf851('0x26')](handleEntityNotFound(_0x13760b,null))[_0xf851('0x26')](removeEntity(_0x13760b,null))[_0xf851('0x43')](handleError(_0x13760b,null));};exports[_0xf851('0x55')]=function(_0x23b27a,_0x58f62a){return db['MailQueue'][_0xf851('0x55')]()['then'](respondWithResult(_0x58f62a,null))[_0xf851('0x43')](handleError(_0x58f62a,null));};exports[_0xf851('0x56')]=function(_0x2e6251,_0x2e6a3c,_0x129d50){var _0x7d1b1c={'raw':!![],'where':{}},_0x172c48={},_0x535d53;return db[_0xf851('0x40')][_0xf851('0x57')]({'where':{'id':_0x2e6251[_0xf851('0x45')]['id']}})[_0xf851('0x26')](handleEntityNotFound(_0x2e6a3c,null))[_0xf851('0x26')](function(_0xc2d513){if(_0xc2d513){_0x535d53=_0xc2d513[_0xf851('0x28')]({'plain':!![]});_0x172c48[_0xf851('0x30')]=_[_0xf851('0x46')](db['UserMailQueue'][_0xf851('0x58')]);_0x172c48[_0xf851('0x31')]=_[_0xf851('0x46')](_0x2e6251['query']);_0x172c48[_0xf851('0x32')]=_[_0xf851('0x47')](_0x172c48[_0xf851('0x30')],_0x172c48[_0xf851('0x31')]);_0x7d1b1c[_0xf851('0x33')]=_[_0xf851('0x47')](_0x172c48['model'],qs['fields'](_0x2e6251[_0xf851('0x31')]['fields']));_0x7d1b1c['attributes']=_0x7d1b1c[_0xf851('0x33')]['length']?_0x7d1b1c[_0xf851('0x33')]:_0x172c48[_0xf851('0x30')];if(!_0x2e6251[_0xf851('0x31')][_0xf851('0x36')](_0xf851('0x37'))){_0x7d1b1c[_0xf851('0x21')]=qs['limit'](_0x2e6251[_0xf851('0x31')][_0xf851('0x21')]);_0x7d1b1c[_0xf851('0x1f')]=qs['offset'](_0x2e6251[_0xf851('0x31')][_0xf851('0x1f')]);}_0x7d1b1c['order']=qs['sort'](_0x2e6251[_0xf851('0x31')][_0xf851('0x39')]);_0x7d1b1c[_0xf851('0x3a')]=qs[_0xf851('0x32')](_[_0xf851('0x3b')](_0x2e6251[_0xf851('0x31')],_0x172c48[_0xf851('0x32')]));_0x7d1b1c['where'][_0xf851('0x59')]=_0xc2d513['id'];if(_0x2e6251[_0xf851('0x31')][_0xf851('0x3c')]){_0x7d1b1c[_0xf851('0x3a')]=_[_0xf851('0x49')](_0x7d1b1c[_0xf851('0x3a')],{'$or':_[_0xf851('0x2e')](_0x7d1b1c['attributes'],function(_0x38f4f0){var _0x574a5d={};_0x574a5d[_0x38f4f0]={'$like':'%'+_0x2e6251[_0xf851('0x31')][_0xf851('0x3c')]+'%'};return _0x574a5d;})});}_0x7d1b1c=_[_0xf851('0x49')]({},_0x7d1b1c,_0x2e6251[_0xf851('0x3e')]);return db['UserMailQueue'][_0xf851('0x41')](_0x7d1b1c);}})[_0xf851('0x26')](function(_0x36e0e7){if(_0x36e0e7){return db[_0xf851('0x5a')]['findAndCountAll']({'where':{'id':_['map'](_0x36e0e7,_0xf851('0x5b')),'role':'agent'},'attributes':['id',_0xf851('0x2b'),_0xf851('0x5c'),_0xf851('0x5d'),_0xf851('0x5e')]});}})[_0xf851('0x26')](function(_0x848ce5){if(_0x848ce5){return{'count':_0x848ce5['count'],'rows':_[_0xf851('0x2e')](_0x848ce5[_0xf851('0x42')],function(_0x262a66){return{'membername':_0x262a66[_0xf851('0x2b')],'UserId':_0x262a66['id'],'queue_name':_0x535d53[_0xf851('0x2b')],'MailQueueId':_0x535d53['id'],'interface':util[_0xf851('0x5f')](_0xf851('0x60'),'SIP',_0x262a66[_0xf851('0x2b')]),'penalty':0x0,'paused':_0x262a66[_0xf851('0x5c')],'createdAt':_0x262a66[_0xf851('0x5e')],'updatedAt':_0x262a66[_0xf851('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf851('0x26')](respondWithFilteredResult(_0x2e6a3c,_0x7d1b1c))[_0xf851('0x43')](handleError(_0x2e6a3c,null));};exports[_0xf851('0x61')]=function(_0x32de26,_0x5a886e,_0x119512){var _0x52ce5e={};var _0x100726={};var _0x32425b;var _0xe9a3f0;return db[_0xf851('0x40')][_0xf851('0x57')]({'where':{'id':_0x32de26[_0xf851('0x45')]['id']}})['then'](handleEntityNotFound(_0x5a886e,null))[_0xf851('0x26')](function(_0x28fa25){if(_0x28fa25){_0x32425b=_0x28fa25;_0x100726[_0xf851('0x30')]=_[_0xf851('0x46')](db[_0xf851('0x62')][_0xf851('0x58')]);_0x100726[_0xf851('0x31')]=_[_0xf851('0x46')](_0x32de26[_0xf851('0x31')]);_0x100726[_0xf851('0x32')]=_[_0xf851('0x47')](_0x100726['model'],_0x100726['query']);_0x52ce5e[_0xf851('0x33')]=_[_0xf851('0x47')](_0x100726['model'],qs[_0xf851('0x34')](_0x32de26[_0xf851('0x31')]['fields']));_0x52ce5e['attributes']=_0x52ce5e['attributes']['length']?_0x52ce5e[_0xf851('0x33')]:_0x100726[_0xf851('0x30')];_0x52ce5e[_0xf851('0x38')]=qs[_0xf851('0x39')](_0x32de26[_0xf851('0x31')]['sort']);_0x52ce5e[_0xf851('0x3a')]=qs[_0xf851('0x32')](_[_0xf851('0x3b')](_0x32de26[_0xf851('0x31')],_0x100726[_0xf851('0x32')]));if(_0x32de26[_0xf851('0x31')]['filter']){_0x52ce5e['where']=_[_0xf851('0x49')](_0x52ce5e['where'],{'$or':_['map'](_0x52ce5e[_0xf851('0x33')],function(_0x1783fc){var _0x142ceb={};_0x142ceb[_0x1783fc]={'$like':'%'+_0x32de26[_0xf851('0x31')][_0xf851('0x3c')]+'%'};return _0x142ceb;})});}_0x52ce5e=_[_0xf851('0x49')]({},_0x52ce5e,_0x32de26[_0xf851('0x3e')]);return _0x32425b[_0xf851('0x61')](_0x52ce5e);}})[_0xf851('0x26')](function(_0x301e68){if(_0x301e68){_0xe9a3f0=_0x301e68[_0xf851('0x35')];if(!_0x32de26['query']['hasOwnProperty'](_0xf851('0x37'))){_0x52ce5e['limit']=qs[_0xf851('0x21')](_0x32de26[_0xf851('0x31')][_0xf851('0x21')]);_0x52ce5e['offset']=qs['offset'](_0x32de26[_0xf851('0x31')]['offset']);}return _0x32425b['getTeams'](_0x52ce5e);}})[_0xf851('0x26')](function(_0x535262){if(_0x535262){return _0x535262?{'count':_0xe9a3f0,'rows':_0x535262}:null;}})[_0xf851('0x26')](respondWithResult(_0x5a886e,null))[_0xf851('0x43')](handleError(_0x5a886e,null));};exports[_0xf851('0x63')]=function(_0x10ea6d,_0x25b7c1,_0x2f8800){var _0x2bc851=_0x10ea6d['body'][_0xf851('0x64')];return db[_0xf851('0x62')][_0xf851('0x41')]({'where':{'id':_0x2bc851},'attributes':['id'],'include':[{'model':db[_0xf851('0x5a')],'as':_0xf851('0x65'),'attributes':['id',_0xf851('0x2b'),_0xf851('0x66'),_0xf851('0x67'),'interface'],'raw':!![]}]})['then'](function(_0x5cd78a){if(_0x5cd78a){var _0x9b696f=_[_0xf851('0x68')](_0x5cd78a,function(_0x4e89fe){var _0x3d69fc=_0x4e89fe['get']({'plain':!![]});return _0x3d69fc[_0xf851('0x65')];});return db['MailQueue'][_0xf851('0x54')]({'where':{'id':_0x10ea6d[_0xf851('0x45')]['id']}})[_0xf851('0x26')](function(_0x3d9e7c){return db[_0xf851('0x69')][_0xf851('0x6a')](function(_0x4b66fe){return _0x3d9e7c[_0xf851('0x63')](_0x2bc851,{'transaction':_0x4b66fe})[_0xf851('0x26')](function(){return BPromise[_0xf851('0x6b')](_0x9b696f,function(_0x47017c){return db[_0xf851('0x6c')][_0xf851('0x6d')]({'where':{'UserId':_0x47017c['id'],'MailQueueId':_0x10ea6d[_0xf851('0x45')]['id']},'transaction':_0x4b66fe});});})[_0xf851('0x26')](function(){_0x9b696f[_0xf851('0x6e')](function(_0x5c02e0){socket['emit'](_0xf851('0x6f'),{'UserId':_0x5c02e0['id'],'MailQueueId':_0x3d9e7c['id']});});});});});}})['then'](respondWithStatusCode(_0x25b7c1,null))[_0xf851('0x43')](handleError(_0x25b7c1,null));};exports[_0xf851('0x70')]=function(_0x138a9b,_0x5563f6,_0x1b54ee){return db['Team'][_0xf851('0x41')]({'where':{'id':_0x138a9b[_0xf851('0x31')][_0xf851('0x64')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xf851('0x65'),'attributes':['id'],'raw':!![]}]})[_0xf851('0x26')](handleEntityNotFound(_0x5563f6,null))['then'](function(_0x3f8157){var _0x6fed8b=_[_0xf851('0x2e')](_0x3f8157,'id');var _0x4bf006=[];var _0x351ba7=[];var _0x108940=squel[_0xf851('0x71')]();_0x108940[_0xf851('0x72')](_0xf851('0x73'))[_0xf851('0x74')]('team_has_mail_queues','tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xf851('0x3a')]('MailQueueId\x20=\x20?',_0x138a9b[_0xf851('0x45')]['id']);for(var _0xcd8cd6=0x0;_0xcd8cd6<_0x3f8157[_0xf851('0x35')];_0xcd8cd6+=0x1){let _0x4f5d3e=_0x3f8157[_0xcd8cd6];for(var _0x2ae14c=0x0;_0x2ae14c<_0x4f5d3e[_0xf851('0x65')][_0xf851('0x35')];_0x2ae14c+=0x1){let _0x237326=_0x4f5d3e[_0xf851('0x65')][_0x2ae14c];var _0x5adbc8=_0x108940['clone']();_0x5adbc8[_0xf851('0x3a')](_0xf851('0x75'),_0x237326['id']);_0x351ba7[_0xf851('0x76')](db[_0xf851('0x69')][_0xf851('0x31')](_0x5adbc8[_0xf851('0x77')](),{'type':db[_0xf851('0x69')][_0xf851('0x78')]['SELECT']})['then'](function(_0x538ab8){if(_0x538ab8[_0xf851('0x35')]===0x1){return _0x237326['id'];}else{var _0x3e456b=_[_0xf851('0x79')](_[_0xf851('0x2e')](_0x538ab8,_0xf851('0x7a')),function(_0x30236b){return _[_0xf851('0x7b')](_0x6fed8b,_0x30236b);});if(_0x3e456b){return _0x237326['id'];}}}));}}return BPromise[_0xf851('0x7c')](_0x351ba7)[_0xf851('0x26')](function(_0x6ae4){_0x4bf006=_(_0x4bf006)[_0xf851('0x7d')](_0x6ae4)[_0xf851('0x7e')]()[_0xf851('0x7f')]();return db[_0xf851('0x40')][_0xf851('0x54')]({'where':{'id':_0x138a9b[_0xf851('0x45')]['id']}})[_0xf851('0x26')](function(_0x5d606b){return db[_0xf851('0x69')]['transaction'](function(_0x1602a9){return _0x5d606b[_0xf851('0x70')](_0x138a9b['query']['ids'],{'transaction':_0x1602a9})[_0xf851('0x26')](function(){if(!_[_0xf851('0x80')](_0x4bf006)){return _0x5d606b[_0xf851('0x81')](_0x4bf006,{'transaction':_0x1602a9});}})[_0xf851('0x26')](function(){_0x4bf006[_0xf851('0x6e')](function(_0x4939e6){socket[_0xf851('0x82')](_0xf851('0x83'),{'UserId':_0x4939e6,'MailQueueId':_0x5d606b['id']});});});});});});})['then'](respondWithStatusCode(_0x5563f6,null))['catch'](handleError(_0x5563f6,null));};exports[_0xf851('0x84')]=function(_0x409c2e,_0x78164e,_0x456788){return db[_0xf851('0x40')]['find']({'where':{'id':_0x409c2e[_0xf851('0x45')]['id']}})[_0xf851('0x26')](handleEntityNotFound(_0x78164e,null))[_0xf851('0x26')](function(_0x50fe17){if(_0x50fe17){return _0x50fe17[_0xf851('0x84')](_0x409c2e[_0xf851('0x4b')][_0xf851('0x64')],_[_0xf851('0x85')](_0x409c2e['body'],[_0xf851('0x64'),'id'])||{})[_0xf851('0x86')](function(_0x58cf0e){for(var _0x2f8671=0x0;_0x2f8671<_0x409c2e[_0xf851('0x4b')][_0xf851('0x64')][_0xf851('0x35')];_0x2f8671+=0x1){socket['emit']('userMailQueue:save',{'UserId':Number(_0x409c2e[_0xf851('0x4b')][_0xf851('0x64')][_0x2f8671]),'MailQueueId':Number(_0x409c2e[_0xf851('0x45')]['id'])});}return _0x58cf0e;});}})['then'](respondWithResult(_0x78164e,null))[_0xf851('0x43')](handleError(_0x78164e,null));};exports[_0xf851('0x81')]=function(_0x12affe,_0x2c6d43,_0x244de9){return db['MailQueue'][_0xf851('0x54')]({'where':{'id':_0x12affe['params']['id']}})[_0xf851('0x26')](handleEntityNotFound(_0x2c6d43,null))[_0xf851('0x26')](function(_0x33dd2b){if(_0x33dd2b){return _0x33dd2b['removeAgents'](_0x12affe[_0xf851('0x31')][_0xf851('0x64')])[_0xf851('0x26')](function(){if(_[_0xf851('0x87')](_0x12affe['query']['ids'])){for(var _0x6c0e89=0x0;_0x6c0e89<_0x12affe['query'][_0xf851('0x64')][_0xf851('0x35')];_0x6c0e89+=0x1){socket['emit'](_0xf851('0x83'),{'UserId':Number(_0x12affe[_0xf851('0x31')][_0xf851('0x64')][_0x6c0e89]),'MailQueueId':Number(_0x12affe[_0xf851('0x45')]['id'])});}}else{socket[_0xf851('0x82')](_0xf851('0x83'),{'UserId':Number(_0x12affe[_0xf851('0x31')][_0xf851('0x64')]),'MailQueueId':Number(_0x12affe[_0xf851('0x45')]['id'])});}});}})['then'](respondWithStatusCode(_0x2c6d43,null))[_0xf851('0x43')](handleError(_0x2c6d43,null));};exports[_0xf851('0x88')]=function(_0x2ca11c,_0x20ceb7,_0xd2e90a){var _0x54e3e0={};var _0x1dcef4={};var _0x408777;var _0x1fef98;return db[_0xf851('0x40')]['findOne']({'where':{'id':_0x2ca11c[_0xf851('0x45')]['id']}})[_0xf851('0x26')](handleEntityNotFound(_0x20ceb7,null))[_0xf851('0x26')](function(_0x412c9d){if(_0x412c9d){_0x408777=_0x412c9d;_0x1dcef4[_0xf851('0x30')]=_[_0xf851('0x46')](db[_0xf851('0x5a')][_0xf851('0x58')]);_0x1dcef4[_0xf851('0x31')]=_['keys'](_0x2ca11c[_0xf851('0x31')]);_0x1dcef4['filters']=_[_0xf851('0x47')](_0x1dcef4[_0xf851('0x30')],_0x1dcef4[_0xf851('0x31')]);_0x54e3e0[_0xf851('0x33')]=_[_0xf851('0x47')](_0x1dcef4[_0xf851('0x30')],qs['fields'](_0x2ca11c[_0xf851('0x31')][_0xf851('0x34')]));_0x54e3e0['attributes']=_0x54e3e0[_0xf851('0x33')][_0xf851('0x35')]?_0x54e3e0[_0xf851('0x33')]:_0x1dcef4[_0xf851('0x30')];_0x54e3e0['order']=qs[_0xf851('0x39')](_0x2ca11c[_0xf851('0x31')][_0xf851('0x39')]);_0x54e3e0[_0xf851('0x3a')]=qs[_0xf851('0x32')](_[_0xf851('0x3b')](_0x2ca11c['query'],_0x1dcef4['filters']));if(_0x2ca11c[_0xf851('0x31')][_0xf851('0x3c')]){_0x54e3e0[_0xf851('0x3a')]=_[_0xf851('0x49')](_0x54e3e0[_0xf851('0x3a')],{'$or':_[_0xf851('0x2e')](_0x54e3e0[_0xf851('0x33')],function(_0xe0df8f){var _0xf8b5d={};_0xf8b5d[_0xe0df8f]={'$like':'%'+_0x2ca11c['query']['filter']+'%'};return _0xf8b5d;})});}_0x54e3e0=_[_0xf851('0x49')]({},_0x54e3e0,_0x2ca11c['options']);return _0x408777[_0xf851('0x88')](_0x54e3e0);}})[_0xf851('0x26')](function(_0x3adcae){if(_0x3adcae){_0x1fef98=_0x3adcae[_0xf851('0x35')];if(!_0x2ca11c[_0xf851('0x31')][_0xf851('0x36')](_0xf851('0x37'))){_0x54e3e0[_0xf851('0x21')]=qs['limit'](_0x2ca11c[_0xf851('0x31')][_0xf851('0x21')]);_0x54e3e0['offset']=qs[_0xf851('0x1f')](_0x2ca11c[_0xf851('0x31')][_0xf851('0x1f')]);}return _0x408777[_0xf851('0x88')](_0x54e3e0);}})[_0xf851('0x26')](function(_0x4dbc55){if(_0x4dbc55){return _0x4dbc55?{'count':_0x1fef98,'rows':_0x4dbc55}:null;}})[_0xf851('0x26')](respondWithResult(_0x20ceb7,null))[_0xf851('0x43')](handleError(_0x20ceb7,null));}; \ No newline at end of file +var _0x5bc5=['sequelize','transaction','findOrCreate','forEach','emit','userMailQueue:save','Team','select','field','tq.TeamId','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','removeTeams','isEmpty','addAgents','omit','spread','isArray','userMailQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','register','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','destroy','get','MailQueues','end','stack','name','send','map','MailQueue','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','MailQueueId','User','findAndCountAll','UserId','mailPause','createdAt','format','SIP','updatedAt','nolimit','getTeams','addTeams','ids','Agents','online','voicePause','flatMap'];(function(_0x523ff8,_0x28fb8e){var _0x1b7b7e=function(_0x57d15b){while(--_0x57d15b){_0x523ff8['push'](_0x523ff8['shift']());}};_0x1b7b7e(++_0x28fb8e);}(_0x5bc5,0xb2));var _0x55bc=function(_0x51d129,_0x175d7d){_0x51d129=_0x51d129-0x0;var _0x44c377=_0x5bc5[_0x51d129];return _0x44c377;};'use strict';var emlformat=require(_0x55bc('0x0'));var rimraf=require(_0x55bc('0x1'));var zipdir=require(_0x55bc('0x2'));var jsonpatch=require(_0x55bc('0x3'));var rp=require(_0x55bc('0x4'));var moment=require(_0x55bc('0x5'));var BPromise=require(_0x55bc('0x6'));var Mustache=require(_0x55bc('0x7'));var util=require(_0x55bc('0x8'));var path=require(_0x55bc('0x9'));var sox=require(_0x55bc('0xa'));var csv=require(_0x55bc('0xb'));var ejs=require(_0x55bc('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x55bc('0xd'));var squel=require(_0x55bc('0xe'));var crypto=require(_0x55bc('0xf'));var jsforce=require(_0x55bc('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x55bc('0xb'));var querystring=require(_0x55bc('0x11'));var Papa=require(_0x55bc('0x12'));var Redis=require(_0x55bc('0x13'));var authService=require(_0x55bc('0x14'));var qs=require(_0x55bc('0x15'));var as=require(_0x55bc('0x16'));var hardwareService=require(_0x55bc('0x17'));var logger=require('../../config/logger')(_0x55bc('0x18'));var utils=require(_0x55bc('0x19'));var config=require(_0x55bc('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x55bc('0x1b'))['db'];config['redis']=_[_0x55bc('0x1c')](config[_0x55bc('0x1d')],{'host':_0x55bc('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x55bc('0x1d')]));require('./mailQueue.socket')[_0x55bc('0x1f')](socket);function respondWithStatusCode(_0x234576,_0x15ce6c){_0x15ce6c=_0x15ce6c||0xcc;return function(_0x517a01){if(_0x517a01){return _0x234576[_0x55bc('0x20')](_0x15ce6c);}return _0x234576[_0x55bc('0x21')](_0x15ce6c)['end']();};}function respondWithResult(_0x5c0547,_0x4754cd){_0x4754cd=_0x4754cd||0xc8;return function(_0x4c36a2){if(_0x4c36a2){return _0x5c0547['status'](_0x4754cd)[_0x55bc('0x22')](_0x4c36a2);}};}function respondWithFilteredResult(_0x184518,_0x23af67){return function(_0x4e1764){if(_0x4e1764){var _0xed8b9e=typeof _0x23af67[_0x55bc('0x23')]===_0x55bc('0x24')&&typeof _0x23af67['limit']===_0x55bc('0x24');var _0x5e7cae=_0x4e1764[_0x55bc('0x25')];var _0x4a4d0d=_0xed8b9e?0x0:_0x23af67['offset'];var _0x1cf770=_0xed8b9e?_0x4e1764[_0x55bc('0x25')]:_0x23af67[_0x55bc('0x23')]+_0x23af67['limit'];var _0x5b1960;if(_0x1cf770>=_0x5e7cae){_0x1cf770=_0x5e7cae;_0x5b1960=0xc8;}else{_0x5b1960=0xce;}_0x184518['status'](_0x5b1960);return _0x184518[_0x55bc('0x26')](_0x55bc('0x27'),_0x4a4d0d+'-'+_0x1cf770+'/'+_0x5e7cae)['json'](_0x4e1764);}return null;};}function patchUpdates(_0x54a473){return function(_0x384433){try{jsonpatch[_0x55bc('0x28')](_0x384433,_0x54a473,!![]);}catch(_0x1f2135){return BPromise[_0x55bc('0x29')](_0x1f2135);}return _0x384433['save']();};}function saveUpdates(_0x21a3be,_0x4f65cd){return function(_0x540d89){if(_0x540d89){return _0x540d89[_0x55bc('0x2a')](_0x21a3be)[_0x55bc('0x2b')](function(_0x229834){return _0x229834;});}return null;};}function removeEntity(_0x3a1c6e,_0x293bee){return function(_0x5d2334){if(_0x5d2334){return _0x5d2334[_0x55bc('0x2c')]()[_0x55bc('0x2b')](function(){var _0xa649a3=_0x5d2334[_0x55bc('0x2d')]({'plain':!![]});var _0x2d1735=_0x55bc('0x2e');return db['UserProfileResource'][_0x55bc('0x2c')]({'where':{'type':_0x2d1735,'resourceId':_0xa649a3['id']}})[_0x55bc('0x2b')](function(){return _0x5d2334;});})[_0x55bc('0x2b')](function(){_0x3a1c6e[_0x55bc('0x21')](0xcc)[_0x55bc('0x2f')]();});}};}function handleEntityNotFound(_0x1dce47,_0x1268ac){return function(_0x29cf97){if(!_0x29cf97){_0x1dce47[_0x55bc('0x20')](0x194);}return _0x29cf97;};}function handleError(_0x409295,_0x257cd0){_0x257cd0=_0x257cd0||0x1f4;return function(_0x2cb696){logger['error'](_0x2cb696[_0x55bc('0x30')]);if(_0x2cb696[_0x55bc('0x31')]){delete _0x2cb696[_0x55bc('0x31')];}_0x409295[_0x55bc('0x21')](_0x257cd0)[_0x55bc('0x32')](_0x2cb696);};}exports['index']=function(_0x317bca,_0x412d57){var _0x3e4c8d={},_0x206b54={},_0x419bc7={'count':0x0,'rows':[]};var _0x3e35e7=_[_0x55bc('0x33')](db[_0x55bc('0x34')][_0x55bc('0x35')],function(_0x5d6cb3){return{'name':_0x5d6cb3[_0x55bc('0x36')],'type':_0x5d6cb3[_0x55bc('0x37')][_0x55bc('0x38')]};});_0x206b54[_0x55bc('0x39')]=_[_0x55bc('0x33')](_0x3e35e7,_0x55bc('0x31'));_0x206b54[_0x55bc('0x3a')]=_['keys'](_0x317bca[_0x55bc('0x3a')]);_0x206b54[_0x55bc('0x3b')]=_['intersection'](_0x206b54[_0x55bc('0x39')],_0x206b54[_0x55bc('0x3a')]);_0x3e4c8d[_0x55bc('0x3c')]=_[_0x55bc('0x3d')](_0x206b54[_0x55bc('0x39')],qs['fields'](_0x317bca['query'][_0x55bc('0x3e')]));_0x3e4c8d[_0x55bc('0x3c')]=_0x3e4c8d[_0x55bc('0x3c')][_0x55bc('0x3f')]?_0x3e4c8d[_0x55bc('0x3c')]:_0x206b54[_0x55bc('0x39')];if(!_0x317bca[_0x55bc('0x3a')][_0x55bc('0x40')]('nolimit')){_0x3e4c8d[_0x55bc('0x41')]=qs[_0x55bc('0x41')](_0x317bca[_0x55bc('0x3a')]['limit']);_0x3e4c8d['offset']=qs[_0x55bc('0x23')](_0x317bca[_0x55bc('0x3a')][_0x55bc('0x23')]);}_0x3e4c8d[_0x55bc('0x42')]=qs['sort'](_0x317bca[_0x55bc('0x3a')][_0x55bc('0x43')]);_0x3e4c8d[_0x55bc('0x44')]=qs[_0x55bc('0x3b')](_[_0x55bc('0x45')](_0x317bca[_0x55bc('0x3a')],_0x206b54[_0x55bc('0x3b')]),_0x3e35e7);if(_0x317bca[_0x55bc('0x3a')]['filter']){_0x3e4c8d[_0x55bc('0x44')]=_[_0x55bc('0x46')](_0x3e4c8d[_0x55bc('0x44')],{'$or':_[_0x55bc('0x33')](_0x3e35e7,function(_0x488b7b){if(_0x488b7b[_0x55bc('0x37')]!==_0x55bc('0x47')){var _0x41fe20={};_0x41fe20[_0x488b7b['name']]={'$like':'%'+_0x317bca[_0x55bc('0x3a')][_0x55bc('0x48')]+'%'};return _0x41fe20;}})});}_0x3e4c8d=_['merge']({},_0x3e4c8d,_0x317bca[_0x55bc('0x49')]);var _0x464f05={'where':_0x3e4c8d[_0x55bc('0x44')]};return db[_0x55bc('0x34')][_0x55bc('0x25')](_0x464f05)[_0x55bc('0x2b')](function(_0x402053){_0x419bc7['count']=_0x402053;if(_0x317bca[_0x55bc('0x3a')][_0x55bc('0x4a')]){_0x3e4c8d[_0x55bc('0x4b')]=[{'all':!![]}];}return db['MailQueue'][_0x55bc('0x4c')](_0x3e4c8d);})[_0x55bc('0x2b')](function(_0x4a904d){_0x419bc7[_0x55bc('0x4d')]=_0x4a904d;return _0x419bc7;})['then'](respondWithFilteredResult(_0x412d57,_0x3e4c8d))[_0x55bc('0x4e')](handleError(_0x412d57,null));};exports['show']=function(_0x54cf96,_0x38d142){var _0x4cc81e={'raw':!![],'where':{'id':_0x54cf96[_0x55bc('0x4f')]['id']}},_0x27b533={};_0x27b533[_0x55bc('0x39')]=_[_0x55bc('0x50')](db['MailQueue']['rawAttributes']);_0x27b533['query']=_['keys'](_0x54cf96[_0x55bc('0x3a')]);_0x27b533[_0x55bc('0x3b')]=_['intersection'](_0x27b533[_0x55bc('0x39')],_0x27b533[_0x55bc('0x3a')]);_0x4cc81e[_0x55bc('0x3c')]=_[_0x55bc('0x3d')](_0x27b533['model'],qs[_0x55bc('0x3e')](_0x54cf96[_0x55bc('0x3a')][_0x55bc('0x3e')]));_0x4cc81e[_0x55bc('0x3c')]=_0x4cc81e[_0x55bc('0x3c')]['length']?_0x4cc81e[_0x55bc('0x3c')]:_0x27b533[_0x55bc('0x39')];if(_0x54cf96[_0x55bc('0x3a')][_0x55bc('0x4a')]){_0x4cc81e[_0x55bc('0x4b')]=[{'all':!![]}];}_0x4cc81e=_[_0x55bc('0x46')]({},_0x4cc81e,_0x54cf96[_0x55bc('0x49')]);return db['MailQueue'][_0x55bc('0x51')](_0x4cc81e)[_0x55bc('0x2b')](handleEntityNotFound(_0x38d142,null))[_0x55bc('0x2b')](respondWithResult(_0x38d142,null))[_0x55bc('0x4e')](handleError(_0x38d142,null));};exports[_0x55bc('0x52')]=function(_0x4764c0,_0x3f77a8){return db[_0x55bc('0x34')][_0x55bc('0x52')](_0x4764c0[_0x55bc('0x53')],{})[_0x55bc('0x2b')](function(_0x20435a){var _0x1d8d04=_0x4764c0[_0x55bc('0x54')]['get']({'plain':!![]});if(!_0x1d8d04)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1d8d04[_0x55bc('0x55')]===_0x55bc('0x54')){var _0x3de9b4=_0x20435a['get']({'plain':!![]});var _0x42847b='MailQueues';return db[_0x55bc('0x56')]['find']({'where':{'name':_0x42847b,'userProfileId':_0x1d8d04[_0x55bc('0x57')]},'raw':!![]})['then'](function(_0x1ba9f3){if(_0x1ba9f3&&_0x1ba9f3[_0x55bc('0x58')]===0x0){return db[_0x55bc('0x59')]['create']({'name':_0x3de9b4[_0x55bc('0x31')],'resourceId':_0x3de9b4['id'],'type':_0x1ba9f3[_0x55bc('0x31')],'sectionId':_0x1ba9f3['id']},{})[_0x55bc('0x2b')](function(){return _0x20435a;});}else{return _0x20435a;}})[_0x55bc('0x4e')](function(_0x17698c){logger['error'](_0x55bc('0x5a'),_0x17698c);throw _0x17698c;});}return _0x20435a;})['then'](respondWithResult(_0x3f77a8,0xc9))[_0x55bc('0x4e')](handleError(_0x3f77a8,null));};exports[_0x55bc('0x2a')]=function(_0x2d6f82,_0x21cc1c){if(_0x2d6f82[_0x55bc('0x53')]['id']){delete _0x2d6f82[_0x55bc('0x53')]['id'];}return db[_0x55bc('0x34')][_0x55bc('0x51')]({'where':{'id':_0x2d6f82[_0x55bc('0x4f')]['id']}})[_0x55bc('0x2b')](handleEntityNotFound(_0x21cc1c,null))[_0x55bc('0x2b')](saveUpdates(_0x2d6f82[_0x55bc('0x53')],null))[_0x55bc('0x2b')](respondWithResult(_0x21cc1c,null))[_0x55bc('0x4e')](handleError(_0x21cc1c,null));};exports[_0x55bc('0x2c')]=function(_0x48d7d5,_0x1864c0){return db['MailQueue'][_0x55bc('0x51')]({'where':{'id':_0x48d7d5[_0x55bc('0x4f')]['id']}})[_0x55bc('0x2b')](handleEntityNotFound(_0x1864c0,null))[_0x55bc('0x2b')](removeEntity(_0x1864c0,null))[_0x55bc('0x4e')](handleError(_0x1864c0,null));};exports[_0x55bc('0x5b')]=function(_0x4f8327,_0x56daa9){return db[_0x55bc('0x34')][_0x55bc('0x5b')]()[_0x55bc('0x2b')](respondWithResult(_0x56daa9,null))['catch'](handleError(_0x56daa9,null));};exports[_0x55bc('0x5c')]=function(_0x3851a7,_0x52f4a7,_0x3bae37){var _0x244884={'raw':!![],'where':{}},_0x5f43aa={},_0x396eec;return db[_0x55bc('0x34')][_0x55bc('0x5d')]({'where':{'id':_0x3851a7['params']['id']}})[_0x55bc('0x2b')](handleEntityNotFound(_0x52f4a7,null))[_0x55bc('0x2b')](function(_0x4048b3){if(_0x4048b3){_0x396eec=_0x4048b3[_0x55bc('0x2d')]({'plain':!![]});_0x5f43aa[_0x55bc('0x39')]=_[_0x55bc('0x50')](db[_0x55bc('0x5e')][_0x55bc('0x35')]);_0x5f43aa[_0x55bc('0x3a')]=_[_0x55bc('0x50')](_0x3851a7[_0x55bc('0x3a')]);_0x5f43aa[_0x55bc('0x3b')]=_['intersection'](_0x5f43aa[_0x55bc('0x39')],_0x5f43aa['query']);_0x244884['attributes']=_[_0x55bc('0x3d')](_0x5f43aa['model'],qs['fields'](_0x3851a7[_0x55bc('0x3a')][_0x55bc('0x3e')]));_0x244884['attributes']=_0x244884[_0x55bc('0x3c')][_0x55bc('0x3f')]?_0x244884[_0x55bc('0x3c')]:_0x5f43aa[_0x55bc('0x39')];if(!_0x3851a7[_0x55bc('0x3a')][_0x55bc('0x40')]('nolimit')){_0x244884[_0x55bc('0x41')]=qs[_0x55bc('0x41')](_0x3851a7[_0x55bc('0x3a')][_0x55bc('0x41')]);_0x244884[_0x55bc('0x23')]=qs[_0x55bc('0x23')](_0x3851a7[_0x55bc('0x3a')][_0x55bc('0x23')]);}_0x244884['order']=qs[_0x55bc('0x43')](_0x3851a7[_0x55bc('0x3a')][_0x55bc('0x43')]);_0x244884[_0x55bc('0x44')]=qs['filters'](_[_0x55bc('0x45')](_0x3851a7[_0x55bc('0x3a')],_0x5f43aa[_0x55bc('0x3b')]));_0x244884[_0x55bc('0x44')][_0x55bc('0x5f')]=_0x4048b3['id'];if(_0x3851a7[_0x55bc('0x3a')][_0x55bc('0x48')]){_0x244884['where']=_[_0x55bc('0x46')](_0x244884[_0x55bc('0x44')],{'$or':_['map'](_0x244884[_0x55bc('0x3c')],function(_0x11c8db){var _0xf22107={};_0xf22107[_0x11c8db]={'$like':'%'+_0x3851a7[_0x55bc('0x3a')][_0x55bc('0x48')]+'%'};return _0xf22107;})});}_0x244884=_[_0x55bc('0x46')]({},_0x244884,_0x3851a7[_0x55bc('0x49')]);return db[_0x55bc('0x5e')][_0x55bc('0x4c')](_0x244884);}})[_0x55bc('0x2b')](function(_0x2bc00f){if(_0x2bc00f){return db[_0x55bc('0x60')][_0x55bc('0x61')]({'where':{'id':_[_0x55bc('0x33')](_0x2bc00f,_0x55bc('0x62')),'role':'agent'},'attributes':['id',_0x55bc('0x31'),_0x55bc('0x63'),'updatedAt',_0x55bc('0x64')]});}})[_0x55bc('0x2b')](function(_0x19e8d5){if(_0x19e8d5){return{'count':_0x19e8d5['count'],'rows':_['map'](_0x19e8d5['rows'],function(_0x5d4c73){return{'membername':_0x5d4c73[_0x55bc('0x31')],'UserId':_0x5d4c73['id'],'queue_name':_0x396eec[_0x55bc('0x31')],'MailQueueId':_0x396eec['id'],'interface':util[_0x55bc('0x65')]('%s/%s',_0x55bc('0x66'),_0x5d4c73[_0x55bc('0x31')]),'penalty':0x0,'paused':_0x5d4c73[_0x55bc('0x63')],'createdAt':_0x5d4c73[_0x55bc('0x64')],'updatedAt':_0x5d4c73[_0x55bc('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x55bc('0x2b')](respondWithFilteredResult(_0x52f4a7,_0x244884))['catch'](handleError(_0x52f4a7,null));};exports['getTeams']=function(_0x1f9a84,_0x541010,_0x815490){var _0xf00b87={};var _0x4e1fbc={};var _0x3b9fc4;var _0x6c29ea;return db[_0x55bc('0x34')][_0x55bc('0x5d')]({'where':{'id':_0x1f9a84[_0x55bc('0x4f')]['id']}})[_0x55bc('0x2b')](handleEntityNotFound(_0x541010,null))[_0x55bc('0x2b')](function(_0x5eab26){if(_0x5eab26){_0x3b9fc4=_0x5eab26;_0x4e1fbc[_0x55bc('0x39')]=_['keys'](db['Team']['rawAttributes']);_0x4e1fbc[_0x55bc('0x3a')]=_['keys'](_0x1f9a84[_0x55bc('0x3a')]);_0x4e1fbc[_0x55bc('0x3b')]=_['intersection'](_0x4e1fbc['model'],_0x4e1fbc[_0x55bc('0x3a')]);_0xf00b87[_0x55bc('0x3c')]=_[_0x55bc('0x3d')](_0x4e1fbc[_0x55bc('0x39')],qs[_0x55bc('0x3e')](_0x1f9a84[_0x55bc('0x3a')][_0x55bc('0x3e')]));_0xf00b87[_0x55bc('0x3c')]=_0xf00b87[_0x55bc('0x3c')][_0x55bc('0x3f')]?_0xf00b87[_0x55bc('0x3c')]:_0x4e1fbc['model'];_0xf00b87[_0x55bc('0x42')]=qs['sort'](_0x1f9a84[_0x55bc('0x3a')][_0x55bc('0x43')]);_0xf00b87[_0x55bc('0x44')]=qs[_0x55bc('0x3b')](_['pick'](_0x1f9a84[_0x55bc('0x3a')],_0x4e1fbc[_0x55bc('0x3b')]));if(_0x1f9a84[_0x55bc('0x3a')][_0x55bc('0x48')]){_0xf00b87[_0x55bc('0x44')]=_['merge'](_0xf00b87[_0x55bc('0x44')],{'$or':_['map'](_0xf00b87[_0x55bc('0x3c')],function(_0x37fad1){var _0x405dbd={};_0x405dbd[_0x37fad1]={'$like':'%'+_0x1f9a84[_0x55bc('0x3a')][_0x55bc('0x48')]+'%'};return _0x405dbd;})});}_0xf00b87=_[_0x55bc('0x46')]({},_0xf00b87,_0x1f9a84['options']);return _0x3b9fc4['getTeams'](_0xf00b87);}})[_0x55bc('0x2b')](function(_0x322904){if(_0x322904){_0x6c29ea=_0x322904[_0x55bc('0x3f')];if(!_0x1f9a84['query'][_0x55bc('0x40')](_0x55bc('0x68'))){_0xf00b87['limit']=qs[_0x55bc('0x41')](_0x1f9a84[_0x55bc('0x3a')][_0x55bc('0x41')]);_0xf00b87[_0x55bc('0x23')]=qs[_0x55bc('0x23')](_0x1f9a84[_0x55bc('0x3a')][_0x55bc('0x23')]);}return _0x3b9fc4[_0x55bc('0x69')](_0xf00b87);}})[_0x55bc('0x2b')](function(_0x89a067){if(_0x89a067){return _0x89a067?{'count':_0x6c29ea,'rows':_0x89a067}:null;}})[_0x55bc('0x2b')](respondWithResult(_0x541010,null))[_0x55bc('0x4e')](handleError(_0x541010,null));};exports[_0x55bc('0x6a')]=function(_0x11d7ab,_0x1b6ff4,_0x34d8b2){var _0x561d00=_0x11d7ab[_0x55bc('0x53')][_0x55bc('0x6b')];return db['Team'][_0x55bc('0x4c')]({'where':{'id':_0x561d00},'attributes':['id'],'include':[{'model':db[_0x55bc('0x60')],'as':_0x55bc('0x6c'),'attributes':['id',_0x55bc('0x31'),_0x55bc('0x6d'),_0x55bc('0x6e'),'interface'],'raw':!![]}]})[_0x55bc('0x2b')](function(_0x31f6b1){if(_0x31f6b1){var _0x34613d=_[_0x55bc('0x6f')](_0x31f6b1,function(_0x4b4380){var _0x3067ba=_0x4b4380[_0x55bc('0x2d')]({'plain':!![]});return _0x3067ba[_0x55bc('0x6c')];});return db[_0x55bc('0x34')][_0x55bc('0x51')]({'where':{'id':_0x11d7ab['params']['id']}})[_0x55bc('0x2b')](function(_0x5b8d5f){return db[_0x55bc('0x70')][_0x55bc('0x71')](function(_0x953f62){return _0x5b8d5f['addTeams'](_0x561d00,{'transaction':_0x953f62})[_0x55bc('0x2b')](function(){return BPromise['each'](_0x34613d,function(_0x5db0e5){return db[_0x55bc('0x5e')][_0x55bc('0x72')]({'where':{'UserId':_0x5db0e5['id'],'MailQueueId':_0x11d7ab[_0x55bc('0x4f')]['id']},'transaction':_0x953f62});});})[_0x55bc('0x2b')](function(){_0x34613d[_0x55bc('0x73')](function(_0x27fbd3){socket[_0x55bc('0x74')](_0x55bc('0x75'),{'UserId':_0x27fbd3['id'],'MailQueueId':_0x5b8d5f['id']});});});});});}})[_0x55bc('0x2b')](respondWithStatusCode(_0x1b6ff4,null))[_0x55bc('0x4e')](handleError(_0x1b6ff4,null));};exports['removeTeams']=function(_0x3df7a0,_0x40ab81,_0x496737){return db[_0x55bc('0x76')][_0x55bc('0x4c')]({'where':{'id':_0x3df7a0['query'][_0x55bc('0x6b')]},'attributes':['id'],'include':[{'model':db[_0x55bc('0x60')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x55bc('0x2b')](handleEntityNotFound(_0x40ab81,null))[_0x55bc('0x2b')](function(_0x1fa595){var _0xe5dd8b=_[_0x55bc('0x33')](_0x1fa595,'id');var _0x12d895=[];var _0x35553c=[];var _0x3a79cf=squel[_0x55bc('0x77')]();_0x3a79cf[_0x55bc('0x78')](_0x55bc('0x79'))['from'](_0x55bc('0x7a'),'tq')[_0x55bc('0x7b')](_0x55bc('0x7c'),'ut',_0x55bc('0x7d'))[_0x55bc('0x44')]('MailQueueId\x20=\x20?',_0x3df7a0[_0x55bc('0x4f')]['id']);for(var _0x291070=0x0;_0x291070<_0x1fa595[_0x55bc('0x3f')];_0x291070+=0x1){let _0x38b040=_0x1fa595[_0x291070];for(var _0x22cdca=0x0;_0x22cdca<_0x38b040[_0x55bc('0x6c')][_0x55bc('0x3f')];_0x22cdca+=0x1){let _0x5050fe=_0x38b040['Agents'][_0x22cdca];var _0x945366=_0x3a79cf[_0x55bc('0x7e')]();_0x945366[_0x55bc('0x44')](_0x55bc('0x7f'),_0x5050fe['id']);_0x35553c[_0x55bc('0x80')](db[_0x55bc('0x70')][_0x55bc('0x3a')](_0x945366[_0x55bc('0x81')](),{'type':db['sequelize'][_0x55bc('0x82')][_0x55bc('0x83')]})[_0x55bc('0x2b')](function(_0x39f713){if(_0x39f713[_0x55bc('0x3f')]===0x1){return _0x5050fe['id'];}else{var _0x29d8ec=_[_0x55bc('0x84')](_[_0x55bc('0x33')](_0x39f713,_0x55bc('0x85')),function(_0x4224b6){return _[_0x55bc('0x86')](_0xe5dd8b,_0x4224b6);});if(_0x29d8ec){return _0x5050fe['id'];}}}));}}return BPromise[_0x55bc('0x87')](_0x35553c)['then'](function(_0x3cabf4){_0x12d895=_(_0x12d895)['union'](_0x3cabf4)[_0x55bc('0x88')]()['value']();return db[_0x55bc('0x34')]['find']({'where':{'id':_0x3df7a0[_0x55bc('0x4f')]['id']}})[_0x55bc('0x2b')](function(_0xda1b5c){return db[_0x55bc('0x70')][_0x55bc('0x71')](function(_0x4b0399){return _0xda1b5c[_0x55bc('0x89')](_0x3df7a0[_0x55bc('0x3a')][_0x55bc('0x6b')],{'transaction':_0x4b0399})[_0x55bc('0x2b')](function(){if(!_[_0x55bc('0x8a')](_0x12d895)){return _0xda1b5c['removeAgents'](_0x12d895,{'transaction':_0x4b0399});}})[_0x55bc('0x2b')](function(){_0x12d895[_0x55bc('0x73')](function(_0x112111){socket[_0x55bc('0x74')]('userMailQueue:remove',{'UserId':_0x112111,'MailQueueId':_0xda1b5c['id']});});});});});});})[_0x55bc('0x2b')](respondWithStatusCode(_0x40ab81,null))[_0x55bc('0x4e')](handleError(_0x40ab81,null));};exports['addAgents']=function(_0x47cbc4,_0x41a37f,_0x1d0feb){return db[_0x55bc('0x34')][_0x55bc('0x51')]({'where':{'id':_0x47cbc4[_0x55bc('0x4f')]['id']}})['then'](handleEntityNotFound(_0x41a37f,null))[_0x55bc('0x2b')](function(_0x533779){if(_0x533779){return _0x533779[_0x55bc('0x8b')](_0x47cbc4[_0x55bc('0x53')][_0x55bc('0x6b')],_[_0x55bc('0x8c')](_0x47cbc4[_0x55bc('0x53')],[_0x55bc('0x6b'),'id'])||{})[_0x55bc('0x8d')](function(_0x447db3){for(var _0x51068a=0x0;_0x51068a<_0x47cbc4[_0x55bc('0x53')][_0x55bc('0x6b')][_0x55bc('0x3f')];_0x51068a+=0x1){socket[_0x55bc('0x74')]('userMailQueue:save',{'UserId':Number(_0x47cbc4[_0x55bc('0x53')][_0x55bc('0x6b')][_0x51068a]),'MailQueueId':Number(_0x47cbc4[_0x55bc('0x4f')]['id'])});}return _0x447db3;});}})[_0x55bc('0x2b')](respondWithResult(_0x41a37f,null))['catch'](handleError(_0x41a37f,null));};exports['removeAgents']=function(_0x172299,_0xf018a8,_0x29e315){return db[_0x55bc('0x34')][_0x55bc('0x51')]({'where':{'id':_0x172299[_0x55bc('0x4f')]['id']}})[_0x55bc('0x2b')](handleEntityNotFound(_0xf018a8,null))[_0x55bc('0x2b')](function(_0x5dfa0d){if(_0x5dfa0d){return _0x5dfa0d['removeAgents'](_0x172299[_0x55bc('0x3a')][_0x55bc('0x6b')])[_0x55bc('0x2b')](function(){if(_[_0x55bc('0x8e')](_0x172299['query']['ids'])){for(var _0x1434dd=0x0;_0x1434dd<_0x172299[_0x55bc('0x3a')]['ids'][_0x55bc('0x3f')];_0x1434dd+=0x1){socket[_0x55bc('0x74')](_0x55bc('0x8f'),{'UserId':Number(_0x172299[_0x55bc('0x3a')][_0x55bc('0x6b')][_0x1434dd]),'MailQueueId':Number(_0x172299['params']['id'])});}}else{socket[_0x55bc('0x74')](_0x55bc('0x8f'),{'UserId':Number(_0x172299[_0x55bc('0x3a')][_0x55bc('0x6b')]),'MailQueueId':Number(_0x172299[_0x55bc('0x4f')]['id'])});}});}})['then'](respondWithStatusCode(_0xf018a8,null))['catch'](handleError(_0xf018a8,null));};exports[_0x55bc('0x90')]=function(_0x54c04b,_0x8f024f,_0x4a4e1c){var _0x2fdc36={};var _0x1f0af5={};var _0xfeb45a;var _0x2ee457;return db[_0x55bc('0x34')][_0x55bc('0x5d')]({'where':{'id':_0x54c04b[_0x55bc('0x4f')]['id']}})[_0x55bc('0x2b')](handleEntityNotFound(_0x8f024f,null))[_0x55bc('0x2b')](function(_0x3e5072){if(_0x3e5072){_0xfeb45a=_0x3e5072;_0x1f0af5[_0x55bc('0x39')]=_[_0x55bc('0x50')](db[_0x55bc('0x60')][_0x55bc('0x35')]);_0x1f0af5[_0x55bc('0x3a')]=_['keys'](_0x54c04b[_0x55bc('0x3a')]);_0x1f0af5[_0x55bc('0x3b')]=_[_0x55bc('0x3d')](_0x1f0af5[_0x55bc('0x39')],_0x1f0af5[_0x55bc('0x3a')]);_0x2fdc36[_0x55bc('0x3c')]=_[_0x55bc('0x3d')](_0x1f0af5[_0x55bc('0x39')],qs[_0x55bc('0x3e')](_0x54c04b[_0x55bc('0x3a')][_0x55bc('0x3e')]));_0x2fdc36['attributes']=_0x2fdc36[_0x55bc('0x3c')][_0x55bc('0x3f')]?_0x2fdc36[_0x55bc('0x3c')]:_0x1f0af5[_0x55bc('0x39')];_0x2fdc36['order']=qs[_0x55bc('0x43')](_0x54c04b['query'][_0x55bc('0x43')]);_0x2fdc36['where']=qs[_0x55bc('0x3b')](_[_0x55bc('0x45')](_0x54c04b['query'],_0x1f0af5[_0x55bc('0x3b')]));if(_0x54c04b[_0x55bc('0x3a')][_0x55bc('0x48')]){_0x2fdc36['where']=_[_0x55bc('0x46')](_0x2fdc36[_0x55bc('0x44')],{'$or':_[_0x55bc('0x33')](_0x2fdc36[_0x55bc('0x3c')],function(_0x54f1d2){var _0x40fa7d={};_0x40fa7d[_0x54f1d2]={'$like':'%'+_0x54c04b[_0x55bc('0x3a')][_0x55bc('0x48')]+'%'};return _0x40fa7d;})});}_0x2fdc36=_[_0x55bc('0x46')]({},_0x2fdc36,_0x54c04b[_0x55bc('0x49')]);return _0xfeb45a[_0x55bc('0x90')](_0x2fdc36);}})[_0x55bc('0x2b')](function(_0x12e7db){if(_0x12e7db){_0x2ee457=_0x12e7db[_0x55bc('0x3f')];if(!_0x54c04b[_0x55bc('0x3a')]['hasOwnProperty']('nolimit')){_0x2fdc36[_0x55bc('0x41')]=qs[_0x55bc('0x41')](_0x54c04b['query'][_0x55bc('0x41')]);_0x2fdc36[_0x55bc('0x23')]=qs[_0x55bc('0x23')](_0x54c04b[_0x55bc('0x3a')][_0x55bc('0x23')]);}return _0xfeb45a[_0x55bc('0x90')](_0x2fdc36);}})['then'](function(_0x27482a){if(_0x27482a){return _0x27482a?{'count':_0x2ee457,'rows':_0x27482a}:null;}})[_0x55bc('0x2b')](respondWithResult(_0x8f024f,null))[_0x55bc('0x4e')](handleError(_0x8f024f,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 05b71e6..22470c6 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 _0x1aab=['update','remove','emit','exports','events','../../mysqldb','MailQueue','setMaxListeners','save'];(function(_0x1705ae,_0x1b8f8c){var _0x5f3ce0=function(_0x1d88d6){while(--_0x1d88d6){_0x1705ae['push'](_0x1705ae['shift']());}};_0x5f3ce0(++_0x1b8f8c);}(_0x1aab,0x187));var _0xb1aa=function(_0x22119e,_0x16f6fc){_0x22119e=_0x22119e-0x0;var _0x1f7c75=_0x1aab[_0x22119e];return _0x1f7c75;};'use strict';var EventEmitter=require(_0xb1aa('0x0'));var MailQueue=require(_0xb1aa('0x1'))['db'][_0xb1aa('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xb1aa('0x3')](0x0);var events={'afterCreate':_0xb1aa('0x4'),'afterUpdate':_0xb1aa('0x5'),'afterDestroy':_0xb1aa('0x6')};function emitEvent(_0x37844e){return function(_0x2a5c4d,_0x3630cd,_0x433de3){MailQueueEvents[_0xb1aa('0x7')](_0x37844e+':'+_0x2a5c4d['id'],_0x2a5c4d);MailQueueEvents['emit'](_0x37844e,_0x2a5c4d);_0x433de3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xb1aa('0x8')]=MailQueueEvents; \ No newline at end of file +var _0x4f6c=['emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x419b7a,_0x299ca7){var _0x4e284d=function(_0x42a9f5){while(--_0x42a9f5){_0x419b7a['push'](_0x419b7a['shift']());}};_0x4e284d(++_0x299ca7);}(_0x4f6c,0x9d));var _0xc4f6=function(_0x364b97,_0x3951d4){_0x364b97=_0x364b97-0x0;var _0x471ab0=_0x4f6c[_0x364b97];return _0x471ab0;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0xc4f6('0x0'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xc4f6('0x1')](0x0);var events={'afterCreate':_0xc4f6('0x2'),'afterUpdate':_0xc4f6('0x3'),'afterDestroy':_0xc4f6('0x4')};function emitEvent(_0x469f0c){return function(_0x2a8984,_0x2a74c6,_0x1faaac){MailQueueEvents[_0xc4f6('0x5')](_0x469f0c+':'+_0x2a8984['id'],_0x2a8984);MailQueueEvents[_0xc4f6('0x5')](_0x469f0c,_0x2a8984);_0x1faaac(null);};}for(var e in events){if(events[_0xc4f6('0x6')](e)){var event=events[e];MailQueue[_0xc4f6('0x7')](e,emitEvent(event));}}module[_0xc4f6('0x8')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index bed0961..8052b5b 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 _0x4f25=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./mailQueue.attributes'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x4f25,0x19e));var _0x54f2=function(_0xccf869,_0x2556a5){_0xccf869=_0xccf869-0x0;var _0x21a9db=_0x4f25[_0xccf869];return _0x21a9db;};'use strict';var _=require(_0x54f2('0x0'));var util=require(_0x54f2('0x1'));var logger=require(_0x54f2('0x2'))(_0x54f2('0x3'));var moment=require(_0x54f2('0x4'));var BPromise=require(_0x54f2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x54f2('0x6'));var rimraf=require(_0x54f2('0x7'));var config=require('../../config/environment');var attributes=require(_0x54f2('0x8'));module['exports']=function(_0x1d1f2b,_0xa78ccd){return _0x1d1f2b['define']('MailQueue',attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7018=['request-promise','rimraf','../../config/environment','./mailQueue.attributes','exports','MailQueue','lodash','util','../../config/logger','moment','bluebird'];(function(_0x3a49f7,_0x5f14ed){var _0x29edab=function(_0x3d87f8){while(--_0x3d87f8){_0x3a49f7['push'](_0x3a49f7['shift']());}};_0x29edab(++_0x5f14ed);}(_0x7018,0x124));var _0x8701=function(_0xab412,_0x55a1e5){_0xab412=_0xab412-0x0;var _0x2f5def=_0x7018[_0xab412];return _0x2f5def;};'use strict';var _=require(_0x8701('0x0'));var util=require(_0x8701('0x1'));var logger=require(_0x8701('0x2'))('api');var moment=require(_0x8701('0x3'));var BPromise=require(_0x8701('0x4'));var rp=require(_0x8701('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8701('0x6'));var config=require(_0x8701('0x7'));var attributes=require(_0x8701('0x8'));module[_0x8701('0x9')]=function(_0x1ee550,_0x404539){return _0x1ee550['define'](_0x8701('0xa'),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 3a452ba..d2b892d 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 _0x83d5=['GetMailQueue','ShowMailQueue','MailQueue','find','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','raw','where','attributes','include','map'];(function(_0x3c0127,_0x2c0d2a){var _0x5c32ec=function(_0x42e29c){while(--_0x42e29c){_0x3c0127['push'](_0x3c0127['shift']());}};_0x5c32ec(++_0x2c0d2a);}(_0x83d5,0xb1));var _0x583d=function(_0x2cc8bb,_0x5f2607){_0x2cc8bb=_0x2cc8bb-0x0;var _0x140e40=_0x83d5[_0x2cc8bb];return _0x140e40;};'use strict';var _=require(_0x583d('0x0'));var util=require(_0x583d('0x1'));var moment=require(_0x583d('0x2'));var BPromise=require(_0x583d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x583d('0x4'));var db=require(_0x583d('0x5'))['db'];var utils=require(_0x583d('0x6'));var logger=require(_0x583d('0x7'))('rpc');var config=require(_0x583d('0x8'));var jayson=require(_0x583d('0x9'));var client=jayson[_0x583d('0xa')][_0x583d('0xb')]({'port':0x232a});config[_0x583d('0xc')]=_[_0x583d('0xd')](config['redis'],{'host':_0x583d('0xe'),'port':0x18eb});var socket=require(_0x583d('0xf'))(new Redis(config['redis']));require(_0x583d('0x10'))[_0x583d('0x11')](socket);function respondWithRpcPromise(_0x46c63a,_0x45d6af,_0xf92ed2){return new BPromise(function(_0x274071,_0x51c4d6){return client[_0x583d('0x12')](_0x46c63a,_0xf92ed2)[_0x583d('0x13')](function(_0x4b3da0){logger[_0x583d('0x14')](_0x583d('0x15'),_0x45d6af,_0x583d('0x16'));logger[_0x583d('0x17')](_0x583d('0x18'),_0x45d6af,'request\x20sent',JSON[_0x583d('0x19')](_0x4b3da0));if(_0x4b3da0[_0x583d('0x1a')]){if(_0x4b3da0['error'][_0x583d('0x1b')]===0x1f4){logger[_0x583d('0x1a')](_0x583d('0x15'),_0x45d6af,_0x4b3da0[_0x583d('0x1a')][_0x583d('0x1c')]);return _0x51c4d6(_0x4b3da0[_0x583d('0x1a')][_0x583d('0x1c')]);}logger[_0x583d('0x1a')](_0x583d('0x15'),_0x45d6af,_0x4b3da0[_0x583d('0x1a')][_0x583d('0x1c')]);return _0x274071(_0x4b3da0[_0x583d('0x1a')]['message']);}else{logger[_0x583d('0x14')](_0x583d('0x15'),_0x45d6af,'request\x20sent');_0x274071(_0x4b3da0[_0x583d('0x1d')][_0x583d('0x1c')]);}})[_0x583d('0x1e')](function(_0x4eda63){logger[_0x583d('0x1a')]('MailQueue,\x20%s,\x20%s',_0x45d6af,_0x4eda63);_0x51c4d6(_0x4eda63);});});}exports['GetMailQueue']=function(_0x5b6e29){var _0x576634=this;return new Promise(function(_0x2939d2,_0x4d49fb){return db['MailQueue'][_0x583d('0x1f')]({'raw':_0x5b6e29[_0x583d('0x20')]?_0x5b6e29[_0x583d('0x20')][_0x583d('0x21')]===undefined?!![]:![]:!![],'where':_0x5b6e29[_0x583d('0x20')]?_0x5b6e29[_0x583d('0x20')][_0x583d('0x22')]||null:null,'attributes':_0x5b6e29['options']?_0x5b6e29[_0x583d('0x20')][_0x583d('0x23')]||null:null,'limit':_0x5b6e29['options']?_0x5b6e29[_0x583d('0x20')]['limit']||null:null,'include':_0x5b6e29[_0x583d('0x20')]?_0x5b6e29[_0x583d('0x20')][_0x583d('0x24')]?_[_0x583d('0x25')](_0x5b6e29['options'][_0x583d('0x24')],function(_0x17ec6f){return{'model':db[_0x17ec6f['model']],'as':_0x17ec6f['as'],'attributes':_0x17ec6f['attributes'],'include':_0x17ec6f[_0x583d('0x24')]?_[_0x583d('0x25')](_0x17ec6f[_0x583d('0x24')],function(_0x49c880){return{'model':db[_0x49c880['model']],'as':_0x49c880['as'],'attributes':_0x49c880[_0x583d('0x23')],'include':_0x49c880['include']?_[_0x583d('0x25')](_0x49c880['include'],function(_0x3e9eb8){return{'model':db[_0x3e9eb8['model']],'as':_0x3e9eb8['as'],'attributes':_0x3e9eb8[_0x583d('0x23')]};}):[]};}):[]};}):[]:[]})[_0x583d('0x13')](function(_0x5667e5){logger[_0x583d('0x14')](_0x583d('0x26'),_0x5b6e29);logger[_0x583d('0x17')]('GetMailQueue',_0x5b6e29,JSON[_0x583d('0x19')](_0x5667e5));_0x2939d2(_0x5667e5);})[_0x583d('0x1e')](function(_0x34e411){logger[_0x583d('0x1a')](_0x583d('0x26'),_0x34e411[_0x583d('0x1c')],_0x5b6e29);_0x4d49fb(_0x576634['error'](0x1f4,_0x34e411[_0x583d('0x1c')]));});});};exports[_0x583d('0x27')]=function(_0x4cb7ce){var _0x11faf1=this;return new Promise(function(_0x2568f3,_0x5e3ee5){return db[_0x583d('0x28')][_0x583d('0x29')]({'raw':_0x4cb7ce[_0x583d('0x20')]?_0x4cb7ce[_0x583d('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x4cb7ce[_0x583d('0x20')]?_0x4cb7ce[_0x583d('0x20')][_0x583d('0x22')]||null:null,'attributes':_0x4cb7ce[_0x583d('0x20')]?_0x4cb7ce[_0x583d('0x20')][_0x583d('0x23')]||null:null,'include':_0x4cb7ce[_0x583d('0x20')]?_0x4cb7ce[_0x583d('0x20')][_0x583d('0x24')]?_[_0x583d('0x25')](_0x4cb7ce[_0x583d('0x20')][_0x583d('0x24')],function(_0x5e052f){return{'model':db[_0x5e052f[_0x583d('0x2a')]],'as':_0x5e052f['as'],'attributes':_0x5e052f[_0x583d('0x23')],'include':_0x5e052f[_0x583d('0x24')]?_[_0x583d('0x25')](_0x5e052f['include'],function(_0x571f2d){return{'model':db[_0x571f2d['model']],'as':_0x571f2d['as'],'attributes':_0x571f2d['attributes'],'include':_0x571f2d[_0x583d('0x24')]?_['map'](_0x571f2d[_0x583d('0x24')],function(_0x324fe2){return{'model':db[_0x324fe2[_0x583d('0x2a')]],'as':_0x324fe2['as'],'attributes':_0x324fe2['attributes']};}):[]};}):[]};}):[]:[]})[_0x583d('0x13')](function(_0x3c4f63){logger['info'](_0x583d('0x27'),_0x4cb7ce);logger[_0x583d('0x17')](_0x583d('0x27'),_0x4cb7ce,JSON[_0x583d('0x19')](_0x3c4f63));_0x2568f3(_0x3c4f63);})[_0x583d('0x1e')](function(_0x275545){logger[_0x583d('0x1a')]('ShowMailQueue',_0x275545[_0x583d('0x1c')],_0x4cb7ce);_0x5e3ee5(_0x11faf1[_0x583d('0x1a')](0x1f4,_0x275545['message']));});});}; \ No newline at end of file +var _0x6b24=['client','defaults','redis','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailQueue','findAll','options','raw','where','attributes','include','map','model','debug','GetMailQueue','ShowMailQueue','catch','util','moment','bluebird','randomstring','../../config/logger','../../config/environment'];(function(_0x4c36e7,_0xe99b6e){var _0x540a15=function(_0x3ccc74){while(--_0x3ccc74){_0x4c36e7['push'](_0x4c36e7['shift']());}};_0x540a15(++_0xe99b6e);}(_0x6b24,0x1ce));var _0x46b2=function(_0x16337a,_0x4789a1){_0x16337a=_0x16337a-0x0;var _0x422365=_0x6b24[_0x16337a];return _0x422365;};'use strict';var _=require('lodash');var util=require(_0x46b2('0x0'));var moment=require(_0x46b2('0x1'));var BPromise=require(_0x46b2('0x2'));var rs=require(_0x46b2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x46b2('0x4'))('rpc');var config=require(_0x46b2('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x46b2('0x6')]['http']({'port':0x232a});config['redis']=_[_0x46b2('0x7')](config[_0x46b2('0x8')],{'host':_0x46b2('0x9'),'port':0x18eb});var socket=require(_0x46b2('0xa'))(new Redis(config[_0x46b2('0x8')]));require(_0x46b2('0xb'))[_0x46b2('0xc')](socket);function respondWithRpcPromise(_0xde459c,_0x3e6b4d,_0x4eb77c){return new BPromise(function(_0x579340,_0x36e63a){return client[_0x46b2('0xd')](_0xde459c,_0x4eb77c)[_0x46b2('0xe')](function(_0x5bb2c3){logger[_0x46b2('0xf')](_0x46b2('0x10'),_0x3e6b4d,_0x46b2('0x11'));logger['debug'](_0x46b2('0x12'),_0x3e6b4d,_0x46b2('0x11'),JSON[_0x46b2('0x13')](_0x5bb2c3));if(_0x5bb2c3[_0x46b2('0x14')]){if(_0x5bb2c3[_0x46b2('0x14')][_0x46b2('0x15')]===0x1f4){logger[_0x46b2('0x14')](_0x46b2('0x10'),_0x3e6b4d,_0x5bb2c3[_0x46b2('0x14')][_0x46b2('0x16')]);return _0x36e63a(_0x5bb2c3['error'][_0x46b2('0x16')]);}logger[_0x46b2('0x14')]('MailQueue,\x20%s,\x20%s',_0x3e6b4d,_0x5bb2c3[_0x46b2('0x14')][_0x46b2('0x16')]);return _0x579340(_0x5bb2c3[_0x46b2('0x14')][_0x46b2('0x16')]);}else{logger[_0x46b2('0xf')](_0x46b2('0x10'),_0x3e6b4d,_0x46b2('0x11'));_0x579340(_0x5bb2c3['result'][_0x46b2('0x16')]);}})['catch'](function(_0x2fc246){logger[_0x46b2('0x14')](_0x46b2('0x10'),_0x3e6b4d,_0x2fc246);_0x36e63a(_0x2fc246);});});}exports['GetMailQueue']=function(_0x285171){var _0x1c232f=this;return new Promise(function(_0x473aad,_0x1e5c35){return db[_0x46b2('0x17')][_0x46b2('0x18')]({'raw':_0x285171[_0x46b2('0x19')]?_0x285171[_0x46b2('0x19')][_0x46b2('0x1a')]===undefined?!![]:![]:!![],'where':_0x285171[_0x46b2('0x19')]?_0x285171[_0x46b2('0x19')][_0x46b2('0x1b')]||null:null,'attributes':_0x285171[_0x46b2('0x19')]?_0x285171[_0x46b2('0x19')][_0x46b2('0x1c')]||null:null,'limit':_0x285171['options']?_0x285171[_0x46b2('0x19')]['limit']||null:null,'include':_0x285171['options']?_0x285171[_0x46b2('0x19')][_0x46b2('0x1d')]?_[_0x46b2('0x1e')](_0x285171[_0x46b2('0x19')][_0x46b2('0x1d')],function(_0x58069e){return{'model':db[_0x58069e[_0x46b2('0x1f')]],'as':_0x58069e['as'],'attributes':_0x58069e[_0x46b2('0x1c')],'include':_0x58069e['include']?_[_0x46b2('0x1e')](_0x58069e['include'],function(_0x23ce7d){return{'model':db[_0x23ce7d[_0x46b2('0x1f')]],'as':_0x23ce7d['as'],'attributes':_0x23ce7d[_0x46b2('0x1c')],'include':_0x23ce7d[_0x46b2('0x1d')]?_[_0x46b2('0x1e')](_0x23ce7d[_0x46b2('0x1d')],function(_0x74615){return{'model':db[_0x74615[_0x46b2('0x1f')]],'as':_0x74615['as'],'attributes':_0x74615[_0x46b2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x46b2('0xe')](function(_0x5421d9){logger['info']('GetMailQueue',_0x285171);logger[_0x46b2('0x20')](_0x46b2('0x21'),_0x285171,JSON[_0x46b2('0x13')](_0x5421d9));_0x473aad(_0x5421d9);})['catch'](function(_0x3ae316){logger[_0x46b2('0x14')]('GetMailQueue',_0x3ae316[_0x46b2('0x16')],_0x285171);_0x1e5c35(_0x1c232f[_0x46b2('0x14')](0x1f4,_0x3ae316[_0x46b2('0x16')]));});});};exports[_0x46b2('0x22')]=function(_0x1a2a6d){var _0x3341df=this;return new Promise(function(_0x36a746,_0x15eabd){return db[_0x46b2('0x17')]['find']({'raw':_0x1a2a6d[_0x46b2('0x19')]?_0x1a2a6d[_0x46b2('0x19')][_0x46b2('0x1a')]===undefined?!![]:![]:!![],'where':_0x1a2a6d['options']?_0x1a2a6d[_0x46b2('0x19')][_0x46b2('0x1b')]||null:null,'attributes':_0x1a2a6d[_0x46b2('0x19')]?_0x1a2a6d[_0x46b2('0x19')]['attributes']||null:null,'include':_0x1a2a6d[_0x46b2('0x19')]?_0x1a2a6d['options'][_0x46b2('0x1d')]?_[_0x46b2('0x1e')](_0x1a2a6d[_0x46b2('0x19')][_0x46b2('0x1d')],function(_0x12c5a5){return{'model':db[_0x12c5a5[_0x46b2('0x1f')]],'as':_0x12c5a5['as'],'attributes':_0x12c5a5[_0x46b2('0x1c')],'include':_0x12c5a5['include']?_[_0x46b2('0x1e')](_0x12c5a5[_0x46b2('0x1d')],function(_0x205ac8){return{'model':db[_0x205ac8[_0x46b2('0x1f')]],'as':_0x205ac8['as'],'attributes':_0x205ac8[_0x46b2('0x1c')],'include':_0x205ac8[_0x46b2('0x1d')]?_[_0x46b2('0x1e')](_0x205ac8['include'],function(_0x4a2d30){return{'model':db[_0x4a2d30['model']],'as':_0x4a2d30['as'],'attributes':_0x4a2d30[_0x46b2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x46b2('0xe')](function(_0x4c46db){logger[_0x46b2('0xf')]('ShowMailQueue',_0x1a2a6d);logger['debug'](_0x46b2('0x22'),_0x1a2a6d,JSON[_0x46b2('0x13')](_0x4c46db));_0x36a746(_0x4c46db);})[_0x46b2('0x23')](function(_0x112e67){logger['error'](_0x46b2('0x22'),_0x112e67['message'],_0x1a2a6d);_0x15eabd(_0x3341df['error'](0x1f4,_0x112e67['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 1019bfe..7c084df 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 _0x53e6=['remove','update','removeListener','register','./mailQueue.events','save'];(function(_0x1d628c,_0x37f75a){var _0x215a4d=function(_0x19d81e){while(--_0x19d81e){_0x1d628c['push'](_0x1d628c['shift']());}};_0x215a4d(++_0x37f75a);}(_0x53e6,0x178));var _0x653e=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x53e6[_0x3ab51d];return _0x29a04e;};'use strict';var MailQueueEvents=require(_0x653e('0x0'));var events=[_0x653e('0x1'),_0x653e('0x2'),_0x653e('0x3')];function createListener(_0x3981f4,_0x5a562a){return function(_0x3e7e15){_0x5a562a['emit'](_0x3981f4,_0x3e7e15);};}function removeListener(_0x58e08b,_0x4d50fd){return function(){MailQueueEvents[_0x653e('0x4')](_0x58e08b,_0x4d50fd);};}exports[_0x653e('0x5')]=function(_0x12022c){for(var _0xe94957=0x0,_0x7df625=events['length'];_0xe94957<_0x7df625;_0xe94957++){var _0x8c8dc5=events[_0xe94957];var _0xedcdcc=createListener('mailQueue:'+_0x8c8dc5,_0x12022c);MailQueueEvents['on'](_0x8c8dc5,_0xedcdcc);}}; \ No newline at end of file +var _0x0c87=['update','emit','removeListener','register','length','./mailQueue.events','save','remove'];(function(_0x3ae09c,_0x516a52){var _0x403664=function(_0x553b57){while(--_0x553b57){_0x3ae09c['push'](_0x3ae09c['shift']());}};_0x403664(++_0x516a52);}(_0x0c87,0x1d5));var _0x70c8=function(_0x57dc65,_0x348bb4){_0x57dc65=_0x57dc65-0x0;var _0x5c13d8=_0x0c87[_0x57dc65];return _0x5c13d8;};'use strict';var MailQueueEvents=require(_0x70c8('0x0'));var events=[_0x70c8('0x1'),_0x70c8('0x2'),_0x70c8('0x3')];function createListener(_0x10c46c,_0x367b10){return function(_0x410dcb){_0x367b10[_0x70c8('0x4')](_0x10c46c,_0x410dcb);};}function removeListener(_0x35c5e1,_0x4a4753){return function(){MailQueueEvents[_0x70c8('0x5')](_0x35c5e1,_0x4a4753);};}exports[_0x70c8('0x6')]=function(_0x5e7ae5){for(var _0xc8fed5=0x0,_0x308372=events[_0x70c8('0x7')];_0xc8fed5<_0x308372;_0xc8fed5++){var _0x162501=events[_0xc8fed5];var _0x440f68=createListener('mailQueue:'+_0x162501,_0x5e7ae5);MailQueueEvents['on'](_0x162501,_0x440f68);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 59181a1..faeb4f6 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 _0x80b3=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','util'];(function(_0x4e52b9,_0x3b39b2){var _0xca4e2a=function(_0x11515d){while(--_0x11515d){_0x4e52b9['push'](_0x4e52b9['shift']());}};_0xca4e2a(++_0x3b39b2);}(_0x80b3,0x19d));var _0x380b=function(_0x4fd1e6,_0xfaa3ff){_0x4fd1e6=_0x4fd1e6-0x0;var _0x2f5995=_0x80b3[_0x4fd1e6];return _0x2f5995;};'use strict';var multer=require('multer');var util=require(_0x380b('0x0'));var path=require('path');var timeout=require(_0x380b('0x1'));var express=require(_0x380b('0x2'));var router=express[_0x380b('0x3')]();var fs_extra=require(_0x380b('0x4'));var auth=require(_0x380b('0x5'));var interaction=require(_0x380b('0x6'));var config=require(_0x380b('0x7'));var controller=require(_0x380b('0x8'));router[_0x380b('0x9')]('/',auth[_0x380b('0xa')](),controller[_0x380b('0xb')]);router[_0x380b('0x9')](_0x380b('0xc'),auth[_0x380b('0xa')](),controller[_0x380b('0xd')]);router[_0x380b('0x9')](_0x380b('0xe'),auth['isAuthenticated'](),controller[_0x380b('0xf')]);router[_0x380b('0x10')]('/',auth['isAuthenticated'](),controller[_0x380b('0x11')]);router[_0x380b('0x12')](_0x380b('0xe'),auth['isAuthenticated'](),controller[_0x380b('0x13')]);router[_0x380b('0x14')]('/:id',auth[_0x380b('0xa')](),controller[_0x380b('0x15')]);module[_0x380b('0x16')]=router; \ No newline at end of file +var _0x1f0d=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','index','get','/describe','isAuthenticated','describe','/:id','show'];(function(_0xee2e7a,_0x58354d){var _0x319dd3=function(_0xa99240){while(--_0xa99240){_0xee2e7a['push'](_0xee2e7a['shift']());}};_0x319dd3(++_0x58354d);}(_0x1f0d,0x97));var _0xd1f0=function(_0x3a0085,_0xa67380){_0x3a0085=_0x3a0085-0x0;var _0x356c35=_0x1f0d[_0x3a0085];return _0x356c35;};'use strict';var multer=require(_0xd1f0('0x0'));var util=require(_0xd1f0('0x1'));var path=require(_0xd1f0('0x2'));var timeout=require(_0xd1f0('0x3'));var express=require(_0xd1f0('0x4'));var router=express[_0xd1f0('0x5')]();var fs_extra=require(_0xd1f0('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd1f0('0x7'));var config=require(_0xd1f0('0x8'));var controller=require(_0xd1f0('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xd1f0('0xa')]);router[_0xd1f0('0xb')](_0xd1f0('0xc'),auth[_0xd1f0('0xd')](),controller[_0xd1f0('0xe')]);router[_0xd1f0('0xb')](_0xd1f0('0xf'),auth[_0xd1f0('0xd')](),controller[_0xd1f0('0x10')]);router[_0xd1f0('0x11')]('/',auth[_0xd1f0('0xd')](),controller[_0xd1f0('0x12')]);router[_0xd1f0('0x13')](_0xd1f0('0xf'),auth[_0xd1f0('0xd')](),controller[_0xd1f0('0x14')]);router[_0xd1f0('0x15')](_0xd1f0('0xf'),auth[_0xd1f0('0xd')](),controller[_0xd1f0('0x16')]);module[_0xd1f0('0x17')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 03e8b86..ed8a58d 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 _0x1da9=['DATE','moment','sequelize','exports','STRING'];(function(_0x2512a5,_0x40f56c){var _0x418afd=function(_0x1baea5){while(--_0x1baea5){_0x2512a5['push'](_0x2512a5['shift']());}};_0x418afd(++_0x40f56c);}(_0x1da9,0x141));var _0x91da=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x1da9[_0x501510];return _0x1e6ee5;};'use strict';var moment=require(_0x91da('0x0'));var Sequelize=require(_0x91da('0x1'));module[_0x91da('0x2')]={'uniqueid':{'type':Sequelize[_0x91da('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x91da('0x3')]},'joinAt':{'type':Sequelize[_0x91da('0x4')]},'leaveAt':{'type':Sequelize[_0x91da('0x4')]},'acceptAt':{'type':Sequelize[_0x91da('0x4')]},'exitAt':{'type':Sequelize[_0x91da('0x4')]},'reason':{'type':Sequelize[_0x91da('0x3')]}}; \ No newline at end of file +var _0x5b9f=['DATE','moment','exports','STRING'];(function(_0x206f54,_0x4e3509){var _0xe2a50e=function(_0x49bd9a){while(--_0x49bd9a){_0x206f54['push'](_0x206f54['shift']());}};_0xe2a50e(++_0x4e3509);}(_0x5b9f,0xc9));var _0xf5b9=function(_0x868a4,_0x54e4d4){_0x868a4=_0x868a4-0x0;var _0x2bcc65=_0x5b9f[_0x868a4];return _0x2bcc65;};'use strict';var moment=require(_0xf5b9('0x0'));var Sequelize=require('sequelize');module[_0xf5b9('0x1')]={'uniqueid':{'type':Sequelize[_0xf5b9('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xf5b9('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xf5b9('0x3')]},'acceptAt':{'type':Sequelize[_0xf5b9('0x3')]},'exitAt':{'type':Sequelize[_0xf5b9('0x3')]},'reason':{'type':Sequelize[_0xf5b9('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index c4998af..b328976 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 _0x93e9=['end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','name','send','map','rawAttributes','fieldName','type','key','query','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','MailQueueReport','includeAll','include','findAll','catch','show','params','keys','fields','length','options','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x44e9ea,_0x3a10a4){var _0x3b4fd7=function(_0xa0de55){while(--_0xa0de55){_0x44e9ea['push'](_0x44e9ea['shift']());}};_0x3b4fd7(++_0x3a10a4);}(_0x93e9,0xcc));var _0x993e=function(_0x3c5fbe,_0x1b05c7){_0x3c5fbe=_0x3c5fbe-0x0;var _0xb5c0ac=_0x93e9[_0x3c5fbe];return _0xb5c0ac;};'use strict';var emlformat=require(_0x993e('0x0'));var rimraf=require(_0x993e('0x1'));var zipdir=require(_0x993e('0x2'));var jsonpatch=require(_0x993e('0x3'));var rp=require(_0x993e('0x4'));var moment=require(_0x993e('0x5'));var BPromise=require(_0x993e('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x993e('0x7'));var sox=require(_0x993e('0x8'));var csv=require(_0x993e('0x9'));var ejs=require(_0x993e('0xa'));var fs=require('fs');var fs_extra=require(_0x993e('0xb'));var _=require(_0x993e('0xc'));var squel=require(_0x993e('0xd'));var crypto=require(_0x993e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x993e('0xf'));var toCsv=require(_0x993e('0x9'));var querystring=require(_0x993e('0x10'));var Papa=require(_0x993e('0x11'));var Redis=require(_0x993e('0x12'));var authService=require(_0x993e('0x13'));var qs=require(_0x993e('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x993e('0x15'));var logger=require(_0x993e('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x993e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x993e('0x18'))['db'];function respondWithStatusCode(_0x5d5c0d,_0x4c2707){_0x4c2707=_0x4c2707||0xcc;return function(_0x31ece2){if(_0x31ece2){return _0x5d5c0d[_0x993e('0x19')](_0x4c2707);}return _0x5d5c0d[_0x993e('0x1a')](_0x4c2707)[_0x993e('0x1b')]();};}function respondWithResult(_0x3e082b,_0x397b42){_0x397b42=_0x397b42||0xc8;return function(_0x34ddda){if(_0x34ddda){return _0x3e082b[_0x993e('0x1a')](_0x397b42)[_0x993e('0x1c')](_0x34ddda);}};}function respondWithFilteredResult(_0xa43a4e,_0x1a7726){return function(_0x135771){if(_0x135771){var _0x3df0e7=typeof _0x1a7726[_0x993e('0x1d')]===_0x993e('0x1e')&&typeof _0x1a7726[_0x993e('0x1f')]===_0x993e('0x1e');var _0x526e06=_0x135771[_0x993e('0x20')];var _0x1acd21=_0x3df0e7?0x0:_0x1a7726[_0x993e('0x1d')];var _0x3d6109=_0x3df0e7?_0x135771[_0x993e('0x20')]:_0x1a7726[_0x993e('0x1d')]+_0x1a7726['limit'];var _0x11cd41;if(_0x3d6109>=_0x526e06){_0x3d6109=_0x526e06;_0x11cd41=0xc8;}else{_0x11cd41=0xce;}_0xa43a4e[_0x993e('0x1a')](_0x11cd41);return _0xa43a4e[_0x993e('0x21')](_0x993e('0x22'),_0x1acd21+'-'+_0x3d6109+'/'+_0x526e06)[_0x993e('0x1c')](_0x135771);}return null;};}function patchUpdates(_0x425ab4){return function(_0x29e48d){try{jsonpatch[_0x993e('0x23')](_0x29e48d,_0x425ab4,!![]);}catch(_0x4bbe9c){return BPromise[_0x993e('0x24')](_0x4bbe9c);}return _0x29e48d['save']();};}function saveUpdates(_0x11f6f4,_0x37ff57){return function(_0x32b09e){if(_0x32b09e){return _0x32b09e['update'](_0x11f6f4)[_0x993e('0x25')](function(_0x13db4e){return _0x13db4e;});}return null;};}function removeEntity(_0xfba00f,_0x1c52fd){return function(_0x3b45ef){if(_0x3b45ef){return _0x3b45ef[_0x993e('0x26')]()[_0x993e('0x25')](function(){_0xfba00f[_0x993e('0x1a')](0xcc)[_0x993e('0x1b')]();});}};}function handleEntityNotFound(_0x18f6ac,_0x3fe099){return function(_0x3603fa){if(!_0x3603fa){_0x18f6ac['sendStatus'](0x194);}return _0x3603fa;};}function handleError(_0x2756a7,_0x279bb8){_0x279bb8=_0x279bb8||0x1f4;return function(_0x52b727){logger[_0x993e('0x27')](_0x52b727['stack']);if(_0x52b727[_0x993e('0x28')]){delete _0x52b727[_0x993e('0x28')];}_0x2756a7[_0x993e('0x1a')](_0x279bb8)[_0x993e('0x29')](_0x52b727);};}exports['index']=function(_0x48d457,_0x32e332){var _0x466d63={},_0x4a4f00={},_0x223af0={'count':0x0,'rows':[]};var _0x46670a=_[_0x993e('0x2a')](db['MailQueueReport'][_0x993e('0x2b')],function(_0x9e0309){return{'name':_0x9e0309[_0x993e('0x2c')],'type':_0x9e0309[_0x993e('0x2d')][_0x993e('0x2e')]};});_0x4a4f00['model']=_[_0x993e('0x2a')](_0x46670a,'name');_0x4a4f00[_0x993e('0x2f')]=_['keys'](_0x48d457[_0x993e('0x2f')]);_0x4a4f00['filters']=_[_0x993e('0x30')](_0x4a4f00[_0x993e('0x31')],_0x4a4f00[_0x993e('0x2f')]);_0x466d63[_0x993e('0x32')]=_[_0x993e('0x30')](_0x4a4f00[_0x993e('0x31')],qs['fields'](_0x48d457[_0x993e('0x2f')]['fields']));_0x466d63['attributes']=_0x466d63[_0x993e('0x32')]['length']?_0x466d63[_0x993e('0x32')]:_0x4a4f00[_0x993e('0x31')];if(!_0x48d457[_0x993e('0x2f')][_0x993e('0x33')](_0x993e('0x34'))){_0x466d63[_0x993e('0x1f')]=qs[_0x993e('0x1f')](_0x48d457[_0x993e('0x2f')][_0x993e('0x1f')]);_0x466d63[_0x993e('0x1d')]=qs[_0x993e('0x1d')](_0x48d457[_0x993e('0x2f')][_0x993e('0x1d')]);}_0x466d63[_0x993e('0x35')]=qs[_0x993e('0x36')](_0x48d457['query'][_0x993e('0x36')]);_0x466d63[_0x993e('0x37')]=qs[_0x993e('0x38')](_[_0x993e('0x39')](_0x48d457[_0x993e('0x2f')],_0x4a4f00[_0x993e('0x38')]),_0x46670a);if(_0x48d457[_0x993e('0x2f')][_0x993e('0x3a')]){_0x466d63[_0x993e('0x37')]=_['merge'](_0x466d63[_0x993e('0x37')],{'$or':_['map'](_0x46670a,function(_0xf79f29){if(_0xf79f29[_0x993e('0x2d')]!==_0x993e('0x3b')){var _0x406f14={};_0x406f14[_0xf79f29[_0x993e('0x28')]]={'$like':'%'+_0x48d457[_0x993e('0x2f')][_0x993e('0x3a')]+'%'};return _0x406f14;}})});}_0x466d63=_[_0x993e('0x3c')]({},_0x466d63,_0x48d457['options']);var _0x186d55={'where':_0x466d63['where']};return db[_0x993e('0x3d')]['count'](_0x186d55)[_0x993e('0x25')](function(_0xbd9983){_0x223af0[_0x993e('0x20')]=_0xbd9983;if(_0x48d457[_0x993e('0x2f')][_0x993e('0x3e')]){_0x466d63[_0x993e('0x3f')]=[{'all':!![]}];}return db[_0x993e('0x3d')][_0x993e('0x40')](_0x466d63);})['then'](function(_0xe64c){_0x223af0['rows']=_0xe64c;return _0x223af0;})['then'](respondWithFilteredResult(_0x32e332,_0x466d63))[_0x993e('0x41')](handleError(_0x32e332,null));};exports[_0x993e('0x42')]=function(_0x1f058f,_0x5ed497){var _0x620b26={'raw':!![],'where':{'id':_0x1f058f[_0x993e('0x43')]['id']}},_0x40719d={};_0x40719d['model']=_['keys'](db['MailQueueReport'][_0x993e('0x2b')]);_0x40719d[_0x993e('0x2f')]=_[_0x993e('0x44')](_0x1f058f['query']);_0x40719d[_0x993e('0x38')]=_[_0x993e('0x30')](_0x40719d['model'],_0x40719d[_0x993e('0x2f')]);_0x620b26[_0x993e('0x32')]=_['intersection'](_0x40719d[_0x993e('0x31')],qs[_0x993e('0x45')](_0x1f058f[_0x993e('0x2f')]['fields']));_0x620b26['attributes']=_0x620b26['attributes'][_0x993e('0x46')]?_0x620b26[_0x993e('0x32')]:_0x40719d[_0x993e('0x31')];if(_0x1f058f[_0x993e('0x2f')]['includeAll']){_0x620b26[_0x993e('0x3f')]=[{'all':!![]}];}_0x620b26=_[_0x993e('0x3c')]({},_0x620b26,_0x1f058f[_0x993e('0x47')]);return db[_0x993e('0x3d')][_0x993e('0x48')](_0x620b26)[_0x993e('0x25')](handleEntityNotFound(_0x5ed497,null))['then'](respondWithResult(_0x5ed497,null))['catch'](handleError(_0x5ed497,null));};exports[_0x993e('0x49')]=function(_0x416f9f,_0x4d560d){return db['MailQueueReport'][_0x993e('0x49')](_0x416f9f[_0x993e('0x4a')],{})[_0x993e('0x25')](respondWithResult(_0x4d560d,0xc9))[_0x993e('0x41')](handleError(_0x4d560d,null));};exports[_0x993e('0x4b')]=function(_0x256ce3,_0x5b18e3){if(_0x256ce3[_0x993e('0x4a')]['id']){delete _0x256ce3['body']['id'];}return db[_0x993e('0x3d')][_0x993e('0x48')]({'where':{'id':_0x256ce3[_0x993e('0x43')]['id']}})[_0x993e('0x25')](handleEntityNotFound(_0x5b18e3,null))[_0x993e('0x25')](saveUpdates(_0x256ce3[_0x993e('0x4a')],null))[_0x993e('0x25')](respondWithResult(_0x5b18e3,null))[_0x993e('0x41')](handleError(_0x5b18e3,null));};exports['destroy']=function(_0x23f09c,_0x66ee65){return db[_0x993e('0x3d')]['find']({'where':{'id':_0x23f09c[_0x993e('0x43')]['id']}})['then'](handleEntityNotFound(_0x66ee65,null))[_0x993e('0x25')](removeEntity(_0x66ee65,null))[_0x993e('0x41')](handleError(_0x66ee65,null));};exports['describe']=function(_0xb2508b,_0xef78a1){return db['MailQueueReport'][_0x993e('0x4c')]()[_0x993e('0x25')](respondWithResult(_0xef78a1,null))[_0x993e('0x41')](handleError(_0xef78a1,null));}; \ No newline at end of file +var _0x2ef3=['name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','MailQueueReport','then','includeAll','include','findAll','catch','show','params','keys','create','body','find','destroy','describe','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'];(function(_0x137774,_0x256067){var _0x55de27=function(_0x44d8a7){while(--_0x44d8a7){_0x137774['push'](_0x137774['shift']());}};_0x55de27(++_0x256067);}(_0x2ef3,0xba));var _0x32ef=function(_0x1f7466,_0xde2e53){_0x1f7466=_0x1f7466-0x0;var _0x4fef4a=_0x2ef3[_0x1f7466];return _0x4fef4a;};'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['MailQueueReport'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'all':!![]}];}return db[_0x32ef('0x3d')][_0x32ef('0x41')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x3c0e44){_0x3c569d['rows']=_0x3c0e44;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x42')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x43')]=function(_0x2a33dd,_0x765c63){var _0x5dca14={'raw':!![],'where':{'id':_0x2a33dd[_0x32ef('0x44')]['id']}},_0x2901a1={};_0x2901a1['model']=_[_0x32ef('0x45')](db['MailQueueReport'][_0x32ef('0x2a')]);_0x2901a1[_0x32ef('0x2f')]=_[_0x32ef('0x45')](_0x2a33dd[_0x32ef('0x2f')]);_0x2901a1[_0x32ef('0x30')]=_[_0x32ef('0x32')](_0x2901a1[_0x32ef('0x2e')],_0x2901a1[_0x32ef('0x2f')]);_0x5dca14[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x2901a1['model'],qs[_0x32ef('0x33')](_0x2a33dd['query'][_0x32ef('0x33')]));_0x5dca14[_0x32ef('0x31')]=_0x5dca14[_0x32ef('0x31')]['length']?_0x5dca14[_0x32ef('0x31')]:_0x2901a1[_0x32ef('0x2e')];if(_0x2a33dd[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5dca14[_0x32ef('0x40')]=[{'all':!![]}];}_0x5dca14=_[_0x32ef('0x3b')]({},_0x5dca14,_0x2a33dd[_0x32ef('0x3c')]);return db['MailQueueReport']['find'](_0x5dca14)[_0x32ef('0x3e')](handleEntityNotFound(_0x765c63,null))[_0x32ef('0x3e')](respondWithResult(_0x765c63,null))[_0x32ef('0x42')](handleError(_0x765c63,null));};exports[_0x32ef('0x46')]=function(_0x209361,_0xd67dc9){return db[_0x32ef('0x3d')][_0x32ef('0x46')](_0x209361[_0x32ef('0x47')],{})[_0x32ef('0x3e')](respondWithResult(_0xd67dc9,0xc9))[_0x32ef('0x42')](handleError(_0xd67dc9,null));};exports[_0x32ef('0x24')]=function(_0x36a65c,_0x4c2534){if(_0x36a65c[_0x32ef('0x47')]['id']){delete _0x36a65c[_0x32ef('0x47')]['id'];}return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x36a65c[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x4c2534,null))[_0x32ef('0x3e')](saveUpdates(_0x36a65c[_0x32ef('0x47')],null))[_0x32ef('0x3e')](respondWithResult(_0x4c2534,null))[_0x32ef('0x42')](handleError(_0x4c2534,null));};exports[_0x32ef('0x49')]=function(_0x29d456,_0x272377){return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x29d456[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x272377,null))[_0x32ef('0x3e')](removeEntity(_0x272377,null))['catch'](handleError(_0x272377,null));};exports['describe']=function(_0x179c2f,_0x259c32){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]()[_0x32ef('0x3e')](respondWithResult(_0x259c32,null))[_0x32ef('0x42')](handleError(_0x259c32,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 968c6ec..d00d9c7 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 _0x3249=['rimraf','../../config/environment','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','moment','request-promise'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3249,0xdf));var _0x9324=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0x3249[_0x58e469];return _0x4c01c5;};'use strict';var _=require(_0x9324('0x0'));var util=require(_0x9324('0x1'));var logger=require(_0x9324('0x2'))('api');var moment=require(_0x9324('0x3'));var BPromise=require('bluebird');var rp=require(_0x9324('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9324('0x5'));var config=require(_0x9324('0x6'));var attributes=require('./mailQueueReport.attributes');module[_0x9324('0x7')]=function(_0x3bb701,_0x2fea77){return _0x3bb701[_0x9324('0x8')](_0x9324('0x9'),attributes,{'tableName':_0x9324('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x9324('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x79fb=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailQueueReport.attributes','define','uniqueid','lodash','util'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x79fb,0xb2));var _0xb79f=function(_0x1a5ac7,_0x4875da){_0x1a5ac7=_0x1a5ac7-0x0;var _0x59d1a3=_0x79fb[_0x1a5ac7];return _0x59d1a3;};'use strict';var _=require(_0xb79f('0x0'));var util=require(_0xb79f('0x1'));var logger=require(_0xb79f('0x2'))(_0xb79f('0x3'));var moment=require(_0xb79f('0x4'));var BPromise=require(_0xb79f('0x5'));var rp=require(_0xb79f('0x6'));var fs=require('fs');var path=require(_0xb79f('0x7'));var rimraf=require(_0xb79f('0x8'));var config=require('../../config/environment');var attributes=require(_0xb79f('0x9'));module['exports']=function(_0x3c3045,_0x101a09){return _0x3c3045[_0xb79f('0xa')]('MailQueueReport',attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0xb79f('0xb'),'fields':[_0xb79f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 7ef7223..07e254d 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','CreateMailQueueReport','MailQueueReport'];(function(_0x1a9cab,_0x43ecaa){var _0x33a4b9=function(_0x22c47d){while(--_0x22c47d){_0x1a9cab['push'](_0x1a9cab['shift']());}};_0x33a4b9(++_0x43ecaa);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xc4aa[_0x88cd7b];return _0x56fcc8;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')](_0x28e304[_0xac4a('0x18')],{'raw':_0x28e304['options']?_0x28e304[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![]})[_0xac4a('0xc')](function(_0x3a3cdb){logger[_0xac4a('0x13')](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON['stringify'](_0x3a3cdb));_0x546c5d(_0x3a3cdb);})[_0xac4a('0x14')](function(_0x3204ad){logger['error'](_0xac4a('0x15'),_0x3204ad[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x3204ad[_0xac4a('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x1b7998){var _0x2503d8=this;return new Promise(function(_0x15435c,_0x412494){return db[_0xac4a('0x16')][_0xac4a('0x1b')](_0x1b7998[_0xac4a('0x18')],{'raw':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1c')]||null:null,'attributes':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1d')]||null:null,'limit':_0x1b7998['options']?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1e')]||null:null})[_0xac4a('0xc')](function(_0x2772fe){logger[_0xac4a('0x13')]('UpdateMailQueueReport',_0x1b7998);logger['debug'](_0xac4a('0x1f'),_0x1b7998,JSON[_0xac4a('0x20')](_0x2772fe));_0x15435c(_0x2772fe);})[_0xac4a('0x14')](function(_0x546b65){logger['error'](_0xac4a('0x1f'),_0x546b65[_0xac4a('0x12')],_0x1b7998);_0x412494(_0x2503d8[_0xac4a('0x10')](0x1f4,_0x546b65[_0xac4a('0x12')]));});});}; \ No newline at end of file +var _0xadb5=['MailQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailQueueReport','create','options','raw','debug','MailQueueReport','body','attributes','limit','UpdateMailQueueReport','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x2143d0,_0x44f8d1){var _0xc5478a=function(_0x20743c){while(--_0x20743c){_0x2143d0['push'](_0x2143d0['shift']());}};_0xc5478a(++_0x44f8d1);}(_0xadb5,0xad));var _0x5adb=function(_0x2b58a7,_0x3941a2){_0x2b58a7=_0x2b58a7-0x0;var _0x34eb32=_0xadb5[_0x2b58a7];return _0x34eb32;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailQueueReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});}exports[_0x5adb('0x15')]=function(_0x529b65){var _0x3fff62=this;return new Promise(function(_0x5de028,_0x1d9e86){return db['MailQueueReport'][_0x5adb('0x16')](_0x529b65['body'],{'raw':_0x529b65['options']?_0x529b65[_0x5adb('0x17')][_0x5adb('0x18')]===undefined?!![]:![]:!![]})[_0x5adb('0xb')](function(_0x1fd4a7){logger[_0x5adb('0xc')]('CreateMailQueueReport',_0x529b65);logger[_0x5adb('0x19')]('CreateMailQueueReport',_0x529b65,JSON['stringify'](_0x1fd4a7));_0x5de028(_0x1fd4a7);})[_0x5adb('0x14')](function(_0x379b33){logger[_0x5adb('0x10')](_0x5adb('0x15'),_0x379b33[_0x5adb('0x12')],_0x529b65);_0x1d9e86(_0x3fff62[_0x5adb('0x10')](0x1f4,_0x379b33[_0x5adb('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x4b1957){var _0x373cc3=this;return new Promise(function(_0x3220cd,_0x3839fb){return db[_0x5adb('0x1a')]['update'](_0x4b1957[_0x5adb('0x1b')],{'raw':_0x4b1957[_0x5adb('0x17')]?_0x4b1957['options'][_0x5adb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')]['where']||null:null,'attributes':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1c')]||null:null,'limit':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1d')]||null:null})['then'](function(_0x49992e){logger['info'](_0x5adb('0x1e'),_0x4b1957);logger[_0x5adb('0x19')](_0x5adb('0x1e'),_0x4b1957,JSON[_0x5adb('0xf')](_0x49992e));_0x3220cd(_0x49992e);})[_0x5adb('0x14')](function(_0x4de310){logger[_0x5adb('0x10')](_0x5adb('0x1e'),_0x4de310[_0x5adb('0x12')],_0x4b1957);_0x3839fb(_0x373cc3[_0x5adb('0x10')](0x1f4,_0x4de310[_0x5adb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 655c640..1382782 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x13c1ec,_0x31fe45){var _0x3df630=function(_0x2ec0ee){while(--_0x2ec0ee){_0x13c1ec['push'](_0x13c1ec['shift']());}};_0x3df630(++_0x31fe45);}(_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'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x10ba37,_0x31d2c8){var _0x1777e2=function(_0x562b3a){while(--_0x562b3a){_0x10ba37['push'](_0x10ba37['shift']());}};_0x1777e2(++_0x31d2c8);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 47e3aa5..ddf5f9e 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 _0xbfcc=['INTEGER','sequelize','STRING','BOOLEAN'];(function(_0x3ccd5c,_0x4837e1){var _0x208d59=function(_0x5afb40){while(--_0x5afb40){_0x3ccd5c['push'](_0x3ccd5c['shift']());}};_0x208d59(++_0x4837e1);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x47b15f,_0x103e93){_0x47b15f=_0x47b15f-0x0;var _0x55bf25=_0xbfcc[_0x47b15f];return _0x55bf25;};'use strict';var Sequelize=require(_0xcbfc('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xcbfc('0x1')]},'authentication':{'type':Sequelize[_0xcbfc('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0xcbfc('0x1')]},'password':{'type':Sequelize[_0xcbfc('0x1')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0xcbfc('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xcbfc('0x3')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x55ea=['BOOLEAN','INTEGER','INBOX','sequelize','exports','STRING'];(function(_0x1928a5,_0xf85c75){var _0x1cbf49=function(_0x9ee53f){while(--_0x9ee53f){_0x1928a5['push'](_0x1928a5['shift']());}};_0x1cbf49(++_0xf85c75);}(_0x55ea,0xc9));var _0xa55e=function(_0x4c1b17,_0x211dff){_0x4c1b17=_0x4c1b17-0x0;var _0x412454=_0x55ea[_0x4c1b17];return _0x412454;};'use strict';var Sequelize=require(_0xa55e('0x0'));module[_0xa55e('0x1')]={'description':{'type':Sequelize[_0xa55e('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xa55e('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xa55e('0x2')]},'password':{'type':Sequelize[_0xa55e('0x2')]},'port':{'type':Sequelize[_0xa55e('0x4')]},'tls':{'type':Sequelize[_0xa55e('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0xa55e('0x5')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 993ff89..86cd45d 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 _0x633e=['MailServerIn','mail_servers_in','moment','request-promise','path','rimraf','./mailServerIn.attributes','exports','define'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x633e,0x18e));var _0xe633=function(_0x24a7c9,_0x157c78){_0x24a7c9=_0x24a7c9-0x0;var _0x451a81=_0x633e[_0x24a7c9];return _0x451a81;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xe633('0x0'));var BPromise=require('bluebird');var rp=require(_0xe633('0x1'));var fs=require('fs');var path=require(_0xe633('0x2'));var rimraf=require(_0xe633('0x3'));var config=require('../../config/environment');var attributes=require(_0xe633('0x4'));module[_0xe633('0x5')]=function(_0x4440ed,_0x557594){return _0x4440ed[_0xe633('0x6')](_0xe633('0x7'),attributes,{'tableName':_0xe633('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f6c=['mail_servers_in','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn'];(function(_0x17649c,_0x49debb){var _0x18e84c=function(_0x56d735){while(--_0x56d735){_0x17649c['push'](_0x17649c['shift']());}};_0x18e84c(++_0x49debb);}(_0x3f6c,0x90));var _0xc3f6=function(_0x1e4e1f,_0x19ab6d){_0x1e4e1f=_0x1e4e1f-0x0;var _0x1b8f50=_0x3f6c[_0x1e4e1f];return _0x1b8f50;};'use strict';var _=require(_0xc3f6('0x0'));var util=require('util');var logger=require(_0xc3f6('0x1'))(_0xc3f6('0x2'));var moment=require(_0xc3f6('0x3'));var BPromise=require(_0xc3f6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc3f6('0x5'));var rimraf=require(_0xc3f6('0x6'));var config=require(_0xc3f6('0x7'));var attributes=require(_0xc3f6('0x8'));module[_0xc3f6('0x9')]=function(_0x4148b9,_0x121fbe){return _0x4148b9[_0xc3f6('0xa')](_0xc3f6('0xb'),attributes,{'tableName':_0xc3f6('0xc'),'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 0d40dee..91dd38a 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 _0x736b=['debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','MailServerIn,\x20%s,\x20%s','request\x20sent','error','code','message','result','GetMailServerIn','MailServerIn','findAll','options','raw','limit','include','model','attributes','map','then'];(function(_0x5e2c46,_0x20f500){var _0x5acf56=function(_0x594bbb){while(--_0x594bbb){_0x5e2c46['push'](_0x5e2c46['shift']());}};_0x5acf56(++_0x20f500);}(_0x736b,0x8a));var _0xb736=function(_0x3f6cf7,_0x56735e){_0x3f6cf7=_0x3f6cf7-0x0;var _0xb90b33=_0x736b[_0x3f6cf7];return _0xb90b33;};'use strict';var _=require(_0xb736('0x0'));var util=require(_0xb736('0x1'));var moment=require(_0xb736('0x2'));var BPromise=require(_0xb736('0x3'));var rs=require(_0xb736('0x4'));var fs=require('fs');var Redis=require(_0xb736('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb736('0x6'));var logger=require(_0xb736('0x7'))(_0xb736('0x8'));var config=require(_0xb736('0x9'));var jayson=require(_0xb736('0xa'));var client=jayson[_0xb736('0xb')][_0xb736('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x26644f,_0x57f6dd,_0x4fbfc0){return new BPromise(function(_0x206418,_0x2c63f4){return client[_0xb736('0xd')](_0x26644f,_0x4fbfc0)['then'](function(_0x59ec11){logger[_0xb736('0xe')](_0xb736('0xf'),_0x57f6dd,_0xb736('0x10'));logger['debug']('MailServerIn,\x20%s,\x20%s,\x20%s',_0x57f6dd,_0xb736('0x10'),JSON['stringify'](_0x59ec11));if(_0x59ec11[_0xb736('0x11')]){if(_0x59ec11['error'][_0xb736('0x12')]===0x1f4){logger[_0xb736('0x11')](_0xb736('0xf'),_0x57f6dd,_0x59ec11[_0xb736('0x11')][_0xb736('0x13')]);return _0x2c63f4(_0x59ec11[_0xb736('0x11')][_0xb736('0x13')]);}logger[_0xb736('0x11')](_0xb736('0xf'),_0x57f6dd,_0x59ec11[_0xb736('0x11')][_0xb736('0x13')]);return _0x206418(_0x59ec11[_0xb736('0x11')]['message']);}else{logger['info'](_0xb736('0xf'),_0x57f6dd,'request\x20sent');_0x206418(_0x59ec11[_0xb736('0x14')][_0xb736('0x13')]);}})['catch'](function(_0x1a315f){logger['error'](_0xb736('0xf'),_0x57f6dd,_0x1a315f);_0x2c63f4(_0x1a315f);});});}exports[_0xb736('0x15')]=function(_0x48d62a){var _0x229fa7=this;return new Promise(function(_0x882901,_0xe83e6e){return db[_0xb736('0x16')][_0xb736('0x17')]({'raw':_0x48d62a[_0xb736('0x18')]?_0x48d62a['options'][_0xb736('0x19')]===undefined?!![]:![]:!![],'where':_0x48d62a['options']?_0x48d62a[_0xb736('0x18')]['where']||null:null,'attributes':_0x48d62a[_0xb736('0x18')]?_0x48d62a['options']['attributes']||null:null,'limit':_0x48d62a['options']?_0x48d62a['options'][_0xb736('0x1a')]||null:null,'include':_0x48d62a[_0xb736('0x18')]?_0x48d62a[_0xb736('0x18')][_0xb736('0x1b')]?_['map'](_0x48d62a[_0xb736('0x18')][_0xb736('0x1b')],function(_0x1d76dd){return{'model':db[_0x1d76dd[_0xb736('0x1c')]],'as':_0x1d76dd['as'],'attributes':_0x1d76dd[_0xb736('0x1d')],'include':_0x1d76dd[_0xb736('0x1b')]?_[_0xb736('0x1e')](_0x1d76dd[_0xb736('0x1b')],function(_0x4eca54){return{'model':db[_0x4eca54[_0xb736('0x1c')]],'as':_0x4eca54['as'],'attributes':_0x4eca54['attributes'],'include':_0x4eca54['include']?_['map'](_0x4eca54['include'],function(_0x3a7f60){return{'model':db[_0x3a7f60['model']],'as':_0x3a7f60['as'],'attributes':_0x3a7f60[_0xb736('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb736('0x1f')](function(_0x13d767){logger[_0xb736('0xe')](_0xb736('0x15'),_0x48d62a);logger[_0xb736('0x20')](_0xb736('0x15'),_0x48d62a,JSON['stringify'](_0x13d767));_0x882901(_0x13d767);})[_0xb736('0x21')](function(_0x419288){logger[_0xb736('0x11')](_0xb736('0x15'),_0x419288[_0xb736('0x13')],_0x48d62a);_0xe83e6e(_0x229fa7[_0xb736('0x11')](0x1f4,_0x419288['message']));});});}; \ No newline at end of file +var _0xad8a=['debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetMailServerIn','findAll','options','raw','limit','include','map','model','attributes','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','MailServerIn,\x20%s,\x20%s','request\x20sent'];(function(_0x589df4,_0x20441b){var _0x17c7e4=function(_0xcdd5b3){while(--_0xcdd5b3){_0x589df4['push'](_0x589df4['shift']());}};_0x17c7e4(++_0x20441b);}(_0xad8a,0xb0));var _0xaad8=function(_0x1e5ab9,_0xcf7a59){_0x1e5ab9=_0x1e5ab9-0x0;var _0x7cfd87=_0xad8a[_0x1e5ab9];return _0x7cfd87;};'use strict';var _=require(_0xaad8('0x0'));var util=require(_0xaad8('0x1'));var moment=require(_0xaad8('0x2'));var BPromise=require(_0xaad8('0x3'));var rs=require(_0xaad8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaad8('0x5'))['db'];var utils=require(_0xaad8('0x6'));var logger=require(_0xaad8('0x7'))('rpc');var config=require(_0xaad8('0x8'));var jayson=require(_0xaad8('0x9'));var client=jayson[_0xaad8('0xa')][_0xaad8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x95aef9,_0x39c599,_0x28f3a1){return new BPromise(function(_0xf3a6c7,_0x11408a){return client[_0xaad8('0xc')](_0x95aef9,_0x28f3a1)['then'](function(_0x52477f){logger[_0xaad8('0xd')](_0xaad8('0xe'),_0x39c599,_0xaad8('0xf'));logger[_0xaad8('0x10')](_0xaad8('0x11'),_0x39c599,_0xaad8('0xf'),JSON[_0xaad8('0x12')](_0x52477f));if(_0x52477f[_0xaad8('0x13')]){if(_0x52477f[_0xaad8('0x13')]['code']===0x1f4){logger[_0xaad8('0x13')](_0xaad8('0xe'),_0x39c599,_0x52477f[_0xaad8('0x13')][_0xaad8('0x14')]);return _0x11408a(_0x52477f[_0xaad8('0x13')][_0xaad8('0x14')]);}logger[_0xaad8('0x13')](_0xaad8('0xe'),_0x39c599,_0x52477f[_0xaad8('0x13')][_0xaad8('0x14')]);return _0xf3a6c7(_0x52477f[_0xaad8('0x13')][_0xaad8('0x14')]);}else{logger[_0xaad8('0xd')]('MailServerIn,\x20%s,\x20%s',_0x39c599,_0xaad8('0xf'));_0xf3a6c7(_0x52477f[_0xaad8('0x15')]['message']);}})[_0xaad8('0x16')](function(_0x2a8e12){logger[_0xaad8('0x13')](_0xaad8('0xe'),_0x39c599,_0x2a8e12);_0x11408a(_0x2a8e12);});});}exports[_0xaad8('0x17')]=function(_0x3895e2){var _0x535b82=this;return new Promise(function(_0xfd8b0a,_0x26684c){return db['MailServerIn'][_0xaad8('0x18')]({'raw':_0x3895e2['options']?_0x3895e2[_0xaad8('0x19')][_0xaad8('0x1a')]===undefined?!![]:![]:!![],'where':_0x3895e2[_0xaad8('0x19')]?_0x3895e2[_0xaad8('0x19')]['where']||null:null,'attributes':_0x3895e2[_0xaad8('0x19')]?_0x3895e2[_0xaad8('0x19')]['attributes']||null:null,'limit':_0x3895e2[_0xaad8('0x19')]?_0x3895e2[_0xaad8('0x19')][_0xaad8('0x1b')]||null:null,'include':_0x3895e2['options']?_0x3895e2['options'][_0xaad8('0x1c')]?_[_0xaad8('0x1d')](_0x3895e2[_0xaad8('0x19')][_0xaad8('0x1c')],function(_0x29ba69){return{'model':db[_0x29ba69[_0xaad8('0x1e')]],'as':_0x29ba69['as'],'attributes':_0x29ba69[_0xaad8('0x1f')],'include':_0x29ba69[_0xaad8('0x1c')]?_[_0xaad8('0x1d')](_0x29ba69[_0xaad8('0x1c')],function(_0x1bbac4){return{'model':db[_0x1bbac4[_0xaad8('0x1e')]],'as':_0x1bbac4['as'],'attributes':_0x1bbac4[_0xaad8('0x1f')],'include':_0x1bbac4[_0xaad8('0x1c')]?_[_0xaad8('0x1d')](_0x1bbac4['include'],function(_0x3d254e){return{'model':db[_0x3d254e[_0xaad8('0x1e')]],'as':_0x3d254e['as'],'attributes':_0x3d254e[_0xaad8('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x237c67){logger[_0xaad8('0xd')](_0xaad8('0x17'),_0x3895e2);logger[_0xaad8('0x10')](_0xaad8('0x17'),_0x3895e2,JSON['stringify'](_0x237c67));_0xfd8b0a(_0x237c67);})[_0xaad8('0x16')](function(_0x43c489){logger[_0xaad8('0x13')](_0xaad8('0x17'),_0x43c489[_0xaad8('0x14')],_0x3895e2);_0x26684c(_0x535b82['error'](0x1f4,_0x43c489[_0xaad8('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 12e5cf8..9ef9125 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x7a54,0x106));var _0x47a5=function(_0x2adcfb,_0x1f98f8){_0x2adcfb=_0x2adcfb-0x0;var _0x13245d=_0x7a54[_0x2adcfb];return _0x13245d;};'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 29d80da..6b3b030 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 _0xe53c=['sequelize','STRING'];(function(_0x3550d4,_0xa10bca){var _0x1c8ba1=function(_0x141ac5){while(--_0x141ac5){_0x3550d4['push'](_0x3550d4['shift']());}};_0x1c8ba1(++_0xa10bca);}(_0xe53c,0x184));var _0xce53=function(_0x4e33c0,_0x555fda){_0x4e33c0=_0x4e33c0-0x0;var _0x1f7aa3=_0xe53c[_0x4e33c0];return _0x1f7aa3;};'use strict';var Sequelize=require(_0xce53('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0xce53('0x1')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0xce53('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x5f1f=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x3f9612,_0x3a561d){var _0x4c2905=function(_0x46384b){while(--_0x46384b){_0x3f9612['push'](_0x3f9612['shift']());}};_0x4c2905(++_0x3a561d);}(_0x5f1f,0x129));var _0xf5f1=function(_0xe779,_0x1a1b29){_0xe779=_0xe779-0x0;var _0x5201de=_0x5f1f[_0xe779];return _0x5201de;};'use strict';var Sequelize=require(_0xf5f1('0x0'));module[_0xf5f1('0x1')]={'description':{'type':Sequelize[_0xf5f1('0x2')]},'host':{'type':Sequelize[_0xf5f1('0x2')]},'user':{'type':Sequelize[_0xf5f1('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xf5f1('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xf5f1('0x4')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index d0ed1f8..967b45b 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 _0x0887=['options','include','findAll','rows','catch','params','keys','rawAttributes','length','includeAll','find','create','body','eml-format','zip-dir','request-promise','moment','bluebird','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','MailServerOut','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','merge','where','VIRTUAL','filter'];(function(_0x122e42,_0x222609){var _0x4c019e=function(_0x3036dd){while(--_0x3036dd){_0x122e42['push'](_0x122e42['shift']());}};_0x4c019e(++_0x222609);}(_0x0887,0x17a));var _0x7088=function(_0x4d7c86,_0x9b62a6){_0x4d7c86=_0x4d7c86-0x0;var _0x59443d=_0x0887[_0x4d7c86];return _0x59443d;};'use strict';var emlformat=require(_0x7088('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7088('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7088('0x2'));var moment=require(_0x7088('0x3'));var BPromise=require(_0x7088('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7088('0x5'));var sox=require(_0x7088('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7088('0x7'));var _=require(_0x7088('0x8'));var squel=require(_0x7088('0x9'));var crypto=require(_0x7088('0xa'));var jsforce=require(_0x7088('0xb'));var deskjs=require(_0x7088('0xc'));var toCsv=require(_0x7088('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7088('0xe'));var authService=require(_0x7088('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7088('0x10'))(_0x7088('0x11'));var utils=require(_0x7088('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x7088('0x13'));var db=require(_0x7088('0x14'))['db'];function respondWithStatusCode(_0x189cc4,_0x10cefa){_0x10cefa=_0x10cefa||0xcc;return function(_0x3dffb6){if(_0x3dffb6){return _0x189cc4[_0x7088('0x15')](_0x10cefa);}return _0x189cc4[_0x7088('0x16')](_0x10cefa)[_0x7088('0x17')]();};}function respondWithResult(_0x30cdc0,_0x43bd1e){_0x43bd1e=_0x43bd1e||0xc8;return function(_0x4988ee){if(_0x4988ee){return _0x30cdc0[_0x7088('0x16')](_0x43bd1e)[_0x7088('0x18')](_0x4988ee);}};}function respondWithFilteredResult(_0xef0549,_0x297b47){return function(_0x56ffa8){if(_0x56ffa8){var _0x59708a=typeof _0x297b47[_0x7088('0x19')]===_0x7088('0x1a')&&typeof _0x297b47[_0x7088('0x1b')]==='undefined';var _0x481d2b=_0x56ffa8[_0x7088('0x1c')];var _0x5a9fd3=_0x59708a?0x0:_0x297b47[_0x7088('0x19')];var _0x203ebb=_0x59708a?_0x56ffa8['count']:_0x297b47[_0x7088('0x19')]+_0x297b47[_0x7088('0x1b')];var _0x417627;if(_0x203ebb>=_0x481d2b){_0x203ebb=_0x481d2b;_0x417627=0xc8;}else{_0x417627=0xce;}_0xef0549[_0x7088('0x16')](_0x417627);return _0xef0549[_0x7088('0x1d')](_0x7088('0x1e'),_0x5a9fd3+'-'+_0x203ebb+'/'+_0x481d2b)['json'](_0x56ffa8);}return null;};}function patchUpdates(_0x4594da){return function(_0x27cb49){try{jsonpatch[_0x7088('0x1f')](_0x27cb49,_0x4594da,!![]);}catch(_0x4985e0){return BPromise[_0x7088('0x20')](_0x4985e0);}return _0x27cb49['save']();};}function saveUpdates(_0x50d40a,_0x3ed0f6){return function(_0x155cd1){if(_0x155cd1){return _0x155cd1[_0x7088('0x21')](_0x50d40a)[_0x7088('0x22')](function(_0x1e1d7f){return _0x1e1d7f;});}return null;};}function removeEntity(_0x1b8b08,_0x20c4e3){return function(_0xed648e){if(_0xed648e){return _0xed648e[_0x7088('0x23')]()[_0x7088('0x22')](function(){_0x1b8b08['status'](0xcc)[_0x7088('0x17')]();});}};}function handleEntityNotFound(_0x3d3d51,_0x31e566){return function(_0x2f717d){if(!_0x2f717d){_0x3d3d51[_0x7088('0x15')](0x194);}return _0x2f717d;};}function handleError(_0x4803a5,_0x548e33){_0x548e33=_0x548e33||0x1f4;return function(_0x47a58f){logger[_0x7088('0x24')](_0x47a58f[_0x7088('0x25')]);if(_0x47a58f[_0x7088('0x26')]){delete _0x47a58f[_0x7088('0x26')];}_0x4803a5[_0x7088('0x16')](_0x548e33)[_0x7088('0x27')](_0x47a58f);};}exports[_0x7088('0x28')]=function(_0x51f606,_0x129dea){var _0x1ea5d7={},_0x1cb476={},_0x26e3fd={'count':0x0,'rows':[]};var _0xa70cef=_[_0x7088('0x29')](db[_0x7088('0x2a')]['rawAttributes'],function(_0x43e32b){return{'name':_0x43e32b['fieldName'],'type':_0x43e32b[_0x7088('0x2b')][_0x7088('0x2c')]};});_0x1cb476[_0x7088('0x2d')]=_[_0x7088('0x29')](_0xa70cef,_0x7088('0x26'));_0x1cb476[_0x7088('0x2e')]=_['keys'](_0x51f606['query']);_0x1cb476['filters']=_[_0x7088('0x2f')](_0x1cb476[_0x7088('0x2d')],_0x1cb476[_0x7088('0x2e')]);_0x1ea5d7[_0x7088('0x30')]=_['intersection'](_0x1cb476[_0x7088('0x2d')],qs[_0x7088('0x31')](_0x51f606[_0x7088('0x2e')][_0x7088('0x31')]));_0x1ea5d7[_0x7088('0x30')]=_0x1ea5d7[_0x7088('0x30')]['length']?_0x1ea5d7[_0x7088('0x30')]:_0x1cb476[_0x7088('0x2d')];if(!_0x51f606[_0x7088('0x2e')][_0x7088('0x32')](_0x7088('0x33'))){_0x1ea5d7[_0x7088('0x1b')]=qs[_0x7088('0x1b')](_0x51f606[_0x7088('0x2e')]['limit']);_0x1ea5d7[_0x7088('0x19')]=qs[_0x7088('0x19')](_0x51f606[_0x7088('0x2e')]['offset']);}_0x1ea5d7[_0x7088('0x34')]=qs['sort'](_0x51f606[_0x7088('0x2e')][_0x7088('0x35')]);_0x1ea5d7['where']=qs[_0x7088('0x36')](_[_0x7088('0x37')](_0x51f606[_0x7088('0x2e')],_0x1cb476[_0x7088('0x36')]),_0xa70cef);if(_0x51f606[_0x7088('0x2e')]['filter']){_0x1ea5d7['where']=_[_0x7088('0x38')](_0x1ea5d7[_0x7088('0x39')],{'$or':_[_0x7088('0x29')](_0xa70cef,function(_0x23d6be){if(_0x23d6be[_0x7088('0x2b')]!==_0x7088('0x3a')){var _0x3f5826={};_0x3f5826[_0x23d6be[_0x7088('0x26')]]={'$like':'%'+_0x51f606[_0x7088('0x2e')][_0x7088('0x3b')]+'%'};return _0x3f5826;}})});}_0x1ea5d7=_[_0x7088('0x38')]({},_0x1ea5d7,_0x51f606[_0x7088('0x3c')]);var _0x361a8c={'where':_0x1ea5d7['where']};return db['MailServerOut'][_0x7088('0x1c')](_0x361a8c)[_0x7088('0x22')](function(_0x12f60e){_0x26e3fd[_0x7088('0x1c')]=_0x12f60e;if(_0x51f606[_0x7088('0x2e')]['includeAll']){_0x1ea5d7[_0x7088('0x3d')]=[{'all':!![]}];}return db[_0x7088('0x2a')][_0x7088('0x3e')](_0x1ea5d7);})[_0x7088('0x22')](function(_0x504196){_0x26e3fd[_0x7088('0x3f')]=_0x504196;return _0x26e3fd;})[_0x7088('0x22')](respondWithFilteredResult(_0x129dea,_0x1ea5d7))[_0x7088('0x40')](handleError(_0x129dea,null));};exports['show']=function(_0x476cec,_0x5bfc59){var _0x1353b7={'raw':!![],'where':{'id':_0x476cec[_0x7088('0x41')]['id']}},_0x4bf0be={};_0x4bf0be['model']=_[_0x7088('0x42')](db['MailServerOut'][_0x7088('0x43')]);_0x4bf0be[_0x7088('0x2e')]=_[_0x7088('0x42')](_0x476cec[_0x7088('0x2e')]);_0x4bf0be['filters']=_[_0x7088('0x2f')](_0x4bf0be[_0x7088('0x2d')],_0x4bf0be[_0x7088('0x2e')]);_0x1353b7['attributes']=_[_0x7088('0x2f')](_0x4bf0be[_0x7088('0x2d')],qs[_0x7088('0x31')](_0x476cec['query'][_0x7088('0x31')]));_0x1353b7['attributes']=_0x1353b7['attributes'][_0x7088('0x44')]?_0x1353b7[_0x7088('0x30')]:_0x4bf0be[_0x7088('0x2d')];if(_0x476cec[_0x7088('0x2e')][_0x7088('0x45')]){_0x1353b7[_0x7088('0x3d')]=[{'all':!![]}];}_0x1353b7=_[_0x7088('0x38')]({},_0x1353b7,_0x476cec[_0x7088('0x3c')]);return db[_0x7088('0x2a')][_0x7088('0x46')](_0x1353b7)['then'](handleEntityNotFound(_0x5bfc59,null))[_0x7088('0x22')](respondWithResult(_0x5bfc59,null))['catch'](handleError(_0x5bfc59,null));};exports[_0x7088('0x47')]=function(_0x58b38d,_0x2dc669){return db[_0x7088('0x2a')][_0x7088('0x47')](_0x58b38d['body'],{})[_0x7088('0x22')](respondWithResult(_0x2dc669,0xc9))['catch'](handleError(_0x2dc669,null));};exports[_0x7088('0x21')]=function(_0x4827a6,_0xa11ecf){if(_0x4827a6['body']['id']){delete _0x4827a6['body']['id'];}return db['MailServerOut']['find']({'where':{'id':_0x4827a6[_0x7088('0x41')]['id']}})['then'](handleEntityNotFound(_0xa11ecf,null))[_0x7088('0x22')](saveUpdates(_0x4827a6[_0x7088('0x48')],null))[_0x7088('0x22')](respondWithResult(_0xa11ecf,null))[_0x7088('0x40')](handleError(_0xa11ecf,null));};exports[_0x7088('0x23')]=function(_0x3d5396,_0x35420b){return db['MailServerOut']['find']({'where':{'id':_0x3d5396[_0x7088('0x41')]['id']}})[_0x7088('0x22')](handleEntityNotFound(_0x35420b,null))[_0x7088('0x22')](removeEntity(_0x35420b,null))[_0x7088('0x40')](handleError(_0x35420b,null));}; \ No newline at end of file +var _0xb562=['sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','options','MailServerOut','include','findAll','rows','catch','show','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x14d8d8,_0x3cc29e){var _0x2dab4b=function(_0x2aa561){while(--_0x2aa561){_0x14d8d8['push'](_0x14d8d8['shift']());}};_0x2dab4b(++_0x3cc29e);}(_0xb562,0xc6));var _0x2b56=function(_0x3c6afe,_0x432ff9){_0x3c6afe=_0x3c6afe-0x0;var _0x3e98b=_0xb562[_0x3c6afe];return _0x3e98b;};'use strict';var emlformat=require(_0x2b56('0x0'));var rimraf=require(_0x2b56('0x1'));var zipdir=require(_0x2b56('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2b56('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2b56('0x4'));var util=require(_0x2b56('0x5'));var path=require(_0x2b56('0x6'));var sox=require('sox');var csv=require(_0x2b56('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2b56('0x8'));var _=require(_0x2b56('0x9'));var squel=require(_0x2b56('0xa'));var crypto=require('crypto');var jsforce=require(_0x2b56('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x2b56('0x7'));var querystring=require(_0x2b56('0xc'));var Papa=require(_0x2b56('0xd'));var Redis=require(_0x2b56('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x2b56('0xf'));var as=require(_0x2b56('0x10'));var hardwareService=require(_0x2b56('0x11'));var logger=require(_0x2b56('0x12'))(_0x2b56('0x13'));var utils=require(_0x2b56('0x14'));var config=require(_0x2b56('0x15'));var licenseUtil=require(_0x2b56('0x16'));var db=require(_0x2b56('0x17'))['db'];function respondWithStatusCode(_0x346a8f,_0xc99ae){_0xc99ae=_0xc99ae||0xcc;return function(_0x3b9e95){if(_0x3b9e95){return _0x346a8f[_0x2b56('0x18')](_0xc99ae);}return _0x346a8f[_0x2b56('0x19')](_0xc99ae)[_0x2b56('0x1a')]();};}function respondWithResult(_0x452d06,_0x3b4233){_0x3b4233=_0x3b4233||0xc8;return function(_0x1c343f){if(_0x1c343f){return _0x452d06['status'](_0x3b4233)[_0x2b56('0x1b')](_0x1c343f);}};}function respondWithFilteredResult(_0x1ba739,_0x15fb80){return function(_0x51667d){if(_0x51667d){var _0x1773e6=typeof _0x15fb80[_0x2b56('0x1c')]===_0x2b56('0x1d')&&typeof _0x15fb80['limit']===_0x2b56('0x1d');var _0x34d670=_0x51667d[_0x2b56('0x1e')];var _0x32c2f0=_0x1773e6?0x0:_0x15fb80[_0x2b56('0x1c')];var _0x2d7d74=_0x1773e6?_0x51667d[_0x2b56('0x1e')]:_0x15fb80[_0x2b56('0x1c')]+_0x15fb80[_0x2b56('0x1f')];var _0x368f56;if(_0x2d7d74>=_0x34d670){_0x2d7d74=_0x34d670;_0x368f56=0xc8;}else{_0x368f56=0xce;}_0x1ba739[_0x2b56('0x19')](_0x368f56);return _0x1ba739[_0x2b56('0x20')](_0x2b56('0x21'),_0x32c2f0+'-'+_0x2d7d74+'/'+_0x34d670)[_0x2b56('0x1b')](_0x51667d);}return null;};}function patchUpdates(_0x1d6de6){return function(_0xf0527b){try{jsonpatch[_0x2b56('0x22')](_0xf0527b,_0x1d6de6,!![]);}catch(_0x24ca9e){return BPromise['reject'](_0x24ca9e);}return _0xf0527b['save']();};}function saveUpdates(_0x38384a,_0x218731){return function(_0x20cd63){if(_0x20cd63){return _0x20cd63[_0x2b56('0x23')](_0x38384a)[_0x2b56('0x24')](function(_0xf243b0){return _0xf243b0;});}return null;};}function removeEntity(_0x17228c,_0x1bcad3){return function(_0x2b00af){if(_0x2b00af){return _0x2b00af[_0x2b56('0x25')]()[_0x2b56('0x24')](function(){_0x17228c[_0x2b56('0x19')](0xcc)[_0x2b56('0x1a')]();});}};}function handleEntityNotFound(_0x5e0a2f,_0x37d78d){return function(_0x1b1bc8){if(!_0x1b1bc8){_0x5e0a2f[_0x2b56('0x18')](0x194);}return _0x1b1bc8;};}function handleError(_0x5ea37e,_0x2856da){_0x2856da=_0x2856da||0x1f4;return function(_0x576cf9){logger[_0x2b56('0x26')](_0x576cf9[_0x2b56('0x27')]);if(_0x576cf9[_0x2b56('0x28')]){delete _0x576cf9[_0x2b56('0x28')];}_0x5ea37e[_0x2b56('0x19')](_0x2856da)[_0x2b56('0x29')](_0x576cf9);};}exports[_0x2b56('0x2a')]=function(_0xf4e094,_0x394334){var _0x1a6d2a={},_0x475c27={},_0x426892={'count':0x0,'rows':[]};var _0x509472=_['map'](db['MailServerOut'][_0x2b56('0x2b')],function(_0x193ef3){return{'name':_0x193ef3['fieldName'],'type':_0x193ef3[_0x2b56('0x2c')][_0x2b56('0x2d')]};});_0x475c27[_0x2b56('0x2e')]=_[_0x2b56('0x2f')](_0x509472,'name');_0x475c27[_0x2b56('0x30')]=_[_0x2b56('0x31')](_0xf4e094[_0x2b56('0x30')]);_0x475c27[_0x2b56('0x32')]=_[_0x2b56('0x33')](_0x475c27[_0x2b56('0x2e')],_0x475c27[_0x2b56('0x30')]);_0x1a6d2a['attributes']=_[_0x2b56('0x33')](_0x475c27[_0x2b56('0x2e')],qs['fields'](_0xf4e094['query'][_0x2b56('0x34')]));_0x1a6d2a[_0x2b56('0x35')]=_0x1a6d2a[_0x2b56('0x35')][_0x2b56('0x36')]?_0x1a6d2a[_0x2b56('0x35')]:_0x475c27[_0x2b56('0x2e')];if(!_0xf4e094[_0x2b56('0x30')][_0x2b56('0x37')]('nolimit')){_0x1a6d2a['limit']=qs[_0x2b56('0x1f')](_0xf4e094[_0x2b56('0x30')]['limit']);_0x1a6d2a[_0x2b56('0x1c')]=qs[_0x2b56('0x1c')](_0xf4e094['query'][_0x2b56('0x1c')]);}_0x1a6d2a[_0x2b56('0x38')]=qs['sort'](_0xf4e094['query']['sort']);_0x1a6d2a[_0x2b56('0x39')]=qs[_0x2b56('0x32')](_[_0x2b56('0x3a')](_0xf4e094[_0x2b56('0x30')],_0x475c27[_0x2b56('0x32')]),_0x509472);if(_0xf4e094[_0x2b56('0x30')][_0x2b56('0x3b')]){_0x1a6d2a[_0x2b56('0x39')]=_[_0x2b56('0x3c')](_0x1a6d2a[_0x2b56('0x39')],{'$or':_[_0x2b56('0x2f')](_0x509472,function(_0x4e51b5){if(_0x4e51b5[_0x2b56('0x2c')]!==_0x2b56('0x3d')){var _0x562638={};_0x562638[_0x4e51b5['name']]={'$like':'%'+_0xf4e094['query'][_0x2b56('0x3b')]+'%'};return _0x562638;}})});}_0x1a6d2a=_[_0x2b56('0x3c')]({},_0x1a6d2a,_0xf4e094[_0x2b56('0x3e')]);var _0x20d47b={'where':_0x1a6d2a['where']};return db[_0x2b56('0x3f')][_0x2b56('0x1e')](_0x20d47b)[_0x2b56('0x24')](function(_0x4552ea){_0x426892['count']=_0x4552ea;if(_0xf4e094[_0x2b56('0x30')]['includeAll']){_0x1a6d2a[_0x2b56('0x40')]=[{'all':!![]}];}return db[_0x2b56('0x3f')][_0x2b56('0x41')](_0x1a6d2a);})[_0x2b56('0x24')](function(_0xb398bd){_0x426892[_0x2b56('0x42')]=_0xb398bd;return _0x426892;})[_0x2b56('0x24')](respondWithFilteredResult(_0x394334,_0x1a6d2a))[_0x2b56('0x43')](handleError(_0x394334,null));};exports[_0x2b56('0x44')]=function(_0x1186c9,_0x24c84e){var _0x3bce89={'raw':!![],'where':{'id':_0x1186c9[_0x2b56('0x45')]['id']}},_0x370d5e={};_0x370d5e[_0x2b56('0x2e')]=_[_0x2b56('0x31')](db['MailServerOut'][_0x2b56('0x2b')]);_0x370d5e[_0x2b56('0x30')]=_[_0x2b56('0x31')](_0x1186c9[_0x2b56('0x30')]);_0x370d5e['filters']=_[_0x2b56('0x33')](_0x370d5e[_0x2b56('0x2e')],_0x370d5e[_0x2b56('0x30')]);_0x3bce89[_0x2b56('0x35')]=_[_0x2b56('0x33')](_0x370d5e[_0x2b56('0x2e')],qs[_0x2b56('0x34')](_0x1186c9[_0x2b56('0x30')]['fields']));_0x3bce89[_0x2b56('0x35')]=_0x3bce89['attributes']['length']?_0x3bce89[_0x2b56('0x35')]:_0x370d5e[_0x2b56('0x2e')];if(_0x1186c9[_0x2b56('0x30')][_0x2b56('0x46')]){_0x3bce89[_0x2b56('0x40')]=[{'all':!![]}];}_0x3bce89=_[_0x2b56('0x3c')]({},_0x3bce89,_0x1186c9[_0x2b56('0x3e')]);return db[_0x2b56('0x3f')][_0x2b56('0x47')](_0x3bce89)[_0x2b56('0x24')](handleEntityNotFound(_0x24c84e,null))[_0x2b56('0x24')](respondWithResult(_0x24c84e,null))[_0x2b56('0x43')](handleError(_0x24c84e,null));};exports[_0x2b56('0x48')]=function(_0x55acba,_0x495320){return db[_0x2b56('0x3f')][_0x2b56('0x48')](_0x55acba[_0x2b56('0x49')],{})[_0x2b56('0x24')](respondWithResult(_0x495320,0xc9))['catch'](handleError(_0x495320,null));};exports[_0x2b56('0x23')]=function(_0x1efa36,_0x1b4bf9){if(_0x1efa36[_0x2b56('0x49')]['id']){delete _0x1efa36['body']['id'];}return db[_0x2b56('0x3f')][_0x2b56('0x47')]({'where':{'id':_0x1efa36['params']['id']}})[_0x2b56('0x24')](handleEntityNotFound(_0x1b4bf9,null))[_0x2b56('0x24')](saveUpdates(_0x1efa36[_0x2b56('0x49')],null))['then'](respondWithResult(_0x1b4bf9,null))[_0x2b56('0x43')](handleError(_0x1b4bf9,null));};exports['destroy']=function(_0x546c21,_0x40b1a9){return db[_0x2b56('0x3f')][_0x2b56('0x47')]({'where':{'id':_0x546c21[_0x2b56('0x45')]['id']}})[_0x2b56('0x24')](handleEntityNotFound(_0x40b1a9,null))['then'](removeEntity(_0x40b1a9,null))[_0x2b56('0x43')](handleError(_0x40b1a9,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 3d25eb2..4a63992 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 _0x90f2=['mail_servers_out','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut'];(function(_0x3d0d25,_0x108611){var _0x3973d1=function(_0x2231f3){while(--_0x2231f3){_0x3d0d25['push'](_0x3d0d25['shift']());}};_0x3973d1(++_0x108611);}(_0x90f2,0x9b));var _0x290f=function(_0x4a0434,_0x52c3d1){_0x4a0434=_0x4a0434-0x0;var _0x52dccb=_0x90f2[_0x4a0434];return _0x52dccb;};'use strict';var _=require(_0x290f('0x0'));var util=require('util');var logger=require(_0x290f('0x1'))(_0x290f('0x2'));var moment=require(_0x290f('0x3'));var BPromise=require(_0x290f('0x4'));var rp=require(_0x290f('0x5'));var fs=require('fs');var path=require(_0x290f('0x6'));var rimraf=require(_0x290f('0x7'));var config=require(_0x290f('0x8'));var attributes=require(_0x290f('0x9'));module[_0x290f('0xa')]=function(_0x1dfc97,_0x17546c){return _0x1dfc97[_0x290f('0xb')](_0x290f('0xc'),attributes,{'tableName':_0x290f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6a89=['define','mail_servers_out','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','exports'];(function(_0x15ea5d,_0x2715e7){var _0x182bde=function(_0x25df07){while(--_0x25df07){_0x15ea5d['push'](_0x15ea5d['shift']());}};_0x182bde(++_0x2715e7);}(_0x6a89,0xde));var _0x96a8=function(_0x217f5b,_0x409e18){_0x217f5b=_0x217f5b-0x0;var _0xee47dd=_0x6a89[_0x217f5b];return _0xee47dd;};'use strict';var _=require(_0x96a8('0x0'));var util=require(_0x96a8('0x1'));var logger=require(_0x96a8('0x2'))('api');var moment=require(_0x96a8('0x3'));var BPromise=require('bluebird');var rp=require(_0x96a8('0x4'));var fs=require('fs');var path=require(_0x96a8('0x5'));var rimraf=require('rimraf');var config=require(_0x96a8('0x6'));var attributes=require('./mailServerOut.attributes');module[_0x96a8('0x7')]=function(_0x3cf7cf,_0x4aea98){return _0x3cf7cf[_0x96a8('0x8')]('MailServerOut',attributes,{'tableName':_0x96a8('0x9'),'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 0485115..e78a189 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 _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x1dde4d,_0xf1b0f){var _0x52b658=function(_0x1b2669){while(--_0x1b2669){_0x1dde4d['push'](_0x1dde4d['shift']());}};_0x52b658(++_0xf1b0f);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x5f66[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('MailServerOut,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x13ccc7,_0x14b81c){var _0x5cbc61=function(_0x12176e){while(--_0x12176e){_0x13ccc7['push'](_0x13ccc7['shift']());}};_0x5cbc61(++_0x14b81c);}(_0xdb28,0x106));var _0x8db2=function(_0x21b11a,_0x546027){_0x21b11a=_0x21b11a-0x0;var _0x2fe271=_0xdb28[_0x21b11a];return _0x2fe271;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index dfdf431..e63f058 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 _0x4a05=['index','/describe','/:id','isAuthenticated','show','post','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get'];(function(_0x5d683e,_0x386a3b){var _0x52805f=function(_0x490930){while(--_0x490930){_0x5d683e['push'](_0x5d683e['shift']());}};_0x52805f(++_0x386a3b);}(_0x4a05,0x15e));var _0x54a0=function(_0x1a64f3,_0x4b2b6b){_0x1a64f3=_0x1a64f3-0x0;var _0x37d68f=_0x4a05[_0x1a64f3];return _0x37d68f;};'use strict';var multer=require(_0x54a0('0x0'));var util=require('util');var path=require(_0x54a0('0x1'));var timeout=require(_0x54a0('0x2'));var express=require(_0x54a0('0x3'));var router=express[_0x54a0('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x54a0('0x5'));var interaction=require(_0x54a0('0x6'));var config=require(_0x54a0('0x7'));var controller=require(_0x54a0('0x8'));router[_0x54a0('0x9')]('/',auth['isAuthenticated'](),controller[_0x54a0('0xa')]);router[_0x54a0('0x9')](_0x54a0('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x54a0('0x9')](_0x54a0('0xc'),auth[_0x54a0('0xd')](),controller[_0x54a0('0xe')]);router[_0x54a0('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x54a0('0x10')](_0x54a0('0xc'),auth[_0x54a0('0xd')](),controller['update']);router[_0x54a0('0x11')](_0x54a0('0xc'),auth[_0x54a0('0xd')](),controller[_0x54a0('0x12')]);module[_0x54a0('0x13')]=router; \ No newline at end of file +var _0xf4a2=['index','describe','show','update','/:id','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','isAuthenticated'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf4a2,0x16e));var _0x2f4a=function(_0x290694,_0x281935){_0x290694=_0x290694-0x0;var _0x5a0f2e=_0xf4a2[_0x290694];return _0x5a0f2e;};'use strict';var multer=require(_0x2f4a('0x0'));var util=require(_0x2f4a('0x1'));var path=require(_0x2f4a('0x2'));var timeout=require(_0x2f4a('0x3'));var express=require(_0x2f4a('0x4'));var router=express[_0x2f4a('0x5')]();var fs_extra=require(_0x2f4a('0x6'));var auth=require(_0x2f4a('0x7'));var interaction=require(_0x2f4a('0x8'));var config=require(_0x2f4a('0x9'));var controller=require(_0x2f4a('0xa'));router['get']('/',auth[_0x2f4a('0xb')](),controller[_0x2f4a('0xc')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x2f4a('0xd')]);router['get']('/:id',auth[_0x2f4a('0xb')](),controller[_0x2f4a('0xe')]);router['post']('/',auth[_0x2f4a('0xb')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x2f4a('0xf')]);router['delete'](_0x2f4a('0x10'),auth[_0x2f4a('0xb')](),controller[_0x2f4a('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index e588911..04fc510 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 _0xa46e=['name','STRING','sequelize','exports'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xa46e,0x8a));var _0xea46=function(_0x122d9f,_0x2c9e5b){_0x122d9f=_0x122d9f-0x0;var _0x41a09e=_0xa46e[_0x122d9f];return _0x41a09e;};'use strict';var Sequelize=require(_0xea46('0x0'));module[_0xea46('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xea46('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xea46('0x3')]}}; \ No newline at end of file +var _0x0e4b=['STRING','sequelize','exports'];(function(_0x507965,_0x4944f4){var _0x3608fc=function(_0x14c8d0){while(--_0x14c8d0){_0x507965['push'](_0x507965['shift']());}};_0x3608fc(++_0x4944f4);}(_0x0e4b,0xdc));var _0xb0e4=function(_0x46fbb4,_0x549ac1){_0x46fbb4=_0x46fbb4-0x0;var _0x5b82c2=_0x0e4b[_0x46fbb4];return _0x5b82c2;};'use strict';var Sequelize=require(_0xb0e4('0x0'));module[_0xb0e4('0x1')]={'name':{'type':Sequelize[_0xb0e4('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb0e4('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 052329d..fac4f84 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 _0x76d4=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','stack','name','send','index','MailSubstatus','rawAttributes','fieldName','type','model','map','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x331fb4,_0x41fff7){var _0x4c3eab=function(_0x1126ae){while(--_0x1126ae){_0x331fb4['push'](_0x331fb4['shift']());}};_0x4c3eab(++_0x41fff7);}(_0x76d4,0x16a));var _0x476d=function(_0x127ddf,_0x166f90){_0x127ddf=_0x127ddf-0x0;var _0x520c50=_0x76d4[_0x127ddf];return _0x520c50;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x476d('0x0'));var zipdir=require(_0x476d('0x1'));var jsonpatch=require(_0x476d('0x2'));var rp=require(_0x476d('0x3'));var moment=require(_0x476d('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x476d('0x5'));var path=require(_0x476d('0x6'));var sox=require('sox');var csv=require(_0x476d('0x7'));var ejs=require(_0x476d('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x476d('0x9'));var crypto=require(_0x476d('0xa'));var jsforce=require(_0x476d('0xb'));var deskjs=require(_0x476d('0xc'));var toCsv=require(_0x476d('0x7'));var querystring=require('querystring');var Papa=require(_0x476d('0xd'));var Redis=require('ioredis');var authService=require(_0x476d('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x476d('0xf'));var hardwareService=require(_0x476d('0x10'));var logger=require(_0x476d('0x11'))(_0x476d('0x12'));var utils=require(_0x476d('0x13'));var config=require(_0x476d('0x14'));var licenseUtil=require(_0x476d('0x15'));var db=require(_0x476d('0x16'))['db'];function respondWithStatusCode(_0x1c838a,_0x3cfe23){_0x3cfe23=_0x3cfe23||0xcc;return function(_0x335a29){if(_0x335a29){return _0x1c838a[_0x476d('0x17')](_0x3cfe23);}return _0x1c838a['status'](_0x3cfe23)[_0x476d('0x18')]();};}function respondWithResult(_0x87a74,_0xf24e1d){_0xf24e1d=_0xf24e1d||0xc8;return function(_0x301a2f){if(_0x301a2f){return _0x87a74[_0x476d('0x19')](_0xf24e1d)[_0x476d('0x1a')](_0x301a2f);}};}function respondWithFilteredResult(_0x573a2e,_0x522f6c){return function(_0x369140){if(_0x369140){var _0x4c34f4=typeof _0x522f6c[_0x476d('0x1b')]===_0x476d('0x1c')&&typeof _0x522f6c[_0x476d('0x1d')]===_0x476d('0x1c');var _0xf081c5=_0x369140[_0x476d('0x1e')];var _0x1bfecf=_0x4c34f4?0x0:_0x522f6c['offset'];var _0x333a4f=_0x4c34f4?_0x369140['count']:_0x522f6c[_0x476d('0x1b')]+_0x522f6c[_0x476d('0x1d')];var _0x385838;if(_0x333a4f>=_0xf081c5){_0x333a4f=_0xf081c5;_0x385838=0xc8;}else{_0x385838=0xce;}_0x573a2e['status'](_0x385838);return _0x573a2e['set'](_0x476d('0x1f'),_0x1bfecf+'-'+_0x333a4f+'/'+_0xf081c5)[_0x476d('0x1a')](_0x369140);}return null;};}function patchUpdates(_0x352756){return function(_0x3be103){try{jsonpatch[_0x476d('0x20')](_0x3be103,_0x352756,!![]);}catch(_0xc150d){return BPromise[_0x476d('0x21')](_0xc150d);}return _0x3be103[_0x476d('0x22')]();};}function saveUpdates(_0x11ab3b,_0x52f652){return function(_0x502d59){if(_0x502d59){return _0x502d59[_0x476d('0x23')](_0x11ab3b)[_0x476d('0x24')](function(_0x25c8d7){return _0x25c8d7;});}return null;};}function removeEntity(_0x28243f,_0x474902){return function(_0x340175){if(_0x340175){return _0x340175['destroy']()[_0x476d('0x24')](function(){_0x28243f[_0x476d('0x19')](0xcc)[_0x476d('0x18')]();});}};}function handleEntityNotFound(_0x2ef09f,_0x12c053){return function(_0x47754c){if(!_0x47754c){_0x2ef09f[_0x476d('0x17')](0x194);}return _0x47754c;};}function handleError(_0x4caa6a,_0x4b1e60){_0x4b1e60=_0x4b1e60||0x1f4;return function(_0x46ea6e){logger['error'](_0x46ea6e[_0x476d('0x25')]);if(_0x46ea6e[_0x476d('0x26')]){delete _0x46ea6e[_0x476d('0x26')];}_0x4caa6a[_0x476d('0x19')](_0x4b1e60)[_0x476d('0x27')](_0x46ea6e);};}exports[_0x476d('0x28')]=function(_0x5bd2c6,_0x5453e7){var _0x2dc69b={},_0x4b956b={},_0x1bd7b0={'count':0x0,'rows':[]};var _0xded95b=_['map'](db[_0x476d('0x29')][_0x476d('0x2a')],function(_0xec6dfd){return{'name':_0xec6dfd[_0x476d('0x2b')],'type':_0xec6dfd[_0x476d('0x2c')]['key']};});_0x4b956b[_0x476d('0x2d')]=_[_0x476d('0x2e')](_0xded95b,_0x476d('0x26'));_0x4b956b[_0x476d('0x2f')]=_['keys'](_0x5bd2c6[_0x476d('0x2f')]);_0x4b956b['filters']=_['intersection'](_0x4b956b[_0x476d('0x2d')],_0x4b956b[_0x476d('0x2f')]);_0x2dc69b[_0x476d('0x30')]=_[_0x476d('0x31')](_0x4b956b[_0x476d('0x2d')],qs[_0x476d('0x32')](_0x5bd2c6[_0x476d('0x2f')][_0x476d('0x32')]));_0x2dc69b[_0x476d('0x30')]=_0x2dc69b['attributes']['length']?_0x2dc69b[_0x476d('0x30')]:_0x4b956b[_0x476d('0x2d')];if(!_0x5bd2c6[_0x476d('0x2f')][_0x476d('0x33')](_0x476d('0x34'))){_0x2dc69b[_0x476d('0x1d')]=qs[_0x476d('0x1d')](_0x5bd2c6[_0x476d('0x2f')][_0x476d('0x1d')]);_0x2dc69b[_0x476d('0x1b')]=qs[_0x476d('0x1b')](_0x5bd2c6['query'][_0x476d('0x1b')]);}_0x2dc69b[_0x476d('0x35')]=qs[_0x476d('0x36')](_0x5bd2c6['query'][_0x476d('0x36')]);_0x2dc69b[_0x476d('0x37')]=qs[_0x476d('0x38')](_[_0x476d('0x39')](_0x5bd2c6['query'],_0x4b956b[_0x476d('0x38')]),_0xded95b);if(_0x5bd2c6[_0x476d('0x2f')][_0x476d('0x3a')]){_0x2dc69b['where']=_[_0x476d('0x3b')](_0x2dc69b[_0x476d('0x37')],{'$or':_['map'](_0xded95b,function(_0x5326ae){if(_0x5326ae[_0x476d('0x2c')]!==_0x476d('0x3c')){var _0x3e4686={};_0x3e4686[_0x5326ae[_0x476d('0x26')]]={'$like':'%'+_0x5bd2c6['query'][_0x476d('0x3a')]+'%'};return _0x3e4686;}})});}_0x2dc69b=_[_0x476d('0x3b')]({},_0x2dc69b,_0x5bd2c6[_0x476d('0x3d')]);var _0x3aef3f={'where':_0x2dc69b[_0x476d('0x37')]};return db[_0x476d('0x29')][_0x476d('0x1e')](_0x3aef3f)[_0x476d('0x24')](function(_0x432550){_0x1bd7b0[_0x476d('0x1e')]=_0x432550;if(_0x5bd2c6[_0x476d('0x2f')][_0x476d('0x3e')]){_0x2dc69b[_0x476d('0x3f')]=[{'all':!![]}];}return db[_0x476d('0x29')][_0x476d('0x40')](_0x2dc69b);})[_0x476d('0x24')](function(_0x535ea0){_0x1bd7b0[_0x476d('0x41')]=_0x535ea0;return _0x1bd7b0;})[_0x476d('0x24')](respondWithFilteredResult(_0x5453e7,_0x2dc69b))[_0x476d('0x42')](handleError(_0x5453e7,null));};exports[_0x476d('0x43')]=function(_0xdb6457,_0x5c9be3){var _0x1163ab={'raw':!![],'where':{'id':_0xdb6457[_0x476d('0x44')]['id']}},_0x41a4f1={};_0x41a4f1[_0x476d('0x2d')]=_[_0x476d('0x45')](db[_0x476d('0x29')][_0x476d('0x2a')]);_0x41a4f1['query']=_['keys'](_0xdb6457['query']);_0x41a4f1[_0x476d('0x38')]=_['intersection'](_0x41a4f1[_0x476d('0x2d')],_0x41a4f1[_0x476d('0x2f')]);_0x1163ab[_0x476d('0x30')]=_[_0x476d('0x31')](_0x41a4f1[_0x476d('0x2d')],qs[_0x476d('0x32')](_0xdb6457[_0x476d('0x2f')][_0x476d('0x32')]));_0x1163ab[_0x476d('0x30')]=_0x1163ab[_0x476d('0x30')][_0x476d('0x46')]?_0x1163ab['attributes']:_0x41a4f1[_0x476d('0x2d')];if(_0xdb6457[_0x476d('0x2f')][_0x476d('0x3e')]){_0x1163ab[_0x476d('0x3f')]=[{'all':!![]}];}_0x1163ab=_[_0x476d('0x3b')]({},_0x1163ab,_0xdb6457[_0x476d('0x3d')]);return db[_0x476d('0x29')][_0x476d('0x47')](_0x1163ab)[_0x476d('0x24')](handleEntityNotFound(_0x5c9be3,null))[_0x476d('0x24')](respondWithResult(_0x5c9be3,null))['catch'](handleError(_0x5c9be3,null));};exports[_0x476d('0x48')]=function(_0x1a84af,_0x32a82a){return db[_0x476d('0x29')][_0x476d('0x48')](_0x1a84af[_0x476d('0x49')],{})[_0x476d('0x24')](respondWithResult(_0x32a82a,0xc9))['catch'](handleError(_0x32a82a,null));};exports[_0x476d('0x23')]=function(_0x51cc85,_0x5061ea){if(_0x51cc85[_0x476d('0x49')]['id']){delete _0x51cc85[_0x476d('0x49')]['id'];}return db[_0x476d('0x29')][_0x476d('0x47')]({'where':{'id':_0x51cc85[_0x476d('0x44')]['id']}})[_0x476d('0x24')](handleEntityNotFound(_0x5061ea,null))[_0x476d('0x24')](saveUpdates(_0x51cc85['body'],null))[_0x476d('0x24')](respondWithResult(_0x5061ea,null))[_0x476d('0x42')](handleError(_0x5061ea,null));};exports[_0x476d('0x4a')]=function(_0x2a66a1,_0x3ad5d6){return db['MailSubstatus'][_0x476d('0x47')]({'where':{'id':_0x2a66a1['params']['id']}})['then'](handleEntityNotFound(_0x3ad5d6,null))[_0x476d('0x24')](removeEntity(_0x3ad5d6,null))['catch'](handleError(_0x3ad5d6,null));};exports['describe']=function(_0x587547,_0xf62dd6){return db[_0x476d('0x29')][_0x476d('0x4b')]()[_0x476d('0x24')](respondWithResult(_0xf62dd6,null))[_0x476d('0x42')](handleError(_0xf62dd6,null));}; \ No newline at end of file +var _0xcb61=['fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','type','options','includeAll','MailSubstatus','rows','show','keys','include','merge','find','catch','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','Content-Range','save','update','destroy','then','sendStatus','error','stack','name','map','rawAttributes'];(function(_0x31d03c,_0x158cef){var _0x420e61=function(_0x1ddac1){while(--_0x1ddac1){_0x31d03c['push'](_0x31d03c['shift']());}};_0x420e61(++_0x158cef);}(_0xcb61,0x69));var _0x1cb6=function(_0x3173fe,_0x428dd4){_0x3173fe=_0x3173fe-0x0;var _0x7cea42=_0xcb61[_0x3173fe];return _0x7cea42;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1cb6('0x0'));var zipdir=require(_0x1cb6('0x1'));var jsonpatch=require(_0x1cb6('0x2'));var rp=require(_0x1cb6('0x3'));var moment=require(_0x1cb6('0x4'));var BPromise=require(_0x1cb6('0x5'));var Mustache=require(_0x1cb6('0x6'));var util=require(_0x1cb6('0x7'));var path=require(_0x1cb6('0x8'));var sox=require(_0x1cb6('0x9'));var csv=require(_0x1cb6('0xa'));var ejs=require(_0x1cb6('0xb'));var fs=require('fs');var fs_extra=require(_0x1cb6('0xc'));var _=require(_0x1cb6('0xd'));var squel=require(_0x1cb6('0xe'));var crypto=require('crypto');var jsforce=require(_0x1cb6('0xf'));var deskjs=require(_0x1cb6('0x10'));var toCsv=require('to-csv');var querystring=require(_0x1cb6('0x11'));var Papa=require(_0x1cb6('0x12'));var Redis=require(_0x1cb6('0x13'));var authService=require(_0x1cb6('0x14'));var qs=require(_0x1cb6('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1cb6('0x16'))(_0x1cb6('0x17'));var utils=require(_0x1cb6('0x18'));var config=require(_0x1cb6('0x19'));var licenseUtil=require(_0x1cb6('0x1a'));var db=require(_0x1cb6('0x1b'))['db'];function respondWithStatusCode(_0x1d9f69,_0x3ed4fa){_0x3ed4fa=_0x3ed4fa||0xcc;return function(_0x175d7a){if(_0x175d7a){return _0x1d9f69['sendStatus'](_0x3ed4fa);}return _0x1d9f69[_0x1cb6('0x1c')](_0x3ed4fa)[_0x1cb6('0x1d')]();};}function respondWithResult(_0x34132f,_0x3c6483){_0x3c6483=_0x3c6483||0xc8;return function(_0x16acd6){if(_0x16acd6){return _0x34132f[_0x1cb6('0x1c')](_0x3c6483)[_0x1cb6('0x1e')](_0x16acd6);}};}function respondWithFilteredResult(_0x2a7091,_0x164009){return function(_0x2527ff){if(_0x2527ff){var _0x4f4da9=typeof _0x164009['offset']===_0x1cb6('0x1f')&&typeof _0x164009['limit']===_0x1cb6('0x1f');var _0x2a962e=_0x2527ff[_0x1cb6('0x20')];var _0x1132b4=_0x4f4da9?0x0:_0x164009[_0x1cb6('0x21')];var _0x4dca64=_0x4f4da9?_0x2527ff[_0x1cb6('0x20')]:_0x164009[_0x1cb6('0x21')]+_0x164009[_0x1cb6('0x22')];var _0x32134e;if(_0x4dca64>=_0x2a962e){_0x4dca64=_0x2a962e;_0x32134e=0xc8;}else{_0x32134e=0xce;}_0x2a7091[_0x1cb6('0x1c')](_0x32134e);return _0x2a7091[_0x1cb6('0x23')](_0x1cb6('0x24'),_0x1132b4+'-'+_0x4dca64+'/'+_0x2a962e)[_0x1cb6('0x1e')](_0x2527ff);}return null;};}function patchUpdates(_0x404826){return function(_0xd211bc){try{jsonpatch['apply'](_0xd211bc,_0x404826,!![]);}catch(_0x15d2c0){return BPromise['reject'](_0x15d2c0);}return _0xd211bc[_0x1cb6('0x25')]();};}function saveUpdates(_0x523eb4,_0x1396ef){return function(_0x30625a){if(_0x30625a){return _0x30625a[_0x1cb6('0x26')](_0x523eb4)['then'](function(_0xefa20e){return _0xefa20e;});}return null;};}function removeEntity(_0x16054a,_0x1bb108){return function(_0x2e8af2){if(_0x2e8af2){return _0x2e8af2[_0x1cb6('0x27')]()[_0x1cb6('0x28')](function(){_0x16054a[_0x1cb6('0x1c')](0xcc)[_0x1cb6('0x1d')]();});}};}function handleEntityNotFound(_0x5b63d9,_0x2ac9c7){return function(_0xd51af7){if(!_0xd51af7){_0x5b63d9[_0x1cb6('0x29')](0x194);}return _0xd51af7;};}function handleError(_0x2bfff1,_0x52afe0){_0x52afe0=_0x52afe0||0x1f4;return function(_0x441435){logger[_0x1cb6('0x2a')](_0x441435[_0x1cb6('0x2b')]);if(_0x441435[_0x1cb6('0x2c')]){delete _0x441435[_0x1cb6('0x2c')];}_0x2bfff1['status'](_0x52afe0)['send'](_0x441435);};}exports['index']=function(_0x491e80,_0x1ec91b){var _0xdd7a37={},_0x359277={},_0x5aeffb={'count':0x0,'rows':[]};var _0x1dbd7f=_[_0x1cb6('0x2d')](db['MailSubstatus'][_0x1cb6('0x2e')],function(_0x134220){return{'name':_0x134220[_0x1cb6('0x2f')],'type':_0x134220['type'][_0x1cb6('0x30')]};});_0x359277[_0x1cb6('0x31')]=_[_0x1cb6('0x2d')](_0x1dbd7f,_0x1cb6('0x2c'));_0x359277['query']=_['keys'](_0x491e80[_0x1cb6('0x32')]);_0x359277['filters']=_[_0x1cb6('0x33')](_0x359277['model'],_0x359277[_0x1cb6('0x32')]);_0xdd7a37[_0x1cb6('0x34')]=_[_0x1cb6('0x33')](_0x359277[_0x1cb6('0x31')],qs[_0x1cb6('0x35')](_0x491e80[_0x1cb6('0x32')]['fields']));_0xdd7a37[_0x1cb6('0x34')]=_0xdd7a37[_0x1cb6('0x34')][_0x1cb6('0x36')]?_0xdd7a37[_0x1cb6('0x34')]:_0x359277[_0x1cb6('0x31')];if(!_0x491e80[_0x1cb6('0x32')][_0x1cb6('0x37')](_0x1cb6('0x38'))){_0xdd7a37[_0x1cb6('0x22')]=qs[_0x1cb6('0x22')](_0x491e80[_0x1cb6('0x32')][_0x1cb6('0x22')]);_0xdd7a37['offset']=qs['offset'](_0x491e80[_0x1cb6('0x32')][_0x1cb6('0x21')]);}_0xdd7a37[_0x1cb6('0x39')]=qs[_0x1cb6('0x3a')](_0x491e80[_0x1cb6('0x32')][_0x1cb6('0x3a')]);_0xdd7a37['where']=qs['filters'](_['pick'](_0x491e80[_0x1cb6('0x32')],_0x359277[_0x1cb6('0x3b')]),_0x1dbd7f);if(_0x491e80[_0x1cb6('0x32')][_0x1cb6('0x3c')]){_0xdd7a37[_0x1cb6('0x3d')]=_['merge'](_0xdd7a37[_0x1cb6('0x3d')],{'$or':_['map'](_0x1dbd7f,function(_0x5f2606){if(_0x5f2606[_0x1cb6('0x3e')]!=='VIRTUAL'){var _0x56b8ef={};_0x56b8ef[_0x5f2606['name']]={'$like':'%'+_0x491e80['query'][_0x1cb6('0x3c')]+'%'};return _0x56b8ef;}})});}_0xdd7a37=_['merge']({},_0xdd7a37,_0x491e80[_0x1cb6('0x3f')]);var _0x5ea18a={'where':_0xdd7a37['where']};return db['MailSubstatus'][_0x1cb6('0x20')](_0x5ea18a)[_0x1cb6('0x28')](function(_0x29b6f6){_0x5aeffb[_0x1cb6('0x20')]=_0x29b6f6;if(_0x491e80['query'][_0x1cb6('0x40')]){_0xdd7a37['include']=[{'all':!![]}];}return db[_0x1cb6('0x41')]['findAll'](_0xdd7a37);})[_0x1cb6('0x28')](function(_0x56cd3a){_0x5aeffb[_0x1cb6('0x42')]=_0x56cd3a;return _0x5aeffb;})['then'](respondWithFilteredResult(_0x1ec91b,_0xdd7a37))['catch'](handleError(_0x1ec91b,null));};exports[_0x1cb6('0x43')]=function(_0x12802e,_0x2b832f){var _0x514530={'raw':!![],'where':{'id':_0x12802e['params']['id']}},_0x56e4e0={};_0x56e4e0[_0x1cb6('0x31')]=_[_0x1cb6('0x44')](db[_0x1cb6('0x41')][_0x1cb6('0x2e')]);_0x56e4e0[_0x1cb6('0x32')]=_['keys'](_0x12802e['query']);_0x56e4e0[_0x1cb6('0x3b')]=_[_0x1cb6('0x33')](_0x56e4e0[_0x1cb6('0x31')],_0x56e4e0[_0x1cb6('0x32')]);_0x514530[_0x1cb6('0x34')]=_[_0x1cb6('0x33')](_0x56e4e0[_0x1cb6('0x31')],qs[_0x1cb6('0x35')](_0x12802e[_0x1cb6('0x32')][_0x1cb6('0x35')]));_0x514530[_0x1cb6('0x34')]=_0x514530['attributes']['length']?_0x514530[_0x1cb6('0x34')]:_0x56e4e0[_0x1cb6('0x31')];if(_0x12802e[_0x1cb6('0x32')][_0x1cb6('0x40')]){_0x514530[_0x1cb6('0x45')]=[{'all':!![]}];}_0x514530=_[_0x1cb6('0x46')]({},_0x514530,_0x12802e[_0x1cb6('0x3f')]);return db[_0x1cb6('0x41')][_0x1cb6('0x47')](_0x514530)['then'](handleEntityNotFound(_0x2b832f,null))[_0x1cb6('0x28')](respondWithResult(_0x2b832f,null))[_0x1cb6('0x48')](handleError(_0x2b832f,null));};exports['create']=function(_0x2b7fc3,_0x253a6a){return db[_0x1cb6('0x41')]['create'](_0x2b7fc3[_0x1cb6('0x49')],{})['then'](respondWithResult(_0x253a6a,0xc9))['catch'](handleError(_0x253a6a,null));};exports[_0x1cb6('0x26')]=function(_0x4f6001,_0x203311){if(_0x4f6001[_0x1cb6('0x49')]['id']){delete _0x4f6001[_0x1cb6('0x49')]['id'];}return db[_0x1cb6('0x41')]['find']({'where':{'id':_0x4f6001[_0x1cb6('0x4a')]['id']}})[_0x1cb6('0x28')](handleEntityNotFound(_0x203311,null))[_0x1cb6('0x28')](saveUpdates(_0x4f6001[_0x1cb6('0x49')],null))[_0x1cb6('0x28')](respondWithResult(_0x203311,null))[_0x1cb6('0x48')](handleError(_0x203311,null));};exports[_0x1cb6('0x27')]=function(_0x45f8dc,_0x58a672){return db[_0x1cb6('0x41')]['find']({'where':{'id':_0x45f8dc[_0x1cb6('0x4a')]['id']}})[_0x1cb6('0x28')](handleEntityNotFound(_0x58a672,null))[_0x1cb6('0x28')](removeEntity(_0x58a672,null))[_0x1cb6('0x48')](handleError(_0x58a672,null));};exports['describe']=function(_0x3132a9,_0x4fcbee){return db[_0x1cb6('0x41')][_0x1cb6('0x4b')]()[_0x1cb6('0x28')](respondWithResult(_0x4fcbee,null))[_0x1cb6('0x48')](handleError(_0x4fcbee,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index d968c26..3f0e756 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 _0xa9ba=['path','../../config/environment','MailSubstatus','mail_substatuses','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x3416e2,_0x5dc708){var _0x449d73=function(_0x1ab5ff){while(--_0x1ab5ff){_0x3416e2['push'](_0x3416e2['shift']());}};_0x449d73(++_0x5dc708);}(_0xa9ba,0x72));var _0xaa9b=function(_0x58d0b6,_0x109f8e){_0x58d0b6=_0x58d0b6-0x0;var _0x5f1a56=_0xa9ba[_0x58d0b6];return _0x5f1a56;};'use strict';var _=require(_0xaa9b('0x0'));var util=require(_0xaa9b('0x1'));var logger=require(_0xaa9b('0x2'))(_0xaa9b('0x3'));var moment=require('moment');var BPromise=require(_0xaa9b('0x4'));var rp=require(_0xaa9b('0x5'));var fs=require('fs');var path=require(_0xaa9b('0x6'));var rimraf=require('rimraf');var config=require(_0xaa9b('0x7'));var attributes=require('./mailSubstatus.attributes');module['exports']=function(_0x21b283,_0x52f336){return _0x21b283['define'](_0xaa9b('0x8'),attributes,{'tableName':_0xaa9b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x99cd=['request-promise','../../config/environment','./mailSubstatus.attributes','exports','define','MailSubstatus','mail_substatuses','../../config/logger','api','bluebird'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0x99cd,0x6b));var _0xd99c=function(_0x214f18,_0x3e0fe1){_0x214f18=_0x214f18-0x0;var _0x15f05f=_0x99cd[_0x214f18];return _0x15f05f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd99c('0x0'))(_0xd99c('0x1'));var moment=require('moment');var BPromise=require(_0xd99c('0x2'));var rp=require(_0xd99c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd99c('0x4'));var attributes=require(_0xd99c('0x5'));module[_0xd99c('0x6')]=function(_0x3310c6,_0xb2c80f){return _0x3310c6[_0xd99c('0x7')](_0xd99c('0x8'),attributes,{'tableName':_0xd99c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 55abde4..4f38a75 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 _0x5eb6=['request','then','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http'];(function(_0x3dc5e5,_0x3fa983){var _0x363b4b=function(_0x13e27a){while(--_0x13e27a){_0x3dc5e5['push'](_0x3dc5e5['shift']());}};_0x363b4b(++_0x3fa983);}(_0x5eb6,0x11e));var _0x65eb=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5eb6[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x65eb('0x0'));var util=require(_0x65eb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x65eb('0x2'));var fs=require('fs');var Redis=require(_0x65eb('0x3'));var db=require(_0x65eb('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x65eb('0x5'));var config=require(_0x65eb('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x65eb('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x330d6a,_0x2de1b0,_0x2e7c5d){return new BPromise(function(_0x151bdb,_0x42dab6){return client[_0x65eb('0x8')](_0x330d6a,_0x2e7c5d)[_0x65eb('0x9')](function(_0x47cdf8){logger['info']('MailSubstatus,\x20%s,\x20%s',_0x2de1b0,_0x65eb('0xa'));logger[_0x65eb('0xb')](_0x65eb('0xc'),_0x2de1b0,_0x65eb('0xa'),JSON[_0x65eb('0xd')](_0x47cdf8));if(_0x47cdf8[_0x65eb('0xe')]){if(_0x47cdf8[_0x65eb('0xe')][_0x65eb('0xf')]===0x1f4){logger[_0x65eb('0xe')](_0x65eb('0x10'),_0x2de1b0,_0x47cdf8[_0x65eb('0xe')][_0x65eb('0x11')]);return _0x42dab6(_0x47cdf8[_0x65eb('0xe')][_0x65eb('0x11')]);}logger['error']('MailSubstatus,\x20%s,\x20%s',_0x2de1b0,_0x47cdf8[_0x65eb('0xe')][_0x65eb('0x11')]);return _0x151bdb(_0x47cdf8[_0x65eb('0xe')]['message']);}else{logger[_0x65eb('0x12')](_0x65eb('0x10'),_0x2de1b0,_0x65eb('0xa'));_0x151bdb(_0x47cdf8[_0x65eb('0x13')]['message']);}})[_0x65eb('0x14')](function(_0x28955c){logger[_0x65eb('0xe')](_0x65eb('0x10'),_0x2de1b0,_0x28955c);_0x42dab6(_0x28955c);});});} \ No newline at end of file +var _0x5a9b=['message','result','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x16818e,_0x4c3656){var _0x6fadf9=function(_0x182c97){while(--_0x182c97){_0x16818e['push'](_0x16818e['shift']());}};_0x6fadf9(++_0x4c3656);}(_0x5a9b,0x76));var _0xb5a9=function(_0x46afa9,_0x2cf09c){_0x46afa9=_0x46afa9-0x0;var _0x57c6a3=_0x5a9b[_0x46afa9];return _0x57c6a3;};'use strict';var _=require('lodash');var util=require(_0xb5a9('0x0'));var moment=require(_0xb5a9('0x1'));var BPromise=require(_0xb5a9('0x2'));var rs=require(_0xb5a9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb5a9('0x4'));var logger=require(_0xb5a9('0x5'))(_0xb5a9('0x6'));var config=require(_0xb5a9('0x7'));var jayson=require(_0xb5a9('0x8'));var client=jayson[_0xb5a9('0x9')][_0xb5a9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x265740,_0x53d399,_0x15f0c8){return new BPromise(function(_0x308b71,_0x230757){return client['request'](_0x265740,_0x15f0c8)[_0xb5a9('0xb')](function(_0x19dee9){logger[_0xb5a9('0xc')](_0xb5a9('0xd'),_0x53d399,_0xb5a9('0xe'));logger[_0xb5a9('0xf')](_0xb5a9('0x10'),_0x53d399,'request\x20sent',JSON[_0xb5a9('0x11')](_0x19dee9));if(_0x19dee9[_0xb5a9('0x12')]){if(_0x19dee9[_0xb5a9('0x12')][_0xb5a9('0x13')]===0x1f4){logger[_0xb5a9('0x12')]('MailSubstatus,\x20%s,\x20%s',_0x53d399,_0x19dee9[_0xb5a9('0x12')][_0xb5a9('0x14')]);return _0x230757(_0x19dee9[_0xb5a9('0x12')][_0xb5a9('0x14')]);}logger['error']('MailSubstatus,\x20%s,\x20%s',_0x53d399,_0x19dee9[_0xb5a9('0x12')]['message']);return _0x308b71(_0x19dee9[_0xb5a9('0x12')][_0xb5a9('0x14')]);}else{logger[_0xb5a9('0xc')](_0xb5a9('0xd'),_0x53d399,_0xb5a9('0xe'));_0x308b71(_0x19dee9[_0xb5a9('0x15')][_0xb5a9('0x14')]);}})[_0xb5a9('0x16')](function(_0x480982){logger[_0xb5a9('0x12')]('MailSubstatus,\x20%s,\x20%s',_0x53d399,_0x480982);_0x230757(_0x480982);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index de58136..b41987c 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 _0x7627=['/describe','/:id','show','post','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated'];(function(_0x538e2e,_0x2a24a5){var _0x3837dd=function(_0x30e061){while(--_0x30e061){_0x538e2e['push'](_0x538e2e['shift']());}};_0x3837dd(++_0x2a24a5);}(_0x7627,0x68));var _0x7762=function(_0x14e54a,_0x11c82b){_0x14e54a=_0x14e54a-0x0;var _0x3af15c=_0x7627[_0x14e54a];return _0x3af15c;};'use strict';var multer=require('multer');var util=require(_0x7762('0x0'));var path=require(_0x7762('0x1'));var timeout=require(_0x7762('0x2'));var express=require('express');var router=express[_0x7762('0x3')]();var fs_extra=require(_0x7762('0x4'));var auth=require(_0x7762('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7762('0x6'));var controller=require(_0x7762('0x7'));router[_0x7762('0x8')]('/',auth[_0x7762('0x9')](),controller['index']);router[_0x7762('0x8')](_0x7762('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x7762('0x8')](_0x7762('0xb'),auth[_0x7762('0x9')](),controller[_0x7762('0xc')]);router[_0x7762('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7762('0xe')](_0x7762('0xb'),auth[_0x7762('0x9')](),controller[_0x7762('0xf')]);router[_0x7762('0x10')](_0x7762('0xb'),auth[_0x7762('0x9')](),controller[_0x7762('0x11')]);module[_0x7762('0x12')]=router; \ No newline at end of file +var _0xc5bd=['destroy','exports','util','path','express','Router','fs-extra','../../config/environment','get','isAuthenticated','describe','show','create','put','update','delete','/:id'];(function(_0x4f2357,_0x3237c5){var _0x37cea2=function(_0x3a03b8){while(--_0x3a03b8){_0x4f2357['push'](_0x4f2357['shift']());}};_0x37cea2(++_0x3237c5);}(_0xc5bd,0x79));var _0xdc5b=function(_0x3857aa,_0x4096d8){_0x3857aa=_0x3857aa-0x0;var _0x418db3=_0xc5bd[_0x3857aa];return _0x418db3;};'use strict';var multer=require('multer');var util=require(_0xdc5b('0x0'));var path=require(_0xdc5b('0x1'));var timeout=require('connect-timeout');var express=require(_0xdc5b('0x2'));var router=express[_0xdc5b('0x3')]();var fs_extra=require(_0xdc5b('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdc5b('0x5'));var controller=require('./mailTransferReport.controller');router[_0xdc5b('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xdc5b('0x6')]('/describe',auth[_0xdc5b('0x7')](),controller[_0xdc5b('0x8')]);router['get']('/:id',auth[_0xdc5b('0x7')](),controller[_0xdc5b('0x9')]);router['post']('/',auth[_0xdc5b('0x7')](),controller[_0xdc5b('0xa')]);router[_0xdc5b('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xdc5b('0xc')]);router[_0xdc5b('0xd')](_0xdc5b('0xe'),auth[_0xdc5b('0x7')](),controller[_0xdc5b('0xf')]);module[_0xdc5b('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 9939b08..4250c57 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(_0x19e013,_0x5c74e0){var _0x58c128=function(_0x26aaf1){while(--_0x26aaf1){_0x19e013['push'](_0x19e013['shift']());}};_0x58c128(++_0x5c74e0);}(_0x4b84,0x1cc));var _0x44b8=function(_0x43fdf8,_0x8426b3){_0x43fdf8=_0x43fdf8-0x0;var _0x1160c6=_0x4b84[_0x43fdf8];return _0x1160c6;};'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(_0x5cd376,_0x163789){var _0x57de74=function(_0x3e56c9){while(--_0x3e56c9){_0x5cd376['push'](_0x5cd376['shift']());}};_0x57de74(++_0x163789);}(_0x008c,0x188));var _0xc008=function(_0x277607,_0x345a06){_0x277607=_0x277607-0x0;var _0x15fe23=_0x008c[_0x277607];return _0x15fe23;};'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 84aaa6c..aa53d2f 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 _0xd5f0=['rows','catch','filters','intersection','length','include','merge','create','body','find','params','eml-format','rimraf','zip-dir','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','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','map','MailTransferReport','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','hasOwnProperty','order','sort','pick','where','VIRTUAL','options','includeAll','findAll'];(function(_0x202c9e,_0xea7c2d){var _0x22c4bd=function(_0x59615a){while(--_0x59615a){_0x202c9e['push'](_0x202c9e['shift']());}};_0x22c4bd(++_0xea7c2d);}(_0xd5f0,0xa5));var _0x0d5f=function(_0xfdbe81,_0x2f134c){_0xfdbe81=_0xfdbe81-0x0;var _0x245271=_0xd5f0[_0xfdbe81];return _0x245271;};'use strict';var emlformat=require(_0x0d5f('0x0'));var rimraf=require(_0x0d5f('0x1'));var zipdir=require(_0x0d5f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0d5f('0x3'));var moment=require(_0x0d5f('0x4'));var BPromise=require(_0x0d5f('0x5'));var Mustache=require(_0x0d5f('0x6'));var util=require(_0x0d5f('0x7'));var path=require(_0x0d5f('0x8'));var sox=require(_0x0d5f('0x9'));var csv=require(_0x0d5f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0d5f('0xb'));var _=require(_0x0d5f('0xc'));var squel=require('squel');var crypto=require(_0x0d5f('0xd'));var jsforce=require(_0x0d5f('0xe'));var deskjs=require(_0x0d5f('0xf'));var toCsv=require(_0x0d5f('0xa'));var querystring=require(_0x0d5f('0x10'));var Papa=require(_0x0d5f('0x11'));var Redis=require(_0x0d5f('0x12'));var authService=require(_0x0d5f('0x13'));var qs=require(_0x0d5f('0x14'));var as=require(_0x0d5f('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0d5f('0x16'));var utils=require(_0x0d5f('0x17'));var config=require(_0x0d5f('0x18'));var licenseUtil=require(_0x0d5f('0x19'));var db=require(_0x0d5f('0x1a'))['db'];function respondWithStatusCode(_0x8c4a6c,_0x1f1a49){_0x1f1a49=_0x1f1a49||0xcc;return function(_0x19249e){if(_0x19249e){return _0x8c4a6c[_0x0d5f('0x1b')](_0x1f1a49);}return _0x8c4a6c['status'](_0x1f1a49)['end']();};}function respondWithResult(_0x1544d3,_0x40fcda){_0x40fcda=_0x40fcda||0xc8;return function(_0x35eead){if(_0x35eead){return _0x1544d3[_0x0d5f('0x1c')](_0x40fcda)[_0x0d5f('0x1d')](_0x35eead);}};}function respondWithFilteredResult(_0xcbf1ee,_0x21dbd0){return function(_0x55b4a7){if(_0x55b4a7){var _0x3f094f=typeof _0x21dbd0[_0x0d5f('0x1e')]===_0x0d5f('0x1f')&&typeof _0x21dbd0[_0x0d5f('0x20')]===_0x0d5f('0x1f');var _0x27004a=_0x55b4a7['count'];var _0x57e7a9=_0x3f094f?0x0:_0x21dbd0['offset'];var _0xf1afce=_0x3f094f?_0x55b4a7[_0x0d5f('0x21')]:_0x21dbd0['offset']+_0x21dbd0['limit'];var _0x1a674a;if(_0xf1afce>=_0x27004a){_0xf1afce=_0x27004a;_0x1a674a=0xc8;}else{_0x1a674a=0xce;}_0xcbf1ee[_0x0d5f('0x1c')](_0x1a674a);return _0xcbf1ee[_0x0d5f('0x22')](_0x0d5f('0x23'),_0x57e7a9+'-'+_0xf1afce+'/'+_0x27004a)[_0x0d5f('0x1d')](_0x55b4a7);}return null;};}function patchUpdates(_0x5a0ceb){return function(_0x19d836){try{jsonpatch['apply'](_0x19d836,_0x5a0ceb,!![]);}catch(_0x5effc9){return BPromise[_0x0d5f('0x24')](_0x5effc9);}return _0x19d836['save']();};}function saveUpdates(_0x1c7b49,_0x20d180){return function(_0x5247e3){if(_0x5247e3){return _0x5247e3[_0x0d5f('0x25')](_0x1c7b49)[_0x0d5f('0x26')](function(_0x463c7c){return _0x463c7c;});}return null;};}function removeEntity(_0xf5ba91,_0x4c327b){return function(_0x58337e){if(_0x58337e){return _0x58337e[_0x0d5f('0x27')]()[_0x0d5f('0x26')](function(){_0xf5ba91[_0x0d5f('0x1c')](0xcc)[_0x0d5f('0x28')]();});}};}function handleEntityNotFound(_0x12bc6b,_0x579177){return function(_0x3ba752){if(!_0x3ba752){_0x12bc6b[_0x0d5f('0x1b')](0x194);}return _0x3ba752;};}function handleError(_0x509cf9,_0x4cd357){_0x4cd357=_0x4cd357||0x1f4;return function(_0x2468c5){logger[_0x0d5f('0x29')](_0x2468c5[_0x0d5f('0x2a')]);if(_0x2468c5[_0x0d5f('0x2b')]){delete _0x2468c5['name'];}_0x509cf9[_0x0d5f('0x1c')](_0x4cd357)[_0x0d5f('0x2c')](_0x2468c5);};}exports[_0x0d5f('0x2d')]=function(_0x42e1fb,_0x45b374){var _0x274cd2={},_0x2fd9c9={},_0x2e39a0={'count':0x0,'rows':[]};var _0x2042ef=_[_0x0d5f('0x2e')](db[_0x0d5f('0x2f')][_0x0d5f('0x30')],function(_0x4a60bc){return{'name':_0x4a60bc[_0x0d5f('0x31')],'type':_0x4a60bc[_0x0d5f('0x32')][_0x0d5f('0x33')]};});_0x2fd9c9[_0x0d5f('0x34')]=_[_0x0d5f('0x2e')](_0x2042ef,_0x0d5f('0x2b'));_0x2fd9c9[_0x0d5f('0x35')]=_[_0x0d5f('0x36')](_0x42e1fb[_0x0d5f('0x35')]);_0x2fd9c9['filters']=_['intersection'](_0x2fd9c9[_0x0d5f('0x34')],_0x2fd9c9['query']);_0x274cd2[_0x0d5f('0x37')]=_['intersection'](_0x2fd9c9[_0x0d5f('0x34')],qs[_0x0d5f('0x38')](_0x42e1fb[_0x0d5f('0x35')][_0x0d5f('0x38')]));_0x274cd2[_0x0d5f('0x37')]=_0x274cd2['attributes']['length']?_0x274cd2['attributes']:_0x2fd9c9[_0x0d5f('0x34')];if(!_0x42e1fb[_0x0d5f('0x35')][_0x0d5f('0x39')]('nolimit')){_0x274cd2['limit']=qs[_0x0d5f('0x20')](_0x42e1fb[_0x0d5f('0x35')][_0x0d5f('0x20')]);_0x274cd2[_0x0d5f('0x1e')]=qs[_0x0d5f('0x1e')](_0x42e1fb[_0x0d5f('0x35')][_0x0d5f('0x1e')]);}_0x274cd2[_0x0d5f('0x3a')]=qs[_0x0d5f('0x3b')](_0x42e1fb[_0x0d5f('0x35')][_0x0d5f('0x3b')]);_0x274cd2['where']=qs['filters'](_[_0x0d5f('0x3c')](_0x42e1fb[_0x0d5f('0x35')],_0x2fd9c9['filters']),_0x2042ef);if(_0x42e1fb[_0x0d5f('0x35')]['filter']){_0x274cd2[_0x0d5f('0x3d')]=_['merge'](_0x274cd2['where'],{'$or':_[_0x0d5f('0x2e')](_0x2042ef,function(_0x2b0143){if(_0x2b0143[_0x0d5f('0x32')]!==_0x0d5f('0x3e')){var _0x2396d5={};_0x2396d5[_0x2b0143[_0x0d5f('0x2b')]]={'$like':'%'+_0x42e1fb[_0x0d5f('0x35')]['filter']+'%'};return _0x2396d5;}})});}_0x274cd2=_['merge']({},_0x274cd2,_0x42e1fb[_0x0d5f('0x3f')]);var _0xfe5dbd={'where':_0x274cd2[_0x0d5f('0x3d')]};return db[_0x0d5f('0x2f')]['count'](_0xfe5dbd)[_0x0d5f('0x26')](function(_0x4d30f1){_0x2e39a0[_0x0d5f('0x21')]=_0x4d30f1;if(_0x42e1fb[_0x0d5f('0x35')][_0x0d5f('0x40')]){_0x274cd2['include']=[{'all':!![]}];}return db[_0x0d5f('0x2f')][_0x0d5f('0x41')](_0x274cd2);})['then'](function(_0x1fa2fd){_0x2e39a0[_0x0d5f('0x42')]=_0x1fa2fd;return _0x2e39a0;})[_0x0d5f('0x26')](respondWithFilteredResult(_0x45b374,_0x274cd2))[_0x0d5f('0x43')](handleError(_0x45b374,null));};exports['show']=function(_0x449927,_0x1ca95e){var _0x5530dd={'raw':!![],'where':{'id':_0x449927['params']['id']}},_0x4cd4fe={};_0x4cd4fe[_0x0d5f('0x34')]=_[_0x0d5f('0x36')](db[_0x0d5f('0x2f')][_0x0d5f('0x30')]);_0x4cd4fe[_0x0d5f('0x35')]=_['keys'](_0x449927['query']);_0x4cd4fe[_0x0d5f('0x44')]=_[_0x0d5f('0x45')](_0x4cd4fe[_0x0d5f('0x34')],_0x4cd4fe[_0x0d5f('0x35')]);_0x5530dd[_0x0d5f('0x37')]=_[_0x0d5f('0x45')](_0x4cd4fe[_0x0d5f('0x34')],qs[_0x0d5f('0x38')](_0x449927['query']['fields']));_0x5530dd[_0x0d5f('0x37')]=_0x5530dd[_0x0d5f('0x37')][_0x0d5f('0x46')]?_0x5530dd[_0x0d5f('0x37')]:_0x4cd4fe['model'];if(_0x449927[_0x0d5f('0x35')]['includeAll']){_0x5530dd[_0x0d5f('0x47')]=[{'all':!![]}];}_0x5530dd=_[_0x0d5f('0x48')]({},_0x5530dd,_0x449927[_0x0d5f('0x3f')]);return db[_0x0d5f('0x2f')]['find'](_0x5530dd)['then'](handleEntityNotFound(_0x1ca95e,null))[_0x0d5f('0x26')](respondWithResult(_0x1ca95e,null))[_0x0d5f('0x43')](handleError(_0x1ca95e,null));};exports[_0x0d5f('0x49')]=function(_0x16de8f,_0x19b878){return db[_0x0d5f('0x2f')][_0x0d5f('0x49')](_0x16de8f[_0x0d5f('0x4a')],{})[_0x0d5f('0x26')](respondWithResult(_0x19b878,0xc9))['catch'](handleError(_0x19b878,null));};exports[_0x0d5f('0x25')]=function(_0x3aa17f,_0x4d2b2d){if(_0x3aa17f[_0x0d5f('0x4a')]['id']){delete _0x3aa17f[_0x0d5f('0x4a')]['id'];}return db['MailTransferReport'][_0x0d5f('0x4b')]({'where':{'id':_0x3aa17f[_0x0d5f('0x4c')]['id']}})[_0x0d5f('0x26')](handleEntityNotFound(_0x4d2b2d,null))[_0x0d5f('0x26')](saveUpdates(_0x3aa17f['body'],null))[_0x0d5f('0x26')](respondWithResult(_0x4d2b2d,null))[_0x0d5f('0x43')](handleError(_0x4d2b2d,null));};exports[_0x0d5f('0x27')]=function(_0x2109e9,_0x3532c7){return db[_0x0d5f('0x2f')][_0x0d5f('0x4b')]({'where':{'id':_0x2109e9[_0x0d5f('0x4c')]['id']}})[_0x0d5f('0x26')](handleEntityNotFound(_0x3532c7,null))[_0x0d5f('0x26')](removeEntity(_0x3532c7,null))['catch'](handleError(_0x3532c7,null));};exports['describe']=function(_0xecf815,_0x3365be){return db[_0x0d5f('0x2f')]['describe']()['then'](respondWithResult(_0x3365be,null))[_0x0d5f('0x43')](handleError(_0x3365be,null));}; \ No newline at end of file +var _0x994f=['reject','save','update','then','error','name','send','index','map','MailTransferReport','rawAttributes','type','key','query','keys','model','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','rows','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x994f,0x78));var _0xf994=function(_0xefd3e6,_0x10d71e){_0xefd3e6=_0xefd3e6-0x0;var _0x52a204=_0x994f[_0xefd3e6];return _0x52a204;};'use strict';var emlformat=require(_0xf994('0x0'));var rimraf=require(_0xf994('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf994('0x2'));var rp=require(_0xf994('0x3'));var moment=require(_0xf994('0x4'));var BPromise=require(_0xf994('0x5'));var Mustache=require(_0xf994('0x6'));var util=require(_0xf994('0x7'));var path=require(_0xf994('0x8'));var sox=require(_0xf994('0x9'));var csv=require(_0xf994('0xa'));var ejs=require(_0xf994('0xb'));var fs=require('fs');var fs_extra=require(_0xf994('0xc'));var _=require(_0xf994('0xd'));var squel=require(_0xf994('0xe'));var crypto=require(_0xf994('0xf'));var jsforce=require(_0xf994('0x10'));var deskjs=require(_0xf994('0x11'));var toCsv=require('to-csv');var querystring=require(_0xf994('0x12'));var Papa=require(_0xf994('0x13'));var Redis=require(_0xf994('0x14'));var authService=require(_0xf994('0x15'));var qs=require(_0xf994('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf994('0x17'));var utils=require(_0xf994('0x18'));var config=require(_0xf994('0x19'));var licenseUtil=require(_0xf994('0x1a'));var db=require(_0xf994('0x1b'))['db'];function respondWithStatusCode(_0x340502,_0x2e070c){_0x2e070c=_0x2e070c||0xcc;return function(_0x48d714){if(_0x48d714){return _0x340502[_0xf994('0x1c')](_0x2e070c);}return _0x340502['status'](_0x2e070c)[_0xf994('0x1d')]();};}function respondWithResult(_0x1fdf17,_0xa3f9fa){_0xa3f9fa=_0xa3f9fa||0xc8;return function(_0x202733){if(_0x202733){return _0x1fdf17[_0xf994('0x1e')](_0xa3f9fa)[_0xf994('0x1f')](_0x202733);}};}function respondWithFilteredResult(_0x4493ff,_0x1986ed){return function(_0x428402){if(_0x428402){var _0x53117a=typeof _0x1986ed[_0xf994('0x20')]===_0xf994('0x21')&&typeof _0x1986ed[_0xf994('0x22')]===_0xf994('0x21');var _0xd42b3c=_0x428402[_0xf994('0x23')];var _0x5a39e5=_0x53117a?0x0:_0x1986ed['offset'];var _0x49c561=_0x53117a?_0x428402[_0xf994('0x23')]:_0x1986ed['offset']+_0x1986ed[_0xf994('0x22')];var _0x57f1d9;if(_0x49c561>=_0xd42b3c){_0x49c561=_0xd42b3c;_0x57f1d9=0xc8;}else{_0x57f1d9=0xce;}_0x4493ff[_0xf994('0x1e')](_0x57f1d9);return _0x4493ff[_0xf994('0x24')]('Content-Range',_0x5a39e5+'-'+_0x49c561+'/'+_0xd42b3c)['json'](_0x428402);}return null;};}function patchUpdates(_0x5111f9){return function(_0x229abb){try{jsonpatch[_0xf994('0x25')](_0x229abb,_0x5111f9,!![]);}catch(_0x21350c){return BPromise[_0xf994('0x26')](_0x21350c);}return _0x229abb[_0xf994('0x27')]();};}function saveUpdates(_0x745f8,_0xc9d630){return function(_0x382557){if(_0x382557){return _0x382557[_0xf994('0x28')](_0x745f8)[_0xf994('0x29')](function(_0x3dbe74){return _0x3dbe74;});}return null;};}function removeEntity(_0x50253c,_0x381bce){return function(_0x1f627d){if(_0x1f627d){return _0x1f627d['destroy']()[_0xf994('0x29')](function(){_0x50253c[_0xf994('0x1e')](0xcc)[_0xf994('0x1d')]();});}};}function handleEntityNotFound(_0x173436,_0x43b6c5){return function(_0x454013){if(!_0x454013){_0x173436[_0xf994('0x1c')](0x194);}return _0x454013;};}function handleError(_0x377e29,_0x35fcfc){_0x35fcfc=_0x35fcfc||0x1f4;return function(_0x40efcb){logger[_0xf994('0x2a')](_0x40efcb['stack']);if(_0x40efcb['name']){delete _0x40efcb[_0xf994('0x2b')];}_0x377e29[_0xf994('0x1e')](_0x35fcfc)[_0xf994('0x2c')](_0x40efcb);};}exports[_0xf994('0x2d')]=function(_0x33681a,_0x5bbecf){var _0xceec3={},_0x840343={},_0x115ff2={'count':0x0,'rows':[]};var _0x15d899=_[_0xf994('0x2e')](db[_0xf994('0x2f')][_0xf994('0x30')],function(_0x4bcd0d){return{'name':_0x4bcd0d['fieldName'],'type':_0x4bcd0d[_0xf994('0x31')][_0xf994('0x32')]};});_0x840343['model']=_[_0xf994('0x2e')](_0x15d899,_0xf994('0x2b'));_0x840343[_0xf994('0x33')]=_[_0xf994('0x34')](_0x33681a[_0xf994('0x33')]);_0x840343['filters']=_['intersection'](_0x840343[_0xf994('0x35')],_0x840343[_0xf994('0x33')]);_0xceec3['attributes']=_[_0xf994('0x36')](_0x840343[_0xf994('0x35')],qs[_0xf994('0x37')](_0x33681a[_0xf994('0x33')][_0xf994('0x37')]));_0xceec3['attributes']=_0xceec3['attributes'][_0xf994('0x38')]?_0xceec3[_0xf994('0x39')]:_0x840343['model'];if(!_0x33681a[_0xf994('0x33')][_0xf994('0x3a')](_0xf994('0x3b'))){_0xceec3[_0xf994('0x22')]=qs[_0xf994('0x22')](_0x33681a['query'][_0xf994('0x22')]);_0xceec3[_0xf994('0x20')]=qs['offset'](_0x33681a[_0xf994('0x33')][_0xf994('0x20')]);}_0xceec3[_0xf994('0x3c')]=qs[_0xf994('0x3d')](_0x33681a[_0xf994('0x33')]['sort']);_0xceec3[_0xf994('0x3e')]=qs[_0xf994('0x3f')](_[_0xf994('0x40')](_0x33681a[_0xf994('0x33')],_0x840343[_0xf994('0x3f')]),_0x15d899);if(_0x33681a[_0xf994('0x33')][_0xf994('0x41')]){_0xceec3[_0xf994('0x3e')]=_['merge'](_0xceec3[_0xf994('0x3e')],{'$or':_[_0xf994('0x2e')](_0x15d899,function(_0x2d0a33){if(_0x2d0a33['type']!=='VIRTUAL'){var _0xe2ab29={};_0xe2ab29[_0x2d0a33[_0xf994('0x2b')]]={'$like':'%'+_0x33681a[_0xf994('0x33')][_0xf994('0x41')]+'%'};return _0xe2ab29;}})});}_0xceec3=_[_0xf994('0x42')]({},_0xceec3,_0x33681a[_0xf994('0x43')]);var _0x9c25ed={'where':_0xceec3[_0xf994('0x3e')]};return db[_0xf994('0x2f')][_0xf994('0x23')](_0x9c25ed)[_0xf994('0x29')](function(_0x4b6b6c){_0x115ff2[_0xf994('0x23')]=_0x4b6b6c;if(_0x33681a[_0xf994('0x33')][_0xf994('0x44')]){_0xceec3[_0xf994('0x45')]=[{'all':!![]}];}return db[_0xf994('0x2f')]['findAll'](_0xceec3);})[_0xf994('0x29')](function(_0x39153b){_0x115ff2[_0xf994('0x46')]=_0x39153b;return _0x115ff2;})[_0xf994('0x29')](respondWithFilteredResult(_0x5bbecf,_0xceec3))[_0xf994('0x47')](handleError(_0x5bbecf,null));};exports[_0xf994('0x48')]=function(_0x50a04b,_0x135c1d){var _0x6f4061={'raw':!![],'where':{'id':_0x50a04b[_0xf994('0x49')]['id']}},_0x1fa05f={};_0x1fa05f[_0xf994('0x35')]=_[_0xf994('0x34')](db[_0xf994('0x2f')][_0xf994('0x30')]);_0x1fa05f[_0xf994('0x33')]=_[_0xf994('0x34')](_0x50a04b[_0xf994('0x33')]);_0x1fa05f[_0xf994('0x3f')]=_['intersection'](_0x1fa05f['model'],_0x1fa05f['query']);_0x6f4061[_0xf994('0x39')]=_['intersection'](_0x1fa05f[_0xf994('0x35')],qs[_0xf994('0x37')](_0x50a04b[_0xf994('0x33')]['fields']));_0x6f4061['attributes']=_0x6f4061[_0xf994('0x39')][_0xf994('0x38')]?_0x6f4061[_0xf994('0x39')]:_0x1fa05f[_0xf994('0x35')];if(_0x50a04b[_0xf994('0x33')][_0xf994('0x44')]){_0x6f4061[_0xf994('0x45')]=[{'all':!![]}];}_0x6f4061=_[_0xf994('0x42')]({},_0x6f4061,_0x50a04b[_0xf994('0x43')]);return db[_0xf994('0x2f')][_0xf994('0x4a')](_0x6f4061)[_0xf994('0x29')](handleEntityNotFound(_0x135c1d,null))['then'](respondWithResult(_0x135c1d,null))[_0xf994('0x47')](handleError(_0x135c1d,null));};exports[_0xf994('0x4b')]=function(_0x374a2a,_0x4ee23b){return db['MailTransferReport'][_0xf994('0x4b')](_0x374a2a[_0xf994('0x4c')],{})[_0xf994('0x29')](respondWithResult(_0x4ee23b,0xc9))[_0xf994('0x47')](handleError(_0x4ee23b,null));};exports[_0xf994('0x28')]=function(_0x43d91d,_0x5e0fc6){if(_0x43d91d[_0xf994('0x4c')]['id']){delete _0x43d91d[_0xf994('0x4c')]['id'];}return db['MailTransferReport'][_0xf994('0x4a')]({'where':{'id':_0x43d91d['params']['id']}})['then'](handleEntityNotFound(_0x5e0fc6,null))['then'](saveUpdates(_0x43d91d[_0xf994('0x4c')],null))['then'](respondWithResult(_0x5e0fc6,null))[_0xf994('0x47')](handleError(_0x5e0fc6,null));};exports[_0xf994('0x4d')]=function(_0x570e60,_0x158a0c){return db[_0xf994('0x2f')]['find']({'where':{'id':_0x570e60[_0xf994('0x49')]['id']}})[_0xf994('0x29')](handleEntityNotFound(_0x158a0c,null))[_0xf994('0x29')](removeEntity(_0x158a0c,null))[_0xf994('0x47')](handleError(_0x158a0c,null));};exports[_0xf994('0x4e')]=function(_0x1a4dea,_0x4d07c2){return db['MailTransferReport']['describe']()[_0xf994('0x29')](respondWithResult(_0x4d07c2,null))[_0xf994('0x47')](handleError(_0x4d07c2,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 9b2430f..2e398b1 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 _0x943c=['path','rimraf','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','request-promise'];(function(_0x2c8e77,_0x2dc145){var _0x31b69a=function(_0x243a9b){while(--_0x243a9b){_0x2c8e77['push'](_0x2c8e77['shift']());}};_0x31b69a(++_0x2dc145);}(_0x943c,0xd8));var _0xc943=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x943c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc943('0x0'));var util=require(_0xc943('0x1'));var logger=require(_0xc943('0x2'))(_0xc943('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc943('0x4'));var fs=require('fs');var path=require(_0xc943('0x5'));var rimraf=require(_0xc943('0x6'));var config=require('../../config/environment');var attributes=require(_0xc943('0x7'));module[_0xc943('0x8')]=function(_0x3307ef,_0xaff37f){return _0x3307ef[_0xc943('0x9')](_0xc943('0xa'),attributes,{'tableName':_0xc943('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xc943('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcba7=['MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./mailTransferReport.attributes','exports','define'];(function(_0x189b61,_0x30c36d){var _0x42dfac=function(_0x3e657f){while(--_0x3e657f){_0x189b61['push'](_0x189b61['shift']());}};_0x42dfac(++_0x30c36d);}(_0xcba7,0x199));var _0x7cba=function(_0x5210a2,_0x4f5288){_0x5210a2=_0x5210a2-0x0;var _0x597bd9=_0xcba7[_0x5210a2];return _0x597bd9;};'use strict';var _=require(_0x7cba('0x0'));var util=require(_0x7cba('0x1'));var logger=require(_0x7cba('0x2'))(_0x7cba('0x3'));var moment=require('moment');var BPromise=require(_0x7cba('0x4'));var rp=require(_0x7cba('0x5'));var fs=require('fs');var path=require(_0x7cba('0x6'));var rimraf=require('rimraf');var config=require(_0x7cba('0x7'));var attributes=require(_0x7cba('0x8'));module[_0x7cba('0x9')]=function(_0x2b0112,_0x285928){return _0x2b0112[_0x7cba('0xa')](_0x7cba('0xb'),attributes,{'tableName':_0x7cba('0xc'),'paranoid':![],'indexes':[{'name':_0x7cba('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 188488f..b1fa59b 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 _0x9491=['client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x9491,0x7b));var _0x1949=function(_0x3096d9,_0x23d5fb){_0x3096d9=_0x3096d9-0x0;var _0x3dc623=_0x9491[_0x3096d9];return _0x3dc623;};'use strict';var _=require(_0x1949('0x0'));var util=require(_0x1949('0x1'));var moment=require(_0x1949('0x2'));var BPromise=require(_0x1949('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1949('0x4'))['db'];var utils=require(_0x1949('0x5'));var logger=require('../../config/logger')(_0x1949('0x6'));var config=require(_0x1949('0x7'));var jayson=require(_0x1949('0x8'));var client=jayson[_0x1949('0x9')][_0x1949('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x265f65,_0x481bd9,_0x7441f6){return new BPromise(function(_0x27a7d5,_0x229f04){return client[_0x1949('0xb')](_0x265f65,_0x7441f6)[_0x1949('0xc')](function(_0x4727ec){logger[_0x1949('0xd')](_0x1949('0xe'),_0x481bd9,_0x1949('0xf'));logger['debug']('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x481bd9,_0x1949('0xf'),JSON[_0x1949('0x10')](_0x4727ec));if(_0x4727ec[_0x1949('0x11')]){if(_0x4727ec[_0x1949('0x11')][_0x1949('0x12')]===0x1f4){logger[_0x1949('0x11')](_0x1949('0xe'),_0x481bd9,_0x4727ec[_0x1949('0x11')][_0x1949('0x13')]);return _0x229f04(_0x4727ec[_0x1949('0x11')][_0x1949('0x13')]);}logger[_0x1949('0x11')](_0x1949('0xe'),_0x481bd9,_0x4727ec[_0x1949('0x11')][_0x1949('0x13')]);return _0x27a7d5(_0x4727ec[_0x1949('0x11')][_0x1949('0x13')]);}else{logger[_0x1949('0xd')](_0x1949('0xe'),_0x481bd9,_0x1949('0xf'));_0x27a7d5(_0x4727ec[_0x1949('0x14')][_0x1949('0x13')]);}})[_0x1949('0x15')](function(_0x33acf9){logger[_0x1949('0x11')](_0x1949('0xe'),_0x481bd9,_0x33acf9);_0x229f04(_0x33acf9);});});} \ No newline at end of file +var _0x04f8=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x14e69a,_0x2eac7c){var _0x26adb8=function(_0x21d3b7){while(--_0x21d3b7){_0x14e69a['push'](_0x14e69a['shift']());}};_0x26adb8(++_0x2eac7c);}(_0x04f8,0x169));var _0x804f=function(_0x4a97a0,_0x402d83){_0x4a97a0=_0x4a97a0-0x0;var _0x25da48=_0x04f8[_0x4a97a0];return _0x25da48;};'use strict';var _=require(_0x804f('0x0'));var util=require(_0x804f('0x1'));var moment=require(_0x804f('0x2'));var BPromise=require('bluebird');var rs=require(_0x804f('0x3'));var fs=require('fs');var Redis=require(_0x804f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x804f('0x5'));var logger=require(_0x804f('0x6'))(_0x804f('0x7'));var config=require(_0x804f('0x8'));var jayson=require(_0x804f('0x9'));var client=jayson[_0x804f('0xa')][_0x804f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c09bc,_0x1181e2,_0xd82f98){return new BPromise(function(_0x400260,_0x2d6801){return client[_0x804f('0xc')](_0x1c09bc,_0xd82f98)[_0x804f('0xd')](function(_0x266802){logger[_0x804f('0xe')](_0x804f('0xf'),_0x1181e2,_0x804f('0x10'));logger[_0x804f('0x11')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x1181e2,_0x804f('0x10'),JSON[_0x804f('0x12')](_0x266802));if(_0x266802[_0x804f('0x13')]){if(_0x266802[_0x804f('0x13')][_0x804f('0x14')]===0x1f4){logger[_0x804f('0x13')](_0x804f('0xf'),_0x1181e2,_0x266802[_0x804f('0x13')]['message']);return _0x2d6801(_0x266802[_0x804f('0x13')][_0x804f('0x15')]);}logger[_0x804f('0x13')]('MailTransferReport,\x20%s,\x20%s',_0x1181e2,_0x266802['error'][_0x804f('0x15')]);return _0x400260(_0x266802[_0x804f('0x13')][_0x804f('0x15')]);}else{logger[_0x804f('0xe')](_0x804f('0xf'),_0x1181e2,'request\x20sent');_0x400260(_0x266802['result'][_0x804f('0x15')]);}})[_0x804f('0x16')](function(_0xf051e2){logger[_0x804f('0x13')]('MailTransferReport,\x20%s,\x20%s',_0x1181e2,_0xf051e2);_0x2d6801(_0xf051e2);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index f41dea4..6821978 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 _0x416f=['./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','put','update','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0xe7281f,_0x2d77c3){var _0x90dc99=function(_0x1e335b){while(--_0x1e335b){_0xe7281f['push'](_0xe7281f['shift']());}};_0x90dc99(++_0x2d77c3);}(_0x416f,0x12b));var _0xf416=function(_0x57d239,_0x45fdb9){_0x57d239=_0x57d239-0x0;var _0x2a4e5d=_0x416f[_0x57d239];return _0x2a4e5d;};'use strict';var multer=require(_0xf416('0x0'));var util=require(_0xf416('0x1'));var path=require(_0xf416('0x2'));var timeout=require(_0xf416('0x3'));var express=require('express');var router=express[_0xf416('0x4')]();var fs_extra=require(_0xf416('0x5'));var auth=require(_0xf416('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf416('0x7'));router[_0xf416('0x8')]('/',auth[_0xf416('0x9')](),controller[_0xf416('0xa')]);router['get'](_0xf416('0xb'),auth['isAuthenticated'](),controller[_0xf416('0xc')]);router[_0xf416('0x8')](_0xf416('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xf416('0xe')]('/',auth[_0xf416('0x9')](),controller['create']);router[_0xf416('0xf')](_0xf416('0xd'),auth[_0xf416('0x9')](),controller[_0xf416('0x10')]);router[_0xf416('0x11')](_0xf416('0xd'),auth[_0xf416('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd095=['Router','fs-extra','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id','create','put','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x1dd034,_0x5f5a76){var _0x4ecb48=function(_0x18ee58){while(--_0x18ee58){_0x1dd034['push'](_0x1dd034['shift']());}};_0x4ecb48(++_0x5f5a76);}(_0xd095,0x100));var _0x5d09=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xd095[_0x263a74];return _0x2aa86c;};'use strict';var multer=require(_0x5d09('0x0'));var util=require(_0x5d09('0x1'));var path=require(_0x5d09('0x2'));var timeout=require(_0x5d09('0x3'));var express=require('express');var router=express[_0x5d09('0x4')]();var fs_extra=require(_0x5d09('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5d09('0x6'));var config=require(_0x5d09('0x7'));var controller=require(_0x5d09('0x8'));router[_0x5d09('0x9')]('/',auth[_0x5d09('0xa')](),controller[_0x5d09('0xb')]);router['get'](_0x5d09('0xc'),auth[_0x5d09('0xa')](),controller[_0x5d09('0xd')]);router['get'](_0x5d09('0xe'),auth[_0x5d09('0xa')](),controller['show']);router['post']('/',auth[_0x5d09('0xa')](),controller[_0x5d09('0xf')]);router[_0x5d09('0x10')](_0x5d09('0xe'),auth[_0x5d09('0xa')](),controller[_0x5d09('0x11')]);router['delete'](_0x5d09('0xe'),auth[_0x5d09('0xa')](),controller[_0x5d09('0x12')]);module[_0x5d09('0x13')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index f3f08fe..92e9c39 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 _0xfc4c=['diff','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','sequelize','moment','exports','STRING','INTEGER','DATE','getDataValue','enterAt'];(function(_0x19fa95,_0x1cca0a){var _0x58a835=function(_0x3e1957){while(--_0x3e1957){_0x19fa95['push'](_0x19fa95['shift']());}};_0x58a835(++_0x1cca0a);}(_0xfc4c,0xca));var _0xcfc4=function(_0x4c5bc6,_0x31390a){_0x4c5bc6=_0x4c5bc6-0x0;var _0x4e5a64=_0xfc4c[_0x4c5bc6];return _0x4e5a64;};'use strict';var Sequelize=require(_0xcfc4('0x0'));var moment=require(_0xcfc4('0x1'));module[_0xcfc4('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xcfc4('0x3')]},'interface':{'type':Sequelize[_0xcfc4('0x3')]},'type':{'type':Sequelize[_0xcfc4('0x3')],'defaultValue':'DEFAULT\x20PAUSE','comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0xcfc4('0x4')]},'enterAt':{'type':Sequelize[_0xcfc4('0x5')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x4a4db3){var _0x30b6d4=moment(_0x4a4db3);var _0x53486d=moment(this[_0xcfc4('0x6')](_0xcfc4('0x7')));var _0x520566=_0x30b6d4[_0xcfc4('0x8')](_0x53486d,'seconds');this['setDataValue']('exitAt',_0x4a4db3);this[_0xcfc4('0x9')](_0xcfc4('0xa'),_0x520566||null);}},'data1':{'type':Sequelize['STRING'],'comment':_0xcfc4('0xb')},'data2':{'type':Sequelize['STRING'],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0xcfc4('0x3')],'comment':_0xcfc4('0xc')},'data4':{'type':Sequelize[_0xcfc4('0x3')],'comment':_0xcfc4('0xd')},'data5':{'type':Sequelize[_0xcfc4('0x3')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0xcfc4('0x3')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xcfc4('0x3')]}}; \ No newline at end of file +var _0x5309=['exitAt','duration','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','seconds','setDataValue'];(function(_0x4492af,_0x47e25d){var _0x216729=function(_0x4964c8){while(--_0x4964c8){_0x4492af['push'](_0x4492af['shift']());}};_0x216729(++_0x47e25d);}(_0x5309,0x1aa));var _0x9530=function(_0x450bf9,_0x1895de){_0x450bf9=_0x450bf9-0x0;var _0x268350=_0x5309[_0x450bf9];return _0x268350;};'use strict';var Sequelize=require(_0x9530('0x0'));var moment=require(_0x9530('0x1'));module[_0x9530('0x2')]={'channel':{'type':Sequelize[_0x9530('0x3')]},'membername':{'type':Sequelize[_0x9530('0x3')]},'interface':{'type':Sequelize[_0x9530('0x3')]},'type':{'type':Sequelize[_0x9530('0x3')],'defaultValue':_0x9530('0x4'),'comment':_0x9530('0x5')},'duration':{'type':Sequelize[_0x9530('0x6')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x1cb512){var _0x187678=moment(_0x1cb512);var _0x1259cc=moment(this['getDataValue']('enterAt'));var _0x24f66b=_0x187678['diff'](_0x1259cc,_0x9530('0x7'));this[_0x9530('0x8')](_0x9530('0x9'),_0x1cb512);this[_0x9530('0x8')](_0x9530('0xa'),_0x24f66b||null);}},'data1':{'type':Sequelize[_0x9530('0x3')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize['STRING'],'comment':_0x9530('0xb')},'data3':{'type':Sequelize[_0x9530('0x3')],'comment':_0x9530('0xc')},'data4':{'type':Sequelize[_0x9530('0x3')],'comment':_0x9530('0xd')},'data5':{'type':Sequelize[_0x9530('0x3')],'comment':_0x9530('0xe')},'role':{'type':Sequelize[_0x9530('0x3')]},'internal':{'type':Sequelize[_0x9530('0x6')]},'uniqueid':{'type':Sequelize[_0x9530('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index e29260c..0c2e8c3 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 _0x7217=['query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','filter','includeAll','include','rows','catch','show','params','rawAttributes','length','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','send','index','map','MemberReport','fieldName','type','model','name','keys'];(function(_0x4768ce,_0x1565ce){var _0x31e30b=function(_0x71e32d){while(--_0x71e32d){_0x4768ce['push'](_0x4768ce['shift']());}};_0x31e30b(++_0x1565ce);}(_0x7217,0x19e));var _0x7721=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x7217[_0x37bd26];return _0xe83dc4;};'use strict';var emlformat=require(_0x7721('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7721('0x1'));var jsonpatch=require(_0x7721('0x2'));var rp=require(_0x7721('0x3'));var moment=require(_0x7721('0x4'));var BPromise=require(_0x7721('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7721('0x6'));var sox=require(_0x7721('0x7'));var csv=require(_0x7721('0x8'));var ejs=require(_0x7721('0x9'));var fs=require('fs');var fs_extra=require(_0x7721('0xa'));var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x8'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var licenseUtil=require(_0x7721('0x1a'));var db=require(_0x7721('0x1b'))['db'];function respondWithStatusCode(_0x55b4ca,_0x2911ec){_0x2911ec=_0x2911ec||0xcc;return function(_0x199930){if(_0x199930){return _0x55b4ca['sendStatus'](_0x2911ec);}return _0x55b4ca[_0x7721('0x1c')](_0x2911ec)[_0x7721('0x1d')]();};}function respondWithResult(_0x3f01c5,_0x2e9752){_0x2e9752=_0x2e9752||0xc8;return function(_0x5069da){if(_0x5069da){return _0x3f01c5[_0x7721('0x1c')](_0x2e9752)[_0x7721('0x1e')](_0x5069da);}};}function respondWithFilteredResult(_0x534f1b,_0x4e199a){return function(_0x4b183e){if(_0x4b183e){var _0x5ed54=typeof _0x4e199a[_0x7721('0x1f')]===_0x7721('0x20')&&typeof _0x4e199a[_0x7721('0x21')]==='undefined';var _0x20f669=_0x4b183e['count'];var _0x3fc09e=_0x5ed54?0x0:_0x4e199a['offset'];var _0xfec626=_0x5ed54?_0x4b183e[_0x7721('0x22')]:_0x4e199a[_0x7721('0x1f')]+_0x4e199a[_0x7721('0x21')];var _0x2286e5;if(_0xfec626>=_0x20f669){_0xfec626=_0x20f669;_0x2286e5=0xc8;}else{_0x2286e5=0xce;}_0x534f1b[_0x7721('0x1c')](_0x2286e5);return _0x534f1b[_0x7721('0x23')](_0x7721('0x24'),_0x3fc09e+'-'+_0xfec626+'/'+_0x20f669)[_0x7721('0x1e')](_0x4b183e);}return null;};}function patchUpdates(_0xaeccc4){return function(_0x4ce1db){try{jsonpatch[_0x7721('0x25')](_0x4ce1db,_0xaeccc4,!![]);}catch(_0x2c1583){return BPromise[_0x7721('0x26')](_0x2c1583);}return _0x4ce1db[_0x7721('0x27')]();};}function saveUpdates(_0x57140c,_0x28f5a6){return function(_0x512f31){if(_0x512f31){return _0x512f31[_0x7721('0x28')](_0x57140c)[_0x7721('0x29')](function(_0x3e8a4e){return _0x3e8a4e;});}return null;};}function removeEntity(_0x1caad8,_0x121cc4){return function(_0x395b15){if(_0x395b15){return _0x395b15[_0x7721('0x2a')]()['then'](function(){_0x1caad8[_0x7721('0x1c')](0xcc)[_0x7721('0x1d')]();});}};}function handleEntityNotFound(_0x125564,_0x1f67c7){return function(_0x40d550){if(!_0x40d550){_0x125564[_0x7721('0x2b')](0x194);}return _0x40d550;};}function handleError(_0x424e05,_0xf753f1){_0xf753f1=_0xf753f1||0x1f4;return function(_0x40f367){logger['error'](_0x40f367[_0x7721('0x2c')]);if(_0x40f367['name']){delete _0x40f367['name'];}_0x424e05[_0x7721('0x1c')](_0xf753f1)[_0x7721('0x2d')](_0x40f367);};}exports[_0x7721('0x2e')]=function(_0x158d98,_0x1ea4d){var _0x37b9f0={},_0xd7d703={},_0x1da2d8={'count':0x0,'rows':[]};var _0x5c54f0=_[_0x7721('0x2f')](db[_0x7721('0x30')]['rawAttributes'],function(_0x4a25c9){return{'name':_0x4a25c9[_0x7721('0x31')],'type':_0x4a25c9[_0x7721('0x32')]['key']};});_0xd7d703[_0x7721('0x33')]=_[_0x7721('0x2f')](_0x5c54f0,_0x7721('0x34'));_0xd7d703['query']=_[_0x7721('0x35')](_0x158d98[_0x7721('0x36')]);_0xd7d703[_0x7721('0x37')]=_[_0x7721('0x38')](_0xd7d703[_0x7721('0x33')],_0xd7d703['query']);_0x37b9f0[_0x7721('0x39')]=_[_0x7721('0x38')](_0xd7d703[_0x7721('0x33')],qs['fields'](_0x158d98[_0x7721('0x36')][_0x7721('0x3a')]));_0x37b9f0['attributes']=_0x37b9f0[_0x7721('0x39')]['length']?_0x37b9f0[_0x7721('0x39')]:_0xd7d703[_0x7721('0x33')];if(!_0x158d98[_0x7721('0x36')][_0x7721('0x3b')](_0x7721('0x3c'))){_0x37b9f0[_0x7721('0x21')]=qs[_0x7721('0x21')](_0x158d98[_0x7721('0x36')][_0x7721('0x21')]);_0x37b9f0[_0x7721('0x1f')]=qs[_0x7721('0x1f')](_0x158d98['query'][_0x7721('0x1f')]);}_0x37b9f0['order']=qs[_0x7721('0x3d')](_0x158d98[_0x7721('0x36')][_0x7721('0x3d')]);_0x37b9f0[_0x7721('0x3e')]=qs[_0x7721('0x37')](_[_0x7721('0x3f')](_0x158d98['query'],_0xd7d703['filters']),_0x5c54f0);if(_0x158d98['query']['filter']){_0x37b9f0[_0x7721('0x3e')]=_[_0x7721('0x40')](_0x37b9f0[_0x7721('0x3e')],{'$or':_[_0x7721('0x2f')](_0x5c54f0,function(_0x4a90ce){if(_0x4a90ce[_0x7721('0x32')]!=='VIRTUAL'){var _0xfab37b={};_0xfab37b[_0x4a90ce[_0x7721('0x34')]]={'$like':'%'+_0x158d98['query'][_0x7721('0x41')]+'%'};return _0xfab37b;}})});}_0x37b9f0=_[_0x7721('0x40')]({},_0x37b9f0,_0x158d98['options']);var _0x4d0111={'where':_0x37b9f0[_0x7721('0x3e')]};return db[_0x7721('0x30')][_0x7721('0x22')](_0x4d0111)[_0x7721('0x29')](function(_0x577af9){_0x1da2d8[_0x7721('0x22')]=_0x577af9;if(_0x158d98[_0x7721('0x36')][_0x7721('0x42')]){_0x37b9f0[_0x7721('0x43')]=[{'all':!![]}];}return db[_0x7721('0x30')]['findAll'](_0x37b9f0);})[_0x7721('0x29')](function(_0x4a2c28){_0x1da2d8[_0x7721('0x44')]=_0x4a2c28;return _0x1da2d8;})['then'](respondWithFilteredResult(_0x1ea4d,_0x37b9f0))[_0x7721('0x45')](handleError(_0x1ea4d,null));};exports[_0x7721('0x46')]=function(_0x231dad,_0x49e0c5){var _0x1453d4={'raw':!![],'where':{'id':_0x231dad[_0x7721('0x47')]['id']}},_0x11d853={};_0x11d853['model']=_[_0x7721('0x35')](db[_0x7721('0x30')][_0x7721('0x48')]);_0x11d853[_0x7721('0x36')]=_[_0x7721('0x35')](_0x231dad[_0x7721('0x36')]);_0x11d853[_0x7721('0x37')]=_['intersection'](_0x11d853['model'],_0x11d853[_0x7721('0x36')]);_0x1453d4[_0x7721('0x39')]=_[_0x7721('0x38')](_0x11d853[_0x7721('0x33')],qs[_0x7721('0x3a')](_0x231dad[_0x7721('0x36')][_0x7721('0x3a')]));_0x1453d4[_0x7721('0x39')]=_0x1453d4[_0x7721('0x39')][_0x7721('0x49')]?_0x1453d4['attributes']:_0x11d853['model'];if(_0x231dad[_0x7721('0x36')][_0x7721('0x42')]){_0x1453d4[_0x7721('0x43')]=[{'all':!![]}];}_0x1453d4=_[_0x7721('0x40')]({},_0x1453d4,_0x231dad['options']);return db[_0x7721('0x30')][_0x7721('0x4a')](_0x1453d4)['then'](handleEntityNotFound(_0x49e0c5,null))[_0x7721('0x29')](respondWithResult(_0x49e0c5,null))['catch'](handleError(_0x49e0c5,null));};exports[_0x7721('0x4b')]=function(_0x5c6922,_0x334f23){return db[_0x7721('0x30')][_0x7721('0x4b')](_0x5c6922['body'],{})[_0x7721('0x29')](respondWithResult(_0x334f23,0xc9))[_0x7721('0x45')](handleError(_0x334f23,null));};exports['update']=function(_0x223d93,_0x1196c2){if(_0x223d93[_0x7721('0x4c')]['id']){delete _0x223d93['body']['id'];}return db[_0x7721('0x30')]['find']({'where':{'id':_0x223d93[_0x7721('0x47')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x1196c2,null))[_0x7721('0x29')](saveUpdates(_0x223d93[_0x7721('0x4c')],null))[_0x7721('0x29')](respondWithResult(_0x1196c2,null))[_0x7721('0x45')](handleError(_0x1196c2,null));};exports[_0x7721('0x2a')]=function(_0x7fbb73,_0x694d2f){return db[_0x7721('0x30')][_0x7721('0x4a')]({'where':{'id':_0x7fbb73[_0x7721('0x47')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x694d2f,null))[_0x7721('0x29')](removeEntity(_0x694d2f,null))[_0x7721('0x45')](handleError(_0x694d2f,null));};exports['describe']=function(_0x474f32,_0x2f6f30){return db[_0x7721('0x30')][_0x7721('0x4d')]()[_0x7721('0x29')](respondWithResult(_0x2f6f30,null))[_0x7721('0x45')](handleError(_0x2f6f30,null));}; \ No newline at end of file +var _0x7217=['query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','filter','includeAll','include','rows','catch','show','params','rawAttributes','length','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','send','index','map','MemberReport','fieldName','type','model','name','keys'];(function(_0x1ac46f,_0x1c3afa){var _0x88f3c1=function(_0x2d8ce7){while(--_0x2d8ce7){_0x1ac46f['push'](_0x1ac46f['shift']());}};_0x88f3c1(++_0x1c3afa);}(_0x7217,0x19e));var _0x7721=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0x7217[_0x5037ab];return _0x512adb;};'use strict';var emlformat=require(_0x7721('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7721('0x1'));var jsonpatch=require(_0x7721('0x2'));var rp=require(_0x7721('0x3'));var moment=require(_0x7721('0x4'));var BPromise=require(_0x7721('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7721('0x6'));var sox=require(_0x7721('0x7'));var csv=require(_0x7721('0x8'));var ejs=require(_0x7721('0x9'));var fs=require('fs');var fs_extra=require(_0x7721('0xa'));var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x8'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var licenseUtil=require(_0x7721('0x1a'));var db=require(_0x7721('0x1b'))['db'];function respondWithStatusCode(_0x55b4ca,_0x2911ec){_0x2911ec=_0x2911ec||0xcc;return function(_0x199930){if(_0x199930){return _0x55b4ca['sendStatus'](_0x2911ec);}return _0x55b4ca[_0x7721('0x1c')](_0x2911ec)[_0x7721('0x1d')]();};}function respondWithResult(_0x3f01c5,_0x2e9752){_0x2e9752=_0x2e9752||0xc8;return function(_0x5069da){if(_0x5069da){return _0x3f01c5[_0x7721('0x1c')](_0x2e9752)[_0x7721('0x1e')](_0x5069da);}};}function respondWithFilteredResult(_0x534f1b,_0x4e199a){return function(_0x4b183e){if(_0x4b183e){var _0x5ed54=typeof _0x4e199a[_0x7721('0x1f')]===_0x7721('0x20')&&typeof _0x4e199a[_0x7721('0x21')]==='undefined';var _0x20f669=_0x4b183e['count'];var _0x3fc09e=_0x5ed54?0x0:_0x4e199a['offset'];var _0xfec626=_0x5ed54?_0x4b183e[_0x7721('0x22')]:_0x4e199a[_0x7721('0x1f')]+_0x4e199a[_0x7721('0x21')];var _0x2286e5;if(_0xfec626>=_0x20f669){_0xfec626=_0x20f669;_0x2286e5=0xc8;}else{_0x2286e5=0xce;}_0x534f1b[_0x7721('0x1c')](_0x2286e5);return _0x534f1b[_0x7721('0x23')](_0x7721('0x24'),_0x3fc09e+'-'+_0xfec626+'/'+_0x20f669)[_0x7721('0x1e')](_0x4b183e);}return null;};}function patchUpdates(_0xaeccc4){return function(_0x4ce1db){try{jsonpatch[_0x7721('0x25')](_0x4ce1db,_0xaeccc4,!![]);}catch(_0x2c1583){return BPromise[_0x7721('0x26')](_0x2c1583);}return _0x4ce1db[_0x7721('0x27')]();};}function saveUpdates(_0x57140c,_0x28f5a6){return function(_0x512f31){if(_0x512f31){return _0x512f31[_0x7721('0x28')](_0x57140c)[_0x7721('0x29')](function(_0x3e8a4e){return _0x3e8a4e;});}return null;};}function removeEntity(_0x1caad8,_0x121cc4){return function(_0x395b15){if(_0x395b15){return _0x395b15[_0x7721('0x2a')]()['then'](function(){_0x1caad8[_0x7721('0x1c')](0xcc)[_0x7721('0x1d')]();});}};}function handleEntityNotFound(_0x125564,_0x1f67c7){return function(_0x40d550){if(!_0x40d550){_0x125564[_0x7721('0x2b')](0x194);}return _0x40d550;};}function handleError(_0x424e05,_0xf753f1){_0xf753f1=_0xf753f1||0x1f4;return function(_0x40f367){logger['error'](_0x40f367[_0x7721('0x2c')]);if(_0x40f367['name']){delete _0x40f367['name'];}_0x424e05[_0x7721('0x1c')](_0xf753f1)[_0x7721('0x2d')](_0x40f367);};}exports[_0x7721('0x2e')]=function(_0x158d98,_0x1ea4d){var _0x37b9f0={},_0xd7d703={},_0x1da2d8={'count':0x0,'rows':[]};var _0x5c54f0=_[_0x7721('0x2f')](db[_0x7721('0x30')]['rawAttributes'],function(_0x4a25c9){return{'name':_0x4a25c9[_0x7721('0x31')],'type':_0x4a25c9[_0x7721('0x32')]['key']};});_0xd7d703[_0x7721('0x33')]=_[_0x7721('0x2f')](_0x5c54f0,_0x7721('0x34'));_0xd7d703['query']=_[_0x7721('0x35')](_0x158d98[_0x7721('0x36')]);_0xd7d703[_0x7721('0x37')]=_[_0x7721('0x38')](_0xd7d703[_0x7721('0x33')],_0xd7d703['query']);_0x37b9f0[_0x7721('0x39')]=_[_0x7721('0x38')](_0xd7d703[_0x7721('0x33')],qs['fields'](_0x158d98[_0x7721('0x36')][_0x7721('0x3a')]));_0x37b9f0['attributes']=_0x37b9f0[_0x7721('0x39')]['length']?_0x37b9f0[_0x7721('0x39')]:_0xd7d703[_0x7721('0x33')];if(!_0x158d98[_0x7721('0x36')][_0x7721('0x3b')](_0x7721('0x3c'))){_0x37b9f0[_0x7721('0x21')]=qs[_0x7721('0x21')](_0x158d98[_0x7721('0x36')][_0x7721('0x21')]);_0x37b9f0[_0x7721('0x1f')]=qs[_0x7721('0x1f')](_0x158d98['query'][_0x7721('0x1f')]);}_0x37b9f0['order']=qs[_0x7721('0x3d')](_0x158d98[_0x7721('0x36')][_0x7721('0x3d')]);_0x37b9f0[_0x7721('0x3e')]=qs[_0x7721('0x37')](_[_0x7721('0x3f')](_0x158d98['query'],_0xd7d703['filters']),_0x5c54f0);if(_0x158d98['query']['filter']){_0x37b9f0[_0x7721('0x3e')]=_[_0x7721('0x40')](_0x37b9f0[_0x7721('0x3e')],{'$or':_[_0x7721('0x2f')](_0x5c54f0,function(_0x4a90ce){if(_0x4a90ce[_0x7721('0x32')]!=='VIRTUAL'){var _0xfab37b={};_0xfab37b[_0x4a90ce[_0x7721('0x34')]]={'$like':'%'+_0x158d98['query'][_0x7721('0x41')]+'%'};return _0xfab37b;}})});}_0x37b9f0=_[_0x7721('0x40')]({},_0x37b9f0,_0x158d98['options']);var _0x4d0111={'where':_0x37b9f0[_0x7721('0x3e')]};return db[_0x7721('0x30')][_0x7721('0x22')](_0x4d0111)[_0x7721('0x29')](function(_0x577af9){_0x1da2d8[_0x7721('0x22')]=_0x577af9;if(_0x158d98[_0x7721('0x36')][_0x7721('0x42')]){_0x37b9f0[_0x7721('0x43')]=[{'all':!![]}];}return db[_0x7721('0x30')]['findAll'](_0x37b9f0);})[_0x7721('0x29')](function(_0x4a2c28){_0x1da2d8[_0x7721('0x44')]=_0x4a2c28;return _0x1da2d8;})['then'](respondWithFilteredResult(_0x1ea4d,_0x37b9f0))[_0x7721('0x45')](handleError(_0x1ea4d,null));};exports[_0x7721('0x46')]=function(_0x231dad,_0x49e0c5){var _0x1453d4={'raw':!![],'where':{'id':_0x231dad[_0x7721('0x47')]['id']}},_0x11d853={};_0x11d853['model']=_[_0x7721('0x35')](db[_0x7721('0x30')][_0x7721('0x48')]);_0x11d853[_0x7721('0x36')]=_[_0x7721('0x35')](_0x231dad[_0x7721('0x36')]);_0x11d853[_0x7721('0x37')]=_['intersection'](_0x11d853['model'],_0x11d853[_0x7721('0x36')]);_0x1453d4[_0x7721('0x39')]=_[_0x7721('0x38')](_0x11d853[_0x7721('0x33')],qs[_0x7721('0x3a')](_0x231dad[_0x7721('0x36')][_0x7721('0x3a')]));_0x1453d4[_0x7721('0x39')]=_0x1453d4[_0x7721('0x39')][_0x7721('0x49')]?_0x1453d4['attributes']:_0x11d853['model'];if(_0x231dad[_0x7721('0x36')][_0x7721('0x42')]){_0x1453d4[_0x7721('0x43')]=[{'all':!![]}];}_0x1453d4=_[_0x7721('0x40')]({},_0x1453d4,_0x231dad['options']);return db[_0x7721('0x30')][_0x7721('0x4a')](_0x1453d4)['then'](handleEntityNotFound(_0x49e0c5,null))[_0x7721('0x29')](respondWithResult(_0x49e0c5,null))['catch'](handleError(_0x49e0c5,null));};exports[_0x7721('0x4b')]=function(_0x5c6922,_0x334f23){return db[_0x7721('0x30')][_0x7721('0x4b')](_0x5c6922['body'],{})[_0x7721('0x29')](respondWithResult(_0x334f23,0xc9))[_0x7721('0x45')](handleError(_0x334f23,null));};exports['update']=function(_0x223d93,_0x1196c2){if(_0x223d93[_0x7721('0x4c')]['id']){delete _0x223d93['body']['id'];}return db[_0x7721('0x30')]['find']({'where':{'id':_0x223d93[_0x7721('0x47')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x1196c2,null))[_0x7721('0x29')](saveUpdates(_0x223d93[_0x7721('0x4c')],null))[_0x7721('0x29')](respondWithResult(_0x1196c2,null))[_0x7721('0x45')](handleError(_0x1196c2,null));};exports[_0x7721('0x2a')]=function(_0x7fbb73,_0x694d2f){return db[_0x7721('0x30')][_0x7721('0x4a')]({'where':{'id':_0x7fbb73[_0x7721('0x47')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x694d2f,null))[_0x7721('0x29')](removeEntity(_0x694d2f,null))[_0x7721('0x45')](handleError(_0x694d2f,null));};exports['describe']=function(_0x474f32,_0x2f6f30){return db[_0x7721('0x30')][_0x7721('0x4d')]()[_0x7721('0x29')](respondWithResult(_0x2f6f30,null))[_0x7721('0x45')](handleError(_0x2f6f30,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index da2143f..d21cf01 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 _0xfb6e=['exports','report_member','membername','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./memberReport.attributes'];(function(_0x556442,_0x206e57){var _0x3fa1f3=function(_0x316ec2){while(--_0x316ec2){_0x556442['push'](_0x556442['shift']());}};_0x3fa1f3(++_0x206e57);}(_0xfb6e,0x177));var _0xefb6=function(_0x1d541f,_0x1c3c26){_0x1d541f=_0x1d541f-0x0;var _0x571873=_0xfb6e[_0x1d541f];return _0x571873;};'use strict';var _=require('lodash');var util=require(_0xefb6('0x0'));var logger=require(_0xefb6('0x1'))(_0xefb6('0x2'));var moment=require(_0xefb6('0x3'));var BPromise=require(_0xefb6('0x4'));var rp=require(_0xefb6('0x5'));var fs=require('fs');var path=require(_0xefb6('0x6'));var rimraf=require(_0xefb6('0x7'));var config=require('../../config/environment');var attributes=require(_0xefb6('0x8'));module[_0xefb6('0x9')]=function(_0x5ccd16,_0x125a0d){return _0x5ccd16['define']('MemberReport',attributes,{'tableName':_0xefb6('0xa'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0xefb6('0xb'),'interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0x185d=['membername','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','MemberReport','report_member'];(function(_0xd7b7c4,_0x3bde33){var _0x3701d4=function(_0x37f7de){while(--_0x37f7de){_0xd7b7c4['push'](_0xd7b7c4['shift']());}};_0x3701d4(++_0x3bde33);}(_0x185d,0xe1));var _0xd185=function(_0x328bd3,_0x9cf5a5){_0x328bd3=_0x328bd3-0x0;var _0x458149=_0x185d[_0x328bd3];return _0x458149;};'use strict';var _=require('lodash');var util=require(_0xd185('0x0'));var logger=require(_0xd185('0x1'))(_0xd185('0x2'));var moment=require(_0xd185('0x3'));var BPromise=require(_0xd185('0x4'));var rp=require(_0xd185('0x5'));var fs=require('fs');var path=require(_0xd185('0x6'));var rimraf=require(_0xd185('0x7'));var config=require(_0xd185('0x8'));var attributes=require(_0xd185('0x9'));module[_0xd185('0xa')]=function(_0x2cfa74,_0x39699d){return _0x2cfa74['define'](_0xd185('0xb'),attributes,{'tableName':_0xd185('0xc'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0xd185('0xd'),'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 48162ae..8053564 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 _0x02ca=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MemberReport,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','MemberReport','options','raw','where','limit','map','include','attributes','model','GetMemberReport','debug','CreateMemberReport','create','body','UpdateMemberReport','update','lodash'];(function(_0x2e6118,_0x311be2){var _0x1616a2=function(_0x5a9d7f){while(--_0x5a9d7f){_0x2e6118['push'](_0x2e6118['shift']());}};_0x1616a2(++_0x311be2);}(_0x02ca,0x97));var _0xa02c=function(_0x195914,_0x4eac4f){_0x195914=_0x195914-0x0;var _0x22fb9e=_0x02ca[_0x195914];return _0x22fb9e;};'use strict';var _=require(_0xa02c('0x0'));var util=require('util');var moment=require(_0xa02c('0x1'));var BPromise=require(_0xa02c('0x2'));var rs=require(_0xa02c('0x3'));var fs=require('fs');var Redis=require(_0xa02c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa02c('0x5'));var logger=require(_0xa02c('0x6'))(_0xa02c('0x7'));var config=require(_0xa02c('0x8'));var jayson=require(_0xa02c('0x9'));var client=jayson[_0xa02c('0xa')][_0xa02c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29c64a,_0x2c87ec,_0x2b96c5){return new BPromise(function(_0x4033b9,_0x4dd173){return client[_0xa02c('0xc')](_0x29c64a,_0x2b96c5)[_0xa02c('0xd')](function(_0x203db6){logger[_0xa02c('0xe')](_0xa02c('0xf'),_0x2c87ec,'request\x20sent');logger['debug']('MemberReport,\x20%s,\x20%s,\x20%s',_0x2c87ec,'request\x20sent',JSON[_0xa02c('0x10')](_0x203db6));if(_0x203db6[_0xa02c('0x11')]){if(_0x203db6[_0xa02c('0x11')][_0xa02c('0x12')]===0x1f4){logger['error'](_0xa02c('0xf'),_0x2c87ec,_0x203db6[_0xa02c('0x11')][_0xa02c('0x13')]);return _0x4dd173(_0x203db6[_0xa02c('0x11')]['message']);}logger[_0xa02c('0x11')](_0xa02c('0xf'),_0x2c87ec,_0x203db6[_0xa02c('0x11')]['message']);return _0x4033b9(_0x203db6[_0xa02c('0x11')][_0xa02c('0x13')]);}else{logger['info'](_0xa02c('0xf'),_0x2c87ec,_0xa02c('0x14'));_0x4033b9(_0x203db6['result'][_0xa02c('0x13')]);}})[_0xa02c('0x15')](function(_0x2db206){logger['error'](_0xa02c('0xf'),_0x2c87ec,_0x2db206);_0x4dd173(_0x2db206);});});}exports['GetMemberReport']=function(_0x4d7cb5){var _0x592de1=this;return new Promise(function(_0x3fcc66,_0x10df83){return db[_0xa02c('0x16')]['findAll']({'raw':_0x4d7cb5[_0xa02c('0x17')]?_0x4d7cb5['options'][_0xa02c('0x18')]===undefined?!![]:![]:!![],'where':_0x4d7cb5[_0xa02c('0x17')]?_0x4d7cb5[_0xa02c('0x17')][_0xa02c('0x19')]||null:null,'attributes':_0x4d7cb5['options']?_0x4d7cb5[_0xa02c('0x17')]['attributes']||null:null,'limit':_0x4d7cb5[_0xa02c('0x17')]?_0x4d7cb5[_0xa02c('0x17')][_0xa02c('0x1a')]||null:null,'include':_0x4d7cb5['options']?_0x4d7cb5['options']['include']?_[_0xa02c('0x1b')](_0x4d7cb5[_0xa02c('0x17')][_0xa02c('0x1c')],function(_0x514ef1){return{'model':db[_0x514ef1['model']],'as':_0x514ef1['as'],'attributes':_0x514ef1[_0xa02c('0x1d')],'include':_0x514ef1[_0xa02c('0x1c')]?_[_0xa02c('0x1b')](_0x514ef1[_0xa02c('0x1c')],function(_0x437308){return{'model':db[_0x437308['model']],'as':_0x437308['as'],'attributes':_0x437308['attributes'],'include':_0x437308[_0xa02c('0x1c')]?_[_0xa02c('0x1b')](_0x437308[_0xa02c('0x1c')],function(_0x39124e){return{'model':db[_0x39124e[_0xa02c('0x1e')]],'as':_0x39124e['as'],'attributes':_0x39124e[_0xa02c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xa02c('0xd')](function(_0x419037){logger['info'](_0xa02c('0x1f'),_0x4d7cb5);logger[_0xa02c('0x20')](_0xa02c('0x1f'),_0x4d7cb5,JSON[_0xa02c('0x10')](_0x419037));_0x3fcc66(_0x419037);})[_0xa02c('0x15')](function(_0x402f72){logger[_0xa02c('0x11')](_0xa02c('0x1f'),_0x402f72[_0xa02c('0x13')],_0x4d7cb5);_0x10df83(_0x592de1['error'](0x1f4,_0x402f72[_0xa02c('0x13')]));});});};exports[_0xa02c('0x21')]=function(_0x279410){var _0x4de1ac=this;return new Promise(function(_0x58542a,_0x186fe9){return db[_0xa02c('0x16')][_0xa02c('0x22')](_0x279410[_0xa02c('0x23')],{'raw':_0x279410[_0xa02c('0x17')]?_0x279410[_0xa02c('0x17')][_0xa02c('0x18')]===undefined?!![]:![]:!![]})[_0xa02c('0xd')](function(_0x254124){logger[_0xa02c('0xe')]('CreateMemberReport',_0x279410);logger['debug'](_0xa02c('0x21'),_0x279410,JSON[_0xa02c('0x10')](_0x254124));_0x58542a(_0x254124);})[_0xa02c('0x15')](function(_0x3b93fb){logger[_0xa02c('0x11')](_0xa02c('0x21'),_0x3b93fb[_0xa02c('0x13')],_0x279410);_0x186fe9(_0x4de1ac[_0xa02c('0x11')](0x1f4,_0x3b93fb[_0xa02c('0x13')]));});});};exports[_0xa02c('0x24')]=function(_0x2ec390){var _0x4abc4d=this;return new Promise(function(_0x356095,_0x42f238){return db[_0xa02c('0x16')][_0xa02c('0x25')](_0x2ec390['body'],{'raw':_0x2ec390['options']?_0x2ec390[_0xa02c('0x17')][_0xa02c('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ec390['options']?_0x2ec390['options']['where']||null:null,'attributes':_0x2ec390['options']?_0x2ec390[_0xa02c('0x17')][_0xa02c('0x1d')]||null:null,'limit':_0x2ec390[_0xa02c('0x17')]?_0x2ec390[_0xa02c('0x17')]['limit']||null:null})[_0xa02c('0xd')](function(_0x281455){logger[_0xa02c('0xe')](_0xa02c('0x24'),_0x2ec390);logger[_0xa02c('0x20')](_0xa02c('0x24'),_0x2ec390,JSON[_0xa02c('0x10')](_0x281455));_0x356095(_0x281455);})[_0xa02c('0x15')](function(_0x520764){logger['error'](_0xa02c('0x24'),_0x520764[_0xa02c('0x13')],_0x2ec390);_0x42f238(_0x4abc4d[_0xa02c('0x11')](0x1f4,_0x520764[_0xa02c('0x13')]));});});}; \ No newline at end of file +var _0xeecc=['model','CreateMemberReport','create','body','UpdateMemberReport','lodash','util','moment','bluebird','ioredis','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MemberReport,\x20%s,\x20%s','message','result','catch','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','map','include'];(function(_0x404a19,_0xf4fa9c){var _0x23ae6a=function(_0xdde5e9){while(--_0xdde5e9){_0x404a19['push'](_0x404a19['shift']());}};_0x23ae6a(++_0xf4fa9c);}(_0xeecc,0x12d));var _0xceec=function(_0x394123,_0x59311a){_0x394123=_0x394123-0x0;var _0x1c50ec=_0xeecc[_0x394123];return _0x1c50ec;};'use strict';var _=require(_0xceec('0x0'));var util=require(_0xceec('0x1'));var moment=require(_0xceec('0x2'));var BPromise=require(_0xceec('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xceec('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xceec('0x5'));var config=require(_0xceec('0x6'));var jayson=require(_0xceec('0x7'));var client=jayson[_0xceec('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x252885,_0x4c84cf,_0x30a3b1){return new BPromise(function(_0x19413a,_0x11733f){return client[_0xceec('0x9')](_0x252885,_0x30a3b1)[_0xceec('0xa')](function(_0xda7733){logger[_0xceec('0xb')]('MemberReport,\x20%s,\x20%s',_0x4c84cf,_0xceec('0xc'));logger[_0xceec('0xd')](_0xceec('0xe'),_0x4c84cf,_0xceec('0xc'),JSON[_0xceec('0xf')](_0xda7733));if(_0xda7733['error']){if(_0xda7733[_0xceec('0x10')][_0xceec('0x11')]===0x1f4){logger[_0xceec('0x10')](_0xceec('0x12'),_0x4c84cf,_0xda7733[_0xceec('0x10')]['message']);return _0x11733f(_0xda7733[_0xceec('0x10')]['message']);}logger[_0xceec('0x10')](_0xceec('0x12'),_0x4c84cf,_0xda7733[_0xceec('0x10')]['message']);return _0x19413a(_0xda7733['error'][_0xceec('0x13')]);}else{logger['info'](_0xceec('0x12'),_0x4c84cf,_0xceec('0xc'));_0x19413a(_0xda7733[_0xceec('0x14')][_0xceec('0x13')]);}})[_0xceec('0x15')](function(_0x3fea07){logger[_0xceec('0x10')](_0xceec('0x12'),_0x4c84cf,_0x3fea07);_0x11733f(_0x3fea07);});});}exports[_0xceec('0x16')]=function(_0xf3be05){var _0x206458=this;return new Promise(function(_0x4e1b81,_0x19696){return db[_0xceec('0x17')][_0xceec('0x18')]({'raw':_0xf3be05[_0xceec('0x19')]?_0xf3be05[_0xceec('0x19')][_0xceec('0x1a')]===undefined?!![]:![]:!![],'where':_0xf3be05[_0xceec('0x19')]?_0xf3be05[_0xceec('0x19')][_0xceec('0x1b')]||null:null,'attributes':_0xf3be05[_0xceec('0x19')]?_0xf3be05['options'][_0xceec('0x1c')]||null:null,'limit':_0xf3be05['options']?_0xf3be05[_0xceec('0x19')][_0xceec('0x1d')]||null:null,'include':_0xf3be05['options']?_0xf3be05[_0xceec('0x19')]['include']?_[_0xceec('0x1e')](_0xf3be05[_0xceec('0x19')][_0xceec('0x1f')],function(_0x1a7fd){return{'model':db[_0x1a7fd[_0xceec('0x20')]],'as':_0x1a7fd['as'],'attributes':_0x1a7fd[_0xceec('0x1c')],'include':_0x1a7fd[_0xceec('0x1f')]?_['map'](_0x1a7fd[_0xceec('0x1f')],function(_0x58bba7){return{'model':db[_0x58bba7[_0xceec('0x20')]],'as':_0x58bba7['as'],'attributes':_0x58bba7[_0xceec('0x1c')],'include':_0x58bba7[_0xceec('0x1f')]?_[_0xceec('0x1e')](_0x58bba7[_0xceec('0x1f')],function(_0x2cb07d){return{'model':db[_0x2cb07d['model']],'as':_0x2cb07d['as'],'attributes':_0x2cb07d[_0xceec('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1eddcc){logger[_0xceec('0xb')](_0xceec('0x16'),_0xf3be05);logger[_0xceec('0xd')](_0xceec('0x16'),_0xf3be05,JSON[_0xceec('0xf')](_0x1eddcc));_0x4e1b81(_0x1eddcc);})[_0xceec('0x15')](function(_0x266828){logger[_0xceec('0x10')]('GetMemberReport',_0x266828[_0xceec('0x13')],_0xf3be05);_0x19696(_0x206458[_0xceec('0x10')](0x1f4,_0x266828[_0xceec('0x13')]));});});};exports[_0xceec('0x21')]=function(_0x94c94f){var _0x39cf05=this;return new Promise(function(_0x2d7c72,_0x17d711){return db['MemberReport'][_0xceec('0x22')](_0x94c94f[_0xceec('0x23')],{'raw':_0x94c94f[_0xceec('0x19')]?_0x94c94f['options']['raw']===undefined?!![]:![]:!![]})[_0xceec('0xa')](function(_0x48be7f){logger[_0xceec('0xb')]('CreateMemberReport',_0x94c94f);logger[_0xceec('0xd')](_0xceec('0x21'),_0x94c94f,JSON[_0xceec('0xf')](_0x48be7f));_0x2d7c72(_0x48be7f);})[_0xceec('0x15')](function(_0x5171ff){logger['error'](_0xceec('0x21'),_0x5171ff[_0xceec('0x13')],_0x94c94f);_0x17d711(_0x39cf05['error'](0x1f4,_0x5171ff['message']));});});};exports[_0xceec('0x24')]=function(_0x1a7045){var _0x586768=this;return new Promise(function(_0x5cb275,_0x2ece23){return db['MemberReport']['update'](_0x1a7045[_0xceec('0x23')],{'raw':_0x1a7045['options']?_0x1a7045[_0xceec('0x19')][_0xceec('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a7045['options']?_0x1a7045[_0xceec('0x19')]['where']||null:null,'attributes':_0x1a7045[_0xceec('0x19')]?_0x1a7045[_0xceec('0x19')]['attributes']||null:null,'limit':_0x1a7045['options']?_0x1a7045[_0xceec('0x19')][_0xceec('0x1d')]||null:null})[_0xceec('0xa')](function(_0x2897a9){logger['info'](_0xceec('0x24'),_0x1a7045);logger[_0xceec('0xd')](_0xceec('0x24'),_0x1a7045,JSON[_0xceec('0xf')](_0x2897a9));_0x5cb275(_0x2897a9);})[_0xceec('0x15')](function(_0xc19a21){logger[_0xceec('0x10')](_0xceec('0x24'),_0xc19a21['message'],_0x1a7045);_0x2ece23(_0x586768[_0xceec('0x10')](0x1f4,_0xc19a21['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 7c5975a..cff137b 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 _0xbd03=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','multer','util'];(function(_0xfd183f,_0x21bbde){var _0x40b42e=function(_0x5dfbf3){while(--_0x5dfbf3){_0xfd183f['push'](_0xfd183f['shift']());}};_0x40b42e(++_0x21bbde);}(_0xbd03,0xcf));var _0x3bd0=function(_0x126fb9,_0x122c59){_0x126fb9=_0x126fb9-0x0;var _0xc8a3b1=_0xbd03[_0x126fb9];return _0xc8a3b1;};'use strict';var multer=require(_0x3bd0('0x0'));var util=require(_0x3bd0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3bd0('0x2'));var router=express[_0x3bd0('0x3')]();var fs_extra=require(_0x3bd0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3bd0('0x5'));var config=require(_0x3bd0('0x6'));var controller=require(_0x3bd0('0x7'));router[_0x3bd0('0x8')]('/',controller[_0x3bd0('0x9')]);module[_0x3bd0('0xa')]=router; \ No newline at end of file +var _0x5594=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','path','connect-timeout','express'];(function(_0x544463,_0x214963){var _0x1add2a=function(_0x5e1006){while(--_0x5e1006){_0x544463['push'](_0x544463['shift']());}};_0x1add2a(++_0x214963);}(_0x5594,0x173));var _0x4559=function(_0x1b0cbd,_0x6c30de){_0x1b0cbd=_0x1b0cbd-0x0;var _0x5b3490=_0x5594[_0x1b0cbd];return _0x5b3490;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4559('0x0'));var timeout=require(_0x4559('0x1'));var express=require(_0x4559('0x2'));var router=express['Router']();var fs_extra=require(_0x4559('0x3'));var auth=require(_0x4559('0x4'));var interaction=require(_0x4559('0x5'));var config=require(_0x4559('0x6'));var controller=require(_0x4559('0x7'));router[_0x4559('0x8')]('/',controller[_0x4559('0x9')]);module[_0x4559('0xa')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 9abed9b..9547bd3 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 _0xb69a=['exports','STRING','version'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0xb69a,0x69));var _0xab69=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xb69a[_0x13d07a];return _0x5ee0ee;};'use strict';var Sequelize=require('sequelize');module[_0xab69('0x0')]={'version':{'type':Sequelize[_0xab69('0x1')],'unique':_0xab69('0x2')}}; \ No newline at end of file +var _0xed39=['exports','STRING','version'];(function(_0x1970cd,_0xbbfebc){var _0x257a8d=function(_0x29b9e9){while(--_0x29b9e9){_0x1970cd['push'](_0x1970cd['shift']());}};_0x257a8d(++_0xbbfebc);}(_0xed39,0x102));var _0x9ed3=function(_0x33e5b6,_0x4144b9){_0x33e5b6=_0x33e5b6-0x0;var _0x3a8738=_0xed39[_0x33e5b6];return _0x3a8738;};'use strict';var Sequelize=require('sequelize');module[_0x9ed3('0x0')]={'version':{'type':Sequelize[_0x9ed3('0x1')],'unique':_0x9ed3('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 00e9683..ade3b8f 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 _0x42ab=['type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','includeAll','include','Migration','findAll','rows','catch','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','count','offset','set','apply','save','update','then','error','stack','name','index','map','fieldName'];(function(_0x3ce6c1,_0x3ab7a7){var _0xecc97d=function(_0x4d06d7){while(--_0x4d06d7){_0x3ce6c1['push'](_0x3ce6c1['shift']());}};_0xecc97d(++_0x3ab7a7);}(_0x42ab,0x97));var _0xb42a=function(_0x5bb1e9,_0x15f025){_0x5bb1e9=_0x5bb1e9-0x0;var _0x262c24=_0x42ab[_0x5bb1e9];return _0x262c24;};'use strict';var emlformat=require(_0xb42a('0x0'));var rimraf=require(_0xb42a('0x1'));var zipdir=require(_0xb42a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb42a('0x3'));var moment=require('moment');var BPromise=require(_0xb42a('0x4'));var Mustache=require(_0xb42a('0x5'));var util=require(_0xb42a('0x6'));var path=require('path');var sox=require(_0xb42a('0x7'));var csv=require('to-csv');var ejs=require(_0xb42a('0x8'));var fs=require('fs');var fs_extra=require(_0xb42a('0x9'));var _=require(_0xb42a('0xa'));var squel=require(_0xb42a('0xb'));var crypto=require(_0xb42a('0xc'));var jsforce=require(_0xb42a('0xd'));var deskjs=require(_0xb42a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb42a('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb42a('0x10'));var qs=require(_0xb42a('0x11'));var as=require(_0xb42a('0x12'));var hardwareService=require(_0xb42a('0x13'));var logger=require('../../config/logger')(_0xb42a('0x14'));var utils=require('../../config/utils');var config=require(_0xb42a('0x15'));var licenseUtil=require(_0xb42a('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x57f0f9,_0x78b75d){_0x78b75d=_0x78b75d||0xcc;return function(_0x3f6333){if(_0x3f6333){return _0x57f0f9[_0xb42a('0x17')](_0x78b75d);}return _0x57f0f9[_0xb42a('0x18')](_0x78b75d)[_0xb42a('0x19')]();};}function respondWithResult(_0x19f4ee,_0x1a6603){_0x1a6603=_0x1a6603||0xc8;return function(_0x1fb61f){if(_0x1fb61f){return _0x19f4ee[_0xb42a('0x18')](_0x1a6603)[_0xb42a('0x1a')](_0x1fb61f);}};}function respondWithFilteredResult(_0x56f2b2,_0x109fd2){return function(_0x17aad5){if(_0x17aad5){var _0x12f326=typeof _0x109fd2['offset']==='undefined'&&typeof _0x109fd2[_0xb42a('0x1b')]==='undefined';var _0x11c13e=_0x17aad5[_0xb42a('0x1c')];var _0xacc707=_0x12f326?0x0:_0x109fd2['offset'];var _0x3d5981=_0x12f326?_0x17aad5[_0xb42a('0x1c')]:_0x109fd2[_0xb42a('0x1d')]+_0x109fd2[_0xb42a('0x1b')];var _0x5b626d;if(_0x3d5981>=_0x11c13e){_0x3d5981=_0x11c13e;_0x5b626d=0xc8;}else{_0x5b626d=0xce;}_0x56f2b2[_0xb42a('0x18')](_0x5b626d);return _0x56f2b2[_0xb42a('0x1e')]('Content-Range',_0xacc707+'-'+_0x3d5981+'/'+_0x11c13e)[_0xb42a('0x1a')](_0x17aad5);}return null;};}function patchUpdates(_0x3e8e1a){return function(_0x256d94){try{jsonpatch[_0xb42a('0x1f')](_0x256d94,_0x3e8e1a,!![]);}catch(_0x41e824){return BPromise['reject'](_0x41e824);}return _0x256d94[_0xb42a('0x20')]();};}function saveUpdates(_0x5818a2,_0x19c69b){return function(_0x366e8c){if(_0x366e8c){return _0x366e8c[_0xb42a('0x21')](_0x5818a2)[_0xb42a('0x22')](function(_0x294bd2){return _0x294bd2;});}return null;};}function removeEntity(_0x19a674,_0x2543d2){return function(_0x5cf0a3){if(_0x5cf0a3){return _0x5cf0a3['destroy']()[_0xb42a('0x22')](function(){_0x19a674['status'](0xcc)[_0xb42a('0x19')]();});}};}function handleEntityNotFound(_0x1a1748,_0x1b9905){return function(_0x58219a){if(!_0x58219a){_0x1a1748['sendStatus'](0x194);}return _0x58219a;};}function handleError(_0x1caa2c,_0x5462d5){_0x5462d5=_0x5462d5||0x1f4;return function(_0x4cddb0){logger[_0xb42a('0x23')](_0x4cddb0[_0xb42a('0x24')]);if(_0x4cddb0[_0xb42a('0x25')]){delete _0x4cddb0[_0xb42a('0x25')];}_0x1caa2c[_0xb42a('0x18')](_0x5462d5)['send'](_0x4cddb0);};}exports[_0xb42a('0x26')]=function(_0x3e5b48,_0x311030){var _0x2ade47={},_0x15082e={},_0xeff21a={'count':0x0,'rows':[]};var _0x13f777=_[_0xb42a('0x27')](db['Migration']['rawAttributes'],function(_0x40f440){return{'name':_0x40f440[_0xb42a('0x28')],'type':_0x40f440[_0xb42a('0x29')]['key']};});_0x15082e[_0xb42a('0x2a')]=_[_0xb42a('0x27')](_0x13f777,_0xb42a('0x25'));_0x15082e[_0xb42a('0x2b')]=_[_0xb42a('0x2c')](_0x3e5b48[_0xb42a('0x2b')]);_0x15082e[_0xb42a('0x2d')]=_[_0xb42a('0x2e')](_0x15082e[_0xb42a('0x2a')],_0x15082e['query']);_0x2ade47['attributes']=_['intersection'](_0x15082e[_0xb42a('0x2a')],qs['fields'](_0x3e5b48[_0xb42a('0x2b')][_0xb42a('0x2f')]));_0x2ade47[_0xb42a('0x30')]=_0x2ade47['attributes'][_0xb42a('0x31')]?_0x2ade47['attributes']:_0x15082e['model'];if(!_0x3e5b48[_0xb42a('0x2b')][_0xb42a('0x32')](_0xb42a('0x33'))){_0x2ade47[_0xb42a('0x1b')]=qs['limit'](_0x3e5b48[_0xb42a('0x2b')][_0xb42a('0x1b')]);_0x2ade47['offset']=qs[_0xb42a('0x1d')](_0x3e5b48[_0xb42a('0x2b')][_0xb42a('0x1d')]);}_0x2ade47[_0xb42a('0x34')]=qs[_0xb42a('0x35')](_0x3e5b48[_0xb42a('0x2b')][_0xb42a('0x35')]);_0x2ade47[_0xb42a('0x36')]=qs[_0xb42a('0x2d')](_['pick'](_0x3e5b48['query'],_0x15082e['filters']),_0x13f777);if(_0x3e5b48[_0xb42a('0x2b')][_0xb42a('0x37')]){_0x2ade47[_0xb42a('0x36')]=_['merge'](_0x2ade47[_0xb42a('0x36')],{'$or':_[_0xb42a('0x27')](_0x13f777,function(_0x10f597){if(_0x10f597['type']!==_0xb42a('0x38')){var _0x1099c2={};_0x1099c2[_0x10f597[_0xb42a('0x25')]]={'$like':'%'+_0x3e5b48['query'][_0xb42a('0x37')]+'%'};return _0x1099c2;}})});}_0x2ade47=_['merge']({},_0x2ade47,_0x3e5b48[_0xb42a('0x39')]);var _0x30d0a2={'where':_0x2ade47[_0xb42a('0x36')]};return db['Migration'][_0xb42a('0x1c')](_0x30d0a2)[_0xb42a('0x22')](function(_0x4649d8){_0xeff21a['count']=_0x4649d8;if(_0x3e5b48[_0xb42a('0x2b')][_0xb42a('0x3a')]){_0x2ade47[_0xb42a('0x3b')]=[{'all':!![]}];}return db[_0xb42a('0x3c')][_0xb42a('0x3d')](_0x2ade47);})[_0xb42a('0x22')](function(_0xaa39b1){_0xeff21a[_0xb42a('0x3e')]=_0xaa39b1;return _0xeff21a;})[_0xb42a('0x22')](respondWithFilteredResult(_0x311030,_0x2ade47))[_0xb42a('0x3f')](handleError(_0x311030,null));}; \ No newline at end of file +var _0x9cd1=['index','map','Migration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','apply','reject','save','then','destroy','error','name','send'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9cd1,0xdd));var _0x19cd=function(_0x4a43db,_0x75359){_0x4a43db=_0x4a43db-0x0;var _0x41d350=_0x9cd1[_0x4a43db];return _0x41d350;};'use strict';var emlformat=require(_0x19cd('0x0'));var rimraf=require(_0x19cd('0x1'));var zipdir=require(_0x19cd('0x2'));var jsonpatch=require(_0x19cd('0x3'));var rp=require(_0x19cd('0x4'));var moment=require('moment');var BPromise=require(_0x19cd('0x5'));var Mustache=require(_0x19cd('0x6'));var util=require(_0x19cd('0x7'));var path=require(_0x19cd('0x8'));var sox=require(_0x19cd('0x9'));var csv=require(_0x19cd('0xa'));var ejs=require(_0x19cd('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x19cd('0xc'));var crypto=require('crypto');var jsforce=require(_0x19cd('0xd'));var deskjs=require(_0x19cd('0xe'));var toCsv=require(_0x19cd('0xa'));var querystring=require(_0x19cd('0xf'));var Papa=require(_0x19cd('0x10'));var Redis=require(_0x19cd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x19cd('0x12'));var hardwareService=require(_0x19cd('0x13'));var logger=require(_0x19cd('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x19cd('0x15'));var licenseUtil=require(_0x19cd('0x16'));var db=require(_0x19cd('0x17'))['db'];function respondWithStatusCode(_0xd6e41,_0x3d1870){_0x3d1870=_0x3d1870||0xcc;return function(_0x330fca){if(_0x330fca){return _0xd6e41[_0x19cd('0x18')](_0x3d1870);}return _0xd6e41[_0x19cd('0x19')](_0x3d1870)[_0x19cd('0x1a')]();};}function respondWithResult(_0x2ce675,_0x567e20){_0x567e20=_0x567e20||0xc8;return function(_0x53bd83){if(_0x53bd83){return _0x2ce675[_0x19cd('0x19')](_0x567e20)[_0x19cd('0x1b')](_0x53bd83);}};}function respondWithFilteredResult(_0x24dd20,_0x959e98){return function(_0x2d6164){if(_0x2d6164){var _0x1b758b=typeof _0x959e98[_0x19cd('0x1c')]==='undefined'&&typeof _0x959e98[_0x19cd('0x1d')]==='undefined';var _0x2ee98d=_0x2d6164[_0x19cd('0x1e')];var _0x1bab00=_0x1b758b?0x0:_0x959e98[_0x19cd('0x1c')];var _0x57b724=_0x1b758b?_0x2d6164[_0x19cd('0x1e')]:_0x959e98[_0x19cd('0x1c')]+_0x959e98[_0x19cd('0x1d')];var _0x1714a1;if(_0x57b724>=_0x2ee98d){_0x57b724=_0x2ee98d;_0x1714a1=0xc8;}else{_0x1714a1=0xce;}_0x24dd20[_0x19cd('0x19')](_0x1714a1);return _0x24dd20['set']('Content-Range',_0x1bab00+'-'+_0x57b724+'/'+_0x2ee98d)[_0x19cd('0x1b')](_0x2d6164);}return null;};}function patchUpdates(_0x5e116c){return function(_0x336241){try{jsonpatch[_0x19cd('0x1f')](_0x336241,_0x5e116c,!![]);}catch(_0x2fd630){return BPromise[_0x19cd('0x20')](_0x2fd630);}return _0x336241[_0x19cd('0x21')]();};}function saveUpdates(_0x15d639,_0x1cfeba){return function(_0x4e3f23){if(_0x4e3f23){return _0x4e3f23['update'](_0x15d639)[_0x19cd('0x22')](function(_0x271cfe){return _0x271cfe;});}return null;};}function removeEntity(_0x2f5bf4,_0x583b2f){return function(_0x401d4b){if(_0x401d4b){return _0x401d4b[_0x19cd('0x23')]()[_0x19cd('0x22')](function(){_0x2f5bf4['status'](0xcc)[_0x19cd('0x1a')]();});}};}function handleEntityNotFound(_0xa9284f,_0x216387){return function(_0x1661df){if(!_0x1661df){_0xa9284f['sendStatus'](0x194);}return _0x1661df;};}function handleError(_0xa20b93,_0x4e46cc){_0x4e46cc=_0x4e46cc||0x1f4;return function(_0x2a6182){logger[_0x19cd('0x24')](_0x2a6182['stack']);if(_0x2a6182['name']){delete _0x2a6182[_0x19cd('0x25')];}_0xa20b93['status'](_0x4e46cc)[_0x19cd('0x26')](_0x2a6182);};}exports[_0x19cd('0x27')]=function(_0x31dc70,_0xf347b9){var _0x22805d={},_0x366cd8={},_0xaac1d8={'count':0x0,'rows':[]};var _0xfb0181=_[_0x19cd('0x28')](db[_0x19cd('0x29')][_0x19cd('0x2a')],function(_0x336fcb){return{'name':_0x336fcb[_0x19cd('0x2b')],'type':_0x336fcb[_0x19cd('0x2c')][_0x19cd('0x2d')]};});_0x366cd8['model']=_['map'](_0xfb0181,_0x19cd('0x25'));_0x366cd8[_0x19cd('0x2e')]=_[_0x19cd('0x2f')](_0x31dc70['query']);_0x366cd8[_0x19cd('0x30')]=_[_0x19cd('0x31')](_0x366cd8[_0x19cd('0x32')],_0x366cd8[_0x19cd('0x2e')]);_0x22805d[_0x19cd('0x33')]=_['intersection'](_0x366cd8[_0x19cd('0x32')],qs[_0x19cd('0x34')](_0x31dc70[_0x19cd('0x2e')][_0x19cd('0x34')]));_0x22805d[_0x19cd('0x33')]=_0x22805d[_0x19cd('0x33')]['length']?_0x22805d[_0x19cd('0x33')]:_0x366cd8[_0x19cd('0x32')];if(!_0x31dc70[_0x19cd('0x2e')][_0x19cd('0x35')](_0x19cd('0x36'))){_0x22805d[_0x19cd('0x1d')]=qs['limit'](_0x31dc70[_0x19cd('0x2e')][_0x19cd('0x1d')]);_0x22805d['offset']=qs[_0x19cd('0x1c')](_0x31dc70[_0x19cd('0x2e')]['offset']);}_0x22805d['order']=qs[_0x19cd('0x37')](_0x31dc70[_0x19cd('0x2e')][_0x19cd('0x37')]);_0x22805d[_0x19cd('0x38')]=qs[_0x19cd('0x30')](_[_0x19cd('0x39')](_0x31dc70['query'],_0x366cd8[_0x19cd('0x30')]),_0xfb0181);if(_0x31dc70['query'][_0x19cd('0x3a')]){_0x22805d['where']=_[_0x19cd('0x3b')](_0x22805d['where'],{'$or':_[_0x19cd('0x28')](_0xfb0181,function(_0x4caf8e){if(_0x4caf8e[_0x19cd('0x2c')]!==_0x19cd('0x3c')){var _0x373e55={};_0x373e55[_0x4caf8e['name']]={'$like':'%'+_0x31dc70[_0x19cd('0x2e')][_0x19cd('0x3a')]+'%'};return _0x373e55;}})});}_0x22805d=_[_0x19cd('0x3b')]({},_0x22805d,_0x31dc70[_0x19cd('0x3d')]);var _0x450fb9={'where':_0x22805d[_0x19cd('0x38')]};return db[_0x19cd('0x29')][_0x19cd('0x1e')](_0x450fb9)[_0x19cd('0x22')](function(_0x170b99){_0xaac1d8[_0x19cd('0x1e')]=_0x170b99;if(_0x31dc70[_0x19cd('0x2e')]['includeAll']){_0x22805d[_0x19cd('0x3e')]=[{'all':!![]}];}return db[_0x19cd('0x29')][_0x19cd('0x3f')](_0x22805d);})[_0x19cd('0x22')](function(_0x436c9a){_0xaac1d8['rows']=_0x436c9a;return _0xaac1d8;})[_0x19cd('0x22')](respondWithFilteredResult(_0xf347b9,_0x22805d))[_0x19cd('0x40')](handleError(_0xf347b9,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 2211273..4f3ce19 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 _0xa506=['rimraf','../../config/environment','./migration.attributes','exports','define','Migration','migrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1390d5,_0x237f99){var _0x4d87da=function(_0x1cb6ef){while(--_0x1cb6ef){_0x1390d5['push'](_0x1390d5['shift']());}};_0x4d87da(++_0x237f99);}(_0xa506,0xca));var _0x6a50=function(_0x40c6c1,_0x2579c0){_0x40c6c1=_0x40c6c1-0x0;var _0x158988=_0xa506[_0x40c6c1];return _0x158988;};'use strict';var _=require(_0x6a50('0x0'));var util=require(_0x6a50('0x1'));var logger=require(_0x6a50('0x2'))(_0x6a50('0x3'));var moment=require(_0x6a50('0x4'));var BPromise=require(_0x6a50('0x5'));var rp=require(_0x6a50('0x6'));var fs=require('fs');var path=require(_0x6a50('0x7'));var rimraf=require(_0x6a50('0x8'));var config=require(_0x6a50('0x9'));var attributes=require(_0x6a50('0xa'));module[_0x6a50('0xb')]=function(_0x179ef1,_0x265bc3){return _0x179ef1[_0x6a50('0xc')](_0x6a50('0xd'),attributes,{'tableName':_0x6a50('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9016=['./migration.attributes','exports','Migration','migrations','lodash','../../config/logger','moment','bluebird','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9016,0xee));var _0x6901=function(_0x52c853,_0x43e1f9){_0x52c853=_0x52c853-0x0;var _0x1bf035=_0x9016[_0x52c853];return _0x1bf035;};'use strict';var _=require(_0x6901('0x0'));var util=require('util');var logger=require(_0x6901('0x1'))('api');var moment=require(_0x6901('0x2'));var BPromise=require(_0x6901('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6901('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6901('0x5'));module[_0x6901('0x6')]=function(_0x5ef8cc,_0x54be71){return _0x5ef8cc['define'](_0x6901('0x7'),attributes,{'tableName':_0x6901('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 8793c8e..551afba 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 _0x453b=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xd86c1f,_0x155733){var _0x2ec664=function(_0x36b76e){while(--_0x36b76e){_0xd86c1f['push'](_0xd86c1f['shift']());}};_0x2ec664(++_0x155733);}(_0x453b,0x164));var _0xb453=function(_0x5a488c,_0x4cc470){_0x5a488c=_0x5a488c-0x0;var _0x53a7d6=_0x453b[_0x5a488c];return _0x53a7d6;};'use strict';var _=require(_0xb453('0x0'));var util=require(_0xb453('0x1'));var moment=require(_0xb453('0x2'));var BPromise=require(_0xb453('0x3'));var rs=require(_0xb453('0x4'));var fs=require('fs');var Redis=require(_0xb453('0x5'));var db=require(_0xb453('0x6'))['db'];var utils=require(_0xb453('0x7'));var logger=require(_0xb453('0x8'))(_0xb453('0x9'));var config=require(_0xb453('0xa'));var jayson=require(_0xb453('0xb'));var client=jayson[_0xb453('0xc')][_0xb453('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1ab841,_0x2436a7,_0x4fdd93){return new BPromise(function(_0x12c490,_0x3486a8){return client['request'](_0x1ab841,_0x4fdd93)[_0xb453('0xe')](function(_0x51337f){logger[_0xb453('0xf')](_0xb453('0x10'),_0x2436a7,_0xb453('0x11'));logger[_0xb453('0x12')]('Migration,\x20%s,\x20%s,\x20%s',_0x2436a7,_0xb453('0x11'),JSON[_0xb453('0x13')](_0x51337f));if(_0x51337f[_0xb453('0x14')]){if(_0x51337f[_0xb453('0x14')][_0xb453('0x15')]===0x1f4){logger[_0xb453('0x14')](_0xb453('0x10'),_0x2436a7,_0x51337f[_0xb453('0x14')][_0xb453('0x16')]);return _0x3486a8(_0x51337f['error']['message']);}logger['error'](_0xb453('0x10'),_0x2436a7,_0x51337f['error'][_0xb453('0x16')]);return _0x12c490(_0x51337f[_0xb453('0x14')][_0xb453('0x16')]);}else{logger['info']('Migration,\x20%s,\x20%s',_0x2436a7,_0xb453('0x11'));_0x12c490(_0x51337f[_0xb453('0x17')][_0xb453('0x16')]);}})[_0xb453('0x18')](function(_0x139ed2){logger[_0xb453('0x14')](_0xb453('0x10'),_0x2436a7,_0x139ed2);_0x3486a8(_0x139ed2);});});} \ No newline at end of file +var _0x37b4=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','info','request\x20sent','stringify','error','Migration,\x20%s,\x20%s','message','result'];(function(_0x3ac978,_0x243809){var _0xf74677=function(_0x2f7861){while(--_0x2f7861){_0x3ac978['push'](_0x3ac978['shift']());}};_0xf74677(++_0x243809);}(_0x37b4,0xef));var _0x437b=function(_0x41ecfc,_0x54f670){_0x41ecfc=_0x41ecfc-0x0;var _0x4cdc47=_0x37b4[_0x41ecfc];return _0x4cdc47;};'use strict';var _=require(_0x437b('0x0'));var util=require('util');var moment=require(_0x437b('0x1'));var BPromise=require(_0x437b('0x2'));var rs=require(_0x437b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x437b('0x4'))['db'];var utils=require(_0x437b('0x5'));var logger=require(_0x437b('0x6'))(_0x437b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x437b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c7dea,_0x4aada7,_0x226e3c){return new BPromise(function(_0x5df980,_0x432b63){return client['request'](_0x3c7dea,_0x226e3c)['then'](function(_0x44bf1d){logger[_0x437b('0x9')]('Migration,\x20%s,\x20%s',_0x4aada7,_0x437b('0xa'));logger['debug']('Migration,\x20%s,\x20%s,\x20%s',_0x4aada7,_0x437b('0xa'),JSON[_0x437b('0xb')](_0x44bf1d));if(_0x44bf1d[_0x437b('0xc')]){if(_0x44bf1d[_0x437b('0xc')]['code']===0x1f4){logger[_0x437b('0xc')](_0x437b('0xd'),_0x4aada7,_0x44bf1d[_0x437b('0xc')]['message']);return _0x432b63(_0x44bf1d[_0x437b('0xc')][_0x437b('0xe')]);}logger[_0x437b('0xc')]('Migration,\x20%s,\x20%s',_0x4aada7,_0x44bf1d[_0x437b('0xc')]['message']);return _0x5df980(_0x44bf1d[_0x437b('0xc')][_0x437b('0xe')]);}else{logger[_0x437b('0x9')]('Migration,\x20%s,\x20%s',_0x4aada7,_0x437b('0xa'));_0x5df980(_0x44bf1d[_0x437b('0xf')][_0x437b('0xe')]);}})[_0x437b('0x10')](function(_0x1d31af){logger[_0x437b('0xc')]('Migration,\x20%s,\x20%s',_0x4aada7,_0x1d31af);_0x432b63(_0x1d31af);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index ac1e5df..47ba58d 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 _0x5388=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','/:id','post','put','update','delete','destroy','exports'];(function(_0x5084a5,_0x431fa2){var _0x16f480=function(_0x287bc3){while(--_0x287bc3){_0x5084a5['push'](_0x5084a5['shift']());}};_0x16f480(++_0x431fa2);}(_0x5388,0xee));var _0x8538=function(_0x13357f,_0x210dc8){_0x13357f=_0x13357f-0x0;var _0x1fbbf1=_0x5388[_0x13357f];return _0x1fbbf1;};'use strict';var multer=require(_0x8538('0x0'));var util=require(_0x8538('0x1'));var path=require(_0x8538('0x2'));var timeout=require(_0x8538('0x3'));var express=require(_0x8538('0x4'));var router=express[_0x8538('0x5')]();var fs_extra=require(_0x8538('0x6'));var auth=require(_0x8538('0x7'));var interaction=require(_0x8538('0x8'));var config=require('../../config/environment');var controller=require('./network.controller');router['get']('/',auth[_0x8538('0x9')](),controller['index']);router['get'](_0x8538('0xa'),auth[_0x8538('0x9')](),controller['show']);router[_0x8538('0xb')]('/',auth[_0x8538('0x9')](),controller['create']);router[_0x8538('0xc')](_0x8538('0xa'),auth[_0x8538('0x9')](),controller[_0x8538('0xd')]);router[_0x8538('0xe')](_0x8538('0xa'),auth[_0x8538('0x9')](),controller[_0x8538('0xf')]);module[_0x8538('0x10')]=router; \ No newline at end of file +var _0xb58d=['create','/:id','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./network.controller','get','isAuthenticated'];(function(_0x788c48,_0x5c0e5e){var _0x299c14=function(_0x6be4c){while(--_0x6be4c){_0x788c48['push'](_0x788c48['shift']());}};_0x299c14(++_0x5c0e5e);}(_0xb58d,0x141));var _0xdb58=function(_0x184c4f,_0x3372ca){_0x184c4f=_0x184c4f-0x0;var _0x41a519=_0xb58d[_0x184c4f];return _0x41a519;};'use strict';var multer=require(_0xdb58('0x0'));var util=require(_0xdb58('0x1'));var path=require(_0xdb58('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdb58('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xdb58('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xdb58('0x5'));var controller=require(_0xdb58('0x6'));router[_0xdb58('0x7')]('/',auth[_0xdb58('0x8')](),controller['index']);router[_0xdb58('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xdb58('0x8')](),controller[_0xdb58('0x9')]);router['put'](_0xdb58('0xa'),auth[_0xdb58('0x8')](),controller[_0xdb58('0xb')]);router[_0xdb58('0xc')](_0xdb58('0xa'),auth[_0xdb58('0x8')](),controller[_0xdb58('0xd')]);module[_0xdb58('0xe')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index d000e4f..de8608e 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 _0x792e=['ENUM','externip','stun','turn','STRING','sequelize','exports'];(function(_0x499b6f,_0x1f1a6d){var _0x5b3b0a=function(_0xf51b1){while(--_0xf51b1){_0x499b6f['push'](_0x499b6f['shift']());}};_0x5b3b0a(++_0x1f1a6d);}(_0x792e,0x139));var _0xe792=function(_0x3c7999,_0x36868d){_0x3c7999=_0x3c7999-0x0;var _0x4723b4=_0x792e[_0x3c7999];return _0x4723b4;};'use strict';var Sequelize=require(_0xe792('0x0'));module[_0xe792('0x1')]={'type':{'type':Sequelize[_0xe792('0x2')]('localnet',_0xe792('0x3'),_0xe792('0x4'),_0xe792('0x5'))},'value':{'type':Sequelize[_0xe792('0x6')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xe792('0x6')]}}; \ No newline at end of file +var _0x8283=['sequelize','exports','ENUM','localnet','stun','turn','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8283,0x1d5));var _0x3828=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8283[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3828('0x0'));module[_0x3828('0x1')]={'type':{'type':Sequelize[_0x3828('0x2')](_0x3828('0x3'),'externip',_0x3828('0x4'),_0x3828('0x5'))},'value':{'type':Sequelize[_0x3828('0x6')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x3828('0x6')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 6ea748d..c29d2b5 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 _0x5885=['catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','Network','includeAll','include','findAll','show','params','length','find','transaction','create','body','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','toUpperCase','TURN','readFileSync','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','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','api','../../config/environment','../../mysqldb','jayson/promise','http','request','then','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result'];(function(_0x1c1b99,_0x2fa392){var _0x2a06b3=function(_0x1c20ad){while(--_0x1c20ad){_0x1c1b99['push'](_0x1c1b99['shift']());}};_0x2a06b3(++_0x2fa392);}(_0x5885,0x1f1));var _0x5588=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5885[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x5588('0x0'));var rimraf=require(_0x5588('0x1'));var zipdir=require(_0x5588('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5588('0x3'));var moment=require(_0x5588('0x4'));var BPromise=require(_0x5588('0x5'));var Mustache=require(_0x5588('0x6'));var util=require(_0x5588('0x7'));var path=require('path');var sox=require(_0x5588('0x8'));var csv=require(_0x5588('0x9'));var ejs=require(_0x5588('0xa'));var fs=require('fs');var fs_extra=require(_0x5588('0xb'));var _=require('lodash');var squel=require(_0x5588('0xc'));var crypto=require(_0x5588('0xd'));var jsforce=require(_0x5588('0xe'));var deskjs=require(_0x5588('0xf'));var toCsv=require(_0x5588('0x9'));var querystring=require(_0x5588('0x10'));var Papa=require('papaparse');var Redis=require(_0x5588('0x11'));var authService=require(_0x5588('0x12'));var qs=require(_0x5588('0x13'));var as=require(_0x5588('0x14'));var hardwareService=require(_0x5588('0x15'));var logger=require('../../config/logger')(_0x5588('0x16'));var utils=require('../../config/utils');var config=require(_0x5588('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5588('0x18'))['db'];var jayson=require(_0x5588('0x19'));var client=jayson['client'][_0x5588('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x2d1c3a,_0x27502a,_0x2b852a,_0x5a87f0){return new BPromise(function(_0x579845,_0x2ced27){var _0x1ce62d=_0x5a87f0||client;return _0x1ce62d[_0x5588('0x1b')](_0x2d1c3a,_0x2b852a)[_0x5588('0x1c')](function(_0x1e85a6){logger['info'](_0x5588('0x1d'),_0x27502a,_0x5588('0x1e'));logger[_0x5588('0x1f')](_0x5588('0x20'),_0x27502a,_0x5588('0x1e'),JSON[_0x5588('0x21')](_0x1e85a6));if(_0x1e85a6[_0x5588('0x22')]){if(_0x1e85a6[_0x5588('0x22')]['code']===0x1f4){logger[_0x5588('0x22')]('Network,\x20%s,\x20%s',_0x27502a,_0x1e85a6[_0x5588('0x22')][_0x5588('0x23')]);return _0x2ced27(_0x1e85a6[_0x5588('0x22')]['message']);}logger[_0x5588('0x22')]('Network,\x20%s,\x20%s',_0x27502a,_0x1e85a6['error']['message']);return _0x579845(_0x1e85a6[_0x5588('0x22')][_0x5588('0x23')]);}else{logger[_0x5588('0x24')](_0x5588('0x1d'),_0x27502a,_0x5588('0x1e'));_0x579845(_0x1e85a6[_0x5588('0x25')][_0x5588('0x23')]);}})[_0x5588('0x26')](function(_0x25f960){logger['error'](_0x5588('0x1d'),_0x27502a,_0x25f960);_0x2ced27(_0x25f960);});});}function respondWithStatusCode(_0x4c765d,_0x1fa110){_0x1fa110=_0x1fa110||0xcc;return function(_0x9bc391){if(_0x9bc391){return _0x4c765d[_0x5588('0x27')](_0x1fa110);}return _0x4c765d['status'](_0x1fa110)[_0x5588('0x28')]();};}function respondWithResult(_0x5af3ac,_0x519b05){_0x519b05=_0x519b05||0xc8;return function(_0x4ed417){if(_0x4ed417){return _0x5af3ac[_0x5588('0x29')](_0x519b05)[_0x5588('0x2a')](_0x4ed417);}};}function respondWithFilteredResult(_0x298399,_0x11c2ce){return function(_0xbd0c8f){if(_0xbd0c8f){var _0x4021c8=typeof _0x11c2ce[_0x5588('0x2b')]===_0x5588('0x2c')&&typeof _0x11c2ce[_0x5588('0x2d')]===_0x5588('0x2c');var _0x76ca66=_0xbd0c8f[_0x5588('0x2e')];var _0x379ae8=_0x4021c8?0x0:_0x11c2ce[_0x5588('0x2b')];var _0x22b011=_0x4021c8?_0xbd0c8f['count']:_0x11c2ce[_0x5588('0x2b')]+_0x11c2ce['limit'];var _0x34fd0d;if(_0x22b011>=_0x76ca66){_0x22b011=_0x76ca66;_0x34fd0d=0xc8;}else{_0x34fd0d=0xce;}_0x298399[_0x5588('0x29')](_0x34fd0d);return _0x298399[_0x5588('0x2f')](_0x5588('0x30'),_0x379ae8+'-'+_0x22b011+'/'+_0x76ca66)[_0x5588('0x2a')](_0xbd0c8f);}return null;};}function patchUpdates(_0x3a4bac){return function(_0x43add5){try{jsonpatch[_0x5588('0x31')](_0x43add5,_0x3a4bac,!![]);}catch(_0x263a81){return BPromise[_0x5588('0x32')](_0x263a81);}return _0x43add5[_0x5588('0x33')]();};}function saveUpdates(_0x5ca9d2,_0x1617a2){return function(_0xb6a6a){if(_0xb6a6a){return _0xb6a6a['update'](_0x5ca9d2)[_0x5588('0x1c')](function(_0x3dbe0c){return _0x3dbe0c;});}return null;};}function removeEntity(_0x387762,_0x1440c1){return function(_0x36c4d1){if(_0x36c4d1){return _0x36c4d1[_0x5588('0x34')]()[_0x5588('0x1c')](function(){_0x387762[_0x5588('0x29')](0xcc)[_0x5588('0x28')]();});}};}function handleEntityNotFound(_0x3303ba,_0xaa575d){return function(_0xc001c6){if(!_0xc001c6){_0x3303ba['sendStatus'](0x194);}return _0xc001c6;};}function handleError(_0x5daf69,_0x11a7de){_0x11a7de=_0x11a7de||0x1f4;return function(_0x1053a2){logger[_0x5588('0x22')](_0x1053a2[_0x5588('0x35')]);if(_0x1053a2[_0x5588('0x36')]){delete _0x1053a2[_0x5588('0x36')];}_0x5daf69['status'](_0x11a7de)[_0x5588('0x37')](_0x1053a2);};}exports[_0x5588('0x38')]=function(_0x524eac,_0xdafdac){var _0x438d45={},_0x1fd2f8={},_0x5a9782={'count':0x0,'rows':[]};var _0x1cc3c3=_[_0x5588('0x39')](db['Network'][_0x5588('0x3a')],function(_0x5bdb77){return{'name':_0x5bdb77[_0x5588('0x3b')],'type':_0x5bdb77[_0x5588('0x3c')][_0x5588('0x3d')]};});_0x1fd2f8[_0x5588('0x3e')]=_[_0x5588('0x39')](_0x1cc3c3,'name');_0x1fd2f8[_0x5588('0x3f')]=_[_0x5588('0x40')](_0x524eac[_0x5588('0x3f')]);_0x1fd2f8['filters']=_['intersection'](_0x1fd2f8[_0x5588('0x3e')],_0x1fd2f8[_0x5588('0x3f')]);_0x438d45[_0x5588('0x41')]=_[_0x5588('0x42')](_0x1fd2f8['model'],qs[_0x5588('0x43')](_0x524eac['query']['fields']));_0x438d45[_0x5588('0x41')]=_0x438d45[_0x5588('0x41')]['length']?_0x438d45[_0x5588('0x41')]:_0x1fd2f8[_0x5588('0x3e')];if(!_0x524eac[_0x5588('0x3f')]['hasOwnProperty'](_0x5588('0x44'))){_0x438d45['limit']=qs['limit'](_0x524eac[_0x5588('0x3f')][_0x5588('0x2d')]);_0x438d45[_0x5588('0x2b')]=qs[_0x5588('0x2b')](_0x524eac['query'][_0x5588('0x2b')]);}_0x438d45['order']=qs[_0x5588('0x45')](_0x524eac['query'][_0x5588('0x45')]);_0x438d45[_0x5588('0x46')]=qs[_0x5588('0x47')](_['pick'](_0x524eac[_0x5588('0x3f')],_0x1fd2f8[_0x5588('0x47')]),_0x1cc3c3);if(_0x524eac['query'][_0x5588('0x48')]){_0x438d45[_0x5588('0x46')]=_[_0x5588('0x49')](_0x438d45[_0x5588('0x46')],{'$or':_[_0x5588('0x39')](_0x1cc3c3,function(_0x1ef0ea){if(_0x1ef0ea[_0x5588('0x3c')]!==_0x5588('0x4a')){var _0x481751={};_0x481751[_0x1ef0ea[_0x5588('0x36')]]={'$like':'%'+_0x524eac[_0x5588('0x3f')][_0x5588('0x48')]+'%'};return _0x481751;}})});}_0x438d45=_['merge']({},_0x438d45,_0x524eac[_0x5588('0x4b')]);var _0x623534={'where':_0x438d45[_0x5588('0x46')]};return db[_0x5588('0x4c')][_0x5588('0x2e')](_0x623534)[_0x5588('0x1c')](function(_0x2082d0){_0x5a9782['count']=_0x2082d0;if(_0x524eac[_0x5588('0x3f')][_0x5588('0x4d')]){_0x438d45[_0x5588('0x4e')]=[{'all':!![]}];}return db[_0x5588('0x4c')][_0x5588('0x4f')](_0x438d45);})[_0x5588('0x1c')](function(_0x1abfac){_0x5a9782['rows']=_0x1abfac;return _0x5a9782;})[_0x5588('0x1c')](respondWithFilteredResult(_0xdafdac,_0x438d45))['catch'](handleError(_0xdafdac,null));};exports[_0x5588('0x50')]=function(_0x154138,_0x1cd1df){var _0x546043={'raw':!![],'where':{'id':_0x154138[_0x5588('0x51')]['id']}},_0x3927bb={};_0x3927bb['model']=_[_0x5588('0x40')](db[_0x5588('0x4c')][_0x5588('0x3a')]);_0x3927bb[_0x5588('0x3f')]=_[_0x5588('0x40')](_0x154138[_0x5588('0x3f')]);_0x3927bb[_0x5588('0x47')]=_[_0x5588('0x42')](_0x3927bb['model'],_0x3927bb[_0x5588('0x3f')]);_0x546043[_0x5588('0x41')]=_[_0x5588('0x42')](_0x3927bb[_0x5588('0x3e')],qs['fields'](_0x154138[_0x5588('0x3f')]['fields']));_0x546043['attributes']=_0x546043['attributes'][_0x5588('0x52')]?_0x546043[_0x5588('0x41')]:_0x3927bb[_0x5588('0x3e')];if(_0x154138[_0x5588('0x3f')][_0x5588('0x4d')]){_0x546043[_0x5588('0x4e')]=[{'all':!![]}];}_0x546043=_[_0x5588('0x49')]({},_0x546043,_0x154138[_0x5588('0x4b')]);return db[_0x5588('0x4c')][_0x5588('0x53')](_0x546043)[_0x5588('0x1c')](handleEntityNotFound(_0x1cd1df,null))[_0x5588('0x1c')](respondWithResult(_0x1cd1df,null))['catch'](handleError(_0x1cd1df,null));};exports['create']=function(_0x1d4683,_0x2d187c,_0x29f8ce){var _0x5cf4a6;return db['sequelize'][_0x5588('0x54')](function(_0x5243a8){return db[_0x5588('0x4c')][_0x5588('0x55')](_0x1d4683[_0x5588('0x56')],{'raw':!![]})['then'](function(_0x20b92b){_0x5cf4a6=_0x20b92b;return db[_0x5588('0x4c')][_0x5588('0x4f')]({'where':{'type':_0x1d4683[_0x5588('0x56')][_0x5588('0x3c')]},'raw':!![]});})['then'](function(_0x3600a9){if(_0x5cf4a6[_0x5588('0x3c')]['toUpperCase']()=='STUN'){var _0x383a21=fs['readFileSync'](path[_0x5588('0x57')](config[_0x5588('0x58')],_0x5588('0x59')),_0x5588('0x5a'));var _0x3237d1=ejs[_0x5588('0x5b')](_0x383a21,{'networks':_0x3600a9||[]});fs[_0x5588('0x5c')](_0x5588('0x5d'),_0x3237d1);return respondWithRpcPromise(_0x5588('0x5e'),_0x5588('0x55'),{'module':_0x5588('0x5f')});}else if(_0x5cf4a6['type'][_0x5588('0x60')]()==_0x5588('0x61')){var _0x1afbaa=fs[_0x5588('0x62')](path[_0x5588('0x57')](config[_0x5588('0x58')],_0x5588('0x63')),_0x5588('0x5a'));var _0x1d2cfb=ejs[_0x5588('0x5b')](_0x1afbaa,{'networks':_0x3600a9||[]});fs['writeFileSync'](_0x5588('0x64'),_0x1d2cfb);return respondWithRpcPromise('Reload',_0x5588('0x55'),{'module':_0x5588('0x5f')});}else{var _0x905c0a=fs[_0x5588('0x62')](path[_0x5588('0x57')](config[_0x5588('0x58')],_0x5588('0x65')),'utf8');var _0x56d9c0=ejs[_0x5588('0x5b')](_0x905c0a,{'networks':_0x3600a9||[]});fs[_0x5588('0x5c')](util[_0x5588('0x66')](_0x5588('0x67'),_0x1d4683['body'][_0x5588('0x3c')][_0x5588('0x68')]()),_0x56d9c0);return respondWithRpcPromise(_0x5588('0x5e'),'create',{'module':_0x5588('0x69')});}return null;})['then'](function(){return _0x5cf4a6;});})[_0x5588('0x1c')](respondWithResult(_0x2d187c,0xc9))[_0x5588('0x26')](handleError(_0x2d187c,null));};exports[_0x5588('0x6a')]=function(_0x758909,_0x31ac5b,_0x43e073){var _0x55c4f0;return db['sequelize'][_0x5588('0x54')](function(_0x42691e){return db[_0x5588('0x4c')][_0x5588('0x53')]({'where':{'id':_0x758909[_0x5588('0x51')]['id']}})['then'](handleEntityNotFound(_0x31ac5b,null))['then'](saveUpdates(_0x758909[_0x5588('0x56')],null))['then'](function(_0x4bef84){if(_0x4bef84){_0x55c4f0=_0x4bef84;return db['Network'][_0x5588('0x4f')]({'where':{'type':_0x55c4f0['type']},'raw':!![]});}return null;})[_0x5588('0x1c')](function(_0x429f16){if(_0x55c4f0[_0x5588('0x3c')]['toUpperCase']()=='STUN'){var _0x522888=fs[_0x5588('0x62')](path[_0x5588('0x57')](config[_0x5588('0x58')],_0x5588('0x59')),_0x5588('0x5a'));var _0x11de63=ejs[_0x5588('0x5b')](_0x522888,{'networks':_0x429f16||[]});fs[_0x5588('0x5c')]('/etc/asterisk/stun_xcally.conf',_0x11de63);return respondWithRpcPromise(_0x5588('0x5e'),_0x5588('0x6a'),{'module':_0x5588('0x5f')});}else if(_0x55c4f0[_0x5588('0x3c')][_0x5588('0x60')]()==_0x5588('0x61')){var _0x4f5884=fs[_0x5588('0x62')](path['join'](config['root'],_0x5588('0x63')),_0x5588('0x5a'));var _0x3ffe77=ejs[_0x5588('0x5b')](_0x4f5884,{'networks':_0x429f16||[]});fs[_0x5588('0x5c')](_0x5588('0x64'),_0x3ffe77);return respondWithRpcPromise(_0x5588('0x5e'),_0x5588('0x6a'),{'module':_0x5588('0x5f')});}else{var _0x2b9ddc=fs['readFileSync'](path[_0x5588('0x57')](config[_0x5588('0x58')],_0x5588('0x65')),'utf8');var _0x7e551f=ejs[_0x5588('0x5b')](_0x2b9ddc,{'networks':_0x429f16||[]});fs[_0x5588('0x5c')](util[_0x5588('0x66')]('/etc/asterisk/sip_xcally_%s.conf',_0x758909[_0x5588('0x56')][_0x5588('0x3c')][_0x5588('0x68')]()),_0x7e551f);return respondWithRpcPromise(_0x5588('0x5e'),_0x5588('0x6a'),{'module':_0x5588('0x69')});}return null;})[_0x5588('0x1c')](function(_0x415477){if(_0x415477){return _0x55c4f0;}return null;});})['then'](respondWithResult(_0x31ac5b,null))[_0x5588('0x26')](handleError(_0x31ac5b,null));};exports[_0x5588('0x34')]=function(_0x53ca78,_0x44149c,_0x47586a){var _0x228670;return db['Network'][_0x5588('0x53')]({'where':{'id':_0x53ca78['params']['id']}})[_0x5588('0x1c')](function(_0x52dda3){_0x228670=_0x52dda3;return _0x52dda3;})[_0x5588('0x1c')](handleEntityNotFound(_0x44149c,null))[_0x5588('0x1c')](removeEntity(_0x44149c,null))[_0x5588('0x1c')](function(){if(_0x228670){return db[_0x5588('0x4c')][_0x5588('0x4f')]({'where':{'type':_0x228670['type']},'raw':!![]});}})[_0x5588('0x1c')](function(_0xdca32e){if(_0x228670[_0x5588('0x3c')][_0x5588('0x60')]()=='STUN'){var _0x43ed56=fs[_0x5588('0x62')](path[_0x5588('0x57')](config[_0x5588('0x58')],'server/files/templates/stun_multiple.ejs'),_0x5588('0x5a'));var _0x515627=ejs[_0x5588('0x5b')](_0x43ed56,{'networks':_0xdca32e||[]});fs[_0x5588('0x5c')](_0x5588('0x5d'),_0x515627);return respondWithRpcPromise('Reload','destroy',{'module':_0x5588('0x5f')});}else if(_0x228670[_0x5588('0x3c')][_0x5588('0x60')]()==_0x5588('0x61')){var _0x48da8b=fs[_0x5588('0x62')](path['join'](config[_0x5588('0x58')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x2da7f1=ejs[_0x5588('0x5b')](_0x48da8b,{'networks':_0xdca32e||[]});fs[_0x5588('0x5c')](_0x5588('0x64'),_0x2da7f1);return respondWithRpcPromise('Reload',_0x5588('0x34'),{'module':'res_stun_monitor.so'});}else{var _0x34d823=fs[_0x5588('0x62')](path[_0x5588('0x57')](config[_0x5588('0x58')],_0x5588('0x65')),_0x5588('0x5a'));var _0x1c147a=ejs[_0x5588('0x5b')](_0x34d823,{'networks':_0xdca32e||[]});fs[_0x5588('0x5c')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x53ca78[_0x5588('0x56')]['type'][_0x5588('0x68')]()),_0x1c147a);return respondWithRpcPromise(_0x5588('0x5e'),'destroy',{'module':'chan_sip.so'});}return null;})[_0x5588('0x26')](handleError(_0x44149c,null));}; \ No newline at end of file +var _0xec68=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','jayson/promise','client','request','request\x20sent','Network,\x20%s,\x20%s,\x20%s','error','Network,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','update','then','stack','name','index','Network','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','params','rawAttributes','find','sequelize','transaction','create','body','findAll','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','render','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','/etc/asterisk/turn_xcally.conf','toLowerCase','destroy','eml-format','zip-dir','fast-json-patch','bluebird','mustache','path','sox','ejs','fs-extra','squel','papaparse','ioredis'];(function(_0x2e9b61,_0x2120cf){var _0x597ccd=function(_0x161d79){while(--_0x161d79){_0x2e9b61['push'](_0x2e9b61['shift']());}};_0x597ccd(++_0x2120cf);}(_0xec68,0x174));var _0x8ec6=function(_0x52d068,_0x148a9a){_0x52d068=_0x52d068-0x0;var _0x512566=_0xec68[_0x52d068];return _0x512566;};'use strict';var emlformat=require(_0x8ec6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8ec6('0x1'));var jsonpatch=require(_0x8ec6('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8ec6('0x3'));var Mustache=require(_0x8ec6('0x4'));var util=require('util');var path=require(_0x8ec6('0x5'));var sox=require(_0x8ec6('0x6'));var csv=require('to-csv');var ejs=require(_0x8ec6('0x7'));var fs=require('fs');var fs_extra=require(_0x8ec6('0x8'));var _=require('lodash');var squel=require(_0x8ec6('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8ec6('0xa'));var Redis=require(_0x8ec6('0xb'));var authService=require(_0x8ec6('0xc'));var qs=require(_0x8ec6('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8ec6('0xe'));var logger=require('../../config/logger')(_0x8ec6('0xf'));var utils=require(_0x8ec6('0x10'));var config=require(_0x8ec6('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x8ec6('0x12'));var client=jayson[_0x8ec6('0x13')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13f5d,_0x10b339,_0xbedecd,_0x370196){return new BPromise(function(_0x6bde29,_0x41f2a8){var _0x3aa04c=_0x370196||client;return _0x3aa04c[_0x8ec6('0x14')](_0x13f5d,_0xbedecd)['then'](function(_0xd5c361){logger['info']('Network,\x20%s,\x20%s',_0x10b339,_0x8ec6('0x15'));logger['debug'](_0x8ec6('0x16'),_0x10b339,'request\x20sent',JSON['stringify'](_0xd5c361));if(_0xd5c361[_0x8ec6('0x17')]){if(_0xd5c361[_0x8ec6('0x17')]['code']===0x1f4){logger[_0x8ec6('0x17')](_0x8ec6('0x18'),_0x10b339,_0xd5c361[_0x8ec6('0x17')]['message']);return _0x41f2a8(_0xd5c361[_0x8ec6('0x17')][_0x8ec6('0x19')]);}logger[_0x8ec6('0x17')](_0x8ec6('0x18'),_0x10b339,_0xd5c361[_0x8ec6('0x17')][_0x8ec6('0x19')]);return _0x6bde29(_0xd5c361[_0x8ec6('0x17')]['message']);}else{logger['info'](_0x8ec6('0x18'),_0x10b339,_0x8ec6('0x15'));_0x6bde29(_0xd5c361[_0x8ec6('0x1a')]['message']);}})[_0x8ec6('0x1b')](function(_0x16d758){logger[_0x8ec6('0x17')](_0x8ec6('0x18'),_0x10b339,_0x16d758);_0x41f2a8(_0x16d758);});});}function respondWithStatusCode(_0x31ce50,_0xf39df){_0xf39df=_0xf39df||0xcc;return function(_0x1c6a68){if(_0x1c6a68){return _0x31ce50[_0x8ec6('0x1c')](_0xf39df);}return _0x31ce50[_0x8ec6('0x1d')](_0xf39df)[_0x8ec6('0x1e')]();};}function respondWithResult(_0x57da7d,_0x291f9a){_0x291f9a=_0x291f9a||0xc8;return function(_0x4f943e){if(_0x4f943e){return _0x57da7d[_0x8ec6('0x1d')](_0x291f9a)[_0x8ec6('0x1f')](_0x4f943e);}};}function respondWithFilteredResult(_0x932b0d,_0x4fcec2){return function(_0x22b5a3){if(_0x22b5a3){var _0x54a4af=typeof _0x4fcec2[_0x8ec6('0x20')]==='undefined'&&typeof _0x4fcec2[_0x8ec6('0x21')]===_0x8ec6('0x22');var _0x2add16=_0x22b5a3['count'];var _0x2a67f5=_0x54a4af?0x0:_0x4fcec2[_0x8ec6('0x20')];var _0x5edc13=_0x54a4af?_0x22b5a3[_0x8ec6('0x23')]:_0x4fcec2['offset']+_0x4fcec2[_0x8ec6('0x21')];var _0x5c8e41;if(_0x5edc13>=_0x2add16){_0x5edc13=_0x2add16;_0x5c8e41=0xc8;}else{_0x5c8e41=0xce;}_0x932b0d[_0x8ec6('0x1d')](_0x5c8e41);return _0x932b0d['set'](_0x8ec6('0x24'),_0x2a67f5+'-'+_0x5edc13+'/'+_0x2add16)[_0x8ec6('0x1f')](_0x22b5a3);}return null;};}function patchUpdates(_0x2de39b){return function(_0x1d7a6e){try{jsonpatch['apply'](_0x1d7a6e,_0x2de39b,!![]);}catch(_0x39aa16){return BPromise[_0x8ec6('0x25')](_0x39aa16);}return _0x1d7a6e['save']();};}function saveUpdates(_0x30c295,_0x39d74d){return function(_0x561776){if(_0x561776){return _0x561776[_0x8ec6('0x26')](_0x30c295)[_0x8ec6('0x27')](function(_0x382402){return _0x382402;});}return null;};}function removeEntity(_0x3492c3,_0x462663){return function(_0x2aebf0){if(_0x2aebf0){return _0x2aebf0['destroy']()[_0x8ec6('0x27')](function(){_0x3492c3[_0x8ec6('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4aa4d0,_0x3594f1){return function(_0x5e6804){if(!_0x5e6804){_0x4aa4d0[_0x8ec6('0x1c')](0x194);}return _0x5e6804;};}function handleError(_0x2d20c0,_0x25d92e){_0x25d92e=_0x25d92e||0x1f4;return function(_0x2ad503){logger[_0x8ec6('0x17')](_0x2ad503[_0x8ec6('0x28')]);if(_0x2ad503[_0x8ec6('0x29')]){delete _0x2ad503['name'];}_0x2d20c0['status'](_0x25d92e)['send'](_0x2ad503);};}exports[_0x8ec6('0x2a')]=function(_0xcecf9e,_0x5d41a0){var _0x1a2b46={},_0x3183b8={},_0x5466e0={'count':0x0,'rows':[]};var _0xd286f7=_['map'](db[_0x8ec6('0x2b')]['rawAttributes'],function(_0x32de0e){return{'name':_0x32de0e[_0x8ec6('0x2c')],'type':_0x32de0e[_0x8ec6('0x2d')][_0x8ec6('0x2e')]};});_0x3183b8[_0x8ec6('0x2f')]=_[_0x8ec6('0x30')](_0xd286f7,_0x8ec6('0x29'));_0x3183b8['query']=_[_0x8ec6('0x31')](_0xcecf9e[_0x8ec6('0x32')]);_0x3183b8[_0x8ec6('0x33')]=_[_0x8ec6('0x34')](_0x3183b8[_0x8ec6('0x2f')],_0x3183b8[_0x8ec6('0x32')]);_0x1a2b46['attributes']=_[_0x8ec6('0x34')](_0x3183b8[_0x8ec6('0x2f')],qs['fields'](_0xcecf9e[_0x8ec6('0x32')][_0x8ec6('0x35')]));_0x1a2b46['attributes']=_0x1a2b46[_0x8ec6('0x36')]['length']?_0x1a2b46[_0x8ec6('0x36')]:_0x3183b8['model'];if(!_0xcecf9e[_0x8ec6('0x32')][_0x8ec6('0x37')](_0x8ec6('0x38'))){_0x1a2b46['limit']=qs['limit'](_0xcecf9e[_0x8ec6('0x32')][_0x8ec6('0x21')]);_0x1a2b46[_0x8ec6('0x20')]=qs[_0x8ec6('0x20')](_0xcecf9e[_0x8ec6('0x32')][_0x8ec6('0x20')]);}_0x1a2b46[_0x8ec6('0x39')]=qs[_0x8ec6('0x3a')](_0xcecf9e[_0x8ec6('0x32')]['sort']);_0x1a2b46[_0x8ec6('0x3b')]=qs[_0x8ec6('0x33')](_[_0x8ec6('0x3c')](_0xcecf9e[_0x8ec6('0x32')],_0x3183b8[_0x8ec6('0x33')]),_0xd286f7);if(_0xcecf9e[_0x8ec6('0x32')][_0x8ec6('0x3d')]){_0x1a2b46[_0x8ec6('0x3b')]=_[_0x8ec6('0x3e')](_0x1a2b46[_0x8ec6('0x3b')],{'$or':_[_0x8ec6('0x30')](_0xd286f7,function(_0x324f24){if(_0x324f24[_0x8ec6('0x2d')]!==_0x8ec6('0x3f')){var _0x15446a={};_0x15446a[_0x324f24['name']]={'$like':'%'+_0xcecf9e[_0x8ec6('0x32')][_0x8ec6('0x3d')]+'%'};return _0x15446a;}})});}_0x1a2b46=_[_0x8ec6('0x3e')]({},_0x1a2b46,_0xcecf9e[_0x8ec6('0x40')]);var _0x5b569b={'where':_0x1a2b46['where']};return db[_0x8ec6('0x2b')][_0x8ec6('0x23')](_0x5b569b)[_0x8ec6('0x27')](function(_0x27cd9f){_0x5466e0[_0x8ec6('0x23')]=_0x27cd9f;if(_0xcecf9e[_0x8ec6('0x32')][_0x8ec6('0x41')]){_0x1a2b46[_0x8ec6('0x42')]=[{'all':!![]}];}return db[_0x8ec6('0x2b')]['findAll'](_0x1a2b46);})[_0x8ec6('0x27')](function(_0x4834cd){_0x5466e0['rows']=_0x4834cd;return _0x5466e0;})['then'](respondWithFilteredResult(_0x5d41a0,_0x1a2b46))['catch'](handleError(_0x5d41a0,null));};exports['show']=function(_0x510f60,_0x251fcc){var _0x2154cd={'raw':!![],'where':{'id':_0x510f60[_0x8ec6('0x43')]['id']}},_0x345c01={};_0x345c01['model']=_[_0x8ec6('0x31')](db['Network'][_0x8ec6('0x44')]);_0x345c01[_0x8ec6('0x32')]=_[_0x8ec6('0x31')](_0x510f60[_0x8ec6('0x32')]);_0x345c01['filters']=_[_0x8ec6('0x34')](_0x345c01[_0x8ec6('0x2f')],_0x345c01[_0x8ec6('0x32')]);_0x2154cd['attributes']=_[_0x8ec6('0x34')](_0x345c01[_0x8ec6('0x2f')],qs[_0x8ec6('0x35')](_0x510f60[_0x8ec6('0x32')][_0x8ec6('0x35')]));_0x2154cd[_0x8ec6('0x36')]=_0x2154cd[_0x8ec6('0x36')]['length']?_0x2154cd[_0x8ec6('0x36')]:_0x345c01[_0x8ec6('0x2f')];if(_0x510f60[_0x8ec6('0x32')]['includeAll']){_0x2154cd['include']=[{'all':!![]}];}_0x2154cd=_[_0x8ec6('0x3e')]({},_0x2154cd,_0x510f60[_0x8ec6('0x40')]);return db[_0x8ec6('0x2b')][_0x8ec6('0x45')](_0x2154cd)[_0x8ec6('0x27')](handleEntityNotFound(_0x251fcc,null))['then'](respondWithResult(_0x251fcc,null))[_0x8ec6('0x1b')](handleError(_0x251fcc,null));};exports['create']=function(_0x32dc08,_0x5c35f7,_0x5b09ba){var _0x58a95e;return db[_0x8ec6('0x46')][_0x8ec6('0x47')](function(_0x32dd88){return db[_0x8ec6('0x2b')][_0x8ec6('0x48')](_0x32dc08[_0x8ec6('0x49')],{'raw':!![]})[_0x8ec6('0x27')](function(_0x528f65){_0x58a95e=_0x528f65;return db['Network'][_0x8ec6('0x4a')]({'where':{'type':_0x32dc08[_0x8ec6('0x49')][_0x8ec6('0x2d')]},'raw':!![]});})['then'](function(_0x9169fa){if(_0x58a95e[_0x8ec6('0x2d')][_0x8ec6('0x4b')]()==_0x8ec6('0x4c')){var _0x473cce=fs[_0x8ec6('0x4d')](path[_0x8ec6('0x4e')](config[_0x8ec6('0x4f')],_0x8ec6('0x50')),_0x8ec6('0x51'));var _0xe8b937=ejs['render'](_0x473cce,{'networks':_0x9169fa||[]});fs[_0x8ec6('0x52')](_0x8ec6('0x53'),_0xe8b937);return respondWithRpcPromise(_0x8ec6('0x54'),_0x8ec6('0x48'),{'module':_0x8ec6('0x55')});}else if(_0x58a95e[_0x8ec6('0x2d')][_0x8ec6('0x4b')]()==_0x8ec6('0x56')){var _0x29f805=fs[_0x8ec6('0x4d')](path[_0x8ec6('0x4e')](config[_0x8ec6('0x4f')],_0x8ec6('0x57')),_0x8ec6('0x51'));var _0x2aa702=ejs[_0x8ec6('0x58')](_0x29f805,{'networks':_0x9169fa||[]});fs[_0x8ec6('0x52')]('/etc/asterisk/turn_xcally.conf',_0x2aa702);return respondWithRpcPromise(_0x8ec6('0x54'),_0x8ec6('0x48'),{'module':'res_stun_monitor.so'});}else{var _0x2d1a77=fs[_0x8ec6('0x4d')](path[_0x8ec6('0x4e')](config[_0x8ec6('0x4f')],_0x8ec6('0x59')),_0x8ec6('0x51'));var _0x128ffa=ejs['render'](_0x2d1a77,{'networks':_0x9169fa||[]});fs['writeFileSync'](util[_0x8ec6('0x5a')](_0x8ec6('0x5b'),_0x32dc08[_0x8ec6('0x49')][_0x8ec6('0x2d')]['toLowerCase']()),_0x128ffa);return respondWithRpcPromise('Reload','create',{'module':_0x8ec6('0x5c')});}return null;})[_0x8ec6('0x27')](function(){return _0x58a95e;});})[_0x8ec6('0x27')](respondWithResult(_0x5c35f7,0xc9))[_0x8ec6('0x1b')](handleError(_0x5c35f7,null));};exports['update']=function(_0x3eb7a7,_0x451c89,_0x48474c){var _0x1fa51b;return db[_0x8ec6('0x46')]['transaction'](function(_0x32dab9){return db['Network']['find']({'where':{'id':_0x3eb7a7['params']['id']}})[_0x8ec6('0x27')](handleEntityNotFound(_0x451c89,null))[_0x8ec6('0x27')](saveUpdates(_0x3eb7a7[_0x8ec6('0x49')],null))[_0x8ec6('0x27')](function(_0x53e2f0){if(_0x53e2f0){_0x1fa51b=_0x53e2f0;return db[_0x8ec6('0x2b')]['findAll']({'where':{'type':_0x1fa51b[_0x8ec6('0x2d')]},'raw':!![]});}return null;})['then'](function(_0x4e4b44){if(_0x1fa51b[_0x8ec6('0x2d')][_0x8ec6('0x4b')]()==_0x8ec6('0x4c')){var _0x4d2759=fs[_0x8ec6('0x4d')](path[_0x8ec6('0x4e')](config[_0x8ec6('0x4f')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x58c6e2=ejs['render'](_0x4d2759,{'networks':_0x4e4b44||[]});fs[_0x8ec6('0x52')]('/etc/asterisk/stun_xcally.conf',_0x58c6e2);return respondWithRpcPromise(_0x8ec6('0x54'),_0x8ec6('0x26'),{'module':'res_stun_monitor.so'});}else if(_0x1fa51b[_0x8ec6('0x2d')]['toUpperCase']()==_0x8ec6('0x56')){var _0x54e3b4=fs[_0x8ec6('0x4d')](path[_0x8ec6('0x4e')](config[_0x8ec6('0x4f')],_0x8ec6('0x57')),_0x8ec6('0x51'));var _0x225034=ejs[_0x8ec6('0x58')](_0x54e3b4,{'networks':_0x4e4b44||[]});fs[_0x8ec6('0x52')](_0x8ec6('0x5d'),_0x225034);return respondWithRpcPromise('Reload','update',{'module':_0x8ec6('0x55')});}else{var _0x1d9242=fs[_0x8ec6('0x4d')](path[_0x8ec6('0x4e')](config[_0x8ec6('0x4f')],_0x8ec6('0x59')),'utf8');var _0x1bca35=ejs['render'](_0x1d9242,{'networks':_0x4e4b44||[]});fs['writeFileSync'](util['format'](_0x8ec6('0x5b'),_0x3eb7a7[_0x8ec6('0x49')][_0x8ec6('0x2d')][_0x8ec6('0x5e')]()),_0x1bca35);return respondWithRpcPromise(_0x8ec6('0x54'),_0x8ec6('0x26'),{'module':_0x8ec6('0x5c')});}return null;})[_0x8ec6('0x27')](function(_0x30dc14){if(_0x30dc14){return _0x1fa51b;}return null;});})[_0x8ec6('0x27')](respondWithResult(_0x451c89,null))[_0x8ec6('0x1b')](handleError(_0x451c89,null));};exports[_0x8ec6('0x5f')]=function(_0x10b81a,_0x3f5c17,_0x6652a5){var _0x5c173b;return db['Network'][_0x8ec6('0x45')]({'where':{'id':_0x10b81a[_0x8ec6('0x43')]['id']}})[_0x8ec6('0x27')](function(_0x5b16bb){_0x5c173b=_0x5b16bb;return _0x5b16bb;})['then'](handleEntityNotFound(_0x3f5c17,null))[_0x8ec6('0x27')](removeEntity(_0x3f5c17,null))[_0x8ec6('0x27')](function(){if(_0x5c173b){return db[_0x8ec6('0x2b')][_0x8ec6('0x4a')]({'where':{'type':_0x5c173b[_0x8ec6('0x2d')]},'raw':!![]});}})[_0x8ec6('0x27')](function(_0x669c98){if(_0x5c173b[_0x8ec6('0x2d')][_0x8ec6('0x4b')]()=='STUN'){var _0x458c8c=fs[_0x8ec6('0x4d')](path[_0x8ec6('0x4e')](config['root'],_0x8ec6('0x50')),_0x8ec6('0x51'));var _0x2c4ee9=ejs['render'](_0x458c8c,{'networks':_0x669c98||[]});fs[_0x8ec6('0x52')](_0x8ec6('0x53'),_0x2c4ee9);return respondWithRpcPromise('Reload',_0x8ec6('0x5f'),{'module':_0x8ec6('0x55')});}else if(_0x5c173b['type']['toUpperCase']()==_0x8ec6('0x56')){var _0x2b194a=fs[_0x8ec6('0x4d')](path[_0x8ec6('0x4e')](config[_0x8ec6('0x4f')],_0x8ec6('0x57')),_0x8ec6('0x51'));var _0x564916=ejs[_0x8ec6('0x58')](_0x2b194a,{'networks':_0x669c98||[]});fs[_0x8ec6('0x52')](_0x8ec6('0x5d'),_0x564916);return respondWithRpcPromise(_0x8ec6('0x54'),'destroy',{'module':_0x8ec6('0x55')});}else{var _0x860a70=fs[_0x8ec6('0x4d')](path[_0x8ec6('0x4e')](config[_0x8ec6('0x4f')],_0x8ec6('0x59')),_0x8ec6('0x51'));var _0x42bd91=ejs[_0x8ec6('0x58')](_0x860a70,{'networks':_0x669c98||[]});fs[_0x8ec6('0x52')](util[_0x8ec6('0x5a')]('/etc/asterisk/sip_xcally_%s.conf',_0x10b81a[_0x8ec6('0x49')][_0x8ec6('0x2d')][_0x8ec6('0x5e')]()),_0x42bd91);return respondWithRpcPromise(_0x8ec6('0x54'),_0x8ec6('0x5f'),{'module':_0x8ec6('0x5c')});}return null;})[_0x8ec6('0x1b')](handleError(_0x3f5c17,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 7ec2864..f414af3 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 _0xb469=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','lodash','util','../../config/logger','api'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xb469,0x13b));var _0x9b46=function(_0x52d02b,_0x5577be){_0x52d02b=_0x52d02b-0x0;var _0x45aeae=_0xb469[_0x52d02b];return _0x45aeae;};'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 +var _0xb248=['lodash','../../config/logger','api','moment','bluebird','path','rimraf','./network.attributes','exports','define','network'];(function(_0x5a8264,_0x2718fe){var _0x3a5bc2=function(_0xb2fdcd){while(--_0xb2fdcd){_0x5a8264['push'](_0x5a8264['shift']());}};_0x3a5bc2(++_0x2718fe);}(_0xb248,0xc6));var _0x8b24=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xb248[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x8b24('0x0'));var util=require('util');var logger=require(_0x8b24('0x1'))(_0x8b24('0x2'));var moment=require(_0x8b24('0x3'));var BPromise=require(_0x8b24('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8b24('0x5'));var rimraf=require(_0x8b24('0x6'));var config=require('../../config/environment');var attributes=require(_0x8b24('0x7'));module[_0x8b24('0x8')]=function(_0x4cc3c4,_0x6da5b7){return _0x4cc3c4[_0x8b24('0x9')]('Network',attributes,{'tableName':_0x8b24('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 3d7c21a..363112d 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(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x42236b,_0x379e7e){_0x42236b=_0x42236b-0x0;var _0x2be3e4=_0x7a54[_0x42236b];return _0x2be3e4;};'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(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7a54,0x106));var _0x47a5=function(_0x2bd608,_0x43ccd0){_0x2bd608=_0x2bd608-0x0;var _0x132b0e=_0x7a54[_0x2bd608];return _0x132b0e;};'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 79c19ea..84fc645 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 _0xbb2c=['/describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications','/:id/users','getAgents','post','create','addAnswer','/:id/notify','notify','/:id/applications','addAgents','/:id/send','send','put','/:id','update','delete','destroy','removeDispositions','removeAgents','exports','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbb2c,0x15e));var _0xcbb2=function(_0x267907,_0x59c53d){_0x267907=_0x267907-0x0;var _0x4cf2b0=_0xbb2c[_0x267907];return _0x4cf2b0;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcbb2('0x0'));var router=express[_0xcbb2('0x1')]();var fs_extra=require(_0xcbb2('0x2'));var auth=require(_0xcbb2('0x3'));var interaction=require(_0xcbb2('0x4'));var config=require(_0xcbb2('0x5'));var controller=require(_0xcbb2('0x6'));router[_0xcbb2('0x7')]('/',auth[_0xcbb2('0x8')](),controller[_0xcbb2('0x9')]);router[_0xcbb2('0x7')](_0xcbb2('0xa'),auth[_0xcbb2('0x8')](),controller['describe']);router[_0xcbb2('0x7')]('/:id',auth[_0xcbb2('0x8')](),controller[_0xcbb2('0xb')]);router['get'](_0xcbb2('0xc'),auth[_0xcbb2('0x8')](),controller[_0xcbb2('0xd')]);router[_0xcbb2('0x7')](_0xcbb2('0xe'),auth[_0xcbb2('0x8')](),controller[_0xcbb2('0xf')]);router[_0xcbb2('0x7')]('/:id/applications',auth[_0xcbb2('0x8')](),controller[_0xcbb2('0x10')]);router[_0xcbb2('0x7')]('/:id/interactions',auth[_0xcbb2('0x8')](),controller['getInteractions']);router['get'](_0xcbb2('0x11'),auth[_0xcbb2('0x8')](),controller[_0xcbb2('0x12')]);router[_0xcbb2('0x13')]('/',auth[_0xcbb2('0x8')](),controller[_0xcbb2('0x14')]);router[_0xcbb2('0x13')]('/:id/dispositions',auth['isAuthenticated'](),controller['addDisposition']);router[_0xcbb2('0x13')](_0xcbb2('0xe'),auth[_0xcbb2('0x8')](),controller[_0xcbb2('0x15')]);router['post'](_0xcbb2('0x16'),controller[_0xcbb2('0x17')]);router[_0xcbb2('0x13')](_0xcbb2('0x18'),auth[_0xcbb2('0x8')](),controller['addApplications']);router[_0xcbb2('0x13')]('/:id/users',auth[_0xcbb2('0x8')](),controller[_0xcbb2('0x19')]);router[_0xcbb2('0x13')](_0xcbb2('0x1a'),auth[_0xcbb2('0x8')](),controller[_0xcbb2('0x1b')]);router[_0xcbb2('0x1c')](_0xcbb2('0x1d'),auth[_0xcbb2('0x8')](),controller[_0xcbb2('0x1e')]);router[_0xcbb2('0x1f')](_0xcbb2('0x1d'),auth['isAuthenticated'](),controller[_0xcbb2('0x20')]);router['delete'](_0xcbb2('0xc'),auth[_0xcbb2('0x8')](),controller[_0xcbb2('0x21')]);router[_0xcbb2('0x1f')]('/:id/canned_answers',auth[_0xcbb2('0x8')](),controller['removeAnswers']);router['delete'](_0xcbb2('0x11'),auth[_0xcbb2('0x8')](),controller[_0xcbb2('0x22')]);module[_0xcbb2('0x23')]=router; \ No newline at end of file +var _0xb4a3=['/:id/interactions','post','/:id/notify','notify','addApplications','/:id/users','addAgents','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','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'];(function(_0x3d2e89,_0x2f79c4){var _0x58b969=function(_0x53064e){while(--_0x53064e){_0x3d2e89['push'](_0x3d2e89['shift']());}};_0x58b969(++_0x2f79c4);}(_0xb4a3,0x19a));var _0x3b4a=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0xb4a3[_0xc67528];return _0x38e26d;};'use strict';var multer=require(_0x3b4a('0x0'));var util=require(_0x3b4a('0x1'));var path=require(_0x3b4a('0x2'));var timeout=require(_0x3b4a('0x3'));var express=require(_0x3b4a('0x4'));var router=express[_0x3b4a('0x5')]();var fs_extra=require(_0x3b4a('0x6'));var auth=require(_0x3b4a('0x7'));var interaction=require(_0x3b4a('0x8'));var config=require(_0x3b4a('0x9'));var controller=require('./openchannelAccount.controller');router[_0x3b4a('0xa')]('/',auth[_0x3b4a('0xb')](),controller[_0x3b4a('0xc')]);router[_0x3b4a('0xa')](_0x3b4a('0xd'),auth[_0x3b4a('0xb')](),controller[_0x3b4a('0xe')]);router[_0x3b4a('0xa')](_0x3b4a('0xf'),auth[_0x3b4a('0xb')](),controller[_0x3b4a('0x10')]);router[_0x3b4a('0xa')](_0x3b4a('0x11'),auth[_0x3b4a('0xb')](),controller[_0x3b4a('0x12')]);router['get'](_0x3b4a('0x13'),auth[_0x3b4a('0xb')](),controller['getAnswers']);router['get'](_0x3b4a('0x14'),auth['isAuthenticated'](),controller[_0x3b4a('0x15')]);router[_0x3b4a('0xa')](_0x3b4a('0x16'),auth[_0x3b4a('0xb')](),controller['getInteractions']);router[_0x3b4a('0xa')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x3b4a('0x17')]('/',auth[_0x3b4a('0xb')](),controller['create']);router['post']('/:id/dispositions',auth[_0x3b4a('0xb')](),controller['addDisposition']);router[_0x3b4a('0x17')](_0x3b4a('0x13'),auth['isAuthenticated'](),controller['addAnswer']);router['post'](_0x3b4a('0x18'),controller[_0x3b4a('0x19')]);router[_0x3b4a('0x17')]('/:id/applications',auth['isAuthenticated'](),controller[_0x3b4a('0x1a')]);router[_0x3b4a('0x17')](_0x3b4a('0x1b'),auth[_0x3b4a('0xb')](),controller[_0x3b4a('0x1c')]);router[_0x3b4a('0x17')]('/:id/send',auth[_0x3b4a('0xb')](),controller['send']);router['put'](_0x3b4a('0xf'),auth[_0x3b4a('0xb')](),controller[_0x3b4a('0x1d')]);router[_0x3b4a('0x1e')]('/:id',auth['isAuthenticated'](),controller[_0x3b4a('0x1f')]);router['delete'](_0x3b4a('0x11'),auth[_0x3b4a('0xb')](),controller[_0x3b4a('0x20')]);router[_0x3b4a('0x1e')]('/:id/canned_answers',auth[_0x3b4a('0xb')](),controller[_0x3b4a('0x21')]);router['delete'](_0x3b4a('0x1b'),auth['isAuthenticated'](),controller[_0x3b4a('0x22')]);module[_0x3b4a('0x23')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 58d184e..65a5536 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 _0x07f3=['mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId'];(function(_0x29da7f,_0x7316ca){var _0x593d5a=function(_0x197eed){while(--_0x197eed){_0x29da7f['push'](_0x29da7f['shift']());}};_0x593d5a(++_0x7316ca);}(_0x07f3,0x1e2));var _0x307f=function(_0x46a38b,_0x16ffb5){_0x46a38b=_0x46a38b-0x0;var _0x346e75=_0x07f3[_0x46a38b];return _0x346e75;};'use strict';var Sequelize=require(_0x307f('0x0'));var rs=require(_0x307f('0x1'));module[_0x307f('0x2')]={'name':{'type':Sequelize[_0x307f('0x3')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x307f('0x3')]},'token':{'type':Sequelize[_0x307f('0x3')],'defaultValue':function(){return rs[_0x307f('0x4')]();}},'replyUri':{'type':Sequelize[_0x307f('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x307f('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x307f('0x5')],'defaultValue':function(){return _0x307f('0x6');}},'notificationSound':{'type':Sequelize[_0x307f('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x307f('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x307f('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x307f('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x307f('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x307f('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x307f('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x307f('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x27e7d2){if(!_0x27e7d2)this[_0x307f('0xa')](_0x307f('0xb'),null);this[_0x307f('0xa')](_0x307f('0xc'),_0x27e7d2);}}}; \ No newline at end of file +var _0xbb0a=['STRING','generate','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','exports','name'];(function(_0x1a3255,_0xd1c5bd){var _0x44dcf9=function(_0x42f9ab){while(--_0x42f9ab){_0x1a3255['push'](_0x1a3255['shift']());}};_0x44dcf9(++_0xd1c5bd);}(_0xbb0a,0x111));var _0xabb0=function(_0x485e5f,_0x13d34a){_0x485e5f=_0x485e5f-0x0;var _0x8b48b8=_0xbb0a[_0x485e5f];return _0x8b48b8;};'use strict';var Sequelize=require(_0xabb0('0x0'));var rs=require('randomstring');module[_0xabb0('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xabb0('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xabb0('0x3')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xabb0('0x4')]();}},'replyUri':{'type':Sequelize[_0xabb0('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xabb0('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xabb0('0x5')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xabb0('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xabb0('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xabb0('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xabb0('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xabb0('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xabb0('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0xabb0('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xabb0('0x6')],'defaultValue':![],'comment':_0xabb0('0x9'),'set':function(_0x1a422d){if(!_0x1a422d)this[_0xabb0('0xa')](_0xabb0('0xb'),null);this[_0xabb0('0xa')]('mandatoryDisposition',_0x1a422d);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 512f2d4..9f08780 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 _0x901c=['order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelAccounts','userProfileId','autoAssociation','body','describe','addDisposition','Disposition','findOne','OpenchannelAccountId','rows','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','notify','openchannel','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','from','Sequelize','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','Contacts','OpenchannelApplication','account','applications','Applications','List','orderBy','priority','asc','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','lastName','messageId','interaction','created','autoclose','push','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','forcedOwnership','startRouting','EventManager','addApplications','sequelize','findAndCountAll','getApplications','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','removeAgents','isArray','userOpenchannelAccount:remove','emit','getAgents','DESC','ListId','out','Messages','user','dataValues','eml-format','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','register','jayson/promise','client','http','request','then','info','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','OpenchannelAccount,\x20%s,\x20%s','result','catch','status','end','json','offset','limit','count','set','Content-Range','apply','destroy','get','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x49a60f,_0x518c48){var _0x38c29c=function(_0x42b9cb){while(--_0x42b9cb){_0x49a60f['push'](_0x49a60f['shift']());}};_0x38c29c(++_0x518c48);}(_0x901c,0x123));var _0xc901=function(_0x46c504,_0xb3b6cb){_0x46c504=_0x46c504-0x0;var _0x926202=_0x901c[_0x46c504];return _0x926202;};'use strict';var emlformat=require(_0xc901('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc901('0x1'));var moment=require(_0xc901('0x2'));var BPromise=require(_0xc901('0x3'));var Mustache=require(_0xc901('0x4'));var util=require(_0xc901('0x5'));var path=require(_0xc901('0x6'));var sox=require('sox');var csv=require(_0xc901('0x7'));var ejs=require(_0xc901('0x8'));var fs=require('fs');var fs_extra=require(_0xc901('0x9'));var _=require(_0xc901('0xa'));var squel=require(_0xc901('0xb'));var crypto=require('crypto');var jsforce=require(_0xc901('0xc'));var deskjs=require(_0xc901('0xd'));var toCsv=require(_0xc901('0x7'));var querystring=require('querystring');var Papa=require(_0xc901('0xe'));var Redis=require(_0xc901('0xf'));var authService=require(_0xc901('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xc901('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc901('0x12'))('api');var utils=require(_0xc901('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xc901('0x14'));var db=require(_0xc901('0x15'))['db'];config[_0xc901('0x16')]=_[_0xc901('0x17')](config[_0xc901('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc901('0x16')]));require('./openchannelAccount.socket')[_0xc901('0x18')](socket);var jayson=require(_0xc901('0x19'));var client=jayson[_0xc901('0x1a')][_0xc901('0x1b')]({'port':0x232c});var client9002=jayson[_0xc901('0x1a')][_0xc901('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x4eb2fe,_0x52c91b,_0x2365dc,_0x1a0b48){return new BPromise(function(_0xcb3d7b,_0x4fc7be){var _0x2e4438=_0x1a0b48||client;return _0x2e4438[_0xc901('0x1c')](_0x4eb2fe,_0x2365dc)[_0xc901('0x1d')](function(_0x55d795){logger[_0xc901('0x1e')]('OpenchannelAccount,\x20%s,\x20%s',_0x52c91b,'request\x20sent');logger[_0xc901('0x1f')](_0xc901('0x20'),_0x52c91b,_0xc901('0x21'),JSON[_0xc901('0x22')](_0x55d795));if(_0x55d795[_0xc901('0x23')]){if(_0x55d795[_0xc901('0x23')][_0xc901('0x24')]===0x1f4){logger[_0xc901('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x52c91b,_0x55d795[_0xc901('0x23')][_0xc901('0x25')]);return _0x4fc7be(_0x55d795[_0xc901('0x23')]['message']);}logger['error'](_0xc901('0x26'),_0x52c91b,_0x55d795[_0xc901('0x23')]['message']);return _0xcb3d7b(_0x55d795[_0xc901('0x23')][_0xc901('0x25')]);}else{logger['info'](_0xc901('0x26'),_0x52c91b,_0xc901('0x21'));_0xcb3d7b(_0x55d795[_0xc901('0x27')]['message']);}})[_0xc901('0x28')](function(_0x40d512){logger[_0xc901('0x23')](_0xc901('0x26'),_0x52c91b,_0x40d512);_0x4fc7be(_0x40d512);});});}function respondWithStatusCode(_0x5a8d0b,_0x4b4fc0){_0x4b4fc0=_0x4b4fc0||0xcc;return function(_0x2ff915){if(_0x2ff915){return _0x5a8d0b['sendStatus'](_0x4b4fc0);}return _0x5a8d0b[_0xc901('0x29')](_0x4b4fc0)[_0xc901('0x2a')]();};}function respondWithResult(_0x1774d1,_0x530700){_0x530700=_0x530700||0xc8;return function(_0x3f60de){if(_0x3f60de){return _0x1774d1[_0xc901('0x29')](_0x530700)[_0xc901('0x2b')](_0x3f60de);}};}function respondWithFilteredResult(_0x522a58,_0x2b37dd){return function(_0x742a5d){if(_0x742a5d){var _0x161847=typeof _0x2b37dd[_0xc901('0x2c')]==='undefined'&&typeof _0x2b37dd[_0xc901('0x2d')]==='undefined';var _0x228ab3=_0x742a5d['count'];var _0x4b1f5f=_0x161847?0x0:_0x2b37dd[_0xc901('0x2c')];var _0x5da7e9=_0x161847?_0x742a5d[_0xc901('0x2e')]:_0x2b37dd[_0xc901('0x2c')]+_0x2b37dd[_0xc901('0x2d')];var _0x335b1b;if(_0x5da7e9>=_0x228ab3){_0x5da7e9=_0x228ab3;_0x335b1b=0xc8;}else{_0x335b1b=0xce;}_0x522a58[_0xc901('0x29')](_0x335b1b);return _0x522a58[_0xc901('0x2f')](_0xc901('0x30'),_0x4b1f5f+'-'+_0x5da7e9+'/'+_0x228ab3)[_0xc901('0x2b')](_0x742a5d);}return null;};}function patchUpdates(_0x23cfb6){return function(_0x25b390){try{jsonpatch[_0xc901('0x31')](_0x25b390,_0x23cfb6,!![]);}catch(_0x542d46){return BPromise['reject'](_0x542d46);}return _0x25b390['save']();};}function saveUpdates(_0x4b2f6e,_0x38d14c){return function(_0x3cd0df){if(_0x3cd0df){return _0x3cd0df['update'](_0x4b2f6e)[_0xc901('0x1d')](function(_0x58c1d9){return _0x58c1d9;});}return null;};}function removeEntity(_0x5187c8,_0x1660f1){return function(_0x405fb7){if(_0x405fb7){return _0x405fb7[_0xc901('0x32')]()[_0xc901('0x1d')](function(){var _0x25ff2c=_0x405fb7[_0xc901('0x33')]({'plain':!![]});var _0x11cedd='OpenchannelAccounts';return db[_0xc901('0x34')][_0xc901('0x32')]({'where':{'type':_0x11cedd,'resourceId':_0x25ff2c['id']}})[_0xc901('0x1d')](function(){return _0x405fb7;});})[_0xc901('0x1d')](function(){_0x5187c8[_0xc901('0x29')](0xcc)[_0xc901('0x2a')]();});}};}function handleEntityNotFound(_0x3eef4a,_0x5226f1){return function(_0x4545bb){if(!_0x4545bb){_0x3eef4a['sendStatus'](0x194);}return _0x4545bb;};}function handleError(_0x1f43b9,_0x5340d5){_0x5340d5=_0x5340d5||0x1f4;return function(_0x451a10){logger[_0xc901('0x23')](_0x451a10[_0xc901('0x35')]);if(_0x451a10[_0xc901('0x36')]){delete _0x451a10[_0xc901('0x36')];}_0x1f43b9[_0xc901('0x29')](_0x5340d5)[_0xc901('0x37')](_0x451a10);};}exports[_0xc901('0x38')]=function(_0x288e41,_0x7d332f){var _0x5b6152={'include':[{'model':db[_0xc901('0x39')],'as':_0xc901('0x3a')}]},_0x3c605d={},_0x4260ac={'count':0x0,'rows':[]};var _0x1a6513=_[_0xc901('0x3b')](db[_0xc901('0x3c')][_0xc901('0x3d')],function(_0x56291b){return{'name':_0x56291b['fieldName'],'type':_0x56291b['type']['key']};});_0x3c605d[_0xc901('0x3e')]=_[_0xc901('0x3b')](_0x1a6513,'name');_0x3c605d[_0xc901('0x3f')]=_[_0xc901('0x40')](_0x288e41[_0xc901('0x3f')]);_0x3c605d['filters']=_[_0xc901('0x41')](_0x3c605d['model'],_0x3c605d['query']);_0x5b6152[_0xc901('0x42')]=_['intersection'](_0x3c605d[_0xc901('0x3e')],qs[_0xc901('0x43')](_0x288e41[_0xc901('0x3f')]['fields']));_0x5b6152['attributes']=_0x5b6152[_0xc901('0x42')][_0xc901('0x44')]?_0x5b6152[_0xc901('0x42')]:_0x3c605d[_0xc901('0x3e')];if(!_0x288e41['query'][_0xc901('0x45')](_0xc901('0x46'))){_0x5b6152[_0xc901('0x2d')]=qs[_0xc901('0x2d')](_0x288e41['query']['limit']);_0x5b6152[_0xc901('0x2c')]=qs['offset'](_0x288e41[_0xc901('0x3f')][_0xc901('0x2c')]);}_0x5b6152[_0xc901('0x47')]=qs[_0xc901('0x48')](_0x288e41[_0xc901('0x3f')][_0xc901('0x48')]);_0x5b6152[_0xc901('0x49')]=qs[_0xc901('0x4a')](_[_0xc901('0x4b')](_0x288e41[_0xc901('0x3f')],_0x3c605d['filters']),_0x1a6513);if(_0x288e41[_0xc901('0x3f')][_0xc901('0x4c')]){_0x5b6152['where']=_[_0xc901('0x4d')](_0x5b6152[_0xc901('0x49')],{'$or':_[_0xc901('0x3b')](_0x1a6513,function(_0x3d7e7f){if(_0x3d7e7f[_0xc901('0x4e')]!==_0xc901('0x4f')){var _0x2e5de8={};_0x2e5de8[_0x3d7e7f[_0xc901('0x36')]]={'$like':'%'+_0x288e41[_0xc901('0x3f')][_0xc901('0x4c')]+'%'};return _0x2e5de8;}})});}_0x5b6152=_[_0xc901('0x4d')]({},_0x5b6152,_0x288e41[_0xc901('0x50')]);var _0x187725={'where':_0x5b6152[_0xc901('0x49')]};return db[_0xc901('0x3c')][_0xc901('0x2e')](_0x187725)[_0xc901('0x1d')](function(_0x73c52d){_0x4260ac[_0xc901('0x2e')]=_0x73c52d;if(_0x288e41[_0xc901('0x3f')][_0xc901('0x51')]){_0x5b6152[_0xc901('0x52')]=[{'all':!![]}];}return db[_0xc901('0x3c')][_0xc901('0x53')](_0x5b6152);})[_0xc901('0x1d')](function(_0x25e978){_0x4260ac['rows']=_0x25e978;return _0x4260ac;})[_0xc901('0x1d')](respondWithFilteredResult(_0x7d332f,_0x5b6152))[_0xc901('0x28')](handleError(_0x7d332f,null));};exports[_0xc901('0x54')]=function(_0x5634d6,_0x87977b){var _0x21b523={'raw':![],'where':{'id':_0x5634d6[_0xc901('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0xc901('0x3a')}]},_0x45b5a6={};_0x45b5a6[_0xc901('0x3e')]=_[_0xc901('0x40')](db[_0xc901('0x3c')][_0xc901('0x3d')]);_0x45b5a6[_0xc901('0x3f')]=_[_0xc901('0x40')](_0x5634d6[_0xc901('0x3f')]);_0x45b5a6[_0xc901('0x4a')]=_[_0xc901('0x41')](_0x45b5a6['model'],_0x45b5a6[_0xc901('0x3f')]);_0x21b523[_0xc901('0x42')]=_[_0xc901('0x41')](_0x45b5a6['model'],qs[_0xc901('0x43')](_0x5634d6['query'][_0xc901('0x43')]));_0x21b523[_0xc901('0x42')]=_0x21b523[_0xc901('0x42')][_0xc901('0x44')]?_0x21b523[_0xc901('0x42')]:_0x45b5a6['model'];if(_0x5634d6[_0xc901('0x3f')]['includeAll']){_0x21b523['include']=[{'all':!![]}];}_0x21b523=_[_0xc901('0x4d')]({},_0x21b523,_0x5634d6['options']);return db[_0xc901('0x3c')][_0xc901('0x56')](_0x21b523)[_0xc901('0x1d')](handleEntityNotFound(_0x87977b,null))['then'](respondWithResult(_0x87977b,null))[_0xc901('0x28')](handleError(_0x87977b,null));};exports[_0xc901('0x57')]=function(_0x3748c8,_0x3a1c98){return db[_0xc901('0x3c')][_0xc901('0x57')](_0x3748c8['body'],{})['then'](function(_0x264bd8){var _0x3caeb7=_0x3748c8['user'][_0xc901('0x33')]({'plain':!![]});if(!_0x3caeb7)throw new Error(_0xc901('0x58'));if(_0x3caeb7[_0xc901('0x59')]==='user'){var _0xe5687f=_0x264bd8[_0xc901('0x33')]({'plain':!![]});var _0x108546=_0xc901('0x5a');return db['UserProfileSection']['find']({'where':{'name':_0x108546,'userProfileId':_0x3caeb7[_0xc901('0x5b')]},'raw':!![]})[_0xc901('0x1d')](function(_0x4539e1){if(_0x4539e1&&_0x4539e1[_0xc901('0x5c')]===0x0){return db[_0xc901('0x34')][_0xc901('0x57')]({'name':_0xe5687f[_0xc901('0x36')],'resourceId':_0xe5687f['id'],'type':_0x4539e1['name'],'sectionId':_0x4539e1['id']},{})['then'](function(){return _0x264bd8;});}else{return _0x264bd8;}})['catch'](function(_0x360477){logger[_0xc901('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x360477);throw _0x360477;});}return _0x264bd8;})[_0xc901('0x1d')](respondWithResult(_0x3a1c98,0xc9))['catch'](handleError(_0x3a1c98,null));};exports['update']=function(_0x4133d3,_0x17f8bf){if(_0x4133d3[_0xc901('0x5d')]['id']){delete _0x4133d3[_0xc901('0x5d')]['id'];}return db[_0xc901('0x3c')][_0xc901('0x56')]({'where':{'id':_0x4133d3[_0xc901('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0xc901('0x3a')}]})[_0xc901('0x1d')](handleEntityNotFound(_0x17f8bf,null))['then'](saveUpdates(_0x4133d3[_0xc901('0x5d')],null))[_0xc901('0x1d')](respondWithResult(_0x17f8bf,null))['catch'](handleError(_0x17f8bf,null));};exports[_0xc901('0x32')]=function(_0x48571b,_0x5801c4){return db[_0xc901('0x3c')][_0xc901('0x56')]({'where':{'id':_0x48571b[_0xc901('0x55')]['id']}})[_0xc901('0x1d')](handleEntityNotFound(_0x5801c4,null))['then'](removeEntity(_0x5801c4,null))[_0xc901('0x28')](handleError(_0x5801c4,null));};exports['describe']=function(_0x8960f3,_0x1a2dab){return db[_0xc901('0x3c')][_0xc901('0x5e')]()[_0xc901('0x1d')](respondWithResult(_0x1a2dab,null))['catch'](handleError(_0x1a2dab,null));};exports[_0xc901('0x5f')]=function(_0x3ec5db,_0x3dfc58,_0x37f2c1){if(_0x3ec5db[_0xc901('0x5d')]['id']){delete _0x3ec5db[_0xc901('0x5d')]['id'];}return db['OpenchannelAccount'][_0xc901('0x56')]({'where':{'id':_0x3ec5db[_0xc901('0x55')]['id']}})[_0xc901('0x1d')](handleEntityNotFound(_0x3dfc58,null))[_0xc901('0x1d')](function(_0x408f3f){if(_0x408f3f){_0x3ec5db[_0xc901('0x5d')]['OpenchannelAccountId']=_0x408f3f['id'];return db[_0xc901('0x60')][_0xc901('0x57')](_0x3ec5db['body']);}})[_0xc901('0x1d')](respondWithResult(_0x3dfc58,null))[_0xc901('0x28')](handleError(_0x3dfc58,null));};exports['getDispositions']=function(_0x451a8e,_0x4ef388,_0x3b673c){var _0x5d8b41={'raw':![],'where':{}};var _0x2d7931={};var _0x41173d={'count':0x0,'rows':[]};return db[_0xc901('0x3c')][_0xc901('0x61')]({'where':{'id':_0x451a8e[_0xc901('0x55')]['id']}})[_0xc901('0x1d')](handleEntityNotFound(_0x4ef388,null))['then'](function(_0x5bfa30){if(_0x5bfa30){_0x2d7931['model']=_[_0xc901('0x40')](db[_0xc901('0x60')][_0xc901('0x3d')]);_0x2d7931[_0xc901('0x3f')]=_[_0xc901('0x40')](_0x451a8e['query']);_0x2d7931['filters']=_[_0xc901('0x41')](_0x2d7931[_0xc901('0x3e')],_0x2d7931[_0xc901('0x3f')]);_0x5d8b41[_0xc901('0x42')]=_['intersection'](_0x2d7931[_0xc901('0x3e')],qs[_0xc901('0x43')](_0x451a8e[_0xc901('0x3f')][_0xc901('0x43')]));_0x5d8b41['attributes']=_0x5d8b41[_0xc901('0x42')][_0xc901('0x44')]?_0x5d8b41[_0xc901('0x42')]:_0x2d7931['model'];if(!_0x451a8e[_0xc901('0x3f')][_0xc901('0x45')]('nolimit')){_0x5d8b41[_0xc901('0x2d')]=qs[_0xc901('0x2d')](_0x451a8e['query'][_0xc901('0x2d')]);_0x5d8b41[_0xc901('0x2c')]=qs[_0xc901('0x2c')](_0x451a8e['query'][_0xc901('0x2c')]);}_0x5d8b41[_0xc901('0x47')]=qs[_0xc901('0x48')](_0x451a8e[_0xc901('0x3f')]['sort']);_0x5d8b41['where']=qs[_0xc901('0x4a')](_[_0xc901('0x4b')](_0x451a8e[_0xc901('0x3f')],_0x2d7931[_0xc901('0x4a')]));_0x5d8b41[_0xc901('0x49')][_0xc901('0x62')]=_0x5bfa30['id'];if(_0x451a8e[_0xc901('0x3f')]['filter']){_0x5d8b41[_0xc901('0x49')]=_['merge'](_0x5d8b41[_0xc901('0x49')],{'$or':_[_0xc901('0x3b')](_0x5d8b41[_0xc901('0x42')],function(_0x58daa1){var _0x3e18ba={};_0x3e18ba[_0x58daa1]={'$like':'%'+_0x451a8e[_0xc901('0x3f')][_0xc901('0x4c')]+'%'};return _0x3e18ba;})});}_0x5d8b41=_['merge']({},_0x5d8b41,_0x451a8e['options']);return db[_0xc901('0x60')]['count']({'where':_0x5d8b41[_0xc901('0x49')]})['then'](function(_0x3f9d18){_0x41173d[_0xc901('0x2e')]=_0x3f9d18;if(_0x451a8e[_0xc901('0x3f')][_0xc901('0x51')]){_0x5d8b41[_0xc901('0x52')]=[{'all':!![]}];}return db[_0xc901('0x60')][_0xc901('0x53')](_0x5d8b41);})[_0xc901('0x1d')](function(_0x1f7988){_0x41173d[_0xc901('0x63')]=_0x1f7988;return _0x41173d;});}})[_0xc901('0x1d')](respondWithFilteredResult(_0x4ef388,_0x5d8b41))[_0xc901('0x28')](handleError(_0x4ef388,null));};exports['removeDispositions']=function(_0x46fed4,_0xce894e,_0xdebc73){return db[_0xc901('0x3c')][_0xc901('0x56')]({'where':{'id':_0x46fed4[_0xc901('0x55')]['id']}})[_0xc901('0x1d')](handleEntityNotFound(_0xce894e,null))['then'](function(_0xa70196){if(_0xa70196){return _0xa70196[_0xc901('0x64')](_0x46fed4[_0xc901('0x3f')][_0xc901('0x65')]);}})[_0xc901('0x1d')](respondWithStatusCode(_0xce894e,null))[_0xc901('0x28')](handleError(_0xce894e,null));};exports[_0xc901('0x66')]=function(_0x26c1bd,_0x246860,_0x11a86d){if(_0x26c1bd[_0xc901('0x5d')]['id']){delete _0x26c1bd['body']['id'];}return db[_0xc901('0x3c')][_0xc901('0x56')]({'where':{'id':_0x26c1bd['params']['id']}})[_0xc901('0x1d')](handleEntityNotFound(_0x246860,null))[_0xc901('0x1d')](function(_0x31a5e1){if(_0x31a5e1){_0x26c1bd[_0xc901('0x5d')]['OpenchannelAccountId']=_0x31a5e1['id'];return db['CannedAnswer'][_0xc901('0x57')](_0x26c1bd['body']);}})[_0xc901('0x1d')](respondWithResult(_0x246860,null))[_0xc901('0x28')](handleError(_0x246860,null));};exports[_0xc901('0x67')]=function(_0x4c398b,_0x117760,_0x2f2ecf){var _0x26c98c={'raw':![],'where':{}};var _0x37a243={};var _0x584b5a={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xc901('0x61')]({'where':{'id':_0x4c398b[_0xc901('0x55')]['id']}})['then'](handleEntityNotFound(_0x117760,null))['then'](function(_0x44dc2e){if(_0x44dc2e){_0x37a243[_0xc901('0x3e')]=_[_0xc901('0x40')](db[_0xc901('0x68')][_0xc901('0x3d')]);_0x37a243[_0xc901('0x3f')]=_[_0xc901('0x40')](_0x4c398b[_0xc901('0x3f')]);_0x37a243['filters']=_[_0xc901('0x41')](_0x37a243[_0xc901('0x3e')],_0x37a243['query']);_0x26c98c[_0xc901('0x42')]=_['intersection'](_0x37a243[_0xc901('0x3e')],qs[_0xc901('0x43')](_0x4c398b['query']['fields']));_0x26c98c['attributes']=_0x26c98c['attributes'][_0xc901('0x44')]?_0x26c98c[_0xc901('0x42')]:_0x37a243[_0xc901('0x3e')];if(!_0x4c398b['query'][_0xc901('0x45')]('nolimit')){_0x26c98c[_0xc901('0x2d')]=qs[_0xc901('0x2d')](_0x4c398b[_0xc901('0x3f')]['limit']);_0x26c98c['offset']=qs[_0xc901('0x2c')](_0x4c398b['query'][_0xc901('0x2c')]);}_0x26c98c['order']=qs[_0xc901('0x48')](_0x4c398b[_0xc901('0x3f')][_0xc901('0x48')]);_0x26c98c['where']=qs[_0xc901('0x4a')](_[_0xc901('0x4b')](_0x4c398b[_0xc901('0x3f')],_0x37a243[_0xc901('0x4a')]));_0x26c98c[_0xc901('0x49')][_0xc901('0x62')]=_0x44dc2e['id'];if(_0x4c398b[_0xc901('0x3f')][_0xc901('0x4c')]){_0x26c98c[_0xc901('0x49')]=_[_0xc901('0x4d')](_0x26c98c[_0xc901('0x49')],{'$or':_['map'](_0x26c98c[_0xc901('0x42')],function(_0x4056dc){var _0x254e22={};_0x254e22[_0x4056dc]={'$like':'%'+_0x4c398b['query'][_0xc901('0x4c')]+'%'};return _0x254e22;})});}_0x26c98c=_[_0xc901('0x4d')]({},_0x26c98c,_0x4c398b[_0xc901('0x50')]);return db[_0xc901('0x68')][_0xc901('0x2e')]({'where':_0x26c98c['where']})['then'](function(_0x30aa97){_0x584b5a[_0xc901('0x2e')]=_0x30aa97;if(_0x4c398b[_0xc901('0x3f')][_0xc901('0x51')]){_0x26c98c[_0xc901('0x52')]=[{'all':!![]}];}return db[_0xc901('0x68')][_0xc901('0x53')](_0x26c98c);})[_0xc901('0x1d')](function(_0x27797a){_0x584b5a[_0xc901('0x63')]=_0x27797a;return _0x584b5a;});}})[_0xc901('0x1d')](respondWithFilteredResult(_0x117760,_0x26c98c))[_0xc901('0x28')](handleError(_0x117760,null));};exports[_0xc901('0x69')]=function(_0x37eb0e,_0x43f3b8,_0x2be99c){return db[_0xc901('0x3c')][_0xc901('0x56')]({'where':{'id':_0x37eb0e[_0xc901('0x55')]['id']}})[_0xc901('0x1d')](handleEntityNotFound(_0x43f3b8,null))['then'](function(_0x201b27){if(_0x201b27){return _0x201b27[_0xc901('0x69')](_0x37eb0e[_0xc901('0x3f')][_0xc901('0x65')]);}})[_0xc901('0x1d')](respondWithStatusCode(_0x43f3b8,null))[_0xc901('0x28')](handleError(_0x43f3b8,null));};exports[_0xc901('0x6a')]=function(_0x417702,_0x281889,_0xf5de02){var _0x4dc9c5={'body':_0x417702[_0xc901('0x5d')],'channel':_0xc901('0x6b')};var _0x2f68ad=[];var _0x37c3e8=[];var _0x4865fb={};var _0x540747=![];return db[_0xc901('0x6c')][_0xc901('0x5e')]()[_0xc901('0x1d')](function(_0x310813){if(!_0x310813){throw new db['Sequelize'][(_0xc901('0x6d'))](_0xc901('0x6e'));}_0x2f68ad=_['difference'](_[_0xc901('0x40')](_0x310813),['createdAt','updatedAt']);_0x37c3e8=_[_0xc901('0x6f')](_['keys'](_0x310813),[_0xc901('0x70'),_0xc901('0x71'),'CompanyId','ListId']);if(_0x417702['body']['id']){delete _0x417702[_0xc901('0x5d')]['id'];}if(_['isNil'](_0x417702[_0xc901('0x5d')][_0xc901('0x72')])){throw new db[(_0xc901('0x73'))][(_0xc901('0x6d'))](_0xc901('0x74'));}if(_[_0xc901('0x75')](_0x417702['body'][_0xc901('0x5d')])||_0x417702[_0xc901('0x5d')][_0xc901('0x5d')]===''){throw new db[(_0xc901('0x73'))][(_0xc901('0x6d'))](_0xc901('0x76'));}if(_[_0xc901('0x75')](_0x417702['body'][_0xc901('0x77')])){throw new db[(_0xc901('0x73'))][(_0xc901('0x6d'))](_0xc901('0x78')+_0x37c3e8);}if(!_[_0xc901('0x79')](_0x37c3e8,_0x417702[_0xc901('0x5d')][_0xc901('0x77')])){throw new db[(_0xc901('0x73'))][(_0xc901('0x6d'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x37c3e8);}_0x4865fb[_0x417702['body']['mapKey']]=_0x417702[_0xc901('0x5d')][_0xc901('0x72')];})[_0xc901('0x1d')](function(){return db['OpenchannelAccount'][_0xc901('0x56')]({'where':{'id':_0x417702['params']['id']},'include':[{'model':db[_0xc901('0x7a')],'as':'List','include':[{'model':db[_0xc901('0x6c')],'as':_0xc901('0x7b'),'where':_0x4865fb,'limit':0x1,'order':[[_0xc901('0x71'),'DESC']]}]},{'model':db[_0xc901('0x7c')],'as':'Applications'}]});})[_0xc901('0x1d')](handleEntityNotFound(_0x281889,null))[_0xc901('0x1d')](function(_0xc8da){if(_0xc8da&&_0xc8da['List']){_0x4dc9c5[_0xc901('0x7d')]=_0xc8da;_0x4dc9c5[_0xc901('0x7e')]=_0xc8da[_0xc901('0x7f')];_0x4dc9c5['list']=_0xc8da[_0xc901('0x80')];_0x4dc9c5[_0xc901('0x7e')]=_[_0xc901('0x81')](_0x4dc9c5[_0xc901('0x7e')],[_0xc901('0x82')],[_0xc901('0x83')]);if(_0x4dc9c5[_0xc901('0x7d')][_0xc901('0x7f')]){delete _0x4dc9c5[_0xc901('0x7d')]['Applications'];}if(_0x4dc9c5[_0xc901('0x7d')][_0xc901('0x80')]&&_0x4dc9c5[_0xc901('0x7d')][_0xc901('0x80')]['Contacts'][_0xc901('0x44')]){return _0x4dc9c5['account'][_0xc901('0x80')][_0xc901('0x7b')][0x0];}var _0xf83cb4=_[_0xc901('0x17')](_0x417702[_0xc901('0x5d')],{'firstName':_0x417702['body'][_0xc901('0x72')],'ListId':_0xc8da['ListId']});_0xf83cb4[_0x417702[_0xc901('0x5d')]['mapKey']]=_0x417702[_0xc901('0x5d')][_0xc901('0x72')];return db[_0xc901('0x6c')]['create'](_0xf83cb4,{'fields':_0x2f68ad,'raw':!![]});}})['then'](handleEntityNotFound(_0x281889,null))[_0xc901('0x1d')](function(_0x3e5d6c){_0x4dc9c5['contact']=_0x3e5d6c;if(_0x3e5d6c){var _0x31a45f={'ContactId':_0x3e5d6c['id'],'OpenchannelAccountId':_0x417702[_0xc901('0x55')]['id'],'from':(_0x3e5d6c[_0xc901('0x84')]||'')+'\x20'+(_0x3e5d6c['lastName']||'')};var _0x34a574={'OpenchannelAccountId':_0x417702[_0xc901('0x55')]['id'],'closed':![]};if(_0x417702[_0xc901('0x5d')][_0xc901('0x85')]){_0x34a574[_0xc901('0x85')]=_0x417702[_0xc901('0x5d')]['threadId'];return db[_0xc901('0x86')][_0xc901('0x56')]({'where':_0x34a574})[_0xc901('0x1d')](function(_0x1e49b1){if(_0x1e49b1){return[_0x1e49b1,![]];}_0x31a45f[_0xc901('0x85')]=_0x417702[_0xc901('0x5d')][_0xc901('0x85')];_0x31a45f[_0xc901('0x87')]=_0x417702[_0xc901('0x5d')]['externalUrl'];return db[_0xc901('0x86')]['create'](_0x31a45f)['then'](function(_0x3ff005){return[_0x3ff005,!![]];});});}else{_0x34a574[_0xc901('0x85')]=null;}_0x34a574[_0xc901('0x88')]=_0x3e5d6c['id'];return db['OpenchannelInteraction'][_0xc901('0x56')]({'where':_0x34a574})[_0xc901('0x1d')](function(_0x43aed5){if(_0x43aed5){return[_0x43aed5,![]];}return db[_0xc901('0x86')]['create'](_0x31a45f)[_0xc901('0x1d')](function(_0x12fd50){return[_0x12fd50,!![]];});});}})[_0xc901('0x89')](function(_0x51e143,_0x52a789){if(_0x51e143){_0x540747=_0x52a789;if(!_0x52a789){var _0x6368f4={'from':(_0x4dc9c5['contact']['firstName']||'')+'\x20'+(_0x4dc9c5[_0xc901('0x8a')][_0xc901('0x8b')]||'')};if(_0x417702[_0xc901('0x5d')][_0xc901('0x85')]&&_0x417702[_0xc901('0x5d')]['messageId']&&_0x417702['body'][_0xc901('0x85')]!=_0x417702[_0xc901('0x5d')][_0xc901('0x8c')]){_0x6368f4[_0xc901('0x85')]=_0x417702[_0xc901('0x5d')][_0xc901('0x8c')];}return _0x51e143['update'](_0x6368f4);}else{return _0x51e143;}}})[_0xc901('0x1d')](function(_0x41c0df){_0x4dc9c5['interaction']=_0x41c0df[_0xc901('0x33')]({'plain':!![]});_0x4dc9c5[_0xc901('0x8d')]['created']=_0x540747;if(_0x4dc9c5['interaction'][_0xc901('0x8e')]){if(_0x4dc9c5[_0xc901('0x7d')][_0xc901('0x8f')]){_0x4dc9c5[_0xc901('0x7e')][_0xc901('0x90')]({'id':0x0,'priority':_0x4dc9c5['applications']['length']+0x1,'app':'close','appdata':_0xc901('0x91'),'interval':_0xc901('0x92')});}}return db[_0xc901('0x93')][_0xc901('0x57')]({'body':_0x417702[_0xc901('0x5d')][_0xc901('0x5d')],'OpenchannelAccountId':_0x417702['params']['id'],'OpenchannelInteractionId':_0x41c0df['id'],'direction':'in','ContactId':_0x4dc9c5[_0xc901('0x8a')]['id'],'AttachmentId':_0x417702['body'][_0xc901('0x94')]});})['then'](function(_0x2a6840){_0x4dc9c5[_0xc901('0x25')]=_0x2a6840;if(_0x4dc9c5['interaction'][_0xc901('0x95')]){return db[_0xc901('0x96')][_0xc901('0x56')]({'attributes':['id','name'],'where':{'id':_0x4dc9c5[_0xc901('0x8d')][_0xc901('0x95')]}})[_0xc901('0x1d')](function(_0x4e2ca9){if(_0x4e2ca9){_0x4dc9c5[_0xc901('0x7e')][_0xc901('0x97')]({'id':0x0,'priority':0x0,'app':_0xc901('0x98'),'appdata':_0x4e2ca9['name']+','+(_0x4dc9c5[_0xc901('0x7d')]['waitForTheAssignedAgent']||0xa),'interval':_0xc901('0x92')});_0x4dc9c5[_0xc901('0x99')]=![];}return respondWithRpcPromise('Start',_0xc901('0x9a'),_0x4dc9c5);});}return respondWithRpcPromise('Start',_0xc901('0x9a'),_0x4dc9c5);})[_0xc901('0x1d')](function(_0x43b18e){respondWithRpcPromise(_0xc901('0x9b'),_0xc901('0x9b'),{'event':_0xc901('0x6a'),'message':_0x43b18e},client9002);return _0x43b18e;})[_0xc901('0x1d')](respondWithResult(_0x281889,null))[_0xc901('0x28')](handleError(_0x281889,null));};exports[_0xc901('0x9c')]=function(_0x151256,_0x55f5aa,_0x289760){return db[_0xc901('0x3c')]['findOne']({'where':{'id':_0x151256['params']['id']}})[_0xc901('0x1d')](handleEntityNotFound(_0x55f5aa,null))[_0xc901('0x1d')](function(_0x2c25df){if(_0x2c25df){return db[_0xc901('0x9d')]['transaction'](function(_0x1af8a5){return db[_0xc901('0x7c')][_0xc901('0x32')]({'where':{'OpenchannelAccountId':_0x151256[_0xc901('0x55')]['id']},'transaction':_0x1af8a5})['then'](function(_0x5c4e7b){var _0x5c3817=_['map'](_0x151256[_0xc901('0x5d')],function(_0x225e47){_0x225e47[_0xc901('0x62')]=_0x151256[_0xc901('0x55')]['id'];return _0x225e47;});return db[_0xc901('0x7c')]['bulkCreate'](_0x5c3817,{'transaction':_0x1af8a5});});})[_0xc901('0x1d')](function(){return db[_0xc901('0x7c')][_0xc901('0x9e')]({'where':{'OpenchannelAccountId':_0x151256[_0xc901('0x55')]['id']},'order':_0xc901('0x82')});});}})['then'](respondWithResult(_0x55f5aa,null))[_0xc901('0x28')](handleError(_0x55f5aa,null));};exports[_0xc901('0x9f')]=function(_0x3bdc55,_0x4e3a69,_0x383cdd){var _0x389c72={};var _0x1c054d={};var _0x213614;var _0x34b6ee;return db[_0xc901('0x3c')][_0xc901('0x61')]({'where':{'id':_0x3bdc55['params']['id']}})[_0xc901('0x1d')](handleEntityNotFound(_0x4e3a69,null))['then'](function(_0xe2e106){if(_0xe2e106){_0x213614=_0xe2e106;_0x1c054d[_0xc901('0x3e')]=_['keys'](db['OpenchannelApplication'][_0xc901('0x3d')]);_0x1c054d['query']=_[_0xc901('0x40')](_0x3bdc55[_0xc901('0x3f')]);_0x1c054d[_0xc901('0x4a')]=_[_0xc901('0x41')](_0x1c054d[_0xc901('0x3e')],_0x1c054d[_0xc901('0x3f')]);_0x389c72[_0xc901('0x42')]=_[_0xc901('0x41')](_0x1c054d[_0xc901('0x3e')],qs[_0xc901('0x43')](_0x3bdc55[_0xc901('0x3f')][_0xc901('0x43')]));_0x389c72[_0xc901('0x42')]=_0x389c72[_0xc901('0x42')][_0xc901('0x44')]?_0x389c72[_0xc901('0x42')]:_0x1c054d[_0xc901('0x3e')];_0x389c72['order']=qs[_0xc901('0x48')](_0x3bdc55['query'][_0xc901('0x48')]);_0x389c72[_0xc901('0x49')]=qs[_0xc901('0x4a')](_[_0xc901('0x4b')](_0x3bdc55[_0xc901('0x3f')],_0x1c054d[_0xc901('0x4a')]));if(_0x3bdc55[_0xc901('0x3f')]['filter']){_0x389c72[_0xc901('0x49')]=_[_0xc901('0x4d')](_0x389c72[_0xc901('0x49')],{'$or':_[_0xc901('0x3b')](_0x389c72[_0xc901('0x42')],function(_0x5ae335){var _0x97fe12={};_0x97fe12[_0x5ae335]={'$like':'%'+_0x3bdc55[_0xc901('0x3f')][_0xc901('0x4c')]+'%'};return _0x97fe12;})});}_0x389c72=_[_0xc901('0x4d')]({},_0x389c72,_0x3bdc55[_0xc901('0x50')]);return _0x213614[_0xc901('0x9f')](_0x389c72);}})[_0xc901('0x1d')](function(_0x5db996){if(_0x5db996){_0x34b6ee=_0x5db996[_0xc901('0x44')];if(!_0x3bdc55[_0xc901('0x3f')][_0xc901('0x45')](_0xc901('0x46'))){_0x389c72['limit']=qs['limit'](_0x3bdc55['query'][_0xc901('0x2d')]);_0x389c72[_0xc901('0x2c')]=qs[_0xc901('0x2c')](_0x3bdc55[_0xc901('0x3f')][_0xc901('0x2c')]);}return _0x213614[_0xc901('0x9f')](_0x389c72);}})['then'](function(_0x163ed9){if(_0x163ed9){return _0x163ed9?{'count':_0x34b6ee,'rows':_0x163ed9}:null;}})['then'](respondWithResult(_0x4e3a69,null))[_0xc901('0x28')](handleError(_0x4e3a69,null));};exports['getInteractions']=function(_0x4f7ac2,_0x1fd107,_0x598cbb){var _0x58ce66={'raw':![],'where':{}};var _0x1468db={};var _0x39eca1={'count':0x0,'rows':[]};return db[_0xc901('0x3c')]['findOne']({'where':{'id':_0x4f7ac2[_0xc901('0x55')]['id']}})['then'](handleEntityNotFound(_0x1fd107,null))[_0xc901('0x1d')](function(_0x2593a0){if(_0x2593a0){_0x1468db['model']=_[_0xc901('0x40')](db[_0xc901('0x86')][_0xc901('0x3d')]);_0x1468db['query']=_[_0xc901('0x40')](_0x4f7ac2['query']);_0x1468db[_0xc901('0x4a')]=_[_0xc901('0x41')](_0x1468db[_0xc901('0x3e')],_0x1468db['query']);_0x58ce66[_0xc901('0x42')]=_[_0xc901('0x41')](_0x1468db[_0xc901('0x3e')],qs[_0xc901('0x43')](_0x4f7ac2['query'][_0xc901('0x43')]));_0x58ce66[_0xc901('0x42')]=_0x58ce66['attributes']['length']?_0x58ce66[_0xc901('0x42')]:_0x1468db[_0xc901('0x3e')];if(!_0x4f7ac2[_0xc901('0x3f')][_0xc901('0x45')](_0xc901('0x46'))){_0x58ce66[_0xc901('0x2d')]=qs[_0xc901('0x2d')](_0x4f7ac2['query']['limit']);_0x58ce66[_0xc901('0x2c')]=qs['offset'](_0x4f7ac2[_0xc901('0x3f')]['offset']);}_0x58ce66[_0xc901('0x47')]=qs[_0xc901('0x48')](_0x4f7ac2[_0xc901('0x3f')][_0xc901('0x48')]);_0x58ce66['where']=qs[_0xc901('0x4a')](_[_0xc901('0x4b')](_0x4f7ac2[_0xc901('0x3f')],_0x1468db[_0xc901('0x4a')]));_0x58ce66[_0xc901('0x49')][_0xc901('0x62')]=_0x2593a0['id'];if(_0x4f7ac2[_0xc901('0x3f')][_0xc901('0x4c')]){_0x58ce66['where']=_['merge'](_0x58ce66[_0xc901('0x49')],{'$or':_['map'](_0x58ce66[_0xc901('0x42')],function(_0x3bfb21){var _0x8656e4={};_0x8656e4[_0x3bfb21]={'$like':'%'+_0x4f7ac2['query']['filter']+'%'};return _0x8656e4;})});}_0x58ce66=_[_0xc901('0x4d')]({},_0x58ce66,_0x4f7ac2[_0xc901('0x50')]);return db['OpenchannelInteraction'][_0xc901('0x2e')]({'where':_0x58ce66[_0xc901('0x49')]})['then'](function(_0x3fdd57){_0x39eca1[_0xc901('0x2e')]=_0x3fdd57;if(_0x4f7ac2['query'][_0xc901('0x51')]){_0x58ce66[_0xc901('0x52')]=[{'model':db['CmContact'],'as':_0xc901('0xa0'),'required':![]},{'model':db[_0xc901('0x96')],'as':_0xc901('0xa1'),'attributes':[_0xc901('0x36'),_0xc901('0xa2'),_0xc901('0xa3')],'required':![]},{'model':db[_0xc901('0xa4')],'as':_0xc901('0xa5'),'attributes':['id',_0xc901('0x36'),_0xc901('0xa6')],'where':_0x4f7ac2[_0xc901('0x3f')][_0xc901('0xa7')]?{'id':_0x4f7ac2[_0xc901('0x3f')][_0xc901('0xa7')]}:undefined,'required':_0x4f7ac2['query']['tag']?!![]:![]}];}return db[_0xc901('0x86')][_0xc901('0x53')](_0x58ce66);})[_0xc901('0x1d')](function(_0x37d01f){_0x39eca1[_0xc901('0x63')]=_0x37d01f;return _0x39eca1;});}})[_0xc901('0x1d')](respondWithFilteredResult(_0x1fd107,_0x58ce66))['catch'](handleError(_0x1fd107,null));};exports[_0xc901('0xa8')]=function(_0x365eac,_0x51339e,_0x564a5c){return db[_0xc901('0x3c')]['find']({'where':{'id':_0x365eac[_0xc901('0x55')]['id']}})['then'](handleEntityNotFound(_0x51339e,null))[_0xc901('0x1d')](function(_0x22e49a){if(_0x22e49a){return _0x22e49a[_0xc901('0xa8')](_0x365eac[_0xc901('0x5d')][_0xc901('0x65')],_[_0xc901('0xa9')](_0x365eac['body'],[_0xc901('0x65'),'id'])||{})[_0xc901('0x89')](function(_0x492958){for(var _0x3b8791=0x0;_0x3b8791<_0x365eac[_0xc901('0x5d')]['ids']['length'];_0x3b8791+=0x1){socket['emit']('userOpenchannelAccount:save',{'UserId':Number(_0x365eac[_0xc901('0x5d')][_0xc901('0x65')][_0x3b8791]),'OpenchannelAccountId':Number(_0x365eac['params']['id'])});}return _0x492958;});}})[_0xc901('0x1d')](respondWithResult(_0x51339e,null))[_0xc901('0x28')](handleError(_0x51339e,null));};exports[_0xc901('0xaa')]=function(_0x27aaf0,_0x3475f2,_0x462fd9){return db[_0xc901('0x3c')][_0xc901('0x56')]({'where':{'id':_0x27aaf0[_0xc901('0x55')]['id']}})[_0xc901('0x1d')](handleEntityNotFound(_0x3475f2,null))[_0xc901('0x1d')](function(_0x4cb514){if(_0x4cb514){return _0x4cb514[_0xc901('0xaa')](_0x27aaf0[_0xc901('0x3f')][_0xc901('0x65')])['then'](function(){if(_[_0xc901('0xab')](_0x27aaf0[_0xc901('0x3f')]['ids'])){for(var _0x4a56e7=0x0;_0x4a56e7<_0x27aaf0[_0xc901('0x3f')]['ids'][_0xc901('0x44')];_0x4a56e7+=0x1){socket['emit'](_0xc901('0xac'),{'UserId':Number(_0x27aaf0['query'][_0xc901('0x65')][_0x4a56e7]),'OpenchannelAccountId':Number(_0x27aaf0[_0xc901('0x55')]['id'])});}}else{socket[_0xc901('0xad')](_0xc901('0xac'),{'UserId':Number(_0x27aaf0[_0xc901('0x3f')][_0xc901('0x65')]),'OpenchannelAccountId':Number(_0x27aaf0['params']['id'])});}});}})[_0xc901('0x1d')](respondWithStatusCode(_0x3475f2,null))[_0xc901('0x28')](handleError(_0x3475f2,null));};exports['getAgents']=function(_0x602bce,_0x248e68,_0x3dc3a9){var _0x5a5857={};var _0x37d6f1={};var _0x4eafb1;var _0x7d0523;return db[_0xc901('0x3c')]['findOne']({'where':{'id':_0x602bce['params']['id']}})['then'](handleEntityNotFound(_0x248e68,null))[_0xc901('0x1d')](function(_0x38b3c6){if(_0x38b3c6){_0x4eafb1=_0x38b3c6;_0x37d6f1[_0xc901('0x3e')]=_[_0xc901('0x40')](db[_0xc901('0x96')][_0xc901('0x3d')]);_0x37d6f1[_0xc901('0x3f')]=_[_0xc901('0x40')](_0x602bce[_0xc901('0x3f')]);_0x37d6f1['filters']=_[_0xc901('0x41')](_0x37d6f1[_0xc901('0x3e')],_0x37d6f1[_0xc901('0x3f')]);_0x5a5857['attributes']=_[_0xc901('0x41')](_0x37d6f1[_0xc901('0x3e')],qs[_0xc901('0x43')](_0x602bce[_0xc901('0x3f')][_0xc901('0x43')]));_0x5a5857['attributes']=_0x5a5857[_0xc901('0x42')]['length']?_0x5a5857['attributes']:_0x37d6f1[_0xc901('0x3e')];_0x5a5857['order']=qs[_0xc901('0x48')](_0x602bce['query'][_0xc901('0x48')]);_0x5a5857['where']=qs[_0xc901('0x4a')](_[_0xc901('0x4b')](_0x602bce[_0xc901('0x3f')],_0x37d6f1[_0xc901('0x4a')]));if(_0x602bce['query'][_0xc901('0x4c')]){_0x5a5857['where']=_[_0xc901('0x4d')](_0x5a5857['where'],{'$or':_[_0xc901('0x3b')](_0x5a5857[_0xc901('0x42')],function(_0x2f9b41){var _0x1fffe3={};_0x1fffe3[_0x2f9b41]={'$like':'%'+_0x602bce['query'][_0xc901('0x4c')]+'%'};return _0x1fffe3;})});}_0x5a5857=_[_0xc901('0x4d')]({},_0x5a5857,_0x602bce[_0xc901('0x50')]);return _0x4eafb1[_0xc901('0xae')](_0x5a5857);}})[_0xc901('0x1d')](function(_0x46fec6){if(_0x46fec6){_0x7d0523=_0x46fec6['length'];if(!_0x602bce[_0xc901('0x3f')][_0xc901('0x45')](_0xc901('0x46'))){_0x5a5857[_0xc901('0x2d')]=qs[_0xc901('0x2d')](_0x602bce['query'][_0xc901('0x2d')]);_0x5a5857['offset']=qs[_0xc901('0x2c')](_0x602bce[_0xc901('0x3f')][_0xc901('0x2c')]);}return _0x4eafb1[_0xc901('0xae')](_0x5a5857);}})[_0xc901('0x1d')](function(_0x457ea1){if(_0x457ea1){return _0x457ea1?{'count':_0x7d0523,'rows':_0x457ea1}:null;}})[_0xc901('0x1d')](respondWithResult(_0x248e68,null))[_0xc901('0x28')](handleError(_0x248e68,null));};exports[_0xc901('0x37')]=function(_0x48b2aa,_0x37b192,_0x560abc){var _0x5b6823,_0x4400ef,_0x1eca58;if(_[_0xc901('0x75')](_0x48b2aa[_0xc901('0x5d')]['body'])||_0x48b2aa[_0xc901('0x5d')]['body']===''){throw new db['Sequelize'][(_0xc901('0x6d'))](_0xc901('0x76'));}if(_['isNil'](_0x48b2aa[_0xc901('0x5d')]['to'])){}_0x5b6823=_0x48b2aa['body']['to'];return db[_0xc901('0x3c')][_0xc901('0x61')]({'where':{'id':_0x48b2aa[_0xc901('0x55')]['id']}})[_0xc901('0x1d')](handleEntityNotFound(_0x37b192,null))[_0xc901('0x1d')](function(_0x3f4378){if(_0x3f4378){return db[_0xc901('0x3c')][_0xc901('0x56')]({'where':{'id':_0x3f4378['id']},'include':[{'model':db[_0xc901('0x7a')],'as':_0xc901('0x80'),'include':[{'model':db[_0xc901('0x6c')],'as':'Contacts','where':{[_0x3f4378['mapKey']]:_0x5b6823},'limit':0x1,'order':[[_0xc901('0x71'),_0xc901('0xaf')]]}]}]})['then'](handleEntityNotFound(_0x37b192,null))['then'](function(_0x290218){if(_0x290218&&_0x290218[_0xc901('0x80')]){_0x4400ef=_0x290218[_0xc901('0x33')]({'plain':!![]});if(_0x4400ef['List']&&_0x4400ef['List']['Contacts']['length']){return _0x4400ef[_0xc901('0x80')]['Contacts'][0x0];}return db['CmContact']['create'](_[_0xc901('0x17')](_0x48b2aa[_0xc901('0x5d')],{'firstName':_0x5b6823,[_0x290218[_0xc901('0x77')]]:_0x5b6823,'phone':_0x5b6823,'ListId':_0x4400ef[_0xc901('0xb0')]}));}})['then'](handleEntityNotFound(_0x37b192,null))['then'](function(_0x251ac6){if(_0x251ac6){_0x1eca58=_0x251ac6;return db[_0xc901('0x86')]['find']({'where':{'ContactId':_0x1eca58['id'],'closed':![],'OpenchannelAccountId':_0x4400ef['id']}})['then'](function(_0x659752){if(_0x659752){return[_0x659752,![]];}return db['OpenchannelInteraction'][_0xc901('0x57')]({'UserId':_0x48b2aa['user']['id'],'ContactId':_0x1eca58['id'],'OpenchannelAccountId':_0x4400ef['id'],'lastMsgDirection':_0xc901('0xb1'),'Messages':[_[_0xc901('0x4d')](_0x48b2aa['body'],{'read':![],'body':_0x48b2aa[_0xc901('0x5d')][_0xc901('0x5d')],'OpenchannelAccountId':_0x4400ef['id'],'UserId':_0x48b2aa['user']['id'],'ContactId':_0x1eca58['id']})]},{'include':[{'model':db[_0xc901('0x93')],'as':_0xc901('0xb2')}]})[_0xc901('0x1d')](function(_0x3be65c){return[_0x3be65c,!![]];});});}})[_0xc901('0x89')](function(_0x32d7a7,_0x5dd1c4){if(_0x5dd1c4){return _0x32d7a7;}return db[_0xc901('0x93')][_0xc901('0x57')](_['merge'](_0x48b2aa[_0xc901('0x5d')],{'read':![],'body':_0x48b2aa[_0xc901('0x5d')]['body'],'OpenchannelAccountId':_0x4400ef['id'],'OpenchannelInteractionId':_0x32d7a7['id'],'UserId':_0x48b2aa[_0xc901('0xb3')]['id'],'ContactId':_0x1eca58['id']}))['then'](function(_0xb167e3){_0x32d7a7[_0xc901('0xb4')]['Messages']=[];_0x32d7a7[_0xc901('0xb4')][_0xc901('0xb2')][_0xc901('0x90')](_0xb167e3[_0xc901('0xb4')]);return _0x32d7a7;});});}})[_0xc901('0x1d')](respondWithResult(_0x37b192,null))[_0xc901('0x28')](handleError(_0x37b192,null));}; \ No newline at end of file +var _0x5f94=['order','sort','where','pick','filter','merge','VIRTUAL','options','rows','show','params','length','includeAll','find','create','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','Disposition','getDispositions','OpenchannelAccountId','include','findAll','removeDispositions','ids','getAnswers','findOne','CannedAnswer','nolimit','removeAnswers','notify','CmContact','ValidationError','no\x20available\x20attributes','updatedAt','difference','createdAt','CompanyId','ListId','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','OpenchannelApplication','Applications','account','applications','list','List','orderBy','priority','asc','Contacts','from','contact','threadId','OpenchannelInteraction','externalUrl','ContactId','firstName','lastName','messageId','interaction','created','autoclose','push','*,*,*,*','OpenchannelMessage','AttachmentId','User','UserId','unshift','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','fullname','Tag','Tags','color','tag','addAgents','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','dataValues','Messages','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','json','limit','undefined','count','offset','status','Content-Range','apply','reject','save','update','get','OpenchannelAccounts','UserProfileResource','destroy','then','stack','name','send','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty'];(function(_0x5504a7,_0x556ca6){var _0x5c84f6=function(_0xfa1fbe){while(--_0xfa1fbe){_0x5504a7['push'](_0x5504a7['shift']());}};_0x5c84f6(++_0x556ca6);}(_0x5f94,0x1ee));var _0x45f9=function(_0x457261,_0x23ba97){_0x457261=_0x457261-0x0;var _0x339ebe=_0x5f94[_0x457261];return _0x339ebe;};'use strict';var emlformat=require(_0x45f9('0x0'));var rimraf=require(_0x45f9('0x1'));var zipdir=require(_0x45f9('0x2'));var jsonpatch=require(_0x45f9('0x3'));var rp=require('request-promise');var moment=require(_0x45f9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x45f9('0x5'));var util=require(_0x45f9('0x6'));var path=require(_0x45f9('0x7'));var sox=require(_0x45f9('0x8'));var csv=require(_0x45f9('0x9'));var ejs=require(_0x45f9('0xa'));var fs=require('fs');var fs_extra=require(_0x45f9('0xb'));var _=require(_0x45f9('0xc'));var squel=require(_0x45f9('0xd'));var crypto=require(_0x45f9('0xe'));var jsforce=require(_0x45f9('0xf'));var deskjs=require(_0x45f9('0x10'));var toCsv=require('to-csv');var querystring=require(_0x45f9('0x11'));var Papa=require(_0x45f9('0x12'));var Redis=require('ioredis');var authService=require(_0x45f9('0x13'));var qs=require(_0x45f9('0x14'));var as=require(_0x45f9('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x45f9('0x16'))('api');var utils=require(_0x45f9('0x17'));var config=require(_0x45f9('0x18'));var licenseUtil=require(_0x45f9('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x45f9('0x1a')](config[_0x45f9('0x1b')],{'host':_0x45f9('0x1c'),'port':0x18eb});var socket=require(_0x45f9('0x1d'))(new Redis(config[_0x45f9('0x1b')]));require('./openchannelAccount.socket')[_0x45f9('0x1e')](socket);var jayson=require(_0x45f9('0x1f'));var client=jayson[_0x45f9('0x20')]['http']({'port':0x232c});var client9002=jayson[_0x45f9('0x20')][_0x45f9('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x572d4a,_0x4b2c4e,_0x4ff9a5,_0x4c94fe){return new BPromise(function(_0x4ab4db,_0xb181bf){var _0x3bb3aa=_0x4c94fe||client;return _0x3bb3aa[_0x45f9('0x22')](_0x572d4a,_0x4ff9a5)['then'](function(_0x114e1b){logger[_0x45f9('0x23')](_0x45f9('0x24'),_0x4b2c4e,_0x45f9('0x25'));logger[_0x45f9('0x26')](_0x45f9('0x27'),_0x4b2c4e,_0x45f9('0x25'),JSON[_0x45f9('0x28')](_0x114e1b));if(_0x114e1b[_0x45f9('0x29')]){if(_0x114e1b[_0x45f9('0x29')]['code']===0x1f4){logger[_0x45f9('0x29')]('OpenchannelAccount,\x20%s,\x20%s',_0x4b2c4e,_0x114e1b[_0x45f9('0x29')][_0x45f9('0x2a')]);return _0xb181bf(_0x114e1b[_0x45f9('0x29')]['message']);}logger[_0x45f9('0x29')](_0x45f9('0x24'),_0x4b2c4e,_0x114e1b[_0x45f9('0x29')][_0x45f9('0x2a')]);return _0x4ab4db(_0x114e1b['error'][_0x45f9('0x2a')]);}else{logger[_0x45f9('0x23')](_0x45f9('0x24'),_0x4b2c4e,_0x45f9('0x25'));_0x4ab4db(_0x114e1b[_0x45f9('0x2b')][_0x45f9('0x2a')]);}})[_0x45f9('0x2c')](function(_0x5a0fa0){logger[_0x45f9('0x29')](_0x45f9('0x24'),_0x4b2c4e,_0x5a0fa0);_0xb181bf(_0x5a0fa0);});});}function respondWithStatusCode(_0x1079c4,_0x1bc34b){_0x1bc34b=_0x1bc34b||0xcc;return function(_0xb6851d){if(_0xb6851d){return _0x1079c4[_0x45f9('0x2d')](_0x1bc34b);}return _0x1079c4['status'](_0x1bc34b)[_0x45f9('0x2e')]();};}function respondWithResult(_0x364b2,_0x4112d4){_0x4112d4=_0x4112d4||0xc8;return function(_0x27d4eb){if(_0x27d4eb){return _0x364b2['status'](_0x4112d4)[_0x45f9('0x2f')](_0x27d4eb);}};}function respondWithFilteredResult(_0x5a01d7,_0x29a1ff){return function(_0x1fbf1b){if(_0x1fbf1b){var _0x598b16=typeof _0x29a1ff['offset']==='undefined'&&typeof _0x29a1ff[_0x45f9('0x30')]===_0x45f9('0x31');var _0x12bed8=_0x1fbf1b[_0x45f9('0x32')];var _0x4fba04=_0x598b16?0x0:_0x29a1ff[_0x45f9('0x33')];var _0x5a6d46=_0x598b16?_0x1fbf1b[_0x45f9('0x32')]:_0x29a1ff[_0x45f9('0x33')]+_0x29a1ff['limit'];var _0x5994fb;if(_0x5a6d46>=_0x12bed8){_0x5a6d46=_0x12bed8;_0x5994fb=0xc8;}else{_0x5994fb=0xce;}_0x5a01d7[_0x45f9('0x34')](_0x5994fb);return _0x5a01d7['set'](_0x45f9('0x35'),_0x4fba04+'-'+_0x5a6d46+'/'+_0x12bed8)[_0x45f9('0x2f')](_0x1fbf1b);}return null;};}function patchUpdates(_0x563021){return function(_0x1a6cff){try{jsonpatch[_0x45f9('0x36')](_0x1a6cff,_0x563021,!![]);}catch(_0x1004d2){return BPromise[_0x45f9('0x37')](_0x1004d2);}return _0x1a6cff[_0x45f9('0x38')]();};}function saveUpdates(_0x1ff14a,_0x185de1){return function(_0x4608ed){if(_0x4608ed){return _0x4608ed[_0x45f9('0x39')](_0x1ff14a)['then'](function(_0x8be80d){return _0x8be80d;});}return null;};}function removeEntity(_0x5a1903,_0x21e685){return function(_0xc1b9ca){if(_0xc1b9ca){return _0xc1b9ca['destroy']()['then'](function(){var _0x18e524=_0xc1b9ca[_0x45f9('0x3a')]({'plain':!![]});var _0x39ec4b=_0x45f9('0x3b');return db[_0x45f9('0x3c')][_0x45f9('0x3d')]({'where':{'type':_0x39ec4b,'resourceId':_0x18e524['id']}})[_0x45f9('0x3e')](function(){return _0xc1b9ca;});})[_0x45f9('0x3e')](function(){_0x5a1903[_0x45f9('0x34')](0xcc)[_0x45f9('0x2e')]();});}};}function handleEntityNotFound(_0x59fe97,_0x4783ba){return function(_0x173fc0){if(!_0x173fc0){_0x59fe97[_0x45f9('0x2d')](0x194);}return _0x173fc0;};}function handleError(_0x20413e,_0x4198c0){_0x4198c0=_0x4198c0||0x1f4;return function(_0xa7198f){logger['error'](_0xa7198f[_0x45f9('0x3f')]);if(_0xa7198f[_0x45f9('0x40')]){delete _0xa7198f['name'];}_0x20413e[_0x45f9('0x34')](_0x4198c0)[_0x45f9('0x41')](_0xa7198f);};}exports['index']=function(_0x52c501,_0x308a9d){var _0x2cfa4d={'include':[{'model':db[_0x45f9('0x42')],'as':_0x45f9('0x43')}]},_0x4ae759={},_0x5bea46={'count':0x0,'rows':[]};var _0x1282c0=_[_0x45f9('0x44')](db[_0x45f9('0x45')][_0x45f9('0x46')],function(_0x466cea){return{'name':_0x466cea[_0x45f9('0x47')],'type':_0x466cea[_0x45f9('0x48')][_0x45f9('0x49')]};});_0x4ae759[_0x45f9('0x4a')]=_[_0x45f9('0x44')](_0x1282c0,_0x45f9('0x40'));_0x4ae759[_0x45f9('0x4b')]=_[_0x45f9('0x4c')](_0x52c501[_0x45f9('0x4b')]);_0x4ae759[_0x45f9('0x4d')]=_[_0x45f9('0x4e')](_0x4ae759[_0x45f9('0x4a')],_0x4ae759[_0x45f9('0x4b')]);_0x2cfa4d['attributes']=_[_0x45f9('0x4e')](_0x4ae759[_0x45f9('0x4a')],qs[_0x45f9('0x4f')](_0x52c501['query'][_0x45f9('0x4f')]));_0x2cfa4d['attributes']=_0x2cfa4d[_0x45f9('0x50')]['length']?_0x2cfa4d[_0x45f9('0x50')]:_0x4ae759[_0x45f9('0x4a')];if(!_0x52c501['query'][_0x45f9('0x51')]('nolimit')){_0x2cfa4d[_0x45f9('0x30')]=qs[_0x45f9('0x30')](_0x52c501[_0x45f9('0x4b')][_0x45f9('0x30')]);_0x2cfa4d[_0x45f9('0x33')]=qs[_0x45f9('0x33')](_0x52c501[_0x45f9('0x4b')][_0x45f9('0x33')]);}_0x2cfa4d[_0x45f9('0x52')]=qs['sort'](_0x52c501[_0x45f9('0x4b')][_0x45f9('0x53')]);_0x2cfa4d[_0x45f9('0x54')]=qs['filters'](_[_0x45f9('0x55')](_0x52c501[_0x45f9('0x4b')],_0x4ae759['filters']),_0x1282c0);if(_0x52c501[_0x45f9('0x4b')][_0x45f9('0x56')]){_0x2cfa4d[_0x45f9('0x54')]=_[_0x45f9('0x57')](_0x2cfa4d[_0x45f9('0x54')],{'$or':_[_0x45f9('0x44')](_0x1282c0,function(_0x3c5fe8){if(_0x3c5fe8[_0x45f9('0x48')]!==_0x45f9('0x58')){var _0x37fa2a={};_0x37fa2a[_0x3c5fe8[_0x45f9('0x40')]]={'$like':'%'+_0x52c501[_0x45f9('0x4b')]['filter']+'%'};return _0x37fa2a;}})});}_0x2cfa4d=_[_0x45f9('0x57')]({},_0x2cfa4d,_0x52c501[_0x45f9('0x59')]);var _0x2e5785={'where':_0x2cfa4d[_0x45f9('0x54')]};return db[_0x45f9('0x45')][_0x45f9('0x32')](_0x2e5785)[_0x45f9('0x3e')](function(_0x258481){_0x5bea46['count']=_0x258481;if(_0x52c501[_0x45f9('0x4b')]['includeAll']){_0x2cfa4d['include']=[{'all':!![]}];}return db['OpenchannelAccount']['findAll'](_0x2cfa4d);})[_0x45f9('0x3e')](function(_0x2804a5){_0x5bea46[_0x45f9('0x5a')]=_0x2804a5;return _0x5bea46;})['then'](respondWithFilteredResult(_0x308a9d,_0x2cfa4d))[_0x45f9('0x2c')](handleError(_0x308a9d,null));};exports[_0x45f9('0x5b')]=function(_0xb91f4d,_0xac78ed){var _0x354629={'raw':![],'where':{'id':_0xb91f4d[_0x45f9('0x5c')]['id']},'include':[{'model':db['Pause'],'as':_0x45f9('0x43')}]},_0x1e946a={};_0x1e946a[_0x45f9('0x4a')]=_[_0x45f9('0x4c')](db[_0x45f9('0x45')][_0x45f9('0x46')]);_0x1e946a[_0x45f9('0x4b')]=_[_0x45f9('0x4c')](_0xb91f4d[_0x45f9('0x4b')]);_0x1e946a['filters']=_[_0x45f9('0x4e')](_0x1e946a['model'],_0x1e946a[_0x45f9('0x4b')]);_0x354629[_0x45f9('0x50')]=_[_0x45f9('0x4e')](_0x1e946a[_0x45f9('0x4a')],qs[_0x45f9('0x4f')](_0xb91f4d[_0x45f9('0x4b')][_0x45f9('0x4f')]));_0x354629[_0x45f9('0x50')]=_0x354629[_0x45f9('0x50')][_0x45f9('0x5d')]?_0x354629[_0x45f9('0x50')]:_0x1e946a[_0x45f9('0x4a')];if(_0xb91f4d[_0x45f9('0x4b')][_0x45f9('0x5e')]){_0x354629['include']=[{'all':!![]}];}_0x354629=_[_0x45f9('0x57')]({},_0x354629,_0xb91f4d[_0x45f9('0x59')]);return db['OpenchannelAccount'][_0x45f9('0x5f')](_0x354629)['then'](handleEntityNotFound(_0xac78ed,null))['then'](respondWithResult(_0xac78ed,null))[_0x45f9('0x2c')](handleError(_0xac78ed,null));};exports[_0x45f9('0x60')]=function(_0x255e3c,_0x12557e){return db[_0x45f9('0x45')][_0x45f9('0x60')](_0x255e3c['body'],{})['then'](function(_0x1085dd){var _0x23a637=_0x255e3c[_0x45f9('0x61')]['get']({'plain':!![]});if(!_0x23a637)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x23a637[_0x45f9('0x62')]===_0x45f9('0x61')){var _0x423a6d=_0x1085dd['get']({'plain':!![]});var _0x5d8bb6=_0x45f9('0x3b');return db[_0x45f9('0x63')][_0x45f9('0x5f')]({'where':{'name':_0x5d8bb6,'userProfileId':_0x23a637['userProfileId']},'raw':!![]})[_0x45f9('0x3e')](function(_0x354a5b){if(_0x354a5b&&_0x354a5b[_0x45f9('0x64')]===0x0){return db[_0x45f9('0x3c')]['create']({'name':_0x423a6d['name'],'resourceId':_0x423a6d['id'],'type':_0x354a5b[_0x45f9('0x40')],'sectionId':_0x354a5b['id']},{})['then'](function(){return _0x1085dd;});}else{return _0x1085dd;}})[_0x45f9('0x2c')](function(_0x519d21){logger[_0x45f9('0x29')](_0x45f9('0x65'),_0x519d21);throw _0x519d21;});}return _0x1085dd;})['then'](respondWithResult(_0x12557e,0xc9))['catch'](handleError(_0x12557e,null));};exports[_0x45f9('0x39')]=function(_0x40fa73,_0x26ebd4){if(_0x40fa73[_0x45f9('0x66')]['id']){delete _0x40fa73['body']['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x40fa73[_0x45f9('0x5c')]['id']},'include':[{'model':db[_0x45f9('0x42')],'as':_0x45f9('0x43')}]})['then'](handleEntityNotFound(_0x26ebd4,null))[_0x45f9('0x3e')](saveUpdates(_0x40fa73['body'],null))[_0x45f9('0x3e')](respondWithResult(_0x26ebd4,null))[_0x45f9('0x2c')](handleError(_0x26ebd4,null));};exports[_0x45f9('0x3d')]=function(_0x2119e3,_0x3c2eb1){return db[_0x45f9('0x45')]['find']({'where':{'id':_0x2119e3[_0x45f9('0x5c')]['id']}})[_0x45f9('0x3e')](handleEntityNotFound(_0x3c2eb1,null))[_0x45f9('0x3e')](removeEntity(_0x3c2eb1,null))[_0x45f9('0x2c')](handleError(_0x3c2eb1,null));};exports['describe']=function(_0x59e07e,_0x163bf4){return db[_0x45f9('0x45')][_0x45f9('0x67')]()[_0x45f9('0x3e')](respondWithResult(_0x163bf4,null))[_0x45f9('0x2c')](handleError(_0x163bf4,null));};exports[_0x45f9('0x68')]=function(_0x3d85dd,_0x343c1b,_0x140f4b){if(_0x3d85dd[_0x45f9('0x66')]['id']){delete _0x3d85dd[_0x45f9('0x66')]['id'];}return db[_0x45f9('0x45')][_0x45f9('0x5f')]({'where':{'id':_0x3d85dd['params']['id']}})[_0x45f9('0x3e')](handleEntityNotFound(_0x343c1b,null))['then'](function(_0x17b009){if(_0x17b009){_0x3d85dd[_0x45f9('0x66')]['OpenchannelAccountId']=_0x17b009['id'];return db[_0x45f9('0x69')]['create'](_0x3d85dd[_0x45f9('0x66')]);}})[_0x45f9('0x3e')](respondWithResult(_0x343c1b,null))[_0x45f9('0x2c')](handleError(_0x343c1b,null));};exports[_0x45f9('0x6a')]=function(_0x104ef5,_0x54ee20,_0x26a0ee){var _0x381d13={'raw':![],'where':{}};var _0x1a6029={};var _0x4a234a={'count':0x0,'rows':[]};return db[_0x45f9('0x45')]['findOne']({'where':{'id':_0x104ef5[_0x45f9('0x5c')]['id']}})['then'](handleEntityNotFound(_0x54ee20,null))[_0x45f9('0x3e')](function(_0x5e54d7){if(_0x5e54d7){_0x1a6029[_0x45f9('0x4a')]=_[_0x45f9('0x4c')](db[_0x45f9('0x69')]['rawAttributes']);_0x1a6029[_0x45f9('0x4b')]=_[_0x45f9('0x4c')](_0x104ef5[_0x45f9('0x4b')]);_0x1a6029[_0x45f9('0x4d')]=_[_0x45f9('0x4e')](_0x1a6029[_0x45f9('0x4a')],_0x1a6029[_0x45f9('0x4b')]);_0x381d13['attributes']=_[_0x45f9('0x4e')](_0x1a6029['model'],qs[_0x45f9('0x4f')](_0x104ef5['query'][_0x45f9('0x4f')]));_0x381d13[_0x45f9('0x50')]=_0x381d13[_0x45f9('0x50')][_0x45f9('0x5d')]?_0x381d13[_0x45f9('0x50')]:_0x1a6029['model'];if(!_0x104ef5[_0x45f9('0x4b')][_0x45f9('0x51')]('nolimit')){_0x381d13[_0x45f9('0x30')]=qs[_0x45f9('0x30')](_0x104ef5['query'][_0x45f9('0x30')]);_0x381d13[_0x45f9('0x33')]=qs[_0x45f9('0x33')](_0x104ef5['query'][_0x45f9('0x33')]);}_0x381d13[_0x45f9('0x52')]=qs[_0x45f9('0x53')](_0x104ef5[_0x45f9('0x4b')][_0x45f9('0x53')]);_0x381d13[_0x45f9('0x54')]=qs[_0x45f9('0x4d')](_[_0x45f9('0x55')](_0x104ef5[_0x45f9('0x4b')],_0x1a6029[_0x45f9('0x4d')]));_0x381d13[_0x45f9('0x54')][_0x45f9('0x6b')]=_0x5e54d7['id'];if(_0x104ef5[_0x45f9('0x4b')][_0x45f9('0x56')]){_0x381d13[_0x45f9('0x54')]=_['merge'](_0x381d13['where'],{'$or':_[_0x45f9('0x44')](_0x381d13[_0x45f9('0x50')],function(_0x489a92){var _0x45b9b9={};_0x45b9b9[_0x489a92]={'$like':'%'+_0x104ef5[_0x45f9('0x4b')][_0x45f9('0x56')]+'%'};return _0x45b9b9;})});}_0x381d13=_['merge']({},_0x381d13,_0x104ef5[_0x45f9('0x59')]);return db[_0x45f9('0x69')]['count']({'where':_0x381d13[_0x45f9('0x54')]})[_0x45f9('0x3e')](function(_0x5a886e){_0x4a234a[_0x45f9('0x32')]=_0x5a886e;if(_0x104ef5[_0x45f9('0x4b')]['includeAll']){_0x381d13[_0x45f9('0x6c')]=[{'all':!![]}];}return db[_0x45f9('0x69')][_0x45f9('0x6d')](_0x381d13);})[_0x45f9('0x3e')](function(_0xb75743){_0x4a234a[_0x45f9('0x5a')]=_0xb75743;return _0x4a234a;});}})['then'](respondWithFilteredResult(_0x54ee20,_0x381d13))['catch'](handleError(_0x54ee20,null));};exports[_0x45f9('0x6e')]=function(_0x12bd23,_0x588367,_0x3c1017){return db[_0x45f9('0x45')][_0x45f9('0x5f')]({'where':{'id':_0x12bd23[_0x45f9('0x5c')]['id']}})[_0x45f9('0x3e')](handleEntityNotFound(_0x588367,null))[_0x45f9('0x3e')](function(_0x2f656b){if(_0x2f656b){return _0x2f656b[_0x45f9('0x6e')](_0x12bd23[_0x45f9('0x4b')][_0x45f9('0x6f')]);}})['then'](respondWithStatusCode(_0x588367,null))[_0x45f9('0x2c')](handleError(_0x588367,null));};exports['addAnswer']=function(_0x12c3d3,_0x1bbd1f,_0x5eb4c9){if(_0x12c3d3['body']['id']){delete _0x12c3d3[_0x45f9('0x66')]['id'];}return db[_0x45f9('0x45')][_0x45f9('0x5f')]({'where':{'id':_0x12c3d3[_0x45f9('0x5c')]['id']}})[_0x45f9('0x3e')](handleEntityNotFound(_0x1bbd1f,null))[_0x45f9('0x3e')](function(_0x28c557){if(_0x28c557){_0x12c3d3[_0x45f9('0x66')]['OpenchannelAccountId']=_0x28c557['id'];return db['CannedAnswer'][_0x45f9('0x60')](_0x12c3d3['body']);}})[_0x45f9('0x3e')](respondWithResult(_0x1bbd1f,null))[_0x45f9('0x2c')](handleError(_0x1bbd1f,null));};exports[_0x45f9('0x70')]=function(_0x5b3d9b,_0x395bde,_0x4f8be1){var _0x20b010={'raw':![],'where':{}};var _0x2a90cb={};var _0x54529e={'count':0x0,'rows':[]};return db[_0x45f9('0x45')][_0x45f9('0x71')]({'where':{'id':_0x5b3d9b[_0x45f9('0x5c')]['id']}})[_0x45f9('0x3e')](handleEntityNotFound(_0x395bde,null))[_0x45f9('0x3e')](function(_0x534c73){if(_0x534c73){_0x2a90cb[_0x45f9('0x4a')]=_[_0x45f9('0x4c')](db[_0x45f9('0x72')][_0x45f9('0x46')]);_0x2a90cb[_0x45f9('0x4b')]=_[_0x45f9('0x4c')](_0x5b3d9b[_0x45f9('0x4b')]);_0x2a90cb[_0x45f9('0x4d')]=_[_0x45f9('0x4e')](_0x2a90cb[_0x45f9('0x4a')],_0x2a90cb[_0x45f9('0x4b')]);_0x20b010[_0x45f9('0x50')]=_[_0x45f9('0x4e')](_0x2a90cb[_0x45f9('0x4a')],qs[_0x45f9('0x4f')](_0x5b3d9b[_0x45f9('0x4b')][_0x45f9('0x4f')]));_0x20b010[_0x45f9('0x50')]=_0x20b010[_0x45f9('0x50')][_0x45f9('0x5d')]?_0x20b010[_0x45f9('0x50')]:_0x2a90cb[_0x45f9('0x4a')];if(!_0x5b3d9b['query'][_0x45f9('0x51')](_0x45f9('0x73'))){_0x20b010['limit']=qs[_0x45f9('0x30')](_0x5b3d9b[_0x45f9('0x4b')][_0x45f9('0x30')]);_0x20b010[_0x45f9('0x33')]=qs[_0x45f9('0x33')](_0x5b3d9b[_0x45f9('0x4b')][_0x45f9('0x33')]);}_0x20b010['order']=qs[_0x45f9('0x53')](_0x5b3d9b['query'][_0x45f9('0x53')]);_0x20b010[_0x45f9('0x54')]=qs[_0x45f9('0x4d')](_[_0x45f9('0x55')](_0x5b3d9b[_0x45f9('0x4b')],_0x2a90cb[_0x45f9('0x4d')]));_0x20b010['where'][_0x45f9('0x6b')]=_0x534c73['id'];if(_0x5b3d9b[_0x45f9('0x4b')][_0x45f9('0x56')]){_0x20b010[_0x45f9('0x54')]=_[_0x45f9('0x57')](_0x20b010[_0x45f9('0x54')],{'$or':_[_0x45f9('0x44')](_0x20b010['attributes'],function(_0x2334e3){var _0x3519a5={};_0x3519a5[_0x2334e3]={'$like':'%'+_0x5b3d9b[_0x45f9('0x4b')][_0x45f9('0x56')]+'%'};return _0x3519a5;})});}_0x20b010=_[_0x45f9('0x57')]({},_0x20b010,_0x5b3d9b[_0x45f9('0x59')]);return db[_0x45f9('0x72')][_0x45f9('0x32')]({'where':_0x20b010[_0x45f9('0x54')]})[_0x45f9('0x3e')](function(_0x23a0ac){_0x54529e[_0x45f9('0x32')]=_0x23a0ac;if(_0x5b3d9b[_0x45f9('0x4b')][_0x45f9('0x5e')]){_0x20b010[_0x45f9('0x6c')]=[{'all':!![]}];}return db[_0x45f9('0x72')][_0x45f9('0x6d')](_0x20b010);})[_0x45f9('0x3e')](function(_0x327517){_0x54529e['rows']=_0x327517;return _0x54529e;});}})['then'](respondWithFilteredResult(_0x395bde,_0x20b010))[_0x45f9('0x2c')](handleError(_0x395bde,null));};exports[_0x45f9('0x74')]=function(_0x58d123,_0x5f1b2f,_0x56ac86){return db[_0x45f9('0x45')]['find']({'where':{'id':_0x58d123[_0x45f9('0x5c')]['id']}})[_0x45f9('0x3e')](handleEntityNotFound(_0x5f1b2f,null))['then'](function(_0x27a09f){if(_0x27a09f){return _0x27a09f[_0x45f9('0x74')](_0x58d123[_0x45f9('0x4b')][_0x45f9('0x6f')]);}})[_0x45f9('0x3e')](respondWithStatusCode(_0x5f1b2f,null))['catch'](handleError(_0x5f1b2f,null));};exports[_0x45f9('0x75')]=function(_0x3e8e4c,_0x6e6a0f,_0x45eed0){var _0x22a736={'body':_0x3e8e4c[_0x45f9('0x66')],'channel':'openchannel'};var _0x15ebcd=[];var _0x3d5479=[];var _0x255941={};var _0x25b218=![];return db[_0x45f9('0x76')]['describe']()[_0x45f9('0x3e')](function(_0x761156){if(!_0x761156){throw new db['Sequelize'][(_0x45f9('0x77'))](_0x45f9('0x78'));}_0x15ebcd=_['difference'](_[_0x45f9('0x4c')](_0x761156),['createdAt',_0x45f9('0x79')]);_0x3d5479=_[_0x45f9('0x7a')](_[_0x45f9('0x4c')](_0x761156),[_0x45f9('0x7b'),_0x45f9('0x79'),_0x45f9('0x7c'),_0x45f9('0x7d')]);if(_0x3e8e4c[_0x45f9('0x66')]['id']){delete _0x3e8e4c[_0x45f9('0x66')]['id'];}if(_[_0x45f9('0x7e')](_0x3e8e4c[_0x45f9('0x66')]['from'])){throw new db[(_0x45f9('0x7f'))]['ValidationError'](_0x45f9('0x80'));}if(_[_0x45f9('0x7e')](_0x3e8e4c['body']['body'])||_0x3e8e4c[_0x45f9('0x66')]['body']===''){throw new db[(_0x45f9('0x7f'))][(_0x45f9('0x77'))](_0x45f9('0x81'));}if(_[_0x45f9('0x7e')](_0x3e8e4c[_0x45f9('0x66')][_0x45f9('0x82')])){throw new db[(_0x45f9('0x7f'))]['ValidationError'](_0x45f9('0x83')+_0x3d5479);}if(!_[_0x45f9('0x84')](_0x3d5479,_0x3e8e4c['body'][_0x45f9('0x82')])){throw new db[(_0x45f9('0x7f'))][(_0x45f9('0x77'))](_0x45f9('0x85')+_0x3d5479);}_0x255941[_0x3e8e4c['body'][_0x45f9('0x82')]]=_0x3e8e4c[_0x45f9('0x66')]['from'];})[_0x45f9('0x3e')](function(){return db[_0x45f9('0x45')][_0x45f9('0x5f')]({'where':{'id':_0x3e8e4c['params']['id']},'include':[{'model':db[_0x45f9('0x86')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':_0x255941,'limit':0x1,'order':[[_0x45f9('0x79'),_0x45f9('0x87')]]}]},{'model':db[_0x45f9('0x88')],'as':_0x45f9('0x89')}]});})['then'](handleEntityNotFound(_0x6e6a0f,null))[_0x45f9('0x3e')](function(_0xa6ce38){if(_0xa6ce38&&_0xa6ce38['List']){_0x22a736[_0x45f9('0x8a')]=_0xa6ce38;_0x22a736[_0x45f9('0x8b')]=_0xa6ce38[_0x45f9('0x89')];_0x22a736[_0x45f9('0x8c')]=_0xa6ce38[_0x45f9('0x8d')];_0x22a736[_0x45f9('0x8b')]=_[_0x45f9('0x8e')](_0x22a736[_0x45f9('0x8b')],[_0x45f9('0x8f')],[_0x45f9('0x90')]);if(_0x22a736[_0x45f9('0x8a')][_0x45f9('0x89')]){delete _0x22a736['account'][_0x45f9('0x89')];}if(_0x22a736[_0x45f9('0x8a')][_0x45f9('0x8d')]&&_0x22a736[_0x45f9('0x8a')][_0x45f9('0x8d')][_0x45f9('0x91')][_0x45f9('0x5d')]){return _0x22a736[_0x45f9('0x8a')][_0x45f9('0x8d')][_0x45f9('0x91')][0x0];}var _0x53e25e=_[_0x45f9('0x1a')](_0x3e8e4c['body'],{'firstName':_0x3e8e4c[_0x45f9('0x66')][_0x45f9('0x92')],'ListId':_0xa6ce38[_0x45f9('0x7d')]});_0x53e25e[_0x3e8e4c[_0x45f9('0x66')][_0x45f9('0x82')]]=_0x3e8e4c[_0x45f9('0x66')]['from'];return db[_0x45f9('0x76')][_0x45f9('0x60')](_0x53e25e,{'fields':_0x15ebcd,'raw':!![]});}})['then'](handleEntityNotFound(_0x6e6a0f,null))[_0x45f9('0x3e')](function(_0x3855e4){_0x22a736[_0x45f9('0x93')]=_0x3855e4;if(_0x3855e4){var _0x448b31={'ContactId':_0x3855e4['id'],'OpenchannelAccountId':_0x3e8e4c[_0x45f9('0x5c')]['id'],'from':(_0x3855e4['firstName']||'')+'\x20'+(_0x3855e4['lastName']||'')};var _0x5364c9={'OpenchannelAccountId':_0x3e8e4c[_0x45f9('0x5c')]['id'],'closed':![]};if(_0x3e8e4c[_0x45f9('0x66')][_0x45f9('0x94')]){_0x5364c9['threadId']=_0x3e8e4c[_0x45f9('0x66')]['threadId'];return db[_0x45f9('0x95')]['find']({'where':_0x5364c9})[_0x45f9('0x3e')](function(_0x2b15b8){if(_0x2b15b8){return[_0x2b15b8,![]];}_0x448b31['threadId']=_0x3e8e4c[_0x45f9('0x66')]['threadId'];_0x448b31[_0x45f9('0x96')]=_0x3e8e4c['body']['externalUrl'];return db['OpenchannelInteraction'][_0x45f9('0x60')](_0x448b31)[_0x45f9('0x3e')](function(_0x3a53b8){return[_0x3a53b8,!![]];});});}else{_0x5364c9[_0x45f9('0x94')]=null;}_0x5364c9[_0x45f9('0x97')]=_0x3855e4['id'];return db[_0x45f9('0x95')]['find']({'where':_0x5364c9})[_0x45f9('0x3e')](function(_0x103232){if(_0x103232){return[_0x103232,![]];}return db[_0x45f9('0x95')][_0x45f9('0x60')](_0x448b31)[_0x45f9('0x3e')](function(_0x11a9cc){return[_0x11a9cc,!![]];});});}})['spread'](function(_0x114aa8,_0xea1955){if(_0x114aa8){_0x25b218=_0xea1955;if(!_0xea1955){var _0x28e886={'from':(_0x22a736['contact'][_0x45f9('0x98')]||'')+'\x20'+(_0x22a736[_0x45f9('0x93')][_0x45f9('0x99')]||'')};if(_0x3e8e4c[_0x45f9('0x66')][_0x45f9('0x94')]&&_0x3e8e4c[_0x45f9('0x66')][_0x45f9('0x9a')]&&_0x3e8e4c[_0x45f9('0x66')]['threadId']!=_0x3e8e4c[_0x45f9('0x66')][_0x45f9('0x9a')]){_0x28e886[_0x45f9('0x94')]=_0x3e8e4c[_0x45f9('0x66')][_0x45f9('0x9a')];}return _0x114aa8[_0x45f9('0x39')](_0x28e886);}else{return _0x114aa8;}}})[_0x45f9('0x3e')](function(_0x13e3e9){_0x22a736[_0x45f9('0x9b')]=_0x13e3e9[_0x45f9('0x3a')]({'plain':!![]});_0x22a736['interaction'][_0x45f9('0x9c')]=_0x25b218;if(_0x22a736[_0x45f9('0x9b')][_0x45f9('0x9c')]){if(_0x22a736['account'][_0x45f9('0x9d')]){_0x22a736['applications'][_0x45f9('0x9e')]({'id':0x0,'priority':_0x22a736[_0x45f9('0x8b')]['length']+0x1,'app':'close','appdata':'unmanaged','interval':_0x45f9('0x9f')});}}return db[_0x45f9('0xa0')][_0x45f9('0x60')]({'body':_0x3e8e4c[_0x45f9('0x66')][_0x45f9('0x66')],'OpenchannelAccountId':_0x3e8e4c[_0x45f9('0x5c')]['id'],'OpenchannelInteractionId':_0x13e3e9['id'],'direction':'in','ContactId':_0x22a736[_0x45f9('0x93')]['id'],'AttachmentId':_0x3e8e4c[_0x45f9('0x66')][_0x45f9('0xa1')]});})[_0x45f9('0x3e')](function(_0x3a98b4){_0x22a736[_0x45f9('0x2a')]=_0x3a98b4;if(_0x22a736['interaction']['UserId']){return db[_0x45f9('0xa2')]['find']({'attributes':['id','name'],'where':{'id':_0x22a736[_0x45f9('0x9b')][_0x45f9('0xa3')]}})[_0x45f9('0x3e')](function(_0x271f31){if(_0x271f31){_0x22a736[_0x45f9('0x8b')][_0x45f9('0xa4')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x271f31[_0x45f9('0x40')]+','+(_0x22a736[_0x45f9('0x8a')][_0x45f9('0xa5')]||0xa),'interval':_0x45f9('0x9f')});_0x22a736[_0x45f9('0xa6')]=![];}return respondWithRpcPromise(_0x45f9('0xa7'),_0x45f9('0xa8'),_0x22a736);});}return respondWithRpcPromise(_0x45f9('0xa7'),_0x45f9('0xa8'),_0x22a736);})[_0x45f9('0x3e')](function(_0x3b40ed){respondWithRpcPromise('EventManager',_0x45f9('0xa9'),{'event':'notify','message':_0x3b40ed},client9002);return _0x3b40ed;})[_0x45f9('0x3e')](respondWithResult(_0x6e6a0f,null))[_0x45f9('0x2c')](handleError(_0x6e6a0f,null));};exports[_0x45f9('0xaa')]=function(_0x26bbca,_0x58eb80,_0x2bb524){return db['OpenchannelAccount'][_0x45f9('0x71')]({'where':{'id':_0x26bbca[_0x45f9('0x5c')]['id']}})[_0x45f9('0x3e')](handleEntityNotFound(_0x58eb80,null))[_0x45f9('0x3e')](function(_0x471b4){if(_0x471b4){return db['sequelize'][_0x45f9('0xab')](function(_0x22eee0){return db['OpenchannelApplication'][_0x45f9('0x3d')]({'where':{'OpenchannelAccountId':_0x26bbca['params']['id']},'transaction':_0x22eee0})[_0x45f9('0x3e')](function(_0x45037f){var _0x3d5887=_['map'](_0x26bbca[_0x45f9('0x66')],function(_0x2a4f5b){_0x2a4f5b[_0x45f9('0x6b')]=_0x26bbca[_0x45f9('0x5c')]['id'];return _0x2a4f5b;});return db[_0x45f9('0x88')][_0x45f9('0xac')](_0x3d5887,{'transaction':_0x22eee0});});})[_0x45f9('0x3e')](function(){return db['OpenchannelApplication'][_0x45f9('0xad')]({'where':{'OpenchannelAccountId':_0x26bbca[_0x45f9('0x5c')]['id']},'order':_0x45f9('0x8f')});});}})[_0x45f9('0x3e')](respondWithResult(_0x58eb80,null))[_0x45f9('0x2c')](handleError(_0x58eb80,null));};exports[_0x45f9('0xae')]=function(_0x1e892d,_0x1b5bb9,_0x3d76bc){var _0xc7a37b={};var _0x34bfd2={};var _0x556d9e;var _0x256388;return db[_0x45f9('0x45')][_0x45f9('0x71')]({'where':{'id':_0x1e892d[_0x45f9('0x5c')]['id']}})[_0x45f9('0x3e')](handleEntityNotFound(_0x1b5bb9,null))[_0x45f9('0x3e')](function(_0x5eb65f){if(_0x5eb65f){_0x556d9e=_0x5eb65f;_0x34bfd2['model']=_[_0x45f9('0x4c')](db[_0x45f9('0x88')][_0x45f9('0x46')]);_0x34bfd2[_0x45f9('0x4b')]=_['keys'](_0x1e892d[_0x45f9('0x4b')]);_0x34bfd2[_0x45f9('0x4d')]=_['intersection'](_0x34bfd2[_0x45f9('0x4a')],_0x34bfd2[_0x45f9('0x4b')]);_0xc7a37b[_0x45f9('0x50')]=_[_0x45f9('0x4e')](_0x34bfd2[_0x45f9('0x4a')],qs[_0x45f9('0x4f')](_0x1e892d['query']['fields']));_0xc7a37b[_0x45f9('0x50')]=_0xc7a37b[_0x45f9('0x50')][_0x45f9('0x5d')]?_0xc7a37b[_0x45f9('0x50')]:_0x34bfd2['model'];_0xc7a37b['order']=qs[_0x45f9('0x53')](_0x1e892d[_0x45f9('0x4b')][_0x45f9('0x53')]);_0xc7a37b[_0x45f9('0x54')]=qs['filters'](_[_0x45f9('0x55')](_0x1e892d[_0x45f9('0x4b')],_0x34bfd2[_0x45f9('0x4d')]));if(_0x1e892d[_0x45f9('0x4b')][_0x45f9('0x56')]){_0xc7a37b[_0x45f9('0x54')]=_[_0x45f9('0x57')](_0xc7a37b['where'],{'$or':_[_0x45f9('0x44')](_0xc7a37b[_0x45f9('0x50')],function(_0x162427){var _0x3b53af={};_0x3b53af[_0x162427]={'$like':'%'+_0x1e892d['query']['filter']+'%'};return _0x3b53af;})});}_0xc7a37b=_[_0x45f9('0x57')]({},_0xc7a37b,_0x1e892d[_0x45f9('0x59')]);return _0x556d9e[_0x45f9('0xae')](_0xc7a37b);}})[_0x45f9('0x3e')](function(_0x3afffc){if(_0x3afffc){_0x256388=_0x3afffc[_0x45f9('0x5d')];if(!_0x1e892d[_0x45f9('0x4b')]['hasOwnProperty'](_0x45f9('0x73'))){_0xc7a37b[_0x45f9('0x30')]=qs[_0x45f9('0x30')](_0x1e892d['query'][_0x45f9('0x30')]);_0xc7a37b[_0x45f9('0x33')]=qs['offset'](_0x1e892d[_0x45f9('0x4b')][_0x45f9('0x33')]);}return _0x556d9e[_0x45f9('0xae')](_0xc7a37b);}})['then'](function(_0x55e992){if(_0x55e992){return _0x55e992?{'count':_0x256388,'rows':_0x55e992}:null;}})[_0x45f9('0x3e')](respondWithResult(_0x1b5bb9,null))[_0x45f9('0x2c')](handleError(_0x1b5bb9,null));};exports[_0x45f9('0xaf')]=function(_0x52245c,_0x2b264c,_0x4d99a3){var _0x5f3de7={'raw':![],'where':{}};var _0x58bc3e={};var _0x4755e6={'count':0x0,'rows':[]};return db[_0x45f9('0x45')][_0x45f9('0x71')]({'where':{'id':_0x52245c[_0x45f9('0x5c')]['id']}})[_0x45f9('0x3e')](handleEntityNotFound(_0x2b264c,null))[_0x45f9('0x3e')](function(_0x4df273){if(_0x4df273){_0x58bc3e[_0x45f9('0x4a')]=_[_0x45f9('0x4c')](db[_0x45f9('0x95')][_0x45f9('0x46')]);_0x58bc3e[_0x45f9('0x4b')]=_['keys'](_0x52245c[_0x45f9('0x4b')]);_0x58bc3e['filters']=_[_0x45f9('0x4e')](_0x58bc3e[_0x45f9('0x4a')],_0x58bc3e[_0x45f9('0x4b')]);_0x5f3de7[_0x45f9('0x50')]=_[_0x45f9('0x4e')](_0x58bc3e['model'],qs['fields'](_0x52245c[_0x45f9('0x4b')][_0x45f9('0x4f')]));_0x5f3de7['attributes']=_0x5f3de7[_0x45f9('0x50')][_0x45f9('0x5d')]?_0x5f3de7['attributes']:_0x58bc3e[_0x45f9('0x4a')];if(!_0x52245c[_0x45f9('0x4b')][_0x45f9('0x51')](_0x45f9('0x73'))){_0x5f3de7['limit']=qs[_0x45f9('0x30')](_0x52245c[_0x45f9('0x4b')][_0x45f9('0x30')]);_0x5f3de7[_0x45f9('0x33')]=qs[_0x45f9('0x33')](_0x52245c[_0x45f9('0x4b')]['offset']);}_0x5f3de7[_0x45f9('0x52')]=qs[_0x45f9('0x53')](_0x52245c[_0x45f9('0x4b')]['sort']);_0x5f3de7[_0x45f9('0x54')]=qs[_0x45f9('0x4d')](_['pick'](_0x52245c[_0x45f9('0x4b')],_0x58bc3e[_0x45f9('0x4d')]));_0x5f3de7['where']['OpenchannelAccountId']=_0x4df273['id'];if(_0x52245c['query'][_0x45f9('0x56')]){_0x5f3de7['where']=_[_0x45f9('0x57')](_0x5f3de7[_0x45f9('0x54')],{'$or':_['map'](_0x5f3de7[_0x45f9('0x50')],function(_0x58635b){var _0x2539ab={};_0x2539ab[_0x58635b]={'$like':'%'+_0x52245c['query'][_0x45f9('0x56')]+'%'};return _0x2539ab;})});}_0x5f3de7=_[_0x45f9('0x57')]({},_0x5f3de7,_0x52245c[_0x45f9('0x59')]);return db['OpenchannelInteraction']['count']({'where':_0x5f3de7[_0x45f9('0x54')]})[_0x45f9('0x3e')](function(_0x1f1a52){_0x4755e6[_0x45f9('0x32')]=_0x1f1a52;if(_0x52245c[_0x45f9('0x4b')][_0x45f9('0x5e')]){_0x5f3de7[_0x45f9('0x6c')]=[{'model':db[_0x45f9('0x76')],'as':_0x45f9('0xb0'),'required':![]},{'model':db[_0x45f9('0xa2')],'as':'Owner','attributes':[_0x45f9('0x40'),_0x45f9('0xb1'),'internal'],'required':![]},{'model':db[_0x45f9('0xb2')],'as':_0x45f9('0xb3'),'attributes':['id',_0x45f9('0x40'),_0x45f9('0xb4')],'where':_0x52245c[_0x45f9('0x4b')]['tag']?{'id':_0x52245c['query']['tag']}:undefined,'required':_0x52245c[_0x45f9('0x4b')][_0x45f9('0xb5')]?!![]:![]}];}return db[_0x45f9('0x95')]['findAll'](_0x5f3de7);})[_0x45f9('0x3e')](function(_0x549834){_0x4755e6[_0x45f9('0x5a')]=_0x549834;return _0x4755e6;});}})['then'](respondWithFilteredResult(_0x2b264c,_0x5f3de7))[_0x45f9('0x2c')](handleError(_0x2b264c,null));};exports[_0x45f9('0xb6')]=function(_0x349e6a,_0x42c43f,_0x30eddf){return db['OpenchannelAccount']['find']({'where':{'id':_0x349e6a[_0x45f9('0x5c')]['id']}})[_0x45f9('0x3e')](handleEntityNotFound(_0x42c43f,null))[_0x45f9('0x3e')](function(_0x4a23dd){if(_0x4a23dd){return _0x4a23dd['addAgents'](_0x349e6a['body'][_0x45f9('0x6f')],_[_0x45f9('0xb7')](_0x349e6a[_0x45f9('0x66')],[_0x45f9('0x6f'),'id'])||{})['spread'](function(_0x1ff2d3){for(var _0x33f236=0x0;_0x33f236<_0x349e6a['body'][_0x45f9('0x6f')][_0x45f9('0x5d')];_0x33f236+=0x1){socket[_0x45f9('0xb8')]('userOpenchannelAccount:save',{'UserId':Number(_0x349e6a[_0x45f9('0x66')][_0x45f9('0x6f')][_0x33f236]),'OpenchannelAccountId':Number(_0x349e6a[_0x45f9('0x5c')]['id'])});}return _0x1ff2d3;});}})[_0x45f9('0x3e')](respondWithResult(_0x42c43f,null))[_0x45f9('0x2c')](handleError(_0x42c43f,null));};exports[_0x45f9('0xb9')]=function(_0x4776bf,_0x1ce12b,_0x2b81d5){return db[_0x45f9('0x45')][_0x45f9('0x5f')]({'where':{'id':_0x4776bf['params']['id']}})[_0x45f9('0x3e')](handleEntityNotFound(_0x1ce12b,null))[_0x45f9('0x3e')](function(_0xbcd7de){if(_0xbcd7de){return _0xbcd7de[_0x45f9('0xb9')](_0x4776bf[_0x45f9('0x4b')][_0x45f9('0x6f')])[_0x45f9('0x3e')](function(){if(_[_0x45f9('0xba')](_0x4776bf[_0x45f9('0x4b')][_0x45f9('0x6f')])){for(var _0x56bf9f=0x0;_0x56bf9f<_0x4776bf['query'][_0x45f9('0x6f')][_0x45f9('0x5d')];_0x56bf9f+=0x1){socket['emit'](_0x45f9('0xbb'),{'UserId':Number(_0x4776bf[_0x45f9('0x4b')]['ids'][_0x56bf9f]),'OpenchannelAccountId':Number(_0x4776bf[_0x45f9('0x5c')]['id'])});}}else{socket[_0x45f9('0xb8')](_0x45f9('0xbb'),{'UserId':Number(_0x4776bf[_0x45f9('0x4b')]['ids']),'OpenchannelAccountId':Number(_0x4776bf[_0x45f9('0x5c')]['id'])});}});}})['then'](respondWithStatusCode(_0x1ce12b,null))[_0x45f9('0x2c')](handleError(_0x1ce12b,null));};exports[_0x45f9('0xbc')]=function(_0x15cbd4,_0x4ece4e,_0x569b2f){var _0x80c016={};var _0x9b38a1={};var _0x4ff37a;var _0x357e88;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x15cbd4[_0x45f9('0x5c')]['id']}})[_0x45f9('0x3e')](handleEntityNotFound(_0x4ece4e,null))[_0x45f9('0x3e')](function(_0xda047c){if(_0xda047c){_0x4ff37a=_0xda047c;_0x9b38a1[_0x45f9('0x4a')]=_[_0x45f9('0x4c')](db[_0x45f9('0xa2')][_0x45f9('0x46')]);_0x9b38a1['query']=_['keys'](_0x15cbd4[_0x45f9('0x4b')]);_0x9b38a1[_0x45f9('0x4d')]=_[_0x45f9('0x4e')](_0x9b38a1[_0x45f9('0x4a')],_0x9b38a1['query']);_0x80c016[_0x45f9('0x50')]=_['intersection'](_0x9b38a1[_0x45f9('0x4a')],qs[_0x45f9('0x4f')](_0x15cbd4[_0x45f9('0x4b')][_0x45f9('0x4f')]));_0x80c016[_0x45f9('0x50')]=_0x80c016[_0x45f9('0x50')][_0x45f9('0x5d')]?_0x80c016['attributes']:_0x9b38a1[_0x45f9('0x4a')];_0x80c016[_0x45f9('0x52')]=qs['sort'](_0x15cbd4[_0x45f9('0x4b')]['sort']);_0x80c016['where']=qs['filters'](_[_0x45f9('0x55')](_0x15cbd4['query'],_0x9b38a1['filters']));if(_0x15cbd4['query'][_0x45f9('0x56')]){_0x80c016[_0x45f9('0x54')]=_[_0x45f9('0x57')](_0x80c016['where'],{'$or':_[_0x45f9('0x44')](_0x80c016[_0x45f9('0x50')],function(_0x3d3c23){var _0x38bd6b={};_0x38bd6b[_0x3d3c23]={'$like':'%'+_0x15cbd4[_0x45f9('0x4b')][_0x45f9('0x56')]+'%'};return _0x38bd6b;})});}_0x80c016=_[_0x45f9('0x57')]({},_0x80c016,_0x15cbd4[_0x45f9('0x59')]);return _0x4ff37a['getAgents'](_0x80c016);}})['then'](function(_0x5e46d2){if(_0x5e46d2){_0x357e88=_0x5e46d2[_0x45f9('0x5d')];if(!_0x15cbd4[_0x45f9('0x4b')][_0x45f9('0x51')](_0x45f9('0x73'))){_0x80c016[_0x45f9('0x30')]=qs['limit'](_0x15cbd4[_0x45f9('0x4b')][_0x45f9('0x30')]);_0x80c016['offset']=qs[_0x45f9('0x33')](_0x15cbd4[_0x45f9('0x4b')][_0x45f9('0x33')]);}return _0x4ff37a[_0x45f9('0xbc')](_0x80c016);}})[_0x45f9('0x3e')](function(_0x1a2651){if(_0x1a2651){return _0x1a2651?{'count':_0x357e88,'rows':_0x1a2651}:null;}})['then'](respondWithResult(_0x4ece4e,null))['catch'](handleError(_0x4ece4e,null));};exports[_0x45f9('0x41')]=function(_0x4d0f96,_0x6d97b2,_0x4b3795){var _0xec039b,_0x2f8f7b,_0x49ac8a;if(_[_0x45f9('0x7e')](_0x4d0f96[_0x45f9('0x66')][_0x45f9('0x66')])||_0x4d0f96[_0x45f9('0x66')][_0x45f9('0x66')]===''){throw new db['Sequelize']['ValidationError'](_0x45f9('0x81'));}if(_[_0x45f9('0x7e')](_0x4d0f96['body']['to'])){}_0xec039b=_0x4d0f96[_0x45f9('0x66')]['to'];return db[_0x45f9('0x45')][_0x45f9('0x71')]({'where':{'id':_0x4d0f96[_0x45f9('0x5c')]['id']}})[_0x45f9('0x3e')](handleEntityNotFound(_0x6d97b2,null))[_0x45f9('0x3e')](function(_0x1795fb){if(_0x1795fb){return db['OpenchannelAccount'][_0x45f9('0x5f')]({'where':{'id':_0x1795fb['id']},'include':[{'model':db[_0x45f9('0x86')],'as':'List','include':[{'model':db[_0x45f9('0x76')],'as':_0x45f9('0x91'),'where':{[_0x1795fb[_0x45f9('0x82')]]:_0xec039b},'limit':0x1,'order':[[_0x45f9('0x79'),_0x45f9('0x87')]]}]}]})[_0x45f9('0x3e')](handleEntityNotFound(_0x6d97b2,null))[_0x45f9('0x3e')](function(_0x220fec){if(_0x220fec&&_0x220fec[_0x45f9('0x8d')]){_0x2f8f7b=_0x220fec['get']({'plain':!![]});if(_0x2f8f7b[_0x45f9('0x8d')]&&_0x2f8f7b[_0x45f9('0x8d')][_0x45f9('0x91')][_0x45f9('0x5d')]){return _0x2f8f7b[_0x45f9('0x8d')][_0x45f9('0x91')][0x0];}return db[_0x45f9('0x76')]['create'](_['defaults'](_0x4d0f96['body'],{'firstName':_0xec039b,[_0x220fec[_0x45f9('0x82')]]:_0xec039b,'phone':_0xec039b,'ListId':_0x2f8f7b['ListId']}));}})['then'](handleEntityNotFound(_0x6d97b2,null))[_0x45f9('0x3e')](function(_0x11f44a){if(_0x11f44a){_0x49ac8a=_0x11f44a;return db['OpenchannelInteraction']['find']({'where':{'ContactId':_0x49ac8a['id'],'closed':![],'OpenchannelAccountId':_0x2f8f7b['id']}})[_0x45f9('0x3e')](function(_0x4ddd03){if(_0x4ddd03){return[_0x4ddd03,![]];}return db[_0x45f9('0x95')][_0x45f9('0x60')]({'UserId':_0x4d0f96['user']['id'],'ContactId':_0x49ac8a['id'],'OpenchannelAccountId':_0x2f8f7b['id'],'lastMsgDirection':_0x45f9('0xbd'),'Messages':[_['merge'](_0x4d0f96[_0x45f9('0x66')],{'read':![],'body':_0x4d0f96['body'][_0x45f9('0x66')],'OpenchannelAccountId':_0x2f8f7b['id'],'UserId':_0x4d0f96['user']['id'],'ContactId':_0x49ac8a['id']})]},{'include':[{'model':db[_0x45f9('0xa0')],'as':'Messages'}]})[_0x45f9('0x3e')](function(_0x29312a){return[_0x29312a,!![]];});});}})['spread'](function(_0x35f6d2,_0x4dbc80){if(_0x4dbc80){return _0x35f6d2;}return db[_0x45f9('0xa0')][_0x45f9('0x60')](_[_0x45f9('0x57')](_0x4d0f96[_0x45f9('0x66')],{'read':![],'body':_0x4d0f96[_0x45f9('0x66')][_0x45f9('0x66')],'OpenchannelAccountId':_0x2f8f7b['id'],'OpenchannelInteractionId':_0x35f6d2['id'],'UserId':_0x4d0f96[_0x45f9('0x61')]['id'],'ContactId':_0x49ac8a['id']}))[_0x45f9('0x3e')](function(_0x9d73eb){_0x35f6d2[_0x45f9('0xbe')]['Messages']=[];_0x35f6d2[_0x45f9('0xbe')][_0x45f9('0xbf')][_0x45f9('0x9e')](_0x9d73eb['dataValues']);return _0x35f6d2;});});}})['then'](respondWithResult(_0x6d97b2,null))['catch'](handleError(_0x6d97b2,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index b234efa..cd57dff 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 _0x1be1=['OpenchannelAccount','setMaxListeners','update','remove','emit','hook'];(function(_0xbd80e7,_0x26022a){var _0x216a04=function(_0x54460d){while(--_0x54460d){_0xbd80e7['push'](_0xbd80e7['shift']());}};_0x216a04(++_0x26022a);}(_0x1be1,0x192));var _0x11be=function(_0x5032cb,_0x1dfadf){_0x5032cb=_0x5032cb-0x0;var _0x4e3ad0=_0x1be1[_0x5032cb];return _0x4e3ad0;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0x11be('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x11be('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x11be('0x2'),'afterDestroy':_0x11be('0x3')};function emitEvent(_0x200b2a){return function(_0x318d41,_0x504d3a,_0x3ce56d){OpenchannelAccountEvents[_0x11be('0x4')](_0x200b2a+':'+_0x318d41['id'],_0x318d41);OpenchannelAccountEvents[_0x11be('0x4')](_0x200b2a,_0x318d41);_0x3ce56d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x11be('0x5')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0xd64b=['exports','events','OpenchannelAccount','save','update','remove','hasOwnProperty','hook'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xd64b,0xc1));var _0xbd64=function(_0x13486c,_0x139348){_0x13486c=_0x13486c-0x0;var _0x135738=_0xd64b[_0x13486c];return _0x135738;};'use strict';var EventEmitter=require(_0xbd64('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0xbd64('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbd64('0x2'),'afterUpdate':_0xbd64('0x3'),'afterDestroy':_0xbd64('0x4')};function emitEvent(_0x3f1f05){return function(_0x30fe29,_0x5458d8,_0x5446e4){OpenchannelAccountEvents['emit'](_0x3f1f05+':'+_0x30fe29['id'],_0x30fe29);OpenchannelAccountEvents['emit'](_0x3f1f05,_0x30fe29);_0x5446e4(null);};}for(var e in events){if(events[_0xbd64('0x5')](e)){var event=events[e];OpenchannelAccount[_0xbd64('0x6')](e,emitEvent(event));}}module[_0xbd64('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 f9c8797..ab729d5 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(_0x1705cc,_0x39f742){var _0x3b1532=function(_0x6ac78){while(--_0x6ac78){_0x1705cc['push'](_0x1705cc['shift']());}};_0x3b1532(++_0x39f742);}(_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 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(_0x1ec0ac,_0x5a8868){var _0x257f79=function(_0x1fa653){while(--_0x1fa653){_0x1ec0ac['push'](_0x1ec0ac['shift']());}};_0x257f79(++_0x5a8868);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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 eec76e9..cf0c1fa 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 _0xeffd=['redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xf48cce,_0x3531e4){var _0x2a5c38=function(_0x22a454){while(--_0x22a454){_0xf48cce['push'](_0xf48cce['shift']());}};_0x2a5c38(++_0x3531e4);}(_0xeffd,0x6b));var _0xdeff=function(_0x3900e2,_0x48b331){_0x3900e2=_0x3900e2-0x0;var _0x5f3986=_0xeffd[_0x3900e2];return _0x5f3986;};'use strict';var _=require(_0xdeff('0x0'));var util=require('util');var moment=require(_0xdeff('0x1'));var BPromise=require(_0xdeff('0x2'));var rs=require(_0xdeff('0x3'));var fs=require('fs');var Redis=require(_0xdeff('0x4'));var db=require(_0xdeff('0x5'))['db'];var utils=require(_0xdeff('0x6'));var logger=require(_0xdeff('0x7'))(_0xdeff('0x8'));var config=require(_0xdeff('0x9'));var jayson=require(_0xdeff('0xa'));var client=jayson[_0xdeff('0xb')][_0xdeff('0xc')]({'port':0x232a});config[_0xdeff('0xd')]=_[_0xdeff('0xe')](config[_0xdeff('0xd')],{'host':_0xdeff('0xf'),'port':0x18eb});var socket=require(_0xdeff('0x10'))(new Redis(config['redis']));require(_0xdeff('0x11'))[_0xdeff('0x12')](socket);function respondWithRpcPromise(_0xf6d58d,_0x51fcb7,_0x1ff265){return new BPromise(function(_0x4423e9,_0x3c1482){return client[_0xdeff('0x13')](_0xf6d58d,_0x1ff265)[_0xdeff('0x14')](function(_0x256b73){logger[_0xdeff('0x15')](_0xdeff('0x16'),_0x51fcb7,'request\x20sent');logger[_0xdeff('0x17')](_0xdeff('0x18'),_0x51fcb7,'request\x20sent',JSON[_0xdeff('0x19')](_0x256b73));if(_0x256b73['error']){if(_0x256b73['error'][_0xdeff('0x1a')]===0x1f4){logger[_0xdeff('0x1b')](_0xdeff('0x16'),_0x51fcb7,_0x256b73[_0xdeff('0x1b')]['message']);return _0x3c1482(_0x256b73[_0xdeff('0x1b')][_0xdeff('0x1c')]);}logger[_0xdeff('0x1b')](_0xdeff('0x16'),_0x51fcb7,_0x256b73[_0xdeff('0x1b')][_0xdeff('0x1c')]);return _0x4423e9(_0x256b73['error']['message']);}else{logger[_0xdeff('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x51fcb7,'request\x20sent');_0x4423e9(_0x256b73[_0xdeff('0x1d')][_0xdeff('0x1c')]);}})['catch'](function(_0x2de203){logger[_0xdeff('0x1b')](_0xdeff('0x16'),_0x51fcb7,_0x2de203);_0x3c1482(_0x2de203);});});} \ No newline at end of file +var _0x5eb8=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','register','request','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x27b714,_0x242d60){var _0x1dbff2=function(_0x12bc9e){while(--_0x12bc9e){_0x27b714['push'](_0x27b714['shift']());}};_0x1dbff2(++_0x242d60);}(_0x5eb8,0xb0));var _0x85eb=function(_0x5c956b,_0xa87d11){_0x5c956b=_0x5c956b-0x0;var _0xaff46a=_0x5eb8[_0x5c956b];return _0xaff46a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x85eb('0x0'));var BPromise=require(_0x85eb('0x1'));var rs=require(_0x85eb('0x2'));var fs=require('fs');var Redis=require(_0x85eb('0x3'));var db=require(_0x85eb('0x4'))['db'];var utils=require(_0x85eb('0x5'));var logger=require(_0x85eb('0x6'))(_0x85eb('0x7'));var config=require(_0x85eb('0x8'));var jayson=require(_0x85eb('0x9'));var client=jayson[_0x85eb('0xa')][_0x85eb('0xb')]({'port':0x232a});config['redis']=_[_0x85eb('0xc')](config[_0x85eb('0xd')],{'host':_0x85eb('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x85eb('0xd')]));require('./openchannelAccount.socket')[_0x85eb('0xf')](socket);function respondWithRpcPromise(_0x40d6b6,_0x673228,_0x29030b){return new BPromise(function(_0x1dacf2,_0x73e6d0){return client[_0x85eb('0x10')](_0x40d6b6,_0x29030b)['then'](function(_0x163f32){logger[_0x85eb('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x673228,_0x85eb('0x12'));logger[_0x85eb('0x13')](_0x85eb('0x14'),_0x673228,_0x85eb('0x12'),JSON['stringify'](_0x163f32));if(_0x163f32['error']){if(_0x163f32[_0x85eb('0x15')]['code']===0x1f4){logger[_0x85eb('0x15')](_0x85eb('0x16'),_0x673228,_0x163f32[_0x85eb('0x15')][_0x85eb('0x17')]);return _0x73e6d0(_0x163f32[_0x85eb('0x15')]['message']);}logger[_0x85eb('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x673228,_0x163f32[_0x85eb('0x15')][_0x85eb('0x17')]);return _0x1dacf2(_0x163f32[_0x85eb('0x15')][_0x85eb('0x17')]);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x673228,'request\x20sent');_0x1dacf2(_0x163f32[_0x85eb('0x18')][_0x85eb('0x17')]);}})[_0x85eb('0x19')](function(_0x2e986c){logger[_0x85eb('0x15')](_0x85eb('0x16'),_0x673228,_0x2e986c);_0x73e6d0(_0x2e986c);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 5b1bc25..2a97290 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 _0x3715=['removeListener','register','openchannelAccount:','./openchannelAccount.events','save','remove','update','emit'];(function(_0x959a2d,_0x1685de){var _0x1b5d0e=function(_0x588de9){while(--_0x588de9){_0x959a2d['push'](_0x959a2d['shift']());}};_0x1b5d0e(++_0x1685de);}(_0x3715,0xc3));var _0x5371=function(_0xa1d719,_0x5a6598){_0xa1d719=_0xa1d719-0x0;var _0x6329c3=_0x3715[_0xa1d719];return _0x6329c3;};'use strict';var OpenchannelAccountEvents=require(_0x5371('0x0'));var events=[_0x5371('0x1'),_0x5371('0x2'),_0x5371('0x3')];function createListener(_0x7304fb,_0x2f9a2c){return function(_0x132ef3){_0x2f9a2c[_0x5371('0x4')](_0x7304fb,_0x132ef3);};}function removeListener(_0x3ff067,_0x355d6a){return function(){OpenchannelAccountEvents[_0x5371('0x5')](_0x3ff067,_0x355d6a);};}exports[_0x5371('0x6')]=function(_0x50a759){for(var _0x1ffdcb=0x0,_0x340e44=events['length'];_0x1ffdcb<_0x340e44;_0x1ffdcb++){var _0x426a2a=events[_0x1ffdcb];var _0x16c64a=createListener(_0x5371('0x7')+_0x426a2a,_0x50a759);OpenchannelAccountEvents['on'](_0x426a2a,_0x16c64a);}}; \ No newline at end of file +var _0x93e7=['removeListener','openchannelAccount:','./openchannelAccount.events','remove','update','emit'];(function(_0x4ebb32,_0x144054){var _0x493190=function(_0x1d019f){while(--_0x1d019f){_0x4ebb32['push'](_0x4ebb32['shift']());}};_0x493190(++_0x144054);}(_0x93e7,0x9e));var _0x793e=function(_0x45346d,_0xffd56b){_0x45346d=_0x45346d-0x0;var _0x5ce7ca=_0x93e7[_0x45346d];return _0x5ce7ca;};'use strict';var OpenchannelAccountEvents=require(_0x793e('0x0'));var events=['save',_0x793e('0x1'),_0x793e('0x2')];function createListener(_0x4b34e4,_0x2adb7e){return function(_0x42f385){_0x2adb7e[_0x793e('0x3')](_0x4b34e4,_0x42f385);};}function removeListener(_0x13a368,_0x59e54c){return function(){OpenchannelAccountEvents[_0x793e('0x4')](_0x13a368,_0x59e54c);};}exports['register']=function(_0x336ce8){for(var _0x58ddb4=0x0,_0x17c1e7=events['length'];_0x58ddb4<_0x17c1e7;_0x58ddb4++){var _0x427280=events[_0x58ddb4];var _0x584492=createListener(_0x793e('0x5')+_0x427280,_0x336ce8);OpenchannelAccountEvents['on'](_0x427280,_0x584492);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 6cc9c09..368e3f4 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 _0x84ba=['../../config/environment','./openchannelApplication.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3df1f3,_0x2d6859){var _0x593b6e=function(_0x12f5ef){while(--_0x12f5ef){_0x3df1f3['push'](_0x3df1f3['shift']());}};_0x593b6e(++_0x2d6859);}(_0x84ba,0x162));var _0xa84b=function(_0x5c2d24,_0x3e324f){_0x5c2d24=_0x5c2d24-0x0;var _0xd0c701=_0x84ba[_0x5c2d24];return _0xd0c701;};'use strict';var multer=require('multer');var util=require(_0xa84b('0x0'));var path=require(_0xa84b('0x1'));var timeout=require('connect-timeout');var express=require(_0xa84b('0x2'));var router=express[_0xa84b('0x3')]();var fs_extra=require(_0xa84b('0x4'));var auth=require(_0xa84b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa84b('0x6'));var controller=require(_0xa84b('0x7'));router[_0xa84b('0x8')]('/',auth[_0xa84b('0x9')](),controller['index']);router[_0xa84b('0x8')](_0xa84b('0xa'),auth[_0xa84b('0x9')](),controller[_0xa84b('0xb')]);router[_0xa84b('0xc')]('/',auth[_0xa84b('0x9')](),controller[_0xa84b('0xd')]);router[_0xa84b('0xe')]('/:id',auth[_0xa84b('0x9')](),controller[_0xa84b('0xf')]);router[_0xa84b('0x10')](_0xa84b('0xa'),auth['isAuthenticated'](),controller[_0xa84b('0x11')]);module['exports']=router; \ No newline at end of file +var _0xb284=['get','isAuthenticated','index','/:id','show','post','put','delete','destroy','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./openchannelApplication.controller'];(function(_0x77820a,_0x480076){var _0x2cee1c=function(_0x3845be){while(--_0x3845be){_0x77820a['push'](_0x77820a['shift']());}};_0x2cee1c(++_0x480076);}(_0xb284,0x1b2));var _0x4b28=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb284[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x4b28('0x0'));var path=require(_0x4b28('0x1'));var timeout=require(_0x4b28('0x2'));var express=require(_0x4b28('0x3'));var router=express[_0x4b28('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4b28('0x5'));var config=require(_0x4b28('0x6'));var controller=require(_0x4b28('0x7'));router[_0x4b28('0x8')]('/',auth[_0x4b28('0x9')](),controller[_0x4b28('0xa')]);router['get'](_0x4b28('0xb'),auth['isAuthenticated'](),controller[_0x4b28('0xc')]);router[_0x4b28('0xd')]('/',auth[_0x4b28('0x9')](),controller['create']);router[_0x4b28('0xe')](_0x4b28('0xb'),auth[_0x4b28('0x9')](),controller['update']);router[_0x4b28('0xf')](_0x4b28('0xb'),auth[_0x4b28('0x9')](),controller[_0x4b28('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 2ec5d8f..94b7050 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 _0x7d5f=['TEXT','*,*,*,*','exports','INTEGER','STRING'];(function(_0x1549c1,_0xeb4f1a){var _0x23434e=function(_0xac4e01){while(--_0xac4e01){_0x1549c1['push'](_0x1549c1['shift']());}};_0x23434e(++_0xeb4f1a);}(_0x7d5f,0x1b5));var _0xf7d5=function(_0x56b499,_0x12b187){_0x56b499=_0x56b499-0x0;var _0xbfc95=_0x7d5f[_0x56b499];return _0xbfc95;};'use strict';var Sequelize=require('sequelize');module[_0xf7d5('0x0')]={'priority':{'type':Sequelize[_0xf7d5('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xf7d5('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xf7d5('0x3')]()},'description':{'type':Sequelize[_0xf7d5('0x2')]},'interval':{'type':Sequelize[_0xf7d5('0x2')],'defaultValue':_0xf7d5('0x4')}}; \ No newline at end of file +var _0x4a00=['sequelize','exports','INTEGER','noop','STRING','*,*,*,*'];(function(_0x346c28,_0xbb486e){var _0x446822=function(_0x25b206){while(--_0x25b206){_0x346c28['push'](_0x346c28['shift']());}};_0x446822(++_0xbb486e);}(_0x4a00,0xc6));var _0x04a0=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x4a00[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0x04a0('0x0'));module[_0x04a0('0x1')]={'priority':{'type':Sequelize[_0x04a0('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x04a0('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x04a0('0x4')],'defaultValue':_0x04a0('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index c1cdcf8..1e270e2 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 _0x734c=['filter','merge','VIRTUAL','includeAll','catch','params','keys','include','options','find','create','body','destroy','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','json','apply','reject','save','update','then','error','stack','name','send','OpenchannelApplication','rawAttributes','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x1eaf5e,_0x333d16){var _0x409fa2=function(_0x57f633){while(--_0x57f633){_0x1eaf5e['push'](_0x1eaf5e['shift']());}};_0x409fa2(++_0x333d16);}(_0x734c,0xe8));var _0xc734=function(_0x16b71e,_0x20353d){_0x16b71e=_0x16b71e-0x0;var _0x298c74=_0x734c[_0x16b71e];return _0x298c74;};'use strict';var emlformat=require(_0xc734('0x0'));var rimraf=require(_0xc734('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc734('0x2'));var rp=require('request-promise');var moment=require(_0xc734('0x3'));var BPromise=require(_0xc734('0x4'));var Mustache=require(_0xc734('0x5'));var util=require(_0xc734('0x6'));var path=require(_0xc734('0x7'));var sox=require(_0xc734('0x8'));var csv=require(_0xc734('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc734('0xa'));var _=require(_0xc734('0xb'));var squel=require(_0xc734('0xc'));var crypto=require(_0xc734('0xd'));var jsforce=require(_0xc734('0xe'));var deskjs=require(_0xc734('0xf'));var toCsv=require('to-csv');var querystring=require(_0xc734('0x10'));var Papa=require(_0xc734('0x11'));var Redis=require(_0xc734('0x12'));var authService=require(_0xc734('0x13'));var qs=require(_0xc734('0x14'));var as=require(_0xc734('0x15'));var hardwareService=require(_0xc734('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xc734('0x17'));var config=require(_0xc734('0x18'));var licenseUtil=require(_0xc734('0x19'));var db=require(_0xc734('0x1a'))['db'];function respondWithStatusCode(_0x2147d9,_0x132ece){_0x132ece=_0x132ece||0xcc;return function(_0x72e574){if(_0x72e574){return _0x2147d9[_0xc734('0x1b')](_0x132ece);}return _0x2147d9[_0xc734('0x1c')](_0x132ece)[_0xc734('0x1d')]();};}function respondWithResult(_0x56c0ea,_0x104da9){_0x104da9=_0x104da9||0xc8;return function(_0x3dfa22){if(_0x3dfa22){return _0x56c0ea[_0xc734('0x1c')](_0x104da9)['json'](_0x3dfa22);}};}function respondWithFilteredResult(_0x322c67,_0x13266){return function(_0x372ae1){if(_0x372ae1){var _0xecf4cc=typeof _0x13266['offset']===_0xc734('0x1e')&&typeof _0x13266[_0xc734('0x1f')]==='undefined';var _0x25d372=_0x372ae1[_0xc734('0x20')];var _0x5f54a0=_0xecf4cc?0x0:_0x13266[_0xc734('0x21')];var _0x1f689=_0xecf4cc?_0x372ae1[_0xc734('0x20')]:_0x13266[_0xc734('0x21')]+_0x13266[_0xc734('0x1f')];var _0x24ef96;if(_0x1f689>=_0x25d372){_0x1f689=_0x25d372;_0x24ef96=0xc8;}else{_0x24ef96=0xce;}_0x322c67[_0xc734('0x1c')](_0x24ef96);return _0x322c67['set']('Content-Range',_0x5f54a0+'-'+_0x1f689+'/'+_0x25d372)[_0xc734('0x22')](_0x372ae1);}return null;};}function patchUpdates(_0x5ed84f){return function(_0x16568b){try{jsonpatch[_0xc734('0x23')](_0x16568b,_0x5ed84f,!![]);}catch(_0x43a49e){return BPromise[_0xc734('0x24')](_0x43a49e);}return _0x16568b[_0xc734('0x25')]();};}function saveUpdates(_0x465141,_0x2d4546){return function(_0x2ed856){if(_0x2ed856){return _0x2ed856[_0xc734('0x26')](_0x465141)[_0xc734('0x27')](function(_0x93ef89){return _0x93ef89;});}return null;};}function removeEntity(_0x49445e,_0x5606c3){return function(_0x1735f6){if(_0x1735f6){return _0x1735f6['destroy']()[_0xc734('0x27')](function(){_0x49445e[_0xc734('0x1c')](0xcc)[_0xc734('0x1d')]();});}};}function handleEntityNotFound(_0x493253,_0x56c9b7){return function(_0x385173){if(!_0x385173){_0x493253[_0xc734('0x1b')](0x194);}return _0x385173;};}function handleError(_0x329248,_0x1b3a91){_0x1b3a91=_0x1b3a91||0x1f4;return function(_0x2e0801){logger[_0xc734('0x28')](_0x2e0801[_0xc734('0x29')]);if(_0x2e0801[_0xc734('0x2a')]){delete _0x2e0801[_0xc734('0x2a')];}_0x329248['status'](_0x1b3a91)[_0xc734('0x2b')](_0x2e0801);};}exports['index']=function(_0x15edd0,_0x381a5d){var _0x45d06f={},_0x3e6adf={},_0x3a6402={'count':0x0,'rows':[]};var _0x1d99ec=_['map'](db[_0xc734('0x2c')][_0xc734('0x2d')],function(_0x418245){return{'name':_0x418245['fieldName'],'type':_0x418245[_0xc734('0x2e')]['key']};});_0x3e6adf[_0xc734('0x2f')]=_['map'](_0x1d99ec,_0xc734('0x2a'));_0x3e6adf[_0xc734('0x30')]=_['keys'](_0x15edd0['query']);_0x3e6adf[_0xc734('0x31')]=_['intersection'](_0x3e6adf[_0xc734('0x2f')],_0x3e6adf[_0xc734('0x30')]);_0x45d06f[_0xc734('0x32')]=_[_0xc734('0x33')](_0x3e6adf[_0xc734('0x2f')],qs[_0xc734('0x34')](_0x15edd0[_0xc734('0x30')][_0xc734('0x34')]));_0x45d06f['attributes']=_0x45d06f['attributes'][_0xc734('0x35')]?_0x45d06f[_0xc734('0x32')]:_0x3e6adf[_0xc734('0x2f')];if(!_0x15edd0[_0xc734('0x30')][_0xc734('0x36')](_0xc734('0x37'))){_0x45d06f[_0xc734('0x1f')]=qs['limit'](_0x15edd0[_0xc734('0x30')][_0xc734('0x1f')]);_0x45d06f[_0xc734('0x21')]=qs[_0xc734('0x21')](_0x15edd0[_0xc734('0x30')][_0xc734('0x21')]);}_0x45d06f[_0xc734('0x38')]=qs[_0xc734('0x39')](_0x15edd0[_0xc734('0x30')][_0xc734('0x39')]);_0x45d06f[_0xc734('0x3a')]=qs['filters'](_[_0xc734('0x3b')](_0x15edd0[_0xc734('0x30')],_0x3e6adf[_0xc734('0x31')]),_0x1d99ec);if(_0x15edd0[_0xc734('0x30')][_0xc734('0x3c')]){_0x45d06f[_0xc734('0x3a')]=_[_0xc734('0x3d')](_0x45d06f['where'],{'$or':_['map'](_0x1d99ec,function(_0x5f0cb9){if(_0x5f0cb9[_0xc734('0x2e')]!==_0xc734('0x3e')){var _0x205fcf={};_0x205fcf[_0x5f0cb9[_0xc734('0x2a')]]={'$like':'%'+_0x15edd0['query']['filter']+'%'};return _0x205fcf;}})});}_0x45d06f=_[_0xc734('0x3d')]({},_0x45d06f,_0x15edd0['options']);var _0x20fc45={'where':_0x45d06f[_0xc734('0x3a')]};return db['OpenchannelApplication'][_0xc734('0x20')](_0x20fc45)[_0xc734('0x27')](function(_0x1d58ca){_0x3a6402[_0xc734('0x20')]=_0x1d58ca;if(_0x15edd0[_0xc734('0x30')][_0xc734('0x3f')]){_0x45d06f['include']=[{'all':!![]}];}return db[_0xc734('0x2c')]['findAll'](_0x45d06f);})[_0xc734('0x27')](function(_0x55af66){_0x3a6402['rows']=_0x55af66;return _0x3a6402;})[_0xc734('0x27')](respondWithFilteredResult(_0x381a5d,_0x45d06f))[_0xc734('0x40')](handleError(_0x381a5d,null));};exports['show']=function(_0x52d617,_0x2910b9){var _0x288201={'raw':!![],'where':{'id':_0x52d617[_0xc734('0x41')]['id']}},_0x335be3={};_0x335be3['model']=_[_0xc734('0x42')](db[_0xc734('0x2c')]['rawAttributes']);_0x335be3['query']=_[_0xc734('0x42')](_0x52d617[_0xc734('0x30')]);_0x335be3['filters']=_[_0xc734('0x33')](_0x335be3[_0xc734('0x2f')],_0x335be3['query']);_0x288201[_0xc734('0x32')]=_[_0xc734('0x33')](_0x335be3[_0xc734('0x2f')],qs['fields'](_0x52d617['query'][_0xc734('0x34')]));_0x288201[_0xc734('0x32')]=_0x288201[_0xc734('0x32')]['length']?_0x288201[_0xc734('0x32')]:_0x335be3[_0xc734('0x2f')];if(_0x52d617[_0xc734('0x30')][_0xc734('0x3f')]){_0x288201[_0xc734('0x43')]=[{'all':!![]}];}_0x288201=_[_0xc734('0x3d')]({},_0x288201,_0x52d617[_0xc734('0x44')]);return db[_0xc734('0x2c')][_0xc734('0x45')](_0x288201)[_0xc734('0x27')](handleEntityNotFound(_0x2910b9,null))['then'](respondWithResult(_0x2910b9,null))[_0xc734('0x40')](handleError(_0x2910b9,null));};exports[_0xc734('0x46')]=function(_0x23df53,_0x537062){return db[_0xc734('0x2c')][_0xc734('0x46')](_0x23df53[_0xc734('0x47')],{})['then'](respondWithResult(_0x537062,0xc9))[_0xc734('0x40')](handleError(_0x537062,null));};exports['update']=function(_0x3a0361,_0x23deef){if(_0x3a0361[_0xc734('0x47')]['id']){delete _0x3a0361[_0xc734('0x47')]['id'];}return db[_0xc734('0x2c')][_0xc734('0x45')]({'where':{'id':_0x3a0361['params']['id']}})['then'](handleEntityNotFound(_0x23deef,null))['then'](saveUpdates(_0x3a0361['body'],null))['then'](respondWithResult(_0x23deef,null))[_0xc734('0x40')](handleError(_0x23deef,null));};exports[_0xc734('0x48')]=function(_0x5f0f77,_0xe5d7ca){return db[_0xc734('0x2c')][_0xc734('0x45')]({'where':{'id':_0x5f0f77[_0xc734('0x41')]['id']}})[_0xc734('0x27')](handleEntityNotFound(_0xe5d7ca,null))[_0xc734('0x27')](removeEntity(_0xe5d7ca,null))[_0xc734('0x40')](handleError(_0xe5d7ca,null));}; \ No newline at end of file +var _0xdaff=['rawAttributes','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','stack','name','send','OpenchannelApplication'];(function(_0x1a50b1,_0x4fb894){var _0x232ae5=function(_0x23d0d3){while(--_0x23d0d3){_0x1a50b1['push'](_0x1a50b1['shift']());}};_0x232ae5(++_0x4fb894);}(_0xdaff,0x147));var _0xfdaf=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xdaff[_0x4b369d];return _0x571a98;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfdaf('0x0'));var zipdir=require(_0xfdaf('0x1'));var jsonpatch=require(_0xfdaf('0x2'));var rp=require(_0xfdaf('0x3'));var moment=require(_0xfdaf('0x4'));var BPromise=require(_0xfdaf('0x5'));var Mustache=require(_0xfdaf('0x6'));var util=require(_0xfdaf('0x7'));var path=require('path');var sox=require(_0xfdaf('0x8'));var csv=require(_0xfdaf('0x9'));var ejs=require(_0xfdaf('0xa'));var fs=require('fs');var fs_extra=require(_0xfdaf('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xfdaf('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xfdaf('0xd'));var toCsv=require(_0xfdaf('0x9'));var querystring=require(_0xfdaf('0xe'));var Papa=require(_0xfdaf('0xf'));var Redis=require(_0xfdaf('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xfdaf('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfdaf('0x12'));var logger=require(_0xfdaf('0x13'))(_0xfdaf('0x14'));var utils=require(_0xfdaf('0x15'));var config=require(_0xfdaf('0x16'));var licenseUtil=require(_0xfdaf('0x17'));var db=require(_0xfdaf('0x18'))['db'];function respondWithStatusCode(_0x17f271,_0x48ac40){_0x48ac40=_0x48ac40||0xcc;return function(_0x2772e2){if(_0x2772e2){return _0x17f271[_0xfdaf('0x19')](_0x48ac40);}return _0x17f271[_0xfdaf('0x1a')](_0x48ac40)[_0xfdaf('0x1b')]();};}function respondWithResult(_0x1e0a0f,_0x23592d){_0x23592d=_0x23592d||0xc8;return function(_0x4f14c3){if(_0x4f14c3){return _0x1e0a0f[_0xfdaf('0x1a')](_0x23592d)[_0xfdaf('0x1c')](_0x4f14c3);}};}function respondWithFilteredResult(_0x1a3e85,_0x458b15){return function(_0x162a3b){if(_0x162a3b){var _0x1e3c8c=typeof _0x458b15[_0xfdaf('0x1d')]===_0xfdaf('0x1e')&&typeof _0x458b15[_0xfdaf('0x1f')]===_0xfdaf('0x1e');var _0x126282=_0x162a3b[_0xfdaf('0x20')];var _0x3eb66e=_0x1e3c8c?0x0:_0x458b15[_0xfdaf('0x1d')];var _0x206bc4=_0x1e3c8c?_0x162a3b['count']:_0x458b15[_0xfdaf('0x1d')]+_0x458b15[_0xfdaf('0x1f')];var _0x5aa19b;if(_0x206bc4>=_0x126282){_0x206bc4=_0x126282;_0x5aa19b=0xc8;}else{_0x5aa19b=0xce;}_0x1a3e85[_0xfdaf('0x1a')](_0x5aa19b);return _0x1a3e85[_0xfdaf('0x21')](_0xfdaf('0x22'),_0x3eb66e+'-'+_0x206bc4+'/'+_0x126282)['json'](_0x162a3b);}return null;};}function patchUpdates(_0x383f2d){return function(_0x41de01){try{jsonpatch[_0xfdaf('0x23')](_0x41de01,_0x383f2d,!![]);}catch(_0x1091a4){return BPromise['reject'](_0x1091a4);}return _0x41de01['save']();};}function saveUpdates(_0xab7160,_0x19a362){return function(_0x1b0292){if(_0x1b0292){return _0x1b0292[_0xfdaf('0x24')](_0xab7160)[_0xfdaf('0x25')](function(_0x777f86){return _0x777f86;});}return null;};}function removeEntity(_0x1e96ec,_0xf1e55){return function(_0x8c8e17){if(_0x8c8e17){return _0x8c8e17[_0xfdaf('0x26')]()[_0xfdaf('0x25')](function(){_0x1e96ec['status'](0xcc)[_0xfdaf('0x1b')]();});}};}function handleEntityNotFound(_0x5827af,_0x434951){return function(_0x350401){if(!_0x350401){_0x5827af['sendStatus'](0x194);}return _0x350401;};}function handleError(_0x1ab5c4,_0x234001){_0x234001=_0x234001||0x1f4;return function(_0x9c5969){logger['error'](_0x9c5969[_0xfdaf('0x27')]);if(_0x9c5969[_0xfdaf('0x28')]){delete _0x9c5969['name'];}_0x1ab5c4['status'](_0x234001)[_0xfdaf('0x29')](_0x9c5969);};}exports['index']=function(_0x119050,_0x3285ef){var _0x2b5636={},_0x19b3c9={},_0x2174fa={'count':0x0,'rows':[]};var _0x22f26b=_['map'](db[_0xfdaf('0x2a')][_0xfdaf('0x2b')],function(_0x468b8b){return{'name':_0x468b8b['fieldName'],'type':_0x468b8b['type'][_0xfdaf('0x2c')]};});_0x19b3c9[_0xfdaf('0x2d')]=_[_0xfdaf('0x2e')](_0x22f26b,_0xfdaf('0x28'));_0x19b3c9[_0xfdaf('0x2f')]=_[_0xfdaf('0x30')](_0x119050[_0xfdaf('0x2f')]);_0x19b3c9[_0xfdaf('0x31')]=_['intersection'](_0x19b3c9[_0xfdaf('0x2d')],_0x19b3c9[_0xfdaf('0x2f')]);_0x2b5636[_0xfdaf('0x32')]=_[_0xfdaf('0x33')](_0x19b3c9[_0xfdaf('0x2d')],qs[_0xfdaf('0x34')](_0x119050[_0xfdaf('0x2f')][_0xfdaf('0x34')]));_0x2b5636['attributes']=_0x2b5636[_0xfdaf('0x32')]['length']?_0x2b5636['attributes']:_0x19b3c9[_0xfdaf('0x2d')];if(!_0x119050[_0xfdaf('0x2f')][_0xfdaf('0x35')](_0xfdaf('0x36'))){_0x2b5636[_0xfdaf('0x1f')]=qs[_0xfdaf('0x1f')](_0x119050[_0xfdaf('0x2f')][_0xfdaf('0x1f')]);_0x2b5636[_0xfdaf('0x1d')]=qs['offset'](_0x119050[_0xfdaf('0x2f')][_0xfdaf('0x1d')]);}_0x2b5636[_0xfdaf('0x37')]=qs[_0xfdaf('0x38')](_0x119050['query']['sort']);_0x2b5636[_0xfdaf('0x39')]=qs[_0xfdaf('0x31')](_[_0xfdaf('0x3a')](_0x119050['query'],_0x19b3c9[_0xfdaf('0x31')]),_0x22f26b);if(_0x119050[_0xfdaf('0x2f')]['filter']){_0x2b5636[_0xfdaf('0x39')]=_[_0xfdaf('0x3b')](_0x2b5636[_0xfdaf('0x39')],{'$or':_[_0xfdaf('0x2e')](_0x22f26b,function(_0x18b185){if(_0x18b185['type']!==_0xfdaf('0x3c')){var _0x4d930e={};_0x4d930e[_0x18b185[_0xfdaf('0x28')]]={'$like':'%'+_0x119050[_0xfdaf('0x2f')][_0xfdaf('0x3d')]+'%'};return _0x4d930e;}})});}_0x2b5636=_[_0xfdaf('0x3b')]({},_0x2b5636,_0x119050[_0xfdaf('0x3e')]);var _0x5657fe={'where':_0x2b5636['where']};return db[_0xfdaf('0x2a')]['count'](_0x5657fe)[_0xfdaf('0x25')](function(_0x2aa15a){_0x2174fa[_0xfdaf('0x20')]=_0x2aa15a;if(_0x119050[_0xfdaf('0x2f')][_0xfdaf('0x3f')]){_0x2b5636[_0xfdaf('0x40')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0xfdaf('0x41')](_0x2b5636);})[_0xfdaf('0x25')](function(_0x4b3c3f){_0x2174fa[_0xfdaf('0x42')]=_0x4b3c3f;return _0x2174fa;})[_0xfdaf('0x25')](respondWithFilteredResult(_0x3285ef,_0x2b5636))['catch'](handleError(_0x3285ef,null));};exports[_0xfdaf('0x43')]=function(_0x5e5d8a,_0x49e267){var _0xdd3fd5={'raw':!![],'where':{'id':_0x5e5d8a[_0xfdaf('0x44')]['id']}},_0x9b7f3d={};_0x9b7f3d[_0xfdaf('0x2d')]=_['keys'](db[_0xfdaf('0x2a')][_0xfdaf('0x2b')]);_0x9b7f3d[_0xfdaf('0x2f')]=_[_0xfdaf('0x30')](_0x5e5d8a[_0xfdaf('0x2f')]);_0x9b7f3d['filters']=_[_0xfdaf('0x33')](_0x9b7f3d[_0xfdaf('0x2d')],_0x9b7f3d[_0xfdaf('0x2f')]);_0xdd3fd5[_0xfdaf('0x32')]=_[_0xfdaf('0x33')](_0x9b7f3d[_0xfdaf('0x2d')],qs[_0xfdaf('0x34')](_0x5e5d8a[_0xfdaf('0x2f')]['fields']));_0xdd3fd5[_0xfdaf('0x32')]=_0xdd3fd5[_0xfdaf('0x32')][_0xfdaf('0x45')]?_0xdd3fd5[_0xfdaf('0x32')]:_0x9b7f3d['model'];if(_0x5e5d8a[_0xfdaf('0x2f')]['includeAll']){_0xdd3fd5[_0xfdaf('0x40')]=[{'all':!![]}];}_0xdd3fd5=_[_0xfdaf('0x3b')]({},_0xdd3fd5,_0x5e5d8a[_0xfdaf('0x3e')]);return db['OpenchannelApplication'][_0xfdaf('0x46')](_0xdd3fd5)[_0xfdaf('0x25')](handleEntityNotFound(_0x49e267,null))[_0xfdaf('0x25')](respondWithResult(_0x49e267,null))[_0xfdaf('0x47')](handleError(_0x49e267,null));};exports[_0xfdaf('0x48')]=function(_0x152a5c,_0x24af05){return db[_0xfdaf('0x2a')]['create'](_0x152a5c[_0xfdaf('0x49')],{})[_0xfdaf('0x25')](respondWithResult(_0x24af05,0xc9))[_0xfdaf('0x47')](handleError(_0x24af05,null));};exports[_0xfdaf('0x24')]=function(_0x35e116,_0x1a0dd2){if(_0x35e116['body']['id']){delete _0x35e116['body']['id'];}return db['OpenchannelApplication']['find']({'where':{'id':_0x35e116[_0xfdaf('0x44')]['id']}})[_0xfdaf('0x25')](handleEntityNotFound(_0x1a0dd2,null))[_0xfdaf('0x25')](saveUpdates(_0x35e116[_0xfdaf('0x49')],null))[_0xfdaf('0x25')](respondWithResult(_0x1a0dd2,null))[_0xfdaf('0x47')](handleError(_0x1a0dd2,null));};exports[_0xfdaf('0x26')]=function(_0x284985,_0x39d87a){return db['OpenchannelApplication'][_0xfdaf('0x46')]({'where':{'id':_0x284985[_0xfdaf('0x44')]['id']}})[_0xfdaf('0x25')](handleEntityNotFound(_0x39d87a,null))[_0xfdaf('0x25')](removeEntity(_0x39d87a,null))[_0xfdaf('0x47')](handleError(_0x39d87a,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index ff5a833..808171c 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 _0x6dc4=['./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x6dc4,0x197));var _0x46dc=function(_0x3e02c5,_0x3c1007){_0x3e02c5=_0x3e02c5-0x0;var _0x4f64f5=_0x6dc4[_0x3e02c5];return _0x4f64f5;};'use strict';var _=require(_0x46dc('0x0'));var util=require(_0x46dc('0x1'));var logger=require(_0x46dc('0x2'))('api');var moment=require(_0x46dc('0x3'));var BPromise=require(_0x46dc('0x4'));var rp=require(_0x46dc('0x5'));var fs=require('fs');var path=require(_0x46dc('0x6'));var rimraf=require(_0x46dc('0x7'));var config=require(_0x46dc('0x8'));var attributes=require(_0x46dc('0x9'));module[_0x46dc('0xa')]=function(_0x4ee795,_0x47274e){return _0x4ee795[_0x46dc('0xb')](_0x46dc('0xc'),attributes,{'tableName':_0x46dc('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x46dc('0xe'),'collate':_0x46dc('0xf')});}; \ No newline at end of file +var _0x279f=['path','rimraf','./openchannelApplication.attributes','exports','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3ef3ca,_0x4556f3){var _0x4a9930=function(_0x1eca22){while(--_0x1eca22){_0x3ef3ca['push'](_0x3ef3ca['shift']());}};_0x4a9930(++_0x4556f3);}(_0x279f,0x182));var _0xf279=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x279f[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0xf279('0x0'));var util=require('util');var logger=require(_0xf279('0x1'))(_0xf279('0x2'));var moment=require(_0xf279('0x3'));var BPromise=require(_0xf279('0x4'));var rp=require(_0xf279('0x5'));var fs=require('fs');var path=require(_0xf279('0x6'));var rimraf=require(_0xf279('0x7'));var config=require('../../config/environment');var attributes=require(_0xf279('0x8'));module[_0xf279('0x9')]=function(_0x29e27b,_0xf71f4c){return _0x29e27b['define'](_0xf279('0xa'),attributes,{'tableName':_0xf279('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf279('0xc'),'collate':_0xf279('0xd')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 4c5f695..7bdafc6 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 _0xff46=['body','options','attributes','limit','then','debug','lodash','util','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','OpenchannelApplication,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','UpdateOpenchannelApplication','update'];(function(_0x2f10e3,_0x5018fe){var _0x37264=function(_0x6e2ce1){while(--_0x6e2ce1){_0x2f10e3['push'](_0x2f10e3['shift']());}};_0x37264(++_0x5018fe);}(_0xff46,0xd6));var _0x6ff4=function(_0x41094d,_0x4ca21d){_0x41094d=_0x41094d-0x0;var _0x503ee1=_0xff46[_0x41094d];return _0x503ee1;};'use strict';var _=require(_0x6ff4('0x0'));var util=require(_0x6ff4('0x1'));var moment=require('moment');var BPromise=require(_0x6ff4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6ff4('0x3'));var logger=require(_0x6ff4('0x4'))(_0x6ff4('0x5'));var config=require('../../config/environment');var jayson=require(_0x6ff4('0x6'));var client=jayson[_0x6ff4('0x7')][_0x6ff4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2f0827,_0x58548b,_0x465d65){return new BPromise(function(_0x4eceb4,_0x282028){return client['request'](_0x2f0827,_0x465d65)['then'](function(_0x1218dd){logger[_0x6ff4('0x9')](_0x6ff4('0xa'),_0x58548b,'request\x20sent');logger['debug']('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x58548b,'request\x20sent',JSON[_0x6ff4('0xb')](_0x1218dd));if(_0x1218dd[_0x6ff4('0xc')]){if(_0x1218dd['error'][_0x6ff4('0xd')]===0x1f4){logger['error'](_0x6ff4('0xa'),_0x58548b,_0x1218dd[_0x6ff4('0xc')][_0x6ff4('0xe')]);return _0x282028(_0x1218dd['error'][_0x6ff4('0xe')]);}logger['error'](_0x6ff4('0xa'),_0x58548b,_0x1218dd[_0x6ff4('0xc')][_0x6ff4('0xe')]);return _0x4eceb4(_0x1218dd[_0x6ff4('0xc')][_0x6ff4('0xe')]);}else{logger[_0x6ff4('0x9')](_0x6ff4('0xa'),_0x58548b,_0x6ff4('0xf'));_0x4eceb4(_0x1218dd[_0x6ff4('0x10')][_0x6ff4('0xe')]);}})[_0x6ff4('0x11')](function(_0x592876){logger[_0x6ff4('0xc')](_0x6ff4('0xa'),_0x58548b,_0x592876);_0x282028(_0x592876);});});}exports[_0x6ff4('0x12')]=function(_0x495290){var _0x2ed3fa=this;return new Promise(function(_0x37a12a,_0x1e0c22){return db['OpenchannelApplication'][_0x6ff4('0x13')](_0x495290[_0x6ff4('0x14')],{'raw':_0x495290[_0x6ff4('0x15')]?_0x495290[_0x6ff4('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x495290['options']?_0x495290[_0x6ff4('0x15')]['where']||null:null,'attributes':_0x495290['options']?_0x495290[_0x6ff4('0x15')][_0x6ff4('0x16')]||null:null,'limit':_0x495290[_0x6ff4('0x15')]?_0x495290[_0x6ff4('0x15')][_0x6ff4('0x17')]||null:null})[_0x6ff4('0x18')](function(_0xa9befd){logger[_0x6ff4('0x9')](_0x6ff4('0x12'),_0x495290);logger[_0x6ff4('0x19')](_0x6ff4('0x12'),_0x495290,JSON['stringify'](_0xa9befd));_0x37a12a(_0xa9befd);})[_0x6ff4('0x11')](function(_0x34b9cf){logger[_0x6ff4('0xc')](_0x6ff4('0x12'),_0x34b9cf['message'],_0x495290);_0x1e0c22(_0x2ed3fa[_0x6ff4('0xc')](0x1f4,_0x34b9cf['message']));});});}; \ No newline at end of file +var _0xa965=['OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','request','then'];(function(_0x49ea1a,_0x1c7e5e){var _0x16c57b=function(_0x587019){while(--_0x587019){_0x49ea1a['push'](_0x49ea1a['shift']());}};_0x16c57b(++_0x1c7e5e);}(_0xa965,0xa8));var _0x5a96=function(_0x1c80e9,_0x3b7f77){_0x1c80e9=_0x1c80e9-0x0;var _0x509563=_0xa965[_0x1c80e9];return _0x509563;};'use strict';var _=require(_0x5a96('0x0'));var util=require(_0x5a96('0x1'));var moment=require(_0x5a96('0x2'));var BPromise=require(_0x5a96('0x3'));var rs=require(_0x5a96('0x4'));var fs=require('fs');var Redis=require(_0x5a96('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5a96('0x6'))(_0x5a96('0x7'));var config=require('../../config/environment');var jayson=require(_0x5a96('0x8'));var client=jayson[_0x5a96('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20ecaf,_0x5b8767,_0x5a961a){return new BPromise(function(_0x12de49,_0xe906a6){return client[_0x5a96('0xa')](_0x20ecaf,_0x5a961a)[_0x5a96('0xb')](function(_0x17e575){logger['info'](_0x5a96('0xc'),_0x5b8767,_0x5a96('0xd'));logger[_0x5a96('0xe')](_0x5a96('0xf'),_0x5b8767,_0x5a96('0xd'),JSON[_0x5a96('0x10')](_0x17e575));if(_0x17e575['error']){if(_0x17e575['error'][_0x5a96('0x11')]===0x1f4){logger[_0x5a96('0x12')](_0x5a96('0xc'),_0x5b8767,_0x17e575[_0x5a96('0x12')][_0x5a96('0x13')]);return _0xe906a6(_0x17e575[_0x5a96('0x12')]['message']);}logger[_0x5a96('0x12')]('OpenchannelApplication,\x20%s,\x20%s',_0x5b8767,_0x17e575['error']['message']);return _0x12de49(_0x17e575[_0x5a96('0x12')][_0x5a96('0x13')]);}else{logger[_0x5a96('0x14')](_0x5a96('0xc'),_0x5b8767,_0x5a96('0xd'));_0x12de49(_0x17e575['result']['message']);}})[_0x5a96('0x15')](function(_0x42d05a){logger[_0x5a96('0x12')](_0x5a96('0xc'),_0x5b8767,_0x42d05a);_0xe906a6(_0x42d05a);});});}exports[_0x5a96('0x16')]=function(_0x5babf8){var _0x566c27=this;return new Promise(function(_0x2bb985,_0x34fd0b){return db[_0x5a96('0x17')][_0x5a96('0x18')](_0x5babf8[_0x5a96('0x19')],{'raw':_0x5babf8[_0x5a96('0x1a')]?_0x5babf8['options'][_0x5a96('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5babf8[_0x5a96('0x1a')]?_0x5babf8['options'][_0x5a96('0x1c')]||null:null,'attributes':_0x5babf8['options']?_0x5babf8[_0x5a96('0x1a')][_0x5a96('0x1d')]||null:null,'limit':_0x5babf8[_0x5a96('0x1a')]?_0x5babf8[_0x5a96('0x1a')]['limit']||null:null})[_0x5a96('0xb')](function(_0x393806){logger[_0x5a96('0x14')](_0x5a96('0x16'),_0x5babf8);logger[_0x5a96('0xe')](_0x5a96('0x16'),_0x5babf8,JSON[_0x5a96('0x10')](_0x393806));_0x2bb985(_0x393806);})[_0x5a96('0x15')](function(_0x274f6e){logger[_0x5a96('0x12')](_0x5a96('0x16'),_0x274f6e[_0x5a96('0x13')],_0x5babf8);_0x34fd0b(_0x566c27[_0x5a96('0x12')](0x1f4,_0x274f6e[_0x5a96('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 85c1553..b30ddf5 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 _0xacdd=['openchannelinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','openchannel','put','update'];(function(_0x120bc2,_0x57a253){var _0x454a41=function(_0x21adfe){while(--_0x21adfe){_0x120bc2['push'](_0x120bc2['shift']());}};_0x454a41(++_0x57a253);}(_0xacdd,0x18b));var _0xdacd=function(_0x2e1387,_0x2fd52a){_0x2e1387=_0x2e1387-0x0;var _0xda65a6=_0xacdd[_0x2e1387];return _0xda65a6;};'use strict';var multer=require(_0xdacd('0x0'));var util=require(_0xdacd('0x1'));var path=require(_0xdacd('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xdacd('0x3'));var auth=require(_0xdacd('0x4'));var interaction=require(_0xdacd('0x5'));var config=require('../../config/environment');var controller=require(_0xdacd('0x6'));router[_0xdacd('0x7')]('/',auth[_0xdacd('0x8')](),controller['index']);router[_0xdacd('0x7')](_0xdacd('0x9'),auth[_0xdacd('0x8')](),controller[_0xdacd('0xa')]);router['get'](_0xdacd('0xb'),auth[_0xdacd('0x8')](),controller[_0xdacd('0xc')]);router[_0xdacd('0x7')](_0xdacd('0xd'),auth[_0xdacd('0x8')](),controller[_0xdacd('0xe')]);router['get'](_0xdacd('0xf'),auth[_0xdacd('0x8')](),controller[_0xdacd('0x10')]);router['post']('/',auth[_0xdacd('0x8')](),controller[_0xdacd('0x11')]);router[_0xdacd('0x12')]('/:id/messages',auth[_0xdacd('0x8')](),controller[_0xdacd('0x13')]);router[_0xdacd('0x12')](_0xdacd('0x14'),auth[_0xdacd('0x8')](),interaction[_0xdacd('0x15')](_0xdacd('0x16'),'openchannelinteraction:addtags'),controller['addTags']);router[_0xdacd('0x17')]('/:id',auth[_0xdacd('0x8')](),interaction[_0xdacd('0x15')](_0xdacd('0x16'),'openchannelinteraction:update'),controller[_0xdacd('0x18')]);router['delete'](_0xdacd('0xb'),auth[_0xdacd('0x8')](),interaction[_0xdacd('0x15')](_0xdacd('0x16'),_0xdacd('0x19')),controller[_0xdacd('0x1a')]);router[_0xdacd('0x1b')](_0xdacd('0x14'),auth[_0xdacd('0x8')](),controller[_0xdacd('0x1c')]);module[_0xdacd('0x1d')]=router; \ No newline at end of file +var _0x58d3=['delete','openchannelinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','create','/:id/tags','openchannel','addTags','put','/:id','tracked','openchannelinteraction:update'];(function(_0x3af19c,_0x1c2581){var _0x239f6d=function(_0x341eca){while(--_0x341eca){_0x3af19c['push'](_0x3af19c['shift']());}};_0x239f6d(++_0x1c2581);}(_0x58d3,0xde));var _0x358d=function(_0xaf661d,_0x386e1c){_0xaf661d=_0xaf661d-0x0;var _0x5635a4=_0x58d3[_0xaf661d];return _0x5635a4;};'use strict';var multer=require(_0x358d('0x0'));var util=require(_0x358d('0x1'));var path=require(_0x358d('0x2'));var timeout=require(_0x358d('0x3'));var express=require(_0x358d('0x4'));var router=express['Router']();var fs_extra=require(_0x358d('0x5'));var auth=require(_0x358d('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x358d('0x7'));router[_0x358d('0x8')]('/',auth[_0x358d('0x9')](),controller[_0x358d('0xa')]);router['get'](_0x358d('0xb'),auth['isAuthenticated'](),controller[_0x358d('0xc')]);router[_0x358d('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x358d('0xd')]);router[_0x358d('0x8')](_0x358d('0xe'),auth['isAuthenticated'](),controller[_0x358d('0xf')]);router[_0x358d('0x8')](_0x358d('0x10'),auth[_0x358d('0x9')](),controller[_0x358d('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x358d('0x12')]);router['post'](_0x358d('0xe'),auth[_0x358d('0x9')](),controller['addMessage']);router['post'](_0x358d('0x13'),auth[_0x358d('0x9')](),interaction['tracked'](_0x358d('0x14'),'openchannelinteraction:addtags'),controller[_0x358d('0x15')]);router[_0x358d('0x16')](_0x358d('0x17'),auth['isAuthenticated'](),interaction[_0x358d('0x18')]('openchannel',_0x358d('0x19')),controller['update']);router[_0x358d('0x1a')]('/:id',auth[_0x358d('0x9')](),interaction[_0x358d('0x18')](_0x358d('0x14'),_0x358d('0x1b')),controller[_0x358d('0x1c')]);router[_0x358d('0x1a')](_0x358d('0x13'),auth['isAuthenticated'](),controller[_0x358d('0x1d')]);module[_0x358d('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index c21268e..3afbd30 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 _0xcb3c=['sequelize','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xcb3c,0x150));var _0xccb3=function(_0x28237e,_0x2a7f11){_0x28237e=_0x28237e-0x0;var _0x1c014b=_0xcb3c[_0x28237e];return _0x1c014b;};'use strict';var Sequelize=require(_0xccb3('0x0'));module[_0xccb3('0x1')]={'closed':{'type':Sequelize[_0xccb3('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xccb3('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xccb3('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xccb3('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0xccb3('0x4')]},'externalUrl':{'type':Sequelize[_0xccb3('0x4')]},'lastMsgAt':{'type':Sequelize[_0xccb3('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xccb3('0x5')]('in',_0xccb3('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xccb3('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0xccb3('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xe1f0=['exports','BOOLEAN','STRING','DATE','ENUM'];(function(_0x330db6,_0x1a3b58){var _0x2c0aa3=function(_0x1545b5){while(--_0x1545b5){_0x330db6['push'](_0x330db6['shift']());}};_0x2c0aa3(++_0x1a3b58);}(_0xe1f0,0x1c2));var _0x0e1f=function(_0x1ff7b4,_0x502d9f){_0x1ff7b4=_0x1ff7b4-0x0;var _0x364284=_0xe1f0[_0x1ff7b4];return _0x364284;};'use strict';var Sequelize=require('sequelize');module[_0x0e1f('0x0')]={'closed':{'type':Sequelize[_0x0e1f('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x0e1f('0x2')]},'secondDisposition':{'type':Sequelize[_0x0e1f('0x2')]},'thirdDisposition':{'type':Sequelize[_0x0e1f('0x2')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x0e1f('0x3')]},'threadId':{'type':Sequelize[_0x0e1f('0x2')]},'externalUrl':{'type':Sequelize[_0x0e1f('0x2')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x0e1f('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x0e1f('0x2')]},'autoreplyExecuted':{'type':Sequelize[_0x0e1f('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 423f4bb..c2db156 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 _0xe3c7=['c.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','catch','params','include','merge','options','create','update','describe','addMessage','OpenchannelMessage','ids','findOne','findAll','setTags','omit','spread','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','tmp','server','files','attachments','format','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','direction','secret','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','threadId','Public','Private','Messages','basename','createReadStream','pipe','out','System','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./openchannelInteraction.socket','status','json','undefined','count','offset','limit','set','apply','reject','then','destroy','end','sendStatus','error','name','send','Users','map','fullname','TagIds','split','forEach','Tags','push','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','left_join','users','u.id\x20=\x20ui.UserId','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','expr','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','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?','UserId','body','some','compact','isEmpty','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.id','Sequelize','QueryTypes','order','contactName','DESC','t.id\x20IN\x20?','OpenchannelAccountId','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','c.email','Contact.email'];(function(_0x14bf63,_0xdbd373){var _0x410d22=function(_0x2e5e3a){while(--_0x2e5e3a){_0x14bf63['push'](_0x14bf63['shift']());}};_0x410d22(++_0xdbd373);}(_0xe3c7,0x138));var _0x7e3c=function(_0xecb7da,_0x1bcc50){_0xecb7da=_0xecb7da-0x0;var _0x571c35=_0xe3c7[_0xecb7da];return _0x571c35;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7e3c('0x0'));var zipdir=require(_0x7e3c('0x1'));var jsonpatch=require(_0x7e3c('0x2'));var rp=require(_0x7e3c('0x3'));var moment=require(_0x7e3c('0x4'));var BPromise=require(_0x7e3c('0x5'));var Mustache=require(_0x7e3c('0x6'));var util=require(_0x7e3c('0x7'));var path=require(_0x7e3c('0x8'));var sox=require(_0x7e3c('0x9'));var csv=require('to-csv');var ejs=require(_0x7e3c('0xa'));var fs=require('fs');var fs_extra=require(_0x7e3c('0xb'));var _=require('lodash');var squel=require(_0x7e3c('0xc'));var crypto=require('crypto');var jsforce=require(_0x7e3c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7e3c('0xe'));var querystring=require(_0x7e3c('0xf'));var Papa=require(_0x7e3c('0x10'));var Redis=require(_0x7e3c('0x11'));var authService=require(_0x7e3c('0x12'));var qs=require(_0x7e3c('0x13'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x7e3c('0x14'));var hardwareService=require(_0x7e3c('0x15'));var logger=require(_0x7e3c('0x16'))(_0x7e3c('0x17'));var utils=require('../../config/utils');var config=require(_0x7e3c('0x18'));var licenseUtil=require(_0x7e3c('0x19'));var db=require(_0x7e3c('0x1a'))['db'];config['redis']=_[_0x7e3c('0x1b')](config[_0x7e3c('0x1c')],{'host':_0x7e3c('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7e3c('0x1c')]));require(_0x7e3c('0x1e'))['register'](socket);function respondWithStatusCode(_0x5ae93d,_0x2f248f){_0x2f248f=_0x2f248f||0xcc;return function(_0x18114e){if(_0x18114e){return _0x5ae93d['sendStatus'](_0x2f248f);}return _0x5ae93d[_0x7e3c('0x1f')](_0x2f248f)['end']();};}function respondWithResult(_0x1e5296,_0xcc3c2a){_0xcc3c2a=_0xcc3c2a||0xc8;return function(_0x3a9a0d){if(_0x3a9a0d){return _0x1e5296[_0x7e3c('0x1f')](_0xcc3c2a)[_0x7e3c('0x20')](_0x3a9a0d);}};}function respondWithFilteredResult(_0xf9d744,_0x68baf){return function(_0x3b4afa){if(_0x3b4afa){var _0x5f14ce=typeof _0x68baf['offset']===_0x7e3c('0x21')&&typeof _0x68baf['limit']==='undefined';var _0x45482a=_0x3b4afa[_0x7e3c('0x22')];var _0x1acbf8=_0x5f14ce?0x0:_0x68baf['offset'];var _0x55024c=_0x5f14ce?_0x3b4afa[_0x7e3c('0x22')]:_0x68baf[_0x7e3c('0x23')]+_0x68baf[_0x7e3c('0x24')];var _0x5eecef;if(_0x55024c>=_0x45482a){_0x55024c=_0x45482a;_0x5eecef=0xc8;}else{_0x5eecef=0xce;}_0xf9d744[_0x7e3c('0x1f')](_0x5eecef);return _0xf9d744[_0x7e3c('0x25')]('Content-Range',_0x1acbf8+'-'+_0x55024c+'/'+_0x45482a)['json'](_0x3b4afa);}return null;};}function patchUpdates(_0x27717f){return function(_0x256280){try{jsonpatch[_0x7e3c('0x26')](_0x256280,_0x27717f,!![]);}catch(_0x10f084){return BPromise[_0x7e3c('0x27')](_0x10f084);}return _0x256280['save']();};}function saveUpdates(_0xcd018a,_0x3fc776){return function(_0x54cfb7){if(_0x54cfb7){return _0x54cfb7['update'](_0xcd018a)[_0x7e3c('0x28')](function(_0x33ed12){return _0x33ed12;});}return null;};}function removeEntity(_0x52e657,_0x43c1b5){return function(_0x4d696a){if(_0x4d696a){return _0x4d696a[_0x7e3c('0x29')]()['then'](function(){_0x52e657['status'](0xcc)[_0x7e3c('0x2a')]();});}};}function handleEntityNotFound(_0x37076e,_0x38aa31){return function(_0xce6568){if(!_0xce6568){_0x37076e[_0x7e3c('0x2b')](0x194);}return _0xce6568;};}function handleError(_0x2894a8,_0x4910c5){_0x4910c5=_0x4910c5||0x1f4;return function(_0x8625be){logger[_0x7e3c('0x2c')](_0x8625be['stack']);if(_0x8625be[_0x7e3c('0x2d')]){delete _0x8625be[_0x7e3c('0x2d')];}_0x2894a8[_0x7e3c('0x1f')](_0x4910c5)[_0x7e3c('0x2e')](_0x8625be);};}function getInteractionUsers(_0x2f2a83,_0x319cdf){return new BPromise(function(_0x15f30b,_0x532133){try{if(_0x319cdf[_0x2f2a83['id']]){_0x2f2a83[_0x7e3c('0x2f')]=_[_0x7e3c('0x30')](_0x319cdf[_0x2f2a83['id']],function(_0x166207){return{'id':_0x166207['id'],'fullname':_0x166207[_0x7e3c('0x31')]};});}}catch(_0x686129){_0x532133(_0x686129);}_0x15f30b(_0x2f2a83);});}function getInteractionTags(_0x32b761,_0x3b6131){return new BPromise(function(_0x25ee4b,_0x2dcb14){try{if(_0x32b761[_0x7e3c('0x32')]){_0x32b761['Tags']=[];_0x32b761[_0x7e3c('0x32')][_0x7e3c('0x33')](',')[_0x7e3c('0x34')](function(_0x58d1b1){_0x32b761[_0x7e3c('0x35')][_0x7e3c('0x36')](_0x3b6131[_0x58d1b1]);});}delete _0x32b761['TagIds'];}catch(_0x3942dc){_0x2dcb14(_0x3942dc);}_0x25ee4b(_0x32b761);});}function updateOpenchannelInteraction(_0x3912ad,_0x3df6f8,_0x288e0d){return new BPromise(function(_0xb9c630,_0x4266d4){return getInteractionUsers(_0x3912ad,_0x288e0d)[_0x7e3c('0x28')](function(_0x2e11df){return getInteractionTags(_0x2e11df,_0x3df6f8);})[_0x7e3c('0x28')](function(_0x1c732d){_0xb9c630(_0x1c732d);})['catch'](function(_0x410834){_0x4266d4(_0x410834);});});}exports[_0x7e3c('0x37')]=function(_0xae46cb,_0x46c27a){var _0x37de6d={},_0x543755={},_0x102eb1={'count':0x0,'rows':[]};var _0x838faf=_[_0x7e3c('0x30')](db[_0x7e3c('0x38')][_0x7e3c('0x39')],function(_0x4b3797){return{'name':_0x4b3797[_0x7e3c('0x3a')],'type':_0x4b3797[_0x7e3c('0x3b')][_0x7e3c('0x3c')]};});_0x543755[_0x7e3c('0x3d')]=_['map'](_0x838faf,_0x7e3c('0x2d'));_0x543755[_0x7e3c('0x3e')]=_[_0x7e3c('0x3f')](_0xae46cb['query']);_0x543755[_0x7e3c('0x40')]=_[_0x7e3c('0x41')](_0x543755[_0x7e3c('0x3d')],_0x543755['query']);_0x37de6d[_0x7e3c('0x42')]=_[_0x7e3c('0x41')](_0x543755['model'],qs[_0x7e3c('0x43')](_0xae46cb[_0x7e3c('0x3e')]['fields']));_0x37de6d[_0x7e3c('0x42')]=_0x37de6d['attributes'][_0x7e3c('0x44')]?_0x37de6d[_0x7e3c('0x42')]:_0x543755['model'];if(!_0xae46cb['query'][_0x7e3c('0x45')](_0x7e3c('0x46'))){_0x37de6d[_0x7e3c('0x24')]=qs['limit'](_0xae46cb[_0x7e3c('0x3e')]['limit']);_0x37de6d[_0x7e3c('0x23')]=qs[_0x7e3c('0x23')](_0xae46cb['query'][_0x7e3c('0x23')]);}_0x37de6d['order']=qs[_0x7e3c('0x47')](_0xae46cb[_0x7e3c('0x3e')][_0x7e3c('0x47')]);_0x37de6d[_0x7e3c('0x48')]=qs['filters'](_[_0x7e3c('0x49')](_0xae46cb[_0x7e3c('0x3e')],_0x543755[_0x7e3c('0x40')]),_0x838faf);var _0x2a2351=[];var _0x48bdfd=squel[_0x7e3c('0x4a')]()[_0x7e3c('0x4b')]('id')[_0x7e3c('0x4b')](_0x7e3c('0x2d'))[_0x7e3c('0x4b')](_0x7e3c('0x4c'))[_0x7e3c('0x4d')](_0x7e3c('0x4e'));var _0x2d0cb5=squel['select']()[_0x7e3c('0x4b')](_0x7e3c('0x4f'))[_0x7e3c('0x4b')](_0x7e3c('0x50'))[_0x7e3c('0x4b')]('ui.OpenchannelInteractionId')[_0x7e3c('0x4d')]('user_has_openchannel_interactions','ui')[_0x7e3c('0x51')](_0x7e3c('0x52'),'u',_0x7e3c('0x53'));var _0x41f67c=squel[_0x7e3c('0x4a')]()[_0x7e3c('0x4d')]('openchannel_interactions','i')[_0x7e3c('0x51')]('cm_contacts','c',_0x7e3c('0x54'))['left_join']('users','o','o.id\x20=\x20i.UserId')[_0x7e3c('0x51')](_0x7e3c('0x55'),'a',_0x7e3c('0x56'))[_0x7e3c('0x51')]('openchannel_messages','me',_0x7e3c('0x57'))[_0x7e3c('0x51')](_0x7e3c('0x58'),'it',_0x7e3c('0x59'))['left_join'](_0x7e3c('0x4e'),'t','t.id\x20=\x20it.TagId');var _0x3bcc14=squel[_0x7e3c('0x5a')]();var _0x25bd87=[];var _0x501896=squel[_0x7e3c('0x5a')]();var _0x3a2fe0;if(_0xae46cb[_0x7e3c('0x3e')][_0x7e3c('0x5b')]){_0x3a2fe0=as['parseSearch'](_0xae46cb['query'][_0x7e3c('0x5b')]);var _0x479144=_0x3a2fe0[_0x7e3c('0x5c')];for(var _0xf9e1c3=0x0;_0xf9e1c3<_0x3a2fe0[_0x7e3c('0x5d')]['length'];_0xf9e1c3++){var _0x2556c5=_0x3a2fe0[_0x7e3c('0x5d')][_0xf9e1c3];var _0x782a5b='i';var _0x4c4812=_[_0x7e3c('0x5e')](_0x838faf,['name',_0x2556c5[_0x7e3c('0x4b')]]);if(!_0x4c4812){switch(_0x2556c5['field']){case _0x7e3c('0x5f'):if(_0x2556c5[_0x7e3c('0x60')]==0x1){_0x41f67c[_0x7e3c('0x61')]('`'+_0x2556c5[_0x7e3c('0x4b')]+_0x7e3c('0x62'));}else{_0x41f67c[_0x7e3c('0x61')]('`'+_0x2556c5[_0x7e3c('0x4b')]+_0x7e3c('0x63'));}break;case _0x7e3c('0x64'):if(_0x2556c5[_0x7e3c('0x65')]===_0x7e3c('0x66')){if(_0x2556c5[_0x7e3c('0x60')]['split']('\x20')['length']>0x1){_0x3bcc14[_0x479144](_0x7e3c('0x67'),qs[_0x7e3c('0x68')](_0x2556c5['value']),null);}else{var _0x2b58d3='%'+_0x2556c5[_0x7e3c('0x60')]+'%';_0x3bcc14[_0x479144](_0x7e3c('0x69'),_0x2b58d3,_0x2b58d3,_0x2b58d3);}}else{_0x4c4812=_['find'](_0x838faf,['name',_0x7e3c('0x6a')]);_0x2556c5[_0x7e3c('0x4b')]=_0x7e3c('0x6a');_0x4a34de=as[_0x7e3c('0x6b')](_0x782a5b,_0x4c4812[_0x7e3c('0x3b')],_0x2556c5);_0x3bcc14[_0x479144](_0x4a34de[_0x7e3c('0x6c')],_0x4a34de[_0x7e3c('0x60')][_0x7e3c('0x6d')],_0x4a34de[_0x7e3c('0x60')][_0x7e3c('0x2a')]);}break;case _0x7e3c('0x6e'):var _0x1e15be=_0x2556c5['value'][_0x7e3c('0x33')](',')['map'](function(_0x5ad043){return Number(_0x5ad043);});_0x1e15be[_0x7e3c('0x34')](function(_0x397e20){_0x501896['or'](_0x7e3c('0x6f'),'%,'+_0x397e20+',%');});_0x25bd87=_[_0x7e3c('0x70')](_0x25bd87,_0x1e15be);break;case _0x7e3c('0x71'):if(_0x2556c5[_0x7e3c('0x65')]==='$substring'){_0x3bcc14[_0x479144](_0x7e3c('0x72'),'%'+_0x2556c5['value']+'%',null);}else{_0x4c4812=_[_0x7e3c('0x5e')](_0x838faf,[_0x7e3c('0x2d'),_0x7e3c('0x73')]);_0x2556c5[_0x7e3c('0x4b')]=_0x7e3c('0x73');_0x4a34de=as[_0x7e3c('0x6b')](_0x782a5b,_0x4c4812[_0x7e3c('0x3b')],_0x2556c5);_0x3bcc14[_0x479144](_0x4a34de[_0x7e3c('0x6c')],_0x4a34de[_0x7e3c('0x60')][_0x7e3c('0x6d')],_0x4a34de['value'][_0x7e3c('0x2a')]);}break;case _0x7e3c('0x74'):_0x4a34de=as[_0x7e3c('0x6b')]('me',null,_0x2556c5);_0x3bcc14[_0x479144](_0x4a34de[_0x7e3c('0x6c')],_0x4a34de[_0x7e3c('0x60')][_0x7e3c('0x6d')],_0x4a34de['value']['end']);break;}}else{var _0x4a34de=as['buildExpression'](_0x782a5b,_0x4c4812['type'],_0x2556c5);_0x3bcc14[_0x479144](_0x4a34de[_0x7e3c('0x6c')],_0x4a34de[_0x7e3c('0x60')][_0x7e3c('0x6d')],_0x4a34de[_0x7e3c('0x60')][_0x7e3c('0x2a')]);}}}else{var _0x55a390=_(_0xae46cb['query'])[_0x7e3c('0x3f')]()[_0x7e3c('0x30')](function(_0xb41749){return _[_0x7e3c('0x75')](_0x838faf,[_0x7e3c('0x2d'),_0xb41749])?_0xb41749:undefined;})[_0x7e3c('0x76')]()[_0x7e3c('0x60')]();if(!_[_0x7e3c('0x77')](_0x55a390)){_0x55a390['forEach'](function(_0x2f13f9){if(_0x2f13f9==='OpenchannelAccountId'){_0x41f67c['where'](_0x7e3c('0x78'),[][_0x7e3c('0x79')](_0xae46cb[_0x7e3c('0x3e')][_0x2f13f9]));}else if(_0x2f13f9===_0x7e3c('0x7a')){var _0x5bb555=JSON[_0x7e3c('0x7b')](_0xae46cb[_0x7e3c('0x3e')][_0x2f13f9])[_0x7e3c('0x7c')];var _0x2d8d8b=JSON['parse'](_0xae46cb[_0x7e3c('0x3e')][_0x2f13f9])['$lte'];_0x41f67c[_0x7e3c('0x48')](_0x7e3c('0x7d'),_0x5bb555,_0x2d8d8b);}else{if(_0xae46cb['query'][_0x2f13f9]==='null'){_0x41f67c[_0x7e3c('0x48')]('i.'+_0x2f13f9+_0x7e3c('0x7e'));}else{_0x41f67c[_0x7e3c('0x48')]('i.'+_0x2f13f9+_0x7e3c('0x7f'),_0xae46cb[_0x7e3c('0x3e')][_0x2f13f9]);}}});}if(_0xae46cb[_0x7e3c('0x3e')][_0x7e3c('0x80')]){if(_0xae46cb[_0x7e3c('0x3e')][_0x7e3c('0x80')]==0x1){_0x41f67c['having']('`unreadMessages`\x20=\x200');}else{_0x41f67c[_0x7e3c('0x61')](_0x7e3c('0x81'));}}if(_0xae46cb['query'][_0x7e3c('0x82')]){_0x25bd87=_['isArray'](_0xae46cb[_0x7e3c('0x3e')][_0x7e3c('0x82')])?_0xae46cb[_0x7e3c('0x3e')][_0x7e3c('0x82')]:new Array(_0xae46cb['query']['tag']);_0x25bd87[_0x7e3c('0x34')](function(_0x29bff0){_0x501896['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x29bff0+',%');});}if(_0xae46cb[_0x7e3c('0x3e')]['filter']){var _0x59c3d1=_0xae46cb[_0x7e3c('0x3e')][_0x7e3c('0x83')]['replace']('\x5c','\x5c\x5c')[_0x7e3c('0x84')](/'/g,'\x27\x27');if(qs[_0x7e3c('0x85')](_0x59c3d1)){_0x3bcc14['or']('i.id\x20LIKE\x20?',_0x59c3d1+'%');}else{_0x3bcc14['or'](_0x7e3c('0x86'),qs['getFullTextValue'](_0x59c3d1))['or']('i.from\x20LIKE\x20?',_0x59c3d1+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x59c3d1+'%');}}}_0x41f67c[_0x7e3c('0x48')](_0x3bcc14);_0x41f67c['group'](_0x7e3c('0x87'));var _0x1acb58={'type':db[_0x7e3c('0x88')][_0x7e3c('0x89')]['SELECT'],'raw':!![]};var _0x30111f=_0x41f67c['clone']();_0x30111f[_0x7e3c('0x4b')](_0x7e3c('0x87'));_0x30111f[_0x7e3c('0x4b')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x7e3c('0x5f'));if(_0x37de6d[_0x7e3c('0x8a')]){_0x37de6d[_0x7e3c('0x8a')][_0x7e3c('0x34')](function(_0x43f0c9){var _0x453adf=_0x43f0c9[0x0]===_0x7e3c('0x8b')?_0x43f0c9[0x0]:'i.'+_0x43f0c9[0x0];_0x41f67c[_0x7e3c('0x8a')](_0x453adf,_0x43f0c9[0x1]===_0x7e3c('0x8c')?![]:!![]);});}if(!_['isEmpty'](_0x25bd87)){_0x41f67c[_0x7e3c('0x61')](_0x501896);_0x30111f['where'](_0x7e3c('0x8d'),_0x25bd87);}BPromise['resolve']()['then'](function(){if(!_0x3a2fe0){if(_0xae46cb['query'][_0x7e3c('0x8e')])return;_0x30111f[_0x7e3c('0x48')](_0x7e3c('0x8f'));_0x41f67c[_0x7e3c('0x48')](_0x7e3c('0x8f'));return;}if(_0xae46cb[_0x7e3c('0x90')][_0x7e3c('0x91')]!=='agent')return;return _0xae46cb[_0x7e3c('0x90')][_0x7e3c('0x92')]({'attributes':['id'],'raw':!![]})[_0x7e3c('0x28')](function(_0x48b620){if(_['isEmpty'](_0x48b620)){_0x30111f[_0x7e3c('0x48')](_0x7e3c('0x93'));_0x41f67c[_0x7e3c('0x48')](_0x7e3c('0x93'));}else{_0x30111f['where']('i.OpenchannelAccountId\x20IN\x20?',_[_0x7e3c('0x30')](_0x48b620,'id'));_0x41f67c[_0x7e3c('0x48')](_0x7e3c('0x78'),_[_0x7e3c('0x30')](_0x48b620,'id'));}});})[_0x7e3c('0x28')](function(){if(_0xae46cb[_0x7e3c('0x90')][_0x7e3c('0x91')]==='agent'&&!_0x3a2fe0&&!_0xae46cb[_0x7e3c('0x3e')][_0x7e3c('0x8e')])return[];return db[_0x7e3c('0x94')]['query'](_0x30111f[_0x7e3c('0x95')](),_0x1acb58);})[_0x7e3c('0x28')](function(_0x2a398){_0x102eb1[_0x7e3c('0x22')]=_0x2a398[_0x7e3c('0x44')];if(_0x102eb1[_0x7e3c('0x22')]===0x0)return[];return db[_0x7e3c('0x94')][_0x7e3c('0x3e')](_0x48bdfd[_0x7e3c('0x95')](),_0x1acb58)[_0x7e3c('0x28')](function(_0x1287d4){_0x2a2351=_['keyBy'](_0x1287d4,'id');_0x1acb58=_['merge'](_0x1acb58,{'model':db[_0x7e3c('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xae46cb[_0x7e3c('0x3e')][_0x7e3c('0x43')]){_0x37de6d[_0x7e3c('0x42')][_0x7e3c('0x34')](function(_0x4fc041){_0x41f67c[_0x7e3c('0x4b')]('i.'+_0x4fc041);});}else{_0x41f67c[_0x7e3c('0x4b')](_0x7e3c('0x96'),_0x7e3c('0x5f'));_0x41f67c['field'](_0x7e3c('0x97'),_0x7e3c('0x98'));_0x41f67c[_0x7e3c('0x4b')](_0x7e3c('0x99'),_0x7e3c('0x9a'));_0x41f67c[_0x7e3c('0x4b')]('CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x41f67c['field'](_0x7e3c('0x9b'));_0x41f67c['field'](_0x7e3c('0x9c'),'Contact.firstName');_0x41f67c[_0x7e3c('0x4b')](_0x7e3c('0x9d'),'Contact.lastName');_0x41f67c[_0x7e3c('0x4b')](_0x7e3c('0x9e'),_0x7e3c('0x9f'));_0x41f67c[_0x7e3c('0x4b')](_0x7e3c('0xa0'),'Contact.phone');_0x41f67c[_0x7e3c('0x4b')](_0x7e3c('0xa1'),_0x7e3c('0xa2'));_0x41f67c['field'](_0x7e3c('0xa3'),'Contact.fax');_0x41f67c[_0x7e3c('0x4b')](_0x7e3c('0xa4'),_0x7e3c('0xa5'));_0x41f67c[_0x7e3c('0x4b')](_0x7e3c('0xa6'),'Owner.internal');_0x41f67c['field'](_0x7e3c('0xa7'),_0x7e3c('0x32'));}if(_0x37de6d[_0x7e3c('0x24')])_0x41f67c[_0x7e3c('0x24')](_0x37de6d[_0x7e3c('0x24')]);if(_0x37de6d[_0x7e3c('0x23')])_0x41f67c[_0x7e3c('0x23')](_0x37de6d[_0x7e3c('0x23')]);return db['sequelize']['query'](_0x41f67c[_0x7e3c('0x95')](),_0x1acb58);})[_0x7e3c('0x28')](function(_0x2cbbbb){if(_0x2cbbbb[_0x7e3c('0x44')]>0x0)_0x2d0cb5['where'](_0x7e3c('0xa8'),_[_0x7e3c('0x30')](_0x2cbbbb,'id'));return db[_0x7e3c('0x94')]['query'](_0x2d0cb5[_0x7e3c('0x95')](),_0x1acb58)[_0x7e3c('0x28')](function(_0x137d7c){var _0x2a08e6=_[_0x7e3c('0xa9')](_0x137d7c,_0x7e3c('0xaa'));var _0x4b2f33=[];_0x2cbbbb[_0x7e3c('0x34')](function(_0x55f2d6){_0x4b2f33['push'](updateOpenchannelInteraction(_0x55f2d6,_0x2a2351,_0x2a08e6));});return BPromise[_0x7e3c('0xab')](_0x4b2f33);});});})[_0x7e3c('0x28')](function(_0x21ebc8){_0x102eb1[_0x7e3c('0xac')]=_0x21ebc8;return _0x102eb1;})['then'](respondWithFilteredResult(_0x46c27a,_0x37de6d))[_0x7e3c('0xad')](handleError(_0x46c27a,null));};exports['show']=function(_0xc95ac2,_0x3790b1){var _0x589a70={};if(_0xc95ac2[_0x7e3c('0x3e')][_0x7e3c('0x3b')]&&_0xc95ac2[_0x7e3c('0x3e')]['type']===_0x7e3c('0x4d')){_0x589a70[_0x7e3c('0x4d')]=_0xc95ac2[_0x7e3c('0xae')]['id'];}else{_0x589a70['id']=_0xc95ac2[_0x7e3c('0xae')]['id'];}var _0x38fb97={'raw':![],'where':_0x589a70},_0x2d0efe={};_0x2d0efe[_0x7e3c('0x3d')]=_[_0x7e3c('0x3f')](db[_0x7e3c('0x38')][_0x7e3c('0x39')]);_0x2d0efe[_0x7e3c('0x3e')]=_['keys'](_0xc95ac2[_0x7e3c('0x3e')]);_0x2d0efe[_0x7e3c('0x40')]=_[_0x7e3c('0x41')](_0x2d0efe[_0x7e3c('0x3d')],_0x2d0efe['query']);_0x38fb97[_0x7e3c('0x42')]=_[_0x7e3c('0x41')](_0x2d0efe['model'],qs['fields'](_0xc95ac2[_0x7e3c('0x3e')][_0x7e3c('0x43')]));_0x38fb97[_0x7e3c('0x42')]=_0x38fb97[_0x7e3c('0x42')][_0x7e3c('0x44')]?_0x38fb97['attributes']:_0x2d0efe[_0x7e3c('0x3d')];if(_0xc95ac2['query']['includeAll']){_0x38fb97[_0x7e3c('0xaf')]=[{'all':!![]}];}_0x38fb97=_[_0x7e3c('0xb0')]({},_0x38fb97,_0xc95ac2[_0x7e3c('0xb1')]);return db[_0x7e3c('0x38')][_0x7e3c('0x5e')](_0x38fb97)[_0x7e3c('0x28')](handleEntityNotFound(_0x3790b1,null))[_0x7e3c('0x28')](respondWithResult(_0x3790b1,null))[_0x7e3c('0xad')](handleError(_0x3790b1,null));};exports[_0x7e3c('0xb2')]=function(_0xcdc5a5,_0x37c7b7){return db['OpenchannelInteraction']['create'](_0xcdc5a5[_0x7e3c('0x74')],{})[_0x7e3c('0x28')](respondWithResult(_0x37c7b7,0xc9))[_0x7e3c('0xad')](handleError(_0x37c7b7,null));};exports[_0x7e3c('0xb3')]=function(_0x3f4570,_0x199968){if(_0x3f4570[_0x7e3c('0x74')]['id']){delete _0x3f4570['body']['id'];}return db['OpenchannelInteraction'][_0x7e3c('0x5e')]({'where':{'id':_0x3f4570['params']['id']}})[_0x7e3c('0x28')](handleEntityNotFound(_0x199968,null))[_0x7e3c('0x28')](saveUpdates(_0x3f4570[_0x7e3c('0x74')],null))[_0x7e3c('0x28')](respondWithResult(_0x199968,null))[_0x7e3c('0xad')](handleError(_0x199968,null));};exports[_0x7e3c('0x29')]=function(_0xe5826c,_0x4dbaa5){return db[_0x7e3c('0x38')][_0x7e3c('0x5e')]({'where':{'id':_0xe5826c['params']['id']}})[_0x7e3c('0x28')](handleEntityNotFound(_0x4dbaa5,null))[_0x7e3c('0x28')](removeEntity(_0x4dbaa5,null))[_0x7e3c('0xad')](handleError(_0x4dbaa5,null));};exports['describe']=function(_0x2e633a,_0x237f4e){return db['OpenchannelInteraction'][_0x7e3c('0xb4')]()[_0x7e3c('0x28')](respondWithResult(_0x237f4e,null))[_0x7e3c('0xad')](handleError(_0x237f4e,null));};exports[_0x7e3c('0xb5')]=function(_0x415fc3,_0x1fe424,_0x276fd1){return db[_0x7e3c('0xb6')][_0x7e3c('0x5e')]({'where':{'id':_0x415fc3['params']['id']}})['then'](handleEntityNotFound(_0x1fe424,null))[_0x7e3c('0x28')](function(_0x467764){if(_0x467764){return _0x467764[_0x7e3c('0xb5')](_0x415fc3[_0x7e3c('0x74')][_0x7e3c('0xb7')],_['omit'](_0x415fc3[_0x7e3c('0x74')],[_0x7e3c('0xb7'),'id'])||{});}})[_0x7e3c('0x28')](respondWithResult(_0x1fe424,null))[_0x7e3c('0xad')](handleError(_0x1fe424,null));};exports['getMessages']=function(_0x71551c,_0x5dc7a2,_0x5187ae){var _0x344537={'raw':![],'where':{}};var _0x22b235={};var _0x358fb2={'count':0x0,'rows':[]};return db[_0x7e3c('0x38')][_0x7e3c('0xb8')]({'where':{'id':_0x71551c[_0x7e3c('0xae')]['id']}})[_0x7e3c('0x28')](handleEntityNotFound(_0x5dc7a2,null))[_0x7e3c('0x28')](function(_0x1e87ed){if(_0x1e87ed){_0x22b235[_0x7e3c('0x3d')]=_[_0x7e3c('0x3f')](db[_0x7e3c('0xb6')][_0x7e3c('0x39')]);_0x22b235[_0x7e3c('0x3e')]=_[_0x7e3c('0x3f')](_0x71551c[_0x7e3c('0x3e')]);_0x22b235[_0x7e3c('0x40')]=_[_0x7e3c('0x41')](_0x22b235[_0x7e3c('0x3d')],_0x22b235[_0x7e3c('0x3e')]);_0x344537[_0x7e3c('0x42')]=_[_0x7e3c('0x41')](_0x22b235[_0x7e3c('0x3d')],qs[_0x7e3c('0x43')](_0x71551c[_0x7e3c('0x3e')][_0x7e3c('0x43')]));_0x344537[_0x7e3c('0x42')]=_0x344537[_0x7e3c('0x42')][_0x7e3c('0x44')]?_0x344537[_0x7e3c('0x42')]:_0x22b235['model'];if(!_0x71551c['query']['hasOwnProperty'](_0x7e3c('0x46'))){_0x344537[_0x7e3c('0x24')]=qs[_0x7e3c('0x24')](_0x71551c['query'][_0x7e3c('0x24')]);_0x344537[_0x7e3c('0x23')]=qs[_0x7e3c('0x23')](_0x71551c[_0x7e3c('0x3e')][_0x7e3c('0x23')]);}_0x344537[_0x7e3c('0x8a')]=qs['sort'](_0x71551c['query'][_0x7e3c('0x47')]);_0x344537[_0x7e3c('0x48')]=qs['filters'](_['pick'](_0x71551c[_0x7e3c('0x3e')],_0x22b235['filters']));_0x344537[_0x7e3c('0x48')][_0x7e3c('0xaa')]=_0x1e87ed['id'];if(_0x71551c['query'][_0x7e3c('0x83')]){_0x344537['where']=_[_0x7e3c('0xb0')](_0x344537[_0x7e3c('0x48')],{'$or':_[_0x7e3c('0x30')](_0x344537[_0x7e3c('0x42')],function(_0x3fa4c7){var _0x3d3de9={};_0x3d3de9[_0x3fa4c7]={'$like':'%'+_0x71551c[_0x7e3c('0x3e')][_0x7e3c('0x83')]+'%'};return _0x3d3de9;})});}if(_0x71551c[_0x7e3c('0x3e')][_0x7e3c('0x7c')]){var _0xfb9b3a=_0x71551c[_0x7e3c('0x3e')]['$gte'][_0x7e3c('0x33')](',');var _0x4d9172={};_0x4d9172[_0xfb9b3a[0x0]]={'$gte':moment(_0xfb9b3a[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x344537['where']=_[_0x7e3c('0xb0')](_0x344537['where'],_0x4d9172);}_0x344537=_['merge']({},_0x344537,_0x71551c[_0x7e3c('0xb1')]);return db[_0x7e3c('0xb6')][_0x7e3c('0x22')]({'where':_0x344537['where']})['then'](function(_0x523e4c){_0x358fb2['count']=_0x523e4c;if(_0x71551c[_0x7e3c('0x3e')]['includeAll']){_0x344537[_0x7e3c('0xaf')]=[{'all':!![]}];}return db[_0x7e3c('0xb6')][_0x7e3c('0xb9')](_0x344537);})[_0x7e3c('0x28')](function(_0x568d8b){_0x358fb2[_0x7e3c('0xac')]=_0x568d8b;return _0x358fb2;});}})['then'](respondWithFilteredResult(_0x5dc7a2,_0x344537))[_0x7e3c('0xad')](handleError(_0x5dc7a2,null));};exports['addTags']=function(_0x1a2284,_0x581c69,_0x5addf6){return db[_0x7e3c('0x38')][_0x7e3c('0x5e')]({'where':{'id':_0x1a2284[_0x7e3c('0xae')]['id']}})[_0x7e3c('0x28')](handleEntityNotFound(_0x581c69,null))['then'](function(_0x46fa1b){if(_0x46fa1b){return _0x46fa1b[_0x7e3c('0xba')](_0x1a2284[_0x7e3c('0x74')][_0x7e3c('0xb7')],_[_0x7e3c('0xbb')](_0x1a2284[_0x7e3c('0x74')],[_0x7e3c('0xb7'),'id'])||{})[_0x7e3c('0xbc')](function(){return db[_0x7e3c('0x6e')][_0x7e3c('0xb9')]({'attributes':['id',_0x7e3c('0x2d'),_0x7e3c('0x4c')],'where':{'id':_0x1a2284[_0x7e3c('0x74')][_0x7e3c('0xb7')]}});})[_0x7e3c('0x28')](function(_0x583d71){socket[_0x7e3c('0xbd')](_0x7e3c('0xbe'),{'id':Number(_0x1a2284[_0x7e3c('0xae')]['id']),'tags':_0x583d71||[]});return{'id':Number(_0x1a2284['params']['id']),'tags':_0x583d71||[]};});}})['then'](respondWithResult(_0x581c69,null))[_0x7e3c('0xad')](handleError(_0x581c69,null));};exports[_0x7e3c('0xbf')]=function(_0x2b6990,_0x41ca15,_0x134739){return db['OpenchannelInteraction']['find']({'where':{'id':_0x2b6990[_0x7e3c('0xae')]['id']}})[_0x7e3c('0x28')](handleEntityNotFound(_0x41ca15,null))[_0x7e3c('0x28')](function(_0x51a5f5){if(_0x51a5f5){return _0x51a5f5[_0x7e3c('0xbf')](_0x2b6990[_0x7e3c('0x3e')][_0x7e3c('0xb7')]);}})[_0x7e3c('0x28')](respondWithStatusCode(_0x41ca15,null))[_0x7e3c('0xad')](handleError(_0x41ca15,null));};exports[_0x7e3c('0xc0')]=function(_0x1a0188,_0x4cd6c7){var _0x5a0f13=moment()[_0x7e3c('0xc1')]()['toString']();var _0x5e9389=path[_0x7e3c('0xc2')](config[_0x7e3c('0xc3')],'server','files',_0x7e3c('0xc4'));var _0xf25b11=path['join'](config[_0x7e3c('0xc3')],_0x7e3c('0xc5'),_0x7e3c('0xc6'),_0x7e3c('0xc7'));var _0x53f6f0=path['join'](_0x5e9389,_0x5a0f13);var _0xb33420=util[_0x7e3c('0xc8')](_0x7e3c('0xc9'),_0x1a0188[_0x7e3c('0xae')]['id'],_0x5a0f13);var _0x441331=path[_0x7e3c('0xc2')](_0x5e9389,_0xb33420);var _0x229dca=[];_0x229dca['push']({'model':db[_0x7e3c('0x71')],'as':_0x7e3c('0x71'),'attributes':['id','fullname'],'raw':!![]});_0x229dca[_0x7e3c('0x36')]({'model':db[_0x7e3c('0xca')],'as':_0x7e3c('0x64'),'attributes':['id',_0x7e3c('0xcb'),_0x7e3c('0xcc')],'raw':!![]});if(_0x1a0188[_0x7e3c('0x3e')][_0x7e3c('0xc7')]){_0x229dca['push']({'model':db[_0x7e3c('0xcd')],'as':'Attachment','raw':!![]});}var _0x4a2532=[{'model':db[_0x7e3c('0xb6')],'as':'Messages','attributes':['id','body',_0x7e3c('0x7a'),_0x7e3c('0xce'),_0x7e3c('0xcf'),_0x7e3c('0x80')],'include':_0x229dca}];_0x4a2532['push']({'model':db[_0x7e3c('0xd0')],'as':_0x7e3c('0xd1'),'attributes':['id','name']});_0x4a2532['push']({'model':db[_0x7e3c('0x71')],'as':_0x7e3c('0xd2'),'attributes':['id','fullname']});return db[_0x7e3c('0x38')][_0x7e3c('0x5e')]({'where':{'id':_0x1a0188['params']['id']},'include':_0x4a2532})[_0x7e3c('0x28')](handleEntityNotFound(_0x4cd6c7,null))[_0x7e3c('0x28')](function(_0x58fdec){if(_0x58fdec){var _0x2f8096=_0x58fdec[_0x7e3c('0xd3')]({'plain':!![]});fs[_0x7e3c('0xd4')](_0x53f6f0);var _0x3b4caa={'channel':_0x7e3c('0xd5'),'account':_0x2f8096[_0x7e3c('0xd1')][_0x7e3c('0x2d')],'agent':_0x2f8096[_0x7e3c('0xd2')]?_0x2f8096[_0x7e3c('0xd2')][_0x7e3c('0x31')]:_0x7e3c('0xd6'),'createdAt':moment(_0x2f8096[_0x7e3c('0x7a')])[_0x7e3c('0xc8')](_0x7e3c('0xd7'))[_0x7e3c('0x95')](),'closedAt':_0x2f8096['closed']?moment(_0x2f8096[_0x7e3c('0xd8')])['format'](_0x7e3c('0xd7'))[_0x7e3c('0x95')]():'','disposition':_0x2f8096[_0x7e3c('0xd9')],'visibility':_0x2f8096[_0x7e3c('0xda')]?_0x7e3c('0xdb'):_0x7e3c('0xdc'),'messages':_(_0x2f8096[_0x7e3c('0xdd')])['filter']({'secret':![]})[_0x7e3c('0x30')](function(_0x553546){if(_0x553546[_0x7e3c('0xcd')]){var _0x25c0d9=path['join'](_0xf25b11,_0x553546[_0x7e3c('0xcd')][_0x7e3c('0xde')]);if(fs['existsSync'](_0x25c0d9)){fs[_0x7e3c('0xdf')](_0x25c0d9)[_0x7e3c('0xe0')](fs['createWriteStream'](path[_0x7e3c('0xc2')](_0x53f6f0,_0x553546['Attachment'][_0x7e3c('0xde')])));}}return{'date':moment(_0x553546[_0x7e3c('0x7a')])['format'](_0x7e3c('0xd7'))[_0x7e3c('0x95')](),'sender':_0x553546[_0x7e3c('0xce')]===_0x7e3c('0xe1')?_0x553546['User']?_0x553546[_0x7e3c('0x71')][_0x7e3c('0x31')]:_0x7e3c('0xe2'):_0x553546['Contact'][_0x7e3c('0xcb')]+(_0x553546[_0x7e3c('0x64')][_0x7e3c('0xcc')]?'\x20'+_0x553546[_0x7e3c('0x64')][_0x7e3c('0xcc')]:''),'body':_0x553546['Attachment']?_0x553546[_0x7e3c('0xcd')][_0x7e3c('0xde')]:_0x553546['body'],'direction':_0x553546[_0x7e3c('0xce')]===_0x7e3c('0xe1')?'A':'C','secret':_0x553546[_0x7e3c('0xcf')],'read':_0x553546[_0x7e3c('0x80')],'attachment':_0x553546['Attachment']};})[_0x7e3c('0x60')]()};return ejs[_0x7e3c('0xe3')](path[_0x7e3c('0xc2')](config['root'],_0x7e3c('0xc5'),_0x7e3c('0xe4'),_0x7e3c('0xe5')),{'interaction':_0x3b4caa})[_0x7e3c('0x28')](function(_0x3341f6){var _0x53d042=path[_0x7e3c('0xc2')](_0x53f6f0,_0x7e3c('0xe6')+_0x2f8096['id']+'-'+_0x5a0f13+_0x7e3c('0xe7'));var _0x2e2324={'path':_0x53d042,'channel':_0x7e3c('0xd5'),'interactionId':_0x2f8096['id']};return pdf[_0x7e3c('0xe8')](_0x3341f6,_0x2e2324);})[_0x7e3c('0x28')](function(){return new BPromise(function(_0x26d15a,_0x112547){zipdir(_0x53f6f0,{'saveTo':_0x441331},function(_0x41a3b0,_0x5ad23b){if(_0x41a3b0)return _0x112547(_0x41a3b0);return _0x26d15a(_0x5ad23b);});})[_0x7e3c('0x28')](function(){return new BPromise(function(_0x2c1014,_0x383d15){rimraf(_0x53f6f0,function(_0x542394){if(_0x542394)_0x383d15(_0x542394);return _0x2c1014();});});})[_0x7e3c('0x28')](function(){return _0x4cd6c7[_0x7e3c('0xc0')](_0x441331,_0xb33420,function(_0x5e0a8a){if(_0x5e0a8a){console[_0x7e3c('0xe9')](_0x7e3c('0xea'),_0x5e0a8a);}else{fs[_0x7e3c('0xeb')](_0x441331);}});});});}else{return _0x4cd6c7[_0x7e3c('0x2b')](0xc8);}})[_0x7e3c('0xad')](handleError(_0x4cd6c7,null));}; \ No newline at end of file +var _0x4ce2=['c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','type','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','where','i.OpenchannelAccountId\x20IN\x20?','parse','$lte','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','contactName','t.id\x20IN\x20?','resolve','OpenchannelAccountId','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','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.*','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','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','OpenchannelInteractionId','all','rows','params','includeAll','include','options','create','describe','addMessage','omit','ids','findOne','OpenchannelMessage','$gte','findAll','spread','Tag','emit','openchannelInteractionTags:save','removeTags','download','unix','server','files','tmp','root','attachments','join','format','transcript-%d-%s.zip','User','firstName','lastName','Attachment','Messages','createdAt','direction','secret','OpenchannelAccount','Account','mkdirSync','Openchannel','Owner','N.A.','closed','closedAt','disposition','threadId','basename','createReadStream','createWriteStream','out','renderFile','views','transcript-','.pdf','createPdfFromHTML','unlinkSync','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','index','OpenchannelInteraction','rawAttributes','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','select','field','color','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','from','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions'];(function(_0x4d0d93,_0x46311b){var _0x19ba1d=function(_0x4f932e){while(--_0x4f932e){_0x4d0d93['push'](_0x4d0d93['shift']());}};_0x19ba1d(++_0x46311b);}(_0x4ce2,0x185));var _0x24ce=function(_0x2796ba,_0x3c5aa9){_0x2796ba=_0x2796ba-0x0;var _0x364582=_0x4ce2[_0x2796ba];return _0x364582;};'use strict';var emlformat=require(_0x24ce('0x0'));var rimraf=require(_0x24ce('0x1'));var zipdir=require(_0x24ce('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x24ce('0x3'));var moment=require(_0x24ce('0x4'));var BPromise=require(_0x24ce('0x5'));var Mustache=require(_0x24ce('0x6'));var util=require(_0x24ce('0x7'));var path=require(_0x24ce('0x8'));var sox=require('sox');var csv=require(_0x24ce('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x24ce('0xa'));var _=require(_0x24ce('0xb'));var squel=require(_0x24ce('0xc'));var crypto=require(_0x24ce('0xd'));var jsforce=require(_0x24ce('0xe'));var deskjs=require(_0x24ce('0xf'));var toCsv=require(_0x24ce('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x24ce('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x24ce('0x11'));var as=require(_0x24ce('0x12'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0x24ce('0x13'));var logger=require(_0x24ce('0x14'))(_0x24ce('0x15'));var utils=require(_0x24ce('0x16'));var config=require(_0x24ce('0x17'));var licenseUtil=require(_0x24ce('0x18'));var db=require('../../mysqldb')['db'];config[_0x24ce('0x19')]=_[_0x24ce('0x1a')](config[_0x24ce('0x19')],{'host':_0x24ce('0x1b'),'port':0x18eb});var socket=require(_0x24ce('0x1c'))(new Redis(config[_0x24ce('0x19')]));require(_0x24ce('0x1d'))[_0x24ce('0x1e')](socket);function respondWithStatusCode(_0x5edd36,_0x408221){_0x408221=_0x408221||0xcc;return function(_0x564f06){if(_0x564f06){return _0x5edd36['sendStatus'](_0x408221);}return _0x5edd36[_0x24ce('0x1f')](_0x408221)[_0x24ce('0x20')]();};}function respondWithResult(_0x484599,_0x50be23){_0x50be23=_0x50be23||0xc8;return function(_0x49223c){if(_0x49223c){return _0x484599[_0x24ce('0x1f')](_0x50be23)[_0x24ce('0x21')](_0x49223c);}};}function respondWithFilteredResult(_0x178646,_0x58f4af){return function(_0x1c01a9){if(_0x1c01a9){var _0x580686=typeof _0x58f4af[_0x24ce('0x22')]==='undefined'&&typeof _0x58f4af[_0x24ce('0x23')]===_0x24ce('0x24');var _0x2f984f=_0x1c01a9[_0x24ce('0x25')];var _0xac50a5=_0x580686?0x0:_0x58f4af[_0x24ce('0x22')];var _0x4edf43=_0x580686?_0x1c01a9[_0x24ce('0x25')]:_0x58f4af[_0x24ce('0x22')]+_0x58f4af[_0x24ce('0x23')];var _0x234727;if(_0x4edf43>=_0x2f984f){_0x4edf43=_0x2f984f;_0x234727=0xc8;}else{_0x234727=0xce;}_0x178646[_0x24ce('0x1f')](_0x234727);return _0x178646[_0x24ce('0x26')](_0x24ce('0x27'),_0xac50a5+'-'+_0x4edf43+'/'+_0x2f984f)[_0x24ce('0x21')](_0x1c01a9);}return null;};}function patchUpdates(_0xeeb9d5){return function(_0x189196){try{jsonpatch[_0x24ce('0x28')](_0x189196,_0xeeb9d5,!![]);}catch(_0x3e5664){return BPromise['reject'](_0x3e5664);}return _0x189196[_0x24ce('0x29')]();};}function saveUpdates(_0x36dda,_0x3b1dfa){return function(_0xc7befc){if(_0xc7befc){return _0xc7befc[_0x24ce('0x2a')](_0x36dda)[_0x24ce('0x2b')](function(_0x1cfa17){return _0x1cfa17;});}return null;};}function removeEntity(_0x1420b5,_0x5e707b){return function(_0x24dc85){if(_0x24dc85){return _0x24dc85[_0x24ce('0x2c')]()[_0x24ce('0x2b')](function(){_0x1420b5[_0x24ce('0x1f')](0xcc)[_0x24ce('0x20')]();});}};}function handleEntityNotFound(_0x12199b,_0x45c908){return function(_0xbaf7e){if(!_0xbaf7e){_0x12199b[_0x24ce('0x2d')](0x194);}return _0xbaf7e;};}function handleError(_0x3c2a8c,_0x10a1ad){_0x10a1ad=_0x10a1ad||0x1f4;return function(_0xa19590){logger[_0x24ce('0x2e')](_0xa19590[_0x24ce('0x2f')]);if(_0xa19590[_0x24ce('0x30')]){delete _0xa19590['name'];}_0x3c2a8c[_0x24ce('0x1f')](_0x10a1ad)[_0x24ce('0x31')](_0xa19590);};}function getInteractionUsers(_0x5434a3,_0x1dd40e){return new BPromise(function(_0x41d55b,_0x2f396d){try{if(_0x1dd40e[_0x5434a3['id']]){_0x5434a3[_0x24ce('0x32')]=_[_0x24ce('0x33')](_0x1dd40e[_0x5434a3['id']],function(_0x5f2c4c){return{'id':_0x5f2c4c['id'],'fullname':_0x5f2c4c[_0x24ce('0x34')]};});}}catch(_0x3a3d7c){_0x2f396d(_0x3a3d7c);}_0x41d55b(_0x5434a3);});}function getInteractionTags(_0x4e1493,_0x315f80){return new BPromise(function(_0xc76dd3,_0x23c679){try{if(_0x4e1493[_0x24ce('0x35')]){_0x4e1493[_0x24ce('0x36')]=[];_0x4e1493[_0x24ce('0x35')][_0x24ce('0x37')](',')[_0x24ce('0x38')](function(_0x270275){_0x4e1493[_0x24ce('0x36')][_0x24ce('0x39')](_0x315f80[_0x270275]);});}delete _0x4e1493[_0x24ce('0x35')];}catch(_0x1253d7){_0x23c679(_0x1253d7);}_0xc76dd3(_0x4e1493);});}function updateOpenchannelInteraction(_0x29ce16,_0xda1646,_0x2680ac){return new BPromise(function(_0x1a4bc2,_0x161d5a){return getInteractionUsers(_0x29ce16,_0x2680ac)[_0x24ce('0x2b')](function(_0x561b33){return getInteractionTags(_0x561b33,_0xda1646);})[_0x24ce('0x2b')](function(_0x533daf){_0x1a4bc2(_0x533daf);})[_0x24ce('0x3a')](function(_0x6c048){_0x161d5a(_0x6c048);});});}exports[_0x24ce('0x3b')]=function(_0x146139,_0x53a3c3){var _0x42b457={},_0x8d3315={},_0x313e48={'count':0x0,'rows':[]};var _0x556f9a=_[_0x24ce('0x33')](db[_0x24ce('0x3c')][_0x24ce('0x3d')],function(_0x58e761){return{'name':_0x58e761['fieldName'],'type':_0x58e761['type'][_0x24ce('0x3e')]};});_0x8d3315['model']=_[_0x24ce('0x33')](_0x556f9a,_0x24ce('0x30'));_0x8d3315[_0x24ce('0x3f')]=_[_0x24ce('0x40')](_0x146139['query']);_0x8d3315[_0x24ce('0x41')]=_[_0x24ce('0x42')](_0x8d3315[_0x24ce('0x43')],_0x8d3315[_0x24ce('0x3f')]);_0x42b457['attributes']=_[_0x24ce('0x42')](_0x8d3315['model'],qs[_0x24ce('0x44')](_0x146139[_0x24ce('0x3f')][_0x24ce('0x44')]));_0x42b457[_0x24ce('0x45')]=_0x42b457[_0x24ce('0x45')][_0x24ce('0x46')]?_0x42b457[_0x24ce('0x45')]:_0x8d3315['model'];if(!_0x146139[_0x24ce('0x3f')][_0x24ce('0x47')](_0x24ce('0x48'))){_0x42b457[_0x24ce('0x23')]=qs[_0x24ce('0x23')](_0x146139[_0x24ce('0x3f')][_0x24ce('0x23')]);_0x42b457[_0x24ce('0x22')]=qs[_0x24ce('0x22')](_0x146139[_0x24ce('0x3f')][_0x24ce('0x22')]);}_0x42b457[_0x24ce('0x49')]=qs[_0x24ce('0x4a')](_0x146139[_0x24ce('0x3f')][_0x24ce('0x4a')]);_0x42b457['where']=qs[_0x24ce('0x41')](_['pick'](_0x146139[_0x24ce('0x3f')],_0x8d3315['filters']),_0x556f9a);var _0x16d096=[];var _0x50f56a=squel[_0x24ce('0x4b')]()[_0x24ce('0x4c')]('id')[_0x24ce('0x4c')](_0x24ce('0x30'))[_0x24ce('0x4c')](_0x24ce('0x4d'))['from'](_0x24ce('0x4e'));var _0x54b3bd=squel['select']()['field'](_0x24ce('0x4f'))[_0x24ce('0x4c')](_0x24ce('0x50'))[_0x24ce('0x4c')](_0x24ce('0x51'))[_0x24ce('0x52')]('user_has_openchannel_interactions','ui')[_0x24ce('0x53')](_0x24ce('0x54'),'u',_0x24ce('0x55'));var _0x2d6b82=squel[_0x24ce('0x4b')]()[_0x24ce('0x52')](_0x24ce('0x56'),'i')[_0x24ce('0x53')]('cm_contacts','c',_0x24ce('0x57'))['left_join']('users','o',_0x24ce('0x58'))[_0x24ce('0x53')](_0x24ce('0x59'),'a',_0x24ce('0x5a'))['left_join'](_0x24ce('0x5b'),'me','me.OpenchannelInteractionId\x20=\x20i.id')[_0x24ce('0x53')](_0x24ce('0x5c'),'it',_0x24ce('0x5d'))[_0x24ce('0x53')](_0x24ce('0x4e'),'t',_0x24ce('0x5e'));var _0x3aa718=squel[_0x24ce('0x5f')]();var _0x2154d9=[];var _0x487778=squel[_0x24ce('0x5f')]();var _0xaa9e8a;if(_0x146139[_0x24ce('0x3f')][_0x24ce('0x60')]){_0xaa9e8a=as['parseSearch'](_0x146139[_0x24ce('0x3f')]['search']);var _0x15ea34=_0xaa9e8a['sqlOperator'];for(var _0x55101d=0x0;_0x55101d<_0xaa9e8a[_0x24ce('0x61')][_0x24ce('0x46')];_0x55101d++){var _0x30e4e9=_0xaa9e8a['conditions'][_0x55101d];var _0x437af2='i';var _0x9cc1f6=_[_0x24ce('0x62')](_0x556f9a,['name',_0x30e4e9[_0x24ce('0x4c')]]);if(!_0x9cc1f6){switch(_0x30e4e9[_0x24ce('0x4c')]){case _0x24ce('0x63'):if(_0x30e4e9[_0x24ce('0x64')]==0x1){_0x2d6b82[_0x24ce('0x65')]('`'+_0x30e4e9[_0x24ce('0x4c')]+_0x24ce('0x66'));}else{_0x2d6b82[_0x24ce('0x65')]('`'+_0x30e4e9['field']+_0x24ce('0x67'));}break;case _0x24ce('0x68'):if(_0x30e4e9[_0x24ce('0x69')]===_0x24ce('0x6a')){if(_0x30e4e9[_0x24ce('0x64')][_0x24ce('0x37')]('\x20')[_0x24ce('0x46')]>0x1){_0x3aa718[_0x15ea34](_0x24ce('0x6b'),qs[_0x24ce('0x6c')](_0x30e4e9['value']),null);}else{var _0x3a9a18='%'+_0x30e4e9[_0x24ce('0x64')]+'%';_0x3aa718[_0x15ea34]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3a9a18,_0x3a9a18,_0x3a9a18);}}else{_0x9cc1f6=_['find'](_0x556f9a,[_0x24ce('0x30'),_0x24ce('0x6d')]);_0x30e4e9[_0x24ce('0x4c')]=_0x24ce('0x6d');_0x51d292=as[_0x24ce('0x6e')](_0x437af2,_0x9cc1f6[_0x24ce('0x6f')],_0x30e4e9);_0x3aa718[_0x15ea34](_0x51d292[_0x24ce('0x70')],_0x51d292[_0x24ce('0x64')][_0x24ce('0x71')],_0x51d292['value'][_0x24ce('0x20')]);}break;case'Tag':var _0x10601e=_0x30e4e9[_0x24ce('0x64')][_0x24ce('0x37')](',')[_0x24ce('0x33')](function(_0xcdd64e){return Number(_0xcdd64e);});_0x10601e['forEach'](function(_0x1ff01c){_0x487778['or'](_0x24ce('0x72'),'%,'+_0x1ff01c+',%');});_0x2154d9=_['union'](_0x2154d9,_0x10601e);break;case'User':if(_0x30e4e9['operator']==='$substring'){_0x3aa718[_0x15ea34](_0x24ce('0x73'),'%'+_0x30e4e9[_0x24ce('0x64')]+'%',null);}else{_0x9cc1f6=_[_0x24ce('0x62')](_0x556f9a,[_0x24ce('0x30'),_0x24ce('0x74')]);_0x30e4e9[_0x24ce('0x4c')]='UserId';_0x51d292=as['buildExpression'](_0x437af2,_0x9cc1f6[_0x24ce('0x6f')],_0x30e4e9);_0x3aa718[_0x15ea34](_0x51d292[_0x24ce('0x70')],_0x51d292[_0x24ce('0x64')][_0x24ce('0x71')],_0x51d292[_0x24ce('0x64')][_0x24ce('0x20')]);}break;case _0x24ce('0x75'):_0x51d292=as[_0x24ce('0x6e')]('me',null,_0x30e4e9);_0x3aa718[_0x15ea34](_0x51d292[_0x24ce('0x70')],_0x51d292[_0x24ce('0x64')]['start'],_0x51d292[_0x24ce('0x64')][_0x24ce('0x20')]);break;}}else{var _0x51d292=as[_0x24ce('0x6e')](_0x437af2,_0x9cc1f6[_0x24ce('0x6f')],_0x30e4e9);_0x3aa718[_0x15ea34](_0x51d292[_0x24ce('0x70')],_0x51d292['value']['start'],_0x51d292[_0x24ce('0x64')]['end']);}}}else{var _0x2b0a6d=_(_0x146139[_0x24ce('0x3f')])[_0x24ce('0x40')]()[_0x24ce('0x33')](function(_0xe2ad45){return _[_0x24ce('0x76')](_0x556f9a,[_0x24ce('0x30'),_0xe2ad45])?_0xe2ad45:undefined;})[_0x24ce('0x77')]()[_0x24ce('0x64')]();if(!_[_0x24ce('0x78')](_0x2b0a6d)){_0x2b0a6d[_0x24ce('0x38')](function(_0xfec1df){if(_0xfec1df==='OpenchannelAccountId'){_0x2d6b82[_0x24ce('0x79')](_0x24ce('0x7a'),[]['concat'](_0x146139[_0x24ce('0x3f')][_0xfec1df]));}else if(_0xfec1df==='createdAt'){var _0x47a1cd=JSON['parse'](_0x146139[_0x24ce('0x3f')][_0xfec1df])['$gte'];var _0x111a21=JSON[_0x24ce('0x7b')](_0x146139['query'][_0xfec1df])[_0x24ce('0x7c')];_0x2d6b82['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x47a1cd,_0x111a21);}else{if(_0x146139['query'][_0xfec1df]===_0x24ce('0x7d')){_0x2d6b82[_0x24ce('0x79')]('i.'+_0xfec1df+'\x20IS\x20NULL');}else{_0x2d6b82[_0x24ce('0x79')]('i.'+_0xfec1df+_0x24ce('0x7e'),_0x146139[_0x24ce('0x3f')][_0xfec1df]);}}});}if(_0x146139[_0x24ce('0x3f')][_0x24ce('0x7f')]){if(_0x146139['query']['read']==0x1){_0x2d6b82[_0x24ce('0x65')](_0x24ce('0x80'));}else{_0x2d6b82['having'](_0x24ce('0x81'));}}if(_0x146139[_0x24ce('0x3f')][_0x24ce('0x82')]){_0x2154d9=_[_0x24ce('0x83')](_0x146139['query'][_0x24ce('0x82')])?_0x146139[_0x24ce('0x3f')]['tag']:new Array(_0x146139[_0x24ce('0x3f')]['tag']);_0x2154d9[_0x24ce('0x38')](function(_0x2299bf){_0x487778['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2299bf+',%');});}if(_0x146139[_0x24ce('0x3f')][_0x24ce('0x84')]){var _0x3cd44a=_0x146139[_0x24ce('0x3f')][_0x24ce('0x84')][_0x24ce('0x85')]('\x5c','\x5c\x5c')[_0x24ce('0x85')](/'/g,'\x27\x27');if(qs[_0x24ce('0x86')](_0x3cd44a)){_0x3aa718['or'](_0x24ce('0x87'),_0x3cd44a+'%');}else{_0x3aa718['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x24ce('0x6c')](_0x3cd44a))['or']('i.from\x20LIKE\x20?',_0x3cd44a+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x3cd44a+'%');}}}_0x2d6b82[_0x24ce('0x79')](_0x3aa718);_0x2d6b82[_0x24ce('0x88')](_0x24ce('0x89'));var _0x14a1bf={'type':db['Sequelize'][_0x24ce('0x8a')][_0x24ce('0x8b')],'raw':!![]};var _0x2eb1cd=_0x2d6b82[_0x24ce('0x8c')]();_0x2eb1cd[_0x24ce('0x4c')](_0x24ce('0x89'));_0x2eb1cd['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x42b457[_0x24ce('0x49')]){_0x42b457[_0x24ce('0x49')][_0x24ce('0x38')](function(_0x356925){var _0x26a9fa=_0x356925[0x0]===_0x24ce('0x8d')?_0x356925[0x0]:'i.'+_0x356925[0x0];_0x2d6b82['order'](_0x26a9fa,_0x356925[0x1]==='DESC'?![]:!![]);});}if(!_[_0x24ce('0x78')](_0x2154d9)){_0x2d6b82['having'](_0x487778);_0x2eb1cd[_0x24ce('0x79')](_0x24ce('0x8e'),_0x2154d9);}BPromise[_0x24ce('0x8f')]()[_0x24ce('0x2b')](function(){if(!_0xaa9e8a){if(_0x146139[_0x24ce('0x3f')][_0x24ce('0x90')])return;_0x2eb1cd[_0x24ce('0x79')](_0x24ce('0x91'));_0x2d6b82[_0x24ce('0x79')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x146139['user'][_0x24ce('0x92')]!==_0x24ce('0x93'))return;return _0x146139[_0x24ce('0x94')][_0x24ce('0x95')]({'attributes':['id'],'raw':!![]})[_0x24ce('0x2b')](function(_0x3b3898){if(_['isEmpty'](_0x3b3898)){_0x2eb1cd[_0x24ce('0x79')](_0x24ce('0x96'));_0x2d6b82['where'](_0x24ce('0x96'));}else{_0x2eb1cd[_0x24ce('0x79')](_0x24ce('0x7a'),_['map'](_0x3b3898,'id'));_0x2d6b82[_0x24ce('0x79')](_0x24ce('0x7a'),_['map'](_0x3b3898,'id'));}});})[_0x24ce('0x2b')](function(){if(_0x146139['user'][_0x24ce('0x92')]==='agent'&&!_0xaa9e8a&&!_0x146139[_0x24ce('0x3f')]['OpenchannelAccountId'])return[];return db[_0x24ce('0x97')][_0x24ce('0x3f')](_0x2eb1cd[_0x24ce('0x98')](),_0x14a1bf);})['then'](function(_0x574703){_0x313e48['count']=_0x574703[_0x24ce('0x46')];if(_0x313e48[_0x24ce('0x25')]===0x0)return[];return db[_0x24ce('0x97')]['query'](_0x50f56a['toString'](),_0x14a1bf)['then'](function(_0x19b498){_0x16d096=_[_0x24ce('0x99')](_0x19b498,'id');_0x14a1bf=_[_0x24ce('0x9a')](_0x14a1bf,{'model':db[_0x24ce('0x3c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x146139[_0x24ce('0x3f')][_0x24ce('0x44')]){_0x42b457['attributes']['forEach'](function(_0x50ab46){_0x2d6b82[_0x24ce('0x4c')]('i.'+_0x50ab46);});}else{_0x2d6b82[_0x24ce('0x4c')](_0x24ce('0x9b'),_0x24ce('0x63'));_0x2d6b82['field'](_0x24ce('0x9c'),_0x24ce('0x9d'));_0x2d6b82[_0x24ce('0x4c')](_0x24ce('0x9e'),'Account.mandatoryDisposition');_0x2d6b82[_0x24ce('0x4c')](_0x24ce('0x9f'),_0x24ce('0x8d'));_0x2d6b82['field'](_0x24ce('0xa0'));_0x2d6b82[_0x24ce('0x4c')](_0x24ce('0xa1'),_0x24ce('0xa2'));_0x2d6b82[_0x24ce('0x4c')](_0x24ce('0xa3'),_0x24ce('0xa4'));_0x2d6b82[_0x24ce('0x4c')](_0x24ce('0xa5'),_0x24ce('0xa6'));_0x2d6b82[_0x24ce('0x4c')](_0x24ce('0xa7'),_0x24ce('0xa8'));_0x2d6b82['field'](_0x24ce('0xa9'),_0x24ce('0xaa'));_0x2d6b82[_0x24ce('0x4c')](_0x24ce('0xab'),_0x24ce('0xac'));_0x2d6b82[_0x24ce('0x4c')](_0x24ce('0xad'),_0x24ce('0xae'));_0x2d6b82[_0x24ce('0x4c')](_0x24ce('0xaf'),_0x24ce('0xb0'));_0x2d6b82[_0x24ce('0x4c')](_0x24ce('0xb1'),_0x24ce('0x35'));}if(_0x42b457['limit'])_0x2d6b82[_0x24ce('0x23')](_0x42b457['limit']);if(_0x42b457[_0x24ce('0x22')])_0x2d6b82[_0x24ce('0x22')](_0x42b457[_0x24ce('0x22')]);return db[_0x24ce('0x97')]['query'](_0x2d6b82[_0x24ce('0x98')](),_0x14a1bf);})[_0x24ce('0x2b')](function(_0xcdec9e){if(_0xcdec9e['length']>0x0)_0x54b3bd[_0x24ce('0x79')](_0x24ce('0xb2'),_[_0x24ce('0x33')](_0xcdec9e,'id'));return db[_0x24ce('0x97')][_0x24ce('0x3f')](_0x54b3bd[_0x24ce('0x98')](),_0x14a1bf)[_0x24ce('0x2b')](function(_0x3779c6){var _0x3ee3d2=_['groupBy'](_0x3779c6,_0x24ce('0xb3'));var _0x1ffccc=[];_0xcdec9e['forEach'](function(_0x525ad3){_0x1ffccc[_0x24ce('0x39')](updateOpenchannelInteraction(_0x525ad3,_0x16d096,_0x3ee3d2));});return BPromise[_0x24ce('0xb4')](_0x1ffccc);});});})[_0x24ce('0x2b')](function(_0x5ab065){_0x313e48[_0x24ce('0xb5')]=_0x5ab065;return _0x313e48;})[_0x24ce('0x2b')](respondWithFilteredResult(_0x53a3c3,_0x42b457))[_0x24ce('0x3a')](handleError(_0x53a3c3,null));};exports['show']=function(_0x51a012,_0x4cc928){var _0x2c491c={};if(_0x51a012[_0x24ce('0x3f')][_0x24ce('0x6f')]&&_0x51a012[_0x24ce('0x3f')]['type']===_0x24ce('0x52')){_0x2c491c[_0x24ce('0x52')]=_0x51a012['params']['id'];}else{_0x2c491c['id']=_0x51a012[_0x24ce('0xb6')]['id'];}var _0xdfade6={'raw':![],'where':_0x2c491c},_0x2f4089={};_0x2f4089[_0x24ce('0x43')]=_[_0x24ce('0x40')](db[_0x24ce('0x3c')][_0x24ce('0x3d')]);_0x2f4089[_0x24ce('0x3f')]=_[_0x24ce('0x40')](_0x51a012[_0x24ce('0x3f')]);_0x2f4089['filters']=_[_0x24ce('0x42')](_0x2f4089['model'],_0x2f4089[_0x24ce('0x3f')]);_0xdfade6[_0x24ce('0x45')]=_[_0x24ce('0x42')](_0x2f4089['model'],qs['fields'](_0x51a012[_0x24ce('0x3f')][_0x24ce('0x44')]));_0xdfade6[_0x24ce('0x45')]=_0xdfade6[_0x24ce('0x45')]['length']?_0xdfade6[_0x24ce('0x45')]:_0x2f4089[_0x24ce('0x43')];if(_0x51a012['query'][_0x24ce('0xb7')]){_0xdfade6[_0x24ce('0xb8')]=[{'all':!![]}];}_0xdfade6=_[_0x24ce('0x9a')]({},_0xdfade6,_0x51a012[_0x24ce('0xb9')]);return db[_0x24ce('0x3c')][_0x24ce('0x62')](_0xdfade6)[_0x24ce('0x2b')](handleEntityNotFound(_0x4cc928,null))[_0x24ce('0x2b')](respondWithResult(_0x4cc928,null))['catch'](handleError(_0x4cc928,null));};exports[_0x24ce('0xba')]=function(_0x409591,_0x5eb495){return db[_0x24ce('0x3c')][_0x24ce('0xba')](_0x409591[_0x24ce('0x75')],{})[_0x24ce('0x2b')](respondWithResult(_0x5eb495,0xc9))['catch'](handleError(_0x5eb495,null));};exports[_0x24ce('0x2a')]=function(_0x569ef3,_0x1c65b4){if(_0x569ef3[_0x24ce('0x75')]['id']){delete _0x569ef3[_0x24ce('0x75')]['id'];}return db[_0x24ce('0x3c')]['find']({'where':{'id':_0x569ef3[_0x24ce('0xb6')]['id']}})['then'](handleEntityNotFound(_0x1c65b4,null))['then'](saveUpdates(_0x569ef3[_0x24ce('0x75')],null))[_0x24ce('0x2b')](respondWithResult(_0x1c65b4,null))[_0x24ce('0x3a')](handleError(_0x1c65b4,null));};exports[_0x24ce('0x2c')]=function(_0x2a4a2f,_0xe3863e){return db[_0x24ce('0x3c')][_0x24ce('0x62')]({'where':{'id':_0x2a4a2f['params']['id']}})[_0x24ce('0x2b')](handleEntityNotFound(_0xe3863e,null))[_0x24ce('0x2b')](removeEntity(_0xe3863e,null))[_0x24ce('0x3a')](handleError(_0xe3863e,null));};exports[_0x24ce('0xbb')]=function(_0x4a711b,_0x6223f5){return db['OpenchannelInteraction'][_0x24ce('0xbb')]()['then'](respondWithResult(_0x6223f5,null))[_0x24ce('0x3a')](handleError(_0x6223f5,null));};exports[_0x24ce('0xbc')]=function(_0x19facd,_0x4a5872,_0x1d2f43){return db['OpenchannelMessage']['find']({'where':{'id':_0x19facd[_0x24ce('0xb6')]['id']}})[_0x24ce('0x2b')](handleEntityNotFound(_0x4a5872,null))[_0x24ce('0x2b')](function(_0x4f5e2b){if(_0x4f5e2b){return _0x4f5e2b[_0x24ce('0xbc')](_0x19facd['body']['ids'],_[_0x24ce('0xbd')](_0x19facd['body'],[_0x24ce('0xbe'),'id'])||{});}})[_0x24ce('0x2b')](respondWithResult(_0x4a5872,null))[_0x24ce('0x3a')](handleError(_0x4a5872,null));};exports['getMessages']=function(_0x142dac,_0x567886,_0x36ce52){var _0x4c4672={'raw':![],'where':{}};var _0x2904df={};var _0x5adbab={'count':0x0,'rows':[]};return db[_0x24ce('0x3c')][_0x24ce('0xbf')]({'where':{'id':_0x142dac[_0x24ce('0xb6')]['id']}})[_0x24ce('0x2b')](handleEntityNotFound(_0x567886,null))[_0x24ce('0x2b')](function(_0x44470c){if(_0x44470c){_0x2904df[_0x24ce('0x43')]=_['keys'](db[_0x24ce('0xc0')][_0x24ce('0x3d')]);_0x2904df['query']=_[_0x24ce('0x40')](_0x142dac[_0x24ce('0x3f')]);_0x2904df['filters']=_[_0x24ce('0x42')](_0x2904df[_0x24ce('0x43')],_0x2904df[_0x24ce('0x3f')]);_0x4c4672['attributes']=_[_0x24ce('0x42')](_0x2904df[_0x24ce('0x43')],qs['fields'](_0x142dac['query'][_0x24ce('0x44')]));_0x4c4672[_0x24ce('0x45')]=_0x4c4672[_0x24ce('0x45')][_0x24ce('0x46')]?_0x4c4672[_0x24ce('0x45')]:_0x2904df[_0x24ce('0x43')];if(!_0x142dac[_0x24ce('0x3f')][_0x24ce('0x47')](_0x24ce('0x48'))){_0x4c4672[_0x24ce('0x23')]=qs[_0x24ce('0x23')](_0x142dac[_0x24ce('0x3f')][_0x24ce('0x23')]);_0x4c4672[_0x24ce('0x22')]=qs[_0x24ce('0x22')](_0x142dac[_0x24ce('0x3f')][_0x24ce('0x22')]);}_0x4c4672[_0x24ce('0x49')]=qs[_0x24ce('0x4a')](_0x142dac[_0x24ce('0x3f')][_0x24ce('0x4a')]);_0x4c4672['where']=qs[_0x24ce('0x41')](_['pick'](_0x142dac[_0x24ce('0x3f')],_0x2904df[_0x24ce('0x41')]));_0x4c4672[_0x24ce('0x79')][_0x24ce('0xb3')]=_0x44470c['id'];if(_0x142dac[_0x24ce('0x3f')]['filter']){_0x4c4672['where']=_[_0x24ce('0x9a')](_0x4c4672[_0x24ce('0x79')],{'$or':_['map'](_0x4c4672['attributes'],function(_0x4940cf){var _0x7f0dfa={};_0x7f0dfa[_0x4940cf]={'$like':'%'+_0x142dac[_0x24ce('0x3f')][_0x24ce('0x84')]+'%'};return _0x7f0dfa;})});}if(_0x142dac['query'][_0x24ce('0xc1')]){var _0x22dfca=_0x142dac['query'][_0x24ce('0xc1')][_0x24ce('0x37')](',');var _0x40f304={};_0x40f304[_0x22dfca[0x0]]={'$gte':moment(_0x22dfca[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x4c4672[_0x24ce('0x79')]=_['merge'](_0x4c4672[_0x24ce('0x79')],_0x40f304);}_0x4c4672=_[_0x24ce('0x9a')]({},_0x4c4672,_0x142dac[_0x24ce('0xb9')]);return db[_0x24ce('0xc0')][_0x24ce('0x25')]({'where':_0x4c4672[_0x24ce('0x79')]})[_0x24ce('0x2b')](function(_0x4d7ac){_0x5adbab[_0x24ce('0x25')]=_0x4d7ac;if(_0x142dac[_0x24ce('0x3f')][_0x24ce('0xb7')]){_0x4c4672[_0x24ce('0xb8')]=[{'all':!![]}];}return db[_0x24ce('0xc0')][_0x24ce('0xc2')](_0x4c4672);})['then'](function(_0x1e1d4){_0x5adbab['rows']=_0x1e1d4;return _0x5adbab;});}})[_0x24ce('0x2b')](respondWithFilteredResult(_0x567886,_0x4c4672))[_0x24ce('0x3a')](handleError(_0x567886,null));};exports['addTags']=function(_0x7ba108,_0x149ec6,_0x2a4dd4){return db[_0x24ce('0x3c')][_0x24ce('0x62')]({'where':{'id':_0x7ba108[_0x24ce('0xb6')]['id']}})[_0x24ce('0x2b')](handleEntityNotFound(_0x149ec6,null))['then'](function(_0xfe12c8){if(_0xfe12c8){return _0xfe12c8['setTags'](_0x7ba108[_0x24ce('0x75')][_0x24ce('0xbe')],_[_0x24ce('0xbd')](_0x7ba108[_0x24ce('0x75')],[_0x24ce('0xbe'),'id'])||{})[_0x24ce('0xc3')](function(){return db[_0x24ce('0xc4')][_0x24ce('0xc2')]({'attributes':['id',_0x24ce('0x30'),_0x24ce('0x4d')],'where':{'id':_0x7ba108[_0x24ce('0x75')][_0x24ce('0xbe')]}});})[_0x24ce('0x2b')](function(_0x5e384b){socket[_0x24ce('0xc5')](_0x24ce('0xc6'),{'id':Number(_0x7ba108[_0x24ce('0xb6')]['id']),'tags':_0x5e384b||[]});return{'id':Number(_0x7ba108[_0x24ce('0xb6')]['id']),'tags':_0x5e384b||[]};});}})['then'](respondWithResult(_0x149ec6,null))[_0x24ce('0x3a')](handleError(_0x149ec6,null));};exports[_0x24ce('0xc7')]=function(_0x32e1aa,_0x56191c,_0x2634e0){return db[_0x24ce('0x3c')][_0x24ce('0x62')]({'where':{'id':_0x32e1aa[_0x24ce('0xb6')]['id']}})[_0x24ce('0x2b')](handleEntityNotFound(_0x56191c,null))['then'](function(_0x33788d){if(_0x33788d){return _0x33788d['removeTags'](_0x32e1aa[_0x24ce('0x3f')]['ids']);}})[_0x24ce('0x2b')](respondWithStatusCode(_0x56191c,null))['catch'](handleError(_0x56191c,null));};exports[_0x24ce('0xc8')]=function(_0x1925c9,_0x37fd25){var _0x38c009=moment()[_0x24ce('0xc9')]()[_0x24ce('0x98')]();var _0x45aca7=path['join'](config['root'],_0x24ce('0xca'),_0x24ce('0xcb'),_0x24ce('0xcc'));var _0x1581d8=path['join'](config[_0x24ce('0xcd')],'server',_0x24ce('0xcb'),_0x24ce('0xce'));var _0x1dc29f=path[_0x24ce('0xcf')](_0x45aca7,_0x38c009);var _0x281899=util[_0x24ce('0xd0')](_0x24ce('0xd1'),_0x1925c9[_0x24ce('0xb6')]['id'],_0x38c009);var _0x2b592c=path[_0x24ce('0xcf')](_0x45aca7,_0x281899);var _0x380213=[];_0x380213[_0x24ce('0x39')]({'model':db[_0x24ce('0xd2')],'as':_0x24ce('0xd2'),'attributes':['id',_0x24ce('0x34')],'raw':!![]});_0x380213[_0x24ce('0x39')]({'model':db['CmContact'],'as':_0x24ce('0x68'),'attributes':['id',_0x24ce('0xd3'),_0x24ce('0xd4')],'raw':!![]});if(_0x1925c9[_0x24ce('0x3f')][_0x24ce('0xce')]){_0x380213['push']({'model':db[_0x24ce('0xd5')],'as':_0x24ce('0xd5'),'raw':!![]});}var _0x3b1ef1=[{'model':db[_0x24ce('0xc0')],'as':_0x24ce('0xd6'),'attributes':['id','body',_0x24ce('0xd7'),_0x24ce('0xd8'),_0x24ce('0xd9'),_0x24ce('0x7f')],'include':_0x380213}];_0x3b1ef1['push']({'model':db[_0x24ce('0xda')],'as':_0x24ce('0xdb'),'attributes':['id',_0x24ce('0x30')]});_0x3b1ef1[_0x24ce('0x39')]({'model':db[_0x24ce('0xd2')],'as':'Owner','attributes':['id',_0x24ce('0x34')]});return db[_0x24ce('0x3c')][_0x24ce('0x62')]({'where':{'id':_0x1925c9[_0x24ce('0xb6')]['id']},'include':_0x3b1ef1})[_0x24ce('0x2b')](handleEntityNotFound(_0x37fd25,null))[_0x24ce('0x2b')](function(_0x4c0927){if(_0x4c0927){var _0x2b4b56=_0x4c0927['get']({'plain':!![]});fs[_0x24ce('0xdc')](_0x1dc29f);var _0x2af4ef={'channel':_0x24ce('0xdd'),'account':_0x2b4b56[_0x24ce('0xdb')][_0x24ce('0x30')],'agent':_0x2b4b56[_0x24ce('0xde')]?_0x2b4b56[_0x24ce('0xde')]['fullname']:_0x24ce('0xdf'),'createdAt':moment(_0x2b4b56[_0x24ce('0xd7')])[_0x24ce('0xd0')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x2b4b56[_0x24ce('0xe0')]?moment(_0x2b4b56[_0x24ce('0xe1')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x2b4b56[_0x24ce('0xe2')],'visibility':_0x2b4b56[_0x24ce('0xe3')]?'Public':'Private','messages':_(_0x2b4b56[_0x24ce('0xd6')])[_0x24ce('0x84')]({'secret':![]})[_0x24ce('0x33')](function(_0x59dba0){if(_0x59dba0[_0x24ce('0xd5')]){var _0xafa5bc=path[_0x24ce('0xcf')](_0x1581d8,_0x59dba0[_0x24ce('0xd5')][_0x24ce('0xe4')]);if(fs['existsSync'](_0xafa5bc)){fs[_0x24ce('0xe5')](_0xafa5bc)['pipe'](fs[_0x24ce('0xe6')](path[_0x24ce('0xcf')](_0x1dc29f,_0x59dba0[_0x24ce('0xd5')][_0x24ce('0xe4')])));}}return{'date':moment(_0x59dba0[_0x24ce('0xd7')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x24ce('0x98')](),'sender':_0x59dba0[_0x24ce('0xd8')]===_0x24ce('0xe7')?_0x59dba0['User']?_0x59dba0['User'][_0x24ce('0x34')]:'System':_0x59dba0[_0x24ce('0x68')][_0x24ce('0xd3')]+(_0x59dba0[_0x24ce('0x68')]['lastName']?'\x20'+_0x59dba0[_0x24ce('0x68')][_0x24ce('0xd4')]:''),'body':_0x59dba0['Attachment']?_0x59dba0[_0x24ce('0xd5')][_0x24ce('0xe4')]:_0x59dba0['body'],'direction':_0x59dba0['direction']===_0x24ce('0xe7')?'A':'C','secret':_0x59dba0['secret'],'read':_0x59dba0[_0x24ce('0x7f')],'attachment':_0x59dba0['Attachment']};})['value']()};return ejs[_0x24ce('0xe8')](path[_0x24ce('0xcf')](config['root'],_0x24ce('0xca'),_0x24ce('0xe9'),'downloadInteraction.ejs'),{'interaction':_0x2af4ef})[_0x24ce('0x2b')](function(_0x4f5a15){var _0x5d6da1=path[_0x24ce('0xcf')](_0x1dc29f,_0x24ce('0xea')+_0x2b4b56['id']+'-'+_0x38c009+_0x24ce('0xeb'));var _0x24b217={'path':_0x5d6da1,'channel':_0x24ce('0xdd'),'interactionId':_0x2b4b56['id']};return pdf[_0x24ce('0xec')](_0x4f5a15,_0x24b217);})[_0x24ce('0x2b')](function(){return new BPromise(function(_0x16c01f,_0x14043b){zipdir(_0x1dc29f,{'saveTo':_0x2b592c},function(_0x5e18da,_0x232510){if(_0x5e18da)return _0x14043b(_0x5e18da);return _0x16c01f(_0x232510);});})['then'](function(){return new BPromise(function(_0x1b1143,_0x44205e){rimraf(_0x1dc29f,function(_0x31d0cb){if(_0x31d0cb)_0x44205e(_0x31d0cb);return _0x1b1143();});});})[_0x24ce('0x2b')](function(){return _0x37fd25[_0x24ce('0xc8')](_0x2b592c,_0x281899,function(_0x52f81c){if(_0x52f81c){console['log']('err',_0x52f81c);}else{fs[_0x24ce('0xed')](_0x2b592c);}});});});}else{return _0x37fd25[_0x24ce('0x2d')](0xc8);}})[_0x24ce('0x3a')](handleError(_0x37fd25,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 630197d..bbcd687 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 _0xcf34=['remove','getUsers','then','setDataValue','map','findAll','unreadMessages','emit','catch','hasOwnProperty','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','update'];(function(_0x17fbf0,_0x414860){var _0x352a30=function(_0x2d9795){while(--_0x2d9795){_0x17fbf0['push'](_0x17fbf0['shift']());}};_0x352a30(++_0x414860);}(_0xcf34,0xc6));var _0x4cf3=function(_0x5de818,_0x7c4485){_0x5de818=_0x5de818-0x0;var _0x345670=_0xcf34[_0x5de818];return _0x345670;};'use strict';var EventEmitter=require(_0x4cf3('0x0'));var OpenchannelInteraction=require(_0x4cf3('0x1'))['db'][_0x4cf3('0x2')];var OpenchannelMessage=require('../../mysqldb')['db'][_0x4cf3('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x4cf3('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4cf3('0x5'),'afterDestroy':_0x4cf3('0x6')};function emitEvent(_0x548398){return function(_0x33a644,_0x4660b3,_0x289a02){_0x33a644[_0x4cf3('0x7')]({'attributes':['id'],'raw':!![]})[_0x4cf3('0x8')](function(_0x3c0222){_0x33a644[_0x4cf3('0x9')]('Users',_0x3c0222[_0x4cf3('0xa')](function(_0x11800b){return{'id':_0x11800b['id']};}));return OpenchannelMessage[_0x4cf3('0xb')]({'where':{'OpenchannelInteractionId':_0x33a644['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4e1e04){_0x33a644['setDataValue'](_0x4cf3('0xc'),_0x4e1e04['length']);OpenchannelInteractionEvents[_0x4cf3('0xd')](_0x548398+':'+_0x33a644['id'],_0x33a644);OpenchannelInteractionEvents[_0x4cf3('0xd')](_0x548398,_0x33a644);_0x289a02(null);})[_0x4cf3('0xe')](_0x289a02(null));};}for(var e in events){if(events[_0x4cf3('0xf')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x4cf3('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x1d96=['length','emit','catch','exports','events','../../mysqldb','OpenchannelInteraction','setMaxListeners','save','getUsers','then','Users','map','findAll','setDataValue','unreadMessages'];(function(_0x3ae8f8,_0x415c54){var _0x24f3e0=function(_0x4f1b5d){while(--_0x4f1b5d){_0x3ae8f8['push'](_0x3ae8f8['shift']());}};_0x24f3e0(++_0x415c54);}(_0x1d96,0x1a4));var _0x61d9=function(_0x14d1fd,_0x5e93ef){_0x14d1fd=_0x14d1fd-0x0;var _0x11ba7c=_0x1d96[_0x14d1fd];return _0x11ba7c;};'use strict';var EventEmitter=require(_0x61d9('0x0'));var OpenchannelInteraction=require(_0x61d9('0x1'))['db'][_0x61d9('0x2')];var OpenchannelMessage=require(_0x61d9('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x61d9('0x3')](0x0);var events={'afterCreate':_0x61d9('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5f2e84){return function(_0x5091d1,_0x3112af,_0xeae1ce){_0x5091d1[_0x61d9('0x5')]({'attributes':['id'],'raw':!![]})[_0x61d9('0x6')](function(_0xf13613){_0x5091d1['setDataValue'](_0x61d9('0x7'),_0xf13613[_0x61d9('0x8')](function(_0x4e730d){return{'id':_0x4e730d['id']};}));return OpenchannelMessage[_0x61d9('0x9')]({'where':{'OpenchannelInteractionId':_0x5091d1['id'],'direction':'in','read':![]},'raw':!![]});})[_0x61d9('0x6')](function(_0x369755){_0x5091d1[_0x61d9('0xa')](_0x61d9('0xb'),_0x369755[_0x61d9('0xc')]);OpenchannelInteractionEvents[_0x61d9('0xd')](_0x5f2e84+':'+_0x5091d1['id'],_0x5091d1);OpenchannelInteractionEvents[_0x61d9('0xd')](_0x5f2e84,_0x5091d1);_0xeae1ce(null);})[_0x61d9('0xe')](_0xeae1ce(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x61d9('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 20a67e1..97b3adb 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 _0xaf37=['../../config/logger','api','bluebird','path','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xaf37,0xa1));var _0x7af3=function(_0x383356,_0x33d2f5){_0x383356=_0x383356-0x0;var _0x32ee5a=_0xaf37[_0x383356];return _0x32ee5a;};'use strict';var _=require('lodash');var util=require(_0x7af3('0x0'));var logger=require(_0x7af3('0x1'))(_0x7af3('0x2'));var moment=require('moment');var BPromise=require(_0x7af3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7af3('0x4'));var rimraf=require('rimraf');var config=require(_0x7af3('0x5'));var attributes=require(_0x7af3('0x6'));module[_0x7af3('0x7')]=function(_0x50af37,_0x466dd2){return _0x50af37[_0x7af3('0x8')](_0x7af3('0x9'),attributes,{'tableName':_0x7af3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7af3('0xb'),'collate':_0x7af3('0xc'),'hooks':{'beforeUpdate':function(_0x39a2ca,_0x1131de,_0x12f388){if(_0x39a2ca[_0x7af3('0xd')](_0x7af3('0xe'))){_0x39a2ca[_0x7af3('0xf')]=moment()[_0x7af3('0x10')](_0x7af3('0x11'));}_0x12f388(null,_0x39a2ca);}}});}; \ No newline at end of file +var _0x15ae=['api','bluebird','request-promise','path','exports','define','closedAt','format','lodash','util','../../config/logger'];(function(_0x23969f,_0xe7ffe4){var _0x51ca0f=function(_0x7ee5d){while(--_0x7ee5d){_0x23969f['push'](_0x23969f['shift']());}};_0x51ca0f(++_0xe7ffe4);}(_0x15ae,0x6b));var _0xe15a=function(_0x244d7d,_0x4e1c7a){_0x244d7d=_0x244d7d-0x0;var _0xb1cff8=_0x15ae[_0x244d7d];return _0xb1cff8;};'use strict';var _=require(_0xe15a('0x0'));var util=require(_0xe15a('0x1'));var logger=require(_0xe15a('0x2'))(_0xe15a('0x3'));var moment=require('moment');var BPromise=require(_0xe15a('0x4'));var rp=require(_0xe15a('0x5'));var fs=require('fs');var path=require(_0xe15a('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./openchannelInteraction.attributes');module[_0xe15a('0x7')]=function(_0x561190,_0x19e256){return _0x561190[_0xe15a('0x8')]('OpenchannelInteraction',attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x58e863,_0x3c1d15,_0x3a3672){if(_0x58e863['changed']('closed')){_0x58e863[_0xe15a('0x9')]=moment()[_0xe15a('0xa')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3a3672(null,_0x58e863);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 14b0aff..2a216e8 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 _0xb859=['../../config/logger','rpc','../../config/environment','http','redis','localhost','./openchannelInteraction.socket','register','request','then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info','result','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options','raw','where','attributes','stringify','catch','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','AddTags','lodash','bluebird','ioredis','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb859,0x16e));var _0x9b85=function(_0xd73d53,_0x598443){_0xd73d53=_0xd73d53-0x0;var _0x560148=_0xb859[_0xd73d53];return _0x560148;};'use strict';var _=require(_0x9b85('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9b85('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9b85('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x9b85('0x3'));var logger=require(_0x9b85('0x4'))(_0x9b85('0x5'));var config=require(_0x9b85('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9b85('0x7')]({'port':0x232a});config[_0x9b85('0x8')]=_['defaults'](config[_0x9b85('0x8')],{'host':_0x9b85('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9b85('0x8')]));require(_0x9b85('0xa'))[_0x9b85('0xb')](socket);function respondWithRpcPromise(_0x132a0f,_0x342ec6,_0x2d873a){return new BPromise(function(_0x15d029,_0x4de979){return client[_0x9b85('0xc')](_0x132a0f,_0x2d873a)[_0x9b85('0xd')](function(_0x211ae9){logger['info'](_0x9b85('0xe'),_0x342ec6,_0x9b85('0xf'));logger['debug'](_0x9b85('0x10'),_0x342ec6,'request\x20sent',JSON['stringify'](_0x211ae9));if(_0x211ae9[_0x9b85('0x11')]){if(_0x211ae9[_0x9b85('0x11')][_0x9b85('0x12')]===0x1f4){logger[_0x9b85('0x11')]('OpenchannelInteraction,\x20%s,\x20%s',_0x342ec6,_0x211ae9[_0x9b85('0x11')][_0x9b85('0x13')]);return _0x4de979(_0x211ae9[_0x9b85('0x11')]['message']);}logger['error'](_0x9b85('0xe'),_0x342ec6,_0x211ae9['error']['message']);return _0x15d029(_0x211ae9[_0x9b85('0x11')]['message']);}else{logger[_0x9b85('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x342ec6,_0x9b85('0xf'));_0x15d029(_0x211ae9[_0x9b85('0x15')][_0x9b85('0x13')]);}})['catch'](function(_0x50ac45){logger[_0x9b85('0x11')](_0x9b85('0xe'),_0x342ec6,_0x50ac45);_0x4de979(_0x50ac45);});});}exports[_0x9b85('0x16')]=function(_0x2ac0f4){var _0x182fca=this;return new Promise(function(_0x3c0e1b,_0x1bb7f4){return db[_0x9b85('0x17')]['update'](_0x2ac0f4[_0x9b85('0x18')],{'raw':_0x2ac0f4['options']?_0x2ac0f4[_0x9b85('0x19')][_0x9b85('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ac0f4[_0x9b85('0x19')]?_0x2ac0f4[_0x9b85('0x19')][_0x9b85('0x1b')]||null:null,'attributes':_0x2ac0f4['options']?_0x2ac0f4[_0x9b85('0x19')][_0x9b85('0x1c')]||null:null,'limit':_0x2ac0f4[_0x9b85('0x19')]?_0x2ac0f4[_0x9b85('0x19')]['limit']||null:null})['then'](function(_0x446e3c){logger[_0x9b85('0x14')]('UpdateOpenchannelInteraction',_0x2ac0f4);logger['debug']('UpdateOpenchannelInteraction',_0x2ac0f4,JSON[_0x9b85('0x1d')](_0x446e3c));_0x3c0e1b(_0x446e3c);})[_0x9b85('0x1e')](function(_0x2c64f0){logger[_0x9b85('0x11')](_0x9b85('0x16'),_0x2c64f0['message'],_0x2ac0f4);_0x1bb7f4(_0x182fca[_0x9b85('0x11')](0x1f4,_0x2c64f0[_0x9b85('0x13')]));});});};exports[_0x9b85('0x1f')]=function(_0x4832a6){return new Promise(function(_0x2edc08,_0xcb7300){return db['OpenchannelInteraction'][_0x9b85('0x20')]({'where':_0x4832a6[_0x9b85('0x19')]?_0x4832a6[_0x9b85('0x19')][_0x9b85('0x1b')]||null:null})[_0x9b85('0xd')](function(_0x5a3359){if(_0x5a3359){return _0x5a3359[_0x9b85('0x21')](_0x4832a6[_0x9b85('0x18')][_0x9b85('0x22')],_[_0x9b85('0x23')](_0x4832a6[_0x9b85('0x18')],[_0x9b85('0x22'),'id'])||{});}})['spread'](function(_0x3fba66){logger['info'](_0x9b85('0x24'),_0x4832a6);logger['debug'](_0x9b85('0x24'),_0x4832a6,JSON[_0x9b85('0x1d')](_0x3fba66));_0x2edc08(_0x3fba66);})['catch'](function(_0x2fe974){logger[_0x9b85('0x11')](_0x9b85('0x24'),_0x2fe974[_0x9b85('0x13')],_0x4832a6);_0xcb7300(_this[_0x9b85('0x11')](0x1f4,_0x2fe974[_0x9b85('0x13')]));});});}; \ No newline at end of file +var _0xdad6=['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','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','options','raw','where','limit','stringify','AddTagsToOpenchannelInteraction','find','addTags','omit','body','ids','spread','AddTags','lodash','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdad6,0xff));var _0x6dad=function(_0x3abaea,_0x9b3831){_0x3abaea=_0x3abaea-0x0;var _0x2d6d20=_0xdad6[_0x3abaea];return _0x2d6d20;};'use strict';var _=require(_0x6dad('0x0'));var util=require('util');var moment=require(_0x6dad('0x1'));var BPromise=require(_0x6dad('0x2'));var rs=require(_0x6dad('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6dad('0x4'))(_0x6dad('0x5'));var config=require(_0x6dad('0x6'));var jayson=require(_0x6dad('0x7'));var client=jayson[_0x6dad('0x8')][_0x6dad('0x9')]({'port':0x232a});config[_0x6dad('0xa')]=_[_0x6dad('0xb')](config['redis'],{'host':_0x6dad('0xc'),'port':0x18eb});var socket=require(_0x6dad('0xd'))(new Redis(config[_0x6dad('0xa')]));require(_0x6dad('0xe'))[_0x6dad('0xf')](socket);function respondWithRpcPromise(_0x258de3,_0x968ef4,_0x1b653b){return new BPromise(function(_0x6714c0,_0x186f60){return client[_0x6dad('0x10')](_0x258de3,_0x1b653b)[_0x6dad('0x11')](function(_0x5116f5){logger[_0x6dad('0x12')](_0x6dad('0x13'),_0x968ef4,_0x6dad('0x14'));logger[_0x6dad('0x15')](_0x6dad('0x16'),_0x968ef4,'request\x20sent',JSON['stringify'](_0x5116f5));if(_0x5116f5[_0x6dad('0x17')]){if(_0x5116f5[_0x6dad('0x17')][_0x6dad('0x18')]===0x1f4){logger[_0x6dad('0x17')](_0x6dad('0x13'),_0x968ef4,_0x5116f5[_0x6dad('0x17')][_0x6dad('0x19')]);return _0x186f60(_0x5116f5[_0x6dad('0x17')][_0x6dad('0x19')]);}logger['error'](_0x6dad('0x13'),_0x968ef4,_0x5116f5[_0x6dad('0x17')][_0x6dad('0x19')]);return _0x6714c0(_0x5116f5[_0x6dad('0x17')][_0x6dad('0x19')]);}else{logger[_0x6dad('0x12')](_0x6dad('0x13'),_0x968ef4,_0x6dad('0x14'));_0x6714c0(_0x5116f5[_0x6dad('0x1a')][_0x6dad('0x19')]);}})[_0x6dad('0x1b')](function(_0x370910){logger[_0x6dad('0x17')](_0x6dad('0x13'),_0x968ef4,_0x370910);_0x186f60(_0x370910);});});}exports[_0x6dad('0x1c')]=function(_0xdad506){var _0x5691fb=this;return new Promise(function(_0x5a7cf3,_0x5de3bd){return db[_0x6dad('0x1d')][_0x6dad('0x1e')](_0xdad506['body'],{'raw':_0xdad506[_0x6dad('0x1f')]?_0xdad506[_0x6dad('0x1f')][_0x6dad('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xdad506['options']?_0xdad506[_0x6dad('0x1f')][_0x6dad('0x21')]||null:null,'attributes':_0xdad506[_0x6dad('0x1f')]?_0xdad506[_0x6dad('0x1f')]['attributes']||null:null,'limit':_0xdad506['options']?_0xdad506['options'][_0x6dad('0x22')]||null:null})['then'](function(_0x2c6ad0){logger[_0x6dad('0x12')]('UpdateOpenchannelInteraction',_0xdad506);logger['debug'](_0x6dad('0x1c'),_0xdad506,JSON[_0x6dad('0x23')](_0x2c6ad0));_0x5a7cf3(_0x2c6ad0);})[_0x6dad('0x1b')](function(_0x383fe7){logger[_0x6dad('0x17')](_0x6dad('0x1c'),_0x383fe7[_0x6dad('0x19')],_0xdad506);_0x5de3bd(_0x5691fb[_0x6dad('0x17')](0x1f4,_0x383fe7[_0x6dad('0x19')]));});});};exports[_0x6dad('0x24')]=function(_0x2f9d63){return new Promise(function(_0x7e1fda,_0x160e3d){return db[_0x6dad('0x1d')][_0x6dad('0x25')]({'where':_0x2f9d63[_0x6dad('0x1f')]?_0x2f9d63[_0x6dad('0x1f')][_0x6dad('0x21')]||null:null})[_0x6dad('0x11')](function(_0x289455){if(_0x289455){return _0x289455[_0x6dad('0x26')](_0x2f9d63['body']['ids'],_[_0x6dad('0x27')](_0x2f9d63[_0x6dad('0x28')],[_0x6dad('0x29'),'id'])||{});}})[_0x6dad('0x2a')](function(_0x3a9d70){logger['info'](_0x6dad('0x2b'),_0x2f9d63);logger[_0x6dad('0x15')](_0x6dad('0x2b'),_0x2f9d63,JSON[_0x6dad('0x23')](_0x3a9d70));_0x7e1fda(_0x3a9d70);})[_0x6dad('0x1b')](function(_0x22de68){logger[_0x6dad('0x17')](_0x6dad('0x2b'),_0x22de68['message'],_0x2f9d63);_0x160e3d(_this[_0x6dad('0x17')](0x1f4,_0x22de68['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 927e533..3037d91 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 _0x69e7=['emit','removeListener','length','openchannelInteraction:','save','update'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x69e7,0x124));var _0x769e=function(_0x1f2461,_0xefc187){_0x1f2461=_0x1f2461-0x0;var _0x38ad6a=_0x69e7[_0x1f2461];return _0x38ad6a;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x769e('0x0'),'remove',_0x769e('0x1')];function createListener(_0x569521,_0x47dc97){return function(_0x27b089){_0x47dc97[_0x769e('0x2')](_0x569521,_0x27b089);};}function removeListener(_0x1216d7,_0x29e5ab){return function(){OpenchannelInteractionEvents[_0x769e('0x3')](_0x1216d7,_0x29e5ab);};}exports['register']=function(_0x10566b){for(var _0x147c09=0x0,_0x57764d=events[_0x769e('0x4')];_0x147c09<_0x57764d;_0x147c09++){var _0x420ebf=events[_0x147c09];var _0x368ee5=createListener(_0x769e('0x5')+_0x420ebf,_0x10566b);OpenchannelInteractionEvents['on'](_0x420ebf,_0x368ee5);}}; \ No newline at end of file +var _0xd748=['save','update','emit','removeListener','register','openchannelInteraction:','./openchannelInteraction.events'];(function(_0x33363d,_0x26c73e){var _0x5503e1=function(_0x5db3d5){while(--_0x5db3d5){_0x33363d['push'](_0x33363d['shift']());}};_0x5503e1(++_0x26c73e);}(_0xd748,0x1bf));var _0x8d74=function(_0x2b1551,_0x1776fe){_0x2b1551=_0x2b1551-0x0;var _0x2fc2a1=_0xd748[_0x2b1551];return _0x2fc2a1;};'use strict';var OpenchannelInteractionEvents=require(_0x8d74('0x0'));var events=[_0x8d74('0x1'),'remove',_0x8d74('0x2')];function createListener(_0x33f74a,_0x366d10){return function(_0x1e3e45){_0x366d10[_0x8d74('0x3')](_0x33f74a,_0x1e3e45);};}function removeListener(_0x3b6f98,_0x283bc0){return function(){OpenchannelInteractionEvents[_0x8d74('0x4')](_0x3b6f98,_0x283bc0);};}exports[_0x8d74('0x5')]=function(_0x463adb){for(var _0x1a95d7=0x0,_0x1ac448=events['length'];_0x1a95d7<_0x1ac448;_0x1a95d7++){var _0x2fbcc3=events[_0x1a95d7];var _0x2a27c5=createListener(_0x8d74('0x6')+_0x2fbcc3,_0x463adb);OpenchannelInteractionEvents['on'](_0x2fbcc3,_0x2a27c5);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index b7d5e9a..d61a10a 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports'];(function(_0x2ab95b,_0x185905){var _0x3d3458=function(_0x244de5){while(--_0x244de5){_0x2ab95b['push'](_0x2ab95b['shift']());}};_0x3d3458(++_0x185905);}(_0xedd9,0xfc));var _0x9edd=function(_0x2678ab,_0x1a3c31){_0x2678ab=_0x2678ab-0x0;var _0x4c3ca0=_0xedd9[_0x2678ab];return _0x4c3ca0;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['show']);router[_0x9edd('0xf')]('/',auth['isAuthenticated'](),interaction[_0x9edd('0x10')](_0x9edd('0x11'),'openchannelmessage:create'),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')](_0x9edd('0x15'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x16')]);router[_0x9edd('0x13')](_0x9edd('0x17'),auth['isAuthenticated'](),controller[_0x9edd('0x18')]);router[_0x9edd('0x19')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x1a')]);module[_0x9edd('0x1b')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports'];(function(_0x6319c,_0x1b4480){var _0x25235f=function(_0x4a45cb){while(--_0x4a45cb){_0x6319c['push'](_0x6319c['shift']());}};_0x25235f(++_0x1b4480);}(_0xedd9,0xfc));var _0x9edd=function(_0x38da8a,_0x12af5e){_0x38da8a=_0x38da8a-0x0;var _0x1badca=_0xedd9[_0x38da8a];return _0x1badca;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['show']);router[_0x9edd('0xf')]('/',auth['isAuthenticated'](),interaction[_0x9edd('0x10')](_0x9edd('0x11'),'openchannelmessage:create'),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')](_0x9edd('0x15'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x16')]);router[_0x9edd('0x13')](_0x9edd('0x17'),auth['isAuthenticated'](),controller[_0x9edd('0x18')]);router[_0x9edd('0x19')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x1a')]);module[_0x9edd('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 3c38a27..4356324 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 _0x34b7=['BOOLEAN','ENUM','out','STRING','TEXT','medium'];(function(_0x33efb8,_0x329950){var _0x8c14be=function(_0x4bc89e){while(--_0x4bc89e){_0x33efb8['push'](_0x33efb8['shift']());}};_0x8c14be(++_0x329950);}(_0x34b7,0x196));var _0x734b=function(_0x3c8d6c,_0x51ae3a){_0x3c8d6c=_0x3c8d6c-0x0;var _0x146521=_0x34b7[_0x3c8d6c];return _0x146521;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x734b('0x0')](_0x734b('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x734b('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x734b('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x734b('0x3')]('in',_0x734b('0x4')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x734b('0x5')]},'providerResponse':{'type':Sequelize[_0x734b('0x0')]}}; \ No newline at end of file +var _0x215d=['TEXT','medium','BOOLEAN','ENUM','out','DATE','sequelize'];(function(_0x5a905e,_0x31aa4a){var _0x4124d6=function(_0x37c28a){while(--_0x37c28a){_0x5a905e['push'](_0x5a905e['shift']());}};_0x4124d6(++_0x31aa4a);}(_0x215d,0x187));var _0xd215=function(_0x59c5a9,_0x4704fc){_0x59c5a9=_0x59c5a9-0x0;var _0x539f7e=_0x215d[_0x59c5a9];return _0x539f7e;};'use strict';var Sequelize=require(_0xd215('0x0'));module['exports']={'body':{'type':Sequelize[_0xd215('0x1')](_0xd215('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xd215('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xd215('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd215('0x4')]('in',_0xd215('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xd215('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xd215('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 36e6ecf..3b232f0 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 _0x9b2c=['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','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','jayson/promise','client','http','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','sendStatus','name','send','index','map','OpenchannelMessage','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','options','then','includeAll','include','rows','catch','show','params','merge','find','create','body','describe','openchannel-interactions','accept','read','readAt','UserId','user','get','OpenchannelInteractionId','update','isNil','format','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','email','internal','manual','interface','channel','event','EventManager','acceptmessage','reject','openchannel','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','RejectMessage','rejectMessage','SIP/%s','rejectmessage','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x4fe29f,_0x47eb82){var _0x5503b1=function(_0x27dd29){while(--_0x27dd29){_0x4fe29f['push'](_0x4fe29f['shift']());}};_0x5503b1(++_0x47eb82);}(_0x9b2c,0x189));var _0xc9b2=function(_0x151381,_0x97b314){_0x151381=_0x151381-0x0;var _0x2afab6=_0x9b2c[_0x151381];return _0x2afab6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc9b2('0x0'));var zipdir=require(_0xc9b2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc9b2('0x2'));var moment=require('moment');var BPromise=require(_0xc9b2('0x3'));var Mustache=require('mustache');var util=require(_0xc9b2('0x4'));var path=require(_0xc9b2('0x5'));var sox=require(_0xc9b2('0x6'));var csv=require(_0xc9b2('0x7'));var ejs=require(_0xc9b2('0x8'));var fs=require('fs');var fs_extra=require(_0xc9b2('0x9'));var _=require(_0xc9b2('0xa'));var squel=require(_0xc9b2('0xb'));var crypto=require(_0xc9b2('0xc'));var jsforce=require(_0xc9b2('0xd'));var deskjs=require(_0xc9b2('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc9b2('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc9b2('0x10'));var qs=require(_0xc9b2('0x11'));var as=require(_0xc9b2('0x12'));var hardwareService=require(_0xc9b2('0x13'));var logger=require(_0xc9b2('0x14'))(_0xc9b2('0x15'));var utils=require(_0xc9b2('0x16'));var config=require(_0xc9b2('0x17'));var licenseUtil=require(_0xc9b2('0x18'));var db=require(_0xc9b2('0x19'))['db'];config[_0xc9b2('0x1a')]=_[_0xc9b2('0x1b')](config['redis'],{'host':_0xc9b2('0x1c'),'port':0x18eb});var socket=require(_0xc9b2('0x1d'))(new Redis(config[_0xc9b2('0x1a')]));require(_0xc9b2('0x1e'))['register'](socket);var jayson=require(_0xc9b2('0x1f'));var client=jayson[_0xc9b2('0x20')][_0xc9b2('0x21')]({'port':0x232c});var client9002=jayson[_0xc9b2('0x20')][_0xc9b2('0x21')]({'port':0x232a});function respondWithRpcPromise(_0xc37dd,_0x302c1a,_0x2167f5,_0x59fb0f){return new BPromise(function(_0x351c79,_0x266823){var _0xe224aa=_0x59fb0f||client;return _0xe224aa[_0xc9b2('0x22')](_0xc37dd,_0x2167f5)['then'](function(_0x10aca7){logger[_0xc9b2('0x23')](_0xc9b2('0x24'),_0x302c1a,_0xc9b2('0x25'));logger[_0xc9b2('0x26')](_0xc9b2('0x27'),_0x302c1a,_0xc9b2('0x25'),JSON['stringify'](_0x10aca7));if(_0x10aca7[_0xc9b2('0x28')]){if(_0x10aca7['error'][_0xc9b2('0x29')]===0x1f4){logger[_0xc9b2('0x28')]('OpenchannelMessage,\x20%s,\x20%s',_0x302c1a,_0x10aca7[_0xc9b2('0x28')][_0xc9b2('0x2a')]);return _0x266823(_0x10aca7['error'][_0xc9b2('0x2a')]);}logger['error'](_0xc9b2('0x24'),_0x302c1a,_0x10aca7[_0xc9b2('0x28')][_0xc9b2('0x2a')]);return _0x351c79(_0x10aca7[_0xc9b2('0x28')][_0xc9b2('0x2a')]);}else{logger[_0xc9b2('0x23')](_0xc9b2('0x24'),_0x302c1a,_0xc9b2('0x25'));_0x351c79(_0x10aca7[_0xc9b2('0x2b')][_0xc9b2('0x2a')]);}})['catch'](function(_0x15dc60){logger[_0xc9b2('0x28')](_0xc9b2('0x24'),_0x302c1a,_0x15dc60);_0x266823(_0x15dc60);});});}function respondWithStatusCode(_0x8e5dfa,_0x5a2c79){_0x5a2c79=_0x5a2c79||0xcc;return function(_0x349943){if(_0x349943){return _0x8e5dfa['sendStatus'](_0x5a2c79);}return _0x8e5dfa[_0xc9b2('0x2c')](_0x5a2c79)[_0xc9b2('0x2d')]();};}function respondWithResult(_0x38b3ff,_0x245385){_0x245385=_0x245385||0xc8;return function(_0x39a186){if(_0x39a186){return _0x38b3ff[_0xc9b2('0x2c')](_0x245385)[_0xc9b2('0x2e')](_0x39a186);}};}function respondWithFilteredResult(_0x3d735a,_0x46ab9b){return function(_0x37f4f0){if(_0x37f4f0){var _0x16936f=typeof _0x46ab9b[_0xc9b2('0x2f')]===_0xc9b2('0x30')&&typeof _0x46ab9b[_0xc9b2('0x31')]===_0xc9b2('0x30');var _0x2eebd3=_0x37f4f0['count'];var _0x5c2277=_0x16936f?0x0:_0x46ab9b[_0xc9b2('0x2f')];var _0x34533a=_0x16936f?_0x37f4f0[_0xc9b2('0x32')]:_0x46ab9b['offset']+_0x46ab9b[_0xc9b2('0x31')];var _0x493e09;if(_0x34533a>=_0x2eebd3){_0x34533a=_0x2eebd3;_0x493e09=0xc8;}else{_0x493e09=0xce;}_0x3d735a[_0xc9b2('0x2c')](_0x493e09);return _0x3d735a[_0xc9b2('0x33')](_0xc9b2('0x34'),_0x5c2277+'-'+_0x34533a+'/'+_0x2eebd3)[_0xc9b2('0x2e')](_0x37f4f0);}return null;};}function patchUpdates(_0x3f7e5d){return function(_0x1d9f19){try{jsonpatch[_0xc9b2('0x35')](_0x1d9f19,_0x3f7e5d,!![]);}catch(_0x23de79){return BPromise['reject'](_0x23de79);}return _0x1d9f19[_0xc9b2('0x36')]();};}function saveUpdates(_0x61ad5b,_0x1eb98d){return function(_0x26f69e){if(_0x26f69e){return _0x26f69e['update'](_0x61ad5b)['then'](function(_0x2c0ca3){return _0x2c0ca3;});}return null;};}function removeEntity(_0x11ce38,_0x53155b){return function(_0x5c894d){if(_0x5c894d){return _0x5c894d[_0xc9b2('0x37')]()['then'](function(){_0x11ce38[_0xc9b2('0x2c')](0xcc)[_0xc9b2('0x2d')]();});}};}function handleEntityNotFound(_0x488835,_0x457b88){return function(_0x33baf3){if(!_0x33baf3){_0x488835[_0xc9b2('0x38')](0x194);}return _0x33baf3;};}function handleError(_0x4bc980,_0x3092d3){_0x3092d3=_0x3092d3||0x1f4;return function(_0xd8ee42){logger[_0xc9b2('0x28')](_0xd8ee42['stack']);if(_0xd8ee42['name']){delete _0xd8ee42[_0xc9b2('0x39')];}_0x4bc980['status'](_0x3092d3)[_0xc9b2('0x3a')](_0xd8ee42);};}exports[_0xc9b2('0x3b')]=function(_0x5b08a5,_0x2503ce){var _0x3fba82={},_0x3b7b90={},_0x4ff33e={'count':0x0,'rows':[]};var _0x2e2976=_[_0xc9b2('0x3c')](db[_0xc9b2('0x3d')][_0xc9b2('0x3e')],function(_0x3f31ae){return{'name':_0x3f31ae['fieldName'],'type':_0x3f31ae[_0xc9b2('0x3f')][_0xc9b2('0x40')]};});_0x3b7b90[_0xc9b2('0x41')]=_[_0xc9b2('0x3c')](_0x2e2976,_0xc9b2('0x39'));_0x3b7b90[_0xc9b2('0x42')]=_[_0xc9b2('0x43')](_0x5b08a5[_0xc9b2('0x42')]);_0x3b7b90[_0xc9b2('0x44')]=_[_0xc9b2('0x45')](_0x3b7b90[_0xc9b2('0x41')],_0x3b7b90[_0xc9b2('0x42')]);_0x3fba82[_0xc9b2('0x46')]=_[_0xc9b2('0x45')](_0x3b7b90['model'],qs[_0xc9b2('0x47')](_0x5b08a5[_0xc9b2('0x42')][_0xc9b2('0x47')]));_0x3fba82[_0xc9b2('0x46')]=_0x3fba82['attributes'][_0xc9b2('0x48')]?_0x3fba82[_0xc9b2('0x46')]:_0x3b7b90['model'];if(!_0x5b08a5[_0xc9b2('0x42')][_0xc9b2('0x49')]('nolimit')){_0x3fba82[_0xc9b2('0x31')]=qs['limit'](_0x5b08a5['query'][_0xc9b2('0x31')]);_0x3fba82[_0xc9b2('0x2f')]=qs[_0xc9b2('0x2f')](_0x5b08a5[_0xc9b2('0x42')][_0xc9b2('0x2f')]);}_0x3fba82[_0xc9b2('0x4a')]=qs[_0xc9b2('0x4b')](_0x5b08a5[_0xc9b2('0x42')][_0xc9b2('0x4b')]);_0x3fba82['where']=qs[_0xc9b2('0x44')](_[_0xc9b2('0x4c')](_0x5b08a5[_0xc9b2('0x42')],_0x3b7b90[_0xc9b2('0x44')]),_0x2e2976);if(_0x5b08a5[_0xc9b2('0x42')][_0xc9b2('0x4d')]){_0x3fba82[_0xc9b2('0x4e')]=_['merge'](_0x3fba82[_0xc9b2('0x4e')],{'$or':_['map'](_0x2e2976,function(_0x1c77ee){if(_0x1c77ee[_0xc9b2('0x3f')]!=='VIRTUAL'){var _0x2fca43={};_0x2fca43[_0x1c77ee['name']]={'$like':'%'+_0x5b08a5[_0xc9b2('0x42')][_0xc9b2('0x4d')]+'%'};return _0x2fca43;}})});}_0x3fba82=_['merge']({},_0x3fba82,_0x5b08a5[_0xc9b2('0x4f')]);var _0x4d492e={'where':_0x3fba82[_0xc9b2('0x4e')]};return db[_0xc9b2('0x3d')]['count'](_0x4d492e)[_0xc9b2('0x50')](function(_0x16f109){_0x4ff33e[_0xc9b2('0x32')]=_0x16f109;if(_0x5b08a5[_0xc9b2('0x42')][_0xc9b2('0x51')]){_0x3fba82[_0xc9b2('0x52')]=[{'all':!![]}];}return db[_0xc9b2('0x3d')]['findAll'](_0x3fba82);})['then'](function(_0xd14d77){_0x4ff33e[_0xc9b2('0x53')]=_0xd14d77;return _0x4ff33e;})['then'](respondWithFilteredResult(_0x2503ce,_0x3fba82))[_0xc9b2('0x54')](handleError(_0x2503ce,null));};exports[_0xc9b2('0x55')]=function(_0x314292,_0x2af138){var _0x5c6d57={'raw':!![],'where':{'id':_0x314292[_0xc9b2('0x56')]['id']}},_0x29628c={};_0x29628c[_0xc9b2('0x41')]=_[_0xc9b2('0x43')](db['OpenchannelMessage']['rawAttributes']);_0x29628c[_0xc9b2('0x42')]=_[_0xc9b2('0x43')](_0x314292[_0xc9b2('0x42')]);_0x29628c['filters']=_[_0xc9b2('0x45')](_0x29628c[_0xc9b2('0x41')],_0x29628c[_0xc9b2('0x42')]);_0x5c6d57[_0xc9b2('0x46')]=_[_0xc9b2('0x45')](_0x29628c[_0xc9b2('0x41')],qs['fields'](_0x314292[_0xc9b2('0x42')][_0xc9b2('0x47')]));_0x5c6d57[_0xc9b2('0x46')]=_0x5c6d57[_0xc9b2('0x46')][_0xc9b2('0x48')]?_0x5c6d57['attributes']:_0x29628c[_0xc9b2('0x41')];if(_0x314292[_0xc9b2('0x42')][_0xc9b2('0x51')]){_0x5c6d57['include']=[{'all':!![]}];}_0x5c6d57=_[_0xc9b2('0x57')]({},_0x5c6d57,_0x314292[_0xc9b2('0x4f')]);return db['OpenchannelMessage'][_0xc9b2('0x58')](_0x5c6d57)[_0xc9b2('0x50')](handleEntityNotFound(_0x2af138,null))['then'](respondWithResult(_0x2af138,null))[_0xc9b2('0x54')](handleError(_0x2af138,null));};exports[_0xc9b2('0x59')]=function(_0xd000f9,_0x54181b){return db[_0xc9b2('0x3d')][_0xc9b2('0x59')](_0xd000f9[_0xc9b2('0x5a')],{})[_0xc9b2('0x50')](respondWithResult(_0x54181b,0xc9))[_0xc9b2('0x54')](handleError(_0x54181b,null));};exports['update']=function(_0x379890,_0x1cec91){if(_0x379890[_0xc9b2('0x5a')]['id']){delete _0x379890[_0xc9b2('0x5a')]['id'];}return db[_0xc9b2('0x3d')][_0xc9b2('0x58')]({'where':{'id':_0x379890[_0xc9b2('0x56')]['id']}})['then'](handleEntityNotFound(_0x1cec91,null))[_0xc9b2('0x50')](saveUpdates(_0x379890[_0xc9b2('0x5a')],null))[_0xc9b2('0x50')](respondWithResult(_0x1cec91,null))[_0xc9b2('0x54')](handleError(_0x1cec91,null));};exports[_0xc9b2('0x37')]=function(_0x42f91e,_0x2ce887){return db[_0xc9b2('0x3d')]['find']({'where':{'id':_0x42f91e[_0xc9b2('0x56')]['id']}})[_0xc9b2('0x50')](handleEntityNotFound(_0x2ce887,null))[_0xc9b2('0x50')](removeEntity(_0x2ce887,null))['catch'](handleError(_0x2ce887,null));};exports[_0xc9b2('0x5b')]=function(_0x423b58,_0x57cba5){return db[_0xc9b2('0x3d')][_0xc9b2('0x5b')]()[_0xc9b2('0x50')](respondWithResult(_0x57cba5,null))['catch'](handleError(_0x57cba5,null));};var interaction_log=require(_0xc9b2('0x14'))(_0xc9b2('0x5c'));exports[_0xc9b2('0x5d')]=function(_0x40ddd0,_0x4a4e32,_0x31cf1d){var _0x28e07={'agent':{},'channel':'openchannel'};if(_0x40ddd0[_0xc9b2('0x5a')]['id']){delete _0x40ddd0[_0xc9b2('0x5a')]['id'];}_0x40ddd0[_0xc9b2('0x5a')][_0xc9b2('0x5e')]=!![];_0x40ddd0[_0xc9b2('0x5a')][_0xc9b2('0x5f')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x40ddd0[_0xc9b2('0x5a')]['UserId']=_0x40ddd0[_0xc9b2('0x5a')][_0xc9b2('0x60')]||_0x40ddd0[_0xc9b2('0x61')]['id'];_0x28e07['agent']['id']=_0x40ddd0[_0xc9b2('0x5a')][_0xc9b2('0x60')];return db[_0xc9b2('0x3d')]['find']({'where':{'id':_0x40ddd0['params']['id'],'UserId':null}})[_0xc9b2('0x50')](handleEntityNotFound(_0x4a4e32,null))[_0xc9b2('0x50')](saveUpdates(_0x40ddd0[_0xc9b2('0x5a')],null))[_0xc9b2('0x50')](function(_0x3baaee){if(_0x3baaee){_0x28e07[_0xc9b2('0x2a')]=_0x3baaee[_0xc9b2('0x62')]({'plain':!![]});return db['OpenchannelInteraction'][_0xc9b2('0x58')]({'where':{'id':_0x3baaee[_0xc9b2('0x63')]}});}return null;})[_0xc9b2('0x50')](handleEntityNotFound(_0x4a4e32,null))['then'](function(_0x67481a){if(_0x67481a){return _0x67481a[_0xc9b2('0x64')]({'UserId':_0x40ddd0['body'][_0xc9b2('0x60')],'read1stAt':_[_0xc9b2('0x65')](_0x67481a['read1stAt'])?moment()[_0xc9b2('0x66')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x13989e){if(_0x13989e){_0x28e07[_0xc9b2('0x67')]=_0x13989e[_0xc9b2('0x62')]({'plain':!![]});interaction_log[_0xc9b2('0x23')](_0xc9b2('0x68'),_0x40ddd0[_0xc9b2('0x61')]['id'],_0x40ddd0[_0xc9b2('0x61')][_0xc9b2('0x39')],_0x40ddd0[_0xc9b2('0x61')][_0xc9b2('0x69')],_0x28e07[_0xc9b2('0x67')]['id'],_0x40ddd0['body']?JSON['stringify'](_0x40ddd0[_0xc9b2('0x5a')]):_0xc9b2('0x6a'));return respondWithRpcPromise(_0xc9b2('0x6b'),_0xc9b2('0x6c'),_0x28e07);}return null;})[_0xc9b2('0x50')](function(_0x535bb3){var _0x33a848=_0xc9b2('0x6d')+_0x535bb3[_0xc9b2('0x2a')][_0xc9b2('0x6e')];return db[_0xc9b2('0x6f')][_0xc9b2('0x42')](_0x33a848,{'type':db[_0xc9b2('0x70')][_0xc9b2('0x71')][_0xc9b2('0x72')],'raw':!![]})[_0xc9b2('0x50')](function(_0x491c1b){return _0x491c1b;});})[_0xc9b2('0x50')](function(_0xdc923a){if(_0xdc923a){_0x28e07[_0xc9b2('0x2a')][_0xc9b2('0x73')]=_0xdc923a[0x0];if(!_0x40ddd0[_0xc9b2('0x5a')][_0xc9b2('0x60')])return;return db[_0xc9b2('0x74')][_0xc9b2('0x58')]({'where':{'id':_0x40ddd0[_0xc9b2('0x5a')]['UserId'],'role':_0xc9b2('0x75')},'attributes':['id',_0xc9b2('0x39'),'fullname',_0xc9b2('0x76'),_0xc9b2('0x77')],'raw':!![]});}return null;})[_0xc9b2('0x50')](function(_0x4895b1){if(!_0x4895b1)return null;_0x28e07['message'][_0xc9b2('0x75')]=_0x4895b1;return _0x28e07;})[_0xc9b2('0x50')](function(_0x4c4d81){if(_0x4c4d81){if(_0x40ddd0[_0xc9b2('0x5a')][_0xc9b2('0x78')]){_0x28e07[_0xc9b2('0x2a')][_0xc9b2('0x79')]=util[_0xc9b2('0x66')]('SIP/%s',_0x40ddd0['user'][_0xc9b2('0x39')]);_0x28e07['message']['channel']=_0x28e07[_0xc9b2('0x7a')];_0x28e07[_0xc9b2('0x2a')][_0xc9b2('0x7b')]='accept';return respondWithRpcPromise('EventManager',_0xc9b2('0x7c'),{'event':_0xc9b2('0x7d'),'message':_0x28e07['message']},client9002)[_0xc9b2('0x50')](function(){return _0x28e07;});}return _0x28e07;}return null;})['then'](respondWithResult(_0x4a4e32,null))[_0xc9b2('0x54')](handleError(_0x4a4e32,null));};var interaction_log=require(_0xc9b2('0x14'))(_0xc9b2('0x5c'));exports[_0xc9b2('0x7e')]=function(_0x3aa152,_0x4893bf,_0x3f309e){var _0x3c361e={'agent':{},'channel':_0xc9b2('0x7f')};if(_0x3aa152[_0xc9b2('0x5a')]['id']){delete _0x3aa152[_0xc9b2('0x5a')]['id'];}_0x3aa152['body']['UserId']=_0x3aa152['body'][_0xc9b2('0x60')]||_0x3aa152['user']['id'];_0x3c361e[_0xc9b2('0x75')]['id']=_0x3aa152[_0xc9b2('0x5a')][_0xc9b2('0x60')];return db[_0xc9b2('0x3d')][_0xc9b2('0x58')]({'where':{'id':_0x3aa152[_0xc9b2('0x56')]['id'],'UserId':null}})[_0xc9b2('0x50')](handleEntityNotFound(_0x4893bf,null))[_0xc9b2('0x50')](function(_0x5e80f2){if(_0x5e80f2){_0x3c361e['message']=_0x5e80f2['get']({'plain':!![]});return db[_0xc9b2('0x80')][_0xc9b2('0x58')]({'where':{'id':_0x5e80f2['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x4893bf,null))[_0xc9b2('0x50')](function(_0x64c235){if(_0x64c235){_0x3c361e['interaction']=_0x64c235[_0xc9b2('0x62')]({'plain':!![]});interaction_log[_0xc9b2('0x23')](_0xc9b2('0x81'),_0x3aa152[_0xc9b2('0x61')]['id'],_0x3aa152[_0xc9b2('0x61')][_0xc9b2('0x39')],_0x3aa152[_0xc9b2('0x61')][_0xc9b2('0x69')],_0x3c361e[_0xc9b2('0x67')]['id'],_0x3aa152[_0xc9b2('0x5a')]?JSON[_0xc9b2('0x82')](_0x3aa152[_0xc9b2('0x5a')]):'null');return respondWithRpcPromise(_0xc9b2('0x83'),_0xc9b2('0x84'),_0x3c361e);}return null;})[_0xc9b2('0x50')](function(_0x48a967){var _0x34edec=_0xc9b2('0x6d')+_0x48a967[_0xc9b2('0x2a')][_0xc9b2('0x6e')];return db[_0xc9b2('0x6f')]['query'](_0x34edec,{'type':db[_0xc9b2('0x70')][_0xc9b2('0x71')]['SELECT'],'raw':!![]})[_0xc9b2('0x50')](function(_0x6918b1){return _0x6918b1;});})[_0xc9b2('0x50')](function(_0x55da71){if(_0x55da71){_0x3c361e['message']['contact']=_0x55da71[0x0];if(!_0x3aa152[_0xc9b2('0x5a')][_0xc9b2('0x60')])return;return db['User'][_0xc9b2('0x58')]({'where':{'id':_0x3aa152[_0xc9b2('0x5a')][_0xc9b2('0x60')],'role':'agent'},'attributes':['id',_0xc9b2('0x39'),'fullname',_0xc9b2('0x76'),_0xc9b2('0x77')],'raw':!![]});}return null;})['then'](function(_0xda3fa9){if(!_0xda3fa9)return null;_0x3c361e[_0xc9b2('0x2a')]['agent']=_0xda3fa9;return _0x3c361e;})['then'](function(_0x1bcb6a){if(_0x1bcb6a){_0x1bcb6a[_0xc9b2('0x2a')]['interface']=util[_0xc9b2('0x66')](_0xc9b2('0x85'),_0x3aa152[_0xc9b2('0x61')][_0xc9b2('0x39')]);_0x1bcb6a[_0xc9b2('0x2a')]['channel']=_0x3c361e[_0xc9b2('0x7a')];_0x1bcb6a[_0xc9b2('0x2a')]['event']=_0xc9b2('0x7e');respondWithRpcPromise('EventManager',_0xc9b2('0x7c'),{'event':_0xc9b2('0x86'),'message':_0x1bcb6a[_0xc9b2('0x2a')]},client9002);return _0x3c361e;}return null;})[_0xc9b2('0x50')](respondWithResult(_0x4893bf,null))[_0xc9b2('0x54')](handleError(_0x4893bf,null));}; \ No newline at end of file +var _0xd0d0=['message','info','result','catch','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','update','destroy','stack','name','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','filters','fields','length','attributes','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','include','findAll','rows','show','params','intersection','find','create','body','describe','accept','openchannel','read','readAt','format','UserId','user','agent','get','OpenchannelInteraction','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','openchannel-interactions','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','internal','reject','rejectmessage','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','./openchannelMessage.socket','jayson/promise','client','http','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x7805cd,_0x2946a6){var _0x4d4875=function(_0x39da49){while(--_0x39da49){_0x7805cd['push'](_0x7805cd['shift']());}};_0x4d4875(++_0x2946a6);}(_0xd0d0,0x15d));var _0x0d0d=function(_0x5469f7,_0x3f390e){_0x5469f7=_0x5469f7-0x0;var _0x78c529=_0xd0d0[_0x5469f7];return _0x78c529;};'use strict';var emlformat=require(_0x0d0d('0x0'));var rimraf=require(_0x0d0d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0d0d('0x2'));var rp=require(_0x0d0d('0x3'));var moment=require(_0x0d0d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0d0d('0x5'));var util=require(_0x0d0d('0x6'));var path=require(_0x0d0d('0x7'));var sox=require(_0x0d0d('0x8'));var csv=require(_0x0d0d('0x9'));var ejs=require(_0x0d0d('0xa'));var fs=require('fs');var fs_extra=require(_0x0d0d('0xb'));var _=require(_0x0d0d('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0d0d('0xd'));var deskjs=require(_0x0d0d('0xe'));var toCsv=require(_0x0d0d('0x9'));var querystring=require(_0x0d0d('0xf'));var Papa=require(_0x0d0d('0x10'));var Redis=require(_0x0d0d('0x11'));var authService=require(_0x0d0d('0x12'));var qs=require(_0x0d0d('0x13'));var as=require(_0x0d0d('0x14'));var hardwareService=require(_0x0d0d('0x15'));var logger=require(_0x0d0d('0x16'))('api');var utils=require(_0x0d0d('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x0d0d('0x18'));var db=require('../../mysqldb')['db'];config[_0x0d0d('0x19')]=_['defaults'](config['redis'],{'host':_0x0d0d('0x1a'),'port':0x18eb});var socket=require(_0x0d0d('0x1b'))(new Redis(config[_0x0d0d('0x19')]));require(_0x0d0d('0x1c'))['register'](socket);var jayson=require(_0x0d0d('0x1d'));var client=jayson[_0x0d0d('0x1e')][_0x0d0d('0x1f')]({'port':0x232c});var client9002=jayson[_0x0d0d('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42d57b,_0x10de99,_0x31edec,_0x517121){return new BPromise(function(_0x347afa,_0x350aef){var _0x1af97e=_0x517121||client;return _0x1af97e[_0x0d0d('0x20')](_0x42d57b,_0x31edec)[_0x0d0d('0x21')](function(_0x36bd0f){logger['info'](_0x0d0d('0x22'),_0x10de99,'request\x20sent');logger[_0x0d0d('0x23')](_0x0d0d('0x24'),_0x10de99,_0x0d0d('0x25'),JSON[_0x0d0d('0x26')](_0x36bd0f));if(_0x36bd0f[_0x0d0d('0x27')]){if(_0x36bd0f[_0x0d0d('0x27')][_0x0d0d('0x28')]===0x1f4){logger['error'](_0x0d0d('0x22'),_0x10de99,_0x36bd0f[_0x0d0d('0x27')]['message']);return _0x350aef(_0x36bd0f[_0x0d0d('0x27')]['message']);}logger['error'](_0x0d0d('0x22'),_0x10de99,_0x36bd0f[_0x0d0d('0x27')][_0x0d0d('0x29')]);return _0x347afa(_0x36bd0f[_0x0d0d('0x27')]['message']);}else{logger[_0x0d0d('0x2a')](_0x0d0d('0x22'),_0x10de99,_0x0d0d('0x25'));_0x347afa(_0x36bd0f[_0x0d0d('0x2b')]['message']);}})[_0x0d0d('0x2c')](function(_0x58bb78){logger[_0x0d0d('0x27')](_0x0d0d('0x22'),_0x10de99,_0x58bb78);_0x350aef(_0x58bb78);});});}function respondWithStatusCode(_0x1a5c70,_0x2d0763){_0x2d0763=_0x2d0763||0xcc;return function(_0x32608a){if(_0x32608a){return _0x1a5c70[_0x0d0d('0x2d')](_0x2d0763);}return _0x1a5c70[_0x0d0d('0x2e')](_0x2d0763)[_0x0d0d('0x2f')]();};}function respondWithResult(_0x324da7,_0x3e9f98){_0x3e9f98=_0x3e9f98||0xc8;return function(_0x4d11c4){if(_0x4d11c4){return _0x324da7['status'](_0x3e9f98)['json'](_0x4d11c4);}};}function respondWithFilteredResult(_0x49a835,_0x4e18f4){return function(_0x4a2dcb){if(_0x4a2dcb){var _0x2541ca=typeof _0x4e18f4['offset']===_0x0d0d('0x30')&&typeof _0x4e18f4['limit']===_0x0d0d('0x30');var _0x3b159c=_0x4a2dcb[_0x0d0d('0x31')];var _0x9e6987=_0x2541ca?0x0:_0x4e18f4[_0x0d0d('0x32')];var _0x1b2869=_0x2541ca?_0x4a2dcb['count']:_0x4e18f4[_0x0d0d('0x32')]+_0x4e18f4[_0x0d0d('0x33')];var _0x20006e;if(_0x1b2869>=_0x3b159c){_0x1b2869=_0x3b159c;_0x20006e=0xc8;}else{_0x20006e=0xce;}_0x49a835[_0x0d0d('0x2e')](_0x20006e);return _0x49a835[_0x0d0d('0x34')](_0x0d0d('0x35'),_0x9e6987+'-'+_0x1b2869+'/'+_0x3b159c)['json'](_0x4a2dcb);}return null;};}function patchUpdates(_0x45364a){return function(_0x17675e){try{jsonpatch['apply'](_0x17675e,_0x45364a,!![]);}catch(_0xc686e3){return BPromise['reject'](_0xc686e3);}return _0x17675e['save']();};}function saveUpdates(_0xaad592,_0x73bca2){return function(_0x57693c){if(_0x57693c){return _0x57693c[_0x0d0d('0x36')](_0xaad592)[_0x0d0d('0x21')](function(_0x34549c){return _0x34549c;});}return null;};}function removeEntity(_0x15bb8c,_0x52e164){return function(_0x591cf8){if(_0x591cf8){return _0x591cf8[_0x0d0d('0x37')]()[_0x0d0d('0x21')](function(){_0x15bb8c['status'](0xcc)[_0x0d0d('0x2f')]();});}};}function handleEntityNotFound(_0x15c2f1,_0x16b2d7){return function(_0x31bb12){if(!_0x31bb12){_0x15c2f1['sendStatus'](0x194);}return _0x31bb12;};}function handleError(_0x1f1837,_0x3546f6){_0x3546f6=_0x3546f6||0x1f4;return function(_0xa85f4b){logger[_0x0d0d('0x27')](_0xa85f4b[_0x0d0d('0x38')]);if(_0xa85f4b[_0x0d0d('0x39')]){delete _0xa85f4b[_0x0d0d('0x39')];}_0x1f1837['status'](_0x3546f6)['send'](_0xa85f4b);};}exports['index']=function(_0x5e886b,_0x51fc60){var _0x2c3dc4={},_0x3f0a2c={},_0x3626e0={'count':0x0,'rows':[]};var _0x1f3f2c=_[_0x0d0d('0x3a')](db[_0x0d0d('0x3b')][_0x0d0d('0x3c')],function(_0x45ece1){return{'name':_0x45ece1[_0x0d0d('0x3d')],'type':_0x45ece1[_0x0d0d('0x3e')][_0x0d0d('0x3f')]};});_0x3f0a2c[_0x0d0d('0x40')]=_[_0x0d0d('0x3a')](_0x1f3f2c,_0x0d0d('0x39'));_0x3f0a2c[_0x0d0d('0x41')]=_['keys'](_0x5e886b[_0x0d0d('0x41')]);_0x3f0a2c[_0x0d0d('0x42')]=_['intersection'](_0x3f0a2c[_0x0d0d('0x40')],_0x3f0a2c[_0x0d0d('0x41')]);_0x2c3dc4['attributes']=_['intersection'](_0x3f0a2c[_0x0d0d('0x40')],qs[_0x0d0d('0x43')](_0x5e886b['query'][_0x0d0d('0x43')]));_0x2c3dc4['attributes']=_0x2c3dc4['attributes'][_0x0d0d('0x44')]?_0x2c3dc4[_0x0d0d('0x45')]:_0x3f0a2c[_0x0d0d('0x40')];if(!_0x5e886b[_0x0d0d('0x41')][_0x0d0d('0x46')](_0x0d0d('0x47'))){_0x2c3dc4[_0x0d0d('0x33')]=qs['limit'](_0x5e886b[_0x0d0d('0x41')]['limit']);_0x2c3dc4[_0x0d0d('0x32')]=qs['offset'](_0x5e886b[_0x0d0d('0x41')]['offset']);}_0x2c3dc4['order']=qs['sort'](_0x5e886b['query'][_0x0d0d('0x48')]);_0x2c3dc4[_0x0d0d('0x49')]=qs[_0x0d0d('0x42')](_[_0x0d0d('0x4a')](_0x5e886b[_0x0d0d('0x41')],_0x3f0a2c[_0x0d0d('0x42')]),_0x1f3f2c);if(_0x5e886b[_0x0d0d('0x41')]['filter']){_0x2c3dc4[_0x0d0d('0x49')]=_[_0x0d0d('0x4b')](_0x2c3dc4['where'],{'$or':_[_0x0d0d('0x3a')](_0x1f3f2c,function(_0x1391e6){if(_0x1391e6[_0x0d0d('0x3e')]!=='VIRTUAL'){var _0x29fe76={};_0x29fe76[_0x1391e6[_0x0d0d('0x39')]]={'$like':'%'+_0x5e886b[_0x0d0d('0x41')][_0x0d0d('0x4c')]+'%'};return _0x29fe76;}})});}_0x2c3dc4=_[_0x0d0d('0x4b')]({},_0x2c3dc4,_0x5e886b[_0x0d0d('0x4d')]);var _0x3e21df={'where':_0x2c3dc4[_0x0d0d('0x49')]};return db[_0x0d0d('0x3b')]['count'](_0x3e21df)[_0x0d0d('0x21')](function(_0x2eca05){_0x3626e0[_0x0d0d('0x31')]=_0x2eca05;if(_0x5e886b[_0x0d0d('0x41')]['includeAll']){_0x2c3dc4[_0x0d0d('0x4e')]=[{'all':!![]}];}return db[_0x0d0d('0x3b')][_0x0d0d('0x4f')](_0x2c3dc4);})[_0x0d0d('0x21')](function(_0x300ca8){_0x3626e0[_0x0d0d('0x50')]=_0x300ca8;return _0x3626e0;})[_0x0d0d('0x21')](respondWithFilteredResult(_0x51fc60,_0x2c3dc4))[_0x0d0d('0x2c')](handleError(_0x51fc60,null));};exports[_0x0d0d('0x51')]=function(_0xdca721,_0x25b2bb){var _0xdba8c7={'raw':!![],'where':{'id':_0xdca721[_0x0d0d('0x52')]['id']}},_0x5e0c99={};_0x5e0c99[_0x0d0d('0x40')]=_['keys'](db['OpenchannelMessage']['rawAttributes']);_0x5e0c99[_0x0d0d('0x41')]=_['keys'](_0xdca721['query']);_0x5e0c99[_0x0d0d('0x42')]=_[_0x0d0d('0x53')](_0x5e0c99['model'],_0x5e0c99[_0x0d0d('0x41')]);_0xdba8c7['attributes']=_['intersection'](_0x5e0c99[_0x0d0d('0x40')],qs[_0x0d0d('0x43')](_0xdca721[_0x0d0d('0x41')][_0x0d0d('0x43')]));_0xdba8c7['attributes']=_0xdba8c7['attributes'][_0x0d0d('0x44')]?_0xdba8c7['attributes']:_0x5e0c99[_0x0d0d('0x40')];if(_0xdca721[_0x0d0d('0x41')]['includeAll']){_0xdba8c7[_0x0d0d('0x4e')]=[{'all':!![]}];}_0xdba8c7=_['merge']({},_0xdba8c7,_0xdca721[_0x0d0d('0x4d')]);return db['OpenchannelMessage'][_0x0d0d('0x54')](_0xdba8c7)[_0x0d0d('0x21')](handleEntityNotFound(_0x25b2bb,null))[_0x0d0d('0x21')](respondWithResult(_0x25b2bb,null))[_0x0d0d('0x2c')](handleError(_0x25b2bb,null));};exports[_0x0d0d('0x55')]=function(_0x26243b,_0x5602eb){return db[_0x0d0d('0x3b')]['create'](_0x26243b['body'],{})[_0x0d0d('0x21')](respondWithResult(_0x5602eb,0xc9))[_0x0d0d('0x2c')](handleError(_0x5602eb,null));};exports['update']=function(_0x57a59b,_0x32ae62){if(_0x57a59b[_0x0d0d('0x56')]['id']){delete _0x57a59b[_0x0d0d('0x56')]['id'];}return db[_0x0d0d('0x3b')]['find']({'where':{'id':_0x57a59b[_0x0d0d('0x52')]['id']}})[_0x0d0d('0x21')](handleEntityNotFound(_0x32ae62,null))['then'](saveUpdates(_0x57a59b[_0x0d0d('0x56')],null))[_0x0d0d('0x21')](respondWithResult(_0x32ae62,null))[_0x0d0d('0x2c')](handleError(_0x32ae62,null));};exports[_0x0d0d('0x37')]=function(_0x53dc77,_0x4cf206){return db[_0x0d0d('0x3b')][_0x0d0d('0x54')]({'where':{'id':_0x53dc77[_0x0d0d('0x52')]['id']}})[_0x0d0d('0x21')](handleEntityNotFound(_0x4cf206,null))[_0x0d0d('0x21')](removeEntity(_0x4cf206,null))[_0x0d0d('0x2c')](handleError(_0x4cf206,null));};exports[_0x0d0d('0x57')]=function(_0x22dbef,_0x5b0bcc){return db['OpenchannelMessage']['describe']()[_0x0d0d('0x21')](respondWithResult(_0x5b0bcc,null))[_0x0d0d('0x2c')](handleError(_0x5b0bcc,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports[_0x0d0d('0x58')]=function(_0xcef7a7,_0x3d5995,_0x101378){var _0x3e12d1={'agent':{},'channel':_0x0d0d('0x59')};if(_0xcef7a7[_0x0d0d('0x56')]['id']){delete _0xcef7a7['body']['id'];}_0xcef7a7[_0x0d0d('0x56')][_0x0d0d('0x5a')]=!![];_0xcef7a7[_0x0d0d('0x56')][_0x0d0d('0x5b')]=moment()[_0x0d0d('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0xcef7a7[_0x0d0d('0x56')][_0x0d0d('0x5d')]=_0xcef7a7[_0x0d0d('0x56')][_0x0d0d('0x5d')]||_0xcef7a7[_0x0d0d('0x5e')]['id'];_0x3e12d1[_0x0d0d('0x5f')]['id']=_0xcef7a7[_0x0d0d('0x56')]['UserId'];return db['OpenchannelMessage'][_0x0d0d('0x54')]({'where':{'id':_0xcef7a7[_0x0d0d('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3d5995,null))[_0x0d0d('0x21')](saveUpdates(_0xcef7a7[_0x0d0d('0x56')],null))['then'](function(_0x2bf8af){if(_0x2bf8af){_0x3e12d1[_0x0d0d('0x29')]=_0x2bf8af[_0x0d0d('0x60')]({'plain':!![]});return db[_0x0d0d('0x61')][_0x0d0d('0x54')]({'where':{'id':_0x2bf8af['OpenchannelInteractionId']}});}return null;})[_0x0d0d('0x21')](handleEntityNotFound(_0x3d5995,null))[_0x0d0d('0x21')](function(_0x1ea083){if(_0x1ea083){return _0x1ea083[_0x0d0d('0x36')]({'UserId':_0xcef7a7[_0x0d0d('0x56')]['UserId'],'read1stAt':_[_0x0d0d('0x62')](_0x1ea083['read1stAt'])?moment()[_0x0d0d('0x5c')](_0x0d0d('0x63')):undefined});}return null;})['then'](function(_0xb1a1b0){if(_0xb1a1b0){_0x3e12d1[_0x0d0d('0x64')]=_0xb1a1b0[_0x0d0d('0x60')]({'plain':!![]});interaction_log[_0x0d0d('0x2a')](_0x0d0d('0x65'),_0xcef7a7[_0x0d0d('0x5e')]['id'],_0xcef7a7[_0x0d0d('0x5e')][_0x0d0d('0x39')],_0xcef7a7[_0x0d0d('0x5e')][_0x0d0d('0x66')],_0x3e12d1[_0x0d0d('0x64')]['id'],_0xcef7a7['body']?JSON['stringify'](_0xcef7a7[_0x0d0d('0x56')]):'null');return respondWithRpcPromise(_0x0d0d('0x67'),_0x0d0d('0x68'),_0x3e12d1);}return null;})[_0x0d0d('0x21')](function(_0x321102){var _0x4bd00e=_0x0d0d('0x69')+_0x321102[_0x0d0d('0x29')][_0x0d0d('0x6a')];return db[_0x0d0d('0x6b')][_0x0d0d('0x41')](_0x4bd00e,{'type':db[_0x0d0d('0x6c')][_0x0d0d('0x6d')][_0x0d0d('0x6e')],'raw':!![]})['then'](function(_0x469f1f){return _0x469f1f;});})[_0x0d0d('0x21')](function(_0x33e1af){if(_0x33e1af){_0x3e12d1[_0x0d0d('0x29')][_0x0d0d('0x6f')]=_0x33e1af[0x0];if(!_0xcef7a7[_0x0d0d('0x56')]['UserId'])return;return db[_0x0d0d('0x70')][_0x0d0d('0x54')]({'where':{'id':_0xcef7a7[_0x0d0d('0x56')][_0x0d0d('0x5d')],'role':_0x0d0d('0x5f')},'attributes':['id',_0x0d0d('0x39'),_0x0d0d('0x71'),_0x0d0d('0x72'),'internal'],'raw':!![]});}return null;})[_0x0d0d('0x21')](function(_0x263c5d){if(!_0x263c5d)return null;_0x3e12d1[_0x0d0d('0x29')][_0x0d0d('0x5f')]=_0x263c5d;return _0x3e12d1;})[_0x0d0d('0x21')](function(_0x1a4beb){if(_0x1a4beb){if(_0xcef7a7[_0x0d0d('0x56')][_0x0d0d('0x73')]){_0x3e12d1[_0x0d0d('0x29')][_0x0d0d('0x74')]=util[_0x0d0d('0x5c')](_0x0d0d('0x75'),_0xcef7a7['user']['name']);_0x3e12d1[_0x0d0d('0x29')]['channel']=_0x3e12d1[_0x0d0d('0x76')];_0x3e12d1['message'][_0x0d0d('0x77')]=_0x0d0d('0x58');return respondWithRpcPromise(_0x0d0d('0x78'),_0x0d0d('0x78'),{'event':_0x0d0d('0x79'),'message':_0x3e12d1[_0x0d0d('0x29')]},client9002)[_0x0d0d('0x21')](function(){return _0x3e12d1;});}return _0x3e12d1;}return null;})[_0x0d0d('0x21')](respondWithResult(_0x3d5995,null))[_0x0d0d('0x2c')](handleError(_0x3d5995,null));};var interaction_log=require('../../config/logger')(_0x0d0d('0x7a'));exports['reject']=function(_0x5eb909,_0xf835cc,_0x1623a4){var _0x3ae219={'agent':{},'channel':_0x0d0d('0x59')};if(_0x5eb909[_0x0d0d('0x56')]['id']){delete _0x5eb909[_0x0d0d('0x56')]['id'];}_0x5eb909[_0x0d0d('0x56')][_0x0d0d('0x5d')]=_0x5eb909[_0x0d0d('0x56')][_0x0d0d('0x5d')]||_0x5eb909['user']['id'];_0x3ae219[_0x0d0d('0x5f')]['id']=_0x5eb909[_0x0d0d('0x56')][_0x0d0d('0x5d')];return db[_0x0d0d('0x3b')][_0x0d0d('0x54')]({'where':{'id':_0x5eb909[_0x0d0d('0x52')]['id'],'UserId':null}})[_0x0d0d('0x21')](handleEntityNotFound(_0xf835cc,null))['then'](function(_0x202f79){if(_0x202f79){_0x3ae219[_0x0d0d('0x29')]=_0x202f79[_0x0d0d('0x60')]({'plain':!![]});return db[_0x0d0d('0x61')][_0x0d0d('0x54')]({'where':{'id':_0x202f79[_0x0d0d('0x7b')]}});}return null;})['then'](handleEntityNotFound(_0xf835cc,null))[_0x0d0d('0x21')](function(_0x1e2413){if(_0x1e2413){_0x3ae219[_0x0d0d('0x64')]=_0x1e2413[_0x0d0d('0x60')]({'plain':!![]});interaction_log['info'](_0x0d0d('0x7c'),_0x5eb909['user']['id'],_0x5eb909['user'][_0x0d0d('0x39')],_0x5eb909[_0x0d0d('0x5e')][_0x0d0d('0x66')],_0x3ae219[_0x0d0d('0x64')]['id'],_0x5eb909[_0x0d0d('0x56')]?JSON[_0x0d0d('0x26')](_0x5eb909[_0x0d0d('0x56')]):'null');return respondWithRpcPromise(_0x0d0d('0x7d'),_0x0d0d('0x7e'),_0x3ae219);}return null;})[_0x0d0d('0x21')](function(_0x3aa8c6){var _0x5215bf=_0x0d0d('0x69')+_0x3aa8c6[_0x0d0d('0x29')][_0x0d0d('0x6a')];return db[_0x0d0d('0x6b')]['query'](_0x5215bf,{'type':db[_0x0d0d('0x6c')][_0x0d0d('0x6d')]['SELECT'],'raw':!![]})[_0x0d0d('0x21')](function(_0x47033e){return _0x47033e;});})[_0x0d0d('0x21')](function(_0x358bf5){if(_0x358bf5){_0x3ae219[_0x0d0d('0x29')][_0x0d0d('0x6f')]=_0x358bf5[0x0];if(!_0x5eb909['body'][_0x0d0d('0x5d')])return;return db['User'][_0x0d0d('0x54')]({'where':{'id':_0x5eb909[_0x0d0d('0x56')][_0x0d0d('0x5d')],'role':_0x0d0d('0x5f')},'attributes':['id','name',_0x0d0d('0x71'),'email',_0x0d0d('0x7f')],'raw':!![]});}return null;})[_0x0d0d('0x21')](function(_0x1e6879){if(!_0x1e6879)return null;_0x3ae219[_0x0d0d('0x29')][_0x0d0d('0x5f')]=_0x1e6879;return _0x3ae219;})[_0x0d0d('0x21')](function(_0x3fe55b){if(_0x3fe55b){_0x3fe55b[_0x0d0d('0x29')][_0x0d0d('0x74')]=util[_0x0d0d('0x5c')]('SIP/%s',_0x5eb909['user'][_0x0d0d('0x39')]);_0x3fe55b[_0x0d0d('0x29')]['channel']=_0x3ae219[_0x0d0d('0x76')];_0x3fe55b[_0x0d0d('0x29')]['event']=_0x0d0d('0x80');respondWithRpcPromise(_0x0d0d('0x78'),_0x0d0d('0x78'),{'event':_0x0d0d('0x81'),'message':_0x3fe55b[_0x0d0d('0x29')]},client9002);return _0x3ae219;}return null;})['then'](respondWithResult(_0xf835cc,null))[_0x0d0d('0x2c')](handleError(_0xf835cc,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 031ce8e..5ef9a0f 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 _0xf2d5=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','update'];(function(_0x39b053,_0x4506cb){var _0xc4bdbf=function(_0x23d86e){while(--_0x23d86e){_0x39b053['push'](_0x39b053['shift']());}};_0xc4bdbf(++_0x4506cb);}(_0xf2d5,0xcc));var _0x5f2d=function(_0x5f8306,_0x2f883a){_0x5f8306=_0x5f8306-0x0;var _0x3379a4=_0xf2d5[_0x5f8306];return _0x3379a4;};'use strict';var EventEmitter=require(_0x5f2d('0x0'));var OpenchannelMessage=require(_0x5f2d('0x1'))['db'][_0x5f2d('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x5f2d('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3466b7){return function(_0x517e96,_0x24d050,_0x52fd18){OpenchannelMessageEvents[_0x5f2d('0x4')](_0x3466b7+':'+_0x517e96['id'],_0x517e96);OpenchannelMessageEvents[_0x5f2d('0x4')](_0x3466b7,_0x517e96);_0x52fd18(null);};}for(var e in events){if(events[_0x5f2d('0x5')](e)){var event=events[e];OpenchannelMessage[_0x5f2d('0x6')](e,emitEvent(event));}}module[_0x5f2d('0x7')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x95a7=['hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x95a7,0x70));var _0x795a=function(_0x525b28,_0x5cf5a0){_0x525b28=_0x525b28-0x0;var _0x180178=_0x95a7[_0x525b28];return _0x180178;};'use strict';var EventEmitter=require(_0x795a('0x0'));var OpenchannelMessage=require(_0x795a('0x1'))['db'][_0x795a('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x795a('0x3')](0x0);var events={'afterCreate':_0x795a('0x4'),'afterUpdate':_0x795a('0x5'),'afterDestroy':_0x795a('0x6')};function emitEvent(_0xe48dec){return function(_0xc289fb,_0x2630a6,_0x23a41f){OpenchannelMessageEvents['emit'](_0xe48dec+':'+_0xc289fb['id'],_0xc289fb);OpenchannelMessageEvents[_0x795a('0x7')](_0xe48dec,_0xc289fb);_0x23a41f(null);};}for(var e in events){if(events[_0x795a('0x8')](e)){var event=events[e];OpenchannelMessage[_0x795a('0x9')](e,emitEvent(event));}}module[_0x795a('0xa')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index f1bf464..ef5187a 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 _0xda2d=['OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','catch','error','out','CmContact','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','keys','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','Interaction','omit','POST','replyUri','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','utf8mb4','util','../../config/logger','api','moment','bluebird','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','models','get','direction','toLowerCase','UserId'];(function(_0x275cb5,_0x17abf2){var _0xbf1764=function(_0x30f784){while(--_0x30f784){_0x275cb5['push'](_0x275cb5['shift']());}};_0xbf1764(++_0x17abf2);}(_0xda2d,0x102));var _0xdda2=function(_0x526d43,_0x58c7c2){_0x526d43=_0x526d43-0x0;var _0x5f1f31=_0xda2d[_0x526d43];return _0x5f1f31;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var logger=require(_0xdda2('0x1'))(_0xdda2('0x2'));var moment=require(_0xdda2('0x3'));var BPromise=require(_0xdda2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdda2('0x5'));var attributes=require(_0xdda2('0x6'));module[_0xdda2('0x7')]=function(_0x39f6c9,_0xc256bc){return _0x39f6c9[_0xdda2('0x8')](_0xdda2('0x9'),attributes,{'tableName':_0xdda2('0xa'),'paranoid':![],'indexes':[{'name':_0xdda2('0xb'),'fields':[_0xdda2('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1a774e,_0x22c6e5,_0x4df6b8){var _0x1c11b2=_0x39f6c9[_0xdda2('0xd')];var _0x42d990=_0x1a774e[_0xdda2('0xe')]({'plain':!![]});if(_0x42d990[_0xdda2('0xf')][_0xdda2('0x10')]()==='in'||_0x42d990[_0xdda2('0xf')][_0xdda2('0x10')]()==='out'&&!_0x42d990['secret']&&!_['isNil'](_0x42d990[_0xdda2('0x11')])){_0x1c11b2[_0xdda2('0x12')][_0xdda2('0x13')]({'where':{'id':_0x42d990[_0xdda2('0x14')]}})[_0xdda2('0x15')](function(_0x475222){if(_0x475222){_0x475222[_0xdda2('0x16')]({'lastMsgAt':_0x42d990['createdAt'],'lastMsgDirection':_0x42d990[_0xdda2('0xf')]['toLowerCase']()});}})[_0xdda2('0x17')](function(_0xb6b01e){console[_0xdda2('0x18')](_0xb6b01e);});}if(_0x42d990[_0xdda2('0xf')]===_0xdda2('0x19')&&!_0x42d990['secret']){var _0x55d674;_0x1c11b2[_0xdda2('0x1a')]['describe']()[_0xdda2('0x15')](function(_0x1a3b35){return _0x1c11b2[_0xdda2('0x1b')][_0xdda2('0x1c')]({'where':{'id':_0x42d990[_0xdda2('0x1d')]},'include':[{'model':_0x1c11b2[_0xdda2('0x12')],'as':_0xdda2('0x1e'),'where':{'id':_0x42d990[_0xdda2('0x14')]},'limit':0x1,'include':[{'model':_0x1c11b2[_0xdda2('0x1a')],'as':_0xdda2('0x1f'),'attributes':_[_0xdda2('0x20')](_0x1a3b35)}]}]});})[_0xdda2('0x15')](function(_0x4eed30){_0x55d674=_0x4eed30[_0xdda2('0xe')]({'plain':!![]});if(_0x55d674&&_0x55d674['replyUri']){logger[_0xdda2('0x21')](_0xdda2('0x22'),_0xdda2('0x23'),util['format'](_0xdda2('0x24'),_0x42d990['id'],_0x55d674['replyUri']));if(_0x55d674[_0xdda2('0x1e')]&&_0x55d674[_0xdda2('0x1e')]['length']){_0x42d990[_0xdda2('0x25')]=_[_0xdda2('0x26')](_0x55d674[_0xdda2('0x1e')][0x0],_0xdda2('0x1f'));_0x42d990[_0xdda2('0x1f')]=_0x55d674['Interactions'][0x0][_0xdda2('0x1f')];}var _0x22c6e5={'method':_0xdda2('0x27'),'uri':encodeURI(_0x55d674[_0xdda2('0x28')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x22c6e5['method']){case'GET':_0x22c6e5['qs']=_0x42d990;break;case _0xdda2('0x27'):_0x22c6e5[_0xdda2('0xc')]=_0x42d990;break;}return rp(_0x22c6e5)[_0xdda2('0x15')](function(_0x5e9e74){logger[_0xdda2('0x21')](_0xdda2('0x22'),_0xdda2('0x23'),util[_0xdda2('0x29')](_0xdda2('0x2a'),_0x42d990['id'],_0x55d674[_0xdda2('0x28')]));if(_0x5e9e74['body'][_0xdda2('0x2b')]&&_0x5e9e74[_0xdda2('0xc')]['threadId']!=_0x42d990[_0xdda2('0x25')][_0xdda2('0x2b')]){return _0x1c11b2[_0xdda2('0x12')][_0xdda2('0x16')]({'threadId':_0x5e9e74['body'][_0xdda2('0x2b')]},{'logging':!![],'where':{'id':_0x42d990[_0xdda2('0x25')]['id']}});}else{return;}})['then'](function(){return _0x1a774e[_0xdda2('0x16')]({'read':!![]});})['catch'](function(_0x2b8cd6){logger['error']('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0xdda2('0x2c')](_0x2b8cd6,{'showHidden':![],'depth':null}));_0x4df6b8();});}else{_0x4df6b8();}})['finally'](function(){_0x4df6b8();});}else{_0x4df6b8();}}},'charset':_0xdda2('0x2d'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x955f=['openchannel_messages','body','FULLTEXT','models','get','toLowerCase','direction','secret','UserId','findOne','OpenchannelInteractionId','then','update','createdAt','catch','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','Interaction','omit','POST','method','GET','info','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','OpenchannelInteraction','error','inspect','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','exports','OpenchannelMessage'];(function(_0x288f5e,_0x205edd){var _0x476cc9=function(_0x796f53){while(--_0x796f53){_0x288f5e['push'](_0x288f5e['shift']());}};_0x476cc9(++_0x205edd);}(_0x955f,0x1eb));var _0xf955=function(_0x533f79,_0x360e21){_0x533f79=_0x533f79-0x0;var _0x227ce5=_0x955f[_0x533f79];return _0x227ce5;};'use strict';var _=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var logger=require(_0xf955('0x2'))(_0xf955('0x3'));var moment=require(_0xf955('0x4'));var BPromise=require('bluebird');var rp=require(_0xf955('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf955('0x6'));var attributes=require('./openchannelMessage.attributes');module[_0xf955('0x7')]=function(_0x2caff2,_0x3fdac2){return _0x2caff2['define'](_0xf955('0x8'),attributes,{'tableName':_0xf955('0x9'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0xf955('0xa')],'type':_0xf955('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x168ffb,_0x38b190,_0x134c1b){var _0x421e4a=_0x2caff2[_0xf955('0xc')];var _0x4d213a=_0x168ffb[_0xf955('0xd')]({'plain':!![]});if(_0x4d213a['direction'][_0xf955('0xe')]()==='in'||_0x4d213a[_0xf955('0xf')][_0xf955('0xe')]()==='out'&&!_0x4d213a[_0xf955('0x10')]&&!_['isNil'](_0x4d213a[_0xf955('0x11')])){_0x421e4a['OpenchannelInteraction'][_0xf955('0x12')]({'where':{'id':_0x4d213a[_0xf955('0x13')]}})[_0xf955('0x14')](function(_0x109bc5){if(_0x109bc5){_0x109bc5[_0xf955('0x15')]({'lastMsgAt':_0x4d213a[_0xf955('0x16')],'lastMsgDirection':_0x4d213a[_0xf955('0xf')][_0xf955('0xe')]()});}})[_0xf955('0x17')](function(_0x24e75c){console['error'](_0x24e75c);});}if(_0x4d213a[_0xf955('0xf')]==='out'&&!_0x4d213a[_0xf955('0x10')]){var _0x3a814f;_0x421e4a[_0xf955('0x18')][_0xf955('0x19')]()['then'](function(_0x5ac6cb){return _0x421e4a[_0xf955('0x1a')][_0xf955('0x1b')]({'where':{'id':_0x4d213a[_0xf955('0x1c')]},'include':[{'model':_0x421e4a['OpenchannelInteraction'],'as':_0xf955('0x1d'),'where':{'id':_0x4d213a[_0xf955('0x13')]},'limit':0x1,'include':[{'model':_0x421e4a[_0xf955('0x18')],'as':_0xf955('0x1e'),'attributes':_[_0xf955('0x1f')](_0x5ac6cb)}]}]});})['then'](function(_0x17d86a){_0x3a814f=_0x17d86a[_0xf955('0xd')]({'plain':!![]});if(_0x3a814f&&_0x3a814f[_0xf955('0x20')]){logger['info'](_0xf955('0x21'),'afterCreate',util[_0xf955('0x22')](_0xf955('0x23'),_0x4d213a['id'],_0x3a814f[_0xf955('0x20')]));if(_0x3a814f[_0xf955('0x1d')]&&_0x3a814f[_0xf955('0x1d')]['length']){_0x4d213a[_0xf955('0x24')]=_[_0xf955('0x25')](_0x3a814f[_0xf955('0x1d')][0x0],_0xf955('0x1e'));_0x4d213a[_0xf955('0x1e')]=_0x3a814f[_0xf955('0x1d')][0x0][_0xf955('0x1e')];}var _0x38b190={'method':_0xf955('0x26'),'uri':encodeURI(_0x3a814f[_0xf955('0x20')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x38b190[_0xf955('0x27')]){case _0xf955('0x28'):_0x38b190['qs']=_0x4d213a;break;case _0xf955('0x26'):_0x38b190[_0xf955('0xa')]=_0x4d213a;break;}return rp(_0x38b190)[_0xf955('0x14')](function(_0x51f3ab){logger[_0xf955('0x29')](_0xf955('0x21'),_0xf955('0x2a'),util[_0xf955('0x22')](_0xf955('0x2b'),_0x4d213a['id'],_0x3a814f[_0xf955('0x20')]));if(_0x51f3ab['body'][_0xf955('0x2c')]&&_0x51f3ab[_0xf955('0xa')]['threadId']!=_0x4d213a[_0xf955('0x24')][_0xf955('0x2c')]){return _0x421e4a[_0xf955('0x2d')][_0xf955('0x15')]({'threadId':_0x51f3ab['body'][_0xf955('0x2c')]},{'logging':!![],'where':{'id':_0x4d213a['Interaction']['id']}});}else{return;}})[_0xf955('0x14')](function(){return _0x168ffb[_0xf955('0x15')]({'read':!![]});})[_0xf955('0x17')](function(_0x4069fe){logger[_0xf955('0x2e')](_0xf955('0x21'),_0xf955('0x2a'),util[_0xf955('0x2f')](_0x4069fe,{'showHidden':![],'depth':null}));_0x134c1b();});}else{_0x134c1b();}})['finally'](function(){_0x134c1b();});}else{_0x134c1b();}}},'charset':_0xf955('0x30'),'collate':_0xf955('0x31')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index c628c9f..4e9ff3b 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(_0x3fddb5,_0x5ed4b1){var _0x3393ad=function(_0x3cdadc){while(--_0x3cdadc){_0x3fddb5['push'](_0x3fddb5['shift']());}};_0x3393ad(++_0x5ed4b1);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4fbfbb,_0x567728){_0x4fbfbb=_0x4fbfbb-0x0;var _0x1e4828=_0x5f2f[_0x4fbfbb];return _0x1e4828;};'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 _0xdb28=['then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request'];(function(_0x1741a1,_0x3ab2f5){var _0x20f178=function(_0x171cea){while(--_0x171cea){_0x1741a1['push'](_0x1741a1['shift']());}};_0x20f178(++_0x3ab2f5);}(_0xdb28,0x106));var _0x8db2=function(_0xb58f3,_0x461217){_0xb58f3=_0xb58f3-0x0;var _0x1cd2ab=_0xdb28[_0xb58f3];return _0x1cd2ab;};'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});config['redis']=_[_0x8db2('0xb')](config[_0x8db2('0xc')],{'host':_0x8db2('0xd'),'port':0x18eb});var socket=require(_0x8db2('0xe'))(new Redis(config[_0x8db2('0xc')]));require(_0x8db2('0xf'))[_0x8db2('0x10')](socket);function respondWithRpcPromise(_0x4ba340,_0x30dc90,_0x476216){return new BPromise(function(_0x1f62af,_0x57015f){return client[_0x8db2('0x11')](_0x4ba340,_0x476216)[_0x8db2('0x12')](function(_0x576475){logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));logger[_0x8db2('0x16')](_0x8db2('0x17'),_0x30dc90,'request\x20sent',JSON['stringify'](_0x576475));if(_0x576475[_0x8db2('0x18')]){if(_0x576475[_0x8db2('0x18')][_0x8db2('0x19')]===0x1f4){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x57015f(_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);}logger[_0x8db2('0x18')]('OpenchannelMessage,\x20%s,\x20%s',_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x1f62af(_0x576475['error'][_0x8db2('0x1a')]);}else{logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));_0x1f62af(_0x576475[_0x8db2('0x1b')][_0x8db2('0x1a')]);}})['catch'](function(_0x5df464){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x5df464);_0x57015f(_0x5df464);});});}exports[_0x8db2('0x1c')]=function(_0x1b64e4){var _0x58562e=this;return new Promise(function(_0x431d60,_0x36a9ff){return db[_0x8db2('0x1d')][_0x8db2('0x1e')](_0x1b64e4[_0x8db2('0x1f')],{'raw':_0x1b64e4['options']?_0x1b64e4[_0x8db2('0x20')][_0x8db2('0x21')]===undefined?!![]:![]:!![]})[_0x8db2('0x12')](function(_0x125be2){logger[_0x8db2('0x13')](_0x8db2('0x1c'),_0x1b64e4);logger[_0x8db2('0x16')]('CreateOpenchannelMessage',_0x1b64e4,JSON[_0x8db2('0x22')](_0x125be2));_0x431d60(_0x125be2);})['catch'](function(_0x5725f0){logger['error']('CreateOpenchannelMessage',_0x5725f0[_0x8db2('0x1a')],_0x1b64e4);_0x36a9ff(_0x58562e[_0x8db2('0x18')](0x1f4,_0x5725f0[_0x8db2('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 0a89a09..2d3af45 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 _0x0882=['./openchannelMessage.events','remove','update','emit','removeListener','register','length','openchannelMessage:'];(function(_0x4a92ff,_0x215eea){var _0x3cd15=function(_0x9f7a44){while(--_0x9f7a44){_0x4a92ff['push'](_0x4a92ff['shift']());}};_0x3cd15(++_0x215eea);}(_0x0882,0x1f0));var _0x2088=function(_0x4ca288,_0x254dd8){_0x4ca288=_0x4ca288-0x0;var _0x2362c1=_0x0882[_0x4ca288];return _0x2362c1;};'use strict';var OpenchannelMessageEvents=require(_0x2088('0x0'));var events=['save',_0x2088('0x1'),_0x2088('0x2')];function createListener(_0x233b2d,_0x14861d){return function(_0x432c7d){_0x14861d[_0x2088('0x3')](_0x233b2d,_0x432c7d);};}function removeListener(_0x2e5cc3,_0x384899){return function(){OpenchannelMessageEvents[_0x2088('0x4')](_0x2e5cc3,_0x384899);};}exports[_0x2088('0x5')]=function(_0x49b9c0){for(var _0x24f4cd=0x0,_0x3b9bce=events[_0x2088('0x6')];_0x24f4cd<_0x3b9bce;_0x24f4cd++){var _0x2d99b2=events[_0x24f4cd];var _0xc93bdd=createListener(_0x2088('0x7')+_0x2d99b2,_0x49b9c0);OpenchannelMessageEvents['on'](_0x2d99b2,_0xc93bdd);}}; \ No newline at end of file +var _0x52a8=['length','update','emit','removeListener','register'];(function(_0x36c176,_0x222378){var _0x1afca5=function(_0x222732){while(--_0x222732){_0x36c176['push'](_0x36c176['shift']());}};_0x1afca5(++_0x222378);}(_0x52a8,0x141));var _0x852a=function(_0x43f531,_0x17a705){_0x43f531=_0x43f531-0x0;var _0x13fdc6=_0x52a8[_0x43f531];return _0x13fdc6;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save','remove',_0x852a('0x0')];function createListener(_0x54cdc8,_0x2662ef){return function(_0x1a71fc){_0x2662ef[_0x852a('0x1')](_0x54cdc8,_0x1a71fc);};}function removeListener(_0x466ffd,_0x1846eb){return function(){OpenchannelMessageEvents[_0x852a('0x2')](_0x466ffd,_0x1846eb);};}exports[_0x852a('0x3')]=function(_0x2c5580){for(var _0x36d165=0x0,_0x36cbaf=events[_0x852a('0x4')];_0x36d165<_0x36cbaf;_0x36d165++){var _0x1f9fe0=events[_0x36d165];var _0x5611ac=createListener('openchannelMessage:'+_0x1f9fe0,_0x2c5580);OpenchannelMessageEvents['on'](_0x1f9fe0,_0x5611ac);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 765e0cf..32ca71d 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 _0xec6e=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','/describe','isAuthenticated','describe','/:id','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','exports','multer','util','path'];(function(_0x18e89d,_0x4814fe){var _0x1aea52=function(_0x23e9fd){while(--_0x23e9fd){_0x18e89d['push'](_0x18e89d['shift']());}};_0x1aea52(++_0x4814fe);}(_0xec6e,0x185));var _0xeec6=function(_0x23b655,_0x4feb2b){_0x23b655=_0x23b655-0x0;var _0x364b32=_0xec6e[_0x23b655];return _0x364b32;};'use strict';var multer=require(_0xeec6('0x0'));var util=require(_0xeec6('0x1'));var path=require(_0xeec6('0x2'));var timeout=require('connect-timeout');var express=require(_0xeec6('0x3'));var router=express['Router']();var fs_extra=require(_0xeec6('0x4'));var auth=require(_0xeec6('0x5'));var interaction=require(_0xeec6('0x6'));var config=require(_0xeec6('0x7'));var controller=require(_0xeec6('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xeec6('0x9')](_0xeec6('0xa'),auth[_0xeec6('0xb')](),controller[_0xeec6('0xc')]);router[_0xeec6('0x9')](_0xeec6('0xd'),auth[_0xeec6('0xb')](),controller['show']);router['get'](_0xeec6('0xe'),auth[_0xeec6('0xb')](),controller['getMembers']);router['get'](_0xeec6('0xf'),auth[_0xeec6('0xb')](),controller[_0xeec6('0x10')]);router['get'](_0xeec6('0x11'),auth[_0xeec6('0xb')](),controller[_0xeec6('0x12')]);router[_0xeec6('0x13')]('/',auth[_0xeec6('0xb')](),controller[_0xeec6('0x14')]);router['post'](_0xeec6('0xf'),auth['isAuthenticated'](),controller[_0xeec6('0x15')]);router[_0xeec6('0x13')](_0xeec6('0x11'),auth[_0xeec6('0xb')](),controller[_0xeec6('0x16')]);router[_0xeec6('0x17')](_0xeec6('0xd'),auth[_0xeec6('0xb')](),controller[_0xeec6('0x18')]);router[_0xeec6('0x19')]('/:id',auth['isAuthenticated'](),controller[_0xeec6('0x1a')]);router['delete']('/:id/teams',auth[_0xeec6('0xb')](),controller['removeTeams']);router[_0xeec6('0x19')]('/:id/users',auth[_0xeec6('0xb')](),controller['removeAgents']);module[_0xeec6('0x1b')]=router; \ No newline at end of file +var _0x9833=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','delete','destroy','removeTeams','removeAgents','multer','path'];(function(_0x10dc64,_0x11bb29){var _0x9cf98d=function(_0x558d71){while(--_0x558d71){_0x10dc64['push'](_0x10dc64['shift']());}};_0x9cf98d(++_0x11bb29);}(_0x9833,0x1ce));var _0x3983=function(_0x2c8f78,_0x53ab14){_0x2c8f78=_0x2c8f78-0x0;var _0x5ed48e=_0x9833[_0x2c8f78];return _0x5ed48e;};'use strict';var multer=require(_0x3983('0x0'));var util=require('util');var path=require(_0x3983('0x1'));var timeout=require(_0x3983('0x2'));var express=require(_0x3983('0x3'));var router=express[_0x3983('0x4')]();var fs_extra=require(_0x3983('0x5'));var auth=require(_0x3983('0x6'));var interaction=require(_0x3983('0x7'));var config=require(_0x3983('0x8'));var controller=require(_0x3983('0x9'));router[_0x3983('0xa')]('/',auth['isAuthenticated'](),controller[_0x3983('0xb')]);router[_0x3983('0xa')](_0x3983('0xc'),auth[_0x3983('0xd')](),controller[_0x3983('0xe')]);router[_0x3983('0xa')](_0x3983('0xf'),auth[_0x3983('0xd')](),controller[_0x3983('0x10')]);router[_0x3983('0xa')]('/:id/members',auth[_0x3983('0xd')](),controller[_0x3983('0x11')]);router['get'](_0x3983('0x12'),auth[_0x3983('0xd')](),controller[_0x3983('0x13')]);router['get'](_0x3983('0x14'),auth[_0x3983('0xd')](),controller[_0x3983('0x15')]);router[_0x3983('0x16')]('/',auth[_0x3983('0xd')](),controller[_0x3983('0x17')]);router['post']('/:id/teams',auth[_0x3983('0xd')](),controller['addTeams']);router[_0x3983('0x16')](_0x3983('0x14'),auth[_0x3983('0xd')](),controller[_0x3983('0x18')]);router['put']('/:id',auth[_0x3983('0xd')](),controller['update']);router[_0x3983('0x19')](_0x3983('0xf'),auth[_0x3983('0xd')](),controller[_0x3983('0x1a')]);router['delete'](_0x3983('0x12'),auth[_0x3983('0xd')](),controller[_0x3983('0x1b')]);router[_0x3983('0x19')](_0x3983('0x14'),auth[_0x3983('0xd')](),controller[_0x3983('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index ad48bd2..679ae95 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 _0x2436=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','ENUM'];(function(_0x2a68ae,_0x19baec){var _0x6fabd3=function(_0x163b72){while(--_0x163b72){_0x2a68ae['push'](_0x2a68ae['shift']());}};_0x6fabd3(++_0x19baec);}(_0x2436,0x1f4));var _0x6243=function(_0x45716d,_0xb51d6d){_0x45716d=_0x45716d-0x0;var _0x1714ab=_0x2436[_0x45716d];return _0x1714ab;};'use strict';var Sequelize=require(_0x6243('0x0'));module[_0x6243('0x1')]={'name':{'type':Sequelize[_0x6243('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6243('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6243('0x3')](_0x6243('0x4'),_0x6243('0x5'),_0x6243('0x6'))}}; \ No newline at end of file +var _0x1165=['beepall','roundrobin','sequelize','exports','name','STRING','INTEGER','ENUM','rrmemory'];(function(_0x54c9c7,_0x458e61){var _0x40c28a=function(_0x32904b){while(--_0x32904b){_0x54c9c7['push'](_0x54c9c7['shift']());}};_0x40c28a(++_0x458e61);}(_0x1165,0xda));var _0x5116=function(_0x1190ba,_0x34d0dd){_0x1190ba=_0x1190ba-0x0;var _0x91669b=_0x1165[_0x1190ba];return _0x91669b;};'use strict';var Sequelize=require(_0x5116('0x0'));module[_0x5116('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x5116('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5116('0x3')]},'timeout':{'type':Sequelize[_0x5116('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5116('0x5')](_0x5116('0x6'),_0x5116('0x7'),_0x5116('0x8'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 43cca13..2514904 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 _0x4f9f=['length','hasOwnProperty','order','sort','where','merge','filter','OpenchannelQueue','catch','show','params','includeAll','include','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','nolimit','pick','OpenchannelQueueId','findAll','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','addTeams','ids','User','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','forEach','emit','userOpenchannelQueue:save','removeTeams','Team','select','field','tq.TeamId','from','team_has_openchannel_queues','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','userOpenchannelQueue:remove','addAgents','spread','removeAgents','isArray','getAgents','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','OpenchannelQueues','UserProfileResource','destroy','error','stack','name','send','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4f9f,0x172));var _0xf4f9=function(_0x454ea3,_0xc74a1c){_0x454ea3=_0x454ea3-0x0;var _0x5ad18a=_0x4f9f[_0x454ea3];return _0x5ad18a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf4f9('0x0'));var jsonpatch=require(_0xf4f9('0x1'));var rp=require('request-promise');var moment=require(_0xf4f9('0x2'));var BPromise=require(_0xf4f9('0x3'));var Mustache=require(_0xf4f9('0x4'));var util=require(_0xf4f9('0x5'));var path=require(_0xf4f9('0x6'));var sox=require(_0xf4f9('0x7'));var csv=require(_0xf4f9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf4f9('0x9'));var _=require('lodash');var squel=require(_0xf4f9('0xa'));var crypto=require(_0xf4f9('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf4f9('0x8'));var querystring=require(_0xf4f9('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf4f9('0xd'));var qs=require(_0xf4f9('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf4f9('0xf'));var logger=require(_0xf4f9('0x10'))(_0xf4f9('0x11'));var utils=require('../../config/utils');var config=require(_0xf4f9('0x12'));var licenseUtil=require(_0xf4f9('0x13'));var db=require(_0xf4f9('0x14'))['db'];config['redis']=_[_0xf4f9('0x15')](config[_0xf4f9('0x16')],{'host':_0xf4f9('0x17'),'port':0x18eb});var socket=require(_0xf4f9('0x18'))(new Redis(config[_0xf4f9('0x16')]));require(_0xf4f9('0x19'))[_0xf4f9('0x1a')](socket);function respondWithStatusCode(_0xab3555,_0x5a9914){_0x5a9914=_0x5a9914||0xcc;return function(_0x378725){if(_0x378725){return _0xab3555[_0xf4f9('0x1b')](_0x5a9914);}return _0xab3555[_0xf4f9('0x1c')](_0x5a9914)[_0xf4f9('0x1d')]();};}function respondWithResult(_0x683753,_0x470ebd){_0x470ebd=_0x470ebd||0xc8;return function(_0x5a762b){if(_0x5a762b){return _0x683753[_0xf4f9('0x1c')](_0x470ebd)[_0xf4f9('0x1e')](_0x5a762b);}};}function respondWithFilteredResult(_0xc446a6,_0x2820d1){return function(_0x2d42f1){if(_0x2d42f1){var _0x5ad89c=typeof _0x2820d1[_0xf4f9('0x1f')]==='undefined'&&typeof _0x2820d1[_0xf4f9('0x20')]===_0xf4f9('0x21');var _0x22f5ab=_0x2d42f1[_0xf4f9('0x22')];var _0x4d650d=_0x5ad89c?0x0:_0x2820d1[_0xf4f9('0x1f')];var _0x3bb946=_0x5ad89c?_0x2d42f1[_0xf4f9('0x22')]:_0x2820d1['offset']+_0x2820d1[_0xf4f9('0x20')];var _0x2cf745;if(_0x3bb946>=_0x22f5ab){_0x3bb946=_0x22f5ab;_0x2cf745=0xc8;}else{_0x2cf745=0xce;}_0xc446a6[_0xf4f9('0x1c')](_0x2cf745);return _0xc446a6[_0xf4f9('0x23')](_0xf4f9('0x24'),_0x4d650d+'-'+_0x3bb946+'/'+_0x22f5ab)[_0xf4f9('0x1e')](_0x2d42f1);}return null;};}function patchUpdates(_0x579e0a){return function(_0x25390a){try{jsonpatch[_0xf4f9('0x25')](_0x25390a,_0x579e0a,!![]);}catch(_0xe6e6e){return BPromise[_0xf4f9('0x26')](_0xe6e6e);}return _0x25390a['save']();};}function saveUpdates(_0xc59c6f,_0x2476be){return function(_0x25dd78){if(_0x25dd78){return _0x25dd78[_0xf4f9('0x27')](_0xc59c6f)[_0xf4f9('0x28')](function(_0x1e0f2a){return _0x1e0f2a;});}return null;};}function removeEntity(_0x7cf2e2,_0x26afdd){return function(_0x373d79){if(_0x373d79){return _0x373d79['destroy']()[_0xf4f9('0x28')](function(){var _0x10a6bb=_0x373d79['get']({'plain':!![]});var _0x5b003d=_0xf4f9('0x29');return db[_0xf4f9('0x2a')][_0xf4f9('0x2b')]({'where':{'type':_0x5b003d,'resourceId':_0x10a6bb['id']}})[_0xf4f9('0x28')](function(){return _0x373d79;});})[_0xf4f9('0x28')](function(){_0x7cf2e2['status'](0xcc)[_0xf4f9('0x1d')]();});}};}function handleEntityNotFound(_0x2bf153,_0x1176c1){return function(_0x2b1fd4){if(!_0x2b1fd4){_0x2bf153[_0xf4f9('0x1b')](0x194);}return _0x2b1fd4;};}function handleError(_0x47ccfc,_0x20147d){_0x20147d=_0x20147d||0x1f4;return function(_0x1d1224){logger[_0xf4f9('0x2c')](_0x1d1224[_0xf4f9('0x2d')]);if(_0x1d1224['name']){delete _0x1d1224[_0xf4f9('0x2e')];}_0x47ccfc[_0xf4f9('0x1c')](_0x20147d)[_0xf4f9('0x2f')](_0x1d1224);};}exports['index']=function(_0x74ac21,_0x3090ff){var _0x4d8544={},_0x525651={},_0x2aedda={'count':0x0,'rows':[]};var _0x525de2=_['map'](db['OpenchannelQueue'][_0xf4f9('0x30')],function(_0x354bd7){return{'name':_0x354bd7[_0xf4f9('0x31')],'type':_0x354bd7[_0xf4f9('0x32')]['key']};});_0x525651[_0xf4f9('0x33')]=_[_0xf4f9('0x34')](_0x525de2,_0xf4f9('0x2e'));_0x525651[_0xf4f9('0x35')]=_[_0xf4f9('0x36')](_0x74ac21['query']);_0x525651[_0xf4f9('0x37')]=_[_0xf4f9('0x38')](_0x525651['model'],_0x525651[_0xf4f9('0x35')]);_0x4d8544[_0xf4f9('0x39')]=_[_0xf4f9('0x38')](_0x525651[_0xf4f9('0x33')],qs[_0xf4f9('0x3a')](_0x74ac21[_0xf4f9('0x35')][_0xf4f9('0x3a')]));_0x4d8544[_0xf4f9('0x39')]=_0x4d8544[_0xf4f9('0x39')][_0xf4f9('0x3b')]?_0x4d8544[_0xf4f9('0x39')]:_0x525651['model'];if(!_0x74ac21[_0xf4f9('0x35')][_0xf4f9('0x3c')]('nolimit')){_0x4d8544['limit']=qs[_0xf4f9('0x20')](_0x74ac21['query'][_0xf4f9('0x20')]);_0x4d8544['offset']=qs['offset'](_0x74ac21[_0xf4f9('0x35')][_0xf4f9('0x1f')]);}_0x4d8544[_0xf4f9('0x3d')]=qs[_0xf4f9('0x3e')](_0x74ac21[_0xf4f9('0x35')][_0xf4f9('0x3e')]);_0x4d8544[_0xf4f9('0x3f')]=qs[_0xf4f9('0x37')](_['pick'](_0x74ac21[_0xf4f9('0x35')],_0x525651['filters']),_0x525de2);if(_0x74ac21[_0xf4f9('0x35')]['filter']){_0x4d8544[_0xf4f9('0x3f')]=_[_0xf4f9('0x40')](_0x4d8544[_0xf4f9('0x3f')],{'$or':_[_0xf4f9('0x34')](_0x525de2,function(_0x59e7fe){if(_0x59e7fe[_0xf4f9('0x32')]!=='VIRTUAL'){var _0x255d65={};_0x255d65[_0x59e7fe[_0xf4f9('0x2e')]]={'$like':'%'+_0x74ac21[_0xf4f9('0x35')][_0xf4f9('0x41')]+'%'};return _0x255d65;}})});}_0x4d8544=_[_0xf4f9('0x40')]({},_0x4d8544,_0x74ac21['options']);var _0x246a12={'where':_0x4d8544[_0xf4f9('0x3f')]};return db[_0xf4f9('0x42')][_0xf4f9('0x22')](_0x246a12)['then'](function(_0x48264b){_0x2aedda[_0xf4f9('0x22')]=_0x48264b;if(_0x74ac21['query']['includeAll']){_0x4d8544['include']=[{'all':!![]}];}return db['OpenchannelQueue']['findAll'](_0x4d8544);})[_0xf4f9('0x28')](function(_0x2cbcbd){_0x2aedda['rows']=_0x2cbcbd;return _0x2aedda;})[_0xf4f9('0x28')](respondWithFilteredResult(_0x3090ff,_0x4d8544))[_0xf4f9('0x43')](handleError(_0x3090ff,null));};exports[_0xf4f9('0x44')]=function(_0x4a08d6,_0x2fc05a){var _0x54be72={'raw':!![],'where':{'id':_0x4a08d6[_0xf4f9('0x45')]['id']}},_0x1a1527={};_0x1a1527[_0xf4f9('0x33')]=_[_0xf4f9('0x36')](db['OpenchannelQueue'][_0xf4f9('0x30')]);_0x1a1527[_0xf4f9('0x35')]=_[_0xf4f9('0x36')](_0x4a08d6[_0xf4f9('0x35')]);_0x1a1527[_0xf4f9('0x37')]=_['intersection'](_0x1a1527[_0xf4f9('0x33')],_0x1a1527['query']);_0x54be72[_0xf4f9('0x39')]=_[_0xf4f9('0x38')](_0x1a1527[_0xf4f9('0x33')],qs[_0xf4f9('0x3a')](_0x4a08d6[_0xf4f9('0x35')][_0xf4f9('0x3a')]));_0x54be72[_0xf4f9('0x39')]=_0x54be72['attributes']['length']?_0x54be72[_0xf4f9('0x39')]:_0x1a1527['model'];if(_0x4a08d6[_0xf4f9('0x35')][_0xf4f9('0x46')]){_0x54be72[_0xf4f9('0x47')]=[{'all':!![]}];}_0x54be72=_['merge']({},_0x54be72,_0x4a08d6[_0xf4f9('0x48')]);return db['OpenchannelQueue'][_0xf4f9('0x49')](_0x54be72)[_0xf4f9('0x28')](handleEntityNotFound(_0x2fc05a,null))[_0xf4f9('0x28')](respondWithResult(_0x2fc05a,null))[_0xf4f9('0x43')](handleError(_0x2fc05a,null));};exports['create']=function(_0x22179d,_0x171c3e){return db[_0xf4f9('0x42')][_0xf4f9('0x4a')](_0x22179d[_0xf4f9('0x4b')],{})['then'](function(_0x4122fc){var _0x28ebff=_0x22179d['user']['get']({'plain':!![]});if(!_0x28ebff)throw new Error(_0xf4f9('0x4c'));if(_0x28ebff['role']===_0xf4f9('0x4d')){var _0x2c35ce=_0x4122fc[_0xf4f9('0x4e')]({'plain':!![]});var _0x2389e0=_0xf4f9('0x29');return db[_0xf4f9('0x4f')][_0xf4f9('0x49')]({'where':{'name':_0x2389e0,'userProfileId':_0x28ebff[_0xf4f9('0x50')]},'raw':!![]})['then'](function(_0x104004){if(_0x104004&&_0x104004['autoAssociation']===0x0){return db[_0xf4f9('0x2a')][_0xf4f9('0x4a')]({'name':_0x2c35ce[_0xf4f9('0x2e')],'resourceId':_0x2c35ce['id'],'type':_0x104004[_0xf4f9('0x2e')],'sectionId':_0x104004['id']},{})[_0xf4f9('0x28')](function(){return _0x4122fc;});}else{return _0x4122fc;}})[_0xf4f9('0x43')](function(_0x4ef15d){logger[_0xf4f9('0x2c')](_0xf4f9('0x51'),_0x4ef15d);throw _0x4ef15d;});}return _0x4122fc;})['then'](respondWithResult(_0x171c3e,0xc9))['catch'](handleError(_0x171c3e,null));};exports[_0xf4f9('0x27')]=function(_0xef2a3a,_0x43201d){if(_0xef2a3a['body']['id']){delete _0xef2a3a[_0xf4f9('0x4b')]['id'];}return db[_0xf4f9('0x42')][_0xf4f9('0x49')]({'where':{'id':_0xef2a3a[_0xf4f9('0x45')]['id']}})['then'](handleEntityNotFound(_0x43201d,null))[_0xf4f9('0x28')](saveUpdates(_0xef2a3a[_0xf4f9('0x4b')],null))['then'](respondWithResult(_0x43201d,null))[_0xf4f9('0x43')](handleError(_0x43201d,null));};exports[_0xf4f9('0x2b')]=function(_0x536ad2,_0x55a9c4){return db[_0xf4f9('0x42')][_0xf4f9('0x49')]({'where':{'id':_0x536ad2[_0xf4f9('0x45')]['id']}})[_0xf4f9('0x28')](handleEntityNotFound(_0x55a9c4,null))[_0xf4f9('0x28')](removeEntity(_0x55a9c4,null))[_0xf4f9('0x43')](handleError(_0x55a9c4,null));};exports[_0xf4f9('0x52')]=function(_0x53e4c3,_0x17e979){return db[_0xf4f9('0x42')]['describe']()['then'](respondWithResult(_0x17e979,null))['catch'](handleError(_0x17e979,null));};exports[_0xf4f9('0x53')]=function(_0x1a437a,_0x3d4176,_0x59e96a){var _0x28b991={'raw':!![],'where':{}},_0x36c275={},_0x56f12d;return db[_0xf4f9('0x42')][_0xf4f9('0x54')]({'where':{'id':_0x1a437a[_0xf4f9('0x45')]['id']}})[_0xf4f9('0x28')](handleEntityNotFound(_0x3d4176,null))[_0xf4f9('0x28')](function(_0x35dcec){if(_0x35dcec){_0x56f12d=_0x35dcec['get']({'plain':!![]});_0x36c275[_0xf4f9('0x33')]=_[_0xf4f9('0x36')](db[_0xf4f9('0x55')][_0xf4f9('0x30')]);_0x36c275[_0xf4f9('0x35')]=_[_0xf4f9('0x36')](_0x1a437a[_0xf4f9('0x35')]);_0x36c275['filters']=_[_0xf4f9('0x38')](_0x36c275[_0xf4f9('0x33')],_0x36c275[_0xf4f9('0x35')]);_0x28b991[_0xf4f9('0x39')]=_[_0xf4f9('0x38')](_0x36c275[_0xf4f9('0x33')],qs[_0xf4f9('0x3a')](_0x1a437a[_0xf4f9('0x35')][_0xf4f9('0x3a')]));_0x28b991[_0xf4f9('0x39')]=_0x28b991['attributes']['length']?_0x28b991['attributes']:_0x36c275['model'];if(!_0x1a437a[_0xf4f9('0x35')]['hasOwnProperty'](_0xf4f9('0x56'))){_0x28b991[_0xf4f9('0x20')]=qs['limit'](_0x1a437a['query'][_0xf4f9('0x20')]);_0x28b991['offset']=qs[_0xf4f9('0x1f')](_0x1a437a[_0xf4f9('0x35')][_0xf4f9('0x1f')]);}_0x28b991[_0xf4f9('0x3d')]=qs['sort'](_0x1a437a[_0xf4f9('0x35')][_0xf4f9('0x3e')]);_0x28b991[_0xf4f9('0x3f')]=qs['filters'](_[_0xf4f9('0x57')](_0x1a437a[_0xf4f9('0x35')],_0x36c275[_0xf4f9('0x37')]));_0x28b991['where'][_0xf4f9('0x58')]=_0x35dcec['id'];if(_0x1a437a[_0xf4f9('0x35')][_0xf4f9('0x41')]){_0x28b991[_0xf4f9('0x3f')]=_[_0xf4f9('0x40')](_0x28b991[_0xf4f9('0x3f')],{'$or':_[_0xf4f9('0x34')](_0x28b991[_0xf4f9('0x39')],function(_0x4fb67e){var _0x27e7a7={};_0x27e7a7[_0x4fb67e]={'$like':'%'+_0x1a437a['query']['filter']+'%'};return _0x27e7a7;})});}_0x28b991=_['merge']({},_0x28b991,_0x1a437a[_0xf4f9('0x48')]);return db[_0xf4f9('0x55')][_0xf4f9('0x59')](_0x28b991);}})[_0xf4f9('0x28')](function(_0x4c469f){if(_0x4c469f){return db['User'][_0xf4f9('0x5a')]({'where':{'id':_['map'](_0x4c469f,_0xf4f9('0x5b')),'role':_0xf4f9('0x5c')},'attributes':['id',_0xf4f9('0x2e'),_0xf4f9('0x5d'),_0xf4f9('0x5e'),_0xf4f9('0x5f')]});}})['then'](function(_0xff223a){if(_0xff223a){return{'count':_0xff223a[_0xf4f9('0x22')],'rows':_[_0xf4f9('0x34')](_0xff223a[_0xf4f9('0x60')],function(_0x56a671){return{'membername':_0x56a671['name'],'UserId':_0x56a671['id'],'queue_name':_0x56f12d[_0xf4f9('0x2e')],'OpenchannelQueueId':_0x56f12d['id'],'interface':util[_0xf4f9('0x61')](_0xf4f9('0x62'),_0xf4f9('0x63'),_0x56a671['name']),'penalty':0x0,'paused':_0x56a671[_0xf4f9('0x5d')],'createdAt':_0x56a671['createdAt'],'updatedAt':_0x56a671[_0xf4f9('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf4f9('0x28')](respondWithFilteredResult(_0x3d4176,_0x28b991))[_0xf4f9('0x43')](handleError(_0x3d4176,null));};exports[_0xf4f9('0x64')]=function(_0x3b4fc3,_0x30fe41,_0x26115a){var _0x3c219b={};var _0x2c82dc={};var _0x4740cd;var _0x52e4c6;return db[_0xf4f9('0x42')][_0xf4f9('0x54')]({'where':{'id':_0x3b4fc3[_0xf4f9('0x45')]['id']}})[_0xf4f9('0x28')](handleEntityNotFound(_0x30fe41,null))[_0xf4f9('0x28')](function(_0x22b609){if(_0x22b609){_0x4740cd=_0x22b609;_0x2c82dc[_0xf4f9('0x33')]=_[_0xf4f9('0x36')](db['Team']['rawAttributes']);_0x2c82dc[_0xf4f9('0x35')]=_[_0xf4f9('0x36')](_0x3b4fc3[_0xf4f9('0x35')]);_0x2c82dc['filters']=_['intersection'](_0x2c82dc['model'],_0x2c82dc[_0xf4f9('0x35')]);_0x3c219b[_0xf4f9('0x39')]=_['intersection'](_0x2c82dc[_0xf4f9('0x33')],qs[_0xf4f9('0x3a')](_0x3b4fc3['query'][_0xf4f9('0x3a')]));_0x3c219b['attributes']=_0x3c219b[_0xf4f9('0x39')][_0xf4f9('0x3b')]?_0x3c219b['attributes']:_0x2c82dc[_0xf4f9('0x33')];_0x3c219b[_0xf4f9('0x3d')]=qs[_0xf4f9('0x3e')](_0x3b4fc3[_0xf4f9('0x35')]['sort']);_0x3c219b[_0xf4f9('0x3f')]=qs[_0xf4f9('0x37')](_['pick'](_0x3b4fc3[_0xf4f9('0x35')],_0x2c82dc['filters']));if(_0x3b4fc3[_0xf4f9('0x35')][_0xf4f9('0x41')]){_0x3c219b['where']=_['merge'](_0x3c219b[_0xf4f9('0x3f')],{'$or':_[_0xf4f9('0x34')](_0x3c219b['attributes'],function(_0x3dfa79){var _0x5e785e={};_0x5e785e[_0x3dfa79]={'$like':'%'+_0x3b4fc3[_0xf4f9('0x35')][_0xf4f9('0x41')]+'%'};return _0x5e785e;})});}_0x3c219b=_[_0xf4f9('0x40')]({},_0x3c219b,_0x3b4fc3[_0xf4f9('0x48')]);return _0x4740cd['getTeams'](_0x3c219b);}})[_0xf4f9('0x28')](function(_0x27ea0f){if(_0x27ea0f){_0x52e4c6=_0x27ea0f[_0xf4f9('0x3b')];if(!_0x3b4fc3['query']['hasOwnProperty'](_0xf4f9('0x56'))){_0x3c219b[_0xf4f9('0x20')]=qs[_0xf4f9('0x20')](_0x3b4fc3[_0xf4f9('0x35')][_0xf4f9('0x20')]);_0x3c219b[_0xf4f9('0x1f')]=qs[_0xf4f9('0x1f')](_0x3b4fc3[_0xf4f9('0x35')][_0xf4f9('0x1f')]);}return _0x4740cd[_0xf4f9('0x64')](_0x3c219b);}})['then'](function(_0x5f4c0d){if(_0x5f4c0d){return _0x5f4c0d?{'count':_0x52e4c6,'rows':_0x5f4c0d}:null;}})[_0xf4f9('0x28')](respondWithResult(_0x30fe41,null))['catch'](handleError(_0x30fe41,null));};exports[_0xf4f9('0x65')]=function(_0x4225bb,_0x43760c,_0x58ee01){var _0x356ac9=_0x4225bb['body'][_0xf4f9('0x66')];return db['Team'][_0xf4f9('0x59')]({'where':{'id':_0x356ac9},'attributes':['id'],'include':[{'model':db[_0xf4f9('0x67')],'as':'Agents','attributes':['id','name',_0xf4f9('0x68'),_0xf4f9('0x69'),_0xf4f9('0x6a')],'raw':!![]}]})[_0xf4f9('0x28')](function(_0x3f1d46){if(_0x3f1d46){var _0x37bd14=_[_0xf4f9('0x6b')](_0x3f1d46,function(_0x44765a){var _0x5bc7e9=_0x44765a[_0xf4f9('0x4e')]({'plain':!![]});return _0x5bc7e9[_0xf4f9('0x6c')];});return db[_0xf4f9('0x42')][_0xf4f9('0x49')]({'where':{'id':_0x4225bb[_0xf4f9('0x45')]['id']}})[_0xf4f9('0x28')](function(_0x5d0bd7){return db[_0xf4f9('0x6d')][_0xf4f9('0x6e')](function(_0x5f361e){return _0x5d0bd7[_0xf4f9('0x65')](_0x356ac9,{'transaction':_0x5f361e})[_0xf4f9('0x28')](function(){return BPromise[_0xf4f9('0x6f')](_0x37bd14,function(_0x52cad6){return db[_0xf4f9('0x55')]['findOrCreate']({'where':{'UserId':_0x52cad6['id'],'OpenchannelQueueId':_0x4225bb[_0xf4f9('0x45')]['id']},'transaction':_0x5f361e});});})[_0xf4f9('0x28')](function(){_0x37bd14[_0xf4f9('0x70')](function(_0x580355){socket[_0xf4f9('0x71')](_0xf4f9('0x72'),{'UserId':_0x580355['id'],'OpenchannelQueueId':_0x5d0bd7['id']});});});});});}})[_0xf4f9('0x28')](respondWithStatusCode(_0x43760c,null))[_0xf4f9('0x43')](handleError(_0x43760c,null));};exports[_0xf4f9('0x73')]=function(_0x1ff8c3,_0x3e687e,_0x16fe3c){return db[_0xf4f9('0x74')][_0xf4f9('0x59')]({'where':{'id':_0x1ff8c3[_0xf4f9('0x35')][_0xf4f9('0x66')]},'attributes':['id'],'include':[{'model':db[_0xf4f9('0x67')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf4f9('0x28')](handleEntityNotFound(_0x3e687e,null))[_0xf4f9('0x28')](function(_0x6e6487){var _0x38c5f0=_[_0xf4f9('0x34')](_0x6e6487,'id');var _0x49a90d=[];var _0x51583a=[];var _0x5d334c=squel[_0xf4f9('0x75')]();_0x5d334c[_0xf4f9('0x76')](_0xf4f9('0x77'))[_0xf4f9('0x78')](_0xf4f9('0x79'),'tq')['join'](_0xf4f9('0x7a'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xf4f9('0x3f')](_0xf4f9('0x7b'),_0x1ff8c3['params']['id']);for(var _0x2756a1=0x0;_0x2756a1<_0x6e6487[_0xf4f9('0x3b')];_0x2756a1+=0x1){let _0x595f49=_0x6e6487[_0x2756a1];for(var _0x2b9063=0x0;_0x2b9063<_0x595f49['Agents'][_0xf4f9('0x3b')];_0x2b9063+=0x1){let _0xbb28f0=_0x595f49['Agents'][_0x2b9063];var _0x994687=_0x5d334c[_0xf4f9('0x7c')]();_0x994687[_0xf4f9('0x3f')](_0xf4f9('0x7d'),_0xbb28f0['id']);_0x51583a[_0xf4f9('0x7e')](db[_0xf4f9('0x6d')][_0xf4f9('0x35')](_0x994687[_0xf4f9('0x7f')](),{'type':db['sequelize']['QueryTypes'][_0xf4f9('0x80')]})[_0xf4f9('0x28')](function(_0x4c2ca6){if(_0x4c2ca6[_0xf4f9('0x3b')]===0x1){return _0xbb28f0['id'];}else{var _0x574e4b=_[_0xf4f9('0x81')](_[_0xf4f9('0x34')](_0x4c2ca6,_0xf4f9('0x82')),function(_0x490ba2){return _[_0xf4f9('0x83')](_0x38c5f0,_0x490ba2);});if(_0x574e4b){return _0xbb28f0['id'];}}}));}}return BPromise[_0xf4f9('0x84')](_0x51583a)['then'](function(_0x52d09c){_0x49a90d=_(_0x49a90d)[_0xf4f9('0x85')](_0x52d09c)[_0xf4f9('0x86')]()[_0xf4f9('0x87')]();return db[_0xf4f9('0x42')][_0xf4f9('0x49')]({'where':{'id':_0x1ff8c3[_0xf4f9('0x45')]['id']}})[_0xf4f9('0x28')](function(_0x11da09){return db['sequelize'][_0xf4f9('0x6e')](function(_0x129415){return _0x11da09['removeTeams'](_0x1ff8c3[_0xf4f9('0x35')][_0xf4f9('0x66')],{'transaction':_0x129415})[_0xf4f9('0x28')](function(){if(!_[_0xf4f9('0x88')](_0x49a90d)){return _0x11da09['removeAgents'](_0x49a90d,{'transaction':_0x129415});}})[_0xf4f9('0x28')](function(){_0x49a90d[_0xf4f9('0x70')](function(_0x5d875c){socket['emit'](_0xf4f9('0x89'),{'UserId':_0x5d875c,'OpenchannelQueueId':_0x11da09['id']});});});});});});})['then'](respondWithStatusCode(_0x3e687e,null))['catch'](handleError(_0x3e687e,null));};exports['addAgents']=function(_0x33ee0e,_0x2d832c,_0x148036){return db[_0xf4f9('0x42')]['find']({'where':{'id':_0x33ee0e[_0xf4f9('0x45')]['id']}})['then'](handleEntityNotFound(_0x2d832c,null))[_0xf4f9('0x28')](function(_0x55b035){if(_0x55b035){return _0x55b035[_0xf4f9('0x8a')](_0x33ee0e['body'][_0xf4f9('0x66')],_['omit'](_0x33ee0e[_0xf4f9('0x4b')],[_0xf4f9('0x66'),'id'])||{})[_0xf4f9('0x8b')](function(_0x4dc028){for(var _0x561cc9=0x0;_0x561cc9<_0x33ee0e[_0xf4f9('0x4b')][_0xf4f9('0x66')][_0xf4f9('0x3b')];_0x561cc9+=0x1){socket[_0xf4f9('0x71')](_0xf4f9('0x72'),{'UserId':Number(_0x33ee0e[_0xf4f9('0x4b')][_0xf4f9('0x66')][_0x561cc9]),'OpenchannelQueueId':Number(_0x33ee0e['params']['id'])});}return _0x4dc028;});}})[_0xf4f9('0x28')](respondWithResult(_0x2d832c,null))['catch'](handleError(_0x2d832c,null));};exports[_0xf4f9('0x8c')]=function(_0x549b1d,_0x3e3977,_0x581fc3){return db[_0xf4f9('0x42')][_0xf4f9('0x49')]({'where':{'id':_0x549b1d[_0xf4f9('0x45')]['id']}})[_0xf4f9('0x28')](handleEntityNotFound(_0x3e3977,null))['then'](function(_0x24ed06){if(_0x24ed06){return _0x24ed06[_0xf4f9('0x8c')](_0x549b1d[_0xf4f9('0x35')][_0xf4f9('0x66')])['then'](function(){if(_[_0xf4f9('0x8d')](_0x549b1d['query'][_0xf4f9('0x66')])){for(var _0x4db4ce=0x0;_0x4db4ce<_0x549b1d[_0xf4f9('0x35')][_0xf4f9('0x66')][_0xf4f9('0x3b')];_0x4db4ce+=0x1){socket[_0xf4f9('0x71')]('userOpenchannelQueue:remove',{'UserId':Number(_0x549b1d[_0xf4f9('0x35')]['ids'][_0x4db4ce]),'OpenchannelQueueId':Number(_0x549b1d['params']['id'])});}}else{socket['emit'](_0xf4f9('0x89'),{'UserId':Number(_0x549b1d['query'][_0xf4f9('0x66')]),'OpenchannelQueueId':Number(_0x549b1d[_0xf4f9('0x45')]['id'])});}});}})[_0xf4f9('0x28')](respondWithStatusCode(_0x3e3977,null))[_0xf4f9('0x43')](handleError(_0x3e3977,null));};exports[_0xf4f9('0x8e')]=function(_0x1b4bfe,_0x212b40,_0x2e7f91){var _0x87c6ce={};var _0x4f6ab1={};var _0x44ea19;var _0x140a50;return db[_0xf4f9('0x42')][_0xf4f9('0x54')]({'where':{'id':_0x1b4bfe[_0xf4f9('0x45')]['id']}})['then'](handleEntityNotFound(_0x212b40,null))[_0xf4f9('0x28')](function(_0x591e5c){if(_0x591e5c){_0x44ea19=_0x591e5c;_0x4f6ab1[_0xf4f9('0x33')]=_[_0xf4f9('0x36')](db['User'][_0xf4f9('0x30')]);_0x4f6ab1[_0xf4f9('0x35')]=_[_0xf4f9('0x36')](_0x1b4bfe[_0xf4f9('0x35')]);_0x4f6ab1[_0xf4f9('0x37')]=_[_0xf4f9('0x38')](_0x4f6ab1['model'],_0x4f6ab1[_0xf4f9('0x35')]);_0x87c6ce['attributes']=_[_0xf4f9('0x38')](_0x4f6ab1[_0xf4f9('0x33')],qs[_0xf4f9('0x3a')](_0x1b4bfe[_0xf4f9('0x35')][_0xf4f9('0x3a')]));_0x87c6ce[_0xf4f9('0x39')]=_0x87c6ce[_0xf4f9('0x39')]['length']?_0x87c6ce['attributes']:_0x4f6ab1[_0xf4f9('0x33')];_0x87c6ce['order']=qs[_0xf4f9('0x3e')](_0x1b4bfe[_0xf4f9('0x35')]['sort']);_0x87c6ce[_0xf4f9('0x3f')]=qs[_0xf4f9('0x37')](_[_0xf4f9('0x57')](_0x1b4bfe['query'],_0x4f6ab1[_0xf4f9('0x37')]));if(_0x1b4bfe[_0xf4f9('0x35')]['filter']){_0x87c6ce[_0xf4f9('0x3f')]=_[_0xf4f9('0x40')](_0x87c6ce['where'],{'$or':_['map'](_0x87c6ce[_0xf4f9('0x39')],function(_0x1e689b){var _0x1d5aa6={};_0x1d5aa6[_0x1e689b]={'$like':'%'+_0x1b4bfe['query'][_0xf4f9('0x41')]+'%'};return _0x1d5aa6;})});}_0x87c6ce=_[_0xf4f9('0x40')]({},_0x87c6ce,_0x1b4bfe['options']);return _0x44ea19[_0xf4f9('0x8e')](_0x87c6ce);}})[_0xf4f9('0x28')](function(_0x5c57bd){if(_0x5c57bd){_0x140a50=_0x5c57bd[_0xf4f9('0x3b')];if(!_0x1b4bfe[_0xf4f9('0x35')][_0xf4f9('0x3c')](_0xf4f9('0x56'))){_0x87c6ce[_0xf4f9('0x20')]=qs['limit'](_0x1b4bfe[_0xf4f9('0x35')]['limit']);_0x87c6ce['offset']=qs[_0xf4f9('0x1f')](_0x1b4bfe['query'][_0xf4f9('0x1f')]);}return _0x44ea19['getAgents'](_0x87c6ce);}})[_0xf4f9('0x28')](function(_0x2ae68a){if(_0x2ae68a){return _0x2ae68a?{'count':_0x140a50,'rows':_0x2ae68a}:null;}})[_0xf4f9('0x28')](respondWithResult(_0x212b40,null))[_0xf4f9('0x43')](handleError(_0x212b40,null));}; \ No newline at end of file +var _0x6bf7=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','keys','filters','intersection','model','attributes','fields','length','query','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','includeAll','include','OpenchannelQueue','params','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserOpenchannelQueue','pick','OpenchannelQueueId','findAll','User','findAndCountAll','UserId','createdAt','SIP','updatedAt','getTeams','Team','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','userOpenchannelQueue:save','removeTeams','select','tq.TeamId','from','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','toString','QueryTypes','every','TeamId','includes','union','compact','isEmpty','removeAgents','forEach','userOpenchannelQueue:remove','addAgents','omit','spread','emit','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','lodash'];(function(_0x30c48d,_0x25e828){var _0x2c64aa=function(_0x244ae6){while(--_0x244ae6){_0x30c48d['push'](_0x30c48d['shift']());}};_0x2c64aa(++_0x25e828);}(_0x6bf7,0x10b));var _0x76bf=function(_0x1a59bc,_0x4027bf){_0x1a59bc=_0x1a59bc-0x0;var _0x116ef1=_0x6bf7[_0x1a59bc];return _0x116ef1;};'use strict';var emlformat=require(_0x76bf('0x0'));var rimraf=require(_0x76bf('0x1'));var zipdir=require(_0x76bf('0x2'));var jsonpatch=require(_0x76bf('0x3'));var rp=require(_0x76bf('0x4'));var moment=require(_0x76bf('0x5'));var BPromise=require(_0x76bf('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x76bf('0x7'));var sox=require(_0x76bf('0x8'));var csv=require('to-csv');var ejs=require(_0x76bf('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76bf('0xa'));var squel=require(_0x76bf('0xb'));var crypto=require(_0x76bf('0xc'));var jsforce=require(_0x76bf('0xd'));var deskjs=require(_0x76bf('0xe'));var toCsv=require('to-csv');var querystring=require(_0x76bf('0xf'));var Papa=require(_0x76bf('0x10'));var Redis=require(_0x76bf('0x11'));var authService=require(_0x76bf('0x12'));var qs=require(_0x76bf('0x13'));var as=require(_0x76bf('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x76bf('0x15'))(_0x76bf('0x16'));var utils=require(_0x76bf('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x76bf('0x18')]=_[_0x76bf('0x19')](config[_0x76bf('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x76bf('0x1a'))(new Redis(config['redis']));require(_0x76bf('0x1b'))[_0x76bf('0x1c')](socket);function respondWithStatusCode(_0x41ca15,_0x50b0c2){_0x50b0c2=_0x50b0c2||0xcc;return function(_0x3089ad){if(_0x3089ad){return _0x41ca15['sendStatus'](_0x50b0c2);}return _0x41ca15[_0x76bf('0x1d')](_0x50b0c2)['end']();};}function respondWithResult(_0x2ea1ad,_0xf41d90){_0xf41d90=_0xf41d90||0xc8;return function(_0x394ae1){if(_0x394ae1){return _0x2ea1ad[_0x76bf('0x1d')](_0xf41d90)[_0x76bf('0x1e')](_0x394ae1);}};}function respondWithFilteredResult(_0x2ea6a1,_0x31f2cc){return function(_0x5c6158){if(_0x5c6158){var _0x1cf0f8=typeof _0x31f2cc[_0x76bf('0x1f')]===_0x76bf('0x20')&&typeof _0x31f2cc[_0x76bf('0x21')]===_0x76bf('0x20');var _0x53b2c2=_0x5c6158['count'];var _0x57fb4a=_0x1cf0f8?0x0:_0x31f2cc[_0x76bf('0x1f')];var _0x2448f7=_0x1cf0f8?_0x5c6158[_0x76bf('0x22')]:_0x31f2cc[_0x76bf('0x1f')]+_0x31f2cc['limit'];var _0x19ede0;if(_0x2448f7>=_0x53b2c2){_0x2448f7=_0x53b2c2;_0x19ede0=0xc8;}else{_0x19ede0=0xce;}_0x2ea6a1[_0x76bf('0x1d')](_0x19ede0);return _0x2ea6a1[_0x76bf('0x23')](_0x76bf('0x24'),_0x57fb4a+'-'+_0x2448f7+'/'+_0x53b2c2)['json'](_0x5c6158);}return null;};}function patchUpdates(_0x1ac9e1){return function(_0x4a55bd){try{jsonpatch[_0x76bf('0x25')](_0x4a55bd,_0x1ac9e1,!![]);}catch(_0x5b5ecf){return BPromise['reject'](_0x5b5ecf);}return _0x4a55bd[_0x76bf('0x26')]();};}function saveUpdates(_0x52d1b6,_0x2153b5){return function(_0x31261a){if(_0x31261a){return _0x31261a[_0x76bf('0x27')](_0x52d1b6)[_0x76bf('0x28')](function(_0x5928db){return _0x5928db;});}return null;};}function removeEntity(_0x1bf00e,_0x1d07c9){return function(_0x3359f0){if(_0x3359f0){return _0x3359f0[_0x76bf('0x29')]()[_0x76bf('0x28')](function(){var _0x40c739=_0x3359f0[_0x76bf('0x2a')]({'plain':!![]});var _0x454fce=_0x76bf('0x2b');return db[_0x76bf('0x2c')][_0x76bf('0x29')]({'where':{'type':_0x454fce,'resourceId':_0x40c739['id']}})['then'](function(){return _0x3359f0;});})[_0x76bf('0x28')](function(){_0x1bf00e['status'](0xcc)[_0x76bf('0x2d')]();});}};}function handleEntityNotFound(_0x3b049d,_0x50a344){return function(_0x306c99){if(!_0x306c99){_0x3b049d[_0x76bf('0x2e')](0x194);}return _0x306c99;};}function handleError(_0x32f8c3,_0x4b9c38){_0x4b9c38=_0x4b9c38||0x1f4;return function(_0x5b746b){logger[_0x76bf('0x2f')](_0x5b746b[_0x76bf('0x30')]);if(_0x5b746b['name']){delete _0x5b746b[_0x76bf('0x31')];}_0x32f8c3['status'](_0x4b9c38)[_0x76bf('0x32')](_0x5b746b);};}exports[_0x76bf('0x33')]=function(_0x5a5245,_0x430db2){var _0x132a14={},_0x307254={},_0x5bb316={'count':0x0,'rows':[]};var _0x17977a=_[_0x76bf('0x34')](db['OpenchannelQueue'][_0x76bf('0x35')],function(_0xe630a5){return{'name':_0xe630a5[_0x76bf('0x36')],'type':_0xe630a5[_0x76bf('0x37')][_0x76bf('0x38')]};});_0x307254['model']=_[_0x76bf('0x34')](_0x17977a,_0x76bf('0x31'));_0x307254['query']=_[_0x76bf('0x39')](_0x5a5245['query']);_0x307254[_0x76bf('0x3a')]=_[_0x76bf('0x3b')](_0x307254[_0x76bf('0x3c')],_0x307254['query']);_0x132a14[_0x76bf('0x3d')]=_[_0x76bf('0x3b')](_0x307254[_0x76bf('0x3c')],qs[_0x76bf('0x3e')](_0x5a5245['query'][_0x76bf('0x3e')]));_0x132a14[_0x76bf('0x3d')]=_0x132a14['attributes'][_0x76bf('0x3f')]?_0x132a14[_0x76bf('0x3d')]:_0x307254[_0x76bf('0x3c')];if(!_0x5a5245[_0x76bf('0x40')][_0x76bf('0x41')](_0x76bf('0x42'))){_0x132a14[_0x76bf('0x21')]=qs[_0x76bf('0x21')](_0x5a5245[_0x76bf('0x40')][_0x76bf('0x21')]);_0x132a14[_0x76bf('0x1f')]=qs[_0x76bf('0x1f')](_0x5a5245[_0x76bf('0x40')]['offset']);}_0x132a14[_0x76bf('0x43')]=qs[_0x76bf('0x44')](_0x5a5245['query'][_0x76bf('0x44')]);_0x132a14['where']=qs[_0x76bf('0x3a')](_['pick'](_0x5a5245[_0x76bf('0x40')],_0x307254[_0x76bf('0x3a')]),_0x17977a);if(_0x5a5245['query']['filter']){_0x132a14[_0x76bf('0x45')]=_[_0x76bf('0x46')](_0x132a14[_0x76bf('0x45')],{'$or':_[_0x76bf('0x34')](_0x17977a,function(_0x4adbaf){if(_0x4adbaf[_0x76bf('0x37')]!==_0x76bf('0x47')){var _0x355c5c={};_0x355c5c[_0x4adbaf[_0x76bf('0x31')]]={'$like':'%'+_0x5a5245[_0x76bf('0x40')][_0x76bf('0x48')]+'%'};return _0x355c5c;}})});}_0x132a14=_['merge']({},_0x132a14,_0x5a5245['options']);var _0x85a3fd={'where':_0x132a14[_0x76bf('0x45')]};return db['OpenchannelQueue'][_0x76bf('0x22')](_0x85a3fd)[_0x76bf('0x28')](function(_0x58922e){_0x5bb316['count']=_0x58922e;if(_0x5a5245[_0x76bf('0x40')][_0x76bf('0x49')]){_0x132a14[_0x76bf('0x4a')]=[{'all':!![]}];}return db[_0x76bf('0x4b')]['findAll'](_0x132a14);})[_0x76bf('0x28')](function(_0x3ed911){_0x5bb316['rows']=_0x3ed911;return _0x5bb316;})[_0x76bf('0x28')](respondWithFilteredResult(_0x430db2,_0x132a14))['catch'](handleError(_0x430db2,null));};exports['show']=function(_0x55f501,_0x172015){var _0x10bd21={'raw':!![],'where':{'id':_0x55f501[_0x76bf('0x4c')]['id']}},_0x30a757={};_0x30a757[_0x76bf('0x3c')]=_[_0x76bf('0x39')](db['OpenchannelQueue'][_0x76bf('0x35')]);_0x30a757[_0x76bf('0x40')]=_['keys'](_0x55f501[_0x76bf('0x40')]);_0x30a757[_0x76bf('0x3a')]=_[_0x76bf('0x3b')](_0x30a757[_0x76bf('0x3c')],_0x30a757[_0x76bf('0x40')]);_0x10bd21[_0x76bf('0x3d')]=_['intersection'](_0x30a757[_0x76bf('0x3c')],qs['fields'](_0x55f501[_0x76bf('0x40')][_0x76bf('0x3e')]));_0x10bd21[_0x76bf('0x3d')]=_0x10bd21['attributes'][_0x76bf('0x3f')]?_0x10bd21[_0x76bf('0x3d')]:_0x30a757['model'];if(_0x55f501[_0x76bf('0x40')]['includeAll']){_0x10bd21[_0x76bf('0x4a')]=[{'all':!![]}];}_0x10bd21=_[_0x76bf('0x46')]({},_0x10bd21,_0x55f501[_0x76bf('0x4d')]);return db[_0x76bf('0x4b')][_0x76bf('0x4e')](_0x10bd21)[_0x76bf('0x28')](handleEntityNotFound(_0x172015,null))['then'](respondWithResult(_0x172015,null))['catch'](handleError(_0x172015,null));};exports[_0x76bf('0x4f')]=function(_0xda968e,_0x158815){return db[_0x76bf('0x4b')][_0x76bf('0x4f')](_0xda968e[_0x76bf('0x50')],{})[_0x76bf('0x28')](function(_0x4fbf79){var _0x43d0be=_0xda968e['user']['get']({'plain':!![]});if(!_0x43d0be)throw new Error(_0x76bf('0x51'));if(_0x43d0be[_0x76bf('0x52')]===_0x76bf('0x53')){var _0xca3a45=_0x4fbf79[_0x76bf('0x2a')]({'plain':!![]});var _0xa30c6d='OpenchannelQueues';return db[_0x76bf('0x54')][_0x76bf('0x4e')]({'where':{'name':_0xa30c6d,'userProfileId':_0x43d0be[_0x76bf('0x55')]},'raw':!![]})[_0x76bf('0x28')](function(_0x3b0d1e){if(_0x3b0d1e&&_0x3b0d1e[_0x76bf('0x56')]===0x0){return db[_0x76bf('0x2c')][_0x76bf('0x4f')]({'name':_0xca3a45[_0x76bf('0x31')],'resourceId':_0xca3a45['id'],'type':_0x3b0d1e[_0x76bf('0x31')],'sectionId':_0x3b0d1e['id']},{})[_0x76bf('0x28')](function(){return _0x4fbf79;});}else{return _0x4fbf79;}})[_0x76bf('0x57')](function(_0x3516a3){logger[_0x76bf('0x2f')](_0x76bf('0x58'),_0x3516a3);throw _0x3516a3;});}return _0x4fbf79;})['then'](respondWithResult(_0x158815,0xc9))[_0x76bf('0x57')](handleError(_0x158815,null));};exports[_0x76bf('0x27')]=function(_0x9b0828,_0x5d8ea6){if(_0x9b0828[_0x76bf('0x50')]['id']){delete _0x9b0828[_0x76bf('0x50')]['id'];}return db[_0x76bf('0x4b')][_0x76bf('0x4e')]({'where':{'id':_0x9b0828[_0x76bf('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5d8ea6,null))['then'](saveUpdates(_0x9b0828[_0x76bf('0x50')],null))[_0x76bf('0x28')](respondWithResult(_0x5d8ea6,null))[_0x76bf('0x57')](handleError(_0x5d8ea6,null));};exports['destroy']=function(_0x5935ed,_0x2a103a){return db[_0x76bf('0x4b')]['find']({'where':{'id':_0x5935ed['params']['id']}})[_0x76bf('0x28')](handleEntityNotFound(_0x2a103a,null))[_0x76bf('0x28')](removeEntity(_0x2a103a,null))['catch'](handleError(_0x2a103a,null));};exports[_0x76bf('0x59')]=function(_0x3ae98f,_0x9a97bf){return db[_0x76bf('0x4b')][_0x76bf('0x59')]()['then'](respondWithResult(_0x9a97bf,null))['catch'](handleError(_0x9a97bf,null));};exports['getMembers']=function(_0x4af38f,_0x9041cf,_0x235b54){var _0x545edc={'raw':!![],'where':{}},_0x9e0790={},_0x50954b;return db[_0x76bf('0x4b')][_0x76bf('0x5a')]({'where':{'id':_0x4af38f['params']['id']}})[_0x76bf('0x28')](handleEntityNotFound(_0x9041cf,null))['then'](function(_0x3fd174){if(_0x3fd174){_0x50954b=_0x3fd174[_0x76bf('0x2a')]({'plain':!![]});_0x9e0790[_0x76bf('0x3c')]=_[_0x76bf('0x39')](db[_0x76bf('0x5b')][_0x76bf('0x35')]);_0x9e0790[_0x76bf('0x40')]=_['keys'](_0x4af38f[_0x76bf('0x40')]);_0x9e0790['filters']=_['intersection'](_0x9e0790[_0x76bf('0x3c')],_0x9e0790[_0x76bf('0x40')]);_0x545edc[_0x76bf('0x3d')]=_[_0x76bf('0x3b')](_0x9e0790[_0x76bf('0x3c')],qs[_0x76bf('0x3e')](_0x4af38f[_0x76bf('0x40')]['fields']));_0x545edc[_0x76bf('0x3d')]=_0x545edc[_0x76bf('0x3d')]['length']?_0x545edc[_0x76bf('0x3d')]:_0x9e0790[_0x76bf('0x3c')];if(!_0x4af38f['query'][_0x76bf('0x41')](_0x76bf('0x42'))){_0x545edc['limit']=qs[_0x76bf('0x21')](_0x4af38f[_0x76bf('0x40')][_0x76bf('0x21')]);_0x545edc['offset']=qs[_0x76bf('0x1f')](_0x4af38f[_0x76bf('0x40')][_0x76bf('0x1f')]);}_0x545edc[_0x76bf('0x43')]=qs[_0x76bf('0x44')](_0x4af38f[_0x76bf('0x40')][_0x76bf('0x44')]);_0x545edc[_0x76bf('0x45')]=qs['filters'](_[_0x76bf('0x5c')](_0x4af38f[_0x76bf('0x40')],_0x9e0790[_0x76bf('0x3a')]));_0x545edc[_0x76bf('0x45')][_0x76bf('0x5d')]=_0x3fd174['id'];if(_0x4af38f[_0x76bf('0x40')][_0x76bf('0x48')]){_0x545edc[_0x76bf('0x45')]=_[_0x76bf('0x46')](_0x545edc[_0x76bf('0x45')],{'$or':_[_0x76bf('0x34')](_0x545edc[_0x76bf('0x3d')],function(_0xbcbc62){var _0x2ad72e={};_0x2ad72e[_0xbcbc62]={'$like':'%'+_0x4af38f[_0x76bf('0x40')][_0x76bf('0x48')]+'%'};return _0x2ad72e;})});}_0x545edc=_[_0x76bf('0x46')]({},_0x545edc,_0x4af38f[_0x76bf('0x4d')]);return db[_0x76bf('0x5b')][_0x76bf('0x5e')](_0x545edc);}})[_0x76bf('0x28')](function(_0x1caef2){if(_0x1caef2){return db[_0x76bf('0x5f')][_0x76bf('0x60')]({'where':{'id':_[_0x76bf('0x34')](_0x1caef2,_0x76bf('0x61')),'role':'agent'},'attributes':['id',_0x76bf('0x31'),'openchannelPause','updatedAt',_0x76bf('0x62')]});}})[_0x76bf('0x28')](function(_0x18dcb4){if(_0x18dcb4){return{'count':_0x18dcb4[_0x76bf('0x22')],'rows':_['map'](_0x18dcb4['rows'],function(_0x5cfc1d){return{'membername':_0x5cfc1d[_0x76bf('0x31')],'UserId':_0x5cfc1d['id'],'queue_name':_0x50954b['name'],'OpenchannelQueueId':_0x50954b['id'],'interface':util['format']('%s/%s',_0x76bf('0x63'),_0x5cfc1d[_0x76bf('0x31')]),'penalty':0x0,'paused':_0x5cfc1d['openchannelPause'],'createdAt':_0x5cfc1d[_0x76bf('0x62')],'updatedAt':_0x5cfc1d[_0x76bf('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x76bf('0x28')](respondWithFilteredResult(_0x9041cf,_0x545edc))['catch'](handleError(_0x9041cf,null));};exports[_0x76bf('0x65')]=function(_0x2037d6,_0x2de60b,_0x3abe36){var _0xb4e8dd={};var _0x1e3745={};var _0x41909f;var _0x4c6fea;return db[_0x76bf('0x4b')][_0x76bf('0x5a')]({'where':{'id':_0x2037d6[_0x76bf('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2de60b,null))[_0x76bf('0x28')](function(_0x4fb4a2){if(_0x4fb4a2){_0x41909f=_0x4fb4a2;_0x1e3745[_0x76bf('0x3c')]=_[_0x76bf('0x39')](db[_0x76bf('0x66')][_0x76bf('0x35')]);_0x1e3745[_0x76bf('0x40')]=_['keys'](_0x2037d6['query']);_0x1e3745['filters']=_[_0x76bf('0x3b')](_0x1e3745[_0x76bf('0x3c')],_0x1e3745['query']);_0xb4e8dd['attributes']=_['intersection'](_0x1e3745['model'],qs['fields'](_0x2037d6[_0x76bf('0x40')][_0x76bf('0x3e')]));_0xb4e8dd['attributes']=_0xb4e8dd[_0x76bf('0x3d')][_0x76bf('0x3f')]?_0xb4e8dd[_0x76bf('0x3d')]:_0x1e3745[_0x76bf('0x3c')];_0xb4e8dd[_0x76bf('0x43')]=qs[_0x76bf('0x44')](_0x2037d6[_0x76bf('0x40')]['sort']);_0xb4e8dd['where']=qs[_0x76bf('0x3a')](_[_0x76bf('0x5c')](_0x2037d6[_0x76bf('0x40')],_0x1e3745[_0x76bf('0x3a')]));if(_0x2037d6[_0x76bf('0x40')][_0x76bf('0x48')]){_0xb4e8dd[_0x76bf('0x45')]=_[_0x76bf('0x46')](_0xb4e8dd[_0x76bf('0x45')],{'$or':_[_0x76bf('0x34')](_0xb4e8dd[_0x76bf('0x3d')],function(_0x909192){var _0x4b5048={};_0x4b5048[_0x909192]={'$like':'%'+_0x2037d6[_0x76bf('0x40')][_0x76bf('0x48')]+'%'};return _0x4b5048;})});}_0xb4e8dd=_[_0x76bf('0x46')]({},_0xb4e8dd,_0x2037d6[_0x76bf('0x4d')]);return _0x41909f['getTeams'](_0xb4e8dd);}})[_0x76bf('0x28')](function(_0x27c950){if(_0x27c950){_0x4c6fea=_0x27c950['length'];if(!_0x2037d6['query']['hasOwnProperty'](_0x76bf('0x42'))){_0xb4e8dd[_0x76bf('0x21')]=qs['limit'](_0x2037d6[_0x76bf('0x40')][_0x76bf('0x21')]);_0xb4e8dd[_0x76bf('0x1f')]=qs[_0x76bf('0x1f')](_0x2037d6['query'][_0x76bf('0x1f')]);}return _0x41909f['getTeams'](_0xb4e8dd);}})[_0x76bf('0x28')](function(_0x3261b8){if(_0x3261b8){return _0x3261b8?{'count':_0x4c6fea,'rows':_0x3261b8}:null;}})[_0x76bf('0x28')](respondWithResult(_0x2de60b,null))[_0x76bf('0x57')](handleError(_0x2de60b,null));};exports[_0x76bf('0x67')]=function(_0x3fb700,_0x13dd7e,_0x1b066e){var _0xd6ef61=_0x3fb700[_0x76bf('0x50')][_0x76bf('0x68')];return db[_0x76bf('0x66')]['findAll']({'where':{'id':_0xd6ef61},'attributes':['id'],'include':[{'model':db[_0x76bf('0x5f')],'as':_0x76bf('0x69'),'attributes':['id',_0x76bf('0x31'),'online',_0x76bf('0x6a'),_0x76bf('0x6b')],'raw':!![]}]})[_0x76bf('0x28')](function(_0x4dc032){if(_0x4dc032){var _0x45c3d4=_[_0x76bf('0x6c')](_0x4dc032,function(_0x4ac884){var _0x47ce2d=_0x4ac884[_0x76bf('0x2a')]({'plain':!![]});return _0x47ce2d[_0x76bf('0x69')];});return db['OpenchannelQueue'][_0x76bf('0x4e')]({'where':{'id':_0x3fb700[_0x76bf('0x4c')]['id']}})['then'](function(_0x1cef5c){return db[_0x76bf('0x6d')][_0x76bf('0x6e')](function(_0x16cad5){return _0x1cef5c[_0x76bf('0x67')](_0xd6ef61,{'transaction':_0x16cad5})[_0x76bf('0x28')](function(){return BPromise[_0x76bf('0x6f')](_0x45c3d4,function(_0x24de54){return db['UserOpenchannelQueue'][_0x76bf('0x70')]({'where':{'UserId':_0x24de54['id'],'OpenchannelQueueId':_0x3fb700[_0x76bf('0x4c')]['id']},'transaction':_0x16cad5});});})['then'](function(){_0x45c3d4['forEach'](function(_0x26e7ad){socket['emit'](_0x76bf('0x71'),{'UserId':_0x26e7ad['id'],'OpenchannelQueueId':_0x1cef5c['id']});});});});});}})[_0x76bf('0x28')](respondWithStatusCode(_0x13dd7e,null))[_0x76bf('0x57')](handleError(_0x13dd7e,null));};exports[_0x76bf('0x72')]=function(_0x2b5450,_0x1e6a5e,_0x54825f){return db['Team'][_0x76bf('0x5e')]({'where':{'id':_0x2b5450[_0x76bf('0x40')][_0x76bf('0x68')]},'attributes':['id'],'include':[{'model':db[_0x76bf('0x5f')],'as':_0x76bf('0x69'),'attributes':['id'],'raw':!![]}]})[_0x76bf('0x28')](handleEntityNotFound(_0x1e6a5e,null))['then'](function(_0x5c5956){var _0x30f2a6=_[_0x76bf('0x34')](_0x5c5956,'id');var _0xe9fc0f=[];var _0x175ced=[];var _0x49632c=squel[_0x76bf('0x73')]();_0x49632c['field'](_0x76bf('0x74'))[_0x76bf('0x75')](_0x76bf('0x76'),'tq')[_0x76bf('0x77')]('user_has_teams','ut',_0x76bf('0x78'))['where'](_0x76bf('0x79'),_0x2b5450[_0x76bf('0x4c')]['id']);for(var _0x38c50a=0x0;_0x38c50a<_0x5c5956[_0x76bf('0x3f')];_0x38c50a+=0x1){let _0x2bf96f=_0x5c5956[_0x38c50a];for(var _0x191dbc=0x0;_0x191dbc<_0x2bf96f['Agents']['length'];_0x191dbc+=0x1){let _0x36c8c2=_0x2bf96f[_0x76bf('0x69')][_0x191dbc];var _0x1d292a=_0x49632c[_0x76bf('0x7a')]();_0x1d292a[_0x76bf('0x45')]('ut.UserId\x20=\x20?',_0x36c8c2['id']);_0x175ced['push'](db[_0x76bf('0x6d')]['query'](_0x1d292a[_0x76bf('0x7b')](),{'type':db['sequelize'][_0x76bf('0x7c')]['SELECT']})['then'](function(_0xc1a51e){if(_0xc1a51e[_0x76bf('0x3f')]===0x1){return _0x36c8c2['id'];}else{var _0x57f9e5=_[_0x76bf('0x7d')](_['map'](_0xc1a51e,_0x76bf('0x7e')),function(_0x23304a){return _[_0x76bf('0x7f')](_0x30f2a6,_0x23304a);});if(_0x57f9e5){return _0x36c8c2['id'];}}}));}}return BPromise['all'](_0x175ced)[_0x76bf('0x28')](function(_0x398ac3){_0xe9fc0f=_(_0xe9fc0f)[_0x76bf('0x80')](_0x398ac3)[_0x76bf('0x81')]()['value']();return db[_0x76bf('0x4b')]['find']({'where':{'id':_0x2b5450[_0x76bf('0x4c')]['id']}})[_0x76bf('0x28')](function(_0x53b6ef){return db[_0x76bf('0x6d')]['transaction'](function(_0x3e2909){return _0x53b6ef['removeTeams'](_0x2b5450['query'][_0x76bf('0x68')],{'transaction':_0x3e2909})[_0x76bf('0x28')](function(){if(!_[_0x76bf('0x82')](_0xe9fc0f)){return _0x53b6ef[_0x76bf('0x83')](_0xe9fc0f,{'transaction':_0x3e2909});}})[_0x76bf('0x28')](function(){_0xe9fc0f[_0x76bf('0x84')](function(_0x2f2d8a){socket['emit'](_0x76bf('0x85'),{'UserId':_0x2f2d8a,'OpenchannelQueueId':_0x53b6ef['id']});});});});});});})[_0x76bf('0x28')](respondWithStatusCode(_0x1e6a5e,null))[_0x76bf('0x57')](handleError(_0x1e6a5e,null));};exports[_0x76bf('0x86')]=function(_0x1d53eb,_0xd55241,_0x431704){return db['OpenchannelQueue'][_0x76bf('0x4e')]({'where':{'id':_0x1d53eb[_0x76bf('0x4c')]['id']}})[_0x76bf('0x28')](handleEntityNotFound(_0xd55241,null))[_0x76bf('0x28')](function(_0x381e89){if(_0x381e89){return _0x381e89[_0x76bf('0x86')](_0x1d53eb[_0x76bf('0x50')][_0x76bf('0x68')],_[_0x76bf('0x87')](_0x1d53eb[_0x76bf('0x50')],[_0x76bf('0x68'),'id'])||{})[_0x76bf('0x88')](function(_0x2ee865){for(var _0x10da3e=0x0;_0x10da3e<_0x1d53eb[_0x76bf('0x50')][_0x76bf('0x68')]['length'];_0x10da3e+=0x1){socket[_0x76bf('0x89')](_0x76bf('0x71'),{'UserId':Number(_0x1d53eb['body'][_0x76bf('0x68')][_0x10da3e]),'OpenchannelQueueId':Number(_0x1d53eb[_0x76bf('0x4c')]['id'])});}return _0x2ee865;});}})['then'](respondWithResult(_0xd55241,null))[_0x76bf('0x57')](handleError(_0xd55241,null));};exports[_0x76bf('0x83')]=function(_0xbe062e,_0x142ac9,_0x2406fe){return db['OpenchannelQueue'][_0x76bf('0x4e')]({'where':{'id':_0xbe062e[_0x76bf('0x4c')]['id']}})[_0x76bf('0x28')](handleEntityNotFound(_0x142ac9,null))[_0x76bf('0x28')](function(_0x1041fb){if(_0x1041fb){return _0x1041fb[_0x76bf('0x83')](_0xbe062e[_0x76bf('0x40')]['ids'])[_0x76bf('0x28')](function(){if(_['isArray'](_0xbe062e['query'][_0x76bf('0x68')])){for(var _0x52a386=0x0;_0x52a386<_0xbe062e[_0x76bf('0x40')]['ids'][_0x76bf('0x3f')];_0x52a386+=0x1){socket[_0x76bf('0x89')]('userOpenchannelQueue:remove',{'UserId':Number(_0xbe062e['query'][_0x76bf('0x68')][_0x52a386]),'OpenchannelQueueId':Number(_0xbe062e[_0x76bf('0x4c')]['id'])});}}else{socket[_0x76bf('0x89')]('userOpenchannelQueue:remove',{'UserId':Number(_0xbe062e[_0x76bf('0x40')][_0x76bf('0x68')]),'OpenchannelQueueId':Number(_0xbe062e['params']['id'])});}});}})[_0x76bf('0x28')](respondWithStatusCode(_0x142ac9,null))['catch'](handleError(_0x142ac9,null));};exports[_0x76bf('0x8a')]=function(_0x39ddcd,_0x5a86fc,_0x179dcb){var _0x11fe50={};var _0x4b7926={};var _0x5b63cd;var _0x5683c0;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x39ddcd[_0x76bf('0x4c')]['id']}})[_0x76bf('0x28')](handleEntityNotFound(_0x5a86fc,null))[_0x76bf('0x28')](function(_0x125318){if(_0x125318){_0x5b63cd=_0x125318;_0x4b7926['model']=_[_0x76bf('0x39')](db['User']['rawAttributes']);_0x4b7926['query']=_[_0x76bf('0x39')](_0x39ddcd[_0x76bf('0x40')]);_0x4b7926['filters']=_[_0x76bf('0x3b')](_0x4b7926[_0x76bf('0x3c')],_0x4b7926[_0x76bf('0x40')]);_0x11fe50[_0x76bf('0x3d')]=_[_0x76bf('0x3b')](_0x4b7926[_0x76bf('0x3c')],qs[_0x76bf('0x3e')](_0x39ddcd[_0x76bf('0x40')][_0x76bf('0x3e')]));_0x11fe50[_0x76bf('0x3d')]=_0x11fe50[_0x76bf('0x3d')][_0x76bf('0x3f')]?_0x11fe50[_0x76bf('0x3d')]:_0x4b7926[_0x76bf('0x3c')];_0x11fe50[_0x76bf('0x43')]=qs[_0x76bf('0x44')](_0x39ddcd[_0x76bf('0x40')][_0x76bf('0x44')]);_0x11fe50[_0x76bf('0x45')]=qs[_0x76bf('0x3a')](_[_0x76bf('0x5c')](_0x39ddcd[_0x76bf('0x40')],_0x4b7926[_0x76bf('0x3a')]));if(_0x39ddcd[_0x76bf('0x40')]['filter']){_0x11fe50['where']=_['merge'](_0x11fe50[_0x76bf('0x45')],{'$or':_[_0x76bf('0x34')](_0x11fe50[_0x76bf('0x3d')],function(_0x178fdc){var _0x4e7037={};_0x4e7037[_0x178fdc]={'$like':'%'+_0x39ddcd['query'][_0x76bf('0x48')]+'%'};return _0x4e7037;})});}_0x11fe50=_[_0x76bf('0x46')]({},_0x11fe50,_0x39ddcd[_0x76bf('0x4d')]);return _0x5b63cd[_0x76bf('0x8a')](_0x11fe50);}})['then'](function(_0x252eb0){if(_0x252eb0){_0x5683c0=_0x252eb0['length'];if(!_0x39ddcd['query'][_0x76bf('0x41')](_0x76bf('0x42'))){_0x11fe50[_0x76bf('0x21')]=qs[_0x76bf('0x21')](_0x39ddcd[_0x76bf('0x40')][_0x76bf('0x21')]);_0x11fe50['offset']=qs[_0x76bf('0x1f')](_0x39ddcd[_0x76bf('0x40')]['offset']);}return _0x5b63cd[_0x76bf('0x8a')](_0x11fe50);}})[_0x76bf('0x28')](function(_0x311f35){if(_0x311f35){return _0x311f35?{'count':_0x5683c0,'rows':_0x311f35}:null;}})[_0x76bf('0x28')](respondWithResult(_0x5a86fc,null))[_0x76bf('0x57')](handleError(_0x5a86fc,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index a82b254..4b1216e 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 _0xa496=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelQueue','save','update'];(function(_0x5a1a5b,_0x1c8fb9){var _0x36eccd=function(_0x55f735){while(--_0x55f735){_0x5a1a5b['push'](_0x5a1a5b['shift']());}};_0x36eccd(++_0x1c8fb9);}(_0xa496,0x131));var _0x6a49=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa496[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x6a49('0x0'));var OpenchannelQueue=require(_0x6a49('0x1'))['db'][_0x6a49('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6a49('0x3'),'afterUpdate':_0x6a49('0x4'),'afterDestroy':_0x6a49('0x5')};function emitEvent(_0x5232c3){return function(_0xa97ba1,_0x5921d4,_0x123c12){OpenchannelQueueEvents[_0x6a49('0x6')](_0x5232c3+':'+_0xa97ba1['id'],_0xa97ba1);OpenchannelQueueEvents['emit'](_0x5232c3,_0xa97ba1);_0x123c12(null);};}for(var e in events){if(events[_0x6a49('0x7')](e)){var event=events[e];OpenchannelQueue[_0x6a49('0x8')](e,emitEvent(event));}}module[_0x6a49('0x9')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xb838=['../../mysqldb','OpenchannelQueue','save','update','remove','emit','hook','exports','events'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xb838,0x98));var _0x8b83=function(_0x44d661,_0x48d80e){_0x44d661=_0x44d661-0x0;var _0x1674e0=_0xb838[_0x44d661];return _0x1674e0;};'use strict';var EventEmitter=require(_0x8b83('0x0'));var OpenchannelQueue=require(_0x8b83('0x1'))['db'][_0x8b83('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8b83('0x3'),'afterUpdate':_0x8b83('0x4'),'afterDestroy':_0x8b83('0x5')};function emitEvent(_0x4d85a2){return function(_0x13121f,_0x156f63,_0x30f209){OpenchannelQueueEvents[_0x8b83('0x6')](_0x4d85a2+':'+_0x13121f['id'],_0x13121f);OpenchannelQueueEvents[_0x8b83('0x6')](_0x4d85a2,_0x13121f);_0x30f209(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x8b83('0x7')](e,emitEvent(event));}}module[_0x8b83('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 7d993c2..ff3f782 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 _0x4868=['openchannel_queues','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue'];(function(_0x3cae69,_0x233c38){var _0x3128eb=function(_0x21d64e){while(--_0x21d64e){_0x3cae69['push'](_0x3cae69['shift']());}};_0x3128eb(++_0x233c38);}(_0x4868,0x90));var _0x8486=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4868[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8486('0x0'));var util=require(_0x8486('0x1'));var logger=require('../../config/logger')(_0x8486('0x2'));var moment=require(_0x8486('0x3'));var BPromise=require(_0x8486('0x4'));var rp=require(_0x8486('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8486('0x6'));var config=require(_0x8486('0x7'));var attributes=require(_0x8486('0x8'));module[_0x8486('0x9')]=function(_0x12531b,_0x47e809){return _0x12531b[_0x8486('0xa')](_0x8486('0xb'),attributes,{'tableName':_0x8486('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34d9=['util','../../config/logger','moment','path','rimraf','./openchannelQueue.attributes','define','OpenchannelQueue','openchannel_queues','lodash'];(function(_0x295413,_0x40fd30){var _0x54bd92=function(_0x2a0fd5){while(--_0x2a0fd5){_0x295413['push'](_0x295413['shift']());}};_0x54bd92(++_0x40fd30);}(_0x34d9,0x135));var _0x934d=function(_0x56894e,_0x1a1316){_0x56894e=_0x56894e-0x0;var _0x33a47b=_0x34d9[_0x56894e];return _0x33a47b;};'use strict';var _=require(_0x934d('0x0'));var util=require(_0x934d('0x1'));var logger=require(_0x934d('0x2'))('api');var moment=require(_0x934d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x934d('0x4'));var rimraf=require(_0x934d('0x5'));var config=require('../../config/environment');var attributes=require(_0x934d('0x6'));module['exports']=function(_0x9b271f,_0x158446){return _0x9b271f[_0x934d('0x7')](_0x934d('0x8'),attributes,{'tableName':_0x934d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 6249c36..949f516 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 _0x2071=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./openchannelQueue.socket','register','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','message','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','limit','include','attributes','map','model','debug','ShowOpenchannelQueue','find','where','stringify'];(function(_0x3630f9,_0x47f4f8){var _0x41804d=function(_0x2ae2a8){while(--_0x2ae2a8){_0x3630f9['push'](_0x3630f9['shift']());}};_0x41804d(++_0x47f4f8);}(_0x2071,0xa0));var _0x1207=function(_0x55ff21,_0x1540f0){_0x55ff21=_0x55ff21-0x0;var _0x4baf37=_0x2071[_0x55ff21];return _0x4baf37;};'use strict';var _=require(_0x1207('0x0'));var util=require(_0x1207('0x1'));var moment=require(_0x1207('0x2'));var BPromise=require(_0x1207('0x3'));var rs=require(_0x1207('0x4'));var fs=require('fs');var Redis=require(_0x1207('0x5'));var db=require(_0x1207('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1207('0x7'));var config=require(_0x1207('0x8'));var jayson=require(_0x1207('0x9'));var client=jayson[_0x1207('0xa')][_0x1207('0xb')]({'port':0x232a});config['redis']=_[_0x1207('0xc')](config[_0x1207('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x1207('0xe'))(new Redis(config[_0x1207('0xd')]));require(_0x1207('0xf'))[_0x1207('0x10')](socket);function respondWithRpcPromise(_0x2d44fe,_0x54f9b9,_0x13aa18){return new BPromise(function(_0x1ba9db,_0x39db0a){return client['request'](_0x2d44fe,_0x13aa18)[_0x1207('0x11')](function(_0x349dfe){logger[_0x1207('0x12')](_0x1207('0x13'),_0x54f9b9,_0x1207('0x14'));logger['debug'](_0x1207('0x15'),_0x54f9b9,_0x1207('0x14'),JSON['stringify'](_0x349dfe));if(_0x349dfe['error']){if(_0x349dfe['error']['code']===0x1f4){logger[_0x1207('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x54f9b9,_0x349dfe[_0x1207('0x16')][_0x1207('0x17')]);return _0x39db0a(_0x349dfe[_0x1207('0x16')][_0x1207('0x17')]);}logger['error'](_0x1207('0x13'),_0x54f9b9,_0x349dfe[_0x1207('0x16')][_0x1207('0x17')]);return _0x1ba9db(_0x349dfe[_0x1207('0x16')]['message']);}else{logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x54f9b9,_0x1207('0x14'));_0x1ba9db(_0x349dfe['result'][_0x1207('0x17')]);}})[_0x1207('0x18')](function(_0x52794a){logger[_0x1207('0x16')](_0x1207('0x13'),_0x54f9b9,_0x52794a);_0x39db0a(_0x52794a);});});}exports[_0x1207('0x19')]=function(_0x448b92){var _0x1e817c=this;return new Promise(function(_0x413539,_0x360e6a){return db[_0x1207('0x1a')][_0x1207('0x1b')]({'raw':_0x448b92['options']?_0x448b92[_0x1207('0x1c')][_0x1207('0x1d')]===undefined?!![]:![]:!![],'where':_0x448b92[_0x1207('0x1c')]?_0x448b92[_0x1207('0x1c')]['where']||null:null,'attributes':_0x448b92[_0x1207('0x1c')]?_0x448b92['options']['attributes']||null:null,'limit':_0x448b92[_0x1207('0x1c')]?_0x448b92[_0x1207('0x1c')][_0x1207('0x1e')]||null:null,'include':_0x448b92['options']?_0x448b92[_0x1207('0x1c')]['include']?_['map'](_0x448b92[_0x1207('0x1c')][_0x1207('0x1f')],function(_0x2f6ab3){return{'model':db[_0x2f6ab3['model']],'as':_0x2f6ab3['as'],'attributes':_0x2f6ab3[_0x1207('0x20')],'include':_0x2f6ab3[_0x1207('0x1f')]?_[_0x1207('0x21')](_0x2f6ab3['include'],function(_0x16ff44){return{'model':db[_0x16ff44[_0x1207('0x22')]],'as':_0x16ff44['as'],'attributes':_0x16ff44['attributes'],'include':_0x16ff44['include']?_[_0x1207('0x21')](_0x16ff44[_0x1207('0x1f')],function(_0x4535ff){return{'model':db[_0x4535ff[_0x1207('0x22')]],'as':_0x4535ff['as'],'attributes':_0x4535ff[_0x1207('0x20')]};}):[]};}):[]};}):[]:[]})[_0x1207('0x11')](function(_0xf99000){logger[_0x1207('0x12')]('GetOpenchannelQueue',_0x448b92);logger[_0x1207('0x23')](_0x1207('0x19'),_0x448b92,JSON['stringify'](_0xf99000));_0x413539(_0xf99000);})[_0x1207('0x18')](function(_0x6f3bc2){logger[_0x1207('0x16')](_0x1207('0x19'),_0x6f3bc2[_0x1207('0x17')],_0x448b92);_0x360e6a(_0x1e817c[_0x1207('0x16')](0x1f4,_0x6f3bc2['message']));});});};exports[_0x1207('0x24')]=function(_0x3efe44){var _0x168bb4=this;return new Promise(function(_0x1c9787,_0x156b76){return db[_0x1207('0x1a')][_0x1207('0x25')]({'raw':_0x3efe44[_0x1207('0x1c')]?_0x3efe44[_0x1207('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x3efe44[_0x1207('0x1c')]?_0x3efe44[_0x1207('0x1c')][_0x1207('0x26')]||null:null,'attributes':_0x3efe44[_0x1207('0x1c')]?_0x3efe44[_0x1207('0x1c')]['attributes']||null:null,'include':_0x3efe44['options']?_0x3efe44[_0x1207('0x1c')][_0x1207('0x1f')]?_[_0x1207('0x21')](_0x3efe44[_0x1207('0x1c')]['include'],function(_0x311c24){return{'model':db[_0x311c24['model']],'as':_0x311c24['as'],'attributes':_0x311c24[_0x1207('0x20')],'include':_0x311c24[_0x1207('0x1f')]?_['map'](_0x311c24[_0x1207('0x1f')],function(_0x2bc2db){return{'model':db[_0x2bc2db[_0x1207('0x22')]],'as':_0x2bc2db['as'],'attributes':_0x2bc2db[_0x1207('0x20')],'include':_0x2bc2db['include']?_[_0x1207('0x21')](_0x2bc2db[_0x1207('0x1f')],function(_0x5d3e28){return{'model':db[_0x5d3e28[_0x1207('0x22')]],'as':_0x5d3e28['as'],'attributes':_0x5d3e28[_0x1207('0x20')]};}):[]};}):[]};}):[]:[]})[_0x1207('0x11')](function(_0x236fda){logger[_0x1207('0x12')](_0x1207('0x24'),_0x3efe44);logger[_0x1207('0x23')](_0x1207('0x24'),_0x3efe44,JSON[_0x1207('0x27')](_0x236fda));_0x1c9787(_0x236fda);})[_0x1207('0x18')](function(_0x3d816b){logger[_0x1207('0x16')](_0x1207('0x24'),_0x3d816b[_0x1207('0x17')],_0x3efe44);_0x156b76(_0x168bb4['error'](0x1f4,_0x3d816b[_0x1207('0x17')]));});});}; \ No newline at end of file +var _0x085e=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','OpenchannelQueue','findAll','options','raw','attributes','limit','include','map','model','GetOpenchannelQueue','ShowOpenchannelQueue','find','where','debug','lodash','util'];(function(_0x266693,_0x15278b){var _0x92768f=function(_0xfb2c68){while(--_0xfb2c68){_0x266693['push'](_0x266693['shift']());}};_0x92768f(++_0x15278b);}(_0x085e,0x14e));var _0xe085=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x085e[_0x29d94e];return _0x106237;};'use strict';var _=require(_0xe085('0x0'));var util=require(_0xe085('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe085('0x2'));var fs=require('fs');var Redis=require(_0xe085('0x3'));var db=require(_0xe085('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe085('0x5'))(_0xe085('0x6'));var config=require(_0xe085('0x7'));var jayson=require(_0xe085('0x8'));var client=jayson[_0xe085('0x9')][_0xe085('0xa')]({'port':0x232a});config[_0xe085('0xb')]=_[_0xe085('0xc')](config[_0xe085('0xb')],{'host':_0xe085('0xd'),'port':0x18eb});var socket=require(_0xe085('0xe'))(new Redis(config[_0xe085('0xb')]));require(_0xe085('0xf'))[_0xe085('0x10')](socket);function respondWithRpcPromise(_0x4b5ef2,_0x15950a,_0x3f1069){return new BPromise(function(_0x28893e,_0x34d2fe){return client[_0xe085('0x11')](_0x4b5ef2,_0x3f1069)[_0xe085('0x12')](function(_0x32104d){logger[_0xe085('0x13')](_0xe085('0x14'),_0x15950a,_0xe085('0x15'));logger['debug'](_0xe085('0x16'),_0x15950a,_0xe085('0x15'),JSON[_0xe085('0x17')](_0x32104d));if(_0x32104d[_0xe085('0x18')]){if(_0x32104d[_0xe085('0x18')]['code']===0x1f4){logger[_0xe085('0x18')](_0xe085('0x14'),_0x15950a,_0x32104d[_0xe085('0x18')][_0xe085('0x19')]);return _0x34d2fe(_0x32104d['error'][_0xe085('0x19')]);}logger[_0xe085('0x18')](_0xe085('0x14'),_0x15950a,_0x32104d[_0xe085('0x18')][_0xe085('0x19')]);return _0x28893e(_0x32104d[_0xe085('0x18')][_0xe085('0x19')]);}else{logger[_0xe085('0x13')](_0xe085('0x14'),_0x15950a,_0xe085('0x15'));_0x28893e(_0x32104d[_0xe085('0x1a')][_0xe085('0x19')]);}})[_0xe085('0x1b')](function(_0x3da880){logger[_0xe085('0x18')](_0xe085('0x14'),_0x15950a,_0x3da880);_0x34d2fe(_0x3da880);});});}exports['GetOpenchannelQueue']=function(_0x4585f1){var _0x8bf98d=this;return new Promise(function(_0x36e11b,_0x368e2d){return db[_0xe085('0x1c')][_0xe085('0x1d')]({'raw':_0x4585f1['options']?_0x4585f1[_0xe085('0x1e')][_0xe085('0x1f')]===undefined?!![]:![]:!![],'where':_0x4585f1['options']?_0x4585f1[_0xe085('0x1e')]['where']||null:null,'attributes':_0x4585f1[_0xe085('0x1e')]?_0x4585f1[_0xe085('0x1e')][_0xe085('0x20')]||null:null,'limit':_0x4585f1[_0xe085('0x1e')]?_0x4585f1['options'][_0xe085('0x21')]||null:null,'include':_0x4585f1[_0xe085('0x1e')]?_0x4585f1['options'][_0xe085('0x22')]?_['map'](_0x4585f1['options']['include'],function(_0x1b816e){return{'model':db[_0x1b816e['model']],'as':_0x1b816e['as'],'attributes':_0x1b816e[_0xe085('0x20')],'include':_0x1b816e[_0xe085('0x22')]?_[_0xe085('0x23')](_0x1b816e[_0xe085('0x22')],function(_0x3b606c){return{'model':db[_0x3b606c[_0xe085('0x24')]],'as':_0x3b606c['as'],'attributes':_0x3b606c[_0xe085('0x20')],'include':_0x3b606c[_0xe085('0x22')]?_[_0xe085('0x23')](_0x3b606c[_0xe085('0x22')],function(_0xf17046){return{'model':db[_0xf17046[_0xe085('0x24')]],'as':_0xf17046['as'],'attributes':_0xf17046[_0xe085('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe085('0x12')](function(_0x344939){logger['info'](_0xe085('0x25'),_0x4585f1);logger['debug']('GetOpenchannelQueue',_0x4585f1,JSON[_0xe085('0x17')](_0x344939));_0x36e11b(_0x344939);})[_0xe085('0x1b')](function(_0x165812){logger[_0xe085('0x18')]('GetOpenchannelQueue',_0x165812[_0xe085('0x19')],_0x4585f1);_0x368e2d(_0x8bf98d['error'](0x1f4,_0x165812[_0xe085('0x19')]));});});};exports[_0xe085('0x26')]=function(_0xb1994){var _0x5f34ce=this;return new Promise(function(_0x2e239a,_0x5c6172){return db[_0xe085('0x1c')][_0xe085('0x27')]({'raw':_0xb1994[_0xe085('0x1e')]?_0xb1994[_0xe085('0x1e')][_0xe085('0x1f')]===undefined?!![]:![]:!![],'where':_0xb1994[_0xe085('0x1e')]?_0xb1994[_0xe085('0x1e')][_0xe085('0x28')]||null:null,'attributes':_0xb1994[_0xe085('0x1e')]?_0xb1994[_0xe085('0x1e')][_0xe085('0x20')]||null:null,'include':_0xb1994['options']?_0xb1994[_0xe085('0x1e')][_0xe085('0x22')]?_[_0xe085('0x23')](_0xb1994[_0xe085('0x1e')][_0xe085('0x22')],function(_0x23fb22){return{'model':db[_0x23fb22[_0xe085('0x24')]],'as':_0x23fb22['as'],'attributes':_0x23fb22[_0xe085('0x20')],'include':_0x23fb22[_0xe085('0x22')]?_[_0xe085('0x23')](_0x23fb22[_0xe085('0x22')],function(_0x41e7d4){return{'model':db[_0x41e7d4[_0xe085('0x24')]],'as':_0x41e7d4['as'],'attributes':_0x41e7d4[_0xe085('0x20')],'include':_0x41e7d4[_0xe085('0x22')]?_[_0xe085('0x23')](_0x41e7d4[_0xe085('0x22')],function(_0x57fc82){return{'model':db[_0x57fc82[_0xe085('0x24')]],'as':_0x57fc82['as'],'attributes':_0x57fc82['attributes']};}):[]};}):[]};}):[]:[]})[_0xe085('0x12')](function(_0x59d1d6){logger[_0xe085('0x13')]('ShowOpenchannelQueue',_0xb1994);logger[_0xe085('0x29')](_0xe085('0x26'),_0xb1994,JSON[_0xe085('0x17')](_0x59d1d6));_0x2e239a(_0x59d1d6);})[_0xe085('0x1b')](function(_0x298937){logger[_0xe085('0x18')]('ShowOpenchannelQueue',_0x298937[_0xe085('0x19')],_0xb1994);_0x5c6172(_0x5f34ce[_0xe085('0x18')](0x1f4,_0x298937['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 552af47..259afbf 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 _0x3029=['./openchannelQueue.events','save','remove','update','emit','removeListener','register','length'];(function(_0xb76aa,_0x5b09f4){var _0x5c02d0=function(_0x224c48){while(--_0x224c48){_0xb76aa['push'](_0xb76aa['shift']());}};_0x5c02d0(++_0x5b09f4);}(_0x3029,0x130));var _0x9302=function(_0x26cf90,_0x50702d){_0x26cf90=_0x26cf90-0x0;var _0x3e13f6=_0x3029[_0x26cf90];return _0x3e13f6;};'use strict';var OpenchannelQueueEvents=require(_0x9302('0x0'));var events=[_0x9302('0x1'),_0x9302('0x2'),_0x9302('0x3')];function createListener(_0x752ffa,_0x158978){return function(_0x35f470){_0x158978[_0x9302('0x4')](_0x752ffa,_0x35f470);};}function removeListener(_0x2291b2,_0x2ac106){return function(){OpenchannelQueueEvents[_0x9302('0x5')](_0x2291b2,_0x2ac106);};}exports[_0x9302('0x6')]=function(_0x29947a){for(var _0x5cac7d=0x0,_0x46691f=events[_0x9302('0x7')];_0x5cac7d<_0x46691f;_0x5cac7d++){var _0x2474e9=events[_0x5cac7d];var _0x19f064=createListener('openchannelQueue:'+_0x2474e9,_0x29947a);OpenchannelQueueEvents['on'](_0x2474e9,_0x19f064);}}; \ No newline at end of file +var _0xe38d=['emit','removeListener','register','openchannelQueue:','./openchannelQueue.events','save','remove','update'];(function(_0x86d828,_0x16f54){var _0x3aba37=function(_0x47faa6){while(--_0x47faa6){_0x86d828['push'](_0x86d828['shift']());}};_0x3aba37(++_0x16f54);}(_0xe38d,0x18c));var _0xde38=function(_0x2d3d90,_0x46d248){_0x2d3d90=_0x2d3d90-0x0;var _0x3f7481=_0xe38d[_0x2d3d90];return _0x3f7481;};'use strict';var OpenchannelQueueEvents=require(_0xde38('0x0'));var events=[_0xde38('0x1'),_0xde38('0x2'),_0xde38('0x3')];function createListener(_0x2070b3,_0x514df0){return function(_0x3a3118){_0x514df0[_0xde38('0x4')](_0x2070b3,_0x3a3118);};}function removeListener(_0x193baf,_0x44b908){return function(){OpenchannelQueueEvents[_0xde38('0x5')](_0x193baf,_0x44b908);};}exports[_0xde38('0x6')]=function(_0x11df93){for(var _0x199129=0x0,_0x2d8a97=events['length'];_0x199129<_0x2d8a97;_0x199129++){var _0x50adc5=events[_0x199129];var _0x43b660=createListener(_0xde38('0x7')+_0x50adc5,_0x11df93);OpenchannelQueueEvents['on'](_0x50adc5,_0x43b660);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index a942000..89f355d 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 _0x63a6=['update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','post','put'];(function(_0x51f0f3,_0x1bba2d){var _0x276e8d=function(_0x6554d9){while(--_0x6554d9){_0x51f0f3['push'](_0x51f0f3['shift']());}};_0x276e8d(++_0x1bba2d);}(_0x63a6,0xf3));var _0x663a=function(_0x1ff085,_0xa5d361){_0x1ff085=_0x1ff085-0x0;var _0x229856=_0x63a6[_0x1ff085];return _0x229856;};'use strict';var multer=require(_0x663a('0x0'));var util=require(_0x663a('0x1'));var path=require(_0x663a('0x2'));var timeout=require('connect-timeout');var express=require(_0x663a('0x3'));var router=express[_0x663a('0x4')]();var fs_extra=require(_0x663a('0x5'));var auth=require(_0x663a('0x6'));var interaction=require(_0x663a('0x7'));var config=require(_0x663a('0x8'));var controller=require('./openchannelQueueReport.controller');router[_0x663a('0x9')]('/',auth[_0x663a('0xa')](),controller[_0x663a('0xb')]);router['get'](_0x663a('0xc'),auth[_0x663a('0xa')](),controller['describe']);router[_0x663a('0x9')](_0x663a('0xd'),auth['isAuthenticated'](),controller[_0x663a('0xe')]);router[_0x663a('0xf')]('/',auth[_0x663a('0xa')](),controller['create']);router[_0x663a('0x10')](_0x663a('0xd'),auth[_0x663a('0xa')](),controller[_0x663a('0x11')]);router['delete'](_0x663a('0xd'),auth['isAuthenticated'](),controller[_0x663a('0x12')]);module[_0x663a('0x13')]=router; \ No newline at end of file +var _0xa72b=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelQueueReport.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','destroy','multer','util'];(function(_0x4ab99,_0x219ed2){var _0x29e39c=function(_0x2dd986){while(--_0x2dd986){_0x4ab99['push'](_0x4ab99['shift']());}};_0x29e39c(++_0x219ed2);}(_0xa72b,0x1c6));var _0xba72=function(_0x389199,_0x40d67e){_0x389199=_0x389199-0x0;var _0x35f279=_0xa72b[_0x389199];return _0x35f279;};'use strict';var multer=require(_0xba72('0x0'));var util=require(_0xba72('0x1'));var path=require(_0xba72('0x2'));var timeout=require(_0xba72('0x3'));var express=require(_0xba72('0x4'));var router=express[_0xba72('0x5')]();var fs_extra=require(_0xba72('0x6'));var auth=require(_0xba72('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xba72('0x8'));router[_0xba72('0x9')]('/',auth[_0xba72('0xa')](),controller[_0xba72('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0xba72('0xa')](),controller[_0xba72('0xc')]);router[_0xba72('0xd')]('/',auth[_0xba72('0xa')](),controller[_0xba72('0xe')]);router[_0xba72('0xf')](_0xba72('0x10'),auth[_0xba72('0xa')](),controller[_0xba72('0x11')]);router['delete'](_0xba72('0x10'),auth[_0xba72('0xa')](),controller[_0xba72('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index f5d8188..f1e0dfa 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 _0x15a8=['sequelize','exports','STRING','DATE','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x15a8,0x6d));var _0x815a=function(_0x370572,_0x3aa200){_0x370572=_0x370572-0x0;var _0x5c5390=_0x15a8[_0x370572];return _0x5c5390;};'use strict';var moment=require(_0x815a('0x0'));var Sequelize=require(_0x815a('0x1'));module[_0x815a('0x2')]={'uniqueid':{'type':Sequelize[_0x815a('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x815a('0x3')]},'joinAt':{'type':Sequelize[_0x815a('0x4')]},'leaveAt':{'type':Sequelize[_0x815a('0x4')]},'acceptAt':{'type':Sequelize[_0x815a('0x4')]},'exitAt':{'type':Sequelize[_0x815a('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd6eb=['DATE','moment','sequelize','STRING'];(function(_0x1f239e,_0x367b43){var _0x826971=function(_0x2c5777){while(--_0x2c5777){_0x1f239e['push'](_0x1f239e['shift']());}};_0x826971(++_0x367b43);}(_0xd6eb,0x18d));var _0xbd6e=function(_0x590970,_0x301de3){_0x590970=_0x590970-0x0;var _0x26b905=_0xd6eb[_0x590970];return _0x26b905;};'use strict';var moment=require(_0xbd6e('0x0'));var Sequelize=require(_0xbd6e('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbd6e('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xbd6e('0x2')]},'joinAt':{'type':Sequelize[_0xbd6e('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xbd6e('0x3')]},'reason':{'type':Sequelize[_0xbd6e('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 9ad5a64..102f2cc 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 _0xd025=['count','set','Content-Range','json','save','update','then','destroy','error','stack','name','send','index','map','OpenchannelQueueReport','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','merge','rows','catch','show','params','includeAll','include','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit'];(function(_0x594439,_0x606806){var _0x580141=function(_0x38c8de){while(--_0x38c8de){_0x594439['push'](_0x594439['shift']());}};_0x580141(++_0x606806);}(_0xd025,0x6b));var _0x5d02=function(_0x273b37,_0x1c9138){_0x273b37=_0x273b37-0x0;var _0x10737e=_0xd025[_0x273b37];return _0x10737e;};'use strict';var emlformat=require(_0x5d02('0x0'));var rimraf=require(_0x5d02('0x1'));var zipdir=require(_0x5d02('0x2'));var jsonpatch=require(_0x5d02('0x3'));var rp=require('request-promise');var moment=require(_0x5d02('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5d02('0x5'));var path=require(_0x5d02('0x6'));var sox=require(_0x5d02('0x7'));var csv=require(_0x5d02('0x8'));var ejs=require(_0x5d02('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5d02('0xa'));var deskjs=require(_0x5d02('0xb'));var toCsv=require(_0x5d02('0x8'));var querystring=require('querystring');var Papa=require(_0x5d02('0xc'));var Redis=require('ioredis');var authService=require(_0x5d02('0xd'));var qs=require(_0x5d02('0xe'));var as=require(_0x5d02('0xf'));var hardwareService=require(_0x5d02('0x10'));var logger=require(_0x5d02('0x11'))('api');var utils=require(_0x5d02('0x12'));var config=require(_0x5d02('0x13'));var licenseUtil=require(_0x5d02('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x63a0ad,_0x4ed938){_0x4ed938=_0x4ed938||0xcc;return function(_0x4c26a0){if(_0x4c26a0){return _0x63a0ad[_0x5d02('0x15')](_0x4ed938);}return _0x63a0ad[_0x5d02('0x16')](_0x4ed938)[_0x5d02('0x17')]();};}function respondWithResult(_0x2fabc9,_0x3f1dac){_0x3f1dac=_0x3f1dac||0xc8;return function(_0x2956b8){if(_0x2956b8){return _0x2fabc9[_0x5d02('0x16')](_0x3f1dac)['json'](_0x2956b8);}};}function respondWithFilteredResult(_0x36c51b,_0x350c3a){return function(_0x4fe4ac){if(_0x4fe4ac){var _0x372b42=typeof _0x350c3a[_0x5d02('0x18')]===_0x5d02('0x19')&&typeof _0x350c3a[_0x5d02('0x1a')]===_0x5d02('0x19');var _0x495d18=_0x4fe4ac[_0x5d02('0x1b')];var _0x3e0619=_0x372b42?0x0:_0x350c3a['offset'];var _0xaf10a=_0x372b42?_0x4fe4ac[_0x5d02('0x1b')]:_0x350c3a[_0x5d02('0x18')]+_0x350c3a[_0x5d02('0x1a')];var _0x37ba59;if(_0xaf10a>=_0x495d18){_0xaf10a=_0x495d18;_0x37ba59=0xc8;}else{_0x37ba59=0xce;}_0x36c51b[_0x5d02('0x16')](_0x37ba59);return _0x36c51b[_0x5d02('0x1c')](_0x5d02('0x1d'),_0x3e0619+'-'+_0xaf10a+'/'+_0x495d18)[_0x5d02('0x1e')](_0x4fe4ac);}return null;};}function patchUpdates(_0x25d756){return function(_0x5cbc7c){try{jsonpatch['apply'](_0x5cbc7c,_0x25d756,!![]);}catch(_0x36294f){return BPromise['reject'](_0x36294f);}return _0x5cbc7c[_0x5d02('0x1f')]();};}function saveUpdates(_0x2993cd,_0x1341f4){return function(_0x3cb0b3){if(_0x3cb0b3){return _0x3cb0b3[_0x5d02('0x20')](_0x2993cd)[_0x5d02('0x21')](function(_0x36bac9){return _0x36bac9;});}return null;};}function removeEntity(_0x5b0416,_0x29e2b2){return function(_0x2cb684){if(_0x2cb684){return _0x2cb684[_0x5d02('0x22')]()[_0x5d02('0x21')](function(){_0x5b0416[_0x5d02('0x16')](0xcc)[_0x5d02('0x17')]();});}};}function handleEntityNotFound(_0x1fff29,_0x1a94ed){return function(_0x10c481){if(!_0x10c481){_0x1fff29[_0x5d02('0x15')](0x194);}return _0x10c481;};}function handleError(_0x221acf,_0x22b4bf){_0x22b4bf=_0x22b4bf||0x1f4;return function(_0x5451a){logger[_0x5d02('0x23')](_0x5451a[_0x5d02('0x24')]);if(_0x5451a[_0x5d02('0x25')]){delete _0x5451a[_0x5d02('0x25')];}_0x221acf['status'](_0x22b4bf)[_0x5d02('0x26')](_0x5451a);};}exports[_0x5d02('0x27')]=function(_0x5d4ced,_0x38d136){var _0x345e91={},_0x172fbb={},_0x1b13f7={'count':0x0,'rows':[]};var _0x174e79=_[_0x5d02('0x28')](db[_0x5d02('0x29')]['rawAttributes'],function(_0x4a0582){return{'name':_0x4a0582[_0x5d02('0x2a')],'type':_0x4a0582['type'][_0x5d02('0x2b')]};});_0x172fbb[_0x5d02('0x2c')]=_['map'](_0x174e79,_0x5d02('0x25'));_0x172fbb[_0x5d02('0x2d')]=_[_0x5d02('0x2e')](_0x5d4ced['query']);_0x172fbb[_0x5d02('0x2f')]=_[_0x5d02('0x30')](_0x172fbb[_0x5d02('0x2c')],_0x172fbb[_0x5d02('0x2d')]);_0x345e91[_0x5d02('0x31')]=_['intersection'](_0x172fbb[_0x5d02('0x2c')],qs[_0x5d02('0x32')](_0x5d4ced['query'][_0x5d02('0x32')]));_0x345e91['attributes']=_0x345e91[_0x5d02('0x31')][_0x5d02('0x33')]?_0x345e91['attributes']:_0x172fbb[_0x5d02('0x2c')];if(!_0x5d4ced[_0x5d02('0x2d')][_0x5d02('0x34')]('nolimit')){_0x345e91[_0x5d02('0x1a')]=qs[_0x5d02('0x1a')](_0x5d4ced['query'][_0x5d02('0x1a')]);_0x345e91[_0x5d02('0x18')]=qs[_0x5d02('0x18')](_0x5d4ced['query'][_0x5d02('0x18')]);}_0x345e91['order']=qs[_0x5d02('0x35')](_0x5d4ced[_0x5d02('0x2d')][_0x5d02('0x35')]);_0x345e91['where']=qs[_0x5d02('0x2f')](_[_0x5d02('0x36')](_0x5d4ced[_0x5d02('0x2d')],_0x172fbb['filters']),_0x174e79);if(_0x5d4ced[_0x5d02('0x2d')][_0x5d02('0x37')]){_0x345e91[_0x5d02('0x38')]=_[_0x5d02('0x39')](_0x345e91[_0x5d02('0x38')],{'$or':_[_0x5d02('0x28')](_0x174e79,function(_0x74bf74){if(_0x74bf74['type']!=='VIRTUAL'){var _0x248f27={};_0x248f27[_0x74bf74[_0x5d02('0x25')]]={'$like':'%'+_0x5d4ced[_0x5d02('0x2d')][_0x5d02('0x37')]+'%'};return _0x248f27;}})});}_0x345e91=_[_0x5d02('0x39')]({},_0x345e91,_0x5d4ced['options']);var _0x2a6e5f={'where':_0x345e91[_0x5d02('0x38')]};return db['OpenchannelQueueReport'][_0x5d02('0x1b')](_0x2a6e5f)[_0x5d02('0x21')](function(_0x3f441e){_0x1b13f7[_0x5d02('0x1b')]=_0x3f441e;if(_0x5d4ced[_0x5d02('0x2d')]['includeAll']){_0x345e91['include']=[{'all':!![]}];}return db[_0x5d02('0x29')]['findAll'](_0x345e91);})[_0x5d02('0x21')](function(_0x227a08){_0x1b13f7[_0x5d02('0x3a')]=_0x227a08;return _0x1b13f7;})[_0x5d02('0x21')](respondWithFilteredResult(_0x38d136,_0x345e91))[_0x5d02('0x3b')](handleError(_0x38d136,null));};exports[_0x5d02('0x3c')]=function(_0x1b2e92,_0x4afef4){var _0xe00a32={'raw':!![],'where':{'id':_0x1b2e92[_0x5d02('0x3d')]['id']}},_0x78f465={};_0x78f465[_0x5d02('0x2c')]=_[_0x5d02('0x2e')](db[_0x5d02('0x29')]['rawAttributes']);_0x78f465[_0x5d02('0x2d')]=_[_0x5d02('0x2e')](_0x1b2e92[_0x5d02('0x2d')]);_0x78f465[_0x5d02('0x2f')]=_[_0x5d02('0x30')](_0x78f465['model'],_0x78f465[_0x5d02('0x2d')]);_0xe00a32[_0x5d02('0x31')]=_[_0x5d02('0x30')](_0x78f465[_0x5d02('0x2c')],qs['fields'](_0x1b2e92[_0x5d02('0x2d')][_0x5d02('0x32')]));_0xe00a32[_0x5d02('0x31')]=_0xe00a32[_0x5d02('0x31')][_0x5d02('0x33')]?_0xe00a32['attributes']:_0x78f465[_0x5d02('0x2c')];if(_0x1b2e92[_0x5d02('0x2d')][_0x5d02('0x3e')]){_0xe00a32[_0x5d02('0x3f')]=[{'all':!![]}];}_0xe00a32=_[_0x5d02('0x39')]({},_0xe00a32,_0x1b2e92['options']);return db[_0x5d02('0x29')]['find'](_0xe00a32)[_0x5d02('0x21')](handleEntityNotFound(_0x4afef4,null))[_0x5d02('0x21')](respondWithResult(_0x4afef4,null))[_0x5d02('0x3b')](handleError(_0x4afef4,null));};exports[_0x5d02('0x40')]=function(_0x516c2c,_0x46e9db){return db[_0x5d02('0x29')][_0x5d02('0x40')](_0x516c2c[_0x5d02('0x41')],{})[_0x5d02('0x21')](respondWithResult(_0x46e9db,0xc9))['catch'](handleError(_0x46e9db,null));};exports['update']=function(_0x328dca,_0x1c2a2e){if(_0x328dca['body']['id']){delete _0x328dca[_0x5d02('0x41')]['id'];}return db['OpenchannelQueueReport']['find']({'where':{'id':_0x328dca[_0x5d02('0x3d')]['id']}})[_0x5d02('0x21')](handleEntityNotFound(_0x1c2a2e,null))[_0x5d02('0x21')](saveUpdates(_0x328dca[_0x5d02('0x41')],null))[_0x5d02('0x21')](respondWithResult(_0x1c2a2e,null))[_0x5d02('0x3b')](handleError(_0x1c2a2e,null));};exports[_0x5d02('0x22')]=function(_0x2f1301,_0x38286e){return db[_0x5d02('0x29')]['find']({'where':{'id':_0x2f1301[_0x5d02('0x3d')]['id']}})[_0x5d02('0x21')](handleEntityNotFound(_0x38286e,null))[_0x5d02('0x21')](removeEntity(_0x38286e,null))[_0x5d02('0x3b')](handleError(_0x38286e,null));};exports[_0x5d02('0x42')]=function(_0x3f1101,_0x2fcf5f){return db[_0x5d02('0x29')][_0x5d02('0x42')]()[_0x5d02('0x21')](respondWithResult(_0x2fcf5f,null))[_0x5d02('0x3b')](handleError(_0x2fcf5f,null));}; \ No newline at end of file +var _0xa6d7=['rows','params','catch','create','body','find','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','OpenchannelQueueReport','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','options','includeAll','include','findAll'];(function(_0x36fe55,_0x75f5d){var _0x2701e4=function(_0xce9362){while(--_0xce9362){_0x36fe55['push'](_0x36fe55['shift']());}};_0x2701e4(++_0x75f5d);}(_0xa6d7,0xee));var _0x7a6d=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa6d7[_0x9aada2];return _0x196dff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7a6d('0x0'));var zipdir=require(_0x7a6d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7a6d('0x2'));var moment=require(_0x7a6d('0x3'));var BPromise=require(_0x7a6d('0x4'));var Mustache=require(_0x7a6d('0x5'));var util=require(_0x7a6d('0x6'));var path=require(_0x7a6d('0x7'));var sox=require(_0x7a6d('0x8'));var csv=require('to-csv');var ejs=require(_0x7a6d('0x9'));var fs=require('fs');var fs_extra=require(_0x7a6d('0xa'));var _=require(_0x7a6d('0xb'));var squel=require('squel');var crypto=require(_0x7a6d('0xc'));var jsforce=require(_0x7a6d('0xd'));var deskjs=require(_0x7a6d('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7a6d('0xf'));var Redis=require(_0x7a6d('0x10'));var authService=require(_0x7a6d('0x11'));var qs=require(_0x7a6d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7a6d('0x13'));var logger=require(_0x7a6d('0x14'))(_0x7a6d('0x15'));var utils=require(_0x7a6d('0x16'));var config=require(_0x7a6d('0x17'));var licenseUtil=require(_0x7a6d('0x18'));var db=require(_0x7a6d('0x19'))['db'];function respondWithStatusCode(_0x37c893,_0x4fd83e){_0x4fd83e=_0x4fd83e||0xcc;return function(_0x4228e5){if(_0x4228e5){return _0x37c893[_0x7a6d('0x1a')](_0x4fd83e);}return _0x37c893[_0x7a6d('0x1b')](_0x4fd83e)['end']();};}function respondWithResult(_0x58bba3,_0x14bce6){_0x14bce6=_0x14bce6||0xc8;return function(_0x3b1e3d){if(_0x3b1e3d){return _0x58bba3[_0x7a6d('0x1b')](_0x14bce6)[_0x7a6d('0x1c')](_0x3b1e3d);}};}function respondWithFilteredResult(_0x102b94,_0x3e150f){return function(_0x576e08){if(_0x576e08){var _0x431143=typeof _0x3e150f[_0x7a6d('0x1d')]==='undefined'&&typeof _0x3e150f[_0x7a6d('0x1e')]===_0x7a6d('0x1f');var _0x308e0d=_0x576e08['count'];var _0x3c6a3d=_0x431143?0x0:_0x3e150f[_0x7a6d('0x1d')];var _0x59c35c=_0x431143?_0x576e08[_0x7a6d('0x20')]:_0x3e150f[_0x7a6d('0x1d')]+_0x3e150f['limit'];var _0x4049de;if(_0x59c35c>=_0x308e0d){_0x59c35c=_0x308e0d;_0x4049de=0xc8;}else{_0x4049de=0xce;}_0x102b94[_0x7a6d('0x1b')](_0x4049de);return _0x102b94[_0x7a6d('0x21')]('Content-Range',_0x3c6a3d+'-'+_0x59c35c+'/'+_0x308e0d)[_0x7a6d('0x1c')](_0x576e08);}return null;};}function patchUpdates(_0x2ce20e){return function(_0x439d6e){try{jsonpatch[_0x7a6d('0x22')](_0x439d6e,_0x2ce20e,!![]);}catch(_0x2ddb71){return BPromise[_0x7a6d('0x23')](_0x2ddb71);}return _0x439d6e[_0x7a6d('0x24')]();};}function saveUpdates(_0x5ba35a,_0xa43072){return function(_0x37cbc0){if(_0x37cbc0){return _0x37cbc0[_0x7a6d('0x25')](_0x5ba35a)[_0x7a6d('0x26')](function(_0x39d647){return _0x39d647;});}return null;};}function removeEntity(_0x1b9ef3,_0x2ca505){return function(_0x4529ba){if(_0x4529ba){return _0x4529ba[_0x7a6d('0x27')]()[_0x7a6d('0x26')](function(){_0x1b9ef3['status'](0xcc)[_0x7a6d('0x28')]();});}};}function handleEntityNotFound(_0x49a9e0,_0x2865c4){return function(_0x3dd5e4){if(!_0x3dd5e4){_0x49a9e0[_0x7a6d('0x1a')](0x194);}return _0x3dd5e4;};}function handleError(_0x2198eb,_0xb10a62){_0xb10a62=_0xb10a62||0x1f4;return function(_0x8bb935){logger[_0x7a6d('0x29')](_0x8bb935[_0x7a6d('0x2a')]);if(_0x8bb935['name']){delete _0x8bb935[_0x7a6d('0x2b')];}_0x2198eb['status'](_0xb10a62)[_0x7a6d('0x2c')](_0x8bb935);};}exports[_0x7a6d('0x2d')]=function(_0x157710,_0x340321){var _0xd9a40f={},_0x178f1c={},_0x18935e={'count':0x0,'rows':[]};var _0x5b75e1=_['map'](db[_0x7a6d('0x2e')][_0x7a6d('0x2f')],function(_0x3b8b63){return{'name':_0x3b8b63[_0x7a6d('0x30')],'type':_0x3b8b63[_0x7a6d('0x31')][_0x7a6d('0x32')]};});_0x178f1c['model']=_[_0x7a6d('0x33')](_0x5b75e1,'name');_0x178f1c[_0x7a6d('0x34')]=_[_0x7a6d('0x35')](_0x157710[_0x7a6d('0x34')]);_0x178f1c[_0x7a6d('0x36')]=_[_0x7a6d('0x37')](_0x178f1c[_0x7a6d('0x38')],_0x178f1c['query']);_0xd9a40f[_0x7a6d('0x39')]=_[_0x7a6d('0x37')](_0x178f1c[_0x7a6d('0x38')],qs[_0x7a6d('0x3a')](_0x157710[_0x7a6d('0x34')][_0x7a6d('0x3a')]));_0xd9a40f['attributes']=_0xd9a40f['attributes'][_0x7a6d('0x3b')]?_0xd9a40f['attributes']:_0x178f1c[_0x7a6d('0x38')];if(!_0x157710[_0x7a6d('0x34')][_0x7a6d('0x3c')]('nolimit')){_0xd9a40f['limit']=qs[_0x7a6d('0x1e')](_0x157710[_0x7a6d('0x34')][_0x7a6d('0x1e')]);_0xd9a40f[_0x7a6d('0x1d')]=qs[_0x7a6d('0x1d')](_0x157710[_0x7a6d('0x34')][_0x7a6d('0x1d')]);}_0xd9a40f[_0x7a6d('0x3d')]=qs[_0x7a6d('0x3e')](_0x157710[_0x7a6d('0x34')][_0x7a6d('0x3e')]);_0xd9a40f['where']=qs[_0x7a6d('0x36')](_[_0x7a6d('0x3f')](_0x157710[_0x7a6d('0x34')],_0x178f1c['filters']),_0x5b75e1);if(_0x157710[_0x7a6d('0x34')][_0x7a6d('0x40')]){_0xd9a40f['where']=_[_0x7a6d('0x41')](_0xd9a40f['where'],{'$or':_[_0x7a6d('0x33')](_0x5b75e1,function(_0xc9bdcc){if(_0xc9bdcc[_0x7a6d('0x31')]!=='VIRTUAL'){var _0x58360b={};_0x58360b[_0xc9bdcc[_0x7a6d('0x2b')]]={'$like':'%'+_0x157710['query'][_0x7a6d('0x40')]+'%'};return _0x58360b;}})});}_0xd9a40f=_[_0x7a6d('0x41')]({},_0xd9a40f,_0x157710[_0x7a6d('0x42')]);var _0xa6ab65={'where':_0xd9a40f['where']};return db['OpenchannelQueueReport'][_0x7a6d('0x20')](_0xa6ab65)['then'](function(_0x395126){_0x18935e[_0x7a6d('0x20')]=_0x395126;if(_0x157710[_0x7a6d('0x34')][_0x7a6d('0x43')]){_0xd9a40f[_0x7a6d('0x44')]=[{'all':!![]}];}return db[_0x7a6d('0x2e')][_0x7a6d('0x45')](_0xd9a40f);})[_0x7a6d('0x26')](function(_0x422b80){_0x18935e[_0x7a6d('0x46')]=_0x422b80;return _0x18935e;})['then'](respondWithFilteredResult(_0x340321,_0xd9a40f))['catch'](handleError(_0x340321,null));};exports['show']=function(_0x23eaa2,_0x357df9){var _0x216a61={'raw':!![],'where':{'id':_0x23eaa2[_0x7a6d('0x47')]['id']}},_0x1a2b89={};_0x1a2b89[_0x7a6d('0x38')]=_[_0x7a6d('0x35')](db[_0x7a6d('0x2e')]['rawAttributes']);_0x1a2b89['query']=_[_0x7a6d('0x35')](_0x23eaa2[_0x7a6d('0x34')]);_0x1a2b89[_0x7a6d('0x36')]=_[_0x7a6d('0x37')](_0x1a2b89[_0x7a6d('0x38')],_0x1a2b89['query']);_0x216a61[_0x7a6d('0x39')]=_['intersection'](_0x1a2b89[_0x7a6d('0x38')],qs['fields'](_0x23eaa2[_0x7a6d('0x34')][_0x7a6d('0x3a')]));_0x216a61[_0x7a6d('0x39')]=_0x216a61[_0x7a6d('0x39')][_0x7a6d('0x3b')]?_0x216a61[_0x7a6d('0x39')]:_0x1a2b89[_0x7a6d('0x38')];if(_0x23eaa2[_0x7a6d('0x34')][_0x7a6d('0x43')]){_0x216a61['include']=[{'all':!![]}];}_0x216a61=_[_0x7a6d('0x41')]({},_0x216a61,_0x23eaa2[_0x7a6d('0x42')]);return db[_0x7a6d('0x2e')]['find'](_0x216a61)['then'](handleEntityNotFound(_0x357df9,null))[_0x7a6d('0x26')](respondWithResult(_0x357df9,null))[_0x7a6d('0x48')](handleError(_0x357df9,null));};exports[_0x7a6d('0x49')]=function(_0x110b6f,_0x498e04){return db[_0x7a6d('0x2e')]['create'](_0x110b6f[_0x7a6d('0x4a')],{})[_0x7a6d('0x26')](respondWithResult(_0x498e04,0xc9))[_0x7a6d('0x48')](handleError(_0x498e04,null));};exports[_0x7a6d('0x25')]=function(_0x4a0b6d,_0x511efe){if(_0x4a0b6d[_0x7a6d('0x4a')]['id']){delete _0x4a0b6d['body']['id'];}return db[_0x7a6d('0x2e')][_0x7a6d('0x4b')]({'where':{'id':_0x4a0b6d[_0x7a6d('0x47')]['id']}})[_0x7a6d('0x26')](handleEntityNotFound(_0x511efe,null))[_0x7a6d('0x26')](saveUpdates(_0x4a0b6d[_0x7a6d('0x4a')],null))[_0x7a6d('0x26')](respondWithResult(_0x511efe,null))['catch'](handleError(_0x511efe,null));};exports[_0x7a6d('0x27')]=function(_0x1e112d,_0x248c9c){return db[_0x7a6d('0x2e')]['find']({'where':{'id':_0x1e112d['params']['id']}})['then'](handleEntityNotFound(_0x248c9c,null))['then'](removeEntity(_0x248c9c,null))[_0x7a6d('0x48')](handleError(_0x248c9c,null));};exports[_0x7a6d('0x4c')]=function(_0x597eaf,_0x5992f7){return db[_0x7a6d('0x2e')]['describe']()['then'](respondWithResult(_0x5992f7,null))[_0x7a6d('0x48')](handleError(_0x5992f7,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index aa674b4..263c56a 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 _0xc4aa=['bluebird','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','../../config/logger','api','moment'];(function(_0x356a31,_0x3e195b){var _0x385b6f=function(_0x44ee52){while(--_0x44ee52){_0x356a31['push'](_0x356a31['shift']());}};_0x385b6f(++_0x3e195b);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xc4aa[_0x88cd7b];return _0x56fcc8;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','../../config/logger','api','moment'];(function(_0x3da0a0,_0x2dba6b){var _0x49d2ed=function(_0x112621){while(--_0x112621){_0x3da0a0['push'](_0x3da0a0['shift']());}};_0x49d2ed(++_0x2dba6b);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xc4aa[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index e5b63c9..136766e 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 _0x8f4c=['request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','update','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','OpenchannelQueueReport,\x20%s,\x20%s'];(function(_0x2bd559,_0x14f665){var _0x450220=function(_0x19680e){while(--_0x19680e){_0x2bd559['push'](_0x2bd559['shift']());}};_0x450220(++_0x14f665);}(_0x8f4c,0x113));var _0xc8f4=function(_0xd4dfdd,_0x1118ff){_0xd4dfdd=_0xd4dfdd-0x0;var _0x37264f=_0x8f4c[_0xd4dfdd];return _0x37264f;};'use strict';var _=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var moment=require(_0xc8f4('0x2'));var BPromise=require(_0xc8f4('0x3'));var rs=require(_0xc8f4('0x4'));var fs=require('fs');var Redis=require(_0xc8f4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc8f4('0x6'));var logger=require(_0xc8f4('0x7'))(_0xc8f4('0x8'));var config=require('../../config/environment');var jayson=require(_0xc8f4('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x520063,_0x373506,_0x48c39d){return new BPromise(function(_0x3ea9a2,_0x3a9ab1){return client[_0xc8f4('0xa')](_0x520063,_0x48c39d)[_0xc8f4('0xb')](function(_0x34f05f){logger['info'](_0xc8f4('0xc'),_0x373506,_0xc8f4('0xd'));logger[_0xc8f4('0xe')](_0xc8f4('0xf'),_0x373506,'request\x20sent',JSON[_0xc8f4('0x10')](_0x34f05f));if(_0x34f05f['error']){if(_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x12')]===0x1f4){logger[_0xc8f4('0x11')](_0xc8f4('0xc'),_0x373506,_0x34f05f[_0xc8f4('0x11')]['message']);return _0x3a9ab1(_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x13')]);}logger[_0xc8f4('0x11')](_0xc8f4('0xc'),_0x373506,_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x13')]);return _0x3ea9a2(_0x34f05f['error'][_0xc8f4('0x13')]);}else{logger[_0xc8f4('0x14')](_0xc8f4('0xc'),_0x373506,_0xc8f4('0xd'));_0x3ea9a2(_0x34f05f[_0xc8f4('0x15')]['message']);}})[_0xc8f4('0x16')](function(_0x4d2b77){logger['error'](_0xc8f4('0xc'),_0x373506,_0x4d2b77);_0x3a9ab1(_0x4d2b77);});});}exports[_0xc8f4('0x17')]=function(_0x108076){var _0x7bb973=this;return new Promise(function(_0x4763c1,_0x374761){return db[_0xc8f4('0x18')][_0xc8f4('0x19')](_0x108076[_0xc8f4('0x1a')],{'raw':_0x108076[_0xc8f4('0x1b')]?_0x108076[_0xc8f4('0x1b')][_0xc8f4('0x1c')]===undefined?!![]:![]:!![]})[_0xc8f4('0xb')](function(_0x5f3264){logger[_0xc8f4('0x14')](_0xc8f4('0x17'),_0x108076);logger[_0xc8f4('0xe')](_0xc8f4('0x17'),_0x108076,JSON[_0xc8f4('0x10')](_0x5f3264));_0x4763c1(_0x5f3264);})[_0xc8f4('0x16')](function(_0xaeee7d){logger[_0xc8f4('0x11')]('CreateOpenchannelQueueReport',_0xaeee7d[_0xc8f4('0x13')],_0x108076);_0x374761(_0x7bb973[_0xc8f4('0x11')](0x1f4,_0xaeee7d[_0xc8f4('0x13')]));});});};exports[_0xc8f4('0x1d')]=function(_0x5d54a9){var _0x39174f=this;return new Promise(function(_0x4a44e0,_0x3782fd){return db['OpenchannelQueueReport'][_0xc8f4('0x1e')](_0x5d54a9[_0xc8f4('0x1a')],{'raw':_0x5d54a9['options']?_0x5d54a9[_0xc8f4('0x1b')][_0xc8f4('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d54a9[_0xc8f4('0x1b')]?_0x5d54a9[_0xc8f4('0x1b')]['where']||null:null,'attributes':_0x5d54a9[_0xc8f4('0x1b')]?_0x5d54a9[_0xc8f4('0x1b')]['attributes']||null:null,'limit':_0x5d54a9[_0xc8f4('0x1b')]?_0x5d54a9[_0xc8f4('0x1b')][_0xc8f4('0x1f')]||null:null})[_0xc8f4('0xb')](function(_0x24bef0){logger[_0xc8f4('0x14')]('UpdateOpenchannelQueueReport',_0x5d54a9);logger[_0xc8f4('0xe')](_0xc8f4('0x1d'),_0x5d54a9,JSON[_0xc8f4('0x10')](_0x24bef0));_0x4a44e0(_0x24bef0);})['catch'](function(_0xf4a556){logger[_0xc8f4('0x11')]('UpdateOpenchannelQueueReport',_0xf4a556['message'],_0x5d54a9);_0x3782fd(_0x39174f['error'](0x1f4,_0xf4a556[_0xc8f4('0x13')]));});});}; \ No newline at end of file +var _0xb78e=['rpc','../../config/environment','client','http','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','update','where','limit','UpdateOpenchannelQueueReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x40aedc,_0x1b9558){var _0xb8ae66=function(_0x394e7d){while(--_0x394e7d){_0x40aedc['push'](_0x40aedc['shift']());}};_0xb8ae66(++_0x1b9558);}(_0xb78e,0x1c9));var _0xeb78=function(_0x4ed898,_0x3afdea){_0x4ed898=_0x4ed898-0x0;var _0x4e2b46=_0xb78e[_0x4ed898];return _0x4e2b46;};'use strict';var _=require(_0xeb78('0x0'));var util=require(_0xeb78('0x1'));var moment=require('moment');var BPromise=require(_0xeb78('0x2'));var rs=require(_0xeb78('0x3'));var fs=require('fs');var Redis=require(_0xeb78('0x4'));var db=require(_0xeb78('0x5'))['db'];var utils=require(_0xeb78('0x6'));var logger=require(_0xeb78('0x7'))(_0xeb78('0x8'));var config=require(_0xeb78('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xeb78('0xa')][_0xeb78('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ccc2f,_0x30c884,_0x2b7925){return new BPromise(function(_0x36963f,_0x5259aa){return client['request'](_0x1ccc2f,_0x2b7925)[_0xeb78('0xc')](function(_0x1c941d){logger[_0xeb78('0xd')](_0xeb78('0xe'),_0x30c884,_0xeb78('0xf'));logger[_0xeb78('0x10')](_0xeb78('0x11'),_0x30c884,_0xeb78('0xf'),JSON[_0xeb78('0x12')](_0x1c941d));if(_0x1c941d['error']){if(_0x1c941d[_0xeb78('0x13')][_0xeb78('0x14')]===0x1f4){logger[_0xeb78('0x13')](_0xeb78('0xe'),_0x30c884,_0x1c941d[_0xeb78('0x13')][_0xeb78('0x15')]);return _0x5259aa(_0x1c941d[_0xeb78('0x13')][_0xeb78('0x15')]);}logger[_0xeb78('0x13')](_0xeb78('0xe'),_0x30c884,_0x1c941d['error'][_0xeb78('0x15')]);return _0x36963f(_0x1c941d[_0xeb78('0x13')]['message']);}else{logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x30c884,_0xeb78('0xf'));_0x36963f(_0x1c941d['result'][_0xeb78('0x15')]);}})[_0xeb78('0x16')](function(_0x49123d){logger[_0xeb78('0x13')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x30c884,_0x49123d);_0x5259aa(_0x49123d);});});}exports[_0xeb78('0x17')]=function(_0x92e410){var _0x576802=this;return new Promise(function(_0x45176e,_0xb97756){return db[_0xeb78('0x18')]['create'](_0x92e410[_0xeb78('0x19')],{'raw':_0x92e410[_0xeb78('0x1a')]?_0x92e410['options']['raw']===undefined?!![]:![]:!![]})[_0xeb78('0xc')](function(_0x106c5d){logger[_0xeb78('0xd')](_0xeb78('0x17'),_0x92e410);logger[_0xeb78('0x10')](_0xeb78('0x17'),_0x92e410,JSON[_0xeb78('0x12')](_0x106c5d));_0x45176e(_0x106c5d);})[_0xeb78('0x16')](function(_0x18f08d){logger['error']('CreateOpenchannelQueueReport',_0x18f08d['message'],_0x92e410);_0xb97756(_0x576802['error'](0x1f4,_0x18f08d[_0xeb78('0x15')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x2159c1){var _0x1fbf2f=this;return new Promise(function(_0x566336,_0x777ca3){return db['OpenchannelQueueReport'][_0xeb78('0x1b')](_0x2159c1[_0xeb78('0x19')],{'raw':_0x2159c1[_0xeb78('0x1a')]?_0x2159c1[_0xeb78('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2159c1[_0xeb78('0x1a')]?_0x2159c1['options'][_0xeb78('0x1c')]||null:null,'attributes':_0x2159c1[_0xeb78('0x1a')]?_0x2159c1[_0xeb78('0x1a')]['attributes']||null:null,'limit':_0x2159c1[_0xeb78('0x1a')]?_0x2159c1[_0xeb78('0x1a')][_0xeb78('0x1d')]||null:null})[_0xeb78('0xc')](function(_0x3d4a97){logger[_0xeb78('0xd')](_0xeb78('0x1e'),_0x2159c1);logger[_0xeb78('0x10')](_0xeb78('0x1e'),_0x2159c1,JSON[_0xeb78('0x12')](_0x3d4a97));_0x566336(_0x3d4a97);})[_0xeb78('0x16')](function(_0x505468){logger['error']('UpdateOpenchannelQueueReport',_0x505468[_0xeb78('0x15')],_0x2159c1);_0x777ca3(_0x1fbf2f[_0xeb78('0x13')](0x1f4,_0x505468[_0xeb78('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 7142521..b898000 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 _0xfe52=['../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','create','put','/:id','update','destroy','util','path','connect-timeout','express','fs-extra'];(function(_0x4538a8,_0x500228){var _0x1fc73c=function(_0x5e9556){while(--_0x5e9556){_0x4538a8['push'](_0x4538a8['shift']());}};_0x1fc73c(++_0x500228);}(_0xfe52,0x113));var _0x2fe5=function(_0x1f7120,_0x53456a){_0x1f7120=_0x1f7120-0x0;var _0x512142=_0xfe52[_0x1f7120];return _0x512142;};'use strict';var multer=require('multer');var util=require(_0x2fe5('0x0'));var path=require(_0x2fe5('0x1'));var timeout=require(_0x2fe5('0x2'));var express=require(_0x2fe5('0x3'));var router=express['Router']();var fs_extra=require(_0x2fe5('0x4'));var auth=require(_0x2fe5('0x5'));var interaction=require(_0x2fe5('0x6'));var config=require(_0x2fe5('0x7'));var controller=require(_0x2fe5('0x8'));router[_0x2fe5('0x9')]('/',auth[_0x2fe5('0xa')](),controller[_0x2fe5('0xb')]);router[_0x2fe5('0x9')](_0x2fe5('0xc'),auth['isAuthenticated'](),controller[_0x2fe5('0xd')]);router[_0x2fe5('0x9')]('/:id',auth[_0x2fe5('0xa')](),controller[_0x2fe5('0xe')]);router['post']('/',auth[_0x2fe5('0xa')](),controller[_0x2fe5('0xf')]);router[_0x2fe5('0x10')](_0x2fe5('0x11'),auth[_0x2fe5('0xa')](),controller[_0x2fe5('0x12')]);router['delete'](_0x2fe5('0x11'),auth['isAuthenticated'](),controller[_0x2fe5('0x13')]);module['exports']=router; \ No newline at end of file +var _0x4743=['describe','show','post','create','put','/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x253b9a,_0x369587){var _0x60194b=function(_0x1f8835){while(--_0x1f8835){_0x253b9a['push'](_0x253b9a['shift']());}};_0x60194b(++_0x369587);}(_0x4743,0xe5));var _0x3474=function(_0x172bd2,_0x1b01e4){_0x172bd2=_0x172bd2-0x0;var _0x2530ec=_0x4743[_0x172bd2];return _0x2530ec;};'use strict';var multer=require('multer');var util=require(_0x3474('0x0'));var path=require(_0x3474('0x1'));var timeout=require(_0x3474('0x2'));var express=require(_0x3474('0x3'));var router=express[_0x3474('0x4')]();var fs_extra=require(_0x3474('0x5'));var auth=require(_0x3474('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3474('0x7'));var controller=require(_0x3474('0x8'));router[_0x3474('0x9')]('/',auth[_0x3474('0xa')](),controller[_0x3474('0xb')]);router['get'](_0x3474('0xc'),auth[_0x3474('0xa')](),controller[_0x3474('0xd')]);router[_0x3474('0x9')]('/:id',auth[_0x3474('0xa')](),controller[_0x3474('0xe')]);router[_0x3474('0xf')]('/',auth[_0x3474('0xa')](),controller[_0x3474('0x10')]);router[_0x3474('0x11')](_0x3474('0x12'),auth['isAuthenticated'](),controller[_0x3474('0x13')]);router[_0x3474('0x14')](_0x3474('0x12'),auth[_0x3474('0xa')](),controller['destroy']);module[_0x3474('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 5f48afc..42b950a 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x2e7f1e,_0x32f286){var _0x3dffa5=function(_0x920dc5){while(--_0x920dc5){_0x2e7f1e['push'](_0x2e7f1e['shift']());}};_0x3dffa5(++_0x32f286);}(_0x54ef,0x112));var _0xf54e=function(_0x58e92d,_0x3ce2d6){_0x58e92d=_0x58e92d-0x0;var _0x41263e=_0x54ef[_0x58e92d];return _0x41263e;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file +var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x42c903,_0x5c81bc){var _0xcfd717=function(_0x34fd31){while(--_0x34fd31){_0x42c903['push'](_0x42c903['shift']());}};_0xcfd717(++_0x5c81bc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 81b1d05..92ce32d 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 _0xe290=['count','offset','status','set','Content-Range','reject','save','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','OpenchannelTransferReport','then','includeAll','include','rows','show','params','options','catch','create','body','update','find','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','end','json','undefined','limit'];(function(_0x1427cf,_0x21c9e2){var _0x3a36cc=function(_0x6c74f9){while(--_0x6c74f9){_0x1427cf['push'](_0x1427cf['shift']());}};_0x3a36cc(++_0x21c9e2);}(_0xe290,0x10f));var _0x0e29=function(_0x1e5755,_0x5e0d48){_0x1e5755=_0x1e5755-0x0;var _0x38975b=_0xe290[_0x1e5755];return _0x38975b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0e29('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0e29('0x1'));var rp=require(_0x0e29('0x2'));var moment=require(_0x0e29('0x3'));var BPromise=require(_0x0e29('0x4'));var Mustache=require(_0x0e29('0x5'));var util=require(_0x0e29('0x6'));var path=require(_0x0e29('0x7'));var sox=require(_0x0e29('0x8'));var csv=require(_0x0e29('0x9'));var ejs=require(_0x0e29('0xa'));var fs=require('fs');var fs_extra=require(_0x0e29('0xb'));var _=require(_0x0e29('0xc'));var squel=require(_0x0e29('0xd'));var crypto=require(_0x0e29('0xe'));var jsforce=require(_0x0e29('0xf'));var deskjs=require(_0x0e29('0x10'));var toCsv=require('to-csv');var querystring=require(_0x0e29('0x11'));var Papa=require(_0x0e29('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0e29('0x13'));var as=require(_0x0e29('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0e29('0x15'))(_0x0e29('0x16'));var utils=require(_0x0e29('0x17'));var config=require(_0x0e29('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15d370,_0x1ddd43){_0x1ddd43=_0x1ddd43||0xcc;return function(_0x448613){if(_0x448613){return _0x15d370['sendStatus'](_0x1ddd43);}return _0x15d370['status'](_0x1ddd43)[_0x0e29('0x19')]();};}function respondWithResult(_0x33f3ce,_0x97213b){_0x97213b=_0x97213b||0xc8;return function(_0x84e8c5){if(_0x84e8c5){return _0x33f3ce['status'](_0x97213b)[_0x0e29('0x1a')](_0x84e8c5);}};}function respondWithFilteredResult(_0x13e85d,_0x51a4d5){return function(_0x1f7f47){if(_0x1f7f47){var _0x544c12=typeof _0x51a4d5['offset']===_0x0e29('0x1b')&&typeof _0x51a4d5[_0x0e29('0x1c')]===_0x0e29('0x1b');var _0x4be748=_0x1f7f47[_0x0e29('0x1d')];var _0x3a1beb=_0x544c12?0x0:_0x51a4d5['offset'];var _0x437f0e=_0x544c12?_0x1f7f47[_0x0e29('0x1d')]:_0x51a4d5[_0x0e29('0x1e')]+_0x51a4d5[_0x0e29('0x1c')];var _0x35e2bd;if(_0x437f0e>=_0x4be748){_0x437f0e=_0x4be748;_0x35e2bd=0xc8;}else{_0x35e2bd=0xce;}_0x13e85d[_0x0e29('0x1f')](_0x35e2bd);return _0x13e85d[_0x0e29('0x20')](_0x0e29('0x21'),_0x3a1beb+'-'+_0x437f0e+'/'+_0x4be748)['json'](_0x1f7f47);}return null;};}function patchUpdates(_0x48a153){return function(_0x18eec6){try{jsonpatch['apply'](_0x18eec6,_0x48a153,!![]);}catch(_0x3193ea){return BPromise[_0x0e29('0x22')](_0x3193ea);}return _0x18eec6[_0x0e29('0x23')]();};}function saveUpdates(_0x50e579,_0x5984ea){return function(_0x2ae8ec){if(_0x2ae8ec){return _0x2ae8ec['update'](_0x50e579)['then'](function(_0x2b8661){return _0x2b8661;});}return null;};}function removeEntity(_0xc96c5b,_0x253ae1){return function(_0x496053){if(_0x496053){return _0x496053[_0x0e29('0x24')]()['then'](function(){_0xc96c5b[_0x0e29('0x1f')](0xcc)[_0x0e29('0x19')]();});}};}function handleEntityNotFound(_0x2f4b12,_0x4c53bc){return function(_0x352e88){if(!_0x352e88){_0x2f4b12[_0x0e29('0x25')](0x194);}return _0x352e88;};}function handleError(_0x2f9199,_0x1c0a07){_0x1c0a07=_0x1c0a07||0x1f4;return function(_0x2a7e70){logger['error'](_0x2a7e70[_0x0e29('0x26')]);if(_0x2a7e70[_0x0e29('0x27')]){delete _0x2a7e70['name'];}_0x2f9199[_0x0e29('0x1f')](_0x1c0a07)[_0x0e29('0x28')](_0x2a7e70);};}exports[_0x0e29('0x29')]=function(_0x48f50a,_0x2e39cb){var _0x1a017e={},_0x28eee5={},_0x41d191={'count':0x0,'rows':[]};var _0x5135f8=_[_0x0e29('0x2a')](db['OpenchannelTransferReport'][_0x0e29('0x2b')],function(_0x540c0e){return{'name':_0x540c0e[_0x0e29('0x2c')],'type':_0x540c0e[_0x0e29('0x2d')][_0x0e29('0x2e')]};});_0x28eee5[_0x0e29('0x2f')]=_[_0x0e29('0x2a')](_0x5135f8,'name');_0x28eee5[_0x0e29('0x30')]=_['keys'](_0x48f50a[_0x0e29('0x30')]);_0x28eee5[_0x0e29('0x31')]=_[_0x0e29('0x32')](_0x28eee5['model'],_0x28eee5['query']);_0x1a017e[_0x0e29('0x33')]=_['intersection'](_0x28eee5[_0x0e29('0x2f')],qs['fields'](_0x48f50a[_0x0e29('0x30')][_0x0e29('0x34')]));_0x1a017e[_0x0e29('0x33')]=_0x1a017e[_0x0e29('0x33')][_0x0e29('0x35')]?_0x1a017e[_0x0e29('0x33')]:_0x28eee5['model'];if(!_0x48f50a[_0x0e29('0x30')]['hasOwnProperty'](_0x0e29('0x36'))){_0x1a017e[_0x0e29('0x1c')]=qs[_0x0e29('0x1c')](_0x48f50a['query'][_0x0e29('0x1c')]);_0x1a017e[_0x0e29('0x1e')]=qs['offset'](_0x48f50a[_0x0e29('0x30')][_0x0e29('0x1e')]);}_0x1a017e[_0x0e29('0x37')]=qs[_0x0e29('0x38')](_0x48f50a[_0x0e29('0x30')][_0x0e29('0x38')]);_0x1a017e[_0x0e29('0x39')]=qs[_0x0e29('0x31')](_['pick'](_0x48f50a[_0x0e29('0x30')],_0x28eee5[_0x0e29('0x31')]),_0x5135f8);if(_0x48f50a[_0x0e29('0x30')][_0x0e29('0x3a')]){_0x1a017e[_0x0e29('0x39')]=_[_0x0e29('0x3b')](_0x1a017e['where'],{'$or':_[_0x0e29('0x2a')](_0x5135f8,function(_0x13a066){if(_0x13a066['type']!==_0x0e29('0x3c')){var _0x51eb39={};_0x51eb39[_0x13a066['name']]={'$like':'%'+_0x48f50a[_0x0e29('0x30')][_0x0e29('0x3a')]+'%'};return _0x51eb39;}})});}_0x1a017e=_[_0x0e29('0x3b')]({},_0x1a017e,_0x48f50a['options']);var _0x287e50={'where':_0x1a017e[_0x0e29('0x39')]};return db[_0x0e29('0x3d')]['count'](_0x287e50)[_0x0e29('0x3e')](function(_0xa620ff){_0x41d191[_0x0e29('0x1d')]=_0xa620ff;if(_0x48f50a[_0x0e29('0x30')][_0x0e29('0x3f')]){_0x1a017e[_0x0e29('0x40')]=[{'all':!![]}];}return db[_0x0e29('0x3d')]['findAll'](_0x1a017e);})[_0x0e29('0x3e')](function(_0x37cfa9){_0x41d191[_0x0e29('0x41')]=_0x37cfa9;return _0x41d191;})[_0x0e29('0x3e')](respondWithFilteredResult(_0x2e39cb,_0x1a017e))['catch'](handleError(_0x2e39cb,null));};exports[_0x0e29('0x42')]=function(_0x5761c8,_0x2778c3){var _0x35fa5e={'raw':!![],'where':{'id':_0x5761c8[_0x0e29('0x43')]['id']}},_0x290eb3={};_0x290eb3[_0x0e29('0x2f')]=_['keys'](db[_0x0e29('0x3d')][_0x0e29('0x2b')]);_0x290eb3[_0x0e29('0x30')]=_['keys'](_0x5761c8[_0x0e29('0x30')]);_0x290eb3[_0x0e29('0x31')]=_[_0x0e29('0x32')](_0x290eb3['model'],_0x290eb3[_0x0e29('0x30')]);_0x35fa5e['attributes']=_[_0x0e29('0x32')](_0x290eb3[_0x0e29('0x2f')],qs[_0x0e29('0x34')](_0x5761c8[_0x0e29('0x30')][_0x0e29('0x34')]));_0x35fa5e[_0x0e29('0x33')]=_0x35fa5e[_0x0e29('0x33')][_0x0e29('0x35')]?_0x35fa5e[_0x0e29('0x33')]:_0x290eb3[_0x0e29('0x2f')];if(_0x5761c8[_0x0e29('0x30')][_0x0e29('0x3f')]){_0x35fa5e[_0x0e29('0x40')]=[{'all':!![]}];}_0x35fa5e=_[_0x0e29('0x3b')]({},_0x35fa5e,_0x5761c8[_0x0e29('0x44')]);return db[_0x0e29('0x3d')]['find'](_0x35fa5e)['then'](handleEntityNotFound(_0x2778c3,null))[_0x0e29('0x3e')](respondWithResult(_0x2778c3,null))[_0x0e29('0x45')](handleError(_0x2778c3,null));};exports[_0x0e29('0x46')]=function(_0x3b5e4c,_0x5dbaa9){return db[_0x0e29('0x3d')]['create'](_0x3b5e4c[_0x0e29('0x47')],{})[_0x0e29('0x3e')](respondWithResult(_0x5dbaa9,0xc9))['catch'](handleError(_0x5dbaa9,null));};exports[_0x0e29('0x48')]=function(_0x5820ad,_0xa84bf9){if(_0x5820ad['body']['id']){delete _0x5820ad[_0x0e29('0x47')]['id'];}return db['OpenchannelTransferReport']['find']({'where':{'id':_0x5820ad[_0x0e29('0x43')]['id']}})[_0x0e29('0x3e')](handleEntityNotFound(_0xa84bf9,null))[_0x0e29('0x3e')](saveUpdates(_0x5820ad[_0x0e29('0x47')],null))[_0x0e29('0x3e')](respondWithResult(_0xa84bf9,null))[_0x0e29('0x45')](handleError(_0xa84bf9,null));};exports[_0x0e29('0x24')]=function(_0x3e63b0,_0x437027){return db[_0x0e29('0x3d')][_0x0e29('0x49')]({'where':{'id':_0x3e63b0['params']['id']}})[_0x0e29('0x3e')](handleEntityNotFound(_0x437027,null))[_0x0e29('0x3e')](removeEntity(_0x437027,null))['catch'](handleError(_0x437027,null));};exports[_0x0e29('0x4a')]=function(_0x3a1622,_0x553b73){return db[_0x0e29('0x3d')][_0x0e29('0x4a')]()[_0x0e29('0x3e')](respondWithResult(_0x553b73,null))['catch'](handleError(_0x553b73,null));}; \ No newline at end of file +var _0xf1c7=['body','destroy','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','OpenchannelTransferReport','include','findAll','rows','catch','show','params','length','includeAll','find','create'];(function(_0x304d85,_0x3bd383){var _0x570077=function(_0x59944d){while(--_0x59944d){_0x304d85['push'](_0x304d85['shift']());}};_0x570077(++_0x3bd383);}(_0xf1c7,0x193));var _0x7f1c=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xf1c7[_0x4ae6ef];return _0x3cbb4e;};'use strict';var emlformat=require(_0x7f1c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7f1c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7f1c('0x2'));var moment=require(_0x7f1c('0x3'));var BPromise=require(_0x7f1c('0x4'));var Mustache=require(_0x7f1c('0x5'));var util=require(_0x7f1c('0x6'));var path=require(_0x7f1c('0x7'));var sox=require(_0x7f1c('0x8'));var csv=require(_0x7f1c('0x9'));var ejs=require(_0x7f1c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7f1c('0xb'));var crypto=require(_0x7f1c('0xc'));var jsforce=require(_0x7f1c('0xd'));var deskjs=require(_0x7f1c('0xe'));var toCsv=require(_0x7f1c('0x9'));var querystring=require(_0x7f1c('0xf'));var Papa=require(_0x7f1c('0x10'));var Redis=require(_0x7f1c('0x11'));var authService=require(_0x7f1c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7f1c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7f1c('0x14'))(_0x7f1c('0x15'));var utils=require(_0x7f1c('0x16'));var config=require(_0x7f1c('0x17'));var licenseUtil=require(_0x7f1c('0x18'));var db=require(_0x7f1c('0x19'))['db'];function respondWithStatusCode(_0x114a9d,_0x376d8f){_0x376d8f=_0x376d8f||0xcc;return function(_0x34aebb){if(_0x34aebb){return _0x114a9d[_0x7f1c('0x1a')](_0x376d8f);}return _0x114a9d[_0x7f1c('0x1b')](_0x376d8f)[_0x7f1c('0x1c')]();};}function respondWithResult(_0x1b977e,_0x10a075){_0x10a075=_0x10a075||0xc8;return function(_0x439ba0){if(_0x439ba0){return _0x1b977e[_0x7f1c('0x1b')](_0x10a075)[_0x7f1c('0x1d')](_0x439ba0);}};}function respondWithFilteredResult(_0x26f067,_0x3ec5db){return function(_0x10a02b){if(_0x10a02b){var _0x4b8aa7=typeof _0x3ec5db['offset']===_0x7f1c('0x1e')&&typeof _0x3ec5db[_0x7f1c('0x1f')]===_0x7f1c('0x1e');var _0x13b849=_0x10a02b[_0x7f1c('0x20')];var _0x66004c=_0x4b8aa7?0x0:_0x3ec5db[_0x7f1c('0x21')];var _0x3d522a=_0x4b8aa7?_0x10a02b[_0x7f1c('0x20')]:_0x3ec5db[_0x7f1c('0x21')]+_0x3ec5db[_0x7f1c('0x1f')];var _0x403cbb;if(_0x3d522a>=_0x13b849){_0x3d522a=_0x13b849;_0x403cbb=0xc8;}else{_0x403cbb=0xce;}_0x26f067[_0x7f1c('0x1b')](_0x403cbb);return _0x26f067[_0x7f1c('0x22')](_0x7f1c('0x23'),_0x66004c+'-'+_0x3d522a+'/'+_0x13b849)['json'](_0x10a02b);}return null;};}function patchUpdates(_0x1ceaa5){return function(_0x210c3f){try{jsonpatch['apply'](_0x210c3f,_0x1ceaa5,!![]);}catch(_0x41a232){return BPromise[_0x7f1c('0x24')](_0x41a232);}return _0x210c3f[_0x7f1c('0x25')]();};}function saveUpdates(_0x5d7b2e,_0x50a61a){return function(_0x59d46b){if(_0x59d46b){return _0x59d46b[_0x7f1c('0x26')](_0x5d7b2e)[_0x7f1c('0x27')](function(_0x3381ac){return _0x3381ac;});}return null;};}function removeEntity(_0x54c770,_0x15f84c){return function(_0x10c131){if(_0x10c131){return _0x10c131['destroy']()[_0x7f1c('0x27')](function(){_0x54c770[_0x7f1c('0x1b')](0xcc)[_0x7f1c('0x1c')]();});}};}function handleEntityNotFound(_0x57506e,_0x1e2314){return function(_0x1a9dc7){if(!_0x1a9dc7){_0x57506e[_0x7f1c('0x1a')](0x194);}return _0x1a9dc7;};}function handleError(_0x57b2a8,_0x2e4001){_0x2e4001=_0x2e4001||0x1f4;return function(_0x2a7928){logger[_0x7f1c('0x28')](_0x2a7928[_0x7f1c('0x29')]);if(_0x2a7928[_0x7f1c('0x2a')]){delete _0x2a7928[_0x7f1c('0x2a')];}_0x57b2a8[_0x7f1c('0x1b')](_0x2e4001)[_0x7f1c('0x2b')](_0x2a7928);};}exports[_0x7f1c('0x2c')]=function(_0x12ec44,_0x50d3ca){var _0x1b24e0={},_0xa6316f={},_0x88f702={'count':0x0,'rows':[]};var _0xf3a898=_['map'](db['OpenchannelTransferReport'][_0x7f1c('0x2d')],function(_0x23f6e6){return{'name':_0x23f6e6[_0x7f1c('0x2e')],'type':_0x23f6e6[_0x7f1c('0x2f')][_0x7f1c('0x30')]};});_0xa6316f[_0x7f1c('0x31')]=_[_0x7f1c('0x32')](_0xf3a898,_0x7f1c('0x2a'));_0xa6316f[_0x7f1c('0x33')]=_[_0x7f1c('0x34')](_0x12ec44[_0x7f1c('0x33')]);_0xa6316f[_0x7f1c('0x35')]=_[_0x7f1c('0x36')](_0xa6316f[_0x7f1c('0x31')],_0xa6316f[_0x7f1c('0x33')]);_0x1b24e0[_0x7f1c('0x37')]=_[_0x7f1c('0x36')](_0xa6316f[_0x7f1c('0x31')],qs[_0x7f1c('0x38')](_0x12ec44[_0x7f1c('0x33')]['fields']));_0x1b24e0[_0x7f1c('0x37')]=_0x1b24e0[_0x7f1c('0x37')]['length']?_0x1b24e0[_0x7f1c('0x37')]:_0xa6316f[_0x7f1c('0x31')];if(!_0x12ec44[_0x7f1c('0x33')][_0x7f1c('0x39')](_0x7f1c('0x3a'))){_0x1b24e0['limit']=qs[_0x7f1c('0x1f')](_0x12ec44['query'][_0x7f1c('0x1f')]);_0x1b24e0[_0x7f1c('0x21')]=qs[_0x7f1c('0x21')](_0x12ec44[_0x7f1c('0x33')]['offset']);}_0x1b24e0['order']=qs[_0x7f1c('0x3b')](_0x12ec44[_0x7f1c('0x33')][_0x7f1c('0x3b')]);_0x1b24e0[_0x7f1c('0x3c')]=qs[_0x7f1c('0x35')](_[_0x7f1c('0x3d')](_0x12ec44['query'],_0xa6316f['filters']),_0xf3a898);if(_0x12ec44[_0x7f1c('0x33')]['filter']){_0x1b24e0['where']=_[_0x7f1c('0x3e')](_0x1b24e0[_0x7f1c('0x3c')],{'$or':_['map'](_0xf3a898,function(_0x7e78f5){if(_0x7e78f5[_0x7f1c('0x2f')]!==_0x7f1c('0x3f')){var _0x2ddc4f={};_0x2ddc4f[_0x7e78f5[_0x7f1c('0x2a')]]={'$like':'%'+_0x12ec44['query'][_0x7f1c('0x40')]+'%'};return _0x2ddc4f;}})});}_0x1b24e0=_[_0x7f1c('0x3e')]({},_0x1b24e0,_0x12ec44[_0x7f1c('0x41')]);var _0x3e215f={'where':_0x1b24e0[_0x7f1c('0x3c')]};return db[_0x7f1c('0x42')]['count'](_0x3e215f)[_0x7f1c('0x27')](function(_0x3aa3bf){_0x88f702['count']=_0x3aa3bf;if(_0x12ec44[_0x7f1c('0x33')]['includeAll']){_0x1b24e0[_0x7f1c('0x43')]=[{'all':!![]}];}return db[_0x7f1c('0x42')][_0x7f1c('0x44')](_0x1b24e0);})[_0x7f1c('0x27')](function(_0x594079){_0x88f702[_0x7f1c('0x45')]=_0x594079;return _0x88f702;})[_0x7f1c('0x27')](respondWithFilteredResult(_0x50d3ca,_0x1b24e0))[_0x7f1c('0x46')](handleError(_0x50d3ca,null));};exports[_0x7f1c('0x47')]=function(_0x224163,_0x13ecfc){var _0x5e6563={'raw':!![],'where':{'id':_0x224163[_0x7f1c('0x48')]['id']}},_0x52e15c={};_0x52e15c[_0x7f1c('0x31')]=_['keys'](db[_0x7f1c('0x42')]['rawAttributes']);_0x52e15c[_0x7f1c('0x33')]=_[_0x7f1c('0x34')](_0x224163[_0x7f1c('0x33')]);_0x52e15c[_0x7f1c('0x35')]=_['intersection'](_0x52e15c['model'],_0x52e15c['query']);_0x5e6563['attributes']=_[_0x7f1c('0x36')](_0x52e15c[_0x7f1c('0x31')],qs[_0x7f1c('0x38')](_0x224163[_0x7f1c('0x33')][_0x7f1c('0x38')]));_0x5e6563[_0x7f1c('0x37')]=_0x5e6563[_0x7f1c('0x37')][_0x7f1c('0x49')]?_0x5e6563[_0x7f1c('0x37')]:_0x52e15c[_0x7f1c('0x31')];if(_0x224163['query'][_0x7f1c('0x4a')]){_0x5e6563[_0x7f1c('0x43')]=[{'all':!![]}];}_0x5e6563=_[_0x7f1c('0x3e')]({},_0x5e6563,_0x224163[_0x7f1c('0x41')]);return db[_0x7f1c('0x42')][_0x7f1c('0x4b')](_0x5e6563)[_0x7f1c('0x27')](handleEntityNotFound(_0x13ecfc,null))['then'](respondWithResult(_0x13ecfc,null))[_0x7f1c('0x46')](handleError(_0x13ecfc,null));};exports['create']=function(_0x4170f6,_0x5680e5){return db[_0x7f1c('0x42')][_0x7f1c('0x4c')](_0x4170f6[_0x7f1c('0x4d')],{})[_0x7f1c('0x27')](respondWithResult(_0x5680e5,0xc9))[_0x7f1c('0x46')](handleError(_0x5680e5,null));};exports['update']=function(_0x50e036,_0x3e3c85){if(_0x50e036['body']['id']){delete _0x50e036[_0x7f1c('0x4d')]['id'];}return db[_0x7f1c('0x42')][_0x7f1c('0x4b')]({'where':{'id':_0x50e036['params']['id']}})[_0x7f1c('0x27')](handleEntityNotFound(_0x3e3c85,null))[_0x7f1c('0x27')](saveUpdates(_0x50e036[_0x7f1c('0x4d')],null))[_0x7f1c('0x27')](respondWithResult(_0x3e3c85,null))[_0x7f1c('0x46')](handleError(_0x3e3c85,null));};exports[_0x7f1c('0x4e')]=function(_0x37251c,_0x4433a5){return db['OpenchannelTransferReport'][_0x7f1c('0x4b')]({'where':{'id':_0x37251c['params']['id']}})[_0x7f1c('0x27')](handleEntityNotFound(_0x4433a5,null))[_0x7f1c('0x27')](removeEntity(_0x4433a5,null))[_0x7f1c('0x46')](handleError(_0x4433a5,null));};exports['describe']=function(_0x2fa9e2,_0x52ca9b){return db[_0x7f1c('0x42')][_0x7f1c('0x4f')]()[_0x7f1c('0x27')](respondWithResult(_0x52ca9b,null))[_0x7f1c('0x46')](handleError(_0x52ca9b,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 0e8b989..0db77dc 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 _0x815b=['request-promise','path','../../config/environment','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x1a3222,_0x49f79c){var _0x34617b=function(_0x14facb){while(--_0x14facb){_0x1a3222['push'](_0x1a3222['shift']());}};_0x34617b(++_0x49f79c);}(_0x815b,0x14c));var _0xb815=function(_0x1917bd,_0x29c28e){_0x1917bd=_0x1917bd-0x0;var _0x59c62a=_0x815b[_0x1917bd];return _0x59c62a;};'use strict';var _=require(_0xb815('0x0'));var util=require(_0xb815('0x1'));var logger=require(_0xb815('0x2'))('api');var moment=require(_0xb815('0x3'));var BPromise=require('bluebird');var rp=require(_0xb815('0x4'));var fs=require('fs');var path=require(_0xb815('0x5'));var rimraf=require('rimraf');var config=require(_0xb815('0x6'));var attributes=require('./openchannelTransferReport.attributes');module[_0xb815('0x7')]=function(_0x5e38ac,_0x340459){return _0x5e38ac[_0xb815('0x8')](_0xb815('0x9'),attributes,{'tableName':_0xb815('0xa'),'paranoid':![],'indexes':[{'name':_0xb815('0xb'),'fields':[_0xb815('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5602=['util','../../config/logger','request-promise','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','uniqueid','lodash'];(function(_0x269b72,_0x3283af){var _0xbcbe67=function(_0x203a87){while(--_0x203a87){_0x269b72['push'](_0x269b72['shift']());}};_0xbcbe67(++_0x3283af);}(_0x5602,0x8b));var _0x2560=function(_0x144f2f,_0x196c1c){_0x144f2f=_0x144f2f-0x0;var _0x3c1a6f=_0x5602[_0x144f2f];return _0x3c1a6f;};'use strict';var _=require(_0x2560('0x0'));var util=require(_0x2560('0x1'));var logger=require(_0x2560('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2560('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2560('0x4'));var config=require(_0x2560('0x5'));var attributes=require(_0x2560('0x6'));module[_0x2560('0x7')]=function(_0x2ffd8f,_0x5dadcf){return _0x2ffd8f[_0x2560('0x8')]('OpenchannelTransferReport',attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x2560('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 8d3b00e..aa4cc16 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 _0x45d1=['randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelTransferReport,\x20%s,\x20%s','result','lodash','util','bluebird'];(function(_0x45915d,_0x352c5b){var _0x25f073=function(_0x324517){while(--_0x324517){_0x45915d['push'](_0x45915d['shift']());}};_0x25f073(++_0x352c5b);}(_0x45d1,0x1cb));var _0x145d=function(_0xfd5f37,_0x24a79c){_0xfd5f37=_0xfd5f37-0x0;var _0x11bd01=_0x45d1[_0xfd5f37];return _0x11bd01;};'use strict';var _=require(_0x145d('0x0'));var util=require(_0x145d('0x1'));var moment=require('moment');var BPromise=require(_0x145d('0x2'));var rs=require(_0x145d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x145d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x145d('0x5'))(_0x145d('0x6'));var config=require(_0x145d('0x7'));var jayson=require(_0x145d('0x8'));var client=jayson[_0x145d('0x9')][_0x145d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbc4161,_0x45ff66,_0x46a729){return new BPromise(function(_0x47eadc,_0x4ef552){return client['request'](_0xbc4161,_0x46a729)[_0x145d('0xb')](function(_0x183afe){logger[_0x145d('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x45ff66,_0x145d('0xd'));logger['debug'](_0x145d('0xe'),_0x45ff66,_0x145d('0xd'),JSON[_0x145d('0xf')](_0x183afe));if(_0x183afe[_0x145d('0x10')]){if(_0x183afe['error'][_0x145d('0x11')]===0x1f4){logger[_0x145d('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x45ff66,_0x183afe[_0x145d('0x10')][_0x145d('0x12')]);return _0x4ef552(_0x183afe[_0x145d('0x10')][_0x145d('0x12')]);}logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x45ff66,_0x183afe[_0x145d('0x10')][_0x145d('0x12')]);return _0x47eadc(_0x183afe[_0x145d('0x10')]['message']);}else{logger[_0x145d('0xc')](_0x145d('0x13'),_0x45ff66,_0x145d('0xd'));_0x47eadc(_0x183afe[_0x145d('0x14')][_0x145d('0x12')]);}})['catch'](function(_0x1c9ee2){logger[_0x145d('0x10')](_0x145d('0x13'),_0x45ff66,_0x1c9ee2);_0x4ef552(_0x1c9ee2);});});} \ No newline at end of file +var _0xfd7b=['OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xfd7b,0x1df));var _0xbfd7=function(_0x489b87,_0xd51c93){_0x489b87=_0x489b87-0x0;var _0x1823b6=_0xfd7b[_0x489b87];return _0x1823b6;};'use strict';var _=require('lodash');var util=require(_0xbfd7('0x0'));var moment=require(_0xbfd7('0x1'));var BPromise=require(_0xbfd7('0x2'));var rs=require(_0xbfd7('0x3'));var fs=require('fs');var Redis=require(_0xbfd7('0x4'));var db=require(_0xbfd7('0x5'))['db'];var utils=require(_0xbfd7('0x6'));var logger=require(_0xbfd7('0x7'))(_0xbfd7('0x8'));var config=require(_0xbfd7('0x9'));var jayson=require(_0xbfd7('0xa'));var client=jayson[_0xbfd7('0xb')][_0xbfd7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5f3067,_0x38b1ef,_0x48f2aa){return new BPromise(function(_0x33dab1,_0x5cee3d){return client[_0xbfd7('0xd')](_0x5f3067,_0x48f2aa)[_0xbfd7('0xe')](function(_0x5a3d78){logger[_0xbfd7('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x38b1ef,_0xbfd7('0x10'));logger[_0xbfd7('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x38b1ef,'request\x20sent',JSON[_0xbfd7('0x12')](_0x5a3d78));if(_0x5a3d78[_0xbfd7('0x13')]){if(_0x5a3d78[_0xbfd7('0x13')][_0xbfd7('0x14')]===0x1f4){logger[_0xbfd7('0x13')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x38b1ef,_0x5a3d78[_0xbfd7('0x13')]['message']);return _0x5cee3d(_0x5a3d78[_0xbfd7('0x13')]['message']);}logger['error'](_0xbfd7('0x15'),_0x38b1ef,_0x5a3d78[_0xbfd7('0x13')][_0xbfd7('0x16')]);return _0x33dab1(_0x5a3d78[_0xbfd7('0x13')]['message']);}else{logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x38b1ef,_0xbfd7('0x10'));_0x33dab1(_0x5a3d78[_0xbfd7('0x17')][_0xbfd7('0x16')]);}})[_0xbfd7('0x18')](function(_0x30c721){logger[_0xbfd7('0x13')](_0xbfd7('0x15'),_0x38b1ef,_0x30c721);_0x5cee3d(_0x30c721);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index b603222..a4a91a9 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 _0x7c0b=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','index','show','post','create','put','/:id','isAuthenticated','update','exports','util','path','express','Router'];(function(_0x34c063,_0x11d3d7){var _0x2c63a3=function(_0x5983d0){while(--_0x5983d0){_0x34c063['push'](_0x34c063['shift']());}};_0x2c63a3(++_0x11d3d7);}(_0x7c0b,0x178));var _0xb7c0=function(_0x22b713,_0x5ac526){_0x22b713=_0x22b713-0x0;var _0x33b438=_0x7c0b[_0x22b713];return _0x33b438;};'use strict';var multer=require('multer');var util=require(_0xb7c0('0x0'));var path=require(_0xb7c0('0x1'));var timeout=require('connect-timeout');var express=require(_0xb7c0('0x2'));var router=express[_0xb7c0('0x3')]();var fs_extra=require(_0xb7c0('0x4'));var auth=require(_0xb7c0('0x5'));var interaction=require(_0xb7c0('0x6'));var config=require(_0xb7c0('0x7'));var controller=require(_0xb7c0('0x8'));router[_0xb7c0('0x9')]('/',auth['isAuthenticated'](),controller[_0xb7c0('0xa')]);router[_0xb7c0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xb7c0('0xb')]);router[_0xb7c0('0xc')]('/',auth['isAuthenticated'](),controller[_0xb7c0('0xd')]);router[_0xb7c0('0xe')](_0xb7c0('0xf'),auth[_0xb7c0('0x10')](),controller[_0xb7c0('0x11')]);router['delete'](_0xb7c0('0xf'),auth[_0xb7c0('0x10')](),controller['destroy']);module[_0xb7c0('0x12')]=router; \ No newline at end of file +var _0x89c4=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./pause.controller','get','isAuthenticated','index','/:id','show','create','put','delete','exports'];(function(_0x30033a,_0x5ce4a6){var _0x5e3518=function(_0x11494a){while(--_0x11494a){_0x30033a['push'](_0x30033a['shift']());}};_0x5e3518(++_0x5ce4a6);}(_0x89c4,0xc6));var _0x489c=function(_0x10ea4d,_0x3920b7){_0x10ea4d=_0x10ea4d-0x0;var _0x4398f2=_0x89c4[_0x10ea4d];return _0x4398f2;};'use strict';var multer=require(_0x489c('0x0'));var util=require(_0x489c('0x1'));var path=require(_0x489c('0x2'));var timeout=require(_0x489c('0x3'));var express=require(_0x489c('0x4'));var router=express[_0x489c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x489c('0x6'));var interaction=require(_0x489c('0x7'));var config=require('../../config/environment');var controller=require(_0x489c('0x8'));router[_0x489c('0x9')]('/',auth[_0x489c('0xa')](),controller[_0x489c('0xb')]);router[_0x489c('0x9')](_0x489c('0xc'),auth[_0x489c('0xa')](),controller[_0x489c('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x489c('0xe')]);router[_0x489c('0xf')](_0x489c('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x489c('0x10')](_0x489c('0xc'),auth[_0x489c('0xa')](),controller['destroy']);module[_0x489c('0x11')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index c21babc..27640a5 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 _0xe19b=['name','sequelize','exports','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe19b,0x16d));var _0xbe19=function(_0x15b568,_0x4019f2){_0x15b568=_0x15b568-0x0;var _0x5c8e0c=_0xe19b[_0x15b568];return _0x5c8e0c;};'use strict';var Sequelize=require(_0xbe19('0x0'));module[_0xbe19('0x1')]={'name':{'type':Sequelize[_0xbe19('0x2')],'unique':_0xbe19('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xbe19('0x2')]}}; \ No newline at end of file +var _0x81f8=['sequelize','exports','STRING','name'];(function(_0x3be885,_0xc8dbc6){var _0x3b8e1f=function(_0x2a15db){while(--_0x2a15db){_0x3be885['push'](_0x3be885['shift']());}};_0x3b8e1f(++_0xc8dbc6);}(_0x81f8,0x170));var _0x881f=function(_0x146e52,_0x3b7e6b){_0x146e52=_0x146e52-0x0;var _0x55f107=_0x81f8[_0x146e52];return _0x55f107;};'use strict';var Sequelize=require(_0x881f('0x0'));module[_0x881f('0x1')]={'name':{'type':Sequelize[_0x881f('0x2')],'unique':_0x881f('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x881f('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index f35746d..01ac42e 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 _0x3fd3=['index','map','Pause','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','length','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','apply','reject','save','destroy','then','Pauses','end','error','stack','name','send'];(function(_0x667c6a,_0x2155cd){var _0x36396a=function(_0x29d602){while(--_0x29d602){_0x667c6a['push'](_0x667c6a['shift']());}};_0x36396a(++_0x2155cd);}(_0x3fd3,0x1c9));var _0x33fd=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0x3fd3[_0x599e60];return _0x468e19;};'use strict';var emlformat=require(_0x33fd('0x0'));var rimraf=require(_0x33fd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x33fd('0x2'));var rp=require('request-promise');var moment=require(_0x33fd('0x3'));var BPromise=require(_0x33fd('0x4'));var Mustache=require(_0x33fd('0x5'));var util=require(_0x33fd('0x6'));var path=require(_0x33fd('0x7'));var sox=require(_0x33fd('0x8'));var csv=require(_0x33fd('0x9'));var ejs=require(_0x33fd('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x33fd('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x33fd('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x33fd('0x9'));var querystring=require('querystring');var Papa=require(_0x33fd('0xd'));var Redis=require(_0x33fd('0xe'));var authService=require(_0x33fd('0xf'));var qs=require(_0x33fd('0x10'));var as=require(_0x33fd('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x33fd('0x12'))('api');var utils=require(_0x33fd('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x33fd('0x14'));var db=require(_0x33fd('0x15'))['db'];function respondWithStatusCode(_0x4619e2,_0x18a2d8){_0x18a2d8=_0x18a2d8||0xcc;return function(_0x3b211a){if(_0x3b211a){return _0x4619e2[_0x33fd('0x16')](_0x18a2d8);}return _0x4619e2[_0x33fd('0x17')](_0x18a2d8)['end']();};}function respondWithResult(_0x26bd9f,_0x3f9585){_0x3f9585=_0x3f9585||0xc8;return function(_0x46c5a1){if(_0x46c5a1){return _0x26bd9f[_0x33fd('0x17')](_0x3f9585)[_0x33fd('0x18')](_0x46c5a1);}};}function respondWithFilteredResult(_0x27b6de,_0x9e752a){return function(_0x12b144){if(_0x12b144){var _0x474d40=typeof _0x9e752a['offset']===_0x33fd('0x19')&&typeof _0x9e752a[_0x33fd('0x1a')]===_0x33fd('0x19');var _0x11d6cb=_0x12b144[_0x33fd('0x1b')];var _0x535a23=_0x474d40?0x0:_0x9e752a[_0x33fd('0x1c')];var _0x17889f=_0x474d40?_0x12b144[_0x33fd('0x1b')]:_0x9e752a[_0x33fd('0x1c')]+_0x9e752a[_0x33fd('0x1a')];var _0x1f1bcf;if(_0x17889f>=_0x11d6cb){_0x17889f=_0x11d6cb;_0x1f1bcf=0xc8;}else{_0x1f1bcf=0xce;}_0x27b6de[_0x33fd('0x17')](_0x1f1bcf);return _0x27b6de[_0x33fd('0x1d')]('Content-Range',_0x535a23+'-'+_0x17889f+'/'+_0x11d6cb)[_0x33fd('0x18')](_0x12b144);}return null;};}function patchUpdates(_0x15163b){return function(_0x7a36c9){try{jsonpatch[_0x33fd('0x1e')](_0x7a36c9,_0x15163b,!![]);}catch(_0x3c49e7){return BPromise[_0x33fd('0x1f')](_0x3c49e7);}return _0x7a36c9[_0x33fd('0x20')]();};}function saveUpdates(_0x31a41b,_0x52bb64){return function(_0x58a0da){if(_0x58a0da){return _0x58a0da['update'](_0x31a41b)['then'](function(_0x46cee0){return _0x46cee0;});}return null;};}function removeEntity(_0x393cd7,_0x37a7cd){return function(_0x5b6d4d){if(_0x5b6d4d){return _0x5b6d4d[_0x33fd('0x21')]()[_0x33fd('0x22')](function(){var _0x1b1d9b=_0x5b6d4d['get']({'plain':!![]});var _0x45b446=_0x33fd('0x23');return db['UserProfileResource'][_0x33fd('0x21')]({'where':{'type':_0x45b446,'resourceId':_0x1b1d9b['id']}})[_0x33fd('0x22')](function(){return _0x5b6d4d;});})[_0x33fd('0x22')](function(){_0x393cd7[_0x33fd('0x17')](0xcc)[_0x33fd('0x24')]();});}};}function handleEntityNotFound(_0x340f9c,_0x3f8944){return function(_0x4f8fc0){if(!_0x4f8fc0){_0x340f9c[_0x33fd('0x16')](0x194);}return _0x4f8fc0;};}function handleError(_0x30d5d2,_0x345cf7){_0x345cf7=_0x345cf7||0x1f4;return function(_0x227794){logger[_0x33fd('0x25')](_0x227794[_0x33fd('0x26')]);if(_0x227794['name']){delete _0x227794[_0x33fd('0x27')];}_0x30d5d2['status'](_0x345cf7)[_0x33fd('0x28')](_0x227794);};}exports[_0x33fd('0x29')]=function(_0xd64224,_0x4bd877){var _0x16a3fe={},_0x53c557={},_0x1a83f6={'count':0x0,'rows':[]};var _0x5b607f=_[_0x33fd('0x2a')](db[_0x33fd('0x2b')][_0x33fd('0x2c')],function(_0x1a6a29){return{'name':_0x1a6a29[_0x33fd('0x2d')],'type':_0x1a6a29['type'][_0x33fd('0x2e')]};});_0x53c557[_0x33fd('0x2f')]=_[_0x33fd('0x2a')](_0x5b607f,'name');_0x53c557[_0x33fd('0x30')]=_[_0x33fd('0x31')](_0xd64224[_0x33fd('0x30')]);_0x53c557[_0x33fd('0x32')]=_[_0x33fd('0x33')](_0x53c557[_0x33fd('0x2f')],_0x53c557['query']);_0x16a3fe[_0x33fd('0x34')]=_[_0x33fd('0x33')](_0x53c557['model'],qs[_0x33fd('0x35')](_0xd64224[_0x33fd('0x30')]['fields']));_0x16a3fe[_0x33fd('0x34')]=_0x16a3fe[_0x33fd('0x34')]['length']?_0x16a3fe['attributes']:_0x53c557[_0x33fd('0x2f')];if(!_0xd64224[_0x33fd('0x30')][_0x33fd('0x36')](_0x33fd('0x37'))){_0x16a3fe[_0x33fd('0x1a')]=qs['limit'](_0xd64224['query']['limit']);_0x16a3fe[_0x33fd('0x1c')]=qs[_0x33fd('0x1c')](_0xd64224[_0x33fd('0x30')][_0x33fd('0x1c')]);}_0x16a3fe[_0x33fd('0x38')]=qs[_0x33fd('0x39')](_0xd64224[_0x33fd('0x30')][_0x33fd('0x39')]);_0x16a3fe['where']=qs[_0x33fd('0x32')](_[_0x33fd('0x3a')](_0xd64224[_0x33fd('0x30')],_0x53c557[_0x33fd('0x32')]),_0x5b607f);if(_0xd64224[_0x33fd('0x30')][_0x33fd('0x3b')]){_0x16a3fe['where']=_['merge'](_0x16a3fe[_0x33fd('0x3c')],{'$or':_[_0x33fd('0x2a')](_0x5b607f,function(_0x1740a6){if(_0x1740a6[_0x33fd('0x3d')]!==_0x33fd('0x3e')){var _0x169c7a={};_0x169c7a[_0x1740a6[_0x33fd('0x27')]]={'$like':'%'+_0xd64224[_0x33fd('0x30')]['filter']+'%'};return _0x169c7a;}})});}_0x16a3fe=_[_0x33fd('0x3f')]({},_0x16a3fe,_0xd64224[_0x33fd('0x40')]);var _0x431ed0={'where':_0x16a3fe[_0x33fd('0x3c')]};return db[_0x33fd('0x2b')][_0x33fd('0x1b')](_0x431ed0)[_0x33fd('0x22')](function(_0x1853ef){_0x1a83f6[_0x33fd('0x1b')]=_0x1853ef;if(_0xd64224['query'][_0x33fd('0x41')]){_0x16a3fe[_0x33fd('0x42')]=[{'all':!![]}];}return db[_0x33fd('0x2b')]['findAll'](_0x16a3fe);})[_0x33fd('0x22')](function(_0x1664af){_0x1a83f6[_0x33fd('0x43')]=_0x1664af;return _0x1a83f6;})[_0x33fd('0x22')](respondWithFilteredResult(_0x4bd877,_0x16a3fe))[_0x33fd('0x44')](handleError(_0x4bd877,null));};exports[_0x33fd('0x45')]=function(_0x757118,_0x3d2104){var _0x4bd53c={'raw':!![],'where':{'id':_0x757118[_0x33fd('0x46')]['id']}},_0x3f95cb={};_0x3f95cb[_0x33fd('0x2f')]=_[_0x33fd('0x31')](db[_0x33fd('0x2b')]['rawAttributes']);_0x3f95cb['query']=_['keys'](_0x757118[_0x33fd('0x30')]);_0x3f95cb[_0x33fd('0x32')]=_[_0x33fd('0x33')](_0x3f95cb[_0x33fd('0x2f')],_0x3f95cb[_0x33fd('0x30')]);_0x4bd53c[_0x33fd('0x34')]=_[_0x33fd('0x33')](_0x3f95cb[_0x33fd('0x2f')],qs[_0x33fd('0x35')](_0x757118[_0x33fd('0x30')]['fields']));_0x4bd53c[_0x33fd('0x34')]=_0x4bd53c[_0x33fd('0x34')][_0x33fd('0x47')]?_0x4bd53c[_0x33fd('0x34')]:_0x3f95cb[_0x33fd('0x2f')];if(_0x757118[_0x33fd('0x30')][_0x33fd('0x41')]){_0x4bd53c[_0x33fd('0x42')]=[{'all':!![]}];}_0x4bd53c=_[_0x33fd('0x3f')]({},_0x4bd53c,_0x757118[_0x33fd('0x40')]);return db[_0x33fd('0x2b')]['find'](_0x4bd53c)[_0x33fd('0x22')](handleEntityNotFound(_0x3d2104,null))[_0x33fd('0x22')](respondWithResult(_0x3d2104,null))['catch'](handleError(_0x3d2104,null));};exports[_0x33fd('0x48')]=function(_0x341fc9,_0x28a3b9){return db[_0x33fd('0x2b')][_0x33fd('0x48')](_0x341fc9[_0x33fd('0x49')],{})[_0x33fd('0x22')](function(_0x7462b4){var _0x41a82b=_0x341fc9[_0x33fd('0x4a')][_0x33fd('0x4b')]({'plain':!![]});if(!_0x41a82b)throw new Error(_0x33fd('0x4c'));if(_0x41a82b['role']===_0x33fd('0x4a')){var _0x2ede80=_0x7462b4[_0x33fd('0x4b')]({'plain':!![]});var _0x3bae33=_0x33fd('0x23');return db[_0x33fd('0x4d')][_0x33fd('0x4e')]({'where':{'name':_0x3bae33,'userProfileId':_0x41a82b[_0x33fd('0x4f')]},'raw':!![]})[_0x33fd('0x22')](function(_0x34a0b0){if(_0x34a0b0&&_0x34a0b0[_0x33fd('0x50')]===0x0){return db['UserProfileResource'][_0x33fd('0x48')]({'name':_0x2ede80[_0x33fd('0x27')],'resourceId':_0x2ede80['id'],'type':_0x34a0b0[_0x33fd('0x27')],'sectionId':_0x34a0b0['id']},{})[_0x33fd('0x22')](function(){return _0x7462b4;});}else{return _0x7462b4;}})[_0x33fd('0x44')](function(_0x1cfb31){logger['error'](_0x33fd('0x51'),_0x1cfb31);throw _0x1cfb31;});}return _0x7462b4;})['then'](respondWithResult(_0x28a3b9,0xc9))[_0x33fd('0x44')](handleError(_0x28a3b9,null));};exports[_0x33fd('0x52')]=function(_0x300314,_0x1bc98b){if(_0x300314['body']['id']){delete _0x300314['body']['id'];}return db[_0x33fd('0x2b')][_0x33fd('0x4e')]({'where':{'id':_0x300314[_0x33fd('0x46')]['id']}})[_0x33fd('0x22')](handleEntityNotFound(_0x1bc98b,null))[_0x33fd('0x22')](saveUpdates(_0x300314[_0x33fd('0x49')],null))[_0x33fd('0x22')](respondWithResult(_0x1bc98b,null))[_0x33fd('0x44')](handleError(_0x1bc98b,null));};exports['destroy']=function(_0x1036a8,_0x12bb05){return db['Pause'][_0x33fd('0x4e')]({'where':{'id':_0x1036a8[_0x33fd('0x46')]['id']}})['then'](handleEntityNotFound(_0x12bb05,null))[_0x33fd('0x22')](removeEntity(_0x12bb05,null))[_0x33fd('0x44')](handleError(_0x12bb05,null));}; \ No newline at end of file +var _0x6144=['catch','show','params','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','userProfileId','autoAssociation','name','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','reject','save','update','destroy','then','Pauses','UserProfileResource','stack','map','Pause','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows'];(function(_0x3933c1,_0xdd73bc){var _0x3a084c=function(_0x1e4955){while(--_0x1e4955){_0x3933c1['push'](_0x3933c1['shift']());}};_0x3a084c(++_0xdd73bc);}(_0x6144,0x1eb));var _0x4614=function(_0xe43ee,_0x4be67d){_0xe43ee=_0xe43ee-0x0;var _0x26d7d2=_0x6144[_0xe43ee];return _0x26d7d2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4614('0x0'));var zipdir=require(_0x4614('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4614('0x2'));var moment=require(_0x4614('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4614('0x4'));var util=require(_0x4614('0x5'));var path=require(_0x4614('0x6'));var sox=require(_0x4614('0x7'));var csv=require(_0x4614('0x8'));var ejs=require(_0x4614('0x9'));var fs=require('fs');var fs_extra=require(_0x4614('0xa'));var _=require(_0x4614('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4614('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4614('0x8'));var querystring=require('querystring');var Papa=require(_0x4614('0xd'));var Redis=require(_0x4614('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x4614('0xf'));var as=require(_0x4614('0x10'));var hardwareService=require(_0x4614('0x11'));var logger=require(_0x4614('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x4614('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x4614('0x14'))['db'];function respondWithStatusCode(_0x16f80e,_0x372458){_0x372458=_0x372458||0xcc;return function(_0x191d09){if(_0x191d09){return _0x16f80e['sendStatus'](_0x372458);}return _0x16f80e['status'](_0x372458)[_0x4614('0x15')]();};}function respondWithResult(_0x2da2dc,_0x2cbfcb){_0x2cbfcb=_0x2cbfcb||0xc8;return function(_0x119035){if(_0x119035){return _0x2da2dc[_0x4614('0x16')](_0x2cbfcb)[_0x4614('0x17')](_0x119035);}};}function respondWithFilteredResult(_0x1153d0,_0x37ecf4){return function(_0x494027){if(_0x494027){var _0x54c73a=typeof _0x37ecf4[_0x4614('0x18')]===_0x4614('0x19')&&typeof _0x37ecf4[_0x4614('0x1a')]===_0x4614('0x19');var _0x41d2d2=_0x494027[_0x4614('0x1b')];var _0x52f6fb=_0x54c73a?0x0:_0x37ecf4[_0x4614('0x18')];var _0x2f6d92=_0x54c73a?_0x494027['count']:_0x37ecf4['offset']+_0x37ecf4['limit'];var _0x5e811d;if(_0x2f6d92>=_0x41d2d2){_0x2f6d92=_0x41d2d2;_0x5e811d=0xc8;}else{_0x5e811d=0xce;}_0x1153d0['status'](_0x5e811d);return _0x1153d0[_0x4614('0x1c')]('Content-Range',_0x52f6fb+'-'+_0x2f6d92+'/'+_0x41d2d2)[_0x4614('0x17')](_0x494027);}return null;};}function patchUpdates(_0x2d388c){return function(_0x2f1b89){try{jsonpatch['apply'](_0x2f1b89,_0x2d388c,!![]);}catch(_0x1f95c2){return BPromise[_0x4614('0x1d')](_0x1f95c2);}return _0x2f1b89[_0x4614('0x1e')]();};}function saveUpdates(_0x2fa5c0,_0x296619){return function(_0x5299a9){if(_0x5299a9){return _0x5299a9[_0x4614('0x1f')](_0x2fa5c0)['then'](function(_0x36d2fa){return _0x36d2fa;});}return null;};}function removeEntity(_0x707c1a,_0x273277){return function(_0x3e0d78){if(_0x3e0d78){return _0x3e0d78[_0x4614('0x20')]()[_0x4614('0x21')](function(){var _0x56932f=_0x3e0d78['get']({'plain':!![]});var _0x48b1dc=_0x4614('0x22');return db[_0x4614('0x23')][_0x4614('0x20')]({'where':{'type':_0x48b1dc,'resourceId':_0x56932f['id']}})[_0x4614('0x21')](function(){return _0x3e0d78;});})[_0x4614('0x21')](function(){_0x707c1a[_0x4614('0x16')](0xcc)[_0x4614('0x15')]();});}};}function handleEntityNotFound(_0x3118a2,_0x40cc68){return function(_0x5a21d8){if(!_0x5a21d8){_0x3118a2['sendStatus'](0x194);}return _0x5a21d8;};}function handleError(_0x219adb,_0x538fe7){_0x538fe7=_0x538fe7||0x1f4;return function(_0x3f37b8){logger['error'](_0x3f37b8[_0x4614('0x24')]);if(_0x3f37b8['name']){delete _0x3f37b8['name'];}_0x219adb['status'](_0x538fe7)['send'](_0x3f37b8);};}exports['index']=function(_0x32fd18,_0x2fee15){var _0x8d47df={},_0x3f019e={},_0x353a80={'count':0x0,'rows':[]};var _0x4d0778=_[_0x4614('0x25')](db[_0x4614('0x26')][_0x4614('0x27')],function(_0x57f540){return{'name':_0x57f540[_0x4614('0x28')],'type':_0x57f540['type'][_0x4614('0x29')]};});_0x3f019e[_0x4614('0x2a')]=_[_0x4614('0x25')](_0x4d0778,'name');_0x3f019e[_0x4614('0x2b')]=_[_0x4614('0x2c')](_0x32fd18[_0x4614('0x2b')]);_0x3f019e['filters']=_[_0x4614('0x2d')](_0x3f019e['model'],_0x3f019e[_0x4614('0x2b')]);_0x8d47df[_0x4614('0x2e')]=_[_0x4614('0x2d')](_0x3f019e[_0x4614('0x2a')],qs[_0x4614('0x2f')](_0x32fd18['query'][_0x4614('0x2f')]));_0x8d47df[_0x4614('0x2e')]=_0x8d47df['attributes'][_0x4614('0x30')]?_0x8d47df[_0x4614('0x2e')]:_0x3f019e[_0x4614('0x2a')];if(!_0x32fd18['query'][_0x4614('0x31')](_0x4614('0x32'))){_0x8d47df[_0x4614('0x1a')]=qs[_0x4614('0x1a')](_0x32fd18[_0x4614('0x2b')][_0x4614('0x1a')]);_0x8d47df[_0x4614('0x18')]=qs[_0x4614('0x18')](_0x32fd18[_0x4614('0x2b')][_0x4614('0x18')]);}_0x8d47df['order']=qs[_0x4614('0x33')](_0x32fd18[_0x4614('0x2b')]['sort']);_0x8d47df[_0x4614('0x34')]=qs[_0x4614('0x35')](_[_0x4614('0x36')](_0x32fd18['query'],_0x3f019e[_0x4614('0x35')]),_0x4d0778);if(_0x32fd18[_0x4614('0x2b')][_0x4614('0x37')]){_0x8d47df[_0x4614('0x34')]=_[_0x4614('0x38')](_0x8d47df['where'],{'$or':_[_0x4614('0x25')](_0x4d0778,function(_0x147aee){if(_0x147aee['type']!==_0x4614('0x39')){var _0x4721f6={};_0x4721f6[_0x147aee['name']]={'$like':'%'+_0x32fd18[_0x4614('0x2b')][_0x4614('0x37')]+'%'};return _0x4721f6;}})});}_0x8d47df=_['merge']({},_0x8d47df,_0x32fd18[_0x4614('0x3a')]);var _0x1f4545={'where':_0x8d47df[_0x4614('0x34')]};return db['Pause'][_0x4614('0x1b')](_0x1f4545)[_0x4614('0x21')](function(_0x286a24){_0x353a80[_0x4614('0x1b')]=_0x286a24;if(_0x32fd18['query'][_0x4614('0x3b')]){_0x8d47df['include']=[{'all':!![]}];}return db['Pause'][_0x4614('0x3c')](_0x8d47df);})[_0x4614('0x21')](function(_0x57e4f5){_0x353a80[_0x4614('0x3d')]=_0x57e4f5;return _0x353a80;})[_0x4614('0x21')](respondWithFilteredResult(_0x2fee15,_0x8d47df))[_0x4614('0x3e')](handleError(_0x2fee15,null));};exports[_0x4614('0x3f')]=function(_0x382e2a,_0x8edf4f){var _0x586c65={'raw':!![],'where':{'id':_0x382e2a[_0x4614('0x40')]['id']}},_0x4c8471={};_0x4c8471[_0x4614('0x2a')]=_['keys'](db[_0x4614('0x26')][_0x4614('0x27')]);_0x4c8471[_0x4614('0x2b')]=_[_0x4614('0x2c')](_0x382e2a['query']);_0x4c8471['filters']=_['intersection'](_0x4c8471[_0x4614('0x2a')],_0x4c8471['query']);_0x586c65['attributes']=_[_0x4614('0x2d')](_0x4c8471[_0x4614('0x2a')],qs[_0x4614('0x2f')](_0x382e2a['query'][_0x4614('0x2f')]));_0x586c65[_0x4614('0x2e')]=_0x586c65[_0x4614('0x2e')][_0x4614('0x30')]?_0x586c65[_0x4614('0x2e')]:_0x4c8471[_0x4614('0x2a')];if(_0x382e2a[_0x4614('0x2b')][_0x4614('0x3b')]){_0x586c65[_0x4614('0x41')]=[{'all':!![]}];}_0x586c65=_[_0x4614('0x38')]({},_0x586c65,_0x382e2a[_0x4614('0x3a')]);return db[_0x4614('0x26')][_0x4614('0x42')](_0x586c65)[_0x4614('0x21')](handleEntityNotFound(_0x8edf4f,null))[_0x4614('0x21')](respondWithResult(_0x8edf4f,null))[_0x4614('0x3e')](handleError(_0x8edf4f,null));};exports[_0x4614('0x43')]=function(_0x4cdaa8,_0x10abd4){return db[_0x4614('0x26')][_0x4614('0x43')](_0x4cdaa8['body'],{})[_0x4614('0x21')](function(_0x2c98a5){var _0xe7659a=_0x4cdaa8['user']['get']({'plain':!![]});if(!_0xe7659a)throw new Error(_0x4614('0x44'));if(_0xe7659a[_0x4614('0x45')]===_0x4614('0x46')){var _0xe16a06=_0x2c98a5[_0x4614('0x47')]({'plain':!![]});var _0x3545a5='Pauses';return db[_0x4614('0x48')][_0x4614('0x42')]({'where':{'name':_0x3545a5,'userProfileId':_0xe7659a[_0x4614('0x49')]},'raw':!![]})['then'](function(_0x3ac038){if(_0x3ac038&&_0x3ac038[_0x4614('0x4a')]===0x0){return db[_0x4614('0x23')][_0x4614('0x43')]({'name':_0xe16a06[_0x4614('0x4b')],'resourceId':_0xe16a06['id'],'type':_0x3ac038[_0x4614('0x4b')],'sectionId':_0x3ac038['id']},{})[_0x4614('0x21')](function(){return _0x2c98a5;});}else{return _0x2c98a5;}})[_0x4614('0x3e')](function(_0x527d20){logger[_0x4614('0x4c')](_0x4614('0x4d'),_0x527d20);throw _0x527d20;});}return _0x2c98a5;})[_0x4614('0x21')](respondWithResult(_0x10abd4,0xc9))[_0x4614('0x3e')](handleError(_0x10abd4,null));};exports[_0x4614('0x1f')]=function(_0x2bc58c,_0x5d96ad){if(_0x2bc58c['body']['id']){delete _0x2bc58c['body']['id'];}return db['Pause'][_0x4614('0x42')]({'where':{'id':_0x2bc58c['params']['id']}})[_0x4614('0x21')](handleEntityNotFound(_0x5d96ad,null))[_0x4614('0x21')](saveUpdates(_0x2bc58c[_0x4614('0x4e')],null))[_0x4614('0x21')](respondWithResult(_0x5d96ad,null))[_0x4614('0x3e')](handleError(_0x5d96ad,null));};exports[_0x4614('0x20')]=function(_0x3533c2,_0x5a7915){return db[_0x4614('0x26')]['find']({'where':{'id':_0x3533c2['params']['id']}})[_0x4614('0x21')](handleEntityNotFound(_0x5a7915,null))[_0x4614('0x21')](removeEntity(_0x5a7915,null))[_0x4614('0x3e')](handleError(_0x5a7915,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 322f6ec..7b0d1d4 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 _0x7217=['../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x57cbfb,_0x2de760){var _0x4cb933=function(_0x33cf6a){while(--_0x33cf6a){_0x57cbfb['push'](_0x57cbfb['shift']());}};_0x4cb933(++_0x2de760);}(_0x7217,0x19e));var _0x7721=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x7217[_0x5e3b04];return _0x1fc44d;};'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 _0x1cb9=['./pause.attributes','exports','define','Pause','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x432643,_0x4c5068){var _0x16fad6=function(_0x139dfe){while(--_0x139dfe){_0x432643['push'](_0x432643['shift']());}};_0x16fad6(++_0x4c5068);}(_0x1cb9,0x14e));var _0x91cb=function(_0x37d238,_0x58e544){_0x37d238=_0x37d238-0x0;var _0x11670a=_0x1cb9[_0x37d238];return _0x11670a;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index b18b250..8bca51e 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(_0x54b221,_0x2dfb60){var _0xb01066=function(_0x5e4a63){while(--_0x5e4a63){_0x54b221['push'](_0x54b221['shift']());}};_0xb01066(++_0x2dfb60);}(_0xb10b,0x12a));var _0xbb10=function(_0x31cae7,_0x297087){_0x31cae7=_0x31cae7-0x0;var _0x3f8521=_0xb10b[_0x31cae7];return _0x3f8521;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x3594ef,_0x2500ac){var _0x58057b=function(_0x495a5d){while(--_0x495a5d){_0x3594ef['push'](_0x3594ef['shift']());}};_0x58057b(++_0x2500ac);}(_0xb10b,0x12a));var _0xbb10=function(_0x4b25e3,_0x33a600){_0x4b25e3=_0x4b25e3-0x0;var _0x1596c6=_0xb10b[_0x4b25e3];return _0x1596c6;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 088c6a9..eac1006 100644 --- a/server/api/plugin/index.js +++ b/server/api/plugin/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb99=['originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','upload','webhookPost','put','update','delete','multer','path','Router','fs-extra','../../components/auth/service','../../config/environment','./plugin.controller','isAuthenticated','get','/webhook','webhookGet','/:id','show','download','diskStorage','join'];(function(_0x1e2caa,_0x5d0c19){var _0x16f101=function(_0x1c4bdb){while(--_0x1c4bdb){_0x1e2caa['push'](_0x1e2caa['shift']());}};_0x16f101(++_0x5d0c19);}(_0xcb99,0x8b));var _0x9cb9=function(_0x5d92c2,_0x26d815){_0x5d92c2=_0x5d92c2-0x0;var _0x415601=_0xcb99[_0x5d92c2];return _0x415601;};'use strict';var multer=require(_0x9cb9('0x0'));var util=require('util');var path=require(_0x9cb9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9cb9('0x2')]();var fs_extra=require(_0x9cb9('0x3'));var auth=require(_0x9cb9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9cb9('0x5'));var controller=require(_0x9cb9('0x6'));router['get']('/',auth[_0x9cb9('0x7')](),controller['index']);router[_0x9cb9('0x8')](_0x9cb9('0x9'),controller[_0x9cb9('0xa')]);router[_0x9cb9('0x8')](_0x9cb9('0xb'),auth[_0x9cb9('0x7')](),controller[_0x9cb9('0xc')]);router[_0x9cb9('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x9cb9('0xd')]);var upload=multer({'storage':multer[_0x9cb9('0xe')]({'destination':function(_0x1b4fa6,_0x5a0ac7,_0x3be02c){_0x3be02c(null,path[_0x9cb9('0xf')](config['root'],'server/files/plugins'));},'filename':function(_0x227d49,_0x2e687e,_0x3382c8){_0x2e687e[_0x9cb9('0x10')]=_0x2e687e['originalname'][_0x9cb9('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3382c8(null,util[_0x9cb9('0x12')](_0x9cb9('0x13'),path[_0x9cb9('0x14')](_0x2e687e[_0x9cb9('0x10')],path[_0x9cb9('0x15')](_0x2e687e[_0x9cb9('0x10')])),Date[_0x9cb9('0x16')](),path[_0x9cb9('0x15')](_0x2e687e[_0x9cb9('0x10')])));}})});router[_0x9cb9('0x17')]('/',upload[_0x9cb9('0x18')](_0x9cb9('0x19')),controller[_0x9cb9('0x1a')]);router[_0x9cb9('0x17')](_0x9cb9('0x9'),controller[_0x9cb9('0x1b')]);router[_0x9cb9('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0x9cb9('0x1d')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x9cb9('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x425d=['isAuthenticated','index','/webhook','/:id','show','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','format','%s-%s%s','basename','extname','now','single','file','upload','post','webhookPost','put','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','get'];(function(_0x6f48f4,_0x34247e){var _0x51b08c=function(_0x2ec0fd){while(--_0x2ec0fd){_0x6f48f4['push'](_0x6f48f4['shift']());}};_0x51b08c(++_0x34247e);}(_0x425d,0x1e0));var _0xd425=function(_0x106214,_0x454b8d){_0x106214=_0x106214-0x0;var _0x5f5cea=_0x425d[_0x106214];return _0x5f5cea;};'use strict';var multer=require(_0xd425('0x0'));var util=require('util');var path=require(_0xd425('0x1'));var timeout=require(_0xd425('0x2'));var express=require(_0xd425('0x3'));var router=express[_0xd425('0x4')]();var fs_extra=require(_0xd425('0x5'));var auth=require(_0xd425('0x6'));var interaction=require(_0xd425('0x7'));var config=require('../../config/environment');var controller=require(_0xd425('0x8'));router[_0xd425('0x9')]('/',auth[_0xd425('0xa')](),controller[_0xd425('0xb')]);router[_0xd425('0x9')](_0xd425('0xc'),controller['webhookGet']);router[_0xd425('0x9')](_0xd425('0xd'),auth[_0xd425('0xa')](),controller[_0xd425('0xe')]);router[_0xd425('0x9')](_0xd425('0xf'),auth[_0xd425('0xa')](),controller[_0xd425('0x10')]);var upload=multer({'storage':multer[_0xd425('0x11')]({'destination':function(_0x35a7f4,_0x3d2bcf,_0x10d463){_0x10d463(null,path[_0xd425('0x12')](config[_0xd425('0x13')],_0xd425('0x14')));},'filename':function(_0x2385a5,_0x9bb611,_0x3cacf7){_0x9bb611[_0xd425('0x15')]=_0x9bb611[_0xd425('0x15')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3cacf7(null,util[_0xd425('0x16')](_0xd425('0x17'),path[_0xd425('0x18')](_0x9bb611['originalname'],path[_0xd425('0x19')](_0x9bb611[_0xd425('0x15')])),Date[_0xd425('0x1a')](),path[_0xd425('0x19')](_0x9bb611[_0xd425('0x15')])));}})});router['post']('/',upload[_0xd425('0x1b')](_0xd425('0x1c')),controller[_0xd425('0x1d')]);router[_0xd425('0x1e')]('/webhook',controller[_0xd425('0x1f')]);router[_0xd425('0x20')](_0xd425('0xd'),auth[_0xd425('0xa')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xd425('0x21')]);module[_0xd425('0x22')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 0ecf8c3..7165f40 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 _0x1d01=['STRING','sequelize','ENUM','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','always','never'];(function(_0x5a3531,_0x1e589a){var _0x44f7a8=function(_0x57b7b4){while(--_0x57b7b4){_0x5a3531['push'](_0x5a3531['shift']());}};_0x44f7a8(++_0x1e589a);}(_0x1d01,0x19b));var _0x11d0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d01[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x11d0('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x11d0('0x1')]('html',_0x11d0('0x2'))},'description':{'type':Sequelize[_0x11d0('0x3')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize['STRING'],'comment':_0x11d0('0x4')},'active':{'type':Sequelize[_0x11d0('0x5')],'defaultValue':0x0,'comment':_0x11d0('0x6')},'sidebar':{'type':Sequelize[_0x11d0('0x1')]('adminOnly','agentOnly',_0x11d0('0x7'),_0x11d0('0x8')),'defaultValue':'always','comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0x11d0('0x9')]},'agentUrl':{'type':Sequelize[_0x11d0('0x9')]},'scriptName':{'type':Sequelize[_0x11d0('0x9')]},'scriptPath':{'type':Sequelize[_0x11d0('0x9')]}}; \ No newline at end of file +var _0x2ddc=['exports','STRING','html','script','TEXT','BOOLEAN','ENUM','adminOnly','agentOnly','always','never','sequelize'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x2ddc,0x167));var _0xc2dd=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x2ddc[_0x24f31b];return _0x488401;};'use strict';var Sequelize=require(_0xc2dd('0x0'));module[_0xc2dd('0x1')]={'name':{'type':Sequelize[_0xc2dd('0x2')]},'type':{'type':Sequelize['ENUM'](_0xc2dd('0x3'),_0xc2dd('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0xc2dd('0x5')]},'path':{'type':Sequelize[_0xc2dd('0x2')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0xc2dd('0x6')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0xc2dd('0x7')](_0xc2dd('0x8'),_0xc2dd('0x9'),_0xc2dd('0xa'),_0xc2dd('0xb')),'defaultValue':_0xc2dd('0xa'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0xc2dd('0x2')]},'scriptName':{'type':Sequelize[_0xc2dd('0x2')]},'scriptPath':{'type':Sequelize[_0xc2dd('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 8e88ab6..bc57d72 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 _0x6cd3=['error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','Plugin','include','findAll','catch','params','length','options','find','download','path','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','**/*','join','dirname','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','Temporary\x20file\x20removed','upload','extname','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','manifest.json','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','views','Invalid\x20manifest:\x20views\x20missing','parameters','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','icon-apps','version','html','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','delete','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','rimraf','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','extract-zip','archiver','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','defaults','redis','./plugin.socket','register','end','status','offset','undefined','limit','count','set','json','apply','reject','update','then','destroy','get','Plugins','sendStatus'];(function(_0x14fddd,_0x220fe5){var _0x2e03a2=function(_0x6d54d9){while(--_0x6d54d9){_0x14fddd['push'](_0x14fddd['shift']());}};_0x2e03a2(++_0x220fe5);}(_0x6cd3,0x118));var _0x36cd=function(_0x2baca1,_0x2f3557){_0x2baca1=_0x2baca1-0x0;var _0x9aa62a=_0x6cd3[_0x2baca1];return _0x9aa62a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x36cd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x36cd('0x1'));var moment=require('moment');var BPromise=require(_0x36cd('0x2'));var Mustache=require('mustache');var util=require(_0x36cd('0x3'));var path=require('path');var sox=require(_0x36cd('0x4'));var csv=require(_0x36cd('0x5'));var ejs=require(_0x36cd('0x6'));var fs=require('fs');var fs_extra=require(_0x36cd('0x7'));var _=require('lodash');var squel=require(_0x36cd('0x8'));var crypto=require(_0x36cd('0x9'));var jsforce=require(_0x36cd('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x36cd('0x5'));var querystring=require(_0x36cd('0xb'));var Papa=require(_0x36cd('0xc'));var extract=require(_0x36cd('0xd'));var rimraf=require(_0x36cd('0x0'));var archiver=require(_0x36cd('0xe'));var Redis=require(_0x36cd('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x36cd('0x10'));var hardwareService=require(_0x36cd('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x36cd('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x36cd('0x13'))['db'];config['redis']=_[_0x36cd('0x14')](config[_0x36cd('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x36cd('0x15')]));require(_0x36cd('0x16'))[_0x36cd('0x17')](socket);function respondWithStatusCode(_0xc2fc39,_0x145585){_0x145585=_0x145585||0xcc;return function(_0x20dd2e){if(_0x20dd2e){return _0xc2fc39['sendStatus'](_0x145585);}return _0xc2fc39['status'](_0x145585)[_0x36cd('0x18')]();};}function respondWithResult(_0x5c7cdb,_0x540b50){_0x540b50=_0x540b50||0xc8;return function(_0x5a0c8d){if(_0x5a0c8d){return _0x5c7cdb[_0x36cd('0x19')](_0x540b50)['json'](_0x5a0c8d);}};}function respondWithFilteredResult(_0x151ea2,_0x4ec2fd){return function(_0x9ad7c1){if(_0x9ad7c1){var _0xa07a4a=typeof _0x4ec2fd[_0x36cd('0x1a')]===_0x36cd('0x1b')&&typeof _0x4ec2fd[_0x36cd('0x1c')]==='undefined';var _0x5f10df=_0x9ad7c1['count'];var _0xfe2a49=_0xa07a4a?0x0:_0x4ec2fd[_0x36cd('0x1a')];var _0x2bafc9=_0xa07a4a?_0x9ad7c1[_0x36cd('0x1d')]:_0x4ec2fd[_0x36cd('0x1a')]+_0x4ec2fd[_0x36cd('0x1c')];var _0x355d69;if(_0x2bafc9>=_0x5f10df){_0x2bafc9=_0x5f10df;_0x355d69=0xc8;}else{_0x355d69=0xce;}_0x151ea2[_0x36cd('0x19')](_0x355d69);return _0x151ea2[_0x36cd('0x1e')]('Content-Range',_0xfe2a49+'-'+_0x2bafc9+'/'+_0x5f10df)[_0x36cd('0x1f')](_0x9ad7c1);}return null;};}function patchUpdates(_0x1e01f6){return function(_0x478143){try{jsonpatch[_0x36cd('0x20')](_0x478143,_0x1e01f6,!![]);}catch(_0x2fa379){return BPromise[_0x36cd('0x21')](_0x2fa379);}return _0x478143['save']();};}function saveUpdates(_0x4c249c,_0x1c2bc2){return function(_0x376e3b){if(_0x376e3b){return _0x376e3b[_0x36cd('0x22')](_0x4c249c)[_0x36cd('0x23')](function(_0x5b93c7){return _0x5b93c7;});}return null;};}function removeEntity(_0x3d3852,_0x437191){return function(_0x2f2dc1){if(_0x2f2dc1){return _0x2f2dc1[_0x36cd('0x24')]()[_0x36cd('0x23')](function(){var _0x59d6ca=_0x2f2dc1[_0x36cd('0x25')]({'plain':!![]});var _0x554ad4=_0x36cd('0x26');return db['UserProfileResource'][_0x36cd('0x24')]({'where':{'type':_0x554ad4,'resourceId':_0x59d6ca['id']}})[_0x36cd('0x23')](function(){return _0x2f2dc1;});})[_0x36cd('0x23')](function(){_0x3d3852[_0x36cd('0x19')](0xcc)[_0x36cd('0x18')]();});}};}function handleEntityNotFound(_0x5511f4,_0x20f9d0){return function(_0x2d1e34){if(!_0x2d1e34){_0x5511f4[_0x36cd('0x27')](0x194);}return _0x2d1e34;};}function handleError(_0x187962,_0x5d5f54){_0x5d5f54=_0x5d5f54||0x1f4;return function(_0x3f34c9){logger[_0x36cd('0x28')](_0x3f34c9['stack']);if(_0x3f34c9['name']){delete _0x3f34c9[_0x36cd('0x29')];}_0x187962[_0x36cd('0x19')](_0x5d5f54)[_0x36cd('0x2a')](_0x3f34c9);};}exports['index']=function(_0xf8b8c,_0x70ecb1){var _0x3fdccb={},_0x10fc41={},_0x31bab7={'count':0x0,'rows':[]};var _0x40ec3c=_[_0x36cd('0x2b')](db['Plugin'][_0x36cd('0x2c')],function(_0x46767c){return{'name':_0x46767c[_0x36cd('0x2d')],'type':_0x46767c[_0x36cd('0x2e')][_0x36cd('0x2f')]};});_0x10fc41[_0x36cd('0x30')]=_[_0x36cd('0x2b')](_0x40ec3c,'name');_0x10fc41[_0x36cd('0x31')]=_[_0x36cd('0x32')](_0xf8b8c[_0x36cd('0x31')]);_0x10fc41[_0x36cd('0x33')]=_[_0x36cd('0x34')](_0x10fc41[_0x36cd('0x30')],_0x10fc41[_0x36cd('0x31')]);_0x3fdccb[_0x36cd('0x35')]=_['intersection'](_0x10fc41[_0x36cd('0x30')],qs[_0x36cd('0x36')](_0xf8b8c[_0x36cd('0x31')][_0x36cd('0x36')]));_0x3fdccb[_0x36cd('0x35')]=_0x3fdccb[_0x36cd('0x35')]['length']?_0x3fdccb[_0x36cd('0x35')]:_0x10fc41[_0x36cd('0x30')];if(!_0xf8b8c[_0x36cd('0x31')][_0x36cd('0x37')](_0x36cd('0x38'))){_0x3fdccb[_0x36cd('0x1c')]=qs[_0x36cd('0x1c')](_0xf8b8c['query'][_0x36cd('0x1c')]);_0x3fdccb[_0x36cd('0x1a')]=qs[_0x36cd('0x1a')](_0xf8b8c[_0x36cd('0x31')][_0x36cd('0x1a')]);}_0x3fdccb[_0x36cd('0x39')]=qs[_0x36cd('0x3a')](_0xf8b8c[_0x36cd('0x31')][_0x36cd('0x3a')]);_0x3fdccb[_0x36cd('0x3b')]=qs[_0x36cd('0x33')](_[_0x36cd('0x3c')](_0xf8b8c['query'],_0x10fc41[_0x36cd('0x33')]),_0x40ec3c);if(_0xf8b8c['query'][_0x36cd('0x3d')]){_0x3fdccb['where']=_[_0x36cd('0x3e')](_0x3fdccb[_0x36cd('0x3b')],{'$or':_[_0x36cd('0x2b')](_0x40ec3c,function(_0x2e42c3){if(_0x2e42c3[_0x36cd('0x2e')]!==_0x36cd('0x3f')){var _0x10e94a={};_0x10e94a[_0x2e42c3[_0x36cd('0x29')]]={'$like':'%'+_0xf8b8c[_0x36cd('0x31')][_0x36cd('0x3d')]+'%'};return _0x10e94a;}})});}_0x3fdccb=_['merge']({},_0x3fdccb,_0xf8b8c['options']);var _0x29d167={'where':_0x3fdccb[_0x36cd('0x3b')]};return db[_0x36cd('0x40')][_0x36cd('0x1d')](_0x29d167)['then'](function(_0x3844b4){_0x31bab7[_0x36cd('0x1d')]=_0x3844b4;if(_0xf8b8c[_0x36cd('0x31')]['includeAll']){_0x3fdccb[_0x36cd('0x41')]=[{'all':!![]}];}return db['Plugin'][_0x36cd('0x42')](_0x3fdccb);})[_0x36cd('0x23')](function(_0x28927b){_0x31bab7['rows']=_0x28927b;return _0x31bab7;})[_0x36cd('0x23')](respondWithFilteredResult(_0x70ecb1,_0x3fdccb))[_0x36cd('0x43')](handleError(_0x70ecb1,null));};exports['show']=function(_0x21a5d1,_0x5369f4){var _0x4a1f6b={'raw':!![],'where':{'id':_0x21a5d1[_0x36cd('0x44')]['id']}},_0x2986a0={};_0x2986a0[_0x36cd('0x30')]=_[_0x36cd('0x32')](db['Plugin'][_0x36cd('0x2c')]);_0x2986a0[_0x36cd('0x31')]=_[_0x36cd('0x32')](_0x21a5d1[_0x36cd('0x31')]);_0x2986a0[_0x36cd('0x33')]=_[_0x36cd('0x34')](_0x2986a0[_0x36cd('0x30')],_0x2986a0[_0x36cd('0x31')]);_0x4a1f6b['attributes']=_[_0x36cd('0x34')](_0x2986a0['model'],qs['fields'](_0x21a5d1['query'][_0x36cd('0x36')]));_0x4a1f6b['attributes']=_0x4a1f6b[_0x36cd('0x35')][_0x36cd('0x45')]?_0x4a1f6b[_0x36cd('0x35')]:_0x2986a0[_0x36cd('0x30')];if(_0x21a5d1[_0x36cd('0x31')]['includeAll']){_0x4a1f6b[_0x36cd('0x41')]=[{'all':!![]}];}_0x4a1f6b=_[_0x36cd('0x3e')]({},_0x4a1f6b,_0x21a5d1[_0x36cd('0x46')]);return db['Plugin'][_0x36cd('0x47')](_0x4a1f6b)[_0x36cd('0x23')](handleEntityNotFound(_0x5369f4,null))['then'](respondWithResult(_0x5369f4,null))[_0x36cd('0x43')](handleError(_0x5369f4,null));};exports[_0x36cd('0x48')]=function(_0x110abd,_0x381f2a,_0x411ee3){return db['Plugin'][_0x36cd('0x47')]({'where':{'id':_0x110abd[_0x36cd('0x44')]['id']},'attributes':['name',_0x36cd('0x49')],'raw':!![]})[_0x36cd('0x23')](handleEntityNotFound(_0x381f2a,null))[_0x36cd('0x23')](function(_0x1f23b1){if(_0x1f23b1){var _0x4f7afa=path['join'](config[_0x36cd('0x4a')],_0x36cd('0x4b'),util[_0x36cd('0x4c')](_0x36cd('0x4d'),path[_0x36cd('0x4e')](_0x1f23b1[_0x36cd('0x49')])));var _0x6ed6f1=fs[_0x36cd('0x4f')](_0x4f7afa);var _0xd3523d=archiver(_0x36cd('0x50'),{'zlib':{'level':0x9}});_0xd3523d['on']('warning',function(_0x2189bc){if(_0x2189bc[_0x36cd('0x51')]===_0x36cd('0x52')){logger['error'](_0x2189bc);}else{throw new db[(_0x36cd('0x53'))][(_0x36cd('0x54'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0xd3523d['on']('error',function(_0x3664e8){throw new db[(_0x36cd('0x53'))][(_0x36cd('0x54'))](_0x36cd('0x55'));});_0xd3523d[_0x36cd('0x56')](_0x6ed6f1);_0xd3523d['glob'](_0x36cd('0x57'),{'cwd':path[_0x36cd('0x58')](config[_0x36cd('0x4a')],_0x36cd('0x4b'),path[_0x36cd('0x59')](_0x1f23b1[_0x36cd('0x49')])),'ignore':[path[_0x36cd('0x58')](path['basename'](_0x1f23b1[_0x36cd('0x49')]),'node_modules/**/*'),path[_0x36cd('0x58')](path[_0x36cd('0x4e')](_0x1f23b1[_0x36cd('0x49')]),'attachments/**/*')],'nodir':!![]})[_0x36cd('0x5a')]();_0x6ed6f1['on'](_0x36cd('0x5b'),function(){if(!fs[_0x36cd('0x5c')](_0x4f7afa)){throw new db[(_0x36cd('0x53'))]['Error'](_0x36cd('0x5d'));}return _0x381f2a['download'](_0x4f7afa,util[_0x36cd('0x4c')](_0x36cd('0x4d'),path[_0x36cd('0x4e')](_0x1f23b1[_0x36cd('0x49')])),function(_0x88fdf7){if(_0x88fdf7){throw new db[(_0x36cd('0x53'))][(_0x36cd('0x54'))](_0x36cd('0x5e'));}fs['unlinkSync'](_0x4f7afa);logger[_0x36cd('0x5f')](_0x36cd('0x60'));logger[_0x36cd('0x5f')](_0x36cd('0x61'));});});}return null;})['catch'](handleError(_0x381f2a,null));};exports[_0x36cd('0x62')]=function(_0x5e0712,_0x56365f,_0x33bf82){var _0x211d3a=path[_0x36cd('0x4e')](_0x5e0712['file']['filename'],path[_0x36cd('0x63')](_0x5e0712['file'][_0x36cd('0x64')]));var _0x32f547=path['join'](config[_0x36cd('0x4a')],_0x36cd('0x4b'),_0x5e0712['file']['filename']);var _0x53d5f8=path[_0x36cd('0x58')](config[_0x36cd('0x4a')],_0x36cd('0x4b'),_0x211d3a);logger['info'](_0x36cd('0x65'),_0x32f547);logger['info'](_0x36cd('0x66'),_0x53d5f8);try{fs['chmodSync'](_0x32f547,parseInt(_0x36cd('0x67'),0x8));extract(_0x32f547,{'dir':_0x53d5f8},function(_0x159c35){if(_0x159c35){logger[_0x36cd('0x28')](_0x159c35);handleError(_0x159c35,!![]);};var _0xfcbf52=fs[_0x36cd('0x68')](_0x53d5f8);if(_0xfcbf52['length']>0x1){removeReferences(_0x32f547,_0x53d5f8);logger[_0x36cd('0x28')](_0x36cd('0x69'));return _0x33bf82(new Error(_0x36cd('0x69')));}var _0x2142e0=fs['lstatSync'](path[_0x36cd('0x58')](_0x53d5f8,_0xfcbf52[0x0]));if(_0x2142e0[_0x36cd('0x6a')]()){removeReferences(_0x32f547,_0x53d5f8);logger[_0x36cd('0x28')](_0x36cd('0x69'));return _0x33bf82(new Error(_0x36cd('0x69')));}if(_0x2142e0['isDirectory']()){var _0x3f9434=fs[_0x36cd('0x68')](path[_0x36cd('0x58')](_0x53d5f8,_0xfcbf52[0x0]));if(_0x3f9434[_0x36cd('0x45')]===0x0){removeReferences(_0x32f547,_0x53d5f8);logger[_0x36cd('0x28')](_0x36cd('0x69'));return _0x33bf82(new Error(_0x36cd('0x69')));}var _0x3c631b=_0x3f9434['some'](function(_0x2b1c53){return _0x2b1c53===_0x36cd('0x6b');});if(!_0x3c631b){return _0x33bf82(new Error('Plugin\x20manifest\x20missing'));}var _0x4873c2=fs[_0x36cd('0x6c')](path['join'](_0x53d5f8,_0xfcbf52[0x0],_0x36cd('0x6b')));var _0x1a9cce=JSON[_0x36cd('0x6d')](_0x4873c2);if(_0x36cd('0x1b')==typeof _0x1a9cce[_0x36cd('0x29')]){return _0x33bf82(new Error(_0x36cd('0x6e')));}if(_0x36cd('0x1b')==typeof _0x1a9cce[_0x36cd('0x2e')]){return _0x33bf82(new Error(_0x36cd('0x6f')));}if(_0x36cd('0x1b')==typeof _0x1a9cce['version']){return _0x33bf82(new Error(_0x36cd('0x70')));}if(_0x36cd('0x1b')==typeof _0x1a9cce['parameters']){return _0x33bf82(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x1a9cce['type']==='html'){if(_0x36cd('0x1b')==typeof _0x1a9cce['parameters'][_0x36cd('0x71')]){return _0x33bf82(new Error(_0x36cd('0x72')));}if(_0x36cd('0x1b')==typeof _0x1a9cce[_0x36cd('0x73')][_0x36cd('0x71')][_0x36cd('0x74')]&&_0x36cd('0x1b')==typeof _0x1a9cce['parameters'][_0x36cd('0x71')][_0x36cd('0x75')]){return _0x33bf82(new Error(_0x36cd('0x76')));}}else if(_0x1a9cce[_0x36cd('0x2e')]==='script'){if('undefined'==typeof _0x1a9cce[_0x36cd('0x73')][_0x36cd('0x77')]){return _0x33bf82(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x36cd('0x1b')==typeof _0x1a9cce[_0x36cd('0x73')][_0x36cd('0x78')]){return _0x33bf82(new Error(_0x36cd('0x79')));}}else{return _0x33bf82(new Error(_0x36cd('0x7a')));}var _0x3cadba=_0x1a9cce[_0x36cd('0x29')];var _0x52c420=_0x1a9cce[_0x36cd('0x7b')];var _0x4ff264=_0x1a9cce[_0x36cd('0x2e')];var _0x125823=_0x1a9cce[_0x36cd('0x7c')]?_0x1a9cce['sidebar']:'always';var _0x306fd4=_0x1a9cce[_0x36cd('0x7d')]?_0x1a9cce['icon']:_0x36cd('0x7e');var _0x58f98b='';var _0x3007fa='';var _0x2a2cab='';var _0x409d39='';var _0x201e98=_0x1a9cce[_0x36cd('0x7f')];if(_0x4ff264===_0x36cd('0x80')){if(_0x36cd('0x1b')!=typeof _0x1a9cce[_0x36cd('0x73')][_0x36cd('0x71')][_0x36cd('0x74')]){var _0x3a7203=_0x1a9cce[_0x36cd('0x73')]['views'][_0x36cd('0x74')];if(!/^(f|ht)tps?:\/\//i[_0x36cd('0x81')](_0x3a7203)){_0x58f98b=path[_0x36cd('0x58')](_0x36cd('0x82'),_0x211d3a,_0xfcbf52[0x0],_0x3a7203);}else{_0x58f98b=_0x3a7203;}}else{logger[_0x36cd('0x5f')](_0x36cd('0x83'));}if('undefined'!=typeof _0x1a9cce[_0x36cd('0x73')][_0x36cd('0x71')][_0x36cd('0x75')]){var _0x6ccdc=_0x1a9cce[_0x36cd('0x73')]['views']['agent'];if(!/^(f|ht)tps?:\/\//i[_0x36cd('0x81')](_0x6ccdc)){_0x3007fa=path[_0x36cd('0x58')](_0x36cd('0x82'),_0x211d3a,_0xfcbf52[0x0],_0x6ccdc);}else{_0x3007fa=_0x6ccdc;}}else{logger[_0x36cd('0x5f')](_0x36cd('0x84'));}}else if(_0x4ff264==='script'){_0x2a2cab=_0x1a9cce[_0x36cd('0x73')][_0x36cd('0x77')];_0x409d39=_0x1a9cce[_0x36cd('0x73')][_0x36cd('0x78')];if('undefined'!=typeof _0x1a9cce[_0x36cd('0x73')]['views']){if('undefined'!=typeof _0x1a9cce[_0x36cd('0x73')][_0x36cd('0x71')][_0x36cd('0x74')]){var _0x3a7203=_0x1a9cce['parameters'][_0x36cd('0x71')][_0x36cd('0x74')];if(!/^(f|ht)tps?:\/\//i[_0x36cd('0x81')](_0x3a7203)){_0x58f98b=path[_0x36cd('0x58')](_0x36cd('0x82'),_0x211d3a,_0xfcbf52[0x0],_0x3a7203);}else{_0x58f98b=_0x3a7203;}}if(_0x36cd('0x1b')!=typeof _0x1a9cce['parameters']['views']['agent']){var _0x6ccdc=_0x1a9cce['parameters'][_0x36cd('0x71')][_0x36cd('0x75')];if(!/^(f|ht)tps?:\/\//i['test'](_0x6ccdc)){_0x3007fa=path[_0x36cd('0x58')]('plugins',_0x211d3a,_0xfcbf52[0x0],_0x6ccdc);}else{_0x3007fa=_0x6ccdc;}}}}var _0x596396={'name':_0x3cadba,'description':_0x52c420,'path':path['join'](_0x211d3a,_0xfcbf52[0x0]),'type':_0x4ff264,'sidebar':_0x125823,'icon':_0x306fd4,'adminUrl':_0x58f98b,'agentUrl':_0x3007fa,'scriptName':_0x2a2cab,'scriptPath':_0x409d39,'version':_0x201e98};removeReferences(_0x32f547,null);return db[_0x36cd('0x40')][_0x36cd('0x85')](_0x596396)[_0x36cd('0x23')](function(_0x3a367a){var _0x2ab5a1={'role':_0x5e0712[_0x36cd('0x86')]['role'],'userProfileId':_0x5e0712[_0x36cd('0x86')][_0x36cd('0x87')]};if(!_0x2ab5a1)throw new Error(_0x36cd('0x88'));if(_0x2ab5a1[_0x36cd('0x89')]===_0x36cd('0x8a')){var _0x56923d=_0x3a367a[_0x36cd('0x25')]({'plain':!![]});return db[_0x36cd('0x8b')]['find']({'where':{'name':_0x36cd('0x26'),'userProfileId':_0x2ab5a1['userProfileId']},'raw':!![]})[_0x36cd('0x23')](function(_0x250a17){if(_0x250a17&&_0x250a17[_0x36cd('0x8c')]===0x0){return db[_0x36cd('0x8d')]['create']({'name':_0x56923d[_0x36cd('0x29')],'resourceId':_0x56923d['id'],'type':_0x250a17['name'],'sectionId':_0x250a17['id']},{})[_0x36cd('0x23')](function(){return _0x3a367a;});}else{return _0x3a367a;}})['catch'](function(_0x2da8a3){logger[_0x36cd('0x28')](_0x36cd('0x8e'),_0x2da8a3);throw _0x2da8a3;});}return _0x3a367a;})['then'](respondWithResult(_0x56365f,null))[_0x36cd('0x43')](handleError(_0x56365f,null));}});}catch(_0x1d0535){_0x56365f['status'](0x1f4)[_0x36cd('0x2a')](_0x1d0535);}};function removeReferences(_0x1381d2,_0x2b9084){try{if(_0x1381d2){fs['unlinkSync'](_0x1381d2);logger[_0x36cd('0x5f')]('Zip\x20archive\x20removed');}if(_0x2b9084){rimraf(_0x2b9084,function(){});logger[_0x36cd('0x5f')](_0x36cd('0x8f'));}}catch(_0x37c1a9){logger[_0x36cd('0x28')](_0x37c1a9);}}exports['update']=function(_0x4385ed,_0x38f911,_0x1b50a6){return db['Plugin']['find']({'where':{'id':_0x4385ed['params']['id']}})[_0x36cd('0x23')](handleEntityNotFound(_0x38f911,null))[_0x36cd('0x23')](saveUpdates(_0x4385ed[_0x36cd('0x86')],null))[_0x36cd('0x23')](respondWithResult(_0x38f911,null))[_0x36cd('0x43')](handleError(_0x38f911,null));};exports[_0x36cd('0x90')]=function(_0x3c8f51,_0x5be06f,_0x3d0288){return db[_0x36cd('0x40')][_0x36cd('0x47')]({'where':{'id':_0x3c8f51[_0x36cd('0x44')]['id']}})[_0x36cd('0x23')](function(_0x5e3f6b){if(_0x5e3f6b){return _0x5e3f6b[_0x36cd('0x24')]();}})[_0x36cd('0x23')](function(_0x4c60a8){rimraf(path[_0x36cd('0x58')](config[_0x36cd('0x4a')],_0x36cd('0x4b'),path[_0x36cd('0x59')](_0x4c60a8[_0x36cd('0x49')])),function(){});return _0x4c60a8;})[_0x36cd('0x23')](handleEntityNotFound(_0x5be06f,null))[_0x36cd('0x23')](respondWithStatusCode(_0x5be06f,null))['catch'](handleError(_0x5be06f,null));};exports['webhookGet']=function(_0x1ac9f0,_0x2da68d,_0xbbda3c){return BPromise[_0x36cd('0x91')]()[_0x36cd('0x23')](function(){if(!_0x1ac9f0[_0x36cd('0x31')]['path']){throw new Error(_0x36cd('0x92'));}if(!_0x1ac9f0[_0x36cd('0x31')][_0x36cd('0x93')]){throw new Error(_0x36cd('0x94'));}var _0x350a99=_0x1ac9f0[_0x36cd('0x31')][_0x36cd('0x95')]?_0x1ac9f0[_0x36cd('0x31')][_0x36cd('0x95')]+':'+_0x1ac9f0[_0x36cd('0x31')]['port']:_0x36cd('0x96')+_0x1ac9f0[_0x36cd('0x31')][_0x36cd('0x93')];var _0x48c2a3=_0x1ac9f0[_0x36cd('0x31')]['json']?_0x1ac9f0['query']['json']:!![];var _0x2921f3=_0x1ac9f0[_0x36cd('0x31')][_0x36cd('0x97')]?_0x1ac9f0[_0x36cd('0x31')][_0x36cd('0x97')]:null;var _0xaae00c={'method':_0x1ac9f0[_0x36cd('0x98')],'uri':util['format'](_0x36cd('0x99'),_0x350a99,_0x1ac9f0[_0x36cd('0x31')][_0x36cd('0x49')]),'json':_0x48c2a3,'resolveWithFullResponse':!![],'encoding':_0x2921f3,'qs':_0x1ac9f0[_0x36cd('0x31')]};if(_0x1ac9f0[_0x36cd('0x9a')]){_0xaae00c[_0x36cd('0x9a')]=_0x1ac9f0[_0x36cd('0x9a')];if(_0xaae00c['headers'][_0x36cd('0x9b')]){delete _0xaae00c[_0x36cd('0x9a')][_0x36cd('0x9b')];}}if(_0xaae00c[_0x36cd('0x9a')][_0x36cd('0x9c')]){delete _0xaae00c[_0x36cd('0x9a')][_0x36cd('0x9c')];}return rp(_0xaae00c);})[_0x36cd('0x23')](function(_0x136d5c){if(_0x136d5c){_0x2da68d[_0x36cd('0x1e')](_0x136d5c['headers']);logger['info'](_0x136d5c[_0x36cd('0x86')]);if(_[_0x36cd('0x9d')](_0x1ac9f0[_0x36cd('0x31')][_0x36cd('0x49')],'download')&&_0x136d5c[_0x36cd('0x9e')]==0x1f4){return _0x2da68d[_0x36cd('0x27')](_0x136d5c[_0x36cd('0x9e')]);}else{return _0x2da68d[_0x36cd('0x19')](_0x136d5c[_0x36cd('0x9e')])[_0x36cd('0x2a')](_0x136d5c[_0x36cd('0x86')]);}}else{return _0x2da68d['sendStatus'](0xc8);}})[_0x36cd('0x43')](handleError(_0x2da68d,null));};exports[_0x36cd('0x9f')]=function(_0x5d012a,_0x514305,_0x457cbe){return BPromise[_0x36cd('0x91')]()['then'](function(){if(!_0x5d012a[_0x36cd('0x31')]['path']){throw new Error(_0x36cd('0x92'));}if(!_0x5d012a[_0x36cd('0x31')][_0x36cd('0x93')]){throw new Error(_0x36cd('0x94'));}var _0x5c6811=_0x5d012a[_0x36cd('0x31')][_0x36cd('0x95')]?_0x5d012a[_0x36cd('0x31')][_0x36cd('0x95')]+':'+_0x5d012a[_0x36cd('0x31')]['port']:_0x36cd('0x96')+_0x5d012a[_0x36cd('0x31')][_0x36cd('0x93')];var _0x3fae14=_0x5d012a[_0x36cd('0x31')][_0x36cd('0x1f')]?_0x5d012a[_0x36cd('0x31')][_0x36cd('0x1f')]:!![];var _0x2847bd=_0x5d012a[_0x36cd('0x31')][_0x36cd('0x97')]?_0x5d012a[_0x36cd('0x31')][_0x36cd('0x97')]:null;var _0x5c4feb={'method':_0x5d012a['method'],'uri':util[_0x36cd('0x4c')](_0x36cd('0x99'),_0x5c6811,_0x5d012a[_0x36cd('0x31')][_0x36cd('0x49')]),'json':_0x3fae14,'resolveWithFullResponse':!![],'encoding':_0x2847bd,'body':_0x5d012a[_0x36cd('0x86')]};if(_0x5d012a[_0x36cd('0x9a')]){_0x5c4feb[_0x36cd('0x9a')]=_0x5d012a[_0x36cd('0x9a')];if(_0x5c4feb['headers'][_0x36cd('0x9b')]){delete _0x5c4feb[_0x36cd('0x9a')][_0x36cd('0x9b')];}}if(_0x5c4feb['headers'][_0x36cd('0x9c')]){delete _0x5c4feb['headers']['content-type'];}return rp(_0x5c4feb);})[_0x36cd('0x23')](function(_0x471e32){if(_0x471e32){_0x514305[_0x36cd('0x1e')](_0x471e32[_0x36cd('0x9a')]);logger[_0x36cd('0x5f')](_0x471e32[_0x36cd('0x86')]);return _0x514305[_0x36cd('0x19')](_0x471e32['statusCode'])['send'](_0x471e32[_0x36cd('0x86')]);}else{return _0x514305['sendStatus'](0xc8);}})[_0x36cd('0x43')](handleError(_0x514305,null));}; \ No newline at end of file +var _0x495d=['sidebar','always','icon','icon-apps','test','plugins','agent','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','create','body','userProfileId','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','update','webhookGet','resolve','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','encoding','headers','content-length','endsWith','statusCode','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','method','%s%s','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','status','end','offset','undefined','limit','count','set','json','apply','save','then','destroy','get','Plugins','UserProfileResource','sendStatus','error','name','send','map','Plugin','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','findAll','rows','catch','show','includeAll','include','options','find','params','join','root','server/files/plugins','%s.zip','createWriteStream','warning','ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','pipe','glob','dirname','basename','node_modules/**/*','attachments/**/*','finalize','existsSync','download','format','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','file','filename','Plugin\x20upload\x20filepath:\x20%s','0777','readdirSync','length','Invalid\x20plugin\x20structure','lstatSync','isDirectory','some','Plugin\x20manifest\x20missing','readFileSync','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing'];(function(_0x4c5c97,_0x4f85bf){var _0xd5d2cb=function(_0x1e6100){while(--_0x1e6100){_0x4c5c97['push'](_0x4c5c97['shift']());}};_0xd5d2cb(++_0x4f85bf);}(_0x495d,0xc3));var _0xd495=function(_0x224758,_0x4e36a2){_0x224758=_0x224758-0x0;var _0x597097=_0x495d[_0x224758];return _0x597097;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd495('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd495('0x1'));var BPromise=require(_0xd495('0x2'));var Mustache=require(_0xd495('0x3'));var util=require(_0xd495('0x4'));var path=require(_0xd495('0x5'));var sox=require(_0xd495('0x6'));var csv=require(_0xd495('0x7'));var ejs=require(_0xd495('0x8'));var fs=require('fs');var fs_extra=require(_0xd495('0x9'));var _=require(_0xd495('0xa'));var squel=require(_0xd495('0xb'));var crypto=require(_0xd495('0xc'));var jsforce=require(_0xd495('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd495('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var extract=require('extract-zip');var rimraf=require('rimraf');var archiver=require('archiver');var Redis=require(_0xd495('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd495('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd495('0x10'))(_0xd495('0x11'));var utils=require(_0xd495('0x12'));var config=require(_0xd495('0x13'));var licenseUtil=require(_0xd495('0x14'));var db=require(_0xd495('0x15'))['db'];config[_0xd495('0x16')]=_[_0xd495('0x17')](config['redis'],{'host':_0xd495('0x18'),'port':0x18eb});var socket=require(_0xd495('0x19'))(new Redis(config[_0xd495('0x16')]));require(_0xd495('0x1a'))['register'](socket);function respondWithStatusCode(_0x2a4786,_0x344a50){_0x344a50=_0x344a50||0xcc;return function(_0x58174f){if(_0x58174f){return _0x2a4786['sendStatus'](_0x344a50);}return _0x2a4786[_0xd495('0x1b')](_0x344a50)[_0xd495('0x1c')]();};}function respondWithResult(_0x472b7f,_0x475e9b){_0x475e9b=_0x475e9b||0xc8;return function(_0x433b90){if(_0x433b90){return _0x472b7f['status'](_0x475e9b)['json'](_0x433b90);}};}function respondWithFilteredResult(_0x157c32,_0x2a3ad3){return function(_0x6e95){if(_0x6e95){var _0x40e6df=typeof _0x2a3ad3[_0xd495('0x1d')]===_0xd495('0x1e')&&typeof _0x2a3ad3[_0xd495('0x1f')]===_0xd495('0x1e');var _0x4f2bab=_0x6e95[_0xd495('0x20')];var _0x5eecac=_0x40e6df?0x0:_0x2a3ad3[_0xd495('0x1d')];var _0x39ae93=_0x40e6df?_0x6e95[_0xd495('0x20')]:_0x2a3ad3[_0xd495('0x1d')]+_0x2a3ad3['limit'];var _0x1b4697;if(_0x39ae93>=_0x4f2bab){_0x39ae93=_0x4f2bab;_0x1b4697=0xc8;}else{_0x1b4697=0xce;}_0x157c32[_0xd495('0x1b')](_0x1b4697);return _0x157c32[_0xd495('0x21')]('Content-Range',_0x5eecac+'-'+_0x39ae93+'/'+_0x4f2bab)[_0xd495('0x22')](_0x6e95);}return null;};}function patchUpdates(_0x3dfecf){return function(_0x15b874){try{jsonpatch[_0xd495('0x23')](_0x15b874,_0x3dfecf,!![]);}catch(_0x270ec1){return BPromise['reject'](_0x270ec1);}return _0x15b874[_0xd495('0x24')]();};}function saveUpdates(_0x4d208f,_0x2d84e8){return function(_0x223faf){if(_0x223faf){return _0x223faf['update'](_0x4d208f)[_0xd495('0x25')](function(_0x59feb8){return _0x59feb8;});}return null;};}function removeEntity(_0x3186c8,_0x4dab60){return function(_0x164be5){if(_0x164be5){return _0x164be5[_0xd495('0x26')]()[_0xd495('0x25')](function(){var _0x5edddd=_0x164be5[_0xd495('0x27')]({'plain':!![]});var _0x743d2e=_0xd495('0x28');return db[_0xd495('0x29')]['destroy']({'where':{'type':_0x743d2e,'resourceId':_0x5edddd['id']}})['then'](function(){return _0x164be5;});})[_0xd495('0x25')](function(){_0x3186c8[_0xd495('0x1b')](0xcc)[_0xd495('0x1c')]();});}};}function handleEntityNotFound(_0x36d47d,_0x5b0a35){return function(_0x37d015){if(!_0x37d015){_0x36d47d[_0xd495('0x2a')](0x194);}return _0x37d015;};}function handleError(_0x1531c3,_0x50a9aa){_0x50a9aa=_0x50a9aa||0x1f4;return function(_0x1ac98c){logger[_0xd495('0x2b')](_0x1ac98c['stack']);if(_0x1ac98c['name']){delete _0x1ac98c[_0xd495('0x2c')];}_0x1531c3[_0xd495('0x1b')](_0x50a9aa)[_0xd495('0x2d')](_0x1ac98c);};}exports['index']=function(_0x3387aa,_0x2d02ab){var _0x1839e8={},_0x1c0ebb={},_0x3f7370={'count':0x0,'rows':[]};var _0x4c51cd=_[_0xd495('0x2e')](db[_0xd495('0x2f')][_0xd495('0x30')],function(_0x49254a){return{'name':_0x49254a[_0xd495('0x31')],'type':_0x49254a[_0xd495('0x32')][_0xd495('0x33')]};});_0x1c0ebb[_0xd495('0x34')]=_['map'](_0x4c51cd,_0xd495('0x2c'));_0x1c0ebb[_0xd495('0x35')]=_[_0xd495('0x36')](_0x3387aa[_0xd495('0x35')]);_0x1c0ebb[_0xd495('0x37')]=_[_0xd495('0x38')](_0x1c0ebb[_0xd495('0x34')],_0x1c0ebb[_0xd495('0x35')]);_0x1839e8[_0xd495('0x39')]=_['intersection'](_0x1c0ebb[_0xd495('0x34')],qs[_0xd495('0x3a')](_0x3387aa['query']['fields']));_0x1839e8[_0xd495('0x39')]=_0x1839e8['attributes']['length']?_0x1839e8[_0xd495('0x39')]:_0x1c0ebb['model'];if(!_0x3387aa['query'][_0xd495('0x3b')](_0xd495('0x3c'))){_0x1839e8[_0xd495('0x1f')]=qs[_0xd495('0x1f')](_0x3387aa[_0xd495('0x35')][_0xd495('0x1f')]);_0x1839e8[_0xd495('0x1d')]=qs[_0xd495('0x1d')](_0x3387aa['query'][_0xd495('0x1d')]);}_0x1839e8[_0xd495('0x3d')]=qs[_0xd495('0x3e')](_0x3387aa[_0xd495('0x35')]['sort']);_0x1839e8[_0xd495('0x3f')]=qs[_0xd495('0x37')](_[_0xd495('0x40')](_0x3387aa[_0xd495('0x35')],_0x1c0ebb[_0xd495('0x37')]),_0x4c51cd);if(_0x3387aa[_0xd495('0x35')][_0xd495('0x41')]){_0x1839e8[_0xd495('0x3f')]=_['merge'](_0x1839e8[_0xd495('0x3f')],{'$or':_[_0xd495('0x2e')](_0x4c51cd,function(_0x48a651){if(_0x48a651[_0xd495('0x32')]!==_0xd495('0x42')){var _0x255cb1={};_0x255cb1[_0x48a651[_0xd495('0x2c')]]={'$like':'%'+_0x3387aa[_0xd495('0x35')][_0xd495('0x41')]+'%'};return _0x255cb1;}})});}_0x1839e8=_[_0xd495('0x43')]({},_0x1839e8,_0x3387aa['options']);var _0x5119a9={'where':_0x1839e8['where']};return db['Plugin'][_0xd495('0x20')](_0x5119a9)[_0xd495('0x25')](function(_0x4eb911){_0x3f7370[_0xd495('0x20')]=_0x4eb911;if(_0x3387aa[_0xd495('0x35')]['includeAll']){_0x1839e8['include']=[{'all':!![]}];}return db[_0xd495('0x2f')][_0xd495('0x44')](_0x1839e8);})['then'](function(_0x205a08){_0x3f7370[_0xd495('0x45')]=_0x205a08;return _0x3f7370;})[_0xd495('0x25')](respondWithFilteredResult(_0x2d02ab,_0x1839e8))[_0xd495('0x46')](handleError(_0x2d02ab,null));};exports[_0xd495('0x47')]=function(_0xa4aa72,_0x3731a3){var _0xf242f5={'raw':!![],'where':{'id':_0xa4aa72['params']['id']}},_0x4f6a23={};_0x4f6a23[_0xd495('0x34')]=_[_0xd495('0x36')](db[_0xd495('0x2f')][_0xd495('0x30')]);_0x4f6a23['query']=_[_0xd495('0x36')](_0xa4aa72[_0xd495('0x35')]);_0x4f6a23[_0xd495('0x37')]=_['intersection'](_0x4f6a23['model'],_0x4f6a23[_0xd495('0x35')]);_0xf242f5[_0xd495('0x39')]=_[_0xd495('0x38')](_0x4f6a23[_0xd495('0x34')],qs['fields'](_0xa4aa72['query']['fields']));_0xf242f5[_0xd495('0x39')]=_0xf242f5[_0xd495('0x39')]['length']?_0xf242f5[_0xd495('0x39')]:_0x4f6a23['model'];if(_0xa4aa72[_0xd495('0x35')][_0xd495('0x48')]){_0xf242f5[_0xd495('0x49')]=[{'all':!![]}];}_0xf242f5=_[_0xd495('0x43')]({},_0xf242f5,_0xa4aa72[_0xd495('0x4a')]);return db['Plugin'][_0xd495('0x4b')](_0xf242f5)[_0xd495('0x25')](handleEntityNotFound(_0x3731a3,null))[_0xd495('0x25')](respondWithResult(_0x3731a3,null))[_0xd495('0x46')](handleError(_0x3731a3,null));};exports['download']=function(_0x216f7d,_0xd3671a,_0x47499e){return db[_0xd495('0x2f')][_0xd495('0x4b')]({'where':{'id':_0x216f7d[_0xd495('0x4c')]['id']},'attributes':[_0xd495('0x2c'),_0xd495('0x5')],'raw':!![]})[_0xd495('0x25')](handleEntityNotFound(_0xd3671a,null))[_0xd495('0x25')](function(_0x55d517){if(_0x55d517){var _0x19a18d=path[_0xd495('0x4d')](config[_0xd495('0x4e')],_0xd495('0x4f'),util['format'](_0xd495('0x50'),path['basename'](_0x55d517['path'])));var _0x3e2d14=fs[_0xd495('0x51')](_0x19a18d);var _0x23930e=archiver('zip',{'zlib':{'level':0x9}});_0x23930e['on'](_0xd495('0x52'),function(_0x1c14b8){if(_0x1c14b8['code']===_0xd495('0x53')){logger[_0xd495('0x2b')](_0x1c14b8);}else{throw new db['Sequelize'][(_0xd495('0x54'))](_0xd495('0x55'));}});_0x23930e['on']('error',function(_0xbb10){throw new db[(_0xd495('0x56'))][(_0xd495('0x54'))](_0xd495('0x55'));});_0x23930e[_0xd495('0x57')](_0x3e2d14);_0x23930e[_0xd495('0x58')]('**/*',{'cwd':path[_0xd495('0x4d')](config['root'],_0xd495('0x4f'),path[_0xd495('0x59')](_0x55d517[_0xd495('0x5')])),'ignore':[path['join'](path[_0xd495('0x5a')](_0x55d517['path']),_0xd495('0x5b')),path[_0xd495('0x4d')](path[_0xd495('0x5a')](_0x55d517[_0xd495('0x5')]),_0xd495('0x5c'))],'nodir':!![]})[_0xd495('0x5d')]();_0x3e2d14['on']('close',function(){if(!fs[_0xd495('0x5e')](_0x19a18d)){throw new db[(_0xd495('0x56'))][(_0xd495('0x54'))]('Plugin\x20not\x20found');}return _0xd3671a[_0xd495('0x5f')](_0x19a18d,util[_0xd495('0x60')]('%s.zip',path['basename'](_0x55d517[_0xd495('0x5')])),function(_0x19af8b){if(_0x19af8b){throw new db[(_0xd495('0x56'))][(_0xd495('0x54'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0xd495('0x61')](_0x19a18d);logger[_0xd495('0x62')](_0xd495('0x63'));logger[_0xd495('0x62')](_0xd495('0x64'));});});}return null;})[_0xd495('0x46')](handleError(_0xd3671a,null));};exports['upload']=function(_0x16a7b6,_0x202367,_0xa47c01){var _0x2b8fed=path[_0xd495('0x5a')](_0x16a7b6[_0xd495('0x65')][_0xd495('0x66')],path['extname'](_0x16a7b6[_0xd495('0x65')][_0xd495('0x66')]));var _0x15e4a2=path['join'](config[_0xd495('0x4e')],_0xd495('0x4f'),_0x16a7b6['file'][_0xd495('0x66')]);var _0x2ece18=path[_0xd495('0x4d')](config[_0xd495('0x4e')],_0xd495('0x4f'),_0x2b8fed);logger['info'](_0xd495('0x67'),_0x15e4a2);logger[_0xd495('0x62')]('Plugin\x20upload\x20destination:\x20%s',_0x2ece18);try{fs['chmodSync'](_0x15e4a2,parseInt(_0xd495('0x68'),0x8));extract(_0x15e4a2,{'dir':_0x2ece18},function(_0x29ae02){if(_0x29ae02){logger[_0xd495('0x2b')](_0x29ae02);handleError(_0x29ae02,!![]);};var _0x2fba24=fs[_0xd495('0x69')](_0x2ece18);if(_0x2fba24[_0xd495('0x6a')]>0x1){removeReferences(_0x15e4a2,_0x2ece18);logger['error']('Invalid\x20plugin\x20structure');return _0xa47c01(new Error(_0xd495('0x6b')));}var _0x52fb43=fs[_0xd495('0x6c')](path['join'](_0x2ece18,_0x2fba24[0x0]));if(_0x52fb43['isFile']()){removeReferences(_0x15e4a2,_0x2ece18);logger['error'](_0xd495('0x6b'));return _0xa47c01(new Error(_0xd495('0x6b')));}if(_0x52fb43[_0xd495('0x6d')]()){var _0x11a242=fs['readdirSync'](path[_0xd495('0x4d')](_0x2ece18,_0x2fba24[0x0]));if(_0x11a242[_0xd495('0x6a')]===0x0){removeReferences(_0x15e4a2,_0x2ece18);logger[_0xd495('0x2b')](_0xd495('0x6b'));return _0xa47c01(new Error(_0xd495('0x6b')));}var _0x523398=_0x11a242[_0xd495('0x6e')](function(_0x5940e2){return _0x5940e2==='manifest.json';});if(!_0x523398){return _0xa47c01(new Error(_0xd495('0x6f')));}var _0x23130f=fs[_0xd495('0x70')](path[_0xd495('0x4d')](_0x2ece18,_0x2fba24[0x0],_0xd495('0x71')));var _0x290114=JSON[_0xd495('0x72')](_0x23130f);if(_0xd495('0x1e')==typeof _0x290114['name']){return _0xa47c01(new Error(_0xd495('0x73')));}if(_0xd495('0x1e')==typeof _0x290114[_0xd495('0x32')]){return _0xa47c01(new Error(_0xd495('0x74')));}if(_0xd495('0x1e')==typeof _0x290114[_0xd495('0x75')]){return _0xa47c01(new Error(_0xd495('0x76')));}if(_0xd495('0x1e')==typeof _0x290114[_0xd495('0x77')]){return _0xa47c01(new Error(_0xd495('0x78')));}if(_0x290114[_0xd495('0x32')]===_0xd495('0x79')){if(_0xd495('0x1e')==typeof _0x290114[_0xd495('0x77')][_0xd495('0x7a')]){return _0xa47c01(new Error(_0xd495('0x7b')));}if(_0xd495('0x1e')==typeof _0x290114['parameters']['views'][_0xd495('0x7c')]&&_0xd495('0x1e')==typeof _0x290114['parameters'][_0xd495('0x7a')]['agent']){return _0xa47c01(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x290114['type']===_0xd495('0x7d')){if('undefined'==typeof _0x290114[_0xd495('0x77')][_0xd495('0x7e')]){return _0xa47c01(new Error(_0xd495('0x7f')));}if(_0xd495('0x1e')==typeof _0x290114[_0xd495('0x77')]['scriptPath']){return _0xa47c01(new Error(_0xd495('0x80')));}}else{return _0xa47c01(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x1f31b9=_0x290114[_0xd495('0x2c')];var _0x4c4adb=_0x290114['description'];var _0x102e8f=_0x290114[_0xd495('0x32')];var _0x4ce5ab=_0x290114[_0xd495('0x81')]?_0x290114[_0xd495('0x81')]:_0xd495('0x82');var _0x4d71f1=_0x290114['icon']?_0x290114[_0xd495('0x83')]:_0xd495('0x84');var _0x126a76='';var _0x2bb287='';var _0x47f999='';var _0x463cbc='';var _0x5e9491=_0x290114[_0xd495('0x75')];if(_0x102e8f===_0xd495('0x79')){if(_0xd495('0x1e')!=typeof _0x290114[_0xd495('0x77')][_0xd495('0x7a')][_0xd495('0x7c')]){var _0x3cc17d=_0x290114['parameters'][_0xd495('0x7a')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xd495('0x85')](_0x3cc17d)){_0x126a76=path[_0xd495('0x4d')](_0xd495('0x86'),_0x2b8fed,_0x2fba24[0x0],_0x3cc17d);}else{_0x126a76=_0x3cc17d;}}else{logger[_0xd495('0x62')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0xd495('0x1e')!=typeof _0x290114[_0xd495('0x77')][_0xd495('0x7a')]['agent']){var _0x50353f=_0x290114[_0xd495('0x77')][_0xd495('0x7a')][_0xd495('0x87')];if(!/^(f|ht)tps?:\/\//i['test'](_0x50353f)){_0x2bb287=path[_0xd495('0x4d')]('plugins',_0x2b8fed,_0x2fba24[0x0],_0x50353f);}else{_0x2bb287=_0x50353f;}}else{logger[_0xd495('0x62')](_0xd495('0x88'));}}else if(_0x102e8f==='script'){_0x47f999=_0x290114[_0xd495('0x77')]['scriptName'];_0x463cbc=_0x290114[_0xd495('0x77')][_0xd495('0x89')];if(_0xd495('0x1e')!=typeof _0x290114[_0xd495('0x77')][_0xd495('0x7a')]){if('undefined'!=typeof _0x290114[_0xd495('0x77')][_0xd495('0x7a')][_0xd495('0x7c')]){var _0x3cc17d=_0x290114['parameters'][_0xd495('0x7a')][_0xd495('0x7c')];if(!/^(f|ht)tps?:\/\//i['test'](_0x3cc17d)){_0x126a76=path[_0xd495('0x4d')](_0xd495('0x86'),_0x2b8fed,_0x2fba24[0x0],_0x3cc17d);}else{_0x126a76=_0x3cc17d;}}if('undefined'!=typeof _0x290114[_0xd495('0x77')][_0xd495('0x7a')]['agent']){var _0x50353f=_0x290114[_0xd495('0x77')]['views']['agent'];if(!/^(f|ht)tps?:\/\//i[_0xd495('0x85')](_0x50353f)){_0x2bb287=path[_0xd495('0x4d')](_0xd495('0x86'),_0x2b8fed,_0x2fba24[0x0],_0x50353f);}else{_0x2bb287=_0x50353f;}}}}var _0x2d435e={'name':_0x1f31b9,'description':_0x4c4adb,'path':path[_0xd495('0x4d')](_0x2b8fed,_0x2fba24[0x0]),'type':_0x102e8f,'sidebar':_0x4ce5ab,'icon':_0x4d71f1,'adminUrl':_0x126a76,'agentUrl':_0x2bb287,'scriptName':_0x47f999,'scriptPath':_0x463cbc,'version':_0x5e9491};removeReferences(_0x15e4a2,null);return db[_0xd495('0x2f')][_0xd495('0x8a')](_0x2d435e)[_0xd495('0x25')](function(_0x233e18){var _0x2f24e9={'role':_0x16a7b6['body']['role'],'userProfileId':_0x16a7b6[_0xd495('0x8b')][_0xd495('0x8c')]};if(!_0x2f24e9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f24e9[_0xd495('0x8d')]===_0xd495('0x8e')){var _0x3a5266=_0x233e18[_0xd495('0x27')]({'plain':!![]});return db[_0xd495('0x8f')][_0xd495('0x4b')]({'where':{'name':'Plugins','userProfileId':_0x2f24e9[_0xd495('0x8c')]},'raw':!![]})[_0xd495('0x25')](function(_0x10ad84){if(_0x10ad84&&_0x10ad84[_0xd495('0x90')]===0x0){return db['UserProfileResource']['create']({'name':_0x3a5266[_0xd495('0x2c')],'resourceId':_0x3a5266['id'],'type':_0x10ad84[_0xd495('0x2c')],'sectionId':_0x10ad84['id']},{})['then'](function(){return _0x233e18;});}else{return _0x233e18;}})[_0xd495('0x46')](function(_0x377a98){logger[_0xd495('0x2b')](_0xd495('0x91'),_0x377a98);throw _0x377a98;});}return _0x233e18;})['then'](respondWithResult(_0x202367,null))[_0xd495('0x46')](handleError(_0x202367,null));}});}catch(_0x154925){_0x202367[_0xd495('0x1b')](0x1f4)[_0xd495('0x2d')](_0x154925);}};function removeReferences(_0x12a320,_0x42ff1b){try{if(_0x12a320){fs[_0xd495('0x61')](_0x12a320);logger['info'](_0xd495('0x92'));}if(_0x42ff1b){rimraf(_0x42ff1b,function(){});logger[_0xd495('0x62')]('Extracted\x20folder\x20removed');}}catch(_0xf473a4){logger[_0xd495('0x2b')](_0xf473a4);}}exports[_0xd495('0x93')]=function(_0x557ea8,_0x1c5a36,_0x2f397f){return db['Plugin'][_0xd495('0x4b')]({'where':{'id':_0x557ea8['params']['id']}})[_0xd495('0x25')](handleEntityNotFound(_0x1c5a36,null))['then'](saveUpdates(_0x557ea8[_0xd495('0x8b')],null))[_0xd495('0x25')](respondWithResult(_0x1c5a36,null))[_0xd495('0x46')](handleError(_0x1c5a36,null));};exports['delete']=function(_0x348993,_0x354eb9,_0x526bc8){return db[_0xd495('0x2f')][_0xd495('0x4b')]({'where':{'id':_0x348993['params']['id']}})['then'](function(_0x196a97){if(_0x196a97){return _0x196a97[_0xd495('0x26')]();}})[_0xd495('0x25')](function(_0x5b86cc){rimraf(path[_0xd495('0x4d')](config[_0xd495('0x4e')],_0xd495('0x4f'),path[_0xd495('0x59')](_0x5b86cc[_0xd495('0x5')])),function(){});return _0x5b86cc;})[_0xd495('0x25')](handleEntityNotFound(_0x354eb9,null))['then'](respondWithStatusCode(_0x354eb9,null))[_0xd495('0x46')](handleError(_0x354eb9,null));};exports[_0xd495('0x94')]=function(_0x4004ee,_0x56308e,_0x4febf3){return BPromise[_0xd495('0x95')]()[_0xd495('0x25')](function(){if(!_0x4004ee[_0xd495('0x35')]['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x4004ee[_0xd495('0x35')]['port']){throw new Error(_0xd495('0x96'));}var _0xf1d04=_0x4004ee['query'][_0xd495('0x97')]?_0x4004ee['query']['hostname']+':'+_0x4004ee[_0xd495('0x35')][_0xd495('0x98')]:'http://localhost:'+_0x4004ee[_0xd495('0x35')][_0xd495('0x98')];var _0x10d5a9=_0x4004ee[_0xd495('0x35')][_0xd495('0x22')]?_0x4004ee[_0xd495('0x35')]['json']:!![];var _0x3db5a0=_0x4004ee[_0xd495('0x35')][_0xd495('0x99')]?_0x4004ee[_0xd495('0x35')]['encoding']:null;var _0x13082b={'method':_0x4004ee['method'],'uri':util['format']('%s%s',_0xf1d04,_0x4004ee[_0xd495('0x35')][_0xd495('0x5')]),'json':_0x10d5a9,'resolveWithFullResponse':!![],'encoding':_0x3db5a0,'qs':_0x4004ee['query']};if(_0x4004ee[_0xd495('0x9a')]){_0x13082b['headers']=_0x4004ee['headers'];if(_0x13082b[_0xd495('0x9a')][_0xd495('0x9b')]){delete _0x13082b['headers'][_0xd495('0x9b')];}}if(_0x13082b[_0xd495('0x9a')]['content-type']){delete _0x13082b[_0xd495('0x9a')]['content-type'];}return rp(_0x13082b);})[_0xd495('0x25')](function(_0x274c25){if(_0x274c25){_0x56308e[_0xd495('0x21')](_0x274c25['headers']);logger[_0xd495('0x62')](_0x274c25['body']);if(_[_0xd495('0x9c')](_0x4004ee['query']['path'],_0xd495('0x5f'))&&_0x274c25[_0xd495('0x9d')]==0x1f4){return _0x56308e[_0xd495('0x2a')](_0x274c25['statusCode']);}else{return _0x56308e[_0xd495('0x1b')](_0x274c25[_0xd495('0x9d')])['send'](_0x274c25[_0xd495('0x8b')]);}}else{return _0x56308e[_0xd495('0x2a')](0xc8);}})[_0xd495('0x46')](handleError(_0x56308e,null));};exports[_0xd495('0x9e')]=function(_0x452b87,_0x213c5b,_0x28dc2e){return BPromise['resolve']()[_0xd495('0x25')](function(){if(!_0x452b87['query'][_0xd495('0x5')]){throw new Error(_0xd495('0x9f'));}if(!_0x452b87[_0xd495('0x35')][_0xd495('0x98')]){throw new Error(_0xd495('0x96'));}var _0x394e76=_0x452b87[_0xd495('0x35')][_0xd495('0x97')]?_0x452b87[_0xd495('0x35')][_0xd495('0x97')]+':'+_0x452b87['query']['port']:'http://localhost:'+_0x452b87['query'][_0xd495('0x98')];var _0x216105=_0x452b87[_0xd495('0x35')]['json']?_0x452b87[_0xd495('0x35')][_0xd495('0x22')]:!![];var _0xb40df8=_0x452b87[_0xd495('0x35')]['encoding']?_0x452b87['query'][_0xd495('0x99')]:null;var _0x2f3c8a={'method':_0x452b87[_0xd495('0xa0')],'uri':util[_0xd495('0x60')](_0xd495('0xa1'),_0x394e76,_0x452b87[_0xd495('0x35')][_0xd495('0x5')]),'json':_0x216105,'resolveWithFullResponse':!![],'encoding':_0xb40df8,'body':_0x452b87['body']};if(_0x452b87[_0xd495('0x9a')]){_0x2f3c8a['headers']=_0x452b87[_0xd495('0x9a')];if(_0x2f3c8a[_0xd495('0x9a')][_0xd495('0x9b')]){delete _0x2f3c8a[_0xd495('0x9a')]['content-length'];}}if(_0x2f3c8a[_0xd495('0x9a')]['content-type']){delete _0x2f3c8a['headers']['content-type'];}return rp(_0x2f3c8a);})[_0xd495('0x25')](function(_0x395929){if(_0x395929){_0x213c5b[_0xd495('0x21')](_0x395929[_0xd495('0x9a')]);logger['info'](_0x395929['body']);return _0x213c5b[_0xd495('0x1b')](_0x395929[_0xd495('0x9d')])[_0xd495('0x2d')](_0x395929[_0xd495('0x8b')]);}else{return _0x213c5b[_0xd495('0x2a')](0xc8);}})[_0xd495('0x46')](handleError(_0x213c5b,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index cc58efe..ab8a732 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 _0x565f=['Plugin','setMaxListeners','update','remove','hasOwnProperty','exports','../../mysqldb'];(function(_0x21e79a,_0x5a7990){var _0x506c02=function(_0x566c95){while(--_0x566c95){_0x21e79a['push'](_0x21e79a['shift']());}};_0x506c02(++_0x5a7990);}(_0x565f,0x68));var _0xf565=function(_0x52e74e,_0x50c3b3){_0x52e74e=_0x52e74e-0x0;var _0x55c576=_0x565f[_0x52e74e];return _0x55c576;};'use strict';var EventEmitter=require('events');var Plugin=require(_0xf565('0x0'))['db'][_0xf565('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0xf565('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf565('0x3'),'afterDestroy':_0xf565('0x4')};function emitEvent(_0x42d01c){return function(_0x44400f,_0x35e885,_0x5da33f){PluginEvents['emit'](_0x42d01c+':'+_0x44400f['id'],_0x44400f);PluginEvents['emit'](_0x42d01c,_0x44400f);_0x5da33f(null);};}for(var e in events){if(events[_0xf565('0x5')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0xf565('0x6')]=PluginEvents; \ No newline at end of file +var _0x0b78=['hook','exports','../../mysqldb','Plugin','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x4b7f28,_0x27d23a){var _0xf5b553=function(_0x1cb9c1){while(--_0x1cb9c1){_0x4b7f28['push'](_0x4b7f28['shift']());}};_0xf5b553(++_0x27d23a);}(_0x0b78,0x1d6));var _0x80b7=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x0b78[_0x19950b];return _0x3c6b41;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x80b7('0x0'))['db'][_0x80b7('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x80b7('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x80b7('0x3'),'afterDestroy':_0x80b7('0x4')};function emitEvent(_0x4ad62b){return function(_0x58bc47,_0x5a6e91,_0x2b7f25){PluginEvents[_0x80b7('0x5')](_0x4ad62b+':'+_0x58bc47['id'],_0x58bc47);PluginEvents[_0x80b7('0x5')](_0x4ad62b,_0x58bc47);_0x2b7f25(null);};}for(var e in events){if(events[_0x80b7('0x6')](e)){var event=events[e];Plugin[_0x80b7('0x7')](e,emitEvent(event));}}module[_0x80b7('0x8')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 5ee757f..a8f5f51 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 _0xb2f4=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports','define','plugins','lodash'];(function(_0x5509f5,_0x4e6972){var _0xd9581c=function(_0x5cb864){while(--_0x5cb864){_0x5509f5['push'](_0x5509f5['shift']());}};_0xd9581c(++_0x4e6972);}(_0xb2f4,0x14f));var _0x4b2f=function(_0x1082ee,_0x18607a){_0x1082ee=_0x1082ee-0x0;var _0x88187e=_0xb2f4[_0x1082ee];return _0x88187e;};'use strict';var _=require(_0x4b2f('0x0'));var util=require(_0x4b2f('0x1'));var logger=require(_0x4b2f('0x2'))(_0x4b2f('0x3'));var moment=require(_0x4b2f('0x4'));var BPromise=require(_0x4b2f('0x5'));var rp=require(_0x4b2f('0x6'));var fs=require('fs');var path=require(_0x4b2f('0x7'));var rimraf=require(_0x4b2f('0x8'));var config=require(_0x4b2f('0x9'));var attributes=require(_0x4b2f('0xa'));module[_0x4b2f('0xb')]=function(_0x316ad4,_0x24ea9d){return _0x316ad4[_0x4b2f('0xc')]('Plugin',attributes,{'tableName':_0x4b2f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b87=['request-promise','path','../../config/environment','./plugin.attributes','exports','define','Plugin','plugins','lodash','util','../../config/logger','api','moment'];(function(_0x56f9e7,_0x1598c4){var _0x400704=function(_0x61e3b6){while(--_0x61e3b6){_0x56f9e7['push'](_0x56f9e7['shift']());}};_0x400704(++_0x1598c4);}(_0x3b87,0x7d));var _0x73b8=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x3b87[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x73b8('0x0'));var util=require(_0x73b8('0x1'));var logger=require(_0x73b8('0x2'))(_0x73b8('0x3'));var moment=require(_0x73b8('0x4'));var BPromise=require('bluebird');var rp=require(_0x73b8('0x5'));var fs=require('fs');var path=require(_0x73b8('0x6'));var rimraf=require('rimraf');var config=require(_0x73b8('0x7'));var attributes=require(_0x73b8('0x8'));module[_0x73b8('0x9')]=function(_0x218df6,_0x228de6){return _0x218df6[_0x73b8('0xa')](_0x73b8('0xb'),attributes,{'tableName':_0x73b8('0xc'),'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 c06fbfd..57afdea 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 _0x6777=['Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Plugin,\x20%s,\x20%s','info','result','catch','Plugin','create','body','options','then','CreatePlugin','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','localhost','socket.io-emitter','./plugin.socket','register','request','request\x20sent','debug'];(function(_0x5c99d9,_0x4b96b7){var _0x43d23a=function(_0xa9949a){while(--_0xa9949a){_0x5c99d9['push'](_0x5c99d9['shift']());}};_0x43d23a(++_0x4b96b7);}(_0x6777,0xb9));var _0x7677=function(_0x576d8a,_0x2d7bde){_0x576d8a=_0x576d8a-0x0;var _0x3dc3ef=_0x6777[_0x576d8a];return _0x3dc3ef;};'use strict';var _=require(_0x7677('0x0'));var util=require(_0x7677('0x1'));var moment=require(_0x7677('0x2'));var BPromise=require('bluebird');var rs=require(_0x7677('0x3'));var fs=require('fs');var Redis=require(_0x7677('0x4'));var db=require(_0x7677('0x5'))['db'];var utils=require(_0x7677('0x6'));var logger=require(_0x7677('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7677('0x8'));var client=jayson[_0x7677('0x9')][_0x7677('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x7677('0xb')],{'host':_0x7677('0xc'),'port':0x18eb});var socket=require(_0x7677('0xd'))(new Redis(config['redis']));require(_0x7677('0xe'))[_0x7677('0xf')](socket);function respondWithRpcPromise(_0xe5e745,_0x22d440,_0x4e916d){return new BPromise(function(_0x66edf7,_0x2097a1){return client[_0x7677('0x10')](_0xe5e745,_0x4e916d)['then'](function(_0x56f016){logger['info']('Plugin,\x20%s,\x20%s',_0x22d440,_0x7677('0x11'));logger[_0x7677('0x12')](_0x7677('0x13'),_0x22d440,_0x7677('0x11'),JSON[_0x7677('0x14')](_0x56f016));if(_0x56f016['error']){if(_0x56f016[_0x7677('0x15')][_0x7677('0x16')]===0x1f4){logger[_0x7677('0x15')]('Plugin,\x20%s,\x20%s',_0x22d440,_0x56f016[_0x7677('0x15')]['message']);return _0x2097a1(_0x56f016[_0x7677('0x15')][_0x7677('0x17')]);}logger['error'](_0x7677('0x18'),_0x22d440,_0x56f016[_0x7677('0x15')][_0x7677('0x17')]);return _0x66edf7(_0x56f016['error'][_0x7677('0x17')]);}else{logger[_0x7677('0x19')](_0x7677('0x18'),_0x22d440,'request\x20sent');_0x66edf7(_0x56f016[_0x7677('0x1a')][_0x7677('0x17')]);}})[_0x7677('0x1b')](function(_0x325fe9){logger[_0x7677('0x15')]('Plugin,\x20%s,\x20%s',_0x22d440,_0x325fe9);_0x2097a1(_0x325fe9);});});}exports['CreatePlugin']=function(_0x4be51c){var _0x27fa56=this;return new Promise(function(_0x383404,_0x5dd74d){return db[_0x7677('0x1c')][_0x7677('0x1d')](_0x4be51c[_0x7677('0x1e')],{'raw':_0x4be51c[_0x7677('0x1f')]?_0x4be51c[_0x7677('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x7677('0x20')](function(_0x293d0f){logger['info']('CreatePlugin',_0x4be51c);logger[_0x7677('0x12')](_0x7677('0x21'),_0x4be51c,JSON[_0x7677('0x14')](_0x293d0f));_0x383404(_0x293d0f);})['catch'](function(_0x1ef4aa){logger['error'](_0x7677('0x21'),_0x1ef4aa['message'],_0x4be51c);_0x5dd74d(_0x27fa56[_0x7677('0x15')](0x1f4,_0x1ef4aa[_0x7677('0x17')]));});});}; \ No newline at end of file +var _0x4ca7=['raw','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis','localhost','./plugin.socket','register','then','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CreatePlugin','Plugin','create','body','options'];(function(_0x45dd63,_0x4f3e49){var _0x2e5cc5=function(_0x1ba92d){while(--_0x1ba92d){_0x45dd63['push'](_0x45dd63['shift']());}};_0x2e5cc5(++_0x4f3e49);}(_0x4ca7,0x14b));var _0x74ca=function(_0x1b81ea,_0x120316){_0x1b81ea=_0x1b81ea-0x0;var _0x24a4a3=_0x4ca7[_0x1b81ea];return _0x24a4a3;};'use strict';var _=require('lodash');var util=require(_0x74ca('0x0'));var moment=require('moment');var BPromise=require(_0x74ca('0x1'));var rs=require(_0x74ca('0x2'));var fs=require('fs');var Redis=require(_0x74ca('0x3'));var db=require(_0x74ca('0x4'))['db'];var utils=require(_0x74ca('0x5'));var logger=require(_0x74ca('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x74ca('0x7'));var client=jayson['client'][_0x74ca('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0x74ca('0x9')],{'host':_0x74ca('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x74ca('0xb'))[_0x74ca('0xc')](socket);function respondWithRpcPromise(_0x5080e4,_0x49b05a,_0x2e8e45){return new BPromise(function(_0x54316a,_0x27cac0){return client['request'](_0x5080e4,_0x2e8e45)[_0x74ca('0xd')](function(_0x3ac614){logger['info'](_0x74ca('0xe'),_0x49b05a,_0x74ca('0xf'));logger[_0x74ca('0x10')](_0x74ca('0x11'),_0x49b05a,_0x74ca('0xf'),JSON[_0x74ca('0x12')](_0x3ac614));if(_0x3ac614[_0x74ca('0x13')]){if(_0x3ac614[_0x74ca('0x13')][_0x74ca('0x14')]===0x1f4){logger['error'](_0x74ca('0xe'),_0x49b05a,_0x3ac614['error'][_0x74ca('0x15')]);return _0x27cac0(_0x3ac614[_0x74ca('0x13')][_0x74ca('0x15')]);}logger[_0x74ca('0x13')]('Plugin,\x20%s,\x20%s',_0x49b05a,_0x3ac614[_0x74ca('0x13')][_0x74ca('0x15')]);return _0x54316a(_0x3ac614['error'][_0x74ca('0x15')]);}else{logger[_0x74ca('0x16')](_0x74ca('0xe'),_0x49b05a,_0x74ca('0xf'));_0x54316a(_0x3ac614[_0x74ca('0x17')][_0x74ca('0x15')]);}})['catch'](function(_0x614d69){logger[_0x74ca('0x13')]('Plugin,\x20%s,\x20%s',_0x49b05a,_0x614d69);_0x27cac0(_0x614d69);});});}exports[_0x74ca('0x18')]=function(_0x514996){var _0x2c1d40=this;return new Promise(function(_0x252c5b,_0x47c92a){return db[_0x74ca('0x19')][_0x74ca('0x1a')](_0x514996[_0x74ca('0x1b')],{'raw':_0x514996[_0x74ca('0x1c')]?_0x514996[_0x74ca('0x1c')][_0x74ca('0x1d')]===undefined?!![]:![]:!![]})[_0x74ca('0xd')](function(_0x379774){logger[_0x74ca('0x16')](_0x74ca('0x18'),_0x514996);logger[_0x74ca('0x10')](_0x74ca('0x18'),_0x514996,JSON[_0x74ca('0x12')](_0x379774));_0x252c5b(_0x379774);})['catch'](function(_0x422e7f){logger[_0x74ca('0x13')](_0x74ca('0x18'),_0x422e7f[_0x74ca('0x15')],_0x514996);_0x47c92a(_0x2c1d40[_0x74ca('0x13')](0x1f4,_0x422e7f[_0x74ca('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index d2b5aad..ff5fefe 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 _0x4e61=['./plugin.events','save','remove','removeListener','plugin:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4e61,0x186));var _0x14e6=function(_0x448f8,_0x2aa1d7){_0x448f8=_0x448f8-0x0;var _0xa73126=_0x4e61[_0x448f8];return _0xa73126;};'use strict';var PluginEvents=require(_0x14e6('0x0'));var events=[_0x14e6('0x1'),_0x14e6('0x2'),'update'];function createListener(_0x46d7d4,_0x195894){return function(_0x5c7517){_0x195894['emit'](_0x46d7d4,_0x5c7517);};}function removeListener(_0x42fcd4,_0x11a895){return function(){PluginEvents[_0x14e6('0x3')](_0x42fcd4,_0x11a895);};}exports['register']=function(_0x4d2cc0){for(var _0x224145=0x0,_0x54f709=events['length'];_0x224145<_0x54f709;_0x224145++){var _0x7a44c9=events[_0x224145];var _0x1937f7=createListener(_0x14e6('0x4')+_0x7a44c9,_0x4d2cc0);PluginEvents['on'](_0x7a44c9,_0x1937f7);}}; \ No newline at end of file +var _0xe9d5=['length','plugin:','remove','emit','removeListener','register'];(function(_0x1ec2b1,_0x55d177){var _0xe9439d=function(_0x14cdd7){while(--_0x14cdd7){_0x1ec2b1['push'](_0x1ec2b1['shift']());}};_0xe9439d(++_0x55d177);}(_0xe9d5,0x1dc));var _0x5e9d=function(_0x20e555,_0x40aea6){_0x20e555=_0x20e555-0x0;var _0x182077=_0xe9d5[_0x20e555];return _0x182077;};'use strict';var PluginEvents=require('./plugin.events');var events=['save',_0x5e9d('0x0'),'update'];function createListener(_0x1b4e6e,_0x1bea99){return function(_0x2356d8){_0x1bea99[_0x5e9d('0x1')](_0x1b4e6e,_0x2356d8);};}function removeListener(_0x48c3a8,_0x2fc68b){return function(){PluginEvents[_0x5e9d('0x2')](_0x48c3a8,_0x2fc68b);};}exports[_0x5e9d('0x3')]=function(_0x2119ac){for(var _0xe14336=0x0,_0x208335=events[_0x5e9d('0x4')];_0xe14336<_0x208335;_0xe14336++){var _0x2feda2=events[_0xe14336];var _0x19733f=createListener(_0x5e9d('0x5')+_0x2feda2,_0x2119ac);PluginEvents['on'](_0x2feda2,_0x19733f);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 9dd21e5..77bc669 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(_0x558050,_0x174ec4){var _0x3ee149=function(_0x22be0f){while(--_0x22be0f){_0x558050['push'](_0x558050['shift']());}};_0x3ee149(++_0x174ec4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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(_0x1994c9,_0x4b9cb5){var _0x295b86=function(_0xdefe19){while(--_0xdefe19){_0x1994c9['push'](_0x1994c9['shift']());}};_0x295b86(++_0x4b9cb5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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 47735b5..2e1aabf 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 _0xc788=['body','script','join','../../files/plugins','chdir','dirname','start','dump','send','update','stop','hasOwnProperty','Unknown\x20status','params','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','child_process','exec','bluebird','sendStatus','status','error','stack','name','info','index','list','then','reject','motion2','catch','show','describe'];(function(_0x2b4cd0,_0x457878){var _0x474616=function(_0x435315){while(--_0x435315){_0x2b4cd0['push'](_0x2b4cd0['shift']());}};_0x474616(++_0x457878);}(_0xc788,0xc4));var _0x8c78=function(_0x4de3ae,_0x4c2d83){_0x4de3ae=_0x4de3ae-0x0;var _0x264e7c=_0xc788[_0x4de3ae];return _0x264e7c;};'use strict';var _=require(_0x8c78('0x0'));var pm2=require(_0x8c78('0x1'));var logger=require(_0x8c78('0x2'))('api');var path=require('path');var exec=require(_0x8c78('0x3'))[_0x8c78('0x4')];var BPromise=require(_0x8c78('0x5'));function handleEntityNotFound(_0x1d0670,_0x386f0a){return function(_0x5498f9){if(!_0x5498f9){_0x1d0670[_0x8c78('0x6')](0x194);;}return _0x5498f9;};}function respondWithResult(_0x4555da,_0x329152){_0x329152=_0x329152||0xc8;return function(_0x1ac27f){if(_0x1ac27f){return _0x4555da[_0x8c78('0x7')](_0x329152)['json'](_0x1ac27f);}return null;};}function handleError(_0x247188,_0x299d9d){_0x299d9d=_0x299d9d||0x1f4;return function(_0x9bc075){logger[_0x8c78('0x8')](_0x9bc075[_0x8c78('0x9')]);if(_0x9bc075[_0x8c78('0xa')]){delete _0x9bc075['name'];}_0x247188[_0x8c78('0x7')](_0x299d9d)['send'](_0x9bc075);};}function execChildProcess(){return new BPromise(function(_0x3d55f0,_0x45935a){exec('npm\x20install',function(_0x1a05a7,_0x95e78e,_0x5ee642){logger[_0x8c78('0xb')](_0x95e78e);logger['info'](_0x5ee642);if(_0x1a05a7){logger['error'](_0x1a05a7);return _0x45935a(_0x1a05a7);}return _0x3d55f0(_0x95e78e);});});}exports[_0x8c78('0xc')]=function(_0x1b1d0e,_0x26178c){return pm2[_0x8c78('0xd')]()[_0x8c78('0xe')](function(_0x3d1306){if(_0x3d1306){var _0xe5f8ae=_[_0x8c78('0xf')](_0x3d1306,function(_0x2f44af){return _0x2f44af[_0x8c78('0xa')]==='express'||_0x2f44af[_0x8c78('0xa')]===_0x8c78('0x10');});return{'rows':_0xe5f8ae,'count':_0xe5f8ae['length']};}return null;})[_0x8c78('0xe')](respondWithResult(_0x26178c,null))[_0x8c78('0x11')](handleError(_0x26178c,null));};exports[_0x8c78('0x12')]=function(_0x23824e,_0x2a982c){return pm2[_0x8c78('0x13')](_0x23824e['params']['id'])['then'](respondWithResult(_0x2a982c,null))[_0x8c78('0xe')](handleEntityNotFound(_0x2a982c,null))['catch'](handleError(_0x2a982c,null));};exports['create']=function(_0xece4f0,_0x56c191){if(_0xece4f0[_0x8c78('0x14')][_0x8c78('0xa')]&&_0xece4f0['body'][_0x8c78('0x15')]){var _0x5b111b=path[_0x8c78('0x16')](__dirname,_0x8c78('0x17'),_0xece4f0['body'][_0x8c78('0x15')]);var _0x188cc3=process['cwd']();process[_0x8c78('0x18')](path[_0x8c78('0x19')](_0x5b111b));return execChildProcess()[_0x8c78('0xe')](function(_0x9581c6){process[_0x8c78('0x18')](_0x188cc3);return pm2[_0x8c78('0x1a')]({'name':_0xece4f0[_0x8c78('0x14')][_0x8c78('0xa')],'script':_0x5b111b});})[_0x8c78('0xe')](function(_0x4a7d20){pm2[_0x8c78('0x1b')]();return _0x4a7d20[0x0];})[_0x8c78('0xe')](respondWithResult(_0x56c191,0xc9))[_0x8c78('0x11')](handleError(_0x56c191,null));}else{return _0x56c191['status'](0x1f4)[_0x8c78('0x1c')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x8c78('0x1d')]=function(_0x24f9a7,_0x8d9ff9){if(_0x24f9a7['body']['id']){delete _0x24f9a7[_0x8c78('0x14')]['id'];}var _0x2568d5={'online':'restart','stopped':_0x8c78('0x1e')};if(_0x2568d5[_0x8c78('0x1f')](_0x24f9a7[_0x8c78('0x14')][_0x8c78('0x7')])){return pm2[_0x2568d5[_0x24f9a7[_0x8c78('0x14')][_0x8c78('0x7')]]](_0x24f9a7['params']['id'])[_0x8c78('0xe')](respondWithResult(_0x8d9ff9,0xc8))['catch'](handleError(_0x8d9ff9,null));}else{return _0x8d9ff9[_0x8c78('0x7')](0x1f4)[_0x8c78('0x1c')]({'message':_0x8c78('0x20')});}};exports['destroy']=function(_0x1f1a0c,_0x3816d2){if(_0x1f1a0c['body']['id']){delete _0x1f1a0c[_0x8c78('0x14')]['id'];}if(_0x1f1a0c[_0x8c78('0x21')]['id']){return pm2[_0x8c78('0x22')](_0x1f1a0c['params']['id'])[_0x8c78('0xe')](function(_0x63307e){pm2[_0x8c78('0x1b')]();return _0x63307e[0x0];})['then'](respondWithResult(_0x3816d2,null))[_0x8c78('0x11')](handleError(_0x3816d2,null));}else{return _0x3816d2[_0x8c78('0x7')](0x1f4)['send']({'message':_0x8c78('0x23')});}}; \ No newline at end of file +var _0x9aea=['join','../../files/plugins','start','dump','Missing\x20name\x20and/or\x20path','update','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/logger','path','child_process','bluebird','sendStatus','status','error','stack','name','send','info','index','list','then','express','motion2','length','catch','show','params','create','body','script'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x9aea,0xdd));var _0xa9ae=function(_0xcbd855,_0x38ee83){_0xcbd855=_0xcbd855-0x0;var _0x1ddd32=_0x9aea[_0xcbd855];return _0x1ddd32;};'use strict';var _=require(_0xa9ae('0x0'));var pm2=require('../../config/pm2');var logger=require(_0xa9ae('0x1'))('api');var path=require(_0xa9ae('0x2'));var exec=require(_0xa9ae('0x3'))['exec'];var BPromise=require(_0xa9ae('0x4'));function handleEntityNotFound(_0x115593,_0x41fb71){return function(_0x10f91d){if(!_0x10f91d){_0x115593[_0xa9ae('0x5')](0x194);;}return _0x10f91d;};}function respondWithResult(_0x56f942,_0x1aa3b9){_0x1aa3b9=_0x1aa3b9||0xc8;return function(_0x22734b){if(_0x22734b){return _0x56f942[_0xa9ae('0x6')](_0x1aa3b9)['json'](_0x22734b);}return null;};}function handleError(_0x1f2e4b,_0x3917f0){_0x3917f0=_0x3917f0||0x1f4;return function(_0x465bd2){logger[_0xa9ae('0x7')](_0x465bd2[_0xa9ae('0x8')]);if(_0x465bd2[_0xa9ae('0x9')]){delete _0x465bd2[_0xa9ae('0x9')];}_0x1f2e4b[_0xa9ae('0x6')](_0x3917f0)[_0xa9ae('0xa')](_0x465bd2);};}function execChildProcess(){return new BPromise(function(_0x5a8178,_0x3d400c){exec('npm\x20install',function(_0x2addd2,_0x226cf7,_0x112ab5){logger[_0xa9ae('0xb')](_0x226cf7);logger[_0xa9ae('0xb')](_0x112ab5);if(_0x2addd2){logger[_0xa9ae('0x7')](_0x2addd2);return _0x3d400c(_0x2addd2);}return _0x5a8178(_0x226cf7);});});}exports[_0xa9ae('0xc')]=function(_0x2b511a,_0x56de45){return pm2[_0xa9ae('0xd')]()[_0xa9ae('0xe')](function(_0x10882e){if(_0x10882e){var _0x3f7f61=_['reject'](_0x10882e,function(_0x28ce2d){return _0x28ce2d[_0xa9ae('0x9')]===_0xa9ae('0xf')||_0x28ce2d[_0xa9ae('0x9')]===_0xa9ae('0x10');});return{'rows':_0x3f7f61,'count':_0x3f7f61[_0xa9ae('0x11')]};}return null;})['then'](respondWithResult(_0x56de45,null))[_0xa9ae('0x12')](handleError(_0x56de45,null));};exports[_0xa9ae('0x13')]=function(_0x3e31d9,_0x4ac5a6){return pm2['describe'](_0x3e31d9[_0xa9ae('0x14')]['id'])['then'](respondWithResult(_0x4ac5a6,null))['then'](handleEntityNotFound(_0x4ac5a6,null))[_0xa9ae('0x12')](handleError(_0x4ac5a6,null));};exports[_0xa9ae('0x15')]=function(_0xbfd2ff,_0x42f961){if(_0xbfd2ff['body'][_0xa9ae('0x9')]&&_0xbfd2ff[_0xa9ae('0x16')][_0xa9ae('0x17')]){var _0x688153=path[_0xa9ae('0x18')](__dirname,_0xa9ae('0x19'),_0xbfd2ff[_0xa9ae('0x16')]['script']);var _0xc021cf=process['cwd']();process['chdir'](path['dirname'](_0x688153));return execChildProcess()['then'](function(_0x1afd07){process['chdir'](_0xc021cf);return pm2[_0xa9ae('0x1a')]({'name':_0xbfd2ff['body'][_0xa9ae('0x9')],'script':_0x688153});})[_0xa9ae('0xe')](function(_0x93d637){pm2[_0xa9ae('0x1b')]();return _0x93d637[0x0];})[_0xa9ae('0xe')](respondWithResult(_0x42f961,0xc9))[_0xa9ae('0x12')](handleError(_0x42f961,null));}else{return _0x42f961[_0xa9ae('0x6')](0x1f4)['send']({'message':_0xa9ae('0x1c')});}};exports[_0xa9ae('0x1d')]=function(_0x2aac9e,_0xfe9ef1){if(_0x2aac9e[_0xa9ae('0x16')]['id']){delete _0x2aac9e[_0xa9ae('0x16')]['id'];}var _0xb12fa8={'online':'restart','stopped':'stop'};if(_0xb12fa8[_0xa9ae('0x1e')](_0x2aac9e[_0xa9ae('0x16')][_0xa9ae('0x6')])){return pm2[_0xb12fa8[_0x2aac9e[_0xa9ae('0x16')][_0xa9ae('0x6')]]](_0x2aac9e['params']['id'])['then'](respondWithResult(_0xfe9ef1,0xc8))[_0xa9ae('0x12')](handleError(_0xfe9ef1,null));}else{return _0xfe9ef1[_0xa9ae('0x6')](0x1f4)[_0xa9ae('0xa')]({'message':_0xa9ae('0x1f')});}};exports[_0xa9ae('0x20')]=function(_0x36bc28,_0x5d0c84){if(_0x36bc28['body']['id']){delete _0x36bc28[_0xa9ae('0x16')]['id'];}if(_0x36bc28[_0xa9ae('0x14')]['id']){return pm2[_0xa9ae('0x21')](_0x36bc28[_0xa9ae('0x14')]['id'])[_0xa9ae('0xe')](function(_0x231152){pm2[_0xa9ae('0x1b')]();return _0x231152[0x0];})[_0xa9ae('0xe')](respondWithResult(_0x5d0c84,null))['catch'](handleError(_0x5d0c84,null));}else{return _0x5d0c84[_0xa9ae('0x6')](0x1f4)['send']({'message':_0xa9ae('0x22')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index d471215..5f2c03b 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 _0x6a18=['/queues','getQueues','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./realtime.controller','get'];(function(_0x50c447,_0xa1a0a5){var _0x191721=function(_0x52323e){while(--_0x52323e){_0x50c447['push'](_0x50c447['shift']());}};_0x191721(++_0xa1a0a5);}(_0x6a18,0x114));var _0x86a1=function(_0x421c22,_0x138abb){_0x421c22=_0x421c22-0x0;var _0x82b03b=_0x6a18[_0x421c22];return _0x82b03b;};'use strict';var multer=require(_0x86a1('0x0'));var util=require(_0x86a1('0x1'));var path=require(_0x86a1('0x2'));var timeout=require(_0x86a1('0x3'));var express=require(_0x86a1('0x4'));var router=express[_0x86a1('0x5')]();var fs_extra=require(_0x86a1('0x6'));var auth=require(_0x86a1('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x86a1('0x8'));router[_0x86a1('0x9')](_0x86a1('0xa'),auth['isAuthenticated'](),controller[_0x86a1('0xb')]);module[_0x86a1('0xc')]=router; \ No newline at end of file +var _0xb9a0=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./realtime.controller','/queues','isAuthenticated','getQueues','exports','multer','util'];(function(_0x10aab9,_0xa3822a){var _0x751408=function(_0x356f8b){while(--_0x356f8b){_0x10aab9['push'](_0x10aab9['shift']());}};_0x751408(++_0xa3822a);}(_0xb9a0,0x186));var _0x0b9a=function(_0x1a9ca4,_0x5115db){_0x1a9ca4=_0x1a9ca4-0x0;var _0x19a2c2=_0xb9a0[_0x1a9ca4];return _0x19a2c2;};'use strict';var multer=require(_0x0b9a('0x0'));var util=require(_0x0b9a('0x1'));var path=require(_0x0b9a('0x2'));var timeout=require('connect-timeout');var express=require(_0x0b9a('0x3'));var router=express[_0x0b9a('0x4')]();var fs_extra=require(_0x0b9a('0x5'));var auth=require(_0x0b9a('0x6'));var interaction=require(_0x0b9a('0x7'));var config=require(_0x0b9a('0x8'));var controller=require(_0x0b9a('0x9'));router['get'](_0x0b9a('0xa'),auth[_0x0b9a('0xb')](),controller[_0x0b9a('0xc')]);module[_0x0b9a('0xd')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index ebadbf2..606bc5c 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 _0xa1d1=['client','http','request','then','request\x20sent','debug','stringify','error','code','Realtime,\x20%s,\x20%s','message','result','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','stack','name','getQueues','mail','chat','sms','openchannel','fax','whatsapp','voice','resolve','query','channel','includes','toLowerCase','startCase','Queue','map','rawAttributes','fieldName','key','user','type','outbound','QueueCampaigns','Queues','findAndCountAll','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','loggedIn','available','waiting','talking','paused','push','pTalking','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','dialPredictiveInterval','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','rows','loggedInDb','agents','find','merge','pick','getAgents','online','length','UserId','QueueId','Pause','findAll','agent','all','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','jayson/promise'];(function(_0x20d6f0,_0x33e54c){var _0x105ceb=function(_0x4927e9){while(--_0x4927e9){_0x20d6f0['push'](_0x20d6f0['shift']());}};_0x105ceb(++_0x33e54c);}(_0xa1d1,0x1aa));var _0x1a1d=function(_0x1e6a71,_0x37927c){_0x1e6a71=_0x1e6a71-0x0;var _0x144d85=_0xa1d1[_0x1e6a71];return _0x144d85;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1a1d('0x0'));var zipdir=require(_0x1a1d('0x1'));var jsonpatch=require(_0x1a1d('0x2'));var rp=require(_0x1a1d('0x3'));var moment=require(_0x1a1d('0x4'));var BPromise=require(_0x1a1d('0x5'));var Mustache=require(_0x1a1d('0x6'));var util=require(_0x1a1d('0x7'));var path=require('path');var sox=require(_0x1a1d('0x8'));var csv=require(_0x1a1d('0x9'));var ejs=require(_0x1a1d('0xa'));var fs=require('fs');var fs_extra=require(_0x1a1d('0xb'));var _=require(_0x1a1d('0xc'));var squel=require(_0x1a1d('0xd'));var crypto=require(_0x1a1d('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1a1d('0x9'));var querystring=require('querystring');var Papa=require(_0x1a1d('0xf'));var Redis=require('ioredis');var authService=require(_0x1a1d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1a1d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1a1d('0x12'));var utils=require('../../config/utils');var config=require(_0x1a1d('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x1a1d('0x14'))['db'];var jayson=require(_0x1a1d('0x15'));var client=jayson[_0x1a1d('0x16')]['http']({'port':0x232a});var routingClient=jayson[_0x1a1d('0x16')][_0x1a1d('0x17')]({'port':0x232c});function respondWithRpcPromise(_0xa7c36b,_0x1664be,_0xd8585f,_0x16e857){return new BPromise(function(_0x2897b7,_0x37b88d){var _0x49814e=_0x16e857||client;return _0x49814e[_0x1a1d('0x18')](_0xa7c36b,_0xd8585f)[_0x1a1d('0x19')](function(_0x18ae93){logger['info']('Realtime,\x20%s,\x20%s',_0x1664be,_0x1a1d('0x1a'));logger[_0x1a1d('0x1b')]('Realtime,\x20%s,\x20%s,\x20%s',_0x1664be,_0x1a1d('0x1a'),JSON[_0x1a1d('0x1c')](_0x18ae93));if(_0x18ae93[_0x1a1d('0x1d')]){if(_0x18ae93['error'][_0x1a1d('0x1e')]===0x1f4){logger['error'](_0x1a1d('0x1f'),_0x1664be,_0x18ae93[_0x1a1d('0x1d')]['message']);return _0x37b88d(_0x18ae93['error'][_0x1a1d('0x20')]);}logger['error'](_0x1a1d('0x1f'),_0x1664be,_0x18ae93['error']['message']);return _0x2897b7(_0x18ae93[_0x1a1d('0x1d')]['message']);}else{logger['info'](_0x1a1d('0x1f'),_0x1664be,_0x1a1d('0x1a'));_0x2897b7(_0x18ae93[_0x1a1d('0x21')][_0x1a1d('0x20')]);}})['catch'](function(_0x48d136){logger[_0x1a1d('0x1d')]('Realtime,\x20%s,\x20%s',_0x1664be,_0x48d136);_0x37b88d(_0x48d136);});});}function respondWithStatusCode(_0x2efedc,_0x28c041){_0x28c041=_0x28c041||0xcc;return function(_0x2dc18a){if(_0x2dc18a){return _0x2efedc[_0x1a1d('0x22')](_0x28c041);}return _0x2efedc['status'](_0x28c041)[_0x1a1d('0x23')]();};}function respondWithResult(_0x115a9c,_0x4f4d72){_0x4f4d72=_0x4f4d72||0xc8;return function(_0x3ad294){if(_0x3ad294){return _0x115a9c[_0x1a1d('0x24')](_0x4f4d72)[_0x1a1d('0x25')](_0x3ad294);}};}function respondWithFilteredResult(_0x1e791c,_0x114af6){return function(_0x45d083){if(_0x45d083){var _0x368afa=typeof _0x114af6[_0x1a1d('0x26')]===_0x1a1d('0x27')&&typeof _0x114af6[_0x1a1d('0x28')]==='undefined';var _0x20638c=_0x45d083[_0x1a1d('0x29')];var _0xdb68d8=_0x368afa?0x0:_0x114af6[_0x1a1d('0x26')];var _0x193924=_0x368afa?_0x45d083[_0x1a1d('0x29')]:_0x114af6['offset']+_0x114af6['limit'];var _0x2e00f4;if(_0x193924>=_0x20638c){_0x193924=_0x20638c;_0x2e00f4=0xc8;}else{_0x2e00f4=0xce;}_0x1e791c[_0x1a1d('0x24')](_0x2e00f4);return _0x1e791c[_0x1a1d('0x2a')](_0x1a1d('0x2b'),_0xdb68d8+'-'+_0x193924+'/'+_0x20638c)[_0x1a1d('0x25')](_0x45d083);}return null;};}function patchUpdates(_0x33db5e){return function(_0x4688d2){try{jsonpatch[_0x1a1d('0x2c')](_0x4688d2,_0x33db5e,!![]);}catch(_0x32540d){return BPromise[_0x1a1d('0x2d')](_0x32540d);}return _0x4688d2[_0x1a1d('0x2e')]();};}function saveUpdates(_0x7ec22d,_0x1ecb00){return function(_0x44bfdf){if(_0x44bfdf){return _0x44bfdf['update'](_0x7ec22d)[_0x1a1d('0x19')](function(_0x2f7473){return _0x2f7473;});}return null;};}function removeEntity(_0x3ca3f0,_0x505def){return function(_0x3534b3){if(_0x3534b3){return _0x3534b3[_0x1a1d('0x2f')]()[_0x1a1d('0x19')](function(){_0x3ca3f0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ab8bf,_0x3b45b5){return function(_0x53640a){if(!_0x53640a){_0x1ab8bf[_0x1a1d('0x22')](0x194);}return _0x53640a;};}function handleError(_0x15b5aa,_0x4fcf3d){_0x4fcf3d=_0x4fcf3d||0x1f4;return function(_0x2c70b1){logger[_0x1a1d('0x1d')](_0x2c70b1[_0x1a1d('0x30')]);if(_0x2c70b1['name']){delete _0x2c70b1[_0x1a1d('0x31')];}_0x15b5aa[_0x1a1d('0x24')](_0x4fcf3d)['send'](_0x2c70b1);};}exports[_0x1a1d('0x32')]=function(_0x46a8f5,_0x3c1b60){var _0x5c7e61=[_0x1a1d('0x33'),_0x1a1d('0x34'),_0x1a1d('0x35'),_0x1a1d('0x36'),_0x1a1d('0x37'),_0x1a1d('0x38'),_0x1a1d('0x39')];var _0x5a50bc={'count':0x0,'rows':[]},_0x2483ff={},_0x2f297b;Promise[_0x1a1d('0x3a')]()[_0x1a1d('0x19')](function(){if(_0x46a8f5[_0x1a1d('0x3b')][_0x1a1d('0x3c')]){if(!_[_0x1a1d('0x3d')](_0x5c7e61,_0x46a8f5[_0x1a1d('0x3b')][_0x1a1d('0x3c')][_0x1a1d('0x3e')]()))throw new Error('Invalid\x20channel');_0x2f297b=_0x46a8f5[_0x1a1d('0x3b')][_0x1a1d('0x3c')][_0x1a1d('0x3e')]();}var _0x4ce89a=_[_0x1a1d('0x3f')](_0x2f297b)+_0x1a1d('0x40');var _0xd7a2fb=_[_0x1a1d('0x41')](db[_0x4ce89a][_0x1a1d('0x42')],function(_0x57d17f){return{'name':_0x57d17f[_0x1a1d('0x43')],'type':_0x57d17f['type'][_0x1a1d('0x44')]};});_0x2483ff=qs['getOptions'](_0xd7a2fb,_0x46a8f5);if(_0x46a8f5['user']['role']==='user'){var _0xe7d244={'params':{'id':_0x46a8f5[_0x1a1d('0x45')]['userProfileId']},'query':{'section':_0x2f297b===_0x1a1d('0x39')&&_0x46a8f5['query'][_0x1a1d('0x46')]===_0x1a1d('0x47')?_0x1a1d('0x48'):_[_0x1a1d('0x3f')](_0x2f297b)+_0x1a1d('0x49'),'type':_0x46a8f5['query']['type'],'nolimit':!![],'sort':'name','filter':_0x46a8f5['query']['filter']}};return db['UserProfile']['getResources'](_0xe7d244);}return db[_0x4ce89a][_0x1a1d('0x4a')](_0x2483ff);})[_0x1a1d('0x19')](function(_0x48fc2c){_0x5a50bc[_0x1a1d('0x29')]=_0x48fc2c[_0x1a1d('0x29')];var _0x2d03b4=_0x2f297b===_0x1a1d('0x39')?client:routingClient;return _0x2d03b4[_0x1a1d('0x18')](_[_0x1a1d('0x3f')](_0x2f297b)+_0x1a1d('0x49'),_0x46a8f5)['then'](function(_0x5bdd55){if(_0x5bdd55[_0x1a1d('0x1d')])throw new Error(util[_0x1a1d('0x4b')](_0x1a1d('0x4c'),_0x2f297b));var _0x13f914=_0x5bdd55[_0x1a1d('0x21')];var _0x52a92c=[_0x1a1d('0x4d'),_0x1a1d('0x4e'),_0x1a1d('0x4f'),_0x1a1d('0x50'),_0x1a1d('0x51')];if(_0x2f297b===_0x1a1d('0x39')&&_0x46a8f5[_0x1a1d('0x3b')]['type']===_0x1a1d('0x47')){_0x52a92c[_0x1a1d('0x52')](_0x1a1d('0x53'),'originated',_0x1a1d('0x20'),'dialActive',_0x1a1d('0x54'),_0x1a1d('0x55'),_0x1a1d('0x56'),_0x1a1d('0x57'),_0x1a1d('0x58'),_0x1a1d('0x59'),'erlangAbandonmentRate','erlangBusyFactor',_0x1a1d('0x5a'),'dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold',_0x1a1d('0x5b'),'predictiveIntervalTotalCalls',_0x1a1d('0x5c'),'predictiveIntervalDroppedCallsTimeout',_0x1a1d('0x5d'),_0x1a1d('0x5e'),_0x1a1d('0x5f'));}var _0x5ba94f=_0x48fc2c[_0x1a1d('0x60')][_0x1a1d('0x41')](function(_0x5d47e2){var _0x58a11f=_0x5d47e2['get']({'plain':!![]});_0x58a11f['paused']=0x0;_0x58a11f[_0x1a1d('0x61')]=0x0;_0x58a11f['loggedIn']=0x0;_0x58a11f['available']=0x0;_0x58a11f['paused']=0x0;_0x58a11f['waiting']=0x0;if(_0x2f297b===_0x1a1d('0x39')){_0x58a11f[_0x1a1d('0x50')]=0x0;if(_0x46a8f5[_0x1a1d('0x3b')]['type']===_0x1a1d('0x47')){_0x58a11f[_0x1a1d('0x53')]=0x0;_0x58a11f['originated']=0x0;}}_0x58a11f[_0x1a1d('0x62')]=[];var _0x14dfbb=_[_0x1a1d('0x63')](_0x13f914[_0x1a1d('0x60')],['id',_0x58a11f['id']]);if(_0x14dfbb)_[_0x1a1d('0x64')](_0x58a11f,_[_0x1a1d('0x65')](_0x14dfbb,_0x52a92c));if(_0x2f297b==='voice'){return _0x5d47e2[_0x1a1d('0x66')]({'attributes':['id',_0x1a1d('0x31'),_0x1a1d('0x67')],'joinTableAttributes':[],'raw':!![]})['then'](function(_0x3746f8){return _0x5d47e2['getMembers']({'raw':!![]})[_0x1a1d('0x19')](function(_0xc672b){for(var _0x2a19ae=0x0;_0x2a19ae<_0x3746f8[_0x1a1d('0x68')];_0x2a19ae++){var _0x28bb3e=_['find'](_0xc672b,[_0x1a1d('0x69'),_0x3746f8[_0x2a19ae]['id']]);var _0x20d8da={'id':_0x3746f8[_0x2a19ae]['id'],'name':_0x3746f8[_0x2a19ae]['name'],'online':Boolean(_0x3746f8[_0x2a19ae][_0x1a1d('0x67')]),'paused':_0x28bb3e?Boolean(_0x28bb3e[_0x1a1d('0x51')]):![]};if(_0x20d8da[_0x1a1d('0x67')])_0x58a11f[_0x1a1d('0x61')]++;if(_0x20d8da[_0x1a1d('0x51')])_0x58a11f[_0x1a1d('0x51')]++;_0x58a11f['agents']['push'](_0x20d8da);}return _0x58a11f;});});}else{var _0x224126='User'+_[_0x1a1d('0x3f')](_0x2f297b)+_0x1a1d('0x40');var _0x498c39=_[_0x1a1d('0x3f')](_0x2f297b)+_0x1a1d('0x6a');var _0x53375f=_0x2f297b+_0x1a1d('0x6b');return db[_0x224126]['findAll']({'where':{['userQueueKey']:_0x5d47e2['id']},'raw':!![]})[_0x1a1d('0x19')](function(_0x7cc89){return db['User'][_0x1a1d('0x6c')]({'attributes':['id',_0x1a1d('0x31'),'online',_0x53375f],'where':{'id':_['map'](_0x7cc89,'UserId'),'role':_0x1a1d('0x6d')},'raw':!![]});})['then'](function(_0x2f89fb){for(var _0x171ee2=0x0;_0x171ee2<_0x2f89fb[_0x1a1d('0x68')];_0x171ee2++){var _0x475cdd={'id':_0x2f89fb[_0x171ee2]['id'],'name':_0x2f89fb[_0x171ee2][_0x1a1d('0x31')],'online':Boolean(_0x2f89fb[_0x171ee2]['online']),'paused':Boolean(_0x2f89fb[_0x171ee2][_0x53375f])};if(_0x475cdd[_0x1a1d('0x67')])_0x58a11f[_0x1a1d('0x61')]++;if(_0x475cdd[_0x1a1d('0x51')])_0x58a11f[_0x1a1d('0x51')]++;_0x58a11f['agents'][_0x1a1d('0x52')](_0x475cdd);}return _0x58a11f;});}});return Promise[_0x1a1d('0x6e')](_0x5ba94f);});})[_0x1a1d('0x19')](function(_0x5661c0){_0x5a50bc[_0x1a1d('0x60')]=_0x5661c0;return _0x5a50bc;})[_0x1a1d('0x19')](respondWithFilteredResult(_0x3c1b60,_0x2483ff))[_0x1a1d('0x6f')](handleError(_0x3c1b60,null));}; \ No newline at end of file +var _0x1708=['Realtime,\x20%s,\x20%s','message','info','result','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','destroy','stack','name','getQueues','mail','openchannel','fax','whatsapp','voice','resolve','query','channel','includes','toLowerCase','Invalid\x20channel','startCase','Queue','map','fieldName','key','getOptions','userProfileId','type','QueueCampaigns','filter','UserProfile','getResources','findAndCountAll','Queues','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','loggedIn','available','waiting','talking','push','pTalking','originated','dialActive','dialMethod','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','get','loggedInDb','paused','outbound','agents','find','rows','pick','getAgents','online','getMembers','UserId','User','Pause','findAll','length','all','catch','eml-format','rimraf','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','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','jayson/promise','client','http','request','then','Realtime,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x2d88cf,_0x314bed){var _0x315537=function(_0x577a6d){while(--_0x577a6d){_0x2d88cf['push'](_0x2d88cf['shift']());}};_0x315537(++_0x314bed);}(_0x1708,0xcc));var _0x8170=function(_0x55754e,_0x286388){_0x55754e=_0x55754e-0x0;var _0x2e9948=_0x1708[_0x55754e];return _0x2e9948;};'use strict';var emlformat=require(_0x8170('0x0'));var rimraf=require(_0x8170('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8170('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x8170('0x3'));var util=require(_0x8170('0x4'));var path=require(_0x8170('0x5'));var sox=require(_0x8170('0x6'));var csv=require(_0x8170('0x7'));var ejs=require(_0x8170('0x8'));var fs=require('fs');var fs_extra=require(_0x8170('0x9'));var _=require(_0x8170('0xa'));var squel=require(_0x8170('0xb'));var crypto=require('crypto');var jsforce=require(_0x8170('0xc'));var deskjs=require(_0x8170('0xd'));var toCsv=require(_0x8170('0x7'));var querystring=require(_0x8170('0xe'));var Papa=require(_0x8170('0xf'));var Redis=require('ioredis');var authService=require(_0x8170('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8170('0x11'));var hardwareService=require(_0x8170('0x12'));var logger=require(_0x8170('0x13'))(_0x8170('0x14'));var utils=require(_0x8170('0x15'));var config=require(_0x8170('0x16'));var licenseUtil=require(_0x8170('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0x8170('0x18'));var client=jayson[_0x8170('0x19')][_0x8170('0x1a')]({'port':0x232a});var routingClient=jayson[_0x8170('0x19')][_0x8170('0x1a')]({'port':0x232c});function respondWithRpcPromise(_0x11eb67,_0x13aef7,_0x465178,_0x374080){return new BPromise(function(_0x4b765f,_0x14f7c8){var _0x1ebb2f=_0x374080||client;return _0x1ebb2f[_0x8170('0x1b')](_0x11eb67,_0x465178)[_0x8170('0x1c')](function(_0x5319d9){logger['info']('Realtime,\x20%s,\x20%s',_0x13aef7,'request\x20sent');logger['debug'](_0x8170('0x1d'),_0x13aef7,_0x8170('0x1e'),JSON[_0x8170('0x1f')](_0x5319d9));if(_0x5319d9[_0x8170('0x20')]){if(_0x5319d9[_0x8170('0x20')][_0x8170('0x21')]===0x1f4){logger[_0x8170('0x20')](_0x8170('0x22'),_0x13aef7,_0x5319d9[_0x8170('0x20')][_0x8170('0x23')]);return _0x14f7c8(_0x5319d9[_0x8170('0x20')]['message']);}logger[_0x8170('0x20')](_0x8170('0x22'),_0x13aef7,_0x5319d9[_0x8170('0x20')][_0x8170('0x23')]);return _0x4b765f(_0x5319d9[_0x8170('0x20')][_0x8170('0x23')]);}else{logger[_0x8170('0x24')](_0x8170('0x22'),_0x13aef7,_0x8170('0x1e'));_0x4b765f(_0x5319d9[_0x8170('0x25')][_0x8170('0x23')]);}})['catch'](function(_0x84751b){logger['error']('Realtime,\x20%s,\x20%s',_0x13aef7,_0x84751b);_0x14f7c8(_0x84751b);});});}function respondWithStatusCode(_0x2e89cb,_0xacd490){_0xacd490=_0xacd490||0xcc;return function(_0x22d73a){if(_0x22d73a){return _0x2e89cb[_0x8170('0x26')](_0xacd490);}return _0x2e89cb['status'](_0xacd490)['end']();};}function respondWithResult(_0x1fa107,_0xc45a0){_0xc45a0=_0xc45a0||0xc8;return function(_0xa582e5){if(_0xa582e5){return _0x1fa107[_0x8170('0x27')](_0xc45a0)[_0x8170('0x28')](_0xa582e5);}};}function respondWithFilteredResult(_0x5c44b8,_0x4de446){return function(_0xc4c3df){if(_0xc4c3df){var _0x4f0b70=typeof _0x4de446['offset']===_0x8170('0x29')&&typeof _0x4de446['limit']===_0x8170('0x29');var _0xc2a078=_0xc4c3df[_0x8170('0x2a')];var _0x388674=_0x4f0b70?0x0:_0x4de446[_0x8170('0x2b')];var _0x4fcf84=_0x4f0b70?_0xc4c3df[_0x8170('0x2a')]:_0x4de446['offset']+_0x4de446[_0x8170('0x2c')];var _0x573362;if(_0x4fcf84>=_0xc2a078){_0x4fcf84=_0xc2a078;_0x573362=0xc8;}else{_0x573362=0xce;}_0x5c44b8[_0x8170('0x27')](_0x573362);return _0x5c44b8[_0x8170('0x2d')](_0x8170('0x2e'),_0x388674+'-'+_0x4fcf84+'/'+_0xc2a078)[_0x8170('0x28')](_0xc4c3df);}return null;};}function patchUpdates(_0x544d6d){return function(_0x433a3b){try{jsonpatch['apply'](_0x433a3b,_0x544d6d,!![]);}catch(_0x3f88a0){return BPromise[_0x8170('0x2f')](_0x3f88a0);}return _0x433a3b[_0x8170('0x30')]();};}function saveUpdates(_0x196756,_0x32b77c){return function(_0x161797){if(_0x161797){return _0x161797[_0x8170('0x31')](_0x196756)[_0x8170('0x1c')](function(_0x30b6db){return _0x30b6db;});}return null;};}function removeEntity(_0x3bc6df,_0x3e8366){return function(_0x478f96){if(_0x478f96){return _0x478f96[_0x8170('0x32')]()['then'](function(){_0x3bc6df['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1694f3,_0x57bc6f){return function(_0x5b92b2){if(!_0x5b92b2){_0x1694f3[_0x8170('0x26')](0x194);}return _0x5b92b2;};}function handleError(_0x38449f,_0x3df15a){_0x3df15a=_0x3df15a||0x1f4;return function(_0x34c11f){logger['error'](_0x34c11f[_0x8170('0x33')]);if(_0x34c11f[_0x8170('0x34')]){delete _0x34c11f[_0x8170('0x34')];}_0x38449f[_0x8170('0x27')](_0x3df15a)['send'](_0x34c11f);};}exports[_0x8170('0x35')]=function(_0x52d8af,_0x3b8c2e){var _0x5d0e47=[_0x8170('0x36'),'chat','sms',_0x8170('0x37'),_0x8170('0x38'),_0x8170('0x39'),_0x8170('0x3a')];var _0x3b84e6={'count':0x0,'rows':[]},_0x58c12a={},_0x426245;Promise[_0x8170('0x3b')]()[_0x8170('0x1c')](function(){if(_0x52d8af[_0x8170('0x3c')][_0x8170('0x3d')]){if(!_[_0x8170('0x3e')](_0x5d0e47,_0x52d8af[_0x8170('0x3c')][_0x8170('0x3d')][_0x8170('0x3f')]()))throw new Error(_0x8170('0x40'));_0x426245=_0x52d8af['query'][_0x8170('0x3d')][_0x8170('0x3f')]();}var _0x21f588=_[_0x8170('0x41')](_0x426245)+_0x8170('0x42');var _0x52b066=_[_0x8170('0x43')](db[_0x21f588]['rawAttributes'],function(_0x3914fa){return{'name':_0x3914fa[_0x8170('0x44')],'type':_0x3914fa['type'][_0x8170('0x45')]};});_0x58c12a=qs[_0x8170('0x46')](_0x52b066,_0x52d8af);if(_0x52d8af['user']['role']==='user'){var _0x19c13e={'params':{'id':_0x52d8af['user'][_0x8170('0x47')]},'query':{'section':_0x426245===_0x8170('0x3a')&&_0x52d8af[_0x8170('0x3c')][_0x8170('0x48')]==='outbound'?_0x8170('0x49'):_['startCase'](_0x426245)+'Queues','type':_0x52d8af[_0x8170('0x3c')][_0x8170('0x48')],'nolimit':!![],'sort':_0x8170('0x34'),'filter':_0x52d8af['query'][_0x8170('0x4a')]}};return db[_0x8170('0x4b')][_0x8170('0x4c')](_0x19c13e);}return db[_0x21f588][_0x8170('0x4d')](_0x58c12a);})['then'](function(_0x4ea6f8){_0x3b84e6['count']=_0x4ea6f8[_0x8170('0x2a')];var _0x284f8a=_0x426245===_0x8170('0x3a')?client:routingClient;return _0x284f8a[_0x8170('0x1b')](_[_0x8170('0x41')](_0x426245)+_0x8170('0x4e'),_0x52d8af)[_0x8170('0x1c')](function(_0x4fcc39){if(_0x4fcc39[_0x8170('0x20')])throw new Error(util[_0x8170('0x4f')](_0x8170('0x50'),_0x426245));var _0x3a5ef6=_0x4fcc39[_0x8170('0x25')];var _0x585cf4=[_0x8170('0x51'),_0x8170('0x52'),_0x8170('0x53'),_0x8170('0x54'),'paused'];if(_0x426245===_0x8170('0x3a')&&_0x52d8af['query'][_0x8170('0x48')]==='outbound'){_0x585cf4[_0x8170('0x55')](_0x8170('0x56'),_0x8170('0x57'),'message',_0x8170('0x58'),_0x8170('0x59'),'Trunk',_0x8170('0x5a'),_0x8170('0x5b'),_0x8170('0x5c'),_0x8170('0x5d'),_0x8170('0x5e'),'erlangBusyFactor','dialPredictiveInterval',_0x8170('0x5f'),_0x8170('0x60'),'predictiveIntervalAvailable','predictiveIntervalTotalCalls',_0x8170('0x61'),_0x8170('0x62'),'predictiveIntervalDroppedCallsCallersExit',_0x8170('0x63'),_0x8170('0x64'));}var _0x52482c=_0x4ea6f8['rows']['map'](function(_0xd15ed9){var _0x42510b=_0xd15ed9[_0x8170('0x65')]({'plain':!![]});_0x42510b['paused']=0x0;_0x42510b[_0x8170('0x66')]=0x0;_0x42510b[_0x8170('0x51')]=0x0;_0x42510b[_0x8170('0x52')]=0x0;_0x42510b[_0x8170('0x67')]=0x0;_0x42510b['waiting']=0x0;if(_0x426245===_0x8170('0x3a')){_0x42510b[_0x8170('0x54')]=0x0;if(_0x52d8af['query'][_0x8170('0x48')]===_0x8170('0x68')){_0x42510b[_0x8170('0x56')]=0x0;_0x42510b[_0x8170('0x57')]=0x0;}}_0x42510b[_0x8170('0x69')]=[];var _0x2b9680=_[_0x8170('0x6a')](_0x3a5ef6[_0x8170('0x6b')],['id',_0x42510b['id']]);if(_0x2b9680)_['merge'](_0x42510b,_[_0x8170('0x6c')](_0x2b9680,_0x585cf4));if(_0x426245===_0x8170('0x3a')){return _0xd15ed9[_0x8170('0x6d')]({'attributes':['id',_0x8170('0x34'),_0x8170('0x6e')],'joinTableAttributes':[],'raw':!![]})[_0x8170('0x1c')](function(_0x403814){return _0xd15ed9[_0x8170('0x6f')]({'raw':!![]})[_0x8170('0x1c')](function(_0x62639b){for(var _0x12d017=0x0;_0x12d017<_0x403814['length'];_0x12d017++){var _0xb25a99=_['find'](_0x62639b,[_0x8170('0x70'),_0x403814[_0x12d017]['id']]);var _0x1ed5a7={'id':_0x403814[_0x12d017]['id'],'name':_0x403814[_0x12d017][_0x8170('0x34')],'online':Boolean(_0x403814[_0x12d017][_0x8170('0x6e')]),'paused':_0xb25a99?Boolean(_0xb25a99[_0x8170('0x67')]):![]};if(_0x1ed5a7['online'])_0x42510b[_0x8170('0x66')]++;if(_0x1ed5a7[_0x8170('0x67')])_0x42510b[_0x8170('0x67')]++;_0x42510b[_0x8170('0x69')]['push'](_0x1ed5a7);}return _0x42510b;});});}else{var _0x7796f4=_0x8170('0x71')+_['startCase'](_0x426245)+_0x8170('0x42');var _0x51a0d1=_[_0x8170('0x41')](_0x426245)+'QueueId';var _0x3529c2=_0x426245+_0x8170('0x72');return db[_0x7796f4][_0x8170('0x73')]({'where':{['userQueueKey']:_0xd15ed9['id']},'raw':!![]})[_0x8170('0x1c')](function(_0x6c3a9a){return db['User'][_0x8170('0x73')]({'attributes':['id','name',_0x8170('0x6e'),_0x3529c2],'where':{'id':_['map'](_0x6c3a9a,'UserId'),'role':'agent'},'raw':!![]});})[_0x8170('0x1c')](function(_0x49b2a7){for(var _0x28e9ac=0x0;_0x28e9ac<_0x49b2a7[_0x8170('0x74')];_0x28e9ac++){var _0x32b652={'id':_0x49b2a7[_0x28e9ac]['id'],'name':_0x49b2a7[_0x28e9ac][_0x8170('0x34')],'online':Boolean(_0x49b2a7[_0x28e9ac][_0x8170('0x6e')]),'paused':Boolean(_0x49b2a7[_0x28e9ac][_0x3529c2])};if(_0x32b652[_0x8170('0x6e')])_0x42510b['loggedInDb']++;if(_0x32b652[_0x8170('0x67')])_0x42510b[_0x8170('0x67')]++;_0x42510b[_0x8170('0x69')][_0x8170('0x55')](_0x32b652);}return _0x42510b;});}});return Promise[_0x8170('0x75')](_0x52482c);});})[_0x8170('0x1c')](function(_0x1a6331){_0x3b84e6[_0x8170('0x6b')]=_0x1a6331;return _0x3b84e6;})[_0x8170('0x1c')](respondWithFilteredResult(_0x3b8c2e,_0x58c12a))[_0x8170('0x76')](handleError(_0x3b8c2e,null));}; \ No newline at end of file diff --git a/server/api/realtime/realtime.model.js b/server/api/realtime/realtime.model.js index 71a99cc..bf7f1a0 100644 --- a/server/api/realtime/realtime.model.js +++ b/server/api/realtime/realtime.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7e06=['exports','define','lodash','util','api','moment','bluebird','path','rimraf'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7e06,0xec));var _0x67e0=function(_0x15022c,_0x44daae){_0x15022c=_0x15022c-0x0;var _0x81623a=_0x7e06[_0x15022c];return _0x81623a;};'use strict';var _=require(_0x67e0('0x0'));var util=require(_0x67e0('0x1'));var logger=require('../../config/logger')(_0x67e0('0x2'));var moment=require(_0x67e0('0x3'));var BPromise=require(_0x67e0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x67e0('0x5'));var rimraf=require(_0x67e0('0x6'));var config=require('../../config/environment');;module[_0x67e0('0x7')]=function(_0xdd536d,_0x2b5370){return _0xdd536d[_0x67e0('0x8')]('Realtime',[],{});}; \ No newline at end of file +var _0x327f=['api','moment','bluebird','path','../../config/environment','exports','define','util','../../config/logger'];(function(_0x108202,_0x5f1f3b){var _0x5e8f0a=function(_0x4cfe81){while(--_0x4cfe81){_0x108202['push'](_0x108202['shift']());}};_0x5e8f0a(++_0x5f1f3b);}(_0x327f,0x142));var _0xf327=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x327f[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require(_0xf327('0x0'));var logger=require(_0xf327('0x1'))(_0xf327('0x2'));var moment=require(_0xf327('0x3'));var BPromise=require(_0xf327('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf327('0x5'));var rimraf=require('rimraf');var config=require(_0xf327('0x6'));;module[_0xf327('0x7')]=function(_0x11d05e,_0x2e73b2){return _0x11d05e[_0xf327('0x8')]('Realtime',[],{});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 485e5b1..59b07a1 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(_0xf598c3,_0x4a943f){var _0x265335=function(_0x303c11){while(--_0x303c11){_0xf598c3['push'](_0xf598c3['shift']());}};_0x265335(++_0x4a943f);}(_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'));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(_0x51851c,_0x1a7c28){var _0x2a585b=function(_0x363278){while(--_0x363278){_0x51851c['push'](_0x51851c['shift']());}};_0x2a585b(++_0x1a7c28);}(_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 3cbc020..ff021fe 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 _0x304b=['INTEGER','STRING','DATE','exports'];(function(_0x3a90c5,_0xb5d6e6){var _0x64feba=function(_0x383109){while(--_0x383109){_0x3a90c5['push'](_0x3a90c5['shift']());}};_0x64feba(++_0xb5d6e6);}(_0x304b,0xfb));var _0xb304=function(_0x4aa18f,_0xbdb520){_0x4aa18f=_0x4aa18f-0x0;var _0x593b49=_0x304b[_0x4aa18f];return _0x593b49;};'use strict';var Sequelize=require('sequelize');module[_0xb304('0x0')]={'state':{'type':Sequelize[_0xb304('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xb304('0x2')]},'scheduledat':{'type':Sequelize[_0xb304('0x3')]},'uniqueid':{'type':Sequelize[_0xb304('0x2')]},'starttime':{'type':Sequelize[_0xb304('0x3')]},'responsetime':{'type':Sequelize[_0xb304('0x3')]},'ringtime':{'type':Sequelize[_0xb304('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xb304('0x2')]}}; \ No newline at end of file +var _0x29b1=['INTEGER','STRING','DATE'];(function(_0x1829c3,_0x103325){var _0x17df21=function(_0xf5bbfb){while(--_0xf5bbfb){_0x1829c3['push'](_0x1829c3['shift']());}};_0x17df21(++_0x103325);}(_0x29b1,0x13b));var _0x129b=function(_0x1b5aea,_0x3f04b7){_0x1b5aea=_0x1b5aea-0x0;var _0x15cfc6=_0x29b1[_0x1b5aea];return _0x15cfc6;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0x129b('0x0')](0x2)},'statedesc':{'type':Sequelize[_0x129b('0x1')]},'scheduledat':{'type':Sequelize[_0x129b('0x2')]},'uniqueid':{'type':Sequelize[_0x129b('0x1')]},'starttime':{'type':Sequelize[_0x129b('0x2')]},'responsetime':{'type':Sequelize[_0x129b('0x2')]},'ringtime':{'type':Sequelize[_0x129b('0x0')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x129b('0x1')]},'campaigntype':{'type':Sequelize[_0x129b('0x1')]},'membername':{'type':Sequelize[_0x129b('0x1')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 7fbe5c4..54d0503 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 _0x913a=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','define','ReportAgentPreview','report_agent_preview','util'];(function(_0x446a9b,_0x48468a){var _0x371972=function(_0x473733){while(--_0x473733){_0x446a9b['push'](_0x446a9b['shift']());}};_0x371972(++_0x48468a);}(_0x913a,0x175));var _0xa913=function(_0x232b3e,_0x5f368d){_0x232b3e=_0x232b3e-0x0;var _0x3dc3cf=_0x913a[_0x232b3e];return _0x3dc3cf;};'use strict';var _=require('lodash');var util=require(_0xa913('0x0'));var logger=require(_0xa913('0x1'))(_0xa913('0x2'));var moment=require(_0xa913('0x3'));var BPromise=require(_0xa913('0x4'));var rp=require(_0xa913('0x5'));var fs=require('fs');var path=require(_0xa913('0x6'));var rimraf=require(_0xa913('0x7'));var config=require('../../config/environment');var attributes=require('./reportAgentPreview.attributes');module['exports']=function(_0x3a6742,_0x5362e3){return _0x3a6742[_0xa913('0x8')](_0xa913('0x9'),attributes,{'tableName':_0xa913('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3de2=['../../config/logger','api','moment','bluebird','request-promise','path','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash'];(function(_0x21922a,_0x1ff195){var _0x975ddc=function(_0x5da191){while(--_0x5da191){_0x21922a['push'](_0x21922a['shift']());}};_0x975ddc(++_0x1ff195);}(_0x3de2,0x137));var _0x23de=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0x3de2[_0x4b73a2];return _0x383c66;};'use strict';var _=require(_0x23de('0x0'));var util=require('util');var logger=require(_0x23de('0x1'))(_0x23de('0x2'));var moment=require(_0x23de('0x3'));var BPromise=require(_0x23de('0x4'));var rp=require(_0x23de('0x5'));var fs=require('fs');var path=require(_0x23de('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x23de('0x7'));module[_0x23de('0x8')]=function(_0x3c76ac,_0x1052e4){return _0x3c76ac[_0x23de('0x9')](_0x23de('0xa'),attributes,{'tableName':_0x23de('0xb'),'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 996694d..bc75ff6 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 _0xb4ea=['error','code','message','catch','ReportAgentPreview','create','body','options','raw','CreateReportAgentPreview','stringify','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s'];(function(_0xa87486,_0x5ff890){var _0x4fc6d5=function(_0x1c85c8){while(--_0x1c85c8){_0xa87486['push'](_0xa87486['shift']());}};_0x4fc6d5(++_0x5ff890);}(_0xb4ea,0x14f));var _0xab4e=function(_0x379a9c,_0xaf3980){_0x379a9c=_0x379a9c-0x0;var _0x286e88=_0xb4ea[_0x379a9c];return _0x286e88;};'use strict';var _=require('lodash');var util=require(_0xab4e('0x0'));var moment=require(_0xab4e('0x1'));var BPromise=require(_0xab4e('0x2'));var rs=require(_0xab4e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab4e('0x4'))['db'];var utils=require(_0xab4e('0x5'));var logger=require(_0xab4e('0x6'))('rpc');var config=require(_0xab4e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xab4e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4de392,_0x34ad06,_0x3eb643){return new BPromise(function(_0x540a60,_0x3e5cae){return client[_0xab4e('0x9')](_0x4de392,_0x3eb643)[_0xab4e('0xa')](function(_0x4156d0){logger[_0xab4e('0xb')](_0xab4e('0xc'),_0x34ad06,_0xab4e('0xd'));logger[_0xab4e('0xe')](_0xab4e('0xf'),_0x34ad06,_0xab4e('0xd'),JSON['stringify'](_0x4156d0));if(_0x4156d0[_0xab4e('0x10')]){if(_0x4156d0[_0xab4e('0x10')][_0xab4e('0x11')]===0x1f4){logger['error'](_0xab4e('0xc'),_0x34ad06,_0x4156d0[_0xab4e('0x10')][_0xab4e('0x12')]);return _0x3e5cae(_0x4156d0[_0xab4e('0x10')][_0xab4e('0x12')]);}logger[_0xab4e('0x10')](_0xab4e('0xc'),_0x34ad06,_0x4156d0['error']['message']);return _0x540a60(_0x4156d0['error']['message']);}else{logger['info'](_0xab4e('0xc'),_0x34ad06,_0xab4e('0xd'));_0x540a60(_0x4156d0['result'][_0xab4e('0x12')]);}})[_0xab4e('0x13')](function(_0x36c887){logger[_0xab4e('0x10')](_0xab4e('0xc'),_0x34ad06,_0x36c887);_0x3e5cae(_0x36c887);});});}exports['CreateReportAgentPreview']=function(_0x1b226e){var _0x38fe9e=this;return new Promise(function(_0x7cd664,_0x1cbd6c){return db[_0xab4e('0x14')][_0xab4e('0x15')](_0x1b226e[_0xab4e('0x16')],{'raw':_0x1b226e[_0xab4e('0x17')]?_0x1b226e[_0xab4e('0x17')][_0xab4e('0x18')]===undefined?!![]:![]:!![]})[_0xab4e('0xa')](function(_0x4a7f32){logger[_0xab4e('0xb')](_0xab4e('0x19'),_0x1b226e);logger[_0xab4e('0xe')](_0xab4e('0x19'),_0x1b226e,JSON[_0xab4e('0x1a')](_0x4a7f32));_0x7cd664(_0x4a7f32);})['catch'](function(_0x515767){logger[_0xab4e('0x10')](_0xab4e('0x19'),_0x515767[_0xab4e('0x12')],_0x1b226e);_0x1cbd6c(_0x38fe9e[_0xab4e('0x10')](0x1f4,_0x515767[_0xab4e('0x12')]));});});}; \ No newline at end of file +var _0x14f9=['then','info','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x1fc18b,_0x13d27d){var _0x16a351=function(_0x54a799){while(--_0x54a799){_0x1fc18b['push'](_0x1fc18b['shift']());}};_0x16a351(++_0x13d27d);}(_0x14f9,0x1b0));var _0x914f=function(_0x10e2fc,_0x3c7960){_0x10e2fc=_0x10e2fc-0x0;var _0x672ca8=_0x14f9[_0x10e2fc];return _0x672ca8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x914f('0x0'));var BPromise=require(_0x914f('0x1'));var rs=require(_0x914f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x914f('0x3'));var logger=require(_0x914f('0x4'))(_0x914f('0x5'));var config=require(_0x914f('0x6'));var jayson=require(_0x914f('0x7'));var client=jayson['client'][_0x914f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xd33ae9,_0x33a83a,_0x501eb2){return new BPromise(function(_0x45f39d,_0x5b8df6){return client[_0x914f('0x9')](_0xd33ae9,_0x501eb2)[_0x914f('0xa')](function(_0x45ae5d){logger[_0x914f('0xb')](_0x914f('0xc'),_0x33a83a,'request\x20sent');logger[_0x914f('0xd')](_0x914f('0xe'),_0x33a83a,_0x914f('0xf'),JSON[_0x914f('0x10')](_0x45ae5d));if(_0x45ae5d['error']){if(_0x45ae5d[_0x914f('0x11')][_0x914f('0x12')]===0x1f4){logger[_0x914f('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x33a83a,_0x45ae5d[_0x914f('0x11')][_0x914f('0x13')]);return _0x5b8df6(_0x45ae5d[_0x914f('0x11')]['message']);}logger[_0x914f('0x11')](_0x914f('0xc'),_0x33a83a,_0x45ae5d[_0x914f('0x11')][_0x914f('0x13')]);return _0x45f39d(_0x45ae5d[_0x914f('0x11')][_0x914f('0x13')]);}else{logger['info'](_0x914f('0xc'),_0x33a83a,_0x914f('0xf'));_0x45f39d(_0x45ae5d['result'][_0x914f('0x13')]);}})[_0x914f('0x14')](function(_0x50675d){logger[_0x914f('0x11')](_0x914f('0xc'),_0x33a83a,_0x50675d);_0x5b8df6(_0x50675d);});});}exports[_0x914f('0x15')]=function(_0x500a05){var _0x5b7318=this;return new Promise(function(_0x3af7a3,_0x297a6b){return db[_0x914f('0x16')][_0x914f('0x17')](_0x500a05[_0x914f('0x18')],{'raw':_0x500a05[_0x914f('0x19')]?_0x500a05[_0x914f('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x914f('0xa')](function(_0x45639e){logger[_0x914f('0xb')]('CreateReportAgentPreview',_0x500a05);logger['debug'](_0x914f('0x15'),_0x500a05,JSON[_0x914f('0x10')](_0x45639e));_0x3af7a3(_0x45639e);})[_0x914f('0x14')](function(_0x19fb0e){logger[_0x914f('0x11')](_0x914f('0x15'),_0x19fb0e['message'],_0x500a05);_0x297a6b(_0x5b7318[_0x914f('0x11')](0x1f4,_0x19fb0e[_0x914f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 1dd2950..38b65c5 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 _0x3c6e=['showMailQueues','post','/chat/queues/:id/notify','chat','/chat/queues/:id','/fax/queues/:id/notify','/fax/queues/:id','showFaxQueues','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','sms','whatsapp','/sms/queues/:id','showSmsQueues','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','Router','../../components/auth/service','./rpc.controller','get','isAuthenticated','voiceChannels','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','/sms/queues','smsQueues','whatsappQueues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','/outbound','outbound','/outbound/channels','agents','/agents/:id/capacity','agentCapacity','/telephones','/trunks','trunks','/campaigns','campaigns','faxAccounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3c6e,0x194));var _0xe3c6=function(_0xea74ea,_0x49c7d2){_0xea74ea=_0xea74ea-0x0;var _0x3dddc5=_0x3c6e[_0xea74ea];return _0x3dddc5;};'use strict';var multer=require(_0xe3c6('0x0'));var util=require(_0xe3c6('0x1'));var path=require(_0xe3c6('0x2'));var express=require('express');var router=express[_0xe3c6('0x3')]();var auth=require(_0xe3c6('0x4'));var controller=require(_0xe3c6('0x5'));router[_0xe3c6('0x6')]('/voice/channels',auth[_0xe3c6('0x7')](),controller[_0xe3c6('0x8')]);router[_0xe3c6('0x6')]('/voice/channels/:uniqueid/mixmonitor',auth['isAuthenticated'](),controller['voiceChannelMixMonitor']);router[_0xe3c6('0x6')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0xe3c6('0x7')](),controller['voiceChannelStopMixMonitor']);router['get'](_0xe3c6('0x9'),auth[_0xe3c6('0x7')](),controller[_0xe3c6('0xa')]);router[_0xe3c6('0x6')](_0xe3c6('0xb'),auth[_0xe3c6('0x7')](),controller[_0xe3c6('0xc')]);router[_0xe3c6('0x6')](_0xe3c6('0xd'),auth[_0xe3c6('0x7')](),controller[_0xe3c6('0xe')]);router['get'](_0xe3c6('0xf'),auth[_0xe3c6('0x7')](),controller[_0xe3c6('0x10')]);router['get'](_0xe3c6('0x11'),auth[_0xe3c6('0x7')](),controller['openchannelQueues']);router[_0xe3c6('0x6')](_0xe3c6('0x12'),auth['isAuthenticated'](),controller[_0xe3c6('0x13')]);router['get']('/whatsapp/queues',auth[_0xe3c6('0x7')](),controller[_0xe3c6('0x14')]);router[_0xe3c6('0x6')]('/fax/queues',auth[_0xe3c6('0x7')](),controller['faxQueues']);router[_0xe3c6('0x6')]('/voice/queues/preview/:id',auth['isAuthenticated'](),controller[_0xe3c6('0x15')]);router[_0xe3c6('0x6')](_0xe3c6('0x16'),auth[_0xe3c6('0x7')](),controller[_0xe3c6('0x17')]);router['get'](_0xe3c6('0x18'),auth[_0xe3c6('0x7')](),controller[_0xe3c6('0x19')]);router[_0xe3c6('0x6')](_0xe3c6('0x1a'),auth[_0xe3c6('0x7')](),controller[_0xe3c6('0x1b')]);router[_0xe3c6('0x6')](_0xe3c6('0x1c'),auth[_0xe3c6('0x7')](),controller[_0xe3c6('0x1d')]);router[_0xe3c6('0x6')](_0xe3c6('0x1e'),auth[_0xe3c6('0x7')](),controller[_0xe3c6('0x1f')]);router[_0xe3c6('0x20')](_0xe3c6('0x1e'),auth[_0xe3c6('0x7')](),controller['updateVoiceQueue']);router[_0xe3c6('0x6')](_0xe3c6('0x21'),auth['isAuthenticated'](),controller[_0xe3c6('0x22')]);router[_0xe3c6('0x6')](_0xe3c6('0x23'),auth[_0xe3c6('0x7')](),controller['outboundChannels']);router[_0xe3c6('0x6')]('/agents',auth[_0xe3c6('0x7')](),controller[_0xe3c6('0x24')]);router[_0xe3c6('0x20')](_0xe3c6('0x25'),auth[_0xe3c6('0x7')](),controller[_0xe3c6('0x26')]);router[_0xe3c6('0x6')](_0xe3c6('0x27'),auth[_0xe3c6('0x7')](),controller['telephones']);router[_0xe3c6('0x6')](_0xe3c6('0x28'),auth[_0xe3c6('0x7')](),controller[_0xe3c6('0x29')]);router[_0xe3c6('0x6')](_0xe3c6('0x2a'),auth[_0xe3c6('0x7')](),controller[_0xe3c6('0x2b')]);router[_0xe3c6('0x6')]('/fax/accounts',auth['isAuthenticated'](),controller[_0xe3c6('0x2c')]);router[_0xe3c6('0x6')]('/chat/queues/waitinginteractions',auth[_0xe3c6('0x7')](),controller[_0xe3c6('0x2d')]);router[_0xe3c6('0x6')](_0xe3c6('0x2e'),auth[_0xe3c6('0x7')](),controller['mailQueuesWaitingInteractions']);router[_0xe3c6('0x6')]('/openchannel/queues/waitinginteractions',auth[_0xe3c6('0x7')](),controller[_0xe3c6('0x2f')]);router[_0xe3c6('0x6')](_0xe3c6('0x30'),auth[_0xe3c6('0x7')](),controller[_0xe3c6('0x31')]);router[_0xe3c6('0x6')]('/sms/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xe3c6('0x32')]);router[_0xe3c6('0x6')](_0xe3c6('0x33'),auth[_0xe3c6('0x7')](),controller[_0xe3c6('0x34')]);router[_0xe3c6('0x6')]('/fax/queues/waitinginteractions',auth[_0xe3c6('0x7')](),controller[_0xe3c6('0x35')]);router['post'](_0xe3c6('0x36'),auth[_0xe3c6('0x7')](),controller[_0xe3c6('0x37')](_0xe3c6('0x38')));router[_0xe3c6('0x6')](_0xe3c6('0x39'),auth['isAuthenticated'](),controller[_0xe3c6('0x3a')]);router[_0xe3c6('0x3b')](_0xe3c6('0x3c'),auth[_0xe3c6('0x7')](),controller['queueNotify'](_0xe3c6('0x3d')));router[_0xe3c6('0x6')](_0xe3c6('0x3e'),auth[_0xe3c6('0x7')](),controller['showChatQueues']);router[_0xe3c6('0x3b')](_0xe3c6('0x3f'),auth['isAuthenticated'](),controller[_0xe3c6('0x37')]('fax'));router[_0xe3c6('0x6')](_0xe3c6('0x40'),auth[_0xe3c6('0x7')](),controller[_0xe3c6('0x41')]);router[_0xe3c6('0x3b')]('/openchannel/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify'](_0xe3c6('0x42')));router[_0xe3c6('0x6')]('/openchannel/queues/:id',auth['isAuthenticated'](),controller[_0xe3c6('0x43')]);router[_0xe3c6('0x3b')](_0xe3c6('0x44'),auth[_0xe3c6('0x7')](),controller['queueNotify'](_0xe3c6('0x45')));router['post']('/whatsapp/queues/:id/notify',auth[_0xe3c6('0x7')](),controller[_0xe3c6('0x37')](_0xe3c6('0x46')));router['get'](_0xe3c6('0x47'),auth[_0xe3c6('0x7')](),controller[_0xe3c6('0x48')]);router[_0xe3c6('0x6')]('/whatsapp/queues/:id',auth[_0xe3c6('0x7')](),controller[_0xe3c6('0x49')]);router[_0xe3c6('0x3b')](_0xe3c6('0x4a'),auth[_0xe3c6('0x7')](),controller[_0xe3c6('0x4b')]);module[_0xe3c6('0x4c')]=router; \ No newline at end of file +var _0xbd63=['/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','/agents/:id/notify','exports','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','/telephones','telephones','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel'];(function(_0x314502,_0x4b7faa){var _0x148304=function(_0x459d93){while(--_0x459d93){_0x314502['push'](_0x314502['shift']());}};_0x148304(++_0x4b7faa);}(_0xbd63,0x199));var _0x3bd6=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xbd63[_0x46e363];return _0x3fb059;};'use strict';var multer=require(_0x3bd6('0x0'));var util=require(_0x3bd6('0x1'));var path=require(_0x3bd6('0x2'));var express=require(_0x3bd6('0x3'));var router=express[_0x3bd6('0x4')]();var auth=require(_0x3bd6('0x5'));var controller=require(_0x3bd6('0x6'));router[_0x3bd6('0x7')]('/voice/channels',auth[_0x3bd6('0x8')](),controller[_0x3bd6('0x9')]);router[_0x3bd6('0x7')]('/voice/channels/:uniqueid/mixmonitor',auth[_0x3bd6('0x8')](),controller['voiceChannelMixMonitor']);router[_0x3bd6('0x7')](_0x3bd6('0xa'),auth[_0x3bd6('0x8')](),controller[_0x3bd6('0xb')]);router['get'](_0x3bd6('0xc'),auth[_0x3bd6('0x8')](),controller[_0x3bd6('0xd')]);router[_0x3bd6('0x7')](_0x3bd6('0xe'),auth[_0x3bd6('0x8')](),controller[_0x3bd6('0xf')]);router[_0x3bd6('0x7')](_0x3bd6('0x10'),auth[_0x3bd6('0x8')](),controller[_0x3bd6('0x11')]);router[_0x3bd6('0x7')](_0x3bd6('0x12'),auth['isAuthenticated'](),controller['mailAccounts']);router[_0x3bd6('0x7')]('/openchannel/queues',auth['isAuthenticated'](),controller[_0x3bd6('0x13')]);router[_0x3bd6('0x7')](_0x3bd6('0x14'),auth['isAuthenticated'](),controller[_0x3bd6('0x15')]);router[_0x3bd6('0x7')](_0x3bd6('0x16'),auth[_0x3bd6('0x8')](),controller[_0x3bd6('0x17')]);router[_0x3bd6('0x7')]('/fax/queues',auth['isAuthenticated'](),controller[_0x3bd6('0x18')]);router[_0x3bd6('0x7')](_0x3bd6('0x19'),auth['isAuthenticated'](),controller[_0x3bd6('0x1a')]);router[_0x3bd6('0x7')]('/voice/queues/channels',auth[_0x3bd6('0x8')](),controller['voiceQueuesChannels']);router[_0x3bd6('0x7')](_0x3bd6('0x1b'),auth[_0x3bd6('0x8')](),controller['voiceQueuesChannel']);router[_0x3bd6('0x7')](_0x3bd6('0x1c'),auth[_0x3bd6('0x8')](),controller[_0x3bd6('0x1d')]);router[_0x3bd6('0x7')](_0x3bd6('0x1e'),auth[_0x3bd6('0x8')](),controller[_0x3bd6('0x1f')]);router[_0x3bd6('0x7')](_0x3bd6('0x20'),auth['isAuthenticated'](),controller[_0x3bd6('0x21')]);router[_0x3bd6('0x22')](_0x3bd6('0x20'),auth[_0x3bd6('0x8')](),controller[_0x3bd6('0x23')]);router['get']('/outbound',auth[_0x3bd6('0x8')](),controller['outbound']);router[_0x3bd6('0x7')](_0x3bd6('0x24'),auth[_0x3bd6('0x8')](),controller[_0x3bd6('0x25')]);router[_0x3bd6('0x7')](_0x3bd6('0x26'),auth[_0x3bd6('0x8')](),controller[_0x3bd6('0x27')]);router['put'](_0x3bd6('0x28'),auth[_0x3bd6('0x8')](),controller['agentCapacity']);router[_0x3bd6('0x7')](_0x3bd6('0x29'),auth[_0x3bd6('0x8')](),controller[_0x3bd6('0x2a')]);router[_0x3bd6('0x7')]('/trunks',auth[_0x3bd6('0x8')](),controller['trunks']);router[_0x3bd6('0x7')]('/campaigns',auth[_0x3bd6('0x8')](),controller[_0x3bd6('0x2b')]);router[_0x3bd6('0x7')](_0x3bd6('0x2c'),auth[_0x3bd6('0x8')](),controller[_0x3bd6('0x2d')]);router['get'](_0x3bd6('0x2e'),auth[_0x3bd6('0x8')](),controller['chatQueuesWaitingInteractions']);router[_0x3bd6('0x7')]('/mail/queues/waitinginteractions',auth[_0x3bd6('0x8')](),controller[_0x3bd6('0x2f')]);router[_0x3bd6('0x7')]('/openchannel/queues/waitinginteractions',auth[_0x3bd6('0x8')](),controller[_0x3bd6('0x30')]);router[_0x3bd6('0x7')](_0x3bd6('0x31'),auth[_0x3bd6('0x8')](),controller[_0x3bd6('0x32')]);router['get'](_0x3bd6('0x33'),auth[_0x3bd6('0x8')](),controller[_0x3bd6('0x34')]);router[_0x3bd6('0x7')]('/whatsapp/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x3bd6('0x35')]);router[_0x3bd6('0x7')]('/fax/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x3bd6('0x36')]);router[_0x3bd6('0x37')](_0x3bd6('0x38'),auth[_0x3bd6('0x8')](),controller[_0x3bd6('0x39')](_0x3bd6('0x3a')));router[_0x3bd6('0x7')](_0x3bd6('0x3b'),auth[_0x3bd6('0x8')](),controller[_0x3bd6('0x3c')]);router['post'](_0x3bd6('0x3d'),auth[_0x3bd6('0x8')](),controller[_0x3bd6('0x39')](_0x3bd6('0x3e')));router[_0x3bd6('0x7')](_0x3bd6('0x3f'),auth[_0x3bd6('0x8')](),controller[_0x3bd6('0x40')]);router[_0x3bd6('0x37')](_0x3bd6('0x41'),auth['isAuthenticated'](),controller[_0x3bd6('0x39')](_0x3bd6('0x42')));router[_0x3bd6('0x7')](_0x3bd6('0x43'),auth['isAuthenticated'](),controller[_0x3bd6('0x44')]);router['post'](_0x3bd6('0x45'),auth[_0x3bd6('0x8')](),controller['queueNotify'](_0x3bd6('0x46')));router[_0x3bd6('0x7')]('/openchannel/queues/:id',auth['isAuthenticated'](),controller['showOpenchannelQueues']);router['post'](_0x3bd6('0x47'),auth['isAuthenticated'](),controller[_0x3bd6('0x39')](_0x3bd6('0x48')));router['post'](_0x3bd6('0x49'),auth[_0x3bd6('0x8')](),controller[_0x3bd6('0x39')](_0x3bd6('0x4a')));router['get'](_0x3bd6('0x4b'),auth[_0x3bd6('0x8')](),controller[_0x3bd6('0x4c')]);router[_0x3bd6('0x7')](_0x3bd6('0x4d'),auth[_0x3bd6('0x8')](),controller['showWhatsappQueues']);router[_0x3bd6('0x37')](_0x3bd6('0x4e'),auth[_0x3bd6('0x8')](),controller['agentNotify']);module[_0x3bd6('0x4f')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 8d1c058..f2d66c3 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 _0x8ef6=['name','send','isNil','find','rows','VoiceChannels','voiceChannelMixMonitor','VoiceChannelMixMonitor','query','params','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','OutboundChannels','agents','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','findAll','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','findOrCreate','interface','SIP/%s','INTERACTION','agent','internal','AgentCapacity','telephones','trunks','Trunks','campaigns','chatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','queue_id','value','filter','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','QueueId','create','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','User','Agent\x20not\x20found','TransferReport','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','client','http','request','then','error','code','message','catch','status','sendStatus','stack'];(function(_0x3a61f1,_0x2b7f2d){var _0x141b0e=function(_0x2c031c){while(--_0x2c031c){_0x3a61f1['push'](_0x3a61f1['shift']());}};_0x141b0e(++_0x2b7f2d);}(_0x8ef6,0xf2));var _0x68ef=function(_0x40444c,_0x2f347c){_0x40444c=_0x40444c-0x0;var _0x5eab5f=_0x8ef6[_0x40444c];return _0x5eab5f;};'use strict';var BPromise=require(_0x68ef('0x0'));var moment=require(_0x68ef('0x1'));var _=require(_0x68ef('0x2'));var util=require(_0x68ef('0x3'));var db=require(_0x68ef('0x4'))['db'];var logger=require(_0x68ef('0x5'))(_0x68ef('0x6'));var jayson=require('jayson/promise');var amiClient=jayson[_0x68ef('0x7')][_0x68ef('0x8')]({'port':0x232a});var mailClient=jayson[_0x68ef('0x7')][_0x68ef('0x8')]({'port':0x232b});var routingClient=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){var _0x31007e=_0x2de776?_0x2de776:amiClient;return _0x31007e[_0x68ef('0x9')](_0x3c2ff3,_0x4740e8)[_0x68ef('0xa')](function(_0x112b18){if(_0x112b18[_0x68ef('0xb')]){if(_0x112b18[_0x68ef('0xb')][_0x68ef('0xc')]===0x1f4){return _0x228967(_0x112b18[_0x68ef('0xb')][_0x68ef('0xd')]);}return _0x4eb5eb(_0x112b18[_0x68ef('0xb')][_0x68ef('0xd')]);}else{_0x4eb5eb(_0x112b18['result']);}})[_0x68ef('0xe')](function(_0x46356f){_0x228967(_0x46356f);});});}function respondWithResult(_0x1e117a,_0x454ef4){_0x454ef4=_0x454ef4||0xc8;return function(_0x40f253){if(_0x40f253){return _0x1e117a[_0x68ef('0xf')](_0x454ef4)['json'](_0x40f253);}return _0x1e117a[_0x68ef('0x10')](0x194);};}function handleError(_0xc50cce,_0x2657c5){_0x2657c5=_0x2657c5||0x1f4;return function(_0x47fbb5){logger[_0x68ef('0xb')](_0x47fbb5[_0x68ef('0x11')]);if(_0x47fbb5[_0x68ef('0x12')]){delete _0x47fbb5['name'];}_0xc50cce[_0x68ef('0xf')](_0x2657c5)[_0x68ef('0x13')](_0x47fbb5);};}function findById(_0x3d1e90){return function(_0x3780a4){if(!_['isNil'](_0x3d1e90)&&!_[_0x68ef('0x14')](_0x3780a4)&&!_['isNil'](_0x3780a4['rows'])){return _[_0x68ef('0x15')](_0x3780a4[_0x68ef('0x16')],function(_0x4ade0d){return _0x4ade0d['id']==_0x3d1e90;});}return null;};}exports['voiceChannels']=function(_0x3c4c1f,_0x2cd92c){return respondWithRpcPromise(_0x68ef('0x17'),_0x3c4c1f['query'])[_0x68ef('0xa')](respondWithResult(_0x2cd92c,null))[_0x68ef('0xe')](handleError(_0x2cd92c,null));};exports[_0x68ef('0x18')]=function(_0x5b246b,_0x3c46d4){return respondWithRpcPromise(_0x68ef('0x19'),_['merge'](_0x5b246b[_0x68ef('0x1a')],_0x5b246b[_0x68ef('0x1b')]))[_0x68ef('0xa')](respondWithResult(_0x3c46d4,null))['catch'](handleError(_0x3c46d4,null));};exports['voiceChannelStopMixMonitor']=function(_0x59bebc,_0x26018d){return respondWithRpcPromise(_0x68ef('0x1c'),_[_0x68ef('0x1d')](_0x59bebc[_0x68ef('0x1a')],_0x59bebc[_0x68ef('0x1b')]))[_0x68ef('0xa')](respondWithResult(_0x26018d,null))[_0x68ef('0xe')](handleError(_0x26018d,null));};exports[_0x68ef('0x1e')]=function(_0x65fd09,_0x13280b){return respondWithRpcPromise('VoiceQueues',_0x65fd09[_0x68ef('0x1a')])['then'](respondWithResult(_0x13280b,null))['catch'](handleError(_0x13280b,null));};exports['showVoiceQueues']=function(_0x1a7ce1,_0x268f32){return respondWithRpcPromise(_0x68ef('0x1f'),_0x1a7ce1[_0x68ef('0x1a')])['then'](findById(_0x1a7ce1['params']['id']))[_0x68ef('0xa')](respondWithResult(_0x268f32,null))[_0x68ef('0xe')](handleError(_0x268f32,null));};exports[_0x68ef('0x20')]=function(_0x263b30,_0x22ef25){return respondWithRpcPromise(_0x68ef('0x21'),_[_0x68ef('0x1d')](_0x263b30[_0x68ef('0x22')],_0x263b30['params']))[_0x68ef('0xa')](respondWithResult(_0x22ef25,null))[_0x68ef('0xe')](handleError(_0x22ef25,null));};exports[_0x68ef('0x23')]=function(_0x4c25aa,_0x370a8f){return respondWithRpcPromise('VoiceQueuesPreview',_[_0x68ef('0x1d')](_0x4c25aa[_0x68ef('0x1a')],_0x4c25aa['params']))['then'](respondWithResult(_0x370a8f,null))[_0x68ef('0xe')](handleError(_0x370a8f,null));};exports[_0x68ef('0x24')]=function(_0x4b8fc8,_0xf58fa1){return respondWithRpcPromise(_0x68ef('0x25'),_0x4b8fc8[_0x68ef('0x1a')])[_0x68ef('0xa')](respondWithResult(_0xf58fa1,null))['catch'](handleError(_0xf58fa1,null));};exports[_0x68ef('0x26')]=function(_0x1d69ac,_0x5f137b){return respondWithRpcPromise(_0x68ef('0x27'),_['merge'](_0x1d69ac[_0x68ef('0x1a')],_0x1d69ac[_0x68ef('0x1b')]))['then'](respondWithResult(_0x5f137b,null))[_0x68ef('0xe')](handleError(_0x5f137b,null));};exports['voiceQueuesChannelHangup']=function(_0x38c2f8,_0x575f43){return respondWithRpcPromise(_0x68ef('0x28'),_[_0x68ef('0x1d')](_0x38c2f8[_0x68ef('0x1a')],_0x38c2f8['params']))[_0x68ef('0xa')](respondWithResult(_0x575f43,null))['catch'](handleError(_0x575f43,null));};exports[_0x68ef('0x29')]=function(_0x4c9506,_0x474ffa){return respondWithRpcPromise(_0x68ef('0x2a'),_[_0x68ef('0x1d')](_0x4c9506[_0x68ef('0x1a')],_0x4c9506[_0x68ef('0x1b')]))[_0x68ef('0xa')](respondWithResult(_0x474ffa,null))['catch'](handleError(_0x474ffa,null));};exports[_0x68ef('0x2b')]=function(_0x15a6ab,_0x32074a){return respondWithRpcPromise('Outbound',_0x15a6ab[_0x68ef('0x1a')])[_0x68ef('0xa')](respondWithResult(_0x32074a,null))[_0x68ef('0xe')](handleError(_0x32074a,null));};exports['outboundChannels']=function(_0x49f260,_0x14f0fc){return respondWithRpcPromise(_0x68ef('0x2c'),_0x49f260[_0x68ef('0x1a')])[_0x68ef('0xa')](respondWithResult(_0x14f0fc,null))[_0x68ef('0xe')](handleError(_0x14f0fc,null));};exports[_0x68ef('0x2d')]=function(_0x41ffe0,_0x5b1246){var _0xaf7df1;return respondWithRpcPromise(_0x68ef('0x2e'),_0x41ffe0[_0x68ef('0x1a')])[_0x68ef('0xa')](function(_0x492b74){_0xaf7df1=_0x492b74;return respondWithRpcPromise(_0x68ef('0x2e'),_0x41ffe0[_0x68ef('0x1a')],routingClient);})[_0x68ef('0xa')](function(_0x410c10){return _[_0x68ef('0x1d')]({},_0x410c10,_0xaf7df1);})[_0x68ef('0xa')](respondWithResult(_0x5b1246,null))['catch'](handleError(_0x5b1246,null));};exports[_0x68ef('0x2f')]=function(_0x3f7699,_0xf5010c){if(_0x3f7699[_0x68ef('0x22')]&&_0x3f7699[_0x68ef('0x22')][_0x68ef('0x30')]&&_0x3f7699[_0x68ef('0x31')]&&_0x3f7699[_0x68ef('0x31')][_0x68ef('0x12')]){for(var _0x531096 in _0x3f7699[_0x68ef('0x22')][_0x68ef('0x30')]){if(_0x3f7699[_0x68ef('0x22')][_0x68ef('0x30')][_0x68ef('0x32')](_0x531096)){db[_0x68ef('0x33')][_0x68ef('0x34')]({'where':{'channel':_0x531096,'membername':_0x3f7699['user'][_0x68ef('0x12')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3f7699[_0x68ef('0x22')][_0x68ef('0x30')][_0x531096]&&_0x3f7699[_0x68ef('0x22')][_0x68ef('0x30')][_0x531096]['length']?{'$notIn':_0x3f7699[_0x68ef('0x22')]['interaction'][_0x531096]}:{'$ne':null}}})[_0x68ef('0xa')](function(_0x499423){var _0x227e36=moment()[_0x68ef('0x35')](_0x68ef('0x36'));for(var _0x5c4a66=0x0,_0x59b148=_0x499423[_0x68ef('0x37')];_0x5c4a66<_0x59b148;_0x5c4a66+=0x1){_0x499423[_0x5c4a66][_0x68ef('0x38')]({'exitAt':_0x227e36});}});for(var _0x58d72a=0x0;_0x58d72a<_0x3f7699['body']['interaction'][_0x531096][_0x68ef('0x37')];_0x58d72a+=0x1){db[_0x68ef('0x33')][_0x68ef('0x39')]({'where':{'channel':_0x531096,'membername':_0x3f7699[_0x68ef('0x31')][_0x68ef('0x12')],'type':'INTERACTION','uniqueid':_0x3f7699['body'][_0x68ef('0x30')][_0x531096][_0x58d72a],'exitAt':null},'defaults':{'channel':_0x531096,'membername':_0x3f7699[_0x68ef('0x31')][_0x68ef('0x12')],'interface':_[_0x68ef('0x14')](_0x3f7699['user'][_0x68ef('0x3a')])?util[_0x68ef('0x35')](_0x68ef('0x3b'),_0x3f7699[_0x68ef('0x31')]['name']):_0x3f7699['user'][_0x68ef('0x3a')],'type':_0x68ef('0x3c'),'enterAt':moment()['format'](_0x68ef('0x36')),'role':_0x68ef('0x3d'),'internal':_0x3f7699[_0x68ef('0x31')][_0x68ef('0x3e')],'uniqueid':_0x3f7699[_0x68ef('0x22')]['interaction'][_0x531096][_0x58d72a]}});}}}}return respondWithRpcPromise(_0x68ef('0x3f'),{'id':_0x3f7699[_0x68ef('0x1b')]['id'],'capacity':_0x3f7699[_0x68ef('0x22')]['capacity']},routingClient)[_0x68ef('0xa')](respondWithResult(_0xf5010c,null))[_0x68ef('0xe')](handleError(_0xf5010c,null));};exports[_0x68ef('0x40')]=function(_0x50ef1f,_0x7dce90){return respondWithRpcPromise('Telephones',_0x50ef1f['query'])[_0x68ef('0xa')](respondWithResult(_0x7dce90,null))['catch'](handleError(_0x7dce90,null));};exports[_0x68ef('0x41')]=function(_0xb33afd,_0x53ebd){return respondWithRpcPromise(_0x68ef('0x42'),_0xb33afd[_0x68ef('0x1a')])[_0x68ef('0xa')](respondWithResult(_0x53ebd,null))[_0x68ef('0xe')](handleError(_0x53ebd,null));};exports[_0x68ef('0x43')]=function(_0x2b35f4,_0x247915){return respondWithRpcPromise('Campaigns',_0x2b35f4['query'])[_0x68ef('0xa')](respondWithResult(_0x247915,null))[_0x68ef('0xe')](handleError(_0x247915,null));};exports[_0x68ef('0x44')]=function(_0xdc83f4,_0x82df12){return respondWithRpcPromise(_0x68ef('0x45'),_0xdc83f4[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](respondWithResult(_0x82df12,null))[_0x68ef('0xe')](handleError(_0x82df12,null));};exports['showChatQueues']=function(_0x5685bb,_0x42a4b2){return respondWithRpcPromise('ChatQueues',_0x5685bb[_0x68ef('0x1a')],routingClient)['then'](findById(_0x5685bb[_0x68ef('0x1b')]['id']))[_0x68ef('0xa')](respondWithResult(_0x42a4b2,null))['catch'](handleError(_0x42a4b2,null));};exports[_0x68ef('0x46')]=function(_0x4e097e,_0x407c6d){return respondWithRpcPromise(_0x68ef('0x47'),_0x4e097e[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](respondWithResult(_0x407c6d,null))[_0x68ef('0xe')](handleError(_0x407c6d,null));};exports[_0x68ef('0x48')]=function(_0x5c347c,_0x1cdaef){return respondWithRpcPromise(_0x68ef('0x47'),_0x5c347c[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](findById(_0x5c347c[_0x68ef('0x1b')]['id']))[_0x68ef('0xa')](respondWithResult(_0x1cdaef,null))['catch'](handleError(_0x1cdaef,null));};exports[_0x68ef('0x49')]=function(_0x42d2a3,_0x4886af){return respondWithRpcPromise(_0x68ef('0x4a'),_0x42d2a3[_0x68ef('0x1a')],mailClient)[_0x68ef('0xa')](respondWithResult(_0x4886af,null))['catch'](handleError(_0x4886af,null));};exports[_0x68ef('0x4b')]=function(_0x49d197,_0x5412ea){return respondWithRpcPromise(_0x68ef('0x4c'),_0x49d197['query'],routingClient)[_0x68ef('0xa')](respondWithResult(_0x5412ea,null))['catch'](handleError(_0x5412ea,null));};exports[_0x68ef('0x4d')]=function(_0x9e8554,_0x304405){return respondWithRpcPromise(_0x68ef('0x4c'),_0x9e8554[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](findById(_0x9e8554['params']['id']))[_0x68ef('0xa')](respondWithResult(_0x304405,null))['catch'](handleError(_0x304405,null));};exports[_0x68ef('0x4e')]=function(_0x4b0c3e,_0x2f97c5){return respondWithRpcPromise(_0x68ef('0x4f'),_0x4b0c3e[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](respondWithResult(_0x2f97c5,null))[_0x68ef('0xe')](handleError(_0x2f97c5,null));};exports[_0x68ef('0x50')]=function(_0x1be626,_0x52d29a){return respondWithRpcPromise(_0x68ef('0x4f'),_0x1be626[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](findById(_0x1be626[_0x68ef('0x1b')]['id']))[_0x68ef('0xa')](respondWithResult(_0x52d29a,null))['catch'](handleError(_0x52d29a,null));};exports[_0x68ef('0x51')]=function(_0x561e8d,_0x1ed172){return respondWithRpcPromise('WhatsappQueues',_0x561e8d['query'],routingClient)[_0x68ef('0xa')](respondWithResult(_0x1ed172,null))[_0x68ef('0xe')](handleError(_0x1ed172,null));};exports[_0x68ef('0x52')]=function(_0x21b2ce,_0x51f905){return respondWithRpcPromise(_0x68ef('0x53'),_0x21b2ce['query'],routingClient)[_0x68ef('0xa')](findById(_0x21b2ce[_0x68ef('0x1b')]['id']))[_0x68ef('0xa')](respondWithResult(_0x51f905,null))['catch'](handleError(_0x51f905,null));};exports['faxQueues']=function(_0x3e74d2,_0x1092f8){return respondWithRpcPromise(_0x68ef('0x54'),_0x3e74d2[_0x68ef('0x1a')],routingClient)['then'](respondWithResult(_0x1092f8,null))[_0x68ef('0xe')](handleError(_0x1092f8,null));};exports[_0x68ef('0x55')]=function(_0x19c20f,_0x21b104){return respondWithRpcPromise('FaxQueues',_0x19c20f[_0x68ef('0x1a')],routingClient)['then'](findById(_0x19c20f[_0x68ef('0x1b')]['id']))[_0x68ef('0xa')](respondWithResult(_0x21b104,null))[_0x68ef('0xe')](handleError(_0x21b104,null));};exports[_0x68ef('0x56')]=function(_0xed16d1,_0x52cb2a){return respondWithRpcPromise(_0x68ef('0x57'),_0xed16d1[_0x68ef('0x1a')])[_0x68ef('0xa')](respondWithResult(_0x52cb2a,null))['catch'](handleError(_0x52cb2a,null));};exports[_0x68ef('0x58')]=function(_0x4de108,_0x69b1c){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x4de108['query'],routingClient)[_0x68ef('0xa')](respondWithResult(_0x69b1c,null))[_0x68ef('0xe')](handleError(_0x69b1c,null));};exports[_0x68ef('0x59')]=function(_0x405971,_0x501004){return respondWithRpcPromise(_0x68ef('0x5a'),_0x405971[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](respondWithResult(_0x501004,null))['catch'](handleError(_0x501004,null));};exports[_0x68ef('0x5b')]=function(_0x2db826,_0xea2a81){return respondWithRpcPromise(_0x68ef('0x5c'),_0x2db826[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](respondWithResult(_0xea2a81,null))[_0x68ef('0xe')](handleError(_0xea2a81,null));};exports[_0x68ef('0x5d')]=function(_0x156ce3,_0x11feff){return respondWithRpcPromise(_0x68ef('0x5c'),_0x156ce3[_0x68ef('0x1a')],routingClient)['then'](function(_0x15378c){if(_0x156ce3[_0x68ef('0x1a')]['type']!==undefined){var _0x513c69=_(_0x15378c[_0x68ef('0x16')])['filter']([_0x156ce3[_0x68ef('0x1a')][_0x68ef('0x5e')],_0x156ce3['params']['id']])['map'](_0x68ef('0x5f'))['uniq']()[_0x68ef('0x60')]();return _0x15378c['rows'][_0x68ef('0x61')](function(_0x4f425f){return _0x513c69[_0x68ef('0x62')](_0x4f425f[_0x68ef('0x5f')])>-0x1;});}else{return _0x15378c['rows'][_0x68ef('0x61')](function(_0x357be7){return _0x357be7[_0x68ef('0x5f')]===parseInt(_0x156ce3[_0x68ef('0x1b')]['id']);});}})['then'](respondWithResult(_0x11feff,null))[_0x68ef('0xe')](handleError(_0x11feff,null));};exports[_0x68ef('0x63')]=function(_0x5b2e89,_0x3bb3b6){return respondWithRpcPromise(_0x68ef('0x64'),_0x5b2e89[_0x68ef('0x1a')],routingClient)['then'](respondWithResult(_0x3bb3b6,null))[_0x68ef('0xe')](handleError(_0x3bb3b6,null));};exports['whatsappQueuesWaitingInteractions']=function(_0xe6bf05,_0x36c109){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0xe6bf05['query'],routingClient)['then'](respondWithResult(_0x36c109,null))['catch'](handleError(_0x36c109,null));};exports[_0x68ef('0x65')]=function(_0x28ad22,_0x1217f9){return respondWithRpcPromise(_0x68ef('0x66'),_0x28ad22[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](respondWithResult(_0x1217f9,null))[_0x68ef('0xe')](handleError(_0x1217f9,null));};exports[_0x68ef('0x67')]=function(_0x24ba34){return function(_0x3ae3e9,_0x17892c){var _0x108223,_0x717d7b;var _0x4bd5c3=_[_0x68ef('0x68')](_0x24ba34);var _0x556dfc=_0x24ba34===_0x68ef('0x69')?'Website':'Account';return db[_0x4bd5c3+_0x68ef('0x6a')][_0x68ef('0x6b')]({'raw':!![],'where':{'id':_0x3ae3e9[_0x68ef('0x1b')]['id']}})[_0x68ef('0xa')](function(_0x518c9a){if(_['isNil'](_0x518c9a)){throw new Error(_0x4bd5c3+_0x68ef('0x6c'));}_0x108223=_0x518c9a;return db[_0x4bd5c3+_0x68ef('0x6d')][_0x68ef('0x6b')]({'where':{'id':_0x3ae3e9['body'][_0x68ef('0x6e')]},'include':[{'model':db[_0x4bd5c3+_0x68ef('0x6f')],'as':_0x68ef('0x6f')},{'model':db[_0x4bd5c3+_0x556dfc],'as':_0x68ef('0x70')}]});})['then'](function(_0x214e89){if(_[_0x68ef('0x14')](_0x214e89)){throw new Error(_0x4bd5c3+_0x68ef('0x71'));}_0x717d7b=_0x214e89;return _0x214e89[_0x68ef('0x72')]({'read':0x0,'readAt':null,'UserId':null});})[_0x68ef('0xa')](function(){var _0x346049={'uniqueid':_0x24ba34+'.'+_0x717d7b['id']+'.'+_0x717d7b['Interaction']['id'],'FromUserId':_0x3ae3e9[_0x68ef('0x31')]['id'],'type':'queue'};_0x346049[_0x4bd5c3+_0x68ef('0x73')]=_0x717d7b['id'];_0x346049[_0x4bd5c3+_0x68ef('0x74')]=_0x717d7b[_0x68ef('0x6f')]['id'];_0x346049[_0x68ef('0x75')+_0x4bd5c3+_0x556dfc+'Id']=_0x717d7b['Account']['id'];_0x346049['To'+_0x4bd5c3+_0x68ef('0x76')]=_0x108223['id'];return db[_0x4bd5c3+'TransferReport'][_0x68ef('0x77')](_0x346049);})[_0x68ef('0xa')](function(){return respondWithRpcPromise('Start',{'channel':_0x24ba34,'interaction':_0x717d7b['Interaction'],'message':_0x717d7b,'account':_0x717d7b[_0x68ef('0x70')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x108223[_0x68ef('0x12')]+','+(_0x717d7b['Account'][_0x68ef('0x78')]||0x12c),'interval':_0x68ef('0x79')}]},routingClient);})[_0x68ef('0xa')](respondWithResult(_0x17892c,null))[_0x68ef('0xe')](handleError(_0x17892c,null));};};exports[_0x68ef('0x7a')]=function(_0x66a7a8,_0x51b8db){var _0x17d014,_0x463356;if(_[_0x68ef('0x14')](_0x66a7a8[_0x68ef('0x22')][_0x68ef('0x7b')])){throw new Error(_0x68ef('0x7c'));}var _0x303add=_0x66a7a8['body'][_0x68ef('0x7b')];var _0x373ab4=_[_0x68ef('0x68')](_0x303add);var _0x2e20aa=_0x303add===_0x68ef('0x69')?_0x68ef('0x7d'):_0x68ef('0x70');return db[_0x68ef('0x7e')][_0x68ef('0x6b')]({'raw':!![],'where':{'id':_0x66a7a8['params']['id'],'role':_0x68ef('0x3d')}})['then'](function(_0x5f3b79){if(_['isNil'](_0x5f3b79)){throw new Error(_0x68ef('0x7f'));}_0x17d014=_0x5f3b79;return db[_0x373ab4+_0x68ef('0x6d')][_0x68ef('0x6b')]({'where':{'id':_0x66a7a8['body']['messageId']},'include':[{'model':db[_0x373ab4+'Interaction'],'as':_0x68ef('0x6f')},{'model':db[_0x373ab4+_0x2e20aa],'as':_0x68ef('0x70')}]});})[_0x68ef('0xa')](function(_0x40996e){if(_[_0x68ef('0x14')](_0x40996e)){throw new Error(_0x373ab4+_0x68ef('0x71'));}_0x463356=_0x40996e;return _0x40996e['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x68ef('0xa')](function(){var _0x2c7f18={'uniqueid':_0x303add+'.'+_0x463356['id']+'.'+_0x463356[_0x68ef('0x6f')]['id'],'FromUserId':_0x66a7a8[_0x68ef('0x31')]['id'],'type':'queue','ToUserId':_0x17d014['id']};_0x2c7f18[_0x373ab4+_0x68ef('0x73')]=_0x463356['id'];_0x2c7f18[_0x373ab4+_0x68ef('0x74')]=_0x463356[_0x68ef('0x6f')]['id'];_0x2c7f18[_0x68ef('0x75')+_0x373ab4+_0x2e20aa+'Id']=_0x463356[_0x68ef('0x70')]['id'];return db[_0x373ab4+_0x68ef('0x80')][_0x68ef('0x77')](_0x2c7f18);})[_0x68ef('0xa')](function(){return respondWithRpcPromise('Start',{'channel':_0x303add,'interaction':_0x463356[_0x68ef('0x6f')],'message':_0x463356,'account':_0x463356[_0x68ef('0x70')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x17d014[_0x68ef('0x12')]+','+(_0x463356[_0x68ef('0x70')][_0x68ef('0x81')]||0x12c),'interval':_0x68ef('0x79')}]},routingClient);})[_0x68ef('0xa')](respondWithResult(_0x51b8db,null))[_0x68ef('0xe')](handleError(_0x51b8db,null));}; \ No newline at end of file +var _0x98a8=['openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','findOne','\x20Queue\x20not\x20found','Message','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','QueueId','TransferReport','create','Start','Account','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','User','Agent\x20not\x20found','messageId','From','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','client','http','request','then','error','code','result','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','catch','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','updateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','Outbound','OutboundChannels','agents','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','YYYY-MM-DD\x20HH:mm:ss','findOrCreate','format','SIP/%s','interface','agent','internal','AgentCapacity','capacity','telephones','trunks','Trunks','campaigns','Campaigns','ChatQueues','showChatQueues','MailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','WhatsappQueues','faxQueues','FaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions'];(function(_0x140f30,_0x391b48){var _0x3e9979=function(_0xeda87d){while(--_0xeda87d){_0x140f30['push'](_0x140f30['shift']());}};_0x3e9979(++_0x391b48);}(_0x98a8,0x12c));var _0x898a=function(_0x1a6066,_0x2ac60a){_0x1a6066=_0x1a6066-0x0;var _0x30a32a=_0x98a8[_0x1a6066];return _0x30a32a;};'use strict';var BPromise=require(_0x898a('0x0'));var moment=require(_0x898a('0x1'));var _=require(_0x898a('0x2'));var util=require(_0x898a('0x3'));var db=require(_0x898a('0x4'))['db'];var logger=require(_0x898a('0x5'))(_0x898a('0x6'));var jayson=require('jayson/promise');var amiClient=jayson[_0x898a('0x7')][_0x898a('0x8')]({'port':0x232a});var mailClient=jayson[_0x898a('0x7')][_0x898a('0x8')]({'port':0x232b});var routingClient=jayson[_0x898a('0x7')]['http']({'port':0x232c});function respondWithRpcPromise(_0x3aadc2,_0x564583,_0xfa8c50){return new BPromise(function(_0x4fbce5,_0x42021d){var _0x283c5=_0xfa8c50?_0xfa8c50:amiClient;return _0x283c5[_0x898a('0x9')](_0x3aadc2,_0x564583)[_0x898a('0xa')](function(_0x3150df){if(_0x3150df[_0x898a('0xb')]){if(_0x3150df[_0x898a('0xb')][_0x898a('0xc')]===0x1f4){return _0x42021d(_0x3150df[_0x898a('0xb')]['message']);}return _0x4fbce5(_0x3150df[_0x898a('0xb')]['message']);}else{_0x4fbce5(_0x3150df[_0x898a('0xd')]);}})['catch'](function(_0x25d7f2){_0x42021d(_0x25d7f2);});});}function respondWithResult(_0x2c76b7,_0x364a23){_0x364a23=_0x364a23||0xc8;return function(_0x5f5e06){if(_0x5f5e06){return _0x2c76b7['status'](_0x364a23)['json'](_0x5f5e06);}return _0x2c76b7[_0x898a('0xe')](0x194);};}function handleError(_0x1f5be4,_0xb24335){_0xb24335=_0xb24335||0x1f4;return function(_0x116fbe){logger[_0x898a('0xb')](_0x116fbe[_0x898a('0xf')]);if(_0x116fbe['name']){delete _0x116fbe[_0x898a('0x10')];}_0x1f5be4['status'](_0xb24335)[_0x898a('0x11')](_0x116fbe);};}function findById(_0x5c96a6){return function(_0x303321){if(!_['isNil'](_0x5c96a6)&&!_[_0x898a('0x12')](_0x303321)&&!_['isNil'](_0x303321[_0x898a('0x13')])){return _[_0x898a('0x14')](_0x303321[_0x898a('0x13')],function(_0x4ddd4d){return _0x4ddd4d['id']==_0x5c96a6;});}return null;};}exports[_0x898a('0x15')]=function(_0x5960e0,_0x54c8f3){return respondWithRpcPromise(_0x898a('0x16'),_0x5960e0[_0x898a('0x17')])['then'](respondWithResult(_0x54c8f3,null))['catch'](handleError(_0x54c8f3,null));};exports[_0x898a('0x18')]=function(_0x26449a,_0x38a8f0){return respondWithRpcPromise(_0x898a('0x19'),_[_0x898a('0x1a')](_0x26449a[_0x898a('0x17')],_0x26449a[_0x898a('0x1b')]))['then'](respondWithResult(_0x38a8f0,null))[_0x898a('0x1c')](handleError(_0x38a8f0,null));};exports[_0x898a('0x1d')]=function(_0x11cae2,_0x3cfd9c){return respondWithRpcPromise(_0x898a('0x1e'),_[_0x898a('0x1a')](_0x11cae2['query'],_0x11cae2[_0x898a('0x1b')]))[_0x898a('0xa')](respondWithResult(_0x3cfd9c,null))[_0x898a('0x1c')](handleError(_0x3cfd9c,null));};exports[_0x898a('0x1f')]=function(_0x3901ab,_0x1426e3){return respondWithRpcPromise('VoiceQueues',_0x3901ab[_0x898a('0x17')])['then'](respondWithResult(_0x1426e3,null))['catch'](handleError(_0x1426e3,null));};exports['showVoiceQueues']=function(_0x3678be,_0x1f4d86){return respondWithRpcPromise(_0x898a('0x20'),_0x3678be[_0x898a('0x17')])[_0x898a('0xa')](findById(_0x3678be[_0x898a('0x1b')]['id']))[_0x898a('0xa')](respondWithResult(_0x1f4d86,null))[_0x898a('0x1c')](handleError(_0x1f4d86,null));};exports[_0x898a('0x21')]=function(_0x58149d,_0x4b3e68){return respondWithRpcPromise('UpdateVoiceQueue',_[_0x898a('0x1a')](_0x58149d[_0x898a('0x22')],_0x58149d[_0x898a('0x1b')]))[_0x898a('0xa')](respondWithResult(_0x4b3e68,null))[_0x898a('0x1c')](handleError(_0x4b3e68,null));};exports[_0x898a('0x23')]=function(_0xe3c983,_0xf74645){return respondWithRpcPromise(_0x898a('0x24'),_[_0x898a('0x1a')](_0xe3c983[_0x898a('0x17')],_0xe3c983[_0x898a('0x1b')]))['then'](respondWithResult(_0xf74645,null))[_0x898a('0x1c')](handleError(_0xf74645,null));};exports[_0x898a('0x25')]=function(_0x26eead,_0x17a980){return respondWithRpcPromise(_0x898a('0x26'),_0x26eead['query'])['then'](respondWithResult(_0x17a980,null))[_0x898a('0x1c')](handleError(_0x17a980,null));};exports[_0x898a('0x27')]=function(_0x1d6d66,_0x4de9bf){return respondWithRpcPromise(_0x898a('0x28'),_[_0x898a('0x1a')](_0x1d6d66[_0x898a('0x17')],_0x1d6d66[_0x898a('0x1b')]))[_0x898a('0xa')](respondWithResult(_0x4de9bf,null))[_0x898a('0x1c')](handleError(_0x4de9bf,null));};exports[_0x898a('0x29')]=function(_0x146f32,_0x50bb4b){return respondWithRpcPromise(_0x898a('0x2a'),_['merge'](_0x146f32['query'],_0x146f32[_0x898a('0x1b')]))['then'](respondWithResult(_0x50bb4b,null))[_0x898a('0x1c')](handleError(_0x50bb4b,null));};exports['voiceQueuesChannelRedirect']=function(_0x37cb11,_0x4f202c){return respondWithRpcPromise(_0x898a('0x2b'),_[_0x898a('0x1a')](_0x37cb11[_0x898a('0x17')],_0x37cb11['params']))['then'](respondWithResult(_0x4f202c,null))['catch'](handleError(_0x4f202c,null));};exports[_0x898a('0x2c')]=function(_0x429c32,_0x5a228f){return respondWithRpcPromise(_0x898a('0x2d'),_0x429c32[_0x898a('0x17')])[_0x898a('0xa')](respondWithResult(_0x5a228f,null))[_0x898a('0x1c')](handleError(_0x5a228f,null));};exports['outboundChannels']=function(_0x4b07bc,_0x3aed01){return respondWithRpcPromise(_0x898a('0x2e'),_0x4b07bc['query'])['then'](respondWithResult(_0x3aed01,null))[_0x898a('0x1c')](handleError(_0x3aed01,null));};exports[_0x898a('0x2f')]=function(_0x181cc8,_0xa45405){var _0x51681f;return respondWithRpcPromise(_0x898a('0x30'),_0x181cc8[_0x898a('0x17')])['then'](function(_0x516b8c){_0x51681f=_0x516b8c;return respondWithRpcPromise('Agents',_0x181cc8[_0x898a('0x17')],routingClient);})[_0x898a('0xa')](function(_0x35d767){return _[_0x898a('0x1a')]({},_0x35d767,_0x51681f);})[_0x898a('0xa')](respondWithResult(_0xa45405,null))[_0x898a('0x1c')](handleError(_0xa45405,null));};exports[_0x898a('0x31')]=function(_0x1432ec,_0x3292c2){if(_0x1432ec[_0x898a('0x22')]&&_0x1432ec[_0x898a('0x22')][_0x898a('0x32')]&&_0x1432ec[_0x898a('0x33')]&&_0x1432ec[_0x898a('0x33')][_0x898a('0x10')]){for(var _0x4c8628 in _0x1432ec[_0x898a('0x22')][_0x898a('0x32')]){if(_0x1432ec[_0x898a('0x22')]['interaction'][_0x898a('0x34')](_0x4c8628)){db[_0x898a('0x35')][_0x898a('0x36')]({'where':{'channel':_0x4c8628,'membername':_0x1432ec[_0x898a('0x33')][_0x898a('0x10')],'type':_0x898a('0x37'),'exitAt':null,'uniqueid':_0x1432ec[_0x898a('0x22')][_0x898a('0x32')][_0x4c8628]&&_0x1432ec['body'][_0x898a('0x32')][_0x4c8628][_0x898a('0x38')]?{'$notIn':_0x1432ec[_0x898a('0x22')][_0x898a('0x32')][_0x4c8628]}:{'$ne':null}}})['then'](function(_0x3d5fba){var _0x152060=moment()['format'](_0x898a('0x39'));for(var _0x4ce00e=0x0,_0x56a40c=_0x3d5fba['length'];_0x4ce00e<_0x56a40c;_0x4ce00e+=0x1){_0x3d5fba[_0x4ce00e]['updateAttributes']({'exitAt':_0x152060});}});for(var _0x322ecc=0x0;_0x322ecc<_0x1432ec['body'][_0x898a('0x32')][_0x4c8628][_0x898a('0x38')];_0x322ecc+=0x1){db['MemberReport'][_0x898a('0x3a')]({'where':{'channel':_0x4c8628,'membername':_0x1432ec[_0x898a('0x33')]['name'],'type':_0x898a('0x37'),'uniqueid':_0x1432ec[_0x898a('0x22')][_0x898a('0x32')][_0x4c8628][_0x322ecc],'exitAt':null},'defaults':{'channel':_0x4c8628,'membername':_0x1432ec[_0x898a('0x33')]['name'],'interface':_[_0x898a('0x12')](_0x1432ec[_0x898a('0x33')]['interface'])?util[_0x898a('0x3b')](_0x898a('0x3c'),_0x1432ec['user'][_0x898a('0x10')]):_0x1432ec['user'][_0x898a('0x3d')],'type':_0x898a('0x37'),'enterAt':moment()[_0x898a('0x3b')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x898a('0x3e'),'internal':_0x1432ec[_0x898a('0x33')][_0x898a('0x3f')],'uniqueid':_0x1432ec[_0x898a('0x22')]['interaction'][_0x4c8628][_0x322ecc]}});}}}}return respondWithRpcPromise(_0x898a('0x40'),{'id':_0x1432ec['params']['id'],'capacity':_0x1432ec[_0x898a('0x22')][_0x898a('0x41')]},routingClient)[_0x898a('0xa')](respondWithResult(_0x3292c2,null))['catch'](handleError(_0x3292c2,null));};exports[_0x898a('0x42')]=function(_0x3c4db0,_0x195ac2){return respondWithRpcPromise('Telephones',_0x3c4db0['query'])[_0x898a('0xa')](respondWithResult(_0x195ac2,null))[_0x898a('0x1c')](handleError(_0x195ac2,null));};exports[_0x898a('0x43')]=function(_0x295f1e,_0x28b8c9){return respondWithRpcPromise(_0x898a('0x44'),_0x295f1e[_0x898a('0x17')])[_0x898a('0xa')](respondWithResult(_0x28b8c9,null))[_0x898a('0x1c')](handleError(_0x28b8c9,null));};exports[_0x898a('0x45')]=function(_0x2382a9,_0x5e9329){return respondWithRpcPromise(_0x898a('0x46'),_0x2382a9[_0x898a('0x17')])['then'](respondWithResult(_0x5e9329,null))[_0x898a('0x1c')](handleError(_0x5e9329,null));};exports['chatQueues']=function(_0x54c44b,_0x15f11e){return respondWithRpcPromise(_0x898a('0x47'),_0x54c44b[_0x898a('0x17')],routingClient)['then'](respondWithResult(_0x15f11e,null))['catch'](handleError(_0x15f11e,null));};exports[_0x898a('0x48')]=function(_0x1f5e4b,_0x515725){return respondWithRpcPromise(_0x898a('0x47'),_0x1f5e4b[_0x898a('0x17')],routingClient)['then'](findById(_0x1f5e4b[_0x898a('0x1b')]['id']))[_0x898a('0xa')](respondWithResult(_0x515725,null))[_0x898a('0x1c')](handleError(_0x515725,null));};exports['mailQueues']=function(_0xf29714,_0x2ef2f1){return respondWithRpcPromise(_0x898a('0x49'),_0xf29714[_0x898a('0x17')],routingClient)[_0x898a('0xa')](respondWithResult(_0x2ef2f1,null))[_0x898a('0x1c')](handleError(_0x2ef2f1,null));};exports['showMailQueues']=function(_0x22a08a,_0x4df5f0){return respondWithRpcPromise(_0x898a('0x49'),_0x22a08a[_0x898a('0x17')],routingClient)[_0x898a('0xa')](findById(_0x22a08a[_0x898a('0x1b')]['id']))[_0x898a('0xa')](respondWithResult(_0x4df5f0,null))[_0x898a('0x1c')](handleError(_0x4df5f0,null));};exports[_0x898a('0x4a')]=function(_0x75ff57,_0x3c761c){return respondWithRpcPromise('MailAccounts',_0x75ff57[_0x898a('0x17')],mailClient)[_0x898a('0xa')](respondWithResult(_0x3c761c,null))[_0x898a('0x1c')](handleError(_0x3c761c,null));};exports[_0x898a('0x4b')]=function(_0x219976,_0x2a1345){return respondWithRpcPromise(_0x898a('0x4c'),_0x219976[_0x898a('0x17')],routingClient)[_0x898a('0xa')](respondWithResult(_0x2a1345,null))[_0x898a('0x1c')](handleError(_0x2a1345,null));};exports[_0x898a('0x4d')]=function(_0x217dda,_0x3331c0){return respondWithRpcPromise(_0x898a('0x4c'),_0x217dda[_0x898a('0x17')],routingClient)['then'](findById(_0x217dda[_0x898a('0x1b')]['id']))[_0x898a('0xa')](respondWithResult(_0x3331c0,null))['catch'](handleError(_0x3331c0,null));};exports[_0x898a('0x4e')]=function(_0x4583a1,_0x5f0944){return respondWithRpcPromise(_0x898a('0x4f'),_0x4583a1[_0x898a('0x17')],routingClient)[_0x898a('0xa')](respondWithResult(_0x5f0944,null))[_0x898a('0x1c')](handleError(_0x5f0944,null));};exports['showSmsQueues']=function(_0xdc0cc4,_0x11def5){return respondWithRpcPromise(_0x898a('0x4f'),_0xdc0cc4[_0x898a('0x17')],routingClient)['then'](findById(_0xdc0cc4[_0x898a('0x1b')]['id']))[_0x898a('0xa')](respondWithResult(_0x11def5,null))['catch'](handleError(_0x11def5,null));};exports[_0x898a('0x50')]=function(_0x3c0bf6,_0x5b7019){return respondWithRpcPromise(_0x898a('0x51'),_0x3c0bf6['query'],routingClient)[_0x898a('0xa')](respondWithResult(_0x5b7019,null))['catch'](handleError(_0x5b7019,null));};exports['showWhatsappQueues']=function(_0x5ed35e,_0xfdd6d8){return respondWithRpcPromise(_0x898a('0x51'),_0x5ed35e[_0x898a('0x17')],routingClient)[_0x898a('0xa')](findById(_0x5ed35e['params']['id']))['then'](respondWithResult(_0xfdd6d8,null))[_0x898a('0x1c')](handleError(_0xfdd6d8,null));};exports[_0x898a('0x52')]=function(_0x1c2661,_0x5dc44e){return respondWithRpcPromise(_0x898a('0x53'),_0x1c2661[_0x898a('0x17')],routingClient)[_0x898a('0xa')](respondWithResult(_0x5dc44e,null))[_0x898a('0x1c')](handleError(_0x5dc44e,null));};exports['showFaxQueues']=function(_0xaac6d4,_0x43bf93){return respondWithRpcPromise('FaxQueues',_0xaac6d4[_0x898a('0x17')],routingClient)[_0x898a('0xa')](findById(_0xaac6d4[_0x898a('0x1b')]['id']))[_0x898a('0xa')](respondWithResult(_0x43bf93,null))[_0x898a('0x1c')](handleError(_0x43bf93,null));};exports[_0x898a('0x54')]=function(_0x3bcc3d,_0x2dc61c){return respondWithRpcPromise(_0x898a('0x55'),_0x3bcc3d[_0x898a('0x17')])[_0x898a('0xa')](respondWithResult(_0x2dc61c,null))[_0x898a('0x1c')](handleError(_0x2dc61c,null));};exports[_0x898a('0x56')]=function(_0x4a7705,_0x2d9a9c){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x4a7705[_0x898a('0x17')],routingClient)[_0x898a('0xa')](respondWithResult(_0x2d9a9c,null))[_0x898a('0x1c')](handleError(_0x2d9a9c,null));};exports['mailQueuesWaitingInteractions']=function(_0x31102d,_0x3f0d9f){return respondWithRpcPromise(_0x898a('0x57'),_0x31102d[_0x898a('0x17')],routingClient)[_0x898a('0xa')](respondWithResult(_0x3f0d9f,null))['catch'](handleError(_0x3f0d9f,null));};exports[_0x898a('0x58')]=function(_0x352ebb,_0x37b1d0){return respondWithRpcPromise(_0x898a('0x59'),_0x352ebb[_0x898a('0x17')],routingClient)['then'](respondWithResult(_0x37b1d0,null))[_0x898a('0x1c')](handleError(_0x37b1d0,null));};exports[_0x898a('0x5a')]=function(_0x474029,_0x37d205){return respondWithRpcPromise(_0x898a('0x59'),_0x474029[_0x898a('0x17')],routingClient)[_0x898a('0xa')](function(_0x1b0c09){if(_0x474029['query'][_0x898a('0x5b')]!==undefined){var _0x4607e1=_(_0x1b0c09['rows'])[_0x898a('0x5c')]([_0x474029['query'][_0x898a('0x5b')],_0x474029['params']['id']])[_0x898a('0x5d')](_0x898a('0x5e'))[_0x898a('0x5f')]()[_0x898a('0x60')]();return _0x1b0c09[_0x898a('0x13')][_0x898a('0x5c')](function(_0x170267){return _0x4607e1[_0x898a('0x61')](_0x170267[_0x898a('0x5e')])>-0x1;});}else{return _0x1b0c09['rows'][_0x898a('0x5c')](function(_0xd627d0){return _0xd627d0[_0x898a('0x5e')]===parseInt(_0x474029[_0x898a('0x1b')]['id']);});}})[_0x898a('0xa')](respondWithResult(_0x37d205,null))[_0x898a('0x1c')](handleError(_0x37d205,null));};exports[_0x898a('0x62')]=function(_0x4bcf85,_0x380f8c){return respondWithRpcPromise(_0x898a('0x63'),_0x4bcf85['query'],routingClient)['then'](respondWithResult(_0x380f8c,null))[_0x898a('0x1c')](handleError(_0x380f8c,null));};exports[_0x898a('0x64')]=function(_0x48e9c2,_0x5710a0){return respondWithRpcPromise(_0x898a('0x65'),_0x48e9c2['query'],routingClient)[_0x898a('0xa')](respondWithResult(_0x5710a0,null))[_0x898a('0x1c')](handleError(_0x5710a0,null));};exports['faxQueuesWaitingInteractions']=function(_0x3f6815,_0x1c782e){return respondWithRpcPromise(_0x898a('0x66'),_0x3f6815[_0x898a('0x17')],routingClient)[_0x898a('0xa')](respondWithResult(_0x1c782e,null))[_0x898a('0x1c')](handleError(_0x1c782e,null));};exports[_0x898a('0x67')]=function(_0x49f8ac){return function(_0x3237e8,_0x1efe1e){var _0x37ee4d,_0x50d978;var _0x27560f=_[_0x898a('0x68')](_0x49f8ac);var _0x5c6247=_0x49f8ac===_0x898a('0x69')?'Website':'Account';return db[_0x27560f+'Queue'][_0x898a('0x6a')]({'raw':!![],'where':{'id':_0x3237e8[_0x898a('0x1b')]['id']}})[_0x898a('0xa')](function(_0x2079d0){if(_[_0x898a('0x12')](_0x2079d0)){throw new Error(_0x27560f+_0x898a('0x6b'));}_0x37ee4d=_0x2079d0;return db[_0x27560f+_0x898a('0x6c')]['findOne']({'where':{'id':_0x3237e8[_0x898a('0x22')]['messageId']},'include':[{'model':db[_0x27560f+_0x898a('0x6d')],'as':_0x898a('0x6d')},{'model':db[_0x27560f+_0x5c6247],'as':'Account'}]});})[_0x898a('0xa')](function(_0x2269fb){if(_[_0x898a('0x12')](_0x2269fb)){throw new Error(_0x27560f+_0x898a('0x6e'));}_0x50d978=_0x2269fb;return _0x2269fb[_0x898a('0x6f')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x5847cb={'uniqueid':_0x49f8ac+'.'+_0x50d978['id']+'.'+_0x50d978['Interaction']['id'],'FromUserId':_0x3237e8[_0x898a('0x33')]['id'],'type':_0x898a('0x70')};_0x5847cb[_0x27560f+_0x898a('0x71')]=_0x50d978['id'];_0x5847cb[_0x27560f+'InteractionId']=_0x50d978[_0x898a('0x6d')]['id'];_0x5847cb['From'+_0x27560f+_0x5c6247+'Id']=_0x50d978['Account']['id'];_0x5847cb['To'+_0x27560f+_0x898a('0x72')]=_0x37ee4d['id'];return db[_0x27560f+_0x898a('0x73')][_0x898a('0x74')](_0x5847cb);})[_0x898a('0xa')](function(){return respondWithRpcPromise(_0x898a('0x75'),{'channel':_0x49f8ac,'interaction':_0x50d978[_0x898a('0x6d')],'message':_0x50d978,'account':_0x50d978[_0x898a('0x76')],'applications':[{'id':0x0,'priority':0x1,'app':_0x898a('0x70'),'appdata':_0x37ee4d[_0x898a('0x10')]+','+(_0x50d978[_0x898a('0x76')][_0x898a('0x77')]||0x12c),'interval':_0x898a('0x78')}]},routingClient);})[_0x898a('0xa')](respondWithResult(_0x1efe1e,null))[_0x898a('0x1c')](handleError(_0x1efe1e,null));};};exports[_0x898a('0x79')]=function(_0x3d9634,_0x54c440){var _0x435689,_0x3eaf3e;if(_[_0x898a('0x12')](_0x3d9634[_0x898a('0x22')][_0x898a('0x7a')])){throw new Error(_0x898a('0x7b'));}var _0xd45b78=_0x3d9634[_0x898a('0x22')][_0x898a('0x7a')];var _0x427eff=_[_0x898a('0x68')](_0xd45b78);var _0x381071=_0xd45b78==='chat'?_0x898a('0x7c'):'Account';return db[_0x898a('0x7d')][_0x898a('0x6a')]({'raw':!![],'where':{'id':_0x3d9634[_0x898a('0x1b')]['id'],'role':'agent'}})[_0x898a('0xa')](function(_0x223775){if(_['isNil'](_0x223775)){throw new Error(_0x898a('0x7e'));}_0x435689=_0x223775;return db[_0x427eff+_0x898a('0x6c')][_0x898a('0x6a')]({'where':{'id':_0x3d9634[_0x898a('0x22')][_0x898a('0x7f')]},'include':[{'model':db[_0x427eff+_0x898a('0x6d')],'as':'Interaction'},{'model':db[_0x427eff+_0x381071],'as':'Account'}]});})[_0x898a('0xa')](function(_0x4b7334){if(_[_0x898a('0x12')](_0x4b7334)){throw new Error(_0x427eff+_0x898a('0x6e'));}_0x3eaf3e=_0x4b7334;return _0x4b7334[_0x898a('0x6f')]({'read':0x0,'readAt':null,'UserId':null});})[_0x898a('0xa')](function(){var _0x13b3f9={'uniqueid':_0xd45b78+'.'+_0x3eaf3e['id']+'.'+_0x3eaf3e[_0x898a('0x6d')]['id'],'FromUserId':_0x3d9634['user']['id'],'type':'queue','ToUserId':_0x435689['id']};_0x13b3f9[_0x427eff+_0x898a('0x71')]=_0x3eaf3e['id'];_0x13b3f9[_0x427eff+'InteractionId']=_0x3eaf3e[_0x898a('0x6d')]['id'];_0x13b3f9[_0x898a('0x80')+_0x427eff+_0x381071+'Id']=_0x3eaf3e['Account']['id'];return db[_0x427eff+_0x898a('0x73')]['create'](_0x13b3f9);})[_0x898a('0xa')](function(){return respondWithRpcPromise(_0x898a('0x75'),{'channel':_0xd45b78,'interaction':_0x3eaf3e[_0x898a('0x6d')],'message':_0x3eaf3e,'account':_0x3eaf3e['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x435689['name']+','+(_0x3eaf3e[_0x898a('0x76')][_0x898a('0x81')]||0x12c),'interval':_0x898a('0x78')}]},routingClient);})[_0x898a('0xa')](respondWithResult(_0x54c440,null))[_0x898a('0x1c')](handleError(_0x54c440,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 49ada6d..8b34b97 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 _0xa018=['/:id','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','show','/:id/run','run','create'];(function(_0xbd4254,_0x31c08b){var _0x46c0f3=function(_0xd0dce7){while(--_0xd0dce7){_0xbd4254['push'](_0xbd4254['shift']());}};_0x46c0f3(++_0x31c08b);}(_0xa018,0x180));var _0x8a01=function(_0x2c7949,_0x14eeb9){_0x2c7949=_0x2c7949-0x0;var _0x4fad70=_0xa018[_0x2c7949];return _0x4fad70;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8a01('0x0'));var timeout=require(_0x8a01('0x1'));var express=require(_0x8a01('0x2'));var router=express[_0x8a01('0x3')]();var fs_extra=require(_0x8a01('0x4'));var auth=require(_0x8a01('0x5'));var interaction=require(_0x8a01('0x6'));var config=require(_0x8a01('0x7'));var controller=require(_0x8a01('0x8'));router[_0x8a01('0x9')]('/',auth[_0x8a01('0xa')](),controller[_0x8a01('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x8a01('0xc')]);router[_0x8a01('0x9')](_0x8a01('0xd'),auth[_0x8a01('0xa')](),controller[_0x8a01('0xe')]);router['post']('/',auth[_0x8a01('0xa')](),controller[_0x8a01('0xf')]);router['put'](_0x8a01('0x10'),auth['isAuthenticated'](),controller['update']);router[_0x8a01('0x11')]('/:id',auth[_0x8a01('0xa')](),controller[_0x8a01('0x12')]);module[_0x8a01('0x13')]=router; \ No newline at end of file +var _0x67b1=['update','delete','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./schedule.controller','get','isAuthenticated','/:id','show','/:id/run','run','post','create'];(function(_0x15418e,_0x475184){var _0x1b1d42=function(_0x31bfb6){while(--_0x31bfb6){_0x15418e['push'](_0x15418e['shift']());}};_0x1b1d42(++_0x475184);}(_0x67b1,0x16d));var _0x167b=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x67b1[_0x134c2e];return _0x2825db;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x167b('0x0'));var timeout=require('connect-timeout');var express=require(_0x167b('0x1'));var router=express[_0x167b('0x2')]();var fs_extra=require(_0x167b('0x3'));var auth=require(_0x167b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x167b('0x5'));var controller=require(_0x167b('0x6'));router[_0x167b('0x7')]('/',auth[_0x167b('0x8')](),controller['index']);router[_0x167b('0x7')](_0x167b('0x9'),auth[_0x167b('0x8')](),controller[_0x167b('0xa')]);router[_0x167b('0x7')](_0x167b('0xb'),auth[_0x167b('0x8')](),controller[_0x167b('0xc')]);router[_0x167b('0xd')]('/',auth[_0x167b('0x8')](),controller[_0x167b('0xe')]);router['put'](_0x167b('0x9'),auth['isAuthenticated'](),controller[_0x167b('0xf')]);router[_0x167b('0x10')](_0x167b('0x9'),auth[_0x167b('0x8')](),controller[_0x167b('0x11')]);module[_0x167b('0x12')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index c69c47c..0450af2 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 _0x3d47=['INTEGER','ENUM','months','weeks','days','minutes','csv','pdf','default','TEXT','exports','STRING','BOOLEAN'];(function(_0x35e7f5,_0x505458){var _0x21327e=function(_0x24ee98){while(--_0x24ee98){_0x35e7f5['push'](_0x35e7f5['shift']());}};_0x21327e(++_0x505458);}(_0x3d47,0x135));var _0x73d4=function(_0x4b297c,_0x540bfa){_0x4b297c=_0x4b297c-0x0;var _0x159ae5=_0x3d47[_0x4b297c];return _0x159ae5;};'use strict';var Sequelize=require('sequelize');module[_0x73d4('0x0')]={'name':{'type':Sequelize[_0x73d4('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x73d4('0x1')]},'active':{'type':Sequelize[_0x73d4('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x73d4('0x1')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x73d4('0x3')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x73d4('0x4')]('years','quarters',_0x73d4('0x5'),_0x73d4('0x6'),_0x73d4('0x7'),'hours',_0x73d4('0x8')),'allowNull':![],'defaultValue':_0x73d4('0x7')},'output':{'type':Sequelize[_0x73d4('0x4')](_0x73d4('0x9'),_0x73d4('0xa'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x73d4('0x4')]('custom',_0x73d4('0xb')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x73d4('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x73d4('0x1')]},'cc':{'type':Sequelize[_0x73d4('0xc')]},'bcc':{'type':Sequelize[_0x73d4('0xc')]},'sendIfEmpty':{'type':Sequelize[_0x73d4('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x7d5f=['xlsx','default','TEXT','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','years','months','weeks','days','hours','ENUM','csv'];(function(_0x525181,_0x52f2ca){var _0x13672b=function(_0x53ee15){while(--_0x53ee15){_0x525181['push'](_0x525181['shift']());}};_0x13672b(++_0x52f2ca);}(_0x7d5f,0xa8));var _0xf7d5=function(_0x3011ca,_0x47685b){_0x3011ca=_0x3011ca-0x0;var _0x370402=_0x7d5f[_0x3011ca];return _0x370402;};'use strict';var Sequelize=require('sequelize');module[_0xf7d5('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xf7d5('0x1')]},'active':{'type':Sequelize[_0xf7d5('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf7d5('0x3')},'startAt':{'type':Sequelize[_0xf7d5('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0xf7d5('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0xf7d5('0x5'),'quarters',_0xf7d5('0x6'),_0xf7d5('0x7'),_0xf7d5('0x8'),_0xf7d5('0x9'),'minutes'),'allowNull':![],'defaultValue':_0xf7d5('0x8')},'output':{'type':Sequelize[_0xf7d5('0xa')](_0xf7d5('0xb'),'pdf',_0xf7d5('0xc')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0xf7d5('0xa')]('custom',_0xf7d5('0xd')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0xf7d5('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xf7d5('0x1')]},'cc':{'type':Sequelize[_0xf7d5('0xe')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index bf5af69..ea6bcd3 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 _0xac72=['querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','status','json','undefined','limit','offset','count','set','Content-Range','reject','save','then','destroy','get','Scheduler','UserProfileResource','end','sendStatus','error','name','send','index','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','order','sort','where','filter','merge','VIRTUAL','options','Schedule','includeAll','include','catch','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','sox','to-csv','ejs','fs-extra','squel','jsforce'];(function(_0x58fc2f,_0x111399){var _0x3a1312=function(_0x3d2ff2){while(--_0x3d2ff2){_0x58fc2f['push'](_0x58fc2f['shift']());}};_0x3a1312(++_0x111399);}(_0xac72,0xdb));var _0x2ac7=function(_0x53610e,_0x5d11ec){_0x53610e=_0x53610e-0x0;var _0x15f323=_0xac72[_0x53610e];return _0x15f323;};'use strict';var emlformat=require(_0x2ac7('0x0'));var rimraf=require(_0x2ac7('0x1'));var zipdir=require(_0x2ac7('0x2'));var jsonpatch=require(_0x2ac7('0x3'));var rp=require(_0x2ac7('0x4'));var moment=require('moment');var BPromise=require(_0x2ac7('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x2ac7('0x6'));var csv=require(_0x2ac7('0x7'));var ejs=require(_0x2ac7('0x8'));var fs=require('fs');var fs_extra=require(_0x2ac7('0x9'));var _=require('lodash');var squel=require(_0x2ac7('0xa'));var crypto=require('crypto');var jsforce=require(_0x2ac7('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x2ac7('0x7'));var querystring=require(_0x2ac7('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2ac7('0xd'));var qs=require(_0x2ac7('0xe'));var as=require(_0x2ac7('0xf'));var hardwareService=require(_0x2ac7('0x10'));var logger=require(_0x2ac7('0x11'))(_0x2ac7('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2ac7('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x455b78,_0x24a86a){_0x24a86a=_0x24a86a||0xcc;return function(_0x330b96){if(_0x330b96){return _0x455b78['sendStatus'](_0x24a86a);}return _0x455b78[_0x2ac7('0x14')](_0x24a86a)['end']();};}function respondWithResult(_0x11b0c5,_0x498bb0){_0x498bb0=_0x498bb0||0xc8;return function(_0x2cb443){if(_0x2cb443){return _0x11b0c5['status'](_0x498bb0)[_0x2ac7('0x15')](_0x2cb443);}};}function respondWithFilteredResult(_0x1621ea,_0x286907){return function(_0x448e2c){if(_0x448e2c){var _0x1bf959=typeof _0x286907['offset']===_0x2ac7('0x16')&&typeof _0x286907[_0x2ac7('0x17')]==='undefined';var _0x57409c=_0x448e2c['count'];var _0x239db1=_0x1bf959?0x0:_0x286907[_0x2ac7('0x18')];var _0x9b61e4=_0x1bf959?_0x448e2c[_0x2ac7('0x19')]:_0x286907[_0x2ac7('0x18')]+_0x286907[_0x2ac7('0x17')];var _0x549fb2;if(_0x9b61e4>=_0x57409c){_0x9b61e4=_0x57409c;_0x549fb2=0xc8;}else{_0x549fb2=0xce;}_0x1621ea[_0x2ac7('0x14')](_0x549fb2);return _0x1621ea[_0x2ac7('0x1a')](_0x2ac7('0x1b'),_0x239db1+'-'+_0x9b61e4+'/'+_0x57409c)[_0x2ac7('0x15')](_0x448e2c);}return null;};}function patchUpdates(_0x5035db){return function(_0x19473e){try{jsonpatch['apply'](_0x19473e,_0x5035db,!![]);}catch(_0x2d3d9a){return BPromise[_0x2ac7('0x1c')](_0x2d3d9a);}return _0x19473e[_0x2ac7('0x1d')]();};}function saveUpdates(_0x8a840a,_0x20cf96){return function(_0x3981b3){if(_0x3981b3){return _0x3981b3['update'](_0x8a840a)[_0x2ac7('0x1e')](function(_0x25833b){return _0x25833b;});}return null;};}function removeEntity(_0x38d150,_0x87d7d4){return function(_0x3eb7e0){if(_0x3eb7e0){return _0x3eb7e0[_0x2ac7('0x1f')]()[_0x2ac7('0x1e')](function(){var _0x5857d4=_0x3eb7e0[_0x2ac7('0x20')]({'plain':!![]});var _0x16e1f4=_0x2ac7('0x21');return db[_0x2ac7('0x22')][_0x2ac7('0x1f')]({'where':{'type':_0x16e1f4,'resourceId':_0x5857d4['id']}})[_0x2ac7('0x1e')](function(){return _0x3eb7e0;});})[_0x2ac7('0x1e')](function(){_0x38d150[_0x2ac7('0x14')](0xcc)[_0x2ac7('0x23')]();});}};}function handleEntityNotFound(_0x49e643,_0x24838b){return function(_0x5227ff){if(!_0x5227ff){_0x49e643[_0x2ac7('0x24')](0x194);}return _0x5227ff;};}function handleError(_0x77bffa,_0x4b65ff){_0x4b65ff=_0x4b65ff||0x1f4;return function(_0x529f5d){logger[_0x2ac7('0x25')](_0x529f5d['stack']);if(_0x529f5d[_0x2ac7('0x26')]){delete _0x529f5d[_0x2ac7('0x26')];}_0x77bffa[_0x2ac7('0x14')](_0x4b65ff)[_0x2ac7('0x27')](_0x529f5d);};}exports[_0x2ac7('0x28')]=function(_0x47639f,_0x28cca2){var _0xc0600e={},_0x517bd1={},_0x3d835e={'count':0x0,'rows':[]};var _0x4f9198=_['map'](db['Schedule']['rawAttributes'],function(_0x37a56e){return{'name':_0x37a56e[_0x2ac7('0x29')],'type':_0x37a56e[_0x2ac7('0x2a')][_0x2ac7('0x2b')]};});_0x517bd1[_0x2ac7('0x2c')]=_[_0x2ac7('0x2d')](_0x4f9198,_0x2ac7('0x26'));_0x517bd1[_0x2ac7('0x2e')]=_[_0x2ac7('0x2f')](_0x47639f[_0x2ac7('0x2e')]);_0x517bd1[_0x2ac7('0x30')]=_[_0x2ac7('0x31')](_0x517bd1[_0x2ac7('0x2c')],_0x517bd1[_0x2ac7('0x2e')]);_0xc0600e[_0x2ac7('0x32')]=_['intersection'](_0x517bd1['model'],qs['fields'](_0x47639f[_0x2ac7('0x2e')][_0x2ac7('0x33')]));_0xc0600e['attributes']=_0xc0600e[_0x2ac7('0x32')]['length']?_0xc0600e[_0x2ac7('0x32')]:_0x517bd1['model'];if(!_0x47639f[_0x2ac7('0x2e')]['hasOwnProperty']('nolimit')){_0xc0600e[_0x2ac7('0x17')]=qs[_0x2ac7('0x17')](_0x47639f[_0x2ac7('0x2e')][_0x2ac7('0x17')]);_0xc0600e[_0x2ac7('0x18')]=qs[_0x2ac7('0x18')](_0x47639f[_0x2ac7('0x2e')][_0x2ac7('0x18')]);}_0xc0600e[_0x2ac7('0x34')]=qs['sort'](_0x47639f[_0x2ac7('0x2e')][_0x2ac7('0x35')]);_0xc0600e[_0x2ac7('0x36')]=qs[_0x2ac7('0x30')](_['pick'](_0x47639f['query'],_0x517bd1['filters']),_0x4f9198);if(_0x47639f[_0x2ac7('0x2e')][_0x2ac7('0x37')]){_0xc0600e[_0x2ac7('0x36')]=_[_0x2ac7('0x38')](_0xc0600e[_0x2ac7('0x36')],{'$or':_[_0x2ac7('0x2d')](_0x4f9198,function(_0x323130){if(_0x323130[_0x2ac7('0x2a')]!==_0x2ac7('0x39')){var _0x19a57e={};_0x19a57e[_0x323130['name']]={'$like':'%'+_0x47639f[_0x2ac7('0x2e')][_0x2ac7('0x37')]+'%'};return _0x19a57e;}})});}_0xc0600e=_[_0x2ac7('0x38')]({},_0xc0600e,_0x47639f[_0x2ac7('0x3a')]);var _0x2943e4={'where':_0xc0600e[_0x2ac7('0x36')]};return db[_0x2ac7('0x3b')][_0x2ac7('0x19')](_0x2943e4)[_0x2ac7('0x1e')](function(_0x2fe3a6){_0x3d835e[_0x2ac7('0x19')]=_0x2fe3a6;if(_0x47639f['query'][_0x2ac7('0x3c')]){_0xc0600e[_0x2ac7('0x3d')]=[{'all':!![]}];}return db['Schedule']['findAll'](_0xc0600e);})['then'](function(_0x163abc){_0x3d835e['rows']=_0x163abc;return _0x3d835e;})[_0x2ac7('0x1e')](respondWithFilteredResult(_0x28cca2,_0xc0600e))[_0x2ac7('0x3e')](handleError(_0x28cca2,null));};exports['show']=function(_0x4fafee,_0x5c32aa){var _0x139048={'raw':![],'where':{'id':_0x4fafee[_0x2ac7('0x3f')]['id']}},_0x24a398={};_0x24a398['model']=_[_0x2ac7('0x2f')](db[_0x2ac7('0x3b')]['rawAttributes']);_0x24a398[_0x2ac7('0x2e')]=_['keys'](_0x4fafee['query']);_0x24a398[_0x2ac7('0x30')]=_['intersection'](_0x24a398['model'],_0x24a398[_0x2ac7('0x2e')]);_0x139048[_0x2ac7('0x32')]=_[_0x2ac7('0x31')](_0x24a398[_0x2ac7('0x2c')],qs[_0x2ac7('0x33')](_0x4fafee[_0x2ac7('0x2e')][_0x2ac7('0x33')]));_0x139048['attributes']=_0x139048[_0x2ac7('0x32')]['length']?_0x139048[_0x2ac7('0x32')]:_0x24a398[_0x2ac7('0x2c')];if(_0x4fafee[_0x2ac7('0x2e')][_0x2ac7('0x3c')]){_0x139048['include']=[{'all':!![]}];}_0x139048=_['merge']({},_0x139048,_0x4fafee[_0x2ac7('0x3a')]);return db[_0x2ac7('0x3b')][_0x2ac7('0x40')](_0x139048)['then'](handleEntityNotFound(_0x5c32aa,null))[_0x2ac7('0x1e')](respondWithResult(_0x5c32aa,null))[_0x2ac7('0x3e')](handleError(_0x5c32aa,null));};exports[_0x2ac7('0x41')]=function(_0x1f9f96,_0x54aaed){return db['Schedule'][_0x2ac7('0x41')](_0x1f9f96['body'],{})[_0x2ac7('0x1e')](function(_0xd6f2dd){var _0x5cc6a1=_0x1f9f96[_0x2ac7('0x42')]['get']({'plain':!![]});if(!_0x5cc6a1)throw new Error(_0x2ac7('0x43'));if(_0x5cc6a1[_0x2ac7('0x44')]===_0x2ac7('0x42')){var _0x92abd1=_0xd6f2dd['get']({'plain':!![]});var _0x15cc59=_0x2ac7('0x21');return db[_0x2ac7('0x45')][_0x2ac7('0x40')]({'where':{'name':_0x15cc59,'userProfileId':_0x5cc6a1[_0x2ac7('0x46')]},'raw':!![]})['then'](function(_0x4ca683){if(_0x4ca683&&_0x4ca683[_0x2ac7('0x47')]===0x0){return db[_0x2ac7('0x22')][_0x2ac7('0x41')]({'name':_0x92abd1[_0x2ac7('0x26')],'resourceId':_0x92abd1['id'],'type':_0x4ca683['name'],'sectionId':_0x4ca683['id']},{})[_0x2ac7('0x1e')](function(){return _0xd6f2dd;});}else{return _0xd6f2dd;}})[_0x2ac7('0x3e')](function(_0x5398eb){logger[_0x2ac7('0x25')](_0x2ac7('0x48'),_0x5398eb);throw _0x5398eb;});}return _0xd6f2dd;})['then'](respondWithResult(_0x54aaed,0xc9))[_0x2ac7('0x3e')](handleError(_0x54aaed,null));};exports[_0x2ac7('0x49')]=function(_0x20a442,_0x32e912){if(_0x20a442[_0x2ac7('0x4a')]['id']){delete _0x20a442[_0x2ac7('0x4a')]['id'];}return db[_0x2ac7('0x3b')]['find']({'where':{'id':_0x20a442['params']['id']}})[_0x2ac7('0x1e')](handleEntityNotFound(_0x32e912,null))[_0x2ac7('0x1e')](saveUpdates(_0x20a442[_0x2ac7('0x4a')],null))[_0x2ac7('0x1e')](respondWithResult(_0x32e912,null))[_0x2ac7('0x3e')](handleError(_0x32e912,null));};exports[_0x2ac7('0x1f')]=function(_0x5a3e62,_0x511fdf){return db[_0x2ac7('0x3b')][_0x2ac7('0x40')]({'where':{'id':_0x5a3e62[_0x2ac7('0x3f')]['id']}})[_0x2ac7('0x1e')](handleEntityNotFound(_0x511fdf,null))['then'](removeEntity(_0x511fdf,null))['catch'](handleError(_0x511fdf,null));};exports[_0x2ac7('0x4b')]=function(_0x36d6a7,_0x202412,_0x4a65e3){var _0x25e09d=require(_0x2ac7('0x4c'));return db['Schedule'][_0x2ac7('0x40')]({'where':{'id':_0x36d6a7[_0x2ac7('0x3f')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x202412,null))[_0x2ac7('0x1e')](function(){_0x25e09d[_0x2ac7('0x4b')](_0x36d6a7['params']['id']);})[_0x2ac7('0x1e')](respondWithStatusCode(_0x202412,null))[_0x2ac7('0x3e')](handleError(_0x202412,null));}; \ No newline at end of file +var _0x9099=['map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','userProfileId','autoAssociation','update','run','../../config/schedule','eml-format','rimraf','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','Content-Range','json','apply','save','then','destroy','Scheduler','UserProfileResource','error','name','send','index','Schedule','rawAttributes','type'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9099,0x109));var _0x9909=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x9099[_0x47b58b];return _0x46bebe;};'use strict';var emlformat=require(_0x9909('0x0'));var rimraf=require(_0x9909('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9909('0x2'));var Mustache=require(_0x9909('0x3'));var util=require('util');var path=require(_0x9909('0x4'));var sox=require('sox');var csv=require(_0x9909('0x5'));var ejs=require(_0x9909('0x6'));var fs=require('fs');var fs_extra=require(_0x9909('0x7'));var _=require(_0x9909('0x8'));var squel=require(_0x9909('0x9'));var crypto=require('crypto');var jsforce=require(_0x9909('0xa'));var deskjs=require(_0x9909('0xb'));var toCsv=require(_0x9909('0x5'));var querystring=require('querystring');var Papa=require(_0x9909('0xc'));var Redis=require('ioredis');var authService=require(_0x9909('0xd'));var qs=require(_0x9909('0xe'));var as=require(_0x9909('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9909('0x10'))(_0x9909('0x11'));var utils=require(_0x9909('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x9909('0x13'));var db=require(_0x9909('0x14'))['db'];function respondWithStatusCode(_0xf4d341,_0x2249c1){_0x2249c1=_0x2249c1||0xcc;return function(_0x483924){if(_0x483924){return _0xf4d341[_0x9909('0x15')](_0x2249c1);}return _0xf4d341[_0x9909('0x16')](_0x2249c1)[_0x9909('0x17')]();};}function respondWithResult(_0x5bff36,_0x3d5cc6){_0x3d5cc6=_0x3d5cc6||0xc8;return function(_0x2e9d8e){if(_0x2e9d8e){return _0x5bff36[_0x9909('0x16')](_0x3d5cc6)['json'](_0x2e9d8e);}};}function respondWithFilteredResult(_0x5949d3,_0x7a98dc){return function(_0x1c5dff){if(_0x1c5dff){var _0x214944=typeof _0x7a98dc['offset']===_0x9909('0x18')&&typeof _0x7a98dc['limit']===_0x9909('0x18');var _0x27ac37=_0x1c5dff[_0x9909('0x19')];var _0x220ad1=_0x214944?0x0:_0x7a98dc['offset'];var _0x18ddfc=_0x214944?_0x1c5dff[_0x9909('0x19')]:_0x7a98dc[_0x9909('0x1a')]+_0x7a98dc[_0x9909('0x1b')];var _0x4e86c0;if(_0x18ddfc>=_0x27ac37){_0x18ddfc=_0x27ac37;_0x4e86c0=0xc8;}else{_0x4e86c0=0xce;}_0x5949d3['status'](_0x4e86c0);return _0x5949d3['set'](_0x9909('0x1c'),_0x220ad1+'-'+_0x18ddfc+'/'+_0x27ac37)[_0x9909('0x1d')](_0x1c5dff);}return null;};}function patchUpdates(_0xfe4aa5){return function(_0x272e9c){try{jsonpatch[_0x9909('0x1e')](_0x272e9c,_0xfe4aa5,!![]);}catch(_0x14bee5){return BPromise['reject'](_0x14bee5);}return _0x272e9c[_0x9909('0x1f')]();};}function saveUpdates(_0x1e891d,_0x15bee5){return function(_0x470c9d){if(_0x470c9d){return _0x470c9d['update'](_0x1e891d)[_0x9909('0x20')](function(_0x4be837){return _0x4be837;});}return null;};}function removeEntity(_0x3cb0b6,_0x5047aa){return function(_0x44839f){if(_0x44839f){return _0x44839f[_0x9909('0x21')]()[_0x9909('0x20')](function(){var _0x43cc7b=_0x44839f['get']({'plain':!![]});var _0x105a93=_0x9909('0x22');return db[_0x9909('0x23')][_0x9909('0x21')]({'where':{'type':_0x105a93,'resourceId':_0x43cc7b['id']}})['then'](function(){return _0x44839f;});})['then'](function(){_0x3cb0b6[_0x9909('0x16')](0xcc)[_0x9909('0x17')]();});}};}function handleEntityNotFound(_0x1d1b33,_0x83cc20){return function(_0x3b3f93){if(!_0x3b3f93){_0x1d1b33['sendStatus'](0x194);}return _0x3b3f93;};}function handleError(_0x3c1adb,_0x1b24f8){_0x1b24f8=_0x1b24f8||0x1f4;return function(_0x50e4b2){logger[_0x9909('0x24')](_0x50e4b2['stack']);if(_0x50e4b2[_0x9909('0x25')]){delete _0x50e4b2[_0x9909('0x25')];}_0x3c1adb[_0x9909('0x16')](_0x1b24f8)[_0x9909('0x26')](_0x50e4b2);};}exports[_0x9909('0x27')]=function(_0x102748,_0x49c8b9){var _0x39a718={},_0x3613b3={},_0x3f642d={'count':0x0,'rows':[]};var _0x5e24d3=_['map'](db[_0x9909('0x28')][_0x9909('0x29')],function(_0x25388d){return{'name':_0x25388d['fieldName'],'type':_0x25388d[_0x9909('0x2a')]['key']};});_0x3613b3['model']=_[_0x9909('0x2b')](_0x5e24d3,_0x9909('0x25'));_0x3613b3[_0x9909('0x2c')]=_[_0x9909('0x2d')](_0x102748['query']);_0x3613b3[_0x9909('0x2e')]=_[_0x9909('0x2f')](_0x3613b3[_0x9909('0x30')],_0x3613b3[_0x9909('0x2c')]);_0x39a718[_0x9909('0x31')]=_[_0x9909('0x2f')](_0x3613b3[_0x9909('0x30')],qs['fields'](_0x102748[_0x9909('0x2c')][_0x9909('0x32')]));_0x39a718['attributes']=_0x39a718[_0x9909('0x31')][_0x9909('0x33')]?_0x39a718[_0x9909('0x31')]:_0x3613b3[_0x9909('0x30')];if(!_0x102748[_0x9909('0x2c')]['hasOwnProperty'](_0x9909('0x34'))){_0x39a718[_0x9909('0x1b')]=qs[_0x9909('0x1b')](_0x102748[_0x9909('0x2c')]['limit']);_0x39a718[_0x9909('0x1a')]=qs[_0x9909('0x1a')](_0x102748['query'][_0x9909('0x1a')]);}_0x39a718['order']=qs[_0x9909('0x35')](_0x102748['query'][_0x9909('0x35')]);_0x39a718[_0x9909('0x36')]=qs[_0x9909('0x2e')](_[_0x9909('0x37')](_0x102748['query'],_0x3613b3[_0x9909('0x2e')]),_0x5e24d3);if(_0x102748[_0x9909('0x2c')][_0x9909('0x38')]){_0x39a718[_0x9909('0x36')]=_[_0x9909('0x39')](_0x39a718[_0x9909('0x36')],{'$or':_[_0x9909('0x2b')](_0x5e24d3,function(_0xefcc3){if(_0xefcc3['type']!==_0x9909('0x3a')){var _0xef68b8={};_0xef68b8[_0xefcc3[_0x9909('0x25')]]={'$like':'%'+_0x102748[_0x9909('0x2c')][_0x9909('0x38')]+'%'};return _0xef68b8;}})});}_0x39a718=_[_0x9909('0x39')]({},_0x39a718,_0x102748[_0x9909('0x3b')]);var _0x280d5b={'where':_0x39a718[_0x9909('0x36')]};return db['Schedule']['count'](_0x280d5b)[_0x9909('0x20')](function(_0x7546eb){_0x3f642d['count']=_0x7546eb;if(_0x102748[_0x9909('0x2c')][_0x9909('0x3c')]){_0x39a718[_0x9909('0x3d')]=[{'all':!![]}];}return db[_0x9909('0x28')]['findAll'](_0x39a718);})[_0x9909('0x20')](function(_0x249708){_0x3f642d[_0x9909('0x3e')]=_0x249708;return _0x3f642d;})[_0x9909('0x20')](respondWithFilteredResult(_0x49c8b9,_0x39a718))[_0x9909('0x3f')](handleError(_0x49c8b9,null));};exports[_0x9909('0x40')]=function(_0x122dcf,_0x1da7b2){var _0x2990b6={'raw':![],'where':{'id':_0x122dcf[_0x9909('0x41')]['id']}},_0x52c5f5={};_0x52c5f5['model']=_[_0x9909('0x2d')](db['Schedule']['rawAttributes']);_0x52c5f5[_0x9909('0x2c')]=_[_0x9909('0x2d')](_0x122dcf[_0x9909('0x2c')]);_0x52c5f5[_0x9909('0x2e')]=_[_0x9909('0x2f')](_0x52c5f5[_0x9909('0x30')],_0x52c5f5[_0x9909('0x2c')]);_0x2990b6['attributes']=_[_0x9909('0x2f')](_0x52c5f5[_0x9909('0x30')],qs['fields'](_0x122dcf[_0x9909('0x2c')][_0x9909('0x32')]));_0x2990b6['attributes']=_0x2990b6[_0x9909('0x31')][_0x9909('0x33')]?_0x2990b6[_0x9909('0x31')]:_0x52c5f5[_0x9909('0x30')];if(_0x122dcf['query'][_0x9909('0x3c')]){_0x2990b6[_0x9909('0x3d')]=[{'all':!![]}];}_0x2990b6=_[_0x9909('0x39')]({},_0x2990b6,_0x122dcf['options']);return db[_0x9909('0x28')][_0x9909('0x42')](_0x2990b6)['then'](handleEntityNotFound(_0x1da7b2,null))[_0x9909('0x20')](respondWithResult(_0x1da7b2,null))[_0x9909('0x3f')](handleError(_0x1da7b2,null));};exports['create']=function(_0x3866b5,_0x406694){return db[_0x9909('0x28')][_0x9909('0x43')](_0x3866b5[_0x9909('0x44')],{})[_0x9909('0x20')](function(_0x485560){var _0xfd27c5=_0x3866b5[_0x9909('0x45')]['get']({'plain':!![]});if(!_0xfd27c5)throw new Error(_0x9909('0x46'));if(_0xfd27c5['role']===_0x9909('0x45')){var _0x5981e4=_0x485560[_0x9909('0x47')]({'plain':!![]});var _0x8cd94e=_0x9909('0x22');return db['UserProfileSection'][_0x9909('0x42')]({'where':{'name':_0x8cd94e,'userProfileId':_0xfd27c5[_0x9909('0x48')]},'raw':!![]})[_0x9909('0x20')](function(_0x2e9d95){if(_0x2e9d95&&_0x2e9d95[_0x9909('0x49')]===0x0){return db[_0x9909('0x23')][_0x9909('0x43')]({'name':_0x5981e4[_0x9909('0x25')],'resourceId':_0x5981e4['id'],'type':_0x2e9d95['name'],'sectionId':_0x2e9d95['id']},{})[_0x9909('0x20')](function(){return _0x485560;});}else{return _0x485560;}})[_0x9909('0x3f')](function(_0x58dfb5){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x58dfb5);throw _0x58dfb5;});}return _0x485560;})[_0x9909('0x20')](respondWithResult(_0x406694,0xc9))[_0x9909('0x3f')](handleError(_0x406694,null));};exports[_0x9909('0x4a')]=function(_0x5cb3cf,_0x2d3761){if(_0x5cb3cf[_0x9909('0x44')]['id']){delete _0x5cb3cf[_0x9909('0x44')]['id'];}return db[_0x9909('0x28')][_0x9909('0x42')]({'where':{'id':_0x5cb3cf['params']['id']}})[_0x9909('0x20')](handleEntityNotFound(_0x2d3761,null))[_0x9909('0x20')](saveUpdates(_0x5cb3cf[_0x9909('0x44')],null))[_0x9909('0x20')](respondWithResult(_0x2d3761,null))[_0x9909('0x3f')](handleError(_0x2d3761,null));};exports[_0x9909('0x21')]=function(_0x2bf055,_0xfd140e){return db['Schedule'][_0x9909('0x42')]({'where':{'id':_0x2bf055[_0x9909('0x41')]['id']}})[_0x9909('0x20')](handleEntityNotFound(_0xfd140e,null))[_0x9909('0x20')](removeEntity(_0xfd140e,null))[_0x9909('0x3f')](handleError(_0xfd140e,null));};exports[_0x9909('0x4b')]=function(_0x6be3b3,_0x20ddfc,_0x23fe47){var _0x540a44=require(_0x9909('0x4c'));return db[_0x9909('0x28')][_0x9909('0x42')]({'where':{'id':_0x6be3b3[_0x9909('0x41')]['id']},'raw':!![]})[_0x9909('0x20')](handleEntityNotFound(_0x20ddfc,null))[_0x9909('0x20')](function(){_0x540a44[_0x9909('0x4b')](_0x6be3b3[_0x9909('0x41')]['id']);})[_0x9909('0x20')](respondWithStatusCode(_0x20ddfc,null))[_0x9909('0x3f')](handleError(_0x20ddfc,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 6abdc39..1dc73fa 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 _0x1688=['moment','bluebird','request-promise','path','rimraf','./schedule.attributes','define','Schedule','tools_schedules','lodash','../../config/logger','api'];(function(_0x6cb5b,_0x38c414){var _0x12c8f4=function(_0x26fd15){while(--_0x26fd15){_0x6cb5b['push'](_0x6cb5b['shift']());}};_0x12c8f4(++_0x38c414);}(_0x1688,0x165));var _0x8168=function(_0x43e546,_0x3ccbd1){_0x43e546=_0x43e546-0x0;var _0x48fcc1=_0x1688[_0x43e546];return _0x48fcc1;};'use strict';var _=require(_0x8168('0x0'));var util=require('util');var logger=require(_0x8168('0x1'))(_0x8168('0x2'));var moment=require(_0x8168('0x3'));var BPromise=require(_0x8168('0x4'));var rp=require(_0x8168('0x5'));var fs=require('fs');var path=require(_0x8168('0x6'));var rimraf=require(_0x8168('0x7'));var config=require('../../config/environment');var attributes=require(_0x8168('0x8'));module['exports']=function(_0x559bc0,_0xfd66c1){return _0x559bc0[_0x8168('0x9')](_0x8168('0xa'),attributes,{'tableName':_0x8168('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d07=['moment','bluebird','request-promise','path','rimraf','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','util','../../config/logger'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1d07,0x1d1));var _0x71d0=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1d07[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x71d0('0x0'));var util=require(_0x71d0('0x1'));var logger=require(_0x71d0('0x2'))('api');var moment=require(_0x71d0('0x3'));var BPromise=require(_0x71d0('0x4'));var rp=require(_0x71d0('0x5'));var fs=require('fs');var path=require(_0x71d0('0x6'));var rimraf=require(_0x71d0('0x7'));var config=require('../../config/environment');var attributes=require(_0x71d0('0x8'));module[_0x71d0('0x9')]=function(_0x5a3313,_0x178bd1){return _0x5a3313[_0x71d0('0xa')](_0x71d0('0xb'),attributes,{'tableName':_0x71d0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 8397c2f..4fa7ebf 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 _0x4e0c=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch'];(function(_0x592b2b,_0x37d495){var _0x557655=function(_0x4a1289){while(--_0x4a1289){_0x592b2b['push'](_0x592b2b['shift']());}};_0x557655(++_0x37d495);}(_0x4e0c,0x111));var _0xc4e0=function(_0xa45395,_0x5579e6){_0xa45395=_0xa45395-0x0;var _0x3c83d2=_0x4e0c[_0xa45395];return _0x3c83d2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc4e0('0x0'));var BPromise=require(_0xc4e0('0x1'));var rs=require(_0xc4e0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc4e0('0x3'))['db'];var utils=require(_0xc4e0('0x4'));var logger=require(_0xc4e0('0x5'))(_0xc4e0('0x6'));var config=require('../../config/environment');var jayson=require(_0xc4e0('0x7'));var client=jayson[_0xc4e0('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c6a8f,_0x1025ee,_0x5851d1){return new BPromise(function(_0x5661c0,_0x4c9bb3){return client[_0xc4e0('0x9')](_0x5c6a8f,_0x5851d1)[_0xc4e0('0xa')](function(_0x1bc5eb){logger['info'](_0xc4e0('0xb'),_0x1025ee,_0xc4e0('0xc'));logger[_0xc4e0('0xd')](_0xc4e0('0xe'),_0x1025ee,_0xc4e0('0xc'),JSON[_0xc4e0('0xf')](_0x1bc5eb));if(_0x1bc5eb[_0xc4e0('0x10')]){if(_0x1bc5eb['error'][_0xc4e0('0x11')]===0x1f4){logger[_0xc4e0('0x10')](_0xc4e0('0xb'),_0x1025ee,_0x1bc5eb[_0xc4e0('0x10')][_0xc4e0('0x12')]);return _0x4c9bb3(_0x1bc5eb[_0xc4e0('0x10')]['message']);}logger['error'](_0xc4e0('0xb'),_0x1025ee,_0x1bc5eb[_0xc4e0('0x10')][_0xc4e0('0x12')]);return _0x5661c0(_0x1bc5eb[_0xc4e0('0x10')][_0xc4e0('0x12')]);}else{logger[_0xc4e0('0x13')]('Schedule,\x20%s,\x20%s',_0x1025ee,'request\x20sent');_0x5661c0(_0x1bc5eb['result'][_0xc4e0('0x12')]);}})[_0xc4e0('0x14')](function(_0x55f36c){logger[_0xc4e0('0x10')]('Schedule,\x20%s,\x20%s',_0x1025ee,_0x55f36c);_0x4c9bb3(_0x55f36c);});});} \ No newline at end of file +var _0x89f9=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x89f9,0x146));var _0x989f=function(_0x2e6766,_0x39c18a){_0x2e6766=_0x2e6766-0x0;var _0x3ef172=_0x89f9[_0x2e6766];return _0x3ef172;};'use strict';var _=require(_0x989f('0x0'));var util=require(_0x989f('0x1'));var moment=require(_0x989f('0x2'));var BPromise=require(_0x989f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x989f('0x4'))['db'];var utils=require(_0x989f('0x5'));var logger=require(_0x989f('0x6'))(_0x989f('0x7'));var config=require(_0x989f('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x989f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a588e,_0x1376cb,_0x41007a){return new BPromise(function(_0x4cfe7a,_0x9460b4){return client['request'](_0x5a588e,_0x41007a)[_0x989f('0xa')](function(_0x5cbdce){logger[_0x989f('0xb')](_0x989f('0xc'),_0x1376cb,_0x989f('0xd'));logger[_0x989f('0xe')](_0x989f('0xf'),_0x1376cb,'request\x20sent',JSON[_0x989f('0x10')](_0x5cbdce));if(_0x5cbdce[_0x989f('0x11')]){if(_0x5cbdce['error'][_0x989f('0x12')]===0x1f4){logger[_0x989f('0x11')](_0x989f('0xc'),_0x1376cb,_0x5cbdce['error'][_0x989f('0x13')]);return _0x9460b4(_0x5cbdce[_0x989f('0x11')][_0x989f('0x13')]);}logger[_0x989f('0x11')]('Schedule,\x20%s,\x20%s',_0x1376cb,_0x5cbdce[_0x989f('0x11')][_0x989f('0x13')]);return _0x4cfe7a(_0x5cbdce['error'][_0x989f('0x13')]);}else{logger[_0x989f('0xb')](_0x989f('0xc'),_0x1376cb,_0x989f('0xd'));_0x4cfe7a(_0x5cbdce[_0x989f('0x14')][_0x989f('0x13')]);}})[_0x989f('0x15')](function(_0x252d38){logger['error'](_0x989f('0xc'),_0x1376cb,_0x252d38);_0x9460b4(_0x252d38);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index ff5e3dd..89c9e00 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 _0xfc52=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./screenRecording.controller','index','get','/describe','isAuthenticated','describe','/:id/download','download','post','create','put','/:id','delete','destroy','exports','util','path'];(function(_0x305003,_0x596a96){var _0x16c277=function(_0x2f44de){while(--_0x2f44de){_0x305003['push'](_0x305003['shift']());}};_0x16c277(++_0x596a96);}(_0xfc52,0xc4));var _0x2fc5=function(_0x5b5c45,_0x199467){_0x5b5c45=_0x5b5c45-0x0;var _0x2cd0dd=_0xfc52[_0x5b5c45];return _0x2cd0dd;};'use strict';var multer=require('multer');var util=require(_0x2fc5('0x0'));var path=require(_0x2fc5('0x1'));var timeout=require(_0x2fc5('0x2'));var express=require(_0x2fc5('0x3'));var router=express[_0x2fc5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2fc5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2fc5('0x6'));var controller=require(_0x2fc5('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x2fc5('0x8')]);router[_0x2fc5('0x9')](_0x2fc5('0xa'),auth[_0x2fc5('0xb')](),controller[_0x2fc5('0xc')]);router[_0x2fc5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x2fc5('0xd'),auth[_0x2fc5('0xb')](),controller[_0x2fc5('0xe')]);router[_0x2fc5('0xf')]('/',auth['isAuthenticated'](),controller[_0x2fc5('0x10')]);router[_0x2fc5('0x11')](_0x2fc5('0x12'),auth[_0x2fc5('0xb')](),controller['update']);router[_0x2fc5('0x13')](_0x2fc5('0x12'),auth['isAuthenticated'](),controller[_0x2fc5('0x14')]);module[_0x2fc5('0x15')]=router; \ No newline at end of file +var _0xaa2e=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','/:id/download','post','create','put','destroy','multer','util','path'];(function(_0x5a7d41,_0x4447e2){var _0x98d8fa=function(_0x2ce1cf){while(--_0x2ce1cf){_0x5a7d41['push'](_0x5a7d41['shift']());}};_0x98d8fa(++_0x4447e2);}(_0xaa2e,0x1b2));var _0xeaa2=function(_0x3ca335,_0x31d972){_0x3ca335=_0x3ca335-0x0;var _0x531b07=_0xaa2e[_0x3ca335];return _0x531b07;};'use strict';var multer=require(_0xeaa2('0x0'));var util=require(_0xeaa2('0x1'));var path=require(_0xeaa2('0x2'));var timeout=require(_0xeaa2('0x3'));var express=require(_0xeaa2('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeaa2('0x5'));var interaction=require(_0xeaa2('0x6'));var config=require(_0xeaa2('0x7'));var controller=require('./screenRecording.controller');router[_0xeaa2('0x8')]('/',auth[_0xeaa2('0x9')](),controller[_0xeaa2('0xa')]);router[_0xeaa2('0x8')](_0xeaa2('0xb'),auth[_0xeaa2('0x9')](),controller[_0xeaa2('0xc')]);router[_0xeaa2('0x8')](_0xeaa2('0xd'),auth[_0xeaa2('0x9')](),controller['show']);router[_0xeaa2('0x8')](_0xeaa2('0xe'),auth[_0xeaa2('0x9')](),controller['download']);router[_0xeaa2('0xf')]('/',auth[_0xeaa2('0x9')](),controller[_0xeaa2('0x10')]);router[_0xeaa2('0x11')](_0xeaa2('0xd'),auth[_0xeaa2('0x9')](),controller['update']);router['delete'](_0xeaa2('0xd'),auth['isAuthenticated'](),controller[_0xeaa2('0x12')]);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 7e7f798..bf3445f 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 _0x1c3d=['moment','path','../../config/environment','exports','VIRTUAL','extname','getDataValue','value','STRING','replace','INTEGER','setDataValue','closedAt','duration','DATE','startedAt','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x1c3d,0x1b8));var _0xd1c3=function(_0xa23904,_0x2dc7a9){_0xa23904=_0xa23904-0x0;var _0x7548c6=_0x1c3d[_0xa23904];return _0x7548c6;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xd1c3('0x0'));var path=require(_0xd1c3('0x1'));var config=require(_0xd1c3('0x2'));module[_0xd1c3('0x3')]={'format':{'type':Sequelize[_0xd1c3('0x4')],'get':function(){return this['getDataValue']('value')?path[_0xd1c3('0x5')](this[_0xd1c3('0x6')](_0xd1c3('0x7'))):undefined;}},'interactionid':{'type':Sequelize[_0xd1c3('0x8')]},'channel':{'type':Sequelize[_0xd1c3('0x8')]},'value':{'type':Sequelize[_0xd1c3('0x8')],'set':function(_0x5adcb7){var _0x398766=_0x5adcb7[_0xd1c3('0x9')](/\\/g,'/');this['setDataValue'](_0xd1c3('0x7'),_0x398766);}},'rating':{'type':Sequelize[_0xd1c3('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xd1c3('0xa')],'set':function(_0x18556c){this[_0xd1c3('0xb')]('startedAt',moment()['subtract'](_0x18556c,'ms'));this[_0xd1c3('0xb')](_0xd1c3('0xc'),moment());this[_0xd1c3('0xb')](_0xd1c3('0xd'),_0x18556c);}},'startedAt':{'type':Sequelize[_0xd1c3('0xe')],'get':function(){return moment(this[_0xd1c3('0x6')](_0xd1c3('0xf')))[_0xd1c3('0x10')](_0xd1c3('0x11'))['toString']();}},'closedAt':{'type':Sequelize[_0xd1c3('0xe')],'get':function(){return moment(this['getDataValue']('closedAt'))[_0xd1c3('0x10')]('MM-DD-YYYY\x20HH:mm')[_0xd1c3('0x12')]();}},'createdAt':{'type':Sequelize[_0xd1c3('0xe')],'get':function(){return moment(this[_0xd1c3('0x6')]('createdAt'))[_0xd1c3('0x10')](_0xd1c3('0x11'))[_0xd1c3('0x12')]();}},'updatedAt':{'type':Sequelize[_0xd1c3('0xe')],'get':function(){return moment(this[_0xd1c3('0x6')](_0xd1c3('0x13')))[_0xd1c3('0x10')](_0xd1c3('0x11'))[_0xd1c3('0x12')]();}}}; \ No newline at end of file +var _0x6a55=['DATE','createdAt','updatedAt','sequelize','exports','value','getDataValue','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','format','MM-DD-YYYY\x20HH:mm','toString'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0x6a55,0xdb));var _0x56a5=function(_0x28db4a,_0x6d6d5a){_0x28db4a=_0x28db4a-0x0;var _0x3bf87e=_0x6a55[_0x28db4a];return _0x3bf87e;};'use strict';var Sequelize=require(_0x56a5('0x0'));var moment=require('moment');var path=require('path');var config=require('../../config/environment');module[_0x56a5('0x1')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x56a5('0x2'))?path['extname'](this[_0x56a5('0x3')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0x56a5('0x4')]},'channel':{'type':Sequelize[_0x56a5('0x4')]},'value':{'type':Sequelize[_0x56a5('0x4')],'set':function(_0x293ea1){var _0x444c65=_0x293ea1[_0x56a5('0x5')](/\\/g,'/');this[_0x56a5('0x6')](_0x56a5('0x2'),_0x444c65);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x56a5('0x7')],'set':function(_0xf15490){this[_0x56a5('0x6')](_0x56a5('0x8'),moment()[_0x56a5('0x9')](_0xf15490,'ms'));this[_0x56a5('0x6')](_0x56a5('0xa'),moment());this[_0x56a5('0x6')](_0x56a5('0xb'),_0xf15490);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x56a5('0x8')))[_0x56a5('0xc')](_0x56a5('0xd'))[_0x56a5('0xe')]();}},'closedAt':{'type':Sequelize[_0x56a5('0xf')],'get':function(){return moment(this[_0x56a5('0x3')]('closedAt'))['format'](_0x56a5('0xd'))[_0x56a5('0xe')]();}},'createdAt':{'type':Sequelize[_0x56a5('0xf')],'get':function(){return moment(this[_0x56a5('0x3')](_0x56a5('0x10')))[_0x56a5('0xc')](_0x56a5('0xd'))['toString']();}},'updatedAt':{'type':Sequelize[_0x56a5('0xf')],'get':function(){return moment(this['getDataValue'](_0x56a5('0x11')))['format'](_0x56a5('0xd'))[_0x56a5('0xe')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index e270b53..c04024a 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 _0xac9d=['extname','unlink','send','Not\x20found','isNil','Entity\x20not\x20found','root','info','unlinkSync','.cypher','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','closedAt','value','describe','download','../../components/encryptor','uniqueid','params','join','server/files/screen_recordings','%s.cypher','existsSync','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename'];(function(_0x3e095b,_0x10e9e7){var _0x3aaa4b=function(_0x269d3c){while(--_0x269d3c){_0x3e095b['push'](_0x3e095b['shift']());}};_0x3aaa4b(++_0x10e9e7);}(_0xac9d,0x14d));var _0xdac9=function(_0x1a9e78,_0x180720){_0x1a9e78=_0x1a9e78-0x0;var _0x113e06=_0xac9d[_0x1a9e78];return _0x113e06;};'use strict';var emlformat=require(_0xdac9('0x0'));var rimraf=require(_0xdac9('0x1'));var zipdir=require(_0xdac9('0x2'));var jsonpatch=require(_0xdac9('0x3'));var rp=require(_0xdac9('0x4'));var moment=require(_0xdac9('0x5'));var BPromise=require(_0xdac9('0x6'));var Mustache=require(_0xdac9('0x7'));var util=require('util');var path=require(_0xdac9('0x8'));var sox=require('sox');var csv=require(_0xdac9('0x9'));var ejs=require(_0xdac9('0xa'));var fs=require('fs');var fs_extra=require(_0xdac9('0xb'));var _=require(_0xdac9('0xc'));var squel=require(_0xdac9('0xd'));var crypto=require(_0xdac9('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xdac9('0xf'));var toCsv=require('to-csv');var querystring=require(_0xdac9('0x10'));var Papa=require(_0xdac9('0x11'));var Redis=require(_0xdac9('0x12'));var authService=require(_0xdac9('0x13'));var qs=require(_0xdac9('0x14'));var as=require(_0xdac9('0x15'));var hardwareService=require(_0xdac9('0x16'));var logger=require(_0xdac9('0x17'))(_0xdac9('0x18'));var utils=require('../../config/utils');var config=require(_0xdac9('0x19'));var licenseUtil=require(_0xdac9('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d8e97,_0xeddbc1){_0xeddbc1=_0xeddbc1||0xcc;return function(_0xbfe6d8){if(_0xbfe6d8){return _0x3d8e97['sendStatus'](_0xeddbc1);}return _0x3d8e97[_0xdac9('0x1b')](_0xeddbc1)[_0xdac9('0x1c')]();};}function respondWithResult(_0x9e1bf6,_0x5f0bbd){_0x5f0bbd=_0x5f0bbd||0xc8;return function(_0x5dd536){if(_0x5dd536){return _0x9e1bf6[_0xdac9('0x1b')](_0x5f0bbd)[_0xdac9('0x1d')](_0x5dd536);}};}function respondWithFilteredResult(_0x50f9fe,_0x76af7a){return function(_0x36cbe4){if(_0x36cbe4){var _0x152ea5=typeof _0x76af7a[_0xdac9('0x1e')]===_0xdac9('0x1f')&&typeof _0x76af7a[_0xdac9('0x20')]===_0xdac9('0x1f');var _0xec1016=_0x36cbe4['count'];var _0x283343=_0x152ea5?0x0:_0x76af7a[_0xdac9('0x1e')];var _0x571e07=_0x152ea5?_0x36cbe4[_0xdac9('0x21')]:_0x76af7a[_0xdac9('0x1e')]+_0x76af7a[_0xdac9('0x20')];var _0x181d11;if(_0x571e07>=_0xec1016){_0x571e07=_0xec1016;_0x181d11=0xc8;}else{_0x181d11=0xce;}_0x50f9fe['status'](_0x181d11);return _0x50f9fe['set'](_0xdac9('0x22'),_0x283343+'-'+_0x571e07+'/'+_0xec1016)[_0xdac9('0x1d')](_0x36cbe4);}return null;};}function patchUpdates(_0x2b9d91){return function(_0x395ec7){try{jsonpatch['apply'](_0x395ec7,_0x2b9d91,!![]);}catch(_0x23ee5e){return BPromise[_0xdac9('0x23')](_0x23ee5e);}return _0x395ec7[_0xdac9('0x24')]();};}function saveUpdates(_0xae680a,_0xe7bd10){return function(_0x42317c){if(_0x42317c){return _0x42317c[_0xdac9('0x25')](_0xae680a)[_0xdac9('0x26')](function(_0x419f0c){return _0x419f0c;});}return null;};}function removeEntity(_0x33de5c,_0x5a0fa2){return function(_0x2943f5){if(_0x2943f5){return _0x2943f5[_0xdac9('0x27')]()[_0xdac9('0x26')](function(){_0x33de5c[_0xdac9('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e631a,_0x5686db){return function(_0x3ce475){if(!_0x3ce475){_0x1e631a[_0xdac9('0x28')](0x194);}return _0x3ce475;};}function handleError(_0x566d8c,_0x433be9){_0x433be9=_0x433be9||0x1f4;return function(_0x5105f1){logger[_0xdac9('0x29')](_0x5105f1[_0xdac9('0x2a')]);if(_0x5105f1[_0xdac9('0x2b')]){delete _0x5105f1[_0xdac9('0x2b')];}_0x566d8c['status'](_0x433be9)['send'](_0x5105f1);};}exports[_0xdac9('0x2c')]=function(_0x170afd,_0x4fe3bd){var _0x4c4e21={},_0x3eed7a={},_0x3505c5={'count':0x0,'rows':[]};var _0x13efba=_[_0xdac9('0x2d')](db[_0xdac9('0x2e')][_0xdac9('0x2f')],function(_0xed99f9){return{'name':_0xed99f9[_0xdac9('0x30')],'type':_0xed99f9[_0xdac9('0x31')][_0xdac9('0x32')]};});_0x3eed7a[_0xdac9('0x33')]=_[_0xdac9('0x34')](_[_0xdac9('0x2d')](_0x13efba,_0xdac9('0x2b')),[_0xdac9('0x35')]);_0x3eed7a[_0xdac9('0x36')]=_[_0xdac9('0x37')](_0x170afd[_0xdac9('0x36')]);_0x3eed7a[_0xdac9('0x38')]=_[_0xdac9('0x39')](_0x3eed7a[_0xdac9('0x33')],_0x3eed7a['query']);_0x4c4e21['attributes']=_[_0xdac9('0x39')](_0x3eed7a[_0xdac9('0x33')],qs[_0xdac9('0x3a')](_0x170afd[_0xdac9('0x36')][_0xdac9('0x3a')]));_0x4c4e21['attributes']=_0x4c4e21[_0xdac9('0x3b')]['length']?_0x4c4e21[_0xdac9('0x3b')]:_0x3eed7a[_0xdac9('0x33')];if(!_0x170afd['query'][_0xdac9('0x3c')]('nolimit')){_0x4c4e21['limit']=qs[_0xdac9('0x20')](_0x170afd[_0xdac9('0x36')][_0xdac9('0x20')]);_0x4c4e21[_0xdac9('0x1e')]=qs[_0xdac9('0x1e')](_0x170afd[_0xdac9('0x36')]['offset']);}_0x4c4e21[_0xdac9('0x3d')]=qs[_0xdac9('0x3e')](_0x170afd['query'][_0xdac9('0x3e')]);_0x4c4e21[_0xdac9('0x3f')]=qs[_0xdac9('0x38')](_[_0xdac9('0x40')](_0x170afd[_0xdac9('0x36')],_0x3eed7a[_0xdac9('0x38')]),_0x13efba);if(_0x170afd[_0xdac9('0x36')]['filter']){_0x4c4e21[_0xdac9('0x3f')]=_[_0xdac9('0x41')](_0x4c4e21[_0xdac9('0x3f')],{'$or':_['map'](_0x13efba,function(_0x9c732e){if(_0x9c732e[_0xdac9('0x31')]!==_0xdac9('0x42')){var _0x1d6f88={};_0x1d6f88[_0x9c732e['name']]={'$like':'%'+_0x170afd['query'][_0xdac9('0x43')]+'%'};return _0x1d6f88;}})});}_0x4c4e21=_[_0xdac9('0x41')]({},_0x4c4e21,_0x170afd[_0xdac9('0x44')]);var _0x260f0e={'where':_0x4c4e21[_0xdac9('0x3f')]};return db['ScreenRecording'][_0xdac9('0x21')](_0x260f0e)['then'](function(_0xd74baf){_0x3505c5[_0xdac9('0x21')]=_0xd74baf;if(_0x170afd[_0xdac9('0x36')][_0xdac9('0x45')]){_0x4c4e21[_0xdac9('0x46')]=[{'all':!![]}];}return db[_0xdac9('0x2e')][_0xdac9('0x47')](_0x4c4e21);})[_0xdac9('0x26')](function(_0x11362d){_0x3505c5[_0xdac9('0x48')]=_0x11362d;return _0x3505c5;})[_0xdac9('0x26')](respondWithFilteredResult(_0x4fe3bd,_0x4c4e21))[_0xdac9('0x49')](handleError(_0x4fe3bd,null));};exports[_0xdac9('0x4a')]=function(_0x441676,_0x5335ae){var _0x3857cf={'raw':![],'where':{'id':_0x441676['params']['id']}},_0x272b52={};_0x272b52[_0xdac9('0x33')]=_[_0xdac9('0x37')](db[_0xdac9('0x2e')][_0xdac9('0x2f')]);_0x272b52[_0xdac9('0x36')]=_[_0xdac9('0x37')](_0x441676['query']);_0x272b52[_0xdac9('0x38')]=_['intersection'](_0x272b52[_0xdac9('0x33')],_0x272b52[_0xdac9('0x36')]);_0x3857cf[_0xdac9('0x3b')]=_[_0xdac9('0x39')](_0x272b52['model'],qs['fields'](_0x441676['query'][_0xdac9('0x3a')]));_0x3857cf['attributes']=_0x3857cf['attributes'][_0xdac9('0x4b')]?_0x3857cf[_0xdac9('0x3b')]:_0x272b52['model'];if(_0x441676['query'][_0xdac9('0x45')]){_0x3857cf[_0xdac9('0x46')]=[{'all':!![]}];}_0x3857cf=_[_0xdac9('0x41')]({},_0x3857cf,_0x441676[_0xdac9('0x44')]);return db[_0xdac9('0x2e')][_0xdac9('0x4c')](_0x3857cf)[_0xdac9('0x26')](handleEntityNotFound(_0x5335ae,null))[_0xdac9('0x26')](respondWithResult(_0x5335ae,null))['catch'](handleError(_0x5335ae,null));};exports[_0xdac9('0x4d')]=function(_0x3bd946,_0xfa104f){return db[_0xdac9('0x2e')][_0xdac9('0x4d')](_0x3bd946[_0xdac9('0x4e')],{})[_0xdac9('0x26')](respondWithResult(_0xfa104f,0xc9))[_0xdac9('0x49')](handleError(_0xfa104f,null));};exports[_0xdac9('0x25')]=function(_0x242c24,_0x257e48){if(_0x242c24[_0xdac9('0x4e')]['id']){delete _0x242c24[_0xdac9('0x4e')]['id'];}delete _0x242c24[_0xdac9('0x4e')]['duration'];delete _0x242c24['body']['createdAt'];delete _0x242c24[_0xdac9('0x4e')][_0xdac9('0x4f')];delete _0x242c24['body'][_0xdac9('0x50')];return db[_0xdac9('0x2e')][_0xdac9('0x4c')]({'where':{'id':_0x242c24['params']['id']}})[_0xdac9('0x26')](handleEntityNotFound(_0x257e48,null))[_0xdac9('0x26')](saveUpdates(_0x242c24['body'],null))['then'](respondWithResult(_0x257e48,null))[_0xdac9('0x49')](handleError(_0x257e48,null));};exports[_0xdac9('0x51')]=function(_0x222de9,_0x370532){return db[_0xdac9('0x2e')][_0xdac9('0x51')]()[_0xdac9('0x26')](respondWithResult(_0x370532,null))[_0xdac9('0x49')](handleError(_0x370532,null));};exports[_0xdac9('0x52')]=function(_0x41579a,_0x10a2cc,_0x32b5f5){var _0xecb50a=require(_0xdac9('0x53'));var _0x35a378=![];var _0x5d0b43={};if(_0x41579a[_0xdac9('0x36')][_0xdac9('0x31')]&&_0x41579a[_0xdac9('0x36')][_0xdac9('0x31')]===_0xdac9('0x54')){_0x5d0b43[_0xdac9('0x54')]=_0x41579a['params']['id'];}else{_0x5d0b43['id']=_0x41579a[_0xdac9('0x55')]['id'];}return db[_0xdac9('0x2e')][_0xdac9('0x4c')]({'where':_0x5d0b43,'attributes':['id',_0xdac9('0x50')],'raw':!![]})[_0xdac9('0x26')](handleEntityNotFound(_0x10a2cc,null))[_0xdac9('0x26')](function(_0x1eec39){if(_0x1eec39){var _0x243862=path[_0xdac9('0x56')](config['root'],_0xdac9('0x57'),_0x1eec39[_0xdac9('0x50')]);var _0x3cab26=util[_0xdac9('0x35')](_0xdac9('0x58'),_0x243862);if(fs[_0xdac9('0x59')](_0x3cab26)){_0x35a378=!![];return _0xecb50a['decryptFile'](_0x3cab26,_0x243862,config['secrets'][_0xdac9('0x5a')])[_0xdac9('0x26')](function(){return _0x1eec39;});}return _0x1eec39;}})[_0xdac9('0x26')](function(_0x46017d){if(_0x46017d){var _0x1c1f5f=path[_0xdac9('0x56')](config['root'],'server/files/screen_recordings',_0x46017d['value']);if(!fs[_0xdac9('0x59')](_0x1c1f5f)){throw new db[(_0xdac9('0x5b'))][(_0xdac9('0x5c'))](_0xdac9('0x5d'));}if(_0x46017d['filename']){return _0x10a2cc[_0xdac9('0x52')](_0x1c1f5f,_0x46017d[_0xdac9('0x5e')]+path[_0xdac9('0x5f')](_0x1c1f5f),function(){if(_0x35a378){fs[_0xdac9('0x60')](_0x1c1f5f);}});}else{return _0x10a2cc[_0xdac9('0x52')](_0x1c1f5f,function(_0x496d9c){if(_0x35a378){fs[_0xdac9('0x60')](_0x1c1f5f);}});}}})['catch'](function(_0x60b64e){if(_0x60b64e['message']===_0xdac9('0x5d')){_0x10a2cc[_0xdac9('0x1b')](0x194)[_0xdac9('0x61')](_0xdac9('0x62'));}else{return handleError(_0x10a2cc,null);}});};exports[_0xdac9('0x27')]=function(_0x40dec7,_0x232440){return db['ScreenRecording']['find']({'where':{'id':_0x40dec7['params']['id']}})[_0xdac9('0x26')](function(_0x42ba53){if(_[_0xdac9('0x63')](_0x42ba53)){throw new ReferenceError(_0xdac9('0x64'));}return _0x42ba53;})[_0xdac9('0x26')](function(_0x29df1d){var _0x288e7e=path['join'](config[_0xdac9('0x65')],'server/files/screen_recordings',_0x29df1d['value']);logger[_0xdac9('0x66')]('cancellazione\x20fisica\x20documento\x20%s',_0x288e7e);if(!_['isNil'](_0x29df1d[_0xdac9('0x50')])&&fs[_0xdac9('0x59')](_0x288e7e)){logger[_0xdac9('0x66')]('File:\x20\x22'+_0x288e7e+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xdac9('0x67')](_0x288e7e);}_0x288e7e=_0x288e7e+_0xdac9('0x68');if(!_['isNil'](_0x29df1d[_0xdac9('0x50')])&&fs[_0xdac9('0x59')](_0x288e7e)){logger[_0xdac9('0x66')](_0xdac9('0x69')+_0x288e7e+_0xdac9('0x6a'));fs[_0xdac9('0x67')](_0x288e7e);}return _0x29df1d;})[_0xdac9('0x26')](function(_0xef4531){if(!_0xef4531)throw new InternalError();return _0xef4531[_0xdac9('0x27')]();})[_0xdac9('0x26')](function(){_0x232440[_0xdac9('0x1b')](0xcc)[_0xdac9('0x1c')]();})['catch'](handleError(_0x232440,null));}; \ No newline at end of file +var _0x3e74=['to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','show','params','catch','create','body','duration','createdAt','closedAt','describe','download','../../components/encryptor','uniqueid','find','value','join','root','decryptFile','secrets','server/files/screen_recordings','Sequelize','ValidationError','filename','unlink','Not\x20found','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','existsSync','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox'];(function(_0x3b0489,_0x51475d){var _0x48a60b=function(_0x1bbb78){while(--_0x1bbb78){_0x3b0489['push'](_0x3b0489['shift']());}};_0x48a60b(++_0x51475d);}(_0x3e74,0x175));var _0x43e7=function(_0x6485d1,_0x564b28){_0x6485d1=_0x6485d1-0x0;var _0x24f5fe=_0x3e74[_0x6485d1];return _0x24f5fe;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={},_0x4690a6={},_0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x27')](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x2a')],'type':_0x31b2a6[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](_[_0x43e7('0x27')](_0x50f9f5,'name'),[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0xb1fc63[_0x43e7('0x30')]);_0x4690a6[_0x43e7('0x32')]=_['intersection'](_0x4690a6[_0x43e7('0x2d')],_0x4690a6[_0x43e7('0x30')]);_0x33a1a5[_0x43e7('0x33')]=_[_0x43e7('0x34')](_0x4690a6['model'],qs['fields'](_0xb1fc63['query'][_0x43e7('0x35')]));_0x33a1a5[_0x43e7('0x33')]=_0x33a1a5[_0x43e7('0x33')][_0x43e7('0x36')]?_0x33a1a5[_0x43e7('0x33')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63['query']['hasOwnProperty']('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5[_0x43e7('0x19')]=qs['offset'](_0xb1fc63[_0x43e7('0x30')][_0x43e7('0x19')]);}_0x33a1a5[_0x43e7('0x37')]=qs[_0x43e7('0x38')](_0xb1fc63[_0x43e7('0x30')][_0x43e7('0x38')]);_0x33a1a5[_0x43e7('0x39')]=qs['filters'](_['pick'](_0xb1fc63['query'],_0x4690a6[_0x43e7('0x32')]),_0x50f9f5);if(_0xb1fc63[_0x43e7('0x30')][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x39')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x39')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x2ffd43){if(_0x2ffd43['type']!==_0x43e7('0x3c')){var _0x2b0ffe={};_0x2b0ffe[_0x2ffd43['name']]={'$like':'%'+_0xb1fc63[_0x43e7('0x30')]['filter']+'%'};return _0x2b0ffe;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63[_0x43e7('0x3d')]);var _0x1c6f45={'where':_0x33a1a5[_0x43e7('0x39')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x1c6f45)['then'](function(_0x574a93){_0x45b675[_0x43e7('0x1a')]=_0x574a93;if(_0xb1fc63[_0x43e7('0x30')][_0x43e7('0x3e')]){_0x33a1a5[_0x43e7('0x3f')]=[{'all':!![]}];}return db[_0x43e7('0x28')]['findAll'](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4227c4){_0x45b675['rows']=_0x4227c4;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x40')]=function(_0x504101,_0x3d81ae){var _0x3b4235={'raw':![],'where':{'id':_0x504101[_0x43e7('0x41')]['id']}},_0x3a5807={};_0x3a5807['model']=_['keys'](db[_0x43e7('0x28')][_0x43e7('0x29')]);_0x3a5807[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x504101['query']);_0x3a5807['filters']=_['intersection'](_0x3a5807[_0x43e7('0x2d')],_0x3a5807['query']);_0x3b4235[_0x43e7('0x33')]=_['intersection'](_0x3a5807['model'],qs[_0x43e7('0x35')](_0x504101['query'][_0x43e7('0x35')]));_0x3b4235[_0x43e7('0x33')]=_0x3b4235[_0x43e7('0x33')][_0x43e7('0x36')]?_0x3b4235['attributes']:_0x3a5807[_0x43e7('0x2d')];if(_0x504101[_0x43e7('0x30')][_0x43e7('0x3e')]){_0x3b4235[_0x43e7('0x3f')]=[{'all':!![]}];}_0x3b4235=_[_0x43e7('0x3b')]({},_0x3b4235,_0x504101[_0x43e7('0x3d')]);return db['ScreenRecording']['find'](_0x3b4235)[_0x43e7('0x21')](handleEntityNotFound(_0x3d81ae,null))[_0x43e7('0x21')](respondWithResult(_0x3d81ae,null))[_0x43e7('0x42')](handleError(_0x3d81ae,null));};exports['create']=function(_0x5c1c18,_0x56489b){return db[_0x43e7('0x28')][_0x43e7('0x43')](_0x5c1c18['body'],{})[_0x43e7('0x21')](respondWithResult(_0x56489b,0xc9))[_0x43e7('0x42')](handleError(_0x56489b,null));};exports[_0x43e7('0x20')]=function(_0x560329,_0x593155){if(_0x560329['body']['id']){delete _0x560329['body']['id'];}delete _0x560329[_0x43e7('0x44')][_0x43e7('0x45')];delete _0x560329['body'][_0x43e7('0x46')];delete _0x560329[_0x43e7('0x44')][_0x43e7('0x47')];delete _0x560329[_0x43e7('0x44')]['value'];return db[_0x43e7('0x28')]['find']({'where':{'id':_0x560329['params']['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x593155,null))[_0x43e7('0x21')](saveUpdates(_0x560329[_0x43e7('0x44')],null))[_0x43e7('0x21')](respondWithResult(_0x593155,null))[_0x43e7('0x42')](handleError(_0x593155,null));};exports[_0x43e7('0x48')]=function(_0x1cd87c,_0x256ddd){return db[_0x43e7('0x28')][_0x43e7('0x48')]()['then'](respondWithResult(_0x256ddd,null))[_0x43e7('0x42')](handleError(_0x256ddd,null));};exports[_0x43e7('0x49')]=function(_0x499c03,_0x39e3ca,_0x4e6f6d){var _0x35b799=require(_0x43e7('0x4a'));var _0x34e2ec=![];var _0x1f561f={};if(_0x499c03[_0x43e7('0x30')]['type']&&_0x499c03['query'][_0x43e7('0x2b')]===_0x43e7('0x4b')){_0x1f561f[_0x43e7('0x4b')]=_0x499c03[_0x43e7('0x41')]['id'];}else{_0x1f561f['id']=_0x499c03[_0x43e7('0x41')]['id'];}return db[_0x43e7('0x28')][_0x43e7('0x4c')]({'where':_0x1f561f,'attributes':['id',_0x43e7('0x4d')],'raw':!![]})[_0x43e7('0x21')](handleEntityNotFound(_0x39e3ca,null))[_0x43e7('0x21')](function(_0x312306){if(_0x312306){var _0x4ace49=path[_0x43e7('0x4e')](config[_0x43e7('0x4f')],'server/files/screen_recordings',_0x312306[_0x43e7('0x4d')]);var _0x220bf2=util[_0x43e7('0x2f')]('%s.cypher',_0x4ace49);if(fs['existsSync'](_0x220bf2)){_0x34e2ec=!![];return _0x35b799[_0x43e7('0x50')](_0x220bf2,_0x4ace49,config[_0x43e7('0x51')]['recording'])[_0x43e7('0x21')](function(){return _0x312306;});}return _0x312306;}})['then'](function(_0x49a6ce){if(_0x49a6ce){var _0x1fa3f6=path[_0x43e7('0x4e')](config[_0x43e7('0x4f')],_0x43e7('0x52'),_0x49a6ce[_0x43e7('0x4d')]);if(!fs['existsSync'](_0x1fa3f6)){throw new db[(_0x43e7('0x53'))][(_0x43e7('0x54'))]('ScreenRecording\x20not\x20found');}if(_0x49a6ce[_0x43e7('0x55')]){return _0x39e3ca[_0x43e7('0x49')](_0x1fa3f6,_0x49a6ce[_0x43e7('0x55')]+path['extname'](_0x1fa3f6),function(){if(_0x34e2ec){fs['unlink'](_0x1fa3f6);}});}else{return _0x39e3ca['download'](_0x1fa3f6,function(_0x2ada55){if(_0x34e2ec){fs[_0x43e7('0x56')](_0x1fa3f6);}});}}})[_0x43e7('0x42')](function(_0x3a6404){if(_0x3a6404['message']==='ScreenRecording\x20not\x20found'){_0x39e3ca[_0x43e7('0x1b')](0x194)[_0x43e7('0x25')](_0x43e7('0x57'));}else{return handleError(_0x39e3ca,null);}});};exports[_0x43e7('0x22')]=function(_0x5ea0db,_0x4438c0){return db[_0x43e7('0x28')][_0x43e7('0x4c')]({'where':{'id':_0x5ea0db[_0x43e7('0x41')]['id']}})[_0x43e7('0x21')](function(_0xd41e79){if(_[_0x43e7('0x58')](_0xd41e79)){throw new ReferenceError(_0x43e7('0x59'));}return _0xd41e79;})[_0x43e7('0x21')](function(_0x381208){var _0x252f00=path['join'](config['root'],_0x43e7('0x52'),_0x381208['value']);logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x252f00);if(!_[_0x43e7('0x58')](_0x381208[_0x43e7('0x4d')])&&fs['existsSync'](_0x252f00)){logger[_0x43e7('0x5a')](_0x43e7('0x5b')+_0x252f00+_0x43e7('0x5c'));fs['unlinkSync'](_0x252f00);}_0x252f00=_0x252f00+_0x43e7('0x5d');if(!_[_0x43e7('0x58')](_0x381208[_0x43e7('0x4d')])&&fs[_0x43e7('0x5e')](_0x252f00)){logger[_0x43e7('0x5a')](_0x43e7('0x5b')+_0x252f00+_0x43e7('0x5c'));fs['unlinkSync'](_0x252f00);}return _0x381208;})[_0x43e7('0x21')](function(_0x40d0c0){if(!_0x40d0c0)throw new InternalError();return _0x40d0c0[_0x43e7('0x22')]();})['then'](function(){_0x4438c0['status'](0xcc)[_0x43e7('0x15')]();})['catch'](handleError(_0x4438c0,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 3718ce7..2f1cfe7 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 _0x69f8=['exports','screen_recordings','interactionid','lodash','util','api','moment','request-promise','path','../../config/environment','./screenRecording.attributes'];(function(_0x9c151a,_0x2cbaaf){var _0xbc1400=function(_0x545398){while(--_0x545398){_0x9c151a['push'](_0x9c151a['shift']());}};_0xbc1400(++_0x2cbaaf);}(_0x69f8,0x1bb));var _0x869f=function(_0x278708,_0x87909f){_0x278708=_0x278708-0x0;var _0x53b0df=_0x69f8[_0x278708];return _0x53b0df;};'use strict';var _=require(_0x869f('0x0'));var util=require(_0x869f('0x1'));var logger=require('../../config/logger')(_0x869f('0x2'));var moment=require(_0x869f('0x3'));var BPromise=require('bluebird');var rp=require(_0x869f('0x4'));var fs=require('fs');var path=require(_0x869f('0x5'));var rimraf=require('rimraf');var config=require(_0x869f('0x6'));var attributes=require(_0x869f('0x7'));module[_0x869f('0x8')]=function(_0x1d2f56,_0x190a9e){return _0x1d2f56['define']('ScreenRecording',attributes,{'tableName':_0x869f('0x9'),'paranoid':![],'indexes':[{'name':_0x869f('0xa'),'fields':[_0x869f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x971b=['define','ScreenRecording','screen_recordings','lodash','util','path','rimraf','../../config/environment','./screenRecording.attributes','exports'];(function(_0x47b434,_0x545203){var _0x26f36a=function(_0x1a7869){while(--_0x1a7869){_0x47b434['push'](_0x47b434['shift']());}};_0x26f36a(++_0x545203);}(_0x971b,0xd5));var _0xb971=function(_0x12ca7a,_0x3295bf){_0x12ca7a=_0x12ca7a-0x0;var _0x2249df=_0x971b[_0x12ca7a];return _0x2249df;};'use strict';var _=require(_0xb971('0x0'));var util=require(_0xb971('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb971('0x2'));var rimraf=require(_0xb971('0x3'));var config=require(_0xb971('0x4'));var attributes=require(_0xb971('0x5'));module[_0xb971('0x6')]=function(_0x43227f,_0x5b4bfc){return _0x43227f[_0xb971('0x7')](_0xb971('0x8'),attributes,{'tableName':_0xb971('0x9'),'paranoid':![],'indexes':[{'name':'interactionid','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 8fef0be..703e428 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 _0xdd39=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x1a0565,_0x243d2c){var _0x509037=function(_0x39ce1b){while(--_0x39ce1b){_0x1a0565['push'](_0x1a0565['shift']());}};_0x509037(++_0x243d2c);}(_0xdd39,0xa7));var _0x9dd3=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0xdd39[_0x1deb03];return _0x189fe7;};'use strict';var _=require(_0x9dd3('0x0'));var util=require(_0x9dd3('0x1'));var moment=require(_0x9dd3('0x2'));var BPromise=require(_0x9dd3('0x3'));var rs=require(_0x9dd3('0x4'));var fs=require('fs');var Redis=require(_0x9dd3('0x5'));var db=require(_0x9dd3('0x6'))['db'];var utils=require(_0x9dd3('0x7'));var logger=require(_0x9dd3('0x8'))(_0x9dd3('0x9'));var config=require(_0x9dd3('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x9dd3('0xb')][_0x9dd3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x297df9,_0x1dcf71,_0x12ee9a){return new BPromise(function(_0x318e15,_0x32d3fb){return client[_0x9dd3('0xd')](_0x297df9,_0x12ee9a)[_0x9dd3('0xe')](function(_0xedc3ad){logger[_0x9dd3('0xf')](_0x9dd3('0x10'),_0x1dcf71,'request\x20sent');logger['debug']('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x1dcf71,_0x9dd3('0x11'),JSON[_0x9dd3('0x12')](_0xedc3ad));if(_0xedc3ad[_0x9dd3('0x13')]){if(_0xedc3ad[_0x9dd3('0x13')][_0x9dd3('0x14')]===0x1f4){logger[_0x9dd3('0x13')]('ScreenRecording,\x20%s,\x20%s',_0x1dcf71,_0xedc3ad[_0x9dd3('0x13')][_0x9dd3('0x15')]);return _0x32d3fb(_0xedc3ad[_0x9dd3('0x13')][_0x9dd3('0x15')]);}logger[_0x9dd3('0x13')]('ScreenRecording,\x20%s,\x20%s',_0x1dcf71,_0xedc3ad[_0x9dd3('0x13')][_0x9dd3('0x15')]);return _0x318e15(_0xedc3ad[_0x9dd3('0x13')][_0x9dd3('0x15')]);}else{logger[_0x9dd3('0xf')](_0x9dd3('0x10'),_0x1dcf71,_0x9dd3('0x11'));_0x318e15(_0xedc3ad[_0x9dd3('0x16')][_0x9dd3('0x15')]);}})[_0x9dd3('0x17')](function(_0x5a1412){logger[_0x9dd3('0x13')]('ScreenRecording,\x20%s,\x20%s',_0x1dcf71,_0x5a1412);_0x32d3fb(_0x5a1412);});});} \ No newline at end of file +var _0xc34a=['code','ScreenRecording,\x20%s,\x20%s','error','message','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','request\x20sent','stringify'];(function(_0x605db2,_0x4cba88){var _0x5b47ef=function(_0x31b6f9){while(--_0x31b6f9){_0x605db2['push'](_0x605db2['shift']());}};_0x5b47ef(++_0x4cba88);}(_0xc34a,0xb2));var _0xac34=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc34a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xac34('0x0'));var util=require(_0xac34('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xac34('0x2'));var fs=require('fs');var Redis=require(_0xac34('0x3'));var db=require(_0xac34('0x4'))['db'];var utils=require(_0xac34('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xac34('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xac34('0x7')][_0xac34('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xfc0fe4,_0x2bb67d,_0x3e4489){return new BPromise(function(_0xa66fa4,_0x2a6878){return client[_0xac34('0x9')](_0xfc0fe4,_0x3e4489)['then'](function(_0x115fa3){logger['info']('ScreenRecording,\x20%s,\x20%s',_0x2bb67d,_0xac34('0xa'));logger['debug']('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x2bb67d,_0xac34('0xa'),JSON[_0xac34('0xb')](_0x115fa3));if(_0x115fa3['error']){if(_0x115fa3['error'][_0xac34('0xc')]===0x1f4){logger['error'](_0xac34('0xd'),_0x2bb67d,_0x115fa3['error']['message']);return _0x2a6878(_0x115fa3[_0xac34('0xe')]['message']);}logger[_0xac34('0xe')](_0xac34('0xd'),_0x2bb67d,_0x115fa3['error']['message']);return _0xa66fa4(_0x115fa3[_0xac34('0xe')][_0xac34('0xf')]);}else{logger[_0xac34('0x10')](_0xac34('0xd'),_0x2bb67d,_0xac34('0xa'));_0xa66fa4(_0x115fa3[_0xac34('0x11')][_0xac34('0xf')]);}})[_0xac34('0x12')](function(_0x5b52de){logger[_0xac34('0xe')](_0xac34('0xd'),_0x2bb67d,_0x5b52de);_0x2a6878(_0x5b52de);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 5b8868d..549eac1 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 _0xcdc0=['addLogo','root','logologin','file','addLogoLogin','join','preferred','addPreferred','/:id/favicon','update','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./setting.controller','isAuthenticated','get','/now','/:id','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','getPreferred','getFavicon','diskStorage','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','/:id/logo','single'];(function(_0x15ce61,_0x36edbc){var _0x5e1f49=function(_0x162a76){while(--_0x162a76){_0x15ce61['push'](_0x15ce61['shift']());}};_0x5e1f49(++_0x36edbc);}(_0xcdc0,0x1eb));var _0x0cdc=function(_0x33dd3b,_0x4c3aba){_0x33dd3b=_0x33dd3b-0x0;var _0xb7ffed=_0xcdc0[_0x33dd3b];return _0xb7ffed;};'use strict';var multer=require(_0x0cdc('0x0'));var util=require('util');var path=require(_0x0cdc('0x1'));var timeout=require(_0x0cdc('0x2'));var express=require(_0x0cdc('0x3'));var router=express[_0x0cdc('0x4')]();var fs_extra=require(_0x0cdc('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0cdc('0x6'));var config=require(_0x0cdc('0x7'));var controller=require(_0x0cdc('0x8'));router['get']('/',auth[_0x0cdc('0x9')](),controller['index']);router[_0x0cdc('0xa')](_0x0cdc('0xb'),controller['getDate']);router[_0x0cdc('0xa')](_0x0cdc('0xc'),controller['show']);router[_0x0cdc('0xa')]('/:id/logo',controller['getLogo']);router['get'](_0x0cdc('0xd'),controller[_0x0cdc('0xe')]);router['get'](_0x0cdc('0xf'),controller['gdpr']);router[_0x0cdc('0xa')](_0x0cdc('0x10'),controller[_0x0cdc('0x11')]);router[_0x0cdc('0xa')]('/:id/favicon',controller[_0x0cdc('0x12')]);var upload=multer({'storage':multer[_0x0cdc('0x13')]({'destination':function(_0x59bf3b,_0xd2795c,_0x35b62b){_0x35b62b(null,path['join'](config['root'],_0x0cdc('0x14')));},'filename':function(_0x310af2,_0xb8bb6f,_0x2f36a9){_0x2f36a9(null,util[_0x0cdc('0x15')](_0x0cdc('0x16'),_0x0cdc('0x17'),path[_0x0cdc('0x18')](_0xb8bb6f[_0x0cdc('0x19')])));}})});router[_0x0cdc('0x1a')](_0x0cdc('0x1b'),upload[_0x0cdc('0x1c')]('file'),controller[_0x0cdc('0x1d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x11fe7f,_0x14de3a,_0x2162f6){_0x2162f6(null,path['join'](config[_0x0cdc('0x1e')],_0x0cdc('0x14')));},'filename':function(_0x32c587,_0xb9dc19,_0x2b5f47){_0x2b5f47(null,util[_0x0cdc('0x15')](_0x0cdc('0x16'),_0x0cdc('0x1f'),path[_0x0cdc('0x18')](_0xb9dc19[_0x0cdc('0x19')])));}})});router[_0x0cdc('0x1a')](_0x0cdc('0xd'),upload['single'](_0x0cdc('0x20')),controller[_0x0cdc('0x21')]);var upload=multer({'storage':multer[_0x0cdc('0x13')]({'destination':function(_0x5d85bf,_0x4d0553,_0x57b37e){_0x57b37e(null,path[_0x0cdc('0x22')](config[_0x0cdc('0x1e')],_0x0cdc('0x14')));},'filename':function(_0x598095,_0x4a4bca,_0x269aa2){_0x269aa2(null,util[_0x0cdc('0x15')](_0x0cdc('0x16'),_0x0cdc('0x23'),path[_0x0cdc('0x18')](_0x4a4bca[_0x0cdc('0x19')])));}})});router[_0x0cdc('0x1a')](_0x0cdc('0x10'),upload[_0x0cdc('0x1c')](_0x0cdc('0x20')),controller[_0x0cdc('0x24')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x274191,_0x298be0,_0x5d6296){_0x5d6296(null,path[_0x0cdc('0x22')](config['root'],_0x0cdc('0x14')));},'filename':function(_0x647273,_0x3cd751,_0x160eaf){_0x160eaf(null,util[_0x0cdc('0x15')]('%s%s','favicon',path[_0x0cdc('0x18')](_0x3cd751[_0x0cdc('0x19')])));}})});router[_0x0cdc('0x1a')](_0x0cdc('0x25'),upload['single'](_0x0cdc('0x20')),controller['addFavicon']);router['put'](_0x0cdc('0xc'),auth['isAuthenticated'](),controller[_0x0cdc('0x26')]);module[_0x0cdc('0x27')]=router; \ No newline at end of file +var _0xe6b8=['isAuthenticated','index','/now','show','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','extname','post','single','file','logologin','preferred','originalname','addPreferred','favicon','addFavicon','put','/:id','update','exports','util','path','express','Router','fs-extra','../../components/auth/service','get'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0xe6b8,0x161));var _0x8e6b=function(_0x45c343,_0x1f1961){_0x45c343=_0x45c343-0x0;var _0x11f9a7=_0xe6b8[_0x45c343];return _0x11f9a7;};'use strict';var multer=require('multer');var util=require(_0x8e6b('0x0'));var path=require(_0x8e6b('0x1'));var timeout=require('connect-timeout');var express=require(_0x8e6b('0x2'));var router=express[_0x8e6b('0x3')]();var fs_extra=require(_0x8e6b('0x4'));var auth=require(_0x8e6b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./setting.controller');router[_0x8e6b('0x6')]('/',auth[_0x8e6b('0x7')](),controller[_0x8e6b('0x8')]);router[_0x8e6b('0x6')](_0x8e6b('0x9'),controller['getDate']);router[_0x8e6b('0x6')]('/:id',controller[_0x8e6b('0xa')]);router[_0x8e6b('0x6')](_0x8e6b('0xb'),controller['getLogo']);router[_0x8e6b('0x6')](_0x8e6b('0xc'),controller[_0x8e6b('0xd')]);router['get'](_0x8e6b('0xe'),controller[_0x8e6b('0xf')]);router[_0x8e6b('0x6')](_0x8e6b('0x10'),controller[_0x8e6b('0x11')]);router['get'](_0x8e6b('0x12'),controller[_0x8e6b('0x13')]);var upload=multer({'storage':multer[_0x8e6b('0x14')]({'destination':function(_0x4496cb,_0x10d48c,_0x3bba00){_0x3bba00(null,path[_0x8e6b('0x15')](config[_0x8e6b('0x16')],_0x8e6b('0x17')));},'filename':function(_0xd6adc1,_0x2a4e42,_0x1425ec){_0x1425ec(null,util[_0x8e6b('0x18')](_0x8e6b('0x19'),'logo',path[_0x8e6b('0x1a')](_0x2a4e42['originalname'])));}})});router[_0x8e6b('0x1b')](_0x8e6b('0xb'),upload[_0x8e6b('0x1c')](_0x8e6b('0x1d')),controller['addLogo']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x32c303,_0x20ffad,_0xc5d0e4){_0xc5d0e4(null,path[_0x8e6b('0x15')](config[_0x8e6b('0x16')],_0x8e6b('0x17')));},'filename':function(_0x5eed02,_0x32bc0b,_0x280506){_0x280506(null,util[_0x8e6b('0x18')]('%s%s',_0x8e6b('0x1e'),path['extname'](_0x32bc0b['originalname'])));}})});router[_0x8e6b('0x1b')](_0x8e6b('0xc'),upload[_0x8e6b('0x1c')](_0x8e6b('0x1d')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x8e6b('0x14')]({'destination':function(_0x3f5f5d,_0x5b0c7c,_0x1fd845){_0x1fd845(null,path[_0x8e6b('0x15')](config[_0x8e6b('0x16')],'server/files/images/logos/'));},'filename':function(_0x5765e0,_0xab1d2b,_0x19aecf){_0x19aecf(null,util[_0x8e6b('0x18')](_0x8e6b('0x19'),_0x8e6b('0x1f'),path[_0x8e6b('0x1a')](_0xab1d2b[_0x8e6b('0x20')])));}})});router[_0x8e6b('0x1b')]('/:id/preferred',upload[_0x8e6b('0x1c')](_0x8e6b('0x1d')),controller[_0x8e6b('0x21')]);var upload=multer({'storage':multer[_0x8e6b('0x14')]({'destination':function(_0x341bc5,_0x5ca489,_0x175ee6){_0x175ee6(null,path[_0x8e6b('0x15')](config[_0x8e6b('0x16')],_0x8e6b('0x17')));},'filename':function(_0x3e7556,_0x39bc9c,_0x21a9ae){_0x21a9ae(null,util['format'](_0x8e6b('0x19'),_0x8e6b('0x22'),path['extname'](_0x39bc9c[_0x8e6b('0x20')])));}})});router[_0x8e6b('0x1b')](_0x8e6b('0x12'),upload[_0x8e6b('0x1c')]('file'),controller[_0x8e6b('0x23')]);router[_0x8e6b('0x24')](_0x8e6b('0x25'),auth[_0x8e6b('0x7')](),controller[_0x8e6b('0x26')]);module[_0x8e6b('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 4bd63d5..fad2858 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 _0x7a54=['UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','alternate'];(function(_0x3fd613,_0x2e79ac){var _0x4997d0=function(_0x47bd83){while(--_0x47bd83){_0x3fd613['push'](_0x3fd613['shift']());}};_0x4997d0(++_0x2e79ac);}(_0x7a54,0x106));var _0x47a5=function(_0x4fba8a,_0x187e0b){_0x4fba8a=_0x4fba8a-0x0;var _0x585db3=_0x7a54[_0x4fba8a];return _0x585db3;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'min_internal':{'type':Sequelize[_0x47a5('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x47a5('0x2')](0xb),'unique':_0x47a5('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x47a5('0x4')],'defaultValue':_0x47a5('0x5')},'logo':{'type':Sequelize[_0x47a5('0x4')]},'defaultLogo':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x47a5('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x47a5('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x47a5('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x47a5('0x4')],'defaultValue':_0x47a5('0x7')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x47a5('0x4')]},'defaultPreferred':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x47a5('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x47a5('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x47a5('0x2')]},'transcribeRegion':{'type':Sequelize[_0x47a5('0x4')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x47a5('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0x47a5('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x47a5('0x2')](0x2)[_0x47a5('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x47a5('0x2')](0x2)[_0x47a5('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x47a5('0x2')](0x2)[_0x47a5('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)[_0x47a5('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x5f66=['STRING','BOOLEAN','UNSIGNED','exports','min_internal','INTEGER','min_mailbox'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x5f66,0x1a0));var _0x65f6=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x5f66[_0x122096];return _0x3d1966;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x65f6('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x65f6('0x2')](0xb),'unique':_0x65f6('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x65f6('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x65f6('0x4')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0x65f6('0x4')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x65f6('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x65f6('0x4')]},'turnaddr':{'type':Sequelize[_0x65f6('0x4')]},'turnusername':{'type':Sequelize[_0x65f6('0x4')]},'turnpassword':{'type':Sequelize[_0x65f6('0x4')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x65f6('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x65f6('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x65f6('0x4')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x65f6('0x4')]},'defaultPreferred':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x65f6('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x65f6('0x4')]},'defaultFavicon':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x65f6('0x4')]},'sentiment':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x65f6('0x2')]},'sentimentRegion':{'type':Sequelize[_0x65f6('0x4')]},'language':{'type':Sequelize[_0x65f6('0x4')]},'bucket':{'type':Sequelize[_0x65f6('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x65f6('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize['INTEGER'](0x2)[_0x65f6('0x6')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x65f6('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 6da2548..79b441b 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 _0xa276=['getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','custom','Sequelize','upperFirst','download','getLogoLogin','default_loginLogo.svg','ValidationError','\x20not\x20found','addPreferred','getPreferred','default_preferred.png','default','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','info','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Setting,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','destroy','stack','name','send','index','Setting','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','keys','find','update','body','file','filename','logo','loginLogo'];(function(_0x58a4ac,_0x43fd42){var _0x545810=function(_0x308e65){while(--_0x308e65){_0x58a4ac['push'](_0x58a4ac['shift']());}};_0x545810(++_0x43fd42);}(_0xa276,0x9a));var _0x6a27=function(_0x56d848,_0x2efd64){_0x56d848=_0x56d848-0x0;var _0x459956=_0xa276[_0x56d848];return _0x459956;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6a27('0x0'));var zipdir=require(_0x6a27('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a27('0x2'));var moment=require(_0x6a27('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6a27('0x4'));var util=require(_0x6a27('0x5'));var path=require(_0x6a27('0x6'));var sox=require('sox');var csv=require(_0x6a27('0x7'));var ejs=require(_0x6a27('0x8'));var fs=require('fs');var fs_extra=require(_0x6a27('0x9'));var _=require('lodash');var squel=require(_0x6a27('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6a27('0xb'));var Papa=require(_0x6a27('0xc'));var Redis=require(_0x6a27('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6a27('0xe'));var hardwareService=require(_0x6a27('0xf'));var logger=require(_0x6a27('0x10'))(_0x6a27('0x11'));var utils=require(_0x6a27('0x12'));var config=require(_0x6a27('0x13'));var licenseUtil=require(_0x6a27('0x14'));var db=require(_0x6a27('0x15'))['db'];var jayson=require(_0x6a27('0x16'));var client=jayson['client'][_0x6a27('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x59012a,_0x4f5ce4,_0x2c7339,_0x1e987f){return new BPromise(function(_0x39ef85,_0x5b28c6){var _0x1b574a=_0x1e987f||client;return _0x1b574a[_0x6a27('0x18')](_0x59012a,_0x2c7339)[_0x6a27('0x19')](function(_0x8f297b){logger[_0x6a27('0x1a')]('Setting,\x20%s,\x20%s',_0x4f5ce4,'request\x20sent');logger[_0x6a27('0x1b')](_0x6a27('0x1c'),_0x4f5ce4,_0x6a27('0x1d'),JSON[_0x6a27('0x1e')](_0x8f297b));if(_0x8f297b[_0x6a27('0x1f')]){if(_0x8f297b[_0x6a27('0x1f')]['code']===0x1f4){logger[_0x6a27('0x1f')](_0x6a27('0x20'),_0x4f5ce4,_0x8f297b[_0x6a27('0x1f')][_0x6a27('0x21')]);return _0x5b28c6(_0x8f297b['error'][_0x6a27('0x21')]);}logger[_0x6a27('0x1f')](_0x6a27('0x20'),_0x4f5ce4,_0x8f297b[_0x6a27('0x1f')]['message']);return _0x39ef85(_0x8f297b['error'][_0x6a27('0x21')]);}else{logger[_0x6a27('0x1a')]('Setting,\x20%s,\x20%s',_0x4f5ce4,_0x6a27('0x1d'));_0x39ef85(_0x8f297b[_0x6a27('0x22')][_0x6a27('0x21')]);}})[_0x6a27('0x23')](function(_0x12ead4){logger[_0x6a27('0x1f')](_0x6a27('0x20'),_0x4f5ce4,_0x12ead4);_0x5b28c6(_0x12ead4);});});}function respondWithStatusCode(_0x13e148,_0x5e3a2e){_0x5e3a2e=_0x5e3a2e||0xcc;return function(_0x241029){if(_0x241029){return _0x13e148[_0x6a27('0x24')](_0x5e3a2e);}return _0x13e148[_0x6a27('0x25')](_0x5e3a2e)[_0x6a27('0x26')]();};}function respondWithResult(_0x2b3e5e,_0x5f4897){_0x5f4897=_0x5f4897||0xc8;return function(_0x5b725c){if(_0x5b725c){return _0x2b3e5e[_0x6a27('0x25')](_0x5f4897)[_0x6a27('0x27')](_0x5b725c);}};}function respondWithFilteredResult(_0x73dc52,_0x354781){return function(_0x54fc6c){if(_0x54fc6c){var _0x118df4=typeof _0x354781['offset']==='undefined'&&typeof _0x354781[_0x6a27('0x28')]===_0x6a27('0x29');var _0x4d1711=_0x54fc6c[_0x6a27('0x2a')];var _0x52cc5d=_0x118df4?0x0:_0x354781[_0x6a27('0x2b')];var _0xa42f9c=_0x118df4?_0x54fc6c['count']:_0x354781[_0x6a27('0x2b')]+_0x354781[_0x6a27('0x28')];var _0x3a1415;if(_0xa42f9c>=_0x4d1711){_0xa42f9c=_0x4d1711;_0x3a1415=0xc8;}else{_0x3a1415=0xce;}_0x73dc52[_0x6a27('0x25')](_0x3a1415);return _0x73dc52[_0x6a27('0x2c')](_0x6a27('0x2d'),_0x52cc5d+'-'+_0xa42f9c+'/'+_0x4d1711)[_0x6a27('0x27')](_0x54fc6c);}return null;};}function patchUpdates(_0x1d37f2){return function(_0x588df7){try{jsonpatch[_0x6a27('0x2e')](_0x588df7,_0x1d37f2,!![]);}catch(_0x10fc65){return BPromise[_0x6a27('0x2f')](_0x10fc65);}return _0x588df7[_0x6a27('0x30')]();};}function saveUpdates(_0x4f08de,_0x4ae1c6){return function(_0x20060f){if(_0x20060f){return _0x20060f['update'](_0x4f08de)[_0x6a27('0x19')](function(_0x94a431){return _0x94a431;});}return null;};}function removeEntity(_0x14d0aa,_0x5beac8){return function(_0x1ab3b0){if(_0x1ab3b0){return _0x1ab3b0[_0x6a27('0x31')]()[_0x6a27('0x19')](function(){_0x14d0aa[_0x6a27('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbb3d4,_0x574df6){return function(_0x1529c6){if(!_0x1529c6){_0xbb3d4[_0x6a27('0x24')](0x194);}return _0x1529c6;};}function handleError(_0x78e3c0,_0x1a96e4){_0x1a96e4=_0x1a96e4||0x1f4;return function(_0x164d6f){logger['error'](_0x164d6f[_0x6a27('0x32')]);if(_0x164d6f[_0x6a27('0x33')]){delete _0x164d6f['name'];}_0x78e3c0['status'](_0x1a96e4)[_0x6a27('0x34')](_0x164d6f);};}exports[_0x6a27('0x35')]=function(_0x28b1bc,_0x34e672){var _0x1d9c1c={},_0x3c3ad2={},_0x556b2a={'count':0x0,'rows':[]};var _0x2d5ab3=_['map'](db[_0x6a27('0x36')][_0x6a27('0x37')],function(_0x61939d){return{'name':_0x61939d[_0x6a27('0x38')],'type':_0x61939d[_0x6a27('0x39')][_0x6a27('0x3a')]};});_0x3c3ad2[_0x6a27('0x3b')]=_[_0x6a27('0x3c')](_0x2d5ab3,'name');_0x3c3ad2[_0x6a27('0x3d')]=_['keys'](_0x28b1bc['query']);_0x3c3ad2[_0x6a27('0x3e')]=_[_0x6a27('0x3f')](_0x3c3ad2[_0x6a27('0x3b')],_0x3c3ad2[_0x6a27('0x3d')]);_0x1d9c1c[_0x6a27('0x40')]=_[_0x6a27('0x3f')](_0x3c3ad2['model'],qs['fields'](_0x28b1bc[_0x6a27('0x3d')][_0x6a27('0x41')]));_0x1d9c1c['attributes']=_0x1d9c1c[_0x6a27('0x40')][_0x6a27('0x42')]?_0x1d9c1c['attributes']:_0x3c3ad2['model'];if(!_0x28b1bc[_0x6a27('0x3d')]['hasOwnProperty'](_0x6a27('0x43'))){_0x1d9c1c[_0x6a27('0x28')]=qs[_0x6a27('0x28')](_0x28b1bc[_0x6a27('0x3d')]['limit']);_0x1d9c1c[_0x6a27('0x2b')]=qs[_0x6a27('0x2b')](_0x28b1bc['query'][_0x6a27('0x2b')]);}_0x1d9c1c['order']=qs[_0x6a27('0x44')](_0x28b1bc[_0x6a27('0x3d')][_0x6a27('0x44')]);_0x1d9c1c[_0x6a27('0x45')]=qs['filters'](_['pick'](_0x28b1bc[_0x6a27('0x3d')],_0x3c3ad2[_0x6a27('0x3e')]),_0x2d5ab3);if(_0x28b1bc[_0x6a27('0x3d')][_0x6a27('0x46')]){_0x1d9c1c[_0x6a27('0x45')]=_['merge'](_0x1d9c1c[_0x6a27('0x45')],{'$or':_[_0x6a27('0x3c')](_0x2d5ab3,function(_0x35979f){if(_0x35979f[_0x6a27('0x39')]!==_0x6a27('0x47')){var _0x128c6d={};_0x128c6d[_0x35979f[_0x6a27('0x33')]]={'$like':'%'+_0x28b1bc[_0x6a27('0x3d')][_0x6a27('0x46')]+'%'};return _0x128c6d;}})});}_0x1d9c1c=_[_0x6a27('0x48')]({},_0x1d9c1c,_0x28b1bc[_0x6a27('0x49')]);var _0x38494f={'where':_0x1d9c1c[_0x6a27('0x45')]};return db[_0x6a27('0x36')][_0x6a27('0x2a')](_0x38494f)[_0x6a27('0x19')](function(_0x33972d){_0x556b2a[_0x6a27('0x2a')]=_0x33972d;if(_0x28b1bc[_0x6a27('0x3d')][_0x6a27('0x4a')]){_0x1d9c1c[_0x6a27('0x4b')]=[{'all':!![]}];}return db['Setting'][_0x6a27('0x4c')](_0x1d9c1c);})['then'](function(_0x5b8948){_0x556b2a[_0x6a27('0x4d')]=_0x5b8948;return _0x556b2a;})[_0x6a27('0x19')](respondWithFilteredResult(_0x34e672,_0x1d9c1c))[_0x6a27('0x23')](handleError(_0x34e672,null));};exports[_0x6a27('0x4e')]=function(_0x5290ef,_0x3cf7d7){var _0x30e5e9={'raw':![],'where':{'id':_0x5290ef[_0x6a27('0x4f')]['id']}},_0x5db14a={};_0x5db14a['model']=_['keys'](db[_0x6a27('0x36')][_0x6a27('0x37')]);_0x5db14a['query']=_[_0x6a27('0x50')](_0x5290ef['query']);_0x5db14a[_0x6a27('0x3e')]=_[_0x6a27('0x3f')](_0x5db14a['model'],_0x5db14a['query']);_0x30e5e9[_0x6a27('0x40')]=_[_0x6a27('0x3f')](_0x5db14a['model'],qs[_0x6a27('0x41')](_0x5290ef[_0x6a27('0x3d')][_0x6a27('0x41')]));_0x30e5e9[_0x6a27('0x40')]=_0x30e5e9[_0x6a27('0x40')][_0x6a27('0x42')]?_0x30e5e9['attributes']:_0x5db14a[_0x6a27('0x3b')];if(_0x5290ef[_0x6a27('0x3d')][_0x6a27('0x4a')]){_0x30e5e9['include']=[{'all':!![]}];}_0x30e5e9=_[_0x6a27('0x48')]({},_0x30e5e9,_0x5290ef[_0x6a27('0x49')]);return db[_0x6a27('0x36')][_0x6a27('0x51')](_0x30e5e9)[_0x6a27('0x19')](handleEntityNotFound(_0x3cf7d7,null))['then'](respondWithResult(_0x3cf7d7,null))['catch'](handleError(_0x3cf7d7,null));};exports[_0x6a27('0x52')]=function(_0x5aab0c,_0x9ab91b){if(_0x5aab0c[_0x6a27('0x53')]['id']){delete _0x5aab0c[_0x6a27('0x53')]['id'];}return db[_0x6a27('0x36')][_0x6a27('0x51')]({'where':{'id':_0x5aab0c[_0x6a27('0x4f')]['id']}})[_0x6a27('0x19')](handleEntityNotFound(_0x9ab91b,null))['then'](saveUpdates(_0x5aab0c[_0x6a27('0x53')],null))[_0x6a27('0x19')](respondWithResult(_0x9ab91b,null))['catch'](handleError(_0x9ab91b,null));};exports['addLogo']=function(_0x557cf6,_0x165e6d,_0x1e5d5c){if(_0x557cf6[_0x6a27('0x54')]&&_0x557cf6[_0x6a27('0x54')][_0x6a27('0x55')]){_0x557cf6[_0x6a27('0x53')][_0x6a27('0x56')]=_0x557cf6[_0x6a27('0x54')][_0x6a27('0x55')];}return db[_0x6a27('0x36')][_0x6a27('0x51')]({'where':{'id':_0x557cf6[_0x6a27('0x4f')]['id']}})[_0x6a27('0x19')](handleEntityNotFound(_0x165e6d,null))[_0x6a27('0x19')](saveUpdates(_0x557cf6[_0x6a27('0x53')],null))['then'](respondWithResult(_0x165e6d,null))[_0x6a27('0x23')](handleError(_0x165e6d,null));};exports['addLogoLogin']=function(_0x100a9f,_0x3826d4,_0x14bac7){if(_0x100a9f[_0x6a27('0x54')]&&_0x100a9f[_0x6a27('0x54')]['filename']){_0x100a9f[_0x6a27('0x53')][_0x6a27('0x57')]=_0x100a9f[_0x6a27('0x54')][_0x6a27('0x55')];}return db[_0x6a27('0x36')]['find']({'where':{'id':_0x100a9f[_0x6a27('0x4f')]['id']}})[_0x6a27('0x19')](handleEntityNotFound(_0x3826d4,null))['then'](saveUpdates(_0x100a9f[_0x6a27('0x53')],null))[_0x6a27('0x19')](respondWithResult(_0x3826d4,null))[_0x6a27('0x23')](handleError(_0x3826d4,null));};var utilLicense=require('../../config/license/util');exports[_0x6a27('0x58')]=function(_0x2af79c,_0x1e1cbc,_0x304a10){var _0x1e77ea=_0x6a27('0x59');var _0xc6eeaa={'custom':![]};return utilLicense[_0x6a27('0x5a')]()[_0x6a27('0x19')](function(_0x24811a){if(_0x24811a){_0xc6eeaa=_0x24811a;}return db[_0x6a27('0x36')][_0x6a27('0x51')]({'where':{'id':_0x2af79c[_0x6a27('0x4f')]['id']},'attributes':[_0x6a27('0x56'),_0x6a27('0x57'),_0x6a27('0x5b'),_0x6a27('0x5c'),_0x6a27('0x5d'),_0x6a27('0x5e'),_0x6a27('0x5f'),_0x6a27('0x60')],'raw':!![]});})[_0x6a27('0x19')](handleEntityNotFound(_0x1e1cbc,null))[_0x6a27('0x19')](function(_0x3b4f4d){if(_0x3b4f4d){var _0x349490=_0x3b4f4d['logo']&&fs[_0x6a27('0x61')](path[_0x6a27('0x62')](config[_0x6a27('0x63')],_0x1e77ea,_[_0x6a27('0x64')](_0x3b4f4d[_0x6a27('0x56')])))?path[_0x6a27('0x62')](config[_0x6a27('0x63')],_0x1e77ea,_[_0x6a27('0x64')](_0x3b4f4d[_0x6a27('0x56')])):path['join'](config[_0x6a27('0x63')],_0x1e77ea,_[_0x6a27('0x64')](_0x6a27('0x65')));var _0x3bc5f9='default'+_['upperFirst']('logo');if(_0x3b4f4d[_0x3bc5f9]||!_0xc6eeaa[_0x6a27('0x66')]){_0x349490=path[_0x6a27('0x62')](config[_0x6a27('0x63')],_0x1e77ea,_[_0x6a27('0x64')](_0x6a27('0x65')));}if(!fs[_0x6a27('0x61')](_0x349490)){throw new db[(_0x6a27('0x67'))]['ValidationError'](_[_0x6a27('0x68')](_0x6a27('0x56'))+'\x20not\x20found');}return _0x1e1cbc[_0x6a27('0x69')](_0x349490);}})[_0x6a27('0x23')](handleError(_0x1e1cbc,null));};var utilLicense=require(_0x6a27('0x14'));exports[_0x6a27('0x6a')]=function(_0x499fa2,_0x362084,_0x59e668){var _0x347a74=_0x6a27('0x59');var _0x3e1a1f={'custom':![]};return utilLicense[_0x6a27('0x5a')]()[_0x6a27('0x19')](function(_0x34e8fd){if(_0x34e8fd){_0x3e1a1f=_0x34e8fd;}return db['Setting'][_0x6a27('0x51')]({'where':{'id':_0x499fa2[_0x6a27('0x4f')]['id']},'attributes':[_0x6a27('0x56'),'loginLogo',_0x6a27('0x5b'),_0x6a27('0x5c'),_0x6a27('0x5d'),'defaultLoginLogo',_0x6a27('0x5f'),_0x6a27('0x60')],'raw':!![]});})[_0x6a27('0x19')](handleEntityNotFound(_0x362084,null))[_0x6a27('0x19')](function(_0xef42cd){if(_0xef42cd){var _0x536d42=_0xef42cd['loginLogo']&&fs[_0x6a27('0x61')](path['join'](config[_0x6a27('0x63')],_0x347a74,_['toLower'](_0xef42cd[_0x6a27('0x57')])))?path[_0x6a27('0x62')](config['root'],_0x347a74,_[_0x6a27('0x64')](_0xef42cd['loginLogo'])):path[_0x6a27('0x62')](config[_0x6a27('0x63')],_0x347a74,_['toLower'](_0x6a27('0x6b')));var _0x13ab6a='default'+_[_0x6a27('0x68')](_0x6a27('0x57'));if(_0xef42cd[_0x13ab6a]||!_0x3e1a1f[_0x6a27('0x66')]){_0x536d42=path[_0x6a27('0x62')](config[_0x6a27('0x63')],_0x347a74,_[_0x6a27('0x64')]('default_loginLogo.svg'));}if(!fs[_0x6a27('0x61')](_0x536d42)){throw new db[(_0x6a27('0x67'))][(_0x6a27('0x6c'))](_[_0x6a27('0x68')]('loginLogo')+_0x6a27('0x6d'));}return _0x362084[_0x6a27('0x69')](_0x536d42);}})['catch'](handleError(_0x362084,null));};exports['gdpr']=function(_0x563493,_0x3b2c8c){return db[_0x6a27('0x36')][_0x6a27('0x51')]({'where':{'id':_0x563493[_0x6a27('0x4f')]['id']},'attributes':['securePassword']})[_0x6a27('0x19')](respondWithResult(_0x3b2c8c,null))[_0x6a27('0x23')](handleError(_0x3b2c8c,null));};exports[_0x6a27('0x6e')]=function(_0x1f3b3b,_0x2cd8fa,_0x387dc3){if(_0x1f3b3b[_0x6a27('0x54')]&&_0x1f3b3b[_0x6a27('0x54')]['filename']){_0x1f3b3b['body'][_0x6a27('0x5b')]=_0x1f3b3b[_0x6a27('0x54')][_0x6a27('0x55')];}return db[_0x6a27('0x36')][_0x6a27('0x51')]({'where':{'id':_0x1f3b3b[_0x6a27('0x4f')]['id']}})[_0x6a27('0x19')](handleEntityNotFound(_0x2cd8fa,null))['then'](saveUpdates(_0x1f3b3b[_0x6a27('0x53')],null))['then'](respondWithResult(_0x2cd8fa,null))[_0x6a27('0x23')](handleError(_0x2cd8fa,null));};var utilLicense=require(_0x6a27('0x14'));exports[_0x6a27('0x6f')]=function(_0x2792c8,_0x33eec3,_0x2640c1){var _0x88bec1=_0x6a27('0x59');var _0x567c14={'custom':![]};return utilLicense['getLicense']()[_0x6a27('0x19')](function(_0x510530){if(_0x510530){_0x567c14=_0x510530;}return db[_0x6a27('0x36')][_0x6a27('0x51')]({'where':{'id':_0x2792c8[_0x6a27('0x4f')]['id']},'attributes':[_0x6a27('0x56'),_0x6a27('0x57'),_0x6a27('0x5b'),_0x6a27('0x5c'),_0x6a27('0x5d'),_0x6a27('0x5e'),_0x6a27('0x5f'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x33eec3,null))[_0x6a27('0x19')](function(_0x53fd0f){if(_0x53fd0f){var _0x494e70=_0x53fd0f['preferred']&&fs[_0x6a27('0x61')](path[_0x6a27('0x62')](config[_0x6a27('0x63')],_0x88bec1,_['toLower'](_0x53fd0f[_0x6a27('0x5b')])))?path[_0x6a27('0x62')](config[_0x6a27('0x63')],_0x88bec1,_[_0x6a27('0x64')](_0x53fd0f[_0x6a27('0x5b')])):path['join'](config[_0x6a27('0x63')],_0x88bec1,_['toLower'](_0x6a27('0x70')));var _0x16143b=_0x6a27('0x71')+_[_0x6a27('0x68')](_0x6a27('0x5b'));if(_0x53fd0f[_0x16143b]||!_0x567c14[_0x6a27('0x66')]||!_0x567c14[_0x6a27('0x5b')]){_0x494e70=path['join'](config[_0x6a27('0x63')],_0x88bec1,_[_0x6a27('0x64')]('default_preferred.png'));}if(!fs['existsSync'](_0x494e70)){throw new db[(_0x6a27('0x67'))]['ValidationError'](_[_0x6a27('0x68')]('preferred')+'\x20not\x20found');}return _0x33eec3[_0x6a27('0x69')](_0x494e70);}})[_0x6a27('0x23')](handleError(_0x33eec3,null));};exports['addFavicon']=function(_0x231c54,_0x12830b,_0x5e8b80){if(_0x231c54[_0x6a27('0x54')]&&_0x231c54[_0x6a27('0x54')][_0x6a27('0x55')]){_0x231c54[_0x6a27('0x53')][_0x6a27('0x5c')]=_0x231c54[_0x6a27('0x54')][_0x6a27('0x55')];}return db['Setting'][_0x6a27('0x51')]({'where':{'id':_0x231c54[_0x6a27('0x4f')]['id']}})[_0x6a27('0x19')](handleEntityNotFound(_0x12830b,null))['then'](saveUpdates(_0x231c54[_0x6a27('0x53')],null))[_0x6a27('0x19')](respondWithResult(_0x12830b,null))[_0x6a27('0x23')](handleError(_0x12830b,null));};var utilLicense=require(_0x6a27('0x14'));exports[_0x6a27('0x72')]=function(_0x318628,_0xcc0bc8,_0x33c15f){var _0x1a249c='server/files/images/logos';var _0x1a1e0f={'custom':![]};return utilLicense[_0x6a27('0x5a')]()[_0x6a27('0x19')](function(_0x423c9d){if(_0x423c9d){_0x1a1e0f=_0x423c9d;}return db[_0x6a27('0x36')][_0x6a27('0x51')]({'where':{'id':_0x318628['params']['id']},'attributes':[_0x6a27('0x56'),'loginLogo',_0x6a27('0x5b'),_0x6a27('0x5c'),_0x6a27('0x5d'),_0x6a27('0x5e'),_0x6a27('0x5f'),_0x6a27('0x60')],'raw':!![]});})[_0x6a27('0x19')](handleEntityNotFound(_0xcc0bc8,null))[_0x6a27('0x19')](function(_0x19285d){if(_0x19285d){var _0x2bd376=_0x19285d[_0x6a27('0x5c')]&&fs[_0x6a27('0x61')](path[_0x6a27('0x62')](config[_0x6a27('0x63')],_0x1a249c,_['toLower'](_0x19285d['favicon'])))?path[_0x6a27('0x62')](config[_0x6a27('0x63')],_0x1a249c,_[_0x6a27('0x64')](_0x19285d[_0x6a27('0x5c')])):path['join'](config['root'],_0x1a249c,_[_0x6a27('0x64')](_0x6a27('0x73')));var _0x304a1f=_0x6a27('0x71')+_[_0x6a27('0x68')](_0x6a27('0x5c'));if(_0x19285d[_0x304a1f]||!_0x1a1e0f[_0x6a27('0x66')]){_0x2bd376=path[_0x6a27('0x62')](config[_0x6a27('0x63')],_0x1a249c,_['toLower'](_0x6a27('0x73')));}if(!fs[_0x6a27('0x61')](_0x2bd376)){throw new db[(_0x6a27('0x67'))][(_0x6a27('0x6c'))](_[_0x6a27('0x68')](_0x6a27('0x5c'))+_0x6a27('0x6d'));}return _0xcc0bc8[_0x6a27('0x69')](_0x2bd376);}})[_0x6a27('0x23')](handleError(_0xcc0bc8,null));};exports[_0x6a27('0x74')]=function(_0x6e700f,_0x18a6dd){var _0x560979={'offset':moment()[_0x6a27('0x75')]()};_0x560979[_0x6a27('0x76')]=moment()['utcOffset'](_0x560979['offset'])[_0x6a27('0x77')](_0x6a27('0x78'));return _0x18a6dd[_0x6a27('0x25')](0xc8)[_0x6a27('0x34')](_0x560979);}; \ No newline at end of file +var _0x16c1=['jayson/promise','client','request','then','info','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Setting,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','Setting','includeAll','include','findAll','show','keys','find','body','addLogo','file','filename','params','addLogoLogin','getLogo','loginLogo','preferred','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','toLower','logo','root','default','custom','default_logo.svg','Sequelize','ValidationError','upperFirst','\x20not\x20found','download','server/files/images/logos','getLicense','favicon','default_loginLogo.svg','gdpr','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x4eb6fd,_0x3f9f91){var _0x5543c9=function(_0x543fec){while(--_0x543fec){_0x4eb6fd['push'](_0x4eb6fd['shift']());}};_0x5543c9(++_0x3f9f91);}(_0x16c1,0x66));var _0x116c=function(_0x1a1650,_0x31ddaa){_0x1a1650=_0x1a1650-0x0;var _0x33409d=_0x16c1[_0x1a1650];return _0x33409d;};'use strict';var emlformat=require(_0x116c('0x0'));var rimraf=require(_0x116c('0x1'));var zipdir=require(_0x116c('0x2'));var jsonpatch=require(_0x116c('0x3'));var rp=require(_0x116c('0x4'));var moment=require(_0x116c('0x5'));var BPromise=require(_0x116c('0x6'));var Mustache=require(_0x116c('0x7'));var util=require(_0x116c('0x8'));var path=require('path');var sox=require(_0x116c('0x9'));var csv=require('to-csv');var ejs=require(_0x116c('0xa'));var fs=require('fs');var fs_extra=require(_0x116c('0xb'));var _=require(_0x116c('0xc'));var squel=require(_0x116c('0xd'));var crypto=require(_0x116c('0xe'));var jsforce=require(_0x116c('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x116c('0x10'));var querystring=require(_0x116c('0x11'));var Papa=require(_0x116c('0x12'));var Redis=require(_0x116c('0x13'));var authService=require(_0x116c('0x14'));var qs=require(_0x116c('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x116c('0x16'));var logger=require(_0x116c('0x17'))(_0x116c('0x18'));var utils=require(_0x116c('0x19'));var config=require(_0x116c('0x1a'));var licenseUtil=require(_0x116c('0x1b'));var db=require(_0x116c('0x1c'))['db'];var jayson=require(_0x116c('0x1d'));var client=jayson[_0x116c('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd1163f,_0x330f51,_0x4af1a8,_0x452a94){return new BPromise(function(_0x575766,_0x2da2d7){var _0x1a4646=_0x452a94||client;return _0x1a4646[_0x116c('0x1f')](_0xd1163f,_0x4af1a8)[_0x116c('0x20')](function(_0x82df96){logger[_0x116c('0x21')]('Setting,\x20%s,\x20%s',_0x330f51,'request\x20sent');logger[_0x116c('0x22')](_0x116c('0x23'),_0x330f51,_0x116c('0x24'),JSON[_0x116c('0x25')](_0x82df96));if(_0x82df96[_0x116c('0x26')]){if(_0x82df96[_0x116c('0x26')]['code']===0x1f4){logger[_0x116c('0x26')](_0x116c('0x27'),_0x330f51,_0x82df96[_0x116c('0x26')][_0x116c('0x28')]);return _0x2da2d7(_0x82df96[_0x116c('0x26')][_0x116c('0x28')]);}logger[_0x116c('0x26')](_0x116c('0x27'),_0x330f51,_0x82df96['error'][_0x116c('0x28')]);return _0x575766(_0x82df96['error'][_0x116c('0x28')]);}else{logger[_0x116c('0x21')]('Setting,\x20%s,\x20%s',_0x330f51,_0x116c('0x24'));_0x575766(_0x82df96[_0x116c('0x29')]['message']);}})[_0x116c('0x2a')](function(_0x5a68ec){logger[_0x116c('0x26')]('Setting,\x20%s,\x20%s',_0x330f51,_0x5a68ec);_0x2da2d7(_0x5a68ec);});});}function respondWithStatusCode(_0x531ad9,_0x17c15d){_0x17c15d=_0x17c15d||0xcc;return function(_0x4ad2c5){if(_0x4ad2c5){return _0x531ad9[_0x116c('0x2b')](_0x17c15d);}return _0x531ad9[_0x116c('0x2c')](_0x17c15d)[_0x116c('0x2d')]();};}function respondWithResult(_0x3150cd,_0x5a879b){_0x5a879b=_0x5a879b||0xc8;return function(_0x432cac){if(_0x432cac){return _0x3150cd[_0x116c('0x2c')](_0x5a879b)[_0x116c('0x2e')](_0x432cac);}};}function respondWithFilteredResult(_0x15c799,_0x19313b){return function(_0x101d19){if(_0x101d19){var _0x554a33=typeof _0x19313b['offset']===_0x116c('0x2f')&&typeof _0x19313b[_0x116c('0x30')]===_0x116c('0x2f');var _0x10f4ad=_0x101d19[_0x116c('0x31')];var _0x1a56ea=_0x554a33?0x0:_0x19313b[_0x116c('0x32')];var _0x2ba6b4=_0x554a33?_0x101d19[_0x116c('0x31')]:_0x19313b[_0x116c('0x32')]+_0x19313b[_0x116c('0x30')];var _0x433906;if(_0x2ba6b4>=_0x10f4ad){_0x2ba6b4=_0x10f4ad;_0x433906=0xc8;}else{_0x433906=0xce;}_0x15c799[_0x116c('0x2c')](_0x433906);return _0x15c799[_0x116c('0x33')](_0x116c('0x34'),_0x1a56ea+'-'+_0x2ba6b4+'/'+_0x10f4ad)[_0x116c('0x2e')](_0x101d19);}return null;};}function patchUpdates(_0x42fa23){return function(_0x432b3e){try{jsonpatch[_0x116c('0x35')](_0x432b3e,_0x42fa23,!![]);}catch(_0x27d46b){return BPromise[_0x116c('0x36')](_0x27d46b);}return _0x432b3e[_0x116c('0x37')]();};}function saveUpdates(_0x3e5826,_0x408f43){return function(_0x5adba7){if(_0x5adba7){return _0x5adba7[_0x116c('0x38')](_0x3e5826)['then'](function(_0x462ae5){return _0x462ae5;});}return null;};}function removeEntity(_0x16ca37,_0x4cb363){return function(_0x21a274){if(_0x21a274){return _0x21a274[_0x116c('0x39')]()['then'](function(){_0x16ca37['status'](0xcc)[_0x116c('0x2d')]();});}};}function handleEntityNotFound(_0x35c420,_0x234c1f){return function(_0x33ba1c){if(!_0x33ba1c){_0x35c420[_0x116c('0x2b')](0x194);}return _0x33ba1c;};}function handleError(_0x4f4701,_0x1c3e0c){_0x1c3e0c=_0x1c3e0c||0x1f4;return function(_0x487307){logger[_0x116c('0x26')](_0x487307[_0x116c('0x3a')]);if(_0x487307[_0x116c('0x3b')]){delete _0x487307[_0x116c('0x3b')];}_0x4f4701[_0x116c('0x2c')](_0x1c3e0c)[_0x116c('0x3c')](_0x487307);};}exports[_0x116c('0x3d')]=function(_0x22c853,_0x4fb7a5){var _0x2cf2ec={},_0x501587={},_0x5d1b20={'count':0x0,'rows':[]};var _0x40aa63=_[_0x116c('0x3e')](db['Setting'][_0x116c('0x3f')],function(_0x38f247){return{'name':_0x38f247[_0x116c('0x40')],'type':_0x38f247[_0x116c('0x41')]['key']};});_0x501587[_0x116c('0x42')]=_[_0x116c('0x3e')](_0x40aa63,_0x116c('0x3b'));_0x501587[_0x116c('0x43')]=_['keys'](_0x22c853[_0x116c('0x43')]);_0x501587['filters']=_['intersection'](_0x501587['model'],_0x501587[_0x116c('0x43')]);_0x2cf2ec[_0x116c('0x44')]=_[_0x116c('0x45')](_0x501587[_0x116c('0x42')],qs[_0x116c('0x46')](_0x22c853['query'][_0x116c('0x46')]));_0x2cf2ec[_0x116c('0x44')]=_0x2cf2ec[_0x116c('0x44')][_0x116c('0x47')]?_0x2cf2ec[_0x116c('0x44')]:_0x501587[_0x116c('0x42')];if(!_0x22c853[_0x116c('0x43')][_0x116c('0x48')](_0x116c('0x49'))){_0x2cf2ec[_0x116c('0x30')]=qs[_0x116c('0x30')](_0x22c853[_0x116c('0x43')][_0x116c('0x30')]);_0x2cf2ec[_0x116c('0x32')]=qs[_0x116c('0x32')](_0x22c853[_0x116c('0x43')]['offset']);}_0x2cf2ec[_0x116c('0x4a')]=qs[_0x116c('0x4b')](_0x22c853[_0x116c('0x43')]['sort']);_0x2cf2ec['where']=qs[_0x116c('0x4c')](_[_0x116c('0x4d')](_0x22c853[_0x116c('0x43')],_0x501587['filters']),_0x40aa63);if(_0x22c853[_0x116c('0x43')][_0x116c('0x4e')]){_0x2cf2ec['where']=_[_0x116c('0x4f')](_0x2cf2ec[_0x116c('0x50')],{'$or':_['map'](_0x40aa63,function(_0x1416b7){if(_0x1416b7['type']!==_0x116c('0x51')){var _0x12ed1c={};_0x12ed1c[_0x1416b7[_0x116c('0x3b')]]={'$like':'%'+_0x22c853[_0x116c('0x43')][_0x116c('0x4e')]+'%'};return _0x12ed1c;}})});}_0x2cf2ec=_['merge']({},_0x2cf2ec,_0x22c853[_0x116c('0x52')]);var _0x3bf512={'where':_0x2cf2ec[_0x116c('0x50')]};return db[_0x116c('0x53')]['count'](_0x3bf512)[_0x116c('0x20')](function(_0x3b702b){_0x5d1b20[_0x116c('0x31')]=_0x3b702b;if(_0x22c853[_0x116c('0x43')][_0x116c('0x54')]){_0x2cf2ec[_0x116c('0x55')]=[{'all':!![]}];}return db[_0x116c('0x53')][_0x116c('0x56')](_0x2cf2ec);})['then'](function(_0x59e79b){_0x5d1b20['rows']=_0x59e79b;return _0x5d1b20;})[_0x116c('0x20')](respondWithFilteredResult(_0x4fb7a5,_0x2cf2ec))[_0x116c('0x2a')](handleError(_0x4fb7a5,null));};exports[_0x116c('0x57')]=function(_0x4071fd,_0x166e5a){var _0x229d43={'raw':![],'where':{'id':_0x4071fd['params']['id']}},_0x3c4bbc={};_0x3c4bbc[_0x116c('0x42')]=_[_0x116c('0x58')](db[_0x116c('0x53')][_0x116c('0x3f')]);_0x3c4bbc[_0x116c('0x43')]=_[_0x116c('0x58')](_0x4071fd[_0x116c('0x43')]);_0x3c4bbc[_0x116c('0x4c')]=_[_0x116c('0x45')](_0x3c4bbc[_0x116c('0x42')],_0x3c4bbc['query']);_0x229d43[_0x116c('0x44')]=_[_0x116c('0x45')](_0x3c4bbc['model'],qs[_0x116c('0x46')](_0x4071fd['query'][_0x116c('0x46')]));_0x229d43[_0x116c('0x44')]=_0x229d43['attributes']['length']?_0x229d43['attributes']:_0x3c4bbc[_0x116c('0x42')];if(_0x4071fd[_0x116c('0x43')][_0x116c('0x54')]){_0x229d43[_0x116c('0x55')]=[{'all':!![]}];}_0x229d43=_['merge']({},_0x229d43,_0x4071fd[_0x116c('0x52')]);return db[_0x116c('0x53')][_0x116c('0x59')](_0x229d43)['then'](handleEntityNotFound(_0x166e5a,null))[_0x116c('0x20')](respondWithResult(_0x166e5a,null))['catch'](handleError(_0x166e5a,null));};exports[_0x116c('0x38')]=function(_0x34d12e,_0x3a916d){if(_0x34d12e[_0x116c('0x5a')]['id']){delete _0x34d12e['body']['id'];}return db[_0x116c('0x53')][_0x116c('0x59')]({'where':{'id':_0x34d12e['params']['id']}})[_0x116c('0x20')](handleEntityNotFound(_0x3a916d,null))[_0x116c('0x20')](saveUpdates(_0x34d12e[_0x116c('0x5a')],null))[_0x116c('0x20')](respondWithResult(_0x3a916d,null))[_0x116c('0x2a')](handleError(_0x3a916d,null));};exports[_0x116c('0x5b')]=function(_0x292667,_0x591665,_0x1d6209){if(_0x292667[_0x116c('0x5c')]&&_0x292667['file']['filename']){_0x292667[_0x116c('0x5a')]['logo']=_0x292667[_0x116c('0x5c')][_0x116c('0x5d')];}return db[_0x116c('0x53')][_0x116c('0x59')]({'where':{'id':_0x292667[_0x116c('0x5e')]['id']}})[_0x116c('0x20')](handleEntityNotFound(_0x591665,null))[_0x116c('0x20')](saveUpdates(_0x292667['body'],null))[_0x116c('0x20')](respondWithResult(_0x591665,null))[_0x116c('0x2a')](handleError(_0x591665,null));};exports[_0x116c('0x5f')]=function(_0x552c23,_0x20b54d,_0x542c53){if(_0x552c23['file']&&_0x552c23[_0x116c('0x5c')][_0x116c('0x5d')]){_0x552c23[_0x116c('0x5a')]['loginLogo']=_0x552c23['file'][_0x116c('0x5d')];}return db[_0x116c('0x53')][_0x116c('0x59')]({'where':{'id':_0x552c23[_0x116c('0x5e')]['id']}})[_0x116c('0x20')](handleEntityNotFound(_0x20b54d,null))[_0x116c('0x20')](saveUpdates(_0x552c23[_0x116c('0x5a')],null))[_0x116c('0x20')](respondWithResult(_0x20b54d,null))[_0x116c('0x2a')](handleError(_0x20b54d,null));};var utilLicense=require(_0x116c('0x1b'));exports[_0x116c('0x60')]=function(_0x2c8977,_0x2a8d6a,_0x517245){var _0x16ea42='server/files/images/logos';var _0x1fd5cc={'custom':![]};return utilLicense['getLicense']()[_0x116c('0x20')](function(_0x2dd76a){if(_0x2dd76a){_0x1fd5cc=_0x2dd76a;}return db[_0x116c('0x53')][_0x116c('0x59')]({'where':{'id':_0x2c8977[_0x116c('0x5e')]['id']},'attributes':['logo',_0x116c('0x61'),_0x116c('0x62'),'favicon',_0x116c('0x63'),_0x116c('0x64'),_0x116c('0x65'),_0x116c('0x66')],'raw':!![]});})[_0x116c('0x20')](handleEntityNotFound(_0x2a8d6a,null))[_0x116c('0x20')](function(_0x523d6b){if(_0x523d6b){var _0x5f1325=_0x523d6b['logo']&&fs[_0x116c('0x67')](path[_0x116c('0x68')](config['root'],_0x16ea42,_[_0x116c('0x69')](_0x523d6b[_0x116c('0x6a')])))?path['join'](config[_0x116c('0x6b')],_0x16ea42,_[_0x116c('0x69')](_0x523d6b[_0x116c('0x6a')])):path[_0x116c('0x68')](config[_0x116c('0x6b')],_0x16ea42,_[_0x116c('0x69')]('default_logo.svg'));var _0x366817=_0x116c('0x6c')+_['upperFirst'](_0x116c('0x6a'));if(_0x523d6b[_0x366817]||!_0x1fd5cc[_0x116c('0x6d')]){_0x5f1325=path[_0x116c('0x68')](config[_0x116c('0x6b')],_0x16ea42,_['toLower'](_0x116c('0x6e')));}if(!fs['existsSync'](_0x5f1325)){throw new db[(_0x116c('0x6f'))][(_0x116c('0x70'))](_[_0x116c('0x71')](_0x116c('0x6a'))+_0x116c('0x72'));}return _0x2a8d6a[_0x116c('0x73')](_0x5f1325);}})['catch'](handleError(_0x2a8d6a,null));};var utilLicense=require(_0x116c('0x1b'));exports['getLogoLogin']=function(_0x2c58e0,_0x5941e9,_0x4ba1b4){var _0x39eb7a=_0x116c('0x74');var _0xbf4697={'custom':![]};return utilLicense[_0x116c('0x75')]()[_0x116c('0x20')](function(_0x349fb6){if(_0x349fb6){_0xbf4697=_0x349fb6;}return db[_0x116c('0x53')][_0x116c('0x59')]({'where':{'id':_0x2c58e0[_0x116c('0x5e')]['id']},'attributes':['logo','loginLogo','preferred',_0x116c('0x76'),_0x116c('0x63'),_0x116c('0x64'),_0x116c('0x65'),_0x116c('0x66')],'raw':!![]});})[_0x116c('0x20')](handleEntityNotFound(_0x5941e9,null))[_0x116c('0x20')](function(_0x1af6d5){if(_0x1af6d5){var _0x7bb221=_0x1af6d5[_0x116c('0x61')]&&fs[_0x116c('0x67')](path['join'](config[_0x116c('0x6b')],_0x39eb7a,_[_0x116c('0x69')](_0x1af6d5['loginLogo'])))?path['join'](config['root'],_0x39eb7a,_[_0x116c('0x69')](_0x1af6d5[_0x116c('0x61')])):path['join'](config[_0x116c('0x6b')],_0x39eb7a,_[_0x116c('0x69')](_0x116c('0x77')));var _0x42ba01=_0x116c('0x6c')+_[_0x116c('0x71')](_0x116c('0x61'));if(_0x1af6d5[_0x42ba01]||!_0xbf4697[_0x116c('0x6d')]){_0x7bb221=path[_0x116c('0x68')](config['root'],_0x39eb7a,_[_0x116c('0x69')](_0x116c('0x77')));}if(!fs[_0x116c('0x67')](_0x7bb221)){throw new db[(_0x116c('0x6f'))][(_0x116c('0x70'))](_[_0x116c('0x71')]('loginLogo')+'\x20not\x20found');}return _0x5941e9[_0x116c('0x73')](_0x7bb221);}})[_0x116c('0x2a')](handleError(_0x5941e9,null));};exports[_0x116c('0x78')]=function(_0x470677,_0x15a02a){return db[_0x116c('0x53')]['find']({'where':{'id':_0x470677[_0x116c('0x5e')]['id']},'attributes':['securePassword']})[_0x116c('0x20')](respondWithResult(_0x15a02a,null))[_0x116c('0x2a')](handleError(_0x15a02a,null));};exports[_0x116c('0x79')]=function(_0x3b2eab,_0x256ead,_0x15bc45){if(_0x3b2eab[_0x116c('0x5c')]&&_0x3b2eab[_0x116c('0x5c')][_0x116c('0x5d')]){_0x3b2eab['body'][_0x116c('0x62')]=_0x3b2eab['file'][_0x116c('0x5d')];}return db[_0x116c('0x53')]['find']({'where':{'id':_0x3b2eab[_0x116c('0x5e')]['id']}})[_0x116c('0x20')](handleEntityNotFound(_0x256ead,null))[_0x116c('0x20')](saveUpdates(_0x3b2eab[_0x116c('0x5a')],null))[_0x116c('0x20')](respondWithResult(_0x256ead,null))[_0x116c('0x2a')](handleError(_0x256ead,null));};var utilLicense=require(_0x116c('0x1b'));exports[_0x116c('0x7a')]=function(_0x40827a,_0x53c48b,_0x442462){var _0x190e93=_0x116c('0x74');var _0x43a8af={'custom':![]};return utilLicense[_0x116c('0x75')]()['then'](function(_0x17d62c){if(_0x17d62c){_0x43a8af=_0x17d62c;}return db[_0x116c('0x53')][_0x116c('0x59')]({'where':{'id':_0x40827a[_0x116c('0x5e')]['id']},'attributes':[_0x116c('0x6a'),'loginLogo',_0x116c('0x62'),_0x116c('0x76'),_0x116c('0x63'),_0x116c('0x64'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x116c('0x20')](handleEntityNotFound(_0x53c48b,null))[_0x116c('0x20')](function(_0x44cdd9){if(_0x44cdd9){var _0x1e698c=_0x44cdd9['preferred']&&fs[_0x116c('0x67')](path[_0x116c('0x68')](config['root'],_0x190e93,_[_0x116c('0x69')](_0x44cdd9[_0x116c('0x62')])))?path[_0x116c('0x68')](config[_0x116c('0x6b')],_0x190e93,_[_0x116c('0x69')](_0x44cdd9[_0x116c('0x62')])):path['join'](config['root'],_0x190e93,_[_0x116c('0x69')](_0x116c('0x7b')));var _0x36f3c1=_0x116c('0x6c')+_[_0x116c('0x71')](_0x116c('0x62'));if(_0x44cdd9[_0x36f3c1]||!_0x43a8af[_0x116c('0x6d')]||!_0x43a8af['preferred']){_0x1e698c=path[_0x116c('0x68')](config[_0x116c('0x6b')],_0x190e93,_['toLower'](_0x116c('0x7b')));}if(!fs[_0x116c('0x67')](_0x1e698c)){throw new db[(_0x116c('0x6f'))][(_0x116c('0x70'))](_['upperFirst'](_0x116c('0x62'))+_0x116c('0x72'));}return _0x53c48b[_0x116c('0x73')](_0x1e698c);}})[_0x116c('0x2a')](handleError(_0x53c48b,null));};exports[_0x116c('0x7c')]=function(_0x165891,_0x229292,_0x5a5fcd){if(_0x165891['file']&&_0x165891[_0x116c('0x5c')][_0x116c('0x5d')]){_0x165891['body'][_0x116c('0x76')]=_0x165891[_0x116c('0x5c')][_0x116c('0x5d')];}return db['Setting'][_0x116c('0x59')]({'where':{'id':_0x165891[_0x116c('0x5e')]['id']}})[_0x116c('0x20')](handleEntityNotFound(_0x229292,null))['then'](saveUpdates(_0x165891[_0x116c('0x5a')],null))[_0x116c('0x20')](respondWithResult(_0x229292,null))[_0x116c('0x2a')](handleError(_0x229292,null));};var utilLicense=require(_0x116c('0x1b'));exports[_0x116c('0x7d')]=function(_0x5da792,_0x139ac4,_0x4eb365){var _0x180348=_0x116c('0x74');var _0x2ab64a={'custom':![]};return utilLicense[_0x116c('0x75')]()['then'](function(_0x28eb7c){if(_0x28eb7c){_0x2ab64a=_0x28eb7c;}return db['Setting'][_0x116c('0x59')]({'where':{'id':_0x5da792[_0x116c('0x5e')]['id']},'attributes':[_0x116c('0x6a'),_0x116c('0x61'),'preferred',_0x116c('0x76'),'defaultLogo',_0x116c('0x64'),_0x116c('0x65'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x139ac4,null))['then'](function(_0x30c29f){if(_0x30c29f){var _0x2f9d43=_0x30c29f[_0x116c('0x76')]&&fs[_0x116c('0x67')](path[_0x116c('0x68')](config[_0x116c('0x6b')],_0x180348,_[_0x116c('0x69')](_0x30c29f['favicon'])))?path['join'](config[_0x116c('0x6b')],_0x180348,_['toLower'](_0x30c29f[_0x116c('0x76')])):path['join'](config[_0x116c('0x6b')],_0x180348,_[_0x116c('0x69')](_0x116c('0x7e')));var _0x486cc1=_0x116c('0x6c')+_['upperFirst'](_0x116c('0x76'));if(_0x30c29f[_0x486cc1]||!_0x2ab64a['custom']){_0x2f9d43=path[_0x116c('0x68')](config[_0x116c('0x6b')],_0x180348,_[_0x116c('0x69')](_0x116c('0x7e')));}if(!fs[_0x116c('0x67')](_0x2f9d43)){throw new db[(_0x116c('0x6f'))]['ValidationError'](_[_0x116c('0x71')]('favicon')+_0x116c('0x72'));}return _0x139ac4[_0x116c('0x73')](_0x2f9d43);}})[_0x116c('0x2a')](handleError(_0x139ac4,null));};exports[_0x116c('0x7f')]=function(_0x3e2c19,_0x5b778d){var _0x5e740f={'offset':moment()[_0x116c('0x80')]()};_0x5e740f[_0x116c('0x81')]=moment()[_0x116c('0x80')](_0x5e740f['offset'])[_0x116c('0x82')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x5b778d[_0x116c('0x2c')](0xc8)[_0x116c('0x3c')](_0x5e740f);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 64c3134..5a3f1cb 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(_0x130705,_0x2d266b){var _0x1fa991=function(_0x395639){while(--_0x395639){_0x130705['push'](_0x130705['shift']());}};_0x1fa991(++_0x2d266b);}(_0x7217,0x19e));var _0x7721=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x7217[_0x49ca18];return _0x145d54;};'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 _0x9957=['exports','define','Setting','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./setting.attributes'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 1cfcaa7..ff68c40 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 _0x2f04=['request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ShowSetting','Setting','find','raw','options','where','attributes','map','include','model','lodash','moment','rpc','../../config/environment','client','http'];(function(_0x57bb74,_0x4755ac){var _0x44e0eb=function(_0x19e800){while(--_0x19e800){_0x57bb74['push'](_0x57bb74['shift']());}};_0x44e0eb(++_0x4755ac);}(_0x2f04,0x6a));var _0x42f0=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x2f04[_0x29d915];return _0x160f86;};'use strict';var _=require(_0x42f0('0x0'));var util=require('util');var moment=require(_0x42f0('0x1'));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('../../config/logger')(_0x42f0('0x2'));var config=require(_0x42f0('0x3'));var jayson=require('jayson/promise');var client=jayson[_0x42f0('0x4')][_0x42f0('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x189514,_0x4bbdc4,_0x1e73bd){return new BPromise(function(_0x176a08,_0x83dcdf){return client[_0x42f0('0x6')](_0x189514,_0x1e73bd)[_0x42f0('0x7')](function(_0x29da85){logger[_0x42f0('0x8')](_0x42f0('0x9'),_0x4bbdc4,_0x42f0('0xa'));logger[_0x42f0('0xb')](_0x42f0('0xc'),_0x4bbdc4,_0x42f0('0xa'),JSON[_0x42f0('0xd')](_0x29da85));if(_0x29da85['error']){if(_0x29da85[_0x42f0('0xe')][_0x42f0('0xf')]===0x1f4){logger[_0x42f0('0xe')](_0x42f0('0x9'),_0x4bbdc4,_0x29da85[_0x42f0('0xe')][_0x42f0('0x10')]);return _0x83dcdf(_0x29da85[_0x42f0('0xe')][_0x42f0('0x10')]);}logger[_0x42f0('0xe')]('Setting,\x20%s,\x20%s',_0x4bbdc4,_0x29da85[_0x42f0('0xe')][_0x42f0('0x10')]);return _0x176a08(_0x29da85[_0x42f0('0xe')][_0x42f0('0x10')]);}else{logger[_0x42f0('0x8')](_0x42f0('0x9'),_0x4bbdc4,_0x42f0('0xa'));_0x176a08(_0x29da85['result'][_0x42f0('0x10')]);}})[_0x42f0('0x11')](function(_0x256ad9){logger['error']('Setting,\x20%s,\x20%s',_0x4bbdc4,_0x256ad9);_0x83dcdf(_0x256ad9);});});}exports[_0x42f0('0x12')]=function(_0x583dc7){var _0x5e66ac=this;return new Promise(function(_0x2d19d1,_0x2e8d54){return db[_0x42f0('0x13')][_0x42f0('0x14')]({'raw':_0x583dc7['options']?_0x583dc7['options'][_0x42f0('0x15')]===undefined?!![]:![]:!![],'where':_0x583dc7[_0x42f0('0x16')]?_0x583dc7['options'][_0x42f0('0x17')]||null:null,'attributes':_0x583dc7[_0x42f0('0x16')]?_0x583dc7[_0x42f0('0x16')][_0x42f0('0x18')]||null:null,'include':_0x583dc7[_0x42f0('0x16')]?_0x583dc7[_0x42f0('0x16')]['include']?_[_0x42f0('0x19')](_0x583dc7[_0x42f0('0x16')][_0x42f0('0x1a')],function(_0x2d5f4c){return{'model':db[_0x2d5f4c[_0x42f0('0x1b')]],'as':_0x2d5f4c['as'],'attributes':_0x2d5f4c[_0x42f0('0x18')],'include':_0x2d5f4c[_0x42f0('0x1a')]?_['map'](_0x2d5f4c[_0x42f0('0x1a')],function(_0x2a4709){return{'model':db[_0x2a4709[_0x42f0('0x1b')]],'as':_0x2a4709['as'],'attributes':_0x2a4709[_0x42f0('0x18')],'include':_0x2a4709[_0x42f0('0x1a')]?_[_0x42f0('0x19')](_0x2a4709[_0x42f0('0x1a')],function(_0x43346d){return{'model':db[_0x43346d['model']],'as':_0x43346d['as'],'attributes':_0x43346d['attributes']};}):[]};}):[]};}):[]:[]})[_0x42f0('0x7')](function(_0x55b901){logger[_0x42f0('0x8')](_0x42f0('0x12'),_0x583dc7);logger[_0x42f0('0xb')](_0x42f0('0x12'),_0x583dc7,JSON[_0x42f0('0xd')](_0x55b901));_0x2d19d1(_0x55b901);})[_0x42f0('0x11')](function(_0x311204){logger[_0x42f0('0xe')]('ShowSetting',_0x311204[_0x42f0('0x10')],_0x583dc7);_0x2e8d54(_0x5e66ac[_0x42f0('0xe')](0x1f4,_0x311204[_0x42f0('0x10')]));});});}; \ No newline at end of file +var _0x7410=['info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','ShowSetting','Setting','find','options','raw','where','include','map','model','attributes','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x33001e,_0x332e19){var _0x44de3d=function(_0xa42f16){while(--_0xa42f16){_0x33001e['push'](_0x33001e['shift']());}};_0x44de3d(++_0x332e19);}(_0x7410,0x174));var _0x0741=function(_0x3f634a,_0x86961c){_0x3f634a=_0x3f634a-0x0;var _0x54f54d=_0x7410[_0x3f634a];return _0x54f54d;};'use strict';var _=require('lodash');var util=require(_0x0741('0x0'));var moment=require(_0x0741('0x1'));var BPromise=require(_0x0741('0x2'));var rs=require(_0x0741('0x3'));var fs=require('fs');var Redis=require(_0x0741('0x4'));var db=require(_0x0741('0x5'))['db'];var utils=require(_0x0741('0x6'));var logger=require('../../config/logger')(_0x0741('0x7'));var config=require(_0x0741('0x8'));var jayson=require(_0x0741('0x9'));var client=jayson['client'][_0x0741('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1765ee,_0x39af26,_0x1b2e34){return new BPromise(function(_0x35f67b,_0x31abde){return client[_0x0741('0xb')](_0x1765ee,_0x1b2e34)['then'](function(_0x286269){logger[_0x0741('0xc')](_0x0741('0xd'),_0x39af26,'request\x20sent');logger[_0x0741('0xe')](_0x0741('0xf'),_0x39af26,_0x0741('0x10'),JSON[_0x0741('0x11')](_0x286269));if(_0x286269[_0x0741('0x12')]){if(_0x286269[_0x0741('0x12')]['code']===0x1f4){logger['error'](_0x0741('0xd'),_0x39af26,_0x286269[_0x0741('0x12')]['message']);return _0x31abde(_0x286269[_0x0741('0x12')][_0x0741('0x13')]);}logger[_0x0741('0x12')](_0x0741('0xd'),_0x39af26,_0x286269['error']['message']);return _0x35f67b(_0x286269['error'][_0x0741('0x13')]);}else{logger['info'](_0x0741('0xd'),_0x39af26,_0x0741('0x10'));_0x35f67b(_0x286269[_0x0741('0x14')][_0x0741('0x13')]);}})[_0x0741('0x15')](function(_0x46e474){logger[_0x0741('0x12')](_0x0741('0xd'),_0x39af26,_0x46e474);_0x31abde(_0x46e474);});});}exports[_0x0741('0x16')]=function(_0x465452){var _0x203543=this;return new Promise(function(_0x11dae3,_0xfd99ed){return db[_0x0741('0x17')][_0x0741('0x18')]({'raw':_0x465452[_0x0741('0x19')]?_0x465452[_0x0741('0x19')][_0x0741('0x1a')]===undefined?!![]:![]:!![],'where':_0x465452[_0x0741('0x19')]?_0x465452[_0x0741('0x19')][_0x0741('0x1b')]||null:null,'attributes':_0x465452['options']?_0x465452[_0x0741('0x19')]['attributes']||null:null,'include':_0x465452[_0x0741('0x19')]?_0x465452[_0x0741('0x19')][_0x0741('0x1c')]?_[_0x0741('0x1d')](_0x465452[_0x0741('0x19')][_0x0741('0x1c')],function(_0x413650){return{'model':db[_0x413650[_0x0741('0x1e')]],'as':_0x413650['as'],'attributes':_0x413650['attributes'],'include':_0x413650[_0x0741('0x1c')]?_[_0x0741('0x1d')](_0x413650[_0x0741('0x1c')],function(_0x452081){return{'model':db[_0x452081['model']],'as':_0x452081['as'],'attributes':_0x452081[_0x0741('0x1f')],'include':_0x452081[_0x0741('0x1c')]?_[_0x0741('0x1d')](_0x452081['include'],function(_0x2e3baa){return{'model':db[_0x2e3baa[_0x0741('0x1e')]],'as':_0x2e3baa['as'],'attributes':_0x2e3baa['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ec58f){logger['info']('ShowSetting',_0x465452);logger[_0x0741('0xe')](_0x0741('0x16'),_0x465452,JSON[_0x0741('0x11')](_0x2ec58f));_0x11dae3(_0x2ec58f);})[_0x0741('0x15')](function(_0x1500ce){logger[_0x0741('0x12')](_0x0741('0x16'),_0x1500ce['message'],_0x465452);_0xfd99ed(_0x203543['error'](0x1f4,_0x1500ce['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index a3301b9..f43595d 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 _0xf494=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','getAgents','post','/:id/applications','addApplications','/:id/send','send','/:id/users','put','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf494,0x1c6));var _0x4f49=function(_0x1e685f,_0x2eda9c){_0x1e685f=_0x1e685f-0x0;var _0x1457cc=_0xf494[_0x1e685f];return _0x1457cc;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f49('0x3'));var router=express[_0x4f49('0x4')]();var fs_extra=require(_0x4f49('0x5'));var auth=require(_0x4f49('0x6'));var interaction=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var controller=require(_0x4f49('0x9'));router[_0x4f49('0xa')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0xc')]);router[_0x4f49('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x4f49('0xd')]);router[_0x4f49('0xa')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0xf')]);router[_0x4f49('0xa')](_0x4f49('0x10'),auth[_0x4f49('0xb')](),controller['getDispositions']);router[_0x4f49('0xa')](_0x4f49('0x11'),auth['isAuthenticated'](),controller[_0x4f49('0x12')]);router['get']('/:id/applications',auth[_0x4f49('0xb')](),controller[_0x4f49('0x13')]);router['get'](_0x4f49('0x14'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x15')]);router[_0x4f49('0xa')](_0x4f49('0x16'),controller[_0x4f49('0x17')]);router[_0x4f49('0xa')]('/:id/users',auth[_0x4f49('0xb')](),controller[_0x4f49('0x18')]);router[_0x4f49('0x19')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4f49('0x19')](_0x4f49('0x10'),auth[_0x4f49('0xb')](),controller['addDisposition']);router[_0x4f49('0x19')](_0x4f49('0x11'),auth[_0x4f49('0xb')](),controller['addAnswer']);router['post']('/:id/notify',controller['notify']);router[_0x4f49('0x19')](_0x4f49('0x1a'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x1b')]);router['post'](_0x4f49('0x1c'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x1d')]);router[_0x4f49('0x19')](_0x4f49('0x16'),controller['status']);router[_0x4f49('0x19')](_0x4f49('0x1e'),auth[_0x4f49('0xb')](),controller['addAgents']);router[_0x4f49('0x1f')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x20')]);router[_0x4f49('0x21')](_0x4f49('0xe'),auth['isAuthenticated'](),controller['destroy']);router[_0x4f49('0x21')](_0x4f49('0x10'),auth['isAuthenticated'](),controller[_0x4f49('0x22')]);router[_0x4f49('0x21')](_0x4f49('0x11'),auth['isAuthenticated'](),controller[_0x4f49('0x23')]);router[_0x4f49('0x21')](_0x4f49('0x1e'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x24')]);module[_0x4f49('0x25')]=router; \ No newline at end of file +var _0xc4aa=['statusGet','/:id/users','getAgents','post','addDisposition','addAnswer','notify','addApplications','/:id/send','send','status','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status'];(function(_0x28ddb2,_0x108109){var _0x19c08c=function(_0x168f8c){while(--_0x168f8c){_0x28ddb2['push'](_0x28ddb2['shift']());}};_0x19c08c(++_0x108109);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xc4aa[_0x3b0731];return _0x4204d7;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['describe']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['get'](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xf')]);router['get'](_0xac4a('0x10'),auth['isAuthenticated'](),controller[_0xac4a('0x11')]);router['get'](_0xac4a('0x12'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x13')]);router['get'](_0xac4a('0x14'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x15')]);router[_0xac4a('0x8')](_0xac4a('0x16'),controller[_0xac4a('0x17')]);router[_0xac4a('0x8')](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x19')]);router[_0xac4a('0x1a')]('/',auth[_0xac4a('0x9')](),controller['create']);router[_0xac4a('0x1a')](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x1b')]);router[_0xac4a('0x1a')](_0xac4a('0x10'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x1c')]);router['post']('/:id/notify',controller[_0xac4a('0x1d')]);router[_0xac4a('0x1a')](_0xac4a('0x12'),auth['isAuthenticated'](),controller[_0xac4a('0x1e')]);router[_0xac4a('0x1a')](_0xac4a('0x1f'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x20')]);router[_0xac4a('0x1a')](_0xac4a('0x16'),controller[_0xac4a('0x21')]);router['post'](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller['addAgents']);router[_0xac4a('0x22')](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x23')]);router['delete'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x24')]);router[_0xac4a('0x25')](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x26')]);router[_0xac4a('0x25')](_0xac4a('0x10'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x27')]);router[_0xac4a('0x25')](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x28')]);module[_0xac4a('0x29')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index c19dd4c..eb580de 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 _0xc069=['clicksend','plivo','bandwidth','csc','intelepeer','ENUM','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','generate','skebby'];(function(_0x291f91,_0x15e63f){var _0x2a2f8f=function(_0x3f0264){while(--_0x3f0264){_0x291f91['push'](_0x291f91['shift']());}};_0x2a2f8f(++_0x15e63f);}(_0xc069,0x117));var _0x9c06=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc069[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x9c06('0x0'));var rs=require(_0x9c06('0x1'));module[_0x9c06('0x2')]={'name':{'type':Sequelize[_0x9c06('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x9c06('0x3')],'defaultValue':function(){return rs[_0x9c06('0x4')]();}},'phone':{'type':Sequelize[_0x9c06('0x3')]},'type':{'type':Sequelize['ENUM']('twilio',_0x9c06('0x5'),'connectel',_0x9c06('0x6'),_0x9c06('0x7'),'clickatell',_0x9c06('0x8'),_0x9c06('0x9'),'infobip',_0x9c06('0xa'))},'accountSid':{'type':Sequelize[_0x9c06('0x3')]},'authId':{'type':Sequelize[_0x9c06('0x3')]},'authToken':{'type':Sequelize[_0x9c06('0x3')]},'smsMethod':{'type':Sequelize[_0x9c06('0xb')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x9c06('0x3')]},'apiKey':{'type':Sequelize[_0x9c06('0x3')]},'applicationId':{'type':Sequelize[_0x9c06('0x3')]},'accountId':{'type':Sequelize[_0x9c06('0x3')]},'senderString':{'type':Sequelize[_0x9c06('0x3')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x9c06('0x3')]},'notificationTemplate':{'type':Sequelize[_0x9c06('0xc')],'defaultValue':function(){return _0x9c06('0xd');}},'notificationSound':{'type':Sequelize[_0x9c06('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9c06('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9c06('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9c06('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9c06('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9c06('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x9c06('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x9c06('0x10')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0xf428ac){if(!_0xf428ac)this[_0x9c06('0x11')](_0x9c06('0x12'),null);this[_0x9c06('0x11')]('mandatoryDisposition',_0xf428ac);}}}; \ No newline at end of file +var _0xcef1=['randomstring','exports','STRING','name','generate','ENUM','connectel','clicksend','plivo','clickatell','bandwidth','csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xcef1,0x17f));var _0x1cef=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xcef1[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0x1cef('0x0'));var rs=require(_0x1cef('0x1'));module[_0x1cef('0x2')]={'name':{'type':Sequelize[_0x1cef('0x3')],'unique':_0x1cef('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x1cef('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x1cef('0x3')],'defaultValue':function(){return rs[_0x1cef('0x5')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x1cef('0x6')]('twilio','skebby',_0x1cef('0x7'),_0x1cef('0x8'),_0x1cef('0x9'),_0x1cef('0xa'),_0x1cef('0xb'),_0x1cef('0xc'),_0x1cef('0xd'),_0x1cef('0xe'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x1cef('0x3')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x1cef('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0x1cef('0x3')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x1cef('0x3')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x1cef('0x3')]},'senderString':{'type':Sequelize[_0x1cef('0x3')]},'deliveryReport':{'type':Sequelize[_0x1cef('0xf')],'defaultValue':![]},'description':{'type':Sequelize[_0x1cef('0x3')]},'notificationTemplate':{'type':Sequelize[_0x1cef('0x10')],'defaultValue':function(){return _0x1cef('0x11');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1cef('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1cef('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1cef('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1cef('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1cef('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x1cef('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x1cef('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x1cef('0xf')],'defaultValue':![],'comment':_0x1cef('0x14'),'set':function(_0x1e7e2e){if(!_0x1e7e2e)this[_0x1cef('0x15')](_0x1cef('0x16'),null);this[_0x1cef('0x15')](_0x1cef('0x17'),_0x1e7e2e);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index a763b56..be1e4bb 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 _0xbc3a=['fullname','internal','Tags','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','List','spread','dataValues','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','statusInt','requestid','status_code','message_id','groupName','redif','DELIVERED','error_code','clickatell','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','csc','message-id','addAgents','omit','emit','removeAgents','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsAccount.socket','register','client','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','save','update','destroy','get','SmsAccounts','UserProfileResource','name','send','index','mandatoryDispositionPause','map','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','VIRTUAL','merge','SmsAccount','includeAll','include','findAll','rows','show','params','Pause','options','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','SmsAccountId','Disposition','getDispositions','keys','rawAttributes','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','sms','SmsApplication','Applications','account','orderBy','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','mobile','twilio','From','Body','MessageSid','from','sender','text','connectel','clicksend','messageId','Text','MessageUUID','infobip','results','originatingAddress','replyMessageId','bandwidth','intelepeer','refid','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','Contacts','DESC','contact','SmsInteraction','interaction','autoclose','applications','close','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','startRouting','entity\x20found','Content-Type','\x0a','addApplications','sequelize','transaction','findAndCountAll','getApplications','Contact','Owner'];(function(_0x3ff601,_0x565c8){var _0x168e2f=function(_0x5b0645){while(--_0x5b0645){_0x3ff601['push'](_0x3ff601['shift']());}};_0x168e2f(++_0x565c8);}(_0xbc3a,0xfd));var _0xabc3=function(_0x53d905,_0x220509){_0x53d905=_0x53d905-0x0;var _0x2d8d0f=_0xbc3a[_0x53d905];return _0x2d8d0f;};'use strict';var emlformat=require(_0xabc3('0x0'));var rimraf=require(_0xabc3('0x1'));var zipdir=require(_0xabc3('0x2'));var jsonpatch=require(_0xabc3('0x3'));var rp=require(_0xabc3('0x4'));var moment=require(_0xabc3('0x5'));var BPromise=require(_0xabc3('0x6'));var Mustache=require(_0xabc3('0x7'));var util=require(_0xabc3('0x8'));var path=require(_0xabc3('0x9'));var sox=require(_0xabc3('0xa'));var csv=require('to-csv');var ejs=require(_0xabc3('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xabc3('0xc'));var squel=require(_0xabc3('0xd'));var crypto=require(_0xabc3('0xe'));var jsforce=require(_0xabc3('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xabc3('0x10'));var querystring=require(_0xabc3('0x11'));var Papa=require(_0xabc3('0x12'));var Redis=require(_0xabc3('0x13'));var authService=require(_0xabc3('0x14'));var qs=require(_0xabc3('0x15'));var as=require(_0xabc3('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xabc3('0x17'))(_0xabc3('0x18'));var utils=require('../../config/utils');var config=require(_0xabc3('0x19'));var licenseUtil=require(_0xabc3('0x1a'));var db=require(_0xabc3('0x1b'))['db'];config[_0xabc3('0x1c')]=_[_0xabc3('0x1d')](config[_0xabc3('0x1c')],{'host':_0xabc3('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xabc3('0x1c')]));require(_0xabc3('0x1f'))[_0xabc3('0x20')](socket);var jayson=require('jayson/promise');var client=jayson[_0xabc3('0x21')]['http']({'port':0x232c});function respondWithRpcPromise(_0x5969f1,_0x35e17a,_0x36e7ab,_0x53b63a){return new BPromise(function(_0x579c6c,_0x16d065){var _0x3ab39e=_0x53b63a||client;return _0x3ab39e['request'](_0x5969f1,_0x36e7ab)[_0xabc3('0x22')](function(_0x4d5190){logger[_0xabc3('0x23')](_0xabc3('0x24'),_0x35e17a,_0xabc3('0x25'));logger[_0xabc3('0x26')](_0xabc3('0x27'),_0x35e17a,_0xabc3('0x25'),JSON['stringify'](_0x4d5190));if(_0x4d5190['error']){if(_0x4d5190[_0xabc3('0x28')]['code']===0x1f4){logger[_0xabc3('0x28')](_0xabc3('0x24'),_0x35e17a,_0x4d5190[_0xabc3('0x28')][_0xabc3('0x29')]);return _0x16d065(_0x4d5190[_0xabc3('0x28')][_0xabc3('0x29')]);}logger[_0xabc3('0x28')](_0xabc3('0x24'),_0x35e17a,_0x4d5190['error']['message']);return _0x579c6c(_0x4d5190[_0xabc3('0x28')][_0xabc3('0x29')]);}else{logger['info'](_0xabc3('0x24'),_0x35e17a,_0xabc3('0x25'));_0x579c6c(_0x4d5190['result'][_0xabc3('0x29')]);}})[_0xabc3('0x2a')](function(_0x25a169){logger[_0xabc3('0x28')](_0xabc3('0x24'),_0x35e17a,_0x25a169);_0x16d065(_0x25a169);});});}function respondWithStatusCode(_0x50c0bd,_0xedac3f){_0xedac3f=_0xedac3f||0xcc;return function(_0xc07954){if(_0xc07954){return _0x50c0bd[_0xabc3('0x2b')](_0xedac3f);}return _0x50c0bd[_0xabc3('0x2c')](_0xedac3f)[_0xabc3('0x2d')]();};}function respondWithResult(_0x4a77a5,_0x467427){_0x467427=_0x467427||0xc8;return function(_0xee312c){if(_0xee312c){return _0x4a77a5[_0xabc3('0x2c')](_0x467427)[_0xabc3('0x2e')](_0xee312c);}};}function respondWithFilteredResult(_0x2d9cc2,_0x315b16){return function(_0x4741a0){if(_0x4741a0){var _0x41f9e7=typeof _0x315b16[_0xabc3('0x2f')]===_0xabc3('0x30')&&typeof _0x315b16[_0xabc3('0x31')]==='undefined';var _0x1a0174=_0x4741a0[_0xabc3('0x32')];var _0x380cc0=_0x41f9e7?0x0:_0x315b16[_0xabc3('0x2f')];var _0x4c8a36=_0x41f9e7?_0x4741a0[_0xabc3('0x32')]:_0x315b16[_0xabc3('0x2f')]+_0x315b16[_0xabc3('0x31')];var _0x5c5a2e;if(_0x4c8a36>=_0x1a0174){_0x4c8a36=_0x1a0174;_0x5c5a2e=0xc8;}else{_0x5c5a2e=0xce;}_0x2d9cc2[_0xabc3('0x2c')](_0x5c5a2e);return _0x2d9cc2[_0xabc3('0x33')]('Content-Range',_0x380cc0+'-'+_0x4c8a36+'/'+_0x1a0174)[_0xabc3('0x2e')](_0x4741a0);}return null;};}function patchUpdates(_0x35ff5f){return function(_0x1b1e63){try{jsonpatch['apply'](_0x1b1e63,_0x35ff5f,!![]);}catch(_0xff9bc5){return BPromise['reject'](_0xff9bc5);}return _0x1b1e63[_0xabc3('0x34')]();};}function saveUpdates(_0x5cfd22,_0x337971){return function(_0x2a914e){if(_0x2a914e){return _0x2a914e[_0xabc3('0x35')](_0x5cfd22)[_0xabc3('0x22')](function(_0x3b77ea){return _0x3b77ea;});}return null;};}function removeEntity(_0x43481a,_0x38f5b8){return function(_0x29b889){if(_0x29b889){return _0x29b889[_0xabc3('0x36')]()[_0xabc3('0x22')](function(){var _0x29da33=_0x29b889[_0xabc3('0x37')]({'plain':!![]});var _0xecf8cc=_0xabc3('0x38');return db[_0xabc3('0x39')][_0xabc3('0x36')]({'where':{'type':_0xecf8cc,'resourceId':_0x29da33['id']}})[_0xabc3('0x22')](function(){return _0x29b889;});})[_0xabc3('0x22')](function(){_0x43481a[_0xabc3('0x2c')](0xcc)[_0xabc3('0x2d')]();});}};}function handleEntityNotFound(_0x2f73dc,_0x136373){return function(_0x259c99){if(!_0x259c99){_0x2f73dc[_0xabc3('0x2b')](0x194);}return _0x259c99;};}function handleError(_0x1ae1a1,_0x492312){_0x492312=_0x492312||0x1f4;return function(_0x572707){logger[_0xabc3('0x28')](_0x572707['stack']);if(_0x572707['name']){delete _0x572707[_0xabc3('0x3a')];}_0x1ae1a1[_0xabc3('0x2c')](_0x492312)[_0xabc3('0x3b')](_0x572707);};}exports[_0xabc3('0x3c')]=function(_0x42daf2,_0xde5dee){var _0x5d902e={'include':[{'model':db['Pause'],'as':_0xabc3('0x3d')}]},_0x410e87={},_0x44fd2d={'count':0x0,'rows':[]};var _0x2248f4=_[_0xabc3('0x3e')](db['SmsAccount']['rawAttributes'],function(_0x4a86c1){return{'name':_0x4a86c1[_0xabc3('0x3f')],'type':_0x4a86c1[_0xabc3('0x40')][_0xabc3('0x41')]};});_0x410e87[_0xabc3('0x42')]=_[_0xabc3('0x3e')](_0x2248f4,_0xabc3('0x3a'));_0x410e87[_0xabc3('0x43')]=_['keys'](_0x42daf2[_0xabc3('0x43')]);_0x410e87['filters']=_[_0xabc3('0x44')](_0x410e87[_0xabc3('0x42')],_0x410e87[_0xabc3('0x43')]);_0x5d902e[_0xabc3('0x45')]=_[_0xabc3('0x44')](_0x410e87[_0xabc3('0x42')],qs[_0xabc3('0x46')](_0x42daf2[_0xabc3('0x43')][_0xabc3('0x46')]));_0x5d902e['attributes']=_0x5d902e[_0xabc3('0x45')][_0xabc3('0x47')]?_0x5d902e['attributes']:_0x410e87[_0xabc3('0x42')];if(!_0x42daf2[_0xabc3('0x43')][_0xabc3('0x48')]('nolimit')){_0x5d902e['limit']=qs[_0xabc3('0x31')](_0x42daf2[_0xabc3('0x43')][_0xabc3('0x31')]);_0x5d902e[_0xabc3('0x2f')]=qs['offset'](_0x42daf2[_0xabc3('0x43')]['offset']);}_0x5d902e[_0xabc3('0x49')]=qs['sort'](_0x42daf2['query'][_0xabc3('0x4a')]);_0x5d902e['where']=qs[_0xabc3('0x4b')](_[_0xabc3('0x4c')](_0x42daf2['query'],_0x410e87[_0xabc3('0x4b')]),_0x2248f4);if(_0x42daf2[_0xabc3('0x43')][_0xabc3('0x4d')]){_0x5d902e[_0xabc3('0x4e')]=_['merge'](_0x5d902e[_0xabc3('0x4e')],{'$or':_[_0xabc3('0x3e')](_0x2248f4,function(_0x28f9b4){if(_0x28f9b4['type']!==_0xabc3('0x4f')){var _0x573e73={};_0x573e73[_0x28f9b4[_0xabc3('0x3a')]]={'$like':'%'+_0x42daf2[_0xabc3('0x43')][_0xabc3('0x4d')]+'%'};return _0x573e73;}})});}_0x5d902e=_[_0xabc3('0x50')]({},_0x5d902e,_0x42daf2['options']);var _0x1a6ba6={'where':_0x5d902e['where']};return db[_0xabc3('0x51')]['count'](_0x1a6ba6)[_0xabc3('0x22')](function(_0x219d00){_0x44fd2d[_0xabc3('0x32')]=_0x219d00;if(_0x42daf2[_0xabc3('0x43')][_0xabc3('0x52')]){_0x5d902e[_0xabc3('0x53')]=[{'all':!![]}];}return db[_0xabc3('0x51')][_0xabc3('0x54')](_0x5d902e);})[_0xabc3('0x22')](function(_0x116f1c){_0x44fd2d[_0xabc3('0x55')]=_0x116f1c;return _0x44fd2d;})[_0xabc3('0x22')](respondWithFilteredResult(_0xde5dee,_0x5d902e))[_0xabc3('0x2a')](handleError(_0xde5dee,null));};exports[_0xabc3('0x56')]=function(_0x3c5a22,_0x1ed62a){var _0x229b86={'raw':![],'where':{'id':_0x3c5a22[_0xabc3('0x57')]['id']},'include':[{'model':db[_0xabc3('0x58')],'as':'mandatoryDispositionPause'}]},_0x1a66ce={};_0x1a66ce['model']=_['keys'](db['SmsAccount']['rawAttributes']);_0x1a66ce[_0xabc3('0x43')]=_['keys'](_0x3c5a22['query']);_0x1a66ce[_0xabc3('0x4b')]=_[_0xabc3('0x44')](_0x1a66ce[_0xabc3('0x42')],_0x1a66ce['query']);_0x229b86[_0xabc3('0x45')]=_[_0xabc3('0x44')](_0x1a66ce[_0xabc3('0x42')],qs[_0xabc3('0x46')](_0x3c5a22[_0xabc3('0x43')][_0xabc3('0x46')]));_0x229b86[_0xabc3('0x45')]=_0x229b86['attributes'][_0xabc3('0x47')]?_0x229b86[_0xabc3('0x45')]:_0x1a66ce[_0xabc3('0x42')];if(_0x3c5a22[_0xabc3('0x43')][_0xabc3('0x52')]){_0x229b86[_0xabc3('0x53')]=[{'all':!![]}];}_0x229b86=_[_0xabc3('0x50')]({},_0x229b86,_0x3c5a22[_0xabc3('0x59')]);return db[_0xabc3('0x51')][_0xabc3('0x5a')](_0x229b86)[_0xabc3('0x22')](handleEntityNotFound(_0x1ed62a,null))[_0xabc3('0x22')](respondWithResult(_0x1ed62a,null))[_0xabc3('0x2a')](handleError(_0x1ed62a,null));};exports[_0xabc3('0x5b')]=function(_0x198cad,_0x155f22){return db[_0xabc3('0x51')][_0xabc3('0x5b')](_0x198cad['body'],{})[_0xabc3('0x22')](function(_0x310728){var _0x58a7c1=_0x198cad[_0xabc3('0x5c')][_0xabc3('0x37')]({'plain':!![]});if(!_0x58a7c1)throw new Error(_0xabc3('0x5d'));if(_0x58a7c1[_0xabc3('0x5e')]===_0xabc3('0x5c')){var _0x3e62ae=_0x310728[_0xabc3('0x37')]({'plain':!![]});var _0x78775b='SmsAccounts';return db[_0xabc3('0x5f')][_0xabc3('0x5a')]({'where':{'name':_0x78775b,'userProfileId':_0x58a7c1[_0xabc3('0x60')]},'raw':!![]})[_0xabc3('0x22')](function(_0x4edd6e){if(_0x4edd6e&&_0x4edd6e[_0xabc3('0x61')]===0x0){return db[_0xabc3('0x39')]['create']({'name':_0x3e62ae['name'],'resourceId':_0x3e62ae['id'],'type':_0x4edd6e[_0xabc3('0x3a')],'sectionId':_0x4edd6e['id']},{})[_0xabc3('0x22')](function(){return _0x310728;});}else{return _0x310728;}})['catch'](function(_0x4851eb){logger[_0xabc3('0x28')](_0xabc3('0x62'),_0x4851eb);throw _0x4851eb;});}return _0x310728;})['then'](respondWithResult(_0x155f22,0xc9))[_0xabc3('0x2a')](handleError(_0x155f22,null));};exports['update']=function(_0x1765a0,_0x417a9f){if(_0x1765a0[_0xabc3('0x63')]['id']){delete _0x1765a0['body']['id'];}return db['SmsAccount'][_0xabc3('0x5a')]({'where':{'id':_0x1765a0[_0xabc3('0x57')]['id']},'include':[{'model':db[_0xabc3('0x58')],'as':_0xabc3('0x3d')}]})['then'](handleEntityNotFound(_0x417a9f,null))[_0xabc3('0x22')](saveUpdates(_0x1765a0['body'],null))[_0xabc3('0x22')](respondWithResult(_0x417a9f,null))[_0xabc3('0x2a')](handleError(_0x417a9f,null));};exports[_0xabc3('0x36')]=function(_0x539d1c,_0x4c4362){return db['SmsAccount'][_0xabc3('0x5a')]({'where':{'id':_0x539d1c[_0xabc3('0x57')]['id']}})[_0xabc3('0x22')](handleEntityNotFound(_0x4c4362,null))['then'](removeEntity(_0x4c4362,null))[_0xabc3('0x2a')](handleError(_0x4c4362,null));};exports[_0xabc3('0x64')]=function(_0x388598,_0x1f6783){return db['SmsAccount'][_0xabc3('0x64')]()['then'](respondWithResult(_0x1f6783,null))['catch'](handleError(_0x1f6783,null));};exports[_0xabc3('0x65')]=function(_0x4f901e,_0x30215e,_0x36f86b){if(_0x4f901e[_0xabc3('0x63')]['id']){delete _0x4f901e['body']['id'];}return db[_0xabc3('0x51')][_0xabc3('0x5a')]({'where':{'id':_0x4f901e[_0xabc3('0x57')]['id']}})['then'](handleEntityNotFound(_0x30215e,null))[_0xabc3('0x22')](function(_0x3fab5d){if(_0x3fab5d){_0x4f901e[_0xabc3('0x63')][_0xabc3('0x66')]=_0x3fab5d['id'];return db[_0xabc3('0x67')][_0xabc3('0x5b')](_0x4f901e['body']);}})[_0xabc3('0x22')](respondWithResult(_0x30215e,null))['catch'](handleError(_0x30215e,null));};exports[_0xabc3('0x68')]=function(_0x3d2fb8,_0x45c28b,_0x42bf4c){var _0x433496={'raw':![],'where':{}};var _0x414fb6={};var _0x1539c2={'count':0x0,'rows':[]};return db[_0xabc3('0x51')]['findOne']({'where':{'id':_0x3d2fb8[_0xabc3('0x57')]['id']}})[_0xabc3('0x22')](handleEntityNotFound(_0x45c28b,null))['then'](function(_0x3a8ab8){if(_0x3a8ab8){_0x414fb6[_0xabc3('0x42')]=_[_0xabc3('0x69')](db[_0xabc3('0x67')][_0xabc3('0x6a')]);_0x414fb6[_0xabc3('0x43')]=_[_0xabc3('0x69')](_0x3d2fb8['query']);_0x414fb6['filters']=_[_0xabc3('0x44')](_0x414fb6[_0xabc3('0x42')],_0x414fb6[_0xabc3('0x43')]);_0x433496[_0xabc3('0x45')]=_[_0xabc3('0x44')](_0x414fb6[_0xabc3('0x42')],qs[_0xabc3('0x46')](_0x3d2fb8[_0xabc3('0x43')][_0xabc3('0x46')]));_0x433496['attributes']=_0x433496[_0xabc3('0x45')][_0xabc3('0x47')]?_0x433496[_0xabc3('0x45')]:_0x414fb6[_0xabc3('0x42')];if(!_0x3d2fb8[_0xabc3('0x43')][_0xabc3('0x48')](_0xabc3('0x6b'))){_0x433496[_0xabc3('0x31')]=qs[_0xabc3('0x31')](_0x3d2fb8[_0xabc3('0x43')][_0xabc3('0x31')]);_0x433496[_0xabc3('0x2f')]=qs[_0xabc3('0x2f')](_0x3d2fb8[_0xabc3('0x43')][_0xabc3('0x2f')]);}_0x433496['order']=qs['sort'](_0x3d2fb8['query'][_0xabc3('0x4a')]);_0x433496[_0xabc3('0x4e')]=qs[_0xabc3('0x4b')](_[_0xabc3('0x4c')](_0x3d2fb8[_0xabc3('0x43')],_0x414fb6[_0xabc3('0x4b')]));_0x433496[_0xabc3('0x4e')][_0xabc3('0x66')]=_0x3a8ab8['id'];if(_0x3d2fb8[_0xabc3('0x43')][_0xabc3('0x4d')]){_0x433496['where']=_[_0xabc3('0x50')](_0x433496['where'],{'$or':_['map'](_0x433496[_0xabc3('0x45')],function(_0x47d86c){var _0x17c386={};_0x17c386[_0x47d86c]={'$like':'%'+_0x3d2fb8[_0xabc3('0x43')]['filter']+'%'};return _0x17c386;})});}_0x433496=_['merge']({},_0x433496,_0x3d2fb8[_0xabc3('0x59')]);return db[_0xabc3('0x67')][_0xabc3('0x32')]({'where':_0x433496[_0xabc3('0x4e')]})[_0xabc3('0x22')](function(_0x309d4c){_0x1539c2[_0xabc3('0x32')]=_0x309d4c;if(_0x3d2fb8[_0xabc3('0x43')]['includeAll']){_0x433496[_0xabc3('0x53')]=[{'all':!![]}];}return db[_0xabc3('0x67')][_0xabc3('0x54')](_0x433496);})[_0xabc3('0x22')](function(_0x4d2453){_0x1539c2[_0xabc3('0x55')]=_0x4d2453;return _0x1539c2;});}})[_0xabc3('0x22')](respondWithFilteredResult(_0x45c28b,_0x433496))[_0xabc3('0x2a')](handleError(_0x45c28b,null));};exports['removeDispositions']=function(_0x4b348d,_0x267862,_0x586e48){return db['SmsAccount']['find']({'where':{'id':_0x4b348d[_0xabc3('0x57')]['id']}})[_0xabc3('0x22')](handleEntityNotFound(_0x267862,null))[_0xabc3('0x22')](function(_0x28d9f8){if(_0x28d9f8){return _0x28d9f8[_0xabc3('0x6c')](_0x4b348d['query'][_0xabc3('0x6d')]);}})[_0xabc3('0x22')](respondWithStatusCode(_0x267862,null))[_0xabc3('0x2a')](handleError(_0x267862,null));};exports[_0xabc3('0x6e')]=function(_0xbfc94e,_0x4201dc,_0x10274e){if(_0xbfc94e['body']['id']){delete _0xbfc94e[_0xabc3('0x63')]['id'];}return db[_0xabc3('0x51')]['find']({'where':{'id':_0xbfc94e[_0xabc3('0x57')]['id']}})[_0xabc3('0x22')](handleEntityNotFound(_0x4201dc,null))[_0xabc3('0x22')](function(_0x537a67){if(_0x537a67){_0xbfc94e['body'][_0xabc3('0x66')]=_0x537a67['id'];return db[_0xabc3('0x6f')]['create'](_0xbfc94e['body']);}})['then'](respondWithResult(_0x4201dc,null))[_0xabc3('0x2a')](handleError(_0x4201dc,null));};exports[_0xabc3('0x70')]=function(_0x1e35d7,_0x26870b,_0x207281){var _0x5f31ea={'raw':![],'where':{}};var _0x1547b6={};var _0x3aff7c={'count':0x0,'rows':[]};return db[_0xabc3('0x51')][_0xabc3('0x71')]({'where':{'id':_0x1e35d7['params']['id']}})['then'](handleEntityNotFound(_0x26870b,null))['then'](function(_0x21aab7){if(_0x21aab7){_0x1547b6[_0xabc3('0x42')]=_['keys'](db[_0xabc3('0x6f')][_0xabc3('0x6a')]);_0x1547b6[_0xabc3('0x43')]=_['keys'](_0x1e35d7[_0xabc3('0x43')]);_0x1547b6[_0xabc3('0x4b')]=_[_0xabc3('0x44')](_0x1547b6[_0xabc3('0x42')],_0x1547b6[_0xabc3('0x43')]);_0x5f31ea[_0xabc3('0x45')]=_[_0xabc3('0x44')](_0x1547b6[_0xabc3('0x42')],qs[_0xabc3('0x46')](_0x1e35d7[_0xabc3('0x43')]['fields']));_0x5f31ea['attributes']=_0x5f31ea['attributes'][_0xabc3('0x47')]?_0x5f31ea[_0xabc3('0x45')]:_0x1547b6[_0xabc3('0x42')];if(!_0x1e35d7['query'][_0xabc3('0x48')](_0xabc3('0x6b'))){_0x5f31ea[_0xabc3('0x31')]=qs[_0xabc3('0x31')](_0x1e35d7[_0xabc3('0x43')][_0xabc3('0x31')]);_0x5f31ea['offset']=qs[_0xabc3('0x2f')](_0x1e35d7[_0xabc3('0x43')][_0xabc3('0x2f')]);}_0x5f31ea[_0xabc3('0x49')]=qs['sort'](_0x1e35d7[_0xabc3('0x43')][_0xabc3('0x4a')]);_0x5f31ea[_0xabc3('0x4e')]=qs[_0xabc3('0x4b')](_[_0xabc3('0x4c')](_0x1e35d7['query'],_0x1547b6[_0xabc3('0x4b')]));_0x5f31ea['where'][_0xabc3('0x66')]=_0x21aab7['id'];if(_0x1e35d7[_0xabc3('0x43')][_0xabc3('0x4d')]){_0x5f31ea['where']=_[_0xabc3('0x50')](_0x5f31ea[_0xabc3('0x4e')],{'$or':_['map'](_0x5f31ea[_0xabc3('0x45')],function(_0x1cd7db){var _0x2ec608={};_0x2ec608[_0x1cd7db]={'$like':'%'+_0x1e35d7['query'][_0xabc3('0x4d')]+'%'};return _0x2ec608;})});}_0x5f31ea=_[_0xabc3('0x50')]({},_0x5f31ea,_0x1e35d7[_0xabc3('0x59')]);return db['CannedAnswer'][_0xabc3('0x32')]({'where':_0x5f31ea['where']})['then'](function(_0x373e99){_0x3aff7c[_0xabc3('0x32')]=_0x373e99;if(_0x1e35d7[_0xabc3('0x43')]['includeAll']){_0x5f31ea[_0xabc3('0x53')]=[{'all':!![]}];}return db[_0xabc3('0x6f')][_0xabc3('0x54')](_0x5f31ea);})[_0xabc3('0x22')](function(_0x221e6f){_0x3aff7c['rows']=_0x221e6f;return _0x3aff7c;});}})[_0xabc3('0x22')](respondWithFilteredResult(_0x26870b,_0x5f31ea))[_0xabc3('0x2a')](handleError(_0x26870b,null));};exports['removeAnswers']=function(_0x45309b,_0x11e28c,_0x332ad6){return db[_0xabc3('0x51')][_0xabc3('0x5a')]({'where':{'id':_0x45309b[_0xabc3('0x57')]['id']}})[_0xabc3('0x22')](handleEntityNotFound(_0x11e28c,null))[_0xabc3('0x22')](function(_0x243d7c){if(_0x243d7c){return _0x243d7c[_0xabc3('0x72')](_0x45309b['query'][_0xabc3('0x6d')]);}})[_0xabc3('0x22')](respondWithStatusCode(_0x11e28c,null))[_0xabc3('0x2a')](handleError(_0x11e28c,null));};exports['notify']=function(_0x3963cb,_0x2dd8a8,_0x511d1e){var _0x447a35={'channel':_0xabc3('0x73')};var _0x2ede97=[];var _0x4c5e0a=[];var _0x24bad6={};return db[_0xabc3('0x51')]['find']({'where':{'id':_0x3963cb['params']['id']},'include':[{'model':db[_0xabc3('0x74')],'as':_0xabc3('0x75')}]})['then'](handleEntityNotFound(_0x2dd8a8,null))[_0xabc3('0x22')](function(_0x388b0e){_0x447a35[_0xabc3('0x76')]=_0x388b0e;_0x447a35['applications']=_[_0xabc3('0x77')](_0x388b0e[_0xabc3('0x75')],[_0xabc3('0x78')],[_0xabc3('0x79')]);if(_0x447a35[_0xabc3('0x76')][_0xabc3('0x75')]){delete _0x447a35[_0xabc3('0x76')][_0xabc3('0x75')];}return db[_0xabc3('0x7a')][_0xabc3('0x64')]();})[_0xabc3('0x22')](function(_0x54d4fe){if(!_0x54d4fe){throw new db[(_0xabc3('0x7b'))][(_0xabc3('0x7c'))](_0xabc3('0x7d'));}_0x2ede97=_['difference'](_[_0xabc3('0x69')](_0x54d4fe),[_0xabc3('0x7e'),_0xabc3('0x7f')]);_0x4c5e0a=_[_0xabc3('0x80')](_[_0xabc3('0x69')](_0x54d4fe),['createdAt',_0xabc3('0x7f'),_0xabc3('0x81'),_0xabc3('0x82')]);_0x447a35[_0xabc3('0x63')]={'mapKey':_0xabc3('0x83')};if(_0x447a35[_0xabc3('0x76')][_0xabc3('0x40')]){switch(_0x447a35[_0xabc3('0x76')][_0xabc3('0x40')]){case _0xabc3('0x84'):_0x447a35['body']['from']=_0x3963cb['body'][_0xabc3('0x85')];_0x447a35[_0xabc3('0x63')][_0xabc3('0x63')]=_0x3963cb[_0xabc3('0x63')][_0xabc3('0x86')];_0x447a35['body']['messageId']=_0x3963cb['body'][_0xabc3('0x87')];break;case'skebby':_0x447a35['body'][_0xabc3('0x88')]='+'+_0x3963cb['body'][_0xabc3('0x89')];_0x447a35[_0xabc3('0x63')][_0xabc3('0x63')]=_0x3963cb[_0xabc3('0x63')][_0xabc3('0x8a')];break;case _0xabc3('0x8b'):_0x447a35[_0xabc3('0x63')]['from']=_0x3963cb[_0xabc3('0x63')][_0xabc3('0x88')];_0x447a35['body'][_0xabc3('0x63')]=_0x3963cb['body']['message'];break;case _0xabc3('0x8c'):_0x447a35['body'][_0xabc3('0x88')]=_0x3963cb['body'][_0xabc3('0x88')];_0x447a35[_0xabc3('0x63')][_0xabc3('0x63')]=_0x3963cb['body'][_0xabc3('0x63')];_0x447a35[_0xabc3('0x63')][_0xabc3('0x8d')]=_0x3963cb[_0xabc3('0x63')]['message_id'];break;case'plivo':_0x447a35[_0xabc3('0x63')]['from']=_0x3963cb['body']['From'];_0x447a35[_0xabc3('0x63')][_0xabc3('0x63')]=_0x3963cb['body'][_0xabc3('0x8e')];_0x447a35['body'][_0xabc3('0x8d')]=_0x3963cb[_0xabc3('0x63')][_0xabc3('0x8f')];break;case _0xabc3('0x90'):_0x447a35[_0xabc3('0x63')]['from']='+'+_0x3963cb[_0xabc3('0x63')][_0xabc3('0x91')][0x0][_0xabc3('0x88')];_0x447a35[_0xabc3('0x63')]['body']=_0x3963cb['body'][_0xabc3('0x91')][0x0]['text'];_0x447a35[_0xabc3('0x63')][_0xabc3('0x8d')]=_0x3963cb[_0xabc3('0x63')][_0xabc3('0x91')][0x0][_0xabc3('0x8d')];break;case'csc':_0x447a35['body'][_0xabc3('0x88')]=_0x3963cb[_0xabc3('0x63')][_0xabc3('0x92')];_0x447a35[_0xabc3('0x63')][_0xabc3('0x63')]=_0x3963cb[_0xabc3('0x63')]['segmentedMessage'][_0xabc3('0x29')];break;case'clickatell':_0x447a35[_0xabc3('0x63')]['from']=_0x3963cb[_0xabc3('0x63')]['fromNumber'];_0x447a35['body'][_0xabc3('0x63')]=_0x3963cb[_0xabc3('0x63')][_0xabc3('0x8a')];_0x447a35[_0xabc3('0x63')]['messageId']=_0x3963cb[_0xabc3('0x63')][_0xabc3('0x93')];break;case _0xabc3('0x94'):_0x447a35[_0xabc3('0x63')][_0xabc3('0x8d')]=_0x3963cb['body'][0x0][_0xabc3('0x29')]['id'];_0x447a35[_0xabc3('0x63')]['from']=_0x3963cb[_0xabc3('0x63')][0x0][_0xabc3('0x29')]['from'];_0x447a35[_0xabc3('0x63')][_0xabc3('0x63')]=_0x3963cb['body'][0x0][_0xabc3('0x29')][_0xabc3('0x8a')];break;case _0xabc3('0x95'):_0x447a35[_0xabc3('0x63')][_0xabc3('0x88')]=_0x3963cb[_0xabc3('0x63')][_0xabc3('0x88')];_0x447a35[_0xabc3('0x63')][_0xabc3('0x63')]=_0x3963cb[_0xabc3('0x63')][_0xabc3('0x29')];_0x447a35[_0xabc3('0x63')][_0xabc3('0x8d')]=_0x3963cb['body'][_0xabc3('0x96')];break;}}if(_0x447a35['body']['id']){delete _0x447a35[_0xabc3('0x63')]['id'];}if(_['isNil'](_0x447a35[_0xabc3('0x63')][_0xabc3('0x88')])){throw new db[(_0xabc3('0x7b'))][(_0xabc3('0x7c'))]('from\x20is\x20mandatory');}if(_[_0xabc3('0x97')](_0x447a35[_0xabc3('0x63')][_0xabc3('0x63')])||_0x447a35[_0xabc3('0x63')][_0xabc3('0x63')]===''){throw new db[(_0xabc3('0x7b'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xabc3('0x97')](_0x447a35[_0xabc3('0x63')][_0xabc3('0x98')])){throw new db['Sequelize'][(_0xabc3('0x7c'))](_0xabc3('0x99')+_0x4c5e0a);}if(!_[_0xabc3('0x9a')](_0x4c5e0a,_0x447a35[_0xabc3('0x63')]['mapKey'])){throw new db['Sequelize']['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4c5e0a);}_0x24bad6[_0x447a35['body'][_0xabc3('0x98')]]=_0x447a35[_0xabc3('0x63')]['from'];return db[_0xabc3('0x9b')][_0xabc3('0x5a')]({'where':{'id':_0x447a35[_0xabc3('0x76')][_0xabc3('0x82')]},'include':[{'model':db[_0xabc3('0x7a')],'as':_0xabc3('0x9c'),'where':_0x24bad6,'limit':0x1,'order':[[_0xabc3('0x7f'),_0xabc3('0x9d')]]}]});})[_0xabc3('0x22')](handleEntityNotFound(_0x2dd8a8,null))[_0xabc3('0x22')](function(_0x25d500){if(_0x25d500){_0x447a35['list']=_['omit'](_0x25d500,[_0xabc3('0x9c')]);if(_0x25d500[_0xabc3('0x9c')][_0xabc3('0x47')]){return _0x25d500[_0xabc3('0x9c')][0x0];}var _0x33b994=_['defaults'](_0x447a35[_0xabc3('0x63')],{'firstName':_0x447a35['body'][_0xabc3('0x88')],'ListId':_0x25d500['id']});_0x33b994[_0x447a35[_0xabc3('0x63')][_0xabc3('0x98')]]=_0x447a35['body'][_0xabc3('0x88')];return db['CmContact'][_0xabc3('0x5b')](_0x33b994,{'fields':_0x2ede97,'raw':!![]});}})[_0xabc3('0x22')](handleEntityNotFound(_0x2dd8a8,null))[_0xabc3('0x22')](function(_0x407b17){if(_0x407b17){_0x447a35[_0xabc3('0x9e')]=_0x407b17;var _0x297041={'ContactId':_0x407b17['id'],'phone':_0x447a35['body'][_0xabc3('0x88')],'SmsAccountId':_0x3963cb[_0xabc3('0x57')]['id']};var _0x4ebebf={'ContactId':_0x407b17['id'],'SmsAccountId':_0x3963cb['params']['id'],'closed':![]};return db[_0xabc3('0x9f')][_0xabc3('0x5a')]({'where':_0x4ebebf})[_0xabc3('0x22')](function(_0x2b8f75){if(_0x2b8f75){return[_0x2b8f75,![]];}return db[_0xabc3('0x9f')][_0xabc3('0x5b')](_0x297041)['then'](function(_0x36482d){return[_0x36482d,!![]];});});}})['spread'](function(_0x33b921,_0x2b5638){_0x447a35[_0xabc3('0xa0')]=_0x33b921[_0xabc3('0x37')]({'plain':!![]});_0x447a35[_0xabc3('0xa0')]['created']=![];if(_0x2b5638){if(_0x447a35[_0xabc3('0x76')][_0xabc3('0xa1')]){_0x447a35[_0xabc3('0xa2')]['push']({'id':0x0,'priority':_0x447a35[_0xabc3('0xa2')][_0xabc3('0x47')]+0x1,'app':_0xabc3('0xa3'),'appdata':'unmanaged','interval':_0xabc3('0xa4')});}_0x447a35['interaction']['created']=!![];}return db[_0xabc3('0xa5')][_0xabc3('0x5b')]({'phone':_0x447a35[_0xabc3('0x63')]['from'],'messageId':_0x447a35[_0xabc3('0x63')]['messageId'],'body':_0x447a35[_0xabc3('0x63')][_0xabc3('0x63')],'SmsAccountId':_0x3963cb[_0xabc3('0x57')]['id'],'SmsInteractionId':_0x33b921['id'],'direction':'in','ContactId':_0x33b921[_0xabc3('0xa6')],'AttachmentId':_0x447a35['body'][_0xabc3('0xa7')]});})[_0xabc3('0x22')](function(_0x200854){_0x447a35['message']=_0x200854;if(_0x447a35[_0xabc3('0xa0')][_0xabc3('0xa8')]){return db[_0xabc3('0xa9')]['find']({'attributes':['id','name'],'where':{'id':_0x447a35[_0xabc3('0xa0')][_0xabc3('0xa8')]}})[_0xabc3('0x22')](function(_0x49df11){if(_0x49df11){_0x447a35[_0xabc3('0xa2')][_0xabc3('0xaa')]({'id':0x0,'priority':0x0,'app':_0xabc3('0xab'),'appdata':_0x49df11['name']+','+(_0x447a35[_0xabc3('0x76')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0xabc3('0xac'),_0x447a35);});}return respondWithRpcPromise('Start','startRouting',_0x447a35);})[_0xabc3('0x22')](function(_0x775a3a){if(_0x775a3a){var _0x32ca42=0xc8;var _0x33aabf='receiveMessage';logger[_0xabc3('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x33aabf,_0x32ca42,'entity\x20found');logger[_0xabc3('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x33aabf,_0x32ca42,_0xabc3('0xad'),JSON['stringify'](_0x775a3a));if(_0x447a35[_0xabc3('0x76')]['type']==='twilio'){return _0x2dd8a8['status'](_0x32ca42)[_0xabc3('0x33')](_0xabc3('0xae'),'text/xml')['send'](_0xabc3('0xaf'));}else{return _0x2dd8a8[_0xabc3('0x2c')](_0x32ca42)[_0xabc3('0x2e')](_0x775a3a);}}})[_0xabc3('0x2a')](handleError(_0x2dd8a8,null));};exports[_0xabc3('0xb0')]=function(_0x26412d,_0x5a3061,_0x414d51){return db['SmsAccount']['findOne']({'where':{'id':_0x26412d[_0xabc3('0x57')]['id']}})[_0xabc3('0x22')](handleEntityNotFound(_0x5a3061,null))[_0xabc3('0x22')](function(_0xb839eb){if(_0xb839eb){return db[_0xabc3('0xb1')][_0xabc3('0xb2')](function(_0x59d60f){return db[_0xabc3('0x74')]['destroy']({'where':{'SmsAccountId':_0x26412d[_0xabc3('0x57')]['id']},'transaction':_0x59d60f})['then'](function(_0x57e76c){var _0x100975=_[_0xabc3('0x3e')](_0x26412d[_0xabc3('0x63')],function(_0x55da5f){_0x55da5f[_0xabc3('0x66')]=_0x26412d[_0xabc3('0x57')]['id'];return _0x55da5f;});return db[_0xabc3('0x74')]['bulkCreate'](_0x100975,{'transaction':_0x59d60f});});})[_0xabc3('0x22')](function(){return db['SmsApplication'][_0xabc3('0xb3')]({'where':{'SmsAccountId':_0x26412d['params']['id']},'order':'priority'});});}})[_0xabc3('0x22')](respondWithResult(_0x5a3061,null))[_0xabc3('0x2a')](handleError(_0x5a3061,null));};exports[_0xabc3('0xb4')]=function(_0x47419e,_0x21d91d,_0x15ed28){var _0x9691b1={};var _0x408563={};var _0x196640;var _0xef3239;return db['SmsAccount'][_0xabc3('0x71')]({'where':{'id':_0x47419e['params']['id']}})[_0xabc3('0x22')](handleEntityNotFound(_0x21d91d,null))[_0xabc3('0x22')](function(_0x48e3c4){if(_0x48e3c4){_0x196640=_0x48e3c4;_0x408563[_0xabc3('0x42')]=_[_0xabc3('0x69')](db['SmsApplication'][_0xabc3('0x6a')]);_0x408563[_0xabc3('0x43')]=_['keys'](_0x47419e[_0xabc3('0x43')]);_0x408563[_0xabc3('0x4b')]=_[_0xabc3('0x44')](_0x408563[_0xabc3('0x42')],_0x408563[_0xabc3('0x43')]);_0x9691b1[_0xabc3('0x45')]=_[_0xabc3('0x44')](_0x408563[_0xabc3('0x42')],qs[_0xabc3('0x46')](_0x47419e[_0xabc3('0x43')][_0xabc3('0x46')]));_0x9691b1[_0xabc3('0x45')]=_0x9691b1['attributes'][_0xabc3('0x47')]?_0x9691b1['attributes']:_0x408563[_0xabc3('0x42')];_0x9691b1[_0xabc3('0x49')]=qs[_0xabc3('0x4a')](_0x47419e['query'][_0xabc3('0x4a')]);_0x9691b1[_0xabc3('0x4e')]=qs[_0xabc3('0x4b')](_[_0xabc3('0x4c')](_0x47419e[_0xabc3('0x43')],_0x408563[_0xabc3('0x4b')]));if(_0x47419e['query'][_0xabc3('0x4d')]){_0x9691b1['where']=_[_0xabc3('0x50')](_0x9691b1[_0xabc3('0x4e')],{'$or':_[_0xabc3('0x3e')](_0x9691b1[_0xabc3('0x45')],function(_0x3041b4){var _0x5cbc06={};_0x5cbc06[_0x3041b4]={'$like':'%'+_0x47419e[_0xabc3('0x43')][_0xabc3('0x4d')]+'%'};return _0x5cbc06;})});}_0x9691b1=_['merge']({},_0x9691b1,_0x47419e[_0xabc3('0x59')]);return _0x196640[_0xabc3('0xb4')](_0x9691b1);}})[_0xabc3('0x22')](function(_0x4aed54){if(_0x4aed54){_0xef3239=_0x4aed54[_0xabc3('0x47')];if(!_0x47419e[_0xabc3('0x43')][_0xabc3('0x48')](_0xabc3('0x6b'))){_0x9691b1[_0xabc3('0x31')]=qs[_0xabc3('0x31')](_0x47419e[_0xabc3('0x43')][_0xabc3('0x31')]);_0x9691b1[_0xabc3('0x2f')]=qs['offset'](_0x47419e[_0xabc3('0x43')]['offset']);}return _0x196640['getApplications'](_0x9691b1);}})[_0xabc3('0x22')](function(_0x55cc6e){if(_0x55cc6e){return _0x55cc6e?{'count':_0xef3239,'rows':_0x55cc6e}:null;}})[_0xabc3('0x22')](respondWithResult(_0x21d91d,null))[_0xabc3('0x2a')](handleError(_0x21d91d,null));};exports['getInteractions']=function(_0x53d397,_0x41a147,_0x2f0f6b){var _0xe4afd8={'raw':![],'where':{}};var _0x33d8e3={};var _0x189621={'count':0x0,'rows':[]};return db[_0xabc3('0x51')][_0xabc3('0x71')]({'where':{'id':_0x53d397['params']['id']}})[_0xabc3('0x22')](handleEntityNotFound(_0x41a147,null))['then'](function(_0x2ffaf3){if(_0x2ffaf3){_0x33d8e3[_0xabc3('0x42')]=_['keys'](db['SmsInteraction']['rawAttributes']);_0x33d8e3[_0xabc3('0x43')]=_[_0xabc3('0x69')](_0x53d397['query']);_0x33d8e3[_0xabc3('0x4b')]=_[_0xabc3('0x44')](_0x33d8e3[_0xabc3('0x42')],_0x33d8e3[_0xabc3('0x43')]);_0xe4afd8[_0xabc3('0x45')]=_[_0xabc3('0x44')](_0x33d8e3[_0xabc3('0x42')],qs['fields'](_0x53d397[_0xabc3('0x43')]['fields']));_0xe4afd8[_0xabc3('0x45')]=_0xe4afd8['attributes'][_0xabc3('0x47')]?_0xe4afd8[_0xabc3('0x45')]:_0x33d8e3[_0xabc3('0x42')];if(!_0x53d397[_0xabc3('0x43')][_0xabc3('0x48')](_0xabc3('0x6b'))){_0xe4afd8[_0xabc3('0x31')]=qs[_0xabc3('0x31')](_0x53d397[_0xabc3('0x43')]['limit']);_0xe4afd8[_0xabc3('0x2f')]=qs[_0xabc3('0x2f')](_0x53d397[_0xabc3('0x43')][_0xabc3('0x2f')]);}_0xe4afd8['order']=qs[_0xabc3('0x4a')](_0x53d397[_0xabc3('0x43')][_0xabc3('0x4a')]);_0xe4afd8[_0xabc3('0x4e')]=qs[_0xabc3('0x4b')](_[_0xabc3('0x4c')](_0x53d397[_0xabc3('0x43')],_0x33d8e3[_0xabc3('0x4b')]));_0xe4afd8[_0xabc3('0x4e')][_0xabc3('0x66')]=_0x2ffaf3['id'];if(_0x53d397[_0xabc3('0x43')]['filter']){_0xe4afd8[_0xabc3('0x4e')]=_[_0xabc3('0x50')](_0xe4afd8[_0xabc3('0x4e')],{'$or':_[_0xabc3('0x3e')](_0xe4afd8[_0xabc3('0x45')],function(_0x493551){var _0x5d3a87={};_0x5d3a87[_0x493551]={'$like':'%'+_0x53d397['query'][_0xabc3('0x4d')]+'%'};return _0x5d3a87;})});}_0xe4afd8=_[_0xabc3('0x50')]({},_0xe4afd8,_0x53d397[_0xabc3('0x59')]);return db['SmsInteraction']['count']({'where':_0xe4afd8[_0xabc3('0x4e')]})['then'](function(_0xe32d48){_0x189621['count']=_0xe32d48;if(_0x53d397[_0xabc3('0x43')]['includeAll']){_0xe4afd8[_0xabc3('0x53')]=[{'model':db[_0xabc3('0x7a')],'as':_0xabc3('0xb5'),'required':![]},{'model':db['User'],'as':_0xabc3('0xb6'),'attributes':[_0xabc3('0x3a'),_0xabc3('0xb7'),_0xabc3('0xb8')],'required':![]},{'model':db['Tag'],'as':_0xabc3('0xb9'),'attributes':['id',_0xabc3('0x3a'),_0xabc3('0xba')],'where':_0x53d397[_0xabc3('0x43')]['tag']?{'id':_0x53d397['query'][_0xabc3('0xbb')]}:undefined,'required':_0x53d397[_0xabc3('0x43')][_0xabc3('0xbb')]?!![]:![]}];}return db['SmsInteraction'][_0xabc3('0x54')](_0xe4afd8);})['then'](function(_0x1af31b){_0x189621[_0xabc3('0x55')]=_0x1af31b;return _0x189621;});}})[_0xabc3('0x22')](respondWithFilteredResult(_0x41a147,_0xe4afd8))[_0xabc3('0x2a')](handleError(_0x41a147,null));};exports[_0xabc3('0x3b')]=function(_0x4a47d6,_0x1428c7,_0x1ca20c){var _0xd0d4ba,_0x452b8,_0x5116b8;if(_[_0xabc3('0x97')](_0x4a47d6[_0xabc3('0x63')]['body'])||_0x4a47d6[_0xabc3('0x63')][_0xabc3('0x63')]===''){throw new db['Sequelize'][(_0xabc3('0x7c'))](_0xabc3('0xbc'));}if(_[_0xabc3('0x97')](_0x4a47d6['body']['to'])){throw new db[(_0xabc3('0x7b'))][(_0xabc3('0x7c'))]('to\x20is\x20mandatory');}_0xd0d4ba=_0x4a47d6[_0xabc3('0x63')]['to'];return db['SmsAccount'][_0xabc3('0x5a')]({'where':{'id':_0x4a47d6['params']['id']},'include':[{'model':db[_0xabc3('0x9b')],'as':_0xabc3('0xbd'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'mobile':_0xd0d4ba},'limit':0x1,'order':[[_0xabc3('0x7f'),'DESC']]}]}]})[_0xabc3('0x22')](handleEntityNotFound(_0x1428c7,null))[_0xabc3('0x22')](function(_0x1b631d){if(_0x1b631d&&_0x1b631d[_0xabc3('0xbd')]){_0x452b8=_0x1b631d[_0xabc3('0x37')]({'plain':!![]});if(_0x452b8['List']&&_0x452b8[_0xabc3('0xbd')]['Contacts'][_0xabc3('0x47')]){return _0x452b8[_0xabc3('0xbd')][_0xabc3('0x9c')][0x0];}return db[_0xabc3('0x7a')][_0xabc3('0x5b')](_['defaults'](_0x4a47d6[_0xabc3('0x63')],{'firstName':_0xd0d4ba,'mobile':_0xd0d4ba,'phone':_0xd0d4ba,'ListId':_0x452b8[_0xabc3('0x82')]}));}})[_0xabc3('0x22')](handleEntityNotFound(_0x1428c7,null))['then'](function(_0x45d7db){if(_0x45d7db){_0x5116b8=_0x45d7db;return db[_0xabc3('0x9f')][_0xabc3('0x5a')]({'where':{'ContactId':_0x5116b8['id'],'closed':![],'SmsAccountId':_0x452b8['id']}})[_0xabc3('0x22')](function(_0x38d58b){if(_0x38d58b){return[_0x38d58b,![]];}return db[_0xabc3('0x9f')][_0xabc3('0x5b')]({'UserId':_0x4a47d6[_0xabc3('0x5c')]['id'],'ContactId':_0x5116b8['id'],'SmsAccountId':_0x452b8['id'],'phone':_0xd0d4ba,'firstMsgDirection':'out','Messages':[_[_0xabc3('0x50')](_0x4a47d6[_0xabc3('0x63')],{'read':![],'body':_0x4a47d6[_0xabc3('0x63')][_0xabc3('0x63')],'phone':_0xd0d4ba,'SmsAccountId':_0x452b8['id'],'UserId':_0x4a47d6[_0xabc3('0x5c')]['id'],'ContactId':_0x5116b8['id']})]},{'include':[{'model':db[_0xabc3('0xa5')],'as':'Messages'}]})['then'](function(_0x3927d3){return[_0x3927d3,!![]];});});}})[_0xabc3('0xbe')](function(_0x2c3691,_0x38effb){if(_0x38effb){return _0x2c3691;}return db[_0xabc3('0xa5')][_0xabc3('0x5b')](_[_0xabc3('0x50')](_0x4a47d6['body'],{'read':![],'body':_0x4a47d6[_0xabc3('0x63')][_0xabc3('0x63')],'phone':_0xd0d4ba,'SmsAccountId':_0x452b8['id'],'SmsInteractionId':_0x2c3691['id'],'UserId':_0x4a47d6[_0xabc3('0x5c')]['id'],'ContactId':_0x5116b8['id']}))[_0xabc3('0x22')](function(_0x1afbd6){_0x2c3691[_0xabc3('0xbf')]['Messages']=[];_0x2c3691['dataValues']['Messages']['push'](_0x1afbd6[_0xabc3('0xbf')]);return _0x2c3691;});})['then'](respondWithResult(_0x1428c7,null))[_0xabc3('0x2a')](handleError(_0x1428c7,null));};exports[_0xabc3('0x2c')]=function(_0x3745ca,_0x13eeaf,_0x5cef7b){if(_0x3745ca[_0xabc3('0x63')]['id']){delete _0x3745ca[_0xabc3('0x63')]['id'];}var _0x57f886,_0x293f5b,_0x4b9324;return db[_0xabc3('0x51')][_0xabc3('0x5a')]({'where':{'id':_0x3745ca['params']['id']}})['then'](handleEntityNotFound(_0x13eeaf,null))['then'](function(_0x177b9e){if(_0x177b9e){_0x4b9324=_0x177b9e;logger[_0xabc3('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xabc3('0x2c'),_0xabc3('0xc0'),_0x177b9e[_0xabc3('0x40')],util[_0xabc3('0xc1')](_0x3745ca[_0xabc3('0x63')],{'showHidden':![],'depth':null}));switch(_0x177b9e[_0xabc3('0x40')]){case _0xabc3('0xc2'):if(_0x3745ca[_0xabc3('0x63')][_0xabc3('0xc3')]&&_0x3745ca[_0xabc3('0x63')]['status']){_0x293f5b=_0x3745ca[_0xabc3('0x63')]['status'];return db[_0xabc3('0xa5')][_0xabc3('0x5a')]({'where':{'messageId':_0x3745ca[_0xabc3('0x63')][_0xabc3('0xc3')]}});}break;case _0xabc3('0x8b'):if(_0x3745ca['body']['requestid']&&_0x3745ca[_0xabc3('0x63')][_0xabc3('0xc4')]){_0x293f5b=_0x3745ca[_0xabc3('0x63')]['statusInt'];return db[_0xabc3('0xa5')][_0xabc3('0x5a')]({'where':{'messageId':_0x3745ca['body'][_0xabc3('0xc5')]}});}break;case _0xabc3('0x8c'):if(_0x3745ca[_0xabc3('0x63')]['message_id']&&_0x3745ca[_0xabc3('0x63')][_0xabc3('0xc6')]){_0x293f5b=_0x3745ca['body']['status_code'];return db[_0xabc3('0xa5')][_0xabc3('0x5a')]({'where':{'messageId':_0x3745ca[_0xabc3('0x63')][_0xabc3('0xc7')]}});}break;case _0xabc3('0x90'):var _0x481366=_0x3745ca[_0xabc3('0x63')][_0xabc3('0x91')][0x0];if(_0x481366[_0xabc3('0x8d')]&&_0x481366['status'][_0xabc3('0xc8')]==='DELIVERED'){_0x293f5b=_0x481366[_0xabc3('0x2c')][_0xabc3('0xc8')];return db['SmsMessage'][_0xabc3('0x5a')]({'where':{'messageId':_0x481366[_0xabc3('0x8d')]}});}break;case'clickatell':if(_0x3745ca[_0xabc3('0x63')][_0xabc3('0x8d')]&&_0x3745ca['body'][_0xabc3('0x2c')]){_0x293f5b=_0x3745ca[_0xabc3('0x63')][_0xabc3('0x2c')];return db[_0xabc3('0xa5')][_0xabc3('0x5a')]({'where':{'messageId':_0x3745ca[_0xabc3('0x63')][_0xabc3('0x8d')]}});}break;case _0xabc3('0x94'):if(_0x3745ca['body'][0x0]['message']['id']){_0x293f5b=_0x3745ca[_0xabc3('0x63')][0x0][_0xabc3('0x40')];return db[_0xabc3('0xa5')][_0xabc3('0x5a')]({'where':{'messageId':_0x3745ca['body'][0x0]['message']['id']}});}break;case'intelepeer':if(_0x3745ca['body'][_0xabc3('0xc9')]&&_0x3745ca['body']['status']){_0x293f5b=_0x3745ca[_0xabc3('0x63')][_0xabc3('0x2c')];return db[_0xabc3('0xa5')][_0xabc3('0x5a')]({'where':{'messageId':_0x3745ca[_0xabc3('0x63')]['redif']}});}break;}}})['then'](handleEntityNotFound(_0x13eeaf,null))[_0xabc3('0x22')](function(_0x3072cf){if(_0x3072cf){_0x57f886=_0x3072cf;switch(_0x4b9324[_0xabc3('0x40')]){case _0xabc3('0xc2'):if(_0x293f5b===_0xabc3('0xca')){return _0x57f886['update']({'read':!![]});}else{logger['error'](_0xabc3('0x27'),_0xabc3('0x2c'),'skebby',util[_0xabc3('0xc1')](_0x3745ca[_0xabc3('0x63')],{'showHidden':![],'depth':null}));}break;case _0xabc3('0x8b'):if(_0x293f5b==='1'){return _0x57f886[_0xabc3('0x35')]({'read':!![]});}else{logger['error'](_0xabc3('0x27'),_0xabc3('0x2c'),_0xabc3('0xc2'),util[_0xabc3('0xc1')](_0x3745ca[_0xabc3('0x63')],{'showHidden':![],'depth':null}));}break;case _0xabc3('0x8c'):if(!_0x3745ca[_0xabc3('0x63')][_0xabc3('0xcb')]&&_0x293f5b>=0xc8&&_0x293f5b<=0xce){return _0x57f886[_0xabc3('0x35')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status','clicksend',util[_0xabc3('0xc1')](_0x3745ca['body'],{'showHidden':![],'depth':null}));}break;case _0xabc3('0x90'):var _0x3fd77c=_0x3745ca['body']['results'][0x0];if(_0x3fd77c[_0xabc3('0x2c')][_0xabc3('0xc8')]===_0xabc3('0xca')){return _0x57f886[_0xabc3('0x35')]({'read':!![]});}else{logger[_0xabc3('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xabc3('0x2c'),_0xabc3('0x90'),util[_0xabc3('0xc1')](_0x3745ca['body'],{'showHidden':![],'depth':null}));}break;case _0xabc3('0xcc'):if(_0x293f5b==_0xabc3('0xcd')||_0x293f5b==_0xabc3('0xce')){return _0x57f886[_0xabc3('0x35')]({'read':!![]});}else{logger['error'](_0xabc3('0x27'),_0xabc3('0x2c'),_0xabc3('0xcc'),util['inspect'](_0x3745ca[_0xabc3('0x63')],{'showHidden':![],'depth':null}));}break;case _0xabc3('0x94'):if(_0x293f5b=='message-delivered'){return _0x57f886[_0xabc3('0x35')]({'read':!![]});}else{logger[_0xabc3('0x28')](_0xabc3('0x27'),'status','bandwidth',util[_0xabc3('0xc1')](_0x3745ca[_0xabc3('0x63')],{'showHidden':![],'depth':null}));}break;case _0xabc3('0x95'):if(_0x293f5b===_0xabc3('0xcf')||_0x293f5b===_0xabc3('0xd0')){return _0x57f886[_0xabc3('0x35')]({'read':!![]});}else{logger[_0xabc3('0x28')](_0xabc3('0x27'),_0xabc3('0x2c'),_0xabc3('0x95'),util[_0xabc3('0xc1')](_0x3745ca[_0xabc3('0x63')],{'showHidden':![],'depth':null}));}break;}return _0x57f886;}})[_0xabc3('0x22')](respondWithResult(_0x13eeaf,null))[_0xabc3('0x2a')](handleError(_0x13eeaf,null));};exports[_0xabc3('0xd1')]=function(_0x114fb7,_0x34aa27,_0x4ea0e8){var _0x10458e,_0x55ebde,_0x2ad6bf;return db[_0xabc3('0x51')]['find']({'where':{'id':_0x114fb7[_0xabc3('0x57')]['id']}})[_0xabc3('0x22')](handleEntityNotFound(_0x34aa27,null))['then'](function(_0x546dd3){if(_0x546dd3){_0x2ad6bf=_0x546dd3;logger['debug'](_0xabc3('0x27'),_0xabc3('0x2c'),_0xabc3('0xc0'),_0x546dd3[_0xabc3('0x40')],util[_0xabc3('0xc1')](_0x114fb7[_0xabc3('0x43')],{'showHidden':![],'depth':null}));switch(_0x546dd3[_0xabc3('0x40')]){case _0xabc3('0xd2'):if(_0x114fb7[_0xabc3('0x43')][_0xabc3('0xd3')]&&_0x114fb7['query']['state']){_0x55ebde=_0x114fb7[_0xabc3('0x43')]['state'];return db['SmsMessage'][_0xabc3('0x5a')]({'where':{'messageId':_0x114fb7[_0xabc3('0x43')][_0xabc3('0xd3')]}});}break;}}})[_0xabc3('0x22')](handleEntityNotFound(_0x34aa27,null))[_0xabc3('0x22')](function(_0x2a8c45){if(_0x2a8c45){_0x10458e=_0x2a8c45;switch(_0x2ad6bf[_0xabc3('0x40')]){case _0xabc3('0xd2'):if(_0x55ebde==='2'||_0x55ebde==='6'){return _0x10458e['update']({'read':!![]});}else{logger[_0xabc3('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xabc3('0x2c'),_0xabc3('0xd2'),util[_0xabc3('0xc1')](_0x114fb7[_0xabc3('0x43')],{'showHidden':![],'depth':null}));};break;}return _0x10458e;}})[_0xabc3('0x22')](respondWithResult(_0x34aa27,null))[_0xabc3('0x2a')](handleError(_0x34aa27,null));};exports[_0xabc3('0xd4')]=function(_0x15e5ad,_0x5bec2e,_0xd51d26){return db['SmsAccount'][_0xabc3('0x5a')]({'where':{'id':_0x15e5ad[_0xabc3('0x57')]['id']}})[_0xabc3('0x22')](handleEntityNotFound(_0x5bec2e,null))[_0xabc3('0x22')](function(_0x31e659){if(_0x31e659){return _0x31e659['addAgents'](_0x15e5ad[_0xabc3('0x63')]['ids'],_[_0xabc3('0xd5')](_0x15e5ad['body'],[_0xabc3('0x6d'),'id'])||{})[_0xabc3('0xbe')](function(_0x34da3f){for(var _0x1f81f1=0x0;_0x1f81f1<_0x15e5ad[_0xabc3('0x63')][_0xabc3('0x6d')][_0xabc3('0x47')];_0x1f81f1+=0x1){socket[_0xabc3('0xd6')]('userSmsAccount:save',{'UserId':Number(_0x15e5ad['body'][_0xabc3('0x6d')][_0x1f81f1]),'SmsAccountId':Number(_0x15e5ad[_0xabc3('0x57')]['id'])});}return _0x34da3f;});}})[_0xabc3('0x22')](respondWithResult(_0x5bec2e,null))[_0xabc3('0x2a')](handleError(_0x5bec2e,null));};exports[_0xabc3('0xd7')]=function(_0x4c0d85,_0xd5f4d0,_0x5efe99){return db[_0xabc3('0x51')][_0xabc3('0x5a')]({'where':{'id':_0x4c0d85['params']['id']}})['then'](handleEntityNotFound(_0xd5f4d0,null))[_0xabc3('0x22')](function(_0x16d121){if(_0x16d121){return _0x16d121[_0xabc3('0xd7')](_0x4c0d85['query'][_0xabc3('0x6d')])['then'](function(){if(_['isArray'](_0x4c0d85['query'][_0xabc3('0x6d')])){for(var _0x3378a9=0x0;_0x3378a9<_0x4c0d85[_0xabc3('0x43')][_0xabc3('0x6d')]['length'];_0x3378a9+=0x1){socket[_0xabc3('0xd6')](_0xabc3('0xd8'),{'UserId':Number(_0x4c0d85[_0xabc3('0x43')][_0xabc3('0x6d')][_0x3378a9]),'SmsAccountId':Number(_0x4c0d85[_0xabc3('0x57')]['id'])});}}else{socket['emit'](_0xabc3('0xd8'),{'UserId':Number(_0x4c0d85[_0xabc3('0x43')][_0xabc3('0x6d')]),'SmsAccountId':Number(_0x4c0d85[_0xabc3('0x57')]['id'])});}});}})[_0xabc3('0x22')](respondWithStatusCode(_0xd5f4d0,null))['catch'](handleError(_0xd5f4d0,null));};exports['getAgents']=function(_0x560641,_0x3eeb9b,_0x1352bc){var _0x3c43de={};var _0x1fbe77={};var _0x8e465e;var _0x5c3b90;return db[_0xabc3('0x51')][_0xabc3('0x71')]({'where':{'id':_0x560641[_0xabc3('0x57')]['id']}})[_0xabc3('0x22')](handleEntityNotFound(_0x3eeb9b,null))[_0xabc3('0x22')](function(_0x4ff4cb){if(_0x4ff4cb){_0x8e465e=_0x4ff4cb;_0x1fbe77['model']=_[_0xabc3('0x69')](db[_0xabc3('0xa9')][_0xabc3('0x6a')]);_0x1fbe77[_0xabc3('0x43')]=_[_0xabc3('0x69')](_0x560641[_0xabc3('0x43')]);_0x1fbe77[_0xabc3('0x4b')]=_['intersection'](_0x1fbe77[_0xabc3('0x42')],_0x1fbe77[_0xabc3('0x43')]);_0x3c43de[_0xabc3('0x45')]=_[_0xabc3('0x44')](_0x1fbe77['model'],qs[_0xabc3('0x46')](_0x560641[_0xabc3('0x43')]['fields']));_0x3c43de[_0xabc3('0x45')]=_0x3c43de[_0xabc3('0x45')][_0xabc3('0x47')]?_0x3c43de[_0xabc3('0x45')]:_0x1fbe77['model'];_0x3c43de[_0xabc3('0x49')]=qs['sort'](_0x560641[_0xabc3('0x43')][_0xabc3('0x4a')]);_0x3c43de['where']=qs['filters'](_['pick'](_0x560641[_0xabc3('0x43')],_0x1fbe77[_0xabc3('0x4b')]));if(_0x560641[_0xabc3('0x43')][_0xabc3('0x4d')]){_0x3c43de['where']=_[_0xabc3('0x50')](_0x3c43de[_0xabc3('0x4e')],{'$or':_[_0xabc3('0x3e')](_0x3c43de[_0xabc3('0x45')],function(_0x53854f){var _0x813882={};_0x813882[_0x53854f]={'$like':'%'+_0x560641[_0xabc3('0x43')]['filter']+'%'};return _0x813882;})});}_0x3c43de=_[_0xabc3('0x50')]({},_0x3c43de,_0x560641[_0xabc3('0x59')]);return _0x8e465e[_0xabc3('0xd9')](_0x3c43de);}})[_0xabc3('0x22')](function(_0x451698){if(_0x451698){_0x5c3b90=_0x451698['length'];if(!_0x560641['query'][_0xabc3('0x48')](_0xabc3('0x6b'))){_0x3c43de[_0xabc3('0x31')]=qs[_0xabc3('0x31')](_0x560641[_0xabc3('0x43')]['limit']);_0x3c43de[_0xabc3('0x2f')]=qs[_0xabc3('0x2f')](_0x560641[_0xabc3('0x43')][_0xabc3('0x2f')]);}return _0x8e465e[_0xabc3('0xd9')](_0x3c43de);}})[_0xabc3('0x22')](function(_0x1b1caa){if(_0x1b1caa){return _0x1b1caa?{'count':_0x5c3b90,'rows':_0x1b1caa}:null;}})[_0xabc3('0x22')](respondWithResult(_0x3eeb9b,null))['catch'](handleError(_0x3eeb9b,null));}; \ No newline at end of file +var _0x20cc=['getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','defaults','redis','localhost','./smsAccount.socket','register','jayson/promise','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','stack','name','send','index','Pause','SmsAccount','key','map','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','VIRTUAL','include','findAll','rows','mandatoryDispositionPause','rawAttributes','fields','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsAccounts','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','destroy','describe','Disposition','getDispositions','findOne','pick','SmsAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','SmsApplication','Applications','account','applications','priority','asc','CmContact','Sequelize','ValidationError','difference','CompanyId','ListId','twilio','From','Body','messageId','MessageSid','text','connectel','from','clicksend','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','updatedAt','DESC','list','Contacts','SmsInteraction','spread','interaction','get','push','close','unmanaged','*,*,*,*','created','SmsMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','startRouting','Start','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','\x0a','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','internal','color','tag','List','out','dataValues','Messages','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','statusInt','requestid','message_id','status_code','groupName','DELIVERED','redif','error_code','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','statusGet','message-id','state','addAgents','omit','userSmsAccount:save','removeAgents','userSmsAccount:remove','emit'];(function(_0x534777,_0x1b3740){var _0xc66b4a=function(_0x511f06){while(--_0x511f06){_0x534777['push'](_0x534777['shift']());}};_0xc66b4a(++_0x1b3740);}(_0x20cc,0x1c1));var _0xc20c=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x20cc[_0x550d12];return _0x12103d;};'use strict';var emlformat=require(_0xc20c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc20c('0x1'));var jsonpatch=require(_0xc20c('0x2'));var rp=require(_0xc20c('0x3'));var moment=require(_0xc20c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc20c('0x5'));var util=require(_0xc20c('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xc20c('0x7'));var ejs=require(_0xc20c('0x8'));var fs=require('fs');var fs_extra=require(_0xc20c('0x9'));var _=require(_0xc20c('0xa'));var squel=require(_0xc20c('0xb'));var crypto=require(_0xc20c('0xc'));var jsforce=require(_0xc20c('0xd'));var deskjs=require(_0xc20c('0xe'));var toCsv=require(_0xc20c('0x7'));var querystring=require(_0xc20c('0xf'));var Papa=require(_0xc20c('0x10'));var Redis=require(_0xc20c('0x11'));var authService=require(_0xc20c('0x12'));var qs=require(_0xc20c('0x13'));var as=require(_0xc20c('0x14'));var hardwareService=require(_0xc20c('0x15'));var logger=require('../../config/logger')(_0xc20c('0x16'));var utils=require('../../config/utils');var config=require(_0xc20c('0x17'));var licenseUtil=require(_0xc20c('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xc20c('0x19')](config[_0xc20c('0x1a')],{'host':_0xc20c('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc20c('0x1c'))[_0xc20c('0x1d')](socket);var jayson=require(_0xc20c('0x1e'));var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x19b3a0,_0xf9f82e,_0x488659,_0x39e81c){return new BPromise(function(_0x2a1145,_0x545a38){var _0x2cc429=_0x39e81c||client;return _0x2cc429[_0xc20c('0x1f')](_0x19b3a0,_0x488659)[_0xc20c('0x20')](function(_0x3c0c02){logger[_0xc20c('0x21')](_0xc20c('0x22'),_0xf9f82e,_0xc20c('0x23'));logger[_0xc20c('0x24')](_0xc20c('0x25'),_0xf9f82e,_0xc20c('0x23'),JSON[_0xc20c('0x26')](_0x3c0c02));if(_0x3c0c02[_0xc20c('0x27')]){if(_0x3c0c02['error'][_0xc20c('0x28')]===0x1f4){logger['error'](_0xc20c('0x22'),_0xf9f82e,_0x3c0c02[_0xc20c('0x27')][_0xc20c('0x29')]);return _0x545a38(_0x3c0c02[_0xc20c('0x27')][_0xc20c('0x29')]);}logger[_0xc20c('0x27')](_0xc20c('0x22'),_0xf9f82e,_0x3c0c02[_0xc20c('0x27')][_0xc20c('0x29')]);return _0x2a1145(_0x3c0c02['error'][_0xc20c('0x29')]);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0xf9f82e,_0xc20c('0x23'));_0x2a1145(_0x3c0c02[_0xc20c('0x2a')][_0xc20c('0x29')]);}})[_0xc20c('0x2b')](function(_0x2b441c){logger[_0xc20c('0x27')](_0xc20c('0x22'),_0xf9f82e,_0x2b441c);_0x545a38(_0x2b441c);});});}function respondWithStatusCode(_0x485336,_0x2dd42e){_0x2dd42e=_0x2dd42e||0xcc;return function(_0x316535){if(_0x316535){return _0x485336[_0xc20c('0x2c')](_0x2dd42e);}return _0x485336[_0xc20c('0x2d')](_0x2dd42e)[_0xc20c('0x2e')]();};}function respondWithResult(_0x104458,_0x5e355f){_0x5e355f=_0x5e355f||0xc8;return function(_0x555c24){if(_0x555c24){return _0x104458[_0xc20c('0x2d')](_0x5e355f)['json'](_0x555c24);}};}function respondWithFilteredResult(_0x41e79a,_0x388422){return function(_0x54e6be){if(_0x54e6be){var _0x26eacf=typeof _0x388422[_0xc20c('0x2f')]===_0xc20c('0x30')&&typeof _0x388422[_0xc20c('0x31')]===_0xc20c('0x30');var _0xd309a1=_0x54e6be[_0xc20c('0x32')];var _0x1abf65=_0x26eacf?0x0:_0x388422[_0xc20c('0x2f')];var _0x156cd7=_0x26eacf?_0x54e6be[_0xc20c('0x32')]:_0x388422[_0xc20c('0x2f')]+_0x388422[_0xc20c('0x31')];var _0x36833f;if(_0x156cd7>=_0xd309a1){_0x156cd7=_0xd309a1;_0x36833f=0xc8;}else{_0x36833f=0xce;}_0x41e79a['status'](_0x36833f);return _0x41e79a[_0xc20c('0x33')](_0xc20c('0x34'),_0x1abf65+'-'+_0x156cd7+'/'+_0xd309a1)[_0xc20c('0x35')](_0x54e6be);}return null;};}function patchUpdates(_0x3f4533){return function(_0x3f6039){try{jsonpatch['apply'](_0x3f6039,_0x3f4533,!![]);}catch(_0x3b476c){return BPromise[_0xc20c('0x36')](_0x3b476c);}return _0x3f6039[_0xc20c('0x37')]();};}function saveUpdates(_0x49dc96,_0x5e7d95){return function(_0x4b9c34){if(_0x4b9c34){return _0x4b9c34['update'](_0x49dc96)[_0xc20c('0x20')](function(_0x5efd0d){return _0x5efd0d;});}return null;};}function removeEntity(_0x12ceb3,_0x14c698){return function(_0x34bee7){if(_0x34bee7){return _0x34bee7['destroy']()[_0xc20c('0x20')](function(){var _0x36ef8f=_0x34bee7['get']({'plain':!![]});var _0x2c551d='SmsAccounts';return db['UserProfileResource']['destroy']({'where':{'type':_0x2c551d,'resourceId':_0x36ef8f['id']}})['then'](function(){return _0x34bee7;});})[_0xc20c('0x20')](function(){_0x12ceb3[_0xc20c('0x2d')](0xcc)[_0xc20c('0x2e')]();});}};}function handleEntityNotFound(_0x5c13f4,_0x38a226){return function(_0x1b19b7){if(!_0x1b19b7){_0x5c13f4[_0xc20c('0x2c')](0x194);}return _0x1b19b7;};}function handleError(_0x2a897e,_0x3aa0df){_0x3aa0df=_0x3aa0df||0x1f4;return function(_0x13f961){logger[_0xc20c('0x27')](_0x13f961[_0xc20c('0x38')]);if(_0x13f961[_0xc20c('0x39')]){delete _0x13f961[_0xc20c('0x39')];}_0x2a897e[_0xc20c('0x2d')](_0x3aa0df)[_0xc20c('0x3a')](_0x13f961);};}exports[_0xc20c('0x3b')]=function(_0x28efba,_0x3f0445){var _0x48165c={'include':[{'model':db[_0xc20c('0x3c')],'as':'mandatoryDispositionPause'}]},_0x351fd1={},_0x5e8a96={'count':0x0,'rows':[]};var _0x386d6f=_['map'](db[_0xc20c('0x3d')]['rawAttributes'],function(_0x258196){return{'name':_0x258196['fieldName'],'type':_0x258196['type'][_0xc20c('0x3e')]};});_0x351fd1['model']=_[_0xc20c('0x3f')](_0x386d6f,_0xc20c('0x39'));_0x351fd1[_0xc20c('0x40')]=_[_0xc20c('0x41')](_0x28efba[_0xc20c('0x40')]);_0x351fd1[_0xc20c('0x42')]=_[_0xc20c('0x43')](_0x351fd1[_0xc20c('0x44')],_0x351fd1[_0xc20c('0x40')]);_0x48165c['attributes']=_[_0xc20c('0x43')](_0x351fd1[_0xc20c('0x44')],qs['fields'](_0x28efba[_0xc20c('0x40')]['fields']));_0x48165c[_0xc20c('0x45')]=_0x48165c[_0xc20c('0x45')][_0xc20c('0x46')]?_0x48165c[_0xc20c('0x45')]:_0x351fd1[_0xc20c('0x44')];if(!_0x28efba[_0xc20c('0x40')][_0xc20c('0x47')](_0xc20c('0x48'))){_0x48165c['limit']=qs['limit'](_0x28efba[_0xc20c('0x40')][_0xc20c('0x31')]);_0x48165c[_0xc20c('0x2f')]=qs[_0xc20c('0x2f')](_0x28efba['query']['offset']);}_0x48165c[_0xc20c('0x49')]=qs[_0xc20c('0x4a')](_0x28efba[_0xc20c('0x40')][_0xc20c('0x4a')]);_0x48165c['where']=qs[_0xc20c('0x42')](_['pick'](_0x28efba[_0xc20c('0x40')],_0x351fd1[_0xc20c('0x42')]),_0x386d6f);if(_0x28efba[_0xc20c('0x40')][_0xc20c('0x4b')]){_0x48165c[_0xc20c('0x4c')]=_[_0xc20c('0x4d')](_0x48165c['where'],{'$or':_[_0xc20c('0x3f')](_0x386d6f,function(_0x39dedf){if(_0x39dedf[_0xc20c('0x4e')]!==_0xc20c('0x4f')){var _0x6c0958={};_0x6c0958[_0x39dedf['name']]={'$like':'%'+_0x28efba[_0xc20c('0x40')][_0xc20c('0x4b')]+'%'};return _0x6c0958;}})});}_0x48165c=_[_0xc20c('0x4d')]({},_0x48165c,_0x28efba['options']);var _0x32a5ad={'where':_0x48165c[_0xc20c('0x4c')]};return db['SmsAccount'][_0xc20c('0x32')](_0x32a5ad)[_0xc20c('0x20')](function(_0x46de58){_0x5e8a96[_0xc20c('0x32')]=_0x46de58;if(_0x28efba['query']['includeAll']){_0x48165c[_0xc20c('0x50')]=[{'all':!![]}];}return db['SmsAccount'][_0xc20c('0x51')](_0x48165c);})[_0xc20c('0x20')](function(_0x4273db){_0x5e8a96[_0xc20c('0x52')]=_0x4273db;return _0x5e8a96;})[_0xc20c('0x20')](respondWithFilteredResult(_0x3f0445,_0x48165c))[_0xc20c('0x2b')](handleError(_0x3f0445,null));};exports['show']=function(_0x540bb9,_0x1900ce){var _0x113c66={'raw':![],'where':{'id':_0x540bb9['params']['id']},'include':[{'model':db['Pause'],'as':_0xc20c('0x53')}]},_0x19a870={};_0x19a870[_0xc20c('0x44')]=_['keys'](db[_0xc20c('0x3d')][_0xc20c('0x54')]);_0x19a870[_0xc20c('0x40')]=_[_0xc20c('0x41')](_0x540bb9[_0xc20c('0x40')]);_0x19a870[_0xc20c('0x42')]=_['intersection'](_0x19a870['model'],_0x19a870[_0xc20c('0x40')]);_0x113c66['attributes']=_[_0xc20c('0x43')](_0x19a870[_0xc20c('0x44')],qs[_0xc20c('0x55')](_0x540bb9[_0xc20c('0x40')][_0xc20c('0x55')]));_0x113c66[_0xc20c('0x45')]=_0x113c66[_0xc20c('0x45')][_0xc20c('0x46')]?_0x113c66['attributes']:_0x19a870['model'];if(_0x540bb9[_0xc20c('0x40')][_0xc20c('0x56')]){_0x113c66[_0xc20c('0x50')]=[{'all':!![]}];}_0x113c66=_[_0xc20c('0x4d')]({},_0x113c66,_0x540bb9[_0xc20c('0x57')]);return db[_0xc20c('0x3d')][_0xc20c('0x58')](_0x113c66)['then'](handleEntityNotFound(_0x1900ce,null))['then'](respondWithResult(_0x1900ce,null))[_0xc20c('0x2b')](handleError(_0x1900ce,null));};exports[_0xc20c('0x59')]=function(_0x393736,_0x3c19ca){return db[_0xc20c('0x3d')][_0xc20c('0x59')](_0x393736[_0xc20c('0x5a')],{})['then'](function(_0x444048){var _0x1eb357=_0x393736[_0xc20c('0x5b')]['get']({'plain':!![]});if(!_0x1eb357)throw new Error(_0xc20c('0x5c'));if(_0x1eb357[_0xc20c('0x5d')]===_0xc20c('0x5b')){var _0x1e82df=_0x444048['get']({'plain':!![]});var _0x5df354=_0xc20c('0x5e');return db[_0xc20c('0x5f')]['find']({'where':{'name':_0x5df354,'userProfileId':_0x1eb357[_0xc20c('0x60')]},'raw':!![]})[_0xc20c('0x20')](function(_0x18bf72){if(_0x18bf72&&_0x18bf72[_0xc20c('0x61')]===0x0){return db[_0xc20c('0x62')][_0xc20c('0x59')]({'name':_0x1e82df['name'],'resourceId':_0x1e82df['id'],'type':_0x18bf72['name'],'sectionId':_0x18bf72['id']},{})[_0xc20c('0x20')](function(){return _0x444048;});}else{return _0x444048;}})[_0xc20c('0x2b')](function(_0x378414){logger[_0xc20c('0x27')](_0xc20c('0x63'),_0x378414);throw _0x378414;});}return _0x444048;})['then'](respondWithResult(_0x3c19ca,0xc9))[_0xc20c('0x2b')](handleError(_0x3c19ca,null));};exports[_0xc20c('0x64')]=function(_0x5f223b,_0x147b61){if(_0x5f223b[_0xc20c('0x5a')]['id']){delete _0x5f223b[_0xc20c('0x5a')]['id'];}return db['SmsAccount'][_0xc20c('0x58')]({'where':{'id':_0x5f223b[_0xc20c('0x65')]['id']},'include':[{'model':db[_0xc20c('0x3c')],'as':_0xc20c('0x53')}]})[_0xc20c('0x20')](handleEntityNotFound(_0x147b61,null))[_0xc20c('0x20')](saveUpdates(_0x5f223b[_0xc20c('0x5a')],null))[_0xc20c('0x20')](respondWithResult(_0x147b61,null))[_0xc20c('0x2b')](handleError(_0x147b61,null));};exports[_0xc20c('0x66')]=function(_0x3276db,_0x3f7987){return db[_0xc20c('0x3d')][_0xc20c('0x58')]({'where':{'id':_0x3276db[_0xc20c('0x65')]['id']}})['then'](handleEntityNotFound(_0x3f7987,null))['then'](removeEntity(_0x3f7987,null))[_0xc20c('0x2b')](handleError(_0x3f7987,null));};exports[_0xc20c('0x67')]=function(_0x108bc4,_0x366434){return db[_0xc20c('0x3d')][_0xc20c('0x67')]()[_0xc20c('0x20')](respondWithResult(_0x366434,null))[_0xc20c('0x2b')](handleError(_0x366434,null));};exports['addDisposition']=function(_0x354945,_0x49f0d7,_0x4e73fa){if(_0x354945[_0xc20c('0x5a')]['id']){delete _0x354945[_0xc20c('0x5a')]['id'];}return db[_0xc20c('0x3d')]['find']({'where':{'id':_0x354945['params']['id']}})[_0xc20c('0x20')](handleEntityNotFound(_0x49f0d7,null))[_0xc20c('0x20')](function(_0x2c40bf){if(_0x2c40bf){_0x354945[_0xc20c('0x5a')]['SmsAccountId']=_0x2c40bf['id'];return db[_0xc20c('0x68')][_0xc20c('0x59')](_0x354945[_0xc20c('0x5a')]);}})[_0xc20c('0x20')](respondWithResult(_0x49f0d7,null))[_0xc20c('0x2b')](handleError(_0x49f0d7,null));};exports[_0xc20c('0x69')]=function(_0x2f7991,_0x32c0cd,_0x2224de){var _0xda4fcb={'raw':![],'where':{}};var _0x52ed9e={};var _0x332510={'count':0x0,'rows':[]};return db['SmsAccount'][_0xc20c('0x6a')]({'where':{'id':_0x2f7991[_0xc20c('0x65')]['id']}})[_0xc20c('0x20')](handleEntityNotFound(_0x32c0cd,null))[_0xc20c('0x20')](function(_0x520ae6){if(_0x520ae6){_0x52ed9e['model']=_[_0xc20c('0x41')](db['Disposition'][_0xc20c('0x54')]);_0x52ed9e[_0xc20c('0x40')]=_[_0xc20c('0x41')](_0x2f7991[_0xc20c('0x40')]);_0x52ed9e[_0xc20c('0x42')]=_[_0xc20c('0x43')](_0x52ed9e[_0xc20c('0x44')],_0x52ed9e[_0xc20c('0x40')]);_0xda4fcb[_0xc20c('0x45')]=_[_0xc20c('0x43')](_0x52ed9e['model'],qs[_0xc20c('0x55')](_0x2f7991['query']['fields']));_0xda4fcb[_0xc20c('0x45')]=_0xda4fcb[_0xc20c('0x45')]['length']?_0xda4fcb[_0xc20c('0x45')]:_0x52ed9e[_0xc20c('0x44')];if(!_0x2f7991['query'][_0xc20c('0x47')]('nolimit')){_0xda4fcb['limit']=qs[_0xc20c('0x31')](_0x2f7991[_0xc20c('0x40')][_0xc20c('0x31')]);_0xda4fcb['offset']=qs['offset'](_0x2f7991['query'][_0xc20c('0x2f')]);}_0xda4fcb[_0xc20c('0x49')]=qs[_0xc20c('0x4a')](_0x2f7991[_0xc20c('0x40')][_0xc20c('0x4a')]);_0xda4fcb['where']=qs['filters'](_[_0xc20c('0x6b')](_0x2f7991[_0xc20c('0x40')],_0x52ed9e['filters']));_0xda4fcb[_0xc20c('0x4c')][_0xc20c('0x6c')]=_0x520ae6['id'];if(_0x2f7991[_0xc20c('0x40')][_0xc20c('0x4b')]){_0xda4fcb[_0xc20c('0x4c')]=_[_0xc20c('0x4d')](_0xda4fcb[_0xc20c('0x4c')],{'$or':_[_0xc20c('0x3f')](_0xda4fcb['attributes'],function(_0x157b60){var _0x61a25f={};_0x61a25f[_0x157b60]={'$like':'%'+_0x2f7991[_0xc20c('0x40')][_0xc20c('0x4b')]+'%'};return _0x61a25f;})});}_0xda4fcb=_['merge']({},_0xda4fcb,_0x2f7991[_0xc20c('0x57')]);return db[_0xc20c('0x68')]['count']({'where':_0xda4fcb[_0xc20c('0x4c')]})[_0xc20c('0x20')](function(_0x8bbb46){_0x332510[_0xc20c('0x32')]=_0x8bbb46;if(_0x2f7991['query'][_0xc20c('0x56')]){_0xda4fcb['include']=[{'all':!![]}];}return db[_0xc20c('0x68')][_0xc20c('0x51')](_0xda4fcb);})[_0xc20c('0x20')](function(_0x991b27){_0x332510[_0xc20c('0x52')]=_0x991b27;return _0x332510;});}})[_0xc20c('0x20')](respondWithFilteredResult(_0x32c0cd,_0xda4fcb))['catch'](handleError(_0x32c0cd,null));};exports[_0xc20c('0x6d')]=function(_0x40b1c2,_0x170d6a,_0x25ecdc){return db[_0xc20c('0x3d')][_0xc20c('0x58')]({'where':{'id':_0x40b1c2[_0xc20c('0x65')]['id']}})[_0xc20c('0x20')](handleEntityNotFound(_0x170d6a,null))[_0xc20c('0x20')](function(_0x269021){if(_0x269021){return _0x269021[_0xc20c('0x6d')](_0x40b1c2[_0xc20c('0x40')][_0xc20c('0x6e')]);}})['then'](respondWithStatusCode(_0x170d6a,null))[_0xc20c('0x2b')](handleError(_0x170d6a,null));};exports[_0xc20c('0x6f')]=function(_0x1a61bf,_0x599142,_0xfa18e6){if(_0x1a61bf[_0xc20c('0x5a')]['id']){delete _0x1a61bf['body']['id'];}return db[_0xc20c('0x3d')]['find']({'where':{'id':_0x1a61bf[_0xc20c('0x65')]['id']}})[_0xc20c('0x20')](handleEntityNotFound(_0x599142,null))[_0xc20c('0x20')](function(_0x3155e9){if(_0x3155e9){_0x1a61bf[_0xc20c('0x5a')][_0xc20c('0x6c')]=_0x3155e9['id'];return db[_0xc20c('0x70')][_0xc20c('0x59')](_0x1a61bf[_0xc20c('0x5a')]);}})[_0xc20c('0x20')](respondWithResult(_0x599142,null))[_0xc20c('0x2b')](handleError(_0x599142,null));};exports[_0xc20c('0x71')]=function(_0x5cd61f,_0x3c11ed,_0x5bfc9b){var _0x2b12bc={'raw':![],'where':{}};var _0x21fef4={};var _0x5c798f={'count':0x0,'rows':[]};return db[_0xc20c('0x3d')][_0xc20c('0x6a')]({'where':{'id':_0x5cd61f[_0xc20c('0x65')]['id']}})[_0xc20c('0x20')](handleEntityNotFound(_0x3c11ed,null))[_0xc20c('0x20')](function(_0xf2840e){if(_0xf2840e){_0x21fef4[_0xc20c('0x44')]=_['keys'](db['CannedAnswer'][_0xc20c('0x54')]);_0x21fef4[_0xc20c('0x40')]=_['keys'](_0x5cd61f[_0xc20c('0x40')]);_0x21fef4[_0xc20c('0x42')]=_['intersection'](_0x21fef4['model'],_0x21fef4['query']);_0x2b12bc['attributes']=_[_0xc20c('0x43')](_0x21fef4[_0xc20c('0x44')],qs['fields'](_0x5cd61f[_0xc20c('0x40')][_0xc20c('0x55')]));_0x2b12bc[_0xc20c('0x45')]=_0x2b12bc[_0xc20c('0x45')]['length']?_0x2b12bc[_0xc20c('0x45')]:_0x21fef4['model'];if(!_0x5cd61f[_0xc20c('0x40')]['hasOwnProperty']('nolimit')){_0x2b12bc['limit']=qs[_0xc20c('0x31')](_0x5cd61f['query'][_0xc20c('0x31')]);_0x2b12bc[_0xc20c('0x2f')]=qs[_0xc20c('0x2f')](_0x5cd61f[_0xc20c('0x40')]['offset']);}_0x2b12bc[_0xc20c('0x49')]=qs[_0xc20c('0x4a')](_0x5cd61f[_0xc20c('0x40')]['sort']);_0x2b12bc['where']=qs[_0xc20c('0x42')](_[_0xc20c('0x6b')](_0x5cd61f[_0xc20c('0x40')],_0x21fef4[_0xc20c('0x42')]));_0x2b12bc[_0xc20c('0x4c')]['SmsAccountId']=_0xf2840e['id'];if(_0x5cd61f[_0xc20c('0x40')][_0xc20c('0x4b')]){_0x2b12bc[_0xc20c('0x4c')]=_[_0xc20c('0x4d')](_0x2b12bc[_0xc20c('0x4c')],{'$or':_['map'](_0x2b12bc[_0xc20c('0x45')],function(_0x2cf50c){var _0x367497={};_0x367497[_0x2cf50c]={'$like':'%'+_0x5cd61f['query'][_0xc20c('0x4b')]+'%'};return _0x367497;})});}_0x2b12bc=_[_0xc20c('0x4d')]({},_0x2b12bc,_0x5cd61f['options']);return db[_0xc20c('0x70')]['count']({'where':_0x2b12bc['where']})[_0xc20c('0x20')](function(_0x1b8d55){_0x5c798f[_0xc20c('0x32')]=_0x1b8d55;if(_0x5cd61f[_0xc20c('0x40')][_0xc20c('0x56')]){_0x2b12bc['include']=[{'all':!![]}];}return db[_0xc20c('0x70')]['findAll'](_0x2b12bc);})[_0xc20c('0x20')](function(_0x37db10){_0x5c798f[_0xc20c('0x52')]=_0x37db10;return _0x5c798f;});}})[_0xc20c('0x20')](respondWithFilteredResult(_0x3c11ed,_0x2b12bc))[_0xc20c('0x2b')](handleError(_0x3c11ed,null));};exports[_0xc20c('0x72')]=function(_0x1a0398,_0x15a1d5,_0x1d1bd0){return db['SmsAccount']['find']({'where':{'id':_0x1a0398[_0xc20c('0x65')]['id']}})['then'](handleEntityNotFound(_0x15a1d5,null))[_0xc20c('0x20')](function(_0x12efb8){if(_0x12efb8){return _0x12efb8[_0xc20c('0x72')](_0x1a0398[_0xc20c('0x40')]['ids']);}})[_0xc20c('0x20')](respondWithStatusCode(_0x15a1d5,null))[_0xc20c('0x2b')](handleError(_0x15a1d5,null));};exports['notify']=function(_0x1df3ad,_0x2d561a,_0x5c63cd){var _0x14ff64={'channel':'sms'};var _0x3d353b=[];var _0x506f18=[];var _0x2bba03={};return db[_0xc20c('0x3d')]['find']({'where':{'id':_0x1df3ad['params']['id']},'include':[{'model':db[_0xc20c('0x73')],'as':_0xc20c('0x74')}]})[_0xc20c('0x20')](handleEntityNotFound(_0x2d561a,null))['then'](function(_0x19aa2b){_0x14ff64[_0xc20c('0x75')]=_0x19aa2b;_0x14ff64[_0xc20c('0x76')]=_['orderBy'](_0x19aa2b[_0xc20c('0x74')],[_0xc20c('0x77')],[_0xc20c('0x78')]);if(_0x14ff64[_0xc20c('0x75')]['Applications']){delete _0x14ff64[_0xc20c('0x75')][_0xc20c('0x74')];}return db[_0xc20c('0x79')][_0xc20c('0x67')]();})[_0xc20c('0x20')](function(_0x4c546b){if(!_0x4c546b){throw new db[(_0xc20c('0x7a'))][(_0xc20c('0x7b'))]('no\x20available\x20attributes');}_0x3d353b=_[_0xc20c('0x7c')](_[_0xc20c('0x41')](_0x4c546b),['createdAt','updatedAt']);_0x506f18=_['difference'](_['keys'](_0x4c546b),['createdAt','updatedAt',_0xc20c('0x7d'),_0xc20c('0x7e')]);_0x14ff64[_0xc20c('0x5a')]={'mapKey':'mobile'};if(_0x14ff64[_0xc20c('0x75')][_0xc20c('0x4e')]){switch(_0x14ff64[_0xc20c('0x75')][_0xc20c('0x4e')]){case _0xc20c('0x7f'):_0x14ff64[_0xc20c('0x5a')]['from']=_0x1df3ad[_0xc20c('0x5a')][_0xc20c('0x80')];_0x14ff64['body'][_0xc20c('0x5a')]=_0x1df3ad[_0xc20c('0x5a')][_0xc20c('0x81')];_0x14ff64[_0xc20c('0x5a')][_0xc20c('0x82')]=_0x1df3ad[_0xc20c('0x5a')][_0xc20c('0x83')];break;case'skebby':_0x14ff64[_0xc20c('0x5a')]['from']='+'+_0x1df3ad['body']['sender'];_0x14ff64[_0xc20c('0x5a')][_0xc20c('0x5a')]=_0x1df3ad[_0xc20c('0x5a')][_0xc20c('0x84')];break;case _0xc20c('0x85'):_0x14ff64[_0xc20c('0x5a')][_0xc20c('0x86')]=_0x1df3ad[_0xc20c('0x5a')]['from'];_0x14ff64[_0xc20c('0x5a')][_0xc20c('0x5a')]=_0x1df3ad[_0xc20c('0x5a')][_0xc20c('0x29')];break;case _0xc20c('0x87'):_0x14ff64[_0xc20c('0x5a')]['from']=_0x1df3ad[_0xc20c('0x5a')][_0xc20c('0x86')];_0x14ff64[_0xc20c('0x5a')]['body']=_0x1df3ad['body'][_0xc20c('0x5a')];_0x14ff64[_0xc20c('0x5a')][_0xc20c('0x82')]=_0x1df3ad[_0xc20c('0x5a')]['message_id'];break;case _0xc20c('0x88'):_0x14ff64['body'][_0xc20c('0x86')]=_0x1df3ad[_0xc20c('0x5a')]['From'];_0x14ff64[_0xc20c('0x5a')][_0xc20c('0x5a')]=_0x1df3ad[_0xc20c('0x5a')][_0xc20c('0x89')];_0x14ff64['body'][_0xc20c('0x82')]=_0x1df3ad[_0xc20c('0x5a')][_0xc20c('0x8a')];break;case _0xc20c('0x8b'):_0x14ff64[_0xc20c('0x5a')][_0xc20c('0x86')]='+'+_0x1df3ad['body'][_0xc20c('0x8c')][0x0]['from'];_0x14ff64['body']['body']=_0x1df3ad[_0xc20c('0x5a')][_0xc20c('0x8c')][0x0][_0xc20c('0x84')];_0x14ff64[_0xc20c('0x5a')][_0xc20c('0x82')]=_0x1df3ad[_0xc20c('0x5a')][_0xc20c('0x8c')][0x0][_0xc20c('0x82')];break;case _0xc20c('0x8d'):_0x14ff64[_0xc20c('0x5a')][_0xc20c('0x86')]=_0x1df3ad[_0xc20c('0x5a')][_0xc20c('0x8e')];_0x14ff64[_0xc20c('0x5a')][_0xc20c('0x5a')]=_0x1df3ad[_0xc20c('0x5a')][_0xc20c('0x8f')][_0xc20c('0x29')];break;case _0xc20c('0x90'):_0x14ff64[_0xc20c('0x5a')][_0xc20c('0x86')]=_0x1df3ad[_0xc20c('0x5a')][_0xc20c('0x91')];_0x14ff64['body']['body']=_0x1df3ad['body'][_0xc20c('0x84')];_0x14ff64['body'][_0xc20c('0x82')]=_0x1df3ad[_0xc20c('0x5a')][_0xc20c('0x92')];break;case _0xc20c('0x93'):_0x14ff64[_0xc20c('0x5a')]['messageId']=_0x1df3ad[_0xc20c('0x5a')][0x0][_0xc20c('0x29')]['id'];_0x14ff64[_0xc20c('0x5a')][_0xc20c('0x86')]=_0x1df3ad[_0xc20c('0x5a')][0x0][_0xc20c('0x29')][_0xc20c('0x86')];_0x14ff64['body']['body']=_0x1df3ad[_0xc20c('0x5a')][0x0][_0xc20c('0x29')]['text'];break;case _0xc20c('0x94'):_0x14ff64['body'][_0xc20c('0x86')]=_0x1df3ad[_0xc20c('0x5a')][_0xc20c('0x86')];_0x14ff64[_0xc20c('0x5a')][_0xc20c('0x5a')]=_0x1df3ad[_0xc20c('0x5a')]['message'];_0x14ff64[_0xc20c('0x5a')][_0xc20c('0x82')]=_0x1df3ad[_0xc20c('0x5a')][_0xc20c('0x95')];break;}}if(_0x14ff64[_0xc20c('0x5a')]['id']){delete _0x14ff64[_0xc20c('0x5a')]['id'];}if(_['isNil'](_0x14ff64['body'][_0xc20c('0x86')])){throw new db[(_0xc20c('0x7a'))][(_0xc20c('0x7b'))](_0xc20c('0x96'));}if(_[_0xc20c('0x97')](_0x14ff64[_0xc20c('0x5a')][_0xc20c('0x5a')])||_0x14ff64[_0xc20c('0x5a')]['body']===''){throw new db[(_0xc20c('0x7a'))][(_0xc20c('0x7b'))](_0xc20c('0x98'));}if(_[_0xc20c('0x97')](_0x14ff64[_0xc20c('0x5a')][_0xc20c('0x99')])){throw new db['Sequelize'][(_0xc20c('0x7b'))](_0xc20c('0x9a')+_0x506f18);}if(!_['includes'](_0x506f18,_0x14ff64[_0xc20c('0x5a')]['mapKey'])){throw new db[(_0xc20c('0x7a'))][(_0xc20c('0x7b'))](_0xc20c('0x9b')+_0x506f18);}_0x2bba03[_0x14ff64[_0xc20c('0x5a')][_0xc20c('0x99')]]=_0x14ff64['body'][_0xc20c('0x86')];return db['CmList'][_0xc20c('0x58')]({'where':{'id':_0x14ff64['account']['ListId']},'include':[{'model':db[_0xc20c('0x79')],'as':'Contacts','where':_0x2bba03,'limit':0x1,'order':[[_0xc20c('0x9c'),_0xc20c('0x9d')]]}]});})[_0xc20c('0x20')](handleEntityNotFound(_0x2d561a,null))['then'](function(_0x320a68){if(_0x320a68){_0x14ff64[_0xc20c('0x9e')]=_['omit'](_0x320a68,[_0xc20c('0x9f')]);if(_0x320a68[_0xc20c('0x9f')][_0xc20c('0x46')]){return _0x320a68[_0xc20c('0x9f')][0x0];}var _0x4ac3e2=_[_0xc20c('0x19')](_0x14ff64['body'],{'firstName':_0x14ff64[_0xc20c('0x5a')][_0xc20c('0x86')],'ListId':_0x320a68['id']});_0x4ac3e2[_0x14ff64['body'][_0xc20c('0x99')]]=_0x14ff64[_0xc20c('0x5a')][_0xc20c('0x86')];return db[_0xc20c('0x79')][_0xc20c('0x59')](_0x4ac3e2,{'fields':_0x3d353b,'raw':!![]});}})[_0xc20c('0x20')](handleEntityNotFound(_0x2d561a,null))[_0xc20c('0x20')](function(_0x3866bb){if(_0x3866bb){_0x14ff64['contact']=_0x3866bb;var _0x2e6ee5={'ContactId':_0x3866bb['id'],'phone':_0x14ff64[_0xc20c('0x5a')][_0xc20c('0x86')],'SmsAccountId':_0x1df3ad[_0xc20c('0x65')]['id']};var _0xa34a5={'ContactId':_0x3866bb['id'],'SmsAccountId':_0x1df3ad[_0xc20c('0x65')]['id'],'closed':![]};return db[_0xc20c('0xa0')]['find']({'where':_0xa34a5})[_0xc20c('0x20')](function(_0x3559c6){if(_0x3559c6){return[_0x3559c6,![]];}return db[_0xc20c('0xa0')][_0xc20c('0x59')](_0x2e6ee5)[_0xc20c('0x20')](function(_0x2e27aa){return[_0x2e27aa,!![]];});});}})[_0xc20c('0xa1')](function(_0x4f413b,_0x101764){_0x14ff64[_0xc20c('0xa2')]=_0x4f413b[_0xc20c('0xa3')]({'plain':!![]});_0x14ff64['interaction']['created']=![];if(_0x101764){if(_0x14ff64[_0xc20c('0x75')]['autoclose']){_0x14ff64[_0xc20c('0x76')][_0xc20c('0xa4')]({'id':0x0,'priority':_0x14ff64[_0xc20c('0x76')][_0xc20c('0x46')]+0x1,'app':_0xc20c('0xa5'),'appdata':_0xc20c('0xa6'),'interval':_0xc20c('0xa7')});}_0x14ff64['interaction'][_0xc20c('0xa8')]=!![];}return db[_0xc20c('0xa9')][_0xc20c('0x59')]({'phone':_0x14ff64[_0xc20c('0x5a')][_0xc20c('0x86')],'messageId':_0x14ff64['body'][_0xc20c('0x82')],'body':_0x14ff64[_0xc20c('0x5a')][_0xc20c('0x5a')],'SmsAccountId':_0x1df3ad[_0xc20c('0x65')]['id'],'SmsInteractionId':_0x4f413b['id'],'direction':'in','ContactId':_0x4f413b['ContactId'],'AttachmentId':_0x14ff64['body'][_0xc20c('0xaa')]});})[_0xc20c('0x20')](function(_0xe2648d){_0x14ff64['message']=_0xe2648d;if(_0x14ff64[_0xc20c('0xa2')][_0xc20c('0xab')]){return db[_0xc20c('0xac')][_0xc20c('0x58')]({'attributes':['id',_0xc20c('0x39')],'where':{'id':_0x14ff64[_0xc20c('0xa2')][_0xc20c('0xab')]}})[_0xc20c('0x20')](function(_0x5e52d7){if(_0x5e52d7){_0x14ff64[_0xc20c('0x76')][_0xc20c('0xad')]({'id':0x0,'priority':0x0,'app':_0xc20c('0xae'),'appdata':_0x5e52d7[_0xc20c('0x39')]+','+(_0x14ff64[_0xc20c('0x75')][_0xc20c('0xaf')]||0xa),'interval':_0xc20c('0xa7')});}return respondWithRpcPromise('Start',_0xc20c('0xb0'),_0x14ff64);});}return respondWithRpcPromise(_0xc20c('0xb1'),_0xc20c('0xb0'),_0x14ff64);})[_0xc20c('0x20')](function(_0x30ddd5){if(_0x30ddd5){var _0x3f401b=0xc8;var _0x28dc0a=_0xc20c('0xb2');logger['info'](_0xc20c('0x25'),_0x28dc0a,_0x3f401b,'entity\x20found');logger[_0xc20c('0x24')](_0xc20c('0xb3'),_0x28dc0a,_0x3f401b,_0xc20c('0xb4'),JSON[_0xc20c('0x26')](_0x30ddd5));if(_0x14ff64[_0xc20c('0x75')][_0xc20c('0x4e')]===_0xc20c('0x7f')){return _0x2d561a[_0xc20c('0x2d')](_0x3f401b)[_0xc20c('0x33')]('Content-Type','text/xml')[_0xc20c('0x3a')](_0xc20c('0xb5'));}else{return _0x2d561a['status'](_0x3f401b)['json'](_0x30ddd5);}}})[_0xc20c('0x2b')](handleError(_0x2d561a,null));};exports[_0xc20c('0xb6')]=function(_0x2add90,_0x1c2acf,_0x2db5cf){return db[_0xc20c('0x3d')][_0xc20c('0x6a')]({'where':{'id':_0x2add90['params']['id']}})[_0xc20c('0x20')](handleEntityNotFound(_0x1c2acf,null))[_0xc20c('0x20')](function(_0x51ddc6){if(_0x51ddc6){return db[_0xc20c('0xb7')][_0xc20c('0xb8')](function(_0x3ae25f){return db[_0xc20c('0x73')][_0xc20c('0x66')]({'where':{'SmsAccountId':_0x2add90[_0xc20c('0x65')]['id']},'transaction':_0x3ae25f})[_0xc20c('0x20')](function(_0x1eb992){var _0x486357=_[_0xc20c('0x3f')](_0x2add90[_0xc20c('0x5a')],function(_0x587da2){_0x587da2[_0xc20c('0x6c')]=_0x2add90[_0xc20c('0x65')]['id'];return _0x587da2;});return db['SmsApplication'][_0xc20c('0xb9')](_0x486357,{'transaction':_0x3ae25f});});})[_0xc20c('0x20')](function(){return db[_0xc20c('0x73')][_0xc20c('0xba')]({'where':{'SmsAccountId':_0x2add90[_0xc20c('0x65')]['id']},'order':_0xc20c('0x77')});});}})[_0xc20c('0x20')](respondWithResult(_0x1c2acf,null))[_0xc20c('0x2b')](handleError(_0x1c2acf,null));};exports[_0xc20c('0xbb')]=function(_0x567669,_0x1fb9d3,_0x4b9938){var _0x577ff7={};var _0x3b29dd={};var _0x1a3598;var _0x4199ef;return db[_0xc20c('0x3d')][_0xc20c('0x6a')]({'where':{'id':_0x567669['params']['id']}})['then'](handleEntityNotFound(_0x1fb9d3,null))[_0xc20c('0x20')](function(_0x2f146e){if(_0x2f146e){_0x1a3598=_0x2f146e;_0x3b29dd['model']=_[_0xc20c('0x41')](db[_0xc20c('0x73')][_0xc20c('0x54')]);_0x3b29dd['query']=_[_0xc20c('0x41')](_0x567669[_0xc20c('0x40')]);_0x3b29dd[_0xc20c('0x42')]=_[_0xc20c('0x43')](_0x3b29dd[_0xc20c('0x44')],_0x3b29dd[_0xc20c('0x40')]);_0x577ff7[_0xc20c('0x45')]=_[_0xc20c('0x43')](_0x3b29dd['model'],qs[_0xc20c('0x55')](_0x567669[_0xc20c('0x40')][_0xc20c('0x55')]));_0x577ff7[_0xc20c('0x45')]=_0x577ff7[_0xc20c('0x45')][_0xc20c('0x46')]?_0x577ff7[_0xc20c('0x45')]:_0x3b29dd[_0xc20c('0x44')];_0x577ff7[_0xc20c('0x49')]=qs[_0xc20c('0x4a')](_0x567669[_0xc20c('0x40')][_0xc20c('0x4a')]);_0x577ff7[_0xc20c('0x4c')]=qs[_0xc20c('0x42')](_['pick'](_0x567669[_0xc20c('0x40')],_0x3b29dd[_0xc20c('0x42')]));if(_0x567669[_0xc20c('0x40')]['filter']){_0x577ff7[_0xc20c('0x4c')]=_['merge'](_0x577ff7[_0xc20c('0x4c')],{'$or':_[_0xc20c('0x3f')](_0x577ff7[_0xc20c('0x45')],function(_0x5b6e4f){var _0x55cb10={};_0x55cb10[_0x5b6e4f]={'$like':'%'+_0x567669[_0xc20c('0x40')][_0xc20c('0x4b')]+'%'};return _0x55cb10;})});}_0x577ff7=_[_0xc20c('0x4d')]({},_0x577ff7,_0x567669[_0xc20c('0x57')]);return _0x1a3598['getApplications'](_0x577ff7);}})[_0xc20c('0x20')](function(_0x14080d){if(_0x14080d){_0x4199ef=_0x14080d[_0xc20c('0x46')];if(!_0x567669[_0xc20c('0x40')][_0xc20c('0x47')]('nolimit')){_0x577ff7[_0xc20c('0x31')]=qs['limit'](_0x567669[_0xc20c('0x40')][_0xc20c('0x31')]);_0x577ff7[_0xc20c('0x2f')]=qs['offset'](_0x567669['query'][_0xc20c('0x2f')]);}return _0x1a3598[_0xc20c('0xbb')](_0x577ff7);}})[_0xc20c('0x20')](function(_0x1d0a73){if(_0x1d0a73){return _0x1d0a73?{'count':_0x4199ef,'rows':_0x1d0a73}:null;}})[_0xc20c('0x20')](respondWithResult(_0x1fb9d3,null))['catch'](handleError(_0x1fb9d3,null));};exports[_0xc20c('0xbc')]=function(_0x20ae5f,_0x216e76,_0x3a9c7a){var _0x3ca1bb={'raw':![],'where':{}};var _0x30b0de={};var _0x31c2c8={'count':0x0,'rows':[]};return db[_0xc20c('0x3d')][_0xc20c('0x6a')]({'where':{'id':_0x20ae5f[_0xc20c('0x65')]['id']}})[_0xc20c('0x20')](handleEntityNotFound(_0x216e76,null))['then'](function(_0x3cbab2){if(_0x3cbab2){_0x30b0de[_0xc20c('0x44')]=_[_0xc20c('0x41')](db[_0xc20c('0xa0')][_0xc20c('0x54')]);_0x30b0de[_0xc20c('0x40')]=_[_0xc20c('0x41')](_0x20ae5f[_0xc20c('0x40')]);_0x30b0de[_0xc20c('0x42')]=_[_0xc20c('0x43')](_0x30b0de[_0xc20c('0x44')],_0x30b0de['query']);_0x3ca1bb[_0xc20c('0x45')]=_[_0xc20c('0x43')](_0x30b0de[_0xc20c('0x44')],qs[_0xc20c('0x55')](_0x20ae5f[_0xc20c('0x40')][_0xc20c('0x55')]));_0x3ca1bb[_0xc20c('0x45')]=_0x3ca1bb[_0xc20c('0x45')]['length']?_0x3ca1bb[_0xc20c('0x45')]:_0x30b0de['model'];if(!_0x20ae5f[_0xc20c('0x40')]['hasOwnProperty'](_0xc20c('0x48'))){_0x3ca1bb[_0xc20c('0x31')]=qs['limit'](_0x20ae5f[_0xc20c('0x40')][_0xc20c('0x31')]);_0x3ca1bb[_0xc20c('0x2f')]=qs[_0xc20c('0x2f')](_0x20ae5f[_0xc20c('0x40')][_0xc20c('0x2f')]);}_0x3ca1bb[_0xc20c('0x49')]=qs[_0xc20c('0x4a')](_0x20ae5f['query'][_0xc20c('0x4a')]);_0x3ca1bb[_0xc20c('0x4c')]=qs[_0xc20c('0x42')](_['pick'](_0x20ae5f['query'],_0x30b0de[_0xc20c('0x42')]));_0x3ca1bb['where'][_0xc20c('0x6c')]=_0x3cbab2['id'];if(_0x20ae5f[_0xc20c('0x40')][_0xc20c('0x4b')]){_0x3ca1bb[_0xc20c('0x4c')]=_['merge'](_0x3ca1bb[_0xc20c('0x4c')],{'$or':_['map'](_0x3ca1bb[_0xc20c('0x45')],function(_0x5abf49){var _0x135fb9={};_0x135fb9[_0x5abf49]={'$like':'%'+_0x20ae5f[_0xc20c('0x40')]['filter']+'%'};return _0x135fb9;})});}_0x3ca1bb=_['merge']({},_0x3ca1bb,_0x20ae5f[_0xc20c('0x57')]);return db[_0xc20c('0xa0')][_0xc20c('0x32')]({'where':_0x3ca1bb[_0xc20c('0x4c')]})[_0xc20c('0x20')](function(_0x243536){_0x31c2c8['count']=_0x243536;if(_0x20ae5f[_0xc20c('0x40')][_0xc20c('0x56')]){_0x3ca1bb[_0xc20c('0x50')]=[{'model':db['CmContact'],'as':_0xc20c('0xbd'),'required':![]},{'model':db[_0xc20c('0xac')],'as':_0xc20c('0xbe'),'attributes':[_0xc20c('0x39'),_0xc20c('0xbf'),_0xc20c('0xc0')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xc20c('0x39'),_0xc20c('0xc1')],'where':_0x20ae5f['query']['tag']?{'id':_0x20ae5f[_0xc20c('0x40')][_0xc20c('0xc2')]}:undefined,'required':_0x20ae5f[_0xc20c('0x40')]['tag']?!![]:![]}];}return db[_0xc20c('0xa0')][_0xc20c('0x51')](_0x3ca1bb);})[_0xc20c('0x20')](function(_0x3f8bb2){_0x31c2c8[_0xc20c('0x52')]=_0x3f8bb2;return _0x31c2c8;});}})[_0xc20c('0x20')](respondWithFilteredResult(_0x216e76,_0x3ca1bb))[_0xc20c('0x2b')](handleError(_0x216e76,null));};exports[_0xc20c('0x3a')]=function(_0x20491d,_0xe96cc4,_0x481bd8){var _0x32432c,_0x27c2f3,_0x2b6017;if(_[_0xc20c('0x97')](_0x20491d[_0xc20c('0x5a')][_0xc20c('0x5a')])||_0x20491d[_0xc20c('0x5a')][_0xc20c('0x5a')]===''){throw new db['Sequelize'][(_0xc20c('0x7b'))](_0xc20c('0x98'));}if(_['isNil'](_0x20491d['body']['to'])){throw new db['Sequelize'][(_0xc20c('0x7b'))]('to\x20is\x20mandatory');}_0x32432c=_0x20491d['body']['to'];return db[_0xc20c('0x3d')][_0xc20c('0x58')]({'where':{'id':_0x20491d['params']['id']},'include':[{'model':db['CmList'],'as':_0xc20c('0xc3'),'include':[{'model':db[_0xc20c('0x79')],'as':_0xc20c('0x9f'),'where':{'mobile':_0x32432c},'limit':0x1,'order':[[_0xc20c('0x9c'),_0xc20c('0x9d')]]}]}]})[_0xc20c('0x20')](handleEntityNotFound(_0xe96cc4,null))[_0xc20c('0x20')](function(_0x5b0536){if(_0x5b0536&&_0x5b0536['List']){_0x27c2f3=_0x5b0536[_0xc20c('0xa3')]({'plain':!![]});if(_0x27c2f3[_0xc20c('0xc3')]&&_0x27c2f3[_0xc20c('0xc3')][_0xc20c('0x9f')][_0xc20c('0x46')]){return _0x27c2f3[_0xc20c('0xc3')][_0xc20c('0x9f')][0x0];}return db[_0xc20c('0x79')][_0xc20c('0x59')](_[_0xc20c('0x19')](_0x20491d[_0xc20c('0x5a')],{'firstName':_0x32432c,'mobile':_0x32432c,'phone':_0x32432c,'ListId':_0x27c2f3['ListId']}));}})[_0xc20c('0x20')](handleEntityNotFound(_0xe96cc4,null))[_0xc20c('0x20')](function(_0x1f5438){if(_0x1f5438){_0x2b6017=_0x1f5438;return db[_0xc20c('0xa0')][_0xc20c('0x58')]({'where':{'ContactId':_0x2b6017['id'],'closed':![],'SmsAccountId':_0x27c2f3['id']}})['then'](function(_0x3b6432){if(_0x3b6432){return[_0x3b6432,![]];}return db[_0xc20c('0xa0')]['create']({'UserId':_0x20491d[_0xc20c('0x5b')]['id'],'ContactId':_0x2b6017['id'],'SmsAccountId':_0x27c2f3['id'],'phone':_0x32432c,'firstMsgDirection':_0xc20c('0xc4'),'Messages':[_[_0xc20c('0x4d')](_0x20491d['body'],{'read':![],'body':_0x20491d['body'][_0xc20c('0x5a')],'phone':_0x32432c,'SmsAccountId':_0x27c2f3['id'],'UserId':_0x20491d[_0xc20c('0x5b')]['id'],'ContactId':_0x2b6017['id']})]},{'include':[{'model':db[_0xc20c('0xa9')],'as':'Messages'}]})[_0xc20c('0x20')](function(_0x43b06f){return[_0x43b06f,!![]];});});}})['spread'](function(_0x434062,_0x34a27d){if(_0x34a27d){return _0x434062;}return db[_0xc20c('0xa9')][_0xc20c('0x59')](_[_0xc20c('0x4d')](_0x20491d[_0xc20c('0x5a')],{'read':![],'body':_0x20491d['body'][_0xc20c('0x5a')],'phone':_0x32432c,'SmsAccountId':_0x27c2f3['id'],'SmsInteractionId':_0x434062['id'],'UserId':_0x20491d[_0xc20c('0x5b')]['id'],'ContactId':_0x2b6017['id']}))[_0xc20c('0x20')](function(_0x32a74a){_0x434062[_0xc20c('0xc5')][_0xc20c('0xc6')]=[];_0x434062[_0xc20c('0xc5')][_0xc20c('0xc6')][_0xc20c('0xa4')](_0x32a74a[_0xc20c('0xc5')]);return _0x434062;});})[_0xc20c('0x20')](respondWithResult(_0xe96cc4,null))[_0xc20c('0x2b')](handleError(_0xe96cc4,null));};exports[_0xc20c('0x2d')]=function(_0x2b1842,_0xc660e7,_0x5892b8){if(_0x2b1842['body']['id']){delete _0x2b1842[_0xc20c('0x5a')]['id'];}var _0x578d7a,_0xc8e2f4,_0x13d515;return db[_0xc20c('0x3d')]['find']({'where':{'id':_0x2b1842['params']['id']}})[_0xc20c('0x20')](handleEntityNotFound(_0xc660e7,null))['then'](function(_0x2ca985){if(_0x2ca985){_0x13d515=_0x2ca985;logger[_0xc20c('0x24')](_0xc20c('0x25'),_0xc20c('0x2d'),_0xc20c('0xc7'),_0x2ca985[_0xc20c('0x4e')],util[_0xc20c('0xc8')](_0x2b1842[_0xc20c('0x5a')],{'showHidden':![],'depth':null}));switch(_0x2ca985[_0xc20c('0x4e')]){case _0xc20c('0xc9'):if(_0x2b1842[_0xc20c('0x5a')]['skebby_dispatch_id']&&_0x2b1842[_0xc20c('0x5a')]['status']){_0xc8e2f4=_0x2b1842[_0xc20c('0x5a')]['status'];return db['SmsMessage'][_0xc20c('0x58')]({'where':{'messageId':_0x2b1842[_0xc20c('0x5a')][_0xc20c('0xca')]}});}break;case _0xc20c('0x85'):if(_0x2b1842[_0xc20c('0x5a')]['requestid']&&_0x2b1842['body'][_0xc20c('0xcb')]){_0xc8e2f4=_0x2b1842[_0xc20c('0x5a')][_0xc20c('0xcb')];return db[_0xc20c('0xa9')][_0xc20c('0x58')]({'where':{'messageId':_0x2b1842[_0xc20c('0x5a')][_0xc20c('0xcc')]}});}break;case _0xc20c('0x87'):if(_0x2b1842[_0xc20c('0x5a')][_0xc20c('0xcd')]&&_0x2b1842['body'][_0xc20c('0xce')]){_0xc8e2f4=_0x2b1842['body'][_0xc20c('0xce')];return db[_0xc20c('0xa9')]['find']({'where':{'messageId':_0x2b1842[_0xc20c('0x5a')][_0xc20c('0xcd')]}});}break;case'infobip':var _0x38276c=_0x2b1842[_0xc20c('0x5a')][_0xc20c('0x8c')][0x0];if(_0x38276c[_0xc20c('0x82')]&&_0x38276c[_0xc20c('0x2d')][_0xc20c('0xcf')]===_0xc20c('0xd0')){_0xc8e2f4=_0x38276c['status'][_0xc20c('0xcf')];return db[_0xc20c('0xa9')][_0xc20c('0x58')]({'where':{'messageId':_0x38276c[_0xc20c('0x82')]}});}break;case _0xc20c('0x90'):if(_0x2b1842['body']['messageId']&&_0x2b1842[_0xc20c('0x5a')][_0xc20c('0x2d')]){_0xc8e2f4=_0x2b1842[_0xc20c('0x5a')]['status'];return db[_0xc20c('0xa9')]['find']({'where':{'messageId':_0x2b1842[_0xc20c('0x5a')][_0xc20c('0x82')]}});}break;case _0xc20c('0x93'):if(_0x2b1842[_0xc20c('0x5a')][0x0]['message']['id']){_0xc8e2f4=_0x2b1842[_0xc20c('0x5a')][0x0][_0xc20c('0x4e')];return db[_0xc20c('0xa9')][_0xc20c('0x58')]({'where':{'messageId':_0x2b1842[_0xc20c('0x5a')][0x0][_0xc20c('0x29')]['id']}});}break;case'intelepeer':if(_0x2b1842[_0xc20c('0x5a')][_0xc20c('0xd1')]&&_0x2b1842[_0xc20c('0x5a')][_0xc20c('0x2d')]){_0xc8e2f4=_0x2b1842['body']['status'];return db[_0xc20c('0xa9')][_0xc20c('0x58')]({'where':{'messageId':_0x2b1842[_0xc20c('0x5a')][_0xc20c('0xd1')]}});}break;}}})[_0xc20c('0x20')](handleEntityNotFound(_0xc660e7,null))[_0xc20c('0x20')](function(_0x2b0534){if(_0x2b0534){_0x578d7a=_0x2b0534;switch(_0x13d515[_0xc20c('0x4e')]){case _0xc20c('0xc9'):if(_0xc8e2f4===_0xc20c('0xd0')){return _0x578d7a[_0xc20c('0x64')]({'read':!![]});}else{logger['error'](_0xc20c('0x25'),_0xc20c('0x2d'),_0xc20c('0xc9'),util[_0xc20c('0xc8')](_0x2b1842[_0xc20c('0x5a')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0xc8e2f4==='1'){return _0x578d7a[_0xc20c('0x64')]({'read':!![]});}else{logger[_0xc20c('0x27')](_0xc20c('0x25'),_0xc20c('0x2d'),'skebby',util[_0xc20c('0xc8')](_0x2b1842[_0xc20c('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xc20c('0x87'):if(!_0x2b1842[_0xc20c('0x5a')][_0xc20c('0xd2')]&&_0xc8e2f4>=0xc8&&_0xc8e2f4<=0xce){return _0x578d7a[_0xc20c('0x64')]({'read':!![]});}else{logger[_0xc20c('0x27')](_0xc20c('0x25'),_0xc20c('0x2d'),'clicksend',util[_0xc20c('0xc8')](_0x2b1842[_0xc20c('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xc20c('0x8b'):var _0x3aa704=_0x2b1842[_0xc20c('0x5a')][_0xc20c('0x8c')][0x0];if(_0x3aa704[_0xc20c('0x2d')][_0xc20c('0xcf')]==='DELIVERED'){return _0x578d7a['update']({'read':!![]});}else{logger['error'](_0xc20c('0x25'),_0xc20c('0x2d'),_0xc20c('0x8b'),util['inspect'](_0x2b1842[_0xc20c('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xc20c('0x90'):if(_0xc8e2f4==_0xc20c('0xd3')||_0xc8e2f4=='RECEIVED_BY_RECIPIENT'){return _0x578d7a[_0xc20c('0x64')]({'read':!![]});}else{logger['error'](_0xc20c('0x25'),'status','clickatell',util[_0xc20c('0xc8')](_0x2b1842[_0xc20c('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xc20c('0x93'):if(_0xc8e2f4==_0xc20c('0xd4')){return _0x578d7a[_0xc20c('0x64')]({'read':!![]});}else{logger[_0xc20c('0x27')](_0xc20c('0x25'),_0xc20c('0x2d'),'bandwidth',util[_0xc20c('0xc8')](_0x2b1842[_0xc20c('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xc20c('0x94'):if(_0xc8e2f4===_0xc20c('0xd5')||_0xc8e2f4==='ACCEPTD'){return _0x578d7a[_0xc20c('0x64')]({'read':!![]});}else{logger[_0xc20c('0x27')](_0xc20c('0x25'),'status',_0xc20c('0x94'),util[_0xc20c('0xc8')](_0x2b1842[_0xc20c('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x578d7a;}})[_0xc20c('0x20')](respondWithResult(_0xc660e7,null))[_0xc20c('0x2b')](handleError(_0xc660e7,null));};exports[_0xc20c('0xd6')]=function(_0x4cf66a,_0x21d762,_0x5c3392){var _0x1d2ed0,_0x349199,_0x5544c5;return db[_0xc20c('0x3d')][_0xc20c('0x58')]({'where':{'id':_0x4cf66a['params']['id']}})[_0xc20c('0x20')](handleEntityNotFound(_0x21d762,null))['then'](function(_0x2bf728){if(_0x2bf728){_0x5544c5=_0x2bf728;logger[_0xc20c('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xc20c('0x2d'),_0xc20c('0xc7'),_0x2bf728['type'],util['inspect'](_0x4cf66a[_0xc20c('0x40')],{'showHidden':![],'depth':null}));switch(_0x2bf728[_0xc20c('0x4e')]){case _0xc20c('0x8d'):if(_0x4cf66a[_0xc20c('0x40')][_0xc20c('0xd7')]&&_0x4cf66a[_0xc20c('0x40')]['state']){_0x349199=_0x4cf66a[_0xc20c('0x40')][_0xc20c('0xd8')];return db[_0xc20c('0xa9')][_0xc20c('0x58')]({'where':{'messageId':_0x4cf66a['query'][_0xc20c('0xd7')]}});}break;}}})[_0xc20c('0x20')](handleEntityNotFound(_0x21d762,null))[_0xc20c('0x20')](function(_0xbd5fc9){if(_0xbd5fc9){_0x1d2ed0=_0xbd5fc9;switch(_0x5544c5[_0xc20c('0x4e')]){case'csc':if(_0x349199==='2'||_0x349199==='6'){return _0x1d2ed0[_0xc20c('0x64')]({'read':!![]});}else{logger[_0xc20c('0x27')](_0xc20c('0x25'),_0xc20c('0x2d'),_0xc20c('0x8d'),util[_0xc20c('0xc8')](_0x4cf66a[_0xc20c('0x40')],{'showHidden':![],'depth':null}));};break;}return _0x1d2ed0;}})[_0xc20c('0x20')](respondWithResult(_0x21d762,null))['catch'](handleError(_0x21d762,null));};exports[_0xc20c('0xd9')]=function(_0x42f27c,_0x395ac4,_0x2e2b7c){return db[_0xc20c('0x3d')][_0xc20c('0x58')]({'where':{'id':_0x42f27c[_0xc20c('0x65')]['id']}})[_0xc20c('0x20')](handleEntityNotFound(_0x395ac4,null))[_0xc20c('0x20')](function(_0x2d8c5a){if(_0x2d8c5a){return _0x2d8c5a[_0xc20c('0xd9')](_0x42f27c[_0xc20c('0x5a')]['ids'],_[_0xc20c('0xda')](_0x42f27c[_0xc20c('0x5a')],[_0xc20c('0x6e'),'id'])||{})[_0xc20c('0xa1')](function(_0x33ff25){for(var _0x1d8a1f=0x0;_0x1d8a1f<_0x42f27c[_0xc20c('0x5a')][_0xc20c('0x6e')][_0xc20c('0x46')];_0x1d8a1f+=0x1){socket['emit'](_0xc20c('0xdb'),{'UserId':Number(_0x42f27c[_0xc20c('0x5a')][_0xc20c('0x6e')][_0x1d8a1f]),'SmsAccountId':Number(_0x42f27c[_0xc20c('0x65')]['id'])});}return _0x33ff25;});}})[_0xc20c('0x20')](respondWithResult(_0x395ac4,null))[_0xc20c('0x2b')](handleError(_0x395ac4,null));};exports[_0xc20c('0xdc')]=function(_0x4a4347,_0x5d6a7f,_0x363269){return db[_0xc20c('0x3d')][_0xc20c('0x58')]({'where':{'id':_0x4a4347[_0xc20c('0x65')]['id']}})[_0xc20c('0x20')](handleEntityNotFound(_0x5d6a7f,null))[_0xc20c('0x20')](function(_0x51a0fb){if(_0x51a0fb){return _0x51a0fb['removeAgents'](_0x4a4347[_0xc20c('0x40')]['ids'])['then'](function(){if(_['isArray'](_0x4a4347[_0xc20c('0x40')][_0xc20c('0x6e')])){for(var _0x457b73=0x0;_0x457b73<_0x4a4347[_0xc20c('0x40')]['ids'][_0xc20c('0x46')];_0x457b73+=0x1){socket['emit'](_0xc20c('0xdd'),{'UserId':Number(_0x4a4347[_0xc20c('0x40')][_0xc20c('0x6e')][_0x457b73]),'SmsAccountId':Number(_0x4a4347['params']['id'])});}}else{socket[_0xc20c('0xde')](_0xc20c('0xdd'),{'UserId':Number(_0x4a4347[_0xc20c('0x40')][_0xc20c('0x6e')]),'SmsAccountId':Number(_0x4a4347[_0xc20c('0x65')]['id'])});}});}})['then'](respondWithStatusCode(_0x5d6a7f,null))[_0xc20c('0x2b')](handleError(_0x5d6a7f,null));};exports[_0xc20c('0xdf')]=function(_0x3d6648,_0x30edc5,_0x3f95a9){var _0x267d82={};var _0x2cb311={};var _0x4e38ba;var _0x4cd8cb;return db[_0xc20c('0x3d')][_0xc20c('0x6a')]({'where':{'id':_0x3d6648[_0xc20c('0x65')]['id']}})['then'](handleEntityNotFound(_0x30edc5,null))[_0xc20c('0x20')](function(_0x4351d8){if(_0x4351d8){_0x4e38ba=_0x4351d8;_0x2cb311[_0xc20c('0x44')]=_['keys'](db[_0xc20c('0xac')][_0xc20c('0x54')]);_0x2cb311[_0xc20c('0x40')]=_['keys'](_0x3d6648[_0xc20c('0x40')]);_0x2cb311[_0xc20c('0x42')]=_[_0xc20c('0x43')](_0x2cb311[_0xc20c('0x44')],_0x2cb311[_0xc20c('0x40')]);_0x267d82[_0xc20c('0x45')]=_[_0xc20c('0x43')](_0x2cb311[_0xc20c('0x44')],qs['fields'](_0x3d6648[_0xc20c('0x40')]['fields']));_0x267d82[_0xc20c('0x45')]=_0x267d82[_0xc20c('0x45')][_0xc20c('0x46')]?_0x267d82[_0xc20c('0x45')]:_0x2cb311[_0xc20c('0x44')];_0x267d82[_0xc20c('0x49')]=qs[_0xc20c('0x4a')](_0x3d6648[_0xc20c('0x40')][_0xc20c('0x4a')]);_0x267d82[_0xc20c('0x4c')]=qs[_0xc20c('0x42')](_[_0xc20c('0x6b')](_0x3d6648[_0xc20c('0x40')],_0x2cb311['filters']));if(_0x3d6648['query'][_0xc20c('0x4b')]){_0x267d82[_0xc20c('0x4c')]=_['merge'](_0x267d82['where'],{'$or':_[_0xc20c('0x3f')](_0x267d82['attributes'],function(_0x111ede){var _0x3e029d={};_0x3e029d[_0x111ede]={'$like':'%'+_0x3d6648[_0xc20c('0x40')]['filter']+'%'};return _0x3e029d;})});}_0x267d82=_[_0xc20c('0x4d')]({},_0x267d82,_0x3d6648[_0xc20c('0x57')]);return _0x4e38ba[_0xc20c('0xdf')](_0x267d82);}})[_0xc20c('0x20')](function(_0x505316){if(_0x505316){_0x4cd8cb=_0x505316[_0xc20c('0x46')];if(!_0x3d6648[_0xc20c('0x40')][_0xc20c('0x47')](_0xc20c('0x48'))){_0x267d82['limit']=qs[_0xc20c('0x31')](_0x3d6648[_0xc20c('0x40')][_0xc20c('0x31')]);_0x267d82['offset']=qs[_0xc20c('0x2f')](_0x3d6648[_0xc20c('0x40')][_0xc20c('0x2f')]);}return _0x4e38ba[_0xc20c('0xdf')](_0x267d82);}})[_0xc20c('0x20')](function(_0x2926fa){if(_0x2926fa){return _0x2926fa?{'count':_0x4cd8cb,'rows':_0x2926fa}:null;}})[_0xc20c('0x20')](respondWithResult(_0x30edc5,null))[_0xc20c('0x2b')](handleError(_0x30edc5,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 3fd9102..98f9f23 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 _0x93cf=['SmsAccount','setMaxListeners','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x36e360,_0xf8d352){var _0x1b2bc6=function(_0x3dd367){while(--_0x3dd367){_0x36e360['push'](_0x36e360['shift']());}};_0x1b2bc6(++_0xf8d352);}(_0x93cf,0xd7));var _0xf93c=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x93cf[_0x23e7c1];return _0x1add43;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0xf93c('0x0'))['db'][_0xf93c('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xf93c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xf93c('0x3')};function emitEvent(_0x18677b){return function(_0x2d3e65,_0x4c980b,_0x3e83c1){SmsAccountEvents['emit'](_0x18677b+':'+_0x2d3e65['id'],_0x2d3e65);SmsAccountEvents[_0xf93c('0x4')](_0x18677b,_0x2d3e65);_0x3e83c1(null);};}for(var e in events){if(events[_0xf93c('0x5')](e)){var event=events[e];SmsAccount[_0xf93c('0x6')](e,emitEvent(event));}}module[_0xf93c('0x7')]=SmsAccountEvents; \ No newline at end of file +var _0x3ae9=['remove','emit','exports','events','../../mysqldb','SmsAccount','setMaxListeners','update'];(function(_0x8f450a,_0x27478a){var _0x3d5fb5=function(_0xe875aa){while(--_0xe875aa){_0x8f450a['push'](_0x8f450a['shift']());}};_0x3d5fb5(++_0x27478a);}(_0x3ae9,0xb3));var _0x93ae=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x3ae9[_0x122096];return _0x3d1966;};'use strict';var EventEmitter=require(_0x93ae('0x0'));var SmsAccount=require(_0x93ae('0x1'))['db'][_0x93ae('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x93ae('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x93ae('0x4'),'afterDestroy':_0x93ae('0x5')};function emitEvent(_0x5b5a93){return function(_0x48d66d,_0x3438dc,_0x434b47){SmsAccountEvents[_0x93ae('0x6')](_0x5b5a93+':'+_0x48d66d['id'],_0x48d66d);SmsAccountEvents[_0x93ae('0x6')](_0x5b5a93,_0x48d66d);_0x434b47(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x93ae('0x7')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index df58803..cb04c0c 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 _0x0772=['bluebird','request-promise','path','rimraf','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x355ee5,_0x116dec){var _0x2818c8=function(_0x59a27e){while(--_0x59a27e){_0x355ee5['push'](_0x355ee5['shift']());}};_0x2818c8(++_0x116dec);}(_0x0772,0x1c9));var _0x2077=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x0772[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x2077('0x0'));var util=require(_0x2077('0x1'));var logger=require(_0x2077('0x2'))(_0x2077('0x3'));var moment=require(_0x2077('0x4'));var BPromise=require(_0x2077('0x5'));var rp=require(_0x2077('0x6'));var fs=require('fs');var path=require(_0x2077('0x7'));var rimraf=require(_0x2077('0x8'));var config=require('../../config/environment');var attributes=require(_0x2077('0x9'));module[_0x2077('0xa')]=function(_0x28b8f8,_0x3711b9){return _0x28b8f8[_0x2077('0xb')](_0x2077('0xc'),attributes,{'tableName':_0x2077('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x834d=['lodash','../../config/logger','path','rimraf','../../config/environment','exports','define','SmsAccount','sms_accounts'];(function(_0x387cb7,_0x3cc1b8){var _0x57cfcd=function(_0x1f0741){while(--_0x1f0741){_0x387cb7['push'](_0x387cb7['shift']());}};_0x57cfcd(++_0x3cc1b8);}(_0x834d,0xcf));var _0xd834=function(_0x49ca10,_0x1ede07){_0x49ca10=_0x49ca10-0x0;var _0x204a5c=_0x834d[_0x49ca10];return _0x204a5c;};'use strict';var _=require(_0xd834('0x0'));var util=require('util');var logger=require(_0xd834('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd834('0x2'));var rimraf=require(_0xd834('0x3'));var config=require(_0xd834('0x4'));var attributes=require('./smsAccount.attributes');module[_0xd834('0x5')]=function(_0x16acaa,_0x6dbc0a){return _0x16acaa[_0xd834('0x6')](_0xd834('0x7'),attributes,{'tableName':_0xd834('0x8'),'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 d6c0114..653333f 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 _0x23a3=['defaults','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','SmsAccount','options','raw','where','attributes','include','map','model','ShowSmsAccount','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis'];(function(_0x112439,_0x24199a){var _0x1ff74b=function(_0x57a538){while(--_0x57a538){_0x112439['push'](_0x112439['shift']());}};_0x1ff74b(++_0x24199a);}(_0x23a3,0x182));var _0x323a=function(_0x2d586a,_0x594a56){_0x2d586a=_0x2d586a-0x0;var _0x8daaa9=_0x23a3[_0x2d586a];return _0x8daaa9;};'use strict';var _=require('lodash');var util=require(_0x323a('0x0'));var moment=require(_0x323a('0x1'));var BPromise=require(_0x323a('0x2'));var rs=require(_0x323a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x323a('0x4'))['db'];var utils=require(_0x323a('0x5'));var logger=require(_0x323a('0x6'))(_0x323a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x323a('0x8')]['http']({'port':0x232a});config[_0x323a('0x9')]=_[_0x323a('0xa')](config[_0x323a('0x9')],{'host':_0x323a('0xb'),'port':0x18eb});var socket=require(_0x323a('0xc'))(new Redis(config[_0x323a('0x9')]));require(_0x323a('0xd'))[_0x323a('0xe')](socket);function respondWithRpcPromise(_0x6e2bad,_0x1dd9ee,_0x528260){return new BPromise(function(_0x531c51,_0x64e40f){return client[_0x323a('0xf')](_0x6e2bad,_0x528260)[_0x323a('0x10')](function(_0x33ef7d){logger[_0x323a('0x11')](_0x323a('0x12'),_0x1dd9ee,_0x323a('0x13'));logger[_0x323a('0x14')](_0x323a('0x15'),_0x1dd9ee,'request\x20sent',JSON[_0x323a('0x16')](_0x33ef7d));if(_0x33ef7d[_0x323a('0x17')]){if(_0x33ef7d[_0x323a('0x17')][_0x323a('0x18')]===0x1f4){logger[_0x323a('0x17')](_0x323a('0x12'),_0x1dd9ee,_0x33ef7d[_0x323a('0x17')][_0x323a('0x19')]);return _0x64e40f(_0x33ef7d[_0x323a('0x17')][_0x323a('0x19')]);}logger[_0x323a('0x17')]('SmsAccount,\x20%s,\x20%s',_0x1dd9ee,_0x33ef7d[_0x323a('0x17')]['message']);return _0x531c51(_0x33ef7d['error'][_0x323a('0x19')]);}else{logger[_0x323a('0x11')](_0x323a('0x12'),_0x1dd9ee,_0x323a('0x13'));_0x531c51(_0x33ef7d[_0x323a('0x1a')][_0x323a('0x19')]);}})['catch'](function(_0x27817f){logger['error'](_0x323a('0x12'),_0x1dd9ee,_0x27817f);_0x64e40f(_0x27817f);});});}exports['ShowSmsAccount']=function(_0x4e4b61){var _0x4931dd=this;return new Promise(function(_0x50d14c,_0x4eefe6){return db[_0x323a('0x1b')]['find']({'raw':_0x4e4b61[_0x323a('0x1c')]?_0x4e4b61[_0x323a('0x1c')][_0x323a('0x1d')]===undefined?!![]:![]:!![],'where':_0x4e4b61[_0x323a('0x1c')]?_0x4e4b61[_0x323a('0x1c')][_0x323a('0x1e')]||null:null,'attributes':_0x4e4b61[_0x323a('0x1c')]?_0x4e4b61[_0x323a('0x1c')][_0x323a('0x1f')]||null:null,'include':_0x4e4b61[_0x323a('0x1c')]?_0x4e4b61[_0x323a('0x1c')][_0x323a('0x20')]?_[_0x323a('0x21')](_0x4e4b61['options'][_0x323a('0x20')],function(_0x2eecde){return{'model':db[_0x2eecde[_0x323a('0x22')]],'as':_0x2eecde['as'],'attributes':_0x2eecde[_0x323a('0x1f')],'include':_0x2eecde[_0x323a('0x20')]?_[_0x323a('0x21')](_0x2eecde[_0x323a('0x20')],function(_0x18fab5){return{'model':db[_0x18fab5[_0x323a('0x22')]],'as':_0x18fab5['as'],'attributes':_0x18fab5[_0x323a('0x1f')],'include':_0x18fab5[_0x323a('0x20')]?_[_0x323a('0x21')](_0x18fab5[_0x323a('0x20')],function(_0x1f7fc1){return{'model':db[_0x1f7fc1['model']],'as':_0x1f7fc1['as'],'attributes':_0x1f7fc1[_0x323a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x323a('0x10')](function(_0x27cead){logger[_0x323a('0x11')](_0x323a('0x23'),_0x4e4b61);logger['debug']('ShowSmsAccount',_0x4e4b61,JSON[_0x323a('0x16')](_0x27cead));_0x50d14c(_0x27cead);})['catch'](function(_0x5cea3d){logger[_0x323a('0x17')](_0x323a('0x23'),_0x5cea3d['message'],_0x4e4b61);_0x4eefe6(_0x4931dd[_0x323a('0x17')](0x1f4,_0x5cea3d[_0x323a('0x19')]));});});}; \ No newline at end of file +var _0x7611=['SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','info'];(function(_0x31a15c,_0x470cd6){var _0x3c1fa7=function(_0xdff22f){while(--_0xdff22f){_0x31a15c['push'](_0x31a15c['shift']());}};_0x3c1fa7(++_0x470cd6);}(_0x7611,0x9f));var _0x1761=function(_0x30cfce,_0x5535f7){_0x30cfce=_0x30cfce-0x0;var _0xfc6fff=_0x7611[_0x30cfce];return _0xfc6fff;};'use strict';var _=require(_0x1761('0x0'));var util=require(_0x1761('0x1'));var moment=require(_0x1761('0x2'));var BPromise=require(_0x1761('0x3'));var rs=require(_0x1761('0x4'));var fs=require('fs');var Redis=require(_0x1761('0x5'));var db=require(_0x1761('0x6'))['db'];var utils=require(_0x1761('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x1761('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x1761('0x9')]=_[_0x1761('0xa')](config[_0x1761('0x9')],{'host':_0x1761('0xb'),'port':0x18eb});var socket=require(_0x1761('0xc'))(new Redis(config[_0x1761('0x9')]));require(_0x1761('0xd'))[_0x1761('0xe')](socket);function respondWithRpcPromise(_0x10eab0,_0x10b302,_0x3bd660){return new BPromise(function(_0x5d810d,_0xdabf94){return client['request'](_0x10eab0,_0x3bd660)['then'](function(_0x89a2c2){logger[_0x1761('0xf')](_0x1761('0x10'),_0x10b302,'request\x20sent');logger[_0x1761('0x11')](_0x1761('0x12'),_0x10b302,'request\x20sent',JSON[_0x1761('0x13')](_0x89a2c2));if(_0x89a2c2[_0x1761('0x14')]){if(_0x89a2c2[_0x1761('0x14')][_0x1761('0x15')]===0x1f4){logger[_0x1761('0x14')](_0x1761('0x10'),_0x10b302,_0x89a2c2['error'][_0x1761('0x16')]);return _0xdabf94(_0x89a2c2[_0x1761('0x14')][_0x1761('0x16')]);}logger['error'](_0x1761('0x10'),_0x10b302,_0x89a2c2['error'][_0x1761('0x16')]);return _0x5d810d(_0x89a2c2[_0x1761('0x14')][_0x1761('0x16')]);}else{logger[_0x1761('0xf')](_0x1761('0x10'),_0x10b302,'request\x20sent');_0x5d810d(_0x89a2c2[_0x1761('0x17')][_0x1761('0x16')]);}})[_0x1761('0x18')](function(_0x4bd5fb){logger[_0x1761('0x14')](_0x1761('0x10'),_0x10b302,_0x4bd5fb);_0xdabf94(_0x4bd5fb);});});}exports[_0x1761('0x19')]=function(_0x16f3e8){var _0x48a8a3=this;return new Promise(function(_0x529673,_0x2f7d63){return db[_0x1761('0x1a')][_0x1761('0x1b')]({'raw':_0x16f3e8[_0x1761('0x1c')]?_0x16f3e8[_0x1761('0x1c')][_0x1761('0x1d')]===undefined?!![]:![]:!![],'where':_0x16f3e8[_0x1761('0x1c')]?_0x16f3e8[_0x1761('0x1c')][_0x1761('0x1e')]||null:null,'attributes':_0x16f3e8[_0x1761('0x1c')]?_0x16f3e8[_0x1761('0x1c')][_0x1761('0x1f')]||null:null,'include':_0x16f3e8[_0x1761('0x1c')]?_0x16f3e8['options'][_0x1761('0x20')]?_[_0x1761('0x21')](_0x16f3e8[_0x1761('0x1c')][_0x1761('0x20')],function(_0x3596a8){return{'model':db[_0x3596a8[_0x1761('0x22')]],'as':_0x3596a8['as'],'attributes':_0x3596a8[_0x1761('0x1f')],'include':_0x3596a8[_0x1761('0x20')]?_[_0x1761('0x21')](_0x3596a8[_0x1761('0x20')],function(_0x329911){return{'model':db[_0x329911[_0x1761('0x22')]],'as':_0x329911['as'],'attributes':_0x329911['attributes'],'include':_0x329911[_0x1761('0x20')]?_['map'](_0x329911[_0x1761('0x20')],function(_0x3891e7){return{'model':db[_0x3891e7[_0x1761('0x22')]],'as':_0x3891e7['as'],'attributes':_0x3891e7[_0x1761('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x53f539){logger[_0x1761('0xf')](_0x1761('0x19'),_0x16f3e8);logger[_0x1761('0x11')](_0x1761('0x19'),_0x16f3e8,JSON['stringify'](_0x53f539));_0x529673(_0x53f539);})[_0x1761('0x18')](function(_0x4f48b2){logger['error']('ShowSmsAccount',_0x4f48b2['message'],_0x16f3e8);_0x2f7d63(_0x48a8a3[_0x1761('0x14')](0x1f4,_0x4f48b2['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 7548ff3..868d47a 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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 2cba2d2..1752ad2 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['update','delete','/:id','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','show','create'];(function(_0xb9c03c,_0x204bfe){var _0x30228c=function(_0x1b2606){while(--_0x1b2606){_0xb9c03c['push'](_0xb9c03c['shift']());}};_0x30228c(++_0x204bfe);}(_0x55ca,0x126));var _0xa55c=function(_0x44334a,_0x181bce){_0x44334a=_0x44334a-0x0;var _0x20a140=_0x55ca[_0x44334a];return _0x20a140;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['post']('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0xb')]);router['put']('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);module[_0xa55c('0x10')]=router; \ No newline at end of file +var _0x34e8=['../../config/environment','./smsApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x29260a,_0x59398a){var _0xcdb779=function(_0x463b01){while(--_0x463b01){_0x29260a['push'](_0x29260a['shift']());}};_0xcdb779(++_0x59398a);}(_0x34e8,0x12c));var _0x834e=function(_0x3951cd,_0x1bd45d){_0x3951cd=_0x3951cd-0x0;var _0x2509cd=_0x34e8[_0x3951cd];return _0x2509cd;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xf')]('/',auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0x13')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);module[_0x834e('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 7529ced..3409c96 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 _0xba2d=['INTEGER','STRING','noop','TEXT','sequelize','exports'];(function(_0x1e1314,_0x16d3e5){var _0x4e3ded=function(_0x16bfd4){while(--_0x16bfd4){_0x1e1314['push'](_0x1e1314['shift']());}};_0x4e3ded(++_0x16d3e5);}(_0xba2d,0x1de));var _0xdba2=function(_0x16a1b,_0x10a68c){_0x16a1b=_0x16a1b-0x0;var _0x60b9b0=_0xba2d[_0x16a1b];return _0x60b9b0;};'use strict';var Sequelize=require(_0xdba2('0x0'));module[_0xdba2('0x1')]={'priority':{'type':Sequelize[_0xdba2('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xdba2('0x3')],'allowNull':![],'defaultValue':_0xdba2('0x4')},'appdata':{'type':Sequelize[_0xdba2('0x5')]()},'description':{'type':Sequelize[_0xdba2('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x1bc7=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0x1bc7,0x1bc));var _0x71bc=function(_0x2f48d6,_0x26f190){_0x2f48d6=_0x2f48d6-0x0;var _0x2aafff=_0x1bc7[_0x2f48d6];return _0x2aafff;};'use strict';var Sequelize=require(_0x71bc('0x0'));module[_0x71bc('0x1')]={'priority':{'type':Sequelize[_0x71bc('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x71bc('0x3')],'allowNull':![],'defaultValue':_0x71bc('0x4')},'appdata':{'type':Sequelize[_0x71bc('0x5')]()},'description':{'type':Sequelize[_0x71bc('0x3')]},'interval':{'type':Sequelize[_0x71bc('0x3')],'defaultValue':_0x71bc('0x6')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index e21f093..0089d54 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 _0xe85e=['limit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','SmsApplication','rows','show','params','length','include','find','catch','create','body','update','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit'];(function(_0x5b574b,_0x4ff1fa){var _0xb1c9d4=function(_0x1f3a77){while(--_0x1f3a77){_0x5b574b['push'](_0x5b574b['shift']());}};_0xb1c9d4(++_0x4ff1fa);}(_0xe85e,0x149));var _0xee85=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe85e[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xee85('0x0'));var rimraf=require(_0xee85('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xee85('0x2'));var rp=require(_0xee85('0x3'));var moment=require(_0xee85('0x4'));var BPromise=require(_0xee85('0x5'));var Mustache=require(_0xee85('0x6'));var util=require(_0xee85('0x7'));var path=require('path');var sox=require(_0xee85('0x8'));var csv=require(_0xee85('0x9'));var ejs=require(_0xee85('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee85('0xb'));var squel=require('squel');var crypto=require(_0xee85('0xc'));var jsforce=require(_0xee85('0xd'));var deskjs=require(_0xee85('0xe'));var toCsv=require(_0xee85('0x9'));var querystring=require(_0xee85('0xf'));var Papa=require(_0xee85('0x10'));var Redis=require(_0xee85('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xee85('0x12'));var hardwareService=require(_0xee85('0x13'));var logger=require(_0xee85('0x14'))(_0xee85('0x15'));var utils=require(_0xee85('0x16'));var config=require(_0xee85('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xee85('0x18'))['db'];function respondWithStatusCode(_0x1ef8dc,_0x50ffea){_0x50ffea=_0x50ffea||0xcc;return function(_0x259e81){if(_0x259e81){return _0x1ef8dc[_0xee85('0x19')](_0x50ffea);}return _0x1ef8dc[_0xee85('0x1a')](_0x50ffea)[_0xee85('0x1b')]();};}function respondWithResult(_0x1e79a7,_0x7fc39c){_0x7fc39c=_0x7fc39c||0xc8;return function(_0x55cf33){if(_0x55cf33){return _0x1e79a7[_0xee85('0x1a')](_0x7fc39c)[_0xee85('0x1c')](_0x55cf33);}};}function respondWithFilteredResult(_0x27015d,_0x51eb5b){return function(_0x227171){if(_0x227171){var _0x1c4b35=typeof _0x51eb5b[_0xee85('0x1d')]===_0xee85('0x1e')&&typeof _0x51eb5b['limit']===_0xee85('0x1e');var _0x4843e9=_0x227171['count'];var _0x46c4c6=_0x1c4b35?0x0:_0x51eb5b['offset'];var _0x2ba9ca=_0x1c4b35?_0x227171[_0xee85('0x1f')]:_0x51eb5b[_0xee85('0x1d')]+_0x51eb5b['limit'];var _0x401e54;if(_0x2ba9ca>=_0x4843e9){_0x2ba9ca=_0x4843e9;_0x401e54=0xc8;}else{_0x401e54=0xce;}_0x27015d[_0xee85('0x1a')](_0x401e54);return _0x27015d[_0xee85('0x20')](_0xee85('0x21'),_0x46c4c6+'-'+_0x2ba9ca+'/'+_0x4843e9)[_0xee85('0x1c')](_0x227171);}return null;};}function patchUpdates(_0x4393fc){return function(_0x37c3cf){try{jsonpatch[_0xee85('0x22')](_0x37c3cf,_0x4393fc,!![]);}catch(_0xff61bb){return BPromise[_0xee85('0x23')](_0xff61bb);}return _0x37c3cf[_0xee85('0x24')]();};}function saveUpdates(_0x9c293a,_0x3e1fe6){return function(_0x15c9ec){if(_0x15c9ec){return _0x15c9ec['update'](_0x9c293a)[_0xee85('0x25')](function(_0x59b305){return _0x59b305;});}return null;};}function removeEntity(_0xfe24de,_0x4b97bd){return function(_0x16c009){if(_0x16c009){return _0x16c009[_0xee85('0x26')]()[_0xee85('0x25')](function(){_0xfe24de[_0xee85('0x1a')](0xcc)[_0xee85('0x1b')]();});}};}function handleEntityNotFound(_0x534f43,_0x443b54){return function(_0x5292b0){if(!_0x5292b0){_0x534f43[_0xee85('0x19')](0x194);}return _0x5292b0;};}function handleError(_0x14fc25,_0x3d4808){_0x3d4808=_0x3d4808||0x1f4;return function(_0x1eba4f){logger[_0xee85('0x27')](_0x1eba4f['stack']);if(_0x1eba4f[_0xee85('0x28')]){delete _0x1eba4f[_0xee85('0x28')];}_0x14fc25['status'](_0x3d4808)[_0xee85('0x29')](_0x1eba4f);};}exports[_0xee85('0x2a')]=function(_0x14b3ca,_0x59a897){var _0x277dd1={},_0x30c4cd={},_0x41b24e={'count':0x0,'rows':[]};var _0x4170c5=_[_0xee85('0x2b')](db['SmsApplication'][_0xee85('0x2c')],function(_0x1c7ee6){return{'name':_0x1c7ee6[_0xee85('0x2d')],'type':_0x1c7ee6['type'][_0xee85('0x2e')]};});_0x30c4cd[_0xee85('0x2f')]=_[_0xee85('0x2b')](_0x4170c5,_0xee85('0x28'));_0x30c4cd[_0xee85('0x30')]=_[_0xee85('0x31')](_0x14b3ca[_0xee85('0x30')]);_0x30c4cd[_0xee85('0x32')]=_[_0xee85('0x33')](_0x30c4cd[_0xee85('0x2f')],_0x30c4cd[_0xee85('0x30')]);_0x277dd1[_0xee85('0x34')]=_[_0xee85('0x33')](_0x30c4cd[_0xee85('0x2f')],qs[_0xee85('0x35')](_0x14b3ca[_0xee85('0x30')][_0xee85('0x35')]));_0x277dd1[_0xee85('0x34')]=_0x277dd1[_0xee85('0x34')]['length']?_0x277dd1[_0xee85('0x34')]:_0x30c4cd[_0xee85('0x2f')];if(!_0x14b3ca['query'][_0xee85('0x36')](_0xee85('0x37'))){_0x277dd1['limit']=qs[_0xee85('0x38')](_0x14b3ca[_0xee85('0x30')][_0xee85('0x38')]);_0x277dd1[_0xee85('0x1d')]=qs[_0xee85('0x1d')](_0x14b3ca[_0xee85('0x30')][_0xee85('0x1d')]);}_0x277dd1[_0xee85('0x39')]=qs['sort'](_0x14b3ca[_0xee85('0x30')][_0xee85('0x3a')]);_0x277dd1[_0xee85('0x3b')]=qs[_0xee85('0x32')](_[_0xee85('0x3c')](_0x14b3ca[_0xee85('0x30')],_0x30c4cd[_0xee85('0x32')]),_0x4170c5);if(_0x14b3ca[_0xee85('0x30')][_0xee85('0x3d')]){_0x277dd1['where']=_['merge'](_0x277dd1[_0xee85('0x3b')],{'$or':_[_0xee85('0x2b')](_0x4170c5,function(_0x113788){if(_0x113788[_0xee85('0x3e')]!==_0xee85('0x3f')){var _0x1bde2f={};_0x1bde2f[_0x113788[_0xee85('0x28')]]={'$like':'%'+_0x14b3ca[_0xee85('0x30')][_0xee85('0x3d')]+'%'};return _0x1bde2f;}})});}_0x277dd1=_[_0xee85('0x40')]({},_0x277dd1,_0x14b3ca[_0xee85('0x41')]);var _0x40a0cf={'where':_0x277dd1[_0xee85('0x3b')]};return db[_0xee85('0x42')][_0xee85('0x1f')](_0x40a0cf)[_0xee85('0x25')](function(_0x360353){_0x41b24e['count']=_0x360353;if(_0x14b3ca[_0xee85('0x30')]['includeAll']){_0x277dd1['include']=[{'all':!![]}];}return db[_0xee85('0x42')]['findAll'](_0x277dd1);})[_0xee85('0x25')](function(_0x5d9b49){_0x41b24e[_0xee85('0x43')]=_0x5d9b49;return _0x41b24e;})[_0xee85('0x25')](respondWithFilteredResult(_0x59a897,_0x277dd1))['catch'](handleError(_0x59a897,null));};exports[_0xee85('0x44')]=function(_0xb555bd,_0x52d0ce){var _0x2cb822={'raw':!![],'where':{'id':_0xb555bd[_0xee85('0x45')]['id']}},_0x221524={};_0x221524[_0xee85('0x2f')]=_[_0xee85('0x31')](db[_0xee85('0x42')]['rawAttributes']);_0x221524[_0xee85('0x30')]=_[_0xee85('0x31')](_0xb555bd['query']);_0x221524[_0xee85('0x32')]=_[_0xee85('0x33')](_0x221524[_0xee85('0x2f')],_0x221524[_0xee85('0x30')]);_0x2cb822[_0xee85('0x34')]=_['intersection'](_0x221524['model'],qs[_0xee85('0x35')](_0xb555bd[_0xee85('0x30')]['fields']));_0x2cb822[_0xee85('0x34')]=_0x2cb822[_0xee85('0x34')][_0xee85('0x46')]?_0x2cb822[_0xee85('0x34')]:_0x221524[_0xee85('0x2f')];if(_0xb555bd[_0xee85('0x30')]['includeAll']){_0x2cb822[_0xee85('0x47')]=[{'all':!![]}];}_0x2cb822=_[_0xee85('0x40')]({},_0x2cb822,_0xb555bd[_0xee85('0x41')]);return db[_0xee85('0x42')][_0xee85('0x48')](_0x2cb822)['then'](handleEntityNotFound(_0x52d0ce,null))[_0xee85('0x25')](respondWithResult(_0x52d0ce,null))[_0xee85('0x49')](handleError(_0x52d0ce,null));};exports['create']=function(_0x3cb5c6,_0x438e00){return db[_0xee85('0x42')][_0xee85('0x4a')](_0x3cb5c6[_0xee85('0x4b')],{})['then'](respondWithResult(_0x438e00,0xc9))[_0xee85('0x49')](handleError(_0x438e00,null));};exports[_0xee85('0x4c')]=function(_0x42d51b,_0x321e65){if(_0x42d51b[_0xee85('0x4b')]['id']){delete _0x42d51b['body']['id'];}return db[_0xee85('0x42')]['find']({'where':{'id':_0x42d51b[_0xee85('0x45')]['id']}})[_0xee85('0x25')](handleEntityNotFound(_0x321e65,null))[_0xee85('0x25')](saveUpdates(_0x42d51b['body'],null))['then'](respondWithResult(_0x321e65,null))['catch'](handleError(_0x321e65,null));};exports['destroy']=function(_0x1b5f69,_0x1f281e){return db[_0xee85('0x42')][_0xee85('0x48')]({'where':{'id':_0x1b5f69[_0xee85('0x45')]['id']}})[_0xee85('0x25')](handleEntityNotFound(_0x1f281e,null))[_0xee85('0x25')](removeEntity(_0x1f281e,null))[_0xee85('0x49')](handleError(_0x1f281e,null));}; \ No newline at end of file +var _0x64d8=['attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','sendStatus','error','stack','name','send','map','SmsApplication','fieldName','key','model','query','keys','filters','intersection'];(function(_0x841803,_0x306ef9){var _0x68aaa4=function(_0x57a889){while(--_0x57a889){_0x841803['push'](_0x841803['shift']());}};_0x68aaa4(++_0x306ef9);}(_0x64d8,0x19e));var _0x864d=function(_0xbf802e,_0x329296){_0xbf802e=_0xbf802e-0x0;var _0x19e99b=_0x64d8[_0xbf802e];return _0x19e99b;};'use strict';var emlformat=require(_0x864d('0x0'));var rimraf=require(_0x864d('0x1'));var zipdir=require(_0x864d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x864d('0x3'));var moment=require(_0x864d('0x4'));var BPromise=require(_0x864d('0x5'));var Mustache=require(_0x864d('0x6'));var util=require(_0x864d('0x7'));var path=require(_0x864d('0x8'));var sox=require(_0x864d('0x9'));var csv=require(_0x864d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x864d('0xb'));var _=require(_0x864d('0xc'));var squel=require(_0x864d('0xd'));var crypto=require(_0x864d('0xe'));var jsforce=require(_0x864d('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x864d('0xa'));var querystring=require(_0x864d('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x864d('0x11'));var qs=require(_0x864d('0x12'));var as=require(_0x864d('0x13'));var hardwareService=require(_0x864d('0x14'));var logger=require(_0x864d('0x15'))(_0x864d('0x16'));var utils=require(_0x864d('0x17'));var config=require(_0x864d('0x18'));var licenseUtil=require(_0x864d('0x19'));var db=require(_0x864d('0x1a'))['db'];function respondWithStatusCode(_0x335908,_0x5b6729){_0x5b6729=_0x5b6729||0xcc;return function(_0x1fce7f){if(_0x1fce7f){return _0x335908['sendStatus'](_0x5b6729);}return _0x335908['status'](_0x5b6729)[_0x864d('0x1b')]();};}function respondWithResult(_0x343dae,_0x5bf7e6){_0x5bf7e6=_0x5bf7e6||0xc8;return function(_0x48e54c){if(_0x48e54c){return _0x343dae[_0x864d('0x1c')](_0x5bf7e6)[_0x864d('0x1d')](_0x48e54c);}};}function respondWithFilteredResult(_0x1fccac,_0x14d470){return function(_0x35ca1f){if(_0x35ca1f){var _0x16e997=typeof _0x14d470[_0x864d('0x1e')]===_0x864d('0x1f')&&typeof _0x14d470[_0x864d('0x20')]===_0x864d('0x1f');var _0x45a8c6=_0x35ca1f['count'];var _0x374293=_0x16e997?0x0:_0x14d470[_0x864d('0x1e')];var _0x3f8b05=_0x16e997?_0x35ca1f[_0x864d('0x21')]:_0x14d470[_0x864d('0x1e')]+_0x14d470[_0x864d('0x20')];var _0xa32659;if(_0x3f8b05>=_0x45a8c6){_0x3f8b05=_0x45a8c6;_0xa32659=0xc8;}else{_0xa32659=0xce;}_0x1fccac[_0x864d('0x1c')](_0xa32659);return _0x1fccac[_0x864d('0x22')](_0x864d('0x23'),_0x374293+'-'+_0x3f8b05+'/'+_0x45a8c6)['json'](_0x35ca1f);}return null;};}function patchUpdates(_0x163c40){return function(_0x206f0b){try{jsonpatch['apply'](_0x206f0b,_0x163c40,!![]);}catch(_0x24bc5f){return BPromise[_0x864d('0x24')](_0x24bc5f);}return _0x206f0b[_0x864d('0x25')]();};}function saveUpdates(_0x43f5f7,_0x402d90){return function(_0x3711dc){if(_0x3711dc){return _0x3711dc[_0x864d('0x26')](_0x43f5f7)[_0x864d('0x27')](function(_0x6aeffd){return _0x6aeffd;});}return null;};}function removeEntity(_0x43656a,_0x147653){return function(_0x3520d5){if(_0x3520d5){return _0x3520d5['destroy']()[_0x864d('0x27')](function(){_0x43656a[_0x864d('0x1c')](0xcc)[_0x864d('0x1b')]();});}};}function handleEntityNotFound(_0x5af8df,_0x1366a4){return function(_0x24e0fc){if(!_0x24e0fc){_0x5af8df[_0x864d('0x28')](0x194);}return _0x24e0fc;};}function handleError(_0x37decc,_0x46e807){_0x46e807=_0x46e807||0x1f4;return function(_0x4eb936){logger[_0x864d('0x29')](_0x4eb936[_0x864d('0x2a')]);if(_0x4eb936[_0x864d('0x2b')]){delete _0x4eb936[_0x864d('0x2b')];}_0x37decc['status'](_0x46e807)[_0x864d('0x2c')](_0x4eb936);};}exports['index']=function(_0x4203cb,_0x56e692){var _0x309a03={},_0x267070={},_0x2618d3={'count':0x0,'rows':[]};var _0x174cf6=_[_0x864d('0x2d')](db[_0x864d('0x2e')]['rawAttributes'],function(_0x20a3f9){return{'name':_0x20a3f9[_0x864d('0x2f')],'type':_0x20a3f9['type'][_0x864d('0x30')]};});_0x267070[_0x864d('0x31')]=_[_0x864d('0x2d')](_0x174cf6,'name');_0x267070[_0x864d('0x32')]=_[_0x864d('0x33')](_0x4203cb['query']);_0x267070[_0x864d('0x34')]=_[_0x864d('0x35')](_0x267070['model'],_0x267070[_0x864d('0x32')]);_0x309a03[_0x864d('0x36')]=_[_0x864d('0x35')](_0x267070['model'],qs[_0x864d('0x37')](_0x4203cb[_0x864d('0x32')][_0x864d('0x37')]));_0x309a03[_0x864d('0x36')]=_0x309a03['attributes'][_0x864d('0x38')]?_0x309a03[_0x864d('0x36')]:_0x267070[_0x864d('0x31')];if(!_0x4203cb[_0x864d('0x32')][_0x864d('0x39')]('nolimit')){_0x309a03['limit']=qs[_0x864d('0x20')](_0x4203cb[_0x864d('0x32')][_0x864d('0x20')]);_0x309a03[_0x864d('0x1e')]=qs['offset'](_0x4203cb[_0x864d('0x32')][_0x864d('0x1e')]);}_0x309a03[_0x864d('0x3a')]=qs[_0x864d('0x3b')](_0x4203cb['query']['sort']);_0x309a03[_0x864d('0x3c')]=qs[_0x864d('0x34')](_[_0x864d('0x3d')](_0x4203cb[_0x864d('0x32')],_0x267070[_0x864d('0x34')]),_0x174cf6);if(_0x4203cb[_0x864d('0x32')][_0x864d('0x3e')]){_0x309a03['where']=_[_0x864d('0x3f')](_0x309a03['where'],{'$or':_[_0x864d('0x2d')](_0x174cf6,function(_0x238414){if(_0x238414[_0x864d('0x40')]!==_0x864d('0x41')){var _0x4e5ec6={};_0x4e5ec6[_0x238414[_0x864d('0x2b')]]={'$like':'%'+_0x4203cb[_0x864d('0x32')][_0x864d('0x3e')]+'%'};return _0x4e5ec6;}})});}_0x309a03=_[_0x864d('0x3f')]({},_0x309a03,_0x4203cb[_0x864d('0x42')]);var _0x121f3f={'where':_0x309a03[_0x864d('0x3c')]};return db[_0x864d('0x2e')]['count'](_0x121f3f)['then'](function(_0x233957){_0x2618d3[_0x864d('0x21')]=_0x233957;if(_0x4203cb[_0x864d('0x32')][_0x864d('0x43')]){_0x309a03[_0x864d('0x44')]=[{'all':!![]}];}return db[_0x864d('0x2e')][_0x864d('0x45')](_0x309a03);})[_0x864d('0x27')](function(_0x1f340d){_0x2618d3['rows']=_0x1f340d;return _0x2618d3;})[_0x864d('0x27')](respondWithFilteredResult(_0x56e692,_0x309a03))[_0x864d('0x46')](handleError(_0x56e692,null));};exports[_0x864d('0x47')]=function(_0x270208,_0x1bbccc){var _0x538e40={'raw':!![],'where':{'id':_0x270208[_0x864d('0x48')]['id']}},_0x1b4c64={};_0x1b4c64[_0x864d('0x31')]=_[_0x864d('0x33')](db[_0x864d('0x2e')][_0x864d('0x49')]);_0x1b4c64[_0x864d('0x32')]=_[_0x864d('0x33')](_0x270208[_0x864d('0x32')]);_0x1b4c64['filters']=_[_0x864d('0x35')](_0x1b4c64['model'],_0x1b4c64['query']);_0x538e40[_0x864d('0x36')]=_['intersection'](_0x1b4c64[_0x864d('0x31')],qs[_0x864d('0x37')](_0x270208[_0x864d('0x32')][_0x864d('0x37')]));_0x538e40[_0x864d('0x36')]=_0x538e40[_0x864d('0x36')][_0x864d('0x38')]?_0x538e40[_0x864d('0x36')]:_0x1b4c64[_0x864d('0x31')];if(_0x270208[_0x864d('0x32')][_0x864d('0x43')]){_0x538e40['include']=[{'all':!![]}];}_0x538e40=_[_0x864d('0x3f')]({},_0x538e40,_0x270208['options']);return db[_0x864d('0x2e')][_0x864d('0x4a')](_0x538e40)[_0x864d('0x27')](handleEntityNotFound(_0x1bbccc,null))[_0x864d('0x27')](respondWithResult(_0x1bbccc,null))['catch'](handleError(_0x1bbccc,null));};exports[_0x864d('0x4b')]=function(_0x3bde79,_0x418c26){return db[_0x864d('0x2e')][_0x864d('0x4b')](_0x3bde79[_0x864d('0x4c')],{})[_0x864d('0x27')](respondWithResult(_0x418c26,0xc9))[_0x864d('0x46')](handleError(_0x418c26,null));};exports[_0x864d('0x26')]=function(_0x3feaea,_0xff3a5){if(_0x3feaea['body']['id']){delete _0x3feaea[_0x864d('0x4c')]['id'];}return db[_0x864d('0x2e')][_0x864d('0x4a')]({'where':{'id':_0x3feaea[_0x864d('0x48')]['id']}})[_0x864d('0x27')](handleEntityNotFound(_0xff3a5,null))['then'](saveUpdates(_0x3feaea['body'],null))['then'](respondWithResult(_0xff3a5,null))[_0x864d('0x46')](handleError(_0xff3a5,null));};exports[_0x864d('0x4d')]=function(_0x3e1c80,_0xff95ac){return db['SmsApplication'][_0x864d('0x4a')]({'where':{'id':_0x3e1c80[_0x864d('0x48')]['id']}})['then'](handleEntityNotFound(_0xff95ac,null))[_0x864d('0x27')](removeEntity(_0xff95ac,null))[_0x864d('0x46')](handleError(_0xff95ac,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index c13b76a..ef46015 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 _0x192a=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','utf8mb4'];(function(_0x4d3a9b,_0x20b47d){var _0x1b5471=function(_0x51bf57){while(--_0x51bf57){_0x4d3a9b['push'](_0x4d3a9b['shift']());}};_0x1b5471(++_0x20b47d);}(_0x192a,0x17b));var _0xa192=function(_0x475770,_0x64adb9){_0x475770=_0x475770-0x0;var _0x49745d=_0x192a[_0x475770];return _0x49745d;};'use strict';var _=require(_0xa192('0x0'));var util=require(_0xa192('0x1'));var logger=require(_0xa192('0x2'))(_0xa192('0x3'));var moment=require('moment');var BPromise=require(_0xa192('0x4'));var rp=require(_0xa192('0x5'));var fs=require('fs');var path=require(_0xa192('0x6'));var rimraf=require(_0xa192('0x7'));var config=require(_0xa192('0x8'));var attributes=require(_0xa192('0x9'));module[_0xa192('0xa')]=function(_0x4e8ccf,_0x1dfa98){return _0x4e8ccf[_0xa192('0xb')]('SmsApplication',attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa192('0xc'),'collate':_0xa192('0xd')});}; \ No newline at end of file +var _0x0298=['request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird'];(function(_0x74844e,_0x52c9ea){var _0x9c0f62=function(_0x2ac9fc){while(--_0x2ac9fc){_0x74844e['push'](_0x74844e['shift']());}};_0x9c0f62(++_0x52c9ea);}(_0x0298,0x95));var _0x8029=function(_0x239cee,_0xf786c8){_0x239cee=_0x239cee-0x0;var _0x4fe6b6=_0x0298[_0x239cee];return _0x4fe6b6;};'use strict';var _=require(_0x8029('0x0'));var util=require('util');var logger=require(_0x8029('0x1'))(_0x8029('0x2'));var moment=require(_0x8029('0x3'));var BPromise=require(_0x8029('0x4'));var rp=require(_0x8029('0x5'));var fs=require('fs');var path=require(_0x8029('0x6'));var rimraf=require(_0x8029('0x7'));var config=require(_0x8029('0x8'));var attributes=require(_0x8029('0x9'));module['exports']=function(_0x37b617,_0xeae01){return _0x37b617['define'](_0x8029('0xa'),attributes,{'tableName':_0x8029('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8029('0xc'),'collate':_0x8029('0xd')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 940fbd0..f1ceb91 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 _0x8277=['request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','SmsApplication,\x20%s,\x20%s'];(function(_0xaf29da,_0x117f5a){var _0x295c51=function(_0x3feaf4){while(--_0x3feaf4){_0xaf29da['push'](_0xaf29da['shift']());}};_0x295c51(++_0x117f5a);}(_0x8277,0xcf));var _0x7827=function(_0x1bfe2b,_0x34856e){_0x1bfe2b=_0x1bfe2b-0x0;var _0x1477d4=_0x8277[_0x1bfe2b];return _0x1477d4;};'use strict';var _=require('lodash');var util=require(_0x7827('0x0'));var moment=require(_0x7827('0x1'));var BPromise=require('bluebird');var rs=require(_0x7827('0x2'));var fs=require('fs');var Redis=require(_0x7827('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7827('0x4'));var logger=require(_0x7827('0x5'))('rpc');var config=require(_0x7827('0x6'));var jayson=require(_0x7827('0x7'));var client=jayson[_0x7827('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e9e85,_0xbbc7df,_0x182412){return new BPromise(function(_0x24970d,_0x35fc12){return client[_0x7827('0x9')](_0x2e9e85,_0x182412)[_0x7827('0xa')](function(_0x3d1158){logger[_0x7827('0xb')](_0x7827('0xc'),_0xbbc7df,_0x7827('0xd'));logger[_0x7827('0xe')](_0x7827('0xf'),_0xbbc7df,_0x7827('0xd'),JSON['stringify'](_0x3d1158));if(_0x3d1158[_0x7827('0x10')]){if(_0x3d1158[_0x7827('0x10')][_0x7827('0x11')]===0x1f4){logger[_0x7827('0x10')]('SmsApplication,\x20%s,\x20%s',_0xbbc7df,_0x3d1158[_0x7827('0x10')][_0x7827('0x12')]);return _0x35fc12(_0x3d1158[_0x7827('0x10')][_0x7827('0x12')]);}logger[_0x7827('0x10')](_0x7827('0xc'),_0xbbc7df,_0x3d1158[_0x7827('0x10')][_0x7827('0x12')]);return _0x24970d(_0x3d1158[_0x7827('0x10')][_0x7827('0x12')]);}else{logger[_0x7827('0xb')](_0x7827('0xc'),_0xbbc7df,_0x7827('0xd'));_0x24970d(_0x3d1158[_0x7827('0x13')][_0x7827('0x12')]);}})['catch'](function(_0x3767f0){logger[_0x7827('0x10')](_0x7827('0xc'),_0xbbc7df,_0x3767f0);_0x35fc12(_0x3767f0);});});} \ No newline at end of file +var _0x2525=['client','http','then','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsApplication,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x373c6a,_0x17af35){var _0x12ec06=function(_0x1caa95){while(--_0x1caa95){_0x373c6a['push'](_0x373c6a['shift']());}};_0x12ec06(++_0x17af35);}(_0x2525,0x1f0));var _0x5252=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x2525[_0x187ee1];return _0x388160;};'use strict';var _=require(_0x5252('0x0'));var util=require(_0x5252('0x1'));var moment=require(_0x5252('0x2'));var BPromise=require(_0x5252('0x3'));var rs=require(_0x5252('0x4'));var fs=require('fs');var Redis=require(_0x5252('0x5'));var db=require(_0x5252('0x6'))['db'];var utils=require(_0x5252('0x7'));var logger=require(_0x5252('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5252('0x9'));var client=jayson[_0x5252('0xa')][_0x5252('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ff1f2,_0x335660,_0x39279b){return new BPromise(function(_0x5e8442,_0x233f82){return client['request'](_0x3ff1f2,_0x39279b)[_0x5252('0xc')](function(_0x3c8d35){logger['info']('SmsApplication,\x20%s,\x20%s',_0x335660,_0x5252('0xd'));logger['debug'](_0x5252('0xe'),_0x335660,_0x5252('0xd'),JSON[_0x5252('0xf')](_0x3c8d35));if(_0x3c8d35[_0x5252('0x10')]){if(_0x3c8d35[_0x5252('0x10')][_0x5252('0x11')]===0x1f4){logger[_0x5252('0x10')](_0x5252('0x12'),_0x335660,_0x3c8d35[_0x5252('0x10')][_0x5252('0x13')]);return _0x233f82(_0x3c8d35[_0x5252('0x10')][_0x5252('0x13')]);}logger[_0x5252('0x10')](_0x5252('0x12'),_0x335660,_0x3c8d35['error']['message']);return _0x5e8442(_0x3c8d35[_0x5252('0x10')][_0x5252('0x13')]);}else{logger[_0x5252('0x14')](_0x5252('0x12'),_0x335660,_0x5252('0xd'));_0x5e8442(_0x3c8d35[_0x5252('0x15')][_0x5252('0x13')]);}})['catch'](function(_0x4b244a){logger['error'](_0x5252('0x12'),_0x335660,_0x4b244a);_0x233f82(_0x4b244a);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 8a2e02e..cb5d65c 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 _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(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_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 +var _0x0b0e=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','describe','/:id','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','put','smsinteraction:update','delete','exports','multer'];(function(_0x5ea415,_0x154386){var _0x449030=function(_0x40909a){while(--_0x40909a){_0x5ea415['push'](_0x5ea415['shift']());}};_0x449030(++_0x154386);}(_0x0b0e,0x187));var _0xe0b0=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0x0b0e[_0x20a558];return _0x53d3f7;};'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')]('/describe',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['show']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/download',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x11')](_0xe0b0('0xe'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x13')]);router['post'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),interaction[_0xe0b0('0x15')](_0xe0b0('0x16'),_0xe0b0('0x17')),controller['addTags']);router[_0xe0b0('0x18')]('/:id',auth[_0xe0b0('0xa')](),interaction[_0xe0b0('0x15')]('sms',_0xe0b0('0x19')),controller['update']);router[_0xe0b0('0x1a')](_0xe0b0('0xd'),auth['isAuthenticated'](),interaction['tracked'](_0xe0b0('0x16'),'smsinteraction:destroy'),controller['destroy']);router['delete'](_0xe0b0('0x14'),auth['isAuthenticated'](),controller['removeTags']);module[_0xe0b0('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 788482b..dfd5e6e 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 _0x80c3=['BOOLEAN','STRING','ENUM','out','sequelize'];(function(_0x620dbb,_0x2653b6){var _0x396c1e=function(_0x489d7d){while(--_0x489d7d){_0x620dbb['push'](_0x620dbb['shift']());}};_0x396c1e(++_0x2653b6);}(_0x80c3,0x18f));var _0x380c=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0x80c3[_0x34021d];return _0x16597b;};'use strict';var Sequelize=require(_0x380c('0x0'));var moment=require('moment');module['exports']={'closed':{'type':Sequelize[_0x380c('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x380c('0x2')]},'secondDisposition':{'type':Sequelize[_0x380c('0x2')]},'thirdDisposition':{'type':Sequelize[_0x380c('0x2')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x380c('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x380c('0x3')]('in',_0x380c('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x380c('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0xd8a7=['BOOLEAN','sequelize','DATE','STRING','out','ENUM'];(function(_0x5b1389,_0x3f0664){var _0x559a88=function(_0x12ad09){while(--_0x12ad09){_0x5b1389['push'](_0x5b1389['shift']());}};_0x559a88(++_0x3f0664);}(_0xd8a7,0xdf));var _0x7d8a=function(_0x5a4341,_0x2cfff4){_0x5a4341=_0x5a4341-0x0;var _0x586b9a=_0xd8a7[_0x5a4341];return _0x586b9a;};'use strict';var Sequelize=require(_0x7d8a('0x0'));var moment=require('moment');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7d8a('0x1')]},'disposition':{'type':Sequelize[_0x7d8a('0x2')]},'secondDisposition':{'type':Sequelize[_0x7d8a('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7d8a('0x2')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x7d8a('0x1')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x7d8a('0x3')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x7d8a('0x4')]('in',_0x7d8a('0x3')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x7d8a('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 2a8de16..3eddb64 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 _0x77cb=['mkdirSync','Sms','N.A.','closed','closedAt','disposition','Messages','out','direction','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','limit','count','Content-Range','save','update','then','destroy','error','name','send','Users','fullname','TagIds','split','forEach','push','catch','index','SmsInteraction','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','select','field','color','tools_tags','u.id','ui.SmsInteractionId','user_has_sms_interactions','left_join','u.id\x20=\x20ui.UserId','from','sms_interactions','cm_contacts','users','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','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?','UserId','text','keys','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','c.phone','c.mobile','Contact.mobile','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','rows','rawAttributes','include','options','create','body','params','describe','addMessage','SmsMessage','ids','omit','findOne','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','spread','emit','smsInteractionTags:save','removeTags','download','join','server','files','tmp','root','attachments','CmContact','firstName','lastName','secret','SmsAccount','Account','Owner','get'];(function(_0x3714d3,_0x281bba){var _0x35a801=function(_0x2c46e4){while(--_0x2c46e4){_0x3714d3['push'](_0x3714d3['shift']());}};_0x35a801(++_0x281bba);}(_0x77cb,0x1e1));var _0xb77c=function(_0x59781d,_0x549c9f){_0x59781d=_0x59781d-0x0;var _0x2a5b01=_0x77cb[_0x59781d];return _0x2a5b01;};'use strict';var emlformat=require(_0xb77c('0x0'));var rimraf=require(_0xb77c('0x1'));var zipdir=require(_0xb77c('0x2'));var jsonpatch=require(_0xb77c('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb77c('0x4'));var Mustache=require(_0xb77c('0x5'));var util=require('util');var path=require(_0xb77c('0x6'));var sox=require('sox');var csv=require(_0xb77c('0x7'));var ejs=require(_0xb77c('0x8'));var fs=require('fs');var fs_extra=require(_0xb77c('0x9'));var _=require(_0xb77c('0xa'));var squel=require(_0xb77c('0xb'));var crypto=require(_0xb77c('0xc'));var jsforce=require(_0xb77c('0xd'));var deskjs=require(_0xb77c('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb77c('0xf'));var Papa=require(_0xb77c('0x10'));var Redis=require(_0xb77c('0x11'));var authService=require(_0xb77c('0x12'));var qs=require(_0xb77c('0x13'));var as=require(_0xb77c('0x14'));var pdf=require('../../components/export/pdf');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb77c('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb77c('0x16'));var db=require(_0xb77c('0x17'))['db'];config[_0xb77c('0x18')]=_[_0xb77c('0x19')](config[_0xb77c('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xb77c('0x1a'))(new Redis(config[_0xb77c('0x18')]));require(_0xb77c('0x1b'))[_0xb77c('0x1c')](socket);function respondWithStatusCode(_0x3604ef,_0x2f1e1a){_0x2f1e1a=_0x2f1e1a||0xcc;return function(_0xc65e8){if(_0xc65e8){return _0x3604ef[_0xb77c('0x1d')](_0x2f1e1a);}return _0x3604ef[_0xb77c('0x1e')](_0x2f1e1a)[_0xb77c('0x1f')]();};}function respondWithResult(_0x3eb74f,_0x458348){_0x458348=_0x458348||0xc8;return function(_0xf6b73a){if(_0xf6b73a){return _0x3eb74f[_0xb77c('0x1e')](_0x458348)[_0xb77c('0x20')](_0xf6b73a);}};}function respondWithFilteredResult(_0x56d12c,_0x4b7e6a){return function(_0x154f3e){if(_0x154f3e){var _0x7317e7=typeof _0x4b7e6a['offset']==='undefined'&&typeof _0x4b7e6a[_0xb77c('0x21')]==='undefined';var _0x2923f2=_0x154f3e['count'];var _0x3a590b=_0x7317e7?0x0:_0x4b7e6a['offset'];var _0x22d3b3=_0x7317e7?_0x154f3e[_0xb77c('0x22')]:_0x4b7e6a['offset']+_0x4b7e6a['limit'];var _0x22686d;if(_0x22d3b3>=_0x2923f2){_0x22d3b3=_0x2923f2;_0x22686d=0xc8;}else{_0x22686d=0xce;}_0x56d12c[_0xb77c('0x1e')](_0x22686d);return _0x56d12c['set'](_0xb77c('0x23'),_0x3a590b+'-'+_0x22d3b3+'/'+_0x2923f2)['json'](_0x154f3e);}return null;};}function patchUpdates(_0xc8b360){return function(_0x10ab74){try{jsonpatch['apply'](_0x10ab74,_0xc8b360,!![]);}catch(_0x59f792){return BPromise['reject'](_0x59f792);}return _0x10ab74[_0xb77c('0x24')]();};}function saveUpdates(_0x3ef83b,_0x559e60){return function(_0x391496){if(_0x391496){return _0x391496[_0xb77c('0x25')](_0x3ef83b)[_0xb77c('0x26')](function(_0x57510f){return _0x57510f;});}return null;};}function removeEntity(_0x3fbcaf,_0x3bab6c){return function(_0x25b449){if(_0x25b449){return _0x25b449[_0xb77c('0x27')]()[_0xb77c('0x26')](function(){_0x3fbcaf[_0xb77c('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42a87e,_0x383a39){return function(_0x5c783a){if(!_0x5c783a){_0x42a87e[_0xb77c('0x1d')](0x194);}return _0x5c783a;};}function handleError(_0x12230d,_0x2867c4){_0x2867c4=_0x2867c4||0x1f4;return function(_0x3f5601){logger[_0xb77c('0x28')](_0x3f5601['stack']);if(_0x3f5601[_0xb77c('0x29')]){delete _0x3f5601[_0xb77c('0x29')];}_0x12230d[_0xb77c('0x1e')](_0x2867c4)[_0xb77c('0x2a')](_0x3f5601);};}function getInteractionUsers(_0x208ccf,_0x263200){return new BPromise(function(_0x4202b1,_0x1ef8b5){try{if(_0x263200[_0x208ccf['id']]){_0x208ccf[_0xb77c('0x2b')]=_['map'](_0x263200[_0x208ccf['id']],function(_0x1c27d2){return{'id':_0x1c27d2['id'],'fullname':_0x1c27d2[_0xb77c('0x2c')]};});}}catch(_0x31347a){_0x1ef8b5(_0x31347a);}_0x4202b1(_0x208ccf);});}function getInteractionTags(_0x1a8536,_0x3d28b1){return new BPromise(function(_0xca1c4e,_0x4b7ad7){try{if(_0x1a8536['TagIds']){_0x1a8536['Tags']=[];_0x1a8536[_0xb77c('0x2d')][_0xb77c('0x2e')](',')[_0xb77c('0x2f')](function(_0x46b883){_0x1a8536['Tags'][_0xb77c('0x30')](_0x3d28b1[_0x46b883]);});}delete _0x1a8536['TagIds'];}catch(_0x18c473){_0x4b7ad7(_0x18c473);}_0xca1c4e(_0x1a8536);});}function updateSmsInteraction(_0x3bf4ee,_0x5f2204,_0x47efdf){return new BPromise(function(_0x545bce,_0x13c391){return getInteractionUsers(_0x3bf4ee,_0x47efdf)[_0xb77c('0x26')](function(_0x341ab3){return getInteractionTags(_0x341ab3,_0x5f2204);})['then'](function(_0x3887b1){_0x545bce(_0x3887b1);})[_0xb77c('0x31')](function(_0xf2103a){_0x13c391(_0xf2103a);});});}exports[_0xb77c('0x32')]=function(_0x39bc2c,_0x47fb12){var _0x41975f={},_0x310428={},_0x421b3a={'count':0x0,'rows':[]};var _0x3d24e9=_['map'](db[_0xb77c('0x33')]['rawAttributes'],function(_0x5f3f6f){return{'name':_0x5f3f6f['fieldName'],'type':_0x5f3f6f[_0xb77c('0x34')][_0xb77c('0x35')]};});_0x310428[_0xb77c('0x36')]=_[_0xb77c('0x37')](_0x3d24e9,'name');_0x310428[_0xb77c('0x38')]=_['keys'](_0x39bc2c[_0xb77c('0x38')]);_0x310428[_0xb77c('0x39')]=_[_0xb77c('0x3a')](_0x310428[_0xb77c('0x36')],_0x310428[_0xb77c('0x38')]);_0x41975f[_0xb77c('0x3b')]=_[_0xb77c('0x3a')](_0x310428[_0xb77c('0x36')],qs[_0xb77c('0x3c')](_0x39bc2c[_0xb77c('0x38')][_0xb77c('0x3c')]));_0x41975f['attributes']=_0x41975f[_0xb77c('0x3b')][_0xb77c('0x3d')]?_0x41975f['attributes']:_0x310428[_0xb77c('0x36')];if(!_0x39bc2c['query'][_0xb77c('0x3e')](_0xb77c('0x3f'))){_0x41975f[_0xb77c('0x21')]=qs['limit'](_0x39bc2c[_0xb77c('0x38')][_0xb77c('0x21')]);_0x41975f['offset']=qs[_0xb77c('0x40')](_0x39bc2c[_0xb77c('0x38')][_0xb77c('0x40')]);}_0x41975f[_0xb77c('0x41')]=qs[_0xb77c('0x42')](_0x39bc2c['query']['sort']);_0x41975f[_0xb77c('0x43')]=qs[_0xb77c('0x39')](_[_0xb77c('0x44')](_0x39bc2c[_0xb77c('0x38')],_0x310428['filters']),_0x3d24e9);var _0x1d805f=[];var _0x35028d=squel[_0xb77c('0x45')]()['field']('id')[_0xb77c('0x46')]('name')[_0xb77c('0x46')](_0xb77c('0x47'))['from'](_0xb77c('0x48'));var _0x2746f7=squel[_0xb77c('0x45')]()[_0xb77c('0x46')](_0xb77c('0x49'))['field']('u.fullname')[_0xb77c('0x46')](_0xb77c('0x4a'))['from'](_0xb77c('0x4b'),'ui')[_0xb77c('0x4c')]('users','u',_0xb77c('0x4d'));var _0x1f3594=squel[_0xb77c('0x45')]()[_0xb77c('0x4e')](_0xb77c('0x4f'),'i')[_0xb77c('0x4c')](_0xb77c('0x50'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0xb77c('0x51'),'o','o.id\x20=\x20i.UserId')[_0xb77c('0x4c')]('sms_accounts','a','a.id\x20=\x20i.SmsAccountId')[_0xb77c('0x4c')](_0xb77c('0x52'),'me',_0xb77c('0x53'))[_0xb77c('0x4c')](_0xb77c('0x54'),'it',_0xb77c('0x55'))[_0xb77c('0x4c')](_0xb77c('0x48'),'t',_0xb77c('0x56'));var _0x3edb76=squel[_0xb77c('0x57')]();var _0x535bb4=[];var _0x1c7d87=squel[_0xb77c('0x57')]();var _0xd4a6df;if(_0x39bc2c[_0xb77c('0x38')]['search']){_0xd4a6df=as[_0xb77c('0x58')](_0x39bc2c[_0xb77c('0x38')][_0xb77c('0x59')]);var _0x2dbb20=_0xd4a6df[_0xb77c('0x5a')];for(var _0xe7c1f1=0x0;_0xe7c1f1<_0xd4a6df[_0xb77c('0x5b')]['length'];_0xe7c1f1++){var _0x4bfa00=_0xd4a6df[_0xb77c('0x5b')][_0xe7c1f1];var _0x83f6c1='i';var _0x4b38a3=_['find'](_0x3d24e9,[_0xb77c('0x29'),_0x4bfa00[_0xb77c('0x46')]]);if(!_0x4b38a3){switch(_0x4bfa00[_0xb77c('0x46')]){case'unreadMessages':if(_0x4bfa00[_0xb77c('0x5c')]==0x1){_0x1f3594[_0xb77c('0x5d')]('`'+_0x4bfa00[_0xb77c('0x46')]+_0xb77c('0x5e'));}else{_0x1f3594[_0xb77c('0x5d')]('`'+_0x4bfa00[_0xb77c('0x46')]+_0xb77c('0x5f'));}break;case _0xb77c('0x60'):if(_0x4bfa00[_0xb77c('0x61')]===_0xb77c('0x62')){if(_0x4bfa00['value'][_0xb77c('0x2e')]('\x20')['length']>0x1){_0x3edb76[_0x2dbb20](_0xb77c('0x63'),qs[_0xb77c('0x64')](_0x4bfa00[_0xb77c('0x5c')]),null);}else{var _0x47edca='%'+_0x4bfa00[_0xb77c('0x5c')]+'%';_0x3edb76[_0x2dbb20](_0xb77c('0x65'),_0x47edca,_0x47edca,_0x47edca);}}else{_0x4b38a3=_[_0xb77c('0x66')](_0x3d24e9,['name','ContactId']);_0x4bfa00[_0xb77c('0x46')]=_0xb77c('0x67');_0xfe6678=as[_0xb77c('0x68')](_0x83f6c1,_0x4b38a3['type'],_0x4bfa00);_0x3edb76[_0x2dbb20](_0xfe6678['text'],_0xfe6678['value'][_0xb77c('0x69')],_0xfe6678[_0xb77c('0x5c')][_0xb77c('0x1f')]);}break;case _0xb77c('0x6a'):var _0x2f17fd=_0x4bfa00['value'][_0xb77c('0x2e')](',')[_0xb77c('0x37')](function(_0x57bf9b){return Number(_0x57bf9b);});_0x2f17fd[_0xb77c('0x2f')](function(_0x5bdee2){_0x1c7d87['or'](_0xb77c('0x6b'),'%,'+_0x5bdee2+',%');});_0x535bb4=_[_0xb77c('0x6c')](_0x535bb4,_0x2f17fd);break;case _0xb77c('0x6d'):if(_0x4bfa00[_0xb77c('0x61')]==='$substring'){_0x3edb76[_0x2dbb20](_0xb77c('0x6e'),'%'+_0x4bfa00[_0xb77c('0x5c')]+'%',null);}else{_0x4b38a3=_['find'](_0x3d24e9,[_0xb77c('0x29'),_0xb77c('0x6f')]);_0x4bfa00[_0xb77c('0x46')]=_0xb77c('0x6f');_0xfe6678=as[_0xb77c('0x68')](_0x83f6c1,_0x4b38a3['type'],_0x4bfa00);_0x3edb76[_0x2dbb20](_0xfe6678[_0xb77c('0x70')],_0xfe6678[_0xb77c('0x5c')][_0xb77c('0x69')],_0xfe6678[_0xb77c('0x5c')][_0xb77c('0x1f')]);}break;case'body':_0xfe6678=as[_0xb77c('0x68')]('me',null,_0x4bfa00);_0x3edb76[_0x2dbb20](_0xfe6678[_0xb77c('0x70')],_0xfe6678[_0xb77c('0x5c')][_0xb77c('0x69')],_0xfe6678[_0xb77c('0x5c')]['end']);break;}}else{var _0xfe6678=as[_0xb77c('0x68')](_0x83f6c1,_0x4b38a3[_0xb77c('0x34')],_0x4bfa00);_0x3edb76[_0x2dbb20](_0xfe6678['text'],_0xfe6678['value'][_0xb77c('0x69')],_0xfe6678[_0xb77c('0x5c')][_0xb77c('0x1f')]);}}}else{var _0x399715=_(_0x39bc2c[_0xb77c('0x38')])[_0xb77c('0x71')]()[_0xb77c('0x37')](function(_0x13c85e){return _[_0xb77c('0x72')](_0x3d24e9,[_0xb77c('0x29'),_0x13c85e])?_0x13c85e:undefined;})[_0xb77c('0x73')]()[_0xb77c('0x5c')]();if(!_[_0xb77c('0x74')](_0x399715)){_0x399715[_0xb77c('0x2f')](function(_0x305624){if(_0x305624===_0xb77c('0x75')){_0x1f3594['where'](_0xb77c('0x76'),[]['concat'](_0x39bc2c['query'][_0x305624]));}else if(_0x305624===_0xb77c('0x77')){var _0x4337d3=JSON['parse'](_0x39bc2c[_0xb77c('0x38')][_0x305624])[_0xb77c('0x78')];var _0x1aba69=JSON[_0xb77c('0x79')](_0x39bc2c['query'][_0x305624])[_0xb77c('0x7a')];_0x1f3594[_0xb77c('0x43')](_0xb77c('0x7b'),_0x4337d3,_0x1aba69);}else{if(_0x39bc2c[_0xb77c('0x38')][_0x305624]==='null'){_0x1f3594['where']('i.'+_0x305624+_0xb77c('0x7c'));}else{_0x1f3594[_0xb77c('0x43')]('i.'+_0x305624+_0xb77c('0x7d'),_0x39bc2c[_0xb77c('0x38')][_0x305624]);}}});}if(_0x39bc2c[_0xb77c('0x38')]['read']){if(_0x39bc2c[_0xb77c('0x38')][_0xb77c('0x7e')]==0x1){_0x1f3594[_0xb77c('0x5d')](_0xb77c('0x7f'));}else{_0x1f3594['having'](_0xb77c('0x80'));}}if(_0x39bc2c[_0xb77c('0x38')][_0xb77c('0x81')]){_0x535bb4=_[_0xb77c('0x82')](_0x39bc2c[_0xb77c('0x38')][_0xb77c('0x81')])?_0x39bc2c['query'][_0xb77c('0x81')]:new Array(_0x39bc2c[_0xb77c('0x38')][_0xb77c('0x81')]);_0x535bb4[_0xb77c('0x2f')](function(_0x59997c){_0x1c7d87['or'](_0xb77c('0x6b'),'%,'+_0x59997c+',%');});}if(_0x39bc2c[_0xb77c('0x38')][_0xb77c('0x83')]){var _0x2460f0=_0x39bc2c[_0xb77c('0x38')][_0xb77c('0x83')][_0xb77c('0x84')]('\x5c','\x5c\x5c')[_0xb77c('0x84')](/'/g,'\x27\x27');if(qs[_0xb77c('0x85')](_0x2460f0)){_0x3edb76['or']('i.id\x20LIKE\x20?',_0x2460f0+'%')['or'](_0xb77c('0x86'),_0x2460f0+'%');}else{_0x3edb76['or'](_0xb77c('0x87'),qs[_0xb77c('0x64')](_0x2460f0))['or'](_0xb77c('0x88'),_0x2460f0+'%');}}}_0x1f3594[_0xb77c('0x43')](_0x3edb76);_0x1f3594[_0xb77c('0x89')](_0xb77c('0x8a'));var _0x481930={'type':db[_0xb77c('0x8b')][_0xb77c('0x8c')][_0xb77c('0x8d')],'raw':!![]};var _0x4bba27=_0x1f3594[_0xb77c('0x8e')]();_0x4bba27['field'](_0xb77c('0x8a'));_0x4bba27[_0xb77c('0x46')](_0xb77c('0x8f'),_0xb77c('0x90'));if(_0x41975f[_0xb77c('0x41')]){_0x41975f['order'][_0xb77c('0x2f')](function(_0x513d9d){var _0xe46ee9=_0x513d9d[0x0]==='contactName'?_0x513d9d[0x0]:'i.'+_0x513d9d[0x0];_0x1f3594['order'](_0xe46ee9,_0x513d9d[0x1]===_0xb77c('0x91')?![]:!![]);});}if(!_['isEmpty'](_0x535bb4)){_0x1f3594[_0xb77c('0x5d')](_0x1c7d87);_0x4bba27[_0xb77c('0x43')](_0xb77c('0x92'),_0x535bb4);}BPromise[_0xb77c('0x93')]()[_0xb77c('0x26')](function(){if(!_0xd4a6df){if(_0x39bc2c[_0xb77c('0x38')][_0xb77c('0x75')])return;_0x4bba27[_0xb77c('0x43')](_0xb77c('0x94'));_0x1f3594[_0xb77c('0x43')](_0xb77c('0x94'));return;}if(_0x39bc2c[_0xb77c('0x95')][_0xb77c('0x96')]!==_0xb77c('0x97'))return;return _0x39bc2c[_0xb77c('0x95')][_0xb77c('0x98')]({'attributes':['id'],'raw':!![]})['then'](function(_0x31b56c){if(_[_0xb77c('0x74')](_0x31b56c)){_0x4bba27[_0xb77c('0x43')]('i.SmsAccountId\x20IS\x20NULL');_0x1f3594['where'](_0xb77c('0x99'));}else{_0x4bba27[_0xb77c('0x43')](_0xb77c('0x76'),_[_0xb77c('0x37')](_0x31b56c,'id'));_0x1f3594[_0xb77c('0x43')](_0xb77c('0x76'),_[_0xb77c('0x37')](_0x31b56c,'id'));}});})[_0xb77c('0x26')](function(){if(_0x39bc2c['user'][_0xb77c('0x96')]===_0xb77c('0x97')&&!_0xd4a6df&&!_0x39bc2c[_0xb77c('0x38')][_0xb77c('0x75')])return[];return db[_0xb77c('0x9a')][_0xb77c('0x38')](_0x4bba27['toString'](),_0x481930);})[_0xb77c('0x26')](function(_0x39ecdf){_0x421b3a[_0xb77c('0x22')]=_0x39ecdf[_0xb77c('0x3d')];if(_0x421b3a['count']===0x0)return[];return db[_0xb77c('0x9a')][_0xb77c('0x38')](_0x35028d['toString'](),_0x481930)[_0xb77c('0x26')](function(_0x2c05bb){_0x1d805f=_[_0xb77c('0x9b')](_0x2c05bb,'id');_0x481930=_[_0xb77c('0x9c')](_0x481930,{'model':db[_0xb77c('0x33')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x39bc2c['query'][_0xb77c('0x3c')]){_0x41975f[_0xb77c('0x3b')][_0xb77c('0x2f')](function(_0x255cbd){_0x1f3594[_0xb77c('0x46')]('i.'+_0x255cbd);});}else{_0x1f3594[_0xb77c('0x46')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x1f3594[_0xb77c('0x46')](_0xb77c('0x9d'),_0xb77c('0x9e'));_0x1f3594['field'](_0xb77c('0x9f'),_0xb77c('0xa0'));_0x1f3594[_0xb77c('0x46')](_0xb77c('0xa1'),'contactName');_0x1f3594[_0xb77c('0x46')](_0xb77c('0xa2'));_0x1f3594['field'](_0xb77c('0xa3'),_0xb77c('0xa4'));_0x1f3594['field']('c.lastName',_0xb77c('0xa5'));_0x1f3594[_0xb77c('0x46')](_0xb77c('0xa6'),'Contact.email');_0x1f3594['field'](_0xb77c('0xa7'),'Contact.phone');_0x1f3594[_0xb77c('0x46')](_0xb77c('0xa8'),_0xb77c('0xa9'));_0x1f3594[_0xb77c('0x46')]('c.fax','Contact.fax');_0x1f3594[_0xb77c('0x46')]('o.fullname','Owner.fullname');_0x1f3594['field']('o.internal',_0xb77c('0xaa'));_0x1f3594[_0xb77c('0x46')](_0xb77c('0xab'),_0xb77c('0x2d'));}if(_0x41975f[_0xb77c('0x21')])_0x1f3594['limit'](_0x41975f[_0xb77c('0x21')]);if(_0x41975f['offset'])_0x1f3594['offset'](_0x41975f['offset']);return db[_0xb77c('0x9a')][_0xb77c('0x38')](_0x1f3594[_0xb77c('0xac')](),_0x481930);})[_0xb77c('0x26')](function(_0x232ea1){if(_0x232ea1[_0xb77c('0x3d')]>0x0)_0x2746f7['where'](_0xb77c('0xad'),_['map'](_0x232ea1,'id'));return db['sequelize'][_0xb77c('0x38')](_0x2746f7[_0xb77c('0xac')](),_0x481930)['then'](function(_0x5bb7a4){var _0x152522=_[_0xb77c('0xae')](_0x5bb7a4,_0xb77c('0xaf'));var _0x1bdcd9=[];_0x232ea1[_0xb77c('0x2f')](function(_0x48c8b8){_0x1bdcd9[_0xb77c('0x30')](updateSmsInteraction(_0x48c8b8,_0x1d805f,_0x152522));});return BPromise[_0xb77c('0xb0')](_0x1bdcd9);});});})[_0xb77c('0x26')](function(_0x23b91d){_0x421b3a[_0xb77c('0xb1')]=_0x23b91d;return _0x421b3a;})['then'](respondWithFilteredResult(_0x47fb12,_0x41975f))[_0xb77c('0x31')](handleError(_0x47fb12,null));};exports['show']=function(_0x41e9b5,_0x59e4d1){var _0x34507d={'raw':![],'where':{'id':_0x41e9b5['params']['id']}},_0x3c3135={};_0x3c3135['model']=_[_0xb77c('0x71')](db[_0xb77c('0x33')][_0xb77c('0xb2')]);_0x3c3135[_0xb77c('0x38')]=_[_0xb77c('0x71')](_0x41e9b5[_0xb77c('0x38')]);_0x3c3135[_0xb77c('0x39')]=_[_0xb77c('0x3a')](_0x3c3135['model'],_0x3c3135[_0xb77c('0x38')]);_0x34507d[_0xb77c('0x3b')]=_['intersection'](_0x3c3135[_0xb77c('0x36')],qs[_0xb77c('0x3c')](_0x41e9b5['query']['fields']));_0x34507d[_0xb77c('0x3b')]=_0x34507d[_0xb77c('0x3b')][_0xb77c('0x3d')]?_0x34507d[_0xb77c('0x3b')]:_0x3c3135[_0xb77c('0x36')];if(_0x41e9b5[_0xb77c('0x38')]['includeAll']){_0x34507d[_0xb77c('0xb3')]=[{'all':!![]}];}_0x34507d=_[_0xb77c('0x9c')]({},_0x34507d,_0x41e9b5[_0xb77c('0xb4')]);return db[_0xb77c('0x33')][_0xb77c('0x66')](_0x34507d)[_0xb77c('0x26')](handleEntityNotFound(_0x59e4d1,null))[_0xb77c('0x26')](respondWithResult(_0x59e4d1,null))[_0xb77c('0x31')](handleError(_0x59e4d1,null));};exports[_0xb77c('0xb5')]=function(_0x35b804,_0x358470){return db[_0xb77c('0x33')][_0xb77c('0xb5')](_0x35b804[_0xb77c('0xb6')],{})[_0xb77c('0x26')](respondWithResult(_0x358470,0xc9))[_0xb77c('0x31')](handleError(_0x358470,null));};exports['update']=function(_0x357fa9,_0x446db0){if(_0x357fa9['body']['id']){delete _0x357fa9[_0xb77c('0xb6')]['id'];}return db['SmsInteraction']['find']({'where':{'id':_0x357fa9[_0xb77c('0xb7')]['id']}})[_0xb77c('0x26')](handleEntityNotFound(_0x446db0,null))['then'](saveUpdates(_0x357fa9[_0xb77c('0xb6')],null))[_0xb77c('0x26')](respondWithResult(_0x446db0,null))[_0xb77c('0x31')](handleError(_0x446db0,null));};exports['destroy']=function(_0x1a7fff,_0x302389){return db['SmsInteraction'][_0xb77c('0x66')]({'where':{'id':_0x1a7fff[_0xb77c('0xb7')]['id']}})['then'](handleEntityNotFound(_0x302389,null))[_0xb77c('0x26')](removeEntity(_0x302389,null))[_0xb77c('0x31')](handleError(_0x302389,null));};exports[_0xb77c('0xb8')]=function(_0xb429c4,_0x4af197){return db[_0xb77c('0x33')][_0xb77c('0xb8')]()[_0xb77c('0x26')](respondWithResult(_0x4af197,null))['catch'](handleError(_0x4af197,null));};exports[_0xb77c('0xb9')]=function(_0x1341c3,_0x2511e9,_0x5ca905){return db[_0xb77c('0xba')][_0xb77c('0x66')]({'where':{'id':_0x1341c3[_0xb77c('0xb7')]['id']}})['then'](handleEntityNotFound(_0x2511e9,null))[_0xb77c('0x26')](function(_0x44f399){if(_0x44f399){return _0x44f399[_0xb77c('0xb9')](_0x1341c3['body'][_0xb77c('0xbb')],_[_0xb77c('0xbc')](_0x1341c3['body'],[_0xb77c('0xbb'),'id'])||{});}})['then'](respondWithResult(_0x2511e9,null))[_0xb77c('0x31')](handleError(_0x2511e9,null));};exports['getMessages']=function(_0x25a28c,_0x206897,_0x50095a){var _0x544917={'raw':![],'where':{}};var _0xc6de3c={};var _0x138e6f={'count':0x0,'rows':[]};return db[_0xb77c('0x33')][_0xb77c('0xbd')]({'where':{'id':_0x25a28c[_0xb77c('0xb7')]['id']}})[_0xb77c('0x26')](handleEntityNotFound(_0x206897,null))[_0xb77c('0x26')](function(_0x981221){if(_0x981221){_0xc6de3c[_0xb77c('0x36')]=_[_0xb77c('0x71')](db[_0xb77c('0xba')]['rawAttributes']);_0xc6de3c[_0xb77c('0x38')]=_[_0xb77c('0x71')](_0x25a28c[_0xb77c('0x38')]);_0xc6de3c[_0xb77c('0x39')]=_['intersection'](_0xc6de3c[_0xb77c('0x36')],_0xc6de3c[_0xb77c('0x38')]);_0x544917[_0xb77c('0x3b')]=_[_0xb77c('0x3a')](_0xc6de3c[_0xb77c('0x36')],qs[_0xb77c('0x3c')](_0x25a28c['query'][_0xb77c('0x3c')]));_0x544917[_0xb77c('0x3b')]=_0x544917[_0xb77c('0x3b')][_0xb77c('0x3d')]?_0x544917[_0xb77c('0x3b')]:_0xc6de3c['model'];if(!_0x25a28c[_0xb77c('0x38')]['hasOwnProperty'](_0xb77c('0x3f'))){_0x544917[_0xb77c('0x21')]=qs[_0xb77c('0x21')](_0x25a28c[_0xb77c('0x38')][_0xb77c('0x21')]);_0x544917[_0xb77c('0x40')]=qs[_0xb77c('0x40')](_0x25a28c['query'][_0xb77c('0x40')]);}_0x544917['order']=qs[_0xb77c('0x42')](_0x25a28c['query']['sort']);_0x544917['where']=qs['filters'](_[_0xb77c('0x44')](_0x25a28c['query'],_0xc6de3c[_0xb77c('0x39')]));_0x544917[_0xb77c('0x43')][_0xb77c('0xaf')]=_0x981221['id'];if(_0x25a28c['query'][_0xb77c('0x83')]){_0x544917[_0xb77c('0x43')]=_[_0xb77c('0x9c')](_0x544917[_0xb77c('0x43')],{'$or':_[_0xb77c('0x37')](_0x544917[_0xb77c('0x3b')],function(_0x3477c5){var _0x8c7c91={};_0x8c7c91[_0x3477c5]={'$like':'%'+_0x25a28c['query'][_0xb77c('0x83')]+'%'};return _0x8c7c91;})});}if(_0x25a28c[_0xb77c('0x38')][_0xb77c('0x78')]){var _0x5866ef=_0x25a28c[_0xb77c('0x38')][_0xb77c('0x78')][_0xb77c('0x2e')](',');var _0x8981e9={};_0x8981e9[_0x5866ef[0x0]]={'$gte':moment(_0x5866ef[0x1])[_0xb77c('0xbe')](_0xb77c('0xbf'))};_0x544917[_0xb77c('0x43')]=_[_0xb77c('0x9c')](_0x544917[_0xb77c('0x43')],_0x8981e9);}_0x544917=_['merge']({},_0x544917,_0x25a28c[_0xb77c('0xb4')]);return db['SmsMessage']['count']({'where':_0x544917['where']})['then'](function(_0x28d224){_0x138e6f[_0xb77c('0x22')]=_0x28d224;if(_0x25a28c[_0xb77c('0x38')][_0xb77c('0xc0')]){_0x544917[_0xb77c('0xb3')]=[{'all':!![]}];}return db['SmsMessage'][_0xb77c('0xc1')](_0x544917);})[_0xb77c('0x26')](function(_0x5d9ad0){_0x138e6f[_0xb77c('0xb1')]=_0x5d9ad0;return _0x138e6f;});}})[_0xb77c('0x26')](respondWithFilteredResult(_0x206897,_0x544917))['catch'](handleError(_0x206897,null));};exports[_0xb77c('0xc2')]=function(_0x111930,_0x4fdf7c,_0x24ac7a){return db[_0xb77c('0x33')][_0xb77c('0x66')]({'where':{'id':_0x111930['params']['id']}})[_0xb77c('0x26')](handleEntityNotFound(_0x4fdf7c,null))[_0xb77c('0x26')](function(_0x215816){if(_0x215816){return _0x215816[_0xb77c('0xc3')](_0x111930['body'][_0xb77c('0xbb')],_[_0xb77c('0xbc')](_0x111930[_0xb77c('0xb6')],[_0xb77c('0xbb'),'id'])||{})[_0xb77c('0xc4')](function(){return db[_0xb77c('0x6a')][_0xb77c('0xc1')]({'attributes':['id',_0xb77c('0x29'),_0xb77c('0x47')],'where':{'id':_0x111930[_0xb77c('0xb6')][_0xb77c('0xbb')]}});})[_0xb77c('0x26')](function(_0xf6f070){socket[_0xb77c('0xc5')](_0xb77c('0xc6'),{'id':Number(_0x111930['params']['id']),'tags':_0xf6f070||[]});return{'id':Number(_0x111930[_0xb77c('0xb7')]['id']),'tags':_0xf6f070||[]};});}})[_0xb77c('0x26')](respondWithResult(_0x4fdf7c,null))['catch'](handleError(_0x4fdf7c,null));};exports['removeTags']=function(_0x2c82cd,_0x4e7f13,_0x48d1aa){return db[_0xb77c('0x33')][_0xb77c('0x66')]({'where':{'id':_0x2c82cd[_0xb77c('0xb7')]['id']}})['then'](handleEntityNotFound(_0x4e7f13,null))['then'](function(_0x161ee7){if(_0x161ee7){return _0x161ee7[_0xb77c('0xc7')](_0x2c82cd['query'][_0xb77c('0xbb')]);}})[_0xb77c('0x26')](respondWithStatusCode(_0x4e7f13,null))['catch'](handleError(_0x4e7f13,null));};exports[_0xb77c('0xc8')]=function(_0x337886,_0x25e1a9){var _0x1f7e2b=moment()['unix']()[_0xb77c('0xac')]();var _0x244d82=path[_0xb77c('0xc9')](config['root'],_0xb77c('0xca'),_0xb77c('0xcb'),_0xb77c('0xcc'));var _0x83fd9f=path[_0xb77c('0xc9')](config[_0xb77c('0xcd')],_0xb77c('0xca'),_0xb77c('0xcb'),_0xb77c('0xce'));var _0x385f19=path[_0xb77c('0xc9')](_0x244d82,_0x1f7e2b);var _0x196a68=util[_0xb77c('0xbe')]('transcript-%d-%s.zip',_0x337886[_0xb77c('0xb7')]['id'],_0x1f7e2b);var _0x1e1775=path[_0xb77c('0xc9')](_0x244d82,_0x196a68);var _0x5287d3=[];_0x5287d3[_0xb77c('0x30')]({'model':db[_0xb77c('0x6d')],'as':_0xb77c('0x6d'),'attributes':['id','fullname'],'raw':!![]});_0x5287d3[_0xb77c('0x30')]({'model':db[_0xb77c('0xcf')],'as':_0xb77c('0x60'),'attributes':['id',_0xb77c('0xd0'),_0xb77c('0xd1')],'raw':!![]});var _0x363f9b=[{'model':db[_0xb77c('0xba')],'as':'Messages','attributes':['id','body',_0xb77c('0x77'),'direction',_0xb77c('0xd2'),_0xb77c('0x7e')],'include':_0x5287d3}];_0x363f9b[_0xb77c('0x30')]({'model':db[_0xb77c('0xd3')],'as':_0xb77c('0xd4'),'attributes':['id',_0xb77c('0x29')]});_0x363f9b[_0xb77c('0x30')]({'model':db[_0xb77c('0x6d')],'as':_0xb77c('0xd5'),'attributes':['id',_0xb77c('0x2c')]});return db[_0xb77c('0x33')][_0xb77c('0x66')]({'where':{'id':_0x337886['params']['id']},'include':_0x363f9b})[_0xb77c('0x26')](handleEntityNotFound(_0x25e1a9,null))[_0xb77c('0x26')](function(_0x5d961b){if(_0x5d961b){var _0x1b4188=_0x5d961b[_0xb77c('0xd6')]({'plain':!![]});fs[_0xb77c('0xd7')](_0x385f19);var _0x3b54c3={'channel':_0xb77c('0xd8'),'account':_0x1b4188['Account'][_0xb77c('0x29')],'agent':_0x1b4188[_0xb77c('0xd5')]?_0x1b4188[_0xb77c('0xd5')]['fullname']:_0xb77c('0xd9'),'createdAt':moment(_0x1b4188[_0xb77c('0x77')])[_0xb77c('0xbe')](_0xb77c('0xbf'))['toString'](),'closedAt':_0x1b4188[_0xb77c('0xda')]?moment(_0x1b4188[_0xb77c('0xdb')])[_0xb77c('0xbe')](_0xb77c('0xbf'))['toString']():'','disposition':_0x1b4188[_0xb77c('0xdc')],'messages':_(_0x1b4188[_0xb77c('0xdd')])['filter']({'secret':![]})['map'](function(_0x1d38e0){return{'date':moment(_0x1d38e0[_0xb77c('0x77')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x1d38e0['direction']===_0xb77c('0xde')?_0x1d38e0['User']?_0x1d38e0[_0xb77c('0x6d')][_0xb77c('0x2c')]:'System':_0x1d38e0[_0xb77c('0x60')][_0xb77c('0xd0')]+(_0x1d38e0[_0xb77c('0x60')][_0xb77c('0xd1')]?'\x20'+_0x1d38e0[_0xb77c('0x60')][_0xb77c('0xd1')]:''),'body':_0x1d38e0[_0xb77c('0xb6')],'direction':_0x1d38e0[_0xb77c('0xdf')]===_0xb77c('0xde')?'A':'C','secret':_0x1d38e0[_0xb77c('0xd2')],'read':_0x1d38e0[_0xb77c('0x7e')]};})['value']()};return ejs[_0xb77c('0xe0')](path[_0xb77c('0xc9')](config[_0xb77c('0xcd')],_0xb77c('0xca'),_0xb77c('0xe1'),_0xb77c('0xe2')),{'interaction':_0x3b54c3})[_0xb77c('0x26')](function(_0x1f2b1a){var _0x2d6835=path['join'](_0x385f19,'transcript-'+_0x1b4188['id']+'-'+_0x1f7e2b+_0xb77c('0xe3'));var _0x5b1f7b={'path':_0x2d6835,'channel':_0xb77c('0xd8'),'interactionId':_0x1b4188['id']};return pdf[_0xb77c('0xe4')](_0x1f2b1a,_0x5b1f7b);})[_0xb77c('0x26')](function(){return new BPromise(function(_0x40f96e,_0x42c48e){zipdir(_0x385f19,{'saveTo':_0x1e1775},function(_0x301818,_0x5cf297){if(_0x301818)return _0x42c48e(_0x301818);return _0x40f96e(_0x5cf297);});})[_0xb77c('0x26')](function(){return new BPromise(function(_0xbc5729,_0x4435f0){rimraf(_0x385f19,function(_0xec96eb){if(_0xec96eb)_0x4435f0(_0xec96eb);return _0xbc5729();});});})['then'](function(){return _0x25e1a9['download'](_0x1e1775,_0x196a68,function(_0xb9e98d){if(_0xb9e98d){console[_0xb77c('0xe5')](_0xb77c('0xe6'),_0xb9e98d);}else{fs[_0xb77c('0xe7')](_0x1e1775);}});});});}else{return _0x25e1a9[_0xb77c('0x1d')](0xc8);}})[_0xb77c('0x31')](handleError(_0x25e1a9,null));}; \ No newline at end of file +var _0x742d=['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)','group','i.id','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','contactName','DESC','t.id\x20IN\x20?','i.SmsAccountId\x20IS\x20NOT\x20NULL','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','user','sequelize','toString','keyBy','merge','a.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','SmsInteractionId','rows','show','SmsInteraction','rawAttributes','includeAll','include','options','params','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','emit','removeTags','download','unix','server','files','join','root','attachments','push','CmContact','lastName','Messages','createdAt','secret','Account','Owner','get','mkdirSync','closed','closedAt','disposition','direction','out','firstName','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Sms','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','send','Users','map','fullname','TagIds','split','forEach','Tags','catch','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','user_has_sms_interactions','left_join','users','sms_interactions','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','having','`\x20=\x200','`\x20>\x200','Contact','$substring','value','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','Tag','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','type','start','body','keys','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','tag'];(function(_0x25273c,_0x270695){var _0x4374e9=function(_0x239be3){while(--_0x239be3){_0x25273c['push'](_0x25273c['shift']());}};_0x4374e9(++_0x270695);}(_0x742d,0x66));var _0xd742=function(_0x27b7ac,_0x2350b9){_0x27b7ac=_0x27b7ac-0x0;var _0x5a1274=_0x742d[_0x27b7ac];return _0x5a1274;};'use strict';var emlformat=require(_0xd742('0x0'));var rimraf=require(_0xd742('0x1'));var zipdir=require(_0xd742('0x2'));var jsonpatch=require(_0xd742('0x3'));var rp=require(_0xd742('0x4'));var moment=require(_0xd742('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd742('0x6'));var util=require(_0xd742('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xd742('0x8'));var ejs=require(_0xd742('0x9'));var fs=require('fs');var fs_extra=require(_0xd742('0xa'));var _=require(_0xd742('0xb'));var squel=require(_0xd742('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd742('0xd'));var toCsv=require(_0xd742('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd742('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd742('0xf'));var as=require(_0xd742('0x10'));var pdf=require(_0xd742('0x11'));var hardwareService=require(_0xd742('0x12'));var logger=require(_0xd742('0x13'))(_0xd742('0x14'));var utils=require(_0xd742('0x15'));var config=require(_0xd742('0x16'));var licenseUtil=require(_0xd742('0x17'));var db=require(_0xd742('0x18'))['db'];config[_0xd742('0x19')]=_[_0xd742('0x1a')](config[_0xd742('0x19')],{'host':_0xd742('0x1b'),'port':0x18eb});var socket=require(_0xd742('0x1c'))(new Redis(config['redis']));require(_0xd742('0x1d'))[_0xd742('0x1e')](socket);function respondWithStatusCode(_0x3cd1d9,_0x71333d){_0x71333d=_0x71333d||0xcc;return function(_0x12778f){if(_0x12778f){return _0x3cd1d9['sendStatus'](_0x71333d);}return _0x3cd1d9['status'](_0x71333d)[_0xd742('0x1f')]();};}function respondWithResult(_0x5a5279,_0x5b8c4d){_0x5b8c4d=_0x5b8c4d||0xc8;return function(_0x5b67ba){if(_0x5b67ba){return _0x5a5279['status'](_0x5b8c4d)[_0xd742('0x20')](_0x5b67ba);}};}function respondWithFilteredResult(_0xdb93b8,_0x169bf2){return function(_0xdc42d9){if(_0xdc42d9){var _0x1f5f72=typeof _0x169bf2[_0xd742('0x21')]===_0xd742('0x22')&&typeof _0x169bf2[_0xd742('0x23')]===_0xd742('0x22');var _0x1124fc=_0xdc42d9[_0xd742('0x24')];var _0x2ff9b4=_0x1f5f72?0x0:_0x169bf2[_0xd742('0x21')];var _0x5ade4e=_0x1f5f72?_0xdc42d9[_0xd742('0x24')]:_0x169bf2[_0xd742('0x21')]+_0x169bf2['limit'];var _0x5ed62d;if(_0x5ade4e>=_0x1124fc){_0x5ade4e=_0x1124fc;_0x5ed62d=0xc8;}else{_0x5ed62d=0xce;}_0xdb93b8[_0xd742('0x25')](_0x5ed62d);return _0xdb93b8[_0xd742('0x26')](_0xd742('0x27'),_0x2ff9b4+'-'+_0x5ade4e+'/'+_0x1124fc)[_0xd742('0x20')](_0xdc42d9);}return null;};}function patchUpdates(_0x47e3d2){return function(_0x1e0f67){try{jsonpatch[_0xd742('0x28')](_0x1e0f67,_0x47e3d2,!![]);}catch(_0x4894a3){return BPromise[_0xd742('0x29')](_0x4894a3);}return _0x1e0f67['save']();};}function saveUpdates(_0xe08d1,_0xff33de){return function(_0x4dc3c8){if(_0x4dc3c8){return _0x4dc3c8[_0xd742('0x2a')](_0xe08d1)[_0xd742('0x2b')](function(_0x4e9842){return _0x4e9842;});}return null;};}function removeEntity(_0x2be197,_0x2581e9){return function(_0x18a842){if(_0x18a842){return _0x18a842[_0xd742('0x2c')]()[_0xd742('0x2b')](function(){_0x2be197[_0xd742('0x25')](0xcc)[_0xd742('0x1f')]();});}};}function handleEntityNotFound(_0x3f6327,_0x495647){return function(_0x3e7d1e){if(!_0x3e7d1e){_0x3f6327[_0xd742('0x2d')](0x194);}return _0x3e7d1e;};}function handleError(_0x460212,_0x55bb9f){_0x55bb9f=_0x55bb9f||0x1f4;return function(_0x20421b){logger[_0xd742('0x2e')](_0x20421b[_0xd742('0x2f')]);if(_0x20421b['name']){delete _0x20421b['name'];}_0x460212['status'](_0x55bb9f)[_0xd742('0x30')](_0x20421b);};}function getInteractionUsers(_0x435998,_0x562c28){return new BPromise(function(_0x1c7f1b,_0x419ab0){try{if(_0x562c28[_0x435998['id']]){_0x435998[_0xd742('0x31')]=_[_0xd742('0x32')](_0x562c28[_0x435998['id']],function(_0x2d9fce){return{'id':_0x2d9fce['id'],'fullname':_0x2d9fce[_0xd742('0x33')]};});}}catch(_0x29cc6c){_0x419ab0(_0x29cc6c);}_0x1c7f1b(_0x435998);});}function getInteractionTags(_0x1e3a8a,_0x12ea73){return new BPromise(function(_0x568fc9,_0x5b88e2){try{if(_0x1e3a8a[_0xd742('0x34')]){_0x1e3a8a['Tags']=[];_0x1e3a8a[_0xd742('0x34')][_0xd742('0x35')](',')[_0xd742('0x36')](function(_0x38f733){_0x1e3a8a[_0xd742('0x37')]['push'](_0x12ea73[_0x38f733]);});}delete _0x1e3a8a['TagIds'];}catch(_0x447957){_0x5b88e2(_0x447957);}_0x568fc9(_0x1e3a8a);});}function updateSmsInteraction(_0x71ebba,_0x448058,_0x46a9ab){return new BPromise(function(_0x4669a3,_0x2eece5){return getInteractionUsers(_0x71ebba,_0x46a9ab)[_0xd742('0x2b')](function(_0x17b663){return getInteractionTags(_0x17b663,_0x448058);})[_0xd742('0x2b')](function(_0x447b43){_0x4669a3(_0x447b43);})[_0xd742('0x38')](function(_0x235192){_0x2eece5(_0x235192);});});}exports['index']=function(_0x1f5e55,_0x3fddd9){var _0x4f83cb={},_0x23d169={},_0xc1f487={'count':0x0,'rows':[]};var _0x5b7c98=_[_0xd742('0x32')](db['SmsInteraction']['rawAttributes'],function(_0x59d0fd){return{'name':_0x59d0fd['fieldName'],'type':_0x59d0fd['type']['key']};});_0x23d169[_0xd742('0x39')]=_['map'](_0x5b7c98,_0xd742('0x3a'));_0x23d169['query']=_['keys'](_0x1f5e55[_0xd742('0x3b')]);_0x23d169[_0xd742('0x3c')]=_[_0xd742('0x3d')](_0x23d169['model'],_0x23d169[_0xd742('0x3b')]);_0x4f83cb[_0xd742('0x3e')]=_[_0xd742('0x3d')](_0x23d169[_0xd742('0x39')],qs[_0xd742('0x3f')](_0x1f5e55[_0xd742('0x3b')][_0xd742('0x3f')]));_0x4f83cb[_0xd742('0x3e')]=_0x4f83cb[_0xd742('0x3e')][_0xd742('0x40')]?_0x4f83cb[_0xd742('0x3e')]:_0x23d169[_0xd742('0x39')];if(!_0x1f5e55[_0xd742('0x3b')][_0xd742('0x41')](_0xd742('0x42'))){_0x4f83cb[_0xd742('0x23')]=qs['limit'](_0x1f5e55[_0xd742('0x3b')][_0xd742('0x23')]);_0x4f83cb[_0xd742('0x21')]=qs[_0xd742('0x21')](_0x1f5e55[_0xd742('0x3b')]['offset']);}_0x4f83cb['order']=qs[_0xd742('0x43')](_0x1f5e55[_0xd742('0x3b')][_0xd742('0x43')]);_0x4f83cb[_0xd742('0x44')]=qs[_0xd742('0x3c')](_[_0xd742('0x45')](_0x1f5e55[_0xd742('0x3b')],_0x23d169[_0xd742('0x3c')]),_0x5b7c98);var _0x49a2a3=[];var _0x458a9e=squel[_0xd742('0x46')]()['field']('id')['field'](_0xd742('0x3a'))[_0xd742('0x47')](_0xd742('0x48'))[_0xd742('0x49')](_0xd742('0x4a'));var _0x1c5e9f=squel['select']()[_0xd742('0x47')](_0xd742('0x4b'))[_0xd742('0x47')](_0xd742('0x4c'))[_0xd742('0x47')]('ui.SmsInteractionId')[_0xd742('0x49')](_0xd742('0x4d'),'ui')[_0xd742('0x4e')](_0xd742('0x4f'),'u','u.id\x20=\x20ui.UserId');var _0x51fd04=squel['select']()['from'](_0xd742('0x50'),'i')[_0xd742('0x4e')]('cm_contacts','c',_0xd742('0x51'))[_0xd742('0x4e')](_0xd742('0x4f'),'o',_0xd742('0x52'))[_0xd742('0x4e')](_0xd742('0x53'),'a',_0xd742('0x54'))[_0xd742('0x4e')]('sms_messages','me',_0xd742('0x55'))[_0xd742('0x4e')]('sms_interaction_has_tags','it',_0xd742('0x56'))[_0xd742('0x4e')](_0xd742('0x4a'),'t',_0xd742('0x57'));var _0x261b9a=squel[_0xd742('0x58')]();var _0x76f2e7=[];var _0x1bab8a=squel[_0xd742('0x58')]();var _0x5f1926;if(_0x1f5e55[_0xd742('0x3b')][_0xd742('0x59')]){_0x5f1926=as[_0xd742('0x5a')](_0x1f5e55[_0xd742('0x3b')][_0xd742('0x59')]);var _0x35fae5=_0x5f1926[_0xd742('0x5b')];for(var _0xe1a0ed=0x0;_0xe1a0ed<_0x5f1926[_0xd742('0x5c')][_0xd742('0x40')];_0xe1a0ed++){var _0x3c63fe=_0x5f1926[_0xd742('0x5c')][_0xe1a0ed];var _0x27927a='i';var _0x4956eb=_['find'](_0x5b7c98,['name',_0x3c63fe[_0xd742('0x47')]]);if(!_0x4956eb){switch(_0x3c63fe[_0xd742('0x47')]){case'unreadMessages':if(_0x3c63fe['value']==0x1){_0x51fd04[_0xd742('0x5d')]('`'+_0x3c63fe[_0xd742('0x47')]+_0xd742('0x5e'));}else{_0x51fd04[_0xd742('0x5d')]('`'+_0x3c63fe[_0xd742('0x47')]+_0xd742('0x5f'));}break;case _0xd742('0x60'):if(_0x3c63fe['operator']===_0xd742('0x61')){if(_0x3c63fe[_0xd742('0x62')][_0xd742('0x35')]('\x20')[_0xd742('0x40')]>0x1){_0x261b9a[_0x35fae5]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xd742('0x63')](_0x3c63fe[_0xd742('0x62')]),null);}else{var _0xbdfe6f='%'+_0x3c63fe['value']+'%';_0x261b9a[_0x35fae5](_0xd742('0x64'),_0xbdfe6f,_0xbdfe6f,_0xbdfe6f);}}else{_0x4956eb=_[_0xd742('0x65')](_0x5b7c98,[_0xd742('0x3a'),_0xd742('0x66')]);_0x3c63fe[_0xd742('0x47')]=_0xd742('0x66');_0x502207=as[_0xd742('0x67')](_0x27927a,_0x4956eb['type'],_0x3c63fe);_0x261b9a[_0x35fae5](_0x502207[_0xd742('0x68')],_0x502207[_0xd742('0x62')]['start'],_0x502207[_0xd742('0x62')][_0xd742('0x1f')]);}break;case _0xd742('0x69'):var _0x216455=_0x3c63fe['value']['split'](',')[_0xd742('0x32')](function(_0x3e2311){return Number(_0x3e2311);});_0x216455[_0xd742('0x36')](function(_0x2cf728){_0x1bab8a['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2cf728+',%');});_0x76f2e7=_[_0xd742('0x6a')](_0x76f2e7,_0x216455);break;case _0xd742('0x6b'):if(_0x3c63fe[_0xd742('0x6c')]===_0xd742('0x61')){_0x261b9a[_0x35fae5](_0xd742('0x6d'),'%'+_0x3c63fe[_0xd742('0x62')]+'%',null);}else{_0x4956eb=_[_0xd742('0x65')](_0x5b7c98,[_0xd742('0x3a'),_0xd742('0x6e')]);_0x3c63fe[_0xd742('0x47')]=_0xd742('0x6e');_0x502207=as[_0xd742('0x67')](_0x27927a,_0x4956eb[_0xd742('0x6f')],_0x3c63fe);_0x261b9a[_0x35fae5](_0x502207[_0xd742('0x68')],_0x502207[_0xd742('0x62')][_0xd742('0x70')],_0x502207[_0xd742('0x62')]['end']);}break;case _0xd742('0x71'):_0x502207=as[_0xd742('0x67')]('me',null,_0x3c63fe);_0x261b9a[_0x35fae5](_0x502207['text'],_0x502207[_0xd742('0x62')]['start'],_0x502207['value']['end']);break;}}else{var _0x502207=as['buildExpression'](_0x27927a,_0x4956eb[_0xd742('0x6f')],_0x3c63fe);_0x261b9a[_0x35fae5](_0x502207['text'],_0x502207['value'][_0xd742('0x70')],_0x502207[_0xd742('0x62')][_0xd742('0x1f')]);}}}else{var _0x112936=_(_0x1f5e55['query'])[_0xd742('0x72')]()[_0xd742('0x32')](function(_0x50b983){return _[_0xd742('0x73')](_0x5b7c98,['name',_0x50b983])?_0x50b983:undefined;})[_0xd742('0x74')]()[_0xd742('0x62')]();if(!_[_0xd742('0x75')](_0x112936)){_0x112936[_0xd742('0x36')](function(_0x551c41){if(_0x551c41===_0xd742('0x76')){_0x51fd04[_0xd742('0x44')](_0xd742('0x77'),[][_0xd742('0x78')](_0x1f5e55[_0xd742('0x3b')][_0x551c41]));}else if(_0x551c41==='createdAt'){var _0x341b6d=JSON[_0xd742('0x79')](_0x1f5e55['query'][_0x551c41])[_0xd742('0x7a')];var _0x554c38=JSON[_0xd742('0x79')](_0x1f5e55['query'][_0x551c41])[_0xd742('0x7b')];_0x51fd04[_0xd742('0x44')](_0xd742('0x7c'),_0x341b6d,_0x554c38);}else{if(_0x1f5e55[_0xd742('0x3b')][_0x551c41]===_0xd742('0x7d')){_0x51fd04[_0xd742('0x44')]('i.'+_0x551c41+_0xd742('0x7e'));}else{_0x51fd04[_0xd742('0x44')]('i.'+_0x551c41+_0xd742('0x7f'),_0x1f5e55[_0xd742('0x3b')][_0x551c41]);}}});}if(_0x1f5e55['query'][_0xd742('0x80')]){if(_0x1f5e55[_0xd742('0x3b')][_0xd742('0x80')]==0x1){_0x51fd04[_0xd742('0x5d')]('`unreadMessages`\x20=\x200');}else{_0x51fd04[_0xd742('0x5d')]('`unreadMessages`\x20>\x200');}}if(_0x1f5e55[_0xd742('0x3b')][_0xd742('0x81')]){_0x76f2e7=_[_0xd742('0x82')](_0x1f5e55[_0xd742('0x3b')][_0xd742('0x81')])?_0x1f5e55[_0xd742('0x3b')][_0xd742('0x81')]:new Array(_0x1f5e55[_0xd742('0x3b')][_0xd742('0x81')]);_0x76f2e7['forEach'](function(_0xb2a59b){_0x1bab8a['or'](_0xd742('0x83'),'%,'+_0xb2a59b+',%');});}if(_0x1f5e55[_0xd742('0x3b')][_0xd742('0x84')]){var _0x588dab=_0x1f5e55[_0xd742('0x3b')][_0xd742('0x84')]['replace']('\x5c','\x5c\x5c')[_0xd742('0x85')](/'/g,'\x27\x27');if(qs[_0xd742('0x86')](_0x588dab)){_0x261b9a['or'](_0xd742('0x87'),_0x588dab+'%')['or'](_0xd742('0x88'),_0x588dab+'%');}else{_0x261b9a['or'](_0xd742('0x89'),qs[_0xd742('0x63')](_0x588dab))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x588dab+'%');}}}_0x51fd04[_0xd742('0x44')](_0x261b9a);_0x51fd04[_0xd742('0x8a')](_0xd742('0x8b'));var _0x1f8d10={'type':db['Sequelize'][_0xd742('0x8c')][_0xd742('0x8d')],'raw':!![]};var _0xe119a7=_0x51fd04['clone']();_0xe119a7[_0xd742('0x47')]('i.id');_0xe119a7[_0xd742('0x47')](_0xd742('0x8e'),_0xd742('0x8f'));if(_0x4f83cb[_0xd742('0x90')]){_0x4f83cb['order']['forEach'](function(_0x1bf4b9){var _0x2ff8d6=_0x1bf4b9[0x0]===_0xd742('0x91')?_0x1bf4b9[0x0]:'i.'+_0x1bf4b9[0x0];_0x51fd04[_0xd742('0x90')](_0x2ff8d6,_0x1bf4b9[0x1]===_0xd742('0x92')?![]:!![]);});}if(!_[_0xd742('0x75')](_0x76f2e7)){_0x51fd04['having'](_0x1bab8a);_0xe119a7['where'](_0xd742('0x93'),_0x76f2e7);}BPromise['resolve']()['then'](function(){if(!_0x5f1926){if(_0x1f5e55[_0xd742('0x3b')]['SmsAccountId'])return;_0xe119a7[_0xd742('0x44')](_0xd742('0x94'));_0x51fd04[_0xd742('0x44')](_0xd742('0x94'));return;}if(_0x1f5e55['user'][_0xd742('0x95')]!==_0xd742('0x96'))return;return _0x1f5e55['user'][_0xd742('0x97')]({'attributes':['id'],'raw':!![]})[_0xd742('0x2b')](function(_0x5dc1e3){if(_['isEmpty'](_0x5dc1e3)){_0xe119a7[_0xd742('0x44')](_0xd742('0x98'));_0x51fd04[_0xd742('0x44')](_0xd742('0x98'));}else{_0xe119a7['where'](_0xd742('0x77'),_['map'](_0x5dc1e3,'id'));_0x51fd04[_0xd742('0x44')](_0xd742('0x77'),_['map'](_0x5dc1e3,'id'));}});})[_0xd742('0x2b')](function(){if(_0x1f5e55[_0xd742('0x99')]['role']==='agent'&&!_0x5f1926&&!_0x1f5e55[_0xd742('0x3b')]['SmsAccountId'])return[];return db[_0xd742('0x9a')]['query'](_0xe119a7[_0xd742('0x9b')](),_0x1f8d10);})[_0xd742('0x2b')](function(_0x5234ed){_0xc1f487[_0xd742('0x24')]=_0x5234ed[_0xd742('0x40')];if(_0xc1f487[_0xd742('0x24')]===0x0)return[];return db['sequelize'][_0xd742('0x3b')](_0x458a9e['toString'](),_0x1f8d10)[_0xd742('0x2b')](function(_0xbe779){_0x49a2a3=_[_0xd742('0x9c')](_0xbe779,'id');_0x1f8d10=_[_0xd742('0x9d')](_0x1f8d10,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1f5e55['query'][_0xd742('0x3f')]){_0x4f83cb[_0xd742('0x3e')]['forEach'](function(_0x2f51c5){_0x51fd04[_0xd742('0x47')]('i.'+_0x2f51c5);});}else{_0x51fd04[_0xd742('0x47')](_0xd742('0x8e'),_0xd742('0x8f'));_0x51fd04[_0xd742('0x47')](_0xd742('0x9e'),'Account.key');_0x51fd04[_0xd742('0x47')]('a.mandatoryDisposition',_0xd742('0x9f'));_0x51fd04[_0xd742('0x47')](_0xd742('0xa0'),'contactName');_0x51fd04[_0xd742('0x47')](_0xd742('0xa1'));_0x51fd04[_0xd742('0x47')](_0xd742('0xa2'),_0xd742('0xa3'));_0x51fd04[_0xd742('0x47')](_0xd742('0xa4'),_0xd742('0xa5'));_0x51fd04[_0xd742('0x47')](_0xd742('0xa6'),'Contact.email');_0x51fd04[_0xd742('0x47')](_0xd742('0xa7'),_0xd742('0xa8'));_0x51fd04[_0xd742('0x47')](_0xd742('0xa9'),'Contact.mobile');_0x51fd04[_0xd742('0x47')]('c.fax',_0xd742('0xaa'));_0x51fd04[_0xd742('0x47')]('o.fullname',_0xd742('0xab'));_0x51fd04[_0xd742('0x47')](_0xd742('0xac'),'Owner.internal');_0x51fd04[_0xd742('0x47')](_0xd742('0xad'),_0xd742('0x34'));}if(_0x4f83cb[_0xd742('0x23')])_0x51fd04[_0xd742('0x23')](_0x4f83cb[_0xd742('0x23')]);if(_0x4f83cb[_0xd742('0x21')])_0x51fd04[_0xd742('0x21')](_0x4f83cb[_0xd742('0x21')]);return db[_0xd742('0x9a')]['query'](_0x51fd04[_0xd742('0x9b')](),_0x1f8d10);})['then'](function(_0x936bd5){if(_0x936bd5[_0xd742('0x40')]>0x0)_0x1c5e9f['where']('ui.SmsInteractionId\x20IN\x20?',_['map'](_0x936bd5,'id'));return db[_0xd742('0x9a')][_0xd742('0x3b')](_0x1c5e9f['toString'](),_0x1f8d10)['then'](function(_0x2685b3){var _0x383d5b=_[_0xd742('0xae')](_0x2685b3,_0xd742('0xaf'));var _0x50fa9a=[];_0x936bd5[_0xd742('0x36')](function(_0x5d7787){_0x50fa9a['push'](updateSmsInteraction(_0x5d7787,_0x49a2a3,_0x383d5b));});return BPromise['all'](_0x50fa9a);});});})[_0xd742('0x2b')](function(_0x29b611){_0xc1f487[_0xd742('0xb0')]=_0x29b611;return _0xc1f487;})[_0xd742('0x2b')](respondWithFilteredResult(_0x3fddd9,_0x4f83cb))['catch'](handleError(_0x3fddd9,null));};exports[_0xd742('0xb1')]=function(_0x2a2232,_0x5146bc){var _0x3b8d84={'raw':![],'where':{'id':_0x2a2232['params']['id']}},_0x1170f2={};_0x1170f2[_0xd742('0x39')]=_[_0xd742('0x72')](db[_0xd742('0xb2')][_0xd742('0xb3')]);_0x1170f2[_0xd742('0x3b')]=_[_0xd742('0x72')](_0x2a2232[_0xd742('0x3b')]);_0x1170f2['filters']=_[_0xd742('0x3d')](_0x1170f2['model'],_0x1170f2[_0xd742('0x3b')]);_0x3b8d84[_0xd742('0x3e')]=_[_0xd742('0x3d')](_0x1170f2[_0xd742('0x39')],qs[_0xd742('0x3f')](_0x2a2232['query'][_0xd742('0x3f')]));_0x3b8d84[_0xd742('0x3e')]=_0x3b8d84[_0xd742('0x3e')][_0xd742('0x40')]?_0x3b8d84['attributes']:_0x1170f2[_0xd742('0x39')];if(_0x2a2232[_0xd742('0x3b')][_0xd742('0xb4')]){_0x3b8d84[_0xd742('0xb5')]=[{'all':!![]}];}_0x3b8d84=_[_0xd742('0x9d')]({},_0x3b8d84,_0x2a2232[_0xd742('0xb6')]);return db[_0xd742('0xb2')][_0xd742('0x65')](_0x3b8d84)['then'](handleEntityNotFound(_0x5146bc,null))[_0xd742('0x2b')](respondWithResult(_0x5146bc,null))['catch'](handleError(_0x5146bc,null));};exports['create']=function(_0x4ee311,_0x4a5e7a){return db[_0xd742('0xb2')]['create'](_0x4ee311[_0xd742('0x71')],{})[_0xd742('0x2b')](respondWithResult(_0x4a5e7a,0xc9))['catch'](handleError(_0x4a5e7a,null));};exports[_0xd742('0x2a')]=function(_0x3f4eb4,_0x9e691){if(_0x3f4eb4[_0xd742('0x71')]['id']){delete _0x3f4eb4['body']['id'];}return db['SmsInteraction']['find']({'where':{'id':_0x3f4eb4[_0xd742('0xb7')]['id']}})['then'](handleEntityNotFound(_0x9e691,null))[_0xd742('0x2b')](saveUpdates(_0x3f4eb4[_0xd742('0x71')],null))[_0xd742('0x2b')](respondWithResult(_0x9e691,null))[_0xd742('0x38')](handleError(_0x9e691,null));};exports[_0xd742('0x2c')]=function(_0x26ad56,_0x3f5a77){return db['SmsInteraction'][_0xd742('0x65')]({'where':{'id':_0x26ad56[_0xd742('0xb7')]['id']}})['then'](handleEntityNotFound(_0x3f5a77,null))['then'](removeEntity(_0x3f5a77,null))['catch'](handleError(_0x3f5a77,null));};exports[_0xd742('0xb8')]=function(_0x393bd7,_0x57458f){return db['SmsInteraction']['describe']()[_0xd742('0x2b')](respondWithResult(_0x57458f,null))[_0xd742('0x38')](handleError(_0x57458f,null));};exports[_0xd742('0xb9')]=function(_0x1078e9,_0x4bb2ab,_0x58535b){return db[_0xd742('0xba')][_0xd742('0x65')]({'where':{'id':_0x1078e9['params']['id']}})['then'](handleEntityNotFound(_0x4bb2ab,null))[_0xd742('0x2b')](function(_0x7dd90a){if(_0x7dd90a){return _0x7dd90a[_0xd742('0xb9')](_0x1078e9[_0xd742('0x71')][_0xd742('0xbb')],_[_0xd742('0xbc')](_0x1078e9[_0xd742('0x71')],[_0xd742('0xbb'),'id'])||{});}})[_0xd742('0x2b')](respondWithResult(_0x4bb2ab,null))[_0xd742('0x38')](handleError(_0x4bb2ab,null));};exports[_0xd742('0xbd')]=function(_0x3cfa42,_0x45f070,_0x5bfc42){var _0x17b262={'raw':![],'where':{}};var _0x57f580={};var _0x522a62={'count':0x0,'rows':[]};return db[_0xd742('0xb2')][_0xd742('0xbe')]({'where':{'id':_0x3cfa42[_0xd742('0xb7')]['id']}})[_0xd742('0x2b')](handleEntityNotFound(_0x45f070,null))[_0xd742('0x2b')](function(_0x381de5){if(_0x381de5){_0x57f580[_0xd742('0x39')]=_[_0xd742('0x72')](db['SmsMessage'][_0xd742('0xb3')]);_0x57f580['query']=_['keys'](_0x3cfa42[_0xd742('0x3b')]);_0x57f580[_0xd742('0x3c')]=_[_0xd742('0x3d')](_0x57f580[_0xd742('0x39')],_0x57f580[_0xd742('0x3b')]);_0x17b262['attributes']=_[_0xd742('0x3d')](_0x57f580['model'],qs['fields'](_0x3cfa42[_0xd742('0x3b')]['fields']));_0x17b262[_0xd742('0x3e')]=_0x17b262[_0xd742('0x3e')][_0xd742('0x40')]?_0x17b262['attributes']:_0x57f580[_0xd742('0x39')];if(!_0x3cfa42[_0xd742('0x3b')][_0xd742('0x41')](_0xd742('0x42'))){_0x17b262['limit']=qs[_0xd742('0x23')](_0x3cfa42[_0xd742('0x3b')][_0xd742('0x23')]);_0x17b262[_0xd742('0x21')]=qs[_0xd742('0x21')](_0x3cfa42['query'][_0xd742('0x21')]);}_0x17b262['order']=qs['sort'](_0x3cfa42['query'][_0xd742('0x43')]);_0x17b262[_0xd742('0x44')]=qs['filters'](_[_0xd742('0x45')](_0x3cfa42[_0xd742('0x3b')],_0x57f580['filters']));_0x17b262['where']['SmsInteractionId']=_0x381de5['id'];if(_0x3cfa42[_0xd742('0x3b')][_0xd742('0x84')]){_0x17b262[_0xd742('0x44')]=_[_0xd742('0x9d')](_0x17b262[_0xd742('0x44')],{'$or':_[_0xd742('0x32')](_0x17b262[_0xd742('0x3e')],function(_0x3f2e2f){var _0x52b09c={};_0x52b09c[_0x3f2e2f]={'$like':'%'+_0x3cfa42[_0xd742('0x3b')][_0xd742('0x84')]+'%'};return _0x52b09c;})});}if(_0x3cfa42['query']['$gte']){var _0x26bb16=_0x3cfa42[_0xd742('0x3b')]['$gte'][_0xd742('0x35')](',');var _0x309b10={};_0x309b10[_0x26bb16[0x0]]={'$gte':moment(_0x26bb16[0x1])[_0xd742('0xbf')](_0xd742('0xc0'))};_0x17b262[_0xd742('0x44')]=_[_0xd742('0x9d')](_0x17b262[_0xd742('0x44')],_0x309b10);}_0x17b262=_['merge']({},_0x17b262,_0x3cfa42[_0xd742('0xb6')]);return db[_0xd742('0xba')][_0xd742('0x24')]({'where':_0x17b262[_0xd742('0x44')]})[_0xd742('0x2b')](function(_0x137378){_0x522a62[_0xd742('0x24')]=_0x137378;if(_0x3cfa42['query'][_0xd742('0xb4')]){_0x17b262[_0xd742('0xb5')]=[{'all':!![]}];}return db[_0xd742('0xba')][_0xd742('0xc1')](_0x17b262);})[_0xd742('0x2b')](function(_0x56bf79){_0x522a62['rows']=_0x56bf79;return _0x522a62;});}})['then'](respondWithFilteredResult(_0x45f070,_0x17b262))['catch'](handleError(_0x45f070,null));};exports[_0xd742('0xc2')]=function(_0xc60c90,_0x58b91c,_0x571fe7){return db['SmsInteraction'][_0xd742('0x65')]({'where':{'id':_0xc60c90[_0xd742('0xb7')]['id']}})[_0xd742('0x2b')](handleEntityNotFound(_0x58b91c,null))['then'](function(_0x507c9f){if(_0x507c9f){return _0x507c9f[_0xd742('0xc3')](_0xc60c90['body'][_0xd742('0xbb')],_[_0xd742('0xbc')](_0xc60c90[_0xd742('0x71')],[_0xd742('0xbb'),'id'])||{})[_0xd742('0xc4')](function(){return db['Tag'][_0xd742('0xc1')]({'attributes':['id',_0xd742('0x3a'),'color'],'where':{'id':_0xc60c90[_0xd742('0x71')]['ids']}});})['then'](function(_0x420b8f){socket[_0xd742('0xc5')]('smsInteractionTags:save',{'id':Number(_0xc60c90[_0xd742('0xb7')]['id']),'tags':_0x420b8f||[]});return{'id':Number(_0xc60c90[_0xd742('0xb7')]['id']),'tags':_0x420b8f||[]};});}})[_0xd742('0x2b')](respondWithResult(_0x58b91c,null))['catch'](handleError(_0x58b91c,null));};exports['removeTags']=function(_0x424029,_0x165179,_0x231a85){return db['SmsInteraction']['find']({'where':{'id':_0x424029[_0xd742('0xb7')]['id']}})['then'](handleEntityNotFound(_0x165179,null))[_0xd742('0x2b')](function(_0xd336e8){if(_0xd336e8){return _0xd336e8[_0xd742('0xc6')](_0x424029['query'][_0xd742('0xbb')]);}})[_0xd742('0x2b')](respondWithStatusCode(_0x165179,null))['catch'](handleError(_0x165179,null));};exports[_0xd742('0xc7')]=function(_0x262c46,_0x1b5cd7){var _0x2890dc=moment()[_0xd742('0xc8')]()[_0xd742('0x9b')]();var _0x18f495=path['join'](config['root'],_0xd742('0xc9'),_0xd742('0xca'),'tmp');var _0x331306=path[_0xd742('0xcb')](config[_0xd742('0xcc')],_0xd742('0xc9'),_0xd742('0xca'),_0xd742('0xcd'));var _0xcdfbc2=path['join'](_0x18f495,_0x2890dc);var _0xa1ee98=util[_0xd742('0xbf')]('transcript-%d-%s.zip',_0x262c46[_0xd742('0xb7')]['id'],_0x2890dc);var _0x48a0d5=path[_0xd742('0xcb')](_0x18f495,_0xa1ee98);var _0x1026c5=[];_0x1026c5[_0xd742('0xce')]({'model':db[_0xd742('0x6b')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x1026c5['push']({'model':db[_0xd742('0xcf')],'as':_0xd742('0x60'),'attributes':['id','firstName',_0xd742('0xd0')],'raw':!![]});var _0x1c5f07=[{'model':db[_0xd742('0xba')],'as':_0xd742('0xd1'),'attributes':['id','body',_0xd742('0xd2'),'direction',_0xd742('0xd3'),_0xd742('0x80')],'include':_0x1026c5}];_0x1c5f07['push']({'model':db['SmsAccount'],'as':_0xd742('0xd4'),'attributes':['id',_0xd742('0x3a')]});_0x1c5f07[_0xd742('0xce')]({'model':db[_0xd742('0x6b')],'as':_0xd742('0xd5'),'attributes':['id',_0xd742('0x33')]});return db[_0xd742('0xb2')]['find']({'where':{'id':_0x262c46['params']['id']},'include':_0x1c5f07})['then'](handleEntityNotFound(_0x1b5cd7,null))[_0xd742('0x2b')](function(_0x11eb46){if(_0x11eb46){var _0x1e03cf=_0x11eb46[_0xd742('0xd6')]({'plain':!![]});fs[_0xd742('0xd7')](_0xcdfbc2);var _0x2478ff={'channel':'Sms','account':_0x1e03cf[_0xd742('0xd4')][_0xd742('0x3a')],'agent':_0x1e03cf[_0xd742('0xd5')]?_0x1e03cf[_0xd742('0xd5')][_0xd742('0x33')]:'N.A.','createdAt':moment(_0x1e03cf['createdAt'])[_0xd742('0xbf')](_0xd742('0xc0'))[_0xd742('0x9b')](),'closedAt':_0x1e03cf[_0xd742('0xd8')]?moment(_0x1e03cf[_0xd742('0xd9')])[_0xd742('0xbf')](_0xd742('0xc0'))[_0xd742('0x9b')]():'','disposition':_0x1e03cf[_0xd742('0xda')],'messages':_(_0x1e03cf[_0xd742('0xd1')])[_0xd742('0x84')]({'secret':![]})[_0xd742('0x32')](function(_0x5a4fcd){return{'date':moment(_0x5a4fcd[_0xd742('0xd2')])[_0xd742('0xbf')](_0xd742('0xc0'))[_0xd742('0x9b')](),'sender':_0x5a4fcd[_0xd742('0xdb')]===_0xd742('0xdc')?_0x5a4fcd[_0xd742('0x6b')]?_0x5a4fcd[_0xd742('0x6b')][_0xd742('0x33')]:'System':_0x5a4fcd[_0xd742('0x60')][_0xd742('0xdd')]+(_0x5a4fcd[_0xd742('0x60')]['lastName']?'\x20'+_0x5a4fcd[_0xd742('0x60')]['lastName']:''),'body':_0x5a4fcd[_0xd742('0x71')],'direction':_0x5a4fcd[_0xd742('0xdb')]===_0xd742('0xdc')?'A':'C','secret':_0x5a4fcd['secret'],'read':_0x5a4fcd[_0xd742('0x80')]};})[_0xd742('0x62')]()};return ejs[_0xd742('0xde')](path[_0xd742('0xcb')](config[_0xd742('0xcc')],_0xd742('0xc9'),_0xd742('0xdf'),_0xd742('0xe0')),{'interaction':_0x2478ff})['then'](function(_0x142768){var _0x42377e=path[_0xd742('0xcb')](_0xcdfbc2,_0xd742('0xe1')+_0x1e03cf['id']+'-'+_0x2890dc+_0xd742('0xe2'));var _0x1815c0={'path':_0x42377e,'channel':_0xd742('0xe3'),'interactionId':_0x1e03cf['id']};return pdf[_0xd742('0xe4')](_0x142768,_0x1815c0);})[_0xd742('0x2b')](function(){return new BPromise(function(_0x113dd6,_0x326eb8){zipdir(_0xcdfbc2,{'saveTo':_0x48a0d5},function(_0x7239a4,_0x3d740b){if(_0x7239a4)return _0x326eb8(_0x7239a4);return _0x113dd6(_0x3d740b);});})['then'](function(){return new BPromise(function(_0x451bef,_0x57e31b){rimraf(_0xcdfbc2,function(_0xca8963){if(_0xca8963)_0x57e31b(_0xca8963);return _0x451bef();});});})[_0xd742('0x2b')](function(){return _0x1b5cd7['download'](_0x48a0d5,_0xa1ee98,function(_0x23d94d){if(_0x23d94d){console[_0xd742('0xe5')](_0xd742('0xe6'),_0x23d94d);}else{fs[_0xd742('0xe7')](_0x48a0d5);}});});});}else{return _0x1b5cd7[_0xd742('0x2d')](0xc8);}})[_0xd742('0x38')](handleError(_0x1b5cd7,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 2364e80..65d06f1 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 _0xb78e=['exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hook'];(function(_0x111a53,_0x106aa2){var _0x2d560a=function(_0x592377){while(--_0x592377){_0x111a53['push'](_0x111a53['shift']());}};_0x2d560a(++_0x106aa2);}(_0xb78e,0x1c9));var _0xeb78=function(_0x3c1a3b,_0x228226){_0x3c1a3b=_0x3c1a3b-0x0;var _0x1fab26=_0xb78e[_0x3c1a3b];return _0x1fab26;};'use strict';var EventEmitter=require(_0xeb78('0x0'));var SmsInteraction=require(_0xeb78('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0xeb78('0x1'))['db'][_0xeb78('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xeb78('0x3')](0x0);var events={'afterCreate':_0xeb78('0x4'),'afterUpdate':_0xeb78('0x5'),'afterDestroy':_0xeb78('0x6')};function emitEvent(_0x13ef9d){return function(_0x1bdf83,_0x57ec6b,_0x3c35e7){_0x1bdf83[_0xeb78('0x7')]({'attributes':['id'],'raw':!![]})[_0xeb78('0x8')](function(_0x30c884){_0x1bdf83[_0xeb78('0x9')](_0xeb78('0xa'),_0x30c884[_0xeb78('0xb')](function(_0x573406){return{'id':_0x573406['id']};}));return SmsMessage[_0xeb78('0xc')]({'where':{'SmsInteractionId':_0x1bdf83['id'],'direction':'in','read':![]},'raw':!![]});})[_0xeb78('0x8')](function(_0xa1ca82){_0x1bdf83[_0xeb78('0x9')](_0xeb78('0xd'),_0xa1ca82[_0xeb78('0xe')]);SmsInteractionEvents[_0xeb78('0xf')](_0x13ef9d+':'+_0x1bdf83['id'],_0x1bdf83);SmsInteractionEvents[_0xeb78('0xf')](_0x13ef9d,_0x1bdf83);_0x3c35e7(null);})[_0xeb78('0x10')](_0x3c35e7(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0xeb78('0x11')](e,emitEvent(event));}}module[_0xeb78('0x12')]=SmsInteractionEvents; \ No newline at end of file +var _0x9f0e=['unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','SmsInteraction','SmsMessage','update','remove','then','setDataValue','map','findAll'];(function(_0x8c7dcb,_0xea478d){var _0x3952e5=function(_0x288691){while(--_0x288691){_0x8c7dcb['push'](_0x8c7dcb['shift']());}};_0x3952e5(++_0xea478d);}(_0x9f0e,0x116));var _0xe9f0=function(_0x4ee30,_0x20894e){_0x4ee30=_0x4ee30-0x0;var _0x2a6108=_0x9f0e[_0x4ee30];return _0x2a6108;};'use strict';var EventEmitter=require(_0xe9f0('0x0'));var SmsInteraction=require(_0xe9f0('0x1'))['db'][_0xe9f0('0x2')];var SmsMessage=require(_0xe9f0('0x1'))['db'][_0xe9f0('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xe9f0('0x4'),'afterDestroy':_0xe9f0('0x5')};function emitEvent(_0x3c589d){return function(_0x202d69,_0x1eed45,_0x50313d){_0x202d69['getUsers']({'attributes':['id'],'raw':!![]})[_0xe9f0('0x6')](function(_0x167198){_0x202d69[_0xe9f0('0x7')]('Users',_0x167198[_0xe9f0('0x8')](function(_0x335b82){return{'id':_0x335b82['id']};}));return SmsMessage[_0xe9f0('0x9')]({'where':{'SmsInteractionId':_0x202d69['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe9f0('0x6')](function(_0xa523c0){_0x202d69[_0xe9f0('0x7')](_0xe9f0('0xa'),_0xa523c0[_0xe9f0('0xb')]);SmsInteractionEvents[_0xe9f0('0xc')](_0x3c589d+':'+_0x202d69['id'],_0x202d69);SmsInteractionEvents['emit'](_0x3c589d,_0x202d69);_0x50313d(null);})[_0xe9f0('0xd')](_0x50313d(null));};}for(var e in events){if(events[_0xe9f0('0xe')](e)){var event=events[e];SmsInteraction[_0xe9f0('0xf')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index dffb3ac..162ce57 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 _0x8b4c=['moment','bluebird','path','define','SmsInteraction','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api'];(function(_0x29891b,_0x4ed0c1){var _0xedb980=function(_0x2e670d){while(--_0x2e670d){_0x29891b['push'](_0x29891b['shift']());}};_0xedb980(++_0x4ed0c1);}(_0x8b4c,0x17d));var _0xc8b4=function(_0x1c0fc3,_0x3537bb){_0x1c0fc3=_0x1c0fc3-0x0;var _0x338237=_0x8b4c[_0x1c0fc3];return _0x338237;};'use strict';var _=require(_0xc8b4('0x0'));var util=require('util');var logger=require(_0xc8b4('0x1'))(_0xc8b4('0x2'));var moment=require(_0xc8b4('0x3'));var BPromise=require(_0xc8b4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc8b4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsInteraction.attributes');module['exports']=function(_0x6b254d,_0x45c7ce){return _0x6b254d[_0xc8b4('0x6')](_0xc8b4('0x7'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4923fd,_0x372c20,_0x2e4cc0){if(_0x4923fd['changed'](_0xc8b4('0x8'))){_0x4923fd[_0xc8b4('0x9')]=moment()[_0xc8b4('0xa')](_0xc8b4('0xb'));}_0x2e4cc0(null,_0x4923fd);}}});}; \ No newline at end of file +var _0xff7e=['changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xff7e,0xf2));var _0xeff7=function(_0x3cfbc5,_0x3c22e3){_0x3cfbc5=_0x3cfbc5-0x0;var _0x45e042=_0xff7e[_0x3cfbc5];return _0x45e042;};'use strict';var _=require(_0xeff7('0x0'));var util=require(_0xeff7('0x1'));var logger=require('../../config/logger')(_0xeff7('0x2'));var moment=require(_0xeff7('0x3'));var BPromise=require('bluebird');var rp=require(_0xeff7('0x4'));var fs=require('fs');var path=require(_0xeff7('0x5'));var rimraf=require(_0xeff7('0x6'));var config=require(_0xeff7('0x7'));var attributes=require(_0xeff7('0x8'));module[_0xeff7('0x9')]=function(_0x59accf,_0xa16da2){return _0x59accf[_0xeff7('0xa')](_0xeff7('0xb'),attributes,{'tableName':_0xeff7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2e88b6,_0x4f06a2,_0xe103b9){if(_0x2e88b6[_0xeff7('0xd')](_0xeff7('0xe'))){_0x2e88b6[_0xeff7('0xf')]=moment()['format'](_0xeff7('0x10'));}_0xe103b9(null,_0x2e88b6);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 2e90d17..71b34f3 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 _0x6e68=['ids','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','request','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateSmsInteraction','SmsInteraction','update','options','raw','where','attributes','limit','AddTagsToSmsInteraction','find','then','addTags','body'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6e68,0x1bc));var _0x86e6=function(_0x465ed8,_0x2be2ac){_0x465ed8=_0x465ed8-0x0;var _0xcb088d=_0x6e68[_0x465ed8];return _0xcb088d;};'use strict';var _=require(_0x86e6('0x0'));var util=require(_0x86e6('0x1'));var moment=require(_0x86e6('0x2'));var BPromise=require('bluebird');var rs=require(_0x86e6('0x3'));var fs=require('fs');var Redis=require(_0x86e6('0x4'));var db=require(_0x86e6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x86e6('0x6'))(_0x86e6('0x7'));var config=require('../../config/environment');var jayson=require(_0x86e6('0x8'));var client=jayson[_0x86e6('0x9')][_0x86e6('0xa')]({'port':0x232a});config[_0x86e6('0xb')]=_[_0x86e6('0xc')](config['redis'],{'host':_0x86e6('0xd'),'port':0x18eb});var socket=require(_0x86e6('0xe'))(new Redis(config['redis']));require(_0x86e6('0xf'))['register'](socket);function respondWithRpcPromise(_0x495271,_0xc1b5ce,_0x27a379){return new BPromise(function(_0x3824ea,_0x4185f2){return client[_0x86e6('0x10')](_0x495271,_0x27a379)['then'](function(_0x16d924){logger[_0x86e6('0x11')](_0x86e6('0x12'),_0xc1b5ce,_0x86e6('0x13'));logger[_0x86e6('0x14')](_0x86e6('0x15'),_0xc1b5ce,'request\x20sent',JSON[_0x86e6('0x16')](_0x16d924));if(_0x16d924[_0x86e6('0x17')]){if(_0x16d924['error'][_0x86e6('0x18')]===0x1f4){logger['error'](_0x86e6('0x12'),_0xc1b5ce,_0x16d924['error'][_0x86e6('0x19')]);return _0x4185f2(_0x16d924[_0x86e6('0x17')][_0x86e6('0x19')]);}logger[_0x86e6('0x17')]('SmsInteraction,\x20%s,\x20%s',_0xc1b5ce,_0x16d924[_0x86e6('0x17')][_0x86e6('0x19')]);return _0x3824ea(_0x16d924[_0x86e6('0x17')][_0x86e6('0x19')]);}else{logger['info'](_0x86e6('0x12'),_0xc1b5ce,_0x86e6('0x13'));_0x3824ea(_0x16d924['result'][_0x86e6('0x19')]);}})[_0x86e6('0x1a')](function(_0xc3d46){logger[_0x86e6('0x17')](_0x86e6('0x12'),_0xc1b5ce,_0xc3d46);_0x4185f2(_0xc3d46);});});}exports[_0x86e6('0x1b')]=function(_0x2b7272){var _0x3f0c2c=this;return new Promise(function(_0x1b4cc6,_0x14e4d3){return db[_0x86e6('0x1c')][_0x86e6('0x1d')](_0x2b7272['body'],{'raw':_0x2b7272[_0x86e6('0x1e')]?_0x2b7272[_0x86e6('0x1e')][_0x86e6('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b7272[_0x86e6('0x1e')]?_0x2b7272[_0x86e6('0x1e')][_0x86e6('0x20')]||null:null,'attributes':_0x2b7272['options']?_0x2b7272['options'][_0x86e6('0x21')]||null:null,'limit':_0x2b7272['options']?_0x2b7272[_0x86e6('0x1e')][_0x86e6('0x22')]||null:null})['then'](function(_0x1e5fd0){logger[_0x86e6('0x11')](_0x86e6('0x1b'),_0x2b7272);logger[_0x86e6('0x14')](_0x86e6('0x1b'),_0x2b7272,JSON[_0x86e6('0x16')](_0x1e5fd0));_0x1b4cc6(_0x1e5fd0);})[_0x86e6('0x1a')](function(_0xddda1){logger[_0x86e6('0x17')](_0x86e6('0x1b'),_0xddda1[_0x86e6('0x19')],_0x2b7272);_0x14e4d3(_0x3f0c2c[_0x86e6('0x17')](0x1f4,_0xddda1[_0x86e6('0x19')]));});});};exports[_0x86e6('0x23')]=function(_0x43110d){return new Promise(function(_0x1f69b0,_0x2976d2){return db['SmsInteraction'][_0x86e6('0x24')]({'where':_0x43110d[_0x86e6('0x1e')]?_0x43110d['options'][_0x86e6('0x20')]||null:null})[_0x86e6('0x25')](function(_0x2d781f){if(_0x2d781f){return _0x2d781f[_0x86e6('0x26')](_0x43110d[_0x86e6('0x27')][_0x86e6('0x28')],_[_0x86e6('0x29')](_0x43110d[_0x86e6('0x27')],[_0x86e6('0x28'),'id'])||{});}})[_0x86e6('0x2a')](function(_0x24c5f9){logger[_0x86e6('0x11')]('AddTags',_0x43110d);logger[_0x86e6('0x14')](_0x86e6('0x2b'),_0x43110d,JSON[_0x86e6('0x16')](_0x24c5f9));_0x1f69b0(_0x24c5f9);})[_0x86e6('0x1a')](function(_0x33adb6){logger[_0x86e6('0x17')]('AddTags',_0x33adb6[_0x86e6('0x19')],_0x43110d);_0x2976d2(_this[_0x86e6('0x17')](0x1f4,_0x33adb6[_0x86e6('0x19')]));});});}; \ No newline at end of file +var _0xd7c4=['message','catch','UpdateSmsInteraction','SmsInteraction','body','options','raw','where','attributes','limit','AddTagsToSmsInteraction','find','addTags','ids','omit','spread','AddTags','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xd7c4,0xbe));var _0x4d7c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd7c4[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x4d7c('0x0'));var util=require(_0x4d7c('0x1'));var moment=require(_0x4d7c('0x2'));var BPromise=require(_0x4d7c('0x3'));var rs=require(_0x4d7c('0x4'));var fs=require('fs');var Redis=require(_0x4d7c('0x5'));var db=require(_0x4d7c('0x6'))['db'];var utils=require(_0x4d7c('0x7'));var logger=require(_0x4d7c('0x8'))('rpc');var config=require(_0x4d7c('0x9'));var jayson=require(_0x4d7c('0xa'));var client=jayson[_0x4d7c('0xb')][_0x4d7c('0xc')]({'port':0x232a});config[_0x4d7c('0xd')]=_[_0x4d7c('0xe')](config[_0x4d7c('0xd')],{'host':_0x4d7c('0xf'),'port':0x18eb});var socket=require(_0x4d7c('0x10'))(new Redis(config['redis']));require('./smsInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x2ae1ab,_0x593c8f,_0x17a550){return new BPromise(function(_0x302a07,_0x4e3f55){return client[_0x4d7c('0x11')](_0x2ae1ab,_0x17a550)[_0x4d7c('0x12')](function(_0x3eb93b){logger[_0x4d7c('0x13')](_0x4d7c('0x14'),_0x593c8f,_0x4d7c('0x15'));logger[_0x4d7c('0x16')](_0x4d7c('0x17'),_0x593c8f,'request\x20sent',JSON['stringify'](_0x3eb93b));if(_0x3eb93b[_0x4d7c('0x18')]){if(_0x3eb93b['error']['code']===0x1f4){logger['error'](_0x4d7c('0x14'),_0x593c8f,_0x3eb93b['error']['message']);return _0x4e3f55(_0x3eb93b[_0x4d7c('0x18')][_0x4d7c('0x19')]);}logger[_0x4d7c('0x18')](_0x4d7c('0x14'),_0x593c8f,_0x3eb93b[_0x4d7c('0x18')]['message']);return _0x302a07(_0x3eb93b[_0x4d7c('0x18')][_0x4d7c('0x19')]);}else{logger[_0x4d7c('0x13')]('SmsInteraction,\x20%s,\x20%s',_0x593c8f,_0x4d7c('0x15'));_0x302a07(_0x3eb93b['result']['message']);}})[_0x4d7c('0x1a')](function(_0x45c48a){logger[_0x4d7c('0x18')]('SmsInteraction,\x20%s,\x20%s',_0x593c8f,_0x45c48a);_0x4e3f55(_0x45c48a);});});}exports[_0x4d7c('0x1b')]=function(_0x4b340e){var _0x552e90=this;return new Promise(function(_0x50e8b3,_0x386466){return db[_0x4d7c('0x1c')]['update'](_0x4b340e[_0x4d7c('0x1d')],{'raw':_0x4b340e[_0x4d7c('0x1e')]?_0x4b340e[_0x4d7c('0x1e')][_0x4d7c('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b340e[_0x4d7c('0x1e')]?_0x4b340e[_0x4d7c('0x1e')][_0x4d7c('0x20')]||null:null,'attributes':_0x4b340e['options']?_0x4b340e[_0x4d7c('0x1e')][_0x4d7c('0x21')]||null:null,'limit':_0x4b340e[_0x4d7c('0x1e')]?_0x4b340e[_0x4d7c('0x1e')][_0x4d7c('0x22')]||null:null})[_0x4d7c('0x12')](function(_0x2350a0){logger[_0x4d7c('0x13')](_0x4d7c('0x1b'),_0x4b340e);logger[_0x4d7c('0x16')](_0x4d7c('0x1b'),_0x4b340e,JSON['stringify'](_0x2350a0));_0x50e8b3(_0x2350a0);})[_0x4d7c('0x1a')](function(_0x179274){logger[_0x4d7c('0x18')](_0x4d7c('0x1b'),_0x179274[_0x4d7c('0x19')],_0x4b340e);_0x386466(_0x552e90[_0x4d7c('0x18')](0x1f4,_0x179274[_0x4d7c('0x19')]));});});};exports[_0x4d7c('0x23')]=function(_0x357cbf){return new Promise(function(_0x5c898b,_0x26f7d5){return db[_0x4d7c('0x1c')][_0x4d7c('0x24')]({'where':_0x357cbf['options']?_0x357cbf[_0x4d7c('0x1e')][_0x4d7c('0x20')]||null:null})['then'](function(_0x5dde7e){if(_0x5dde7e){return _0x5dde7e[_0x4d7c('0x25')](_0x357cbf['body'][_0x4d7c('0x26')],_[_0x4d7c('0x27')](_0x357cbf[_0x4d7c('0x1d')],[_0x4d7c('0x26'),'id'])||{});}})[_0x4d7c('0x28')](function(_0x348e95){logger[_0x4d7c('0x13')](_0x4d7c('0x29'),_0x357cbf);logger[_0x4d7c('0x16')](_0x4d7c('0x29'),_0x357cbf,JSON[_0x4d7c('0x2a')](_0x348e95));_0x5c898b(_0x348e95);})[_0x4d7c('0x1a')](function(_0x3eb1f0){logger['error'](_0x4d7c('0x29'),_0x3eb1f0[_0x4d7c('0x19')],_0x357cbf);_0x26f7d5(_this['error'](0x1f4,_0x3eb1f0[_0x4d7c('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 5cc3e95..4b7f742 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 _0x1904=['length','smsInteraction:','./smsInteraction.events','save','remove','update','emit','removeListener'];(function(_0x296289,_0x48a853){var _0x496eb5=function(_0x12a337){while(--_0x12a337){_0x296289['push'](_0x296289['shift']());}};_0x496eb5(++_0x48a853);}(_0x1904,0x72));var _0x4190=function(_0x3b902b,_0x5ace7d){_0x3b902b=_0x3b902b-0x0;var _0x268647=_0x1904[_0x3b902b];return _0x268647;};'use strict';var SmsInteractionEvents=require(_0x4190('0x0'));var events=[_0x4190('0x1'),_0x4190('0x2'),_0x4190('0x3')];function createListener(_0x243d5c,_0x2ceea1){return function(_0x118191){_0x2ceea1[_0x4190('0x4')](_0x243d5c,_0x118191);};}function removeListener(_0x454994,_0x49ac0e){return function(){SmsInteractionEvents[_0x4190('0x5')](_0x454994,_0x49ac0e);};}exports['register']=function(_0x537179){for(var _0x4df24f=0x0,_0x214307=events[_0x4190('0x6')];_0x4df24f<_0x214307;_0x4df24f++){var _0x328861=events[_0x4df24f];var _0x49d6db=createListener(_0x4190('0x7')+_0x328861,_0x537179);SmsInteractionEvents['on'](_0x328861,_0x49d6db);}}; \ No newline at end of file +var _0x878f=['emit','removeListener','register','./smsInteraction.events','save','remove','update'];(function(_0x13d32a,_0x1e1e35){var _0x434edc=function(_0x4e9e3b){while(--_0x4e9e3b){_0x13d32a['push'](_0x13d32a['shift']());}};_0x434edc(++_0x1e1e35);}(_0x878f,0x11b));var _0xf878=function(_0xfc2812,_0x19df5b){_0xfc2812=_0xfc2812-0x0;var _0xd94232=_0x878f[_0xfc2812];return _0xd94232;};'use strict';var SmsInteractionEvents=require(_0xf878('0x0'));var events=[_0xf878('0x1'),_0xf878('0x2'),_0xf878('0x3')];function createListener(_0x391d82,_0x38f775){return function(_0xf388e8){_0x38f775[_0xf878('0x4')](_0x391d82,_0xf388e8);};}function removeListener(_0x324e47,_0x2223cb){return function(){SmsInteractionEvents[_0xf878('0x5')](_0x324e47,_0x2223cb);};}exports[_0xf878('0x6')]=function(_0x2150aa){for(var _0x7be8ce=0x0,_0x3ccd8e=events['length'];_0x7be8ce<_0x3ccd8e;_0x7be8ce++){var _0x35677e=events[_0x7be8ce];var _0x926d24=createListener('smsInteraction:'+_0x35677e,_0x2150aa);SmsInteractionEvents['on'](_0x35677e,_0x926d24);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 3ec16a0..232a678 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 _0x3ad1=['post','smsmessage:create','create','status','put','update','/:id/accept','accept','reject','delete','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/:id','show'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x3ad1,0x11e));var _0x13ad=function(_0x3c88be,_0x40ae3f){_0x3c88be=_0x3c88be-0x0;var _0x4d4264=_0x3ad1[_0x3c88be];return _0x4d4264;};'use strict';var multer=require(_0x13ad('0x0'));var util=require(_0x13ad('0x1'));var path=require('path');var timeout=require(_0x13ad('0x2'));var express=require(_0x13ad('0x3'));var router=express[_0x13ad('0x4')]();var fs_extra=require(_0x13ad('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x13ad('0x6'));var controller=require(_0x13ad('0x7'));router[_0x13ad('0x8')]('/',auth[_0x13ad('0x9')](),controller[_0x13ad('0xa')]);router['get']('/describe',auth[_0x13ad('0x9')](),controller['describe']);router[_0x13ad('0x8')](_0x13ad('0xb'),auth['isAuthenticated'](),controller[_0x13ad('0xc')]);router[_0x13ad('0xd')]('/',auth[_0x13ad('0x9')](),interaction['tracked']('sms',_0x13ad('0xe')),controller[_0x13ad('0xf')]);router[_0x13ad('0xd')]('/:id/status',controller[_0x13ad('0x10')]);router[_0x13ad('0x11')](_0x13ad('0xb'),auth[_0x13ad('0x9')](),controller[_0x13ad('0x12')]);router[_0x13ad('0x11')](_0x13ad('0x13'),auth[_0x13ad('0x9')](),controller[_0x13ad('0x14')]);router[_0x13ad('0x11')]('/:id/reject',auth[_0x13ad('0x9')](),controller[_0x13ad('0x15')]);router[_0x13ad('0x16')]('/:id',auth[_0x13ad('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x34a5=['create','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','tracked','sms'];(function(_0xc1f646,_0x46aa45){var _0x5e5e0b=function(_0x4b7c92){while(--_0x4b7c92){_0xc1f646['push'](_0xc1f646['shift']());}};_0x5e5e0b(++_0x46aa45);}(_0x34a5,0x15a));var _0x534a=function(_0x43344d,_0x3041ad){_0x43344d=_0x43344d-0x0;var _0x33ceb7=_0x34a5[_0x43344d];return _0x33ceb7;};'use strict';var multer=require('multer');var util=require(_0x534a('0x0'));var path=require(_0x534a('0x1'));var timeout=require(_0x534a('0x2'));var express=require(_0x534a('0x3'));var router=express[_0x534a('0x4')]();var fs_extra=require(_0x534a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x534a('0x6'));var config=require(_0x534a('0x7'));var controller=require(_0x534a('0x8'));router[_0x534a('0x9')]('/',auth[_0x534a('0xa')](),controller[_0x534a('0xb')]);router[_0x534a('0x9')](_0x534a('0xc'),auth[_0x534a('0xa')](),controller[_0x534a('0xd')]);router['get'](_0x534a('0xe'),auth[_0x534a('0xa')](),controller[_0x534a('0xf')]);router['post']('/',auth[_0x534a('0xa')](),interaction[_0x534a('0x10')](_0x534a('0x11'),'smsmessage:create'),controller[_0x534a('0x12')]);router['post']('/:id/status',controller[_0x534a('0x13')]);router[_0x534a('0x14')](_0x534a('0xe'),auth[_0x534a('0xa')](),controller[_0x534a('0x15')]);router[_0x534a('0x14')](_0x534a('0x16'),auth['isAuthenticated'](),controller[_0x534a('0x17')]);router[_0x534a('0x14')](_0x534a('0x18'),auth[_0x534a('0xa')](),controller[_0x534a('0x19')]);router[_0x534a('0x1a')](_0x534a('0xe'),auth[_0x534a('0xa')](),controller[_0x534a('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 564d667..8897575 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 _0x4a93=['exports','ENUM','out','STRING','BOOLEAN','TEXT','sequelize'];(function(_0x5c6b9a,_0x3ff453){var _0xa5c6d8=function(_0x4633ef){while(--_0x4633ef){_0x5c6b9a['push'](_0x5c6b9a['shift']());}};_0xa5c6d8(++_0x3ff453);}(_0x4a93,0x1bf));var _0x34a9=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0x4a93[_0x2642cb];return _0xe6e41;};'use strict';var Sequelize=require(_0x34a9('0x0'));module[_0x34a9('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x34a9('0x2')]('in','out'),'defaultValue':_0x34a9('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0x34a9('0x4')](0xbe)},'phone':{'type':Sequelize[_0x34a9('0x4')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x34a9('0x5')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x34a9('0x4')]},'providerResponse':{'type':Sequelize[_0x34a9('0x6')]}}; \ No newline at end of file +var _0xa906=['out','STRING','DATE','sequelize','TEXT','ENUM'];(function(_0x105c51,_0x412d34){var _0x1f727d=function(_0x536704){while(--_0x536704){_0x105c51['push'](_0x105c51['shift']());}};_0x1f727d(++_0x412d34);}(_0xa906,0x1e3));var _0x6a90=function(_0x3cba64,_0x2dcabf){_0x3cba64=_0x3cba64-0x0;var _0x140c26=_0xa906[_0x3cba64];return _0x140c26;};'use strict';var Sequelize=require(_0x6a90('0x0'));module['exports']={'body':{'type':Sequelize[_0x6a90('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x6a90('0x2')]('in',_0x6a90('0x3')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x6a90('0x4')]},'readAt':{'type':Sequelize[_0x6a90('0x5')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x6a90('0x4')]},'providerResponse':{'type':Sequelize[_0x6a90('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index b642eca..496a360 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 _0x4867=['request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','apply','update','destroy','stack','send','index','map','SmsMessage','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','type','VIRTUAL','filter','options','includeAll','include','params','find','create','body','describe','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','QueryTypes','contact','User','agent','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','reject','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','fullname','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','sent','delivered','Status','plivio','infobip','results','DELIVERED','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','http'];(function(_0x36b01a,_0x2e954c){var _0x1f371e=function(_0x497ef){while(--_0x497ef){_0x36b01a['push'](_0x36b01a['shift']());}};_0x1f371e(++_0x2e954c);}(_0x4867,0x1a2));var _0x7486=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0x4867[_0x35da42];return _0x370035;};'use strict';var emlformat=require(_0x7486('0x0'));var rimraf=require(_0x7486('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7486('0x2'));var rp=require(_0x7486('0x3'));var moment=require(_0x7486('0x4'));var BPromise=require(_0x7486('0x5'));var Mustache=require(_0x7486('0x6'));var util=require(_0x7486('0x7'));var path=require(_0x7486('0x8'));var sox=require(_0x7486('0x9'));var csv=require(_0x7486('0xa'));var ejs=require(_0x7486('0xb'));var fs=require('fs');var fs_extra=require(_0x7486('0xc'));var _=require('lodash');var squel=require(_0x7486('0xd'));var crypto=require(_0x7486('0xe'));var jsforce=require(_0x7486('0xf'));var deskjs=require(_0x7486('0x10'));var toCsv=require(_0x7486('0xa'));var querystring=require('querystring');var Papa=require(_0x7486('0x11'));var Redis=require(_0x7486('0x12'));var authService=require(_0x7486('0x13'));var qs=require(_0x7486('0x14'));var as=require(_0x7486('0x15'));var hardwareService=require(_0x7486('0x16'));var logger=require(_0x7486('0x17'))('api');var utils=require(_0x7486('0x18'));var config=require(_0x7486('0x19'));var licenseUtil=require(_0x7486('0x1a'));var db=require(_0x7486('0x1b'))['db'];config[_0x7486('0x1c')]=_[_0x7486('0x1d')](config[_0x7486('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x7486('0x1e'))(new Redis(config['redis']));require('./smsMessage.socket')[_0x7486('0x1f')](socket);var jayson=require(_0x7486('0x20'));var client=jayson[_0x7486('0x21')]['http']({'port':0x232c});var client9002=jayson['client'][_0x7486('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x1d52e6,_0x54801d,_0x4517b2,_0x3f0e66){return new BPromise(function(_0x42b1b8,_0x2f122f){var _0x276c6e=_0x3f0e66||client;return _0x276c6e[_0x7486('0x23')](_0x1d52e6,_0x4517b2)[_0x7486('0x24')](function(_0x7704fd){logger[_0x7486('0x25')](_0x7486('0x26'),_0x54801d,_0x7486('0x27'));logger[_0x7486('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x54801d,'request\x20sent',JSON[_0x7486('0x29')](_0x7704fd));if(_0x7704fd[_0x7486('0x2a')]){if(_0x7704fd[_0x7486('0x2a')][_0x7486('0x2b')]===0x1f4){logger[_0x7486('0x2a')](_0x7486('0x26'),_0x54801d,_0x7704fd[_0x7486('0x2a')][_0x7486('0x2c')]);return _0x2f122f(_0x7704fd[_0x7486('0x2a')][_0x7486('0x2c')]);}logger[_0x7486('0x2a')]('SmsMessage,\x20%s,\x20%s',_0x54801d,_0x7704fd[_0x7486('0x2a')]['message']);return _0x42b1b8(_0x7704fd[_0x7486('0x2a')][_0x7486('0x2c')]);}else{logger['info'](_0x7486('0x26'),_0x54801d,'request\x20sent');_0x42b1b8(_0x7704fd['result'][_0x7486('0x2c')]);}})[_0x7486('0x2d')](function(_0x2972df){logger['error'](_0x7486('0x26'),_0x54801d,_0x2972df);_0x2f122f(_0x2972df);});});}function respondWithStatusCode(_0x3632b5,_0x54bedc){_0x54bedc=_0x54bedc||0xcc;return function(_0x5ee20f){if(_0x5ee20f){return _0x3632b5[_0x7486('0x2e')](_0x54bedc);}return _0x3632b5['status'](_0x54bedc)[_0x7486('0x2f')]();};}function respondWithResult(_0x378885,_0x71659f){_0x71659f=_0x71659f||0xc8;return function(_0x592609){if(_0x592609){return _0x378885[_0x7486('0x30')](_0x71659f)['json'](_0x592609);}};}function respondWithFilteredResult(_0x2699e9,_0x2973c9){return function(_0x2477cc){if(_0x2477cc){var _0x476e2a=typeof _0x2973c9[_0x7486('0x31')]===_0x7486('0x32')&&typeof _0x2973c9[_0x7486('0x33')]===_0x7486('0x32');var _0x3a0689=_0x2477cc[_0x7486('0x34')];var _0x4f9768=_0x476e2a?0x0:_0x2973c9[_0x7486('0x31')];var _0x4c4e29=_0x476e2a?_0x2477cc[_0x7486('0x34')]:_0x2973c9[_0x7486('0x31')]+_0x2973c9[_0x7486('0x33')];var _0x301e8f;if(_0x4c4e29>=_0x3a0689){_0x4c4e29=_0x3a0689;_0x301e8f=0xc8;}else{_0x301e8f=0xce;}_0x2699e9[_0x7486('0x30')](_0x301e8f);return _0x2699e9['set'](_0x7486('0x35'),_0x4f9768+'-'+_0x4c4e29+'/'+_0x3a0689)[_0x7486('0x36')](_0x2477cc);}return null;};}function patchUpdates(_0x26a82d){return function(_0x4fc4b3){try{jsonpatch[_0x7486('0x37')](_0x4fc4b3,_0x26a82d,!![]);}catch(_0x31cce8){return BPromise['reject'](_0x31cce8);}return _0x4fc4b3['save']();};}function saveUpdates(_0x5b5295,_0x76471b){return function(_0x2552cd){if(_0x2552cd){return _0x2552cd[_0x7486('0x38')](_0x5b5295)[_0x7486('0x24')](function(_0x42dd28){return _0x42dd28;});}return null;};}function removeEntity(_0x194cf7,_0x2cf15c){return function(_0x381336){if(_0x381336){return _0x381336[_0x7486('0x39')]()[_0x7486('0x24')](function(){_0x194cf7[_0x7486('0x30')](0xcc)[_0x7486('0x2f')]();});}};}function handleEntityNotFound(_0x45d047,_0x596d86){return function(_0x3f960c){if(!_0x3f960c){_0x45d047[_0x7486('0x2e')](0x194);}return _0x3f960c;};}function handleError(_0x5c55f1,_0x104c77){_0x104c77=_0x104c77||0x1f4;return function(_0x5b6b6e){logger['error'](_0x5b6b6e[_0x7486('0x3a')]);if(_0x5b6b6e['name']){delete _0x5b6b6e['name'];}_0x5c55f1[_0x7486('0x30')](_0x104c77)[_0x7486('0x3b')](_0x5b6b6e);};}exports[_0x7486('0x3c')]=function(_0x424aa6,_0x13db14){var _0x24bcc4={},_0x3fb728={},_0x1a9bd2={'count':0x0,'rows':[]};var _0x50c1c5=_[_0x7486('0x3d')](db[_0x7486('0x3e')][_0x7486('0x3f')],function(_0x3f341e){return{'name':_0x3f341e[_0x7486('0x40')],'type':_0x3f341e['type'][_0x7486('0x41')]};});_0x3fb728[_0x7486('0x42')]=_['map'](_0x50c1c5,_0x7486('0x43'));_0x3fb728[_0x7486('0x44')]=_[_0x7486('0x45')](_0x424aa6['query']);_0x3fb728[_0x7486('0x46')]=_[_0x7486('0x47')](_0x3fb728['model'],_0x3fb728['query']);_0x24bcc4[_0x7486('0x48')]=_[_0x7486('0x47')](_0x3fb728[_0x7486('0x42')],qs[_0x7486('0x49')](_0x424aa6['query'][_0x7486('0x49')]));_0x24bcc4['attributes']=_0x24bcc4[_0x7486('0x48')][_0x7486('0x4a')]?_0x24bcc4['attributes']:_0x3fb728['model'];if(!_0x424aa6[_0x7486('0x44')][_0x7486('0x4b')](_0x7486('0x4c'))){_0x24bcc4['limit']=qs[_0x7486('0x33')](_0x424aa6[_0x7486('0x44')][_0x7486('0x33')]);_0x24bcc4[_0x7486('0x31')]=qs['offset'](_0x424aa6[_0x7486('0x44')][_0x7486('0x31')]);}_0x24bcc4['order']=qs[_0x7486('0x4d')](_0x424aa6[_0x7486('0x44')][_0x7486('0x4d')]);_0x24bcc4[_0x7486('0x4e')]=qs[_0x7486('0x46')](_['pick'](_0x424aa6[_0x7486('0x44')],_0x3fb728[_0x7486('0x46')]),_0x50c1c5);if(_0x424aa6[_0x7486('0x44')]['filter']){_0x24bcc4[_0x7486('0x4e')]=_[_0x7486('0x4f')](_0x24bcc4[_0x7486('0x4e')],{'$or':_[_0x7486('0x3d')](_0x50c1c5,function(_0x5d686c){if(_0x5d686c[_0x7486('0x50')]!==_0x7486('0x51')){var _0x48aae0={};_0x48aae0[_0x5d686c[_0x7486('0x43')]]={'$like':'%'+_0x424aa6['query'][_0x7486('0x52')]+'%'};return _0x48aae0;}})});}_0x24bcc4=_[_0x7486('0x4f')]({},_0x24bcc4,_0x424aa6[_0x7486('0x53')]);var _0x1ccd26={'where':_0x24bcc4[_0x7486('0x4e')]};return db[_0x7486('0x3e')][_0x7486('0x34')](_0x1ccd26)[_0x7486('0x24')](function(_0xf28a21){_0x1a9bd2[_0x7486('0x34')]=_0xf28a21;if(_0x424aa6['query'][_0x7486('0x54')]){_0x24bcc4[_0x7486('0x55')]=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x24bcc4);})[_0x7486('0x24')](function(_0x288ce0){_0x1a9bd2['rows']=_0x288ce0;return _0x1a9bd2;})['then'](respondWithFilteredResult(_0x13db14,_0x24bcc4))[_0x7486('0x2d')](handleError(_0x13db14,null));};exports['show']=function(_0x1507e8,_0x46bc54){var _0x3bc2c4={'raw':!![],'where':{'id':_0x1507e8[_0x7486('0x56')]['id']}},_0x59bf07={};_0x59bf07[_0x7486('0x42')]=_[_0x7486('0x45')](db[_0x7486('0x3e')]['rawAttributes']);_0x59bf07['query']=_['keys'](_0x1507e8[_0x7486('0x44')]);_0x59bf07['filters']=_[_0x7486('0x47')](_0x59bf07[_0x7486('0x42')],_0x59bf07[_0x7486('0x44')]);_0x3bc2c4[_0x7486('0x48')]=_['intersection'](_0x59bf07['model'],qs[_0x7486('0x49')](_0x1507e8[_0x7486('0x44')][_0x7486('0x49')]));_0x3bc2c4[_0x7486('0x48')]=_0x3bc2c4[_0x7486('0x48')][_0x7486('0x4a')]?_0x3bc2c4['attributes']:_0x59bf07[_0x7486('0x42')];if(_0x1507e8[_0x7486('0x44')][_0x7486('0x54')]){_0x3bc2c4['include']=[{'all':!![]}];}_0x3bc2c4=_['merge']({},_0x3bc2c4,_0x1507e8[_0x7486('0x53')]);return db[_0x7486('0x3e')][_0x7486('0x57')](_0x3bc2c4)['then'](handleEntityNotFound(_0x46bc54,null))['then'](respondWithResult(_0x46bc54,null))[_0x7486('0x2d')](handleError(_0x46bc54,null));};exports[_0x7486('0x58')]=function(_0x4a69b1,_0x40a320){return db['SmsMessage'][_0x7486('0x58')](_0x4a69b1[_0x7486('0x59')],{})[_0x7486('0x24')](respondWithResult(_0x40a320,0xc9))[_0x7486('0x2d')](handleError(_0x40a320,null));};exports['update']=function(_0xb07ea,_0x8a855b){if(_0xb07ea['body']['id']){delete _0xb07ea['body']['id'];}return db[_0x7486('0x3e')][_0x7486('0x57')]({'where':{'id':_0xb07ea[_0x7486('0x56')]['id']}})[_0x7486('0x24')](handleEntityNotFound(_0x8a855b,null))[_0x7486('0x24')](saveUpdates(_0xb07ea['body'],null))[_0x7486('0x24')](respondWithResult(_0x8a855b,null))[_0x7486('0x2d')](handleError(_0x8a855b,null));};exports[_0x7486('0x39')]=function(_0x1ffef3,_0x5c34c2){return db['SmsMessage'][_0x7486('0x57')]({'where':{'id':_0x1ffef3[_0x7486('0x56')]['id']}})[_0x7486('0x24')](handleEntityNotFound(_0x5c34c2,null))[_0x7486('0x24')](removeEntity(_0x5c34c2,null))[_0x7486('0x2d')](handleError(_0x5c34c2,null));};exports[_0x7486('0x5a')]=function(_0x1b8586,_0x4206e6){return db[_0x7486('0x3e')][_0x7486('0x5a')]()[_0x7486('0x24')](respondWithResult(_0x4206e6,null))[_0x7486('0x2d')](handleError(_0x4206e6,null));};var interaction_log=require(_0x7486('0x17'))(_0x7486('0x5b'));exports[_0x7486('0x5c')]=function(_0x164313,_0x10c690,_0x1badd4){var _0x517162={'agent':{},'channel':_0x7486('0x5d')};if(_0x164313['body']['id']){delete _0x164313['body']['id'];}_0x164313['body'][_0x7486('0x5e')]=!![];_0x164313[_0x7486('0x59')][_0x7486('0x5f')]=moment()[_0x7486('0x60')](_0x7486('0x61'));_0x164313[_0x7486('0x59')][_0x7486('0x62')]=_0x164313[_0x7486('0x59')]['UserId']||_0x164313[_0x7486('0x63')]['id'];_0x517162['agent']['id']=_0x164313[_0x7486('0x59')][_0x7486('0x62')];return db['SmsMessage']['find']({'where':{'id':_0x164313[_0x7486('0x56')]['id'],'UserId':null}})[_0x7486('0x24')](handleEntityNotFound(_0x10c690,null))[_0x7486('0x24')](saveUpdates(_0x164313[_0x7486('0x59')],null))['then'](function(_0x1ebc22){if(_0x1ebc22){_0x517162[_0x7486('0x2c')]=_0x1ebc22[_0x7486('0x64')]({'plain':!![]});return db[_0x7486('0x65')][_0x7486('0x57')]({'where':{'id':_0x1ebc22[_0x7486('0x66')]}});}return null;})[_0x7486('0x24')](handleEntityNotFound(_0x10c690,null))[_0x7486('0x24')](function(_0x2112df){if(_0x2112df){return _0x2112df[_0x7486('0x38')]({'UserId':_0x164313[_0x7486('0x59')][_0x7486('0x62')],'read1stAt':_[_0x7486('0x67')](_0x2112df[_0x7486('0x68')])?moment()['format'](_0x7486('0x61')):undefined});}return null;})[_0x7486('0x24')](function(_0x445655){if(_0x445655){_0x517162[_0x7486('0x69')]=_0x445655[_0x7486('0x64')]({'plain':!![]});interaction_log[_0x7486('0x25')](_0x7486('0x6a'),_0x164313[_0x7486('0x63')]['id'],_0x164313[_0x7486('0x63')][_0x7486('0x43')],_0x164313[_0x7486('0x63')][_0x7486('0x6b')],_0x517162[_0x7486('0x69')]['id'],_0x164313[_0x7486('0x59')]?JSON[_0x7486('0x29')](_0x164313[_0x7486('0x59')]):_0x7486('0x6c'));return respondWithRpcPromise(_0x7486('0x6d'),_0x7486('0x6e'),_0x517162);}return null;})[_0x7486('0x24')](function(_0x5f0fe9){var _0x2a3880='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5f0fe9[_0x7486('0x2c')]['ContactId'];return db['sequelize'][_0x7486('0x44')](_0x2a3880,{'type':db['Sequelize'][_0x7486('0x6f')]['SELECT'],'raw':!![]})[_0x7486('0x24')](function(_0x43e9c1){return _0x43e9c1;});})[_0x7486('0x24')](function(_0x207323){if(_0x207323){_0x517162[_0x7486('0x2c')][_0x7486('0x70')]=_0x207323[0x0];if(!_0x164313['body'][_0x7486('0x62')])return;return db[_0x7486('0x71')][_0x7486('0x57')]({'where':{'id':_0x164313[_0x7486('0x59')][_0x7486('0x62')],'role':_0x7486('0x72')},'attributes':['id',_0x7486('0x43'),'fullname',_0x7486('0x73'),_0x7486('0x74')],'raw':!![]});}return null;})[_0x7486('0x24')](function(_0x339b06){if(!_0x339b06)return null;_0x517162[_0x7486('0x2c')][_0x7486('0x72')]=_0x339b06;return _0x517162;})[_0x7486('0x24')](function(_0x234332){if(_0x234332){if(_0x164313[_0x7486('0x59')][_0x7486('0x75')]){_0x517162['message'][_0x7486('0x76')]=util[_0x7486('0x60')](_0x7486('0x77'),_0x164313[_0x7486('0x63')]['name']);_0x517162[_0x7486('0x2c')]['channel']=_0x517162[_0x7486('0x78')];_0x517162[_0x7486('0x2c')][_0x7486('0x79')]=_0x7486('0x5c');return respondWithRpcPromise(_0x7486('0x7a'),_0x7486('0x7a'),{'event':_0x7486('0x7b'),'message':_0x517162['message']},client9002)[_0x7486('0x24')](function(){return _0x517162;});}return _0x517162;}return null;})[_0x7486('0x24')](respondWithResult(_0x10c690,null))[_0x7486('0x2d')](handleError(_0x10c690,null));};var interaction_log=require(_0x7486('0x17'))(_0x7486('0x5b'));exports[_0x7486('0x7c')]=function(_0x5246ce,_0x31e3a3,_0x570c1f){var _0x551dc0={'agent':{},'channel':_0x7486('0x5d')};if(_0x5246ce[_0x7486('0x59')]['id']){delete _0x5246ce[_0x7486('0x59')]['id'];}_0x5246ce[_0x7486('0x59')][_0x7486('0x62')]=_0x5246ce['body'][_0x7486('0x62')]||_0x5246ce['user']['id'];_0x551dc0['agent']['id']=_0x5246ce[_0x7486('0x59')][_0x7486('0x62')];return db['SmsMessage'][_0x7486('0x57')]({'where':{'id':_0x5246ce[_0x7486('0x56')]['id'],'UserId':null}})[_0x7486('0x24')](handleEntityNotFound(_0x31e3a3,null))[_0x7486('0x24')](function(_0x9d974b){if(_0x9d974b){_0x551dc0[_0x7486('0x2c')]=_0x9d974b[_0x7486('0x64')]({'plain':!![]});return db[_0x7486('0x65')]['find']({'where':{'id':_0x9d974b[_0x7486('0x66')]}});}return null;})[_0x7486('0x24')](handleEntityNotFound(_0x31e3a3,null))[_0x7486('0x24')](function(_0x333eef){if(_0x333eef){_0x551dc0[_0x7486('0x69')]=_0x333eef[_0x7486('0x64')]({'plain':!![]});interaction_log[_0x7486('0x25')](_0x7486('0x7d'),_0x5246ce[_0x7486('0x63')]['id'],_0x5246ce[_0x7486('0x63')][_0x7486('0x43')],_0x5246ce[_0x7486('0x63')][_0x7486('0x6b')],_0x551dc0[_0x7486('0x69')]['id'],_0x5246ce[_0x7486('0x59')]?JSON[_0x7486('0x29')](_0x5246ce[_0x7486('0x59')]):'null');return respondWithRpcPromise('RejectMessage',_0x7486('0x7e'),_0x551dc0);}return null;})[_0x7486('0x24')](function(_0x4cef66){var _0xc3303f=_0x7486('0x7f')+_0x4cef66[_0x7486('0x2c')][_0x7486('0x80')];return db[_0x7486('0x81')]['query'](_0xc3303f,{'type':db[_0x7486('0x82')][_0x7486('0x6f')][_0x7486('0x83')],'raw':!![]})[_0x7486('0x24')](function(_0x38e520){return _0x38e520;});})['then'](function(_0x41169f){if(_0x41169f){_0x551dc0[_0x7486('0x2c')][_0x7486('0x70')]=_0x41169f[0x0];if(!_0x5246ce[_0x7486('0x59')][_0x7486('0x62')])return;return db[_0x7486('0x71')][_0x7486('0x57')]({'where':{'id':_0x5246ce[_0x7486('0x59')][_0x7486('0x62')],'role':'agent'},'attributes':['id',_0x7486('0x43'),_0x7486('0x84'),_0x7486('0x73'),_0x7486('0x74')],'raw':!![]});}return null;})[_0x7486('0x24')](function(_0xa82103){if(!_0xa82103)return null;_0x551dc0['message'][_0x7486('0x72')]=_0xa82103;return _0x551dc0;})[_0x7486('0x24')](function(_0x5dec42){if(_0x5dec42){_0x5dec42[_0x7486('0x2c')][_0x7486('0x76')]=util['format']('SIP/%s',_0x5246ce[_0x7486('0x63')]['name']);_0x5dec42['message'][_0x7486('0x78')]=_0x551dc0[_0x7486('0x78')];_0x5dec42[_0x7486('0x2c')]['event']=_0x7486('0x7c');respondWithRpcPromise(_0x7486('0x7a'),'EventManager',{'event':'rejectmessage','message':_0x5dec42[_0x7486('0x2c')]},client9002);return _0x551dc0;}return null;})[_0x7486('0x24')](respondWithResult(_0x31e3a3,null))[_0x7486('0x2d')](handleError(_0x31e3a3,null));};exports[_0x7486('0x30')]=function(_0x3d9614,_0x74f58c,_0x795c95){if(_0x3d9614[_0x7486('0x59')]['id']){delete _0x3d9614[_0x7486('0x59')]['id'];}var _0x1b673f;return db[_0x7486('0x3e')][_0x7486('0x57')]({'where':{'id':_0x3d9614['params']['id']}})['then'](handleEntityNotFound(_0x74f58c,null))[_0x7486('0x24')](function(_0x219f0d){if(_0x219f0d){_0x1b673f=_0x219f0d;return db[_0x7486('0x85')]['find']({'where':{'id':_0x219f0d[_0x7486('0x86')]}});}})[_0x7486('0x24')](handleEntityNotFound(_0x74f58c,null))[_0x7486('0x24')](function(_0x3acce5){if(_0x3acce5){logger[_0x7486('0x28')](_0x7486('0x87'),_0x7486('0x30'),_0x7486('0x88'),_0x3acce5[_0x7486('0x50')],util['inspect'](_0x3d9614[_0x7486('0x59')],{'showHidden':![],'depth':null}));switch(_0x3acce5[_0x7486('0x50')]){case _0x7486('0x89'):if(_0x3d9614[_0x7486('0x59')][_0x7486('0x8a')]&&_0x3d9614[_0x7486('0x59')][_0x7486('0x8a')]===_0x1b673f[_0x7486('0x8b')]){return _0x1b673f['update']({'read':!![]});}else{logger['error'](_0x7486('0x8c'),_0x7486('0x30'),_0x7486('0x89'),util[_0x7486('0x8d')](_0x3d9614[_0x7486('0x59')],{'showHidden':![],'depth':null}));}break;case _0x7486('0x8e'):if(_0x3d9614[_0x7486('0x59')]['MessageUUID']&&_0x3d9614[_0x7486('0x59')][_0x7486('0x8f')]===_0x1b673f['messageId']&&_['indexOf']([_0x7486('0x90'),_0x7486('0x91')],_0x3d9614[_0x7486('0x59')][_0x7486('0x92')])>=0x0){return _0x1b673f[_0x7486('0x38')]({'read':!![]});}else{logger['error'](_0x7486('0x8c'),_0x7486('0x30'),_0x7486('0x93'),util[_0x7486('0x8d')](_0x3d9614[_0x7486('0x59')],{'showHidden':![],'depth':null}));}break;case _0x7486('0x94'):var _0x4e2f00=_0x3d9614[_0x7486('0x59')][_0x7486('0x95')][0x0];if(_0x4e2f00[_0x7486('0x30')]['groupName']===_0x7486('0x96')){return _0x1b673f[_0x7486('0x38')]({'read':!![]});}else{logger[_0x7486('0x2a')](_0x7486('0x8c'),_0x7486('0x30'),_0x7486('0x94'),util[_0x7486('0x8d')](_0x3d9614[_0x7486('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x1b673f;}})['then'](respondWithResult(_0x74f58c,null))[_0x7486('0x2d')](handleError(_0x74f58c,null));}; \ No newline at end of file +var _0x5be4=['YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','stringify','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','channel','EventManager','acceptmessage','rejectMessage','ContactId','sequelize','agent','event','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','MessageUUID','indexOf','sent','delivered','plivio','inspect','infobip','results','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','SmsMessage','includeAll','include','findAll','rows','show','params','keys','find','create','body','destroy','describe','../../config/logger','sms-interactions','accept','sms','read','format'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x5be4,0x161));var _0x45be=function(_0x5a4951,_0x5d694a){_0x5a4951=_0x5a4951-0x0;var _0x21e0dc=_0x5be4[_0x5a4951];return _0x21e0dc;};'use strict';var emlformat=require(_0x45be('0x0'));var rimraf=require(_0x45be('0x1'));var zipdir=require(_0x45be('0x2'));var jsonpatch=require(_0x45be('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x45be('0x4'));var Mustache=require(_0x45be('0x5'));var util=require(_0x45be('0x6'));var path=require(_0x45be('0x7'));var sox=require(_0x45be('0x8'));var csv=require(_0x45be('0x9'));var ejs=require(_0x45be('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x45be('0xb'));var squel=require('squel');var crypto=require(_0x45be('0xc'));var jsforce=require(_0x45be('0xd'));var deskjs=require(_0x45be('0xe'));var toCsv=require(_0x45be('0x9'));var querystring=require(_0x45be('0xf'));var Papa=require(_0x45be('0x10'));var Redis=require(_0x45be('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x45be('0x12'));var as=require(_0x45be('0x13'));var hardwareService=require(_0x45be('0x14'));var logger=require('../../config/logger')(_0x45be('0x15'));var utils=require(_0x45be('0x16'));var config=require(_0x45be('0x17'));var licenseUtil=require(_0x45be('0x18'));var db=require(_0x45be('0x19'))['db'];config[_0x45be('0x1a')]=_['defaults'](config['redis'],{'host':_0x45be('0x1b'),'port':0x18eb});var socket=require(_0x45be('0x1c'))(new Redis(config[_0x45be('0x1a')]));require('./smsMessage.socket')[_0x45be('0x1d')](socket);var jayson=require(_0x45be('0x1e'));var client=jayson['client'][_0x45be('0x1f')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x189b25,_0x43097a,_0x24244f,_0x5aaca8){return new BPromise(function(_0x4b2c77,_0x3d4b65){var _0x4c57f7=_0x5aaca8||client;return _0x4c57f7[_0x45be('0x20')](_0x189b25,_0x24244f)[_0x45be('0x21')](function(_0x28f467){logger[_0x45be('0x22')](_0x45be('0x23'),_0x43097a,_0x45be('0x24'));logger[_0x45be('0x25')](_0x45be('0x26'),_0x43097a,_0x45be('0x24'),JSON['stringify'](_0x28f467));if(_0x28f467[_0x45be('0x27')]){if(_0x28f467[_0x45be('0x27')][_0x45be('0x28')]===0x1f4){logger[_0x45be('0x27')](_0x45be('0x23'),_0x43097a,_0x28f467['error'][_0x45be('0x29')]);return _0x3d4b65(_0x28f467[_0x45be('0x27')][_0x45be('0x29')]);}logger['error'](_0x45be('0x23'),_0x43097a,_0x28f467[_0x45be('0x27')][_0x45be('0x29')]);return _0x4b2c77(_0x28f467[_0x45be('0x27')]['message']);}else{logger[_0x45be('0x22')](_0x45be('0x23'),_0x43097a,_0x45be('0x24'));_0x4b2c77(_0x28f467[_0x45be('0x2a')][_0x45be('0x29')]);}})[_0x45be('0x2b')](function(_0x240f08){logger[_0x45be('0x27')](_0x45be('0x23'),_0x43097a,_0x240f08);_0x3d4b65(_0x240f08);});});}function respondWithStatusCode(_0x40d97e,_0x2b6c91){_0x2b6c91=_0x2b6c91||0xcc;return function(_0x11f021){if(_0x11f021){return _0x40d97e[_0x45be('0x2c')](_0x2b6c91);}return _0x40d97e[_0x45be('0x2d')](_0x2b6c91)[_0x45be('0x2e')]();};}function respondWithResult(_0x489c26,_0x2bd04c){_0x2bd04c=_0x2bd04c||0xc8;return function(_0x1c1157){if(_0x1c1157){return _0x489c26[_0x45be('0x2d')](_0x2bd04c)['json'](_0x1c1157);}};}function respondWithFilteredResult(_0x61443f,_0x1a5681){return function(_0x8cb132){if(_0x8cb132){var _0x309df4=typeof _0x1a5681[_0x45be('0x2f')]===_0x45be('0x30')&&typeof _0x1a5681[_0x45be('0x31')]===_0x45be('0x30');var _0x340a69=_0x8cb132[_0x45be('0x32')];var _0x2da713=_0x309df4?0x0:_0x1a5681['offset'];var _0x246598=_0x309df4?_0x8cb132[_0x45be('0x32')]:_0x1a5681[_0x45be('0x2f')]+_0x1a5681[_0x45be('0x31')];var _0x3dc362;if(_0x246598>=_0x340a69){_0x246598=_0x340a69;_0x3dc362=0xc8;}else{_0x3dc362=0xce;}_0x61443f[_0x45be('0x2d')](_0x3dc362);return _0x61443f[_0x45be('0x33')](_0x45be('0x34'),_0x2da713+'-'+_0x246598+'/'+_0x340a69)[_0x45be('0x35')](_0x8cb132);}return null;};}function patchUpdates(_0x291112){return function(_0x24c067){try{jsonpatch[_0x45be('0x36')](_0x24c067,_0x291112,!![]);}catch(_0x396520){return BPromise[_0x45be('0x37')](_0x396520);}return _0x24c067['save']();};}function saveUpdates(_0x464adc,_0x370720){return function(_0x420cd3){if(_0x420cd3){return _0x420cd3[_0x45be('0x38')](_0x464adc)['then'](function(_0x30ba7d){return _0x30ba7d;});}return null;};}function removeEntity(_0x593fb4,_0x754239){return function(_0x5bb22f){if(_0x5bb22f){return _0x5bb22f['destroy']()[_0x45be('0x21')](function(){_0x593fb4['status'](0xcc)[_0x45be('0x2e')]();});}};}function handleEntityNotFound(_0x4be207,_0x7d10ac){return function(_0x5ab448){if(!_0x5ab448){_0x4be207['sendStatus'](0x194);}return _0x5ab448;};}function handleError(_0x390015,_0x49e663){_0x49e663=_0x49e663||0x1f4;return function(_0x15c1e1){logger[_0x45be('0x27')](_0x15c1e1[_0x45be('0x39')]);if(_0x15c1e1[_0x45be('0x3a')]){delete _0x15c1e1[_0x45be('0x3a')];}_0x390015[_0x45be('0x2d')](_0x49e663)['send'](_0x15c1e1);};}exports[_0x45be('0x3b')]=function(_0x54d570,_0x23ffaa){var _0x33e13b={},_0xffd136={},_0x10cde0={'count':0x0,'rows':[]};var _0x4e5357=_[_0x45be('0x3c')](db['SmsMessage'][_0x45be('0x3d')],function(_0x448f79){return{'name':_0x448f79[_0x45be('0x3e')],'type':_0x448f79[_0x45be('0x3f')][_0x45be('0x40')]};});_0xffd136[_0x45be('0x41')]=_[_0x45be('0x3c')](_0x4e5357,'name');_0xffd136[_0x45be('0x42')]=_['keys'](_0x54d570[_0x45be('0x42')]);_0xffd136[_0x45be('0x43')]=_[_0x45be('0x44')](_0xffd136[_0x45be('0x41')],_0xffd136[_0x45be('0x42')]);_0x33e13b[_0x45be('0x45')]=_[_0x45be('0x44')](_0xffd136['model'],qs['fields'](_0x54d570[_0x45be('0x42')][_0x45be('0x46')]));_0x33e13b[_0x45be('0x45')]=_0x33e13b['attributes'][_0x45be('0x47')]?_0x33e13b[_0x45be('0x45')]:_0xffd136['model'];if(!_0x54d570['query'][_0x45be('0x48')](_0x45be('0x49'))){_0x33e13b[_0x45be('0x31')]=qs['limit'](_0x54d570[_0x45be('0x42')][_0x45be('0x31')]);_0x33e13b[_0x45be('0x2f')]=qs[_0x45be('0x2f')](_0x54d570[_0x45be('0x42')][_0x45be('0x2f')]);}_0x33e13b[_0x45be('0x4a')]=qs[_0x45be('0x4b')](_0x54d570[_0x45be('0x42')][_0x45be('0x4b')]);_0x33e13b[_0x45be('0x4c')]=qs[_0x45be('0x43')](_['pick'](_0x54d570[_0x45be('0x42')],_0xffd136['filters']),_0x4e5357);if(_0x54d570[_0x45be('0x42')][_0x45be('0x4d')]){_0x33e13b[_0x45be('0x4c')]=_[_0x45be('0x4e')](_0x33e13b['where'],{'$or':_['map'](_0x4e5357,function(_0x585ea1){if(_0x585ea1[_0x45be('0x3f')]!==_0x45be('0x4f')){var _0x57bc5b={};_0x57bc5b[_0x585ea1[_0x45be('0x3a')]]={'$like':'%'+_0x54d570[_0x45be('0x42')][_0x45be('0x4d')]+'%'};return _0x57bc5b;}})});}_0x33e13b=_['merge']({},_0x33e13b,_0x54d570[_0x45be('0x50')]);var _0x1a9eef={'where':_0x33e13b[_0x45be('0x4c')]};return db[_0x45be('0x51')][_0x45be('0x32')](_0x1a9eef)['then'](function(_0xd0dd1){_0x10cde0['count']=_0xd0dd1;if(_0x54d570[_0x45be('0x42')][_0x45be('0x52')]){_0x33e13b[_0x45be('0x53')]=[{'all':!![]}];}return db[_0x45be('0x51')][_0x45be('0x54')](_0x33e13b);})[_0x45be('0x21')](function(_0x16de04){_0x10cde0[_0x45be('0x55')]=_0x16de04;return _0x10cde0;})[_0x45be('0x21')](respondWithFilteredResult(_0x23ffaa,_0x33e13b))[_0x45be('0x2b')](handleError(_0x23ffaa,null));};exports[_0x45be('0x56')]=function(_0x491ec4,_0x2a6037){var _0x1c78be={'raw':!![],'where':{'id':_0x491ec4[_0x45be('0x57')]['id']}},_0x2c8730={};_0x2c8730['model']=_['keys'](db[_0x45be('0x51')][_0x45be('0x3d')]);_0x2c8730[_0x45be('0x42')]=_[_0x45be('0x58')](_0x491ec4['query']);_0x2c8730[_0x45be('0x43')]=_[_0x45be('0x44')](_0x2c8730[_0x45be('0x41')],_0x2c8730['query']);_0x1c78be[_0x45be('0x45')]=_[_0x45be('0x44')](_0x2c8730['model'],qs[_0x45be('0x46')](_0x491ec4['query'][_0x45be('0x46')]));_0x1c78be['attributes']=_0x1c78be[_0x45be('0x45')][_0x45be('0x47')]?_0x1c78be[_0x45be('0x45')]:_0x2c8730[_0x45be('0x41')];if(_0x491ec4[_0x45be('0x42')][_0x45be('0x52')]){_0x1c78be[_0x45be('0x53')]=[{'all':!![]}];}_0x1c78be=_[_0x45be('0x4e')]({},_0x1c78be,_0x491ec4[_0x45be('0x50')]);return db[_0x45be('0x51')][_0x45be('0x59')](_0x1c78be)[_0x45be('0x21')](handleEntityNotFound(_0x2a6037,null))[_0x45be('0x21')](respondWithResult(_0x2a6037,null))[_0x45be('0x2b')](handleError(_0x2a6037,null));};exports[_0x45be('0x5a')]=function(_0x305a6a,_0x143fad){return db[_0x45be('0x51')]['create'](_0x305a6a[_0x45be('0x5b')],{})['then'](respondWithResult(_0x143fad,0xc9))['catch'](handleError(_0x143fad,null));};exports['update']=function(_0x2d1da5,_0xbdb69f){if(_0x2d1da5[_0x45be('0x5b')]['id']){delete _0x2d1da5[_0x45be('0x5b')]['id'];}return db[_0x45be('0x51')][_0x45be('0x59')]({'where':{'id':_0x2d1da5[_0x45be('0x57')]['id']}})[_0x45be('0x21')](handleEntityNotFound(_0xbdb69f,null))['then'](saveUpdates(_0x2d1da5[_0x45be('0x5b')],null))[_0x45be('0x21')](respondWithResult(_0xbdb69f,null))['catch'](handleError(_0xbdb69f,null));};exports[_0x45be('0x5c')]=function(_0x389304,_0x5d7e53){return db[_0x45be('0x51')][_0x45be('0x59')]({'where':{'id':_0x389304[_0x45be('0x57')]['id']}})[_0x45be('0x21')](handleEntityNotFound(_0x5d7e53,null))[_0x45be('0x21')](removeEntity(_0x5d7e53,null))['catch'](handleError(_0x5d7e53,null));};exports['describe']=function(_0x191147,_0xe350c9){return db[_0x45be('0x51')][_0x45be('0x5d')]()[_0x45be('0x21')](respondWithResult(_0xe350c9,null))['catch'](handleError(_0xe350c9,null));};var interaction_log=require(_0x45be('0x5e'))(_0x45be('0x5f'));exports[_0x45be('0x60')]=function(_0x22d714,_0x3e60a9,_0x3d7b4a){var _0x415241={'agent':{},'channel':_0x45be('0x61')};if(_0x22d714[_0x45be('0x5b')]['id']){delete _0x22d714[_0x45be('0x5b')]['id'];}_0x22d714[_0x45be('0x5b')][_0x45be('0x62')]=!![];_0x22d714[_0x45be('0x5b')]['readAt']=moment()[_0x45be('0x63')](_0x45be('0x64'));_0x22d714[_0x45be('0x5b')]['UserId']=_0x22d714[_0x45be('0x5b')][_0x45be('0x65')]||_0x22d714[_0x45be('0x66')]['id'];_0x415241['agent']['id']=_0x22d714[_0x45be('0x5b')]['UserId'];return db[_0x45be('0x51')]['find']({'where':{'id':_0x22d714[_0x45be('0x57')]['id'],'UserId':null}})[_0x45be('0x21')](handleEntityNotFound(_0x3e60a9,null))[_0x45be('0x21')](saveUpdates(_0x22d714['body'],null))[_0x45be('0x21')](function(_0x1567f6){if(_0x1567f6){_0x415241[_0x45be('0x29')]=_0x1567f6[_0x45be('0x67')]({'plain':!![]});return db[_0x45be('0x68')][_0x45be('0x59')]({'where':{'id':_0x1567f6[_0x45be('0x69')]}});}return null;})[_0x45be('0x21')](handleEntityNotFound(_0x3e60a9,null))[_0x45be('0x21')](function(_0x3b3021){if(_0x3b3021){return _0x3b3021['update']({'UserId':_0x22d714[_0x45be('0x5b')][_0x45be('0x65')],'read1stAt':_[_0x45be('0x6a')](_0x3b3021[_0x45be('0x6b')])?moment()[_0x45be('0x63')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x45be('0x21')](function(_0x2a9afd){if(_0x2a9afd){_0x415241['interaction']=_0x2a9afd[_0x45be('0x67')]({'plain':!![]});interaction_log[_0x45be('0x22')](_0x45be('0x6c'),_0x22d714[_0x45be('0x66')]['id'],_0x22d714[_0x45be('0x66')][_0x45be('0x3a')],_0x22d714['user'][_0x45be('0x6d')],_0x415241[_0x45be('0x6e')]['id'],_0x22d714[_0x45be('0x5b')]?JSON[_0x45be('0x6f')](_0x22d714[_0x45be('0x5b')]):_0x45be('0x70'));return respondWithRpcPromise('AcceptMessage',_0x45be('0x71'),_0x415241);}return null;})['then'](function(_0x552091){var _0x1e5508=_0x45be('0x72')+_0x552091['message']['ContactId'];return db['sequelize'][_0x45be('0x42')](_0x1e5508,{'type':db[_0x45be('0x73')][_0x45be('0x74')][_0x45be('0x75')],'raw':!![]})['then'](function(_0x3c9284){return _0x3c9284;});})[_0x45be('0x21')](function(_0x597a44){if(_0x597a44){_0x415241[_0x45be('0x29')][_0x45be('0x76')]=_0x597a44[0x0];if(!_0x22d714[_0x45be('0x5b')][_0x45be('0x65')])return;return db[_0x45be('0x77')][_0x45be('0x59')]({'where':{'id':_0x22d714[_0x45be('0x5b')]['UserId'],'role':'agent'},'attributes':['id',_0x45be('0x3a'),_0x45be('0x78'),_0x45be('0x79'),_0x45be('0x7a')],'raw':!![]});}return null;})[_0x45be('0x21')](function(_0x416df4){if(!_0x416df4)return null;_0x415241['message']['agent']=_0x416df4;return _0x415241;})[_0x45be('0x21')](function(_0xa8c25f){if(_0xa8c25f){if(_0x22d714['body']['manual']){_0x415241[_0x45be('0x29')][_0x45be('0x7b')]=util[_0x45be('0x63')](_0x45be('0x7c'),_0x22d714[_0x45be('0x66')]['name']);_0x415241[_0x45be('0x29')][_0x45be('0x7d')]=_0x415241[_0x45be('0x7d')];_0x415241[_0x45be('0x29')]['event']=_0x45be('0x60');return respondWithRpcPromise(_0x45be('0x7e'),_0x45be('0x7e'),{'event':_0x45be('0x7f'),'message':_0x415241['message']},client9002)[_0x45be('0x21')](function(){return _0x415241;});}return _0x415241;}return null;})[_0x45be('0x21')](respondWithResult(_0x3e60a9,null))[_0x45be('0x2b')](handleError(_0x3e60a9,null));};var interaction_log=require(_0x45be('0x5e'))(_0x45be('0x5f'));exports[_0x45be('0x37')]=function(_0x16dce0,_0x2b0a71,_0x31954c){var _0x21c6f9={'agent':{},'channel':_0x45be('0x61')};if(_0x16dce0[_0x45be('0x5b')]['id']){delete _0x16dce0['body']['id'];}_0x16dce0[_0x45be('0x5b')][_0x45be('0x65')]=_0x16dce0[_0x45be('0x5b')][_0x45be('0x65')]||_0x16dce0[_0x45be('0x66')]['id'];_0x21c6f9['agent']['id']=_0x16dce0[_0x45be('0x5b')][_0x45be('0x65')];return db[_0x45be('0x51')][_0x45be('0x59')]({'where':{'id':_0x16dce0[_0x45be('0x57')]['id'],'UserId':null}})[_0x45be('0x21')](handleEntityNotFound(_0x2b0a71,null))[_0x45be('0x21')](function(_0x3ba91c){if(_0x3ba91c){_0x21c6f9['message']=_0x3ba91c['get']({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x3ba91c['SmsInteractionId']}});}return null;})[_0x45be('0x21')](handleEntityNotFound(_0x2b0a71,null))['then'](function(_0xff5571){if(_0xff5571){_0x21c6f9[_0x45be('0x6e')]=_0xff5571[_0x45be('0x67')]({'plain':!![]});interaction_log[_0x45be('0x22')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x16dce0['user']['id'],_0x16dce0['user']['name'],_0x16dce0[_0x45be('0x66')]['role'],_0x21c6f9[_0x45be('0x6e')]['id'],_0x16dce0['body']?JSON[_0x45be('0x6f')](_0x16dce0[_0x45be('0x5b')]):_0x45be('0x70'));return respondWithRpcPromise('RejectMessage',_0x45be('0x80'),_0x21c6f9);}return null;})['then'](function(_0x5a0e22){var _0x58377f=_0x45be('0x72')+_0x5a0e22[_0x45be('0x29')][_0x45be('0x81')];return db[_0x45be('0x82')][_0x45be('0x42')](_0x58377f,{'type':db['Sequelize']['QueryTypes'][_0x45be('0x75')],'raw':!![]})[_0x45be('0x21')](function(_0x363258){return _0x363258;});})[_0x45be('0x21')](function(_0x46a198){if(_0x46a198){_0x21c6f9[_0x45be('0x29')]['contact']=_0x46a198[0x0];if(!_0x16dce0[_0x45be('0x5b')][_0x45be('0x65')])return;return db[_0x45be('0x77')][_0x45be('0x59')]({'where':{'id':_0x16dce0['body'][_0x45be('0x65')],'role':_0x45be('0x83')},'attributes':['id',_0x45be('0x3a'),'fullname','email',_0x45be('0x7a')],'raw':!![]});}return null;})['then'](function(_0x5e850f){if(!_0x5e850f)return null;_0x21c6f9[_0x45be('0x29')][_0x45be('0x83')]=_0x5e850f;return _0x21c6f9;})[_0x45be('0x21')](function(_0x1d7b90){if(_0x1d7b90){_0x1d7b90[_0x45be('0x29')][_0x45be('0x7b')]=util['format'](_0x45be('0x7c'),_0x16dce0['user']['name']);_0x1d7b90[_0x45be('0x29')][_0x45be('0x7d')]=_0x21c6f9[_0x45be('0x7d')];_0x1d7b90[_0x45be('0x29')][_0x45be('0x84')]=_0x45be('0x37');respondWithRpcPromise(_0x45be('0x7e'),_0x45be('0x7e'),{'event':_0x45be('0x85'),'message':_0x1d7b90[_0x45be('0x29')]},client9002);return _0x21c6f9;}return null;})['then'](respondWithResult(_0x2b0a71,null))[_0x45be('0x2b')](handleError(_0x2b0a71,null));};exports['status']=function(_0x4b388f,_0x9635d9,_0x5966f3){if(_0x4b388f[_0x45be('0x5b')]['id']){delete _0x4b388f['body']['id'];}var _0x242b07;return db['SmsMessage'][_0x45be('0x59')]({'where':{'id':_0x4b388f[_0x45be('0x57')]['id']}})[_0x45be('0x21')](handleEntityNotFound(_0x9635d9,null))['then'](function(_0x3ac855){if(_0x3ac855){_0x242b07=_0x3ac855;return db[_0x45be('0x86')][_0x45be('0x59')]({'where':{'id':_0x3ac855[_0x45be('0x87')]}});}})['then'](handleEntityNotFound(_0x9635d9,null))['then'](function(_0x4a43cf){if(_0x4a43cf){logger['debug'](_0x45be('0x26'),_0x45be('0x2d'),_0x45be('0x88'),_0x4a43cf[_0x45be('0x3f')],util['inspect'](_0x4b388f[_0x45be('0x5b')],{'showHidden':![],'depth':null}));switch(_0x4a43cf['type']){case _0x45be('0x89'):if(_0x4b388f['body'][_0x45be('0x8a')]&&_0x4b388f[_0x45be('0x5b')]['MessageSid']===_0x242b07[_0x45be('0x8b')]){return _0x242b07['update']({'read':!![]});}else{logger[_0x45be('0x27')](_0x45be('0x8c'),_0x45be('0x2d'),_0x45be('0x89'),util['inspect'](_0x4b388f[_0x45be('0x5b')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x4b388f['body'][_0x45be('0x8d')]&&_0x4b388f[_0x45be('0x5b')][_0x45be('0x8d')]===_0x242b07[_0x45be('0x8b')]&&_[_0x45be('0x8e')]([_0x45be('0x8f'),_0x45be('0x90')],_0x4b388f[_0x45be('0x5b')]['Status'])>=0x0){return _0x242b07[_0x45be('0x38')]({'read':!![]});}else{logger[_0x45be('0x27')](_0x45be('0x8c'),_0x45be('0x2d'),_0x45be('0x91'),util[_0x45be('0x92')](_0x4b388f[_0x45be('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x45be('0x93'):var _0x62ac3b=_0x4b388f['body'][_0x45be('0x94')][0x0];if(_0x62ac3b['status'][_0x45be('0x95')]===_0x45be('0x96')){return _0x242b07[_0x45be('0x38')]({'read':!![]});}else{logger[_0x45be('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x45be('0x2d'),'infobip',util['inspect'](_0x4b388f[_0x45be('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x242b07;}})[_0x45be('0x21')](respondWithResult(_0x9635d9,null))[_0x45be('0x2b')](handleError(_0x9635d9,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index fb2526a..bb833a5 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 _0x7fd2=['events','../../mysqldb','SmsMessage','setMaxListeners','update','emit','hook','exports'];(function(_0x22ad41,_0x502d5a){var _0x5d0c2b=function(_0x27112b){while(--_0x27112b){_0x22ad41['push'](_0x22ad41['shift']());}};_0x5d0c2b(++_0x502d5a);}(_0x7fd2,0x90));var _0x27fd=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x7fd2[_0x525c7b];return _0x27b33e;};'use strict';var EventEmitter=require(_0x27fd('0x0'));var SmsMessage=require(_0x27fd('0x1'))['db'][_0x27fd('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x27fd('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x27fd('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4a3c05){return function(_0x58ebfa,_0x4e9fc7,_0x47b04e){SmsMessageEvents['emit'](_0x4a3c05+':'+_0x58ebfa['id'],_0x58ebfa);SmsMessageEvents[_0x27fd('0x5')](_0x4a3c05,_0x58ebfa);_0x47b04e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x27fd('0x6')](e,emitEvent(event));}}module[_0x27fd('0x7')]=SmsMessageEvents; \ No newline at end of file +var _0x923f=['hasOwnProperty','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','emit'];(function(_0x39f34f,_0x298f45){var _0x59fee1=function(_0x6ebbb7){while(--_0x6ebbb7){_0x39f34f['push'](_0x39f34f['shift']());}};_0x59fee1(++_0x298f45);}(_0x923f,0xfe));var _0xf923=function(_0x20b36a,_0x1037d8){_0x20b36a=_0x20b36a-0x0;var _0x1deb43=_0x923f[_0x20b36a];return _0x1deb43;};'use strict';var EventEmitter=require(_0xf923('0x0'));var SmsMessage=require(_0xf923('0x1'))['db'][_0xf923('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xf923('0x3')](0x0);var events={'afterCreate':_0xf923('0x4'),'afterUpdate':_0xf923('0x5'),'afterDestroy':'remove'};function emitEvent(_0x70405d){return function(_0x5ea18d,_0x393bce,_0x556e80){SmsMessageEvents[_0xf923('0x6')](_0x70405d+':'+_0x5ea18d['id'],_0x5ea18d);SmsMessageEvents['emit'](_0x70405d,_0x5ea18d);_0x556e80(null);};}for(var e in events){if(events[_0xf923('0x7')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xf923('0x8')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 90888aa..d9a6550 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 _0x9063=['data','queued_count','head','message_id','clickSend','plivo','authId','/api/sms/messages/','/status?token=','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','csc','crypto','apiKey','text','timestamp','keys','length','createHash','digest','hex','signature=','/external/get/send.php?','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','UTF-8','apiMessageId','clickatell','bandwidth','accountId','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./smsMessage.attributes','exports','messageId','fti_sms_messages','FULLTEXT','models','get','direction','secret','isNil','findOne','SmsInteractionId','update','createdAt','toLowerCase','catch','error','out','SmsAccount','SmsAccountId','then','type','twilio','accountSid','authToken','messages','body','phone','remote','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby','https://api.skebby.it/API/v1.0/REST/','smsMethod','sender','login?username=','username','password','GET','sms','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','POST','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code'];(function(_0x5871a7,_0x2525b4){var _0x38aaa1=function(_0x233a33){while(--_0x233a33){_0x5871a7['push'](_0x5871a7['shift']());}};_0x38aaa1(++_0x2525b4);}(_0x9063,0x1a2));var _0x3906=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0x9063[_0x1b828b];return _0x98da1a;};'use strict';var _=require(_0x3906('0x0'));var util=require(_0x3906('0x1'));var logger=require(_0x3906('0x2'))(_0x3906('0x3'));var moment=require(_0x3906('0x4'));var BPromise=require(_0x3906('0x5'));var rp=require(_0x3906('0x6'));var fs=require('fs');var path=require(_0x3906('0x7'));var rimraf=require('rimraf');var config=require(_0x3906('0x8'));var attributes=require(_0x3906('0x9'));module[_0x3906('0xa')]=function(_0x17c286,_0x79d5ae){return _0x17c286['define']('SmsMessage',attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x3906('0xb'),'fields':[_0x3906('0xb')]},{'name':_0x3906('0xc'),'fields':['body'],'type':_0x3906('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x469456,_0x4f4b46,_0x3c8f45){var _0x3218bb=_0x17c286[_0x3906('0xe')];var _0x535705=_0x469456[_0x3906('0xf')]({'plain':!![]});if(_0x535705[_0x3906('0x10')]['toLowerCase']()==='in'||_0x535705[_0x3906('0x10')]['toLowerCase']()==='out'&&!_0x535705[_0x3906('0x11')]&&!_[_0x3906('0x12')](_0x535705['UserId'])){_0x3218bb['SmsInteraction'][_0x3906('0x13')]({'where':{'id':_0x535705[_0x3906('0x14')]}})['then'](function(_0x57d5e4){if(_0x57d5e4){_0x57d5e4[_0x3906('0x15')]({'lastMsgAt':_0x535705[_0x3906('0x16')],'lastMsgDirection':_0x535705[_0x3906('0x10')][_0x3906('0x17')]()});}})[_0x3906('0x18')](function(_0x7d7401){console[_0x3906('0x19')](_0x7d7401);});}if(_0x535705[_0x3906('0x10')]===_0x3906('0x1a')&&!_0x535705[_0x3906('0x11')]){var _0x5b28bc;_0x3218bb[_0x3906('0x1b')]['find']({'where':{'id':_0x535705[_0x3906('0x1c')]},'raw':!![]})[_0x3906('0x1d')](function(_0x4b4221){_0x5b28bc=_0x4b4221;if(_0x5b28bc&&_0x5b28bc[_0x3906('0x1e')]){switch(_0x5b28bc['type']){case _0x3906('0x1f'):var _0x2fc1a2=require(_0x3906('0x1f'));if(_0x5b28bc[_0x3906('0x20')]&&_0x5b28bc[_0x3906('0x21')]&&_0x5b28bc['phone']){var _0x1495bc=new _0x2fc1a2(_0x5b28bc[_0x3906('0x20')],_0x5b28bc[_0x3906('0x21')]);_0x1495bc[_0x3906('0x22')]['create']({'body':_0x535705[_0x3906('0x23')],'to':_0x535705[_0x3906('0x24')],'from':_0x5b28bc[_0x3906('0x24')],'statusCallback':_0x5b28bc[_0x3906('0x25')]+'/api/sms/messages/'+_0x535705['id']+'/status?token='+_0x5b28bc[_0x3906('0x26')]})[_0x3906('0x1d')](function(_0x343821){if(_0x343821[_0x3906('0x27')]){return _0x469456['update']({'messageId':_0x343821[_0x3906('0x27')]});}})[_0x3906('0x18')](function(_0x5a471c){logger['error'](_0x3906('0x28'),_0x3906('0x29'),_0x3906('0x1f'),util['inspect'](_0x5a471c,{'showHidden':![],'depth':null}));});}else{logger[_0x3906('0x19')](_0x3906('0x28'),_0x3906('0x29'),_0x3906('0x1f'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x3906('0x2a'):var _0x59d260=_0x3906('0x2b');if(_0x5b28bc['username']&&_0x5b28bc['password']){var _0x21f846={'recipient':[_0x535705[_0x3906('0x24')]],'message':_0x535705[_0x3906('0x23')],'message_type':_0x5b28bc['smsMethod']};if(_0x5b28bc['smsMethod']&&_0x5b28bc[_0x3906('0x2c')]!=='SI'){_0x21f846[_0x3906('0x2d')]=_0x5b28bc[_0x3906('0x24')];}var _0x3e2562={'url':_0x59d260+_0x3906('0x2e')+_0x5b28bc[_0x3906('0x2f')]+'&password='+_0x5b28bc[_0x3906('0x30')],'method':_0x3906('0x31')};rp(_0x3e2562)['then'](function(_0x50eaa0){var _0x191e30=_0x50eaa0['split'](';');var _0x409e21={'user_key':_0x191e30[0x0],'session_key':_0x191e30[0x1]};_0x3e2562={'url':_0x59d260+_0x3906('0x32'),'method':'POST','headers':{'user_key':_0x409e21[_0x3906('0x33')],'Session_key':_0x409e21[_0x3906('0x34')]},'json':!![],'body':_0x21f846};return rp(_0x3e2562);})[_0x3906('0x1d')](function(_0x84b262){if(_0x84b262[_0x3906('0x35')]>=0x1){var _0x3e7e6e={'messageId':_0x84b262[_0x3906('0x36')]};if(_0x5b28bc[_0x3906('0x2c')]!=='GP'||!_0x5b28bc[_0x3906('0x37')]){_0x3e7e6e[_0x3906('0x38')]=!![];}return _0x469456['update'](_0x3e7e6e);}else{return logger[_0x3906('0x19')](_0x3906('0x28'),_0x3906('0x29'),_0x3906('0x2a'),util['inspect'](_0x84b262,{'showHidden':![],'depth':null}));}})[_0x3906('0x18')](function(_0x153f51){return logger[_0x3906('0x19')](_0x3906('0x28'),_0x3906('0x29'),_0x3906('0x2a'),util[_0x3906('0x39')](_0x153f51,{'showHidden':![],'depth':null}));});}else{logger[_0x3906('0x19')](_0x3906('0x28'),_0x3906('0x29'),_0x3906('0x2a'),_0x3906('0x3a'));}break;case _0x3906('0x3b'):if(_0x5b28bc[_0x3906('0x21')]){var _0x54b569={'recipient':_0x535705['phone'],'message':_0x535705[_0x3906('0x23')],'sender':_0x5b28bc[_0x3906('0x3c')]||_0x5b28bc['phone'],'authorization':_0x5b28bc[_0x3906('0x21')]};var _0x4f4b46={'method':'POST','uri':_0x3906('0x3d'),'body':_0x54b569,'json':!![]};rp(_0x4f4b46)[_0x3906('0x1d')](function(_0x2e3def){var _0x5d0489={'messageId':_0x2e3def[_0x3906('0x3e')]};if(!_0x5b28bc['deliveryReport']){_0x5d0489[_0x3906('0x38')]=!![];}return _0x469456['update'](_0x5d0489);})[_0x3906('0x18')](function(_0x4d4365){logger['error'](_0x3906('0x28'),_0x3906('0x29'),_0x3906('0x3b'),util[_0x3906('0x39')](_0x4d4365,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x3906('0x28'),_0x3906('0x29'),_0x3906('0x3b'),_0x3906('0x3f'));}break;case _0x3906('0x40'):if(_0x5b28bc['username']&&_0x5b28bc[_0x3906('0x30')]){var _0x54b569={'messages':[{'source':_0x3906('0x41'),'to':_0x535705[_0x3906('0x24')],'body':_0x535705['body'],'from':_0x5b28bc['senderString']||_0x5b28bc[_0x3906('0x24')]}]};var _0x196757=util[_0x3906('0x42')](_0x3906('0x43'),_0x5b28bc[_0x3906('0x2f')],_0x5b28bc[_0x3906('0x30')]);var _0x4f4b46={'method':_0x3906('0x44'),'uri':_0x3906('0x45'),'body':_0x54b569,'headers':{'Authorization':util[_0x3906('0x42')](_0x3906('0x46'),new Buffer(_0x196757)[_0x3906('0x47')](_0x3906('0x48')))},'json':!![]};rp(_0x4f4b46)[_0x3906('0x1d')](function(_0x38aacd){if(_0x38aacd[_0x3906('0x49')]>=0xc8&&_0x38aacd[_0x3906('0x49')]<=0xce){if(_0x38aacd[_0x3906('0x4a')]&&_0x38aacd['data'][_0x3906('0x4b')]>0x0){var _0x3e6e35=_[_0x3906('0x4c')](_0x38aacd['data']['messages']);var _0x3780cd={'messageId':_0x3e6e35[_0x3906('0x4d')]};if(!_0x5b28bc[_0x3906('0x37')]){_0x3780cd[_0x3906('0x38')]=!![];}return _0x469456[_0x3906('0x15')](_0x3780cd);}else{logger['error'](_0x3906('0x28'),'afterCreate',_0x3906('0x4e'),util[_0x3906('0x39')](_0x38aacd,{'showHidden':![],'depth':null}));}}else{logger[_0x3906('0x19')](_0x3906('0x28'),_0x3906('0x29'),_0x3906('0x4e'),util[_0x3906('0x39')](_0x38aacd,{'showHidden':![],'depth':null}));}})['catch'](function(_0xbea2bf){logger['error'](_0x3906('0x28'),'afterCreate',_0x3906('0x4e'),util[_0x3906('0x39')](_0xbea2bf,{'showHidden':![],'depth':null}));});}else{logger[_0x3906('0x19')](_0x3906('0x28'),'afterCreate',_0x3906('0x4e'),_0x3906('0x3a'));}break;case _0x3906('0x4f'):if(_0x5b28bc[_0x3906('0x50')]&&_0x5b28bc[_0x3906('0x21')]){var _0x54b569={'dst':_0x535705[_0x3906('0x24')],'text':_0x535705['body'],'src':_0x5b28bc['senderString']||_0x5b28bc[_0x3906('0x24')],'url':_0x5b28bc['remote']+_0x3906('0x51')+_0x535705['id']+_0x3906('0x52')+_0x5b28bc[_0x3906('0x26')]};var _0x196757=util[_0x3906('0x42')](_0x3906('0x43'),_0x5b28bc[_0x3906('0x50')],_0x5b28bc['authToken']);var _0x4f4b46={'method':_0x3906('0x44'),'uri':util[_0x3906('0x42')]('https://api.plivo.com/v1/Account/%s/Message/',_0x5b28bc[_0x3906('0x50')]),'body':_0x54b569,'headers':{'Authorization':util[_0x3906('0x42')](_0x3906('0x46'),new Buffer(_0x196757)[_0x3906('0x47')]('base64'))},'json':!![]};rp(_0x4f4b46)[_0x3906('0x1d')](function(_0x3883eb){var _0x3451d7={'messageId':_0x3883eb[_0x3906('0x53')][0x0]};return _0x469456[_0x3906('0x15')](_0x3451d7);})[_0x3906('0x18')](function(_0x181a4a){logger[_0x3906('0x19')](_0x3906('0x28'),_0x3906('0x29'),_0x3906('0x4f'),util[_0x3906('0x39')](_0x181a4a,{'showHidden':![],'depth':null}));});}else{logger[_0x3906('0x19')](_0x3906('0x28'),_0x3906('0x29'),_0x3906('0x4f'),_0x3906('0x54'));}break;case _0x3906('0x55'):if(_0x5b28bc['username']&&_0x5b28bc['password']){if(_0x5b28bc[_0x3906('0x56')]){var _0x530cf4={'method':_0x3906('0x44'),'uri':_0x5b28bc[_0x3906('0x56')]+_0x3906('0x57'),'body':{'username':_0x5b28bc['username'],'password':_0x5b28bc[_0x3906('0x30')]},'json':!![]};return rp(_0x530cf4)[_0x3906('0x1d')](function(_0x494962){var _0x311d0a={'method':_0x3906('0x44'),'uri':_0x5b28bc[_0x3906('0x56')]+_0x3906('0x58'),'body':{'messages':[{'from':_0x5b28bc['phone'],'destinations':[{'to':_0x535705[_0x3906('0x24')]}],'text':_0x535705[_0x3906('0x23')],'notifyUrl':_0x5b28bc[_0x3906('0x25')]+_0x3906('0x51')+_0x535705['id']+'/status?token='+_0x5b28bc[_0x3906('0x26')],'notifyContentType':_0x3906('0x59'),'callbackData':_0x5b28bc['phone']+';'+_0x535705[_0x3906('0x23')]}]},'headers':{'Authorization':_0x3906('0x5a')+_0x494962['token']},'json':!![]};return rp(_0x311d0a)['then'](function(_0x52ded9){if(_0x52ded9[_0x3906('0x22')]){var _0x544800={'messageId':_0x52ded9[_0x3906('0x22')][0x0][_0x3906('0xb')]};if(!_0x5b28bc[_0x3906('0x37')]){_0x544800['read']=!![];}return _0x469456[_0x3906('0x15')](_0x544800);}else{return logger['error'](_0x3906('0x28'),_0x3906('0x29'),_0x3906('0x55'),util['inspect'](_0x52ded9,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x50dab0){return logger[_0x3906('0x19')](_0x3906('0x28'),_0x3906('0x29'),_0x3906('0x55'),util['inspect'](_0x50dab0,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x3906('0x28'),_0x3906('0x29'),_0x3906('0x55'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x3906('0x19')](_0x3906('0x28'),_0x3906('0x29'),_0x3906('0x55'),_0x3906('0x3a'));}break;case _0x3906('0x5b'):var _0x2f8a9c=require(_0x3906('0x5c'));if(_0x5b28bc[_0x3906('0x5d')]){var _0x41c993={};_0x41c993['login']=_0x5b28bc['username'];_0x41c993[_0x3906('0x24')]=_0x535705[_0x3906('0x24')];_0x41c993[_0x3906('0x2d')]=_0x5b28bc[_0x3906('0x24')];_0x41c993[_0x3906('0x5e')]=_0x535705[_0x3906('0x23')];_0x41c993[_0x3906('0x5f')]=+new Date();var _0x494051='';var _0x161314='';var _0x5d9893=Object[_0x3906('0x60')](_0x41c993);_0x5d9893['sort']();for(var _0x2a0743=0x0;_0x2a0743<_0x5d9893[_0x3906('0x61')];_0x2a0743++){if(_0x494051!=''){_0x494051+='&';}_0x494051+=_0x5d9893[_0x2a0743]+'='+encodeURIComponent(_0x41c993[_0x5d9893[_0x2a0743]]);_0x161314+=_0x41c993[_0x5d9893[_0x2a0743]];}_0x161314+=_0x5b28bc['apiKey'];_0x161314=_0x2f8a9c[_0x3906('0x62')]('md5')[_0x3906('0x15')](_0x161314)[_0x3906('0x63')](_0x3906('0x64'));if(_0x494051!==''){_0x494051+='&';}_0x494051+=_0x3906('0x65')+_0x161314;var _0x3e2562={'method':_0x3906('0x31'),'uri':_0x5b28bc[_0x3906('0x56')]+_0x3906('0x66')+_0x494051,'json':!![]};return rp(_0x3e2562)['then'](function(_0x457571){var _0x4fc8a5=Object[_0x3906('0x60')](_0x457571);if(_0x457571[_0x4fc8a5[0x0]]['error']&&parseInt(_0x457571[_0x4fc8a5[0x0]][_0x3906('0x19')])===0x0){var _0x12133d={'messageId':_0x457571[_0x4fc8a5[0x0]]['id_sms']};if(!_0x5b28bc['deliveryReport']){_0x12133d['read']=!![];}return _0x469456['update'](_0x12133d);}else{return logger[_0x3906('0x19')](_0x3906('0x28'),'afterCreate','csc',util[_0x3906('0x39')](_0x457571[_0x3906('0x19')],{'showHidden':![],'depth':null}));}})[_0x3906('0x18')](function(_0x22faf1){return logger[_0x3906('0x19')](_0x3906('0x28'),_0x3906('0x29'),'csc',util['inspect'](_0x22faf1,{'showHidden':![],'depth':null}));});}else{logger[_0x3906('0x19')](_0x3906('0x28'),_0x3906('0x29'),'csc',_0x3906('0x67'));}break;case'clickatell':if(_0x5b28bc[_0x3906('0x5d')]){var _0x35ea5f={'method':'POST','uri':_0x3906('0x68'),'headers':{'Authorization':_0x5b28bc[_0x3906('0x5d')]},'body':{'content':_0x535705[_0x3906('0x23')],'to':[_0x535705[_0x3906('0x24')]],'from':_0x5b28bc[_0x3906('0x24')],'binary':![],'clientMessageId':'uuid','charset':_0x3906('0x69')},'json':!![]};rp(_0x35ea5f)['then'](function(_0x5cfef1){if(!_0x5cfef1[_0x3906('0x19')]){var _0x98afa9={'messageId':_0x5cfef1[_0x3906('0x22')][0x0][_0x3906('0x6a')]};if(!_0x5b28bc[_0x3906('0x37')]){_0x98afa9[_0x3906('0x38')]=!![];}return _0x469456[_0x3906('0x15')](_0x98afa9);}else{return logger[_0x3906('0x19')](_0x3906('0x28'),_0x3906('0x29'),_0x3906('0x6b'),util[_0x3906('0x39')](_0x5cfef1['error'],{'showHidden':![],'depth':null}));}})[_0x3906('0x18')](function(_0x6c682a){return logger[_0x3906('0x19')](_0x3906('0x28'),_0x3906('0x29'),_0x3906('0x6b'),util['inspect'](_0x6c682a,{'showHidden':![],'depth':null}));});}else{logger[_0x3906('0x19')](_0x3906('0x28'),'afterCreate',_0x3906('0x6b'),_0x3906('0x67'));}break;case _0x3906('0x6c'):if(_0x5b28bc['username']&&_0x5b28bc[_0x3906('0x30')]){var _0x196757=util[_0x3906('0x42')](_0x3906('0x43'),_0x5b28bc[_0x3906('0x2f')],_0x5b28bc[_0x3906('0x30')]);var _0x4f4b46={'method':'POST','uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x5b28bc[_0x3906('0x6d')]+'/messages','body':{'to':[_0x535705['phone']],'text':_0x535705[_0x3906('0x23')],'from':_0x5b28bc[_0x3906('0x24')],'applicationId':_0x5b28bc[_0x3906('0x6e')]},'headers':{'Authorization':util[_0x3906('0x42')](_0x3906('0x46'),new Buffer(_0x196757)[_0x3906('0x47')](_0x3906('0x48')))},'json':!![]};rp(_0x4f4b46)[_0x3906('0x1d')](function(_0x16838e){if(_0x16838e['id']){var _0x35a9a6={'messageId':_0x16838e['id']};return _0x469456[_0x3906('0x15')](_0x35a9a6);}else{logger[_0x3906('0x19')](_0x3906('0x28'),_0x3906('0x29'),_0x3906('0x6c'),util[_0x3906('0x39')](_0x16838e,{'showHidden':![],'depth':null}));}})[_0x3906('0x18')](function(_0x4b071f){logger[_0x3906('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3906('0x29'),_0x3906('0x6c'),util[_0x3906('0x39')](_0x4b071f,{'showHidden':![],'depth':null}));});}else{logger[_0x3906('0x19')](_0x3906('0x28'),_0x3906('0x29'),_0x3906('0x6c'),_0x3906('0x3a'));}break;case _0x3906('0x6f'):if(_0x5b28bc[_0x3906('0x5d')]){var _0x3f9d96={};var _0x3e2562={'method':'POST','uri':_0x3906('0x70'),'headers':{'Authorization':_0x3906('0x71')+_0x5b28bc[_0x3906('0x5d')],'Content-Type':_0x3906('0x59')},'body':{'from':_0x5b28bc['phone'],'to':_0x535705[_0x3906('0x24')],'text':_0x535705[_0x3906('0x23')]},'json':!![]};return rp(_0x3e2562)[_0x3906('0x1d')](function(_0x5bbbca){if(_0x5bbbca[_0x3906('0x72')]==0xca){_0x3f9d96[_0x3906('0x73')]=_0x5bbbca;var _0x2c8763={'method':_0x3906('0x44'),'uri':_0x3906('0x74'),'headers':{'Authorization':_0x3906('0x71')+_0x5b28bc[_0x3906('0x5d')],'Content-Type':_0x3906('0x59')},'body':{'refid':_0x3f9d96['message'][_0x3906('0x75')]},'json':!![]};return rp(_0x2c8763)[_0x3906('0x1d')](function(_0x2b4329){_0x3f9d96[_0x3906('0x76')]=_0x2b4329;var _0x241ad2={'messageId':_0x3f9d96[_0x3906('0x73')][_0x3906('0x75')],'read':!![]};return _0x469456[_0x3906('0x15')](_0x241ad2);});}else{return logger[_0x3906('0x19')](_0x3906('0x28'),_0x3906('0x29'),_0x3906('0x6f'),util[_0x3906('0x39')](_0x5bbbca,{'showHidden':![],'depth':null}));}})[_0x3906('0x18')](function(_0x16cce3){return logger[_0x3906('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3906('0x29'),_0x3906('0x6f'),util['inspect'](_0x16cce3,{'showHidden':![],'depth':null}));});}else{return logger[_0x3906('0x19')](_0x3906('0x28'),'afterCreate',_0x3906('0x6f'),_0x3906('0x77'));}break;}}})[_0x3906('0x78')](function(){_0x3c8f45();});}else{_0x3c8f45();}}},'charset':_0x3906('0x79'),'collate':_0x3906('0x7a')});}; \ No newline at end of file +var _0x3098=['message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','sms_messages','messageId','fti_sms_messages','models','get','direction','toLowerCase','secret','UserId','findOne','SmsInteractionId','then','update','createdAt','error','out','SmsAccount','find','type','twilio','accountSid','authToken','phone','create','body','remote','/api/sms/messages/','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','sender','username','&password=','GET','sms','POST','user_key','session_key','read','afterCreate','catch','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','queued_count','head','data','messages','message_id','deliveryReport','clickSend','plivo','authId','/status?token=','https://api.plivo.com/v1/Account/%s/Message/','base64','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','application/json','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','crypto','apiKey','login','createHash','md5','digest','hex','signature=','/external/get/send.php?','keys','id_sms','csc','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','apiMessageId','bandwidth','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code'];(function(_0x54ce4a,_0x502cba){var _0x279dce=function(_0x217ed8){while(--_0x217ed8){_0x54ce4a['push'](_0x54ce4a['shift']());}};_0x279dce(++_0x502cba);}(_0x3098,0x86));var _0x8309=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x3098[_0x2f3848];return _0x102668;};'use strict';var _=require(_0x8309('0x0'));var util=require(_0x8309('0x1'));var logger=require(_0x8309('0x2'))(_0x8309('0x3'));var moment=require('moment');var BPromise=require(_0x8309('0x4'));var rp=require(_0x8309('0x5'));var fs=require('fs');var path=require(_0x8309('0x6'));var rimraf=require(_0x8309('0x7'));var config=require(_0x8309('0x8'));var attributes=require(_0x8309('0x9'));module[_0x8309('0xa')]=function(_0x2ddf0b,_0x2aa50b){return _0x2ddf0b[_0x8309('0xb')]('SmsMessage',attributes,{'tableName':_0x8309('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x8309('0xd')]},{'name':_0x8309('0xe'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x13a19f,_0x21b2f1,_0x12d5c9){var _0x302195=_0x2ddf0b[_0x8309('0xf')];var _0x55c201=_0x13a19f[_0x8309('0x10')]({'plain':!![]});if(_0x55c201[_0x8309('0x11')][_0x8309('0x12')]()==='in'||_0x55c201[_0x8309('0x11')][_0x8309('0x12')]()==='out'&&!_0x55c201[_0x8309('0x13')]&&!_['isNil'](_0x55c201[_0x8309('0x14')])){_0x302195['SmsInteraction'][_0x8309('0x15')]({'where':{'id':_0x55c201[_0x8309('0x16')]}})[_0x8309('0x17')](function(_0x264867){if(_0x264867){_0x264867[_0x8309('0x18')]({'lastMsgAt':_0x55c201[_0x8309('0x19')],'lastMsgDirection':_0x55c201[_0x8309('0x11')]['toLowerCase']()});}})['catch'](function(_0x2aefda){console[_0x8309('0x1a')](_0x2aefda);});}if(_0x55c201[_0x8309('0x11')]===_0x8309('0x1b')&&!_0x55c201[_0x8309('0x13')]){var _0x28bfec;_0x302195[_0x8309('0x1c')][_0x8309('0x1d')]({'where':{'id':_0x55c201['SmsAccountId']},'raw':!![]})[_0x8309('0x17')](function(_0x475030){_0x28bfec=_0x475030;if(_0x28bfec&&_0x28bfec[_0x8309('0x1e')]){switch(_0x28bfec[_0x8309('0x1e')]){case _0x8309('0x1f'):var _0x3a3bd5=require(_0x8309('0x1f'));if(_0x28bfec[_0x8309('0x20')]&&_0x28bfec[_0x8309('0x21')]&&_0x28bfec[_0x8309('0x22')]){var _0x3dc639=new _0x3a3bd5(_0x28bfec[_0x8309('0x20')],_0x28bfec['authToken']);_0x3dc639['messages'][_0x8309('0x23')]({'body':_0x55c201[_0x8309('0x24')],'to':_0x55c201[_0x8309('0x22')],'from':_0x28bfec[_0x8309('0x22')],'statusCallback':_0x28bfec[_0x8309('0x25')]+_0x8309('0x26')+_0x55c201['id']+'/status?token='+_0x28bfec[_0x8309('0x27')]})[_0x8309('0x17')](function(_0x3599da){if(_0x3599da['sid']){return _0x13a19f[_0x8309('0x18')]({'messageId':_0x3599da[_0x8309('0x28')]});}})['catch'](function(_0x166902){logger['error'](_0x8309('0x29'),'afterCreate',_0x8309('0x1f'),util[_0x8309('0x2a')](_0x166902,{'showHidden':![],'depth':null}));});}else{logger[_0x8309('0x1a')](_0x8309('0x29'),'afterCreate',_0x8309('0x1f'),_0x8309('0x2b'));}break;case _0x8309('0x2c'):var _0x5f2f68=_0x8309('0x2d');if(_0x28bfec['username']&&_0x28bfec[_0x8309('0x2e')]){var _0x417942={'recipient':[_0x55c201[_0x8309('0x22')]],'message':_0x55c201[_0x8309('0x24')],'message_type':_0x28bfec[_0x8309('0x2f')]};if(_0x28bfec[_0x8309('0x2f')]&&_0x28bfec[_0x8309('0x2f')]!=='SI'){_0x417942[_0x8309('0x30')]=_0x28bfec[_0x8309('0x22')];}var _0x2ee67b={'url':_0x5f2f68+'login?username='+_0x28bfec[_0x8309('0x31')]+_0x8309('0x32')+_0x28bfec[_0x8309('0x2e')],'method':_0x8309('0x33')};rp(_0x2ee67b)[_0x8309('0x17')](function(_0x379776){var _0x421918=_0x379776['split'](';');var _0x44dd9a={'user_key':_0x421918[0x0],'session_key':_0x421918[0x1]};_0x2ee67b={'url':_0x5f2f68+_0x8309('0x34'),'method':_0x8309('0x35'),'headers':{'user_key':_0x44dd9a[_0x8309('0x36')],'Session_key':_0x44dd9a[_0x8309('0x37')]},'json':!![],'body':_0x417942};return rp(_0x2ee67b);})[_0x8309('0x17')](function(_0x18be73){if(_0x18be73['total_sent']>=0x1){var _0x4ef390={'messageId':_0x18be73['internal_order_id']};if(_0x28bfec['smsMethod']!=='GP'||!_0x28bfec['deliveryReport']){_0x4ef390[_0x8309('0x38')]=!![];}return _0x13a19f[_0x8309('0x18')](_0x4ef390);}else{return logger[_0x8309('0x1a')](_0x8309('0x29'),_0x8309('0x39'),'skebby',util[_0x8309('0x2a')](_0x18be73,{'showHidden':![],'depth':null}));}})[_0x8309('0x3a')](function(_0x51e4bf){return logger[_0x8309('0x1a')](_0x8309('0x29'),_0x8309('0x39'),_0x8309('0x2c'),util[_0x8309('0x2a')](_0x51e4bf,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8309('0x39'),'skebby',_0x8309('0x3b'));}break;case _0x8309('0x3c'):if(_0x28bfec[_0x8309('0x21')]){var _0x54b4be={'recipient':_0x55c201[_0x8309('0x22')],'message':_0x55c201['body'],'sender':_0x28bfec[_0x8309('0x3d')]||_0x28bfec[_0x8309('0x22')],'authorization':_0x28bfec[_0x8309('0x21')]};var _0x21b2f1={'method':_0x8309('0x35'),'uri':_0x8309('0x3e'),'body':_0x54b4be,'json':!![]};rp(_0x21b2f1)[_0x8309('0x17')](function(_0x1991a3){var _0x2719d9={'messageId':_0x1991a3[_0x8309('0x3f')]};if(!_0x28bfec['deliveryReport']){_0x2719d9[_0x8309('0x38')]=!![];}return _0x13a19f[_0x8309('0x18')](_0x2719d9);})[_0x8309('0x3a')](function(_0x2b5d52){logger['error'](_0x8309('0x29'),'afterCreate',_0x8309('0x3c'),util[_0x8309('0x2a')](_0x2b5d52,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x8309('0x29'),_0x8309('0x39'),_0x8309('0x3c'),_0x8309('0x40'));}break;case _0x8309('0x41'):if(_0x28bfec[_0x8309('0x31')]&&_0x28bfec[_0x8309('0x2e')]){var _0x54b4be={'messages':[{'source':_0x8309('0x42'),'to':_0x55c201[_0x8309('0x22')],'body':_0x55c201[_0x8309('0x24')],'from':_0x28bfec['senderString']||_0x28bfec[_0x8309('0x22')]}]};var _0x417433=util[_0x8309('0x43')](_0x8309('0x44'),_0x28bfec['username'],_0x28bfec[_0x8309('0x2e')]);var _0x21b2f1={'method':_0x8309('0x35'),'uri':_0x8309('0x45'),'body':_0x54b4be,'headers':{'Authorization':util['format'](_0x8309('0x46'),new Buffer(_0x417433)[_0x8309('0x47')]('base64'))},'json':!![]};rp(_0x21b2f1)['then'](function(_0x5c8b0a){if(_0x5c8b0a[_0x8309('0x48')]>=0xc8&&_0x5c8b0a[_0x8309('0x48')]<=0xce){if(_0x5c8b0a['data']&&_0x5c8b0a['data'][_0x8309('0x49')]>0x0){var _0x10813a=_[_0x8309('0x4a')](_0x5c8b0a[_0x8309('0x4b')][_0x8309('0x4c')]);var _0x2b0eac={'messageId':_0x10813a[_0x8309('0x4d')]};if(!_0x28bfec[_0x8309('0x4e')]){_0x2b0eac[_0x8309('0x38')]=!![];}return _0x13a19f[_0x8309('0x18')](_0x2b0eac);}else{logger[_0x8309('0x1a')](_0x8309('0x29'),'afterCreate',_0x8309('0x4f'),util[_0x8309('0x2a')](_0x5c8b0a,{'showHidden':![],'depth':null}));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8309('0x39'),_0x8309('0x4f'),util[_0x8309('0x2a')](_0x5c8b0a,{'showHidden':![],'depth':null}));}})['catch'](function(_0x5e9e2a){logger[_0x8309('0x1a')](_0x8309('0x29'),_0x8309('0x39'),_0x8309('0x4f'),util[_0x8309('0x2a')](_0x5e9e2a,{'showHidden':![],'depth':null}));});}else{logger[_0x8309('0x1a')](_0x8309('0x29'),_0x8309('0x39'),_0x8309('0x4f'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x8309('0x50'):if(_0x28bfec[_0x8309('0x51')]&&_0x28bfec[_0x8309('0x21')]){var _0x54b4be={'dst':_0x55c201[_0x8309('0x22')],'text':_0x55c201[_0x8309('0x24')],'src':_0x28bfec['senderString']||_0x28bfec[_0x8309('0x22')],'url':_0x28bfec[_0x8309('0x25')]+_0x8309('0x26')+_0x55c201['id']+_0x8309('0x52')+_0x28bfec[_0x8309('0x27')]};var _0x417433=util[_0x8309('0x43')](_0x8309('0x44'),_0x28bfec[_0x8309('0x51')],_0x28bfec[_0x8309('0x21')]);var _0x21b2f1={'method':_0x8309('0x35'),'uri':util[_0x8309('0x43')](_0x8309('0x53'),_0x28bfec['authId']),'body':_0x54b4be,'headers':{'Authorization':util[_0x8309('0x43')](_0x8309('0x46'),new Buffer(_0x417433)[_0x8309('0x47')](_0x8309('0x54')))},'json':!![]};rp(_0x21b2f1)[_0x8309('0x17')](function(_0x5f8860){var _0x4c25cf={'messageId':_0x5f8860[_0x8309('0x55')][0x0]};return _0x13a19f['update'](_0x4c25cf);})['catch'](function(_0x2975fe){logger[_0x8309('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8309('0x39'),_0x8309('0x50'),util[_0x8309('0x2a')](_0x2975fe,{'showHidden':![],'depth':null}));});}else{logger[_0x8309('0x1a')](_0x8309('0x29'),_0x8309('0x39'),_0x8309('0x50'),_0x8309('0x56'));}break;case'infobip':if(_0x28bfec[_0x8309('0x31')]&&_0x28bfec[_0x8309('0x2e')]){if(_0x28bfec[_0x8309('0x57')]){var _0x5c2b01={'method':_0x8309('0x35'),'uri':_0x28bfec[_0x8309('0x57')]+_0x8309('0x58'),'body':{'username':_0x28bfec['username'],'password':_0x28bfec[_0x8309('0x2e')]},'json':!![]};return rp(_0x5c2b01)['then'](function(_0x464118){var _0x2012db={'method':_0x8309('0x35'),'uri':_0x28bfec['baseUrl']+'/sms/2/text/advanced','body':{'messages':[{'from':_0x28bfec[_0x8309('0x22')],'destinations':[{'to':_0x55c201['phone']}],'text':_0x55c201['body'],'notifyUrl':_0x28bfec[_0x8309('0x25')]+'/api/sms/messages/'+_0x55c201['id']+_0x8309('0x52')+_0x28bfec[_0x8309('0x27')],'notifyContentType':_0x8309('0x59'),'callbackData':_0x28bfec[_0x8309('0x22')]+';'+_0x55c201[_0x8309('0x24')]}]},'headers':{'Authorization':_0x8309('0x5a')+_0x464118[_0x8309('0x27')]},'json':!![]};return rp(_0x2012db)[_0x8309('0x17')](function(_0x5d8ce9){if(_0x5d8ce9[_0x8309('0x4c')]){var _0x1d3414={'messageId':_0x5d8ce9['messages'][0x0][_0x8309('0xd')]};if(!_0x28bfec['deliveryReport']){_0x1d3414[_0x8309('0x38')]=!![];}return _0x13a19f['update'](_0x1d3414);}else{return logger[_0x8309('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','infobip',util['inspect'](_0x5d8ce9,{'showHidden':![],'depth':null}));}});})[_0x8309('0x3a')](function(_0x368947){return logger['error'](_0x8309('0x29'),_0x8309('0x39'),_0x8309('0x5b'),util[_0x8309('0x2a')](_0x368947,{'showHidden':![],'depth':null}));});}else{logger[_0x8309('0x1a')](_0x8309('0x29'),'afterCreate',_0x8309('0x5b'),_0x8309('0x5c'));}}else{logger[_0x8309('0x1a')](_0x8309('0x29'),_0x8309('0x39'),_0x8309('0x5b'),_0x8309('0x3b'));}break;case'csc':var _0x2c1772=require(_0x8309('0x5d'));if(_0x28bfec[_0x8309('0x5e')]){var _0x46897c={};_0x46897c[_0x8309('0x5f')]=_0x28bfec[_0x8309('0x31')];_0x46897c[_0x8309('0x22')]=_0x55c201[_0x8309('0x22')];_0x46897c[_0x8309('0x30')]=_0x28bfec['phone'];_0x46897c['text']=_0x55c201[_0x8309('0x24')];_0x46897c['timestamp']=+new Date();var _0x539e78='';var _0x2211f0='';var _0x53a28e=Object['keys'](_0x46897c);_0x53a28e['sort']();for(var _0x4c8784=0x0;_0x4c8784<_0x53a28e['length'];_0x4c8784++){if(_0x539e78!=''){_0x539e78+='&';}_0x539e78+=_0x53a28e[_0x4c8784]+'='+encodeURIComponent(_0x46897c[_0x53a28e[_0x4c8784]]);_0x2211f0+=_0x46897c[_0x53a28e[_0x4c8784]];}_0x2211f0+=_0x28bfec[_0x8309('0x5e')];_0x2211f0=_0x2c1772[_0x8309('0x60')](_0x8309('0x61'))[_0x8309('0x18')](_0x2211f0)[_0x8309('0x62')](_0x8309('0x63'));if(_0x539e78!==''){_0x539e78+='&';}_0x539e78+=_0x8309('0x64')+_0x2211f0;var _0x2ee67b={'method':_0x8309('0x33'),'uri':_0x28bfec[_0x8309('0x57')]+_0x8309('0x65')+_0x539e78,'json':!![]};return rp(_0x2ee67b)['then'](function(_0x2da238){var _0x31d998=Object[_0x8309('0x66')](_0x2da238);if(_0x2da238[_0x31d998[0x0]][_0x8309('0x1a')]&&parseInt(_0x2da238[_0x31d998[0x0]][_0x8309('0x1a')])===0x0){var _0x18e73e={'messageId':_0x2da238[_0x31d998[0x0]][_0x8309('0x67')]};if(!_0x28bfec[_0x8309('0x4e')]){_0x18e73e[_0x8309('0x38')]=!![];}return _0x13a19f['update'](_0x18e73e);}else{return logger[_0x8309('0x1a')](_0x8309('0x29'),_0x8309('0x39'),_0x8309('0x68'),util[_0x8309('0x2a')](_0x2da238[_0x8309('0x1a')],{'showHidden':![],'depth':null}));}})[_0x8309('0x3a')](function(_0x46f405){return logger[_0x8309('0x1a')](_0x8309('0x29'),_0x8309('0x39'),'csc',util[_0x8309('0x2a')](_0x46f405,{'showHidden':![],'depth':null}));});}else{logger[_0x8309('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8309('0x39'),'csc',_0x8309('0x69'));}break;case _0x8309('0x6a'):if(_0x28bfec[_0x8309('0x5e')]){var _0x356255={'method':_0x8309('0x35'),'uri':_0x8309('0x6b'),'headers':{'Authorization':_0x28bfec['apiKey']},'body':{'content':_0x55c201['body'],'to':[_0x55c201[_0x8309('0x22')]],'from':_0x28bfec[_0x8309('0x22')],'binary':![],'clientMessageId':_0x8309('0x6c'),'charset':'UTF-8'},'json':!![]};rp(_0x356255)[_0x8309('0x17')](function(_0x20c5b2){if(!_0x20c5b2[_0x8309('0x1a')]){var _0x32b9b2={'messageId':_0x20c5b2[_0x8309('0x4c')][0x0][_0x8309('0x6d')]};if(!_0x28bfec[_0x8309('0x4e')]){_0x32b9b2[_0x8309('0x38')]=!![];}return _0x13a19f[_0x8309('0x18')](_0x32b9b2);}else{return logger[_0x8309('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x8309('0x6a'),util[_0x8309('0x2a')](_0x20c5b2[_0x8309('0x1a')],{'showHidden':![],'depth':null}));}})[_0x8309('0x3a')](function(_0x305cb7){return logger['error'](_0x8309('0x29'),_0x8309('0x39'),_0x8309('0x6a'),util[_0x8309('0x2a')](_0x305cb7,{'showHidden':![],'depth':null}));});}else{logger[_0x8309('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x8309('0x6a'),_0x8309('0x69'));}break;case _0x8309('0x6e'):if(_0x28bfec['username']&&_0x28bfec[_0x8309('0x2e')]){var _0x417433=util[_0x8309('0x43')](_0x8309('0x44'),_0x28bfec[_0x8309('0x31')],_0x28bfec[_0x8309('0x2e')]);var _0x21b2f1={'method':_0x8309('0x35'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x28bfec[_0x8309('0x6f')]+_0x8309('0x70'),'body':{'to':[_0x55c201[_0x8309('0x22')]],'text':_0x55c201[_0x8309('0x24')],'from':_0x28bfec[_0x8309('0x22')],'applicationId':_0x28bfec[_0x8309('0x71')]},'headers':{'Authorization':util[_0x8309('0x43')]('Basic\x20%s',new Buffer(_0x417433)['toString'](_0x8309('0x54')))},'json':!![]};rp(_0x21b2f1)[_0x8309('0x17')](function(_0xdd84aa){if(_0xdd84aa['id']){var _0x20f954={'messageId':_0xdd84aa['id']};return _0x13a19f[_0x8309('0x18')](_0x20f954);}else{logger['error'](_0x8309('0x29'),_0x8309('0x39'),_0x8309('0x6e'),util['inspect'](_0xdd84aa,{'showHidden':![],'depth':null}));}})[_0x8309('0x3a')](function(_0x42a30a){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x8309('0x6e'),util[_0x8309('0x2a')](_0x42a30a,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x8309('0x29'),'afterCreate','bandwidth',_0x8309('0x3b'));}break;case _0x8309('0x72'):if(_0x28bfec['apiKey']){var _0x2f1af8={};var _0x2ee67b={'method':_0x8309('0x35'),'uri':_0x8309('0x73'),'headers':{'Authorization':_0x8309('0x74')+_0x28bfec[_0x8309('0x5e')],'Content-Type':_0x8309('0x59')},'body':{'from':_0x28bfec[_0x8309('0x22')],'to':_0x55c201[_0x8309('0x22')],'text':_0x55c201[_0x8309('0x24')]},'json':!![]};return rp(_0x2ee67b)[_0x8309('0x17')](function(_0xeb53d9){if(_0xeb53d9[_0x8309('0x75')]==0xca){_0x2f1af8[_0x8309('0x76')]=_0xeb53d9;var _0x46aa56={'method':_0x8309('0x35'),'uri':_0x8309('0x77'),'headers':{'Authorization':'Bearer\x20'+_0x28bfec['apiKey'],'Content-Type':_0x8309('0x59')},'body':{'refid':_0x2f1af8[_0x8309('0x76')][_0x8309('0x78')]},'json':!![]};return rp(_0x46aa56)['then'](function(_0x48c563){_0x2f1af8[_0x8309('0x79')]=_0x48c563;var _0x41d8a1={'messageId':_0x2f1af8[_0x8309('0x76')][_0x8309('0x78')],'read':!![]};return _0x13a19f[_0x8309('0x18')](_0x41d8a1);});}else{return logger[_0x8309('0x1a')](_0x8309('0x29'),_0x8309('0x39'),_0x8309('0x72'),util[_0x8309('0x2a')](_0xeb53d9,{'showHidden':![],'depth':null}));}})[_0x8309('0x3a')](function(_0x11b346){return logger[_0x8309('0x1a')](_0x8309('0x29'),_0x8309('0x39'),'intelepeer',util[_0x8309('0x2a')](_0x11b346,{'showHidden':![],'depth':null}));});}else{return logger[_0x8309('0x1a')](_0x8309('0x29'),_0x8309('0x39'),_0x8309('0x72'),_0x8309('0x7a'));}break;}}})[_0x8309('0x7b')](function(){_0x12d5c9();});}else{_0x12d5c9();}}},'charset':_0x8309('0x7c'),'collate':_0x8309('0x7d')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 17ac9f5..fd47e61 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 _0xfefc=['ioredis','../../config/utils','rpc','../../config/environment','client','http','defaults','redis','localhost','./smsMessage.socket','register','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','info','stringify','lodash','bluebird','randomstring'];(function(_0x5c720a,_0xe7bf7e){var _0x126186=function(_0xcddb40){while(--_0xcddb40){_0x5c720a['push'](_0x5c720a['shift']());}};_0x126186(++_0xe7bf7e);}(_0xfefc,0x15d));var _0xcfef=function(_0x2bc678,_0x4bb174){_0x2bc678=_0x2bc678-0x0;var _0x1844e8=_0xfefc[_0x2bc678];return _0x1844e8;};'use strict';var _=require(_0xcfef('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcfef('0x1'));var rs=require(_0xcfef('0x2'));var fs=require('fs');var Redis=require(_0xcfef('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcfef('0x4'));var logger=require('../../config/logger')(_0xcfef('0x5'));var config=require(_0xcfef('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xcfef('0x7')][_0xcfef('0x8')]({'port':0x232a});config['redis']=_[_0xcfef('0x9')](config[_0xcfef('0xa')],{'host':_0xcfef('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcfef('0xa')]));require(_0xcfef('0xc'))[_0xcfef('0xd')](socket);function respondWithRpcPromise(_0x87b637,_0x43c125,_0x52cc8e){return new BPromise(function(_0x565d86,_0x4e1c7c){return client['request'](_0x87b637,_0x52cc8e)[_0xcfef('0xe')](function(_0x7e0957){logger['info'](_0xcfef('0xf'),_0x43c125,_0xcfef('0x10'));logger[_0xcfef('0x11')](_0xcfef('0x12'),_0x43c125,_0xcfef('0x10'),JSON['stringify'](_0x7e0957));if(_0x7e0957[_0xcfef('0x13')]){if(_0x7e0957[_0xcfef('0x13')][_0xcfef('0x14')]===0x1f4){logger[_0xcfef('0x13')](_0xcfef('0xf'),_0x43c125,_0x7e0957['error'][_0xcfef('0x15')]);return _0x4e1c7c(_0x7e0957[_0xcfef('0x13')]['message']);}logger[_0xcfef('0x13')](_0xcfef('0xf'),_0x43c125,_0x7e0957[_0xcfef('0x13')][_0xcfef('0x15')]);return _0x565d86(_0x7e0957[_0xcfef('0x13')][_0xcfef('0x15')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x43c125,'request\x20sent');_0x565d86(_0x7e0957[_0xcfef('0x16')][_0xcfef('0x15')]);}})[_0xcfef('0x17')](function(_0x518eac){logger[_0xcfef('0x13')](_0xcfef('0xf'),_0x43c125,_0x518eac);_0x4e1c7c(_0x518eac);});});}exports[_0xcfef('0x18')]=function(_0x56c248){var _0x57b606=this;return new Promise(function(_0x99440d,_0x579cef){return db[_0xcfef('0x19')][_0xcfef('0x1a')](_0x56c248[_0xcfef('0x1b')],{'raw':_0x56c248['options']?_0x56c248[_0xcfef('0x1c')][_0xcfef('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x547edc){logger[_0xcfef('0x1e')](_0xcfef('0x18'),_0x56c248);logger['debug']('CreateSmsMessage',_0x56c248,JSON[_0xcfef('0x1f')](_0x547edc));_0x99440d(_0x547edc);})[_0xcfef('0x17')](function(_0x57d969){logger['error'](_0xcfef('0x18'),_0x57d969[_0xcfef('0x15')],_0x56c248);_0x579cef(_0x57b606[_0xcfef('0x13')](0x1f4,_0x57d969[_0xcfef('0x15')]));});});}; \ No newline at end of file +var _0x1b59=['then','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','request','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateSmsMessage','SmsMessage','create','options','raw'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1b59,0x156));var _0x91b5=function(_0x22808b,_0x329b6a){_0x22808b=_0x22808b-0x0;var _0x42cbd2=_0x1b59[_0x22808b];return _0x42cbd2;};'use strict';var _=require(_0x91b5('0x0'));var util=require(_0x91b5('0x1'));var moment=require(_0x91b5('0x2'));var BPromise=require('bluebird');var rs=require(_0x91b5('0x3'));var fs=require('fs');var Redis=require(_0x91b5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91b5('0x5'));var logger=require(_0x91b5('0x6'))(_0x91b5('0x7'));var config=require(_0x91b5('0x8'));var jayson=require(_0x91b5('0x9'));var client=jayson['client'][_0x91b5('0xa')]({'port':0x232a});config[_0x91b5('0xb')]=_[_0x91b5('0xc')](config[_0x91b5('0xb')],{'host':_0x91b5('0xd'),'port':0x18eb});var socket=require(_0x91b5('0xe'))(new Redis(config[_0x91b5('0xb')]));require(_0x91b5('0xf'))['register'](socket);function respondWithRpcPromise(_0x499486,_0xb9ca69,_0x29b76c){return new BPromise(function(_0x384279,_0x2e413f){return client[_0x91b5('0x10')](_0x499486,_0x29b76c)['then'](function(_0x2d5bed){logger[_0x91b5('0x11')](_0x91b5('0x12'),_0xb9ca69,'request\x20sent');logger[_0x91b5('0x13')](_0x91b5('0x14'),_0xb9ca69,_0x91b5('0x15'),JSON[_0x91b5('0x16')](_0x2d5bed));if(_0x2d5bed['error']){if(_0x2d5bed[_0x91b5('0x17')][_0x91b5('0x18')]===0x1f4){logger['error'](_0x91b5('0x12'),_0xb9ca69,_0x2d5bed['error'][_0x91b5('0x19')]);return _0x2e413f(_0x2d5bed['error'][_0x91b5('0x19')]);}logger['error'](_0x91b5('0x12'),_0xb9ca69,_0x2d5bed[_0x91b5('0x17')]['message']);return _0x384279(_0x2d5bed[_0x91b5('0x17')][_0x91b5('0x19')]);}else{logger[_0x91b5('0x11')]('SmsMessage,\x20%s,\x20%s',_0xb9ca69,_0x91b5('0x15'));_0x384279(_0x2d5bed[_0x91b5('0x1a')][_0x91b5('0x19')]);}})['catch'](function(_0x4e1789){logger[_0x91b5('0x17')](_0x91b5('0x12'),_0xb9ca69,_0x4e1789);_0x2e413f(_0x4e1789);});});}exports[_0x91b5('0x1b')]=function(_0x1eab2b){var _0x3e5fba=this;return new Promise(function(_0x10a373,_0x48dba0){return db[_0x91b5('0x1c')][_0x91b5('0x1d')](_0x1eab2b['body'],{'raw':_0x1eab2b['options']?_0x1eab2b[_0x91b5('0x1e')][_0x91b5('0x1f')]===undefined?!![]:![]:!![]})[_0x91b5('0x20')](function(_0x2bb766){logger[_0x91b5('0x11')](_0x91b5('0x1b'),_0x1eab2b);logger['debug'](_0x91b5('0x1b'),_0x1eab2b,JSON[_0x91b5('0x16')](_0x2bb766));_0x10a373(_0x2bb766);})[_0x91b5('0x21')](function(_0x598293){logger[_0x91b5('0x17')](_0x91b5('0x1b'),_0x598293['message'],_0x1eab2b);_0x48dba0(_0x3e5fba[_0x91b5('0x17')](0x1f4,_0x598293['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 54de1a9..d9a4a03 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 _0xf652=['length','./smsMessage.events','save','remove','emit','removeListener'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xf652,0x67));var _0x2f65=function(_0xa08b52,_0x166a59){_0xa08b52=_0xa08b52-0x0;var _0x311035=_0xf652[_0xa08b52];return _0x311035;};'use strict';var SmsMessageEvents=require(_0x2f65('0x0'));var events=[_0x2f65('0x1'),_0x2f65('0x2'),'update'];function createListener(_0x4b8aad,_0xde4934){return function(_0x9bdff9){_0xde4934[_0x2f65('0x3')](_0x4b8aad,_0x9bdff9);};}function removeListener(_0x56cebc,_0x5e5baa){return function(){SmsMessageEvents[_0x2f65('0x4')](_0x56cebc,_0x5e5baa);};}exports['register']=function(_0x1dda08){for(var _0x2f9dcf=0x0,_0x416eb6=events[_0x2f65('0x5')];_0x2f9dcf<_0x416eb6;_0x2f9dcf++){var _0x43d0c0=events[_0x2f9dcf];var _0x2a62d0=createListener('smsMessage:'+_0x43d0c0,_0x1dda08);SmsMessageEvents['on'](_0x43d0c0,_0x2a62d0);}}; \ No newline at end of file +var _0xb315=['length','./smsMessage.events','save','remove','emit','register'];(function(_0x4be70c,_0x2d8bae){var _0x243cf9=function(_0x336540){while(--_0x336540){_0x4be70c['push'](_0x4be70c['shift']());}};_0x243cf9(++_0x2d8bae);}(_0xb315,0x139));var _0x5b31=function(_0x4dab14,_0x164ea0){_0x4dab14=_0x4dab14-0x0;var _0xf41aa=_0xb315[_0x4dab14];return _0xf41aa;};'use strict';var SmsMessageEvents=require(_0x5b31('0x0'));var events=[_0x5b31('0x1'),_0x5b31('0x2'),'update'];function createListener(_0x4123b9,_0x466c1a){return function(_0x474ec1){_0x466c1a[_0x5b31('0x3')](_0x4123b9,_0x474ec1);};}function removeListener(_0x4590a0,_0x252d05){return function(){SmsMessageEvents['removeListener'](_0x4590a0,_0x252d05);};}exports[_0x5b31('0x4')]=function(_0x372011){for(var _0x306747=0x0,_0x49e417=events[_0x5b31('0x5')];_0x306747<_0x49e417;_0x306747++){var _0x49410d=events[_0x306747];var _0x580187=createListener('smsMessage:'+_0x49410d,_0x372011);SmsMessageEvents['on'](_0x49410d,_0x580187);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 3a52b79..0b731e4 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 _0x2487=['multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','/:id/teams','/:id/users','post','create','addAgents','put','/:id','delete','removeTeams','removeAgents','exports'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x2487,0x1c0));var _0x7248=function(_0x227cfb,_0x4f42cf){_0x227cfb=_0x227cfb-0x0;var _0x131407=_0x2487[_0x227cfb];return _0x131407;};'use strict';var multer=require(_0x7248('0x0'));var util=require(_0x7248('0x1'));var path=require(_0x7248('0x2'));var timeout=require(_0x7248('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7248('0x4'));var auth=require(_0x7248('0x5'));var interaction=require(_0x7248('0x6'));var config=require(_0x7248('0x7'));var controller=require(_0x7248('0x8'));router[_0x7248('0x9')]('/',auth[_0x7248('0xa')](),controller[_0x7248('0xb')]);router['get'](_0x7248('0xc'),auth[_0x7248('0xa')](),controller[_0x7248('0xd')]);router[_0x7248('0x9')]('/:id',auth[_0x7248('0xa')](),controller[_0x7248('0xe')]);router['get'](_0x7248('0xf'),auth[_0x7248('0xa')](),controller[_0x7248('0x10')]);router[_0x7248('0x9')](_0x7248('0x11'),auth[_0x7248('0xa')](),controller['getTeams']);router[_0x7248('0x9')](_0x7248('0x12'),auth[_0x7248('0xa')](),controller['getAgents']);router[_0x7248('0x13')]('/',auth['isAuthenticated'](),controller[_0x7248('0x14')]);router['post'](_0x7248('0x11'),auth[_0x7248('0xa')](),controller['addTeams']);router['post']('/:id/users',auth[_0x7248('0xa')](),controller[_0x7248('0x15')]);router[_0x7248('0x16')](_0x7248('0x17'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x7248('0x18')](_0x7248('0x11'),auth[_0x7248('0xa')](),controller[_0x7248('0x19')]);router[_0x7248('0x18')](_0x7248('0x12'),auth[_0x7248('0xa')](),controller[_0x7248('0x1a')]);module[_0x7248('0x1b')]=router; \ No newline at end of file +var _0x6234=['destroy','removeAgents','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','update','delete'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0x6234,0x1c2));var _0x4623=function(_0x405c3c,_0x11500f){_0x405c3c=_0x405c3c-0x0;var _0x3ed6a0=_0x6234[_0x405c3c];return _0x3ed6a0;};'use strict';var multer=require(_0x4623('0x0'));var util=require(_0x4623('0x1'));var path=require('path');var timeout=require(_0x4623('0x2'));var express=require(_0x4623('0x3'));var router=express['Router']();var fs_extra=require(_0x4623('0x4'));var auth=require(_0x4623('0x5'));var interaction=require(_0x4623('0x6'));var config=require('../../config/environment');var controller=require(_0x4623('0x7'));router[_0x4623('0x8')]('/',auth[_0x4623('0x9')](),controller[_0x4623('0xa')]);router[_0x4623('0x8')](_0x4623('0xb'),auth[_0x4623('0x9')](),controller[_0x4623('0xc')]);router[_0x4623('0x8')](_0x4623('0xd'),auth[_0x4623('0x9')](),controller[_0x4623('0xe')]);router['get'](_0x4623('0xf'),auth[_0x4623('0x9')](),controller[_0x4623('0x10')]);router[_0x4623('0x8')](_0x4623('0x11'),auth[_0x4623('0x9')](),controller[_0x4623('0x12')]);router[_0x4623('0x8')](_0x4623('0x13'),auth[_0x4623('0x9')](),controller[_0x4623('0x14')]);router[_0x4623('0x15')]('/',auth[_0x4623('0x9')](),controller[_0x4623('0x16')]);router[_0x4623('0x15')](_0x4623('0x11'),auth[_0x4623('0x9')](),controller[_0x4623('0x17')]);router[_0x4623('0x15')](_0x4623('0x13'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x4623('0xd'),auth[_0x4623('0x9')](),controller[_0x4623('0x18')]);router[_0x4623('0x19')](_0x4623('0xd'),auth[_0x4623('0x9')](),controller[_0x4623('0x1a')]);router[_0x4623('0x19')](_0x4623('0x11'),auth[_0x4623('0x9')](),controller['removeTeams']);router[_0x4623('0x19')](_0x4623('0x13'),auth['isAuthenticated'](),controller[_0x4623('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 4fc7ad0..b1e510d 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 _0x8401=['roundrobin','sequelize','name','STRING','rrmemory','beepall'];(function(_0x27bd2c,_0x24bd98){var _0x3784ea=function(_0x4ca802){while(--_0x4ca802){_0x27bd2c['push'](_0x27bd2c['shift']());}};_0x3784ea(++_0x24bd98);}(_0x8401,0x97));var _0x1840=function(_0x18942d,_0x2dac87){_0x18942d=_0x18942d-0x0;var _0x2091e9=_0x8401[_0x18942d];return _0x2091e9;};'use strict';var Sequelize=require(_0x1840('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x1840('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1840('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x1840('0x3'),_0x1840('0x4'),_0x1840('0x5'))}}; \ No newline at end of file +var _0x6e99=['name','INTEGER','rrmemory','sequelize','exports','STRING'];(function(_0x16dfb3,_0x1613fc){var _0x1d8030=function(_0x1bd5da){while(--_0x1bd5da){_0x16dfb3['push'](_0x16dfb3['shift']());}};_0x1d8030(++_0x1613fc);}(_0x6e99,0x8d));var _0x96e9=function(_0x5f59ee,_0x20e87d){_0x5f59ee=_0x5f59ee-0x0;var _0xec8564=_0x6e99[_0x5f59ee];return _0xec8564;};'use strict';var Sequelize=require(_0x96e9('0x0'));module[_0x96e9('0x1')]={'name':{'type':Sequelize[_0x96e9('0x2')],'unique':_0x96e9('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x96e9('0x2')]},'timeout':{'type':Sequelize[_0x96e9('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x96e9('0x5'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index b0709ea..899a63f 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 _0xcc97=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./smsQueue.socket','register','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','error','stack','name','send','SmsQueue','rawAttributes','fieldName','type','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','count','include','findAll','catch','params','create','body','user','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','order','SmsQueueId','findAndCountAll','agent','updatedAt','createdAt','rows','format','SIP','getTeams','Team','addTeams','Agents','online','interface','transaction','each','findOrCreate','emit','userSmsQueue:save','removeTeams','ids','select','from','team_has_sms_queues','join','user_has_teams','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','removeAgents','forEach','addAgents','omit','spread','isArray','userSmsQueue:remove','getAgents','User','eml-format','rimraf'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xcc97,0x1a8));var _0x7cc9=function(_0x58e3b7,_0x174a8f){_0x58e3b7=_0x58e3b7-0x0;var _0x37885b=_0xcc97[_0x58e3b7];return _0x37885b;};'use strict';var emlformat=require(_0x7cc9('0x0'));var rimraf=require(_0x7cc9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7cc9('0x2'));var rp=require(_0x7cc9('0x3'));var moment=require(_0x7cc9('0x4'));var BPromise=require(_0x7cc9('0x5'));var Mustache=require(_0x7cc9('0x6'));var util=require(_0x7cc9('0x7'));var path=require(_0x7cc9('0x8'));var sox=require(_0x7cc9('0x9'));var csv=require(_0x7cc9('0xa'));var ejs=require(_0x7cc9('0xb'));var fs=require('fs');var fs_extra=require(_0x7cc9('0xc'));var _=require('lodash');var squel=require(_0x7cc9('0xd'));var crypto=require(_0x7cc9('0xe'));var jsforce=require(_0x7cc9('0xf'));var deskjs=require(_0x7cc9('0x10'));var toCsv=require(_0x7cc9('0xa'));var querystring=require('querystring');var Papa=require(_0x7cc9('0x11'));var Redis=require('ioredis');var authService=require(_0x7cc9('0x12'));var qs=require(_0x7cc9('0x13'));var as=require(_0x7cc9('0x14'));var hardwareService=require(_0x7cc9('0x15'));var logger=require(_0x7cc9('0x16'))(_0x7cc9('0x17'));var utils=require(_0x7cc9('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7cc9('0x19'))['db'];config['redis']=_[_0x7cc9('0x1a')](config['redis'],{'host':_0x7cc9('0x1b'),'port':0x18eb});var socket=require(_0x7cc9('0x1c'))(new Redis(config[_0x7cc9('0x1d')]));require(_0x7cc9('0x1e'))[_0x7cc9('0x1f')](socket);function respondWithStatusCode(_0x48694e,_0x4de4c5){_0x4de4c5=_0x4de4c5||0xcc;return function(_0x23c329){if(_0x23c329){return _0x48694e[_0x7cc9('0x20')](_0x4de4c5);}return _0x48694e[_0x7cc9('0x21')](_0x4de4c5)[_0x7cc9('0x22')]();};}function respondWithResult(_0x4f0e10,_0x2e5587){_0x2e5587=_0x2e5587||0xc8;return function(_0x4db823){if(_0x4db823){return _0x4f0e10[_0x7cc9('0x21')](_0x2e5587)[_0x7cc9('0x23')](_0x4db823);}};}function respondWithFilteredResult(_0xce7e46,_0x380638){return function(_0x317ec4){if(_0x317ec4){var _0x1f1f77=typeof _0x380638['offset']===_0x7cc9('0x24')&&typeof _0x380638[_0x7cc9('0x25')]===_0x7cc9('0x24');var _0x275128=_0x317ec4['count'];var _0x5a2333=_0x1f1f77?0x0:_0x380638['offset'];var _0x1c22f0=_0x1f1f77?_0x317ec4['count']:_0x380638[_0x7cc9('0x26')]+_0x380638[_0x7cc9('0x25')];var _0x4a07a0;if(_0x1c22f0>=_0x275128){_0x1c22f0=_0x275128;_0x4a07a0=0xc8;}else{_0x4a07a0=0xce;}_0xce7e46[_0x7cc9('0x21')](_0x4a07a0);return _0xce7e46[_0x7cc9('0x27')](_0x7cc9('0x28'),_0x5a2333+'-'+_0x1c22f0+'/'+_0x275128)[_0x7cc9('0x23')](_0x317ec4);}return null;};}function patchUpdates(_0x9b148e){return function(_0x1d5d12){try{jsonpatch[_0x7cc9('0x29')](_0x1d5d12,_0x9b148e,!![]);}catch(_0xec018d){return BPromise[_0x7cc9('0x2a')](_0xec018d);}return _0x1d5d12[_0x7cc9('0x2b')]();};}function saveUpdates(_0xa0eee6,_0x1022ac){return function(_0x4adb9e){if(_0x4adb9e){return _0x4adb9e[_0x7cc9('0x2c')](_0xa0eee6)[_0x7cc9('0x2d')](function(_0x5ad481){return _0x5ad481;});}return null;};}function removeEntity(_0x1013c1,_0x47f514){return function(_0x2d5ed9){if(_0x2d5ed9){return _0x2d5ed9[_0x7cc9('0x2e')]()[_0x7cc9('0x2d')](function(){var _0x4f6d59=_0x2d5ed9[_0x7cc9('0x2f')]({'plain':!![]});var _0x4bb12b='SmsQueues';return db['UserProfileResource'][_0x7cc9('0x2e')]({'where':{'type':_0x4bb12b,'resourceId':_0x4f6d59['id']}})[_0x7cc9('0x2d')](function(){return _0x2d5ed9;});})[_0x7cc9('0x2d')](function(){_0x1013c1[_0x7cc9('0x21')](0xcc)[_0x7cc9('0x22')]();});}};}function handleEntityNotFound(_0x527b75,_0x5ba534){return function(_0x5a3f15){if(!_0x5a3f15){_0x527b75[_0x7cc9('0x20')](0x194);}return _0x5a3f15;};}function handleError(_0x4a8c62,_0x3b12a9){_0x3b12a9=_0x3b12a9||0x1f4;return function(_0x2bc89d){logger[_0x7cc9('0x30')](_0x2bc89d[_0x7cc9('0x31')]);if(_0x2bc89d[_0x7cc9('0x32')]){delete _0x2bc89d['name'];}_0x4a8c62['status'](_0x3b12a9)[_0x7cc9('0x33')](_0x2bc89d);};}exports['index']=function(_0x116fd2,_0x52ea89){var _0x401f57={},_0x29a38a={},_0x172492={'count':0x0,'rows':[]};var _0x253379=_['map'](db[_0x7cc9('0x34')][_0x7cc9('0x35')],function(_0xe05c23){return{'name':_0xe05c23[_0x7cc9('0x36')],'type':_0xe05c23[_0x7cc9('0x37')]['key']};});_0x29a38a['model']=_[_0x7cc9('0x38')](_0x253379,_0x7cc9('0x32'));_0x29a38a['query']=_[_0x7cc9('0x39')](_0x116fd2[_0x7cc9('0x3a')]);_0x29a38a[_0x7cc9('0x3b')]=_[_0x7cc9('0x3c')](_0x29a38a[_0x7cc9('0x3d')],_0x29a38a[_0x7cc9('0x3a')]);_0x401f57[_0x7cc9('0x3e')]=_['intersection'](_0x29a38a[_0x7cc9('0x3d')],qs[_0x7cc9('0x3f')](_0x116fd2[_0x7cc9('0x3a')][_0x7cc9('0x3f')]));_0x401f57['attributes']=_0x401f57['attributes'][_0x7cc9('0x40')]?_0x401f57[_0x7cc9('0x3e')]:_0x29a38a[_0x7cc9('0x3d')];if(!_0x116fd2[_0x7cc9('0x3a')][_0x7cc9('0x41')](_0x7cc9('0x42'))){_0x401f57[_0x7cc9('0x25')]=qs[_0x7cc9('0x25')](_0x116fd2[_0x7cc9('0x3a')][_0x7cc9('0x25')]);_0x401f57['offset']=qs[_0x7cc9('0x26')](_0x116fd2[_0x7cc9('0x3a')][_0x7cc9('0x26')]);}_0x401f57['order']=qs[_0x7cc9('0x43')](_0x116fd2['query'][_0x7cc9('0x43')]);_0x401f57[_0x7cc9('0x44')]=qs[_0x7cc9('0x3b')](_[_0x7cc9('0x45')](_0x116fd2['query'],_0x29a38a[_0x7cc9('0x3b')]),_0x253379);if(_0x116fd2[_0x7cc9('0x3a')]['filter']){_0x401f57['where']=_['merge'](_0x401f57[_0x7cc9('0x44')],{'$or':_['map'](_0x253379,function(_0xbee8db){if(_0xbee8db[_0x7cc9('0x37')]!==_0x7cc9('0x46')){var _0x3d0b81={};_0x3d0b81[_0xbee8db[_0x7cc9('0x32')]]={'$like':'%'+_0x116fd2[_0x7cc9('0x3a')][_0x7cc9('0x47')]+'%'};return _0x3d0b81;}})});}_0x401f57=_[_0x7cc9('0x48')]({},_0x401f57,_0x116fd2[_0x7cc9('0x49')]);var _0x26749b={'where':_0x401f57[_0x7cc9('0x44')]};return db[_0x7cc9('0x34')][_0x7cc9('0x4a')](_0x26749b)[_0x7cc9('0x2d')](function(_0x1981a1){_0x172492[_0x7cc9('0x4a')]=_0x1981a1;if(_0x116fd2[_0x7cc9('0x3a')]['includeAll']){_0x401f57[_0x7cc9('0x4b')]=[{'all':!![]}];}return db[_0x7cc9('0x34')][_0x7cc9('0x4c')](_0x401f57);})[_0x7cc9('0x2d')](function(_0x2e3a3c){_0x172492['rows']=_0x2e3a3c;return _0x172492;})['then'](respondWithFilteredResult(_0x52ea89,_0x401f57))[_0x7cc9('0x4d')](handleError(_0x52ea89,null));};exports['show']=function(_0x4f6829,_0x5e220c){var _0x29cee3={'raw':!![],'where':{'id':_0x4f6829[_0x7cc9('0x4e')]['id']}},_0x2bc517={};_0x2bc517[_0x7cc9('0x3d')]=_[_0x7cc9('0x39')](db['SmsQueue']['rawAttributes']);_0x2bc517[_0x7cc9('0x3a')]=_[_0x7cc9('0x39')](_0x4f6829[_0x7cc9('0x3a')]);_0x2bc517[_0x7cc9('0x3b')]=_[_0x7cc9('0x3c')](_0x2bc517[_0x7cc9('0x3d')],_0x2bc517[_0x7cc9('0x3a')]);_0x29cee3['attributes']=_[_0x7cc9('0x3c')](_0x2bc517['model'],qs['fields'](_0x4f6829[_0x7cc9('0x3a')]['fields']));_0x29cee3[_0x7cc9('0x3e')]=_0x29cee3[_0x7cc9('0x3e')][_0x7cc9('0x40')]?_0x29cee3[_0x7cc9('0x3e')]:_0x2bc517[_0x7cc9('0x3d')];if(_0x4f6829['query']['includeAll']){_0x29cee3['include']=[{'all':!![]}];}_0x29cee3=_[_0x7cc9('0x48')]({},_0x29cee3,_0x4f6829[_0x7cc9('0x49')]);return db[_0x7cc9('0x34')]['find'](_0x29cee3)[_0x7cc9('0x2d')](handleEntityNotFound(_0x5e220c,null))[_0x7cc9('0x2d')](respondWithResult(_0x5e220c,null))[_0x7cc9('0x4d')](handleError(_0x5e220c,null));};exports[_0x7cc9('0x4f')]=function(_0x28693c,_0x521304){return db[_0x7cc9('0x34')][_0x7cc9('0x4f')](_0x28693c[_0x7cc9('0x50')],{})[_0x7cc9('0x2d')](function(_0x5146a7){var _0x3d0380=_0x28693c[_0x7cc9('0x51')][_0x7cc9('0x2f')]({'plain':!![]});if(!_0x3d0380)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3d0380['role']===_0x7cc9('0x51')){var _0x4acd3f=_0x5146a7[_0x7cc9('0x2f')]({'plain':!![]});var _0x54e424='SmsQueues';return db[_0x7cc9('0x52')][_0x7cc9('0x53')]({'where':{'name':_0x54e424,'userProfileId':_0x3d0380[_0x7cc9('0x54')]},'raw':!![]})[_0x7cc9('0x2d')](function(_0x7020fe){if(_0x7020fe&&_0x7020fe['autoAssociation']===0x0){return db[_0x7cc9('0x55')]['create']({'name':_0x4acd3f[_0x7cc9('0x32')],'resourceId':_0x4acd3f['id'],'type':_0x7020fe[_0x7cc9('0x32')],'sectionId':_0x7020fe['id']},{})['then'](function(){return _0x5146a7;});}else{return _0x5146a7;}})['catch'](function(_0x1e6641){logger['error'](_0x7cc9('0x56'),_0x1e6641);throw _0x1e6641;});}return _0x5146a7;})[_0x7cc9('0x2d')](respondWithResult(_0x521304,0xc9))[_0x7cc9('0x4d')](handleError(_0x521304,null));};exports[_0x7cc9('0x2c')]=function(_0x5d5990,_0x34017f){if(_0x5d5990['body']['id']){delete _0x5d5990['body']['id'];}return db[_0x7cc9('0x34')][_0x7cc9('0x53')]({'where':{'id':_0x5d5990[_0x7cc9('0x4e')]['id']}})['then'](handleEntityNotFound(_0x34017f,null))['then'](saveUpdates(_0x5d5990[_0x7cc9('0x50')],null))[_0x7cc9('0x2d')](respondWithResult(_0x34017f,null))[_0x7cc9('0x4d')](handleError(_0x34017f,null));};exports[_0x7cc9('0x2e')]=function(_0x280004,_0x5040f6){return db[_0x7cc9('0x34')][_0x7cc9('0x53')]({'where':{'id':_0x280004[_0x7cc9('0x4e')]['id']}})[_0x7cc9('0x2d')](handleEntityNotFound(_0x5040f6,null))[_0x7cc9('0x2d')](removeEntity(_0x5040f6,null))[_0x7cc9('0x4d')](handleError(_0x5040f6,null));};exports['describe']=function(_0x10d213,_0x353d08){return db[_0x7cc9('0x34')][_0x7cc9('0x57')]()[_0x7cc9('0x2d')](respondWithResult(_0x353d08,null))['catch'](handleError(_0x353d08,null));};exports[_0x7cc9('0x58')]=function(_0x50f739,_0x3c6fa7,_0x3a9af2){var _0x1c2a34={'raw':!![],'where':{}},_0x429bc4={},_0xb6c843;return db[_0x7cc9('0x34')][_0x7cc9('0x59')]({'where':{'id':_0x50f739[_0x7cc9('0x4e')]['id']}})[_0x7cc9('0x2d')](handleEntityNotFound(_0x3c6fa7,null))['then'](function(_0x14dd8e){if(_0x14dd8e){_0xb6c843=_0x14dd8e['get']({'plain':!![]});_0x429bc4[_0x7cc9('0x3d')]=_[_0x7cc9('0x39')](db[_0x7cc9('0x5a')][_0x7cc9('0x35')]);_0x429bc4[_0x7cc9('0x3a')]=_[_0x7cc9('0x39')](_0x50f739[_0x7cc9('0x3a')]);_0x429bc4['filters']=_['intersection'](_0x429bc4['model'],_0x429bc4[_0x7cc9('0x3a')]);_0x1c2a34[_0x7cc9('0x3e')]=_['intersection'](_0x429bc4[_0x7cc9('0x3d')],qs['fields'](_0x50f739[_0x7cc9('0x3a')][_0x7cc9('0x3f')]));_0x1c2a34[_0x7cc9('0x3e')]=_0x1c2a34[_0x7cc9('0x3e')][_0x7cc9('0x40')]?_0x1c2a34['attributes']:_0x429bc4[_0x7cc9('0x3d')];if(!_0x50f739[_0x7cc9('0x3a')][_0x7cc9('0x41')](_0x7cc9('0x42'))){_0x1c2a34[_0x7cc9('0x25')]=qs[_0x7cc9('0x25')](_0x50f739['query'][_0x7cc9('0x25')]);_0x1c2a34['offset']=qs[_0x7cc9('0x26')](_0x50f739['query'][_0x7cc9('0x26')]);}_0x1c2a34[_0x7cc9('0x5b')]=qs['sort'](_0x50f739[_0x7cc9('0x3a')][_0x7cc9('0x43')]);_0x1c2a34['where']=qs[_0x7cc9('0x3b')](_['pick'](_0x50f739[_0x7cc9('0x3a')],_0x429bc4['filters']));_0x1c2a34['where'][_0x7cc9('0x5c')]=_0x14dd8e['id'];if(_0x50f739[_0x7cc9('0x3a')][_0x7cc9('0x47')]){_0x1c2a34[_0x7cc9('0x44')]=_[_0x7cc9('0x48')](_0x1c2a34[_0x7cc9('0x44')],{'$or':_[_0x7cc9('0x38')](_0x1c2a34[_0x7cc9('0x3e')],function(_0x4a4e36){var _0x26e283={};_0x26e283[_0x4a4e36]={'$like':'%'+_0x50f739[_0x7cc9('0x3a')][_0x7cc9('0x47')]+'%'};return _0x26e283;})});}_0x1c2a34=_[_0x7cc9('0x48')]({},_0x1c2a34,_0x50f739['options']);return db[_0x7cc9('0x5a')]['findAll'](_0x1c2a34);}})['then'](function(_0x127b01){if(_0x127b01){return db['User'][_0x7cc9('0x5d')]({'where':{'id':_[_0x7cc9('0x38')](_0x127b01,'UserId'),'role':_0x7cc9('0x5e')},'attributes':['id',_0x7cc9('0x32'),'smsPause',_0x7cc9('0x5f'),_0x7cc9('0x60')]});}})['then'](function(_0x5ca609){if(_0x5ca609){return{'count':_0x5ca609[_0x7cc9('0x4a')],'rows':_[_0x7cc9('0x38')](_0x5ca609[_0x7cc9('0x61')],function(_0x175b76){return{'membername':_0x175b76[_0x7cc9('0x32')],'UserId':_0x175b76['id'],'queue_name':_0xb6c843['name'],'SmsQueueId':_0xb6c843['id'],'interface':util[_0x7cc9('0x62')]('%s/%s',_0x7cc9('0x63'),_0x175b76['name']),'penalty':0x0,'paused':_0x175b76['smsPause'],'createdAt':_0x175b76['createdAt'],'updatedAt':_0x175b76['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x7cc9('0x2d')](respondWithFilteredResult(_0x3c6fa7,_0x1c2a34))['catch'](handleError(_0x3c6fa7,null));};exports[_0x7cc9('0x64')]=function(_0x5996d6,_0x2e0e05,_0x9c83f9){var _0xd08907={};var _0x4082f7={};var _0x4e1f9a;var _0xb187c4;return db[_0x7cc9('0x34')][_0x7cc9('0x59')]({'where':{'id':_0x5996d6[_0x7cc9('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2e0e05,null))[_0x7cc9('0x2d')](function(_0x28480b){if(_0x28480b){_0x4e1f9a=_0x28480b;_0x4082f7[_0x7cc9('0x3d')]=_[_0x7cc9('0x39')](db[_0x7cc9('0x65')]['rawAttributes']);_0x4082f7[_0x7cc9('0x3a')]=_[_0x7cc9('0x39')](_0x5996d6['query']);_0x4082f7[_0x7cc9('0x3b')]=_[_0x7cc9('0x3c')](_0x4082f7[_0x7cc9('0x3d')],_0x4082f7[_0x7cc9('0x3a')]);_0xd08907[_0x7cc9('0x3e')]=_[_0x7cc9('0x3c')](_0x4082f7[_0x7cc9('0x3d')],qs[_0x7cc9('0x3f')](_0x5996d6[_0x7cc9('0x3a')][_0x7cc9('0x3f')]));_0xd08907[_0x7cc9('0x3e')]=_0xd08907[_0x7cc9('0x3e')][_0x7cc9('0x40')]?_0xd08907[_0x7cc9('0x3e')]:_0x4082f7[_0x7cc9('0x3d')];_0xd08907[_0x7cc9('0x5b')]=qs['sort'](_0x5996d6[_0x7cc9('0x3a')]['sort']);_0xd08907[_0x7cc9('0x44')]=qs[_0x7cc9('0x3b')](_[_0x7cc9('0x45')](_0x5996d6['query'],_0x4082f7[_0x7cc9('0x3b')]));if(_0x5996d6[_0x7cc9('0x3a')][_0x7cc9('0x47')]){_0xd08907[_0x7cc9('0x44')]=_[_0x7cc9('0x48')](_0xd08907[_0x7cc9('0x44')],{'$or':_[_0x7cc9('0x38')](_0xd08907['attributes'],function(_0x11840b){var _0x3df434={};_0x3df434[_0x11840b]={'$like':'%'+_0x5996d6[_0x7cc9('0x3a')][_0x7cc9('0x47')]+'%'};return _0x3df434;})});}_0xd08907=_[_0x7cc9('0x48')]({},_0xd08907,_0x5996d6[_0x7cc9('0x49')]);return _0x4e1f9a[_0x7cc9('0x64')](_0xd08907);}})[_0x7cc9('0x2d')](function(_0x3c9dc5){if(_0x3c9dc5){_0xb187c4=_0x3c9dc5[_0x7cc9('0x40')];if(!_0x5996d6[_0x7cc9('0x3a')][_0x7cc9('0x41')](_0x7cc9('0x42'))){_0xd08907[_0x7cc9('0x25')]=qs[_0x7cc9('0x25')](_0x5996d6[_0x7cc9('0x3a')][_0x7cc9('0x25')]);_0xd08907['offset']=qs[_0x7cc9('0x26')](_0x5996d6[_0x7cc9('0x3a')][_0x7cc9('0x26')]);}return _0x4e1f9a['getTeams'](_0xd08907);}})[_0x7cc9('0x2d')](function(_0x4fda2f){if(_0x4fda2f){return _0x4fda2f?{'count':_0xb187c4,'rows':_0x4fda2f}:null;}})[_0x7cc9('0x2d')](respondWithResult(_0x2e0e05,null))[_0x7cc9('0x4d')](handleError(_0x2e0e05,null));};exports[_0x7cc9('0x66')]=function(_0x15c392,_0x3c71b0,_0x168077){var _0x575a42=_0x15c392[_0x7cc9('0x50')]['ids'];return db[_0x7cc9('0x65')][_0x7cc9('0x4c')]({'where':{'id':_0x575a42},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7cc9('0x67'),'attributes':['id',_0x7cc9('0x32'),_0x7cc9('0x68'),'voicePause',_0x7cc9('0x69')],'raw':!![]}]})['then'](function(_0x5eb9fb){if(_0x5eb9fb){var _0x27f78a=_['flatMap'](_0x5eb9fb,function(_0x5ad2ec){var _0x41990e=_0x5ad2ec[_0x7cc9('0x2f')]({'plain':!![]});return _0x41990e[_0x7cc9('0x67')];});return db[_0x7cc9('0x34')]['find']({'where':{'id':_0x15c392['params']['id']}})[_0x7cc9('0x2d')](function(_0x430861){return db['sequelize'][_0x7cc9('0x6a')](function(_0x504150){return _0x430861[_0x7cc9('0x66')](_0x575a42,{'transaction':_0x504150})[_0x7cc9('0x2d')](function(){return BPromise[_0x7cc9('0x6b')](_0x27f78a,function(_0x363261){return db[_0x7cc9('0x5a')][_0x7cc9('0x6c')]({'where':{'UserId':_0x363261['id'],'SmsQueueId':_0x15c392['params']['id']},'transaction':_0x504150});});})['then'](function(){_0x27f78a['forEach'](function(_0x19e741){socket[_0x7cc9('0x6d')](_0x7cc9('0x6e'),{'UserId':_0x19e741['id'],'SmsQueueId':_0x430861['id']});});});});});}})['then'](respondWithStatusCode(_0x3c71b0,null))[_0x7cc9('0x4d')](handleError(_0x3c71b0,null));};exports[_0x7cc9('0x6f')]=function(_0xb0a432,_0x40ce68,_0x4922fa){return db['Team'][_0x7cc9('0x4c')]({'where':{'id':_0xb0a432[_0x7cc9('0x3a')][_0x7cc9('0x70')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7cc9('0x67'),'attributes':['id'],'raw':!![]}]})[_0x7cc9('0x2d')](handleEntityNotFound(_0x40ce68,null))['then'](function(_0x2133d7){var _0x2ba0e1=_[_0x7cc9('0x38')](_0x2133d7,'id');var _0x499ef5=[];var _0x22ddf5=[];var _0x255be8=squel[_0x7cc9('0x71')]();_0x255be8['field']('tq.TeamId')[_0x7cc9('0x72')](_0x7cc9('0x73'),'tq')[_0x7cc9('0x74')](_0x7cc9('0x75'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x7cc9('0x76'),_0xb0a432['params']['id']);for(var _0x297b6b=0x0;_0x297b6b<_0x2133d7['length'];_0x297b6b+=0x1){let _0x38a9cf=_0x2133d7[_0x297b6b];for(var _0x4fc9dc=0x0;_0x4fc9dc<_0x38a9cf[_0x7cc9('0x67')][_0x7cc9('0x40')];_0x4fc9dc+=0x1){let _0x26baf7=_0x38a9cf['Agents'][_0x4fc9dc];var _0x438696=_0x255be8[_0x7cc9('0x77')]();_0x438696[_0x7cc9('0x44')](_0x7cc9('0x78'),_0x26baf7['id']);_0x22ddf5[_0x7cc9('0x79')](db['sequelize'][_0x7cc9('0x3a')](_0x438696[_0x7cc9('0x7a')](),{'type':db[_0x7cc9('0x7b')][_0x7cc9('0x7c')][_0x7cc9('0x7d')]})[_0x7cc9('0x2d')](function(_0x1f6ed9){if(_0x1f6ed9['length']===0x1){return _0x26baf7['id'];}else{var _0x2cb93d=_[_0x7cc9('0x7e')](_['map'](_0x1f6ed9,'TeamId'),function(_0x294406){return _[_0x7cc9('0x7f')](_0x2ba0e1,_0x294406);});if(_0x2cb93d){return _0x26baf7['id'];}}}));}}return BPromise[_0x7cc9('0x80')](_0x22ddf5)['then'](function(_0x75a067){_0x499ef5=_(_0x499ef5)[_0x7cc9('0x81')](_0x75a067)[_0x7cc9('0x82')]()[_0x7cc9('0x83')]();return db['SmsQueue'][_0x7cc9('0x53')]({'where':{'id':_0xb0a432['params']['id']}})['then'](function(_0x24cf02){return db[_0x7cc9('0x7b')][_0x7cc9('0x6a')](function(_0x5447de){return _0x24cf02[_0x7cc9('0x6f')](_0xb0a432['query'][_0x7cc9('0x70')],{'transaction':_0x5447de})['then'](function(){if(!_[_0x7cc9('0x84')](_0x499ef5)){return _0x24cf02[_0x7cc9('0x85')](_0x499ef5,{'transaction':_0x5447de});}})[_0x7cc9('0x2d')](function(){_0x499ef5[_0x7cc9('0x86')](function(_0x27a6db){socket[_0x7cc9('0x6d')]('userSmsQueue:remove',{'UserId':_0x27a6db,'SmsQueueId':_0x24cf02['id']});});});});});});})[_0x7cc9('0x2d')](respondWithStatusCode(_0x40ce68,null))[_0x7cc9('0x4d')](handleError(_0x40ce68,null));};exports['addAgents']=function(_0x2ec095,_0x5178d2,_0x3a94cf){return db[_0x7cc9('0x34')][_0x7cc9('0x53')]({'where':{'id':_0x2ec095[_0x7cc9('0x4e')]['id']}})[_0x7cc9('0x2d')](handleEntityNotFound(_0x5178d2,null))[_0x7cc9('0x2d')](function(_0x3c3479){if(_0x3c3479){return _0x3c3479[_0x7cc9('0x87')](_0x2ec095[_0x7cc9('0x50')][_0x7cc9('0x70')],_[_0x7cc9('0x88')](_0x2ec095[_0x7cc9('0x50')],[_0x7cc9('0x70'),'id'])||{})[_0x7cc9('0x89')](function(_0x3caa62){for(var _0x217105=0x0;_0x217105<_0x2ec095[_0x7cc9('0x50')][_0x7cc9('0x70')]['length'];_0x217105+=0x1){socket['emit']('userSmsQueue:save',{'UserId':Number(_0x2ec095[_0x7cc9('0x50')][_0x7cc9('0x70')][_0x217105]),'SmsQueueId':Number(_0x2ec095[_0x7cc9('0x4e')]['id'])});}return _0x3caa62;});}})['then'](respondWithResult(_0x5178d2,null))[_0x7cc9('0x4d')](handleError(_0x5178d2,null));};exports['removeAgents']=function(_0x4fed3d,_0x323933,_0x4db8f5){return db[_0x7cc9('0x34')][_0x7cc9('0x53')]({'where':{'id':_0x4fed3d[_0x7cc9('0x4e')]['id']}})[_0x7cc9('0x2d')](handleEntityNotFound(_0x323933,null))[_0x7cc9('0x2d')](function(_0x1703b8){if(_0x1703b8){return _0x1703b8[_0x7cc9('0x85')](_0x4fed3d['query'][_0x7cc9('0x70')])['then'](function(){if(_[_0x7cc9('0x8a')](_0x4fed3d[_0x7cc9('0x3a')][_0x7cc9('0x70')])){for(var _0x4f7d99=0x0;_0x4f7d99<_0x4fed3d[_0x7cc9('0x3a')][_0x7cc9('0x70')][_0x7cc9('0x40')];_0x4f7d99+=0x1){socket['emit'](_0x7cc9('0x8b'),{'UserId':Number(_0x4fed3d[_0x7cc9('0x3a')][_0x7cc9('0x70')][_0x4f7d99]),'SmsQueueId':Number(_0x4fed3d[_0x7cc9('0x4e')]['id'])});}}else{socket[_0x7cc9('0x6d')](_0x7cc9('0x8b'),{'UserId':Number(_0x4fed3d[_0x7cc9('0x3a')][_0x7cc9('0x70')]),'SmsQueueId':Number(_0x4fed3d[_0x7cc9('0x4e')]['id'])});}});}})['then'](respondWithStatusCode(_0x323933,null))[_0x7cc9('0x4d')](handleError(_0x323933,null));};exports[_0x7cc9('0x8c')]=function(_0x34832c,_0x58e651,_0x19bf09){var _0x53caca={};var _0x532e00={};var _0x48ca9b;var _0x3d052a;return db[_0x7cc9('0x34')][_0x7cc9('0x59')]({'where':{'id':_0x34832c[_0x7cc9('0x4e')]['id']}})[_0x7cc9('0x2d')](handleEntityNotFound(_0x58e651,null))[_0x7cc9('0x2d')](function(_0x5b4e7e){if(_0x5b4e7e){_0x48ca9b=_0x5b4e7e;_0x532e00[_0x7cc9('0x3d')]=_['keys'](db[_0x7cc9('0x8d')][_0x7cc9('0x35')]);_0x532e00[_0x7cc9('0x3a')]=_[_0x7cc9('0x39')](_0x34832c[_0x7cc9('0x3a')]);_0x532e00[_0x7cc9('0x3b')]=_[_0x7cc9('0x3c')](_0x532e00[_0x7cc9('0x3d')],_0x532e00[_0x7cc9('0x3a')]);_0x53caca[_0x7cc9('0x3e')]=_[_0x7cc9('0x3c')](_0x532e00[_0x7cc9('0x3d')],qs[_0x7cc9('0x3f')](_0x34832c['query'][_0x7cc9('0x3f')]));_0x53caca['attributes']=_0x53caca[_0x7cc9('0x3e')][_0x7cc9('0x40')]?_0x53caca['attributes']:_0x532e00[_0x7cc9('0x3d')];_0x53caca[_0x7cc9('0x5b')]=qs['sort'](_0x34832c['query'][_0x7cc9('0x43')]);_0x53caca[_0x7cc9('0x44')]=qs[_0x7cc9('0x3b')](_[_0x7cc9('0x45')](_0x34832c[_0x7cc9('0x3a')],_0x532e00[_0x7cc9('0x3b')]));if(_0x34832c[_0x7cc9('0x3a')][_0x7cc9('0x47')]){_0x53caca[_0x7cc9('0x44')]=_[_0x7cc9('0x48')](_0x53caca[_0x7cc9('0x44')],{'$or':_['map'](_0x53caca[_0x7cc9('0x3e')],function(_0x3c9db2){var _0x4336e2={};_0x4336e2[_0x3c9db2]={'$like':'%'+_0x34832c[_0x7cc9('0x3a')][_0x7cc9('0x47')]+'%'};return _0x4336e2;})});}_0x53caca=_[_0x7cc9('0x48')]({},_0x53caca,_0x34832c[_0x7cc9('0x49')]);return _0x48ca9b['getAgents'](_0x53caca);}})[_0x7cc9('0x2d')](function(_0xe53011){if(_0xe53011){_0x3d052a=_0xe53011['length'];if(!_0x34832c[_0x7cc9('0x3a')][_0x7cc9('0x41')](_0x7cc9('0x42'))){_0x53caca['limit']=qs[_0x7cc9('0x25')](_0x34832c['query']['limit']);_0x53caca[_0x7cc9('0x26')]=qs[_0x7cc9('0x26')](_0x34832c[_0x7cc9('0x3a')][_0x7cc9('0x26')]);}return _0x48ca9b['getAgents'](_0x53caca);}})[_0x7cc9('0x2d')](function(_0x42eced){if(_0x42eced){return _0x42eced?{'count':_0x3d052a,'rows':_0x42eced}:null;}})[_0x7cc9('0x2d')](respondWithResult(_0x58e651,null))[_0x7cc9('0x4d')](handleError(_0x58e651,null));}; \ No newline at end of file +var _0x9336=['moment','bluebird','mustache','util','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','register','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','get','SmsQueues','UserProfileResource','sendStatus','error','stack','name','send','map','SmsQueue','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','params','describe','getMembers','findOne','UserSmsQueue','hasOwnProperty','sort','SmsQueueId','User','findAndCountAll','UserId','agent','updatedAt','format','SIP','createdAt','getTeams','ids','online','interface','transaction','addTeams','each','findOrCreate','forEach','userSmsQueue:save','removeTeams','Team','Agents','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','sequelize','toString','every','includes','all','union','compact','value','removeAgents','emit','userSmsQueue:remove','addAgents','omit','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x316fa4,_0x1b9789){var _0x5ec413=function(_0x2b5efd){while(--_0x2b5efd){_0x316fa4['push'](_0x316fa4['shift']());}};_0x5ec413(++_0x1b9789);}(_0x9336,0x112));var _0x6933=function(_0x21b2d0,_0x832e75){_0x21b2d0=_0x21b2d0-0x0;var _0x2e4f83=_0x9336[_0x21b2d0];return _0x2e4f83;};'use strict';var emlformat=require(_0x6933('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6933('0x1'));var jsonpatch=require(_0x6933('0x2'));var rp=require(_0x6933('0x3'));var moment=require(_0x6933('0x4'));var BPromise=require(_0x6933('0x5'));var Mustache=require(_0x6933('0x6'));var util=require(_0x6933('0x7'));var path=require('path');var sox=require(_0x6933('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6933('0x9'));var _=require(_0x6933('0xa'));var squel=require('squel');var crypto=require(_0x6933('0xb'));var jsforce=require(_0x6933('0xc'));var deskjs=require(_0x6933('0xd'));var toCsv=require(_0x6933('0xe'));var querystring=require(_0x6933('0xf'));var Papa=require(_0x6933('0x10'));var Redis=require(_0x6933('0x11'));var authService=require(_0x6933('0x12'));var qs=require(_0x6933('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6933('0x14'));var logger=require(_0x6933('0x15'))('api');var utils=require(_0x6933('0x16'));var config=require(_0x6933('0x17'));var licenseUtil=require(_0x6933('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x6933('0x19')],{'host':_0x6933('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6933('0x19')]));require('./smsQueue.socket')[_0x6933('0x1b')](socket);function respondWithStatusCode(_0x5e4f17,_0x27d1b5){_0x27d1b5=_0x27d1b5||0xcc;return function(_0x6d9a95){if(_0x6d9a95){return _0x5e4f17['sendStatus'](_0x27d1b5);}return _0x5e4f17[_0x6933('0x1c')](_0x27d1b5)[_0x6933('0x1d')]();};}function respondWithResult(_0x4d550e,_0x10f5c9){_0x10f5c9=_0x10f5c9||0xc8;return function(_0x21f784){if(_0x21f784){return _0x4d550e[_0x6933('0x1c')](_0x10f5c9)[_0x6933('0x1e')](_0x21f784);}};}function respondWithFilteredResult(_0x1cb398,_0x5d7380){return function(_0x150219){if(_0x150219){var _0x14dd29=typeof _0x5d7380['offset']===_0x6933('0x1f')&&typeof _0x5d7380['limit']===_0x6933('0x1f');var _0x5c99c6=_0x150219['count'];var _0x437d2a=_0x14dd29?0x0:_0x5d7380['offset'];var _0x46d4ef=_0x14dd29?_0x150219[_0x6933('0x20')]:_0x5d7380[_0x6933('0x21')]+_0x5d7380[_0x6933('0x22')];var _0x405d18;if(_0x46d4ef>=_0x5c99c6){_0x46d4ef=_0x5c99c6;_0x405d18=0xc8;}else{_0x405d18=0xce;}_0x1cb398[_0x6933('0x1c')](_0x405d18);return _0x1cb398[_0x6933('0x23')](_0x6933('0x24'),_0x437d2a+'-'+_0x46d4ef+'/'+_0x5c99c6)[_0x6933('0x1e')](_0x150219);}return null;};}function patchUpdates(_0x17a247){return function(_0x2ea3c3){try{jsonpatch[_0x6933('0x25')](_0x2ea3c3,_0x17a247,!![]);}catch(_0x3d91f8){return BPromise[_0x6933('0x26')](_0x3d91f8);}return _0x2ea3c3[_0x6933('0x27')]();};}function saveUpdates(_0x3196ad,_0x44268a){return function(_0x40fff8){if(_0x40fff8){return _0x40fff8['update'](_0x3196ad)[_0x6933('0x28')](function(_0x575aa3){return _0x575aa3;});}return null;};}function removeEntity(_0x1842aa,_0x525878){return function(_0x1f6b19){if(_0x1f6b19){return _0x1f6b19[_0x6933('0x29')]()[_0x6933('0x28')](function(){var _0x12e901=_0x1f6b19[_0x6933('0x2a')]({'plain':!![]});var _0x54b037=_0x6933('0x2b');return db[_0x6933('0x2c')][_0x6933('0x29')]({'where':{'type':_0x54b037,'resourceId':_0x12e901['id']}})[_0x6933('0x28')](function(){return _0x1f6b19;});})[_0x6933('0x28')](function(){_0x1842aa[_0x6933('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x721618,_0xba8a6e){return function(_0x10f74d){if(!_0x10f74d){_0x721618[_0x6933('0x2d')](0x194);}return _0x10f74d;};}function handleError(_0x107985,_0x5f4f52){_0x5f4f52=_0x5f4f52||0x1f4;return function(_0x3254af){logger[_0x6933('0x2e')](_0x3254af[_0x6933('0x2f')]);if(_0x3254af[_0x6933('0x30')]){delete _0x3254af[_0x6933('0x30')];}_0x107985[_0x6933('0x1c')](_0x5f4f52)[_0x6933('0x31')](_0x3254af);};}exports['index']=function(_0x4dc364,_0x1140ad){var _0x4b9c5e={},_0x1c62d2={},_0xb65def={'count':0x0,'rows':[]};var _0x5bb373=_[_0x6933('0x32')](db[_0x6933('0x33')][_0x6933('0x34')],function(_0x4f3aae){return{'name':_0x4f3aae['fieldName'],'type':_0x4f3aae[_0x6933('0x35')]['key']};});_0x1c62d2[_0x6933('0x36')]=_[_0x6933('0x32')](_0x5bb373,_0x6933('0x30'));_0x1c62d2[_0x6933('0x37')]=_[_0x6933('0x38')](_0x4dc364[_0x6933('0x37')]);_0x1c62d2[_0x6933('0x39')]=_[_0x6933('0x3a')](_0x1c62d2[_0x6933('0x36')],_0x1c62d2['query']);_0x4b9c5e[_0x6933('0x3b')]=_['intersection'](_0x1c62d2[_0x6933('0x36')],qs['fields'](_0x4dc364[_0x6933('0x37')][_0x6933('0x3c')]));_0x4b9c5e[_0x6933('0x3b')]=_0x4b9c5e[_0x6933('0x3b')][_0x6933('0x3d')]?_0x4b9c5e[_0x6933('0x3b')]:_0x1c62d2[_0x6933('0x36')];if(!_0x4dc364[_0x6933('0x37')]['hasOwnProperty'](_0x6933('0x3e'))){_0x4b9c5e[_0x6933('0x22')]=qs[_0x6933('0x22')](_0x4dc364['query'][_0x6933('0x22')]);_0x4b9c5e[_0x6933('0x21')]=qs[_0x6933('0x21')](_0x4dc364[_0x6933('0x37')][_0x6933('0x21')]);}_0x4b9c5e[_0x6933('0x3f')]=qs['sort'](_0x4dc364['query']['sort']);_0x4b9c5e[_0x6933('0x40')]=qs['filters'](_[_0x6933('0x41')](_0x4dc364[_0x6933('0x37')],_0x1c62d2['filters']),_0x5bb373);if(_0x4dc364[_0x6933('0x37')]['filter']){_0x4b9c5e[_0x6933('0x40')]=_[_0x6933('0x42')](_0x4b9c5e['where'],{'$or':_[_0x6933('0x32')](_0x5bb373,function(_0x456643){if(_0x456643[_0x6933('0x35')]!==_0x6933('0x43')){var _0x4bbed6={};_0x4bbed6[_0x456643[_0x6933('0x30')]]={'$like':'%'+_0x4dc364[_0x6933('0x37')][_0x6933('0x44')]+'%'};return _0x4bbed6;}})});}_0x4b9c5e=_['merge']({},_0x4b9c5e,_0x4dc364[_0x6933('0x45')]);var _0xd0cb55={'where':_0x4b9c5e[_0x6933('0x40')]};return db[_0x6933('0x33')][_0x6933('0x20')](_0xd0cb55)[_0x6933('0x28')](function(_0x28e383){_0xb65def[_0x6933('0x20')]=_0x28e383;if(_0x4dc364[_0x6933('0x37')][_0x6933('0x46')]){_0x4b9c5e[_0x6933('0x47')]=[{'all':!![]}];}return db[_0x6933('0x33')][_0x6933('0x48')](_0x4b9c5e);})['then'](function(_0x4a5792){_0xb65def[_0x6933('0x49')]=_0x4a5792;return _0xb65def;})[_0x6933('0x28')](respondWithFilteredResult(_0x1140ad,_0x4b9c5e))[_0x6933('0x4a')](handleError(_0x1140ad,null));};exports[_0x6933('0x4b')]=function(_0x3a53b3,_0x398e0f){var _0x5b950e={'raw':!![],'where':{'id':_0x3a53b3['params']['id']}},_0x4e4fd6={};_0x4e4fd6[_0x6933('0x36')]=_[_0x6933('0x38')](db['SmsQueue'][_0x6933('0x34')]);_0x4e4fd6[_0x6933('0x37')]=_[_0x6933('0x38')](_0x3a53b3['query']);_0x4e4fd6[_0x6933('0x39')]=_[_0x6933('0x3a')](_0x4e4fd6[_0x6933('0x36')],_0x4e4fd6['query']);_0x5b950e[_0x6933('0x3b')]=_[_0x6933('0x3a')](_0x4e4fd6['model'],qs[_0x6933('0x3c')](_0x3a53b3[_0x6933('0x37')][_0x6933('0x3c')]));_0x5b950e[_0x6933('0x3b')]=_0x5b950e[_0x6933('0x3b')][_0x6933('0x3d')]?_0x5b950e[_0x6933('0x3b')]:_0x4e4fd6[_0x6933('0x36')];if(_0x3a53b3[_0x6933('0x37')][_0x6933('0x46')]){_0x5b950e[_0x6933('0x47')]=[{'all':!![]}];}_0x5b950e=_['merge']({},_0x5b950e,_0x3a53b3[_0x6933('0x45')]);return db[_0x6933('0x33')]['find'](_0x5b950e)[_0x6933('0x28')](handleEntityNotFound(_0x398e0f,null))[_0x6933('0x28')](respondWithResult(_0x398e0f,null))['catch'](handleError(_0x398e0f,null));};exports['create']=function(_0x26dc06,_0x8fe065){return db[_0x6933('0x33')]['create'](_0x26dc06[_0x6933('0x4c')],{})[_0x6933('0x28')](function(_0x4864bd){var _0x12c5d7=_0x26dc06[_0x6933('0x4d')][_0x6933('0x2a')]({'plain':!![]});if(!_0x12c5d7)throw new Error(_0x6933('0x4e'));if(_0x12c5d7['role']==='user'){var _0x2d0dfb=_0x4864bd[_0x6933('0x2a')]({'plain':!![]});var _0x2fd7b8=_0x6933('0x2b');return db['UserProfileSection']['find']({'where':{'name':_0x2fd7b8,'userProfileId':_0x12c5d7[_0x6933('0x4f')]},'raw':!![]})[_0x6933('0x28')](function(_0x375aee){if(_0x375aee&&_0x375aee[_0x6933('0x50')]===0x0){return db[_0x6933('0x2c')][_0x6933('0x51')]({'name':_0x2d0dfb['name'],'resourceId':_0x2d0dfb['id'],'type':_0x375aee[_0x6933('0x30')],'sectionId':_0x375aee['id']},{})[_0x6933('0x28')](function(){return _0x4864bd;});}else{return _0x4864bd;}})[_0x6933('0x4a')](function(_0x1c0f0f){logger['error'](_0x6933('0x52'),_0x1c0f0f);throw _0x1c0f0f;});}return _0x4864bd;})[_0x6933('0x28')](respondWithResult(_0x8fe065,0xc9))[_0x6933('0x4a')](handleError(_0x8fe065,null));};exports[_0x6933('0x53')]=function(_0x24bf2a,_0x2d9329){if(_0x24bf2a['body']['id']){delete _0x24bf2a[_0x6933('0x4c')]['id'];}return db[_0x6933('0x33')][_0x6933('0x54')]({'where':{'id':_0x24bf2a['params']['id']}})['then'](handleEntityNotFound(_0x2d9329,null))[_0x6933('0x28')](saveUpdates(_0x24bf2a[_0x6933('0x4c')],null))[_0x6933('0x28')](respondWithResult(_0x2d9329,null))[_0x6933('0x4a')](handleError(_0x2d9329,null));};exports['destroy']=function(_0x51cfea,_0x5ced58){return db[_0x6933('0x33')][_0x6933('0x54')]({'where':{'id':_0x51cfea[_0x6933('0x55')]['id']}})[_0x6933('0x28')](handleEntityNotFound(_0x5ced58,null))[_0x6933('0x28')](removeEntity(_0x5ced58,null))['catch'](handleError(_0x5ced58,null));};exports['describe']=function(_0x127346,_0x5418ea){return db[_0x6933('0x33')][_0x6933('0x56')]()[_0x6933('0x28')](respondWithResult(_0x5418ea,null))[_0x6933('0x4a')](handleError(_0x5418ea,null));};exports[_0x6933('0x57')]=function(_0x2956cc,_0x52b09,_0x24e238){var _0x5ebb2f={'raw':!![],'where':{}},_0x2af6b9={},_0x2ba7a4;return db['SmsQueue'][_0x6933('0x58')]({'where':{'id':_0x2956cc[_0x6933('0x55')]['id']}})[_0x6933('0x28')](handleEntityNotFound(_0x52b09,null))[_0x6933('0x28')](function(_0x478310){if(_0x478310){_0x2ba7a4=_0x478310[_0x6933('0x2a')]({'plain':!![]});_0x2af6b9[_0x6933('0x36')]=_[_0x6933('0x38')](db[_0x6933('0x59')][_0x6933('0x34')]);_0x2af6b9[_0x6933('0x37')]=_['keys'](_0x2956cc[_0x6933('0x37')]);_0x2af6b9[_0x6933('0x39')]=_[_0x6933('0x3a')](_0x2af6b9[_0x6933('0x36')],_0x2af6b9[_0x6933('0x37')]);_0x5ebb2f[_0x6933('0x3b')]=_[_0x6933('0x3a')](_0x2af6b9[_0x6933('0x36')],qs[_0x6933('0x3c')](_0x2956cc[_0x6933('0x37')][_0x6933('0x3c')]));_0x5ebb2f[_0x6933('0x3b')]=_0x5ebb2f[_0x6933('0x3b')][_0x6933('0x3d')]?_0x5ebb2f['attributes']:_0x2af6b9['model'];if(!_0x2956cc[_0x6933('0x37')][_0x6933('0x5a')]('nolimit')){_0x5ebb2f['limit']=qs[_0x6933('0x22')](_0x2956cc['query']['limit']);_0x5ebb2f[_0x6933('0x21')]=qs['offset'](_0x2956cc[_0x6933('0x37')][_0x6933('0x21')]);}_0x5ebb2f[_0x6933('0x3f')]=qs[_0x6933('0x5b')](_0x2956cc[_0x6933('0x37')][_0x6933('0x5b')]);_0x5ebb2f[_0x6933('0x40')]=qs['filters'](_['pick'](_0x2956cc[_0x6933('0x37')],_0x2af6b9[_0x6933('0x39')]));_0x5ebb2f['where'][_0x6933('0x5c')]=_0x478310['id'];if(_0x2956cc['query'][_0x6933('0x44')]){_0x5ebb2f[_0x6933('0x40')]=_[_0x6933('0x42')](_0x5ebb2f[_0x6933('0x40')],{'$or':_[_0x6933('0x32')](_0x5ebb2f[_0x6933('0x3b')],function(_0x2bf790){var _0xae3997={};_0xae3997[_0x2bf790]={'$like':'%'+_0x2956cc[_0x6933('0x37')][_0x6933('0x44')]+'%'};return _0xae3997;})});}_0x5ebb2f=_[_0x6933('0x42')]({},_0x5ebb2f,_0x2956cc[_0x6933('0x45')]);return db[_0x6933('0x59')][_0x6933('0x48')](_0x5ebb2f);}})[_0x6933('0x28')](function(_0x4010fd){if(_0x4010fd){return db[_0x6933('0x5d')][_0x6933('0x5e')]({'where':{'id':_['map'](_0x4010fd,_0x6933('0x5f')),'role':_0x6933('0x60')},'attributes':['id',_0x6933('0x30'),'smsPause',_0x6933('0x61'),'createdAt']});}})[_0x6933('0x28')](function(_0x5d47d5){if(_0x5d47d5){return{'count':_0x5d47d5[_0x6933('0x20')],'rows':_[_0x6933('0x32')](_0x5d47d5[_0x6933('0x49')],function(_0xb3319){return{'membername':_0xb3319[_0x6933('0x30')],'UserId':_0xb3319['id'],'queue_name':_0x2ba7a4['name'],'SmsQueueId':_0x2ba7a4['id'],'interface':util[_0x6933('0x62')]('%s/%s',_0x6933('0x63'),_0xb3319[_0x6933('0x30')]),'penalty':0x0,'paused':_0xb3319['smsPause'],'createdAt':_0xb3319[_0x6933('0x64')],'updatedAt':_0xb3319['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x6933('0x28')](respondWithFilteredResult(_0x52b09,_0x5ebb2f))[_0x6933('0x4a')](handleError(_0x52b09,null));};exports['getTeams']=function(_0x2ead46,_0x2a0432,_0x32951a){var _0x330e1c={};var _0x11c76b={};var _0x10d411;var _0x260614;return db[_0x6933('0x33')]['findOne']({'where':{'id':_0x2ead46[_0x6933('0x55')]['id']}})[_0x6933('0x28')](handleEntityNotFound(_0x2a0432,null))[_0x6933('0x28')](function(_0x3ffe7e){if(_0x3ffe7e){_0x10d411=_0x3ffe7e;_0x11c76b[_0x6933('0x36')]=_['keys'](db['Team'][_0x6933('0x34')]);_0x11c76b[_0x6933('0x37')]=_[_0x6933('0x38')](_0x2ead46[_0x6933('0x37')]);_0x11c76b[_0x6933('0x39')]=_[_0x6933('0x3a')](_0x11c76b[_0x6933('0x36')],_0x11c76b['query']);_0x330e1c['attributes']=_['intersection'](_0x11c76b['model'],qs[_0x6933('0x3c')](_0x2ead46['query'][_0x6933('0x3c')]));_0x330e1c[_0x6933('0x3b')]=_0x330e1c[_0x6933('0x3b')]['length']?_0x330e1c['attributes']:_0x11c76b[_0x6933('0x36')];_0x330e1c[_0x6933('0x3f')]=qs[_0x6933('0x5b')](_0x2ead46['query']['sort']);_0x330e1c[_0x6933('0x40')]=qs['filters'](_[_0x6933('0x41')](_0x2ead46['query'],_0x11c76b['filters']));if(_0x2ead46[_0x6933('0x37')][_0x6933('0x44')]){_0x330e1c[_0x6933('0x40')]=_['merge'](_0x330e1c[_0x6933('0x40')],{'$or':_[_0x6933('0x32')](_0x330e1c['attributes'],function(_0x1364b9){var _0x31bad6={};_0x31bad6[_0x1364b9]={'$like':'%'+_0x2ead46[_0x6933('0x37')][_0x6933('0x44')]+'%'};return _0x31bad6;})});}_0x330e1c=_[_0x6933('0x42')]({},_0x330e1c,_0x2ead46[_0x6933('0x45')]);return _0x10d411[_0x6933('0x65')](_0x330e1c);}})['then'](function(_0x819165){if(_0x819165){_0x260614=_0x819165[_0x6933('0x3d')];if(!_0x2ead46[_0x6933('0x37')][_0x6933('0x5a')](_0x6933('0x3e'))){_0x330e1c[_0x6933('0x22')]=qs[_0x6933('0x22')](_0x2ead46['query'][_0x6933('0x22')]);_0x330e1c[_0x6933('0x21')]=qs[_0x6933('0x21')](_0x2ead46[_0x6933('0x37')][_0x6933('0x21')]);}return _0x10d411[_0x6933('0x65')](_0x330e1c);}})['then'](function(_0x4c5692){if(_0x4c5692){return _0x4c5692?{'count':_0x260614,'rows':_0x4c5692}:null;}})[_0x6933('0x28')](respondWithResult(_0x2a0432,null))[_0x6933('0x4a')](handleError(_0x2a0432,null));};exports['addTeams']=function(_0x3d83aa,_0x57b9d8,_0x48f171){var _0x5e5cf9=_0x3d83aa['body'][_0x6933('0x66')];return db['Team']['findAll']({'where':{'id':_0x5e5cf9},'attributes':['id'],'include':[{'model':db[_0x6933('0x5d')],'as':'Agents','attributes':['id',_0x6933('0x30'),_0x6933('0x67'),'voicePause',_0x6933('0x68')],'raw':!![]}]})[_0x6933('0x28')](function(_0x148088){if(_0x148088){var _0x3cdef2=_['flatMap'](_0x148088,function(_0x3e1e37){var _0x3b2e90=_0x3e1e37['get']({'plain':!![]});return _0x3b2e90['Agents'];});return db['SmsQueue'][_0x6933('0x54')]({'where':{'id':_0x3d83aa[_0x6933('0x55')]['id']}})[_0x6933('0x28')](function(_0x58bf25){return db['sequelize'][_0x6933('0x69')](function(_0x194666){return _0x58bf25[_0x6933('0x6a')](_0x5e5cf9,{'transaction':_0x194666})[_0x6933('0x28')](function(){return BPromise[_0x6933('0x6b')](_0x3cdef2,function(_0x3349b3){return db[_0x6933('0x59')][_0x6933('0x6c')]({'where':{'UserId':_0x3349b3['id'],'SmsQueueId':_0x3d83aa[_0x6933('0x55')]['id']},'transaction':_0x194666});});})[_0x6933('0x28')](function(){_0x3cdef2[_0x6933('0x6d')](function(_0x5153ac){socket['emit'](_0x6933('0x6e'),{'UserId':_0x5153ac['id'],'SmsQueueId':_0x58bf25['id']});});});});});}})[_0x6933('0x28')](respondWithStatusCode(_0x57b9d8,null))[_0x6933('0x4a')](handleError(_0x57b9d8,null));};exports[_0x6933('0x6f')]=function(_0x1d7062,_0x594e19,_0x1d5259){return db[_0x6933('0x70')][_0x6933('0x48')]({'where':{'id':_0x1d7062[_0x6933('0x37')]['ids']},'attributes':['id'],'include':[{'model':db[_0x6933('0x5d')],'as':_0x6933('0x71'),'attributes':['id'],'raw':!![]}]})[_0x6933('0x28')](handleEntityNotFound(_0x594e19,null))[_0x6933('0x28')](function(_0x37833e){var _0x4aa160=_[_0x6933('0x32')](_0x37833e,'id');var _0x5d0b25=[];var _0xe2f730=[];var _0xc3a18e=squel[_0x6933('0x72')]();_0xc3a18e[_0x6933('0x73')](_0x6933('0x74'))[_0x6933('0x75')](_0x6933('0x76'),'tq')[_0x6933('0x77')](_0x6933('0x78'),'ut',_0x6933('0x79'))[_0x6933('0x40')](_0x6933('0x7a'),_0x1d7062[_0x6933('0x55')]['id']);for(var _0x508e28=0x0;_0x508e28<_0x37833e[_0x6933('0x3d')];_0x508e28+=0x1){let _0x432bda=_0x37833e[_0x508e28];for(var _0x4a9294=0x0;_0x4a9294<_0x432bda[_0x6933('0x71')][_0x6933('0x3d')];_0x4a9294+=0x1){let _0x2badfc=_0x432bda['Agents'][_0x4a9294];var _0x2705a8=_0xc3a18e['clone']();_0x2705a8['where'](_0x6933('0x7b'),_0x2badfc['id']);_0xe2f730['push'](db[_0x6933('0x7c')]['query'](_0x2705a8[_0x6933('0x7d')](),{'type':db[_0x6933('0x7c')]['QueryTypes']['SELECT']})[_0x6933('0x28')](function(_0x20ffe1){if(_0x20ffe1[_0x6933('0x3d')]===0x1){return _0x2badfc['id'];}else{var _0xb6fecb=_[_0x6933('0x7e')](_[_0x6933('0x32')](_0x20ffe1,'TeamId'),function(_0x180173){return _[_0x6933('0x7f')](_0x4aa160,_0x180173);});if(_0xb6fecb){return _0x2badfc['id'];}}}));}}return BPromise[_0x6933('0x80')](_0xe2f730)[_0x6933('0x28')](function(_0x3bd685){_0x5d0b25=_(_0x5d0b25)[_0x6933('0x81')](_0x3bd685)[_0x6933('0x82')]()[_0x6933('0x83')]();return db['SmsQueue']['find']({'where':{'id':_0x1d7062[_0x6933('0x55')]['id']}})['then'](function(_0x54b3c9){return db[_0x6933('0x7c')][_0x6933('0x69')](function(_0xa93871){return _0x54b3c9['removeTeams'](_0x1d7062['query'][_0x6933('0x66')],{'transaction':_0xa93871})[_0x6933('0x28')](function(){if(!_['isEmpty'](_0x5d0b25)){return _0x54b3c9[_0x6933('0x84')](_0x5d0b25,{'transaction':_0xa93871});}})[_0x6933('0x28')](function(){_0x5d0b25[_0x6933('0x6d')](function(_0x5037fe){socket[_0x6933('0x85')](_0x6933('0x86'),{'UserId':_0x5037fe,'SmsQueueId':_0x54b3c9['id']});});});});});});})[_0x6933('0x28')](respondWithStatusCode(_0x594e19,null))[_0x6933('0x4a')](handleError(_0x594e19,null));};exports[_0x6933('0x87')]=function(_0x2c8877,_0x19c721,_0x1054d3){return db[_0x6933('0x33')][_0x6933('0x54')]({'where':{'id':_0x2c8877[_0x6933('0x55')]['id']}})[_0x6933('0x28')](handleEntityNotFound(_0x19c721,null))[_0x6933('0x28')](function(_0x2cbea0){if(_0x2cbea0){return _0x2cbea0[_0x6933('0x87')](_0x2c8877[_0x6933('0x4c')][_0x6933('0x66')],_[_0x6933('0x88')](_0x2c8877[_0x6933('0x4c')],[_0x6933('0x66'),'id'])||{})['spread'](function(_0x592250){for(var _0x916ebf=0x0;_0x916ebf<_0x2c8877[_0x6933('0x4c')][_0x6933('0x66')][_0x6933('0x3d')];_0x916ebf+=0x1){socket[_0x6933('0x85')](_0x6933('0x6e'),{'UserId':Number(_0x2c8877[_0x6933('0x4c')][_0x6933('0x66')][_0x916ebf]),'SmsQueueId':Number(_0x2c8877[_0x6933('0x55')]['id'])});}return _0x592250;});}})[_0x6933('0x28')](respondWithResult(_0x19c721,null))[_0x6933('0x4a')](handleError(_0x19c721,null));};exports[_0x6933('0x84')]=function(_0x2af25f,_0x5677cd,_0x1c27f8){return db[_0x6933('0x33')][_0x6933('0x54')]({'where':{'id':_0x2af25f[_0x6933('0x55')]['id']}})['then'](handleEntityNotFound(_0x5677cd,null))[_0x6933('0x28')](function(_0x1d5956){if(_0x1d5956){return _0x1d5956[_0x6933('0x84')](_0x2af25f[_0x6933('0x37')][_0x6933('0x66')])['then'](function(){if(_[_0x6933('0x89')](_0x2af25f[_0x6933('0x37')]['ids'])){for(var _0x5c9c37=0x0;_0x5c9c37<_0x2af25f[_0x6933('0x37')][_0x6933('0x66')]['length'];_0x5c9c37+=0x1){socket[_0x6933('0x85')]('userSmsQueue:remove',{'UserId':Number(_0x2af25f['query'][_0x6933('0x66')][_0x5c9c37]),'SmsQueueId':Number(_0x2af25f[_0x6933('0x55')]['id'])});}}else{socket[_0x6933('0x85')]('userSmsQueue:remove',{'UserId':Number(_0x2af25f[_0x6933('0x37')][_0x6933('0x66')]),'SmsQueueId':Number(_0x2af25f[_0x6933('0x55')]['id'])});}});}})[_0x6933('0x28')](respondWithStatusCode(_0x5677cd,null))[_0x6933('0x4a')](handleError(_0x5677cd,null));};exports['getAgents']=function(_0x491a1d,_0x45307b,_0x39bba0){var _0x2991cf={};var _0x2d80be={};var _0x3f4ec9;var _0x5dbf55;return db[_0x6933('0x33')][_0x6933('0x58')]({'where':{'id':_0x491a1d[_0x6933('0x55')]['id']}})[_0x6933('0x28')](handleEntityNotFound(_0x45307b,null))[_0x6933('0x28')](function(_0x52f084){if(_0x52f084){_0x3f4ec9=_0x52f084;_0x2d80be['model']=_[_0x6933('0x38')](db[_0x6933('0x5d')][_0x6933('0x34')]);_0x2d80be[_0x6933('0x37')]=_[_0x6933('0x38')](_0x491a1d[_0x6933('0x37')]);_0x2d80be[_0x6933('0x39')]=_[_0x6933('0x3a')](_0x2d80be[_0x6933('0x36')],_0x2d80be[_0x6933('0x37')]);_0x2991cf[_0x6933('0x3b')]=_['intersection'](_0x2d80be[_0x6933('0x36')],qs[_0x6933('0x3c')](_0x491a1d[_0x6933('0x37')]['fields']));_0x2991cf[_0x6933('0x3b')]=_0x2991cf[_0x6933('0x3b')][_0x6933('0x3d')]?_0x2991cf[_0x6933('0x3b')]:_0x2d80be[_0x6933('0x36')];_0x2991cf[_0x6933('0x3f')]=qs['sort'](_0x491a1d['query'][_0x6933('0x5b')]);_0x2991cf[_0x6933('0x40')]=qs[_0x6933('0x39')](_['pick'](_0x491a1d['query'],_0x2d80be[_0x6933('0x39')]));if(_0x491a1d[_0x6933('0x37')][_0x6933('0x44')]){_0x2991cf[_0x6933('0x40')]=_['merge'](_0x2991cf[_0x6933('0x40')],{'$or':_['map'](_0x2991cf[_0x6933('0x3b')],function(_0x22602c){var _0xac0509={};_0xac0509[_0x22602c]={'$like':'%'+_0x491a1d[_0x6933('0x37')][_0x6933('0x44')]+'%'};return _0xac0509;})});}_0x2991cf=_['merge']({},_0x2991cf,_0x491a1d['options']);return _0x3f4ec9[_0x6933('0x8a')](_0x2991cf);}})[_0x6933('0x28')](function(_0x4d7de2){if(_0x4d7de2){_0x5dbf55=_0x4d7de2[_0x6933('0x3d')];if(!_0x491a1d[_0x6933('0x37')][_0x6933('0x5a')]('nolimit')){_0x2991cf[_0x6933('0x22')]=qs[_0x6933('0x22')](_0x491a1d['query'][_0x6933('0x22')]);_0x2991cf[_0x6933('0x21')]=qs['offset'](_0x491a1d[_0x6933('0x37')][_0x6933('0x21')]);}return _0x3f4ec9[_0x6933('0x8a')](_0x2991cf);}})['then'](function(_0x6eaa7b){if(_0x6eaa7b){return _0x6eaa7b?{'count':_0x5dbf55,'rows':_0x6eaa7b}:null;}})['then'](respondWithResult(_0x45307b,null))[_0x6933('0x4a')](handleError(_0x45307b,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 3282edf..bed170c 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 _0x6737=['hasOwnProperty','hook','exports','events','../../mysqldb','SmsQueue','setMaxListeners','update','remove','emit'];(function(_0x54d32c,_0x210b27){var _0x20284f=function(_0x4be5d3){while(--_0x4be5d3){_0x54d32c['push'](_0x54d32c['shift']());}};_0x20284f(++_0x210b27);}(_0x6737,0x11b));var _0x7673=function(_0x45232e,_0x143066){_0x45232e=_0x45232e-0x0;var _0x15c0a2=_0x6737[_0x45232e];return _0x15c0a2;};'use strict';var EventEmitter=require(_0x7673('0x0'));var SmsQueue=require(_0x7673('0x1'))['db'][_0x7673('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x7673('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7673('0x4'),'afterDestroy':_0x7673('0x5')};function emitEvent(_0x2e0892){return function(_0x193c7f,_0x4f9f2f,_0x5fbf9e){SmsQueueEvents[_0x7673('0x6')](_0x2e0892+':'+_0x193c7f['id'],_0x193c7f);SmsQueueEvents[_0x7673('0x6')](_0x2e0892,_0x193c7f);_0x5fbf9e(null);};}for(var e in events){if(events[_0x7673('0x7')](e)){var event=events[e];SmsQueue[_0x7673('0x8')](e,emitEvent(event));}}module[_0x7673('0x9')]=SmsQueueEvents; \ No newline at end of file +var _0xdd03=['save','update','emit','hasOwnProperty','hook','events','../../mysqldb','SmsQueue','setMaxListeners'];(function(_0x19e297,_0x2541e9){var _0x37cec8=function(_0x3b4176){while(--_0x3b4176){_0x19e297['push'](_0x19e297['shift']());}};_0x37cec8(++_0x2541e9);}(_0xdd03,0x71));var _0x3dd0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd03[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x3dd0('0x0'));var SmsQueue=require(_0x3dd0('0x1'))['db'][_0x3dd0('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x3dd0('0x3')](0x0);var events={'afterCreate':_0x3dd0('0x4'),'afterUpdate':_0x3dd0('0x5'),'afterDestroy':'remove'};function emitEvent(_0x10bf2f){return function(_0x5cb695,_0x55e70d,_0x3cf602){SmsQueueEvents[_0x3dd0('0x6')](_0x10bf2f+':'+_0x5cb695['id'],_0x5cb695);SmsQueueEvents[_0x3dd0('0x6')](_0x10bf2f,_0x5cb695);_0x3cf602(null);};}for(var e in events){if(events[_0x3dd0('0x7')](e)){var event=events[e];SmsQueue[_0x3dd0('0x8')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 59e94b2..65abb64 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 _0xc812=['SmsQueue','sms_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','define'];(function(_0x1f8feb,_0x41808d){var _0x111ead=function(_0x1a336b){while(--_0x1a336b){_0x1f8feb['push'](_0x1f8feb['shift']());}};_0x111ead(++_0x41808d);}(_0xc812,0x162));var _0x2c81=function(_0xda572e,_0x563565){_0xda572e=_0xda572e-0x0;var _0x49e5a3=_0xc812[_0xda572e];return _0x49e5a3;};'use strict';var _=require(_0x2c81('0x0'));var util=require(_0x2c81('0x1'));var logger=require(_0x2c81('0x2'))(_0x2c81('0x3'));var moment=require(_0x2c81('0x4'));var BPromise=require(_0x2c81('0x5'));var rp=require(_0x2c81('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2c81('0x7'));var config=require('../../config/environment');var attributes=require('./smsQueue.attributes');module['exports']=function(_0x36b26b,_0x2388cb){return _0x36b26b[_0x2c81('0x8')](_0x2c81('0x9'),attributes,{'tableName':_0x2c81('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb476=['moment','bluebird','request-promise','path','../../config/environment','./smsQueue.attributes','exports','define','lodash','api'];(function(_0x2f6c38,_0x4b067a){var _0x66279f=function(_0x13c4b5){while(--_0x13c4b5){_0x2f6c38['push'](_0x2f6c38['shift']());}};_0x66279f(++_0x4b067a);}(_0xb476,0x76));var _0x6b47=function(_0xcd5a3d,_0x3c5b33){_0xcd5a3d=_0xcd5a3d-0x0;var _0xd43207=_0xb476[_0xcd5a3d];return _0xd43207;};'use strict';var _=require(_0x6b47('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6b47('0x1'));var moment=require(_0x6b47('0x2'));var BPromise=require(_0x6b47('0x3'));var rp=require(_0x6b47('0x4'));var fs=require('fs');var path=require(_0x6b47('0x5'));var rimraf=require('rimraf');var config=require(_0x6b47('0x6'));var attributes=require(_0x6b47('0x7'));module[_0x6b47('0x8')]=function(_0x361425,_0xa57767){return _0x361425[_0x6b47('0x9')]('SmsQueue',attributes,{'tableName':'sms_queues','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 2014c28..78637fa 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 _0x08e8=['http','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetSmsQueue','SmsQueue','options','raw','where','attributes','limit','include','map','model','stringify','ShowSmsQueue','find','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x08e8,0x122));var _0x808e=function(_0x4f94f6,_0x3cc437){_0x4f94f6=_0x4f94f6-0x0;var _0x512a4b=_0x08e8[_0x4f94f6];return _0x512a4b;};'use strict';var _=require('lodash');var util=require(_0x808e('0x0'));var moment=require(_0x808e('0x1'));var BPromise=require(_0x808e('0x2'));var rs=require(_0x808e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x808e('0x4'))['db'];var utils=require(_0x808e('0x5'));var logger=require(_0x808e('0x6'))(_0x808e('0x7'));var config=require(_0x808e('0x8'));var jayson=require(_0x808e('0x9'));var client=jayson[_0x808e('0xa')][_0x808e('0xb')]({'port':0x232a});config['redis']=_[_0x808e('0xc')](config[_0x808e('0xd')],{'host':_0x808e('0xe'),'port':0x18eb});var socket=require(_0x808e('0xf'))(new Redis(config[_0x808e('0xd')]));require(_0x808e('0x10'))[_0x808e('0x11')](socket);function respondWithRpcPromise(_0x4a1561,_0x5bae3b,_0x130b40){return new BPromise(function(_0x1300dd,_0x1c2157){return client[_0x808e('0x12')](_0x4a1561,_0x130b40)[_0x808e('0x13')](function(_0x3cc4d3){logger[_0x808e('0x14')](_0x808e('0x15'),_0x5bae3b,_0x808e('0x16'));logger[_0x808e('0x17')](_0x808e('0x18'),_0x5bae3b,_0x808e('0x16'),JSON['stringify'](_0x3cc4d3));if(_0x3cc4d3[_0x808e('0x19')]){if(_0x3cc4d3[_0x808e('0x19')][_0x808e('0x1a')]===0x1f4){logger[_0x808e('0x19')](_0x808e('0x15'),_0x5bae3b,_0x3cc4d3['error']['message']);return _0x1c2157(_0x3cc4d3[_0x808e('0x19')]['message']);}logger[_0x808e('0x19')](_0x808e('0x15'),_0x5bae3b,_0x3cc4d3[_0x808e('0x19')][_0x808e('0x1b')]);return _0x1300dd(_0x3cc4d3[_0x808e('0x19')][_0x808e('0x1b')]);}else{logger[_0x808e('0x14')](_0x808e('0x15'),_0x5bae3b,_0x808e('0x16'));_0x1300dd(_0x3cc4d3[_0x808e('0x1c')]['message']);}})[_0x808e('0x1d')](function(_0x6ab826){logger[_0x808e('0x19')]('SmsQueue,\x20%s,\x20%s',_0x5bae3b,_0x6ab826);_0x1c2157(_0x6ab826);});});}exports[_0x808e('0x1e')]=function(_0x580919){var _0x3aad12=this;return new Promise(function(_0x50675e,_0x364709){return db[_0x808e('0x1f')]['findAll']({'raw':_0x580919[_0x808e('0x20')]?_0x580919[_0x808e('0x20')][_0x808e('0x21')]===undefined?!![]:![]:!![],'where':_0x580919[_0x808e('0x20')]?_0x580919[_0x808e('0x20')][_0x808e('0x22')]||null:null,'attributes':_0x580919['options']?_0x580919['options'][_0x808e('0x23')]||null:null,'limit':_0x580919[_0x808e('0x20')]?_0x580919[_0x808e('0x20')][_0x808e('0x24')]||null:null,'include':_0x580919['options']?_0x580919[_0x808e('0x20')][_0x808e('0x25')]?_['map'](_0x580919[_0x808e('0x20')][_0x808e('0x25')],function(_0x3df6ab){return{'model':db[_0x3df6ab['model']],'as':_0x3df6ab['as'],'attributes':_0x3df6ab['attributes'],'include':_0x3df6ab[_0x808e('0x25')]?_[_0x808e('0x26')](_0x3df6ab[_0x808e('0x25')],function(_0x57ecb4){return{'model':db[_0x57ecb4['model']],'as':_0x57ecb4['as'],'attributes':_0x57ecb4[_0x808e('0x23')],'include':_0x57ecb4[_0x808e('0x25')]?_['map'](_0x57ecb4[_0x808e('0x25')],function(_0x4e75c7){return{'model':db[_0x4e75c7[_0x808e('0x27')]],'as':_0x4e75c7['as'],'attributes':_0x4e75c7['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x43cdd3){logger['info']('GetSmsQueue',_0x580919);logger[_0x808e('0x17')]('GetSmsQueue',_0x580919,JSON[_0x808e('0x28')](_0x43cdd3));_0x50675e(_0x43cdd3);})[_0x808e('0x1d')](function(_0xcfb61){logger[_0x808e('0x19')]('GetSmsQueue',_0xcfb61['message'],_0x580919);_0x364709(_0x3aad12[_0x808e('0x19')](0x1f4,_0xcfb61[_0x808e('0x1b')]));});});};exports[_0x808e('0x29')]=function(_0x28d2da){var _0x4abf68=this;return new Promise(function(_0x379d5b,_0x42ccc4){return db[_0x808e('0x1f')][_0x808e('0x2a')]({'raw':_0x28d2da['options']?_0x28d2da[_0x808e('0x20')][_0x808e('0x21')]===undefined?!![]:![]:!![],'where':_0x28d2da[_0x808e('0x20')]?_0x28d2da['options'][_0x808e('0x22')]||null:null,'attributes':_0x28d2da['options']?_0x28d2da['options'][_0x808e('0x23')]||null:null,'include':_0x28d2da[_0x808e('0x20')]?_0x28d2da['options'][_0x808e('0x25')]?_['map'](_0x28d2da[_0x808e('0x20')][_0x808e('0x25')],function(_0x4ae319){return{'model':db[_0x4ae319[_0x808e('0x27')]],'as':_0x4ae319['as'],'attributes':_0x4ae319[_0x808e('0x23')],'include':_0x4ae319['include']?_[_0x808e('0x26')](_0x4ae319[_0x808e('0x25')],function(_0x25b747){return{'model':db[_0x25b747['model']],'as':_0x25b747['as'],'attributes':_0x25b747[_0x808e('0x23')],'include':_0x25b747[_0x808e('0x25')]?_[_0x808e('0x26')](_0x25b747[_0x808e('0x25')],function(_0x1bab74){return{'model':db[_0x1bab74['model']],'as':_0x1bab74['as'],'attributes':_0x1bab74[_0x808e('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x55add2){logger[_0x808e('0x14')]('ShowSmsQueue',_0x28d2da);logger['debug']('ShowSmsQueue',_0x28d2da,JSON[_0x808e('0x28')](_0x55add2));_0x379d5b(_0x55add2);})['catch'](function(_0x56351d){logger[_0x808e('0x19')](_0x808e('0x29'),_0x56351d[_0x808e('0x1b')],_0x28d2da);_0x42ccc4(_0x4abf68[_0x808e('0x19')](0x1f4,_0x56351d[_0x808e('0x1b')]));});});}; \ No newline at end of file +var _0x89a5=['raw','attributes','include','map','model','ShowSmsQueue','SmsQueue','where','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','redis','defaults','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetSmsQueue','findAll','options'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x89a5,0x71));var _0x589a=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0x89a5[_0x38537f];return _0x141e23;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x589a('0x0'));var BPromise=require(_0x589a('0x1'));var rs=require(_0x589a('0x2'));var fs=require('fs');var Redis=require(_0x589a('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x589a('0x4'));var jayson=require(_0x589a('0x5'));var client=jayson[_0x589a('0x6')]['http']({'port':0x232a});config[_0x589a('0x7')]=_[_0x589a('0x8')](config[_0x589a('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x589a('0x7')]));require(_0x589a('0x9'))[_0x589a('0xa')](socket);function respondWithRpcPromise(_0xc92466,_0x5409e5,_0x33a806){return new BPromise(function(_0x10e5d0,_0x4db993){return client[_0x589a('0xb')](_0xc92466,_0x33a806)[_0x589a('0xc')](function(_0x5ab152){logger[_0x589a('0xd')](_0x589a('0xe'),_0x5409e5,_0x589a('0xf'));logger[_0x589a('0x10')](_0x589a('0x11'),_0x5409e5,_0x589a('0xf'),JSON[_0x589a('0x12')](_0x5ab152));if(_0x5ab152['error']){if(_0x5ab152['error'][_0x589a('0x13')]===0x1f4){logger[_0x589a('0x14')]('SmsQueue,\x20%s,\x20%s',_0x5409e5,_0x5ab152[_0x589a('0x14')]['message']);return _0x4db993(_0x5ab152['error'][_0x589a('0x15')]);}logger['error']('SmsQueue,\x20%s,\x20%s',_0x5409e5,_0x5ab152['error']['message']);return _0x10e5d0(_0x5ab152[_0x589a('0x14')][_0x589a('0x15')]);}else{logger[_0x589a('0xd')](_0x589a('0xe'),_0x5409e5,'request\x20sent');_0x10e5d0(_0x5ab152[_0x589a('0x16')]['message']);}})[_0x589a('0x17')](function(_0x4d3ba4){logger['error'](_0x589a('0xe'),_0x5409e5,_0x4d3ba4);_0x4db993(_0x4d3ba4);});});}exports[_0x589a('0x18')]=function(_0x14e8ce){var _0x489020=this;return new Promise(function(_0x4a9d3f,_0x57d3b4){return db['SmsQueue'][_0x589a('0x19')]({'raw':_0x14e8ce[_0x589a('0x1a')]?_0x14e8ce[_0x589a('0x1a')][_0x589a('0x1b')]===undefined?!![]:![]:!![],'where':_0x14e8ce['options']?_0x14e8ce[_0x589a('0x1a')]['where']||null:null,'attributes':_0x14e8ce[_0x589a('0x1a')]?_0x14e8ce['options'][_0x589a('0x1c')]||null:null,'limit':_0x14e8ce[_0x589a('0x1a')]?_0x14e8ce['options']['limit']||null:null,'include':_0x14e8ce[_0x589a('0x1a')]?_0x14e8ce['options'][_0x589a('0x1d')]?_[_0x589a('0x1e')](_0x14e8ce[_0x589a('0x1a')][_0x589a('0x1d')],function(_0x56d241){return{'model':db[_0x56d241[_0x589a('0x1f')]],'as':_0x56d241['as'],'attributes':_0x56d241[_0x589a('0x1c')],'include':_0x56d241[_0x589a('0x1d')]?_[_0x589a('0x1e')](_0x56d241[_0x589a('0x1d')],function(_0x396172){return{'model':db[_0x396172['model']],'as':_0x396172['as'],'attributes':_0x396172[_0x589a('0x1c')],'include':_0x396172[_0x589a('0x1d')]?_['map'](_0x396172[_0x589a('0x1d')],function(_0x3f5a11){return{'model':db[_0x3f5a11['model']],'as':_0x3f5a11['as'],'attributes':_0x3f5a11[_0x589a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x589a('0xc')](function(_0x114337){logger[_0x589a('0xd')]('GetSmsQueue',_0x14e8ce);logger[_0x589a('0x10')]('GetSmsQueue',_0x14e8ce,JSON[_0x589a('0x12')](_0x114337));_0x4a9d3f(_0x114337);})[_0x589a('0x17')](function(_0x1b82dd){logger[_0x589a('0x14')](_0x589a('0x18'),_0x1b82dd['message'],_0x14e8ce);_0x57d3b4(_0x489020[_0x589a('0x14')](0x1f4,_0x1b82dd[_0x589a('0x15')]));});});};exports[_0x589a('0x20')]=function(_0x5584c1){var _0x18449c=this;return new Promise(function(_0x15d1d7,_0xfa5c17){return db[_0x589a('0x21')]['find']({'raw':_0x5584c1[_0x589a('0x1a')]?_0x5584c1[_0x589a('0x1a')][_0x589a('0x1b')]===undefined?!![]:![]:!![],'where':_0x5584c1[_0x589a('0x1a')]?_0x5584c1['options'][_0x589a('0x22')]||null:null,'attributes':_0x5584c1[_0x589a('0x1a')]?_0x5584c1['options'][_0x589a('0x1c')]||null:null,'include':_0x5584c1[_0x589a('0x1a')]?_0x5584c1['options'][_0x589a('0x1d')]?_[_0x589a('0x1e')](_0x5584c1[_0x589a('0x1a')][_0x589a('0x1d')],function(_0x59e167){return{'model':db[_0x59e167['model']],'as':_0x59e167['as'],'attributes':_0x59e167['attributes'],'include':_0x59e167['include']?_[_0x589a('0x1e')](_0x59e167[_0x589a('0x1d')],function(_0x1d39a7){return{'model':db[_0x1d39a7[_0x589a('0x1f')]],'as':_0x1d39a7['as'],'attributes':_0x1d39a7[_0x589a('0x1c')],'include':_0x1d39a7['include']?_[_0x589a('0x1e')](_0x1d39a7['include'],function(_0x33080c){return{'model':db[_0x33080c[_0x589a('0x1f')]],'as':_0x33080c['as'],'attributes':_0x33080c['attributes']};}):[]};}):[]};}):[]:[]})[_0x589a('0xc')](function(_0x4db971){logger[_0x589a('0xd')](_0x589a('0x20'),_0x5584c1);logger[_0x589a('0x10')](_0x589a('0x20'),_0x5584c1,JSON['stringify'](_0x4db971));_0x15d1d7(_0x4db971);})['catch'](function(_0x53e387){logger[_0x589a('0x14')](_0x589a('0x20'),_0x53e387[_0x589a('0x15')],_0x5584c1);_0xfa5c17(_0x18449c[_0x589a('0x14')](0x1f4,_0x53e387[_0x589a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 4a46a66..6438467 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 _0xd60e=['register','length','smsQueue:','./smsQueue.events','save','update','emit','removeListener'];(function(_0x39d578,_0x2985b3){var _0x425e12=function(_0x505207){while(--_0x505207){_0x39d578['push'](_0x39d578['shift']());}};_0x425e12(++_0x2985b3);}(_0xd60e,0xcb));var _0xed60=function(_0x7d8bff,_0x1976c6){_0x7d8bff=_0x7d8bff-0x0;var _0x1535ae=_0xd60e[_0x7d8bff];return _0x1535ae;};'use strict';var SmsQueueEvents=require(_0xed60('0x0'));var events=[_0xed60('0x1'),'remove',_0xed60('0x2')];function createListener(_0x497883,_0x2ce2eb){return function(_0x536186){_0x2ce2eb[_0xed60('0x3')](_0x497883,_0x536186);};}function removeListener(_0x1facf5,_0x562139){return function(){SmsQueueEvents[_0xed60('0x4')](_0x1facf5,_0x562139);};}exports[_0xed60('0x5')]=function(_0x4b7f9d){for(var _0x5b5f27=0x0,_0x32101b=events[_0xed60('0x6')];_0x5b5f27<_0x32101b;_0x5b5f27++){var _0x5584d8=events[_0x5b5f27];var _0x98580f=createListener(_0xed60('0x7')+_0x5584d8,_0x4b7f9d);SmsQueueEvents['on'](_0x5584d8,_0x98580f);}}; \ No newline at end of file +var _0x50f4=['smsQueue:','./smsQueue.events','save','remove','update','emit','removeListener','length'];(function(_0x500c3b,_0x1a7015){var _0x238cbc=function(_0x48a8e9){while(--_0x48a8e9){_0x500c3b['push'](_0x500c3b['shift']());}};_0x238cbc(++_0x1a7015);}(_0x50f4,0x121));var _0x450f=function(_0x32651e,_0x48964c){_0x32651e=_0x32651e-0x0;var _0x2e191f=_0x50f4[_0x32651e];return _0x2e191f;};'use strict';var SmsQueueEvents=require(_0x450f('0x0'));var events=[_0x450f('0x1'),_0x450f('0x2'),_0x450f('0x3')];function createListener(_0x235a37,_0x51aa96){return function(_0x1f4f69){_0x51aa96[_0x450f('0x4')](_0x235a37,_0x1f4f69);};}function removeListener(_0xf722f5,_0x4c2722){return function(){SmsQueueEvents[_0x450f('0x5')](_0xf722f5,_0x4c2722);};}exports['register']=function(_0x555194){for(var _0x3be607=0x0,_0xb68404=events[_0x450f('0x6')];_0x3be607<_0xb68404;_0x3be607++){var _0x5272db=events[_0x3be607];var _0xc84fa4=createListener(_0x450f('0x7')+_0x5272db,_0x555194);SmsQueueEvents['on'](_0x5272db,_0xc84fa4);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index f6ae984..737fdce 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 _0x724d=['/describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index'];(function(_0x555481,_0x4e1bf3){var _0x4b4a4f=function(_0x45e376){while(--_0x45e376){_0x555481['push'](_0x555481['shift']());}};_0x4b4a4f(++_0x4e1bf3);}(_0x724d,0xe5));var _0xd724=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x724d[_0x40ac5e];return _0x2839d6;};'use strict';var multer=require(_0xd724('0x0'));var util=require(_0xd724('0x1'));var path=require(_0xd724('0x2'));var timeout=require('connect-timeout');var express=require(_0xd724('0x3'));var router=express[_0xd724('0x4')]();var fs_extra=require(_0xd724('0x5'));var auth=require(_0xd724('0x6'));var interaction=require(_0xd724('0x7'));var config=require(_0xd724('0x8'));var controller=require(_0xd724('0x9'));router[_0xd724('0xa')]('/',auth[_0xd724('0xb')](),controller[_0xd724('0xc')]);router[_0xd724('0xa')](_0xd724('0xd'),auth[_0xd724('0xb')](),controller['describe']);router[_0xd724('0xa')](_0xd724('0xe'),auth[_0xd724('0xb')](),controller[_0xd724('0xf')]);router[_0xd724('0x10')]('/',auth[_0xd724('0xb')](),controller['create']);router[_0xd724('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xd724('0x12')]);router[_0xd724('0x13')](_0xd724('0xe'),auth[_0xd724('0xb')](),controller[_0xd724('0x14')]);module[_0xd724('0x15')]=router; \ No newline at end of file +var _0x1d7e=['get','isAuthenticated','index','/describe','describe','/:id','post','create','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller'];(function(_0x190d2c,_0x159734){var _0x83d998=function(_0x291357){while(--_0x291357){_0x190d2c['push'](_0x190d2c['shift']());}};_0x83d998(++_0x159734);}(_0x1d7e,0x7d));var _0xe1d7=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x1d7e[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require('multer');var util=require(_0xe1d7('0x0'));var path=require(_0xe1d7('0x1'));var timeout=require(_0xe1d7('0x2'));var express=require('express');var router=express[_0xe1d7('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe1d7('0x4'));var interaction=require(_0xe1d7('0x5'));var config=require(_0xe1d7('0x6'));var controller=require(_0xe1d7('0x7'));router[_0xe1d7('0x8')]('/',auth[_0xe1d7('0x9')](),controller[_0xe1d7('0xa')]);router[_0xe1d7('0x8')](_0xe1d7('0xb'),auth[_0xe1d7('0x9')](),controller[_0xe1d7('0xc')]);router['get'](_0xe1d7('0xd'),auth[_0xe1d7('0x9')](),controller['show']);router[_0xe1d7('0xe')]('/',auth['isAuthenticated'](),controller[_0xe1d7('0xf')]);router['put'](_0xe1d7('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xe1d7('0x10')](_0xe1d7('0xd'),auth[_0xe1d7('0x9')](),controller[_0xe1d7('0x11')]);module[_0xe1d7('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 1f0d5cf..9b49d5e 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 _0x004c=['exports','STRING','DATE','moment','sequelize'];(function(_0x1d817b,_0x5b70e5){var _0x50dac5=function(_0x12fd5d){while(--_0x12fd5d){_0x1d817b['push'](_0x1d817b['shift']());}};_0x50dac5(++_0x5b70e5);}(_0x004c,0x85));var _0xc004=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0x004c[_0x31a371];return _0x2a5bd6;};'use strict';var moment=require(_0xc004('0x0'));var Sequelize=require(_0xc004('0x1'));module[_0xc004('0x2')]={'uniqueid':{'type':Sequelize[_0xc004('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xc004('0x4')]},'leaveAt':{'type':Sequelize[_0xc004('0x4')]},'acceptAt':{'type':Sequelize[_0xc004('0x4')]},'exitAt':{'type':Sequelize[_0xc004('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4310=['STRING','DATE','moment','sequelize','exports'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x4310,0x110));var _0x0431=function(_0x2b3902,_0x5731c0){_0x2b3902=_0x2b3902-0x0;var _0x5ad953=_0x4310[_0x2b3902];return _0x5ad953;};'use strict';var moment=require(_0x0431('0x0'));var Sequelize=require(_0x0431('0x1'));module[_0x0431('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x0431('0x3')]},'joinAt':{'type':Sequelize[_0x0431('0x4')]},'leaveAt':{'type':Sequelize[_0x0431('0x4')]},'acceptAt':{'type':Sequelize[_0x0431('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x0431('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 3ae86ad..c2a7050 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 _0x3b15=['merge','map','VIRTUAL','filter','includeAll','include','findAll','show','params','keys','options','create','body','catch','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','name','index','SmsQueueReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where'];(function(_0x5aff1d,_0x4267c1){var _0x53c519=function(_0x2af464){while(--_0x2af464){_0x5aff1d['push'](_0x5aff1d['shift']());}};_0x53c519(++_0x4267c1);}(_0x3b15,0x148));var _0x53b1=function(_0x2e7a43,_0x3b3df4){_0x2e7a43=_0x2e7a43-0x0;var _0x52e9e1=_0x3b15[_0x2e7a43];return _0x52e9e1;};'use strict';var emlformat=require(_0x53b1('0x0'));var rimraf=require(_0x53b1('0x1'));var zipdir=require(_0x53b1('0x2'));var jsonpatch=require(_0x53b1('0x3'));var rp=require('request-promise');var moment=require(_0x53b1('0x4'));var BPromise=require(_0x53b1('0x5'));var Mustache=require(_0x53b1('0x6'));var util=require(_0x53b1('0x7'));var path=require('path');var sox=require(_0x53b1('0x8'));var csv=require(_0x53b1('0x9'));var ejs=require(_0x53b1('0xa'));var fs=require('fs');var fs_extra=require(_0x53b1('0xb'));var _=require(_0x53b1('0xc'));var squel=require(_0x53b1('0xd'));var crypto=require(_0x53b1('0xe'));var jsforce=require(_0x53b1('0xf'));var deskjs=require(_0x53b1('0x10'));var toCsv=require(_0x53b1('0x9'));var querystring=require(_0x53b1('0x11'));var Papa=require(_0x53b1('0x12'));var Redis=require('ioredis');var authService=require(_0x53b1('0x13'));var qs=require(_0x53b1('0x14'));var as=require(_0x53b1('0x15'));var hardwareService=require(_0x53b1('0x16'));var logger=require('../../config/logger')(_0x53b1('0x17'));var utils=require('../../config/utils');var config=require(_0x53b1('0x18'));var licenseUtil=require(_0x53b1('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ef62d,_0x127171){_0x127171=_0x127171||0xcc;return function(_0x4fccfb){if(_0x4fccfb){return _0x1ef62d[_0x53b1('0x1a')](_0x127171);}return _0x1ef62d['status'](_0x127171)[_0x53b1('0x1b')]();};}function respondWithResult(_0x118964,_0xa09429){_0xa09429=_0xa09429||0xc8;return function(_0x558636){if(_0x558636){return _0x118964[_0x53b1('0x1c')](_0xa09429)[_0x53b1('0x1d')](_0x558636);}};}function respondWithFilteredResult(_0x5a3084,_0x26beb2){return function(_0x26e381){if(_0x26e381){var _0x509670=typeof _0x26beb2[_0x53b1('0x1e')]===_0x53b1('0x1f')&&typeof _0x26beb2[_0x53b1('0x20')]===_0x53b1('0x1f');var _0x55ea3d=_0x26e381[_0x53b1('0x21')];var _0x53431e=_0x509670?0x0:_0x26beb2['offset'];var _0x3eacf7=_0x509670?_0x26e381[_0x53b1('0x21')]:_0x26beb2[_0x53b1('0x1e')]+_0x26beb2['limit'];var _0x3a0608;if(_0x3eacf7>=_0x55ea3d){_0x3eacf7=_0x55ea3d;_0x3a0608=0xc8;}else{_0x3a0608=0xce;}_0x5a3084['status'](_0x3a0608);return _0x5a3084[_0x53b1('0x22')](_0x53b1('0x23'),_0x53431e+'-'+_0x3eacf7+'/'+_0x55ea3d)[_0x53b1('0x1d')](_0x26e381);}return null;};}function patchUpdates(_0x460d58){return function(_0x5ed2e6){try{jsonpatch[_0x53b1('0x24')](_0x5ed2e6,_0x460d58,!![]);}catch(_0x4470e7){return BPromise[_0x53b1('0x25')](_0x4470e7);}return _0x5ed2e6[_0x53b1('0x26')]();};}function saveUpdates(_0x5c5742,_0xb9980a){return function(_0x31a98c){if(_0x31a98c){return _0x31a98c[_0x53b1('0x27')](_0x5c5742)['then'](function(_0x50b732){return _0x50b732;});}return null;};}function removeEntity(_0x143191,_0x49c121){return function(_0x410cad){if(_0x410cad){return _0x410cad[_0x53b1('0x28')]()[_0x53b1('0x29')](function(){_0x143191[_0x53b1('0x1c')](0xcc)[_0x53b1('0x1b')]();});}};}function handleEntityNotFound(_0x1de749,_0x41cf4a){return function(_0x5201e2){if(!_0x5201e2){_0x1de749[_0x53b1('0x1a')](0x194);}return _0x5201e2;};}function handleError(_0x53ca4c,_0x45c546){_0x45c546=_0x45c546||0x1f4;return function(_0x23efbc){logger[_0x53b1('0x2a')](_0x23efbc['stack']);if(_0x23efbc[_0x53b1('0x2b')]){delete _0x23efbc['name'];}_0x53ca4c[_0x53b1('0x1c')](_0x45c546)['send'](_0x23efbc);};}exports[_0x53b1('0x2c')]=function(_0x48dfa0,_0xb1963f){var _0x152828={},_0x53ad6e={},_0x3b916d={'count':0x0,'rows':[]};var _0x3a171e=_['map'](db[_0x53b1('0x2d')][_0x53b1('0x2e')],function(_0x4895ed){return{'name':_0x4895ed[_0x53b1('0x2f')],'type':_0x4895ed['type'][_0x53b1('0x30')]};});_0x53ad6e[_0x53b1('0x31')]=_['map'](_0x3a171e,_0x53b1('0x2b'));_0x53ad6e[_0x53b1('0x32')]=_['keys'](_0x48dfa0[_0x53b1('0x32')]);_0x53ad6e[_0x53b1('0x33')]=_[_0x53b1('0x34')](_0x53ad6e[_0x53b1('0x31')],_0x53ad6e[_0x53b1('0x32')]);_0x152828[_0x53b1('0x35')]=_['intersection'](_0x53ad6e[_0x53b1('0x31')],qs[_0x53b1('0x36')](_0x48dfa0['query'][_0x53b1('0x36')]));_0x152828[_0x53b1('0x35')]=_0x152828[_0x53b1('0x35')][_0x53b1('0x37')]?_0x152828[_0x53b1('0x35')]:_0x53ad6e[_0x53b1('0x31')];if(!_0x48dfa0['query'][_0x53b1('0x38')](_0x53b1('0x39'))){_0x152828[_0x53b1('0x20')]=qs[_0x53b1('0x20')](_0x48dfa0[_0x53b1('0x32')][_0x53b1('0x20')]);_0x152828[_0x53b1('0x1e')]=qs[_0x53b1('0x1e')](_0x48dfa0['query']['offset']);}_0x152828[_0x53b1('0x3a')]=qs[_0x53b1('0x3b')](_0x48dfa0[_0x53b1('0x32')][_0x53b1('0x3b')]);_0x152828['where']=qs[_0x53b1('0x33')](_[_0x53b1('0x3c')](_0x48dfa0[_0x53b1('0x32')],_0x53ad6e['filters']),_0x3a171e);if(_0x48dfa0[_0x53b1('0x32')]['filter']){_0x152828[_0x53b1('0x3d')]=_[_0x53b1('0x3e')](_0x152828[_0x53b1('0x3d')],{'$or':_[_0x53b1('0x3f')](_0x3a171e,function(_0x3b1a44){if(_0x3b1a44['type']!==_0x53b1('0x40')){var _0x34270b={};_0x34270b[_0x3b1a44[_0x53b1('0x2b')]]={'$like':'%'+_0x48dfa0[_0x53b1('0x32')][_0x53b1('0x41')]+'%'};return _0x34270b;}})});}_0x152828=_['merge']({},_0x152828,_0x48dfa0['options']);var _0x1f152d={'where':_0x152828[_0x53b1('0x3d')]};return db[_0x53b1('0x2d')][_0x53b1('0x21')](_0x1f152d)[_0x53b1('0x29')](function(_0x53c578){_0x3b916d[_0x53b1('0x21')]=_0x53c578;if(_0x48dfa0[_0x53b1('0x32')][_0x53b1('0x42')]){_0x152828[_0x53b1('0x43')]=[{'all':!![]}];}return db[_0x53b1('0x2d')][_0x53b1('0x44')](_0x152828);})[_0x53b1('0x29')](function(_0x3b15d2){_0x3b916d['rows']=_0x3b15d2;return _0x3b916d;})[_0x53b1('0x29')](respondWithFilteredResult(_0xb1963f,_0x152828))['catch'](handleError(_0xb1963f,null));};exports[_0x53b1('0x45')]=function(_0x5035af,_0x33e374){var _0x478dd6={'raw':!![],'where':{'id':_0x5035af[_0x53b1('0x46')]['id']}},_0x2399ca={};_0x2399ca[_0x53b1('0x31')]=_[_0x53b1('0x47')](db[_0x53b1('0x2d')][_0x53b1('0x2e')]);_0x2399ca[_0x53b1('0x32')]=_[_0x53b1('0x47')](_0x5035af[_0x53b1('0x32')]);_0x2399ca['filters']=_[_0x53b1('0x34')](_0x2399ca[_0x53b1('0x31')],_0x2399ca['query']);_0x478dd6[_0x53b1('0x35')]=_['intersection'](_0x2399ca[_0x53b1('0x31')],qs[_0x53b1('0x36')](_0x5035af[_0x53b1('0x32')]['fields']));_0x478dd6[_0x53b1('0x35')]=_0x478dd6[_0x53b1('0x35')][_0x53b1('0x37')]?_0x478dd6[_0x53b1('0x35')]:_0x2399ca[_0x53b1('0x31')];if(_0x5035af[_0x53b1('0x32')][_0x53b1('0x42')]){_0x478dd6[_0x53b1('0x43')]=[{'all':!![]}];}_0x478dd6=_[_0x53b1('0x3e')]({},_0x478dd6,_0x5035af[_0x53b1('0x48')]);return db['SmsQueueReport']['find'](_0x478dd6)[_0x53b1('0x29')](handleEntityNotFound(_0x33e374,null))[_0x53b1('0x29')](respondWithResult(_0x33e374,null))['catch'](handleError(_0x33e374,null));};exports[_0x53b1('0x49')]=function(_0x435e73,_0x1b1306){return db['SmsQueueReport']['create'](_0x435e73[_0x53b1('0x4a')],{})[_0x53b1('0x29')](respondWithResult(_0x1b1306,0xc9))[_0x53b1('0x4b')](handleError(_0x1b1306,null));};exports['update']=function(_0x10261b,_0x117b2a){if(_0x10261b['body']['id']){delete _0x10261b['body']['id'];}return db['SmsQueueReport']['find']({'where':{'id':_0x10261b[_0x53b1('0x46')]['id']}})[_0x53b1('0x29')](handleEntityNotFound(_0x117b2a,null))['then'](saveUpdates(_0x10261b[_0x53b1('0x4a')],null))[_0x53b1('0x29')](respondWithResult(_0x117b2a,null))[_0x53b1('0x4b')](handleError(_0x117b2a,null));};exports[_0x53b1('0x28')]=function(_0xc91ea8,_0x14b125){return db['SmsQueueReport'][_0x53b1('0x4c')]({'where':{'id':_0xc91ea8[_0x53b1('0x46')]['id']}})[_0x53b1('0x29')](handleEntityNotFound(_0x14b125,null))[_0x53b1('0x29')](removeEntity(_0x14b125,null))[_0x53b1('0x4b')](handleError(_0x14b125,null));};exports[_0x53b1('0x4d')]=function(_0x237924,_0x4bef2f){return db[_0x53b1('0x2d')][_0x53b1('0x4d')]()[_0x53b1('0x29')](respondWithResult(_0x4bef2f,null))[_0x53b1('0x4b')](handleError(_0x4bef2f,null));}; \ No newline at end of file +var _0x73a1=['offset','undefined','count','set','apply','reject','update','destroy','then','error','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','type','VIRTUAL','name','filter','options','SmsQueueReport','includeAll','include','findAll','rows','params','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','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','../../mysqldb','sendStatus','status','json'];(function(_0x4cac67,_0x2555cf){var _0x281c19=function(_0x25c25f){while(--_0x25c25f){_0x4cac67['push'](_0x4cac67['shift']());}};_0x281c19(++_0x2555cf);}(_0x73a1,0x1ef));var _0x173a=function(_0x17a32f,_0x5a51a){_0x17a32f=_0x17a32f-0x0;var _0x15a293=_0x73a1[_0x17a32f];return _0x15a293;};'use strict';var emlformat=require(_0x173a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x173a('0x1'));var jsonpatch=require(_0x173a('0x2'));var rp=require(_0x173a('0x3'));var moment=require(_0x173a('0x4'));var BPromise=require(_0x173a('0x5'));var Mustache=require(_0x173a('0x6'));var util=require(_0x173a('0x7'));var path=require(_0x173a('0x8'));var sox=require(_0x173a('0x9'));var csv=require(_0x173a('0xa'));var ejs=require(_0x173a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x173a('0xc'));var squel=require(_0x173a('0xd'));var crypto=require(_0x173a('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x173a('0xf'));var toCsv=require('to-csv');var querystring=require(_0x173a('0x10'));var Papa=require('papaparse');var Redis=require(_0x173a('0x11'));var authService=require(_0x173a('0x12'));var qs=require(_0x173a('0x13'));var as=require(_0x173a('0x14'));var hardwareService=require(_0x173a('0x15'));var logger=require('../../config/logger')(_0x173a('0x16'));var utils=require(_0x173a('0x17'));var config=require(_0x173a('0x18'));var licenseUtil=require(_0x173a('0x19'));var db=require(_0x173a('0x1a'))['db'];function respondWithStatusCode(_0x47ea22,_0xd19c8){_0xd19c8=_0xd19c8||0xcc;return function(_0x33c40e){if(_0x33c40e){return _0x47ea22[_0x173a('0x1b')](_0xd19c8);}return _0x47ea22[_0x173a('0x1c')](_0xd19c8)['end']();};}function respondWithResult(_0x5be871,_0x4ce3fa){_0x4ce3fa=_0x4ce3fa||0xc8;return function(_0x23123e){if(_0x23123e){return _0x5be871[_0x173a('0x1c')](_0x4ce3fa)[_0x173a('0x1d')](_0x23123e);}};}function respondWithFilteredResult(_0x30679b,_0x2d3a61){return function(_0x26154f){if(_0x26154f){var _0xcf550d=typeof _0x2d3a61[_0x173a('0x1e')]===_0x173a('0x1f')&&typeof _0x2d3a61['limit']===_0x173a('0x1f');var _0x2a9dcf=_0x26154f[_0x173a('0x20')];var _0x1e6210=_0xcf550d?0x0:_0x2d3a61['offset'];var _0x3d8010=_0xcf550d?_0x26154f[_0x173a('0x20')]:_0x2d3a61[_0x173a('0x1e')]+_0x2d3a61['limit'];var _0x5bdaed;if(_0x3d8010>=_0x2a9dcf){_0x3d8010=_0x2a9dcf;_0x5bdaed=0xc8;}else{_0x5bdaed=0xce;}_0x30679b['status'](_0x5bdaed);return _0x30679b[_0x173a('0x21')]('Content-Range',_0x1e6210+'-'+_0x3d8010+'/'+_0x2a9dcf)[_0x173a('0x1d')](_0x26154f);}return null;};}function patchUpdates(_0x42dc70){return function(_0x3f2dc8){try{jsonpatch[_0x173a('0x22')](_0x3f2dc8,_0x42dc70,!![]);}catch(_0x2b097b){return BPromise[_0x173a('0x23')](_0x2b097b);}return _0x3f2dc8['save']();};}function saveUpdates(_0xbd15f1,_0x573e22){return function(_0x3bba94){if(_0x3bba94){return _0x3bba94[_0x173a('0x24')](_0xbd15f1)['then'](function(_0x526f46){return _0x526f46;});}return null;};}function removeEntity(_0x1ef3cb,_0x1b467b){return function(_0x2c5161){if(_0x2c5161){return _0x2c5161[_0x173a('0x25')]()[_0x173a('0x26')](function(){_0x1ef3cb[_0x173a('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19d0a7,_0xf4a8b4){return function(_0x45d88a){if(!_0x45d88a){_0x19d0a7[_0x173a('0x1b')](0x194);}return _0x45d88a;};}function handleError(_0x134977,_0x526103){_0x526103=_0x526103||0x1f4;return function(_0x372ef7){logger[_0x173a('0x27')](_0x372ef7['stack']);if(_0x372ef7['name']){delete _0x372ef7['name'];}_0x134977[_0x173a('0x1c')](_0x526103)['send'](_0x372ef7);};}exports[_0x173a('0x28')]=function(_0x574fbf,_0x5abf50){var _0x2eda24={},_0x5f36e6={},_0x305f27={'count':0x0,'rows':[]};var _0x4b5966=_[_0x173a('0x29')](db['SmsQueueReport'][_0x173a('0x2a')],function(_0x12a2cb){return{'name':_0x12a2cb[_0x173a('0x2b')],'type':_0x12a2cb['type']['key']};});_0x5f36e6[_0x173a('0x2c')]=_[_0x173a('0x29')](_0x4b5966,'name');_0x5f36e6[_0x173a('0x2d')]=_[_0x173a('0x2e')](_0x574fbf[_0x173a('0x2d')]);_0x5f36e6[_0x173a('0x2f')]=_[_0x173a('0x30')](_0x5f36e6[_0x173a('0x2c')],_0x5f36e6[_0x173a('0x2d')]);_0x2eda24[_0x173a('0x31')]=_[_0x173a('0x30')](_0x5f36e6[_0x173a('0x2c')],qs[_0x173a('0x32')](_0x574fbf['query'][_0x173a('0x32')]));_0x2eda24[_0x173a('0x31')]=_0x2eda24[_0x173a('0x31')][_0x173a('0x33')]?_0x2eda24[_0x173a('0x31')]:_0x5f36e6[_0x173a('0x2c')];if(!_0x574fbf['query'][_0x173a('0x34')](_0x173a('0x35'))){_0x2eda24[_0x173a('0x36')]=qs['limit'](_0x574fbf[_0x173a('0x2d')][_0x173a('0x36')]);_0x2eda24[_0x173a('0x1e')]=qs[_0x173a('0x1e')](_0x574fbf[_0x173a('0x2d')][_0x173a('0x1e')]);}_0x2eda24[_0x173a('0x37')]=qs[_0x173a('0x38')](_0x574fbf[_0x173a('0x2d')][_0x173a('0x38')]);_0x2eda24[_0x173a('0x39')]=qs[_0x173a('0x2f')](_['pick'](_0x574fbf[_0x173a('0x2d')],_0x5f36e6[_0x173a('0x2f')]),_0x4b5966);if(_0x574fbf[_0x173a('0x2d')]['filter']){_0x2eda24['where']=_[_0x173a('0x3a')](_0x2eda24[_0x173a('0x39')],{'$or':_[_0x173a('0x29')](_0x4b5966,function(_0x3ede47){if(_0x3ede47[_0x173a('0x3b')]!==_0x173a('0x3c')){var _0x17c37b={};_0x17c37b[_0x3ede47[_0x173a('0x3d')]]={'$like':'%'+_0x574fbf['query'][_0x173a('0x3e')]+'%'};return _0x17c37b;}})});}_0x2eda24=_[_0x173a('0x3a')]({},_0x2eda24,_0x574fbf[_0x173a('0x3f')]);var _0x33b606={'where':_0x2eda24[_0x173a('0x39')]};return db[_0x173a('0x40')][_0x173a('0x20')](_0x33b606)[_0x173a('0x26')](function(_0x201d05){_0x305f27['count']=_0x201d05;if(_0x574fbf[_0x173a('0x2d')][_0x173a('0x41')]){_0x2eda24[_0x173a('0x42')]=[{'all':!![]}];}return db[_0x173a('0x40')][_0x173a('0x43')](_0x2eda24);})[_0x173a('0x26')](function(_0x476bc9){_0x305f27[_0x173a('0x44')]=_0x476bc9;return _0x305f27;})[_0x173a('0x26')](respondWithFilteredResult(_0x5abf50,_0x2eda24))['catch'](handleError(_0x5abf50,null));};exports['show']=function(_0xab8a80,_0x2365ea){var _0x15b4df={'raw':!![],'where':{'id':_0xab8a80[_0x173a('0x45')]['id']}},_0x269136={};_0x269136[_0x173a('0x2c')]=_[_0x173a('0x2e')](db[_0x173a('0x40')]['rawAttributes']);_0x269136[_0x173a('0x2d')]=_[_0x173a('0x2e')](_0xab8a80[_0x173a('0x2d')]);_0x269136['filters']=_[_0x173a('0x30')](_0x269136[_0x173a('0x2c')],_0x269136[_0x173a('0x2d')]);_0x15b4df[_0x173a('0x31')]=_['intersection'](_0x269136[_0x173a('0x2c')],qs[_0x173a('0x32')](_0xab8a80[_0x173a('0x2d')]['fields']));_0x15b4df['attributes']=_0x15b4df[_0x173a('0x31')]['length']?_0x15b4df['attributes']:_0x269136[_0x173a('0x2c')];if(_0xab8a80[_0x173a('0x2d')][_0x173a('0x41')]){_0x15b4df[_0x173a('0x42')]=[{'all':!![]}];}_0x15b4df=_[_0x173a('0x3a')]({},_0x15b4df,_0xab8a80[_0x173a('0x3f')]);return db[_0x173a('0x40')][_0x173a('0x46')](_0x15b4df)[_0x173a('0x26')](handleEntityNotFound(_0x2365ea,null))[_0x173a('0x26')](respondWithResult(_0x2365ea,null))[_0x173a('0x47')](handleError(_0x2365ea,null));};exports[_0x173a('0x48')]=function(_0x287582,_0x450a40){return db[_0x173a('0x40')][_0x173a('0x48')](_0x287582[_0x173a('0x49')],{})[_0x173a('0x26')](respondWithResult(_0x450a40,0xc9))[_0x173a('0x47')](handleError(_0x450a40,null));};exports['update']=function(_0x52ea38,_0x33d5c5){if(_0x52ea38[_0x173a('0x49')]['id']){delete _0x52ea38[_0x173a('0x49')]['id'];}return db[_0x173a('0x40')][_0x173a('0x46')]({'where':{'id':_0x52ea38['params']['id']}})[_0x173a('0x26')](handleEntityNotFound(_0x33d5c5,null))[_0x173a('0x26')](saveUpdates(_0x52ea38[_0x173a('0x49')],null))[_0x173a('0x26')](respondWithResult(_0x33d5c5,null))[_0x173a('0x47')](handleError(_0x33d5c5,null));};exports[_0x173a('0x25')]=function(_0x1d67b9,_0x4dcb74){return db[_0x173a('0x40')][_0x173a('0x46')]({'where':{'id':_0x1d67b9[_0x173a('0x45')]['id']}})[_0x173a('0x26')](handleEntityNotFound(_0x4dcb74,null))[_0x173a('0x26')](removeEntity(_0x4dcb74,null))[_0x173a('0x47')](handleError(_0x4dcb74,null));};exports[_0x173a('0x4a')]=function(_0x4bc315,_0x12ef19){return db[_0x173a('0x40')][_0x173a('0x4a')]()[_0x173a('0x26')](respondWithResult(_0x12ef19,null))[_0x173a('0x47')](handleError(_0x12ef19,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index be98825..c762490 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 _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x11f5ff,_0xa0ef18){var _0x46eefb=function(_0x51872a){while(--_0x51872a){_0x11f5ff['push'](_0x11f5ff['shift']());}};_0x46eefb(++_0xa0ef18);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','define','SmsQueueReport','uniqueid','lodash'];(function(_0x903dcc,_0x10d4f8){var _0x24d5ce=function(_0x4aadfa){while(--_0x4aadfa){_0x903dcc['push'](_0x903dcc['shift']());}};_0x24d5ce(++_0x10d4f8);}(_0xb7e7,0x121));var _0x7b7e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb7e7[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index d38b636..8b448ae 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 _0x4030=['../../config/environment','client','http','request','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateSmsQueueReport','create','body','options','raw','UpdateSmsQueueReport','SmsQueueReport','update','attributes','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x544afb,_0xa77ab6){var _0x3c39ec=function(_0x573442){while(--_0x573442){_0x544afb['push'](_0x544afb['shift']());}};_0x3c39ec(++_0xa77ab6);}(_0x4030,0x10e));var _0x0403=function(_0x300a0a,_0x1653d4){_0x300a0a=_0x300a0a-0x0;var _0x28b718=_0x4030[_0x300a0a];return _0x28b718;};'use strict';var _=require(_0x0403('0x0'));var util=require(_0x0403('0x1'));var moment=require(_0x0403('0x2'));var BPromise=require(_0x0403('0x3'));var rs=require(_0x0403('0x4'));var fs=require('fs');var Redis=require(_0x0403('0x5'));var db=require(_0x0403('0x6'))['db'];var utils=require(_0x0403('0x7'));var logger=require(_0x0403('0x8'))(_0x0403('0x9'));var config=require(_0x0403('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x0403('0xb')][_0x0403('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xf29bdc,_0x27015a,_0x5df9aa){return new BPromise(function(_0x325bfd,_0x17736c){return client[_0x0403('0xd')](_0xf29bdc,_0x5df9aa)[_0x0403('0xe')](function(_0xd37373){logger['info'](_0x0403('0xf'),_0x27015a,_0x0403('0x10'));logger[_0x0403('0x11')](_0x0403('0x12'),_0x27015a,_0x0403('0x10'),JSON['stringify'](_0xd37373));if(_0xd37373['error']){if(_0xd37373[_0x0403('0x13')][_0x0403('0x14')]===0x1f4){logger[_0x0403('0x13')](_0x0403('0xf'),_0x27015a,_0xd37373['error']['message']);return _0x17736c(_0xd37373[_0x0403('0x13')]['message']);}logger[_0x0403('0x13')](_0x0403('0xf'),_0x27015a,_0xd37373[_0x0403('0x13')][_0x0403('0x15')]);return _0x325bfd(_0xd37373['error'][_0x0403('0x15')]);}else{logger[_0x0403('0x16')](_0x0403('0xf'),_0x27015a,_0x0403('0x10'));_0x325bfd(_0xd37373[_0x0403('0x17')][_0x0403('0x15')]);}})[_0x0403('0x18')](function(_0x458249){logger[_0x0403('0x13')](_0x0403('0xf'),_0x27015a,_0x458249);_0x17736c(_0x458249);});});}exports[_0x0403('0x19')]=function(_0x4c572d){var _0xe9580d=this;return new Promise(function(_0x177e83,_0x14751a){return db['SmsQueueReport'][_0x0403('0x1a')](_0x4c572d[_0x0403('0x1b')],{'raw':_0x4c572d[_0x0403('0x1c')]?_0x4c572d['options'][_0x0403('0x1d')]===undefined?!![]:![]:!![]})[_0x0403('0xe')](function(_0x5617c7){logger[_0x0403('0x16')](_0x0403('0x19'),_0x4c572d);logger[_0x0403('0x11')](_0x0403('0x19'),_0x4c572d,JSON['stringify'](_0x5617c7));_0x177e83(_0x5617c7);})[_0x0403('0x18')](function(_0x1ee58c){logger[_0x0403('0x13')](_0x0403('0x19'),_0x1ee58c[_0x0403('0x15')],_0x4c572d);_0x14751a(_0xe9580d[_0x0403('0x13')](0x1f4,_0x1ee58c[_0x0403('0x15')]));});});};exports[_0x0403('0x1e')]=function(_0x32898e){var _0x386306=this;return new Promise(function(_0x3c7fe5,_0x1c35f1){return db[_0x0403('0x1f')][_0x0403('0x20')](_0x32898e[_0x0403('0x1b')],{'raw':_0x32898e[_0x0403('0x1c')]?_0x32898e['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32898e[_0x0403('0x1c')]?_0x32898e[_0x0403('0x1c')]['where']||null:null,'attributes':_0x32898e['options']?_0x32898e[_0x0403('0x1c')][_0x0403('0x21')]||null:null,'limit':_0x32898e[_0x0403('0x1c')]?_0x32898e[_0x0403('0x1c')]['limit']||null:null})['then'](function(_0x251e1e){logger[_0x0403('0x16')](_0x0403('0x1e'),_0x32898e);logger[_0x0403('0x11')](_0x0403('0x1e'),_0x32898e,JSON[_0x0403('0x22')](_0x251e1e));_0x3c7fe5(_0x251e1e);})[_0x0403('0x18')](function(_0x149909){logger['error'](_0x0403('0x1e'),_0x149909[_0x0403('0x15')],_0x32898e);_0x1c35f1(_0x386306[_0x0403('0x13')](0x1f4,_0x149909['message']));});});}; \ No newline at end of file +var _0x866c=['catch','UpdateSmsQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message','CreateSmsQueueReport','SmsQueueReport','body','options','raw','then'];(function(_0x1c3124,_0x218186){var _0x23477a=function(_0x34df96){while(--_0x34df96){_0x1c3124['push'](_0x1c3124['shift']());}};_0x23477a(++_0x218186);}(_0x866c,0x69));var _0xc866=function(_0x4f1e1c,_0x51e19b){_0x4f1e1c=_0x4f1e1c-0x0;var _0x1bb4f7=_0x866c[_0x4f1e1c];return _0x1bb4f7;};'use strict';var _=require(_0xc866('0x0'));var util=require(_0xc866('0x1'));var moment=require(_0xc866('0x2'));var BPromise=require(_0xc866('0x3'));var rs=require(_0xc866('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc866('0x5'))['db'];var utils=require(_0xc866('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xc866('0x7'));var jayson=require(_0xc866('0x8'));var client=jayson[_0xc866('0x9')][_0xc866('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a4a51,_0x30473f,_0x34ce26){return new BPromise(function(_0x6cb285,_0x378b8){return client[_0xc866('0xb')](_0x3a4a51,_0x34ce26)['then'](function(_0x2bbf90){logger[_0xc866('0xc')]('SmsQueueReport,\x20%s,\x20%s',_0x30473f,_0xc866('0xd'));logger[_0xc866('0xe')](_0xc866('0xf'),_0x30473f,_0xc866('0xd'),JSON[_0xc866('0x10')](_0x2bbf90));if(_0x2bbf90[_0xc866('0x11')]){if(_0x2bbf90[_0xc866('0x11')][_0xc866('0x12')]===0x1f4){logger['error'](_0xc866('0x13'),_0x30473f,_0x2bbf90[_0xc866('0x11')][_0xc866('0x14')]);return _0x378b8(_0x2bbf90[_0xc866('0x11')][_0xc866('0x14')]);}logger[_0xc866('0x11')](_0xc866('0x13'),_0x30473f,_0x2bbf90[_0xc866('0x11')]['message']);return _0x6cb285(_0x2bbf90['error']['message']);}else{logger[_0xc866('0xc')]('SmsQueueReport,\x20%s,\x20%s',_0x30473f,'request\x20sent');_0x6cb285(_0x2bbf90['result'][_0xc866('0x14')]);}})['catch'](function(_0x3ca387){logger[_0xc866('0x11')](_0xc866('0x13'),_0x30473f,_0x3ca387);_0x378b8(_0x3ca387);});});}exports[_0xc866('0x15')]=function(_0x7fe0c7){var _0x5da5f6=this;return new Promise(function(_0x363d5f,_0x5a1781){return db[_0xc866('0x16')]['create'](_0x7fe0c7[_0xc866('0x17')],{'raw':_0x7fe0c7[_0xc866('0x18')]?_0x7fe0c7[_0xc866('0x18')][_0xc866('0x19')]===undefined?!![]:![]:!![]})[_0xc866('0x1a')](function(_0x280ffa){logger[_0xc866('0xc')](_0xc866('0x15'),_0x7fe0c7);logger[_0xc866('0xe')]('CreateSmsQueueReport',_0x7fe0c7,JSON[_0xc866('0x10')](_0x280ffa));_0x363d5f(_0x280ffa);})[_0xc866('0x1b')](function(_0x4ffbd6){logger[_0xc866('0x11')](_0xc866('0x15'),_0x4ffbd6['message'],_0x7fe0c7);_0x5a1781(_0x5da5f6['error'](0x1f4,_0x4ffbd6[_0xc866('0x14')]));});});};exports[_0xc866('0x1c')]=function(_0x5b021d){var _0x2fce8e=this;return new Promise(function(_0x5c7d18,_0x29445c){return db[_0xc866('0x16')][_0xc866('0x1d')](_0x5b021d[_0xc866('0x17')],{'raw':_0x5b021d[_0xc866('0x18')]?_0x5b021d[_0xc866('0x18')][_0xc866('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b021d['options']?_0x5b021d[_0xc866('0x18')][_0xc866('0x1e')]||null:null,'attributes':_0x5b021d[_0xc866('0x18')]?_0x5b021d['options'][_0xc866('0x1f')]||null:null,'limit':_0x5b021d[_0xc866('0x18')]?_0x5b021d['options'][_0xc866('0x20')]||null:null})[_0xc866('0x1a')](function(_0x3d5d99){logger[_0xc866('0xc')](_0xc866('0x1c'),_0x5b021d);logger[_0xc866('0xe')]('UpdateSmsQueueReport',_0x5b021d,JSON['stringify'](_0x3d5d99));_0x5c7d18(_0x3d5d99);})[_0xc866('0x1b')](function(_0x1c571d){logger[_0xc866('0x11')]('UpdateSmsQueueReport',_0x1c571d[_0xc866('0x14')],_0x5b021d);_0x29445c(_0x2fce8e['error'](0x1f4,_0x1c571d[_0xc866('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 3855a29..df2d319 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 _0x7dfd=['isAuthenticated','index','/describe','/:id','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get'];(function(_0x1b7254,_0x442034){var _0x30f907=function(_0x15b6d0){while(--_0x15b6d0){_0x1b7254['push'](_0x1b7254['shift']());}};_0x30f907(++_0x442034);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd7df('0x0'));var util=require(_0xd7df('0x1'));var path=require(_0xd7df('0x2'));var timeout=require(_0xd7df('0x3'));var express=require(_0xd7df('0x4'));var router=express[_0xd7df('0x5')]();var fs_extra=require(_0xd7df('0x6'));var auth=require(_0xd7df('0x7'));var interaction=require(_0xd7df('0x8'));var config=require(_0xd7df('0x9'));var controller=require(_0xd7df('0xa'));router[_0xd7df('0xb')]('/',auth[_0xd7df('0xc')](),controller[_0xd7df('0xd')]);router[_0xd7df('0xb')](_0xd7df('0xe'),auth[_0xd7df('0xc')](),controller['describe']);router[_0xd7df('0xb')](_0xd7df('0xf'),auth[_0xd7df('0xc')](),controller[_0xd7df('0x10')]);router['post']('/',auth[_0xd7df('0xc')](),controller['create']);router[_0xd7df('0x11')]('/:id',auth[_0xd7df('0xc')](),controller[_0xd7df('0x12')]);router[_0xd7df('0x13')](_0xd7df('0xf'),auth[_0xd7df('0xc')](),controller[_0xd7df('0x14')]);module[_0xd7df('0x15')]=router; \ No newline at end of file +var _0xec39=['Router','fs-extra','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','/describe','isAuthenticated','/:id','show','post','create','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x186c2b,_0x347195){var _0x4483ab=function(_0xf59d69){while(--_0xf59d69){_0x186c2b['push'](_0x186c2b['shift']());}};_0x4483ab(++_0x347195);}(_0xec39,0x19f));var _0x9ec3=function(_0x5c01e5,_0x48ac51){_0x5c01e5=_0x5c01e5-0x0;var _0x59da39=_0xec39[_0x5c01e5];return _0x59da39;};'use strict';var multer=require(_0x9ec3('0x0'));var util=require(_0x9ec3('0x1'));var path=require(_0x9ec3('0x2'));var timeout=require(_0x9ec3('0x3'));var express=require(_0x9ec3('0x4'));var router=express[_0x9ec3('0x5')]();var fs_extra=require(_0x9ec3('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9ec3('0x7'));var config=require(_0x9ec3('0x8'));var controller=require(_0x9ec3('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x9ec3('0xa')](_0x9ec3('0xb'),auth[_0x9ec3('0xc')](),controller['describe']);router[_0x9ec3('0xa')](_0x9ec3('0xd'),auth[_0x9ec3('0xc')](),controller[_0x9ec3('0xe')]);router[_0x9ec3('0xf')]('/',auth[_0x9ec3('0xc')](),controller[_0x9ec3('0x10')]);router['put'](_0x9ec3('0xd'),auth[_0x9ec3('0xc')](),controller[_0x9ec3('0x11')]);router[_0x9ec3('0x12')](_0x9ec3('0xd'),auth[_0x9ec3('0xc')](),controller[_0x9ec3('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 3a452e6..277a272 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(_0x55c979,_0x36c5f0){var _0x690107=function(_0xa61dad){while(--_0xa61dad){_0x55c979['push'](_0x55c979['shift']());}};_0x690107(++_0x36c5f0);}(_0x9bde,0xe1));var _0xe9bd=function(_0x13c8aa,_0x2c9bd4){_0x13c8aa=_0x13c8aa-0x0;var _0x150b9f=_0x9bde[_0x13c8aa];return _0x150b9f;};'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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x1895ce,_0x81e9b2){var _0x4c3c7f=function(_0x2e4d0b){while(--_0x2e4d0b){_0x1895ce['push'](_0x1895ce['shift']());}};_0x4c3c7f(++_0x81e9b2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index d9fe569..ffe4faa 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 _0x12aa=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','end','json','limit','undefined','count','offset','status','set','Content-Range','apply','save','then','sendStatus','error','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','options','SmsTransferReport','includeAll','include','findAll','rows','catch','show','params','create','body','update','find','destroy','describe','eml-format','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x36da89,_0xe7d44f){var _0x31bdbd=function(_0x2957a9){while(--_0x2957a9){_0x36da89['push'](_0x36da89['shift']());}};_0x31bdbd(++_0xe7d44f);}(_0x12aa,0xcd));var _0xa12a=function(_0x38b76a,_0x3a9c42){_0x38b76a=_0x38b76a-0x0;var _0x698a18=_0x12aa[_0x38b76a];return _0x698a18;};'use strict';var emlformat=require(_0xa12a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa12a('0x1'));var jsonpatch=require(_0xa12a('0x2'));var rp=require('request-promise');var moment=require(_0xa12a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa12a('0x4'));var util=require('util');var path=require('path');var sox=require(_0xa12a('0x5'));var csv=require(_0xa12a('0x6'));var ejs=require(_0xa12a('0x7'));var fs=require('fs');var fs_extra=require(_0xa12a('0x8'));var _=require(_0xa12a('0x9'));var squel=require(_0xa12a('0xa'));var crypto=require(_0xa12a('0xb'));var jsforce=require(_0xa12a('0xc'));var deskjs=require(_0xa12a('0xd'));var toCsv=require(_0xa12a('0x6'));var querystring=require(_0xa12a('0xe'));var Papa=require(_0xa12a('0xf'));var Redis=require(_0xa12a('0x10'));var authService=require(_0xa12a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa12a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa12a('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xa12a('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xa12a('0x15'))['db'];function respondWithStatusCode(_0x270f4e,_0x1a6878){_0x1a6878=_0x1a6878||0xcc;return function(_0x254abb){if(_0x254abb){return _0x270f4e['sendStatus'](_0x1a6878);}return _0x270f4e['status'](_0x1a6878)[_0xa12a('0x16')]();};}function respondWithResult(_0x4439a2,_0x3facf7){_0x3facf7=_0x3facf7||0xc8;return function(_0x6d41f3){if(_0x6d41f3){return _0x4439a2['status'](_0x3facf7)[_0xa12a('0x17')](_0x6d41f3);}};}function respondWithFilteredResult(_0x57e174,_0x546928){return function(_0x5ea6df){if(_0x5ea6df){var _0x499fcd=typeof _0x546928['offset']==='undefined'&&typeof _0x546928[_0xa12a('0x18')]===_0xa12a('0x19');var _0x1bd8b5=_0x5ea6df[_0xa12a('0x1a')];var _0x5e0d01=_0x499fcd?0x0:_0x546928[_0xa12a('0x1b')];var _0x36d4ec=_0x499fcd?_0x5ea6df['count']:_0x546928[_0xa12a('0x1b')]+_0x546928[_0xa12a('0x18')];var _0x329709;if(_0x36d4ec>=_0x1bd8b5){_0x36d4ec=_0x1bd8b5;_0x329709=0xc8;}else{_0x329709=0xce;}_0x57e174[_0xa12a('0x1c')](_0x329709);return _0x57e174[_0xa12a('0x1d')](_0xa12a('0x1e'),_0x5e0d01+'-'+_0x36d4ec+'/'+_0x1bd8b5)['json'](_0x5ea6df);}return null;};}function patchUpdates(_0x1e9d6b){return function(_0x3d8297){try{jsonpatch[_0xa12a('0x1f')](_0x3d8297,_0x1e9d6b,!![]);}catch(_0x49d3dc){return BPromise['reject'](_0x49d3dc);}return _0x3d8297[_0xa12a('0x20')]();};}function saveUpdates(_0x34051d,_0x538d48){return function(_0x4cd09f){if(_0x4cd09f){return _0x4cd09f['update'](_0x34051d)[_0xa12a('0x21')](function(_0x21b36c){return _0x21b36c;});}return null;};}function removeEntity(_0x3b8fba,_0x1373d6){return function(_0x43eb32){if(_0x43eb32){return _0x43eb32['destroy']()[_0xa12a('0x21')](function(){_0x3b8fba[_0xa12a('0x1c')](0xcc)[_0xa12a('0x16')]();});}};}function handleEntityNotFound(_0x4879c2,_0xf79c25){return function(_0x45d343){if(!_0x45d343){_0x4879c2[_0xa12a('0x22')](0x194);}return _0x45d343;};}function handleError(_0x440619,_0x5818ad){_0x5818ad=_0x5818ad||0x1f4;return function(_0x473f9f){logger[_0xa12a('0x23')](_0x473f9f['stack']);if(_0x473f9f['name']){delete _0x473f9f[_0xa12a('0x24')];}_0x440619[_0xa12a('0x1c')](_0x5818ad)['send'](_0x473f9f);};}exports[_0xa12a('0x25')]=function(_0x41ac3a,_0xb3fba3){var _0x292384={},_0x138fe7={},_0x4b3283={'count':0x0,'rows':[]};var _0x2e2c47=_[_0xa12a('0x26')](db['SmsTransferReport'][_0xa12a('0x27')],function(_0x4f93e4){return{'name':_0x4f93e4[_0xa12a('0x28')],'type':_0x4f93e4[_0xa12a('0x29')][_0xa12a('0x2a')]};});_0x138fe7[_0xa12a('0x2b')]=_[_0xa12a('0x26')](_0x2e2c47,_0xa12a('0x24'));_0x138fe7[_0xa12a('0x2c')]=_[_0xa12a('0x2d')](_0x41ac3a[_0xa12a('0x2c')]);_0x138fe7[_0xa12a('0x2e')]=_[_0xa12a('0x2f')](_0x138fe7[_0xa12a('0x2b')],_0x138fe7[_0xa12a('0x2c')]);_0x292384[_0xa12a('0x30')]=_[_0xa12a('0x2f')](_0x138fe7[_0xa12a('0x2b')],qs[_0xa12a('0x31')](_0x41ac3a[_0xa12a('0x2c')][_0xa12a('0x31')]));_0x292384[_0xa12a('0x30')]=_0x292384[_0xa12a('0x30')][_0xa12a('0x32')]?_0x292384[_0xa12a('0x30')]:_0x138fe7[_0xa12a('0x2b')];if(!_0x41ac3a[_0xa12a('0x2c')]['hasOwnProperty'](_0xa12a('0x33'))){_0x292384[_0xa12a('0x18')]=qs[_0xa12a('0x18')](_0x41ac3a['query'][_0xa12a('0x18')]);_0x292384[_0xa12a('0x1b')]=qs[_0xa12a('0x1b')](_0x41ac3a[_0xa12a('0x2c')][_0xa12a('0x1b')]);}_0x292384[_0xa12a('0x34')]=qs[_0xa12a('0x35')](_0x41ac3a[_0xa12a('0x2c')][_0xa12a('0x35')]);_0x292384[_0xa12a('0x36')]=qs[_0xa12a('0x2e')](_[_0xa12a('0x37')](_0x41ac3a[_0xa12a('0x2c')],_0x138fe7[_0xa12a('0x2e')]),_0x2e2c47);if(_0x41ac3a[_0xa12a('0x2c')]['filter']){_0x292384[_0xa12a('0x36')]=_[_0xa12a('0x38')](_0x292384[_0xa12a('0x36')],{'$or':_[_0xa12a('0x26')](_0x2e2c47,function(_0x134eb5){if(_0x134eb5[_0xa12a('0x29')]!==_0xa12a('0x39')){var _0x57e16b={};_0x57e16b[_0x134eb5['name']]={'$like':'%'+_0x41ac3a['query']['filter']+'%'};return _0x57e16b;}})});}_0x292384=_[_0xa12a('0x38')]({},_0x292384,_0x41ac3a[_0xa12a('0x3a')]);var _0x372b34={'where':_0x292384['where']};return db[_0xa12a('0x3b')][_0xa12a('0x1a')](_0x372b34)['then'](function(_0xfa06b0){_0x4b3283['count']=_0xfa06b0;if(_0x41ac3a[_0xa12a('0x2c')][_0xa12a('0x3c')]){_0x292384[_0xa12a('0x3d')]=[{'all':!![]}];}return db['SmsTransferReport'][_0xa12a('0x3e')](_0x292384);})['then'](function(_0x143497){_0x4b3283[_0xa12a('0x3f')]=_0x143497;return _0x4b3283;})[_0xa12a('0x21')](respondWithFilteredResult(_0xb3fba3,_0x292384))[_0xa12a('0x40')](handleError(_0xb3fba3,null));};exports[_0xa12a('0x41')]=function(_0x10c5d8,_0x5e5710){var _0x475547={'raw':!![],'where':{'id':_0x10c5d8[_0xa12a('0x42')]['id']}},_0x1e8ee2={};_0x1e8ee2['model']=_[_0xa12a('0x2d')](db[_0xa12a('0x3b')][_0xa12a('0x27')]);_0x1e8ee2[_0xa12a('0x2c')]=_[_0xa12a('0x2d')](_0x10c5d8['query']);_0x1e8ee2[_0xa12a('0x2e')]=_['intersection'](_0x1e8ee2[_0xa12a('0x2b')],_0x1e8ee2[_0xa12a('0x2c')]);_0x475547[_0xa12a('0x30')]=_['intersection'](_0x1e8ee2['model'],qs['fields'](_0x10c5d8[_0xa12a('0x2c')]['fields']));_0x475547[_0xa12a('0x30')]=_0x475547[_0xa12a('0x30')]['length']?_0x475547['attributes']:_0x1e8ee2[_0xa12a('0x2b')];if(_0x10c5d8[_0xa12a('0x2c')][_0xa12a('0x3c')]){_0x475547[_0xa12a('0x3d')]=[{'all':!![]}];}_0x475547=_[_0xa12a('0x38')]({},_0x475547,_0x10c5d8[_0xa12a('0x3a')]);return db[_0xa12a('0x3b')]['find'](_0x475547)[_0xa12a('0x21')](handleEntityNotFound(_0x5e5710,null))[_0xa12a('0x21')](respondWithResult(_0x5e5710,null))['catch'](handleError(_0x5e5710,null));};exports[_0xa12a('0x43')]=function(_0x2c0fb9,_0x596ca8){return db[_0xa12a('0x3b')][_0xa12a('0x43')](_0x2c0fb9[_0xa12a('0x44')],{})[_0xa12a('0x21')](respondWithResult(_0x596ca8,0xc9))['catch'](handleError(_0x596ca8,null));};exports[_0xa12a('0x45')]=function(_0x1520e0,_0xb11b4c){if(_0x1520e0[_0xa12a('0x44')]['id']){delete _0x1520e0[_0xa12a('0x44')]['id'];}return db[_0xa12a('0x3b')][_0xa12a('0x46')]({'where':{'id':_0x1520e0['params']['id']}})[_0xa12a('0x21')](handleEntityNotFound(_0xb11b4c,null))[_0xa12a('0x21')](saveUpdates(_0x1520e0[_0xa12a('0x44')],null))[_0xa12a('0x21')](respondWithResult(_0xb11b4c,null))[_0xa12a('0x40')](handleError(_0xb11b4c,null));};exports[_0xa12a('0x47')]=function(_0x53a671,_0x44f9ee){return db[_0xa12a('0x3b')][_0xa12a('0x46')]({'where':{'id':_0x53a671[_0xa12a('0x42')]['id']}})['then'](handleEntityNotFound(_0x44f9ee,null))[_0xa12a('0x21')](removeEntity(_0x44f9ee,null))[_0xa12a('0x40')](handleError(_0x44f9ee,null));};exports[_0xa12a('0x48')]=function(_0x3cecf0,_0x119f89){return db[_0xa12a('0x3b')][_0xa12a('0x48')]()[_0xa12a('0x21')](respondWithResult(_0x119f89,null))[_0xa12a('0x40')](handleError(_0x119f89,null));}; \ No newline at end of file +var _0x1d03=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','json','reject','save','then','sendStatus','error','stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','rows','show','params','keys','includeAll','options','find','catch','create','body','update','destroy','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x749079,_0x419e9d){var _0x5916ae=function(_0x414296){while(--_0x414296){_0x749079['push'](_0x749079['shift']());}};_0x5916ae(++_0x419e9d);}(_0x1d03,0x118));var _0x31d0=function(_0x150f6e,_0x10a614){_0x150f6e=_0x150f6e-0x0;var _0x1fff4a=_0x1d03[_0x150f6e];return _0x1fff4a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x31d0('0x0'));var jsonpatch=require(_0x31d0('0x1'));var rp=require(_0x31d0('0x2'));var moment=require(_0x31d0('0x3'));var BPromise=require(_0x31d0('0x4'));var Mustache=require('mustache');var util=require(_0x31d0('0x5'));var path=require(_0x31d0('0x6'));var sox=require(_0x31d0('0x7'));var csv=require(_0x31d0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x31d0('0x9'));var _=require(_0x31d0('0xa'));var squel=require(_0x31d0('0xb'));var crypto=require(_0x31d0('0xc'));var jsforce=require(_0x31d0('0xd'));var deskjs=require(_0x31d0('0xe'));var toCsv=require(_0x31d0('0x8'));var querystring=require(_0x31d0('0xf'));var Papa=require('papaparse');var Redis=require(_0x31d0('0x10'));var authService=require(_0x31d0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x31d0('0x12'));var hardwareService=require(_0x31d0('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x31d0('0x14'));var config=require(_0x31d0('0x15'));var licenseUtil=require(_0x31d0('0x16'));var db=require(_0x31d0('0x17'))['db'];function respondWithStatusCode(_0x30b07b,_0x1e780b){_0x1e780b=_0x1e780b||0xcc;return function(_0x2df72b){if(_0x2df72b){return _0x30b07b['sendStatus'](_0x1e780b);}return _0x30b07b[_0x31d0('0x18')](_0x1e780b)[_0x31d0('0x19')]();};}function respondWithResult(_0x3909a0,_0x32bc8f){_0x32bc8f=_0x32bc8f||0xc8;return function(_0x287e50){if(_0x287e50){return _0x3909a0['status'](_0x32bc8f)['json'](_0x287e50);}};}function respondWithFilteredResult(_0x362b99,_0x3a2fbb){return function(_0x585c76){if(_0x585c76){var _0x308b89=typeof _0x3a2fbb[_0x31d0('0x1a')]===_0x31d0('0x1b')&&typeof _0x3a2fbb[_0x31d0('0x1c')]===_0x31d0('0x1b');var _0x5cc8b5=_0x585c76['count'];var _0x80ab3e=_0x308b89?0x0:_0x3a2fbb[_0x31d0('0x1a')];var _0x2e8b02=_0x308b89?_0x585c76[_0x31d0('0x1d')]:_0x3a2fbb[_0x31d0('0x1a')]+_0x3a2fbb['limit'];var _0x50cdff;if(_0x2e8b02>=_0x5cc8b5){_0x2e8b02=_0x5cc8b5;_0x50cdff=0xc8;}else{_0x50cdff=0xce;}_0x362b99[_0x31d0('0x18')](_0x50cdff);return _0x362b99[_0x31d0('0x1e')]('Content-Range',_0x80ab3e+'-'+_0x2e8b02+'/'+_0x5cc8b5)[_0x31d0('0x1f')](_0x585c76);}return null;};}function patchUpdates(_0x3a7cdb){return function(_0x35ffc1){try{jsonpatch['apply'](_0x35ffc1,_0x3a7cdb,!![]);}catch(_0x119a38){return BPromise[_0x31d0('0x20')](_0x119a38);}return _0x35ffc1[_0x31d0('0x21')]();};}function saveUpdates(_0xe02583,_0x3e4d0f){return function(_0xff1a50){if(_0xff1a50){return _0xff1a50['update'](_0xe02583)[_0x31d0('0x22')](function(_0x1c2817){return _0x1c2817;});}return null;};}function removeEntity(_0x269af4,_0xff4501){return function(_0x127dae){if(_0x127dae){return _0x127dae['destroy']()[_0x31d0('0x22')](function(){_0x269af4[_0x31d0('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33858d,_0x4495d3){return function(_0x5cadce){if(!_0x5cadce){_0x33858d[_0x31d0('0x23')](0x194);}return _0x5cadce;};}function handleError(_0x46beb6,_0x57a8a6){_0x57a8a6=_0x57a8a6||0x1f4;return function(_0xfab650){logger[_0x31d0('0x24')](_0xfab650[_0x31d0('0x25')]);if(_0xfab650['name']){delete _0xfab650[_0x31d0('0x26')];}_0x46beb6['status'](_0x57a8a6)[_0x31d0('0x27')](_0xfab650);};}exports[_0x31d0('0x28')]=function(_0xd7b189,_0x3924db){var _0x7f5741={},_0x47108d={},_0x61fde5={'count':0x0,'rows':[]};var _0x74b4c2=_[_0x31d0('0x29')](db[_0x31d0('0x2a')][_0x31d0('0x2b')],function(_0x2d77d0){return{'name':_0x2d77d0[_0x31d0('0x2c')],'type':_0x2d77d0[_0x31d0('0x2d')][_0x31d0('0x2e')]};});_0x47108d[_0x31d0('0x2f')]=_[_0x31d0('0x29')](_0x74b4c2,'name');_0x47108d[_0x31d0('0x30')]=_['keys'](_0xd7b189[_0x31d0('0x30')]);_0x47108d[_0x31d0('0x31')]=_[_0x31d0('0x32')](_0x47108d[_0x31d0('0x2f')],_0x47108d[_0x31d0('0x30')]);_0x7f5741[_0x31d0('0x33')]=_['intersection'](_0x47108d['model'],qs[_0x31d0('0x34')](_0xd7b189[_0x31d0('0x30')][_0x31d0('0x34')]));_0x7f5741[_0x31d0('0x33')]=_0x7f5741[_0x31d0('0x33')][_0x31d0('0x35')]?_0x7f5741[_0x31d0('0x33')]:_0x47108d[_0x31d0('0x2f')];if(!_0xd7b189[_0x31d0('0x30')][_0x31d0('0x36')]('nolimit')){_0x7f5741[_0x31d0('0x1c')]=qs[_0x31d0('0x1c')](_0xd7b189[_0x31d0('0x30')][_0x31d0('0x1c')]);_0x7f5741[_0x31d0('0x1a')]=qs[_0x31d0('0x1a')](_0xd7b189[_0x31d0('0x30')]['offset']);}_0x7f5741[_0x31d0('0x37')]=qs['sort'](_0xd7b189[_0x31d0('0x30')][_0x31d0('0x38')]);_0x7f5741[_0x31d0('0x39')]=qs[_0x31d0('0x31')](_['pick'](_0xd7b189[_0x31d0('0x30')],_0x47108d[_0x31d0('0x31')]),_0x74b4c2);if(_0xd7b189['query'][_0x31d0('0x3a')]){_0x7f5741[_0x31d0('0x39')]=_[_0x31d0('0x3b')](_0x7f5741[_0x31d0('0x39')],{'$or':_['map'](_0x74b4c2,function(_0x17fa93){if(_0x17fa93[_0x31d0('0x2d')]!==_0x31d0('0x3c')){var _0xf63ec0={};_0xf63ec0[_0x17fa93[_0x31d0('0x26')]]={'$like':'%'+_0xd7b189[_0x31d0('0x30')][_0x31d0('0x3a')]+'%'};return _0xf63ec0;}})});}_0x7f5741=_[_0x31d0('0x3b')]({},_0x7f5741,_0xd7b189['options']);var _0x568cb5={'where':_0x7f5741['where']};return db[_0x31d0('0x2a')][_0x31d0('0x1d')](_0x568cb5)[_0x31d0('0x22')](function(_0x1f789d){_0x61fde5[_0x31d0('0x1d')]=_0x1f789d;if(_0xd7b189[_0x31d0('0x30')]['includeAll']){_0x7f5741['include']=[{'all':!![]}];}return db[_0x31d0('0x2a')]['findAll'](_0x7f5741);})[_0x31d0('0x22')](function(_0x467bfd){_0x61fde5[_0x31d0('0x3d')]=_0x467bfd;return _0x61fde5;})[_0x31d0('0x22')](respondWithFilteredResult(_0x3924db,_0x7f5741))['catch'](handleError(_0x3924db,null));};exports[_0x31d0('0x3e')]=function(_0x26061a,_0x321bca){var _0xf1c4c5={'raw':!![],'where':{'id':_0x26061a[_0x31d0('0x3f')]['id']}},_0x5c1231={};_0x5c1231[_0x31d0('0x2f')]=_['keys'](db[_0x31d0('0x2a')][_0x31d0('0x2b')]);_0x5c1231[_0x31d0('0x30')]=_[_0x31d0('0x40')](_0x26061a[_0x31d0('0x30')]);_0x5c1231['filters']=_[_0x31d0('0x32')](_0x5c1231[_0x31d0('0x2f')],_0x5c1231[_0x31d0('0x30')]);_0xf1c4c5[_0x31d0('0x33')]=_[_0x31d0('0x32')](_0x5c1231[_0x31d0('0x2f')],qs[_0x31d0('0x34')](_0x26061a[_0x31d0('0x30')][_0x31d0('0x34')]));_0xf1c4c5[_0x31d0('0x33')]=_0xf1c4c5['attributes'][_0x31d0('0x35')]?_0xf1c4c5['attributes']:_0x5c1231['model'];if(_0x26061a['query'][_0x31d0('0x41')]){_0xf1c4c5['include']=[{'all':!![]}];}_0xf1c4c5=_[_0x31d0('0x3b')]({},_0xf1c4c5,_0x26061a[_0x31d0('0x42')]);return db['SmsTransferReport'][_0x31d0('0x43')](_0xf1c4c5)['then'](handleEntityNotFound(_0x321bca,null))[_0x31d0('0x22')](respondWithResult(_0x321bca,null))[_0x31d0('0x44')](handleError(_0x321bca,null));};exports[_0x31d0('0x45')]=function(_0x3f0675,_0x6aae95){return db[_0x31d0('0x2a')]['create'](_0x3f0675[_0x31d0('0x46')],{})['then'](respondWithResult(_0x6aae95,0xc9))[_0x31d0('0x44')](handleError(_0x6aae95,null));};exports[_0x31d0('0x47')]=function(_0x4cae13,_0x30f8a6){if(_0x4cae13[_0x31d0('0x46')]['id']){delete _0x4cae13[_0x31d0('0x46')]['id'];}return db['SmsTransferReport'][_0x31d0('0x43')]({'where':{'id':_0x4cae13['params']['id']}})[_0x31d0('0x22')](handleEntityNotFound(_0x30f8a6,null))[_0x31d0('0x22')](saveUpdates(_0x4cae13[_0x31d0('0x46')],null))['then'](respondWithResult(_0x30f8a6,null))[_0x31d0('0x44')](handleError(_0x30f8a6,null));};exports[_0x31d0('0x48')]=function(_0x1e3380,_0x27f363){return db[_0x31d0('0x2a')][_0x31d0('0x43')]({'where':{'id':_0x1e3380['params']['id']}})['then'](handleEntityNotFound(_0x27f363,null))[_0x31d0('0x22')](removeEntity(_0x27f363,null))[_0x31d0('0x44')](handleError(_0x27f363,null));};exports[_0x31d0('0x49')]=function(_0x7f0511,_0x454c49){return db[_0x31d0('0x2a')][_0x31d0('0x49')]()[_0x31d0('0x22')](respondWithResult(_0x454c49,null))['catch'](handleError(_0x454c49,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index ef18cfa..3d0fe57 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 _0xc3d6=['SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x802997,_0x5534a2){var _0x35c641=function(_0x22c4f2){while(--_0x22c4f2){_0x802997['push'](_0x802997['shift']());}};_0x35c641(++_0x5534a2);}(_0xc3d6,0x153));var _0x6c3d=function(_0x12190c,_0x98340a){_0x12190c=_0x12190c-0x0;var _0x91ca1=_0xc3d6[_0x12190c];return _0x91ca1;};'use strict';var _=require(_0x6c3d('0x0'));var util=require(_0x6c3d('0x1'));var logger=require(_0x6c3d('0x2'))(_0x6c3d('0x3'));var moment=require(_0x6c3d('0x4'));var BPromise=require(_0x6c3d('0x5'));var rp=require(_0x6c3d('0x6'));var fs=require('fs');var path=require(_0x6c3d('0x7'));var rimraf=require(_0x6c3d('0x8'));var config=require(_0x6c3d('0x9'));var attributes=require('./smsTransferReport.attributes');module[_0x6c3d('0xa')]=function(_0x4b59e5,_0x9c4987){return _0x4b59e5['define'](_0x6c3d('0xb'),attributes,{'tableName':_0x6c3d('0xc'),'paranoid':![],'indexes':[{'name':_0x6c3d('0xd'),'fields':[_0x6c3d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc856=['moment','bluebird','path','rimraf','../../config/environment','exports','define','SmsTransferReport','report_sms_transfer','lodash','util','../../config/logger','api'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xc856,0x1a9));var _0x6c85=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xc856[_0x35885a];return _0xe86249;};'use strict';var _=require(_0x6c85('0x0'));var util=require(_0x6c85('0x1'));var logger=require(_0x6c85('0x2'))(_0x6c85('0x3'));var moment=require(_0x6c85('0x4'));var BPromise=require(_0x6c85('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6c85('0x6'));var rimraf=require(_0x6c85('0x7'));var config=require(_0x6c85('0x8'));var attributes=require('./smsTransferReport.attributes');module[_0x6c85('0x9')]=function(_0x1fe753,_0x3105c6){return _0x1fe753[_0x6c85('0xa')](_0x6c85('0xb'),attributes,{'tableName':_0x6c85('0xc'),'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 a2fcd92..f956973 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 _0x8255=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','message','info','SmsTransferReport,\x20%s,\x20%s','catch'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x8255,0x176));var _0x5825=function(_0x5a03eb,_0x64c29e){_0x5a03eb=_0x5a03eb-0x0;var _0xe1f6ee=_0x8255[_0x5a03eb];return _0xe1f6ee;};'use strict';var _=require(_0x5825('0x0'));var util=require(_0x5825('0x1'));var moment=require(_0x5825('0x2'));var BPromise=require(_0x5825('0x3'));var rs=require(_0x5825('0x4'));var fs=require('fs');var Redis=require(_0x5825('0x5'));var db=require(_0x5825('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x5825('0x7'));var jayson=require(_0x5825('0x8'));var client=jayson[_0x5825('0x9')][_0x5825('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x383a49,_0x3415c5,_0x27d87e){return new BPromise(function(_0x577974,_0x4975de){return client[_0x5825('0xb')](_0x383a49,_0x27d87e)[_0x5825('0xc')](function(_0x754d99){logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x3415c5,_0x5825('0xd'));logger[_0x5825('0xe')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x3415c5,_0x5825('0xd'),JSON[_0x5825('0xf')](_0x754d99));if(_0x754d99['error']){if(_0x754d99[_0x5825('0x10')][_0x5825('0x11')]===0x1f4){logger[_0x5825('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x3415c5,_0x754d99['error'][_0x5825('0x12')]);return _0x4975de(_0x754d99[_0x5825('0x10')][_0x5825('0x12')]);}logger[_0x5825('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x3415c5,_0x754d99[_0x5825('0x10')]['message']);return _0x577974(_0x754d99[_0x5825('0x10')][_0x5825('0x12')]);}else{logger[_0x5825('0x13')](_0x5825('0x14'),_0x3415c5,_0x5825('0xd'));_0x577974(_0x754d99['result']['message']);}})[_0x5825('0x15')](function(_0x38cd22){logger[_0x5825('0x10')](_0x5825('0x14'),_0x3415c5,_0x38cd22);_0x4975de(_0x38cd22);});});} \ No newline at end of file +var _0x99c9=['code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3a5242,_0xffab14){var _0x18952d=function(_0x98c455){while(--_0x98c455){_0x3a5242['push'](_0x3a5242['shift']());}};_0x18952d(++_0xffab14);}(_0x99c9,0x13c));var _0x999c=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x99c9[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x999c('0x0'));var util=require(_0x999c('0x1'));var moment=require(_0x999c('0x2'));var BPromise=require(_0x999c('0x3'));var rs=require(_0x999c('0x4'));var fs=require('fs');var Redis=require(_0x999c('0x5'));var db=require(_0x999c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x999c('0x7'))(_0x999c('0x8'));var config=require(_0x999c('0x9'));var jayson=require(_0x999c('0xa'));var client=jayson[_0x999c('0xb')][_0x999c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x34f100,_0x651b7e,_0xc8a6b5){return new BPromise(function(_0xb88ec1,_0x329252){return client[_0x999c('0xd')](_0x34f100,_0xc8a6b5)[_0x999c('0xe')](function(_0x395321){logger['info'](_0x999c('0xf'),_0x651b7e,_0x999c('0x10'));logger['debug'](_0x999c('0x11'),_0x651b7e,_0x999c('0x10'),JSON[_0x999c('0x12')](_0x395321));if(_0x395321[_0x999c('0x13')]){if(_0x395321[_0x999c('0x13')][_0x999c('0x14')]===0x1f4){logger[_0x999c('0x13')](_0x999c('0xf'),_0x651b7e,_0x395321[_0x999c('0x13')][_0x999c('0x15')]);return _0x329252(_0x395321[_0x999c('0x13')][_0x999c('0x15')]);}logger['error'](_0x999c('0xf'),_0x651b7e,_0x395321[_0x999c('0x13')]['message']);return _0xb88ec1(_0x395321['error']['message']);}else{logger[_0x999c('0x16')](_0x999c('0xf'),_0x651b7e,_0x999c('0x10'));_0xb88ec1(_0x395321[_0x999c('0x17')][_0x999c('0x15')]);}})['catch'](function(_0x226437){logger[_0x999c('0x13')](_0x999c('0xf'),_0x651b7e,_0x226437);_0x329252(_0x226437);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index cfab8cc..602f9ef 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 _0x8dd0=['/:id/download','download','diskStorage','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./sound.controller','get','isAuthenticated','index','/:id'];(function(_0x378bcc,_0x545aa8){var _0x1f77d7=function(_0x3fbc6f){while(--_0x3fbc6f){_0x378bcc['push'](_0x378bcc['shift']());}};_0x1f77d7(++_0x545aa8);}(_0x8dd0,0x1d4));var _0x08dd=function(_0x5a7fe2,_0x21e7cc){_0x5a7fe2=_0x5a7fe2-0x0;var _0x44c5cf=_0x8dd0[_0x5a7fe2];return _0x44c5cf;};'use strict';var multer=require(_0x08dd('0x0'));var util=require(_0x08dd('0x1'));var path=require(_0x08dd('0x2'));var timeout=require(_0x08dd('0x3'));var express=require('express');var router=express[_0x08dd('0x4')]();var fs_extra=require(_0x08dd('0x5'));var auth=require(_0x08dd('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x08dd('0x7'));router[_0x08dd('0x8')]('/',auth[_0x08dd('0x9')](),controller[_0x08dd('0xa')]);router[_0x08dd('0x8')](_0x08dd('0xb'),auth[_0x08dd('0x9')](),controller['show']);router[_0x08dd('0x8')](_0x08dd('0xc'),auth['isAuthenticated'](),controller[_0x08dd('0xd')]);var upload=multer({'storage':multer[_0x08dd('0xe')]({'destination':function(_0x46f553,_0x23c4da,_0x52a439){_0x52a439(null,path['join'](config['root'],'server/files/sounds/original/'));},'filename':function(_0x298ae1,_0x5d370f,_0x29d23f){_0x5d370f[_0x08dd('0xf')]=_0x5d370f[_0x08dd('0xf')][_0x08dd('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x29d23f(null,util[_0x08dd('0x11')](_0x08dd('0x12'),path[_0x08dd('0x13')](_0x5d370f['originalname'],path[_0x08dd('0x14')](_0x5d370f['originalname'])),Date[_0x08dd('0x15')](),path['extname'](_0x5d370f['originalname'])));}})});router[_0x08dd('0x16')]('/',upload[_0x08dd('0x17')](_0x08dd('0x18')),controller[_0x08dd('0x19')]);router[_0x08dd('0x1a')](_0x08dd('0xb'),auth[_0x08dd('0x9')](),controller[_0x08dd('0x1b')]);router['delete'](_0x08dd('0xb'),auth[_0x08dd('0x9')](),controller[_0x08dd('0x1c')]);module[_0x08dd('0x1d')]=router; \ No newline at end of file +var _0x60ac=['exports','multer','util','connect-timeout','express','fs-extra','../../config/environment','./sound.controller','isAuthenticated','get','show','/:id/download','diskStorage','root','server/files/sounds/original/','originalname','format','%s-%s%s','basename','now','extname','single','file','create','put','/:id'];(function(_0x5828f6,_0x2b022f){var _0x5237a9=function(_0x2d9746){while(--_0x2d9746){_0x5828f6['push'](_0x5828f6['shift']());}};_0x5237a9(++_0x2b022f);}(_0x60ac,0x1d5));var _0xc60a=function(_0x1ffd2a,_0x2bb63b){_0x1ffd2a=_0x1ffd2a-0x0;var _0x50d65e=_0x60ac[_0x1ffd2a];return _0x50d65e;};'use strict';var multer=require(_0xc60a('0x0'));var util=require(_0xc60a('0x1'));var path=require('path');var timeout=require(_0xc60a('0x2'));var express=require(_0xc60a('0x3'));var router=express['Router']();var fs_extra=require(_0xc60a('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc60a('0x5'));var controller=require(_0xc60a('0x6'));router['get']('/',auth[_0xc60a('0x7')](),controller['index']);router[_0xc60a('0x8')]('/:id',auth[_0xc60a('0x7')](),controller[_0xc60a('0x9')]);router[_0xc60a('0x8')](_0xc60a('0xa'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0xc60a('0xb')]({'destination':function(_0x2d3ad0,_0x24e675,_0x24e0d8){_0x24e0d8(null,path['join'](config[_0xc60a('0xc')],_0xc60a('0xd')));},'filename':function(_0x4056cf,_0x1ad26b,_0x382e37){_0x1ad26b['originalname']=_0x1ad26b[_0xc60a('0xe')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x382e37(null,util[_0xc60a('0xf')](_0xc60a('0x10'),path[_0xc60a('0x11')](_0x1ad26b[_0xc60a('0xe')],path['extname'](_0x1ad26b[_0xc60a('0xe')])),Date[_0xc60a('0x12')](),path[_0xc60a('0x13')](_0x1ad26b[_0xc60a('0xe')])));}})});router['post']('/',upload[_0xc60a('0x14')](_0xc60a('0x15')),controller[_0xc60a('0x16')]);router[_0xc60a('0x17')](_0xc60a('0x18'),auth[_0xc60a('0x7')](),controller['update']);router['delete'](_0xc60a('0x18'),auth[_0xc60a('0x7')](),controller['delete']);module[_0xc60a('0x19')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 7f74abb..70b4937 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 _0x86af=['STRING','FLOAT','BIGINT','INTEGER'];(function(_0x37e848,_0x418405){var _0x512fe7=function(_0x1652c3){while(--_0x1652c3){_0x37e848['push'](_0x37e848['shift']());}};_0x512fe7(++_0x418405);}(_0x86af,0xdc));var _0xf86a=function(_0x443468,_0x5c8c24){_0x443468=_0x443468-0x0;var _0xb723f=_0x86af[_0x443468];return _0xb723f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xf86a('0x0')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0xf86a('0x0')],'defaultValue':''},'description':{'type':Sequelize[_0xf86a('0x0')]},'original_format':{'type':Sequelize[_0xf86a('0x0')]},'original_duration':{'type':Sequelize[_0xf86a('0x1')]},'original_sampleCount':{'type':Sequelize[_0xf86a('0x2')]},'original_channelCount':{'type':Sequelize[_0xf86a('0x3')]},'original_bitRate':{'type':Sequelize[_0xf86a('0x2')]},'original_sampleRate':{'type':Sequelize[_0xf86a('0x3')]},'converted_format':{'type':Sequelize[_0xf86a('0x0')]},'converted_duration':{'type':Sequelize[_0xf86a('0x1')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0xf86a('0x3')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0xf86a('0x3')]}}; \ No newline at end of file +var _0xd7c7=['INTEGER','exports','STRING','FLOAT','BIGINT'];(function(_0x39c76d,_0x34929d){var _0x135391=function(_0x43e64b){while(--_0x43e64b){_0x39c76d['push'](_0x39c76d['shift']());}};_0x135391(++_0x34929d);}(_0xd7c7,0x1f0));var _0x7d7c=function(_0x36cfcf,_0x55545d){_0x36cfcf=_0x36cfcf-0x0;var _0x5d4ec6=_0xd7c7[_0x36cfcf];return _0x5d4ec6;};'use strict';var Sequelize=require('sequelize');module[_0x7d7c('0x0')]={'name':{'type':Sequelize[_0x7d7c('0x1')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x7d7c('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x7d7c('0x1')]},'original_format':{'type':Sequelize[_0x7d7c('0x1')]},'original_duration':{'type':Sequelize[_0x7d7c('0x2')]},'original_sampleCount':{'type':Sequelize[_0x7d7c('0x3')]},'original_channelCount':{'type':Sequelize[_0x7d7c('0x4')]},'original_bitRate':{'type':Sequelize[_0x7d7c('0x3')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x7d7c('0x1')]},'converted_duration':{'type':Sequelize[_0x7d7c('0x2')]},'converted_sampleCount':{'type':Sequelize[_0x7d7c('0x3')]},'converted_channelCount':{'type':Sequelize[_0x7d7c('0x4')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x7d7c('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 1d8af4d..f4bde57 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 _0x75f1=['findAll','show','params','keys','includeAll','include','find','catch','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','ValidationError','Sound\x20not\x20found','download','format','%s.%s','file','originalname','extname','basename','filename','substring','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','wav','unlinkSync','src','original_duration','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_bitRate','converted_sampleRate','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','pick','delete','original_format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','Content-Range','apply','reject','save','update','then','destroy','get','Sounds','error','name','send','map','Sound','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options'];(function(_0x92776f,_0x7f7b9e){var _0x4f4a98=function(_0x3f8020){while(--_0x3f8020){_0x92776f['push'](_0x92776f['shift']());}};_0x4f4a98(++_0x7f7b9e);}(_0x75f1,0xc3));var _0x175f=function(_0x57b236,_0x30614e){_0x57b236=_0x57b236-0x0;var _0x4feb29=_0x75f1[_0x57b236];return _0x4feb29;};'use strict';var emlformat=require(_0x175f('0x0'));var rimraf=require(_0x175f('0x1'));var zipdir=require(_0x175f('0x2'));var jsonpatch=require(_0x175f('0x3'));var rp=require(_0x175f('0x4'));var moment=require(_0x175f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x175f('0x6'));var util=require(_0x175f('0x7'));var path=require(_0x175f('0x8'));var sox=require(_0x175f('0x9'));var csv=require(_0x175f('0xa'));var ejs=require(_0x175f('0xb'));var fs=require('fs');var fs_extra=require(_0x175f('0xc'));var _=require('lodash');var squel=require(_0x175f('0xd'));var crypto=require(_0x175f('0xe'));var jsforce=require(_0x175f('0xf'));var deskjs=require(_0x175f('0x10'));var toCsv=require(_0x175f('0xa'));var querystring=require(_0x175f('0x11'));var Papa=require(_0x175f('0x12'));var Redis=require('ioredis');var authService=require(_0x175f('0x13'));var qs=require(_0x175f('0x14'));var as=require(_0x175f('0x15'));var hardwareService=require(_0x175f('0x16'));var logger=require(_0x175f('0x17'))(_0x175f('0x18'));var utils=require(_0x175f('0x19'));var config=require(_0x175f('0x1a'));var licenseUtil=require(_0x175f('0x1b'));var db=require(_0x175f('0x1c'))['db'];function respondWithStatusCode(_0x5f26ee,_0x34e9d0){_0x34e9d0=_0x34e9d0||0xcc;return function(_0x4c74c9){if(_0x4c74c9){return _0x5f26ee[_0x175f('0x1d')](_0x34e9d0);}return _0x5f26ee[_0x175f('0x1e')](_0x34e9d0)[_0x175f('0x1f')]();};}function respondWithResult(_0x29db7c,_0x5ef2f1){_0x5ef2f1=_0x5ef2f1||0xc8;return function(_0x3eacd0){if(_0x3eacd0){return _0x29db7c[_0x175f('0x1e')](_0x5ef2f1)[_0x175f('0x20')](_0x3eacd0);}};}function respondWithFilteredResult(_0x4dc959,_0xccabb){return function(_0x2d5149){if(_0x2d5149){var _0x3c2ee2=typeof _0xccabb['offset']===_0x175f('0x21')&&typeof _0xccabb['limit']===_0x175f('0x21');var _0x42c75=_0x2d5149['count'];var _0x27f5cc=_0x3c2ee2?0x0:_0xccabb[_0x175f('0x22')];var _0x5ab0fa=_0x3c2ee2?_0x2d5149[_0x175f('0x23')]:_0xccabb[_0x175f('0x22')]+_0xccabb[_0x175f('0x24')];var _0x28f81d;if(_0x5ab0fa>=_0x42c75){_0x5ab0fa=_0x42c75;_0x28f81d=0xc8;}else{_0x28f81d=0xce;}_0x4dc959['status'](_0x28f81d);return _0x4dc959['set'](_0x175f('0x25'),_0x27f5cc+'-'+_0x5ab0fa+'/'+_0x42c75)[_0x175f('0x20')](_0x2d5149);}return null;};}function patchUpdates(_0x5aa3cf){return function(_0x141362){try{jsonpatch[_0x175f('0x26')](_0x141362,_0x5aa3cf,!![]);}catch(_0x4ffc30){return BPromise[_0x175f('0x27')](_0x4ffc30);}return _0x141362[_0x175f('0x28')]();};}function saveUpdates(_0x1e24a3,_0x2a84cc){return function(_0x1fdf60){if(_0x1fdf60){return _0x1fdf60[_0x175f('0x29')](_0x1e24a3)[_0x175f('0x2a')](function(_0x46baec){return _0x46baec;});}return null;};}function removeEntity(_0x2bfe5c,_0x162e6a){return function(_0xc25286){if(_0xc25286){return _0xc25286[_0x175f('0x2b')]()[_0x175f('0x2a')](function(){var _0x4260c1=_0xc25286[_0x175f('0x2c')]({'plain':!![]});var _0x4e6834=_0x175f('0x2d');return db['UserProfileResource'][_0x175f('0x2b')]({'where':{'type':_0x4e6834,'resourceId':_0x4260c1['id']}})[_0x175f('0x2a')](function(){return _0xc25286;});})['then'](function(){_0x2bfe5c[_0x175f('0x1e')](0xcc)[_0x175f('0x1f')]();});}};}function handleEntityNotFound(_0x4f7fd5,_0x5c1cf4){return function(_0x532d53){if(!_0x532d53){_0x4f7fd5['sendStatus'](0x194);}return _0x532d53;};}function handleError(_0x55f127,_0x1e17ad){_0x1e17ad=_0x1e17ad||0x1f4;return function(_0x289e7f){logger[_0x175f('0x2e')](_0x289e7f['stack']);if(_0x289e7f[_0x175f('0x2f')]){delete _0x289e7f[_0x175f('0x2f')];}_0x55f127[_0x175f('0x1e')](_0x1e17ad)[_0x175f('0x30')](_0x289e7f);};}exports['index']=function(_0x3f5a9a,_0x4567c5){var _0x5289d8={},_0x1f7a10={},_0x335cdc={'count':0x0,'rows':[]};var _0x1557a4=_[_0x175f('0x31')](db[_0x175f('0x32')][_0x175f('0x33')],function(_0x51bb1e){return{'name':_0x51bb1e[_0x175f('0x34')],'type':_0x51bb1e[_0x175f('0x35')][_0x175f('0x36')]};});_0x1f7a10[_0x175f('0x37')]=_[_0x175f('0x31')](_0x1557a4,_0x175f('0x2f'));_0x1f7a10[_0x175f('0x38')]=_['keys'](_0x3f5a9a[_0x175f('0x38')]);_0x1f7a10['filters']=_[_0x175f('0x39')](_0x1f7a10[_0x175f('0x37')],_0x1f7a10['query']);_0x5289d8[_0x175f('0x3a')]=_[_0x175f('0x39')](_0x1f7a10[_0x175f('0x37')],qs[_0x175f('0x3b')](_0x3f5a9a[_0x175f('0x38')][_0x175f('0x3b')]));_0x5289d8[_0x175f('0x3a')]=_0x5289d8[_0x175f('0x3a')][_0x175f('0x3c')]?_0x5289d8['attributes']:_0x1f7a10[_0x175f('0x37')];if(!_0x3f5a9a['query'][_0x175f('0x3d')](_0x175f('0x3e'))){_0x5289d8[_0x175f('0x24')]=qs[_0x175f('0x24')](_0x3f5a9a['query'][_0x175f('0x24')]);_0x5289d8[_0x175f('0x22')]=qs[_0x175f('0x22')](_0x3f5a9a[_0x175f('0x38')][_0x175f('0x22')]);}_0x5289d8[_0x175f('0x3f')]=qs[_0x175f('0x40')](_0x3f5a9a[_0x175f('0x38')]['sort']);_0x5289d8[_0x175f('0x41')]=qs['filters'](_['pick'](_0x3f5a9a[_0x175f('0x38')],_0x1f7a10[_0x175f('0x42')]),_0x1557a4);if(_0x3f5a9a[_0x175f('0x38')][_0x175f('0x43')]){_0x5289d8[_0x175f('0x41')]=_[_0x175f('0x44')](_0x5289d8[_0x175f('0x41')],{'$or':_[_0x175f('0x31')](_0x1557a4,function(_0xefe12){if(_0xefe12[_0x175f('0x35')]!==_0x175f('0x45')){var _0x402194={};_0x402194[_0xefe12[_0x175f('0x2f')]]={'$like':'%'+_0x3f5a9a[_0x175f('0x38')][_0x175f('0x43')]+'%'};return _0x402194;}})});}_0x5289d8=_[_0x175f('0x44')]({},_0x5289d8,_0x3f5a9a[_0x175f('0x46')]);var _0x30b912={'where':_0x5289d8[_0x175f('0x41')]};return db['Sound'][_0x175f('0x23')](_0x30b912)[_0x175f('0x2a')](function(_0xa16ee1){_0x335cdc[_0x175f('0x23')]=_0xa16ee1;if(_0x3f5a9a[_0x175f('0x38')]['includeAll']){_0x5289d8['include']=[{'all':!![]}];}return db[_0x175f('0x32')][_0x175f('0x47')](_0x5289d8);})[_0x175f('0x2a')](function(_0x1f69ef){_0x335cdc['rows']=_0x1f69ef;return _0x335cdc;})[_0x175f('0x2a')](respondWithFilteredResult(_0x4567c5,_0x5289d8))['catch'](handleError(_0x4567c5,null));};exports[_0x175f('0x48')]=function(_0x56569e,_0xf06a){var _0x7ebd18={'raw':!![],'where':{'id':_0x56569e[_0x175f('0x49')]['id']}},_0x4d381e={};_0x4d381e[_0x175f('0x37')]=_[_0x175f('0x4a')](db[_0x175f('0x32')]['rawAttributes']);_0x4d381e[_0x175f('0x38')]=_['keys'](_0x56569e[_0x175f('0x38')]);_0x4d381e[_0x175f('0x42')]=_['intersection'](_0x4d381e['model'],_0x4d381e[_0x175f('0x38')]);_0x7ebd18[_0x175f('0x3a')]=_[_0x175f('0x39')](_0x4d381e[_0x175f('0x37')],qs['fields'](_0x56569e[_0x175f('0x38')][_0x175f('0x3b')]));_0x7ebd18[_0x175f('0x3a')]=_0x7ebd18[_0x175f('0x3a')][_0x175f('0x3c')]?_0x7ebd18['attributes']:_0x4d381e[_0x175f('0x37')];if(_0x56569e[_0x175f('0x38')][_0x175f('0x4b')]){_0x7ebd18[_0x175f('0x4c')]=[{'all':!![]}];}_0x7ebd18=_[_0x175f('0x44')]({},_0x7ebd18,_0x56569e[_0x175f('0x46')]);return db['Sound'][_0x175f('0x4d')](_0x7ebd18)[_0x175f('0x2a')](handleEntityNotFound(_0xf06a,null))['then'](respondWithResult(_0xf06a,null))[_0x175f('0x4e')](handleError(_0xf06a,null));};exports['download']=function(_0xfcc75a,_0x51397e,_0x26ef15){return db[_0x175f('0x32')][_0x175f('0x4d')]({'where':{'id':_0xfcc75a[_0x175f('0x49')]['id']},'attributes':[_0x175f('0x2f'),_0x175f('0x4f'),_0x175f('0x50')],'raw':!![]})[_0x175f('0x2a')](handleEntityNotFound(_0x51397e,null))[_0x175f('0x2a')](function(_0x8c4066){if(_0x8c4066){if(!fs[_0x175f('0x51')](path[_0x175f('0x52')](config[_0x175f('0x53')],_0x175f('0x54'),_0x8c4066[_0x175f('0x4f')]+'.'+_0x8c4066['converted_format']))){throw new db['Sequelize'][(_0x175f('0x55'))](_0x175f('0x56'));}return _0x51397e[_0x175f('0x57')](path[_0x175f('0x52')](config[_0x175f('0x53')],_0x175f('0x54'),util[_0x175f('0x58')]('%s.%s',_0x8c4066['save_name'],_0x8c4066['converted_format'])),util[_0x175f('0x58')](_0x175f('0x59'),_0x8c4066['name'],_0x8c4066[_0x175f('0x50')]));}return null;})[_0x175f('0x4e')](handleError(_0x51397e,null));};exports['create']=function(_0x561fe6,_0xc40c20,_0x1b3d0e){var _0xe053a={'name':path['basename'](_0x561fe6[_0x175f('0x5a')][_0x175f('0x5b')],path[_0x175f('0x5c')](_0x561fe6[_0x175f('0x5a')][_0x175f('0x5b')])),'save_name':path[_0x175f('0x5d')](_0x561fe6[_0x175f('0x5a')]['filename'],path[_0x175f('0x5c')](_0x561fe6[_0x175f('0x5a')][_0x175f('0x5e')])),'original_format':path[_0x175f('0x5c')](_0x561fe6[_0x175f('0x5a')][_0x175f('0x5b')])[_0x175f('0x5f')](0x1),'converted_format':'wav'};var _0x18bb81=path[_0x175f('0x52')](config[_0x175f('0x53')],_0x175f('0x60'),_0x561fe6[_0x175f('0x5a')][_0x175f('0x5e')]);var _0x50637f=path['join'](config[_0x175f('0x53')],_0x175f('0x54'),util[_0x175f('0x58')]('%s.%s',path[_0x175f('0x5d')](_0x561fe6[_0x175f('0x5a')][_0x175f('0x5e')],path['extname'](_0x561fe6[_0x175f('0x5a')][_0x175f('0x5e')])),_0xe053a[_0x175f('0x50')]));logger[_0x175f('0x61')](_0x175f('0x62'),_0x18bb81);logger[_0x175f('0x61')](_0x175f('0x63'),_0x50637f);try{fs[_0x175f('0x64')](_0x18bb81,parseInt(_0x175f('0x65'),0x8));var _0xbac54a=sox[_0x175f('0x66')](_0x18bb81,_0x50637f,{'sampleRate':0x1f40,'format':_0x175f('0x67'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xbac54a['on'](_0x175f('0x2e'),function(_0x182a9e){fs[_0x175f('0x68')](_0x18bb81);_0xc40c20[_0x175f('0x1e')](0x1f4)['send'](_0x182a9e);});_0xbac54a['on'](_0x175f('0x69'),function(_0x367f7d){_0xe053a[_0x175f('0x6a')]=isNaN(_0x367f7d[_0x175f('0x6b')])?null:_0x367f7d[_0x175f('0x6b')]*0x3e8;_0xe053a['original_sampleCount']=isNaN(_0x367f7d[_0x175f('0x6c')])?null:_0x367f7d[_0x175f('0x6c')];_0xe053a[_0x175f('0x6d')]=isNaN(_0x367f7d['channelCount'])?null:_0x367f7d[_0x175f('0x6e')];_0xe053a[_0x175f('0x6f')]=isNaN(_0x367f7d[_0x175f('0x70')])?null:_0x367f7d[_0x175f('0x70')];_0xe053a[_0x175f('0x71')]=isNaN(_0x367f7d[_0x175f('0x72')])?null:_0x367f7d[_0x175f('0x72')];});_0xbac54a['on'](_0x175f('0x73'),function(_0x14c9fe){_0xe053a[_0x175f('0x74')]=isNaN(_0x14c9fe[_0x175f('0x6b')])?null:_0x14c9fe['duration']*0x3e8;_0xe053a[_0x175f('0x75')]=isNaN(_0x14c9fe[_0x175f('0x6c')])?null:_0x14c9fe[_0x175f('0x6c')];_0xe053a['converted_channelCount']=isNaN(_0x14c9fe[_0x175f('0x6e')])?null:_0x14c9fe[_0x175f('0x6e')];_0xe053a[_0x175f('0x76')]=isNaN(_0x14c9fe[_0x175f('0x70')])?null:_0x14c9fe[_0x175f('0x70')];_0xe053a[_0x175f('0x77')]=isNaN(_0x14c9fe[_0x175f('0x72')])?null:_0x14c9fe[_0x175f('0x72')];});_0xbac54a['on'](_0x175f('0x1f'),function(){fs[_0x175f('0x64')](_0x50637f,parseInt(_0x175f('0x65'),0x8));return db['Sound'][_0x175f('0x78')](_0xe053a)['then'](function(_0x3940bd){var _0xc76832={'role':_0x561fe6[_0x175f('0x79')][_0x175f('0x7a')],'userProfileId':_0x561fe6[_0x175f('0x79')]['userProfileId']};if(!_0xc76832)throw new Error(_0x175f('0x7b'));if(_0xc76832[_0x175f('0x7a')]===_0x175f('0x7c')){var _0x2040b1=_0x3940bd[_0x175f('0x2c')]({'plain':!![]});return db[_0x175f('0x7d')][_0x175f('0x4d')]({'where':{'name':_0x175f('0x2d'),'userProfileId':_0xc76832[_0x175f('0x7e')]},'raw':!![]})[_0x175f('0x2a')](function(_0x27a9c3){if(_0x27a9c3&&_0x27a9c3[_0x175f('0x7f')]===0x0){return db[_0x175f('0x80')][_0x175f('0x78')]({'name':_0x2040b1[_0x175f('0x2f')],'resourceId':_0x2040b1['id'],'type':_0x27a9c3[_0x175f('0x2f')],'sectionId':_0x27a9c3['id']},{})[_0x175f('0x2a')](function(){return _0x3940bd;});}else{return _0x3940bd;}})[_0x175f('0x4e')](function(_0x481185){logger[_0x175f('0x2e')](_0x175f('0x81'),_0x481185);throw _0x481185;});}return _0x3940bd;})['then'](respondWithResult(_0xc40c20,null))[_0x175f('0x4e')](handleError(_0xc40c20,null));});_0xbac54a['start']();}catch(_0x5ba72f){_0xc40c20[_0x175f('0x1e')](0x1f4)[_0x175f('0x30')](_0x5ba72f);}};exports[_0x175f('0x29')]=function(_0x334b04,_0x299e7a,_0x19d74f){return db['Sound'][_0x175f('0x4d')]({'where':{'id':_0x334b04[_0x175f('0x49')]['id']}})[_0x175f('0x2a')](handleEntityNotFound(_0x299e7a,null))['then'](saveUpdates(_[_0x175f('0x82')](_0x334b04[_0x175f('0x79')],[_0x175f('0x2f'),'description']),null))[_0x175f('0x2a')](respondWithResult(_0x299e7a,null))[_0x175f('0x4e')](handleError(_0x299e7a,null));};exports[_0x175f('0x83')]=function(_0x4210d4,_0x1f71ef,_0xbbd87d){return db[_0x175f('0x32')][_0x175f('0x4d')]({'where':{'id':_0x4210d4[_0x175f('0x49')]['id']}})[_0x175f('0x2a')](function(_0x1a2da9){if(_0x1a2da9){return _0x1a2da9[_0x175f('0x2b')]();}})[_0x175f('0x2a')](function(_0x165470){var _0xa7cc2e=path[_0x175f('0x52')](config[_0x175f('0x53')],_0x175f('0x60'),util[_0x175f('0x58')](_0x175f('0x59'),_0x165470[_0x175f('0x4f')],_0x165470[_0x175f('0x84')]));var _0x3f8da4=path['join'](config[_0x175f('0x53')],_0x175f('0x54'),util[_0x175f('0x58')](_0x175f('0x59'),_0x165470['save_name'],_0x165470[_0x175f('0x50')]));fs[_0x175f('0x68')](_0xa7cc2e);fs[_0x175f('0x68')](_0x3f8da4);return _0x165470;})[_0x175f('0x2a')](function(_0x2d6b62){if(_0x2d6b62){return _0x1f71ef[_0x175f('0x1e')](0xcc)[_0x175f('0x1f')]();}})[_0x175f('0x2a')](handleEntityNotFound(_0x1f71ef,null))[_0x175f('0x4e')](handleError(_0x1f71ef,null));}; \ No newline at end of file +var _0x04b2=['channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','autoAssociation','UserProfileResource','pick','delete','original_format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','Sounds','then','error','name','send','index','Sound','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','map','options','includeAll','include','rows','catch','show','rawAttributes','length','find','download','params','existsSync','join','root','save_name','converted_format','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','create','basename','originalname','extname','file','filename','substring','wav','server/files/sounds/original','server/files/sounds/converted','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount'];(function(_0x15029f,_0x58be73){var _0x36688c=function(_0xc6062){while(--_0xc6062){_0x15029f['push'](_0x15029f['shift']());}};_0x36688c(++_0x58be73);}(_0x04b2,0x93));var _0x204b=function(_0x5d0347,_0x49ebd2){_0x5d0347=_0x5d0347-0x0;var _0xaaf756=_0x04b2[_0x5d0347];return _0xaaf756;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x204b('0x0'));var zipdir=require(_0x204b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x204b('0x2'));var moment=require(_0x204b('0x3'));var BPromise=require(_0x204b('0x4'));var Mustache=require(_0x204b('0x5'));var util=require(_0x204b('0x6'));var path=require(_0x204b('0x7'));var sox=require('sox');var csv=require(_0x204b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x204b('0x9'));var _=require(_0x204b('0xa'));var squel=require('squel');var crypto=require(_0x204b('0xb'));var jsforce=require(_0x204b('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x204b('0x8'));var querystring=require('querystring');var Papa=require(_0x204b('0xd'));var Redis=require(_0x204b('0xe'));var authService=require(_0x204b('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x204b('0x10'))(_0x204b('0x11'));var utils=require(_0x204b('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x204b('0x13'));var db=require(_0x204b('0x14'))['db'];function respondWithStatusCode(_0x488a29,_0x326de6){_0x326de6=_0x326de6||0xcc;return function(_0x117840){if(_0x117840){return _0x488a29[_0x204b('0x15')](_0x326de6);}return _0x488a29[_0x204b('0x16')](_0x326de6)[_0x204b('0x17')]();};}function respondWithResult(_0x2f51b2,_0x5df272){_0x5df272=_0x5df272||0xc8;return function(_0xd628da){if(_0xd628da){return _0x2f51b2[_0x204b('0x16')](_0x5df272)[_0x204b('0x18')](_0xd628da);}};}function respondWithFilteredResult(_0x43ec40,_0x45dd7e){return function(_0xcbee24){if(_0xcbee24){var _0x4cf5d3=typeof _0x45dd7e[_0x204b('0x19')]===_0x204b('0x1a')&&typeof _0x45dd7e[_0x204b('0x1b')]==='undefined';var _0x2f2105=_0xcbee24[_0x204b('0x1c')];var _0x611e87=_0x4cf5d3?0x0:_0x45dd7e['offset'];var _0x93a4cc=_0x4cf5d3?_0xcbee24[_0x204b('0x1c')]:_0x45dd7e[_0x204b('0x19')]+_0x45dd7e['limit'];var _0x294912;if(_0x93a4cc>=_0x2f2105){_0x93a4cc=_0x2f2105;_0x294912=0xc8;}else{_0x294912=0xce;}_0x43ec40['status'](_0x294912);return _0x43ec40[_0x204b('0x1d')]('Content-Range',_0x611e87+'-'+_0x93a4cc+'/'+_0x2f2105)[_0x204b('0x18')](_0xcbee24);}return null;};}function patchUpdates(_0x464fe4){return function(_0x260bd9){try{jsonpatch[_0x204b('0x1e')](_0x260bd9,_0x464fe4,!![]);}catch(_0x14e461){return BPromise[_0x204b('0x1f')](_0x14e461);}return _0x260bd9[_0x204b('0x20')]();};}function saveUpdates(_0x26d612,_0x452e33){return function(_0x4a8f2a){if(_0x4a8f2a){return _0x4a8f2a[_0x204b('0x21')](_0x26d612)['then'](function(_0x709b2d){return _0x709b2d;});}return null;};}function removeEntity(_0x17ec83,_0x182fdd){return function(_0x510cea){if(_0x510cea){return _0x510cea[_0x204b('0x22')]()['then'](function(){var _0x1b3c78=_0x510cea['get']({'plain':!![]});var _0xf26554=_0x204b('0x23');return db['UserProfileResource'][_0x204b('0x22')]({'where':{'type':_0xf26554,'resourceId':_0x1b3c78['id']}})[_0x204b('0x24')](function(){return _0x510cea;});})[_0x204b('0x24')](function(){_0x17ec83['status'](0xcc)[_0x204b('0x17')]();});}};}function handleEntityNotFound(_0x104c60,_0x54d94c){return function(_0x4aa054){if(!_0x4aa054){_0x104c60[_0x204b('0x15')](0x194);}return _0x4aa054;};}function handleError(_0x2f2aff,_0x321df7){_0x321df7=_0x321df7||0x1f4;return function(_0x2d18bd){logger[_0x204b('0x25')](_0x2d18bd['stack']);if(_0x2d18bd[_0x204b('0x26')]){delete _0x2d18bd[_0x204b('0x26')];}_0x2f2aff[_0x204b('0x16')](_0x321df7)[_0x204b('0x27')](_0x2d18bd);};}exports[_0x204b('0x28')]=function(_0x340559,_0x1d1e0b){var _0x365c65={},_0x53bcc5={},_0x16cc1f={'count':0x0,'rows':[]};var _0x559c8f=_['map'](db[_0x204b('0x29')]['rawAttributes'],function(_0x31bae9){return{'name':_0x31bae9[_0x204b('0x2a')],'type':_0x31bae9['type'][_0x204b('0x2b')]};});_0x53bcc5[_0x204b('0x2c')]=_['map'](_0x559c8f,_0x204b('0x26'));_0x53bcc5[_0x204b('0x2d')]=_[_0x204b('0x2e')](_0x340559['query']);_0x53bcc5['filters']=_[_0x204b('0x2f')](_0x53bcc5[_0x204b('0x2c')],_0x53bcc5[_0x204b('0x2d')]);_0x365c65[_0x204b('0x30')]=_['intersection'](_0x53bcc5['model'],qs['fields'](_0x340559[_0x204b('0x2d')][_0x204b('0x31')]));_0x365c65[_0x204b('0x30')]=_0x365c65[_0x204b('0x30')]['length']?_0x365c65[_0x204b('0x30')]:_0x53bcc5['model'];if(!_0x340559[_0x204b('0x2d')][_0x204b('0x32')](_0x204b('0x33'))){_0x365c65[_0x204b('0x1b')]=qs[_0x204b('0x1b')](_0x340559[_0x204b('0x2d')][_0x204b('0x1b')]);_0x365c65[_0x204b('0x19')]=qs['offset'](_0x340559[_0x204b('0x2d')][_0x204b('0x19')]);}_0x365c65[_0x204b('0x34')]=qs[_0x204b('0x35')](_0x340559['query'][_0x204b('0x35')]);_0x365c65[_0x204b('0x36')]=qs[_0x204b('0x37')](_['pick'](_0x340559['query'],_0x53bcc5[_0x204b('0x37')]),_0x559c8f);if(_0x340559['query'][_0x204b('0x38')]){_0x365c65['where']=_[_0x204b('0x39')](_0x365c65[_0x204b('0x36')],{'$or':_[_0x204b('0x3a')](_0x559c8f,function(_0x26b28e){if(_0x26b28e['type']!=='VIRTUAL'){var _0x4ce694={};_0x4ce694[_0x26b28e[_0x204b('0x26')]]={'$like':'%'+_0x340559['query'][_0x204b('0x38')]+'%'};return _0x4ce694;}})});}_0x365c65=_[_0x204b('0x39')]({},_0x365c65,_0x340559[_0x204b('0x3b')]);var _0x2590f7={'where':_0x365c65[_0x204b('0x36')]};return db[_0x204b('0x29')]['count'](_0x2590f7)[_0x204b('0x24')](function(_0x56e870){_0x16cc1f['count']=_0x56e870;if(_0x340559['query'][_0x204b('0x3c')]){_0x365c65[_0x204b('0x3d')]=[{'all':!![]}];}return db['Sound']['findAll'](_0x365c65);})[_0x204b('0x24')](function(_0x2264bc){_0x16cc1f[_0x204b('0x3e')]=_0x2264bc;return _0x16cc1f;})[_0x204b('0x24')](respondWithFilteredResult(_0x1d1e0b,_0x365c65))[_0x204b('0x3f')](handleError(_0x1d1e0b,null));};exports[_0x204b('0x40')]=function(_0x5b1ff2,_0x57ea01){var _0x15ccb9={'raw':!![],'where':{'id':_0x5b1ff2['params']['id']}},_0x1d8faf={};_0x1d8faf[_0x204b('0x2c')]=_[_0x204b('0x2e')](db['Sound'][_0x204b('0x41')]);_0x1d8faf[_0x204b('0x2d')]=_['keys'](_0x5b1ff2[_0x204b('0x2d')]);_0x1d8faf[_0x204b('0x37')]=_['intersection'](_0x1d8faf[_0x204b('0x2c')],_0x1d8faf[_0x204b('0x2d')]);_0x15ccb9['attributes']=_[_0x204b('0x2f')](_0x1d8faf[_0x204b('0x2c')],qs[_0x204b('0x31')](_0x5b1ff2['query']['fields']));_0x15ccb9[_0x204b('0x30')]=_0x15ccb9[_0x204b('0x30')][_0x204b('0x42')]?_0x15ccb9[_0x204b('0x30')]:_0x1d8faf['model'];if(_0x5b1ff2['query'][_0x204b('0x3c')]){_0x15ccb9[_0x204b('0x3d')]=[{'all':!![]}];}_0x15ccb9=_['merge']({},_0x15ccb9,_0x5b1ff2[_0x204b('0x3b')]);return db[_0x204b('0x29')][_0x204b('0x43')](_0x15ccb9)[_0x204b('0x24')](handleEntityNotFound(_0x57ea01,null))['then'](respondWithResult(_0x57ea01,null))[_0x204b('0x3f')](handleError(_0x57ea01,null));};exports[_0x204b('0x44')]=function(_0x36ed5f,_0x4fdf93,_0xfa90e7){return db[_0x204b('0x29')]['find']({'where':{'id':_0x36ed5f[_0x204b('0x45')]['id']},'attributes':[_0x204b('0x26'),'save_name','converted_format'],'raw':!![]})[_0x204b('0x24')](handleEntityNotFound(_0x4fdf93,null))[_0x204b('0x24')](function(_0x5b889d){if(_0x5b889d){if(!fs[_0x204b('0x46')](path[_0x204b('0x47')](config[_0x204b('0x48')],'server/files/sounds/converted',_0x5b889d[_0x204b('0x49')]+'.'+_0x5b889d[_0x204b('0x4a')]))){throw new db[(_0x204b('0x4b'))][(_0x204b('0x4c'))](_0x204b('0x4d'));}return _0x4fdf93[_0x204b('0x44')](path['join'](config['root'],'server/files/sounds/converted',util[_0x204b('0x4e')](_0x204b('0x4f'),_0x5b889d[_0x204b('0x49')],_0x5b889d[_0x204b('0x4a')])),util[_0x204b('0x4e')]('%s.%s',_0x5b889d[_0x204b('0x26')],_0x5b889d['converted_format']));}return null;})[_0x204b('0x3f')](handleError(_0x4fdf93,null));};exports[_0x204b('0x50')]=function(_0x26a22b,_0x5a82a9,_0x3142dd){var _0x9dcda3={'name':path[_0x204b('0x51')](_0x26a22b['file'][_0x204b('0x52')],path[_0x204b('0x53')](_0x26a22b['file'][_0x204b('0x52')])),'save_name':path[_0x204b('0x51')](_0x26a22b['file']['filename'],path[_0x204b('0x53')](_0x26a22b[_0x204b('0x54')][_0x204b('0x55')])),'original_format':path['extname'](_0x26a22b[_0x204b('0x54')]['originalname'])[_0x204b('0x56')](0x1),'converted_format':_0x204b('0x57')};var _0x3f8ba3=path['join'](config[_0x204b('0x48')],_0x204b('0x58'),_0x26a22b[_0x204b('0x54')][_0x204b('0x55')]);var _0x5ae59f=path[_0x204b('0x47')](config[_0x204b('0x48')],_0x204b('0x59'),util[_0x204b('0x4e')]('%s.%s',path[_0x204b('0x51')](_0x26a22b[_0x204b('0x54')][_0x204b('0x55')],path[_0x204b('0x53')](_0x26a22b['file'][_0x204b('0x55')])),_0x9dcda3[_0x204b('0x4a')]));logger[_0x204b('0x5a')](_0x204b('0x5b'),_0x3f8ba3);logger[_0x204b('0x5a')](_0x204b('0x5c'),_0x5ae59f);try{fs[_0x204b('0x5d')](_0x3f8ba3,parseInt(_0x204b('0x5e'),0x8));var _0x48ed39=sox[_0x204b('0x5f')](_0x3f8ba3,_0x5ae59f,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x48ed39['on'](_0x204b('0x25'),function(_0x51402a){fs[_0x204b('0x60')](_0x3f8ba3);_0x5a82a9['status'](0x1f4)[_0x204b('0x27')](_0x51402a);});_0x48ed39['on'](_0x204b('0x61'),function(_0x5e6785){_0x9dcda3[_0x204b('0x62')]=isNaN(_0x5e6785[_0x204b('0x63')])?null:_0x5e6785[_0x204b('0x63')]*0x3e8;_0x9dcda3[_0x204b('0x64')]=isNaN(_0x5e6785[_0x204b('0x65')])?null:_0x5e6785[_0x204b('0x65')];_0x9dcda3[_0x204b('0x66')]=isNaN(_0x5e6785[_0x204b('0x67')])?null:_0x5e6785['channelCount'];_0x9dcda3['original_bitRate']=isNaN(_0x5e6785[_0x204b('0x68')])?null:_0x5e6785[_0x204b('0x68')];_0x9dcda3[_0x204b('0x69')]=isNaN(_0x5e6785[_0x204b('0x6a')])?null:_0x5e6785[_0x204b('0x6a')];});_0x48ed39['on'](_0x204b('0x6b'),function(_0x49284e){_0x9dcda3[_0x204b('0x6c')]=isNaN(_0x49284e[_0x204b('0x63')])?null:_0x49284e[_0x204b('0x63')]*0x3e8;_0x9dcda3[_0x204b('0x6d')]=isNaN(_0x49284e[_0x204b('0x65')])?null:_0x49284e['sampleCount'];_0x9dcda3[_0x204b('0x6e')]=isNaN(_0x49284e['channelCount'])?null:_0x49284e[_0x204b('0x67')];_0x9dcda3[_0x204b('0x6f')]=isNaN(_0x49284e[_0x204b('0x68')])?null:_0x49284e[_0x204b('0x68')];_0x9dcda3[_0x204b('0x70')]=isNaN(_0x49284e['sampleRate'])?null:_0x49284e['sampleRate'];});_0x48ed39['on'](_0x204b('0x17'),function(){fs[_0x204b('0x5d')](_0x5ae59f,parseInt(_0x204b('0x5e'),0x8));return db['Sound'][_0x204b('0x50')](_0x9dcda3)['then'](function(_0x30bb01){var _0x22385c={'role':_0x26a22b[_0x204b('0x71')]['role'],'userProfileId':_0x26a22b[_0x204b('0x71')][_0x204b('0x72')]};if(!_0x22385c)throw new Error(_0x204b('0x73'));if(_0x22385c[_0x204b('0x74')]===_0x204b('0x75')){var _0x3b02ff=_0x30bb01[_0x204b('0x76')]({'plain':!![]});return db[_0x204b('0x77')]['find']({'where':{'name':_0x204b('0x23'),'userProfileId':_0x22385c[_0x204b('0x72')]},'raw':!![]})[_0x204b('0x24')](function(_0x59a7f1){if(_0x59a7f1&&_0x59a7f1[_0x204b('0x78')]===0x0){return db[_0x204b('0x79')][_0x204b('0x50')]({'name':_0x3b02ff[_0x204b('0x26')],'resourceId':_0x3b02ff['id'],'type':_0x59a7f1[_0x204b('0x26')],'sectionId':_0x59a7f1['id']},{})[_0x204b('0x24')](function(){return _0x30bb01;});}else{return _0x30bb01;}})['catch'](function(_0x5c4506){logger[_0x204b('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c4506);throw _0x5c4506;});}return _0x30bb01;})['then'](respondWithResult(_0x5a82a9,null))[_0x204b('0x3f')](handleError(_0x5a82a9,null));});_0x48ed39['start']();}catch(_0x491e5b){_0x5a82a9['status'](0x1f4)[_0x204b('0x27')](_0x491e5b);}};exports[_0x204b('0x21')]=function(_0xce7392,_0x41d152,_0x5893b9){return db[_0x204b('0x29')][_0x204b('0x43')]({'where':{'id':_0xce7392[_0x204b('0x45')]['id']}})[_0x204b('0x24')](handleEntityNotFound(_0x41d152,null))[_0x204b('0x24')](saveUpdates(_[_0x204b('0x7a')](_0xce7392[_0x204b('0x71')],[_0x204b('0x26'),'description']),null))[_0x204b('0x24')](respondWithResult(_0x41d152,null))[_0x204b('0x3f')](handleError(_0x41d152,null));};exports[_0x204b('0x7b')]=function(_0x55836b,_0x213a29,_0xe9e5c3){return db[_0x204b('0x29')][_0x204b('0x43')]({'where':{'id':_0x55836b[_0x204b('0x45')]['id']}})[_0x204b('0x24')](function(_0x3153ed){if(_0x3153ed){return _0x3153ed[_0x204b('0x22')]();}})[_0x204b('0x24')](function(_0x338a69){var _0x4cbe4b=path['join'](config[_0x204b('0x48')],_0x204b('0x58'),util[_0x204b('0x4e')](_0x204b('0x4f'),_0x338a69[_0x204b('0x49')],_0x338a69[_0x204b('0x7c')]));var _0xa57584=path[_0x204b('0x47')](config[_0x204b('0x48')],'server/files/sounds/converted',util[_0x204b('0x4e')]('%s.%s',_0x338a69[_0x204b('0x49')],_0x338a69[_0x204b('0x4a')]));fs['unlinkSync'](_0x4cbe4b);fs[_0x204b('0x60')](_0xa57584);return _0x338a69;})['then'](function(_0x4859b4){if(_0x4859b4){return _0x213a29['status'](0xcc)['end']();}})[_0x204b('0x24')](handleEntityNotFound(_0x213a29,null))[_0x204b('0x3f')](handleError(_0x213a29,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index da88e86..1b16c86 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 _0x2763=['exports','define','Sound','tools_sounds','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x2763,0x8b));var _0x3276=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2763[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x3276('0x0'));var util=require(_0x3276('0x1'));var logger=require(_0x3276('0x2'))(_0x3276('0x3'));var moment=require(_0x3276('0x4'));var BPromise=require(_0x3276('0x5'));var rp=require(_0x3276('0x6'));var fs=require('fs');var path=require(_0x3276('0x7'));var rimraf=require(_0x3276('0x8'));var config=require(_0x3276('0x9'));var attributes=require(_0x3276('0xa'));module[_0x3276('0xb')]=function(_0x380575,_0x17e80a){return _0x380575[_0x3276('0xc')](_0x3276('0xd'),attributes,{'tableName':_0x3276('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e52=['exports','define','Sound','tools_sounds','lodash','util','api','bluebird','path','rimraf','../../config/environment','./sound.attributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3e52,0xa0));var _0x23e5=function(_0x234f9e,_0x248116){_0x234f9e=_0x234f9e-0x0;var _0xeaa036=_0x3e52[_0x234f9e];return _0xeaa036;};'use strict';var _=require(_0x23e5('0x0'));var util=require(_0x23e5('0x1'));var logger=require('../../config/logger')(_0x23e5('0x2'));var moment=require('moment');var BPromise=require(_0x23e5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x23e5('0x4'));var rimraf=require(_0x23e5('0x5'));var config=require(_0x23e5('0x6'));var attributes=require(_0x23e5('0x7'));module[_0x23e5('0x8')]=function(_0x4264ff,_0x5f266a){return _0x4264ff[_0x23e5('0x9')](_0x23e5('0xa'),attributes,{'tableName':_0x23e5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index fd20ec4..9d39b4a 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 _0x1f90=['where','attributes','include','map','model','ShowSound','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','http','request','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','Sound','find','options','raw'];(function(_0x1bdcad,_0x14ffd1){var _0x2cb356=function(_0x44a508){while(--_0x44a508){_0x1bdcad['push'](_0x1bdcad['shift']());}};_0x2cb356(++_0x14ffd1);}(_0x1f90,0x1b9));var _0x01f9=function(_0x2867a6,_0x10d905){_0x2867a6=_0x2867a6-0x0;var _0x4afc2b=_0x1f90[_0x2867a6];return _0x4afc2b;};'use strict';var _=require(_0x01f9('0x0'));var util=require(_0x01f9('0x1'));var moment=require('moment');var BPromise=require(_0x01f9('0x2'));var rs=require(_0x01f9('0x3'));var fs=require('fs');var Redis=require(_0x01f9('0x4'));var db=require(_0x01f9('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x01f9('0x6'));var config=require('../../config/environment');var jayson=require(_0x01f9('0x7'));var client=jayson['client'][_0x01f9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x43c151,_0x2b67bf,_0x11ccfd){return new BPromise(function(_0xfc92ed,_0x3ea6ef){return client[_0x01f9('0x9')](_0x43c151,_0x11ccfd)['then'](function(_0x5e0da3){logger['info'](_0x01f9('0xa'),_0x2b67bf,_0x01f9('0xb'));logger[_0x01f9('0xc')](_0x01f9('0xd'),_0x2b67bf,_0x01f9('0xb'),JSON[_0x01f9('0xe')](_0x5e0da3));if(_0x5e0da3[_0x01f9('0xf')]){if(_0x5e0da3[_0x01f9('0xf')][_0x01f9('0x10')]===0x1f4){logger[_0x01f9('0xf')](_0x01f9('0xa'),_0x2b67bf,_0x5e0da3[_0x01f9('0xf')][_0x01f9('0x11')]);return _0x3ea6ef(_0x5e0da3['error'][_0x01f9('0x11')]);}logger[_0x01f9('0xf')](_0x01f9('0xa'),_0x2b67bf,_0x5e0da3['error'][_0x01f9('0x11')]);return _0xfc92ed(_0x5e0da3[_0x01f9('0xf')]['message']);}else{logger[_0x01f9('0x12')](_0x01f9('0xa'),_0x2b67bf,'request\x20sent');_0xfc92ed(_0x5e0da3[_0x01f9('0x13')][_0x01f9('0x11')]);}})['catch'](function(_0x283730){logger[_0x01f9('0xf')](_0x01f9('0xa'),_0x2b67bf,_0x283730);_0x3ea6ef(_0x283730);});});}exports['ShowSound']=function(_0x5113ab){var _0x4ce774=this;return new Promise(function(_0xb8f662,_0x8493a4){return db[_0x01f9('0x14')][_0x01f9('0x15')]({'raw':_0x5113ab[_0x01f9('0x16')]?_0x5113ab[_0x01f9('0x16')][_0x01f9('0x17')]===undefined?!![]:![]:!![],'where':_0x5113ab['options']?_0x5113ab[_0x01f9('0x16')][_0x01f9('0x18')]||null:null,'attributes':_0x5113ab[_0x01f9('0x16')]?_0x5113ab[_0x01f9('0x16')][_0x01f9('0x19')]||null:null,'include':_0x5113ab[_0x01f9('0x16')]?_0x5113ab[_0x01f9('0x16')][_0x01f9('0x1a')]?_[_0x01f9('0x1b')](_0x5113ab['options'][_0x01f9('0x1a')],function(_0x2d97d7){return{'model':db[_0x2d97d7[_0x01f9('0x1c')]],'as':_0x2d97d7['as'],'attributes':_0x2d97d7[_0x01f9('0x19')],'include':_0x2d97d7[_0x01f9('0x1a')]?_['map'](_0x2d97d7[_0x01f9('0x1a')],function(_0x215915){return{'model':db[_0x215915[_0x01f9('0x1c')]],'as':_0x215915['as'],'attributes':_0x215915['attributes'],'include':_0x215915[_0x01f9('0x1a')]?_['map'](_0x215915['include'],function(_0x188ad5){return{'model':db[_0x188ad5[_0x01f9('0x1c')]],'as':_0x188ad5['as'],'attributes':_0x188ad5[_0x01f9('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xbd5239){logger['info'](_0x01f9('0x1d'),_0x5113ab);logger[_0x01f9('0xc')](_0x01f9('0x1d'),_0x5113ab,JSON[_0x01f9('0xe')](_0xbd5239));_0xb8f662(_0xbd5239);})[_0x01f9('0x1e')](function(_0x2405bf){logger['error'](_0x01f9('0x1d'),_0x2405bf[_0x01f9('0x11')],_0x5113ab);_0x8493a4(_0x4ce774[_0x01f9('0xf')](0x1f4,_0x2405bf[_0x01f9('0x11')]));});});}; \ No newline at end of file +var _0xf461=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Sound,\x20%s,\x20%s','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','ShowSound','Sound','find','options','raw','attributes','map','include','model','stringify','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf461,0x14a));var _0x1f46=function(_0xb14e07,_0x1b665a){_0xb14e07=_0xb14e07-0x0;var _0x2bb27e=_0xf461[_0xb14e07];return _0x2bb27e;};'use strict';var _=require(_0x1f46('0x0'));var util=require(_0x1f46('0x1'));var moment=require(_0x1f46('0x2'));var BPromise=require(_0x1f46('0x3'));var rs=require(_0x1f46('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f46('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1f46('0x6'))(_0x1f46('0x7'));var config=require(_0x1f46('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1f46('0x9')][_0x1f46('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d2750,_0x38eaad,_0x415526){return new BPromise(function(_0xf74367,_0x487b72){return client[_0x1f46('0xb')](_0x1d2750,_0x415526)[_0x1f46('0xc')](function(_0x4415cf){logger[_0x1f46('0xd')](_0x1f46('0xe'),_0x38eaad,'request\x20sent');logger[_0x1f46('0xf')](_0x1f46('0x10'),_0x38eaad,_0x1f46('0x11'),JSON['stringify'](_0x4415cf));if(_0x4415cf[_0x1f46('0x12')]){if(_0x4415cf[_0x1f46('0x12')][_0x1f46('0x13')]===0x1f4){logger[_0x1f46('0x12')](_0x1f46('0xe'),_0x38eaad,_0x4415cf[_0x1f46('0x12')][_0x1f46('0x14')]);return _0x487b72(_0x4415cf[_0x1f46('0x12')][_0x1f46('0x14')]);}logger[_0x1f46('0x12')](_0x1f46('0xe'),_0x38eaad,_0x4415cf[_0x1f46('0x12')][_0x1f46('0x14')]);return _0xf74367(_0x4415cf['error'][_0x1f46('0x14')]);}else{logger['info'](_0x1f46('0xe'),_0x38eaad,'request\x20sent');_0xf74367(_0x4415cf[_0x1f46('0x15')][_0x1f46('0x14')]);}})['catch'](function(_0x18a4bc){logger[_0x1f46('0x12')](_0x1f46('0xe'),_0x38eaad,_0x18a4bc);_0x487b72(_0x18a4bc);});});}exports[_0x1f46('0x16')]=function(_0x3b3085){var _0x3ced08=this;return new Promise(function(_0x12d24e,_0x5e59d0){return db[_0x1f46('0x17')][_0x1f46('0x18')]({'raw':_0x3b3085[_0x1f46('0x19')]?_0x3b3085['options'][_0x1f46('0x1a')]===undefined?!![]:![]:!![],'where':_0x3b3085[_0x1f46('0x19')]?_0x3b3085[_0x1f46('0x19')]['where']||null:null,'attributes':_0x3b3085['options']?_0x3b3085['options'][_0x1f46('0x1b')]||null:null,'include':_0x3b3085['options']?_0x3b3085['options']['include']?_[_0x1f46('0x1c')](_0x3b3085[_0x1f46('0x19')][_0x1f46('0x1d')],function(_0xd5dc94){return{'model':db[_0xd5dc94[_0x1f46('0x1e')]],'as':_0xd5dc94['as'],'attributes':_0xd5dc94[_0x1f46('0x1b')],'include':_0xd5dc94[_0x1f46('0x1d')]?_[_0x1f46('0x1c')](_0xd5dc94[_0x1f46('0x1d')],function(_0x2f5faa){return{'model':db[_0x2f5faa[_0x1f46('0x1e')]],'as':_0x2f5faa['as'],'attributes':_0x2f5faa[_0x1f46('0x1b')],'include':_0x2f5faa[_0x1f46('0x1d')]?_[_0x1f46('0x1c')](_0x2f5faa[_0x1f46('0x1d')],function(_0x4e7aae){return{'model':db[_0x4e7aae[_0x1f46('0x1e')]],'as':_0x4e7aae['as'],'attributes':_0x4e7aae['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1854e2){logger[_0x1f46('0xd')](_0x1f46('0x16'),_0x3b3085);logger[_0x1f46('0xf')]('ShowSound',_0x3b3085,JSON[_0x1f46('0x1f')](_0x1854e2));_0x12d24e(_0x1854e2);})[_0x1f46('0x20')](function(_0x268662){logger['error'](_0x1f46('0x16'),_0x268662[_0x1f46('0x14')],_0x3b3085);_0x5e59d0(_0x3ced08['error'](0x1f4,_0x268662['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 2768446..c0ca0b2 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 _0xb10b=['./squareMessage.controller','get','index','isAuthenticated','show','post','create','put','/:id','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4cef84,_0x1717ef){var _0x9620c1=function(_0x549acf){while(--_0x549acf){_0x4cef84['push'](_0x4cef84['shift']());}};_0x9620c1(++_0x1717ef);}(_0xb10b,0x12a));var _0xbb10=function(_0x466b8c,_0x492ed0){_0x466b8c=_0x466b8c-0x0;var _0x3f461d=_0xb10b[_0x466b8c];return _0x3f461d;};'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('0xd')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['update']);router['delete'](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);module['exports']=router; \ No newline at end of file +var _0x9ffd=['util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','get','/:id','show','post','create','delete','destroy','exports','multer'];(function(_0x25bea7,_0x49ab45){var _0x175952=function(_0x56a0b5){while(--_0x56a0b5){_0x25bea7['push'](_0x25bea7['shift']());}};_0x175952(++_0x49ab45);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x4fa71e,_0x398ac4){_0x4fa71e=_0x4fa71e-0x0;var _0x33ba6a=_0x9ffd[_0x4fa71e];return _0x33ba6a;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var fs_extra=require(_0xd9ff('0x5'));var auth=require(_0xd9ff('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd9ff('0x7'));var controller=require(_0xd9ff('0x8'));router['get']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xa')]);router[_0xd9ff('0xb')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xd')]);router[_0xd9ff('0xe')]('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd9ff('0x10')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x11')]);module[_0xd9ff('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 0c10f60..220d18c 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 _0x9492=['out','sequelize','exports','STRING','TEXT','medium','ENUM'];(function(_0x493836,_0x5af577){var _0x57b579=function(_0x254e42){while(--_0x254e42){_0x493836['push'](_0x493836['shift']());}};_0x57b579(++_0x5af577);}(_0x9492,0x1c8));var _0x2949=function(_0x39a1ae,_0x210b6e){_0x39a1ae=_0x39a1ae-0x0;var _0x1c1411=_0x9492[_0x39a1ae];return _0x1c1411;};'use strict';var Sequelize=require(_0x2949('0x0'));module[_0x2949('0x1')]={'uniqueid':{'type':Sequelize[_0x2949('0x2')]},'body':{'type':Sequelize[_0x2949('0x3')](_0x2949('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x2949('0x5')]('in','out'),'defaultValue':_0x2949('0x6'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x2949('0x3')]}}; \ No newline at end of file +var _0x1319=['TEXT','ENUM','out','sequelize','exports','STRING'];(function(_0x5cd22a,_0x42c8cb){var _0x5abccf=function(_0x1a5b38){while(--_0x1a5b38){_0x5cd22a['push'](_0x5cd22a['shift']());}};_0x5abccf(++_0x42c8cb);}(_0x1319,0xf3));var _0x9131=function(_0x5a31f7,_0x2dca9c){_0x5a31f7=_0x5a31f7-0x0;var _0x46f6e2=_0x1319[_0x5a31f7];return _0x46f6e2;};'use strict';var Sequelize=require(_0x9131('0x0'));module[_0x9131('0x1')]={'uniqueid':{'type':Sequelize[_0x9131('0x2')]},'body':{'type':Sequelize[_0x9131('0x3')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x9131('0x4')]('in',_0x9131('0x5')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x9131('0x2')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 141cc3e..e654c10 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 _0xc025=['findAll','rows','catch','params','find','body','eml-format','zip-dir','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','SquareMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include'];(function(_0x2690f8,_0x4f9557){var _0x33f32c=function(_0x4a6e86){while(--_0x4a6e86){_0x2690f8['push'](_0x2690f8['shift']());}};_0x33f32c(++_0x4f9557);}(_0xc025,0x169));var _0x5c02=function(_0x42146d,_0x5daba1){_0x42146d=_0x42146d-0x0;var _0x354548=_0xc025[_0x42146d];return _0x354548;};'use strict';var emlformat=require(_0x5c02('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5c02('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5c02('0x2'));var moment=require(_0x5c02('0x3'));var BPromise=require(_0x5c02('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5c02('0x5'));var sox=require(_0x5c02('0x6'));var csv=require('to-csv');var ejs=require(_0x5c02('0x7'));var fs=require('fs');var fs_extra=require(_0x5c02('0x8'));var _=require(_0x5c02('0x9'));var squel=require(_0x5c02('0xa'));var crypto=require(_0x5c02('0xb'));var jsforce=require(_0x5c02('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5c02('0xd'));var querystring=require(_0x5c02('0xe'));var Papa=require('papaparse');var Redis=require(_0x5c02('0xf'));var authService=require(_0x5c02('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5c02('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5c02('0x12'));var db=require(_0x5c02('0x13'))['db'];function respondWithStatusCode(_0x531bc8,_0x490536){_0x490536=_0x490536||0xcc;return function(_0xa426cf){if(_0xa426cf){return _0x531bc8[_0x5c02('0x14')](_0x490536);}return _0x531bc8[_0x5c02('0x15')](_0x490536)[_0x5c02('0x16')]();};}function respondWithResult(_0x18610d,_0x1c30b3){_0x1c30b3=_0x1c30b3||0xc8;return function(_0x47c4f3){if(_0x47c4f3){return _0x18610d[_0x5c02('0x15')](_0x1c30b3)[_0x5c02('0x17')](_0x47c4f3);}};}function respondWithFilteredResult(_0x168f95,_0x2f948b){return function(_0x17888d){if(_0x17888d){var _0x1c6bfc=typeof _0x2f948b[_0x5c02('0x18')]===_0x5c02('0x19')&&typeof _0x2f948b[_0x5c02('0x1a')]==='undefined';var _0xf9532d=_0x17888d[_0x5c02('0x1b')];var _0x5b8444=_0x1c6bfc?0x0:_0x2f948b[_0x5c02('0x18')];var _0x4b7cb6=_0x1c6bfc?_0x17888d[_0x5c02('0x1b')]:_0x2f948b[_0x5c02('0x18')]+_0x2f948b[_0x5c02('0x1a')];var _0x2844ad;if(_0x4b7cb6>=_0xf9532d){_0x4b7cb6=_0xf9532d;_0x2844ad=0xc8;}else{_0x2844ad=0xce;}_0x168f95['status'](_0x2844ad);return _0x168f95[_0x5c02('0x1c')](_0x5c02('0x1d'),_0x5b8444+'-'+_0x4b7cb6+'/'+_0xf9532d)[_0x5c02('0x17')](_0x17888d);}return null;};}function patchUpdates(_0x2f96fd){return function(_0x43fe98){try{jsonpatch[_0x5c02('0x1e')](_0x43fe98,_0x2f96fd,!![]);}catch(_0x3e94a0){return BPromise[_0x5c02('0x1f')](_0x3e94a0);}return _0x43fe98[_0x5c02('0x20')]();};}function saveUpdates(_0x5801dc,_0x1ee5a2){return function(_0x3dca35){if(_0x3dca35){return _0x3dca35[_0x5c02('0x21')](_0x5801dc)[_0x5c02('0x22')](function(_0x5a8861){return _0x5a8861;});}return null;};}function removeEntity(_0x59ba1b,_0x4b09f6){return function(_0x4ba5e9){if(_0x4ba5e9){return _0x4ba5e9[_0x5c02('0x23')]()[_0x5c02('0x22')](function(){_0x59ba1b['status'](0xcc)[_0x5c02('0x16')]();});}};}function handleEntityNotFound(_0x24b8b6,_0x3f7dc8){return function(_0xbbaeea){if(!_0xbbaeea){_0x24b8b6[_0x5c02('0x14')](0x194);}return _0xbbaeea;};}function handleError(_0x54c18c,_0x2a9ea9){_0x2a9ea9=_0x2a9ea9||0x1f4;return function(_0x4780b9){logger[_0x5c02('0x24')](_0x4780b9[_0x5c02('0x25')]);if(_0x4780b9[_0x5c02('0x26')]){delete _0x4780b9['name'];}_0x54c18c['status'](_0x2a9ea9)[_0x5c02('0x27')](_0x4780b9);};}exports['index']=function(_0x2f8b5c,_0x5467d8){var _0x2a0dde={},_0x1c891f={},_0x39d6fe={'count':0x0,'rows':[]};var _0x3a0571=_['map'](db[_0x5c02('0x28')][_0x5c02('0x29')],function(_0x28a8c2){return{'name':_0x28a8c2[_0x5c02('0x2a')],'type':_0x28a8c2[_0x5c02('0x2b')][_0x5c02('0x2c')]};});_0x1c891f[_0x5c02('0x2d')]=_[_0x5c02('0x2e')](_0x3a0571,'name');_0x1c891f[_0x5c02('0x2f')]=_[_0x5c02('0x30')](_0x2f8b5c['query']);_0x1c891f[_0x5c02('0x31')]=_[_0x5c02('0x32')](_0x1c891f[_0x5c02('0x2d')],_0x1c891f[_0x5c02('0x2f')]);_0x2a0dde[_0x5c02('0x33')]=_[_0x5c02('0x32')](_0x1c891f[_0x5c02('0x2d')],qs[_0x5c02('0x34')](_0x2f8b5c[_0x5c02('0x2f')]['fields']));_0x2a0dde['attributes']=_0x2a0dde[_0x5c02('0x33')][_0x5c02('0x35')]?_0x2a0dde[_0x5c02('0x33')]:_0x1c891f[_0x5c02('0x2d')];if(!_0x2f8b5c[_0x5c02('0x2f')][_0x5c02('0x36')](_0x5c02('0x37'))){_0x2a0dde['limit']=qs[_0x5c02('0x1a')](_0x2f8b5c[_0x5c02('0x2f')]['limit']);_0x2a0dde[_0x5c02('0x18')]=qs[_0x5c02('0x18')](_0x2f8b5c['query'][_0x5c02('0x18')]);}_0x2a0dde[_0x5c02('0x38')]=qs[_0x5c02('0x39')](_0x2f8b5c[_0x5c02('0x2f')][_0x5c02('0x39')]);_0x2a0dde[_0x5c02('0x3a')]=qs['filters'](_['pick'](_0x2f8b5c[_0x5c02('0x2f')],_0x1c891f[_0x5c02('0x31')]),_0x3a0571);if(_0x2f8b5c[_0x5c02('0x2f')]['filter']){_0x2a0dde[_0x5c02('0x3a')]=_[_0x5c02('0x3b')](_0x2a0dde['where'],{'$or':_[_0x5c02('0x2e')](_0x3a0571,function(_0x31a997){if(_0x31a997[_0x5c02('0x2b')]!==_0x5c02('0x3c')){var _0xbd0419={};_0xbd0419[_0x31a997[_0x5c02('0x26')]]={'$like':'%'+_0x2f8b5c[_0x5c02('0x2f')][_0x5c02('0x3d')]+'%'};return _0xbd0419;}})});}_0x2a0dde=_[_0x5c02('0x3b')]({},_0x2a0dde,_0x2f8b5c[_0x5c02('0x3e')]);var _0x1e2ec7={'where':_0x2a0dde['where']};return db[_0x5c02('0x28')]['count'](_0x1e2ec7)['then'](function(_0x31fcc){_0x39d6fe[_0x5c02('0x1b')]=_0x31fcc;if(_0x2f8b5c[_0x5c02('0x2f')][_0x5c02('0x3f')]){_0x2a0dde[_0x5c02('0x40')]=[{'all':!![]}];}return db[_0x5c02('0x28')][_0x5c02('0x41')](_0x2a0dde);})[_0x5c02('0x22')](function(_0x3e87d8){_0x39d6fe[_0x5c02('0x42')]=_0x3e87d8;return _0x39d6fe;})['then'](respondWithFilteredResult(_0x5467d8,_0x2a0dde))[_0x5c02('0x43')](handleError(_0x5467d8,null));};exports['show']=function(_0x30ba0b,_0x4eccee){var _0x349310={'raw':!![],'where':{'id':_0x30ba0b[_0x5c02('0x44')]['id']}},_0x4aff10={};_0x4aff10[_0x5c02('0x2d')]=_[_0x5c02('0x30')](db['SquareMessage']['rawAttributes']);_0x4aff10[_0x5c02('0x2f')]=_[_0x5c02('0x30')](_0x30ba0b[_0x5c02('0x2f')]);_0x4aff10[_0x5c02('0x31')]=_[_0x5c02('0x32')](_0x4aff10[_0x5c02('0x2d')],_0x4aff10[_0x5c02('0x2f')]);_0x349310[_0x5c02('0x33')]=_['intersection'](_0x4aff10['model'],qs[_0x5c02('0x34')](_0x30ba0b[_0x5c02('0x2f')][_0x5c02('0x34')]));_0x349310[_0x5c02('0x33')]=_0x349310[_0x5c02('0x33')][_0x5c02('0x35')]?_0x349310['attributes']:_0x4aff10[_0x5c02('0x2d')];if(_0x30ba0b[_0x5c02('0x2f')][_0x5c02('0x3f')]){_0x349310[_0x5c02('0x40')]=[{'all':!![]}];}_0x349310=_[_0x5c02('0x3b')]({},_0x349310,_0x30ba0b[_0x5c02('0x3e')]);return db['SquareMessage'][_0x5c02('0x45')](_0x349310)[_0x5c02('0x22')](handleEntityNotFound(_0x4eccee,null))[_0x5c02('0x22')](respondWithResult(_0x4eccee,null))['catch'](handleError(_0x4eccee,null));};exports['create']=function(_0x5cdb00,_0x2c1c0b){return db[_0x5c02('0x28')]['create'](_0x5cdb00[_0x5c02('0x46')],{})[_0x5c02('0x22')](respondWithResult(_0x2c1c0b,0xc9))[_0x5c02('0x43')](handleError(_0x2c1c0b,null));};exports['update']=function(_0x607338,_0x1ae3a3){if(_0x607338[_0x5c02('0x46')]['id']){delete _0x607338['body']['id'];}return db[_0x5c02('0x28')][_0x5c02('0x45')]({'where':{'id':_0x607338[_0x5c02('0x44')]['id']}})[_0x5c02('0x22')](handleEntityNotFound(_0x1ae3a3,null))[_0x5c02('0x22')](saveUpdates(_0x607338[_0x5c02('0x46')],null))['then'](respondWithResult(_0x1ae3a3,null))[_0x5c02('0x43')](handleError(_0x1ae3a3,null));};exports[_0x5c02('0x23')]=function(_0x468a07,_0x1ceafb){return db[_0x5c02('0x28')][_0x5c02('0x45')]({'where':{'id':_0x468a07[_0x5c02('0x44')]['id']}})[_0x5c02('0x22')](handleEntityNotFound(_0x1ceafb,null))[_0x5c02('0x22')](removeEntity(_0x1ceafb,null))[_0x5c02('0x43')](handleError(_0x1ceafb,null));}; \ No newline at end of file +var _0x3b57=['../../config/logger','api','../../config/license/util','status','end','json','offset','limit','undefined','count','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','include','body','find','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x5eb874,_0x3d849f){var _0x5bbbd0=function(_0x54c86a){while(--_0x54c86a){_0x5eb874['push'](_0x5eb874['shift']());}};_0x5bbbd0(++_0x3d849f);}(_0x3b57,0x103));var _0x73b5=function(_0x519228,_0x2bcbc2){_0x519228=_0x519228-0x0;var _0xc3c605=_0x3b57[_0x519228];return _0xc3c605;};'use strict';var emlformat=require(_0x73b5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x73b5('0x1'));var jsonpatch=require(_0x73b5('0x2'));var rp=require('request-promise');var moment=require(_0x73b5('0x3'));var BPromise=require(_0x73b5('0x4'));var Mustache=require(_0x73b5('0x5'));var util=require('util');var path=require(_0x73b5('0x6'));var sox=require('sox');var csv=require(_0x73b5('0x7'));var ejs=require(_0x73b5('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x73b5('0x9'));var crypto=require(_0x73b5('0xa'));var jsforce=require(_0x73b5('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x73b5('0x7'));var querystring=require(_0x73b5('0xc'));var Papa=require(_0x73b5('0xd'));var Redis=require(_0x73b5('0xe'));var authService=require(_0x73b5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x73b5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x73b5('0x11'))(_0x73b5('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x73b5('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38159e,_0x408546){_0x408546=_0x408546||0xcc;return function(_0x164f3b){if(_0x164f3b){return _0x38159e['sendStatus'](_0x408546);}return _0x38159e[_0x73b5('0x14')](_0x408546)[_0x73b5('0x15')]();};}function respondWithResult(_0x3d2980,_0x2d3ddc){_0x2d3ddc=_0x2d3ddc||0xc8;return function(_0x439d44){if(_0x439d44){return _0x3d2980[_0x73b5('0x14')](_0x2d3ddc)[_0x73b5('0x16')](_0x439d44);}};}function respondWithFilteredResult(_0x363488,_0x2af26b){return function(_0x20b1e0){if(_0x20b1e0){var _0x2427d0=typeof _0x2af26b[_0x73b5('0x17')]==='undefined'&&typeof _0x2af26b[_0x73b5('0x18')]===_0x73b5('0x19');var _0x196e22=_0x20b1e0[_0x73b5('0x1a')];var _0x1bf821=_0x2427d0?0x0:_0x2af26b[_0x73b5('0x17')];var _0x43a6e1=_0x2427d0?_0x20b1e0[_0x73b5('0x1a')]:_0x2af26b[_0x73b5('0x17')]+_0x2af26b[_0x73b5('0x18')];var _0xe3d4f6;if(_0x43a6e1>=_0x196e22){_0x43a6e1=_0x196e22;_0xe3d4f6=0xc8;}else{_0xe3d4f6=0xce;}_0x363488[_0x73b5('0x14')](_0xe3d4f6);return _0x363488['set']('Content-Range',_0x1bf821+'-'+_0x43a6e1+'/'+_0x196e22)[_0x73b5('0x16')](_0x20b1e0);}return null;};}function patchUpdates(_0x134f50){return function(_0x409ff9){try{jsonpatch['apply'](_0x409ff9,_0x134f50,!![]);}catch(_0x5e12d2){return BPromise[_0x73b5('0x1b')](_0x5e12d2);}return _0x409ff9[_0x73b5('0x1c')]();};}function saveUpdates(_0x478cf0,_0xb3ff17){return function(_0x556f8b){if(_0x556f8b){return _0x556f8b[_0x73b5('0x1d')](_0x478cf0)[_0x73b5('0x1e')](function(_0x330fc7){return _0x330fc7;});}return null;};}function removeEntity(_0x38219d,_0x1a624c){return function(_0x48473f){if(_0x48473f){return _0x48473f[_0x73b5('0x1f')]()[_0x73b5('0x1e')](function(){_0x38219d[_0x73b5('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15ce9b,_0x2bd338){return function(_0x378d37){if(!_0x378d37){_0x15ce9b[_0x73b5('0x20')](0x194);}return _0x378d37;};}function handleError(_0x1005cd,_0x2bb762){_0x2bb762=_0x2bb762||0x1f4;return function(_0x33f9ea){logger[_0x73b5('0x21')](_0x33f9ea[_0x73b5('0x22')]);if(_0x33f9ea[_0x73b5('0x23')]){delete _0x33f9ea['name'];}_0x1005cd[_0x73b5('0x14')](_0x2bb762)[_0x73b5('0x24')](_0x33f9ea);};}exports[_0x73b5('0x25')]=function(_0x59a69c,_0x3715f2){var _0xfc51ff={},_0x19f861={},_0x2dd07a={'count':0x0,'rows':[]};var _0x9d7b6=_[_0x73b5('0x26')](db[_0x73b5('0x27')][_0x73b5('0x28')],function(_0x4fc81d){return{'name':_0x4fc81d[_0x73b5('0x29')],'type':_0x4fc81d[_0x73b5('0x2a')][_0x73b5('0x2b')]};});_0x19f861[_0x73b5('0x2c')]=_[_0x73b5('0x26')](_0x9d7b6,_0x73b5('0x23'));_0x19f861[_0x73b5('0x2d')]=_[_0x73b5('0x2e')](_0x59a69c['query']);_0x19f861['filters']=_[_0x73b5('0x2f')](_0x19f861[_0x73b5('0x2c')],_0x19f861[_0x73b5('0x2d')]);_0xfc51ff[_0x73b5('0x30')]=_[_0x73b5('0x2f')](_0x19f861[_0x73b5('0x2c')],qs[_0x73b5('0x31')](_0x59a69c[_0x73b5('0x2d')]['fields']));_0xfc51ff[_0x73b5('0x30')]=_0xfc51ff[_0x73b5('0x30')][_0x73b5('0x32')]?_0xfc51ff[_0x73b5('0x30')]:_0x19f861[_0x73b5('0x2c')];if(!_0x59a69c['query'][_0x73b5('0x33')]('nolimit')){_0xfc51ff[_0x73b5('0x18')]=qs[_0x73b5('0x18')](_0x59a69c[_0x73b5('0x2d')]['limit']);_0xfc51ff[_0x73b5('0x17')]=qs[_0x73b5('0x17')](_0x59a69c[_0x73b5('0x2d')]['offset']);}_0xfc51ff[_0x73b5('0x34')]=qs[_0x73b5('0x35')](_0x59a69c['query'][_0x73b5('0x35')]);_0xfc51ff[_0x73b5('0x36')]=qs[_0x73b5('0x37')](_[_0x73b5('0x38')](_0x59a69c[_0x73b5('0x2d')],_0x19f861[_0x73b5('0x37')]),_0x9d7b6);if(_0x59a69c[_0x73b5('0x2d')][_0x73b5('0x39')]){_0xfc51ff[_0x73b5('0x36')]=_[_0x73b5('0x3a')](_0xfc51ff['where'],{'$or':_['map'](_0x9d7b6,function(_0x2ccc86){if(_0x2ccc86[_0x73b5('0x2a')]!=='VIRTUAL'){var _0x3d1976={};_0x3d1976[_0x2ccc86['name']]={'$like':'%'+_0x59a69c[_0x73b5('0x2d')][_0x73b5('0x39')]+'%'};return _0x3d1976;}})});}_0xfc51ff=_[_0x73b5('0x3a')]({},_0xfc51ff,_0x59a69c[_0x73b5('0x3b')]);var _0x5be91d={'where':_0xfc51ff[_0x73b5('0x36')]};return db[_0x73b5('0x27')][_0x73b5('0x1a')](_0x5be91d)[_0x73b5('0x1e')](function(_0x2131ff){_0x2dd07a['count']=_0x2131ff;if(_0x59a69c['query'][_0x73b5('0x3c')]){_0xfc51ff['include']=[{'all':!![]}];}return db[_0x73b5('0x27')][_0x73b5('0x3d')](_0xfc51ff);})[_0x73b5('0x1e')](function(_0x152646){_0x2dd07a[_0x73b5('0x3e')]=_0x152646;return _0x2dd07a;})[_0x73b5('0x1e')](respondWithFilteredResult(_0x3715f2,_0xfc51ff))[_0x73b5('0x3f')](handleError(_0x3715f2,null));};exports[_0x73b5('0x40')]=function(_0x4d22bb,_0x18c882){var _0x5d3964={'raw':!![],'where':{'id':_0x4d22bb[_0x73b5('0x41')]['id']}},_0x489780={};_0x489780[_0x73b5('0x2c')]=_[_0x73b5('0x2e')](db[_0x73b5('0x27')]['rawAttributes']);_0x489780[_0x73b5('0x2d')]=_['keys'](_0x4d22bb[_0x73b5('0x2d')]);_0x489780[_0x73b5('0x37')]=_[_0x73b5('0x2f')](_0x489780['model'],_0x489780[_0x73b5('0x2d')]);_0x5d3964[_0x73b5('0x30')]=_[_0x73b5('0x2f')](_0x489780['model'],qs['fields'](_0x4d22bb[_0x73b5('0x2d')][_0x73b5('0x31')]));_0x5d3964[_0x73b5('0x30')]=_0x5d3964['attributes'][_0x73b5('0x32')]?_0x5d3964[_0x73b5('0x30')]:_0x489780[_0x73b5('0x2c')];if(_0x4d22bb[_0x73b5('0x2d')][_0x73b5('0x3c')]){_0x5d3964[_0x73b5('0x42')]=[{'all':!![]}];}_0x5d3964=_['merge']({},_0x5d3964,_0x4d22bb[_0x73b5('0x3b')]);return db[_0x73b5('0x27')]['find'](_0x5d3964)['then'](handleEntityNotFound(_0x18c882,null))[_0x73b5('0x1e')](respondWithResult(_0x18c882,null))[_0x73b5('0x3f')](handleError(_0x18c882,null));};exports['create']=function(_0x53d83f,_0x3baba2){return db['SquareMessage']['create'](_0x53d83f[_0x73b5('0x43')],{})['then'](respondWithResult(_0x3baba2,0xc9))[_0x73b5('0x3f')](handleError(_0x3baba2,null));};exports[_0x73b5('0x1d')]=function(_0x1c1ac0,_0x53c902){if(_0x1c1ac0[_0x73b5('0x43')]['id']){delete _0x1c1ac0[_0x73b5('0x43')]['id'];}return db[_0x73b5('0x27')]['find']({'where':{'id':_0x1c1ac0['params']['id']}})[_0x73b5('0x1e')](handleEntityNotFound(_0x53c902,null))['then'](saveUpdates(_0x1c1ac0[_0x73b5('0x43')],null))[_0x73b5('0x1e')](respondWithResult(_0x53c902,null))[_0x73b5('0x3f')](handleError(_0x53c902,null));};exports[_0x73b5('0x1f')]=function(_0x3bbaa3,_0x59c3fb){return db[_0x73b5('0x27')][_0x73b5('0x44')]({'where':{'id':_0x3bbaa3['params']['id']}})[_0x73b5('0x1e')](handleEntityNotFound(_0x59c3fb,null))[_0x73b5('0x1e')](removeEntity(_0x59c3fb,null))[_0x73b5('0x3f')](handleError(_0x59c3fb,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 762ff82..208e16e 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 _0xf7bb=['square_messages','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','SquareMessage'];(function(_0x2fcf18,_0x10009a){var _0x4c68cc=function(_0x444002){while(--_0x444002){_0x2fcf18['push'](_0x2fcf18['shift']());}};_0x4c68cc(++_0x10009a);}(_0xf7bb,0x121));var _0xbf7b=function(_0x14a85c,_0x1db7a5){_0x14a85c=_0x14a85c-0x0;var _0x32e12b=_0xf7bb[_0x14a85c];return _0x32e12b;};'use strict';var _=require(_0xbf7b('0x0'));var util=require(_0xbf7b('0x1'));var logger=require(_0xbf7b('0x2'))('api');var moment=require(_0xbf7b('0x3'));var BPromise=require(_0xbf7b('0x4'));var rp=require(_0xbf7b('0x5'));var fs=require('fs');var path=require(_0xbf7b('0x6'));var rimraf=require(_0xbf7b('0x7'));var config=require(_0xbf7b('0x8'));var attributes=require('./squareMessage.attributes');module[_0xbf7b('0x9')]=function(_0x38056d,_0x5a38d1){return _0x38056d['define'](_0xbf7b('0xa'),attributes,{'tableName':_0xbf7b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x04fb=['util','../../config/logger','bluebird','request-promise','path','rimraf','./squareMessage.attributes','define','SquareMessage','square_messages'];(function(_0x1385dc,_0x2c7fd7){var _0x2f6469=function(_0x47ed8a){while(--_0x47ed8a){_0x1385dc['push'](_0x1385dc['shift']());}};_0x2f6469(++_0x2c7fd7);}(_0x04fb,0x8c));var _0xb04f=function(_0x20e4ad,_0x36cafb){_0x20e4ad=_0x20e4ad-0x0;var _0x10c0ec=_0x04fb[_0x20e4ad];return _0x10c0ec;};'use strict';var _=require('lodash');var util=require(_0xb04f('0x0'));var logger=require(_0xb04f('0x1'))('api');var moment=require('moment');var BPromise=require(_0xb04f('0x2'));var rp=require(_0xb04f('0x3'));var fs=require('fs');var path=require(_0xb04f('0x4'));var rimraf=require(_0xb04f('0x5'));var config=require('../../config/environment');var attributes=require(_0xb04f('0x6'));module['exports']=function(_0x604c9f,_0x12f43d){return _0x604c9f[_0xb04f('0x7')](_0xb04f('0x8'),attributes,{'tableName':_0xb04f('0x9'),'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 64a1b30..7eaaeb7 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 _0xd203=['raw','then','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','client','http','request','info','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareMessage,\x20%s,\x20%s','message','result','catch','CreateSquareMessage','SquareMessage','options'];(function(_0x1872a1,_0x18ed95){var _0x5afa10=function(_0x104312){while(--_0x104312){_0x1872a1['push'](_0x1872a1['shift']());}};_0x5afa10(++_0x18ed95);}(_0xd203,0xdb));var _0x3d20=function(_0x70450,_0x30556a){_0x70450=_0x70450-0x0;var _0x2259a9=_0xd203[_0x70450];return _0x2259a9;};'use strict';var _=require(_0x3d20('0x0'));var util=require(_0x3d20('0x1'));var moment=require(_0x3d20('0x2'));var BPromise=require(_0x3d20('0x3'));var rs=require(_0x3d20('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3d20('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3d20('0x6'));var config=require(_0x3d20('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3d20('0x8')][_0x3d20('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8af679,_0x39a74c,_0x423d01){return new BPromise(function(_0x3ce14b,_0x2951e9){return client[_0x3d20('0xa')](_0x8af679,_0x423d01)['then'](function(_0x2e7873){logger[_0x3d20('0xb')]('SquareMessage,\x20%s,\x20%s',_0x39a74c,_0x3d20('0xc'));logger['debug'](_0x3d20('0xd'),_0x39a74c,_0x3d20('0xc'),JSON[_0x3d20('0xe')](_0x2e7873));if(_0x2e7873[_0x3d20('0xf')]){if(_0x2e7873[_0x3d20('0xf')][_0x3d20('0x10')]===0x1f4){logger[_0x3d20('0xf')](_0x3d20('0x11'),_0x39a74c,_0x2e7873['error'][_0x3d20('0x12')]);return _0x2951e9(_0x2e7873[_0x3d20('0xf')][_0x3d20('0x12')]);}logger['error'](_0x3d20('0x11'),_0x39a74c,_0x2e7873[_0x3d20('0xf')][_0x3d20('0x12')]);return _0x3ce14b(_0x2e7873['error'][_0x3d20('0x12')]);}else{logger[_0x3d20('0xb')]('SquareMessage,\x20%s,\x20%s',_0x39a74c,_0x3d20('0xc'));_0x3ce14b(_0x2e7873[_0x3d20('0x13')]['message']);}})[_0x3d20('0x14')](function(_0x8df15c){logger[_0x3d20('0xf')]('SquareMessage,\x20%s,\x20%s',_0x39a74c,_0x8df15c);_0x2951e9(_0x8df15c);});});}exports[_0x3d20('0x15')]=function(_0x34d98e){var _0x36f95c=this;return new Promise(function(_0x112474,_0x46ecff){return db[_0x3d20('0x16')]['create'](_0x34d98e['body'],{'raw':_0x34d98e['options']?_0x34d98e[_0x3d20('0x17')][_0x3d20('0x18')]===undefined?!![]:![]:!![]})[_0x3d20('0x19')](function(_0xde9d1){logger[_0x3d20('0xb')](_0x3d20('0x15'),_0x34d98e);logger[_0x3d20('0x1a')]('CreateSquareMessage',_0x34d98e,JSON[_0x3d20('0xe')](_0xde9d1));_0x112474(_0xde9d1);})['catch'](function(_0x3337e8){logger[_0x3d20('0xf')](_0x3d20('0x15'),_0x3337e8[_0x3d20('0x12')],_0x34d98e);_0x46ecff(_0x36f95c[_0x3d20('0xf')](0x1f4,_0x3337e8['message']));});});}; \ No newline at end of file +var _0xeadd=['request','then','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','SquareMessage,\x20%s,\x20%s','message','info','result','catch','CreateSquareMessage','SquareMessage','create','options','raw','debug','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http'];(function(_0x4e99c0,_0xcf6975){var _0x4fa388=function(_0x85144a){while(--_0x85144a){_0x4e99c0['push'](_0x4e99c0['shift']());}};_0x4fa388(++_0xcf6975);}(_0xeadd,0x11f));var _0xdead=function(_0x2bbfc4,_0x3aaf97){_0x2bbfc4=_0x2bbfc4-0x0;var _0x18199a=_0xeadd[_0x2bbfc4];return _0x18199a;};'use strict';var _=require(_0xdead('0x0'));var util=require(_0xdead('0x1'));var moment=require(_0xdead('0x2'));var BPromise=require(_0xdead('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdead('0x4'))['db'];var utils=require(_0xdead('0x5'));var logger=require(_0xdead('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xdead('0x7'));var client=jayson[_0xdead('0x8')][_0xdead('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36ee95,_0x447ee9,_0x27f55e){return new BPromise(function(_0x43ce5c,_0x4c9fb1){return client[_0xdead('0xa')](_0x36ee95,_0x27f55e)[_0xdead('0xb')](function(_0xaae65b){logger['info']('SquareMessage,\x20%s,\x20%s',_0x447ee9,_0xdead('0xc'));logger['debug'](_0xdead('0xd'),_0x447ee9,_0xdead('0xc'),JSON[_0xdead('0xe')](_0xaae65b));if(_0xaae65b[_0xdead('0xf')]){if(_0xaae65b[_0xdead('0xf')]['code']===0x1f4){logger['error'](_0xdead('0x10'),_0x447ee9,_0xaae65b[_0xdead('0xf')][_0xdead('0x11')]);return _0x4c9fb1(_0xaae65b[_0xdead('0xf')][_0xdead('0x11')]);}logger[_0xdead('0xf')]('SquareMessage,\x20%s,\x20%s',_0x447ee9,_0xaae65b[_0xdead('0xf')][_0xdead('0x11')]);return _0x43ce5c(_0xaae65b[_0xdead('0xf')]['message']);}else{logger[_0xdead('0x12')](_0xdead('0x10'),_0x447ee9,_0xdead('0xc'));_0x43ce5c(_0xaae65b[_0xdead('0x13')]['message']);}})[_0xdead('0x14')](function(_0x15264d){logger['error'](_0xdead('0x10'),_0x447ee9,_0x15264d);_0x4c9fb1(_0x15264d);});});}exports[_0xdead('0x15')]=function(_0x53a8af){var _0x1112d8=this;return new Promise(function(_0x212338,_0x1c4cce){return db[_0xdead('0x16')][_0xdead('0x17')](_0x53a8af['body'],{'raw':_0x53a8af[_0xdead('0x18')]?_0x53a8af[_0xdead('0x18')][_0xdead('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x43ac4c){logger['info'](_0xdead('0x15'),_0x53a8af);logger[_0xdead('0x1a')]('CreateSquareMessage',_0x53a8af,JSON[_0xdead('0xe')](_0x43ac4c));_0x212338(_0x43ac4c);})[_0xdead('0x14')](function(_0x2653e9){logger[_0xdead('0xf')](_0xdead('0x15'),_0x2653e9[_0xdead('0x11')],_0x53a8af);_0x1c4cce(_0x1112d8[_0xdead('0xf')](0x1f4,_0x2653e9[_0xdead('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index dd936bc..617ae04 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 _0x2369=['get','isAuthenticated','index','/:id','show','/:id/test','15s','test','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareOdbc.controller'];(function(_0x361d3f,_0x3be2aa){var _0x320229=function(_0x138319){while(--_0x138319){_0x361d3f['push'](_0x361d3f['shift']());}};_0x320229(++_0x3be2aa);}(_0x2369,0x15e));var _0x9236=function(_0x4aca12,_0x335d87){_0x4aca12=_0x4aca12-0x0;var _0xf0f91=_0x2369[_0x4aca12];return _0xf0f91;};'use strict';var multer=require(_0x9236('0x0'));var util=require(_0x9236('0x1'));var path=require(_0x9236('0x2'));var timeout=require(_0x9236('0x3'));var express=require(_0x9236('0x4'));var router=express[_0x9236('0x5')]();var fs_extra=require(_0x9236('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9236('0x7'));var config=require(_0x9236('0x8'));var controller=require(_0x9236('0x9'));router[_0x9236('0xa')]('/',auth[_0x9236('0xb')](),controller[_0x9236('0xc')]);router[_0x9236('0xa')](_0x9236('0xd'),auth[_0x9236('0xb')](),controller[_0x9236('0xe')]);router[_0x9236('0xa')](_0x9236('0xf'),auth[_0x9236('0xb')](),timeout(_0x9236('0x10')),controller[_0x9236('0x11')]);router[_0x9236('0x12')]('/',auth['isAuthenticated'](),controller[_0x9236('0x13')]);router[_0x9236('0x14')](_0x9236('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x9236('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x9236('0x16')]);module[_0x9236('0x17')]=router; \ No newline at end of file +var _0x0685=['15s','test','post','create','put','update','delete','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareOdbc.controller','get','/:id','isAuthenticated','show','/:id/test'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0685,0x197));var _0x5068=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x0685[_0x178e48];return _0x440d7e;};'use strict';var multer=require(_0x5068('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5068('0x1'));var express=require(_0x5068('0x2'));var router=express[_0x5068('0x3')]();var fs_extra=require(_0x5068('0x4'));var auth=require(_0x5068('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5068('0x6'));var controller=require(_0x5068('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x5068('0x8')](_0x5068('0x9'),auth[_0x5068('0xa')](),controller[_0x5068('0xb')]);router['get'](_0x5068('0xc'),auth[_0x5068('0xa')](),timeout(_0x5068('0xd')),controller[_0x5068('0xe')]);router[_0x5068('0xf')]('/',auth[_0x5068('0xa')](),controller[_0x5068('0x10')]);router[_0x5068('0x11')](_0x5068('0x9'),auth[_0x5068('0xa')](),controller[_0x5068('0x12')]);router[_0x5068('0x13')](_0x5068('0x9'),auth[_0x5068('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index e47a280..de1e44c 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 _0x60a2=['STRING','name'];(function(_0x1deb72,_0x3f6338){var _0x18bbdf=function(_0x1b4b9b){while(--_0x1b4b9b){_0x1deb72['push'](_0x1deb72['shift']());}};_0x18bbdf(++_0x3f6338);}(_0x60a2,0xee));var _0x260a=function(_0xa630b0,_0x4eee1e){_0xa630b0=_0xa630b0-0x0;var _0x26dc98=_0x60a2[_0xa630b0];return _0x26dc98;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x260a('0x0')],'unique':_0x260a('0x1'),'allowNull':![]},'dsn':{'type':Sequelize[_0x260a('0x0')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x385c=['exports','STRING','sequelize'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x385c,0x1d9));var _0xc385=function(_0x584a9d,_0x14a343){_0x584a9d=_0x584a9d-0x0;var _0x4b2f02=_0x385c[_0x584a9d];return _0x4b2f02;};'use strict';var Sequelize=require(_0xc385('0x0'));module[_0xc385('0x1')]={'name':{'type':Sequelize[_0xc385('0x2')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0xc385('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index f32abec..ed36ec0 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 _0x1407=['ODBC','error','stack','name','send','index','map','SquareOdbc','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','includeAll','include','show','params','options','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','odbc','dsn','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','reject','save','update','then','destroy','get'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x1407,0x1e1));var _0x7140=function(_0x586205,_0x56f8ca){_0x586205=_0x586205-0x0;var _0x539adf=_0x1407[_0x586205];return _0x539adf;};'use strict';var emlformat=require(_0x7140('0x0'));var rimraf=require(_0x7140('0x1'));var zipdir=require(_0x7140('0x2'));var jsonpatch=require(_0x7140('0x3'));var rp=require(_0x7140('0x4'));var moment=require('moment');var BPromise=require(_0x7140('0x5'));var Mustache=require(_0x7140('0x6'));var util=require(_0x7140('0x7'));var path=require('path');var sox=require(_0x7140('0x8'));var csv=require(_0x7140('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7140('0xa'));var _=require(_0x7140('0xb'));var squel=require(_0x7140('0xc'));var crypto=require('crypto');var jsforce=require(_0x7140('0xd'));var deskjs=require(_0x7140('0xe'));var toCsv=require(_0x7140('0x9'));var querystring=require(_0x7140('0xf'));var Papa=require(_0x7140('0x10'));var Redis=require(_0x7140('0x11'));var authService=require(_0x7140('0x12'));var qs=require(_0x7140('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7140('0x14'));var logger=require(_0x7140('0x15'))(_0x7140('0x16'));var utils=require(_0x7140('0x17'));var config=require(_0x7140('0x18'));var licenseUtil=require(_0x7140('0x19'));var db=require(_0x7140('0x1a'))['db'];function respondWithStatusCode(_0x52e3d8,_0x2173d6){_0x2173d6=_0x2173d6||0xcc;return function(_0xa481ce){if(_0xa481ce){return _0x52e3d8[_0x7140('0x1b')](_0x2173d6);}return _0x52e3d8[_0x7140('0x1c')](_0x2173d6)[_0x7140('0x1d')]();};}function respondWithResult(_0x592731,_0x40057f){_0x40057f=_0x40057f||0xc8;return function(_0x2376e1){if(_0x2376e1){return _0x592731['status'](_0x40057f)[_0x7140('0x1e')](_0x2376e1);}};}function respondWithFilteredResult(_0x1957b8,_0x3982eb){return function(_0x16cf93){if(_0x16cf93){var _0xc74615=typeof _0x3982eb[_0x7140('0x1f')]===_0x7140('0x20')&&typeof _0x3982eb['limit']===_0x7140('0x20');var _0x32eaeb=_0x16cf93[_0x7140('0x21')];var _0x43f389=_0xc74615?0x0:_0x3982eb[_0x7140('0x1f')];var _0x4ceda4=_0xc74615?_0x16cf93['count']:_0x3982eb['offset']+_0x3982eb['limit'];var _0x487b9b;if(_0x4ceda4>=_0x32eaeb){_0x4ceda4=_0x32eaeb;_0x487b9b=0xc8;}else{_0x487b9b=0xce;}_0x1957b8['status'](_0x487b9b);return _0x1957b8['set'](_0x7140('0x22'),_0x43f389+'-'+_0x4ceda4+'/'+_0x32eaeb)[_0x7140('0x1e')](_0x16cf93);}return null;};}function patchUpdates(_0x5399bc){return function(_0x72da62){try{jsonpatch['apply'](_0x72da62,_0x5399bc,!![]);}catch(_0x1099d5){return BPromise[_0x7140('0x23')](_0x1099d5);}return _0x72da62[_0x7140('0x24')]();};}function saveUpdates(_0x39cec5,_0x14c326){return function(_0x472d2c){if(_0x472d2c){return _0x472d2c[_0x7140('0x25')](_0x39cec5)[_0x7140('0x26')](function(_0x131328){return _0x131328;});}return null;};}function removeEntity(_0x3dad9f,_0x413de1){return function(_0x47ef60){if(_0x47ef60){return _0x47ef60[_0x7140('0x27')]()['then'](function(){var _0x7037e5=_0x47ef60[_0x7140('0x28')]({'plain':!![]});var _0x3ca7cb=_0x7140('0x29');return db['UserProfileResource'][_0x7140('0x27')]({'where':{'type':_0x3ca7cb,'resourceId':_0x7037e5['id']}})[_0x7140('0x26')](function(){return _0x47ef60;});})[_0x7140('0x26')](function(){_0x3dad9f['status'](0xcc)[_0x7140('0x1d')]();});}};}function handleEntityNotFound(_0x27af61,_0xa17749){return function(_0x46fd4b){if(!_0x46fd4b){_0x27af61[_0x7140('0x1b')](0x194);}return _0x46fd4b;};}function handleError(_0x33b5bf,_0x264b86){_0x264b86=_0x264b86||0x1f4;return function(_0x2d42c8){logger[_0x7140('0x2a')](_0x2d42c8[_0x7140('0x2b')]);if(_0x2d42c8[_0x7140('0x2c')]){delete _0x2d42c8[_0x7140('0x2c')];}_0x33b5bf[_0x7140('0x1c')](_0x264b86)[_0x7140('0x2d')](_0x2d42c8);};}exports[_0x7140('0x2e')]=function(_0x19894f,_0xc8b00){var _0x13b355={},_0x418fbb={},_0x58431f={'count':0x0,'rows':[]};var _0x343dda=_[_0x7140('0x2f')](db[_0x7140('0x30')][_0x7140('0x31')],function(_0x27b2eb){return{'name':_0x27b2eb['fieldName'],'type':_0x27b2eb[_0x7140('0x32')][_0x7140('0x33')]};});_0x418fbb[_0x7140('0x34')]=_['map'](_0x343dda,_0x7140('0x2c'));_0x418fbb[_0x7140('0x35')]=_[_0x7140('0x36')](_0x19894f[_0x7140('0x35')]);_0x418fbb[_0x7140('0x37')]=_[_0x7140('0x38')](_0x418fbb[_0x7140('0x34')],_0x418fbb[_0x7140('0x35')]);_0x13b355[_0x7140('0x39')]=_['intersection'](_0x418fbb[_0x7140('0x34')],qs[_0x7140('0x3a')](_0x19894f['query'][_0x7140('0x3a')]));_0x13b355[_0x7140('0x39')]=_0x13b355[_0x7140('0x39')][_0x7140('0x3b')]?_0x13b355[_0x7140('0x39')]:_0x418fbb['model'];if(!_0x19894f[_0x7140('0x35')]['hasOwnProperty'](_0x7140('0x3c'))){_0x13b355[_0x7140('0x3d')]=qs[_0x7140('0x3d')](_0x19894f['query'][_0x7140('0x3d')]);_0x13b355[_0x7140('0x1f')]=qs[_0x7140('0x1f')](_0x19894f['query'][_0x7140('0x1f')]);}_0x13b355[_0x7140('0x3e')]=qs[_0x7140('0x3f')](_0x19894f[_0x7140('0x35')][_0x7140('0x3f')]);_0x13b355[_0x7140('0x40')]=qs[_0x7140('0x37')](_[_0x7140('0x41')](_0x19894f[_0x7140('0x35')],_0x418fbb['filters']),_0x343dda);if(_0x19894f[_0x7140('0x35')][_0x7140('0x42')]){_0x13b355[_0x7140('0x40')]=_['merge'](_0x13b355['where'],{'$or':_[_0x7140('0x2f')](_0x343dda,function(_0xabf008){if(_0xabf008['type']!=='VIRTUAL'){var _0x35645f={};_0x35645f[_0xabf008[_0x7140('0x2c')]]={'$like':'%'+_0x19894f[_0x7140('0x35')][_0x7140('0x42')]+'%'};return _0x35645f;}})});}_0x13b355=_[_0x7140('0x43')]({},_0x13b355,_0x19894f['options']);var _0x3b1247={'where':_0x13b355['where']};return db[_0x7140('0x30')][_0x7140('0x21')](_0x3b1247)[_0x7140('0x26')](function(_0x3617b2){_0x58431f[_0x7140('0x21')]=_0x3617b2;if(_0x19894f[_0x7140('0x35')][_0x7140('0x44')]){_0x13b355[_0x7140('0x45')]=[{'all':!![]}];}return db[_0x7140('0x30')]['findAll'](_0x13b355);})[_0x7140('0x26')](function(_0x384bcf){_0x58431f['rows']=_0x384bcf;return _0x58431f;})[_0x7140('0x26')](respondWithFilteredResult(_0xc8b00,_0x13b355))['catch'](handleError(_0xc8b00,null));};exports[_0x7140('0x46')]=function(_0x24e6f7,_0x1b034e){var _0x183048={'raw':!![],'where':{'id':_0x24e6f7[_0x7140('0x47')]['id']}},_0x39303b={};_0x39303b[_0x7140('0x34')]=_[_0x7140('0x36')](db[_0x7140('0x30')][_0x7140('0x31')]);_0x39303b['query']=_[_0x7140('0x36')](_0x24e6f7[_0x7140('0x35')]);_0x39303b[_0x7140('0x37')]=_[_0x7140('0x38')](_0x39303b['model'],_0x39303b[_0x7140('0x35')]);_0x183048[_0x7140('0x39')]=_['intersection'](_0x39303b[_0x7140('0x34')],qs['fields'](_0x24e6f7['query']['fields']));_0x183048[_0x7140('0x39')]=_0x183048[_0x7140('0x39')][_0x7140('0x3b')]?_0x183048[_0x7140('0x39')]:_0x39303b[_0x7140('0x34')];if(_0x24e6f7[_0x7140('0x35')][_0x7140('0x44')]){_0x183048['include']=[{'all':!![]}];}_0x183048=_[_0x7140('0x43')]({},_0x183048,_0x24e6f7[_0x7140('0x48')]);return db[_0x7140('0x30')][_0x7140('0x49')](_0x183048)[_0x7140('0x26')](handleEntityNotFound(_0x1b034e,null))[_0x7140('0x26')](respondWithResult(_0x1b034e,null))[_0x7140('0x4a')](handleError(_0x1b034e,null));};exports['create']=function(_0x3a229d,_0x5d4c9c){return db[_0x7140('0x30')][_0x7140('0x4b')](_0x3a229d[_0x7140('0x4c')],{})[_0x7140('0x26')](function(_0x20fcfa){var _0x4940e5=_0x3a229d['user'][_0x7140('0x28')]({'plain':!![]});if(!_0x4940e5)throw new Error(_0x7140('0x4d'));if(_0x4940e5['role']===_0x7140('0x4e')){var _0x351741=_0x20fcfa['get']({'plain':!![]});var _0x156776=_0x7140('0x29');return db[_0x7140('0x4f')][_0x7140('0x49')]({'where':{'name':_0x156776,'userProfileId':_0x4940e5[_0x7140('0x50')]},'raw':!![]})[_0x7140('0x26')](function(_0x500389){if(_0x500389&&_0x500389['autoAssociation']===0x0){return db[_0x7140('0x51')]['create']({'name':_0x351741['name'],'resourceId':_0x351741['id'],'type':_0x500389[_0x7140('0x2c')],'sectionId':_0x500389['id']},{})['then'](function(){return _0x20fcfa;});}else{return _0x20fcfa;}})[_0x7140('0x4a')](function(_0x353df8){logger[_0x7140('0x2a')](_0x7140('0x52'),_0x353df8);throw _0x353df8;});}return _0x20fcfa;})[_0x7140('0x26')](respondWithResult(_0x5d4c9c,0xc9))[_0x7140('0x4a')](handleError(_0x5d4c9c,null));};exports[_0x7140('0x25')]=function(_0x521d2a,_0x41b827){if(_0x521d2a[_0x7140('0x4c')]['id']){delete _0x521d2a[_0x7140('0x4c')]['id'];}return db[_0x7140('0x30')]['find']({'where':{'id':_0x521d2a['params']['id']}})[_0x7140('0x26')](handleEntityNotFound(_0x41b827,null))[_0x7140('0x26')](saveUpdates(_0x521d2a[_0x7140('0x4c')],null))[_0x7140('0x26')](respondWithResult(_0x41b827,null))['catch'](handleError(_0x41b827,null));};exports[_0x7140('0x27')]=function(_0x4a63a0,_0xf9b609){return db[_0x7140('0x30')][_0x7140('0x49')]({'where':{'id':_0x4a63a0[_0x7140('0x47')]['id']}})[_0x7140('0x26')](handleEntityNotFound(_0xf9b609,null))[_0x7140('0x26')](removeEntity(_0xf9b609,null))[_0x7140('0x4a')](handleError(_0xf9b609,null));};exports[_0x7140('0x53')]=function(_0x3f439e,_0x47df25,_0x2ff54c){var _0x53aa83;return db['SquareOdbc'][_0x7140('0x49')]({'where':{'id':_0x3f439e[_0x7140('0x47')]['id']},'attributes':['id','dsn']})[_0x7140('0x26')](handleEntityNotFound(_0x47df25,null))['then'](function(_0x30774b){if(_0x30774b){var _0x438463=require(_0x7140('0x54'))();_0x438463['openSync'](_0x30774b[_0x7140('0x55')]);_0x438463[_0x7140('0x56')]();return _0x30774b;}})[_0x7140('0x26')](respondWithResult(_0x47df25,null))['catch'](handleError(_0x47df25,null));}; \ No newline at end of file +var _0x52a5=['undefined','limit','count','offset','Content-Range','reject','save','update','destroy','then','UserProfileResource','error','name','send','map','SquareOdbc','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','findAll','rows','params','rawAttributes','include','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ODBC','UserProfileSection','find','catch','dsn','openSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json'];(function(_0x268202,_0x4ff2ff){var _0x1847aa=function(_0x23ac03){while(--_0x23ac03){_0x268202['push'](_0x268202['shift']());}};_0x1847aa(++_0x4ff2ff);}(_0x52a5,0x85));var _0x552a=function(_0x137c8a,_0x18c301){_0x137c8a=_0x137c8a-0x0;var _0x10db36=_0x52a5[_0x137c8a];return _0x10db36;};'use strict';var emlformat=require(_0x552a('0x0'));var rimraf=require(_0x552a('0x1'));var zipdir=require(_0x552a('0x2'));var jsonpatch=require(_0x552a('0x3'));var rp=require(_0x552a('0x4'));var moment=require(_0x552a('0x5'));var BPromise=require(_0x552a('0x6'));var Mustache=require(_0x552a('0x7'));var util=require(_0x552a('0x8'));var path=require(_0x552a('0x9'));var sox=require(_0x552a('0xa'));var csv=require(_0x552a('0xb'));var ejs=require(_0x552a('0xc'));var fs=require('fs');var fs_extra=require(_0x552a('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x552a('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x552a('0xf'));var toCsv=require(_0x552a('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x552a('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x552a('0x11'));var hardwareService=require(_0x552a('0x12'));var logger=require(_0x552a('0x13'))(_0x552a('0x14'));var utils=require(_0x552a('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x552a('0x16'));var db=require(_0x552a('0x17'))['db'];function respondWithStatusCode(_0x5e20cc,_0x2c69cc){_0x2c69cc=_0x2c69cc||0xcc;return function(_0x38de84){if(_0x38de84){return _0x5e20cc['sendStatus'](_0x2c69cc);}return _0x5e20cc[_0x552a('0x18')](_0x2c69cc)[_0x552a('0x19')]();};}function respondWithResult(_0x3a5b9b,_0x1f53c9){_0x1f53c9=_0x1f53c9||0xc8;return function(_0x11ec15){if(_0x11ec15){return _0x3a5b9b['status'](_0x1f53c9)[_0x552a('0x1a')](_0x11ec15);}};}function respondWithFilteredResult(_0x54ce8f,_0x516fea){return function(_0x5cb232){if(_0x5cb232){var _0x3118ed=typeof _0x516fea['offset']===_0x552a('0x1b')&&typeof _0x516fea[_0x552a('0x1c')]===_0x552a('0x1b');var _0x4a49b4=_0x5cb232[_0x552a('0x1d')];var _0x3f33eb=_0x3118ed?0x0:_0x516fea['offset'];var _0x5cad86=_0x3118ed?_0x5cb232['count']:_0x516fea[_0x552a('0x1e')]+_0x516fea[_0x552a('0x1c')];var _0x50689f;if(_0x5cad86>=_0x4a49b4){_0x5cad86=_0x4a49b4;_0x50689f=0xc8;}else{_0x50689f=0xce;}_0x54ce8f['status'](_0x50689f);return _0x54ce8f['set'](_0x552a('0x1f'),_0x3f33eb+'-'+_0x5cad86+'/'+_0x4a49b4)[_0x552a('0x1a')](_0x5cb232);}return null;};}function patchUpdates(_0x5b371a){return function(_0x503a91){try{jsonpatch['apply'](_0x503a91,_0x5b371a,!![]);}catch(_0x20c9a0){return BPromise[_0x552a('0x20')](_0x20c9a0);}return _0x503a91[_0x552a('0x21')]();};}function saveUpdates(_0x3e6b21,_0x4319fc){return function(_0x23a4a8){if(_0x23a4a8){return _0x23a4a8[_0x552a('0x22')](_0x3e6b21)['then'](function(_0x28ba72){return _0x28ba72;});}return null;};}function removeEntity(_0x404c63,_0x17a18f){return function(_0x5e0a56){if(_0x5e0a56){return _0x5e0a56[_0x552a('0x23')]()[_0x552a('0x24')](function(){var _0x45f803=_0x5e0a56['get']({'plain':!![]});var _0x41f720='ODBC';return db[_0x552a('0x25')][_0x552a('0x23')]({'where':{'type':_0x41f720,'resourceId':_0x45f803['id']}})[_0x552a('0x24')](function(){return _0x5e0a56;});})[_0x552a('0x24')](function(){_0x404c63[_0x552a('0x18')](0xcc)[_0x552a('0x19')]();});}};}function handleEntityNotFound(_0x17454a,_0x2cc006){return function(_0x16d406){if(!_0x16d406){_0x17454a['sendStatus'](0x194);}return _0x16d406;};}function handleError(_0x5e6f2a,_0x45f9d5){_0x45f9d5=_0x45f9d5||0x1f4;return function(_0x39b679){logger[_0x552a('0x26')](_0x39b679['stack']);if(_0x39b679[_0x552a('0x27')]){delete _0x39b679[_0x552a('0x27')];}_0x5e6f2a[_0x552a('0x18')](_0x45f9d5)[_0x552a('0x28')](_0x39b679);};}exports['index']=function(_0x56f03e,_0x10711b){var _0x16e43f={},_0x35a161={},_0x20a04d={'count':0x0,'rows':[]};var _0x201827=_[_0x552a('0x29')](db[_0x552a('0x2a')]['rawAttributes'],function(_0x22e8c4){return{'name':_0x22e8c4[_0x552a('0x2b')],'type':_0x22e8c4[_0x552a('0x2c')][_0x552a('0x2d')]};});_0x35a161[_0x552a('0x2e')]=_[_0x552a('0x29')](_0x201827,_0x552a('0x27'));_0x35a161[_0x552a('0x2f')]=_[_0x552a('0x30')](_0x56f03e[_0x552a('0x2f')]);_0x35a161[_0x552a('0x31')]=_[_0x552a('0x32')](_0x35a161[_0x552a('0x2e')],_0x35a161[_0x552a('0x2f')]);_0x16e43f[_0x552a('0x33')]=_[_0x552a('0x32')](_0x35a161[_0x552a('0x2e')],qs[_0x552a('0x34')](_0x56f03e[_0x552a('0x2f')]['fields']));_0x16e43f[_0x552a('0x33')]=_0x16e43f['attributes'][_0x552a('0x35')]?_0x16e43f[_0x552a('0x33')]:_0x35a161[_0x552a('0x2e')];if(!_0x56f03e[_0x552a('0x2f')][_0x552a('0x36')](_0x552a('0x37'))){_0x16e43f[_0x552a('0x1c')]=qs[_0x552a('0x1c')](_0x56f03e[_0x552a('0x2f')][_0x552a('0x1c')]);_0x16e43f['offset']=qs[_0x552a('0x1e')](_0x56f03e[_0x552a('0x2f')][_0x552a('0x1e')]);}_0x16e43f['order']=qs[_0x552a('0x38')](_0x56f03e[_0x552a('0x2f')]['sort']);_0x16e43f[_0x552a('0x39')]=qs['filters'](_[_0x552a('0x3a')](_0x56f03e['query'],_0x35a161['filters']),_0x201827);if(_0x56f03e[_0x552a('0x2f')][_0x552a('0x3b')]){_0x16e43f[_0x552a('0x39')]=_[_0x552a('0x3c')](_0x16e43f[_0x552a('0x39')],{'$or':_[_0x552a('0x29')](_0x201827,function(_0x438585){if(_0x438585[_0x552a('0x2c')]!=='VIRTUAL'){var _0x34e968={};_0x34e968[_0x438585['name']]={'$like':'%'+_0x56f03e[_0x552a('0x2f')][_0x552a('0x3b')]+'%'};return _0x34e968;}})});}_0x16e43f=_[_0x552a('0x3c')]({},_0x16e43f,_0x56f03e['options']);var _0x134717={'where':_0x16e43f['where']};return db['SquareOdbc'][_0x552a('0x1d')](_0x134717)[_0x552a('0x24')](function(_0x4ffc53){_0x20a04d['count']=_0x4ffc53;if(_0x56f03e['query'][_0x552a('0x3d')]){_0x16e43f['include']=[{'all':!![]}];}return db[_0x552a('0x2a')][_0x552a('0x3e')](_0x16e43f);})[_0x552a('0x24')](function(_0xe086ba){_0x20a04d[_0x552a('0x3f')]=_0xe086ba;return _0x20a04d;})[_0x552a('0x24')](respondWithFilteredResult(_0x10711b,_0x16e43f))['catch'](handleError(_0x10711b,null));};exports['show']=function(_0x470ae7,_0x14a84a){var _0x47eb95={'raw':!![],'where':{'id':_0x470ae7[_0x552a('0x40')]['id']}},_0x125cf6={};_0x125cf6[_0x552a('0x2e')]=_['keys'](db[_0x552a('0x2a')][_0x552a('0x41')]);_0x125cf6['query']=_[_0x552a('0x30')](_0x470ae7[_0x552a('0x2f')]);_0x125cf6[_0x552a('0x31')]=_[_0x552a('0x32')](_0x125cf6[_0x552a('0x2e')],_0x125cf6['query']);_0x47eb95[_0x552a('0x33')]=_[_0x552a('0x32')](_0x125cf6[_0x552a('0x2e')],qs[_0x552a('0x34')](_0x470ae7[_0x552a('0x2f')][_0x552a('0x34')]));_0x47eb95['attributes']=_0x47eb95['attributes'][_0x552a('0x35')]?_0x47eb95[_0x552a('0x33')]:_0x125cf6[_0x552a('0x2e')];if(_0x470ae7[_0x552a('0x2f')][_0x552a('0x3d')]){_0x47eb95[_0x552a('0x42')]=[{'all':!![]}];}_0x47eb95=_[_0x552a('0x3c')]({},_0x47eb95,_0x470ae7[_0x552a('0x43')]);return db[_0x552a('0x2a')]['find'](_0x47eb95)[_0x552a('0x24')](handleEntityNotFound(_0x14a84a,null))[_0x552a('0x24')](respondWithResult(_0x14a84a,null))['catch'](handleError(_0x14a84a,null));};exports[_0x552a('0x44')]=function(_0x3d1186,_0x450725){return db[_0x552a('0x2a')]['create'](_0x3d1186[_0x552a('0x45')],{})[_0x552a('0x24')](function(_0x1c1ce7){var _0x3ad3bd=_0x3d1186[_0x552a('0x46')][_0x552a('0x47')]({'plain':!![]});if(!_0x3ad3bd)throw new Error(_0x552a('0x48'));if(_0x3ad3bd[_0x552a('0x49')]===_0x552a('0x46')){var _0x1e36f9=_0x1c1ce7['get']({'plain':!![]});var _0x412365=_0x552a('0x4a');return db[_0x552a('0x4b')][_0x552a('0x4c')]({'where':{'name':_0x412365,'userProfileId':_0x3ad3bd['userProfileId']},'raw':!![]})[_0x552a('0x24')](function(_0x470ca2){if(_0x470ca2&&_0x470ca2['autoAssociation']===0x0){return db[_0x552a('0x25')][_0x552a('0x44')]({'name':_0x1e36f9[_0x552a('0x27')],'resourceId':_0x1e36f9['id'],'type':_0x470ca2[_0x552a('0x27')],'sectionId':_0x470ca2['id']},{})['then'](function(){return _0x1c1ce7;});}else{return _0x1c1ce7;}})[_0x552a('0x4d')](function(_0x1976c5){logger[_0x552a('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1976c5);throw _0x1976c5;});}return _0x1c1ce7;})['then'](respondWithResult(_0x450725,0xc9))[_0x552a('0x4d')](handleError(_0x450725,null));};exports['update']=function(_0x15715b,_0x4dabcc){if(_0x15715b[_0x552a('0x45')]['id']){delete _0x15715b['body']['id'];}return db[_0x552a('0x2a')]['find']({'where':{'id':_0x15715b[_0x552a('0x40')]['id']}})[_0x552a('0x24')](handleEntityNotFound(_0x4dabcc,null))[_0x552a('0x24')](saveUpdates(_0x15715b[_0x552a('0x45')],null))[_0x552a('0x24')](respondWithResult(_0x4dabcc,null))[_0x552a('0x4d')](handleError(_0x4dabcc,null));};exports[_0x552a('0x23')]=function(_0x4b77f1,_0x511e1b){return db[_0x552a('0x2a')][_0x552a('0x4c')]({'where':{'id':_0x4b77f1['params']['id']}})[_0x552a('0x24')](handleEntityNotFound(_0x511e1b,null))[_0x552a('0x24')](removeEntity(_0x511e1b,null))[_0x552a('0x4d')](handleError(_0x511e1b,null));};exports['test']=function(_0x36c58e,_0x20f195,_0x11f92e){var _0x629058;return db['SquareOdbc'][_0x552a('0x4c')]({'where':{'id':_0x36c58e[_0x552a('0x40')]['id']},'attributes':['id',_0x552a('0x4e')]})[_0x552a('0x24')](handleEntityNotFound(_0x20f195,null))[_0x552a('0x24')](function(_0x32753f){if(_0x32753f){var _0x36e6bb=require('odbc')();_0x36e6bb[_0x552a('0x4f')](_0x32753f['dsn']);_0x36e6bb['closeSync']();return _0x32753f;}})[_0x552a('0x24')](respondWithResult(_0x20f195,null))[_0x552a('0x4d')](handleError(_0x20f195,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 8e6ebc4..5b52760 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 _0xed2c=['exports','define','SquareOdbc','square_odbc','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./squareOdbc.attributes'];(function(_0x5ac0f0,_0xee4d98){var _0x4aceec=function(_0x3a9044){while(--_0x3a9044){_0x5ac0f0['push'](_0x5ac0f0['shift']());}};_0x4aceec(++_0xee4d98);}(_0xed2c,0x10c));var _0xced2=function(_0x10e2c9,_0x489aab){_0x10e2c9=_0x10e2c9-0x0;var _0x426947=_0xed2c[_0x10e2c9];return _0x426947;};'use strict';var _=require(_0xced2('0x0'));var util=require(_0xced2('0x1'));var logger=require(_0xced2('0x2'))(_0xced2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xced2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xced2('0x5'));var config=require(_0xced2('0x6'));var attributes=require(_0xced2('0x7'));module[_0xced2('0x8')]=function(_0x2fdbe9,_0x20062f){return _0x2fdbe9[_0xced2('0x9')](_0xced2('0xa'),attributes,{'tableName':_0xced2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x03e9=['path','rimraf','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash','util','api','moment','bluebird','request-promise'];(function(_0xd474d1,_0x750c36){var _0x327bf7=function(_0x3a65aa){while(--_0x3a65aa){_0xd474d1['push'](_0xd474d1['shift']());}};_0x327bf7(++_0x750c36);}(_0x03e9,0x13f));var _0x903e=function(_0x17ea96,_0x1e33ab){_0x17ea96=_0x17ea96-0x0;var _0x48f13f=_0x03e9[_0x17ea96];return _0x48f13f;};'use strict';var _=require(_0x903e('0x0'));var util=require(_0x903e('0x1'));var logger=require('../../config/logger')(_0x903e('0x2'));var moment=require(_0x903e('0x3'));var BPromise=require(_0x903e('0x4'));var rp=require(_0x903e('0x5'));var fs=require('fs');var path=require(_0x903e('0x6'));var rimraf=require(_0x903e('0x7'));var config=require('../../config/environment');var attributes=require(_0x903e('0x8'));module[_0x903e('0x9')]=function(_0x4767ba,_0x2431ce){return _0x4767ba[_0x903e('0xa')](_0x903e('0xb'),attributes,{'tableName':_0x903e('0xc'),'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 a41ff01..011fad8 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 _0x5172=['map','debug','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','attributes','include','model'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x5172,0xf0));var _0x2517=function(_0x8320e8,_0x26030f){_0x8320e8=_0x8320e8-0x0;var _0xd04d0=_0x5172[_0x8320e8];return _0xd04d0;};'use strict';var _=require('lodash');var util=require(_0x2517('0x0'));var moment=require(_0x2517('0x1'));var BPromise=require('bluebird');var rs=require(_0x2517('0x2'));var fs=require('fs');var Redis=require(_0x2517('0x3'));var db=require(_0x2517('0x4'))['db'];var utils=require(_0x2517('0x5'));var logger=require(_0x2517('0x6'))(_0x2517('0x7'));var config=require(_0x2517('0x8'));var jayson=require(_0x2517('0x9'));var client=jayson[_0x2517('0xa')][_0x2517('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x11c80c,_0x30bc2f,_0x4d8891){return new BPromise(function(_0xa8587d,_0x5394b4){return client[_0x2517('0xc')](_0x11c80c,_0x4d8891)[_0x2517('0xd')](function(_0x402175){logger[_0x2517('0xe')](_0x2517('0xf'),_0x30bc2f,_0x2517('0x10'));logger['debug'](_0x2517('0x11'),_0x30bc2f,_0x2517('0x10'),JSON[_0x2517('0x12')](_0x402175));if(_0x402175[_0x2517('0x13')]){if(_0x402175[_0x2517('0x13')][_0x2517('0x14')]===0x1f4){logger['error'](_0x2517('0xf'),_0x30bc2f,_0x402175['error'][_0x2517('0x15')]);return _0x5394b4(_0x402175[_0x2517('0x13')][_0x2517('0x15')]);}logger[_0x2517('0x13')](_0x2517('0xf'),_0x30bc2f,_0x402175[_0x2517('0x13')]['message']);return _0xa8587d(_0x402175[_0x2517('0x13')][_0x2517('0x15')]);}else{logger[_0x2517('0xe')](_0x2517('0xf'),_0x30bc2f,'request\x20sent');_0xa8587d(_0x402175[_0x2517('0x16')][_0x2517('0x15')]);}})[_0x2517('0x17')](function(_0x3e8066){logger[_0x2517('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x30bc2f,_0x3e8066);_0x5394b4(_0x3e8066);});});}exports[_0x2517('0x18')]=function(_0x42a73c){var _0x492040=this;return new Promise(function(_0xa4ad55,_0x6cf6ec){return db[_0x2517('0x19')][_0x2517('0x1a')]({'raw':_0x42a73c[_0x2517('0x1b')]?_0x42a73c['options'][_0x2517('0x1c')]===undefined?!![]:![]:!![],'where':_0x42a73c[_0x2517('0x1b')]?_0x42a73c[_0x2517('0x1b')]['where']||null:null,'attributes':_0x42a73c['options']?_0x42a73c['options'][_0x2517('0x1d')]||null:null,'include':_0x42a73c[_0x2517('0x1b')]?_0x42a73c['options']['include']?_['map'](_0x42a73c[_0x2517('0x1b')][_0x2517('0x1e')],function(_0x298945){return{'model':db[_0x298945[_0x2517('0x1f')]],'as':_0x298945['as'],'attributes':_0x298945[_0x2517('0x1d')],'include':_0x298945[_0x2517('0x1e')]?_[_0x2517('0x20')](_0x298945[_0x2517('0x1e')],function(_0x218a82){return{'model':db[_0x218a82['model']],'as':_0x218a82['as'],'attributes':_0x218a82[_0x2517('0x1d')],'include':_0x218a82['include']?_[_0x2517('0x20')](_0x218a82[_0x2517('0x1e')],function(_0x2f473d){return{'model':db[_0x2f473d[_0x2517('0x1f')]],'as':_0x2f473d['as'],'attributes':_0x2f473d[_0x2517('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2517('0xd')](function(_0x11db3a){logger['info'](_0x2517('0x18'),_0x42a73c);logger[_0x2517('0x21')](_0x2517('0x18'),_0x42a73c,JSON[_0x2517('0x12')](_0x11db3a));_0xa4ad55(_0x11db3a);})[_0x2517('0x17')](function(_0x627e83){logger['error'](_0x2517('0x18'),_0x627e83['message'],_0x42a73c);_0x6cf6ec(_0x492040['error'](0x1f4,_0x627e83[_0x2517('0x15')]));});});}; \ No newline at end of file +var _0x8d5a=['request\x20sent','stringify','error','code','message','info','result','catch','ShowSquareOdbc','find','options','raw','attributes','map','model','include','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','SquareOdbc,\x20%s,\x20%s'];(function(_0x2c75ba,_0x845086){var _0x4450b2=function(_0x70a7cf){while(--_0x70a7cf){_0x2c75ba['push'](_0x2c75ba['shift']());}};_0x4450b2(++_0x845086);}(_0x8d5a,0x1f1));var _0xa8d5=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x8d5a[_0x487b0c];return _0x1adbdc;};'use strict';var _=require(_0xa8d5('0x0'));var util=require(_0xa8d5('0x1'));var moment=require(_0xa8d5('0x2'));var BPromise=require(_0xa8d5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa8d5('0x4'));var db=require(_0xa8d5('0x5'))['db'];var utils=require(_0xa8d5('0x6'));var logger=require(_0xa8d5('0x7'))(_0xa8d5('0x8'));var config=require(_0xa8d5('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x35d30d,_0x21b6c4,_0x214c10){return new BPromise(function(_0x2e1323,_0x2c8538){return client[_0xa8d5('0xa')](_0x35d30d,_0x214c10)[_0xa8d5('0xb')](function(_0x3f341d){logger['info'](_0xa8d5('0xc'),_0x21b6c4,_0xa8d5('0xd'));logger['debug']('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x21b6c4,_0xa8d5('0xd'),JSON[_0xa8d5('0xe')](_0x3f341d));if(_0x3f341d['error']){if(_0x3f341d[_0xa8d5('0xf')][_0xa8d5('0x10')]===0x1f4){logger[_0xa8d5('0xf')](_0xa8d5('0xc'),_0x21b6c4,_0x3f341d[_0xa8d5('0xf')][_0xa8d5('0x11')]);return _0x2c8538(_0x3f341d[_0xa8d5('0xf')][_0xa8d5('0x11')]);}logger['error'](_0xa8d5('0xc'),_0x21b6c4,_0x3f341d[_0xa8d5('0xf')][_0xa8d5('0x11')]);return _0x2e1323(_0x3f341d[_0xa8d5('0xf')]['message']);}else{logger[_0xa8d5('0x12')](_0xa8d5('0xc'),_0x21b6c4,'request\x20sent');_0x2e1323(_0x3f341d[_0xa8d5('0x13')][_0xa8d5('0x11')]);}})[_0xa8d5('0x14')](function(_0x96db5e){logger[_0xa8d5('0xf')](_0xa8d5('0xc'),_0x21b6c4,_0x96db5e);_0x2c8538(_0x96db5e);});});}exports[_0xa8d5('0x15')]=function(_0x1e9754){var _0x397fcd=this;return new Promise(function(_0x24f43c,_0x5e3615){return db['SquareOdbc'][_0xa8d5('0x16')]({'raw':_0x1e9754[_0xa8d5('0x17')]?_0x1e9754[_0xa8d5('0x17')][_0xa8d5('0x18')]===undefined?!![]:![]:!![],'where':_0x1e9754[_0xa8d5('0x17')]?_0x1e9754[_0xa8d5('0x17')]['where']||null:null,'attributes':_0x1e9754[_0xa8d5('0x17')]?_0x1e9754[_0xa8d5('0x17')][_0xa8d5('0x19')]||null:null,'include':_0x1e9754['options']?_0x1e9754[_0xa8d5('0x17')]['include']?_[_0xa8d5('0x1a')](_0x1e9754['options']['include'],function(_0x25ecc4){return{'model':db[_0x25ecc4[_0xa8d5('0x1b')]],'as':_0x25ecc4['as'],'attributes':_0x25ecc4[_0xa8d5('0x19')],'include':_0x25ecc4[_0xa8d5('0x1c')]?_[_0xa8d5('0x1a')](_0x25ecc4[_0xa8d5('0x1c')],function(_0x55974d){return{'model':db[_0x55974d[_0xa8d5('0x1b')]],'as':_0x55974d['as'],'attributes':_0x55974d[_0xa8d5('0x19')],'include':_0x55974d[_0xa8d5('0x1c')]?_['map'](_0x55974d[_0xa8d5('0x1c')],function(_0x3307d9){return{'model':db[_0x3307d9['model']],'as':_0x3307d9['as'],'attributes':_0x3307d9[_0xa8d5('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa8d5('0xb')](function(_0x242650){logger[_0xa8d5('0x12')](_0xa8d5('0x15'),_0x1e9754);logger[_0xa8d5('0x1d')](_0xa8d5('0x15'),_0x1e9754,JSON[_0xa8d5('0xe')](_0x242650));_0x24f43c(_0x242650);})[_0xa8d5('0x14')](function(_0x16824d){logger[_0xa8d5('0xf')](_0xa8d5('0x15'),_0x16824d['message'],_0x1e9754);_0x5e3615(_0x397fcd[_0xa8d5('0xf')](0x1f4,_0x16824d[_0xa8d5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 8bfe4ca..8f77104 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 _0xbac1=['./squareProject.controller','get','/:id','show','/:id/users','getUsers','post','isAuthenticated','create','addUsers','put','update','delete','removeUsers','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xbac1,0x17f));var _0x1bac=function(_0x5df543,_0x6d1a24){_0x5df543=_0x5df543-0x0;var _0x20a242=_0xbac1[_0x5df543];return _0x20a242;};'use strict';var multer=require('multer');var util=require(_0x1bac('0x0'));var path=require(_0x1bac('0x1'));var timeout=require(_0x1bac('0x2'));var express=require(_0x1bac('0x3'));var router=express[_0x1bac('0x4')]();var fs_extra=require(_0x1bac('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1bac('0x6'));var config=require(_0x1bac('0x7'));var controller=require(_0x1bac('0x8'));router[_0x1bac('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1bac('0x9')](_0x1bac('0xa'),auth['isAuthenticated'](),controller[_0x1bac('0xb')]);router[_0x1bac('0x9')](_0x1bac('0xc'),auth['isAuthenticated'](),controller[_0x1bac('0xd')]);router[_0x1bac('0xe')]('/',auth[_0x1bac('0xf')](),controller[_0x1bac('0x10')]);router['post'](_0x1bac('0xc'),auth[_0x1bac('0xf')](),controller[_0x1bac('0x11')]);router[_0x1bac('0x12')](_0x1bac('0xa'),auth[_0x1bac('0xf')](),controller[_0x1bac('0x13')]);router[_0x1bac('0x14')]('/:id',auth[_0x1bac('0xf')](),controller['destroy']);router['delete'](_0x1bac('0xc'),auth[_0x1bac('0xf')](),controller[_0x1bac('0x15')]);module[_0x1bac('0x16')]=router; \ No newline at end of file +var _0xd983=['../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','/:id/users','getUsers','post','addUsers','put','update','delete','removeUsers','multer','util','path','connect-timeout','express'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xd983,0x1df));var _0x3d98=function(_0x35999b,_0x4d35dd){_0x35999b=_0x35999b-0x0;var _0x1c545d=_0xd983[_0x35999b];return _0x1c545d;};'use strict';var multer=require(_0x3d98('0x0'));var util=require(_0x3d98('0x1'));var path=require(_0x3d98('0x2'));var timeout=require(_0x3d98('0x3'));var express=require(_0x3d98('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3d98('0x5'));var interaction=require(_0x3d98('0x6'));var config=require(_0x3d98('0x7'));var controller=require(_0x3d98('0x8'));router[_0x3d98('0x9')]('/',auth[_0x3d98('0xa')](),controller[_0x3d98('0xb')]);router['get'](_0x3d98('0xc'),auth[_0x3d98('0xa')](),controller[_0x3d98('0xd')]);router[_0x3d98('0x9')](_0x3d98('0xe'),auth[_0x3d98('0xa')](),controller[_0x3d98('0xf')]);router[_0x3d98('0x10')]('/',auth[_0x3d98('0xa')](),controller['create']);router['post'](_0x3d98('0xe'),auth[_0x3d98('0xa')](),controller[_0x3d98('0x11')]);router[_0x3d98('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x3d98('0x13')]);router[_0x3d98('0x14')](_0x3d98('0xc'),auth[_0x3d98('0xa')](),controller['destroy']);router[_0x3d98('0x14')](_0x3d98('0xe'),auth['isAuthenticated'](),controller[_0x3d98('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 6ca645c..c9e1eeb 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 _0x5226=['utf8','production','DATE','sequelize','exports','STRING','name','BLOB','long','getDataValue','toString'];(function(_0x2401d2,_0x57caea){var _0x17c81f=function(_0x43259f){while(--_0x43259f){_0x2401d2['push'](_0x2401d2['shift']());}};_0x17c81f(++_0x57caea);}(_0x5226,0x137));var _0x6522=function(_0x3a9973,_0x24726b){_0x3a9973=_0x3a9973-0x0;var _0x3d26a8=_0x5226[_0x3a9973];return _0x3d26a8;};'use strict';var Sequelize=require(_0x6522('0x0'));module[_0x6522('0x1')]={'name':{'type':Sequelize[_0x6522('0x2')],'unique':_0x6522('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x6522('0x2')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x6522('0x4')](_0x6522('0x5')),'get':function(){if(this[_0x6522('0x6')]('preproduction')){return this[_0x6522('0x6')]('preproduction')[_0x6522('0x7')](_0x6522('0x8'));}}},'production':{'type':Sequelize[_0x6522('0x4')](_0x6522('0x5')),'get':function(){if(this[_0x6522('0x6')](_0x6522('0x9'))){return this[_0x6522('0x6')]('production')['toString'](_0x6522('0x8'));}}},'savedAt':{'type':Sequelize[_0x6522('0xa')]},'publishedAt':{'type':Sequelize[_0x6522('0xa')]}}; \ No newline at end of file +var _0x68fb=['utf8','production','DATE','exports','name','TEXT','BLOB','long','getDataValue','preproduction','toString'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x68fb,0x1d1));var _0xb68f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x68fb[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xb68f('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xb68f('0x1'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xb68f('0x2')]},'preproduction':{'type':Sequelize[_0xb68f('0x3')](_0xb68f('0x4')),'get':function(){if(this[_0xb68f('0x5')]('preproduction')){return this['getDataValue'](_0xb68f('0x6'))[_0xb68f('0x7')](_0xb68f('0x8'));}}},'production':{'type':Sequelize[_0xb68f('0x3')](_0xb68f('0x4')),'get':function(){if(this[_0xb68f('0x5')](_0xb68f('0x9'))){return this[_0xb68f('0x5')](_0xb68f('0x9'))[_0xb68f('0x7')](_0xb68f('0x8'));}}},'savedAt':{'type':Sequelize[_0xb68f('0xa')]},'publishedAt':{'type':Sequelize[_0xb68f('0xa')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index f0b8443..bcc0ce9 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 _0x67bc=['util','sox','ejs','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','socket.io-emitter','./squareProject.socket','register','sendStatus','status','json','undefined','limit','offset','set','Content-Range','apply','reject','save','update','then','get','SquareProjects','destroy','end','error','stack','send','index','SquareProject','rawAttributes','fieldName','type','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','options','count','includeAll','findAll','catch','show','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','body','addUsers','omit','removeUsers','isArray','ids','emit','userSquareProject:remove','getUsers','findOne','User','eml-format','request-promise','moment','bluebird'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x67bc,0x1d7));var _0xc67b=function(_0x3e451f,_0x10500d){_0x3e451f=_0x3e451f-0x0;var _0x57978f=_0x67bc[_0x3e451f];return _0x57978f;};'use strict';var emlformat=require(_0xc67b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc67b('0x1'));var moment=require(_0xc67b('0x2'));var BPromise=require(_0xc67b('0x3'));var Mustache=require('mustache');var util=require(_0xc67b('0x4'));var path=require('path');var sox=require(_0xc67b('0x5'));var csv=require('to-csv');var ejs=require(_0xc67b('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc67b('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc67b('0x8'));var deskjs=require('desk.js');var toCsv=require(_0xc67b('0x9'));var querystring=require(_0xc67b('0xa'));var Papa=require(_0xc67b('0xb'));var Redis=require(_0xc67b('0xc'));var authService=require(_0xc67b('0xd'));var qs=require(_0xc67b('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc67b('0xf'));var logger=require(_0xc67b('0x10'))('api');var utils=require(_0xc67b('0x11'));var config=require(_0xc67b('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xc67b('0x13')]=_['defaults'](config[_0xc67b('0x13')],{'host':'localhost','port':0x18eb});var socket=require(_0xc67b('0x14'))(new Redis(config[_0xc67b('0x13')]));require(_0xc67b('0x15'))[_0xc67b('0x16')](socket);function respondWithStatusCode(_0x25e256,_0x5685b3){_0x5685b3=_0x5685b3||0xcc;return function(_0x3865e7){if(_0x3865e7){return _0x25e256[_0xc67b('0x17')](_0x5685b3);}return _0x25e256[_0xc67b('0x18')](_0x5685b3)['end']();};}function respondWithResult(_0x237921,_0x57549a){_0x57549a=_0x57549a||0xc8;return function(_0x4d444c){if(_0x4d444c){return _0x237921[_0xc67b('0x18')](_0x57549a)[_0xc67b('0x19')](_0x4d444c);}};}function respondWithFilteredResult(_0x1537e2,_0x21025e){return function(_0x5bc036){if(_0x5bc036){var _0x254712=typeof _0x21025e['offset']===_0xc67b('0x1a')&&typeof _0x21025e[_0xc67b('0x1b')]===_0xc67b('0x1a');var _0x2c8b02=_0x5bc036['count'];var _0x3db8c3=_0x254712?0x0:_0x21025e[_0xc67b('0x1c')];var _0x204653=_0x254712?_0x5bc036['count']:_0x21025e['offset']+_0x21025e[_0xc67b('0x1b')];var _0x41e87b;if(_0x204653>=_0x2c8b02){_0x204653=_0x2c8b02;_0x41e87b=0xc8;}else{_0x41e87b=0xce;}_0x1537e2['status'](_0x41e87b);return _0x1537e2[_0xc67b('0x1d')](_0xc67b('0x1e'),_0x3db8c3+'-'+_0x204653+'/'+_0x2c8b02)[_0xc67b('0x19')](_0x5bc036);}return null;};}function patchUpdates(_0x1fd171){return function(_0x1eb6e6){try{jsonpatch[_0xc67b('0x1f')](_0x1eb6e6,_0x1fd171,!![]);}catch(_0x1e00d1){return BPromise[_0xc67b('0x20')](_0x1e00d1);}return _0x1eb6e6[_0xc67b('0x21')]();};}function saveUpdates(_0x1ea884,_0x55ba3d){return function(_0x170300){if(_0x170300){return _0x170300[_0xc67b('0x22')](_0x1ea884)[_0xc67b('0x23')](function(_0x225629){return _0x225629;});}return null;};}function removeEntity(_0x200da4,_0x402487){return function(_0x38642c){if(_0x38642c){return _0x38642c['destroy']()[_0xc67b('0x23')](function(){var _0x26cf3c=_0x38642c[_0xc67b('0x24')]({'plain':!![]});var _0x4aaaa1=_0xc67b('0x25');return db['UserProfileResource'][_0xc67b('0x26')]({'where':{'type':_0x4aaaa1,'resourceId':_0x26cf3c['id']}})[_0xc67b('0x23')](function(){return _0x38642c;});})[_0xc67b('0x23')](function(){_0x200da4[_0xc67b('0x18')](0xcc)[_0xc67b('0x27')]();});}};}function handleEntityNotFound(_0x2ea5dc,_0x5c57fd){return function(_0x1f4ee1){if(!_0x1f4ee1){_0x2ea5dc[_0xc67b('0x17')](0x194);}return _0x1f4ee1;};}function handleError(_0x414e00,_0x3fe238){_0x3fe238=_0x3fe238||0x1f4;return function(_0x3cfa2d){logger[_0xc67b('0x28')](_0x3cfa2d[_0xc67b('0x29')]);if(_0x3cfa2d['name']){delete _0x3cfa2d['name'];}_0x414e00[_0xc67b('0x18')](_0x3fe238)[_0xc67b('0x2a')](_0x3cfa2d);};}exports[_0xc67b('0x2b')]=function(_0x4b3990,_0x2e5158){var _0x512878={},_0x16aa84={},_0x29db6e={'count':0x0,'rows':[]};var _0x4a358c=_['map'](db[_0xc67b('0x2c')][_0xc67b('0x2d')],function(_0x10ce4e){return{'name':_0x10ce4e[_0xc67b('0x2e')],'type':_0x10ce4e[_0xc67b('0x2f')]['key']};});_0x16aa84['model']=_['map'](_0x4a358c,_0xc67b('0x30'));_0x16aa84[_0xc67b('0x31')]=_[_0xc67b('0x32')](_0x4b3990[_0xc67b('0x31')]);_0x16aa84[_0xc67b('0x33')]=_[_0xc67b('0x34')](_0x16aa84[_0xc67b('0x35')],_0x16aa84[_0xc67b('0x31')]);_0x512878[_0xc67b('0x36')]=_[_0xc67b('0x34')](_0x16aa84[_0xc67b('0x35')],qs[_0xc67b('0x37')](_0x4b3990[_0xc67b('0x31')][_0xc67b('0x37')]));_0x512878[_0xc67b('0x36')]=_0x512878['attributes'][_0xc67b('0x38')]?_0x512878[_0xc67b('0x36')]:_0x16aa84[_0xc67b('0x35')];if(!_0x4b3990[_0xc67b('0x31')][_0xc67b('0x39')](_0xc67b('0x3a'))){_0x512878[_0xc67b('0x1b')]=qs[_0xc67b('0x1b')](_0x4b3990['query']['limit']);_0x512878[_0xc67b('0x1c')]=qs['offset'](_0x4b3990[_0xc67b('0x31')][_0xc67b('0x1c')]);}_0x512878[_0xc67b('0x3b')]=qs[_0xc67b('0x3c')](_0x4b3990['query'][_0xc67b('0x3c')]);_0x512878['where']=qs[_0xc67b('0x33')](_[_0xc67b('0x3d')](_0x4b3990[_0xc67b('0x31')],_0x16aa84[_0xc67b('0x33')]),_0x4a358c);if(_0x4b3990[_0xc67b('0x31')][_0xc67b('0x3e')]){_0x512878[_0xc67b('0x3f')]=_[_0xc67b('0x40')](_0x512878[_0xc67b('0x3f')],{'$or':_[_0xc67b('0x41')](_0x4a358c,function(_0x39880f){if(_0x39880f[_0xc67b('0x2f')]!=='VIRTUAL'){var _0x39be24={};_0x39be24[_0x39880f[_0xc67b('0x30')]]={'$like':'%'+_0x4b3990[_0xc67b('0x31')][_0xc67b('0x3e')]+'%'};return _0x39be24;}})});}_0x512878=_[_0xc67b('0x40')]({},_0x512878,_0x4b3990[_0xc67b('0x42')]);var _0x29a6ae={'where':_0x512878['where']};return db['SquareProject'][_0xc67b('0x43')](_0x29a6ae)[_0xc67b('0x23')](function(_0x441986){_0x29db6e['count']=_0x441986;if(_0x4b3990['query'][_0xc67b('0x44')]){_0x512878['include']=[{'all':!![]}];}return db[_0xc67b('0x2c')][_0xc67b('0x45')](_0x512878);})[_0xc67b('0x23')](function(_0x1baacd){_0x29db6e['rows']=_0x1baacd;return _0x29db6e;})[_0xc67b('0x23')](respondWithFilteredResult(_0x2e5158,_0x512878))[_0xc67b('0x46')](handleError(_0x2e5158,null));};exports[_0xc67b('0x47')]=function(_0xd8010b,_0xb45ee0){var _0xa8a977={'raw':![],'where':{'id':_0xd8010b['params']['id']}},_0x8ca6f2={};_0x8ca6f2[_0xc67b('0x35')]=_[_0xc67b('0x32')](db[_0xc67b('0x2c')][_0xc67b('0x2d')]);_0x8ca6f2['query']=_['keys'](_0xd8010b[_0xc67b('0x31')]);_0x8ca6f2[_0xc67b('0x33')]=_[_0xc67b('0x34')](_0x8ca6f2[_0xc67b('0x35')],_0x8ca6f2[_0xc67b('0x31')]);_0xa8a977[_0xc67b('0x36')]=_[_0xc67b('0x34')](_0x8ca6f2[_0xc67b('0x35')],qs[_0xc67b('0x37')](_0xd8010b[_0xc67b('0x31')][_0xc67b('0x37')]));_0xa8a977[_0xc67b('0x36')]=_0xa8a977[_0xc67b('0x36')]['length']?_0xa8a977[_0xc67b('0x36')]:_0x8ca6f2['model'];if(_0xd8010b['query'][_0xc67b('0x44')]){_0xa8a977[_0xc67b('0x48')]=[{'all':!![]}];}_0xa8a977=_[_0xc67b('0x40')]({},_0xa8a977,_0xd8010b[_0xc67b('0x42')]);return db['SquareProject'][_0xc67b('0x49')](_0xa8a977)[_0xc67b('0x23')](handleEntityNotFound(_0xb45ee0,null))[_0xc67b('0x23')](respondWithResult(_0xb45ee0,null))[_0xc67b('0x46')](handleError(_0xb45ee0,null));};exports[_0xc67b('0x4a')]=function(_0x742ba4,_0x54b496){return db['SquareProject'][_0xc67b('0x4a')](_0x742ba4['body'],{})['then'](function(_0x148bc0){var _0x47eeb0=_0x742ba4[_0xc67b('0x4b')][_0xc67b('0x24')]({'plain':!![]});if(!_0x47eeb0)throw new Error(_0xc67b('0x4c'));if(_0x47eeb0[_0xc67b('0x4d')]===_0xc67b('0x4b')){var _0x4800e1=_0x148bc0[_0xc67b('0x24')]({'plain':!![]});var _0x4605c0=_0xc67b('0x25');return db[_0xc67b('0x4e')][_0xc67b('0x49')]({'where':{'name':_0x4605c0,'userProfileId':_0x47eeb0[_0xc67b('0x4f')]},'raw':!![]})[_0xc67b('0x23')](function(_0x2e3382){if(_0x2e3382&&_0x2e3382[_0xc67b('0x50')]===0x0){return db[_0xc67b('0x51')]['create']({'name':_0x4800e1[_0xc67b('0x30')],'resourceId':_0x4800e1['id'],'type':_0x2e3382[_0xc67b('0x30')],'sectionId':_0x2e3382['id']},{})[_0xc67b('0x23')](function(){return _0x148bc0;});}else{return _0x148bc0;}})['catch'](function(_0x89b6c7){logger[_0xc67b('0x28')](_0xc67b('0x52'),_0x89b6c7);throw _0x89b6c7;});}return _0x148bc0;})[_0xc67b('0x23')](respondWithResult(_0x54b496,0xc9))[_0xc67b('0x46')](handleError(_0x54b496,null));};exports[_0xc67b('0x22')]=function(_0x1913d0,_0x1b9625){if(_0x1913d0['body']['id']){delete _0x1913d0['body']['id'];}return db['SquareProject']['find']({'where':{'id':_0x1913d0[_0xc67b('0x53')]['id']}})[_0xc67b('0x23')](handleEntityNotFound(_0x1b9625,null))[_0xc67b('0x23')](saveUpdates(_0x1913d0[_0xc67b('0x54')],null))[_0xc67b('0x23')](respondWithResult(_0x1b9625,null))[_0xc67b('0x46')](handleError(_0x1b9625,null));};exports[_0xc67b('0x26')]=function(_0x5376bf,_0x2aa135){return db[_0xc67b('0x2c')][_0xc67b('0x49')]({'where':{'id':_0x5376bf['params']['id']}})['then'](handleEntityNotFound(_0x2aa135,null))[_0xc67b('0x23')](removeEntity(_0x2aa135,null))[_0xc67b('0x46')](handleError(_0x2aa135,null));};exports[_0xc67b('0x55')]=function(_0x1d74aa,_0x2a73d8,_0x313744){return db['SquareProject'][_0xc67b('0x49')]({'where':{'id':_0x1d74aa[_0xc67b('0x53')]['id']}})[_0xc67b('0x23')](handleEntityNotFound(_0x2a73d8,null))['then'](function(_0xedd32b){if(_0xedd32b){return _0xedd32b['addUsers'](_0x1d74aa[_0xc67b('0x54')]['ids'],_[_0xc67b('0x56')](_0x1d74aa[_0xc67b('0x54')],['ids','id'])||{});}})['then'](respondWithResult(_0x2a73d8,null))['catch'](handleError(_0x2a73d8,null));};exports[_0xc67b('0x57')]=function(_0x2fd07b,_0x3ba549,_0x371dd0){return db['SquareProject'][_0xc67b('0x49')]({'where':{'id':_0x2fd07b[_0xc67b('0x53')]['id']}})[_0xc67b('0x23')](handleEntityNotFound(_0x3ba549,null))['then'](function(_0x179102){if(_0x179102){return _0x179102[_0xc67b('0x57')](_0x2fd07b['query']['ids'])[_0xc67b('0x23')](function(){if(_[_0xc67b('0x58')](_0x2fd07b['query'][_0xc67b('0x59')])){for(var _0x38e646=0x0;_0x38e646<_0x2fd07b['query'][_0xc67b('0x59')]['length'];_0x38e646+=0x1){socket[_0xc67b('0x5a')]('userSquareProject:remove',{'UserId':Number(_0x2fd07b['query'][_0xc67b('0x59')][_0x38e646]),'SquareProjectId':Number(_0x2fd07b['params']['id'])});}}else{socket['emit'](_0xc67b('0x5b'),{'UserId':Number(_0x2fd07b[_0xc67b('0x31')][_0xc67b('0x59')]),'SquareProjectId':Number(_0x2fd07b[_0xc67b('0x53')]['id'])});}});}})['then'](respondWithStatusCode(_0x3ba549,null))['catch'](handleError(_0x3ba549,null));};exports[_0xc67b('0x5c')]=function(_0x5502e0,_0x342362,_0x3c5064){var _0x5b7765={};var _0x512234={};var _0x47c458;var _0x4e263e;return db['SquareProject'][_0xc67b('0x5d')]({'where':{'id':_0x5502e0['params']['id']}})[_0xc67b('0x23')](handleEntityNotFound(_0x342362,null))['then'](function(_0x2b9412){if(_0x2b9412){_0x47c458=_0x2b9412;_0x512234[_0xc67b('0x35')]=_[_0xc67b('0x32')](db[_0xc67b('0x5e')][_0xc67b('0x2d')]);_0x512234[_0xc67b('0x31')]=_['keys'](_0x5502e0[_0xc67b('0x31')]);_0x512234['filters']=_['intersection'](_0x512234[_0xc67b('0x35')],_0x512234[_0xc67b('0x31')]);_0x5b7765['attributes']=_[_0xc67b('0x34')](_0x512234['model'],qs[_0xc67b('0x37')](_0x5502e0[_0xc67b('0x31')][_0xc67b('0x37')]));_0x5b7765[_0xc67b('0x36')]=_0x5b7765[_0xc67b('0x36')][_0xc67b('0x38')]?_0x5b7765[_0xc67b('0x36')]:_0x512234['model'];_0x5b7765['order']=qs[_0xc67b('0x3c')](_0x5502e0[_0xc67b('0x31')]['sort']);_0x5b7765[_0xc67b('0x3f')]=qs[_0xc67b('0x33')](_[_0xc67b('0x3d')](_0x5502e0[_0xc67b('0x31')],_0x512234['filters']));if(_0x5502e0[_0xc67b('0x31')][_0xc67b('0x3e')]){_0x5b7765['where']=_['merge'](_0x5b7765[_0xc67b('0x3f')],{'$or':_['map'](_0x5b7765[_0xc67b('0x36')],function(_0x451e4a){var _0xf61721={};_0xf61721[_0x451e4a]={'$like':'%'+_0x5502e0[_0xc67b('0x31')][_0xc67b('0x3e')]+'%'};return _0xf61721;})});}_0x5b7765=_['merge']({},_0x5b7765,_0x5502e0['options']);return _0x47c458[_0xc67b('0x5c')](_0x5b7765);}})[_0xc67b('0x23')](function(_0x49773a){if(_0x49773a){_0x4e263e=_0x49773a[_0xc67b('0x38')];if(!_0x5502e0['query'][_0xc67b('0x39')](_0xc67b('0x3a'))){_0x5b7765['limit']=qs[_0xc67b('0x1b')](_0x5502e0[_0xc67b('0x31')]['limit']);_0x5b7765[_0xc67b('0x1c')]=qs[_0xc67b('0x1c')](_0x5502e0[_0xc67b('0x31')][_0xc67b('0x1c')]);}return _0x47c458['getUsers'](_0x5b7765);}})[_0xc67b('0x23')](function(_0x3b79ea){if(_0x3b79ea){return _0x3b79ea?{'count':_0x4e263e,'rows':_0x3b79ea}:null;}})[_0xc67b('0x23')](respondWithResult(_0x342362,null))[_0xc67b('0x46')](handleError(_0x342362,null));}; \ No newline at end of file +var _0xf365=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','SquareProjects','error','send','index','map','SquareProject','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','name','options','includeAll','include','findAll','rows','show','params','length','find','create','body','role','user','UserProfileSection','userProfileId','UserProfileResource','catch','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','User','order','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js'];(function(_0x409493,_0x640cb8){var _0x7286d8=function(_0x446f84){while(--_0x446f84){_0x409493['push'](_0x409493['shift']());}};_0x7286d8(++_0x640cb8);}(_0xf365,0xb5));var _0x5f36=function(_0x142691,_0x281ee4){_0x142691=_0x142691-0x0;var _0x7ff861=_0xf365[_0x142691];return _0x7ff861;};'use strict';var emlformat=require(_0x5f36('0x0'));var rimraf=require(_0x5f36('0x1'));var zipdir=require(_0x5f36('0x2'));var jsonpatch=require(_0x5f36('0x3'));var rp=require(_0x5f36('0x4'));var moment=require(_0x5f36('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5f36('0x6'));var path=require(_0x5f36('0x7'));var sox=require(_0x5f36('0x8'));var csv=require(_0x5f36('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5f36('0xa'));var _=require(_0x5f36('0xb'));var squel=require('squel');var crypto=require(_0x5f36('0xc'));var jsforce=require(_0x5f36('0xd'));var deskjs=require(_0x5f36('0xe'));var toCsv=require(_0x5f36('0x9'));var querystring=require(_0x5f36('0xf'));var Papa=require(_0x5f36('0x10'));var Redis=require('ioredis');var authService=require(_0x5f36('0x11'));var qs=require(_0x5f36('0x12'));var as=require(_0x5f36('0x13'));var hardwareService=require(_0x5f36('0x14'));var logger=require(_0x5f36('0x15'))(_0x5f36('0x16'));var utils=require(_0x5f36('0x17'));var config=require(_0x5f36('0x18'));var licenseUtil=require(_0x5f36('0x19'));var db=require(_0x5f36('0x1a'))['db'];config[_0x5f36('0x1b')]=_[_0x5f36('0x1c')](config[_0x5f36('0x1b')],{'host':_0x5f36('0x1d'),'port':0x18eb});var socket=require(_0x5f36('0x1e'))(new Redis(config[_0x5f36('0x1b')]));require(_0x5f36('0x1f'))['register'](socket);function respondWithStatusCode(_0x2571e1,_0x2ff278){_0x2ff278=_0x2ff278||0xcc;return function(_0xbcda0b){if(_0xbcda0b){return _0x2571e1[_0x5f36('0x20')](_0x2ff278);}return _0x2571e1['status'](_0x2ff278)['end']();};}function respondWithResult(_0x1435f9,_0x1657dd){_0x1657dd=_0x1657dd||0xc8;return function(_0x274897){if(_0x274897){return _0x1435f9[_0x5f36('0x21')](_0x1657dd)[_0x5f36('0x22')](_0x274897);}};}function respondWithFilteredResult(_0x5a4261,_0x4225ae){return function(_0xf6344a){if(_0xf6344a){var _0x2046e0=typeof _0x4225ae[_0x5f36('0x23')]===_0x5f36('0x24')&&typeof _0x4225ae[_0x5f36('0x25')]===_0x5f36('0x24');var _0x28c751=_0xf6344a[_0x5f36('0x26')];var _0x141555=_0x2046e0?0x0:_0x4225ae[_0x5f36('0x23')];var _0x1effe7=_0x2046e0?_0xf6344a[_0x5f36('0x26')]:_0x4225ae[_0x5f36('0x23')]+_0x4225ae['limit'];var _0x5e833e;if(_0x1effe7>=_0x28c751){_0x1effe7=_0x28c751;_0x5e833e=0xc8;}else{_0x5e833e=0xce;}_0x5a4261[_0x5f36('0x21')](_0x5e833e);return _0x5a4261['set'](_0x5f36('0x27'),_0x141555+'-'+_0x1effe7+'/'+_0x28c751)[_0x5f36('0x22')](_0xf6344a);}return null;};}function patchUpdates(_0x2721d5){return function(_0x284ad5){try{jsonpatch[_0x5f36('0x28')](_0x284ad5,_0x2721d5,!![]);}catch(_0x9315e0){return BPromise[_0x5f36('0x29')](_0x9315e0);}return _0x284ad5[_0x5f36('0x2a')]();};}function saveUpdates(_0x215899,_0x4acc6e){return function(_0x4f3bff){if(_0x4f3bff){return _0x4f3bff[_0x5f36('0x2b')](_0x215899)[_0x5f36('0x2c')](function(_0x2028db){return _0x2028db;});}return null;};}function removeEntity(_0x3ac2ce,_0x4e4644){return function(_0x33caa1){if(_0x33caa1){return _0x33caa1[_0x5f36('0x2d')]()['then'](function(){var _0x4a8645=_0x33caa1[_0x5f36('0x2e')]({'plain':!![]});var _0x4432e2=_0x5f36('0x2f');return db['UserProfileResource'][_0x5f36('0x2d')]({'where':{'type':_0x4432e2,'resourceId':_0x4a8645['id']}})['then'](function(){return _0x33caa1;});})[_0x5f36('0x2c')](function(){_0x3ac2ce[_0x5f36('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48208a,_0x4e66dd){return function(_0x1480b3){if(!_0x1480b3){_0x48208a[_0x5f36('0x20')](0x194);}return _0x1480b3;};}function handleError(_0x3c58ef,_0x9dc1f1){_0x9dc1f1=_0x9dc1f1||0x1f4;return function(_0x507eea){logger[_0x5f36('0x30')](_0x507eea['stack']);if(_0x507eea['name']){delete _0x507eea['name'];}_0x3c58ef[_0x5f36('0x21')](_0x9dc1f1)[_0x5f36('0x31')](_0x507eea);};}exports[_0x5f36('0x32')]=function(_0x46b7b9,_0x88f1d3){var _0x4f4445={},_0x11627b={},_0x4f00cb={'count':0x0,'rows':[]};var _0x512931=_[_0x5f36('0x33')](db[_0x5f36('0x34')][_0x5f36('0x35')],function(_0x110f47){return{'name':_0x110f47[_0x5f36('0x36')],'type':_0x110f47[_0x5f36('0x37')][_0x5f36('0x38')]};});_0x11627b[_0x5f36('0x39')]=_['map'](_0x512931,'name');_0x11627b[_0x5f36('0x3a')]=_[_0x5f36('0x3b')](_0x46b7b9['query']);_0x11627b[_0x5f36('0x3c')]=_['intersection'](_0x11627b[_0x5f36('0x39')],_0x11627b[_0x5f36('0x3a')]);_0x4f4445['attributes']=_[_0x5f36('0x3d')](_0x11627b[_0x5f36('0x39')],qs[_0x5f36('0x3e')](_0x46b7b9[_0x5f36('0x3a')][_0x5f36('0x3e')]));_0x4f4445['attributes']=_0x4f4445['attributes']['length']?_0x4f4445[_0x5f36('0x3f')]:_0x11627b[_0x5f36('0x39')];if(!_0x46b7b9[_0x5f36('0x3a')][_0x5f36('0x40')](_0x5f36('0x41'))){_0x4f4445['limit']=qs['limit'](_0x46b7b9['query'][_0x5f36('0x25')]);_0x4f4445[_0x5f36('0x23')]=qs[_0x5f36('0x23')](_0x46b7b9[_0x5f36('0x3a')][_0x5f36('0x23')]);}_0x4f4445['order']=qs[_0x5f36('0x42')](_0x46b7b9['query'][_0x5f36('0x42')]);_0x4f4445[_0x5f36('0x43')]=qs[_0x5f36('0x3c')](_[_0x5f36('0x44')](_0x46b7b9['query'],_0x11627b[_0x5f36('0x3c')]),_0x512931);if(_0x46b7b9[_0x5f36('0x3a')][_0x5f36('0x45')]){_0x4f4445[_0x5f36('0x43')]=_[_0x5f36('0x46')](_0x4f4445[_0x5f36('0x43')],{'$or':_[_0x5f36('0x33')](_0x512931,function(_0x4283d1){if(_0x4283d1['type']!==_0x5f36('0x47')){var _0x2b74a7={};_0x2b74a7[_0x4283d1[_0x5f36('0x48')]]={'$like':'%'+_0x46b7b9[_0x5f36('0x3a')][_0x5f36('0x45')]+'%'};return _0x2b74a7;}})});}_0x4f4445=_[_0x5f36('0x46')]({},_0x4f4445,_0x46b7b9[_0x5f36('0x49')]);var _0xe27b48={'where':_0x4f4445['where']};return db['SquareProject']['count'](_0xe27b48)[_0x5f36('0x2c')](function(_0x109318){_0x4f00cb[_0x5f36('0x26')]=_0x109318;if(_0x46b7b9[_0x5f36('0x3a')][_0x5f36('0x4a')]){_0x4f4445[_0x5f36('0x4b')]=[{'all':!![]}];}return db['SquareProject'][_0x5f36('0x4c')](_0x4f4445);})[_0x5f36('0x2c')](function(_0x381b05){_0x4f00cb[_0x5f36('0x4d')]=_0x381b05;return _0x4f00cb;})[_0x5f36('0x2c')](respondWithFilteredResult(_0x88f1d3,_0x4f4445))['catch'](handleError(_0x88f1d3,null));};exports[_0x5f36('0x4e')]=function(_0xd9e47b,_0xb86333){var _0xe3a044={'raw':![],'where':{'id':_0xd9e47b[_0x5f36('0x4f')]['id']}},_0x1b5024={};_0x1b5024[_0x5f36('0x39')]=_['keys'](db[_0x5f36('0x34')][_0x5f36('0x35')]);_0x1b5024[_0x5f36('0x3a')]=_[_0x5f36('0x3b')](_0xd9e47b[_0x5f36('0x3a')]);_0x1b5024[_0x5f36('0x3c')]=_[_0x5f36('0x3d')](_0x1b5024[_0x5f36('0x39')],_0x1b5024[_0x5f36('0x3a')]);_0xe3a044[_0x5f36('0x3f')]=_['intersection'](_0x1b5024[_0x5f36('0x39')],qs[_0x5f36('0x3e')](_0xd9e47b[_0x5f36('0x3a')][_0x5f36('0x3e')]));_0xe3a044[_0x5f36('0x3f')]=_0xe3a044['attributes'][_0x5f36('0x50')]?_0xe3a044[_0x5f36('0x3f')]:_0x1b5024['model'];if(_0xd9e47b[_0x5f36('0x3a')]['includeAll']){_0xe3a044[_0x5f36('0x4b')]=[{'all':!![]}];}_0xe3a044=_[_0x5f36('0x46')]({},_0xe3a044,_0xd9e47b[_0x5f36('0x49')]);return db[_0x5f36('0x34')][_0x5f36('0x51')](_0xe3a044)['then'](handleEntityNotFound(_0xb86333,null))[_0x5f36('0x2c')](respondWithResult(_0xb86333,null))['catch'](handleError(_0xb86333,null));};exports['create']=function(_0x4c08ed,_0x410d43){return db[_0x5f36('0x34')][_0x5f36('0x52')](_0x4c08ed[_0x5f36('0x53')],{})[_0x5f36('0x2c')](function(_0x216973){var _0x546dfe=_0x4c08ed['user'][_0x5f36('0x2e')]({'plain':!![]});if(!_0x546dfe)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x546dfe[_0x5f36('0x54')]===_0x5f36('0x55')){var _0x435056=_0x216973[_0x5f36('0x2e')]({'plain':!![]});var _0x5a4fba=_0x5f36('0x2f');return db[_0x5f36('0x56')][_0x5f36('0x51')]({'where':{'name':_0x5a4fba,'userProfileId':_0x546dfe[_0x5f36('0x57')]},'raw':!![]})[_0x5f36('0x2c')](function(_0x22f115){if(_0x22f115&&_0x22f115['autoAssociation']===0x0){return db[_0x5f36('0x58')][_0x5f36('0x52')]({'name':_0x435056[_0x5f36('0x48')],'resourceId':_0x435056['id'],'type':_0x22f115[_0x5f36('0x48')],'sectionId':_0x22f115['id']},{})[_0x5f36('0x2c')](function(){return _0x216973;});}else{return _0x216973;}})[_0x5f36('0x59')](function(_0x397b25){logger[_0x5f36('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x397b25);throw _0x397b25;});}return _0x216973;})[_0x5f36('0x2c')](respondWithResult(_0x410d43,0xc9))[_0x5f36('0x59')](handleError(_0x410d43,null));};exports['update']=function(_0x2cc67f,_0x40eb94){if(_0x2cc67f[_0x5f36('0x53')]['id']){delete _0x2cc67f[_0x5f36('0x53')]['id'];}return db[_0x5f36('0x34')][_0x5f36('0x51')]({'where':{'id':_0x2cc67f[_0x5f36('0x4f')]['id']}})['then'](handleEntityNotFound(_0x40eb94,null))[_0x5f36('0x2c')](saveUpdates(_0x2cc67f['body'],null))[_0x5f36('0x2c')](respondWithResult(_0x40eb94,null))[_0x5f36('0x59')](handleError(_0x40eb94,null));};exports['destroy']=function(_0x4b06fa,_0x9aed68){return db[_0x5f36('0x34')][_0x5f36('0x51')]({'where':{'id':_0x4b06fa[_0x5f36('0x4f')]['id']}})[_0x5f36('0x2c')](handleEntityNotFound(_0x9aed68,null))[_0x5f36('0x2c')](removeEntity(_0x9aed68,null))[_0x5f36('0x59')](handleError(_0x9aed68,null));};exports['addUsers']=function(_0xb140b4,_0x74c320,_0x490905){return db[_0x5f36('0x34')][_0x5f36('0x51')]({'where':{'id':_0xb140b4[_0x5f36('0x4f')]['id']}})['then'](handleEntityNotFound(_0x74c320,null))[_0x5f36('0x2c')](function(_0x173d9){if(_0x173d9){return _0x173d9['addUsers'](_0xb140b4[_0x5f36('0x53')][_0x5f36('0x5a')],_['omit'](_0xb140b4[_0x5f36('0x53')],[_0x5f36('0x5a'),'id'])||{});}})[_0x5f36('0x2c')](respondWithResult(_0x74c320,null))[_0x5f36('0x59')](handleError(_0x74c320,null));};exports['removeUsers']=function(_0x3d583b,_0x3c4b5f,_0xfdeb8e){return db[_0x5f36('0x34')][_0x5f36('0x51')]({'where':{'id':_0x3d583b[_0x5f36('0x4f')]['id']}})[_0x5f36('0x2c')](handleEntityNotFound(_0x3c4b5f,null))[_0x5f36('0x2c')](function(_0x35b0e1){if(_0x35b0e1){return _0x35b0e1[_0x5f36('0x5b')](_0x3d583b[_0x5f36('0x3a')]['ids'])[_0x5f36('0x2c')](function(){if(_[_0x5f36('0x5c')](_0x3d583b[_0x5f36('0x3a')][_0x5f36('0x5a')])){for(var _0x457ccd=0x0;_0x457ccd<_0x3d583b[_0x5f36('0x3a')]['ids'][_0x5f36('0x50')];_0x457ccd+=0x1){socket[_0x5f36('0x5d')](_0x5f36('0x5e'),{'UserId':Number(_0x3d583b['query'][_0x5f36('0x5a')][_0x457ccd]),'SquareProjectId':Number(_0x3d583b[_0x5f36('0x4f')]['id'])});}}else{socket[_0x5f36('0x5d')]('userSquareProject:remove',{'UserId':Number(_0x3d583b['query'][_0x5f36('0x5a')]),'SquareProjectId':Number(_0x3d583b[_0x5f36('0x4f')]['id'])});}});}})['then'](respondWithStatusCode(_0x3c4b5f,null))[_0x5f36('0x59')](handleError(_0x3c4b5f,null));};exports[_0x5f36('0x5f')]=function(_0x55a1fd,_0x1e769d,_0x3e3d34){var _0x355a13={};var _0x4d231e={};var _0x852dd6;var _0x1444bb;return db[_0x5f36('0x34')]['findOne']({'where':{'id':_0x55a1fd[_0x5f36('0x4f')]['id']}})[_0x5f36('0x2c')](handleEntityNotFound(_0x1e769d,null))[_0x5f36('0x2c')](function(_0x12a516){if(_0x12a516){_0x852dd6=_0x12a516;_0x4d231e[_0x5f36('0x39')]=_[_0x5f36('0x3b')](db[_0x5f36('0x60')][_0x5f36('0x35')]);_0x4d231e[_0x5f36('0x3a')]=_[_0x5f36('0x3b')](_0x55a1fd[_0x5f36('0x3a')]);_0x4d231e['filters']=_['intersection'](_0x4d231e['model'],_0x4d231e[_0x5f36('0x3a')]);_0x355a13[_0x5f36('0x3f')]=_['intersection'](_0x4d231e['model'],qs['fields'](_0x55a1fd['query']['fields']));_0x355a13[_0x5f36('0x3f')]=_0x355a13[_0x5f36('0x3f')]['length']?_0x355a13[_0x5f36('0x3f')]:_0x4d231e[_0x5f36('0x39')];_0x355a13[_0x5f36('0x61')]=qs[_0x5f36('0x42')](_0x55a1fd[_0x5f36('0x3a')][_0x5f36('0x42')]);_0x355a13[_0x5f36('0x43')]=qs[_0x5f36('0x3c')](_[_0x5f36('0x44')](_0x55a1fd[_0x5f36('0x3a')],_0x4d231e[_0x5f36('0x3c')]));if(_0x55a1fd[_0x5f36('0x3a')][_0x5f36('0x45')]){_0x355a13[_0x5f36('0x43')]=_[_0x5f36('0x46')](_0x355a13['where'],{'$or':_['map'](_0x355a13[_0x5f36('0x3f')],function(_0x13232c){var _0xf4348b={};_0xf4348b[_0x13232c]={'$like':'%'+_0x55a1fd[_0x5f36('0x3a')][_0x5f36('0x45')]+'%'};return _0xf4348b;})});}_0x355a13=_[_0x5f36('0x46')]({},_0x355a13,_0x55a1fd['options']);return _0x852dd6[_0x5f36('0x5f')](_0x355a13);}})[_0x5f36('0x2c')](function(_0x61aae4){if(_0x61aae4){_0x1444bb=_0x61aae4[_0x5f36('0x50')];if(!_0x55a1fd[_0x5f36('0x3a')][_0x5f36('0x40')](_0x5f36('0x41'))){_0x355a13[_0x5f36('0x25')]=qs[_0x5f36('0x25')](_0x55a1fd['query'][_0x5f36('0x25')]);_0x355a13['offset']=qs[_0x5f36('0x23')](_0x55a1fd[_0x5f36('0x3a')][_0x5f36('0x23')]);}return _0x852dd6[_0x5f36('0x5f')](_0x355a13);}})[_0x5f36('0x2c')](function(_0x220e7f){if(_0x220e7f){return _0x220e7f?{'count':_0x1444bb,'rows':_0x220e7f}:null;}})[_0x5f36('0x2c')](respondWithResult(_0x1e769d,null))[_0x5f36('0x59')](handleError(_0x1e769d,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 41c2e16..3b91d2b 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 _0x37f0=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SquareProject','remove'];(function(_0x264545,_0x214037){var _0x114d10=function(_0x9e3461){while(--_0x9e3461){_0x264545['push'](_0x264545['shift']());}};_0x114d10(++_0x214037);}(_0x37f0,0x1cc));var _0x037f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x37f0[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require(_0x037f('0x0'));var SquareProject=require(_0x037f('0x1'))['db'][_0x037f('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x037f('0x3')};function emitEvent(_0x22f365){return function(_0x200c8f,_0x49b908,_0x7768b8){SquareProjectEvents[_0x037f('0x4')](_0x22f365+':'+_0x200c8f['id'],_0x200c8f);SquareProjectEvents['emit'](_0x22f365,_0x200c8f);_0x7768b8(null);};}for(var e in events){if(events[_0x037f('0x5')](e)){var event=events[e];SquareProject[_0x037f('0x6')](e,emitEvent(event));}}module[_0x037f('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0xdfc5=['exports','events','../../mysqldb','SquareProject','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x279e6f,_0x566574){var _0x489a5f=function(_0x57e285){while(--_0x57e285){_0x279e6f['push'](_0x279e6f['shift']());}};_0x489a5f(++_0x566574);}(_0xdfc5,0x90));var _0x5dfc=function(_0x51d6ed,_0x23aaaf){_0x51d6ed=_0x51d6ed-0x0;var _0x2d09bc=_0xdfc5[_0x51d6ed];return _0x2d09bc;};'use strict';var EventEmitter=require(_0x5dfc('0x0'));var SquareProject=require(_0x5dfc('0x1'))['db'][_0x5dfc('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x5dfc('0x3')](0x0);var events={'afterCreate':_0x5dfc('0x4'),'afterUpdate':_0x5dfc('0x5'),'afterDestroy':_0x5dfc('0x6')};function emitEvent(_0x299f98){return function(_0x2cc2b3,_0x3acce5,_0x3e0875){SquareProjectEvents[_0x5dfc('0x7')](_0x299f98+':'+_0x2cc2b3['id'],_0x2cc2b3);SquareProjectEvents[_0x5dfc('0x7')](_0x299f98,_0x2cc2b3);_0x3e0875(null);};}for(var e in events){if(events[_0x5dfc('0x8')](e)){var event=events[e];SquareProject[_0x5dfc('0x9')](e,emitEvent(event));}}module[_0x5dfc('0xa')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 561d8aa..8b7aa4a 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 _0x6502=['production','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','SquareProject','square_projects','changed','preproduction','format'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x6502,0x92));var _0x2650=function(_0xb98d8d,_0x481423){_0xb98d8d=_0xb98d8d-0x0;var _0x489b15=_0x6502[_0xb98d8d];return _0x489b15;};'use strict';var _=require(_0x2650('0x0'));var util=require(_0x2650('0x1'));var logger=require(_0x2650('0x2'))(_0x2650('0x3'));var moment=require(_0x2650('0x4'));var BPromise=require(_0x2650('0x5'));var rp=require(_0x2650('0x6'));var fs=require('fs');var path=require(_0x2650('0x7'));var rimraf=require('rimraf');var config=require(_0x2650('0x8'));var attributes=require('./squareProject.attributes');module['exports']=function(_0x55a35b,_0x56eaa4){return _0x55a35b['define'](_0x2650('0x9'),attributes,{'tableName':_0x2650('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x28cc29,_0x3cbcb1,_0x3192dc){if(_0x28cc29[_0x2650('0xb')](_0x2650('0xc'))){_0x28cc29['savedAt']=moment()[_0x2650('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x28cc29['changed'](_0x2650('0xe'))){_0x28cc29['publishedAt']=moment()[_0x2650('0xd')](_0x2650('0xf'));}_0x3192dc(null,_0x28cc29);}}});}; \ No newline at end of file +var _0x78e4=['savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','square_projects','changed','preproduction'];(function(_0x265aa2,_0x220072){var _0x447a3a=function(_0x1512cc){while(--_0x1512cc){_0x265aa2['push'](_0x265aa2['shift']());}};_0x447a3a(++_0x220072);}(_0x78e4,0x194));var _0x478e=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0x78e4[_0x485b5a];return _0xd2b34d;};'use strict';var _=require(_0x478e('0x0'));var util=require(_0x478e('0x1'));var logger=require(_0x478e('0x2'))(_0x478e('0x3'));var moment=require(_0x478e('0x4'));var BPromise=require(_0x478e('0x5'));var rp=require(_0x478e('0x6'));var fs=require('fs');var path=require(_0x478e('0x7'));var rimraf=require('rimraf');var config=require(_0x478e('0x8'));var attributes=require('./squareProject.attributes');module[_0x478e('0x9')]=function(_0x39ec66,_0xaccd42){return _0x39ec66[_0x478e('0xa')]('SquareProject',attributes,{'tableName':_0x478e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x39a041,_0x2fe326,_0x1f4550){if(_0x39a041[_0x478e('0xc')](_0x478e('0xd'))){_0x39a041[_0x478e('0xe')]=moment()[_0x478e('0xf')](_0x478e('0x10'));}if(_0x39a041[_0x478e('0xc')](_0x478e('0x11'))){_0x39a041[_0x478e('0x12')]=moment()[_0x478e('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1f4550(null,_0x39a041);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 6e79fa1..336193c 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 _0xc4eb=['../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','request','info','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','code','error','message','SquareProject,\x20%s,\x20%s','result','catch','SquareProject','options','raw','where','attributes','include','map','model','then','ShowSquareProject','lodash','util','moment','bluebird','ioredis'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc4eb,0xb9));var _0xbc4e=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xc4eb[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xbc4e('0x0'));var util=require(_0xbc4e('0x1'));var moment=require(_0xbc4e('0x2'));var BPromise=require(_0xbc4e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbc4e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbc4e('0x5'));var logger=require(_0xbc4e('0x6'))(_0xbc4e('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbc4e('0x8')][_0xbc4e('0x9')]({'port':0x232a});config[_0xbc4e('0xa')]=_[_0xbc4e('0xb')](config['redis'],{'host':_0xbc4e('0xc'),'port':0x18eb});var socket=require(_0xbc4e('0xd'))(new Redis(config[_0xbc4e('0xa')]));require(_0xbc4e('0xe'))[_0xbc4e('0xf')](socket);function respondWithRpcPromise(_0x1642ff,_0x171004,_0x30a989){return new BPromise(function(_0x25c8e4,_0x1ff30e){return client[_0xbc4e('0x10')](_0x1642ff,_0x30a989)['then'](function(_0x28361b){logger[_0xbc4e('0x11')]('SquareProject,\x20%s,\x20%s',_0x171004,_0xbc4e('0x12'));logger[_0xbc4e('0x13')](_0xbc4e('0x14'),_0x171004,_0xbc4e('0x12'),JSON[_0xbc4e('0x15')](_0x28361b));if(_0x28361b['error']){if(_0x28361b['error'][_0xbc4e('0x16')]===0x1f4){logger[_0xbc4e('0x17')]('SquareProject,\x20%s,\x20%s',_0x171004,_0x28361b[_0xbc4e('0x17')][_0xbc4e('0x18')]);return _0x1ff30e(_0x28361b[_0xbc4e('0x17')][_0xbc4e('0x18')]);}logger[_0xbc4e('0x17')](_0xbc4e('0x19'),_0x171004,_0x28361b[_0xbc4e('0x17')][_0xbc4e('0x18')]);return _0x25c8e4(_0x28361b['error'][_0xbc4e('0x18')]);}else{logger['info'](_0xbc4e('0x19'),_0x171004,_0xbc4e('0x12'));_0x25c8e4(_0x28361b[_0xbc4e('0x1a')][_0xbc4e('0x18')]);}})[_0xbc4e('0x1b')](function(_0x335a9f){logger[_0xbc4e('0x17')](_0xbc4e('0x19'),_0x171004,_0x335a9f);_0x1ff30e(_0x335a9f);});});}exports['ShowSquareProject']=function(_0x31b745){var _0x318644=this;return new Promise(function(_0x13e9e1,_0x1cde40){return db[_0xbc4e('0x1c')]['find']({'raw':_0x31b745[_0xbc4e('0x1d')]?_0x31b745[_0xbc4e('0x1d')][_0xbc4e('0x1e')]===undefined?!![]:![]:!![],'where':_0x31b745[_0xbc4e('0x1d')]?_0x31b745[_0xbc4e('0x1d')][_0xbc4e('0x1f')]||null:null,'attributes':_0x31b745[_0xbc4e('0x1d')]?_0x31b745[_0xbc4e('0x1d')][_0xbc4e('0x20')]||null:null,'include':_0x31b745['options']?_0x31b745[_0xbc4e('0x1d')][_0xbc4e('0x21')]?_[_0xbc4e('0x22')](_0x31b745[_0xbc4e('0x1d')][_0xbc4e('0x21')],function(_0x5914c1){return{'model':db[_0x5914c1[_0xbc4e('0x23')]],'as':_0x5914c1['as'],'attributes':_0x5914c1[_0xbc4e('0x20')],'include':_0x5914c1[_0xbc4e('0x21')]?_[_0xbc4e('0x22')](_0x5914c1[_0xbc4e('0x21')],function(_0x295749){return{'model':db[_0x295749[_0xbc4e('0x23')]],'as':_0x295749['as'],'attributes':_0x295749['attributes'],'include':_0x295749[_0xbc4e('0x21')]?_[_0xbc4e('0x22')](_0x295749[_0xbc4e('0x21')],function(_0x1b28ec){return{'model':db[_0x1b28ec[_0xbc4e('0x23')]],'as':_0x1b28ec['as'],'attributes':_0x1b28ec[_0xbc4e('0x20')]};}):[]};}):[]};}):[]:[]})[_0xbc4e('0x24')](function(_0x8433e2){logger['info'](_0xbc4e('0x25'),_0x31b745);logger['debug'](_0xbc4e('0x25'),_0x31b745,JSON[_0xbc4e('0x15')](_0x8433e2));_0x13e9e1(_0x8433e2);})[_0xbc4e('0x1b')](function(_0x26214c){logger['error'](_0xbc4e('0x25'),_0x26214c['message'],_0x31b745);_0x1cde40(_0x318644[_0xbc4e('0x17')](0x1f4,_0x26214c[_0xbc4e('0x18')]));});});}; \ No newline at end of file +var _0x04cc=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','./squareProject.socket','request','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSquareProject','SquareProject','find','options','where','attributes','include','model','map','lodash','util'];(function(_0x36e88b,_0x9434c3){var _0x24aee2=function(_0x2a9f00){while(--_0x2a9f00){_0x36e88b['push'](_0x36e88b['shift']());}};_0x24aee2(++_0x9434c3);}(_0x04cc,0x14b));var _0xc04c=function(_0x4a7756,_0x97b450){_0x4a7756=_0x4a7756-0x0;var _0x26b489=_0x04cc[_0x4a7756];return _0x26b489;};'use strict';var _=require(_0xc04c('0x0'));var util=require(_0xc04c('0x1'));var moment=require('moment');var BPromise=require(_0xc04c('0x2'));var rs=require(_0xc04c('0x3'));var fs=require('fs');var Redis=require(_0xc04c('0x4'));var db=require(_0xc04c('0x5'))['db'];var utils=require(_0xc04c('0x6'));var logger=require(_0xc04c('0x7'))(_0xc04c('0x8'));var config=require(_0xc04c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc04c('0xa')][_0xc04c('0xb')]({'port':0x232a});config[_0xc04c('0xc')]=_[_0xc04c('0xd')](config[_0xc04c('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc04c('0xc')]));require(_0xc04c('0xe'))['register'](socket);function respondWithRpcPromise(_0x2b140e,_0x3dca2c,_0x2e75ba){return new BPromise(function(_0x3faa46,_0x694c5b){return client[_0xc04c('0xf')](_0x2b140e,_0x2e75ba)[_0xc04c('0x10')](function(_0x2e49d2){logger[_0xc04c('0x11')](_0xc04c('0x12'),_0x3dca2c,_0xc04c('0x13'));logger[_0xc04c('0x14')](_0xc04c('0x15'),_0x3dca2c,_0xc04c('0x13'),JSON[_0xc04c('0x16')](_0x2e49d2));if(_0x2e49d2[_0xc04c('0x17')]){if(_0x2e49d2[_0xc04c('0x17')][_0xc04c('0x18')]===0x1f4){logger[_0xc04c('0x17')](_0xc04c('0x12'),_0x3dca2c,_0x2e49d2['error'][_0xc04c('0x19')]);return _0x694c5b(_0x2e49d2[_0xc04c('0x17')][_0xc04c('0x19')]);}logger[_0xc04c('0x17')](_0xc04c('0x12'),_0x3dca2c,_0x2e49d2['error'][_0xc04c('0x19')]);return _0x3faa46(_0x2e49d2[_0xc04c('0x17')][_0xc04c('0x19')]);}else{logger['info'](_0xc04c('0x12'),_0x3dca2c,_0xc04c('0x13'));_0x3faa46(_0x2e49d2[_0xc04c('0x1a')][_0xc04c('0x19')]);}})[_0xc04c('0x1b')](function(_0x5c8efd){logger['error'](_0xc04c('0x12'),_0x3dca2c,_0x5c8efd);_0x694c5b(_0x5c8efd);});});}exports[_0xc04c('0x1c')]=function(_0x4c9b09){var _0x43feb9=this;return new Promise(function(_0x183818,_0x4b3bb5){return db[_0xc04c('0x1d')][_0xc04c('0x1e')]({'raw':_0x4c9b09['options']?_0x4c9b09[_0xc04c('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x4c9b09['options']?_0x4c9b09['options'][_0xc04c('0x20')]||null:null,'attributes':_0x4c9b09[_0xc04c('0x1f')]?_0x4c9b09[_0xc04c('0x1f')][_0xc04c('0x21')]||null:null,'include':_0x4c9b09[_0xc04c('0x1f')]?_0x4c9b09[_0xc04c('0x1f')][_0xc04c('0x22')]?_['map'](_0x4c9b09[_0xc04c('0x1f')][_0xc04c('0x22')],function(_0x4f0a64){return{'model':db[_0x4f0a64[_0xc04c('0x23')]],'as':_0x4f0a64['as'],'attributes':_0x4f0a64[_0xc04c('0x21')],'include':_0x4f0a64['include']?_[_0xc04c('0x24')](_0x4f0a64['include'],function(_0x59307d){return{'model':db[_0x59307d[_0xc04c('0x23')]],'as':_0x59307d['as'],'attributes':_0x59307d[_0xc04c('0x21')],'include':_0x59307d[_0xc04c('0x22')]?_[_0xc04c('0x24')](_0x59307d[_0xc04c('0x22')],function(_0x18ee26){return{'model':db[_0x18ee26[_0xc04c('0x23')]],'as':_0x18ee26['as'],'attributes':_0x18ee26['attributes']};}):[]};}):[]};}):[]:[]})[_0xc04c('0x10')](function(_0x1f9335){logger['info']('ShowSquareProject',_0x4c9b09);logger[_0xc04c('0x14')](_0xc04c('0x1c'),_0x4c9b09,JSON[_0xc04c('0x16')](_0x1f9335));_0x183818(_0x1f9335);})[_0xc04c('0x1b')](function(_0x254860){logger[_0xc04c('0x17')]('ShowSquareProject',_0x254860['message'],_0x4c9b09);_0x4b3bb5(_0x43feb9[_0xc04c('0x17')](0x1f4,_0x254860[_0xc04c('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index e295e68..1252661 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 _0x8308=['register','length','squareProject:','./squareProject.events','save','remove','update','emit','removeListener'];(function(_0x3ce840,_0x1e0118){var _0x5089d1=function(_0x2cbefc){while(--_0x2cbefc){_0x3ce840['push'](_0x3ce840['shift']());}};_0x5089d1(++_0x1e0118);}(_0x8308,0xf6));var _0x8830=function(_0x4e29e5,_0x5ce388){_0x4e29e5=_0x4e29e5-0x0;var _0x312749=_0x8308[_0x4e29e5];return _0x312749;};'use strict';var SquareProjectEvents=require(_0x8830('0x0'));var events=[_0x8830('0x1'),_0x8830('0x2'),_0x8830('0x3')];function createListener(_0xc694ef,_0x45abc9){return function(_0x38b5c5){_0x45abc9[_0x8830('0x4')](_0xc694ef,_0x38b5c5);};}function removeListener(_0x6d80f9,_0x42d2f8){return function(){SquareProjectEvents[_0x8830('0x5')](_0x6d80f9,_0x42d2f8);};}exports[_0x8830('0x6')]=function(_0x4d4406){for(var _0x2ec6fc=0x0,_0x1fd53b=events[_0x8830('0x7')];_0x2ec6fc<_0x1fd53b;_0x2ec6fc++){var _0x1fb80e=events[_0x2ec6fc];var _0x236ed1=createListener(_0x8830('0x8')+_0x1fb80e,_0x4d4406);SquareProjectEvents['on'](_0x1fb80e,_0x236ed1);}}; \ No newline at end of file +var _0xa560=['./squareProject.events','save','emit','removeListener','squareProject:'];(function(_0x259706,_0x2937c9){var _0x1524a8=function(_0x29fac1){while(--_0x29fac1){_0x259706['push'](_0x259706['shift']());}};_0x1524a8(++_0x2937c9);}(_0xa560,0xf0));var _0x0a56=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xa560[_0x4a9fb1];return _0x348672;};'use strict';var SquareProjectEvents=require(_0x0a56('0x0'));var events=[_0x0a56('0x1'),'remove','update'];function createListener(_0x1f8238,_0x3e55e1){return function(_0x5e1016){_0x3e55e1[_0x0a56('0x2')](_0x1f8238,_0x5e1016);};}function removeListener(_0x231e29,_0x2ae044){return function(){SquareProjectEvents[_0x0a56('0x3')](_0x231e29,_0x2ae044);};}exports['register']=function(_0x766f3a){for(var _0x5781d9=0x0,_0x101981=events['length'];_0x5781d9<_0x101981;_0x5781d9++){var _0x17f2f8=events[_0x5781d9];var _0x518415=createListener(_0x0a56('0x4')+_0x17f2f8,_0x766f3a);SquareProjectEvents['on'](_0x17f2f8,_0x518415);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 6b6c16f..86a1e13 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(_0x2892da,_0x191a40){var _0x28cff2=function(_0x57023d){while(--_0x57023d){_0x2892da['push'](_0x2892da['shift']());}};_0x28cff2(++_0x191a40);}(_0x7217,0x19e));var _0x7721=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x7217[_0x49ca18];return _0x145d54;};'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 _0xe14b=['Router','../../components/auth/service','./squareRecording.controller','get','isAuthenticated','index','/:id','download','post','delete','destroy','exports','multer','util','express'];(function(_0x432eb2,_0x113cc4){var _0x4adbe6=function(_0x20cee0){while(--_0x20cee0){_0x432eb2['push'](_0x432eb2['shift']());}};_0x4adbe6(++_0x113cc4);}(_0xe14b,0x93));var _0xbe14=function(_0x37f31b,_0xd8a97){_0x37f31b=_0x37f31b-0x0;var _0x3074a3=_0xe14b[_0x37f31b];return _0x3074a3;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['show']);router['get']('/:id/download',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0xb')]('/',auth[_0xbe14('0x7')](),controller['create']);router['put'](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0xc')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xd')]);module[_0xbe14('0xe')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 5283014..13a80b2 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 _0x7bae=['savePath','substring','lastIndexOf','STRING','VIRTUAL','getDataValue'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x7bae,0x13b));var _0xe7ba=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0x7bae[_0x10004e];return _0x5af990;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xe7ba('0x0')]},'callerid':{'type':Sequelize[_0xe7ba('0x0')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xe7ba('0x0')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xe7ba('0x0')]},'accountcode':{'type':Sequelize[_0xe7ba('0x0')]},'dnid':{'type':Sequelize[_0xe7ba('0x0')]},'projectName':{'type':Sequelize[_0xe7ba('0x0')]},'saveName':{'type':Sequelize[_0xe7ba('0x0')]},'filename':{'type':Sequelize[_0xe7ba('0x0')]},'savePath':{'type':Sequelize[_0xe7ba('0x0')]},'format':{'type':Sequelize[_0xe7ba('0x1')],'get':function(){var _0x10b307='';var _0x34fb18=this[_0xe7ba('0x2')](_0xe7ba('0x3'));if(_0x34fb18){_0x10b307=_0x34fb18[_0xe7ba('0x4')](_0x34fb18[_0xe7ba('0x5')]('.'));}return _0x10b307;}}}; \ No newline at end of file +var _0x5fd1=['STRING','VIRTUAL','getDataValue','savePath','substring','sequelize'];(function(_0x4564ce,_0x17a92b){var _0x5c15c5=function(_0x1842c6){while(--_0x1842c6){_0x4564ce['push'](_0x4564ce['shift']());}};_0x5c15c5(++_0x17a92b);}(_0x5fd1,0x155));var _0x15fd=function(_0x1c8997,_0x59a48d){_0x1c8997=_0x1c8997-0x0;var _0x3c8b7a=_0x5fd1[_0x1c8997];return _0x3c8b7a;};'use strict';var Sequelize=require(_0x15fd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x15fd('0x1')]},'callerid':{'type':Sequelize[_0x15fd('0x1')]},'calleridname':{'type':Sequelize[_0x15fd('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x15fd('0x1')]},'accountcode':{'type':Sequelize[_0x15fd('0x1')]},'dnid':{'type':Sequelize[_0x15fd('0x1')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0x15fd('0x1')]},'filename':{'type':Sequelize[_0x15fd('0x1')]},'savePath':{'type':Sequelize[_0x15fd('0x1')]},'format':{'type':Sequelize[_0x15fd('0x2')],'get':function(){var _0x225728='';var _0x534e63=this[_0x15fd('0x3')](_0x15fd('0x4'));if(_0x534e63){_0x225728=_0x534e63[_0x15fd('0x5')](_0x534e63['lastIndexOf']('.'));}return _0x225728;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index e27f612..a17b21e 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 _0x533f=['reject','save','update','then','end','sendStatus','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','SquareRecording','includeAll','include','findAll','rows','catch','params','find','create','body','download','../../components/encryptor','uniqueid','savePath','decryptFile','recording','existsSync','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','extname','Not\x20found','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/license/util','status','offset','undefined','limit','count','set','json'];(function(_0x1f8c59,_0x3c8819){var _0x56969e=function(_0x1bcf2c){while(--_0x1bcf2c){_0x1f8c59['push'](_0x1f8c59['shift']());}};_0x56969e(++_0x3c8819);}(_0x533f,0x14e));var _0xf533=function(_0x79cd47,_0x16102d){_0x79cd47=_0x79cd47-0x0;var _0x3b9484=_0x533f[_0x79cd47];return _0x3b9484;};'use strict';var emlformat=require(_0xf533('0x0'));var rimraf=require(_0xf533('0x1'));var zipdir=require(_0xf533('0x2'));var jsonpatch=require(_0xf533('0x3'));var rp=require(_0xf533('0x4'));var moment=require(_0xf533('0x5'));var BPromise=require(_0xf533('0x6'));var Mustache=require(_0xf533('0x7'));var util=require(_0xf533('0x8'));var path=require('path');var sox=require(_0xf533('0x9'));var csv=require('to-csv');var ejs=require(_0xf533('0xa'));var fs=require('fs');var fs_extra=require(_0xf533('0xb'));var _=require('lodash');var squel=require(_0xf533('0xc'));var crypto=require(_0xf533('0xd'));var jsforce=require(_0xf533('0xe'));var deskjs=require(_0xf533('0xf'));var toCsv=require(_0xf533('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf533('0x11'));var authService=require(_0xf533('0x12'));var qs=require(_0xf533('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf533('0x14'));var utils=require(_0xf533('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf533('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e0a89,_0x3e3f21){_0x3e3f21=_0x3e3f21||0xcc;return function(_0x2091ff){if(_0x2091ff){return _0x2e0a89['sendStatus'](_0x3e3f21);}return _0x2e0a89[_0xf533('0x17')](_0x3e3f21)['end']();};}function respondWithResult(_0x99a107,_0x358b28){_0x358b28=_0x358b28||0xc8;return function(_0x3ddd36){if(_0x3ddd36){return _0x99a107['status'](_0x358b28)['json'](_0x3ddd36);}};}function respondWithFilteredResult(_0x337c5b,_0x11c34a){return function(_0x2aa0a8){if(_0x2aa0a8){var _0x578f2b=typeof _0x11c34a[_0xf533('0x18')]===_0xf533('0x19')&&typeof _0x11c34a[_0xf533('0x1a')]===_0xf533('0x19');var _0x3e1a2d=_0x2aa0a8[_0xf533('0x1b')];var _0xfdf54b=_0x578f2b?0x0:_0x11c34a['offset'];var _0x35426a=_0x578f2b?_0x2aa0a8[_0xf533('0x1b')]:_0x11c34a[_0xf533('0x18')]+_0x11c34a[_0xf533('0x1a')];var _0x1b0ae0;if(_0x35426a>=_0x3e1a2d){_0x35426a=_0x3e1a2d;_0x1b0ae0=0xc8;}else{_0x1b0ae0=0xce;}_0x337c5b[_0xf533('0x17')](_0x1b0ae0);return _0x337c5b[_0xf533('0x1c')]('Content-Range',_0xfdf54b+'-'+_0x35426a+'/'+_0x3e1a2d)[_0xf533('0x1d')](_0x2aa0a8);}return null;};}function patchUpdates(_0x51f384){return function(_0x2bef3c){try{jsonpatch['apply'](_0x2bef3c,_0x51f384,!![]);}catch(_0x1dea72){return BPromise[_0xf533('0x1e')](_0x1dea72);}return _0x2bef3c[_0xf533('0x1f')]();};}function saveUpdates(_0x3fd712,_0x23a837){return function(_0x40493d){if(_0x40493d){return _0x40493d[_0xf533('0x20')](_0x3fd712)[_0xf533('0x21')](function(_0x62a738){return _0x62a738;});}return null;};}function removeEntity(_0x19fd84,_0x5830d5){return function(_0x44d98e){if(_0x44d98e){return _0x44d98e['destroy']()[_0xf533('0x21')](function(){_0x19fd84[_0xf533('0x17')](0xcc)[_0xf533('0x22')]();});}};}function handleEntityNotFound(_0xa1fe06,_0x186930){return function(_0x1b8970){if(!_0x1b8970){_0xa1fe06[_0xf533('0x23')](0x194);}return _0x1b8970;};}function handleError(_0x4687c3,_0x1b23e8){_0x1b23e8=_0x1b23e8||0x1f4;return function(_0x5a41f2){logger['error'](_0x5a41f2[_0xf533('0x24')]);if(_0x5a41f2[_0xf533('0x25')]){delete _0x5a41f2[_0xf533('0x25')];}_0x4687c3[_0xf533('0x17')](_0x1b23e8)[_0xf533('0x26')](_0x5a41f2);};}exports['index']=function(_0xde9e05,_0x4ced7a){var _0x9d4df9={},_0x3b92c2={},_0x44f0e6={'count':0x0,'rows':[]};var _0x469758=_[_0xf533('0x27')](db['SquareRecording'][_0xf533('0x28')],function(_0xd1d41e){return{'name':_0xd1d41e[_0xf533('0x29')],'type':_0xd1d41e[_0xf533('0x2a')]['key']};});_0x3b92c2[_0xf533('0x2b')]=_[_0xf533('0x27')](_0x469758,'name');_0x3b92c2[_0xf533('0x2c')]=_[_0xf533('0x2d')](_0xde9e05[_0xf533('0x2c')]);_0x3b92c2['filters']=_[_0xf533('0x2e')](_0x3b92c2[_0xf533('0x2b')],_0x3b92c2[_0xf533('0x2c')]);_0x9d4df9['attributes']=_[_0xf533('0x2e')](_0x3b92c2[_0xf533('0x2b')],qs[_0xf533('0x2f')](_0xde9e05[_0xf533('0x2c')][_0xf533('0x2f')]));_0x9d4df9[_0xf533('0x30')]=_0x9d4df9[_0xf533('0x30')][_0xf533('0x31')]?_0x9d4df9[_0xf533('0x30')]:_0x3b92c2[_0xf533('0x2b')];if(!_0xde9e05[_0xf533('0x2c')][_0xf533('0x32')](_0xf533('0x33'))){_0x9d4df9[_0xf533('0x1a')]=qs[_0xf533('0x1a')](_0xde9e05['query'][_0xf533('0x1a')]);_0x9d4df9[_0xf533('0x18')]=qs['offset'](_0xde9e05['query']['offset']);}_0x9d4df9[_0xf533('0x34')]=qs['sort'](_0xde9e05[_0xf533('0x2c')][_0xf533('0x35')]);_0x9d4df9[_0xf533('0x36')]=qs['filters'](_[_0xf533('0x37')](_0xde9e05['query'],_0x3b92c2[_0xf533('0x38')]),_0x469758);if(_0xde9e05[_0xf533('0x2c')][_0xf533('0x39')]){_0x9d4df9[_0xf533('0x36')]=_['merge'](_0x9d4df9[_0xf533('0x36')],{'$or':_[_0xf533('0x27')](_0x469758,function(_0x43016b){if(_0x43016b[_0xf533('0x2a')]!==_0xf533('0x3a')){var _0xd2a42d={};_0xd2a42d[_0x43016b[_0xf533('0x25')]]={'$like':'%'+_0xde9e05[_0xf533('0x2c')][_0xf533('0x39')]+'%'};return _0xd2a42d;}})});}_0x9d4df9=_[_0xf533('0x3b')]({},_0x9d4df9,_0xde9e05[_0xf533('0x3c')]);var _0x25b815={'where':_0x9d4df9[_0xf533('0x36')]};return db[_0xf533('0x3d')][_0xf533('0x1b')](_0x25b815)['then'](function(_0x2cf6c5){_0x44f0e6[_0xf533('0x1b')]=_0x2cf6c5;if(_0xde9e05[_0xf533('0x2c')][_0xf533('0x3e')]){_0x9d4df9[_0xf533('0x3f')]=[{'all':!![]}];}return db['SquareRecording'][_0xf533('0x40')](_0x9d4df9);})['then'](function(_0x2941a7){_0x44f0e6[_0xf533('0x41')]=_0x2941a7;return _0x44f0e6;})[_0xf533('0x21')](respondWithFilteredResult(_0x4ced7a,_0x9d4df9))[_0xf533('0x42')](handleError(_0x4ced7a,null));};exports['show']=function(_0x4a7f00,_0x1ad2c9){var _0xef72bf={'raw':!![],'where':{'id':_0x4a7f00[_0xf533('0x43')]['id']}},_0x30e736={};_0x30e736[_0xf533('0x2b')]=_['keys'](db[_0xf533('0x3d')]['rawAttributes']);_0x30e736[_0xf533('0x2c')]=_['keys'](_0x4a7f00[_0xf533('0x2c')]);_0x30e736[_0xf533('0x38')]=_[_0xf533('0x2e')](_0x30e736[_0xf533('0x2b')],_0x30e736['query']);_0xef72bf[_0xf533('0x30')]=_[_0xf533('0x2e')](_0x30e736[_0xf533('0x2b')],qs[_0xf533('0x2f')](_0x4a7f00[_0xf533('0x2c')][_0xf533('0x2f')]));_0xef72bf[_0xf533('0x30')]=_0xef72bf[_0xf533('0x30')][_0xf533('0x31')]?_0xef72bf[_0xf533('0x30')]:_0x30e736[_0xf533('0x2b')];if(_0x4a7f00['query'][_0xf533('0x3e')]){_0xef72bf[_0xf533('0x3f')]=[{'all':!![]}];}_0xef72bf=_[_0xf533('0x3b')]({},_0xef72bf,_0x4a7f00[_0xf533('0x3c')]);return db[_0xf533('0x3d')][_0xf533('0x44')](_0xef72bf)[_0xf533('0x21')](handleEntityNotFound(_0x1ad2c9,null))[_0xf533('0x21')](respondWithResult(_0x1ad2c9,null))[_0xf533('0x42')](handleError(_0x1ad2c9,null));};exports[_0xf533('0x45')]=function(_0x370d5a,_0x2fde7b){return db[_0xf533('0x3d')][_0xf533('0x45')](_0x370d5a[_0xf533('0x46')],{})[_0xf533('0x21')](respondWithResult(_0x2fde7b,0xc9))[_0xf533('0x42')](handleError(_0x2fde7b,null));};exports[_0xf533('0x20')]=function(_0x1bb0ef,_0x13b631){if(_0x1bb0ef[_0xf533('0x46')]['id']){delete _0x1bb0ef[_0xf533('0x46')]['id'];}return db['SquareRecording']['find']({'where':{'id':_0x1bb0ef[_0xf533('0x43')]['id']}})[_0xf533('0x21')](handleEntityNotFound(_0x13b631,null))[_0xf533('0x21')](saveUpdates(_0x1bb0ef[_0xf533('0x46')],null))['then'](respondWithResult(_0x13b631,null))[_0xf533('0x42')](handleError(_0x13b631,null));};exports[_0xf533('0x47')]=function(_0x6a2e03,_0x5a4c10,_0x3761f7){var _0x1ab060=require(_0xf533('0x48'));var _0x331255=![];var _0x358d2c={};if(_0x6a2e03[_0xf533('0x2c')]['type']&&_0x6a2e03[_0xf533('0x2c')][_0xf533('0x2a')]===_0xf533('0x49')){_0x358d2c[_0xf533('0x49')]=_0x6a2e03[_0xf533('0x43')]['id'];}else{_0x358d2c['id']=_0x6a2e03[_0xf533('0x43')]['id'];}return db[_0xf533('0x3d')][_0xf533('0x44')]({'where':_0x358d2c,'attributes':['id',_0xf533('0x4a'),'filename'],'raw':!![]})[_0xf533('0x21')](handleEntityNotFound(_0x5a4c10,null))['then'](function(_0x124fda){if(_0x124fda){var _0xb63fe1=_0x124fda['savePath'];var _0x53c5d6=util['format']('%s.cypher',_0xb63fe1);if(fs['existsSync'](_0x53c5d6)){_0x331255=!![];return _0x1ab060[_0xf533('0x4b')](_0x53c5d6,_0xb63fe1,config['secrets'][_0xf533('0x4c')])['then'](function(){return _0x124fda;});}return _0x124fda;}})['then'](function(_0x2b0140){if(_0x2b0140){var _0x47bb09=_0x2b0140[_0xf533('0x4a')];if(!fs[_0xf533('0x4d')](_0x47bb09)){throw new db[(_0xf533('0x4e'))][(_0xf533('0x4f'))](_0xf533('0x50'));}if(_0x2b0140['filename']){return _0x5a4c10[_0xf533('0x47')](_0x47bb09,_0x2b0140[_0xf533('0x51')]+path[_0xf533('0x52')](_0x47bb09),function(){if(_0x331255){fs['unlink'](_0x47bb09);}});}else{return _0x5a4c10[_0xf533('0x47')](_0x47bb09,function(_0x3fb76d){if(_0x331255){fs['unlink'](_0x47bb09);}});}}})['catch'](function(_0x55f7b9){if(_0x55f7b9['message']===_0xf533('0x50')){_0x5a4c10[_0xf533('0x17')](0x194)[_0xf533('0x26')](_0xf533('0x53'));}else{return handleError(_0x5a4c10,null);}});};exports['destroy']=function(_0x36b186,_0x107c08){return db[_0xf533('0x3d')]['find']({'where':{'id':_0x36b186[_0xf533('0x43')]['id']}})['then'](function(_0x344bc5){if(_[_0xf533('0x54')](_0x344bc5)){throw new ReferenceError(_0xf533('0x55'));}return _0x344bc5;})[_0xf533('0x21')](function(_0x3c9b74){var _0x4cec0e=_0x3c9b74[_0xf533('0x4a')];logger[_0xf533('0x56')]('cancellazione\x20fisica\x20documento\x20%s',_0x4cec0e);if(!_[_0xf533('0x54')](_0x3c9b74[_0xf533('0x4a')])&&fs[_0xf533('0x4d')](_0x4cec0e)){logger[_0xf533('0x56')](_0xf533('0x57')+_0x4cec0e+_0xf533('0x58'));fs[_0xf533('0x59')](_0x4cec0e);}_0x4cec0e=_0x4cec0e+'.cypher';if(!_['isNil'](_0x3c9b74[_0xf533('0x4a')])&&fs[_0xf533('0x4d')](_0x4cec0e)){logger[_0xf533('0x56')](_0xf533('0x57')+_0x4cec0e+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xf533('0x59')](_0x4cec0e);}return _0x3c9b74;})['then'](function(_0x4b5a2b){if(!_0x4b5a2b)throw new InternalError();return _0x4b5a2b[_0xf533('0x5a')]();})['then'](function(){_0x107c08[_0xf533('0x17')](0xcc)[_0xf533('0x22')]();})[_0xf533('0x42')](handleError(_0x107c08,null));}; \ No newline at end of file +var _0xd86c=['fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','SquareRecording','rawAttributes','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','download','../../components/encryptor','uniqueid','savePath','filename','format','recording','Sequelize','unlink','message','SquareRecording\x20not\x20found','send','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','existsSync','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0xd86c,0x114));var _0xcd86=function(_0x46cf00,_0x457a43){_0x46cf00=_0x46cf00-0x0;var _0x3974dc=_0xd86c[_0x46cf00];return _0x3974dc;};'use strict';var emlformat=require(_0xcd86('0x0'));var rimraf=require(_0xcd86('0x1'));var zipdir=require(_0xcd86('0x2'));var jsonpatch=require(_0xcd86('0x3'));var rp=require(_0xcd86('0x4'));var moment=require(_0xcd86('0x5'));var BPromise=require(_0xcd86('0x6'));var Mustache=require(_0xcd86('0x7'));var util=require(_0xcd86('0x8'));var path=require(_0xcd86('0x9'));var sox=require(_0xcd86('0xa'));var csv=require('to-csv');var ejs=require(_0xcd86('0xb'));var fs=require('fs');var fs_extra=require(_0xcd86('0xc'));var _=require(_0xcd86('0xd'));var squel=require(_0xcd86('0xe'));var crypto=require('crypto');var jsforce=require(_0xcd86('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xcd86('0x10'));var querystring=require(_0xcd86('0x11'));var Papa=require(_0xcd86('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xcd86('0x13'));var as=require(_0xcd86('0x14'));var hardwareService=require(_0xcd86('0x15'));var logger=require(_0xcd86('0x16'))('api');var utils=require(_0xcd86('0x17'));var config=require(_0xcd86('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3adf13,_0x46741f){_0x46741f=_0x46741f||0xcc;return function(_0x1a9ecf){if(_0x1a9ecf){return _0x3adf13['sendStatus'](_0x46741f);}return _0x3adf13[_0xcd86('0x19')](_0x46741f)[_0xcd86('0x1a')]();};}function respondWithResult(_0x4055c7,_0x2717cb){_0x2717cb=_0x2717cb||0xc8;return function(_0x51c4ee){if(_0x51c4ee){return _0x4055c7['status'](_0x2717cb)[_0xcd86('0x1b')](_0x51c4ee);}};}function respondWithFilteredResult(_0x22baae,_0x53bae4){return function(_0x1389de){if(_0x1389de){var _0x204844=typeof _0x53bae4['offset']===_0xcd86('0x1c')&&typeof _0x53bae4[_0xcd86('0x1d')]===_0xcd86('0x1c');var _0x26169e=_0x1389de['count'];var _0x1f88da=_0x204844?0x0:_0x53bae4[_0xcd86('0x1e')];var _0x214e86=_0x204844?_0x1389de[_0xcd86('0x1f')]:_0x53bae4[_0xcd86('0x1e')]+_0x53bae4['limit'];var _0x53b948;if(_0x214e86>=_0x26169e){_0x214e86=_0x26169e;_0x53b948=0xc8;}else{_0x53b948=0xce;}_0x22baae[_0xcd86('0x19')](_0x53b948);return _0x22baae[_0xcd86('0x20')](_0xcd86('0x21'),_0x1f88da+'-'+_0x214e86+'/'+_0x26169e)[_0xcd86('0x1b')](_0x1389de);}return null;};}function patchUpdates(_0x825bbc){return function(_0x5ec312){try{jsonpatch['apply'](_0x5ec312,_0x825bbc,!![]);}catch(_0x142f6f){return BPromise[_0xcd86('0x22')](_0x142f6f);}return _0x5ec312[_0xcd86('0x23')]();};}function saveUpdates(_0x91ded9,_0x53794e){return function(_0x524f0b){if(_0x524f0b){return _0x524f0b[_0xcd86('0x24')](_0x91ded9)[_0xcd86('0x25')](function(_0x2ba3b6){return _0x2ba3b6;});}return null;};}function removeEntity(_0x51c9e8,_0x1b2bc9){return function(_0x34589b){if(_0x34589b){return _0x34589b[_0xcd86('0x26')]()['then'](function(){_0x51c9e8[_0xcd86('0x19')](0xcc)[_0xcd86('0x1a')]();});}};}function handleEntityNotFound(_0x47de6c,_0x59dd93){return function(_0x53c9c7){if(!_0x53c9c7){_0x47de6c[_0xcd86('0x27')](0x194);}return _0x53c9c7;};}function handleError(_0x41c86a,_0x31a357){_0x31a357=_0x31a357||0x1f4;return function(_0x32ae74){logger[_0xcd86('0x28')](_0x32ae74[_0xcd86('0x29')]);if(_0x32ae74[_0xcd86('0x2a')]){delete _0x32ae74['name'];}_0x41c86a[_0xcd86('0x19')](_0x31a357)['send'](_0x32ae74);};}exports[_0xcd86('0x2b')]=function(_0x1c91a2,_0x1b042a){var _0x57bb93={},_0x329078={},_0x1d327e={'count':0x0,'rows':[]};var _0x33aa0b=_[_0xcd86('0x2c')](db[_0xcd86('0x2d')][_0xcd86('0x2e')],function(_0x5ff5f1){return{'name':_0x5ff5f1['fieldName'],'type':_0x5ff5f1['type'][_0xcd86('0x2f')]};});_0x329078[_0xcd86('0x30')]=_[_0xcd86('0x2c')](_0x33aa0b,_0xcd86('0x2a'));_0x329078[_0xcd86('0x31')]=_['keys'](_0x1c91a2[_0xcd86('0x31')]);_0x329078['filters']=_[_0xcd86('0x32')](_0x329078['model'],_0x329078['query']);_0x57bb93[_0xcd86('0x33')]=_[_0xcd86('0x32')](_0x329078['model'],qs[_0xcd86('0x34')](_0x1c91a2[_0xcd86('0x31')][_0xcd86('0x34')]));_0x57bb93[_0xcd86('0x33')]=_0x57bb93[_0xcd86('0x33')][_0xcd86('0x35')]?_0x57bb93[_0xcd86('0x33')]:_0x329078[_0xcd86('0x30')];if(!_0x1c91a2[_0xcd86('0x31')][_0xcd86('0x36')](_0xcd86('0x37'))){_0x57bb93[_0xcd86('0x1d')]=qs[_0xcd86('0x1d')](_0x1c91a2[_0xcd86('0x31')][_0xcd86('0x1d')]);_0x57bb93[_0xcd86('0x1e')]=qs[_0xcd86('0x1e')](_0x1c91a2[_0xcd86('0x31')]['offset']);}_0x57bb93[_0xcd86('0x38')]=qs[_0xcd86('0x39')](_0x1c91a2['query'][_0xcd86('0x39')]);_0x57bb93[_0xcd86('0x3a')]=qs[_0xcd86('0x3b')](_[_0xcd86('0x3c')](_0x1c91a2[_0xcd86('0x31')],_0x329078['filters']),_0x33aa0b);if(_0x1c91a2[_0xcd86('0x31')]['filter']){_0x57bb93[_0xcd86('0x3a')]=_['merge'](_0x57bb93[_0xcd86('0x3a')],{'$or':_['map'](_0x33aa0b,function(_0x5178b6){if(_0x5178b6[_0xcd86('0x3d')]!==_0xcd86('0x3e')){var _0x26b4fa={};_0x26b4fa[_0x5178b6[_0xcd86('0x2a')]]={'$like':'%'+_0x1c91a2[_0xcd86('0x31')]['filter']+'%'};return _0x26b4fa;}})});}_0x57bb93=_[_0xcd86('0x3f')]({},_0x57bb93,_0x1c91a2[_0xcd86('0x40')]);var _0x4a64d5={'where':_0x57bb93[_0xcd86('0x3a')]};return db[_0xcd86('0x2d')][_0xcd86('0x1f')](_0x4a64d5)['then'](function(_0x414d5e){_0x1d327e['count']=_0x414d5e;if(_0x1c91a2[_0xcd86('0x31')][_0xcd86('0x41')]){_0x57bb93[_0xcd86('0x42')]=[{'all':!![]}];}return db['SquareRecording'][_0xcd86('0x43')](_0x57bb93);})[_0xcd86('0x25')](function(_0x535eba){_0x1d327e[_0xcd86('0x44')]=_0x535eba;return _0x1d327e;})[_0xcd86('0x25')](respondWithFilteredResult(_0x1b042a,_0x57bb93))[_0xcd86('0x45')](handleError(_0x1b042a,null));};exports[_0xcd86('0x46')]=function(_0x3f7cea,_0x196f64){var _0x443fd4={'raw':!![],'where':{'id':_0x3f7cea[_0xcd86('0x47')]['id']}},_0x19b263={};_0x19b263['model']=_['keys'](db[_0xcd86('0x2d')][_0xcd86('0x2e')]);_0x19b263[_0xcd86('0x31')]=_[_0xcd86('0x48')](_0x3f7cea[_0xcd86('0x31')]);_0x19b263[_0xcd86('0x3b')]=_[_0xcd86('0x32')](_0x19b263['model'],_0x19b263['query']);_0x443fd4[_0xcd86('0x33')]=_[_0xcd86('0x32')](_0x19b263[_0xcd86('0x30')],qs['fields'](_0x3f7cea[_0xcd86('0x31')][_0xcd86('0x34')]));_0x443fd4['attributes']=_0x443fd4[_0xcd86('0x33')][_0xcd86('0x35')]?_0x443fd4['attributes']:_0x19b263[_0xcd86('0x30')];if(_0x3f7cea[_0xcd86('0x31')][_0xcd86('0x41')]){_0x443fd4[_0xcd86('0x42')]=[{'all':!![]}];}_0x443fd4=_[_0xcd86('0x3f')]({},_0x443fd4,_0x3f7cea[_0xcd86('0x40')]);return db['SquareRecording']['find'](_0x443fd4)[_0xcd86('0x25')](handleEntityNotFound(_0x196f64,null))[_0xcd86('0x25')](respondWithResult(_0x196f64,null))['catch'](handleError(_0x196f64,null));};exports[_0xcd86('0x49')]=function(_0x1a6845,_0x5a672b){return db['SquareRecording'][_0xcd86('0x49')](_0x1a6845[_0xcd86('0x4a')],{})[_0xcd86('0x25')](respondWithResult(_0x5a672b,0xc9))[_0xcd86('0x45')](handleError(_0x5a672b,null));};exports[_0xcd86('0x24')]=function(_0x1eb1ac,_0x5a626a){if(_0x1eb1ac[_0xcd86('0x4a')]['id']){delete _0x1eb1ac[_0xcd86('0x4a')]['id'];}return db[_0xcd86('0x2d')][_0xcd86('0x4b')]({'where':{'id':_0x1eb1ac[_0xcd86('0x47')]['id']}})[_0xcd86('0x25')](handleEntityNotFound(_0x5a626a,null))['then'](saveUpdates(_0x1eb1ac[_0xcd86('0x4a')],null))['then'](respondWithResult(_0x5a626a,null))[_0xcd86('0x45')](handleError(_0x5a626a,null));};exports[_0xcd86('0x4c')]=function(_0x50d2b0,_0x5debf7,_0x4be0aa){var _0x54afb8=require(_0xcd86('0x4d'));var _0x38a080=![];var _0x4bada5={};if(_0x50d2b0[_0xcd86('0x31')][_0xcd86('0x3d')]&&_0x50d2b0[_0xcd86('0x31')][_0xcd86('0x3d')]===_0xcd86('0x4e')){_0x4bada5[_0xcd86('0x4e')]=_0x50d2b0[_0xcd86('0x47')]['id'];}else{_0x4bada5['id']=_0x50d2b0[_0xcd86('0x47')]['id'];}return db[_0xcd86('0x2d')][_0xcd86('0x4b')]({'where':_0x4bada5,'attributes':['id',_0xcd86('0x4f'),_0xcd86('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0x5debf7,null))[_0xcd86('0x25')](function(_0x251edb){if(_0x251edb){var _0x3b015b=_0x251edb['savePath'];var _0x2a5bf0=util[_0xcd86('0x51')]('%s.cypher',_0x3b015b);if(fs['existsSync'](_0x2a5bf0)){_0x38a080=!![];return _0x54afb8['decryptFile'](_0x2a5bf0,_0x3b015b,config['secrets'][_0xcd86('0x52')])[_0xcd86('0x25')](function(){return _0x251edb;});}return _0x251edb;}})['then'](function(_0x4625d9){if(_0x4625d9){var _0x3406fd=_0x4625d9[_0xcd86('0x4f')];if(!fs['existsSync'](_0x3406fd)){throw new db[(_0xcd86('0x53'))]['ValidationError']('SquareRecording\x20not\x20found');}if(_0x4625d9[_0xcd86('0x50')]){return _0x5debf7[_0xcd86('0x4c')](_0x3406fd,_0x4625d9[_0xcd86('0x50')]+path['extname'](_0x3406fd),function(){if(_0x38a080){fs[_0xcd86('0x54')](_0x3406fd);}});}else{return _0x5debf7[_0xcd86('0x4c')](_0x3406fd,function(_0x45a0ce){if(_0x38a080){fs['unlink'](_0x3406fd);}});}}})[_0xcd86('0x45')](function(_0x49f526){if(_0x49f526[_0xcd86('0x55')]===_0xcd86('0x56')){_0x5debf7[_0xcd86('0x19')](0x194)[_0xcd86('0x57')]('Not\x20found');}else{return handleError(_0x5debf7,null);}});};exports[_0xcd86('0x26')]=function(_0x13c8b3,_0x564bf5){return db[_0xcd86('0x2d')][_0xcd86('0x4b')]({'where':{'id':_0x13c8b3[_0xcd86('0x47')]['id']}})[_0xcd86('0x25')](function(_0x2fe712){if(_[_0xcd86('0x58')](_0x2fe712)){throw new ReferenceError(_0xcd86('0x59'));}return _0x2fe712;})[_0xcd86('0x25')](function(_0x1c93c){var _0x1624f9=_0x1c93c[_0xcd86('0x4f')];logger[_0xcd86('0x5a')](_0xcd86('0x5b'),_0x1624f9);if(!_[_0xcd86('0x58')](_0x1c93c[_0xcd86('0x4f')])&&fs[_0xcd86('0x5c')](_0x1624f9)){logger[_0xcd86('0x5a')](_0xcd86('0x5d')+_0x1624f9+_0xcd86('0x5e'));fs[_0xcd86('0x5f')](_0x1624f9);}_0x1624f9=_0x1624f9+'.cypher';if(!_['isNil'](_0x1c93c[_0xcd86('0x4f')])&&fs[_0xcd86('0x5c')](_0x1624f9)){logger['info'](_0xcd86('0x5d')+_0x1624f9+_0xcd86('0x5e'));fs[_0xcd86('0x5f')](_0x1624f9);}return _0x1c93c;})[_0xcd86('0x25')](function(_0x297b8b){if(!_0x297b8b)throw new InternalError();return _0x297b8b[_0xcd86('0x26')]();})[_0xcd86('0x25')](function(){_0x564bf5['status'](0xcc)[_0xcd86('0x1a')]();})[_0xcd86('0x45')](handleError(_0x564bf5,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 432f916..cf6e97e 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 _0x2da6=['moment','bluebird','request-promise','path','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','util','../../config/logger','api'];(function(_0x4e6c2d,_0x10ebd0){var _0x2008aa=function(_0x13d0fc){while(--_0x13d0fc){_0x4e6c2d['push'](_0x4e6c2d['shift']());}};_0x2008aa(++_0x10ebd0);}(_0x2da6,0x1dd));var _0x62da=function(_0x36e68c,_0x2938c4){_0x36e68c=_0x36e68c-0x0;var _0x3a521e=_0x2da6[_0x36e68c];return _0x3a521e;};'use strict';var _=require(_0x62da('0x0'));var util=require(_0x62da('0x1'));var logger=require(_0x62da('0x2'))(_0x62da('0x3'));var moment=require(_0x62da('0x4'));var BPromise=require(_0x62da('0x5'));var rp=require(_0x62da('0x6'));var fs=require('fs');var path=require(_0x62da('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x62da('0x8'));module[_0x62da('0x9')]=function(_0x3a59f8,_0x30437f){return _0x3a59f8[_0x62da('0xa')](_0x62da('0xb'),attributes,{'tableName':_0x62da('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf96b=['bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','util','../../config/logger','api','moment'];(function(_0x229bfc,_0x1df5a5){var _0x28fee5=function(_0x557103){while(--_0x557103){_0x229bfc['push'](_0x229bfc['shift']());}};_0x28fee5(++_0x1df5a5);}(_0xf96b,0x109));var _0xbf96=function(_0x183f55,_0x6cf2f0){_0x183f55=_0x183f55-0x0;var _0x1b0987=_0xf96b[_0x183f55];return _0x1b0987;};'use strict';var _=require(_0xbf96('0x0'));var util=require(_0xbf96('0x1'));var logger=require(_0xbf96('0x2'))(_0xbf96('0x3'));var moment=require(_0xbf96('0x4'));var BPromise=require(_0xbf96('0x5'));var rp=require(_0xbf96('0x6'));var fs=require('fs');var path=require(_0xbf96('0x7'));var rimraf=require(_0xbf96('0x8'));var config=require(_0xbf96('0x9'));var attributes=require(_0xbf96('0xa'));module[_0xbf96('0xb')]=function(_0x162c19,_0x4de1c3){return _0x162c19[_0xbf96('0xc')](_0xbf96('0xd'),attributes,{'tableName':_0xbf96('0xe'),'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 5a0d74c..6c2f0cf 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 _0x3e5c=['create','options','raw','then','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','CreateSquareRecording','SquareRecording'];(function(_0x26df35,_0x4a8b78){var _0x1944a5=function(_0xa27fe8){while(--_0xa27fe8){_0x26df35['push'](_0x26df35['shift']());}};_0x1944a5(++_0x4a8b78);}(_0x3e5c,0x6c));var _0xc3e5=function(_0x2a1a09,_0x5ca556){_0x2a1a09=_0x2a1a09-0x0;var _0x2add23=_0x3e5c[_0x2a1a09];return _0x2add23;};'use strict';var _=require(_0xc3e5('0x0'));var util=require(_0xc3e5('0x1'));var moment=require(_0xc3e5('0x2'));var BPromise=require('bluebird');var rs=require(_0xc3e5('0x3'));var fs=require('fs');var Redis=require(_0xc3e5('0x4'));var db=require(_0xc3e5('0x5'))['db'];var utils=require(_0xc3e5('0x6'));var logger=require(_0xc3e5('0x7'))('rpc');var config=require(_0xc3e5('0x8'));var jayson=require(_0xc3e5('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3b1f15,_0xd8d560,_0x1d6b0d){return new BPromise(function(_0x488a7b,_0x316809){return client[_0xc3e5('0xa')](_0x3b1f15,_0x1d6b0d)['then'](function(_0xb4d9c5){logger[_0xc3e5('0xb')](_0xc3e5('0xc'),_0xd8d560,_0xc3e5('0xd'));logger[_0xc3e5('0xe')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0xd8d560,'request\x20sent',JSON['stringify'](_0xb4d9c5));if(_0xb4d9c5[_0xc3e5('0xf')]){if(_0xb4d9c5[_0xc3e5('0xf')][_0xc3e5('0x10')]===0x1f4){logger[_0xc3e5('0xf')](_0xc3e5('0xc'),_0xd8d560,_0xb4d9c5[_0xc3e5('0xf')][_0xc3e5('0x11')]);return _0x316809(_0xb4d9c5[_0xc3e5('0xf')]['message']);}logger[_0xc3e5('0xf')]('SquareRecording,\x20%s,\x20%s',_0xd8d560,_0xb4d9c5[_0xc3e5('0xf')][_0xc3e5('0x11')]);return _0x488a7b(_0xb4d9c5[_0xc3e5('0xf')][_0xc3e5('0x11')]);}else{logger[_0xc3e5('0xb')](_0xc3e5('0xc'),_0xd8d560,_0xc3e5('0xd'));_0x488a7b(_0xb4d9c5[_0xc3e5('0x12')]['message']);}})[_0xc3e5('0x13')](function(_0x1d84a1){logger['error'](_0xc3e5('0xc'),_0xd8d560,_0x1d84a1);_0x316809(_0x1d84a1);});});}exports[_0xc3e5('0x14')]=function(_0x2191b9){var _0x522560=this;return new Promise(function(_0x36012b,_0x110f79){return db[_0xc3e5('0x15')][_0xc3e5('0x16')](_0x2191b9['body'],{'raw':_0x2191b9[_0xc3e5('0x17')]?_0x2191b9['options'][_0xc3e5('0x18')]===undefined?!![]:![]:!![]})[_0xc3e5('0x19')](function(_0x25ae7a){logger[_0xc3e5('0xb')]('CreateSquareRecording',_0x2191b9);logger[_0xc3e5('0xe')](_0xc3e5('0x14'),_0x2191b9,JSON['stringify'](_0x25ae7a));_0x36012b(_0x25ae7a);})['catch'](function(_0x54bf05){logger[_0xc3e5('0xf')](_0xc3e5('0x14'),_0x54bf05[_0xc3e5('0x11')],_0x2191b9);_0x110f79(_0x522560['error'](0x1f4,_0x54bf05[_0xc3e5('0x11')]));});});}; \ No newline at end of file +var _0xd73e=['jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateSquareRecording','SquareRecording','create','body','options','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4be3ca,_0x1fb9bc){var _0x5d2c7f=function(_0x3fe9ec){while(--_0x3fe9ec){_0x4be3ca['push'](_0x4be3ca['shift']());}};_0x5d2c7f(++_0x1fb9bc);}(_0xd73e,0x172));var _0xed73=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd73e[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xed73('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xed73('0x1'));var fs=require('fs');var Redis=require(_0xed73('0x2'));var db=require(_0xed73('0x3'))['db'];var utils=require(_0xed73('0x4'));var logger=require(_0xed73('0x5'))(_0xed73('0x6'));var config=require(_0xed73('0x7'));var jayson=require(_0xed73('0x8'));var client=jayson[_0xed73('0x9')][_0xed73('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e7c03,_0x32ed82,_0x4d6605){return new BPromise(function(_0x4e96d9,_0x4f9e5d){return client[_0xed73('0xb')](_0x2e7c03,_0x4d6605)[_0xed73('0xc')](function(_0x41f278){logger[_0xed73('0xd')](_0xed73('0xe'),_0x32ed82,_0xed73('0xf'));logger[_0xed73('0x10')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x32ed82,_0xed73('0xf'),JSON[_0xed73('0x11')](_0x41f278));if(_0x41f278[_0xed73('0x12')]){if(_0x41f278[_0xed73('0x12')]['code']===0x1f4){logger['error']('SquareRecording,\x20%s,\x20%s',_0x32ed82,_0x41f278[_0xed73('0x12')][_0xed73('0x13')]);return _0x4f9e5d(_0x41f278[_0xed73('0x12')][_0xed73('0x13')]);}logger[_0xed73('0x12')]('SquareRecording,\x20%s,\x20%s',_0x32ed82,_0x41f278[_0xed73('0x12')][_0xed73('0x13')]);return _0x4e96d9(_0x41f278[_0xed73('0x12')]['message']);}else{logger['info'](_0xed73('0xe'),_0x32ed82,_0xed73('0xf'));_0x4e96d9(_0x41f278[_0xed73('0x14')][_0xed73('0x13')]);}})[_0xed73('0x15')](function(_0x4c2057){logger['error']('SquareRecording,\x20%s,\x20%s',_0x32ed82,_0x4c2057);_0x4f9e5d(_0x4c2057);});});}exports[_0xed73('0x16')]=function(_0x2eefb0){var _0x248c41=this;return new Promise(function(_0xb3f1d8,_0x3f7eb3){return db[_0xed73('0x17')][_0xed73('0x18')](_0x2eefb0[_0xed73('0x19')],{'raw':_0x2eefb0[_0xed73('0x1a')]?_0x2eefb0[_0xed73('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xed73('0xc')](function(_0x17e63f){logger[_0xed73('0xd')](_0xed73('0x16'),_0x2eefb0);logger[_0xed73('0x10')]('CreateSquareRecording',_0x2eefb0,JSON[_0xed73('0x11')](_0x17e63f));_0xb3f1d8(_0x17e63f);})[_0xed73('0x15')](function(_0x2c7d8b){logger[_0xed73('0x12')](_0xed73('0x16'),_0x2c7d8b[_0xed73('0x13')],_0x2eefb0);_0x3f7eb3(_0x248c41[_0xed73('0x12')](0x1f4,_0x2c7d8b[_0xed73('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index bd6424a..67b8651 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x33d64a,_0x4195e7){var _0x74efab=function(_0xf2a76a){while(--_0xf2a76a){_0x33d64a['push'](_0x33d64a['shift']());}};_0x74efab(++_0x4195e7);}(_0xe706,0xa3));var _0x6e70=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xe706[_0x4709c0];return _0x13348b;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file +var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0xd381ae,_0x191ad8){var _0x172bd3=function(_0xc26a72){while(--_0xc26a72){_0xd381ae['push'](_0xd381ae['shift']());}};_0x172bd3(++_0x191ad8);}(_0xe706,0xa3));var _0x6e70=function(_0x292f93,_0x2c6e8e){_0x292f93=_0x292f93-0x0;var _0x5a94b1=_0xe706[_0x292f93];return _0x5a94b1;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 9a97f12..5050b60 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 _0x5317=['DATE','sequelize','exports','STRING'];(function(_0x3f88bc,_0xe38cf5){var _0x4df1c4=function(_0x111de1){while(--_0x111de1){_0x3f88bc['push'](_0x3f88bc['shift']());}};_0x4df1c4(++_0xe38cf5);}(_0x5317,0x1ad));var _0x7531=function(_0x27d1bd,_0xb04627){_0x27d1bd=_0x27d1bd-0x0;var _0x72f82a=_0x5317[_0x27d1bd];return _0x72f82a;};'use strict';var Sequelize=require(_0x7531('0x0'));module[_0x7531('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x7531('0x2')]},'request':{'type':Sequelize[_0x7531('0x2')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x7531('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x7531('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x7531('0x2')]},'callingani2':{'type':Sequelize[_0x7531('0x2')]},'callington':{'type':Sequelize[_0x7531('0x2')]},'callingtns':{'type':Sequelize[_0x7531('0x2')]},'dnid':{'type':Sequelize[_0x7531('0x2')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x7531('0x2')]},'priority':{'type':Sequelize[_0x7531('0x2')]},'enhanced':{'type':Sequelize[_0x7531('0x2')]},'accountcode':{'type':Sequelize[_0x7531('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0x7531('0x2')]},'joinAt':{'type':Sequelize[_0x7531('0x3')]},'leaveAt':{'type':Sequelize[_0x7531('0x3')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x9165=['STRING','DATE','sequelize'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x9165,0x17c));var _0x5916=function(_0x2e7a43,_0x3b3df4){_0x2e7a43=_0x2e7a43-0x0;var _0x52e9e1=_0x9165[_0x2e7a43];return _0x52e9e1;};'use strict';var Sequelize=require(_0x5916('0x0'));module['exports']={'network':{'type':Sequelize[_0x5916('0x1')]},'network_script':{'type':Sequelize[_0x5916('0x1')]},'request':{'type':Sequelize[_0x5916('0x1')]},'channel':{'type':Sequelize[_0x5916('0x1')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x5916('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x5916('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5916('0x1')]},'callingpres':{'type':Sequelize[_0x5916('0x1')]},'callingani2':{'type':Sequelize[_0x5916('0x1')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x5916('0x1')]},'dnid':{'type':Sequelize[_0x5916('0x1')]},'rdnis':{'type':Sequelize[_0x5916('0x1')]},'context':{'type':Sequelize[_0x5916('0x1')]},'extension':{'type':Sequelize[_0x5916('0x1')]},'priority':{'type':Sequelize[_0x5916('0x1')]},'enhanced':{'type':Sequelize[_0x5916('0x1')]},'accountcode':{'type':Sequelize[_0x5916('0x1')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0x5916('0x1')]},'joinAt':{'type':Sequelize[_0x5916('0x2')]},'leaveAt':{'type':Sequelize[_0x5916('0x2')]},'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 3d6ab83..5c9940e 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 _0x2a45=['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','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','SquareReport','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','catch','show','rawAttributes','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce'];(function(_0xe6cf5e,_0x95f17a){var _0x168722=function(_0x14a950){while(--_0x14a950){_0xe6cf5e['push'](_0xe6cf5e['shift']());}};_0x168722(++_0x95f17a);}(_0x2a45,0x91));var _0x52a4=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x2a45[_0xa148b7];return _0x51efd3;};'use strict';var emlformat=require(_0x52a4('0x0'));var rimraf=require(_0x52a4('0x1'));var zipdir=require(_0x52a4('0x2'));var jsonpatch=require(_0x52a4('0x3'));var rp=require(_0x52a4('0x4'));var moment=require('moment');var BPromise=require(_0x52a4('0x5'));var Mustache=require(_0x52a4('0x6'));var util=require('util');var path=require(_0x52a4('0x7'));var sox=require(_0x52a4('0x8'));var csv=require(_0x52a4('0x9'));var ejs=require(_0x52a4('0xa'));var fs=require('fs');var fs_extra=require(_0x52a4('0xb'));var _=require(_0x52a4('0xc'));var squel=require(_0x52a4('0xd'));var crypto=require('crypto');var jsforce=require(_0x52a4('0xe'));var deskjs=require(_0x52a4('0xf'));var toCsv=require(_0x52a4('0x9'));var querystring=require(_0x52a4('0x10'));var Papa=require(_0x52a4('0x11'));var Redis=require(_0x52a4('0x12'));var authService=require(_0x52a4('0x13'));var qs=require(_0x52a4('0x14'));var as=require(_0x52a4('0x15'));var hardwareService=require(_0x52a4('0x16'));var logger=require(_0x52a4('0x17'))(_0x52a4('0x18'));var utils=require('../../config/utils');var config=require(_0x52a4('0x19'));var licenseUtil=require(_0x52a4('0x1a'));var db=require(_0x52a4('0x1b'))['db'];function respondWithStatusCode(_0x5fecba,_0x5bb166){_0x5bb166=_0x5bb166||0xcc;return function(_0x1eea7c){if(_0x1eea7c){return _0x5fecba[_0x52a4('0x1c')](_0x5bb166);}return _0x5fecba[_0x52a4('0x1d')](_0x5bb166)[_0x52a4('0x1e')]();};}function respondWithResult(_0x1b16ff,_0x6b569b){_0x6b569b=_0x6b569b||0xc8;return function(_0x48aeae){if(_0x48aeae){return _0x1b16ff[_0x52a4('0x1d')](_0x6b569b)[_0x52a4('0x1f')](_0x48aeae);}};}function respondWithFilteredResult(_0x412882,_0x48bc0e){return function(_0x56e1aa){if(_0x56e1aa){var _0x54c94c=typeof _0x48bc0e[_0x52a4('0x20')]==='undefined'&&typeof _0x48bc0e[_0x52a4('0x21')]===_0x52a4('0x22');var _0x48b832=_0x56e1aa[_0x52a4('0x23')];var _0xf555ba=_0x54c94c?0x0:_0x48bc0e[_0x52a4('0x20')];var _0x8d2b2f=_0x54c94c?_0x56e1aa[_0x52a4('0x23')]:_0x48bc0e[_0x52a4('0x20')]+_0x48bc0e[_0x52a4('0x21')];var _0x218ed2;if(_0x8d2b2f>=_0x48b832){_0x8d2b2f=_0x48b832;_0x218ed2=0xc8;}else{_0x218ed2=0xce;}_0x412882[_0x52a4('0x1d')](_0x218ed2);return _0x412882[_0x52a4('0x24')](_0x52a4('0x25'),_0xf555ba+'-'+_0x8d2b2f+'/'+_0x48b832)['json'](_0x56e1aa);}return null;};}function patchUpdates(_0x473ad5){return function(_0x59c0eb){try{jsonpatch[_0x52a4('0x26')](_0x59c0eb,_0x473ad5,!![]);}catch(_0x167649){return BPromise[_0x52a4('0x27')](_0x167649);}return _0x59c0eb[_0x52a4('0x28')]();};}function saveUpdates(_0x9f977d,_0x58167f){return function(_0xfbf281){if(_0xfbf281){return _0xfbf281[_0x52a4('0x29')](_0x9f977d)[_0x52a4('0x2a')](function(_0x1446e1){return _0x1446e1;});}return null;};}function removeEntity(_0x18e066,_0x56c62c){return function(_0x51fdfb){if(_0x51fdfb){return _0x51fdfb['destroy']()[_0x52a4('0x2a')](function(){_0x18e066[_0x52a4('0x1d')](0xcc)[_0x52a4('0x1e')]();});}};}function handleEntityNotFound(_0x5b52d2,_0x3e3ef3){return function(_0x2f9c73){if(!_0x2f9c73){_0x5b52d2[_0x52a4('0x1c')](0x194);}return _0x2f9c73;};}function handleError(_0x38ebcf,_0xb5811e){_0xb5811e=_0xb5811e||0x1f4;return function(_0x48b39f){logger[_0x52a4('0x2b')](_0x48b39f[_0x52a4('0x2c')]);if(_0x48b39f[_0x52a4('0x2d')]){delete _0x48b39f['name'];}_0x38ebcf[_0x52a4('0x1d')](_0xb5811e)['send'](_0x48b39f);};}exports[_0x52a4('0x2e')]=function(_0x5bb6e2,_0x22939b){var _0x3626c3={},_0x163540={},_0x35006b={'count':0x0,'rows':[]};var _0x13c494=_[_0x52a4('0x2f')](db[_0x52a4('0x30')]['rawAttributes'],function(_0x208106){return{'name':_0x208106['fieldName'],'type':_0x208106['type'][_0x52a4('0x31')]};});_0x163540[_0x52a4('0x32')]=_['map'](_0x13c494,_0x52a4('0x2d'));_0x163540[_0x52a4('0x33')]=_[_0x52a4('0x34')](_0x5bb6e2['query']);_0x163540[_0x52a4('0x35')]=_[_0x52a4('0x36')](_0x163540[_0x52a4('0x32')],_0x163540[_0x52a4('0x33')]);_0x3626c3['attributes']=_[_0x52a4('0x36')](_0x163540[_0x52a4('0x32')],qs[_0x52a4('0x37')](_0x5bb6e2[_0x52a4('0x33')][_0x52a4('0x37')]));_0x3626c3['attributes']=_0x3626c3[_0x52a4('0x38')][_0x52a4('0x39')]?_0x3626c3[_0x52a4('0x38')]:_0x163540['model'];if(!_0x5bb6e2['query'][_0x52a4('0x3a')](_0x52a4('0x3b'))){_0x3626c3[_0x52a4('0x21')]=qs[_0x52a4('0x21')](_0x5bb6e2['query'][_0x52a4('0x21')]);_0x3626c3[_0x52a4('0x20')]=qs[_0x52a4('0x20')](_0x5bb6e2['query'][_0x52a4('0x20')]);}_0x3626c3[_0x52a4('0x3c')]=qs[_0x52a4('0x3d')](_0x5bb6e2['query'][_0x52a4('0x3d')]);_0x3626c3[_0x52a4('0x3e')]=qs[_0x52a4('0x35')](_[_0x52a4('0x3f')](_0x5bb6e2[_0x52a4('0x33')],_0x163540[_0x52a4('0x35')]),_0x13c494);if(_0x5bb6e2[_0x52a4('0x33')][_0x52a4('0x40')]){_0x3626c3[_0x52a4('0x3e')]=_[_0x52a4('0x41')](_0x3626c3[_0x52a4('0x3e')],{'$or':_['map'](_0x13c494,function(_0x37251b){if(_0x37251b[_0x52a4('0x42')]!==_0x52a4('0x43')){var _0x196655={};_0x196655[_0x37251b[_0x52a4('0x2d')]]={'$like':'%'+_0x5bb6e2[_0x52a4('0x33')][_0x52a4('0x40')]+'%'};return _0x196655;}})});}_0x3626c3=_[_0x52a4('0x41')]({},_0x3626c3,_0x5bb6e2[_0x52a4('0x44')]);var _0x2b7d2b={'where':_0x3626c3['where']};return db[_0x52a4('0x30')][_0x52a4('0x23')](_0x2b7d2b)[_0x52a4('0x2a')](function(_0x578adc){_0x35006b[_0x52a4('0x23')]=_0x578adc;if(_0x5bb6e2[_0x52a4('0x33')][_0x52a4('0x45')]){_0x3626c3[_0x52a4('0x46')]=[{'all':!![]}];}return db[_0x52a4('0x30')]['findAll'](_0x3626c3);})[_0x52a4('0x2a')](function(_0x118afc){_0x35006b['rows']=_0x118afc;return _0x35006b;})['then'](respondWithFilteredResult(_0x22939b,_0x3626c3))[_0x52a4('0x47')](handleError(_0x22939b,null));};exports[_0x52a4('0x48')]=function(_0x2bf591,_0x40c444){var _0x5e31e2={'raw':!![],'where':{'id':_0x2bf591['params']['id']}},_0x259b90={};_0x259b90[_0x52a4('0x32')]=_[_0x52a4('0x34')](db[_0x52a4('0x30')][_0x52a4('0x49')]);_0x259b90[_0x52a4('0x33')]=_[_0x52a4('0x34')](_0x2bf591[_0x52a4('0x33')]);_0x259b90[_0x52a4('0x35')]=_['intersection'](_0x259b90[_0x52a4('0x32')],_0x259b90[_0x52a4('0x33')]);_0x5e31e2['attributes']=_[_0x52a4('0x36')](_0x259b90[_0x52a4('0x32')],qs[_0x52a4('0x37')](_0x2bf591[_0x52a4('0x33')][_0x52a4('0x37')]));_0x5e31e2[_0x52a4('0x38')]=_0x5e31e2['attributes']['length']?_0x5e31e2[_0x52a4('0x38')]:_0x259b90['model'];if(_0x2bf591[_0x52a4('0x33')]['includeAll']){_0x5e31e2[_0x52a4('0x46')]=[{'all':!![]}];}_0x5e31e2=_[_0x52a4('0x41')]({},_0x5e31e2,_0x2bf591['options']);return db['SquareReport'][_0x52a4('0x4a')](_0x5e31e2)[_0x52a4('0x2a')](handleEntityNotFound(_0x40c444,null))[_0x52a4('0x2a')](respondWithResult(_0x40c444,null))['catch'](handleError(_0x40c444,null));};exports[_0x52a4('0x4b')]=function(_0x568243,_0x2d6e9c){return db['SquareReport']['create'](_0x568243['body'],{})['then'](respondWithResult(_0x2d6e9c,0xc9))[_0x52a4('0x47')](handleError(_0x2d6e9c,null));};exports[_0x52a4('0x29')]=function(_0x11e876,_0x3ec10a){if(_0x11e876[_0x52a4('0x4c')]['id']){delete _0x11e876[_0x52a4('0x4c')]['id'];}return db[_0x52a4('0x30')][_0x52a4('0x4a')]({'where':{'id':_0x11e876[_0x52a4('0x4d')]['id']}})[_0x52a4('0x2a')](handleEntityNotFound(_0x3ec10a,null))['then'](saveUpdates(_0x11e876[_0x52a4('0x4c')],null))['then'](respondWithResult(_0x3ec10a,null))[_0x52a4('0x47')](handleError(_0x3ec10a,null));};exports[_0x52a4('0x4e')]=function(_0x511cdc,_0x851d92){return db['SquareReport'][_0x52a4('0x4a')]({'where':{'id':_0x511cdc[_0x52a4('0x4d')]['id']}})[_0x52a4('0x2a')](handleEntityNotFound(_0x851d92,null))[_0x52a4('0x2a')](removeEntity(_0x851d92,null))['catch'](handleError(_0x851d92,null));};exports[_0x52a4('0x4f')]=function(_0x2b527f,_0x3fcb22){return db['SquareReport'][_0x52a4('0x4f')]()[_0x52a4('0x2a')](respondWithResult(_0x3fcb22,null))[_0x52a4('0x47')](handleError(_0x3fcb22,null));}; \ No newline at end of file +var _0xff4b=['keys','length','include','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','update','then','destroy','error','name','send','index','map','SquareReport','fieldName','type','key','model','query','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','catch','show','params'];(function(_0x33cd58,_0x2e86a8){var _0x31277f=function(_0x5cd43e){while(--_0x5cd43e){_0x33cd58['push'](_0x33cd58['shift']());}};_0x31277f(++_0x2e86a8);}(_0xff4b,0x16f));var _0xbff4=function(_0x2d23bd,_0x2f9c7c){_0x2d23bd=_0x2d23bd-0x0;var _0x51cddf=_0xff4b[_0x2d23bd];return _0x51cddf;};'use strict';var emlformat=require(_0xbff4('0x0'));var rimraf=require(_0xbff4('0x1'));var zipdir=require(_0xbff4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbff4('0x3'));var moment=require(_0xbff4('0x4'));var BPromise=require(_0xbff4('0x5'));var Mustache=require(_0xbff4('0x6'));var util=require(_0xbff4('0x7'));var path=require(_0xbff4('0x8'));var sox=require(_0xbff4('0x9'));var csv=require(_0xbff4('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbff4('0xb'));var squel=require(_0xbff4('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbff4('0xd'));var toCsv=require(_0xbff4('0xa'));var querystring=require(_0xbff4('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xbff4('0xf'));var qs=require(_0xbff4('0x10'));var as=require(_0xbff4('0x11'));var hardwareService=require(_0xbff4('0x12'));var logger=require(_0xbff4('0x13'))(_0xbff4('0x14'));var utils=require(_0xbff4('0x15'));var config=require(_0xbff4('0x16'));var licenseUtil=require(_0xbff4('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17691e,_0x59fb6f){_0x59fb6f=_0x59fb6f||0xcc;return function(_0x40a0d8){if(_0x40a0d8){return _0x17691e[_0xbff4('0x18')](_0x59fb6f);}return _0x17691e[_0xbff4('0x19')](_0x59fb6f)[_0xbff4('0x1a')]();};}function respondWithResult(_0x1d67df,_0x2a3264){_0x2a3264=_0x2a3264||0xc8;return function(_0x429c3d){if(_0x429c3d){return _0x1d67df[_0xbff4('0x19')](_0x2a3264)[_0xbff4('0x1b')](_0x429c3d);}};}function respondWithFilteredResult(_0x154f24,_0x13a3d3){return function(_0x94c411){if(_0x94c411){var _0x5ce88a=typeof _0x13a3d3[_0xbff4('0x1c')]===_0xbff4('0x1d')&&typeof _0x13a3d3['limit']===_0xbff4('0x1d');var _0x29802b=_0x94c411[_0xbff4('0x1e')];var _0x56383b=_0x5ce88a?0x0:_0x13a3d3['offset'];var _0xb5932e=_0x5ce88a?_0x94c411['count']:_0x13a3d3[_0xbff4('0x1c')]+_0x13a3d3[_0xbff4('0x1f')];var _0x5a8c52;if(_0xb5932e>=_0x29802b){_0xb5932e=_0x29802b;_0x5a8c52=0xc8;}else{_0x5a8c52=0xce;}_0x154f24[_0xbff4('0x19')](_0x5a8c52);return _0x154f24['set'](_0xbff4('0x20'),_0x56383b+'-'+_0xb5932e+'/'+_0x29802b)[_0xbff4('0x1b')](_0x94c411);}return null;};}function patchUpdates(_0x4f793e){return function(_0x1ec5d4){try{jsonpatch['apply'](_0x1ec5d4,_0x4f793e,!![]);}catch(_0x1604bc){return BPromise['reject'](_0x1604bc);}return _0x1ec5d4['save']();};}function saveUpdates(_0x3a88af,_0x1f1df5){return function(_0x2413fd){if(_0x2413fd){return _0x2413fd[_0xbff4('0x21')](_0x3a88af)[_0xbff4('0x22')](function(_0x13ec03){return _0x13ec03;});}return null;};}function removeEntity(_0x397e0f,_0x3e645a){return function(_0x56894f){if(_0x56894f){return _0x56894f[_0xbff4('0x23')]()[_0xbff4('0x22')](function(){_0x397e0f[_0xbff4('0x19')](0xcc)[_0xbff4('0x1a')]();});}};}function handleEntityNotFound(_0x1f9c53,_0x38e99e){return function(_0xa3b2e0){if(!_0xa3b2e0){_0x1f9c53[_0xbff4('0x18')](0x194);}return _0xa3b2e0;};}function handleError(_0x5c435c,_0x5ec649){_0x5ec649=_0x5ec649||0x1f4;return function(_0x1bea82){logger[_0xbff4('0x24')](_0x1bea82['stack']);if(_0x1bea82[_0xbff4('0x25')]){delete _0x1bea82['name'];}_0x5c435c['status'](_0x5ec649)[_0xbff4('0x26')](_0x1bea82);};}exports[_0xbff4('0x27')]=function(_0x2fad6e,_0x4f773a){var _0x5bfcf2={},_0xcb1fef={},_0x4777f7={'count':0x0,'rows':[]};var _0x4b961b=_[_0xbff4('0x28')](db[_0xbff4('0x29')]['rawAttributes'],function(_0x23441c){return{'name':_0x23441c[_0xbff4('0x2a')],'type':_0x23441c[_0xbff4('0x2b')][_0xbff4('0x2c')]};});_0xcb1fef[_0xbff4('0x2d')]=_[_0xbff4('0x28')](_0x4b961b,'name');_0xcb1fef[_0xbff4('0x2e')]=_['keys'](_0x2fad6e[_0xbff4('0x2e')]);_0xcb1fef[_0xbff4('0x2f')]=_[_0xbff4('0x30')](_0xcb1fef[_0xbff4('0x2d')],_0xcb1fef[_0xbff4('0x2e')]);_0x5bfcf2['attributes']=_['intersection'](_0xcb1fef['model'],qs[_0xbff4('0x31')](_0x2fad6e[_0xbff4('0x2e')]['fields']));_0x5bfcf2[_0xbff4('0x32')]=_0x5bfcf2['attributes']['length']?_0x5bfcf2[_0xbff4('0x32')]:_0xcb1fef[_0xbff4('0x2d')];if(!_0x2fad6e['query']['hasOwnProperty'](_0xbff4('0x33'))){_0x5bfcf2[_0xbff4('0x1f')]=qs['limit'](_0x2fad6e[_0xbff4('0x2e')][_0xbff4('0x1f')]);_0x5bfcf2[_0xbff4('0x1c')]=qs[_0xbff4('0x1c')](_0x2fad6e['query']['offset']);}_0x5bfcf2[_0xbff4('0x34')]=qs[_0xbff4('0x35')](_0x2fad6e[_0xbff4('0x2e')]['sort']);_0x5bfcf2[_0xbff4('0x36')]=qs[_0xbff4('0x2f')](_[_0xbff4('0x37')](_0x2fad6e[_0xbff4('0x2e')],_0xcb1fef[_0xbff4('0x2f')]),_0x4b961b);if(_0x2fad6e[_0xbff4('0x2e')]['filter']){_0x5bfcf2[_0xbff4('0x36')]=_[_0xbff4('0x38')](_0x5bfcf2['where'],{'$or':_[_0xbff4('0x28')](_0x4b961b,function(_0x2322b3){if(_0x2322b3['type']!==_0xbff4('0x39')){var _0x2d2ce8={};_0x2d2ce8[_0x2322b3['name']]={'$like':'%'+_0x2fad6e[_0xbff4('0x2e')][_0xbff4('0x3a')]+'%'};return _0x2d2ce8;}})});}_0x5bfcf2=_[_0xbff4('0x38')]({},_0x5bfcf2,_0x2fad6e[_0xbff4('0x3b')]);var _0x405bc3={'where':_0x5bfcf2[_0xbff4('0x36')]};return db[_0xbff4('0x29')][_0xbff4('0x1e')](_0x405bc3)['then'](function(_0x287851){_0x4777f7['count']=_0x287851;if(_0x2fad6e[_0xbff4('0x2e')][_0xbff4('0x3c')]){_0x5bfcf2['include']=[{'all':!![]}];}return db[_0xbff4('0x29')][_0xbff4('0x3d')](_0x5bfcf2);})['then'](function(_0xf963fe){_0x4777f7['rows']=_0xf963fe;return _0x4777f7;})[_0xbff4('0x22')](respondWithFilteredResult(_0x4f773a,_0x5bfcf2))[_0xbff4('0x3e')](handleError(_0x4f773a,null));};exports[_0xbff4('0x3f')]=function(_0x6bc8a8,_0x55f495){var _0x3e3e31={'raw':!![],'where':{'id':_0x6bc8a8[_0xbff4('0x40')]['id']}},_0x3e926a={};_0x3e926a['model']=_[_0xbff4('0x41')](db['SquareReport']['rawAttributes']);_0x3e926a[_0xbff4('0x2e')]=_[_0xbff4('0x41')](_0x6bc8a8[_0xbff4('0x2e')]);_0x3e926a[_0xbff4('0x2f')]=_[_0xbff4('0x30')](_0x3e926a[_0xbff4('0x2d')],_0x3e926a[_0xbff4('0x2e')]);_0x3e3e31[_0xbff4('0x32')]=_[_0xbff4('0x30')](_0x3e926a['model'],qs[_0xbff4('0x31')](_0x6bc8a8[_0xbff4('0x2e')][_0xbff4('0x31')]));_0x3e3e31[_0xbff4('0x32')]=_0x3e3e31['attributes'][_0xbff4('0x42')]?_0x3e3e31[_0xbff4('0x32')]:_0x3e926a[_0xbff4('0x2d')];if(_0x6bc8a8[_0xbff4('0x2e')][_0xbff4('0x3c')]){_0x3e3e31[_0xbff4('0x43')]=[{'all':!![]}];}_0x3e3e31=_[_0xbff4('0x38')]({},_0x3e3e31,_0x6bc8a8[_0xbff4('0x3b')]);return db[_0xbff4('0x29')][_0xbff4('0x44')](_0x3e3e31)[_0xbff4('0x22')](handleEntityNotFound(_0x55f495,null))[_0xbff4('0x22')](respondWithResult(_0x55f495,null))['catch'](handleError(_0x55f495,null));};exports[_0xbff4('0x45')]=function(_0x53fb3e,_0x51f5cb){return db[_0xbff4('0x29')]['create'](_0x53fb3e[_0xbff4('0x46')],{})['then'](respondWithResult(_0x51f5cb,0xc9))[_0xbff4('0x3e')](handleError(_0x51f5cb,null));};exports[_0xbff4('0x21')]=function(_0x372dfe,_0x20bd51){if(_0x372dfe[_0xbff4('0x46')]['id']){delete _0x372dfe[_0xbff4('0x46')]['id'];}return db[_0xbff4('0x29')][_0xbff4('0x44')]({'where':{'id':_0x372dfe['params']['id']}})[_0xbff4('0x22')](handleEntityNotFound(_0x20bd51,null))['then'](saveUpdates(_0x372dfe[_0xbff4('0x46')],null))[_0xbff4('0x22')](respondWithResult(_0x20bd51,null))[_0xbff4('0x3e')](handleError(_0x20bd51,null));};exports[_0xbff4('0x23')]=function(_0x4765d9,_0xb84ca6){return db[_0xbff4('0x29')][_0xbff4('0x44')]({'where':{'id':_0x4765d9[_0xbff4('0x40')]['id']}})[_0xbff4('0x22')](handleEntityNotFound(_0xb84ca6,null))[_0xbff4('0x22')](removeEntity(_0xb84ca6,null))[_0xbff4('0x3e')](handleError(_0xb84ca6,null));};exports[_0xbff4('0x47')]=function(_0x3f52bb,_0x5e1f6f){return db[_0xbff4('0x29')][_0xbff4('0x47')]()[_0xbff4('0x22')](respondWithResult(_0x5e1f6f,null))[_0xbff4('0x3e')](handleError(_0x5e1f6f,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index fb2f18a..992315b 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 _0xa414=['../../config/environment','./squareReport.attributes','exports','define','report_square','uid_pname','uniqueid','leaveAt','lodash','util','api','bluebird','rimraf'];(function(_0x2e3955,_0x18c718){var _0x347490=function(_0x321129){while(--_0x321129){_0x2e3955['push'](_0x2e3955['shift']());}};_0x347490(++_0x18c718);}(_0xa414,0xff));var _0x4a41=function(_0x1036fe,_0x2389b0){_0x1036fe=_0x1036fe-0x0;var _0x2d2782=_0xa414[_0x1036fe];return _0x2d2782;};'use strict';var _=require(_0x4a41('0x0'));var util=require(_0x4a41('0x1'));var logger=require('../../config/logger')(_0x4a41('0x2'));var moment=require('moment');var BPromise=require(_0x4a41('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4a41('0x4'));var config=require(_0x4a41('0x5'));var attributes=require(_0x4a41('0x6'));module[_0x4a41('0x7')]=function(_0x144b2c,_0x380c01){return _0x144b2c[_0x4a41('0x8')]('SquareReport',attributes,{'tableName':_0x4a41('0x9'),'paranoid':![],'indexes':[{'name':_0x4a41('0xa'),'fields':[_0x4a41('0xb'),'project_name']},{'name':_0x4a41('0xc'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0x347c=['exports','define','SquareReport','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./squareReport.attributes'];(function(_0x26742c,_0xe241ee){var _0x4d9df4=function(_0x5bf307){while(--_0x5bf307){_0x26742c['push'](_0x26742c['shift']());}};_0x4d9df4(++_0xe241ee);}(_0x347c,0x1d8));var _0xc347=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x347c[_0x4792c8];return _0x35edb1;};'use strict';var _=require(_0xc347('0x0'));var util=require(_0xc347('0x1'));var logger=require(_0xc347('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc347('0x3'));var rp=require(_0xc347('0x4'));var fs=require('fs');var path=require(_0xc347('0x5'));var rimraf=require('rimraf');var config=require(_0xc347('0x6'));var attributes=require(_0xc347('0x7'));module[_0xc347('0x8')]=function(_0x5d7772,_0x2879f0){return _0x5d7772[_0xc347('0x9')](_0xc347('0xa'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0xc347('0xb'),'fields':[_0xc347('0xc'),_0xc347('0xd')]},{'name':_0xc347('0xe'),'fields':[_0xc347('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 8802504..8fafa6f 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 _0xb41b=['SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSquareReport','SquareReport','create','body','options','update','raw','attributes','UpdateSquareReport','lodash','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x310cfb,_0x10b5ac){var _0x33735a=function(_0x1e1ae4){while(--_0x1e1ae4){_0x310cfb['push'](_0x310cfb['shift']());}};_0x33735a(++_0x10b5ac);}(_0xb41b,0x1b6));var _0xbb41=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb41b[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xbb41('0x0'));var util=require(_0xbb41('0x1'));var moment=require(_0xbb41('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb41('0x3'))['db'];var utils=require(_0xbb41('0x4'));var logger=require('../../config/logger')(_0xbb41('0x5'));var config=require(_0xbb41('0x6'));var jayson=require(_0xbb41('0x7'));var client=jayson[_0xbb41('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x539213,_0x3605c8,_0x55c5e4){return new BPromise(function(_0x483b05,_0x4cd009){return client[_0xbb41('0x9')](_0x539213,_0x55c5e4)[_0xbb41('0xa')](function(_0x416590){logger[_0xbb41('0xb')](_0xbb41('0xc'),_0x3605c8,_0xbb41('0xd'));logger[_0xbb41('0xe')](_0xbb41('0xf'),_0x3605c8,'request\x20sent',JSON['stringify'](_0x416590));if(_0x416590['error']){if(_0x416590[_0xbb41('0x10')][_0xbb41('0x11')]===0x1f4){logger['error'](_0xbb41('0xc'),_0x3605c8,_0x416590['error'][_0xbb41('0x12')]);return _0x4cd009(_0x416590[_0xbb41('0x10')][_0xbb41('0x12')]);}logger[_0xbb41('0x10')](_0xbb41('0xc'),_0x3605c8,_0x416590[_0xbb41('0x10')][_0xbb41('0x12')]);return _0x483b05(_0x416590[_0xbb41('0x10')][_0xbb41('0x12')]);}else{logger[_0xbb41('0xb')](_0xbb41('0xc'),_0x3605c8,_0xbb41('0xd'));_0x483b05(_0x416590[_0xbb41('0x13')][_0xbb41('0x12')]);}})[_0xbb41('0x14')](function(_0x12da54){logger[_0xbb41('0x10')](_0xbb41('0xc'),_0x3605c8,_0x12da54);_0x4cd009(_0x12da54);});});}exports[_0xbb41('0x15')]=function(_0x303f73){var _0x5271b5=this;return new Promise(function(_0x161f54,_0x51df1f){return db[_0xbb41('0x16')][_0xbb41('0x17')](_0x303f73[_0xbb41('0x18')],{'raw':_0x303f73[_0xbb41('0x19')]?_0x303f73[_0xbb41('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xbb41('0xa')](function(_0x1b137c){logger['info'](_0xbb41('0x15'),_0x303f73);logger[_0xbb41('0xe')](_0xbb41('0x15'),_0x303f73,JSON['stringify'](_0x1b137c));_0x161f54(_0x1b137c);})[_0xbb41('0x14')](function(_0x538cc3){logger[_0xbb41('0x10')](_0xbb41('0x15'),_0x538cc3['message'],_0x303f73);_0x51df1f(_0x5271b5[_0xbb41('0x10')](0x1f4,_0x538cc3[_0xbb41('0x12')]));});});};exports['UpdateSquareReport']=function(_0x18eb86){var _0x51cded=this;return new Promise(function(_0x4d5f9f,_0x3e55f7){return db[_0xbb41('0x16')][_0xbb41('0x1a')](_0x18eb86[_0xbb41('0x18')],{'raw':_0x18eb86[_0xbb41('0x19')]?_0x18eb86['options'][_0xbb41('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18eb86[_0xbb41('0x19')]?_0x18eb86[_0xbb41('0x19')]['where']||null:null,'attributes':_0x18eb86[_0xbb41('0x19')]?_0x18eb86[_0xbb41('0x19')][_0xbb41('0x1c')]||null:null,'limit':_0x18eb86[_0xbb41('0x19')]?_0x18eb86['options']['limit']||null:null})[_0xbb41('0xa')](function(_0x2af1e2){logger[_0xbb41('0xb')](_0xbb41('0x1d'),_0x18eb86);logger[_0xbb41('0xe')]('UpdateSquareReport',_0x18eb86,JSON['stringify'](_0x2af1e2));_0x4d5f9f(_0x2af1e2);})[_0xbb41('0x14')](function(_0x32168e){logger[_0xbb41('0x10')]('UpdateSquareReport',_0x32168e[_0xbb41('0x12')],_0x18eb86);_0x3e55f7(_0x51cded[_0xbb41('0x10')](0x1f4,_0x32168e[_0xbb41('0x12')]));});});}; \ No newline at end of file +var _0x62e6=['create','options','raw','UpdateSquareReport','update','body','limit','stringify','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s','error','code','message','request\x20sent','result','CreateSquareReport','SquareReport'];(function(_0x1b2a0f,_0x587f19){var _0x21de7e=function(_0x273d88){while(--_0x273d88){_0x1b2a0f['push'](_0x1b2a0f['shift']());}};_0x21de7e(++_0x587f19);}(_0x62e6,0xae));var _0x662e=function(_0x35f7f5,_0x4e2ee1){_0x35f7f5=_0x35f7f5-0x0;var _0x5567a4=_0x62e6[_0x35f7f5];return _0x5567a4;};'use strict';var _=require(_0x662e('0x0'));var util=require(_0x662e('0x1'));var moment=require('moment');var BPromise=require(_0x662e('0x2'));var rs=require(_0x662e('0x3'));var fs=require('fs');var Redis=require(_0x662e('0x4'));var db=require(_0x662e('0x5'))['db'];var utils=require(_0x662e('0x6'));var logger=require(_0x662e('0x7'))(_0x662e('0x8'));var config=require(_0x662e('0x9'));var jayson=require(_0x662e('0xa'));var client=jayson[_0x662e('0xb')][_0x662e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5d49c3,_0x764fcc,_0x6f289a){return new BPromise(function(_0x26bd04,_0x458a81){return client[_0x662e('0xd')](_0x5d49c3,_0x6f289a)[_0x662e('0xe')](function(_0x44dc41){logger[_0x662e('0xf')](_0x662e('0x10'),_0x764fcc,'request\x20sent');logger['debug']('SquareReport,\x20%s,\x20%s,\x20%s',_0x764fcc,'request\x20sent',JSON['stringify'](_0x44dc41));if(_0x44dc41[_0x662e('0x11')]){if(_0x44dc41['error'][_0x662e('0x12')]===0x1f4){logger[_0x662e('0x11')](_0x662e('0x10'),_0x764fcc,_0x44dc41['error'][_0x662e('0x13')]);return _0x458a81(_0x44dc41['error'][_0x662e('0x13')]);}logger[_0x662e('0x11')](_0x662e('0x10'),_0x764fcc,_0x44dc41[_0x662e('0x11')][_0x662e('0x13')]);return _0x26bd04(_0x44dc41['error']['message']);}else{logger['info'](_0x662e('0x10'),_0x764fcc,_0x662e('0x14'));_0x26bd04(_0x44dc41[_0x662e('0x15')]['message']);}})['catch'](function(_0x112d75){logger['error'](_0x662e('0x10'),_0x764fcc,_0x112d75);_0x458a81(_0x112d75);});});}exports[_0x662e('0x16')]=function(_0x522f23){var _0x41aa7d=this;return new Promise(function(_0x598eeb,_0x33c28c){return db[_0x662e('0x17')][_0x662e('0x18')](_0x522f23['body'],{'raw':_0x522f23[_0x662e('0x19')]?_0x522f23['options'][_0x662e('0x1a')]===undefined?!![]:![]:!![]})[_0x662e('0xe')](function(_0x4d4b18){logger[_0x662e('0xf')](_0x662e('0x16'),_0x522f23);logger['debug']('CreateSquareReport',_0x522f23,JSON['stringify'](_0x4d4b18));_0x598eeb(_0x4d4b18);})['catch'](function(_0x495be7){logger[_0x662e('0x11')](_0x662e('0x16'),_0x495be7['message'],_0x522f23);_0x33c28c(_0x41aa7d['error'](0x1f4,_0x495be7[_0x662e('0x13')]));});});};exports[_0x662e('0x1b')]=function(_0x33ecf8){var _0x370180=this;return new Promise(function(_0x2ae730,_0x54bac6){return db[_0x662e('0x17')][_0x662e('0x1c')](_0x33ecf8[_0x662e('0x1d')],{'raw':_0x33ecf8['options']?_0x33ecf8[_0x662e('0x19')][_0x662e('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33ecf8[_0x662e('0x19')]?_0x33ecf8[_0x662e('0x19')]['where']||null:null,'attributes':_0x33ecf8[_0x662e('0x19')]?_0x33ecf8['options']['attributes']||null:null,'limit':_0x33ecf8[_0x662e('0x19')]?_0x33ecf8['options'][_0x662e('0x1e')]||null:null})[_0x662e('0xe')](function(_0x54b002){logger[_0x662e('0xf')](_0x662e('0x1b'),_0x33ecf8);logger['debug'](_0x662e('0x1b'),_0x33ecf8,JSON[_0x662e('0x1f')](_0x54b002));_0x2ae730(_0x54b002);})[_0x662e('0x20')](function(_0x459f52){logger[_0x662e('0x11')](_0x662e('0x1b'),_0x459f52[_0x662e('0x13')],_0x33ecf8);_0x54bac6(_0x370180[_0x662e('0x11')](0x1f4,_0x459f52[_0x662e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 4387c2c..97fe553 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 _0x97c0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','/describe','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x9894ff,_0x9256ba){var _0x462988=function(_0x38f4ad){while(--_0x38f4ad){_0x9894ff['push'](_0x9894ff['shift']());}};_0x462988(++_0x9256ba);}(_0x97c0,0x172));var _0x097c=function(_0x4ba321,_0x106ec1){_0x4ba321=_0x4ba321-0x0;var _0x15c93b=_0x97c0[_0x4ba321];return _0x15c93b;};'use strict';var multer=require('multer');var util=require(_0x097c('0x0'));var path=require(_0x097c('0x1'));var timeout=require(_0x097c('0x2'));var express=require(_0x097c('0x3'));var router=express[_0x097c('0x4')]();var fs_extra=require(_0x097c('0x5'));var auth=require(_0x097c('0x6'));var interaction=require(_0x097c('0x7'));var config=require(_0x097c('0x8'));var controller=require(_0x097c('0x9'));router[_0x097c('0xa')]('/',auth[_0x097c('0xb')](),controller['index']);router['get'](_0x097c('0xc'),auth[_0x097c('0xb')](),controller['describe']);router[_0x097c('0xa')](_0x097c('0xd'),auth[_0x097c('0xb')](),controller[_0x097c('0xe')]);router[_0x097c('0xf')]('/',auth['isAuthenticated'](),controller[_0x097c('0x10')]);router[_0x097c('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x097c('0x12')]);router[_0x097c('0x13')](_0x097c('0xd'),auth[_0x097c('0xb')](),controller[_0x097c('0x14')]);module[_0x097c('0x15')]=router; \ No newline at end of file +var _0x1d97=['describe','/:id','show','post','create','update','delete','destroy','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe'];(function(_0x2e53e1,_0x12aed1){var _0x3a23de=function(_0xd84699){while(--_0xd84699){_0x2e53e1['push'](_0x2e53e1['shift']());}};_0x3a23de(++_0x12aed1);}(_0x1d97,0xa0));var _0x71d9=function(_0xf21e4,_0x5089af){_0xf21e4=_0xf21e4-0x0;var _0x48e49a=_0x1d97[_0xf21e4];return _0x48e49a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x71d9('0x0'));var timeout=require(_0x71d9('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x71d9('0x2'));var auth=require(_0x71d9('0x3'));var interaction=require(_0x71d9('0x4'));var config=require(_0x71d9('0x5'));var controller=require(_0x71d9('0x6'));router[_0x71d9('0x7')]('/',auth[_0x71d9('0x8')](),controller[_0x71d9('0x9')]);router[_0x71d9('0x7')](_0x71d9('0xa'),auth[_0x71d9('0x8')](),controller[_0x71d9('0xb')]);router['get'](_0x71d9('0xc'),auth['isAuthenticated'](),controller[_0x71d9('0xd')]);router[_0x71d9('0xe')]('/',auth[_0x71d9('0x8')](),controller[_0x71d9('0xf')]);router['put']('/:id',auth[_0x71d9('0x8')](),controller[_0x71d9('0x10')]);router[_0x71d9('0x11')]('/:id',auth[_0x71d9('0x8')](),controller[_0x71d9('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 5e350a6..1446a40 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 _0x8130=['sequelize','STRING','TEXT'];(function(_0x38cd13,_0x40822e){var _0x469ab7=function(_0x3ee90c){while(--_0x3ee90c){_0x38cd13['push'](_0x38cd13['shift']());}};_0x469ab7(++_0x40822e);}(_0x8130,0x1d4));var _0x0813=function(_0x48b10c,_0x152ea){_0x48b10c=_0x48b10c-0x0;var _0x4eb069=_0x8130[_0x48b10c];return _0x4eb069;};'use strict';var Sequelize=require(_0x0813('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x0813('0x1')]},'data':{'type':Sequelize[_0x0813('0x2')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x0813('0x1')]}}; \ No newline at end of file +var _0x9a20=['STRING','TEXT','sequelize','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9a20,0x1da));var _0x09a2=function(_0x5e56d2,_0x69a9d9){_0x5e56d2=_0x5e56d2-0x0;var _0x382751=_0x9a20[_0x5e56d2];return _0x382751;};'use strict';var Sequelize=require(_0x09a2('0x0'));module[_0x09a2('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x09a2('0x2')]},'application':{'type':Sequelize[_0x09a2('0x2')]},'data':{'type':Sequelize[_0x09a2('0x3')]},'project_name':{'type':Sequelize[_0x09a2('0x2')]},'callerid':{'type':Sequelize[_0x09a2('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 7138248..13283c2 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 _0x4046=['status','end','json','undefined','count','offset','set','apply','reject','save','update','destroy','then','stack','name','send','index','map','SquareDetailsReport','fieldName','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','catch','params','keys','rawAttributes','length','includeAll','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x4046,0x7b));var _0x6404=function(_0x364d75,_0x4721f0){_0x364d75=_0x364d75-0x0;var _0x198ad7=_0x4046[_0x364d75];return _0x198ad7;};'use strict';var emlformat=require(_0x6404('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6404('0x1'));var jsonpatch=require(_0x6404('0x2'));var rp=require(_0x6404('0x3'));var moment=require(_0x6404('0x4'));var BPromise=require(_0x6404('0x5'));var Mustache=require(_0x6404('0x6'));var util=require(_0x6404('0x7'));var path=require('path');var sox=require(_0x6404('0x8'));var csv=require(_0x6404('0x9'));var ejs=require(_0x6404('0xa'));var fs=require('fs');var fs_extra=require(_0x6404('0xb'));var _=require(_0x6404('0xc'));var squel=require('squel');var crypto=require(_0x6404('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6404('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6404('0xf'));var Papa=require(_0x6404('0x10'));var Redis=require(_0x6404('0x11'));var authService=require(_0x6404('0x12'));var qs=require(_0x6404('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6404('0x14'));var logger=require('../../config/logger')(_0x6404('0x15'));var utils=require(_0x6404('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6404('0x17'))['db'];function respondWithStatusCode(_0xf1347c,_0x230917){_0x230917=_0x230917||0xcc;return function(_0x5870a8){if(_0x5870a8){return _0xf1347c[_0x6404('0x18')](_0x230917);}return _0xf1347c[_0x6404('0x19')](_0x230917)[_0x6404('0x1a')]();};}function respondWithResult(_0x516bdd,_0x4e9951){_0x4e9951=_0x4e9951||0xc8;return function(_0x10f4aa){if(_0x10f4aa){return _0x516bdd[_0x6404('0x19')](_0x4e9951)[_0x6404('0x1b')](_0x10f4aa);}};}function respondWithFilteredResult(_0x3df5f6,_0x14ecb2){return function(_0x552355){if(_0x552355){var _0x27b8ba=typeof _0x14ecb2['offset']===_0x6404('0x1c')&&typeof _0x14ecb2['limit']===_0x6404('0x1c');var _0x2d9523=_0x552355[_0x6404('0x1d')];var _0x553e93=_0x27b8ba?0x0:_0x14ecb2[_0x6404('0x1e')];var _0x217bd3=_0x27b8ba?_0x552355[_0x6404('0x1d')]:_0x14ecb2[_0x6404('0x1e')]+_0x14ecb2['limit'];var _0x3eff58;if(_0x217bd3>=_0x2d9523){_0x217bd3=_0x2d9523;_0x3eff58=0xc8;}else{_0x3eff58=0xce;}_0x3df5f6['status'](_0x3eff58);return _0x3df5f6[_0x6404('0x1f')]('Content-Range',_0x553e93+'-'+_0x217bd3+'/'+_0x2d9523)[_0x6404('0x1b')](_0x552355);}return null;};}function patchUpdates(_0x71ac46){return function(_0x2c6ec0){try{jsonpatch[_0x6404('0x20')](_0x2c6ec0,_0x71ac46,!![]);}catch(_0x543314){return BPromise[_0x6404('0x21')](_0x543314);}return _0x2c6ec0[_0x6404('0x22')]();};}function saveUpdates(_0x4850e6,_0x387135){return function(_0x50e437){if(_0x50e437){return _0x50e437[_0x6404('0x23')](_0x4850e6)['then'](function(_0x47d0e9){return _0x47d0e9;});}return null;};}function removeEntity(_0x509e44,_0x424a47){return function(_0x5e88c6){if(_0x5e88c6){return _0x5e88c6[_0x6404('0x24')]()[_0x6404('0x25')](function(){_0x509e44[_0x6404('0x19')](0xcc)[_0x6404('0x1a')]();});}};}function handleEntityNotFound(_0xbab10,_0x594c4){return function(_0x40b639){if(!_0x40b639){_0xbab10['sendStatus'](0x194);}return _0x40b639;};}function handleError(_0x584c67,_0x2417c3){_0x2417c3=_0x2417c3||0x1f4;return function(_0x17d8d6){logger['error'](_0x17d8d6[_0x6404('0x26')]);if(_0x17d8d6[_0x6404('0x27')]){delete _0x17d8d6[_0x6404('0x27')];}_0x584c67[_0x6404('0x19')](_0x2417c3)[_0x6404('0x28')](_0x17d8d6);};}exports[_0x6404('0x29')]=function(_0x1b778e,_0x215723){var _0x49e332={},_0x5305dd={},_0x5a0d09={'count':0x0,'rows':[]};var _0x50190a=_[_0x6404('0x2a')](db[_0x6404('0x2b')]['rawAttributes'],function(_0x1d9e9a){return{'name':_0x1d9e9a[_0x6404('0x2c')],'type':_0x1d9e9a['type'][_0x6404('0x2d')]};});_0x5305dd[_0x6404('0x2e')]=_[_0x6404('0x2a')](_0x50190a,'name');_0x5305dd[_0x6404('0x2f')]=_['keys'](_0x1b778e[_0x6404('0x2f')]);_0x5305dd['filters']=_[_0x6404('0x30')](_0x5305dd['model'],_0x5305dd[_0x6404('0x2f')]);_0x49e332[_0x6404('0x31')]=_['intersection'](_0x5305dd[_0x6404('0x2e')],qs[_0x6404('0x32')](_0x1b778e[_0x6404('0x2f')]['fields']));_0x49e332['attributes']=_0x49e332['attributes']['length']?_0x49e332[_0x6404('0x31')]:_0x5305dd[_0x6404('0x2e')];if(!_0x1b778e[_0x6404('0x2f')][_0x6404('0x33')](_0x6404('0x34'))){_0x49e332[_0x6404('0x35')]=qs['limit'](_0x1b778e[_0x6404('0x2f')][_0x6404('0x35')]);_0x49e332[_0x6404('0x1e')]=qs['offset'](_0x1b778e[_0x6404('0x2f')]['offset']);}_0x49e332[_0x6404('0x36')]=qs[_0x6404('0x37')](_0x1b778e['query'][_0x6404('0x37')]);_0x49e332[_0x6404('0x38')]=qs[_0x6404('0x39')](_['pick'](_0x1b778e[_0x6404('0x2f')],_0x5305dd[_0x6404('0x39')]),_0x50190a);if(_0x1b778e[_0x6404('0x2f')][_0x6404('0x3a')]){_0x49e332['where']=_[_0x6404('0x3b')](_0x49e332[_0x6404('0x38')],{'$or':_['map'](_0x50190a,function(_0x3ce621){if(_0x3ce621['type']!==_0x6404('0x3c')){var _0x214042={};_0x214042[_0x3ce621['name']]={'$like':'%'+_0x1b778e[_0x6404('0x2f')]['filter']+'%'};return _0x214042;}})});}_0x49e332=_[_0x6404('0x3b')]({},_0x49e332,_0x1b778e[_0x6404('0x3d')]);var _0x348100={'where':_0x49e332[_0x6404('0x38')]};return db[_0x6404('0x2b')][_0x6404('0x1d')](_0x348100)['then'](function(_0x1de3c2){_0x5a0d09[_0x6404('0x1d')]=_0x1de3c2;if(_0x1b778e[_0x6404('0x2f')]['includeAll']){_0x49e332[_0x6404('0x3e')]=[{'all':!![]}];}return db[_0x6404('0x2b')][_0x6404('0x3f')](_0x49e332);})[_0x6404('0x25')](function(_0x1f965e){_0x5a0d09['rows']=_0x1f965e;return _0x5a0d09;})[_0x6404('0x25')](respondWithFilteredResult(_0x215723,_0x49e332))[_0x6404('0x40')](handleError(_0x215723,null));};exports['show']=function(_0x2fa62b,_0x35cea0){var _0x4f0a6e={'raw':!![],'where':{'id':_0x2fa62b[_0x6404('0x41')]['id']}},_0x9a2354={};_0x9a2354['model']=_[_0x6404('0x42')](db['SquareDetailsReport'][_0x6404('0x43')]);_0x9a2354[_0x6404('0x2f')]=_[_0x6404('0x42')](_0x2fa62b['query']);_0x9a2354[_0x6404('0x39')]=_[_0x6404('0x30')](_0x9a2354['model'],_0x9a2354[_0x6404('0x2f')]);_0x4f0a6e[_0x6404('0x31')]=_[_0x6404('0x30')](_0x9a2354[_0x6404('0x2e')],qs['fields'](_0x2fa62b[_0x6404('0x2f')]['fields']));_0x4f0a6e['attributes']=_0x4f0a6e[_0x6404('0x31')][_0x6404('0x44')]?_0x4f0a6e[_0x6404('0x31')]:_0x9a2354['model'];if(_0x2fa62b[_0x6404('0x2f')][_0x6404('0x45')]){_0x4f0a6e['include']=[{'all':!![]}];}_0x4f0a6e=_[_0x6404('0x3b')]({},_0x4f0a6e,_0x2fa62b['options']);return db[_0x6404('0x2b')][_0x6404('0x46')](_0x4f0a6e)['then'](handleEntityNotFound(_0x35cea0,null))['then'](respondWithResult(_0x35cea0,null))[_0x6404('0x40')](handleError(_0x35cea0,null));};exports['create']=function(_0x52c919,_0x3d110b){return db[_0x6404('0x2b')][_0x6404('0x47')](_0x52c919['body'],{})[_0x6404('0x25')](respondWithResult(_0x3d110b,0xc9))['catch'](handleError(_0x3d110b,null));};exports['update']=function(_0x5630a5,_0x54ae2a){if(_0x5630a5[_0x6404('0x48')]['id']){delete _0x5630a5[_0x6404('0x48')]['id'];}return db[_0x6404('0x2b')][_0x6404('0x46')]({'where':{'id':_0x5630a5[_0x6404('0x41')]['id']}})['then'](handleEntityNotFound(_0x54ae2a,null))[_0x6404('0x25')](saveUpdates(_0x5630a5[_0x6404('0x48')],null))[_0x6404('0x25')](respondWithResult(_0x54ae2a,null))[_0x6404('0x40')](handleError(_0x54ae2a,null));};exports[_0x6404('0x24')]=function(_0x1b991d,_0x3876a4){return db[_0x6404('0x2b')][_0x6404('0x46')]({'where':{'id':_0x1b991d[_0x6404('0x41')]['id']}})['then'](handleEntityNotFound(_0x3876a4,null))[_0x6404('0x25')](removeEntity(_0x3876a4,null))[_0x6404('0x40')](handleError(_0x3876a4,null));};exports['describe']=function(_0x28045d,_0x2072ce){return db[_0x6404('0x2b')][_0x6404('0x49')]()[_0x6404('0x25')](respondWithResult(_0x2072ce,null))['catch'](handleError(_0x2072ce,null));}; \ No newline at end of file +var _0xf5de=['describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','offset','undefined','count','limit','set','json','apply','reject','update','then','destroy','error','stack','name','send','index','map','SquareDetailsReport','type','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','merge','filter','options','includeAll','catch','show','params','rawAttributes','keys','find','create','body'];(function(_0x2778f5,_0x166ae0){var _0x49745d=function(_0x2d156a){while(--_0x2d156a){_0x2778f5['push'](_0x2778f5['shift']());}};_0x49745d(++_0x166ae0);}(_0xf5de,0x1e4));var _0xef5d=function(_0x480c72,_0x4d059b){_0x480c72=_0x480c72-0x0;var _0xd48af2=_0xf5de[_0x480c72];return _0xd48af2;};'use strict';var emlformat=require(_0xef5d('0x0'));var rimraf=require(_0xef5d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xef5d('0x2'));var rp=require(_0xef5d('0x3'));var moment=require(_0xef5d('0x4'));var BPromise=require(_0xef5d('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xef5d('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xef5d('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xef5d('0x8'));var squel=require(_0xef5d('0x9'));var crypto=require(_0xef5d('0xa'));var jsforce=require(_0xef5d('0xb'));var deskjs=require(_0xef5d('0xc'));var toCsv=require('to-csv');var querystring=require(_0xef5d('0xd'));var Papa=require(_0xef5d('0xe'));var Redis=require(_0xef5d('0xf'));var authService=require(_0xef5d('0x10'));var qs=require(_0xef5d('0x11'));var as=require(_0xef5d('0x12'));var hardwareService=require(_0xef5d('0x13'));var logger=require(_0xef5d('0x14'))(_0xef5d('0x15'));var utils=require('../../config/utils');var config=require(_0xef5d('0x16'));var licenseUtil=require(_0xef5d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xfe8c73,_0x1ac8fb){_0x1ac8fb=_0x1ac8fb||0xcc;return function(_0x287950){if(_0x287950){return _0xfe8c73['sendStatus'](_0x1ac8fb);}return _0xfe8c73[_0xef5d('0x18')](_0x1ac8fb)[_0xef5d('0x19')]();};}function respondWithResult(_0x4ca124,_0x2f53ce){_0x2f53ce=_0x2f53ce||0xc8;return function(_0x3560c3){if(_0x3560c3){return _0x4ca124[_0xef5d('0x18')](_0x2f53ce)['json'](_0x3560c3);}};}function respondWithFilteredResult(_0x512ee3,_0x10c488){return function(_0x41a8c9){if(_0x41a8c9){var _0x1e2003=typeof _0x10c488[_0xef5d('0x1a')]===_0xef5d('0x1b')&&typeof _0x10c488['limit']===_0xef5d('0x1b');var _0x29d6e5=_0x41a8c9[_0xef5d('0x1c')];var _0x38a010=_0x1e2003?0x0:_0x10c488[_0xef5d('0x1a')];var _0x6355a0=_0x1e2003?_0x41a8c9['count']:_0x10c488[_0xef5d('0x1a')]+_0x10c488[_0xef5d('0x1d')];var _0x2dbc26;if(_0x6355a0>=_0x29d6e5){_0x6355a0=_0x29d6e5;_0x2dbc26=0xc8;}else{_0x2dbc26=0xce;}_0x512ee3[_0xef5d('0x18')](_0x2dbc26);return _0x512ee3[_0xef5d('0x1e')]('Content-Range',_0x38a010+'-'+_0x6355a0+'/'+_0x29d6e5)[_0xef5d('0x1f')](_0x41a8c9);}return null;};}function patchUpdates(_0x8013fc){return function(_0x474421){try{jsonpatch[_0xef5d('0x20')](_0x474421,_0x8013fc,!![]);}catch(_0xeca986){return BPromise[_0xef5d('0x21')](_0xeca986);}return _0x474421['save']();};}function saveUpdates(_0x52915a,_0x1bbd41){return function(_0x49c56f){if(_0x49c56f){return _0x49c56f[_0xef5d('0x22')](_0x52915a)[_0xef5d('0x23')](function(_0x438119){return _0x438119;});}return null;};}function removeEntity(_0x5eb1e6,_0x30f432){return function(_0x1184b2){if(_0x1184b2){return _0x1184b2[_0xef5d('0x24')]()[_0xef5d('0x23')](function(){_0x5eb1e6[_0xef5d('0x18')](0xcc)[_0xef5d('0x19')]();});}};}function handleEntityNotFound(_0x2ec96d,_0x400f9c){return function(_0x486dc6){if(!_0x486dc6){_0x2ec96d['sendStatus'](0x194);}return _0x486dc6;};}function handleError(_0x1626be,_0x25a252){_0x25a252=_0x25a252||0x1f4;return function(_0x1f9ecf){logger[_0xef5d('0x25')](_0x1f9ecf[_0xef5d('0x26')]);if(_0x1f9ecf[_0xef5d('0x27')]){delete _0x1f9ecf[_0xef5d('0x27')];}_0x1626be[_0xef5d('0x18')](_0x25a252)[_0xef5d('0x28')](_0x1f9ecf);};}exports[_0xef5d('0x29')]=function(_0x4377ed,_0x673080){var _0x510dda={},_0x104598={},_0x5337e9={'count':0x0,'rows':[]};var _0x13d38d=_[_0xef5d('0x2a')](db[_0xef5d('0x2b')]['rawAttributes'],function(_0x2c98f6){return{'name':_0x2c98f6['fieldName'],'type':_0x2c98f6[_0xef5d('0x2c')]['key']};});_0x104598[_0xef5d('0x2d')]=_[_0xef5d('0x2a')](_0x13d38d,_0xef5d('0x27'));_0x104598[_0xef5d('0x2e')]=_['keys'](_0x4377ed[_0xef5d('0x2e')]);_0x104598['filters']=_[_0xef5d('0x2f')](_0x104598[_0xef5d('0x2d')],_0x104598['query']);_0x510dda['attributes']=_[_0xef5d('0x2f')](_0x104598[_0xef5d('0x2d')],qs[_0xef5d('0x30')](_0x4377ed[_0xef5d('0x2e')][_0xef5d('0x30')]));_0x510dda[_0xef5d('0x31')]=_0x510dda[_0xef5d('0x31')][_0xef5d('0x32')]?_0x510dda[_0xef5d('0x31')]:_0x104598[_0xef5d('0x2d')];if(!_0x4377ed[_0xef5d('0x2e')][_0xef5d('0x33')](_0xef5d('0x34'))){_0x510dda[_0xef5d('0x1d')]=qs['limit'](_0x4377ed[_0xef5d('0x2e')]['limit']);_0x510dda[_0xef5d('0x1a')]=qs[_0xef5d('0x1a')](_0x4377ed[_0xef5d('0x2e')][_0xef5d('0x1a')]);}_0x510dda['order']=qs[_0xef5d('0x35')](_0x4377ed['query'][_0xef5d('0x35')]);_0x510dda[_0xef5d('0x36')]=qs[_0xef5d('0x37')](_['pick'](_0x4377ed[_0xef5d('0x2e')],_0x104598[_0xef5d('0x37')]),_0x13d38d);if(_0x4377ed[_0xef5d('0x2e')]['filter']){_0x510dda[_0xef5d('0x36')]=_[_0xef5d('0x38')](_0x510dda[_0xef5d('0x36')],{'$or':_[_0xef5d('0x2a')](_0x13d38d,function(_0x33f082){if(_0x33f082[_0xef5d('0x2c')]!=='VIRTUAL'){var _0x5115c0={};_0x5115c0[_0x33f082[_0xef5d('0x27')]]={'$like':'%'+_0x4377ed[_0xef5d('0x2e')][_0xef5d('0x39')]+'%'};return _0x5115c0;}})});}_0x510dda=_[_0xef5d('0x38')]({},_0x510dda,_0x4377ed[_0xef5d('0x3a')]);var _0x52224b={'where':_0x510dda['where']};return db['SquareDetailsReport'][_0xef5d('0x1c')](_0x52224b)[_0xef5d('0x23')](function(_0x381836){_0x5337e9[_0xef5d('0x1c')]=_0x381836;if(_0x4377ed[_0xef5d('0x2e')][_0xef5d('0x3b')]){_0x510dda['include']=[{'all':!![]}];}return db[_0xef5d('0x2b')]['findAll'](_0x510dda);})[_0xef5d('0x23')](function(_0xaea6df){_0x5337e9['rows']=_0xaea6df;return _0x5337e9;})[_0xef5d('0x23')](respondWithFilteredResult(_0x673080,_0x510dda))[_0xef5d('0x3c')](handleError(_0x673080,null));};exports[_0xef5d('0x3d')]=function(_0x3af83a,_0x547e45){var _0xde3dce={'raw':!![],'where':{'id':_0x3af83a[_0xef5d('0x3e')]['id']}},_0x5e5c4e={};_0x5e5c4e[_0xef5d('0x2d')]=_['keys'](db[_0xef5d('0x2b')][_0xef5d('0x3f')]);_0x5e5c4e[_0xef5d('0x2e')]=_[_0xef5d('0x40')](_0x3af83a[_0xef5d('0x2e')]);_0x5e5c4e[_0xef5d('0x37')]=_[_0xef5d('0x2f')](_0x5e5c4e[_0xef5d('0x2d')],_0x5e5c4e[_0xef5d('0x2e')]);_0xde3dce[_0xef5d('0x31')]=_[_0xef5d('0x2f')](_0x5e5c4e[_0xef5d('0x2d')],qs[_0xef5d('0x30')](_0x3af83a['query'][_0xef5d('0x30')]));_0xde3dce[_0xef5d('0x31')]=_0xde3dce['attributes'][_0xef5d('0x32')]?_0xde3dce[_0xef5d('0x31')]:_0x5e5c4e[_0xef5d('0x2d')];if(_0x3af83a[_0xef5d('0x2e')][_0xef5d('0x3b')]){_0xde3dce['include']=[{'all':!![]}];}_0xde3dce=_[_0xef5d('0x38')]({},_0xde3dce,_0x3af83a['options']);return db[_0xef5d('0x2b')][_0xef5d('0x41')](_0xde3dce)[_0xef5d('0x23')](handleEntityNotFound(_0x547e45,null))[_0xef5d('0x23')](respondWithResult(_0x547e45,null))[_0xef5d('0x3c')](handleError(_0x547e45,null));};exports['create']=function(_0x24dea1,_0x40b322){return db[_0xef5d('0x2b')][_0xef5d('0x42')](_0x24dea1[_0xef5d('0x43')],{})[_0xef5d('0x23')](respondWithResult(_0x40b322,0xc9))[_0xef5d('0x3c')](handleError(_0x40b322,null));};exports[_0xef5d('0x22')]=function(_0x47472b,_0x452878){if(_0x47472b[_0xef5d('0x43')]['id']){delete _0x47472b[_0xef5d('0x43')]['id'];}return db[_0xef5d('0x2b')][_0xef5d('0x41')]({'where':{'id':_0x47472b['params']['id']}})[_0xef5d('0x23')](handleEntityNotFound(_0x452878,null))[_0xef5d('0x23')](saveUpdates(_0x47472b['body'],null))[_0xef5d('0x23')](respondWithResult(_0x452878,null))[_0xef5d('0x3c')](handleError(_0x452878,null));};exports[_0xef5d('0x24')]=function(_0x1fd2ae,_0x3a1248){return db[_0xef5d('0x2b')][_0xef5d('0x41')]({'where':{'id':_0x1fd2ae[_0xef5d('0x3e')]['id']}})[_0xef5d('0x23')](handleEntityNotFound(_0x3a1248,null))['then'](removeEntity(_0x3a1248,null))[_0xef5d('0x3c')](handleError(_0x3a1248,null));};exports[_0xef5d('0x44')]=function(_0x3e5d93,_0x390c49){return db['SquareDetailsReport'][_0xef5d('0x44')]()['then'](respondWithResult(_0x390c49,null))[_0xef5d('0x3c')](handleError(_0x390c49,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 86e84bf..154c4ef 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 _0xb09f=['api','moment','bluebird','path','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','../../config/logger'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0xb09f,0xa6));var _0xfb09=function(_0x823cf0,_0x5495d7){_0x823cf0=_0x823cf0-0x0;var _0x370bb4=_0xb09f[_0x823cf0];return _0x370bb4;};'use strict';var _=require(_0xfb09('0x0'));var util=require('util');var logger=require(_0xfb09('0x1'))(_0xfb09('0x2'));var moment=require(_0xfb09('0x3'));var BPromise=require(_0xfb09('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfb09('0x5'));var rimraf=require('rimraf');var config=require(_0xfb09('0x6'));var attributes=require(_0xfb09('0x7'));module[_0xfb09('0x8')]=function(_0x583927,_0x1fb446){return _0x583927[_0xfb09('0x9')](_0xfb09('0xa'),attributes,{'tableName':_0xfb09('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xff95=['exports','define','report_square_details','lodash','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x18b7b2,_0x5bfa38){var _0x4636bd=function(_0x2f7773){while(--_0x2f7773){_0x18b7b2['push'](_0x18b7b2['shift']());}};_0x4636bd(++_0x5bfa38);}(_0xff95,0xcb));var _0x5ff9=function(_0x4281a6,_0x522ffa){_0x4281a6=_0x4281a6-0x0;var _0x14d43f=_0xff95[_0x4281a6];return _0x14d43f;};'use strict';var _=require(_0x5ff9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5ff9('0x1'));var moment=require(_0x5ff9('0x2'));var BPromise=require('bluebird');var rp=require(_0x5ff9('0x3'));var fs=require('fs');var path=require(_0x5ff9('0x4'));var rimraf=require(_0x5ff9('0x5'));var config=require(_0x5ff9('0x6'));var attributes=require('./squareReportDetail.attributes');module[_0x5ff9('0x7')]=function(_0x2d4f87,_0x3a423b){return _0x2d4f87[_0x5ff9('0x8')]('SquareDetailsReport',attributes,{'tableName':_0x5ff9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 43a3ffe..a1de823 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 _0xe2cf=['info','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x1bab70,_0x399ccf){_0x1bab70=_0x1bab70-0x0;var _0x44a639=_0xe2cf[_0x1bab70];return _0x44a639;};'use strict';var _=require('lodash');var util=require(_0xfe2c('0x0'));var moment=require('moment');var BPromise=require(_0xfe2c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfe2c('0x2'));var db=require(_0xfe2c('0x3'))['db'];var utils=require(_0xfe2c('0x4'));var logger=require(_0xfe2c('0x5'))('rpc');var config=require(_0xfe2c('0x6'));var jayson=require(_0xfe2c('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4e0b97,_0x417bc4,_0x5e5b46){return new BPromise(function(_0x485a24,_0x30aafe){return client[_0xfe2c('0x8')](_0x4e0b97,_0x5e5b46)[_0xfe2c('0x9')](function(_0x562414){logger['info'](_0xfe2c('0xa'),_0x417bc4,_0xfe2c('0xb'));logger['debug'](_0xfe2c('0xc'),_0x417bc4,_0xfe2c('0xb'),JSON[_0xfe2c('0xd')](_0x562414));if(_0x562414[_0xfe2c('0xe')]){if(_0x562414[_0xfe2c('0xe')][_0xfe2c('0xf')]===0x1f4){logger[_0xfe2c('0xe')]('SquareDetailsReport,\x20%s,\x20%s',_0x417bc4,_0x562414['error']['message']);return _0x30aafe(_0x562414['error'][_0xfe2c('0x10')]);}logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x417bc4,_0x562414[_0xfe2c('0xe')][_0xfe2c('0x10')]);return _0x485a24(_0x562414[_0xfe2c('0xe')][_0xfe2c('0x10')]);}else{logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x417bc4,_0xfe2c('0xb'));_0x485a24(_0x562414[_0xfe2c('0x11')][_0xfe2c('0x10')]);}})[_0xfe2c('0x12')](function(_0x565f40){logger[_0xfe2c('0xe')](_0xfe2c('0xa'),_0x417bc4,_0x565f40);_0x30aafe(_0x565f40);});});}exports[_0xfe2c('0x13')]=function(_0x23242b){var _0x36aeec=this;return new Promise(function(_0x13f233,_0x4afea3){return db[_0xfe2c('0x14')][_0xfe2c('0x15')](_0x23242b[_0xfe2c('0x16')],{'raw':_0x23242b[_0xfe2c('0x17')]?_0x23242b['options'][_0xfe2c('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x4e9137){logger[_0xfe2c('0x19')](_0xfe2c('0x13'),_0x23242b);logger['debug'](_0xfe2c('0x13'),_0x23242b,JSON[_0xfe2c('0xd')](_0x4e9137));_0x13f233(_0x4e9137);})['catch'](function(_0x1bd50e){logger['error'](_0xfe2c('0x13'),_0x1bd50e[_0xfe2c('0x10')],_0x23242b);_0x4afea3(_0x36aeec[_0xfe2c('0xe')](0x1f4,_0x1bd50e[_0xfe2c('0x10')]));});});}; \ No newline at end of file +var _0x3423=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareDetailsReport,\x20%s,\x20%s','stringify','error','code','message','info','result','CreateSquareDetailsReport','SquareDetailsReport','create','options','raw','debug','catch'];(function(_0x10f42b,_0x3c5e6f){var _0x32a04b=function(_0x517ce0){while(--_0x517ce0){_0x10f42b['push'](_0x10f42b['shift']());}};_0x32a04b(++_0x3c5e6f);}(_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});function respondWithRpcPromise(_0x29c40c,_0x420d4b,_0x76422d){return new BPromise(function(_0xce08ab,_0x305d13){return client[_0x3342('0xc')](_0x29c40c,_0x76422d)[_0x3342('0xd')](function(_0x4ae4f3){logger['info'](_0x3342('0xe'),_0x420d4b,'request\x20sent');logger['debug']('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x420d4b,'request\x20sent',JSON[_0x3342('0xf')](_0x4ae4f3));if(_0x4ae4f3[_0x3342('0x10')]){if(_0x4ae4f3['error'][_0x3342('0x11')]===0x1f4){logger['error'](_0x3342('0xe'),_0x420d4b,_0x4ae4f3[_0x3342('0x10')]['message']);return _0x305d13(_0x4ae4f3[_0x3342('0x10')][_0x3342('0x12')]);}logger[_0x3342('0x10')](_0x3342('0xe'),_0x420d4b,_0x4ae4f3[_0x3342('0x10')][_0x3342('0x12')]);return _0xce08ab(_0x4ae4f3[_0x3342('0x10')]['message']);}else{logger[_0x3342('0x13')](_0x3342('0xe'),_0x420d4b,'request\x20sent');_0xce08ab(_0x4ae4f3[_0x3342('0x14')][_0x3342('0x12')]);}})['catch'](function(_0x554f9c){logger[_0x3342('0x10')](_0x3342('0xe'),_0x420d4b,_0x554f9c);_0x305d13(_0x554f9c);});});}exports[_0x3342('0x15')]=function(_0x2075cb){var _0x12947a=this;return new Promise(function(_0x156c24,_0x45a3ca){return db[_0x3342('0x16')][_0x3342('0x17')](_0x2075cb['body'],{'raw':_0x2075cb[_0x3342('0x18')]?_0x2075cb[_0x3342('0x18')][_0x3342('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x3cb86f){logger[_0x3342('0x13')]('CreateSquareDetailsReport',_0x2075cb);logger[_0x3342('0x1a')](_0x3342('0x15'),_0x2075cb,JSON['stringify'](_0x3cb86f));_0x156c24(_0x3cb86f);})[_0x3342('0x1b')](function(_0x5a0658){logger[_0x3342('0x10')](_0x3342('0x15'),_0x5a0658[_0x3342('0x12')],_0x2075cb);_0x45a3ca(_0x12947a[_0x3342('0x10')](0x1f4,_0x5a0658[_0x3342('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 475cec1..6fda924 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 _0x6336=['./system.controller','get','isAuthenticated','index','/process/:pid/kill','exports','Router','../../components/auth/service'];(function(_0x108340,_0x28030b){var _0xe8bf73=function(_0x5753e7){while(--_0x5753e7){_0x108340['push'](_0x108340['shift']());}};_0xe8bf73(++_0x28030b);}(_0x6336,0x1ae));var _0x6633=function(_0xcf610a,_0x11dcc5){_0xcf610a=_0xcf610a-0x0;var _0x4de265=_0x6336[_0xcf610a];return _0x4de265;};'use strict';var express=require('express');var router=express[_0x6633('0x0')]();var auth=require(_0x6633('0x1'));var controller=require(_0x6633('0x2'));router[_0x6633('0x3')]('/',auth[_0x6633('0x4')](),controller[_0x6633('0x5')]);router[_0x6633('0x3')](_0x6633('0x6'),auth['isAuthenticated'](),controller['killProcess']);module[_0x6633('0x7')]=router; \ No newline at end of file +var _0x6aa7=['killProcess','exports','../../components/auth/service','isAuthenticated','get','/process/:pid/kill'];(function(_0x17ec37,_0x2c3cb8){var _0x13cc2b=function(_0x3ceaf4){while(--_0x3ceaf4){_0x17ec37['push'](_0x17ec37['shift']());}};_0x13cc2b(++_0x2c3cb8);}(_0x6aa7,0x80));var _0x76aa=function(_0x24e77e,_0xd4ed64){_0x24e77e=_0x24e77e-0x0;var _0x172f87=_0x6aa7[_0x24e77e];return _0x172f87;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x76aa('0x0'));var controller=require('./system.controller');router['get']('/',auth[_0x76aa('0x1')](),controller['index']);router[_0x76aa('0x2')](_0x76aa('0x3'),auth[_0x76aa('0x1')](),controller[_0x76aa('0x4')]);module[_0x76aa('0x5')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 7900bc9..248aed7 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 _0x01b7=['inspect','name','status','index','json','killProcess','components/import/cm','format','params','pid','then','split','indexOf','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','systeminformation','child_process','exec','../../config/logger','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s'];(function(_0x353ae2,_0x462df3){var _0x46c63b=function(_0x123449){while(--_0x123449){_0x353ae2['push'](_0x353ae2['shift']());}};_0x46c63b(++_0x462df3);}(_0x01b7,0xc7));var _0x701b=function(_0x2734ee,_0x3e48ff){_0x2734ee=_0x2734ee-0x0;var _0x1d2d96=_0x01b7[_0x2734ee];return _0x1d2d96;};'use strict';var info=require(_0x701b('0x0'));var exec=require(_0x701b('0x1'))[_0x701b('0x2')];var logger=require(_0x701b('0x3'))('api');var util=require('util');var BPromise=require(_0x701b('0x4'));var _=require(_0x701b('0x5'));function handleError(_0x2d0d70,_0x5718da,_0x4a59a7){_0x5718da=_0x5718da||0x1f4;return function(_0x636b29){logger[_0x701b('0x6')](_0x701b('0x7'),_0x4a59a7,_0x5718da,util[_0x701b('0x8')](_0x636b29,{'showHidden':![],'depth':null}));delete _0x636b29[_0x701b('0x9')];_0x2d0d70[_0x701b('0xa')](_0x5718da)['send'](_0x636b29);};}exports[_0x701b('0xb')]=function(_0x3cf518,_0x4612d5){return info['getAllData']()['then'](function(_0x4cb1ab){return _0x4612d5[_0x701b('0xa')](0xc8)['json'](_0x4cb1ab);})['catch'](function(_0x3aaebf){return _0x4612d5[_0x701b('0xa')](0x1f4)[_0x701b('0xc')](_0x3aaebf);});};exports[_0x701b('0xd')]=function(_0x370167,_0x2107b7){var _0x2c7b8a=[_0x701b('0xe')];return new BPromise(function(_0x47a15c,_0x149c38){return exec(util[_0x701b('0xf')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x370167[_0x701b('0x10')][_0x701b('0x11')]),function(_0x5f07b4,_0x33e1c2,_0x2b6cb3){if(_0x5f07b4){return _0x149c38(_0x5f07b4);}return _0x47a15c(_0x33e1c2);});})[_0x701b('0x12')](function(_0x49e048){var _0x59205c=![];var _0x263de2=_0x49e048[_0x701b('0x13')](/\n/);for(var _0x4194f1=0x0,_0x5f445d=_0x2c7b8a['length'];_0x4194f1<_0x5f445d,_0x59205c===![];_0x4194f1+=0x1){if(_0x49e048[_0x701b('0x14')](_0x2c7b8a[_0x4194f1])>=0x0){_0x59205c=!![];}}if(!_0x59205c){throw new Error(util[_0x701b('0xf')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x370167[_0x701b('0x10')]['pid']));}process['kill'](_0x370167[_0x701b('0x10')]['pid'],'SIGINT');return _0x2107b7[_0x701b('0xa')](0xc8)[_0x701b('0xc')]({'message':util['format'](_0x701b('0x15'),_0x370167[_0x701b('0x10')][_0x701b('0x11')])});})[_0x701b('0x16')](handleError(_0x2107b7,null,_0x701b('0xd')));}; \ No newline at end of file +var _0x3f35=['pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','systeminformation','child_process','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','status','send','index','getAllData','then','catch','json','components/import/cm','format'];(function(_0x29cf5b,_0x49d2bd){var _0xfc6be1=function(_0x3a0c33){while(--_0x3a0c33){_0x29cf5b['push'](_0x29cf5b['shift']());}};_0xfc6be1(++_0x49d2bd);}(_0x3f35,0x90));var _0x53f3=function(_0x3b150c,_0x2f93f8){_0x3b150c=_0x3b150c-0x0;var _0x5cd414=_0x3f35[_0x3b150c];return _0x5cd414;};'use strict';var info=require(_0x53f3('0x0'));var exec=require(_0x53f3('0x1'))['exec'];var logger=require('../../config/logger')(_0x53f3('0x2'));var util=require(_0x53f3('0x3'));var BPromise=require(_0x53f3('0x4'));var _=require(_0x53f3('0x5'));function handleError(_0x5ae528,_0x35ef07,_0x5d0c61){_0x35ef07=_0x35ef07||0x1f4;return function(_0x3cc8a4){logger[_0x53f3('0x6')](_0x53f3('0x7'),_0x5d0c61,_0x35ef07,util['inspect'](_0x3cc8a4,{'showHidden':![],'depth':null}));delete _0x3cc8a4[_0x53f3('0x8')];_0x5ae528[_0x53f3('0x9')](_0x35ef07)[_0x53f3('0xa')](_0x3cc8a4);};}exports[_0x53f3('0xb')]=function(_0x12818d,_0x4f35e3){return info[_0x53f3('0xc')]()[_0x53f3('0xd')](function(_0x16dcb7){return _0x4f35e3[_0x53f3('0x9')](0xc8)['json'](_0x16dcb7);})[_0x53f3('0xe')](function(_0x2ab5bb){return _0x4f35e3[_0x53f3('0x9')](0x1f4)[_0x53f3('0xf')](_0x2ab5bb);});};exports['killProcess']=function(_0x26431a,_0xd4a587){var _0x1bc178=[_0x53f3('0x10')];return new BPromise(function(_0x32d006,_0x4fefcb){return exec(util[_0x53f3('0x11')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x26431a['params'][_0x53f3('0x12')]),function(_0x47ced7,_0x205f83,_0x60b2cb){if(_0x47ced7){return _0x4fefcb(_0x47ced7);}return _0x32d006(_0x205f83);});})['then'](function(_0x34a8bb){var _0x508d2d=![];var _0x42680e=_0x34a8bb[_0x53f3('0x13')](/\n/);for(var _0x4576c5=0x0,_0x1b8ca6=_0x1bc178[_0x53f3('0x14')];_0x4576c5<_0x1b8ca6,_0x508d2d===![];_0x4576c5+=0x1){if(_0x34a8bb[_0x53f3('0x15')](_0x1bc178[_0x4576c5])>=0x0){_0x508d2d=!![];}}if(!_0x508d2d){throw new Error(util[_0x53f3('0x11')](_0x53f3('0x16'),_0x26431a['params'][_0x53f3('0x12')]));}process['kill'](_0x26431a[_0x53f3('0x17')]['pid'],_0x53f3('0x18'));return _0xd4a587['status'](0xc8)[_0x53f3('0xf')]({'message':util[_0x53f3('0x11')](_0x53f3('0x19'),_0x26431a[_0x53f3('0x17')][_0x53f3('0x12')])});})[_0x53f3('0xe')](handleError(_0xd4a587,null,_0x53f3('0x1a')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 14e02a0..5469735 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 _0x52ed=['destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','isAuthenticated','index','create','put','/:id','update','delete'];(function(_0x11b08d,_0x224f74){var _0x3d704a=function(_0x5be8dc){while(--_0x5be8dc){_0x11b08d['push'](_0x11b08d['shift']());}};_0x3d704a(++_0x224f74);}(_0x52ed,0x132));var _0xd52e=function(_0x18e3a1,_0xd51faa){_0x18e3a1=_0x18e3a1-0x0;var _0x69b4a1=_0x52ed[_0x18e3a1];return _0x69b4a1;};'use strict';var multer=require(_0xd52e('0x0'));var util=require(_0xd52e('0x1'));var path=require(_0xd52e('0x2'));var timeout=require(_0xd52e('0x3'));var express=require(_0xd52e('0x4'));var router=express['Router']();var fs_extra=require(_0xd52e('0x5'));var auth=require(_0xd52e('0x6'));var interaction=require(_0xd52e('0x7'));var config=require(_0xd52e('0x8'));var controller=require(_0xd52e('0x9'));router['get']('/',auth[_0xd52e('0xa')](),controller[_0xd52e('0xb')]);router['get']('/:id',auth[_0xd52e('0xa')](),controller['show']);router['post']('/',auth[_0xd52e('0xa')](),controller[_0xd52e('0xc')]);router[_0xd52e('0xd')](_0xd52e('0xe'),auth[_0xd52e('0xa')](),controller[_0xd52e('0xf')]);router[_0xd52e('0x10')](_0xd52e('0xe'),auth[_0xd52e('0xa')](),controller[_0xd52e('0x11')]);module[_0xd52e('0x12')]=router; \ No newline at end of file +var _0x8863=['put','update','destroy','util','path','connect-timeout','express','../../config/environment','./tag.controller','isAuthenticated','index','/:id','show','post','create'];(function(_0x71185f,_0x371d74){var _0x160ffe=function(_0x57feba){while(--_0x57feba){_0x71185f['push'](_0x71185f['shift']());}};_0x160ffe(++_0x371d74);}(_0x8863,0x1b6));var _0x3886=function(_0x3bb859,_0x589816){_0x3bb859=_0x3bb859-0x0;var _0x3bf534=_0x8863[_0x3bb859];return _0x3bf534;};'use strict';var multer=require('multer');var util=require(_0x3886('0x0'));var path=require(_0x3886('0x1'));var timeout=require(_0x3886('0x2'));var express=require(_0x3886('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3886('0x4'));var controller=require(_0x3886('0x5'));router['get']('/',auth[_0x3886('0x6')](),controller[_0x3886('0x7')]);router['get'](_0x3886('0x8'),auth[_0x3886('0x6')](),controller[_0x3886('0x9')]);router[_0x3886('0xa')]('/',auth['isAuthenticated'](),controller[_0x3886('0xb')]);router[_0x3886('0xc')](_0x3886('0x8'),auth[_0x3886('0x6')](),controller[_0x3886('0xd')]);router['delete'](_0x3886('0x8'),auth[_0x3886('0x6')](),controller[_0x3886('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 70032aa..b5cd52f 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 _0x3e22=['exports','name','STRING','#0091EA'];(function(_0x15d707,_0x57ea06){var _0x280702=function(_0xcfb961){while(--_0xcfb961){_0x15d707['push'](_0x15d707['shift']());}};_0x280702(++_0x57ea06);}(_0x3e22,0xa8));var _0x23e2=function(_0x234491,_0x303898){_0x234491=_0x234491-0x0;var _0x4cac47=_0x3e22[_0x234491];return _0x4cac47;};'use strict';var Sequelize=require('sequelize');module[_0x23e2('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x23e2('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x23e2('0x2')],'defaultValue':_0x23e2('0x3')},'description':{'type':Sequelize[_0x23e2('0x2')]}}; \ No newline at end of file +var _0x5867=['name','#0091EA','sequelize','exports','STRING'];(function(_0x2aa1c1,_0x21f627){var _0xf7e649=function(_0x23fe00){while(--_0x23fe00){_0x2aa1c1['push'](_0x2aa1c1['shift']());}};_0xf7e649(++_0x21f627);}(_0x5867,0x1e2));var _0x7586=function(_0x44bad6,_0x156b4d){_0x44bad6=_0x44bad6-0x0;var _0x1711e7=_0x5867[_0x44bad6];return _0x1711e7;};'use strict';var Sequelize=require(_0x7586('0x0'));module[_0x7586('0x1')]={'name':{'type':Sequelize[_0x7586('0x2')],'unique':_0x7586('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x7586('0x2')],'defaultValue':_0x7586('0x4')},'description':{'type':Sequelize[_0x7586('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 492a88b..bcc03c1 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 _0x9f62=['name','send','index','Tag','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','map','filter','merge','options','count','includeAll','catch','show','params','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','UserProfileSection','userProfileId','autoAssociation','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','update','destroy','then','get','UserProfileResource','error','stack'];(function(_0x1c3c0e,_0x1101cf){var _0x8d2169=function(_0x238b0e){while(--_0x238b0e){_0x1c3c0e['push'](_0x1c3c0e['shift']());}};_0x8d2169(++_0x1101cf);}(_0x9f62,0x154));var _0x29f6=function(_0x1b835e,_0x211544){_0x1b835e=_0x1b835e-0x0;var _0x46b7b7=_0x9f62[_0x1b835e];return _0x46b7b7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x29f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x29f6('0x1'));var rp=require(_0x29f6('0x2'));var moment=require(_0x29f6('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x29f6('0x4'));var path=require(_0x29f6('0x5'));var sox=require(_0x29f6('0x6'));var csv=require(_0x29f6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x29f6('0x8'));var _=require(_0x29f6('0x9'));var squel=require(_0x29f6('0xa'));var crypto=require(_0x29f6('0xb'));var jsforce=require(_0x29f6('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x29f6('0xd'));var authService=require(_0x29f6('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x29f6('0xf'));var logger=require(_0x29f6('0x10'))('api');var utils=require(_0x29f6('0x11'));var config=require(_0x29f6('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x559585,_0x57b2d2){_0x57b2d2=_0x57b2d2||0xcc;return function(_0x2ae0e4){if(_0x2ae0e4){return _0x559585[_0x29f6('0x13')](_0x57b2d2);}return _0x559585[_0x29f6('0x14')](_0x57b2d2)[_0x29f6('0x15')]();};}function respondWithResult(_0x17de6e,_0x156c96){_0x156c96=_0x156c96||0xc8;return function(_0x35d2e2){if(_0x35d2e2){return _0x17de6e[_0x29f6('0x14')](_0x156c96)[_0x29f6('0x16')](_0x35d2e2);}};}function respondWithFilteredResult(_0x19331f,_0x28d314){return function(_0x370484){if(_0x370484){var _0x1dde97=typeof _0x28d314[_0x29f6('0x17')]===_0x29f6('0x18')&&typeof _0x28d314[_0x29f6('0x19')]===_0x29f6('0x18');var _0x5bfda7=_0x370484['count'];var _0x2e66d3=_0x1dde97?0x0:_0x28d314[_0x29f6('0x17')];var _0xb31436=_0x1dde97?_0x370484['count']:_0x28d314[_0x29f6('0x17')]+_0x28d314[_0x29f6('0x19')];var _0x49252f;if(_0xb31436>=_0x5bfda7){_0xb31436=_0x5bfda7;_0x49252f=0xc8;}else{_0x49252f=0xce;}_0x19331f[_0x29f6('0x14')](_0x49252f);return _0x19331f[_0x29f6('0x1a')](_0x29f6('0x1b'),_0x2e66d3+'-'+_0xb31436+'/'+_0x5bfda7)[_0x29f6('0x16')](_0x370484);}return null;};}function patchUpdates(_0xb6e7a9){return function(_0x2bfb3d){try{jsonpatch['apply'](_0x2bfb3d,_0xb6e7a9,!![]);}catch(_0xfb8fd2){return BPromise['reject'](_0xfb8fd2);}return _0x2bfb3d['save']();};}function saveUpdates(_0x470019,_0x1fa159){return function(_0x39c6b3){if(_0x39c6b3){return _0x39c6b3[_0x29f6('0x1c')](_0x470019)['then'](function(_0x2c672e){return _0x2c672e;});}return null;};}function removeEntity(_0x49f67d,_0xd4179c){return function(_0xcce041){if(_0xcce041){return _0xcce041[_0x29f6('0x1d')]()[_0x29f6('0x1e')](function(){var _0x4fc725=_0xcce041[_0x29f6('0x1f')]({'plain':!![]});var _0x4d494f='Tags';return db[_0x29f6('0x20')][_0x29f6('0x1d')]({'where':{'type':_0x4d494f,'resourceId':_0x4fc725['id']}})[_0x29f6('0x1e')](function(){return _0xcce041;});})[_0x29f6('0x1e')](function(){_0x49f67d[_0x29f6('0x14')](0xcc)[_0x29f6('0x15')]();});}};}function handleEntityNotFound(_0x23c630,_0x50cdd2){return function(_0x2183b7){if(!_0x2183b7){_0x23c630[_0x29f6('0x13')](0x194);}return _0x2183b7;};}function handleError(_0x1ab8d8,_0x3dace7){_0x3dace7=_0x3dace7||0x1f4;return function(_0xda0a63){logger[_0x29f6('0x21')](_0xda0a63[_0x29f6('0x22')]);if(_0xda0a63[_0x29f6('0x23')]){delete _0xda0a63[_0x29f6('0x23')];}_0x1ab8d8[_0x29f6('0x14')](_0x3dace7)[_0x29f6('0x24')](_0xda0a63);};}exports[_0x29f6('0x25')]=function(_0x40c830,_0x304c28){var _0x375564={},_0x218931={},_0x3a7249={'count':0x0,'rows':[]};var _0x5492c2=_['map'](db[_0x29f6('0x26')]['rawAttributes'],function(_0x341071){return{'name':_0x341071[_0x29f6('0x27')],'type':_0x341071[_0x29f6('0x28')][_0x29f6('0x29')]};});_0x218931['model']=_['map'](_0x5492c2,_0x29f6('0x23'));_0x218931[_0x29f6('0x2a')]=_[_0x29f6('0x2b')](_0x40c830[_0x29f6('0x2a')]);_0x218931[_0x29f6('0x2c')]=_[_0x29f6('0x2d')](_0x218931[_0x29f6('0x2e')],_0x218931[_0x29f6('0x2a')]);_0x375564[_0x29f6('0x2f')]=_[_0x29f6('0x2d')](_0x218931[_0x29f6('0x2e')],qs[_0x29f6('0x30')](_0x40c830[_0x29f6('0x2a')][_0x29f6('0x30')]));_0x375564['attributes']=_0x375564['attributes'][_0x29f6('0x31')]?_0x375564[_0x29f6('0x2f')]:_0x218931[_0x29f6('0x2e')];if(!_0x40c830['query'][_0x29f6('0x32')](_0x29f6('0x33'))){_0x375564[_0x29f6('0x19')]=qs[_0x29f6('0x19')](_0x40c830[_0x29f6('0x2a')]['limit']);_0x375564[_0x29f6('0x17')]=qs[_0x29f6('0x17')](_0x40c830[_0x29f6('0x2a')][_0x29f6('0x17')]);}_0x375564['order']=qs[_0x29f6('0x34')](_0x40c830[_0x29f6('0x2a')][_0x29f6('0x34')]);_0x375564[_0x29f6('0x35')]=qs['filters'](_['pick'](_0x40c830[_0x29f6('0x2a')],_0x218931['filters']),_0x5492c2);if(_0x40c830[_0x29f6('0x2a')]['filter']){_0x375564[_0x29f6('0x35')]=_['merge'](_0x375564[_0x29f6('0x35')],{'$or':_[_0x29f6('0x36')](_0x5492c2,function(_0x5448c4){if(_0x5448c4[_0x29f6('0x28')]!=='VIRTUAL'){var _0x3f3475={};_0x3f3475[_0x5448c4[_0x29f6('0x23')]]={'$like':'%'+_0x40c830['query'][_0x29f6('0x37')]+'%'};return _0x3f3475;}})});}_0x375564=_[_0x29f6('0x38')]({},_0x375564,_0x40c830[_0x29f6('0x39')]);var _0x1e9d5a={'where':_0x375564['where']};return db[_0x29f6('0x26')][_0x29f6('0x3a')](_0x1e9d5a)[_0x29f6('0x1e')](function(_0x2322eb){_0x3a7249[_0x29f6('0x3a')]=_0x2322eb;if(_0x40c830['query'][_0x29f6('0x3b')]){_0x375564['include']=[{'all':!![]}];}return db[_0x29f6('0x26')]['findAll'](_0x375564);})[_0x29f6('0x1e')](function(_0x3a8a12){_0x3a7249['rows']=_0x3a8a12;return _0x3a7249;})[_0x29f6('0x1e')](respondWithFilteredResult(_0x304c28,_0x375564))[_0x29f6('0x3c')](handleError(_0x304c28,null));};exports[_0x29f6('0x3d')]=function(_0x27d655,_0x5402bb){var _0x415dd3={'raw':!![],'where':{'id':_0x27d655[_0x29f6('0x3e')]['id']}},_0x2a83b7={};_0x2a83b7['model']=_[_0x29f6('0x2b')](db['Tag'][_0x29f6('0x3f')]);_0x2a83b7['query']=_['keys'](_0x27d655['query']);_0x2a83b7[_0x29f6('0x2c')]=_[_0x29f6('0x2d')](_0x2a83b7[_0x29f6('0x2e')],_0x2a83b7[_0x29f6('0x2a')]);_0x415dd3[_0x29f6('0x2f')]=_[_0x29f6('0x2d')](_0x2a83b7[_0x29f6('0x2e')],qs[_0x29f6('0x30')](_0x27d655[_0x29f6('0x2a')][_0x29f6('0x30')]));_0x415dd3['attributes']=_0x415dd3['attributes'][_0x29f6('0x31')]?_0x415dd3[_0x29f6('0x2f')]:_0x2a83b7[_0x29f6('0x2e')];if(_0x27d655[_0x29f6('0x2a')]['includeAll']){_0x415dd3[_0x29f6('0x40')]=[{'all':!![]}];}_0x415dd3=_[_0x29f6('0x38')]({},_0x415dd3,_0x27d655['options']);return db[_0x29f6('0x26')][_0x29f6('0x41')](_0x415dd3)[_0x29f6('0x1e')](handleEntityNotFound(_0x5402bb,null))[_0x29f6('0x1e')](respondWithResult(_0x5402bb,null))[_0x29f6('0x3c')](handleError(_0x5402bb,null));};exports[_0x29f6('0x42')]=function(_0x320b5e,_0x1f03b6){return db[_0x29f6('0x26')][_0x29f6('0x42')](_0x320b5e[_0x29f6('0x43')],{})[_0x29f6('0x1e')](function(_0x58ea69){var _0x416c24=_0x320b5e[_0x29f6('0x44')][_0x29f6('0x1f')]({'plain':!![]});if(!_0x416c24)throw new Error(_0x29f6('0x45'));if(_0x416c24[_0x29f6('0x46')]==='user'){var _0x2e29e3=_0x58ea69['get']({'plain':!![]});var _0x546c91=_0x29f6('0x47');return db[_0x29f6('0x48')][_0x29f6('0x41')]({'where':{'name':_0x546c91,'userProfileId':_0x416c24[_0x29f6('0x49')]},'raw':!![]})[_0x29f6('0x1e')](function(_0x509caf){if(_0x509caf&&_0x509caf[_0x29f6('0x4a')]===0x0){return db[_0x29f6('0x20')]['create']({'name':_0x2e29e3[_0x29f6('0x23')],'resourceId':_0x2e29e3['id'],'type':_0x509caf['name'],'sectionId':_0x509caf['id']},{})[_0x29f6('0x1e')](function(){return _0x58ea69;});}else{return _0x58ea69;}})[_0x29f6('0x3c')](function(_0x27601d){logger[_0x29f6('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x27601d);throw _0x27601d;});}return _0x58ea69;})[_0x29f6('0x1e')](respondWithResult(_0x1f03b6,0xc9))[_0x29f6('0x3c')](handleError(_0x1f03b6,null));};exports[_0x29f6('0x1c')]=function(_0x217428,_0x3aa7eb){if(_0x217428[_0x29f6('0x43')]['id']){delete _0x217428[_0x29f6('0x43')]['id'];}return db['Tag'][_0x29f6('0x41')]({'where':{'id':_0x217428[_0x29f6('0x3e')]['id']}})[_0x29f6('0x1e')](handleEntityNotFound(_0x3aa7eb,null))[_0x29f6('0x1e')](saveUpdates(_0x217428[_0x29f6('0x43')],null))[_0x29f6('0x1e')](respondWithResult(_0x3aa7eb,null))[_0x29f6('0x3c')](handleError(_0x3aa7eb,null));};exports[_0x29f6('0x1d')]=function(_0x39d531,_0x3dbd19){return db['Tag']['find']({'where':{'id':_0x39d531[_0x29f6('0x3e')]['id']}})[_0x29f6('0x1e')](handleEntityNotFound(_0x3dbd19,null))[_0x29f6('0x1e')](removeEntity(_0x3dbd19,null))['catch'](handleError(_0x3dbd19,null));}; \ No newline at end of file +var _0x5712=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','count','limit','set','Content-Range','apply','save','then','destroy','Tags','UserProfileResource','error','stack','name','send','index','map','Tag','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','find','create','user','get','role','userProfileId','autoAssociation','update','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x267cf4,_0xcbcf72){var _0x4824cf=function(_0x3e53d6){while(--_0x3e53d6){_0x267cf4['push'](_0x267cf4['shift']());}};_0x4824cf(++_0xcbcf72);}(_0x5712,0x140));var _0x2571=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5712[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x2571('0x0'));var rimraf=require(_0x2571('0x1'));var zipdir=require(_0x2571('0x2'));var jsonpatch=require(_0x2571('0x3'));var rp=require(_0x2571('0x4'));var moment=require(_0x2571('0x5'));var BPromise=require(_0x2571('0x6'));var Mustache=require(_0x2571('0x7'));var util=require(_0x2571('0x8'));var path=require(_0x2571('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2571('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2571('0xb'));var squel=require(_0x2571('0xc'));var crypto=require(_0x2571('0xd'));var jsforce=require(_0x2571('0xe'));var deskjs=require(_0x2571('0xf'));var toCsv=require(_0x2571('0x10'));var querystring=require('querystring');var Papa=require(_0x2571('0x11'));var Redis=require('ioredis');var authService=require(_0x2571('0x12'));var qs=require(_0x2571('0x13'));var as=require(_0x2571('0x14'));var hardwareService=require(_0x2571('0x15'));var logger=require(_0x2571('0x16'))(_0x2571('0x17'));var utils=require(_0x2571('0x18'));var config=require(_0x2571('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33d3ed,_0x1ab846){_0x1ab846=_0x1ab846||0xcc;return function(_0x10823d){if(_0x10823d){return _0x33d3ed[_0x2571('0x1a')](_0x1ab846);}return _0x33d3ed[_0x2571('0x1b')](_0x1ab846)[_0x2571('0x1c')]();};}function respondWithResult(_0x241129,_0x130ab1){_0x130ab1=_0x130ab1||0xc8;return function(_0xdf8c3a){if(_0xdf8c3a){return _0x241129[_0x2571('0x1b')](_0x130ab1)[_0x2571('0x1d')](_0xdf8c3a);}};}function respondWithFilteredResult(_0x3c1a08,_0x5b0392){return function(_0x30b0f2){if(_0x30b0f2){var _0x47b5e9=typeof _0x5b0392['offset']==='undefined'&&typeof _0x5b0392['limit']===_0x2571('0x1e');var _0x371ae2=_0x30b0f2[_0x2571('0x1f')];var _0x75af2a=_0x47b5e9?0x0:_0x5b0392['offset'];var _0x7707=_0x47b5e9?_0x30b0f2[_0x2571('0x1f')]:_0x5b0392['offset']+_0x5b0392[_0x2571('0x20')];var _0x7303ad;if(_0x7707>=_0x371ae2){_0x7707=_0x371ae2;_0x7303ad=0xc8;}else{_0x7303ad=0xce;}_0x3c1a08[_0x2571('0x1b')](_0x7303ad);return _0x3c1a08[_0x2571('0x21')](_0x2571('0x22'),_0x75af2a+'-'+_0x7707+'/'+_0x371ae2)['json'](_0x30b0f2);}return null;};}function patchUpdates(_0x52da27){return function(_0x5fe030){try{jsonpatch[_0x2571('0x23')](_0x5fe030,_0x52da27,!![]);}catch(_0x58f6aa){return BPromise['reject'](_0x58f6aa);}return _0x5fe030[_0x2571('0x24')]();};}function saveUpdates(_0x2e7d89,_0x2218fb){return function(_0xb6dfa6){if(_0xb6dfa6){return _0xb6dfa6['update'](_0x2e7d89)[_0x2571('0x25')](function(_0x55ec06){return _0x55ec06;});}return null;};}function removeEntity(_0x1ec23c,_0x4316b1){return function(_0x5d6778){if(_0x5d6778){return _0x5d6778[_0x2571('0x26')]()[_0x2571('0x25')](function(){var _0x22cdb8=_0x5d6778['get']({'plain':!![]});var _0x5d455d=_0x2571('0x27');return db[_0x2571('0x28')][_0x2571('0x26')]({'where':{'type':_0x5d455d,'resourceId':_0x22cdb8['id']}})[_0x2571('0x25')](function(){return _0x5d6778;});})[_0x2571('0x25')](function(){_0x1ec23c[_0x2571('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f6ccc,_0x1ceb21){return function(_0x426615){if(!_0x426615){_0x4f6ccc[_0x2571('0x1a')](0x194);}return _0x426615;};}function handleError(_0x2ce206,_0x26757a){_0x26757a=_0x26757a||0x1f4;return function(_0x165aa8){logger[_0x2571('0x29')](_0x165aa8[_0x2571('0x2a')]);if(_0x165aa8[_0x2571('0x2b')]){delete _0x165aa8[_0x2571('0x2b')];}_0x2ce206['status'](_0x26757a)[_0x2571('0x2c')](_0x165aa8);};}exports[_0x2571('0x2d')]=function(_0x26af3c,_0x441e7d){var _0x1bf5d1={},_0x2902cb={},_0x5bc2e7={'count':0x0,'rows':[]};var _0x4c4911=_[_0x2571('0x2e')](db[_0x2571('0x2f')][_0x2571('0x30')],function(_0x2b6416){return{'name':_0x2b6416['fieldName'],'type':_0x2b6416[_0x2571('0x31')][_0x2571('0x32')]};});_0x2902cb['model']=_['map'](_0x4c4911,_0x2571('0x2b'));_0x2902cb[_0x2571('0x33')]=_[_0x2571('0x34')](_0x26af3c['query']);_0x2902cb[_0x2571('0x35')]=_[_0x2571('0x36')](_0x2902cb['model'],_0x2902cb[_0x2571('0x33')]);_0x1bf5d1['attributes']=_[_0x2571('0x36')](_0x2902cb[_0x2571('0x37')],qs[_0x2571('0x38')](_0x26af3c['query']['fields']));_0x1bf5d1[_0x2571('0x39')]=_0x1bf5d1['attributes'][_0x2571('0x3a')]?_0x1bf5d1[_0x2571('0x39')]:_0x2902cb[_0x2571('0x37')];if(!_0x26af3c[_0x2571('0x33')]['hasOwnProperty'](_0x2571('0x3b'))){_0x1bf5d1[_0x2571('0x20')]=qs['limit'](_0x26af3c[_0x2571('0x33')][_0x2571('0x20')]);_0x1bf5d1['offset']=qs[_0x2571('0x3c')](_0x26af3c[_0x2571('0x33')][_0x2571('0x3c')]);}_0x1bf5d1[_0x2571('0x3d')]=qs[_0x2571('0x3e')](_0x26af3c[_0x2571('0x33')][_0x2571('0x3e')]);_0x1bf5d1[_0x2571('0x3f')]=qs[_0x2571('0x35')](_[_0x2571('0x40')](_0x26af3c[_0x2571('0x33')],_0x2902cb[_0x2571('0x35')]),_0x4c4911);if(_0x26af3c[_0x2571('0x33')][_0x2571('0x41')]){_0x1bf5d1['where']=_[_0x2571('0x42')](_0x1bf5d1[_0x2571('0x3f')],{'$or':_[_0x2571('0x2e')](_0x4c4911,function(_0x440752){if(_0x440752[_0x2571('0x31')]!==_0x2571('0x43')){var _0x35deff={};_0x35deff[_0x440752['name']]={'$like':'%'+_0x26af3c[_0x2571('0x33')][_0x2571('0x41')]+'%'};return _0x35deff;}})});}_0x1bf5d1=_[_0x2571('0x42')]({},_0x1bf5d1,_0x26af3c['options']);var _0x5fe079={'where':_0x1bf5d1[_0x2571('0x3f')]};return db[_0x2571('0x2f')]['count'](_0x5fe079)[_0x2571('0x25')](function(_0x1c6ccd){_0x5bc2e7[_0x2571('0x1f')]=_0x1c6ccd;if(_0x26af3c[_0x2571('0x33')][_0x2571('0x44')]){_0x1bf5d1[_0x2571('0x45')]=[{'all':!![]}];}return db[_0x2571('0x2f')][_0x2571('0x46')](_0x1bf5d1);})[_0x2571('0x25')](function(_0x5d2734){_0x5bc2e7[_0x2571('0x47')]=_0x5d2734;return _0x5bc2e7;})[_0x2571('0x25')](respondWithFilteredResult(_0x441e7d,_0x1bf5d1))[_0x2571('0x48')](handleError(_0x441e7d,null));};exports[_0x2571('0x49')]=function(_0x2411d9,_0x1e6f2c){var _0x391c01={'raw':!![],'where':{'id':_0x2411d9['params']['id']}},_0x2d024c={};_0x2d024c['model']=_['keys'](db['Tag']['rawAttributes']);_0x2d024c['query']=_[_0x2571('0x34')](_0x2411d9[_0x2571('0x33')]);_0x2d024c['filters']=_[_0x2571('0x36')](_0x2d024c[_0x2571('0x37')],_0x2d024c[_0x2571('0x33')]);_0x391c01[_0x2571('0x39')]=_[_0x2571('0x36')](_0x2d024c['model'],qs['fields'](_0x2411d9['query'][_0x2571('0x38')]));_0x391c01[_0x2571('0x39')]=_0x391c01[_0x2571('0x39')][_0x2571('0x3a')]?_0x391c01[_0x2571('0x39')]:_0x2d024c[_0x2571('0x37')];if(_0x2411d9[_0x2571('0x33')]['includeAll']){_0x391c01[_0x2571('0x45')]=[{'all':!![]}];}_0x391c01=_[_0x2571('0x42')]({},_0x391c01,_0x2411d9[_0x2571('0x4a')]);return db['Tag'][_0x2571('0x4b')](_0x391c01)[_0x2571('0x25')](handleEntityNotFound(_0x1e6f2c,null))[_0x2571('0x25')](respondWithResult(_0x1e6f2c,null))[_0x2571('0x48')](handleError(_0x1e6f2c,null));};exports['create']=function(_0x18291c,_0x245edb){return db[_0x2571('0x2f')][_0x2571('0x4c')](_0x18291c['body'],{})[_0x2571('0x25')](function(_0xef8f21){var _0x10d956=_0x18291c[_0x2571('0x4d')][_0x2571('0x4e')]({'plain':!![]});if(!_0x10d956)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x10d956[_0x2571('0x4f')]===_0x2571('0x4d')){var _0x20302b=_0xef8f21[_0x2571('0x4e')]({'plain':!![]});var _0x6a55ff=_0x2571('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x6a55ff,'userProfileId':_0x10d956[_0x2571('0x50')]},'raw':!![]})['then'](function(_0x47ff18){if(_0x47ff18&&_0x47ff18[_0x2571('0x51')]===0x0){return db[_0x2571('0x28')][_0x2571('0x4c')]({'name':_0x20302b[_0x2571('0x2b')],'resourceId':_0x20302b['id'],'type':_0x47ff18[_0x2571('0x2b')],'sectionId':_0x47ff18['id']},{})[_0x2571('0x25')](function(){return _0xef8f21;});}else{return _0xef8f21;}})[_0x2571('0x48')](function(_0x3c890a){logger[_0x2571('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c890a);throw _0x3c890a;});}return _0xef8f21;})[_0x2571('0x25')](respondWithResult(_0x245edb,0xc9))[_0x2571('0x48')](handleError(_0x245edb,null));};exports[_0x2571('0x52')]=function(_0x495c45,_0x3823c9){if(_0x495c45['body']['id']){delete _0x495c45[_0x2571('0x53')]['id'];}return db[_0x2571('0x2f')][_0x2571('0x4b')]({'where':{'id':_0x495c45['params']['id']}})['then'](handleEntityNotFound(_0x3823c9,null))['then'](saveUpdates(_0x495c45['body'],null))[_0x2571('0x25')](respondWithResult(_0x3823c9,null))[_0x2571('0x48')](handleError(_0x3823c9,null));};exports[_0x2571('0x26')]=function(_0x3ce2b9,_0x333b91){return db[_0x2571('0x2f')][_0x2571('0x4b')]({'where':{'id':_0x3ce2b9[_0x2571('0x54')]['id']}})[_0x2571('0x25')](handleEntityNotFound(_0x333b91,null))[_0x2571('0x25')](removeEntity(_0x333b91,null))[_0x2571('0x48')](handleError(_0x333b91,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 383ade1..f42bf46 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 _0xda33=['moment','bluebird','path','rimraf','../../config/environment','./tag.attributes','exports','define','Tag','tools_tags','lodash','util','../../config/logger'];(function(_0x330101,_0x3f9f6b){var _0x344d8e=function(_0x2cb8b3){while(--_0x2cb8b3){_0x330101['push'](_0x330101['shift']());}};_0x344d8e(++_0x3f9f6b);}(_0xda33,0x1b7));var _0x3da3=function(_0x208524,_0x391c25){_0x208524=_0x208524-0x0;var _0x3b82a8=_0xda33[_0x208524];return _0x3b82a8;};'use strict';var _=require(_0x3da3('0x0'));var util=require(_0x3da3('0x1'));var logger=require(_0x3da3('0x2'))('api');var moment=require(_0x3da3('0x3'));var BPromise=require(_0x3da3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3da3('0x5'));var rimraf=require(_0x3da3('0x6'));var config=require(_0x3da3('0x7'));var attributes=require(_0x3da3('0x8'));module[_0x3da3('0x9')]=function(_0x2d2317,_0x5633bf){return _0x2d2317[_0x3da3('0xa')](_0x3da3('0xb'),attributes,{'tableName':_0x3da3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4262=['util','../../config/logger','moment','request-promise','../../config/environment','./tag.attributes','exports','define','Tag','tools_tags','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4262,0x15f));var _0x2426=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x4262[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x2426('0x0'));var util=require(_0x2426('0x1'));var logger=require(_0x2426('0x2'))('api');var moment=require(_0x2426('0x3'));var BPromise=require('bluebird');var rp=require(_0x2426('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2426('0x5'));var attributes=require(_0x2426('0x6'));module[_0x2426('0x7')]=function(_0x127500,_0x4a6553){return _0x127500[_0x2426('0x8')](_0x2426('0x9'),attributes,{'tableName':_0x2426('0xa'),'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 606341d..8287ed7 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 _0x0e9f=['debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','Tag,\x20%s,\x20%s','message','catch','lodash','util','randomstring','../../config/utils','../../config/environment','jayson/promise','http','then','info','request\x20sent'];(function(_0x43de22,_0x1eced6){var _0x4b15ee=function(_0x6e36da){while(--_0x6e36da){_0x43de22['push'](_0x43de22['shift']());}};_0x4b15ee(++_0x1eced6);}(_0x0e9f,0x116));var _0xf0e9=function(_0xae6736,_0x4e43c3){_0xae6736=_0xae6736-0x0;var _0x179d79=_0x0e9f[_0xae6736];return _0x179d79;};'use strict';var _=require(_0xf0e9('0x0'));var util=require(_0xf0e9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf0e9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf0e9('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0xf0e9('0x4'));var jayson=require(_0xf0e9('0x5'));var client=jayson['client'][_0xf0e9('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4a35a3,_0x3f9792,_0x2fa08f){return new BPromise(function(_0x106ba0,_0x58edfe){return client['request'](_0x4a35a3,_0x2fa08f)[_0xf0e9('0x7')](function(_0x7b3146){logger[_0xf0e9('0x8')]('Tag,\x20%s,\x20%s',_0x3f9792,_0xf0e9('0x9'));logger[_0xf0e9('0xa')](_0xf0e9('0xb'),_0x3f9792,'request\x20sent',JSON[_0xf0e9('0xc')](_0x7b3146));if(_0x7b3146[_0xf0e9('0xd')]){if(_0x7b3146[_0xf0e9('0xd')][_0xf0e9('0xe')]===0x1f4){logger['error'](_0xf0e9('0xf'),_0x3f9792,_0x7b3146['error'][_0xf0e9('0x10')]);return _0x58edfe(_0x7b3146[_0xf0e9('0xd')]['message']);}logger[_0xf0e9('0xd')](_0xf0e9('0xf'),_0x3f9792,_0x7b3146[_0xf0e9('0xd')][_0xf0e9('0x10')]);return _0x106ba0(_0x7b3146[_0xf0e9('0xd')][_0xf0e9('0x10')]);}else{logger['info'](_0xf0e9('0xf'),_0x3f9792,_0xf0e9('0x9'));_0x106ba0(_0x7b3146['result'][_0xf0e9('0x10')]);}})[_0xf0e9('0x11')](function(_0x3d0b4d){logger[_0xf0e9('0xd')]('Tag,\x20%s,\x20%s',_0x3f9792,_0x3d0b4d);_0x58edfe(_0x3d0b4d);});});} \ No newline at end of file +var _0xb903=['http','request','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','error','Tag,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1889c6,_0x4dfefc){var _0x3b3279=function(_0x4cb810){while(--_0x4cb810){_0x1889c6['push'](_0x1889c6['shift']());}};_0x3b3279(++_0x4dfefc);}(_0xb903,0x185));var _0x3b90=function(_0xcc5be8,_0x4d9831){_0xcc5be8=_0xcc5be8-0x0;var _0x1baabd=_0xb903[_0xcc5be8];return _0x1baabd;};'use strict';var _=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var moment=require(_0x3b90('0x2'));var BPromise=require(_0x3b90('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b90('0x4'));var db=require(_0x3b90('0x5'))['db'];var utils=require(_0x3b90('0x6'));var logger=require(_0x3b90('0x7'))(_0x3b90('0x8'));var config=require(_0x3b90('0x9'));var jayson=require(_0x3b90('0xa'));var client=jayson['client'][_0x3b90('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e845a,_0x55792c,_0x153283){return new BPromise(function(_0x2e4c06,_0x42efe8){return client[_0x3b90('0xc')](_0x5e845a,_0x153283)['then'](function(_0x5cda1d){logger['info']('Tag,\x20%s,\x20%s',_0x55792c,'request\x20sent');logger['debug'](_0x3b90('0xd'),_0x55792c,_0x3b90('0xe'),JSON['stringify'](_0x5cda1d));if(_0x5cda1d[_0x3b90('0xf')]){if(_0x5cda1d[_0x3b90('0xf')]['code']===0x1f4){logger[_0x3b90('0xf')](_0x3b90('0x10'),_0x55792c,_0x5cda1d[_0x3b90('0xf')]['message']);return _0x42efe8(_0x5cda1d['error'][_0x3b90('0x11')]);}logger['error']('Tag,\x20%s,\x20%s',_0x55792c,_0x5cda1d[_0x3b90('0xf')][_0x3b90('0x11')]);return _0x2e4c06(_0x5cda1d['error']['message']);}else{logger[_0x3b90('0x12')](_0x3b90('0x10'),_0x55792c,_0x3b90('0xe'));_0x2e4c06(_0x5cda1d[_0x3b90('0x13')][_0x3b90('0x11')]);}})['catch'](function(_0x494970){logger[_0x3b90('0xf')](_0x3b90('0x10'),_0x55792c,_0x494970);_0x42efe8(_0x494970);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 9977893..8421761 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa9e0,0x123));var _0x0a9e=function(_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'));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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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 502fc40..9ae7bd3 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(_0x44e1e0,_0x2cfe4a){var _0x3957ab=function(_0x112a43){while(--_0x112a43){_0x44e1e0['push'](_0x44e1e0['shift']());}};_0x3957ab(++_0x2cfe4a);}(_0x2032,0xd9));var _0x2203=function(_0x4ed094,_0x146fb2){_0x4ed094=_0x4ed094-0x0;var _0x1c28d3=_0x2032[_0x4ed094];return _0x1c28d3;};'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 _0xe706=['STRING','sequelize','exports'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xe706,0xa3));var _0x6e70=function(_0x1c443f,_0x51319d){_0x1c443f=_0x1c443f-0x0;var _0x4a4a71=_0xe706[_0x1c443f];return _0x4a4a71;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'name':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x6e70('0x2')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 4ad833b..60aa5f0 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 _0xc259=['voicePause','interface','upsert','isNil','format','SIP/%s','all','removeAgents','parse','emit','Queue:remove','getAgents','nolimit','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','get','sendStatus','error','stack','name','send','Team','rawAttributes','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Teams','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getQueues','findOne','channel','isValidChannel','Sequelize','ValidationError','Unknown\x20channel','Queue','pick','capitalize','Queues','addQueues','add','toLowerCase','remove','addAgents','Chat','Mail','Fax','Openchannel','sequelize','Voice','penalty','ids','QueueId','TeamVoiceQueue','findOrCreate','Queue:save','User','online'];(function(_0x220237,_0x5828c3){var _0x46a45f=function(_0x23ec6d){while(--_0x23ec6d){_0x220237['push'](_0x220237['shift']());}};_0x46a45f(++_0x5828c3);}(_0xc259,0x193));var _0x9c25=function(_0x1f20b4,_0x4c2d3e){_0x1f20b4=_0x1f20b4-0x0;var _0x1dcf9c=_0xc259[_0x1f20b4];return _0x1dcf9c;};'use strict';var emlformat=require(_0x9c25('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9c25('0x1'));var jsonpatch=require(_0x9c25('0x2'));var rp=require(_0x9c25('0x3'));var moment=require('moment');var BPromise=require(_0x9c25('0x4'));var Mustache=require(_0x9c25('0x5'));var util=require(_0x9c25('0x6'));var path=require(_0x9c25('0x7'));var sox=require(_0x9c25('0x8'));var csv=require(_0x9c25('0x9'));var ejs=require(_0x9c25('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9c25('0xb'));var squel=require(_0x9c25('0xc'));var crypto=require(_0x9c25('0xd'));var jsforce=require(_0x9c25('0xe'));var deskjs=require(_0x9c25('0xf'));var toCsv=require(_0x9c25('0x9'));var querystring=require(_0x9c25('0x10'));var Papa=require(_0x9c25('0x11'));var Redis=require(_0x9c25('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9c25('0x13'));var logger=require(_0x9c25('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x9c25('0x15'));var licenseUtil=require(_0x9c25('0x16'));var db=require(_0x9c25('0x17'))['db'];config[_0x9c25('0x18')]=_[_0x9c25('0x19')](config[_0x9c25('0x18')],{'host':_0x9c25('0x1a'),'port':0x18eb});var socket=require(_0x9c25('0x1b'))(new Redis(config[_0x9c25('0x18')]));require(_0x9c25('0x1c'))[_0x9c25('0x1d')](socket);function respondWithStatusCode(_0x123065,_0x4ca7be){_0x4ca7be=_0x4ca7be||0xcc;return function(_0x4e9aac){if(_0x4e9aac){return _0x123065['sendStatus'](_0x4ca7be);}return _0x123065[_0x9c25('0x1e')](_0x4ca7be)[_0x9c25('0x1f')]();};}function respondWithResult(_0x1974ca,_0x208a57){_0x208a57=_0x208a57||0xc8;return function(_0x4ee390){if(_0x4ee390){return _0x1974ca['status'](_0x208a57)[_0x9c25('0x20')](_0x4ee390);}};}function respondWithFilteredResult(_0x533d1a,_0x461894){return function(_0x164eb5){if(_0x164eb5){var _0x575f85=typeof _0x461894[_0x9c25('0x21')]===_0x9c25('0x22')&&typeof _0x461894[_0x9c25('0x23')]===_0x9c25('0x22');var _0x3e4420=_0x164eb5[_0x9c25('0x24')];var _0x4d7b07=_0x575f85?0x0:_0x461894[_0x9c25('0x21')];var _0x1f5b85=_0x575f85?_0x164eb5[_0x9c25('0x24')]:_0x461894[_0x9c25('0x21')]+_0x461894[_0x9c25('0x23')];var _0x2fa8f3;if(_0x1f5b85>=_0x3e4420){_0x1f5b85=_0x3e4420;_0x2fa8f3=0xc8;}else{_0x2fa8f3=0xce;}_0x533d1a[_0x9c25('0x1e')](_0x2fa8f3);return _0x533d1a['set'](_0x9c25('0x25'),_0x4d7b07+'-'+_0x1f5b85+'/'+_0x3e4420)[_0x9c25('0x20')](_0x164eb5);}return null;};}function patchUpdates(_0x557cfb){return function(_0x5956d3){try{jsonpatch['apply'](_0x5956d3,_0x557cfb,!![]);}catch(_0x503c74){return BPromise[_0x9c25('0x26')](_0x503c74);}return _0x5956d3[_0x9c25('0x27')]();};}function saveUpdates(_0x5a8e68,_0x59f0f1){return function(_0x1a2626){if(_0x1a2626){return _0x1a2626[_0x9c25('0x28')](_0x5a8e68)[_0x9c25('0x29')](function(_0x37f006){return _0x37f006;});}return null;};}function removeEntity(_0x1c4c5b,_0x53c075){return function(_0x507396){if(_0x507396){return _0x507396[_0x9c25('0x2a')]()[_0x9c25('0x29')](function(){var _0x139b62=_0x507396[_0x9c25('0x2b')]({'plain':!![]});var _0x26f19c='Teams';return db['UserProfileResource'][_0x9c25('0x2a')]({'where':{'type':_0x26f19c,'resourceId':_0x139b62['id']}})['then'](function(){return _0x507396;});})[_0x9c25('0x29')](function(){_0x1c4c5b[_0x9c25('0x1e')](0xcc)[_0x9c25('0x1f')]();});}};}function handleEntityNotFound(_0x1f4895,_0x2083b9){return function(_0x5aa5be){if(!_0x5aa5be){_0x1f4895[_0x9c25('0x2c')](0x194);}return _0x5aa5be;};}function handleError(_0x17392c,_0x263236){_0x263236=_0x263236||0x1f4;return function(_0x3aabe3){logger[_0x9c25('0x2d')](_0x3aabe3[_0x9c25('0x2e')]);if(_0x3aabe3[_0x9c25('0x2f')]){delete _0x3aabe3['name'];}_0x17392c[_0x9c25('0x1e')](_0x263236)[_0x9c25('0x30')](_0x3aabe3);};}exports['index']=function(_0x71e4ec,_0x4af603){var _0x3d8dbb={},_0x38b94e={},_0x98e80={'count':0x0,'rows':[]};var _0x133e74=_['map'](db[_0x9c25('0x31')][_0x9c25('0x32')],function(_0x171a11){return{'name':_0x171a11['fieldName'],'type':_0x171a11[_0x9c25('0x33')][_0x9c25('0x34')]};});_0x38b94e[_0x9c25('0x35')]=_[_0x9c25('0x36')](_0x133e74,_0x9c25('0x2f'));_0x38b94e[_0x9c25('0x37')]=_[_0x9c25('0x38')](_0x71e4ec[_0x9c25('0x37')]);_0x38b94e[_0x9c25('0x39')]=_['intersection'](_0x38b94e[_0x9c25('0x35')],_0x38b94e[_0x9c25('0x37')]);_0x3d8dbb[_0x9c25('0x3a')]=_[_0x9c25('0x3b')](_0x38b94e['model'],qs[_0x9c25('0x3c')](_0x71e4ec[_0x9c25('0x37')][_0x9c25('0x3c')]));_0x3d8dbb['attributes']=_0x3d8dbb[_0x9c25('0x3a')][_0x9c25('0x3d')]?_0x3d8dbb[_0x9c25('0x3a')]:_0x38b94e['model'];if(!_0x71e4ec[_0x9c25('0x37')][_0x9c25('0x3e')]('nolimit')){_0x3d8dbb[_0x9c25('0x23')]=qs[_0x9c25('0x23')](_0x71e4ec[_0x9c25('0x37')]['limit']);_0x3d8dbb[_0x9c25('0x21')]=qs[_0x9c25('0x21')](_0x71e4ec[_0x9c25('0x37')]['offset']);}_0x3d8dbb[_0x9c25('0x3f')]=qs[_0x9c25('0x40')](_0x71e4ec[_0x9c25('0x37')][_0x9c25('0x40')]);_0x3d8dbb[_0x9c25('0x41')]=qs[_0x9c25('0x39')](_['pick'](_0x71e4ec[_0x9c25('0x37')],_0x38b94e[_0x9c25('0x39')]),_0x133e74);if(_0x71e4ec[_0x9c25('0x37')][_0x9c25('0x42')]){_0x3d8dbb[_0x9c25('0x41')]=_[_0x9c25('0x43')](_0x3d8dbb[_0x9c25('0x41')],{'$or':_[_0x9c25('0x36')](_0x133e74,function(_0x4580f9){if(_0x4580f9[_0x9c25('0x33')]!==_0x9c25('0x44')){var _0x4b7186={};_0x4b7186[_0x4580f9[_0x9c25('0x2f')]]={'$like':'%'+_0x71e4ec['query'][_0x9c25('0x42')]+'%'};return _0x4b7186;}})});}_0x3d8dbb=_[_0x9c25('0x43')]({},_0x3d8dbb,_0x71e4ec[_0x9c25('0x45')]);var _0x4e99cd={'where':_0x3d8dbb['where']};return db[_0x9c25('0x31')][_0x9c25('0x24')](_0x4e99cd)['then'](function(_0x49fb82){_0x98e80['count']=_0x49fb82;if(_0x71e4ec[_0x9c25('0x37')][_0x9c25('0x46')]){_0x3d8dbb[_0x9c25('0x47')]=[{'all':!![]}];}return db[_0x9c25('0x31')][_0x9c25('0x48')](_0x3d8dbb);})[_0x9c25('0x29')](function(_0x11b73f){_0x98e80[_0x9c25('0x49')]=_0x11b73f;return _0x98e80;})[_0x9c25('0x29')](respondWithFilteredResult(_0x4af603,_0x3d8dbb))[_0x9c25('0x4a')](handleError(_0x4af603,null));};exports[_0x9c25('0x4b')]=function(_0x51ac04,_0xb53766){var _0x3d8b1f={'raw':![],'where':{'id':_0x51ac04[_0x9c25('0x4c')]['id']}},_0x1bfd21={};_0x1bfd21[_0x9c25('0x35')]=_[_0x9c25('0x38')](db[_0x9c25('0x31')][_0x9c25('0x32')]);_0x1bfd21['query']=_[_0x9c25('0x38')](_0x51ac04[_0x9c25('0x37')]);_0x1bfd21[_0x9c25('0x39')]=_['intersection'](_0x1bfd21[_0x9c25('0x35')],_0x1bfd21[_0x9c25('0x37')]);_0x3d8b1f['attributes']=_['intersection'](_0x1bfd21[_0x9c25('0x35')],qs[_0x9c25('0x3c')](_0x51ac04[_0x9c25('0x37')][_0x9c25('0x3c')]));_0x3d8b1f['attributes']=_0x3d8b1f['attributes']['length']?_0x3d8b1f[_0x9c25('0x3a')]:_0x1bfd21[_0x9c25('0x35')];if(_0x51ac04[_0x9c25('0x37')]['includeAll']){_0x3d8b1f[_0x9c25('0x47')]=[{'all':!![]}];}_0x3d8b1f=_[_0x9c25('0x43')]({},_0x3d8b1f,_0x51ac04[_0x9c25('0x45')]);return db[_0x9c25('0x31')][_0x9c25('0x4d')](_0x3d8b1f)[_0x9c25('0x29')](handleEntityNotFound(_0xb53766,null))[_0x9c25('0x29')](respondWithResult(_0xb53766,null))[_0x9c25('0x4a')](handleError(_0xb53766,null));};exports['create']=function(_0x2c6d91,_0x46aa5c){return db['Team'][_0x9c25('0x4e')](_0x2c6d91['body'],{})[_0x9c25('0x29')](function(_0x57b47d){var _0x57fceb=_0x2c6d91['user']['get']({'plain':!![]});if(!_0x57fceb)throw new Error(_0x9c25('0x4f'));if(_0x57fceb[_0x9c25('0x50')]===_0x9c25('0x51')){var _0x31c5e8=_0x57b47d[_0x9c25('0x2b')]({'plain':!![]});var _0x4633ad=_0x9c25('0x52');return db[_0x9c25('0x53')][_0x9c25('0x4d')]({'where':{'name':_0x4633ad,'userProfileId':_0x57fceb['userProfileId']},'raw':!![]})['then'](function(_0x2bfa7e){if(_0x2bfa7e&&_0x2bfa7e['autoAssociation']===0x0){return db[_0x9c25('0x54')][_0x9c25('0x4e')]({'name':_0x31c5e8[_0x9c25('0x2f')],'resourceId':_0x31c5e8['id'],'type':_0x2bfa7e[_0x9c25('0x2f')],'sectionId':_0x2bfa7e['id']},{})[_0x9c25('0x29')](function(){return _0x57b47d;});}else{return _0x57b47d;}})[_0x9c25('0x4a')](function(_0x4fbcf2){logger[_0x9c25('0x2d')](_0x9c25('0x55'),_0x4fbcf2);throw _0x4fbcf2;});}return _0x57b47d;})['then'](respondWithResult(_0x46aa5c,0xc9))[_0x9c25('0x4a')](handleError(_0x46aa5c,null));};exports[_0x9c25('0x28')]=function(_0x30bf03,_0x394ee7){if(_0x30bf03[_0x9c25('0x56')]['id']){delete _0x30bf03[_0x9c25('0x56')]['id'];}return db[_0x9c25('0x31')][_0x9c25('0x4d')]({'where':{'id':_0x30bf03[_0x9c25('0x4c')]['id']}})[_0x9c25('0x29')](handleEntityNotFound(_0x394ee7,null))['then'](saveUpdates(_0x30bf03[_0x9c25('0x56')],null))[_0x9c25('0x29')](respondWithResult(_0x394ee7,null))['catch'](handleError(_0x394ee7,null));};exports[_0x9c25('0x2a')]=function(_0x57dd44,_0x585340){return db[_0x9c25('0x31')][_0x9c25('0x4d')]({'where':{'id':_0x57dd44['params']['id']}})[_0x9c25('0x29')](handleEntityNotFound(_0x585340,null))[_0x9c25('0x29')](removeEntity(_0x585340,null))['catch'](handleError(_0x585340,null));};exports[_0x9c25('0x57')]=function(_0x51dba0,_0x7a3ff2,_0x36a46f){return db['Team'][_0x9c25('0x58')]({'where':{'id':_0x51dba0[_0x9c25('0x4c')]['id']}})['then'](handleEntityNotFound(_0x7a3ff2,null))[_0x9c25('0x29')](function(_0x771140){if(!_0x51dba0['query'][_0x9c25('0x59')]||!utils[_0x9c25('0x5a')](_0x51dba0[_0x9c25('0x37')][_0x9c25('0x59')])){throw new db[(_0x9c25('0x5b'))][(_0x9c25('0x5c'))](_0x9c25('0x5d'));}var _0x491dc9={};var _0xab429d={};_0xab429d[_0x9c25('0x35')]=_['keys'](db[_['capitalize'](_0x51dba0[_0x9c25('0x37')][_0x9c25('0x59')]['toLowerCase']())+_0x9c25('0x5e')][_0x9c25('0x32')]);_0xab429d[_0x9c25('0x37')]=_[_0x9c25('0x38')](_0x51dba0[_0x9c25('0x37')]);_0xab429d[_0x9c25('0x39')]=_[_0x9c25('0x3b')](_0xab429d[_0x9c25('0x35')],_0xab429d[_0x9c25('0x37')]);_0x491dc9['attributes']=_[_0x9c25('0x3b')](_0xab429d[_0x9c25('0x35')],qs[_0x9c25('0x3c')](_0x51dba0[_0x9c25('0x37')][_0x9c25('0x3c')]));_0x491dc9[_0x9c25('0x3a')]=_0x491dc9[_0x9c25('0x3a')]['length']?_0x491dc9[_0x9c25('0x3a')]:_0xab429d['model'];_0x491dc9[_0x9c25('0x23')]=qs['limit'](_0x51dba0['query'][_0x9c25('0x23')]);_0x491dc9[_0x9c25('0x21')]=qs[_0x9c25('0x21')](_0x51dba0[_0x9c25('0x37')][_0x9c25('0x21')]);_0x491dc9[_0x9c25('0x3f')]=qs[_0x9c25('0x40')](_0x51dba0[_0x9c25('0x37')][_0x9c25('0x40')]);_0x491dc9[_0x9c25('0x41')]=qs[_0x9c25('0x39')](_[_0x9c25('0x5f')](_0x51dba0[_0x9c25('0x37')],_0xab429d[_0x9c25('0x39')]));_0x491dc9=_[_0x9c25('0x43')]({},_0x491dc9,_0x51dba0['options']);return _0x771140[_0x9c25('0x2b')+_[_0x9c25('0x60')](_0x51dba0[_0x9c25('0x37')]['channel']['toLowerCase']())+_0x9c25('0x61')](_0x491dc9);})[_0x9c25('0x29')](respondWithResult(_0x7a3ff2,null))[_0x9c25('0x4a')](handleError(_0x7a3ff2,null));};exports[_0x9c25('0x62')]=function(_0x3f97f7,_0x57e786,_0x31680f){return db[_0x9c25('0x31')][_0x9c25('0x58')]({'where':{'id':_0x3f97f7[_0x9c25('0x4c')]['id']}})[_0x9c25('0x29')](function(_0x3feaa1){if(_0x3feaa1){if(!_0x3f97f7[_0x9c25('0x56')][_0x9c25('0x59')]||!utils[_0x9c25('0x5a')](_0x3f97f7[_0x9c25('0x56')][_0x9c25('0x59')])){throw new db[(_0x9c25('0x5b'))][(_0x9c25('0x5c'))](_0x9c25('0x5d'));}return _0x3feaa1[_0x9c25('0x63')+_[_0x9c25('0x60')](_0x3f97f7['body'][_0x9c25('0x59')][_0x9c25('0x64')]())+_0x9c25('0x61')](_0x3f97f7[_0x9c25('0x56')]['ids']);}return null;})[_0x9c25('0x29')](handleEntityNotFound(_0x57e786,null))[_0x9c25('0x29')](respondWithStatusCode(_0x57e786,null))[_0x9c25('0x4a')](handleError(_0x57e786,null));};exports['removeQueues']=function(_0x5cc9f6,_0x2515a3,_0xafbb17){return db[_0x9c25('0x31')][_0x9c25('0x58')]({'where':{'id':_0x5cc9f6[_0x9c25('0x4c')]['id']}})['then'](function(_0x1cd020){if(_0x1cd020){if(!_0x5cc9f6[_0x9c25('0x37')]['channel']||!utils['isValidChannel'](_0x5cc9f6[_0x9c25('0x37')][_0x9c25('0x59')])){throw new db[(_0x9c25('0x5b'))]['ValidationError']('Unknown\x20channel');}return _0x1cd020[_0x9c25('0x65')+_[_0x9c25('0x60')](_0x5cc9f6[_0x9c25('0x37')][_0x9c25('0x59')][_0x9c25('0x64')]())+_0x9c25('0x61')](_0x5cc9f6[_0x9c25('0x37')]['ids']);}return null;})[_0x9c25('0x29')](handleEntityNotFound(_0x2515a3,null))[_0x9c25('0x29')](respondWithStatusCode(_0x2515a3,null))[_0x9c25('0x4a')](handleError(_0x2515a3,null));};exports[_0x9c25('0x66')]=function(_0x462c31,_0x4b33aa){return db[_0x9c25('0x31')][_0x9c25('0x4d')]({'where':{'id':_0x462c31[_0x9c25('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4b33aa,null))[_0x9c25('0x29')](function(_0xf22518){if(_0xf22518){var _0x966a86=['Voice',_0x9c25('0x67'),_0x9c25('0x68'),'Sms',_0x9c25('0x69'),_0x9c25('0x6a'),'Whatsapp'];return db[_0x9c25('0x6b')]['transaction'](function(_0x5112d3){var _0x17574a=_[_0x9c25('0x36')](_0x966a86,function(_0x386450){var _0x3f2f92={'attributes':['id','name']};if(_0x386450===_0x9c25('0x6c')){_0x3f2f92['through']={'attributes':[_0x9c25('0x6d')]};}return _0xf22518[_0x9c25('0x2b')+_0x386450+_0x9c25('0x61')](_0x3f2f92)['then'](function(_0x390be1){var _0x2675ae=_[_0x9c25('0x36')](_0x390be1,function(_0x1aaf0e){var _0x4f96b1=_[_0x9c25('0x36')](_0x462c31[_0x9c25('0x56')][_0x9c25('0x6e')],function(_0x3c7b19){var _0x285127={'where':{'UserId':_0x3c7b19,[_0x386450+_0x9c25('0x6f')]:_0x1aaf0e['id']},'transaction':_0x5112d3};if(_0x386450==='Voice'){_0x285127[_0x9c25('0x19')]={'penalty':_0x1aaf0e[_0x9c25('0x70')][_0x9c25('0x6d')]};}return db['User'+_0x386450+_0x9c25('0x5e')][_0x9c25('0x71')](_0x285127)[_0x9c25('0x29')](function(){socket['emit']('user'+_0x386450+_0x9c25('0x72'),{'UserId':_0x3c7b19,[_0x386450+'QueueId']:_0x1aaf0e['id']});if(_0x386450!=='Voice')return;return db[_0x9c25('0x73')][_0x9c25('0x48')]({'where':{'id':_0x462c31[_0x9c25('0x56')][_0x9c25('0x6e')],'online':0x1},'attributes':['id',_0x9c25('0x2f'),_0x9c25('0x74'),_0x9c25('0x75'),_0x9c25('0x76')],'raw':!![]})[_0x9c25('0x29')](function(_0x22c20f){var _0x3eaaf6=_[_0x9c25('0x36')](_0x22c20f,function(_0x1fd222){return db['UserVoiceQueueRt'][_0x9c25('0x77')]({'membername':_0x1fd222[_0x9c25('0x2f')],'UserId':_0x1fd222['id'],'queue_name':_0x1aaf0e[_0x9c25('0x2f')],'VoiceQueueId':_0x1aaf0e['id'],'interface':_[_0x9c25('0x78')](_0x1fd222[_0x9c25('0x76')])?util[_0x9c25('0x79')](_0x9c25('0x7a'),_0x1fd222[_0x9c25('0x2f')]):_0x1fd222[_0x9c25('0x76')],'paused':_0x1fd222[_0x9c25('0x75')]||![],'penalty':_0x1aaf0e['TeamVoiceQueue'][_0x9c25('0x6d')]},{'transaction':_0x5112d3});});return Promise[_0x9c25('0x7b')](_0x3eaaf6);});});});return Promise[_0x9c25('0x7b')](_0x4f96b1);});return Promise[_0x9c25('0x7b')](_0x2675ae);});});return Promise['all'](_0x17574a)[_0x9c25('0x29')](function(){return _0xf22518[_0x9c25('0x66')](_0x462c31['body']['ids'],{'transaction':_0x5112d3})['spread'](function(_0x17e5a0){return _0x17e5a0;});});});}})[_0x9c25('0x29')](respondWithResult(_0x4b33aa,null))[_0x9c25('0x4a')](handleError(_0x4b33aa,null));};exports[_0x9c25('0x7c')]=function(_0x6fa8fe,_0x738306){return db[_0x9c25('0x31')][_0x9c25('0x4d')]({'where':{'id':_0x6fa8fe['params']['id']}})['then'](handleEntityNotFound(_0x738306,null))['then'](function(_0x3d5dc5){if(_0x3d5dc5){var _0x173810=[_0x9c25('0x6c'),_0x9c25('0x67'),_0x9c25('0x68'),'Sms','Fax',_0x9c25('0x6a'),'Whatsapp'];return db[_0x9c25('0x6b')]['transaction'](function(_0x25fcdc){var _0x4c74f0=_[_0x9c25('0x36')](_0x173810,function(_0x34164c){var _0x410d0d={'attributes':['id',_0x9c25('0x2f')]};return _0x3d5dc5['get'+_0x34164c+_0x9c25('0x61')](_0x410d0d)['then'](function(_0x5aaadf){var _0x4a3586=_[_0x9c25('0x36')](_0x5aaadf,function(_0x37f79a){return _0x37f79a[_0x9c25('0x7c')](_0x6fa8fe[_0x9c25('0x37')][_0x9c25('0x6e')],{'transaction':_0x25fcdc})[_0x9c25('0x29')](function(){var _0x25d4fd=JSON[_0x9c25('0x7d')]('['+_0x6fa8fe['query']['ids']+']');var _0x1806b9=_['map'](_0x25d4fd,function(_0x3d1f69){socket[_0x9c25('0x7e')](_0x9c25('0x51')+_0x34164c+_0x9c25('0x7f'),{'UserId':Number(_0x3d1f69),[_0x34164c+_0x9c25('0x6f')]:_0x37f79a['id']});if(_0x34164c!==_0x9c25('0x6c'))return;return db['UserVoiceQueueRt'][_0x9c25('0x2a')]({'where':{'VoiceQueueId':_0x37f79a['id'],'UserId':_0x3d1f69},'transaction':_0x25fcdc});});return Promise[_0x9c25('0x7b')](_0x1806b9);});});return Promise[_0x9c25('0x7b')](_0x4a3586);});});return Promise[_0x9c25('0x7b')](_0x4c74f0)[_0x9c25('0x29')](function(){return _0x3d5dc5[_0x9c25('0x7c')](_0x6fa8fe['query'][_0x9c25('0x6e')],{'transaction':_0x25fcdc});});});}})[_0x9c25('0x29')](respondWithStatusCode(_0x738306,null))['catch'](handleError(_0x738306,null));};exports[_0x9c25('0x80')]=function(_0x36f55d,_0x2ff1cd,_0x3ce05f){var _0x7384ab={};var _0xf22c8e={};var _0x53140f;var _0x280ce5;return db[_0x9c25('0x31')][_0x9c25('0x58')]({'where':{'id':_0x36f55d[_0x9c25('0x4c')]['id']}})[_0x9c25('0x29')](handleEntityNotFound(_0x2ff1cd,null))[_0x9c25('0x29')](function(_0x12f3d6){if(_0x12f3d6){_0x53140f=_0x12f3d6;_0xf22c8e[_0x9c25('0x35')]=_[_0x9c25('0x38')](db[_0x9c25('0x73')][_0x9c25('0x32')]);_0xf22c8e[_0x9c25('0x37')]=_[_0x9c25('0x38')](_0x36f55d[_0x9c25('0x37')]);_0xf22c8e[_0x9c25('0x39')]=_['intersection'](_0xf22c8e['model'],_0xf22c8e[_0x9c25('0x37')]);_0x7384ab[_0x9c25('0x3a')]=_[_0x9c25('0x3b')](_0xf22c8e[_0x9c25('0x35')],qs['fields'](_0x36f55d[_0x9c25('0x37')]['fields']));_0x7384ab[_0x9c25('0x3a')]=_0x7384ab[_0x9c25('0x3a')][_0x9c25('0x3d')]?_0x7384ab[_0x9c25('0x3a')]:_0xf22c8e[_0x9c25('0x35')];_0x7384ab[_0x9c25('0x3f')]=qs['sort'](_0x36f55d[_0x9c25('0x37')]['sort']);_0x7384ab[_0x9c25('0x41')]=qs['filters'](_[_0x9c25('0x5f')](_0x36f55d[_0x9c25('0x37')],_0xf22c8e[_0x9c25('0x39')]));if(_0x36f55d[_0x9c25('0x37')][_0x9c25('0x42')]){_0x7384ab[_0x9c25('0x41')]=_[_0x9c25('0x43')](_0x7384ab[_0x9c25('0x41')],{'$or':_['map'](_0x7384ab[_0x9c25('0x3a')],function(_0x15e315){var _0x392fdf={};_0x392fdf[_0x15e315]={'$like':'%'+_0x36f55d[_0x9c25('0x37')][_0x9c25('0x42')]+'%'};return _0x392fdf;})});}_0x7384ab=_[_0x9c25('0x43')]({},_0x7384ab,_0x36f55d[_0x9c25('0x45')]);return _0x53140f[_0x9c25('0x80')](_0x7384ab);}})[_0x9c25('0x29')](function(_0x4b76d0){if(_0x4b76d0){_0x280ce5=_0x4b76d0['length'];if(!_0x36f55d[_0x9c25('0x37')][_0x9c25('0x3e')](_0x9c25('0x81'))){_0x7384ab[_0x9c25('0x23')]=qs['limit'](_0x36f55d['query']['limit']);_0x7384ab[_0x9c25('0x21')]=qs[_0x9c25('0x21')](_0x36f55d[_0x9c25('0x37')]['offset']);}return _0x53140f[_0x9c25('0x80')](_0x7384ab);}})[_0x9c25('0x29')](function(_0x50ce2f){if(_0x50ce2f){return _0x50ce2f?{'count':_0x280ce5,'rows':_0x50ce2f}:null;}})['then'](respondWithResult(_0x2ff1cd,null))['catch'](handleError(_0x2ff1cd,null));}; \ No newline at end of file +var _0xe2bc=['name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getQueues','findOne','channel','isValidChannel','Unknown\x20channel','toLowerCase','Queue','length','capitalize','Queues','addQueues','Sequelize','ValidationError','add','ids','remove','addAgents','Voice','Chat','Mail','Fax','Openchannel','Whatsapp','sequelize','transaction','through','penalty','QueueId','TeamVoiceQueue','Queue:save','User','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','voicePause','all','spread','removeAgents','Sms','parse','emit','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','Teams','sendStatus','error','send','index','map','Team','rawAttributes','fieldName','type','key','model'];(function(_0x4b33c0,_0x17fb55){var _0x43c889=function(_0x410c0d){while(--_0x410c0d){_0x4b33c0['push'](_0x4b33c0['shift']());}};_0x43c889(++_0x17fb55);}(_0xe2bc,0x15d));var _0xce2b=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xe2bc[_0x40220a];return _0x3903cc;};'use strict';var emlformat=require(_0xce2b('0x0'));var rimraf=require(_0xce2b('0x1'));var zipdir=require(_0xce2b('0x2'));var jsonpatch=require(_0xce2b('0x3'));var rp=require(_0xce2b('0x4'));var moment=require(_0xce2b('0x5'));var BPromise=require(_0xce2b('0x6'));var Mustache=require('mustache');var util=require(_0xce2b('0x7'));var path=require('path');var sox=require(_0xce2b('0x8'));var csv=require(_0xce2b('0x9'));var ejs=require(_0xce2b('0xa'));var fs=require('fs');var fs_extra=require(_0xce2b('0xb'));var _=require(_0xce2b('0xc'));var squel=require(_0xce2b('0xd'));var crypto=require(_0xce2b('0xe'));var jsforce=require(_0xce2b('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xce2b('0x10'));var Redis=require(_0xce2b('0x11'));var authService=require(_0xce2b('0x12'));var qs=require(_0xce2b('0x13'));var as=require(_0xce2b('0x14'));var hardwareService=require(_0xce2b('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xce2b('0x16'));var config=require(_0xce2b('0x17'));var licenseUtil=require(_0xce2b('0x18'));var db=require(_0xce2b('0x19'))['db'];config[_0xce2b('0x1a')]=_[_0xce2b('0x1b')](config['redis'],{'host':_0xce2b('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xce2b('0x1a')]));require('./team.socket')[_0xce2b('0x1d')](socket);function respondWithStatusCode(_0x3704e8,_0x3353b4){_0x3353b4=_0x3353b4||0xcc;return function(_0x32ff12){if(_0x32ff12){return _0x3704e8['sendStatus'](_0x3353b4);}return _0x3704e8[_0xce2b('0x1e')](_0x3353b4)[_0xce2b('0x1f')]();};}function respondWithResult(_0x3d645b,_0x38e84e){_0x38e84e=_0x38e84e||0xc8;return function(_0x36d2fd){if(_0x36d2fd){return _0x3d645b[_0xce2b('0x1e')](_0x38e84e)[_0xce2b('0x20')](_0x36d2fd);}};}function respondWithFilteredResult(_0x7bf304,_0x222114){return function(_0x85f7f9){if(_0x85f7f9){var _0x48d282=typeof _0x222114[_0xce2b('0x21')]==='undefined'&&typeof _0x222114[_0xce2b('0x22')]===_0xce2b('0x23');var _0x449404=_0x85f7f9[_0xce2b('0x24')];var _0x1226cf=_0x48d282?0x0:_0x222114['offset'];var _0x2785ba=_0x48d282?_0x85f7f9['count']:_0x222114['offset']+_0x222114[_0xce2b('0x22')];var _0x49b29b;if(_0x2785ba>=_0x449404){_0x2785ba=_0x449404;_0x49b29b=0xc8;}else{_0x49b29b=0xce;}_0x7bf304['status'](_0x49b29b);return _0x7bf304[_0xce2b('0x25')]('Content-Range',_0x1226cf+'-'+_0x2785ba+'/'+_0x449404)['json'](_0x85f7f9);}return null;};}function patchUpdates(_0x3fa8bf){return function(_0x1ccfad){try{jsonpatch[_0xce2b('0x26')](_0x1ccfad,_0x3fa8bf,!![]);}catch(_0x448936){return BPromise[_0xce2b('0x27')](_0x448936);}return _0x1ccfad[_0xce2b('0x28')]();};}function saveUpdates(_0x59b254,_0x52b5d4){return function(_0x3affe7){if(_0x3affe7){return _0x3affe7[_0xce2b('0x29')](_0x59b254)[_0xce2b('0x2a')](function(_0x440523){return _0x440523;});}return null;};}function removeEntity(_0xc3329b,_0x29c6d0){return function(_0x51e852){if(_0x51e852){return _0x51e852[_0xce2b('0x2b')]()[_0xce2b('0x2a')](function(){var _0x112414=_0x51e852['get']({'plain':!![]});var _0x330602=_0xce2b('0x2c');return db['UserProfileResource'][_0xce2b('0x2b')]({'where':{'type':_0x330602,'resourceId':_0x112414['id']}})[_0xce2b('0x2a')](function(){return _0x51e852;});})['then'](function(){_0xc3329b[_0xce2b('0x1e')](0xcc)[_0xce2b('0x1f')]();});}};}function handleEntityNotFound(_0x595e11,_0x7e56b2){return function(_0x3565c6){if(!_0x3565c6){_0x595e11[_0xce2b('0x2d')](0x194);}return _0x3565c6;};}function handleError(_0x49c1cc,_0x5068ee){_0x5068ee=_0x5068ee||0x1f4;return function(_0x41ee30){logger[_0xce2b('0x2e')](_0x41ee30['stack']);if(_0x41ee30['name']){delete _0x41ee30['name'];}_0x49c1cc[_0xce2b('0x1e')](_0x5068ee)[_0xce2b('0x2f')](_0x41ee30);};}exports[_0xce2b('0x30')]=function(_0x1b3473,_0x54aa50){var _0x1bcfc6={},_0x1281e8={},_0x193d41={'count':0x0,'rows':[]};var _0x571f75=_[_0xce2b('0x31')](db[_0xce2b('0x32')][_0xce2b('0x33')],function(_0x6c747e){return{'name':_0x6c747e[_0xce2b('0x34')],'type':_0x6c747e[_0xce2b('0x35')][_0xce2b('0x36')]};});_0x1281e8[_0xce2b('0x37')]=_[_0xce2b('0x31')](_0x571f75,_0xce2b('0x38'));_0x1281e8[_0xce2b('0x39')]=_[_0xce2b('0x3a')](_0x1b3473['query']);_0x1281e8[_0xce2b('0x3b')]=_[_0xce2b('0x3c')](_0x1281e8['model'],_0x1281e8[_0xce2b('0x39')]);_0x1bcfc6[_0xce2b('0x3d')]=_[_0xce2b('0x3c')](_0x1281e8[_0xce2b('0x37')],qs[_0xce2b('0x3e')](_0x1b3473[_0xce2b('0x39')][_0xce2b('0x3e')]));_0x1bcfc6[_0xce2b('0x3d')]=_0x1bcfc6['attributes']['length']?_0x1bcfc6[_0xce2b('0x3d')]:_0x1281e8[_0xce2b('0x37')];if(!_0x1b3473[_0xce2b('0x39')][_0xce2b('0x3f')](_0xce2b('0x40'))){_0x1bcfc6[_0xce2b('0x22')]=qs[_0xce2b('0x22')](_0x1b3473[_0xce2b('0x39')]['limit']);_0x1bcfc6['offset']=qs[_0xce2b('0x21')](_0x1b3473[_0xce2b('0x39')][_0xce2b('0x21')]);}_0x1bcfc6['order']=qs[_0xce2b('0x41')](_0x1b3473[_0xce2b('0x39')][_0xce2b('0x41')]);_0x1bcfc6[_0xce2b('0x42')]=qs[_0xce2b('0x3b')](_[_0xce2b('0x43')](_0x1b3473[_0xce2b('0x39')],_0x1281e8['filters']),_0x571f75);if(_0x1b3473[_0xce2b('0x39')][_0xce2b('0x44')]){_0x1bcfc6[_0xce2b('0x42')]=_[_0xce2b('0x45')](_0x1bcfc6['where'],{'$or':_[_0xce2b('0x31')](_0x571f75,function(_0x2d35a1){if(_0x2d35a1[_0xce2b('0x35')]!==_0xce2b('0x46')){var _0x345c8b={};_0x345c8b[_0x2d35a1[_0xce2b('0x38')]]={'$like':'%'+_0x1b3473[_0xce2b('0x39')][_0xce2b('0x44')]+'%'};return _0x345c8b;}})});}_0x1bcfc6=_[_0xce2b('0x45')]({},_0x1bcfc6,_0x1b3473[_0xce2b('0x47')]);var _0x34f08d={'where':_0x1bcfc6[_0xce2b('0x42')]};return db[_0xce2b('0x32')][_0xce2b('0x24')](_0x34f08d)[_0xce2b('0x2a')](function(_0x47aec1){_0x193d41[_0xce2b('0x24')]=_0x47aec1;if(_0x1b3473['query']['includeAll']){_0x1bcfc6[_0xce2b('0x48')]=[{'all':!![]}];}return db[_0xce2b('0x32')][_0xce2b('0x49')](_0x1bcfc6);})[_0xce2b('0x2a')](function(_0x4fad81){_0x193d41[_0xce2b('0x4a')]=_0x4fad81;return _0x193d41;})['then'](respondWithFilteredResult(_0x54aa50,_0x1bcfc6))[_0xce2b('0x4b')](handleError(_0x54aa50,null));};exports[_0xce2b('0x4c')]=function(_0x369300,_0x39f1eb){var _0x3e671b={'raw':![],'where':{'id':_0x369300[_0xce2b('0x4d')]['id']}},_0x3a77df={};_0x3a77df[_0xce2b('0x37')]=_[_0xce2b('0x3a')](db['Team'][_0xce2b('0x33')]);_0x3a77df[_0xce2b('0x39')]=_['keys'](_0x369300[_0xce2b('0x39')]);_0x3a77df[_0xce2b('0x3b')]=_[_0xce2b('0x3c')](_0x3a77df[_0xce2b('0x37')],_0x3a77df['query']);_0x3e671b[_0xce2b('0x3d')]=_[_0xce2b('0x3c')](_0x3a77df[_0xce2b('0x37')],qs[_0xce2b('0x3e')](_0x369300['query'][_0xce2b('0x3e')]));_0x3e671b[_0xce2b('0x3d')]=_0x3e671b['attributes']['length']?_0x3e671b[_0xce2b('0x3d')]:_0x3a77df['model'];if(_0x369300[_0xce2b('0x39')]['includeAll']){_0x3e671b['include']=[{'all':!![]}];}_0x3e671b=_['merge']({},_0x3e671b,_0x369300[_0xce2b('0x47')]);return db['Team'][_0xce2b('0x4e')](_0x3e671b)['then'](handleEntityNotFound(_0x39f1eb,null))[_0xce2b('0x2a')](respondWithResult(_0x39f1eb,null))[_0xce2b('0x4b')](handleError(_0x39f1eb,null));};exports[_0xce2b('0x4f')]=function(_0x320bd2,_0x55afea){return db[_0xce2b('0x32')][_0xce2b('0x4f')](_0x320bd2[_0xce2b('0x50')],{})['then'](function(_0x1dc631){var _0x1c4a1e=_0x320bd2[_0xce2b('0x51')]['get']({'plain':!![]});if(!_0x1c4a1e)throw new Error(_0xce2b('0x52'));if(_0x1c4a1e[_0xce2b('0x53')]==='user'){var _0x52365f=_0x1dc631[_0xce2b('0x54')]({'plain':!![]});var _0x38ce97=_0xce2b('0x2c');return db[_0xce2b('0x55')]['find']({'where':{'name':_0x38ce97,'userProfileId':_0x1c4a1e[_0xce2b('0x56')]},'raw':!![]})[_0xce2b('0x2a')](function(_0xc18150){if(_0xc18150&&_0xc18150[_0xce2b('0x57')]===0x0){return db[_0xce2b('0x58')][_0xce2b('0x4f')]({'name':_0x52365f['name'],'resourceId':_0x52365f['id'],'type':_0xc18150[_0xce2b('0x38')],'sectionId':_0xc18150['id']},{})[_0xce2b('0x2a')](function(){return _0x1dc631;});}else{return _0x1dc631;}})[_0xce2b('0x4b')](function(_0x51dd3a){logger[_0xce2b('0x2e')](_0xce2b('0x59'),_0x51dd3a);throw _0x51dd3a;});}return _0x1dc631;})['then'](respondWithResult(_0x55afea,0xc9))[_0xce2b('0x4b')](handleError(_0x55afea,null));};exports[_0xce2b('0x29')]=function(_0x2aab6c,_0x3bd5d9){if(_0x2aab6c[_0xce2b('0x50')]['id']){delete _0x2aab6c['body']['id'];}return db[_0xce2b('0x32')]['find']({'where':{'id':_0x2aab6c[_0xce2b('0x4d')]['id']}})[_0xce2b('0x2a')](handleEntityNotFound(_0x3bd5d9,null))['then'](saveUpdates(_0x2aab6c['body'],null))[_0xce2b('0x2a')](respondWithResult(_0x3bd5d9,null))[_0xce2b('0x4b')](handleError(_0x3bd5d9,null));};exports[_0xce2b('0x2b')]=function(_0x1fbbfa,_0x72f20b){return db[_0xce2b('0x32')][_0xce2b('0x4e')]({'where':{'id':_0x1fbbfa[_0xce2b('0x4d')]['id']}})['then'](handleEntityNotFound(_0x72f20b,null))['then'](removeEntity(_0x72f20b,null))[_0xce2b('0x4b')](handleError(_0x72f20b,null));};exports[_0xce2b('0x5a')]=function(_0x5bc6b2,_0x1187d3,_0x1b64b6){return db[_0xce2b('0x32')][_0xce2b('0x5b')]({'where':{'id':_0x5bc6b2[_0xce2b('0x4d')]['id']}})[_0xce2b('0x2a')](handleEntityNotFound(_0x1187d3,null))[_0xce2b('0x2a')](function(_0x7b185e){if(!_0x5bc6b2[_0xce2b('0x39')][_0xce2b('0x5c')]||!utils[_0xce2b('0x5d')](_0x5bc6b2['query'][_0xce2b('0x5c')])){throw new db['Sequelize']['ValidationError'](_0xce2b('0x5e'));}var _0x10b665={};var _0xc4312e={};_0xc4312e['model']=_[_0xce2b('0x3a')](db[_['capitalize'](_0x5bc6b2[_0xce2b('0x39')][_0xce2b('0x5c')][_0xce2b('0x5f')]())+_0xce2b('0x60')][_0xce2b('0x33')]);_0xc4312e[_0xce2b('0x39')]=_['keys'](_0x5bc6b2[_0xce2b('0x39')]);_0xc4312e[_0xce2b('0x3b')]=_[_0xce2b('0x3c')](_0xc4312e[_0xce2b('0x37')],_0xc4312e[_0xce2b('0x39')]);_0x10b665['attributes']=_[_0xce2b('0x3c')](_0xc4312e[_0xce2b('0x37')],qs['fields'](_0x5bc6b2[_0xce2b('0x39')][_0xce2b('0x3e')]));_0x10b665[_0xce2b('0x3d')]=_0x10b665['attributes'][_0xce2b('0x61')]?_0x10b665[_0xce2b('0x3d')]:_0xc4312e['model'];_0x10b665[_0xce2b('0x22')]=qs['limit'](_0x5bc6b2[_0xce2b('0x39')][_0xce2b('0x22')]);_0x10b665['offset']=qs[_0xce2b('0x21')](_0x5bc6b2[_0xce2b('0x39')][_0xce2b('0x21')]);_0x10b665['order']=qs[_0xce2b('0x41')](_0x5bc6b2['query']['sort']);_0x10b665[_0xce2b('0x42')]=qs[_0xce2b('0x3b')](_[_0xce2b('0x43')](_0x5bc6b2['query'],_0xc4312e[_0xce2b('0x3b')]));_0x10b665=_[_0xce2b('0x45')]({},_0x10b665,_0x5bc6b2['options']);return _0x7b185e[_0xce2b('0x54')+_[_0xce2b('0x62')](_0x5bc6b2[_0xce2b('0x39')][_0xce2b('0x5c')][_0xce2b('0x5f')]())+_0xce2b('0x63')](_0x10b665);})['then'](respondWithResult(_0x1187d3,null))['catch'](handleError(_0x1187d3,null));};exports[_0xce2b('0x64')]=function(_0x349b30,_0x70bfbb,_0x345502){return db[_0xce2b('0x32')]['findOne']({'where':{'id':_0x349b30['params']['id']}})['then'](function(_0x241c2a){if(_0x241c2a){if(!_0x349b30[_0xce2b('0x50')][_0xce2b('0x5c')]||!utils[_0xce2b('0x5d')](_0x349b30[_0xce2b('0x50')][_0xce2b('0x5c')])){throw new db[(_0xce2b('0x65'))][(_0xce2b('0x66'))](_0xce2b('0x5e'));}return _0x241c2a[_0xce2b('0x67')+_[_0xce2b('0x62')](_0x349b30[_0xce2b('0x50')][_0xce2b('0x5c')][_0xce2b('0x5f')]())+_0xce2b('0x63')](_0x349b30['body'][_0xce2b('0x68')]);}return null;})[_0xce2b('0x2a')](handleEntityNotFound(_0x70bfbb,null))[_0xce2b('0x2a')](respondWithStatusCode(_0x70bfbb,null))[_0xce2b('0x4b')](handleError(_0x70bfbb,null));};exports['removeQueues']=function(_0x5a36fe,_0x2f7858,_0x2fd7d3){return db['Team'][_0xce2b('0x5b')]({'where':{'id':_0x5a36fe[_0xce2b('0x4d')]['id']}})[_0xce2b('0x2a')](function(_0x3ab246){if(_0x3ab246){if(!_0x5a36fe[_0xce2b('0x39')]['channel']||!utils[_0xce2b('0x5d')](_0x5a36fe[_0xce2b('0x39')][_0xce2b('0x5c')])){throw new db[(_0xce2b('0x65'))][(_0xce2b('0x66'))]('Unknown\x20channel');}return _0x3ab246[_0xce2b('0x69')+_[_0xce2b('0x62')](_0x5a36fe[_0xce2b('0x39')]['channel'][_0xce2b('0x5f')]())+_0xce2b('0x63')](_0x5a36fe[_0xce2b('0x39')]['ids']);}return null;})['then'](handleEntityNotFound(_0x2f7858,null))[_0xce2b('0x2a')](respondWithStatusCode(_0x2f7858,null))[_0xce2b('0x4b')](handleError(_0x2f7858,null));};exports[_0xce2b('0x6a')]=function(_0x51cd43,_0x7025f1){return db['Team'][_0xce2b('0x4e')]({'where':{'id':_0x51cd43[_0xce2b('0x4d')]['id']}})[_0xce2b('0x2a')](handleEntityNotFound(_0x7025f1,null))[_0xce2b('0x2a')](function(_0x18375e){if(_0x18375e){var _0x2af4bf=[_0xce2b('0x6b'),_0xce2b('0x6c'),_0xce2b('0x6d'),'Sms',_0xce2b('0x6e'),_0xce2b('0x6f'),_0xce2b('0x70')];return db[_0xce2b('0x71')][_0xce2b('0x72')](function(_0x1a4df7){var _0x25cbf9=_[_0xce2b('0x31')](_0x2af4bf,function(_0xa4a220){var _0x1da0ff={'attributes':['id',_0xce2b('0x38')]};if(_0xa4a220===_0xce2b('0x6b')){_0x1da0ff[_0xce2b('0x73')]={'attributes':[_0xce2b('0x74')]};}return _0x18375e[_0xce2b('0x54')+_0xa4a220+_0xce2b('0x63')](_0x1da0ff)['then'](function(_0x50cd7a){var _0x57c716=_[_0xce2b('0x31')](_0x50cd7a,function(_0x5cd7b1){var _0x5be2c4=_[_0xce2b('0x31')](_0x51cd43[_0xce2b('0x50')][_0xce2b('0x68')],function(_0x3cee1b){var _0x46a25e={'where':{'UserId':_0x3cee1b,[_0xa4a220+_0xce2b('0x75')]:_0x5cd7b1['id']},'transaction':_0x1a4df7};if(_0xa4a220===_0xce2b('0x6b')){_0x46a25e[_0xce2b('0x1b')]={'penalty':_0x5cd7b1[_0xce2b('0x76')][_0xce2b('0x74')]};}return db['User'+_0xa4a220+_0xce2b('0x60')]['findOrCreate'](_0x46a25e)[_0xce2b('0x2a')](function(){socket['emit']('user'+_0xa4a220+_0xce2b('0x77'),{'UserId':_0x3cee1b,[_0xa4a220+'QueueId']:_0x5cd7b1['id']});if(_0xa4a220!==_0xce2b('0x6b'))return;return db[_0xce2b('0x78')][_0xce2b('0x49')]({'where':{'id':_0x51cd43[_0xce2b('0x50')][_0xce2b('0x68')],'online':0x1},'attributes':['id',_0xce2b('0x38'),'online','voicePause',_0xce2b('0x79')],'raw':!![]})[_0xce2b('0x2a')](function(_0x5be272){var _0x4f7a67=_['map'](_0x5be272,function(_0x455bf4){return db[_0xce2b('0x7a')][_0xce2b('0x7b')]({'membername':_0x455bf4[_0xce2b('0x38')],'UserId':_0x455bf4['id'],'queue_name':_0x5cd7b1[_0xce2b('0x38')],'VoiceQueueId':_0x5cd7b1['id'],'interface':_[_0xce2b('0x7c')](_0x455bf4[_0xce2b('0x79')])?util[_0xce2b('0x7d')](_0xce2b('0x7e'),_0x455bf4['name']):_0x455bf4[_0xce2b('0x79')],'paused':_0x455bf4[_0xce2b('0x7f')]||![],'penalty':_0x5cd7b1['TeamVoiceQueue'][_0xce2b('0x74')]},{'transaction':_0x1a4df7});});return Promise[_0xce2b('0x80')](_0x4f7a67);});});});return Promise['all'](_0x5be2c4);});return Promise[_0xce2b('0x80')](_0x57c716);});});return Promise[_0xce2b('0x80')](_0x25cbf9)[_0xce2b('0x2a')](function(){return _0x18375e['addAgents'](_0x51cd43['body'][_0xce2b('0x68')],{'transaction':_0x1a4df7})[_0xce2b('0x81')](function(_0x16db08){return _0x16db08;});});});}})['then'](respondWithResult(_0x7025f1,null))[_0xce2b('0x4b')](handleError(_0x7025f1,null));};exports[_0xce2b('0x82')]=function(_0x5cde89,_0x10ce95){return db['Team'][_0xce2b('0x4e')]({'where':{'id':_0x5cde89['params']['id']}})[_0xce2b('0x2a')](handleEntityNotFound(_0x10ce95,null))[_0xce2b('0x2a')](function(_0x247c00){if(_0x247c00){var _0x46538d=[_0xce2b('0x6b'),'Chat','Mail',_0xce2b('0x83'),_0xce2b('0x6e'),_0xce2b('0x6f'),'Whatsapp'];return db[_0xce2b('0x71')][_0xce2b('0x72')](function(_0x39eda8){var _0x131850=_['map'](_0x46538d,function(_0x21937f){var _0x596f59={'attributes':['id',_0xce2b('0x38')]};return _0x247c00[_0xce2b('0x54')+_0x21937f+_0xce2b('0x63')](_0x596f59)[_0xce2b('0x2a')](function(_0x4ec2bb){var _0x1a5649=_['map'](_0x4ec2bb,function(_0x591a76){return _0x591a76[_0xce2b('0x82')](_0x5cde89[_0xce2b('0x39')][_0xce2b('0x68')],{'transaction':_0x39eda8})[_0xce2b('0x2a')](function(){var _0x836e8f=JSON[_0xce2b('0x84')]('['+_0x5cde89[_0xce2b('0x39')][_0xce2b('0x68')]+']');var _0xd15472=_[_0xce2b('0x31')](_0x836e8f,function(_0x33f133){socket[_0xce2b('0x85')](_0xce2b('0x51')+_0x21937f+'Queue:remove',{'UserId':Number(_0x33f133),[_0x21937f+_0xce2b('0x75')]:_0x591a76['id']});if(_0x21937f!==_0xce2b('0x6b'))return;return db[_0xce2b('0x7a')][_0xce2b('0x2b')]({'where':{'VoiceQueueId':_0x591a76['id'],'UserId':_0x33f133},'transaction':_0x39eda8});});return Promise['all'](_0xd15472);});});return Promise['all'](_0x1a5649);});});return Promise['all'](_0x131850)[_0xce2b('0x2a')](function(){return _0x247c00[_0xce2b('0x82')](_0x5cde89['query'][_0xce2b('0x68')],{'transaction':_0x39eda8});});});}})[_0xce2b('0x2a')](respondWithStatusCode(_0x10ce95,null))[_0xce2b('0x4b')](handleError(_0x10ce95,null));};exports[_0xce2b('0x86')]=function(_0x715961,_0x2e1963,_0x27bf8e){var _0x12bc74={};var _0xda617a={};var _0x5288a4;var _0x3d3801;return db[_0xce2b('0x32')][_0xce2b('0x5b')]({'where':{'id':_0x715961['params']['id']}})[_0xce2b('0x2a')](handleEntityNotFound(_0x2e1963,null))['then'](function(_0x2e2ec5){if(_0x2e2ec5){_0x5288a4=_0x2e2ec5;_0xda617a[_0xce2b('0x37')]=_[_0xce2b('0x3a')](db['User'][_0xce2b('0x33')]);_0xda617a['query']=_['keys'](_0x715961['query']);_0xda617a[_0xce2b('0x3b')]=_[_0xce2b('0x3c')](_0xda617a[_0xce2b('0x37')],_0xda617a[_0xce2b('0x39')]);_0x12bc74[_0xce2b('0x3d')]=_[_0xce2b('0x3c')](_0xda617a[_0xce2b('0x37')],qs[_0xce2b('0x3e')](_0x715961['query'][_0xce2b('0x3e')]));_0x12bc74[_0xce2b('0x3d')]=_0x12bc74[_0xce2b('0x3d')]['length']?_0x12bc74['attributes']:_0xda617a[_0xce2b('0x37')];_0x12bc74['order']=qs[_0xce2b('0x41')](_0x715961[_0xce2b('0x39')][_0xce2b('0x41')]);_0x12bc74[_0xce2b('0x42')]=qs[_0xce2b('0x3b')](_['pick'](_0x715961[_0xce2b('0x39')],_0xda617a[_0xce2b('0x3b')]));if(_0x715961[_0xce2b('0x39')]['filter']){_0x12bc74[_0xce2b('0x42')]=_[_0xce2b('0x45')](_0x12bc74['where'],{'$or':_[_0xce2b('0x31')](_0x12bc74[_0xce2b('0x3d')],function(_0x3f6c92){var _0x15ba85={};_0x15ba85[_0x3f6c92]={'$like':'%'+_0x715961[_0xce2b('0x39')]['filter']+'%'};return _0x15ba85;})});}_0x12bc74=_[_0xce2b('0x45')]({},_0x12bc74,_0x715961[_0xce2b('0x47')]);return _0x5288a4[_0xce2b('0x86')](_0x12bc74);}})[_0xce2b('0x2a')](function(_0x6c0227){if(_0x6c0227){_0x3d3801=_0x6c0227[_0xce2b('0x61')];if(!_0x715961['query'][_0xce2b('0x3f')](_0xce2b('0x40'))){_0x12bc74[_0xce2b('0x22')]=qs[_0xce2b('0x22')](_0x715961['query'][_0xce2b('0x22')]);_0x12bc74[_0xce2b('0x21')]=qs[_0xce2b('0x21')](_0x715961[_0xce2b('0x39')]['offset']);}return _0x5288a4['getAgents'](_0x12bc74);}})[_0xce2b('0x2a')](function(_0x5d4ce2){if(_0x5d4ce2){return _0x5d4ce2?{'count':_0x3d3801,'rows':_0x5d4ce2}:null;}})[_0xce2b('0x2a')](respondWithResult(_0x2e1963,null))[_0xce2b('0x4b')](handleError(_0x2e1963,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 9453d3f..ac1f6f0 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 _0x657c=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','../../mysqldb','Team'];(function(_0x2278d1,_0x32a372){var _0x22442b=function(_0x5df6f9){while(--_0x5df6f9){_0x2278d1['push'](_0x2278d1['shift']());}};_0x22442b(++_0x32a372);}(_0x657c,0x19c));var _0xc657=function(_0x123450,_0x491c01){_0x123450=_0x123450-0x0;var _0x23b29d=_0x657c[_0x123450];return _0x23b29d;};'use strict';var EventEmitter=require('events');var Team=require(_0xc657('0x0'))['db'][_0xc657('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0xc657('0x2')](0x0);var events={'afterCreate':_0xc657('0x3'),'afterUpdate':_0xc657('0x4'),'afterDestroy':_0xc657('0x5')};function emitEvent(_0x418770){return function(_0x1742d2,_0x2b2f5a,_0x4bce27){TeamEvents[_0xc657('0x6')](_0x418770+':'+_0x1742d2['id'],_0x1742d2);TeamEvents[_0xc657('0x6')](_0x418770,_0x1742d2);_0x4bce27(null);};}for(var e in events){if(events[_0xc657('0x7')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0xc657('0x8')]=TeamEvents; \ No newline at end of file +var _0x5b2e=['Team','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x10a951,_0x5da875){var _0x6da0d=function(_0x249416){while(--_0x249416){_0x10a951['push'](_0x10a951['shift']());}};_0x6da0d(++_0x5da875);}(_0x5b2e,0x182));var _0xe5b2=function(_0x229c24,_0x3ca85c){_0x229c24=_0x229c24-0x0;var _0x1a0d45=_0x5b2e[_0x229c24];return _0x1a0d45;};'use strict';var EventEmitter=require('events');var Team=require(_0xe5b2('0x0'))['db'][_0xe5b2('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0xe5b2('0x2')](0x0);var events={'afterCreate':_0xe5b2('0x3'),'afterUpdate':_0xe5b2('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2fc08b){return function(_0x335fa8,_0x5ac90d,_0x56f4cb){TeamEvents[_0xe5b2('0x5')](_0x2fc08b+':'+_0x335fa8['id'],_0x335fa8);TeamEvents[_0xe5b2('0x5')](_0x2fc08b,_0x335fa8);_0x56f4cb(null);};}for(var e in events){if(events[_0xe5b2('0x6')](e)){var event=events[e];Team[_0xe5b2('0x7')](e,emitEvent(event));}}module[_0xe5b2('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 307377c..e44551b 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 _0x06d0=['exports','define','Team','lodash','util','api','moment','bluebird','rimraf','../../config/environment','./team.attributes'];(function(_0x3554c5,_0x350da9){var _0x225fa6=function(_0x69e398){while(--_0x69e398){_0x3554c5['push'](_0x3554c5['shift']());}};_0x225fa6(++_0x350da9);}(_0x06d0,0x66));var _0x006d=function(_0x2cf452,_0x763cf3){_0x2cf452=_0x2cf452-0x0;var _0x1eef13=_0x06d0[_0x2cf452];return _0x1eef13;};'use strict';var _=require(_0x006d('0x0'));var util=require(_0x006d('0x1'));var logger=require('../../config/logger')(_0x006d('0x2'));var moment=require(_0x006d('0x3'));var BPromise=require(_0x006d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x006d('0x5'));var config=require(_0x006d('0x6'));var attributes=require(_0x006d('0x7'));module[_0x006d('0x8')]=function(_0x32a5f7,_0x4a08bd){return _0x32a5f7[_0x006d('0x9')](_0x006d('0xa'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ff8=['rimraf','../../config/environment','./team.attributes','define','lodash','util','api','moment','bluebird','request-promise'];(function(_0x3890d7,_0x5d6229){var _0x224e89=function(_0x2d82f0){while(--_0x2d82f0){_0x3890d7['push'](_0x3890d7['shift']());}};_0x224e89(++_0x5d6229);}(_0x4ff8,0x86));var _0x84ff=function(_0x4e00af,_0xd9c39a){_0x4e00af=_0x4e00af-0x0;var _0x3c606f=_0x4ff8[_0x4e00af];return _0x3c606f;};'use strict';var _=require(_0x84ff('0x0'));var util=require(_0x84ff('0x1'));var logger=require('../../config/logger')(_0x84ff('0x2'));var moment=require(_0x84ff('0x3'));var BPromise=require(_0x84ff('0x4'));var rp=require(_0x84ff('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x84ff('0x6'));var config=require(_0x84ff('0x7'));var attributes=require(_0x84ff('0x8'));module['exports']=function(_0x47541a,_0xac264d){return _0x47541a[_0x84ff('0x9')]('Team',attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index aadf0b7..68a253c 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 _0x1696=['result','lodash','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','request','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0x1696,0x141));var _0x6169=function(_0x766aae,_0x415039){_0x766aae=_0x766aae-0x0;var _0x2af69c=_0x1696[_0x766aae];return _0x2af69c;};'use strict';var _=require(_0x6169('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6169('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6169('0x2'));var logger=require(_0x6169('0x3'))('rpc');var config=require(_0x6169('0x4'));var jayson=require(_0x6169('0x5'));var client=jayson['client'][_0x6169('0x6')]({'port':0x232a});config[_0x6169('0x7')]=_[_0x6169('0x8')](config[_0x6169('0x7')],{'host':_0x6169('0x9'),'port':0x18eb});var socket=require(_0x6169('0xa'))(new Redis(config['redis']));require('./team.socket')['register'](socket);function respondWithRpcPromise(_0x3699dc,_0x1aa529,_0x1ce434){return new BPromise(function(_0x4428a0,_0x41c7d5){return client[_0x6169('0xb')](_0x3699dc,_0x1ce434)['then'](function(_0x43ebca){logger[_0x6169('0xc')](_0x6169('0xd'),_0x1aa529,_0x6169('0xe'));logger['debug'](_0x6169('0xf'),_0x1aa529,_0x6169('0xe'),JSON[_0x6169('0x10')](_0x43ebca));if(_0x43ebca[_0x6169('0x11')]){if(_0x43ebca[_0x6169('0x11')]['code']===0x1f4){logger[_0x6169('0x11')]('Team,\x20%s,\x20%s',_0x1aa529,_0x43ebca['error'][_0x6169('0x12')]);return _0x41c7d5(_0x43ebca[_0x6169('0x11')]['message']);}logger[_0x6169('0x11')](_0x6169('0xd'),_0x1aa529,_0x43ebca[_0x6169('0x11')]['message']);return _0x4428a0(_0x43ebca['error']['message']);}else{logger[_0x6169('0xc')](_0x6169('0xd'),_0x1aa529,_0x6169('0xe'));_0x4428a0(_0x43ebca[_0x6169('0x13')][_0x6169('0x12')]);}})['catch'](function(_0x2b470f){logger[_0x6169('0x11')](_0x6169('0xd'),_0x1aa529,_0x2b470f);_0x41c7d5(_0x2b470f);});});} \ No newline at end of file +var _0xb140=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','Team,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2c815f,_0x5a4823){var _0xda8b8f=function(_0x3405ca){while(--_0x3405ca){_0x2c815f['push'](_0x2c815f['shift']());}};_0xda8b8f(++_0x5a4823);}(_0xb140,0xb1));var _0x0b14=function(_0x4289ed,_0x2c7b8f){_0x4289ed=_0x4289ed-0x0;var _0x2f5317=_0xb140[_0x4289ed];return _0x2f5317;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0b14('0x0'));var BPromise=require('bluebird');var rs=require(_0x0b14('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0b14('0x2'))['db'];var utils=require(_0x0b14('0x3'));var logger=require(_0x0b14('0x4'))(_0x0b14('0x5'));var config=require(_0x0b14('0x6'));var jayson=require(_0x0b14('0x7'));var client=jayson[_0x0b14('0x8')][_0x0b14('0x9')]({'port':0x232a});config[_0x0b14('0xa')]=_[_0x0b14('0xb')](config['redis'],{'host':_0x0b14('0xc'),'port':0x18eb});var socket=require(_0x0b14('0xd'))(new Redis(config[_0x0b14('0xa')]));require(_0x0b14('0xe'))[_0x0b14('0xf')](socket);function respondWithRpcPromise(_0x168757,_0x4db89e,_0x585100){return new BPromise(function(_0x33c031,_0x401458){return client['request'](_0x168757,_0x585100)['then'](function(_0xe3e6e1){logger['info'](_0x0b14('0x10'),_0x4db89e,_0x0b14('0x11'));logger[_0x0b14('0x12')]('Team,\x20%s,\x20%s,\x20%s',_0x4db89e,'request\x20sent',JSON[_0x0b14('0x13')](_0xe3e6e1));if(_0xe3e6e1[_0x0b14('0x14')]){if(_0xe3e6e1[_0x0b14('0x14')][_0x0b14('0x15')]===0x1f4){logger[_0x0b14('0x14')]('Team,\x20%s,\x20%s',_0x4db89e,_0xe3e6e1[_0x0b14('0x14')][_0x0b14('0x16')]);return _0x401458(_0xe3e6e1['error'][_0x0b14('0x16')]);}logger[_0x0b14('0x14')](_0x0b14('0x10'),_0x4db89e,_0xe3e6e1['error'][_0x0b14('0x16')]);return _0x33c031(_0xe3e6e1['error']['message']);}else{logger[_0x0b14('0x17')](_0x0b14('0x10'),_0x4db89e,'request\x20sent');_0x33c031(_0xe3e6e1[_0x0b14('0x18')]['message']);}})[_0x0b14('0x19')](function(_0xa857fd){logger[_0x0b14('0x14')](_0x0b14('0x10'),_0x4db89e,_0xa857fd);_0x401458(_0xa857fd);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 41d88ef..2ff6029 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 _0xdf97=['register','length','team:','./team.events','remove','update','emit','removeListener'];(function(_0x4a7906,_0x3ef77d){var _0x558373=function(_0xd892c3){while(--_0xd892c3){_0x4a7906['push'](_0x4a7906['shift']());}};_0x558373(++_0x3ef77d);}(_0xdf97,0xfb));var _0x7df9=function(_0x5bb47f,_0x5dfc60){_0x5bb47f=_0x5bb47f-0x0;var _0x483679=_0xdf97[_0x5bb47f];return _0x483679;};'use strict';var TeamEvents=require(_0x7df9('0x0'));var events=['save',_0x7df9('0x1'),_0x7df9('0x2')];function createListener(_0x99b37c,_0x4240ce){return function(_0x2d51c9){_0x4240ce[_0x7df9('0x3')](_0x99b37c,_0x2d51c9);};}function removeListener(_0x42b08c,_0x4e2c34){return function(){TeamEvents[_0x7df9('0x4')](_0x42b08c,_0x4e2c34);};}exports[_0x7df9('0x5')]=function(_0x355a1c){for(var _0x19ffc3=0x0,_0x1cb6b5=events[_0x7df9('0x6')];_0x19ffc3<_0x1cb6b5;_0x19ffc3++){var _0x132cff=events[_0x19ffc3];var _0x314153=createListener(_0x7df9('0x7')+_0x132cff,_0x355a1c);TeamEvents['on'](_0x132cff,_0x314153);}}; \ No newline at end of file +var _0x987a=['update','removeListener','register','length','./team.events','save','remove'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x987a,0x17e));var _0xa987=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x987a[_0x3ab51d];return _0x29a04e;};'use strict';var TeamEvents=require(_0xa987('0x0'));var events=[_0xa987('0x1'),_0xa987('0x2'),_0xa987('0x3')];function createListener(_0x55d6a7,_0x566e68){return function(_0x3e266f){_0x566e68['emit'](_0x55d6a7,_0x3e266f);};}function removeListener(_0x41fbdb,_0x3a279d){return function(){TeamEvents[_0xa987('0x4')](_0x41fbdb,_0x3a279d);};}exports[_0xa987('0x5')]=function(_0x34ce39){for(var _0x210c89=0x0,_0x30378d=events[_0xa987('0x6')];_0x210c89<_0x30378d;_0x210c89++){var _0x10acdd=events[_0x210c89];var _0x19f2ac=createListener('team:'+_0x10acdd,_0x34ce39);TeamEvents['on'](_0x10acdd,_0x19f2ac);}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index ebde60d..1cda067 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x4fc79e,_0x3b1919){var _0x301cba=function(_0x39ed05){while(--_0x39ed05){_0x4fc79e['push'](_0x4fc79e['shift']());}};_0x301cba(++_0x3b1919);}(_0x9c44,0x178));var _0x49c4=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x9c44[_0x6cf19c];return _0xce14f3;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x11aa97,_0x4c35cd){var _0x367035=function(_0x170605){while(--_0x170605){_0x11aa97['push'](_0x11aa97['shift']());}};_0x367035(++_0x4c35cd);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1aed80,_0x3ca6f6){_0x1aed80=_0x1aed80-0x0;var _0x43961e=_0xcb91[_0x1aed80];return _0x43961e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index cae3ea2..bf3230c 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 _0x362a=['sequelize','exports','INTEGER'];(function(_0x2e907c,_0x248d21){var _0x2a28e2=function(_0x5e39ae){while(--_0x5e39ae){_0x2e907c['push'](_0x2e907c['shift']());}};_0x2a28e2(++_0x248d21);}(_0x362a,0x102));var _0xa362=function(_0x44d6b8,_0xe7e065){_0x44d6b8=_0x44d6b8-0x0;var _0x18cbfa=_0x362a[_0x44d6b8];return _0x18cbfa;};'use strict';var Sequelize=require(_0xa362('0x0'));module[_0xa362('0x1')]={'penalty':{'type':Sequelize[_0xa362('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3d1b=['sequelize','exports','INTEGER'];(function(_0x86b219,_0x43038f){var _0x1f320c=function(_0x8cd63f){while(--_0x8cd63f){_0x86b219['push'](_0x86b219['shift']());}};_0x1f320c(++_0x43038f);}(_0x3d1b,0xb7));var _0xb3d1=function(_0x2b38f7,_0x3897af){_0x2b38f7=_0x2b38f7-0x0;var _0x4f8e27=_0x3d1b[_0x2b38f7];return _0x4f8e27;};'use strict';var Sequelize=require(_0xb3d1('0x0'));module[_0xb3d1('0x1')]={'penalty':{'type':Sequelize[_0xb3d1('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 f1a33fe..4cdd174 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 _0x1bb2=['TeamVoiceQueue','team_has_voice_queues','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define'];(function(_0x5a64ad,_0x323c95){var _0x548b73=function(_0x2e2dee){while(--_0x2e2dee){_0x5a64ad['push'](_0x5a64ad['shift']());}};_0x548b73(++_0x323c95);}(_0x1bb2,0x152));var _0x21bb=function(_0x38536f,_0x3ccc0b){_0x38536f=_0x38536f-0x0;var _0x2674ee=_0x1bb2[_0x38536f];return _0x2674ee;};'use strict';var _=require('lodash');var util=require(_0x21bb('0x0'));var logger=require(_0x21bb('0x1'))(_0x21bb('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x21bb('0x3'));var fs=require('fs');var path=require(_0x21bb('0x4'));var rimraf=require(_0x21bb('0x5'));var config=require(_0x21bb('0x6'));var attributes=require(_0x21bb('0x7'));module[_0x21bb('0x8')]=function(_0x198344,_0x267bb0){return _0x198344[_0x21bb('0x9')](_0x21bb('0xa'),attributes,{'tableName':_0x21bb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1f38=['./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x2466d4,_0x2b9802){var _0x383a41=function(_0x2106e8){while(--_0x2106e8){_0x2466d4['push'](_0x2466d4['shift']());}};_0x383a41(++_0x2b9802);}(_0x1f38,0xd7));var _0x81f3=function(_0x21f9c2,_0x2b3d2a){_0x21f9c2=_0x21f9c2-0x0;var _0x3da17f=_0x1f38[_0x21f9c2];return _0x3da17f;};'use strict';var _=require(_0x81f3('0x0'));var util=require(_0x81f3('0x1'));var logger=require(_0x81f3('0x2'))(_0x81f3('0x3'));var moment=require(_0x81f3('0x4'));var BPromise=require(_0x81f3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x81f3('0x6'));var rimraf=require(_0x81f3('0x7'));var config=require(_0x81f3('0x8'));var attributes=require(_0x81f3('0x9'));module[_0x81f3('0xa')]=function(_0x59e5ae,_0x39633a){return _0x59e5ae[_0x81f3('0xb')](_0x81f3('0xc'),attributes,{'tableName':_0x81f3('0xd'),'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 30fa4da..15500b4 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 _0x923f=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','TeamVoiceQueue,\x20%s,\x20%s','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x36257b,_0x53ebf9){var _0x3f949f=function(_0x2569b9){while(--_0x2569b9){_0x36257b['push'](_0x36257b['shift']());}};_0x3f949f(++_0x53ebf9);}(_0x923f,0x7b));var _0xf923=function(_0x46b80a,_0x1f58f9){_0x46b80a=_0x46b80a-0x0;var _0x5c04fe=_0x923f[_0x46b80a];return _0x5c04fe;};'use strict';var _=require(_0xf923('0x0'));var util=require(_0xf923('0x1'));var moment=require(_0xf923('0x2'));var BPromise=require(_0xf923('0x3'));var rs=require(_0xf923('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf923('0x5'))['db'];var utils=require(_0xf923('0x6'));var logger=require(_0xf923('0x7'))('rpc');var config=require(_0xf923('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf923('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30f2b7,_0x42738b,_0x19501c){return new BPromise(function(_0x3db5ab,_0x2cfc53){return client[_0xf923('0xa')](_0x30f2b7,_0x19501c)['then'](function(_0x3ab9b){logger['info'](_0xf923('0xb'),_0x42738b,'request\x20sent');logger[_0xf923('0xc')](_0xf923('0xd'),_0x42738b,_0xf923('0xe'),JSON[_0xf923('0xf')](_0x3ab9b));if(_0x3ab9b[_0xf923('0x10')]){if(_0x3ab9b['error'][_0xf923('0x11')]===0x1f4){logger[_0xf923('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x42738b,_0x3ab9b[_0xf923('0x10')]['message']);return _0x2cfc53(_0x3ab9b[_0xf923('0x10')]['message']);}logger[_0xf923('0x10')](_0xf923('0xb'),_0x42738b,_0x3ab9b[_0xf923('0x10')][_0xf923('0x12')]);return _0x3db5ab(_0x3ab9b[_0xf923('0x10')][_0xf923('0x12')]);}else{logger['info'](_0xf923('0xb'),_0x42738b,_0xf923('0xe'));_0x3db5ab(_0x3ab9b[_0xf923('0x13')][_0xf923('0x12')]);}})[_0xf923('0x14')](function(_0x259cc9){logger[_0xf923('0x10')](_0xf923('0xb'),_0x42738b,_0x259cc9);_0x2cfc53(_0x259cc9);});});} \ No newline at end of file +var _0x79e0=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0x24c645,_0x553b42){var _0x3688ac=function(_0x2ef8fd){while(--_0x2ef8fd){_0x24c645['push'](_0x24c645['shift']());}};_0x3688ac(++_0x553b42);}(_0x79e0,0x1f4));var _0x079e=function(_0x117f4c,_0x36a9b1){_0x117f4c=_0x117f4c-0x0;var _0x2b24e9=_0x79e0[_0x117f4c];return _0x2b24e9;};'use strict';var _=require(_0x079e('0x0'));var util=require(_0x079e('0x1'));var moment=require(_0x079e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x079e('0x3'));var db=require(_0x079e('0x4'))['db'];var utils=require(_0x079e('0x5'));var logger=require(_0x079e('0x6'))(_0x079e('0x7'));var config=require(_0x079e('0x8'));var jayson=require(_0x079e('0x9'));var client=jayson[_0x079e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ee29a,_0x476a22,_0x4e04bc){return new BPromise(function(_0x2f1ba9,_0x4dba5e){return client[_0x079e('0xb')](_0x4ee29a,_0x4e04bc)[_0x079e('0xc')](function(_0x30b392){logger[_0x079e('0xd')](_0x079e('0xe'),_0x476a22,'request\x20sent');logger[_0x079e('0xf')](_0x079e('0x10'),_0x476a22,_0x079e('0x11'),JSON[_0x079e('0x12')](_0x30b392));if(_0x30b392[_0x079e('0x13')]){if(_0x30b392[_0x079e('0x13')][_0x079e('0x14')]===0x1f4){logger[_0x079e('0x13')](_0x079e('0xe'),_0x476a22,_0x30b392[_0x079e('0x13')][_0x079e('0x15')]);return _0x4dba5e(_0x30b392[_0x079e('0x13')][_0x079e('0x15')]);}logger[_0x079e('0x13')](_0x079e('0xe'),_0x476a22,_0x30b392[_0x079e('0x13')][_0x079e('0x15')]);return _0x2f1ba9(_0x30b392['error'][_0x079e('0x15')]);}else{logger[_0x079e('0xd')]('TeamVoiceQueue,\x20%s,\x20%s',_0x476a22,_0x079e('0x11'));_0x2f1ba9(_0x30b392['result'][_0x079e('0x15')]);}})[_0x079e('0x16')](function(_0x51a987){logger[_0x079e('0x13')](_0x079e('0xe'),_0x476a22,_0x51a987);_0x4dba5e(_0x51a987);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index b06c476..29fe766 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 _0xd237=['../../components/interaction/service','../../config/environment','./template.controller','isAuthenticated','show','post','create','put','/:id','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0xd237,0x14f));var _0x7d23=function(_0x57b4dc,_0x3fbf56){_0x57b4dc=_0x57b4dc-0x0;var _0x19a18a=_0xd237[_0x57b4dc];return _0x19a18a;};'use strict';var multer=require(_0x7d23('0x0'));var util=require(_0x7d23('0x1'));var path=require(_0x7d23('0x2'));var timeout=require(_0x7d23('0x3'));var express=require('express');var router=express[_0x7d23('0x4')]();var fs_extra=require(_0x7d23('0x5'));var auth=require(_0x7d23('0x6'));var interaction=require(_0x7d23('0x7'));var config=require(_0x7d23('0x8'));var controller=require(_0x7d23('0x9'));router['get']('/',auth[_0x7d23('0xa')](),controller['index']);router['get']('/:id',auth[_0x7d23('0xa')](),controller[_0x7d23('0xb')]);router[_0x7d23('0xc')]('/',auth[_0x7d23('0xa')](),controller[_0x7d23('0xd')]);router[_0x7d23('0xe')](_0x7d23('0xf'),auth[_0x7d23('0xa')](),controller['update']);router[_0x7d23('0x10')](_0x7d23('0xf'),auth[_0x7d23('0xa')](),controller['destroy']);module[_0x7d23('0x11')]=router; \ No newline at end of file +var _0x4123=['Router','fs-extra','../../components/auth/service','./template.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x5e4750,_0x580531){var _0x34ed68=function(_0x3ac3bd){while(--_0x3ac3bd){_0x5e4750['push'](_0x5e4750['shift']());}};_0x34ed68(++_0x580531);}(_0x4123,0x87));var _0x3412=function(_0x4dbff0,_0xd80451){_0x4dbff0=_0x4dbff0-0x0;var _0xf762b6=_0x4123[_0x4dbff0];return _0xf762b6;};'use strict';var multer=require(_0x3412('0x0'));var util=require(_0x3412('0x1'));var path=require(_0x3412('0x2'));var timeout=require(_0x3412('0x3'));var express=require(_0x3412('0x4'));var router=express[_0x3412('0x5')]();var fs_extra=require(_0x3412('0x6'));var auth=require(_0x3412('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3412('0x8'));router[_0x3412('0x9')]('/',auth['isAuthenticated'](),controller[_0x3412('0xa')]);router[_0x3412('0x9')](_0x3412('0xb'),auth[_0x3412('0xc')](),controller[_0x3412('0xd')]);router[_0x3412('0xe')]('/',auth['isAuthenticated'](),controller[_0x3412('0xf')]);router[_0x3412('0x10')](_0x3412('0xb'),auth[_0x3412('0xc')](),controller[_0x3412('0x11')]);router[_0x3412('0x12')](_0x3412('0xb'),auth[_0x3412('0xc')](),controller[_0x3412('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 4719287..e9a14f8 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 _0xd136=['STRING','exports'];(function(_0x1850ba,_0x55e013){var _0x2045e8=function(_0x5a5b09){while(--_0x5a5b09){_0x1850ba['push'](_0x1850ba['shift']());}};_0x2045e8(++_0x55e013);}(_0xd136,0xfd));var _0x6d13=function(_0x4a7897,_0x456e37){_0x4a7897=_0x4a7897-0x0;var _0x42abd1=_0xd136[_0x4a7897];return _0x42abd1;};'use strict';var Sequelize=require('sequelize');module[_0x6d13('0x0')]={'name':{'type':Sequelize[_0x6d13('0x1')]},'description':{'type':Sequelize[_0x6d13('0x1')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x9592=['STRING','TEXT','sequelize'];(function(_0x3e3865,_0x537f66){var _0x47ebe9=function(_0x4fa2a9){while(--_0x4fa2a9){_0x3e3865['push'](_0x3e3865['shift']());}};_0x47ebe9(++_0x537f66);}(_0x9592,0xb9));var _0x2959=function(_0x458f28,_0x3cb956){_0x458f28=_0x458f28-0x0;var _0x1c4099=_0x9592[_0x458f28];return _0x1c4099;};'use strict';var Sequelize=require(_0x2959('0x0'));module['exports']={'name':{'type':Sequelize[_0x2959('0x1')]},'description':{'type':Sequelize[_0x2959('0x1')]},'html':{'type':Sequelize[_0x2959('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index b525b39..25c2c0e 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 _0x9c86=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','save','update','then','get','UserProfileResource','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','Template','rows','catch','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','fast-json-patch','request-promise'];(function(_0x26013b,_0x4b6f7c){var _0x5a6e74=function(_0x13214f){while(--_0x13214f){_0x26013b['push'](_0x26013b['shift']());}};_0x5a6e74(++_0x4b6f7c);}(_0x9c86,0x9f));var _0x69c8=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x9c86[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0x69c8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x69c8('0x1'));var rp=require(_0x69c8('0x2'));var moment=require(_0x69c8('0x3'));var BPromise=require(_0x69c8('0x4'));var Mustache=require(_0x69c8('0x5'));var util=require(_0x69c8('0x6'));var path=require(_0x69c8('0x7'));var sox=require(_0x69c8('0x8'));var csv=require(_0x69c8('0x9'));var ejs=require(_0x69c8('0xa'));var fs=require('fs');var fs_extra=require(_0x69c8('0xb'));var _=require(_0x69c8('0xc'));var squel=require(_0x69c8('0xd'));var crypto=require(_0x69c8('0xe'));var jsforce=require(_0x69c8('0xf'));var deskjs=require(_0x69c8('0x10'));var toCsv=require(_0x69c8('0x9'));var querystring=require(_0x69c8('0x11'));var Papa=require(_0x69c8('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x69c8('0x13'));var as=require(_0x69c8('0x14'));var hardwareService=require(_0x69c8('0x15'));var logger=require(_0x69c8('0x16'))('api');var utils=require(_0x69c8('0x17'));var config=require(_0x69c8('0x18'));var licenseUtil=require(_0x69c8('0x19'));var db=require(_0x69c8('0x1a'))['db'];function respondWithStatusCode(_0x47b1f9,_0x3da40a){_0x3da40a=_0x3da40a||0xcc;return function(_0x4179fb){if(_0x4179fb){return _0x47b1f9[_0x69c8('0x1b')](_0x3da40a);}return _0x47b1f9[_0x69c8('0x1c')](_0x3da40a)[_0x69c8('0x1d')]();};}function respondWithResult(_0x4d1b4e,_0x160c4d){_0x160c4d=_0x160c4d||0xc8;return function(_0x3ebbba){if(_0x3ebbba){return _0x4d1b4e['status'](_0x160c4d)[_0x69c8('0x1e')](_0x3ebbba);}};}function respondWithFilteredResult(_0x2d14a6,_0x3bb80b){return function(_0x5e7861){if(_0x5e7861){var _0x1d89b3=typeof _0x3bb80b['offset']===_0x69c8('0x1f')&&typeof _0x3bb80b[_0x69c8('0x20')]===_0x69c8('0x1f');var _0x385eca=_0x5e7861['count'];var _0x1c5b9d=_0x1d89b3?0x0:_0x3bb80b[_0x69c8('0x21')];var _0x27cad0=_0x1d89b3?_0x5e7861[_0x69c8('0x22')]:_0x3bb80b['offset']+_0x3bb80b[_0x69c8('0x20')];var _0xd365b8;if(_0x27cad0>=_0x385eca){_0x27cad0=_0x385eca;_0xd365b8=0xc8;}else{_0xd365b8=0xce;}_0x2d14a6[_0x69c8('0x1c')](_0xd365b8);return _0x2d14a6['set']('Content-Range',_0x1c5b9d+'-'+_0x27cad0+'/'+_0x385eca)[_0x69c8('0x1e')](_0x5e7861);}return null;};}function patchUpdates(_0x43d64c){return function(_0x3fee18){try{jsonpatch['apply'](_0x3fee18,_0x43d64c,!![]);}catch(_0x320c25){return BPromise['reject'](_0x320c25);}return _0x3fee18[_0x69c8('0x23')]();};}function saveUpdates(_0x105fc3,_0x365c91){return function(_0x458ec7){if(_0x458ec7){return _0x458ec7[_0x69c8('0x24')](_0x105fc3)['then'](function(_0x49e60e){return _0x49e60e;});}return null;};}function removeEntity(_0x377448,_0xd32da8){return function(_0xfb843e){if(_0xfb843e){return _0xfb843e['destroy']()[_0x69c8('0x25')](function(){var _0x12e8ab=_0xfb843e[_0x69c8('0x26')]({'plain':!![]});var _0xb9f67b='Templates';return db[_0x69c8('0x27')][_0x69c8('0x28')]({'where':{'type':_0xb9f67b,'resourceId':_0x12e8ab['id']}})[_0x69c8('0x25')](function(){return _0xfb843e;});})['then'](function(){_0x377448[_0x69c8('0x1c')](0xcc)[_0x69c8('0x1d')]();});}};}function handleEntityNotFound(_0x3416c0,_0x1016e6){return function(_0x36e607){if(!_0x36e607){_0x3416c0[_0x69c8('0x1b')](0x194);}return _0x36e607;};}function handleError(_0x8e7a98,_0x5aa017){_0x5aa017=_0x5aa017||0x1f4;return function(_0x1550e8){logger[_0x69c8('0x29')](_0x1550e8['stack']);if(_0x1550e8[_0x69c8('0x2a')]){delete _0x1550e8[_0x69c8('0x2a')];}_0x8e7a98[_0x69c8('0x1c')](_0x5aa017)[_0x69c8('0x2b')](_0x1550e8);};}exports[_0x69c8('0x2c')]=function(_0x491455,_0x590e8d){var _0x15dda6={},_0x3fef3e={},_0x5a7f64={'count':0x0,'rows':[]};var _0x4cd478=_[_0x69c8('0x2d')](db['Template'][_0x69c8('0x2e')],function(_0x3495b9){return{'name':_0x3495b9[_0x69c8('0x2f')],'type':_0x3495b9[_0x69c8('0x30')][_0x69c8('0x31')]};});_0x3fef3e[_0x69c8('0x32')]=_[_0x69c8('0x2d')](_0x4cd478,_0x69c8('0x2a'));_0x3fef3e['query']=_[_0x69c8('0x33')](_0x491455['query']);_0x3fef3e[_0x69c8('0x34')]=_[_0x69c8('0x35')](_0x3fef3e[_0x69c8('0x32')],_0x3fef3e['query']);_0x15dda6[_0x69c8('0x36')]=_[_0x69c8('0x35')](_0x3fef3e[_0x69c8('0x32')],qs[_0x69c8('0x37')](_0x491455[_0x69c8('0x38')][_0x69c8('0x37')]));_0x15dda6[_0x69c8('0x36')]=_0x15dda6['attributes'][_0x69c8('0x39')]?_0x15dda6[_0x69c8('0x36')]:_0x3fef3e[_0x69c8('0x32')];if(!_0x491455[_0x69c8('0x38')][_0x69c8('0x3a')](_0x69c8('0x3b'))){_0x15dda6[_0x69c8('0x20')]=qs[_0x69c8('0x20')](_0x491455[_0x69c8('0x38')][_0x69c8('0x20')]);_0x15dda6[_0x69c8('0x21')]=qs[_0x69c8('0x21')](_0x491455[_0x69c8('0x38')][_0x69c8('0x21')]);}_0x15dda6[_0x69c8('0x3c')]=qs[_0x69c8('0x3d')](_0x491455[_0x69c8('0x38')][_0x69c8('0x3d')]);_0x15dda6[_0x69c8('0x3e')]=qs[_0x69c8('0x34')](_[_0x69c8('0x3f')](_0x491455[_0x69c8('0x38')],_0x3fef3e['filters']),_0x4cd478);if(_0x491455['query'][_0x69c8('0x40')]){_0x15dda6[_0x69c8('0x3e')]=_[_0x69c8('0x41')](_0x15dda6[_0x69c8('0x3e')],{'$or':_['map'](_0x4cd478,function(_0x499d05){if(_0x499d05[_0x69c8('0x30')]!=='VIRTUAL'){var _0x45ec8d={};_0x45ec8d[_0x499d05[_0x69c8('0x2a')]]={'$like':'%'+_0x491455[_0x69c8('0x38')]['filter']+'%'};return _0x45ec8d;}})});}_0x15dda6=_[_0x69c8('0x41')]({},_0x15dda6,_0x491455[_0x69c8('0x42')]);var _0x4aaa22={'where':_0x15dda6[_0x69c8('0x3e')]};return db['Template'][_0x69c8('0x22')](_0x4aaa22)[_0x69c8('0x25')](function(_0x1df849){_0x5a7f64[_0x69c8('0x22')]=_0x1df849;if(_0x491455[_0x69c8('0x38')][_0x69c8('0x43')]){_0x15dda6[_0x69c8('0x44')]=[{'all':!![]}];}return db[_0x69c8('0x45')]['findAll'](_0x15dda6);})['then'](function(_0xb259cf){_0x5a7f64[_0x69c8('0x46')]=_0xb259cf;return _0x5a7f64;})[_0x69c8('0x25')](respondWithFilteredResult(_0x590e8d,_0x15dda6))[_0x69c8('0x47')](handleError(_0x590e8d,null));};exports['show']=function(_0x2d9cd5,_0x2c51c8){var _0x5e7674={'raw':!![],'where':{'id':_0x2d9cd5['params']['id']}},_0x238286={};_0x238286[_0x69c8('0x32')]=_[_0x69c8('0x33')](db['Template'][_0x69c8('0x2e')]);_0x238286[_0x69c8('0x38')]=_[_0x69c8('0x33')](_0x2d9cd5[_0x69c8('0x38')]);_0x238286['filters']=_[_0x69c8('0x35')](_0x238286[_0x69c8('0x32')],_0x238286[_0x69c8('0x38')]);_0x5e7674[_0x69c8('0x36')]=_['intersection'](_0x238286['model'],qs[_0x69c8('0x37')](_0x2d9cd5[_0x69c8('0x38')]['fields']));_0x5e7674[_0x69c8('0x36')]=_0x5e7674[_0x69c8('0x36')]['length']?_0x5e7674[_0x69c8('0x36')]:_0x238286[_0x69c8('0x32')];if(_0x2d9cd5['query'][_0x69c8('0x43')]){_0x5e7674['include']=[{'all':!![]}];}_0x5e7674=_[_0x69c8('0x41')]({},_0x5e7674,_0x2d9cd5[_0x69c8('0x42')]);return db['Template'][_0x69c8('0x48')](_0x5e7674)[_0x69c8('0x25')](handleEntityNotFound(_0x2c51c8,null))[_0x69c8('0x25')](respondWithResult(_0x2c51c8,null))['catch'](handleError(_0x2c51c8,null));};exports[_0x69c8('0x49')]=function(_0x2bf855,_0x33dfcf){return db[_0x69c8('0x45')]['create'](_0x2bf855[_0x69c8('0x4a')],{})[_0x69c8('0x25')](function(_0x2e7311){var _0x18a59b=_0x2bf855['user'][_0x69c8('0x26')]({'plain':!![]});if(!_0x18a59b)throw new Error(_0x69c8('0x4b'));if(_0x18a59b[_0x69c8('0x4c')]===_0x69c8('0x4d')){var _0x4f774a=_0x2e7311['get']({'plain':!![]});var _0x1368d2='Templates';return db['UserProfileSection'][_0x69c8('0x48')]({'where':{'name':_0x1368d2,'userProfileId':_0x18a59b[_0x69c8('0x4e')]},'raw':!![]})['then'](function(_0x3137a5){if(_0x3137a5&&_0x3137a5['autoAssociation']===0x0){return db[_0x69c8('0x27')][_0x69c8('0x49')]({'name':_0x4f774a[_0x69c8('0x2a')],'resourceId':_0x4f774a['id'],'type':_0x3137a5[_0x69c8('0x2a')],'sectionId':_0x3137a5['id']},{})[_0x69c8('0x25')](function(){return _0x2e7311;});}else{return _0x2e7311;}})[_0x69c8('0x47')](function(_0x3d6f7e){logger['error'](_0x69c8('0x4f'),_0x3d6f7e);throw _0x3d6f7e;});}return _0x2e7311;})['then'](respondWithResult(_0x33dfcf,0xc9))[_0x69c8('0x47')](handleError(_0x33dfcf,null));};exports[_0x69c8('0x24')]=function(_0x34f4d7,_0x2cbb84){if(_0x34f4d7[_0x69c8('0x4a')]['id']){delete _0x34f4d7[_0x69c8('0x4a')]['id'];}return db[_0x69c8('0x45')][_0x69c8('0x48')]({'where':{'id':_0x34f4d7[_0x69c8('0x50')]['id']}})[_0x69c8('0x25')](handleEntityNotFound(_0x2cbb84,null))[_0x69c8('0x25')](saveUpdates(_0x34f4d7[_0x69c8('0x4a')],null))[_0x69c8('0x25')](respondWithResult(_0x2cbb84,null))[_0x69c8('0x47')](handleError(_0x2cbb84,null));};exports['destroy']=function(_0x5aec4e,_0x1cfdd2){return db[_0x69c8('0x45')][_0x69c8('0x48')]({'where':{'id':_0x5aec4e['params']['id']}})[_0x69c8('0x25')](handleEntityNotFound(_0x1cfdd2,null))[_0x69c8('0x25')](removeEntity(_0x1cfdd2,null))[_0x69c8('0x47')](handleError(_0x1cfdd2,null));}; \ No newline at end of file +var _0xdcaf=['Template','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','rawAttributes','length','find','body','user','role','get','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','rimraf','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','destroy','Templates','end','error','stack','name','send','index','map'];(function(_0x4d8666,_0x2ff19d){var _0x37175b=function(_0x1b8de6){while(--_0x1b8de6){_0x4d8666['push'](_0x4d8666['shift']());}};_0x37175b(++_0x2ff19d);}(_0xdcaf,0x11e));var _0xfdca=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdcaf[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfdca('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfdca('0x1'));var moment=require(_0xfdca('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xfdca('0x3'));var util=require(_0xfdca('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xfdca('0x5'));var ejs=require(_0xfdca('0x6'));var fs=require('fs');var fs_extra=require(_0xfdca('0x7'));var _=require(_0xfdca('0x8'));var squel=require(_0xfdca('0x9'));var crypto=require(_0xfdca('0xa'));var jsforce=require(_0xfdca('0xb'));var deskjs=require(_0xfdca('0xc'));var toCsv=require(_0xfdca('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfdca('0xd'));var authService=require(_0xfdca('0xe'));var qs=require(_0xfdca('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfdca('0x10'));var logger=require(_0xfdca('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xfdca('0x12'));var licenseUtil=require(_0xfdca('0x13'));var db=require(_0xfdca('0x14'))['db'];function respondWithStatusCode(_0x4388a3,_0x257660){_0x257660=_0x257660||0xcc;return function(_0x3fef4b){if(_0x3fef4b){return _0x4388a3[_0xfdca('0x15')](_0x257660);}return _0x4388a3[_0xfdca('0x16')](_0x257660)['end']();};}function respondWithResult(_0x4d6fd8,_0x1773df){_0x1773df=_0x1773df||0xc8;return function(_0x2bc05d){if(_0x2bc05d){return _0x4d6fd8[_0xfdca('0x16')](_0x1773df)[_0xfdca('0x17')](_0x2bc05d);}};}function respondWithFilteredResult(_0x2b86b2,_0x3bf620){return function(_0x5f4a51){if(_0x5f4a51){var _0x40fa78=typeof _0x3bf620[_0xfdca('0x18')]===_0xfdca('0x19')&&typeof _0x3bf620[_0xfdca('0x1a')]===_0xfdca('0x19');var _0x133f99=_0x5f4a51['count'];var _0x50bc31=_0x40fa78?0x0:_0x3bf620[_0xfdca('0x18')];var _0x53fce9=_0x40fa78?_0x5f4a51['count']:_0x3bf620[_0xfdca('0x18')]+_0x3bf620[_0xfdca('0x1a')];var _0x1af23;if(_0x53fce9>=_0x133f99){_0x53fce9=_0x133f99;_0x1af23=0xc8;}else{_0x1af23=0xce;}_0x2b86b2[_0xfdca('0x16')](_0x1af23);return _0x2b86b2['set'](_0xfdca('0x1b'),_0x50bc31+'-'+_0x53fce9+'/'+_0x133f99)['json'](_0x5f4a51);}return null;};}function patchUpdates(_0x508563){return function(_0x26ea4b){try{jsonpatch[_0xfdca('0x1c')](_0x26ea4b,_0x508563,!![]);}catch(_0x49d942){return BPromise[_0xfdca('0x1d')](_0x49d942);}return _0x26ea4b[_0xfdca('0x1e')]();};}function saveUpdates(_0x348622,_0x38f8d3){return function(_0x41a0f5){if(_0x41a0f5){return _0x41a0f5[_0xfdca('0x1f')](_0x348622)[_0xfdca('0x20')](function(_0x29f744){return _0x29f744;});}return null;};}function removeEntity(_0x408247,_0x1d9fd2){return function(_0x2411d7){if(_0x2411d7){return _0x2411d7[_0xfdca('0x21')]()[_0xfdca('0x20')](function(){var _0x3db822=_0x2411d7['get']({'plain':!![]});var _0x17b65f=_0xfdca('0x22');return db['UserProfileResource'][_0xfdca('0x21')]({'where':{'type':_0x17b65f,'resourceId':_0x3db822['id']}})[_0xfdca('0x20')](function(){return _0x2411d7;});})[_0xfdca('0x20')](function(){_0x408247['status'](0xcc)[_0xfdca('0x23')]();});}};}function handleEntityNotFound(_0x332701,_0x1b6953){return function(_0x38510e){if(!_0x38510e){_0x332701[_0xfdca('0x15')](0x194);}return _0x38510e;};}function handleError(_0x4cea53,_0x3934a9){_0x3934a9=_0x3934a9||0x1f4;return function(_0x48f085){logger[_0xfdca('0x24')](_0x48f085[_0xfdca('0x25')]);if(_0x48f085[_0xfdca('0x26')]){delete _0x48f085[_0xfdca('0x26')];}_0x4cea53[_0xfdca('0x16')](_0x3934a9)[_0xfdca('0x27')](_0x48f085);};}exports[_0xfdca('0x28')]=function(_0x5f58b6,_0x194d76){var _0x39fdb2={},_0x26b33d={},_0x410dfb={'count':0x0,'rows':[]};var _0x2384b8=_[_0xfdca('0x29')](db[_0xfdca('0x2a')]['rawAttributes'],function(_0x106b2e){return{'name':_0x106b2e[_0xfdca('0x2b')],'type':_0x106b2e[_0xfdca('0x2c')][_0xfdca('0x2d')]};});_0x26b33d[_0xfdca('0x2e')]=_[_0xfdca('0x29')](_0x2384b8,_0xfdca('0x26'));_0x26b33d[_0xfdca('0x2f')]=_[_0xfdca('0x30')](_0x5f58b6['query']);_0x26b33d[_0xfdca('0x31')]=_[_0xfdca('0x32')](_0x26b33d['model'],_0x26b33d[_0xfdca('0x2f')]);_0x39fdb2['attributes']=_[_0xfdca('0x32')](_0x26b33d[_0xfdca('0x2e')],qs['fields'](_0x5f58b6[_0xfdca('0x2f')][_0xfdca('0x33')]));_0x39fdb2[_0xfdca('0x34')]=_0x39fdb2[_0xfdca('0x34')]['length']?_0x39fdb2['attributes']:_0x26b33d[_0xfdca('0x2e')];if(!_0x5f58b6[_0xfdca('0x2f')][_0xfdca('0x35')](_0xfdca('0x36'))){_0x39fdb2['limit']=qs[_0xfdca('0x1a')](_0x5f58b6[_0xfdca('0x2f')][_0xfdca('0x1a')]);_0x39fdb2[_0xfdca('0x18')]=qs[_0xfdca('0x18')](_0x5f58b6[_0xfdca('0x2f')][_0xfdca('0x18')]);}_0x39fdb2[_0xfdca('0x37')]=qs[_0xfdca('0x38')](_0x5f58b6['query']['sort']);_0x39fdb2['where']=qs['filters'](_[_0xfdca('0x39')](_0x5f58b6[_0xfdca('0x2f')],_0x26b33d[_0xfdca('0x31')]),_0x2384b8);if(_0x5f58b6[_0xfdca('0x2f')][_0xfdca('0x3a')]){_0x39fdb2['where']=_[_0xfdca('0x3b')](_0x39fdb2[_0xfdca('0x3c')],{'$or':_[_0xfdca('0x29')](_0x2384b8,function(_0x4fbb67){if(_0x4fbb67[_0xfdca('0x2c')]!==_0xfdca('0x3d')){var _0x2b9b04={};_0x2b9b04[_0x4fbb67[_0xfdca('0x26')]]={'$like':'%'+_0x5f58b6[_0xfdca('0x2f')][_0xfdca('0x3a')]+'%'};return _0x2b9b04;}})});}_0x39fdb2=_['merge']({},_0x39fdb2,_0x5f58b6[_0xfdca('0x3e')]);var _0x48d0d9={'where':_0x39fdb2[_0xfdca('0x3c')]};return db[_0xfdca('0x2a')][_0xfdca('0x3f')](_0x48d0d9)[_0xfdca('0x20')](function(_0x2296f2){_0x410dfb['count']=_0x2296f2;if(_0x5f58b6['query'][_0xfdca('0x40')]){_0x39fdb2[_0xfdca('0x41')]=[{'all':!![]}];}return db[_0xfdca('0x2a')][_0xfdca('0x42')](_0x39fdb2);})[_0xfdca('0x20')](function(_0x37bf35){_0x410dfb[_0xfdca('0x43')]=_0x37bf35;return _0x410dfb;})['then'](respondWithFilteredResult(_0x194d76,_0x39fdb2))[_0xfdca('0x44')](handleError(_0x194d76,null));};exports['show']=function(_0x42af89,_0x5b925b){var _0x1a2692={'raw':!![],'where':{'id':_0x42af89['params']['id']}},_0xdff757={};_0xdff757[_0xfdca('0x2e')]=_[_0xfdca('0x30')](db['Template'][_0xfdca('0x45')]);_0xdff757[_0xfdca('0x2f')]=_[_0xfdca('0x30')](_0x42af89[_0xfdca('0x2f')]);_0xdff757[_0xfdca('0x31')]=_[_0xfdca('0x32')](_0xdff757[_0xfdca('0x2e')],_0xdff757[_0xfdca('0x2f')]);_0x1a2692[_0xfdca('0x34')]=_[_0xfdca('0x32')](_0xdff757[_0xfdca('0x2e')],qs[_0xfdca('0x33')](_0x42af89[_0xfdca('0x2f')][_0xfdca('0x33')]));_0x1a2692[_0xfdca('0x34')]=_0x1a2692[_0xfdca('0x34')][_0xfdca('0x46')]?_0x1a2692['attributes']:_0xdff757[_0xfdca('0x2e')];if(_0x42af89[_0xfdca('0x2f')][_0xfdca('0x40')]){_0x1a2692[_0xfdca('0x41')]=[{'all':!![]}];}_0x1a2692=_['merge']({},_0x1a2692,_0x42af89['options']);return db['Template'][_0xfdca('0x47')](_0x1a2692)[_0xfdca('0x20')](handleEntityNotFound(_0x5b925b,null))[_0xfdca('0x20')](respondWithResult(_0x5b925b,null))['catch'](handleError(_0x5b925b,null));};exports['create']=function(_0x5bd8e8,_0x57733e){return db[_0xfdca('0x2a')]['create'](_0x5bd8e8[_0xfdca('0x48')],{})['then'](function(_0x549353){var _0x3fc1de=_0x5bd8e8[_0xfdca('0x49')]['get']({'plain':!![]});if(!_0x3fc1de)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3fc1de[_0xfdca('0x4a')]==='user'){var _0x1cd6c4=_0x549353[_0xfdca('0x4b')]({'plain':!![]});var _0x45ab4e=_0xfdca('0x22');return db[_0xfdca('0x4c')][_0xfdca('0x47')]({'where':{'name':_0x45ab4e,'userProfileId':_0x3fc1de[_0xfdca('0x4d')]},'raw':!![]})[_0xfdca('0x20')](function(_0x17ef57){if(_0x17ef57&&_0x17ef57[_0xfdca('0x4e')]===0x0){return db['UserProfileResource'][_0xfdca('0x4f')]({'name':_0x1cd6c4[_0xfdca('0x26')],'resourceId':_0x1cd6c4['id'],'type':_0x17ef57[_0xfdca('0x26')],'sectionId':_0x17ef57['id']},{})[_0xfdca('0x20')](function(){return _0x549353;});}else{return _0x549353;}})[_0xfdca('0x44')](function(_0x3256f0){logger[_0xfdca('0x24')](_0xfdca('0x50'),_0x3256f0);throw _0x3256f0;});}return _0x549353;})['then'](respondWithResult(_0x57733e,0xc9))['catch'](handleError(_0x57733e,null));};exports[_0xfdca('0x1f')]=function(_0x3ea6fa,_0x57bfa7){if(_0x3ea6fa['body']['id']){delete _0x3ea6fa[_0xfdca('0x48')]['id'];}return db['Template'][_0xfdca('0x47')]({'where':{'id':_0x3ea6fa['params']['id']}})['then'](handleEntityNotFound(_0x57bfa7,null))[_0xfdca('0x20')](saveUpdates(_0x3ea6fa[_0xfdca('0x48')],null))[_0xfdca('0x20')](respondWithResult(_0x57bfa7,null))[_0xfdca('0x44')](handleError(_0x57bfa7,null));};exports['destroy']=function(_0x5e42db,_0xe1f6b6){return db['Template'][_0xfdca('0x47')]({'where':{'id':_0x5e42db[_0xfdca('0x51')]['id']}})['then'](handleEntityNotFound(_0xe1f6b6,null))['then'](removeEntity(_0xe1f6b6,null))[_0xfdca('0x44')](handleError(_0xe1f6b6,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 20b8526..b750253 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 _0xd1e2=['tools_templates','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','exports','define','Template'];(function(_0x13247b,_0x2ff535){var _0x1a1816=function(_0x79c98c){while(--_0x79c98c){_0x13247b['push'](_0x13247b['shift']());}};_0x1a1816(++_0x2ff535);}(_0xd1e2,0x11e));var _0x2d1e=function(_0x36547c,_0x49f530){_0x36547c=_0x36547c-0x0;var _0x409167=_0xd1e2[_0x36547c];return _0x409167;};'use strict';var _=require(_0x2d1e('0x0'));var util=require(_0x2d1e('0x1'));var logger=require(_0x2d1e('0x2'))(_0x2d1e('0x3'));var moment=require(_0x2d1e('0x4'));var BPromise=require(_0x2d1e('0x5'));var rp=require(_0x2d1e('0x6'));var fs=require('fs');var path=require(_0x2d1e('0x7'));var rimraf=require(_0x2d1e('0x8'));var config=require(_0x2d1e('0x9'));var attributes=require(_0x2d1e('0xa'));module[_0x2d1e('0xb')]=function(_0x356199,_0x215a61){return _0x356199[_0x2d1e('0xc')](_0x2d1e('0xd'),attributes,{'tableName':_0x2d1e('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d0e=['./template.attributes','exports','define','Template','tools_templates','lodash','util','../../config/logger','api','moment'];(function(_0x110c05,_0x987399){var _0x559ee0=function(_0x3b87b3){while(--_0x3b87b3){_0x110c05['push'](_0x110c05['shift']());}};_0x559ee0(++_0x987399);}(_0x0d0e,0x9b));var _0xe0d0=function(_0x3e8de0,_0x47a74f){_0x3e8de0=_0x3e8de0-0x0;var _0xc3ee7b=_0x0d0e[_0x3e8de0];return _0xc3ee7b;};'use strict';var _=require(_0xe0d0('0x0'));var util=require(_0xe0d0('0x1'));var logger=require(_0xe0d0('0x2'))(_0xe0d0('0x3'));var moment=require(_0xe0d0('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe0d0('0x5'));module[_0xe0d0('0x6')]=function(_0x299a9f,_0x239037){return _0x299a9f[_0xe0d0('0x7')](_0xe0d0('0x8'),attributes,{'tableName':_0xe0d0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index fccca7d..08772df 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 _0x50dd=['request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','Template','findAll','options','raw','attributes','limit','include','map','model','GetTemplate','catch','util','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x49c6cc,_0x308bdb){var _0x22e239=function(_0x48507d){while(--_0x48507d){_0x49c6cc['push'](_0x49c6cc['shift']());}};_0x22e239(++_0x308bdb);}(_0x50dd,0xd7));var _0xd50d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x50dd[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xd50d('0x0'));var moment=require('moment');var BPromise=require(_0xd50d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd50d('0x2'));var db=require(_0xd50d('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd50d('0x4'))('rpc');var config=require(_0xd50d('0x5'));var jayson=require(_0xd50d('0x6'));var client=jayson[_0xd50d('0x7')][_0xd50d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3daca2,_0x4f7c25,_0x2d38ed){return new BPromise(function(_0x2eb55f,_0x92a5b9){return client[_0xd50d('0x9')](_0x3daca2,_0x2d38ed)[_0xd50d('0xa')](function(_0x20aa1b){logger[_0xd50d('0xb')](_0xd50d('0xc'),_0x4f7c25,_0xd50d('0xd'));logger[_0xd50d('0xe')](_0xd50d('0xf'),_0x4f7c25,_0xd50d('0xd'),JSON[_0xd50d('0x10')](_0x20aa1b));if(_0x20aa1b[_0xd50d('0x11')]){if(_0x20aa1b['error'][_0xd50d('0x12')]===0x1f4){logger[_0xd50d('0x11')](_0xd50d('0xc'),_0x4f7c25,_0x20aa1b[_0xd50d('0x11')][_0xd50d('0x13')]);return _0x92a5b9(_0x20aa1b['error'][_0xd50d('0x13')]);}logger['error']('Template,\x20%s,\x20%s',_0x4f7c25,_0x20aa1b['error'][_0xd50d('0x13')]);return _0x2eb55f(_0x20aa1b['error'][_0xd50d('0x13')]);}else{logger['info'](_0xd50d('0xc'),_0x4f7c25,_0xd50d('0xd'));_0x2eb55f(_0x20aa1b[_0xd50d('0x14')]['message']);}})['catch'](function(_0x20cdae){logger['error'](_0xd50d('0xc'),_0x4f7c25,_0x20cdae);_0x92a5b9(_0x20cdae);});});}exports['GetTemplate']=function(_0xbea4d3){var _0x37757e=this;return new Promise(function(_0x2118f0,_0x100681){return db[_0xd50d('0x15')][_0xd50d('0x16')]({'raw':_0xbea4d3['options']?_0xbea4d3[_0xd50d('0x17')][_0xd50d('0x18')]===undefined?!![]:![]:!![],'where':_0xbea4d3[_0xd50d('0x17')]?_0xbea4d3['options']['where']||null:null,'attributes':_0xbea4d3[_0xd50d('0x17')]?_0xbea4d3[_0xd50d('0x17')][_0xd50d('0x19')]||null:null,'limit':_0xbea4d3[_0xd50d('0x17')]?_0xbea4d3['options'][_0xd50d('0x1a')]||null:null,'include':_0xbea4d3['options']?_0xbea4d3[_0xd50d('0x17')][_0xd50d('0x1b')]?_[_0xd50d('0x1c')](_0xbea4d3[_0xd50d('0x17')][_0xd50d('0x1b')],function(_0x5131c9){return{'model':db[_0x5131c9[_0xd50d('0x1d')]],'as':_0x5131c9['as'],'attributes':_0x5131c9[_0xd50d('0x19')],'include':_0x5131c9[_0xd50d('0x1b')]?_[_0xd50d('0x1c')](_0x5131c9['include'],function(_0x16211d){return{'model':db[_0x16211d['model']],'as':_0x16211d['as'],'attributes':_0x16211d[_0xd50d('0x19')],'include':_0x16211d[_0xd50d('0x1b')]?_[_0xd50d('0x1c')](_0x16211d[_0xd50d('0x1b')],function(_0x25f691){return{'model':db[_0x25f691[_0xd50d('0x1d')]],'as':_0x25f691['as'],'attributes':_0x25f691[_0xd50d('0x19')]};}):[]};}):[]};}):[]:[]})[_0xd50d('0xa')](function(_0x227348){logger[_0xd50d('0xb')](_0xd50d('0x1e'),_0xbea4d3);logger[_0xd50d('0xe')](_0xd50d('0x1e'),_0xbea4d3,JSON['stringify'](_0x227348));_0x2118f0(_0x227348);})[_0xd50d('0x1f')](function(_0x29347a){logger[_0xd50d('0x11')]('GetTemplate',_0x29347a[_0xd50d('0x13')],_0xbea4d3);_0x100681(_0x37757e[_0xd50d('0x11')](0x1f4,_0x29347a['message']));});});}; \ No newline at end of file +var _0x5b0d=['../../config/logger','rpc','jayson/promise','client','http','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','GetTemplate','findAll','options','where','attributes','model','include','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x5b0d,0x172));var _0xd5b0=function(_0x3b2452,_0x1fb1f9){_0x3b2452=_0x3b2452-0x0;var _0x1fa4e4=_0x5b0d[_0x3b2452];return _0x1fa4e4;};'use strict';var _=require(_0xd5b0('0x0'));var util=require(_0xd5b0('0x1'));var moment=require(_0xd5b0('0x2'));var BPromise=require(_0xd5b0('0x3'));var rs=require(_0xd5b0('0x4'));var fs=require('fs');var Redis=require(_0xd5b0('0x5'));var db=require(_0xd5b0('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd5b0('0x7'))(_0xd5b0('0x8'));var config=require('../../config/environment');var jayson=require(_0xd5b0('0x9'));var client=jayson[_0xd5b0('0xa')][_0xd5b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d858c,_0x7c3d76,_0x177344){return new BPromise(function(_0x45ce71,_0x293fbc){return client['request'](_0x2d858c,_0x177344)[_0xd5b0('0xc')](function(_0x337e23){logger[_0xd5b0('0xd')](_0xd5b0('0xe'),_0x7c3d76,_0xd5b0('0xf'));logger[_0xd5b0('0x10')]('Template,\x20%s,\x20%s,\x20%s',_0x7c3d76,_0xd5b0('0xf'),JSON[_0xd5b0('0x11')](_0x337e23));if(_0x337e23['error']){if(_0x337e23['error']['code']===0x1f4){logger[_0xd5b0('0x12')](_0xd5b0('0xe'),_0x7c3d76,_0x337e23[_0xd5b0('0x12')][_0xd5b0('0x13')]);return _0x293fbc(_0x337e23['error']['message']);}logger[_0xd5b0('0x12')]('Template,\x20%s,\x20%s',_0x7c3d76,_0x337e23['error']['message']);return _0x45ce71(_0x337e23['error'][_0xd5b0('0x13')]);}else{logger[_0xd5b0('0xd')](_0xd5b0('0xe'),_0x7c3d76,_0xd5b0('0xf'));_0x45ce71(_0x337e23[_0xd5b0('0x14')][_0xd5b0('0x13')]);}})['catch'](function(_0x1792a9){logger[_0xd5b0('0x12')](_0xd5b0('0xe'),_0x7c3d76,_0x1792a9);_0x293fbc(_0x1792a9);});});}exports[_0xd5b0('0x15')]=function(_0x22d170){var _0x45d9ad=this;return new Promise(function(_0xb0a0f0,_0x31c086){return db['Template'][_0xd5b0('0x16')]({'raw':_0x22d170['options']?_0x22d170[_0xd5b0('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x22d170[_0xd5b0('0x17')]?_0x22d170['options'][_0xd5b0('0x18')]||null:null,'attributes':_0x22d170[_0xd5b0('0x17')]?_0x22d170['options'][_0xd5b0('0x19')]||null:null,'limit':_0x22d170[_0xd5b0('0x17')]?_0x22d170[_0xd5b0('0x17')]['limit']||null:null,'include':_0x22d170['options']?_0x22d170[_0xd5b0('0x17')]['include']?_['map'](_0x22d170[_0xd5b0('0x17')]['include'],function(_0x4f0cb5){return{'model':db[_0x4f0cb5[_0xd5b0('0x1a')]],'as':_0x4f0cb5['as'],'attributes':_0x4f0cb5['attributes'],'include':_0x4f0cb5[_0xd5b0('0x1b')]?_[_0xd5b0('0x1c')](_0x4f0cb5[_0xd5b0('0x1b')],function(_0xd2b20c){return{'model':db[_0xd2b20c[_0xd5b0('0x1a')]],'as':_0xd2b20c['as'],'attributes':_0xd2b20c[_0xd5b0('0x19')],'include':_0xd2b20c[_0xd5b0('0x1b')]?_[_0xd5b0('0x1c')](_0xd2b20c['include'],function(_0x493f51){return{'model':db[_0x493f51[_0xd5b0('0x1a')]],'as':_0x493f51['as'],'attributes':_0x493f51['attributes']};}):[]};}):[]};}):[]:[]})[_0xd5b0('0xc')](function(_0x1fd359){logger[_0xd5b0('0xd')](_0xd5b0('0x15'),_0x22d170);logger[_0xd5b0('0x10')]('GetTemplate',_0x22d170,JSON[_0xd5b0('0x11')](_0x1fd359));_0xb0a0f0(_0x1fd359);})['catch'](function(_0xdc8d0e){logger[_0xd5b0('0x12')](_0xd5b0('0x15'),_0xdc8d0e['message'],_0x22d170);_0x31c086(_0x45d9ad[_0xd5b0('0x12')](0x1f4,_0xdc8d0e[_0xd5b0('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index cb4a7e5..2e77459 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 _0x8d37=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','addAnyCondition','addAction'];(function(_0x27530d,_0x46480a){var _0x59e561=function(_0x395fe9){while(--_0x395fe9){_0x27530d['push'](_0x27530d['shift']());}};_0x59e561(++_0x46480a);}(_0x8d37,0x1d5));var _0x78d3=function(_0x47ffb7,_0x12bef7){_0x47ffb7=_0x47ffb7-0x0;var _0x302154=_0x8d37[_0x47ffb7];return _0x302154;};'use strict';var multer=require(_0x78d3('0x0'));var util=require(_0x78d3('0x1'));var path=require(_0x78d3('0x2'));var timeout=require(_0x78d3('0x3'));var express=require(_0x78d3('0x4'));var router=express['Router']();var fs_extra=require(_0x78d3('0x5'));var auth=require(_0x78d3('0x6'));var interaction=require(_0x78d3('0x7'));var config=require(_0x78d3('0x8'));var controller=require(_0x78d3('0x9'));router[_0x78d3('0xa')]('/',auth[_0x78d3('0xb')](),controller[_0x78d3('0xc')]);router['get'](_0x78d3('0xd'),auth[_0x78d3('0xb')](),controller[_0x78d3('0xe')]);router[_0x78d3('0xa')](_0x78d3('0xf'),auth[_0x78d3('0xb')](),controller[_0x78d3('0x10')]);router[_0x78d3('0xa')](_0x78d3('0x11'),auth[_0x78d3('0xb')](),controller[_0x78d3('0x12')]);router[_0x78d3('0xa')](_0x78d3('0x13'),auth[_0x78d3('0xb')](),controller[_0x78d3('0x14')]);router[_0x78d3('0x15')]('/',auth[_0x78d3('0xb')](),controller['create']);router['post'](_0x78d3('0xf'),auth[_0x78d3('0xb')](),controller['addAllCondition']);router[_0x78d3('0x15')]('/:id/any_conditions',auth[_0x78d3('0xb')](),controller[_0x78d3('0x16')]);router[_0x78d3('0x15')](_0x78d3('0x13'),auth[_0x78d3('0xb')](),controller[_0x78d3('0x17')]);router[_0x78d3('0x18')](_0x78d3('0xd'),auth['isAuthenticated'](),controller[_0x78d3('0x19')]);router[_0x78d3('0x1a')]('/:id',auth[_0x78d3('0xb')](),controller[_0x78d3('0x1b')]);module[_0x78d3('0x1c')]=router; \ No newline at end of file +var _0x62e4=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','/:id','isAuthenticated','show','/:id/any_conditions','getAnyConditions','/:id/actions','create','post','addAllCondition','addAction','put','delete','destroy','exports','multer'];(function(_0x15f96e,_0x168cb6){var _0x17f602=function(_0x1512c1){while(--_0x1512c1){_0x15f96e['push'](_0x15f96e['shift']());}};_0x17f602(++_0x168cb6);}(_0x62e4,0x12b));var _0x462e=function(_0xb86ce2,_0x1094b3){_0xb86ce2=_0xb86ce2-0x0;var _0x4ff874=_0x62e4[_0xb86ce2];return _0x4ff874;};'use strict';var multer=require(_0x462e('0x0'));var util=require(_0x462e('0x1'));var path=require(_0x462e('0x2'));var timeout=require('connect-timeout');var express=require(_0x462e('0x3'));var router=express[_0x462e('0x4')]();var fs_extra=require(_0x462e('0x5'));var auth=require(_0x462e('0x6'));var interaction=require(_0x462e('0x7'));var config=require(_0x462e('0x8'));var controller=require(_0x462e('0x9'));router[_0x462e('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x462e('0xa')](_0x462e('0xb'),auth[_0x462e('0xc')](),controller[_0x462e('0xd')]);router[_0x462e('0xa')]('/:id/all_conditions',auth[_0x462e('0xc')](),controller['getAllConditions']);router[_0x462e('0xa')](_0x462e('0xe'),auth[_0x462e('0xc')](),controller[_0x462e('0xf')]);router[_0x462e('0xa')](_0x462e('0x10'),auth[_0x462e('0xc')](),controller['getActions']);router['post']('/',auth[_0x462e('0xc')](),controller[_0x462e('0x11')]);router[_0x462e('0x12')]('/:id/all_conditions',auth['isAuthenticated'](),controller[_0x462e('0x13')]);router['post']('/:id/any_conditions',auth[_0x462e('0xc')](),controller['addAnyCondition']);router[_0x462e('0x12')](_0x462e('0x10'),auth[_0x462e('0xc')](),controller[_0x462e('0x14')]);router[_0x462e('0x15')](_0x462e('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x462e('0x16')](_0x462e('0xb'),auth[_0x462e('0xc')](),controller[_0x462e('0x17')]);module[_0x462e('0x18')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index bf709fb..dd054e1 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 _0x55fd=['exports','STRING','BOOLEAN','sequelize'];(function(_0x4cad81,_0x57ddcd){var _0x4edd5e=function(_0x3a5678){while(--_0x3a5678){_0x4cad81['push'](_0x4cad81['shift']());}};_0x4edd5e(++_0x57ddcd);}(_0x55fd,0xbf));var _0xd55f=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x55fd[_0x47a7d0];return _0xb9bd08;};'use strict';var Sequelize=require(_0xd55f('0x0'));module[_0xd55f('0x1')]={'name':{'type':Sequelize[_0xd55f('0x2')]},'channel':{'type':Sequelize[_0xd55f('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xd55f('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xaa65=['sequelize','exports','STRING','BOOLEAN'];(function(_0x21bfec,_0x97120f){var _0x3f223e=function(_0x193962){while(--_0x193962){_0x21bfec['push'](_0x21bfec['shift']());}};_0x3f223e(++_0x97120f);}(_0xaa65,0x90));var _0x5aa6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaa65[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x5aa6('0x0'));module[_0x5aa6('0x1')]={'name':{'type':Sequelize[_0x5aa6('0x2')]},'channel':{'type':Sequelize[_0x5aa6('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x5aa6('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 df94c01..86f1712 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 _0xb533=['offset','undefined','limit','count','json','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Trigger','rawAttributes','type','key','keys','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','findAll','rows','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','TriggerAllId','TriggerAnyId','Condition','getAllConditions','getAnyConditions','findOne','Action','getActions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0xb533,0x9f));var _0x3b53=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xb533[_0x5f09c5];return _0x426ad9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3b53('0x0'));var zipdir=require(_0x3b53('0x1'));var jsonpatch=require(_0x3b53('0x2'));var rp=require(_0x3b53('0x3'));var moment=require(_0x3b53('0x4'));var BPromise=require(_0x3b53('0x5'));var Mustache=require('mustache');var util=require(_0x3b53('0x6'));var path=require(_0x3b53('0x7'));var sox=require(_0x3b53('0x8'));var csv=require(_0x3b53('0x9'));var ejs=require(_0x3b53('0xa'));var fs=require('fs');var fs_extra=require(_0x3b53('0xb'));var _=require(_0x3b53('0xc'));var squel=require(_0x3b53('0xd'));var crypto=require(_0x3b53('0xe'));var jsforce=require(_0x3b53('0xf'));var deskjs=require(_0x3b53('0x10'));var toCsv=require(_0x3b53('0x9'));var querystring=require(_0x3b53('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3b53('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3b53('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3b53('0x14'))(_0x3b53('0x15'));var utils=require(_0x3b53('0x16'));var config=require(_0x3b53('0x17'));var licenseUtil=require(_0x3b53('0x18'));var db=require(_0x3b53('0x19'))['db'];function respondWithStatusCode(_0x5b06d3,_0x596850){_0x596850=_0x596850||0xcc;return function(_0x16668d){if(_0x16668d){return _0x5b06d3[_0x3b53('0x1a')](_0x596850);}return _0x5b06d3['status'](_0x596850)[_0x3b53('0x1b')]();};}function respondWithResult(_0x4fc5f7,_0x9dfbbb){_0x9dfbbb=_0x9dfbbb||0xc8;return function(_0x408f86){if(_0x408f86){return _0x4fc5f7[_0x3b53('0x1c')](_0x9dfbbb)['json'](_0x408f86);}};}function respondWithFilteredResult(_0x3b2b67,_0x1550ce){return function(_0x2e188c){if(_0x2e188c){var _0x4fcb56=typeof _0x1550ce[_0x3b53('0x1d')]===_0x3b53('0x1e')&&typeof _0x1550ce[_0x3b53('0x1f')]===_0x3b53('0x1e');var _0x3a7add=_0x2e188c[_0x3b53('0x20')];var _0x1baf93=_0x4fcb56?0x0:_0x1550ce[_0x3b53('0x1d')];var _0x23a4c9=_0x4fcb56?_0x2e188c['count']:_0x1550ce[_0x3b53('0x1d')]+_0x1550ce['limit'];var _0x11c717;if(_0x23a4c9>=_0x3a7add){_0x23a4c9=_0x3a7add;_0x11c717=0xc8;}else{_0x11c717=0xce;}_0x3b2b67[_0x3b53('0x1c')](_0x11c717);return _0x3b2b67['set']('Content-Range',_0x1baf93+'-'+_0x23a4c9+'/'+_0x3a7add)[_0x3b53('0x21')](_0x2e188c);}return null;};}function patchUpdates(_0x1918f1){return function(_0x27b7ae){try{jsonpatch[_0x3b53('0x22')](_0x27b7ae,_0x1918f1,!![]);}catch(_0x4d57dc){return BPromise[_0x3b53('0x23')](_0x4d57dc);}return _0x27b7ae['save']();};}function saveUpdates(_0x3c84ae,_0x126d94){return function(_0x2c439f){if(_0x2c439f){return _0x2c439f[_0x3b53('0x24')](_0x3c84ae)[_0x3b53('0x25')](function(_0x2989a8){return _0x2989a8;});}return null;};}function removeEntity(_0x2dd523,_0x1b8c6d){return function(_0x54e75a){if(_0x54e75a){return _0x54e75a[_0x3b53('0x26')]()[_0x3b53('0x25')](function(){var _0x444a52=_0x54e75a[_0x3b53('0x27')]({'plain':!![]});var _0x177dfb='Triggers';return db[_0x3b53('0x28')][_0x3b53('0x26')]({'where':{'type':_0x177dfb,'resourceId':_0x444a52['id']}})[_0x3b53('0x25')](function(){return _0x54e75a;});})[_0x3b53('0x25')](function(){_0x2dd523[_0x3b53('0x1c')](0xcc)[_0x3b53('0x1b')]();});}};}function handleEntityNotFound(_0x387939,_0x16d36d){return function(_0x355795){if(!_0x355795){_0x387939[_0x3b53('0x1a')](0x194);}return _0x355795;};}function handleError(_0xe494,_0x53b22c){_0x53b22c=_0x53b22c||0x1f4;return function(_0x20f689){logger[_0x3b53('0x29')](_0x20f689[_0x3b53('0x2a')]);if(_0x20f689[_0x3b53('0x2b')]){delete _0x20f689[_0x3b53('0x2b')];}_0xe494['status'](_0x53b22c)[_0x3b53('0x2c')](_0x20f689);};}exports[_0x3b53('0x2d')]=function(_0x5153c2,_0x297cd9){var _0x1d11d6={},_0xb45f60={},_0x2512cd={'count':0x0,'rows':[]};var _0xb5ba0e=_[_0x3b53('0x2e')](db[_0x3b53('0x2f')][_0x3b53('0x30')],function(_0x49a734){return{'name':_0x49a734['fieldName'],'type':_0x49a734[_0x3b53('0x31')][_0x3b53('0x32')]};});_0xb45f60['model']=_[_0x3b53('0x2e')](_0xb5ba0e,_0x3b53('0x2b'));_0xb45f60['query']=_[_0x3b53('0x33')](_0x5153c2[_0x3b53('0x34')]);_0xb45f60['filters']=_[_0x3b53('0x35')](_0xb45f60['model'],_0xb45f60[_0x3b53('0x34')]);_0x1d11d6[_0x3b53('0x36')]=_[_0x3b53('0x35')](_0xb45f60[_0x3b53('0x37')],qs['fields'](_0x5153c2[_0x3b53('0x34')][_0x3b53('0x38')]));_0x1d11d6[_0x3b53('0x36')]=_0x1d11d6['attributes'][_0x3b53('0x39')]?_0x1d11d6[_0x3b53('0x36')]:_0xb45f60[_0x3b53('0x37')];if(!_0x5153c2[_0x3b53('0x34')][_0x3b53('0x3a')](_0x3b53('0x3b'))){_0x1d11d6['limit']=qs['limit'](_0x5153c2[_0x3b53('0x34')][_0x3b53('0x1f')]);_0x1d11d6[_0x3b53('0x1d')]=qs[_0x3b53('0x1d')](_0x5153c2[_0x3b53('0x34')][_0x3b53('0x1d')]);}_0x1d11d6[_0x3b53('0x3c')]=qs[_0x3b53('0x3d')](_0x5153c2[_0x3b53('0x34')][_0x3b53('0x3d')]);_0x1d11d6[_0x3b53('0x3e')]=qs[_0x3b53('0x3f')](_[_0x3b53('0x40')](_0x5153c2[_0x3b53('0x34')],_0xb45f60[_0x3b53('0x3f')]),_0xb5ba0e);if(_0x5153c2[_0x3b53('0x34')][_0x3b53('0x41')]){_0x1d11d6[_0x3b53('0x3e')]=_[_0x3b53('0x42')](_0x1d11d6[_0x3b53('0x3e')],{'$or':_[_0x3b53('0x2e')](_0xb5ba0e,function(_0x36507b){if(_0x36507b['type']!=='VIRTUAL'){var _0x526080={};_0x526080[_0x36507b['name']]={'$like':'%'+_0x5153c2[_0x3b53('0x34')][_0x3b53('0x41')]+'%'};return _0x526080;}})});}_0x1d11d6=_[_0x3b53('0x42')]({},_0x1d11d6,_0x5153c2[_0x3b53('0x43')]);var _0x2d8e1f={'where':_0x1d11d6[_0x3b53('0x3e')]};return db[_0x3b53('0x2f')][_0x3b53('0x20')](_0x2d8e1f)[_0x3b53('0x25')](function(_0x187357){_0x2512cd[_0x3b53('0x20')]=_0x187357;if(_0x5153c2[_0x3b53('0x34')][_0x3b53('0x44')]){_0x1d11d6['include']=[{'all':!![]}];}return db[_0x3b53('0x2f')][_0x3b53('0x45')](_0x1d11d6);})[_0x3b53('0x25')](function(_0x38bc95){_0x2512cd[_0x3b53('0x46')]=_0x38bc95;return _0x2512cd;})[_0x3b53('0x25')](respondWithFilteredResult(_0x297cd9,_0x1d11d6))['catch'](handleError(_0x297cd9,null));};exports[_0x3b53('0x47')]=function(_0x59c764,_0x3a6b1c){var _0x11996f={'raw':![],'where':{'id':_0x59c764[_0x3b53('0x48')]['id']}},_0x577b04={};_0x577b04['model']=_['keys'](db[_0x3b53('0x2f')][_0x3b53('0x30')]);_0x577b04[_0x3b53('0x34')]=_[_0x3b53('0x33')](_0x59c764[_0x3b53('0x34')]);_0x577b04[_0x3b53('0x3f')]=_['intersection'](_0x577b04[_0x3b53('0x37')],_0x577b04['query']);_0x11996f['attributes']=_[_0x3b53('0x35')](_0x577b04['model'],qs[_0x3b53('0x38')](_0x59c764[_0x3b53('0x34')][_0x3b53('0x38')]));_0x11996f[_0x3b53('0x36')]=_0x11996f[_0x3b53('0x36')][_0x3b53('0x39')]?_0x11996f[_0x3b53('0x36')]:_0x577b04[_0x3b53('0x37')];if(_0x59c764['query'][_0x3b53('0x44')]){_0x11996f[_0x3b53('0x49')]=[{'all':!![]}];}_0x11996f=_[_0x3b53('0x42')]({},_0x11996f,_0x59c764['options']);return db['Trigger'][_0x3b53('0x4a')](_0x11996f)[_0x3b53('0x25')](handleEntityNotFound(_0x3a6b1c,null))[_0x3b53('0x25')](respondWithResult(_0x3a6b1c,null))['catch'](handleError(_0x3a6b1c,null));};exports['create']=function(_0x32c378,_0x25b2f4){return db[_0x3b53('0x2f')][_0x3b53('0x4b')](_0x32c378[_0x3b53('0x4c')],{})[_0x3b53('0x25')](function(_0x36cbd7){var _0x28a0f7=_0x32c378[_0x3b53('0x4d')][_0x3b53('0x27')]({'plain':!![]});if(!_0x28a0f7)throw new Error(_0x3b53('0x4e'));if(_0x28a0f7[_0x3b53('0x4f')]===_0x3b53('0x4d')){var _0x6a42fd=_0x36cbd7['get']({'plain':!![]});var _0x3b555e=_0x3b53('0x50');return db[_0x3b53('0x51')][_0x3b53('0x4a')]({'where':{'name':_0x3b555e,'userProfileId':_0x28a0f7[_0x3b53('0x52')]},'raw':!![]})[_0x3b53('0x25')](function(_0x7f0e53){if(_0x7f0e53&&_0x7f0e53[_0x3b53('0x53')]===0x0){return db['UserProfileResource']['create']({'name':_0x6a42fd[_0x3b53('0x2b')],'resourceId':_0x6a42fd['id'],'type':_0x7f0e53['name'],'sectionId':_0x7f0e53['id']},{})[_0x3b53('0x25')](function(){return _0x36cbd7;});}else{return _0x36cbd7;}})[_0x3b53('0x54')](function(_0x29c0d7){logger[_0x3b53('0x29')](_0x3b53('0x55'),_0x29c0d7);throw _0x29c0d7;});}return _0x36cbd7;})[_0x3b53('0x25')](respondWithResult(_0x25b2f4,0xc9))[_0x3b53('0x54')](handleError(_0x25b2f4,null));};exports[_0x3b53('0x24')]=function(_0x46fcb8,_0x302ab5){if(_0x46fcb8['body']['id']){delete _0x46fcb8[_0x3b53('0x4c')]['id'];}return db[_0x3b53('0x2f')][_0x3b53('0x4a')]({'where':{'id':_0x46fcb8[_0x3b53('0x48')]['id']}})[_0x3b53('0x25')](handleEntityNotFound(_0x302ab5,null))['then'](saveUpdates(_0x46fcb8[_0x3b53('0x4c')],null))[_0x3b53('0x25')](respondWithResult(_0x302ab5,null))[_0x3b53('0x54')](handleError(_0x302ab5,null));};exports[_0x3b53('0x26')]=function(_0x91b51a,_0x449365){return db[_0x3b53('0x2f')][_0x3b53('0x4a')]({'where':{'id':_0x91b51a[_0x3b53('0x48')]['id']}})[_0x3b53('0x25')](handleEntityNotFound(_0x449365,null))[_0x3b53('0x25')](removeEntity(_0x449365,null))['catch'](handleError(_0x449365,null));};exports['addAllCondition']=function(_0x996793,_0x29ef70,_0x2bb701){if(_0x996793[_0x3b53('0x4c')]['id']){delete _0x996793['body']['id'];}return db[_0x3b53('0x2f')][_0x3b53('0x4a')]({'where':{'id':_0x996793['params']['id']}})[_0x3b53('0x25')](handleEntityNotFound(_0x29ef70,null))[_0x3b53('0x25')](function(_0x501764){if(_0x501764){_0x996793[_0x3b53('0x4c')][_0x3b53('0x56')]=_0x501764['id'];return db['Condition']['create'](_0x996793['body']);}})[_0x3b53('0x25')](respondWithResult(_0x29ef70,null))[_0x3b53('0x54')](handleError(_0x29ef70,null));};exports['addAnyCondition']=function(_0x5e5b21,_0x20ff83,_0x3d09c1){if(_0x5e5b21[_0x3b53('0x4c')]['id']){delete _0x5e5b21[_0x3b53('0x4c')]['id'];}return db[_0x3b53('0x2f')][_0x3b53('0x4a')]({'where':{'id':_0x5e5b21[_0x3b53('0x48')]['id']}})[_0x3b53('0x25')](handleEntityNotFound(_0x20ff83,null))['then'](function(_0x4085a5){if(_0x4085a5){_0x5e5b21['body'][_0x3b53('0x57')]=_0x4085a5['id'];return db['Condition'][_0x3b53('0x4b')](_0x5e5b21[_0x3b53('0x4c')]);}})[_0x3b53('0x25')](respondWithResult(_0x20ff83,null))[_0x3b53('0x54')](handleError(_0x20ff83,null));};exports['getAllConditions']=function(_0x47ed37,_0x36c333,_0x328d04){var _0x427229={};var _0x151667={};var _0x19bfa7;var _0x3efef1;return db[_0x3b53('0x2f')]['findOne']({'where':{'id':_0x47ed37['params']['id']}})[_0x3b53('0x25')](handleEntityNotFound(_0x36c333,null))['then'](function(_0x53571f){if(_0x53571f){_0x19bfa7=_0x53571f;_0x151667[_0x3b53('0x37')]=_[_0x3b53('0x33')](db[_0x3b53('0x58')][_0x3b53('0x30')]);_0x151667[_0x3b53('0x34')]=_['keys'](_0x47ed37[_0x3b53('0x34')]);_0x151667[_0x3b53('0x3f')]=_[_0x3b53('0x35')](_0x151667['model'],_0x151667[_0x3b53('0x34')]);_0x427229[_0x3b53('0x36')]=_['intersection'](_0x151667[_0x3b53('0x37')],qs['fields'](_0x47ed37[_0x3b53('0x34')][_0x3b53('0x38')]));_0x427229['attributes']=_0x427229[_0x3b53('0x36')][_0x3b53('0x39')]?_0x427229[_0x3b53('0x36')]:_0x151667['model'];_0x427229[_0x3b53('0x3c')]=qs['sort'](_0x47ed37['query']['sort']);_0x427229['where']=qs[_0x3b53('0x3f')](_[_0x3b53('0x40')](_0x47ed37[_0x3b53('0x34')],_0x151667[_0x3b53('0x3f')]));if(_0x47ed37[_0x3b53('0x34')][_0x3b53('0x41')]){_0x427229['where']=_[_0x3b53('0x42')](_0x427229[_0x3b53('0x3e')],{'$or':_['map'](_0x427229[_0x3b53('0x36')],function(_0x209658){var _0x579a46={};_0x579a46[_0x209658]={'$like':'%'+_0x47ed37[_0x3b53('0x34')][_0x3b53('0x41')]+'%'};return _0x579a46;})});}_0x427229=_['merge']({},_0x427229,_0x47ed37['options']);return _0x19bfa7[_0x3b53('0x59')](_0x427229);}})['then'](function(_0x3aa813){if(_0x3aa813){_0x3efef1=_0x3aa813[_0x3b53('0x39')];if(!_0x47ed37[_0x3b53('0x34')]['hasOwnProperty'](_0x3b53('0x3b'))){_0x427229[_0x3b53('0x1f')]=qs[_0x3b53('0x1f')](_0x47ed37[_0x3b53('0x34')][_0x3b53('0x1f')]);_0x427229[_0x3b53('0x1d')]=qs[_0x3b53('0x1d')](_0x47ed37[_0x3b53('0x34')][_0x3b53('0x1d')]);}return _0x19bfa7['getAllConditions'](_0x427229);}})['then'](function(_0x29d9c8){if(_0x29d9c8){return _0x29d9c8?{'count':_0x3efef1,'rows':_0x29d9c8}:null;}})[_0x3b53('0x25')](respondWithResult(_0x36c333,null))['catch'](handleError(_0x36c333,null));};exports[_0x3b53('0x5a')]=function(_0xa898a5,_0x5bdd3d,_0x45af05){var _0x4be1af={};var _0x1549cb={};var _0x291320;var _0x5dfbc1;return db['Trigger'][_0x3b53('0x5b')]({'where':{'id':_0xa898a5[_0x3b53('0x48')]['id']}})[_0x3b53('0x25')](handleEntityNotFound(_0x5bdd3d,null))[_0x3b53('0x25')](function(_0x9ec7e7){if(_0x9ec7e7){_0x291320=_0x9ec7e7;_0x1549cb['model']=_['keys'](db['Condition'][_0x3b53('0x30')]);_0x1549cb[_0x3b53('0x34')]=_[_0x3b53('0x33')](_0xa898a5['query']);_0x1549cb[_0x3b53('0x3f')]=_['intersection'](_0x1549cb[_0x3b53('0x37')],_0x1549cb[_0x3b53('0x34')]);_0x4be1af[_0x3b53('0x36')]=_[_0x3b53('0x35')](_0x1549cb[_0x3b53('0x37')],qs[_0x3b53('0x38')](_0xa898a5[_0x3b53('0x34')][_0x3b53('0x38')]));_0x4be1af['attributes']=_0x4be1af[_0x3b53('0x36')][_0x3b53('0x39')]?_0x4be1af['attributes']:_0x1549cb[_0x3b53('0x37')];_0x4be1af[_0x3b53('0x3c')]=qs['sort'](_0xa898a5[_0x3b53('0x34')][_0x3b53('0x3d')]);_0x4be1af['where']=qs[_0x3b53('0x3f')](_[_0x3b53('0x40')](_0xa898a5[_0x3b53('0x34')],_0x1549cb['filters']));if(_0xa898a5[_0x3b53('0x34')]['filter']){_0x4be1af[_0x3b53('0x3e')]=_['merge'](_0x4be1af[_0x3b53('0x3e')],{'$or':_[_0x3b53('0x2e')](_0x4be1af[_0x3b53('0x36')],function(_0x4280a5){var _0x424f66={};_0x424f66[_0x4280a5]={'$like':'%'+_0xa898a5[_0x3b53('0x34')][_0x3b53('0x41')]+'%'};return _0x424f66;})});}_0x4be1af=_[_0x3b53('0x42')]({},_0x4be1af,_0xa898a5['options']);return _0x291320[_0x3b53('0x5a')](_0x4be1af);}})[_0x3b53('0x25')](function(_0x1f9e54){if(_0x1f9e54){_0x5dfbc1=_0x1f9e54['length'];if(!_0xa898a5[_0x3b53('0x34')][_0x3b53('0x3a')](_0x3b53('0x3b'))){_0x4be1af[_0x3b53('0x1f')]=qs['limit'](_0xa898a5[_0x3b53('0x34')][_0x3b53('0x1f')]);_0x4be1af[_0x3b53('0x1d')]=qs[_0x3b53('0x1d')](_0xa898a5[_0x3b53('0x34')][_0x3b53('0x1d')]);}return _0x291320[_0x3b53('0x5a')](_0x4be1af);}})['then'](function(_0x1b40a9){if(_0x1b40a9){return _0x1b40a9?{'count':_0x5dfbc1,'rows':_0x1b40a9}:null;}})['then'](respondWithResult(_0x5bdd3d,null))[_0x3b53('0x54')](handleError(_0x5bdd3d,null));};exports['addAction']=function(_0x202dc8,_0x264250,_0x5ddb92){if(_0x202dc8['body']['id']){delete _0x202dc8[_0x3b53('0x4c')]['id'];}return db[_0x3b53('0x2f')][_0x3b53('0x4a')]({'where':{'id':_0x202dc8[_0x3b53('0x48')]['id']}})['then'](handleEntityNotFound(_0x264250,null))['then'](function(_0x34d9d9){if(_0x34d9d9){_0x202dc8[_0x3b53('0x4c')]['TriggerId']=_0x34d9d9['id'];return db[_0x3b53('0x5c')][_0x3b53('0x4b')](_0x202dc8[_0x3b53('0x4c')]);}})[_0x3b53('0x25')](respondWithResult(_0x264250,null))[_0x3b53('0x54')](handleError(_0x264250,null));};exports[_0x3b53('0x5d')]=function(_0x415dd1,_0x14bfdd,_0x21d01d){var _0x4b01f6={};var _0x160d0b={};var _0x5ce9ac;var _0x296dcb;return db[_0x3b53('0x2f')][_0x3b53('0x5b')]({'where':{'id':_0x415dd1[_0x3b53('0x48')]['id']}})[_0x3b53('0x25')](handleEntityNotFound(_0x14bfdd,null))[_0x3b53('0x25')](function(_0x2b41d1){if(_0x2b41d1){_0x5ce9ac=_0x2b41d1;_0x160d0b[_0x3b53('0x37')]=_[_0x3b53('0x33')](db[_0x3b53('0x5c')][_0x3b53('0x30')]);_0x160d0b[_0x3b53('0x34')]=_['keys'](_0x415dd1[_0x3b53('0x34')]);_0x160d0b[_0x3b53('0x3f')]=_[_0x3b53('0x35')](_0x160d0b[_0x3b53('0x37')],_0x160d0b['query']);_0x4b01f6[_0x3b53('0x36')]=_[_0x3b53('0x35')](_0x160d0b[_0x3b53('0x37')],qs['fields'](_0x415dd1[_0x3b53('0x34')][_0x3b53('0x38')]));_0x4b01f6[_0x3b53('0x36')]=_0x4b01f6[_0x3b53('0x36')][_0x3b53('0x39')]?_0x4b01f6[_0x3b53('0x36')]:_0x160d0b[_0x3b53('0x37')];_0x4b01f6[_0x3b53('0x3c')]=qs[_0x3b53('0x3d')](_0x415dd1[_0x3b53('0x34')][_0x3b53('0x3d')]);_0x4b01f6[_0x3b53('0x3e')]=qs[_0x3b53('0x3f')](_[_0x3b53('0x40')](_0x415dd1[_0x3b53('0x34')],_0x160d0b[_0x3b53('0x3f')]));if(_0x415dd1['query']['filter']){_0x4b01f6[_0x3b53('0x3e')]=_['merge'](_0x4b01f6['where'],{'$or':_[_0x3b53('0x2e')](_0x4b01f6[_0x3b53('0x36')],function(_0x3e2b9d){var _0x4dcb66={};_0x4dcb66[_0x3e2b9d]={'$like':'%'+_0x415dd1[_0x3b53('0x34')][_0x3b53('0x41')]+'%'};return _0x4dcb66;})});}_0x4b01f6=_[_0x3b53('0x42')]({},_0x4b01f6,_0x415dd1[_0x3b53('0x43')]);return _0x5ce9ac[_0x3b53('0x5d')](_0x4b01f6);}})[_0x3b53('0x25')](function(_0x3badaf){if(_0x3badaf){_0x296dcb=_0x3badaf[_0x3b53('0x39')];if(!_0x415dd1[_0x3b53('0x34')][_0x3b53('0x3a')](_0x3b53('0x3b'))){_0x4b01f6[_0x3b53('0x1f')]=qs['limit'](_0x415dd1[_0x3b53('0x34')][_0x3b53('0x1f')]);_0x4b01f6[_0x3b53('0x1d')]=qs[_0x3b53('0x1d')](_0x415dd1[_0x3b53('0x34')]['offset']);}return _0x5ce9ac[_0x3b53('0x5d')](_0x4b01f6);}})[_0x3b53('0x25')](function(_0x271d27){if(_0x271d27){return _0x271d27?{'count':_0x296dcb,'rows':_0x271d27}:null;}})['then'](respondWithResult(_0x14bfdd,null))[_0x3b53('0x54')](handleError(_0x14bfdd,null));}; \ No newline at end of file +var _0x769b=['catch','show','rawAttributes','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','addAllCondition','params','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','order','nolimit','getAnyConditions','addAction','Action','getActions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','get','Triggers','UserProfileResource','destroy','error','stack','name','send','map','Trigger','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','sort','where','filters','pick','filter','merge','options','includeAll','findAll','rows'];(function(_0x140202,_0x4245c7){var _0x3037c2=function(_0x525d19){while(--_0x525d19){_0x140202['push'](_0x140202['shift']());}};_0x3037c2(++_0x4245c7);}(_0x769b,0x7c));var _0xb769=function(_0x38347b,_0x57c12a){_0x38347b=_0x38347b-0x0;var _0x404250=_0x769b[_0x38347b];return _0x404250;};'use strict';var emlformat=require(_0xb769('0x0'));var rimraf=require(_0xb769('0x1'));var zipdir=require(_0xb769('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb769('0x3'));var moment=require(_0xb769('0x4'));var BPromise=require(_0xb769('0x5'));var Mustache=require('mustache');var util=require(_0xb769('0x6'));var path=require(_0xb769('0x7'));var sox=require(_0xb769('0x8'));var csv=require(_0xb769('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb769('0xa'));var _=require(_0xb769('0xb'));var squel=require('squel');var crypto=require(_0xb769('0xc'));var jsforce=require(_0xb769('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb769('0x9'));var querystring=require(_0xb769('0xe'));var Papa=require(_0xb769('0xf'));var Redis=require('ioredis');var authService=require(_0xb769('0x10'));var qs=require(_0xb769('0x11'));var as=require(_0xb769('0x12'));var hardwareService=require(_0xb769('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xb769('0x14'));var config=require(_0xb769('0x15'));var licenseUtil=require(_0xb769('0x16'));var db=require(_0xb769('0x17'))['db'];function respondWithStatusCode(_0x78937b,_0x489698){_0x489698=_0x489698||0xcc;return function(_0x52dc94){if(_0x52dc94){return _0x78937b[_0xb769('0x18')](_0x489698);}return _0x78937b['status'](_0x489698)[_0xb769('0x19')]();};}function respondWithResult(_0xb060fe,_0x2bb266){_0x2bb266=_0x2bb266||0xc8;return function(_0x1dc889){if(_0x1dc889){return _0xb060fe[_0xb769('0x1a')](_0x2bb266)[_0xb769('0x1b')](_0x1dc889);}};}function respondWithFilteredResult(_0x3a8aeb,_0x4b99b1){return function(_0x3bb527){if(_0x3bb527){var _0x38937f=typeof _0x4b99b1[_0xb769('0x1c')]===_0xb769('0x1d')&&typeof _0x4b99b1[_0xb769('0x1e')]==='undefined';var _0x25befa=_0x3bb527['count'];var _0x1bb56c=_0x38937f?0x0:_0x4b99b1[_0xb769('0x1c')];var _0x96a1f1=_0x38937f?_0x3bb527[_0xb769('0x1f')]:_0x4b99b1['offset']+_0x4b99b1['limit'];var _0x54dbfd;if(_0x96a1f1>=_0x25befa){_0x96a1f1=_0x25befa;_0x54dbfd=0xc8;}else{_0x54dbfd=0xce;}_0x3a8aeb['status'](_0x54dbfd);return _0x3a8aeb[_0xb769('0x20')](_0xb769('0x21'),_0x1bb56c+'-'+_0x96a1f1+'/'+_0x25befa)[_0xb769('0x1b')](_0x3bb527);}return null;};}function patchUpdates(_0x35314c){return function(_0x510709){try{jsonpatch['apply'](_0x510709,_0x35314c,!![]);}catch(_0x250b32){return BPromise['reject'](_0x250b32);}return _0x510709[_0xb769('0x22')]();};}function saveUpdates(_0x42b6eb,_0x8054ea){return function(_0x147fc9){if(_0x147fc9){return _0x147fc9[_0xb769('0x23')](_0x42b6eb)[_0xb769('0x24')](function(_0x43320c){return _0x43320c;});}return null;};}function removeEntity(_0x256ab6,_0x3a9318){return function(_0x107434){if(_0x107434){return _0x107434['destroy']()[_0xb769('0x24')](function(){var _0x416c67=_0x107434[_0xb769('0x25')]({'plain':!![]});var _0x572163=_0xb769('0x26');return db[_0xb769('0x27')][_0xb769('0x28')]({'where':{'type':_0x572163,'resourceId':_0x416c67['id']}})['then'](function(){return _0x107434;});})[_0xb769('0x24')](function(){_0x256ab6[_0xb769('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x335310,_0x3f57ed){return function(_0x570303){if(!_0x570303){_0x335310[_0xb769('0x18')](0x194);}return _0x570303;};}function handleError(_0x53c7e1,_0x4e1b73){_0x4e1b73=_0x4e1b73||0x1f4;return function(_0x1b2a0e){logger[_0xb769('0x29')](_0x1b2a0e[_0xb769('0x2a')]);if(_0x1b2a0e[_0xb769('0x2b')]){delete _0x1b2a0e[_0xb769('0x2b')];}_0x53c7e1[_0xb769('0x1a')](_0x4e1b73)[_0xb769('0x2c')](_0x1b2a0e);};}exports['index']=function(_0x141b55,_0x2e918a){var _0x1431a3={},_0x2be67b={},_0x864c3={'count':0x0,'rows':[]};var _0x6f11c6=_[_0xb769('0x2d')](db[_0xb769('0x2e')]['rawAttributes'],function(_0x1c5ab9){return{'name':_0x1c5ab9[_0xb769('0x2f')],'type':_0x1c5ab9[_0xb769('0x30')][_0xb769('0x31')]};});_0x2be67b[_0xb769('0x32')]=_[_0xb769('0x2d')](_0x6f11c6,'name');_0x2be67b[_0xb769('0x33')]=_[_0xb769('0x34')](_0x141b55[_0xb769('0x33')]);_0x2be67b['filters']=_[_0xb769('0x35')](_0x2be67b[_0xb769('0x32')],_0x2be67b[_0xb769('0x33')]);_0x1431a3['attributes']=_[_0xb769('0x35')](_0x2be67b[_0xb769('0x32')],qs[_0xb769('0x36')](_0x141b55[_0xb769('0x33')][_0xb769('0x36')]));_0x1431a3[_0xb769('0x37')]=_0x1431a3[_0xb769('0x37')][_0xb769('0x38')]?_0x1431a3['attributes']:_0x2be67b['model'];if(!_0x141b55[_0xb769('0x33')][_0xb769('0x39')]('nolimit')){_0x1431a3[_0xb769('0x1e')]=qs[_0xb769('0x1e')](_0x141b55[_0xb769('0x33')][_0xb769('0x1e')]);_0x1431a3[_0xb769('0x1c')]=qs[_0xb769('0x1c')](_0x141b55[_0xb769('0x33')][_0xb769('0x1c')]);}_0x1431a3['order']=qs[_0xb769('0x3a')](_0x141b55[_0xb769('0x33')][_0xb769('0x3a')]);_0x1431a3[_0xb769('0x3b')]=qs[_0xb769('0x3c')](_[_0xb769('0x3d')](_0x141b55[_0xb769('0x33')],_0x2be67b[_0xb769('0x3c')]),_0x6f11c6);if(_0x141b55[_0xb769('0x33')][_0xb769('0x3e')]){_0x1431a3['where']=_[_0xb769('0x3f')](_0x1431a3['where'],{'$or':_[_0xb769('0x2d')](_0x6f11c6,function(_0x4e53f3){if(_0x4e53f3[_0xb769('0x30')]!=='VIRTUAL'){var _0x17b2f0={};_0x17b2f0[_0x4e53f3[_0xb769('0x2b')]]={'$like':'%'+_0x141b55['query']['filter']+'%'};return _0x17b2f0;}})});}_0x1431a3=_[_0xb769('0x3f')]({},_0x1431a3,_0x141b55[_0xb769('0x40')]);var _0x3b328b={'where':_0x1431a3[_0xb769('0x3b')]};return db[_0xb769('0x2e')][_0xb769('0x1f')](_0x3b328b)[_0xb769('0x24')](function(_0x3030f8){_0x864c3['count']=_0x3030f8;if(_0x141b55[_0xb769('0x33')][_0xb769('0x41')]){_0x1431a3['include']=[{'all':!![]}];}return db[_0xb769('0x2e')][_0xb769('0x42')](_0x1431a3);})[_0xb769('0x24')](function(_0x3aab87){_0x864c3[_0xb769('0x43')]=_0x3aab87;return _0x864c3;})[_0xb769('0x24')](respondWithFilteredResult(_0x2e918a,_0x1431a3))[_0xb769('0x44')](handleError(_0x2e918a,null));};exports[_0xb769('0x45')]=function(_0x1d9eec,_0x1e9b03){var _0x2669c2={'raw':![],'where':{'id':_0x1d9eec['params']['id']}},_0x47e55a={};_0x47e55a[_0xb769('0x32')]=_[_0xb769('0x34')](db[_0xb769('0x2e')][_0xb769('0x46')]);_0x47e55a['query']=_[_0xb769('0x34')](_0x1d9eec['query']);_0x47e55a[_0xb769('0x3c')]=_[_0xb769('0x35')](_0x47e55a[_0xb769('0x32')],_0x47e55a[_0xb769('0x33')]);_0x2669c2['attributes']=_['intersection'](_0x47e55a[_0xb769('0x32')],qs[_0xb769('0x36')](_0x1d9eec['query'][_0xb769('0x36')]));_0x2669c2['attributes']=_0x2669c2[_0xb769('0x37')][_0xb769('0x38')]?_0x2669c2[_0xb769('0x37')]:_0x47e55a[_0xb769('0x32')];if(_0x1d9eec[_0xb769('0x33')][_0xb769('0x41')]){_0x2669c2[_0xb769('0x47')]=[{'all':!![]}];}_0x2669c2=_[_0xb769('0x3f')]({},_0x2669c2,_0x1d9eec[_0xb769('0x40')]);return db[_0xb769('0x2e')]['find'](_0x2669c2)[_0xb769('0x24')](handleEntityNotFound(_0x1e9b03,null))[_0xb769('0x24')](respondWithResult(_0x1e9b03,null))[_0xb769('0x44')](handleError(_0x1e9b03,null));};exports['create']=function(_0x598dcc,_0x17de51){return db[_0xb769('0x2e')][_0xb769('0x48')](_0x598dcc[_0xb769('0x49')],{})[_0xb769('0x24')](function(_0x18fcce){var _0x968144=_0x598dcc[_0xb769('0x4a')][_0xb769('0x25')]({'plain':!![]});if(!_0x968144)throw new Error(_0xb769('0x4b'));if(_0x968144[_0xb769('0x4c')]===_0xb769('0x4a')){var _0x2a286e=_0x18fcce[_0xb769('0x25')]({'plain':!![]});var _0x16e3ee=_0xb769('0x26');return db[_0xb769('0x4d')]['find']({'where':{'name':_0x16e3ee,'userProfileId':_0x968144[_0xb769('0x4e')]},'raw':!![]})[_0xb769('0x24')](function(_0x87769d){if(_0x87769d&&_0x87769d[_0xb769('0x4f')]===0x0){return db[_0xb769('0x27')]['create']({'name':_0x2a286e[_0xb769('0x2b')],'resourceId':_0x2a286e['id'],'type':_0x87769d[_0xb769('0x2b')],'sectionId':_0x87769d['id']},{})[_0xb769('0x24')](function(){return _0x18fcce;});}else{return _0x18fcce;}})[_0xb769('0x44')](function(_0x40d9fd){logger[_0xb769('0x29')](_0xb769('0x50'),_0x40d9fd);throw _0x40d9fd;});}return _0x18fcce;})[_0xb769('0x24')](respondWithResult(_0x17de51,0xc9))['catch'](handleError(_0x17de51,null));};exports['update']=function(_0x573d05,_0x1c77a4){if(_0x573d05[_0xb769('0x49')]['id']){delete _0x573d05['body']['id'];}return db['Trigger']['find']({'where':{'id':_0x573d05['params']['id']}})['then'](handleEntityNotFound(_0x1c77a4,null))[_0xb769('0x24')](saveUpdates(_0x573d05[_0xb769('0x49')],null))['then'](respondWithResult(_0x1c77a4,null))[_0xb769('0x44')](handleError(_0x1c77a4,null));};exports[_0xb769('0x28')]=function(_0xa4ed63,_0x5a6b27){return db[_0xb769('0x2e')][_0xb769('0x51')]({'where':{'id':_0xa4ed63['params']['id']}})['then'](handleEntityNotFound(_0x5a6b27,null))['then'](removeEntity(_0x5a6b27,null))[_0xb769('0x44')](handleError(_0x5a6b27,null));};exports[_0xb769('0x52')]=function(_0x59a3a6,_0x386047,_0x45d7e8){if(_0x59a3a6[_0xb769('0x49')]['id']){delete _0x59a3a6['body']['id'];}return db[_0xb769('0x2e')]['find']({'where':{'id':_0x59a3a6[_0xb769('0x53')]['id']}})[_0xb769('0x24')](handleEntityNotFound(_0x386047,null))[_0xb769('0x24')](function(_0x15076d){if(_0x15076d){_0x59a3a6[_0xb769('0x49')][_0xb769('0x54')]=_0x15076d['id'];return db[_0xb769('0x55')]['create'](_0x59a3a6['body']);}})['then'](respondWithResult(_0x386047,null))[_0xb769('0x44')](handleError(_0x386047,null));};exports[_0xb769('0x56')]=function(_0x3264ce,_0xff95e5,_0x1d72c2){if(_0x3264ce[_0xb769('0x49')]['id']){delete _0x3264ce['body']['id'];}return db[_0xb769('0x2e')]['find']({'where':{'id':_0x3264ce[_0xb769('0x53')]['id']}})[_0xb769('0x24')](handleEntityNotFound(_0xff95e5,null))[_0xb769('0x24')](function(_0x1e1a0c){if(_0x1e1a0c){_0x3264ce[_0xb769('0x49')][_0xb769('0x57')]=_0x1e1a0c['id'];return db['Condition'][_0xb769('0x48')](_0x3264ce[_0xb769('0x49')]);}})[_0xb769('0x24')](respondWithResult(_0xff95e5,null))[_0xb769('0x44')](handleError(_0xff95e5,null));};exports[_0xb769('0x58')]=function(_0x416e9e,_0x4aa895,_0x4a723b){var _0xb76b02={};var _0x4a19e6={};var _0x52eed6;var _0x261625;return db[_0xb769('0x2e')][_0xb769('0x59')]({'where':{'id':_0x416e9e[_0xb769('0x53')]['id']}})[_0xb769('0x24')](handleEntityNotFound(_0x4aa895,null))[_0xb769('0x24')](function(_0x577464){if(_0x577464){_0x52eed6=_0x577464;_0x4a19e6[_0xb769('0x32')]=_[_0xb769('0x34')](db[_0xb769('0x55')]['rawAttributes']);_0x4a19e6[_0xb769('0x33')]=_[_0xb769('0x34')](_0x416e9e[_0xb769('0x33')]);_0x4a19e6[_0xb769('0x3c')]=_[_0xb769('0x35')](_0x4a19e6[_0xb769('0x32')],_0x4a19e6[_0xb769('0x33')]);_0xb76b02[_0xb769('0x37')]=_[_0xb769('0x35')](_0x4a19e6[_0xb769('0x32')],qs[_0xb769('0x36')](_0x416e9e[_0xb769('0x33')][_0xb769('0x36')]));_0xb76b02[_0xb769('0x37')]=_0xb76b02[_0xb769('0x37')][_0xb769('0x38')]?_0xb76b02['attributes']:_0x4a19e6['model'];_0xb76b02[_0xb769('0x5a')]=qs[_0xb769('0x3a')](_0x416e9e[_0xb769('0x33')]['sort']);_0xb76b02['where']=qs[_0xb769('0x3c')](_['pick'](_0x416e9e[_0xb769('0x33')],_0x4a19e6['filters']));if(_0x416e9e['query'][_0xb769('0x3e')]){_0xb76b02[_0xb769('0x3b')]=_['merge'](_0xb76b02['where'],{'$or':_[_0xb769('0x2d')](_0xb76b02[_0xb769('0x37')],function(_0x559b0a){var _0x576f74={};_0x576f74[_0x559b0a]={'$like':'%'+_0x416e9e['query']['filter']+'%'};return _0x576f74;})});}_0xb76b02=_[_0xb769('0x3f')]({},_0xb76b02,_0x416e9e[_0xb769('0x40')]);return _0x52eed6[_0xb769('0x58')](_0xb76b02);}})[_0xb769('0x24')](function(_0x39b629){if(_0x39b629){_0x261625=_0x39b629[_0xb769('0x38')];if(!_0x416e9e['query'][_0xb769('0x39')](_0xb769('0x5b'))){_0xb76b02[_0xb769('0x1e')]=qs['limit'](_0x416e9e['query']['limit']);_0xb76b02[_0xb769('0x1c')]=qs[_0xb769('0x1c')](_0x416e9e['query'][_0xb769('0x1c')]);}return _0x52eed6[_0xb769('0x58')](_0xb76b02);}})[_0xb769('0x24')](function(_0x52bc96){if(_0x52bc96){return _0x52bc96?{'count':_0x261625,'rows':_0x52bc96}:null;}})[_0xb769('0x24')](respondWithResult(_0x4aa895,null))[_0xb769('0x44')](handleError(_0x4aa895,null));};exports[_0xb769('0x5c')]=function(_0x42c16b,_0x31d876,_0x2a52da){var _0x56f36e={};var _0x45f46d={};var _0xe83b21;var _0x394c79;return db[_0xb769('0x2e')]['findOne']({'where':{'id':_0x42c16b[_0xb769('0x53')]['id']}})['then'](handleEntityNotFound(_0x31d876,null))[_0xb769('0x24')](function(_0xd90339){if(_0xd90339){_0xe83b21=_0xd90339;_0x45f46d[_0xb769('0x32')]=_[_0xb769('0x34')](db[_0xb769('0x55')][_0xb769('0x46')]);_0x45f46d['query']=_['keys'](_0x42c16b[_0xb769('0x33')]);_0x45f46d[_0xb769('0x3c')]=_[_0xb769('0x35')](_0x45f46d[_0xb769('0x32')],_0x45f46d['query']);_0x56f36e['attributes']=_[_0xb769('0x35')](_0x45f46d[_0xb769('0x32')],qs['fields'](_0x42c16b[_0xb769('0x33')]['fields']));_0x56f36e[_0xb769('0x37')]=_0x56f36e[_0xb769('0x37')]['length']?_0x56f36e[_0xb769('0x37')]:_0x45f46d[_0xb769('0x32')];_0x56f36e[_0xb769('0x5a')]=qs['sort'](_0x42c16b[_0xb769('0x33')]['sort']);_0x56f36e[_0xb769('0x3b')]=qs[_0xb769('0x3c')](_[_0xb769('0x3d')](_0x42c16b[_0xb769('0x33')],_0x45f46d[_0xb769('0x3c')]));if(_0x42c16b[_0xb769('0x33')]['filter']){_0x56f36e[_0xb769('0x3b')]=_['merge'](_0x56f36e['where'],{'$or':_[_0xb769('0x2d')](_0x56f36e[_0xb769('0x37')],function(_0x47d892){var _0xbe3c75={};_0xbe3c75[_0x47d892]={'$like':'%'+_0x42c16b[_0xb769('0x33')]['filter']+'%'};return _0xbe3c75;})});}_0x56f36e=_[_0xb769('0x3f')]({},_0x56f36e,_0x42c16b['options']);return _0xe83b21[_0xb769('0x5c')](_0x56f36e);}})['then'](function(_0x329f42){if(_0x329f42){_0x394c79=_0x329f42[_0xb769('0x38')];if(!_0x42c16b['query']['hasOwnProperty']('nolimit')){_0x56f36e[_0xb769('0x1e')]=qs[_0xb769('0x1e')](_0x42c16b['query']['limit']);_0x56f36e[_0xb769('0x1c')]=qs['offset'](_0x42c16b[_0xb769('0x33')][_0xb769('0x1c')]);}return _0xe83b21['getAnyConditions'](_0x56f36e);}})['then'](function(_0x2a4c51){if(_0x2a4c51){return _0x2a4c51?{'count':_0x394c79,'rows':_0x2a4c51}:null;}})[_0xb769('0x24')](respondWithResult(_0x31d876,null))[_0xb769('0x44')](handleError(_0x31d876,null));};exports[_0xb769('0x5d')]=function(_0x243fa4,_0x1e067b,_0x55e3ce){if(_0x243fa4['body']['id']){delete _0x243fa4[_0xb769('0x49')]['id'];}return db[_0xb769('0x2e')]['find']({'where':{'id':_0x243fa4[_0xb769('0x53')]['id']}})[_0xb769('0x24')](handleEntityNotFound(_0x1e067b,null))[_0xb769('0x24')](function(_0xb781c5){if(_0xb781c5){_0x243fa4[_0xb769('0x49')]['TriggerId']=_0xb781c5['id'];return db['Action'][_0xb769('0x48')](_0x243fa4[_0xb769('0x49')]);}})[_0xb769('0x24')](respondWithResult(_0x1e067b,null))[_0xb769('0x44')](handleError(_0x1e067b,null));};exports['getActions']=function(_0x4496ab,_0x2b31de,_0x24b4f9){var _0x5bcb3d={};var _0x159f9d={};var _0x29b777;var _0x10d10a;return db[_0xb769('0x2e')][_0xb769('0x59')]({'where':{'id':_0x4496ab[_0xb769('0x53')]['id']}})[_0xb769('0x24')](handleEntityNotFound(_0x2b31de,null))[_0xb769('0x24')](function(_0x7b1b4d){if(_0x7b1b4d){_0x29b777=_0x7b1b4d;_0x159f9d[_0xb769('0x32')]=_[_0xb769('0x34')](db[_0xb769('0x5e')][_0xb769('0x46')]);_0x159f9d['query']=_[_0xb769('0x34')](_0x4496ab[_0xb769('0x33')]);_0x159f9d['filters']=_[_0xb769('0x35')](_0x159f9d[_0xb769('0x32')],_0x159f9d[_0xb769('0x33')]);_0x5bcb3d[_0xb769('0x37')]=_[_0xb769('0x35')](_0x159f9d[_0xb769('0x32')],qs[_0xb769('0x36')](_0x4496ab[_0xb769('0x33')]['fields']));_0x5bcb3d[_0xb769('0x37')]=_0x5bcb3d[_0xb769('0x37')][_0xb769('0x38')]?_0x5bcb3d[_0xb769('0x37')]:_0x159f9d['model'];_0x5bcb3d[_0xb769('0x5a')]=qs[_0xb769('0x3a')](_0x4496ab['query']['sort']);_0x5bcb3d[_0xb769('0x3b')]=qs['filters'](_[_0xb769('0x3d')](_0x4496ab[_0xb769('0x33')],_0x159f9d[_0xb769('0x3c')]));if(_0x4496ab[_0xb769('0x33')][_0xb769('0x3e')]){_0x5bcb3d[_0xb769('0x3b')]=_[_0xb769('0x3f')](_0x5bcb3d[_0xb769('0x3b')],{'$or':_['map'](_0x5bcb3d[_0xb769('0x37')],function(_0xb20379){var _0x2b0f26={};_0x2b0f26[_0xb20379]={'$like':'%'+_0x4496ab[_0xb769('0x33')]['filter']+'%'};return _0x2b0f26;})});}_0x5bcb3d=_['merge']({},_0x5bcb3d,_0x4496ab[_0xb769('0x40')]);return _0x29b777[_0xb769('0x5f')](_0x5bcb3d);}})[_0xb769('0x24')](function(_0x3ccd92){if(_0x3ccd92){_0x10d10a=_0x3ccd92[_0xb769('0x38')];if(!_0x4496ab[_0xb769('0x33')][_0xb769('0x39')](_0xb769('0x5b'))){_0x5bcb3d[_0xb769('0x1e')]=qs[_0xb769('0x1e')](_0x4496ab['query'][_0xb769('0x1e')]);_0x5bcb3d[_0xb769('0x1c')]=qs[_0xb769('0x1c')](_0x4496ab[_0xb769('0x33')]['offset']);}return _0x29b777[_0xb769('0x5f')](_0x5bcb3d);}})['then'](function(_0x113961){if(_0x113961){return _0x113961?{'count':_0x10d10a,'rows':_0x113961}:null;}})[_0xb769('0x24')](respondWithResult(_0x2b31de,null))['catch'](handleError(_0x2b31de,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index b5b2b4b..f516c09 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 _0xafe6=['rimraf','../../config/environment','./trigger.attributes','exports','define','Trigger','tools_triggers','lodash','util','moment','bluebird'];(function(_0x48210d,_0x516363){var _0x4f87b6=function(_0x437a5b){while(--_0x437a5b){_0x48210d['push'](_0x48210d['shift']());}};_0x4f87b6(++_0x516363);}(_0xafe6,0xac));var _0x6afe=function(_0x5bd4b0,_0x1ba7b8){_0x5bd4b0=_0x5bd4b0-0x0;var _0x30dc0d=_0xafe6[_0x5bd4b0];return _0x30dc0d;};'use strict';var _=require(_0x6afe('0x0'));var util=require(_0x6afe('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6afe('0x2'));var BPromise=require(_0x6afe('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6afe('0x4'));var config=require(_0x6afe('0x5'));var attributes=require(_0x6afe('0x6'));module[_0x6afe('0x7')]=function(_0x2ce302,_0x4898bb){return _0x2ce302[_0x6afe('0x8')](_0x6afe('0x9'),attributes,{'tableName':_0x6afe('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe002=['request-promise','rimraf','../../config/environment','./trigger.attributes','exports','define','Trigger','lodash','util','../../config/logger','moment','bluebird'];(function(_0x2f5504,_0x27d801){var _0x51d32a=function(_0x36dbbf){while(--_0x36dbbf){_0x2f5504['push'](_0x2f5504['shift']());}};_0x51d32a(++_0x27d801);}(_0xe002,0xf7));var _0x2e00=function(_0x391c55,_0x168617){_0x391c55=_0x391c55-0x0;var _0xa434e0=_0xe002[_0x391c55];return _0xa434e0;};'use strict';var _=require(_0x2e00('0x0'));var util=require(_0x2e00('0x1'));var logger=require(_0x2e00('0x2'))('api');var moment=require(_0x2e00('0x3'));var BPromise=require(_0x2e00('0x4'));var rp=require(_0x2e00('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2e00('0x6'));var config=require(_0x2e00('0x7'));var attributes=require(_0x2e00('0x8'));module[_0x2e00('0x9')]=function(_0x3cd8e8,_0x120155){return _0x3cd8e8[_0x2e00('0xa')](_0x2e00('0xb'),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 a82b24e..a9316e8 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 _0x3f9f=['attributes','limit','include','map','model','find','ShowTrigger','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','Trigger,\x20%s,\x20%s','message','result','GetTrigger','Trigger','findAll','options','raw','where'];(function(_0x292e74,_0x479e10){var _0x627ba6=function(_0x4f4900){while(--_0x4f4900){_0x292e74['push'](_0x292e74['shift']());}};_0x627ba6(++_0x479e10);}(_0x3f9f,0x112));var _0xf3f9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f9f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf3f9('0x0'));var util=require(_0xf3f9('0x1'));var moment=require(_0xf3f9('0x2'));var BPromise=require(_0xf3f9('0x3'));var rs=require(_0xf3f9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf3f9('0x5'))['db'];var utils=require(_0xf3f9('0x6'));var logger=require(_0xf3f9('0x7'))('rpc');var config=require(_0xf3f9('0x8'));var jayson=require(_0xf3f9('0x9'));var client=jayson[_0xf3f9('0xa')][_0xf3f9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d792e,_0xe03d90,_0x116d1d){return new BPromise(function(_0x236909,_0xfa7750){return client[_0xf3f9('0xc')](_0x5d792e,_0x116d1d)[_0xf3f9('0xd')](function(_0x2b70d8){logger[_0xf3f9('0xe')]('Trigger,\x20%s,\x20%s',_0xe03d90,_0xf3f9('0xf'));logger[_0xf3f9('0x10')](_0xf3f9('0x11'),_0xe03d90,'request\x20sent',JSON[_0xf3f9('0x12')](_0x2b70d8));if(_0x2b70d8[_0xf3f9('0x13')]){if(_0x2b70d8[_0xf3f9('0x13')][_0xf3f9('0x14')]===0x1f4){logger[_0xf3f9('0x13')](_0xf3f9('0x15'),_0xe03d90,_0x2b70d8[_0xf3f9('0x13')]['message']);return _0xfa7750(_0x2b70d8[_0xf3f9('0x13')][_0xf3f9('0x16')]);}logger[_0xf3f9('0x13')](_0xf3f9('0x15'),_0xe03d90,_0x2b70d8['error'][_0xf3f9('0x16')]);return _0x236909(_0x2b70d8[_0xf3f9('0x13')][_0xf3f9('0x16')]);}else{logger[_0xf3f9('0xe')](_0xf3f9('0x15'),_0xe03d90,_0xf3f9('0xf'));_0x236909(_0x2b70d8[_0xf3f9('0x17')][_0xf3f9('0x16')]);}})['catch'](function(_0x52d40a){logger['error'](_0xf3f9('0x15'),_0xe03d90,_0x52d40a);_0xfa7750(_0x52d40a);});});}exports[_0xf3f9('0x18')]=function(_0x300ba7){var _0x26b1f9=this;return new Promise(function(_0xe8c531,_0xb3d788){return db[_0xf3f9('0x19')][_0xf3f9('0x1a')]({'raw':_0x300ba7[_0xf3f9('0x1b')]?_0x300ba7[_0xf3f9('0x1b')][_0xf3f9('0x1c')]===undefined?!![]:![]:!![],'where':_0x300ba7[_0xf3f9('0x1b')]?_0x300ba7[_0xf3f9('0x1b')][_0xf3f9('0x1d')]||null:null,'attributes':_0x300ba7[_0xf3f9('0x1b')]?_0x300ba7[_0xf3f9('0x1b')][_0xf3f9('0x1e')]||null:null,'limit':_0x300ba7['options']?_0x300ba7[_0xf3f9('0x1b')][_0xf3f9('0x1f')]||null:null,'include':_0x300ba7[_0xf3f9('0x1b')]?_0x300ba7[_0xf3f9('0x1b')][_0xf3f9('0x20')]?_[_0xf3f9('0x21')](_0x300ba7['options'][_0xf3f9('0x20')],function(_0x281dd8){return{'model':db[_0x281dd8['model']],'as':_0x281dd8['as'],'attributes':_0x281dd8[_0xf3f9('0x1e')],'include':_0x281dd8[_0xf3f9('0x20')]?_[_0xf3f9('0x21')](_0x281dd8[_0xf3f9('0x20')],function(_0x433710){return{'model':db[_0x433710[_0xf3f9('0x22')]],'as':_0x433710['as'],'attributes':_0x433710[_0xf3f9('0x1e')],'include':_0x433710[_0xf3f9('0x20')]?_[_0xf3f9('0x21')](_0x433710[_0xf3f9('0x20')],function(_0x3286f9){return{'model':db[_0x3286f9[_0xf3f9('0x22')]],'as':_0x3286f9['as'],'attributes':_0x3286f9[_0xf3f9('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x56496d){logger[_0xf3f9('0xe')](_0xf3f9('0x18'),_0x300ba7);logger[_0xf3f9('0x10')](_0xf3f9('0x18'),_0x300ba7,JSON[_0xf3f9('0x12')](_0x56496d));_0xe8c531(_0x56496d);})['catch'](function(_0x3fbc9f){logger[_0xf3f9('0x13')]('GetTrigger',_0x3fbc9f[_0xf3f9('0x16')],_0x300ba7);_0xb3d788(_0x26b1f9[_0xf3f9('0x13')](0x1f4,_0x3fbc9f[_0xf3f9('0x16')]));});});};exports['ShowTrigger']=function(_0x1e886b){var _0x3c0a04=this;return new Promise(function(_0x1e1a4d,_0x53f474){return db[_0xf3f9('0x19')][_0xf3f9('0x23')]({'raw':_0x1e886b[_0xf3f9('0x1b')]?_0x1e886b['options']['raw']===undefined?!![]:![]:!![],'where':_0x1e886b[_0xf3f9('0x1b')]?_0x1e886b[_0xf3f9('0x1b')][_0xf3f9('0x1d')]||null:null,'attributes':_0x1e886b[_0xf3f9('0x1b')]?_0x1e886b[_0xf3f9('0x1b')][_0xf3f9('0x1e')]||null:null,'include':_0x1e886b['options']?_0x1e886b[_0xf3f9('0x1b')][_0xf3f9('0x20')]?_[_0xf3f9('0x21')](_0x1e886b['options'][_0xf3f9('0x20')],function(_0x306e88){return{'model':db[_0x306e88['model']],'as':_0x306e88['as'],'attributes':_0x306e88['attributes'],'include':_0x306e88['include']?_[_0xf3f9('0x21')](_0x306e88['include'],function(_0x34d7ae){return{'model':db[_0x34d7ae['model']],'as':_0x34d7ae['as'],'attributes':_0x34d7ae[_0xf3f9('0x1e')],'include':_0x34d7ae[_0xf3f9('0x20')]?_[_0xf3f9('0x21')](_0x34d7ae[_0xf3f9('0x20')],function(_0x1c55f6){return{'model':db[_0x1c55f6[_0xf3f9('0x22')]],'as':_0x1c55f6['as'],'attributes':_0x1c55f6[_0xf3f9('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf3f9('0xd')](function(_0x2f956d){logger[_0xf3f9('0xe')](_0xf3f9('0x24'),_0x1e886b);logger[_0xf3f9('0x10')](_0xf3f9('0x24'),_0x1e886b,JSON[_0xf3f9('0x12')](_0x2f956d));_0x1e1a4d(_0x2f956d);})[_0xf3f9('0x25')](function(_0x2b1497){logger[_0xf3f9('0x13')](_0xf3f9('0x24'),_0x2b1497[_0xf3f9('0x16')],_0x1e886b);_0x53f474(_0x3c0a04[_0xf3f9('0x13')](0x1f4,_0x2b1497[_0xf3f9('0x16')]));});});}; \ No newline at end of file +var _0x367e=['options','attributes','include','map','model','find','raw','ShowTrigger','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTrigger','Trigger','findAll'];(function(_0x577519,_0x346daf){var _0x5b12f7=function(_0x4aecb6){while(--_0x4aecb6){_0x577519['push'](_0x577519['shift']());}};_0x5b12f7(++_0x346daf);}(_0x367e,0x104));var _0xe367=function(_0x560059,_0x7d549b){_0x560059=_0x560059-0x0;var _0x113418=_0x367e[_0x560059];return _0x113418;};'use strict';var _=require(_0xe367('0x0'));var util=require(_0xe367('0x1'));var moment=require(_0xe367('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe367('0x3'));var db=require(_0xe367('0x4'))['db'];var utils=require(_0xe367('0x5'));var logger=require(_0xe367('0x6'))(_0xe367('0x7'));var config=require(_0xe367('0x8'));var jayson=require(_0xe367('0x9'));var client=jayson[_0xe367('0xa')][_0xe367('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x20003f,_0x44a9fc,_0x3a092e){return new BPromise(function(_0x481255,_0x1f9c60){return client[_0xe367('0xc')](_0x20003f,_0x3a092e)[_0xe367('0xd')](function(_0x1b4cd0){logger[_0xe367('0xe')](_0xe367('0xf'),_0x44a9fc,_0xe367('0x10'));logger[_0xe367('0x11')](_0xe367('0x12'),_0x44a9fc,_0xe367('0x10'),JSON[_0xe367('0x13')](_0x1b4cd0));if(_0x1b4cd0[_0xe367('0x14')]){if(_0x1b4cd0[_0xe367('0x14')][_0xe367('0x15')]===0x1f4){logger['error'](_0xe367('0xf'),_0x44a9fc,_0x1b4cd0['error'][_0xe367('0x16')]);return _0x1f9c60(_0x1b4cd0[_0xe367('0x14')][_0xe367('0x16')]);}logger[_0xe367('0x14')]('Trigger,\x20%s,\x20%s',_0x44a9fc,_0x1b4cd0['error'][_0xe367('0x16')]);return _0x481255(_0x1b4cd0[_0xe367('0x14')]['message']);}else{logger[_0xe367('0xe')](_0xe367('0xf'),_0x44a9fc,_0xe367('0x10'));_0x481255(_0x1b4cd0[_0xe367('0x17')]['message']);}})[_0xe367('0x18')](function(_0x60d4bc){logger[_0xe367('0x14')]('Trigger,\x20%s,\x20%s',_0x44a9fc,_0x60d4bc);_0x1f9c60(_0x60d4bc);});});}exports[_0xe367('0x19')]=function(_0x5d538e){var _0x2c48cb=this;return new Promise(function(_0x2bc9f7,_0x54a8a3){return db[_0xe367('0x1a')][_0xe367('0x1b')]({'raw':_0x5d538e[_0xe367('0x1c')]?_0x5d538e['options']['raw']===undefined?!![]:![]:!![],'where':_0x5d538e['options']?_0x5d538e['options']['where']||null:null,'attributes':_0x5d538e[_0xe367('0x1c')]?_0x5d538e[_0xe367('0x1c')][_0xe367('0x1d')]||null:null,'limit':_0x5d538e[_0xe367('0x1c')]?_0x5d538e[_0xe367('0x1c')]['limit']||null:null,'include':_0x5d538e[_0xe367('0x1c')]?_0x5d538e[_0xe367('0x1c')][_0xe367('0x1e')]?_[_0xe367('0x1f')](_0x5d538e[_0xe367('0x1c')]['include'],function(_0x1c7136){return{'model':db[_0x1c7136[_0xe367('0x20')]],'as':_0x1c7136['as'],'attributes':_0x1c7136['attributes'],'include':_0x1c7136[_0xe367('0x1e')]?_[_0xe367('0x1f')](_0x1c7136[_0xe367('0x1e')],function(_0x1cc83b){return{'model':db[_0x1cc83b['model']],'as':_0x1cc83b['as'],'attributes':_0x1cc83b[_0xe367('0x1d')],'include':_0x1cc83b[_0xe367('0x1e')]?_[_0xe367('0x1f')](_0x1cc83b[_0xe367('0x1e')],function(_0x4b44e1){return{'model':db[_0x4b44e1[_0xe367('0x20')]],'as':_0x4b44e1['as'],'attributes':_0x4b44e1[_0xe367('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe367('0xd')](function(_0x1d8cad){logger['info'](_0xe367('0x19'),_0x5d538e);logger['debug']('GetTrigger',_0x5d538e,JSON['stringify'](_0x1d8cad));_0x2bc9f7(_0x1d8cad);})['catch'](function(_0x5640a5){logger[_0xe367('0x14')]('GetTrigger',_0x5640a5['message'],_0x5d538e);_0x54a8a3(_0x2c48cb[_0xe367('0x14')](0x1f4,_0x5640a5[_0xe367('0x16')]));});});};exports['ShowTrigger']=function(_0x218668){var _0x5aba0b=this;return new Promise(function(_0x5a46b3,_0x327684){return db[_0xe367('0x1a')][_0xe367('0x21')]({'raw':_0x218668[_0xe367('0x1c')]?_0x218668[_0xe367('0x1c')][_0xe367('0x22')]===undefined?!![]:![]:!![],'where':_0x218668[_0xe367('0x1c')]?_0x218668['options']['where']||null:null,'attributes':_0x218668[_0xe367('0x1c')]?_0x218668[_0xe367('0x1c')][_0xe367('0x1d')]||null:null,'include':_0x218668[_0xe367('0x1c')]?_0x218668[_0xe367('0x1c')][_0xe367('0x1e')]?_[_0xe367('0x1f')](_0x218668[_0xe367('0x1c')][_0xe367('0x1e')],function(_0x363568){return{'model':db[_0x363568[_0xe367('0x20')]],'as':_0x363568['as'],'attributes':_0x363568['attributes'],'include':_0x363568[_0xe367('0x1e')]?_[_0xe367('0x1f')](_0x363568[_0xe367('0x1e')],function(_0x20de1c){return{'model':db[_0x20de1c[_0xe367('0x20')]],'as':_0x20de1c['as'],'attributes':_0x20de1c[_0xe367('0x1d')],'include':_0x20de1c[_0xe367('0x1e')]?_[_0xe367('0x1f')](_0x20de1c['include'],function(_0xc60473){return{'model':db[_0xc60473[_0xe367('0x20')]],'as':_0xc60473['as'],'attributes':_0xc60473[_0xe367('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe367('0xd')](function(_0x2b7922){logger['info'](_0xe367('0x23'),_0x218668);logger[_0xe367('0x11')](_0xe367('0x23'),_0x218668,JSON[_0xe367('0x13')](_0x2b7922));_0x5a46b3(_0x2b7922);})['catch'](function(_0x224503){logger[_0xe367('0x14')]('ShowTrigger',_0x224503[_0xe367('0x16')],_0x218668);_0x327684(_0x5aba0b['error'](0x1f4,_0x224503['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 3703f9d..1a82c30 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 _0xb16d=['delete','destroy','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show','post','/:id/clone','clone','put'];(function(_0x17ad24,_0x5694a6){var _0x41dca6=function(_0x3c97ed){while(--_0x3c97ed){_0x17ad24['push'](_0x17ad24['shift']());}};_0x41dca6(++_0x5694a6);}(_0xb16d,0x8e));var _0xdb16=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb16d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xdb16('0x0'));var path=require(_0xdb16('0x1'));var timeout=require(_0xdb16('0x2'));var express=require(_0xdb16('0x3'));var router=express['Router']();var fs_extra=require(_0xdb16('0x4'));var auth=require(_0xdb16('0x5'));var interaction=require(_0xdb16('0x6'));var config=require(_0xdb16('0x7'));var controller=require(_0xdb16('0x8'));router[_0xdb16('0x9')]('/',auth[_0xdb16('0xa')](),controller[_0xdb16('0xb')]);router['get'](_0xdb16('0xc'),auth[_0xdb16('0xa')](),controller[_0xdb16('0xd')]);router[_0xdb16('0xe')](_0xdb16('0xf'),auth['isAuthenticated'](),controller[_0xdb16('0x10')]);router[_0xdb16('0xe')]('/',auth[_0xdb16('0xa')](),controller['create']);router[_0xdb16('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xdb16('0x12')]('/:id',auth[_0xdb16('0xa')](),controller[_0xdb16('0x13')]);module['exports']=router; \ No newline at end of file +var _0x8a3c=['fs-extra','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show','post','/:id/clone','clone','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0xf04513,_0x3f60ad){var _0x4b9e23=function(_0x1e1917){while(--_0x1e1917){_0xf04513['push'](_0xf04513['shift']());}};_0x4b9e23(++_0x3f60ad);}(_0x8a3c,0x9b));var _0xc8a3=function(_0x360d26,_0x700e92){_0x360d26=_0x360d26-0x0;var _0x180eef=_0x8a3c[_0x360d26];return _0x180eef;};'use strict';var multer=require(_0xc8a3('0x0'));var util=require(_0xc8a3('0x1'));var path=require(_0xc8a3('0x2'));var timeout=require(_0xc8a3('0x3'));var express=require(_0xc8a3('0x4'));var router=express[_0xc8a3('0x5')]();var fs_extra=require(_0xc8a3('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xc8a3('0x7'));var config=require(_0xc8a3('0x8'));var controller=require(_0xc8a3('0x9'));router[_0xc8a3('0xa')]('/',auth[_0xc8a3('0xb')](),controller[_0xc8a3('0xc')]);router[_0xc8a3('0xa')](_0xc8a3('0xd'),auth[_0xc8a3('0xb')](),controller[_0xc8a3('0xe')]);router[_0xc8a3('0xf')](_0xc8a3('0x10'),auth['isAuthenticated'](),controller[_0xc8a3('0x11')]);router[_0xc8a3('0xf')]('/',auth[_0xc8a3('0xb')](),controller[_0xc8a3('0x12')]);router['put'](_0xc8a3('0xd'),auth[_0xc8a3('0xb')](),controller[_0xc8a3('0x13')]);router[_0xc8a3('0x14')](_0xc8a3('0xd'),auth[_0xc8a3('0xb')](),controller[_0xc8a3('0x15')]);module[_0xc8a3('0x16')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 2dee4c7..01bd8c8 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 _0xcf18=['ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','auto','yes','update','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','originate','pai','fingerprint','certificate','active','passive','actpass','dynamic','nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','user','friend'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xcf18,0x12b));var _0x8cf1=function(_0x53e787,_0x4298e6){_0x53e787=_0x53e787-0x0;var _0x2781a0=_0xcf18[_0x53e787];return _0x2781a0;};'use strict';var Sequelize=require(_0x8cf1('0x0'));module[_0x8cf1('0x1')]={'name':{'type':Sequelize[_0x8cf1('0x2')],'allowNull':![],'unique':_0x8cf1('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x8cf1('0x4')]('friend',_0x8cf1('0x5'),'peer'),'allowNull':![],'defaultValue':_0x8cf1('0x6')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x8cf1('0x4')](_0x8cf1('0x7'),_0x8cf1('0x8'),'ALLOWED_FAILED_SCREEN',_0x8cf1('0x9'),_0x8cf1('0xa'),_0x8cf1('0xb'),_0x8cf1('0xc'),_0x8cf1('0xd'))},'deny':{'type':Sequelize[_0x8cf1('0x2')]},'permit':{'type':Sequelize[_0x8cf1('0x2')]},'secret':{'type':Sequelize[_0x8cf1('0x2')]},'md5secret':{'type':Sequelize[_0x8cf1('0x2')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize['STRING'],'defaultValue':_0x8cf1('0xe'),'set':function(_0x3c4e1f){this[_0x8cf1('0xf')](_0x8cf1('0x10'),_0x3c4e1f?_0x3c4e1f[_0x8cf1('0x11')](','):null);},'get':function(){return this[_0x8cf1('0x12')](_0x8cf1('0x10'))?this[_0x8cf1('0x12')](_0x8cf1('0x10'))[_0x8cf1('0x13')](','):null;},'comment':_0x8cf1('0x14')},'dtmfmode':{'type':Sequelize[_0x8cf1('0x4')]('rfc2833',_0x8cf1('0x15'),_0x8cf1('0x16'),'inband',_0x8cf1('0x17')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x8cf1('0x4')](_0x8cf1('0x18'),'no','nonat',_0x8cf1('0x19'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x8cf1('0x4')](_0x8cf1('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x8cf1('0x2')]},'nat':{'type':Sequelize[_0x8cf1('0x2')],'defaultValue':_0x8cf1('0x1a'),'set':function(_0x21d9b2){this[_0x8cf1('0xf')](_0x8cf1('0x1b'),_0x21d9b2?_0x21d9b2['join'](','):null);},'get':function(){return this[_0x8cf1('0x12')](_0x8cf1('0x1b'))?this[_0x8cf1('0x12')]('nat')['split'](','):null;},'comment':_0x8cf1('0x1c')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x8cf1('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x8cf1('0x2')]},'language':{'type':Sequelize[_0x8cf1('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x8cf1('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x8cf1('0x2')],'defaultValue':_0x8cf1('0x1d')},'allow':{'type':Sequelize[_0x8cf1('0x2')],'allowNull':![],'defaultValue':_0x8cf1('0x1e'),'set':function(_0x520d98){this[_0x8cf1('0xf')](_0x8cf1('0x1f'),_0x520d98?_0x520d98[_0x8cf1('0x11')](';'):_0x8cf1('0x1e'));},'get':function(){return this[_0x8cf1('0x12')](_0x8cf1('0x1f'))?this[_0x8cf1('0x12')](_0x8cf1('0x1f'))['split'](';'):null;},'comment':_0x8cf1('0x20')},'autoframing':{'type':Sequelize[_0x8cf1('0x4')](_0x8cf1('0x18'),'no')},'insecure':{'type':Sequelize[_0x8cf1('0x2')],'defaultValue':_0x8cf1('0x21'),'set':function(_0x32e4f4){this['setDataValue'](_0x8cf1('0x22'),_0x32e4f4?_0x32e4f4[_0x8cf1('0x11')](','):null);},'get':function(){return this['getDataValue']('insecure')?this[_0x8cf1('0x12')](_0x8cf1('0x22'))[_0x8cf1('0x13')](','):null;},'comment':_0x8cf1('0x23')},'trustrpid':{'type':Sequelize[_0x8cf1('0x4')](_0x8cf1('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x8cf1('0x4')](_0x8cf1('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x8cf1('0x4')](_0x8cf1('0x18'),'no',_0x8cf1('0x24'))},'promiscredir':{'type':Sequelize[_0x8cf1('0x4')](_0x8cf1('0x18'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0x8cf1('0x18'),'no')},'accountcode':{'type':Sequelize[_0x8cf1('0x25')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x8cf1('0x2')],'defaultValue':_0x8cf1('0x26')},'amaflags':{'type':Sequelize[_0x8cf1('0x2')]},'callcounter':{'type':Sequelize[_0x8cf1('0x4')](_0x8cf1('0x18'),'no'),'defaultValue':_0x8cf1('0x18')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x8cf1('0x4')](_0x8cf1('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0x8cf1('0x4')](_0x8cf1('0x18'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x8cf1('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0x8cf1('0x4')](_0x8cf1('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0x8cf1('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x8cf1('0x4')]('yes','no',_0x8cf1('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x8cf1('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no')},'mailbox':{'type':Sequelize[_0x8cf1('0x2')]},'session_timers':{'type':Sequelize[_0x8cf1('0x4')](_0x8cf1('0x28'),'refuse',_0x8cf1('0x29'))},'session_expires':{'type':Sequelize[_0x8cf1('0x25')](0xb)},'session_minse':{'type':Sequelize[_0x8cf1('0x25')](0xb)},'session_refresher':{'type':Sequelize[_0x8cf1('0x4')]('uac','uas'),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x8cf1('0x2')]},'regexten':{'type':Sequelize[_0x8cf1('0x2')]},'fromdomain':{'type':Sequelize[_0x8cf1('0x2')]},'fromuser':{'type':Sequelize[_0x8cf1('0x2')]},'port':{'type':Sequelize[_0x8cf1('0x25')](0x5)},'qualify':{'type':Sequelize[_0x8cf1('0x4')](_0x8cf1('0x18'),'no'),'defaultValue':_0x8cf1('0x18')},'keepalive':{'type':Sequelize[_0x8cf1('0x25')](0xb)},'defaultip':{'type':Sequelize[_0x8cf1('0x2')]},'defaultuser':{'type':Sequelize[_0x8cf1('0x2')]},'rtptimeout':{'type':Sequelize[_0x8cf1('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x8cf1('0x18'),'no',_0x8cf1('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x8cf1('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x8cf1('0x25')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x8cf1('0x25')](0xb)},'contactpermit':{'type':Sequelize[_0x8cf1('0x2')]},'contactdeny':{'type':Sequelize[_0x8cf1('0x2')]},'contactacl':{'type':Sequelize[_0x8cf1('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x8cf1('0x2')]},'use_q850_reason':{'type':Sequelize[_0x8cf1('0x2')]},'maxforwards':{'type':Sequelize[_0x8cf1('0x25')](0xb)},'encryption':{'type':Sequelize[_0x8cf1('0x4')](_0x8cf1('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x8cf1('0x4')]('yes','no')},'force_avp':{'type':Sequelize[_0x8cf1('0x4')](_0x8cf1('0x18'),'no')},'icesupport':{'type':Sequelize[_0x8cf1('0x4')](_0x8cf1('0x18'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x8cf1('0x18'),'no')},'dtlsverify':{'type':Sequelize[_0x8cf1('0x4')](_0x8cf1('0x18'),'no',_0x8cf1('0x2b'),_0x8cf1('0x2c'))},'dtlsrekey':{'type':Sequelize[_0x8cf1('0x25')](0xb)},'dtlscertfile':{'type':Sequelize[_0x8cf1('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x8cf1('0x2')]},'dtlscipher':{'type':Sequelize[_0x8cf1('0x2')]},'dtlscafile':{'type':Sequelize[_0x8cf1('0x2')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x8cf1('0x4')](_0x8cf1('0x2d'),_0x8cf1('0x2e'),_0x8cf1('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x8cf1('0x2')]},'usereqphone':{'type':Sequelize[_0x8cf1('0x4')](_0x8cf1('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x8cf1('0x2')]},'call_limit':{'type':Sequelize[_0x8cf1('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x8cf1('0x4')](_0x8cf1('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0x8cf1('0x4')](_0x8cf1('0x18'),'no')},'vmexten':{'type':Sequelize[_0x8cf1('0x2')]},'mohinterpret':{'type':Sequelize[_0x8cf1('0x2')]},'mohsuggest':{'type':Sequelize[_0x8cf1('0x2')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x8cf1('0x2')],'defaultValue':_0x8cf1('0x30')},'canreinvite':{'type':Sequelize[_0x8cf1('0x4')]('yes','no',_0x8cf1('0x31'),_0x8cf1('0x19'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x8cf1('0x2')]},'otherFields':{'type':Sequelize[_0x8cf1('0x2')]},'active':{'type':Sequelize[_0x8cf1('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0x7dc4=['STRING','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_FAILED_SCREEN','PROHIB','udp','join','getDataValue','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','rfc2833','yes','nonat','outgoing','force_rport,comedia','nat','split','all','ulaw;alaw;gsm','setDataValue','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','always','accept','refuse','originate','uas','pai','fingerprint','certificate','active','passive','dynamic','update','update,nonat','BOOLEAN','sequelize','name','friend','peer'];(function(_0x22e749,_0x2e8074){var _0x1ab3a7=function(_0x122c8a){while(--_0x122c8a){_0x22e749['push'](_0x22e749['shift']());}};_0x1ab3a7(++_0x2e8074);}(_0x7dc4,0x194));var _0x47dc=function(_0x4c1f4f,_0x2ff1ad){_0x4c1f4f=_0x4c1f4f-0x0;var _0xc1fa4f=_0x7dc4[_0x4c1f4f];return _0xc1fa4f;};'use strict';var Sequelize=require(_0x47dc('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x47dc('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x47dc('0x2'),'user',_0x47dc('0x3')),'allowNull':![],'defaultValue':_0x47dc('0x2')},'context':{'type':Sequelize[_0x47dc('0x4')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x47dc('0x5')](_0x47dc('0x6'),_0x47dc('0x7'),_0x47dc('0x8'),_0x47dc('0x9'),'PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN',_0x47dc('0xa'),_0x47dc('0xb'))},'deny':{'type':Sequelize[_0x47dc('0x4')]},'permit':{'type':Sequelize[_0x47dc('0x4')]},'secret':{'type':Sequelize[_0x47dc('0x4')]},'md5secret':{'type':Sequelize[_0x47dc('0x4')]},'remotesecret':{'type':Sequelize[_0x47dc('0x4')]},'transport':{'type':Sequelize[_0x47dc('0x4')],'defaultValue':_0x47dc('0xc'),'set':function(_0x4193af){this['setDataValue']('transport',_0x4193af?_0x4193af[_0x47dc('0xd')](','):null);},'get':function(){return this[_0x47dc('0xe')](_0x47dc('0xf'))?this[_0x47dc('0xe')](_0x47dc('0xf'))['split'](','):null;},'comment':_0x47dc('0x10')},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0x47dc('0x11'),_0x47dc('0x12'),_0x47dc('0x13'),_0x47dc('0x14')),'defaultValue':_0x47dc('0x15')},'directmedia':{'type':Sequelize['ENUM'](_0x47dc('0x16'),'no',_0x47dc('0x17'),'update',_0x47dc('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x47dc('0x5')](_0x47dc('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x47dc('0x4')]},'directmediadeny':{'type':Sequelize[_0x47dc('0x4')]},'nat':{'type':Sequelize[_0x47dc('0x4')],'defaultValue':_0x47dc('0x19'),'set':function(_0x54bc98){this['setDataValue']('nat',_0x54bc98?_0x54bc98['join'](','):null);},'get':function(){return this[_0x47dc('0xe')](_0x47dc('0x1a'))?this[_0x47dc('0xe')](_0x47dc('0x1a'))[_0x47dc('0x1b')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x47dc('0x4')]},'namedcallgroup':{'type':Sequelize[_0x47dc('0x4')]},'pickupgroup':{'type':Sequelize[_0x47dc('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x47dc('0x4')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0x47dc('0x1c')},'allow':{'type':Sequelize[_0x47dc('0x4')],'allowNull':![],'defaultValue':_0x47dc('0x1d'),'set':function(_0x20c604){this[_0x47dc('0x1e')](_0x47dc('0x1f'),_0x20c604?_0x20c604[_0x47dc('0xd')](';'):_0x47dc('0x1d'));},'get':function(){return this[_0x47dc('0xe')](_0x47dc('0x1f'))?this[_0x47dc('0xe')]('allow')[_0x47dc('0x1b')](';'):null;},'comment':_0x47dc('0x20')},'autoframing':{'type':Sequelize[_0x47dc('0x5')](_0x47dc('0x16'),'no')},'insecure':{'type':Sequelize[_0x47dc('0x4')],'defaultValue':_0x47dc('0x21'),'set':function(_0xbb7731){this[_0x47dc('0x1e')](_0x47dc('0x22'),_0xbb7731?_0xbb7731[_0x47dc('0xd')](','):null);},'get':function(){return this['getDataValue']('insecure')?this[_0x47dc('0xe')](_0x47dc('0x22'))[_0x47dc('0x1b')](','):null;},'comment':_0x47dc('0x23')},'trustrpid':{'type':Sequelize[_0x47dc('0x5')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x47dc('0x5')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x47dc('0x5')](_0x47dc('0x16'),'no','never')},'promiscredir':{'type':Sequelize[_0x47dc('0x5')](_0x47dc('0x16'),'no')},'useclientcode':{'type':Sequelize[_0x47dc('0x5')]('yes','no')},'accountcode':{'type':Sequelize[_0x47dc('0x24')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x47dc('0x4')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x47dc('0x5')](_0x47dc('0x16'),'no'),'defaultValue':_0x47dc('0x16')},'busylevel':{'type':Sequelize[_0x47dc('0x24')](0xb)},'allowoverlap':{'type':Sequelize[_0x47dc('0x5')](_0x47dc('0x16'),'no')},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no')},'allowtransfer':{'type':Sequelize[_0x47dc('0x5')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0x47dc('0x5')](_0x47dc('0x16'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x47dc('0x4')]},'videosupport':{'type':Sequelize['ENUM'](_0x47dc('0x16'),'no',_0x47dc('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x47dc('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no')},'mailbox':{'type':Sequelize[_0x47dc('0x4')]},'session_timers':{'type':Sequelize['ENUM'](_0x47dc('0x26'),_0x47dc('0x27'),_0x47dc('0x28'))},'session_expires':{'type':Sequelize[_0x47dc('0x24')](0xb)},'session_minse':{'type':Sequelize[_0x47dc('0x24')](0xb)},'session_refresher':{'type':Sequelize[_0x47dc('0x5')]('uac',_0x47dc('0x29')),'defaultValue':_0x47dc('0x29')},'t38pt_usertpsource':{'type':Sequelize[_0x47dc('0x4')]},'regexten':{'type':Sequelize[_0x47dc('0x4')]},'fromdomain':{'type':Sequelize[_0x47dc('0x4')]},'fromuser':{'type':Sequelize[_0x47dc('0x4')]},'port':{'type':Sequelize[_0x47dc('0x24')](0x5)},'qualify':{'type':Sequelize[_0x47dc('0x5')](_0x47dc('0x16'),'no'),'defaultValue':_0x47dc('0x16')},'keepalive':{'type':Sequelize[_0x47dc('0x24')](0xb)},'defaultip':{'type':Sequelize[_0x47dc('0x4')]},'defaultuser':{'type':Sequelize[_0x47dc('0x4')]},'rtptimeout':{'type':Sequelize[_0x47dc('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x47dc('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0x47dc('0x5')](_0x47dc('0x16'),'no',_0x47dc('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x47dc('0x4')]},'timert1':{'type':Sequelize[_0x47dc('0x24')](0xb)},'timerb':{'type':Sequelize[_0x47dc('0x24')](0xb)},'qualifyfreq':{'type':Sequelize[_0x47dc('0x24')](0xb)},'contactpermit':{'type':Sequelize[_0x47dc('0x4')]},'contactdeny':{'type':Sequelize[_0x47dc('0x4')]},'contactacl':{'type':Sequelize[_0x47dc('0x4')]},'unsolicited_mailbox':{'type':Sequelize[_0x47dc('0x4')]},'use_q850_reason':{'type':Sequelize[_0x47dc('0x4')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x47dc('0x5')](_0x47dc('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x47dc('0x5')]('yes','no')},'force_avp':{'type':Sequelize[_0x47dc('0x5')](_0x47dc('0x16'),'no')},'icesupport':{'type':Sequelize[_0x47dc('0x5')]('yes','no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x47dc('0x16'),'no')},'dtlsverify':{'type':Sequelize[_0x47dc('0x5')](_0x47dc('0x16'),'no',_0x47dc('0x2b'),_0x47dc('0x2c'))},'dtlsrekey':{'type':Sequelize[_0x47dc('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0x47dc('0x4')]},'dtlsprivatekey':{'type':Sequelize[_0x47dc('0x4')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x47dc('0x4')]},'dtlssetup':{'type':Sequelize[_0x47dc('0x5')](_0x47dc('0x2d'),_0x47dc('0x2e'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x47dc('0x4')]},'usereqphone':{'type':Sequelize[_0x47dc('0x5')](_0x47dc('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x47dc('0x4')]},'call_limit':{'type':Sequelize[_0x47dc('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x47dc('0x16'),'no')},'subscribemwi':{'type':Sequelize[_0x47dc('0x5')](_0x47dc('0x16'),'no')},'vmexten':{'type':Sequelize[_0x47dc('0x4')]},'mohinterpret':{'type':Sequelize[_0x47dc('0x4')]},'mohsuggest':{'type':Sequelize[_0x47dc('0x4')]},'parkinglot':{'type':Sequelize[_0x47dc('0x4')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x47dc('0x4')],'defaultValue':_0x47dc('0x2f')},'canreinvite':{'type':Sequelize['ENUM'](_0x47dc('0x16'),'no',_0x47dc('0x17'),_0x47dc('0x30'),_0x47dc('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x47dc('0x4')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x47dc('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x47dc('0x4')],'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 392d2b6..9724bfa 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 _0x6aa7=['sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','length','includeAll','clone','find','get','createdAt','body','omit','updatedAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','render','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','autoAssociation','update','utf8','server/files/templates/registry.ejs','writeFileSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','http','then','Trunk,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','Trunks','UserProfileResource','stack','name','index','map','Trunk','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','order'];(function(_0x5bd0c9,_0x2d3dc9){var _0xce563d=function(_0x43a079){while(--_0x43a079){_0x5bd0c9['push'](_0x5bd0c9['shift']());}};_0xce563d(++_0x2d3dc9);}(_0x6aa7,0x178));var _0x76aa=function(_0x9e8375,_0x43daab){_0x9e8375=_0x9e8375-0x0;var _0x315660=_0x6aa7[_0x9e8375];return _0x315660;};'use strict';var emlformat=require(_0x76aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x76aa('0x1'));var jsonpatch=require(_0x76aa('0x2'));var rp=require(_0x76aa('0x3'));var moment=require(_0x76aa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x76aa('0x5'));var util=require(_0x76aa('0x6'));var path=require(_0x76aa('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x76aa('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76aa('0x9'));var squel=require(_0x76aa('0xa'));var crypto=require(_0x76aa('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x76aa('0xc'));var toCsv=require(_0x76aa('0xd'));var querystring=require(_0x76aa('0xe'));var Papa=require('papaparse');var Redis=require(_0x76aa('0xf'));var authService=require(_0x76aa('0x10'));var qs=require(_0x76aa('0x11'));var as=require(_0x76aa('0x12'));var hardwareService=require(_0x76aa('0x13'));var logger=require(_0x76aa('0x14'))(_0x76aa('0x15'));var utils=require(_0x76aa('0x16'));var config=require(_0x76aa('0x17'));var licenseUtil=require(_0x76aa('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0x76aa('0x19'));var client=jayson['client'][_0x76aa('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x12dde0,_0x3f8f6b,_0x8e44ed,_0x10432c){return new BPromise(function(_0x4e309f,_0x5f5b59){var _0x2b3b4f=_0x10432c||client;return _0x2b3b4f['request'](_0x12dde0,_0x8e44ed)[_0x76aa('0x1b')](function(_0x319bf1){logger['info'](_0x76aa('0x1c'),_0x3f8f6b,'request\x20sent');logger[_0x76aa('0x1d')]('Trunk,\x20%s,\x20%s,\x20%s',_0x3f8f6b,_0x76aa('0x1e'),JSON[_0x76aa('0x1f')](_0x319bf1));if(_0x319bf1[_0x76aa('0x20')]){if(_0x319bf1[_0x76aa('0x20')][_0x76aa('0x21')]===0x1f4){logger[_0x76aa('0x20')]('Trunk,\x20%s,\x20%s',_0x3f8f6b,_0x319bf1['error'][_0x76aa('0x22')]);return _0x5f5b59(_0x319bf1[_0x76aa('0x20')][_0x76aa('0x22')]);}logger[_0x76aa('0x20')](_0x76aa('0x1c'),_0x3f8f6b,_0x319bf1[_0x76aa('0x20')][_0x76aa('0x22')]);return _0x4e309f(_0x319bf1[_0x76aa('0x20')][_0x76aa('0x22')]);}else{logger['info'](_0x76aa('0x1c'),_0x3f8f6b,_0x76aa('0x1e'));_0x4e309f(_0x319bf1[_0x76aa('0x23')]['message']);}})[_0x76aa('0x24')](function(_0x189cb6){logger[_0x76aa('0x20')](_0x76aa('0x1c'),_0x3f8f6b,_0x189cb6);_0x5f5b59(_0x189cb6);});});}function respondWithStatusCode(_0x29c50c,_0xc1044c){_0xc1044c=_0xc1044c||0xcc;return function(_0x3cd039){if(_0x3cd039){return _0x29c50c[_0x76aa('0x25')](_0xc1044c);}return _0x29c50c[_0x76aa('0x26')](_0xc1044c)[_0x76aa('0x27')]();};}function respondWithResult(_0x37f1ab,_0x26b75e){_0x26b75e=_0x26b75e||0xc8;return function(_0x3599a9){if(_0x3599a9){return _0x37f1ab['status'](_0x26b75e)[_0x76aa('0x28')](_0x3599a9);}};}function respondWithFilteredResult(_0x1d6d15,_0x25c614){return function(_0x2e7ab4){if(_0x2e7ab4){var _0xa1e6=typeof _0x25c614[_0x76aa('0x29')]===_0x76aa('0x2a')&&typeof _0x25c614[_0x76aa('0x2b')]===_0x76aa('0x2a');var _0x1bdc3d=_0x2e7ab4['count'];var _0x3fcb7f=_0xa1e6?0x0:_0x25c614['offset'];var _0x994550=_0xa1e6?_0x2e7ab4[_0x76aa('0x2c')]:_0x25c614[_0x76aa('0x29')]+_0x25c614[_0x76aa('0x2b')];var _0x1eecd9;if(_0x994550>=_0x1bdc3d){_0x994550=_0x1bdc3d;_0x1eecd9=0xc8;}else{_0x1eecd9=0xce;}_0x1d6d15[_0x76aa('0x26')](_0x1eecd9);return _0x1d6d15[_0x76aa('0x2d')](_0x76aa('0x2e'),_0x3fcb7f+'-'+_0x994550+'/'+_0x1bdc3d)[_0x76aa('0x28')](_0x2e7ab4);}return null;};}function patchUpdates(_0x3ea05a){return function(_0x5edcd8){try{jsonpatch[_0x76aa('0x2f')](_0x5edcd8,_0x3ea05a,!![]);}catch(_0x5532c7){return BPromise[_0x76aa('0x30')](_0x5532c7);}return _0x5edcd8[_0x76aa('0x31')]();};}function saveUpdates(_0x458ac3,_0x38ecd1){return function(_0x35a705){if(_0x35a705){return _0x35a705['update'](_0x458ac3)[_0x76aa('0x1b')](function(_0x25a11f){return _0x25a11f;});}return null;};}function removeEntity(_0x5a0f72,_0x2ee338){return function(_0x58d860){if(_0x58d860){return _0x58d860[_0x76aa('0x32')]()['then'](function(){var _0x8479a3=_0x58d860['get']({'plain':!![]});var _0x58f135=_0x76aa('0x33');return db[_0x76aa('0x34')][_0x76aa('0x32')]({'where':{'type':_0x58f135,'resourceId':_0x8479a3['id']}})[_0x76aa('0x1b')](function(){return _0x58d860;});})['then'](function(){_0x5a0f72['status'](0xcc)[_0x76aa('0x27')]();});}};}function handleEntityNotFound(_0x1c7b6f,_0x58127c){return function(_0x23e2fd){if(!_0x23e2fd){_0x1c7b6f[_0x76aa('0x25')](0x194);}return _0x23e2fd;};}function handleError(_0x5b57d8,_0x9ce5f4){_0x9ce5f4=_0x9ce5f4||0x1f4;return function(_0x5c77f1){logger['error'](_0x5c77f1[_0x76aa('0x35')]);if(_0x5c77f1[_0x76aa('0x36')]){delete _0x5c77f1[_0x76aa('0x36')];}_0x5b57d8[_0x76aa('0x26')](_0x9ce5f4)['send'](_0x5c77f1);};}exports[_0x76aa('0x37')]=function(_0x1c22f7,_0x2eea79){var _0x4e131a={},_0x113770={},_0x1638db={'count':0x0,'rows':[]};var _0x2f7726=_[_0x76aa('0x38')](db[_0x76aa('0x39')][_0x76aa('0x3a')],function(_0x878903){return{'name':_0x878903[_0x76aa('0x3b')],'type':_0x878903[_0x76aa('0x3c')]['key']};});_0x113770[_0x76aa('0x3d')]=_[_0x76aa('0x38')](_0x2f7726,_0x76aa('0x36'));_0x113770[_0x76aa('0x3e')]=_[_0x76aa('0x3f')](_0x1c22f7[_0x76aa('0x3e')]);_0x113770['filters']=_['intersection'](_0x113770[_0x76aa('0x3d')],_0x113770[_0x76aa('0x3e')]);_0x4e131a[_0x76aa('0x40')]=_[_0x76aa('0x41')](_0x113770['model'],qs[_0x76aa('0x42')](_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x42')]));_0x4e131a[_0x76aa('0x40')]=_0x4e131a[_0x76aa('0x40')]['length']?_0x4e131a[_0x76aa('0x40')]:_0x113770['model'];if(!_0x1c22f7[_0x76aa('0x3e')]['hasOwnProperty']('nolimit')){_0x4e131a['limit']=qs[_0x76aa('0x2b')](_0x1c22f7['query']['limit']);_0x4e131a['offset']=qs[_0x76aa('0x29')](_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x29')]);}_0x4e131a[_0x76aa('0x43')]=qs[_0x76aa('0x44')](_0x1c22f7['query'][_0x76aa('0x44')]);_0x4e131a[_0x76aa('0x45')]=qs[_0x76aa('0x46')](_[_0x76aa('0x47')](_0x1c22f7[_0x76aa('0x3e')],_0x113770['filters']),_0x2f7726);if(_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x48')]){_0x4e131a['where']=_[_0x76aa('0x49')](_0x4e131a['where'],{'$or':_[_0x76aa('0x38')](_0x2f7726,function(_0x24ea05){if(_0x24ea05[_0x76aa('0x3c')]!==_0x76aa('0x4a')){var _0x2d0bc4={};_0x2d0bc4[_0x24ea05[_0x76aa('0x36')]]={'$like':'%'+_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x48')]+'%'};return _0x2d0bc4;}})});}_0x4e131a=_[_0x76aa('0x49')]({},_0x4e131a,_0x1c22f7[_0x76aa('0x4b')]);var _0x5e4967={'where':_0x4e131a[_0x76aa('0x45')]};return db['Trunk'][_0x76aa('0x2c')](_0x5e4967)[_0x76aa('0x1b')](function(_0x5e95f5){_0x1638db[_0x76aa('0x2c')]=_0x5e95f5;if(_0x1c22f7['query']['includeAll']){_0x4e131a[_0x76aa('0x4c')]=[{'all':!![]}];}return db['Trunk'][_0x76aa('0x4d')](_0x4e131a);})[_0x76aa('0x1b')](function(_0x4315b3){_0x1638db[_0x76aa('0x4e')]=_0x4315b3;return _0x1638db;})[_0x76aa('0x1b')](respondWithFilteredResult(_0x2eea79,_0x4e131a))[_0x76aa('0x24')](handleError(_0x2eea79,null));};exports['show']=function(_0x564546,_0x2fcf8f){var _0x1eafb2={'raw':![],'where':{'id':_0x564546[_0x76aa('0x4f')]['id']}},_0x1708d4={};_0x1708d4[_0x76aa('0x3d')]=_[_0x76aa('0x3f')](db['Trunk'][_0x76aa('0x3a')]);_0x1708d4[_0x76aa('0x3e')]=_[_0x76aa('0x3f')](_0x564546['query']);_0x1708d4[_0x76aa('0x46')]=_['intersection'](_0x1708d4[_0x76aa('0x3d')],_0x1708d4['query']);_0x1eafb2[_0x76aa('0x40')]=_[_0x76aa('0x41')](_0x1708d4[_0x76aa('0x3d')],qs[_0x76aa('0x42')](_0x564546[_0x76aa('0x3e')][_0x76aa('0x42')]));_0x1eafb2[_0x76aa('0x40')]=_0x1eafb2['attributes'][_0x76aa('0x50')]?_0x1eafb2['attributes']:_0x1708d4[_0x76aa('0x3d')];if(_0x564546[_0x76aa('0x3e')][_0x76aa('0x51')]){_0x1eafb2[_0x76aa('0x4c')]=[{'all':!![]}];}_0x1eafb2=_[_0x76aa('0x49')]({},_0x1eafb2,_0x564546[_0x76aa('0x4b')]);return db[_0x76aa('0x39')]['find'](_0x1eafb2)[_0x76aa('0x1b')](handleEntityNotFound(_0x2fcf8f,null))[_0x76aa('0x1b')](respondWithResult(_0x2fcf8f,null))[_0x76aa('0x24')](handleError(_0x2fcf8f,null));};exports[_0x76aa('0x52')]=function(_0x5c742c,_0xb9401b){var _0x163440={'where':{'id':_0x5c742c[_0x76aa('0x4f')]['id']}},_0x8dc601={};_0x8dc601[_0x76aa('0x3d')]=_[_0x76aa('0x3f')](db['Trunk'][_0x76aa('0x3a')]);_0x163440[_0x76aa('0x40')]=_[_0x76aa('0x41')](_0x8dc601[_0x76aa('0x3d')],qs[_0x76aa('0x42')](_0x5c742c[_0x76aa('0x3e')][_0x76aa('0x42')]));_0x163440['attributes']=_0x163440['attributes'][_0x76aa('0x50')]?_0x163440[_0x76aa('0x40')]:_0x8dc601['model'];if(_0x5c742c[_0x76aa('0x3e')][_0x76aa('0x51')]){_0x163440['include']=[{'all':!![]}];}_0x163440=_[_0x76aa('0x49')]({},_0x163440,_0x5c742c[_0x76aa('0x4b')]);return db[_0x76aa('0x39')][_0x76aa('0x53')](_0x163440)[_0x76aa('0x1b')](handleEntityNotFound(_0xb9401b,null))[_0x76aa('0x1b')](function(_0x3376ec){if(_0x3376ec){var _0x30573a=_0x3376ec[_0x76aa('0x54')]({'plain':!![]});_0x30573a=qs['omit'](_0x30573a,['id',_0x76aa('0x55'),'updatedAt']);_0x5c742c[_0x76aa('0x56')]=_[_0x76aa('0x57')](_0x5c742c[_0x76aa('0x56')],['id',_0x76aa('0x55'),_0x76aa('0x58')]);return db[_0x76aa('0x39')][_0x76aa('0x59')](_[_0x76aa('0x49')](_0x30573a,_0x5c742c[_0x76aa('0x56')]),{'include':_0x5c742c['query'][_0x76aa('0x51')]?[{'all':!![]}]:undefined})[_0x76aa('0x1b')](function(_0x5c542b){var _0xe5957d=_0x5c742c[_0x76aa('0x5a')][_0x76aa('0x54')]({'plain':!![]});if(!_0xe5957d)throw new Error(_0x76aa('0x5b'));if(_0xe5957d[_0x76aa('0x5c')]==='user'){var _0x364d05=_0x5c542b['get']({'plain':!![]});var _0x35bd2b=_0x76aa('0x33');return db[_0x76aa('0x5d')][_0x76aa('0x53')]({'where':{'name':_0x35bd2b,'userProfileId':_0xe5957d[_0x76aa('0x5e')]},'raw':!![]})[_0x76aa('0x1b')](function(_0x2bfb46){if(_0x2bfb46&&_0x2bfb46['autoAssociation']===0x0){return db[_0x76aa('0x34')][_0x76aa('0x59')]({'name':_0x364d05['name'],'resourceId':_0x364d05['id'],'type':_0x2bfb46['name'],'sectionId':_0x2bfb46['id']},{})[_0x76aa('0x1b')](function(){return _0x5c542b;});}else{return _0x5c542b;}})[_0x76aa('0x24')](function(_0x5295a7){logger[_0x76aa('0x20')](_0x76aa('0x5f'),_0x5295a7);throw _0x5295a7;});}return _0x5c542b;});}})[_0x76aa('0x1b')](respondWithResult(_0xb9401b,0xc9))['catch'](handleError(_0xb9401b,null));};exports[_0x76aa('0x59')]=function(_0x47f733,_0xf31e1f,_0x1178e5){var _0x2315cf;return db[_0x76aa('0x39')]['create'](_0x47f733['body'],{'raw':!![]})[_0x76aa('0x1b')](function(_0x4dfeb3){_0x2315cf=_0x4dfeb3;return db[_0x76aa('0x39')][_0x76aa('0x4d')]({'raw':!![]});})[_0x76aa('0x1b')](function(_0x43a2af){var _0x2dd320=fs[_0x76aa('0x60')](path[_0x76aa('0x61')](config[_0x76aa('0x62')],_0x76aa('0x63')),'utf8');var _0x7d02e7=fs[_0x76aa('0x60')](path[_0x76aa('0x61')](config[_0x76aa('0x62')],'server/files/templates/registry.ejs'),'utf8');var _0x557c11=ejs[_0x76aa('0x64')](_0x2dd320,{'trunks':_0x43a2af||[]});fs['writeFileSync'](_0x76aa('0x65'),_0x557c11);if(_0x2315cf[_0x76aa('0x66')]){var _0x38faff=ejs[_0x76aa('0x64')](_0x7d02e7,{'trunks':_0x43a2af||[]});fs['writeFileSync'](_0x76aa('0x67'),_0x38faff);}})['then'](function(){return respondWithRpcPromise(_0x76aa('0x68'),_0x76aa('0x59'),{'module':_0x76aa('0x69')});})[_0x76aa('0x1b')](function(){var _0x1037fb=_0x47f733['user'][_0x76aa('0x54')]({'plain':!![]});if(!_0x1037fb)throw new Error(_0x76aa('0x5b'));if(_0x1037fb[_0x76aa('0x5c')]===_0x76aa('0x5a')){var _0x32c1de=_0x2315cf[_0x76aa('0x54')]({'plain':!![]});return db[_0x76aa('0x5d')][_0x76aa('0x53')]({'where':{'name':'Trunks','userProfileId':_0x1037fb[_0x76aa('0x5e')]},'raw':!![]})[_0x76aa('0x1b')](function(_0x48136a){if(_0x48136a&&_0x48136a[_0x76aa('0x6a')]===0x0){return db[_0x76aa('0x34')][_0x76aa('0x59')]({'name':_0x32c1de[_0x76aa('0x36')],'resourceId':_0x32c1de['id'],'type':_0x48136a[_0x76aa('0x36')],'sectionId':_0x48136a['id']},{})[_0x76aa('0x1b')](function(){return _0x2315cf;});}else{return _0x2315cf;}})[_0x76aa('0x24')](function(_0x5dc923){logger[_0x76aa('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5dc923);throw _0x5dc923;});}return _0x2315cf;})['then'](respondWithResult(_0xf31e1f,0xc9))[_0x76aa('0x24')](handleError(_0xf31e1f,null));};exports[_0x76aa('0x6b')]=function(_0x5d8947,_0x5d1de1,_0x36da4d){var _0x14b5a2;return db[_0x76aa('0x39')]['find']({'where':{'id':_0x5d8947['params']['id']}})[_0x76aa('0x1b')](handleEntityNotFound(_0x5d1de1,null))[_0x76aa('0x1b')](saveUpdates(_0x5d8947[_0x76aa('0x56')],null))['then'](function(_0xb70589){if(_0xb70589){_0x14b5a2=_0xb70589;return db['Trunk'][_0x76aa('0x4d')]({'raw':!![]});}})[_0x76aa('0x1b')](function(_0x383290){if(_0x383290){var _0x325ffa=fs[_0x76aa('0x60')](path['join'](config['root'],_0x76aa('0x63')),_0x76aa('0x6c'));var _0x19ebb7=fs['readFileSync'](path[_0x76aa('0x61')](config[_0x76aa('0x62')],_0x76aa('0x6d')),_0x76aa('0x6c'));var _0x303b78=ejs['render'](_0x325ffa,{'trunks':_0x383290||[]});fs[_0x76aa('0x6e')]('/etc/asterisk/sip_xcally_trunks.conf',_0x303b78);var _0x213f7f=ejs[_0x76aa('0x64')](_0x19ebb7,{'trunks':_0x383290||[]});fs[_0x76aa('0x6e')](_0x76aa('0x67'),_0x213f7f);return respondWithRpcPromise(_0x76aa('0x68'),_0x76aa('0x6b'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x547411){if(_0x547411){return _0x14b5a2;}})['then'](respondWithResult(_0x5d1de1,null))['catch'](handleError(_0x5d1de1,null));};exports[_0x76aa('0x32')]=function(_0x22f44f,_0x52c5be,_0x5c2c91){var _0x4f01e9;return db[_0x76aa('0x39')][_0x76aa('0x53')]({'where':{'id':_0x22f44f[_0x76aa('0x4f')]['id']}})['then'](handleEntityNotFound(_0x52c5be,null))['then'](removeEntity(_0x52c5be,null))[_0x76aa('0x1b')](function(){return db[_0x76aa('0x39')][_0x76aa('0x4d')]({'raw':!![]});})[_0x76aa('0x1b')](function(_0x354c7b){var _0x55e526=fs['readFileSync'](path[_0x76aa('0x61')](config['root'],'server/files/templates/trunk.ejs'),'utf8');var _0x4673e6=fs[_0x76aa('0x60')](path['join'](config[_0x76aa('0x62')],_0x76aa('0x6d')),'utf8');var _0x22063f=ejs[_0x76aa('0x64')](_0x55e526,{'trunks':_0x354c7b});var _0x11d91f=ejs[_0x76aa('0x64')](_0x4673e6,{'trunks':_0x354c7b});fs[_0x76aa('0x6e')](_0x76aa('0x65'),_0x22063f);fs[_0x76aa('0x6e')](_0x76aa('0x67'),_0x11d91f);return respondWithRpcPromise(_0x76aa('0x68'),'destroy',{'module':_0x76aa('0x69')});})[_0x76aa('0x24')](handleError(_0x52c5be,null));}; \ No newline at end of file +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(_0x18f4e2,_0x1c6508){var _0xbb59c2=function(_0x20b3a4){while(--_0x20b3a4){_0x18f4e2['push'](_0x18f4e2['shift']());}};_0xbb59c2(++_0x1c6508);}(_0x98a8,0x12c));var _0x898a=function(_0x4f4fd4,_0x151d2c){_0x4f4fd4=_0x4f4fd4-0x0;var _0xb3b635=_0x98a8[_0x4f4fd4];return _0xb3b635;};'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 diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index c444f04..d758561 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 _0x9111=['./trunk.attributes','define','Trunk','tools_trunks','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4fa166,_0x58b7fb){var _0x5dd974=function(_0x342886){while(--_0x342886){_0x4fa166['push'](_0x4fa166['shift']());}};_0x5dd974(++_0x58b7fb);}(_0x9111,0x1cb));var _0x1911=function(_0x55ba3e,_0x255a93){_0x55ba3e=_0x55ba3e-0x0;var _0x358c69=_0x9111[_0x55ba3e];return _0x358c69;};'use strict';var _=require(_0x1911('0x0'));var util=require(_0x1911('0x1'));var logger=require(_0x1911('0x2'))(_0x1911('0x3'));var moment=require(_0x1911('0x4'));var BPromise=require(_0x1911('0x5'));var rp=require(_0x1911('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1911('0x7'));var config=require(_0x1911('0x8'));var attributes=require(_0x1911('0x9'));module['exports']=function(_0x45fce3,_0x1135e1){return _0x45fce3[_0x1911('0xa')](_0x1911('0xb'),attributes,{'tableName':_0x1911('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3bc7=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks','util'];(function(_0x1fd9e7,_0x24cdbe){var _0x1781f2=function(_0x2bd0a3){while(--_0x2bd0a3){_0x1fd9e7['push'](_0x1fd9e7['shift']());}};_0x1781f2(++_0x24cdbe);}(_0x3bc7,0x12b));var _0x73bc=function(_0x2e9de3,_0x578e22){_0x2e9de3=_0x2e9de3-0x0;var _0x29d7ce=_0x3bc7[_0x2e9de3];return _0x29d7ce;};'use strict';var _=require('lodash');var util=require(_0x73bc('0x0'));var logger=require(_0x73bc('0x1'))(_0x73bc('0x2'));var moment=require(_0x73bc('0x3'));var BPromise=require(_0x73bc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x73bc('0x5'));var config=require(_0x73bc('0x6'));var attributes=require(_0x73bc('0x7'));module[_0x73bc('0x8')]=function(_0x2f9adc,_0x3e0304){return _0x2f9adc[_0x73bc('0x9')](_0x73bc('0xa'),attributes,{'tableName':_0x73bc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index fbcb8b0..32fd57f 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 _0x40f0=['attributes','model','GetTrunk','debug','ShowTrunk','find','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','findAll','options','raw','where','limit','map','include'];(function(_0x2fb87c,_0x2dee49){var _0x43038b=function(_0x7e5396){while(--_0x7e5396){_0x2fb87c['push'](_0x2fb87c['shift']());}};_0x43038b(++_0x2dee49);}(_0x40f0,0x15a));var _0x040f=function(_0x4a9c91,_0xa777b6){_0x4a9c91=_0x4a9c91-0x0;var _0x2b5394=_0x40f0[_0x4a9c91];return _0x2b5394;};'use strict';var _=require(_0x040f('0x0'));var util=require(_0x040f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x040f('0x2'));var fs=require('fs');var Redis=require(_0x040f('0x3'));var db=require(_0x040f('0x4'))['db'];var utils=require(_0x040f('0x5'));var logger=require(_0x040f('0x6'))(_0x040f('0x7'));var config=require('../../config/environment');var jayson=require(_0x040f('0x8'));var client=jayson[_0x040f('0x9')][_0x040f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d7d43,_0x285ce9,_0x23f057){return new BPromise(function(_0xfb4594,_0x11ef7f){return client[_0x040f('0xb')](_0x3d7d43,_0x23f057)[_0x040f('0xc')](function(_0x3694f9){logger[_0x040f('0xd')](_0x040f('0xe'),_0x285ce9,_0x040f('0xf'));logger['debug']('Trunk,\x20%s,\x20%s,\x20%s',_0x285ce9,_0x040f('0xf'),JSON[_0x040f('0x10')](_0x3694f9));if(_0x3694f9[_0x040f('0x11')]){if(_0x3694f9['error'][_0x040f('0x12')]===0x1f4){logger[_0x040f('0x11')](_0x040f('0xe'),_0x285ce9,_0x3694f9[_0x040f('0x11')][_0x040f('0x13')]);return _0x11ef7f(_0x3694f9[_0x040f('0x11')][_0x040f('0x13')]);}logger[_0x040f('0x11')](_0x040f('0xe'),_0x285ce9,_0x3694f9['error']['message']);return _0xfb4594(_0x3694f9[_0x040f('0x11')][_0x040f('0x13')]);}else{logger['info'](_0x040f('0xe'),_0x285ce9,_0x040f('0xf'));_0xfb4594(_0x3694f9['result'][_0x040f('0x13')]);}})[_0x040f('0x14')](function(_0x46e81f){logger[_0x040f('0x11')](_0x040f('0xe'),_0x285ce9,_0x46e81f);_0x11ef7f(_0x46e81f);});});}exports['GetTrunk']=function(_0x5628c8){var _0x1e0290=this;return new Promise(function(_0x511a46,_0x4f4bc2){return db['Trunk'][_0x040f('0x15')]({'raw':_0x5628c8[_0x040f('0x16')]?_0x5628c8['options'][_0x040f('0x17')]===undefined?!![]:![]:!![],'where':_0x5628c8['options']?_0x5628c8[_0x040f('0x16')][_0x040f('0x18')]||null:null,'attributes':_0x5628c8[_0x040f('0x16')]?_0x5628c8[_0x040f('0x16')]['attributes']||null:null,'limit':_0x5628c8[_0x040f('0x16')]?_0x5628c8['options'][_0x040f('0x19')]||null:null,'include':_0x5628c8[_0x040f('0x16')]?_0x5628c8[_0x040f('0x16')]['include']?_[_0x040f('0x1a')](_0x5628c8[_0x040f('0x16')][_0x040f('0x1b')],function(_0x3611b4){return{'model':db[_0x3611b4['model']],'as':_0x3611b4['as'],'attributes':_0x3611b4[_0x040f('0x1c')],'include':_0x3611b4['include']?_[_0x040f('0x1a')](_0x3611b4[_0x040f('0x1b')],function(_0x4908b4){return{'model':db[_0x4908b4['model']],'as':_0x4908b4['as'],'attributes':_0x4908b4[_0x040f('0x1c')],'include':_0x4908b4[_0x040f('0x1b')]?_[_0x040f('0x1a')](_0x4908b4[_0x040f('0x1b')],function(_0x2a862f){return{'model':db[_0x2a862f[_0x040f('0x1d')]],'as':_0x2a862f['as'],'attributes':_0x2a862f[_0x040f('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ded71){logger[_0x040f('0xd')](_0x040f('0x1e'),_0x5628c8);logger[_0x040f('0x1f')]('GetTrunk',_0x5628c8,JSON['stringify'](_0x3ded71));_0x511a46(_0x3ded71);})['catch'](function(_0x463999){logger[_0x040f('0x11')](_0x040f('0x1e'),_0x463999[_0x040f('0x13')],_0x5628c8);_0x4f4bc2(_0x1e0290[_0x040f('0x11')](0x1f4,_0x463999[_0x040f('0x13')]));});});};exports[_0x040f('0x20')]=function(_0x165ce6){var _0x2ea7b3=this;return new Promise(function(_0x5aee92,_0x407d70){return db['Trunk'][_0x040f('0x21')]({'raw':_0x165ce6['options']?_0x165ce6['options'][_0x040f('0x17')]===undefined?!![]:![]:!![],'where':_0x165ce6['options']?_0x165ce6[_0x040f('0x16')][_0x040f('0x18')]||null:null,'attributes':_0x165ce6[_0x040f('0x16')]?_0x165ce6['options'][_0x040f('0x1c')]||null:null,'include':_0x165ce6[_0x040f('0x16')]?_0x165ce6[_0x040f('0x16')][_0x040f('0x1b')]?_[_0x040f('0x1a')](_0x165ce6['options'][_0x040f('0x1b')],function(_0xae33a3){return{'model':db[_0xae33a3[_0x040f('0x1d')]],'as':_0xae33a3['as'],'attributes':_0xae33a3[_0x040f('0x1c')],'include':_0xae33a3[_0x040f('0x1b')]?_[_0x040f('0x1a')](_0xae33a3[_0x040f('0x1b')],function(_0x1eb2c7){return{'model':db[_0x1eb2c7['model']],'as':_0x1eb2c7['as'],'attributes':_0x1eb2c7[_0x040f('0x1c')],'include':_0x1eb2c7[_0x040f('0x1b')]?_[_0x040f('0x1a')](_0x1eb2c7[_0x040f('0x1b')],function(_0x427c80){return{'model':db[_0x427c80['model']],'as':_0x427c80['as'],'attributes':_0x427c80[_0x040f('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x59d702){logger[_0x040f('0xd')](_0x040f('0x20'),_0x165ce6);logger['debug'](_0x040f('0x20'),_0x165ce6,JSON['stringify'](_0x59d702));_0x5aee92(_0x59d702);})[_0x040f('0x14')](function(_0x4dd726){logger[_0x040f('0x11')](_0x040f('0x20'),_0x4dd726[_0x040f('0x13')],_0x165ce6);_0x407d70(_0x2ea7b3[_0x040f('0x11')](0x1f4,_0x4dd726[_0x040f('0x13')]));});});}; \ No newline at end of file +var _0x1ebd=['client','http','request','then','info','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Trunk,\x20%s,\x20%s','message','result','Trunk','findAll','options','where','attributes','limit','map','include','model','GetTrunk','ShowTrunk','find','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x1f2a82,_0x4765e8){var _0x5abc41=function(_0xa0cb6b){while(--_0xa0cb6b){_0x1f2a82['push'](_0x1f2a82['shift']());}};_0x5abc41(++_0x4765e8);}(_0x1ebd,0xf9));var _0xd1eb=function(_0x5c0234,_0x31c0d6){_0x5c0234=_0x5c0234-0x0;var _0x54e2ad=_0x1ebd[_0x5c0234];return _0x54e2ad;};'use strict';var _=require(_0xd1eb('0x0'));var util=require('util');var moment=require(_0xd1eb('0x1'));var BPromise=require(_0xd1eb('0x2'));var rs=require(_0xd1eb('0x3'));var fs=require('fs');var Redis=require(_0xd1eb('0x4'));var db=require(_0xd1eb('0x5'))['db'];var utils=require(_0xd1eb('0x6'));var logger=require('../../config/logger')(_0xd1eb('0x7'));var config=require(_0xd1eb('0x8'));var jayson=require(_0xd1eb('0x9'));var client=jayson[_0xd1eb('0xa')][_0xd1eb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb34b7e,_0x4def22,_0x4695cb){return new BPromise(function(_0x17b8a0,_0x291e40){return client[_0xd1eb('0xc')](_0xb34b7e,_0x4695cb)[_0xd1eb('0xd')](function(_0x38bc4b){logger[_0xd1eb('0xe')]('Trunk,\x20%s,\x20%s',_0x4def22,'request\x20sent');logger[_0xd1eb('0xf')](_0xd1eb('0x10'),_0x4def22,_0xd1eb('0x11'),JSON[_0xd1eb('0x12')](_0x38bc4b));if(_0x38bc4b['error']){if(_0x38bc4b[_0xd1eb('0x13')][_0xd1eb('0x14')]===0x1f4){logger['error'](_0xd1eb('0x15'),_0x4def22,_0x38bc4b[_0xd1eb('0x13')][_0xd1eb('0x16')]);return _0x291e40(_0x38bc4b['error']['message']);}logger[_0xd1eb('0x13')](_0xd1eb('0x15'),_0x4def22,_0x38bc4b['error'][_0xd1eb('0x16')]);return _0x17b8a0(_0x38bc4b['error'][_0xd1eb('0x16')]);}else{logger['info'](_0xd1eb('0x15'),_0x4def22,_0xd1eb('0x11'));_0x17b8a0(_0x38bc4b[_0xd1eb('0x17')]['message']);}})['catch'](function(_0x21cefb){logger['error']('Trunk,\x20%s,\x20%s',_0x4def22,_0x21cefb);_0x291e40(_0x21cefb);});});}exports['GetTrunk']=function(_0x23e3e0){var _0x487960=this;return new Promise(function(_0x4c54cb,_0x5a8876){return db[_0xd1eb('0x18')][_0xd1eb('0x19')]({'raw':_0x23e3e0['options']?_0x23e3e0[_0xd1eb('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x23e3e0['options']?_0x23e3e0['options'][_0xd1eb('0x1b')]||null:null,'attributes':_0x23e3e0[_0xd1eb('0x1a')]?_0x23e3e0[_0xd1eb('0x1a')][_0xd1eb('0x1c')]||null:null,'limit':_0x23e3e0[_0xd1eb('0x1a')]?_0x23e3e0[_0xd1eb('0x1a')][_0xd1eb('0x1d')]||null:null,'include':_0x23e3e0[_0xd1eb('0x1a')]?_0x23e3e0[_0xd1eb('0x1a')]['include']?_[_0xd1eb('0x1e')](_0x23e3e0[_0xd1eb('0x1a')]['include'],function(_0x4d4091){return{'model':db[_0x4d4091['model']],'as':_0x4d4091['as'],'attributes':_0x4d4091[_0xd1eb('0x1c')],'include':_0x4d4091[_0xd1eb('0x1f')]?_['map'](_0x4d4091[_0xd1eb('0x1f')],function(_0x388c52){return{'model':db[_0x388c52[_0xd1eb('0x20')]],'as':_0x388c52['as'],'attributes':_0x388c52[_0xd1eb('0x1c')],'include':_0x388c52[_0xd1eb('0x1f')]?_['map'](_0x388c52[_0xd1eb('0x1f')],function(_0x21e779){return{'model':db[_0x21e779['model']],'as':_0x21e779['as'],'attributes':_0x21e779[_0xd1eb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd1eb('0xd')](function(_0x5393d7){logger[_0xd1eb('0xe')](_0xd1eb('0x21'),_0x23e3e0);logger['debug'](_0xd1eb('0x21'),_0x23e3e0,JSON[_0xd1eb('0x12')](_0x5393d7));_0x4c54cb(_0x5393d7);})['catch'](function(_0x51f0e7){logger[_0xd1eb('0x13')](_0xd1eb('0x21'),_0x51f0e7[_0xd1eb('0x16')],_0x23e3e0);_0x5a8876(_0x487960[_0xd1eb('0x13')](0x1f4,_0x51f0e7[_0xd1eb('0x16')]));});});};exports[_0xd1eb('0x22')]=function(_0xe088a7){var _0x542c99=this;return new Promise(function(_0x5e0b02,_0x4664aa){return db[_0xd1eb('0x18')][_0xd1eb('0x23')]({'raw':_0xe088a7['options']?_0xe088a7[_0xd1eb('0x1a')][_0xd1eb('0x24')]===undefined?!![]:![]:!![],'where':_0xe088a7['options']?_0xe088a7[_0xd1eb('0x1a')][_0xd1eb('0x1b')]||null:null,'attributes':_0xe088a7[_0xd1eb('0x1a')]?_0xe088a7['options'][_0xd1eb('0x1c')]||null:null,'include':_0xe088a7[_0xd1eb('0x1a')]?_0xe088a7[_0xd1eb('0x1a')][_0xd1eb('0x1f')]?_[_0xd1eb('0x1e')](_0xe088a7['options'][_0xd1eb('0x1f')],function(_0x24d3b4){return{'model':db[_0x24d3b4[_0xd1eb('0x20')]],'as':_0x24d3b4['as'],'attributes':_0x24d3b4[_0xd1eb('0x1c')],'include':_0x24d3b4[_0xd1eb('0x1f')]?_[_0xd1eb('0x1e')](_0x24d3b4['include'],function(_0xc4619f){return{'model':db[_0xc4619f[_0xd1eb('0x20')]],'as':_0xc4619f['as'],'attributes':_0xc4619f[_0xd1eb('0x1c')],'include':_0xc4619f['include']?_[_0xd1eb('0x1e')](_0xc4619f[_0xd1eb('0x1f')],function(_0x53608e){return{'model':db[_0x53608e[_0xd1eb('0x20')]],'as':_0x53608e['as'],'attributes':_0x53608e[_0xd1eb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd1eb('0xd')](function(_0x2a2e1e){logger[_0xd1eb('0xe')]('ShowTrunk',_0xe088a7);logger[_0xd1eb('0xf')](_0xd1eb('0x22'),_0xe088a7,JSON[_0xd1eb('0x12')](_0x2a2e1e));_0x5e0b02(_0x2a2e1e);})['catch'](function(_0x4d172a){logger['error'](_0xd1eb('0x22'),_0x4d172a[_0xd1eb('0x16')],_0xe088a7);_0x4664aa(_0x542c99[_0xd1eb('0x13')](0x1f4,_0x4d172a['message']));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 340cc3c..ee83612 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 _0xb3c6=['/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/teams','addTeams','/:id/chat_interactions','addChatInteractions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','addMailAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','createApiKey','update','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','/:id/mail_interactions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','/:id/whatsapp_accounts','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','/whoami','/presence','getPresence','/:id','show','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/api_key','getApiKey','post','addContacts','create','/create_many','addQueues','diskStorage','root','format','%s-%s','now','originalname','/:id/avatar','file','addAvatar'];(function(_0x3b73be,_0x2db174){var _0x388e65=function(_0x3f5659){while(--_0x3f5659){_0x3b73be['push'](_0x3b73be['shift']());}};_0x388e65(++_0x2db174);}(_0xb3c6,0x1a6));var _0x6b3c=function(_0x996bc8,_0x291e01){_0x996bc8=_0x996bc8-0x0;var _0x20b0ea=_0xb3c6[_0x996bc8];return _0x20b0ea;};'use strict';var multer=require(_0x6b3c('0x0'));var util=require(_0x6b3c('0x1'));var path=require(_0x6b3c('0x2'));var timeout=require('connect-timeout');var express=require(_0x6b3c('0x3'));var router=express[_0x6b3c('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6b3c('0x5'));var config=require(_0x6b3c('0x6'));var controller=require(_0x6b3c('0x7'));router[_0x6b3c('0x8')]('/',auth[_0x6b3c('0x9')](),controller[_0x6b3c('0xa')]);router[_0x6b3c('0x8')](_0x6b3c('0xb'),auth[_0x6b3c('0x9')](),controller[_0x6b3c('0xc')]);router[_0x6b3c('0x8')](_0x6b3c('0xd'),auth['isAuthenticated'](),controller['whoami']);router['get'](_0x6b3c('0xe'),auth['isAuthenticated'](),controller[_0x6b3c('0xf')]);router[_0x6b3c('0x8')](_0x6b3c('0x10'),auth[_0x6b3c('0x9')](),controller[_0x6b3c('0x11')]);router[_0x6b3c('0x8')]('/:id/avatar',controller['getAvatar']);router[_0x6b3c('0x8')](_0x6b3c('0x12'),auth[_0x6b3c('0x9')](),controller[_0x6b3c('0x13')]);router[_0x6b3c('0x8')](_0x6b3c('0x14'),auth[_0x6b3c('0x9')](),controller[_0x6b3c('0x15')]);router[_0x6b3c('0x8')](_0x6b3c('0x16'),auth[_0x6b3c('0x9')](),controller['getQueues']);router[_0x6b3c('0x8')](_0x6b3c('0x17'),auth['isAuthenticated'](),controller[_0x6b3c('0x18')]);router['get'](_0x6b3c('0x19'),auth[_0x6b3c('0x9')](),controller[_0x6b3c('0x1a')]);router[_0x6b3c('0x8')](_0x6b3c('0x1b'),auth['isAuthenticated'](),controller[_0x6b3c('0x1c')]);router[_0x6b3c('0x8')](_0x6b3c('0x1d'),auth[_0x6b3c('0x9')](),controller[_0x6b3c('0x1e')]);router[_0x6b3c('0x8')](_0x6b3c('0x1f'),auth[_0x6b3c('0x9')](),controller[_0x6b3c('0x20')]);router[_0x6b3c('0x8')](_0x6b3c('0x21'),auth[_0x6b3c('0x9')](),controller[_0x6b3c('0x22')]);router[_0x6b3c('0x8')](_0x6b3c('0x23'),auth[_0x6b3c('0x9')](),controller[_0x6b3c('0x24')]);router[_0x6b3c('0x8')]('/:id/sms/interactions',auth[_0x6b3c('0x9')](),controller[_0x6b3c('0x25')]);router[_0x6b3c('0x8')]('/:id/fax/interactions',auth[_0x6b3c('0x9')](),controller[_0x6b3c('0x26')]);router[_0x6b3c('0x8')](_0x6b3c('0x27'),auth[_0x6b3c('0x9')](),controller[_0x6b3c('0x28')]);router[_0x6b3c('0x8')]('/:id/teams',auth[_0x6b3c('0x9')](),controller[_0x6b3c('0x29')]);router[_0x6b3c('0x8')](_0x6b3c('0x2a'),auth[_0x6b3c('0x9')](),controller[_0x6b3c('0x2b')]);router[_0x6b3c('0x8')](_0x6b3c('0x2c'),auth[_0x6b3c('0x9')](),controller[_0x6b3c('0x2d')]);router[_0x6b3c('0x8')](_0x6b3c('0x2e'),auth[_0x6b3c('0x9')](),controller[_0x6b3c('0x2f')]);router['get']('/:id/fax_accounts',auth[_0x6b3c('0x9')](),controller['getFaxAccounts']);router['get'](_0x6b3c('0x30'),auth[_0x6b3c('0x9')](),controller['getMailAccounts']);router[_0x6b3c('0x8')](_0x6b3c('0x31'),auth[_0x6b3c('0x9')](),controller[_0x6b3c('0x32')]);router['get'](_0x6b3c('0x33'),auth['isAuthenticated'](),controller[_0x6b3c('0x34')]);router[_0x6b3c('0x8')](_0x6b3c('0x35'),auth[_0x6b3c('0x9')](),controller[_0x6b3c('0x36')]);router[_0x6b3c('0x8')]('/:id/whatsapp_accounts',auth[_0x6b3c('0x9')](),controller[_0x6b3c('0x37')]);router[_0x6b3c('0x8')](_0x6b3c('0x38'),auth['isAuthenticated'](),controller[_0x6b3c('0x39')]);router[_0x6b3c('0x8')]('/:id/scheduled_calls',auth[_0x6b3c('0x9')](),controller['getScheduledCalls']);router[_0x6b3c('0x8')](_0x6b3c('0x3a'),auth['isAuthenticated'](),controller[_0x6b3c('0x3b')]);router[_0x6b3c('0x3c')]('/:id/contacts',auth[_0x6b3c('0x9')](),controller[_0x6b3c('0x3d')]);router[_0x6b3c('0x3c')]('/',auth['isAuthenticated'](),controller[_0x6b3c('0x3e')]);router[_0x6b3c('0x3c')](_0x6b3c('0x3f'),auth[_0x6b3c('0x9')](),controller['bulkCreate']);router[_0x6b3c('0x3c')](_0x6b3c('0x16'),auth[_0x6b3c('0x9')](),controller[_0x6b3c('0x40')]);var upload=multer({'storage':multer[_0x6b3c('0x41')]({'destination':function(_0x2b3410,_0x338234,_0x2c3c97){_0x2c3c97(null,path['join'](config[_0x6b3c('0x42')],'server/files/images/'));},'filename':function(_0x4702e6,_0x376009,_0xebd978){_0xebd978(null,util[_0x6b3c('0x43')](_0x6b3c('0x44'),Date[_0x6b3c('0x45')](),_0x376009[_0x6b3c('0x46')]));}})});router[_0x6b3c('0x3c')](_0x6b3c('0x47'),upload['single'](_0x6b3c('0x48')),controller[_0x6b3c('0x49')]);router[_0x6b3c('0x3c')](_0x6b3c('0x4a'),auth['isAuthenticated'](),controller[_0x6b3c('0x4b')]);router[_0x6b3c('0x3c')](_0x6b3c('0x4c'),auth[_0x6b3c('0x9')](),controller[_0x6b3c('0x4d')]);router['post'](_0x6b3c('0x4e'),auth[_0x6b3c('0x9')](),controller[_0x6b3c('0x4f')]);router[_0x6b3c('0x3c')]('/:id/unpause',auth['isAuthenticated'](),controller['unpause']);router[_0x6b3c('0x3c')](_0x6b3c('0x50'),auth[_0x6b3c('0x9')](),controller[_0x6b3c('0x51')]);router[_0x6b3c('0x3c')](_0x6b3c('0x52'),auth[_0x6b3c('0x9')](),controller[_0x6b3c('0x53')]);router[_0x6b3c('0x3c')]('/:id/mail_interactions',auth[_0x6b3c('0x9')](),controller[_0x6b3c('0x54')]);router[_0x6b3c('0x3c')](_0x6b3c('0x55'),auth[_0x6b3c('0x9')](),controller[_0x6b3c('0x56')]);router['post'](_0x6b3c('0x57'),auth[_0x6b3c('0x9')](),controller[_0x6b3c('0x58')]);router[_0x6b3c('0x3c')]('/:id/openchannel_interactions',auth[_0x6b3c('0x9')](),controller[_0x6b3c('0x59')]);router[_0x6b3c('0x3c')]('/:id/whatsapp_interactions',auth[_0x6b3c('0x9')](),controller[_0x6b3c('0x5a')]);router[_0x6b3c('0x3c')](_0x6b3c('0x5b'),auth[_0x6b3c('0x9')](),controller[_0x6b3c('0x5c')]);router[_0x6b3c('0x3c')](_0x6b3c('0x30'),auth[_0x6b3c('0x9')](),controller[_0x6b3c('0x5d')]);router[_0x6b3c('0x3c')](_0x6b3c('0x31'),auth[_0x6b3c('0x9')](),controller['addOpenchannelAccounts']);router[_0x6b3c('0x3c')](_0x6b3c('0x33'),auth[_0x6b3c('0x9')](),controller[_0x6b3c('0x5e')]);router[_0x6b3c('0x3c')](_0x6b3c('0x35'),auth['isAuthenticated'](),controller[_0x6b3c('0x5f')]);router[_0x6b3c('0x3c')]('/:id/whatsapp_accounts',auth[_0x6b3c('0x9')](),controller[_0x6b3c('0x60')]);router[_0x6b3c('0x3c')](_0x6b3c('0x38'),auth[_0x6b3c('0x9')](),controller['addSquareProjects']);router[_0x6b3c('0x3c')](_0x6b3c('0x3a'),auth['isAuthenticated'](),controller[_0x6b3c('0x61')]);router['put'](_0x6b3c('0x10'),auth[_0x6b3c('0x9')](),controller[_0x6b3c('0x62')]);router['put'](_0x6b3c('0x63'),auth[_0x6b3c('0x9')](),controller[_0x6b3c('0x64')]);router[_0x6b3c('0x65')](_0x6b3c('0x16'),auth[_0x6b3c('0x9')](),controller[_0x6b3c('0x66')]);router[_0x6b3c('0x65')](_0x6b3c('0x50'),auth[_0x6b3c('0x9')](),controller[_0x6b3c('0x67')]);router[_0x6b3c('0x65')](_0x6b3c('0x10'),auth[_0x6b3c('0x9')](),controller[_0x6b3c('0x68')]);router[_0x6b3c('0x65')]('/:id/chat_interactions',auth[_0x6b3c('0x9')](),controller[_0x6b3c('0x69')]);router[_0x6b3c('0x65')](_0x6b3c('0x6a'),auth['isAuthenticated'](),controller[_0x6b3c('0x6b')]);router['delete'](_0x6b3c('0x55'),auth['isAuthenticated'](),controller[_0x6b3c('0x6c')]);router['delete'](_0x6b3c('0x57'),auth[_0x6b3c('0x9')](),controller[_0x6b3c('0x6d')]);router[_0x6b3c('0x65')](_0x6b3c('0x6e'),auth[_0x6b3c('0x9')](),controller[_0x6b3c('0x6f')]);router[_0x6b3c('0x65')](_0x6b3c('0x70'),auth['isAuthenticated'](),controller[_0x6b3c('0x71')]);router['delete'](_0x6b3c('0x5b'),auth[_0x6b3c('0x9')](),controller[_0x6b3c('0x72')]);router[_0x6b3c('0x65')](_0x6b3c('0x30'),auth[_0x6b3c('0x9')](),controller[_0x6b3c('0x73')]);router[_0x6b3c('0x65')](_0x6b3c('0x31'),auth['isAuthenticated'](),controller[_0x6b3c('0x74')]);router[_0x6b3c('0x65')](_0x6b3c('0x33'),auth[_0x6b3c('0x9')](),controller[_0x6b3c('0x75')]);router[_0x6b3c('0x65')](_0x6b3c('0x35'),auth['isAuthenticated'](),controller[_0x6b3c('0x76')]);router[_0x6b3c('0x65')](_0x6b3c('0x77'),auth[_0x6b3c('0x9')](),controller[_0x6b3c('0x78')]);router[_0x6b3c('0x65')](_0x6b3c('0x38'),auth['isAuthenticated'](),controller[_0x6b3c('0x79')]);router['delete'](_0x6b3c('0x3a'),auth[_0x6b3c('0x9')](),controller[_0x6b3c('0x7a')]);module[_0x6b3c('0x7b')]=router; \ No newline at end of file +var _0x9743=['../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','/whoami','whoami','getPresence','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/square_projects','/:id/scheduled_calls','getScheduledCalls','getApiKey','post','addContacts','create','/create_many','bulkCreate','addQueues','join','root','server/files/images/','format','%s-%s','now','originalname','single','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addOpenchannelAccounts','addSmsAccounts','/:id/whatsapp_accounts','addWhatsappAccounts','addSquareProjects','createApiKey','put','/:id','/:id/password','changePassword','delete','destroy','removeChatInteractions','/:id/mail_interactions','removeMailInteractions','removeFaxInteractions','/:id/sms_interactions','removeSmsInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeWhatsappAccounts','removeSquareProjects','removeApiKey','util','path','connect-timeout','Router','fs-extra'];(function(_0x9a2f5,_0x6095ba){var _0x1b9757=function(_0x39caa1){while(--_0x39caa1){_0x9a2f5['push'](_0x9a2f5['shift']());}};_0x1b9757(++_0x6095ba);}(_0x9743,0xe9));var _0x3974=function(_0x6674e4,_0x1f1a41){_0x6674e4=_0x6674e4-0x0;var _0x2cfd78=_0x9743[_0x6674e4];return _0x2cfd78;};'use strict';var multer=require('multer');var util=require(_0x3974('0x0'));var path=require(_0x3974('0x1'));var timeout=require(_0x3974('0x2'));var express=require('express');var router=express[_0x3974('0x3')]();var fs_extra=require(_0x3974('0x4'));var auth=require(_0x3974('0x5'));var interaction=require(_0x3974('0x6'));var config=require(_0x3974('0x7'));var controller=require(_0x3974('0x8'));router[_0x3974('0x9')]('/',auth[_0x3974('0xa')](),controller[_0x3974('0xb')]);router['get'](_0x3974('0xc'),auth[_0x3974('0xa')](),controller[_0x3974('0xd')]);router[_0x3974('0x9')](_0x3974('0xe'),auth[_0x3974('0xa')](),controller[_0x3974('0xf')]);router[_0x3974('0x9')]('/presence',auth[_0x3974('0xa')](),controller[_0x3974('0x10')]);router[_0x3974('0x9')]('/:id',auth[_0x3974('0xa')](),controller[_0x3974('0x11')]);router[_0x3974('0x9')](_0x3974('0x12'),controller[_0x3974('0x13')]);router['get'](_0x3974('0x14'),auth[_0x3974('0xa')](),controller[_0x3974('0x15')]);router[_0x3974('0x9')](_0x3974('0x16'),auth['isAuthenticated'](),controller[_0x3974('0x17')]);router[_0x3974('0x9')](_0x3974('0x18'),auth['isAuthenticated'](),controller['getQueues']);router[_0x3974('0x9')]('/:id/queues_rt',auth[_0x3974('0xa')](),controller[_0x3974('0x19')]);router[_0x3974('0x9')](_0x3974('0x1a'),auth[_0x3974('0xa')](),controller[_0x3974('0x1b')]);router[_0x3974('0x9')](_0x3974('0x1c'),auth['isAuthenticated'](),controller[_0x3974('0x1d')]);router['get']('/:id/screen_recordings',auth['isAuthenticated'](),controller[_0x3974('0x1e')]);router[_0x3974('0x9')](_0x3974('0x1f'),auth[_0x3974('0xa')](),controller[_0x3974('0x20')]);router[_0x3974('0x9')](_0x3974('0x21'),auth['isAuthenticated'](),controller[_0x3974('0x22')]);router[_0x3974('0x9')](_0x3974('0x23'),auth[_0x3974('0xa')](),controller[_0x3974('0x24')]);router[_0x3974('0x9')](_0x3974('0x25'),auth[_0x3974('0xa')](),controller[_0x3974('0x26')]);router[_0x3974('0x9')](_0x3974('0x27'),auth[_0x3974('0xa')](),controller[_0x3974('0x28')]);router[_0x3974('0x9')]('/:id/whatsapp/interactions',auth[_0x3974('0xa')](),controller[_0x3974('0x29')]);router[_0x3974('0x9')](_0x3974('0x2a'),auth['isAuthenticated'](),controller[_0x3974('0x2b')]);router['get'](_0x3974('0x2c'),auth['isAuthenticated'](),controller['getLists']);router[_0x3974('0x9')](_0x3974('0x2d'),auth[_0x3974('0xa')](),controller[_0x3974('0x2e')]);router[_0x3974('0x9')](_0x3974('0x2f'),auth['isAuthenticated'](),controller[_0x3974('0x30')]);router[_0x3974('0x9')](_0x3974('0x31'),auth['isAuthenticated'](),controller['getFaxAccounts']);router['get'](_0x3974('0x32'),auth[_0x3974('0xa')](),controller[_0x3974('0x33')]);router[_0x3974('0x9')](_0x3974('0x34'),auth[_0x3974('0xa')](),controller['getOpenchannelAccounts']);router[_0x3974('0x9')](_0x3974('0x35'),auth['isAuthenticated'](),controller[_0x3974('0x36')]);router['get'](_0x3974('0x37'),auth[_0x3974('0xa')](),controller[_0x3974('0x38')]);router['get']('/:id/whatsapp_accounts',auth[_0x3974('0xa')](),controller['getWhatsappAccounts']);router[_0x3974('0x9')](_0x3974('0x39'),auth['isAuthenticated'](),controller['getSquareProjects']);router['get'](_0x3974('0x3a'),auth['isAuthenticated'](),controller[_0x3974('0x3b')]);router[_0x3974('0x9')]('/:id/api_key',auth[_0x3974('0xa')](),controller[_0x3974('0x3c')]);router[_0x3974('0x3d')](_0x3974('0x16'),auth[_0x3974('0xa')](),controller[_0x3974('0x3e')]);router[_0x3974('0x3d')]('/',auth[_0x3974('0xa')](),controller[_0x3974('0x3f')]);router[_0x3974('0x3d')](_0x3974('0x40'),auth['isAuthenticated'](),controller[_0x3974('0x41')]);router[_0x3974('0x3d')](_0x3974('0x18'),auth['isAuthenticated'](),controller[_0x3974('0x42')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x16b718,_0x1b4520,_0x177c98){_0x177c98(null,path[_0x3974('0x43')](config[_0x3974('0x44')],_0x3974('0x45')));},'filename':function(_0x5e4f68,_0x49b387,_0x2cd747){_0x2cd747(null,util[_0x3974('0x46')](_0x3974('0x47'),Date[_0x3974('0x48')](),_0x49b387[_0x3974('0x49')]));}})});router[_0x3974('0x3d')](_0x3974('0x12'),upload[_0x3974('0x4a')]('file'),controller[_0x3974('0x4b')]);router[_0x3974('0x3d')](_0x3974('0x4c'),auth[_0x3974('0xa')](),controller[_0x3974('0x4d')]);router[_0x3974('0x3d')](_0x3974('0x4e'),auth[_0x3974('0xa')](),controller[_0x3974('0x4f')]);router[_0x3974('0x3d')](_0x3974('0x50'),auth[_0x3974('0xa')](),controller[_0x3974('0x51')]);router['post']('/:id/unpause',auth[_0x3974('0xa')](),controller[_0x3974('0x52')]);router[_0x3974('0x3d')](_0x3974('0x2a'),auth['isAuthenticated'](),controller[_0x3974('0x53')]);router['post'](_0x3974('0x54'),auth[_0x3974('0xa')](),controller[_0x3974('0x55')]);router[_0x3974('0x3d')]('/:id/mail_interactions',auth[_0x3974('0xa')](),controller['addMailInteractions']);router[_0x3974('0x3d')](_0x3974('0x56'),auth[_0x3974('0xa')](),controller[_0x3974('0x57')]);router[_0x3974('0x3d')]('/:id/sms_interactions',auth[_0x3974('0xa')](),controller[_0x3974('0x58')]);router[_0x3974('0x3d')](_0x3974('0x59'),auth['isAuthenticated'](),controller[_0x3974('0x5a')]);router[_0x3974('0x3d')](_0x3974('0x5b'),auth[_0x3974('0xa')](),controller[_0x3974('0x5c')]);router[_0x3974('0x3d')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0x3974('0x5d')]);router[_0x3974('0x3d')](_0x3974('0x32'),auth['isAuthenticated'](),controller['addMailAccounts']);router[_0x3974('0x3d')](_0x3974('0x34'),auth[_0x3974('0xa')](),controller[_0x3974('0x5e')]);router['post'](_0x3974('0x35'),auth[_0x3974('0xa')](),controller[_0x3974('0x5f')]);router[_0x3974('0x3d')](_0x3974('0x37'),auth[_0x3974('0xa')](),controller['addChatWebsites']);router[_0x3974('0x3d')](_0x3974('0x60'),auth[_0x3974('0xa')](),controller[_0x3974('0x61')]);router[_0x3974('0x3d')](_0x3974('0x39'),auth['isAuthenticated'](),controller[_0x3974('0x62')]);router['post']('/:id/api_key',auth['isAuthenticated'](),controller[_0x3974('0x63')]);router[_0x3974('0x64')](_0x3974('0x65'),auth[_0x3974('0xa')](),controller['update']);router[_0x3974('0x64')](_0x3974('0x66'),auth['isAuthenticated'](),controller[_0x3974('0x67')]);router['delete'](_0x3974('0x18'),auth[_0x3974('0xa')](),controller['removeQueues']);router['delete'](_0x3974('0x2a'),auth[_0x3974('0xa')](),controller['removeTeams']);router[_0x3974('0x68')]('/:id',auth[_0x3974('0xa')](),controller[_0x3974('0x69')]);router['delete']('/:id/chat_interactions',auth[_0x3974('0xa')](),controller[_0x3974('0x6a')]);router[_0x3974('0x68')](_0x3974('0x6b'),auth['isAuthenticated'](),controller[_0x3974('0x6c')]);router[_0x3974('0x68')](_0x3974('0x56'),auth[_0x3974('0xa')](),controller[_0x3974('0x6d')]);router[_0x3974('0x68')](_0x3974('0x6e'),auth[_0x3974('0xa')](),controller[_0x3974('0x6f')]);router[_0x3974('0x68')](_0x3974('0x59'),auth[_0x3974('0xa')](),controller[_0x3974('0x70')]);router['delete'](_0x3974('0x5b'),auth[_0x3974('0xa')](),controller['removeWhatsappInteractions']);router[_0x3974('0x68')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0x3974('0x71')]);router['delete'](_0x3974('0x32'),auth[_0x3974('0xa')](),controller['removeMailAccounts']);router['delete']('/:id/openchannel_accounts',auth[_0x3974('0xa')](),controller[_0x3974('0x72')]);router['delete'](_0x3974('0x35'),auth['isAuthenticated'](),controller[_0x3974('0x73')]);router[_0x3974('0x68')](_0x3974('0x37'),auth[_0x3974('0xa')](),controller['removeChatWebsites']);router[_0x3974('0x68')]('/:id/whatsapp_accounts',auth[_0x3974('0xa')](),controller[_0x3974('0x74')]);router[_0x3974('0x68')](_0x3974('0x39'),auth[_0x3974('0xa')](),controller[_0x3974('0x75')]);router[_0x3974('0x68')]('/:id/api_key',auth['isAuthenticated'](),controller[_0x3974('0x76')]);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 e5cb811..602f447 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 _0xa6b0=['setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','INTEGER','accountcode','getDataValue','BOOLEAN','DATE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_FAILED_SCREEN','PROHIB','udp','join','transport','split','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','certificate','passive','TEXT','showWebBar','get','isArray','wss','encryption','avpf','force_avp','icesupport','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','dtlsenable','actpass','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','map','permissions','string','true','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','exports','STRING','name'];(function(_0xd674fb,_0x3684e5){var _0x1449ba=function(_0x113bbb){while(--_0x113bbb){_0xd674fb['push'](_0xd674fb['shift']());}};_0x1449ba(++_0x3684e5);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x2fc41c,_0x37a491){_0x2fc41c=_0x2fc41c-0x0;var _0x78eded=_0xa6b0[_0x2fc41c];return _0x78eded;};'use strict';var Sequelize=require(_0x0a6b('0x0'));var moment=require(_0x0a6b('0x1'));var util=require('util');var _=require('lodash');module[_0x0a6b('0x2')]={'name':{'type':Sequelize[_0x0a6b('0x3')],'allowNull':![],'unique':_0x0a6b('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x4c9a84){this[_0x0a6b('0x5')](_0x0a6b('0x4'),_0x4c9a84);this[_0x0a6b('0x5')](_0x0a6b('0x6'),_0x4c9a84);},'comment':_0x0a6b('0x7')},'fullname':{'type':Sequelize[_0x0a6b('0x3')],'allowNull':![],'set':function(_0x1b5fb5){this[_0x0a6b('0x5')](_0x0a6b('0x8'),_0x1b5fb5);this[_0x0a6b('0x5')](_0x0a6b('0x9'),util[_0x0a6b('0xa')]('\x22%s\x22\x20<%s>',_0x1b5fb5,this['getDataValue'](_0x0a6b('0xb'))));}},'alias':{'type':Sequelize[_0x0a6b('0x3')]},'email':{'type':Sequelize[_0x0a6b('0x3')],'allowNull':![],'unique':_0x0a6b('0xc'),'validate':{'isEmail':!![]},'set':function(_0x81a412){if(_0x81a412){this[_0x0a6b('0x5')](_0x0a6b('0xc'),_0x81a412[_0x0a6b('0xd')]());}}},'role':{'type':Sequelize[_0x0a6b('0xe')](_0x0a6b('0xf'),_0x0a6b('0x10'),_0x0a6b('0x11'),_0x0a6b('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0x0a6b('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize[_0x0a6b('0x13')](0xb),'allowNull':![],'unique':_0x0a6b('0xb'),'set':function(_0x2abc4e){this[_0x0a6b('0x5')](_0x0a6b('0xb'),_0x2abc4e);this[_0x0a6b('0x5')](_0x0a6b('0x14'),_0x2abc4e);this[_0x0a6b('0x5')](_0x0a6b('0x9'),util[_0x0a6b('0xa')]('\x22%s\x22\x20<%s>',this[_0x0a6b('0x15')](_0x0a6b('0x8')),_0x2abc4e));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x0a6b('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x0a6b('0x3')]},'zipcode':{'type':Sequelize[_0x0a6b('0x3')]},'userpic':{'type':Sequelize[_0x0a6b('0x3')]},'city':{'type':Sequelize[_0x0a6b('0x3')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0x0a6b('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x0a6b('0x17')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x0a6b('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x0a6b('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x0a6b('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x0a6b('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x0a6b('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x0a6b('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x0a6b('0x17')]},'chatCapacity':{'type':Sequelize[_0x0a6b('0x13')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x0a6b('0x13')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x0a6b('0x13')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x0a6b('0x13')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x0a6b('0x13')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x0a6b('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x0a6b('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x0a6b('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x0a6b('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x0a6b('0x13')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x0a6b('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x0a6b('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x0a6b('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0x0a6b('0x3')],'allowNull':!![],'defaultValue':_0x0a6b('0x18')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x0a6b('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x0a6b('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x0a6b('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x0a6b('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0x0a6b('0x19'),_0x0a6b('0x10'),_0x0a6b('0x1a')),'allowNull':!![],'defaultValue':_0x0a6b('0x19')},'context':{'type':Sequelize[_0x0a6b('0x3')],'allowNull':!![],'defaultValue':_0x0a6b('0x1b')},'callingpres':{'type':Sequelize['ENUM'](_0x0a6b('0x1c'),_0x0a6b('0x1d'),'ALLOWED_FAILED_SCREEN',_0x0a6b('0x1e'),'PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN',_0x0a6b('0x1f'),_0x0a6b('0x20')),'allowNull':!![]},'deny':{'type':Sequelize[_0x0a6b('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x0a6b('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x0a6b('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x0a6b('0x3')],'allowNull':!![],'defaultValue':_0x0a6b('0x21'),'set':function(_0x235cc3){this[_0x0a6b('0x5')]('transport',_0x235cc3?_0x235cc3[_0x0a6b('0x22')](','):null);},'get':function(){return this[_0x0a6b('0x15')]('transport')?this['getDataValue'](_0x0a6b('0x23'))[_0x0a6b('0x24')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x0a6b('0xe')](_0x0a6b('0x25'),_0x0a6b('0x26'),_0x0a6b('0x27'),_0x0a6b('0x28'),_0x0a6b('0x29')),'allowNull':!![],'defaultValue':_0x0a6b('0x25')},'directmedia':{'type':Sequelize[_0x0a6b('0xe')](_0x0a6b('0x2a'),'no',_0x0a6b('0x2b'),_0x0a6b('0x2c'),_0x0a6b('0x2d')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x0a6b('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x0a6b('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0x0a6b('0x3')],'allowNull':!![],'defaultValue':_0x0a6b('0x2e'),'set':function(_0x206612){this[_0x0a6b('0x5')](_0x0a6b('0x2f'),_0x206612?_0x206612[_0x0a6b('0x22')](','):null);},'get':function(){return this[_0x0a6b('0x15')](_0x0a6b('0x2f'))?this[_0x0a6b('0x15')]('nat')[_0x0a6b('0x24')](','):null;},'comment':_0x0a6b('0x30')},'callgroup':{'type':Sequelize[_0x0a6b('0x3')]},'namedcallgroup':{'type':Sequelize[_0x0a6b('0x3')]},'pickupgroup':{'type':Sequelize[_0x0a6b('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x0a6b('0x3')]},'language':{'type':Sequelize[_0x0a6b('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x0a6b('0x3')]},'disallow':{'type':Sequelize[_0x0a6b('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x0a6b('0x3')],'allowNull':![],'defaultValue':_0x0a6b('0x31'),'set':function(_0x3aa7d5){this[_0x0a6b('0x5')](_0x0a6b('0x32'),_0x3aa7d5?_0x3aa7d5[_0x0a6b('0x22')](';'):_0x0a6b('0x31'));},'get':function(){return this[_0x0a6b('0x15')](_0x0a6b('0x32'))?this['getDataValue'](_0x0a6b('0x32'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x0a6b('0xe')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x2f1221){this[_0x0a6b('0x5')](_0x0a6b('0x33'),_0x2f1221?_0x2f1221['join'](','):null);},'get':function(){return this[_0x0a6b('0x15')]('insecure')?this['getDataValue'](_0x0a6b('0x33'))['split'](','):null;},'comment':_0x0a6b('0x34')},'trustrpid':{'type':Sequelize['ENUM'](_0x0a6b('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0a6b('0xe')](_0x0a6b('0x2a'),'no',_0x0a6b('0x35')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x0a6b('0xe')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x0a6b('0xe')](_0x0a6b('0x2a'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x0a6b('0x13')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x0a6b('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x0a6b('0x3')],'allowNull':!![],'defaultValue':_0x0a6b('0x36')},'amaflags':{'type':Sequelize[_0x0a6b('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x0a6b('0x2a'),'no'),'allowNull':!![],'defaultValue':_0x0a6b('0x2a')},'busylevel':{'type':Sequelize[_0x0a6b('0x13')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x0a6b('0xe')](_0x0a6b('0x2a'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x0a6b('0xe')](_0x0a6b('0x2a'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x0a6b('0xe')](_0x0a6b('0x2a'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x0a6b('0x2a'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x0a6b('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x0a6b('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x0a6b('0xe')](_0x0a6b('0x2a'),'no',_0x0a6b('0x37')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x0a6b('0x13')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x0a6b('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x0a6b('0xe')](_0x0a6b('0x38'),_0x0a6b('0x39'),_0x0a6b('0x3a')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x0a6b('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x0a6b('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x0a6b('0xe')](_0x0a6b('0x3b'),'uas'),'allowNull':!![],'defaultValue':_0x0a6b('0x3c')},'t38pt_usertpsource':{'type':Sequelize[_0x0a6b('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x0a6b('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x0a6b('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x0a6b('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x0a6b('0x2a'),'no'),'allowNull':!![],'defaultValue':_0x0a6b('0x2a')},'keepalive':{'type':Sequelize[_0x0a6b('0x13')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x0a6b('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x0a6b('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x0a6b('0x13')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x0a6b('0x13')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x0a6b('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x0a6b('0xe')](_0x0a6b('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x0a6b('0x13')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x0a6b('0x13')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x0a6b('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x0a6b('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x0a6b('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x0a6b('0x13')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x0a6b('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x0a6b('0xe')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x0a6b('0xe')](_0x0a6b('0x2a'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x0a6b('0x2a'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x0a6b('0x2a'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x0a6b('0xe')](_0x0a6b('0x2a'),'no','fingerprint',_0x0a6b('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x0a6b('0x13')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x0a6b('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x0a6b('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x0a6b('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x0a6b('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM']('active',_0x0a6b('0x3e'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0a6b('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x0a6b('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x0a6b('0x13')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x0a6b('0xe')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x0a6b('0xe')](_0x0a6b('0x2a'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x0a6b('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x0a6b('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x0a6b('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM']('yes','no',_0x0a6b('0x2b'),_0x0a6b('0x2c'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x0a6b('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x0a6b('0x17')]},'passwordResetAt':{'type':Sequelize[_0x0a6b('0x17')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x0a6b('0x3f')]},'showWebBar':{'type':Sequelize[_0x0a6b('0x13')],'defaultValue':0x0,'set':function(_0x450a32){this['setDataValue'](_0x0a6b('0x40'),_0x450a32);var _0x34bebd=this[_0x0a6b('0x41')]({'plain':!![]});switch(_0x450a32){case 0x0:case 0x1:var _0x38974c=_0x34bebd['transport']?_[_0x0a6b('0x42')](_0x34bebd[_0x0a6b('0x23')])?_0x34bebd[_0x0a6b('0x23')][_0x0a6b('0x22')]():_0x34bebd[_0x0a6b('0x23')]:'udp';if(_0x38974c===_0x0a6b('0x43')){_0x38974c=_0x0a6b('0x21');}this[_0x0a6b('0x5')](_0x0a6b('0x23'),_0x38974c);this[_0x0a6b('0x5')](_0x0a6b('0x44'),'no');this[_0x0a6b('0x5')](_0x0a6b('0x45'),null);this['setDataValue'](_0x0a6b('0x46'),null);this[_0x0a6b('0x5')](_0x0a6b('0x47'),null);this[_0x0a6b('0x5')]('dtlsenable',null);this[_0x0a6b('0x5')](_0x0a6b('0x48'),null);this[_0x0a6b('0x5')](_0x0a6b('0x49'),null);this[_0x0a6b('0x5')](_0x0a6b('0x4a'),null);this[_0x0a6b('0x5')](_0x0a6b('0x4b'),null);this[_0x0a6b('0x5')](_0x0a6b('0x4c'),'no');break;case 0x2:this[_0x0a6b('0x5')](_0x0a6b('0x23'),_0x0a6b('0x43'));this[_0x0a6b('0x5')](_0x0a6b('0x44'),'yes');this['setDataValue'](_0x0a6b('0x45'),_0x0a6b('0x2a'));this['setDataValue'](_0x0a6b('0x46'),_0x0a6b('0x2a'));this[_0x0a6b('0x5')](_0x0a6b('0x47'),_0x0a6b('0x2a'));this[_0x0a6b('0x5')](_0x0a6b('0x4d'),_0x0a6b('0x2a'));this[_0x0a6b('0x5')](_0x0a6b('0x48'),'no');this[_0x0a6b('0x5')]('dtlssetup',_0x0a6b('0x4e'));this['setDataValue'](_0x0a6b('0x4a'),_0x34bebd[_0x0a6b('0x4a')]||_0x0a6b('0x4f'));this[_0x0a6b('0x5')](_0x0a6b('0x4b'),_0x34bebd[_0x0a6b('0x4b')]||_0x0a6b('0x50'));this['setDataValue'](_0x0a6b('0x4c'),_0x0a6b('0x2a'));break;default:}}},'permissions':{'type':Sequelize[_0x0a6b('0x3f')],'set':function(_0x356d70){this[_0x0a6b('0x5')]('permissions',_0x356d70?_0x356d70[_0x0a6b('0x22')](','):[]);},'get':function(){return this['getDataValue']('permissions')?_[_0x0a6b('0x51')](this[_0x0a6b('0x15')](_0x0a6b('0x52'))[_0x0a6b('0x24')](','),function(_0xec326b){return parseInt(_0xec326b,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x0a6b('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x0a6b('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x0a6b('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x0a6b('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x0a6b('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x0a6b('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x0a6b('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x0a6b('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x0a6b('0x13')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x0a6b('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x0a6b('0x13')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x0a6b('0x2a'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x0a6b('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0x0a6b('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a6b('0x15')]('phoneBarEnableScreenRecordingByAgent')?this[_0x0a6b('0x15')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x0a6b('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x0a6b('0x16')],'defaultValue':![]},'interface':{'type':Sequelize[_0x0a6b('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x0a6b('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x0a6b('0x16')],'defaultValue':![],'set':function(_0x239be5){if(typeof _0x239be5===_0x0a6b('0x53')){var _0x571800=_0x239be5==='1'?!![]:_0x239be5==='0'?![]:_0x239be5===_0x0a6b('0x54')?!![]:_0x239be5==='false'?![]:![];this[_0x0a6b('0x5')](_0x0a6b('0x55'),_0x571800);}else{this[_0x0a6b('0x5')](_0x0a6b('0x55'),_0x239be5);}}},'blocked':{'type':Sequelize[_0x0a6b('0x16')],'defaultValue':![],'set':function(_0x1374c3){this[_0x0a6b('0x5')](_0x0a6b('0x56'),_0x1374c3);if(_0x1374c3===!![]){this['setDataValue'](_0x0a6b('0x57'),moment());this['setDataValue'](_0x0a6b('0x58'),0x0);}else{this[_0x0a6b('0x5')](_0x0a6b('0x57'),null);}}},'blockedAt':{'type':Sequelize[_0x0a6b('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x0a6b('0x16')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x0a6b('0x16')],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)[_0x0a6b('0x59')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x0a6b('0x16')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x0a6b('0x16')],'defaultValue':!![]}}; \ No newline at end of file +var _0xc1fc=['ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','yes','outgoing','force_rport,comedia','nat','join','all','ulaw;alaw;gsm','allow','insecure','never','\x22\x22\x20<>','accept','refuse','uac','uas','fingerprint','certificate','active','actpass','update','update,nonat','TEXT','showWebBar','get','udp','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','moment','util','exports','STRING','name','setDataValue','defaultuser','fullname','callerid','internal','email','toLowerCase','ENUM','user','agent','telephone','local','INTEGER','accountcode','format','\x22%s\x22\x20<%s>','getDataValue','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend'];(function(_0x4fd6ed,_0x3e6a76){var _0x2375e1=function(_0x54e44e){while(--_0x54e44e){_0x4fd6ed['push'](_0x4fd6ed['shift']());}};_0x2375e1(++_0x3e6a76);}(_0xc1fc,0x93));var _0xcc1f=function(_0xc978af,_0x372595){_0xc978af=_0xc978af-0x0;var _0x2c8bee=_0xc1fc[_0xc978af];return _0x2c8bee;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xcc1f('0x0'));var util=require(_0xcc1f('0x1'));var _=require('lodash');module[_0xcc1f('0x2')]={'name':{'type':Sequelize[_0xcc1f('0x3')],'allowNull':![],'unique':_0xcc1f('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x3f57ea){this[_0xcc1f('0x5')](_0xcc1f('0x4'),_0x3f57ea);this[_0xcc1f('0x5')](_0xcc1f('0x6'),_0x3f57ea);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x376348){this[_0xcc1f('0x5')](_0xcc1f('0x7'),_0x376348);this[_0xcc1f('0x5')](_0xcc1f('0x8'),util['format']('\x22%s\x22\x20<%s>',_0x376348,this['getDataValue'](_0xcc1f('0x9'))));}},'alias':{'type':Sequelize[_0xcc1f('0x3')]},'email':{'type':Sequelize[_0xcc1f('0x3')],'allowNull':![],'unique':_0xcc1f('0xa'),'validate':{'isEmail':!![]},'set':function(_0x3a2625){if(_0x3a2625){this[_0xcc1f('0x5')](_0xcc1f('0xa'),_0x3a2625[_0xcc1f('0xb')]());}}},'role':{'type':Sequelize[_0xcc1f('0xc')]('admin',_0xcc1f('0xd'),_0xcc1f('0xe'),_0xcc1f('0xf')),'allowNull':![]},'password':{'type':Sequelize[_0xcc1f('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xcc1f('0x3')],'defaultValue':_0xcc1f('0x10')},'internal':{'type':Sequelize[_0xcc1f('0x11')](0xb),'allowNull':![],'unique':'internal','set':function(_0xf0ba72){this[_0xcc1f('0x5')](_0xcc1f('0x9'),_0xf0ba72);this[_0xcc1f('0x5')](_0xcc1f('0x12'),_0xf0ba72);this[_0xcc1f('0x5')](_0xcc1f('0x8'),util[_0xcc1f('0x13')](_0xcc1f('0x14'),this[_0xcc1f('0x15')]('fullname'),_0xf0ba72));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xcc1f('0x3')]},'mobile':{'type':Sequelize[_0xcc1f('0x3')]},'address':{'type':Sequelize[_0xcc1f('0x3')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0xcc1f('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0xcc1f('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xcc1f('0x17')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xcc1f('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xcc1f('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xcc1f('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xcc1f('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xcc1f('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xcc1f('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0xcc1f('0x18')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0xcc1f('0x11')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xcc1f('0x11')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xcc1f('0x11')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xcc1f('0x11')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xcc1f('0x11')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xcc1f('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xcc1f('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xcc1f('0x11')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xcc1f('0x11')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xcc1f('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xcc1f('0x11')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xcc1f('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xcc1f('0x16')],'defaultValue':![]},'description':{'type':Sequelize[_0xcc1f('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0xcc1f('0x3')],'allowNull':!![],'defaultValue':_0xcc1f('0x19')},'ipaddr':{'type':Sequelize[_0xcc1f('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0xcc1f('0x11')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xcc1f('0x11')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0xcc1f('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xcc1f('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xcc1f('0x11')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xcc1f('0xc')](_0xcc1f('0x1a'),_0xcc1f('0xd'),'peer'),'allowNull':!![],'defaultValue':_0xcc1f('0x1a')},'context':{'type':Sequelize[_0xcc1f('0x3')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0xcc1f('0xc')]('ALLOWED_NOT_SCREENED',_0xcc1f('0x1b'),_0xcc1f('0x1c'),_0xcc1f('0x1d'),_0xcc1f('0x1e'),'PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN',_0xcc1f('0x1f')),'allowNull':!![]},'deny':{'type':Sequelize[_0xcc1f('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0xcc1f('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0xcc1f('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xcc1f('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xcc1f('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0xcc1f('0x3')],'allowNull':!![],'defaultValue':'udp','set':function(_0x329a71){this[_0xcc1f('0x5')](_0xcc1f('0x20'),_0x329a71?_0x329a71['join'](','):null);},'get':function(){return this[_0xcc1f('0x15')](_0xcc1f('0x20'))?this[_0xcc1f('0x15')](_0xcc1f('0x20'))[_0xcc1f('0x21')](','):null;},'comment':_0xcc1f('0x22')},'dtmfmode':{'type':Sequelize[_0xcc1f('0xc')](_0xcc1f('0x23'),'info',_0xcc1f('0x24'),_0xcc1f('0x25'),'auto'),'allowNull':!![],'defaultValue':_0xcc1f('0x23')},'directmedia':{'type':Sequelize[_0xcc1f('0xc')](_0xcc1f('0x26'),'no','nonat','update',_0xcc1f('0x27')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xcc1f('0xc')](_0xcc1f('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xcc1f('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0xcc1f('0x3')],'allowNull':!![],'defaultValue':_0xcc1f('0x28'),'set':function(_0x1fc390){this[_0xcc1f('0x5')](_0xcc1f('0x29'),_0x1fc390?_0x1fc390[_0xcc1f('0x2a')](','):null);},'get':function(){return this[_0xcc1f('0x15')](_0xcc1f('0x29'))?this[_0xcc1f('0x15')](_0xcc1f('0x29'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xcc1f('0x3')]},'pickupgroup':{'type':Sequelize[_0xcc1f('0x3')]},'namedpickupgroup':{'type':Sequelize[_0xcc1f('0x3')]},'language':{'type':Sequelize[_0xcc1f('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xcc1f('0x3')]},'disallow':{'type':Sequelize[_0xcc1f('0x3')],'allowNull':![],'defaultValue':_0xcc1f('0x2b')},'allow':{'type':Sequelize[_0xcc1f('0x3')],'allowNull':![],'defaultValue':_0xcc1f('0x2c'),'set':function(_0x2df358){this[_0xcc1f('0x5')](_0xcc1f('0x2d'),_0x2df358?_0x2df358[_0xcc1f('0x2a')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xcc1f('0x15')](_0xcc1f('0x2d'))?this[_0xcc1f('0x15')](_0xcc1f('0x2d'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0xcc1f('0xc')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xcc1f('0x3')],'allowNull':!![],'set':function(_0x29ec3f){this[_0xcc1f('0x5')]('insecure',_0x29ec3f?_0x29ec3f[_0xcc1f('0x2a')](','):null);},'get':function(){return this[_0xcc1f('0x15')]('insecure')?this[_0xcc1f('0x15')](_0xcc1f('0x2e'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xcc1f('0xc')](_0xcc1f('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xcc1f('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xcc1f('0xc')](_0xcc1f('0x26'),'no',_0xcc1f('0x2f')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xcc1f('0xc')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0xcc1f('0x26'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xcc1f('0x11')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xcc1f('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xcc1f('0x3')],'allowNull':!![],'defaultValue':_0xcc1f('0x30')},'amaflags':{'type':Sequelize[_0xcc1f('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0xcc1f('0x26'),'no'),'allowNull':!![],'defaultValue':_0xcc1f('0x26')},'busylevel':{'type':Sequelize[_0xcc1f('0x11')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xcc1f('0xc')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xcc1f('0xc')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xcc1f('0xc')](_0xcc1f('0x26'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xcc1f('0xc')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xcc1f('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0xcc1f('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xcc1f('0xc')](_0xcc1f('0x26'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xcc1f('0x11')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xcc1f('0xc')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xcc1f('0xc')](_0xcc1f('0x31'),_0xcc1f('0x32'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xcc1f('0x11')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xcc1f('0x11')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xcc1f('0xc')](_0xcc1f('0x33'),_0xcc1f('0x34')),'allowNull':!![],'defaultValue':_0xcc1f('0x34')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0xcc1f('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xcc1f('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xcc1f('0xc')](_0xcc1f('0x26'),'no'),'allowNull':!![],'defaultValue':_0xcc1f('0x26')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xcc1f('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xcc1f('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xcc1f('0x11')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xcc1f('0x11')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xcc1f('0x11')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xcc1f('0xc')](_0xcc1f('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xcc1f('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xcc1f('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xcc1f('0x11')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xcc1f('0x11')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xcc1f('0x11')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xcc1f('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xcc1f('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xcc1f('0xc')](_0xcc1f('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xcc1f('0xc')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xcc1f('0xc')](_0xcc1f('0x26'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xcc1f('0xc')](_0xcc1f('0x26'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xcc1f('0xc')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0xcc1f('0x26'),'no',_0xcc1f('0x35'),_0xcc1f('0x36')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xcc1f('0x11')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xcc1f('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xcc1f('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xcc1f('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xcc1f('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0xcc1f('0x37'),'passive',_0xcc1f('0x38')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xcc1f('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xcc1f('0xc')](_0xcc1f('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xcc1f('0x11')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xcc1f('0xc')](_0xcc1f('0x26'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xcc1f('0xc')](_0xcc1f('0x26'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xcc1f('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xcc1f('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xcc1f('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xcc1f('0xc')](_0xcc1f('0x26'),'no','nonat',_0xcc1f('0x39'),_0xcc1f('0x3a')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xcc1f('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xcc1f('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0xcc1f('0x17')]},'passwordResetAt':{'type':Sequelize[_0xcc1f('0x17')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xcc1f('0x3b')]},'showWebBar':{'type':Sequelize[_0xcc1f('0x11')],'defaultValue':0x0,'set':function(_0x38fe3c){this[_0xcc1f('0x5')](_0xcc1f('0x3c'),_0x38fe3c);var _0x559152=this[_0xcc1f('0x3d')]({'plain':!![]});switch(_0x38fe3c){case 0x0:case 0x1:var _0x2af013=_0x559152[_0xcc1f('0x20')]?_['isArray'](_0x559152[_0xcc1f('0x20')])?_0x559152['transport'][_0xcc1f('0x2a')]():_0x559152['transport']:_0xcc1f('0x3e');if(_0x2af013===_0xcc1f('0x3f')){_0x2af013=_0xcc1f('0x3e');}this[_0xcc1f('0x5')](_0xcc1f('0x20'),_0x2af013);this[_0xcc1f('0x5')](_0xcc1f('0x40'),'no');this[_0xcc1f('0x5')](_0xcc1f('0x41'),null);this[_0xcc1f('0x5')](_0xcc1f('0x42'),null);this[_0xcc1f('0x5')](_0xcc1f('0x43'),null);this['setDataValue'](_0xcc1f('0x44'),null);this[_0xcc1f('0x5')](_0xcc1f('0x45'),null);this['setDataValue'](_0xcc1f('0x46'),null);this[_0xcc1f('0x5')](_0xcc1f('0x47'),null);this[_0xcc1f('0x5')](_0xcc1f('0x48'),null);this[_0xcc1f('0x5')](_0xcc1f('0x49'),'no');break;case 0x2:this[_0xcc1f('0x5')](_0xcc1f('0x20'),_0xcc1f('0x3f'));this[_0xcc1f('0x5')](_0xcc1f('0x40'),_0xcc1f('0x26'));this['setDataValue'](_0xcc1f('0x41'),_0xcc1f('0x26'));this[_0xcc1f('0x5')]('force_avp',_0xcc1f('0x26'));this[_0xcc1f('0x5')](_0xcc1f('0x43'),_0xcc1f('0x26'));this[_0xcc1f('0x5')](_0xcc1f('0x44'),_0xcc1f('0x26'));this[_0xcc1f('0x5')](_0xcc1f('0x45'),'no');this['setDataValue'](_0xcc1f('0x46'),_0xcc1f('0x38'));this[_0xcc1f('0x5')](_0xcc1f('0x47'),_0x559152[_0xcc1f('0x47')]||_0xcc1f('0x4a'));this[_0xcc1f('0x5')](_0xcc1f('0x48'),_0x559152[_0xcc1f('0x48')]||_0xcc1f('0x4b'));this[_0xcc1f('0x5')](_0xcc1f('0x49'),_0xcc1f('0x26'));break;default:}}},'permissions':{'type':Sequelize[_0xcc1f('0x3b')],'set':function(_0x2af8fd){this[_0xcc1f('0x5')](_0xcc1f('0x4c'),_0x2af8fd?_0x2af8fd[_0xcc1f('0x2a')](','):[]);},'get':function(){return this[_0xcc1f('0x15')](_0xcc1f('0x4c'))?_[_0xcc1f('0x4d')](this['getDataValue']('permissions')['split'](','),function(_0x18f873){return parseInt(_0x18f873,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xcc1f('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xcc1f('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0xcc1f('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0xcc1f('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xcc1f('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xcc1f('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xcc1f('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xcc1f('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xcc1f('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xcc1f('0x11')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xcc1f('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xcc1f('0x11')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xcc1f('0xc')](_0xcc1f('0x26'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xcc1f('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xcc1f('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0xcc1f('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xcc1f('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xcc1f('0x4e')],'get':function(){return this[_0xcc1f('0x15')](_0xcc1f('0x4f'))?this[_0xcc1f('0x15')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xcc1f('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xcc1f('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xcc1f('0x16')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xcc1f('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xcc1f('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xcc1f('0x16')],'defaultValue':![],'set':function(_0x1f35b8){if(typeof _0x1f35b8==='string'){var _0x30a928=_0x1f35b8==='1'?!![]:_0x1f35b8==='0'?![]:_0x1f35b8===_0xcc1f('0x50')?!![]:_0x1f35b8===_0xcc1f('0x51')?![]:![];this[_0xcc1f('0x5')](_0xcc1f('0x52'),_0x30a928);}else{this[_0xcc1f('0x5')](_0xcc1f('0x52'),_0x1f35b8);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x394d0e){this['setDataValue'](_0xcc1f('0x53'),_0x394d0e);if(_0x394d0e===!![]){this[_0xcc1f('0x5')](_0xcc1f('0x54'),moment());this[_0xcc1f('0x5')](_0xcc1f('0x55'),0x0);}else{this[_0xcc1f('0x5')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0xcc1f('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xcc1f('0x11')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xcc1f('0x16')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xcc1f('0x16')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xcc1f('0x11')](0x5)[_0xcc1f('0x56')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xcc1f('0x16')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index fbd5c24..736d0de 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 _0xa486=['end','status','json','limit','count','offset','set','Content-Range','destroy','admin','Users','user','Agents','agent','Telephones','telephone','filter','ignore','map','value','includes','role','find','UserProfileResource','stack','name','send','index','User','rawAttributes','fieldName','type','key','salt','getOptions','where','query','attributes','push','rows','openTabs','length','chat','dataValues','sms','mail','whatsapp','all','show','model','differenceBy','password','filters','intersection','fields','includeAll','include','merge','options','true','openchannel','update','body','params','describe','addContacts','ids','internal','findById','securePassword','max','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','VoiceMail','fullname','permissions','101','102','103','113','110','105','106','107','108','100','111','114','115','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','settingsEnabled','UserProfileSection','userProfileId','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','checkUserLimits','each','findAll','isEmpty','compact','changePassword','oldPassword','newPassword','Sequelize','authenticate','ValidationError','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Setting','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','updatePasswordsHistory','addQueues','channel','online','voicePause','interface','Unknown\x20channel','add','toLowerCase','penalty','spread','capitalize','Queue:save','voice','VoiceQueue','get','format','UserVoiceQueueRt','upsert','isValidChannel','remove','Queues','isArray','QueueId','emit','Queue:remove','addAvatar','userpic','getAvatar','join','root','server/files/images/logos/default_profile.png','download','existsSync','getOpenTabs','fax','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','findOne','keys','CmContact','order','sort','pick','getContacts','hasOwnProperty','CmList','List','Tags','color','tag','nolimit','getQueues','Queue','getVoiceQueuesRt','ChatGroup','getGroups','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','login','mobile','LOCAL/%s@from-sip/n','intrf','SIP/%s','user:%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','loginInPause','UserVoiceQueue.penalty','MemberReport','getChannels','YYYY-MM-DD\x20HH:mm:ss','forEach','LOGIN','PAUSE','LOGININPAUSE','concat','logout','pause','QueuePause','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','faxPause','openchannelPause','smsPause','whatsapppause','pauseType','lastPauseAt','manual','%s%s','Pause','getTeams','Team','addTeams','omit','setDataValue','Voice','getChatQueues','Mail','Sms','Whatsapp','Fax','getOpenchannelQueues','Openchannel','flatten','addAgent','getDataValue','removeTeams','Chat','getMailQueues','getSmsQueues','getWhatsappQueues','transaction','removeAgent','getLists','getAgents','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','removeFaxInteractions','user_has_fax_interactions:remove','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','$and','$or','$gt','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','lastName','phone','Contact','CmHopper','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','resolve','teams','queues','inbound','lower','col','toString','asc','substring','uniqBy','orderBy','client','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','ringing','voiceStatus','busy','charAt','slice','select','field','ui.','InteractionId','ui.createdAt','_interactions','ui.UserId\x20=\x20?','OpenTabs','moment','util','lodash','jayson/promise','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','socket.io-emitter','redis','./user.socket','register','defaults','localhost','http','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus'];(function(_0x4131b0,_0x504d34){var _0x18783d=function(_0x289767){while(--_0x289767){_0x4131b0['push'](_0x4131b0['shift']());}};_0x18783d(++_0x504d34);}(_0xa486,0x17d));var _0x6a48=function(_0x8e6301,_0x229dcf){_0x8e6301=_0x8e6301-0x0;var _0x28738c=_0xa486[_0x8e6301];return _0x28738c;};'use strict';var moment=require(_0x6a48('0x0'));var BPromise=require('bluebird');var util=require(_0x6a48('0x1'));var path=require('path');var fs=require('fs');var _=require(_0x6a48('0x2'));var squel=require('squel');var jayson=require(_0x6a48('0x3'));var Redis=require(_0x6a48('0x4'));var authService=require(_0x6a48('0x5'));var qs=require(_0x6a48('0x6'));var logger=require(_0x6a48('0x7'))(_0x6a48('0x8'));var utils=require(_0x6a48('0x9'));var config=require(_0x6a48('0xa'));var licenseUtil=require(_0x6a48('0xb'));var db=require(_0x6a48('0xc'))['db'];var socket=require(_0x6a48('0xd'))(new Redis(config[_0x6a48('0xe')]));require(_0x6a48('0xf'))[_0x6a48('0x10')](socket);config[_0x6a48('0xe')]=_[_0x6a48('0x11')](config['redis'],{'host':_0x6a48('0x12'),'port':0x18eb});var client=jayson['client'][_0x6a48('0x13')]({'port':0x232a});var values;function respondWithRpcPromise(_0x454dbd,_0x158714,_0x290bd2,_0x12b760){return new BPromise(function(_0x3aec54,_0x448a82){var _0x416d66=_0x12b760||client;return _0x416d66[_0x6a48('0x14')](_0x454dbd,_0x290bd2)[_0x6a48('0x15')](function(_0x1ef5c7){logger[_0x6a48('0x16')](_0x6a48('0x17'),_0x158714,_0x6a48('0x18'));logger[_0x6a48('0x19')](_0x6a48('0x1a'),_0x158714,_0x6a48('0x18'),JSON[_0x6a48('0x1b')](_0x1ef5c7));if(_0x1ef5c7[_0x6a48('0x1c')]){if(_0x1ef5c7[_0x6a48('0x1c')][_0x6a48('0x1d')]===0x1f4){logger[_0x6a48('0x1c')](_0x6a48('0x17'),_0x158714,_0x1ef5c7[_0x6a48('0x1c')][_0x6a48('0x1e')]);return _0x448a82(_0x1ef5c7[_0x6a48('0x1c')][_0x6a48('0x1e')]);}logger[_0x6a48('0x1c')]('User,\x20%s,\x20%s',_0x158714,_0x1ef5c7[_0x6a48('0x1c')][_0x6a48('0x1e')]);return _0x3aec54(_0x1ef5c7[_0x6a48('0x1c')][_0x6a48('0x1e')]);}else{logger['info'](_0x6a48('0x17'),_0x158714,_0x6a48('0x18'));_0x3aec54(_0x1ef5c7[_0x6a48('0x1f')]['message']);}})[_0x6a48('0x20')](function(_0x6a0206){logger[_0x6a48('0x1c')]('User,\x20%s,\x20%s',_0x158714,_0x6a0206);_0x448a82(_0x6a0206);});});}function respondWithStatusCode(_0xd0230,_0x24c549){_0x24c549=_0x24c549||0xcc;return function(_0x14dc20){if(_0x14dc20){return _0xd0230[_0x6a48('0x21')](_0x24c549);}return _0xd0230['status'](_0x24c549)[_0x6a48('0x22')]();};}function respondWithResult(_0x230220,_0x59b031){_0x59b031=_0x59b031||0xc8;return function(_0x4aa84e){if(_0x4aa84e){return _0x230220[_0x6a48('0x23')](_0x59b031)[_0x6a48('0x24')](_0x4aa84e);}};}function respondWithFilteredResult(_0x4cb5d0,_0x2eae9f){return function(_0x4846bf){if(_0x4846bf){var _0x508432=typeof _0x2eae9f['offset']==='undefined'&&typeof _0x2eae9f[_0x6a48('0x25')]==='undefined';var _0x19594c=_0x4846bf['count'];var _0x5b1331=_0x508432?0x0:_0x2eae9f['offset'];var _0x5d62a6=_0x508432?_0x4846bf[_0x6a48('0x26')]:_0x2eae9f[_0x6a48('0x27')]+_0x2eae9f[_0x6a48('0x25')];var _0x20ecb0;if(_0x5d62a6>=_0x19594c){_0x5d62a6=_0x19594c;_0x20ecb0=0xc8;}else{_0x20ecb0=0xce;}_0x4cb5d0['status'](_0x20ecb0);return _0x4cb5d0[_0x6a48('0x28')](_0x6a48('0x29'),_0x5b1331+'-'+_0x5d62a6+'/'+_0x19594c)[_0x6a48('0x24')](_0x4846bf);}return null;};}function saveUpdates(_0x13fe57){return function(_0x5188e8){if(_0x5188e8){return _0x5188e8['update'](_0x13fe57)[_0x6a48('0x15')](function(_0xa75f3d){return _0xa75f3d;});}return null;};}function removeEntity(_0x4168f2){return function(_0x38e417){if(_0x38e417){return _0x38e417[_0x6a48('0x2a')]()['then'](function(){var _0x16982f=_0x38e417['get']({'plain':!![]});if(_0x16982f['role']===_0x6a48('0x2b'))return;var _0x396e12=[{'name':_0x6a48('0x2c'),'value':_0x6a48('0x2d'),'ignore':!![]},{'name':_0x6a48('0x2e'),'value':_0x6a48('0x2f'),'ignore':![]},{'name':_0x6a48('0x30'),'value':_0x6a48('0x31'),'ignore':![]}];var _0x1372ef=_(_0x396e12)[_0x6a48('0x32')](_0x6a48('0x33'))[_0x6a48('0x34')]('value')[_0x6a48('0x35')]();if(_[_0x6a48('0x36')](_0x1372ef,_0x16982f[_0x6a48('0x37')])){return;}var _0x5502bb=_[_0x6a48('0x38')](_0x396e12,['value',_0x16982f[_0x6a48('0x37')]])['name'];return db[_0x6a48('0x39')][_0x6a48('0x2a')]({'where':{'type':_0x5502bb,'resourceId':_0x16982f['id']}})[_0x6a48('0x15')](function(){return _0x38e417;});})['then'](function(){_0x4168f2[_0x6a48('0x23')](0xcc)[_0x6a48('0x22')]();});}};}function handleEntityNotFound(_0x51703a){return function(_0x53004c){if(!_0x53004c){_0x51703a[_0x6a48('0x21')](0x194);}return _0x53004c;};}function handleError(_0x463476,_0x4f3ec1){_0x4f3ec1=_0x4f3ec1||0x1f4;return function(_0x5bf085){logger[_0x6a48('0x1c')](_0x5bf085[_0x6a48('0x3a')]);if(_0x5bf085[_0x6a48('0x3b')]){delete _0x5bf085[_0x6a48('0x3b')];}_0x463476['status'](_0x4f3ec1)[_0x6a48('0x3c')](_0x5bf085);};}exports[_0x6a48('0x3d')]=function(_0x35c3cf,_0x2b236b){var _0x228297={},_0x434f53={'count':0x0,'rows':[]};var _0x2e085c=_(db[_0x6a48('0x3e')][_0x6a48('0x3f')])[_0x6a48('0x34')](function(_0x102ea2){return{'name':_0x102ea2[_0x6a48('0x40')],'type':_0x102ea2[_0x6a48('0x41')][_0x6a48('0x42')]};})['filter'](function(_0x1c08fd){return!_[_0x6a48('0x36')](['password',_0x6a48('0x43')],_0x1c08fd[_0x6a48('0x3b')]);})[_0x6a48('0x35')]();_0x228297=qs[_0x6a48('0x44')](_0x2e085c,_0x35c3cf);var _0x4ced81={'where':_0x228297[_0x6a48('0x45')]};return db[_0x6a48('0x3e')][_0x6a48('0x26')](_0x4ced81)[_0x6a48('0x15')](function(_0xdb2642){_0x434f53[_0x6a48('0x26')]=_0xdb2642;if(_0x35c3cf[_0x6a48('0x46')]['includeAll']){_0x228297['include']=[{'all':!![]}];}if(!_[_0x6a48('0x36')](_0x228297[_0x6a48('0x47')],'id')){_0x228297['attributes'][_0x6a48('0x48')]('id');}return db[_0x6a48('0x3e')]['findAll'](_0x228297);})[_0x6a48('0x15')](function(_0x2abea4){_0x434f53[_0x6a48('0x49')]=_0x2abea4;if(_0x35c3cf[_0x6a48('0x46')][_0x6a48('0x4a')]==='true'){var _0x367701=[];for(var _0x553dd5=0x0;_0x553dd5<_0x434f53['rows'][_0x6a48('0x4b')];_0x553dd5++){_0x367701['push'](get_open_tabs(_0x6a48('0x4c'),_0x434f53['rows'][_0x553dd5][_0x6a48('0x4d')]));_0x367701[_0x6a48('0x48')](get_open_tabs(_0x6a48('0x4e'),_0x434f53['rows'][_0x553dd5][_0x6a48('0x4d')]));_0x367701['push'](get_open_tabs('fax',_0x434f53['rows'][_0x553dd5][_0x6a48('0x4d')]));_0x367701['push'](get_open_tabs(_0x6a48('0x4f'),_0x434f53[_0x6a48('0x49')][_0x553dd5][_0x6a48('0x4d')]));_0x367701[_0x6a48('0x48')](get_open_tabs('openchannel',_0x434f53[_0x6a48('0x49')][_0x553dd5]['dataValues']));_0x367701[_0x6a48('0x48')](get_open_tabs(_0x6a48('0x50'),_0x434f53['rows'][_0x553dd5]['dataValues']));}return BPromise[_0x6a48('0x51')](_0x367701)[_0x6a48('0x15')](function(_0x5c91cf){return _0x434f53;});}else{return _0x434f53;}})[_0x6a48('0x15')](respondWithFilteredResult(_0x2b236b,_0x228297))[_0x6a48('0x20')](handleError(_0x2b236b,null));};exports[_0x6a48('0x52')]=function(_0x20dab5,_0x1adecf){var _0x350a82={'raw':![],'where':{'id':_0x20dab5['params']['id']}},_0x1b00fa={};_0x1b00fa[_0x6a48('0x53')]=_[_0x6a48('0x54')](_['keys'](db[_0x6a48('0x3e')][_0x6a48('0x3f')]),[_0x6a48('0x55'),_0x6a48('0x43')]);_0x1b00fa[_0x6a48('0x46')]=_['keys'](_0x20dab5[_0x6a48('0x46')]);_0x1b00fa[_0x6a48('0x56')]=_[_0x6a48('0x57')](_0x1b00fa[_0x6a48('0x53')],_0x1b00fa[_0x6a48('0x46')]);_0x350a82['attributes']=_['intersection'](_0x1b00fa[_0x6a48('0x53')],qs[_0x6a48('0x58')](_0x20dab5[_0x6a48('0x46')]['fields']));_0x350a82[_0x6a48('0x47')]=_0x350a82['attributes'][_0x6a48('0x4b')]?_0x350a82[_0x6a48('0x47')]:_0x1b00fa['model'];if(_0x20dab5[_0x6a48('0x46')][_0x6a48('0x59')]){_0x350a82[_0x6a48('0x5a')]=[{'all':!![]}];}_0x350a82=_[_0x6a48('0x5b')]({},_0x350a82,_0x20dab5[_0x6a48('0x5c')]);if(!_[_0x6a48('0x36')](_0x350a82[_0x6a48('0x47')],'id')){_0x350a82['attributes'][_0x6a48('0x48')]('id');}return db[_0x6a48('0x3e')]['find'](_0x350a82)['then'](handleEntityNotFound(_0x1adecf,null))[_0x6a48('0x15')](function(_0x5459c2){var _0x4ffe6b=[];values=_0x5459c2;if(_0x20dab5[_0x6a48('0x46')]['openTabs']===_0x6a48('0x5d')){_0x4ffe6b[_0x6a48('0x48')](get_open_tabs(_0x6a48('0x4c'),_0x5459c2['dataValues']));_0x4ffe6b[_0x6a48('0x48')](get_open_tabs(_0x6a48('0x4e'),_0x5459c2[_0x6a48('0x4d')]));_0x4ffe6b[_0x6a48('0x48')](get_open_tabs(_0x6a48('0x5e'),_0x5459c2[_0x6a48('0x4d')]));_0x4ffe6b['push'](get_open_tabs(_0x6a48('0x50'),_0x5459c2[_0x6a48('0x4d')]));_0x4ffe6b[_0x6a48('0x48')](get_open_tabs('fax',_0x5459c2[_0x6a48('0x4d')]));_0x4ffe6b['push'](get_open_tabs('mail',_0x5459c2[_0x6a48('0x4d')]));return BPromise[_0x6a48('0x51')](_0x4ffe6b);}else{return values;}})[_0x6a48('0x15')](function(_0x492174){return values;})['then'](respondWithResult(_0x1adecf,null))[_0x6a48('0x20')](handleError(_0x1adecf,null));};exports[_0x6a48('0x5f')]=function(_0x133494,_0x545e28){if(_0x133494[_0x6a48('0x60')]['id']){delete _0x133494[_0x6a48('0x60')]['id'];}delete _0x133494['body'][_0x6a48('0x37')];return db['User'][_0x6a48('0x38')]({'where':{'id':_0x133494[_0x6a48('0x61')]['id']}})[_0x6a48('0x15')](handleEntityNotFound(_0x545e28,null))[_0x6a48('0x15')](saveUpdates(_0x133494[_0x6a48('0x60')],null))[_0x6a48('0x15')](respondWithResult(_0x545e28,null))[_0x6a48('0x20')](handleError(_0x545e28,null));};exports['describe']=function(_0xcede73,_0x2ae9c2){return db[_0x6a48('0x3e')][_0x6a48('0x62')]()[_0x6a48('0x15')](respondWithResult(_0x2ae9c2,null))[_0x6a48('0x20')](handleError(_0x2ae9c2,null));};exports[_0x6a48('0x63')]=function(_0x1da744,_0x232456){return db[_0x6a48('0x3e')][_0x6a48('0x38')]({'where':{'id':_0x1da744['params']['id']}})[_0x6a48('0x15')](handleEntityNotFound(_0x232456,null))[_0x6a48('0x15')](function(_0x27e689){if(_0x27e689){return _0x27e689[_0x6a48('0x63')](_0x1da744[_0x6a48('0x60')][_0x6a48('0x64')],_['omit'](_0x1da744['body'],['ids','id'])||{});}})[_0x6a48('0x15')](respondWithResult(_0x232456,null))[_0x6a48('0x20')](handleError(_0x232456,null));};function validateUser(_0x1a17f8){return new BPromise(function(_0x39b9b7,_0x5a53e0){if(_0x1a17f8[_0x6a48('0x65')])return _0x39b9b7(_0x1a17f8);return db['Setting'][_0x6a48('0x66')](0x1)[_0x6a48('0x15')](function(_0x2edba7){if(_0x2edba7[_0x6a48('0x67')])authService['validatePasswordPattern'](_0x1a17f8[_0x6a48('0x55')]);db[_0x6a48('0x3e')][_0x6a48('0x68')](_0x6a48('0x65'))[_0x6a48('0x15')](function(_0x1635fa){if(_[_0x6a48('0x69')](_0x1635fa)){_0x1a17f8[_0x6a48('0x65')]=_0x2edba7[_0x6a48('0x6a')]||0x1;return;}if(_[_0x6a48('0x69')](_0x2edba7[_0x6a48('0x6a')])||_0x2edba7[_0x6a48('0x6a')]===_0x1635fa){_0x1a17f8[_0x6a48('0x65')]=_0x1635fa+0x1;return;}if(_0x2edba7[_0x6a48('0x6a')]>_0x1635fa){_0x1a17f8[_0x6a48('0x65')]=_0x2edba7[_0x6a48('0x6a')];return;}return db[_0x6a48('0x6b')][_0x6a48('0x46')](_0x6a48('0x6c'),{'type':db[_0x6a48('0x6b')][_0x6a48('0x6d')][_0x6a48('0x6e')]})[_0x6a48('0x15')](function(_0x27ed0c){if(_0x27ed0c&&_0x27ed0c['length']){for(var _0x4435ab=0x0,_0x49bb0c=_0x27ed0c[_0x6a48('0x4b')];_0x4435ab<_0x49bb0c&&_[_0x6a48('0x69')](_0x1a17f8['internal']);_0x4435ab++){if(_0x2edba7[_0x6a48('0x6a')]<=_0x27ed0c[_0x4435ab][_0x6a48('0x6f')]){_0x1a17f8['internal']=_0x27ed0c[_0x4435ab][_0x6a48('0x6f')];}else if(_0x2edba7['min_internal']>_0x27ed0c[_0x4435ab][_0x6a48('0x6f')]&&_0x2edba7['min_internal']<=_0x27ed0c[_0x4435ab]['to']){_0x1a17f8[_0x6a48('0x65')]=_0x2edba7[_0x6a48('0x6a')];}}}if(_[_0x6a48('0x69')](_0x1a17f8['internal'])){_0x1a17f8[_0x6a48('0x65')]=_0x1635fa+0x1;}return _0x39b9b7(_0x1a17f8);});});})[_0x6a48('0x20')](function(_0x48042a){_0x5a53e0(_0x48042a);});});}function updateUser(_0x535fde){return new BPromise(function(_0x27129b,_0x58974b){try{if(_0x535fde['voicemail']){_0x535fde['mailbox']=_0x535fde[_0x6a48('0x65')];_0x535fde[_0x6a48('0x70')]={'mailbox':_0x535fde[_0x6a48('0x65')],'password':_0x535fde[_0x6a48('0x55')],'fullname':_0x535fde[_0x6a48('0x71')],'email':_0x535fde['email']};}if(_0x535fde[_0x6a48('0x37')]===_0x6a48('0x2f')){if(!_0x535fde[_0x6a48('0x72')])_0x535fde[_0x6a48('0x72')]=[_0x6a48('0x73'),_0x6a48('0x74'),_0x6a48('0x75'),_0x6a48('0x76'),_0x6a48('0x77'),'104',_0x6a48('0x78'),_0x6a48('0x79'),_0x6a48('0x7a'),_0x6a48('0x7b'),'109',_0x6a48('0x7c'),_0x6a48('0x7d'),_0x6a48('0x7e'),_0x6a48('0x7f')];}_0x27129b(_0x535fde);}catch(_0x52918d){_0x58974b(_0x52918d);}});}exports[_0x6a48('0x80')]=function(_0x488def,_0x14904b){if(_0x488def[_0x6a48('0x2d')]['role']===_0x6a48('0x2f'))throw new Error(_0x6a48('0x81'));if(_0x488def[_0x6a48('0x60')]['role']===_0x6a48('0x2d')&&_0x488def[_0x6a48('0x2d')][_0x6a48('0x37')]!==_0x6a48('0x2b')){throw new Error(_0x6a48('0x82'));}if(_0x488def[_0x6a48('0x60')][_0x6a48('0x37')]===_0x6a48('0x2b')&&_0x488def[_0x6a48('0x2d')]['role']!==_0x6a48('0x2b')){throw new Error(_0x6a48('0x83'));}return licenseUtil['checkUserLimits']([_0x488def[_0x6a48('0x60')]])['then'](function(){return validateUser(_0x488def[_0x6a48('0x60')]);})[_0x6a48('0x15')](function(_0x5c00de){return updateUser(_0x5c00de)[_0x6a48('0x15')](function(_0x6a8675){if(_0x6a8675[_0x6a48('0x37')]===_0x6a48('0x2b')){_0x6a8675[_0x6a48('0x84')]=_0x488def[_0x6a48('0x2d')][_0x6a48('0x84')];delete _0x6a8675['userProfileId'];}return _0x6a8675;});})[_0x6a48('0x15')](function(_0xdcfa2d){return db[_0x6a48('0x3e')][_0x6a48('0x80')](_0xdcfa2d,{'include':[{'model':db[_0x6a48('0x70')],'as':_0x6a48('0x70')}]});})[_0x6a48('0x15')](function(_0x51886e){if(_0x488def['body'][_0x6a48('0x37')]===_0x6a48('0x2d'))return _0x51886e;if(_0x488def['user']['role']!==_0x6a48('0x2d'))return _0x51886e;return db[_0x6a48('0x85')][_0x6a48('0x38')]({'where':{'name':_0x51886e[_0x6a48('0x37')]===_0x6a48('0x2f')?'Agents':_0x6a48('0x30'),'userProfileId':_0x488def['user'][_0x6a48('0x86')]},'raw':!![]})[_0x6a48('0x15')](function(_0x2600d9){if(!_0x2600d9||_0x2600d9[_0x6a48('0x87')]!=0x0)return _0x51886e;return db[_0x6a48('0x39')][_0x6a48('0x80')]({'name':_0x51886e[_0x6a48('0x3b')],'resourceId':_0x51886e['id'],'type':_0x2600d9[_0x6a48('0x3b')],'sectionId':_0x2600d9['id']},{})[_0x6a48('0x15')](function(){return _0x51886e;});})[_0x6a48('0x20')](function(_0x1f7602){logger['error'](_0x6a48('0x88'),_0x1f7602);throw _0x1f7602;});})[_0x6a48('0x15')](respondWithResult(_0x14904b,0xc9))[_0x6a48('0x20')](handleError(_0x14904b,null));};exports[_0x6a48('0x89')]=function(_0x3d0141,_0x58e395){var _0x5555d5=_0x3d0141[_0x6a48('0x60')];var _0x5ba0db=[];if(_0x3d0141[_0x6a48('0x2d')][_0x6a48('0x37')]===_0x6a48('0x2f'))throw new Error(_0x6a48('0x81'));if(_[_0x6a48('0x8a')](_0x5555d5,['role','user'])&&_0x3d0141[_0x6a48('0x2d')]['role']!==_0x6a48('0x2b')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x6a48('0x8a')](_0x5555d5,[_0x6a48('0x37'),_0x6a48('0x2b')])&&_0x3d0141[_0x6a48('0x2d')]['role']!==_0x6a48('0x2b')){throw new Error(_0x6a48('0x8b'));}return licenseUtil[_0x6a48('0x8c')](_0x5555d5)['then'](function(){return validateUser(_0x5555d5[0x0]);})[_0x6a48('0x15')](function(){for(var _0x432204=0x1;_0x432204<_0x5555d5['length'];_0x432204++){var _0x57268d=_0x5555d5[_0x432204-0x1][_0x6a48('0x65')];if(!_0x5555d5[_0x432204][_0x6a48('0x65')])_0x5555d5[_0x432204]['internal']=_0x57268d+0x1;_0x5ba0db['push'](validateUser(_0x5555d5[_0x432204]));}return BPromise[_0x6a48('0x51')](_0x5ba0db);})['then'](function(){_0x5ba0db=[];for(var _0x15b678=0x0;_0x15b678<_0x5555d5[_0x6a48('0x4b')];_0x15b678++){_0x5ba0db[_0x6a48('0x48')](updateUser(_0x5555d5[_0x15b678]));}return BPromise[_0x6a48('0x51')](_0x5ba0db);})[_0x6a48('0x15')](function(){return BPromise[_0x6a48('0x8d')](_0x5555d5,function(_0x9318e4){return db[_0x6a48('0x3e')][_0x6a48('0x80')](_0x9318e4,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]})[_0x6a48('0x15')](function(_0x49d4db){_0x9318e4['id']=_0x49d4db['id'];return _0x9318e4;});});})[_0x6a48('0x15')](function(_0x23cedd){if(_0x3d0141[_0x6a48('0x60')][_0x6a48('0x37')]===_0x6a48('0x2d'))return _0x23cedd;if(_0x3d0141[_0x6a48('0x2d')][_0x6a48('0x37')]!==_0x6a48('0x2d'))return _0x23cedd;var _0x59a53f=_[_0x6a48('0x8a')](_0x23cedd,function(_0x38f5c8){return _0x38f5c8[_0x6a48('0x37')]===_0x6a48('0x2f')||_0x38f5c8['role']===_0x6a48('0x31');});if(!_0x59a53f)return _0x23cedd;return db[_0x6a48('0x85')][_0x6a48('0x8e')]({'where':{'name':{'$or':[_0x6a48('0x2e'),_0x6a48('0x30')]},'userProfileId':_0x3d0141['user'][_0x6a48('0x86')]},'raw':!![]})[_0x6a48('0x15')](function(_0x563181){if(_[_0x6a48('0x8f')](_0x563181)||!_[_0x6a48('0x8a')](_0x563181,[_0x6a48('0x87'),0x0]))return _0x23cedd;_0x5ba0db=[];var _0x90c544=_(_0x563181)[_0x6a48('0x34')](function(_0x22b589){if(_0x22b589[_0x6a48('0x87')]===0x1)return;return _0x22b589['name']===_0x6a48('0x2e')?_0x6a48('0x2f'):_0x6a48('0x31');})[_0x6a48('0x90')]()['value']();for(var _0x20be82=0x0;_0x20be82<_0x23cedd[_0x6a48('0x4b')];_0x20be82++){if(!_[_0x6a48('0x36')](_0x90c544,_0x23cedd[_0x20be82][_0x6a48('0x37')]))return;var _0x513e5c=_0x23cedd[_0x20be82]['role']===_0x6a48('0x2f')?_0x6a48('0x2e'):_0x6a48('0x30');_0x5ba0db['push'](db['UserProfileResource'][_0x6a48('0x80')]({'name':_0x23cedd[_0x20be82][_0x6a48('0x3b')],'resourceId':_0x23cedd[_0x20be82]['id'],'type':_0x513e5c,'sectionId':_[_0x6a48('0x38')](_0x563181,['name',_0x513e5c])['id']},{}));}return BPromise[_0x6a48('0x51')](_0x5ba0db);});})['then'](respondWithResult(_0x58e395,0xc9))[_0x6a48('0x20')](handleError(_0x58e395,null));};exports[_0x6a48('0x91')]=function(_0xbbde4c,_0x54d72b){if(_0xbbde4c[_0x6a48('0x60')]['id']){delete _0xbbde4c['body']['id'];}return db['User'][_0x6a48('0x38')]({'where':{'id':_0xbbde4c['params']['id']}})[_0x6a48('0x15')](function(_0x2335c8){if(!_0x2335c8)return null;if(_0x2335c8['id']===_0xbbde4c[_0x6a48('0x2d')]['id']){if(!_0xbbde4c[_0x6a48('0x60')][_0x6a48('0x92')]||!_0xbbde4c[_0x6a48('0x60')][_0x6a48('0x93')]){throw new db[(_0x6a48('0x94'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x2335c8[_0x6a48('0x95')](_0xbbde4c[_0x6a48('0x60')][_0x6a48('0x92')])){throw new db['Sequelize'][(_0x6a48('0x96'))](_0x6a48('0x97'));}if(_0xbbde4c[_0x6a48('0x60')][_0x6a48('0x92')]===_0xbbde4c['body']['newPassword']){throw new db[(_0x6a48('0x94'))]['ValidationError'](_0x6a48('0x98'));}}else if(_0xbbde4c[_0x6a48('0x2d')][_0x6a48('0x37')]===_0x6a48('0x2b')){if(!_0xbbde4c[_0x6a48('0x60')]['newPassword']){throw new db[(_0x6a48('0x94'))][(_0x6a48('0x96'))](_0x6a48('0x99'));}}else if(_0xbbde4c[_0x6a48('0x2d')]['role']===_0x6a48('0x2d')){if(!_0xbbde4c[_0x6a48('0x60')][_0x6a48('0x93')]){throw new db[(_0x6a48('0x94'))]['ValidationError'](_0x6a48('0x99'));}if(_0x2335c8[_0x6a48('0x37')]!==_0x6a48('0x2f')){throw new db[(_0x6a48('0x94'))][(_0x6a48('0x96'))]('Unauthorized');}}else{throw new db[(_0x6a48('0x94'))]['ValidationError']('Unauthorized');}return _0x2335c8;})[_0x6a48('0x15')](handleEntityNotFound(_0x54d72b,null))[_0x6a48('0x15')](function(_0x3c11f7){return db[_0x6a48('0x9a')]['findOne']({'attributes':['id',_0x6a48('0x67'),_0x6a48('0x9b'),_0x6a48('0x9c')]})['then'](function(_0xe883db){if(_0xe883db[_0x6a48('0x67')])authService['validatePasswordPattern'](_0xbbde4c[_0x6a48('0x60')][_0x6a48('0x93')]);if(!_0xe883db['enforcePasswordHistory']||!_0x3c11f7['previousPasswords'])return _0x3c11f7;authService['validatePasswordHistory'](_0xbbde4c[_0x6a48('0x60')][_0x6a48('0x93')],_0x3c11f7[_0x6a48('0x9d')],_0xe883db[_0x6a48('0x9c')]);return _0x3c11f7;})[_0x6a48('0x15')](saveUpdates({'password':_0xbbde4c[_0x6a48('0x60')]['newPassword'],'passwordResetAt':_0xbbde4c[_0x6a48('0x2d')]['id']==_0xbbde4c['params']['id']?moment():null,'previousPasswords':authService[_0x6a48('0x9e')](_0xbbde4c[_0x6a48('0x60')][_0x6a48('0x93')],_0x3c11f7[_0x6a48('0x9d')])},null));})[_0x6a48('0x15')](respondWithResult(_0x54d72b,null))[_0x6a48('0x20')](handleError(_0x54d72b,null));};exports[_0x6a48('0x9f')]=function(_0x4f9527,_0x4b494d){var _0x292a04=_0x4f9527['body'][_0x6a48('0xa0')];return db[_0x6a48('0x3e')][_0x6a48('0x38')]({'where':{'id':_0x4f9527[_0x6a48('0x61')]['id']},'attributes':['id',_0x6a48('0x3b'),_0x6a48('0x37'),_0x6a48('0xa1'),'loginInPause',_0x6a48('0xa2'),_0x6a48('0xa3')]})[_0x6a48('0x15')](handleEntityNotFound(_0x4b494d,null))['then'](function(_0x505e99){if(_0x505e99){if(!utils['isValidChannel'](_0x292a04)){throw new db[(_0x6a48('0x94'))][(_0x6a48('0x96'))](_0x6a48('0xa4'));}return _0x505e99[_0x6a48('0xa5')+_['capitalize'](_0x292a04[_0x6a48('0xa6')]())+'Queues'](_0x4f9527[_0x6a48('0x60')][_0x6a48('0x64')],{'penalty':_0x4f9527[_0x6a48('0x60')][_0x6a48('0xa7')]||0x0})[_0x6a48('0xa8')](function(_0x3d8066){for(var _0x28ca9c=0x0;_0x28ca9c<_0x4f9527[_0x6a48('0x60')][_0x6a48('0x64')][_0x6a48('0x4b')];_0x28ca9c+=0x1){var _0x1e126d={'UserId':Number(_0x4f9527[_0x6a48('0x61')]['id'])};_0x1e126d[_[_0x6a48('0xa9')](_0x292a04[_0x6a48('0xa6')]())+'QueueId']=Number(_0x4f9527[_0x6a48('0x60')][_0x6a48('0x64')][_0x28ca9c]);socket['emit'](_0x6a48('0x2d')+_[_0x6a48('0xa9')](_0x292a04[_0x6a48('0xa6')]())+_0x6a48('0xaa'),_0x1e126d);}return _0x3d8066;})[_0x6a48('0x15')](function(){if(_0x292a04===_0x6a48('0xab')){return db[_0x6a48('0xac')][_0x6a48('0x8e')]({'where':{'id':_0x4f9527[_0x6a48('0x60')][_0x6a48('0x64')]||[]},'raw':!![],'attributes':['id',_0x6a48('0x3b')]});}})[_0x6a48('0x15')](function(_0x1408b4){var _0x5bee43=_0x505e99[_0x6a48('0xad')]({'plain':!![]});var _0x2b5f03=[];if(_0x292a04==='voice'&&_0x5bee43[_0x6a48('0x37')]==='agent'&&_0x5bee43[_0x6a48('0xa1')]){for(var _0x1b6111=0x0;_0x1b6111<_0x1408b4[_0x6a48('0x4b')];_0x1b6111+=0x1){_0x2b5f03['push']({'membername':_0x5bee43[_0x6a48('0x3b')],'UserId':_0x5bee43['id'],'queue_name':_0x1408b4[_0x1b6111][_0x6a48('0x3b')],'VoiceQueueId':_0x1408b4[_0x1b6111]['id'],'interface':_[_0x6a48('0x69')](_0x5bee43[_0x6a48('0xa3')])?util[_0x6a48('0xae')]('SIP/%s',_0x5bee43[_0x6a48('0x3b')]):_0x5bee43['interface'],'paused':_0x5bee43[_0x6a48('0xa2')]||![],'penalty':_0x4f9527[_0x6a48('0x60')][_0x6a48('0xa7')]||0x0});}return BPromise[_0x6a48('0x8d')](_0x2b5f03,function(_0x337acc){return db[_0x6a48('0xaf')][_0x6a48('0xb0')](_0x337acc);});}return _0x505e99;});}})['then'](respondWithStatusCode(_0x4b494d,null))[_0x6a48('0x20')](handleError(_0x4b494d,null));};exports['removeQueues']=function(_0x3fff05,_0xfc8158){var _0x362ea2;return db[_0x6a48('0x3e')]['find']({'where':{'id':_0x3fff05['params']['id']},'attributes':['id',_0x6a48('0x3b'),'role']})[_0x6a48('0x15')](handleEntityNotFound(_0xfc8158,null))[_0x6a48('0x15')](function(_0x57a915){if(_0x57a915){_0x362ea2=_0x57a915;if(!_0x3fff05[_0x6a48('0x46')][_0x6a48('0xa0')]||!utils[_0x6a48('0xb1')](_0x3fff05[_0x6a48('0x46')][_0x6a48('0xa0')])){throw new db[(_0x6a48('0x94'))][(_0x6a48('0x96'))](_0x6a48('0xa4'));}return _0x57a915[_0x6a48('0xb2')+_[_0x6a48('0xa9')](_0x3fff05[_0x6a48('0x46')][_0x6a48('0xa0')][_0x6a48('0xa6')]())+_0x6a48('0xb3')](_0x3fff05[_0x6a48('0x46')][_0x6a48('0x64')]);}})[_0x6a48('0x15')](function(_0x347fae){if(_[_0x6a48('0xb4')](_0x3fff05[_0x6a48('0x46')]['ids'])){for(var _0x18241a=0x0;_0x18241a<_0x3fff05[_0x6a48('0x46')][_0x6a48('0x64')][_0x6a48('0x4b')];_0x18241a+=0x1){var _0x5dbbd4={'UserId':Number(_0x3fff05[_0x6a48('0x61')]['id'])};_0x5dbbd4[_[_0x6a48('0xa9')](_0x3fff05[_0x6a48('0x46')][_0x6a48('0xa0')]['toLowerCase']())+_0x6a48('0xb5')]=Number(_0x3fff05[_0x6a48('0x46')][_0x6a48('0x64')][_0x18241a]);socket[_0x6a48('0xb6')](_0x6a48('0x2d')+_[_0x6a48('0xa9')](_0x3fff05[_0x6a48('0x46')][_0x6a48('0xa0')][_0x6a48('0xa6')]())+_0x6a48('0xb7'),_0x5dbbd4);}}else{var _0x5dbbd4={'UserId':Number(_0x3fff05[_0x6a48('0x61')]['id'])};_0x5dbbd4[_[_0x6a48('0xa9')](_0x3fff05[_0x6a48('0x46')][_0x6a48('0xa0')]['toLowerCase']())+_0x6a48('0xb5')]=Number(_0x3fff05[_0x6a48('0x46')][_0x6a48('0x64')]);socket['emit'](_0x6a48('0x2d')+_[_0x6a48('0xa9')](_0x3fff05[_0x6a48('0x46')][_0x6a48('0xa0')][_0x6a48('0xa6')]())+'Queue:remove',_0x5dbbd4);}return _0x347fae;})[_0x6a48('0x15')](function(){if(_0x3fff05['query']['channel']==='voice'){return db[_0x6a48('0xaf')][_0x6a48('0x2a')]({'where':{'UserId':_0x3fff05[_0x6a48('0x61')]['id'],'VoiceQueueId':_0x3fff05[_0x6a48('0x46')]['ids']},'individualHooks':!![]})['then'](function(){return _0x362ea2;});}return _0x362ea2;})['then'](respondWithStatusCode(_0xfc8158,null))[_0x6a48('0x20')](handleError(_0xfc8158,null));};exports[_0x6a48('0xb8')]=function(_0x23f88f,_0x536c21){_0x23f88f[_0x6a48('0x60')][_0x6a48('0xb9')]=_0x23f88f['file']['filename'];return db['User'][_0x6a48('0x38')]({'where':{'id':_0x23f88f[_0x6a48('0x61')]['id']}})[_0x6a48('0x15')](handleEntityNotFound(_0x536c21,null))[_0x6a48('0x15')](saveUpdates(_0x23f88f[_0x6a48('0x60')],null))[_0x6a48('0x15')](respondWithResult(_0x536c21,null))[_0x6a48('0x20')](handleError(_0x536c21,null));};exports[_0x6a48('0xba')]=function(_0x405ba3,_0x385ef7){var _0x2e3efb=path[_0x6a48('0xbb')](config[_0x6a48('0xbc')],_0x6a48('0xbd'));return db[_0x6a48('0x3e')][_0x6a48('0x38')]({'where':{'id':_0x405ba3[_0x6a48('0x61')]['id']},'attributes':['id',_0x6a48('0xb9')],'raw':!![]})[_0x6a48('0x15')](handleEntityNotFound(_0x385ef7,null))[_0x6a48('0x15')](function(_0x62de82){if(_0x62de82){if(_[_0x6a48('0x69')](_0x62de82[_0x6a48('0xb9')])){return _0x385ef7[_0x6a48('0xbe')](_0x2e3efb);}else{if(!fs[_0x6a48('0xbf')](path['join'](config[_0x6a48('0xbc')],'server/files/images/',_0x62de82[_0x6a48('0xb9')]))){return _0x385ef7['download'](_0x2e3efb);}return _0x385ef7[_0x6a48('0xbe')](path[_0x6a48('0xbb')](config[_0x6a48('0xbc')],'server/files/images/',_0x62de82['userpic']));}}})[_0x6a48('0x20')](handleError(_0x385ef7,null));};exports[_0x6a48('0xc0')]=function(_0x5ddc5e,_0x96ea57){return db['User'][_0x6a48('0x38')]({'where':{'id':_0x5ddc5e['params']['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x96ea57,null))['then'](function(_0x590c80){var _0x3474e5=[];values=_0x590c80[_0x6a48('0x4d')];_0x3474e5['push'](get_open_tabs(_0x6a48('0x4c'),_0x590c80[_0x6a48('0x4d')]));_0x3474e5[_0x6a48('0x48')](get_open_tabs(_0x6a48('0x4e'),_0x590c80['dataValues']));_0x3474e5[_0x6a48('0x48')](get_open_tabs(_0x6a48('0x5e'),_0x590c80[_0x6a48('0x4d')]));_0x3474e5[_0x6a48('0x48')](get_open_tabs(_0x6a48('0x50'),_0x590c80[_0x6a48('0x4d')]));_0x3474e5[_0x6a48('0x48')](get_open_tabs(_0x6a48('0xc1'),_0x590c80[_0x6a48('0x4d')]));_0x3474e5[_0x6a48('0x48')](get_open_tabs(_0x6a48('0x4f'),_0x590c80[_0x6a48('0x4d')]));return BPromise[_0x6a48('0x51')](_0x3474e5);})[_0x6a48('0x15')](function(_0x558e1c){var _0x317dc7=[];if(_0x558e1c){for(var _0x2b4b39=0x0;_0x2b4b39=_0x5cc7d8){_0x3a2fd3=_0x5cc7d8;_0x326c38=0xc8;}else{_0x326c38=0xce;}_0x2c3799[_0x2d4a('0x1d')](_0x326c38);return _0x2c3799[_0x2d4a('0x24')]('Content-Range',_0x5029f3+'-'+_0x3a2fd3+'/'+_0x5cc7d8)[_0x2d4a('0x1f')](_0x2c845c);}return null;};}function saveUpdates(_0x5ce262){return function(_0x221602){if(_0x221602){return _0x221602[_0x2d4a('0x25')](_0x5ce262)[_0x2d4a('0x13')](function(_0x20b87d){return _0x20b87d;});}return null;};}function removeEntity(_0x101382){return function(_0x1dfc5d){if(_0x1dfc5d){return _0x1dfc5d[_0x2d4a('0x26')]()[_0x2d4a('0x13')](function(){var _0x51b447=_0x1dfc5d[_0x2d4a('0x27')]({'plain':!![]});if(_0x51b447[_0x2d4a('0x28')]===_0x2d4a('0x29'))return;var _0x286150=[{'name':_0x2d4a('0x2a'),'value':'user','ignore':!![]},{'name':_0x2d4a('0x2b'),'value':_0x2d4a('0x2c'),'ignore':![]},{'name':_0x2d4a('0x2d'),'value':_0x2d4a('0x2e'),'ignore':![]}];var _0x2bb93d=_(_0x286150)['filter'](_0x2d4a('0x2f'))[_0x2d4a('0x30')](_0x2d4a('0x31'))[_0x2d4a('0x31')]();if(_[_0x2d4a('0x32')](_0x2bb93d,_0x51b447[_0x2d4a('0x28')])){return;}var _0x5801a8=_[_0x2d4a('0x33')](_0x286150,[_0x2d4a('0x31'),_0x51b447[_0x2d4a('0x28')]])[_0x2d4a('0x34')];return db[_0x2d4a('0x35')]['destroy']({'where':{'type':_0x5801a8,'resourceId':_0x51b447['id']}})[_0x2d4a('0x13')](function(){return _0x1dfc5d;});})[_0x2d4a('0x13')](function(){_0x101382['status'](0xcc)[_0x2d4a('0x1e')]();});}};}function handleEntityNotFound(_0x1d6313){return function(_0x3dae78){if(!_0x3dae78){_0x1d6313[_0x2d4a('0x1c')](0x194);}return _0x3dae78;};}function handleError(_0x2b9093,_0x318ff0){_0x318ff0=_0x318ff0||0x1f4;return function(_0x487d2e){logger[_0x2d4a('0x17')](_0x487d2e[_0x2d4a('0x36')]);if(_0x487d2e[_0x2d4a('0x34')]){delete _0x487d2e[_0x2d4a('0x34')];}_0x2b9093[_0x2d4a('0x1d')](_0x318ff0)[_0x2d4a('0x37')](_0x487d2e);};}exports['index']=function(_0x5883f5,_0x393762){var _0x4b833b={},_0x6e0716={'count':0x0,'rows':[]};var _0x309e33=_(db['User'][_0x2d4a('0x38')])[_0x2d4a('0x30')](function(_0x8e1bea){return{'name':_0x8e1bea[_0x2d4a('0x39')],'type':_0x8e1bea[_0x2d4a('0x3a')][_0x2d4a('0x3b')]};})[_0x2d4a('0x3c')](function(_0x2bd60a){return!_[_0x2d4a('0x32')]([_0x2d4a('0x3d'),_0x2d4a('0x3e')],_0x2bd60a['name']);})[_0x2d4a('0x31')]();_0x4b833b=qs[_0x2d4a('0x3f')](_0x309e33,_0x5883f5);var _0x2bc864={'where':_0x4b833b[_0x2d4a('0x40')]};return db[_0x2d4a('0x41')]['count'](_0x2bc864)['then'](function(_0x54750d){_0x6e0716['count']=_0x54750d;if(_0x5883f5[_0x2d4a('0x42')][_0x2d4a('0x43')]){_0x4b833b[_0x2d4a('0x44')]=[{'all':!![]}];}if(!_[_0x2d4a('0x32')](_0x4b833b['attributes'],'id')){_0x4b833b[_0x2d4a('0x45')][_0x2d4a('0x46')]('id');}return db['User'][_0x2d4a('0x47')](_0x4b833b);})[_0x2d4a('0x13')](function(_0x8a9375){_0x6e0716[_0x2d4a('0x48')]=_0x8a9375;if(_0x5883f5[_0x2d4a('0x42')][_0x2d4a('0x49')]==='true'){var _0x236fbf=[];for(var _0x2d6eca=0x0;_0x2d6eca<_0x6e0716[_0x2d4a('0x48')][_0x2d4a('0x4a')];_0x2d6eca++){_0x236fbf[_0x2d4a('0x46')](get_open_tabs(_0x2d4a('0x4b'),_0x6e0716['rows'][_0x2d6eca][_0x2d4a('0x4c')]));_0x236fbf[_0x2d4a('0x46')](get_open_tabs(_0x2d4a('0x4d'),_0x6e0716['rows'][_0x2d6eca][_0x2d4a('0x4c')]));_0x236fbf['push'](get_open_tabs(_0x2d4a('0x4e'),_0x6e0716[_0x2d4a('0x48')][_0x2d6eca][_0x2d4a('0x4c')]));_0x236fbf[_0x2d4a('0x46')](get_open_tabs(_0x2d4a('0x4f'),_0x6e0716['rows'][_0x2d6eca]['dataValues']));_0x236fbf[_0x2d4a('0x46')](get_open_tabs(_0x2d4a('0x50'),_0x6e0716['rows'][_0x2d6eca][_0x2d4a('0x4c')]));_0x236fbf['push'](get_open_tabs(_0x2d4a('0x51'),_0x6e0716[_0x2d4a('0x48')][_0x2d6eca][_0x2d4a('0x4c')]));}return BPromise['all'](_0x236fbf)[_0x2d4a('0x13')](function(_0x541b93){return _0x6e0716;});}else{return _0x6e0716;}})[_0x2d4a('0x13')](respondWithFilteredResult(_0x393762,_0x4b833b))[_0x2d4a('0x1b')](handleError(_0x393762,null));};exports[_0x2d4a('0x52')]=function(_0x2d66f2,_0x1325ea){var _0x4210d9={'raw':![],'where':{'id':_0x2d66f2[_0x2d4a('0x53')]['id']}},_0x92842c={};_0x92842c[_0x2d4a('0x54')]=_[_0x2d4a('0x55')](_[_0x2d4a('0x56')](db['User'][_0x2d4a('0x38')]),[_0x2d4a('0x3d'),_0x2d4a('0x3e')]);_0x92842c[_0x2d4a('0x42')]=_[_0x2d4a('0x56')](_0x2d66f2['query']);_0x92842c[_0x2d4a('0x57')]=_[_0x2d4a('0x58')](_0x92842c[_0x2d4a('0x54')],_0x92842c[_0x2d4a('0x42')]);_0x4210d9[_0x2d4a('0x45')]=_['intersection'](_0x92842c['model'],qs[_0x2d4a('0x59')](_0x2d66f2[_0x2d4a('0x42')]['fields']));_0x4210d9[_0x2d4a('0x45')]=_0x4210d9[_0x2d4a('0x45')][_0x2d4a('0x4a')]?_0x4210d9[_0x2d4a('0x45')]:_0x92842c['model'];if(_0x2d66f2[_0x2d4a('0x42')]['includeAll']){_0x4210d9[_0x2d4a('0x44')]=[{'all':!![]}];}_0x4210d9=_[_0x2d4a('0x5a')]({},_0x4210d9,_0x2d66f2[_0x2d4a('0x5b')]);if(!_[_0x2d4a('0x32')](_0x4210d9[_0x2d4a('0x45')],'id')){_0x4210d9[_0x2d4a('0x45')][_0x2d4a('0x46')]('id');}return db[_0x2d4a('0x41')]['find'](_0x4210d9)[_0x2d4a('0x13')](handleEntityNotFound(_0x1325ea,null))[_0x2d4a('0x13')](function(_0x98046f){var _0x67ddff=[];values=_0x98046f;if(_0x2d66f2[_0x2d4a('0x42')][_0x2d4a('0x49')]===_0x2d4a('0x5c')){_0x67ddff[_0x2d4a('0x46')](get_open_tabs(_0x2d4a('0x4b'),_0x98046f[_0x2d4a('0x4c')]));_0x67ddff[_0x2d4a('0x46')](get_open_tabs(_0x2d4a('0x4d'),_0x98046f[_0x2d4a('0x4c')]));_0x67ddff[_0x2d4a('0x46')](get_open_tabs(_0x2d4a('0x50'),_0x98046f[_0x2d4a('0x4c')]));_0x67ddff[_0x2d4a('0x46')](get_open_tabs('whatsapp',_0x98046f[_0x2d4a('0x4c')]));_0x67ddff[_0x2d4a('0x46')](get_open_tabs('fax',_0x98046f[_0x2d4a('0x4c')]));_0x67ddff[_0x2d4a('0x46')](get_open_tabs(_0x2d4a('0x4f'),_0x98046f[_0x2d4a('0x4c')]));return BPromise[_0x2d4a('0x5d')](_0x67ddff);}else{return values;}})[_0x2d4a('0x13')](function(_0x5ac4d1){return values;})[_0x2d4a('0x13')](respondWithResult(_0x1325ea,null))[_0x2d4a('0x1b')](handleError(_0x1325ea,null));};exports[_0x2d4a('0x25')]=function(_0x346f2b,_0x302323){if(_0x346f2b['body']['id']){delete _0x346f2b[_0x2d4a('0x5e')]['id'];}delete _0x346f2b[_0x2d4a('0x5e')]['role'];return db[_0x2d4a('0x41')][_0x2d4a('0x33')]({'where':{'id':_0x346f2b[_0x2d4a('0x53')]['id']}})[_0x2d4a('0x13')](handleEntityNotFound(_0x302323,null))[_0x2d4a('0x13')](saveUpdates(_0x346f2b[_0x2d4a('0x5e')],null))[_0x2d4a('0x13')](respondWithResult(_0x302323,null))[_0x2d4a('0x1b')](handleError(_0x302323,null));};exports[_0x2d4a('0x5f')]=function(_0x282df8,_0x5bbc96){return db[_0x2d4a('0x41')][_0x2d4a('0x5f')]()[_0x2d4a('0x13')](respondWithResult(_0x5bbc96,null))['catch'](handleError(_0x5bbc96,null));};exports[_0x2d4a('0x60')]=function(_0x4082a1,_0x153914){return db[_0x2d4a('0x41')][_0x2d4a('0x33')]({'where':{'id':_0x4082a1[_0x2d4a('0x53')]['id']}})[_0x2d4a('0x13')](handleEntityNotFound(_0x153914,null))[_0x2d4a('0x13')](function(_0x1ed616){if(_0x1ed616){return _0x1ed616['addContacts'](_0x4082a1[_0x2d4a('0x5e')][_0x2d4a('0x61')],_[_0x2d4a('0x62')](_0x4082a1[_0x2d4a('0x5e')],[_0x2d4a('0x61'),'id'])||{});}})[_0x2d4a('0x13')](respondWithResult(_0x153914,null))['catch'](handleError(_0x153914,null));};function validateUser(_0x38e4ae){return new BPromise(function(_0x3a675e,_0x22707f){if(_0x38e4ae['internal'])return _0x3a675e(_0x38e4ae);return db[_0x2d4a('0x63')][_0x2d4a('0x64')](0x1)['then'](function(_0x2b0e4c){if(_0x2b0e4c[_0x2d4a('0x65')])authService['validatePasswordPattern'](_0x38e4ae[_0x2d4a('0x3d')]);db['User']['max'](_0x2d4a('0x66'))[_0x2d4a('0x13')](function(_0x3b5bb9){if(_[_0x2d4a('0x67')](_0x3b5bb9)){_0x38e4ae['internal']=_0x2b0e4c[_0x2d4a('0x68')]||0x1;return;}if(_[_0x2d4a('0x67')](_0x2b0e4c[_0x2d4a('0x68')])||_0x2b0e4c[_0x2d4a('0x68')]===_0x3b5bb9){_0x38e4ae['internal']=_0x3b5bb9+0x1;return;}if(_0x2b0e4c['min_internal']>_0x3b5bb9){_0x38e4ae[_0x2d4a('0x66')]=_0x2b0e4c[_0x2d4a('0x68')];return;}return db[_0x2d4a('0x69')][_0x2d4a('0x42')](_0x2d4a('0x6a'),{'type':db[_0x2d4a('0x69')][_0x2d4a('0x6b')]['SELECT']})[_0x2d4a('0x13')](function(_0x23fdb2){if(_0x23fdb2&&_0x23fdb2[_0x2d4a('0x4a')]){for(var _0x398439=0x0,_0x59810d=_0x23fdb2[_0x2d4a('0x4a')];_0x398439<_0x59810d&&_[_0x2d4a('0x67')](_0x38e4ae[_0x2d4a('0x66')]);_0x398439++){if(_0x2b0e4c[_0x2d4a('0x68')]<=_0x23fdb2[_0x398439]['from']){_0x38e4ae[_0x2d4a('0x66')]=_0x23fdb2[_0x398439][_0x2d4a('0x6c')];}else if(_0x2b0e4c['min_internal']>_0x23fdb2[_0x398439][_0x2d4a('0x6c')]&&_0x2b0e4c[_0x2d4a('0x68')]<=_0x23fdb2[_0x398439]['to']){_0x38e4ae[_0x2d4a('0x66')]=_0x2b0e4c['min_internal'];}}}if(_[_0x2d4a('0x67')](_0x38e4ae[_0x2d4a('0x66')])){_0x38e4ae[_0x2d4a('0x66')]=_0x3b5bb9+0x1;}return _0x3a675e(_0x38e4ae);});});})[_0x2d4a('0x1b')](function(_0x251d40){_0x22707f(_0x251d40);});});}function updateUser(_0xb6c864){return new BPromise(function(_0x3bc965,_0x53dbc0){try{if(_0xb6c864[_0x2d4a('0x6d')]){_0xb6c864[_0x2d4a('0x6e')]=_0xb6c864[_0x2d4a('0x66')];_0xb6c864[_0x2d4a('0x6f')]={'mailbox':_0xb6c864[_0x2d4a('0x66')],'password':_0xb6c864['password'],'fullname':_0xb6c864[_0x2d4a('0x70')],'email':_0xb6c864['email']};}if(_0xb6c864[_0x2d4a('0x28')]===_0x2d4a('0x2c')){if(!_0xb6c864[_0x2d4a('0x71')])_0xb6c864[_0x2d4a('0x71')]=[_0x2d4a('0x72'),_0x2d4a('0x73'),_0x2d4a('0x74'),_0x2d4a('0x75'),_0x2d4a('0x76'),_0x2d4a('0x77'),'105',_0x2d4a('0x78'),'107',_0x2d4a('0x79'),_0x2d4a('0x7a'),_0x2d4a('0x7b'),_0x2d4a('0x7c'),_0x2d4a('0x7d'),_0x2d4a('0x7e')];}_0x3bc965(_0xb6c864);}catch(_0x30b58b){_0x53dbc0(_0x30b58b);}});}exports[_0x2d4a('0x7f')]=function(_0x21633a,_0x51b96b){if(_0x21633a[_0x2d4a('0x80')][_0x2d4a('0x28')]===_0x2d4a('0x2c'))throw new Error(_0x2d4a('0x81'));if(_0x21633a['body'][_0x2d4a('0x28')]===_0x2d4a('0x80')&&_0x21633a[_0x2d4a('0x80')][_0x2d4a('0x28')]!==_0x2d4a('0x29')){throw new Error(_0x2d4a('0x82'));}if(_0x21633a['body'][_0x2d4a('0x28')]===_0x2d4a('0x29')&&_0x21633a['user'][_0x2d4a('0x28')]!==_0x2d4a('0x29')){throw new Error(_0x2d4a('0x83'));}return licenseUtil[_0x2d4a('0x84')]([_0x21633a[_0x2d4a('0x5e')]])[_0x2d4a('0x13')](function(){return validateUser(_0x21633a[_0x2d4a('0x5e')]);})[_0x2d4a('0x13')](function(_0x251d79){return updateUser(_0x251d79)[_0x2d4a('0x13')](function(_0x567ced){if(_0x567ced[_0x2d4a('0x28')]==='admin'){_0x567ced[_0x2d4a('0x85')]=_0x21633a[_0x2d4a('0x80')][_0x2d4a('0x85')];delete _0x567ced[_0x2d4a('0x86')];}return _0x567ced;});})[_0x2d4a('0x13')](function(_0x43155e){return db[_0x2d4a('0x41')]['create'](_0x43155e,{'include':[{'model':db[_0x2d4a('0x6f')],'as':_0x2d4a('0x6f')}]});})[_0x2d4a('0x13')](function(_0xfc7b53){if(_0x21633a[_0x2d4a('0x5e')]['role']==='user')return _0xfc7b53;if(_0x21633a['user'][_0x2d4a('0x28')]!==_0x2d4a('0x80'))return _0xfc7b53;return db[_0x2d4a('0x87')]['find']({'where':{'name':_0xfc7b53[_0x2d4a('0x28')]===_0x2d4a('0x2c')?_0x2d4a('0x2b'):_0x2d4a('0x2d'),'userProfileId':_0x21633a[_0x2d4a('0x80')][_0x2d4a('0x86')]},'raw':!![]})['then'](function(_0x334d5f){if(!_0x334d5f||_0x334d5f['autoAssociation']!=0x0)return _0xfc7b53;return db[_0x2d4a('0x35')][_0x2d4a('0x7f')]({'name':_0xfc7b53['name'],'resourceId':_0xfc7b53['id'],'type':_0x334d5f[_0x2d4a('0x34')],'sectionId':_0x334d5f['id']},{})['then'](function(){return _0xfc7b53;});})['catch'](function(_0x51b845){logger[_0x2d4a('0x17')](_0x2d4a('0x88'),_0x51b845);throw _0x51b845;});})[_0x2d4a('0x13')](respondWithResult(_0x51b96b,0xc9))['catch'](handleError(_0x51b96b,null));};exports[_0x2d4a('0x89')]=function(_0x10bd48,_0x31f3e9){var _0xb0e165=_0x10bd48['body'];var _0x2e4038=[];if(_0x10bd48[_0x2d4a('0x80')]['role']===_0x2d4a('0x2c'))throw new Error(_0x2d4a('0x81'));if(_['some'](_0xb0e165,[_0x2d4a('0x28'),'user'])&&_0x10bd48['user'][_0x2d4a('0x28')]!=='admin'){throw new Error(_0x2d4a('0x82'));}if(_[_0x2d4a('0x8a')](_0xb0e165,[_0x2d4a('0x28'),_0x2d4a('0x29')])&&_0x10bd48['user'][_0x2d4a('0x28')]!=='admin'){throw new Error(_0x2d4a('0x8b'));}return licenseUtil[_0x2d4a('0x84')](_0xb0e165)[_0x2d4a('0x13')](function(){return validateUser(_0xb0e165[0x0]);})[_0x2d4a('0x13')](function(){for(var _0x45f6b7=0x1;_0x45f6b7<_0xb0e165['length'];_0x45f6b7++){var _0x34f0d7=_0xb0e165[_0x45f6b7-0x1][_0x2d4a('0x66')];if(!_0xb0e165[_0x45f6b7][_0x2d4a('0x66')])_0xb0e165[_0x45f6b7]['internal']=_0x34f0d7+0x1;_0x2e4038[_0x2d4a('0x46')](validateUser(_0xb0e165[_0x45f6b7]));}return BPromise['all'](_0x2e4038);})['then'](function(){_0x2e4038=[];for(var _0x393cb9=0x0;_0x393cb9<_0xb0e165[_0x2d4a('0x4a')];_0x393cb9++){_0x2e4038[_0x2d4a('0x46')](updateUser(_0xb0e165[_0x393cb9]));}return BPromise[_0x2d4a('0x5d')](_0x2e4038);})[_0x2d4a('0x13')](function(){return BPromise[_0x2d4a('0x8c')](_0xb0e165,function(_0x2bffb4){return db[_0x2d4a('0x41')][_0x2d4a('0x7f')](_0x2bffb4,{'include':[{'model':db[_0x2d4a('0x6f')],'as':'VoiceMail'}]})[_0x2d4a('0x13')](function(_0x2b29b1){_0x2bffb4['id']=_0x2b29b1['id'];return _0x2bffb4;});});})[_0x2d4a('0x13')](function(_0x10d86c){if(_0x10bd48[_0x2d4a('0x5e')][_0x2d4a('0x28')]===_0x2d4a('0x80'))return _0x10d86c;if(_0x10bd48[_0x2d4a('0x80')]['role']!==_0x2d4a('0x80'))return _0x10d86c;var _0x2c8761=_[_0x2d4a('0x8a')](_0x10d86c,function(_0x5eb662){return _0x5eb662[_0x2d4a('0x28')]==='agent'||_0x5eb662[_0x2d4a('0x28')]===_0x2d4a('0x2e');});if(!_0x2c8761)return _0x10d86c;return db[_0x2d4a('0x87')][_0x2d4a('0x47')]({'where':{'name':{'$or':['Agents',_0x2d4a('0x2d')]},'userProfileId':_0x10bd48['user'][_0x2d4a('0x86')]},'raw':!![]})[_0x2d4a('0x13')](function(_0x9051cd){if(_['isEmpty'](_0x9051cd)||!_[_0x2d4a('0x8a')](_0x9051cd,['autoAssociation',0x0]))return _0x10d86c;_0x2e4038=[];var _0x34707d=_(_0x9051cd)[_0x2d4a('0x30')](function(_0x41b22a){if(_0x41b22a[_0x2d4a('0x8d')]===0x1)return;return _0x41b22a[_0x2d4a('0x34')]===_0x2d4a('0x2b')?_0x2d4a('0x2c'):_0x2d4a('0x2e');})[_0x2d4a('0x8e')]()['value']();for(var _0x4d6beb=0x0;_0x4d6beb<_0x10d86c['length'];_0x4d6beb++){if(!_[_0x2d4a('0x32')](_0x34707d,_0x10d86c[_0x4d6beb]['role']))return;var _0x23b7d=_0x10d86c[_0x4d6beb]['role']===_0x2d4a('0x2c')?_0x2d4a('0x2b'):'Telephones';_0x2e4038['push'](db[_0x2d4a('0x35')]['create']({'name':_0x10d86c[_0x4d6beb][_0x2d4a('0x34')],'resourceId':_0x10d86c[_0x4d6beb]['id'],'type':_0x23b7d,'sectionId':_[_0x2d4a('0x33')](_0x9051cd,[_0x2d4a('0x34'),_0x23b7d])['id']},{}));}return BPromise['all'](_0x2e4038);});})[_0x2d4a('0x13')](respondWithResult(_0x31f3e9,0xc9))[_0x2d4a('0x1b')](handleError(_0x31f3e9,null));};exports[_0x2d4a('0x8f')]=function(_0x2c8acd,_0x1c3c0f){if(_0x2c8acd[_0x2d4a('0x5e')]['id']){delete _0x2c8acd[_0x2d4a('0x5e')]['id'];}return db[_0x2d4a('0x41')][_0x2d4a('0x33')]({'where':{'id':_0x2c8acd[_0x2d4a('0x53')]['id']}})[_0x2d4a('0x13')](function(_0x12a1b7){if(!_0x12a1b7)return null;if(_0x12a1b7['id']===_0x2c8acd['user']['id']){if(!_0x2c8acd[_0x2d4a('0x5e')][_0x2d4a('0x90')]||!_0x2c8acd[_0x2d4a('0x5e')]['newPassword']){throw new db[(_0x2d4a('0x91'))][(_0x2d4a('0x92'))](_0x2d4a('0x93'));}if(!_0x12a1b7[_0x2d4a('0x94')](_0x2c8acd[_0x2d4a('0x5e')]['oldPassword'])){throw new db[(_0x2d4a('0x91'))][(_0x2d4a('0x92'))](_0x2d4a('0x95'));}if(_0x2c8acd[_0x2d4a('0x5e')]['oldPassword']===_0x2c8acd[_0x2d4a('0x5e')][_0x2d4a('0x96')]){throw new db[(_0x2d4a('0x91'))][(_0x2d4a('0x92'))](_0x2d4a('0x97'));}}else if(_0x2c8acd[_0x2d4a('0x80')][_0x2d4a('0x28')]==='admin'){if(!_0x2c8acd[_0x2d4a('0x5e')][_0x2d4a('0x96')]){throw new db[(_0x2d4a('0x91'))][(_0x2d4a('0x92'))](_0x2d4a('0x98'));}}else if(_0x2c8acd[_0x2d4a('0x80')]['role']===_0x2d4a('0x80')){if(!_0x2c8acd[_0x2d4a('0x5e')][_0x2d4a('0x96')]){throw new db[(_0x2d4a('0x91'))][(_0x2d4a('0x92'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x12a1b7['role']!==_0x2d4a('0x2c')){throw new db[(_0x2d4a('0x91'))][(_0x2d4a('0x92'))](_0x2d4a('0x81'));}}else{throw new db[(_0x2d4a('0x91'))][(_0x2d4a('0x92'))](_0x2d4a('0x81'));}return _0x12a1b7;})[_0x2d4a('0x13')](handleEntityNotFound(_0x1c3c0f,null))[_0x2d4a('0x13')](function(_0x5dca40){return db['Setting'][_0x2d4a('0x99')]({'attributes':['id',_0x2d4a('0x65'),_0x2d4a('0x9a'),_0x2d4a('0x9b')]})[_0x2d4a('0x13')](function(_0x4eeba3){if(_0x4eeba3[_0x2d4a('0x65')])authService[_0x2d4a('0x9c')](_0x2c8acd[_0x2d4a('0x5e')][_0x2d4a('0x96')]);if(!_0x4eeba3[_0x2d4a('0x9a')]||!_0x5dca40[_0x2d4a('0x9d')])return _0x5dca40;authService['validatePasswordHistory'](_0x2c8acd['body']['newPassword'],_0x5dca40[_0x2d4a('0x9d')],_0x4eeba3['passwordHistoryLimit']);return _0x5dca40;})['then'](saveUpdates({'password':_0x2c8acd[_0x2d4a('0x5e')][_0x2d4a('0x96')],'passwordResetAt':_0x2c8acd['user']['id']==_0x2c8acd['params']['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x2c8acd[_0x2d4a('0x5e')][_0x2d4a('0x96')],_0x5dca40[_0x2d4a('0x9d')])},null));})[_0x2d4a('0x13')](respondWithResult(_0x1c3c0f,null))[_0x2d4a('0x1b')](handleError(_0x1c3c0f,null));};exports[_0x2d4a('0x9e')]=function(_0xd80165,_0x448664){var _0x23d406=_0xd80165[_0x2d4a('0x5e')]['channel'];return db[_0x2d4a('0x41')][_0x2d4a('0x33')]({'where':{'id':_0xd80165[_0x2d4a('0x53')]['id']},'attributes':['id',_0x2d4a('0x34'),_0x2d4a('0x28'),_0x2d4a('0x9f'),'loginInPause',_0x2d4a('0xa0'),_0x2d4a('0xa1')]})['then'](handleEntityNotFound(_0x448664,null))[_0x2d4a('0x13')](function(_0xe198b){if(_0xe198b){if(!utils['isValidChannel'](_0x23d406)){throw new db['Sequelize']['ValidationError']('Unknown\x20channel');}return _0xe198b[_0x2d4a('0xa2')+_['capitalize'](_0x23d406[_0x2d4a('0xa3')]())+_0x2d4a('0xa4')](_0xd80165[_0x2d4a('0x5e')][_0x2d4a('0x61')],{'penalty':_0xd80165[_0x2d4a('0x5e')][_0x2d4a('0xa5')]||0x0})[_0x2d4a('0xa6')](function(_0x4ceb91){for(var _0x8749ac=0x0;_0x8749ac<_0xd80165['body'][_0x2d4a('0x61')][_0x2d4a('0x4a')];_0x8749ac+=0x1){var _0x137c57={'UserId':Number(_0xd80165[_0x2d4a('0x53')]['id'])};_0x137c57[_[_0x2d4a('0xa7')](_0x23d406[_0x2d4a('0xa3')]())+_0x2d4a('0xa8')]=Number(_0xd80165['body'][_0x2d4a('0x61')][_0x8749ac]);socket['emit'](_0x2d4a('0x80')+_[_0x2d4a('0xa7')](_0x23d406[_0x2d4a('0xa3')]())+'Queue:save',_0x137c57);}return _0x4ceb91;})[_0x2d4a('0x13')](function(){if(_0x23d406===_0x2d4a('0xa9')){return db[_0x2d4a('0xaa')][_0x2d4a('0x47')]({'where':{'id':_0xd80165[_0x2d4a('0x5e')][_0x2d4a('0x61')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x2d4a('0x13')](function(_0x58dd6b){var _0x147c1b=_0xe198b['get']({'plain':!![]});var _0x4ac327=[];if(_0x23d406===_0x2d4a('0xa9')&&_0x147c1b['role']==='agent'&&_0x147c1b[_0x2d4a('0x9f')]){for(var _0x206717=0x0;_0x206717<_0x58dd6b[_0x2d4a('0x4a')];_0x206717+=0x1){_0x4ac327[_0x2d4a('0x46')]({'membername':_0x147c1b[_0x2d4a('0x34')],'UserId':_0x147c1b['id'],'queue_name':_0x58dd6b[_0x206717][_0x2d4a('0x34')],'VoiceQueueId':_0x58dd6b[_0x206717]['id'],'interface':_[_0x2d4a('0x67')](_0x147c1b['interface'])?util['format'](_0x2d4a('0xab'),_0x147c1b[_0x2d4a('0x34')]):_0x147c1b[_0x2d4a('0xa1')],'paused':_0x147c1b[_0x2d4a('0xa0')]||![],'penalty':_0xd80165[_0x2d4a('0x5e')][_0x2d4a('0xa5')]||0x0});}return BPromise[_0x2d4a('0x8c')](_0x4ac327,function(_0x598603){return db[_0x2d4a('0xac')][_0x2d4a('0xad')](_0x598603);});}return _0xe198b;});}})['then'](respondWithStatusCode(_0x448664,null))[_0x2d4a('0x1b')](handleError(_0x448664,null));};exports['removeQueues']=function(_0xc163c0,_0x3dae40){var _0x1f5f6e;return db['User'][_0x2d4a('0x33')]({'where':{'id':_0xc163c0['params']['id']},'attributes':['id','name',_0x2d4a('0x28')]})[_0x2d4a('0x13')](handleEntityNotFound(_0x3dae40,null))[_0x2d4a('0x13')](function(_0x5ce2dc){if(_0x5ce2dc){_0x1f5f6e=_0x5ce2dc;if(!_0xc163c0[_0x2d4a('0x42')]['channel']||!utils[_0x2d4a('0xae')](_0xc163c0[_0x2d4a('0x42')]['channel'])){throw new db[(_0x2d4a('0x91'))][(_0x2d4a('0x92'))](_0x2d4a('0xaf'));}return _0x5ce2dc[_0x2d4a('0xb0')+_[_0x2d4a('0xa7')](_0xc163c0[_0x2d4a('0x42')][_0x2d4a('0xb1')]['toLowerCase']())+_0x2d4a('0xa4')](_0xc163c0[_0x2d4a('0x42')][_0x2d4a('0x61')]);}})[_0x2d4a('0x13')](function(_0x120aa5){if(_[_0x2d4a('0xb2')](_0xc163c0['query']['ids'])){for(var _0x1038e0=0x0;_0x1038e0<_0xc163c0[_0x2d4a('0x42')][_0x2d4a('0x61')][_0x2d4a('0x4a')];_0x1038e0+=0x1){var _0xf539d4={'UserId':Number(_0xc163c0[_0x2d4a('0x53')]['id'])};_0xf539d4[_[_0x2d4a('0xa7')](_0xc163c0[_0x2d4a('0x42')]['channel'][_0x2d4a('0xa3')]())+_0x2d4a('0xa8')]=Number(_0xc163c0['query']['ids'][_0x1038e0]);socket[_0x2d4a('0xb3')](_0x2d4a('0x80')+_[_0x2d4a('0xa7')](_0xc163c0['query'][_0x2d4a('0xb1')][_0x2d4a('0xa3')]())+'Queue:remove',_0xf539d4);}}else{var _0xf539d4={'UserId':Number(_0xc163c0[_0x2d4a('0x53')]['id'])};_0xf539d4[_[_0x2d4a('0xa7')](_0xc163c0[_0x2d4a('0x42')][_0x2d4a('0xb1')]['toLowerCase']())+'QueueId']=Number(_0xc163c0[_0x2d4a('0x42')]['ids']);socket[_0x2d4a('0xb3')](_0x2d4a('0x80')+_[_0x2d4a('0xa7')](_0xc163c0['query'][_0x2d4a('0xb1')][_0x2d4a('0xa3')]())+_0x2d4a('0xb4'),_0xf539d4);}return _0x120aa5;})[_0x2d4a('0x13')](function(){if(_0xc163c0[_0x2d4a('0x42')][_0x2d4a('0xb1')]===_0x2d4a('0xa9')){return db[_0x2d4a('0xac')]['destroy']({'where':{'UserId':_0xc163c0['params']['id'],'VoiceQueueId':_0xc163c0['query'][_0x2d4a('0x61')]},'individualHooks':!![]})[_0x2d4a('0x13')](function(){return _0x1f5f6e;});}return _0x1f5f6e;})[_0x2d4a('0x13')](respondWithStatusCode(_0x3dae40,null))['catch'](handleError(_0x3dae40,null));};exports[_0x2d4a('0xb5')]=function(_0x5bd543,_0x39d12c){_0x5bd543[_0x2d4a('0x5e')][_0x2d4a('0xb6')]=_0x5bd543[_0x2d4a('0xb7')][_0x2d4a('0xb8')];return db[_0x2d4a('0x41')][_0x2d4a('0x33')]({'where':{'id':_0x5bd543['params']['id']}})[_0x2d4a('0x13')](handleEntityNotFound(_0x39d12c,null))[_0x2d4a('0x13')](saveUpdates(_0x5bd543[_0x2d4a('0x5e')],null))['then'](respondWithResult(_0x39d12c,null))['catch'](handleError(_0x39d12c,null));};exports[_0x2d4a('0xb9')]=function(_0x567f14,_0x50795a){var _0x53c863=path[_0x2d4a('0xba')](config['root'],_0x2d4a('0xbb'));return db['User'][_0x2d4a('0x33')]({'where':{'id':_0x567f14['params']['id']},'attributes':['id',_0x2d4a('0xb6')],'raw':!![]})['then'](handleEntityNotFound(_0x50795a,null))[_0x2d4a('0x13')](function(_0x6159e6){if(_0x6159e6){if(_['isNil'](_0x6159e6[_0x2d4a('0xb6')])){return _0x50795a[_0x2d4a('0xbc')](_0x53c863);}else{if(!fs[_0x2d4a('0xbd')](path['join'](config['root'],_0x2d4a('0xbe'),_0x6159e6[_0x2d4a('0xb6')]))){return _0x50795a[_0x2d4a('0xbc')](_0x53c863);}return _0x50795a[_0x2d4a('0xbc')](path[_0x2d4a('0xba')](config[_0x2d4a('0xbf')],_0x2d4a('0xbe'),_0x6159e6[_0x2d4a('0xb6')]));}}})[_0x2d4a('0x1b')](handleError(_0x50795a,null));};exports[_0x2d4a('0xc0')]=function(_0xc26e41,_0x2780e4){return db[_0x2d4a('0x41')][_0x2d4a('0x33')]({'where':{'id':_0xc26e41['params']['id']},'attributes':['id']})[_0x2d4a('0x13')](handleEntityNotFound(_0x2780e4,null))[_0x2d4a('0x13')](function(_0x35e1fe){var _0x10ebfa=[];values=_0x35e1fe[_0x2d4a('0x4c')];_0x10ebfa['push'](get_open_tabs(_0x2d4a('0x4b'),_0x35e1fe[_0x2d4a('0x4c')]));_0x10ebfa['push'](get_open_tabs('sms',_0x35e1fe[_0x2d4a('0x4c')]));_0x10ebfa[_0x2d4a('0x46')](get_open_tabs(_0x2d4a('0x50'),_0x35e1fe[_0x2d4a('0x4c')]));_0x10ebfa[_0x2d4a('0x46')](get_open_tabs('whatsapp',_0x35e1fe[_0x2d4a('0x4c')]));_0x10ebfa[_0x2d4a('0x46')](get_open_tabs(_0x2d4a('0x4e'),_0x35e1fe['dataValues']));_0x10ebfa[_0x2d4a('0x46')](get_open_tabs(_0x2d4a('0x4f'),_0x35e1fe[_0x2d4a('0x4c')]));return BPromise[_0x2d4a('0x5d')](_0x10ebfa);})[_0x2d4a('0x13')](function(_0x495640){var _0x34d6d3=[];if(_0x495640){for(var _0x9028f8=0x0;_0x9028f8=_0x51ea65[_0x75a4('0x50')]){throw new Error(_0x75a4('0x51'));}})[_0x75a4('0x22')](function(){if(_0x3d8153){return db['UserVoiceQueueRt'][_0x75a4('0x46')]({'where':{'membername':_0x3d8153[_0x75a4('0x27')]},'individualHooks':!![]});}})[_0x75a4('0x22')](function(){if(_0x3d8153){return _0x3d8153[_0x75a4('0x52')]({'raw':!![]});}})[_0x75a4('0x22')](function(_0x2d1df1){if(_0x3d8153){if(_0x2d1df1){var _0x45dd67=[];_0x588e9b=_0x2d1df1;if(_0x588e9b[_0x75a4('0x2f')]){for(var _0x15f0ea=0x0;_0x15f0ea<_0x588e9b[_0x75a4('0x2f')];_0x15f0ea++){_0x45dd67[_0x75a4('0x33')](db[_0x75a4('0x2b')]['upsert']({'membername':_0x3d8153['name'],'UserId':_0x3d8153['id'],'queue_name':_0x588e9b[_0x15f0ea][_0x75a4('0x27')],'VoiceQueueId':_0x588e9b[_0x15f0ea]['id'],'interface':_0x349e97,'paused':_0x3d8153[_0x75a4('0x4b')]||![],'penalty':_0x588e9b[_0x15f0ea]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x75a4('0x47')](_0x45dd67);}}}})['then'](function(){if(_0x3d8153){return db[_0x75a4('0x2d')][_0x75a4('0x1a')]({'where':{'membername':_0x3d8153[_0x75a4('0x27')],'exitAt':null}});}})[_0x75a4('0x22')](function(_0x26f1ea){if(_0x3d8153){if(_0x26f1ea&&_0x26f1ea[_0x75a4('0x2f')]){var _0x4d01a4=[];_0x26f1ea[_0x75a4('0x32')](function(_0x365d92){_0x4d01a4[_0x75a4('0x33')](_0x365d92[_0x75a4('0x2c')]({'exitAt':moment()[_0x75a4('0x35')](_0x75a4('0x30'))}));});return BPromise['all'](_0x4d01a4);}}})[_0x75a4('0x22')](function(_0x4582eb){if(_0x3d8153){var _0x1fed8d=[];var _0x3a1bca=[];var _0x7eb5a8=utils[_0x75a4('0x53')]();var _0x13938e={'membername':_0x3d8153[_0x75a4('0x27')],'interface':_0x349e97,'enterAt':moment()[_0x75a4('0x35')](_0x75a4('0x30')),'role':_0x3d8153[_0x75a4('0x28')],'internal':_0x3d8153[_0x75a4('0x29')]};_0x7eb5a8[_0x75a4('0x32')](function(_0x4b817b){_0x1fed8d[_0x75a4('0x33')](_[_0x75a4('0x54')]({'channel':_0x4b817b,'type':_0x75a4('0x55'),'data1':'callysquare','data2':_0x349e97},_0x13938e));if(_0x3d8153['loginInPause']){_0x3a1bca['push'](_[_0x75a4('0x54')]({'channel':_0x4b817b,'type':_0x75a4('0x2e'),'data1':_0x75a4('0x56')},_0x13938e));}});return db[_0x75a4('0x2d')][_0x75a4('0x3a')](_0x1fed8d[_0x75a4('0x57')](_0x3a1bca),{'individualHooks':!![]});}})[_0x75a4('0x22')](function(){if(_0x3d8153){return _0x3d8153['update']({'online':!![],'lastLoginAt':moment()[_0x75a4('0x35')](_0x75a4('0x30')),'voicePause':_0x3d8153[_0x75a4('0x4b')]||![],'mailPause':_0x3d8153[_0x75a4('0x4b')]||![],'chatPause':_0x3d8153['loginInPause']||![],'faxPause':_0x3d8153[_0x75a4('0x4b')]||![],'smsPause':_0x3d8153[_0x75a4('0x4b')]||![],'openchannelPause':_0x3d8153[_0x75a4('0x4b')]||![],'pauseType':_0x3d8153[_0x75a4('0x4b')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x75a4('0x35')](_0x75a4('0x30')),'interface':_0x349e97});}})[_0x75a4('0x22')](function(_0x910908){_0x5262f2(_0x910908);})[_0x75a4('0x17')](function(_0x493810){_0x57b140(_0x61a1bb[_0x75a4('0x14')](0x1f4,_0x493810[_0x75a4('0x15')]));});});}; \ No newline at end of file +var _0x4b19=['then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetUser','User','findAll','raw','options','include','map','model','attributes','ShowUser','where','find','name','internal','interface','UserVoiceQueueRt','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','getChannels','forEach','push','isNil','body','type','DEFAULT\x20PAUSE','role','MemberReport','bulkCreate','update','UnpauseUser','findOne','isValidChannel','channel','Unknown\x20channel','system','chat','fax','sms','openchannel','whatsapp','set','%s%s','Pause','all','destroy','SIP/%s','count','agent','agents','getVoiceQueues','upsert','loginInPause','UserVoiceQueue.penalty','LOGIN','callysquare','LOGININPAUSE','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./user.socket','register'];(function(_0x5c3398,_0x500ece){var _0x17a38c=function(_0x1370c4){while(--_0x1370c4){_0x5c3398['push'](_0x5c3398['shift']());}};_0x17a38c(++_0x500ece);}(_0x4b19,0x9b));var _0x94b1=function(_0x5b6551,_0x53ab5c){_0x5b6551=_0x5b6551-0x0;var _0x55029c=_0x4b19[_0x5b6551];return _0x55029c;};'use strict';var _=require(_0x94b1('0x0'));var util=require('util');var moment=require(_0x94b1('0x1'));var BPromise=require(_0x94b1('0x2'));var rs=require(_0x94b1('0x3'));var fs=require('fs');var Redis=require(_0x94b1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x94b1('0x5'));var logger=require(_0x94b1('0x6'))(_0x94b1('0x7'));var config=require(_0x94b1('0x8'));var jayson=require(_0x94b1('0x9'));var client=jayson[_0x94b1('0xa')][_0x94b1('0xb')]({'port':0x232a});config[_0x94b1('0xc')]=_['defaults'](config['redis'],{'host':_0x94b1('0xd'),'port':0x18eb});var socket=require(_0x94b1('0xe'))(new Redis(config[_0x94b1('0xc')]));require(_0x94b1('0xf'))[_0x94b1('0x10')](socket);function respondWithRpcPromise(_0x356bd4,_0x2988ad,_0x14dd20){return new BPromise(function(_0x3fd533,_0x44fd10){return client['request'](_0x356bd4,_0x14dd20)[_0x94b1('0x11')](function(_0x5912a3){logger[_0x94b1('0x12')](_0x94b1('0x13'),_0x2988ad,_0x94b1('0x14'));logger[_0x94b1('0x15')](_0x94b1('0x16'),_0x2988ad,'request\x20sent',JSON[_0x94b1('0x17')](_0x5912a3));if(_0x5912a3['error']){if(_0x5912a3['error']['code']===0x1f4){logger[_0x94b1('0x18')](_0x94b1('0x13'),_0x2988ad,_0x5912a3[_0x94b1('0x18')][_0x94b1('0x19')]);return _0x44fd10(_0x5912a3[_0x94b1('0x18')][_0x94b1('0x19')]);}logger['error'](_0x94b1('0x13'),_0x2988ad,_0x5912a3[_0x94b1('0x18')][_0x94b1('0x19')]);return _0x3fd533(_0x5912a3['error'][_0x94b1('0x19')]);}else{logger['info'](_0x94b1('0x13'),_0x2988ad,_0x94b1('0x14'));_0x3fd533(_0x5912a3[_0x94b1('0x1a')][_0x94b1('0x19')]);}})[_0x94b1('0x1b')](function(_0x1af23f){logger[_0x94b1('0x18')](_0x94b1('0x13'),_0x2988ad,_0x1af23f);_0x44fd10(_0x1af23f);});});}exports[_0x94b1('0x1c')]=function(_0x1b9b65){var _0x27c1df=this;return new Promise(function(_0x58836d,_0xd3c19){return db[_0x94b1('0x1d')][_0x94b1('0x1e')]({'raw':_0x1b9b65['options']?_0x1b9b65['options'][_0x94b1('0x1f')]===undefined?!![]:![]:!![],'where':_0x1b9b65[_0x94b1('0x20')]?_0x1b9b65[_0x94b1('0x20')]['where']||null:null,'attributes':_0x1b9b65[_0x94b1('0x20')]?_0x1b9b65[_0x94b1('0x20')]['attributes']||null:null,'limit':_0x1b9b65[_0x94b1('0x20')]?_0x1b9b65[_0x94b1('0x20')]['limit']||null:null,'include':_0x1b9b65['options']?_0x1b9b65[_0x94b1('0x20')][_0x94b1('0x21')]?_[_0x94b1('0x22')](_0x1b9b65['options'][_0x94b1('0x21')],function(_0xc9fd1){return{'model':db[_0xc9fd1[_0x94b1('0x23')]],'as':_0xc9fd1['as'],'attributes':_0xc9fd1[_0x94b1('0x24')],'include':_0xc9fd1[_0x94b1('0x21')]?_[_0x94b1('0x22')](_0xc9fd1['include'],function(_0x366f77){return{'model':db[_0x366f77[_0x94b1('0x23')]],'as':_0x366f77['as'],'attributes':_0x366f77[_0x94b1('0x24')],'include':_0x366f77['include']?_[_0x94b1('0x22')](_0x366f77[_0x94b1('0x21')],function(_0x2ccb70){return{'model':db[_0x2ccb70[_0x94b1('0x23')]],'as':_0x2ccb70['as'],'attributes':_0x2ccb70[_0x94b1('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x324cf4){logger[_0x94b1('0x12')]('GetUser',_0x1b9b65);logger[_0x94b1('0x15')](_0x94b1('0x1c'),_0x1b9b65,JSON[_0x94b1('0x17')](_0x324cf4));_0x58836d(_0x324cf4);})[_0x94b1('0x1b')](function(_0x948eaa){logger['error']('GetUser',_0x948eaa['message'],_0x1b9b65);_0xd3c19(_0x27c1df[_0x94b1('0x18')](0x1f4,_0x948eaa['message']));});});};exports[_0x94b1('0x25')]=function(_0x162b03){var _0x3dcd8d=this;return new Promise(function(_0x3316fa,_0x50a453){return db[_0x94b1('0x1d')]['find']({'raw':_0x162b03[_0x94b1('0x20')]?_0x162b03[_0x94b1('0x20')][_0x94b1('0x1f')]===undefined?!![]:![]:!![],'where':_0x162b03[_0x94b1('0x20')]?_0x162b03[_0x94b1('0x20')][_0x94b1('0x26')]||null:null,'attributes':_0x162b03[_0x94b1('0x20')]?_0x162b03['options']['attributes']||null:null,'include':_0x162b03[_0x94b1('0x20')]?_0x162b03[_0x94b1('0x20')]['include']?_[_0x94b1('0x22')](_0x162b03['options'][_0x94b1('0x21')],function(_0x27f0aa){return{'model':db[_0x27f0aa[_0x94b1('0x23')]],'as':_0x27f0aa['as'],'attributes':_0x27f0aa['attributes'],'include':_0x27f0aa[_0x94b1('0x21')]?_[_0x94b1('0x22')](_0x27f0aa['include'],function(_0x49868a){return{'model':db[_0x49868a[_0x94b1('0x23')]],'as':_0x49868a['as'],'attributes':_0x49868a[_0x94b1('0x24')],'include':_0x49868a['include']?_['map'](_0x49868a[_0x94b1('0x21')],function(_0x3394f2){return{'model':db[_0x3394f2['model']],'as':_0x3394f2['as'],'attributes':_0x3394f2['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4fc8a5){logger[_0x94b1('0x12')](_0x94b1('0x25'),_0x162b03);logger[_0x94b1('0x15')](_0x94b1('0x25'),_0x162b03,JSON[_0x94b1('0x17')](_0x4fc8a5));_0x3316fa(_0x4fc8a5);})['catch'](function(_0x580837){logger[_0x94b1('0x18')]('ShowUser',_0x580837[_0x94b1('0x19')],_0x162b03);_0x50a453(_0x3dcd8d[_0x94b1('0x18')](0x1f4,_0x580837[_0x94b1('0x19')]));});});};exports['PauseUser']=function(_0xa08f2c){var _0x50a7dd=this;return new Promise(function(_0x35c5f6,_0x855374){var _0x2b4a13;return db[_0x94b1('0x1d')][_0x94b1('0x27')]({'where':_0xa08f2c[_0x94b1('0x20')][_0x94b1('0x26')]||{},'attributes':['id',_0x94b1('0x28'),'role',_0x94b1('0x29'),_0x94b1('0x2a')]})['then'](function(_0x2e03f6){if(_0x2e03f6){_0x2b4a13=_0x2e03f6;return db[_0x94b1('0x2b')]['update']({'paused':0x1},{'where':{'UserId':_0x2b4a13['id']},'individualHooks':!![]});}})[_0x94b1('0x11')](function(){if(_0x2b4a13){return db['MemberReport'][_0x94b1('0x1e')]({'where':{'membername':_0x2b4a13['name'],'type':_0x94b1('0x2c'),'exitAt':null}});}})[_0x94b1('0x11')](function(_0x46cc13){if(_0x2b4a13){if(_0x46cc13&&_0x46cc13[_0x94b1('0x2d')]){var _0x5e55ec=moment()[_0x94b1('0x2e')](_0x94b1('0x2f'));for(var _0x2a1372=0x0,_0x2da9e7=_0x46cc13['length'];_0x2a1372<_0x2da9e7;_0x2a1372++){_0x46cc13[_0x2a1372]['updateAttributes']({'exitAt':_0x5e55ec});}}}})[_0x94b1('0x11')](function(){if(_0x2b4a13){var _0x7ca197=[];var _0x255345=utils[_0x94b1('0x30')]();_0x255345[_0x94b1('0x31')](function(_0x33ed4f){_0x7ca197[_0x94b1('0x32')]({'channel':_0x33ed4f,'membername':_0x2b4a13[_0x94b1('0x28')],'interface':_[_0x94b1('0x33')](_0x2b4a13[_0x94b1('0x2a')])?util[_0x94b1('0x2e')]('SIP/%s',_0x2b4a13['name']):_0x2b4a13[_0x94b1('0x2a')],'type':_0x94b1('0x2c'),'enterAt':moment()[_0x94b1('0x2e')](_0x94b1('0x2f')),'data1':_0xa08f2c[_0x94b1('0x34')][_0x94b1('0x35')]||_0x94b1('0x36'),'role':_0x2b4a13[_0x94b1('0x37')],'internal':_0x2b4a13['internal'],'uniqueid':_0xa08f2c['body']['uniqueid']||null});});return db[_0x94b1('0x38')][_0x94b1('0x39')](_0x7ca197,{'individualHooks':!![]});}})[_0x94b1('0x11')](function(){if(_0x2b4a13){return _0x2b4a13[_0x94b1('0x3a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0xa08f2c[_0x94b1('0x34')]['type']||_0x94b1('0x36'),'lastPauseAt':moment()[_0x94b1('0x2e')](_0x94b1('0x2f'))});}})[_0x94b1('0x11')](function(_0x2e74fd){_0x35c5f6(_0x2e74fd);})[_0x94b1('0x1b')](function(_0x590a2d){_0x855374(_0x50a7dd[_0x94b1('0x18')](0x1f4,_0x590a2d[_0x94b1('0x19')]));});});};exports[_0x94b1('0x3b')]=function(_0x211c6a){var _0x1de096=this;return new Promise(function(_0x121430,_0x5950d5){var _0xeef9f2;return db[_0x94b1('0x1d')][_0x94b1('0x3c')]({'where':_0x211c6a[_0x94b1('0x20')][_0x94b1('0x26')]||{},'attributes':['id','name']})[_0x94b1('0x11')](function(_0x52017f){if(_0x52017f){_0xeef9f2=_0x52017f;if(_0x211c6a[_0x94b1('0x34')]['channel']&&!utils[_0x94b1('0x3d')](_0x211c6a['body'][_0x94b1('0x3e')])){throw new Error(_0x94b1('0x3f'));}switch(_0x211c6a[_0x94b1('0x34')][_0x94b1('0x3e')]){case'voice':return db[_0x94b1('0x2b')][_0x94b1('0x3a')]({'paused':0x0},{'where':{'UserId':_0xeef9f2['id']}})[_0x94b1('0x11')](function(){return db[_0x94b1('0x38')][_0x94b1('0x27')]({'where':{'channel':_0x211c6a[_0x94b1('0x34')][_0x94b1('0x3e')],'membername':_0xeef9f2[_0x94b1('0x28')],'type':'PAUSE','exitAt':null}});})[_0x94b1('0x11')](function(_0x4eabb3){if(_0x4eabb3){return _0x4eabb3['update']({'exitAt':moment()[_0x94b1('0x2e')](_0x94b1('0x2f')),'data2':_0x94b1('0x40')},{'individualHooks':!![]});}return null;})['then'](function(){return _0xeef9f2[_0x94b1('0x3a')]({'voicePause':![]});});case'mail':case _0x94b1('0x41'):case _0x94b1('0x42'):case _0x94b1('0x43'):case _0x94b1('0x44'):case _0x94b1('0x45'):return db[_0x94b1('0x38')][_0x94b1('0x27')]({'where':{'channel':_0x211c6a[_0x94b1('0x34')][_0x94b1('0x3e')],'membername':_0xeef9f2['name'],'type':'PAUSE','exitAt':null}})[_0x94b1('0x11')](function(_0x24a2d0){return _0x24a2d0['update']({'exitAt':moment()[_0x94b1('0x2e')](_0x94b1('0x2f')),'data2':'system'},{'individualHooks':!![]});})['then'](function(){var _0x2b82e4={};_[_0x94b1('0x46')](_0x2b82e4,util[_0x94b1('0x2e')](_0x94b1('0x47'),_0x211c6a['body'][_0x94b1('0x3e')],_0x94b1('0x48')),![]);return _0xeef9f2['update'](_0x2b82e4);});default:return db[_0x94b1('0x2b')][_0x94b1('0x3a')]({'paused':0x0},{'where':{'UserId':_0xeef9f2['id']}})[_0x94b1('0x11')](function(){return db[_0x94b1('0x38')][_0x94b1('0x1e')]({'where':{'membername':_0xeef9f2[_0x94b1('0x28')],'type':_0x94b1('0x2c'),'exitAt':null}});})['then'](function(_0x3900e6){var _0x441fa7=[];_0x3900e6[_0x94b1('0x31')](function(_0x2f0e44){_0x441fa7[_0x94b1('0x32')](_0x2f0e44['update']({'exitAt':moment()[_0x94b1('0x2e')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x94b1('0x40')}));});return BPromise[_0x94b1('0x49')](_0x441fa7);})[_0x94b1('0x11')](function(){return _0xeef9f2[_0x94b1('0x3a')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0x94b1('0x11')](function(_0x323433){_0x121430(_0x323433);})[_0x94b1('0x1b')](function(_0x50c008){_0x5950d5(_0x1de096[_0x94b1('0x18')](0x1f4,_0x50c008['message']));});});};exports['LogoutUser']=function(_0x1da9d3){var _0x56d15d=this;return new Promise(function(_0x384cda,_0x2d38cd){var _0x8029b2;return db[_0x94b1('0x1d')][_0x94b1('0x3c')]({'where':_0x1da9d3['options'][_0x94b1('0x26')]||{},'attributes':['id','name']})['then'](function(_0x4abbdd){if(_0x4abbdd){_0x8029b2=_0x4abbdd;return db[_0x94b1('0x2b')][_0x94b1('0x4a')]({'where':{'membername':_0x8029b2[_0x94b1('0x28')]},'individualHooks':!![]});}})[_0x94b1('0x11')](function(){if(_0x8029b2){return db[_0x94b1('0x38')][_0x94b1('0x1e')]({'where':{'membername':_0x8029b2[_0x94b1('0x28')],'exitAt':null}});}})[_0x94b1('0x11')](function(_0xa0affe){if(_0x8029b2){if(_0xa0affe&&_0xa0affe[_0x94b1('0x2d')]){var _0x414995=[];_0xa0affe[_0x94b1('0x31')](function(_0x9ee976){_0x414995[_0x94b1('0x32')](_0x9ee976['update']({'exitAt':moment()['format'](_0x94b1('0x2f'))}));});return BPromise['all'](_0x414995);}}})[_0x94b1('0x11')](function(){if(_0x8029b2){return _0x8029b2[_0x94b1('0x3a')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x94b1('0x11')](function(_0x42d433){_0x384cda(_0x42d433);})[_0x94b1('0x1b')](function(_0x2bc425){_0x2d38cd(_0x56d15d['error'](0x1f4,_0x2bc425['message']));});});};exports['LoginUser']=function(_0x59d06d){var _0x3056c6=this;return new Promise(function(_0x5dd4dc,_0x47a880){var _0x1d11f3;var _0x108fef;var _0x5b6345;var _0xdb28c5;return db[_0x94b1('0x1d')][_0x94b1('0x3c')]({'where':_0x59d06d[_0x94b1('0x20')][_0x94b1('0x26')]||{},'attributes':['id',_0x94b1('0x28'),_0x94b1('0x37'),'mobile','phone',_0x94b1('0x29'),'loginInPause',_0x94b1('0x2a')]})['then'](function(_0x1025dd){if(_0x1025dd){_0x1d11f3=_0x1025dd;_0xdb28c5=_0x59d06d[_0x94b1('0x34')]['interface']?_0x59d06d[_0x94b1('0x34')][_0x94b1('0x2a')]:util[_0x94b1('0x2e')](_0x94b1('0x4b'),_0x1d11f3[_0x94b1('0x28')]);return db[_0x94b1('0x1d')][_0x94b1('0x4c')]({'where':{'role':_0x94b1('0x4d'),'online':!![],'id':{'$ne':_0x1d11f3['id']}}});}})['then'](function(_0x54dbeb){if(_0x54dbeb){_0x5b6345=_0x54dbeb;return require('../../config/license/util')['getLicense']();}})[_0x94b1('0x11')](function(_0xbd0f1c){if(_0xbd0f1c&&_0xbd0f1c[_0x94b1('0x4e')]&&_0x5b6345>=_0xbd0f1c['agents']){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x94b1('0x11')](function(){if(_0x1d11f3){return db[_0x94b1('0x2b')][_0x94b1('0x4a')]({'where':{'membername':_0x1d11f3[_0x94b1('0x28')]},'individualHooks':!![]});}})[_0x94b1('0x11')](function(){if(_0x1d11f3){return _0x1d11f3[_0x94b1('0x4f')]({'raw':!![]});}})[_0x94b1('0x11')](function(_0x7178e6){if(_0x1d11f3){if(_0x7178e6){var _0x10f65f=[];_0x108fef=_0x7178e6;if(_0x108fef[_0x94b1('0x2d')]){for(var _0x5cecee=0x0;_0x5cecee<_0x108fef[_0x94b1('0x2d')];_0x5cecee++){_0x10f65f['push'](db[_0x94b1('0x2b')][_0x94b1('0x50')]({'membername':_0x1d11f3[_0x94b1('0x28')],'UserId':_0x1d11f3['id'],'queue_name':_0x108fef[_0x5cecee][_0x94b1('0x28')],'VoiceQueueId':_0x108fef[_0x5cecee]['id'],'interface':_0xdb28c5,'paused':_0x1d11f3[_0x94b1('0x51')]||![],'penalty':_0x108fef[_0x5cecee][_0x94b1('0x52')]||0x0}));}return BPromise['all'](_0x10f65f);}}}})[_0x94b1('0x11')](function(){if(_0x1d11f3){return db[_0x94b1('0x38')][_0x94b1('0x1e')]({'where':{'membername':_0x1d11f3['name'],'exitAt':null}});}})['then'](function(_0x3a46fe){if(_0x1d11f3){if(_0x3a46fe&&_0x3a46fe[_0x94b1('0x2d')]){var _0x3568f8=[];_0x3a46fe[_0x94b1('0x31')](function(_0x9cd174){_0x3568f8[_0x94b1('0x32')](_0x9cd174['update']({'exitAt':moment()[_0x94b1('0x2e')](_0x94b1('0x2f'))}));});return BPromise[_0x94b1('0x49')](_0x3568f8);}}})['then'](function(_0x4e886b){if(_0x1d11f3){var _0x357374=[];var _0x5df07e=[];var _0x3335f1=utils['getChannels']();var _0xb1b78f={'membername':_0x1d11f3[_0x94b1('0x28')],'interface':_0xdb28c5,'enterAt':moment()[_0x94b1('0x2e')](_0x94b1('0x2f')),'role':_0x1d11f3[_0x94b1('0x37')],'internal':_0x1d11f3['internal']};_0x3335f1['forEach'](function(_0x310093){_0x357374[_0x94b1('0x32')](_['merge']({'channel':_0x310093,'type':_0x94b1('0x53'),'data1':_0x94b1('0x54'),'data2':_0xdb28c5},_0xb1b78f));if(_0x1d11f3[_0x94b1('0x51')]){_0x5df07e['push'](_['merge']({'channel':_0x310093,'type':'PAUSE','data1':_0x94b1('0x55')},_0xb1b78f));}});return db[_0x94b1('0x38')][_0x94b1('0x39')](_0x357374['concat'](_0x5df07e),{'individualHooks':!![]});}})['then'](function(){if(_0x1d11f3){return _0x1d11f3['update']({'online':!![],'lastLoginAt':moment()[_0x94b1('0x2e')](_0x94b1('0x2f')),'voicePause':_0x1d11f3['loginInPause']||![],'mailPause':_0x1d11f3[_0x94b1('0x51')]||![],'chatPause':_0x1d11f3[_0x94b1('0x51')]||![],'faxPause':_0x1d11f3['loginInPause']||![],'smsPause':_0x1d11f3[_0x94b1('0x51')]||![],'openchannelPause':_0x1d11f3['loginInPause']||![],'pauseType':_0x1d11f3[_0x94b1('0x51')]?_0x94b1('0x55'):null,'lastPauseAt':moment()[_0x94b1('0x2e')](_0x94b1('0x2f')),'interface':_0xdb28c5});}})['then'](function(_0x3b3de1){_0x5dd4dc(_0x3b3de1);})[_0x94b1('0x1b')](function(_0x602b06){_0x47a880(_0x3056c6[_0x94b1('0x18')](0x1f4,_0x602b06['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index ef55dac..320d0ce 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 _0x8fb3=['./user.events','save','remove','update','register','length','user:'];(function(_0x24795e,_0x886b65){var _0x3981b0=function(_0x2cd7ce){while(--_0x2cd7ce){_0x24795e['push'](_0x24795e['shift']());}};_0x3981b0(++_0x886b65);}(_0x8fb3,0x103));var _0x38fb=function(_0x9411f4,_0x1714d0){_0x9411f4=_0x9411f4-0x0;var _0x3304ea=_0x8fb3[_0x9411f4];return _0x3304ea;};'use strict';var UserEvents=require(_0x38fb('0x0'));var events=[_0x38fb('0x1'),_0x38fb('0x2'),_0x38fb('0x3')];function createListener(_0x3dfa8f,_0x24f2ab){return function(_0x47446e){_0x24f2ab['emit'](_0x3dfa8f,_0x47446e);};}function removeListener(_0x2459b5,_0x324f23){return function(){UserEvents['removeListener'](_0x2459b5,_0x324f23);};}exports[_0x38fb('0x4')]=function(_0x364719){for(var _0x29d50c=0x0,_0x534cf3=events[_0x38fb('0x5')];_0x29d50c<_0x534cf3;_0x29d50c++){var _0x2caa84=events[_0x29d50c];var _0x11df77=createListener(_0x38fb('0x6')+_0x2caa84,_0x364719);UserEvents['on'](_0x2caa84,_0x11df77);}}; \ No newline at end of file +var _0x0bee=['emit','register','user:','./user.events','save','remove','update'];(function(_0x12a7d8,_0x2f33be){var _0x523252=function(_0x17189d){while(--_0x17189d){_0x12a7d8['push'](_0x12a7d8['shift']());}};_0x523252(++_0x2f33be);}(_0x0bee,0xb9));var _0xe0be=function(_0x34c427,_0x1da90a){_0x34c427=_0x34c427-0x0;var _0x28f705=_0x0bee[_0x34c427];return _0x28f705;};'use strict';var UserEvents=require(_0xe0be('0x0'));var events=[_0xe0be('0x1'),_0xe0be('0x2'),_0xe0be('0x3')];function createListener(_0x3b87b1,_0x58d84d){return function(_0x2bb9e5){_0x58d84d[_0xe0be('0x4')](_0x3b87b1,_0x2bb9e5);};}function removeListener(_0x18146d,_0x2a18c7){return function(){UserEvents['removeListener'](_0x18146d,_0x2a18c7);};}exports[_0xe0be('0x5')]=function(_0x1d6ef4){for(var _0x47c148=0x0,_0x36d71a=events['length'];_0x47c148<_0x36d71a;_0x47c148++){var _0x264251=events[_0x47c148];var _0x555f61=createListener(_0xe0be('0x6')+_0x264251,_0x1d6ef4);UserEvents['on'](_0x264251,_0x555f61);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index e3b440c..74912fc 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x2dadad,_0x174057){var _0x5c67a0=function(_0x14d07b){while(--_0x14d07b){_0x2dadad['push'](_0x2dadad['shift']());}};_0x5c67a0(++_0x174057);}(_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(_0x4cd672,_0x2f1567){var _0x195526=function(_0x3af5a0){while(--_0x3af5a0){_0x4cd672['push'](_0x4cd672['shift']());}};_0x195526(++_0x2f1567);}(_0x70e0,0x17b));var _0x070e=function(_0x97d8d8,_0xa923c1){_0x97d8d8=_0x97d8d8-0x0;var _0x126455=_0x70e0[_0x97d8d8];return _0x126455;};'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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index be1c421..5ee4cf2 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 _0x4b28=['INTEGER','sequelize','exports'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x4b28,0x121));var _0x84b2=function(_0xaf0ac3,_0x338231){_0xaf0ac3=_0xaf0ac3-0x0;var _0x2f6e40=_0x4b28[_0xaf0ac3];return _0x2f6e40;};'use strict';var Sequelize=require(_0x84b2('0x0'));module[_0x84b2('0x1')]={'penalty':{'type':Sequelize[_0x84b2('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x30d7=['exports','INTEGER','sequelize'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x30d7,0x173));var _0x730d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x30d7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x730d('0x0'));module[_0x730d('0x1')]={'penalty':{'type':Sequelize[_0x730d('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index ced5710..4a63678 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 _0x46fc=['../../config/environment','exports','define','UserChatQueue','user_has_chat_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5c4585,_0x3d0eab){var _0x21dede=function(_0x5c3d6a){while(--_0x5c3d6a){_0x5c4585['push'](_0x5c4585['shift']());}};_0x21dede(++_0x3d0eab);}(_0x46fc,0x87));var _0xc46f=function(_0x1e7de9,_0x52f0ca){_0x1e7de9=_0x1e7de9-0x0;var _0x4639ce=_0x46fc[_0x1e7de9];return _0x4639ce;};'use strict';var _=require(_0xc46f('0x0'));var util=require('util');var logger=require(_0xc46f('0x1'))(_0xc46f('0x2'));var moment=require(_0xc46f('0x3'));var BPromise=require(_0xc46f('0x4'));var rp=require(_0xc46f('0x5'));var fs=require('fs');var path=require(_0xc46f('0x6'));var rimraf=require(_0xc46f('0x7'));var config=require(_0xc46f('0x8'));var attributes=require('./userChatQueue.attributes');module[_0xc46f('0x9')]=function(_0x4e7a74,_0xf1aa1a){return _0x4e7a74[_0xc46f('0xa')](_0xc46f('0xb'),attributes,{'tableName':_0xc46f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b50=['../../config/logger','moment','bluebird','rimraf','../../config/environment','./userChatQueue.attributes','define','UserChatQueue','user_has_chat_queues','lodash','util'];(function(_0x393db8,_0x3e1157){var _0x4295cc=function(_0x59aaf2){while(--_0x59aaf2){_0x393db8['push'](_0x393db8['shift']());}};_0x4295cc(++_0x3e1157);}(_0x0b50,0x98));var _0x00b5=function(_0x631a3c,_0x1b61b6){_0x631a3c=_0x631a3c-0x0;var _0x2bdfa3=_0x0b50[_0x631a3c];return _0x2bdfa3;};'use strict';var _=require(_0x00b5('0x0'));var util=require(_0x00b5('0x1'));var logger=require(_0x00b5('0x2'))('api');var moment=require(_0x00b5('0x3'));var BPromise=require(_0x00b5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x00b5('0x5'));var config=require(_0x00b5('0x6'));var attributes=require(_0x00b5('0x7'));module['exports']=function(_0x522744,_0x28b55e){return _0x522744[_0x00b5('0x8')](_0x00b5('0x9'),attributes,{'tableName':_0x00b5('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 3f64e95..1898bdd 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 _0xa44e=['UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request'];(function(_0x4fb2dd,_0x6f90bb){var _0x2156d9=function(_0x4d1f06){while(--_0x4d1f06){_0x4fb2dd['push'](_0x4fb2dd['shift']());}};_0x2156d9(++_0x6f90bb);}(_0xa44e,0x1ed));var _0xea44=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa44e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xea44('0x0'));var util=require(_0xea44('0x1'));var moment=require(_0xea44('0x2'));var BPromise=require(_0xea44('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xea44('0x4'))['db'];var utils=require(_0xea44('0x5'));var logger=require(_0xea44('0x6'))('rpc');var config=require(_0xea44('0x7'));var jayson=require(_0xea44('0x8'));var client=jayson[_0xea44('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2889f1,_0x32ad9f,_0x52478e){return new BPromise(function(_0x74903c,_0x517781){return client[_0xea44('0xa')](_0x2889f1,_0x52478e)['then'](function(_0x2e136f){logger['info'](_0xea44('0xb'),_0x32ad9f,_0xea44('0xc'));logger[_0xea44('0xd')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x32ad9f,_0xea44('0xc'),JSON[_0xea44('0xe')](_0x2e136f));if(_0x2e136f[_0xea44('0xf')]){if(_0x2e136f[_0xea44('0xf')][_0xea44('0x10')]===0x1f4){logger['error'](_0xea44('0xb'),_0x32ad9f,_0x2e136f[_0xea44('0xf')]['message']);return _0x517781(_0x2e136f[_0xea44('0xf')]['message']);}logger[_0xea44('0xf')](_0xea44('0xb'),_0x32ad9f,_0x2e136f[_0xea44('0xf')][_0xea44('0x11')]);return _0x74903c(_0x2e136f['error']['message']);}else{logger[_0xea44('0x12')](_0xea44('0xb'),_0x32ad9f,_0xea44('0xc'));_0x74903c(_0x2e136f[_0xea44('0x13')][_0xea44('0x11')]);}})[_0xea44('0x14')](function(_0x99341){logger[_0xea44('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x32ad9f,_0x99341);_0x517781(_0x99341);});});} \ No newline at end of file +var _0x46ba=['result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserChatQueue,\x20%s,\x20%s','message'];(function(_0x290992,_0x93ee82){var _0x2f5e2b=function(_0x2c2080){while(--_0x2c2080){_0x290992['push'](_0x290992['shift']());}};_0x2f5e2b(++_0x93ee82);}(_0x46ba,0x151));var _0xa46b=function(_0x979f8,_0x15f7f7){_0x979f8=_0x979f8-0x0;var _0xdc0fff=_0x46ba[_0x979f8];return _0xdc0fff;};'use strict';var _=require(_0xa46b('0x0'));var util=require(_0xa46b('0x1'));var moment=require('moment');var BPromise=require(_0xa46b('0x2'));var rs=require(_0xa46b('0x3'));var fs=require('fs');var Redis=require(_0xa46b('0x4'));var db=require(_0xa46b('0x5'))['db'];var utils=require(_0xa46b('0x6'));var logger=require(_0xa46b('0x7'))('rpc');var config=require(_0xa46b('0x8'));var jayson=require(_0xa46b('0x9'));var client=jayson[_0xa46b('0xa')][_0xa46b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x40af72,_0x4ad1bc,_0x490886){return new BPromise(function(_0x34eefb,_0x503d83){return client[_0xa46b('0xc')](_0x40af72,_0x490886)[_0xa46b('0xd')](function(_0x235f40){logger[_0xa46b('0xe')]('UserChatQueue,\x20%s,\x20%s',_0x4ad1bc,_0xa46b('0xf'));logger[_0xa46b('0x10')](_0xa46b('0x11'),_0x4ad1bc,_0xa46b('0xf'),JSON[_0xa46b('0x12')](_0x235f40));if(_0x235f40[_0xa46b('0x13')]){if(_0x235f40[_0xa46b('0x13')][_0xa46b('0x14')]===0x1f4){logger[_0xa46b('0x13')](_0xa46b('0x15'),_0x4ad1bc,_0x235f40['error'][_0xa46b('0x16')]);return _0x503d83(_0x235f40[_0xa46b('0x13')][_0xa46b('0x16')]);}logger[_0xa46b('0x13')](_0xa46b('0x15'),_0x4ad1bc,_0x235f40[_0xa46b('0x13')]['message']);return _0x34eefb(_0x235f40[_0xa46b('0x13')][_0xa46b('0x16')]);}else{logger[_0xa46b('0xe')](_0xa46b('0x15'),_0x4ad1bc,'request\x20sent');_0x34eefb(_0x235f40[_0xa46b('0x17')]['message']);}})['catch'](function(_0x5d3b82){logger[_0xa46b('0x13')](_0xa46b('0x15'),_0x4ad1bc,_0x5d3b82);_0x503d83(_0x5d3b82);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 49a10d7..722de88 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x54d970,_0x1d8c10){var _0xa51348=function(_0x396d08){while(--_0x396d08){_0x54d970['push'](_0x54d970['shift']());}};_0xa51348(++_0x1d8c10);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4d2f00,_0x4e94d5){_0x4d2f00=_0x4d2f00-0x0;var _0x2d7b7f=_0xcb91[_0x4d2f00];return _0x2d7b7f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x33a6bd,_0x564362){var _0x339aff=function(_0xfa38d1){while(--_0xfa38d1){_0x33a6bd['push'](_0x33a6bd['shift']());}};_0x339aff(++_0x564362);}(_0x9c44,0x178));var _0x49c4=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9c44[_0x53ccf2];return _0x5a2964;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index cb19f5a..f5600e1 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 _0xe6f1=['exports','INTEGER','sequelize'];(function(_0x264267,_0x28d67e){var _0x891190=function(_0x31aa5a){while(--_0x31aa5a){_0x264267['push'](_0x264267['shift']());}};_0x891190(++_0x28d67e);}(_0xe6f1,0x7a));var _0x1e6f=function(_0x507357,_0x2c9a2f){_0x507357=_0x507357-0x0;var _0x164653=_0xe6f1[_0x507357];return _0x164653;};'use strict';var Sequelize=require(_0x1e6f('0x0'));module[_0x1e6f('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x1e6f('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2e54=['INTEGER','STRING','exports'];(function(_0x59ec40,_0x26a6b3){var _0x282cdc=function(_0x5ac3df){while(--_0x5ac3df){_0x59ec40['push'](_0x59ec40['shift']());}};_0x282cdc(++_0x26a6b3);}(_0x2e54,0xfb));var _0x42e5=function(_0x4c46a9,_0x2168dd){_0x4c46a9=_0x4c46a9-0x0;var _0x16022e=_0x2e54[_0x4c46a9];return _0x16022e;};'use strict';var Sequelize=require('sequelize');module[_0x42e5('0x0')]={'penalty':{'type':Sequelize[_0x42e5('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x42e5('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x42e5('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index b34c414..25826e5 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 _0xb405=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','user_has_fax_queues','lodash','../../config/logger'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0xb405,0x94));var _0x5b40=function(_0x4222c6,_0x18ff2a){_0x4222c6=_0x4222c6-0x0;var _0x19b9e3=_0xb405[_0x4222c6];return _0x19b9e3;};'use strict';var _=require(_0x5b40('0x0'));var util=require('util');var logger=require(_0x5b40('0x1'))('api');var moment=require('moment');var BPromise=require(_0x5b40('0x2'));var rp=require(_0x5b40('0x3'));var fs=require('fs');var path=require(_0x5b40('0x4'));var rimraf=require(_0x5b40('0x5'));var config=require(_0x5b40('0x6'));var attributes=require('./userFaxQueue.attributes');module[_0x5b40('0x7')]=function(_0x388f5c,_0x28bb7d){return _0x388f5c[_0x5b40('0x8')]('UserFaxQueue',attributes,{'tableName':_0x5b40('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x583b=['moment','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api'];(function(_0x532a00,_0x595411){var _0x267d71=function(_0x3985ef){while(--_0x3985ef){_0x532a00['push'](_0x532a00['shift']());}};_0x267d71(++_0x595411);}(_0x583b,0xac));var _0xb583=function(_0x2eb016,_0x357bcb){_0x2eb016=_0x2eb016-0x0;var _0x1773db=_0x583b[_0x2eb016];return _0x1773db;};'use strict';var _=require(_0xb583('0x0'));var util=require(_0xb583('0x1'));var logger=require(_0xb583('0x2'))(_0xb583('0x3'));var moment=require(_0xb583('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb583('0x5'));var attributes=require(_0xb583('0x6'));module[_0xb583('0x7')]=function(_0x5b1c4c,_0x1cb502){return _0x5b1c4c[_0xb583('0x8')](_0xb583('0x9'),attributes,{'tableName':_0xb583('0xa'),'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 a252068..7d2a0be 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 _0x2472=['debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','lodash','util','moment','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0x2472,0xd8));var _0x2247=function(_0x519644,_0x1f4200){_0x519644=_0x519644-0x0;var _0x25b338=_0x2472[_0x519644];return _0x25b338;};'use strict';var _=require(_0x2247('0x0'));var util=require(_0x2247('0x1'));var moment=require(_0x2247('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2247('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2247('0x4'))(_0x2247('0x5'));var config=require(_0x2247('0x6'));var jayson=require(_0x2247('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x984435,_0x2325d9,_0x2881c9){return new BPromise(function(_0x1c83ae,_0x58f607){return client['request'](_0x984435,_0x2881c9)[_0x2247('0x8')](function(_0x4db2bb){logger[_0x2247('0x9')](_0x2247('0xa'),_0x2325d9,_0x2247('0xb'));logger[_0x2247('0xc')](_0x2247('0xd'),_0x2325d9,'request\x20sent',JSON[_0x2247('0xe')](_0x4db2bb));if(_0x4db2bb['error']){if(_0x4db2bb['error'][_0x2247('0xf')]===0x1f4){logger[_0x2247('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x2325d9,_0x4db2bb['error'][_0x2247('0x11')]);return _0x58f607(_0x4db2bb['error'][_0x2247('0x11')]);}logger['error'](_0x2247('0xa'),_0x2325d9,_0x4db2bb[_0x2247('0x10')][_0x2247('0x11')]);return _0x1c83ae(_0x4db2bb['error'][_0x2247('0x11')]);}else{logger[_0x2247('0x9')](_0x2247('0xa'),_0x2325d9,_0x2247('0xb'));_0x1c83ae(_0x4db2bb[_0x2247('0x12')][_0x2247('0x11')]);}})['catch'](function(_0x3a646a){logger['error'](_0x2247('0xa'),_0x2325d9,_0x3a646a);_0x58f607(_0x3a646a);});});} \ No newline at end of file +var _0x331c=['rpc','jayson/promise','http','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3bc80b,_0x3c0912){var _0x4a257b=function(_0x294eaf){while(--_0x294eaf){_0x3bc80b['push'](_0x3bc80b['shift']());}};_0x4a257b(++_0x3c0912);}(_0x331c,0xea));var _0xc331=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x331c[_0x187ee1];return _0x388160;};'use strict';var _=require('lodash');var util=require(_0xc331('0x0'));var moment=require('moment');var BPromise=require(_0xc331('0x1'));var rs=require(_0xc331('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc331('0x3'))['db'];var utils=require(_0xc331('0x4'));var logger=require(_0xc331('0x5'))(_0xc331('0x6'));var config=require('../../config/environment');var jayson=require(_0xc331('0x7'));var client=jayson['client'][_0xc331('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2c6e5f,_0x352876,_0x49bf1e){return new BPromise(function(_0x2fb9d3,_0x343648){return client['request'](_0x2c6e5f,_0x49bf1e)[_0xc331('0x9')](function(_0x89c2cb){logger[_0xc331('0xa')](_0xc331('0xb'),_0x352876,_0xc331('0xc'));logger[_0xc331('0xd')](_0xc331('0xe'),_0x352876,'request\x20sent',JSON[_0xc331('0xf')](_0x89c2cb));if(_0x89c2cb[_0xc331('0x10')]){if(_0x89c2cb[_0xc331('0x10')][_0xc331('0x11')]===0x1f4){logger['error'](_0xc331('0xb'),_0x352876,_0x89c2cb[_0xc331('0x10')][_0xc331('0x12')]);return _0x343648(_0x89c2cb[_0xc331('0x10')][_0xc331('0x12')]);}logger[_0xc331('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x352876,_0x89c2cb[_0xc331('0x10')][_0xc331('0x12')]);return _0x2fb9d3(_0x89c2cb['error']['message']);}else{logger[_0xc331('0xa')]('UserFaxQueue,\x20%s,\x20%s',_0x352876,_0xc331('0xc'));_0x2fb9d3(_0x89c2cb[_0xc331('0x13')][_0xc331('0x12')]);}})['catch'](function(_0x4c6584){logger[_0xc331('0x10')](_0xc331('0xb'),_0x352876,_0x4c6584);_0x343648(_0x4c6584);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 27915b3..a36e640 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x9a23df,_0x2edc93){var _0x44c94e=function(_0xb17494){while(--_0xb17494){_0x9a23df['push'](_0x9a23df['shift']());}};_0x44c94e(++_0x2edc93);}(_0x9c44,0x178));var _0x49c4=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x9c44[_0x2e4aa2];return _0x5e6092;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0xd3eb4c,_0x478af8){var _0xea9dc6=function(_0xf36762){while(--_0xf36762){_0xd3eb4c['push'](_0xd3eb4c['shift']());}};_0xea9dc6(++_0x478af8);}(_0xedd9,0xfc));var _0x9edd=function(_0x35d483,_0x28b4a0){_0x35d483=_0x35d483-0x0;var _0x99edb7=_0xedd9[_0x35d483];return _0x99edb7;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 11d87f1..12e0e16 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 _0xdfe9=['INTEGER','sequelize','exports'];(function(_0x1b4002,_0x5b4094){var _0x1716f3=function(_0x47cfd1){while(--_0x47cfd1){_0x1b4002['push'](_0x1b4002['shift']());}};_0x1716f3(++_0x5b4094);}(_0xdfe9,0x199));var _0x9dfe=function(_0x4136aa,_0x470735){_0x4136aa=_0x4136aa-0x0;var _0x293cf6=_0xdfe9[_0x4136aa];return _0x293cf6;};'use strict';var Sequelize=require(_0x9dfe('0x0'));module[_0x9dfe('0x1')]={'penalty':{'type':Sequelize[_0x9dfe('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5855=['sequelize'];(function(_0x9b973d,_0x5af0da){var _0x54feef=function(_0x27fc06){while(--_0x27fc06){_0x9b973d['push'](_0x9b973d['shift']());}};_0x54feef(++_0x5af0da);}(_0x5855,0xc9));var _0x5585=function(_0x49d9db,_0x41347b){_0x49d9db=_0x49d9db-0x0;var _0x5f049d=_0x5855[_0x49d9db];return _0x5f049d;};'use strict';var Sequelize=require(_0x5585('0x0'));module['exports']={'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 94e5ceb..9f8a1f0 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 _0xf33c=['user_has_mail_queues','lodash','api','moment','request-promise','../../config/environment','./userMailQueue.attributes','exports','UserMailQueue'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xf33c,0x1b1));var _0xcf33=function(_0x9bc5b5,_0x17c13a){_0x9bc5b5=_0x9bc5b5-0x0;var _0x1209ff=_0xf33c[_0x9bc5b5];return _0x1209ff;};'use strict';var _=require(_0xcf33('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xcf33('0x1'));var moment=require(_0xcf33('0x2'));var BPromise=require('bluebird');var rp=require(_0xcf33('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcf33('0x4'));var attributes=require(_0xcf33('0x5'));module[_0xcf33('0x6')]=function(_0x2fe589,_0xcc7537){return _0x2fe589['define'](_0xcf33('0x7'),attributes,{'tableName':_0xcf33('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0488=['UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./userMailQueue.attributes','define'];(function(_0x3a86a4,_0x8b3ed6){var _0x126c18=function(_0x2eccf2){while(--_0x2eccf2){_0x3a86a4['push'](_0x3a86a4['shift']());}};_0x126c18(++_0x8b3ed6);}(_0x0488,0x12e));var _0x8048=function(_0x4ca950,_0x4624b1){_0x4ca950=_0x4ca950-0x0;var _0x467add=_0x0488[_0x4ca950];return _0x467add;};'use strict';var _=require(_0x8048('0x0'));var util=require(_0x8048('0x1'));var logger=require(_0x8048('0x2'))(_0x8048('0x3'));var moment=require(_0x8048('0x4'));var BPromise=require('bluebird');var rp=require(_0x8048('0x5'));var fs=require('fs');var path=require(_0x8048('0x6'));var rimraf=require(_0x8048('0x7'));var config=require('../../config/environment');var attributes=require(_0x8048('0x8'));module['exports']=function(_0x4a3011,_0x16268f){return _0x4a3011[_0x8048('0x9')](_0x8048('0xa'),attributes,{'tableName':_0x8048('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 ef40cec..4d71ae8 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 _0x6aa7=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x557132,_0x3650c9){var _0x4cf7e1=function(_0x4eb2e6){while(--_0x4eb2e6){_0x557132['push'](_0x557132['shift']());}};_0x4cf7e1(++_0x3650c9);}(_0x6aa7,0x178));var _0x76aa=function(_0x369eae,_0x3a960d){_0x369eae=_0x369eae-0x0;var _0x56e35e=_0x6aa7[_0x369eae];return _0x56e35e;};'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 +var _0x8ef6=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xbb7381,_0x36c671){var _0x44f1ac=function(_0x3a082c){while(--_0x3a082c){_0xbb7381['push'](_0xbb7381['shift']());}};_0x44f1ac(++_0x36c671);}(_0x8ef6,0xf2));var _0x68ef=function(_0x2ed197,_0x143cc){_0x2ed197=_0x2ed197-0x0;var _0x1be29d=_0x8ef6[_0x2ed197];return _0x1be29d;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 6f40bac..25fa19e 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 _0x9d2f=['post','isAuthenticated','sendUserNotification','path','connect-timeout','Router','fs-extra','../../components/auth/service','./userNotification.controller'];(function(_0xd22ad6,_0x374849){var _0x196776=function(_0x11fbe5){while(--_0x11fbe5){_0xd22ad6['push'](_0xd22ad6['shift']());}};_0x196776(++_0x374849);}(_0x9d2f,0x6f));var _0xf9d2=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x9d2f[_0x32f7d7];return _0x133d09;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf9d2('0x0'));var timeout=require(_0xf9d2('0x1'));var express=require('express');var router=express[_0xf9d2('0x2')]();var fs_extra=require(_0xf9d2('0x3'));var auth=require(_0xf9d2('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf9d2('0x5'));router[_0xf9d2('0x6')]('/',auth[_0xf9d2('0x7')](),controller[_0xf9d2('0x8')]);module['exports']=router; \ No newline at end of file +var _0xb082=['multer','path','Router','fs-extra','../../components/interaction/service','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports'];(function(_0x40f9a0,_0x3458cc){var _0x3e3144=function(_0x1f8fce){while(--_0x1f8fce){_0x40f9a0['push'](_0x40f9a0['shift']());}};_0x3e3144(++_0x3458cc);}(_0xb082,0x1e0));var _0x2b08=function(_0x394baf,_0x1d1e3c){_0x394baf=_0x394baf-0x0;var _0x498f33=_0xb082[_0x394baf];return _0x498f33;};'use strict';var multer=require(_0x2b08('0x0'));var util=require('util');var path=require(_0x2b08('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2b08('0x2')]();var fs_extra=require(_0x2b08('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x2b08('0x4'));var config=require('../../config/environment');var controller=require(_0x2b08('0x5'));router[_0x2b08('0x6')]('/',auth[_0x2b08('0x7')](),controller[_0x2b08('0x8')]);module[_0x2b08('0x9')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 9afb6a0..9cd973a 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 _0x8436=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x39428c,_0x34b23a){var _0x52d069=function(_0x394962){while(--_0x394962){_0x39428c['push'](_0x39428c['shift']());}};_0x52d069(++_0x34b23a);}(_0x8436,0x198));var _0x6843=function(_0xc83161,_0x2fe694){_0xc83161=_0xc83161-0x0;var _0x791195=_0x8436[_0xc83161];return _0x791195;};'use strict';var Sequelize=require(_0x6843('0x0'));module[_0x6843('0x1')]={'body':{'type':Sequelize[_0x6843('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x6843('0x3')]},'beep':{'type':Sequelize[_0x6843('0x4')]}}; \ No newline at end of file +var _0x6294=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x4cd21c,_0x35fa45){var _0x5d8e5e=function(_0x3af223){while(--_0x3af223){_0x4cd21c['push'](_0x4cd21c['shift']());}};_0x5d8e5e(++_0x35fa45);}(_0x6294,0x8a));var _0x4629=function(_0x1043e4,_0x17f1ae){_0x1043e4=_0x1043e4-0x0;var _0x4c19f4=_0x6294[_0x1043e4];return _0x4c19f4;};'use strict';var Sequelize=require(_0x4629('0x0'));module[_0x4629('0x1')]={'body':{'type':Sequelize[_0x4629('0x2')]},'senderName':{'type':Sequelize[_0x4629('0x3')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x4629('0x3')]},'beep':{'type':Sequelize[_0x4629('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 291ade4..3cbdf09 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 _0xe954=['sequelize','transaction','UserNotification','forEach','recipient','emit','userNotification:send','catch','text','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','union','queue','replace','ids','push','all','flatten','getAgents','map','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','sendUserNotification','body','hasOwnProperty','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','view','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','openchannelqueue','smsqueue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join'];(function(_0x222b60,_0x5cb508){var _0x5334a7=function(_0x4ff520){while(--_0x4ff520){_0x222b60['push'](_0x222b60['shift']());}};_0x5334a7(++_0x5cb508);}(_0xe954,0x145));var _0x4e95=function(_0x13a3c4,_0x1f03a3){_0x13a3c4=_0x13a3c4-0x0;var _0x5dd2d1=_0xe954[_0x13a3c4];return _0x5dd2d1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4e95('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4e95('0x1'));var moment=require(_0x4e95('0x2'));var BPromise=require(_0x4e95('0x3'));var Mustache=require(_0x4e95('0x4'));var util=require(_0x4e95('0x5'));var path=require(_0x4e95('0x6'));var sox=require(_0x4e95('0x7'));var csv=require(_0x4e95('0x8'));var ejs=require(_0x4e95('0x9'));var fs=require('fs');var fs_extra=require(_0x4e95('0xa'));var _=require('lodash');var squel=require(_0x4e95('0xb'));var crypto=require(_0x4e95('0xc'));var jsforce=require(_0x4e95('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4e95('0xe'));var Papa=require(_0x4e95('0xf'));var Redis=require(_0x4e95('0x10'));var authService=require(_0x4e95('0x11'));var qs=require(_0x4e95('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4e95('0x13'));var logger=require(_0x4e95('0x14'))(_0x4e95('0x15'));var utils=require(_0x4e95('0x16'));var config=require(_0x4e95('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x4e95('0x18'))['db'];config[_0x4e95('0x19')]=_[_0x4e95('0x1a')](config['redis'],{'host':_0x4e95('0x1b'),'port':0x18eb});var socket=require(_0x4e95('0x1c'))(new Redis(config[_0x4e95('0x19')]));require('./userNotification.socket')[_0x4e95('0x1d')](socket);function respondWithStatusCode(_0x5539ce,_0xf24105){_0xf24105=_0xf24105||0xcc;return function(_0x3882c8){if(_0x3882c8){return _0x5539ce['sendStatus'](_0xf24105);}return _0x5539ce[_0x4e95('0x1e')](_0xf24105)[_0x4e95('0x1f')]();};}function respondWithResult(_0x36f7b5,_0x27a3d4){_0x27a3d4=_0x27a3d4||0xc8;return function(_0x171a65){if(_0x171a65){return _0x36f7b5[_0x4e95('0x1e')](_0x27a3d4)['json'](_0x171a65);}};}function respondWithFilteredResult(_0x2b4dfa,_0x550ceb){return function(_0x291927){if(_0x291927){var _0x5c27e1=typeof _0x550ceb[_0x4e95('0x20')]===_0x4e95('0x21')&&typeof _0x550ceb[_0x4e95('0x22')]==='undefined';var _0x3f7d5f=_0x291927['count'];var _0x63d177=_0x5c27e1?0x0:_0x550ceb[_0x4e95('0x20')];var _0x1c4079=_0x5c27e1?_0x291927[_0x4e95('0x23')]:_0x550ceb['offset']+_0x550ceb[_0x4e95('0x22')];var _0x16b96b;if(_0x1c4079>=_0x3f7d5f){_0x1c4079=_0x3f7d5f;_0x16b96b=0xc8;}else{_0x16b96b=0xce;}_0x2b4dfa['status'](_0x16b96b);return _0x2b4dfa['set'](_0x4e95('0x24'),_0x63d177+'-'+_0x1c4079+'/'+_0x3f7d5f)['json'](_0x291927);}return null;};}function patchUpdates(_0x4393f6){return function(_0x3984ac){try{jsonpatch[_0x4e95('0x25')](_0x3984ac,_0x4393f6,!![]);}catch(_0x174a84){return BPromise[_0x4e95('0x26')](_0x174a84);}return _0x3984ac[_0x4e95('0x27')]();};}function saveUpdates(_0x2c6de6,_0xfd909a){return function(_0x351114){if(_0x351114){return _0x351114[_0x4e95('0x28')](_0x2c6de6)[_0x4e95('0x29')](function(_0x4bec6e){return _0x4bec6e;});}return null;};}function removeEntity(_0x4a9c22,_0x41f3bb){return function(_0x4a8d0d){if(_0x4a8d0d){return _0x4a8d0d[_0x4e95('0x2a')]()[_0x4e95('0x29')](function(){_0x4a9c22[_0x4e95('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14247a,_0x1082cb){return function(_0x30619b){if(!_0x30619b){_0x14247a[_0x4e95('0x2b')](0x194);}return _0x30619b;};}function handleError(_0x4e50f4,_0x2abd54){_0x2abd54=_0x2abd54||0x1f4;return function(_0x26d363){logger[_0x4e95('0x2c')](_0x26d363[_0x4e95('0x2d')]);if(_0x26d363[_0x4e95('0x2e')]){delete _0x26d363[_0x4e95('0x2e')];}_0x4e50f4[_0x4e95('0x1e')](_0x2abd54)[_0x4e95('0x2f')](_0x26d363);};}exports[_0x4e95('0x30')]=function(_0x2b242e,_0x3736be,_0x47330a){if(!_0x2b242e[_0x4e95('0x31')][_0x4e95('0x32')]('text')&&!_0x2b242e[_0x4e95('0x31')][_0x4e95('0x32')]('TemplateId')){throw new db['Sequelize'][(_0x4e95('0x33'))](_0x4e95('0x34'));}else{if(_0x2b242e[_0x4e95('0x31')][_0x4e95('0x32')](_0x4e95('0x35'))&&!_0x2b242e[_0x4e95('0x31')][_0x4e95('0x32')](_0x4e95('0x36'))){throw new db[(_0x4e95('0x37'))][(_0x4e95('0x33'))](_0x4e95('0x38'));}if(!_0x2b242e[_0x4e95('0x31')]['hasOwnProperty'](_0x4e95('0x39'))){throw new db[(_0x4e95('0x37'))][(_0x4e95('0x33'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x250452=JSON[_0x4e95('0x3a')](_0x2b242e[_0x4e95('0x31')][_0x4e95('0x39')]);}catch(_0x281178){logger['error'](_0x281178);throw new db[(_0x4e95('0x37'))][(_0x4e95('0x33'))](_0x4e95('0x3b'));}var _0x2e3f3e=[_0x4e95('0x3c'),'faxqueue','mailqueue',_0x4e95('0x3d'),_0x4e95('0x3e'),'voicequeue',_0x4e95('0x3f'),_0x4e95('0x40'),_0x4e95('0x41')];if(_[_0x4e95('0x42')](_0x250452,function(_0x36d989){return!_[_0x4e95('0x43')](_0x2e3f3e,_0x36d989[_0x4e95('0x44')][_0x4e95('0x45')]());})){throw new db['Sequelize']['ValidationError'](_0x4e95('0x46'));}}}var _0x57abd0={};_0x57abd0[_0x4e95('0x47')]=_0x2b242e['body'][_0x4e95('0x32')](_0x4e95('0x47'))?_0x2b242e[_0x4e95('0x31')][_0x4e95('0x47')]:_0x2b242e[_0x4e95('0x41')]['fullname'];_0x57abd0[_0x4e95('0x48')]=_[_0x4e95('0x49')](_0x2b242e[_0x4e95('0x31')][_0x4e95('0x48')])?null:_0x2b242e[_0x4e95('0x31')][_0x4e95('0x48')];_0x57abd0[_0x4e95('0x4a')]=_0x2b242e[_0x4e95('0x31')][_0x4e95('0x4a')]||![];_0x57abd0[_0x4e95('0x4b')]=_0x2b242e[_0x4e95('0x41')]['id'];return getContent(_0x2b242e[_0x4e95('0x31')])[_0x4e95('0x29')](function(_0x2e242f){_0x57abd0['body']=_0x2e242f;return getRecipients(_0x250452);})[_0x4e95('0x29')](function(_0x5a927d){_0x57abd0[_0x4e95('0x4c')]=_[_0x4e95('0x4d')](_0x5a927d)[_0x4e95('0x4e')](',');return db[_0x4e95('0x4f')][_0x4e95('0x50')](function(_0x166308){return db[_0x4e95('0x51')]['create'](_0x57abd0,{'raw':!![],'transaction':_0x166308})[_0x4e95('0x29')](function(_0x187123){var _0x113cf0={'sender':_0x57abd0['senderName'],'description':_0x57abd0[_0x4e95('0x48')],'content':_0x57abd0[_0x4e95('0x31')],'beep':_0x57abd0[_0x4e95('0x4a')]};_0x5a927d[_0x4e95('0x52')](function(_0x91cfc4){_0x113cf0[_0x4e95('0x53')]=_0x91cfc4;socket[_0x4e95('0x54')](_0x4e95('0x55'),_0x113cf0);});return _0x187123;});});})[_0x4e95('0x29')](respondWithResult(_0x3736be,0xc9))[_0x4e95('0x56')](handleError(_0x3736be,null));};function getContent(_0x11052e){return new BPromise(function(_0x405934,_0x348136){if(_0x11052e[_0x4e95('0x57')]){_0x405934(_0x11052e[_0x4e95('0x57')]);return;}return db[_0x4e95('0x58')][_0x4e95('0x59')]({'attributes':['html'],'where':{'id':_0x11052e[_0x4e95('0x35')]},'raw':!![]})[_0x4e95('0x29')](function(_0x5efdbe){if(!_0x5efdbe)throw new db[(_0x4e95('0x37'))]['ValidationError'](_0x4e95('0x5a'));var _0x5b6aa9=Mustache[_0x4e95('0x5b')](_0x5efdbe['html'],_0x11052e[_0x4e95('0x36')]);_0x405934(_0x5b6aa9);})[_0x4e95('0x56')](function(_0x27a353){_0x348136(_0x27a353);});});}function getRecipients(_0x2c2bdd){return new BPromise(function(_0x13e689,_0x298878){var _0x181cbf=[];var _0x22f243=[];_0x2c2bdd[_0x4e95('0x52')](function(_0x5c7a1c){var _0x273a84=_['startCase'](_0x5c7a1c[_0x4e95('0x44')]['toLowerCase']());if(_0x273a84==='User'){_0x181cbf=_[_0x4e95('0x5c')](_0x181cbf,_0x5c7a1c['ids']);}else{if(_['includes'](_0x273a84,_0x4e95('0x5d')))_0x273a84=_0x273a84[_0x4e95('0x5e')](_0x4e95('0x5d'),'Queue');_0x5c7a1c[_0x4e95('0x5f')][_0x4e95('0x52')](function(_0x5e8ca2){_0x22f243[_0x4e95('0x60')](getAgents(_0x273a84,_0x5e8ca2));});}});return BPromise[_0x4e95('0x61')](_0x22f243)['then'](function(_0x44cd16){_0x181cbf=_[_0x4e95('0x5c')](_0x181cbf,_[_0x4e95('0x62')](_0x44cd16));_0x13e689(_0x181cbf);})[_0x4e95('0x56')](function(_0x478798){_0x298878(_0x478798);});});}function getAgents(_0x20d065,_0x1f5337){return new BPromise(function(_0x44e2d8,_0x42a1e6){return db[_0x20d065][_0x4e95('0x59')]({'where':{'id':_0x1f5337}})['then'](function(_0x598867){return _0x598867[_0x4e95('0x63')]({'attributes':['id'],'raw':!![]})[_0x4e95('0x29')](function(_0x5505a9){var _0x1db8a8=_[_0x4e95('0x64')](_0x5505a9,'id');_0x44e2d8(_0x1db8a8);});})[_0x4e95('0x56')](function(_0x25ce6f){_0x42a1e6(_0x25ce6f);});});} \ No newline at end of file +var _0xc732=['Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','body','view','recipients','Missing\x20\x27recipients\x27\x20parameter','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','isEmpty','recipientsDescription','beep','recipientsId','join','sequelize','transaction','UserNotification','create','emit','userNotification:send','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','catch','forEach','startCase','union','ids','replace','Queue','push','all','getAgents','map','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','redis','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','destroy','then','error','name','send','sendUserNotification','hasOwnProperty','text','TemplateId'];(function(_0x2ade64,_0x14081a){var _0x54dd52=function(_0x536859){while(--_0x536859){_0x2ade64['push'](_0x2ade64['shift']());}};_0x54dd52(++_0x14081a);}(_0xc732,0x1a2));var _0x2c73=function(_0x5cf43e,_0x2afa04){_0x5cf43e=_0x5cf43e-0x0;var _0x2d6585=_0xc732[_0x5cf43e];return _0x2d6585;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2c73('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2c73('0x1'));var rp=require(_0x2c73('0x2'));var moment=require(_0x2c73('0x3'));var BPromise=require(_0x2c73('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2c73('0x5'));var sox=require(_0x2c73('0x6'));var csv=require(_0x2c73('0x7'));var ejs=require(_0x2c73('0x8'));var fs=require('fs');var fs_extra=require(_0x2c73('0x9'));var _=require(_0x2c73('0xa'));var squel=require(_0x2c73('0xb'));var crypto=require(_0x2c73('0xc'));var jsforce=require(_0x2c73('0xd'));var deskjs=require(_0x2c73('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2c73('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2c73('0x10'));var as=require(_0x2c73('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2c73('0x12'))('api');var utils=require(_0x2c73('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2c73('0x14'))['db'];config['redis']=_['defaults'](config[_0x2c73('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x2c73('0x16'))(new Redis(config[_0x2c73('0x15')]));require(_0x2c73('0x17'))[_0x2c73('0x18')](socket);function respondWithStatusCode(_0xed2909,_0x235561){_0x235561=_0x235561||0xcc;return function(_0xa95008){if(_0xa95008){return _0xed2909[_0x2c73('0x19')](_0x235561);}return _0xed2909[_0x2c73('0x1a')](_0x235561)[_0x2c73('0x1b')]();};}function respondWithResult(_0x143fb9,_0x5cffe4){_0x5cffe4=_0x5cffe4||0xc8;return function(_0x51626a){if(_0x51626a){return _0x143fb9[_0x2c73('0x1a')](_0x5cffe4)['json'](_0x51626a);}};}function respondWithFilteredResult(_0x24e13c,_0x4d8abc){return function(_0x38af46){if(_0x38af46){var _0x42e72e=typeof _0x4d8abc[_0x2c73('0x1c')]===_0x2c73('0x1d')&&typeof _0x4d8abc[_0x2c73('0x1e')]===_0x2c73('0x1d');var _0x303311=_0x38af46[_0x2c73('0x1f')];var _0x23a5a7=_0x42e72e?0x0:_0x4d8abc[_0x2c73('0x1c')];var _0x3e3c85=_0x42e72e?_0x38af46[_0x2c73('0x1f')]:_0x4d8abc['offset']+_0x4d8abc[_0x2c73('0x1e')];var _0x5341c9;if(_0x3e3c85>=_0x303311){_0x3e3c85=_0x303311;_0x5341c9=0xc8;}else{_0x5341c9=0xce;}_0x24e13c['status'](_0x5341c9);return _0x24e13c[_0x2c73('0x20')](_0x2c73('0x21'),_0x23a5a7+'-'+_0x3e3c85+'/'+_0x303311)[_0x2c73('0x22')](_0x38af46);}return null;};}function patchUpdates(_0x540eb){return function(_0x3ed51d){try{jsonpatch[_0x2c73('0x23')](_0x3ed51d,_0x540eb,!![]);}catch(_0xc0c3b6){return BPromise['reject'](_0xc0c3b6);}return _0x3ed51d[_0x2c73('0x24')]();};}function saveUpdates(_0x43416f,_0x2a8a1d){return function(_0x320c80){if(_0x320c80){return _0x320c80[_0x2c73('0x25')](_0x43416f)['then'](function(_0x21213e){return _0x21213e;});}return null;};}function removeEntity(_0x28bcb6,_0x4455a6){return function(_0x1358a0){if(_0x1358a0){return _0x1358a0[_0x2c73('0x26')]()[_0x2c73('0x27')](function(){_0x28bcb6[_0x2c73('0x1a')](0xcc)[_0x2c73('0x1b')]();});}};}function handleEntityNotFound(_0x51468b,_0x1b16f1){return function(_0x44c8d3){if(!_0x44c8d3){_0x51468b[_0x2c73('0x19')](0x194);}return _0x44c8d3;};}function handleError(_0x3e3004,_0x374e03){_0x374e03=_0x374e03||0x1f4;return function(_0xdaa299){logger[_0x2c73('0x28')](_0xdaa299['stack']);if(_0xdaa299[_0x2c73('0x29')]){delete _0xdaa299['name'];}_0x3e3004['status'](_0x374e03)[_0x2c73('0x2a')](_0xdaa299);};}exports[_0x2c73('0x2b')]=function(_0x210dc5,_0x4c077f,_0x3134ef){if(!_0x210dc5['body'][_0x2c73('0x2c')](_0x2c73('0x2d'))&&!_0x210dc5['body'][_0x2c73('0x2c')](_0x2c73('0x2e'))){throw new db[(_0x2c73('0x2f'))][(_0x2c73('0x30'))](_0x2c73('0x31'));}else{if(_0x210dc5[_0x2c73('0x32')][_0x2c73('0x2c')](_0x2c73('0x2e'))&&!_0x210dc5[_0x2c73('0x32')][_0x2c73('0x2c')](_0x2c73('0x33'))){throw new db[(_0x2c73('0x2f'))]['ValidationError']('Missing\x20\x27view\x27\x20parameter');}if(!_0x210dc5[_0x2c73('0x32')][_0x2c73('0x2c')](_0x2c73('0x34'))){throw new db[(_0x2c73('0x2f'))][(_0x2c73('0x30'))](_0x2c73('0x35'));}else{try{var _0x413e0e=JSON['parse'](_0x210dc5[_0x2c73('0x32')][_0x2c73('0x34')]);}catch(_0x1a5ac9){logger[_0x2c73('0x28')](_0x1a5ac9);throw new db[(_0x2c73('0x2f'))]['ValidationError']('Invalid\x20\x27recipients\x27\x20object');}var _0x3cb2f5=['chatqueue','faxqueue',_0x2c73('0x36'),_0x2c73('0x37'),_0x2c73('0x38'),_0x2c73('0x39'),_0x2c73('0x3a'),'team','user'];if(_[_0x2c73('0x3b')](_0x413e0e,function(_0xd8e7da){return!_[_0x2c73('0x3c')](_0x3cb2f5,_0xd8e7da[_0x2c73('0x3d')][_0x2c73('0x3e')]());})){throw new db[(_0x2c73('0x2f'))][(_0x2c73('0x30'))](_0x2c73('0x3f'));}}}var _0x1e43bf={};_0x1e43bf['senderName']=_0x210dc5['body'][_0x2c73('0x2c')](_0x2c73('0x40'))?_0x210dc5[_0x2c73('0x32')]['senderName']:_0x210dc5[_0x2c73('0x41')][_0x2c73('0x42')];_0x1e43bf['recipientsDescription']=_[_0x2c73('0x43')](_0x210dc5['body'][_0x2c73('0x44')])?null:_0x210dc5[_0x2c73('0x32')][_0x2c73('0x44')];_0x1e43bf[_0x2c73('0x45')]=_0x210dc5[_0x2c73('0x32')][_0x2c73('0x45')]||![];_0x1e43bf['SenderId']=_0x210dc5[_0x2c73('0x41')]['id'];return getContent(_0x210dc5[_0x2c73('0x32')])[_0x2c73('0x27')](function(_0x73b404){_0x1e43bf[_0x2c73('0x32')]=_0x73b404;return getRecipients(_0x413e0e);})['then'](function(_0x478c8a){_0x1e43bf[_0x2c73('0x46')]=_['sortBy'](_0x478c8a)[_0x2c73('0x47')](',');return db[_0x2c73('0x48')][_0x2c73('0x49')](function(_0x36f653){return db[_0x2c73('0x4a')][_0x2c73('0x4b')](_0x1e43bf,{'raw':!![],'transaction':_0x36f653})[_0x2c73('0x27')](function(_0x286388){var _0x1761f7={'sender':_0x1e43bf[_0x2c73('0x40')],'description':_0x1e43bf[_0x2c73('0x44')],'content':_0x1e43bf['body'],'beep':_0x1e43bf[_0x2c73('0x45')]};_0x478c8a['forEach'](function(_0x33e9d3){_0x1761f7['recipient']=_0x33e9d3;socket[_0x2c73('0x4c')](_0x2c73('0x4d'),_0x1761f7);});return _0x286388;});});})[_0x2c73('0x27')](respondWithResult(_0x4c077f,0xc9))['catch'](handleError(_0x4c077f,null));};function getContent(_0x496e4a){return new BPromise(function(_0xfd9d0e,_0x202830){if(_0x496e4a[_0x2c73('0x2d')]){_0xfd9d0e(_0x496e4a[_0x2c73('0x2d')]);return;}return db['Template'][_0x2c73('0x4e')]({'attributes':[_0x2c73('0x4f')],'where':{'id':_0x496e4a[_0x2c73('0x2e')]},'raw':!![]})[_0x2c73('0x27')](function(_0x869f4a){if(!_0x869f4a)throw new db[(_0x2c73('0x2f'))][(_0x2c73('0x30'))](_0x2c73('0x50'));var _0x2fe688=Mustache[_0x2c73('0x51')](_0x869f4a[_0x2c73('0x4f')],_0x496e4a['view']);_0xfd9d0e(_0x2fe688);})[_0x2c73('0x52')](function(_0x29d4a3){_0x202830(_0x29d4a3);});});}function getRecipients(_0x577d10){return new BPromise(function(_0x59ac44,_0x39a28e){var _0x74e434=[];var _0x2cca10=[];_0x577d10[_0x2c73('0x53')](function(_0x126f32){var _0x5d072c=_[_0x2c73('0x54')](_0x126f32['model']['toLowerCase']());if(_0x5d072c==='User'){_0x74e434=_[_0x2c73('0x55')](_0x74e434,_0x126f32[_0x2c73('0x56')]);}else{if(_['includes'](_0x5d072c,'queue'))_0x5d072c=_0x5d072c[_0x2c73('0x57')]('queue',_0x2c73('0x58'));_0x126f32['ids']['forEach'](function(_0x184a8f){_0x2cca10[_0x2c73('0x59')](getAgents(_0x5d072c,_0x184a8f));});}});return BPromise[_0x2c73('0x5a')](_0x2cca10)[_0x2c73('0x27')](function(_0x1b3124){_0x74e434=_[_0x2c73('0x55')](_0x74e434,_['flatten'](_0x1b3124));_0x59ac44(_0x74e434);})[_0x2c73('0x52')](function(_0x155e85){_0x39a28e(_0x155e85);});});}function getAgents(_0x862f34,_0x4c7151){return new BPromise(function(_0x382ebc,_0xb8b567){return db[_0x862f34][_0x2c73('0x4e')]({'where':{'id':_0x4c7151}})[_0x2c73('0x27')](function(_0x381da3){return _0x381da3[_0x2c73('0x5b')]({'attributes':['id'],'raw':!![]})['then'](function(_0x220d86){var _0x182d39=_[_0x2c73('0x5c')](_0x220d86,'id');_0x382ebc(_0x182d39);});})[_0x2c73('0x52')](function(_0x221fd1){_0xb8b567(_0x221fd1);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 56ef374..c9449a8 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 _0x1e9b=['emit','hook','events','../../mysqldb','UserNotification','setMaxListeners','save','update'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x1e9b,0x112));var _0xb1e9=function(_0x4cc5c6,_0x406b79){_0x4cc5c6=_0x4cc5c6-0x0;var _0x2ae5e8=_0x1e9b[_0x4cc5c6];return _0x2ae5e8;};'use strict';var EventEmitter=require(_0xb1e9('0x0'));var UserNotification=require(_0xb1e9('0x1'))['db'][_0xb1e9('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xb1e9('0x3')](0x0);var events={'afterCreate':_0xb1e9('0x4'),'afterUpdate':_0xb1e9('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3811e7){return function(_0x2b3583,_0x820709,_0x46b6b9){UserNotificationEvents[_0xb1e9('0x6')](_0x3811e7+':'+_0x2b3583['id'],_0x2b3583);UserNotificationEvents[_0xb1e9('0x6')](_0x3811e7,_0x2b3583);_0x46b6b9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0xb1e9('0x7')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file +var _0xe967=['save','update','emit','hasOwnProperty','hook','events','UserNotification','setMaxListeners'];(function(_0x188741,_0x243906){var _0x5e9290=function(_0x90f20a){while(--_0x90f20a){_0x188741['push'](_0x188741['shift']());}};_0x5e9290(++_0x243906);}(_0xe967,0x10d));var _0x7e96=function(_0x18c44d,_0x33976d){_0x18c44d=_0x18c44d-0x0;var _0x71abcf=_0xe967[_0x18c44d];return _0x71abcf;};'use strict';var EventEmitter=require(_0x7e96('0x0'));var UserNotification=require('../../mysqldb')['db'][_0x7e96('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x7e96('0x2')](0x0);var events={'afterCreate':_0x7e96('0x3'),'afterUpdate':_0x7e96('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2a51c5){return function(_0x16cc3a,_0x220b7d,_0x22b2d7){UserNotificationEvents[_0x7e96('0x5')](_0x2a51c5+':'+_0x16cc3a['id'],_0x16cc3a);UserNotificationEvents[_0x7e96('0x5')](_0x2a51c5,_0x16cc3a);_0x22b2d7(null);};}for(var e in events){if(events[_0x7e96('0x6')](e)){var event=events[e];UserNotification[_0x7e96('0x7')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index dfae74a..355068d 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 _0x17a5=['utf8mb4_unicode_ci','util','../../config/logger','moment','request-promise','rimraf','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4'];(function(_0x1be8d4,_0x4e9d06){var _0xa5171a=function(_0x19d932){while(--_0x19d932){_0x1be8d4['push'](_0x1be8d4['shift']());}};_0xa5171a(++_0x4e9d06);}(_0x17a5,0x1d5));var _0x517a=function(_0x46b4aa,_0x303110){_0x46b4aa=_0x46b4aa-0x0;var _0x192019=_0x17a5[_0x46b4aa];return _0x192019;};'use strict';var _=require('lodash');var util=require(_0x517a('0x0'));var logger=require(_0x517a('0x1'))('api');var moment=require(_0x517a('0x2'));var BPromise=require('bluebird');var rp=require(_0x517a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x517a('0x4'));var config=require('../../config/environment');var attributes=require(_0x517a('0x5'));module[_0x517a('0x6')]=function(_0x3c34f8,_0x4db37b){return _0x3c34f8[_0x517a('0x7')](_0x517a('0x8'),attributes,{'tableName':_0x517a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x517a('0xa'),'collate':_0x517a('0xb')});}; \ No newline at end of file +var _0x2470=['userNotifications','utf8mb4_unicode_ci','lodash','util','api','moment','path','rimraf','../../config/environment','./userNotification.attributes','define','UserNotification'];(function(_0x748f64,_0x1ab840){var _0x50a19c=function(_0x292646){while(--_0x292646){_0x748f64['push'](_0x748f64['shift']());}};_0x50a19c(++_0x1ab840);}(_0x2470,0xb6));var _0x0247=function(_0x193980,_0x5d61f2){_0x193980=_0x193980-0x0;var _0x44161f=_0x2470[_0x193980];return _0x44161f;};'use strict';var _=require(_0x0247('0x0'));var util=require(_0x0247('0x1'));var logger=require('../../config/logger')(_0x0247('0x2'));var moment=require(_0x0247('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0247('0x4'));var rimraf=require(_0x0247('0x5'));var config=require(_0x0247('0x6'));var attributes=require(_0x0247('0x7'));module['exports']=function(_0x4adc99,_0x41ed22){return _0x4adc99[_0x0247('0x8')](_0x0247('0x9'),attributes,{'tableName':_0x0247('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0247('0xb')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index b96315f..8c726b8 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 _0x51ec=['../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','request','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','UserNotification,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0x51ec,0x106));var _0xc51e=function(_0xc26026,_0x1dc681){_0xc26026=_0xc26026-0x0;var _0x119198=_0x51ec[_0xc26026];return _0x119198;};'use strict';var _=require(_0xc51e('0x0'));var util=require(_0xc51e('0x1'));var moment=require(_0xc51e('0x2'));var BPromise=require('bluebird');var rs=require(_0xc51e('0x3'));var fs=require('fs');var Redis=require(_0xc51e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc51e('0x5'));var logger=require(_0xc51e('0x6'))(_0xc51e('0x7'));var config=require(_0xc51e('0x8'));var jayson=require(_0xc51e('0x9'));var client=jayson[_0xc51e('0xa')][_0xc51e('0xb')]({'port':0x232a});config[_0xc51e('0xc')]=_[_0xc51e('0xd')](config[_0xc51e('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xc51e('0xe'))(new Redis(config['redis']));require('./userNotification.socket')['register'](socket);function respondWithRpcPromise(_0x5a67e5,_0xf70d88,_0x40ecc1){return new BPromise(function(_0x4b5333,_0x3858ef){return client[_0xc51e('0xf')](_0x5a67e5,_0x40ecc1)['then'](function(_0x44e0ae){logger['info']('UserNotification,\x20%s,\x20%s',_0xf70d88,_0xc51e('0x10'));logger[_0xc51e('0x11')](_0xc51e('0x12'),_0xf70d88,'request\x20sent',JSON[_0xc51e('0x13')](_0x44e0ae));if(_0x44e0ae[_0xc51e('0x14')]){if(_0x44e0ae[_0xc51e('0x14')][_0xc51e('0x15')]===0x1f4){logger['error'](_0xc51e('0x16'),_0xf70d88,_0x44e0ae[_0xc51e('0x14')][_0xc51e('0x17')]);return _0x3858ef(_0x44e0ae[_0xc51e('0x14')][_0xc51e('0x17')]);}logger[_0xc51e('0x14')]('UserNotification,\x20%s,\x20%s',_0xf70d88,_0x44e0ae['error'][_0xc51e('0x17')]);return _0x4b5333(_0x44e0ae[_0xc51e('0x14')][_0xc51e('0x17')]);}else{logger[_0xc51e('0x18')](_0xc51e('0x16'),_0xf70d88,_0xc51e('0x10'));_0x4b5333(_0x44e0ae[_0xc51e('0x19')][_0xc51e('0x17')]);}})[_0xc51e('0x1a')](function(_0x2bb2e2){logger[_0xc51e('0x14')](_0xc51e('0x16'),_0xf70d88,_0x2bb2e2);_0x3858ef(_0x2bb2e2);});});} \ No newline at end of file +var _0xc9e1=['redis','defaults','socket.io-emitter','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc9e1,0x123));var _0x1c9e=function(_0x5b27c0,_0x962da9){_0x5b27c0=_0x5b27c0-0x0;var _0x3d579d=_0xc9e1[_0x5b27c0];return _0x3d579d;};'use strict';var _=require(_0x1c9e('0x0'));var util=require(_0x1c9e('0x1'));var moment=require(_0x1c9e('0x2'));var BPromise=require('bluebird');var rs=require(_0x1c9e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1c9e('0x4'))['db'];var utils=require(_0x1c9e('0x5'));var logger=require('../../config/logger')(_0x1c9e('0x6'));var config=require(_0x1c9e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1c9e('0x8')]['http']({'port':0x232a});config[_0x1c9e('0x9')]=_[_0x1c9e('0xa')](config[_0x1c9e('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x1c9e('0xb'))(new Redis(config[_0x1c9e('0x9')]));require(_0x1c9e('0xc'))[_0x1c9e('0xd')](socket);function respondWithRpcPromise(_0xb68590,_0x5bbad6,_0x19c8f5){return new BPromise(function(_0x5ab86f,_0x4d7469){return client[_0x1c9e('0xe')](_0xb68590,_0x19c8f5)[_0x1c9e('0xf')](function(_0x1d84ab){logger[_0x1c9e('0x10')](_0x1c9e('0x11'),_0x5bbad6,_0x1c9e('0x12'));logger['debug'](_0x1c9e('0x13'),_0x5bbad6,_0x1c9e('0x12'),JSON[_0x1c9e('0x14')](_0x1d84ab));if(_0x1d84ab[_0x1c9e('0x15')]){if(_0x1d84ab[_0x1c9e('0x15')][_0x1c9e('0x16')]===0x1f4){logger[_0x1c9e('0x15')]('UserNotification,\x20%s,\x20%s',_0x5bbad6,_0x1d84ab['error'][_0x1c9e('0x17')]);return _0x4d7469(_0x1d84ab[_0x1c9e('0x15')][_0x1c9e('0x17')]);}logger[_0x1c9e('0x15')](_0x1c9e('0x11'),_0x5bbad6,_0x1d84ab['error'][_0x1c9e('0x17')]);return _0x5ab86f(_0x1d84ab['error'][_0x1c9e('0x17')]);}else{logger[_0x1c9e('0x10')](_0x1c9e('0x11'),_0x5bbad6,_0x1c9e('0x12'));_0x5ab86f(_0x1d84ab[_0x1c9e('0x18')]['message']);}})['catch'](function(_0x164878){logger['error'](_0x1c9e('0x11'),_0x5bbad6,_0x164878);_0x4d7469(_0x164878);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 6051c51..ad653d5 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 _0x175d=['remove','emit','register','length','userNotification:','./userNotification.events','save'];(function(_0x4c2db2,_0x4a2b51){var _0x1914fb=function(_0x21999c){while(--_0x21999c){_0x4c2db2['push'](_0x4c2db2['shift']());}};_0x1914fb(++_0x4a2b51);}(_0x175d,0x1b7));var _0xd175=function(_0x476036,_0x13c6a6){_0x476036=_0x476036-0x0;var _0x30b0ef=_0x175d[_0x476036];return _0x30b0ef;};'use strict';var UserNotificationEvents=require(_0xd175('0x0'));var events=[_0xd175('0x1'),_0xd175('0x2'),'update'];function createListener(_0x313896,_0x30e44f){return function(_0x4a96c2){_0x30e44f[_0xd175('0x3')](_0x313896,_0x4a96c2);};}function removeListener(_0x263fdb,_0x24956b){return function(){UserNotificationEvents['removeListener'](_0x263fdb,_0x24956b);};}exports[_0xd175('0x4')]=function(_0x4eb530){for(var _0x59b445=0x0,_0x80b291=events[_0xd175('0x5')];_0x59b445<_0x80b291;_0x59b445++){var _0x3a03b9=events[_0x59b445];var _0x32278c=createListener(_0xd175('0x6')+_0x3a03b9,_0x4eb530);UserNotificationEvents['on'](_0x3a03b9,_0x32278c);}}; \ No newline at end of file +var _0x2426=['register','userNotification:','./userNotification.events','save','remove','removeListener'];(function(_0x3ea15f,_0x1a3f80){var _0x2addc6=function(_0x3d966e){while(--_0x3d966e){_0x3ea15f['push'](_0x3ea15f['shift']());}};_0x2addc6(++_0x1a3f80);}(_0x2426,0xbc));var _0x6242=function(_0x2ad9e2,_0x675554){_0x2ad9e2=_0x2ad9e2-0x0;var _0x51f7b0=_0x2426[_0x2ad9e2];return _0x51f7b0;};'use strict';var UserNotificationEvents=require(_0x6242('0x0'));var events=[_0x6242('0x1'),_0x6242('0x2'),'update'];function createListener(_0x599b18,_0x3f179e){return function(_0x56572f){_0x3f179e['emit'](_0x599b18,_0x56572f);};}function removeListener(_0x1c816a,_0x3ec767){return function(){UserNotificationEvents[_0x6242('0x3')](_0x1c816a,_0x3ec767);};}exports[_0x6242('0x4')]=function(_0x235e3d){for(var _0x107b09=0x0,_0x260922=events['length'];_0x107b09<_0x260922;_0x107b09++){var _0x327b33=events[_0x107b09];var _0x252730=createListener(_0x6242('0x5')+_0x327b33,_0x235e3d);UserNotificationEvents['on'](_0x327b33,_0x252730);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 0bb836b..b9d5d1f 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x48decd,_0x4e9995){var _0x4be802=function(_0x23094c){while(--_0x23094c){_0x48decd['push'](_0x48decd['shift']());}};_0x4be802(++_0x4e9995);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0xcb91[_0x101e7b];return _0x4995c0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x527c05,_0x4018f9){var _0x5d09a6=function(_0x12e0d9){while(--_0x12e0d9){_0x527c05['push'](_0x527c05['shift']());}};_0x5d09a6(++_0x4018f9);}(_0xe706,0xa3));var _0x6e70=function(_0x490e61,_0x7f848e){_0x490e61=_0x490e61-0x0;var _0x169bc6=_0xe706[_0x490e61];return _0x169bc6;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index ba6365b..2c70553 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 _0x3e2a=['exports'];(function(_0x5ce898,_0x33da79){var _0x552cab=function(_0xa92d40){while(--_0xa92d40){_0x5ce898['push'](_0x5ce898['shift']());}};_0x552cab(++_0x33da79);}(_0x3e2a,0x106));var _0xa3e2=function(_0x17cd47,_0x4af8d0){_0x17cd47=_0x17cd47-0x0;var _0x171b91=_0x3e2a[_0x17cd47];return _0x171b91;};'use strict';var Sequelize=require('sequelize');module[_0xa3e2('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x5859=['sequelize','exports'];(function(_0x2c0a09,_0x38844f){var _0x566853=function(_0x1de581){while(--_0x1de581){_0x2c0a09['push'](_0x2c0a09['shift']());}};_0x566853(++_0x38844f);}(_0x5859,0x13c));var _0x9585=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0x5859[_0x20a558];return _0x53d3f7;};'use strict';var Sequelize=require(_0x9585('0x0'));module[_0x9585('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index cdf1281..ffd11de 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 _0xf565=['../../config/environment','exports','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0xf565,0x7c));var _0x5f56=function(_0x5d0177,_0x466a86){_0x5d0177=_0x5d0177-0x0;var _0x3f572e=_0xf565[_0x5d0177];return _0x3f572e;};'use strict';var _=require(_0x5f56('0x0'));var util=require(_0x5f56('0x1'));var logger=require(_0x5f56('0x2'))(_0x5f56('0x3'));var moment=require(_0x5f56('0x4'));var BPromise=require(_0x5f56('0x5'));var rp=require(_0x5f56('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5f56('0x7'));var config=require(_0x5f56('0x8'));var attributes=require('./userOpenchannelQueue.attributes');module[_0x5f56('0x9')]=function(_0x474385,_0x3bdc60){return _0x474385['define']('UserOpenchannelQueue',attributes,{'tableName':_0x5f56('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ba6=['exports','UserOpenchannelQueue','user_has_openchannel_queues','lodash','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x193800,_0x10828b){var _0x519bd0=function(_0x2010dc){while(--_0x2010dc){_0x193800['push'](_0x193800['shift']());}};_0x519bd0(++_0x10828b);}(_0x7ba6,0xb7));var _0x67ba=function(_0x13a129,_0x45ef92){_0x13a129=_0x13a129-0x0;var _0x44cbb2=_0x7ba6[_0x13a129];return _0x44cbb2;};'use strict';var _=require(_0x67ba('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x67ba('0x1'));var rp=require(_0x67ba('0x2'));var fs=require('fs');var path=require(_0x67ba('0x3'));var rimraf=require(_0x67ba('0x4'));var config=require(_0x67ba('0x5'));var attributes=require('./userOpenchannelQueue.attributes');module[_0x67ba('0x6')]=function(_0x2e0133,_0x275240){return _0x2e0133['define'](_0x67ba('0x7'),attributes,{'tableName':_0x67ba('0x8'),'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 a5c217b..28368cb 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 _0x9275=['request','then','info','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x28729d,_0x49edcc){var _0x5519b3=function(_0x1c530a){while(--_0x1c530a){_0x28729d['push'](_0x28729d['shift']());}};_0x5519b3(++_0x49edcc);}(_0x9275,0x170));var _0x5927=function(_0x265aa2,_0x220072){_0x265aa2=_0x265aa2-0x0;var _0x447a3a=_0x9275[_0x265aa2];return _0x447a3a;};'use strict';var _=require('lodash');var util=require(_0x5927('0x0'));var moment=require('moment');var BPromise=require(_0x5927('0x1'));var rs=require(_0x5927('0x2'));var fs=require('fs');var Redis=require(_0x5927('0x3'));var db=require(_0x5927('0x4'))['db'];var utils=require(_0x5927('0x5'));var logger=require(_0x5927('0x6'))('rpc');var config=require(_0x5927('0x7'));var jayson=require(_0x5927('0x8'));var client=jayson['client'][_0x5927('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5662ec,_0x289cf0,_0xc3267f){return new BPromise(function(_0x399e55,_0x21fc6f){return client[_0x5927('0xa')](_0x5662ec,_0xc3267f)[_0x5927('0xb')](function(_0x2daddd){logger[_0x5927('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x289cf0,_0x5927('0xd'));logger['debug'](_0x5927('0xe'),_0x289cf0,'request\x20sent',JSON[_0x5927('0xf')](_0x2daddd));if(_0x2daddd['error']){if(_0x2daddd[_0x5927('0x10')][_0x5927('0x11')]===0x1f4){logger['error'](_0x5927('0x12'),_0x289cf0,_0x2daddd[_0x5927('0x10')][_0x5927('0x13')]);return _0x21fc6f(_0x2daddd['error'][_0x5927('0x13')]);}logger['error'](_0x5927('0x12'),_0x289cf0,_0x2daddd[_0x5927('0x10')][_0x5927('0x13')]);return _0x399e55(_0x2daddd[_0x5927('0x10')][_0x5927('0x13')]);}else{logger[_0x5927('0xc')](_0x5927('0x12'),_0x289cf0,_0x5927('0xd'));_0x399e55(_0x2daddd[_0x5927('0x14')][_0x5927('0x13')]);}})['catch'](function(_0x15316a){logger[_0x5927('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x289cf0,_0x15316a);_0x21fc6f(_0x15316a);});});} \ No newline at end of file +var _0x8602=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis'];(function(_0x37b9ad,_0x179adf){var _0x6264e2=function(_0x469b7d){while(--_0x469b7d){_0x37b9ad['push'](_0x37b9ad['shift']());}};_0x6264e2(++_0x179adf);}(_0x8602,0xca));var _0x2860=function(_0x577519,_0x346daf){_0x577519=_0x577519-0x0;var _0x5b12f7=_0x8602[_0x577519];return _0x5b12f7;};'use strict';var _=require(_0x2860('0x0'));var util=require(_0x2860('0x1'));var moment=require('moment');var BPromise=require(_0x2860('0x2'));var rs=require(_0x2860('0x3'));var fs=require('fs');var Redis=require(_0x2860('0x4'));var db=require(_0x2860('0x5'))['db'];var utils=require(_0x2860('0x6'));var logger=require(_0x2860('0x7'))(_0x2860('0x8'));var config=require(_0x2860('0x9'));var jayson=require(_0x2860('0xa'));var client=jayson['client'][_0x2860('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8039c6,_0x2738ba,_0x2873f2){return new BPromise(function(_0x2b2ace,_0x505600){return client['request'](_0x8039c6,_0x2873f2)[_0x2860('0xc')](function(_0x20c731){logger[_0x2860('0xd')](_0x2860('0xe'),_0x2738ba,_0x2860('0xf'));logger[_0x2860('0x10')](_0x2860('0x11'),_0x2738ba,'request\x20sent',JSON[_0x2860('0x12')](_0x20c731));if(_0x20c731[_0x2860('0x13')]){if(_0x20c731[_0x2860('0x13')][_0x2860('0x14')]===0x1f4){logger['error'](_0x2860('0xe'),_0x2738ba,_0x20c731[_0x2860('0x13')][_0x2860('0x15')]);return _0x505600(_0x20c731['error'][_0x2860('0x15')]);}logger[_0x2860('0x13')](_0x2860('0xe'),_0x2738ba,_0x20c731['error'][_0x2860('0x15')]);return _0x2b2ace(_0x20c731[_0x2860('0x13')][_0x2860('0x15')]);}else{logger[_0x2860('0xd')](_0x2860('0xe'),_0x2738ba,_0x2860('0xf'));_0x2b2ace(_0x20c731[_0x2860('0x16')][_0x2860('0x15')]);}})['catch'](function(_0xebfabf){logger[_0x2860('0x13')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x2738ba,_0xebfabf);_0x505600(_0xebfabf);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 50adf6f..3cf8647 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 _0x46ba=['../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','clone','addSections','update','delete','destroy','removeSections','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5a32fc,_0x4ddbde){var _0x39f28b=function(_0xaebcaa){while(--_0xaebcaa){_0x5a32fc['push'](_0x5a32fc['shift']());}};_0x39f28b(++_0x4ddbde);}(_0x46ba,0xd9));var _0xa46b=function(_0x30d6df,_0x26549f){_0x30d6df=_0x30d6df-0x0;var _0x25cc9d=_0x46ba[_0x30d6df];return _0x25cc9d;};'use strict';var multer=require(_0xa46b('0x0'));var util=require(_0xa46b('0x1'));var path=require(_0xa46b('0x2'));var timeout=require('connect-timeout');var express=require(_0xa46b('0x3'));var router=express[_0xa46b('0x4')]();var fs_extra=require(_0xa46b('0x5'));var auth=require(_0xa46b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa46b('0x7'));var controller=require('./userProfile.controller');router[_0xa46b('0x8')]('/',auth[_0xa46b('0x9')](),controller[_0xa46b('0xa')]);router['get']('/describe',auth[_0xa46b('0x9')](),controller[_0xa46b('0xb')]);router[_0xa46b('0x8')](_0xa46b('0xc'),auth[_0xa46b('0x9')](),controller[_0xa46b('0xd')]);router['get'](_0xa46b('0xe'),auth[_0xa46b('0x9')](),controller[_0xa46b('0xf')]);router[_0xa46b('0x8')](_0xa46b('0x10'),auth['isAuthenticated'](),controller[_0xa46b('0x11')]);router[_0xa46b('0x12')]('/',auth[_0xa46b('0x9')](),controller[_0xa46b('0x13')]);router[_0xa46b('0x12')](_0xa46b('0x14'),auth[_0xa46b('0x9')](),controller[_0xa46b('0x15')]);router[_0xa46b('0x12')]('/:id/sections',auth[_0xa46b('0x9')](),controller[_0xa46b('0x16')]);router['post'](_0xa46b('0x10'),auth[_0xa46b('0x9')](),controller['addResources']);router['put']('/:id',auth[_0xa46b('0x9')](),controller[_0xa46b('0x17')]);router[_0xa46b('0x18')]('/:id',auth[_0xa46b('0x9')](),controller[_0xa46b('0x19')]);router['delete'](_0xa46b('0xe'),auth[_0xa46b('0x9')](),controller[_0xa46b('0x1a')]);router[_0xa46b('0x18')](_0xa46b('0x10'),auth[_0xa46b('0x9')](),controller['removeResources']);module[_0xa46b('0x1b')]=router; \ No newline at end of file +var _0xd16c=['index','/describe','describe','/:id','/:id/sections','getSections','/:id/resources','create','post','clone','addResources','update','delete','destroy','removeSections','removeResources','exports','multer','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x532806,_0x32eee3){var _0x509ead=function(_0x503248){while(--_0x503248){_0x532806['push'](_0x532806['shift']());}};_0x509ead(++_0x32eee3);}(_0xd16c,0x179));var _0xcd16=function(_0x245ce4,_0x470c35){_0x245ce4=_0x245ce4-0x0;var _0x578727=_0xd16c[_0x245ce4];return _0x578727;};'use strict';var multer=require(_0xcd16('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcd16('0x1'));var router=express[_0xcd16('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xcd16('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xcd16('0x4'));var controller=require('./userProfile.controller');router[_0xcd16('0x5')]('/',auth[_0xcd16('0x6')](),controller[_0xcd16('0x7')]);router[_0xcd16('0x5')](_0xcd16('0x8'),auth[_0xcd16('0x6')](),controller[_0xcd16('0x9')]);router[_0xcd16('0x5')](_0xcd16('0xa'),auth[_0xcd16('0x6')](),controller['show']);router[_0xcd16('0x5')](_0xcd16('0xb'),auth[_0xcd16('0x6')](),controller[_0xcd16('0xc')]);router[_0xcd16('0x5')](_0xcd16('0xd'),auth[_0xcd16('0x6')](),controller['getResources']);router['post']('/',auth[_0xcd16('0x6')](),controller[_0xcd16('0xe')]);router[_0xcd16('0xf')]('/:id/clone',auth[_0xcd16('0x6')](),controller[_0xcd16('0x10')]);router['post']('/:id/sections',auth['isAuthenticated'](),controller['addSections']);router['post'](_0xcd16('0xd'),auth[_0xcd16('0x6')](),controller[_0xcd16('0x11')]);router['put']('/:id',auth[_0xcd16('0x6')](),controller[_0xcd16('0x12')]);router[_0xcd16('0x13')](_0xcd16('0xa'),auth[_0xcd16('0x6')](),controller[_0xcd16('0x14')]);router[_0xcd16('0x13')](_0xcd16('0xb'),auth[_0xcd16('0x6')](),controller[_0xcd16('0x15')]);router[_0xcd16('0x13')]('/:id/resources',auth[_0xcd16('0x6')](),controller[_0xcd16('0x16')]);module[_0xcd16('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 2a970d5..267472f 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 _0x1d6a=['name','crudPermissions','join','getDataValue','split','BOOLEAN','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1d6a,0x12c));var _0xa1d6=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x1d6a[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xa1d6('0x0')],'allowNull':![],'unique':_0xa1d6('0x1')},'crudPermissions':{'type':Sequelize[_0xa1d6('0x0')],'set':function(_0x54ee4e){this['setDataValue'](_0xa1d6('0x2'),_0x54ee4e?_0x54ee4e[_0xa1d6('0x3')](''):[]);},'get':function(){return this[_0xa1d6('0x4')](_0xa1d6('0x2'))?this['getDataValue']('crudPermissions')[_0xa1d6('0x5')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xa1d6('0x0')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xa1d6('0x6')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xa1d6('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xa1d6('0x6')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xa1d6('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0x766a=['join','getDataValue','split','BOOLEAN','STRING','name','crudPermissions'];(function(_0xc8c244,_0x417666){var _0x272db0=function(_0x551413){while(--_0x551413){_0xc8c244['push'](_0xc8c244['shift']());}};_0x272db0(++_0x417666);}(_0x766a,0xeb));var _0xa766=function(_0x4f6f84,_0x31e197){_0x4f6f84=_0x4f6f84-0x0;var _0x20d989=_0x766a[_0x4f6f84];return _0x20d989;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xa766('0x0')],'allowNull':![],'unique':_0xa766('0x1')},'crudPermissions':{'type':Sequelize[_0xa766('0x0')],'set':function(_0x3904e0){this['setDataValue'](_0xa766('0x2'),_0x3904e0?_0x3904e0[_0xa766('0x3')](''):[]);},'get':function(){return this[_0xa766('0x4')](_0xa766('0x2'))?this[_0xa766('0x4')](_0xa766('0x2'))[_0xa766('0x5')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xa766('0x0')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xa766('0x6')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xa766('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xa766('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xa766('0x6')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xa766('0x6')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xa766('0x6')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 0674ae3..e352f83 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 _0x8af6=['forEach','resourceId','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','save','update','then','destroy','name','map','UserProfile','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','length','find','create','body','clone','keys','createdAt','updatedAt','crudPermissions','omit','sequelize','transaction','get','UserProfileSection','autoAssociation','Resources','UserProfileResource','describe','addSections','sectionId','push','removeSections','ids','enabled','includes','isEmpty','subsections','findOne','Dashboard'];(function(_0x168f97,_0x2e9319){var _0x1e2e11=function(_0x5a4a85){while(--_0x5a4a85){_0x168f97['push'](_0x168f97['shift']());}};_0x1e2e11(++_0x2e9319);}(_0x8af6,0x76));var _0x68af=function(_0x58efe3,_0x4bc205){_0x58efe3=_0x58efe3-0x0;var _0x4cd1e3=_0x8af6[_0x58efe3];return _0x4cd1e3;};'use strict';var emlformat=require(_0x68af('0x0'));var rimraf=require(_0x68af('0x1'));var zipdir=require(_0x68af('0x2'));var jsonpatch=require(_0x68af('0x3'));var rp=require(_0x68af('0x4'));var moment=require(_0x68af('0x5'));var BPromise=require(_0x68af('0x6'));var Mustache=require(_0x68af('0x7'));var util=require(_0x68af('0x8'));var path=require(_0x68af('0x9'));var sox=require('sox');var csv=require(_0x68af('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x68af('0xb'));var _=require(_0x68af('0xc'));var squel=require(_0x68af('0xd'));var crypto=require(_0x68af('0xe'));var jsforce=require(_0x68af('0xf'));var deskjs=require(_0x68af('0x10'));var toCsv=require(_0x68af('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x68af('0x11'));var authService=require(_0x68af('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x68af('0x13'));var hardwareService=require(_0x68af('0x14'));var logger=require(_0x68af('0x15'))(_0x68af('0x16'));var utils=require(_0x68af('0x17'));var config=require(_0x68af('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x68af('0x19')]=_['defaults'](config['redis'],{'host':_0x68af('0x1a'),'port':0x18eb});var socket=require(_0x68af('0x1b'))(new Redis(config[_0x68af('0x19')]));require('./userProfile.socket')[_0x68af('0x1c')](socket);function respondWithStatusCode(_0x50f1ea,_0x3a6d18){_0x3a6d18=_0x3a6d18||0xcc;return function(_0x3c37db){if(_0x3c37db){return _0x50f1ea[_0x68af('0x1d')](_0x3a6d18);}return _0x50f1ea[_0x68af('0x1e')](_0x3a6d18)[_0x68af('0x1f')]();};}function respondWithResult(_0x58764e,_0x43c1d9){_0x43c1d9=_0x43c1d9||0xc8;return function(_0xcdf590){if(_0xcdf590){return _0x58764e[_0x68af('0x1e')](_0x43c1d9)[_0x68af('0x20')](_0xcdf590);}};}function respondWithFilteredResult(_0x59d7f3,_0x5357b1){return function(_0x3aa998){if(_0x3aa998){var _0x29ddbf=typeof _0x5357b1['offset']===_0x68af('0x21')&&typeof _0x5357b1[_0x68af('0x22')]===_0x68af('0x21');var _0x1a82f0=_0x3aa998['count'];var _0x2ed0a6=_0x29ddbf?0x0:_0x5357b1[_0x68af('0x23')];var _0x5ab38b=_0x29ddbf?_0x3aa998['count']:_0x5357b1[_0x68af('0x23')]+_0x5357b1[_0x68af('0x22')];var _0x14b930;if(_0x5ab38b>=_0x1a82f0){_0x5ab38b=_0x1a82f0;_0x14b930=0xc8;}else{_0x14b930=0xce;}_0x59d7f3[_0x68af('0x1e')](_0x14b930);return _0x59d7f3[_0x68af('0x24')](_0x68af('0x25'),_0x2ed0a6+'-'+_0x5ab38b+'/'+_0x1a82f0)['json'](_0x3aa998);}return null;};}function patchUpdates(_0x25a210){return function(_0x3c71ef){try{jsonpatch['apply'](_0x3c71ef,_0x25a210,!![]);}catch(_0x3ebd57){return BPromise['reject'](_0x3ebd57);}return _0x3c71ef[_0x68af('0x26')]();};}function saveUpdates(_0x1f0d0e,_0xa489c3){return function(_0x16e07a){if(_0x16e07a){return _0x16e07a[_0x68af('0x27')](_0x1f0d0e)[_0x68af('0x28')](function(_0x5851b9){return _0x5851b9;});}return null;};}function removeEntity(_0x514ebc,_0x29f003){return function(_0x6c175e){if(_0x6c175e){return _0x6c175e[_0x68af('0x29')]()[_0x68af('0x28')](function(){_0x514ebc[_0x68af('0x1e')](0xcc)[_0x68af('0x1f')]();});}};}function handleEntityNotFound(_0x1839f9,_0x2729fd){return function(_0x5417e9){if(!_0x5417e9){_0x1839f9[_0x68af('0x1d')](0x194);}return _0x5417e9;};}function handleError(_0x1c6011,_0xec7c01){_0xec7c01=_0xec7c01||0x1f4;return function(_0x3d1303){logger['error'](_0x3d1303['stack']);if(_0x3d1303[_0x68af('0x2a')]){delete _0x3d1303[_0x68af('0x2a')];}_0x1c6011[_0x68af('0x1e')](_0xec7c01)['send'](_0x3d1303);};}exports['index']=function(_0x3c3268,_0x135dc1){var _0x5c0adb={},_0x718b39={},_0x2d5aac={'count':0x0,'rows':[]};var _0x21b677=_[_0x68af('0x2b')](db[_0x68af('0x2c')][_0x68af('0x2d')],function(_0x18120e){return{'name':_0x18120e['fieldName'],'type':_0x18120e[_0x68af('0x2e')][_0x68af('0x2f')]};});_0x718b39[_0x68af('0x30')]=_['map'](_0x21b677,_0x68af('0x2a'));_0x718b39[_0x68af('0x31')]=_['keys'](_0x3c3268[_0x68af('0x31')]);_0x718b39[_0x68af('0x32')]=_['intersection'](_0x718b39[_0x68af('0x30')],_0x718b39['query']);_0x5c0adb['attributes']=_[_0x68af('0x33')](_0x718b39[_0x68af('0x30')],qs[_0x68af('0x34')](_0x3c3268[_0x68af('0x31')][_0x68af('0x34')]));_0x5c0adb[_0x68af('0x35')]=_0x5c0adb['attributes']['length']?_0x5c0adb['attributes']:_0x718b39[_0x68af('0x30')];if(!_0x3c3268[_0x68af('0x31')]['hasOwnProperty'](_0x68af('0x36'))){_0x5c0adb[_0x68af('0x22')]=qs[_0x68af('0x22')](_0x3c3268['query'][_0x68af('0x22')]);_0x5c0adb[_0x68af('0x23')]=qs[_0x68af('0x23')](_0x3c3268[_0x68af('0x31')][_0x68af('0x23')]);}_0x5c0adb['order']=qs[_0x68af('0x37')](_0x3c3268[_0x68af('0x31')][_0x68af('0x37')]);_0x5c0adb[_0x68af('0x38')]=qs[_0x68af('0x32')](_[_0x68af('0x39')](_0x3c3268[_0x68af('0x31')],_0x718b39[_0x68af('0x32')]),_0x21b677);if(_0x3c3268[_0x68af('0x31')][_0x68af('0x3a')]){_0x5c0adb['where']=_[_0x68af('0x3b')](_0x5c0adb[_0x68af('0x38')],{'$or':_['map'](_0x21b677,function(_0x3ba003){if(_0x3ba003[_0x68af('0x2e')]!==_0x68af('0x3c')){var _0x47292c={};_0x47292c[_0x3ba003[_0x68af('0x2a')]]={'$like':'%'+_0x3c3268['query']['filter']+'%'};return _0x47292c;}})});}_0x5c0adb=_['merge']({},_0x5c0adb,_0x3c3268[_0x68af('0x3d')]);var _0x139900={'where':_0x5c0adb['where']};return db[_0x68af('0x2c')][_0x68af('0x3e')](_0x139900)[_0x68af('0x28')](function(_0x3bb630){_0x2d5aac['count']=_0x3bb630;if(_0x3c3268[_0x68af('0x31')][_0x68af('0x3f')]){_0x5c0adb[_0x68af('0x40')]=[{'all':!![]}];}return db[_0x68af('0x2c')][_0x68af('0x41')](_0x5c0adb);})[_0x68af('0x28')](function(_0x3b0953){_0x2d5aac[_0x68af('0x42')]=_0x3b0953;return _0x2d5aac;})[_0x68af('0x28')](respondWithFilteredResult(_0x135dc1,_0x5c0adb))[_0x68af('0x43')](handleError(_0x135dc1,null));};exports['show']=function(_0x52adab,_0x395cce){var _0x105243={'raw':![],'where':{'id':_0x52adab[_0x68af('0x44')]['id']}},_0x1a0b10={};_0x1a0b10[_0x68af('0x30')]=_['keys'](db[_0x68af('0x2c')][_0x68af('0x2d')]);_0x1a0b10[_0x68af('0x31')]=_['keys'](_0x52adab[_0x68af('0x31')]);_0x1a0b10[_0x68af('0x32')]=_[_0x68af('0x33')](_0x1a0b10[_0x68af('0x30')],_0x1a0b10[_0x68af('0x31')]);_0x105243[_0x68af('0x35')]=_[_0x68af('0x33')](_0x1a0b10['model'],qs[_0x68af('0x34')](_0x52adab[_0x68af('0x31')][_0x68af('0x34')]));_0x105243[_0x68af('0x35')]=_0x105243['attributes'][_0x68af('0x45')]?_0x105243[_0x68af('0x35')]:_0x1a0b10['model'];if(_0x52adab[_0x68af('0x31')]['includeAll']){_0x105243[_0x68af('0x40')]=[{'all':!![]}];}_0x105243=_['merge']({},_0x105243,_0x52adab[_0x68af('0x3d')]);return db[_0x68af('0x2c')][_0x68af('0x46')](_0x105243)[_0x68af('0x28')](handleEntityNotFound(_0x395cce,null))[_0x68af('0x28')](respondWithResult(_0x395cce,null))[_0x68af('0x43')](handleError(_0x395cce,null));};exports[_0x68af('0x47')]=function(_0x3b43a6,_0x3544d5){return db[_0x68af('0x2c')][_0x68af('0x47')](_0x3b43a6[_0x68af('0x48')],{})['then'](respondWithResult(_0x3544d5,0xc9))[_0x68af('0x43')](handleError(_0x3544d5,null));};exports[_0x68af('0x49')]=function(_0x4d44cd,_0x2bce28){var _0x472868={'where':{'id':_0x4d44cd['params']['id']}},_0x46a1f0={};_0x46a1f0[_0x68af('0x30')]=_[_0x68af('0x4a')](db[_0x68af('0x2c')][_0x68af('0x2d')]);_0x472868[_0x68af('0x35')]=_['intersection'](_0x46a1f0[_0x68af('0x30')],qs[_0x68af('0x34')](_0x4d44cd[_0x68af('0x31')][_0x68af('0x34')]));_0x472868[_0x68af('0x35')]=_0x472868[_0x68af('0x35')][_0x68af('0x45')]?_0x472868[_0x68af('0x35')]:_0x46a1f0[_0x68af('0x30')];if(_0x4d44cd[_0x68af('0x31')]['includeAll']){_0x472868[_0x68af('0x40')]=[{'all':!![]}];}_0x472868=_[_0x68af('0x3b')]({},_0x472868,_0x4d44cd[_0x68af('0x3d')]);return db[_0x68af('0x2c')][_0x68af('0x46')](_0x472868)[_0x68af('0x28')](handleEntityNotFound(_0x2bce28,null))['then'](function(_0x5ca2ae){if(_0x5ca2ae){var _0x433d50=_0x5ca2ae['get']({'plain':!![]});_0x433d50=qs['omit'](_0x433d50,['id',_0x68af('0x4b'),_0x68af('0x4c'),_0x68af('0x4d')]);_0x4d44cd[_0x68af('0x48')]=_[_0x68af('0x4e')](_0x4d44cd[_0x68af('0x48')],['id',_0x68af('0x4b'),'updatedAt']);return db[_0x68af('0x4f')][_0x68af('0x50')](function(_0x255e1c){return db[_0x68af('0x2c')][_0x68af('0x47')](_[_0x68af('0x3b')](_0x433d50,_0x4d44cd[_0x68af('0x48')]),{'include':_0x4d44cd[_0x68af('0x31')][_0x68af('0x3f')]?[{'all':!![]}]:undefined,'transaction':_0x255e1c})['then'](function(_0x367685){var _0x2706a4=_0x367685[_0x68af('0x51')]({'plain':!![]});return db[_0x68af('0x52')][_0x68af('0x41')]({'where':{'userProfileId':_0x4d44cd[_0x68af('0x44')]['id']},'raw':!![]})['then'](function(_0x1f2ba6){if(_0x1f2ba6){return BPromise['each'](_0x1f2ba6,function(_0x2fea5f){return new BPromise(function(_0x4ee21b,_0x5e6aca){if(_0x2fea5f['autoAssociation']===null||_0x2fea5f[_0x68af('0x53')]===0x1)_0x4ee21b(null);return db['UserProfileResource'][_0x68af('0x41')]({'where':{'sectionId':_0x2fea5f['id']},'raw':!![]})[_0x68af('0x28')](function(_0x39388f){var _0x137d3e=_[_0x68af('0x2b')](_0x39388f,function(_0x162961){return qs[_0x68af('0x4e')](_0x162961,['id','createdAt',_0x68af('0x4c'),'sectionId']);});_0x4ee21b(_0x137d3e);})[_0x68af('0x43')](function(_0x37170a){_0x5e6aca(_0x37170a);});})[_0x68af('0x28')](function(_0x588453){var _0x3d57ca=qs[_0x68af('0x4e')](_0x2fea5f,['id',_0x68af('0x4b'),_0x68af('0x4c')]);_0x3d57ca['userProfileId']=_0x2706a4['id'];if(_0x588453)_0x3d57ca[_0x68af('0x54')]=_0x588453;return _0x3d57ca;})['then'](function(_0x20d912){return db['UserProfileSection'][_0x68af('0x47')](_0x20d912,{'include':[{'model':db[_0x68af('0x55')],'as':_0x68af('0x54')}],'raw':!![],'transaction':_0x255e1c});});})['then'](function(){return _0x2706a4;});}});});});}})[_0x68af('0x28')](respondWithResult(_0x2bce28,0xc9))[_0x68af('0x43')](handleError(_0x2bce28,null));};exports[_0x68af('0x27')]=function(_0x36b9ae,_0x55c62a){if(_0x36b9ae[_0x68af('0x48')]['id']){delete _0x36b9ae['body']['id'];}return db[_0x68af('0x2c')]['find']({'where':{'id':_0x36b9ae['params']['id']}})[_0x68af('0x28')](handleEntityNotFound(_0x55c62a,null))['then'](saveUpdates(_0x36b9ae[_0x68af('0x48')],null))['then'](respondWithResult(_0x55c62a,null))[_0x68af('0x43')](handleError(_0x55c62a,null));};exports[_0x68af('0x29')]=function(_0x4d3587,_0x21260a){return db[_0x68af('0x2c')]['find']({'where':{'id':_0x4d3587[_0x68af('0x44')]['id']}})[_0x68af('0x28')](handleEntityNotFound(_0x21260a,null))[_0x68af('0x28')](removeEntity(_0x21260a,null))[_0x68af('0x43')](handleError(_0x21260a,null));};exports[_0x68af('0x56')]=function(_0x5bb1e8,_0x2f7a3a){return db[_0x68af('0x2c')][_0x68af('0x56')]()[_0x68af('0x28')](respondWithResult(_0x2f7a3a,null))[_0x68af('0x43')](handleError(_0x2f7a3a,null));};exports[_0x68af('0x57')]=function(_0x125d2a,_0x183349){var _0x2d814a=_0x125d2a['body'];return db[_0x68af('0x2c')]['find']({'where':{'id':_0x125d2a[_0x68af('0x44')]['id']}})[_0x68af('0x28')](handleEntityNotFound(_0x183349,null))[_0x68af('0x28')](function(_0x4b23e6){if(_0x4b23e6){return db[_0x68af('0x4f')][_0x68af('0x50')](function(_0x4e1f0e){return db[_0x68af('0x52')][_0x68af('0x29')]({'where':{'userProfileId':_0x125d2a[_0x68af('0x44')]['id'],'sectionId':_[_0x68af('0x2b')](_0x2d814a,function(_0x5dbf33){return _0x5dbf33[_0x68af('0x58')];})},'transaction':_0x4e1f0e})[_0x68af('0x28')](function(){var _0x1acb3e=_[_0x68af('0x2b')](_0x2d814a,function(_0x51b055){_0x51b055['userProfileId']=_0x125d2a[_0x68af('0x44')]['id'];return _0x51b055;});var _0x44418f=[];return BPromise['each'](_0x1acb3e,function(_0x351d52){return db[_0x68af('0x52')][_0x68af('0x47')](_0x351d52,{'include':[{'model':db[_0x68af('0x55')],'as':_0x68af('0x54')}],'raw':!![],'transaction':_0x4e1f0e})['then'](function(_0x22cd4c){_0x44418f[_0x68af('0x59')](_0x22cd4c[_0x68af('0x51')]({'plain':!![]}));});})['then'](function(){return _0x44418f;});});});}})[_0x68af('0x28')](function(_0x290f64){return _0x290f64;})['then'](respondWithResult(_0x183349,null))['catch'](handleError(_0x183349,null));};exports[_0x68af('0x5a')]=function(_0x3e837d,_0x2e61f9){var _0x324205;return db['UserProfile'][_0x68af('0x46')]({'where':{'id':_0x3e837d['params']['id']},'attributes':['id','name']})['then'](handleEntityNotFound(_0x2e61f9,null))[_0x68af('0x28')](function(_0x56cadf){if(_0x56cadf){_0x324205=_0x56cadf;return db['UserProfileSection'][_0x68af('0x29')]({'where':{'userProfileId':_0x3e837d[_0x68af('0x44')]['id'],'sectionId':_0x3e837d[_0x68af('0x31')][_0x68af('0x5b')]}});}})[_0x68af('0x28')](function(){return _0x324205;})[_0x68af('0x28')](respondWithStatusCode(_0x2e61f9,null))[_0x68af('0x43')](handleError(_0x2e61f9,null));};exports['getSections']=function(_0x36d27e,_0x2643a1){var _0x2f6a9c=[];var _0x4cd9b3=[];return db[_0x68af('0x52')]['findAll']({'where':{'userProfileId':_0x36d27e[_0x68af('0x44')]['id']},'raw':!![]})[_0x68af('0x28')](function(_0x10521b){_0x2f6a9c=_[_0x68af('0x3a')](_0x10521b,function(_0x270392){return _0x270392[_0x68af('0x5c')]===0x1||_[_0x68af('0x5d')]([0x3eb,0x709],_0x270392[_0x68af('0x58')]);});if(!_[_0x68af('0x5e')](_0x2f6a9c)){return _[_0x68af('0x2b')](_0x2f6a9c,function(_0x3e8660){return _0x3e8660[_0x68af('0x58')];});}else{return;}})[_0x68af('0x28')](function(_0x576e9d){if(_0x576e9d)_0x4cd9b3=_0x576e9d;if(_[_0x68af('0x5d')](_0x4cd9b3,0x64)){var _0x3b1fec=_['find'](_0x2f6a9c,{'sectionId':0x64});return hasDefaultDashboard(_0x3b1fec)[_0x68af('0x28')](function(_0x20b73b){return _[_0x68af('0x2b')](_0x2f6a9c,function(_0x469711){if(_0x469711[_0x68af('0x58')]===0x64){_0x469711[_0x68af('0x5f')]=_0x20b73b;}return _0x469711;});});}else{return;}})['then'](function(_0x43dc7b){if(_0x43dc7b)_0x2f6a9c=_0x43dc7b;if(_[_0x68af('0x5d')](_0x4cd9b3,0x3eb)){var _0x387f2d=_['find'](_0x2f6a9c,{'sectionId':0x3eb});return getCustomDashboards(_0x387f2d)['then'](function(_0x1bebe1){return _[_0x68af('0x2b')](_0x2f6a9c,function(_0x126ece){if(_0x387f2d['enabled']){if(_0x126ece[_0x68af('0x58')]===0x3eb){_0x126ece[_0x68af('0x5f')]=_0x1bebe1;}}else{if(_0x126ece[_0x68af('0x58')]===0x64){_0x126ece[_0x68af('0x5f')]=_0x1bebe1;}}return _0x126ece;});});}else{return;}})['then'](function(_0x2eea52){if(_0x2eea52)_0x2f6a9c=_0x2eea52;if(_[_0x68af('0x5d')](_0x4cd9b3,0x709)){var _0x2bbd03=_[_0x68af('0x46')](_0x2f6a9c,{'sectionId':0x709});return getPlugins(_0x2bbd03)[_0x68af('0x28')](function(_0x4d2fca){if(_0x2bbd03[_0x68af('0x5c')]){return _[_0x68af('0x2b')](_0x2f6a9c,function(_0x3c6c97){if(_0x3c6c97['sectionId']===0x709){_0x3c6c97[_0x68af('0x5f')]=_0x4d2fca;}return _0x3c6c97;});}else{var _0x226d1f={'sectionId':0x76c,'enabled':0x1,'subsections':_0x4d2fca};var _0x216506=_[_0x68af('0x2b')](_0x2f6a9c);_0x216506[_0x68af('0x59')](_0x226d1f);return _0x216506;}});}else{return;}})[_0x68af('0x28')](function(_0x58901d){if(_0x58901d)_0x2f6a9c=_0x58901d;return _[_0x68af('0x3a')](_0x2f6a9c,[_0x68af('0x5c'),0x1]);})[_0x68af('0x28')](respondWithResult(_0x2643a1,null))['catch'](handleError(_0x2643a1,null));};function hasDefaultDashboard(_0x56404f){var _0x470804=[0x65];return new BPromise(function(_0x42b58d,_0x1ce09a){try{if(_0x56404f[_0x68af('0x53')]){_0x42b58d(_0x470804);}else{return db['UserProfileResource'][_0x68af('0x60')]({'where':{'sectionId':_0x56404f['id']},'raw':!![]})[_0x68af('0x28')](function(_0x4a2797){_0x4a2797?_0x42b58d(_0x470804):_0x42b58d();});}}catch(_0x584796){_0x1ce09a(_0x584796);}});}function getCustomDashboards(_0x3a348c){var _0x1f77c1=[];return new BPromise(function(_0x5dc173,_0x220fe8){try{if(_0x3a348c[_0x68af('0x53')]){return db[_0x68af('0x61')][_0x68af('0x41')]({'raw':!![]})['then'](function(_0x12a8c2){_0x12a8c2[_0x68af('0x62')](function(_0x53cad0){_0x1f77c1['push'](_0x53cad0['id']+0x1869f);});_0x5dc173(_0x1f77c1);});}else{return db[_0x68af('0x55')][_0x68af('0x41')]({'where':{'sectionId':_0x3a348c['id']},'raw':!![]})['then'](function(_0x3f97ad){_0x3f97ad['forEach'](function(_0x2dcaaa){_0x1f77c1['push'](_0x2dcaaa['resourceId']+0x1869f);});_0x5dc173(_0x1f77c1);});}}catch(_0x5babfa){_0x220fe8(_0x5babfa);}});}function getPlugins(_0x8c5d55){var _0x31b589=[];return new BPromise(function(_0x3c3313,_0x3749f2){try{if(_0x8c5d55[_0x68af('0x53')]){return db['Plugin'][_0x68af('0x41')]({'raw':!![]})[_0x68af('0x28')](function(_0x47948b){_0x47948b[_0x68af('0x62')](function(_0x160a65){_0x31b589['push'](_0x160a65['id']+0x15b38);});_0x3c3313(_0x31b589);});}else{return db[_0x68af('0x55')][_0x68af('0x41')]({'where':{'sectionId':_0x8c5d55['id']},'raw':!![]})[_0x68af('0x28')](function(_0xc9e13a){_0xc9e13a['forEach'](function(_0x31ebb5){_0x31b589[_0x68af('0x59')](_0x31ebb5[_0x68af('0x63')]+0x15b38);});_0x3c3313(_0x31b589);});}}catch(_0x4b0616){_0x3749f2(_0x4b0616);}});}exports[_0x68af('0x64')]=function(_0x3d8421,_0x258677){return db[_0x68af('0x2c')][_0x68af('0x46')]({'where':{'id':_0x3d8421[_0x68af('0x44')]['id']}})[_0x68af('0x28')](handleEntityNotFound(_0x258677,null))['then'](function(_0xadc4e2){if(_0xadc4e2){return db['sequelize'][_0x68af('0x50')](function(_0x48f249){return db[_0x68af('0x52')][_0x68af('0x41')]({'where':{'userProfileId':_0x3d8421[_0x68af('0x44')]['id']},'attributes':['id'],'raw':!![]})[_0x68af('0x28')](function(_0x414566){if(_0x414566){return db[_0x68af('0x52')][_0x68af('0x29')]({'where':{'userProfileId':_0x3d8421[_0x68af('0x44')]['id'],'id':_[_0x68af('0x2b')](_0x414566,function(_0x1339c0){return _0x1339c0['id'];})},'transaction':_0x48f249});}})['then'](function(_0x3afa1e){var _0x5580a3=_[_0x68af('0x2b')](_0x3d8421[_0x68af('0x48')],function(_0x39451d){_0x39451d['userProfileId']=_0x3d8421[_0x68af('0x44')]['id'];return _0x39451d;});return db['UserProfileSection']['bulkCreate'](_0x5580a3,{'raw':!![],'transaction':_0x48f249});})[_0x68af('0x28')](function(_0x2357c8){var _0x1e7a6a=_['filter'](_[_0x68af('0x2b')](_0x2357c8,function(_0x544979){return _0x544979[_0x68af('0x51')]({'plain':!![]});}),{'includeAll':![]});if(_0x1e7a6a){return db[_0x68af('0x52')][_0x68af('0x41')]({'where':{'userProfileId':_0x3d8421[_0x68af('0x44')]['id'],'sectionId':_[_0x68af('0x2b')](_0x1e7a6a,function(_0x1138bd){return _0x1138bd['sectionId'];})},'attributes':['id','sectionId'],'raw':!![]})[_0x68af('0x28')](function(_0x3dbea6){var _0x3a68d8=_[_0x68af('0x2b')](_0x3d8421[_0x68af('0x48')],function(_0x1a845f){_0x1a845f['userProfileId']=_0x3d8421['params']['id'];return _0x1a845f;});return db[_0x68af('0x55')][_0x68af('0x65')](_0x3a68d8,{'raw':!![],'transaction':_0x48f249});});}})[_0x68af('0x43')](handleError(_0x258677,null));});}})[_0x68af('0x28')](function(_0x4e18ec){var _0x4b1f2c=_[_0x68af('0x2b')](_0x4e18ec,function(_0xe7205d){return _0xe7205d[_0x68af('0x51')]({'plain':!![]});});})[_0x68af('0x28')](respondWithResult(_0x258677,null))[_0x68af('0x43')](handleError(_0x258677,null));};exports['removeResources']=function(_0x3a72a0,_0x1714a9,_0x148a17){return db['UserProfile'][_0x68af('0x46')]({'where':{'id':_0x3a72a0['params']['id']}})[_0x68af('0x28')](handleEntityNotFound(_0x1714a9,null))[_0x68af('0x28')](function(_0xaa0fd8){if(_0xaa0fd8){return _0xaa0fd8[_0x68af('0x66')](_0x3a72a0['query'][_0x68af('0x5b')]);}})[_0x68af('0x28')](respondWithStatusCode(_0x1714a9,null))[_0x68af('0x43')](handleError(_0x1714a9,null));};exports[_0x68af('0x67')]=function(_0xc2cfe7,_0x1f2fe8){var _0xd51acf={};if(!_0xc2cfe7['query'][_0x68af('0x68')])throw new Error(_0x68af('0x69'));if(!_0xc2cfe7['query'][_0x68af('0x6a')](_0x68af('0x36'))){_0xd51acf[_0x68af('0x22')]=qs['limit'](_0xc2cfe7[_0x68af('0x31')][_0x68af('0x22')]);_0xd51acf[_0x68af('0x23')]=qs[_0x68af('0x23')](_0xc2cfe7[_0x68af('0x31')][_0x68af('0x23')]);}return db['UserProfile']['find']({'where':{'id':_0xc2cfe7[_0x68af('0x44')]['id']}})[_0x68af('0x28')](function(_0x52d79e){if(!_0x52d79e)throw new Error(_0x68af('0x6b')+_0xc2cfe7[_0x68af('0x44')]['id']);return db['UserProfile'][_0x68af('0x67')](_0xc2cfe7);})['then'](respondWithFilteredResult(_0x1f2fe8,_0xd51acf))[_0x68af('0x43')](handleError(_0x1f2fe8,null));}; \ No newline at end of file +var _0xc177=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','save','destroy','then','error','stack','name','send','index','map','UserProfile','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','options','include','rows','catch','show','params','rawAttributes','includeAll','merge','find','create','body','clone','get','omit','updatedAt','createdAt','sequelize','transaction','UserProfileSection','findAll','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','update','describe','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto'];(function(_0xf479e6,_0x768a94){var _0x160eee=function(_0x56a201){while(--_0x56a201){_0xf479e6['push'](_0xf479e6['shift']());}};_0x160eee(++_0x768a94);}(_0xc177,0x1b2));var _0x7c17=function(_0x5d767f,_0x47778e){_0x5d767f=_0x5d767f-0x0;var _0xa14e09=_0xc177[_0x5d767f];return _0xa14e09;};'use strict';var emlformat=require(_0x7c17('0x0'));var rimraf=require(_0x7c17('0x1'));var zipdir=require(_0x7c17('0x2'));var jsonpatch=require(_0x7c17('0x3'));var rp=require(_0x7c17('0x4'));var moment=require('moment');var BPromise=require(_0x7c17('0x5'));var Mustache=require(_0x7c17('0x6'));var util=require(_0x7c17('0x7'));var path=require(_0x7c17('0x8'));var sox=require('sox');var csv=require(_0x7c17('0x9'));var ejs=require(_0x7c17('0xa'));var fs=require('fs');var fs_extra=require(_0x7c17('0xb'));var _=require('lodash');var squel=require(_0x7c17('0xc'));var crypto=require(_0x7c17('0xd'));var jsforce=require(_0x7c17('0xe'));var deskjs=require(_0x7c17('0xf'));var toCsv=require(_0x7c17('0x9'));var querystring=require(_0x7c17('0x10'));var Papa=require(_0x7c17('0x11'));var Redis=require(_0x7c17('0x12'));var authService=require(_0x7c17('0x13'));var qs=require(_0x7c17('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7c17('0x15'));var utils=require(_0x7c17('0x16'));var config=require(_0x7c17('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x7c17('0x18'))['db'];config[_0x7c17('0x19')]=_[_0x7c17('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7c17('0x1b'))(new Redis(config[_0x7c17('0x19')]));require('./userProfile.socket')[_0x7c17('0x1c')](socket);function respondWithStatusCode(_0x551f10,_0x36f8e2){_0x36f8e2=_0x36f8e2||0xcc;return function(_0x5714b6){if(_0x5714b6){return _0x551f10[_0x7c17('0x1d')](_0x36f8e2);}return _0x551f10[_0x7c17('0x1e')](_0x36f8e2)[_0x7c17('0x1f')]();};}function respondWithResult(_0x33f9cc,_0x2f9348){_0x2f9348=_0x2f9348||0xc8;return function(_0x296211){if(_0x296211){return _0x33f9cc[_0x7c17('0x1e')](_0x2f9348)[_0x7c17('0x20')](_0x296211);}};}function respondWithFilteredResult(_0x37af8c,_0x2ed3d3){return function(_0x24a25d){if(_0x24a25d){var _0x47307a=typeof _0x2ed3d3[_0x7c17('0x21')]===_0x7c17('0x22')&&typeof _0x2ed3d3['limit']===_0x7c17('0x22');var _0x302e4c=_0x24a25d['count'];var _0x291c5e=_0x47307a?0x0:_0x2ed3d3['offset'];var _0x4ffe35=_0x47307a?_0x24a25d[_0x7c17('0x23')]:_0x2ed3d3[_0x7c17('0x21')]+_0x2ed3d3[_0x7c17('0x24')];var _0x5d5b75;if(_0x4ffe35>=_0x302e4c){_0x4ffe35=_0x302e4c;_0x5d5b75=0xc8;}else{_0x5d5b75=0xce;}_0x37af8c[_0x7c17('0x1e')](_0x5d5b75);return _0x37af8c[_0x7c17('0x25')]('Content-Range',_0x291c5e+'-'+_0x4ffe35+'/'+_0x302e4c)[_0x7c17('0x20')](_0x24a25d);}return null;};}function patchUpdates(_0x3d69f6){return function(_0x116f15){try{jsonpatch['apply'](_0x116f15,_0x3d69f6,!![]);}catch(_0x3178fb){return BPromise[_0x7c17('0x26')](_0x3178fb);}return _0x116f15[_0x7c17('0x27')]();};}function saveUpdates(_0x541630,_0xa4f95e){return function(_0x270130){if(_0x270130){return _0x270130['update'](_0x541630)['then'](function(_0x42260f){return _0x42260f;});}return null;};}function removeEntity(_0x2eb4c1,_0xd98e0a){return function(_0x36b5ed){if(_0x36b5ed){return _0x36b5ed[_0x7c17('0x28')]()[_0x7c17('0x29')](function(){_0x2eb4c1['status'](0xcc)[_0x7c17('0x1f')]();});}};}function handleEntityNotFound(_0x29dfd5,_0x44513e){return function(_0xf2c46c){if(!_0xf2c46c){_0x29dfd5[_0x7c17('0x1d')](0x194);}return _0xf2c46c;};}function handleError(_0x38f18b,_0x3c4dd5){_0x3c4dd5=_0x3c4dd5||0x1f4;return function(_0x467bde){logger[_0x7c17('0x2a')](_0x467bde[_0x7c17('0x2b')]);if(_0x467bde[_0x7c17('0x2c')]){delete _0x467bde[_0x7c17('0x2c')];}_0x38f18b[_0x7c17('0x1e')](_0x3c4dd5)[_0x7c17('0x2d')](_0x467bde);};}exports[_0x7c17('0x2e')]=function(_0x1caab8,_0x4ea072){var _0x1378e7={},_0x61a143={},_0x4dd018={'count':0x0,'rows':[]};var _0x98f8f4=_[_0x7c17('0x2f')](db[_0x7c17('0x30')]['rawAttributes'],function(_0x381dd9){return{'name':_0x381dd9['fieldName'],'type':_0x381dd9[_0x7c17('0x31')][_0x7c17('0x32')]};});_0x61a143[_0x7c17('0x33')]=_[_0x7c17('0x2f')](_0x98f8f4,'name');_0x61a143[_0x7c17('0x34')]=_[_0x7c17('0x35')](_0x1caab8[_0x7c17('0x34')]);_0x61a143[_0x7c17('0x36')]=_[_0x7c17('0x37')](_0x61a143[_0x7c17('0x33')],_0x61a143['query']);_0x1378e7[_0x7c17('0x38')]=_[_0x7c17('0x37')](_0x61a143['model'],qs[_0x7c17('0x39')](_0x1caab8[_0x7c17('0x34')]['fields']));_0x1378e7[_0x7c17('0x38')]=_0x1378e7['attributes'][_0x7c17('0x3a')]?_0x1378e7[_0x7c17('0x38')]:_0x61a143[_0x7c17('0x33')];if(!_0x1caab8['query'][_0x7c17('0x3b')](_0x7c17('0x3c'))){_0x1378e7[_0x7c17('0x24')]=qs['limit'](_0x1caab8['query'][_0x7c17('0x24')]);_0x1378e7['offset']=qs[_0x7c17('0x21')](_0x1caab8[_0x7c17('0x34')][_0x7c17('0x21')]);}_0x1378e7['order']=qs[_0x7c17('0x3d')](_0x1caab8[_0x7c17('0x34')][_0x7c17('0x3d')]);_0x1378e7[_0x7c17('0x3e')]=qs[_0x7c17('0x36')](_[_0x7c17('0x3f')](_0x1caab8['query'],_0x61a143[_0x7c17('0x36')]),_0x98f8f4);if(_0x1caab8[_0x7c17('0x34')][_0x7c17('0x40')]){_0x1378e7[_0x7c17('0x3e')]=_['merge'](_0x1378e7[_0x7c17('0x3e')],{'$or':_[_0x7c17('0x2f')](_0x98f8f4,function(_0x5c226d){if(_0x5c226d[_0x7c17('0x31')]!=='VIRTUAL'){var _0x4f6491={};_0x4f6491[_0x5c226d['name']]={'$like':'%'+_0x1caab8[_0x7c17('0x34')][_0x7c17('0x40')]+'%'};return _0x4f6491;}})});}_0x1378e7=_['merge']({},_0x1378e7,_0x1caab8[_0x7c17('0x41')]);var _0x240bb7={'where':_0x1378e7[_0x7c17('0x3e')]};return db[_0x7c17('0x30')][_0x7c17('0x23')](_0x240bb7)[_0x7c17('0x29')](function(_0x35081f){_0x4dd018['count']=_0x35081f;if(_0x1caab8[_0x7c17('0x34')]['includeAll']){_0x1378e7[_0x7c17('0x42')]=[{'all':!![]}];}return db['UserProfile']['findAll'](_0x1378e7);})[_0x7c17('0x29')](function(_0x4f1d70){_0x4dd018[_0x7c17('0x43')]=_0x4f1d70;return _0x4dd018;})[_0x7c17('0x29')](respondWithFilteredResult(_0x4ea072,_0x1378e7))[_0x7c17('0x44')](handleError(_0x4ea072,null));};exports[_0x7c17('0x45')]=function(_0x452f49,_0x1d525a){var _0x115c7c={'raw':![],'where':{'id':_0x452f49[_0x7c17('0x46')]['id']}},_0x12c4c1={};_0x12c4c1[_0x7c17('0x33')]=_[_0x7c17('0x35')](db[_0x7c17('0x30')][_0x7c17('0x47')]);_0x12c4c1[_0x7c17('0x34')]=_[_0x7c17('0x35')](_0x452f49['query']);_0x12c4c1[_0x7c17('0x36')]=_['intersection'](_0x12c4c1[_0x7c17('0x33')],_0x12c4c1[_0x7c17('0x34')]);_0x115c7c['attributes']=_['intersection'](_0x12c4c1['model'],qs[_0x7c17('0x39')](_0x452f49['query']['fields']));_0x115c7c[_0x7c17('0x38')]=_0x115c7c[_0x7c17('0x38')]['length']?_0x115c7c['attributes']:_0x12c4c1[_0x7c17('0x33')];if(_0x452f49['query'][_0x7c17('0x48')]){_0x115c7c[_0x7c17('0x42')]=[{'all':!![]}];}_0x115c7c=_[_0x7c17('0x49')]({},_0x115c7c,_0x452f49['options']);return db[_0x7c17('0x30')][_0x7c17('0x4a')](_0x115c7c)[_0x7c17('0x29')](handleEntityNotFound(_0x1d525a,null))['then'](respondWithResult(_0x1d525a,null))[_0x7c17('0x44')](handleError(_0x1d525a,null));};exports[_0x7c17('0x4b')]=function(_0x1a1099,_0xc1dc81){return db[_0x7c17('0x30')]['create'](_0x1a1099[_0x7c17('0x4c')],{})[_0x7c17('0x29')](respondWithResult(_0xc1dc81,0xc9))[_0x7c17('0x44')](handleError(_0xc1dc81,null));};exports[_0x7c17('0x4d')]=function(_0x644049,_0x3b136f){var _0x471328={'where':{'id':_0x644049[_0x7c17('0x46')]['id']}},_0x147d4e={};_0x147d4e['model']=_['keys'](db[_0x7c17('0x30')]['rawAttributes']);_0x471328[_0x7c17('0x38')]=_['intersection'](_0x147d4e[_0x7c17('0x33')],qs[_0x7c17('0x39')](_0x644049['query']['fields']));_0x471328[_0x7c17('0x38')]=_0x471328[_0x7c17('0x38')][_0x7c17('0x3a')]?_0x471328['attributes']:_0x147d4e[_0x7c17('0x33')];if(_0x644049[_0x7c17('0x34')][_0x7c17('0x48')]){_0x471328[_0x7c17('0x42')]=[{'all':!![]}];}_0x471328=_[_0x7c17('0x49')]({},_0x471328,_0x644049[_0x7c17('0x41')]);return db['UserProfile'][_0x7c17('0x4a')](_0x471328)[_0x7c17('0x29')](handleEntityNotFound(_0x3b136f,null))[_0x7c17('0x29')](function(_0x2a7c77){if(_0x2a7c77){var _0x19458b=_0x2a7c77[_0x7c17('0x4e')]({'plain':!![]});_0x19458b=qs[_0x7c17('0x4f')](_0x19458b,['id','createdAt',_0x7c17('0x50'),'crudPermissions']);_0x644049['body']=_[_0x7c17('0x4f')](_0x644049[_0x7c17('0x4c')],['id',_0x7c17('0x51'),_0x7c17('0x50')]);return db[_0x7c17('0x52')][_0x7c17('0x53')](function(_0x2f6d9c){return db[_0x7c17('0x30')]['create'](_[_0x7c17('0x49')](_0x19458b,_0x644049[_0x7c17('0x4c')]),{'include':_0x644049[_0x7c17('0x34')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x2f6d9c})[_0x7c17('0x29')](function(_0x31f821){var _0x54c559=_0x31f821[_0x7c17('0x4e')]({'plain':!![]});return db[_0x7c17('0x54')][_0x7c17('0x55')]({'where':{'userProfileId':_0x644049['params']['id']},'raw':!![]})[_0x7c17('0x29')](function(_0x1d8754){if(_0x1d8754){return BPromise[_0x7c17('0x56')](_0x1d8754,function(_0xacae9e){return new BPromise(function(_0x58a2a5,_0x121fd4){if(_0xacae9e[_0x7c17('0x57')]===null||_0xacae9e[_0x7c17('0x57')]===0x1)_0x58a2a5(null);return db[_0x7c17('0x58')][_0x7c17('0x55')]({'where':{'sectionId':_0xacae9e['id']},'raw':!![]})[_0x7c17('0x29')](function(_0x1b3858){var _0x2c6bd8=_[_0x7c17('0x2f')](_0x1b3858,function(_0x322dc9){return qs[_0x7c17('0x4f')](_0x322dc9,['id','createdAt','updatedAt',_0x7c17('0x59')]);});_0x58a2a5(_0x2c6bd8);})[_0x7c17('0x44')](function(_0x511ffe){_0x121fd4(_0x511ffe);});})[_0x7c17('0x29')](function(_0x26a6d9){var _0x39bfeb=qs[_0x7c17('0x4f')](_0xacae9e,['id','createdAt',_0x7c17('0x50')]);_0x39bfeb[_0x7c17('0x5a')]=_0x54c559['id'];if(_0x26a6d9)_0x39bfeb[_0x7c17('0x5b')]=_0x26a6d9;return _0x39bfeb;})[_0x7c17('0x29')](function(_0x540f6a){return db['UserProfileSection']['create'](_0x540f6a,{'include':[{'model':db['UserProfileResource'],'as':_0x7c17('0x5b')}],'raw':!![],'transaction':_0x2f6d9c});});})[_0x7c17('0x29')](function(){return _0x54c559;});}});});});}})['then'](respondWithResult(_0x3b136f,0xc9))[_0x7c17('0x44')](handleError(_0x3b136f,null));};exports[_0x7c17('0x5c')]=function(_0x5d5bed,_0x1fea19){if(_0x5d5bed['body']['id']){delete _0x5d5bed[_0x7c17('0x4c')]['id'];}return db[_0x7c17('0x30')]['find']({'where':{'id':_0x5d5bed['params']['id']}})[_0x7c17('0x29')](handleEntityNotFound(_0x1fea19,null))[_0x7c17('0x29')](saveUpdates(_0x5d5bed[_0x7c17('0x4c')],null))[_0x7c17('0x29')](respondWithResult(_0x1fea19,null))[_0x7c17('0x44')](handleError(_0x1fea19,null));};exports[_0x7c17('0x28')]=function(_0x43d57b,_0x7aec57){return db[_0x7c17('0x30')][_0x7c17('0x4a')]({'where':{'id':_0x43d57b[_0x7c17('0x46')]['id']}})[_0x7c17('0x29')](handleEntityNotFound(_0x7aec57,null))[_0x7c17('0x29')](removeEntity(_0x7aec57,null))[_0x7c17('0x44')](handleError(_0x7aec57,null));};exports['describe']=function(_0x4c81f8,_0x5e2349){return db[_0x7c17('0x30')][_0x7c17('0x5d')]()[_0x7c17('0x29')](respondWithResult(_0x5e2349,null))['catch'](handleError(_0x5e2349,null));};exports['addSections']=function(_0x239d36,_0x17f32d){var _0x12d6b5=_0x239d36[_0x7c17('0x4c')];return db['UserProfile']['find']({'where':{'id':_0x239d36[_0x7c17('0x46')]['id']}})['then'](handleEntityNotFound(_0x17f32d,null))[_0x7c17('0x29')](function(_0x21d07e){if(_0x21d07e){return db['sequelize'][_0x7c17('0x53')](function(_0x1cd3c1){return db[_0x7c17('0x54')][_0x7c17('0x28')]({'where':{'userProfileId':_0x239d36[_0x7c17('0x46')]['id'],'sectionId':_['map'](_0x12d6b5,function(_0x269084){return _0x269084[_0x7c17('0x59')];})},'transaction':_0x1cd3c1})[_0x7c17('0x29')](function(){var _0x595452=_[_0x7c17('0x2f')](_0x12d6b5,function(_0x373ce6){_0x373ce6['userProfileId']=_0x239d36['params']['id'];return _0x373ce6;});var _0x24a530=[];return BPromise['each'](_0x595452,function(_0x12e224){return db[_0x7c17('0x54')]['create'](_0x12e224,{'include':[{'model':db[_0x7c17('0x58')],'as':_0x7c17('0x5b')}],'raw':!![],'transaction':_0x1cd3c1})['then'](function(_0x241371){_0x24a530[_0x7c17('0x5e')](_0x241371[_0x7c17('0x4e')]({'plain':!![]}));});})['then'](function(){return _0x24a530;});});});}})[_0x7c17('0x29')](function(_0x16b4de){return _0x16b4de;})[_0x7c17('0x29')](respondWithResult(_0x17f32d,null))[_0x7c17('0x44')](handleError(_0x17f32d,null));};exports[_0x7c17('0x5f')]=function(_0x5cea5b,_0x324e4a){var _0x3fa78e;return db[_0x7c17('0x30')][_0x7c17('0x4a')]({'where':{'id':_0x5cea5b[_0x7c17('0x46')]['id']},'attributes':['id',_0x7c17('0x2c')]})[_0x7c17('0x29')](handleEntityNotFound(_0x324e4a,null))[_0x7c17('0x29')](function(_0x1dae4f){if(_0x1dae4f){_0x3fa78e=_0x1dae4f;return db[_0x7c17('0x54')][_0x7c17('0x28')]({'where':{'userProfileId':_0x5cea5b['params']['id'],'sectionId':_0x5cea5b[_0x7c17('0x34')][_0x7c17('0x60')]}});}})[_0x7c17('0x29')](function(){return _0x3fa78e;})['then'](respondWithStatusCode(_0x324e4a,null))[_0x7c17('0x44')](handleError(_0x324e4a,null));};exports[_0x7c17('0x61')]=function(_0x5bbac7,_0x113b33){var _0x3ab6f0=[];var _0x4b4641=[];return db['UserProfileSection'][_0x7c17('0x55')]({'where':{'userProfileId':_0x5bbac7[_0x7c17('0x46')]['id']},'raw':!![]})['then'](function(_0x555fa9){_0x3ab6f0=_[_0x7c17('0x40')](_0x555fa9,function(_0x5abc25){return _0x5abc25[_0x7c17('0x62')]===0x1||_[_0x7c17('0x63')]([0x3eb,0x709],_0x5abc25['sectionId']);});if(!_[_0x7c17('0x64')](_0x3ab6f0)){return _[_0x7c17('0x2f')](_0x3ab6f0,function(_0x7b24bf){return _0x7b24bf[_0x7c17('0x59')];});}else{return;}})[_0x7c17('0x29')](function(_0x1a27c9){if(_0x1a27c9)_0x4b4641=_0x1a27c9;if(_[_0x7c17('0x63')](_0x4b4641,0x64)){var _0x1964cf=_[_0x7c17('0x4a')](_0x3ab6f0,{'sectionId':0x64});return hasDefaultDashboard(_0x1964cf)['then'](function(_0x433e59){return _['map'](_0x3ab6f0,function(_0x23cbd3){if(_0x23cbd3['sectionId']===0x64){_0x23cbd3[_0x7c17('0x65')]=_0x433e59;}return _0x23cbd3;});});}else{return;}})[_0x7c17('0x29')](function(_0x298aa0){if(_0x298aa0)_0x3ab6f0=_0x298aa0;if(_['includes'](_0x4b4641,0x3eb)){var _0x779406=_[_0x7c17('0x4a')](_0x3ab6f0,{'sectionId':0x3eb});return getCustomDashboards(_0x779406)[_0x7c17('0x29')](function(_0xef373){return _[_0x7c17('0x2f')](_0x3ab6f0,function(_0x5384cc){if(_0x779406['enabled']){if(_0x5384cc[_0x7c17('0x59')]===0x3eb){_0x5384cc[_0x7c17('0x65')]=_0xef373;}}else{if(_0x5384cc[_0x7c17('0x59')]===0x64){_0x5384cc[_0x7c17('0x65')]=_0xef373;}}return _0x5384cc;});});}else{return;}})[_0x7c17('0x29')](function(_0x315000){if(_0x315000)_0x3ab6f0=_0x315000;if(_[_0x7c17('0x63')](_0x4b4641,0x709)){var _0x636757=_[_0x7c17('0x4a')](_0x3ab6f0,{'sectionId':0x709});return getPlugins(_0x636757)[_0x7c17('0x29')](function(_0x10bae9){if(_0x636757[_0x7c17('0x62')]){return _[_0x7c17('0x2f')](_0x3ab6f0,function(_0x3e2b0c){if(_0x3e2b0c[_0x7c17('0x59')]===0x709){_0x3e2b0c[_0x7c17('0x65')]=_0x10bae9;}return _0x3e2b0c;});}else{var _0x1d6617={'sectionId':0x76c,'enabled':0x1,'subsections':_0x10bae9};var _0x1a5dfc=_['map'](_0x3ab6f0);_0x1a5dfc[_0x7c17('0x5e')](_0x1d6617);return _0x1a5dfc;}});}else{return;}})[_0x7c17('0x29')](function(_0x22338b){if(_0x22338b)_0x3ab6f0=_0x22338b;return _[_0x7c17('0x40')](_0x3ab6f0,[_0x7c17('0x62'),0x1]);})[_0x7c17('0x29')](respondWithResult(_0x113b33,null))['catch'](handleError(_0x113b33,null));};function hasDefaultDashboard(_0x282150){var _0x31e478=[0x65];return new BPromise(function(_0x1004b6,_0x49d522){try{if(_0x282150[_0x7c17('0x57')]){_0x1004b6(_0x31e478);}else{return db[_0x7c17('0x58')][_0x7c17('0x66')]({'where':{'sectionId':_0x282150['id']},'raw':!![]})[_0x7c17('0x29')](function(_0x38676d){_0x38676d?_0x1004b6(_0x31e478):_0x1004b6();});}}catch(_0x3ef0f9){_0x49d522(_0x3ef0f9);}});}function getCustomDashboards(_0x50e28f){var _0x99e34e=[];return new BPromise(function(_0x32c202,_0x5cacb8){try{if(_0x50e28f[_0x7c17('0x57')]){return db[_0x7c17('0x67')]['findAll']({'raw':!![]})[_0x7c17('0x29')](function(_0x5b074c){_0x5b074c[_0x7c17('0x68')](function(_0x7ad2ae){_0x99e34e[_0x7c17('0x5e')](_0x7ad2ae['id']+0x1869f);});_0x32c202(_0x99e34e);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x50e28f['id']},'raw':!![]})[_0x7c17('0x29')](function(_0x404987){_0x404987['forEach'](function(_0x13f5db){_0x99e34e[_0x7c17('0x5e')](_0x13f5db[_0x7c17('0x69')]+0x1869f);});_0x32c202(_0x99e34e);});}}catch(_0x100d9a){_0x5cacb8(_0x100d9a);}});}function getPlugins(_0x3bae4b){var _0x5c460a=[];return new BPromise(function(_0x351a60,_0x1cf96e){try{if(_0x3bae4b[_0x7c17('0x57')]){return db[_0x7c17('0x6a')][_0x7c17('0x55')]({'raw':!![]})[_0x7c17('0x29')](function(_0x319b4a){_0x319b4a[_0x7c17('0x68')](function(_0x406c35){_0x5c460a[_0x7c17('0x5e')](_0x406c35['id']+0x15b38);});_0x351a60(_0x5c460a);});}else{return db[_0x7c17('0x58')][_0x7c17('0x55')]({'where':{'sectionId':_0x3bae4b['id']},'raw':!![]})[_0x7c17('0x29')](function(_0x12ee2f){_0x12ee2f[_0x7c17('0x68')](function(_0x438fc4){_0x5c460a[_0x7c17('0x5e')](_0x438fc4[_0x7c17('0x69')]+0x15b38);});_0x351a60(_0x5c460a);});}}catch(_0x1e1861){_0x1cf96e(_0x1e1861);}});}exports[_0x7c17('0x6b')]=function(_0x3d5f96,_0x25533a){return db[_0x7c17('0x30')]['find']({'where':{'id':_0x3d5f96[_0x7c17('0x46')]['id']}})[_0x7c17('0x29')](handleEntityNotFound(_0x25533a,null))[_0x7c17('0x29')](function(_0x430e53){if(_0x430e53){return db['sequelize'][_0x7c17('0x53')](function(_0x434965){return db[_0x7c17('0x54')][_0x7c17('0x55')]({'where':{'userProfileId':_0x3d5f96[_0x7c17('0x46')]['id']},'attributes':['id'],'raw':!![]})[_0x7c17('0x29')](function(_0x2ce70a){if(_0x2ce70a){return db[_0x7c17('0x54')][_0x7c17('0x28')]({'where':{'userProfileId':_0x3d5f96[_0x7c17('0x46')]['id'],'id':_[_0x7c17('0x2f')](_0x2ce70a,function(_0x690ef8){return _0x690ef8['id'];})},'transaction':_0x434965});}})['then'](function(_0x10aa69){var _0x4ba3c5=_['map'](_0x3d5f96[_0x7c17('0x4c')],function(_0x56a7f1){_0x56a7f1[_0x7c17('0x5a')]=_0x3d5f96[_0x7c17('0x46')]['id'];return _0x56a7f1;});return db[_0x7c17('0x54')][_0x7c17('0x6c')](_0x4ba3c5,{'raw':!![],'transaction':_0x434965});})['then'](function(_0x2ff961){var _0x477788=_[_0x7c17('0x40')](_['map'](_0x2ff961,function(_0x221529){return _0x221529['get']({'plain':!![]});}),{'includeAll':![]});if(_0x477788){return db[_0x7c17('0x54')][_0x7c17('0x55')]({'where':{'userProfileId':_0x3d5f96[_0x7c17('0x46')]['id'],'sectionId':_[_0x7c17('0x2f')](_0x477788,function(_0x1d862c){return _0x1d862c[_0x7c17('0x59')];})},'attributes':['id',_0x7c17('0x59')],'raw':!![]})[_0x7c17('0x29')](function(_0x5a8aff){var _0x33debe=_['map'](_0x3d5f96[_0x7c17('0x4c')],function(_0x3f9d0d){_0x3f9d0d[_0x7c17('0x5a')]=_0x3d5f96['params']['id'];return _0x3f9d0d;});return db[_0x7c17('0x58')][_0x7c17('0x6c')](_0x33debe,{'raw':!![],'transaction':_0x434965});});}})['catch'](handleError(_0x25533a,null));});}})[_0x7c17('0x29')](function(_0x128289){var _0x3eff21=_['map'](_0x128289,function(_0x362e3f){return _0x362e3f[_0x7c17('0x4e')]({'plain':!![]});});})[_0x7c17('0x29')](respondWithResult(_0x25533a,null))[_0x7c17('0x44')](handleError(_0x25533a,null));};exports[_0x7c17('0x6d')]=function(_0x61fd3a,_0x4af4f9,_0x37487a){return db[_0x7c17('0x30')]['find']({'where':{'id':_0x61fd3a[_0x7c17('0x46')]['id']}})[_0x7c17('0x29')](handleEntityNotFound(_0x4af4f9,null))['then'](function(_0x230d66){if(_0x230d66){return _0x230d66['removeResources'](_0x61fd3a[_0x7c17('0x34')][_0x7c17('0x60')]);}})[_0x7c17('0x29')](respondWithStatusCode(_0x4af4f9,null))[_0x7c17('0x44')](handleError(_0x4af4f9,null));};exports['getResources']=function(_0x593295,_0x546191){var _0xc8939d={};if(!_0x593295[_0x7c17('0x34')]['section'])throw new Error(_0x7c17('0x6e'));if(!_0x593295[_0x7c17('0x34')][_0x7c17('0x3b')](_0x7c17('0x3c'))){_0xc8939d[_0x7c17('0x24')]=qs[_0x7c17('0x24')](_0x593295[_0x7c17('0x34')][_0x7c17('0x24')]);_0xc8939d[_0x7c17('0x21')]=qs['offset'](_0x593295[_0x7c17('0x34')][_0x7c17('0x21')]);}return db[_0x7c17('0x30')][_0x7c17('0x4a')]({'where':{'id':_0x593295[_0x7c17('0x46')]['id']}})[_0x7c17('0x29')](function(_0x1f6266){if(!_0x1f6266)throw new Error(_0x7c17('0x6f')+_0x593295[_0x7c17('0x46')]['id']);return db[_0x7c17('0x30')]['getResources'](_0x593295);})[_0x7c17('0x29')](respondWithFilteredResult(_0x546191,_0xc8939d))[_0x7c17('0x44')](handleError(_0x546191,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 76a8764..76d234a 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 _0xde46=['UserProfile','setMaxListeners','remove','emit','hook','events','../../mysqldb'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0xde46,0x14e));var _0x6de4=function(_0x28340a,_0x205ccb){_0x28340a=_0x28340a-0x0;var _0x3dee26=_0xde46[_0x28340a];return _0x3dee26;};'use strict';var EventEmitter=require(_0x6de4('0x0'));var UserProfile=require(_0x6de4('0x1'))['db'][_0x6de4('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x6de4('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x6de4('0x4')};function emitEvent(_0x5ddab6){return function(_0x2aec40,_0x19e9a6,_0xd7f8a7){UserProfileEvents[_0x6de4('0x5')](_0x5ddab6+':'+_0x2aec40['id'],_0x2aec40);UserProfileEvents['emit'](_0x5ddab6,_0x2aec40);_0xd7f8a7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x6de4('0x6')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0xdb8b=['remove','emit','hasOwnProperty','exports','../../mysqldb','UserProfile','setMaxListeners'];(function(_0x1dd79a,_0x1ef8cb){var _0xdd42db=function(_0x2bfe7d){while(--_0x2bfe7d){_0x1dd79a['push'](_0x1dd79a['shift']());}};_0xdd42db(++_0x1ef8cb);}(_0xdb8b,0x1c4));var _0xbdb8=function(_0x4eb365,_0x42e2bf){_0x4eb365=_0x4eb365-0x0;var _0x4edcb8=_0xdb8b[_0x4eb365];return _0x4edcb8;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0xbdb8('0x0'))['db'][_0xbdb8('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xbdb8('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xbdb8('0x3')};function emitEvent(_0x5e5f57){return function(_0x3149c6,_0x2ec8cc,_0x33b3d2){UserProfileEvents[_0xbdb8('0x4')](_0x5e5f57+':'+_0x3149c6['id'],_0x3149c6);UserProfileEvents['emit'](_0x5e5f57,_0x3149c6);_0x33b3d2(null);};}for(var e in events){if(events[_0xbdb8('0x5')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0xbdb8('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 7928f9e..7f1bfa0 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 _0x7fda=['metrics','toUpperCase','slice','Sequelize','QueryTypes','SELECT','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','where','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','section','mergeResources','Invalid\x20section\x20\x27','length','push','UserProfileSection','all','ignore','isEmpty','union','autoAssociation','rawAttributes','keys','intersection','attributes','fields','nolimit','limit','offset','sort','filters','merge','key','VIRTUAL','foreignKey','forEach','options','includeAll','include','default','find','DefaultReports','CustomReports','rows','count','Tags','color','tag','ThroughTags','openTabs','true','chat','sms','fax','dataValues','mail','openchannel','lodash','./userProfile.attributes','exports','models','filter','field','value','findAll','then','map','catch','model','associatedResources','name','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','SquareOdbc','SquareRecording','parentSections','JscriptyProject','contacts','CmContact','Lists','ListId','lists','CmList','companies','globalcustomfields','chatqueues','ChatQueue','ChatWebsite','faxqueues','FaxQueue','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','Telephones','telephone','VoiceQueues','VoiceQueue','QueueCampaigns','queue','outbound','musiconholds','chanspies','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','OpenchannelQueue','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','Users','admin','user','ZendeskAccount','SalesforceAccount','FreshdeskAccount','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','vtigeraccounts','Disposition','customdashboards','Dashboard','Interval','Pause','Schedule','tags','Tag','templates','Template','triggers','trunks','Trunk','variables','Plugin','extractedreports','reportId'];(function(_0xeb67fa,_0x4dda10){var _0x534ecb=function(_0x3d4058){while(--_0x3d4058){_0xeb67fa['push'](_0xeb67fa['shift']());}};_0x534ecb(++_0x4dda10);}(_0x7fda,0xf4));var _0xa7fd=function(_0x2d638f,_0x368a4f){_0x2d638f=_0x2d638f-0x0;var _0x4d07bd=_0x7fda[_0x2d638f];return _0x4d07bd;};'use strict';var _=require(_0xa7fd('0x0'));var attributes=require(_0xa7fd('0x1'));var qs=require('../../components/parsers/qs');module[_0xa7fd('0x2')]=function(_0x36f305){var _0x2d82a1=_0x36f305[_0xa7fd('0x3')];function _0x515c3a(_0x4115c9,_0x553dad){return new Promise(function(_0x3980d8,_0x4255c0){if(!_0x553dad)return _0x3980d8(null);var _0x57545d=_0x553dad[_0xa7fd('0x4')]?{[_0x553dad[_0xa7fd('0x4')][_0xa7fd('0x5')]]:_0x553dad[_0xa7fd('0x4')][_0xa7fd('0x6')]}:undefined;return _0x2d82a1[_0x4115c9][_0xa7fd('0x7')]({'where':_0x57545d,'raw':!![]})[_0xa7fd('0x8')](function(_0x315bf9){_0x553dad['associatedResources']=_[_0xa7fd('0x9')](_0x315bf9,'id');_0x3980d8(_0x553dad);})[_0xa7fd('0xa')](function(_0x1c71ad){_0x4255c0(_0x1c71ad);});});}function _0x5e3bd4(_0x12d4dd,_0x42353f){return new Promise(function(_0x88a76e,_0xe8ca3d){var _0x1c60f7=_0x12d4dd['filter']?{[_0x12d4dd[_0xa7fd('0x4')][_0xa7fd('0x5')]]:_0x12d4dd[_0xa7fd('0x4')][_0xa7fd('0x6')]}:undefined;return _0x2d82a1[_0x12d4dd[_0xa7fd('0xb')]][_0xa7fd('0x7')]({'where':_0x1c60f7,'raw':!![]})['then'](function(_0x4df152){_0x42353f[_0xa7fd('0xc')]=_[_0xa7fd('0x9')](_0x4df152,function(_0x4acdf5){return _0x4acdf5[_0xa7fd('0xd')];});_0x88a76e(_0x42353f);})[_0xa7fd('0xa')](function(_0x4684fa){_0xe8ca3d(_0x4684fa);});});}function _0x533bed(_0xb3b5a9,_0x2cc993,_0x5b5ac8){if(!_0x2cc993)return resolve(null);return new Promise(function(_0x13f7f0,_0xf9268f){return _0x2d82a1[_0xa7fd('0xe')][_0xa7fd('0x7')]({'where':{'sectionId':_0x2cc993['id']},'raw':!![]})[_0xa7fd('0x8')](function(_0x32be1c){if(_0xb3b5a9['field']&&_0xb3b5a9[_0xa7fd('0x5')]!=='id'){_0x2cc993[_0xa7fd('0xc')]=_['map'](_0x32be1c,function(_0x2eccfe){return _0x2eccfe[_0xb3b5a9[_0xa7fd('0x5')]];});}else{if(_0x5b5ac8===_0xa7fd('0xf')){_0x2cc993['associatedResources']=_[_0xa7fd('0x9')](_0x32be1c,function(_0x503cca){return{'id':_0x503cca[_0xa7fd('0x10')],'type':_0x503cca[_0xa7fd('0x11')]};});}else{_0x2cc993[_0xa7fd('0xc')]=_[_0xa7fd('0x9')](_0x32be1c,function(_0x1df448){return _0x1df448[_0xa7fd('0x10')];});}}_0x13f7f0(_0x2cc993);})[_0xa7fd('0xa')](function(_0x5b6e9e){_0xf9268f(_0x5b6e9e);});});}function _0x48088b(_0x22a486,_0x3b0562){var _0x302a78={'parentSections':[]};switch(_0x22a486[_0xa7fd('0x12')]()){case _0xa7fd('0x13'):_0x302a78[_0xa7fd('0x14')]=_0xa7fd('0x15');break;case'odbc':_0x302a78['childModel']=_0xa7fd('0x16');break;case'squarerecordings':_0x302a78['childModel']=_0xa7fd('0x17');_0x302a78[_0xa7fd('0x18')]=[{'name':'SquareProjects','field':_0xa7fd('0xd'),'foreignKey':'projectName'}];break;case'projects':_0x302a78[_0xa7fd('0x14')]=_0xa7fd('0x19');break;case _0xa7fd('0x1a'):_0x302a78[_0xa7fd('0x14')]=_0xa7fd('0x1b');_0x302a78[_0xa7fd('0x18')]=[{'name':_0xa7fd('0x1c'),'field':'id','foreignKey':_0xa7fd('0x1d')}];break;case _0xa7fd('0x1e'):_0x302a78['childModel']=_0xa7fd('0x1f');break;case _0xa7fd('0x20'):_0x302a78[_0xa7fd('0x14')]='CmCompany';break;case _0xa7fd('0x21'):_0x302a78[_0xa7fd('0x14')]='CmCustomField';break;case _0xa7fd('0x22'):_0x302a78['childModel']=_0xa7fd('0x23');break;case'chatwebsites':_0x302a78[_0xa7fd('0x14')]=_0xa7fd('0x24');break;case _0xa7fd('0x25'):_0x302a78[_0xa7fd('0x14')]=_0xa7fd('0x26');break;case'faxaccounts':_0x302a78[_0xa7fd('0x14')]=_0xa7fd('0x27');break;case _0xa7fd('0x28'):case _0xa7fd('0x29'):case _0xa7fd('0x2a'):_0x302a78[_0xa7fd('0x14')]=_0xa7fd('0x2b');break;case'contexts':_0x302a78[_0xa7fd('0x14')]=_0xa7fd('0x2c');break;case _0xa7fd('0x2d'):_0x302a78[_0xa7fd('0x14')]=_0xa7fd('0x2e');break;case _0xa7fd('0x2f'):_0x302a78[_0xa7fd('0x14')]=_0xa7fd('0x30');_0x302a78[_0xa7fd('0x18')]=[{'name':_0xa7fd('0x31'),'field':'name','foreignKey':_0xa7fd('0x32'),'model':_0xa7fd('0x33'),'filter':{'field':_0xa7fd('0x34'),'value':['agent']}},{'name':_0xa7fd('0x35'),'field':_0xa7fd('0xd'),'foreignKey':_0xa7fd('0x32'),'model':'User','filter':{'field':_0xa7fd('0x34'),'value':[_0xa7fd('0x36')]}},{'name':_0xa7fd('0x37'),'field':_0xa7fd('0xd'),'foreignKey':'queue','model':_0xa7fd('0x38'),'filter':{'field':'type','value':['inbound']}},{'name':_0xa7fd('0x39'),'field':_0xa7fd('0xd'),'foreignKey':_0xa7fd('0x3a'),'model':_0xa7fd('0x38'),'filter':{'field':_0xa7fd('0x11'),'value':[_0xa7fd('0x3b')]}}];break;case _0xa7fd('0x3c'):_0x302a78[_0xa7fd('0x14')]='VoiceMusicOnHold';break;case _0xa7fd('0x3d'):_0x302a78[_0xa7fd('0x14')]='VoiceChanSpy';break;case'voiceprefixes':_0x302a78[_0xa7fd('0x14')]=_0xa7fd('0x3e');break;case _0xa7fd('0x3f'):_0x302a78[_0xa7fd('0x14')]=_0xa7fd('0x40');break;case _0xa7fd('0x41'):_0x302a78['childModel']=_0xa7fd('0x42');break;case _0xa7fd('0x43'):_0x302a78[_0xa7fd('0x14')]=_0xa7fd('0x44');break;case _0xa7fd('0x45'):_0x302a78[_0xa7fd('0x14')]='MailSubstatus';break;case'openchannelqueues':_0x302a78['childModel']=_0xa7fd('0x46');break;case'openchannelaccounts':_0x302a78[_0xa7fd('0x14')]=_0xa7fd('0x47');break;case _0xa7fd('0x48'):_0x302a78['childModel']=_0xa7fd('0x49');break;case _0xa7fd('0x4a'):_0x302a78[_0xa7fd('0x14')]=_0xa7fd('0x4b');break;case _0xa7fd('0x4c'):_0x302a78[_0xa7fd('0x14')]='WhatsappQueue';break;case _0xa7fd('0x4d'):_0x302a78['childModel']=_0xa7fd('0x4e');break;case _0xa7fd('0x4f'):_0x302a78[_0xa7fd('0x14')]=_0xa7fd('0x50');break;case _0xa7fd('0x51'):case'queuecampaigns':_0x302a78[_0xa7fd('0x14')]='VoiceQueue';if(_0x3b0562){_0x302a78[_0xa7fd('0x18')]=[{'name':_0xa7fd('0x37')},{'name':_0xa7fd('0x39')}];}break;case'users':case'agents':case'telephones':_0x302a78[_0xa7fd('0x14')]=_0xa7fd('0x33');if(_0x3b0562){_0x302a78[_0xa7fd('0x18')]=[{'name':_0xa7fd('0x52'),'filter':{'field':_0xa7fd('0x34'),'value':[_0xa7fd('0x53'),_0xa7fd('0x54')]},'ignore':!![]},{'name':'Agents'},{'name':_0xa7fd('0x35')}];}break;case'zendeskaccounts':_0x302a78[_0xa7fd('0x14')]=_0xa7fd('0x55');break;case'salesforceaccounts':_0x302a78['childModel']=_0xa7fd('0x56');break;case'freshdeskaccounts':_0x302a78[_0xa7fd('0x14')]=_0xa7fd('0x57');break;case'sugarcrmaccounts':_0x302a78[_0xa7fd('0x14')]=_0xa7fd('0x58');break;case _0xa7fd('0x59'):_0x302a78[_0xa7fd('0x14')]=_0xa7fd('0x5a');break;case _0xa7fd('0x5b'):_0x302a78[_0xa7fd('0x14')]='ZohoAccount';break;case _0xa7fd('0x5c'):_0x302a78[_0xa7fd('0x14')]='User';break;case'cannedanswers':_0x302a78[_0xa7fd('0x14')]='CannedAnswer';break;case'dispositions':_0x302a78[_0xa7fd('0x14')]=_0xa7fd('0x5d');break;case _0xa7fd('0x5e'):_0x302a78[_0xa7fd('0x14')]=_0xa7fd('0x5f');break;case'intervals':_0x302a78[_0xa7fd('0x14')]=_0xa7fd('0x60');break;case'pauses':_0x302a78[_0xa7fd('0x14')]=_0xa7fd('0x61');break;case'scheduler':_0x302a78[_0xa7fd('0x14')]=_0xa7fd('0x62');break;case'sounds':_0x302a78[_0xa7fd('0x14')]='Sound';break;case _0xa7fd('0x63'):_0x302a78[_0xa7fd('0x14')]=_0xa7fd('0x64');break;case _0xa7fd('0x65'):_0x302a78[_0xa7fd('0x14')]=_0xa7fd('0x66');break;case _0xa7fd('0x67'):_0x302a78['childModel']='Trigger';break;case _0xa7fd('0x68'):_0x302a78['childModel']=_0xa7fd('0x69');break;case _0xa7fd('0x6a'):_0x302a78['childModel']='Variable';break;case'plugins':_0x302a78[_0xa7fd('0x14')]=_0xa7fd('0x6b');break;case _0xa7fd('0x6c'):_0x302a78['childModel']=_0xa7fd('0xf');_0x302a78[_0xa7fd('0x18')]=[{'name':'Reports','field':'id','foreignKey':_0xa7fd('0x6d')}];break;case _0xa7fd('0x6e'):_0x302a78[_0xa7fd('0x14')]='AnalyticMetric';break;case _0xa7fd('0x4d'):_0x302a78[_0xa7fd('0x14')]=_0xa7fd('0x4e');break;}return _0x302a78;}function _0x10a4e1(_0x3b9dbd,_0x34d0d3){var _0x2d817b=_0x3b9dbd['charAt'](0x0)[_0xa7fd('0x6f')]()+_0x3b9dbd[_0xa7fd('0x70')](0x1);var _0x2b9dbb={'type':_0x2d82a1[_0xa7fd('0x71')][_0xa7fd('0x72')][_0xa7fd('0x73')],'raw':!![]};return new BPromise(function(_0xc4c9c,_0x244047){var _0x112de5=squel['select']()[_0xa7fd('0x5')](_0xa7fd('0x74')+_0x2d817b+_0xa7fd('0x75'),'id')['field'](_0xa7fd('0x76'))[_0xa7fd('0x77')](_0xa7fd('0x78')+_0x3b9dbd+_0xa7fd('0x79'),'ui')[_0xa7fd('0x7a')]('ui.UserId\x20=\x20?',_0x34d0d3['id']);return _0x2d82a1[_0xa7fd('0x7b')][_0xa7fd('0x7c')](_0x112de5[_0xa7fd('0x7d')](),_0x2b9dbb)[_0xa7fd('0x8')](function(_0x26c247){_0x34d0d3[_0x2d817b+_0xa7fd('0x7e')]=_0x26c247;_0xc4c9c(_0x26c247);})[_0xa7fd('0xa')](function(_0x168c4d){_0x244047(_0x168c4d);});});}return _0x36f305[_0xa7fd('0x7f')](_0xa7fd('0x80'),attributes,{'tableName':_0xa7fd('0x81'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x3285ed){var _0x579061={'raw':![],'where':{}};var _0x22449b={};var _0x21b158={'count':0x0,'rows':[]};var _0x2d6242=_0x3285ed[_0xa7fd('0x7c')][_0xa7fd('0x82')];var _0x1919ee=_0x3285ed[_0xa7fd('0x7c')][_0xa7fd('0x83')]||![];var _0x2a516c=_0x48088b(_0x2d6242,_0x1919ee);if(!_0x2a516c[_0xa7fd('0x14')])throw new Error(_0xa7fd('0x84')+_0x2d6242+'\x27');var _0x19cd16=[{'name':_0x2d6242}];if(!_['isEmpty'](_0x2a516c[_0xa7fd('0x18')]))_0x19cd16=_0x2a516c[_0xa7fd('0x18')];var _0x179e99=[];for(var _0x46e6f4=0x0;_0x46e6f4<_0x19cd16[_0xa7fd('0x85')];_0x46e6f4++){_0x179e99[_0xa7fd('0x86')](_0x2d82a1[_0xa7fd('0x87')]['find']({'where':{'userProfileId':_0x3285ed['params']['id'],'name':_0x19cd16[_0x46e6f4]['name']},'raw':!![]}));}return Promise[_0xa7fd('0x88')](_0x179e99)[_0xa7fd('0x8')](function(_0x32c490){var _0xd4aa3f=_[_0xa7fd('0x4')](_0x32c490,function(_0x5731d2){return _0x5731d2?_0x5731d2:undefined;});var _0x204992=_[_0xa7fd('0x4')](_0x19cd16,[_0xa7fd('0x89'),!![]]);var _0x1782da=_[_0xa7fd('0x8a')](_0xd4aa3f)&&_[_0xa7fd('0x8a')](_0x204992)?null:_[_0xa7fd('0x8b')](_0x204992,_0xd4aa3f);if(!_0x1782da)return null;var _0x2f58d0=[];for(var _0x2eb646=0x0;_0x2eb646<_0x1782da[_0xa7fd('0x85')];_0x2eb646++){var _0x340055=_['find'](_0x19cd16,function(_0x46c53f){return _0x1782da[_0x2eb646]?_0x46c53f[_0xa7fd('0xd')]===_0x1782da[_0x2eb646][_0xa7fd('0xd')]:null;});if(_0x340055){if(_0x1782da[_0x2eb646][_0xa7fd('0x89')]){_0x2f58d0[_0xa7fd('0x86')](_0x515c3a(_0x2a516c[_0xa7fd('0x14')],_0x1782da[_0x2eb646]));}else{if(!_0x1782da[_0x2eb646][_0xa7fd('0x8c')]){_0x2f58d0[_0xa7fd('0x86')](_0x533bed(_0x340055,_0x1782da[_0x2eb646],_0x2a516c['childModel']));}else{if(_0x340055[_0xa7fd('0xb')]){_0x2f58d0[_0xa7fd('0x86')](_0x5e3bd4(_0x340055,_0x1782da[_0x2eb646]));}}}}}return Promise[_0xa7fd('0x88')](_0x2f58d0);})[_0xa7fd('0x8')](function(_0x4367d8){var _0x333eaa=_0x4367d8;var _0x334595=null;if(_0x333eaa){_0x334595=_0x333eaa[_0xa7fd('0x85')]===0x1?_0x333eaa[0x0]:null;}if(!_0x334595&&!_0x333eaa)return _0x21b158;var _0x562f09=_0x2d82a1[_0x2a516c[_0xa7fd('0x14')]][_0xa7fd('0x8d')];_0x22449b['model']=_['keys'](_0x562f09);_0x22449b[_0xa7fd('0x7c')]=_[_0xa7fd('0x8e')](_0x3285ed[_0xa7fd('0x7c')]);_0x22449b['filters']=_[_0xa7fd('0x8f')](_0x22449b[_0xa7fd('0xb')],_0x22449b[_0xa7fd('0x7c')]);_0x579061[_0xa7fd('0x90')]=_[_0xa7fd('0x8f')](_0x22449b[_0xa7fd('0xb')],qs[_0xa7fd('0x91')](_0x3285ed['query'][_0xa7fd('0x91')]));_0x579061[_0xa7fd('0x90')]=_0x579061[_0xa7fd('0x90')][_0xa7fd('0x85')]?_0x579061[_0xa7fd('0x90')]:_0x22449b[_0xa7fd('0xb')];if(!_0x3285ed[_0xa7fd('0x7c')]['hasOwnProperty'](_0xa7fd('0x92'))){_0x579061['limit']=qs[_0xa7fd('0x93')](_0x3285ed[_0xa7fd('0x7c')][_0xa7fd('0x93')]);_0x579061[_0xa7fd('0x94')]=qs[_0xa7fd('0x94')](_0x3285ed[_0xa7fd('0x7c')][_0xa7fd('0x94')]);}_0x579061['order']=qs[_0xa7fd('0x95')](_0x3285ed[_0xa7fd('0x7c')]['sort']);_0x579061['where']=qs[_0xa7fd('0x96')](_['pick'](_0x3285ed[_0xa7fd('0x7c')],_0x22449b[_0xa7fd('0x96')]));if(_0x3285ed['query']['filter']){_0x579061['where']=_[_0xa7fd('0x97')](_0x579061[_0xa7fd('0x7a')],{'$or':_[_0xa7fd('0x9')](_0x562f09,function(_0x58b43b){if(_0x58b43b[_0xa7fd('0x11')][_0xa7fd('0x98')]!==_0xa7fd('0x99')){var _0x4b4237={};_0x4b4237[_0x58b43b['field']]={'$like':'%'+_0x3285ed[_0xa7fd('0x7c')][_0xa7fd('0x4')]+'%'};return _0x4b4237;}})});}var _0x380ae9=[];if(_0x334595){var _0x43a386=_['find'](_0x19cd16,[_0xa7fd('0xd'),_0x334595['name']]);if(_0x43a386[_0xa7fd('0x5')]){var _0x78d075={};if(_0x2a516c[_0xa7fd('0x14')]===_0xa7fd('0xf')){_0x78d075[_0x43a386['foreignKey']]=_[_0xa7fd('0x9')](_0x334595[_0xa7fd('0xc')],'id');}else{_0x78d075[_0x43a386[_0xa7fd('0x9a')]]=_0x334595[_0xa7fd('0xc')];}_0x380ae9[_0xa7fd('0x86')](_0x78d075);}else{_0x579061['where']['id']=_0x334595[_0xa7fd('0xc')];}}else{for(var _0x21776e=0x0;_0x21776e<_0x333eaa[_0xa7fd('0x85')];_0x21776e++){var _0x43a386=_['find'](_0x19cd16,['name',_0x333eaa[_0x21776e][_0xa7fd('0xd')]]);if(_0x43a386['field']){var _0x78d075={};_0x78d075[_0x43a386['foreignKey']]=_0x333eaa[_0x21776e][_0xa7fd('0xc')];_0x380ae9['push'](_0x78d075);}else{if(!_0x579061[_0xa7fd('0x7a')]['id'])_0x579061[_0xa7fd('0x7a')]['id']=[];_0x333eaa[_0x21776e][_0xa7fd('0xc')][_0xa7fd('0x9b')](function(_0x5862e2){_0x579061[_0xa7fd('0x7a')]['id'][_0xa7fd('0x86')](_0x5862e2);});}}}if(!_[_0xa7fd('0x8a')](_0x380ae9)){_0x579061[_0xa7fd('0x7a')]=_['merge'](_0x579061[_0xa7fd('0x7a')],{'$and':{'$or':_0x380ae9}});}_0x579061=_[_0xa7fd('0x97')]({},_0x579061,_0x3285ed[_0xa7fd('0x9c')]);if(_0x334595&&!_0x334595['autoAssociation']&&_0x2a516c[_0xa7fd('0x14')]==='AnalyticExtractedReport'){if(_0x3285ed[_0xa7fd('0x7c')][_0xa7fd('0x9d')]){_0x579061[_0xa7fd('0x9e')]=[{'all':!![]}];}return _0x2d82a1[_0x2a516c[_0xa7fd('0x14')]][_0xa7fd('0x7')](_0x579061)[_0xa7fd('0x8')](function(_0x35ffd6){var _0x1e8179=[];_0x35ffd6[_0xa7fd('0x9b')](function(_0x5083f6){var _0x58a31e;switch(_0x5083f6['reportType']){case _0xa7fd('0x9f'):_0x58a31e=_[_0xa7fd('0xa0')](_0x334595['associatedResources'],function(_0x42226b){return _0x42226b['id']===_0x5083f6['reportId']&&_0x42226b[_0xa7fd('0x11')]===_0xa7fd('0xa1');});break;case'custom':_0x58a31e=_[_0xa7fd('0xa0')](_0x334595[_0xa7fd('0xc')],function(_0x425e76){return _0x425e76['id']===_0x5083f6[_0xa7fd('0x6d')]&&_0x425e76[_0xa7fd('0x11')]===_0xa7fd('0xa2');});break;}if(_0x58a31e)_0x1e8179[_0xa7fd('0x86')](_0x5083f6);});_0x21b158['count']=_0x1e8179[_0xa7fd('0x85')];_0x21b158[_0xa7fd('0xa3')]=_0x1e8179;return _0x21b158;});}else{return _0x2d82a1[_0x2a516c['childModel']][_0xa7fd('0xa4')]({'where':_0x579061[_0xa7fd('0x7a')]})[_0xa7fd('0x8')](function(_0x275eaa){_0x21b158['count']=_0x275eaa;if(_0x3285ed[_0xa7fd('0x7c')]['includeAll']){if(_0x2a516c['childModel']===_0xa7fd('0x1b')){_0x579061['include']=[{'model':_0x2d82a1[_0xa7fd('0x64')],'as':_0xa7fd('0xa5'),'attributes':['id',_0xa7fd('0xd'),_0xa7fd('0xa6')],'required':_0x3285ed[_0xa7fd('0x7c')][_0xa7fd('0xa7')]?!![]:![]},{'model':_0x2d82a1[_0xa7fd('0x64')],'as':_0xa7fd('0xa8'),'attributes':['id','name','color'],'through':_0x3285ed[_0xa7fd('0x7c')][_0xa7fd('0xa7')]?{'attributes':[],'where':{'TagId':_0x3285ed[_0xa7fd('0x7c')][_0xa7fd('0xa7')]||undefined}}:{},'required':_0x3285ed[_0xa7fd('0x7c')][_0xa7fd('0xa7')]?!![]:![]}];}else{_0x579061[_0xa7fd('0x9e')]=[{'all':!![]}];}}return _0x2d82a1[_0x2a516c[_0xa7fd('0x14')]][_0xa7fd('0x7')](_0x579061);})[_0xa7fd('0x8')](function(_0x5265f1){_0x21b158[_0xa7fd('0xa3')]=_0x5265f1;if(_0x2d6242===_0xa7fd('0x31')&&_0x3285ed[_0xa7fd('0x7c')][_0xa7fd('0xa9')]===_0xa7fd('0xaa')){var _0x245054=[];for(var _0xb13261=0x0;_0xb13261<_0x21b158['rows'][_0xa7fd('0x85')];_0xb13261++){_0x245054[_0xa7fd('0x86')](_0x10a4e1(_0xa7fd('0xab'),_0x21b158[_0xa7fd('0xa3')][_0xb13261]['dataValues']));_0x245054['push'](_0x10a4e1(_0xa7fd('0xac'),_0x21b158[_0xa7fd('0xa3')][_0xb13261]['dataValues']));_0x245054['push'](_0x10a4e1(_0xa7fd('0xad'),_0x21b158[_0xa7fd('0xa3')][_0xb13261][_0xa7fd('0xae')]));_0x245054[_0xa7fd('0x86')](_0x10a4e1(_0xa7fd('0xaf'),_0x21b158[_0xa7fd('0xa3')][_0xb13261][_0xa7fd('0xae')]));_0x245054[_0xa7fd('0x86')](_0x10a4e1(_0xa7fd('0xb0'),_0x21b158[_0xa7fd('0xa3')][_0xb13261][_0xa7fd('0xae')]));_0x245054[_0xa7fd('0x86')](_0x10a4e1('whatsapp',_0x21b158[_0xa7fd('0xa3')][_0xb13261][_0xa7fd('0xae')]));}return Promise[_0xa7fd('0x88')](_0x245054)[_0xa7fd('0x8')](function(){return _0x21b158;});}return _0x21b158;});}});}}});}; \ No newline at end of file +var _0xceaf=['then','associatedResources','map','catch','model','findAll','name','AnalyticExtractedReport','resourceId','type','toLowerCase','childModel','SquareProject','odbc','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','CmContact','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','VoiceContext','voicemails','VoiceMail','voicerecordings','Agents','User','role','agent','Telephones','membername','telephone','VoiceQueues','queue','VoiceQueue','QueueCampaigns','outbound','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','WhatsappQueue','whatsappaccounts','WhatsappAccount','voicequeues','queuecampaigns','users','agents','telephones','Users','admin','user','zendeskaccounts','ZendeskAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','Pause','scheduler','sounds','Sound','tags','Tag','templates','Template','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','where','sequelize','query','toString','OpenTabs','define','user_profiles','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','all','ignore','union','autoAssociation','keys','intersection','fields','attributes','hasOwnProperty','limit','offset','sort','pick','filters','merge','VIRTUAL','foreignKey','forEach','options','includeAll','include','reportType','default','DefaultReports','custom','CustomReports','count','rows','Tags','tag','ThroughTags','color','openTabs','true','chat','dataValues','fax','whatsapp','lodash','exports','filter','field','value'];(function(_0x3c0e8c,_0x1fbfdf){var _0x1c0805=function(_0x5ccff7){while(--_0x5ccff7){_0x3c0e8c['push'](_0x3c0e8c['shift']());}};_0x1c0805(++_0x1fbfdf);}(_0xceaf,0x17d));var _0xfcea=function(_0xf45cb,_0x4ed870){_0xf45cb=_0xf45cb-0x0;var _0x56dc78=_0xceaf[_0xf45cb];return _0x56dc78;};'use strict';var _=require(_0xfcea('0x0'));var attributes=require('./userProfile.attributes');var qs=require('../../components/parsers/qs');module[_0xfcea('0x1')]=function(_0x446fca){var _0x20963e=_0x446fca['models'];function _0x1b4c58(_0x3f7a9d,_0x11a775){return new Promise(function(_0xfb4ceb,_0xeae347){if(!_0x11a775)return _0xfb4ceb(null);var _0x8b4a50=_0x11a775['filter']?{[_0x11a775[_0xfcea('0x2')][_0xfcea('0x3')]]:_0x11a775['filter'][_0xfcea('0x4')]}:undefined;return _0x20963e[_0x3f7a9d]['findAll']({'where':_0x8b4a50,'raw':!![]})[_0xfcea('0x5')](function(_0x3a5854){_0x11a775[_0xfcea('0x6')]=_[_0xfcea('0x7')](_0x3a5854,'id');_0xfb4ceb(_0x11a775);})[_0xfcea('0x8')](function(_0x22237a){_0xeae347(_0x22237a);});});}function _0x99113d(_0x49d67e,_0x3ad1b2){return new Promise(function(_0x2ec961,_0x3a1b29){var _0x514f48=_0x49d67e[_0xfcea('0x2')]?{[_0x49d67e['filter']['field']]:_0x49d67e['filter'][_0xfcea('0x4')]}:undefined;return _0x20963e[_0x49d67e[_0xfcea('0x9')]][_0xfcea('0xa')]({'where':_0x514f48,'raw':!![]})['then'](function(_0x20d776){_0x3ad1b2[_0xfcea('0x6')]=_[_0xfcea('0x7')](_0x20d776,function(_0x14586f){return _0x14586f[_0xfcea('0xb')];});_0x2ec961(_0x3ad1b2);})[_0xfcea('0x8')](function(_0x1882b2){_0x3a1b29(_0x1882b2);});});}function _0x192c76(_0x27d78b,_0x267a10,_0x8084a7){if(!_0x267a10)return resolve(null);return new Promise(function(_0x24cf8d,_0x1a44b8){return _0x20963e['UserProfileResource'][_0xfcea('0xa')]({'where':{'sectionId':_0x267a10['id']},'raw':!![]})[_0xfcea('0x5')](function(_0x45ec2a){if(_0x27d78b[_0xfcea('0x3')]&&_0x27d78b['field']!=='id'){_0x267a10[_0xfcea('0x6')]=_[_0xfcea('0x7')](_0x45ec2a,function(_0x337287){return _0x337287[_0x27d78b[_0xfcea('0x3')]];});}else{if(_0x8084a7===_0xfcea('0xc')){_0x267a10[_0xfcea('0x6')]=_[_0xfcea('0x7')](_0x45ec2a,function(_0x40b722){return{'id':_0x40b722[_0xfcea('0xd')],'type':_0x40b722[_0xfcea('0xe')]};});}else{_0x267a10[_0xfcea('0x6')]=_[_0xfcea('0x7')](_0x45ec2a,function(_0x309505){return _0x309505[_0xfcea('0xd')];});}}_0x24cf8d(_0x267a10);})[_0xfcea('0x8')](function(_0x2e80f8){_0x1a44b8(_0x2e80f8);});});}function _0x37d618(_0x349d44,_0x39cde3){var _0x424dce={'parentSections':[]};switch(_0x349d44[_0xfcea('0xf')]()){case'squareprojects':_0x424dce[_0xfcea('0x10')]=_0xfcea('0x11');break;case _0xfcea('0x12'):_0x424dce[_0xfcea('0x10')]='SquareOdbc';break;case'squarerecordings':_0x424dce[_0xfcea('0x10')]='SquareRecording';_0x424dce[_0xfcea('0x13')]=[{'name':_0xfcea('0x14'),'field':'name','foreignKey':_0xfcea('0x15')}];break;case _0xfcea('0x16'):_0x424dce[_0xfcea('0x10')]=_0xfcea('0x17');break;case _0xfcea('0x18'):_0x424dce[_0xfcea('0x10')]=_0xfcea('0x19');_0x424dce[_0xfcea('0x13')]=[{'name':_0xfcea('0x1a'),'field':'id','foreignKey':_0xfcea('0x1b')}];break;case _0xfcea('0x1c'):_0x424dce[_0xfcea('0x10')]=_0xfcea('0x1d');break;case _0xfcea('0x1e'):_0x424dce[_0xfcea('0x10')]=_0xfcea('0x1f');break;case _0xfcea('0x20'):_0x424dce[_0xfcea('0x10')]=_0xfcea('0x21');break;case _0xfcea('0x22'):_0x424dce[_0xfcea('0x10')]=_0xfcea('0x23');break;case _0xfcea('0x24'):_0x424dce[_0xfcea('0x10')]=_0xfcea('0x25');break;case _0xfcea('0x26'):_0x424dce[_0xfcea('0x10')]=_0xfcea('0x27');break;case _0xfcea('0x28'):_0x424dce[_0xfcea('0x10')]=_0xfcea('0x29');break;case _0xfcea('0x2a'):case _0xfcea('0x2b'):case _0xfcea('0x2c'):_0x424dce[_0xfcea('0x10')]=_0xfcea('0x2d');break;case'contexts':_0x424dce['childModel']=_0xfcea('0x2e');break;case _0xfcea('0x2f'):_0x424dce[_0xfcea('0x10')]=_0xfcea('0x30');break;case _0xfcea('0x31'):_0x424dce[_0xfcea('0x10')]='VoiceRecording';_0x424dce['parentSections']=[{'name':_0xfcea('0x32'),'field':_0xfcea('0xb'),'foreignKey':'membername','model':_0xfcea('0x33'),'filter':{'field':_0xfcea('0x34'),'value':[_0xfcea('0x35')]}},{'name':_0xfcea('0x36'),'field':_0xfcea('0xb'),'foreignKey':_0xfcea('0x37'),'model':_0xfcea('0x33'),'filter':{'field':_0xfcea('0x34'),'value':[_0xfcea('0x38')]}},{'name':_0xfcea('0x39'),'field':_0xfcea('0xb'),'foreignKey':_0xfcea('0x3a'),'model':_0xfcea('0x3b'),'filter':{'field':'type','value':['inbound']}},{'name':_0xfcea('0x3c'),'field':_0xfcea('0xb'),'foreignKey':_0xfcea('0x3a'),'model':_0xfcea('0x3b'),'filter':{'field':'type','value':[_0xfcea('0x3d')]}}];break;case'musiconholds':_0x424dce['childModel']='VoiceMusicOnHold';break;case'chanspies':_0x424dce['childModel']=_0xfcea('0x3e');break;case _0xfcea('0x3f'):_0x424dce['childModel']=_0xfcea('0x40');break;case _0xfcea('0x41'):_0x424dce[_0xfcea('0x10')]=_0xfcea('0x42');break;case _0xfcea('0x43'):_0x424dce[_0xfcea('0x10')]=_0xfcea('0x44');break;case _0xfcea('0x45'):_0x424dce[_0xfcea('0x10')]=_0xfcea('0x46');break;case _0xfcea('0x47'):_0x424dce[_0xfcea('0x10')]=_0xfcea('0x48');break;case _0xfcea('0x49'):_0x424dce[_0xfcea('0x10')]=_0xfcea('0x4a');break;case'openchannelaccounts':_0x424dce[_0xfcea('0x10')]=_0xfcea('0x4b');break;case _0xfcea('0x4c'):_0x424dce['childModel']=_0xfcea('0x4d');break;case _0xfcea('0x4e'):_0x424dce['childModel']='SmsAccount';break;case'whatsappqueues':_0x424dce[_0xfcea('0x10')]=_0xfcea('0x4f');break;case _0xfcea('0x50'):_0x424dce[_0xfcea('0x10')]=_0xfcea('0x51');break;case'teams':_0x424dce['childModel']='Team';break;case _0xfcea('0x52'):case _0xfcea('0x53'):_0x424dce[_0xfcea('0x10')]=_0xfcea('0x3b');if(_0x39cde3){_0x424dce[_0xfcea('0x13')]=[{'name':_0xfcea('0x39')},{'name':_0xfcea('0x3c')}];}break;case _0xfcea('0x54'):case _0xfcea('0x55'):case _0xfcea('0x56'):_0x424dce[_0xfcea('0x10')]=_0xfcea('0x33');if(_0x39cde3){_0x424dce[_0xfcea('0x13')]=[{'name':_0xfcea('0x57'),'filter':{'field':_0xfcea('0x34'),'value':[_0xfcea('0x58'),_0xfcea('0x59')]},'ignore':!![]},{'name':'Agents'},{'name':'Telephones'}];}break;case _0xfcea('0x5a'):_0x424dce[_0xfcea('0x10')]=_0xfcea('0x5b');break;case'salesforceaccounts':_0x424dce[_0xfcea('0x10')]='SalesforceAccount';break;case _0xfcea('0x5c'):_0x424dce[_0xfcea('0x10')]=_0xfcea('0x5d');break;case _0xfcea('0x5e'):_0x424dce[_0xfcea('0x10')]='SugarcrmAccount';break;case _0xfcea('0x5f'):_0x424dce[_0xfcea('0x10')]=_0xfcea('0x60');break;case _0xfcea('0x61'):_0x424dce[_0xfcea('0x10')]=_0xfcea('0x62');break;case _0xfcea('0x63'):_0x424dce['childModel']=_0xfcea('0x33');break;case _0xfcea('0x64'):_0x424dce['childModel']=_0xfcea('0x65');break;case _0xfcea('0x66'):_0x424dce[_0xfcea('0x10')]=_0xfcea('0x67');break;case _0xfcea('0x68'):_0x424dce['childModel']=_0xfcea('0x69');break;case _0xfcea('0x6a'):_0x424dce[_0xfcea('0x10')]=_0xfcea('0x6b');break;case'pauses':_0x424dce[_0xfcea('0x10')]=_0xfcea('0x6c');break;case _0xfcea('0x6d'):_0x424dce['childModel']='Schedule';break;case _0xfcea('0x6e'):_0x424dce['childModel']=_0xfcea('0x6f');break;case _0xfcea('0x70'):_0x424dce[_0xfcea('0x10')]=_0xfcea('0x71');break;case _0xfcea('0x72'):_0x424dce[_0xfcea('0x10')]=_0xfcea('0x73');break;case'triggers':_0x424dce[_0xfcea('0x10')]=_0xfcea('0x74');break;case _0xfcea('0x75'):_0x424dce['childModel']=_0xfcea('0x76');break;case _0xfcea('0x77'):_0x424dce[_0xfcea('0x10')]=_0xfcea('0x78');break;case _0xfcea('0x79'):_0x424dce[_0xfcea('0x10')]=_0xfcea('0x7a');break;case _0xfcea('0x7b'):_0x424dce['childModel']=_0xfcea('0xc');_0x424dce[_0xfcea('0x13')]=[{'name':_0xfcea('0x7c'),'field':'id','foreignKey':_0xfcea('0x7d')}];break;case _0xfcea('0x7e'):_0x424dce[_0xfcea('0x10')]=_0xfcea('0x7f');break;case _0xfcea('0x50'):_0x424dce['childModel']=_0xfcea('0x51');break;}return _0x424dce;}function _0x2695e6(_0x25b313,_0x5154e8){var _0x34579e=_0x25b313[_0xfcea('0x80')](0x0)[_0xfcea('0x81')]()+_0x25b313[_0xfcea('0x82')](0x1);var _0x479c20={'type':_0x20963e['Sequelize'][_0xfcea('0x83')][_0xfcea('0x84')],'raw':!![]};return new BPromise(function(_0x517828,_0x935aef){var _0x12c266=squel[_0xfcea('0x85')]()[_0xfcea('0x3')](_0xfcea('0x86')+_0x34579e+_0xfcea('0x87'),'id')[_0xfcea('0x3')](_0xfcea('0x88'))[_0xfcea('0x89')](_0xfcea('0x8a')+_0x25b313+_0xfcea('0x8b'),'ui')[_0xfcea('0x8c')]('ui.UserId\x20=\x20?',_0x5154e8['id']);return _0x20963e[_0xfcea('0x8d')][_0xfcea('0x8e')](_0x12c266[_0xfcea('0x8f')](),_0x479c20)[_0xfcea('0x5')](function(_0x47eb56){_0x5154e8[_0x34579e+_0xfcea('0x90')]=_0x47eb56;_0x517828(_0x47eb56);})[_0xfcea('0x8')](function(_0x4f5967){_0x935aef(_0x4f5967);});});}return _0x446fca[_0xfcea('0x91')]('UserProfile',attributes,{'tableName':_0xfcea('0x92'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x48ee70){var _0x5e58bb={'raw':![],'where':{}};var _0x317c05={};var _0x40d2e3={'count':0x0,'rows':[]};var _0x5cc728=_0x48ee70['query']['section'];var _0x158a10=_0x48ee70[_0xfcea('0x8e')][_0xfcea('0x93')]||![];var _0x4169e0=_0x37d618(_0x5cc728,_0x158a10);if(!_0x4169e0['childModel'])throw new Error(_0xfcea('0x94')+_0x5cc728+'\x27');var _0x32b7c9=[{'name':_0x5cc728}];if(!_[_0xfcea('0x95')](_0x4169e0[_0xfcea('0x13')]))_0x32b7c9=_0x4169e0[_0xfcea('0x13')];var _0x258b6b=[];for(var _0x37fbec=0x0;_0x37fbec<_0x32b7c9[_0xfcea('0x96')];_0x37fbec++){_0x258b6b[_0xfcea('0x97')](_0x20963e[_0xfcea('0x98')][_0xfcea('0x99')]({'where':{'userProfileId':_0x48ee70[_0xfcea('0x9a')]['id'],'name':_0x32b7c9[_0x37fbec][_0xfcea('0xb')]},'raw':!![]}));}return Promise[_0xfcea('0x9b')](_0x258b6b)[_0xfcea('0x5')](function(_0x4d66f0){var _0x3a2f78=_[_0xfcea('0x2')](_0x4d66f0,function(_0x30e1ee){return _0x30e1ee?_0x30e1ee:undefined;});var _0x549455=_[_0xfcea('0x2')](_0x32b7c9,[_0xfcea('0x9c'),!![]]);var _0x40dd96=_[_0xfcea('0x95')](_0x3a2f78)&&_[_0xfcea('0x95')](_0x549455)?null:_[_0xfcea('0x9d')](_0x549455,_0x3a2f78);if(!_0x40dd96)return null;var _0x53bc28=[];for(var _0xe6d26d=0x0;_0xe6d26d<_0x40dd96[_0xfcea('0x96')];_0xe6d26d++){var _0x5849fa=_[_0xfcea('0x99')](_0x32b7c9,function(_0x319d73){return _0x40dd96[_0xe6d26d]?_0x319d73[_0xfcea('0xb')]===_0x40dd96[_0xe6d26d][_0xfcea('0xb')]:null;});if(_0x5849fa){if(_0x40dd96[_0xe6d26d][_0xfcea('0x9c')]){_0x53bc28[_0xfcea('0x97')](_0x1b4c58(_0x4169e0[_0xfcea('0x10')],_0x40dd96[_0xe6d26d]));}else{if(!_0x40dd96[_0xe6d26d][_0xfcea('0x9e')]){_0x53bc28['push'](_0x192c76(_0x5849fa,_0x40dd96[_0xe6d26d],_0x4169e0[_0xfcea('0x10')]));}else{if(_0x5849fa[_0xfcea('0x9')]){_0x53bc28['push'](_0x99113d(_0x5849fa,_0x40dd96[_0xe6d26d]));}}}}}return Promise[_0xfcea('0x9b')](_0x53bc28);})[_0xfcea('0x5')](function(_0x501502){var _0xddaae9=_0x501502;var _0x3d3129=null;if(_0xddaae9){_0x3d3129=_0xddaae9[_0xfcea('0x96')]===0x1?_0xddaae9[0x0]:null;}if(!_0x3d3129&&!_0xddaae9)return _0x40d2e3;var _0x1f2171=_0x20963e[_0x4169e0[_0xfcea('0x10')]]['rawAttributes'];_0x317c05[_0xfcea('0x9')]=_[_0xfcea('0x9f')](_0x1f2171);_0x317c05[_0xfcea('0x8e')]=_[_0xfcea('0x9f')](_0x48ee70['query']);_0x317c05['filters']=_[_0xfcea('0xa0')](_0x317c05[_0xfcea('0x9')],_0x317c05['query']);_0x5e58bb['attributes']=_[_0xfcea('0xa0')](_0x317c05[_0xfcea('0x9')],qs['fields'](_0x48ee70[_0xfcea('0x8e')][_0xfcea('0xa1')]));_0x5e58bb[_0xfcea('0xa2')]=_0x5e58bb[_0xfcea('0xa2')][_0xfcea('0x96')]?_0x5e58bb[_0xfcea('0xa2')]:_0x317c05['model'];if(!_0x48ee70[_0xfcea('0x8e')][_0xfcea('0xa3')]('nolimit')){_0x5e58bb[_0xfcea('0xa4')]=qs[_0xfcea('0xa4')](_0x48ee70[_0xfcea('0x8e')][_0xfcea('0xa4')]);_0x5e58bb['offset']=qs[_0xfcea('0xa5')](_0x48ee70[_0xfcea('0x8e')][_0xfcea('0xa5')]);}_0x5e58bb['order']=qs[_0xfcea('0xa6')](_0x48ee70[_0xfcea('0x8e')][_0xfcea('0xa6')]);_0x5e58bb['where']=qs['filters'](_[_0xfcea('0xa7')](_0x48ee70[_0xfcea('0x8e')],_0x317c05[_0xfcea('0xa8')]));if(_0x48ee70['query'][_0xfcea('0x2')]){_0x5e58bb[_0xfcea('0x8c')]=_[_0xfcea('0xa9')](_0x5e58bb['where'],{'$or':_['map'](_0x1f2171,function(_0x4caed7){if(_0x4caed7['type']['key']!==_0xfcea('0xaa')){var _0x3f6a0c={};_0x3f6a0c[_0x4caed7[_0xfcea('0x3')]]={'$like':'%'+_0x48ee70[_0xfcea('0x8e')][_0xfcea('0x2')]+'%'};return _0x3f6a0c;}})});}var _0x3252be=[];if(_0x3d3129){var _0x112231=_[_0xfcea('0x99')](_0x32b7c9,[_0xfcea('0xb'),_0x3d3129[_0xfcea('0xb')]]);if(_0x112231[_0xfcea('0x3')]){var _0x3eb2b2={};if(_0x4169e0[_0xfcea('0x10')]===_0xfcea('0xc')){_0x3eb2b2[_0x112231[_0xfcea('0xab')]]=_[_0xfcea('0x7')](_0x3d3129[_0xfcea('0x6')],'id');}else{_0x3eb2b2[_0x112231['foreignKey']]=_0x3d3129[_0xfcea('0x6')];}_0x3252be[_0xfcea('0x97')](_0x3eb2b2);}else{_0x5e58bb[_0xfcea('0x8c')]['id']=_0x3d3129[_0xfcea('0x6')];}}else{for(var _0x5a1098=0x0;_0x5a1098<_0xddaae9['length'];_0x5a1098++){var _0x112231=_['find'](_0x32b7c9,[_0xfcea('0xb'),_0xddaae9[_0x5a1098][_0xfcea('0xb')]]);if(_0x112231[_0xfcea('0x3')]){var _0x3eb2b2={};_0x3eb2b2[_0x112231['foreignKey']]=_0xddaae9[_0x5a1098][_0xfcea('0x6')];_0x3252be[_0xfcea('0x97')](_0x3eb2b2);}else{if(!_0x5e58bb[_0xfcea('0x8c')]['id'])_0x5e58bb['where']['id']=[];_0xddaae9[_0x5a1098][_0xfcea('0x6')][_0xfcea('0xac')](function(_0x4b520f){_0x5e58bb[_0xfcea('0x8c')]['id'][_0xfcea('0x97')](_0x4b520f);});}}}if(!_[_0xfcea('0x95')](_0x3252be)){_0x5e58bb[_0xfcea('0x8c')]=_['merge'](_0x5e58bb[_0xfcea('0x8c')],{'$and':{'$or':_0x3252be}});}_0x5e58bb=_[_0xfcea('0xa9')]({},_0x5e58bb,_0x48ee70[_0xfcea('0xad')]);if(_0x3d3129&&!_0x3d3129[_0xfcea('0x9e')]&&_0x4169e0[_0xfcea('0x10')]===_0xfcea('0xc')){if(_0x48ee70[_0xfcea('0x8e')][_0xfcea('0xae')]){_0x5e58bb[_0xfcea('0xaf')]=[{'all':!![]}];}return _0x20963e[_0x4169e0[_0xfcea('0x10')]][_0xfcea('0xa')](_0x5e58bb)['then'](function(_0x524cd0){var _0x4c7705=[];_0x524cd0[_0xfcea('0xac')](function(_0x22c5c8){var _0x59ee51;switch(_0x22c5c8[_0xfcea('0xb0')]){case _0xfcea('0xb1'):_0x59ee51=_[_0xfcea('0x99')](_0x3d3129['associatedResources'],function(_0x522a41){return _0x522a41['id']===_0x22c5c8[_0xfcea('0x7d')]&&_0x522a41['type']===_0xfcea('0xb2');});break;case _0xfcea('0xb3'):_0x59ee51=_[_0xfcea('0x99')](_0x3d3129[_0xfcea('0x6')],function(_0x46e253){return _0x46e253['id']===_0x22c5c8[_0xfcea('0x7d')]&&_0x46e253[_0xfcea('0xe')]===_0xfcea('0xb4');});break;}if(_0x59ee51)_0x4c7705['push'](_0x22c5c8);});_0x40d2e3[_0xfcea('0xb5')]=_0x4c7705[_0xfcea('0x96')];_0x40d2e3[_0xfcea('0xb6')]=_0x4c7705;return _0x40d2e3;});}else{return _0x20963e[_0x4169e0['childModel']]['count']({'where':_0x5e58bb[_0xfcea('0x8c')]})['then'](function(_0x501058){_0x40d2e3[_0xfcea('0xb5')]=_0x501058;if(_0x48ee70[_0xfcea('0x8e')]['includeAll']){if(_0x4169e0['childModel']===_0xfcea('0x19')){_0x5e58bb[_0xfcea('0xaf')]=[{'model':_0x20963e[_0xfcea('0x71')],'as':_0xfcea('0xb7'),'attributes':['id',_0xfcea('0xb'),'color'],'required':_0x48ee70['query'][_0xfcea('0xb8')]?!![]:![]},{'model':_0x20963e[_0xfcea('0x71')],'as':_0xfcea('0xb9'),'attributes':['id','name',_0xfcea('0xba')],'through':_0x48ee70[_0xfcea('0x8e')]['tag']?{'attributes':[],'where':{'TagId':_0x48ee70[_0xfcea('0x8e')][_0xfcea('0xb8')]||undefined}}:{},'required':_0x48ee70[_0xfcea('0x8e')][_0xfcea('0xb8')]?!![]:![]}];}else{_0x5e58bb[_0xfcea('0xaf')]=[{'all':!![]}];}}return _0x20963e[_0x4169e0[_0xfcea('0x10')]][_0xfcea('0xa')](_0x5e58bb);})[_0xfcea('0x5')](function(_0x149e17){_0x40d2e3[_0xfcea('0xb6')]=_0x149e17;if(_0x5cc728===_0xfcea('0x32')&&_0x48ee70[_0xfcea('0x8e')][_0xfcea('0xbb')]===_0xfcea('0xbc')){var _0x449c21=[];for(var _0x3ad33a=0x0;_0x3ad33a<_0x40d2e3['rows']['length'];_0x3ad33a++){_0x449c21[_0xfcea('0x97')](_0x2695e6(_0xfcea('0xbd'),_0x40d2e3['rows'][_0x3ad33a][_0xfcea('0xbe')]));_0x449c21[_0xfcea('0x97')](_0x2695e6('sms',_0x40d2e3['rows'][_0x3ad33a][_0xfcea('0xbe')]));_0x449c21['push'](_0x2695e6(_0xfcea('0xbf'),_0x40d2e3['rows'][_0x3ad33a]['dataValues']));_0x449c21[_0xfcea('0x97')](_0x2695e6('mail',_0x40d2e3[_0xfcea('0xb6')][_0x3ad33a][_0xfcea('0xbe')]));_0x449c21[_0xfcea('0x97')](_0x2695e6('openchannel',_0x40d2e3[_0xfcea('0xb6')][_0x3ad33a][_0xfcea('0xbe')]));_0x449c21[_0xfcea('0x97')](_0x2695e6(_0xfcea('0xc0'),_0x40d2e3[_0xfcea('0xb6')][_0x3ad33a][_0xfcea('0xbe')]));}return Promise[_0xfcea('0x9b')](_0x449c21)[_0xfcea('0x5')](function(){return _0x40d2e3;});}return _0x40d2e3;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 52521b6..bd8b477 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 _0x36fe=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','then','info','request\x20sent','debug','stringify','error','UserProfile,\x20%s,\x20%s','message','catch','lodash','util'];(function(_0x5af22d,_0x4059f7){var _0x2c627f=function(_0x14e411){while(--_0x14e411){_0x5af22d['push'](_0x5af22d['shift']());}};_0x2c627f(++_0x4059f7);}(_0x36fe,0x127));var _0xe36f=function(_0x2715cf,_0x517bb2){_0x2715cf=_0x2715cf-0x0;var _0x1bdcb8=_0x36fe[_0x2715cf];return _0x1bdcb8;};'use strict';var _=require(_0xe36f('0x0'));var util=require(_0xe36f('0x1'));var moment=require(_0xe36f('0x2'));var BPromise=require(_0xe36f('0x3'));var rs=require(_0xe36f('0x4'));var fs=require('fs');var Redis=require(_0xe36f('0x5'));var db=require(_0xe36f('0x6'))['db'];var utils=require(_0xe36f('0x7'));var logger=require(_0xe36f('0x8'))(_0xe36f('0x9'));var config=require(_0xe36f('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xe36f('0xb')]['http']({'port':0x232a});config[_0xe36f('0xc')]=_[_0xe36f('0xd')](config['redis'],{'host':_0xe36f('0xe'),'port':0x18eb});var socket=require(_0xe36f('0xf'))(new Redis(config['redis']));require(_0xe36f('0x10'))[_0xe36f('0x11')](socket);function respondWithRpcPromise(_0xa26c3d,_0x44bc2f,_0x3d036f){return new BPromise(function(_0x5b23ff,_0x212ff9){return client['request'](_0xa26c3d,_0x3d036f)[_0xe36f('0x12')](function(_0x2b1c1c){logger[_0xe36f('0x13')]('UserProfile,\x20%s,\x20%s',_0x44bc2f,_0xe36f('0x14'));logger[_0xe36f('0x15')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x44bc2f,_0xe36f('0x14'),JSON[_0xe36f('0x16')](_0x2b1c1c));if(_0x2b1c1c[_0xe36f('0x17')]){if(_0x2b1c1c[_0xe36f('0x17')]['code']===0x1f4){logger[_0xe36f('0x17')](_0xe36f('0x18'),_0x44bc2f,_0x2b1c1c[_0xe36f('0x17')]['message']);return _0x212ff9(_0x2b1c1c[_0xe36f('0x17')][_0xe36f('0x19')]);}logger['error'](_0xe36f('0x18'),_0x44bc2f,_0x2b1c1c[_0xe36f('0x17')][_0xe36f('0x19')]);return _0x5b23ff(_0x2b1c1c[_0xe36f('0x17')][_0xe36f('0x19')]);}else{logger[_0xe36f('0x13')]('UserProfile,\x20%s,\x20%s',_0x44bc2f,'request\x20sent');_0x5b23ff(_0x2b1c1c['result']['message']);}})[_0xe36f('0x1a')](function(_0x2d6409){logger[_0xe36f('0x17')](_0xe36f('0x18'),_0x44bc2f,_0x2d6409);_0x212ff9(_0x2d6409);});});} \ No newline at end of file +var _0xc43c=['../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','../../mysqldb'];(function(_0x45b618,_0x38c83b){var _0x36cc97=function(_0x1e4009){while(--_0x1e4009){_0x45b618['push'](_0x45b618['shift']());}};_0x36cc97(++_0x38c83b);}(_0xc43c,0xd4));var _0xcc43=function(_0x5af404,_0x1df7ec){_0x5af404=_0x5af404-0x0;var _0x41318b=_0xc43c[_0x5af404];return _0x41318b;};'use strict';var _=require(_0xcc43('0x0'));var util=require(_0xcc43('0x1'));var moment=require(_0xcc43('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcc43('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xcc43('0x4'));var jayson=require(_0xcc43('0x5'));var client=jayson[_0xcc43('0x6')]['http']({'port':0x232a});config[_0xcc43('0x7')]=_[_0xcc43('0x8')](config[_0xcc43('0x7')],{'host':_0xcc43('0x9'),'port':0x18eb});var socket=require(_0xcc43('0xa'))(new Redis(config[_0xcc43('0x7')]));require(_0xcc43('0xb'))[_0xcc43('0xc')](socket);function respondWithRpcPromise(_0x4b11dc,_0x3ddc64,_0x1a825b){return new BPromise(function(_0x2656bc,_0x3bc51e){return client[_0xcc43('0xd')](_0x4b11dc,_0x1a825b)[_0xcc43('0xe')](function(_0x439c43){logger[_0xcc43('0xf')](_0xcc43('0x10'),_0x3ddc64,_0xcc43('0x11'));logger[_0xcc43('0x12')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x3ddc64,_0xcc43('0x11'),JSON[_0xcc43('0x13')](_0x439c43));if(_0x439c43[_0xcc43('0x14')]){if(_0x439c43[_0xcc43('0x14')]['code']===0x1f4){logger[_0xcc43('0x14')](_0xcc43('0x10'),_0x3ddc64,_0x439c43[_0xcc43('0x14')][_0xcc43('0x15')]);return _0x3bc51e(_0x439c43[_0xcc43('0x14')]['message']);}logger[_0xcc43('0x14')](_0xcc43('0x10'),_0x3ddc64,_0x439c43['error'][_0xcc43('0x15')]);return _0x2656bc(_0x439c43['error'][_0xcc43('0x15')]);}else{logger[_0xcc43('0xf')](_0xcc43('0x10'),_0x3ddc64,'request\x20sent');_0x2656bc(_0x439c43[_0xcc43('0x16')][_0xcc43('0x15')]);}})[_0xcc43('0x17')](function(_0x326851){logger['error'](_0xcc43('0x10'),_0x3ddc64,_0x326851);_0x3bc51e(_0x326851);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 0a764a0..2e27efa 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 _0x1c21=['remove','removeListener','register','length','userProfile:'];(function(_0x5442b0,_0x43d009){var _0x20da77=function(_0x3386df){while(--_0x3386df){_0x5442b0['push'](_0x5442b0['shift']());}};_0x20da77(++_0x43d009);}(_0x1c21,0x17c));var _0x11c2=function(_0x2fc5be,_0x5ae57a){_0x2fc5be=_0x2fc5be-0x0;var _0x5a6a3a=_0x1c21[_0x2fc5be];return _0x5a6a3a;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=['save',_0x11c2('0x0'),'update'];function createListener(_0x1429ff,_0x36c5db){return function(_0x85a178){_0x36c5db['emit'](_0x1429ff,_0x85a178);};}function removeListener(_0x508e2b,_0x21351d){return function(){UserProfileEvents[_0x11c2('0x1')](_0x508e2b,_0x21351d);};}exports[_0x11c2('0x2')]=function(_0x15a2e3){for(var _0x60af78=0x0,_0x6950a0=events[_0x11c2('0x3')];_0x60af78<_0x6950a0;_0x60af78++){var _0x158c28=events[_0x60af78];var _0x53a232=createListener(_0x11c2('0x4')+_0x158c28,_0x15a2e3);UserProfileEvents['on'](_0x158c28,_0x53a232);}}; \ No newline at end of file +var _0xbf3e=['length','./userProfile.events','save','remove','update','emit','removeListener','register'];(function(_0x67939a,_0x58ff4f){var _0x35d247=function(_0x47f744){while(--_0x47f744){_0x67939a['push'](_0x67939a['shift']());}};_0x35d247(++_0x58ff4f);}(_0xbf3e,0x131));var _0xebf3=function(_0x45470d,_0x258c9c){_0x45470d=_0x45470d-0x0;var _0x2529fe=_0xbf3e[_0x45470d];return _0x2529fe;};'use strict';var UserProfileEvents=require(_0xebf3('0x0'));var events=[_0xebf3('0x1'),_0xebf3('0x2'),_0xebf3('0x3')];function createListener(_0x4f4405,_0x10086f){return function(_0x341674){_0x10086f[_0xebf3('0x4')](_0x4f4405,_0x341674);};}function removeListener(_0x39656a,_0x157765){return function(){UserProfileEvents[_0xebf3('0x5')](_0x39656a,_0x157765);};}exports[_0xebf3('0x6')]=function(_0x471b6c){for(var _0x19f760=0x0,_0x3d30a1=events[_0xebf3('0x7')];_0x19f760<_0x3d30a1;_0x19f760++){var _0x2949bc=events[_0x19f760];var _0x310479=createListener('userProfile:'+_0x2949bc,_0x471b6c);UserProfileEvents['on'](_0x2949bc,_0x310479);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index f6f7af0..94c45ef 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 _0x34ad=['create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','describe','/:id','show','post'];(function(_0xa64531,_0x48c65f){var _0x1b1f42=function(_0x78e575){while(--_0x78e575){_0xa64531['push'](_0xa64531['shift']());}};_0x1b1f42(++_0x48c65f);}(_0x34ad,0x181));var _0xd34a=function(_0x24d711,_0x3cdb28){_0x24d711=_0x24d711-0x0;var _0x3491b4=_0x34ad[_0x24d711];return _0x3491b4;};'use strict';var multer=require(_0xd34a('0x0'));var util=require(_0xd34a('0x1'));var path=require(_0xd34a('0x2'));var timeout=require(_0xd34a('0x3'));var express=require('express');var router=express[_0xd34a('0x4')]();var fs_extra=require(_0xd34a('0x5'));var auth=require(_0xd34a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd34a('0x7'));var controller=require(_0xd34a('0x8'));router[_0xd34a('0x9')]('/',auth[_0xd34a('0xa')](),controller['index']);router['get']('/describe',auth[_0xd34a('0xa')](),controller[_0xd34a('0xb')]);router['get'](_0xd34a('0xc'),auth[_0xd34a('0xa')](),controller[_0xd34a('0xd')]);router[_0xd34a('0xe')]('/',auth[_0xd34a('0xa')](),controller[_0xd34a('0xf')]);router[_0xd34a('0x10')](_0xd34a('0xc'),auth[_0xd34a('0xa')](),controller[_0xd34a('0x11')]);router[_0xd34a('0x12')]('/:id',auth[_0xd34a('0xa')](),controller[_0xd34a('0x13')]);module['exports']=router; \ No newline at end of file +var _0xb00e=['show','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','isAuthenticated','index','get','/describe'];(function(_0x4924f2,_0x47b8b3){var _0x29fb08=function(_0x5a59e6){while(--_0x5a59e6){_0x4924f2['push'](_0x4924f2['shift']());}};_0x29fb08(++_0x47b8b3);}(_0xb00e,0xb8));var _0xeb00=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0xb00e[_0x39e283];return _0x7de89f;};'use strict';var multer=require(_0xeb00('0x0'));var util=require(_0xeb00('0x1'));var path=require(_0xeb00('0x2'));var timeout=require(_0xeb00('0x3'));var express=require(_0xeb00('0x4'));var router=express[_0xeb00('0x5')]();var fs_extra=require(_0xeb00('0x6'));var auth=require(_0xeb00('0x7'));var interaction=require(_0xeb00('0x8'));var config=require('../../config/environment');var controller=require(_0xeb00('0x9'));router['get']('/',auth[_0xeb00('0xa')](),controller[_0xeb00('0xb')]);router[_0xeb00('0xc')](_0xeb00('0xd'),auth[_0xeb00('0xa')](),controller['describe']);router[_0xeb00('0xc')]('/:id',auth[_0xeb00('0xa')](),controller[_0xeb00('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xeb00('0xf')]);router[_0xeb00('0x10')]('/:id',auth[_0xeb00('0xa')](),controller[_0xeb00('0x11')]);router[_0xeb00('0x12')](_0xeb00('0x13'),auth['isAuthenticated'](),controller[_0xeb00('0x14')]);module[_0xeb00('0x15')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 4932718..e270630 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 _0x8a98=['exports','STRING','INTEGER','sequelize'];(function(_0x2b5ffb,_0x268de9){var _0x4c159f=function(_0x3fa4b3){while(--_0x3fa4b3){_0x2b5ffb['push'](_0x2b5ffb['shift']());}};_0x4c159f(++_0x268de9);}(_0x8a98,0xef));var _0x88a9=function(_0x51ac09,_0x383098){_0x51ac09=_0x51ac09-0x0;var _0x3f827d=_0x8a98[_0x51ac09];return _0x3f827d;};'use strict';var Sequelize=require(_0x88a9('0x0'));module[_0x88a9('0x1')]={'name':{'type':Sequelize[_0x88a9('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x88a9('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x88a9('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x3f65=['STRING','INTEGER','sequelize','exports'];(function(_0x1c3386,_0x2868c0){var _0x2cc8e9=function(_0x556aa2){while(--_0x556aa2){_0x1c3386['push'](_0x1c3386['shift']());}};_0x2cc8e9(++_0x2868c0);}(_0x3f65,0x166));var _0x53f6=function(_0x4ad56c,_0x121ad8){_0x4ad56c=_0x4ad56c-0x0;var _0x441169=_0x3f65[_0x4ad56c];return _0x441169;};'use strict';var Sequelize=require(_0x53f6('0x0'));module[_0x53f6('0x1')]={'name':{'type':Sequelize[_0x53f6('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x53f6('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x53f6('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 737c51e..0bbb785 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 _0xd117=['filter','merge','VIRTUAL','count','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','UserProfileResource','fieldName','type','map','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x5b3712,_0x55c33c){var _0x513549=function(_0x3cf881){while(--_0x3cf881){_0x5b3712['push'](_0x5b3712['shift']());}};_0x513549(++_0x55c33c);}(_0xd117,0x182));var _0x7d11=function(_0x4471ff,_0x4bb7de){_0x4471ff=_0x4471ff-0x0;var _0xe723ca=_0xd117[_0x4471ff];return _0xe723ca;};'use strict';var emlformat=require(_0x7d11('0x0'));var rimraf=require(_0x7d11('0x1'));var zipdir=require(_0x7d11('0x2'));var jsonpatch=require(_0x7d11('0x3'));var rp=require(_0x7d11('0x4'));var moment=require(_0x7d11('0x5'));var BPromise=require(_0x7d11('0x6'));var Mustache=require(_0x7d11('0x7'));var util=require(_0x7d11('0x8'));var path=require(_0x7d11('0x9'));var sox=require(_0x7d11('0xa'));var csv=require(_0x7d11('0xb'));var ejs=require(_0x7d11('0xc'));var fs=require('fs');var fs_extra=require(_0x7d11('0xd'));var _=require(_0x7d11('0xe'));var squel=require(_0x7d11('0xf'));var crypto=require('crypto');var jsforce=require(_0x7d11('0x10'));var deskjs=require(_0x7d11('0x11'));var toCsv=require(_0x7d11('0xb'));var querystring=require('querystring');var Papa=require(_0x7d11('0x12'));var Redis=require(_0x7d11('0x13'));var authService=require(_0x7d11('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x7d11('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7d11('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7d11('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4767d5,_0x471f46){_0x471f46=_0x471f46||0xcc;return function(_0x5ee572){if(_0x5ee572){return _0x4767d5[_0x7d11('0x18')](_0x471f46);}return _0x4767d5[_0x7d11('0x19')](_0x471f46)['end']();};}function respondWithResult(_0x324de5,_0x16949d){_0x16949d=_0x16949d||0xc8;return function(_0x20a2df){if(_0x20a2df){return _0x324de5[_0x7d11('0x19')](_0x16949d)[_0x7d11('0x1a')](_0x20a2df);}};}function respondWithFilteredResult(_0xeae744,_0x2a269e){return function(_0xb1669e){if(_0xb1669e){var _0x4aa795=typeof _0x2a269e[_0x7d11('0x1b')]===_0x7d11('0x1c')&&typeof _0x2a269e[_0x7d11('0x1d')]===_0x7d11('0x1c');var _0x45f916=_0xb1669e['count'];var _0x456cb9=_0x4aa795?0x0:_0x2a269e[_0x7d11('0x1b')];var _0x4d1306=_0x4aa795?_0xb1669e['count']:_0x2a269e[_0x7d11('0x1b')]+_0x2a269e['limit'];var _0x1f9990;if(_0x4d1306>=_0x45f916){_0x4d1306=_0x45f916;_0x1f9990=0xc8;}else{_0x1f9990=0xce;}_0xeae744['status'](_0x1f9990);return _0xeae744[_0x7d11('0x1e')](_0x7d11('0x1f'),_0x456cb9+'-'+_0x4d1306+'/'+_0x45f916)[_0x7d11('0x1a')](_0xb1669e);}return null;};}function patchUpdates(_0x46f662){return function(_0x30df70){try{jsonpatch[_0x7d11('0x20')](_0x30df70,_0x46f662,!![]);}catch(_0x4297f8){return BPromise[_0x7d11('0x21')](_0x4297f8);}return _0x30df70['save']();};}function saveUpdates(_0x441917,_0x4a34f4){return function(_0x58455b){if(_0x58455b){return _0x58455b['update'](_0x441917)[_0x7d11('0x22')](function(_0x3545dc){return _0x3545dc;});}return null;};}function removeEntity(_0x44476c,_0x1a7853){return function(_0x355d14){if(_0x355d14){return _0x355d14[_0x7d11('0x23')]()[_0x7d11('0x22')](function(){_0x44476c[_0x7d11('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36c2b4,_0x577ca9){return function(_0x4bfa76){if(!_0x4bfa76){_0x36c2b4['sendStatus'](0x194);}return _0x4bfa76;};}function handleError(_0x3ba092,_0x59cdba){_0x59cdba=_0x59cdba||0x1f4;return function(_0x180e1e){logger[_0x7d11('0x24')](_0x180e1e[_0x7d11('0x25')]);if(_0x180e1e['name']){delete _0x180e1e[_0x7d11('0x26')];}_0x3ba092[_0x7d11('0x19')](_0x59cdba)[_0x7d11('0x27')](_0x180e1e);};}exports['index']=function(_0x601650,_0x35a789){var _0x18c049={},_0x38f1be={},_0x4c7d6a={'count':0x0,'rows':[]};var _0x1a7745=_['map'](db[_0x7d11('0x28')]['rawAttributes'],function(_0x31866d){return{'name':_0x31866d[_0x7d11('0x29')],'type':_0x31866d[_0x7d11('0x2a')]['key']};});_0x38f1be['model']=_[_0x7d11('0x2b')](_0x1a7745,_0x7d11('0x26'));_0x38f1be['query']=_[_0x7d11('0x2c')](_0x601650[_0x7d11('0x2d')]);_0x38f1be[_0x7d11('0x2e')]=_['intersection'](_0x38f1be[_0x7d11('0x2f')],_0x38f1be['query']);_0x18c049['attributes']=_[_0x7d11('0x30')](_0x38f1be['model'],qs[_0x7d11('0x31')](_0x601650[_0x7d11('0x2d')][_0x7d11('0x31')]));_0x18c049[_0x7d11('0x32')]=_0x18c049['attributes'][_0x7d11('0x33')]?_0x18c049[_0x7d11('0x32')]:_0x38f1be['model'];if(!_0x601650['query'][_0x7d11('0x34')](_0x7d11('0x35'))){_0x18c049['limit']=qs[_0x7d11('0x1d')](_0x601650['query']['limit']);_0x18c049[_0x7d11('0x1b')]=qs['offset'](_0x601650['query'][_0x7d11('0x1b')]);}_0x18c049[_0x7d11('0x36')]=qs[_0x7d11('0x37')](_0x601650[_0x7d11('0x2d')][_0x7d11('0x37')]);_0x18c049[_0x7d11('0x38')]=qs[_0x7d11('0x2e')](_[_0x7d11('0x39')](_0x601650[_0x7d11('0x2d')],_0x38f1be[_0x7d11('0x2e')]),_0x1a7745);if(_0x601650[_0x7d11('0x2d')][_0x7d11('0x3a')]){_0x18c049['where']=_[_0x7d11('0x3b')](_0x18c049['where'],{'$or':_[_0x7d11('0x2b')](_0x1a7745,function(_0x111e26){if(_0x111e26[_0x7d11('0x2a')]!==_0x7d11('0x3c')){var _0x4f8fd2={};_0x4f8fd2[_0x111e26[_0x7d11('0x26')]]={'$like':'%'+_0x601650[_0x7d11('0x2d')][_0x7d11('0x3a')]+'%'};return _0x4f8fd2;}})});}_0x18c049=_[_0x7d11('0x3b')]({},_0x18c049,_0x601650['options']);var _0x22730e={'where':_0x18c049['where']};return db[_0x7d11('0x28')]['count'](_0x22730e)[_0x7d11('0x22')](function(_0x622725){_0x4c7d6a[_0x7d11('0x3d')]=_0x622725;if(_0x601650[_0x7d11('0x2d')]['includeAll']){_0x18c049['include']=[{'all':!![]}];}return db[_0x7d11('0x28')][_0x7d11('0x3e')](_0x18c049);})['then'](function(_0x1caef9){_0x4c7d6a[_0x7d11('0x3f')]=_0x1caef9;return _0x4c7d6a;})[_0x7d11('0x22')](respondWithFilteredResult(_0x35a789,_0x18c049))[_0x7d11('0x40')](handleError(_0x35a789,null));};exports[_0x7d11('0x41')]=function(_0x2e1647,_0x47e968){var _0x25b73b={'raw':![],'where':{'id':_0x2e1647[_0x7d11('0x42')]['id']}},_0x5cf6a6={};_0x5cf6a6[_0x7d11('0x2f')]=_[_0x7d11('0x2c')](db[_0x7d11('0x28')][_0x7d11('0x43')]);_0x5cf6a6[_0x7d11('0x2d')]=_['keys'](_0x2e1647['query']);_0x5cf6a6['filters']=_[_0x7d11('0x30')](_0x5cf6a6[_0x7d11('0x2f')],_0x5cf6a6[_0x7d11('0x2d')]);_0x25b73b[_0x7d11('0x32')]=_[_0x7d11('0x30')](_0x5cf6a6['model'],qs[_0x7d11('0x31')](_0x2e1647[_0x7d11('0x2d')]['fields']));_0x25b73b[_0x7d11('0x32')]=_0x25b73b[_0x7d11('0x32')][_0x7d11('0x33')]?_0x25b73b['attributes']:_0x5cf6a6[_0x7d11('0x2f')];if(_0x2e1647[_0x7d11('0x2d')][_0x7d11('0x44')]){_0x25b73b['include']=[{'all':!![]}];}_0x25b73b=_[_0x7d11('0x3b')]({},_0x25b73b,_0x2e1647['options']);return db[_0x7d11('0x28')][_0x7d11('0x45')](_0x25b73b)[_0x7d11('0x22')](handleEntityNotFound(_0x47e968,null))[_0x7d11('0x22')](respondWithResult(_0x47e968,null))[_0x7d11('0x40')](handleError(_0x47e968,null));};exports[_0x7d11('0x46')]=function(_0x161213,_0x193631){return db[_0x7d11('0x28')]['create'](_0x161213['body'],{})['then'](respondWithResult(_0x193631,0xc9))[_0x7d11('0x40')](handleError(_0x193631,null));};exports[_0x7d11('0x47')]=function(_0x20297a,_0x18ae0e){if(_0x20297a[_0x7d11('0x48')]['id']){delete _0x20297a[_0x7d11('0x48')]['id'];}return db[_0x7d11('0x28')][_0x7d11('0x45')]({'where':{'id':_0x20297a[_0x7d11('0x42')]['id']}})[_0x7d11('0x22')](handleEntityNotFound(_0x18ae0e,null))[_0x7d11('0x22')](saveUpdates(_0x20297a[_0x7d11('0x48')],null))['then'](respondWithResult(_0x18ae0e,null))[_0x7d11('0x40')](handleError(_0x18ae0e,null));};exports[_0x7d11('0x23')]=function(_0x29207f,_0x553a03){return db['UserProfileResource'][_0x7d11('0x45')]({'where':{'id':_0x29207f[_0x7d11('0x42')]['id']}})[_0x7d11('0x22')](handleEntityNotFound(_0x553a03,null))['then'](removeEntity(_0x553a03,null))['catch'](handleError(_0x553a03,null));};exports[_0x7d11('0x49')]=function(_0x36af2b,_0x5e6234){return db[_0x7d11('0x28')][_0x7d11('0x49')]()[_0x7d11('0x22')](respondWithResult(_0x5e6234,null))[_0x7d11('0x40')](handleError(_0x5e6234,null));}; \ No newline at end of file +var _0x5f66=['bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','UserProfileResource','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','find','create','body','update','catch','describe','rimraf','fast-json-patch','request-promise','moment'];(function(_0x594e11,_0x28f652){var _0x5418ad=function(_0x5dcfa7){while(--_0x5dcfa7){_0x594e11['push'](_0x594e11['shift']());}};_0x5418ad(++_0x28f652);}(_0x5f66,0x1a0));var _0x65f6=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x5f66[_0x138adb];return _0x1b27f2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419819,_0x4862a5){_0x4862a5=_0x4862a5||0xcc;return function(_0x2f964a){if(_0x2f964a){return _0x419819[_0x65f6('0x14')](_0x4862a5);}return _0x419819[_0x65f6('0x15')](_0x4862a5)[_0x65f6('0x16')]();};}function respondWithResult(_0x369f96,_0x1d29fd){_0x1d29fd=_0x1d29fd||0xc8;return function(_0x44144b){if(_0x44144b){return _0x369f96[_0x65f6('0x15')](_0x1d29fd)[_0x65f6('0x17')](_0x44144b);}};}function respondWithFilteredResult(_0x3440af,_0x59154e){return function(_0x19b9ff){if(_0x19b9ff){var _0x49a913=typeof _0x59154e['offset']===_0x65f6('0x18')&&typeof _0x59154e[_0x65f6('0x19')]===_0x65f6('0x18');var _0x1c955c=_0x19b9ff[_0x65f6('0x1a')];var _0x1f974c=_0x49a913?0x0:_0x59154e[_0x65f6('0x1b')];var _0x18380e=_0x49a913?_0x19b9ff['count']:_0x59154e['offset']+_0x59154e[_0x65f6('0x19')];var _0x5b4055;if(_0x18380e>=_0x1c955c){_0x18380e=_0x1c955c;_0x5b4055=0xc8;}else{_0x5b4055=0xce;}_0x3440af['status'](_0x5b4055);return _0x3440af['set'](_0x65f6('0x1c'),_0x1f974c+'-'+_0x18380e+'/'+_0x1c955c)[_0x65f6('0x17')](_0x19b9ff);}return null;};}function patchUpdates(_0x5114a4){return function(_0x39e19f){try{jsonpatch[_0x65f6('0x1d')](_0x39e19f,_0x5114a4,!![]);}catch(_0xbee6a4){return BPromise[_0x65f6('0x1e')](_0xbee6a4);}return _0x39e19f[_0x65f6('0x1f')]();};}function saveUpdates(_0xc139c2,_0x581374){return function(_0x197a49){if(_0x197a49){return _0x197a49['update'](_0xc139c2)['then'](function(_0x212247){return _0x212247;});}return null;};}function removeEntity(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(_0x1eeaaa){return _0x1eeaaa[_0x65f6('0x20')]()[_0x65f6('0x21')](function(){_0xd173f4[_0x65f6('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d7bb0,_0x59ea32){return function(_0x20a161){if(!_0x20a161){_0x9d7bb0['sendStatus'](0x194);}return _0x20a161;};}function handleError(_0x5cb131,_0x4fde2f){_0x4fde2f=_0x4fde2f||0x1f4;return function(_0x29abdb){logger[_0x65f6('0x22')](_0x29abdb['stack']);if(_0x29abdb[_0x65f6('0x23')]){delete _0x29abdb[_0x65f6('0x23')];}_0x5cb131['status'](_0x4fde2f)[_0x65f6('0x24')](_0x29abdb);};}exports[_0x65f6('0x25')]=function(_0x28d0df,_0x559330){var _0x4ac04b={},_0x488d36={},_0x266cfe={'count':0x0,'rows':[]};var _0x3c032f=_[_0x65f6('0x26')](db[_0x65f6('0x27')][_0x65f6('0x28')],function(_0x14a387){return{'name':_0x14a387[_0x65f6('0x29')],'type':_0x14a387['type']['key']};});_0x488d36[_0x65f6('0x2a')]=_[_0x65f6('0x26')](_0x3c032f,'name');_0x488d36['query']=_[_0x65f6('0x2b')](_0x28d0df[_0x65f6('0x2c')]);_0x488d36[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],_0x488d36[_0x65f6('0x2c')]);_0x4ac04b['attributes']=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x28d0df['query'][_0x65f6('0x2f')]));_0x4ac04b[_0x65f6('0x30')]=_0x4ac04b[_0x65f6('0x30')][_0x65f6('0x31')]?_0x4ac04b[_0x65f6('0x30')]:_0x488d36[_0x65f6('0x2a')];if(!_0x28d0df['query'][_0x65f6('0x32')](_0x65f6('0x33'))){_0x4ac04b['limit']=qs[_0x65f6('0x19')](_0x28d0df['query'][_0x65f6('0x19')]);_0x4ac04b['offset']=qs[_0x65f6('0x1b')](_0x28d0df[_0x65f6('0x2c')]['offset']);}_0x4ac04b[_0x65f6('0x34')]=qs[_0x65f6('0x35')](_0x28d0df[_0x65f6('0x2c')]['sort']);_0x4ac04b['where']=qs[_0x65f6('0x2d')](_['pick'](_0x28d0df[_0x65f6('0x2c')],_0x488d36['filters']),_0x3c032f);if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]){_0x4ac04b['where']=_[_0x65f6('0x37')](_0x4ac04b['where'],{'$or':_['map'](_0x3c032f,function(_0x71b16b){if(_0x71b16b[_0x65f6('0x38')]!==_0x65f6('0x39')){var _0x313be5={};_0x313be5[_0x71b16b[_0x65f6('0x23')]]={'$like':'%'+_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]+'%'};return _0x313be5;}})});}_0x4ac04b=_[_0x65f6('0x37')]({},_0x4ac04b,_0x28d0df['options']);var _0x3aa254={'where':_0x4ac04b['where']};return db[_0x65f6('0x27')][_0x65f6('0x1a')](_0x3aa254)[_0x65f6('0x21')](function(_0x2ea7f7){_0x266cfe['count']=_0x2ea7f7;if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x4ac04b[_0x65f6('0x3b')]=[{'all':!![]}];}return db[_0x65f6('0x27')][_0x65f6('0x3c')](_0x4ac04b);})[_0x65f6('0x21')](function(_0xed4c96){_0x266cfe[_0x65f6('0x3d')]=_0xed4c96;return _0x266cfe;})[_0x65f6('0x21')](respondWithFilteredResult(_0x559330,_0x4ac04b))['catch'](handleError(_0x559330,null));};exports[_0x65f6('0x3e')]=function(_0x400ed2,_0x377ae5){var _0x181798={'raw':![],'where':{'id':_0x400ed2[_0x65f6('0x3f')]['id']}},_0x83e2d9={};_0x83e2d9[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](db[_0x65f6('0x27')][_0x65f6('0x28')]);_0x83e2d9[_0x65f6('0x2c')]=_[_0x65f6('0x2b')](_0x400ed2[_0x65f6('0x2c')]);_0x83e2d9[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x83e2d9[_0x65f6('0x2a')],_0x83e2d9['query']);_0x181798[_0x65f6('0x30')]=_[_0x65f6('0x2e')](_0x83e2d9[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x400ed2['query'][_0x65f6('0x2f')]));_0x181798[_0x65f6('0x30')]=_0x181798[_0x65f6('0x30')]['length']?_0x181798[_0x65f6('0x30')]:_0x83e2d9[_0x65f6('0x2a')];if(_0x400ed2[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x181798['include']=[{'all':!![]}];}_0x181798=_[_0x65f6('0x37')]({},_0x181798,_0x400ed2['options']);return db[_0x65f6('0x27')][_0x65f6('0x40')](_0x181798)['then'](handleEntityNotFound(_0x377ae5,null))[_0x65f6('0x21')](respondWithResult(_0x377ae5,null))['catch'](handleError(_0x377ae5,null));};exports[_0x65f6('0x41')]=function(_0x4d9b76,_0x2d1706){return db[_0x65f6('0x27')][_0x65f6('0x41')](_0x4d9b76[_0x65f6('0x42')],{})['then'](respondWithResult(_0x2d1706,0xc9))['catch'](handleError(_0x2d1706,null));};exports[_0x65f6('0x43')]=function(_0x15d3ba,_0x3b647a){if(_0x15d3ba[_0x65f6('0x42')]['id']){delete _0x15d3ba[_0x65f6('0x42')]['id'];}return db[_0x65f6('0x27')][_0x65f6('0x40')]({'where':{'id':_0x15d3ba[_0x65f6('0x3f')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x3b647a,null))['then'](saveUpdates(_0x15d3ba[_0x65f6('0x42')],null))[_0x65f6('0x21')](respondWithResult(_0x3b647a,null))[_0x65f6('0x44')](handleError(_0x3b647a,null));};exports['destroy']=function(_0x47e749,_0x42d453){return db['UserProfileResource'][_0x65f6('0x40')]({'where':{'id':_0x47e749[_0x65f6('0x3f')]['id']}})['then'](handleEntityNotFound(_0x42d453,null))[_0x65f6('0x21')](removeEntity(_0x42d453,null))['catch'](handleError(_0x42d453,null));};exports[_0x65f6('0x45')]=function(_0x3b241f,_0x1ca67e){return db['UserProfileResource'][_0x65f6('0x45')]()[_0x65f6('0x21')](respondWithResult(_0x1ca67e,null))['catch'](handleError(_0x1ca67e,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 18b6c84..6fcf208 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 _0xff34=['api','moment','bluebird','request-promise','path','rimraf','./userProfileResource.attributes','define','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger'];(function(_0x43b616,_0xb842c){var _0xc188db=function(_0x2faaf5){while(--_0x2faaf5){_0x43b616['push'](_0x43b616['shift']());}};_0xc188db(++_0xb842c);}(_0xff34,0x192));var _0x4ff3=function(_0x5895ca,_0x5e67f1){_0x5895ca=_0x5895ca-0x0;var _0x4b6055=_0xff34[_0x5895ca];return _0x4b6055;};'use strict';var _=require(_0x4ff3('0x0'));var util=require(_0x4ff3('0x1'));var logger=require(_0x4ff3('0x2'))(_0x4ff3('0x3'));var moment=require(_0x4ff3('0x4'));var BPromise=require(_0x4ff3('0x5'));var rp=require(_0x4ff3('0x6'));var fs=require('fs');var path=require(_0x4ff3('0x7'));var rimraf=require(_0x4ff3('0x8'));var config=require('../../config/environment');var attributes=require(_0x4ff3('0x9'));module['exports']=function(_0x2a57b7,_0x57e770){return _0x2a57b7[_0x4ff3('0xa')]('UserProfileResource',attributes,{'tableName':_0x4ff3('0xb'),'paranoid':![],'indexes':[{'name':_0x4ff3('0xc'),'fields':[_0x4ff3('0xd'),_0x4ff3('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc439=['./userProfileResource.attributes','exports','define','user_profile_has_resources','compositeIndex','sectionId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xdce06c,_0x3ec17d){var _0x4fbee9=function(_0x97f242){while(--_0x97f242){_0xdce06c['push'](_0xdce06c['shift']());}};_0x4fbee9(++_0x3ec17d);}(_0xc439,0x1c6));var _0x9c43=function(_0x245147,_0x43bc0f){_0x245147=_0x245147-0x0;var _0x3a85c5=_0xc439[_0x245147];return _0x3a85c5;};'use strict';var _=require(_0x9c43('0x0'));var util=require(_0x9c43('0x1'));var logger=require(_0x9c43('0x2'))(_0x9c43('0x3'));var moment=require(_0x9c43('0x4'));var BPromise=require(_0x9c43('0x5'));var rp=require(_0x9c43('0x6'));var fs=require('fs');var path=require(_0x9c43('0x7'));var rimraf=require(_0x9c43('0x8'));var config=require(_0x9c43('0x9'));var attributes=require(_0x9c43('0xa'));module[_0x9c43('0xb')]=function(_0x58665e,_0xc2635c){return _0x58665e[_0x9c43('0xc')]('UserProfileResource',attributes,{'tableName':_0x9c43('0xd'),'paranoid':![],'indexes':[{'name':_0x9c43('0xe'),'fields':['resourceId',_0x9c43('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 442c6e0..6bb76ad 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 _0xa212=['code','message','info','result','catch','lodash','util','moment','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0xa212,0xec));var _0x2a21=function(_0x57c4bb,_0x284386){_0x57c4bb=_0x57c4bb-0x0;var _0x2ca240=_0xa212[_0x57c4bb];return _0x2ca240;};'use strict';var _=require(_0x2a21('0x0'));var util=require(_0x2a21('0x1'));var moment=require(_0x2a21('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2a21('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2a21('0x4'));var config=require(_0x2a21('0x5'));var jayson=require(_0x2a21('0x6'));var client=jayson[_0x2a21('0x7')][_0x2a21('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4f76c0,_0x3c0b85,_0x41b1ba){return new BPromise(function(_0x519ee3,_0x55ae9e){return client[_0x2a21('0x9')](_0x4f76c0,_0x41b1ba)[_0x2a21('0xa')](function(_0x3f73bc){logger['info'](_0x2a21('0xb'),_0x3c0b85,_0x2a21('0xc'));logger[_0x2a21('0xd')](_0x2a21('0xe'),_0x3c0b85,_0x2a21('0xc'),JSON['stringify'](_0x3f73bc));if(_0x3f73bc[_0x2a21('0xf')]){if(_0x3f73bc[_0x2a21('0xf')][_0x2a21('0x10')]===0x1f4){logger[_0x2a21('0xf')](_0x2a21('0xb'),_0x3c0b85,_0x3f73bc[_0x2a21('0xf')][_0x2a21('0x11')]);return _0x55ae9e(_0x3f73bc[_0x2a21('0xf')]['message']);}logger[_0x2a21('0xf')](_0x2a21('0xb'),_0x3c0b85,_0x3f73bc[_0x2a21('0xf')][_0x2a21('0x11')]);return _0x519ee3(_0x3f73bc[_0x2a21('0xf')][_0x2a21('0x11')]);}else{logger[_0x2a21('0x12')](_0x2a21('0xb'),_0x3c0b85,_0x2a21('0xc'));_0x519ee3(_0x3f73bc[_0x2a21('0x13')][_0x2a21('0x11')]);}})[_0x2a21('0x14')](function(_0x55e489){logger[_0x2a21('0xf')](_0x2a21('0xb'),_0x3c0b85,_0x55e489);_0x55ae9e(_0x55e489);});});} \ No newline at end of file +var _0x4501=['info','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','code','error','UserProfileResource,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then'];(function(_0x44b255,_0x3d924b){var _0x174e2c=function(_0x374d79){while(--_0x374d79){_0x44b255['push'](_0x44b255['shift']());}};_0x174e2c(++_0x3d924b);}(_0x4501,0x14d));var _0x1450=function(_0x181fd6,_0x117cdf){_0x181fd6=_0x181fd6-0x0;var _0x1424fa=_0x4501[_0x181fd6];return _0x1424fa;};'use strict';var _=require(_0x1450('0x0'));var util=require(_0x1450('0x1'));var moment=require(_0x1450('0x2'));var BPromise=require('bluebird');var rs=require(_0x1450('0x3'));var fs=require('fs');var Redis=require(_0x1450('0x4'));var db=require(_0x1450('0x5'))['db'];var utils=require(_0x1450('0x6'));var logger=require(_0x1450('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1450('0x8')][_0x1450('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1dcd04,_0x27024f,_0x3174d3){return new BPromise(function(_0x30242e,_0x5b44c9){return client[_0x1450('0xa')](_0x1dcd04,_0x3174d3)[_0x1450('0xb')](function(_0x2039dd){logger[_0x1450('0xc')]('UserProfileResource,\x20%s,\x20%s',_0x27024f,_0x1450('0xd'));logger[_0x1450('0xe')](_0x1450('0xf'),_0x27024f,'request\x20sent',JSON[_0x1450('0x10')](_0x2039dd));if(_0x2039dd['error']){if(_0x2039dd['error'][_0x1450('0x11')]===0x1f4){logger[_0x1450('0x12')](_0x1450('0x13'),_0x27024f,_0x2039dd[_0x1450('0x12')][_0x1450('0x14')]);return _0x5b44c9(_0x2039dd['error']['message']);}logger[_0x1450('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x27024f,_0x2039dd['error'][_0x1450('0x14')]);return _0x30242e(_0x2039dd['error']['message']);}else{logger[_0x1450('0xc')](_0x1450('0x13'),_0x27024f,'request\x20sent');_0x30242e(_0x2039dd[_0x1450('0x15')][_0x1450('0x14')]);}})[_0x1450('0x16')](function(_0x878251){logger['error'](_0x1450('0x13'),_0x27024f,_0x878251);_0x5b44c9(_0x878251);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 8d24218..7d384e0 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 _0x0a1f=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','destroy','exports','multer','util','path'];(function(_0x3b7fb0,_0x553e21){var _0x3b7fc5=function(_0x286bdc){while(--_0x286bdc){_0x3b7fb0['push'](_0x3b7fb0['shift']());}};_0x3b7fc5(++_0x553e21);}(_0x0a1f,0xef));var _0xf0a1=function(_0x51ccec,_0x2da2ed){_0x51ccec=_0x51ccec-0x0;var _0x2fe51d=_0x0a1f[_0x51ccec];return _0x2fe51d;};'use strict';var multer=require(_0xf0a1('0x0'));var util=require(_0xf0a1('0x1'));var path=require(_0xf0a1('0x2'));var timeout=require(_0xf0a1('0x3'));var express=require(_0xf0a1('0x4'));var router=express[_0xf0a1('0x5')]();var fs_extra=require(_0xf0a1('0x6'));var auth=require(_0xf0a1('0x7'));var interaction=require(_0xf0a1('0x8'));var config=require('../../config/environment');var controller=require(_0xf0a1('0x9'));router[_0xf0a1('0xa')]('/',auth[_0xf0a1('0xb')](),controller[_0xf0a1('0xc')]);router['get'](_0xf0a1('0xd'),auth['isAuthenticated'](),controller[_0xf0a1('0xe')]);router[_0xf0a1('0xa')](_0xf0a1('0xf'),auth[_0xf0a1('0xb')](),controller['show']);router[_0xf0a1('0x10')]('/',auth[_0xf0a1('0xb')](),controller[_0xf0a1('0x11')]);router[_0xf0a1('0x12')](_0xf0a1('0xf'),auth[_0xf0a1('0xb')](),controller[_0xf0a1('0x13')]);router['delete'](_0xf0a1('0xf'),auth[_0xf0a1('0xb')](),controller[_0xf0a1('0x14')]);module[_0xf0a1('0x15')]=router; \ No newline at end of file +var _0xbdb3=['./userProfileSection.controller','isAuthenticated','index','get','/describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x3a873e,_0x500ed1){var _0x3a3859=function(_0x266868){while(--_0x266868){_0x3a873e['push'](_0x3a873e['shift']());}};_0x3a3859(++_0x500ed1);}(_0xbdb3,0xca));var _0x3bdb=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xbdb3[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0x3bdb('0x0'));var util=require(_0x3bdb('0x1'));var path=require(_0x3bdb('0x2'));var timeout=require(_0x3bdb('0x3'));var express=require(_0x3bdb('0x4'));var router=express['Router']();var fs_extra=require(_0x3bdb('0x5'));var auth=require(_0x3bdb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3bdb('0x7'));var controller=require(_0x3bdb('0x8'));router['get']('/',auth[_0x3bdb('0x9')](),controller[_0x3bdb('0xa')]);router[_0x3bdb('0xb')](_0x3bdb('0xc'),auth[_0x3bdb('0x9')](),controller['describe']);router[_0x3bdb('0xb')](_0x3bdb('0xd'),auth[_0x3bdb('0x9')](),controller['show']);router[_0x3bdb('0xe')]('/',auth['isAuthenticated'](),controller[_0x3bdb('0xf')]);router[_0x3bdb('0x10')](_0x3bdb('0xd'),auth['isAuthenticated'](),controller[_0x3bdb('0x11')]);router[_0x3bdb('0x12')](_0x3bdb('0xd'),auth['isAuthenticated'](),controller[_0x3bdb('0x13')]);module[_0x3bdb('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 3477cdf..db4af72 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 _0x02ce=['BOOLEAN','setDataValue','crudPermissions','join','getDataValue','sequelize','exports','STRING','INTEGER'];(function(_0x2e3d80,_0x4e2ae4){var _0x326557=function(_0x1d5d63){while(--_0x1d5d63){_0x2e3d80['push'](_0x2e3d80['shift']());}};_0x326557(++_0x4e2ae4);}(_0x02ce,0x1ac));var _0xe02c=function(_0x3df333,_0x486849){_0x3df333=_0x3df333-0x0;var _0x428261=_0x02ce[_0x3df333];return _0x428261;};'use strict';var Sequelize=require(_0xe02c('0x0'));module[_0xe02c('0x1')]={'name':{'type':Sequelize[_0xe02c('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0xe02c('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xe02c('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xe02c('0x2')],'set':function(_0x46475c){this[_0xe02c('0x5')](_0xe02c('0x6'),_0x46475c?_0x46475c[_0xe02c('0x7')](''):[]);},'get':function(){return this[_0xe02c('0x8')](_0xe02c('0x6'))?this[_0xe02c('0x8')]('crudPermissions')['split'](''):[];}}}; \ No newline at end of file +var _0xb688=['STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','split','exports'];(function(_0x61528e,_0x12ecee){var _0x528049=function(_0x58dff2){while(--_0x58dff2){_0x61528e['push'](_0x61528e['shift']());}};_0x528049(++_0x12ecee);}(_0xb688,0xcf));var _0x8b68=function(_0x605cc2,_0x5196ac){_0x605cc2=_0x605cc2-0x0;var _0x31e18e=_0xb688[_0x605cc2];return _0x31e18e;};'use strict';var Sequelize=require('sequelize');module[_0x8b68('0x0')]={'name':{'type':Sequelize[_0x8b68('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x8b68('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x8b68('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x8b68('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x8b68('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x41030e){this[_0x8b68('0x4')](_0x8b68('0x5'),_0x41030e?_0x41030e[_0x8b68('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0x8b68('0x5'))?this['getDataValue'](_0x8b68('0x5'))[_0x8b68('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index f9f29fa..2e41617 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 _0xe8c2=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','end','error','stack','name','send','index','map','UserProfileSection','type','key','query','keys','filters','intersection','model','attributes','fields','length','sort','where','pick','filter','merge','options','then','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','body','destroy','describe','eml-format','rimraf'];(function(_0x1c16b5,_0x52afbc){var _0x54c5a2=function(_0x2c59eb){while(--_0x2c59eb){_0x1c16b5['push'](_0x1c16b5['shift']());}};_0x54c5a2(++_0x52afbc);}(_0xe8c2,0x1ba));var _0x2e8c=function(_0x295726,_0x5f072e){_0x295726=_0x295726-0x0;var _0x30315b=_0xe8c2[_0x295726];return _0x30315b;};'use strict';var emlformat=require(_0x2e8c('0x0'));var rimraf=require(_0x2e8c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2e8c('0x2'));var rp=require(_0x2e8c('0x3'));var moment=require(_0x2e8c('0x4'));var BPromise=require(_0x2e8c('0x5'));var Mustache=require(_0x2e8c('0x6'));var util=require(_0x2e8c('0x7'));var path=require(_0x2e8c('0x8'));var sox=require(_0x2e8c('0x9'));var csv=require(_0x2e8c('0xa'));var ejs=require(_0x2e8c('0xb'));var fs=require('fs');var fs_extra=require(_0x2e8c('0xc'));var _=require('lodash');var squel=require(_0x2e8c('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2e8c('0xa'));var querystring=require(_0x2e8c('0xe'));var Papa=require(_0x2e8c('0xf'));var Redis=require(_0x2e8c('0x10'));var authService=require(_0x2e8c('0x11'));var qs=require(_0x2e8c('0x12'));var as=require(_0x2e8c('0x13'));var hardwareService=require(_0x2e8c('0x14'));var logger=require(_0x2e8c('0x15'))(_0x2e8c('0x16'));var utils=require(_0x2e8c('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2e8c('0x18'))['db'];function respondWithStatusCode(_0xce2d8f,_0x2ceb56){_0x2ceb56=_0x2ceb56||0xcc;return function(_0x54f46a){if(_0x54f46a){return _0xce2d8f[_0x2e8c('0x19')](_0x2ceb56);}return _0xce2d8f[_0x2e8c('0x1a')](_0x2ceb56)['end']();};}function respondWithResult(_0x1a2911,_0x111b0c){_0x111b0c=_0x111b0c||0xc8;return function(_0x3e2d9c){if(_0x3e2d9c){return _0x1a2911['status'](_0x111b0c)[_0x2e8c('0x1b')](_0x3e2d9c);}};}function respondWithFilteredResult(_0x332c73,_0x15bb6d){return function(_0x490059){if(_0x490059){var _0x3839b0=typeof _0x15bb6d[_0x2e8c('0x1c')]===_0x2e8c('0x1d')&&typeof _0x15bb6d[_0x2e8c('0x1e')]===_0x2e8c('0x1d');var _0x44be5e=_0x490059['count'];var _0x36cddd=_0x3839b0?0x0:_0x15bb6d[_0x2e8c('0x1c')];var _0x1405a6=_0x3839b0?_0x490059[_0x2e8c('0x1f')]:_0x15bb6d[_0x2e8c('0x1c')]+_0x15bb6d['limit'];var _0x3ca856;if(_0x1405a6>=_0x44be5e){_0x1405a6=_0x44be5e;_0x3ca856=0xc8;}else{_0x3ca856=0xce;}_0x332c73[_0x2e8c('0x1a')](_0x3ca856);return _0x332c73[_0x2e8c('0x20')](_0x2e8c('0x21'),_0x36cddd+'-'+_0x1405a6+'/'+_0x44be5e)['json'](_0x490059);}return null;};}function patchUpdates(_0x107da2){return function(_0xab3da9){try{jsonpatch['apply'](_0xab3da9,_0x107da2,!![]);}catch(_0x3276c3){return BPromise[_0x2e8c('0x22')](_0x3276c3);}return _0xab3da9[_0x2e8c('0x23')]();};}function saveUpdates(_0x186273,_0x27221e){return function(_0x5a7299){if(_0x5a7299){return _0x5a7299[_0x2e8c('0x24')](_0x186273)['then'](function(_0x4db2a8){return _0x4db2a8;});}return null;};}function removeEntity(_0xa2f09f,_0x40131d){return function(_0x593b6e){if(_0x593b6e){return _0x593b6e['destroy']()['then'](function(){_0xa2f09f[_0x2e8c('0x1a')](0xcc)[_0x2e8c('0x25')]();});}};}function handleEntityNotFound(_0x53fd14,_0x3fb3ab){return function(_0xff8414){if(!_0xff8414){_0x53fd14[_0x2e8c('0x19')](0x194);}return _0xff8414;};}function handleError(_0x2deeef,_0x2d02e5){_0x2d02e5=_0x2d02e5||0x1f4;return function(_0x49f769){logger[_0x2e8c('0x26')](_0x49f769[_0x2e8c('0x27')]);if(_0x49f769[_0x2e8c('0x28')]){delete _0x49f769[_0x2e8c('0x28')];}_0x2deeef[_0x2e8c('0x1a')](_0x2d02e5)[_0x2e8c('0x29')](_0x49f769);};}exports[_0x2e8c('0x2a')]=function(_0x7c1e2,_0x42037a){var _0x7cb0f6={},_0x5b0a1f={},_0x98d4a5={'count':0x0,'rows':[]};var _0x514a98=_[_0x2e8c('0x2b')](db[_0x2e8c('0x2c')]['rawAttributes'],function(_0x115926){return{'name':_0x115926['fieldName'],'type':_0x115926[_0x2e8c('0x2d')][_0x2e8c('0x2e')]};});_0x5b0a1f['model']=_[_0x2e8c('0x2b')](_0x514a98,_0x2e8c('0x28'));_0x5b0a1f[_0x2e8c('0x2f')]=_[_0x2e8c('0x30')](_0x7c1e2[_0x2e8c('0x2f')]);_0x5b0a1f[_0x2e8c('0x31')]=_[_0x2e8c('0x32')](_0x5b0a1f[_0x2e8c('0x33')],_0x5b0a1f[_0x2e8c('0x2f')]);_0x7cb0f6[_0x2e8c('0x34')]=_[_0x2e8c('0x32')](_0x5b0a1f[_0x2e8c('0x33')],qs['fields'](_0x7c1e2[_0x2e8c('0x2f')][_0x2e8c('0x35')]));_0x7cb0f6[_0x2e8c('0x34')]=_0x7cb0f6[_0x2e8c('0x34')][_0x2e8c('0x36')]?_0x7cb0f6[_0x2e8c('0x34')]:_0x5b0a1f['model'];if(!_0x7c1e2[_0x2e8c('0x2f')]['hasOwnProperty']('nolimit')){_0x7cb0f6[_0x2e8c('0x1e')]=qs[_0x2e8c('0x1e')](_0x7c1e2[_0x2e8c('0x2f')][_0x2e8c('0x1e')]);_0x7cb0f6[_0x2e8c('0x1c')]=qs[_0x2e8c('0x1c')](_0x7c1e2['query'][_0x2e8c('0x1c')]);}_0x7cb0f6['order']=qs[_0x2e8c('0x37')](_0x7c1e2[_0x2e8c('0x2f')][_0x2e8c('0x37')]);_0x7cb0f6[_0x2e8c('0x38')]=qs['filters'](_[_0x2e8c('0x39')](_0x7c1e2['query'],_0x5b0a1f[_0x2e8c('0x31')]),_0x514a98);if(_0x7c1e2[_0x2e8c('0x2f')][_0x2e8c('0x3a')]){_0x7cb0f6[_0x2e8c('0x38')]=_[_0x2e8c('0x3b')](_0x7cb0f6['where'],{'$or':_[_0x2e8c('0x2b')](_0x514a98,function(_0x302847){if(_0x302847[_0x2e8c('0x2d')]!=='VIRTUAL'){var _0x4692e2={};_0x4692e2[_0x302847[_0x2e8c('0x28')]]={'$like':'%'+_0x7c1e2[_0x2e8c('0x2f')][_0x2e8c('0x3a')]+'%'};return _0x4692e2;}})});}_0x7cb0f6=_[_0x2e8c('0x3b')]({},_0x7cb0f6,_0x7c1e2[_0x2e8c('0x3c')]);var _0x44d448={'where':_0x7cb0f6[_0x2e8c('0x38')]};return db[_0x2e8c('0x2c')][_0x2e8c('0x1f')](_0x44d448)[_0x2e8c('0x3d')](function(_0x3be569){_0x98d4a5[_0x2e8c('0x1f')]=_0x3be569;if(_0x7c1e2[_0x2e8c('0x2f')]['includeAll']){_0x7cb0f6[_0x2e8c('0x3e')]=[{'all':!![]}];}return db[_0x2e8c('0x2c')][_0x2e8c('0x3f')](_0x7cb0f6);})[_0x2e8c('0x3d')](function(_0x49aa5d){_0x98d4a5[_0x2e8c('0x40')]=_0x49aa5d;return _0x98d4a5;})['then'](respondWithFilteredResult(_0x42037a,_0x7cb0f6))[_0x2e8c('0x41')](handleError(_0x42037a,null));};exports[_0x2e8c('0x42')]=function(_0x47d52a,_0x5c525e){var _0x5858a5={'raw':![],'where':{'id':_0x47d52a[_0x2e8c('0x43')]['id']}},_0x249f88={};_0x249f88[_0x2e8c('0x33')]=_[_0x2e8c('0x30')](db[_0x2e8c('0x2c')][_0x2e8c('0x44')]);_0x249f88[_0x2e8c('0x2f')]=_[_0x2e8c('0x30')](_0x47d52a[_0x2e8c('0x2f')]);_0x249f88[_0x2e8c('0x31')]=_['intersection'](_0x249f88[_0x2e8c('0x33')],_0x249f88['query']);_0x5858a5[_0x2e8c('0x34')]=_[_0x2e8c('0x32')](_0x249f88[_0x2e8c('0x33')],qs[_0x2e8c('0x35')](_0x47d52a[_0x2e8c('0x2f')][_0x2e8c('0x35')]));_0x5858a5['attributes']=_0x5858a5[_0x2e8c('0x34')][_0x2e8c('0x36')]?_0x5858a5[_0x2e8c('0x34')]:_0x249f88[_0x2e8c('0x33')];if(_0x47d52a[_0x2e8c('0x2f')][_0x2e8c('0x45')]){_0x5858a5['include']=[{'all':!![]}];}_0x5858a5=_[_0x2e8c('0x3b')]({},_0x5858a5,_0x47d52a[_0x2e8c('0x3c')]);return db[_0x2e8c('0x2c')][_0x2e8c('0x46')](_0x5858a5)[_0x2e8c('0x3d')](handleEntityNotFound(_0x5c525e,null))[_0x2e8c('0x3d')](respondWithResult(_0x5c525e,null))[_0x2e8c('0x41')](handleError(_0x5c525e,null));};exports['create']=function(_0x8e58cc,_0x51352f){return db['UserProfileSection']['create'](_0x8e58cc[_0x2e8c('0x47')],{})[_0x2e8c('0x3d')](respondWithResult(_0x51352f,0xc9))[_0x2e8c('0x41')](handleError(_0x51352f,null));};exports[_0x2e8c('0x24')]=function(_0x1ce374,_0x520ac7){if(_0x1ce374[_0x2e8c('0x47')]['id']){delete _0x1ce374[_0x2e8c('0x47')]['id'];}return db[_0x2e8c('0x2c')][_0x2e8c('0x46')]({'where':{'id':_0x1ce374[_0x2e8c('0x43')]['id']}})[_0x2e8c('0x3d')](handleEntityNotFound(_0x520ac7,null))[_0x2e8c('0x3d')](saveUpdates(_0x1ce374[_0x2e8c('0x47')],null))[_0x2e8c('0x3d')](respondWithResult(_0x520ac7,null))[_0x2e8c('0x41')](handleError(_0x520ac7,null));};exports[_0x2e8c('0x48')]=function(_0x40c37b,_0x4efb0a){return db[_0x2e8c('0x2c')][_0x2e8c('0x46')]({'where':{'id':_0x40c37b[_0x2e8c('0x43')]['id']}})['then'](handleEntityNotFound(_0x4efb0a,null))[_0x2e8c('0x3d')](removeEntity(_0x4efb0a,null))['catch'](handleError(_0x4efb0a,null));};exports[_0x2e8c('0x49')]=function(_0x4e7d49,_0x1eff2b){return db[_0x2e8c('0x2c')][_0x2e8c('0x49')]()[_0x2e8c('0x3d')](respondWithResult(_0x1eff2b,null))[_0x2e8c('0x41')](handleError(_0x1eff2b,null));}; \ No newline at end of file +var _0x5c22=['rimraf','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','error','name','index','map','UserProfileSection','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','describe','eml-format'];(function(_0x1498ff,_0x37f016){var _0x303a12=function(_0x26f493){while(--_0x26f493){_0x1498ff['push'](_0x1498ff['shift']());}};_0x303a12(++_0x37f016);}(_0x5c22,0x8d));var _0x25c2=function(_0x53be51,_0x47f8f4){_0x53be51=_0x53be51-0x0;var _0x237114=_0x5c22[_0x53be51];return _0x237114;};'use strict';var emlformat=require(_0x25c2('0x0'));var rimraf=require(_0x25c2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x25c2('0x2'));var moment=require(_0x25c2('0x3'));var BPromise=require(_0x25c2('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x25c2('0x5'));var sox=require(_0x25c2('0x6'));var csv=require('to-csv');var ejs=require(_0x25c2('0x7'));var fs=require('fs');var fs_extra=require(_0x25c2('0x8'));var _=require(_0x25c2('0x9'));var squel=require(_0x25c2('0xa'));var crypto=require(_0x25c2('0xb'));var jsforce=require(_0x25c2('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x25c2('0xd'));var querystring=require('querystring');var Papa=require(_0x25c2('0xe'));var Redis=require(_0x25c2('0xf'));var authService=require(_0x25c2('0x10'));var qs=require(_0x25c2('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x25c2('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x25c2('0x13'));var config=require(_0x25c2('0x14'));var licenseUtil=require(_0x25c2('0x15'));var db=require(_0x25c2('0x16'))['db'];function respondWithStatusCode(_0x3b9372,_0x2fad99){_0x2fad99=_0x2fad99||0xcc;return function(_0x3bc609){if(_0x3bc609){return _0x3b9372[_0x25c2('0x17')](_0x2fad99);}return _0x3b9372[_0x25c2('0x18')](_0x2fad99)[_0x25c2('0x19')]();};}function respondWithResult(_0x5d2b7a,_0x13556e){_0x13556e=_0x13556e||0xc8;return function(_0xee5c1a){if(_0xee5c1a){return _0x5d2b7a[_0x25c2('0x18')](_0x13556e)[_0x25c2('0x1a')](_0xee5c1a);}};}function respondWithFilteredResult(_0x1c9854,_0x1ee761){return function(_0x5c9ab0){if(_0x5c9ab0){var _0x13808f=typeof _0x1ee761['offset']===_0x25c2('0x1b')&&typeof _0x1ee761[_0x25c2('0x1c')]===_0x25c2('0x1b');var _0x123a7a=_0x5c9ab0[_0x25c2('0x1d')];var _0x414d60=_0x13808f?0x0:_0x1ee761[_0x25c2('0x1e')];var _0x4079ba=_0x13808f?_0x5c9ab0['count']:_0x1ee761['offset']+_0x1ee761[_0x25c2('0x1c')];var _0xfa18bd;if(_0x4079ba>=_0x123a7a){_0x4079ba=_0x123a7a;_0xfa18bd=0xc8;}else{_0xfa18bd=0xce;}_0x1c9854[_0x25c2('0x18')](_0xfa18bd);return _0x1c9854[_0x25c2('0x1f')]('Content-Range',_0x414d60+'-'+_0x4079ba+'/'+_0x123a7a)[_0x25c2('0x1a')](_0x5c9ab0);}return null;};}function patchUpdates(_0x403ce5){return function(_0x6d166f){try{jsonpatch[_0x25c2('0x20')](_0x6d166f,_0x403ce5,!![]);}catch(_0x5f3e5a){return BPromise[_0x25c2('0x21')](_0x5f3e5a);}return _0x6d166f[_0x25c2('0x22')]();};}function saveUpdates(_0x530265,_0x4abbcf){return function(_0x11bc3f){if(_0x11bc3f){return _0x11bc3f[_0x25c2('0x23')](_0x530265)[_0x25c2('0x24')](function(_0x94d91b){return _0x94d91b;});}return null;};}function removeEntity(_0x42e282,_0x362762){return function(_0x9bf5cb){if(_0x9bf5cb){return _0x9bf5cb[_0x25c2('0x25')]()[_0x25c2('0x24')](function(){_0x42e282['status'](0xcc)[_0x25c2('0x19')]();});}};}function handleEntityNotFound(_0x5278bd,_0x49bc43){return function(_0x2b519b){if(!_0x2b519b){_0x5278bd[_0x25c2('0x17')](0x194);}return _0x2b519b;};}function handleError(_0x34d12a,_0x19053c){_0x19053c=_0x19053c||0x1f4;return function(_0x4e99af){logger[_0x25c2('0x26')](_0x4e99af['stack']);if(_0x4e99af[_0x25c2('0x27')]){delete _0x4e99af[_0x25c2('0x27')];}_0x34d12a[_0x25c2('0x18')](_0x19053c)['send'](_0x4e99af);};}exports[_0x25c2('0x28')]=function(_0x1fd05a,_0x18a6e2){var _0x28a881={},_0x56ce83={},_0x410388={'count':0x0,'rows':[]};var _0x2c1919=_[_0x25c2('0x29')](db[_0x25c2('0x2a')][_0x25c2('0x2b')],function(_0x152315){return{'name':_0x152315['fieldName'],'type':_0x152315[_0x25c2('0x2c')]['key']};});_0x56ce83[_0x25c2('0x2d')]=_['map'](_0x2c1919,_0x25c2('0x27'));_0x56ce83[_0x25c2('0x2e')]=_[_0x25c2('0x2f')](_0x1fd05a[_0x25c2('0x2e')]);_0x56ce83[_0x25c2('0x30')]=_[_0x25c2('0x31')](_0x56ce83[_0x25c2('0x2d')],_0x56ce83[_0x25c2('0x2e')]);_0x28a881['attributes']=_[_0x25c2('0x31')](_0x56ce83[_0x25c2('0x2d')],qs[_0x25c2('0x32')](_0x1fd05a[_0x25c2('0x2e')]['fields']));_0x28a881['attributes']=_0x28a881[_0x25c2('0x33')][_0x25c2('0x34')]?_0x28a881[_0x25c2('0x33')]:_0x56ce83['model'];if(!_0x1fd05a[_0x25c2('0x2e')]['hasOwnProperty']('nolimit')){_0x28a881[_0x25c2('0x1c')]=qs[_0x25c2('0x1c')](_0x1fd05a[_0x25c2('0x2e')][_0x25c2('0x1c')]);_0x28a881[_0x25c2('0x1e')]=qs[_0x25c2('0x1e')](_0x1fd05a[_0x25c2('0x2e')][_0x25c2('0x1e')]);}_0x28a881[_0x25c2('0x35')]=qs[_0x25c2('0x36')](_0x1fd05a[_0x25c2('0x2e')]['sort']);_0x28a881['where']=qs[_0x25c2('0x30')](_[_0x25c2('0x37')](_0x1fd05a[_0x25c2('0x2e')],_0x56ce83[_0x25c2('0x30')]),_0x2c1919);if(_0x1fd05a[_0x25c2('0x2e')][_0x25c2('0x38')]){_0x28a881[_0x25c2('0x39')]=_[_0x25c2('0x3a')](_0x28a881[_0x25c2('0x39')],{'$or':_['map'](_0x2c1919,function(_0x4476ac){if(_0x4476ac[_0x25c2('0x2c')]!==_0x25c2('0x3b')){var _0x3526ce={};_0x3526ce[_0x4476ac[_0x25c2('0x27')]]={'$like':'%'+_0x1fd05a[_0x25c2('0x2e')][_0x25c2('0x38')]+'%'};return _0x3526ce;}})});}_0x28a881=_['merge']({},_0x28a881,_0x1fd05a[_0x25c2('0x3c')]);var _0x5db85e={'where':_0x28a881[_0x25c2('0x39')]};return db[_0x25c2('0x2a')]['count'](_0x5db85e)[_0x25c2('0x24')](function(_0x14b173){_0x410388['count']=_0x14b173;if(_0x1fd05a['query'][_0x25c2('0x3d')]){_0x28a881[_0x25c2('0x3e')]=[{'all':!![]}];}return db[_0x25c2('0x2a')]['findAll'](_0x28a881);})[_0x25c2('0x24')](function(_0x59fec3){_0x410388[_0x25c2('0x3f')]=_0x59fec3;return _0x410388;})[_0x25c2('0x24')](respondWithFilteredResult(_0x18a6e2,_0x28a881))[_0x25c2('0x40')](handleError(_0x18a6e2,null));};exports[_0x25c2('0x41')]=function(_0x27fd09,_0x385c9f){var _0x593369={'raw':![],'where':{'id':_0x27fd09[_0x25c2('0x42')]['id']}},_0x5baca3={};_0x5baca3[_0x25c2('0x2d')]=_[_0x25c2('0x2f')](db[_0x25c2('0x2a')][_0x25c2('0x2b')]);_0x5baca3[_0x25c2('0x2e')]=_[_0x25c2('0x2f')](_0x27fd09[_0x25c2('0x2e')]);_0x5baca3[_0x25c2('0x30')]=_[_0x25c2('0x31')](_0x5baca3[_0x25c2('0x2d')],_0x5baca3[_0x25c2('0x2e')]);_0x593369[_0x25c2('0x33')]=_['intersection'](_0x5baca3['model'],qs[_0x25c2('0x32')](_0x27fd09[_0x25c2('0x2e')][_0x25c2('0x32')]));_0x593369[_0x25c2('0x33')]=_0x593369[_0x25c2('0x33')]['length']?_0x593369[_0x25c2('0x33')]:_0x5baca3['model'];if(_0x27fd09[_0x25c2('0x2e')][_0x25c2('0x3d')]){_0x593369[_0x25c2('0x3e')]=[{'all':!![]}];}_0x593369=_[_0x25c2('0x3a')]({},_0x593369,_0x27fd09[_0x25c2('0x3c')]);return db[_0x25c2('0x2a')][_0x25c2('0x43')](_0x593369)['then'](handleEntityNotFound(_0x385c9f,null))[_0x25c2('0x24')](respondWithResult(_0x385c9f,null))['catch'](handleError(_0x385c9f,null));};exports[_0x25c2('0x44')]=function(_0x520b4c,_0x22a1ab){return db['UserProfileSection'][_0x25c2('0x44')](_0x520b4c['body'],{})['then'](respondWithResult(_0x22a1ab,0xc9))[_0x25c2('0x40')](handleError(_0x22a1ab,null));};exports[_0x25c2('0x23')]=function(_0x36ffb3,_0x5db071){if(_0x36ffb3[_0x25c2('0x45')]['id']){delete _0x36ffb3[_0x25c2('0x45')]['id'];}return db[_0x25c2('0x2a')][_0x25c2('0x43')]({'where':{'id':_0x36ffb3[_0x25c2('0x42')]['id']}})[_0x25c2('0x24')](handleEntityNotFound(_0x5db071,null))['then'](saveUpdates(_0x36ffb3[_0x25c2('0x45')],null))[_0x25c2('0x24')](respondWithResult(_0x5db071,null))[_0x25c2('0x40')](handleError(_0x5db071,null));};exports[_0x25c2('0x25')]=function(_0x32e998,_0xacf672){return db['UserProfileSection'][_0x25c2('0x43')]({'where':{'id':_0x32e998[_0x25c2('0x42')]['id']}})[_0x25c2('0x24')](handleEntityNotFound(_0xacf672,null))[_0x25c2('0x24')](removeEntity(_0xacf672,null))[_0x25c2('0x40')](handleError(_0xacf672,null));};exports[_0x25c2('0x46')]=function(_0x45b12d,_0x45df56){return db['UserProfileSection'][_0x25c2('0x46')]()[_0x25c2('0x24')](respondWithResult(_0x45df56,null))['catch'](handleError(_0x45df56,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 0d44720..ab20575 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 _0xbedb=['util','../../config/logger','request-promise','path','rimraf','./userProfileSection.attributes','exports','define','compositeIndex','sectionId','userProfileId','lodash'];(function(_0x17ea97,_0x234a33){var _0x3ed183=function(_0xfcb57c){while(--_0xfcb57c){_0x17ea97['push'](_0x17ea97['shift']());}};_0x3ed183(++_0x234a33);}(_0xbedb,0xe3));var _0xbbed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbedb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xbbed('0x0'));var util=require(_0xbbed('0x1'));var logger=require(_0xbbed('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbbed('0x3'));var fs=require('fs');var path=require(_0xbbed('0x4'));var rimraf=require(_0xbbed('0x5'));var config=require('../../config/environment');var attributes=require(_0xbbed('0x6'));module[_0xbbed('0x7')]=function(_0x10d2b3,_0x372d5f){return _0x10d2b3[_0xbbed('0x8')]('UserProfileSection',attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0xbbed('0x9'),'fields':[_0xbbed('0xa'),_0xbbed('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3c15=['../../config/logger','api','bluebird','path','../../config/environment','./userProfileSection.attributes','exports','define','compositeIndex','userProfileId','lodash','util'];(function(_0x16dbfd,_0x2f9431){var _0x382254=function(_0x19dade){while(--_0x19dade){_0x16dbfd['push'](_0x16dbfd['shift']());}};_0x382254(++_0x2f9431);}(_0x3c15,0x9a));var _0x53c1=function(_0x178015,_0x4bcd41){_0x178015=_0x178015-0x0;var _0x5ef3c5=_0x3c15[_0x178015];return _0x5ef3c5;};'use strict';var _=require(_0x53c1('0x0'));var util=require(_0x53c1('0x1'));var logger=require(_0x53c1('0x2'))(_0x53c1('0x3'));var moment=require('moment');var BPromise=require(_0x53c1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x53c1('0x5'));var rimraf=require('rimraf');var config=require(_0x53c1('0x6'));var attributes=require(_0x53c1('0x7'));module[_0x53c1('0x8')]=function(_0x2a3592,_0x5181f3){return _0x2a3592[_0x53c1('0x9')]('UserProfileSection',attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x53c1('0xa'),'fields':['sectionId',_0x53c1('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 21a5359..908c9d9 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 _0x89f8=['code','message','result','catch','lodash','util','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x89f8,0x14e));var _0x889f=function(_0x2ae78d,_0x4bdc21){_0x2ae78d=_0x2ae78d-0x0;var _0xb84c6a=_0x89f8[_0x2ae78d];return _0xb84c6a;};'use strict';var _=require(_0x889f('0x0'));var util=require(_0x889f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x889f('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x889f('0x3'))(_0x889f('0x4'));var config=require(_0x889f('0x5'));var jayson=require(_0x889f('0x6'));var client=jayson[_0x889f('0x7')][_0x889f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53c0b9,_0x1742a5,_0x22e9f6){return new BPromise(function(_0x51e027,_0xd9b5c9){return client[_0x889f('0x9')](_0x53c0b9,_0x22e9f6)[_0x889f('0xa')](function(_0x341546){logger[_0x889f('0xb')](_0x889f('0xc'),_0x1742a5,_0x889f('0xd'));logger[_0x889f('0xe')](_0x889f('0xf'),_0x1742a5,'request\x20sent',JSON[_0x889f('0x10')](_0x341546));if(_0x341546[_0x889f('0x11')]){if(_0x341546[_0x889f('0x11')][_0x889f('0x12')]===0x1f4){logger[_0x889f('0x11')](_0x889f('0xc'),_0x1742a5,_0x341546[_0x889f('0x11')][_0x889f('0x13')]);return _0xd9b5c9(_0x341546[_0x889f('0x11')]['message']);}logger[_0x889f('0x11')](_0x889f('0xc'),_0x1742a5,_0x341546['error'][_0x889f('0x13')]);return _0x51e027(_0x341546['error']['message']);}else{logger[_0x889f('0xb')](_0x889f('0xc'),_0x1742a5,'request\x20sent');_0x51e027(_0x341546[_0x889f('0x14')][_0x889f('0x13')]);}})[_0x889f('0x15')](function(_0x3a0a46){logger[_0x889f('0x11')]('UserProfileSection,\x20%s,\x20%s',_0x1742a5,_0x3a0a46);_0xd9b5c9(_0x3a0a46);});});} \ No newline at end of file +var _0xbecd=['catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','UserProfileSection,\x20%s,\x20%s','message','info'];(function(_0x25fdb1,_0x71aaa7){var _0x221606=function(_0x53d287){while(--_0x53d287){_0x25fdb1['push'](_0x25fdb1['shift']());}};_0x221606(++_0x71aaa7);}(_0xbecd,0x6a));var _0xdbec=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xbecd[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xdbec('0x0'));var util=require('util');var moment=require(_0xdbec('0x1'));var BPromise=require(_0xdbec('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdbec('0x3'));var db=require(_0xdbec('0x4'))['db'];var utils=require(_0xdbec('0x5'));var logger=require(_0xdbec('0x6'))(_0xdbec('0x7'));var config=require(_0xdbec('0x8'));var jayson=require(_0xdbec('0x9'));var client=jayson[_0xdbec('0xa')][_0xdbec('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38cac4,_0x13dfff,_0x380bf8){return new BPromise(function(_0x406cd3,_0x242b59){return client[_0xdbec('0xc')](_0x38cac4,_0x380bf8)['then'](function(_0x299d84){logger['info']('UserProfileSection,\x20%s,\x20%s',_0x13dfff,'request\x20sent');logger['debug'](_0xdbec('0xd'),_0x13dfff,_0xdbec('0xe'),JSON['stringify'](_0x299d84));if(_0x299d84[_0xdbec('0xf')]){if(_0x299d84[_0xdbec('0xf')][_0xdbec('0x10')]===0x1f4){logger[_0xdbec('0xf')](_0xdbec('0x11'),_0x13dfff,_0x299d84[_0xdbec('0xf')]['message']);return _0x242b59(_0x299d84[_0xdbec('0xf')][_0xdbec('0x12')]);}logger['error'](_0xdbec('0x11'),_0x13dfff,_0x299d84[_0xdbec('0xf')]['message']);return _0x406cd3(_0x299d84[_0xdbec('0xf')]['message']);}else{logger[_0xdbec('0x13')]('UserProfileSection,\x20%s,\x20%s',_0x13dfff,_0xdbec('0xe'));_0x406cd3(_0x299d84['result']['message']);}})[_0xdbec('0x14')](function(_0x1c9054){logger[_0xdbec('0xf')](_0xdbec('0x11'),_0x13dfff,_0x1c9054);_0x242b59(_0x1c9054);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 2669f91..09bfcbf 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x5e3fb7,_0x4f0c05){var _0x3c9228=function(_0x8636ae){while(--_0x8636ae){_0x5e3fb7['push'](_0x5e3fb7['shift']());}};_0x3c9228(++_0x4f0c05);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x7101a,_0x53ab1a){var _0x5d0b3f=function(_0x1afe97){while(--_0x1afe97){_0x7101a['push'](_0x7101a['shift']());}};_0x5d0b3f(++_0x53ab1a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xcb91[_0x18ab2a];return _0x16dcee;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 7ff5153..f5e27bb 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 _0x1784=['sequelize','INTEGER'];(function(_0x3220bb,_0x342a03){var _0x23415c=function(_0x56cc05){while(--_0x56cc05){_0x3220bb['push'](_0x3220bb['shift']());}};_0x23415c(++_0x342a03);}(_0x1784,0x1ec));var _0x4178=function(_0x2ec5b9,_0x56e0a3){_0x2ec5b9=_0x2ec5b9-0x0;var _0x10dcea=_0x1784[_0x2ec5b9];return _0x10dcea;};'use strict';var Sequelize=require(_0x4178('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x4178('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x98a8=['sequelize','exports','INTEGER'];(function(_0x3913d1,_0x5cba20){var _0x309948=function(_0x4a2103){while(--_0x4a2103){_0x3913d1['push'](_0x3913d1['shift']());}};_0x309948(++_0x5cba20);}(_0x98a8,0x12c));var _0x898a=function(_0x5c8b3f,_0x4612f9){_0x5c8b3f=_0x5c8b3f-0x0;var _0x3f2a2e=_0x98a8[_0x5c8b3f];return _0x3f2a2e;};'use strict';var Sequelize=require(_0x898a('0x0'));module[_0x898a('0x1')]={'penalty':{'type':Sequelize[_0x898a('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 c1f2424..dca3183 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 _0x6d38=['util','../../config/logger','api','request-promise','rimraf','../../config/environment','./userSmsQueue.attributes','define','UserSmsQueue'];(function(_0x7f56a5,_0x5c5075){var _0x5c7d75=function(_0x3e648d){while(--_0x3e648d){_0x7f56a5['push'](_0x7f56a5['shift']());}};_0x5c7d75(++_0x5c5075);}(_0x6d38,0x1ef));var _0x86d3=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x6d38[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var logger=require(_0x86d3('0x1'))(_0x86d3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x86d3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x86d3('0x4'));var config=require(_0x86d3('0x5'));var attributes=require(_0x86d3('0x6'));module['exports']=function(_0x2d8272,_0xfbbc15){return _0x2d8272[_0x86d3('0x7')](_0x86d3('0x8'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x524e=['define','UserSmsQueue','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports'];(function(_0x36bfe3,_0x358938){var _0x9b0436=function(_0x86e47d){while(--_0x86e47d){_0x36bfe3['push'](_0x36bfe3['shift']());}};_0x9b0436(++_0x358938);}(_0x524e,0x15e));var _0xe524=function(_0x4ce71e,_0x3e71e5){_0x4ce71e=_0x4ce71e-0x0;var _0x1650bf=_0x524e[_0x4ce71e];return _0x1650bf;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe524('0x0'))(_0xe524('0x1'));var moment=require(_0xe524('0x2'));var BPromise=require(_0xe524('0x3'));var rp=require(_0xe524('0x4'));var fs=require('fs');var path=require(_0xe524('0x5'));var rimraf=require(_0xe524('0x6'));var config=require(_0xe524('0x7'));var attributes=require(_0xe524('0x8'));module[_0xe524('0x9')]=function(_0x4f75d6,_0xaaeaa9){return _0x4f75d6[_0xe524('0xa')](_0xe524('0xb'),attributes,{'tableName':'user_has_sms_queues','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 2699dad..2d288f7 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 _0x10dc=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserSmsQueue,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash'];(function(_0x39be59,_0x511fd9){var _0x20ac62=function(_0x2783f8){while(--_0x2783f8){_0x39be59['push'](_0x39be59['shift']());}};_0x20ac62(++_0x511fd9);}(_0x10dc,0x77));var _0xc10d=function(_0x5e3665,_0x369ac8){_0x5e3665=_0x5e3665-0x0;var _0x187299=_0x10dc[_0x5e3665];return _0x187299;};'use strict';var _=require(_0xc10d('0x0'));var util=require(_0xc10d('0x1'));var moment=require(_0xc10d('0x2'));var BPromise=require(_0xc10d('0x3'));var rs=require(_0xc10d('0x4'));var fs=require('fs');var Redis=require(_0xc10d('0x5'));var db=require(_0xc10d('0x6'))['db'];var utils=require(_0xc10d('0x7'));var logger=require('../../config/logger')(_0xc10d('0x8'));var config=require(_0xc10d('0x9'));var jayson=require(_0xc10d('0xa'));var client=jayson[_0xc10d('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x464404,_0x11e7f9,_0x26af3b){return new BPromise(function(_0x111305,_0x2e19cb){return client[_0xc10d('0xc')](_0x464404,_0x26af3b)[_0xc10d('0xd')](function(_0x56b87f){logger[_0xc10d('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x11e7f9,'request\x20sent');logger[_0xc10d('0xf')](_0xc10d('0x10'),_0x11e7f9,'request\x20sent',JSON[_0xc10d('0x11')](_0x56b87f));if(_0x56b87f[_0xc10d('0x12')]){if(_0x56b87f[_0xc10d('0x12')]['code']===0x1f4){logger[_0xc10d('0x12')](_0xc10d('0x13'),_0x11e7f9,_0x56b87f[_0xc10d('0x12')][_0xc10d('0x14')]);return _0x2e19cb(_0x56b87f[_0xc10d('0x12')][_0xc10d('0x14')]);}logger[_0xc10d('0x12')](_0xc10d('0x13'),_0x11e7f9,_0x56b87f[_0xc10d('0x12')][_0xc10d('0x14')]);return _0x111305(_0x56b87f[_0xc10d('0x12')][_0xc10d('0x14')]);}else{logger[_0xc10d('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x11e7f9,_0xc10d('0x15'));_0x111305(_0x56b87f[_0xc10d('0x16')][_0xc10d('0x14')]);}})[_0xc10d('0x17')](function(_0x1c88d2){logger['error'](_0xc10d('0x13'),_0x11e7f9,_0x1c88d2);_0x2e19cb(_0x1c88d2);});});} \ No newline at end of file +var _0xfe68=['info','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then'];(function(_0x29c768,_0x56446f){var _0x19fcdb=function(_0x2ee4a8){while(--_0x2ee4a8){_0x29c768['push'](_0x29c768['shift']());}};_0x19fcdb(++_0x56446f);}(_0xfe68,0x11b));var _0x8fe6=function(_0x3bbd2d,_0xf8ba3c){_0x3bbd2d=_0x3bbd2d-0x0;var _0x241bd4=_0xfe68[_0x3bbd2d];return _0x241bd4;};'use strict';var _=require(_0x8fe6('0x0'));var util=require('util');var moment=require(_0x8fe6('0x1'));var BPromise=require(_0x8fe6('0x2'));var rs=require(_0x8fe6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8fe6('0x4'))['db'];var utils=require(_0x8fe6('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x8fe6('0x6'));var jayson=require(_0x8fe6('0x7'));var client=jayson['client'][_0x8fe6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3a3fbe,_0x20ff14,_0x5362fc){return new BPromise(function(_0x5b0ee7,_0x2ad296){return client[_0x8fe6('0x9')](_0x3a3fbe,_0x5362fc)[_0x8fe6('0xa')](function(_0x41e4cb){logger[_0x8fe6('0xb')]('UserSmsQueue,\x20%s,\x20%s',_0x20ff14,'request\x20sent');logger['debug'](_0x8fe6('0xc'),_0x20ff14,_0x8fe6('0xd'),JSON[_0x8fe6('0xe')](_0x41e4cb));if(_0x41e4cb[_0x8fe6('0xf')]){if(_0x41e4cb[_0x8fe6('0xf')][_0x8fe6('0x10')]===0x1f4){logger['error'](_0x8fe6('0x11'),_0x20ff14,_0x41e4cb['error']['message']);return _0x2ad296(_0x41e4cb[_0x8fe6('0xf')][_0x8fe6('0x12')]);}logger[_0x8fe6('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x20ff14,_0x41e4cb[_0x8fe6('0xf')]['message']);return _0x5b0ee7(_0x41e4cb[_0x8fe6('0xf')][_0x8fe6('0x12')]);}else{logger[_0x8fe6('0xb')]('UserSmsQueue,\x20%s,\x20%s',_0x20ff14,_0x8fe6('0xd'));_0x5b0ee7(_0x41e4cb[_0x8fe6('0x13')][_0x8fe6('0x12')]);}})[_0x8fe6('0x14')](function(_0x29c7cd){logger[_0x8fe6('0xf')](_0x8fe6('0x11'),_0x20ff14,_0x29c7cd);_0x2ad296(_0x29c7cd);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 087a66c..627963c 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x3e96a4,_0x2db1db){var _0x18ce41=function(_0x5e4acd){while(--_0x5e4acd){_0x3e96a4['push'](_0x3e96a4['shift']());}};_0x18ce41(++_0x2db1db);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1076c0,_0x172051){var _0x47881b=function(_0x4d9a70){while(--_0x4d9a70){_0x1076c0['push'](_0x1076c0['shift']());}};_0x47881b(++_0x172051);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 064571e..c6575a8 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 _0x300a=['INTEGER','sequelize','exports'];(function(_0x504c1e,_0x51e919){var _0x1967e5=function(_0x56044e){while(--_0x56044e){_0x504c1e['push'](_0x504c1e['shift']());}};_0x1967e5(++_0x51e919);}(_0x300a,0x184));var _0xa300=function(_0x2577d9,_0x8f2f28){_0x2577d9=_0x2577d9-0x0;var _0x36fe58=_0x300a[_0x2577d9];return _0x36fe58;};'use strict';var Sequelize=require(_0xa300('0x0'));module[_0xa300('0x1')]={'penalty':{'type':Sequelize[_0xa300('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb70c=['sequelize','exports','INTEGER'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0xb70c,0x1e0));var _0xcb70=function(_0x5c768b,_0x5e88a6){_0x5c768b=_0x5c768b-0x0;var _0x335af8=_0xb70c[_0x5c768b];return _0x335af8;};'use strict';var Sequelize=require(_0xcb70('0x0'));module[_0xcb70('0x1')]={'penalty':{'type':Sequelize[_0xcb70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index f606a6e..6571d58 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 _0xef48=['lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./userVoiceQueue.attributes','UserVoiceQueue','user_has_voice_queues'];(function(_0x11da6,_0x1b215c){var _0x4e9ae8=function(_0x24b0d9){while(--_0x24b0d9){_0x11da6['push'](_0x11da6['shift']());}};_0x4e9ae8(++_0x1b215c);}(_0xef48,0x96));var _0x8ef4=function(_0x60fe,_0x513468){_0x60fe=_0x60fe-0x0;var _0x2e9051=_0xef48[_0x60fe];return _0x2e9051;};'use strict';var _=require(_0x8ef4('0x0'));var util=require(_0x8ef4('0x1'));var logger=require(_0x8ef4('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8ef4('0x3'));var rp=require(_0x8ef4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8ef4('0x5'));var config=require(_0x8ef4('0x6'));var attributes=require(_0x8ef4('0x7'));module['exports']=function(_0x678270,_0x52a15c){return _0x678270['define'](_0x8ef4('0x8'),attributes,{'tableName':_0x8ef4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x02b5=['user_has_voice_queues','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue'];(function(_0x19115e,_0x507bab){var _0x45bbd4=function(_0x1308bf){while(--_0x1308bf){_0x19115e['push'](_0x19115e['shift']());}};_0x45bbd4(++_0x507bab);}(_0x02b5,0x12c));var _0x502b=function(_0xcfc07f,_0x563b43){_0xcfc07f=_0xcfc07f-0x0;var _0x2b3584=_0x02b5[_0xcfc07f];return _0x2b3584;};'use strict';var _=require(_0x502b('0x0'));var util=require(_0x502b('0x1'));var logger=require(_0x502b('0x2'))(_0x502b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x502b('0x4'));var fs=require('fs');var path=require(_0x502b('0x5'));var rimraf=require(_0x502b('0x6'));var config=require(_0x502b('0x7'));var attributes=require(_0x502b('0x8'));module[_0x502b('0x9')]=function(_0x41c755,_0x349e92){return _0x41c755[_0x502b('0xa')](_0x502b('0xb'),attributes,{'tableName':_0x502b('0xc'),'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 3e15950..3d9a022 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 _0xb233=['request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueue,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xb233,0x14b));var _0x3b23=function(_0x22be10,_0x4c23c0){_0x22be10=_0x22be10-0x0;var _0x36c4a9=_0xb233[_0x22be10];return _0x36c4a9;};'use strict';var _=require(_0x3b23('0x0'));var util=require(_0x3b23('0x1'));var moment=require(_0x3b23('0x2'));var BPromise=require(_0x3b23('0x3'));var rs=require(_0x3b23('0x4'));var fs=require('fs');var Redis=require(_0x3b23('0x5'));var db=require(_0x3b23('0x6'))['db'];var utils=require(_0x3b23('0x7'));var logger=require(_0x3b23('0x8'))(_0x3b23('0x9'));var config=require('../../config/environment');var jayson=require(_0x3b23('0xa'));var client=jayson[_0x3b23('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5db33c,_0x550031,_0x1c170c){return new BPromise(function(_0x3af365,_0x6191df){return client['request'](_0x5db33c,_0x1c170c)[_0x3b23('0xc')](function(_0x3dba1d){logger[_0x3b23('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x550031,_0x3b23('0xe'));logger[_0x3b23('0xf')](_0x3b23('0x10'),_0x550031,_0x3b23('0xe'),JSON[_0x3b23('0x11')](_0x3dba1d));if(_0x3dba1d[_0x3b23('0x12')]){if(_0x3dba1d[_0x3b23('0x12')][_0x3b23('0x13')]===0x1f4){logger['error'](_0x3b23('0x14'),_0x550031,_0x3dba1d[_0x3b23('0x12')][_0x3b23('0x15')]);return _0x6191df(_0x3dba1d[_0x3b23('0x12')][_0x3b23('0x15')]);}logger[_0x3b23('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x550031,_0x3dba1d['error']['message']);return _0x3af365(_0x3dba1d['error'][_0x3b23('0x15')]);}else{logger[_0x3b23('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x550031,'request\x20sent');_0x3af365(_0x3dba1d[_0x3b23('0x16')]['message']);}})['catch'](function(_0x4edf96){logger[_0x3b23('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x550031,_0x4edf96);_0x6191df(_0x4edf96);});});} \ No newline at end of file +var _0x3e9b=['ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserVoiceQueue,\x20%s,\x20%s','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','util','bluebird','randomstring'];(function(_0x21e49a,_0x5a0940){var _0x5be3f4=function(_0x18f206){while(--_0x18f206){_0x21e49a['push'](_0x21e49a['shift']());}};_0x5be3f4(++_0x5a0940);}(_0x3e9b,0x100));var _0xb3e9=function(_0xed216,_0x3be2d8){_0xed216=_0xed216-0x0;var _0x5a52c5=_0x3e9b[_0xed216];return _0x5a52c5;};'use strict';var _=require(_0xb3e9('0x0'));var util=require(_0xb3e9('0x1'));var moment=require('moment');var BPromise=require(_0xb3e9('0x2'));var rs=require(_0xb3e9('0x3'));var fs=require('fs');var Redis=require(_0xb3e9('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb3e9('0x5'))(_0xb3e9('0x6'));var config=require(_0xb3e9('0x7'));var jayson=require(_0xb3e9('0x8'));var client=jayson[_0xb3e9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21e8f7,_0xe9b055,_0x4decdf){return new BPromise(function(_0x906ec7,_0x1e1ef8){return client[_0xb3e9('0xa')](_0x21e8f7,_0x4decdf)[_0xb3e9('0xb')](function(_0x39cece){logger[_0xb3e9('0xc')](_0xb3e9('0xd'),_0xe9b055,'request\x20sent');logger['debug'](_0xb3e9('0xe'),_0xe9b055,_0xb3e9('0xf'),JSON[_0xb3e9('0x10')](_0x39cece));if(_0x39cece['error']){if(_0x39cece[_0xb3e9('0x11')]['code']===0x1f4){logger[_0xb3e9('0x11')](_0xb3e9('0xd'),_0xe9b055,_0x39cece[_0xb3e9('0x11')][_0xb3e9('0x12')]);return _0x1e1ef8(_0x39cece[_0xb3e9('0x11')]['message']);}logger['error'](_0xb3e9('0xd'),_0xe9b055,_0x39cece[_0xb3e9('0x11')][_0xb3e9('0x12')]);return _0x906ec7(_0x39cece['error'][_0xb3e9('0x12')]);}else{logger['info'](_0xb3e9('0xd'),_0xe9b055,_0xb3e9('0xf'));_0x906ec7(_0x39cece['result']['message']);}})[_0xb3e9('0x13')](function(_0x1089c4){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0xe9b055,_0x1089c4);_0x1e1ef8(_0x1089c4);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index f8b98ab..bb9b33a 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x121a91,_0x26ec77){var _0x506bf4=function(_0x5b2f5c){while(--_0x5b2f5c){_0x121a91['push'](_0x121a91['shift']());}};_0x506bf4(++_0x26ec77);}(_0xedd9,0xfc));var _0x9edd=function(_0x3149bf,_0x1a3976){_0x3149bf=_0x3149bf-0x0;var _0x190bf6=_0xedd9[_0x3149bf];return _0x190bf6;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x57d534,_0xd9e79e){var _0x1a3d0b=function(_0x5028bc){while(--_0x5028bc){_0x57d534['push'](_0x57d534['shift']());}};_0x1a3d0b(++_0xd9e79e);}(_0xe706,0xa3));var _0x6e70=function(_0x12ad1b,_0x106d01){_0x12ad1b=_0x12ad1b-0x0;var _0x22efbb=_0xe706[_0x12ad1b];return _0x22efbb;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 89c231b..14004e8 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 _0x5872=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0x4a6362,_0x9e782a){var _0x2653a5=function(_0x52b12b){while(--_0x52b12b){_0x4a6362['push'](_0x4a6362['shift']());}};_0x2653a5(++_0x9e782a);}(_0x5872,0x18b));var _0x2587=function(_0x215dc8,_0x52c245){_0x215dc8=_0x215dc8-0x0;var _0x583ea3=_0x5872[_0x215dc8];return _0x583ea3;};'use strict';var Sequelize=require(_0x2587('0x0'));module[_0x2587('0x1')]={'uniqueid':{'type':Sequelize[_0x2587('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x2587('0x3')},'membername':{'type':Sequelize[_0x2587('0x4')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x2587('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x2587('0x4')],'allowNull':![],'unique':_0x2587('0x5'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x2587('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x2587('0x4')],'allowNull':![],'unique':'queue_interface','comment':_0x2587('0x3')},'penalty':{'type':Sequelize[_0x2587('0x2')](0xb),'defaultValue':0x0,'comment':_0x2587('0x3')},'paused':{'type':Sequelize[_0x2587('0x2')](0xb),'defaultValue':0x0,'comment':_0x2587('0x3')}}; \ No newline at end of file +var _0xcf42=['exports','INTEGER','Required\x20by\x20Asterisk','queue_interface'];(function(_0x2b152a,_0x3dd988){var _0x2ad4c7=function(_0x2fa97c){while(--_0x2fa97c){_0x2b152a['push'](_0x2b152a['shift']());}};_0x2ad4c7(++_0x3dd988);}(_0xcf42,0x74));var _0x2cf4=function(_0x115eda,_0x231953){_0x115eda=_0x115eda-0x0;var _0x865c00=_0xcf42[_0x115eda];return _0x865c00;};'use strict';var Sequelize=require('sequelize');module[_0x2cf4('0x0')]={'uniqueid':{'type':Sequelize[_0x2cf4('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x2cf4('0x2')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x2cf4('0x2')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':_0x2cf4('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x2cf4('0x3'),'comment':_0x2cf4('0x2')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x2cf4('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 82681cf..08e1796 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 _0xf2f0=['exports','events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x7ad123,_0xeeeef3){var _0x37d073=function(_0x51367b){while(--_0x51367b){_0x7ad123['push'](_0x7ad123['shift']());}};_0x37d073(++_0xeeeef3);}(_0xf2f0,0x1e9));var _0x0f2f=function(_0x510f22,_0x391e2d){_0x510f22=_0x510f22-0x0;var _0x131834=_0xf2f0[_0x510f22];return _0x131834;};'use strict';var EventEmitter=require(_0x0f2f('0x0'));var UserVoiceQueueRt=require(_0x0f2f('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0f2f('0x2'),'afterDestroy':_0x0f2f('0x3')};function emitEvent(_0x39516f){return function(_0x4d51f7,_0x2ea25f,_0x3be672){UserVoiceQueueRtEvents[_0x0f2f('0x4')](_0x39516f+':'+_0x4d51f7['id'],_0x4d51f7);UserVoiceQueueRtEvents[_0x0f2f('0x4')](_0x39516f,_0x4d51f7);_0x3be672(null);};}for(var e in events){if(events[_0x0f2f('0x5')](e)){var event=events[e];UserVoiceQueueRt[_0x0f2f('0x6')](e,emitEvent(event));}}module[_0x0f2f('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x701b=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','update'];(function(_0x1b256a,_0x2a48da){var _0x587b64=function(_0x36eda5){while(--_0x36eda5){_0x1b256a['push'](_0x1b256a['shift']());}};_0x587b64(++_0x2a48da);}(_0x701b,0xaf));var _0xb701=function(_0x175b5a,_0x458f0f){_0x175b5a=_0x175b5a-0x0;var _0x204dc0=_0x701b[_0x175b5a];return _0x204dc0;};'use strict';var EventEmitter=require(_0xb701('0x0'));var UserVoiceQueueRt=require(_0xb701('0x1'))['db'][_0xb701('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xb701('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb701('0x4'),'afterDestroy':_0xb701('0x5')};function emitEvent(_0x41dace){return function(_0x495c92,_0xf810ad,_0x2113cf){UserVoiceQueueRtEvents[_0xb701('0x6')](_0x41dace+':'+_0x495c92['id'],_0x495c92);UserVoiceQueueRtEvents[_0xb701('0x6')](_0x41dace,_0x495c92);_0x2113cf(null);};}for(var e in events){if(events[_0xb701('0x7')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0xb701('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 03269c0..dc5ebda 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 _0x58cd=['moment','bluebird','request-promise','path','rimraf','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api'];(function(_0x48aabf,_0x338fc8){var _0x3f6011=function(_0x53a3d6){while(--_0x53a3d6){_0x48aabf['push'](_0x48aabf['shift']());}};_0x3f6011(++_0x338fc8);}(_0x58cd,0xea));var _0xd58c=function(_0x367aa1,_0x28451f){_0x367aa1=_0x367aa1-0x0;var _0x2d3611=_0x58cd[_0x367aa1];return _0x2d3611;};'use strict';var _=require(_0xd58c('0x0'));var util=require(_0xd58c('0x1'));var logger=require(_0xd58c('0x2'))(_0xd58c('0x3'));var moment=require(_0xd58c('0x4'));var BPromise=require(_0xd58c('0x5'));var rp=require(_0xd58c('0x6'));var fs=require('fs');var path=require(_0xd58c('0x7'));var rimraf=require(_0xd58c('0x8'));var config=require('../../config/environment');var attributes=require(_0xd58c('0x9'));module[_0xd58c('0xa')]=function(_0x245fae,_0x101e79){return _0x245fae[_0xd58c('0xb')](_0xd58c('0xc'),attributes,{'tableName':_0xd58c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4eb9=['../../config/logger','api','moment','request-promise','path','../../config/environment','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util'];(function(_0x4ed1d4,_0x512d9a){var _0x28e363=function(_0x2bdfb7){while(--_0x2bdfb7){_0x4ed1d4['push'](_0x4ed1d4['shift']());}};_0x28e363(++_0x512d9a);}(_0x4eb9,0x196));var _0x94eb=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x4eb9[_0x4b2863];return _0x567d67;};'use strict';var _=require(_0x94eb('0x0'));var util=require(_0x94eb('0x1'));var logger=require(_0x94eb('0x2'))(_0x94eb('0x3'));var moment=require(_0x94eb('0x4'));var BPromise=require('bluebird');var rp=require(_0x94eb('0x5'));var fs=require('fs');var path=require(_0x94eb('0x6'));var rimraf=require('rimraf');var config=require(_0x94eb('0x7'));var attributes=require('./userVoiceQueueRt.attributes');module[_0x94eb('0x8')]=function(_0x4d303e,_0x3b39af){return _0x4d303e[_0x94eb('0x9')](_0x94eb('0xa'),attributes,{'tableName':_0x94eb('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 67a7ab1..b181e29 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 _0xd5fd=['options','raw','where','COUNT','sequelize','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','GetVoiceQueueRtPauses','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UserVoiceQueueRt','findAll'];(function(_0x454018,_0x46e33a){var _0x24697d=function(_0x3ec647){while(--_0x3ec647){_0x454018['push'](_0x454018['shift']());}};_0x24697d(++_0x46e33a);}(_0xd5fd,0x1c5));var _0xdd5f=function(_0x3d789d,_0x534c06){_0x3d789d=_0x3d789d-0x0;var _0x464ae9=_0xd5fd[_0x3d789d];return _0x464ae9;};'use strict';var _=require(_0xdd5f('0x0'));var util=require(_0xdd5f('0x1'));var moment=require(_0xdd5f('0x2'));var BPromise=require(_0xdd5f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdd5f('0x4'));var db=require(_0xdd5f('0x5'))['db'];var utils=require(_0xdd5f('0x6'));var logger=require(_0xdd5f('0x7'))('rpc');var config=require(_0xdd5f('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xdd5f('0x9')]({'port':0x232a});config[_0xdd5f('0xa')]=_[_0xdd5f('0xb')](config[_0xdd5f('0xa')],{'host':_0xdd5f('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdd5f('0xa')]));require(_0xdd5f('0xd'))[_0xdd5f('0xe')](socket);function respondWithRpcPromise(_0x568fa0,_0x24bd79,_0x1a04b9){return new BPromise(function(_0x460669,_0x51877d){return client[_0xdd5f('0xf')](_0x568fa0,_0x1a04b9)[_0xdd5f('0x10')](function(_0x3f4bb0){logger[_0xdd5f('0x11')](_0xdd5f('0x12'),_0x24bd79,_0xdd5f('0x13'));logger['debug'](_0xdd5f('0x14'),_0x24bd79,_0xdd5f('0x13'),JSON['stringify'](_0x3f4bb0));if(_0x3f4bb0['error']){if(_0x3f4bb0[_0xdd5f('0x15')][_0xdd5f('0x16')]===0x1f4){logger[_0xdd5f('0x15')](_0xdd5f('0x12'),_0x24bd79,_0x3f4bb0[_0xdd5f('0x15')][_0xdd5f('0x17')]);return _0x51877d(_0x3f4bb0[_0xdd5f('0x15')][_0xdd5f('0x17')]);}logger[_0xdd5f('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x24bd79,_0x3f4bb0[_0xdd5f('0x15')][_0xdd5f('0x17')]);return _0x460669(_0x3f4bb0['error'][_0xdd5f('0x17')]);}else{logger['info'](_0xdd5f('0x12'),_0x24bd79,_0xdd5f('0x13'));_0x460669(_0x3f4bb0[_0xdd5f('0x18')]['message']);}})[_0xdd5f('0x19')](function(_0x2cd7f8){logger[_0xdd5f('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x24bd79,_0x2cd7f8);_0x51877d(_0x2cd7f8);});});}exports['GetVoiceQueueRtPauses']=function(_0x40bf07){var _0x4c9437=this;return new Promise(function(_0x4d0667,_0x26caaf){return db[_0xdd5f('0x1a')][_0xdd5f('0x1b')]({'raw':_0x40bf07['options']?_0x40bf07[_0xdd5f('0x1c')][_0xdd5f('0x1d')]===undefined?!![]:![]:!![],'where':_0x40bf07[_0xdd5f('0x1c')]?_0x40bf07['options'][_0xdd5f('0x1e')]||null:null,'attributes':[[db['sequelize']['fn'](_0xdd5f('0x1f'),db[_0xdd5f('0x20')]['fn']('IF',db[_0xdd5f('0x20')]['literal'](_0xdd5f('0x21')))),_0xdd5f('0x22')]]})[_0xdd5f('0x10')](function(_0x525276){logger[_0xdd5f('0x11')](_0xdd5f('0x23'),_0x40bf07);logger[_0xdd5f('0x24')]('GetVoiceQueueRtPauses',_0x40bf07,JSON['stringify'](_0x525276));_0x4d0667(_0x525276);})['catch'](function(_0x201920){logger[_0xdd5f('0x15')]('GetVoiceQueueRtPauses',_0x201920[_0xdd5f('0x17')],_0x40bf07);_0x26caaf(_0x4c9437['error'](0x1f4,_0x201920[_0xdd5f('0x17')]));});});}; \ No newline at end of file +var _0xae34=['redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','stringify','error','UserVoiceQueueRt,\x20%s,\x20%s','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4236dd,_0x5832de){var _0x5a1171=function(_0x430175){while(--_0x430175){_0x4236dd['push'](_0x4236dd['shift']());}};_0x5a1171(++_0x5832de);}(_0xae34,0x104));var _0x4ae3=function(_0x196d63,_0x20af0b){_0x196d63=_0x196d63-0x0;var _0x2e4161=_0xae34[_0x196d63];return _0x2e4161;};'use strict';var _=require(_0x4ae3('0x0'));var util=require(_0x4ae3('0x1'));var moment=require('moment');var BPromise=require(_0x4ae3('0x2'));var rs=require(_0x4ae3('0x3'));var fs=require('fs');var Redis=require(_0x4ae3('0x4'));var db=require(_0x4ae3('0x5'))['db'];var utils=require(_0x4ae3('0x6'));var logger=require(_0x4ae3('0x7'))(_0x4ae3('0x8'));var config=require(_0x4ae3('0x9'));var jayson=require(_0x4ae3('0xa'));var client=jayson[_0x4ae3('0xb')][_0x4ae3('0xc')]({'port':0x232a});config[_0x4ae3('0xd')]=_[_0x4ae3('0xe')](config[_0x4ae3('0xd')],{'host':_0x4ae3('0xf'),'port':0x18eb});var socket=require(_0x4ae3('0x10'))(new Redis(config['redis']));require('./userVoiceQueueRt.socket')[_0x4ae3('0x11')](socket);function respondWithRpcPromise(_0x42ce8f,_0x3fd0bc,_0x37605c){return new BPromise(function(_0xb68b06,_0x1d19d8){return client[_0x4ae3('0x12')](_0x42ce8f,_0x37605c)[_0x4ae3('0x13')](function(_0x27fb7b){logger[_0x4ae3('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x3fd0bc,_0x4ae3('0x15'));logger[_0x4ae3('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x3fd0bc,_0x4ae3('0x15'),JSON[_0x4ae3('0x17')](_0x27fb7b));if(_0x27fb7b[_0x4ae3('0x18')]){if(_0x27fb7b[_0x4ae3('0x18')]['code']===0x1f4){logger[_0x4ae3('0x18')](_0x4ae3('0x19'),_0x3fd0bc,_0x27fb7b[_0x4ae3('0x18')][_0x4ae3('0x1a')]);return _0x1d19d8(_0x27fb7b[_0x4ae3('0x18')]['message']);}logger['error'](_0x4ae3('0x19'),_0x3fd0bc,_0x27fb7b[_0x4ae3('0x18')]['message']);return _0xb68b06(_0x27fb7b[_0x4ae3('0x18')][_0x4ae3('0x1a')]);}else{logger[_0x4ae3('0x14')](_0x4ae3('0x19'),_0x3fd0bc,'request\x20sent');_0xb68b06(_0x27fb7b[_0x4ae3('0x1b')]['message']);}})[_0x4ae3('0x1c')](function(_0x20b36d){logger[_0x4ae3('0x18')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x3fd0bc,_0x20b36d);_0x1d19d8(_0x20b36d);});});}exports[_0x4ae3('0x1d')]=function(_0x535d8c){var _0x2f2435=this;return new Promise(function(_0x5571c1,_0x18281f){return db[_0x4ae3('0x1e')][_0x4ae3('0x1f')]({'raw':_0x535d8c[_0x4ae3('0x20')]?_0x535d8c[_0x4ae3('0x20')][_0x4ae3('0x21')]===undefined?!![]:![]:!![],'where':_0x535d8c[_0x4ae3('0x20')]?_0x535d8c[_0x4ae3('0x20')][_0x4ae3('0x22')]||null:null,'attributes':[[db[_0x4ae3('0x23')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x4ae3('0x24')](_0x4ae3('0x25')))),_0x4ae3('0x26')]]})[_0x4ae3('0x13')](function(_0x5e28af){logger[_0x4ae3('0x14')](_0x4ae3('0x1d'),_0x535d8c);logger['debug']('GetVoiceQueueRtPauses',_0x535d8c,JSON[_0x4ae3('0x17')](_0x5e28af));_0x5571c1(_0x5e28af);})[_0x4ae3('0x1c')](function(_0x4b1b80){logger[_0x4ae3('0x18')](_0x4ae3('0x1d'),_0x4b1b80['message'],_0x535d8c);_0x18281f(_0x2f2435[_0x4ae3('0x18')](0x1f4,_0x4b1b80[_0x4ae3('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 4d06186..1763c72 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 _0x8ff3=['length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','update','emit','removeListener'];(function(_0xf4452a,_0x578630){var _0x5b9baa=function(_0x211540){while(--_0x211540){_0xf4452a['push'](_0xf4452a['shift']());}};_0x5b9baa(++_0x578630);}(_0x8ff3,0x72));var _0x38ff=function(_0x3945f4,_0x2da4ad){_0x3945f4=_0x3945f4-0x0;var _0x2a1633=_0x8ff3[_0x3945f4];return _0x2a1633;};'use strict';var UserVoiceQueueRtEvents=require(_0x38ff('0x0'));var events=[_0x38ff('0x1'),'remove',_0x38ff('0x2')];function createListener(_0x3a6f7a,_0x3da206){return function(_0x1ba4fb){_0x3da206[_0x38ff('0x3')](_0x3a6f7a,_0x1ba4fb);};}function removeListener(_0x5bf243,_0x5f377c){return function(){UserVoiceQueueRtEvents[_0x38ff('0x4')](_0x5bf243,_0x5f377c);};}exports['register']=function(_0x32a606){for(var _0x5428e3=0x0,_0x158d7f=events[_0x38ff('0x5')];_0x5428e3<_0x158d7f;_0x5428e3++){var _0x1f6e52=events[_0x5428e3];var _0x8a1088=createListener(_0x38ff('0x6')+_0x1f6e52,_0x32a606);UserVoiceQueueRtEvents['on'](_0x1f6e52,_0x8a1088);}}; \ No newline at end of file +var _0x251b=['update','emit','removeListener','register','length','./userVoiceQueueRt.events','save','remove'];(function(_0x42a9c6,_0x1e9364){var _0x28e2f6=function(_0xea37a2){while(--_0xea37a2){_0x42a9c6['push'](_0x42a9c6['shift']());}};_0x28e2f6(++_0x1e9364);}(_0x251b,0x185));var _0xb251=function(_0x296897,_0x4d23ea){_0x296897=_0x296897-0x0;var _0x2b44ab=_0x251b[_0x296897];return _0x2b44ab;};'use strict';var UserVoiceQueueRtEvents=require(_0xb251('0x0'));var events=[_0xb251('0x1'),_0xb251('0x2'),_0xb251('0x3')];function createListener(_0x2ddbc3,_0x4317d4){return function(_0x39d5bf){_0x4317d4[_0xb251('0x4')](_0x2ddbc3,_0x39d5bf);};}function removeListener(_0x304446,_0x334010){return function(){UserVoiceQueueRtEvents[_0xb251('0x5')](_0x304446,_0x334010);};}exports[_0xb251('0x6')]=function(_0x5e96a7){for(var _0x30797a=0x0,_0x594a1b=events[_0xb251('0x7')];_0x30797a<_0x594a1b;_0x30797a++){var _0x3cf251=events[_0x30797a];var _0x923bc0=createListener('userVoiceQueueRt:'+_0x3cf251,_0x5e96a7);UserVoiceQueueRtEvents['on'](_0x3cf251,_0x923bc0);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index cc61729..70ac4be 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x3d309c,_0x242f4c){var _0x241187=function(_0x594990){while(--_0x594990){_0x3d309c['push'](_0x3d309c['shift']());}};_0x241187(++_0x242f4c);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x498f3b,_0x3b28bf){var _0x12fbf6=function(_0x5ecf0b){while(--_0x5ecf0b){_0x498f3b['push'](_0x498f3b['shift']());}};_0x12fbf6(++_0x3b28bf);}(_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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index e926877..8e9ef0d 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 _0xe953=['exports','sequelize'];(function(_0x37cce6,_0x42aaf5){var _0x3dc9ba=function(_0x1cc51f){while(--_0x1cc51f){_0x37cce6['push'](_0x37cce6['shift']());}};_0x3dc9ba(++_0x42aaf5);}(_0xe953,0xc9));var _0x3e95=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xe953[_0x4e676e];return _0x336a3c;};'use strict';var Sequelize=require(_0x3e95('0x0'));module[_0x3e95('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd2c2=['INTEGER','sequelize','exports'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xd2c2,0xf1));var _0x2d2c=function(_0x349369,_0x3878a4){_0x349369=_0x349369-0x0;var _0x568fb9=_0xd2c2[_0x349369];return _0x568fb9;};'use strict';var Sequelize=require(_0x2d2c('0x0'));module[_0x2d2c('0x1')]={'penalty':{'type':Sequelize[_0x2d2c('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index d5a3086..c2be012 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 _0x719e=['bluebird','path','../../config/environment','./userWhatsappQueue.attributes','UserWhatsappQueue','lodash','util','../../config/logger','moment'];(function(_0x27c067,_0x201bd0){var _0x3cb9e9=function(_0x2e6423){while(--_0x2e6423){_0x27c067['push'](_0x27c067['shift']());}};_0x3cb9e9(++_0x201bd0);}(_0x719e,0x149));var _0xe719=function(_0x556dda,_0x3180e8){_0x556dda=_0x556dda-0x0;var _0x3405ce=_0x719e[_0x556dda];return _0x3405ce;};'use strict';var _=require(_0xe719('0x0'));var util=require(_0xe719('0x1'));var logger=require(_0xe719('0x2'))('api');var moment=require(_0xe719('0x3'));var BPromise=require(_0xe719('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe719('0x5'));var rimraf=require('rimraf');var config=require(_0xe719('0x6'));var attributes=require(_0xe719('0x7'));module['exports']=function(_0x370821,_0x417d9a){return _0x370821['define'](_0xe719('0x8'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x707a=['user_has_whatsapp_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserWhatsappQueue'];(function(_0x10d862,_0x100d34){var _0x43f571=function(_0x2f9fbf){while(--_0x2f9fbf){_0x10d862['push'](_0x10d862['shift']());}};_0x43f571(++_0x100d34);}(_0x707a,0xb7));var _0xa707=function(_0x497614,_0x17d6a7){_0x497614=_0x497614-0x0;var _0x55e704=_0x707a[_0x497614];return _0x55e704;};'use strict';var _=require('lodash');var util=require(_0xa707('0x0'));var logger=require(_0xa707('0x1'))(_0xa707('0x2'));var moment=require(_0xa707('0x3'));var BPromise=require(_0xa707('0x4'));var rp=require(_0xa707('0x5'));var fs=require('fs');var path=require(_0xa707('0x6'));var rimraf=require(_0xa707('0x7'));var config=require(_0xa707('0x8'));var attributes=require('./userWhatsappQueue.attributes');module[_0xa707('0x9')]=function(_0x108fa2,_0x3ee246){return _0x108fa2[_0xa707('0xa')](_0xa707('0xb'),attributes,{'tableName':_0xa707('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 5ada02b..3419934 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 _0x0d07=['debug','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x4750b4,_0x588610){var _0x3f7b38=function(_0x41d21f){while(--_0x41d21f){_0x4750b4['push'](_0x4750b4['shift']());}};_0x3f7b38(++_0x588610);}(_0x0d07,0x140));var _0x70d0=function(_0x4f90d9,_0x4a6697){_0x4f90d9=_0x4f90d9-0x0;var _0x593a44=_0x0d07[_0x4f90d9];return _0x593a44;};'use strict';var _=require(_0x70d0('0x0'));var util=require('util');var moment=require(_0x70d0('0x1'));var BPromise=require(_0x70d0('0x2'));var rs=require(_0x70d0('0x3'));var fs=require('fs');var Redis=require(_0x70d0('0x4'));var db=require(_0x70d0('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x70d0('0x6'));var config=require(_0x70d0('0x7'));var jayson=require(_0x70d0('0x8'));var client=jayson[_0x70d0('0x9')][_0x70d0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12e32f,_0x40eed3,_0x4ee6db){return new BPromise(function(_0x47a538,_0x22b603){return client[_0x70d0('0xb')](_0x12e32f,_0x4ee6db)[_0x70d0('0xc')](function(_0x1b1412){logger[_0x70d0('0xd')](_0x70d0('0xe'),_0x40eed3,_0x70d0('0xf'));logger[_0x70d0('0x10')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x40eed3,_0x70d0('0xf'),JSON['stringify'](_0x1b1412));if(_0x1b1412[_0x70d0('0x11')]){if(_0x1b1412[_0x70d0('0x11')][_0x70d0('0x12')]===0x1f4){logger[_0x70d0('0x11')](_0x70d0('0xe'),_0x40eed3,_0x1b1412[_0x70d0('0x11')][_0x70d0('0x13')]);return _0x22b603(_0x1b1412[_0x70d0('0x11')][_0x70d0('0x13')]);}logger[_0x70d0('0x11')](_0x70d0('0xe'),_0x40eed3,_0x1b1412[_0x70d0('0x11')]['message']);return _0x47a538(_0x1b1412[_0x70d0('0x11')][_0x70d0('0x13')]);}else{logger[_0x70d0('0xd')](_0x70d0('0xe'),_0x40eed3,'request\x20sent');_0x47a538(_0x1b1412[_0x70d0('0x14')][_0x70d0('0x13')]);}})['catch'](function(_0xc878b0){logger[_0x70d0('0x11')](_0x70d0('0xe'),_0x40eed3,_0xc878b0);_0x22b603(_0xc878b0);});});} \ No newline at end of file +var _0xc206=['request\x20sent','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','info','UserWhatsappQueue,\x20%s,\x20%s','debug','stringify','error','code','message'];(function(_0x240ad5,_0x5e125b){var _0x9cc8f5=function(_0x1e376e){while(--_0x1e376e){_0x240ad5['push'](_0x240ad5['shift']());}};_0x9cc8f5(++_0x5e125b);}(_0xc206,0x12e));var _0x6c20=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0xc206[_0x4d8ed9];return _0x1e2140;};'use strict';var _=require('lodash');var util=require(_0x6c20('0x0'));var moment=require(_0x6c20('0x1'));var BPromise=require(_0x6c20('0x2'));var rs=require(_0x6c20('0x3'));var fs=require('fs');var Redis=require(_0x6c20('0x4'));var db=require(_0x6c20('0x5'))['db'];var utils=require(_0x6c20('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x6c20('0x7'));var jayson=require(_0x6c20('0x8'));var client=jayson[_0x6c20('0x9')][_0x6c20('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ec040,_0x26aa03,_0x25cf14){return new BPromise(function(_0x3eaa48,_0x1ffa6a){return client['request'](_0x2ec040,_0x25cf14)['then'](function(_0x32a38d){logger[_0x6c20('0xb')](_0x6c20('0xc'),_0x26aa03,'request\x20sent');logger[_0x6c20('0xd')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x26aa03,'request\x20sent',JSON[_0x6c20('0xe')](_0x32a38d));if(_0x32a38d[_0x6c20('0xf')]){if(_0x32a38d[_0x6c20('0xf')][_0x6c20('0x10')]===0x1f4){logger['error'](_0x6c20('0xc'),_0x26aa03,_0x32a38d['error']['message']);return _0x1ffa6a(_0x32a38d['error'][_0x6c20('0x11')]);}logger[_0x6c20('0xf')](_0x6c20('0xc'),_0x26aa03,_0x32a38d[_0x6c20('0xf')][_0x6c20('0x11')]);return _0x3eaa48(_0x32a38d[_0x6c20('0xf')]['message']);}else{logger['info'](_0x6c20('0xc'),_0x26aa03,_0x6c20('0x12'));_0x3eaa48(_0x32a38d[_0x6c20('0x13')][_0x6c20('0x11')]);}})['catch'](function(_0xcdf628){logger[_0x6c20('0xf')](_0x6c20('0xc'),_0x26aa03,_0xcdf628);_0x1ffa6a(_0xcdf628);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 19706c5..80c5df8 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 _0x175e=['isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get'];(function(_0x4182f7,_0xcc375f){var _0x24872c=function(_0x3bacdd){while(--_0x3bacdd){_0x4182f7['push'](_0x4182f7['shift']());}};_0x24872c(++_0xcc375f);}(_0x175e,0xe6));var _0xe175=function(_0x22be9f,_0x2307cc){_0x22be9f=_0x22be9f-0x0;var _0xcea3c1=_0x175e[_0x22be9f];return _0xcea3c1;};'use strict';var multer=require(_0xe175('0x0'));var util=require(_0xe175('0x1'));var path=require(_0xe175('0x2'));var timeout=require(_0xe175('0x3'));var express=require(_0xe175('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe175('0x5'));var interaction=require(_0xe175('0x6'));var config=require(_0xe175('0x7'));var controller=require(_0xe175('0x8'));router[_0xe175('0x9')]('/',auth[_0xe175('0xa')](),controller[_0xe175('0xb')]);router[_0xe175('0x9')](_0xe175('0xc'),auth[_0xe175('0xa')](),controller[_0xe175('0xd')]);router[_0xe175('0xe')]('/',auth[_0xe175('0xa')](),controller[_0xe175('0xf')]);router[_0xe175('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xe175('0x11')]);router['delete'](_0xe175('0xc'),auth[_0xe175('0xa')](),controller[_0xe175('0x12')]);module[_0xe175('0x13')]=router; \ No newline at end of file +var _0x03ce=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x306d05,_0x3d20e5){var _0x1f14ef=function(_0x4e6d41){while(--_0x4e6d41){_0x306d05['push'](_0x306d05['shift']());}};_0x1f14ef(++_0x3d20e5);}(_0x03ce,0x1a1));var _0xe03c=function(_0x239a81,_0x1ede2f){_0x239a81=_0x239a81-0x0;var _0x1a3b9b=_0x03ce[_0x239a81];return _0x1a3b9b;};'use strict';var multer=require(_0xe03c('0x0'));var util=require(_0xe03c('0x1'));var path=require(_0xe03c('0x2'));var timeout=require(_0xe03c('0x3'));var express=require('express');var router=express[_0xe03c('0x4')]();var fs_extra=require(_0xe03c('0x5'));var auth=require(_0xe03c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe03c('0x7'));var controller=require(_0xe03c('0x8'));router[_0xe03c('0x9')]('/',auth[_0xe03c('0xa')](),controller[_0xe03c('0xb')]);router[_0xe03c('0x9')](_0xe03c('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xe03c('0xd')]('/',auth[_0xe03c('0xa')](),controller[_0xe03c('0xe')]);router[_0xe03c('0xf')](_0xe03c('0xc'),auth[_0xe03c('0xa')](),controller[_0xe03c('0x10')]);router[_0xe03c('0x11')]('/:id',auth[_0xe03c('0xa')](),controller[_0xe03c('0x12')]);module[_0xe03c('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 0d166f6..0351dcd 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 _0xa28b=['sequelize','exports','STRING','name'];(function(_0xfeed64,_0x2330e6){var _0x17e15a=function(_0x37e69d){while(--_0x37e69d){_0xfeed64['push'](_0xfeed64['shift']());}};_0x17e15a(++_0x2330e6);}(_0xa28b,0x1dc));var _0xba28=function(_0x12f7a5,_0x241f6d){_0x12f7a5=_0x12f7a5-0x0;var _0x3bc7b9=_0xa28b[_0x12f7a5];return _0x3bc7b9;};'use strict';var Sequelize=require(_0xba28('0x0'));module[_0xba28('0x1')]={'name':{'type':Sequelize[_0xba28('0x2')],'unique':_0xba28('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc452=['STRING','exports','name'];(function(_0x48ff9a,_0x20007a){var _0x2f93f8=function(_0x1705d4){while(--_0x1705d4){_0x48ff9a['push'](_0x48ff9a['shift']());}};_0x2f93f8(++_0x20007a);}(_0xc452,0x154));var _0x2c45=function(_0x1bcf76,_0x11bc8b){_0x1bcf76=_0x1bcf76-0x0;var _0x5e1608=_0xc452[_0x1bcf76];return _0x5e1608;};'use strict';var Sequelize=require('sequelize');module[_0x2c45('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x2c45('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x2c45('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index f9bd043..7b0b4b6 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 _0xdb15=['sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','json','apply','reject','save','update','then','destroy','get','Variables','UserProfileResource','end','error','stack','name','send','index','Variable','fieldName','type','key','model','map','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','show','params','keys','rawAttributes','includeAll','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','zip-dir','moment','mustache','util','path'];(function(_0x5357ca,_0x801fac){var _0x24a125=function(_0x29ff8c){while(--_0x29ff8c){_0x5357ca['push'](_0x5357ca['shift']());}};_0x24a125(++_0x801fac);}(_0xdb15,0xf1));var _0x5db1=function(_0x31de07,_0x495ba4){_0x31de07=_0x31de07-0x0;var _0x29c60d=_0xdb15[_0x31de07];return _0x29c60d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5db1('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5db1('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x5db1('0x2'));var util=require(_0x5db1('0x3'));var path=require(_0x5db1('0x4'));var sox=require(_0x5db1('0x5'));var csv=require(_0x5db1('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5db1('0x7'));var _=require(_0x5db1('0x8'));var squel=require(_0x5db1('0x9'));var crypto=require(_0x5db1('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x5db1('0xb'));var toCsv=require(_0x5db1('0x6'));var querystring=require(_0x5db1('0xc'));var Papa=require(_0x5db1('0xd'));var Redis=require(_0x5db1('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('../../config/logger')(_0x5db1('0xf'));var utils=require(_0x5db1('0x10'));var config=require(_0x5db1('0x11'));var licenseUtil=require(_0x5db1('0x12'));var db=require(_0x5db1('0x13'))['db'];function respondWithStatusCode(_0x178c0a,_0x1f8565){_0x1f8565=_0x1f8565||0xcc;return function(_0x25dfca){if(_0x25dfca){return _0x178c0a[_0x5db1('0x14')](_0x1f8565);}return _0x178c0a['status'](_0x1f8565)['end']();};}function respondWithResult(_0x3abaf3,_0x3bd85e){_0x3bd85e=_0x3bd85e||0xc8;return function(_0x4ba89b){if(_0x4ba89b){return _0x3abaf3[_0x5db1('0x15')](_0x3bd85e)['json'](_0x4ba89b);}};}function respondWithFilteredResult(_0x12b5b6,_0x30e424){return function(_0x295d88){if(_0x295d88){var _0x4fafb3=typeof _0x30e424[_0x5db1('0x16')]==='undefined'&&typeof _0x30e424[_0x5db1('0x17')]===_0x5db1('0x18');var _0x4633a4=_0x295d88[_0x5db1('0x19')];var _0x2ee0d6=_0x4fafb3?0x0:_0x30e424[_0x5db1('0x16')];var _0x4552e0=_0x4fafb3?_0x295d88[_0x5db1('0x19')]:_0x30e424['offset']+_0x30e424[_0x5db1('0x17')];var _0x42b01f;if(_0x4552e0>=_0x4633a4){_0x4552e0=_0x4633a4;_0x42b01f=0xc8;}else{_0x42b01f=0xce;}_0x12b5b6[_0x5db1('0x15')](_0x42b01f);return _0x12b5b6[_0x5db1('0x1a')]('Content-Range',_0x2ee0d6+'-'+_0x4552e0+'/'+_0x4633a4)[_0x5db1('0x1b')](_0x295d88);}return null;};}function patchUpdates(_0x55e663){return function(_0xdda69a){try{jsonpatch[_0x5db1('0x1c')](_0xdda69a,_0x55e663,!![]);}catch(_0x15b9af){return BPromise[_0x5db1('0x1d')](_0x15b9af);}return _0xdda69a[_0x5db1('0x1e')]();};}function saveUpdates(_0x13badd,_0x1490e2){return function(_0x44e4a9){if(_0x44e4a9){return _0x44e4a9[_0x5db1('0x1f')](_0x13badd)[_0x5db1('0x20')](function(_0x2dbfbe){return _0x2dbfbe;});}return null;};}function removeEntity(_0x5146d4,_0x55f1bb){return function(_0x349dff){if(_0x349dff){return _0x349dff[_0x5db1('0x21')]()[_0x5db1('0x20')](function(){var _0x14a9de=_0x349dff[_0x5db1('0x22')]({'plain':!![]});var _0x12ca98=_0x5db1('0x23');return db[_0x5db1('0x24')]['destroy']({'where':{'type':_0x12ca98,'resourceId':_0x14a9de['id']}})[_0x5db1('0x20')](function(){return _0x349dff;});})[_0x5db1('0x20')](function(){_0x5146d4[_0x5db1('0x15')](0xcc)[_0x5db1('0x25')]();});}};}function handleEntityNotFound(_0x4b103c,_0x17911a){return function(_0x946b0a){if(!_0x946b0a){_0x4b103c[_0x5db1('0x14')](0x194);}return _0x946b0a;};}function handleError(_0x2e86e6,_0x3d867d){_0x3d867d=_0x3d867d||0x1f4;return function(_0x551933){logger[_0x5db1('0x26')](_0x551933[_0x5db1('0x27')]);if(_0x551933[_0x5db1('0x28')]){delete _0x551933[_0x5db1('0x28')];}_0x2e86e6[_0x5db1('0x15')](_0x3d867d)[_0x5db1('0x29')](_0x551933);};}exports[_0x5db1('0x2a')]=function(_0x46e452,_0x40e407){var _0x5c0955={},_0xc0cbed={},_0x5e46cc={'count':0x0,'rows':[]};var _0xd7013b=_['map'](db[_0x5db1('0x2b')]['rawAttributes'],function(_0x441322){return{'name':_0x441322[_0x5db1('0x2c')],'type':_0x441322[_0x5db1('0x2d')][_0x5db1('0x2e')]};});_0xc0cbed[_0x5db1('0x2f')]=_[_0x5db1('0x30')](_0xd7013b,'name');_0xc0cbed['query']=_['keys'](_0x46e452['query']);_0xc0cbed[_0x5db1('0x31')]=_[_0x5db1('0x32')](_0xc0cbed[_0x5db1('0x2f')],_0xc0cbed[_0x5db1('0x33')]);_0x5c0955[_0x5db1('0x34')]=_[_0x5db1('0x32')](_0xc0cbed[_0x5db1('0x2f')],qs[_0x5db1('0x35')](_0x46e452[_0x5db1('0x33')][_0x5db1('0x35')]));_0x5c0955[_0x5db1('0x34')]=_0x5c0955[_0x5db1('0x34')][_0x5db1('0x36')]?_0x5c0955[_0x5db1('0x34')]:_0xc0cbed[_0x5db1('0x2f')];if(!_0x46e452['query'][_0x5db1('0x37')](_0x5db1('0x38'))){_0x5c0955[_0x5db1('0x17')]=qs[_0x5db1('0x17')](_0x46e452[_0x5db1('0x33')]['limit']);_0x5c0955[_0x5db1('0x16')]=qs[_0x5db1('0x16')](_0x46e452['query'][_0x5db1('0x16')]);}_0x5c0955[_0x5db1('0x39')]=qs[_0x5db1('0x3a')](_0x46e452[_0x5db1('0x33')]['sort']);_0x5c0955[_0x5db1('0x3b')]=qs[_0x5db1('0x31')](_[_0x5db1('0x3c')](_0x46e452['query'],_0xc0cbed[_0x5db1('0x31')]),_0xd7013b);if(_0x46e452[_0x5db1('0x33')][_0x5db1('0x3d')]){_0x5c0955[_0x5db1('0x3b')]=_[_0x5db1('0x3e')](_0x5c0955[_0x5db1('0x3b')],{'$or':_[_0x5db1('0x30')](_0xd7013b,function(_0x428946){if(_0x428946[_0x5db1('0x2d')]!=='VIRTUAL'){var _0x23c627={};_0x23c627[_0x428946[_0x5db1('0x28')]]={'$like':'%'+_0x46e452[_0x5db1('0x33')][_0x5db1('0x3d')]+'%'};return _0x23c627;}})});}_0x5c0955=_[_0x5db1('0x3e')]({},_0x5c0955,_0x46e452[_0x5db1('0x3f')]);var _0x29a1e4={'where':_0x5c0955['where']};return db[_0x5db1('0x2b')]['count'](_0x29a1e4)[_0x5db1('0x20')](function(_0x686464){_0x5e46cc[_0x5db1('0x19')]=_0x686464;if(_0x46e452[_0x5db1('0x33')]['includeAll']){_0x5c0955[_0x5db1('0x40')]=[{'all':!![]}];}return db[_0x5db1('0x2b')][_0x5db1('0x41')](_0x5c0955);})['then'](function(_0xb0bf3c){_0x5e46cc[_0x5db1('0x42')]=_0xb0bf3c;return _0x5e46cc;})[_0x5db1('0x20')](respondWithFilteredResult(_0x40e407,_0x5c0955))['catch'](handleError(_0x40e407,null));};exports[_0x5db1('0x43')]=function(_0x41ac63,_0x31c244){var _0xb46db0={'raw':!![],'where':{'id':_0x41ac63[_0x5db1('0x44')]['id']}},_0x139322={};_0x139322['model']=_[_0x5db1('0x45')](db[_0x5db1('0x2b')][_0x5db1('0x46')]);_0x139322[_0x5db1('0x33')]=_[_0x5db1('0x45')](_0x41ac63[_0x5db1('0x33')]);_0x139322['filters']=_[_0x5db1('0x32')](_0x139322[_0x5db1('0x2f')],_0x139322[_0x5db1('0x33')]);_0xb46db0[_0x5db1('0x34')]=_[_0x5db1('0x32')](_0x139322[_0x5db1('0x2f')],qs[_0x5db1('0x35')](_0x41ac63[_0x5db1('0x33')][_0x5db1('0x35')]));_0xb46db0[_0x5db1('0x34')]=_0xb46db0[_0x5db1('0x34')]['length']?_0xb46db0['attributes']:_0x139322[_0x5db1('0x2f')];if(_0x41ac63[_0x5db1('0x33')][_0x5db1('0x47')]){_0xb46db0[_0x5db1('0x40')]=[{'all':!![]}];}_0xb46db0=_[_0x5db1('0x3e')]({},_0xb46db0,_0x41ac63[_0x5db1('0x3f')]);return db['Variable'][_0x5db1('0x48')](_0xb46db0)[_0x5db1('0x20')](handleEntityNotFound(_0x31c244,null))['then'](respondWithResult(_0x31c244,null))[_0x5db1('0x49')](handleError(_0x31c244,null));};exports[_0x5db1('0x4a')]=function(_0x100757,_0x362506){return db['Variable'][_0x5db1('0x4a')](_0x100757['body'],{})['then'](function(_0xe53600){var _0x2d6c94=_0x100757['user'][_0x5db1('0x22')]({'plain':!![]});if(!_0x2d6c94)throw new Error(_0x5db1('0x4b'));if(_0x2d6c94[_0x5db1('0x4c')]===_0x5db1('0x4d')){var _0x49d8de=_0xe53600[_0x5db1('0x22')]({'plain':!![]});var _0x4a9cff=_0x5db1('0x23');return db[_0x5db1('0x4e')][_0x5db1('0x48')]({'where':{'name':_0x4a9cff,'userProfileId':_0x2d6c94[_0x5db1('0x4f')]},'raw':!![]})[_0x5db1('0x20')](function(_0x3d7b3a){if(_0x3d7b3a&&_0x3d7b3a['autoAssociation']===0x0){return db[_0x5db1('0x24')]['create']({'name':_0x49d8de[_0x5db1('0x28')],'resourceId':_0x49d8de['id'],'type':_0x3d7b3a[_0x5db1('0x28')],'sectionId':_0x3d7b3a['id']},{})[_0x5db1('0x20')](function(){return _0xe53600;});}else{return _0xe53600;}})['catch'](function(_0x588f64){logger['error'](_0x5db1('0x50'),_0x588f64);throw _0x588f64;});}return _0xe53600;})[_0x5db1('0x20')](respondWithResult(_0x362506,0xc9))[_0x5db1('0x49')](handleError(_0x362506,null));};exports[_0x5db1('0x1f')]=function(_0x42737f,_0x36106a){if(_0x42737f[_0x5db1('0x51')]['id']){delete _0x42737f[_0x5db1('0x51')]['id'];}return db[_0x5db1('0x2b')]['find']({'where':{'id':_0x42737f[_0x5db1('0x44')]['id']}})[_0x5db1('0x20')](handleEntityNotFound(_0x36106a,null))[_0x5db1('0x20')](saveUpdates(_0x42737f[_0x5db1('0x51')],null))[_0x5db1('0x20')](respondWithResult(_0x36106a,null))[_0x5db1('0x49')](handleError(_0x36106a,null));};exports['destroy']=function(_0xb9b546,_0x241ef8){return db[_0x5db1('0x2b')][_0x5db1('0x48')]({'where':{'id':_0xb9b546['params']['id']}})['then'](handleEntityNotFound(_0x241ef8,null))[_0x5db1('0x20')](removeEntity(_0x241ef8,null))[_0x5db1('0x49')](handleError(_0x241ef8,null));}; \ No newline at end of file +var _0xd2bd=['sendStatus','error','name','send','index','Variable','type','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','pick','filters','filter','where','merge','options','includeAll','findAll','show','params','rawAttributes','length','find','catch','create','user','role','Variables','UserProfileSection','userProfileId','autoAssociation','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','get','UserProfileResource','destroy','end'];(function(_0x459832,_0x38973f){var _0x1d0509=function(_0x526f38){while(--_0x526f38){_0x459832['push'](_0x459832['shift']());}};_0x1d0509(++_0x38973f);}(_0xd2bd,0x1b2));var _0xdd2b=function(_0x585d81,_0xf6d74f){_0x585d81=_0x585d81-0x0;var _0x1aca0d=_0xd2bd[_0x585d81];return _0x1aca0d;};'use strict';var emlformat=require(_0xdd2b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdd2b('0x1'));var jsonpatch=require(_0xdd2b('0x2'));var rp=require(_0xdd2b('0x3'));var moment=require('moment');var BPromise=require(_0xdd2b('0x4'));var Mustache=require('mustache');var util=require(_0xdd2b('0x5'));var path=require(_0xdd2b('0x6'));var sox=require(_0xdd2b('0x7'));var csv=require(_0xdd2b('0x8'));var ejs=require(_0xdd2b('0x9'));var fs=require('fs');var fs_extra=require(_0xdd2b('0xa'));var _=require(_0xdd2b('0xb'));var squel=require('squel');var crypto=require(_0xdd2b('0xc'));var jsforce=require(_0xdd2b('0xd'));var deskjs=require(_0xdd2b('0xe'));var toCsv=require(_0xdd2b('0x8'));var querystring=require(_0xdd2b('0xf'));var Papa=require(_0xdd2b('0x10'));var Redis=require('ioredis');var authService=require(_0xdd2b('0x11'));var qs=require(_0xdd2b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdd2b('0x13'));var logger=require(_0xdd2b('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xdd2b('0x15'));var licenseUtil=require(_0xdd2b('0x16'));var db=require(_0xdd2b('0x17'))['db'];function respondWithStatusCode(_0x263540,_0x5503ae){_0x5503ae=_0x5503ae||0xcc;return function(_0xfa948c){if(_0xfa948c){return _0x263540['sendStatus'](_0x5503ae);}return _0x263540[_0xdd2b('0x18')](_0x5503ae)['end']();};}function respondWithResult(_0x11ad57,_0x378bce){_0x378bce=_0x378bce||0xc8;return function(_0x277860){if(_0x277860){return _0x11ad57[_0xdd2b('0x18')](_0x378bce)[_0xdd2b('0x19')](_0x277860);}};}function respondWithFilteredResult(_0x1a7ef8,_0x9f8d74){return function(_0x2507f1){if(_0x2507f1){var _0x473e72=typeof _0x9f8d74[_0xdd2b('0x1a')]==='undefined'&&typeof _0x9f8d74[_0xdd2b('0x1b')]===_0xdd2b('0x1c');var _0x1c8ba7=_0x2507f1[_0xdd2b('0x1d')];var _0x475554=_0x473e72?0x0:_0x9f8d74['offset'];var _0x1e1024=_0x473e72?_0x2507f1[_0xdd2b('0x1d')]:_0x9f8d74[_0xdd2b('0x1a')]+_0x9f8d74[_0xdd2b('0x1b')];var _0x221060;if(_0x1e1024>=_0x1c8ba7){_0x1e1024=_0x1c8ba7;_0x221060=0xc8;}else{_0x221060=0xce;}_0x1a7ef8['status'](_0x221060);return _0x1a7ef8[_0xdd2b('0x1e')](_0xdd2b('0x1f'),_0x475554+'-'+_0x1e1024+'/'+_0x1c8ba7)[_0xdd2b('0x19')](_0x2507f1);}return null;};}function patchUpdates(_0x16f7bf){return function(_0x5ccb4e){try{jsonpatch['apply'](_0x5ccb4e,_0x16f7bf,!![]);}catch(_0x1f5e6c){return BPromise[_0xdd2b('0x20')](_0x1f5e6c);}return _0x5ccb4e[_0xdd2b('0x21')]();};}function saveUpdates(_0x15d859,_0x5e2b62){return function(_0x5813bf){if(_0x5813bf){return _0x5813bf[_0xdd2b('0x22')](_0x15d859)['then'](function(_0x5cd500){return _0x5cd500;});}return null;};}function removeEntity(_0x1a7c86,_0xbe5f86){return function(_0x143e6c){if(_0x143e6c){return _0x143e6c['destroy']()[_0xdd2b('0x23')](function(){var _0x43b330=_0x143e6c[_0xdd2b('0x24')]({'plain':!![]});var _0x5b02b3='Variables';return db[_0xdd2b('0x25')][_0xdd2b('0x26')]({'where':{'type':_0x5b02b3,'resourceId':_0x43b330['id']}})[_0xdd2b('0x23')](function(){return _0x143e6c;});})[_0xdd2b('0x23')](function(){_0x1a7c86[_0xdd2b('0x18')](0xcc)[_0xdd2b('0x27')]();});}};}function handleEntityNotFound(_0x560bba,_0x5eaf7e){return function(_0x4cdc3b){if(!_0x4cdc3b){_0x560bba[_0xdd2b('0x28')](0x194);}return _0x4cdc3b;};}function handleError(_0x4b376b,_0x4598f0){_0x4598f0=_0x4598f0||0x1f4;return function(_0x598f5c){logger[_0xdd2b('0x29')](_0x598f5c['stack']);if(_0x598f5c['name']){delete _0x598f5c[_0xdd2b('0x2a')];}_0x4b376b[_0xdd2b('0x18')](_0x4598f0)[_0xdd2b('0x2b')](_0x598f5c);};}exports[_0xdd2b('0x2c')]=function(_0x32e333,_0x2cea9d){var _0xa79681={},_0x38568a={},_0x36bfad={'count':0x0,'rows':[]};var _0x2e4792=_['map'](db[_0xdd2b('0x2d')]['rawAttributes'],function(_0x236b88){return{'name':_0x236b88['fieldName'],'type':_0x236b88[_0xdd2b('0x2e')]['key']};});_0x38568a[_0xdd2b('0x2f')]=_[_0xdd2b('0x30')](_0x2e4792,_0xdd2b('0x2a'));_0x38568a[_0xdd2b('0x31')]=_[_0xdd2b('0x32')](_0x32e333['query']);_0x38568a['filters']=_[_0xdd2b('0x33')](_0x38568a[_0xdd2b('0x2f')],_0x38568a[_0xdd2b('0x31')]);_0xa79681[_0xdd2b('0x34')]=_[_0xdd2b('0x33')](_0x38568a[_0xdd2b('0x2f')],qs['fields'](_0x32e333[_0xdd2b('0x31')][_0xdd2b('0x35')]));_0xa79681[_0xdd2b('0x34')]=_0xa79681[_0xdd2b('0x34')]['length']?_0xa79681[_0xdd2b('0x34')]:_0x38568a['model'];if(!_0x32e333[_0xdd2b('0x31')][_0xdd2b('0x36')](_0xdd2b('0x37'))){_0xa79681[_0xdd2b('0x1b')]=qs['limit'](_0x32e333['query'][_0xdd2b('0x1b')]);_0xa79681['offset']=qs[_0xdd2b('0x1a')](_0x32e333[_0xdd2b('0x31')]['offset']);}_0xa79681[_0xdd2b('0x38')]=qs['sort'](_0x32e333['query']['sort']);_0xa79681['where']=qs['filters'](_[_0xdd2b('0x39')](_0x32e333[_0xdd2b('0x31')],_0x38568a[_0xdd2b('0x3a')]),_0x2e4792);if(_0x32e333[_0xdd2b('0x31')][_0xdd2b('0x3b')]){_0xa79681[_0xdd2b('0x3c')]=_[_0xdd2b('0x3d')](_0xa79681[_0xdd2b('0x3c')],{'$or':_[_0xdd2b('0x30')](_0x2e4792,function(_0x5d4a1a){if(_0x5d4a1a[_0xdd2b('0x2e')]!=='VIRTUAL'){var _0x4e4368={};_0x4e4368[_0x5d4a1a[_0xdd2b('0x2a')]]={'$like':'%'+_0x32e333[_0xdd2b('0x31')][_0xdd2b('0x3b')]+'%'};return _0x4e4368;}})});}_0xa79681=_[_0xdd2b('0x3d')]({},_0xa79681,_0x32e333[_0xdd2b('0x3e')]);var _0x4c9d77={'where':_0xa79681['where']};return db[_0xdd2b('0x2d')][_0xdd2b('0x1d')](_0x4c9d77)[_0xdd2b('0x23')](function(_0x3d55e1){_0x36bfad['count']=_0x3d55e1;if(_0x32e333['query'][_0xdd2b('0x3f')]){_0xa79681['include']=[{'all':!![]}];}return db['Variable'][_0xdd2b('0x40')](_0xa79681);})['then'](function(_0x3ff0fc){_0x36bfad['rows']=_0x3ff0fc;return _0x36bfad;})['then'](respondWithFilteredResult(_0x2cea9d,_0xa79681))['catch'](handleError(_0x2cea9d,null));};exports[_0xdd2b('0x41')]=function(_0x2228ec,_0x1a627d){var _0x3658d0={'raw':!![],'where':{'id':_0x2228ec[_0xdd2b('0x42')]['id']}},_0x17a4de={};_0x17a4de[_0xdd2b('0x2f')]=_[_0xdd2b('0x32')](db[_0xdd2b('0x2d')][_0xdd2b('0x43')]);_0x17a4de[_0xdd2b('0x31')]=_[_0xdd2b('0x32')](_0x2228ec['query']);_0x17a4de[_0xdd2b('0x3a')]=_[_0xdd2b('0x33')](_0x17a4de['model'],_0x17a4de[_0xdd2b('0x31')]);_0x3658d0[_0xdd2b('0x34')]=_['intersection'](_0x17a4de[_0xdd2b('0x2f')],qs['fields'](_0x2228ec[_0xdd2b('0x31')][_0xdd2b('0x35')]));_0x3658d0['attributes']=_0x3658d0[_0xdd2b('0x34')][_0xdd2b('0x44')]?_0x3658d0[_0xdd2b('0x34')]:_0x17a4de[_0xdd2b('0x2f')];if(_0x2228ec[_0xdd2b('0x31')][_0xdd2b('0x3f')]){_0x3658d0['include']=[{'all':!![]}];}_0x3658d0=_[_0xdd2b('0x3d')]({},_0x3658d0,_0x2228ec[_0xdd2b('0x3e')]);return db[_0xdd2b('0x2d')][_0xdd2b('0x45')](_0x3658d0)['then'](handleEntityNotFound(_0x1a627d,null))[_0xdd2b('0x23')](respondWithResult(_0x1a627d,null))[_0xdd2b('0x46')](handleError(_0x1a627d,null));};exports[_0xdd2b('0x47')]=function(_0x31e867,_0xdf7a18){return db[_0xdd2b('0x2d')][_0xdd2b('0x47')](_0x31e867['body'],{})[_0xdd2b('0x23')](function(_0x22cd98){var _0xe28d2e=_0x31e867[_0xdd2b('0x48')]['get']({'plain':!![]});if(!_0xe28d2e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe28d2e[_0xdd2b('0x49')]===_0xdd2b('0x48')){var _0x574b33=_0x22cd98[_0xdd2b('0x24')]({'plain':!![]});var _0x5ec1d6=_0xdd2b('0x4a');return db[_0xdd2b('0x4b')][_0xdd2b('0x45')]({'where':{'name':_0x5ec1d6,'userProfileId':_0xe28d2e[_0xdd2b('0x4c')]},'raw':!![]})[_0xdd2b('0x23')](function(_0x47ffbb){if(_0x47ffbb&&_0x47ffbb[_0xdd2b('0x4d')]===0x0){return db['UserProfileResource'][_0xdd2b('0x47')]({'name':_0x574b33[_0xdd2b('0x2a')],'resourceId':_0x574b33['id'],'type':_0x47ffbb[_0xdd2b('0x2a')],'sectionId':_0x47ffbb['id']},{})[_0xdd2b('0x23')](function(){return _0x22cd98;});}else{return _0x22cd98;}})['catch'](function(_0x3c3518){logger[_0xdd2b('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c3518);throw _0x3c3518;});}return _0x22cd98;})[_0xdd2b('0x23')](respondWithResult(_0xdf7a18,0xc9))['catch'](handleError(_0xdf7a18,null));};exports['update']=function(_0x3e7d35,_0x40b275){if(_0x3e7d35[_0xdd2b('0x4e')]['id']){delete _0x3e7d35['body']['id'];}return db[_0xdd2b('0x2d')]['find']({'where':{'id':_0x3e7d35[_0xdd2b('0x42')]['id']}})[_0xdd2b('0x23')](handleEntityNotFound(_0x40b275,null))[_0xdd2b('0x23')](saveUpdates(_0x3e7d35[_0xdd2b('0x4e')],null))['then'](respondWithResult(_0x40b275,null))[_0xdd2b('0x46')](handleError(_0x40b275,null));};exports[_0xdd2b('0x26')]=function(_0x2a568f,_0x494a86){return db[_0xdd2b('0x2d')]['find']({'where':{'id':_0x2a568f[_0xdd2b('0x42')]['id']}})[_0xdd2b('0x23')](handleEntityNotFound(_0x494a86,null))['then'](removeEntity(_0x494a86,null))[_0xdd2b('0x46')](handleError(_0x494a86,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 004f656..7df0c2e 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 _0x59e5=['../../config/environment','exports','define','Variable','util','../../config/logger','api','bluebird','path'];(function(_0x59a415,_0x3269f0){var _0x595fbd=function(_0x1e42e7){while(--_0x1e42e7){_0x59a415['push'](_0x59a415['shift']());}};_0x595fbd(++_0x3269f0);}(_0x59e5,0x11b));var _0x559e=function(_0x245793,_0x580900){_0x245793=_0x245793-0x0;var _0x556e18=_0x59e5[_0x245793];return _0x556e18;};'use strict';var _=require('lodash');var util=require(_0x559e('0x0'));var logger=require(_0x559e('0x1'))(_0x559e('0x2'));var moment=require('moment');var BPromise=require(_0x559e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x559e('0x4'));var rimraf=require('rimraf');var config=require(_0x559e('0x5'));var attributes=require('./variable.attributes');module[_0x559e('0x6')]=function(_0x378a25,_0x50798f){return _0x378a25[_0x559e('0x7')](_0x559e('0x8'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb43e=['tools_variables','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./variable.attributes','define','Variable'];(function(_0x19f873,_0x21e78a){var _0x5cc4d9=function(_0x50efd2){while(--_0x50efd2){_0x19f873['push'](_0x19f873['shift']());}};_0x5cc4d9(++_0x21e78a);}(_0xb43e,0x1f0));var _0xeb43=function(_0x584c68,_0x550bee){_0x584c68=_0x584c68-0x0;var _0x49edaa=_0xb43e[_0x584c68];return _0x49edaa;};'use strict';var _=require('lodash');var util=require(_0xeb43('0x0'));var logger=require(_0xeb43('0x1'))(_0xeb43('0x2'));var moment=require('moment');var BPromise=require(_0xeb43('0x3'));var rp=require(_0xeb43('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeb43('0x5'));var config=require(_0xeb43('0x6'));var attributes=require(_0xeb43('0x7'));module['exports']=function(_0x308087,_0x448c8e){return _0x308087[_0xeb43('0x8')](_0xeb43('0x9'),attributes,{'tableName':_0xeb43('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index ff037cf..936867f 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa41a=['debug','Variable,\x20%s,\x20%s,\x20%s','error','message','result','catch','ShowVariable','options','raw','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0xa41a,0x6b));var _0xaa41=function(_0x4b24c2,_0x494b55){_0x4b24c2=_0x4b24c2-0x0;var _0x52379e=_0xa41a[_0x4b24c2];return _0x52379e;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});}exports[_0xaa41('0x17')]=function(_0xd20ddf){var _0x29efe5=this;return new Promise(function(_0x46e6d3,_0x150ddf){return db['Variable']['find']({'raw':_0xd20ddf[_0xaa41('0x18')]?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x19')]===undefined?!![]:![]:!![],'where':_0xd20ddf['options']?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1a')]||null:null,'attributes':_0xd20ddf['options']?_0xd20ddf['options'][_0xaa41('0x1b')]||null:null,'include':_0xd20ddf['options']?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1c')]?_[_0xaa41('0x1d')](_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1c')],function(_0x4eb01f){return{'model':db[_0x4eb01f[_0xaa41('0x1e')]],'as':_0x4eb01f['as'],'attributes':_0x4eb01f[_0xaa41('0x1b')],'include':_0x4eb01f[_0xaa41('0x1c')]?_[_0xaa41('0x1d')](_0x4eb01f[_0xaa41('0x1c')],function(_0xa1f024){return{'model':db[_0xa1f024['model']],'as':_0xa1f024['as'],'attributes':_0xa1f024['attributes'],'include':_0xa1f024[_0xaa41('0x1c')]?_['map'](_0xa1f024['include'],function(_0x12e362){return{'model':db[_0x12e362['model']],'as':_0x12e362['as'],'attributes':_0x12e362['attributes']};}):[]};}):[]};}):[]:[]})[_0xaa41('0xd')](function(_0x9c8c21){logger[_0xaa41('0xe')](_0xaa41('0x17'),_0xd20ddf);logger[_0xaa41('0x11')](_0xaa41('0x17'),_0xd20ddf,JSON['stringify'](_0x9c8c21));_0x46e6d3(_0x9c8c21);})[_0xaa41('0x16')](function(_0x1f0275){logger[_0xaa41('0x13')](_0xaa41('0x17'),_0x1f0275[_0xaa41('0x14')],_0xd20ddf);_0x150ddf(_0x29efe5[_0xaa41('0x13')](0x1f4,_0x1f0275[_0xaa41('0x14')]));});});}; \ No newline at end of file +var _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(_0x3b4658,_0x550465){var _0x1748d6=function(_0x1424af){while(--_0x1424af){_0x3b4658['push'](_0x3b4658['shift']());}};_0x1748d6(++_0x550465);}(_0xabce,0x103));var _0xeabc=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xabce[_0x173d7e];return _0x2220d6;};'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 diff --git a/server/api/version/index.js b/server/api/version/index.js index 3df6c1f..da53823 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 _0x0123=['Router','get','index','/fetch','canUpdate','/reset','isAuthenticated','reset','pull','restart','/migrations','migrations','express'];(function(_0x59616b,_0x38e534){var _0x5c4523=function(_0x166f2e){while(--_0x166f2e){_0x59616b['push'](_0x59616b['shift']());}};_0x5c4523(++_0x38e534);}(_0x0123,0xb5));var _0x3012=function(_0x3809e0,_0x3c2e4e){_0x3809e0=_0x3809e0-0x0;var _0x5447d4=_0x0123[_0x3809e0];return _0x5447d4;};'use strict';var express=require(_0x3012('0x0'));var router=express[_0x3012('0x1')]();var auth=require('../../components/auth/service');var controller=require('./version.controller');router[_0x3012('0x2')]('/',controller[_0x3012('0x3')]);router['get'](_0x3012('0x4'),auth['isAuthenticated'](),auth[_0x3012('0x5')](),controller['fetch']);router[_0x3012('0x2')](_0x3012('0x6'),auth[_0x3012('0x7')](),auth[_0x3012('0x5')](),controller[_0x3012('0x8')]);router[_0x3012('0x2')]('/pull',auth[_0x3012('0x7')](),auth[_0x3012('0x5')](),controller[_0x3012('0x9')]);router['get']('/restart',auth[_0x3012('0x7')](),controller[_0x3012('0xa')]);router['get'](_0x3012('0xb'),controller[_0x3012('0xc')]);module['exports']=router; \ No newline at end of file +var _0x0dd7=['get','reset','/pull','pull','/restart','restart','migrations','exports','express','Router','../../components/auth/service','./version.controller','index','isAuthenticated','canUpdate','fetch'];(function(_0x2896ea,_0x17c794){var _0x519c5a=function(_0x5095cf){while(--_0x5095cf){_0x2896ea['push'](_0x2896ea['shift']());}};_0x519c5a(++_0x17c794);}(_0x0dd7,0x1c8));var _0x70dd=function(_0x1d426f,_0x37e919){_0x1d426f=_0x1d426f-0x0;var _0x17f71a=_0x0dd7[_0x1d426f];return _0x17f71a;};'use strict';var express=require(_0x70dd('0x0'));var router=express[_0x70dd('0x1')]();var auth=require(_0x70dd('0x2'));var controller=require(_0x70dd('0x3'));router['get']('/',controller[_0x70dd('0x4')]);router['get']('/fetch',auth[_0x70dd('0x5')](),auth[_0x70dd('0x6')](),controller[_0x70dd('0x7')]);router[_0x70dd('0x8')]('/reset',auth[_0x70dd('0x5')](),auth['canUpdate'](),controller[_0x70dd('0x9')]);router[_0x70dd('0x8')](_0x70dd('0xa'),auth['isAuthenticated'](),auth[_0x70dd('0x6')](),controller[_0x70dd('0xb')]);router[_0x70dd('0x8')](_0x70dd('0xc'),auth[_0x70dd('0x5')](),controller[_0x70dd('0xd')]);router['get']('/migrations',controller[_0x70dd('0xe')]);module[_0x70dd('0xf')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 43b0a62..d0a44a7 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 _0x979f=['Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','root','server','replace','.js','push','sort','Migration','sequelize','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','map','Database\x20migrated\x20successfully\x20from\x20version\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','index','exports','query','latest','fetch','tags','2.0.0','status','json','origin','master','error','info','git\x20fetch','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s'];(function(_0xba1760,_0x191969){var _0x1f3143=function(_0x5aa807){while(--_0x5aa807){_0xba1760['push'](_0xba1760['shift']());}};_0x1f3143(++_0x191969);}(_0x979f,0xf2));var _0xf979=function(_0x162da8,_0x1f40aa){_0x162da8=_0x162da8-0x0;var _0x4226b0=_0x979f[_0x162da8];return _0x4226b0;};'use strict';var Umzug=require('umzug');var path=require(_0xf979('0x0'));var fs=require('fs');var _=require(_0xf979('0x1'));var pkginfo=require(_0xf979('0x2'))(module,_0xf979('0x3'));var compareVersions=require(_0xf979('0x4'));var exec=require(_0xf979('0x5'))[_0xf979('0x6')];var db=require(_0xf979('0x7'))['db'];var config=require(_0xf979('0x8'));var pm2=require(_0xf979('0x9'));var logger=require(_0xf979('0xa'))(_0xf979('0xb'));var git=require(_0xf979('0xc'))(config['root']);exports[_0xf979('0xd')]=function(_0x4ae693,_0x32df94){var _0x65a570={'current':module[_0xf979('0xe')]['version'],'phonebar':0x2};if(_0x4ae693['query']&&_0x4ae693[_0xf979('0xf')][_0xf979('0x10')]){return git[_0xf979('0x11')]()[_0xf979('0x12')](function(_0x3a0690,_0x4b52ab){_0x65a570[_0xf979('0x10')]=(_0x3a0690?module[_0xf979('0xe')][_0xf979('0x3')]:_0x4b52ab[_0xf979('0x10')])||_0xf979('0x13');return _0x32df94[_0xf979('0x14')](0xc8)[_0xf979('0x15')](_0x65a570);});}else{return _0x32df94[_0xf979('0x14')](0xc8)[_0xf979('0x15')](_0x65a570);}};exports[_0xf979('0x11')]=function(_0xf8e0f7,_0x4ed9df){return git[_0xf979('0x11')]([_0xf979('0x16'),_0xf979('0x17')],function(_0x563c30){if(_0x563c30){logger[_0xf979('0x18')](_0x563c30);return _0x4ed9df[_0xf979('0x14')](0x1f4)['json'](_0x563c30);}logger[_0xf979('0x19')](_0xf979('0x1a'));return _0x4ed9df[_0xf979('0x14')](0xc8)[_0xf979('0x15')]({'output':'git\x20fetch\x20origin\x20master'});});};exports['reset']=function(_0x402281,_0x5db302){return git[_0xf979('0x1b')]([_0xf979('0x1c'),_0xf979('0x1d')],function(_0x5cb4b0){if(_0x5cb4b0){logger[_0xf979('0x18')](_0x5cb4b0);return _0x5db302[_0xf979('0x14')](0x1f4)[_0xf979('0x15')](_0x5cb4b0);}logger[_0xf979('0x19')](_0xf979('0x1e'));return _0x5db302[_0xf979('0x14')](0xc8)[_0xf979('0x15')]({'output':_0xf979('0x1f')});});};exports[_0xf979('0x20')]=function(_0x13f037,_0x70e0ce){exec(_0xf979('0x21'),function(_0x46349f,_0x26ba33,_0x1b33dd){logger[_0xf979('0x19')](_0x26ba33);logger['info'](_0x1b33dd);if(_0x46349f){logger[_0xf979('0x18')](_0x46349f);return _0x70e0ce[_0xf979('0x14')](0x1f4)['json'](_0x46349f);}return _0x70e0ce[_0xf979('0x14')](0xc8)[_0xf979('0x15')]({'output':_0x26ba33});});};exports[_0xf979('0x22')]=function(_0x4ebeea,_0xca0a03){return pm2['restart'](_0xf979('0x23'))[_0xf979('0x24')](function(_0x2157d9){logger[_0xf979('0x19')](_0xf979('0x25'),_0x2157d9);return _0xca0a03['status'](0xc8)[_0xf979('0x15')]({'output':_0xf979('0x26')});})['catch'](function(_0x1fc842){logger[_0xf979('0x18')](_0x1fc842);return _0xca0a03[_0xf979('0x14')](0x1f4)[_0xf979('0x15')](_0x1fc842);});};exports[_0xf979('0x27')]=function(_0x5c7da8,_0x209b33){var _0x12ae69=fs['readdirSync'](path['join'](config[_0xf979('0x28')],_0xf979('0x29'),_0xf979('0x27')));var _0x4afad3=[];for(var _0xae03da=0x0;_0xae03da<_0x12ae69['length'];_0xae03da++){var _0x300adb=_0x12ae69[_0xae03da][_0xf979('0x2a')](_0xf979('0x2b'),'');if(compareVersions(module['exports'][_0xf979('0x3')],_0x300adb)===-0x1){_0x4afad3[_0xf979('0x2c')](_0x300adb);}}if(_0x4afad3['length']){var _0x46ca59=_0x4afad3[_0xf979('0x2d')](compareVersions);var _0x1d0537=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0xf979('0x2e')],'modelName':_0xf979('0x2e'),'columnName':'version'},'migrations':{'params':[db[_0xf979('0x2f')]['getQueryInterface'](),db['sequelize'][_0xf979('0x30')],function(){throw new Error(_0xf979('0x31'));}],'path':path[_0xf979('0x32')](config[_0xf979('0x28')],'server',_0xf979('0x27')),'pattern':/\.js$/}});_0x1d0537['up']({'migrations':_[_0xf979('0x33')](_0x46ca59,function(_0x4ba351){return _0x4ba351+'.js';})})['then'](function(){return _0x209b33[_0xf979('0x14')](0xc8)[_0xf979('0x15')]({'output':_0xf979('0x34')+module[_0xf979('0xe')][_0xf979('0x3')]+'\x20to\x20'+_[_0xf979('0x35')](_0x46ca59),'migrations':_[_0xf979('0x32')](_0x46ca59)});})['catch'](function(_0xc113ca){if(_0xc113ca instanceof db[_0xf979('0x2f')][_0xf979('0x36')]){return _0x209b33['status'](0xc8)[_0xf979('0x15')]({'output':_0xf979('0x37')});}else{return _0x209b33[_0xf979('0x14')](0x1f4)['json'](_0xc113ca);}});}else{return _0x209b33[_0xf979('0x14')](0xc8)[_0xf979('0x15')]({'output':_0xf979('0x37')});}}; \ No newline at end of file +var _0x1fb6=['master','error','info','git\x20fetch','reset','FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','catch','migrations','readdirSync','join','server','length','.js','push','sort','sequelize','Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','path','lodash','version','compare-versions','child_process','../../mysqldb','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','query','latest','fetch','tags','2.0.0','json','status','origin'];(function(_0x21659d,_0x3ccc16){var _0x463b02=function(_0x15db65){while(--_0x15db65){_0x21659d['push'](_0x21659d['shift']());}};_0x463b02(++_0x3ccc16);}(_0x1fb6,0x193));var _0x61fb=function(_0x4cacc4,_0x320fb2){_0x4cacc4=_0x4cacc4-0x0;var _0x27397d=_0x1fb6[_0x4cacc4];return _0x27397d;};'use strict';var Umzug=require('umzug');var path=require(_0x61fb('0x0'));var fs=require('fs');var _=require(_0x61fb('0x1'));var pkginfo=require('pkginfo')(module,_0x61fb('0x2'));var compareVersions=require(_0x61fb('0x3'));var exec=require(_0x61fb('0x4'))['exec'];var db=require(_0x61fb('0x5'))['db'];var config=require('../../config/environment');var pm2=require(_0x61fb('0x6'));var logger=require(_0x61fb('0x7'))(_0x61fb('0x8'));var git=require(_0x61fb('0x9'))(config[_0x61fb('0xa')]);exports[_0x61fb('0xb')]=function(_0x529300,_0x38bdfb){var _0x17c04a={'current':module[_0x61fb('0xc')][_0x61fb('0x2')],'phonebar':0x2};if(_0x529300[_0x61fb('0xd')]&&_0x529300[_0x61fb('0xd')][_0x61fb('0xe')]){return git[_0x61fb('0xf')]()[_0x61fb('0x10')](function(_0x197dcd,_0x2d6425){_0x17c04a[_0x61fb('0xe')]=(_0x197dcd?module[_0x61fb('0xc')][_0x61fb('0x2')]:_0x2d6425[_0x61fb('0xe')])||_0x61fb('0x11');return _0x38bdfb['status'](0xc8)[_0x61fb('0x12')](_0x17c04a);});}else{return _0x38bdfb[_0x61fb('0x13')](0xc8)[_0x61fb('0x12')](_0x17c04a);}};exports[_0x61fb('0xf')]=function(_0x246c99,_0x2ac952){return git[_0x61fb('0xf')]([_0x61fb('0x14'),_0x61fb('0x15')],function(_0x58f934){if(_0x58f934){logger[_0x61fb('0x16')](_0x58f934);return _0x2ac952['status'](0x1f4)[_0x61fb('0x12')](_0x58f934);}logger[_0x61fb('0x17')](_0x61fb('0x18'));return _0x2ac952['status'](0xc8)[_0x61fb('0x12')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x61fb('0x19')]=function(_0x3bf824,_0x4de5ed){return git[_0x61fb('0x19')](['--hard',_0x61fb('0x1a')],function(_0x5d7d){if(_0x5d7d){logger[_0x61fb('0x16')](_0x5d7d);return _0x4de5ed[_0x61fb('0x13')](0x1f4)[_0x61fb('0x12')](_0x5d7d);}logger[_0x61fb('0x17')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x4de5ed[_0x61fb('0x13')](0xc8)[_0x61fb('0x12')]({'output':_0x61fb('0x1b')});});};exports[_0x61fb('0x1c')]=function(_0x1d7399,_0x5e0d3e){exec(_0x61fb('0x1d'),function(_0x3ba609,_0x2e758a,_0x4cf2fc){logger[_0x61fb('0x17')](_0x2e758a);logger[_0x61fb('0x17')](_0x4cf2fc);if(_0x3ba609){logger[_0x61fb('0x16')](_0x3ba609);return _0x5e0d3e['status'](0x1f4)[_0x61fb('0x12')](_0x3ba609);}return _0x5e0d3e[_0x61fb('0x13')](0xc8)['json']({'output':_0x2e758a});});};exports['restart']=function(_0xcf5333,_0xf20d76){return pm2[_0x61fb('0x1e')](_0x61fb('0x1f'))[_0x61fb('0x20')](function(_0x37a00f){logger[_0x61fb('0x17')](_0x61fb('0x21'),_0x37a00f);return _0xf20d76[_0x61fb('0x13')](0xc8)['json']({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x61fb('0x22')](function(_0x13c498){logger[_0x61fb('0x16')](_0x13c498);return _0xf20d76[_0x61fb('0x13')](0x1f4)[_0x61fb('0x12')](_0x13c498);});};exports[_0x61fb('0x23')]=function(_0x4dd695,_0x20e0db){var _0x1e70cd=fs[_0x61fb('0x24')](path[_0x61fb('0x25')](config['root'],_0x61fb('0x26'),_0x61fb('0x23')));var _0x3faede=[];for(var _0x33672f=0x0;_0x33672f<_0x1e70cd[_0x61fb('0x27')];_0x33672f++){var _0x3d0773=_0x1e70cd[_0x33672f]['replace'](_0x61fb('0x28'),'');if(compareVersions(module[_0x61fb('0xc')]['version'],_0x3d0773)===-0x1){_0x3faede[_0x61fb('0x29')](_0x3d0773);}}if(_0x3faede[_0x61fb('0x27')]){var _0x23d682=_0x3faede[_0x61fb('0x2a')](compareVersions);var _0x3e602d=new Umzug({'storage':_0x61fb('0x2b'),'storageOptions':{'model':db[_0x61fb('0x2c')],'modelName':_0x61fb('0x2c'),'columnName':_0x61fb('0x2')},'migrations':{'params':[db[_0x61fb('0x2b')]['getQueryInterface'](),db['sequelize'][_0x61fb('0x2d')],function(){throw new Error(_0x61fb('0x2e'));}],'path':path[_0x61fb('0x25')](config[_0x61fb('0xa')],'server','migrations'),'pattern':/\.js$/}});_0x3e602d['up']({'migrations':_[_0x61fb('0x2f')](_0x23d682,function(_0x1b17c0){return _0x1b17c0+_0x61fb('0x28');})})[_0x61fb('0x20')](function(){return _0x20e0db[_0x61fb('0x13')](0xc8)[_0x61fb('0x12')]({'output':_0x61fb('0x30')+module[_0x61fb('0xc')]['version']+_0x61fb('0x31')+_[_0x61fb('0x32')](_0x23d682),'migrations':_[_0x61fb('0x25')](_0x23d682)});})[_0x61fb('0x22')](function(_0x35e34c){if(_0x35e34c instanceof db['sequelize'][_0x61fb('0x33')]){return _0x20e0db[_0x61fb('0x13')](0xc8)[_0x61fb('0x12')]({'output':_0x61fb('0x34')});}else{return _0x20e0db['status'](0x1f4)[_0x61fb('0x12')](_0x35e34c);}});}else{return _0x20e0db[_0x61fb('0x13')](0xc8)[_0x61fb('0x12')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 6b61b82..929bab2 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 _0x554c=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x554c,0x14b));var _0xc554=function(_0x4df62a,_0x152e28){_0x4df62a=_0x4df62a-0x0;var _0x1d5c56=_0x554c[_0x4df62a];return _0x1d5c56;};'use strict';var multer=require(_0xc554('0x0'));var util=require(_0xc554('0x1'));var path=require(_0xc554('0x2'));var timeout=require(_0xc554('0x3'));var express=require(_0xc554('0x4'));var router=express[_0xc554('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc554('0x6'));var interaction=require(_0xc554('0x7'));var config=require(_0xc554('0x8'));var controller=require(_0xc554('0x9'));router[_0xc554('0xa')]('/',auth[_0xc554('0xb')](),controller[_0xc554('0xc')]);router[_0xc554('0xa')](_0xc554('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0xc554('0xa')](_0xc554('0xe'),auth[_0xc554('0xb')](),controller[_0xc554('0xf')]);router[_0xc554('0x10')]('/',auth[_0xc554('0xb')](),controller[_0xc554('0x11')]);router[_0xc554('0x12')]('/:id',auth[_0xc554('0xb')](),controller[_0xc554('0x13')]);router[_0xc554('0x14')](_0xc554('0xe'),auth[_0xc554('0xb')](),controller['destroy']);module[_0xc554('0x15')]=router; \ No newline at end of file +var _0xe3f7=['/:id','delete','destroy','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','post','create','put'];(function(_0x309727,_0x3d6874){var _0x20ead4=function(_0x14e27e){while(--_0x14e27e){_0x309727['push'](_0x309727['shift']());}};_0x20ead4(++_0x3d6874);}(_0xe3f7,0x1d4));var _0x7e3f=function(_0x47ae30,_0x521769){_0x47ae30=_0x47ae30-0x0;var _0x39a2bd=_0xe3f7[_0x47ae30];return _0x39a2bd;};'use strict';var multer=require(_0x7e3f('0x0'));var util=require('util');var path=require(_0x7e3f('0x1'));var timeout=require('connect-timeout');var express=require(_0x7e3f('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7e3f('0x3'));var interaction=require(_0x7e3f('0x4'));var config=require('../../config/environment');var controller=require('./voiceAgentReport.controller');router[_0x7e3f('0x5')]('/',auth[_0x7e3f('0x6')](),controller[_0x7e3f('0x7')]);router[_0x7e3f('0x5')](_0x7e3f('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0x7e3f('0x5')]('/:id',auth[_0x7e3f('0x6')](),controller['show']);router[_0x7e3f('0x9')]('/',auth['isAuthenticated'](),controller[_0x7e3f('0xa')]);router[_0x7e3f('0xb')](_0x7e3f('0xc'),auth[_0x7e3f('0x6')](),controller['update']);router[_0x7e3f('0xd')]('/:id',auth[_0x7e3f('0x6')](),controller[_0x7e3f('0xe')]);module[_0x7e3f('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index c6ebefc..c8391d8 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 _0x7be1=['sequelize','exports','STRING','DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x4c5aa3,_0x31989b){var _0x1bcfa2=function(_0x16685d){while(--_0x16685d){_0x4c5aa3['push'](_0x4c5aa3['shift']());}};_0x1bcfa2(++_0x31989b);}(_0x7be1,0x165));var _0x17be=function(_0x3b150c,_0x2f93f8){_0x3b150c=_0x3b150c-0x0;var _0x5cd414=_0x7be1[_0x3b150c];return _0x5cd414;};'use strict';var Sequelize=require(_0x17be('0x0'));module[_0x17be('0x1')]={'type':{'type':Sequelize[_0x17be('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x17be('0x2')]},'calleridname':{'type':Sequelize[_0x17be('0x2')]},'queue':{'type':Sequelize[_0x17be('0x2')]},'interface':{'type':Sequelize[_0x17be('0x2')]},'membername':{'type':Sequelize[_0x17be('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x17be('0x3')]},'agentdumpAt':{'type':Sequelize[_0x17be('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x17be('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x17be('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x17be('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x17be('0x5')]},'agentacw':{'type':Sequelize[_0x17be('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x17be('0x5')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x17be('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x17be('0x5')]},'channelstatedesc':{'type':Sequelize[_0x17be('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x17be('0x2')]},'language':{'type':Sequelize[_0x17be('0x2')]},'accountcode':{'type':Sequelize[_0x17be('0x2')]},'context':{'type':Sequelize[_0x17be('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x17be('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x17be('0x5')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x17be('0x2')]},'destcalleridname':{'type':Sequelize[_0x17be('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x17be('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x17be('0x2')]},'destlanguage':{'type':Sequelize[_0x17be('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x17be('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x17be('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x17be('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x17be('0x2')],'comment':_0x17be('0x6')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x17be('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x235b=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x4ad047,_0x1d7e61){var _0x1ab662=function(_0x329325){while(--_0x329325){_0x4ad047['push'](_0x4ad047['shift']());}};_0x1ab662(++_0x1d7e61);}(_0x235b,0x1ed));var _0xb235=function(_0x4c0511,_0x23721f){_0x4c0511=_0x4c0511-0x0;var _0xd4e76b=_0x235b[_0x4c0511];return _0xd4e76b;};'use strict';var Sequelize=require(_0xb235('0x0'));module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xb235('0x1')]},'calleridnum':{'type':Sequelize[_0xb235('0x1')]},'calleridname':{'type':Sequelize[_0xb235('0x1')]},'queue':{'type':Sequelize[_0xb235('0x1')]},'interface':{'type':Sequelize[_0xb235('0x1')]},'membername':{'type':Sequelize[_0xb235('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xb235('0x2')]},'agentcompleteAt':{'type':Sequelize[_0xb235('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0xb235('0x2')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xb235('0x3')]},'agentcomplete':{'type':Sequelize[_0xb235('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xb235('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xb235('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xb235('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xb235('0x1')]},'lastevent':{'type':Sequelize[_0xb235('0x1')]},'channel':{'type':Sequelize[_0xb235('0x1')]},'channelstate':{'type':Sequelize[_0xb235('0x3')]},'channelstatedesc':{'type':Sequelize[_0xb235('0x1')]},'connectedlinenum':{'type':Sequelize[_0xb235('0x1')]},'connectedlinename':{'type':Sequelize[_0xb235('0x1')]},'language':{'type':Sequelize[_0xb235('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xb235('0x1')]},'exten':{'type':Sequelize[_0xb235('0x1')]},'priority':{'type':Sequelize[_0xb235('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xb235('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xb235('0x1')]},'destcalleridname':{'type':Sequelize[_0xb235('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xb235('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xb235('0x1')]},'destlanguage':{'type':Sequelize[_0xb235('0x1')]},'destaccountcode':{'type':Sequelize[_0xb235('0x1')]},'destcontext':{'type':Sequelize[_0xb235('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xb235('0x1')]},'destuniqueid':{'type':Sequelize[_0xb235('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xb235('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xb235('0x1')]},'transfer':{'type':Sequelize[_0xb235('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xb235('0x1')],'comment':_0xb235('0x5')},'transferexten':{'type':Sequelize[_0xb235('0x1')]},'transferuniqueid':{'type':Sequelize[_0xb235('0x1')]},'agententerreason':{'type':Sequelize[_0xb235('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 6806d33..4ab3cfa 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(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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 5b0036a..204f6a0 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 _0x0a52=['rimraf','../../config/environment','./voiceAgentReport.attributes','exports','VoiceAgentReport','report_agent','destuniqueid','lodash','util','api','moment','bluebird','path'];(function(_0x55b96d,_0x2a0db9){var _0x438583=function(_0x448437){while(--_0x448437){_0x55b96d['push'](_0x55b96d['shift']());}};_0x438583(++_0x2a0db9);}(_0x0a52,0xe4));var _0x20a5=function(_0x4a02e5,_0x2cdf02){_0x4a02e5=_0x4a02e5-0x0;var _0x2e75b9=_0x0a52[_0x4a02e5];return _0x2e75b9;};'use strict';var _=require(_0x20a5('0x0'));var util=require(_0x20a5('0x1'));var logger=require('../../config/logger')(_0x20a5('0x2'));var moment=require(_0x20a5('0x3'));var BPromise=require(_0x20a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x20a5('0x5'));var rimraf=require(_0x20a5('0x6'));var config=require(_0x20a5('0x7'));var attributes=require(_0x20a5('0x8'));module[_0x20a5('0x9')]=function(_0x1fcc72,_0x4acc66){return _0x1fcc72['define'](_0x20a5('0xa'),attributes,{'tableName':_0x20a5('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0x20a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xac31=['request-promise','rimraf','../../config/environment','define','VoiceAgentReport','report_agent','destuniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x58965a,_0x2e71db){var _0x254efc=function(_0xf14fb4){while(--_0xf14fb4){_0x58965a['push'](_0x58965a['shift']());}};_0x254efc(++_0x2e71db);}(_0xac31,0xca));var _0x1ac3=function(_0x165bb5,_0x2afce5){_0x165bb5=_0x165bb5-0x0;var _0x51aa82=_0xac31[_0x165bb5];return _0x51aa82;};'use strict';var _=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var logger=require(_0x1ac3('0x2'))(_0x1ac3('0x3'));var moment=require(_0x1ac3('0x4'));var BPromise=require(_0x1ac3('0x5'));var rp=require(_0x1ac3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1ac3('0x7'));var config=require(_0x1ac3('0x8'));var attributes=require('./voiceAgentReport.attributes');module['exports']=function(_0xbe22b7,_0x20027f){return _0xbe22b7[_0x1ac3('0x9')](_0x1ac3('0xa'),attributes,{'tableName':_0x1ac3('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0x1ac3('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 707bd71..a5e6889 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 _0x8bc1=['result','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','then','UpdateVoiceAgentReport','update','where','attributes','limit','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','request\x20sent','debug','stringify','error','VoiceAgentReport,\x20%s,\x20%s','message'];(function(_0x5193e5,_0x36cd71){var _0x27cb8a=function(_0x5140ca){while(--_0x5140ca){_0x5193e5['push'](_0x5193e5['shift']());}};_0x27cb8a(++_0x36cd71);}(_0x8bc1,0x193));var _0x18bc=function(_0x3c0960,_0x21cac0){_0x3c0960=_0x3c0960-0x0;var _0x43d706=_0x8bc1[_0x3c0960];return _0x43d706;};'use strict';var _=require('lodash');var util=require(_0x18bc('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x18bc('0x1'));var fs=require('fs');var Redis=require(_0x18bc('0x2'));var db=require(_0x18bc('0x3'))['db'];var utils=require(_0x18bc('0x4'));var logger=require(_0x18bc('0x5'))('rpc');var config=require(_0x18bc('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x18bc('0x7')][_0x18bc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xc325b0,_0x17bafa,_0xb3f516){return new BPromise(function(_0x33fc1c,_0x4db061){return client[_0x18bc('0x9')](_0xc325b0,_0xb3f516)['then'](function(_0x4f454b){logger[_0x18bc('0xa')]('VoiceAgentReport,\x20%s,\x20%s',_0x17bafa,_0x18bc('0xb'));logger[_0x18bc('0xc')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x17bafa,_0x18bc('0xb'),JSON[_0x18bc('0xd')](_0x4f454b));if(_0x4f454b[_0x18bc('0xe')]){if(_0x4f454b[_0x18bc('0xe')]['code']===0x1f4){logger[_0x18bc('0xe')](_0x18bc('0xf'),_0x17bafa,_0x4f454b[_0x18bc('0xe')][_0x18bc('0x10')]);return _0x4db061(_0x4f454b[_0x18bc('0xe')][_0x18bc('0x10')]);}logger[_0x18bc('0xe')](_0x18bc('0xf'),_0x17bafa,_0x4f454b[_0x18bc('0xe')]['message']);return _0x33fc1c(_0x4f454b[_0x18bc('0xe')][_0x18bc('0x10')]);}else{logger[_0x18bc('0xa')](_0x18bc('0xf'),_0x17bafa,'request\x20sent');_0x33fc1c(_0x4f454b[_0x18bc('0x11')][_0x18bc('0x10')]);}})['catch'](function(_0x33142b){logger[_0x18bc('0xe')](_0x18bc('0xf'),_0x17bafa,_0x33142b);_0x4db061(_0x33142b);});});}exports[_0x18bc('0x12')]=function(_0x16aed5){var _0x33334e=this;return new Promise(function(_0x5900ea,_0x33473e){return db[_0x18bc('0x13')][_0x18bc('0x14')](_0x16aed5[_0x18bc('0x15')],{'raw':_0x16aed5[_0x18bc('0x16')]?_0x16aed5[_0x18bc('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x18bc('0x17')](function(_0x22dfa6){logger['info'](_0x18bc('0x12'),_0x16aed5);logger[_0x18bc('0xc')](_0x18bc('0x12'),_0x16aed5,JSON[_0x18bc('0xd')](_0x22dfa6));_0x5900ea(_0x22dfa6);})['catch'](function(_0x36e0d2){logger[_0x18bc('0xe')]('CreateVoiceAgentReport',_0x36e0d2['message'],_0x16aed5);_0x33473e(_0x33334e['error'](0x1f4,_0x36e0d2[_0x18bc('0x10')]));});});};exports[_0x18bc('0x18')]=function(_0xa1f078){var _0x21395b=this;return new Promise(function(_0x4f8b21,_0x42b223){return db[_0x18bc('0x13')][_0x18bc('0x19')](_0xa1f078[_0x18bc('0x15')],{'raw':_0xa1f078[_0x18bc('0x16')]?_0xa1f078[_0x18bc('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa1f078[_0x18bc('0x16')]?_0xa1f078[_0x18bc('0x16')][_0x18bc('0x1a')]||null:null,'attributes':_0xa1f078[_0x18bc('0x16')]?_0xa1f078[_0x18bc('0x16')][_0x18bc('0x1b')]||null:null,'limit':_0xa1f078[_0x18bc('0x16')]?_0xa1f078[_0x18bc('0x16')][_0x18bc('0x1c')]||null:null})['then'](function(_0x6e9268){logger[_0x18bc('0xa')](_0x18bc('0x18'),_0xa1f078);logger[_0x18bc('0xc')]('UpdateVoiceAgentReport',_0xa1f078,JSON[_0x18bc('0xd')](_0x6e9268));_0x4f8b21(_0x6e9268);})[_0x18bc('0x1d')](function(_0x60c7bf){logger['error']('UpdateVoiceAgentReport',_0x60c7bf[_0x18bc('0x10')],_0xa1f078);_0x42b223(_0x21395b['error'](0x1f4,_0x60c7bf['message']));});});}; \ No newline at end of file +var _0xc9b7=['debug','UpdateVoiceAgentReport','update','where','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceAgentReport,\x20%s,\x20%s','result','catch','VoiceAgentReport','create','body','options','raw','CreateVoiceAgentReport'];(function(_0x2451ae,_0x2ff3a4){var _0x5d6db9=function(_0x1b0200){while(--_0x1b0200){_0x2451ae['push'](_0x2451ae['shift']());}};_0x5d6db9(++_0x2ff3a4);}(_0xc9b7,0xfa));var _0x7c9b=function(_0x514f8c,_0x149740){_0x514f8c=_0x514f8c-0x0;var _0x3fbf72=_0xc9b7[_0x514f8c];return _0x3fbf72;};'use strict';var _=require(_0x7c9b('0x0'));var util=require(_0x7c9b('0x1'));var moment=require(_0x7c9b('0x2'));var BPromise=require(_0x7c9b('0x3'));var rs=require(_0x7c9b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7c9b('0x5'))['db'];var utils=require(_0x7c9b('0x6'));var logger=require(_0x7c9b('0x7'))(_0x7c9b('0x8'));var config=require(_0x7c9b('0x9'));var jayson=require(_0x7c9b('0xa'));var client=jayson[_0x7c9b('0xb')][_0x7c9b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x537703,_0x3fcc8b,_0x42157a){return new BPromise(function(_0x3f7e98,_0x17a1b0){return client[_0x7c9b('0xd')](_0x537703,_0x42157a)['then'](function(_0x15b620){logger[_0x7c9b('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0x3fcc8b,_0x7c9b('0xf'));logger['debug'](_0x7c9b('0x10'),_0x3fcc8b,'request\x20sent',JSON[_0x7c9b('0x11')](_0x15b620));if(_0x15b620[_0x7c9b('0x12')]){if(_0x15b620[_0x7c9b('0x12')][_0x7c9b('0x13')]===0x1f4){logger[_0x7c9b('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x3fcc8b,_0x15b620[_0x7c9b('0x12')][_0x7c9b('0x14')]);return _0x17a1b0(_0x15b620[_0x7c9b('0x12')][_0x7c9b('0x14')]);}logger[_0x7c9b('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x3fcc8b,_0x15b620[_0x7c9b('0x12')][_0x7c9b('0x14')]);return _0x3f7e98(_0x15b620['error'][_0x7c9b('0x14')]);}else{logger['info'](_0x7c9b('0x15'),_0x3fcc8b,_0x7c9b('0xf'));_0x3f7e98(_0x15b620[_0x7c9b('0x16')]['message']);}})[_0x7c9b('0x17')](function(_0x19df92){logger[_0x7c9b('0x12')](_0x7c9b('0x15'),_0x3fcc8b,_0x19df92);_0x17a1b0(_0x19df92);});});}exports['CreateVoiceAgentReport']=function(_0x5a9ad6){var _0x50bed0=this;return new Promise(function(_0x366b39,_0x5e9c2e){return db[_0x7c9b('0x18')][_0x7c9b('0x19')](_0x5a9ad6[_0x7c9b('0x1a')],{'raw':_0x5a9ad6[_0x7c9b('0x1b')]?_0x5a9ad6[_0x7c9b('0x1b')][_0x7c9b('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x4d9a34){logger['info'](_0x7c9b('0x1d'),_0x5a9ad6);logger[_0x7c9b('0x1e')]('CreateVoiceAgentReport',_0x5a9ad6,JSON[_0x7c9b('0x11')](_0x4d9a34));_0x366b39(_0x4d9a34);})[_0x7c9b('0x17')](function(_0x12ee93){logger[_0x7c9b('0x12')](_0x7c9b('0x1d'),_0x12ee93['message'],_0x5a9ad6);_0x5e9c2e(_0x50bed0['error'](0x1f4,_0x12ee93[_0x7c9b('0x14')]));});});};exports[_0x7c9b('0x1f')]=function(_0x4d5a35){var _0x546cc3=this;return new Promise(function(_0x338d37,_0x4053bb){return db['VoiceAgentReport'][_0x7c9b('0x20')](_0x4d5a35[_0x7c9b('0x1a')],{'raw':_0x4d5a35['options']?_0x4d5a35[_0x7c9b('0x1b')][_0x7c9b('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d5a35[_0x7c9b('0x1b')]?_0x4d5a35[_0x7c9b('0x1b')][_0x7c9b('0x21')]||null:null,'attributes':_0x4d5a35[_0x7c9b('0x1b')]?_0x4d5a35[_0x7c9b('0x1b')]['attributes']||null:null,'limit':_0x4d5a35['options']?_0x4d5a35[_0x7c9b('0x1b')][_0x7c9b('0x22')]||null:null})['then'](function(_0x465e4a){logger[_0x7c9b('0xe')]('UpdateVoiceAgentReport',_0x4d5a35);logger[_0x7c9b('0x1e')](_0x7c9b('0x1f'),_0x4d5a35,JSON[_0x7c9b('0x11')](_0x465e4a));_0x338d37(_0x465e4a);})[_0x7c9b('0x17')](function(_0xaf4e8){logger[_0x7c9b('0x12')](_0x7c9b('0x1f'),_0xaf4e8['message'],_0x4d5a35);_0x4053bb(_0x546cc3[_0x7c9b('0x12')](0x1f4,_0xaf4e8[_0x7c9b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index c96f676..4a9c663 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 _0x4b84=['update','delete','destroy','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/describe','describe','isAuthenticated','show','post','create','put','/:id'];(function(_0x438e18,_0x52e2c5){var _0x50c6ea=function(_0x7ae358){while(--_0x7ae358){_0x438e18['push'](_0x438e18['shift']());}};_0x50c6ea(++_0x52e2c5);}(_0x4b84,0x1cc));var _0x44b8=function(_0x1c6089,_0x3816e2){_0x1c6089=_0x1c6089-0x0;var _0x4d97c1=_0x4b84[_0x1c6089];return _0x4d97c1;};'use strict';var multer=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x44b8('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x44b8('0x3'));var interaction=require(_0x44b8('0x4'));var config=require(_0x44b8('0x5'));var controller=require('./voiceCallReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x44b8('0x6')]);router['get'](_0x44b8('0x7'),auth['isAuthenticated'](),controller[_0x44b8('0x8')]);router['get']('/:id',auth[_0x44b8('0x9')](),controller[_0x44b8('0xa')]);router[_0x44b8('0xb')]('/',auth['isAuthenticated'](),controller[_0x44b8('0xc')]);router[_0x44b8('0xd')](_0x44b8('0xe'),auth[_0x44b8('0x9')](),controller[_0x44b8('0xf')]);router[_0x44b8('0x10')](_0x44b8('0xe'),auth['isAuthenticated'](),controller[_0x44b8('0x11')]);module[_0x44b8('0x12')]=router; \ No newline at end of file +var _0x723e=['delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','put'];(function(_0x44e845,_0x17e1ba){var _0x1a1b94=function(_0x206f1c){while(--_0x206f1c){_0x44e845['push'](_0x44e845['shift']());}};_0x1a1b94(++_0x17e1ba);}(_0x723e,0x179));var _0xe723=function(_0x3e469e,_0x334923){_0x3e469e=_0x3e469e-0x0;var _0x33d855=_0x723e[_0x3e469e];return _0x33d855;};'use strict';var multer=require('multer');var util=require(_0xe723('0x0'));var path=require(_0xe723('0x1'));var timeout=require(_0xe723('0x2'));var express=require(_0xe723('0x3'));var router=express[_0xe723('0x4')]();var fs_extra=require(_0xe723('0x5'));var auth=require(_0xe723('0x6'));var interaction=require(_0xe723('0x7'));var config=require(_0xe723('0x8'));var controller=require(_0xe723('0x9'));router['get']('/',auth[_0xe723('0xa')](),controller[_0xe723('0xb')]);router[_0xe723('0xc')](_0xe723('0xd'),auth[_0xe723('0xa')](),controller[_0xe723('0xe')]);router[_0xe723('0xc')](_0xe723('0xf'),auth['isAuthenticated'](),controller[_0xe723('0x10')]);router[_0xe723('0x11')]('/',auth[_0xe723('0xa')](),controller['create']);router[_0xe723('0x12')](_0xe723('0xf'),auth[_0xe723('0xa')](),controller['update']);router[_0xe723('0x13')](_0xe723('0xf'),auth[_0xe723('0xa')](),controller[_0xe723('0x14')]);module[_0xe723('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 955648c..731a64b 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 _0x4cd3=['DATE','INTEGER','sequelize','exports','outbound','inbound-fax','STRING','TEXT'];(function(_0x384d39,_0xf060fc){var _0x13bf22=function(_0x5d83f2){while(--_0x5d83f2){_0x384d39['push'](_0x384d39['shift']());}};_0x13bf22(++_0xf060fc);}(_0x4cd3,0x1ca));var _0x34cd=function(_0x1e7701,_0x13fd0f){_0x1e7701=_0x1e7701-0x0;var _0x3ab707=_0x4cd3[_0x1e7701];return _0x3ab707;};'use strict';var Sequelize=require(_0x34cd('0x0'));module[_0x34cd('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM']('inbound','internal',_0x34cd('0x2'),_0x34cd('0x3'),'outbound-fax','dialer')},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x34cd('0x4')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x34cd('0x4')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x34cd('0x4')]},'lastapplication':{'type':Sequelize[_0x34cd('0x4')]},'lastdata':{'type':Sequelize[_0x34cd('0x5')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x34cd('0x6')]},'answertime':{'type':Sequelize[_0x34cd('0x6')]},'endtime':{'type':Sequelize[_0x34cd('0x6')]},'duration':{'type':Sequelize[_0x34cd('0x7')]},'billableseconds':{'type':Sequelize[_0x34cd('0x7')]},'mohtime':{'type':Sequelize[_0x34cd('0x7')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x34cd('0x4')]},'amaflags':{'type':Sequelize[_0x34cd('0x4')]},'userfield':{'type':Sequelize[_0x34cd('0x4')]},'userDisposition':{'type':Sequelize[_0x34cd('0x4')]},'userSecondDisposition':{'type':Sequelize[_0x34cd('0x4')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x34cd('0x4')]},'prefix':{'type':Sequelize[_0x34cd('0x4')]},'routeid':{'type':Sequelize[_0x34cd('0x7')]},'sipcallid':{'type':Sequelize[_0x34cd('0x4')]}}; \ No newline at end of file +var _0x0bf7=['sequelize','STRING','ENUM','inbound','internal','outbound','inbound-fax','dialer','TEXT','DATE','INTEGER'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x0bf7,0x14a));var _0x70bf=function(_0x296882,_0x49e256){_0x296882=_0x296882-0x0;var _0x19d716=_0x0bf7[_0x296882];return _0x19d716;};'use strict';var Sequelize=require(_0x70bf('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x70bf('0x1')]},'type':{'type':Sequelize[_0x70bf('0x2')](_0x70bf('0x3'),_0x70bf('0x4'),_0x70bf('0x5'),_0x70bf('0x6'),'outbound-fax',_0x70bf('0x7'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x70bf('0x1')]},'destinationcontext':{'type':Sequelize[_0x70bf('0x1')]},'callerid':{'type':Sequelize[_0x70bf('0x1')]},'channel':{'type':Sequelize[_0x70bf('0x1')]},'destinationchannel':{'type':Sequelize[_0x70bf('0x1')]},'lastapplication':{'type':Sequelize[_0x70bf('0x1')]},'lastdata':{'type':Sequelize[_0x70bf('0x8')]},'starttime':{'type':Sequelize[_0x70bf('0x9')]},'systemanswertime':{'type':Sequelize[_0x70bf('0x9')]},'answertime':{'type':Sequelize[_0x70bf('0x9')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x70bf('0xa')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x70bf('0x1')]},'amaflags':{'type':Sequelize[_0x70bf('0x1')]},'userfield':{'type':Sequelize[_0x70bf('0x1')]},'userDisposition':{'type':Sequelize[_0x70bf('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x70bf('0x1')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x70bf('0x1')]},'prefix':{'type':Sequelize[_0x70bf('0x1')]},'routeid':{'type':Sequelize[_0x70bf('0xa')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 8ae4075..34746c0 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(_0xf2628e,_0x521bf7){var _0x13863a=function(_0x2b04ab){while(--_0x2b04ab){_0xf2628e['push'](_0xf2628e['shift']());}};_0x13863a(++_0x521bf7);}(_0x2ef3,0xba));var _0x32ef=function(_0x3bcdc8,_0x2b7d8c){_0x3bcdc8=_0x3bcdc8-0x0;var _0x5bb5d2=_0x2ef3[_0x3bcdc8];return _0x5bb5d2;};'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 _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(_0x6e1239,_0x3562ac){var _0x418150=function(_0x279f06){while(--_0x279f06){_0x6e1239['push'](_0x6e1239['shift']());}};_0x418150(++_0x3562ac);}(_0x2ef3,0xba));var _0x32ef=function(_0x39a087,_0x4a0e43){_0x39a087=_0x39a087-0x0;var _0x28c1aa=_0x2ef3[_0x39a087];return _0x28c1aa;};'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 diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 0063994..c08a356 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 _0xc069=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xc069,0x1cd));var _0x9c06=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc069[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x9c06('0x0'));var util=require(_0x9c06('0x1'));var logger=require(_0x9c06('0x2'))('api');var moment=require(_0x9c06('0x3'));var BPromise=require(_0x9c06('0x4'));var rp=require(_0x9c06('0x5'));var fs=require('fs');var path=require(_0x9c06('0x6'));var rimraf=require(_0x9c06('0x7'));var config=require(_0x9c06('0x8'));var attributes=require(_0x9c06('0x9'));module[_0x9c06('0xa')]=function(_0xf640c9,_0x41c32e){return _0xf640c9[_0x9c06('0xb')](_0x9c06('0xc'),attributes,{'tableName':_0x9c06('0xd'),'paranoid':![],'indexes':[{'fields':[_0x9c06('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x435f=['exports','define','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x41e519,_0x1ba4e5){var _0x5ab9bd=function(_0x37cccf){while(--_0x37cccf){_0x41e519['push'](_0x41e519['shift']());}};_0x5ab9bd(++_0x1ba4e5);}(_0x435f,0x14a));var _0xf435=function(_0x12de53,_0x110352){_0x12de53=_0x12de53-0x0;var _0x214a96=_0x435f[_0x12de53];return _0x214a96;};'use strict';var _=require(_0xf435('0x0'));var util=require(_0xf435('0x1'));var logger=require(_0xf435('0x2'))(_0xf435('0x3'));var moment=require('moment');var BPromise=require(_0xf435('0x4'));var rp=require(_0xf435('0x5'));var fs=require('fs');var path=require(_0xf435('0x6'));var rimraf=require(_0xf435('0x7'));var config=require('../../config/environment');var attributes=require('./voiceCallReport.attributes');module[_0xf435('0x8')]=function(_0x566249,_0x467bb0){return _0x566249[_0xf435('0x9')](_0xf435('0xa'),attributes,{'tableName':_0xf435('0xb'),'paranoid':![],'indexes':[{'fields':[_0xf435('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 927c8a3..cbc4f8f 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 _0xd494=['result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','map','include','model','then','CreateVoiceCallReport','body','UpdateVoiceCallReport','update','stringify','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','error','message','info'];(function(_0x1e4146,_0x48d1bf){var _0x3f7956=function(_0x1061b8){while(--_0x1061b8){_0x1e4146['push'](_0x1e4146['shift']());}};_0x3f7956(++_0x48d1bf);}(_0xd494,0xdf));var _0x4d49=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd494[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0x4d49('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4d49('0x1'));var fs=require('fs');var Redis=require(_0x4d49('0x2'));var db=require(_0x4d49('0x3'))['db'];var utils=require(_0x4d49('0x4'));var logger=require(_0x4d49('0x5'))(_0x4d49('0x6'));var config=require('../../config/environment');var jayson=require(_0x4d49('0x7'));var client=jayson[_0x4d49('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44e8a4,_0x64299a,_0x15cbcf){return new BPromise(function(_0xe42051,_0x9bc2c6){return client['request'](_0x44e8a4,_0x15cbcf)['then'](function(_0x58947e){logger['info'](_0x4d49('0x9'),_0x64299a,_0x4d49('0xa'));logger[_0x4d49('0xb')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x64299a,_0x4d49('0xa'),JSON['stringify'](_0x58947e));if(_0x58947e[_0x4d49('0xc')]){if(_0x58947e[_0x4d49('0xc')]['code']===0x1f4){logger[_0x4d49('0xc')](_0x4d49('0x9'),_0x64299a,_0x58947e[_0x4d49('0xc')][_0x4d49('0xd')]);return _0x9bc2c6(_0x58947e[_0x4d49('0xc')]['message']);}logger[_0x4d49('0xc')]('VoiceCallReport,\x20%s,\x20%s',_0x64299a,_0x58947e[_0x4d49('0xc')]['message']);return _0xe42051(_0x58947e[_0x4d49('0xc')][_0x4d49('0xd')]);}else{logger[_0x4d49('0xe')]('VoiceCallReport,\x20%s,\x20%s',_0x64299a,_0x4d49('0xa'));_0xe42051(_0x58947e[_0x4d49('0xf')][_0x4d49('0xd')]);}})[_0x4d49('0x10')](function(_0x3f7358){logger[_0x4d49('0xc')](_0x4d49('0x9'),_0x64299a,_0x3f7358);_0x9bc2c6(_0x3f7358);});});}exports[_0x4d49('0x11')]=function(_0xebbb6d){var _0x45f44a=this;return new Promise(function(_0x30d3e1,_0x14b734){return db[_0x4d49('0x12')][_0x4d49('0x13')]({'raw':_0xebbb6d[_0x4d49('0x14')]?_0xebbb6d['options'][_0x4d49('0x15')]===undefined?!![]:![]:!![],'where':_0xebbb6d[_0x4d49('0x14')]?_0xebbb6d[_0x4d49('0x14')][_0x4d49('0x16')]||null:null,'attributes':_0xebbb6d[_0x4d49('0x14')]?_0xebbb6d[_0x4d49('0x14')][_0x4d49('0x17')]||null:null,'limit':_0xebbb6d[_0x4d49('0x14')]?_0xebbb6d[_0x4d49('0x14')][_0x4d49('0x18')]||null:null,'include':_0xebbb6d[_0x4d49('0x14')]?_0xebbb6d[_0x4d49('0x14')]['include']?_[_0x4d49('0x19')](_0xebbb6d['options'][_0x4d49('0x1a')],function(_0x26a351){return{'model':db[_0x26a351[_0x4d49('0x1b')]],'as':_0x26a351['as'],'attributes':_0x26a351[_0x4d49('0x17')],'include':_0x26a351[_0x4d49('0x1a')]?_[_0x4d49('0x19')](_0x26a351[_0x4d49('0x1a')],function(_0x272b73){return{'model':db[_0x272b73[_0x4d49('0x1b')]],'as':_0x272b73['as'],'attributes':_0x272b73[_0x4d49('0x17')],'include':_0x272b73['include']?_[_0x4d49('0x19')](_0x272b73[_0x4d49('0x1a')],function(_0x3573e9){return{'model':db[_0x3573e9['model']],'as':_0x3573e9['as'],'attributes':_0x3573e9['attributes']};}):[]};}):[]};}):[]:[]})[_0x4d49('0x1c')](function(_0x21c3b9){logger[_0x4d49('0xe')]('GetVoiceCallReport',_0xebbb6d);logger['debug'](_0x4d49('0x11'),_0xebbb6d,JSON['stringify'](_0x21c3b9));_0x30d3e1(_0x21c3b9);})['catch'](function(_0x57d3d1){logger[_0x4d49('0xc')](_0x4d49('0x11'),_0x57d3d1['message'],_0xebbb6d);_0x14b734(_0x45f44a[_0x4d49('0xc')](0x1f4,_0x57d3d1[_0x4d49('0xd')]));});});};exports[_0x4d49('0x1d')]=function(_0xab83cd){var _0x90b71b=this;return new Promise(function(_0xbe6a63,_0x3d6eb0){return db[_0x4d49('0x12')]['create'](_0xab83cd[_0x4d49('0x1e')],{'raw':_0xab83cd['options']?_0xab83cd[_0x4d49('0x14')][_0x4d49('0x15')]===undefined?!![]:![]:!![]})[_0x4d49('0x1c')](function(_0x1dc179){logger['info'](_0x4d49('0x1d'),_0xab83cd);logger[_0x4d49('0xb')](_0x4d49('0x1d'),_0xab83cd,JSON['stringify'](_0x1dc179));_0xbe6a63(_0x1dc179);})['catch'](function(_0x5bb524){logger['error'](_0x4d49('0x1d'),_0x5bb524[_0x4d49('0xd')],_0xab83cd);_0x3d6eb0(_0x90b71b['error'](0x1f4,_0x5bb524[_0x4d49('0xd')]));});});};exports[_0x4d49('0x1f')]=function(_0x53fce1){var _0x2cf593=this;return new Promise(function(_0x4161b1,_0x1111e9){return db['VoiceCallReport'][_0x4d49('0x20')](_0x53fce1['body'],{'raw':_0x53fce1['options']?_0x53fce1[_0x4d49('0x14')][_0x4d49('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53fce1[_0x4d49('0x14')]?_0x53fce1[_0x4d49('0x14')]['where']||null:null,'attributes':_0x53fce1[_0x4d49('0x14')]?_0x53fce1['options'][_0x4d49('0x17')]||null:null,'limit':_0x53fce1['options']?_0x53fce1[_0x4d49('0x14')][_0x4d49('0x18')]||null:null})[_0x4d49('0x1c')](function(_0x5f12d0){logger[_0x4d49('0xe')](_0x4d49('0x1f'),_0x53fce1);logger['debug']('UpdateVoiceCallReport',_0x53fce1,JSON[_0x4d49('0x21')](_0x5f12d0));_0x4161b1(_0x5f12d0);})[_0x4d49('0x10')](function(_0x32eed1){logger['error']('UpdateVoiceCallReport',_0x32eed1[_0x4d49('0xd')],_0x53fce1);_0x1111e9(_0x2cf593[_0x4d49('0xc')](0x1f4,_0x32eed1['message']));});});}; \ No newline at end of file +var _0x2e9b=['error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','options','raw','where','limit','include','model','attributes','stringify','create','body','CreateVoiceCallReport','UpdateVoiceCallReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s'];(function(_0xdf1572,_0xd3be30){var _0x2e4890=function(_0x3c2059){while(--_0x3c2059){_0xdf1572['push'](_0xdf1572['shift']());}};_0x2e4890(++_0xd3be30);}(_0x2e9b,0x1a4));var _0xb2e9=function(_0x56370f,_0x1d5b0d){_0x56370f=_0x56370f-0x0;var _0x5ab283=_0x2e9b[_0x56370f];return _0x5ab283;};'use strict';var _=require(_0xb2e9('0x0'));var util=require(_0xb2e9('0x1'));var moment=require(_0xb2e9('0x2'));var BPromise=require(_0xb2e9('0x3'));var rs=require(_0xb2e9('0x4'));var fs=require('fs');var Redis=require(_0xb2e9('0x5'));var db=require(_0xb2e9('0x6'))['db'];var utils=require(_0xb2e9('0x7'));var logger=require(_0xb2e9('0x8'))(_0xb2e9('0x9'));var config=require(_0xb2e9('0xa'));var jayson=require(_0xb2e9('0xb'));var client=jayson[_0xb2e9('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x541ce6,_0x44a46b,_0x510880){return new BPromise(function(_0x53db6d,_0x3583dc){return client[_0xb2e9('0xd')](_0x541ce6,_0x510880)[_0xb2e9('0xe')](function(_0x550df7){logger[_0xb2e9('0xf')](_0xb2e9('0x10'),_0x44a46b,_0xb2e9('0x11'));logger[_0xb2e9('0x12')](_0xb2e9('0x13'),_0x44a46b,_0xb2e9('0x11'),JSON['stringify'](_0x550df7));if(_0x550df7[_0xb2e9('0x14')]){if(_0x550df7['error'][_0xb2e9('0x15')]===0x1f4){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x44a46b,_0x550df7[_0xb2e9('0x14')]['message']);return _0x3583dc(_0x550df7[_0xb2e9('0x14')][_0xb2e9('0x16')]);}logger[_0xb2e9('0x14')](_0xb2e9('0x10'),_0x44a46b,_0x550df7[_0xb2e9('0x14')][_0xb2e9('0x16')]);return _0x53db6d(_0x550df7[_0xb2e9('0x14')][_0xb2e9('0x16')]);}else{logger[_0xb2e9('0xf')](_0xb2e9('0x10'),_0x44a46b,'request\x20sent');_0x53db6d(_0x550df7[_0xb2e9('0x17')][_0xb2e9('0x16')]);}})[_0xb2e9('0x18')](function(_0x5e6fa6){logger['error'](_0xb2e9('0x10'),_0x44a46b,_0x5e6fa6);_0x3583dc(_0x5e6fa6);});});}exports[_0xb2e9('0x19')]=function(_0x44d69e){var _0x34a2eb=this;return new Promise(function(_0x1a076d,_0x4ee9c4){return db[_0xb2e9('0x1a')]['findAll']({'raw':_0x44d69e['options']?_0x44d69e[_0xb2e9('0x1b')][_0xb2e9('0x1c')]===undefined?!![]:![]:!![],'where':_0x44d69e['options']?_0x44d69e['options'][_0xb2e9('0x1d')]||null:null,'attributes':_0x44d69e[_0xb2e9('0x1b')]?_0x44d69e[_0xb2e9('0x1b')]['attributes']||null:null,'limit':_0x44d69e[_0xb2e9('0x1b')]?_0x44d69e[_0xb2e9('0x1b')][_0xb2e9('0x1e')]||null:null,'include':_0x44d69e[_0xb2e9('0x1b')]?_0x44d69e['options'][_0xb2e9('0x1f')]?_['map'](_0x44d69e[_0xb2e9('0x1b')][_0xb2e9('0x1f')],function(_0x35321d){return{'model':db[_0x35321d[_0xb2e9('0x20')]],'as':_0x35321d['as'],'attributes':_0x35321d[_0xb2e9('0x21')],'include':_0x35321d['include']?_['map'](_0x35321d[_0xb2e9('0x1f')],function(_0x4b2686){return{'model':db[_0x4b2686[_0xb2e9('0x20')]],'as':_0x4b2686['as'],'attributes':_0x4b2686[_0xb2e9('0x21')],'include':_0x4b2686[_0xb2e9('0x1f')]?_['map'](_0x4b2686[_0xb2e9('0x1f')],function(_0x55e159){return{'model':db[_0x55e159[_0xb2e9('0x20')]],'as':_0x55e159['as'],'attributes':_0x55e159[_0xb2e9('0x21')]};}):[]};}):[]};}):[]:[]})[_0xb2e9('0xe')](function(_0x396142){logger[_0xb2e9('0xf')]('GetVoiceCallReport',_0x44d69e);logger[_0xb2e9('0x12')]('GetVoiceCallReport',_0x44d69e,JSON[_0xb2e9('0x22')](_0x396142));_0x1a076d(_0x396142);})[_0xb2e9('0x18')](function(_0x4bf481){logger[_0xb2e9('0x14')](_0xb2e9('0x19'),_0x4bf481[_0xb2e9('0x16')],_0x44d69e);_0x4ee9c4(_0x34a2eb[_0xb2e9('0x14')](0x1f4,_0x4bf481['message']));});});};exports['CreateVoiceCallReport']=function(_0x4eb908){var _0x3607d1=this;return new Promise(function(_0x45e3c0,_0x2d7cf5){return db[_0xb2e9('0x1a')][_0xb2e9('0x23')](_0x4eb908[_0xb2e9('0x24')],{'raw':_0x4eb908['options']?_0x4eb908[_0xb2e9('0x1b')][_0xb2e9('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x2e3eab){logger[_0xb2e9('0xf')](_0xb2e9('0x25'),_0x4eb908);logger['debug'](_0xb2e9('0x25'),_0x4eb908,JSON[_0xb2e9('0x22')](_0x2e3eab));_0x45e3c0(_0x2e3eab);})[_0xb2e9('0x18')](function(_0x35739a){logger[_0xb2e9('0x14')]('CreateVoiceCallReport',_0x35739a[_0xb2e9('0x16')],_0x4eb908);_0x2d7cf5(_0x3607d1[_0xb2e9('0x14')](0x1f4,_0x35739a[_0xb2e9('0x16')]));});});};exports[_0xb2e9('0x26')]=function(_0x233954){var _0x2e5973=this;return new Promise(function(_0x5c9586,_0x4df4b3){return db[_0xb2e9('0x1a')][_0xb2e9('0x27')](_0x233954['body'],{'raw':_0x233954[_0xb2e9('0x1b')]?_0x233954[_0xb2e9('0x1b')][_0xb2e9('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x233954[_0xb2e9('0x1b')]?_0x233954[_0xb2e9('0x1b')][_0xb2e9('0x1d')]||null:null,'attributes':_0x233954['options']?_0x233954[_0xb2e9('0x1b')][_0xb2e9('0x21')]||null:null,'limit':_0x233954['options']?_0x233954['options'][_0xb2e9('0x1e')]||null:null})[_0xb2e9('0xe')](function(_0x76501){logger[_0xb2e9('0xf')](_0xb2e9('0x26'),_0x233954);logger[_0xb2e9('0x12')]('UpdateVoiceCallReport',_0x233954,JSON[_0xb2e9('0x22')](_0x76501));_0x5c9586(_0x76501);})[_0xb2e9('0x18')](function(_0x15db91){logger[_0xb2e9('0x14')](_0xb2e9('0x26'),_0x15db91[_0xb2e9('0x16')],_0x233954);_0x4df4b3(_0x2e5973[_0xb2e9('0x14')](0x1f4,_0x15db91[_0xb2e9('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 1ae1ae5..9a1a09f 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 _0x18d5=['/:id','show','create','put','update','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','isAuthenticated','index','get'];(function(_0x3b547c,_0x261444){var _0x27b773=function(_0x3f607f){while(--_0x3f607f){_0x3b547c['push'](_0x3b547c['shift']());}};_0x27b773(++_0x261444);}(_0x18d5,0xe5));var _0x518d=function(_0x104d64,_0x379875){_0x104d64=_0x104d64-0x0;var _0xb210e0=_0x18d5[_0x104d64];return _0xb210e0;};'use strict';var multer=require(_0x518d('0x0'));var util=require(_0x518d('0x1'));var path=require(_0x518d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x518d('0x3'));var auth=require(_0x518d('0x4'));var interaction=require(_0x518d('0x5'));var config=require(_0x518d('0x6'));var controller=require(_0x518d('0x7'));router['get']('/',auth[_0x518d('0x8')](),controller[_0x518d('0x9')]);router[_0x518d('0xa')](_0x518d('0xb'),auth[_0x518d('0x8')](),controller[_0x518d('0xc')]);router['post']('/',auth[_0x518d('0x8')](),controller[_0x518d('0xd')]);router[_0x518d('0xe')](_0x518d('0xb'),auth['isAuthenticated'](),controller[_0x518d('0xf')]);router['delete'](_0x518d('0xb'),auth[_0x518d('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2a69=['delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceChanSpy.controller','isAuthenticated','get','/:id','show','create','put'];(function(_0x242bbe,_0x4df8c6){var _0x3e3286=function(_0x1f4e92){while(--_0x1f4e92){_0x242bbe['push'](_0x242bbe['shift']());}};_0x3e3286(++_0x4df8c6);}(_0x2a69,0x159));var _0x92a6=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x2a69[_0x46e363];return _0x3fb059;};'use strict';var multer=require(_0x92a6('0x0'));var util=require(_0x92a6('0x1'));var path=require('path');var timeout=require(_0x92a6('0x2'));var express=require(_0x92a6('0x3'));var router=express[_0x92a6('0x4')]();var fs_extra=require(_0x92a6('0x5'));var auth=require(_0x92a6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x92a6('0x7'));var controller=require(_0x92a6('0x8'));router['get']('/',auth[_0x92a6('0x9')](),controller['index']);router[_0x92a6('0xa')](_0x92a6('0xb'),auth['isAuthenticated'](),controller[_0x92a6('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x92a6('0xd')]);router[_0x92a6('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x92a6('0xf')](_0x92a6('0xb'),auth['isAuthenticated'](),controller[_0x92a6('0x10')]);module[_0x92a6('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 4ef43be..b9a343b 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 _0x1da2=['setDataValue','options','join','getDataValue','split','BOOLEAN','exports','STRING','name'];(function(_0x48e5cd,_0x46acc0){var _0x559f41=function(_0x284af1){while(--_0x284af1){_0x48e5cd['push'](_0x48e5cd['shift']());}};_0x559f41(++_0x46acc0);}(_0x1da2,0x141));var _0x21da=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x1da2[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require('sequelize');module[_0x21da('0x0')]={'name':{'type':Sequelize[_0x21da('0x1')]},'prefix':{'type':Sequelize[_0x21da('0x1')],'unique':_0x21da('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x21da('0x1')],'set':function(_0x1766a1){this[_0x21da('0x3')](_0x21da('0x4'),_0x1766a1?_0x1766a1[_0x21da('0x5')](''):[]);},'get':function(){return this[_0x21da('0x6')](_0x21da('0x4'))?this[_0x21da('0x6')]('options')[_0x21da('0x7')](''):[];}},'auth':{'type':Sequelize[_0x21da('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x21da('0x1')]},'record':{'type':Sequelize[_0x21da('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcf24=['STRING','name','setDataValue','options','join','getDataValue','exports'];(function(_0x3e429d,_0x125d0d){var _0x167cf1=function(_0x44d496){while(--_0x44d496){_0x3e429d['push'](_0x3e429d['shift']());}};_0x167cf1(++_0x125d0d);}(_0xcf24,0x195));var _0x4cf2=function(_0x4efae9,_0x52ec8e){_0x4efae9=_0x4efae9-0x0;var _0x110d8d=_0xcf24[_0x4efae9];return _0x110d8d;};'use strict';var Sequelize=require('sequelize');module[_0x4cf2('0x0')]={'name':{'type':Sequelize[_0x4cf2('0x1')]},'prefix':{'type':Sequelize[_0x4cf2('0x1')],'unique':_0x4cf2('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x4cf2('0x1')],'set':function(_0x2c4649){this[_0x4cf2('0x3')](_0x4cf2('0x4'),_0x2c4649?_0x2c4649[_0x4cf2('0x5')](''):[]);},'get':function(){return this[_0x4cf2('0x6')]('options')?this[_0x4cf2('0x6')](_0x4cf2('0x4'))['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x4cf2('0x1')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4cf2('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 8a8e9b1..77d77c8 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 _0xf021=['autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','offset','limit','reject','save','update','then','ChanSpies','end','error','stack','send','index','map','rawAttributes','fieldName','type','key','model','name','query','filters','attributes','fields','length','hasOwnProperty','order','sort','where','merge','filter','options','VoiceChanSpy','count','includeAll','include','rows','catch','show','intersection','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xf021,0x18f));var _0x1f02=function(_0xfd9b19,_0x21d75f){_0xfd9b19=_0xfd9b19-0x0;var _0x514918=_0xf021[_0xfd9b19];return _0x514918;};'use strict';var emlformat=require(_0x1f02('0x0'));var rimraf=require(_0x1f02('0x1'));var zipdir=require(_0x1f02('0x2'));var jsonpatch=require(_0x1f02('0x3'));var rp=require(_0x1f02('0x4'));var moment=require('moment');var BPromise=require(_0x1f02('0x5'));var Mustache=require('mustache');var util=require(_0x1f02('0x6'));var path=require(_0x1f02('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1f02('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1f02('0x9'));var squel=require(_0x1f02('0xa'));var crypto=require(_0x1f02('0xb'));var jsforce=require(_0x1f02('0xc'));var deskjs=require(_0x1f02('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1f02('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1f02('0xf'));var as=require(_0x1f02('0x10'));var hardwareService=require(_0x1f02('0x11'));var logger=require(_0x1f02('0x12'))(_0x1f02('0x13'));var utils=require('../../config/utils');var config=require(_0x1f02('0x14'));var licenseUtil=require(_0x1f02('0x15'));var db=require(_0x1f02('0x16'))['db'];function respondWithStatusCode(_0x56a2c2,_0x24e9b8){_0x24e9b8=_0x24e9b8||0xcc;return function(_0x1ac6eb){if(_0x1ac6eb){return _0x56a2c2[_0x1f02('0x17')](_0x24e9b8);}return _0x56a2c2['status'](_0x24e9b8)['end']();};}function respondWithResult(_0x4974bd,_0x11ba7e){_0x11ba7e=_0x11ba7e||0xc8;return function(_0x2c08ad){if(_0x2c08ad){return _0x4974bd[_0x1f02('0x18')](_0x11ba7e)[_0x1f02('0x19')](_0x2c08ad);}};}function respondWithFilteredResult(_0x1c16ce,_0x45bae1){return function(_0x440328){if(_0x440328){var _0x3b0a3d=typeof _0x45bae1['offset']===_0x1f02('0x1a')&&typeof _0x45bae1['limit']==='undefined';var _0x4a66a5=_0x440328['count'];var _0x4d1e4f=_0x3b0a3d?0x0:_0x45bae1[_0x1f02('0x1b')];var _0x3033a2=_0x3b0a3d?_0x440328['count']:_0x45bae1[_0x1f02('0x1b')]+_0x45bae1[_0x1f02('0x1c')];var _0x356444;if(_0x3033a2>=_0x4a66a5){_0x3033a2=_0x4a66a5;_0x356444=0xc8;}else{_0x356444=0xce;}_0x1c16ce[_0x1f02('0x18')](_0x356444);return _0x1c16ce['set']('Content-Range',_0x4d1e4f+'-'+_0x3033a2+'/'+_0x4a66a5)[_0x1f02('0x19')](_0x440328);}return null;};}function patchUpdates(_0x37393a){return function(_0x5e78c2){try{jsonpatch['apply'](_0x5e78c2,_0x37393a,!![]);}catch(_0x339c29){return BPromise[_0x1f02('0x1d')](_0x339c29);}return _0x5e78c2[_0x1f02('0x1e')]();};}function saveUpdates(_0xbabbd7,_0x480297){return function(_0x12c4af){if(_0x12c4af){return _0x12c4af[_0x1f02('0x1f')](_0xbabbd7)[_0x1f02('0x20')](function(_0x2f422c){return _0x2f422c;});}return null;};}function removeEntity(_0x43b3e7,_0x134398){return function(_0x1328ea){if(_0x1328ea){return _0x1328ea['destroy']()[_0x1f02('0x20')](function(){var _0x3a8c57=_0x1328ea['get']({'plain':!![]});var _0x25a8d1=_0x1f02('0x21');return db['UserProfileResource']['destroy']({'where':{'type':_0x25a8d1,'resourceId':_0x3a8c57['id']}})[_0x1f02('0x20')](function(){return _0x1328ea;});})[_0x1f02('0x20')](function(){_0x43b3e7[_0x1f02('0x18')](0xcc)[_0x1f02('0x22')]();});}};}function handleEntityNotFound(_0x3f5c5e,_0x3f5577){return function(_0x297cf4){if(!_0x297cf4){_0x3f5c5e['sendStatus'](0x194);}return _0x297cf4;};}function handleError(_0x4d5f7e,_0x4e04f2){_0x4e04f2=_0x4e04f2||0x1f4;return function(_0x3ef4bf){logger[_0x1f02('0x23')](_0x3ef4bf[_0x1f02('0x24')]);if(_0x3ef4bf['name']){delete _0x3ef4bf['name'];}_0x4d5f7e[_0x1f02('0x18')](_0x4e04f2)[_0x1f02('0x25')](_0x3ef4bf);};}exports[_0x1f02('0x26')]=function(_0x433a1e,_0x220345){var _0x3080a6={},_0x442333={},_0x23fa22={'count':0x0,'rows':[]};var _0x1c2a0d=_[_0x1f02('0x27')](db['VoiceChanSpy'][_0x1f02('0x28')],function(_0x5ab7a2){return{'name':_0x5ab7a2[_0x1f02('0x29')],'type':_0x5ab7a2[_0x1f02('0x2a')][_0x1f02('0x2b')]};});_0x442333[_0x1f02('0x2c')]=_[_0x1f02('0x27')](_0x1c2a0d,_0x1f02('0x2d'));_0x442333['query']=_['keys'](_0x433a1e[_0x1f02('0x2e')]);_0x442333[_0x1f02('0x2f')]=_['intersection'](_0x442333[_0x1f02('0x2c')],_0x442333['query']);_0x3080a6[_0x1f02('0x30')]=_['intersection'](_0x442333[_0x1f02('0x2c')],qs['fields'](_0x433a1e['query'][_0x1f02('0x31')]));_0x3080a6[_0x1f02('0x30')]=_0x3080a6[_0x1f02('0x30')][_0x1f02('0x32')]?_0x3080a6['attributes']:_0x442333[_0x1f02('0x2c')];if(!_0x433a1e[_0x1f02('0x2e')][_0x1f02('0x33')]('nolimit')){_0x3080a6[_0x1f02('0x1c')]=qs[_0x1f02('0x1c')](_0x433a1e[_0x1f02('0x2e')][_0x1f02('0x1c')]);_0x3080a6[_0x1f02('0x1b')]=qs[_0x1f02('0x1b')](_0x433a1e['query'][_0x1f02('0x1b')]);}_0x3080a6[_0x1f02('0x34')]=qs[_0x1f02('0x35')](_0x433a1e['query'][_0x1f02('0x35')]);_0x3080a6['where']=qs[_0x1f02('0x2f')](_['pick'](_0x433a1e['query'],_0x442333[_0x1f02('0x2f')]),_0x1c2a0d);if(_0x433a1e['query']['filter']){_0x3080a6[_0x1f02('0x36')]=_[_0x1f02('0x37')](_0x3080a6[_0x1f02('0x36')],{'$or':_[_0x1f02('0x27')](_0x1c2a0d,function(_0x47ee27){if(_0x47ee27[_0x1f02('0x2a')]!=='VIRTUAL'){var _0x2cd179={};_0x2cd179[_0x47ee27[_0x1f02('0x2d')]]={'$like':'%'+_0x433a1e[_0x1f02('0x2e')][_0x1f02('0x38')]+'%'};return _0x2cd179;}})});}_0x3080a6=_[_0x1f02('0x37')]({},_0x3080a6,_0x433a1e[_0x1f02('0x39')]);var _0xb4fac5={'where':_0x3080a6[_0x1f02('0x36')]};return db[_0x1f02('0x3a')]['count'](_0xb4fac5)[_0x1f02('0x20')](function(_0x5aab10){_0x23fa22[_0x1f02('0x3b')]=_0x5aab10;if(_0x433a1e['query'][_0x1f02('0x3c')]){_0x3080a6[_0x1f02('0x3d')]=[{'all':!![]}];}return db[_0x1f02('0x3a')]['findAll'](_0x3080a6);})['then'](function(_0x1c3f09){_0x23fa22[_0x1f02('0x3e')]=_0x1c3f09;return _0x23fa22;})[_0x1f02('0x20')](respondWithFilteredResult(_0x220345,_0x3080a6))[_0x1f02('0x3f')](handleError(_0x220345,null));};exports[_0x1f02('0x40')]=function(_0x15fb49,_0x23733c){var _0x11f31f={'raw':![],'where':{'id':_0x15fb49['params']['id']}},_0x391b57={};_0x391b57[_0x1f02('0x2c')]=_['keys'](db['VoiceChanSpy'][_0x1f02('0x28')]);_0x391b57['query']=_['keys'](_0x15fb49[_0x1f02('0x2e')]);_0x391b57['filters']=_['intersection'](_0x391b57[_0x1f02('0x2c')],_0x391b57[_0x1f02('0x2e')]);_0x11f31f['attributes']=_[_0x1f02('0x41')](_0x391b57[_0x1f02('0x2c')],qs[_0x1f02('0x31')](_0x15fb49[_0x1f02('0x2e')]['fields']));_0x11f31f[_0x1f02('0x30')]=_0x11f31f[_0x1f02('0x30')][_0x1f02('0x32')]?_0x11f31f[_0x1f02('0x30')]:_0x391b57[_0x1f02('0x2c')];if(_0x15fb49[_0x1f02('0x2e')][_0x1f02('0x3c')]){_0x11f31f[_0x1f02('0x3d')]=[{'all':!![]}];}_0x11f31f=_[_0x1f02('0x37')]({},_0x11f31f,_0x15fb49[_0x1f02('0x39')]);return db[_0x1f02('0x3a')][_0x1f02('0x42')](_0x11f31f)[_0x1f02('0x20')](handleEntityNotFound(_0x23733c,null))[_0x1f02('0x20')](respondWithResult(_0x23733c,null))['catch'](handleError(_0x23733c,null));};exports[_0x1f02('0x43')]=function(_0x50d5ed,_0x37759d){return db['VoiceChanSpy'][_0x1f02('0x43')](_0x50d5ed[_0x1f02('0x44')],{})[_0x1f02('0x20')](function(_0x32dac3){var _0x40bf99=_0x50d5ed[_0x1f02('0x45')][_0x1f02('0x46')]({'plain':!![]});if(!_0x40bf99)throw new Error(_0x1f02('0x47'));if(_0x40bf99[_0x1f02('0x48')]===_0x1f02('0x45')){var _0x1241c5=_0x32dac3['get']({'plain':!![]});var _0x45e71d=_0x1f02('0x21');return db[_0x1f02('0x49')][_0x1f02('0x42')]({'where':{'name':_0x45e71d,'userProfileId':_0x40bf99[_0x1f02('0x4a')]},'raw':!![]})[_0x1f02('0x20')](function(_0x2201b4){if(_0x2201b4&&_0x2201b4[_0x1f02('0x4b')]===0x0){return db[_0x1f02('0x4c')]['create']({'name':_0x1241c5[_0x1f02('0x2d')],'resourceId':_0x1241c5['id'],'type':_0x2201b4[_0x1f02('0x2d')],'sectionId':_0x2201b4['id']},{})[_0x1f02('0x20')](function(){return _0x32dac3;});}else{return _0x32dac3;}})[_0x1f02('0x3f')](function(_0x3cdf8c){logger['error'](_0x1f02('0x4d'),_0x3cdf8c);throw _0x3cdf8c;});}return _0x32dac3;})['then'](respondWithResult(_0x37759d,0xc9))[_0x1f02('0x3f')](handleError(_0x37759d,null));};exports[_0x1f02('0x1f')]=function(_0x2240d1,_0x18d80d){if(_0x2240d1[_0x1f02('0x44')]['id']){delete _0x2240d1[_0x1f02('0x44')]['id'];}return db[_0x1f02('0x3a')][_0x1f02('0x42')]({'where':{'id':_0x2240d1[_0x1f02('0x4e')]['id']}})[_0x1f02('0x20')](handleEntityNotFound(_0x18d80d,null))['then'](saveUpdates(_0x2240d1['body'],null))['then'](respondWithResult(_0x18d80d,null))[_0x1f02('0x3f')](handleError(_0x18d80d,null));};exports['destroy']=function(_0x238911,_0x449d58){return db['VoiceChanSpy'][_0x1f02('0x42')]({'where':{'id':_0x238911['params']['id']}})['then'](handleEntityNotFound(_0x449d58,null))['then'](removeEntity(_0x449d58,null))[_0x1f02('0x3f')](handleError(_0x449d58,null));}; \ No newline at end of file +var _0x5e14=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','ChanSpies','UserProfileResource','sendStatus','stack','name','send','index','VoiceChanSpy','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','merge','where','map','type','VIRTUAL','filter','includeAll','findAll','rows','show','params','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x28b7d6,_0x29a958){var _0x39950e=function(_0x44d299){while(--_0x44d299){_0x28b7d6['push'](_0x28b7d6['shift']());}};_0x39950e(++_0x29a958);}(_0x5e14,0x164));var _0x45e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e14[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x45e1('0x0'));var rimraf=require(_0x45e1('0x1'));var zipdir=require(_0x45e1('0x2'));var jsonpatch=require(_0x45e1('0x3'));var rp=require(_0x45e1('0x4'));var moment=require(_0x45e1('0x5'));var BPromise=require(_0x45e1('0x6'));var Mustache=require(_0x45e1('0x7'));var util=require(_0x45e1('0x8'));var path=require(_0x45e1('0x9'));var sox=require(_0x45e1('0xa'));var csv=require(_0x45e1('0xb'));var ejs=require(_0x45e1('0xc'));var fs=require('fs');var fs_extra=require(_0x45e1('0xd'));var _=require(_0x45e1('0xe'));var squel=require(_0x45e1('0xf'));var crypto=require(_0x45e1('0x10'));var jsforce=require(_0x45e1('0x11'));var deskjs=require(_0x45e1('0x12'));var toCsv=require(_0x45e1('0xb'));var querystring=require(_0x45e1('0x13'));var Papa=require(_0x45e1('0x14'));var Redis=require('ioredis');var authService=require(_0x45e1('0x15'));var qs=require(_0x45e1('0x16'));var as=require(_0x45e1('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x45e1('0x18'))('api');var utils=require(_0x45e1('0x19'));var config=require(_0x45e1('0x1a'));var licenseUtil=require(_0x45e1('0x1b'));var db=require(_0x45e1('0x1c'))['db'];function respondWithStatusCode(_0x3c88b1,_0x2ec2b9){_0x2ec2b9=_0x2ec2b9||0xcc;return function(_0x2ab53e){if(_0x2ab53e){return _0x3c88b1['sendStatus'](_0x2ec2b9);}return _0x3c88b1[_0x45e1('0x1d')](_0x2ec2b9)[_0x45e1('0x1e')]();};}function respondWithResult(_0x473ec6,_0x370297){_0x370297=_0x370297||0xc8;return function(_0x4364a0){if(_0x4364a0){return _0x473ec6[_0x45e1('0x1d')](_0x370297)[_0x45e1('0x1f')](_0x4364a0);}};}function respondWithFilteredResult(_0x4c2344,_0x5d9dba){return function(_0x2de680){if(_0x2de680){var _0x53a90e=typeof _0x5d9dba['offset']==='undefined'&&typeof _0x5d9dba[_0x45e1('0x20')]===_0x45e1('0x21');var _0x4de963=_0x2de680[_0x45e1('0x22')];var _0xa8bbf9=_0x53a90e?0x0:_0x5d9dba[_0x45e1('0x23')];var _0x4aea60=_0x53a90e?_0x2de680[_0x45e1('0x22')]:_0x5d9dba['offset']+_0x5d9dba[_0x45e1('0x20')];var _0x486782;if(_0x4aea60>=_0x4de963){_0x4aea60=_0x4de963;_0x486782=0xc8;}else{_0x486782=0xce;}_0x4c2344[_0x45e1('0x1d')](_0x486782);return _0x4c2344[_0x45e1('0x24')](_0x45e1('0x25'),_0xa8bbf9+'-'+_0x4aea60+'/'+_0x4de963)[_0x45e1('0x1f')](_0x2de680);}return null;};}function patchUpdates(_0x393fdf){return function(_0x4f4884){try{jsonpatch[_0x45e1('0x26')](_0x4f4884,_0x393fdf,!![]);}catch(_0x43cc42){return BPromise[_0x45e1('0x27')](_0x43cc42);}return _0x4f4884[_0x45e1('0x28')]();};}function saveUpdates(_0x3a312b,_0x32ae6b){return function(_0x477b12){if(_0x477b12){return _0x477b12[_0x45e1('0x29')](_0x3a312b)[_0x45e1('0x2a')](function(_0x68a3b){return _0x68a3b;});}return null;};}function removeEntity(_0x2f724b,_0x51fb60){return function(_0x3847dd){if(_0x3847dd){return _0x3847dd[_0x45e1('0x2b')]()[_0x45e1('0x2a')](function(){var _0x2d615a=_0x3847dd[_0x45e1('0x2c')]({'plain':!![]});var _0x103b7a=_0x45e1('0x2d');return db[_0x45e1('0x2e')][_0x45e1('0x2b')]({'where':{'type':_0x103b7a,'resourceId':_0x2d615a['id']}})[_0x45e1('0x2a')](function(){return _0x3847dd;});})[_0x45e1('0x2a')](function(){_0x2f724b[_0x45e1('0x1d')](0xcc)[_0x45e1('0x1e')]();});}};}function handleEntityNotFound(_0x2a3f95,_0x2d2b14){return function(_0x371cf5){if(!_0x371cf5){_0x2a3f95[_0x45e1('0x2f')](0x194);}return _0x371cf5;};}function handleError(_0x8b253,_0x541a9a){_0x541a9a=_0x541a9a||0x1f4;return function(_0x2b6287){logger['error'](_0x2b6287[_0x45e1('0x30')]);if(_0x2b6287[_0x45e1('0x31')]){delete _0x2b6287['name'];}_0x8b253[_0x45e1('0x1d')](_0x541a9a)[_0x45e1('0x32')](_0x2b6287);};}exports[_0x45e1('0x33')]=function(_0x2e5391,_0x1f2069){var _0x290d99={},_0x85a172={},_0x47e77d={'count':0x0,'rows':[]};var _0x2259bc=_['map'](db[_0x45e1('0x34')][_0x45e1('0x35')],function(_0x3df426){return{'name':_0x3df426[_0x45e1('0x36')],'type':_0x3df426['type']['key']};});_0x85a172[_0x45e1('0x37')]=_['map'](_0x2259bc,_0x45e1('0x31'));_0x85a172[_0x45e1('0x38')]=_[_0x45e1('0x39')](_0x2e5391['query']);_0x85a172[_0x45e1('0x3a')]=_[_0x45e1('0x3b')](_0x85a172[_0x45e1('0x37')],_0x85a172[_0x45e1('0x38')]);_0x290d99[_0x45e1('0x3c')]=_['intersection'](_0x85a172[_0x45e1('0x37')],qs[_0x45e1('0x3d')](_0x2e5391[_0x45e1('0x38')]['fields']));_0x290d99['attributes']=_0x290d99[_0x45e1('0x3c')][_0x45e1('0x3e')]?_0x290d99['attributes']:_0x85a172['model'];if(!_0x2e5391[_0x45e1('0x38')][_0x45e1('0x3f')]('nolimit')){_0x290d99[_0x45e1('0x20')]=qs['limit'](_0x2e5391[_0x45e1('0x38')][_0x45e1('0x20')]);_0x290d99[_0x45e1('0x23')]=qs['offset'](_0x2e5391['query'][_0x45e1('0x23')]);}_0x290d99[_0x45e1('0x40')]=qs[_0x45e1('0x41')](_0x2e5391[_0x45e1('0x38')]['sort']);_0x290d99['where']=qs['filters'](_[_0x45e1('0x42')](_0x2e5391[_0x45e1('0x38')],_0x85a172[_0x45e1('0x3a')]),_0x2259bc);if(_0x2e5391['query']['filter']){_0x290d99['where']=_[_0x45e1('0x43')](_0x290d99[_0x45e1('0x44')],{'$or':_[_0x45e1('0x45')](_0x2259bc,function(_0x134210){if(_0x134210[_0x45e1('0x46')]!==_0x45e1('0x47')){var _0x566b6f={};_0x566b6f[_0x134210[_0x45e1('0x31')]]={'$like':'%'+_0x2e5391[_0x45e1('0x38')][_0x45e1('0x48')]+'%'};return _0x566b6f;}})});}_0x290d99=_[_0x45e1('0x43')]({},_0x290d99,_0x2e5391['options']);var _0x3fb463={'where':_0x290d99['where']};return db[_0x45e1('0x34')]['count'](_0x3fb463)[_0x45e1('0x2a')](function(_0x30af52){_0x47e77d[_0x45e1('0x22')]=_0x30af52;if(_0x2e5391[_0x45e1('0x38')][_0x45e1('0x49')]){_0x290d99['include']=[{'all':!![]}];}return db[_0x45e1('0x34')][_0x45e1('0x4a')](_0x290d99);})[_0x45e1('0x2a')](function(_0x46feb6){_0x47e77d[_0x45e1('0x4b')]=_0x46feb6;return _0x47e77d;})[_0x45e1('0x2a')](respondWithFilteredResult(_0x1f2069,_0x290d99))['catch'](handleError(_0x1f2069,null));};exports[_0x45e1('0x4c')]=function(_0x859bb3,_0x5e25f8){var _0x3d14b1={'raw':![],'where':{'id':_0x859bb3[_0x45e1('0x4d')]['id']}},_0x3df715={};_0x3df715[_0x45e1('0x37')]=_[_0x45e1('0x39')](db[_0x45e1('0x34')][_0x45e1('0x35')]);_0x3df715[_0x45e1('0x38')]=_[_0x45e1('0x39')](_0x859bb3[_0x45e1('0x38')]);_0x3df715[_0x45e1('0x3a')]=_[_0x45e1('0x3b')](_0x3df715[_0x45e1('0x37')],_0x3df715[_0x45e1('0x38')]);_0x3d14b1[_0x45e1('0x3c')]=_['intersection'](_0x3df715[_0x45e1('0x37')],qs[_0x45e1('0x3d')](_0x859bb3[_0x45e1('0x38')][_0x45e1('0x3d')]));_0x3d14b1[_0x45e1('0x3c')]=_0x3d14b1[_0x45e1('0x3c')][_0x45e1('0x3e')]?_0x3d14b1[_0x45e1('0x3c')]:_0x3df715[_0x45e1('0x37')];if(_0x859bb3[_0x45e1('0x38')][_0x45e1('0x49')]){_0x3d14b1['include']=[{'all':!![]}];}_0x3d14b1=_[_0x45e1('0x43')]({},_0x3d14b1,_0x859bb3['options']);return db[_0x45e1('0x34')][_0x45e1('0x4e')](_0x3d14b1)[_0x45e1('0x2a')](handleEntityNotFound(_0x5e25f8,null))[_0x45e1('0x2a')](respondWithResult(_0x5e25f8,null))['catch'](handleError(_0x5e25f8,null));};exports[_0x45e1('0x4f')]=function(_0x38f779,_0x17701d){return db[_0x45e1('0x34')][_0x45e1('0x4f')](_0x38f779[_0x45e1('0x50')],{})['then'](function(_0x409f0f){var _0x30fbaa=_0x38f779[_0x45e1('0x51')][_0x45e1('0x2c')]({'plain':!![]});if(!_0x30fbaa)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x30fbaa[_0x45e1('0x52')]===_0x45e1('0x51')){var _0x14bd32=_0x409f0f[_0x45e1('0x2c')]({'plain':!![]});var _0x10580e=_0x45e1('0x2d');return db[_0x45e1('0x53')][_0x45e1('0x4e')]({'where':{'name':_0x10580e,'userProfileId':_0x30fbaa[_0x45e1('0x54')]},'raw':!![]})[_0x45e1('0x2a')](function(_0x53f2f4){if(_0x53f2f4&&_0x53f2f4[_0x45e1('0x55')]===0x0){return db[_0x45e1('0x2e')][_0x45e1('0x4f')]({'name':_0x14bd32[_0x45e1('0x31')],'resourceId':_0x14bd32['id'],'type':_0x53f2f4['name'],'sectionId':_0x53f2f4['id']},{})[_0x45e1('0x2a')](function(){return _0x409f0f;});}else{return _0x409f0f;}})[_0x45e1('0x56')](function(_0x4e0bca){logger[_0x45e1('0x57')](_0x45e1('0x58'),_0x4e0bca);throw _0x4e0bca;});}return _0x409f0f;})[_0x45e1('0x2a')](respondWithResult(_0x17701d,0xc9))[_0x45e1('0x56')](handleError(_0x17701d,null));};exports[_0x45e1('0x29')]=function(_0x5e08e1,_0x260ee1){if(_0x5e08e1[_0x45e1('0x50')]['id']){delete _0x5e08e1[_0x45e1('0x50')]['id'];}return db[_0x45e1('0x34')]['find']({'where':{'id':_0x5e08e1[_0x45e1('0x4d')]['id']}})[_0x45e1('0x2a')](handleEntityNotFound(_0x260ee1,null))['then'](saveUpdates(_0x5e08e1[_0x45e1('0x50')],null))[_0x45e1('0x2a')](respondWithResult(_0x260ee1,null))[_0x45e1('0x56')](handleError(_0x260ee1,null));};exports[_0x45e1('0x2b')]=function(_0x1140ce,_0x17a0ae){return db['VoiceChanSpy']['find']({'where':{'id':_0x1140ce['params']['id']}})[_0x45e1('0x2a')](handleEntityNotFound(_0x17a0ae,null))['then'](removeEntity(_0x17a0ae,null))[_0x45e1('0x56')](handleError(_0x17a0ae,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index d173213..aee5c48 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 _0x6fa2=['util','bluebird','./voiceChanSpy.attributes','context','from-sip','prefix','system','push','Set','format','CDR(type)=%s','chanspy','record','merge','MixMonitor','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','StopMixMonitor','length','internal','User','findAll','agent','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6fa2,0x167));var _0x26fa=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x6fa2[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0x26fa('0x0'));var util=require(_0x26fa('0x1'));var BPromise=require(_0x26fa('0x2'));var attributes=require(_0x26fa('0x3'));var getUserApplications=function(_0x2f5f2a,_0x4b15b9,_0xe6becf){var _0x1c92d7=0x1;var _0x1e32d2=[];var _0x36b90c={'context':_0x4b15b9[_0x26fa('0x4')]||_0x26fa('0x5'),'exten':util['format']('%s%s',_0x2f5f2a[_0x26fa('0x6')],_0xe6becf),'type':_0x26fa('0x7'),'isApp':![],'ChanSpyId':_0x2f5f2a['id'],'UserId':_0x4b15b9['id']};_0x1e32d2[_0x26fa('0x8')](_['merge']({'app':_0x26fa('0x9'),'appdata':util[_0x26fa('0xa')](_0x26fa('0xb'),_0x26fa('0xc')),'priority':_0x1c92d7++},_0x36b90c));if(_0x2f5f2a[_0x26fa('0xd')]){_0x1e32d2[_0x26fa('0x8')](_[_0x26fa('0xe')]({'app':_0x26fa('0xf'),'appdata':util[_0x26fa('0xa')]('${UNIQUEID}.%s,a',_0x2f5f2a[_0x26fa('0x10')]),'priority':_0x1c92d7++},_0x36b90c));}if(_0x2f5f2a[_0x26fa('0x11')]){_0x1e32d2[_0x26fa('0x8')](_[_0x26fa('0xe')]({'app':_0x26fa('0x12'),'appdata':_0x2f5f2a[_0x26fa('0x13')],'priority':_0x1c92d7++},_0x36b90c));}_0x1e32d2[_0x26fa('0x8')](_[_0x26fa('0xe')]({'app':_0x26fa('0x14'),'appdata':util[_0x26fa('0xa')](_0x26fa('0x15'),_0x4b15b9[_0x26fa('0x16')],_0x2f5f2a[_0x26fa('0x17')]?_0x2f5f2a[_0x26fa('0x17')]['join'](''):''),'priority':_0x1c92d7++},_0x36b90c));if(_0x2f5f2a[_0x26fa('0xd')]){_0x1e32d2[_0x26fa('0x8')](_['merge']({'app':_0x26fa('0x18'),'priority':_0x1c92d7++},_0x36b90c));}return _0x1e32d2;};var getChanSpyApplications=function(_0x8ffba,_0x1001d6){var _0x350fdf=[];for(var _0x362f85=0x0,_0x2dbb3e=0x1;_0x362f85<_0x1001d6[_0x26fa('0x19')];_0x362f85++,_0x2dbb3e=0x1){_0x350fdf=_0x350fdf['concat'](getUserApplications(_0x8ffba,_0x1001d6[_0x362f85],_0x1001d6[_0x362f85][_0x26fa('0x1a')]));if(_0x1001d6[_0x362f85][_0x26fa('0x1a')]!=_0x1001d6[_0x362f85][_0x26fa('0x16')]){_0x350fdf=_0x350fdf['concat'](getUserApplications(_0x8ffba,_0x1001d6[_0x362f85],_0x1001d6[_0x362f85][_0x26fa('0x16')]));}}return _0x350fdf;};var getChanSpyPromise=function(_0x54f40b,_0x3bb29b){return new BPromise(function(_0x31487a,_0x46f1fa){return _0x54f40b[_0x26fa('0x1b')][_0x26fa('0x1c')]({'attributes':['id','name','internal'],'where':{'role':_0x26fa('0x1d'),'chanspy':!![]},'raw':!![]})[_0x26fa('0x1e')](function(_0x116fdc){if(_0x116fdc){return _0x31487a(getChanSpyApplications(_0x3bb29b,_0x116fdc));}return _0x31487a([]);})[_0x26fa('0x1f')](function(_0x5dc7c1){_0x46f1fa(_0x5dc7c1);});});};module[_0x26fa('0x20')]=function(_0x91c741,_0x4d260c){var _0x5a21b4=_0x91c741[_0x26fa('0x21')];return _0x91c741[_0x26fa('0x22')](_0x26fa('0x23'),attributes,{'tableName':_0x26fa('0x24'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x114b0a,_0x5197c6,_0x2cc535){return getChanSpyPromise(_0x5a21b4,_0x114b0a)[_0x26fa('0x1e')](function(_0x3a3760){if(_0x3a3760&&_0x3a3760[_0x26fa('0x19')]){return _0x5a21b4[_0x26fa('0x25')][_0x26fa('0x26')](_0x3a3760);}})['then'](function(){_0x2cc535();})[_0x26fa('0x1f')](function(_0x35033d){_0x2cc535(_0x35033d);});},'afterUpdate':function(_0x44fbf2,_0x30e66d,_0x332d98){return _0x5a21b4[_0x26fa('0x25')][_0x26fa('0x27')]({'where':{'ChanSpyId':_0x44fbf2['id']}})['then'](function(){return getChanSpyPromise(_0x5a21b4,_0x44fbf2);})[_0x26fa('0x1e')](function(_0x4b5ed4){if(_0x4b5ed4&&_0x4b5ed4[_0x26fa('0x19')]){return _0x5a21b4['VoiceExtension'][_0x26fa('0x26')](_0x4b5ed4);}})[_0x26fa('0x1e')](function(){_0x332d98();})[_0x26fa('0x1f')](function(_0x48ba13){_0x332d98(_0x48ba13);});},'afterDestroy':function(_0x1f518e,_0x21a782,_0x139338){return _0x5a21b4[_0x26fa('0x25')][_0x26fa('0x27')]({'where':{'ChanSpyId':_0x1f518e['id']}})[_0x26fa('0x1e')](function(){_0x139338();})[_0x26fa('0x1f')](function(_0x3ba361){_0x139338(_0x3ba361);});}}});}; \ No newline at end of file +var _0xf249=['push','merge','CDR(type)=%s','chanspy','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','record','StopMixMonitor','length','concat','internal','User','findAll','agent','catch','exports','VoiceChanSpy','then','VoiceExtension','bulkCreate','lodash','util','./voiceChanSpy.attributes','context','format','prefix','system'];(function(_0x5455a9,_0x5681b5){var _0xc14b0=function(_0x3a5e8e){while(--_0x3a5e8e){_0x5455a9['push'](_0x5455a9['shift']());}};_0xc14b0(++_0x5681b5);}(_0xf249,0x1d5));var _0x9f24=function(_0x2c22d6,_0x181e97){_0x2c22d6=_0x2c22d6-0x0;var _0x150c83=_0xf249[_0x2c22d6];return _0x150c83;};'use strict';var _=require(_0x9f24('0x0'));var util=require(_0x9f24('0x1'));var BPromise=require('bluebird');var attributes=require(_0x9f24('0x2'));var getUserApplications=function(_0x494e6b,_0x11e020,_0x790194){var _0x2f0696=0x1;var _0x2e88f8=[];var _0x3b9204={'context':_0x11e020[_0x9f24('0x3')]||'from-sip','exten':util[_0x9f24('0x4')]('%s%s',_0x494e6b[_0x9f24('0x5')],_0x790194),'type':_0x9f24('0x6'),'isApp':![],'ChanSpyId':_0x494e6b['id'],'UserId':_0x11e020['id']};_0x2e88f8[_0x9f24('0x7')](_[_0x9f24('0x8')]({'app':'Set','appdata':util[_0x9f24('0x4')](_0x9f24('0x9'),_0x9f24('0xa')),'priority':_0x2f0696++},_0x3b9204));if(_0x494e6b['record']){_0x2e88f8[_0x9f24('0x7')](_[_0x9f24('0x8')]({'app':_0x9f24('0xb'),'appdata':util['format'](_0x9f24('0xc'),_0x494e6b[_0x9f24('0xd')]),'priority':_0x2f0696++},_0x3b9204));}if(_0x494e6b['auth']){_0x2e88f8[_0x9f24('0x7')](_[_0x9f24('0x8')]({'app':_0x9f24('0xe'),'appdata':_0x494e6b[_0x9f24('0xf')],'priority':_0x2f0696++},_0x3b9204));}_0x2e88f8['push'](_[_0x9f24('0x8')]({'app':_0x9f24('0x10'),'appdata':util[_0x9f24('0x4')](_0x9f24('0x11'),_0x11e020[_0x9f24('0x12')],_0x494e6b[_0x9f24('0x13')]?_0x494e6b[_0x9f24('0x13')]['join'](''):''),'priority':_0x2f0696++},_0x3b9204));if(_0x494e6b[_0x9f24('0x14')]){_0x2e88f8[_0x9f24('0x7')](_['merge']({'app':_0x9f24('0x15'),'priority':_0x2f0696++},_0x3b9204));}return _0x2e88f8;};var getChanSpyApplications=function(_0x72adb6,_0x4e256b){var _0x3899ad=[];for(var _0x15cd49=0x0,_0x167c3c=0x1;_0x15cd49<_0x4e256b[_0x9f24('0x16')];_0x15cd49++,_0x167c3c=0x1){_0x3899ad=_0x3899ad[_0x9f24('0x17')](getUserApplications(_0x72adb6,_0x4e256b[_0x15cd49],_0x4e256b[_0x15cd49][_0x9f24('0x18')]));if(_0x4e256b[_0x15cd49][_0x9f24('0x18')]!=_0x4e256b[_0x15cd49]['name']){_0x3899ad=_0x3899ad[_0x9f24('0x17')](getUserApplications(_0x72adb6,_0x4e256b[_0x15cd49],_0x4e256b[_0x15cd49][_0x9f24('0x12')]));}}return _0x3899ad;};var getChanSpyPromise=function(_0x58f9d1,_0xa8805c){return new BPromise(function(_0x9c3eb6,_0x58b823){return _0x58f9d1[_0x9f24('0x19')][_0x9f24('0x1a')]({'attributes':['id',_0x9f24('0x12'),_0x9f24('0x18')],'where':{'role':_0x9f24('0x1b'),'chanspy':!![]},'raw':!![]})['then'](function(_0x375e80){if(_0x375e80){return _0x9c3eb6(getChanSpyApplications(_0xa8805c,_0x375e80));}return _0x9c3eb6([]);})[_0x9f24('0x1c')](function(_0xc7ad9e){_0x58b823(_0xc7ad9e);});});};module[_0x9f24('0x1d')]=function(_0x59ff2d,_0x4bb057){var _0x5abb9e=_0x59ff2d['models'];return _0x59ff2d['define'](_0x9f24('0x1e'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x25cac9,_0x5c39dd,_0x4791e1){return getChanSpyPromise(_0x5abb9e,_0x25cac9)[_0x9f24('0x1f')](function(_0x5bf2a2){if(_0x5bf2a2&&_0x5bf2a2[_0x9f24('0x16')]){return _0x5abb9e[_0x9f24('0x20')][_0x9f24('0x21')](_0x5bf2a2);}})[_0x9f24('0x1f')](function(){_0x4791e1();})[_0x9f24('0x1c')](function(_0x398139){_0x4791e1(_0x398139);});},'afterUpdate':function(_0x23eaa7,_0x200ba1,_0x2ab982){return _0x5abb9e['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x23eaa7['id']}})[_0x9f24('0x1f')](function(){return getChanSpyPromise(_0x5abb9e,_0x23eaa7);})['then'](function(_0x12f865){if(_0x12f865&&_0x12f865[_0x9f24('0x16')]){return _0x5abb9e[_0x9f24('0x20')]['bulkCreate'](_0x12f865);}})[_0x9f24('0x1f')](function(){_0x2ab982();})['catch'](function(_0x3e80cb){_0x2ab982(_0x3e80cb);});},'afterDestroy':function(_0x3f248b,_0x5be773,_0x9a10e0){return _0x5abb9e[_0x9f24('0x20')]['destroy']({'where':{'ChanSpyId':_0x3f248b['id']}})[_0x9f24('0x1f')](function(){_0x9a10e0();})[_0x9f24('0x1c')](function(_0x1ba7f2){_0x9a10e0(_0x1ba7f2);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 382bf8b..f54cd3a 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 _0xc901=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error','code','message','lodash'];(function(_0x4eaedd,_0x4c28c0){var _0x1f943c=function(_0x529d8d){while(--_0x529d8d){_0x4eaedd['push'](_0x4eaedd['shift']());}};_0x1f943c(++_0x4c28c0);}(_0xc901,0x142));var _0x1c90=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xc901[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x1c90('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1c90('0x1'));var db=require(_0x1c90('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x1c90('0x3'))(_0x1c90('0x4'));var config=require(_0x1c90('0x5'));var jayson=require(_0x1c90('0x6'));var client=jayson[_0x1c90('0x7')][_0x1c90('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x912860,_0x12c07d,_0x423cfb){return new BPromise(function(_0x19196f,_0x514386){return client[_0x1c90('0x9')](_0x912860,_0x423cfb)[_0x1c90('0xa')](function(_0x38cd18){logger[_0x1c90('0xb')](_0x1c90('0xc'),_0x12c07d,_0x1c90('0xd'));logger[_0x1c90('0xe')](_0x1c90('0xf'),_0x12c07d,'request\x20sent',JSON['stringify'](_0x38cd18));if(_0x38cd18[_0x1c90('0x10')]){if(_0x38cd18[_0x1c90('0x10')][_0x1c90('0x11')]===0x1f4){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x12c07d,_0x38cd18[_0x1c90('0x10')][_0x1c90('0x12')]);return _0x514386(_0x38cd18['error'][_0x1c90('0x12')]);}logger[_0x1c90('0x10')](_0x1c90('0xc'),_0x12c07d,_0x38cd18['error'][_0x1c90('0x12')]);return _0x19196f(_0x38cd18['error'][_0x1c90('0x12')]);}else{logger[_0x1c90('0xb')](_0x1c90('0xc'),_0x12c07d,_0x1c90('0xd'));_0x19196f(_0x38cd18['result'][_0x1c90('0x12')]);}})['catch'](function(_0x2d3c90){logger[_0x1c90('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x12c07d,_0x2d3c90);_0x514386(_0x2d3c90);});});} \ No newline at end of file +var _0x9c2c=['request\x20sent','stringify','code','error','message','info','result','catch','lodash','util','ioredis','../../config/utils','../../config/logger','jayson/promise','http','request','then','VoiceChanSpy,\x20%s,\x20%s','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s'];(function(_0x481df5,_0x216652){var _0x32726e=function(_0x2133f4){while(--_0x2133f4){_0x481df5['push'](_0x481df5['shift']());}};_0x32726e(++_0x216652);}(_0x9c2c,0x1c0));var _0xc9c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c2c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc9c2('0x0'));var util=require(_0xc9c2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc9c2('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xc9c2('0x3'));var logger=require(_0xc9c2('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc9c2('0x5'));var client=jayson['client'][_0xc9c2('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x17b5e8,_0x711f3d,_0x18a815){return new BPromise(function(_0x270572,_0xd7fb27){return client[_0xc9c2('0x7')](_0x17b5e8,_0x18a815)[_0xc9c2('0x8')](function(_0x8614c4){logger['info'](_0xc9c2('0x9'),_0x711f3d,'request\x20sent');logger[_0xc9c2('0xa')](_0xc9c2('0xb'),_0x711f3d,_0xc9c2('0xc'),JSON[_0xc9c2('0xd')](_0x8614c4));if(_0x8614c4['error']){if(_0x8614c4['error'][_0xc9c2('0xe')]===0x1f4){logger[_0xc9c2('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x711f3d,_0x8614c4[_0xc9c2('0xf')][_0xc9c2('0x10')]);return _0xd7fb27(_0x8614c4[_0xc9c2('0xf')][_0xc9c2('0x10')]);}logger[_0xc9c2('0xf')](_0xc9c2('0x9'),_0x711f3d,_0x8614c4[_0xc9c2('0xf')][_0xc9c2('0x10')]);return _0x270572(_0x8614c4[_0xc9c2('0xf')][_0xc9c2('0x10')]);}else{logger[_0xc9c2('0x11')](_0xc9c2('0x9'),_0x711f3d,'request\x20sent');_0x270572(_0x8614c4[_0xc9c2('0x12')][_0xc9c2('0x10')]);}})[_0xc9c2('0x13')](function(_0x240099){logger[_0xc9c2('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x711f3d,_0x240099);_0xd7fb27(_0x240099);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 929bfa2..683c08e 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 _0xb68a=['show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','get','isAuthenticated','/:id'];(function(_0xb04f6b,_0x1ade6){var _0x571dcb=function(_0x47f9e1){while(--_0x47f9e1){_0xb04f6b['push'](_0xb04f6b['shift']());}};_0x571dcb(++_0x1ade6);}(_0xb68a,0xa1));var _0xab68=function(_0x3849ff,_0x4ae25e){_0x3849ff=_0x3849ff-0x0;var _0x3ab676=_0xb68a[_0x3849ff];return _0x3ab676;};'use strict';var multer=require(_0xab68('0x0'));var util=require(_0xab68('0x1'));var path=require(_0xab68('0x2'));var timeout=require(_0xab68('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xab68('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xab68('0x5'));var config=require('../../config/environment');var controller=require('./voiceContext.controller');router[_0xab68('0x6')]('/',auth[_0xab68('0x7')](),controller['index']);router[_0xab68('0x6')](_0xab68('0x8'),auth['isAuthenticated'](),controller[_0xab68('0x9')]);router[_0xab68('0xa')]('/',auth['isAuthenticated'](),controller[_0xab68('0xb')]);router[_0xab68('0xc')]('/:id',auth[_0xab68('0x7')](),controller[_0xab68('0xd')]);router[_0xab68('0xe')](_0xab68('0x8'),auth[_0xab68('0x7')](),controller[_0xab68('0xf')]);module[_0xab68('0x10')]=router; \ No newline at end of file +var _0x8b8a=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','create','put','update'];(function(_0x154b31,_0x2d12bc){var _0x1183d8=function(_0x5c9e27){while(--_0x5c9e27){_0x154b31['push'](_0x154b31['shift']());}};_0x1183d8(++_0x2d12bc);}(_0x8b8a,0x1d5));var _0xa8b8=function(_0x43d679,_0x112ca3){_0x43d679=_0x43d679-0x0;var _0x21111b=_0x8b8a[_0x43d679];return _0x21111b;};'use strict';var multer=require(_0xa8b8('0x0'));var util=require(_0xa8b8('0x1'));var path=require(_0xa8b8('0x2'));var timeout=require(_0xa8b8('0x3'));var express=require(_0xa8b8('0x4'));var router=express[_0xa8b8('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa8b8('0x6'));var interaction=require(_0xa8b8('0x7'));var config=require(_0xa8b8('0x8'));var controller=require(_0xa8b8('0x9'));router[_0xa8b8('0xa')]('/',auth[_0xa8b8('0xb')](),controller[_0xa8b8('0xc')]);router[_0xa8b8('0xa')](_0xa8b8('0xd'),auth[_0xa8b8('0xb')](),controller['show']);router['post']('/',auth[_0xa8b8('0xb')](),controller[_0xa8b8('0xe')]);router[_0xa8b8('0xf')](_0xa8b8('0xd'),auth['isAuthenticated'](),controller[_0xa8b8('0x10')]);router['delete'](_0xa8b8('0xd'),auth[_0xa8b8('0xb')](),controller['destroy']);module[_0xa8b8('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index fb9cf79..9527bf1 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 _0x3c69=['STRING','name','BOOLEAN','sequelize','exports'];(function(_0x9d4ce4,_0x510f23){var _0x555e00=function(_0x2572f9){while(--_0x2572f9){_0x9d4ce4['push'](_0x9d4ce4['shift']());}};_0x555e00(++_0x510f23);}(_0x3c69,0x9e));var _0x93c6=function(_0x30e25c,_0x355276){_0x30e25c=_0x30e25c-0x0;var _0x47959b=_0x3c69[_0x30e25c];return _0x47959b;};'use strict';var Sequelize=require(_0x93c6('0x0'));module[_0x93c6('0x1')]={'name':{'type':Sequelize[_0x93c6('0x2')],'unique':_0x93c6('0x3')},'description':{'type':Sequelize[_0x93c6('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x93c6('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x77f4=['sequelize','STRING','BOOLEAN'];(function(_0x469056,_0x4f46e1){var _0xba97aa=function(_0x217722){while(--_0x217722){_0x469056['push'](_0x469056['shift']());}};_0xba97aa(++_0x4f46e1);}(_0x77f4,0x96));var _0x477f=function(_0x236fdf,_0x775c77){_0x236fdf=_0x236fdf-0x0;var _0x495d1c=_0x77f4[_0x236fdf];return _0x495d1c;};'use strict';var Sequelize=require(_0x477f('0x0'));module['exports']={'name':{'type':Sequelize[_0x477f('0x1')],'unique':'name'},'description':{'type':Sequelize[_0x477f('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x477f('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 0aa6800..b851525 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 _0x6d9d=['querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','error','message','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','stack','send','index','map','VoiceContext','rawAttributes','fieldName','key','model','name','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','params','keys','include','find','readFileSync','join','root','server/files/templates/context.ejs','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','create','chan_sip.so','user','get','role','UserProfileSection','Contexts','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','utf8','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x6d9d,0x1e2));var _0xd6d9=function(_0x5cff20,_0x57b5a3){_0x5cff20=_0x5cff20-0x0;var _0x40ad5a=_0x6d9d[_0x5cff20];return _0x40ad5a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd6d9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd6d9('0x1'));var moment=require('moment');var BPromise=require(_0xd6d9('0x2'));var Mustache=require(_0xd6d9('0x3'));var util=require(_0xd6d9('0x4'));var path=require(_0xd6d9('0x5'));var sox=require(_0xd6d9('0x6'));var csv=require(_0xd6d9('0x7'));var ejs=require(_0xd6d9('0x8'));var fs=require('fs');var fs_extra=require(_0xd6d9('0x9'));var _=require(_0xd6d9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd6d9('0xb'));var deskjs=require(_0xd6d9('0xc'));var toCsv=require(_0xd6d9('0x7'));var querystring=require(_0xd6d9('0xd'));var Papa=require(_0xd6d9('0xe'));var Redis=require(_0xd6d9('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd6d9('0x10'));var as=require(_0xd6d9('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd6d9('0x12'))(_0xd6d9('0x13'));var utils=require('../../config/utils');var config=require(_0xd6d9('0x14'));var licenseUtil=require(_0xd6d9('0x15'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xd6d9('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x1118ac,_0x568b39,_0x31a373,_0x5da583){return new BPromise(function(_0x3fac16,_0x586c8e){var _0x2c4c97=_0x5da583||client;return _0x2c4c97[_0xd6d9('0x17')](_0x1118ac,_0x31a373)[_0xd6d9('0x18')](function(_0x456549){logger[_0xd6d9('0x19')](_0xd6d9('0x1a'),_0x568b39,'request\x20sent');logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x568b39,_0xd6d9('0x1b'),JSON['stringify'](_0x456549));if(_0x456549[_0xd6d9('0x1c')]){if(_0x456549[_0xd6d9('0x1c')]['code']===0x1f4){logger[_0xd6d9('0x1c')](_0xd6d9('0x1a'),_0x568b39,_0x456549[_0xd6d9('0x1c')][_0xd6d9('0x1d')]);return _0x586c8e(_0x456549[_0xd6d9('0x1c')][_0xd6d9('0x1d')]);}logger['error'](_0xd6d9('0x1a'),_0x568b39,_0x456549[_0xd6d9('0x1c')][_0xd6d9('0x1d')]);return _0x3fac16(_0x456549[_0xd6d9('0x1c')]['message']);}else{logger[_0xd6d9('0x19')]('VoiceContext,\x20%s,\x20%s',_0x568b39,_0xd6d9('0x1b'));_0x3fac16(_0x456549['result'][_0xd6d9('0x1d')]);}})[_0xd6d9('0x1e')](function(_0x4a4218){logger[_0xd6d9('0x1c')]('VoiceContext,\x20%s,\x20%s',_0x568b39,_0x4a4218);_0x586c8e(_0x4a4218);});});}function respondWithStatusCode(_0x3040b2,_0x4ed755){_0x4ed755=_0x4ed755||0xcc;return function(_0x3a3f17){if(_0x3a3f17){return _0x3040b2[_0xd6d9('0x1f')](_0x4ed755);}return _0x3040b2[_0xd6d9('0x20')](_0x4ed755)[_0xd6d9('0x21')]();};}function respondWithResult(_0xea9c3d,_0x14a65f){_0x14a65f=_0x14a65f||0xc8;return function(_0x2f9df8){if(_0x2f9df8){return _0xea9c3d['status'](_0x14a65f)['json'](_0x2f9df8);}};}function respondWithFilteredResult(_0x385b88,_0xb7994e){return function(_0x5afd22){if(_0x5afd22){var _0xe4902a=typeof _0xb7994e[_0xd6d9('0x22')]===_0xd6d9('0x23')&&typeof _0xb7994e[_0xd6d9('0x24')]==='undefined';var _0xdefa6d=_0x5afd22[_0xd6d9('0x25')];var _0x36fe18=_0xe4902a?0x0:_0xb7994e[_0xd6d9('0x22')];var _0x17cd29=_0xe4902a?_0x5afd22[_0xd6d9('0x25')]:_0xb7994e['offset']+_0xb7994e['limit'];var _0x58d5dc;if(_0x17cd29>=_0xdefa6d){_0x17cd29=_0xdefa6d;_0x58d5dc=0xc8;}else{_0x58d5dc=0xce;}_0x385b88[_0xd6d9('0x20')](_0x58d5dc);return _0x385b88[_0xd6d9('0x26')](_0xd6d9('0x27'),_0x36fe18+'-'+_0x17cd29+'/'+_0xdefa6d)[_0xd6d9('0x28')](_0x5afd22);}return null;};}function patchUpdates(_0x1d5aac){return function(_0x3e02d0){try{jsonpatch[_0xd6d9('0x29')](_0x3e02d0,_0x1d5aac,!![]);}catch(_0x5d72d4){return BPromise[_0xd6d9('0x2a')](_0x5d72d4);}return _0x3e02d0[_0xd6d9('0x2b')]();};}function saveUpdates(_0xd98f19,_0x4547da){return function(_0x18bd25){if(_0x18bd25){return _0x18bd25[_0xd6d9('0x2c')](_0xd98f19)[_0xd6d9('0x18')](function(_0x2d34bd){return _0x2d34bd;});}return null;};}function removeEntity(_0x2feefa,_0x9e59c6){return function(_0x5d6405){if(_0x5d6405){return _0x5d6405[_0xd6d9('0x2d')]()[_0xd6d9('0x18')](function(){var _0x111be7=_0x5d6405['get']({'plain':!![]});var _0x2788a0='Contexts';return db['UserProfileResource'][_0xd6d9('0x2d')]({'where':{'type':_0x2788a0,'resourceId':_0x111be7['id']}})[_0xd6d9('0x18')](function(){return _0x5d6405;});})[_0xd6d9('0x18')](function(){_0x2feefa[_0xd6d9('0x20')](0xcc)[_0xd6d9('0x21')]();});}};}function handleEntityNotFound(_0x4aabde,_0x1bc0b0){return function(_0x4f3130){if(!_0x4f3130){_0x4aabde['sendStatus'](0x194);}return _0x4f3130;};}function handleError(_0x2806df,_0x246355){_0x246355=_0x246355||0x1f4;return function(_0x5d6671){logger[_0xd6d9('0x1c')](_0x5d6671[_0xd6d9('0x2e')]);if(_0x5d6671['name']){delete _0x5d6671['name'];}_0x2806df[_0xd6d9('0x20')](_0x246355)[_0xd6d9('0x2f')](_0x5d6671);};}exports[_0xd6d9('0x30')]=function(_0x2a27c2,_0x2b7fb8){var _0x3f974a={},_0x3f9a80={},_0x37122f={'count':0x0,'rows':[]};var _0x2a3522=_[_0xd6d9('0x31')](db[_0xd6d9('0x32')][_0xd6d9('0x33')],function(_0x415bf0){return{'name':_0x415bf0[_0xd6d9('0x34')],'type':_0x415bf0['type'][_0xd6d9('0x35')]};});_0x3f9a80[_0xd6d9('0x36')]=_[_0xd6d9('0x31')](_0x2a3522,_0xd6d9('0x37'));_0x3f9a80[_0xd6d9('0x38')]=_['keys'](_0x2a27c2['query']);_0x3f9a80[_0xd6d9('0x39')]=_['intersection'](_0x3f9a80[_0xd6d9('0x36')],_0x3f9a80[_0xd6d9('0x38')]);_0x3f974a[_0xd6d9('0x3a')]=_[_0xd6d9('0x3b')](_0x3f9a80['model'],qs[_0xd6d9('0x3c')](_0x2a27c2['query'][_0xd6d9('0x3c')]));_0x3f974a['attributes']=_0x3f974a[_0xd6d9('0x3a')]['length']?_0x3f974a[_0xd6d9('0x3a')]:_0x3f9a80[_0xd6d9('0x36')];if(!_0x2a27c2['query'][_0xd6d9('0x3d')](_0xd6d9('0x3e'))){_0x3f974a[_0xd6d9('0x24')]=qs[_0xd6d9('0x24')](_0x2a27c2[_0xd6d9('0x38')][_0xd6d9('0x24')]);_0x3f974a[_0xd6d9('0x22')]=qs['offset'](_0x2a27c2[_0xd6d9('0x38')]['offset']);}_0x3f974a[_0xd6d9('0x3f')]=qs['sort'](_0x2a27c2['query'][_0xd6d9('0x40')]);_0x3f974a[_0xd6d9('0x41')]=qs[_0xd6d9('0x39')](_[_0xd6d9('0x42')](_0x2a27c2['query'],_0x3f9a80[_0xd6d9('0x39')]),_0x2a3522);if(_0x2a27c2['query']['filter']){_0x3f974a[_0xd6d9('0x41')]=_[_0xd6d9('0x43')](_0x3f974a['where'],{'$or':_[_0xd6d9('0x31')](_0x2a3522,function(_0x46a623){if(_0x46a623['type']!==_0xd6d9('0x44')){var _0x34df6f={};_0x34df6f[_0x46a623[_0xd6d9('0x37')]]={'$like':'%'+_0x2a27c2[_0xd6d9('0x38')][_0xd6d9('0x45')]+'%'};return _0x34df6f;}})});}_0x3f974a=_['merge']({},_0x3f974a,_0x2a27c2[_0xd6d9('0x46')]);var _0x3bba53={'where':_0x3f974a[_0xd6d9('0x41')]};return db['VoiceContext'][_0xd6d9('0x25')](_0x3bba53)[_0xd6d9('0x18')](function(_0x330c44){_0x37122f[_0xd6d9('0x25')]=_0x330c44;if(_0x2a27c2[_0xd6d9('0x38')][_0xd6d9('0x47')]){_0x3f974a['include']=[{'all':!![]}];}return db['VoiceContext'][_0xd6d9('0x48')](_0x3f974a);})[_0xd6d9('0x18')](function(_0x4649dc){_0x37122f[_0xd6d9('0x49')]=_0x4649dc;return _0x37122f;})[_0xd6d9('0x18')](respondWithFilteredResult(_0x2b7fb8,_0x3f974a))[_0xd6d9('0x1e')](handleError(_0x2b7fb8,null));};exports['show']=function(_0x5a29ca,_0x114325){var _0x4281c8={'raw':![],'where':{'id':_0x5a29ca[_0xd6d9('0x4a')]['id']}},_0xb30f2e={};_0xb30f2e[_0xd6d9('0x36')]=_[_0xd6d9('0x4b')](db[_0xd6d9('0x32')][_0xd6d9('0x33')]);_0xb30f2e[_0xd6d9('0x38')]=_[_0xd6d9('0x4b')](_0x5a29ca[_0xd6d9('0x38')]);_0xb30f2e[_0xd6d9('0x39')]=_[_0xd6d9('0x3b')](_0xb30f2e['model'],_0xb30f2e[_0xd6d9('0x38')]);_0x4281c8[_0xd6d9('0x3a')]=_[_0xd6d9('0x3b')](_0xb30f2e[_0xd6d9('0x36')],qs[_0xd6d9('0x3c')](_0x5a29ca[_0xd6d9('0x38')][_0xd6d9('0x3c')]));_0x4281c8[_0xd6d9('0x3a')]=_0x4281c8[_0xd6d9('0x3a')]['length']?_0x4281c8[_0xd6d9('0x3a')]:_0xb30f2e[_0xd6d9('0x36')];if(_0x5a29ca[_0xd6d9('0x38')][_0xd6d9('0x47')]){_0x4281c8[_0xd6d9('0x4c')]=[{'all':!![]}];}_0x4281c8=_[_0xd6d9('0x43')]({},_0x4281c8,_0x5a29ca['options']);return db[_0xd6d9('0x32')][_0xd6d9('0x4d')](_0x4281c8)['then'](handleEntityNotFound(_0x114325,null))['then'](respondWithResult(_0x114325,null))[_0xd6d9('0x1e')](handleError(_0x114325,null));};exports['create']=function(_0x547e0d,_0x4014b5,_0x270533){var _0x311cc5;return db[_0xd6d9('0x32')]['create'](_0x547e0d['body'],{'raw':!![]})[_0xd6d9('0x18')](function(_0x1c66e5){_0x311cc5=_0x1c66e5;return db[_0xd6d9('0x32')][_0xd6d9('0x48')]({'raw':!![]});})[_0xd6d9('0x18')](function(_0xcd7a19){var _0x1ed4de=fs[_0xd6d9('0x4e')](path[_0xd6d9('0x4f')](config[_0xd6d9('0x50')],_0xd6d9('0x51')),'utf8');var _0x2c4664=ejs[_0xd6d9('0x52')](_0x1ed4de,{'contexts':_0xcd7a19||[]});fs[_0xd6d9('0x53')](_0xd6d9('0x54'),_0x2c4664);})[_0xd6d9('0x18')](function(){return respondWithRpcPromise(_0xd6d9('0x55'),_0xd6d9('0x56'),{'module':_0xd6d9('0x57')});})[_0xd6d9('0x18')](function(){var _0x1f27ee=_0x547e0d[_0xd6d9('0x58')][_0xd6d9('0x59')]({'plain':!![]});if(!_0x1f27ee)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1f27ee[_0xd6d9('0x5a')]===_0xd6d9('0x58')){var _0x24a1df=_0x311cc5[_0xd6d9('0x59')]({'plain':!![]});return db[_0xd6d9('0x5b')][_0xd6d9('0x4d')]({'where':{'name':_0xd6d9('0x5c'),'userProfileId':_0x1f27ee[_0xd6d9('0x5d')]},'raw':!![]})[_0xd6d9('0x18')](function(_0x5edfd9){if(_0x5edfd9&&_0x5edfd9[_0xd6d9('0x5e')]===0x0){return db[_0xd6d9('0x5f')]['create']({'name':_0x24a1df[_0xd6d9('0x37')],'resourceId':_0x24a1df['id'],'type':_0x5edfd9['name'],'sectionId':_0x5edfd9['id']},{})[_0xd6d9('0x18')](function(){return _0x311cc5;});}else{return _0x311cc5;}})[_0xd6d9('0x1e')](function(_0x5d4a6e){logger[_0xd6d9('0x1c')](_0xd6d9('0x60'),_0x5d4a6e);throw _0x5d4a6e;});}return _0x311cc5;})[_0xd6d9('0x18')](respondWithResult(_0x4014b5,0xc9))[_0xd6d9('0x1e')](handleError(_0x4014b5,null));};exports[_0xd6d9('0x2c')]=function(_0x229840,_0x3f74a6,_0x339110){var _0xee856b;return db[_0xd6d9('0x32')][_0xd6d9('0x4d')]({'where':{'id':_0x229840['params']['id']}})[_0xd6d9('0x18')](handleEntityNotFound(_0x3f74a6,null))[_0xd6d9('0x18')](saveUpdates(_0x229840[_0xd6d9('0x61')],null))[_0xd6d9('0x18')](function(_0x37a2a7){if(_0x37a2a7){_0xee856b=_0x37a2a7;return db[_0xd6d9('0x32')][_0xd6d9('0x48')]({'raw':!![]});}})[_0xd6d9('0x18')](function(_0x4b3432){var _0x32eb05=fs[_0xd6d9('0x4e')](path[_0xd6d9('0x4f')](config[_0xd6d9('0x50')],_0xd6d9('0x51')),_0xd6d9('0x62'));var _0x17d3fd=ejs[_0xd6d9('0x52')](_0x32eb05,{'contexts':_0x4b3432||[]});fs[_0xd6d9('0x53')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x17d3fd);})[_0xd6d9('0x18')](function(){return respondWithRpcPromise(_0xd6d9('0x55'),'update',{'module':_0xd6d9('0x57')});})[_0xd6d9('0x18')](function(){return _0xee856b;})[_0xd6d9('0x18')](respondWithResult(_0x3f74a6,null))['catch'](handleError(_0x3f74a6,null));};exports[_0xd6d9('0x2d')]=function(_0x3b8059,_0x2e3c78,_0x3ee787){var _0x409626;return db[_0xd6d9('0x32')]['find']({'where':{'id':_0x3b8059[_0xd6d9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2e3c78,null))[_0xd6d9('0x18')](removeEntity(_0x2e3c78,null))[_0xd6d9('0x18')](function(){return db['VoiceContext']['findAll']({'raw':!![]});})[_0xd6d9('0x18')](function(_0x5d35ec){var _0x421ab3=fs[_0xd6d9('0x4e')](path[_0xd6d9('0x4f')](config[_0xd6d9('0x50')],_0xd6d9('0x51')),_0xd6d9('0x62'));var _0x28f09c=ejs[_0xd6d9('0x52')](_0x421ab3,{'contexts':_0x5d35ec});fs[_0xd6d9('0x53')](_0xd6d9('0x54'),_0x28f09c);return respondWithRpcPromise(_0xd6d9('0x55'),_0xd6d9('0x2d'),{'module':_0xd6d9('0x57')});})['catch'](handleError(_0x2e3c78,null));}; \ No newline at end of file +var _0x7092=['undefined','count','set','Content-Range','json','apply','reject','save','destroy','Contexts','UserProfileResource','sendStatus','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','nolimit','order','sort','filters','pick','where','filter','merge','options','VoiceContext','includeAll','include','findAll','show','params','keys','length','create','body','join','server/files/templates/context.ejs','render','writeFileSync','Reload','chan_sip.so','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','utf8','/etc/asterisk/extensions_xcally_contexts.conf','readFileSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','offset','limit'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x7092,0x17f));var _0x2709=function(_0x218881,_0x4a913a){_0x218881=_0x218881-0x0;var _0x5034ce=_0x7092[_0x218881];return _0x5034ce;};'use strict';var emlformat=require(_0x2709('0x0'));var rimraf=require(_0x2709('0x1'));var zipdir=require(_0x2709('0x2'));var jsonpatch=require(_0x2709('0x3'));var rp=require(_0x2709('0x4'));var moment=require(_0x2709('0x5'));var BPromise=require(_0x2709('0x6'));var Mustache=require(_0x2709('0x7'));var util=require('util');var path=require(_0x2709('0x8'));var sox=require('sox');var csv=require(_0x2709('0x9'));var ejs=require(_0x2709('0xa'));var fs=require('fs');var fs_extra=require(_0x2709('0xb'));var _=require(_0x2709('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2709('0xd'));var deskjs=require(_0x2709('0xe'));var toCsv=require(_0x2709('0x9'));var querystring=require(_0x2709('0xf'));var Papa=require(_0x2709('0x10'));var Redis=require(_0x2709('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2709('0x12'));var as=require(_0x2709('0x13'));var hardwareService=require(_0x2709('0x14'));var logger=require(_0x2709('0x15'))(_0x2709('0x16'));var utils=require(_0x2709('0x17'));var config=require(_0x2709('0x18'));var licenseUtil=require(_0x2709('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0x2709('0x1a'));var client=jayson[_0x2709('0x1b')][_0x2709('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x1f6c02,_0x1f3345,_0x57226a,_0x210f50){return new BPromise(function(_0x365da4,_0x1d556e){var _0x57eeba=_0x210f50||client;return _0x57eeba[_0x2709('0x1d')](_0x1f6c02,_0x57226a)[_0x2709('0x1e')](function(_0x3b9f5d){logger[_0x2709('0x1f')](_0x2709('0x20'),_0x1f3345,'request\x20sent');logger['debug'](_0x2709('0x21'),_0x1f3345,_0x2709('0x22'),JSON[_0x2709('0x23')](_0x3b9f5d));if(_0x3b9f5d[_0x2709('0x24')]){if(_0x3b9f5d[_0x2709('0x24')][_0x2709('0x25')]===0x1f4){logger[_0x2709('0x24')](_0x2709('0x20'),_0x1f3345,_0x3b9f5d[_0x2709('0x24')][_0x2709('0x26')]);return _0x1d556e(_0x3b9f5d[_0x2709('0x24')][_0x2709('0x26')]);}logger[_0x2709('0x24')]('VoiceContext,\x20%s,\x20%s',_0x1f3345,_0x3b9f5d[_0x2709('0x24')][_0x2709('0x26')]);return _0x365da4(_0x3b9f5d['error'][_0x2709('0x26')]);}else{logger['info'](_0x2709('0x20'),_0x1f3345,_0x2709('0x22'));_0x365da4(_0x3b9f5d[_0x2709('0x27')][_0x2709('0x26')]);}})[_0x2709('0x28')](function(_0x48c272){logger[_0x2709('0x24')](_0x2709('0x20'),_0x1f3345,_0x48c272);_0x1d556e(_0x48c272);});});}function respondWithStatusCode(_0x3d49a2,_0x533ca2){_0x533ca2=_0x533ca2||0xcc;return function(_0xfdd999){if(_0xfdd999){return _0x3d49a2['sendStatus'](_0x533ca2);}return _0x3d49a2[_0x2709('0x29')](_0x533ca2)[_0x2709('0x2a')]();};}function respondWithResult(_0x2d91ca,_0x1305c4){_0x1305c4=_0x1305c4||0xc8;return function(_0x4742dd){if(_0x4742dd){return _0x2d91ca[_0x2709('0x29')](_0x1305c4)['json'](_0x4742dd);}};}function respondWithFilteredResult(_0x17fee2,_0x1e1092){return function(_0x5324e4){if(_0x5324e4){var _0x230fc6=typeof _0x1e1092[_0x2709('0x2b')]==='undefined'&&typeof _0x1e1092[_0x2709('0x2c')]===_0x2709('0x2d');var _0x1b63ab=_0x5324e4[_0x2709('0x2e')];var _0x242303=_0x230fc6?0x0:_0x1e1092['offset'];var _0x63fa0e=_0x230fc6?_0x5324e4['count']:_0x1e1092[_0x2709('0x2b')]+_0x1e1092[_0x2709('0x2c')];var _0x526ae5;if(_0x63fa0e>=_0x1b63ab){_0x63fa0e=_0x1b63ab;_0x526ae5=0xc8;}else{_0x526ae5=0xce;}_0x17fee2[_0x2709('0x29')](_0x526ae5);return _0x17fee2[_0x2709('0x2f')](_0x2709('0x30'),_0x242303+'-'+_0x63fa0e+'/'+_0x1b63ab)[_0x2709('0x31')](_0x5324e4);}return null;};}function patchUpdates(_0x2c37c2){return function(_0x34d126){try{jsonpatch[_0x2709('0x32')](_0x34d126,_0x2c37c2,!![]);}catch(_0x353b47){return BPromise[_0x2709('0x33')](_0x353b47);}return _0x34d126[_0x2709('0x34')]();};}function saveUpdates(_0xf0a8ac,_0x1186a8){return function(_0x4cbbba){if(_0x4cbbba){return _0x4cbbba['update'](_0xf0a8ac)[_0x2709('0x1e')](function(_0x2c0245){return _0x2c0245;});}return null;};}function removeEntity(_0x55581e,_0x3d5aae){return function(_0x3d347a){if(_0x3d347a){return _0x3d347a[_0x2709('0x35')]()[_0x2709('0x1e')](function(){var _0x29b5d7=_0x3d347a['get']({'plain':!![]});var _0x29076a=_0x2709('0x36');return db[_0x2709('0x37')][_0x2709('0x35')]({'where':{'type':_0x29076a,'resourceId':_0x29b5d7['id']}})[_0x2709('0x1e')](function(){return _0x3d347a;});})[_0x2709('0x1e')](function(){_0x55581e[_0x2709('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e04f1,_0x340d43){return function(_0x106a87){if(!_0x106a87){_0x2e04f1[_0x2709('0x38')](0x194);}return _0x106a87;};}function handleError(_0x762ace,_0x3dc7b7){_0x3dc7b7=_0x3dc7b7||0x1f4;return function(_0x18c42b){logger['error'](_0x18c42b['stack']);if(_0x18c42b[_0x2709('0x39')]){delete _0x18c42b[_0x2709('0x39')];}_0x762ace[_0x2709('0x29')](_0x3dc7b7)[_0x2709('0x3a')](_0x18c42b);};}exports[_0x2709('0x3b')]=function(_0x355f83,_0x4dc682){var _0x6d71fe={},_0x3f3100={},_0x47a5cc={'count':0x0,'rows':[]};var _0x5ea036=_[_0x2709('0x3c')](db['VoiceContext'][_0x2709('0x3d')],function(_0x249e9e){return{'name':_0x249e9e[_0x2709('0x3e')],'type':_0x249e9e[_0x2709('0x3f')][_0x2709('0x40')]};});_0x3f3100[_0x2709('0x41')]=_['map'](_0x5ea036,'name');_0x3f3100[_0x2709('0x42')]=_['keys'](_0x355f83['query']);_0x3f3100['filters']=_[_0x2709('0x43')](_0x3f3100[_0x2709('0x41')],_0x3f3100[_0x2709('0x42')]);_0x6d71fe[_0x2709('0x44')]=_[_0x2709('0x43')](_0x3f3100[_0x2709('0x41')],qs['fields'](_0x355f83[_0x2709('0x42')][_0x2709('0x45')]));_0x6d71fe['attributes']=_0x6d71fe['attributes']['length']?_0x6d71fe[_0x2709('0x44')]:_0x3f3100[_0x2709('0x41')];if(!_0x355f83[_0x2709('0x42')]['hasOwnProperty'](_0x2709('0x46'))){_0x6d71fe[_0x2709('0x2c')]=qs[_0x2709('0x2c')](_0x355f83[_0x2709('0x42')][_0x2709('0x2c')]);_0x6d71fe['offset']=qs[_0x2709('0x2b')](_0x355f83[_0x2709('0x42')][_0x2709('0x2b')]);}_0x6d71fe[_0x2709('0x47')]=qs[_0x2709('0x48')](_0x355f83[_0x2709('0x42')][_0x2709('0x48')]);_0x6d71fe['where']=qs[_0x2709('0x49')](_[_0x2709('0x4a')](_0x355f83[_0x2709('0x42')],_0x3f3100[_0x2709('0x49')]),_0x5ea036);if(_0x355f83['query']['filter']){_0x6d71fe[_0x2709('0x4b')]=_['merge'](_0x6d71fe[_0x2709('0x4b')],{'$or':_[_0x2709('0x3c')](_0x5ea036,function(_0x58eea8){if(_0x58eea8[_0x2709('0x3f')]!=='VIRTUAL'){var _0x5acccc={};_0x5acccc[_0x58eea8['name']]={'$like':'%'+_0x355f83['query'][_0x2709('0x4c')]+'%'};return _0x5acccc;}})});}_0x6d71fe=_[_0x2709('0x4d')]({},_0x6d71fe,_0x355f83[_0x2709('0x4e')]);var _0x34e683={'where':_0x6d71fe[_0x2709('0x4b')]};return db[_0x2709('0x4f')][_0x2709('0x2e')](_0x34e683)[_0x2709('0x1e')](function(_0x17b620){_0x47a5cc[_0x2709('0x2e')]=_0x17b620;if(_0x355f83['query'][_0x2709('0x50')]){_0x6d71fe[_0x2709('0x51')]=[{'all':!![]}];}return db[_0x2709('0x4f')][_0x2709('0x52')](_0x6d71fe);})[_0x2709('0x1e')](function(_0x45fb0d){_0x47a5cc['rows']=_0x45fb0d;return _0x47a5cc;})[_0x2709('0x1e')](respondWithFilteredResult(_0x4dc682,_0x6d71fe))['catch'](handleError(_0x4dc682,null));};exports[_0x2709('0x53')]=function(_0x16412c,_0x507859){var _0x14f4cd={'raw':![],'where':{'id':_0x16412c[_0x2709('0x54')]['id']}},_0x27a27b={};_0x27a27b[_0x2709('0x41')]=_[_0x2709('0x55')](db[_0x2709('0x4f')][_0x2709('0x3d')]);_0x27a27b[_0x2709('0x42')]=_[_0x2709('0x55')](_0x16412c[_0x2709('0x42')]);_0x27a27b[_0x2709('0x49')]=_[_0x2709('0x43')](_0x27a27b[_0x2709('0x41')],_0x27a27b[_0x2709('0x42')]);_0x14f4cd[_0x2709('0x44')]=_[_0x2709('0x43')](_0x27a27b[_0x2709('0x41')],qs[_0x2709('0x45')](_0x16412c[_0x2709('0x42')][_0x2709('0x45')]));_0x14f4cd[_0x2709('0x44')]=_0x14f4cd[_0x2709('0x44')][_0x2709('0x56')]?_0x14f4cd[_0x2709('0x44')]:_0x27a27b['model'];if(_0x16412c[_0x2709('0x42')][_0x2709('0x50')]){_0x14f4cd[_0x2709('0x51')]=[{'all':!![]}];}_0x14f4cd=_[_0x2709('0x4d')]({},_0x14f4cd,_0x16412c['options']);return db[_0x2709('0x4f')]['find'](_0x14f4cd)[_0x2709('0x1e')](handleEntityNotFound(_0x507859,null))[_0x2709('0x1e')](respondWithResult(_0x507859,null))[_0x2709('0x28')](handleError(_0x507859,null));};exports[_0x2709('0x57')]=function(_0x2dcdca,_0x4fb327,_0x5e96fa){var _0x5999c0;return db['VoiceContext']['create'](_0x2dcdca[_0x2709('0x58')],{'raw':!![]})['then'](function(_0x45076e){_0x5999c0=_0x45076e;return db['VoiceContext'][_0x2709('0x52')]({'raw':!![]});})[_0x2709('0x1e')](function(_0x9cdcfa){var _0x3b5e89=fs['readFileSync'](path[_0x2709('0x59')](config['root'],_0x2709('0x5a')),'utf8');var _0x5c80d6=ejs[_0x2709('0x5b')](_0x3b5e89,{'contexts':_0x9cdcfa||[]});fs[_0x2709('0x5c')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x5c80d6);})[_0x2709('0x1e')](function(){return respondWithRpcPromise(_0x2709('0x5d'),_0x2709('0x57'),{'module':_0x2709('0x5e')});})[_0x2709('0x1e')](function(){var _0x3abc91=_0x2dcdca[_0x2709('0x5f')][_0x2709('0x60')]({'plain':!![]});if(!_0x3abc91)throw new Error(_0x2709('0x61'));if(_0x3abc91[_0x2709('0x62')]===_0x2709('0x5f')){var _0x12b9da=_0x5999c0[_0x2709('0x60')]({'plain':!![]});return db[_0x2709('0x63')]['find']({'where':{'name':'Contexts','userProfileId':_0x3abc91['userProfileId']},'raw':!![]})['then'](function(_0x371681){if(_0x371681&&_0x371681[_0x2709('0x64')]===0x0){return db[_0x2709('0x37')][_0x2709('0x57')]({'name':_0x12b9da[_0x2709('0x39')],'resourceId':_0x12b9da['id'],'type':_0x371681[_0x2709('0x39')],'sectionId':_0x371681['id']},{})[_0x2709('0x1e')](function(){return _0x5999c0;});}else{return _0x5999c0;}})[_0x2709('0x28')](function(_0x5a56a2){logger[_0x2709('0x24')](_0x2709('0x65'),_0x5a56a2);throw _0x5a56a2;});}return _0x5999c0;})[_0x2709('0x1e')](respondWithResult(_0x4fb327,0xc9))['catch'](handleError(_0x4fb327,null));};exports[_0x2709('0x66')]=function(_0x4005df,_0x4ab7e6,_0x325d4e){var _0x4341e9;return db[_0x2709('0x4f')][_0x2709('0x67')]({'where':{'id':_0x4005df[_0x2709('0x54')]['id']}})['then'](handleEntityNotFound(_0x4ab7e6,null))[_0x2709('0x1e')](saveUpdates(_0x4005df['body'],null))['then'](function(_0x2627b8){if(_0x2627b8){_0x4341e9=_0x2627b8;return db[_0x2709('0x4f')][_0x2709('0x52')]({'raw':!![]});}})[_0x2709('0x1e')](function(_0x4021e1){var _0x27d7ab=fs['readFileSync'](path[_0x2709('0x59')](config['root'],_0x2709('0x5a')),_0x2709('0x68'));var _0x569e4d=ejs[_0x2709('0x5b')](_0x27d7ab,{'contexts':_0x4021e1||[]});fs[_0x2709('0x5c')](_0x2709('0x69'),_0x569e4d);})['then'](function(){return respondWithRpcPromise(_0x2709('0x5d'),'update',{'module':_0x2709('0x5e')});})[_0x2709('0x1e')](function(){return _0x4341e9;})[_0x2709('0x1e')](respondWithResult(_0x4ab7e6,null))[_0x2709('0x28')](handleError(_0x4ab7e6,null));};exports['destroy']=function(_0x40b904,_0x479517,_0x2d6896){var _0x5be4c2;return db[_0x2709('0x4f')][_0x2709('0x67')]({'where':{'id':_0x40b904[_0x2709('0x54')]['id']}})[_0x2709('0x1e')](handleEntityNotFound(_0x479517,null))[_0x2709('0x1e')](removeEntity(_0x479517,null))['then'](function(){return db['VoiceContext'][_0x2709('0x52')]({'raw':!![]});})[_0x2709('0x1e')](function(_0x2247cc){var _0x3d1761=fs[_0x2709('0x6a')](path[_0x2709('0x59')](config['root'],_0x2709('0x5a')),'utf8');var _0x446354=ejs[_0x2709('0x5b')](_0x3d1761,{'contexts':_0x2247cc});fs[_0x2709('0x5c')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x446354);return respondWithRpcPromise(_0x2709('0x5d'),'destroy',{'module':_0x2709('0x5e')});})[_0x2709('0x28')](handleError(_0x479517,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 2849f9f..099f76f 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 _0x9b16=['VoiceContext','voice_contexts','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports','define'];(function(_0xb4fe2c,_0x3d2be6){var _0x460a1a=function(_0x2f8039){while(--_0x2f8039){_0xb4fe2c['push'](_0xb4fe2c['shift']());}};_0x460a1a(++_0x3d2be6);}(_0x9b16,0x16e));var _0x69b1=function(_0x59ea41,_0x5ef780){_0x59ea41=_0x59ea41-0x0;var _0x1d71ad=_0x9b16[_0x59ea41];return _0x1d71ad;};'use strict';var _=require(_0x69b1('0x0'));var util=require('util');var logger=require(_0x69b1('0x1'))(_0x69b1('0x2'));var moment=require(_0x69b1('0x3'));var BPromise=require('bluebird');var rp=require(_0x69b1('0x4'));var fs=require('fs');var path=require(_0x69b1('0x5'));var rimraf=require(_0x69b1('0x6'));var config=require(_0x69b1('0x7'));var attributes=require(_0x69b1('0x8'));module[_0x69b1('0x9')]=function(_0x1fc2dd,_0x5830bb){return _0x1fc2dd[_0x69b1('0xa')](_0x69b1('0xb'),attributes,{'tableName':_0x69b1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb675=['lodash','../../config/logger','api','moment','request-promise','path','./voiceContext.attributes','exports','define','voice_contexts'];(function(_0x5038b7,_0xbd4a85){var _0x4deef0=function(_0xcb2a61){while(--_0xcb2a61){_0x5038b7['push'](_0x5038b7['shift']());}};_0x4deef0(++_0xbd4a85);}(_0xb675,0xe6));var _0x5b67=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xb675[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0x5b67('0x0'));var util=require('util');var logger=require(_0x5b67('0x1'))(_0x5b67('0x2'));var moment=require(_0x5b67('0x3'));var BPromise=require('bluebird');var rp=require(_0x5b67('0x4'));var fs=require('fs');var path=require(_0x5b67('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5b67('0x6'));module[_0x5b67('0x7')]=function(_0x3c7ff6,_0x414ff0){return _0x3c7ff6[_0x5b67('0x8')]('VoiceContext',attributes,{'tableName':_0x5b67('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 1da05aa..fc43f1d 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 _0x9972=['result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1a094c,_0x30fd18){var _0x7c3ca6=function(_0xce6f1a){while(--_0xce6f1a){_0x1a094c['push'](_0x1a094c['shift']());}};_0x7c3ca6(++_0x30fd18);}(_0x9972,0xaa));var _0x2997=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x9972[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x2997('0x0'));var util=require(_0x2997('0x1'));var moment=require(_0x2997('0x2'));var BPromise=require(_0x2997('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2997('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2997('0x5'));var logger=require('../../config/logger')(_0x2997('0x6'));var config=require(_0x2997('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2997('0x8')][_0x2997('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27d795,_0x581ed1,_0x1820dc){return new BPromise(function(_0x4445bb,_0x1fe2bb){return client[_0x2997('0xa')](_0x27d795,_0x1820dc)[_0x2997('0xb')](function(_0x5d857){logger['info'](_0x2997('0xc'),_0x581ed1,_0x2997('0xd'));logger['debug'](_0x2997('0xe'),_0x581ed1,'request\x20sent',JSON[_0x2997('0xf')](_0x5d857));if(_0x5d857['error']){if(_0x5d857[_0x2997('0x10')][_0x2997('0x11')]===0x1f4){logger[_0x2997('0x10')]('VoiceContext,\x20%s,\x20%s',_0x581ed1,_0x5d857[_0x2997('0x10')][_0x2997('0x12')]);return _0x1fe2bb(_0x5d857['error'][_0x2997('0x12')]);}logger[_0x2997('0x10')](_0x2997('0xc'),_0x581ed1,_0x5d857[_0x2997('0x10')][_0x2997('0x12')]);return _0x4445bb(_0x5d857[_0x2997('0x10')][_0x2997('0x12')]);}else{logger['info'](_0x2997('0xc'),_0x581ed1,_0x2997('0xd'));_0x4445bb(_0x5d857[_0x2997('0x13')]['message']);}})[_0x2997('0x14')](function(_0x2c65d1){logger[_0x2997('0x10')](_0x2997('0xc'),_0x581ed1,_0x2c65d1);_0x1fe2bb(_0x2c65d1);});});} \ No newline at end of file +var _0x0b70=['info','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x39e73d,_0x5c14ca){var _0x4b2708=function(_0x4a29e7){while(--_0x4a29e7){_0x39e73d['push'](_0x39e73d['shift']());}};_0x4b2708(++_0x5c14ca);}(_0x0b70,0x159));var _0x00b7=function(_0x354288,_0x4f56c0){_0x354288=_0x354288-0x0;var _0x1ffbf9=_0x0b70[_0x354288];return _0x1ffbf9;};'use strict';var _=require('lodash');var util=require(_0x00b7('0x0'));var moment=require('moment');var BPromise=require(_0x00b7('0x1'));var rs=require(_0x00b7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x00b7('0x3'))['db'];var utils=require(_0x00b7('0x4'));var logger=require(_0x00b7('0x5'))('rpc');var config=require(_0x00b7('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x00b7('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f8137,_0x5a2dee,_0xa57ae4){return new BPromise(function(_0x56adcc,_0x420f35){return client[_0x00b7('0x8')](_0x3f8137,_0xa57ae4)[_0x00b7('0x9')](function(_0x203c15){logger['info'](_0x00b7('0xa'),_0x5a2dee,_0x00b7('0xb'));logger[_0x00b7('0xc')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x5a2dee,_0x00b7('0xb'),JSON['stringify'](_0x203c15));if(_0x203c15[_0x00b7('0xd')]){if(_0x203c15[_0x00b7('0xd')][_0x00b7('0xe')]===0x1f4){logger[_0x00b7('0xd')](_0x00b7('0xa'),_0x5a2dee,_0x203c15[_0x00b7('0xd')][_0x00b7('0xf')]);return _0x420f35(_0x203c15[_0x00b7('0xd')][_0x00b7('0xf')]);}logger[_0x00b7('0xd')]('VoiceContext,\x20%s,\x20%s',_0x5a2dee,_0x203c15[_0x00b7('0xd')][_0x00b7('0xf')]);return _0x56adcc(_0x203c15['error']['message']);}else{logger[_0x00b7('0x10')](_0x00b7('0xa'),_0x5a2dee,_0x00b7('0xb'));_0x56adcc(_0x203c15[_0x00b7('0x11')][_0x00b7('0xf')]);}})[_0x00b7('0x12')](function(_0x342b82){logger[_0x00b7('0xd')]('VoiceContext,\x20%s,\x20%s',_0x5a2dee,_0x342b82);_0x420f35(_0x342b82);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 09923b3..d5e29dc 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 _0x7119=['/:id','update','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceDialReport.controller','get','isAuthenticated','index','describe','post','create'];(function(_0x5ce56c,_0x27e813){var _0x528aac=function(_0x500983){while(--_0x500983){_0x5ce56c['push'](_0x5ce56c['shift']());}};_0x528aac(++_0x27e813);}(_0x7119,0x1c7));var _0x9711=function(_0x576d8a,_0x2d7bde){_0x576d8a=_0x576d8a-0x0;var _0x3dc3ef=_0x7119[_0x576d8a];return _0x3dc3ef;};'use strict';var multer=require('multer');var util=require(_0x9711('0x0'));var path=require('path');var timeout=require(_0x9711('0x1'));var express=require('express');var router=express[_0x9711('0x2')]();var fs_extra=require(_0x9711('0x3'));var auth=require(_0x9711('0x4'));var interaction=require(_0x9711('0x5'));var config=require('../../config/environment');var controller=require(_0x9711('0x6'));router[_0x9711('0x7')]('/',auth[_0x9711('0x8')](),controller[_0x9711('0x9')]);router[_0x9711('0x7')]('/describe',auth[_0x9711('0x8')](),controller[_0x9711('0xa')]);router[_0x9711('0x7')]('/:id',auth[_0x9711('0x8')](),controller['show']);router[_0x9711('0xb')]('/',auth[_0x9711('0x8')](),controller[_0x9711('0xc')]);router['put'](_0x9711('0xd'),auth[_0x9711('0x8')](),controller[_0x9711('0xe')]);router[_0x9711('0xf')](_0x9711('0xd'),auth[_0x9711('0x8')](),controller[_0x9711('0x10')]);module[_0x9711('0x11')]=router; \ No newline at end of file +var _0xec37=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceDialReport.controller','get','index','/describe','isAuthenticated','/:id','show','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x299027,_0x5d2e4f){var _0x1bc622=function(_0x281430){while(--_0x281430){_0x299027['push'](_0x299027['shift']());}};_0x1bc622(++_0x5d2e4f);}(_0xec37,0x1e0));var _0x7ec3=function(_0x1ccbcc,_0x5c948b){_0x1ccbcc=_0x1ccbcc-0x0;var _0x1e873f=_0xec37[_0x1ccbcc];return _0x1e873f;};'use strict';var multer=require(_0x7ec3('0x0'));var util=require(_0x7ec3('0x1'));var path=require(_0x7ec3('0x2'));var timeout=require(_0x7ec3('0x3'));var express=require(_0x7ec3('0x4'));var router=express[_0x7ec3('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7ec3('0x6'));var interaction=require(_0x7ec3('0x7'));var config=require('../../config/environment');var controller=require(_0x7ec3('0x8'));router[_0x7ec3('0x9')]('/',auth['isAuthenticated'](),controller[_0x7ec3('0xa')]);router[_0x7ec3('0x9')](_0x7ec3('0xb'),auth[_0x7ec3('0xc')](),controller['describe']);router[_0x7ec3('0x9')](_0x7ec3('0xd'),auth[_0x7ec3('0xc')](),controller[_0x7ec3('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7ec3('0xf')]);router[_0x7ec3('0x10')](_0x7ec3('0xd'),auth[_0x7ec3('0xc')](),controller[_0x7ec3('0x11')]);router[_0x7ec3('0x12')]('/:id',auth[_0x7ec3('0xc')](),controller[_0x7ec3('0x13')]);module[_0x7ec3('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index de719d3..52ae336 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 _0x6aa7=['called,connect,complete','sequelize','STRING','INTEGER','DATE'];(function(_0x3299ea,_0x5196c0){var _0xe9255=function(_0x122d1f){while(--_0x122d1f){_0x3299ea['push'](_0x3299ea['shift']());}};_0xe9255(++_0x5196c0);}(_0x6aa7,0x178));var _0x76aa=function(_0x80b1f2,_0x80544f){_0x80b1f2=_0x80b1f2-0x0;var _0x15a1ad=_0x6aa7[_0x80b1f2];return _0x15a1ad;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'privilege':{'type':Sequelize[_0x76aa('0x1')]},'channel':{'type':Sequelize[_0x76aa('0x1')]},'channelstate':{'type':Sequelize[_0x76aa('0x2')]},'channelstatedesc':{'type':Sequelize[_0x76aa('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x76aa('0x1')]},'connectedlinenum':{'type':Sequelize[_0x76aa('0x1')]},'connectedlinename':{'type':Sequelize[_0x76aa('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x76aa('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x76aa('0x2')]},'uniqueid':{'type':Sequelize[_0x76aa('0x1')]},'linkedid':{'type':Sequelize[_0x76aa('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x76aa('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x76aa('0x1')]},'destcalleridnum':{'type':Sequelize[_0x76aa('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x76aa('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x76aa('0x1')]},'destlanguage':{'type':Sequelize[_0x76aa('0x1')]},'destaccountcode':{'type':Sequelize[_0x76aa('0x1')]},'destcontext':{'type':Sequelize[_0x76aa('0x1')]},'destexten':{'type':Sequelize[_0x76aa('0x1')]},'destpriority':{'type':Sequelize[_0x76aa('0x2')]},'destuniqueid':{'type':Sequelize[_0x76aa('0x1')]},'destlinkedid':{'type':Sequelize[_0x76aa('0x1')]},'dialstring':{'type':Sequelize[_0x76aa('0x1')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x76aa('0x3')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x76aa('0x3')]},'lastevent':{'type':Sequelize[_0x76aa('0x1')],'comment':_0x76aa('0x4')},'routeId':{'type':Sequelize[_0x76aa('0x2')]},'duration':{'type':Sequelize[_0x76aa('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x425d=['sequelize','STRING','INTEGER','DATE'];(function(_0x3571bb,_0x192c86){var _0x23aad4=function(_0x5180a9){while(--_0x5180a9){_0x3571bb['push'](_0x3571bb['shift']());}};_0x23aad4(++_0x192c86);}(_0x425d,0x1e0));var _0xd425=function(_0xc5bb7f,_0x336c16){_0xc5bb7f=_0xc5bb7f-0x0;var _0x5ed8f7=_0x425d[_0xc5bb7f];return _0x5ed8f7;};'use strict';var Sequelize=require(_0xd425('0x0'));module['exports']={'privilege':{'type':Sequelize[_0xd425('0x1')]},'channel':{'type':Sequelize[_0xd425('0x1')]},'channelstate':{'type':Sequelize[_0xd425('0x2')]},'channelstatedesc':{'type':Sequelize[_0xd425('0x1')]},'calleridnum':{'type':Sequelize[_0xd425('0x1')]},'calleridname':{'type':Sequelize[_0xd425('0x1')]},'connectedlinenum':{'type':Sequelize[_0xd425('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xd425('0x1')]},'accountcode':{'type':Sequelize[_0xd425('0x1')]},'context':{'type':Sequelize[_0xd425('0x1')]},'exten':{'type':Sequelize[_0xd425('0x1')]},'priority':{'type':Sequelize[_0xd425('0x2')]},'uniqueid':{'type':Sequelize[_0xd425('0x1')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xd425('0x1')]},'destchannelstate':{'type':Sequelize[_0xd425('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xd425('0x1')]},'destcalleridnum':{'type':Sequelize[_0xd425('0x1')]},'destcalleridname':{'type':Sequelize[_0xd425('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xd425('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xd425('0x1')]},'destlanguage':{'type':Sequelize[_0xd425('0x1')]},'destaccountcode':{'type':Sequelize[_0xd425('0x1')]},'destcontext':{'type':Sequelize[_0xd425('0x1')]},'destexten':{'type':Sequelize[_0xd425('0x1')]},'destpriority':{'type':Sequelize[_0xd425('0x2')]},'destuniqueid':{'type':Sequelize[_0xd425('0x1')]},'destlinkedid':{'type':Sequelize[_0xd425('0x1')]},'dialstring':{'type':Sequelize[_0xd425('0x1')]},'dialstatus':{'type':Sequelize[_0xd425('0x1')]},'starttime':{'type':Sequelize[_0xd425('0x3')]},'answertime':{'type':Sequelize[_0xd425('0x3')]},'endtime':{'type':Sequelize[_0xd425('0x3')]},'lastevent':{'type':Sequelize[_0xd425('0x1')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xd425('0x2')]},'duration':{'type':Sequelize[_0xd425('0x2')]},'holdtime':{'type':Sequelize[_0xd425('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 ad03304..6913af1 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 _0xb0b5=['request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','apply','reject','save','update','destroy','then','end','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','VoiceDialReport','includeAll','include','rows','show','params','options','create','body','catch','find','describe','rimraf','zip-dir','fast-json-patch'];(function(_0x38a998,_0x37b7f1){var _0x1160eb=function(_0x29c38b){while(--_0x29c38b){_0x38a998['push'](_0x38a998['shift']());}};_0x1160eb(++_0x37b7f1);}(_0xb0b5,0x12d));var _0x5b0b=function(_0x5c80c1,_0x4f80ca){_0x5c80c1=_0x5c80c1-0x0;var _0xb74ac=_0xb0b5[_0x5c80c1];return _0xb74ac;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5b0b('0x0'));var zipdir=require(_0x5b0b('0x1'));var jsonpatch=require(_0x5b0b('0x2'));var rp=require(_0x5b0b('0x3'));var moment=require('moment');var BPromise=require(_0x5b0b('0x4'));var Mustache=require(_0x5b0b('0x5'));var util=require(_0x5b0b('0x6'));var path=require(_0x5b0b('0x7'));var sox=require(_0x5b0b('0x8'));var csv=require(_0x5b0b('0x9'));var ejs=require(_0x5b0b('0xa'));var fs=require('fs');var fs_extra=require(_0x5b0b('0xb'));var _=require(_0x5b0b('0xc'));var squel=require(_0x5b0b('0xd'));var crypto=require('crypto');var jsforce=require(_0x5b0b('0xe'));var deskjs=require(_0x5b0b('0xf'));var toCsv=require(_0x5b0b('0x9'));var querystring=require(_0x5b0b('0x10'));var Papa=require(_0x5b0b('0x11'));var Redis=require(_0x5b0b('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x5b0b('0x13'));var as=require(_0x5b0b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5b0b('0x15'))('api');var utils=require(_0x5b0b('0x16'));var config=require(_0x5b0b('0x17'));var licenseUtil=require(_0x5b0b('0x18'));var db=require(_0x5b0b('0x19'))['db'];function respondWithStatusCode(_0x2bf08d,_0x5e0295){_0x5e0295=_0x5e0295||0xcc;return function(_0x425ce5){if(_0x425ce5){return _0x2bf08d[_0x5b0b('0x1a')](_0x5e0295);}return _0x2bf08d[_0x5b0b('0x1b')](_0x5e0295)['end']();};}function respondWithResult(_0x44c438,_0x136d25){_0x136d25=_0x136d25||0xc8;return function(_0x560e83){if(_0x560e83){return _0x44c438[_0x5b0b('0x1b')](_0x136d25)[_0x5b0b('0x1c')](_0x560e83);}};}function respondWithFilteredResult(_0x4b0e33,_0x2125da){return function(_0x3459d0){if(_0x3459d0){var _0x586e3c=typeof _0x2125da[_0x5b0b('0x1d')]===_0x5b0b('0x1e')&&typeof _0x2125da[_0x5b0b('0x1f')]===_0x5b0b('0x1e');var _0x7b77b7=_0x3459d0[_0x5b0b('0x20')];var _0x3808fd=_0x586e3c?0x0:_0x2125da[_0x5b0b('0x1d')];var _0x39ae82=_0x586e3c?_0x3459d0[_0x5b0b('0x20')]:_0x2125da['offset']+_0x2125da['limit'];var _0x565d83;if(_0x39ae82>=_0x7b77b7){_0x39ae82=_0x7b77b7;_0x565d83=0xc8;}else{_0x565d83=0xce;}_0x4b0e33[_0x5b0b('0x1b')](_0x565d83);return _0x4b0e33['set']('Content-Range',_0x3808fd+'-'+_0x39ae82+'/'+_0x7b77b7)[_0x5b0b('0x1c')](_0x3459d0);}return null;};}function patchUpdates(_0x7c22bc){return function(_0x9ae7e7){try{jsonpatch[_0x5b0b('0x21')](_0x9ae7e7,_0x7c22bc,!![]);}catch(_0x5417e0){return BPromise[_0x5b0b('0x22')](_0x5417e0);}return _0x9ae7e7[_0x5b0b('0x23')]();};}function saveUpdates(_0xe7cbbc,_0x383411){return function(_0x20c7d3){if(_0x20c7d3){return _0x20c7d3[_0x5b0b('0x24')](_0xe7cbbc)['then'](function(_0x12d4e1){return _0x12d4e1;});}return null;};}function removeEntity(_0x4f1dcc,_0x37ea7e){return function(_0x12280f){if(_0x12280f){return _0x12280f[_0x5b0b('0x25')]()[_0x5b0b('0x26')](function(){_0x4f1dcc['status'](0xcc)[_0x5b0b('0x27')]();});}};}function handleEntityNotFound(_0x4dbbb7,_0xb137cb){return function(_0xdf309c){if(!_0xdf309c){_0x4dbbb7[_0x5b0b('0x1a')](0x194);}return _0xdf309c;};}function handleError(_0x5cd35a,_0x3dccc6){_0x3dccc6=_0x3dccc6||0x1f4;return function(_0x1b1889){logger[_0x5b0b('0x28')](_0x1b1889['stack']);if(_0x1b1889[_0x5b0b('0x29')]){delete _0x1b1889[_0x5b0b('0x29')];}_0x5cd35a[_0x5b0b('0x1b')](_0x3dccc6)[_0x5b0b('0x2a')](_0x1b1889);};}exports[_0x5b0b('0x2b')]=function(_0x44a9d0,_0x1f83b5){var _0x686357={},_0x135d4f={},_0x474206={'count':0x0,'rows':[]};var _0x24dc4b=_[_0x5b0b('0x2c')](db['VoiceDialReport'][_0x5b0b('0x2d')],function(_0x1a5adb){return{'name':_0x1a5adb[_0x5b0b('0x2e')],'type':_0x1a5adb[_0x5b0b('0x2f')][_0x5b0b('0x30')]};});_0x135d4f[_0x5b0b('0x31')]=_[_0x5b0b('0x2c')](_0x24dc4b,_0x5b0b('0x29'));_0x135d4f[_0x5b0b('0x32')]=_[_0x5b0b('0x33')](_0x44a9d0[_0x5b0b('0x32')]);_0x135d4f[_0x5b0b('0x34')]=_[_0x5b0b('0x35')](_0x135d4f[_0x5b0b('0x31')],_0x135d4f[_0x5b0b('0x32')]);_0x686357[_0x5b0b('0x36')]=_[_0x5b0b('0x35')](_0x135d4f[_0x5b0b('0x31')],qs[_0x5b0b('0x37')](_0x44a9d0[_0x5b0b('0x32')][_0x5b0b('0x37')]));_0x686357[_0x5b0b('0x36')]=_0x686357[_0x5b0b('0x36')][_0x5b0b('0x38')]?_0x686357[_0x5b0b('0x36')]:_0x135d4f[_0x5b0b('0x31')];if(!_0x44a9d0['query'][_0x5b0b('0x39')]('nolimit')){_0x686357['limit']=qs[_0x5b0b('0x1f')](_0x44a9d0[_0x5b0b('0x32')][_0x5b0b('0x1f')]);_0x686357['offset']=qs['offset'](_0x44a9d0['query']['offset']);}_0x686357[_0x5b0b('0x3a')]=qs[_0x5b0b('0x3b')](_0x44a9d0[_0x5b0b('0x32')][_0x5b0b('0x3b')]);_0x686357['where']=qs[_0x5b0b('0x34')](_['pick'](_0x44a9d0['query'],_0x135d4f[_0x5b0b('0x34')]),_0x24dc4b);if(_0x44a9d0['query'][_0x5b0b('0x3c')]){_0x686357[_0x5b0b('0x3d')]=_[_0x5b0b('0x3e')](_0x686357[_0x5b0b('0x3d')],{'$or':_[_0x5b0b('0x2c')](_0x24dc4b,function(_0x36461c){if(_0x36461c[_0x5b0b('0x2f')]!==_0x5b0b('0x3f')){var _0x251682={};_0x251682[_0x36461c[_0x5b0b('0x29')]]={'$like':'%'+_0x44a9d0['query'][_0x5b0b('0x3c')]+'%'};return _0x251682;}})});}_0x686357=_[_0x5b0b('0x3e')]({},_0x686357,_0x44a9d0['options']);var _0x2cc29d={'where':_0x686357['where']};return db[_0x5b0b('0x40')][_0x5b0b('0x20')](_0x2cc29d)[_0x5b0b('0x26')](function(_0x431b25){_0x474206[_0x5b0b('0x20')]=_0x431b25;if(_0x44a9d0[_0x5b0b('0x32')][_0x5b0b('0x41')]){_0x686357[_0x5b0b('0x42')]=[{'all':!![]}];}return db[_0x5b0b('0x40')]['findAll'](_0x686357);})[_0x5b0b('0x26')](function(_0x126884){_0x474206[_0x5b0b('0x43')]=_0x126884;return _0x474206;})[_0x5b0b('0x26')](respondWithFilteredResult(_0x1f83b5,_0x686357))['catch'](handleError(_0x1f83b5,null));};exports[_0x5b0b('0x44')]=function(_0x5aa666,_0x38ea51){var _0x537241={'raw':!![],'where':{'id':_0x5aa666[_0x5b0b('0x45')]['id']}},_0x421fdf={};_0x421fdf['model']=_['keys'](db['VoiceDialReport']['rawAttributes']);_0x421fdf[_0x5b0b('0x32')]=_['keys'](_0x5aa666[_0x5b0b('0x32')]);_0x421fdf[_0x5b0b('0x34')]=_['intersection'](_0x421fdf['model'],_0x421fdf[_0x5b0b('0x32')]);_0x537241[_0x5b0b('0x36')]=_[_0x5b0b('0x35')](_0x421fdf[_0x5b0b('0x31')],qs['fields'](_0x5aa666[_0x5b0b('0x32')][_0x5b0b('0x37')]));_0x537241['attributes']=_0x537241['attributes']['length']?_0x537241[_0x5b0b('0x36')]:_0x421fdf[_0x5b0b('0x31')];if(_0x5aa666[_0x5b0b('0x32')][_0x5b0b('0x41')]){_0x537241[_0x5b0b('0x42')]=[{'all':!![]}];}_0x537241=_[_0x5b0b('0x3e')]({},_0x537241,_0x5aa666[_0x5b0b('0x46')]);return db['VoiceDialReport']['find'](_0x537241)[_0x5b0b('0x26')](handleEntityNotFound(_0x38ea51,null))[_0x5b0b('0x26')](respondWithResult(_0x38ea51,null))['catch'](handleError(_0x38ea51,null));};exports[_0x5b0b('0x47')]=function(_0x220724,_0x138b96){return db[_0x5b0b('0x40')][_0x5b0b('0x47')](_0x220724[_0x5b0b('0x48')],{})[_0x5b0b('0x26')](respondWithResult(_0x138b96,0xc9))[_0x5b0b('0x49')](handleError(_0x138b96,null));};exports[_0x5b0b('0x24')]=function(_0x12473a,_0x2cf7ab){if(_0x12473a[_0x5b0b('0x48')]['id']){delete _0x12473a[_0x5b0b('0x48')]['id'];}return db[_0x5b0b('0x40')][_0x5b0b('0x4a')]({'where':{'id':_0x12473a[_0x5b0b('0x45')]['id']}})['then'](handleEntityNotFound(_0x2cf7ab,null))[_0x5b0b('0x26')](saveUpdates(_0x12473a[_0x5b0b('0x48')],null))[_0x5b0b('0x26')](respondWithResult(_0x2cf7ab,null))[_0x5b0b('0x49')](handleError(_0x2cf7ab,null));};exports[_0x5b0b('0x25')]=function(_0x239a01,_0x1c28c1){return db[_0x5b0b('0x40')]['find']({'where':{'id':_0x239a01[_0x5b0b('0x45')]['id']}})[_0x5b0b('0x26')](handleEntityNotFound(_0x1c28c1,null))[_0x5b0b('0x26')](removeEntity(_0x1c28c1,null))[_0x5b0b('0x49')](handleError(_0x1c28c1,null));};exports['describe']=function(_0x58b6fb,_0x2fd3f9){return db[_0x5b0b('0x40')][_0x5b0b('0x4b')]()[_0x5b0b('0x26')](respondWithResult(_0x2fd3f9,null))['catch'](handleError(_0x2fd3f9,null));}; \ No newline at end of file +var _0xc40d=['api','../../config/utils','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','apply','save','then','destroy','end','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','includeAll','findAll','rows','catch','show','params','VoiceDialReport','create','body','update','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x996bc8,_0x291e01){var _0x20b0ea=function(_0x5ba992){while(--_0x5ba992){_0x996bc8['push'](_0x996bc8['shift']());}};_0x20b0ea(++_0x291e01);}(_0xc40d,0x19b));var _0xdc40=function(_0x905e7e,_0x4ee055){_0x905e7e=_0x905e7e-0x0;var _0x23249b=_0xc40d[_0x905e7e];return _0x23249b;};'use strict';var emlformat=require(_0xdc40('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdc40('0x1'));var jsonpatch=require(_0xdc40('0x2'));var rp=require(_0xdc40('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdc40('0x4'));var path=require(_0xdc40('0x5'));var sox=require(_0xdc40('0x6'));var csv=require('to-csv');var ejs=require(_0xdc40('0x7'));var fs=require('fs');var fs_extra=require(_0xdc40('0x8'));var _=require(_0xdc40('0x9'));var squel=require(_0xdc40('0xa'));var crypto=require('crypto');var jsforce=require(_0xdc40('0xb'));var deskjs=require(_0xdc40('0xc'));var toCsv=require(_0xdc40('0xd'));var querystring=require(_0xdc40('0xe'));var Papa=require(_0xdc40('0xf'));var Redis=require(_0xdc40('0x10'));var authService=require(_0xdc40('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xdc40('0x12'));var hardwareService=require(_0xdc40('0x13'));var logger=require(_0xdc40('0x14'))(_0xdc40('0x15'));var utils=require(_0xdc40('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdc40('0x17'))['db'];function respondWithStatusCode(_0x24887b,_0x42b8ec){_0x42b8ec=_0x42b8ec||0xcc;return function(_0x453053){if(_0x453053){return _0x24887b[_0xdc40('0x18')](_0x42b8ec);}return _0x24887b[_0xdc40('0x19')](_0x42b8ec)['end']();};}function respondWithResult(_0x5e62d5,_0x3aa8d8){_0x3aa8d8=_0x3aa8d8||0xc8;return function(_0x292e26){if(_0x292e26){return _0x5e62d5['status'](_0x3aa8d8)[_0xdc40('0x1a')](_0x292e26);}};}function respondWithFilteredResult(_0x37b1a3,_0x167258){return function(_0x15e98d){if(_0x15e98d){var _0x120ea4=typeof _0x167258['offset']===_0xdc40('0x1b')&&typeof _0x167258[_0xdc40('0x1c')]===_0xdc40('0x1b');var _0x45928b=_0x15e98d[_0xdc40('0x1d')];var _0x145a39=_0x120ea4?0x0:_0x167258['offset'];var _0x3a2d69=_0x120ea4?_0x15e98d[_0xdc40('0x1d')]:_0x167258[_0xdc40('0x1e')]+_0x167258[_0xdc40('0x1c')];var _0x40b97b;if(_0x3a2d69>=_0x45928b){_0x3a2d69=_0x45928b;_0x40b97b=0xc8;}else{_0x40b97b=0xce;}_0x37b1a3['status'](_0x40b97b);return _0x37b1a3[_0xdc40('0x1f')]('Content-Range',_0x145a39+'-'+_0x3a2d69+'/'+_0x45928b)['json'](_0x15e98d);}return null;};}function patchUpdates(_0x6d5add){return function(_0x309155){try{jsonpatch[_0xdc40('0x20')](_0x309155,_0x6d5add,!![]);}catch(_0x201088){return BPromise['reject'](_0x201088);}return _0x309155[_0xdc40('0x21')]();};}function saveUpdates(_0x10c45c,_0x2e7d09){return function(_0x1b9c7c){if(_0x1b9c7c){return _0x1b9c7c['update'](_0x10c45c)[_0xdc40('0x22')](function(_0x3c6a5d){return _0x3c6a5d;});}return null;};}function removeEntity(_0x153690,_0x282fe1){return function(_0x42dbd7){if(_0x42dbd7){return _0x42dbd7[_0xdc40('0x23')]()[_0xdc40('0x22')](function(){_0x153690[_0xdc40('0x19')](0xcc)[_0xdc40('0x24')]();});}};}function handleEntityNotFound(_0x545e62,_0x15284b){return function(_0x14bf7c){if(!_0x14bf7c){_0x545e62[_0xdc40('0x18')](0x194);}return _0x14bf7c;};}function handleError(_0xe9f308,_0x4a4704){_0x4a4704=_0x4a4704||0x1f4;return function(_0x33760d){logger[_0xdc40('0x25')](_0x33760d[_0xdc40('0x26')]);if(_0x33760d[_0xdc40('0x27')]){delete _0x33760d[_0xdc40('0x27')];}_0xe9f308[_0xdc40('0x19')](_0x4a4704)[_0xdc40('0x28')](_0x33760d);};}exports[_0xdc40('0x29')]=function(_0x43c9af,_0x538df9){var _0x281f68={},_0x227cb2={},_0x5540cd={'count':0x0,'rows':[]};var _0x4814dd=_[_0xdc40('0x2a')](db['VoiceDialReport'][_0xdc40('0x2b')],function(_0x26d6e2){return{'name':_0x26d6e2['fieldName'],'type':_0x26d6e2[_0xdc40('0x2c')][_0xdc40('0x2d')]};});_0x227cb2[_0xdc40('0x2e')]=_[_0xdc40('0x2a')](_0x4814dd,_0xdc40('0x27'));_0x227cb2[_0xdc40('0x2f')]=_[_0xdc40('0x30')](_0x43c9af[_0xdc40('0x2f')]);_0x227cb2[_0xdc40('0x31')]=_[_0xdc40('0x32')](_0x227cb2[_0xdc40('0x2e')],_0x227cb2[_0xdc40('0x2f')]);_0x281f68[_0xdc40('0x33')]=_[_0xdc40('0x32')](_0x227cb2[_0xdc40('0x2e')],qs[_0xdc40('0x34')](_0x43c9af['query'][_0xdc40('0x34')]));_0x281f68['attributes']=_0x281f68[_0xdc40('0x33')][_0xdc40('0x35')]?_0x281f68[_0xdc40('0x33')]:_0x227cb2[_0xdc40('0x2e')];if(!_0x43c9af[_0xdc40('0x2f')][_0xdc40('0x36')](_0xdc40('0x37'))){_0x281f68[_0xdc40('0x1c')]=qs[_0xdc40('0x1c')](_0x43c9af['query'][_0xdc40('0x1c')]);_0x281f68[_0xdc40('0x1e')]=qs[_0xdc40('0x1e')](_0x43c9af[_0xdc40('0x2f')][_0xdc40('0x1e')]);}_0x281f68['order']=qs[_0xdc40('0x38')](_0x43c9af[_0xdc40('0x2f')][_0xdc40('0x38')]);_0x281f68[_0xdc40('0x39')]=qs[_0xdc40('0x31')](_['pick'](_0x43c9af['query'],_0x227cb2[_0xdc40('0x31')]),_0x4814dd);if(_0x43c9af[_0xdc40('0x2f')][_0xdc40('0x3a')]){_0x281f68[_0xdc40('0x39')]=_[_0xdc40('0x3b')](_0x281f68[_0xdc40('0x39')],{'$or':_[_0xdc40('0x2a')](_0x4814dd,function(_0x39d6d5){if(_0x39d6d5[_0xdc40('0x2c')]!=='VIRTUAL'){var _0x41b921={};_0x41b921[_0x39d6d5[_0xdc40('0x27')]]={'$like':'%'+_0x43c9af[_0xdc40('0x2f')][_0xdc40('0x3a')]+'%'};return _0x41b921;}})});}_0x281f68=_[_0xdc40('0x3b')]({},_0x281f68,_0x43c9af['options']);var _0xe09f30={'where':_0x281f68[_0xdc40('0x39')]};return db['VoiceDialReport'][_0xdc40('0x1d')](_0xe09f30)[_0xdc40('0x22')](function(_0x395dd0){_0x5540cd['count']=_0x395dd0;if(_0x43c9af[_0xdc40('0x2f')][_0xdc40('0x3c')]){_0x281f68['include']=[{'all':!![]}];}return db['VoiceDialReport'][_0xdc40('0x3d')](_0x281f68);})[_0xdc40('0x22')](function(_0x4a67e5){_0x5540cd[_0xdc40('0x3e')]=_0x4a67e5;return _0x5540cd;})['then'](respondWithFilteredResult(_0x538df9,_0x281f68))[_0xdc40('0x3f')](handleError(_0x538df9,null));};exports[_0xdc40('0x40')]=function(_0x27482f,_0x2043be){var _0x211656={'raw':!![],'where':{'id':_0x27482f[_0xdc40('0x41')]['id']}},_0x39b66e={};_0x39b66e[_0xdc40('0x2e')]=_['keys'](db['VoiceDialReport'][_0xdc40('0x2b')]);_0x39b66e[_0xdc40('0x2f')]=_['keys'](_0x27482f[_0xdc40('0x2f')]);_0x39b66e[_0xdc40('0x31')]=_['intersection'](_0x39b66e[_0xdc40('0x2e')],_0x39b66e[_0xdc40('0x2f')]);_0x211656[_0xdc40('0x33')]=_[_0xdc40('0x32')](_0x39b66e[_0xdc40('0x2e')],qs[_0xdc40('0x34')](_0x27482f[_0xdc40('0x2f')][_0xdc40('0x34')]));_0x211656['attributes']=_0x211656[_0xdc40('0x33')][_0xdc40('0x35')]?_0x211656[_0xdc40('0x33')]:_0x39b66e['model'];if(_0x27482f['query'][_0xdc40('0x3c')]){_0x211656['include']=[{'all':!![]}];}_0x211656=_[_0xdc40('0x3b')]({},_0x211656,_0x27482f['options']);return db[_0xdc40('0x42')]['find'](_0x211656)[_0xdc40('0x22')](handleEntityNotFound(_0x2043be,null))[_0xdc40('0x22')](respondWithResult(_0x2043be,null))[_0xdc40('0x3f')](handleError(_0x2043be,null));};exports[_0xdc40('0x43')]=function(_0x4f1784,_0x5385e1){return db[_0xdc40('0x42')]['create'](_0x4f1784[_0xdc40('0x44')],{})[_0xdc40('0x22')](respondWithResult(_0x5385e1,0xc9))[_0xdc40('0x3f')](handleError(_0x5385e1,null));};exports[_0xdc40('0x45')]=function(_0x4e02f8,_0x283c90){if(_0x4e02f8[_0xdc40('0x44')]['id']){delete _0x4e02f8[_0xdc40('0x44')]['id'];}return db[_0xdc40('0x42')][_0xdc40('0x46')]({'where':{'id':_0x4e02f8['params']['id']}})[_0xdc40('0x22')](handleEntityNotFound(_0x283c90,null))[_0xdc40('0x22')](saveUpdates(_0x4e02f8[_0xdc40('0x44')],null))[_0xdc40('0x22')](respondWithResult(_0x283c90,null))[_0xdc40('0x3f')](handleError(_0x283c90,null));};exports[_0xdc40('0x23')]=function(_0x356e21,_0x4fd960){return db['VoiceDialReport'][_0xdc40('0x46')]({'where':{'id':_0x356e21[_0xdc40('0x41')]['id']}})[_0xdc40('0x22')](handleEntityNotFound(_0x4fd960,null))[_0xdc40('0x22')](removeEntity(_0x4fd960,null))['catch'](handleError(_0x4fd960,null));};exports[_0xdc40('0x47')]=function(_0x15214f,_0x10ed77){return db[_0xdc40('0x42')][_0xdc40('0x47')]()[_0xdc40('0x22')](respondWithResult(_0x10ed77,null))['catch'](handleError(_0x10ed77,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 40dcdd3..6587089 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 _0xa16e=['api','bluebird','request-promise','path','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','lodash'];(function(_0x57cb4f,_0x541f57){var _0x29bb45=function(_0x462bee){while(--_0x462bee){_0x57cb4f['push'](_0x57cb4f['shift']());}};_0x29bb45(++_0x541f57);}(_0xa16e,0x133));var _0xea16=function(_0x169ef9,_0x2ce3ab){_0x169ef9=_0x169ef9-0x0;var _0x5910a0=_0xa16e[_0x169ef9];return _0x5910a0;};'use strict';var _=require(_0xea16('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xea16('0x1'));var moment=require('moment');var BPromise=require(_0xea16('0x2'));var rp=require(_0xea16('0x3'));var fs=require('fs');var path=require(_0xea16('0x4'));var rimraf=require('rimraf');var config=require(_0xea16('0x5'));var attributes=require(_0xea16('0x6'));module[_0xea16('0x7')]=function(_0x5979d8,_0x20d943){return _0x5979d8[_0xea16('0x8')](_0xea16('0x9'),attributes,{'tableName':_0xea16('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf44c=['request-promise','define','VoiceDialReport','report_dial','uniqueid','lodash','../../config/logger','api','moment','bluebird'];(function(_0x1a15ed,_0x269dc4){var _0x386030=function(_0x4a7111){while(--_0x4a7111){_0x1a15ed['push'](_0x1a15ed['shift']());}};_0x386030(++_0x269dc4);}(_0xf44c,0x163));var _0xcf44=function(_0x1ca03d,_0x591fc4){_0x1ca03d=_0x1ca03d-0x0;var _0x31ce7d=_0xf44c[_0x1ca03d];return _0x31ce7d;};'use strict';var _=require(_0xcf44('0x0'));var util=require('util');var logger=require(_0xcf44('0x1'))(_0xcf44('0x2'));var moment=require(_0xcf44('0x3'));var BPromise=require(_0xcf44('0x4'));var rp=require(_0xcf44('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceDialReport.attributes');module['exports']=function(_0x14485c,_0x3b1eb0){return _0x14485c[_0xcf44('0x6')](_0xcf44('0x7'),attributes,{'tableName':_0xcf44('0x8'),'paranoid':![],'indexes':[{'fields':[_0xcf44('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index a767e08..2510894 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 _0xbe31=['UpdateVoiceDialReport','where','limit','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','CreateVoiceDialReport','VoiceDialReport','create','options','raw'];(function(_0x5c0776,_0x4f7ccb){var _0x1bf7e9=function(_0x238b78){while(--_0x238b78){_0x5c0776['push'](_0x5c0776['shift']());}};_0x1bf7e9(++_0x4f7ccb);}(_0xbe31,0x16b));var _0x1be3=function(_0x30affd,_0x47df28){_0x30affd=_0x30affd-0x0;var _0x97122d=_0xbe31[_0x30affd];return _0x97122d;};'use strict';var _=require('lodash');var util=require(_0x1be3('0x0'));var moment=require(_0x1be3('0x1'));var BPromise=require('bluebird');var rs=require(_0x1be3('0x2'));var fs=require('fs');var Redis=require(_0x1be3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1be3('0x4'));var logger=require(_0x1be3('0x5'))(_0x1be3('0x6'));var config=require(_0x1be3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1be3('0x8')][_0x1be3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a9d38,_0x509128,_0x4d6bec){return new BPromise(function(_0x1909fa,_0x3da8e3){return client[_0x1be3('0xa')](_0x2a9d38,_0x4d6bec)[_0x1be3('0xb')](function(_0x3091b9){logger['info'](_0x1be3('0xc'),_0x509128,_0x1be3('0xd'));logger[_0x1be3('0xe')](_0x1be3('0xf'),_0x509128,_0x1be3('0xd'),JSON[_0x1be3('0x10')](_0x3091b9));if(_0x3091b9['error']){if(_0x3091b9[_0x1be3('0x11')]['code']===0x1f4){logger[_0x1be3('0x11')](_0x1be3('0xc'),_0x509128,_0x3091b9[_0x1be3('0x11')][_0x1be3('0x12')]);return _0x3da8e3(_0x3091b9[_0x1be3('0x11')][_0x1be3('0x12')]);}logger[_0x1be3('0x11')](_0x1be3('0xc'),_0x509128,_0x3091b9[_0x1be3('0x11')][_0x1be3('0x12')]);return _0x1909fa(_0x3091b9[_0x1be3('0x11')][_0x1be3('0x12')]);}else{logger[_0x1be3('0x13')](_0x1be3('0xc'),_0x509128,_0x1be3('0xd'));_0x1909fa(_0x3091b9[_0x1be3('0x14')][_0x1be3('0x12')]);}})[_0x1be3('0x15')](function(_0x88463a){logger[_0x1be3('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x509128,_0x88463a);_0x3da8e3(_0x88463a);});});}exports[_0x1be3('0x16')]=function(_0x10d897){var _0x1b2a7c=this;return new Promise(function(_0x187d72,_0x363b6d){return db[_0x1be3('0x17')][_0x1be3('0x18')](_0x10d897['body'],{'raw':_0x10d897[_0x1be3('0x19')]?_0x10d897['options'][_0x1be3('0x1a')]===undefined?!![]:![]:!![]})[_0x1be3('0xb')](function(_0x184ce8){logger[_0x1be3('0x13')](_0x1be3('0x16'),_0x10d897);logger[_0x1be3('0xe')]('CreateVoiceDialReport',_0x10d897,JSON['stringify'](_0x184ce8));_0x187d72(_0x184ce8);})[_0x1be3('0x15')](function(_0x2ef38c){logger[_0x1be3('0x11')](_0x1be3('0x16'),_0x2ef38c['message'],_0x10d897);_0x363b6d(_0x1b2a7c['error'](0x1f4,_0x2ef38c[_0x1be3('0x12')]));});});};exports[_0x1be3('0x1b')]=function(_0x5504f3){var _0x2a2e80=this;return new Promise(function(_0x44f2ea,_0x39d88b){return db[_0x1be3('0x17')]['update'](_0x5504f3['body'],{'raw':_0x5504f3[_0x1be3('0x19')]?_0x5504f3[_0x1be3('0x19')][_0x1be3('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5504f3[_0x1be3('0x19')]?_0x5504f3[_0x1be3('0x19')][_0x1be3('0x1c')]||null:null,'attributes':_0x5504f3[_0x1be3('0x19')]?_0x5504f3[_0x1be3('0x19')]['attributes']||null:null,'limit':_0x5504f3[_0x1be3('0x19')]?_0x5504f3[_0x1be3('0x19')][_0x1be3('0x1d')]||null:null})['then'](function(_0x3adc14){logger[_0x1be3('0x13')]('UpdateVoiceDialReport',_0x5504f3);logger['debug'](_0x1be3('0x1b'),_0x5504f3,JSON['stringify'](_0x3adc14));_0x44f2ea(_0x3adc14);})[_0x1be3('0x15')](function(_0x3519f6){logger[_0x1be3('0x11')](_0x1be3('0x1b'),_0x3519f6['message'],_0x5504f3);_0x39d88b(_0x2a2e80[_0x1be3('0x11')](0x1f4,_0x3519f6['message']));});});}; \ No newline at end of file +var _0xae7e=['update','where','attributes','limit','UpdateVoiceDialReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','VoiceDialReport,\x20%s,\x20%s','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','then','stringify'];(function(_0xdb2e3c,_0x2f4644){var _0x55e38d=function(_0x46ed7b){while(--_0x46ed7b){_0xdb2e3c['push'](_0xdb2e3c['shift']());}};_0x55e38d(++_0x2f4644);}(_0xae7e,0xdd));var _0xeae7=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xae7e[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0xeae7('0x0'));var util=require(_0xeae7('0x1'));var moment=require(_0xeae7('0x2'));var BPromise=require(_0xeae7('0x3'));var rs=require(_0xeae7('0x4'));var fs=require('fs');var Redis=require(_0xeae7('0x5'));var db=require(_0xeae7('0x6'))['db'];var utils=require(_0xeae7('0x7'));var logger=require(_0xeae7('0x8'))(_0xeae7('0x9'));var config=require(_0xeae7('0xa'));var jayson=require(_0xeae7('0xb'));var client=jayson[_0xeae7('0xc')][_0xeae7('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3beef5,_0x1f3a25,_0x1c25ee){return new BPromise(function(_0x3b29f5,_0xf93c40){return client['request'](_0x3beef5,_0x1c25ee)['then'](function(_0x123bf2){logger[_0xeae7('0xe')]('VoiceDialReport,\x20%s,\x20%s',_0x1f3a25,'request\x20sent');logger[_0xeae7('0xf')](_0xeae7('0x10'),_0x1f3a25,_0xeae7('0x11'),JSON['stringify'](_0x123bf2));if(_0x123bf2['error']){if(_0x123bf2[_0xeae7('0x12')]['code']===0x1f4){logger[_0xeae7('0x12')](_0xeae7('0x13'),_0x1f3a25,_0x123bf2[_0xeae7('0x12')]['message']);return _0xf93c40(_0x123bf2[_0xeae7('0x12')][_0xeae7('0x14')]);}logger[_0xeae7('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0x1f3a25,_0x123bf2[_0xeae7('0x12')]['message']);return _0x3b29f5(_0x123bf2['error'][_0xeae7('0x14')]);}else{logger[_0xeae7('0xe')]('VoiceDialReport,\x20%s,\x20%s',_0x1f3a25,'request\x20sent');_0x3b29f5(_0x123bf2[_0xeae7('0x15')][_0xeae7('0x14')]);}})[_0xeae7('0x16')](function(_0x4a5712){logger['error'](_0xeae7('0x13'),_0x1f3a25,_0x4a5712);_0xf93c40(_0x4a5712);});});}exports[_0xeae7('0x17')]=function(_0x103add){var _0x4b03ce=this;return new Promise(function(_0x344bd9,_0x17e856){return db[_0xeae7('0x18')][_0xeae7('0x19')](_0x103add[_0xeae7('0x1a')],{'raw':_0x103add[_0xeae7('0x1b')]?_0x103add['options'][_0xeae7('0x1c')]===undefined?!![]:![]:!![]})[_0xeae7('0x1d')](function(_0x2f28db){logger['info']('CreateVoiceDialReport',_0x103add);logger[_0xeae7('0xf')](_0xeae7('0x17'),_0x103add,JSON[_0xeae7('0x1e')](_0x2f28db));_0x344bd9(_0x2f28db);})[_0xeae7('0x16')](function(_0x147094){logger[_0xeae7('0x12')](_0xeae7('0x17'),_0x147094[_0xeae7('0x14')],_0x103add);_0x17e856(_0x4b03ce[_0xeae7('0x12')](0x1f4,_0x147094[_0xeae7('0x14')]));});});};exports['UpdateVoiceDialReport']=function(_0x47b41e){var _0x4064a7=this;return new Promise(function(_0x5a30ab,_0x5310e4){return db['VoiceDialReport'][_0xeae7('0x1f')](_0x47b41e[_0xeae7('0x1a')],{'raw':_0x47b41e[_0xeae7('0x1b')]?_0x47b41e[_0xeae7('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47b41e[_0xeae7('0x1b')]?_0x47b41e[_0xeae7('0x1b')][_0xeae7('0x20')]||null:null,'attributes':_0x47b41e[_0xeae7('0x1b')]?_0x47b41e[_0xeae7('0x1b')][_0xeae7('0x21')]||null:null,'limit':_0x47b41e[_0xeae7('0x1b')]?_0x47b41e[_0xeae7('0x1b')][_0xeae7('0x22')]||null:null})[_0xeae7('0x1d')](function(_0x384072){logger['info'](_0xeae7('0x23'),_0x47b41e);logger[_0xeae7('0xf')](_0xeae7('0x23'),_0x47b41e,JSON[_0xeae7('0x1e')](_0x384072));_0x5a30ab(_0x384072);})['catch'](function(_0x3511da){logger['error'](_0xeae7('0x23'),_0x3511da[_0xeae7('0x14')],_0x47b41e);_0x5310e4(_0x4064a7['error'](0x1f4,_0x3511da['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 87bdb9c..4613490 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 _0x804e=['post','/:id/applications','addApplications','put','delete','exports','express','Router','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id'];(function(_0x199756,_0x5d0b24){var _0x47ab5c=function(_0x1b4342){while(--_0x1b4342){_0x199756['push'](_0x199756['shift']());}};_0x47ab5c(++_0x5d0b24);}(_0x804e,0x110));var _0xe804=function(_0x5dc628,_0x1aa304){_0x5dc628=_0x5dc628-0x0;var _0x2f82c3=_0x804e[_0x5dc628];return _0x2f82c3;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe804('0x0'));var router=express[_0xe804('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe804('0x2'));var controller=require(_0xe804('0x3'));router[_0xe804('0x4')]('/',auth[_0xe804('0x5')](),controller[_0xe804('0x6')]);router[_0xe804('0x4')](_0xe804('0x7'),auth[_0xe804('0x5')](),controller['show']);router[_0xe804('0x8')]('/',auth[_0xe804('0x5')](),controller['create']);router[_0xe804('0x8')](_0xe804('0x9'),auth[_0xe804('0x5')](),controller[_0xe804('0xa')]);router[_0xe804('0xb')](_0xe804('0x7'),auth[_0xe804('0x5')](),controller['update']);router[_0xe804('0xc')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xe804('0xd')]=router; \ No newline at end of file +var _0x053e=['path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceExtension.controller','isAuthenticated','index','get','/:id','show','post','/:id/applications','addApplications','put','update','destroy','multer'];(function(_0x3aadde,_0x50f23f){var _0x21df4e=function(_0x55a49d){while(--_0x55a49d){_0x3aadde['push'](_0x3aadde['shift']());}};_0x21df4e(++_0x50f23f);}(_0x053e,0xe3));var _0xe053=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x053e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xe053('0x0'));var util=require('util');var path=require(_0xe053('0x1'));var timeout=require(_0xe053('0x2'));var express=require(_0xe053('0x3'));var router=express['Router']();var fs_extra=require(_0xe053('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe053('0x5'));var config=require(_0xe053('0x6'));var controller=require(_0xe053('0x7'));router['get']('/',auth[_0xe053('0x8')](),controller[_0xe053('0x9')]);router[_0xe053('0xa')](_0xe053('0xb'),auth[_0xe053('0x8')](),controller[_0xe053('0xc')]);router[_0xe053('0xd')]('/',auth[_0xe053('0x8')](),controller['create']);router[_0xe053('0xd')](_0xe053('0xe'),auth[_0xe053('0x8')](),controller[_0xe053('0xf')]);router[_0xe053('0x10')](_0xe053('0xb'),auth['isAuthenticated'](),controller[_0xe053('0x11')]);router['delete'](_0xe053('0xb'),auth[_0xe053('0x8')](),controller[_0xe053('0x12')]);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 a293aea..4a582da 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 _0xc745=['VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','inbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav'];(function(_0x5beb9a,_0x18df8e){var _0x23ba76=function(_0x49c1d5){while(--_0x49c1d5){_0x5beb9a['push'](_0x5beb9a['shift']());}};_0x23ba76(++_0x18df8e);}(_0xc745,0x133));var _0x5c74=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xc745[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0x5c74('0x0'));module[_0x5c74('0x1')]={'context':{'type':Sequelize[_0x5c74('0x2')],'allowNull':![],'unique':_0x5c74('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x5c74('0x2')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x5c74('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x5c74('0x3')},'tag':{'type':Sequelize[_0x5c74('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x5c74('0x2')],'allowNull':![],'defaultValue':_0x5c74('0x4')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x5c74('0x5')](_0x5c74('0x6'),_0x5c74('0x7'),_0x5c74('0x8'),_0x5c74('0x9'),'outbound-fax',_0x5c74('0xa'),_0x5c74('0xb')),'allowNull':![]},'description':{'type':Sequelize[_0x5c74('0x2')]},'interval':{'type':Sequelize[_0x5c74('0x2')],'allowNull':![],'defaultValue':_0x5c74('0xc')},'IntervalId':{'type':Sequelize[_0x5c74('0xd')]},'isApp':{'type':Sequelize[_0x5c74('0xe')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x5c74('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x5c74('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x5c74('0xe')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x5c74('0xf')},'answer':{'type':Sequelize[_0x5c74('0xe')],'defaultValue':!![]},'name':{'type':Sequelize[_0x5c74('0x10')],'get':function(_0x1df0ee){return this[_0x5c74('0x11')](_0x5c74('0x12'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x16dc=['BOOLEAN','wav','VIRTUAL','getDataValue','exten','sequelize','STRING','compositeIndex','NoOp','ENUM','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER'];(function(_0x45dbe3,_0xd2bf96){var _0x1e71cf=function(_0x47d46d){while(--_0x47d46d){_0x45dbe3['push'](_0x45dbe3['shift']());}};_0x1e71cf(++_0xd2bf96);}(_0x16dc,0xd5));var _0xc16d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x16dc[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc16d('0x0'));module['exports']={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xc16d('0x1')],'allowNull':![],'unique':_0xc16d('0x2')},'priority':{'type':Sequelize[_0xc16d('0x1')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0xc16d('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xc16d('0x1')],'allowNull':![],'defaultValue':_0xc16d('0x3')},'appdata':{'type':Sequelize[_0xc16d('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xc16d('0x4')]('inbound','outbound','internal',_0xc16d('0x5'),_0xc16d('0x6'),_0xc16d('0x7'),_0xc16d('0x8')),'allowNull':![]},'description':{'type':Sequelize[_0xc16d('0x1')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc16d('0x9')},'IntervalId':{'type':Sequelize[_0xc16d('0xa')]},'isApp':{'type':Sequelize[_0xc16d('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0xc16d('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0xc16d('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xc16d('0xa')]},'recordingFormat':{'type':Sequelize[_0xc16d('0x1')],'defaultValue':_0xc16d('0xc')},'answer':{'type':Sequelize[_0xc16d('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0xc16d('0xd')],'get':function(_0x6160f){return this[_0xc16d('0xe')](_0xc16d('0xf'));}},'alias':{'type':Sequelize[_0xc16d('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 405c9c1..0a7dda9 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 _0x84c9=['error','send','index','VoiceExtension','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','limit','order','sort','pick','where','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','merge','options','find','create','body','startsWith','exten','role','inbound','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','findOne','sequelize','transaction','VoiceExtensionId','isApp','toLowerCase','true','findAndCountAll','eml-format','rimraf','request-promise','util','path','to-csv','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','offset','count','Content-Range','apply','reject','update','destroy','then','get','OutboundRoutes','outbound','InternalRoutes','internal','filter','map','value','includes','type','name','UserProfileResource'];(function(_0x2ac11c,_0xc8bdde){var _0x42e473=function(_0x2115aa){while(--_0x2115aa){_0x2ac11c['push'](_0x2ac11c['shift']());}};_0x42e473(++_0xc8bdde);}(_0x84c9,0x1d3));var _0x984c=function(_0x2fb3ff,_0x236f5a){_0x2fb3ff=_0x2fb3ff-0x0;var _0x1d868e=_0x84c9[_0x2fb3ff];return _0x1d868e;};'use strict';var emlformat=require(_0x984c('0x0'));var rimraf=require(_0x984c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x984c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x984c('0x3'));var path=require(_0x984c('0x4'));var sox=require('sox');var csv=require(_0x984c('0x5'));var ejs=require(_0x984c('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x984c('0x7'));var squel=require('squel');var crypto=require(_0x984c('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x984c('0x9'));var toCsv=require('to-csv');var querystring=require(_0x984c('0xa'));var Papa=require('papaparse');var Redis=require(_0x984c('0xb'));var authService=require(_0x984c('0xc'));var qs=require(_0x984c('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x984c('0xe'));var logger=require(_0x984c('0xf'))(_0x984c('0x10'));var utils=require(_0x984c('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x984c('0x12'))['db'];config[_0x984c('0x13')]=_['defaults'](config[_0x984c('0x13')],{'host':_0x984c('0x14'),'port':0x18eb});var socket=require(_0x984c('0x15'))(new Redis(config[_0x984c('0x13')]));require('./voiceExtension.socket')[_0x984c('0x16')](socket);function respondWithStatusCode(_0x12bfe2,_0x3378a3){_0x3378a3=_0x3378a3||0xcc;return function(_0x24d540){if(_0x24d540){return _0x12bfe2[_0x984c('0x17')](_0x3378a3);}return _0x12bfe2[_0x984c('0x18')](_0x3378a3)[_0x984c('0x19')]();};}function respondWithResult(_0x2254c4,_0x5d858c){_0x5d858c=_0x5d858c||0xc8;return function(_0x382895){if(_0x382895){return _0x2254c4['status'](_0x5d858c)[_0x984c('0x1a')](_0x382895);}};}function respondWithFilteredResult(_0x5378ec,_0x4aaa4b){return function(_0x4516b5){if(_0x4516b5){var _0x233f30=typeof _0x4aaa4b['offset']==='undefined'&&typeof _0x4aaa4b['limit']===_0x984c('0x1b');var _0x47e4df=_0x4516b5['count'];var _0x321281=_0x233f30?0x0:_0x4aaa4b[_0x984c('0x1c')];var _0x57810c=_0x233f30?_0x4516b5[_0x984c('0x1d')]:_0x4aaa4b[_0x984c('0x1c')]+_0x4aaa4b['limit'];var _0x4074dc;if(_0x57810c>=_0x47e4df){_0x57810c=_0x47e4df;_0x4074dc=0xc8;}else{_0x4074dc=0xce;}_0x5378ec[_0x984c('0x18')](_0x4074dc);return _0x5378ec['set'](_0x984c('0x1e'),_0x321281+'-'+_0x57810c+'/'+_0x47e4df)['json'](_0x4516b5);}return null;};}function patchUpdates(_0x34d97f){return function(_0x4c07ed){try{jsonpatch[_0x984c('0x1f')](_0x4c07ed,_0x34d97f,!![]);}catch(_0x439354){return BPromise[_0x984c('0x20')](_0x439354);}return _0x4c07ed['save']();};}function saveUpdates(_0x5020db,_0x57a578){return function(_0x4809d0){if(_0x4809d0){return _0x4809d0[_0x984c('0x21')](_0x5020db)['then'](function(_0x516037){return _0x516037;});}return null;};}function removeEntity(_0x4ec30a,_0x59d016){return function(_0x5ad702){if(_0x5ad702){return _0x5ad702[_0x984c('0x22')]()[_0x984c('0x23')](function(){var _0x984c8=_0x5ad702[_0x984c('0x24')]({'plain':!![]});var _0xe8fb08=[{'name':'InboundRoutes','value':'inbound','ignore':![]},{'name':_0x984c('0x25'),'value':_0x984c('0x26'),'ignore':![]},{'name':_0x984c('0x27'),'value':_0x984c('0x28'),'ignore':![]}];var _0x489fd5=_(_0xe8fb08)[_0x984c('0x29')]('ignore')[_0x984c('0x2a')](_0x984c('0x2b'))[_0x984c('0x2b')]();if(_[_0x984c('0x2c')](_0x489fd5,_0x984c8[_0x984c('0x2d')])){return;}var _0x2a2ae6=_['find'](_0xe8fb08,['value',_0x984c8['type']])[_0x984c('0x2e')];return db[_0x984c('0x2f')][_0x984c('0x22')]({'where':{'type':_0x2a2ae6,'resourceId':_0x984c8['id']}})[_0x984c('0x23')](function(){return _0x5ad702;});})[_0x984c('0x23')](function(){_0x4ec30a[_0x984c('0x18')](0xcc)[_0x984c('0x19')]();});}};}function handleEntityNotFound(_0x3ed086,_0x441253){return function(_0x26f9a3){if(!_0x26f9a3){_0x3ed086[_0x984c('0x17')](0x194);}return _0x26f9a3;};}function handleError(_0x124880,_0x4b5446){_0x4b5446=_0x4b5446||0x1f4;return function(_0x280ef7){logger[_0x984c('0x30')](_0x280ef7['stack']);if(_0x280ef7[_0x984c('0x2e')]){delete _0x280ef7[_0x984c('0x2e')];}_0x124880['status'](_0x4b5446)[_0x984c('0x31')](_0x280ef7);};}exports[_0x984c('0x32')]=function(_0x426e3c,_0x970f28){var _0x2f649f={},_0x1c5719={},_0x245bee={'count':0x0,'rows':[]};var _0x2ebe79=_[_0x984c('0x2a')](db[_0x984c('0x33')][_0x984c('0x34')],function(_0x2896ac){return{'name':_0x2896ac['fieldName'],'type':_0x2896ac['type'][_0x984c('0x35')]};});_0x1c5719[_0x984c('0x36')]=_['map'](_0x2ebe79,'name');_0x1c5719[_0x984c('0x37')]=_[_0x984c('0x38')](_0x426e3c[_0x984c('0x37')]);_0x1c5719[_0x984c('0x39')]=_[_0x984c('0x3a')](_0x1c5719['model'],_0x1c5719[_0x984c('0x37')]);_0x2f649f[_0x984c('0x3b')]=_[_0x984c('0x3a')](_0x1c5719[_0x984c('0x36')],qs[_0x984c('0x3c')](_0x426e3c[_0x984c('0x37')][_0x984c('0x3c')]));_0x2f649f[_0x984c('0x3b')]=_0x2f649f['attributes'][_0x984c('0x3d')]?_0x2f649f[_0x984c('0x3b')]:_0x1c5719[_0x984c('0x36')];if(!_0x426e3c[_0x984c('0x37')]['hasOwnProperty']('nolimit')){_0x2f649f[_0x984c('0x3e')]=qs[_0x984c('0x3e')](_0x426e3c[_0x984c('0x37')][_0x984c('0x3e')]);_0x2f649f['offset']=qs[_0x984c('0x1c')](_0x426e3c[_0x984c('0x37')]['offset']);}_0x2f649f[_0x984c('0x3f')]=qs[_0x984c('0x40')](_0x426e3c[_0x984c('0x37')][_0x984c('0x40')]);_0x2f649f['where']=qs['filters'](_[_0x984c('0x41')](_0x426e3c['query'],_0x1c5719[_0x984c('0x39')]),_0x2ebe79);if(_0x426e3c['query'][_0x984c('0x29')]){_0x2f649f[_0x984c('0x42')]=_['merge'](_0x2f649f[_0x984c('0x42')],{'$or':_[_0x984c('0x2a')](_0x2ebe79,function(_0xa07809){if(_0xa07809['type']!==_0x984c('0x43')){var _0x4a1fa5={};_0x4a1fa5[_0xa07809[_0x984c('0x2e')]]={'$like':'%'+_0x426e3c['query'][_0x984c('0x29')]+'%'};return _0x4a1fa5;}})});}_0x2f649f=_['merge']({},_0x2f649f,_0x426e3c['options']);var _0x9e3956={'where':_0x2f649f[_0x984c('0x42')]};return db[_0x984c('0x33')]['count'](_0x9e3956)['then'](function(_0x5056ea){_0x245bee[_0x984c('0x1d')]=_0x5056ea;if(_0x426e3c[_0x984c('0x37')][_0x984c('0x44')]){_0x2f649f[_0x984c('0x45')]=[{'all':!![]}];}return db[_0x984c('0x33')][_0x984c('0x46')](_0x2f649f);})[_0x984c('0x23')](function(_0x4b0f42){_0x245bee[_0x984c('0x47')]=_0x4b0f42;return _0x245bee;})[_0x984c('0x23')](respondWithFilteredResult(_0x970f28,_0x2f649f))[_0x984c('0x48')](handleError(_0x970f28,null));};exports[_0x984c('0x49')]=function(_0x219b04,_0x36f81e){var _0x573bb7={'raw':![],'where':{'id':_0x219b04[_0x984c('0x4a')]['id']}},_0x5e7551={};_0x5e7551[_0x984c('0x36')]=_[_0x984c('0x38')](db['VoiceExtension'][_0x984c('0x34')]);_0x5e7551[_0x984c('0x37')]=_[_0x984c('0x38')](_0x219b04['query']);_0x5e7551[_0x984c('0x39')]=_[_0x984c('0x3a')](_0x5e7551[_0x984c('0x36')],_0x5e7551['query']);_0x573bb7[_0x984c('0x3b')]=_[_0x984c('0x3a')](_0x5e7551[_0x984c('0x36')],qs[_0x984c('0x3c')](_0x219b04[_0x984c('0x37')][_0x984c('0x3c')]));_0x573bb7[_0x984c('0x3b')]=_0x573bb7[_0x984c('0x3b')][_0x984c('0x3d')]?_0x573bb7['attributes']:_0x5e7551[_0x984c('0x36')];if(_0x219b04[_0x984c('0x37')]['includeAll']){_0x573bb7[_0x984c('0x45')]=[{'all':!![]}];}_0x573bb7=_[_0x984c('0x4b')]({},_0x573bb7,_0x219b04[_0x984c('0x4c')]);return db[_0x984c('0x33')][_0x984c('0x4d')](_0x573bb7)[_0x984c('0x23')](handleEntityNotFound(_0x36f81e,null))['then'](respondWithResult(_0x36f81e,null))['catch'](handleError(_0x36f81e,null));};exports[_0x984c('0x22')]=function(_0x290779,_0x3e2b23){return db[_0x984c('0x33')]['find']({'where':{'id':_0x290779[_0x984c('0x4a')]['id']}})[_0x984c('0x23')](handleEntityNotFound(_0x3e2b23,null))[_0x984c('0x23')](removeEntity(_0x3e2b23,null))['catch'](handleError(_0x3e2b23,null));};exports[_0x984c('0x4e')]=function(_0x425cf2,_0x1c7fea){if(_0x425cf2[_0x984c('0x4f')][_0x984c('0x2d')]===_0x984c('0x26')&&!_[_0x984c('0x50')](_0x425cf2[_0x984c('0x4f')]['exten'],'_')){_0x425cf2[_0x984c('0x4f')]['exten']='_'['concat'](_0x425cf2[_0x984c('0x4f')][_0x984c('0x51')]);}return db[_0x984c('0x33')][_0x984c('0x4e')](_0x425cf2['body'],{'raw':![]})['then'](function(_0x5ac10c){var _0x51649b=_0x425cf2['user'][_0x984c('0x24')]({'plain':!![]});if(!_0x51649b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x51649b[_0x984c('0x52')]==='user'){var _0x403ba1=_0x5ac10c['get']({'plain':!![]});var _0x29840b=[{'name':'InboundRoutes','value':_0x984c('0x53')},{'name':_0x984c('0x25'),'value':_0x984c('0x26')},{'name':_0x984c('0x27'),'value':_0x984c('0x28')}];var _0xf42f25=_[_0x984c('0x4d')](_0x29840b,[_0x984c('0x2b'),_0x403ba1['type']])[_0x984c('0x2e')];return db[_0x984c('0x54')]['find']({'where':{'name':_0xf42f25,'userProfileId':_0x51649b[_0x984c('0x55')]},'raw':!![]})[_0x984c('0x23')](function(_0x2ce72a){if(_0x2ce72a&&_0x2ce72a[_0x984c('0x56')]===0x0){return db[_0x984c('0x2f')]['create']({'name':_0x403ba1['name'],'resourceId':_0x403ba1['id'],'type':_0x2ce72a[_0x984c('0x2e')],'sectionId':_0x2ce72a['id']},{})[_0x984c('0x23')](function(){return _0x5ac10c;});}else{return _0x5ac10c;}})[_0x984c('0x48')](function(_0x31f589){logger[_0x984c('0x30')](_0x984c('0x57'),_0x31f589);throw _0x31f589;});}return _0x5ac10c;})[_0x984c('0x23')](respondWithResult(_0x1c7fea,0xc9))[_0x984c('0x48')](handleError(_0x1c7fea,null));};exports[_0x984c('0x21')]=function(_0x1e093b,_0x2aa0b1){if(_0x1e093b['body']['id']){delete _0x1e093b[_0x984c('0x4f')]['id'];}return db[_0x984c('0x33')]['find']({'where':{'id':_0x1e093b[_0x984c('0x4a')]['id']}})[_0x984c('0x23')](handleEntityNotFound(_0x2aa0b1,null))[_0x984c('0x23')](function(_0x44fe4d){if(_0x44fe4d){return db[_0x984c('0x33')][_0x984c('0x21')](_[_0x984c('0x41')](_0x1e093b[_0x984c('0x4f')],['exten',_0x984c('0x58'),_0x984c('0x59'),_0x984c('0x5a'),_0x984c('0x5b'),_0x984c('0x5c'),_0x984c('0x5d')]),{'where':{'context':_0x44fe4d['context'],'exten':_0x44fe4d[_0x984c('0x51')]},'individualHooks':!![]})[_0x984c('0x23')](function(_0x21771f){return _0x21771f;});}return null;})[_0x984c('0x23')](respondWithStatusCode(_0x2aa0b1,null))[_0x984c('0x48')](handleError(_0x2aa0b1,null));};exports[_0x984c('0x5e')]=function(_0x5c618d,_0x263d0a){return db[_0x984c('0x33')][_0x984c('0x5f')]({'where':{'id':_0x5c618d[_0x984c('0x4a')]['id']}})[_0x984c('0x23')](function(_0x1e2b29){if(_0x1e2b29){return db[_0x984c('0x60')][_0x984c('0x61')](function(_0x1ce6dd){return db[_0x984c('0x33')]['destroy']({'where':{'VoiceExtensionId':_0x5c618d['params']['id']},'transaction':_0x1ce6dd})[_0x984c('0x23')](function(){var _0x4b38b4=_['map'](_0x5c618d[_0x984c('0x4f')],function(_0xca5794){_0xca5794[_0x984c('0x62')]=_0x5c618d['params']['id'];_0xca5794[_0x984c('0x63')]=!![];return _0xca5794;});var _0x2dbda5=_0x5c618d[_0x984c('0x37')]['rewriteDial']&&_0x5c618d[_0x984c('0x37')]['rewriteDial'][_0x984c('0x64')]()===_0x984c('0x65')?!![]:![];return _0x1e2b29['createRouting'](_0x4b38b4,_0x2dbda5);})[_0x984c('0x23')](function(_0x32e008){return db[_0x984c('0x33')]['bulkCreate'](_0x32e008,{'transaction':_0x1ce6dd});});})['then'](function(){return db[_0x984c('0x33')][_0x984c('0x66')]({'where':{'isApp':!![],'VoiceExtensionId':_0x5c618d[_0x984c('0x4a')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})[_0x984c('0x23')](respondWithResult(_0x263d0a,null))['catch'](handleError(_0x263d0a,null));}; \ No newline at end of file +var _0x1151=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','destroy','get','inbound','OutboundRoutes','outbound','InternalRoutes','internal','map','value','includes','find','type','UserProfileResource','stack','name','send','index','VoiceExtension','fieldName','key','model','keys','query','intersection','fields','attributes','length','nolimit','order','sort','filters','pick','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','catch','create','startsWith','body','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InboundRoutes','UserProfileSection','autoAssociation','error','description','recordingFormat','cutdigits','mandatoryDisposition','context','addApplications','findOne','isApp','rewriteDial','toLowerCase','true','createRouting','findAndCountAll','cast(priority\x20as\x20unsigned)','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0x1151,0x1b3));var _0x1115=function(_0x39caaa,_0x1f37bc){_0x39caaa=_0x39caaa-0x0;var _0x9b9c7d=_0x1151[_0x39caaa];return _0x9b9c7d;};'use strict';var emlformat=require(_0x1115('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1115('0x1'));var jsonpatch=require(_0x1115('0x2'));var rp=require(_0x1115('0x3'));var moment=require(_0x1115('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1115('0x5'));var util=require('util');var path=require(_0x1115('0x6'));var sox=require(_0x1115('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1115('0x8'));var _=require(_0x1115('0x9'));var squel=require(_0x1115('0xa'));var crypto=require(_0x1115('0xb'));var jsforce=require(_0x1115('0xc'));var deskjs=require(_0x1115('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1115('0xe'));var Papa=require(_0x1115('0xf'));var Redis=require(_0x1115('0x10'));var authService=require(_0x1115('0x11'));var qs=require(_0x1115('0x12'));var as=require(_0x1115('0x13'));var hardwareService=require(_0x1115('0x14'));var logger=require(_0x1115('0x15'))(_0x1115('0x16'));var utils=require(_0x1115('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x1115('0x18'));var db=require(_0x1115('0x19'))['db'];config[_0x1115('0x1a')]=_[_0x1115('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1115('0x1c'))(new Redis(config[_0x1115('0x1a')]));require(_0x1115('0x1d'))[_0x1115('0x1e')](socket);function respondWithStatusCode(_0x30a631,_0x3c81c9){_0x3c81c9=_0x3c81c9||0xcc;return function(_0x468bfd){if(_0x468bfd){return _0x30a631[_0x1115('0x1f')](_0x3c81c9);}return _0x30a631[_0x1115('0x20')](_0x3c81c9)[_0x1115('0x21')]();};}function respondWithResult(_0x2ba64e,_0xb5c4ae){_0xb5c4ae=_0xb5c4ae||0xc8;return function(_0x353486){if(_0x353486){return _0x2ba64e['status'](_0xb5c4ae)['json'](_0x353486);}};}function respondWithFilteredResult(_0xec294e,_0x4bbe21){return function(_0x3d36c7){if(_0x3d36c7){var _0x276440=typeof _0x4bbe21[_0x1115('0x22')]===_0x1115('0x23')&&typeof _0x4bbe21[_0x1115('0x24')]===_0x1115('0x23');var _0x34f2f8=_0x3d36c7['count'];var _0xabbb81=_0x276440?0x0:_0x4bbe21[_0x1115('0x22')];var _0x54fe32=_0x276440?_0x3d36c7[_0x1115('0x25')]:_0x4bbe21[_0x1115('0x22')]+_0x4bbe21['limit'];var _0x5be9d7;if(_0x54fe32>=_0x34f2f8){_0x54fe32=_0x34f2f8;_0x5be9d7=0xc8;}else{_0x5be9d7=0xce;}_0xec294e[_0x1115('0x20')](_0x5be9d7);return _0xec294e['set'](_0x1115('0x26'),_0xabbb81+'-'+_0x54fe32+'/'+_0x34f2f8)[_0x1115('0x27')](_0x3d36c7);}return null;};}function patchUpdates(_0x4b71fb){return function(_0x38f758){try{jsonpatch['apply'](_0x38f758,_0x4b71fb,!![]);}catch(_0xad266d){return BPromise[_0x1115('0x28')](_0xad266d);}return _0x38f758[_0x1115('0x29')]();};}function saveUpdates(_0x4bf29b,_0x23c579){return function(_0x5486ab){if(_0x5486ab){return _0x5486ab[_0x1115('0x2a')](_0x4bf29b)[_0x1115('0x2b')](function(_0x4f87eb){return _0x4f87eb;});}return null;};}function removeEntity(_0x356463,_0x3c5c2b){return function(_0x3f5e80){if(_0x3f5e80){return _0x3f5e80[_0x1115('0x2c')]()[_0x1115('0x2b')](function(){var _0x2c383c=_0x3f5e80[_0x1115('0x2d')]({'plain':!![]});var _0x4d5885=[{'name':'InboundRoutes','value':_0x1115('0x2e'),'ignore':![]},{'name':_0x1115('0x2f'),'value':_0x1115('0x30'),'ignore':![]},{'name':_0x1115('0x31'),'value':_0x1115('0x32'),'ignore':![]}];var _0xf80c9f=_(_0x4d5885)['filter']('ignore')[_0x1115('0x33')](_0x1115('0x34'))[_0x1115('0x34')]();if(_[_0x1115('0x35')](_0xf80c9f,_0x2c383c['type'])){return;}var _0xc9d750=_[_0x1115('0x36')](_0x4d5885,[_0x1115('0x34'),_0x2c383c[_0x1115('0x37')]])['name'];return db[_0x1115('0x38')][_0x1115('0x2c')]({'where':{'type':_0xc9d750,'resourceId':_0x2c383c['id']}})[_0x1115('0x2b')](function(){return _0x3f5e80;});})[_0x1115('0x2b')](function(){_0x356463[_0x1115('0x20')](0xcc)[_0x1115('0x21')]();});}};}function handleEntityNotFound(_0x1635b6,_0x284da1){return function(_0x56dd25){if(!_0x56dd25){_0x1635b6['sendStatus'](0x194);}return _0x56dd25;};}function handleError(_0x1e3e29,_0x2bf552){_0x2bf552=_0x2bf552||0x1f4;return function(_0x2f092c){logger['error'](_0x2f092c[_0x1115('0x39')]);if(_0x2f092c[_0x1115('0x3a')]){delete _0x2f092c[_0x1115('0x3a')];}_0x1e3e29[_0x1115('0x20')](_0x2bf552)[_0x1115('0x3b')](_0x2f092c);};}exports[_0x1115('0x3c')]=function(_0x3287dd,_0x30e048){var _0x238b8f={},_0x5ad9f0={},_0x2381a2={'count':0x0,'rows':[]};var _0x1fd86d=_[_0x1115('0x33')](db[_0x1115('0x3d')]['rawAttributes'],function(_0x2b019c){return{'name':_0x2b019c[_0x1115('0x3e')],'type':_0x2b019c[_0x1115('0x37')][_0x1115('0x3f')]};});_0x5ad9f0[_0x1115('0x40')]=_[_0x1115('0x33')](_0x1fd86d,'name');_0x5ad9f0['query']=_[_0x1115('0x41')](_0x3287dd[_0x1115('0x42')]);_0x5ad9f0['filters']=_['intersection'](_0x5ad9f0[_0x1115('0x40')],_0x5ad9f0[_0x1115('0x42')]);_0x238b8f['attributes']=_[_0x1115('0x43')](_0x5ad9f0['model'],qs[_0x1115('0x44')](_0x3287dd['query']['fields']));_0x238b8f[_0x1115('0x45')]=_0x238b8f[_0x1115('0x45')][_0x1115('0x46')]?_0x238b8f[_0x1115('0x45')]:_0x5ad9f0[_0x1115('0x40')];if(!_0x3287dd['query']['hasOwnProperty'](_0x1115('0x47'))){_0x238b8f[_0x1115('0x24')]=qs[_0x1115('0x24')](_0x3287dd[_0x1115('0x42')][_0x1115('0x24')]);_0x238b8f[_0x1115('0x22')]=qs[_0x1115('0x22')](_0x3287dd[_0x1115('0x42')][_0x1115('0x22')]);}_0x238b8f[_0x1115('0x48')]=qs[_0x1115('0x49')](_0x3287dd[_0x1115('0x42')][_0x1115('0x49')]);_0x238b8f['where']=qs[_0x1115('0x4a')](_[_0x1115('0x4b')](_0x3287dd['query'],_0x5ad9f0[_0x1115('0x4a')]),_0x1fd86d);if(_0x3287dd['query']['filter']){_0x238b8f['where']=_['merge'](_0x238b8f[_0x1115('0x4c')],{'$or':_[_0x1115('0x33')](_0x1fd86d,function(_0x304f8c){if(_0x304f8c['type']!==_0x1115('0x4d')){var _0x3354d0={};_0x3354d0[_0x304f8c[_0x1115('0x3a')]]={'$like':'%'+_0x3287dd['query'][_0x1115('0x4e')]+'%'};return _0x3354d0;}})});}_0x238b8f=_[_0x1115('0x4f')]({},_0x238b8f,_0x3287dd[_0x1115('0x50')]);var _0x7e9306={'where':_0x238b8f[_0x1115('0x4c')]};return db[_0x1115('0x3d')][_0x1115('0x25')](_0x7e9306)[_0x1115('0x2b')](function(_0x5054ba){_0x2381a2[_0x1115('0x25')]=_0x5054ba;if(_0x3287dd[_0x1115('0x42')][_0x1115('0x51')]){_0x238b8f[_0x1115('0x52')]=[{'all':!![]}];}return db['VoiceExtension'][_0x1115('0x53')](_0x238b8f);})[_0x1115('0x2b')](function(_0x12d539){_0x2381a2[_0x1115('0x54')]=_0x12d539;return _0x2381a2;})[_0x1115('0x2b')](respondWithFilteredResult(_0x30e048,_0x238b8f))['catch'](handleError(_0x30e048,null));};exports[_0x1115('0x55')]=function(_0x142ae5,_0x41764c){var _0x42640b={'raw':![],'where':{'id':_0x142ae5[_0x1115('0x56')]['id']}},_0x52b1bb={};_0x52b1bb['model']=_[_0x1115('0x41')](db[_0x1115('0x3d')][_0x1115('0x57')]);_0x52b1bb[_0x1115('0x42')]=_[_0x1115('0x41')](_0x142ae5[_0x1115('0x42')]);_0x52b1bb[_0x1115('0x4a')]=_['intersection'](_0x52b1bb[_0x1115('0x40')],_0x52b1bb['query']);_0x42640b[_0x1115('0x45')]=_['intersection'](_0x52b1bb[_0x1115('0x40')],qs[_0x1115('0x44')](_0x142ae5['query'][_0x1115('0x44')]));_0x42640b[_0x1115('0x45')]=_0x42640b[_0x1115('0x45')][_0x1115('0x46')]?_0x42640b[_0x1115('0x45')]:_0x52b1bb[_0x1115('0x40')];if(_0x142ae5[_0x1115('0x42')][_0x1115('0x51')]){_0x42640b['include']=[{'all':!![]}];}_0x42640b=_[_0x1115('0x4f')]({},_0x42640b,_0x142ae5[_0x1115('0x50')]);return db[_0x1115('0x3d')]['find'](_0x42640b)[_0x1115('0x2b')](handleEntityNotFound(_0x41764c,null))[_0x1115('0x2b')](respondWithResult(_0x41764c,null))[_0x1115('0x58')](handleError(_0x41764c,null));};exports[_0x1115('0x2c')]=function(_0x13ffe9,_0x381bf0){return db[_0x1115('0x3d')]['find']({'where':{'id':_0x13ffe9[_0x1115('0x56')]['id']}})['then'](handleEntityNotFound(_0x381bf0,null))[_0x1115('0x2b')](removeEntity(_0x381bf0,null))['catch'](handleError(_0x381bf0,null));};exports[_0x1115('0x59')]=function(_0x4596ae,_0x263ae7){if(_0x4596ae['body'][_0x1115('0x37')]==='outbound'&&!_[_0x1115('0x5a')](_0x4596ae[_0x1115('0x5b')][_0x1115('0x5c')],'_')){_0x4596ae[_0x1115('0x5b')][_0x1115('0x5c')]='_'['concat'](_0x4596ae[_0x1115('0x5b')][_0x1115('0x5c')]);}return db[_0x1115('0x3d')][_0x1115('0x59')](_0x4596ae[_0x1115('0x5b')],{'raw':![]})[_0x1115('0x2b')](function(_0x435dde){var _0x5baa1f=_0x4596ae[_0x1115('0x5d')][_0x1115('0x2d')]({'plain':!![]});if(!_0x5baa1f)throw new Error(_0x1115('0x5e'));if(_0x5baa1f[_0x1115('0x5f')]===_0x1115('0x5d')){var _0x2457d8=_0x435dde[_0x1115('0x2d')]({'plain':!![]});var _0x5a0891=[{'name':_0x1115('0x60'),'value':_0x1115('0x2e')},{'name':_0x1115('0x2f'),'value':_0x1115('0x30')},{'name':_0x1115('0x31'),'value':'internal'}];var _0x5291bf=_[_0x1115('0x36')](_0x5a0891,[_0x1115('0x34'),_0x2457d8[_0x1115('0x37')]])[_0x1115('0x3a')];return db[_0x1115('0x61')]['find']({'where':{'name':_0x5291bf,'userProfileId':_0x5baa1f['userProfileId']},'raw':!![]})[_0x1115('0x2b')](function(_0x5637e1){if(_0x5637e1&&_0x5637e1[_0x1115('0x62')]===0x0){return db[_0x1115('0x38')][_0x1115('0x59')]({'name':_0x2457d8[_0x1115('0x3a')],'resourceId':_0x2457d8['id'],'type':_0x5637e1['name'],'sectionId':_0x5637e1['id']},{})[_0x1115('0x2b')](function(){return _0x435dde;});}else{return _0x435dde;}})[_0x1115('0x58')](function(_0x3c4b44){logger[_0x1115('0x63')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c4b44);throw _0x3c4b44;});}return _0x435dde;})['then'](respondWithResult(_0x263ae7,0xc9))[_0x1115('0x58')](handleError(_0x263ae7,null));};exports['update']=function(_0x14bc4b,_0x5ba377){if(_0x14bc4b[_0x1115('0x5b')]['id']){delete _0x14bc4b[_0x1115('0x5b')]['id'];}return db[_0x1115('0x3d')][_0x1115('0x36')]({'where':{'id':_0x14bc4b[_0x1115('0x56')]['id']}})['then'](handleEntityNotFound(_0x5ba377,null))[_0x1115('0x2b')](function(_0x14e70d){if(_0x14e70d){return db['VoiceExtension']['update'](_[_0x1115('0x4b')](_0x14bc4b[_0x1115('0x5b')],[_0x1115('0x5c'),'context',_0x1115('0x64'),_0x1115('0x65'),_0x1115('0x66'),_0x1115('0x67'),'alias']),{'where':{'context':_0x14e70d[_0x1115('0x68')],'exten':_0x14e70d[_0x1115('0x5c')]},'individualHooks':!![]})['then'](function(_0x1c309e){return _0x1c309e;});}return null;})[_0x1115('0x2b')](respondWithStatusCode(_0x5ba377,null))[_0x1115('0x58')](handleError(_0x5ba377,null));};exports[_0x1115('0x69')]=function(_0x451e6b,_0x443983){return db['VoiceExtension'][_0x1115('0x6a')]({'where':{'id':_0x451e6b[_0x1115('0x56')]['id']}})[_0x1115('0x2b')](function(_0x4e7406){if(_0x4e7406){return db['sequelize']['transaction'](function(_0x4dd1d9){return db[_0x1115('0x3d')][_0x1115('0x2c')]({'where':{'VoiceExtensionId':_0x451e6b[_0x1115('0x56')]['id']},'transaction':_0x4dd1d9})['then'](function(){var _0x1b3b81=_[_0x1115('0x33')](_0x451e6b[_0x1115('0x5b')],function(_0x509896){_0x509896['VoiceExtensionId']=_0x451e6b['params']['id'];_0x509896[_0x1115('0x6b')]=!![];return _0x509896;});var _0x5197c4=_0x451e6b[_0x1115('0x42')]['rewriteDial']&&_0x451e6b[_0x1115('0x42')][_0x1115('0x6c')][_0x1115('0x6d')]()===_0x1115('0x6e')?!![]:![];return _0x4e7406[_0x1115('0x6f')](_0x1b3b81,_0x5197c4);})[_0x1115('0x2b')](function(_0x32640f){return db['VoiceExtension']['bulkCreate'](_0x32640f,{'transaction':_0x4dd1d9});});})['then'](function(){return db[_0x1115('0x3d')][_0x1115('0x70')]({'where':{'isApp':!![],'VoiceExtensionId':_0x451e6b[_0x1115('0x56')]['id']},'order':_0x1115('0x71')});});}})[_0x1115('0x2b')](respondWithResult(_0x443983,null))[_0x1115('0x58')](handleError(_0x443983,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 8117aaa..cf36213 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 _0xb918=['../../mysqldb','VoiceExtension','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xb918,0x11d));var _0x8b91=function(_0x41b3e7,_0x94678a){_0x41b3e7=_0x41b3e7-0x0;var _0x47a92c=_0xb918[_0x41b3e7];return _0x47a92c;};'use strict';var EventEmitter=require(_0x8b91('0x0'));var VoiceExtension=require(_0x8b91('0x1'))['db'][_0x8b91('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x8b91('0x3')](0x0);var events={'afterCreate':_0x8b91('0x4'),'afterUpdate':_0x8b91('0x5'),'afterDestroy':_0x8b91('0x6')};function emitEvent(_0x28bced){return function(_0x47b434,_0x1bfb4d,_0x3c4a61){VoiceExtensionEvents[_0x8b91('0x7')](_0x28bced+':'+_0x47b434['id'],_0x47b434);VoiceExtensionEvents['emit'](_0x28bced,_0x47b434);_0x3c4a61(null);};}for(var e in events){if(events[_0x8b91('0x8')](e)){var event=events[e];VoiceExtension[_0x8b91('0x9')](e,emitEvent(event));}}module[_0x8b91('0xa')]=VoiceExtensionEvents; \ No newline at end of file +var _0x3c88=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceExtension','update'];(function(_0x3e6d5d,_0x264c7a){var _0x238923=function(_0x201b19){while(--_0x201b19){_0x3e6d5d['push'](_0x3e6d5d['shift']());}};_0x238923(++_0x264c7a);}(_0x3c88,0x176));var _0x83c8=function(_0x101bca,_0x482978){_0x101bca=_0x101bca-0x0;var _0x56af92=_0x3c88[_0x101bca];return _0x56af92;};'use strict';var EventEmitter=require(_0x83c8('0x0'));var VoiceExtension=require(_0x83c8('0x1'))['db'][_0x83c8('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x83c8('0x3'),'afterDestroy':_0x83c8('0x4')};function emitEvent(_0x12c01a){return function(_0x1eea55,_0xac64e9,_0x45471a){VoiceExtensionEvents['emit'](_0x12c01a+':'+_0x1eea55['id'],_0x1eea55);VoiceExtensionEvents[_0x83c8('0x5')](_0x12c01a,_0x1eea55);_0x45471a(null);};}for(var e in events){if(events[_0x83c8('0x6')](e)){var event=events[e];VoiceExtension[_0x83c8('0x7')](e,emitEvent(event));}}module[_0x83c8('0x8')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index f1401f5..6795189 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 _0x1ac5=['XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(routeAlias)=','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','trunk','timeout','split','length','name','phone','param','prefix','SIP','join','options','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','IntervalId','then','intervals','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','Set(CALLERID(all)=','callerID','NoOp(No\x20number\x20available)','answer','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','priority','last','concat','catch','define','VoiceExtension','voice_extensions','util','lodash','exports','models','CDR(type)=','context','exten','type','alias','Set','NoOp','No\x20alias\x20set','inbound','push'];(function(_0x17f479,_0x3d8dc8){var _0x25ab39=function(_0x48b609){while(--_0x48b609){_0x17f479['push'](_0x17f479['shift']());}};_0x25ab39(++_0x3d8dc8);}(_0x1ac5,0x9c));var _0x51ac=function(_0x4b9c3d,_0x30e12a){_0x4b9c3d=_0x4b9c3d-0x0;var _0x9d9a6d=_0x1ac5[_0x4b9c3d];return _0x9d9a6d;};'use strict';var util=require(_0x51ac('0x0'));var _=require(_0x51ac('0x1'));var attributes=require('./voiceExtension.attributes');module[_0x51ac('0x2')]=function(_0x2ccd28){var _0x299a4f=_0x2ccd28[_0x51ac('0x3')];function _0x4ce91e(_0x5b0244){var _0x4a8283=0x2;var _0x594a90=[{'type':_0x5b0244['type'],'app':'Set','appdata':_0x51ac('0x4')+_0x5b0244['type'],'context':_0x5b0244[_0x51ac('0x5')],'exten':_0x5b0244[_0x51ac('0x6')],'priority':_0x4a8283++,'VoiceExtensionId':_0x5b0244['id']},{'type':_0x5b0244[_0x51ac('0x7')],'app':_0x5b0244[_0x51ac('0x8')]?_0x51ac('0x9'):_0x51ac('0xa'),'appdata':_0x5b0244[_0x51ac('0x8')]?'CDR(routeAlias)='+_0x5b0244[_0x51ac('0x8')]:_0x51ac('0xb'),'context':_0x5b0244[_0x51ac('0x5')],'exten':_0x5b0244['exten'],'priority':_0x4a8283++,'VoiceExtensionId':_0x5b0244['id']}];if(_0x5b0244['type']===_0x51ac('0xc')){_0x594a90[_0x51ac('0xd')]({'type':_0x51ac('0xc'),'app':_0x51ac('0x9'),'appdata':'CDR(routeid)='+_0x5b0244['id'],'context':_0x5b0244['context'],'exten':_0x5b0244[_0x51ac('0x6')],'priority':_0x4a8283++,'VoiceExtensionId':_0x5b0244['id']});}_0x594a90[_0x51ac('0xd')]({'type':_0x5b0244[_0x51ac('0x7')],'app':_0x51ac('0x9'),'appdata':_0x51ac('0xe'),'context':_0x5b0244[_0x51ac('0x5')],'exten':_0x5b0244['exten'],'priority':_0x4a8283++,'VoiceExtensionId':_0x5b0244['id']},{'type':_0x5b0244[_0x51ac('0x7')],'app':_0x51ac('0x9'),'appdata':_0x51ac('0xf'),'context':_0x5b0244[_0x51ac('0x5')],'exten':_0x5b0244[_0x51ac('0x6')],'priority':_0x4a8283++,'VoiceExtensionId':_0x5b0244['id']},{'type':_0x5b0244[_0x51ac('0x7')],'app':_0x51ac('0x9'),'appdata':_0x51ac('0x10'),'context':_0x5b0244['context'],'exten':_0x5b0244[_0x51ac('0x6')],'priority':_0x4a8283++,'VoiceExtensionId':_0x5b0244['id']});return _0x594a90;}function _0x59b655(_0x4c9152){var _0x6d1416=0x2;var _0x47cffc=[{'type':_0x51ac('0x11'),'app':_0x51ac('0x9'),'appdata':_0x51ac('0x12'),'context':_0x4c9152[_0x51ac('0x5')],'exten':_0x4c9152[_0x51ac('0x6')],'priority':_0x6d1416++,'VoiceExtensionId':_0x4c9152['id']},{'type':_0x51ac('0x11'),'app':_0x4c9152['alias']?_0x51ac('0x9'):_0x51ac('0xa'),'appdata':_0x4c9152[_0x51ac('0x8')]?_0x51ac('0x13')+_0x4c9152[_0x51ac('0x8')]:_0x51ac('0xb'),'context':_0x4c9152['context'],'exten':_0x4c9152[_0x51ac('0x6')],'priority':_0x6d1416++,'VoiceExtensionId':_0x4c9152['id']},{'type':_0x51ac('0x11'),'app':_0x51ac('0x9'),'appdata':_0x51ac('0x14')+(_0x4c9152[_0x51ac('0x15')]?_0x51ac('0x16')+_0x4c9152[_0x51ac('0x15')]+'}':_0x51ac('0x17')),'context':_0x4c9152[_0x51ac('0x5')],'exten':_0x4c9152['exten'],'priority':_0x6d1416++,'VoiceExtensionId':_0x4c9152['id']},{'type':_0x51ac('0x11'),'app':_0x51ac('0x9'),'appdata':'CDR(routeid)='+_0x4c9152['id'],'context':_0x4c9152[_0x51ac('0x5')],'exten':_0x4c9152[_0x51ac('0x6')],'priority':_0x6d1416++,'VoiceExtensionId':_0x4c9152['id']},{'type':_0x51ac('0x11'),'app':_0x51ac('0x18'),'appdata':_0x51ac('0x19')+(_0x6d1416+0x2)+_0x51ac('0x1a')+(_0x6d1416+0x1)+')','context':_0x4c9152['context'],'exten':_0x4c9152[_0x51ac('0x6')],'priority':_0x6d1416++,'VoiceExtensionId':_0x4c9152['id']},{'type':_0x51ac('0x11'),'app':_0x51ac('0x9'),'appdata':_0x4c9152[_0x51ac('0x15')]?_0x51ac('0x1b')+_0x4c9152[_0x51ac('0x15')]+'}':_0x51ac('0x1c'),'context':_0x4c9152[_0x51ac('0x5')],'exten':_0x4c9152['exten'],'priority':_0x6d1416++,'VoiceExtensionId':_0x4c9152['id']},{'type':_0x51ac('0x11'),'app':_0x51ac('0x9'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x4c9152[_0x51ac('0x5')],'exten':_0x4c9152[_0x51ac('0x6')],'priority':_0x6d1416++,'VoiceExtensionId':_0x4c9152['id']},{'type':'outbound','app':_0x51ac('0x9'),'appdata':_0x51ac('0xf'),'context':_0x4c9152[_0x51ac('0x5')],'exten':_0x4c9152[_0x51ac('0x6')],'priority':_0x6d1416++,'VoiceExtensionId':_0x4c9152['id']},{'type':_0x51ac('0x11'),'app':'Set','appdata':_0x51ac('0x10'),'context':_0x4c9152[_0x51ac('0x5')],'exten':_0x4c9152[_0x51ac('0x6')],'priority':_0x6d1416++,'VoiceExtensionId':_0x4c9152['id']},{'type':_0x51ac('0x11'),'app':'Set','appdata':_0x51ac('0x1d')+_0x4c9152['id'],'context':_0x4c9152['context'],'exten':_0x4c9152[_0x51ac('0x6')],'priority':_0x6d1416++,'VoiceExtensionId':_0x4c9152['id']}];if(_0x4c9152[_0x51ac('0x1e')](_0x51ac('0x1f'))&&_0x4c9152[_0x51ac('0x1f')]!=='none'){_0x47cffc['push']({'type':_0x51ac('0x11'),'app':_0x51ac('0x9'),'appdata':_0x51ac('0x20'),'context':_0x4c9152[_0x51ac('0x5')],'exten':_0x4c9152[_0x51ac('0x6')],'priority':_0x6d1416++,'VoiceExtensionId':_0x4c9152['id']},{'type':_0x51ac('0x11'),'app':'Set','appdata':_0x51ac('0x21')+_0x4c9152['recordingFormat']||'wav','context':_0x4c9152[_0x51ac('0x5')],'exten':_0x4c9152['exten'],'priority':_0x6d1416++,'VoiceExtensionId':_0x4c9152['id']});}return _0x47cffc;}function _0x464417(_0x376933){var _0xaf45f9=[{'name':_0x51ac('0x22'),'param':0x0},{'name':_0x51ac('0x23'),'param':0x1},{'name':'options','param':0x2},{'name':'url','param':0x3}];var _0x5f1d93={};var _0x547fca=_0x376933[_0x51ac('0x24')](',');var _0x5ef6e3=[];for(var _0x292d74=0x0;_0x292d74<_0xaf45f9[_0x51ac('0x25')];_0x292d74++){switch(_0xaf45f9[_0x292d74][_0x51ac('0x26')]){case _0x51ac('0x22'):_0x5f1d93[_0x51ac('0x22')]=_0x547fca[_0xaf45f9[_0x292d74]['param']]['split']('/')[0x1];_0x5f1d93[_0x51ac('0x27')]=_0x547fca[_0xaf45f9[_0x292d74][_0x51ac('0x28')]][_0x51ac('0x24')]('/')[0x2];_0x5f1d93[_0x51ac('0x29')]=_0x5f1d93[_0x51ac('0x27')]?_0x5f1d93['phone'][_0x51ac('0x24')]('$')[0x0]:undefined;_0x5f1d93[_0x51ac('0x27')]=route[_0x51ac('0x15')]?(_0x5f1d93['prefix']||'')+_0x51ac('0x16')+route['cutdigits']+'}':(_0x5f1d93['prefix']||'')+_0x51ac('0x17');_0x5ef6e3[_0xaf45f9[_0x292d74][_0x51ac('0x28')]]=[_0x51ac('0x2a'),_0x5f1d93['trunk'],_0x5f1d93[_0x51ac('0x27')]][_0x51ac('0x2b')]('/');break;case _0x51ac('0x2c'):_0x5f1d93[_0x51ac('0x2c')]=_0x547fca[_0xaf45f9[_0x292d74][_0x51ac('0x28')]];if(route[_0x51ac('0x1f')]!=='none'){if(_0x5f1d93['options'][_0x51ac('0x2d')](_0x51ac('0x2e'))<0x0){_0x5f1d93[_0x51ac('0x2c')]+='U(xcally-mixmonitor-context)';}}else{_0x5f1d93[_0x51ac('0x2c')]=_0x5f1d93['options'][_0x51ac('0x2f')](_0x51ac('0x2e'),'');}_0x5ef6e3[_0xaf45f9[_0x292d74][_0x51ac('0x28')]]=_0x5f1d93[_0x51ac('0x2c')];break;default:_0x5ef6e3[_0xaf45f9[_0x292d74][_0x51ac('0x28')]]=_0x547fca[_0xaf45f9[_0x292d74][_0x51ac('0x28')]];}}return _0x5ef6e3[_0x51ac('0x2b')](',');}function _0x2eaab8(_0x49e871,_0x366188,_0x240f3a,_0x3c9069){return new Promise(function(_0x67d69e,_0x9554c2){var _0x58e9e1=[];if(_[_0x51ac('0x30')](_0x366188))return _0x67d69e(_0x58e9e1);_0x299a4f[_0x51ac('0x31')][_0x51ac('0x32')]({'attributes':['id',_0x51ac('0x33'),_0x51ac('0x34')],'raw':!![]})[_0x51ac('0x35')](function(_0x32f8d3){for(var _0x8a87d3=0x0,_0x2e8b02=0x0;_0x8a87d3<_0x366188[_0x51ac('0x25')];_0x8a87d3++,_0x2e8b02=0x0){var _0x66fabc=_0x366188[_0x8a87d3];var _0x1e17b4=[];var _0x3c1a1c=[];if(_0x66fabc[_0x51ac('0x33')]!=='*,*,*,*'){_0x66fabc[_0x51ac('0x36')]=[_0x66fabc['interval']];}else{_0x66fabc[_0x51ac('0x36')]=_0x66fabc[_0x51ac('0x34')]?_[_0x51ac('0x37')](_[_0x51ac('0x38')](_0x32f8d3,{'IntervalId':_0x66fabc['IntervalId']}),_0x51ac('0x33')):[];}_0x66fabc['context']=_0x49e871['context'];_0x66fabc[_0x51ac('0x6')]=_0x49e871['exten'];if(_0x66fabc[_0x51ac('0x7')])_0x66fabc[_0x51ac('0x7')]=_0x66fabc[_0x51ac('0x7')][_0x51ac('0x39')]();if(_0x49e871[_0x51ac('0x7')]===_0x51ac('0x11')){if(_0x66fabc['hasOwnProperty']('tag')&&_0x66fabc[_0x51ac('0x3a')]&&_0x66fabc[_0x51ac('0x3a')]!=='--'){_0x1e17b4['push']({'type':_0x66fabc[_0x51ac('0x7')]['toLowerCase'](),'app':_0x51ac('0x9'),'appdata':_0x51ac('0x3b')+_0x66fabc['tag'],'context':_0x49e871[_0x51ac('0x5')],'exten':_0x49e871[_0x51ac('0x6')],'priority':_0x66fabc[_0x51ac('0x36')][_0x51ac('0x25')]+_0x240f3a+_0x2e8b02++,'VoiceExtensionId':_0x49e871['id']});}_0x1e17b4[_0x51ac('0xd')]({'type':_0x66fabc[_0x51ac('0x7')][_0x51ac('0x39')](),'app':'ExecIf','appdata':_0x51ac('0x3c')+(_0x66fabc['callerID']?_0x51ac('0x3d')+_0x66fabc[_0x51ac('0x3e')]+')':_0x51ac('0x3f')),'context':_0x49e871[_0x51ac('0x5')],'exten':_0x49e871['exten'],'priority':_0x66fabc['intervals'][_0x51ac('0x25')]+_0x240f3a+_0x2e8b02++,'VoiceExtensionId':_0x49e871['id']});}else{if(_0x66fabc[_0x51ac('0x1e')](_0x51ac('0x40'))){if(['queue',_0x51ac('0x41')][_0x51ac('0x42')](_0x66fabc[_0x51ac('0x43')][_0x51ac('0x39')]())&&_0x66fabc[_0x51ac('0x44')]!==_0x51ac('0x45')){if(_0x66fabc[_0x51ac('0x40')]){_0x1e17b4['push']({'type':_0x66fabc[_0x51ac('0x7')][_0x51ac('0x39')](),'app':_0x51ac('0x18'),'appdata':_0x51ac('0x46'),'context':_0x49e871[_0x51ac('0x5')],'exten':_0x49e871['exten'],'priority':_0x66fabc[_0x51ac('0x36')][_0x51ac('0x25')]+_0x240f3a+_0x2e8b02++,'VoiceExtensionId':_0x49e871['id']});_0x1e17b4[_0x51ac('0xd')]({'type':_0x66fabc['type'][_0x51ac('0x39')](),'app':_0x51ac('0x9'),'appdata':_0x51ac('0x47'),'context':_0x49e871[_0x51ac('0x5')],'exten':_0x49e871[_0x51ac('0x6')],'priority':_0x66fabc['intervals'][_0x51ac('0x25')]+_0x240f3a+_0x2e8b02++,'VoiceExtensionId':_0x49e871['id']});}else{_0x1e17b4[_0x51ac('0xd')]({'type':_0x66fabc[_0x51ac('0x7')][_0x51ac('0x39')](),'app':_0x51ac('0x18'),'appdata':_0x51ac('0x48'),'context':_0x49e871['context'],'exten':_0x49e871[_0x51ac('0x6')],'priority':_0x66fabc[_0x51ac('0x36')][_0x51ac('0x25')]+_0x240f3a+_0x2e8b02++,'VoiceExtensionId':_0x49e871['id']});_0x1e17b4[_0x51ac('0xd')]({'type':_0x66fabc['type'][_0x51ac('0x39')](),'app':_0x51ac('0x9'),'appdata':_0x51ac('0x49'),'context':_0x49e871[_0x51ac('0x5')],'exten':_0x49e871[_0x51ac('0x6')],'priority':_0x66fabc[_0x51ac('0x36')][_0x51ac('0x25')]+_0x240f3a+_0x2e8b02++,'VoiceExtensionId':_0x49e871['id']});}}}}for(var _0x4d3e49=0x0;_0x4d3e49<_0x66fabc[_0x51ac('0x36')][_0x51ac('0x25')];_0x4d3e49++){var _0x184d81=_0x240f3a+_0x66fabc[_0x51ac('0x36')]['length'];var _0x504e7e=_0x4d3e49===_0x66fabc[_0x51ac('0x36')][_0x51ac('0x25')]-0x1?_0x240f3a+_0x1e17b4['length']+_0x3c1a1c[_0x51ac('0x25')]+0x2:_0x240f3a+_0x4d3e49+0x1;_0x1e17b4[_0x51ac('0x4a')](_0x4d3e49,0x0,{'type':_0x49e871['type'],'app':_0x51ac('0x4b'),'appdata':_0x66fabc[_0x51ac('0x36')][_0x4d3e49]+'?'+_0x49e871['context']+_0x51ac('0x4c')+_0x184d81+':'+_0x49e871[_0x51ac('0x5')]+',${EXTEN},'+_0x504e7e,'exten':_0x49e871[_0x51ac('0x6')],'context':_0x49e871['context'],'priority':_0x240f3a+_0x4d3e49,'VoiceExtensionId':_0x49e871['id']});}if(_0x3c9069&&_0x66fabc[_0x51ac('0x44')]===_0x51ac('0x4d'))_0x66fabc['appdata']=_0x464417(_0x66fabc['appdata']);_0x66fabc[_0x51ac('0x4e')]=_0x1e17b4[_0x51ac('0x25')]?_[_0x51ac('0x4f')](_0x1e17b4)['priority']+0x1:_0x240f3a;_0x58e9e1=_[_0x51ac('0x50')](_0x58e9e1,_0x1e17b4,[_0x66fabc],_0x3c1a1c);_0x240f3a=_[_0x51ac('0x4f')](_0x58e9e1)[_0x51ac('0x4e')]+0x1;}return _0x67d69e(_0x58e9e1);})[_0x51ac('0x51')](function(_0x396c8b){_0x9554c2(_0x396c8b);});});}return _0x2ccd28[_0x51ac('0x52')](_0x51ac('0x53'),attributes,{'tableName':_0x51ac('0x54'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x388b7d,_0x350097){var _0xe0c735=this;var _0xddb45b=_0xe0c735[_0x51ac('0x7')]==='outbound'?_0x59b655(_0xe0c735):_0x4ce91e(_0xe0c735);return _0x2eaab8(_0xe0c735,_0x388b7d,_[_0x51ac('0x4f')](_0xddb45b)[_0x51ac('0x4e')]+0x1,_0x350097)[_0x51ac('0x35')](function(_0x5b0e2e){var _0x1b97e9=_[_0x51ac('0x50')](_0xddb45b,_0x5b0e2e);_0x1b97e9[_0x51ac('0xd')]({'type':_0xe0c735['type'],'app':'Hangup','exten':_0xe0c735[_0x51ac('0x6')],'context':_0xe0c735['context'],'priority':_[_0x51ac('0x4f')](_0x1b97e9)['priority']+0x1,'VoiceExtensionId':_0xe0c735['id']});return _0x1b97e9;});}}});}; \ No newline at end of file +var _0x9702=['Hangup','lodash','./voiceExtension.attributes','exports','type','Set','CDR(type)=','context','exten','alias','NoOp','CDR(routeAlias)=','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','No\x20alias\x20set','cutdigits','${EXTEN:','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','trunk','split','length','param','phone','prefix','SIP','join','options','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','*,*,*,*','IntervalId','map','toLowerCase','tag','CDR(tag)=','intervals','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','answer','queue','playback','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','concat','catch','define','VoiceExtension','voice_extensions'];(function(_0x774a25,_0x46f547){var _0x3dc2fd=function(_0x27de02){while(--_0x27de02){_0x774a25['push'](_0x774a25['shift']());}};_0x3dc2fd(++_0x46f547);}(_0x9702,0x187));var _0x2970=function(_0x1bbfca,_0x3da67e){_0x1bbfca=_0x1bbfca-0x0;var _0x333bac=_0x9702[_0x1bbfca];return _0x333bac;};'use strict';var util=require('util');var _=require(_0x2970('0x0'));var attributes=require(_0x2970('0x1'));module[_0x2970('0x2')]=function(_0x4e900f){var _0x4a50e8=_0x4e900f['models'];function _0x4754ce(_0x1dc4c5){var _0x7437a8=0x2;var _0x2bb70f=[{'type':_0x1dc4c5[_0x2970('0x3')],'app':_0x2970('0x4'),'appdata':_0x2970('0x5')+_0x1dc4c5['type'],'context':_0x1dc4c5[_0x2970('0x6')],'exten':_0x1dc4c5[_0x2970('0x7')],'priority':_0x7437a8++,'VoiceExtensionId':_0x1dc4c5['id']},{'type':_0x1dc4c5[_0x2970('0x3')],'app':_0x1dc4c5[_0x2970('0x8')]?_0x2970('0x4'):_0x2970('0x9'),'appdata':_0x1dc4c5[_0x2970('0x8')]?_0x2970('0xa')+_0x1dc4c5['alias']:'No\x20alias\x20set','context':_0x1dc4c5['context'],'exten':_0x1dc4c5[_0x2970('0x7')],'priority':_0x7437a8++,'VoiceExtensionId':_0x1dc4c5['id']}];if(_0x1dc4c5[_0x2970('0x3')]===_0x2970('0xb')){_0x2bb70f[_0x2970('0xc')]({'type':_0x2970('0xb'),'app':'Set','appdata':_0x2970('0xd')+_0x1dc4c5['id'],'context':_0x1dc4c5[_0x2970('0x6')],'exten':_0x1dc4c5[_0x2970('0x7')],'priority':_0x7437a8++,'VoiceExtensionId':_0x1dc4c5['id']});}_0x2bb70f['push']({'type':_0x1dc4c5[_0x2970('0x3')],'app':_0x2970('0x4'),'appdata':_0x2970('0xe'),'context':_0x1dc4c5[_0x2970('0x6')],'exten':_0x1dc4c5[_0x2970('0x7')],'priority':_0x7437a8++,'VoiceExtensionId':_0x1dc4c5['id']},{'type':_0x1dc4c5['type'],'app':_0x2970('0x4'),'appdata':_0x2970('0xf'),'context':_0x1dc4c5[_0x2970('0x6')],'exten':_0x1dc4c5[_0x2970('0x7')],'priority':_0x7437a8++,'VoiceExtensionId':_0x1dc4c5['id']},{'type':_0x1dc4c5[_0x2970('0x3')],'app':_0x2970('0x4'),'appdata':_0x2970('0x10'),'context':_0x1dc4c5[_0x2970('0x6')],'exten':_0x1dc4c5[_0x2970('0x7')],'priority':_0x7437a8++,'VoiceExtensionId':_0x1dc4c5['id']});return _0x2bb70f;}function _0x375585(_0x28c2cb){var _0x36ada1=0x2;var _0xf547dd=[{'type':_0x2970('0x11'),'app':_0x2970('0x4'),'appdata':_0x2970('0x12'),'context':_0x28c2cb[_0x2970('0x6')],'exten':_0x28c2cb[_0x2970('0x7')],'priority':_0x36ada1++,'VoiceExtensionId':_0x28c2cb['id']},{'type':_0x2970('0x11'),'app':_0x28c2cb['alias']?_0x2970('0x4'):_0x2970('0x9'),'appdata':_0x28c2cb[_0x2970('0x8')]?'CDR(routeAlias)='+_0x28c2cb[_0x2970('0x8')]:_0x2970('0x13'),'context':_0x28c2cb['context'],'exten':_0x28c2cb[_0x2970('0x7')],'priority':_0x36ada1++,'VoiceExtensionId':_0x28c2cb['id']},{'type':_0x2970('0x11'),'app':_0x2970('0x4'),'appdata':'CDR(destination)='+(_0x28c2cb[_0x2970('0x14')]?_0x2970('0x15')+_0x28c2cb[_0x2970('0x14')]+'}':_0x2970('0x16')),'context':_0x28c2cb[_0x2970('0x6')],'exten':_0x28c2cb['exten'],'priority':_0x36ada1++,'VoiceExtensionId':_0x28c2cb['id']},{'type':_0x2970('0x11'),'app':_0x2970('0x4'),'appdata':_0x2970('0xd')+_0x28c2cb['id'],'context':_0x28c2cb[_0x2970('0x6')],'exten':_0x28c2cb[_0x2970('0x7')],'priority':_0x36ada1++,'VoiceExtensionId':_0x28c2cb['id']},{'type':_0x2970('0x11'),'app':'ExecIf','appdata':_0x2970('0x17')+(_0x36ada1+0x2)+'):Goto('+(_0x36ada1+0x1)+')','context':_0x28c2cb['context'],'exten':_0x28c2cb[_0x2970('0x7')],'priority':_0x36ada1++,'VoiceExtensionId':_0x28c2cb['id']},{'type':_0x2970('0x11'),'app':'Set','appdata':_0x28c2cb[_0x2970('0x14')]?_0x2970('0x18')+_0x28c2cb[_0x2970('0x14')]+'}':'CDR(prefix)=noprefix','context':_0x28c2cb['context'],'exten':_0x28c2cb[_0x2970('0x7')],'priority':_0x36ada1++,'VoiceExtensionId':_0x28c2cb['id']},{'type':_0x2970('0x11'),'app':_0x2970('0x4'),'appdata':_0x2970('0xe'),'context':_0x28c2cb[_0x2970('0x6')],'exten':_0x28c2cb[_0x2970('0x7')],'priority':_0x36ada1++,'VoiceExtensionId':_0x28c2cb['id']},{'type':_0x2970('0x11'),'app':_0x2970('0x4'),'appdata':_0x2970('0xf'),'context':_0x28c2cb['context'],'exten':_0x28c2cb[_0x2970('0x7')],'priority':_0x36ada1++,'VoiceExtensionId':_0x28c2cb['id']},{'type':_0x2970('0x11'),'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x28c2cb[_0x2970('0x6')],'exten':_0x28c2cb[_0x2970('0x7')],'priority':_0x36ada1++,'VoiceExtensionId':_0x28c2cb['id']},{'type':_0x2970('0x11'),'app':_0x2970('0x4'),'appdata':'outboundrouteid='+_0x28c2cb['id'],'context':_0x28c2cb['context'],'exten':_0x28c2cb[_0x2970('0x7')],'priority':_0x36ada1++,'VoiceExtensionId':_0x28c2cb['id']}];if(_0x28c2cb[_0x2970('0x19')](_0x2970('0x1a'))&&_0x28c2cb[_0x2970('0x1a')]!==_0x2970('0x1b')){_0xf547dd[_0x2970('0xc')]({'type':_0x2970('0x11'),'app':_0x2970('0x4'),'appdata':_0x2970('0x1c'),'context':_0x28c2cb['context'],'exten':_0x28c2cb[_0x2970('0x7')],'priority':_0x36ada1++,'VoiceExtensionId':_0x28c2cb['id']},{'type':_0x2970('0x11'),'app':'Set','appdata':_0x2970('0x1d')+_0x28c2cb[_0x2970('0x1a')]||'wav','context':_0x28c2cb[_0x2970('0x6')],'exten':_0x28c2cb[_0x2970('0x7')],'priority':_0x36ada1++,'VoiceExtensionId':_0x28c2cb['id']});}return _0xf547dd;}function _0x59b868(_0x305211){var _0x29636c=[{'name':_0x2970('0x1e'),'param':0x0},{'name':'timeout','param':0x1},{'name':'options','param':0x2},{'name':'url','param':0x3}];var _0x5810f5={};var _0x491d07=_0x305211[_0x2970('0x1f')](',');var _0x4d1e16=[];for(var _0x5c5448=0x0;_0x5c5448<_0x29636c[_0x2970('0x20')];_0x5c5448++){switch(_0x29636c[_0x5c5448]['name']){case _0x2970('0x1e'):_0x5810f5['trunk']=_0x491d07[_0x29636c[_0x5c5448][_0x2970('0x21')]][_0x2970('0x1f')]('/')[0x1];_0x5810f5[_0x2970('0x22')]=_0x491d07[_0x29636c[_0x5c5448][_0x2970('0x21')]][_0x2970('0x1f')]('/')[0x2];_0x5810f5[_0x2970('0x23')]=_0x5810f5[_0x2970('0x22')]?_0x5810f5[_0x2970('0x22')][_0x2970('0x1f')]('$')[0x0]:undefined;_0x5810f5[_0x2970('0x22')]=route['cutdigits']?(_0x5810f5[_0x2970('0x23')]||'')+_0x2970('0x15')+route[_0x2970('0x14')]+'}':(_0x5810f5['prefix']||'')+'${EXTEN}';_0x4d1e16[_0x29636c[_0x5c5448][_0x2970('0x21')]]=[_0x2970('0x24'),_0x5810f5[_0x2970('0x1e')],_0x5810f5['phone']][_0x2970('0x25')]('/');break;case'options':_0x5810f5['options']=_0x491d07[_0x29636c[_0x5c5448][_0x2970('0x21')]];if(route[_0x2970('0x1a')]!==_0x2970('0x1b')){if(_0x5810f5['options']['indexOf']('U(xcally-mixmonitor-context)')<0x0){_0x5810f5[_0x2970('0x26')]+=_0x2970('0x27');}}else{_0x5810f5[_0x2970('0x26')]=_0x5810f5[_0x2970('0x26')][_0x2970('0x28')](_0x2970('0x27'),'');}_0x4d1e16[_0x29636c[_0x5c5448][_0x2970('0x21')]]=_0x5810f5['options'];break;default:_0x4d1e16[_0x29636c[_0x5c5448][_0x2970('0x21')]]=_0x491d07[_0x29636c[_0x5c5448][_0x2970('0x21')]];}}return _0x4d1e16['join'](',');}function _0x3fbee2(_0x4e05d6,_0x2e4dcd,_0x4dcb71,_0x372a05){return new Promise(function(_0x568811,_0x1f69c6){var _0x3eca02=[];if(_[_0x2970('0x29')](_0x2e4dcd))return _0x568811(_0x3eca02);_0x4a50e8[_0x2970('0x2a')][_0x2970('0x2b')]({'attributes':['id',_0x2970('0x2c'),'IntervalId'],'raw':!![]})['then'](function(_0x27395d){for(var _0xf74507=0x0,_0x3260b5=0x0;_0xf74507<_0x2e4dcd[_0x2970('0x20')];_0xf74507++,_0x3260b5=0x0){var _0x28e6ac=_0x2e4dcd[_0xf74507];var _0x64ba6d=[];var _0x48a6e6=[];if(_0x28e6ac[_0x2970('0x2c')]!==_0x2970('0x2d')){_0x28e6ac['intervals']=[_0x28e6ac[_0x2970('0x2c')]];}else{_0x28e6ac['intervals']=_0x28e6ac[_0x2970('0x2e')]?_[_0x2970('0x2f')](_['filter'](_0x27395d,{'IntervalId':_0x28e6ac[_0x2970('0x2e')]}),_0x2970('0x2c')):[];}_0x28e6ac[_0x2970('0x6')]=_0x4e05d6[_0x2970('0x6')];_0x28e6ac[_0x2970('0x7')]=_0x4e05d6[_0x2970('0x7')];if(_0x28e6ac['type'])_0x28e6ac[_0x2970('0x3')]=_0x28e6ac[_0x2970('0x3')][_0x2970('0x30')]();if(_0x4e05d6['type']==='outbound'){if(_0x28e6ac[_0x2970('0x19')](_0x2970('0x31'))&&_0x28e6ac['tag']&&_0x28e6ac[_0x2970('0x31')]!=='--'){_0x64ba6d['push']({'type':_0x28e6ac[_0x2970('0x3')][_0x2970('0x30')](),'app':_0x2970('0x4'),'appdata':_0x2970('0x32')+_0x28e6ac[_0x2970('0x31')],'context':_0x4e05d6[_0x2970('0x6')],'exten':_0x4e05d6['exten'],'priority':_0x28e6ac[_0x2970('0x33')]['length']+_0x4dcb71+_0x3260b5++,'VoiceExtensionId':_0x4e05d6['id']});}_0x64ba6d[_0x2970('0xc')]({'type':_0x28e6ac[_0x2970('0x3')][_0x2970('0x30')](),'app':_0x2970('0x34'),'appdata':_0x2970('0x35')+(_0x28e6ac[_0x2970('0x36')]?_0x2970('0x37')+_0x28e6ac[_0x2970('0x36')]+')':'NoOp(No\x20number\x20available)'),'context':_0x4e05d6[_0x2970('0x6')],'exten':_0x4e05d6[_0x2970('0x7')],'priority':_0x28e6ac[_0x2970('0x33')][_0x2970('0x20')]+_0x4dcb71+_0x3260b5++,'VoiceExtensionId':_0x4e05d6['id']});}else{if(_0x28e6ac['hasOwnProperty'](_0x2970('0x38'))){if([_0x2970('0x39'),_0x2970('0x3a')]['includes'](_0x28e6ac[_0x2970('0x3b')][_0x2970('0x30')]())&&_0x28e6ac[_0x2970('0x3c')]!==_0x2970('0x3d')){if(_0x28e6ac[_0x2970('0x38')]){_0x64ba6d[_0x2970('0xc')]({'type':_0x28e6ac[_0x2970('0x3')][_0x2970('0x30')](),'app':_0x2970('0x34'),'appdata':_0x2970('0x3e'),'context':_0x4e05d6[_0x2970('0x6')],'exten':_0x4e05d6['exten'],'priority':_0x28e6ac[_0x2970('0x33')]['length']+_0x4dcb71+_0x3260b5++,'VoiceExtensionId':_0x4e05d6['id']});_0x64ba6d[_0x2970('0xc')]({'type':_0x28e6ac['type']['toLowerCase'](),'app':_0x2970('0x4'),'appdata':_0x2970('0x3f'),'context':_0x4e05d6[_0x2970('0x6')],'exten':_0x4e05d6[_0x2970('0x7')],'priority':_0x28e6ac[_0x2970('0x33')][_0x2970('0x20')]+_0x4dcb71+_0x3260b5++,'VoiceExtensionId':_0x4e05d6['id']});}else{_0x64ba6d['push']({'type':_0x28e6ac[_0x2970('0x3')][_0x2970('0x30')](),'app':_0x2970('0x34'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x4e05d6[_0x2970('0x6')],'exten':_0x4e05d6['exten'],'priority':_0x28e6ac[_0x2970('0x33')][_0x2970('0x20')]+_0x4dcb71+_0x3260b5++,'VoiceExtensionId':_0x4e05d6['id']});_0x64ba6d[_0x2970('0xc')]({'type':_0x28e6ac[_0x2970('0x3')]['toLowerCase'](),'app':_0x2970('0x4'),'appdata':_0x2970('0x40'),'context':_0x4e05d6[_0x2970('0x6')],'exten':_0x4e05d6[_0x2970('0x7')],'priority':_0x28e6ac[_0x2970('0x33')][_0x2970('0x20')]+_0x4dcb71+_0x3260b5++,'VoiceExtensionId':_0x4e05d6['id']});}}}}for(var _0x5c101f=0x0;_0x5c101f<_0x28e6ac[_0x2970('0x33')][_0x2970('0x20')];_0x5c101f++){var _0x3d0c7a=_0x4dcb71+_0x28e6ac[_0x2970('0x33')][_0x2970('0x20')];var _0xa03164=_0x5c101f===_0x28e6ac[_0x2970('0x33')]['length']-0x1?_0x4dcb71+_0x64ba6d[_0x2970('0x20')]+_0x48a6e6[_0x2970('0x20')]+0x2:_0x4dcb71+_0x5c101f+0x1;_0x64ba6d[_0x2970('0x41')](_0x5c101f,0x0,{'type':_0x4e05d6[_0x2970('0x3')],'app':_0x2970('0x42'),'appdata':_0x28e6ac['intervals'][_0x5c101f]+'?'+_0x4e05d6[_0x2970('0x6')]+_0x2970('0x43')+_0x3d0c7a+':'+_0x4e05d6['context']+_0x2970('0x43')+_0xa03164,'exten':_0x4e05d6['exten'],'context':_0x4e05d6[_0x2970('0x6')],'priority':_0x4dcb71+_0x5c101f,'VoiceExtensionId':_0x4e05d6['id']});}if(_0x372a05&&_0x28e6ac[_0x2970('0x3c')]===_0x2970('0x44'))_0x28e6ac['appdata']=_0x59b868(_0x28e6ac[_0x2970('0x45')]);_0x28e6ac[_0x2970('0x46')]=_0x64ba6d[_0x2970('0x20')]?_[_0x2970('0x47')](_0x64ba6d)[_0x2970('0x46')]+0x1:_0x4dcb71;_0x3eca02=_[_0x2970('0x48')](_0x3eca02,_0x64ba6d,[_0x28e6ac],_0x48a6e6);_0x4dcb71=_[_0x2970('0x47')](_0x3eca02)[_0x2970('0x46')]+0x1;}return _0x568811(_0x3eca02);})[_0x2970('0x49')](function(_0x4a3358){_0x1f69c6(_0x4a3358);});});}return _0x4e900f[_0x2970('0x4a')](_0x2970('0x4b'),attributes,{'tableName':_0x2970('0x4c'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x4bd409,_0x2d720e){var _0x4b6d78=this;var _0x393cfd=_0x4b6d78['type']==='outbound'?_0x375585(_0x4b6d78):_0x4754ce(_0x4b6d78);return _0x3fbee2(_0x4b6d78,_0x4bd409,_[_0x2970('0x47')](_0x393cfd)[_0x2970('0x46')]+0x1,_0x2d720e)['then'](function(_0x470410){var _0x3b5f99=_['concat'](_0x393cfd,_0x470410);_0x3b5f99['push']({'type':_0x4b6d78[_0x2970('0x3')],'app':_0x2970('0x4d'),'exten':_0x4b6d78[_0x2970('0x7')],'context':_0x4b6d78[_0x2970('0x6')],'priority':_[_0x2970('0x47')](_0x3b5f99)['priority']+0x1,'VoiceExtensionId':_0x4b6d78['id']});return _0x3b5f99;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 2c2034f..2de1c34 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 _0x6d19=['register','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit','include','map','model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x6d19,0x160));var _0x96d1=function(_0x44d9ab,_0x76bc69){_0x44d9ab=_0x44d9ab-0x0;var _0x31485e=_0x6d19[_0x44d9ab];return _0x31485e;};'use strict';var _=require(_0x96d1('0x0'));var util=require(_0x96d1('0x1'));var moment=require(_0x96d1('0x2'));var BPromise=require(_0x96d1('0x3'));var rs=require(_0x96d1('0x4'));var fs=require('fs');var Redis=require(_0x96d1('0x5'));var db=require(_0x96d1('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x96d1('0x7'))(_0x96d1('0x8'));var config=require(_0x96d1('0x9'));var jayson=require(_0x96d1('0xa'));var client=jayson['client'][_0x96d1('0xb')]({'port':0x232a});config[_0x96d1('0xc')]=_[_0x96d1('0xd')](config['redis'],{'host':_0x96d1('0xe'),'port':0x18eb});var socket=require(_0x96d1('0xf'))(new Redis(config[_0x96d1('0xc')]));require(_0x96d1('0x10'))[_0x96d1('0x11')](socket);function respondWithRpcPromise(_0x38ecf1,_0x4d3e32,_0x4bd620){return new BPromise(function(_0x44e65d,_0x2de9e3){return client['request'](_0x38ecf1,_0x4bd620)[_0x96d1('0x12')](function(_0x51b089){logger[_0x96d1('0x13')](_0x96d1('0x14'),_0x4d3e32,_0x96d1('0x15'));logger[_0x96d1('0x16')](_0x96d1('0x17'),_0x4d3e32,_0x96d1('0x15'),JSON['stringify'](_0x51b089));if(_0x51b089[_0x96d1('0x18')]){if(_0x51b089[_0x96d1('0x18')][_0x96d1('0x19')]===0x1f4){logger[_0x96d1('0x18')](_0x96d1('0x14'),_0x4d3e32,_0x51b089['error']['message']);return _0x2de9e3(_0x51b089[_0x96d1('0x18')][_0x96d1('0x1a')]);}logger[_0x96d1('0x18')](_0x96d1('0x14'),_0x4d3e32,_0x51b089[_0x96d1('0x18')][_0x96d1('0x1a')]);return _0x44e65d(_0x51b089[_0x96d1('0x18')][_0x96d1('0x1a')]);}else{logger[_0x96d1('0x13')]('VoiceExtension,\x20%s,\x20%s',_0x4d3e32,_0x96d1('0x15'));_0x44e65d(_0x51b089[_0x96d1('0x1b')][_0x96d1('0x1a')]);}})[_0x96d1('0x1c')](function(_0x10a351){logger['error'](_0x96d1('0x14'),_0x4d3e32,_0x10a351);_0x2de9e3(_0x10a351);});});}exports[_0x96d1('0x1d')]=function(_0x28b2aa){var _0x393f5c=this;return new Promise(function(_0x5866e9,_0x17e281){return db[_0x96d1('0x1e')][_0x96d1('0x1f')]({'raw':_0x28b2aa[_0x96d1('0x20')]?_0x28b2aa['options'][_0x96d1('0x21')]===undefined?!![]:![]:!![],'where':_0x28b2aa[_0x96d1('0x20')]?_0x28b2aa[_0x96d1('0x20')][_0x96d1('0x22')]||null:null,'attributes':_0x28b2aa['options']?_0x28b2aa[_0x96d1('0x20')][_0x96d1('0x23')]||null:null,'limit':_0x28b2aa['options']?_0x28b2aa[_0x96d1('0x20')][_0x96d1('0x24')]||null:null,'include':_0x28b2aa['options']?_0x28b2aa[_0x96d1('0x20')][_0x96d1('0x25')]?_[_0x96d1('0x26')](_0x28b2aa['options'][_0x96d1('0x25')],function(_0x46aa64){return{'model':db[_0x46aa64[_0x96d1('0x27')]],'as':_0x46aa64['as'],'attributes':_0x46aa64['attributes'],'include':_0x46aa64['include']?_[_0x96d1('0x26')](_0x46aa64['include'],function(_0x3728c8){return{'model':db[_0x3728c8[_0x96d1('0x27')]],'as':_0x3728c8['as'],'attributes':_0x3728c8[_0x96d1('0x23')],'include':_0x3728c8[_0x96d1('0x25')]?_[_0x96d1('0x26')](_0x3728c8['include'],function(_0x1b42a0){return{'model':db[_0x1b42a0[_0x96d1('0x27')]],'as':_0x1b42a0['as'],'attributes':_0x1b42a0[_0x96d1('0x23')]};}):[]};}):[]};}):[]:[]})[_0x96d1('0x12')](function(_0x5a83e6){logger[_0x96d1('0x13')](_0x96d1('0x1d'),_0x28b2aa);logger['debug']('GetVoiceExtension',_0x28b2aa,JSON[_0x96d1('0x28')](_0x5a83e6));_0x5866e9(_0x5a83e6);})[_0x96d1('0x1c')](function(_0x3968f5){logger[_0x96d1('0x18')](_0x96d1('0x1d'),_0x3968f5[_0x96d1('0x1a')],_0x28b2aa);_0x17e281(_0x393f5c['error'](0x1f4,_0x3968f5[_0x96d1('0x1a')]));});});}; \ No newline at end of file +var _0x08d9=['moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','VoiceExtension,\x20%s,\x20%s','VoiceExtension','findAll','options','raw','attributes','limit','map','include','model','GetVoiceExtension','debug','lodash'];(function(_0x328eee,_0x4c044a){var _0x3c45bb=function(_0x5f3302){while(--_0x5f3302){_0x328eee['push'](_0x328eee['shift']());}};_0x3c45bb(++_0x4c044a);}(_0x08d9,0xc2));var _0x908d=function(_0x118425,_0x2f2332){_0x118425=_0x118425-0x0;var _0x240451=_0x08d9[_0x118425];return _0x240451;};'use strict';var _=require(_0x908d('0x0'));var util=require('util');var moment=require(_0x908d('0x1'));var BPromise=require('bluebird');var rs=require(_0x908d('0x2'));var fs=require('fs');var Redis=require(_0x908d('0x3'));var db=require(_0x908d('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x908d('0x5'));var config=require(_0x908d('0x6'));var jayson=require(_0x908d('0x7'));var client=jayson[_0x908d('0x8')][_0x908d('0x9')]({'port':0x232a});config['redis']=_[_0x908d('0xa')](config[_0x908d('0xb')],{'host':_0x908d('0xc'),'port':0x18eb});var socket=require(_0x908d('0xd'))(new Redis(config[_0x908d('0xb')]));require(_0x908d('0xe'))[_0x908d('0xf')](socket);function respondWithRpcPromise(_0x24113f,_0x41b147,_0x2ac2b7){return new BPromise(function(_0x570b56,_0x938950){return client[_0x908d('0x10')](_0x24113f,_0x2ac2b7)[_0x908d('0x11')](function(_0x114027){logger[_0x908d('0x12')]('VoiceExtension,\x20%s,\x20%s',_0x41b147,'request\x20sent');logger['debug'](_0x908d('0x13'),_0x41b147,_0x908d('0x14'),JSON[_0x908d('0x15')](_0x114027));if(_0x114027[_0x908d('0x16')]){if(_0x114027[_0x908d('0x16')][_0x908d('0x17')]===0x1f4){logger[_0x908d('0x16')]('VoiceExtension,\x20%s,\x20%s',_0x41b147,_0x114027['error'][_0x908d('0x18')]);return _0x938950(_0x114027[_0x908d('0x16')][_0x908d('0x18')]);}logger[_0x908d('0x16')]('VoiceExtension,\x20%s,\x20%s',_0x41b147,_0x114027['error'][_0x908d('0x18')]);return _0x570b56(_0x114027[_0x908d('0x16')][_0x908d('0x18')]);}else{logger[_0x908d('0x12')]('VoiceExtension,\x20%s,\x20%s',_0x41b147,_0x908d('0x14'));_0x570b56(_0x114027[_0x908d('0x19')][_0x908d('0x18')]);}})[_0x908d('0x1a')](function(_0x209ffd){logger[_0x908d('0x16')](_0x908d('0x1b'),_0x41b147,_0x209ffd);_0x938950(_0x209ffd);});});}exports['GetVoiceExtension']=function(_0x34a524){var _0x10848a=this;return new Promise(function(_0x46dd69,_0x48ef83){return db[_0x908d('0x1c')][_0x908d('0x1d')]({'raw':_0x34a524[_0x908d('0x1e')]?_0x34a524[_0x908d('0x1e')][_0x908d('0x1f')]===undefined?!![]:![]:!![],'where':_0x34a524['options']?_0x34a524[_0x908d('0x1e')]['where']||null:null,'attributes':_0x34a524[_0x908d('0x1e')]?_0x34a524[_0x908d('0x1e')][_0x908d('0x20')]||null:null,'limit':_0x34a524[_0x908d('0x1e')]?_0x34a524[_0x908d('0x1e')][_0x908d('0x21')]||null:null,'include':_0x34a524[_0x908d('0x1e')]?_0x34a524[_0x908d('0x1e')]['include']?_[_0x908d('0x22')](_0x34a524[_0x908d('0x1e')][_0x908d('0x23')],function(_0x269e36){return{'model':db[_0x269e36[_0x908d('0x24')]],'as':_0x269e36['as'],'attributes':_0x269e36['attributes'],'include':_0x269e36['include']?_[_0x908d('0x22')](_0x269e36[_0x908d('0x23')],function(_0x41ca76){return{'model':db[_0x41ca76[_0x908d('0x24')]],'as':_0x41ca76['as'],'attributes':_0x41ca76[_0x908d('0x20')],'include':_0x41ca76['include']?_[_0x908d('0x22')](_0x41ca76[_0x908d('0x23')],function(_0x5f529e){return{'model':db[_0x5f529e[_0x908d('0x24')]],'as':_0x5f529e['as'],'attributes':_0x5f529e[_0x908d('0x20')]};}):[]};}):[]};}):[]:[]})[_0x908d('0x11')](function(_0x44b7a5){logger[_0x908d('0x12')](_0x908d('0x25'),_0x34a524);logger[_0x908d('0x26')](_0x908d('0x25'),_0x34a524,JSON[_0x908d('0x15')](_0x44b7a5));_0x46dd69(_0x44b7a5);})[_0x908d('0x1a')](function(_0xb38043){logger['error'](_0x908d('0x25'),_0xb38043[_0x908d('0x18')],_0x34a524);_0x48ef83(_0x10848a[_0x908d('0x16')](0x1f4,_0xb38043[_0x908d('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 9470878..241315b 100644 --- a/server/api/voiceExtension/voiceExtension.socket.js +++ b/server/api/voiceExtension/voiceExtension.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf494=['save','remove','emit','removeListener','register','voiceExtension:','./voiceExtension.events'];(function(_0x210343,_0x49c255){var _0x30a8e8=function(_0x4c4738){while(--_0x4c4738){_0x210343['push'](_0x210343['shift']());}};_0x30a8e8(++_0x49c255);}(_0xf494,0x1c6));var _0x4f49=function(_0xd69099,_0x4e017b){_0xd69099=_0xd69099-0x0;var _0x2a4022=_0xf494[_0xd69099];return _0x2a4022;};'use strict';var VoiceExtensionEvents=require(_0x4f49('0x0'));var events=[_0x4f49('0x1'),_0x4f49('0x2'),'update'];function createListener(_0x3aeeb8,_0x1d54cc){return function(_0x423b25){_0x1d54cc[_0x4f49('0x3')](_0x3aeeb8,_0x423b25);};}function removeListener(_0x20c0d7,_0x2a15fb){return function(){VoiceExtensionEvents[_0x4f49('0x4')](_0x20c0d7,_0x2a15fb);};}exports[_0x4f49('0x5')]=function(_0xc5e778){for(var _0x413530=0x0,_0x42b0e8=events['length'];_0x413530<_0x42b0e8;_0x413530++){var _0x58e9a0=events[_0x413530];var _0x169c95=createListener(_0x4f49('0x6')+_0x58e9a0,_0xc5e778);VoiceExtensionEvents['on'](_0x58e9a0,_0x169c95);}}; \ No newline at end of file +var _0x5fc3=['./voiceExtension.events','save','update','emit','removeListener','register','voiceExtension:'];(function(_0x1c7703,_0x5a91d8){var _0x163f1a=function(_0x4949ce){while(--_0x4949ce){_0x1c7703['push'](_0x1c7703['shift']());}};_0x163f1a(++_0x5a91d8);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3ad7ad,_0x291a8d){_0x3ad7ad=_0x3ad7ad-0x0;var _0x225a60=_0x5fc3[_0x3ad7ad];return _0x225a60;};'use strict';var VoiceExtensionEvents=require(_0x35fc('0x0'));var events=[_0x35fc('0x1'),'remove',_0x35fc('0x2')];function createListener(_0x2ac6da,_0x196bc2){return function(_0x91d024){_0x196bc2[_0x35fc('0x3')](_0x2ac6da,_0x91d024);};}function removeListener(_0x5e75e6,_0x2d1404){return function(){VoiceExtensionEvents[_0x35fc('0x4')](_0x5e75e6,_0x2d1404);};}exports[_0x35fc('0x5')]=function(_0x5b85ad){for(var _0x5754be=0x0,_0x19a0d1=events['length'];_0x5754be<_0x19a0d1;_0x5754be++){var _0x16e153=events[_0x5754be];var _0x27524f=createListener(_0x35fc('0x6')+_0x16e153,_0x5b85ad);VoiceExtensionEvents['on'](_0x16e153,_0x27524f);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 30f0fd0..22d44a6 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 _0xb145=['show','/:id/messages','getMessages','post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','get','isAuthenticated','index','/:id'];(function(_0x4ce5db,_0xd6ecd3){var _0x2e3398=function(_0x4b049f){while(--_0x4b049f){_0x4ce5db['push'](_0x4ce5db['shift']());}};_0x2e3398(++_0xd6ecd3);}(_0xb145,0xa3));var _0x5b14=function(_0x5f2359,_0x152375){_0x5f2359=_0x5f2359-0x0;var _0xc41a57=_0xb145[_0x5f2359];return _0xc41a57;};'use strict';var multer=require('multer');var util=require(_0x5b14('0x0'));var path=require(_0x5b14('0x1'));var timeout=require(_0x5b14('0x2'));var express=require(_0x5b14('0x3'));var router=express[_0x5b14('0x4')]();var fs_extra=require(_0x5b14('0x5'));var auth=require(_0x5b14('0x6'));var interaction=require(_0x5b14('0x7'));var config=require('../../config/environment');var controller=require(_0x5b14('0x8'));router[_0x5b14('0x9')]('/',auth[_0x5b14('0xa')](),controller[_0x5b14('0xb')]);router['get'](_0x5b14('0xc'),auth[_0x5b14('0xa')](),controller[_0x5b14('0xd')]);router[_0x5b14('0x9')](_0x5b14('0xe'),auth['isAuthenticated'](),controller[_0x5b14('0xf')]);router[_0x5b14('0x10')]('/',auth['isAuthenticated'](),controller[_0x5b14('0x11')]);router[_0x5b14('0x12')](_0x5b14('0xc'),auth[_0x5b14('0xa')](),controller[_0x5b14('0x13')]);router['delete'](_0x5b14('0xc'),auth['isAuthenticated'](),controller[_0x5b14('0x14')]);module[_0x5b14('0x15')]=router; \ No newline at end of file +var _0x1261=['isAuthenticated','show','/:id/messages','post','create','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','index','get'];(function(_0x533677,_0x5ecc9e){var _0x235512=function(_0x542b2c){while(--_0x542b2c){_0x533677['push'](_0x533677['shift']());}};_0x235512(++_0x5ecc9e);}(_0x1261,0x144));var _0x1126=function(_0x3a66fa,_0x399904){_0x3a66fa=_0x3a66fa-0x0;var _0x388cf9=_0x1261[_0x3a66fa];return _0x388cf9;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xb')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['getMessages']);router[_0x1126('0xf')]('/',auth[_0x1126('0xc')](),controller[_0x1126('0x10')]);router['put'](_0x1126('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x1126('0x12')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0x13')]);module[_0x1126('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 145e3bf..7f37b22 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 _0x5260=['trim','ENUM','yes','TINYINT(4)','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','exports','STRING','from-voicemail','contest_mailbox','email','string'];(function(_0x333767,_0x3e6f9c){var _0x51661b=function(_0x46e5d6){while(--_0x46e5d6){_0x333767['push'](_0x333767['shift']());}};_0x51661b(++_0x3e6f9c);}(_0x5260,0x15a));var _0x0526=function(_0x475f0e,_0x109994){_0x475f0e=_0x475f0e-0x0;var _0x470ab9=_0x5260[_0x475f0e];return _0x470ab9;};'use strict';var Sequelize=require('sequelize');module[_0x0526('0x0')]={'customer_id':{'type':Sequelize[_0x0526('0x1')]},'context':{'type':Sequelize[_0x0526('0x1')],'defaultValue':_0x0526('0x2'),'unique':_0x0526('0x3')},'mailbox':{'type':Sequelize[_0x0526('0x1')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x0526('0x1')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x0526('0x1')],'validate':{'isEmail':!![]},'set':function(_0x1c89fe){this['setDataValue'](_0x0526('0x4'),typeof _0x1c89fe===_0x0526('0x5')&&_0x1c89fe['trim']()?_0x1c89fe[_0x0526('0x6')]():null);}},'pager':{'type':Sequelize[_0x0526('0x1')]},'tz':{'type':Sequelize[_0x0526('0x1')],'defaultValue':'central'},'attach':{'type':Sequelize[_0x0526('0x7')](_0x0526('0x8'),'no'),'defaultValue':_0x0526('0x8'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x0526('0x8'),'no'),'defaultValue':_0x0526('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0x0526('0x1')]},'callback':{'type':Sequelize[_0x0526('0x1')]},'review':{'type':Sequelize[_0x0526('0x7')](_0x0526('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x0526('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x0526('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x0526('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x0526('0x7')](_0x0526('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x0526('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x0526('0x8'),'no'),'defaultValue':_0x0526('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0x0526('0x7')](_0x0526('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x0526('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x0526('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x0526('0x1')]},'emailbody':{'type':Sequelize[_0x0526('0x1')]},'maxsecs':{'type':Sequelize[_0x0526('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x0526('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x0526('0xb')],'get':function(){return this[_0x0526('0xc')](_0x0526('0xd'))+_0x0526('0xe')+this['getDataValue'](_0x0526('0xf'));}}}; \ No newline at end of file +var _0xfcd1=['\x20-\x20','getDataValue','mailbox','sequelize','exports','STRING','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)','VIRTUAL','fullname'];(function(_0x42e3e5,_0x3d6cd0){var _0x286809=function(_0x1e7788){while(--_0x1e7788){_0x42e3e5['push'](_0x42e3e5['shift']());}};_0x286809(++_0x3d6cd0);}(_0xfcd1,0xad));var _0x1fcd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfcd1[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x1fcd('0x0'));module[_0x1fcd('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x1fcd('0x2')],'defaultValue':'from-voicemail','unique':_0x1fcd('0x3')},'mailbox':{'type':Sequelize[_0x1fcd('0x2')],'defaultValue':'','allowNull':![],'unique':_0x1fcd('0x3')},'password':{'type':Sequelize[_0x1fcd('0x2')]},'fullname':{'type':Sequelize[_0x1fcd('0x2')]},'email':{'type':Sequelize[_0x1fcd('0x2')],'validate':{'isEmail':!![]},'set':function(_0xc67599){this[_0x1fcd('0x4')](_0x1fcd('0x5'),typeof _0xc67599===_0x1fcd('0x6')&&_0xc67599['trim']()?_0xc67599[_0x1fcd('0x7')]():null);}},'pager':{'type':Sequelize[_0x1fcd('0x2')]},'tz':{'type':Sequelize[_0x1fcd('0x2')],'defaultValue':_0x1fcd('0x8')},'attach':{'type':Sequelize[_0x1fcd('0x9')](_0x1fcd('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x1fcd('0x9')]('yes','no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x1fcd('0x2')]},'callback':{'type':Sequelize[_0x1fcd('0x2')]},'review':{'type':Sequelize[_0x1fcd('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x1fcd('0x9')](_0x1fcd('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x1fcd('0x9')](_0x1fcd('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x1fcd('0x9')](_0x1fcd('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x1fcd('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x1fcd('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x1fcd('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x1fcd('0x9')](_0x1fcd('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x1fcd('0x9')](_0x1fcd('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x1fcd('0x9')](_0x1fcd('0xa'),'no'),'defaultValue':_0x1fcd('0xa'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x1fcd('0x2')]},'emailbody':{'type':Sequelize[_0x1fcd('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x1fcd('0xc')],'get':function(){return this['getDataValue'](_0x1fcd('0xd'))+_0x1fcd('0xe')+this[_0x1fcd('0xf')](_0x1fcd('0x10'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 8584a9a..e00a296 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 _0xd64b=['merge','filter','options','includeAll','include','findAll','catch','params','filters','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMessages','findOne','order','sort','mailbox','VoiceMailMessage','findAndCountAll','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','apply','reject','update','then','destroy','get','Voicemails','stack','name','send','index','map','VoiceMail','rawAttributes','type','model','keys','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','limit','where','pick'];(function(_0x270a02,_0x223adb){var _0x3cd07b=function(_0x387642){while(--_0x387642){_0x270a02['push'](_0x270a02['shift']());}};_0x3cd07b(++_0x223adb);}(_0xd64b,0xc1));var _0xbd64=function(_0x3a09e5,_0x22b07d){_0x3a09e5=_0x3a09e5-0x0;var _0x47f87d=_0xd64b[_0x3a09e5];return _0x47f87d;};'use strict';var emlformat=require(_0xbd64('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbd64('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbd64('0x2'));var moment=require(_0xbd64('0x3'));var BPromise=require(_0xbd64('0x4'));var Mustache=require(_0xbd64('0x5'));var util=require(_0xbd64('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbd64('0x7'));var _=require(_0xbd64('0x8'));var squel=require(_0xbd64('0x9'));var crypto=require(_0xbd64('0xa'));var jsforce=require(_0xbd64('0xb'));var deskjs=require(_0xbd64('0xc'));var toCsv=require(_0xbd64('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbd64('0xe'));var authService=require(_0xbd64('0xf'));var qs=require(_0xbd64('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbd64('0x11'));var logger=require(_0xbd64('0x12'))(_0xbd64('0x13'));var utils=require(_0xbd64('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xbd64('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x136f60,_0x2729d8){_0x2729d8=_0x2729d8||0xcc;return function(_0x3a941c){if(_0x3a941c){return _0x136f60[_0xbd64('0x16')](_0x2729d8);}return _0x136f60[_0xbd64('0x17')](_0x2729d8)[_0xbd64('0x18')]();};}function respondWithResult(_0x2e23f2,_0x269e2f){_0x269e2f=_0x269e2f||0xc8;return function(_0x2b5808){if(_0x2b5808){return _0x2e23f2['status'](_0x269e2f)[_0xbd64('0x19')](_0x2b5808);}};}function respondWithFilteredResult(_0x13e7a4,_0x3ff550){return function(_0x32fd34){if(_0x32fd34){var _0x29fc16=typeof _0x3ff550['offset']===_0xbd64('0x1a')&&typeof _0x3ff550['limit']===_0xbd64('0x1a');var _0x1432a6=_0x32fd34[_0xbd64('0x1b')];var _0x1d7a14=_0x29fc16?0x0:_0x3ff550[_0xbd64('0x1c')];var _0x2f4554=_0x29fc16?_0x32fd34[_0xbd64('0x1b')]:_0x3ff550[_0xbd64('0x1c')]+_0x3ff550['limit'];var _0x305545;if(_0x2f4554>=_0x1432a6){_0x2f4554=_0x1432a6;_0x305545=0xc8;}else{_0x305545=0xce;}_0x13e7a4[_0xbd64('0x17')](_0x305545);return _0x13e7a4['set']('Content-Range',_0x1d7a14+'-'+_0x2f4554+'/'+_0x1432a6)[_0xbd64('0x19')](_0x32fd34);}return null;};}function patchUpdates(_0x42b328){return function(_0x196d21){try{jsonpatch[_0xbd64('0x1d')](_0x196d21,_0x42b328,!![]);}catch(_0x2c5551){return BPromise[_0xbd64('0x1e')](_0x2c5551);}return _0x196d21['save']();};}function saveUpdates(_0x4d4a16,_0x6038f){return function(_0x41f2f){if(_0x41f2f){return _0x41f2f[_0xbd64('0x1f')](_0x4d4a16)[_0xbd64('0x20')](function(_0x55e74c){return _0x55e74c;});}return null;};}function removeEntity(_0x51d118,_0x28497c){return function(_0x4afaff){if(_0x4afaff){return _0x4afaff[_0xbd64('0x21')]()['then'](function(){var _0x33452d=_0x4afaff[_0xbd64('0x22')]({'plain':!![]});var _0x3d12a0=_0xbd64('0x23');return db['UserProfileResource'][_0xbd64('0x21')]({'where':{'type':_0x3d12a0,'resourceId':_0x33452d['id']}})[_0xbd64('0x20')](function(){return _0x4afaff;});})[_0xbd64('0x20')](function(){_0x51d118[_0xbd64('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e8719,_0x29c9c8){return function(_0x49eac5){if(!_0x49eac5){_0x4e8719['sendStatus'](0x194);}return _0x49eac5;};}function handleError(_0xfa918,_0x5aacdd){_0x5aacdd=_0x5aacdd||0x1f4;return function(_0x3cf5b7){logger['error'](_0x3cf5b7[_0xbd64('0x24')]);if(_0x3cf5b7['name']){delete _0x3cf5b7[_0xbd64('0x25')];}_0xfa918[_0xbd64('0x17')](_0x5aacdd)[_0xbd64('0x26')](_0x3cf5b7);};}exports[_0xbd64('0x27')]=function(_0x306f19,_0x207ffc){var _0x4ed44a={},_0x35bdd5={},_0xe876c9={'count':0x0,'rows':[]};var _0xc44280=_[_0xbd64('0x28')](db[_0xbd64('0x29')][_0xbd64('0x2a')],function(_0x5e70d3){return{'name':_0x5e70d3['fieldName'],'type':_0x5e70d3[_0xbd64('0x2b')]['key']};});_0x35bdd5[_0xbd64('0x2c')]=_[_0xbd64('0x28')](_0xc44280,'name');_0x35bdd5['query']=_[_0xbd64('0x2d')](_0x306f19['query']);_0x35bdd5['filters']=_[_0xbd64('0x2e')](_0x35bdd5[_0xbd64('0x2c')],_0x35bdd5[_0xbd64('0x2f')]);_0x4ed44a['attributes']=_[_0xbd64('0x2e')](_0x35bdd5['model'],qs[_0xbd64('0x30')](_0x306f19[_0xbd64('0x2f')][_0xbd64('0x30')]));_0x4ed44a[_0xbd64('0x31')]=_0x4ed44a[_0xbd64('0x31')][_0xbd64('0x32')]?_0x4ed44a['attributes']:_0x35bdd5['model'];if(!_0x306f19[_0xbd64('0x2f')][_0xbd64('0x33')](_0xbd64('0x34'))){_0x4ed44a[_0xbd64('0x35')]=qs[_0xbd64('0x35')](_0x306f19[_0xbd64('0x2f')]['limit']);_0x4ed44a['offset']=qs[_0xbd64('0x1c')](_0x306f19[_0xbd64('0x2f')][_0xbd64('0x1c')]);}_0x4ed44a['order']=qs['sort'](_0x306f19[_0xbd64('0x2f')]['sort']);_0x4ed44a[_0xbd64('0x36')]=qs['filters'](_[_0xbd64('0x37')](_0x306f19[_0xbd64('0x2f')],_0x35bdd5['filters']),_0xc44280);if(_0x306f19[_0xbd64('0x2f')]['filter']){_0x4ed44a['where']=_[_0xbd64('0x38')](_0x4ed44a[_0xbd64('0x36')],{'$or':_[_0xbd64('0x28')](_0xc44280,function(_0x52f401){if(_0x52f401['type']!=='VIRTUAL'){var _0x344d46={};_0x344d46[_0x52f401[_0xbd64('0x25')]]={'$like':'%'+_0x306f19['query'][_0xbd64('0x39')]+'%'};return _0x344d46;}})});}_0x4ed44a=_[_0xbd64('0x38')]({},_0x4ed44a,_0x306f19[_0xbd64('0x3a')]);var _0x27fd12={'where':_0x4ed44a['where']};return db['VoiceMail'][_0xbd64('0x1b')](_0x27fd12)['then'](function(_0x595a91){_0xe876c9[_0xbd64('0x1b')]=_0x595a91;if(_0x306f19[_0xbd64('0x2f')][_0xbd64('0x3b')]){_0x4ed44a[_0xbd64('0x3c')]=[{'all':!![]}];}return db[_0xbd64('0x29')][_0xbd64('0x3d')](_0x4ed44a);})[_0xbd64('0x20')](function(_0x762380){_0xe876c9['rows']=_0x762380;return _0xe876c9;})[_0xbd64('0x20')](respondWithFilteredResult(_0x207ffc,_0x4ed44a))[_0xbd64('0x3e')](handleError(_0x207ffc,null));};exports['show']=function(_0x41b27a,_0x1e4983){var _0xe5b069={'raw':!![],'where':{'id':_0x41b27a[_0xbd64('0x3f')]['id']}},_0x2bc972={};_0x2bc972[_0xbd64('0x2c')]=_[_0xbd64('0x2d')](db['VoiceMail'][_0xbd64('0x2a')]);_0x2bc972['query']=_[_0xbd64('0x2d')](_0x41b27a['query']);_0x2bc972[_0xbd64('0x40')]=_[_0xbd64('0x2e')](_0x2bc972[_0xbd64('0x2c')],_0x2bc972['query']);_0xe5b069[_0xbd64('0x31')]=_['intersection'](_0x2bc972['model'],qs['fields'](_0x41b27a[_0xbd64('0x2f')][_0xbd64('0x30')]));_0xe5b069[_0xbd64('0x31')]=_0xe5b069[_0xbd64('0x31')][_0xbd64('0x32')]?_0xe5b069[_0xbd64('0x31')]:_0x2bc972[_0xbd64('0x2c')];if(_0x41b27a['query'][_0xbd64('0x3b')]){_0xe5b069[_0xbd64('0x3c')]=[{'all':!![]}];}_0xe5b069=_[_0xbd64('0x38')]({},_0xe5b069,_0x41b27a['options']);return db[_0xbd64('0x29')][_0xbd64('0x41')](_0xe5b069)[_0xbd64('0x20')](handleEntityNotFound(_0x1e4983,null))[_0xbd64('0x20')](respondWithResult(_0x1e4983,null))[_0xbd64('0x3e')](handleError(_0x1e4983,null));};exports['create']=function(_0x283699,_0x1a9ec8){return db[_0xbd64('0x29')][_0xbd64('0x42')](_0x283699['body'],{})['then'](function(_0x1e008f){var _0x2a7eec=_0x283699[_0xbd64('0x43')][_0xbd64('0x22')]({'plain':!![]});if(!_0x2a7eec)throw new Error(_0xbd64('0x44'));if(_0x2a7eec[_0xbd64('0x45')]===_0xbd64('0x43')){var _0x3807a7=_0x1e008f[_0xbd64('0x22')]({'plain':!![]});var _0x2709b2=_0xbd64('0x23');return db[_0xbd64('0x46')][_0xbd64('0x41')]({'where':{'name':_0x2709b2,'userProfileId':_0x2a7eec[_0xbd64('0x47')]},'raw':!![]})[_0xbd64('0x20')](function(_0x5bd444){if(_0x5bd444&&_0x5bd444[_0xbd64('0x48')]===0x0){return db['UserProfileResource']['create']({'name':_0x3807a7['name'],'resourceId':_0x3807a7['id'],'type':_0x5bd444['name'],'sectionId':_0x5bd444['id']},{})[_0xbd64('0x20')](function(){return _0x1e008f;});}else{return _0x1e008f;}})[_0xbd64('0x3e')](function(_0x5480f5){logger[_0xbd64('0x49')](_0xbd64('0x4a'),_0x5480f5);throw _0x5480f5;});}return _0x1e008f;})[_0xbd64('0x20')](respondWithResult(_0x1a9ec8,0xc9))['catch'](handleError(_0x1a9ec8,null));};exports[_0xbd64('0x1f')]=function(_0x371bad,_0x44cd4f){if(_0x371bad[_0xbd64('0x4b')]['id']){delete _0x371bad[_0xbd64('0x4b')]['id'];}return db[_0xbd64('0x29')]['find']({'where':{'id':_0x371bad['params']['id']}})['then'](handleEntityNotFound(_0x44cd4f,null))[_0xbd64('0x20')](saveUpdates(_0x371bad[_0xbd64('0x4b')],null))[_0xbd64('0x20')](respondWithResult(_0x44cd4f,null))[_0xbd64('0x3e')](handleError(_0x44cd4f,null));};exports['destroy']=function(_0x1d0d9f,_0x20b275){return db[_0xbd64('0x29')][_0xbd64('0x41')]({'where':{'id':_0x1d0d9f[_0xbd64('0x3f')]['id']}})[_0xbd64('0x20')](handleEntityNotFound(_0x20b275,null))['then'](removeEntity(_0x20b275,null))[_0xbd64('0x3e')](handleError(_0x20b275,null));};exports[_0xbd64('0x4c')]=function(_0x15f1fc,_0x1fe3e5,_0x465661){return db[_0xbd64('0x29')][_0xbd64('0x4d')]({'where':{'id':_0x15f1fc[_0xbd64('0x3f')]['id']}})[_0xbd64('0x20')](handleEntityNotFound(_0x1fe3e5,null))[_0xbd64('0x20')](function(_0x3812b3){var _0xffda84;var _0x4a1e21={},_0x56c7d9={};_0x56c7d9[_0xbd64('0x2c')]=_[_0xbd64('0x2d')](db['VoiceMailMessage']['rawAttributes']);_0x56c7d9[_0xbd64('0x2f')]=_[_0xbd64('0x2d')](_0x15f1fc['query']);_0x56c7d9[_0xbd64('0x40')]=_[_0xbd64('0x2e')](_0x56c7d9[_0xbd64('0x2c')],_0x56c7d9[_0xbd64('0x2f')]);_0x4a1e21[_0xbd64('0x31')]=_[_0xbd64('0x2e')](_0x56c7d9[_0xbd64('0x2c')],qs[_0xbd64('0x30')](_0x15f1fc[_0xbd64('0x2f')]['fields']));_0x4a1e21[_0xbd64('0x31')]=_0x4a1e21[_0xbd64('0x31')][_0xbd64('0x32')]?_0x4a1e21['attributes']:_0x56c7d9[_0xbd64('0x2c')];if(!_0x15f1fc[_0xbd64('0x2f')]['hasOwnProperty'](_0xbd64('0x34'))){_0x4a1e21[_0xbd64('0x35')]=qs[_0xbd64('0x35')](_0x15f1fc[_0xbd64('0x2f')][_0xbd64('0x35')]);_0x4a1e21[_0xbd64('0x1c')]=qs['offset'](_0x15f1fc[_0xbd64('0x2f')][_0xbd64('0x1c')]);}_0x4a1e21[_0xbd64('0x4e')]=qs[_0xbd64('0x4f')](_0x15f1fc['query'][_0xbd64('0x4f')]);_0x4a1e21[_0xbd64('0x36')]=qs['filters'](_[_0xbd64('0x37')](_0x15f1fc['query'],_0x56c7d9[_0xbd64('0x40')]));if(_0x15f1fc[_0xbd64('0x2f')][_0xbd64('0x39')]){_0x4a1e21[_0xbd64('0x36')]=_['merge'](_0x4a1e21[_0xbd64('0x36')],{'$or':_[_0xbd64('0x28')](_0x4a1e21[_0xbd64('0x31')],function(_0x23925c){var _0x463a60={};_0x463a60[_0x23925c]={'$like':'%'+_0x15f1fc[_0xbd64('0x2f')]['filter']+'%'};return _0x463a60;})});}_0x4a1e21['where']=_['merge'](_0x4a1e21[_0xbd64('0x36')],{'mailboxuser':_0x3812b3[_0xbd64('0x50')]});_0x4a1e21=_[_0xbd64('0x38')]({},_0x4a1e21,_0x15f1fc[_0xbd64('0x3a')]);return db[_0xbd64('0x51')][_0xbd64('0x52')](_0x4a1e21)['then'](respondWithFilteredResult(_0x1fe3e5,_0x4a1e21));})[_0xbd64('0x3e')](handleError(_0x1fe3e5,null));}; \ No newline at end of file +var _0x91a7=['status','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','get','Voicemails','error','stack','name','send','index','map','VoiceMail','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','includeAll','catch','show','params','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','getMessages','findOne','VoiceMailMessage','order','mailbox','options','findAndCountAll','rimraf','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x91a7,0xe7));var _0x791a=function(_0x50aba2,_0x272dfd){_0x50aba2=_0x50aba2-0x0;var _0x585c88=_0x91a7[_0x50aba2];return _0x585c88;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x791a('0x0'));var zipdir=require(_0x791a('0x1'));var jsonpatch=require(_0x791a('0x2'));var rp=require('request-promise');var moment=require(_0x791a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x791a('0x4'));var util=require('util');var path=require('path');var sox=require(_0x791a('0x5'));var csv=require(_0x791a('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x791a('0x7'));var _=require('lodash');var squel=require(_0x791a('0x8'));var crypto=require(_0x791a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x791a('0xa'));var toCsv=require(_0x791a('0x6'));var querystring=require(_0x791a('0xb'));var Papa=require(_0x791a('0xc'));var Redis=require(_0x791a('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x791a('0xe'));var as=require(_0x791a('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x791a('0x10'))(_0x791a('0x11'));var utils=require(_0x791a('0x12'));var config=require(_0x791a('0x13'));var licenseUtil=require(_0x791a('0x14'));var db=require(_0x791a('0x15'))['db'];function respondWithStatusCode(_0x53dc41,_0x5daecd){_0x5daecd=_0x5daecd||0xcc;return function(_0xc92016){if(_0xc92016){return _0x53dc41[_0x791a('0x16')](_0x5daecd);}return _0x53dc41['status'](_0x5daecd)[_0x791a('0x17')]();};}function respondWithResult(_0x3a2ec6,_0x5d5b11){_0x5d5b11=_0x5d5b11||0xc8;return function(_0x2887f0){if(_0x2887f0){return _0x3a2ec6[_0x791a('0x18')](_0x5d5b11)[_0x791a('0x19')](_0x2887f0);}};}function respondWithFilteredResult(_0x5cdf2,_0x55e845){return function(_0x2ce2e0){if(_0x2ce2e0){var _0x575d11=typeof _0x55e845[_0x791a('0x1a')]===_0x791a('0x1b')&&typeof _0x55e845['limit']===_0x791a('0x1b');var _0x5bea2e=_0x2ce2e0[_0x791a('0x1c')];var _0x52941d=_0x575d11?0x0:_0x55e845['offset'];var _0x588d00=_0x575d11?_0x2ce2e0[_0x791a('0x1c')]:_0x55e845['offset']+_0x55e845['limit'];var _0x39c60b;if(_0x588d00>=_0x5bea2e){_0x588d00=_0x5bea2e;_0x39c60b=0xc8;}else{_0x39c60b=0xce;}_0x5cdf2[_0x791a('0x18')](_0x39c60b);return _0x5cdf2[_0x791a('0x1d')](_0x791a('0x1e'),_0x52941d+'-'+_0x588d00+'/'+_0x5bea2e)['json'](_0x2ce2e0);}return null;};}function patchUpdates(_0x189c0d){return function(_0xcb5e66){try{jsonpatch[_0x791a('0x1f')](_0xcb5e66,_0x189c0d,!![]);}catch(_0x280f1e){return BPromise['reject'](_0x280f1e);}return _0xcb5e66[_0x791a('0x20')]();};}function saveUpdates(_0x2054c6,_0x25bae5){return function(_0x9e17b5){if(_0x9e17b5){return _0x9e17b5[_0x791a('0x21')](_0x2054c6)[_0x791a('0x22')](function(_0x2241a0){return _0x2241a0;});}return null;};}function removeEntity(_0x45a67d,_0x323c6a){return function(_0xe8e452){if(_0xe8e452){return _0xe8e452[_0x791a('0x23')]()['then'](function(){var _0x1102c9=_0xe8e452[_0x791a('0x24')]({'plain':!![]});var _0x380329=_0x791a('0x25');return db['UserProfileResource'][_0x791a('0x23')]({'where':{'type':_0x380329,'resourceId':_0x1102c9['id']}})[_0x791a('0x22')](function(){return _0xe8e452;});})['then'](function(){_0x45a67d[_0x791a('0x18')](0xcc)[_0x791a('0x17')]();});}};}function handleEntityNotFound(_0x16dbaf,_0x4c1626){return function(_0x29194d){if(!_0x29194d){_0x16dbaf[_0x791a('0x16')](0x194);}return _0x29194d;};}function handleError(_0x2b0784,_0x395376){_0x395376=_0x395376||0x1f4;return function(_0x4f423){logger[_0x791a('0x26')](_0x4f423[_0x791a('0x27')]);if(_0x4f423[_0x791a('0x28')]){delete _0x4f423['name'];}_0x2b0784[_0x791a('0x18')](_0x395376)[_0x791a('0x29')](_0x4f423);};}exports[_0x791a('0x2a')]=function(_0x59d2c0,_0x1cdda9){var _0x5df656={},_0xc59f5e={},_0x2e4ec8={'count':0x0,'rows':[]};var _0xcde862=_[_0x791a('0x2b')](db[_0x791a('0x2c')][_0x791a('0x2d')],function(_0x15ff6e){return{'name':_0x15ff6e['fieldName'],'type':_0x15ff6e[_0x791a('0x2e')][_0x791a('0x2f')]};});_0xc59f5e[_0x791a('0x30')]=_[_0x791a('0x2b')](_0xcde862,_0x791a('0x28'));_0xc59f5e['query']=_[_0x791a('0x31')](_0x59d2c0[_0x791a('0x32')]);_0xc59f5e[_0x791a('0x33')]=_[_0x791a('0x34')](_0xc59f5e[_0x791a('0x30')],_0xc59f5e['query']);_0x5df656[_0x791a('0x35')]=_[_0x791a('0x34')](_0xc59f5e[_0x791a('0x30')],qs[_0x791a('0x36')](_0x59d2c0[_0x791a('0x32')]['fields']));_0x5df656[_0x791a('0x35')]=_0x5df656['attributes'][_0x791a('0x37')]?_0x5df656['attributes']:_0xc59f5e['model'];if(!_0x59d2c0[_0x791a('0x32')][_0x791a('0x38')](_0x791a('0x39'))){_0x5df656[_0x791a('0x3a')]=qs[_0x791a('0x3a')](_0x59d2c0[_0x791a('0x32')][_0x791a('0x3a')]);_0x5df656['offset']=qs[_0x791a('0x1a')](_0x59d2c0['query'][_0x791a('0x1a')]);}_0x5df656['order']=qs[_0x791a('0x3b')](_0x59d2c0[_0x791a('0x32')]['sort']);_0x5df656[_0x791a('0x3c')]=qs[_0x791a('0x33')](_['pick'](_0x59d2c0[_0x791a('0x32')],_0xc59f5e[_0x791a('0x33')]),_0xcde862);if(_0x59d2c0[_0x791a('0x32')][_0x791a('0x3d')]){_0x5df656[_0x791a('0x3c')]=_[_0x791a('0x3e')](_0x5df656[_0x791a('0x3c')],{'$or':_[_0x791a('0x2b')](_0xcde862,function(_0xc0fb63){if(_0xc0fb63[_0x791a('0x2e')]!=='VIRTUAL'){var _0x15f066={};_0x15f066[_0xc0fb63[_0x791a('0x28')]]={'$like':'%'+_0x59d2c0[_0x791a('0x32')]['filter']+'%'};return _0x15f066;}})});}_0x5df656=_[_0x791a('0x3e')]({},_0x5df656,_0x59d2c0['options']);var _0x5bad7d={'where':_0x5df656['where']};return db[_0x791a('0x2c')][_0x791a('0x1c')](_0x5bad7d)['then'](function(_0x415c44){_0x2e4ec8[_0x791a('0x1c')]=_0x415c44;if(_0x59d2c0[_0x791a('0x32')][_0x791a('0x3f')]){_0x5df656['include']=[{'all':!![]}];}return db['VoiceMail']['findAll'](_0x5df656);})[_0x791a('0x22')](function(_0x216dd3){_0x2e4ec8['rows']=_0x216dd3;return _0x2e4ec8;})[_0x791a('0x22')](respondWithFilteredResult(_0x1cdda9,_0x5df656))[_0x791a('0x40')](handleError(_0x1cdda9,null));};exports[_0x791a('0x41')]=function(_0x954164,_0x508727){var _0x11263d={'raw':!![],'where':{'id':_0x954164[_0x791a('0x42')]['id']}},_0x5911db={};_0x5911db[_0x791a('0x30')]=_[_0x791a('0x31')](db[_0x791a('0x2c')][_0x791a('0x2d')]);_0x5911db['query']=_[_0x791a('0x31')](_0x954164[_0x791a('0x32')]);_0x5911db[_0x791a('0x33')]=_[_0x791a('0x34')](_0x5911db[_0x791a('0x30')],_0x5911db['query']);_0x11263d[_0x791a('0x35')]=_[_0x791a('0x34')](_0x5911db['model'],qs['fields'](_0x954164[_0x791a('0x32')][_0x791a('0x36')]));_0x11263d[_0x791a('0x35')]=_0x11263d['attributes']['length']?_0x11263d[_0x791a('0x35')]:_0x5911db[_0x791a('0x30')];if(_0x954164['query'][_0x791a('0x3f')]){_0x11263d[_0x791a('0x43')]=[{'all':!![]}];}_0x11263d=_[_0x791a('0x3e')]({},_0x11263d,_0x954164['options']);return db['VoiceMail'][_0x791a('0x44')](_0x11263d)[_0x791a('0x22')](handleEntityNotFound(_0x508727,null))[_0x791a('0x22')](respondWithResult(_0x508727,null))[_0x791a('0x40')](handleError(_0x508727,null));};exports['create']=function(_0x2d7c7d,_0x9f768a){return db[_0x791a('0x2c')][_0x791a('0x45')](_0x2d7c7d['body'],{})[_0x791a('0x22')](function(_0x19654d){var _0xe0696b=_0x2d7c7d[_0x791a('0x46')][_0x791a('0x24')]({'plain':!![]});if(!_0xe0696b)throw new Error(_0x791a('0x47'));if(_0xe0696b[_0x791a('0x48')]==='user'){var _0xdcb1b=_0x19654d[_0x791a('0x24')]({'plain':!![]});var _0x4bffa6=_0x791a('0x25');return db[_0x791a('0x49')]['find']({'where':{'name':_0x4bffa6,'userProfileId':_0xe0696b[_0x791a('0x4a')]},'raw':!![]})[_0x791a('0x22')](function(_0x12178e){if(_0x12178e&&_0x12178e[_0x791a('0x4b')]===0x0){return db[_0x791a('0x4c')]['create']({'name':_0xdcb1b['name'],'resourceId':_0xdcb1b['id'],'type':_0x12178e['name'],'sectionId':_0x12178e['id']},{})[_0x791a('0x22')](function(){return _0x19654d;});}else{return _0x19654d;}})['catch'](function(_0x4c7555){logger[_0x791a('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c7555);throw _0x4c7555;});}return _0x19654d;})[_0x791a('0x22')](respondWithResult(_0x9f768a,0xc9))[_0x791a('0x40')](handleError(_0x9f768a,null));};exports['update']=function(_0x5166b5,_0x3599f6){if(_0x5166b5['body']['id']){delete _0x5166b5[_0x791a('0x4d')]['id'];}return db[_0x791a('0x2c')][_0x791a('0x44')]({'where':{'id':_0x5166b5['params']['id']}})[_0x791a('0x22')](handleEntityNotFound(_0x3599f6,null))[_0x791a('0x22')](saveUpdates(_0x5166b5['body'],null))[_0x791a('0x22')](respondWithResult(_0x3599f6,null))[_0x791a('0x40')](handleError(_0x3599f6,null));};exports[_0x791a('0x23')]=function(_0x34d53c,_0x450ad8){return db[_0x791a('0x2c')]['find']({'where':{'id':_0x34d53c['params']['id']}})[_0x791a('0x22')](handleEntityNotFound(_0x450ad8,null))['then'](removeEntity(_0x450ad8,null))[_0x791a('0x40')](handleError(_0x450ad8,null));};exports[_0x791a('0x4e')]=function(_0x18ad89,_0xf11dea,_0x3b760c){return db[_0x791a('0x2c')][_0x791a('0x4f')]({'where':{'id':_0x18ad89['params']['id']}})[_0x791a('0x22')](handleEntityNotFound(_0xf11dea,null))[_0x791a('0x22')](function(_0xc34c5b){var _0x1a4376;var _0x2d671f={},_0xe062f1={};_0xe062f1[_0x791a('0x30')]=_['keys'](db[_0x791a('0x50')]['rawAttributes']);_0xe062f1['query']=_[_0x791a('0x31')](_0x18ad89[_0x791a('0x32')]);_0xe062f1[_0x791a('0x33')]=_[_0x791a('0x34')](_0xe062f1[_0x791a('0x30')],_0xe062f1[_0x791a('0x32')]);_0x2d671f[_0x791a('0x35')]=_[_0x791a('0x34')](_0xe062f1[_0x791a('0x30')],qs[_0x791a('0x36')](_0x18ad89[_0x791a('0x32')][_0x791a('0x36')]));_0x2d671f[_0x791a('0x35')]=_0x2d671f[_0x791a('0x35')][_0x791a('0x37')]?_0x2d671f[_0x791a('0x35')]:_0xe062f1[_0x791a('0x30')];if(!_0x18ad89[_0x791a('0x32')][_0x791a('0x38')](_0x791a('0x39'))){_0x2d671f['limit']=qs[_0x791a('0x3a')](_0x18ad89[_0x791a('0x32')][_0x791a('0x3a')]);_0x2d671f[_0x791a('0x1a')]=qs[_0x791a('0x1a')](_0x18ad89['query'][_0x791a('0x1a')]);}_0x2d671f[_0x791a('0x51')]=qs[_0x791a('0x3b')](_0x18ad89[_0x791a('0x32')]['sort']);_0x2d671f[_0x791a('0x3c')]=qs['filters'](_['pick'](_0x18ad89['query'],_0xe062f1['filters']));if(_0x18ad89[_0x791a('0x32')][_0x791a('0x3d')]){_0x2d671f[_0x791a('0x3c')]=_[_0x791a('0x3e')](_0x2d671f[_0x791a('0x3c')],{'$or':_[_0x791a('0x2b')](_0x2d671f[_0x791a('0x35')],function(_0x5dca78){var _0x522cb8={};_0x522cb8[_0x5dca78]={'$like':'%'+_0x18ad89[_0x791a('0x32')][_0x791a('0x3d')]+'%'};return _0x522cb8;})});}_0x2d671f['where']=_['merge'](_0x2d671f[_0x791a('0x3c')],{'mailboxuser':_0xc34c5b[_0x791a('0x52')]});_0x2d671f=_['merge']({},_0x2d671f,_0x18ad89[_0x791a('0x53')]);return db[_0x791a('0x50')][_0x791a('0x54')](_0x2d671f)[_0x791a('0x22')](respondWithFilteredResult(_0xf11dea,_0x2d671f));})['catch'](handleError(_0xf11dea,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index a74cf3c..f7a4a39 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 _0xe24d=['rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0xe24d,0xf9));var _0xde24=function(_0x14746a,_0x38839d){_0x14746a=_0x14746a-0x0;var _0x2133a7=_0xe24d[_0x14746a];return _0x2133a7;};'use strict';var _=require(_0xde24('0x0'));var util=require('util');var logger=require(_0xde24('0x1'))(_0xde24('0x2'));var moment=require(_0xde24('0x3'));var BPromise=require(_0xde24('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xde24('0x5'));var rimraf=require(_0xde24('0x6'));var config=require(_0xde24('0x7'));var attributes=require(_0xde24('0x8'));module[_0xde24('0x9')]=function(_0x4d930e,_0x23403b){return _0x4d930e[_0xde24('0xa')](_0xde24('0xb'),attributes,{'tableName':_0xde24('0xc'),'paranoid':![],'indexes':[{'name':_0xde24('0xd'),'fields':[_0xde24('0xe'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5c28=['path','./voiceMail.attributes','exports','VoiceMail','voice_voicemail','mailbox_context','mailbox','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x2c0a57,_0x37ecda){var _0x54a7dc=function(_0x3914bc){while(--_0x3914bc){_0x2c0a57['push'](_0x2c0a57['shift']());}};_0x54a7dc(++_0x37ecda);}(_0x5c28,0xe4));var _0x85c2=function(_0x465c38,_0x36a714){_0x465c38=_0x465c38-0x0;var _0x445c27=_0x5c28[_0x465c38];return _0x445c27;};'use strict';var _=require(_0x85c2('0x0'));var util=require(_0x85c2('0x1'));var logger=require(_0x85c2('0x2'))(_0x85c2('0x3'));var moment=require('moment');var BPromise=require(_0x85c2('0x4'));var rp=require(_0x85c2('0x5'));var fs=require('fs');var path=require(_0x85c2('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x85c2('0x7'));module[_0x85c2('0x8')]=function(_0x281951,_0x2c730d){return _0x281951['define'](_0x85c2('0x9'),attributes,{'tableName':_0x85c2('0xa'),'paranoid':![],'indexes':[{'name':_0x85c2('0xb'),'fields':[_0x85c2('0xc'),'context']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 663b9ea..80d1eb5 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 _0x674a=['../../config/utils','jayson/promise','client','http','request','then','VoiceMail,\x20%s,\x20%s','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0xf84870,_0x4dc38f){var _0x4541a4=function(_0x3ff5d5){while(--_0x3ff5d5){_0xf84870['push'](_0xf84870['shift']());}};_0x4541a4(++_0x4dc38f);}(_0x674a,0xc0));var _0xa674=function(_0x4201c2,_0x36fc2a){_0x4201c2=_0x4201c2-0x0;var _0x45020c=_0x674a[_0x4201c2];return _0x45020c;};'use strict';var _=require(_0xa674('0x0'));var util=require(_0xa674('0x1'));var moment=require(_0xa674('0x2'));var BPromise=require('bluebird');var rs=require(_0xa674('0x3'));var fs=require('fs');var Redis=require(_0xa674('0x4'));var db=require(_0xa674('0x5'))['db'];var utils=require(_0xa674('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xa674('0x7'));var client=jayson[_0xa674('0x8')][_0xa674('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f2539,_0x310d78,_0x154afe){return new BPromise(function(_0x144635,_0x33de45){return client[_0xa674('0xa')](_0x4f2539,_0x154afe)[_0xa674('0xb')](function(_0x568ba7){logger['info'](_0xa674('0xc'),_0x310d78,'request\x20sent');logger['debug'](_0xa674('0xd'),_0x310d78,'request\x20sent',JSON[_0xa674('0xe')](_0x568ba7));if(_0x568ba7[_0xa674('0xf')]){if(_0x568ba7[_0xa674('0xf')][_0xa674('0x10')]===0x1f4){logger['error'](_0xa674('0xc'),_0x310d78,_0x568ba7[_0xa674('0xf')]['message']);return _0x33de45(_0x568ba7[_0xa674('0xf')][_0xa674('0x11')]);}logger[_0xa674('0xf')]('VoiceMail,\x20%s,\x20%s',_0x310d78,_0x568ba7[_0xa674('0xf')][_0xa674('0x11')]);return _0x144635(_0x568ba7[_0xa674('0xf')]['message']);}else{logger[_0xa674('0x12')](_0xa674('0xc'),_0x310d78,_0xa674('0x13'));_0x144635(_0x568ba7[_0xa674('0x14')][_0xa674('0x11')]);}})[_0xa674('0x15')](function(_0xe1a20d){logger[_0xa674('0xf')]('VoiceMail,\x20%s,\x20%s',_0x310d78,_0xe1a20d);_0x33de45(_0xe1a20d);});});} \ No newline at end of file +var _0x40b4=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x29c261,_0x3af39a){var _0x1a9335=function(_0x40d1e8){while(--_0x40d1e8){_0x29c261['push'](_0x29c261['shift']());}};_0x1a9335(++_0x3af39a);}(_0x40b4,0xbf));var _0x440b=function(_0x427c89,_0x2e6e8b){_0x427c89=_0x427c89-0x0;var _0x26395c=_0x40b4[_0x427c89];return _0x26395c;};'use strict';var _=require(_0x440b('0x0'));var util=require(_0x440b('0x1'));var moment=require(_0x440b('0x2'));var BPromise=require(_0x440b('0x3'));var rs=require(_0x440b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x440b('0x5'))['db'];var utils=require(_0x440b('0x6'));var logger=require(_0x440b('0x7'))(_0x440b('0x8'));var config=require('../../config/environment');var jayson=require(_0x440b('0x9'));var client=jayson[_0x440b('0xa')][_0x440b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50aed2,_0x5d5325,_0x421f7c){return new BPromise(function(_0xfe43b2,_0x12ee6d){return client[_0x440b('0xc')](_0x50aed2,_0x421f7c)[_0x440b('0xd')](function(_0x1c52cb){logger[_0x440b('0xe')](_0x440b('0xf'),_0x5d5325,_0x440b('0x10'));logger[_0x440b('0x11')](_0x440b('0x12'),_0x5d5325,_0x440b('0x10'),JSON[_0x440b('0x13')](_0x1c52cb));if(_0x1c52cb[_0x440b('0x14')]){if(_0x1c52cb[_0x440b('0x14')][_0x440b('0x15')]===0x1f4){logger[_0x440b('0x14')]('VoiceMail,\x20%s,\x20%s',_0x5d5325,_0x1c52cb[_0x440b('0x14')]['message']);return _0x12ee6d(_0x1c52cb['error'][_0x440b('0x16')]);}logger[_0x440b('0x14')](_0x440b('0xf'),_0x5d5325,_0x1c52cb[_0x440b('0x14')]['message']);return _0xfe43b2(_0x1c52cb[_0x440b('0x14')][_0x440b('0x16')]);}else{logger['info'](_0x440b('0xf'),_0x5d5325,'request\x20sent');_0xfe43b2(_0x1c52cb[_0x440b('0x17')][_0x440b('0x16')]);}})['catch'](function(_0x170525){logger[_0x440b('0x14')](_0x440b('0xf'),_0x5d5325,_0x170525);_0x12ee6d(_0x170525);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 5336da6..7492e0f 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 _0x7c36=['download','post','create','/:id','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','show','/:id/download','isAuthenticated'];(function(_0x4c807c,_0x3e41c5){var _0xad2435=function(_0x1e7b31){while(--_0x1e7b31){_0x4c807c['push'](_0x4c807c['shift']());}};_0xad2435(++_0x3e41c5);}(_0x7c36,0xfe));var _0x67c3=function(_0x14b3dc,_0x47caeb){_0x14b3dc=_0x14b3dc-0x0;var _0x10ff20=_0x7c36[_0x14b3dc];return _0x10ff20;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x67c3('0x0'));var timeout=require(_0x67c3('0x1'));var express=require(_0x67c3('0x2'));var router=express[_0x67c3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x67c3('0x4'));var interaction=require(_0x67c3('0x5'));var config=require(_0x67c3('0x6'));var controller=require(_0x67c3('0x7'));router[_0x67c3('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x67c3('0x9')]);router[_0x67c3('0x8')](_0x67c3('0xa'),auth[_0x67c3('0xb')](),controller[_0x67c3('0xc')]);router[_0x67c3('0xd')]('/',auth['isAuthenticated'](),controller[_0x67c3('0xe')]);router['put'](_0x67c3('0xf'),auth[_0x67c3('0xb')](),controller['update']);router[_0x67c3('0x10')](_0x67c3('0xf'),auth[_0x67c3('0xb')](),controller[_0x67c3('0x11')]);module[_0x67c3('0x12')]=router; \ No newline at end of file +var _0x1b5a=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','isAuthenticated','index','get','/:id','show','download','post','put','update','delete','multer','util','path','express'];(function(_0x4347ec,_0x41c4b8){var _0x4c8314=function(_0x583acd){while(--_0x583acd){_0x4347ec['push'](_0x4347ec['shift']());}};_0x4c8314(++_0x41c4b8);}(_0x1b5a,0x1a0));var _0xa1b5=function(_0x1d3771,_0x242e12){_0x1d3771=_0x1d3771-0x0;var _0x565b45=_0x1b5a[_0x1d3771];return _0x565b45;};'use strict';var multer=require(_0xa1b5('0x0'));var util=require(_0xa1b5('0x1'));var path=require(_0xa1b5('0x2'));var timeout=require('connect-timeout');var express=require(_0xa1b5('0x3'));var router=express[_0xa1b5('0x4')]();var fs_extra=require(_0xa1b5('0x5'));var auth=require(_0xa1b5('0x6'));var interaction=require(_0xa1b5('0x7'));var config=require(_0xa1b5('0x8'));var controller=require(_0xa1b5('0x9'));router['get']('/',auth[_0xa1b5('0xa')](),controller[_0xa1b5('0xb')]);router[_0xa1b5('0xc')](_0xa1b5('0xd'),auth[_0xa1b5('0xa')](),controller[_0xa1b5('0xe')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xa1b5('0xf')]);router[_0xa1b5('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa1b5('0x11')](_0xa1b5('0xd'),auth[_0xa1b5('0xa')](),controller[_0xa1b5('0x12')]);router[_0xa1b5('0x13')](_0xa1b5('0xd'),auth[_0xa1b5('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index b073d92..6a25f82 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 _0xb556=['TIMESTAMP','literal','sequelize','exports','VIRTUAL','getDataValue','STRING','BLOB','long'];(function(_0x36c16a,_0x492ad7){var _0x24727f=function(_0x2fe567){while(--_0x2fe567){_0x36c16a['push'](_0x36c16a['shift']());}};_0x24727f(++_0x492ad7);}(_0xb556,0x1e8));var _0x6b55=function(_0x213bac,_0x4ec014){_0x213bac=_0x213bac-0x0;var _0x41519f=_0xb556[_0x213bac];return _0x41519f;};'use strict';var Sequelize=require(_0x6b55('0x0'));module[_0x6b55('0x1')]={'name':{'type':Sequelize[_0x6b55('0x2')],'get':function(_0xc97fcf){return this[_0x6b55('0x3')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x6b55('0x4')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x6b55('0x4')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x6b55('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x6b55('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x6b55('0x5')](_0x6b55('0x6')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x6b55('0x4')],'defaultValue':''},'stamp':{'type':_0x6b55('0x7'),'defaultValue':Sequelize[_0x6b55('0x8')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x6b51=['long','TIMESTAMP','literal','exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB'];(function(_0x584db2,_0xf19a0){var _0x5ac76d=function(_0x8e3468){while(--_0x8e3468){_0x584db2['push'](_0x584db2['shift']());}};_0x5ac76d(++_0xf19a0);}(_0x6b51,0xff));var _0x16b5=function(_0x3bc958,_0x45d34a){_0x3bc958=_0x3bc958-0x0;var _0x3d136e=_0x6b51[_0x3bc958];return _0x3d136e;};'use strict';var Sequelize=require('sequelize');module[_0x16b5('0x0')]={'name':{'type':Sequelize[_0x16b5('0x1')],'get':function(_0x4bb902){return this[_0x16b5('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x16b5('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x16b5('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x16b5('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x16b5('0x4')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x16b5('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x16b5('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x16b5('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x16b5('0x5')](_0x16b5('0x6')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x16b5('0x4')],'defaultValue':''},'stamp':{'type':_0x16b5('0x7'),'defaultValue':Sequelize[_0x16b5('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 20f1169..db6ac0f 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 _0x798e=['catch','params','create','body','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','attachment','Content-Disposition','.wav\x22','set','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','count','reject','save','update','then','destroy','error','name','send','map','VoiceMailMessage','rawAttributes','fieldName','type','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','offset','order','sort','filters','pick','filter','where','merge','options','includeAll','findAll','rows'];(function(_0x3681f7,_0x3c5ade){var _0xec3c3c=function(_0x1e3084){while(--_0x1e3084){_0x3681f7['push'](_0x3681f7['shift']());}};_0xec3c3c(++_0x3c5ade);}(_0x798e,0xf2));var _0xe798=function(_0x28c8fc,_0x1e007e){_0x28c8fc=_0x28c8fc-0x0;var _0x3bc1c1=_0x798e[_0x28c8fc];return _0x3bc1c1;};'use strict';var emlformat=require(_0xe798('0x0'));var rimraf=require(_0xe798('0x1'));var zipdir=require(_0xe798('0x2'));var jsonpatch=require(_0xe798('0x3'));var rp=require(_0xe798('0x4'));var moment=require(_0xe798('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe798('0x6'));var path=require('path');var sox=require(_0xe798('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe798('0x8'));var squel=require(_0xe798('0x9'));var crypto=require(_0xe798('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xe798('0xb'));var toCsv=require(_0xe798('0xc'));var querystring=require(_0xe798('0xd'));var Papa=require('papaparse');var Redis=require(_0xe798('0xe'));var authService=require(_0xe798('0xf'));var qs=require(_0xe798('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe798('0x11'));var logger=require('../../config/logger')(_0xe798('0x12'));var utils=require(_0xe798('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xe798('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5825d6,_0x4d1c9d){_0x4d1c9d=_0x4d1c9d||0xcc;return function(_0x4173b6){if(_0x4173b6){return _0x5825d6[_0xe798('0x15')](_0x4d1c9d);}return _0x5825d6[_0xe798('0x16')](_0x4d1c9d)[_0xe798('0x17')]();};}function respondWithResult(_0x3c3558,_0x2a3fe7){_0x2a3fe7=_0x2a3fe7||0xc8;return function(_0x3bb988){if(_0x3bb988){return _0x3c3558[_0xe798('0x16')](_0x2a3fe7)[_0xe798('0x18')](_0x3bb988);}};}function respondWithFilteredResult(_0x5cd12f,_0x55f33a){return function(_0x4aa8b2){if(_0x4aa8b2){var _0x1b0afb=typeof _0x55f33a['offset']===_0xe798('0x19')&&typeof _0x55f33a['limit']===_0xe798('0x19');var _0x21b8b4=_0x4aa8b2[_0xe798('0x1a')];var _0x57539f=_0x1b0afb?0x0:_0x55f33a['offset'];var _0xd3e646=_0x1b0afb?_0x4aa8b2[_0xe798('0x1a')]:_0x55f33a['offset']+_0x55f33a['limit'];var _0x5d62d2;if(_0xd3e646>=_0x21b8b4){_0xd3e646=_0x21b8b4;_0x5d62d2=0xc8;}else{_0x5d62d2=0xce;}_0x5cd12f[_0xe798('0x16')](_0x5d62d2);return _0x5cd12f['set']('Content-Range',_0x57539f+'-'+_0xd3e646+'/'+_0x21b8b4)[_0xe798('0x18')](_0x4aa8b2);}return null;};}function patchUpdates(_0x52cc04){return function(_0x1f4445){try{jsonpatch['apply'](_0x1f4445,_0x52cc04,!![]);}catch(_0x2b7d7e){return BPromise[_0xe798('0x1b')](_0x2b7d7e);}return _0x1f4445[_0xe798('0x1c')]();};}function saveUpdates(_0x2b9cdf,_0x388749){return function(_0x380dea){if(_0x380dea){return _0x380dea[_0xe798('0x1d')](_0x2b9cdf)[_0xe798('0x1e')](function(_0x5e9962){return _0x5e9962;});}return null;};}function removeEntity(_0x23fd50,_0x56d76f){return function(_0x3e63b3){if(_0x3e63b3){return _0x3e63b3[_0xe798('0x1f')]()[_0xe798('0x1e')](function(){_0x23fd50['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x8cdc67,_0x2ba4e3){return function(_0x1e681b){if(!_0x1e681b){_0x8cdc67[_0xe798('0x15')](0x194);}return _0x1e681b;};}function handleError(_0x5bcf4a,_0x27f38d){_0x27f38d=_0x27f38d||0x1f4;return function(_0x26e8eb){logger[_0xe798('0x20')](_0x26e8eb['stack']);if(_0x26e8eb['name']){delete _0x26e8eb[_0xe798('0x21')];}_0x5bcf4a[_0xe798('0x16')](_0x27f38d)[_0xe798('0x22')](_0x26e8eb);};}exports['index']=function(_0x5868a7,_0x18bf93){var _0x2211d3={},_0x2bfed6={},_0x5a44cf={'count':0x0,'rows':[]};var _0x24931d=_[_0xe798('0x23')](db[_0xe798('0x24')][_0xe798('0x25')],function(_0x1769de){return{'name':_0x1769de[_0xe798('0x26')],'type':_0x1769de[_0xe798('0x27')]['key']};});_0x2bfed6['model']=_['differenceBy'](_['map'](_0x24931d,_0xe798('0x21')),[_0xe798('0x21')]);_0x2bfed6['query']=_[_0xe798('0x28')](_0x5868a7[_0xe798('0x29')]);_0x2bfed6['filters']=_[_0xe798('0x2a')](_0x2bfed6[_0xe798('0x2b')],_0x2bfed6[_0xe798('0x29')]);_0x2211d3[_0xe798('0x2c')]=_[_0xe798('0x2a')](_0x2bfed6[_0xe798('0x2b')],qs[_0xe798('0x2d')](_0x5868a7['query'][_0xe798('0x2d')]));_0x2211d3['attributes']=_0x2211d3[_0xe798('0x2c')][_0xe798('0x2e')]?_0x2211d3[_0xe798('0x2c')]:_0x2bfed6[_0xe798('0x2b')];if(!_0x5868a7['query'][_0xe798('0x2f')](_0xe798('0x30'))){_0x2211d3['limit']=qs['limit'](_0x5868a7['query'][_0xe798('0x31')]);_0x2211d3['offset']=qs['offset'](_0x5868a7[_0xe798('0x29')][_0xe798('0x32')]);}_0x2211d3[_0xe798('0x33')]=qs['sort'](_0x5868a7[_0xe798('0x29')][_0xe798('0x34')]);_0x2211d3['where']=qs[_0xe798('0x35')](_[_0xe798('0x36')](_0x5868a7[_0xe798('0x29')],_0x2bfed6[_0xe798('0x35')]),_0x24931d);if(_0x5868a7[_0xe798('0x29')][_0xe798('0x37')]){_0x2211d3[_0xe798('0x38')]=_[_0xe798('0x39')](_0x2211d3[_0xe798('0x38')],{'$or':_[_0xe798('0x23')](_0x24931d,function(_0xbc1b26){if(_0xbc1b26[_0xe798('0x27')]!=='VIRTUAL'){var _0x251dae={};_0x251dae[_0xbc1b26['name']]={'$like':'%'+_0x5868a7[_0xe798('0x29')][_0xe798('0x37')]+'%'};return _0x251dae;}})});}_0x2211d3=_['merge']({},_0x2211d3,_0x5868a7[_0xe798('0x3a')]);var _0x550b73={'where':_0x2211d3[_0xe798('0x38')]};return db['VoiceMailMessage'][_0xe798('0x1a')](_0x550b73)[_0xe798('0x1e')](function(_0xf3105c){_0x5a44cf[_0xe798('0x1a')]=_0xf3105c;if(_0x5868a7[_0xe798('0x29')][_0xe798('0x3b')]){_0x2211d3['include']=[{'all':!![]}];}return db[_0xe798('0x24')][_0xe798('0x3c')](_0x2211d3);})['then'](function(_0x5557c2){_0x5a44cf[_0xe798('0x3d')]=_0x5557c2;return _0x5a44cf;})[_0xe798('0x1e')](respondWithFilteredResult(_0x18bf93,_0x2211d3))[_0xe798('0x3e')](handleError(_0x18bf93,null));};exports['show']=function(_0x536d52,_0x417861){var _0x3af3ca={'raw':!![],'where':{'id':_0x536d52[_0xe798('0x3f')]['id']}},_0x25249a={};_0x25249a['model']=_[_0xe798('0x28')](db['VoiceMailMessage'][_0xe798('0x25')]);_0x25249a['query']=_['keys'](_0x536d52[_0xe798('0x29')]);_0x25249a['filters']=_['intersection'](_0x25249a['model'],_0x25249a[_0xe798('0x29')]);_0x3af3ca[_0xe798('0x2c')]=_[_0xe798('0x2a')](_0x25249a['model'],qs[_0xe798('0x2d')](_0x536d52[_0xe798('0x29')][_0xe798('0x2d')]));_0x3af3ca['attributes']=_0x3af3ca[_0xe798('0x2c')][_0xe798('0x2e')]?_0x3af3ca['attributes']:_0x25249a[_0xe798('0x2b')];if(_0x536d52[_0xe798('0x29')][_0xe798('0x3b')]){_0x3af3ca['include']=[{'all':!![]}];}_0x3af3ca=_['merge']({},_0x3af3ca,_0x536d52[_0xe798('0x3a')]);return db[_0xe798('0x24')]['find'](_0x3af3ca)['then'](handleEntityNotFound(_0x417861,null))[_0xe798('0x1e')](respondWithResult(_0x417861,null))[_0xe798('0x3e')](handleError(_0x417861,null));};exports['create']=function(_0x58fe7c,_0xdc7041){return db['VoiceMailMessage'][_0xe798('0x40')](_0x58fe7c['body'],{})[_0xe798('0x1e')](respondWithResult(_0xdc7041,0xc9))[_0xe798('0x3e')](handleError(_0xdc7041,null));};exports[_0xe798('0x1d')]=function(_0x6aebd8,_0x47d533){if(_0x6aebd8[_0xe798('0x41')]['id']){delete _0x6aebd8[_0xe798('0x41')]['id'];}return db[_0xe798('0x24')]['find']({'where':{'id':_0x6aebd8[_0xe798('0x3f')]['id']}})[_0xe798('0x1e')](handleEntityNotFound(_0x47d533,null))[_0xe798('0x1e')](saveUpdates(_0x6aebd8[_0xe798('0x41')],null))[_0xe798('0x1e')](respondWithResult(_0x47d533,null))[_0xe798('0x3e')](handleError(_0x47d533,null));};exports[_0xe798('0x1f')]=function(_0x1f7157,_0x3007c5){return db[_0xe798('0x24')]['find']({'where':{'id':_0x1f7157[_0xe798('0x3f')]['id']}})[_0xe798('0x1e')](handleEntityNotFound(_0x3007c5,null))[_0xe798('0x1e')](removeEntity(_0x3007c5,null))[_0xe798('0x3e')](handleError(_0x3007c5,null));};exports[_0xe798('0x42')]=function(_0x406a24,_0x451710,_0x659e01){return db[_0xe798('0x24')]['find']({'where':{'id':_0x406a24[_0xe798('0x3f')]['id']},'attributes':['id',_0xe798('0x43'),_0xe798('0x44')]})[_0xe798('0x1e')](handleEntityNotFound(_0x451710,null))[_0xe798('0x1e')](function(_0x420f9f){if(_0x420f9f){if(!_0x420f9f['recording']){throw new db[(_0xe798('0x45'))][(_0xe798('0x46'))](_0xe798('0x47'));}var _0x379b84={'Content-Type':'audio/wav','Content-Disposition':_0xe798('0x48')};if(_0x420f9f['msg_id']){_0x379b84[_0xe798('0x49')]='attachment;\x20filename=\x22'+_0x420f9f[_0xe798('0x44')]+_0xe798('0x4a');}_0x451710[_0xe798('0x4b')](_0x379b84);return _0x451710['send'](new Buffer(_0x420f9f[_0xe798('0x43')]));}})['catch'](handleError(_0x451710,null));}; \ No newline at end of file +var _0x9a12=['msg_id','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','limit','offset','set','json','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','count','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','download'];(function(_0x7feb90,_0x28e700){var _0x3c5b33=function(_0x113cfa){while(--_0x113cfa){_0x7feb90['push'](_0x7feb90['shift']());}};_0x3c5b33(++_0x28e700);}(_0x9a12,0x1c1));var _0x29a1=function(_0x552252,_0xdb0d75){_0x552252=_0x552252-0x0;var _0x16ae8d=_0x9a12[_0x552252];return _0x16ae8d;};'use strict';var emlformat=require(_0x29a1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x29a1('0x1'));var jsonpatch=require(_0x29a1('0x2'));var rp=require(_0x29a1('0x3'));var moment=require(_0x29a1('0x4'));var BPromise=require(_0x29a1('0x5'));var Mustache=require(_0x29a1('0x6'));var util=require(_0x29a1('0x7'));var path=require('path');var sox=require(_0x29a1('0x8'));var csv=require('to-csv');var ejs=require(_0x29a1('0x9'));var fs=require('fs');var fs_extra=require(_0x29a1('0xa'));var _=require(_0x29a1('0xb'));var squel=require(_0x29a1('0xc'));var crypto=require(_0x29a1('0xd'));var jsforce=require(_0x29a1('0xe'));var deskjs=require(_0x29a1('0xf'));var toCsv=require(_0x29a1('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x29a1('0x11'));var authService=require(_0x29a1('0x12'));var qs=require(_0x29a1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x29a1('0x14'));var logger=require(_0x29a1('0x15'))(_0x29a1('0x16'));var utils=require(_0x29a1('0x17'));var config=require(_0x29a1('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e9dc9,_0x914690){_0x914690=_0x914690||0xcc;return function(_0x36cf45){if(_0x36cf45){return _0x1e9dc9['sendStatus'](_0x914690);}return _0x1e9dc9[_0x29a1('0x19')](_0x914690)['end']();};}function respondWithResult(_0x52118c,_0x871f96){_0x871f96=_0x871f96||0xc8;return function(_0x3d2a6d){if(_0x3d2a6d){return _0x52118c[_0x29a1('0x19')](_0x871f96)['json'](_0x3d2a6d);}};}function respondWithFilteredResult(_0x470a5c,_0x10d57c){return function(_0xfa36f0){if(_0xfa36f0){var _0x35b4ae=typeof _0x10d57c['offset']==='undefined'&&typeof _0x10d57c[_0x29a1('0x1a')]==='undefined';var _0x2a0b65=_0xfa36f0['count'];var _0x3a1842=_0x35b4ae?0x0:_0x10d57c[_0x29a1('0x1b')];var _0x152b66=_0x35b4ae?_0xfa36f0['count']:_0x10d57c['offset']+_0x10d57c[_0x29a1('0x1a')];var _0x11e4c3;if(_0x152b66>=_0x2a0b65){_0x152b66=_0x2a0b65;_0x11e4c3=0xc8;}else{_0x11e4c3=0xce;}_0x470a5c['status'](_0x11e4c3);return _0x470a5c[_0x29a1('0x1c')]('Content-Range',_0x3a1842+'-'+_0x152b66+'/'+_0x2a0b65)[_0x29a1('0x1d')](_0xfa36f0);}return null;};}function patchUpdates(_0x2abf90){return function(_0x2496d1){try{jsonpatch[_0x29a1('0x1e')](_0x2496d1,_0x2abf90,!![]);}catch(_0x4115b1){return BPromise[_0x29a1('0x1f')](_0x4115b1);}return _0x2496d1[_0x29a1('0x20')]();};}function saveUpdates(_0x592fe7,_0x282726){return function(_0xe9eeba){if(_0xe9eeba){return _0xe9eeba[_0x29a1('0x21')](_0x592fe7)[_0x29a1('0x22')](function(_0xd5f45){return _0xd5f45;});}return null;};}function removeEntity(_0x2e30f9,_0x527244){return function(_0x36703d){if(_0x36703d){return _0x36703d[_0x29a1('0x23')]()[_0x29a1('0x22')](function(){_0x2e30f9[_0x29a1('0x19')](0xcc)[_0x29a1('0x24')]();});}};}function handleEntityNotFound(_0x15e659,_0x1f8238){return function(_0x44e04e){if(!_0x44e04e){_0x15e659[_0x29a1('0x25')](0x194);}return _0x44e04e;};}function handleError(_0x3b369c,_0x3f93ac){_0x3f93ac=_0x3f93ac||0x1f4;return function(_0x4c2a22){logger[_0x29a1('0x26')](_0x4c2a22[_0x29a1('0x27')]);if(_0x4c2a22['name']){delete _0x4c2a22[_0x29a1('0x28')];}_0x3b369c[_0x29a1('0x19')](_0x3f93ac)[_0x29a1('0x29')](_0x4c2a22);};}exports[_0x29a1('0x2a')]=function(_0x8cd9f4,_0x5c9373){var _0x251ce4={},_0x575fbb={},_0x3da12a={'count':0x0,'rows':[]};var _0x8c3e22=_[_0x29a1('0x2b')](db[_0x29a1('0x2c')][_0x29a1('0x2d')],function(_0x17b463){return{'name':_0x17b463[_0x29a1('0x2e')],'type':_0x17b463['type'][_0x29a1('0x2f')]};});_0x575fbb[_0x29a1('0x30')]=_['differenceBy'](_[_0x29a1('0x2b')](_0x8c3e22,'name'),[_0x29a1('0x28')]);_0x575fbb[_0x29a1('0x31')]=_[_0x29a1('0x32')](_0x8cd9f4['query']);_0x575fbb[_0x29a1('0x33')]=_[_0x29a1('0x34')](_0x575fbb[_0x29a1('0x30')],_0x575fbb[_0x29a1('0x31')]);_0x251ce4[_0x29a1('0x35')]=_[_0x29a1('0x34')](_0x575fbb[_0x29a1('0x30')],qs[_0x29a1('0x36')](_0x8cd9f4['query'][_0x29a1('0x36')]));_0x251ce4[_0x29a1('0x35')]=_0x251ce4[_0x29a1('0x35')][_0x29a1('0x37')]?_0x251ce4[_0x29a1('0x35')]:_0x575fbb[_0x29a1('0x30')];if(!_0x8cd9f4[_0x29a1('0x31')][_0x29a1('0x38')](_0x29a1('0x39'))){_0x251ce4['limit']=qs[_0x29a1('0x1a')](_0x8cd9f4[_0x29a1('0x31')][_0x29a1('0x1a')]);_0x251ce4[_0x29a1('0x1b')]=qs['offset'](_0x8cd9f4[_0x29a1('0x31')][_0x29a1('0x1b')]);}_0x251ce4[_0x29a1('0x3a')]=qs[_0x29a1('0x3b')](_0x8cd9f4[_0x29a1('0x31')][_0x29a1('0x3b')]);_0x251ce4[_0x29a1('0x3c')]=qs[_0x29a1('0x33')](_[_0x29a1('0x3d')](_0x8cd9f4[_0x29a1('0x31')],_0x575fbb[_0x29a1('0x33')]),_0x8c3e22);if(_0x8cd9f4[_0x29a1('0x31')][_0x29a1('0x3e')]){_0x251ce4[_0x29a1('0x3c')]=_[_0x29a1('0x3f')](_0x251ce4[_0x29a1('0x3c')],{'$or':_['map'](_0x8c3e22,function(_0x4583ef){if(_0x4583ef[_0x29a1('0x40')]!==_0x29a1('0x41')){var _0x5de2d9={};_0x5de2d9[_0x4583ef['name']]={'$like':'%'+_0x8cd9f4['query'][_0x29a1('0x3e')]+'%'};return _0x5de2d9;}})});}_0x251ce4=_[_0x29a1('0x3f')]({},_0x251ce4,_0x8cd9f4['options']);var _0xc24de5={'where':_0x251ce4[_0x29a1('0x3c')]};return db[_0x29a1('0x2c')][_0x29a1('0x42')](_0xc24de5)[_0x29a1('0x22')](function(_0x73c2d8){_0x3da12a[_0x29a1('0x42')]=_0x73c2d8;if(_0x8cd9f4['query']['includeAll']){_0x251ce4[_0x29a1('0x43')]=[{'all':!![]}];}return db[_0x29a1('0x2c')][_0x29a1('0x44')](_0x251ce4);})[_0x29a1('0x22')](function(_0x4da6fa){_0x3da12a[_0x29a1('0x45')]=_0x4da6fa;return _0x3da12a;})[_0x29a1('0x22')](respondWithFilteredResult(_0x5c9373,_0x251ce4))[_0x29a1('0x46')](handleError(_0x5c9373,null));};exports[_0x29a1('0x47')]=function(_0x43bbe3,_0x254d7a){var _0x979d58={'raw':!![],'where':{'id':_0x43bbe3[_0x29a1('0x48')]['id']}},_0x5ed481={};_0x5ed481[_0x29a1('0x30')]=_[_0x29a1('0x32')](db[_0x29a1('0x2c')][_0x29a1('0x2d')]);_0x5ed481[_0x29a1('0x31')]=_['keys'](_0x43bbe3[_0x29a1('0x31')]);_0x5ed481[_0x29a1('0x33')]=_[_0x29a1('0x34')](_0x5ed481[_0x29a1('0x30')],_0x5ed481[_0x29a1('0x31')]);_0x979d58[_0x29a1('0x35')]=_[_0x29a1('0x34')](_0x5ed481[_0x29a1('0x30')],qs['fields'](_0x43bbe3[_0x29a1('0x31')][_0x29a1('0x36')]));_0x979d58[_0x29a1('0x35')]=_0x979d58[_0x29a1('0x35')][_0x29a1('0x37')]?_0x979d58[_0x29a1('0x35')]:_0x5ed481['model'];if(_0x43bbe3[_0x29a1('0x31')][_0x29a1('0x49')]){_0x979d58[_0x29a1('0x43')]=[{'all':!![]}];}_0x979d58=_['merge']({},_0x979d58,_0x43bbe3[_0x29a1('0x4a')]);return db[_0x29a1('0x2c')][_0x29a1('0x4b')](_0x979d58)['then'](handleEntityNotFound(_0x254d7a,null))[_0x29a1('0x22')](respondWithResult(_0x254d7a,null))[_0x29a1('0x46')](handleError(_0x254d7a,null));};exports[_0x29a1('0x4c')]=function(_0x1809ac,_0x502c2b){return db[_0x29a1('0x2c')]['create'](_0x1809ac[_0x29a1('0x4d')],{})[_0x29a1('0x22')](respondWithResult(_0x502c2b,0xc9))[_0x29a1('0x46')](handleError(_0x502c2b,null));};exports[_0x29a1('0x21')]=function(_0x100f84,_0x5eee13){if(_0x100f84[_0x29a1('0x4d')]['id']){delete _0x100f84[_0x29a1('0x4d')]['id'];}return db[_0x29a1('0x2c')][_0x29a1('0x4b')]({'where':{'id':_0x100f84[_0x29a1('0x48')]['id']}})[_0x29a1('0x22')](handleEntityNotFound(_0x5eee13,null))['then'](saveUpdates(_0x100f84['body'],null))['then'](respondWithResult(_0x5eee13,null))[_0x29a1('0x46')](handleError(_0x5eee13,null));};exports[_0x29a1('0x23')]=function(_0x5b324e,_0x51935b){return db[_0x29a1('0x2c')][_0x29a1('0x4b')]({'where':{'id':_0x5b324e['params']['id']}})[_0x29a1('0x22')](handleEntityNotFound(_0x51935b,null))[_0x29a1('0x22')](removeEntity(_0x51935b,null))[_0x29a1('0x46')](handleError(_0x51935b,null));};exports[_0x29a1('0x4e')]=function(_0x4f11b3,_0x2a6cbe,_0x345810){return db[_0x29a1('0x2c')]['find']({'where':{'id':_0x4f11b3[_0x29a1('0x48')]['id']},'attributes':['id','recording',_0x29a1('0x4f')]})['then'](handleEntityNotFound(_0x2a6cbe,null))['then'](function(_0x4455d4){if(_0x4455d4){if(!_0x4455d4[_0x29a1('0x50')]){throw new db[(_0x29a1('0x51'))][(_0x29a1('0x52'))](_0x29a1('0x53'));}var _0xf46fcc={'Content-Type':_0x29a1('0x54'),'Content-Disposition':'attachment'};if(_0x4455d4[_0x29a1('0x4f')]){_0xf46fcc[_0x29a1('0x55')]=_0x29a1('0x56')+_0x4455d4[_0x29a1('0x4f')]+_0x29a1('0x57');}_0x2a6cbe[_0x29a1('0x1c')](_0xf46fcc);return _0x2a6cbe[_0x29a1('0x29')](new Buffer(_0x4455d4[_0x29a1('0x50')]));}})[_0x29a1('0x46')](handleError(_0x2a6cbe,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 2c1b7ab..6799414 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 _0x0ff9=['rimraf','./voiceMailMessage.attributes','exports','define','voice_voicemail_messages','dir','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x0ff9,0x13e));var _0x90ff=function(_0x90add5,_0x531360){_0x90add5=_0x90add5-0x0;var _0x376af0=_0x0ff9[_0x90add5];return _0x376af0;};'use strict';var _=require(_0x90ff('0x0'));var util=require(_0x90ff('0x1'));var logger=require(_0x90ff('0x2'))('api');var moment=require(_0x90ff('0x3'));var BPromise=require('bluebird');var rp=require(_0x90ff('0x4'));var fs=require('fs');var path=require(_0x90ff('0x5'));var rimraf=require(_0x90ff('0x6'));var config=require('../../config/environment');var attributes=require(_0x90ff('0x7'));module[_0x90ff('0x8')]=function(_0x4b57a7,_0x572886){return _0x4b57a7[_0x90ff('0x9')]('VoiceMailMessage',attributes,{'tableName':_0x90ff('0xa'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x90ff('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x808e=['exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./voiceMailMessage.attributes'];(function(_0x5ddb72,_0x44e0f6){var _0x2d87ca=function(_0x520cfa){while(--_0x520cfa){_0x5ddb72['push'](_0x5ddb72['shift']());}};_0x2d87ca(++_0x44e0f6);}(_0x808e,0x67));var _0xe808=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x808e[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0xe808('0x0'));var util=require(_0xe808('0x1'));var logger=require(_0xe808('0x2'))(_0xe808('0x3'));var moment=require(_0xe808('0x4'));var BPromise=require('bluebird');var rp=require(_0xe808('0x5'));var fs=require('fs');var path=require(_0xe808('0x6'));var rimraf=require(_0xe808('0x7'));var config=require('../../config/environment');var attributes=require(_0xe808('0x8'));module[_0xe808('0x9')]=function(_0x3cfa46,_0xd687bd){return _0x3cfa46[_0xe808('0xa')](_0xe808('0xb'),attributes,{'tableName':_0xe808('0xc'),'paranoid':![],'indexes':[{'name':_0xe808('0xd'),'fields':[_0xe808('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 735ce7f..9f89ac8 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 _0x1ae6=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceMailMessage,\x20%s,\x20%s','message','catch','moment','bluebird','randomstring'];(function(_0x18f8ff,_0x257e95){var _0x18de97=function(_0xc8eb68){while(--_0xc8eb68){_0x18f8ff['push'](_0x18f8ff['shift']());}};_0x18de97(++_0x257e95);}(_0x1ae6,0x90));var _0x61ae=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x1ae6[_0x5c351c];return _0x26f3b3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x61ae('0x0'));var BPromise=require(_0x61ae('0x1'));var rs=require(_0x61ae('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x61ae('0x3'))['db'];var utils=require(_0x61ae('0x4'));var logger=require(_0x61ae('0x5'))('rpc');var config=require(_0x61ae('0x6'));var jayson=require(_0x61ae('0x7'));var client=jayson[_0x61ae('0x8')][_0x61ae('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x336ecf,_0x3c8369,_0x463b01){return new BPromise(function(_0x35f08b,_0x59ca68){return client[_0x61ae('0xa')](_0x336ecf,_0x463b01)['then'](function(_0x28b7ea){logger[_0x61ae('0xb')]('VoiceMailMessage,\x20%s,\x20%s',_0x3c8369,_0x61ae('0xc'));logger[_0x61ae('0xd')](_0x61ae('0xe'),_0x3c8369,_0x61ae('0xc'),JSON[_0x61ae('0xf')](_0x28b7ea));if(_0x28b7ea[_0x61ae('0x10')]){if(_0x28b7ea[_0x61ae('0x10')][_0x61ae('0x11')]===0x1f4){logger[_0x61ae('0x10')](_0x61ae('0x12'),_0x3c8369,_0x28b7ea[_0x61ae('0x10')][_0x61ae('0x13')]);return _0x59ca68(_0x28b7ea['error'][_0x61ae('0x13')]);}logger[_0x61ae('0x10')](_0x61ae('0x12'),_0x3c8369,_0x28b7ea['error']['message']);return _0x35f08b(_0x28b7ea[_0x61ae('0x10')][_0x61ae('0x13')]);}else{logger[_0x61ae('0xb')](_0x61ae('0x12'),_0x3c8369,_0x61ae('0xc'));_0x35f08b(_0x28b7ea['result'][_0x61ae('0x13')]);}})[_0x61ae('0x14')](function(_0x1ce1a2){logger['error'](_0x61ae('0x12'),_0x3c8369,_0x1ce1a2);_0x59ca68(_0x1ce1a2);});});} \ No newline at end of file +var _0x6caf=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../config/utils'];(function(_0x3f3f6e,_0x3a092d){var _0x3a9480=function(_0x187bc6){while(--_0x187bc6){_0x3f3f6e['push'](_0x3f3f6e['shift']());}};_0x3a9480(++_0x3a092d);}(_0x6caf,0x1b3));var _0xf6ca=function(_0x37756b,_0x24db76){_0x37756b=_0x37756b-0x0;var _0x46efec=_0x6caf[_0x37756b];return _0x46efec;};'use strict';var _=require(_0xf6ca('0x0'));var util=require(_0xf6ca('0x1'));var moment=require('moment');var BPromise=require(_0xf6ca('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf6ca('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf6ca('0x4'));var logger=require(_0xf6ca('0x5'))(_0xf6ca('0x6'));var config=require(_0xf6ca('0x7'));var jayson=require(_0xf6ca('0x8'));var client=jayson[_0xf6ca('0x9')][_0xf6ca('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x460224,_0x456736,_0x1afb03){return new BPromise(function(_0x2f64f9,_0x265482){return client[_0xf6ca('0xb')](_0x460224,_0x1afb03)['then'](function(_0x3a2282){logger[_0xf6ca('0xc')](_0xf6ca('0xd'),_0x456736,_0xf6ca('0xe'));logger[_0xf6ca('0xf')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x456736,_0xf6ca('0xe'),JSON[_0xf6ca('0x10')](_0x3a2282));if(_0x3a2282[_0xf6ca('0x11')]){if(_0x3a2282['error'][_0xf6ca('0x12')]===0x1f4){logger[_0xf6ca('0x11')](_0xf6ca('0xd'),_0x456736,_0x3a2282[_0xf6ca('0x11')][_0xf6ca('0x13')]);return _0x265482(_0x3a2282['error']['message']);}logger[_0xf6ca('0x11')](_0xf6ca('0xd'),_0x456736,_0x3a2282[_0xf6ca('0x11')]['message']);return _0x2f64f9(_0x3a2282['error'][_0xf6ca('0x13')]);}else{logger['info'](_0xf6ca('0xd'),_0x456736,'request\x20sent');_0x2f64f9(_0x3a2282[_0xf6ca('0x14')][_0xf6ca('0x13')]);}})[_0xf6ca('0x15')](function(_0x21da5c){logger[_0xf6ca('0x11')](_0xf6ca('0xd'),_0x456736,_0x21da5c);_0x265482(_0x21da5c);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 8a3fd4c..1a28c6a 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 _0x7437=['express','fs-extra','../../components/interaction/service','./voiceMusicOnHold.controller','isAuthenticated','index','get','/:id','show','/:id/sounds','getSounds','post','create','addSound','put','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','path','connect-timeout'];(function(_0x3b3253,_0x282bf2){var _0x147c1f=function(_0x1fe7db){while(--_0x1fe7db){_0x3b3253['push'](_0x3b3253['shift']());}};_0x147c1f(++_0x282bf2);}(_0x7437,0x1f4));var _0x7743=function(_0x5e42b4,_0x1b9678){_0x5e42b4=_0x5e42b4-0x0;var _0x3f89c8=_0x7437[_0x5e42b4];return _0x3f89c8;};'use strict';var multer=require(_0x7743('0x0'));var util=require(_0x7743('0x1'));var path=require(_0x7743('0x2'));var timeout=require(_0x7743('0x3'));var express=require(_0x7743('0x4'));var router=express['Router']();var fs_extra=require(_0x7743('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7743('0x6'));var config=require('../../config/environment');var controller=require(_0x7743('0x7'));router['get']('/',auth[_0x7743('0x8')](),controller[_0x7743('0x9')]);router[_0x7743('0xa')](_0x7743('0xb'),auth['isAuthenticated'](),controller[_0x7743('0xc')]);router[_0x7743('0xa')](_0x7743('0xd'),auth[_0x7743('0x8')](),controller[_0x7743('0xe')]);router[_0x7743('0xf')]('/',auth[_0x7743('0x8')](),controller[_0x7743('0x10')]);router[_0x7743('0xf')](_0x7743('0xd'),auth[_0x7743('0x8')](),controller[_0x7743('0x11')]);router[_0x7743('0x12')](_0x7743('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x7743('0x13')](_0x7743('0xb'),auth[_0x7743('0x8')](),controller[_0x7743('0x14')]);router['delete'](_0x7743('0x15'),auth[_0x7743('0x8')](),controller[_0x7743('0x16')]);module[_0x7743('0x17')]=router; \ No newline at end of file +var _0xc482=['show','getSounds','post','create','/:id/sounds','addSound','put','update','delete','destroy','removeSound','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','/:id'];(function(_0x44c89d,_0x2b6039){var _0x1dafed=function(_0x57fddb){while(--_0x57fddb){_0x44c89d['push'](_0x44c89d['shift']());}};_0x1dafed(++_0x2b6039);}(_0xc482,0x13f));var _0x2c48=function(_0x56b0e1,_0x1cfa47){_0x56b0e1=_0x56b0e1-0x0;var _0x1f9f92=_0xc482[_0x56b0e1];return _0x1f9f92;};'use strict';var multer=require(_0x2c48('0x0'));var util=require(_0x2c48('0x1'));var path=require(_0x2c48('0x2'));var timeout=require(_0x2c48('0x3'));var express=require(_0x2c48('0x4'));var router=express[_0x2c48('0x5')]();var fs_extra=require(_0x2c48('0x6'));var auth=require(_0x2c48('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x2c48('0x8'));var controller=require('./voiceMusicOnHold.controller');router['get']('/',auth[_0x2c48('0x9')](),controller['index']);router['get'](_0x2c48('0xa'),auth[_0x2c48('0x9')](),controller[_0x2c48('0xb')]);router['get']('/:id/sounds',auth[_0x2c48('0x9')](),controller[_0x2c48('0xc')]);router[_0x2c48('0xd')]('/',auth['isAuthenticated'](),controller[_0x2c48('0xe')]);router[_0x2c48('0xd')](_0x2c48('0xf'),auth[_0x2c48('0x9')](),controller[_0x2c48('0x10')]);router[_0x2c48('0x11')]('/:id',auth[_0x2c48('0x9')](),controller[_0x2c48('0x12')]);router[_0x2c48('0x13')](_0x2c48('0xa'),auth[_0x2c48('0x9')](),controller[_0x2c48('0x14')]);router[_0x2c48('0x13')]('/:id/sounds/:id2',auth[_0x2c48('0x9')](),controller[_0x2c48('0x15')]);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 b9206f1..8e9ac80 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 _0xf061=['mp3','alpha','sequelize','exports','STRING','ENUM','files','mp3nb','quietmp3nb'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf061,0xec));var _0x1f06=function(_0x40b655,_0x394cfb){_0x40b655=_0x40b655-0x0;var _0x1ccb75=_0xf061[_0x40b655];return _0x1ccb75;};'use strict';var Sequelize=require(_0x1f06('0x0'));module[_0x1f06('0x1')]={'name':{'type':Sequelize[_0x1f06('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x1f06('0x3')]('custom',_0x1f06('0x4'),_0x1f06('0x5'),_0x1f06('0x6'),'quietmp3',_0x1f06('0x7')),'allowNull':!![],'defaultValue':_0x1f06('0x4')},'directory':{'type':Sequelize[_0x1f06('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x1f06('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x1f06('0x2')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1f06('0x8')},'format':{'type':Sequelize[_0x1f06('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x31eb=['mp3nb','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','exports','STRING','name','ENUM','custom','files'];(function(_0x158c7f,_0x3641eb){var _0xac275e=function(_0x45f5bf){while(--_0x45f5bf){_0x158c7f['push'](_0x158c7f['shift']());}};_0xac275e(++_0x3641eb);}(_0x31eb,0xd7));var _0xb31e=function(_0xa16756,_0x5693a9){_0xa16756=_0xa16756-0x0;var _0x35e70e=_0x31eb[_0xa16756];return _0x35e70e;};'use strict';var Sequelize=require('sequelize');module[_0xb31e('0x0')]={'name':{'type':Sequelize[_0xb31e('0x1')],'allowNull':![],'unique':_0xb31e('0x2')},'mode':{'type':Sequelize[_0xb31e('0x3')](_0xb31e('0x4'),_0xb31e('0x5'),_0xb31e('0x6'),_0xb31e('0x7'),_0xb31e('0x8'),_0xb31e('0x9')),'allowNull':!![],'defaultValue':_0xb31e('0x5')},'directory':{'type':Sequelize[_0xb31e('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0xb31e('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0xb31e('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0xb31e('0x1')],'allowNull':!![],'defaultValue':_0xb31e('0xa')},'format':{'type':Sequelize[_0xb31e('0x1')],'allowNull':!![]},'stamp':{'type':_0xb31e('0xb')},'defaultEntry':{'type':Sequelize[_0xb31e('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 2d72c75..ab590f4 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 _0xcbb7=['nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','body','create','sequelize','transaction','mode','files','directory','join','root','server/files/moh','mkdirSync','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','readdirSync','forEach','unlinkSync','ValidationError','message','addSound','converted_format','createdAt','server/files/sounds/converted','%s.%s','basename','save_name','extname','format','symlinkSync','Sequelize','removeSound','id2','Sound','getSounds','findOne','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','limit','undefined','count','offset','status','apply','reject','save','update','destroy','then','get','MusicOnHolds','UserProfileResource','error','name','send','map','VoiceMusicOnHold','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x21eafe,_0x41af5a){var _0x4b3631=function(_0x38975e){while(--_0x38975e){_0x21eafe['push'](_0x21eafe['shift']());}};_0x4b3631(++_0x41af5a);}(_0xcbb7,0xa8));var _0x7cbb=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xcbb7[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x7cbb('0x0'));var rimraf=require(_0x7cbb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7cbb('0x2'));var rp=require(_0x7cbb('0x3'));var moment=require(_0x7cbb('0x4'));var BPromise=require(_0x7cbb('0x5'));var Mustache=require(_0x7cbb('0x6'));var util=require(_0x7cbb('0x7'));var path=require(_0x7cbb('0x8'));var sox=require(_0x7cbb('0x9'));var csv=require(_0x7cbb('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7cbb('0xb'));var _=require(_0x7cbb('0xc'));var squel=require(_0x7cbb('0xd'));var crypto=require('crypto');var jsforce=require(_0x7cbb('0xe'));var deskjs=require(_0x7cbb('0xf'));var toCsv=require(_0x7cbb('0xa'));var querystring=require(_0x7cbb('0x10'));var Papa=require(_0x7cbb('0x11'));var Redis=require(_0x7cbb('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7cbb('0x13'));var hardwareService=require(_0x7cbb('0x14'));var logger=require(_0x7cbb('0x15'))(_0x7cbb('0x16'));var utils=require(_0x7cbb('0x17'));var config=require(_0x7cbb('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x7cbb('0x19'))['db'];function respondWithStatusCode(_0x24b2a8,_0x3d18ff){_0x3d18ff=_0x3d18ff||0xcc;return function(_0x702b5c){if(_0x702b5c){return _0x24b2a8[_0x7cbb('0x1a')](_0x3d18ff);}return _0x24b2a8['status'](_0x3d18ff)['end']();};}function respondWithResult(_0x5ec88f,_0x19bfa3){_0x19bfa3=_0x19bfa3||0xc8;return function(_0x1f36cf){if(_0x1f36cf){return _0x5ec88f['status'](_0x19bfa3)['json'](_0x1f36cf);}};}function respondWithFilteredResult(_0x363714,_0x54a896){return function(_0x3df877){if(_0x3df877){var _0x5119d9=typeof _0x54a896['offset']==='undefined'&&typeof _0x54a896[_0x7cbb('0x1b')]===_0x7cbb('0x1c');var _0x20225f=_0x3df877[_0x7cbb('0x1d')];var _0x7446f8=_0x5119d9?0x0:_0x54a896[_0x7cbb('0x1e')];var _0x4ebb8b=_0x5119d9?_0x3df877[_0x7cbb('0x1d')]:_0x54a896[_0x7cbb('0x1e')]+_0x54a896[_0x7cbb('0x1b')];var _0x2aebb9;if(_0x4ebb8b>=_0x20225f){_0x4ebb8b=_0x20225f;_0x2aebb9=0xc8;}else{_0x2aebb9=0xce;}_0x363714[_0x7cbb('0x1f')](_0x2aebb9);return _0x363714['set']('Content-Range',_0x7446f8+'-'+_0x4ebb8b+'/'+_0x20225f)['json'](_0x3df877);}return null;};}function patchUpdates(_0x18923f){return function(_0x5cdc76){try{jsonpatch[_0x7cbb('0x20')](_0x5cdc76,_0x18923f,!![]);}catch(_0x59e5e8){return BPromise[_0x7cbb('0x21')](_0x59e5e8);}return _0x5cdc76[_0x7cbb('0x22')]();};}function saveUpdates(_0x213f38,_0x2af604){return function(_0x32aa88){if(_0x32aa88){return _0x32aa88[_0x7cbb('0x23')](_0x213f38)['then'](function(_0x11b3f9){return _0x11b3f9;});}return null;};}function removeEntity(_0x309fe4,_0x3ce606){return function(_0x5389a0){if(_0x5389a0){return _0x5389a0[_0x7cbb('0x24')]()[_0x7cbb('0x25')](function(){var _0x550aeb=_0x5389a0[_0x7cbb('0x26')]({'plain':!![]});var _0x44cfb1=_0x7cbb('0x27');return db[_0x7cbb('0x28')]['destroy']({'where':{'type':_0x44cfb1,'resourceId':_0x550aeb['id']}})['then'](function(){return _0x5389a0;});})[_0x7cbb('0x25')](function(){_0x309fe4[_0x7cbb('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c45c7,_0x319f75){return function(_0x17458e){if(!_0x17458e){_0x5c45c7[_0x7cbb('0x1a')](0x194);}return _0x17458e;};}function handleError(_0x23421b,_0x12f64f){_0x12f64f=_0x12f64f||0x1f4;return function(_0x138599){logger[_0x7cbb('0x29')](_0x138599['stack']);if(_0x138599['name']){delete _0x138599[_0x7cbb('0x2a')];}_0x23421b[_0x7cbb('0x1f')](_0x12f64f)[_0x7cbb('0x2b')](_0x138599);};}exports['index']=function(_0x51a56a,_0x158963){var _0x126bc6={},_0xb9b42e={},_0x20272c={'count':0x0,'rows':[]};var _0xcd0585=_[_0x7cbb('0x2c')](db[_0x7cbb('0x2d')]['rawAttributes'],function(_0x16bd3a){return{'name':_0x16bd3a[_0x7cbb('0x2e')],'type':_0x16bd3a[_0x7cbb('0x2f')][_0x7cbb('0x30')]};});_0xb9b42e[_0x7cbb('0x31')]=_[_0x7cbb('0x2c')](_0xcd0585,_0x7cbb('0x2a'));_0xb9b42e[_0x7cbb('0x32')]=_[_0x7cbb('0x33')](_0x51a56a[_0x7cbb('0x32')]);_0xb9b42e[_0x7cbb('0x34')]=_[_0x7cbb('0x35')](_0xb9b42e[_0x7cbb('0x31')],_0xb9b42e['query']);_0x126bc6['attributes']=_['intersection'](_0xb9b42e[_0x7cbb('0x31')],qs[_0x7cbb('0x36')](_0x51a56a[_0x7cbb('0x32')]['fields']));_0x126bc6[_0x7cbb('0x37')]=_0x126bc6[_0x7cbb('0x37')][_0x7cbb('0x38')]?_0x126bc6[_0x7cbb('0x37')]:_0xb9b42e[_0x7cbb('0x31')];if(!_0x51a56a['query'][_0x7cbb('0x39')](_0x7cbb('0x3a'))){_0x126bc6[_0x7cbb('0x1b')]=qs['limit'](_0x51a56a[_0x7cbb('0x32')]['limit']);_0x126bc6[_0x7cbb('0x1e')]=qs[_0x7cbb('0x1e')](_0x51a56a[_0x7cbb('0x32')][_0x7cbb('0x1e')]);}_0x126bc6[_0x7cbb('0x3b')]=qs[_0x7cbb('0x3c')](_0x51a56a['query'][_0x7cbb('0x3c')]);delete _0x51a56a[_0x7cbb('0x32')]['sort'];_0x126bc6['where']=qs[_0x7cbb('0x34')](_[_0x7cbb('0x3d')](_0x51a56a[_0x7cbb('0x32')],_0xb9b42e[_0x7cbb('0x34')]),_0xcd0585);if(_0x51a56a['query'][_0x7cbb('0x3e')]){_0x126bc6[_0x7cbb('0x3f')]=_[_0x7cbb('0x40')](_0x126bc6[_0x7cbb('0x3f')],{'$or':_[_0x7cbb('0x2c')](_0xcd0585,function(_0x4f6829){if(_0x4f6829[_0x7cbb('0x2f')]!==_0x7cbb('0x41')){var _0x1af6bd={};_0x1af6bd[_0x4f6829[_0x7cbb('0x2a')]]={'$like':'%'+_0x51a56a[_0x7cbb('0x32')][_0x7cbb('0x3e')]+'%'};return _0x1af6bd;}})});}_0x126bc6=_[_0x7cbb('0x40')]({},_0x126bc6,_0x51a56a[_0x7cbb('0x42')]);var _0x4fee0a={'where':_0x126bc6[_0x7cbb('0x3f')]};return db[_0x7cbb('0x2d')][_0x7cbb('0x1d')](_0x4fee0a)[_0x7cbb('0x25')](function(_0x5454e2){_0x20272c[_0x7cbb('0x1d')]=_0x5454e2;if(_0x51a56a['query'][_0x7cbb('0x43')]){_0x126bc6[_0x7cbb('0x44')]=[{'all':!![]}];}return db[_0x7cbb('0x2d')][_0x7cbb('0x45')](_0x126bc6);})['then'](function(_0x220b8a){_0x20272c[_0x7cbb('0x46')]=_0x220b8a;return _0x20272c;})[_0x7cbb('0x25')](respondWithFilteredResult(_0x158963,_0x126bc6))[_0x7cbb('0x47')](handleError(_0x158963,null));};exports[_0x7cbb('0x48')]=function(_0x2f7162,_0x179aec){var _0xb369ed={'raw':![],'where':{'id':_0x2f7162[_0x7cbb('0x49')]['id']}},_0x57453e={};_0x57453e[_0x7cbb('0x31')]=_['keys'](db[_0x7cbb('0x2d')][_0x7cbb('0x4a')]);_0x57453e[_0x7cbb('0x32')]=_[_0x7cbb('0x33')](_0x2f7162[_0x7cbb('0x32')]);_0x57453e['filters']=_[_0x7cbb('0x35')](_0x57453e[_0x7cbb('0x31')],_0x57453e[_0x7cbb('0x32')]);_0xb369ed[_0x7cbb('0x37')]=_[_0x7cbb('0x35')](_0x57453e[_0x7cbb('0x31')],qs[_0x7cbb('0x36')](_0x2f7162[_0x7cbb('0x32')]['fields']));_0xb369ed[_0x7cbb('0x37')]=_0xb369ed[_0x7cbb('0x37')]['length']?_0xb369ed[_0x7cbb('0x37')]:_0x57453e[_0x7cbb('0x31')];if(_0x2f7162['query'][_0x7cbb('0x43')]){_0xb369ed[_0x7cbb('0x44')]=[{'all':!![]}];}_0xb369ed=_[_0x7cbb('0x40')]({},_0xb369ed,_0x2f7162['options']);return db[_0x7cbb('0x2d')][_0x7cbb('0x4b')](_0xb369ed)[_0x7cbb('0x25')](handleEntityNotFound(_0x179aec,null))['then'](respondWithResult(_0x179aec,null))[_0x7cbb('0x47')](handleError(_0x179aec,null));};exports[_0x7cbb('0x23')]=function(_0x8a9fb6,_0x4f5952){if(_0x8a9fb6['body']['id']){delete _0x8a9fb6[_0x7cbb('0x4c')]['id'];}return db[_0x7cbb('0x2d')][_0x7cbb('0x4b')]({'where':{'id':_0x8a9fb6[_0x7cbb('0x49')]['id']}})[_0x7cbb('0x25')](handleEntityNotFound(_0x4f5952,null))['then'](saveUpdates(_0x8a9fb6[_0x7cbb('0x4c')],null))[_0x7cbb('0x25')](respondWithResult(_0x4f5952,null))[_0x7cbb('0x47')](handleError(_0x4f5952,null));};exports[_0x7cbb('0x4d')]=function(_0x474c1c,_0x3d3535,_0x567a85){return db[_0x7cbb('0x4e')][_0x7cbb('0x4f')](function(_0x20c68c){if(_0x474c1c[_0x7cbb('0x4c')][_0x7cbb('0x50')]===_0x7cbb('0x51')){_0x474c1c[_0x7cbb('0x4c')][_0x7cbb('0x52')]=path[_0x7cbb('0x53')](config[_0x7cbb('0x54')],_0x7cbb('0x55'),_0x474c1c[_0x7cbb('0x4c')][_0x7cbb('0x2a')]);}return db[_0x7cbb('0x2d')][_0x7cbb('0x4d')](_0x474c1c[_0x7cbb('0x4c')],{'transaction':_0x20c68c})[_0x7cbb('0x25')](function(_0xeb4309){if(_0x474c1c[_0x7cbb('0x4c')]['mode']===_0x7cbb('0x51')){fs[_0x7cbb('0x56')](_0xeb4309[_0x7cbb('0x52')],parseInt('0777',0x8));}var _0x198afb=_0x474c1c[_0x7cbb('0x57')][_0x7cbb('0x26')]({'plain':!![]});if(!_0x198afb)throw new Error(_0x7cbb('0x58'));if(_0x198afb[_0x7cbb('0x59')]===_0x7cbb('0x57')){var _0x5b356a=_0xeb4309['get']({'plain':!![]});return db[_0x7cbb('0x5a')]['find']({'where':{'name':_0x7cbb('0x27'),'userProfileId':_0x198afb['userProfileId']},'raw':!![]})['then'](function(_0x50c317){if(_0x50c317&&_0x50c317[_0x7cbb('0x5b')]===0x0){return db[_0x7cbb('0x28')][_0x7cbb('0x4d')]({'name':_0x5b356a[_0x7cbb('0x2a')],'resourceId':_0x5b356a['id'],'type':_0x50c317[_0x7cbb('0x2a')],'sectionId':_0x50c317['id']},{})['then'](function(){return _0xeb4309;});}else{return _0xeb4309;}})['catch'](function(_0x37c14a){logger[_0x7cbb('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37c14a);});}return _0xeb4309;});})[_0x7cbb('0x25')](respondWithResult(_0x3d3535,0xc9))['catch'](handleError(_0x3d3535,null));};exports[_0x7cbb('0x24')]=function(_0x42c80c,_0x4dc8e3,_0x589811){var _0x462124;return db[_0x7cbb('0x2d')]['find']({'where':{'id':_0x42c80c[_0x7cbb('0x49')]['id']}})[_0x7cbb('0x25')](function(_0x3eab9b){if(_0x3eab9b){return db[_0x7cbb('0x4e')]['transaction'](function(_0x156b95){return _0x3eab9b[_0x7cbb('0x24')]({'transaction':_0x156b95,'raw':!![]})[_0x7cbb('0x25')](function(_0x291a16){if(_0x291a16['directory']){fs[_0x7cbb('0x5c')](_0x291a16['directory'])[_0x7cbb('0x5d')](function(_0x10b011){fs[_0x7cbb('0x5e')](path[_0x7cbb('0x53')](_0x291a16['directory'],_0x10b011));});fs['rmdirSync'](_0x291a16['directory']);}return _0x291a16;});})[_0x7cbb('0x47')](function(_0x48f911){throw new db['Sequelize'][(_0x7cbb('0x5f'))](_0x48f911[_0x7cbb('0x60')]);});}})[_0x7cbb('0x25')](handleEntityNotFound(_0x4dc8e3,null))[_0x7cbb('0x25')](removeEntity(_0x4dc8e3,null))[_0x7cbb('0x47')](handleError(_0x4dc8e3,null));};exports[_0x7cbb('0x61')]=function(_0x54c1a6,_0xaa02,_0x10d8b4){return db[_0x7cbb('0x4e')][_0x7cbb('0x4f')](function(_0x53c357){var _0x5b1c52;return db[_0x7cbb('0x2d')][_0x7cbb('0x4b')]({'where':{'id':_0x54c1a6['params']['id']}})[_0x7cbb('0x25')](function(_0x2b916e){if(_0x2b916e){_0x5b1c52=_0x2b916e;return _0x2b916e[_0x7cbb('0x61')](_0x54c1a6[_0x7cbb('0x4c')]['id'],{'transaction':_0x53c357});}})[_0x7cbb('0x25')](function(_0x4d29f9){if(_0x4d29f9){return db['Sound']['findOne']({'where':{'id':_0x54c1a6[_0x7cbb('0x4c')]['id']},'attributes':['id',_0x7cbb('0x2a'),'save_name',_0x7cbb('0x62'),_0x7cbb('0x63')],'raw':!![]});}})[_0x7cbb('0x25')](function(_0x411634){if(_0x411634){var _0xce0d24=path[_0x7cbb('0x53')](config[_0x7cbb('0x54')],_0x7cbb('0x64'),util['format'](_0x7cbb('0x65'),path[_0x7cbb('0x66')](_0x411634[_0x7cbb('0x67')],path[_0x7cbb('0x68')](_0x411634[_0x7cbb('0x67')])),_0x411634['converted_format']));var _0xabfdf6=path[_0x7cbb('0x53')](config[_0x7cbb('0x54')],'server/files/moh',_0x5b1c52[_0x7cbb('0x2a')],util[_0x7cbb('0x69')](_0x7cbb('0x65'),_0x411634[_0x7cbb('0x2a')],_0x411634[_0x7cbb('0x62')]));fs[_0x7cbb('0x6a')](_0xce0d24,_0xabfdf6);return _0x411634;}})[_0x7cbb('0x47')](function(_0xf7d6c6){throw new db[(_0x7cbb('0x6b'))][(_0x7cbb('0x5f'))](_0xf7d6c6[_0x7cbb('0x60')]);});})[_0x7cbb('0x25')](handleEntityNotFound(_0xaa02,null))[_0x7cbb('0x25')](respondWithResult(_0xaa02,0xc9))[_0x7cbb('0x47')](handleError(_0xaa02,null));};exports[_0x7cbb('0x6c')]=function(_0x518a5b,_0xad49f5,_0x45f5cf){return db['sequelize']['transaction'](function(_0x27170a){var _0x158218;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x518a5b['params']['id']}})[_0x7cbb('0x25')](handleEntityNotFound(_0xad49f5,null))[_0x7cbb('0x25')](function(_0x518c5b){if(_0x518c5b){_0x158218=_0x518c5b;return _0x518c5b[_0x7cbb('0x6c')](_0x518a5b['params'][_0x7cbb('0x6d')]);}})[_0x7cbb('0x25')](function(_0x182658){if(_0x182658){return db[_0x7cbb('0x6e')]['findOne']({'where':{'id':_0x518a5b[_0x7cbb('0x49')]['id2']},'attributes':['id',_0x7cbb('0x2a'),_0x7cbb('0x67'),_0x7cbb('0x62'),_0x7cbb('0x63')],'raw':!![]});}})[_0x7cbb('0x25')](function(_0x176d33){if(_0x176d33){fs[_0x7cbb('0x5e')](path[_0x7cbb('0x53')](_0x158218[_0x7cbb('0x52')],util[_0x7cbb('0x69')](_0x7cbb('0x65'),_0x176d33['name'],_0x176d33[_0x7cbb('0x62')])));return _0x176d33;}})[_0x7cbb('0x47')](function(_0x38c285){throw new db['Sequelize'][(_0x7cbb('0x5f'))](_0x38c285['message']);});})[_0x7cbb('0x25')](handleEntityNotFound(_0xad49f5,null))[_0x7cbb('0x25')](respondWithStatusCode(_0xad49f5,0xcc))[_0x7cbb('0x47')](handleError(_0xad49f5,null));};exports[_0x7cbb('0x6f')]=function(_0x200a6c,_0x2b3870,_0x44020e){var _0x516eee={};var _0x8b7d19={};var _0x31f728;var _0x32b8fb;return db[_0x7cbb('0x2d')][_0x7cbb('0x70')]({'where':{'id':_0x200a6c[_0x7cbb('0x49')]['id']}})['then'](handleEntityNotFound(_0x2b3870,null))[_0x7cbb('0x25')](function(_0x4f5794){if(_0x4f5794){_0x31f728=_0x4f5794;_0x8b7d19[_0x7cbb('0x31')]=_['keys'](db[_0x7cbb('0x6e')][_0x7cbb('0x4a')]);_0x8b7d19[_0x7cbb('0x32')]=_[_0x7cbb('0x33')](_0x200a6c[_0x7cbb('0x32')]);_0x8b7d19[_0x7cbb('0x34')]=_[_0x7cbb('0x35')](_0x8b7d19['model'],_0x8b7d19[_0x7cbb('0x32')]);_0x516eee['attributes']=_[_0x7cbb('0x35')](_0x8b7d19[_0x7cbb('0x31')],qs[_0x7cbb('0x36')](_0x200a6c[_0x7cbb('0x32')][_0x7cbb('0x36')]));_0x516eee[_0x7cbb('0x37')]=_0x516eee['attributes'][_0x7cbb('0x38')]?_0x516eee['attributes']:_0x8b7d19['model'];_0x516eee[_0x7cbb('0x3b')]=qs['sort'](_0x200a6c[_0x7cbb('0x32')][_0x7cbb('0x3c')]);_0x516eee[_0x7cbb('0x3f')]=qs[_0x7cbb('0x34')](_[_0x7cbb('0x3d')](_0x200a6c[_0x7cbb('0x32')],_0x8b7d19[_0x7cbb('0x34')]));if(_0x200a6c[_0x7cbb('0x32')][_0x7cbb('0x3e')]){_0x516eee[_0x7cbb('0x3f')]=_[_0x7cbb('0x40')](_0x516eee[_0x7cbb('0x3f')],{'$or':_[_0x7cbb('0x2c')](_0x516eee[_0x7cbb('0x37')],function(_0x17379d){var _0x44fa3={};_0x44fa3[_0x17379d]={'$like':'%'+_0x200a6c[_0x7cbb('0x32')][_0x7cbb('0x3e')]+'%'};return _0x44fa3;})});}_0x516eee=_[_0x7cbb('0x40')]({},_0x516eee,_0x200a6c[_0x7cbb('0x42')]);return _0x31f728['getSounds'](_0x516eee);}})[_0x7cbb('0x25')](function(_0x42190d){if(_0x42190d){_0x32b8fb=_0x42190d[_0x7cbb('0x38')];if(!_0x200a6c['query']['hasOwnProperty'](_0x7cbb('0x3a'))){_0x516eee[_0x7cbb('0x1b')]=qs[_0x7cbb('0x1b')](_0x200a6c[_0x7cbb('0x32')][_0x7cbb('0x1b')]);_0x516eee[_0x7cbb('0x1e')]=qs[_0x7cbb('0x1e')](_0x200a6c[_0x7cbb('0x32')][_0x7cbb('0x1e')]);}return _0x31f728[_0x7cbb('0x6f')](_0x516eee);}})['then'](function(_0x15db9d){if(_0x15db9d){return _0x15db9d?{'count':_0x32b8fb,'rows':_0x15db9d}:null;}})[_0x7cbb('0x25')](respondWithResult(_0x2b3870,null))[_0x7cbb('0x47')](handleError(_0x2b3870,null));}; \ No newline at end of file +var _0xf60a=['bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','reject','save','then','destroy','UserProfileResource','error','stack','name','send','index','VoiceMusicOnHold','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','include','options','find','update','body','create','sequelize','transaction','mode','files','directory','join','root','server/files/moh','mkdirSync','0777','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MusicOnHolds','autoAssociation','readdirSync','forEach','unlinkSync','ValidationError','message','addSound','Sound','findOne','save_name','createdAt','server/files/sounds/converted','format','%s.%s','extname','converted_format','symlinkSync','Sequelize','removeSound','id2','rawAttributes','getSounds','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x26721d,_0x448ba5){var _0x1035c5=function(_0x1c1b86){while(--_0x1c1b86){_0x26721d['push'](_0x26721d['shift']());}};_0x1035c5(++_0x448ba5);}(_0xf60a,0xe8));var _0xaf60=function(_0x2d84fb,_0xe90436){_0x2d84fb=_0x2d84fb-0x0;var _0x5ae6ff=_0xf60a[_0x2d84fb];return _0x5ae6ff;};'use strict';var emlformat=require(_0xaf60('0x0'));var rimraf=require(_0xaf60('0x1'));var zipdir=require(_0xaf60('0x2'));var jsonpatch=require(_0xaf60('0x3'));var rp=require(_0xaf60('0x4'));var moment=require(_0xaf60('0x5'));var BPromise=require(_0xaf60('0x6'));var Mustache=require(_0xaf60('0x7'));var util=require(_0xaf60('0x8'));var path=require(_0xaf60('0x9'));var sox=require('sox');var csv=require(_0xaf60('0xa'));var ejs=require(_0xaf60('0xb'));var fs=require('fs');var fs_extra=require(_0xaf60('0xc'));var _=require(_0xaf60('0xd'));var squel=require(_0xaf60('0xe'));var crypto=require(_0xaf60('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xaf60('0x10'));var toCsv=require(_0xaf60('0xa'));var querystring=require(_0xaf60('0x11'));var Papa=require(_0xaf60('0x12'));var Redis=require(_0xaf60('0x13'));var authService=require(_0xaf60('0x14'));var qs=require(_0xaf60('0x15'));var as=require(_0xaf60('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaf60('0x17'))(_0xaf60('0x18'));var utils=require(_0xaf60('0x19'));var config=require(_0xaf60('0x1a'));var licenseUtil=require(_0xaf60('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52312e,_0x5d4d79){_0x5d4d79=_0x5d4d79||0xcc;return function(_0x451a41){if(_0x451a41){return _0x52312e[_0xaf60('0x1c')](_0x5d4d79);}return _0x52312e[_0xaf60('0x1d')](_0x5d4d79)[_0xaf60('0x1e')]();};}function respondWithResult(_0x4e92b1,_0x19d866){_0x19d866=_0x19d866||0xc8;return function(_0x5e5f84){if(_0x5e5f84){return _0x4e92b1[_0xaf60('0x1d')](_0x19d866)[_0xaf60('0x1f')](_0x5e5f84);}};}function respondWithFilteredResult(_0x35bfb2,_0x356f08){return function(_0x293888){if(_0x293888){var _0x377f84=typeof _0x356f08[_0xaf60('0x20')]==='undefined'&&typeof _0x356f08[_0xaf60('0x21')]==='undefined';var _0x354968=_0x293888['count'];var _0x430ea8=_0x377f84?0x0:_0x356f08[_0xaf60('0x20')];var _0x143df6=_0x377f84?_0x293888[_0xaf60('0x22')]:_0x356f08['offset']+_0x356f08['limit'];var _0x55003c;if(_0x143df6>=_0x354968){_0x143df6=_0x354968;_0x55003c=0xc8;}else{_0x55003c=0xce;}_0x35bfb2[_0xaf60('0x1d')](_0x55003c);return _0x35bfb2['set'](_0xaf60('0x23'),_0x430ea8+'-'+_0x143df6+'/'+_0x354968)[_0xaf60('0x1f')](_0x293888);}return null;};}function patchUpdates(_0x50b802){return function(_0x41ef33){try{jsonpatch[_0xaf60('0x24')](_0x41ef33,_0x50b802,!![]);}catch(_0x45c3b0){return BPromise[_0xaf60('0x25')](_0x45c3b0);}return _0x41ef33[_0xaf60('0x26')]();};}function saveUpdates(_0x234133,_0xd89fe0){return function(_0xdf71c3){if(_0xdf71c3){return _0xdf71c3['update'](_0x234133)[_0xaf60('0x27')](function(_0x568ff5){return _0x568ff5;});}return null;};}function removeEntity(_0x27fa25,_0x147376){return function(_0x4f177c){if(_0x4f177c){return _0x4f177c[_0xaf60('0x28')]()['then'](function(){var _0x223611=_0x4f177c['get']({'plain':!![]});var _0x1d8465='MusicOnHolds';return db[_0xaf60('0x29')][_0xaf60('0x28')]({'where':{'type':_0x1d8465,'resourceId':_0x223611['id']}})['then'](function(){return _0x4f177c;});})['then'](function(){_0x27fa25[_0xaf60('0x1d')](0xcc)[_0xaf60('0x1e')]();});}};}function handleEntityNotFound(_0x5b9f4f,_0x4f5c12){return function(_0x3d36bf){if(!_0x3d36bf){_0x5b9f4f[_0xaf60('0x1c')](0x194);}return _0x3d36bf;};}function handleError(_0x2b669e,_0x54239e){_0x54239e=_0x54239e||0x1f4;return function(_0x344c0e){logger[_0xaf60('0x2a')](_0x344c0e[_0xaf60('0x2b')]);if(_0x344c0e[_0xaf60('0x2c')]){delete _0x344c0e[_0xaf60('0x2c')];}_0x2b669e[_0xaf60('0x1d')](_0x54239e)[_0xaf60('0x2d')](_0x344c0e);};}exports[_0xaf60('0x2e')]=function(_0x55587b,_0x415ccb){var _0x87f86a={},_0x523284={},_0x3f5082={'count':0x0,'rows':[]};var _0x1630bd=_['map'](db[_0xaf60('0x2f')]['rawAttributes'],function(_0x37edd1){return{'name':_0x37edd1[_0xaf60('0x30')],'type':_0x37edd1[_0xaf60('0x31')][_0xaf60('0x32')]};});_0x523284[_0xaf60('0x33')]=_[_0xaf60('0x34')](_0x1630bd,_0xaf60('0x2c'));_0x523284['query']=_[_0xaf60('0x35')](_0x55587b[_0xaf60('0x36')]);_0x523284[_0xaf60('0x37')]=_[_0xaf60('0x38')](_0x523284[_0xaf60('0x33')],_0x523284[_0xaf60('0x36')]);_0x87f86a[_0xaf60('0x39')]=_[_0xaf60('0x38')](_0x523284[_0xaf60('0x33')],qs[_0xaf60('0x3a')](_0x55587b[_0xaf60('0x36')][_0xaf60('0x3a')]));_0x87f86a[_0xaf60('0x39')]=_0x87f86a[_0xaf60('0x39')][_0xaf60('0x3b')]?_0x87f86a[_0xaf60('0x39')]:_0x523284['model'];if(!_0x55587b['query'][_0xaf60('0x3c')](_0xaf60('0x3d'))){_0x87f86a[_0xaf60('0x21')]=qs['limit'](_0x55587b['query'][_0xaf60('0x21')]);_0x87f86a[_0xaf60('0x20')]=qs[_0xaf60('0x20')](_0x55587b[_0xaf60('0x36')][_0xaf60('0x20')]);}_0x87f86a[_0xaf60('0x3e')]=qs[_0xaf60('0x3f')](_0x55587b[_0xaf60('0x36')][_0xaf60('0x3f')]);delete _0x55587b[_0xaf60('0x36')][_0xaf60('0x3f')];_0x87f86a[_0xaf60('0x40')]=qs[_0xaf60('0x37')](_[_0xaf60('0x41')](_0x55587b['query'],_0x523284['filters']),_0x1630bd);if(_0x55587b['query']['filter']){_0x87f86a[_0xaf60('0x40')]=_[_0xaf60('0x42')](_0x87f86a[_0xaf60('0x40')],{'$or':_[_0xaf60('0x34')](_0x1630bd,function(_0x18450c){if(_0x18450c[_0xaf60('0x31')]!==_0xaf60('0x43')){var _0x5b4c89={};_0x5b4c89[_0x18450c[_0xaf60('0x2c')]]={'$like':'%'+_0x55587b['query'][_0xaf60('0x44')]+'%'};return _0x5b4c89;}})});}_0x87f86a=_['merge']({},_0x87f86a,_0x55587b['options']);var _0x408df1={'where':_0x87f86a[_0xaf60('0x40')]};return db[_0xaf60('0x2f')][_0xaf60('0x22')](_0x408df1)[_0xaf60('0x27')](function(_0x3120d5){_0x3f5082[_0xaf60('0x22')]=_0x3120d5;if(_0x55587b['query'][_0xaf60('0x45')]){_0x87f86a['include']=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xaf60('0x46')](_0x87f86a);})[_0xaf60('0x27')](function(_0x12a6d2){_0x3f5082[_0xaf60('0x47')]=_0x12a6d2;return _0x3f5082;})[_0xaf60('0x27')](respondWithFilteredResult(_0x415ccb,_0x87f86a))[_0xaf60('0x48')](handleError(_0x415ccb,null));};exports[_0xaf60('0x49')]=function(_0xd37f89,_0x172b90){var _0x461f2a={'raw':![],'where':{'id':_0xd37f89[_0xaf60('0x4a')]['id']}},_0x38ef7c={};_0x38ef7c[_0xaf60('0x33')]=_['keys'](db[_0xaf60('0x2f')]['rawAttributes']);_0x38ef7c[_0xaf60('0x36')]=_['keys'](_0xd37f89[_0xaf60('0x36')]);_0x38ef7c[_0xaf60('0x37')]=_[_0xaf60('0x38')](_0x38ef7c[_0xaf60('0x33')],_0x38ef7c[_0xaf60('0x36')]);_0x461f2a[_0xaf60('0x39')]=_[_0xaf60('0x38')](_0x38ef7c[_0xaf60('0x33')],qs[_0xaf60('0x3a')](_0xd37f89['query'][_0xaf60('0x3a')]));_0x461f2a[_0xaf60('0x39')]=_0x461f2a[_0xaf60('0x39')][_0xaf60('0x3b')]?_0x461f2a[_0xaf60('0x39')]:_0x38ef7c[_0xaf60('0x33')];if(_0xd37f89['query'][_0xaf60('0x45')]){_0x461f2a[_0xaf60('0x4b')]=[{'all':!![]}];}_0x461f2a=_[_0xaf60('0x42')]({},_0x461f2a,_0xd37f89[_0xaf60('0x4c')]);return db[_0xaf60('0x2f')][_0xaf60('0x4d')](_0x461f2a)['then'](handleEntityNotFound(_0x172b90,null))[_0xaf60('0x27')](respondWithResult(_0x172b90,null))[_0xaf60('0x48')](handleError(_0x172b90,null));};exports[_0xaf60('0x4e')]=function(_0x57424e,_0x5ed244){if(_0x57424e[_0xaf60('0x4f')]['id']){delete _0x57424e['body']['id'];}return db[_0xaf60('0x2f')][_0xaf60('0x4d')]({'where':{'id':_0x57424e[_0xaf60('0x4a')]['id']}})[_0xaf60('0x27')](handleEntityNotFound(_0x5ed244,null))['then'](saveUpdates(_0x57424e[_0xaf60('0x4f')],null))[_0xaf60('0x27')](respondWithResult(_0x5ed244,null))[_0xaf60('0x48')](handleError(_0x5ed244,null));};exports[_0xaf60('0x50')]=function(_0x392919,_0x3bed2f,_0x2ae86c){return db[_0xaf60('0x51')][_0xaf60('0x52')](function(_0x46d9a1){if(_0x392919['body'][_0xaf60('0x53')]===_0xaf60('0x54')){_0x392919[_0xaf60('0x4f')][_0xaf60('0x55')]=path[_0xaf60('0x56')](config[_0xaf60('0x57')],_0xaf60('0x58'),_0x392919[_0xaf60('0x4f')][_0xaf60('0x2c')]);}return db[_0xaf60('0x2f')]['create'](_0x392919[_0xaf60('0x4f')],{'transaction':_0x46d9a1})['then'](function(_0x50cf63){if(_0x392919[_0xaf60('0x4f')][_0xaf60('0x53')]===_0xaf60('0x54')){fs[_0xaf60('0x59')](_0x50cf63[_0xaf60('0x55')],parseInt(_0xaf60('0x5a'),0x8));}var _0x399cc7=_0x392919[_0xaf60('0x5b')][_0xaf60('0x5c')]({'plain':!![]});if(!_0x399cc7)throw new Error(_0xaf60('0x5d'));if(_0x399cc7[_0xaf60('0x5e')]===_0xaf60('0x5b')){var _0x5afda9=_0x50cf63[_0xaf60('0x5c')]({'plain':!![]});return db[_0xaf60('0x5f')][_0xaf60('0x4d')]({'where':{'name':_0xaf60('0x60'),'userProfileId':_0x399cc7['userProfileId']},'raw':!![]})[_0xaf60('0x27')](function(_0xd7d5eb){if(_0xd7d5eb&&_0xd7d5eb[_0xaf60('0x61')]===0x0){return db['UserProfileResource'][_0xaf60('0x50')]({'name':_0x5afda9[_0xaf60('0x2c')],'resourceId':_0x5afda9['id'],'type':_0xd7d5eb[_0xaf60('0x2c')],'sectionId':_0xd7d5eb['id']},{})[_0xaf60('0x27')](function(){return _0x50cf63;});}else{return _0x50cf63;}})[_0xaf60('0x48')](function(_0x21a229){logger[_0xaf60('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x21a229);});}return _0x50cf63;});})['then'](respondWithResult(_0x3bed2f,0xc9))[_0xaf60('0x48')](handleError(_0x3bed2f,null));};exports[_0xaf60('0x28')]=function(_0x485af4,_0x4b19e6,_0x5af6f2){var _0x59a7b9;return db[_0xaf60('0x2f')][_0xaf60('0x4d')]({'where':{'id':_0x485af4[_0xaf60('0x4a')]['id']}})[_0xaf60('0x27')](function(_0x5e8f3a){if(_0x5e8f3a){return db[_0xaf60('0x51')]['transaction'](function(_0x5605ef){return _0x5e8f3a[_0xaf60('0x28')]({'transaction':_0x5605ef,'raw':!![]})[_0xaf60('0x27')](function(_0x3c4b31){if(_0x3c4b31[_0xaf60('0x55')]){fs[_0xaf60('0x62')](_0x3c4b31[_0xaf60('0x55')])[_0xaf60('0x63')](function(_0x529edc){fs[_0xaf60('0x64')](path[_0xaf60('0x56')](_0x3c4b31[_0xaf60('0x55')],_0x529edc));});fs['rmdirSync'](_0x3c4b31[_0xaf60('0x55')]);}return _0x3c4b31;});})[_0xaf60('0x48')](function(_0x16ea2f){throw new db['Sequelize'][(_0xaf60('0x65'))](_0x16ea2f[_0xaf60('0x66')]);});}})[_0xaf60('0x27')](handleEntityNotFound(_0x4b19e6,null))['then'](removeEntity(_0x4b19e6,null))[_0xaf60('0x48')](handleError(_0x4b19e6,null));};exports['addSound']=function(_0x59cb04,_0x1a2923,_0x984a1e){return db[_0xaf60('0x51')]['transaction'](function(_0xf689ef){var _0x989daa;return db['VoiceMusicOnHold'][_0xaf60('0x4d')]({'where':{'id':_0x59cb04['params']['id']}})[_0xaf60('0x27')](function(_0x888ff1){if(_0x888ff1){_0x989daa=_0x888ff1;return _0x888ff1[_0xaf60('0x67')](_0x59cb04[_0xaf60('0x4f')]['id'],{'transaction':_0xf689ef});}})[_0xaf60('0x27')](function(_0x419b24){if(_0x419b24){return db[_0xaf60('0x68')][_0xaf60('0x69')]({'where':{'id':_0x59cb04['body']['id']},'attributes':['id',_0xaf60('0x2c'),_0xaf60('0x6a'),'converted_format',_0xaf60('0x6b')],'raw':!![]});}})[_0xaf60('0x27')](function(_0x29b342){if(_0x29b342){var _0x3688fc=path[_0xaf60('0x56')](config[_0xaf60('0x57')],_0xaf60('0x6c'),util[_0xaf60('0x6d')](_0xaf60('0x6e'),path['basename'](_0x29b342[_0xaf60('0x6a')],path[_0xaf60('0x6f')](_0x29b342[_0xaf60('0x6a')])),_0x29b342[_0xaf60('0x70')]));var _0x1f6785=path[_0xaf60('0x56')](config[_0xaf60('0x57')],_0xaf60('0x58'),_0x989daa[_0xaf60('0x2c')],util[_0xaf60('0x6d')](_0xaf60('0x6e'),_0x29b342[_0xaf60('0x2c')],_0x29b342['converted_format']));fs[_0xaf60('0x71')](_0x3688fc,_0x1f6785);return _0x29b342;}})[_0xaf60('0x48')](function(_0x40eace){throw new db[(_0xaf60('0x72'))][(_0xaf60('0x65'))](_0x40eace[_0xaf60('0x66')]);});})[_0xaf60('0x27')](handleEntityNotFound(_0x1a2923,null))[_0xaf60('0x27')](respondWithResult(_0x1a2923,0xc9))['catch'](handleError(_0x1a2923,null));};exports[_0xaf60('0x73')]=function(_0x39d53a,_0x1e9551,_0x1f6228){return db[_0xaf60('0x51')][_0xaf60('0x52')](function(_0x46ef41){var _0x26551;return db[_0xaf60('0x2f')][_0xaf60('0x69')]({'where':{'id':_0x39d53a[_0xaf60('0x4a')]['id']}})[_0xaf60('0x27')](handleEntityNotFound(_0x1e9551,null))[_0xaf60('0x27')](function(_0x305db0){if(_0x305db0){_0x26551=_0x305db0;return _0x305db0[_0xaf60('0x73')](_0x39d53a[_0xaf60('0x4a')][_0xaf60('0x74')]);}})[_0xaf60('0x27')](function(_0x2431e9){if(_0x2431e9){return db[_0xaf60('0x68')][_0xaf60('0x69')]({'where':{'id':_0x39d53a[_0xaf60('0x4a')][_0xaf60('0x74')]},'attributes':['id',_0xaf60('0x2c'),_0xaf60('0x6a'),'converted_format',_0xaf60('0x6b')],'raw':!![]});}})['then'](function(_0x3b7397){if(_0x3b7397){fs[_0xaf60('0x64')](path[_0xaf60('0x56')](_0x26551[_0xaf60('0x55')],util['format']('%s.%s',_0x3b7397[_0xaf60('0x2c')],_0x3b7397[_0xaf60('0x70')])));return _0x3b7397;}})['catch'](function(_0x526f75){throw new db[(_0xaf60('0x72'))][(_0xaf60('0x65'))](_0x526f75[_0xaf60('0x66')]);});})[_0xaf60('0x27')](handleEntityNotFound(_0x1e9551,null))[_0xaf60('0x27')](respondWithStatusCode(_0x1e9551,0xcc))[_0xaf60('0x48')](handleError(_0x1e9551,null));};exports['getSounds']=function(_0x4f4d8f,_0x1bb9cc,_0xfbbdf){var _0x2847e4={};var _0x9d36b1={};var _0x5c8926;var _0x2a3cb3;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x4f4d8f['params']['id']}})['then'](handleEntityNotFound(_0x1bb9cc,null))[_0xaf60('0x27')](function(_0x34a8b1){if(_0x34a8b1){_0x5c8926=_0x34a8b1;_0x9d36b1['model']=_[_0xaf60('0x35')](db[_0xaf60('0x68')][_0xaf60('0x75')]);_0x9d36b1[_0xaf60('0x36')]=_['keys'](_0x4f4d8f[_0xaf60('0x36')]);_0x9d36b1[_0xaf60('0x37')]=_[_0xaf60('0x38')](_0x9d36b1[_0xaf60('0x33')],_0x9d36b1[_0xaf60('0x36')]);_0x2847e4[_0xaf60('0x39')]=_['intersection'](_0x9d36b1[_0xaf60('0x33')],qs[_0xaf60('0x3a')](_0x4f4d8f[_0xaf60('0x36')][_0xaf60('0x3a')]));_0x2847e4[_0xaf60('0x39')]=_0x2847e4['attributes'][_0xaf60('0x3b')]?_0x2847e4[_0xaf60('0x39')]:_0x9d36b1[_0xaf60('0x33')];_0x2847e4[_0xaf60('0x3e')]=qs[_0xaf60('0x3f')](_0x4f4d8f['query'][_0xaf60('0x3f')]);_0x2847e4[_0xaf60('0x40')]=qs['filters'](_[_0xaf60('0x41')](_0x4f4d8f[_0xaf60('0x36')],_0x9d36b1[_0xaf60('0x37')]));if(_0x4f4d8f['query']['filter']){_0x2847e4[_0xaf60('0x40')]=_[_0xaf60('0x42')](_0x2847e4['where'],{'$or':_[_0xaf60('0x34')](_0x2847e4['attributes'],function(_0x56eb2b){var _0x35b34d={};_0x35b34d[_0x56eb2b]={'$like':'%'+_0x4f4d8f['query'][_0xaf60('0x44')]+'%'};return _0x35b34d;})});}_0x2847e4=_[_0xaf60('0x42')]({},_0x2847e4,_0x4f4d8f[_0xaf60('0x4c')]);return _0x5c8926[_0xaf60('0x76')](_0x2847e4);}})[_0xaf60('0x27')](function(_0x1ce216){if(_0x1ce216){_0x2a3cb3=_0x1ce216['length'];if(!_0x4f4d8f[_0xaf60('0x36')][_0xaf60('0x3c')]('nolimit')){_0x2847e4['limit']=qs[_0xaf60('0x21')](_0x4f4d8f[_0xaf60('0x36')][_0xaf60('0x21')]);_0x2847e4[_0xaf60('0x20')]=qs[_0xaf60('0x20')](_0x4f4d8f[_0xaf60('0x36')]['offset']);}return _0x5c8926['getSounds'](_0x2847e4);}})[_0xaf60('0x27')](function(_0x46eb5b){if(_0x46eb5b){return _0x46eb5b?{'count':_0x2a3cb3,'rows':_0x46eb5b}:null;}})[_0xaf60('0x27')](respondWithResult(_0x1bb9cc,null))[_0xaf60('0x48')](handleError(_0x1bb9cc,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 2b8b6f4..99326af 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 _0x380d=['bluebird','rimraf','../../config/environment','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x380d,0x165));var _0xd380=function(_0x205c4d,_0x3a2e6d){_0x205c4d=_0x205c4d-0x0;var _0x4a3e0e=_0x380d[_0x205c4d];return _0x4a3e0e;};'use strict';var _=require(_0xd380('0x0'));var util=require(_0xd380('0x1'));var logger=require(_0xd380('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd380('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd380('0x4'));var config=require(_0xd380('0x5'));var attributes=require('./voiceMusicOnHold.attributes');module[_0xd380('0x6')]=function(_0x301450,_0x189e11){return _0x301450[_0xd380('0x7')](_0xd380('0x8'),attributes,{'tableName':_0xd380('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x07b2=['moment','bluebird','path','../../config/environment','voice_musiconhold','lodash','util','../../config/logger','api'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x07b2,0x9e));var _0x207b=function(_0x3092be,_0x5c07d5){_0x3092be=_0x3092be-0x0;var _0x1d1119=_0x07b2[_0x3092be];return _0x1d1119;};'use strict';var _=require(_0x207b('0x0'));var util=require(_0x207b('0x1'));var logger=require(_0x207b('0x2'))(_0x207b('0x3'));var moment=require(_0x207b('0x4'));var BPromise=require(_0x207b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x207b('0x6'));var rimraf=require('rimraf');var config=require(_0x207b('0x7'));var attributes=require('./voiceMusicOnHold.attributes');module['exports']=function(_0x3bab98,_0x2cd013){return _0x3bab98['define']('VoiceMusicOnHold',attributes,{'tableName':_0x207b('0x8'),'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 6778145..8c3f9b6 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 _0xe706=['http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2a54ce,_0x3d6f76){var _0x4ed5fc=function(_0x1c2195){while(--_0x1c2195){_0x2a54ce['push'](_0x2a54ce['shift']());}};_0x4ed5fc(++_0x3d6f76);}(_0xe706,0xa3));var _0x6e70=function(_0xe6894,_0x5a1755){_0xe6894=_0xe6894-0x0;var _0x4e2ea7=_0xe706[_0xe6894];return _0x4e2ea7;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','VoiceMusicOnHold,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x24f05e,_0x4d08a9){var _0x5541ab=function(_0x2f2296){while(--_0x2f2296){_0x24f05e['push'](_0x24f05e['shift']());}};_0x5541ab(++_0x4d08a9);}(_0x9c44,0x178));var _0x49c4=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9c44[_0x1969a7];return _0x3d665f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 5d1d831..51d4c8a 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 _0xd4c6=['getAgents','create','post','/:id','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./voicePrefix.controller','get','isAuthenticated','index','describe','show','/:id/users'];(function(_0x31692c,_0x29ac68){var _0x1a15df=function(_0x11036f){while(--_0x11036f){_0x31692c['push'](_0x31692c['shift']());}};_0x1a15df(++_0x29ac68);}(_0xd4c6,0x195));var _0x6d4c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd4c6[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x6d4c('0x0'));var util=require(_0x6d4c('0x1'));var path=require(_0x6d4c('0x2'));var timeout=require(_0x6d4c('0x3'));var express=require(_0x6d4c('0x4'));var router=express[_0x6d4c('0x5')]();var fs_extra=require(_0x6d4c('0x6'));var auth=require(_0x6d4c('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6d4c('0x8'));router[_0x6d4c('0x9')]('/',auth[_0x6d4c('0xa')](),controller[_0x6d4c('0xb')]);router[_0x6d4c('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x6d4c('0xc')]);router[_0x6d4c('0x9')]('/:id',auth[_0x6d4c('0xa')](),controller[_0x6d4c('0xd')]);router[_0x6d4c('0x9')](_0x6d4c('0xe'),auth[_0x6d4c('0xa')](),controller[_0x6d4c('0xf')]);router['post']('/',auth[_0x6d4c('0xa')](),controller[_0x6d4c('0x10')]);router[_0x6d4c('0x11')](_0x6d4c('0xe'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x6d4c('0x12'),auth[_0x6d4c('0xa')](),controller[_0x6d4c('0x13')]);router['delete'](_0x6d4c('0x12'),auth[_0x6d4c('0xa')](),controller['destroy']);router[_0x6d4c('0x14')](_0x6d4c('0xe'),auth[_0x6d4c('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x8973=['describe','/:id','show','/:id/users','getAgents','create','post','addAgents','put','update','delete','destroy','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','get','isAuthenticated','index','/describe'];(function(_0x4c15e7,_0x4ad7f5){var _0x1f119a=function(_0x5b3da8){while(--_0x5b3da8){_0x4c15e7['push'](_0x4c15e7['shift']());}};_0x1f119a(++_0x4ad7f5);}(_0x8973,0xb0));var _0x3897=function(_0x22b86e,_0x4eece1){_0x22b86e=_0x22b86e-0x0;var _0x383cdb=_0x8973[_0x22b86e];return _0x383cdb;};'use strict';var multer=require(_0x3897('0x0'));var util=require('util');var path=require(_0x3897('0x1'));var timeout=require(_0x3897('0x2'));var express=require(_0x3897('0x3'));var router=express[_0x3897('0x4')]();var fs_extra=require(_0x3897('0x5'));var auth=require(_0x3897('0x6'));var interaction=require(_0x3897('0x7'));var config=require('../../config/environment');var controller=require(_0x3897('0x8'));router[_0x3897('0x9')]('/',auth[_0x3897('0xa')](),controller[_0x3897('0xb')]);router[_0x3897('0x9')](_0x3897('0xc'),auth[_0x3897('0xa')](),controller[_0x3897('0xd')]);router[_0x3897('0x9')](_0x3897('0xe'),auth[_0x3897('0xa')](),controller[_0x3897('0xf')]);router[_0x3897('0x9')](_0x3897('0x10'),auth[_0x3897('0xa')](),controller[_0x3897('0x11')]);router['post']('/',auth[_0x3897('0xa')](),controller[_0x3897('0x12')]);router[_0x3897('0x13')](_0x3897('0x10'),auth[_0x3897('0xa')](),controller[_0x3897('0x14')]);router[_0x3897('0x15')](_0x3897('0xe'),auth['isAuthenticated'](),controller[_0x3897('0x16')]);router[_0x3897('0x17')](_0x3897('0xe'),auth['isAuthenticated'](),controller[_0x3897('0x18')]);router[_0x3897('0x17')](_0x3897('0x10'),auth['isAuthenticated'](),controller[_0x3897('0x19')]);module[_0x3897('0x1a')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index f276623..dfe4e60 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 _0xccda=['VIRTUAL','system-','getDataValue','INTEGER','sequelize','exports','STRING','name'];(function(_0x348c13,_0xfd15db){var _0xe34d01=function(_0x248147){while(--_0x248147){_0x348c13['push'](_0x348c13['shift']());}};_0xe34d01(++_0xfd15db);}(_0xccda,0x18c));var _0xaccd=function(_0x5c6469,_0x54afe8){_0x5c6469=_0x5c6469-0x0;var _0x4a85d0=_0xccda[_0x5c6469];return _0x4a85d0;};'use strict';var Sequelize=require(_0xaccd('0x0'));module[_0xaccd('0x1')]={'name':{'type':Sequelize[_0xaccd('0x2')],'allowNull':![],'unique':_0xaccd('0x3')},'prefix':{'type':Sequelize[_0xaccd('0x4')],'get':function(_0x5ee7f6){return _0xaccd('0x5')+this[_0xaccd('0x6')](_0xaccd('0x3'))+'-';}},'description':{'type':Sequelize[_0xaccd('0x2')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0xaccd('0x7')]}}; \ No newline at end of file +var _0xbe3f=['VIRTUAL','system-','getDataValue','INTEGER','sequelize','STRING','name'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xbe3f,0x1e7));var _0xfbe3=function(_0x5c98f7,_0x15c303){_0x5c98f7=_0x5c98f7-0x0;var _0x3a185e=_0xbe3f[_0x5c98f7];return _0x3a185e;};'use strict';var Sequelize=require(_0xfbe3('0x0'));module['exports']={'name':{'type':Sequelize[_0xfbe3('0x1')],'allowNull':![],'unique':_0xfbe3('0x2')},'prefix':{'type':Sequelize[_0xfbe3('0x3')],'get':function(_0x453140){return _0xfbe3('0x4')+this[_0xfbe3('0x5')](_0xfbe3('0x2'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0xfbe3('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0xfbe3('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 471f94d..b2eb6c2 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 _0x30c7=['CDR(prefix)=','callerIdAll','Set','PREFIX-CALLERIDALL=','No\x20callerid\x20available','${EXTEN:','charAt','system-','transaction','update','addAgents','ids','omit','spread','userVoicePrefix:save','removeAgents','isArray','emit','userVoicePrefix:remove','findOne','User','getAgents','nolimit','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','then','VoicePrefixes','UserProfileResource','destroy','end','error','stack','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','find','describe','create','sequelize','body','VoiceExtension','VoiceExtensionId','get','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','system','description','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x30c7,0x111));var _0x730c=function(_0x3f37f1,_0x50041e){_0x3f37f1=_0x3f37f1-0x0;var _0x33472d=_0x30c7[_0x3f37f1];return _0x33472d;};'use strict';var emlformat=require(_0x730c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x730c('0x1'));var jsonpatch=require(_0x730c('0x2'));var rp=require(_0x730c('0x3'));var moment=require('moment');var BPromise=require(_0x730c('0x4'));var Mustache=require(_0x730c('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x730c('0x6'));var fs=require('fs');var fs_extra=require(_0x730c('0x7'));var _=require('lodash');var squel=require(_0x730c('0x8'));var crypto=require(_0x730c('0x9'));var jsforce=require(_0x730c('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x730c('0xb'));var querystring=require(_0x730c('0xc'));var Papa=require('papaparse');var Redis=require(_0x730c('0xd'));var authService=require(_0x730c('0xe'));var qs=require(_0x730c('0xf'));var as=require(_0x730c('0x10'));var hardwareService=require(_0x730c('0x11'));var logger=require(_0x730c('0x12'))(_0x730c('0x13'));var utils=require('../../config/utils');var config=require(_0x730c('0x14'));var licenseUtil=require(_0x730c('0x15'));var db=require(_0x730c('0x16'))['db'];config[_0x730c('0x17')]=_['defaults'](config[_0x730c('0x17')],{'host':_0x730c('0x18'),'port':0x18eb});var socket=require(_0x730c('0x19'))(new Redis(config[_0x730c('0x17')]));require(_0x730c('0x1a'))[_0x730c('0x1b')](socket);function respondWithStatusCode(_0x419b7b,_0x342f90){_0x342f90=_0x342f90||0xcc;return function(_0x1bb9d7){if(_0x1bb9d7){return _0x419b7b[_0x730c('0x1c')](_0x342f90);}return _0x419b7b[_0x730c('0x1d')](_0x342f90)['end']();};}function respondWithResult(_0x55e11c,_0x4f9f2c){_0x4f9f2c=_0x4f9f2c||0xc8;return function(_0x35f1bd){if(_0x35f1bd){return _0x55e11c[_0x730c('0x1d')](_0x4f9f2c)[_0x730c('0x1e')](_0x35f1bd);}};}function respondWithFilteredResult(_0xa7a352,_0x5800d7){return function(_0x3b3fda){if(_0x3b3fda){var _0x39a2be=typeof _0x5800d7[_0x730c('0x1f')]===_0x730c('0x20')&&typeof _0x5800d7[_0x730c('0x21')]===_0x730c('0x20');var _0x2fe217=_0x3b3fda[_0x730c('0x22')];var _0x1349c3=_0x39a2be?0x0:_0x5800d7[_0x730c('0x1f')];var _0x5e9806=_0x39a2be?_0x3b3fda[_0x730c('0x22')]:_0x5800d7[_0x730c('0x1f')]+_0x5800d7[_0x730c('0x21')];var _0x2cc248;if(_0x5e9806>=_0x2fe217){_0x5e9806=_0x2fe217;_0x2cc248=0xc8;}else{_0x2cc248=0xce;}_0xa7a352[_0x730c('0x1d')](_0x2cc248);return _0xa7a352[_0x730c('0x23')]('Content-Range',_0x1349c3+'-'+_0x5e9806+'/'+_0x2fe217)[_0x730c('0x1e')](_0x3b3fda);}return null;};}function patchUpdates(_0x1e87e3){return function(_0x2d4dfb){try{jsonpatch[_0x730c('0x24')](_0x2d4dfb,_0x1e87e3,!![]);}catch(_0x2d0850){return BPromise[_0x730c('0x25')](_0x2d0850);}return _0x2d4dfb[_0x730c('0x26')]();};}function saveUpdates(_0x1d6c33,_0x5520d0){return function(_0x4a104b){if(_0x4a104b){return _0x4a104b['update'](_0x1d6c33)[_0x730c('0x27')](function(_0xea1cfd){return _0xea1cfd;});}return null;};}function removeEntity(_0x1d8bf8,_0x26a58c){return function(_0x2c0cb3){if(_0x2c0cb3){return _0x2c0cb3['destroy']()['then'](function(){var _0x984a84=_0x2c0cb3['get']({'plain':!![]});var _0x58290c=_0x730c('0x28');return db[_0x730c('0x29')][_0x730c('0x2a')]({'where':{'type':_0x58290c,'resourceId':_0x984a84['id']}})[_0x730c('0x27')](function(){return _0x2c0cb3;});})['then'](function(){_0x1d8bf8[_0x730c('0x1d')](0xcc)[_0x730c('0x2b')]();});}};}function handleEntityNotFound(_0x1f988a,_0x3fdb87){return function(_0x14425e){if(!_0x14425e){_0x1f988a[_0x730c('0x1c')](0x194);}return _0x14425e;};}function handleError(_0x652b0e,_0x2ae689){_0x2ae689=_0x2ae689||0x1f4;return function(_0x13d446){logger[_0x730c('0x2c')](_0x13d446[_0x730c('0x2d')]);if(_0x13d446['name']){delete _0x13d446[_0x730c('0x2e')];}_0x652b0e['status'](_0x2ae689)[_0x730c('0x2f')](_0x13d446);};}exports[_0x730c('0x30')]=function(_0x55df01,_0x4cf98b){var _0x304c5f={},_0x23026f={},_0x33a6b0={'count':0x0,'rows':[]};var _0xfb277f=_[_0x730c('0x31')](db[_0x730c('0x32')][_0x730c('0x33')],function(_0x56114b){return{'name':_0x56114b[_0x730c('0x34')],'type':_0x56114b[_0x730c('0x35')][_0x730c('0x36')]};});_0x23026f[_0x730c('0x37')]=_['map'](_0xfb277f,_0x730c('0x2e'));_0x23026f[_0x730c('0x38')]=_['keys'](_0x55df01[_0x730c('0x38')]);_0x23026f[_0x730c('0x39')]=_[_0x730c('0x3a')](_0x23026f['model'],_0x23026f[_0x730c('0x38')]);_0x304c5f[_0x730c('0x3b')]=_[_0x730c('0x3a')](_0x23026f['model'],qs['fields'](_0x55df01[_0x730c('0x38')][_0x730c('0x3c')]));_0x304c5f['attributes']=_0x304c5f[_0x730c('0x3b')][_0x730c('0x3d')]?_0x304c5f[_0x730c('0x3b')]:_0x23026f[_0x730c('0x37')];if(!_0x55df01[_0x730c('0x38')][_0x730c('0x3e')]('nolimit')){_0x304c5f['limit']=qs[_0x730c('0x21')](_0x55df01['query'][_0x730c('0x21')]);_0x304c5f[_0x730c('0x1f')]=qs[_0x730c('0x1f')](_0x55df01['query'][_0x730c('0x1f')]);}_0x304c5f[_0x730c('0x3f')]=qs[_0x730c('0x40')](_0x55df01[_0x730c('0x38')]['sort']);_0x304c5f[_0x730c('0x41')]=qs[_0x730c('0x39')](_[_0x730c('0x42')](_0x55df01['query'],_0x23026f[_0x730c('0x39')]),_0xfb277f);if(_0x55df01[_0x730c('0x38')][_0x730c('0x43')]){_0x304c5f['where']=_[_0x730c('0x44')](_0x304c5f[_0x730c('0x41')],{'$or':_[_0x730c('0x31')](_0xfb277f,function(_0x13e649){if(_0x13e649[_0x730c('0x35')]!==_0x730c('0x45')){var _0x2d7cd3={};_0x2d7cd3[_0x13e649['name']]={'$like':'%'+_0x55df01[_0x730c('0x38')][_0x730c('0x43')]+'%'};return _0x2d7cd3;}})});}_0x304c5f=_[_0x730c('0x44')]({},_0x304c5f,_0x55df01[_0x730c('0x46')]);var _0x49fb2d={'where':_0x304c5f[_0x730c('0x41')]};return db['VoicePrefix']['count'](_0x49fb2d)[_0x730c('0x27')](function(_0x37371e){_0x33a6b0[_0x730c('0x22')]=_0x37371e;if(_0x55df01['query']['includeAll']){_0x304c5f[_0x730c('0x47')]=[{'all':!![]}];}return db[_0x730c('0x32')][_0x730c('0x48')](_0x304c5f);})[_0x730c('0x27')](function(_0x301aa2){_0x33a6b0[_0x730c('0x49')]=_0x301aa2;return _0x33a6b0;})[_0x730c('0x27')](respondWithFilteredResult(_0x4cf98b,_0x304c5f))[_0x730c('0x4a')](handleError(_0x4cf98b,null));};exports[_0x730c('0x4b')]=function(_0xfcbd86,_0x5d4211){var _0x1f8df9={'raw':![],'where':{'id':_0xfcbd86[_0x730c('0x4c')]['id']}},_0x58479e={};_0x58479e['model']=_[_0x730c('0x4d')](db[_0x730c('0x32')][_0x730c('0x33')]);_0x58479e[_0x730c('0x38')]=_[_0x730c('0x4d')](_0xfcbd86[_0x730c('0x38')]);_0x58479e[_0x730c('0x39')]=_[_0x730c('0x3a')](_0x58479e[_0x730c('0x37')],_0x58479e[_0x730c('0x38')]);_0x1f8df9[_0x730c('0x3b')]=_[_0x730c('0x3a')](_0x58479e[_0x730c('0x37')],qs[_0x730c('0x3c')](_0xfcbd86[_0x730c('0x38')][_0x730c('0x3c')]));_0x1f8df9[_0x730c('0x3b')]=_0x1f8df9[_0x730c('0x3b')]['length']?_0x1f8df9[_0x730c('0x3b')]:_0x58479e[_0x730c('0x37')];if(_0xfcbd86[_0x730c('0x38')]['includeAll']){_0x1f8df9[_0x730c('0x47')]=[{'all':!![]}];}_0x1f8df9=_[_0x730c('0x44')]({},_0x1f8df9,_0xfcbd86[_0x730c('0x46')]);return db[_0x730c('0x32')][_0x730c('0x4e')](_0x1f8df9)[_0x730c('0x27')](handleEntityNotFound(_0x5d4211,null))[_0x730c('0x27')](respondWithResult(_0x5d4211,null))[_0x730c('0x4a')](handleError(_0x5d4211,null));};exports[_0x730c('0x2a')]=function(_0x591545,_0x324cab){return db[_0x730c('0x32')]['find']({'where':{'id':_0x591545[_0x730c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x324cab,null))[_0x730c('0x27')](removeEntity(_0x324cab,null))[_0x730c('0x4a')](handleError(_0x324cab,null));};exports[_0x730c('0x4f')]=function(_0x166c29,_0x3dc0c8){return db[_0x730c('0x32')][_0x730c('0x4f')]()['then'](respondWithResult(_0x3dc0c8,null))[_0x730c('0x4a')](handleError(_0x3dc0c8,null));};exports[_0x730c('0x50')]=function(_0x26b846,_0x7ccaf7){var _0x204871;return db[_0x730c('0x51')]['transaction'](function(_0x49e410){return db[_0x730c('0x32')][_0x730c('0x50')](_0x26b846[_0x730c('0x52')],{'transaction':_0x49e410})[_0x730c('0x27')](function(_0x4461d2){_0x204871=_0x4461d2['get']({'plain':!![]});return db[_0x730c('0x53')][_0x730c('0x4e')]({'where':{'id':_0x204871[_0x730c('0x54')]},'raw':!![]})['then'](function(_0x374bf5){return createVoicePrefixExtensions(_0x204871,_0x374bf5,_0x49e410);});});})[_0x730c('0x27')](function(){var _0x34cfbb=_0x26b846['user'][_0x730c('0x55')]({'plain':!![]});if(!_0x34cfbb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x34cfbb['role']===_0x730c('0x56')){var _0x3b2fa2=_0x204871;return db['UserProfileSection'][_0x730c('0x4e')]({'where':{'name':_0x730c('0x28'),'userProfileId':_0x34cfbb[_0x730c('0x57')]},'raw':!![]})[_0x730c('0x27')](function(_0x210ec3){if(_0x210ec3&&_0x210ec3[_0x730c('0x58')]===0x0){return db[_0x730c('0x29')]['create']({'name':_0x3b2fa2[_0x730c('0x2e')],'resourceId':_0x3b2fa2['id'],'type':_0x210ec3[_0x730c('0x2e')],'sectionId':_0x210ec3['id']},{})[_0x730c('0x27')](function(){return _0x204871;});}else{return _0x204871;}})[_0x730c('0x4a')](function(_0x255282){logger[_0x730c('0x2c')](_0x730c('0x59'),_0x255282);throw _0x255282;});}return _0x204871;})['then'](respondWithResult(_0x7ccaf7,null))['catch'](handleError(_0x7ccaf7,null));};function Extension(_0x499793,_0x482214,_0x1bf9b2,_0x1e0563){this[_0x730c('0x5a')]='from-sip';this['exten']=_0x499793;this['app']=_0x1bf9b2;this[_0x730c('0x35')]=_0x730c('0x5b');this[_0x730c('0x5c')]='Voice\x20Prefix\x20Extension';this[_0x730c('0x5d')]=_0x482214;this[_0x730c('0x5e')]=_0x1e0563;}function createVoicePrefixExtensions(_0x10d58e,_0xa7aaeb,_0x17a63e){return new BPromise(function(_0x15ca49,_0x381096){var _0x47f427=new Extension(formatPrefixName(_0x10d58e[_0x730c('0x5f')]),0x1,_0x730c('0x60'),_0x730c('0x61'));_0x47f427[_0x730c('0x62')]=_0x10d58e['id'];return db[_0x730c('0x53')][_0x730c('0x50')](_0x47f427,{'transaction':_0x17a63e})[_0x730c('0x27')](function(_0x38c6f3){var _0x5b0f96=_0x38c6f3['get']({'plain':!![]});var _0x3a630b=_[_0x730c('0x31')](addVoicePrefixExtensions(_0x10d58e,_0xa7aaeb),function(_0x281fe1){_0x281fe1[_0x730c('0x54')]=_0x5b0f96['id'];_0x281fe1[_0x730c('0x62')]=_0x10d58e['id'];return _0x281fe1;});return db[_0x730c('0x53')][_0x730c('0x63')](_0x3a630b,{'transaction':_0x17a63e})[_0x730c('0x27')](function(_0x2a650b){if(!_0x2a650b){return _0x381096(_0x730c('0x64'));}else{return _0x15ca49(_0x2a650b);}})[_0x730c('0x4a')](function(_0x5539f7){return _0x381096(_0x5539f7);});});;});};function addVoicePrefixExtensions(_0x1aed19,_0x952a4b){var _0x253645=[];var _0x1d36b7=formatPrefixName(_0x1aed19[_0x730c('0x5f')]);_0x253645[_0x730c('0x65')](new Extension(_0x1d36b7,0x2,'Set',_0x730c('0x66')+_0x1aed19['name']));if(_0x1aed19[_0x730c('0x67')]){_0x253645['push'](new Extension(_0x1d36b7,0x3,_0x730c('0x68'),_0x730c('0x69')+_0x1aed19['callerIdAll']));}else{_0x253645[_0x730c('0x65')](new Extension(_0x1d36b7,0x3,_0x730c('0x60'),_0x730c('0x6a')));}_0x253645[_0x730c('0x65')](new Extension(_0x1d36b7,0x4,'goto',_0x952a4b[_0x730c('0x5a')]+','+_0x730c('0x6b')+(0x8+_0x1aed19['name'][_0x730c('0x3d')])+'}'+','+0x1));return _0x253645;}function formatPrefixName(_0x444863){var _0x15e662='_';for(var _0x1c3718=0x0;_0x1c3718<_0x444863[_0x730c('0x3d')];_0x1c3718++){if(_0x444863['charAt'](_0x1c3718)=='-'){_0x15e662+=_0x444863[_0x730c('0x6c')](_0x1c3718);}else{_0x15e662+='['+_0x444863[_0x730c('0x6c')](_0x1c3718)+']';}}_0x15e662+='.';return _0x15e662;}exports['update']=function(_0x353547,_0x212505,_0x911071){var _0x32d4e8=_0x353547[_0x730c('0x52')];_0x32d4e8[_0x730c('0x5f')]=_0x730c('0x6d')+_0x32d4e8[_0x730c('0x2e')]+'-';return db[_0x730c('0x51')][_0x730c('0x6e')](function(_0x3b02b3){return db[_0x730c('0x32')][_0x730c('0x6f')](_0x32d4e8,{'where':{'id':_0x32d4e8['id']},'transaction':_0x3b02b3})[_0x730c('0x27')](function(){return db['VoiceExtension'][_0x730c('0x2a')]({'where':{'VoicePrefixId':_0x32d4e8['id']},'transaction':_0x3b02b3})[_0x730c('0x27')](function(){return db['VoiceExtension']['find']({'where':{'id':_0x32d4e8[_0x730c('0x54')]},'raw':!![]})[_0x730c('0x27')](function(_0x44eb1d){return createVoicePrefixExtensions(_0x32d4e8,_0x44eb1d,_0x3b02b3);});});});})[_0x730c('0x27')](function(){return db[_0x730c('0x32')]['findById'](_0x32d4e8['id']);})[_0x730c('0x27')](respondWithResult(_0x212505,null))[_0x730c('0x4a')](handleError(_0x212505,null));};exports[_0x730c('0x70')]=function(_0x1bf755,_0x237b8e,_0x1846b6){return db[_0x730c('0x32')][_0x730c('0x4e')]({'where':{'id':_0x1bf755[_0x730c('0x4c')]['id']}})[_0x730c('0x27')](handleEntityNotFound(_0x237b8e,null))[_0x730c('0x27')](function(_0x3527dd){if(_0x3527dd){return _0x3527dd[_0x730c('0x70')](_0x1bf755['body'][_0x730c('0x71')],_[_0x730c('0x72')](_0x1bf755['body'],[_0x730c('0x71'),'id'])||{})[_0x730c('0x73')](function(_0x46a1a3){for(var _0x421460=0x0;_0x421460<_0x1bf755['body'][_0x730c('0x71')]['length'];_0x421460+=0x1){socket['emit'](_0x730c('0x74'),{'UserId':Number(_0x1bf755[_0x730c('0x52')]['ids'][_0x421460]),'VoicePrefixId':Number(_0x1bf755[_0x730c('0x4c')]['id'])});}return _0x46a1a3;});}})[_0x730c('0x27')](respondWithResult(_0x237b8e,null))[_0x730c('0x4a')](handleError(_0x237b8e,null));};exports['removeAgents']=function(_0x3785b4,_0x18a493,_0x47baaa){return db['VoicePrefix'][_0x730c('0x4e')]({'where':{'id':_0x3785b4['params']['id']}})[_0x730c('0x27')](handleEntityNotFound(_0x18a493,null))['then'](function(_0x3913d){if(_0x3913d){return _0x3913d[_0x730c('0x75')](_0x3785b4[_0x730c('0x38')][_0x730c('0x71')])[_0x730c('0x27')](function(){if(_[_0x730c('0x76')](_0x3785b4[_0x730c('0x38')][_0x730c('0x71')])){for(var _0xb56c1e=0x0;_0xb56c1e<_0x3785b4[_0x730c('0x38')][_0x730c('0x71')]['length'];_0xb56c1e+=0x1){socket[_0x730c('0x77')](_0x730c('0x78'),{'UserId':Number(_0x3785b4[_0x730c('0x38')][_0x730c('0x71')][_0xb56c1e]),'VoicePrefixId':Number(_0x3785b4[_0x730c('0x4c')]['id'])});}}else{socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x3785b4[_0x730c('0x38')][_0x730c('0x71')]),'VoicePrefixId':Number(_0x3785b4['params']['id'])});}});}})['then'](respondWithStatusCode(_0x18a493,null))[_0x730c('0x4a')](handleError(_0x18a493,null));};exports['getAgents']=function(_0x88cc95,_0x9da88e,_0x17dc1c){var _0x368604={};var _0x4e1cf5={};var _0x511cb9;var _0x3ed63f;return db[_0x730c('0x32')][_0x730c('0x79')]({'where':{'id':_0x88cc95[_0x730c('0x4c')]['id']}})[_0x730c('0x27')](handleEntityNotFound(_0x9da88e,null))[_0x730c('0x27')](function(_0x3e1ea6){if(_0x3e1ea6){_0x511cb9=_0x3e1ea6;_0x4e1cf5['model']=_['keys'](db[_0x730c('0x7a')][_0x730c('0x33')]);_0x4e1cf5[_0x730c('0x38')]=_[_0x730c('0x4d')](_0x88cc95['query']);_0x4e1cf5['filters']=_[_0x730c('0x3a')](_0x4e1cf5[_0x730c('0x37')],_0x4e1cf5[_0x730c('0x38')]);_0x368604['attributes']=_[_0x730c('0x3a')](_0x4e1cf5[_0x730c('0x37')],qs[_0x730c('0x3c')](_0x88cc95['query'][_0x730c('0x3c')]));_0x368604['attributes']=_0x368604[_0x730c('0x3b')]['length']?_0x368604[_0x730c('0x3b')]:_0x4e1cf5['model'];_0x368604[_0x730c('0x3f')]=qs[_0x730c('0x40')](_0x88cc95['query'][_0x730c('0x40')]);_0x368604[_0x730c('0x41')]=qs[_0x730c('0x39')](_[_0x730c('0x42')](_0x88cc95[_0x730c('0x38')],_0x4e1cf5[_0x730c('0x39')]));if(_0x88cc95[_0x730c('0x38')][_0x730c('0x43')]){_0x368604[_0x730c('0x41')]=_[_0x730c('0x44')](_0x368604[_0x730c('0x41')],{'$or':_[_0x730c('0x31')](_0x368604[_0x730c('0x3b')],function(_0x213194){var _0x5a55b4={};_0x5a55b4[_0x213194]={'$like':'%'+_0x88cc95[_0x730c('0x38')][_0x730c('0x43')]+'%'};return _0x5a55b4;})});}_0x368604=_[_0x730c('0x44')]({},_0x368604,_0x88cc95[_0x730c('0x46')]);return _0x511cb9[_0x730c('0x7b')](_0x368604);}})[_0x730c('0x27')](function(_0x229c24){if(_0x229c24){_0x3ed63f=_0x229c24['length'];if(!_0x88cc95['query'][_0x730c('0x3e')](_0x730c('0x7c'))){_0x368604[_0x730c('0x21')]=qs[_0x730c('0x21')](_0x88cc95[_0x730c('0x38')][_0x730c('0x21')]);_0x368604[_0x730c('0x1f')]=qs['offset'](_0x88cc95[_0x730c('0x38')][_0x730c('0x1f')]);}return _0x511cb9[_0x730c('0x7b')](_0x368604);}})[_0x730c('0x27')](function(_0x1fe5d9){if(_0x1fe5d9){return _0x1fe5d9?{'count':_0x3ed63f,'rows':_0x1fe5d9}:null;}})[_0x730c('0x27')](respondWithResult(_0x9da88e,null))['catch'](handleError(_0x9da88e,null));}; \ No newline at end of file +var _0xca1d=['zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','VoicePrefix','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','describe','sequelize','create','VoiceExtension','VoiceExtensionId','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','system','description','priority','Voice\x20Prefix','bulkCreate','prefix','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','push','goto','${EXTEN:','body','system-','transaction','findById','addAgents','ids','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','emit','getAgents','findOne','User','eml-format','rimraf'];(function(_0x28e526,_0x11d057){var _0x3173f3=function(_0x209510){while(--_0x209510){_0x28e526['push'](_0x28e526['shift']());}};_0x3173f3(++_0x11d057);}(_0xca1d,0x1e6));var _0xdca1=function(_0x11b0ff,_0x47e962){_0x11b0ff=_0x11b0ff-0x0;var _0x340c38=_0xca1d[_0x11b0ff];return _0x340c38;};'use strict';var emlformat=require(_0xdca1('0x0'));var rimraf=require(_0xdca1('0x1'));var zipdir=require(_0xdca1('0x2'));var jsonpatch=require(_0xdca1('0x3'));var rp=require(_0xdca1('0x4'));var moment=require(_0xdca1('0x5'));var BPromise=require(_0xdca1('0x6'));var Mustache=require('mustache');var util=require(_0xdca1('0x7'));var path=require(_0xdca1('0x8'));var sox=require('sox');var csv=require(_0xdca1('0x9'));var ejs=require(_0xdca1('0xa'));var fs=require('fs');var fs_extra=require(_0xdca1('0xb'));var _=require('lodash');var squel=require(_0xdca1('0xc'));var crypto=require(_0xdca1('0xd'));var jsforce=require(_0xdca1('0xe'));var deskjs=require(_0xdca1('0xf'));var toCsv=require(_0xdca1('0x9'));var querystring=require('querystring');var Papa=require(_0xdca1('0x10'));var Redis=require(_0xdca1('0x11'));var authService=require(_0xdca1('0x12'));var qs=require(_0xdca1('0x13'));var as=require(_0xdca1('0x14'));var hardwareService=require(_0xdca1('0x15'));var logger=require('../../config/logger')(_0xdca1('0x16'));var utils=require(_0xdca1('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xdca1('0x18'));var db=require(_0xdca1('0x19'))['db'];config[_0xdca1('0x1a')]=_[_0xdca1('0x1b')](config[_0xdca1('0x1a')],{'host':_0xdca1('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdca1('0x1a')]));require('./voicePrefix.socket')[_0xdca1('0x1d')](socket);function respondWithStatusCode(_0x2874df,_0x25126b){_0x25126b=_0x25126b||0xcc;return function(_0x285411){if(_0x285411){return _0x2874df[_0xdca1('0x1e')](_0x25126b);}return _0x2874df[_0xdca1('0x1f')](_0x25126b)[_0xdca1('0x20')]();};}function respondWithResult(_0x4ba1e9,_0x5b7399){_0x5b7399=_0x5b7399||0xc8;return function(_0x306978){if(_0x306978){return _0x4ba1e9[_0xdca1('0x1f')](_0x5b7399)[_0xdca1('0x21')](_0x306978);}};}function respondWithFilteredResult(_0x363f75,_0x1a4436){return function(_0x1fad53){if(_0x1fad53){var _0x29bcfe=typeof _0x1a4436[_0xdca1('0x22')]===_0xdca1('0x23')&&typeof _0x1a4436[_0xdca1('0x24')]===_0xdca1('0x23');var _0x44377f=_0x1fad53[_0xdca1('0x25')];var _0x1c9cf9=_0x29bcfe?0x0:_0x1a4436[_0xdca1('0x22')];var _0x72ba80=_0x29bcfe?_0x1fad53[_0xdca1('0x25')]:_0x1a4436['offset']+_0x1a4436[_0xdca1('0x24')];var _0x366e00;if(_0x72ba80>=_0x44377f){_0x72ba80=_0x44377f;_0x366e00=0xc8;}else{_0x366e00=0xce;}_0x363f75[_0xdca1('0x1f')](_0x366e00);return _0x363f75[_0xdca1('0x26')](_0xdca1('0x27'),_0x1c9cf9+'-'+_0x72ba80+'/'+_0x44377f)[_0xdca1('0x21')](_0x1fad53);}return null;};}function patchUpdates(_0xad5463){return function(_0x9443ce){try{jsonpatch['apply'](_0x9443ce,_0xad5463,!![]);}catch(_0x45a2a8){return BPromise[_0xdca1('0x28')](_0x45a2a8);}return _0x9443ce['save']();};}function saveUpdates(_0xd34c45,_0x348d72){return function(_0x186c71){if(_0x186c71){return _0x186c71[_0xdca1('0x29')](_0xd34c45)[_0xdca1('0x2a')](function(_0x363165){return _0x363165;});}return null;};}function removeEntity(_0x16bb98,_0x22046d){return function(_0x273e3c){if(_0x273e3c){return _0x273e3c[_0xdca1('0x2b')]()['then'](function(){var _0x224384=_0x273e3c[_0xdca1('0x2c')]({'plain':!![]});var _0x33d8fe='VoicePrefixes';return db[_0xdca1('0x2d')][_0xdca1('0x2b')]({'where':{'type':_0x33d8fe,'resourceId':_0x224384['id']}})[_0xdca1('0x2a')](function(){return _0x273e3c;});})[_0xdca1('0x2a')](function(){_0x16bb98['status'](0xcc)[_0xdca1('0x20')]();});}};}function handleEntityNotFound(_0x1c7035,_0x3bc034){return function(_0x1e1dd0){if(!_0x1e1dd0){_0x1c7035[_0xdca1('0x1e')](0x194);}return _0x1e1dd0;};}function handleError(_0x5b6ee4,_0x2c7a07){_0x2c7a07=_0x2c7a07||0x1f4;return function(_0x25bb64){logger[_0xdca1('0x2e')](_0x25bb64[_0xdca1('0x2f')]);if(_0x25bb64[_0xdca1('0x30')]){delete _0x25bb64[_0xdca1('0x30')];}_0x5b6ee4[_0xdca1('0x1f')](_0x2c7a07)[_0xdca1('0x31')](_0x25bb64);};}exports['index']=function(_0x4210e9,_0x4b33ed){var _0x449003={},_0x465f13={},_0x406cd5={'count':0x0,'rows':[]};var _0x5e2d61=_['map'](db[_0xdca1('0x32')][_0xdca1('0x33')],function(_0x4c94bd){return{'name':_0x4c94bd[_0xdca1('0x34')],'type':_0x4c94bd['type'][_0xdca1('0x35')]};});_0x465f13['model']=_['map'](_0x5e2d61,_0xdca1('0x30'));_0x465f13[_0xdca1('0x36')]=_[_0xdca1('0x37')](_0x4210e9['query']);_0x465f13[_0xdca1('0x38')]=_[_0xdca1('0x39')](_0x465f13['model'],_0x465f13[_0xdca1('0x36')]);_0x449003[_0xdca1('0x3a')]=_[_0xdca1('0x39')](_0x465f13[_0xdca1('0x3b')],qs['fields'](_0x4210e9[_0xdca1('0x36')][_0xdca1('0x3c')]));_0x449003['attributes']=_0x449003[_0xdca1('0x3a')][_0xdca1('0x3d')]?_0x449003['attributes']:_0x465f13[_0xdca1('0x3b')];if(!_0x4210e9['query'][_0xdca1('0x3e')](_0xdca1('0x3f'))){_0x449003[_0xdca1('0x24')]=qs[_0xdca1('0x24')](_0x4210e9[_0xdca1('0x36')][_0xdca1('0x24')]);_0x449003[_0xdca1('0x22')]=qs[_0xdca1('0x22')](_0x4210e9[_0xdca1('0x36')]['offset']);}_0x449003[_0xdca1('0x40')]=qs['sort'](_0x4210e9[_0xdca1('0x36')][_0xdca1('0x41')]);_0x449003['where']=qs['filters'](_[_0xdca1('0x42')](_0x4210e9[_0xdca1('0x36')],_0x465f13['filters']),_0x5e2d61);if(_0x4210e9['query'][_0xdca1('0x43')]){_0x449003[_0xdca1('0x44')]=_[_0xdca1('0x45')](_0x449003[_0xdca1('0x44')],{'$or':_[_0xdca1('0x46')](_0x5e2d61,function(_0x2bd091){if(_0x2bd091[_0xdca1('0x47')]!==_0xdca1('0x48')){var _0xb54125={};_0xb54125[_0x2bd091[_0xdca1('0x30')]]={'$like':'%'+_0x4210e9[_0xdca1('0x36')]['filter']+'%'};return _0xb54125;}})});}_0x449003=_[_0xdca1('0x45')]({},_0x449003,_0x4210e9[_0xdca1('0x49')]);var _0x138c80={'where':_0x449003[_0xdca1('0x44')]};return db[_0xdca1('0x32')][_0xdca1('0x25')](_0x138c80)['then'](function(_0x1ed3d9){_0x406cd5['count']=_0x1ed3d9;if(_0x4210e9[_0xdca1('0x36')][_0xdca1('0x4a')]){_0x449003['include']=[{'all':!![]}];}return db[_0xdca1('0x32')][_0xdca1('0x4b')](_0x449003);})[_0xdca1('0x2a')](function(_0x4ca8df){_0x406cd5[_0xdca1('0x4c')]=_0x4ca8df;return _0x406cd5;})[_0xdca1('0x2a')](respondWithFilteredResult(_0x4b33ed,_0x449003))[_0xdca1('0x4d')](handleError(_0x4b33ed,null));};exports[_0xdca1('0x4e')]=function(_0x357e0e,_0x319f3c){var _0x119afd={'raw':![],'where':{'id':_0x357e0e[_0xdca1('0x4f')]['id']}},_0x22739d={};_0x22739d[_0xdca1('0x3b')]=_[_0xdca1('0x37')](db[_0xdca1('0x32')][_0xdca1('0x33')]);_0x22739d['query']=_[_0xdca1('0x37')](_0x357e0e[_0xdca1('0x36')]);_0x22739d[_0xdca1('0x38')]=_[_0xdca1('0x39')](_0x22739d['model'],_0x22739d[_0xdca1('0x36')]);_0x119afd[_0xdca1('0x3a')]=_[_0xdca1('0x39')](_0x22739d['model'],qs['fields'](_0x357e0e[_0xdca1('0x36')][_0xdca1('0x3c')]));_0x119afd[_0xdca1('0x3a')]=_0x119afd[_0xdca1('0x3a')][_0xdca1('0x3d')]?_0x119afd[_0xdca1('0x3a')]:_0x22739d[_0xdca1('0x3b')];if(_0x357e0e[_0xdca1('0x36')][_0xdca1('0x4a')]){_0x119afd[_0xdca1('0x50')]=[{'all':!![]}];}_0x119afd=_[_0xdca1('0x45')]({},_0x119afd,_0x357e0e['options']);return db[_0xdca1('0x32')][_0xdca1('0x51')](_0x119afd)[_0xdca1('0x2a')](handleEntityNotFound(_0x319f3c,null))['then'](respondWithResult(_0x319f3c,null))[_0xdca1('0x4d')](handleError(_0x319f3c,null));};exports[_0xdca1('0x2b')]=function(_0x1e89b0,_0x41791e){return db[_0xdca1('0x32')][_0xdca1('0x51')]({'where':{'id':_0x1e89b0[_0xdca1('0x4f')]['id']}})[_0xdca1('0x2a')](handleEntityNotFound(_0x41791e,null))[_0xdca1('0x2a')](removeEntity(_0x41791e,null))[_0xdca1('0x4d')](handleError(_0x41791e,null));};exports[_0xdca1('0x52')]=function(_0x15853d,_0x4ec467){return db['VoicePrefix'][_0xdca1('0x52')]()[_0xdca1('0x2a')](respondWithResult(_0x4ec467,null))[_0xdca1('0x4d')](handleError(_0x4ec467,null));};exports['create']=function(_0x5f13ad,_0x4e9368){var _0x18808b;return db[_0xdca1('0x53')]['transaction'](function(_0x57778e){return db[_0xdca1('0x32')][_0xdca1('0x54')](_0x5f13ad['body'],{'transaction':_0x57778e})[_0xdca1('0x2a')](function(_0x354d0b){_0x18808b=_0x354d0b['get']({'plain':!![]});return db[_0xdca1('0x55')]['find']({'where':{'id':_0x18808b[_0xdca1('0x56')]},'raw':!![]})[_0xdca1('0x2a')](function(_0x2c564d){return createVoicePrefixExtensions(_0x18808b,_0x2c564d,_0x57778e);});});})[_0xdca1('0x2a')](function(){var _0x24c4cc=_0x5f13ad[_0xdca1('0x57')][_0xdca1('0x2c')]({'plain':!![]});if(!_0x24c4cc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x24c4cc[_0xdca1('0x58')]===_0xdca1('0x57')){var _0x25e46b=_0x18808b;return db['UserProfileSection'][_0xdca1('0x51')]({'where':{'name':'VoicePrefixes','userProfileId':_0x24c4cc[_0xdca1('0x59')]},'raw':!![]})['then'](function(_0x89db0e){if(_0x89db0e&&_0x89db0e[_0xdca1('0x5a')]===0x0){return db['UserProfileResource'][_0xdca1('0x54')]({'name':_0x25e46b['name'],'resourceId':_0x25e46b['id'],'type':_0x89db0e['name'],'sectionId':_0x89db0e['id']},{})['then'](function(){return _0x18808b;});}else{return _0x18808b;}})[_0xdca1('0x4d')](function(_0x232a64){logger[_0xdca1('0x2e')](_0xdca1('0x5b'),_0x232a64);throw _0x232a64;});}return _0x18808b;})[_0xdca1('0x2a')](respondWithResult(_0x4e9368,null))[_0xdca1('0x4d')](handleError(_0x4e9368,null));};function Extension(_0x13922e,_0xa05559,_0x5b6018,_0x10f9ee){this[_0xdca1('0x5c')]=_0xdca1('0x5d');this['exten']=_0x13922e;this[_0xdca1('0x5e')]=_0x5b6018;this[_0xdca1('0x47')]=_0xdca1('0x5f');this[_0xdca1('0x60')]='Voice\x20Prefix\x20Extension';this[_0xdca1('0x61')]=_0xa05559;this['appdata']=_0x10f9ee;}function createVoicePrefixExtensions(_0x598530,_0x560039,_0x409427){return new BPromise(function(_0x3c0b2c,_0xf7b1ad){var _0x2139b2=new Extension(formatPrefixName(_0x598530['prefix']),0x1,'NoOp',_0xdca1('0x62'));_0x2139b2['VoicePrefixId']=_0x598530['id'];return db['VoiceExtension'][_0xdca1('0x54')](_0x2139b2,{'transaction':_0x409427})[_0xdca1('0x2a')](function(_0x1a7761){var _0x365520=_0x1a7761[_0xdca1('0x2c')]({'plain':!![]});var _0x30c660=_[_0xdca1('0x46')](addVoicePrefixExtensions(_0x598530,_0x560039),function(_0x310ddd){_0x310ddd[_0xdca1('0x56')]=_0x365520['id'];_0x310ddd['VoicePrefixId']=_0x598530['id'];return _0x310ddd;});return db[_0xdca1('0x55')][_0xdca1('0x63')](_0x30c660,{'transaction':_0x409427})[_0xdca1('0x2a')](function(_0x351b81){if(!_0x351b81){return _0xf7b1ad('Extensions\x20creation\x20failed');}else{return _0x3c0b2c(_0x351b81);}})['catch'](function(_0x330840){return _0xf7b1ad(_0x330840);});});;});};function addVoicePrefixExtensions(_0xf01557,_0x40ed4e){var _0x4bdfde=[];var _0x462ad9=formatPrefixName(_0xf01557[_0xdca1('0x64')]);_0x4bdfde['push'](new Extension(_0x462ad9,0x2,_0xdca1('0x65'),_0xdca1('0x66')+_0xf01557['name']));if(_0xf01557[_0xdca1('0x67')]){_0x4bdfde['push'](new Extension(_0x462ad9,0x3,_0xdca1('0x65'),_0xdca1('0x68')+_0xf01557[_0xdca1('0x67')]));}else{_0x4bdfde[_0xdca1('0x69')](new Extension(_0x462ad9,0x3,'NoOp','No\x20callerid\x20available'));}_0x4bdfde[_0xdca1('0x69')](new Extension(_0x462ad9,0x4,_0xdca1('0x6a'),_0x40ed4e[_0xdca1('0x5c')]+','+_0xdca1('0x6b')+(0x8+_0xf01557[_0xdca1('0x30')][_0xdca1('0x3d')])+'}'+','+0x1));return _0x4bdfde;}function formatPrefixName(_0x5f2a51){var _0x571efb='_';for(var _0x20594c=0x0;_0x20594c<_0x5f2a51[_0xdca1('0x3d')];_0x20594c++){if(_0x5f2a51['charAt'](_0x20594c)=='-'){_0x571efb+=_0x5f2a51['charAt'](_0x20594c);}else{_0x571efb+='['+_0x5f2a51['charAt'](_0x20594c)+']';}}_0x571efb+='.';return _0x571efb;}exports[_0xdca1('0x29')]=function(_0x4dd80e,_0xc0bf2,_0x53091b){var _0x279926=_0x4dd80e[_0xdca1('0x6c')];_0x279926[_0xdca1('0x64')]=_0xdca1('0x6d')+_0x279926['name']+'-';return db['sequelize'][_0xdca1('0x6e')](function(_0x4d7383){return db[_0xdca1('0x32')]['update'](_0x279926,{'where':{'id':_0x279926['id']},'transaction':_0x4d7383})['then'](function(){return db[_0xdca1('0x55')][_0xdca1('0x2b')]({'where':{'VoicePrefixId':_0x279926['id']},'transaction':_0x4d7383})['then'](function(){return db[_0xdca1('0x55')][_0xdca1('0x51')]({'where':{'id':_0x279926[_0xdca1('0x56')]},'raw':!![]})[_0xdca1('0x2a')](function(_0x1b6b39){return createVoicePrefixExtensions(_0x279926,_0x1b6b39,_0x4d7383);});});});})[_0xdca1('0x2a')](function(){return db['VoicePrefix'][_0xdca1('0x6f')](_0x279926['id']);})[_0xdca1('0x2a')](respondWithResult(_0xc0bf2,null))['catch'](handleError(_0xc0bf2,null));};exports[_0xdca1('0x70')]=function(_0x152f0c,_0x2f9a6c,_0x555e18){return db[_0xdca1('0x32')][_0xdca1('0x51')]({'where':{'id':_0x152f0c[_0xdca1('0x4f')]['id']}})[_0xdca1('0x2a')](handleEntityNotFound(_0x2f9a6c,null))[_0xdca1('0x2a')](function(_0x2ef64d){if(_0x2ef64d){return _0x2ef64d[_0xdca1('0x70')](_0x152f0c[_0xdca1('0x6c')]['ids'],_['omit'](_0x152f0c[_0xdca1('0x6c')],[_0xdca1('0x71'),'id'])||{})['spread'](function(_0x5e7942){for(var _0x1d7607=0x0;_0x1d7607<_0x152f0c[_0xdca1('0x6c')][_0xdca1('0x71')]['length'];_0x1d7607+=0x1){socket['emit'](_0xdca1('0x72'),{'UserId':Number(_0x152f0c[_0xdca1('0x6c')][_0xdca1('0x71')][_0x1d7607]),'VoicePrefixId':Number(_0x152f0c[_0xdca1('0x4f')]['id'])});}return _0x5e7942;});}})[_0xdca1('0x2a')](respondWithResult(_0x2f9a6c,null))[_0xdca1('0x4d')](handleError(_0x2f9a6c,null));};exports[_0xdca1('0x73')]=function(_0x56631b,_0x4e7a76,_0x2c1eb1){return db[_0xdca1('0x32')][_0xdca1('0x51')]({'where':{'id':_0x56631b[_0xdca1('0x4f')]['id']}})[_0xdca1('0x2a')](handleEntityNotFound(_0x4e7a76,null))['then'](function(_0x5e4dda){if(_0x5e4dda){return _0x5e4dda['removeAgents'](_0x56631b['query'][_0xdca1('0x71')])[_0xdca1('0x2a')](function(){if(_[_0xdca1('0x74')](_0x56631b[_0xdca1('0x36')]['ids'])){for(var _0x216d3d=0x0;_0x216d3d<_0x56631b[_0xdca1('0x36')]['ids'][_0xdca1('0x3d')];_0x216d3d+=0x1){socket['emit'](_0xdca1('0x75'),{'UserId':Number(_0x56631b['query'][_0xdca1('0x71')][_0x216d3d]),'VoicePrefixId':Number(_0x56631b[_0xdca1('0x4f')]['id'])});}}else{socket[_0xdca1('0x76')](_0xdca1('0x75'),{'UserId':Number(_0x56631b[_0xdca1('0x36')][_0xdca1('0x71')]),'VoicePrefixId':Number(_0x56631b[_0xdca1('0x4f')]['id'])});}});}})[_0xdca1('0x2a')](respondWithStatusCode(_0x4e7a76,null))[_0xdca1('0x4d')](handleError(_0x4e7a76,null));};exports[_0xdca1('0x77')]=function(_0x555a42,_0xdfb539,_0x170a7a){var _0x24ab55={};var _0x370b87={};var _0x4ea3d1;var _0x1af46d;return db[_0xdca1('0x32')][_0xdca1('0x78')]({'where':{'id':_0x555a42[_0xdca1('0x4f')]['id']}})[_0xdca1('0x2a')](handleEntityNotFound(_0xdfb539,null))['then'](function(_0x273c80){if(_0x273c80){_0x4ea3d1=_0x273c80;_0x370b87[_0xdca1('0x3b')]=_[_0xdca1('0x37')](db[_0xdca1('0x79')]['rawAttributes']);_0x370b87['query']=_[_0xdca1('0x37')](_0x555a42[_0xdca1('0x36')]);_0x370b87['filters']=_['intersection'](_0x370b87[_0xdca1('0x3b')],_0x370b87['query']);_0x24ab55[_0xdca1('0x3a')]=_[_0xdca1('0x39')](_0x370b87['model'],qs[_0xdca1('0x3c')](_0x555a42['query'][_0xdca1('0x3c')]));_0x24ab55['attributes']=_0x24ab55[_0xdca1('0x3a')][_0xdca1('0x3d')]?_0x24ab55[_0xdca1('0x3a')]:_0x370b87['model'];_0x24ab55['order']=qs['sort'](_0x555a42[_0xdca1('0x36')][_0xdca1('0x41')]);_0x24ab55[_0xdca1('0x44')]=qs[_0xdca1('0x38')](_[_0xdca1('0x42')](_0x555a42[_0xdca1('0x36')],_0x370b87['filters']));if(_0x555a42['query']['filter']){_0x24ab55['where']=_['merge'](_0x24ab55[_0xdca1('0x44')],{'$or':_[_0xdca1('0x46')](_0x24ab55[_0xdca1('0x3a')],function(_0x42dd63){var _0x5ef442={};_0x5ef442[_0x42dd63]={'$like':'%'+_0x555a42[_0xdca1('0x36')]['filter']+'%'};return _0x5ef442;})});}_0x24ab55=_['merge']({},_0x24ab55,_0x555a42[_0xdca1('0x49')]);return _0x4ea3d1[_0xdca1('0x77')](_0x24ab55);}})['then'](function(_0x4c5378){if(_0x4c5378){_0x1af46d=_0x4c5378[_0xdca1('0x3d')];if(!_0x555a42['query'][_0xdca1('0x3e')](_0xdca1('0x3f'))){_0x24ab55[_0xdca1('0x24')]=qs[_0xdca1('0x24')](_0x555a42[_0xdca1('0x36')][_0xdca1('0x24')]);_0x24ab55[_0xdca1('0x22')]=qs[_0xdca1('0x22')](_0x555a42[_0xdca1('0x36')][_0xdca1('0x22')]);}return _0x4ea3d1[_0xdca1('0x77')](_0x24ab55);}})[_0xdca1('0x2a')](function(_0x1b0d4d){if(_0x1b0d4d){return _0x1b0d4d?{'count':_0x1af46d,'rows':_0x1b0d4d}:null;}})['then'](respondWithResult(_0xdfb539,null))['catch'](handleError(_0xdfb539,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 20a8895..63b5bbc 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 _0x41c5=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoicePrefix','setMaxListeners'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x41c5,0x8c));var _0x541c=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x41c5[_0x19950b];return _0x3c6b41;};'use strict';var EventEmitter=require(_0x541c('0x0'));var VoicePrefix=require(_0x541c('0x1'))['db'][_0x541c('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x541c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x541c('0x4')};function emitEvent(_0x3bfc09){return function(_0x3e8907,_0x1eb400,_0x3caaa4){VoicePrefixEvents[_0x541c('0x5')](_0x3bfc09+':'+_0x3e8907['id'],_0x3e8907);VoicePrefixEvents[_0x541c('0x5')](_0x3bfc09,_0x3e8907);_0x3caaa4(null);};}for(var e in events){if(events[_0x541c('0x6')](e)){var event=events[e];VoicePrefix[_0x541c('0x7')](e,emitEvent(event));}}module[_0x541c('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0x84c2=['emit','hook','events','../../mysqldb','VoicePrefix','setMaxListeners','remove'];(function(_0x17054e,_0x312ea4){var _0x30d59f=function(_0x4c4887){while(--_0x4c4887){_0x17054e['push'](_0x17054e['shift']());}};_0x30d59f(++_0x312ea4);}(_0x84c2,0xcd));var _0x284c=function(_0x5b11c3,_0x126c21){_0x5b11c3=_0x5b11c3-0x0;var _0x586d00=_0x84c2[_0x5b11c3];return _0x586d00;};'use strict';var EventEmitter=require(_0x284c('0x0'));var VoicePrefix=require(_0x284c('0x1'))['db'][_0x284c('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x284c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x284c('0x4')};function emitEvent(_0x1f0e3f){return function(_0x55648f,_0x44ae0c,_0x27b8e4){VoicePrefixEvents[_0x284c('0x5')](_0x1f0e3f+':'+_0x55648f['id'],_0x55648f);VoicePrefixEvents[_0x284c('0x5')](_0x1f0e3f,_0x55648f);_0x27b8e4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0x284c('0x6')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 2d27816..6cb388f 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 _0x8742=['define','VoicePrefix','voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./voicePrefix.attributes','exports'];(function(_0x505108,_0x573bbd){var _0x376bdc=function(_0x36f30d){while(--_0x36f30d){_0x505108['push'](_0x505108['shift']());}};_0x376bdc(++_0x573bbd);}(_0x8742,0xf3));var _0x2874=function(_0x3fb520,_0x9d07d5){_0x3fb520=_0x3fb520-0x0;var _0x42d9f7=_0x8742[_0x3fb520];return _0x42d9f7;};'use strict';var _=require(_0x2874('0x0'));var util=require(_0x2874('0x1'));var logger=require(_0x2874('0x2'))(_0x2874('0x3'));var moment=require(_0x2874('0x4'));var BPromise=require(_0x2874('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2874('0x6'));var attributes=require(_0x2874('0x7'));module[_0x2874('0x8')]=function(_0x13e8ec,_0xac2156){return _0x13e8ec[_0x2874('0x9')](_0x2874('0xa'),attributes,{'tableName':_0x2874('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b14=['VoicePrefix','voice_prefixes','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define'];(function(_0x1dc1e2,_0x4c6a04){var _0x1ef851=function(_0x335a86){while(--_0x335a86){_0x1dc1e2['push'](_0x1dc1e2['shift']());}};_0x1ef851(++_0x4c6a04);}(_0x0b14,0xc8));var _0x40b1=function(_0x216586,_0x3be6ec){_0x216586=_0x216586-0x0;var _0x24987f=_0x0b14[_0x216586];return _0x24987f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x40b1('0x0'))('api');var moment=require(_0x40b1('0x1'));var BPromise=require('bluebird');var rp=require(_0x40b1('0x2'));var fs=require('fs');var path=require(_0x40b1('0x3'));var rimraf=require(_0x40b1('0x4'));var config=require(_0x40b1('0x5'));var attributes=require(_0x40b1('0x6'));module[_0x40b1('0x7')]=function(_0x3ea0c0,_0x4ff393){return _0x3ea0c0[_0x40b1('0x8')](_0x40b1('0x9'),attributes,{'tableName':_0x40b1('0xa'),'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 85e142a..6a8a86c 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 _0x2b29=['code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','./voicePrefix.socket','register','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x49dc5b,_0x47647b){var _0x562e00=function(_0x5df3ab){while(--_0x5df3ab){_0x49dc5b['push'](_0x49dc5b['shift']());}};_0x562e00(++_0x47647b);}(_0x2b29,0x163));var _0x92b2=function(_0x410225,_0x38f3e0){_0x410225=_0x410225-0x0;var _0xfaed1=_0x2b29[_0x410225];return _0xfaed1;};'use strict';var _=require('lodash');var util=require(_0x92b2('0x0'));var moment=require(_0x92b2('0x1'));var BPromise=require(_0x92b2('0x2'));var rs=require(_0x92b2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x92b2('0x4'))['db'];var utils=require(_0x92b2('0x5'));var logger=require(_0x92b2('0x6'))(_0x92b2('0x7'));var config=require(_0x92b2('0x8'));var jayson=require(_0x92b2('0x9'));var client=jayson['client'][_0x92b2('0xa')]({'port':0x232a});config['redis']=_[_0x92b2('0xb')](config[_0x92b2('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x92b2('0xd'))(new Redis(config[_0x92b2('0xc')]));require(_0x92b2('0xe'))[_0x92b2('0xf')](socket);function respondWithRpcPromise(_0x592c9e,_0x2b17de,_0x21bbf5){return new BPromise(function(_0x187eab,_0x1ef7f3){return client[_0x92b2('0x10')](_0x592c9e,_0x21bbf5)[_0x92b2('0x11')](function(_0xa18d4e){logger['info'](_0x92b2('0x12'),_0x2b17de,_0x92b2('0x13'));logger[_0x92b2('0x14')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x2b17de,_0x92b2('0x13'),JSON[_0x92b2('0x15')](_0xa18d4e));if(_0xa18d4e[_0x92b2('0x16')]){if(_0xa18d4e[_0x92b2('0x16')][_0x92b2('0x17')]===0x1f4){logger[_0x92b2('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x2b17de,_0xa18d4e[_0x92b2('0x16')]['message']);return _0x1ef7f3(_0xa18d4e[_0x92b2('0x16')][_0x92b2('0x18')]);}logger[_0x92b2('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x2b17de,_0xa18d4e['error'][_0x92b2('0x18')]);return _0x187eab(_0xa18d4e['error'][_0x92b2('0x18')]);}else{logger['info'](_0x92b2('0x12'),_0x2b17de,_0x92b2('0x13'));_0x187eab(_0xa18d4e[_0x92b2('0x19')][_0x92b2('0x18')]);}})[_0x92b2('0x1a')](function(_0x3dfd47){logger[_0x92b2('0x16')](_0x92b2('0x12'),_0x2b17de,_0x3dfd47);_0x1ef7f3(_0x3dfd47);});});} \ No newline at end of file +var _0x4e83=['bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','redis','defaults','socket.io-emitter','./voicePrefix.socket','request','then','info','request\x20sent','debug','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','result','catch','lodash','moment'];(function(_0x3738e7,_0x358aca){var _0x13ff86=function(_0xb5da50){while(--_0xb5da50){_0x3738e7['push'](_0x3738e7['shift']());}};_0x13ff86(++_0x358aca);}(_0x4e83,0x1ae));var _0x34e8=function(_0x39686e,_0x3d83bb){_0x39686e=_0x39686e-0x0;var _0x1b765e=_0x4e83[_0x39686e];return _0x1b765e;};'use strict';var _=require(_0x34e8('0x0'));var util=require('util');var moment=require(_0x34e8('0x1'));var BPromise=require(_0x34e8('0x2'));var rs=require(_0x34e8('0x3'));var fs=require('fs');var Redis=require(_0x34e8('0x4'));var db=require(_0x34e8('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x34e8('0x6'));var client=jayson[_0x34e8('0x7')]['http']({'port':0x232a});config[_0x34e8('0x8')]=_[_0x34e8('0x9')](config[_0x34e8('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x34e8('0xa'))(new Redis(config[_0x34e8('0x8')]));require(_0x34e8('0xb'))['register'](socket);function respondWithRpcPromise(_0x8ad56d,_0x1e3038,_0x42bb8d){return new BPromise(function(_0x46fe66,_0x316e99){return client[_0x34e8('0xc')](_0x8ad56d,_0x42bb8d)[_0x34e8('0xd')](function(_0x6827a3){logger[_0x34e8('0xe')]('VoicePrefix,\x20%s,\x20%s',_0x1e3038,_0x34e8('0xf'));logger[_0x34e8('0x10')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x1e3038,_0x34e8('0xf'),JSON[_0x34e8('0x11')](_0x6827a3));if(_0x6827a3[_0x34e8('0x12')]){if(_0x6827a3[_0x34e8('0x12')][_0x34e8('0x13')]===0x1f4){logger[_0x34e8('0x12')](_0x34e8('0x14'),_0x1e3038,_0x6827a3[_0x34e8('0x12')][_0x34e8('0x15')]);return _0x316e99(_0x6827a3['error'][_0x34e8('0x15')]);}logger[_0x34e8('0x12')](_0x34e8('0x14'),_0x1e3038,_0x6827a3[_0x34e8('0x12')][_0x34e8('0x15')]);return _0x46fe66(_0x6827a3['error'][_0x34e8('0x15')]);}else{logger[_0x34e8('0xe')](_0x34e8('0x14'),_0x1e3038,_0x34e8('0xf'));_0x46fe66(_0x6827a3[_0x34e8('0x16')][_0x34e8('0x15')]);}})[_0x34e8('0x17')](function(_0x3eb461){logger[_0x34e8('0x12')](_0x34e8('0x14'),_0x1e3038,_0x3eb461);_0x316e99(_0x3eb461);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index c4057d2..e207634 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 _0x98b8=['removeListener','register','voicePrefix:','./voicePrefix.events','save','remove','update','emit'];(function(_0x3a48c8,_0x11e3c5){var _0x54822e=function(_0x447730){while(--_0x447730){_0x3a48c8['push'](_0x3a48c8['shift']());}};_0x54822e(++_0x11e3c5);}(_0x98b8,0x93));var _0x898b=function(_0x408b1e,_0x4fd20f){_0x408b1e=_0x408b1e-0x0;var _0x231e81=_0x98b8[_0x408b1e];return _0x231e81;};'use strict';var VoicePrefixEvents=require(_0x898b('0x0'));var events=[_0x898b('0x1'),_0x898b('0x2'),_0x898b('0x3')];function createListener(_0x17a43c,_0x141e59){return function(_0x86f457){_0x141e59[_0x898b('0x4')](_0x17a43c,_0x86f457);};}function removeListener(_0xc90f04,_0x7aea2f){return function(){VoicePrefixEvents[_0x898b('0x5')](_0xc90f04,_0x7aea2f);};}exports[_0x898b('0x6')]=function(_0x1ddef6){for(var _0x27b2fd=0x0,_0x124030=events['length'];_0x27b2fd<_0x124030;_0x27b2fd++){var _0x3989f9=events[_0x27b2fd];var _0x32e2e=createListener(_0x898b('0x7')+_0x3989f9,_0x1ddef6);VoicePrefixEvents['on'](_0x3989f9,_0x32e2e);}}; \ No newline at end of file +var _0x7117=['register','voicePrefix:','./voicePrefix.events','save','remove','update','removeListener'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x7117,0x1ec));var _0x7711=function(_0x518e25,_0x471d5d){_0x518e25=_0x518e25-0x0;var _0x5becaf=_0x7117[_0x518e25];return _0x5becaf;};'use strict';var VoicePrefixEvents=require(_0x7711('0x0'));var events=[_0x7711('0x1'),_0x7711('0x2'),_0x7711('0x3')];function createListener(_0x57ab3f,_0x3a55de){return function(_0x348cc0){_0x3a55de['emit'](_0x57ab3f,_0x348cc0);};}function removeListener(_0x3c7467,_0x508c33){return function(){VoicePrefixEvents[_0x7711('0x4')](_0x3c7467,_0x508c33);};}exports[_0x7711('0x5')]=function(_0x414dcc){for(var _0x5ca3dc=0x0,_0x492137=events['length'];_0x5ca3dc<_0x492137;_0x5ca3dc++){var _0x50acc7=events[_0x5ca3dc];var _0x390862=createListener(_0x7711('0x6')+_0x50acc7,_0x414dcc);VoicePrefixEvents['on'](_0x50acc7,_0x390862);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 4ac6bbc..283c815 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 _0x7aa7=['getMembers','/:id/lists','getLists','/:id/blacklists','post','create','clone','addTeams','addAgents','addLists','addBlackLists','put','update','destroy','delete','removeTeams','removeAgents','removeBlackLists','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./voiceQueue.controller','isAuthenticated','index','/:id','show','get','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents'];(function(_0x4b4f45,_0x3e2865){var _0x1b3d3c=function(_0x5b2fed){while(--_0x5b2fed){_0x4b4f45['push'](_0x4b4f45['shift']());}};_0x1b3d3c(++_0x3e2865);}(_0x7aa7,0x94));var _0x77aa=function(_0x403feb,_0x407396){_0x403feb=_0x403feb-0x0;var _0xc7e78c=_0x7aa7[_0x403feb];return _0xc7e78c;};'use strict';var multer=require(_0x77aa('0x0'));var util=require(_0x77aa('0x1'));var path=require('path');var timeout=require(_0x77aa('0x2'));var express=require(_0x77aa('0x3'));var router=express[_0x77aa('0x4')]();var fs_extra=require(_0x77aa('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x77aa('0x6'));var controller=require(_0x77aa('0x7'));router['get']('/',auth[_0x77aa('0x8')](),controller[_0x77aa('0x9')]);router['get'](_0x77aa('0xa'),auth[_0x77aa('0x8')](),controller[_0x77aa('0xb')]);router[_0x77aa('0xc')](_0x77aa('0xd'),auth[_0x77aa('0x8')](),controller['getHoppers']);router['get'](_0x77aa('0xe'),auth[_0x77aa('0x8')](),controller[_0x77aa('0xf')]);router['get'](_0x77aa('0x10'),auth['isAuthenticated'](),controller[_0x77aa('0x11')]);router[_0x77aa('0xc')](_0x77aa('0x12'),auth[_0x77aa('0x8')](),controller[_0x77aa('0x13')]);router[_0x77aa('0xc')](_0x77aa('0x14'),auth[_0x77aa('0x8')](),controller[_0x77aa('0x15')]);router[_0x77aa('0xc')](_0x77aa('0x16'),auth[_0x77aa('0x8')](),controller[_0x77aa('0x17')]);router[_0x77aa('0xc')]('/:id/members',auth[_0x77aa('0x8')](),controller[_0x77aa('0x18')]);router['get'](_0x77aa('0x19'),auth[_0x77aa('0x8')](),controller[_0x77aa('0x1a')]);router['get'](_0x77aa('0x1b'),auth[_0x77aa('0x8')](),controller['getBlackLists']);router[_0x77aa('0x1c')]('/',auth[_0x77aa('0x8')](),controller[_0x77aa('0x1d')]);router['post']('/:id/clone',auth[_0x77aa('0x8')](),controller[_0x77aa('0x1e')]);router['post']('/:id/teams',auth['isAuthenticated'](),controller[_0x77aa('0x1f')]);router[_0x77aa('0x1c')](_0x77aa('0x16'),auth['isAuthenticated'](),controller[_0x77aa('0x20')]);router[_0x77aa('0x1c')](_0x77aa('0x19'),auth[_0x77aa('0x8')](),controller[_0x77aa('0x21')]);router[_0x77aa('0x1c')](_0x77aa('0x1b'),auth[_0x77aa('0x8')](),controller[_0x77aa('0x22')]);router[_0x77aa('0x23')](_0x77aa('0xa'),auth[_0x77aa('0x8')](),controller[_0x77aa('0x24')]);router['delete'](_0x77aa('0xa'),auth['isAuthenticated'](),controller[_0x77aa('0x25')]);router[_0x77aa('0x26')](_0x77aa('0x14'),auth['isAuthenticated'](),controller[_0x77aa('0x27')]);router[_0x77aa('0x26')]('/:id/users',auth[_0x77aa('0x8')](),controller[_0x77aa('0x28')]);router[_0x77aa('0x26')](_0x77aa('0x19'),auth[_0x77aa('0x8')](),controller['removeLists']);router[_0x77aa('0x26')](_0x77aa('0x1b'),auth[_0x77aa('0x8')](),controller[_0x77aa('0x29')]);module[_0x77aa('0x2a')]=router; \ No newline at end of file +var _0xca1f=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueue.controller','get','isAuthenticated','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','getAgents','/:id/members','getLists','create','post','/:id/clone','clone','addTeams','addAgents','/:id/lists','addLists','/:id/blacklists','put','update','delete','destroy','/:id/users','removeAgents','removeLists','exports','multer'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xca1f,0xa3));var _0xfca1=function(_0x399abe,_0x555f0a){_0x399abe=_0x399abe-0x0;var _0x1dc11e=_0xca1f[_0x399abe];return _0x1dc11e;};'use strict';var multer=require(_0xfca1('0x0'));var util=require('util');var path=require(_0xfca1('0x1'));var timeout=require(_0xfca1('0x2'));var express=require(_0xfca1('0x3'));var router=express[_0xfca1('0x4')]();var fs_extra=require(_0xfca1('0x5'));var auth=require(_0xfca1('0x6'));var interaction=require(_0xfca1('0x7'));var config=require('../../config/environment');var controller=require(_0xfca1('0x8'));router[_0xfca1('0x9')]('/',auth[_0xfca1('0xa')](),controller['index']);router[_0xfca1('0x9')](_0xfca1('0xb'),auth[_0xfca1('0xa')](),controller[_0xfca1('0xc')]);router[_0xfca1('0x9')](_0xfca1('0xd'),auth[_0xfca1('0xa')](),controller[_0xfca1('0xe')]);router[_0xfca1('0x9')](_0xfca1('0xf'),auth[_0xfca1('0xa')](),controller['getHopperHistories']);router[_0xfca1('0x9')]('/:id/hopper_finals',auth[_0xfca1('0xa')](),controller[_0xfca1('0x10')]);router['get'](_0xfca1('0x11'),auth['isAuthenticated'](),controller[_0xfca1('0x12')]);router['get'](_0xfca1('0x13'),auth[_0xfca1('0xa')](),controller[_0xfca1('0x14')]);router[_0xfca1('0x9')]('/:id/users',auth[_0xfca1('0xa')](),controller[_0xfca1('0x15')]);router[_0xfca1('0x9')](_0xfca1('0x16'),auth[_0xfca1('0xa')](),controller['getMembers']);router[_0xfca1('0x9')]('/:id/lists',auth[_0xfca1('0xa')](),controller[_0xfca1('0x17')]);router[_0xfca1('0x9')]('/:id/blacklists',auth[_0xfca1('0xa')](),controller['getBlackLists']);router['post']('/',auth[_0xfca1('0xa')](),controller[_0xfca1('0x18')]);router[_0xfca1('0x19')](_0xfca1('0x1a'),auth[_0xfca1('0xa')](),controller[_0xfca1('0x1b')]);router[_0xfca1('0x19')](_0xfca1('0x13'),auth[_0xfca1('0xa')](),controller[_0xfca1('0x1c')]);router[_0xfca1('0x19')]('/:id/users',auth[_0xfca1('0xa')](),controller[_0xfca1('0x1d')]);router[_0xfca1('0x19')](_0xfca1('0x1e'),auth[_0xfca1('0xa')](),controller[_0xfca1('0x1f')]);router['post'](_0xfca1('0x20'),auth[_0xfca1('0xa')](),controller['addBlackLists']);router[_0xfca1('0x21')](_0xfca1('0xb'),auth[_0xfca1('0xa')](),controller[_0xfca1('0x22')]);router[_0xfca1('0x23')](_0xfca1('0xb'),auth[_0xfca1('0xa')](),controller[_0xfca1('0x24')]);router['delete']('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);router['delete'](_0xfca1('0x25'),auth[_0xfca1('0xa')](),controller[_0xfca1('0x26')]);router[_0xfca1('0x23')](_0xfca1('0x1e'),auth['isAuthenticated'](),controller[_0xfca1('0x27')]);router[_0xfca1('0x23')](_0xfca1('0x20'),auth[_0xfca1('0xa')](),controller['removeBlackLists']);module[_0xfca1('0x28')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 0e760f8..fe514ce 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 _0x7cad=['Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','mandatoryDispositionPauseId','sequelize','exports','STRING','name','inbound','outbound','ENUM','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','getDataValue','dialMethod','booked','progressive','predictive','power','INTEGER','yes','all','once','periodic_announce','join','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.','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\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)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x7cad,0x13b));var _0xd7ca=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x7cad[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0xd7ca('0x0'));module[_0xd7ca('0x1')]={'name':{'type':Sequelize[_0xd7ca('0x2')],'allowNull':![],'unique':_0xd7ca('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xd7ca('0x4'),_0xd7ca('0x5')),'allowNull':![],'defaultValue':_0xd7ca('0x4')},'musiconhold':{'type':Sequelize[_0xd7ca('0x2')],'defaultValue':'default'},'announce':{'type':Sequelize[_0xd7ca('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0xd7ca('0x6')]('rr',_0xd7ca('0x7'),_0xd7ca('0x8'),_0xd7ca('0x9'),_0xd7ca('0xa'),_0xd7ca('0xb'),_0xd7ca('0xc'),_0xd7ca('0xd'),_0xd7ca('0xe')),'allowNull':![],'defaultValue':'ringall','set':function(_0xcb41ce){this[_0xd7ca('0xf')](_0xd7ca('0x10'),_0xcb41ce?_0xcb41ce:_0xd7ca('0xb'));},'get':function(){var _0x3aee18=this['getDataValue']('type');var _0x2affd3=this[_0xd7ca('0x11')](_0xd7ca('0x12'));var _0x5bf741=this[_0xd7ca('0x11')](_0xd7ca('0x10'));if(_0x3aee18==='inbound'){return _0x5bf741;}if(_0x2affd3===_0xd7ca('0x13')&&_0x5bf741==='rrmemory'||_0x2affd3===_0xd7ca('0x13')&&_0x5bf741==='roundrobin'){return _0x5bf741;}if(_0x2affd3===_0xd7ca('0x14')||_0x2affd3===_0xd7ca('0x15')||_0x2affd3===_0xd7ca('0x16')){return _0x5bf741;}return null;}},'servicelevel':{'type':Sequelize[_0xd7ca('0x17')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xd7ca('0x17')](0xb)},'timeout':{'type':Sequelize[_0xd7ca('0x17')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xd7ca('0x17')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0xd7ca('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xd7ca('0x6')](_0xd7ca('0x18'),'no'),'defaultValue':_0xd7ca('0x18')},'autopause':{'type':Sequelize[_0xd7ca('0x6')](_0xd7ca('0x18'),'no',_0xd7ca('0x19')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xd7ca('0x17')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0xd7ca('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xd7ca('0x6')](_0xd7ca('0x18'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xd7ca('0x17')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xd7ca('0x6')](_0xd7ca('0x18'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0xd7ca('0x18'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0xd7ca('0x18'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xd7ca('0x6')](_0xd7ca('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xd7ca('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xd7ca('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xd7ca('0x17')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xd7ca('0x17')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xd7ca('0x17')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0xd7ca('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xd7ca('0x6')]('yes','no'),'defaultValue':_0xd7ca('0x18')},'announce_holdtime':{'type':Sequelize[_0xd7ca('0x6')]('yes','no',_0xd7ca('0x1a')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xd7ca('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0xd7ca('0x18'),'no')},'announce_position_limit':{'type':Sequelize[_0xd7ca('0x17')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xd7ca('0x6')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xd7ca('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0xd7ca('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xd7ca('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xd7ca('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xd7ca('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xd7ca('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xd7ca('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0xd7ca('0x2')]},'queue_quantity2':{'type':Sequelize[_0xd7ca('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0xd7ca('0x2')]},'queue_less_than':{'type':Sequelize[_0xd7ca('0x2')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x42aa4d){this['setDataValue'](_0xd7ca('0x1b'),_0x42aa4d?_0x42aa4d[_0xd7ca('0x1c')](','):[]);},'get':function(){return this['getDataValue'](_0xd7ca('0x1b'))?this[_0xd7ca('0x11')](_0xd7ca('0x1b'))[_0xd7ca('0x1d')](','):[];}},'joinempty':{'type':Sequelize[_0xd7ca('0x2')],'defaultValue':_0xd7ca('0x18'),'set':function(_0x4d06ee){this[_0xd7ca('0xf')](_0xd7ca('0x1e'),_0x4d06ee?_0x4d06ee[_0xd7ca('0x1c')](','):undefined);},'get':function(){return this[_0xd7ca('0x11')](_0xd7ca('0x1e'))?this[_0xd7ca('0x11')](_0xd7ca('0x1e'))[_0xd7ca('0x1d')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xd7ca('0x2')],'defaultValue':'no','set':function(_0x2d0088){this[_0xd7ca('0xf')](_0xd7ca('0x1f'),_0x2d0088?_0x2d0088[_0xd7ca('0x1c')](','):undefined);},'get':function(){return this['getDataValue'](_0xd7ca('0x1f'))?this['getDataValue'](_0xd7ca('0x1f'))[_0xd7ca('0x1d')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0xd7ca('0x18'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xd7ca('0x6')](_0xd7ca('0x18'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xd7ca('0x17')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xd7ca('0x6')](_0xd7ca('0x18'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xd7ca('0x2')]},'description':{'type':Sequelize[_0xd7ca('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x1264ba){this['setDataValue'](_0xd7ca('0x20'),_0x1264ba);if(_0x1264ba){if(this[_0xd7ca('0x11')](_0xd7ca('0x21'))<0x2){this[_0xd7ca('0xf')](_0xd7ca('0x21'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xd7ca('0x17')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xd7ca('0x22')],'defaultValue':0x0,'comment':_0xd7ca('0x23')},'dialMethod':{'type':Sequelize[_0xd7ca('0x6')]('preview',_0xd7ca('0x14'),_0xd7ca('0x16'),_0xd7ca('0x15'),_0xd7ca('0x13')),'defaultValue':_0xd7ca('0x14'),'comment':_0xd7ca('0x24')},'dialLimitChannel':{'type':Sequelize[_0xd7ca('0x17')](0x4)[_0xd7ca('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xd7ca('0x26')},'dialLimitQueue':{'type':Sequelize[_0xd7ca('0x17')](0x4)[_0xd7ca('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xd7ca('0x27')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0xd7ca('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0xd7ca('0x6')](_0xd7ca('0x28'),_0xd7ca('0x29')),'defaultValue':'dropRate','comment':_0xd7ca('0x2a')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xd7ca('0x2b')},'dialPredictiveInterval':{'type':Sequelize[_0xd7ca('0x17')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0xd7ca('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xd7ca('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xd7ca('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd7ca('0x2c')},'dialQueueOptions':{'type':Sequelize[_0xd7ca('0x2')],'defaultValue':_0xd7ca('0x2d'),'comment':_0xd7ca('0x2e')},'dialQueueTimeout':{'type':Sequelize[_0xd7ca('0x17')](0x3)[_0xd7ca('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd7ca('0x2f')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0xd7ca('0x30')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd7ca('0x31')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xd7ca('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd7ca('0x32')},'dialBusyMaxRetry':{'type':Sequelize[_0xd7ca('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd7ca('0x33')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xd7ca('0x17')](0x3)[_0xd7ca('0x25')],'defaultValue':0x3,'comment':_0xd7ca('0x34')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xd7ca('0x17')](0x5)[_0xd7ca('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd7ca('0x25')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xd7ca('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xd7ca('0x2')],'defaultValue':_0xd7ca('0x35')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xd7ca('0x36'),_0xd7ca('0x37'),_0xd7ca('0x38')),'defaultValue':_0xd7ca('0x36')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xd7ca('0x25')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xd7ca('0x39')},'dialAMDGreeting':{'type':Sequelize[_0xd7ca('0x17')](0x9)[_0xd7ca('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xd7ca('0x3a')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xd7ca('0x17')](0x9)[_0xd7ca('0x25')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xd7ca('0x17')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd7ca('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0xd7ca('0x17')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xd7ca('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xd7ca('0x17')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xd7ca('0x17')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xd7ca('0x17')](0x5)[_0xd7ca('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xd7ca('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xd7ca('0x17')](0x9)[_0xd7ca('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0xd7ca('0x17')](0x5)[_0xd7ca('0x25')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xd7ca('0x3e')},'dialRecallInQueue':{'type':Sequelize[_0xd7ca('0x22')],'defaultValue':0x0,'comment':_0xd7ca('0x3f')},'dialOrderByScheduledAt':{'type':Sequelize[_0xd7ca('0x6')](_0xd7ca('0x40'),'ASC'),'defaultValue':_0xd7ca('0x40')},'dialQueueProject2':{'type':Sequelize[_0xd7ca('0x2')],'comment':_0xd7ca('0x30')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xd7ca('0x22')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xd7ca('0x22')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xd7ca('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xd7ca('0x17')](0x3)[_0xd7ca('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd7ca('0x41')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xd7ca('0x17')](0x3)[_0xd7ca('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd7ca('0x42')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xd7ca('0x17')](0x5)[_0xd7ca('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd7ca('0x43')},'dialDropMaxRetry':{'type':Sequelize[_0xd7ca('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd7ca('0x44')},'dialDropRetryFrequency':{'type':Sequelize[_0xd7ca('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd7ca('0x45')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd7ca('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd7ca('0x46')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd7ca('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd7ca('0x47')},'dialMachineMaxRetry':{'type':Sequelize[_0xd7ca('0x17')](0x3)[_0xd7ca('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd7ca('0x48')},'dialMachineRetryFrequency':{'type':Sequelize[_0xd7ca('0x17')](0x5)[_0xd7ca('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd7ca('0x49')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xd7ca('0x17')](0x3)[_0xd7ca('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd7ca('0x4a')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd7ca('0x17')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x43832c){if(!_0x43832c)this[_0xd7ca('0xf')](_0xd7ca('0x4b'),null);this['setDataValue']('mandatoryDisposition',_0x43832c);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xd7ca('0x17')](0x3)[_0xd7ca('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xd7ca('0x17')](0x3)[_0xd7ca('0x25')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xd7ca('0x17')](0x3)[_0xd7ca('0x25')],'defaultValue':0x4}}; \ No newline at end of file +var _0xea29=['getDataValue','type','dialMethod','booked','roundrobin','predictive','power','STRING','INTEGER','yes','all','once','TEXT','join','periodic_announce','split','joinempty','leavewhenempty','BOOLEAN','acw','Active/Disactive\x20Campaign','preview','progressive','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','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','ENUM','inbound','outbound','default','leastrecent','fewestcalls','linear','ringall','setDataValue','strategy','rrmemory'];(function(_0xa60e64,_0x3b89b0){var _0x551d5f=function(_0x171771){while(--_0x171771){_0xa60e64['push'](_0xa60e64['shift']());}};_0x551d5f(++_0x3b89b0);}(_0xea29,0x87));var _0x9ea2=function(_0x4b0290,_0x188c34){_0x4b0290=_0x4b0290-0x0;var _0x4bd9f4=_0xea29[_0x4b0290];return _0x4bd9f4;};'use strict';var Sequelize=require(_0x9ea2('0x0'));module[_0x9ea2('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x9ea2('0x2')](_0x9ea2('0x3'),_0x9ea2('0x4')),'allowNull':![],'defaultValue':_0x9ea2('0x3')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0x9ea2('0x5')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x9ea2('0x2')]('rr','ringall',_0x9ea2('0x6'),_0x9ea2('0x7'),'random','rrmemory',_0x9ea2('0x8'),'wrandom','rrordered'),'allowNull':![],'defaultValue':_0x9ea2('0x9'),'set':function(_0x5f0223){this[_0x9ea2('0xa')](_0x9ea2('0xb'),_0x5f0223?_0x5f0223:_0x9ea2('0xc'));},'get':function(){var _0x5509b1=this[_0x9ea2('0xd')](_0x9ea2('0xe'));var _0x50316a=this[_0x9ea2('0xd')](_0x9ea2('0xf'));var _0x1d7b90=this[_0x9ea2('0xd')](_0x9ea2('0xb'));if(_0x5509b1==='inbound'){return _0x1d7b90;}if(_0x50316a===_0x9ea2('0x10')&&_0x1d7b90===_0x9ea2('0xc')||_0x50316a===_0x9ea2('0x10')&&_0x1d7b90===_0x9ea2('0x11')){return _0x1d7b90;}if(_0x50316a==='progressive'||_0x50316a===_0x9ea2('0x12')||_0x50316a===_0x9ea2('0x13')){return _0x1d7b90;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x9ea2('0x14')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x9ea2('0x15')](0xb)},'timeout':{'type':Sequelize[_0x9ea2('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x9ea2('0x14')]},'weight':{'type':Sequelize[_0x9ea2('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x9ea2('0x15')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x9ea2('0x2')](_0x9ea2('0x16'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize['ENUM'](_0x9ea2('0x16'),'no',_0x9ea2('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x9ea2('0x15')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0x9ea2('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x9ea2('0x2')](_0x9ea2('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x9ea2('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x9ea2('0x2')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x9ea2('0x2')](_0x9ea2('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x9ea2('0x2')](_0x9ea2('0x16'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0x9ea2('0x16'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x9ea2('0x14')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x9ea2('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x9ea2('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x9ea2('0x2')](_0x9ea2('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x9ea2('0x16')},'announce_holdtime':{'type':Sequelize[_0x9ea2('0x2')](_0x9ea2('0x16'),'no',_0x9ea2('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x9ea2('0x14')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x9ea2('0x2')](_0x9ea2('0x16'),'no')},'announce_position_limit':{'type':Sequelize[_0x9ea2('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x9ea2('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x9ea2('0x14')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0x9ea2('0x14')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x9ea2('0x14')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x9ea2('0x14')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x9ea2('0x14')]},'queue_quantity2':{'type':Sequelize[_0x9ea2('0x14')]},'queue_periodic_announce':{'type':Sequelize[_0x9ea2('0x14')]},'queue_less_than':{'type':Sequelize[_0x9ea2('0x14')]},'periodic_announce':{'type':Sequelize[_0x9ea2('0x19')],'set':function(_0x297624){this[_0x9ea2('0xa')]('periodic_announce',_0x297624?_0x297624[_0x9ea2('0x1a')](','):[]);},'get':function(){return this['getDataValue'](_0x9ea2('0x1b'))?this[_0x9ea2('0xd')](_0x9ea2('0x1b'))[_0x9ea2('0x1c')](','):[];}},'joinempty':{'type':Sequelize[_0x9ea2('0x14')],'defaultValue':_0x9ea2('0x16'),'set':function(_0x2789ce){this['setDataValue']('joinempty',_0x2789ce?_0x2789ce[_0x9ea2('0x1a')](','):undefined);},'get':function(){return this[_0x9ea2('0xd')](_0x9ea2('0x1d'))?this[_0x9ea2('0xd')](_0x9ea2('0x1d'))[_0x9ea2('0x1c')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x9ea2('0x14')],'defaultValue':'no','set':function(_0x2b930b){this[_0x9ea2('0xa')]('leavewhenempty',_0x2b930b?_0x2b930b[_0x9ea2('0x1a')](','):undefined);},'get':function(){return this[_0x9ea2('0xd')]('leavewhenempty')?this[_0x9ea2('0xd')](_0x9ea2('0x1e'))[_0x9ea2('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x9ea2('0x2')](_0x9ea2('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x9ea2('0x2')](_0x9ea2('0x16'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x9ea2('0x15')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x9ea2('0x2')](_0x9ea2('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0x9ea2('0x1f')],'defaultValue':0x0,'set':function(_0x99b786){this['setDataValue'](_0x9ea2('0x20'),_0x99b786);if(_0x99b786){if(this['getDataValue']('wrapuptime')<0x2){this[_0x9ea2('0xa')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0x9ea2('0x15')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x9ea2('0x1f')],'defaultValue':0x0,'comment':_0x9ea2('0x21')},'dialMethod':{'type':Sequelize[_0x9ea2('0x2')](_0x9ea2('0x22'),'progressive',_0x9ea2('0x13'),_0x9ea2('0x12'),_0x9ea2('0x10')),'defaultValue':_0x9ea2('0x23'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0x9ea2('0x15')](0x4)[_0x9ea2('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x9ea2('0x25')},'dialLimitQueue':{'type':Sequelize[_0x9ea2('0x15')](0x4)[_0x9ea2('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x9ea2('0x26')},'dialPowerLevel':{'type':Sequelize[_0x9ea2('0x27')](0x2)[_0x9ea2('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x9ea2('0x28')},'dialPredictiveOptimization':{'type':Sequelize[_0x9ea2('0x2')]('agentBusyFactor','dropRate'),'defaultValue':_0x9ea2('0x29'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x9ea2('0x27')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0x9ea2('0x15')](0x3)[_0x9ea2('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x9ea2('0x2a')},'dialOriginateCallerIdName':{'type':Sequelize[_0x9ea2('0x14')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x9ea2('0x14')]},'dialOriginateTimeout':{'type':Sequelize[_0x9ea2('0x15')](0x3)[_0x9ea2('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9ea2('0x2b')},'dialQueueOptions':{'type':Sequelize[_0x9ea2('0x14')],'defaultValue':_0x9ea2('0x2c'),'comment':_0x9ea2('0x2d')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x9ea2('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9ea2('0x2e')},'dialQueueProject':{'type':Sequelize[_0x9ea2('0x14')],'comment':_0x9ea2('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize[_0x9ea2('0x15')](0x3)[_0x9ea2('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9ea2('0x30')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9ea2('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9ea2('0x31')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9ea2('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9ea2('0x24')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x9ea2('0x15')](0x5)[_0x9ea2('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x9ea2('0x15')](0x3)[_0x9ea2('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x9ea2('0x32')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x9ea2('0x14')],'defaultValue':_0x9ea2('0x33')},'dialPrefix':{'type':Sequelize[_0x9ea2('0x14')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x9ea2('0x2')](_0x9ea2('0x34'),_0x9ea2('0x35'),'onlyIfOpen'),'defaultValue':_0x9ea2('0x34')},'dialAMDActive':{'type':Sequelize[_0x9ea2('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x9ea2('0x15')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x9ea2('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x9ea2('0x15')](0x9)[_0x9ea2('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x9ea2('0x36')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x9ea2('0x15')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x9ea2('0x15')](0x9)[_0x9ea2('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x9ea2('0x37')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x9ea2('0x15')](0x9)[_0x9ea2('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x9ea2('0x38')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x9ea2('0x15')](0x5)[_0x9ea2('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9ea2('0x39')},'dialRecallMeTimeout':{'type':Sequelize[_0x9ea2('0x15')](0x5)[_0x9ea2('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x9ea2('0x3a')},'dialRecallInQueue':{'type':Sequelize[_0x9ea2('0x1f')],'defaultValue':0x0,'comment':_0x9ea2('0x3b')},'dialOrderByScheduledAt':{'type':Sequelize[_0x9ea2('0x2')](_0x9ea2('0x3c'),'ASC'),'defaultValue':_0x9ea2('0x3c')},'dialQueueProject2':{'type':Sequelize[_0x9ea2('0x14')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x9ea2('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x9ea2('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x9ea2('0x15')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9ea2('0x3d')},'dialCutDigit':{'type':Sequelize[_0x9ea2('0x15')](0x3)[_0x9ea2('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9ea2('0x3e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x9ea2('0x15')](0x3)[_0x9ea2('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9ea2('0x3f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9ea2('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9ea2('0x40')},'dialDropMaxRetry':{'type':Sequelize[_0x9ea2('0x15')](0x3)[_0x9ea2('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9ea2('0x41')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9ea2('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9ea2('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9ea2('0x42')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9ea2('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9ea2('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9ea2('0x43')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9ea2('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x9ea2('0x15')](0x3)[_0x9ea2('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9ea2('0x44')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x9ea2('0x15')](0x5)[_0x9ea2('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9ea2('0x45')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9ea2('0x15')],'allowNull':!![],'comment':_0x9ea2('0x46')},'mandatoryDisposition':{'type':Sequelize[_0x9ea2('0x1f')],'defaultValue':![],'comment':_0x9ea2('0x47'),'set':function(_0x479345){if(!_0x479345)this[_0x9ea2('0xa')](_0x9ea2('0x48'),null);this['setDataValue'](_0x9ea2('0x49'),_0x479345);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x9ea2('0x15')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x9ea2('0x15')](0x3)[_0x9ea2('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x9ea2('0x15')](0x3)['UNSIGNED'],'defaultValue':0x4}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index e46a558..b7583e4 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 _0xabce=['voicePause','forEach','emit','removeTeams','ids','select','field','from','team_has_voice_queues','join','ut.TeamId\x20=\x20tq.TeamId','push','sequelize','toString','QueryTypes','SELECT','TeamId','all','union','transaction','removeAgents','userVoiceQueue:remove','addAgents','userVoiceQueue:save','User','online','isEmpty','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','spread','dialCheckDuplicateType','always','insert','into','fromQuery','scheduledAt','ContactId','ListId','phone','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_hopper','phone\x20IS\x20NOT\x20NULL','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','cm_contact_has_items','h.scheduledat=?','PHONE','removeLists','NOW()','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueue.socket','sendStatus','end','status','offset','undefined','limit','count','set','json','reject','save','then','destroy','get','inbound','outbound','ignore','map','value','includes','type','find','name','error','stack','send','index','rawAttributes','fieldName','key','query','keys','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','VoiceQueue','includeAll','include','findAll','catch','show','params','intersection','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','QueueCampaigns','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','role','VoiceQueues','update','getHoppers','findOne','CmHopper','VoiceQueueId','rows','getHopperHistories','CmHopperHistory','CmHopperFinal','nolimit','getHopperBlacks','CmHopperBlack','Team','getTeams','addTeams','teams','interface','flatMap','Agents','penalty','each','TeamVoiceQueue','upsert','UserVoiceQueue','UserVoiceQueueRt','isNil','format','SIP/%s'];(function(_0x183904,_0x18903d){var _0x44a8fd=function(_0x19b3a3){while(--_0x19b3a3){_0x183904['push'](_0x183904['shift']());}};_0x44a8fd(++_0x18903d);}(_0xabce,0x103));var _0xeabc=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xabce[_0x1ddedd];return _0xa3e1ac;};'use strict';var emlformat=require(_0xeabc('0x0'));var rimraf=require(_0xeabc('0x1'));var zipdir=require(_0xeabc('0x2'));var jsonpatch=require(_0xeabc('0x3'));var rp=require(_0xeabc('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeabc('0x5'));var util=require(_0xeabc('0x6'));var path=require(_0xeabc('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeabc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeabc('0x9'));var squel=require('squel');var crypto=require(_0xeabc('0xa'));var jsforce=require(_0xeabc('0xb'));var deskjs=require(_0xeabc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeabc('0xd'));var Papa=require(_0xeabc('0xe'));var Redis=require(_0xeabc('0xf'));var authService=require(_0xeabc('0x10'));var qs=require(_0xeabc('0x11'));var as=require(_0xeabc('0x12'));var hardwareService=require(_0xeabc('0x13'));var logger=require(_0xeabc('0x14'))(_0xeabc('0x15'));var utils=require(_0xeabc('0x16'));var config=require(_0xeabc('0x17'));var licenseUtil=require(_0xeabc('0x18'));var db=require(_0xeabc('0x19'))['db'];config[_0xeabc('0x1a')]=_[_0xeabc('0x1b')](config[_0xeabc('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xeabc('0x1c'))(new Redis(config[_0xeabc('0x1a')]));require(_0xeabc('0x1d'))['register'](socket);function respondWithStatusCode(_0x5f4ee8,_0x3170ea){_0x3170ea=_0x3170ea||0xcc;return function(_0x3ae954){if(_0x3ae954){return _0x5f4ee8[_0xeabc('0x1e')](_0x3170ea);}return _0x5f4ee8['status'](_0x3170ea)[_0xeabc('0x1f')]();};}function respondWithResult(_0x638976,_0x49f2d8){_0x49f2d8=_0x49f2d8||0xc8;return function(_0x53fe28){if(_0x53fe28){return _0x638976[_0xeabc('0x20')](_0x49f2d8)['json'](_0x53fe28);}};}function respondWithFilteredResult(_0x3d0e21,_0x1b64b9){return function(_0x58a3c0){if(_0x58a3c0){var _0x16f08b=typeof _0x1b64b9[_0xeabc('0x21')]===_0xeabc('0x22')&&typeof _0x1b64b9[_0xeabc('0x23')]===_0xeabc('0x22');var _0x5d92e5=_0x58a3c0[_0xeabc('0x24')];var _0x4d68ea=_0x16f08b?0x0:_0x1b64b9[_0xeabc('0x21')];var _0x16530c=_0x16f08b?_0x58a3c0['count']:_0x1b64b9[_0xeabc('0x21')]+_0x1b64b9[_0xeabc('0x23')];var _0x254590;if(_0x16530c>=_0x5d92e5){_0x16530c=_0x5d92e5;_0x254590=0xc8;}else{_0x254590=0xce;}_0x3d0e21[_0xeabc('0x20')](_0x254590);return _0x3d0e21[_0xeabc('0x25')]('Content-Range',_0x4d68ea+'-'+_0x16530c+'/'+_0x5d92e5)[_0xeabc('0x26')](_0x58a3c0);}return null;};}function patchUpdates(_0x10c675){return function(_0x91ab00){try{jsonpatch['apply'](_0x91ab00,_0x10c675,!![]);}catch(_0x457f27){return BPromise[_0xeabc('0x27')](_0x457f27);}return _0x91ab00[_0xeabc('0x28')]();};}function saveUpdates(_0x319119,_0x5b8838){return function(_0x109e1d){if(_0x109e1d){return _0x109e1d['update'](_0x319119)[_0xeabc('0x29')](function(_0x4d4e29){return _0x4d4e29;});}return null;};}function removeEntity(_0x811f0d,_0x12acbd){return function(_0x269621){if(_0x269621){return _0x269621[_0xeabc('0x2a')]()[_0xeabc('0x29')](function(){var _0x137293=_0x269621[_0xeabc('0x2b')]({'plain':!![]});var _0x4c2693=[{'name':'VoiceQueues','value':_0xeabc('0x2c'),'ignore':![]},{'name':'QueueCampaigns','value':_0xeabc('0x2d'),'ignore':![]}];var _0x2b342c=_(_0x4c2693)['filter'](_0xeabc('0x2e'))[_0xeabc('0x2f')](_0xeabc('0x30'))[_0xeabc('0x30')]();if(_[_0xeabc('0x31')](_0x2b342c,_0x137293[_0xeabc('0x32')])){return;}var _0x2c62fe=_[_0xeabc('0x33')](_0x4c2693,[_0xeabc('0x30'),_0x137293['type']])[_0xeabc('0x34')];return db['UserProfileResource'][_0xeabc('0x2a')]({'where':{'type':_0x2c62fe,'resourceId':_0x137293['id']}})[_0xeabc('0x29')](function(){return _0x269621;});})[_0xeabc('0x29')](function(){_0x811f0d[_0xeabc('0x20')](0xcc)[_0xeabc('0x1f')]();});}};}function handleEntityNotFound(_0x368b8a,_0x61c0af){return function(_0x545d7f){if(!_0x545d7f){_0x368b8a[_0xeabc('0x1e')](0x194);}return _0x545d7f;};}function handleError(_0x2df9e6,_0x3bc45e){_0x3bc45e=_0x3bc45e||0x1f4;return function(_0x4918e2){logger[_0xeabc('0x35')](_0x4918e2[_0xeabc('0x36')]);if(_0x4918e2[_0xeabc('0x34')]){delete _0x4918e2['name'];}_0x2df9e6[_0xeabc('0x20')](_0x3bc45e)[_0xeabc('0x37')](_0x4918e2);};}exports[_0xeabc('0x38')]=function(_0x521091,_0xf98c7c){var _0x286203={},_0x5d9acf={},_0x50cca2={'count':0x0,'rows':[]};var _0x254568=_[_0xeabc('0x2f')](db['VoiceQueue'][_0xeabc('0x39')],function(_0x81976d){return{'name':_0x81976d[_0xeabc('0x3a')],'type':_0x81976d[_0xeabc('0x32')][_0xeabc('0x3b')]};});_0x5d9acf['model']=_[_0xeabc('0x2f')](_0x254568,'name');_0x5d9acf[_0xeabc('0x3c')]=_[_0xeabc('0x3d')](_0x521091[_0xeabc('0x3c')]);_0x5d9acf['filters']=_['intersection'](_0x5d9acf[_0xeabc('0x3e')],_0x5d9acf['query']);_0x286203[_0xeabc('0x3f')]=_['intersection'](_0x5d9acf['model'],qs['fields'](_0x521091['query'][_0xeabc('0x40')]));_0x286203['attributes']=_0x286203[_0xeabc('0x3f')][_0xeabc('0x41')]?_0x286203['attributes']:_0x5d9acf[_0xeabc('0x3e')];if(!_0x521091['query'][_0xeabc('0x42')]('nolimit')){_0x286203[_0xeabc('0x23')]=qs[_0xeabc('0x23')](_0x521091[_0xeabc('0x3c')]['limit']);_0x286203['offset']=qs['offset'](_0x521091[_0xeabc('0x3c')][_0xeabc('0x21')]);}_0x286203[_0xeabc('0x43')]=qs['sort'](_0x521091['query'][_0xeabc('0x44')]);_0x286203[_0xeabc('0x45')]=qs['filters'](_[_0xeabc('0x46')](_0x521091['query'],_0x5d9acf[_0xeabc('0x47')]),_0x254568);if(_0x521091['query']['filter']){_0x286203['where']=_[_0xeabc('0x48')](_0x286203[_0xeabc('0x45')],{'$or':_[_0xeabc('0x2f')](_0x254568,function(_0x3eeeb5){if(_0x3eeeb5['type']!==_0xeabc('0x49')){var _0x555d26={};_0x555d26[_0x3eeeb5[_0xeabc('0x34')]]={'$like':'%'+_0x521091[_0xeabc('0x3c')][_0xeabc('0x4a')]+'%'};return _0x555d26;}})});}_0x286203=_[_0xeabc('0x48')]({},_0x286203,_0x521091[_0xeabc('0x4b')]);var _0x48b988={'where':_0x286203['where']};return db[_0xeabc('0x4c')]['count'](_0x48b988)[_0xeabc('0x29')](function(_0x2cdf59){_0x50cca2['count']=_0x2cdf59;if(_0x521091[_0xeabc('0x3c')][_0xeabc('0x4d')]){_0x286203[_0xeabc('0x4e')]=[{'all':!![]}];}return db[_0xeabc('0x4c')][_0xeabc('0x4f')](_0x286203);})[_0xeabc('0x29')](function(_0x2003a7){_0x50cca2['rows']=_0x2003a7;return _0x50cca2;})[_0xeabc('0x29')](respondWithFilteredResult(_0xf98c7c,_0x286203))[_0xeabc('0x50')](handleError(_0xf98c7c,null));};exports[_0xeabc('0x51')]=function(_0x1b41c8,_0x271f8c){var _0x3fbc97={'raw':![],'where':{'id':_0x1b41c8[_0xeabc('0x52')]['id']}},_0x2107d5={};_0x2107d5[_0xeabc('0x3e')]=_[_0xeabc('0x3d')](db['VoiceQueue'][_0xeabc('0x39')]);_0x2107d5[_0xeabc('0x3c')]=_[_0xeabc('0x3d')](_0x1b41c8[_0xeabc('0x3c')]);_0x2107d5[_0xeabc('0x47')]=_[_0xeabc('0x53')](_0x2107d5[_0xeabc('0x3e')],_0x2107d5['query']);_0x3fbc97[_0xeabc('0x3f')]=_[_0xeabc('0x53')](_0x2107d5[_0xeabc('0x3e')],qs[_0xeabc('0x40')](_0x1b41c8[_0xeabc('0x3c')]['fields']));_0x3fbc97[_0xeabc('0x3f')]=_0x3fbc97[_0xeabc('0x3f')][_0xeabc('0x41')]?_0x3fbc97[_0xeabc('0x3f')]:_0x2107d5['model'];if(_0x1b41c8[_0xeabc('0x3c')][_0xeabc('0x4d')]){_0x3fbc97['include']=[{'all':!![]}];}_0x3fbc97=_[_0xeabc('0x48')]({},_0x3fbc97,_0x1b41c8['options']);return db[_0xeabc('0x4c')]['find'](_0x3fbc97)[_0xeabc('0x29')](handleEntityNotFound(_0x271f8c,null))[_0xeabc('0x29')](respondWithResult(_0x271f8c,null))[_0xeabc('0x50')](handleError(_0x271f8c,null));};exports[_0xeabc('0x54')]=function(_0x1ee837,_0x15ba95){return db[_0xeabc('0x4c')][_0xeabc('0x54')](_0x1ee837[_0xeabc('0x55')],{})[_0xeabc('0x29')](function(_0x48a13f){var _0x180a14=_0x1ee837[_0xeabc('0x56')][_0xeabc('0x2b')]({'plain':!![]});if(!_0x180a14)throw new Error(_0xeabc('0x57'));if(_0x180a14['role']===_0xeabc('0x56')){var _0x392913=_0x48a13f[_0xeabc('0x2b')]({'plain':!![]});var _0x21f972=[{'name':'VoiceQueues','value':_0xeabc('0x2c')},{'name':_0xeabc('0x58'),'value':_0xeabc('0x2d')}];var _0xa55cce=_[_0xeabc('0x33')](_0x21f972,[_0xeabc('0x30'),_0x392913[_0xeabc('0x32')]])[_0xeabc('0x34')];return db[_0xeabc('0x59')]['find']({'where':{'name':_0xa55cce,'userProfileId':_0x180a14[_0xeabc('0x5a')]},'raw':!![]})['then'](function(_0x5e09fc){if(_0x5e09fc&&_0x5e09fc['autoAssociation']===0x0){return db[_0xeabc('0x5b')][_0xeabc('0x54')]({'name':_0x392913[_0xeabc('0x34')],'resourceId':_0x392913['id'],'type':_0x5e09fc[_0xeabc('0x34')],'sectionId':_0x5e09fc['id']},{})[_0xeabc('0x29')](function(){return _0x48a13f;});}else{return _0x48a13f;}})[_0xeabc('0x50')](function(_0x4a2ad6){logger[_0xeabc('0x35')](_0xeabc('0x5c'),_0x4a2ad6);throw _0x4a2ad6;});}return _0x48a13f;})[_0xeabc('0x29')](respondWithResult(_0x15ba95,0xc9))[_0xeabc('0x50')](handleError(_0x15ba95,null));};exports[_0xeabc('0x5d')]=function(_0x2c7b4e,_0x1750e9){var _0x25c728={'where':{'id':_0x2c7b4e['params']['id']}},_0x5820ca={};_0x5820ca[_0xeabc('0x3e')]=_[_0xeabc('0x3d')](db[_0xeabc('0x4c')]['rawAttributes']);_0x25c728[_0xeabc('0x3f')]=_['intersection'](_0x5820ca['model'],qs[_0xeabc('0x40')](_0x2c7b4e[_0xeabc('0x3c')][_0xeabc('0x40')]));_0x25c728[_0xeabc('0x3f')]=_0x25c728[_0xeabc('0x3f')][_0xeabc('0x41')]?_0x25c728['attributes']:_0x5820ca[_0xeabc('0x3e')];if(_0x2c7b4e[_0xeabc('0x3c')][_0xeabc('0x4d')]){_0x25c728[_0xeabc('0x4e')]=[{'all':!![]}];}_0x25c728=_[_0xeabc('0x48')]({},_0x25c728,_0x2c7b4e[_0xeabc('0x4b')]);return db['VoiceQueue'][_0xeabc('0x33')](_0x25c728)[_0xeabc('0x29')](handleEntityNotFound(_0x1750e9,null))[_0xeabc('0x29')](function(_0x165899){if(_0x165899){var _0x1b61a8=_0x165899[_0xeabc('0x2b')]({'plain':!![]});_0x1b61a8=qs[_0xeabc('0x5e')](_0x1b61a8,['id',_0xeabc('0x5f'),_0xeabc('0x60')]);_0x2c7b4e['body']=_[_0xeabc('0x5e')](_0x2c7b4e['body'],['id',_0xeabc('0x5f'),_0xeabc('0x60')]);return db[_0xeabc('0x4c')][_0xeabc('0x54')](_[_0xeabc('0x48')](_0x1b61a8,_0x2c7b4e[_0xeabc('0x55')]),{'include':_0x2c7b4e[_0xeabc('0x3c')][_0xeabc('0x4d')]?[{'all':!![]}]:undefined})[_0xeabc('0x29')](function(_0x24d0e5){var _0x5702cb=_0x2c7b4e[_0xeabc('0x56')][_0xeabc('0x2b')]({'plain':!![]});if(!_0x5702cb)throw new Error(_0xeabc('0x57'));if(_0x5702cb[_0xeabc('0x61')]==='user'){var _0x12fd48=_0x24d0e5['get']({'plain':!![]});var _0x54e7d6=[{'name':_0xeabc('0x62'),'value':_0xeabc('0x2c')},{'name':_0xeabc('0x58'),'value':_0xeabc('0x2d')}];var _0x4b7730=_['find'](_0x54e7d6,[_0xeabc('0x30'),_0x12fd48['type']])['name'];return db[_0xeabc('0x59')]['find']({'where':{'name':_0x4b7730,'userProfileId':_0x5702cb['userProfileId']},'raw':!![]})[_0xeabc('0x29')](function(_0x1c84b5){if(_0x1c84b5&&_0x1c84b5['autoAssociation']===0x0){return db['UserProfileResource'][_0xeabc('0x54')]({'name':_0x12fd48['name'],'resourceId':_0x12fd48['id'],'type':_0x1c84b5[_0xeabc('0x34')],'sectionId':_0x1c84b5['id']},{})[_0xeabc('0x29')](function(){return _0x24d0e5;});}else{return _0x24d0e5;}})['catch'](function(_0x5d6477){logger[_0xeabc('0x35')](_0xeabc('0x5c'),_0x5d6477);throw _0x5d6477;});}return _0x24d0e5;});}})[_0xeabc('0x29')](respondWithResult(_0x1750e9,0xc9))[_0xeabc('0x50')](handleError(_0x1750e9,null));};exports[_0xeabc('0x63')]=function(_0x511b33,_0x53f578){if(_0x511b33[_0xeabc('0x55')]['id']){delete _0x511b33['body']['id'];}return db[_0xeabc('0x4c')]['find']({'where':{'id':_0x511b33[_0xeabc('0x52')]['id']}})['then'](handleEntityNotFound(_0x53f578,null))[_0xeabc('0x29')](saveUpdates(_0x511b33['body'],null))[_0xeabc('0x29')](respondWithResult(_0x53f578,null))[_0xeabc('0x50')](handleError(_0x53f578,null));};exports[_0xeabc('0x2a')]=function(_0x36cc41,_0x5e121c){return db[_0xeabc('0x4c')]['find']({'where':{'id':_0x36cc41[_0xeabc('0x52')]['id']}})[_0xeabc('0x29')](handleEntityNotFound(_0x5e121c,null))[_0xeabc('0x29')](removeEntity(_0x5e121c,null))[_0xeabc('0x50')](handleError(_0x5e121c,null));};exports[_0xeabc('0x64')]=function(_0x5c1ab2,_0x239350,_0x329d8b){var _0x4b9614={'raw':![],'where':{}};var _0x2509a4={};var _0x5427c8={'count':0x0,'rows':[]};return db[_0xeabc('0x4c')][_0xeabc('0x65')]({'where':{'id':_0x5c1ab2[_0xeabc('0x52')]['id']}})[_0xeabc('0x29')](handleEntityNotFound(_0x239350,null))['then'](function(_0xb9b460){if(_0xb9b460){_0x2509a4[_0xeabc('0x3e')]=_[_0xeabc('0x3d')](db[_0xeabc('0x66')]['rawAttributes']);_0x2509a4['query']=_[_0xeabc('0x3d')](_0x5c1ab2['query']);_0x2509a4['filters']=_[_0xeabc('0x53')](_0x2509a4[_0xeabc('0x3e')],_0x2509a4[_0xeabc('0x3c')]);_0x4b9614['attributes']=_[_0xeabc('0x53')](_0x2509a4[_0xeabc('0x3e')],qs['fields'](_0x5c1ab2[_0xeabc('0x3c')][_0xeabc('0x40')]));_0x4b9614[_0xeabc('0x3f')]=_0x4b9614[_0xeabc('0x3f')][_0xeabc('0x41')]?_0x4b9614['attributes']:_0x2509a4[_0xeabc('0x3e')];if(!_0x5c1ab2['query']['hasOwnProperty']('nolimit')){_0x4b9614[_0xeabc('0x23')]=qs[_0xeabc('0x23')](_0x5c1ab2[_0xeabc('0x3c')][_0xeabc('0x23')]);_0x4b9614[_0xeabc('0x21')]=qs['offset'](_0x5c1ab2[_0xeabc('0x3c')]['offset']);}_0x4b9614[_0xeabc('0x43')]=qs[_0xeabc('0x44')](_0x5c1ab2['query'][_0xeabc('0x44')]);_0x4b9614['where']=qs['filters'](_[_0xeabc('0x46')](_0x5c1ab2[_0xeabc('0x3c')],_0x2509a4[_0xeabc('0x47')]));_0x4b9614[_0xeabc('0x45')][_0xeabc('0x67')]=_0xb9b460['id'];if(_0x5c1ab2['query'][_0xeabc('0x4a')]){_0x4b9614[_0xeabc('0x45')]=_[_0xeabc('0x48')](_0x4b9614[_0xeabc('0x45')],{'$or':_[_0xeabc('0x2f')](_0x4b9614[_0xeabc('0x3f')],function(_0x2d05b4){var _0x419fc6={};_0x419fc6[_0x2d05b4]={'$like':'%'+_0x5c1ab2[_0xeabc('0x3c')][_0xeabc('0x4a')]+'%'};return _0x419fc6;})});}_0x4b9614=_['merge']({},_0x4b9614,_0x5c1ab2[_0xeabc('0x4b')]);return db[_0xeabc('0x66')][_0xeabc('0x24')]({'where':_0x4b9614['where']})['then'](function(_0x1506bd){_0x5427c8[_0xeabc('0x24')]=_0x1506bd;if(_0x5c1ab2[_0xeabc('0x3c')][_0xeabc('0x4d')]){_0x4b9614[_0xeabc('0x4e')]=[{'all':!![]}];}return db['CmHopper'][_0xeabc('0x4f')](_0x4b9614);})['then'](function(_0x5f39ef){_0x5427c8[_0xeabc('0x68')]=_0x5f39ef;return _0x5427c8;});}})[_0xeabc('0x29')](respondWithFilteredResult(_0x239350,_0x4b9614))['catch'](handleError(_0x239350,null));};exports[_0xeabc('0x69')]=function(_0x45c9c7,_0x49a70a,_0x5963f7){var _0xfaef39={'raw':!![],'where':{}};var _0xb04677={};var _0x135a79={'count':0x0,'rows':[]};return db[_0xeabc('0x4c')][_0xeabc('0x65')]({'where':{'id':_0x45c9c7[_0xeabc('0x52')]['id']}})[_0xeabc('0x29')](handleEntityNotFound(_0x49a70a,null))['then'](function(_0xb54c35){if(_0xb54c35){_0xb04677['model']=_[_0xeabc('0x3d')](db[_0xeabc('0x6a')][_0xeabc('0x39')]);_0xb04677[_0xeabc('0x3c')]=_[_0xeabc('0x3d')](_0x45c9c7[_0xeabc('0x3c')]);_0xb04677[_0xeabc('0x47')]=_[_0xeabc('0x53')](_0xb04677[_0xeabc('0x3e')],_0xb04677[_0xeabc('0x3c')]);_0xfaef39[_0xeabc('0x3f')]=_['intersection'](_0xb04677[_0xeabc('0x3e')],qs[_0xeabc('0x40')](_0x45c9c7[_0xeabc('0x3c')][_0xeabc('0x40')]));_0xfaef39['attributes']=_0xfaef39[_0xeabc('0x3f')][_0xeabc('0x41')]?_0xfaef39['attributes']:_0xb04677[_0xeabc('0x3e')];if(!_0x45c9c7[_0xeabc('0x3c')]['hasOwnProperty']('nolimit')){_0xfaef39['limit']=qs['limit'](_0x45c9c7[_0xeabc('0x3c')][_0xeabc('0x23')]);_0xfaef39[_0xeabc('0x21')]=qs[_0xeabc('0x21')](_0x45c9c7[_0xeabc('0x3c')][_0xeabc('0x21')]);}_0xfaef39[_0xeabc('0x43')]=qs[_0xeabc('0x44')](_0x45c9c7[_0xeabc('0x3c')][_0xeabc('0x44')]);_0xfaef39['where']=qs[_0xeabc('0x47')](_[_0xeabc('0x46')](_0x45c9c7['query'],_0xb04677[_0xeabc('0x47')]));_0xfaef39[_0xeabc('0x45')][_0xeabc('0x67')]=_0xb54c35['id'];if(_0x45c9c7['query'][_0xeabc('0x4a')]){_0xfaef39['where']=_[_0xeabc('0x48')](_0xfaef39[_0xeabc('0x45')],{'$or':_[_0xeabc('0x2f')](_0xfaef39[_0xeabc('0x3f')],function(_0x1c52f7){var _0x5e7e00={};_0x5e7e00[_0x1c52f7]={'$like':'%'+_0x45c9c7['query']['filter']+'%'};return _0x5e7e00;})});}_0xfaef39=_['merge']({},_0xfaef39,_0x45c9c7[_0xeabc('0x4b')]);return db[_0xeabc('0x6a')][_0xeabc('0x24')]({'where':_0xfaef39['where']})[_0xeabc('0x29')](function(_0x19536d){_0x135a79[_0xeabc('0x24')]=_0x19536d;if(_0x45c9c7[_0xeabc('0x3c')][_0xeabc('0x4d')]){_0xfaef39[_0xeabc('0x4e')]=[{'all':!![]}];}return db[_0xeabc('0x6a')][_0xeabc('0x4f')](_0xfaef39);})[_0xeabc('0x29')](function(_0x391e67){_0x135a79[_0xeabc('0x68')]=_0x391e67;return _0x135a79;});}})[_0xeabc('0x29')](respondWithFilteredResult(_0x49a70a,_0xfaef39))['catch'](handleError(_0x49a70a,null));};exports['getHopperFinals']=function(_0x3286a2,_0x50a5d5,_0x20c4d7){var _0x18ee16={'raw':!![],'where':{}};var _0x102591={};var _0x56f622={'count':0x0,'rows':[]};return db[_0xeabc('0x4c')][_0xeabc('0x65')]({'where':{'id':_0x3286a2[_0xeabc('0x52')]['id']}})['then'](handleEntityNotFound(_0x50a5d5,null))['then'](function(_0x3557f2){if(_0x3557f2){_0x102591[_0xeabc('0x3e')]=_[_0xeabc('0x3d')](db[_0xeabc('0x6b')][_0xeabc('0x39')]);_0x102591[_0xeabc('0x3c')]=_['keys'](_0x3286a2['query']);_0x102591[_0xeabc('0x47')]=_[_0xeabc('0x53')](_0x102591[_0xeabc('0x3e')],_0x102591[_0xeabc('0x3c')]);_0x18ee16['attributes']=_['intersection'](_0x102591['model'],qs[_0xeabc('0x40')](_0x3286a2['query'][_0xeabc('0x40')]));_0x18ee16['attributes']=_0x18ee16[_0xeabc('0x3f')]['length']?_0x18ee16[_0xeabc('0x3f')]:_0x102591[_0xeabc('0x3e')];if(!_0x3286a2[_0xeabc('0x3c')][_0xeabc('0x42')](_0xeabc('0x6c'))){_0x18ee16['limit']=qs[_0xeabc('0x23')](_0x3286a2[_0xeabc('0x3c')][_0xeabc('0x23')]);_0x18ee16['offset']=qs[_0xeabc('0x21')](_0x3286a2[_0xeabc('0x3c')][_0xeabc('0x21')]);}_0x18ee16[_0xeabc('0x43')]=qs[_0xeabc('0x44')](_0x3286a2['query'][_0xeabc('0x44')]);_0x18ee16[_0xeabc('0x45')]=qs['filters'](_[_0xeabc('0x46')](_0x3286a2[_0xeabc('0x3c')],_0x102591['filters']));_0x18ee16[_0xeabc('0x45')][_0xeabc('0x67')]=_0x3557f2['id'];if(_0x3286a2[_0xeabc('0x3c')][_0xeabc('0x4a')]){_0x18ee16[_0xeabc('0x45')]=_[_0xeabc('0x48')](_0x18ee16[_0xeabc('0x45')],{'$or':_[_0xeabc('0x2f')](_0x18ee16[_0xeabc('0x3f')],function(_0x11a185){var _0x223cd6={};_0x223cd6[_0x11a185]={'$like':'%'+_0x3286a2[_0xeabc('0x3c')][_0xeabc('0x4a')]+'%'};return _0x223cd6;})});}_0x18ee16=_['merge']({},_0x18ee16,_0x3286a2['options']);return db[_0xeabc('0x6b')][_0xeabc('0x24')]({'where':_0x18ee16[_0xeabc('0x45')]})[_0xeabc('0x29')](function(_0x5805c9){_0x56f622[_0xeabc('0x24')]=_0x5805c9;if(_0x3286a2['query']['includeAll']){_0x18ee16['include']=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x18ee16);})['then'](function(_0x72dd0e){_0x56f622[_0xeabc('0x68')]=_0x72dd0e;return _0x56f622;});}})[_0xeabc('0x29')](respondWithFilteredResult(_0x50a5d5,_0x18ee16))[_0xeabc('0x50')](handleError(_0x50a5d5,null));};exports[_0xeabc('0x6d')]=function(_0xe27492,_0x152d99,_0x3eaedf){var _0x44dc85={'raw':!![],'where':{}};var _0x550273={};var _0x3b1f77={'count':0x0,'rows':[]};return db[_0xeabc('0x4c')][_0xeabc('0x65')]({'where':{'id':_0xe27492[_0xeabc('0x52')]['id']}})[_0xeabc('0x29')](handleEntityNotFound(_0x152d99,null))[_0xeabc('0x29')](function(_0x2a29d7){if(_0x2a29d7){_0x550273['model']=_[_0xeabc('0x3d')](db['CmHopperBlack'][_0xeabc('0x39')]);_0x550273[_0xeabc('0x3c')]=_['keys'](_0xe27492[_0xeabc('0x3c')]);_0x550273['filters']=_[_0xeabc('0x53')](_0x550273[_0xeabc('0x3e')],_0x550273[_0xeabc('0x3c')]);_0x44dc85[_0xeabc('0x3f')]=_[_0xeabc('0x53')](_0x550273[_0xeabc('0x3e')],qs[_0xeabc('0x40')](_0xe27492[_0xeabc('0x3c')][_0xeabc('0x40')]));_0x44dc85['attributes']=_0x44dc85['attributes'][_0xeabc('0x41')]?_0x44dc85[_0xeabc('0x3f')]:_0x550273['model'];if(!_0xe27492[_0xeabc('0x3c')]['hasOwnProperty'](_0xeabc('0x6c'))){_0x44dc85[_0xeabc('0x23')]=qs[_0xeabc('0x23')](_0xe27492[_0xeabc('0x3c')][_0xeabc('0x23')]);_0x44dc85[_0xeabc('0x21')]=qs['offset'](_0xe27492[_0xeabc('0x3c')]['offset']);}_0x44dc85[_0xeabc('0x43')]=qs[_0xeabc('0x44')](_0xe27492[_0xeabc('0x3c')][_0xeabc('0x44')]);_0x44dc85['where']=qs[_0xeabc('0x47')](_[_0xeabc('0x46')](_0xe27492[_0xeabc('0x3c')],_0x550273['filters']));_0x44dc85[_0xeabc('0x45')][_0xeabc('0x67')]=_0x2a29d7['id'];if(_0xe27492[_0xeabc('0x3c')]['filter']){_0x44dc85['where']=_['merge'](_0x44dc85['where'],{'$or':_[_0xeabc('0x2f')](_0x44dc85[_0xeabc('0x3f')],function(_0x52e84f){var _0x12f024={};_0x12f024[_0x52e84f]={'$like':'%'+_0xe27492[_0xeabc('0x3c')][_0xeabc('0x4a')]+'%'};return _0x12f024;})});}_0x44dc85=_[_0xeabc('0x48')]({},_0x44dc85,_0xe27492[_0xeabc('0x4b')]);return db[_0xeabc('0x6e')][_0xeabc('0x24')]({'where':_0x44dc85[_0xeabc('0x45')]})[_0xeabc('0x29')](function(_0x4df674){_0x3b1f77[_0xeabc('0x24')]=_0x4df674;if(_0xe27492['query'][_0xeabc('0x4d')]){_0x44dc85[_0xeabc('0x4e')]=[{'all':!![]}];}return db[_0xeabc('0x6e')][_0xeabc('0x4f')](_0x44dc85);})[_0xeabc('0x29')](function(_0x3a43ad){_0x3b1f77[_0xeabc('0x68')]=_0x3a43ad;return _0x3b1f77;});}})['then'](respondWithFilteredResult(_0x152d99,_0x44dc85))[_0xeabc('0x50')](handleError(_0x152d99,null));};exports['getTeams']=function(_0x475160,_0x4d8953,_0x10d66b){var _0x12a042={};var _0x266b53={};var _0x1aee85;var _0x507037;return db['VoiceQueue'][_0xeabc('0x65')]({'where':{'id':_0x475160[_0xeabc('0x52')]['id']}})[_0xeabc('0x29')](handleEntityNotFound(_0x4d8953,null))[_0xeabc('0x29')](function(_0x3339ce){if(_0x3339ce){_0x1aee85=_0x3339ce;_0x266b53['model']=_[_0xeabc('0x3d')](db[_0xeabc('0x6f')][_0xeabc('0x39')]);_0x266b53[_0xeabc('0x3c')]=_[_0xeabc('0x3d')](_0x475160['query']);_0x266b53[_0xeabc('0x47')]=_['intersection'](_0x266b53[_0xeabc('0x3e')],_0x266b53[_0xeabc('0x3c')]);_0x12a042[_0xeabc('0x3f')]=_[_0xeabc('0x53')](_0x266b53[_0xeabc('0x3e')],qs[_0xeabc('0x40')](_0x475160[_0xeabc('0x3c')][_0xeabc('0x40')]));_0x12a042[_0xeabc('0x3f')]=_0x12a042[_0xeabc('0x3f')]['length']?_0x12a042[_0xeabc('0x3f')]:_0x266b53[_0xeabc('0x3e')];_0x12a042[_0xeabc('0x43')]=qs[_0xeabc('0x44')](_0x475160['query'][_0xeabc('0x44')]);_0x12a042['where']=qs['filters'](_[_0xeabc('0x46')](_0x475160[_0xeabc('0x3c')],_0x266b53[_0xeabc('0x47')]));if(_0x475160['query'][_0xeabc('0x4a')]){_0x12a042[_0xeabc('0x45')]=_[_0xeabc('0x48')](_0x12a042[_0xeabc('0x45')],{'$or':_[_0xeabc('0x2f')](_0x12a042['attributes'],function(_0x1dc0fc){var _0x316e15={};_0x316e15[_0x1dc0fc]={'$like':'%'+_0x475160['query']['filter']+'%'};return _0x316e15;})});}_0x12a042=_[_0xeabc('0x48')]({},_0x12a042,_0x475160[_0xeabc('0x4b')]);return _0x1aee85[_0xeabc('0x70')](_0x12a042);}})[_0xeabc('0x29')](function(_0x2a0075){if(_0x2a0075){_0x507037=_0x2a0075[_0xeabc('0x41')];if(!_0x475160[_0xeabc('0x3c')][_0xeabc('0x42')](_0xeabc('0x6c'))){_0x12a042['limit']=qs[_0xeabc('0x23')](_0x475160['query'][_0xeabc('0x23')]);_0x12a042['offset']=qs[_0xeabc('0x21')](_0x475160[_0xeabc('0x3c')][_0xeabc('0x21')]);}return _0x1aee85[_0xeabc('0x70')](_0x12a042);}})[_0xeabc('0x29')](function(_0x227f00){if(_0x227f00){return _0x227f00?{'count':_0x507037,'rows':_0x227f00}:null;}})[_0xeabc('0x29')](respondWithResult(_0x4d8953,null))[_0xeabc('0x50')](handleError(_0x4d8953,null));};exports[_0xeabc('0x71')]=function(_0x31f1bf,_0x5c83e5,_0x5629db){var _0x1ad48f=_0x31f1bf['body'][_0xeabc('0x72')];var _0x283d40=_['map'](_0x1ad48f,'id');return db['Team'][_0xeabc('0x4f')]({'where':{'id':_0x283d40},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xeabc('0x34'),'online','voicePause',_0xeabc('0x73')],'raw':!![]}]})[_0xeabc('0x29')](function(_0x4a2b27){if(_0x4a2b27){var _0x480bbd=_[_0xeabc('0x74')](_0x4a2b27,function(_0x2465f9){var _0x4b6717=_0x2465f9[_0xeabc('0x2b')]({'plain':!![]});_0x4b6717[_0xeabc('0x75')]['forEach'](function(_0x578fdc){_0x578fdc[_0xeabc('0x76')]=_[_0xeabc('0x33')](_0x1ad48f,{'id':_0x4b6717['id']})[_0xeabc('0x76')];});return _0x4b6717['Agents'];});return db[_0xeabc('0x4c')]['find']({'where':{'id':_0x31f1bf[_0xeabc('0x52')]['id']}})[_0xeabc('0x29')](function(_0x2055d8){return db['sequelize']['transaction'](function(_0x6dff2a){return _0x2055d8[_0xeabc('0x71')](_0x283d40,{'transaction':_0x6dff2a})[_0xeabc('0x29')](function(){return BPromise[_0xeabc('0x77')](_0x1ad48f,function(_0x40658b){return db[_0xeabc('0x78')][_0xeabc('0x79')]({'TeamId':_0x40658b['id'],'VoiceQueueId':_0x31f1bf[_0xeabc('0x52')]['id'],'penalty':_0x40658b['penalty']},{'transaction':_0x6dff2a});});})['then'](function(){return BPromise[_0xeabc('0x77')](_0x480bbd,function(_0x55e41e){return db[_0xeabc('0x7a')]['findOrCreate']({'where':{'UserId':_0x55e41e['id'],'VoiceQueueId':_0x31f1bf[_0xeabc('0x52')]['id']},'defaults':{'penalty':_0x55e41e[_0xeabc('0x76')]},'transaction':_0x6dff2a});});})[_0xeabc('0x29')](function(){return BPromise[_0xeabc('0x77')](_[_0xeabc('0x4a')](_0x480bbd,{'online':!![]}),function(_0x75f13b){return db[_0xeabc('0x7b')][_0xeabc('0x79')]({'membername':_0x75f13b['name'],'UserId':_0x75f13b['id'],'queue_name':_0x2055d8[_0xeabc('0x34')],'VoiceQueueId':_0x2055d8['id'],'interface':_[_0xeabc('0x7c')](_0x75f13b[_0xeabc('0x73')])?util[_0xeabc('0x7d')](_0xeabc('0x7e'),_0x75f13b[_0xeabc('0x34')]):_0x75f13b[_0xeabc('0x73')],'paused':_0x75f13b[_0xeabc('0x7f')]||![],'penalty':_0x75f13b[_0xeabc('0x76')]},{'transaction':_0x6dff2a});});})[_0xeabc('0x29')](function(){_0x480bbd[_0xeabc('0x80')](function(_0x1ba153){socket[_0xeabc('0x81')]('userVoiceQueue:save',{'UserId':_0x1ba153['id'],'VoiceQueueId':_0x2055d8['id']});});});});});}})[_0xeabc('0x29')](respondWithStatusCode(_0x5c83e5,null))[_0xeabc('0x50')](handleError(_0x5c83e5,null));};exports[_0xeabc('0x82')]=function(_0x2a0793,_0x198641,_0x34738e){return db[_0xeabc('0x6f')][_0xeabc('0x4f')]({'where':{'id':_0x2a0793[_0xeabc('0x3c')][_0xeabc('0x83')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xeabc('0x75'),'attributes':['id'],'raw':!![]}]})[_0xeabc('0x29')](handleEntityNotFound(_0x198641,null))['then'](function(_0x598105){var _0x5fc21a=_[_0xeabc('0x2f')](_0x598105,'id');var _0x201539=[];var _0x597bd0=[];var _0xba66a2=squel[_0xeabc('0x84')]();_0xba66a2[_0xeabc('0x85')]('tq.TeamId')[_0xeabc('0x86')](_0xeabc('0x87'),'tq')[_0xeabc('0x88')]('user_has_teams','ut',_0xeabc('0x89'))[_0xeabc('0x45')]('VoiceQueueId\x20=\x20?',_0x2a0793[_0xeabc('0x52')]['id']);for(var _0x50371d=0x0;_0x50371d<_0x598105[_0xeabc('0x41')];_0x50371d+=0x1){let _0x39916c=_0x598105[_0x50371d];for(var _0x5cc6d0=0x0;_0x5cc6d0<_0x39916c['Agents']['length'];_0x5cc6d0+=0x1){let _0x122f23=_0x39916c[_0xeabc('0x75')][_0x5cc6d0];var _0x3571c6=_0xba66a2['clone']();_0x3571c6['where']('ut.UserId\x20=\x20?',_0x122f23['id']);_0x597bd0[_0xeabc('0x8a')](db[_0xeabc('0x8b')]['query'](_0x3571c6[_0xeabc('0x8c')](),{'type':db[_0xeabc('0x8b')][_0xeabc('0x8d')][_0xeabc('0x8e')]})[_0xeabc('0x29')](function(_0x1ca3da){if(_0x1ca3da[_0xeabc('0x41')]===0x1){return _0x122f23['id'];}else{var _0x4a5555=_['every'](_['map'](_0x1ca3da,_0xeabc('0x8f')),function(_0x24cf0a){return _[_0xeabc('0x31')](_0x5fc21a,_0x24cf0a);});if(_0x4a5555){return _0x122f23['id'];}}}));}}return BPromise[_0xeabc('0x90')](_0x597bd0)[_0xeabc('0x29')](function(_0x564ebd){_0x201539=_(_0x201539)[_0xeabc('0x91')](_0x564ebd)['compact']()[_0xeabc('0x30')]();return db[_0xeabc('0x4c')][_0xeabc('0x33')]({'where':{'id':_0x2a0793[_0xeabc('0x52')]['id']}})[_0xeabc('0x29')](function(_0x94fb8e){return db[_0xeabc('0x8b')][_0xeabc('0x92')](function(_0x4287e3){return _0x94fb8e[_0xeabc('0x82')](_0x2a0793['query'][_0xeabc('0x83')],{'transaction':_0x4287e3})[_0xeabc('0x29')](function(){if(!_['isEmpty'](_0x201539)){return _0x94fb8e[_0xeabc('0x93')](_0x201539,{'transaction':_0x4287e3})['then'](function(){return db[_0xeabc('0x7b')][_0xeabc('0x2a')]({'where':{'VoiceQueueId':_0x2a0793[_0xeabc('0x52')]['id'],'UserId':_0x201539},'transaction':_0x4287e3});});}})[_0xeabc('0x29')](function(){_0x201539['forEach'](function(_0x40156a){socket[_0xeabc('0x81')](_0xeabc('0x94'),{'UserId':_0x40156a,'VoiceQueueId':_0x94fb8e['id']});});});});});});})[_0xeabc('0x29')](respondWithStatusCode(_0x198641,null))[_0xeabc('0x50')](handleError(_0x198641,null));};exports['addAgents']=function(_0x34fc2b,_0x43fa37,_0x4913cf){var _0x584b2b,_0xb28be5;return db[_0xeabc('0x4c')]['find']({'where':{'id':_0x34fc2b[_0xeabc('0x52')]['id']}})[_0xeabc('0x29')](handleEntityNotFound(_0x43fa37,null))['then'](function(_0x4d9ebd){if(_0x4d9ebd){_0xb28be5=_0x4d9ebd;return _0x4d9ebd[_0xeabc('0x95')](_0x34fc2b['body'][_0xeabc('0x83')],_[_0xeabc('0x5e')](_0x34fc2b[_0xeabc('0x55')],['ids','id'])||{})['spread'](function(_0x245991){for(var _0x3abe64=0x0;_0x3abe64<_0x34fc2b[_0xeabc('0x55')][_0xeabc('0x83')][_0xeabc('0x41')];_0x3abe64+=0x1){socket[_0xeabc('0x81')](_0xeabc('0x96'),{'UserId':Number(_0x34fc2b[_0xeabc('0x55')][_0xeabc('0x83')][_0x3abe64]),'VoiceQueueId':Number(_0x34fc2b['params']['id'])});}return _0x245991;});}})['then'](function(_0x1f0a8e){_0x584b2b=_0x1f0a8e||[];if(_0xb28be5){return db[_0xeabc('0x97')][_0xeabc('0x4f')]({'where':{'id':_0x34fc2b['body'][_0xeabc('0x83')]},'attributes':['id',_0xeabc('0x34'),_0xeabc('0x98'),_0xeabc('0x7f'),_0xeabc('0x73')],'raw':!![]});}})[_0xeabc('0x29')](function(_0x2f5ab8){if(!_[_0xeabc('0x99')](_0x2f5ab8)){var _0x1c77a0=[];for(var _0x10f354=0x0;_0x10f354<_0x2f5ab8[_0xeabc('0x41')];_0x10f354++){if(_0x2f5ab8[_0x10f354][_0xeabc('0x98')]){_0x1c77a0['push'](db[_0xeabc('0x7b')][_0xeabc('0x79')]({'membername':_0x2f5ab8[_0x10f354][_0xeabc('0x34')],'UserId':_0x2f5ab8[_0x10f354]['id'],'queue_name':_0xb28be5['name'],'VoiceQueueId':_0xb28be5['id'],'interface':_[_0xeabc('0x7c')](_0x2f5ab8[_0x10f354][_0xeabc('0x73')])?util['format'](_0xeabc('0x7e'),_0x2f5ab8[_0x10f354]['name']):_0x2f5ab8[_0x10f354][_0xeabc('0x73')],'paused':_0x2f5ab8[_0x10f354][_0xeabc('0x7f')]||![],'penalty':_0x34fc2b[_0xeabc('0x55')][_0xeabc('0x76')]||0x0}));}}return BPromise[_0xeabc('0x90')](_0x1c77a0);}})[_0xeabc('0x29')](function(){return _0x584b2b;})[_0xeabc('0x29')](respondWithResult(_0x43fa37,null))[_0xeabc('0x50')](handleError(_0x43fa37,null));};exports[_0xeabc('0x93')]=function(_0x4946af,_0x17a858,_0x4d3ead){return db['VoiceQueue'][_0xeabc('0x33')]({'where':{'id':_0x4946af[_0xeabc('0x52')]['id']}})[_0xeabc('0x29')](handleEntityNotFound(_0x17a858,null))[_0xeabc('0x29')](function(_0x224a0e){if(_0x224a0e){return _0x224a0e[_0xeabc('0x93')](_0x4946af[_0xeabc('0x3c')][_0xeabc('0x83')])[_0xeabc('0x29')](function(){if(_[_0xeabc('0x9a')](_0x4946af[_0xeabc('0x3c')]['ids'])){for(var _0x57cf40=0x0;_0x57cf40<_0x4946af[_0xeabc('0x3c')][_0xeabc('0x83')]['length'];_0x57cf40+=0x1){socket[_0xeabc('0x81')](_0xeabc('0x94'),{'UserId':Number(_0x4946af['query']['ids'][_0x57cf40]),'VoiceQueueId':Number(_0x4946af[_0xeabc('0x52')]['id'])});}}else{socket['emit']('userVoiceQueue:remove',{'UserId':Number(_0x4946af['query'][_0xeabc('0x83')]),'VoiceQueueId':Number(_0x4946af[_0xeabc('0x52')]['id'])});}});}})['then'](function(_0x58982a){return db[_0xeabc('0x7b')]['destroy']({'where':{'VoiceQueueId':_0x4946af[_0xeabc('0x52')]['id'],'UserId':_0x4946af['query']['ids']}})[_0xeabc('0x29')](function(){return _0x58982a;});})[_0xeabc('0x29')](respondWithStatusCode(_0x17a858,null))[_0xeabc('0x50')](handleError(_0x17a858,null));};exports[_0xeabc('0x9b')]=function(_0x2e23da,_0x1bf9a2,_0x29153b){var _0x114ffc={};var _0x235270={};var _0x23fab7;var _0x29b175;return db[_0xeabc('0x4c')][_0xeabc('0x65')]({'where':{'id':_0x2e23da['params']['id']}})[_0xeabc('0x29')](handleEntityNotFound(_0x1bf9a2,null))['then'](function(_0x42ceb1){if(_0x42ceb1){_0x23fab7=_0x42ceb1;_0x235270['model']=_[_0xeabc('0x3d')](db[_0xeabc('0x97')][_0xeabc('0x39')]);_0x235270['query']=_[_0xeabc('0x3d')](_0x2e23da['query']);_0x235270[_0xeabc('0x47')]=_[_0xeabc('0x53')](_0x235270[_0xeabc('0x3e')],_0x235270[_0xeabc('0x3c')]);_0x114ffc[_0xeabc('0x3f')]=_['intersection'](_0x235270[_0xeabc('0x3e')],qs[_0xeabc('0x40')](_0x2e23da[_0xeabc('0x3c')][_0xeabc('0x40')]));_0x114ffc[_0xeabc('0x3f')]=_0x114ffc[_0xeabc('0x3f')][_0xeabc('0x41')]?_0x114ffc[_0xeabc('0x3f')]:_0x235270[_0xeabc('0x3e')];_0x114ffc['order']=qs['sort'](_0x2e23da[_0xeabc('0x3c')][_0xeabc('0x44')]);_0x114ffc[_0xeabc('0x45')]=qs[_0xeabc('0x47')](_['pick'](_0x2e23da[_0xeabc('0x3c')],_0x235270[_0xeabc('0x47')]));if(_0x2e23da[_0xeabc('0x3c')][_0xeabc('0x4a')]){_0x114ffc['where']=_[_0xeabc('0x48')](_0x114ffc[_0xeabc('0x45')],{'$or':_[_0xeabc('0x2f')](_0x114ffc['attributes'],function(_0x497ee4){var _0x43e541={};_0x43e541[_0x497ee4]={'$like':'%'+_0x2e23da[_0xeabc('0x3c')][_0xeabc('0x4a')]+'%'};return _0x43e541;})});}_0x114ffc=_[_0xeabc('0x48')]({},_0x114ffc,_0x2e23da[_0xeabc('0x4b')]);return _0x23fab7[_0xeabc('0x9b')](_0x114ffc);}})[_0xeabc('0x29')](function(_0x4124c6){if(_0x4124c6){_0x29b175=_0x4124c6['length'];if(!_0x2e23da['query'][_0xeabc('0x42')](_0xeabc('0x6c'))){_0x114ffc[_0xeabc('0x23')]=qs['limit'](_0x2e23da[_0xeabc('0x3c')][_0xeabc('0x23')]);_0x114ffc[_0xeabc('0x21')]=qs[_0xeabc('0x21')](_0x2e23da[_0xeabc('0x3c')]['offset']);}return _0x23fab7[_0xeabc('0x9b')](_0x114ffc);}})[_0xeabc('0x29')](function(_0x207932){if(_0x207932){return _0x207932?{'count':_0x29b175,'rows':_0x207932}:null;}})[_0xeabc('0x29')](respondWithResult(_0x1bf9a2,null))[_0xeabc('0x50')](handleError(_0x1bf9a2,null));};exports[_0xeabc('0x9c')]=function(_0x35ed8a,_0x977d14,_0x141dbb){var _0x318be6={};var _0xf97e59={};var _0x1293ab;var _0x55c261;return db[_0xeabc('0x4c')][_0xeabc('0x65')]({'where':{'id':_0x35ed8a[_0xeabc('0x52')]['id']}})['then'](handleEntityNotFound(_0x977d14,null))[_0xeabc('0x29')](function(_0x26e38b){if(_0x26e38b){_0x1293ab=_0x26e38b;_0xf97e59['model']=_[_0xeabc('0x3d')](db[_0xeabc('0x7b')]['rawAttributes']);_0xf97e59['query']=_[_0xeabc('0x3d')](_0x35ed8a[_0xeabc('0x3c')]);_0xf97e59[_0xeabc('0x47')]=_[_0xeabc('0x53')](_0xf97e59[_0xeabc('0x3e')],_0xf97e59[_0xeabc('0x3c')]);_0x318be6[_0xeabc('0x3f')]=_[_0xeabc('0x53')](_0xf97e59['model'],qs['fields'](_0x35ed8a[_0xeabc('0x3c')][_0xeabc('0x40')]));_0x318be6[_0xeabc('0x3f')]=_0x318be6[_0xeabc('0x3f')]['length']?_0x318be6['attributes']:_0xf97e59[_0xeabc('0x3e')];_0x318be6[_0xeabc('0x43')]=qs[_0xeabc('0x44')](_0x35ed8a[_0xeabc('0x3c')][_0xeabc('0x44')]);_0x318be6[_0xeabc('0x45')]=qs[_0xeabc('0x47')](_['pick'](_0x35ed8a[_0xeabc('0x3c')],_0xf97e59[_0xeabc('0x47')]));if(_0x35ed8a[_0xeabc('0x3c')][_0xeabc('0x4a')]){_0x318be6['where']=_['merge'](_0x318be6[_0xeabc('0x45')],{'$or':_[_0xeabc('0x2f')](_0x318be6[_0xeabc('0x3f')],function(_0xb9df16){var _0x432709={};_0x432709[_0xb9df16]={'$like':'%'+_0x35ed8a[_0xeabc('0x3c')][_0xeabc('0x4a')]+'%'};return _0x432709;})});}_0x318be6=_[_0xeabc('0x48')]({},_0x318be6,_0x35ed8a[_0xeabc('0x4b')]);return _0x1293ab[_0xeabc('0x9c')](_0x318be6);}})[_0xeabc('0x29')](function(_0x2a3a5c){if(_0x2a3a5c){_0x55c261=_0x2a3a5c[_0xeabc('0x41')];if(!_0x35ed8a[_0xeabc('0x3c')][_0xeabc('0x42')](_0xeabc('0x6c'))){_0x318be6[_0xeabc('0x23')]=qs['limit'](_0x35ed8a['query']['limit']);_0x318be6['offset']=qs['offset'](_0x35ed8a[_0xeabc('0x3c')][_0xeabc('0x21')]);}return _0x1293ab['getMembers'](_0x318be6);}})[_0xeabc('0x29')](function(_0xdfb37a){return _0xdfb37a?{'count':_0x55c261,'rows':_0xdfb37a}:null;})[_0xeabc('0x29')](respondWithResult(_0x977d14,null))[_0xeabc('0x50')](handleError(_0x977d14,null));};exports[_0xeabc('0x9d')]=function(_0x366034,_0x5d16cb,_0x52c973){var _0x1f90b6={};var _0x1c0703={};var _0x5ad17f;var _0x3f6255;return db['VoiceQueue'][_0xeabc('0x65')]({'where':{'id':_0x366034['params']['id']}})[_0xeabc('0x29')](handleEntityNotFound(_0x5d16cb,null))[_0xeabc('0x29')](function(_0x31df33){if(_0x31df33){_0x5ad17f=_0x31df33;_0x1c0703[_0xeabc('0x3e')]=_['keys'](db[_0xeabc('0x9e')][_0xeabc('0x39')]);_0x1c0703[_0xeabc('0x3c')]=_[_0xeabc('0x3d')](_0x366034[_0xeabc('0x3c')]);_0x1c0703[_0xeabc('0x47')]=_[_0xeabc('0x53')](_0x1c0703[_0xeabc('0x3e')],_0x1c0703['query']);_0x1f90b6[_0xeabc('0x3f')]=_['intersection'](_0x1c0703[_0xeabc('0x3e')],qs[_0xeabc('0x40')](_0x366034[_0xeabc('0x3c')]['fields']));_0x1f90b6[_0xeabc('0x3f')]=_0x1f90b6['attributes']['length']?_0x1f90b6[_0xeabc('0x3f')]:_0x1c0703['model'];_0x1f90b6[_0xeabc('0x43')]=qs[_0xeabc('0x44')](_0x366034[_0xeabc('0x3c')]['sort']);_0x1f90b6[_0xeabc('0x45')]=qs['filters'](_['pick'](_0x366034[_0xeabc('0x3c')],_0x1c0703[_0xeabc('0x47')]));if(_0x366034['query']['filter']){_0x1f90b6[_0xeabc('0x45')]=_[_0xeabc('0x48')](_0x1f90b6[_0xeabc('0x45')],{'$or':_[_0xeabc('0x2f')](_0x1f90b6[_0xeabc('0x3f')],function(_0x274693){var _0x73de81={};_0x73de81[_0x274693]={'$like':'%'+_0x366034['query'][_0xeabc('0x4a')]+'%'};return _0x73de81;})});}_0x1f90b6=_['merge']({},_0x1f90b6,_0x366034[_0xeabc('0x4b')]);return _0x5ad17f[_0xeabc('0x9d')](_0x1f90b6);}})[_0xeabc('0x29')](function(_0x197261){if(_0x197261){_0x3f6255=_0x197261['length'];if(!_0x366034['query'][_0xeabc('0x42')](_0xeabc('0x6c'))){_0x1f90b6[_0xeabc('0x23')]=qs[_0xeabc('0x23')](_0x366034[_0xeabc('0x3c')][_0xeabc('0x23')]);_0x1f90b6[_0xeabc('0x21')]=qs[_0xeabc('0x21')](_0x366034[_0xeabc('0x3c')]['offset']);}return _0x5ad17f[_0xeabc('0x9d')](_0x1f90b6);}})[_0xeabc('0x29')](function(_0x16d3c1){if(_0x16d3c1){return _0x16d3c1?{'count':_0x3f6255,'rows':_0x16d3c1}:null;}})['then'](respondWithResult(_0x5d16cb,null))[_0xeabc('0x50')](handleError(_0x5d16cb,null));};exports[_0xeabc('0x9f')]=function(_0x5cf0e6,_0x4f8763,_0x534147){var _0x1708ec=moment()[_0xeabc('0x7d')](_0xeabc('0xa0'));var _0x394082,_0xc1fb57;return db[_0xeabc('0x4c')][_0xeabc('0x33')]({'where':{'id':_0x5cf0e6['params']['id']}})[_0xeabc('0x29')](handleEntityNotFound(_0x4f8763,null))['then'](function(_0x3939a5){if(_0x3939a5){_0xc1fb57=_0x3939a5;return _0x3939a5[_0xeabc('0x9f')](_0x5cf0e6[_0xeabc('0x55')][_0xeabc('0x83')],_[_0xeabc('0x5e')](_0x5cf0e6['body'],[_0xeabc('0x83'),'id'])||{});}return null;})[_0xeabc('0xa1')](function(_0x5a92db){var _0xceed5f;_0x394082=_0x5a92db||[];var _0x44ac6f=[];if(_0x5a92db){for(var _0x3b807d=0x0;_0x3b807d<_0x5a92db[_0xeabc('0x41')];_0x3b807d+=0x1){var _0x11128b=_0x5a92db[_0x3b807d][_0xeabc('0x2b')]({'plain':!![]});_0xc1fb57[_0xeabc('0xa2')]=_0x5cf0e6[_0xeabc('0x55')]['dialCheckDuplicateType']?_0x5cf0e6[_0xeabc('0x55')][_0xeabc('0xa2')]:_0xc1fb57[_0xeabc('0xa2')];switch(_0xc1fb57['dialCheckDuplicateType']){case _0xeabc('0xa3'):_0xceed5f=squel[_0xeabc('0xa4')]()[_0xeabc('0xa5')]('cm_hopper')[_0xeabc('0xa6')](['phone',_0xeabc('0xa7'),_0xeabc('0xa8'),_0xeabc('0xa9'),_0xeabc('0x67'),'createdAt',_0xeabc('0x60')],squel[_0xeabc('0x84')]()['field'](_0xeabc('0xaa'),'phone')[_0xeabc('0x85')]('\x27'+_0x1708ec+'\x27',_0xeabc('0xa7'))[_0xeabc('0x85')]('id',_0xeabc('0xa8'))['field'](_0x11128b[_0xeabc('0xab')][_0xeabc('0x8c')](),_0xeabc('0xa9'))[_0xeabc('0x85')](_0x5cf0e6['params']['id']['toString'](),_0xeabc('0x67'))['field']('\x27'+_0x1708ec+'\x27','createdAt')['field']('\x27'+_0x1708ec+'\x27','updatedAt')[_0xeabc('0x86')](_0xeabc('0xac'))['where'](_0xeabc('0xad'))[_0xeabc('0x45')](_0xeabc('0xae'),_0x11128b[_0xeabc('0xab')][_0xeabc('0x8c')]())[_0xeabc('0x45')]('phone\x20IS\x20NOT\x20NULL')[_0xeabc('0x45')](_0xeabc('0xaf'),squel[_0xeabc('0x84')]()[_0xeabc('0x85')](_0xeabc('0xb0'))[_0xeabc('0x86')](_0xeabc('0xb1'))[_0xeabc('0x45')](_0xeabc('0xb2'),_0x5cf0e6[_0xeabc('0x52')]['id'][_0xeabc('0x8c')]()))[_0xeabc('0x45')]('phone\x20NOT\x20IN\x20(?)',squel[_0xeabc('0x84')]()[_0xeabc('0x85')](_0xeabc('0xb3'))[_0xeabc('0x86')]('cm_hopper')[_0xeabc('0x45')](_0xeabc('0xb2'),_0x5cf0e6['params']['id']['toString']())))[_0xeabc('0x8c')]();break;case _0xeabc('0xb4'):_0xceed5f=squel[_0xeabc('0xa4')]()[_0xeabc('0xa5')](_0xeabc('0xb5'))['fromQuery']([_0xeabc('0xaa'),_0xeabc('0xa7'),_0xeabc('0xa8'),_0xeabc('0xa9'),_0xeabc('0x67'),_0xeabc('0x5f'),'updatedAt'],squel[_0xeabc('0x84')]()[_0xeabc('0x85')](_0xeabc('0xaa'),_0xeabc('0xaa'))[_0xeabc('0x85')]('\x27'+_0x1708ec+'\x27',_0xeabc('0xa7'))['field']('id',_0xeabc('0xa8'))[_0xeabc('0x85')](_0x11128b[_0xeabc('0xab')][_0xeabc('0x8c')](),'ListId')[_0xeabc('0x85')](_0x5cf0e6[_0xeabc('0x52')]['id']['toString'](),_0xeabc('0x67'))[_0xeabc('0x85')]('\x27'+_0x1708ec+'\x27',_0xeabc('0x5f'))[_0xeabc('0x85')]('\x27'+_0x1708ec+'\x27',_0xeabc('0x60'))[_0xeabc('0x86')](_0xeabc('0xac'))[_0xeabc('0x45')](_0xeabc('0xad'))[_0xeabc('0x45')](_0xeabc('0xae'),_0x11128b[_0xeabc('0xab')][_0xeabc('0x8c')]())['where']('phone\x20IS\x20NOT\x20NULL')['where'](_0xeabc('0xaf'),squel[_0xeabc('0x84')]()['field'](_0xeabc('0xb3'))[_0xeabc('0x86')](_0xeabc('0xb5'))['where'](_0xeabc('0xb2'),_0x5cf0e6[_0xeabc('0x52')]['id'][_0xeabc('0x8c')]())))[_0xeabc('0x8c')]();break;default:_0xceed5f=squel[_0xeabc('0xa4')]()[_0xeabc('0xa5')](_0xeabc('0xb5'))[_0xeabc('0xa6')](['phone','scheduledAt','ContactId',_0xeabc('0xa9'),_0xeabc('0x67'),'createdAt','updatedAt'],squel[_0xeabc('0x84')]()[_0xeabc('0x85')](_0xeabc('0xaa'),_0xeabc('0xaa'))['field']('\x27'+_0x1708ec+'\x27',_0xeabc('0xa7'))[_0xeabc('0x85')]('id',_0xeabc('0xa8'))[_0xeabc('0x85')](_0x11128b[_0xeabc('0xab')][_0xeabc('0x8c')](),'ListId')[_0xeabc('0x85')](_0x5cf0e6[_0xeabc('0x52')]['id']['toString'](),'VoiceQueueId')[_0xeabc('0x85')]('\x27'+_0x1708ec+'\x27',_0xeabc('0x5f'))['field']('\x27'+_0x1708ec+'\x27',_0xeabc('0x60'))[_0xeabc('0x86')]('cm_contacts')[_0xeabc('0x45')]('deletedAt\x20IS\x20NULL')[_0xeabc('0x45')](_0xeabc('0xae'),_0x11128b[_0xeabc('0xab')]['toString']())[_0xeabc('0x45')](_0xeabc('0xb6')))['toString']();}_0x44ac6f[_0xeabc('0x8a')](db[_0xeabc('0x8b')][_0xeabc('0x3c')](_0xceed5f));}return BPromise[_0xeabc('0x90')](_0x44ac6f);}})['then'](function(){var _0x390d90=[];var _0x414fc3=squel[_0xeabc('0xa4')]()[_0xeabc('0xa5')](_0xeabc('0xb7'))[_0xeabc('0xa6')]([_0xeabc('0xb8'),_0xeabc('0xaa'),_0xeabc('0xb9'),'createdAt',_0xeabc('0x60')],squel[_0xeabc('0x84')]()[_0xeabc('0x85')](_0xeabc('0xba'))[_0xeabc('0x85')]('ci.item')[_0xeabc('0x85')]('ci.OrderBy')[_0xeabc('0x85')]('\x27'+_0x1708ec+'\x27',_0xeabc('0x5f'))[_0xeabc('0x85')]('\x27'+_0x1708ec+'\x27','updatedAt')['from'](_0xeabc('0xbb'),'ci')[_0xeabc('0x88')](_0xeabc('0xb5'),'h','h.ContactId=ci.CmContactId')[_0xeabc('0x45')](_0xeabc('0xbc'),_0x1708ec)[_0xeabc('0x45')]('ci.ItemClass=?',_0xeabc('0xbd')))['toString']();_0x390d90[_0xeabc('0x8a')](db['sequelize'][_0xeabc('0x3c')](_0x414fc3));return BPromise[_0xeabc('0x90')](_0x390d90);})[_0xeabc('0x29')](function(){return _0x394082;})[_0xeabc('0x29')](respondWithResult(_0x4f8763,null))[_0xeabc('0x50')](handleError(_0x4f8763,null));};exports[_0xeabc('0xbe')]=function(_0x1216cf,_0x198c42,_0x21a0df){return db[_0xeabc('0x4c')][_0xeabc('0x33')]({'where':{'id':_0x1216cf['params']['id']}})[_0xeabc('0x29')](handleEntityNotFound(_0x198c42,null))[_0xeabc('0x29')](function(_0x42c8c9){if(_0x42c8c9){return _0x42c8c9[_0xeabc('0xbe')](_0x1216cf[_0xeabc('0x3c')][_0xeabc('0x83')]);}})['then'](function(_0x67df66){if(_0x67df66){return db[_0xeabc('0x66')][_0xeabc('0x2a')]({'where':{'ListId':_0x1216cf[_0xeabc('0x3c')][_0xeabc('0x83')],'VoiceQueueId':_0x1216cf[_0xeabc('0x52')]['id']}})[_0xeabc('0x29')](function(){return _0x67df66;});}})[_0xeabc('0x29')](respondWithStatusCode(_0x198c42,null))[_0xeabc('0x50')](handleError(_0x198c42,null));};exports['getBlackLists']=function(_0xaf0794,_0x47da72,_0x30b6a2){var _0xcc42a7={};var _0x13be21={};var _0x28a4cb;var _0x5ee7bb;return db[_0xeabc('0x4c')][_0xeabc('0x65')]({'where':{'id':_0xaf0794['params']['id']}})[_0xeabc('0x29')](handleEntityNotFound(_0x47da72,null))['then'](function(_0x22c237){if(_0x22c237){_0x28a4cb=_0x22c237;_0x13be21[_0xeabc('0x3e')]=_['keys'](db[_0xeabc('0x9e')]['rawAttributes']);_0x13be21['query']=_['keys'](_0xaf0794[_0xeabc('0x3c')]);_0x13be21[_0xeabc('0x47')]=_[_0xeabc('0x53')](_0x13be21[_0xeabc('0x3e')],_0x13be21[_0xeabc('0x3c')]);_0xcc42a7[_0xeabc('0x3f')]=_[_0xeabc('0x53')](_0x13be21[_0xeabc('0x3e')],qs[_0xeabc('0x40')](_0xaf0794[_0xeabc('0x3c')]['fields']));_0xcc42a7[_0xeabc('0x3f')]=_0xcc42a7['attributes'][_0xeabc('0x41')]?_0xcc42a7[_0xeabc('0x3f')]:_0x13be21[_0xeabc('0x3e')];_0xcc42a7['order']=qs[_0xeabc('0x44')](_0xaf0794['query']['sort']);_0xcc42a7[_0xeabc('0x45')]=qs['filters'](_[_0xeabc('0x46')](_0xaf0794[_0xeabc('0x3c')],_0x13be21['filters']));if(_0xaf0794[_0xeabc('0x3c')]['filter']){_0xcc42a7[_0xeabc('0x45')]=_['merge'](_0xcc42a7[_0xeabc('0x45')],{'$or':_['map'](_0xcc42a7[_0xeabc('0x3f')],function(_0x559792){var _0xb959bf={};_0xb959bf[_0x559792]={'$like':'%'+_0xaf0794[_0xeabc('0x3c')][_0xeabc('0x4a')]+'%'};return _0xb959bf;})});}_0xcc42a7=_[_0xeabc('0x48')]({},_0xcc42a7,_0xaf0794['options']);return _0x28a4cb['getBlackLists'](_0xcc42a7);}})['then'](function(_0x51f91d){if(_0x51f91d){_0x5ee7bb=_0x51f91d[_0xeabc('0x41')];if(!_0xaf0794[_0xeabc('0x3c')][_0xeabc('0x42')]('nolimit')){_0xcc42a7[_0xeabc('0x23')]=qs['limit'](_0xaf0794[_0xeabc('0x3c')][_0xeabc('0x23')]);_0xcc42a7[_0xeabc('0x21')]=qs[_0xeabc('0x21')](_0xaf0794['query']['offset']);}return _0x28a4cb['getBlackLists'](_0xcc42a7);}})[_0xeabc('0x29')](function(_0x457d82){if(_0x457d82){return _0x457d82?{'count':_0x5ee7bb,'rows':_0x457d82}:null;}})[_0xeabc('0x29')](respondWithResult(_0x47da72,null))[_0xeabc('0x50')](handleError(_0x47da72,null));};exports['addBlackLists']=function(_0x3d9f54,_0x440501,_0x11a8af){var _0x268aff,_0x1fbd9b;return db[_0xeabc('0x4c')][_0xeabc('0x33')]({'where':{'id':_0x3d9f54[_0xeabc('0x52')]['id']}})[_0xeabc('0x29')](handleEntityNotFound(_0x440501,null))[_0xeabc('0x29')](function(_0x5643f6){if(_0x5643f6){_0x1fbd9b=_0x5643f6;return _0x5643f6['addBlackLists'](_0x3d9f54['body'][_0xeabc('0x83')],_[_0xeabc('0x5e')](_0x3d9f54[_0xeabc('0x55')],[_0xeabc('0x83'),'id'])||{});}return null;})[_0xeabc('0xa1')](function(_0x18157e){var _0x404839;_0x268aff=_0x18157e||[];var _0x30eb6f=[];if(_0x18157e){for(var _0xba3953=0x0;_0xba3953<_0x18157e[_0xeabc('0x41')];_0xba3953+=0x1){var _0xa1613b=_0x18157e[_0xba3953][_0xeabc('0x2b')]({'plain':!![]});_0x404839=squel[_0xeabc('0xa4')]()['into']('cm_hopper_black')[_0xeabc('0xa6')](['phone',_0xeabc('0xa8'),'ListId',_0xeabc('0x67'),_0xeabc('0x5f'),'updatedAt'],squel['select']()[_0xeabc('0x85')](_0xeabc('0xaa'),_0xeabc('0xaa'))['field']('id',_0xeabc('0xa8'))[_0xeabc('0x85')](_0xa1613b[_0xeabc('0xab')][_0xeabc('0x8c')](),'ListId')[_0xeabc('0x85')](_0x3d9f54[_0xeabc('0x52')]['id'][_0xeabc('0x8c')](),_0xeabc('0x67'))[_0xeabc('0x85')](_0xeabc('0xbf'),_0xeabc('0x5f'))[_0xeabc('0x85')](_0xeabc('0xbf'),_0xeabc('0x60'))[_0xeabc('0x86')](_0xeabc('0xac'))[_0xeabc('0x45')](_0xeabc('0xad'))[_0xeabc('0x45')](_0xeabc('0xae'),_0xa1613b[_0xeabc('0xab')][_0xeabc('0x8c')]())[_0xeabc('0x45')]('phone\x20IS\x20NOT\x20NULL'))[_0xeabc('0x8c')]();_0x30eb6f[_0xeabc('0x8a')](db[_0xeabc('0x8b')][_0xeabc('0x3c')](_0x404839));}return BPromise[_0xeabc('0x90')](_0x30eb6f);}})[_0xeabc('0x29')](function(){return _0x268aff;})[_0xeabc('0x29')](respondWithResult(_0x440501,null))['catch'](handleError(_0x440501,null));};exports[_0xeabc('0xc0')]=function(_0xb22c9f,_0x24bc07,_0x52bc60){return db[_0xeabc('0x4c')][_0xeabc('0x33')]({'where':{'id':_0xb22c9f[_0xeabc('0x52')]['id']}})[_0xeabc('0x29')](handleEntityNotFound(_0x24bc07,null))['then'](function(_0x3a3d98){if(_0x3a3d98){return _0x3a3d98[_0xeabc('0xc0')](_0xb22c9f[_0xeabc('0x3c')][_0xeabc('0x83')]);}})[_0xeabc('0x29')](function(_0x14cf92){if(_0x14cf92){return db[_0xeabc('0x6e')][_0xeabc('0x2a')]({'where':{'ListId':_0xb22c9f[_0xeabc('0x3c')][_0xeabc('0x83')],'VoiceQueueId':_0xb22c9f[_0xeabc('0x52')]['id']}})[_0xeabc('0x29')](function(){return _0x14cf92;});}})[_0xeabc('0x29')](respondWithStatusCode(_0x24bc07,null))[_0xeabc('0x50')](handleError(_0x24bc07,null));}; \ No newline at end of file +var _0xabce=['voicePause','forEach','emit','removeTeams','ids','select','field','from','team_has_voice_queues','join','ut.TeamId\x20=\x20tq.TeamId','push','sequelize','toString','QueryTypes','SELECT','TeamId','all','union','transaction','removeAgents','userVoiceQueue:remove','addAgents','userVoiceQueue:save','User','online','isEmpty','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','spread','dialCheckDuplicateType','always','insert','into','fromQuery','scheduledAt','ContactId','ListId','phone','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_hopper','phone\x20IS\x20NOT\x20NULL','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','cm_contact_has_items','h.scheduledat=?','PHONE','removeLists','NOW()','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueue.socket','sendStatus','end','status','offset','undefined','limit','count','set','json','reject','save','then','destroy','get','inbound','outbound','ignore','map','value','includes','type','find','name','error','stack','send','index','rawAttributes','fieldName','key','query','keys','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','VoiceQueue','includeAll','include','findAll','catch','show','params','intersection','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','QueueCampaigns','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','role','VoiceQueues','update','getHoppers','findOne','CmHopper','VoiceQueueId','rows','getHopperHistories','CmHopperHistory','CmHopperFinal','nolimit','getHopperBlacks','CmHopperBlack','Team','getTeams','addTeams','teams','interface','flatMap','Agents','penalty','each','TeamVoiceQueue','upsert','UserVoiceQueue','UserVoiceQueueRt','isNil','format','SIP/%s'];(function(_0x4f0498,_0x553933){var _0x5d8d2c=function(_0x4d523e){while(--_0x4d523e){_0x4f0498['push'](_0x4f0498['shift']());}};_0x5d8d2c(++_0x553933);}(_0xabce,0x103));var _0xeabc=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xabce[_0x2d8fc2];return _0x3a9e53;};'use strict';var emlformat=require(_0xeabc('0x0'));var rimraf=require(_0xeabc('0x1'));var zipdir=require(_0xeabc('0x2'));var jsonpatch=require(_0xeabc('0x3'));var rp=require(_0xeabc('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeabc('0x5'));var util=require(_0xeabc('0x6'));var path=require(_0xeabc('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeabc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeabc('0x9'));var squel=require('squel');var crypto=require(_0xeabc('0xa'));var jsforce=require(_0xeabc('0xb'));var deskjs=require(_0xeabc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeabc('0xd'));var Papa=require(_0xeabc('0xe'));var Redis=require(_0xeabc('0xf'));var authService=require(_0xeabc('0x10'));var qs=require(_0xeabc('0x11'));var as=require(_0xeabc('0x12'));var hardwareService=require(_0xeabc('0x13'));var logger=require(_0xeabc('0x14'))(_0xeabc('0x15'));var utils=require(_0xeabc('0x16'));var config=require(_0xeabc('0x17'));var licenseUtil=require(_0xeabc('0x18'));var db=require(_0xeabc('0x19'))['db'];config[_0xeabc('0x1a')]=_[_0xeabc('0x1b')](config[_0xeabc('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xeabc('0x1c'))(new Redis(config[_0xeabc('0x1a')]));require(_0xeabc('0x1d'))['register'](socket);function respondWithStatusCode(_0x5f4ee8,_0x3170ea){_0x3170ea=_0x3170ea||0xcc;return function(_0x3ae954){if(_0x3ae954){return _0x5f4ee8[_0xeabc('0x1e')](_0x3170ea);}return _0x5f4ee8['status'](_0x3170ea)[_0xeabc('0x1f')]();};}function respondWithResult(_0x638976,_0x49f2d8){_0x49f2d8=_0x49f2d8||0xc8;return function(_0x53fe28){if(_0x53fe28){return _0x638976[_0xeabc('0x20')](_0x49f2d8)['json'](_0x53fe28);}};}function respondWithFilteredResult(_0x3d0e21,_0x1b64b9){return function(_0x58a3c0){if(_0x58a3c0){var _0x16f08b=typeof _0x1b64b9[_0xeabc('0x21')]===_0xeabc('0x22')&&typeof _0x1b64b9[_0xeabc('0x23')]===_0xeabc('0x22');var _0x5d92e5=_0x58a3c0[_0xeabc('0x24')];var _0x4d68ea=_0x16f08b?0x0:_0x1b64b9[_0xeabc('0x21')];var _0x16530c=_0x16f08b?_0x58a3c0['count']:_0x1b64b9[_0xeabc('0x21')]+_0x1b64b9[_0xeabc('0x23')];var _0x254590;if(_0x16530c>=_0x5d92e5){_0x16530c=_0x5d92e5;_0x254590=0xc8;}else{_0x254590=0xce;}_0x3d0e21[_0xeabc('0x20')](_0x254590);return _0x3d0e21[_0xeabc('0x25')]('Content-Range',_0x4d68ea+'-'+_0x16530c+'/'+_0x5d92e5)[_0xeabc('0x26')](_0x58a3c0);}return null;};}function patchUpdates(_0x10c675){return function(_0x91ab00){try{jsonpatch['apply'](_0x91ab00,_0x10c675,!![]);}catch(_0x457f27){return BPromise[_0xeabc('0x27')](_0x457f27);}return _0x91ab00[_0xeabc('0x28')]();};}function saveUpdates(_0x319119,_0x5b8838){return function(_0x109e1d){if(_0x109e1d){return _0x109e1d['update'](_0x319119)[_0xeabc('0x29')](function(_0x4d4e29){return _0x4d4e29;});}return null;};}function removeEntity(_0x811f0d,_0x12acbd){return function(_0x269621){if(_0x269621){return _0x269621[_0xeabc('0x2a')]()[_0xeabc('0x29')](function(){var _0x137293=_0x269621[_0xeabc('0x2b')]({'plain':!![]});var _0x4c2693=[{'name':'VoiceQueues','value':_0xeabc('0x2c'),'ignore':![]},{'name':'QueueCampaigns','value':_0xeabc('0x2d'),'ignore':![]}];var _0x2b342c=_(_0x4c2693)['filter'](_0xeabc('0x2e'))[_0xeabc('0x2f')](_0xeabc('0x30'))[_0xeabc('0x30')]();if(_[_0xeabc('0x31')](_0x2b342c,_0x137293[_0xeabc('0x32')])){return;}var _0x2c62fe=_[_0xeabc('0x33')](_0x4c2693,[_0xeabc('0x30'),_0x137293['type']])[_0xeabc('0x34')];return db['UserProfileResource'][_0xeabc('0x2a')]({'where':{'type':_0x2c62fe,'resourceId':_0x137293['id']}})[_0xeabc('0x29')](function(){return _0x269621;});})[_0xeabc('0x29')](function(){_0x811f0d[_0xeabc('0x20')](0xcc)[_0xeabc('0x1f')]();});}};}function handleEntityNotFound(_0x368b8a,_0x61c0af){return function(_0x545d7f){if(!_0x545d7f){_0x368b8a[_0xeabc('0x1e')](0x194);}return _0x545d7f;};}function handleError(_0x2df9e6,_0x3bc45e){_0x3bc45e=_0x3bc45e||0x1f4;return function(_0x4918e2){logger[_0xeabc('0x35')](_0x4918e2[_0xeabc('0x36')]);if(_0x4918e2[_0xeabc('0x34')]){delete _0x4918e2['name'];}_0x2df9e6[_0xeabc('0x20')](_0x3bc45e)[_0xeabc('0x37')](_0x4918e2);};}exports[_0xeabc('0x38')]=function(_0x521091,_0xf98c7c){var _0x286203={},_0x5d9acf={},_0x50cca2={'count':0x0,'rows':[]};var _0x254568=_[_0xeabc('0x2f')](db['VoiceQueue'][_0xeabc('0x39')],function(_0x81976d){return{'name':_0x81976d[_0xeabc('0x3a')],'type':_0x81976d[_0xeabc('0x32')][_0xeabc('0x3b')]};});_0x5d9acf['model']=_[_0xeabc('0x2f')](_0x254568,'name');_0x5d9acf[_0xeabc('0x3c')]=_[_0xeabc('0x3d')](_0x521091[_0xeabc('0x3c')]);_0x5d9acf['filters']=_['intersection'](_0x5d9acf[_0xeabc('0x3e')],_0x5d9acf['query']);_0x286203[_0xeabc('0x3f')]=_['intersection'](_0x5d9acf['model'],qs['fields'](_0x521091['query'][_0xeabc('0x40')]));_0x286203['attributes']=_0x286203[_0xeabc('0x3f')][_0xeabc('0x41')]?_0x286203['attributes']:_0x5d9acf[_0xeabc('0x3e')];if(!_0x521091['query'][_0xeabc('0x42')]('nolimit')){_0x286203[_0xeabc('0x23')]=qs[_0xeabc('0x23')](_0x521091[_0xeabc('0x3c')]['limit']);_0x286203['offset']=qs['offset'](_0x521091[_0xeabc('0x3c')][_0xeabc('0x21')]);}_0x286203[_0xeabc('0x43')]=qs['sort'](_0x521091['query'][_0xeabc('0x44')]);_0x286203[_0xeabc('0x45')]=qs['filters'](_[_0xeabc('0x46')](_0x521091['query'],_0x5d9acf[_0xeabc('0x47')]),_0x254568);if(_0x521091['query']['filter']){_0x286203['where']=_[_0xeabc('0x48')](_0x286203[_0xeabc('0x45')],{'$or':_[_0xeabc('0x2f')](_0x254568,function(_0x3eeeb5){if(_0x3eeeb5['type']!==_0xeabc('0x49')){var _0x555d26={};_0x555d26[_0x3eeeb5[_0xeabc('0x34')]]={'$like':'%'+_0x521091[_0xeabc('0x3c')][_0xeabc('0x4a')]+'%'};return _0x555d26;}})});}_0x286203=_[_0xeabc('0x48')]({},_0x286203,_0x521091[_0xeabc('0x4b')]);var _0x48b988={'where':_0x286203['where']};return db[_0xeabc('0x4c')]['count'](_0x48b988)[_0xeabc('0x29')](function(_0x2cdf59){_0x50cca2['count']=_0x2cdf59;if(_0x521091[_0xeabc('0x3c')][_0xeabc('0x4d')]){_0x286203[_0xeabc('0x4e')]=[{'all':!![]}];}return db[_0xeabc('0x4c')][_0xeabc('0x4f')](_0x286203);})[_0xeabc('0x29')](function(_0x2003a7){_0x50cca2['rows']=_0x2003a7;return _0x50cca2;})[_0xeabc('0x29')](respondWithFilteredResult(_0xf98c7c,_0x286203))[_0xeabc('0x50')](handleError(_0xf98c7c,null));};exports[_0xeabc('0x51')]=function(_0x1b41c8,_0x271f8c){var _0x3fbc97={'raw':![],'where':{'id':_0x1b41c8[_0xeabc('0x52')]['id']}},_0x2107d5={};_0x2107d5[_0xeabc('0x3e')]=_[_0xeabc('0x3d')](db['VoiceQueue'][_0xeabc('0x39')]);_0x2107d5[_0xeabc('0x3c')]=_[_0xeabc('0x3d')](_0x1b41c8[_0xeabc('0x3c')]);_0x2107d5[_0xeabc('0x47')]=_[_0xeabc('0x53')](_0x2107d5[_0xeabc('0x3e')],_0x2107d5['query']);_0x3fbc97[_0xeabc('0x3f')]=_[_0xeabc('0x53')](_0x2107d5[_0xeabc('0x3e')],qs[_0xeabc('0x40')](_0x1b41c8[_0xeabc('0x3c')]['fields']));_0x3fbc97[_0xeabc('0x3f')]=_0x3fbc97[_0xeabc('0x3f')][_0xeabc('0x41')]?_0x3fbc97[_0xeabc('0x3f')]:_0x2107d5['model'];if(_0x1b41c8[_0xeabc('0x3c')][_0xeabc('0x4d')]){_0x3fbc97['include']=[{'all':!![]}];}_0x3fbc97=_[_0xeabc('0x48')]({},_0x3fbc97,_0x1b41c8['options']);return db[_0xeabc('0x4c')]['find'](_0x3fbc97)[_0xeabc('0x29')](handleEntityNotFound(_0x271f8c,null))[_0xeabc('0x29')](respondWithResult(_0x271f8c,null))[_0xeabc('0x50')](handleError(_0x271f8c,null));};exports[_0xeabc('0x54')]=function(_0x1ee837,_0x15ba95){return db[_0xeabc('0x4c')][_0xeabc('0x54')](_0x1ee837[_0xeabc('0x55')],{})[_0xeabc('0x29')](function(_0x48a13f){var _0x180a14=_0x1ee837[_0xeabc('0x56')][_0xeabc('0x2b')]({'plain':!![]});if(!_0x180a14)throw new Error(_0xeabc('0x57'));if(_0x180a14['role']===_0xeabc('0x56')){var _0x392913=_0x48a13f[_0xeabc('0x2b')]({'plain':!![]});var _0x21f972=[{'name':'VoiceQueues','value':_0xeabc('0x2c')},{'name':_0xeabc('0x58'),'value':_0xeabc('0x2d')}];var _0xa55cce=_[_0xeabc('0x33')](_0x21f972,[_0xeabc('0x30'),_0x392913[_0xeabc('0x32')]])[_0xeabc('0x34')];return db[_0xeabc('0x59')]['find']({'where':{'name':_0xa55cce,'userProfileId':_0x180a14[_0xeabc('0x5a')]},'raw':!![]})['then'](function(_0x5e09fc){if(_0x5e09fc&&_0x5e09fc['autoAssociation']===0x0){return db[_0xeabc('0x5b')][_0xeabc('0x54')]({'name':_0x392913[_0xeabc('0x34')],'resourceId':_0x392913['id'],'type':_0x5e09fc[_0xeabc('0x34')],'sectionId':_0x5e09fc['id']},{})[_0xeabc('0x29')](function(){return _0x48a13f;});}else{return _0x48a13f;}})[_0xeabc('0x50')](function(_0x4a2ad6){logger[_0xeabc('0x35')](_0xeabc('0x5c'),_0x4a2ad6);throw _0x4a2ad6;});}return _0x48a13f;})[_0xeabc('0x29')](respondWithResult(_0x15ba95,0xc9))[_0xeabc('0x50')](handleError(_0x15ba95,null));};exports[_0xeabc('0x5d')]=function(_0x2c7b4e,_0x1750e9){var _0x25c728={'where':{'id':_0x2c7b4e['params']['id']}},_0x5820ca={};_0x5820ca[_0xeabc('0x3e')]=_[_0xeabc('0x3d')](db[_0xeabc('0x4c')]['rawAttributes']);_0x25c728[_0xeabc('0x3f')]=_['intersection'](_0x5820ca['model'],qs[_0xeabc('0x40')](_0x2c7b4e[_0xeabc('0x3c')][_0xeabc('0x40')]));_0x25c728[_0xeabc('0x3f')]=_0x25c728[_0xeabc('0x3f')][_0xeabc('0x41')]?_0x25c728['attributes']:_0x5820ca[_0xeabc('0x3e')];if(_0x2c7b4e[_0xeabc('0x3c')][_0xeabc('0x4d')]){_0x25c728[_0xeabc('0x4e')]=[{'all':!![]}];}_0x25c728=_[_0xeabc('0x48')]({},_0x25c728,_0x2c7b4e[_0xeabc('0x4b')]);return db['VoiceQueue'][_0xeabc('0x33')](_0x25c728)[_0xeabc('0x29')](handleEntityNotFound(_0x1750e9,null))[_0xeabc('0x29')](function(_0x165899){if(_0x165899){var _0x1b61a8=_0x165899[_0xeabc('0x2b')]({'plain':!![]});_0x1b61a8=qs[_0xeabc('0x5e')](_0x1b61a8,['id',_0xeabc('0x5f'),_0xeabc('0x60')]);_0x2c7b4e['body']=_[_0xeabc('0x5e')](_0x2c7b4e['body'],['id',_0xeabc('0x5f'),_0xeabc('0x60')]);return db[_0xeabc('0x4c')][_0xeabc('0x54')](_[_0xeabc('0x48')](_0x1b61a8,_0x2c7b4e[_0xeabc('0x55')]),{'include':_0x2c7b4e[_0xeabc('0x3c')][_0xeabc('0x4d')]?[{'all':!![]}]:undefined})[_0xeabc('0x29')](function(_0x24d0e5){var _0x5702cb=_0x2c7b4e[_0xeabc('0x56')][_0xeabc('0x2b')]({'plain':!![]});if(!_0x5702cb)throw new Error(_0xeabc('0x57'));if(_0x5702cb[_0xeabc('0x61')]==='user'){var _0x12fd48=_0x24d0e5['get']({'plain':!![]});var _0x54e7d6=[{'name':_0xeabc('0x62'),'value':_0xeabc('0x2c')},{'name':_0xeabc('0x58'),'value':_0xeabc('0x2d')}];var _0x4b7730=_['find'](_0x54e7d6,[_0xeabc('0x30'),_0x12fd48['type']])['name'];return db[_0xeabc('0x59')]['find']({'where':{'name':_0x4b7730,'userProfileId':_0x5702cb['userProfileId']},'raw':!![]})[_0xeabc('0x29')](function(_0x1c84b5){if(_0x1c84b5&&_0x1c84b5['autoAssociation']===0x0){return db['UserProfileResource'][_0xeabc('0x54')]({'name':_0x12fd48['name'],'resourceId':_0x12fd48['id'],'type':_0x1c84b5[_0xeabc('0x34')],'sectionId':_0x1c84b5['id']},{})[_0xeabc('0x29')](function(){return _0x24d0e5;});}else{return _0x24d0e5;}})['catch'](function(_0x5d6477){logger[_0xeabc('0x35')](_0xeabc('0x5c'),_0x5d6477);throw _0x5d6477;});}return _0x24d0e5;});}})[_0xeabc('0x29')](respondWithResult(_0x1750e9,0xc9))[_0xeabc('0x50')](handleError(_0x1750e9,null));};exports[_0xeabc('0x63')]=function(_0x511b33,_0x53f578){if(_0x511b33[_0xeabc('0x55')]['id']){delete _0x511b33['body']['id'];}return db[_0xeabc('0x4c')]['find']({'where':{'id':_0x511b33[_0xeabc('0x52')]['id']}})['then'](handleEntityNotFound(_0x53f578,null))[_0xeabc('0x29')](saveUpdates(_0x511b33['body'],null))[_0xeabc('0x29')](respondWithResult(_0x53f578,null))[_0xeabc('0x50')](handleError(_0x53f578,null));};exports[_0xeabc('0x2a')]=function(_0x36cc41,_0x5e121c){return db[_0xeabc('0x4c')]['find']({'where':{'id':_0x36cc41[_0xeabc('0x52')]['id']}})[_0xeabc('0x29')](handleEntityNotFound(_0x5e121c,null))[_0xeabc('0x29')](removeEntity(_0x5e121c,null))[_0xeabc('0x50')](handleError(_0x5e121c,null));};exports[_0xeabc('0x64')]=function(_0x5c1ab2,_0x239350,_0x329d8b){var _0x4b9614={'raw':![],'where':{}};var _0x2509a4={};var _0x5427c8={'count':0x0,'rows':[]};return db[_0xeabc('0x4c')][_0xeabc('0x65')]({'where':{'id':_0x5c1ab2[_0xeabc('0x52')]['id']}})[_0xeabc('0x29')](handleEntityNotFound(_0x239350,null))['then'](function(_0xb9b460){if(_0xb9b460){_0x2509a4[_0xeabc('0x3e')]=_[_0xeabc('0x3d')](db[_0xeabc('0x66')]['rawAttributes']);_0x2509a4['query']=_[_0xeabc('0x3d')](_0x5c1ab2['query']);_0x2509a4['filters']=_[_0xeabc('0x53')](_0x2509a4[_0xeabc('0x3e')],_0x2509a4[_0xeabc('0x3c')]);_0x4b9614['attributes']=_[_0xeabc('0x53')](_0x2509a4[_0xeabc('0x3e')],qs['fields'](_0x5c1ab2[_0xeabc('0x3c')][_0xeabc('0x40')]));_0x4b9614[_0xeabc('0x3f')]=_0x4b9614[_0xeabc('0x3f')][_0xeabc('0x41')]?_0x4b9614['attributes']:_0x2509a4[_0xeabc('0x3e')];if(!_0x5c1ab2['query']['hasOwnProperty']('nolimit')){_0x4b9614[_0xeabc('0x23')]=qs[_0xeabc('0x23')](_0x5c1ab2[_0xeabc('0x3c')][_0xeabc('0x23')]);_0x4b9614[_0xeabc('0x21')]=qs['offset'](_0x5c1ab2[_0xeabc('0x3c')]['offset']);}_0x4b9614[_0xeabc('0x43')]=qs[_0xeabc('0x44')](_0x5c1ab2['query'][_0xeabc('0x44')]);_0x4b9614['where']=qs['filters'](_[_0xeabc('0x46')](_0x5c1ab2[_0xeabc('0x3c')],_0x2509a4[_0xeabc('0x47')]));_0x4b9614[_0xeabc('0x45')][_0xeabc('0x67')]=_0xb9b460['id'];if(_0x5c1ab2['query'][_0xeabc('0x4a')]){_0x4b9614[_0xeabc('0x45')]=_[_0xeabc('0x48')](_0x4b9614[_0xeabc('0x45')],{'$or':_[_0xeabc('0x2f')](_0x4b9614[_0xeabc('0x3f')],function(_0x2d05b4){var _0x419fc6={};_0x419fc6[_0x2d05b4]={'$like':'%'+_0x5c1ab2[_0xeabc('0x3c')][_0xeabc('0x4a')]+'%'};return _0x419fc6;})});}_0x4b9614=_['merge']({},_0x4b9614,_0x5c1ab2[_0xeabc('0x4b')]);return db[_0xeabc('0x66')][_0xeabc('0x24')]({'where':_0x4b9614['where']})['then'](function(_0x1506bd){_0x5427c8[_0xeabc('0x24')]=_0x1506bd;if(_0x5c1ab2[_0xeabc('0x3c')][_0xeabc('0x4d')]){_0x4b9614[_0xeabc('0x4e')]=[{'all':!![]}];}return db['CmHopper'][_0xeabc('0x4f')](_0x4b9614);})['then'](function(_0x5f39ef){_0x5427c8[_0xeabc('0x68')]=_0x5f39ef;return _0x5427c8;});}})[_0xeabc('0x29')](respondWithFilteredResult(_0x239350,_0x4b9614))['catch'](handleError(_0x239350,null));};exports[_0xeabc('0x69')]=function(_0x45c9c7,_0x49a70a,_0x5963f7){var _0xfaef39={'raw':!![],'where':{}};var _0xb04677={};var _0x135a79={'count':0x0,'rows':[]};return db[_0xeabc('0x4c')][_0xeabc('0x65')]({'where':{'id':_0x45c9c7[_0xeabc('0x52')]['id']}})[_0xeabc('0x29')](handleEntityNotFound(_0x49a70a,null))['then'](function(_0xb54c35){if(_0xb54c35){_0xb04677['model']=_[_0xeabc('0x3d')](db[_0xeabc('0x6a')][_0xeabc('0x39')]);_0xb04677[_0xeabc('0x3c')]=_[_0xeabc('0x3d')](_0x45c9c7[_0xeabc('0x3c')]);_0xb04677[_0xeabc('0x47')]=_[_0xeabc('0x53')](_0xb04677[_0xeabc('0x3e')],_0xb04677[_0xeabc('0x3c')]);_0xfaef39[_0xeabc('0x3f')]=_['intersection'](_0xb04677[_0xeabc('0x3e')],qs[_0xeabc('0x40')](_0x45c9c7[_0xeabc('0x3c')][_0xeabc('0x40')]));_0xfaef39['attributes']=_0xfaef39[_0xeabc('0x3f')][_0xeabc('0x41')]?_0xfaef39['attributes']:_0xb04677[_0xeabc('0x3e')];if(!_0x45c9c7[_0xeabc('0x3c')]['hasOwnProperty']('nolimit')){_0xfaef39['limit']=qs['limit'](_0x45c9c7[_0xeabc('0x3c')][_0xeabc('0x23')]);_0xfaef39[_0xeabc('0x21')]=qs[_0xeabc('0x21')](_0x45c9c7[_0xeabc('0x3c')][_0xeabc('0x21')]);}_0xfaef39[_0xeabc('0x43')]=qs[_0xeabc('0x44')](_0x45c9c7[_0xeabc('0x3c')][_0xeabc('0x44')]);_0xfaef39['where']=qs[_0xeabc('0x47')](_[_0xeabc('0x46')](_0x45c9c7['query'],_0xb04677[_0xeabc('0x47')]));_0xfaef39[_0xeabc('0x45')][_0xeabc('0x67')]=_0xb54c35['id'];if(_0x45c9c7['query'][_0xeabc('0x4a')]){_0xfaef39['where']=_[_0xeabc('0x48')](_0xfaef39[_0xeabc('0x45')],{'$or':_[_0xeabc('0x2f')](_0xfaef39[_0xeabc('0x3f')],function(_0x1c52f7){var _0x5e7e00={};_0x5e7e00[_0x1c52f7]={'$like':'%'+_0x45c9c7['query']['filter']+'%'};return _0x5e7e00;})});}_0xfaef39=_['merge']({},_0xfaef39,_0x45c9c7[_0xeabc('0x4b')]);return db[_0xeabc('0x6a')][_0xeabc('0x24')]({'where':_0xfaef39['where']})[_0xeabc('0x29')](function(_0x19536d){_0x135a79[_0xeabc('0x24')]=_0x19536d;if(_0x45c9c7[_0xeabc('0x3c')][_0xeabc('0x4d')]){_0xfaef39[_0xeabc('0x4e')]=[{'all':!![]}];}return db[_0xeabc('0x6a')][_0xeabc('0x4f')](_0xfaef39);})[_0xeabc('0x29')](function(_0x391e67){_0x135a79[_0xeabc('0x68')]=_0x391e67;return _0x135a79;});}})[_0xeabc('0x29')](respondWithFilteredResult(_0x49a70a,_0xfaef39))['catch'](handleError(_0x49a70a,null));};exports['getHopperFinals']=function(_0x3286a2,_0x50a5d5,_0x20c4d7){var _0x18ee16={'raw':!![],'where':{}};var _0x102591={};var _0x56f622={'count':0x0,'rows':[]};return db[_0xeabc('0x4c')][_0xeabc('0x65')]({'where':{'id':_0x3286a2[_0xeabc('0x52')]['id']}})['then'](handleEntityNotFound(_0x50a5d5,null))['then'](function(_0x3557f2){if(_0x3557f2){_0x102591[_0xeabc('0x3e')]=_[_0xeabc('0x3d')](db[_0xeabc('0x6b')][_0xeabc('0x39')]);_0x102591[_0xeabc('0x3c')]=_['keys'](_0x3286a2['query']);_0x102591[_0xeabc('0x47')]=_[_0xeabc('0x53')](_0x102591[_0xeabc('0x3e')],_0x102591[_0xeabc('0x3c')]);_0x18ee16['attributes']=_['intersection'](_0x102591['model'],qs[_0xeabc('0x40')](_0x3286a2['query'][_0xeabc('0x40')]));_0x18ee16['attributes']=_0x18ee16[_0xeabc('0x3f')]['length']?_0x18ee16[_0xeabc('0x3f')]:_0x102591[_0xeabc('0x3e')];if(!_0x3286a2[_0xeabc('0x3c')][_0xeabc('0x42')](_0xeabc('0x6c'))){_0x18ee16['limit']=qs[_0xeabc('0x23')](_0x3286a2[_0xeabc('0x3c')][_0xeabc('0x23')]);_0x18ee16['offset']=qs[_0xeabc('0x21')](_0x3286a2[_0xeabc('0x3c')][_0xeabc('0x21')]);}_0x18ee16[_0xeabc('0x43')]=qs[_0xeabc('0x44')](_0x3286a2['query'][_0xeabc('0x44')]);_0x18ee16[_0xeabc('0x45')]=qs['filters'](_[_0xeabc('0x46')](_0x3286a2[_0xeabc('0x3c')],_0x102591['filters']));_0x18ee16[_0xeabc('0x45')][_0xeabc('0x67')]=_0x3557f2['id'];if(_0x3286a2[_0xeabc('0x3c')][_0xeabc('0x4a')]){_0x18ee16[_0xeabc('0x45')]=_[_0xeabc('0x48')](_0x18ee16[_0xeabc('0x45')],{'$or':_[_0xeabc('0x2f')](_0x18ee16[_0xeabc('0x3f')],function(_0x11a185){var _0x223cd6={};_0x223cd6[_0x11a185]={'$like':'%'+_0x3286a2[_0xeabc('0x3c')][_0xeabc('0x4a')]+'%'};return _0x223cd6;})});}_0x18ee16=_['merge']({},_0x18ee16,_0x3286a2['options']);return db[_0xeabc('0x6b')][_0xeabc('0x24')]({'where':_0x18ee16[_0xeabc('0x45')]})[_0xeabc('0x29')](function(_0x5805c9){_0x56f622[_0xeabc('0x24')]=_0x5805c9;if(_0x3286a2['query']['includeAll']){_0x18ee16['include']=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x18ee16);})['then'](function(_0x72dd0e){_0x56f622[_0xeabc('0x68')]=_0x72dd0e;return _0x56f622;});}})[_0xeabc('0x29')](respondWithFilteredResult(_0x50a5d5,_0x18ee16))[_0xeabc('0x50')](handleError(_0x50a5d5,null));};exports[_0xeabc('0x6d')]=function(_0xe27492,_0x152d99,_0x3eaedf){var _0x44dc85={'raw':!![],'where':{}};var _0x550273={};var _0x3b1f77={'count':0x0,'rows':[]};return db[_0xeabc('0x4c')][_0xeabc('0x65')]({'where':{'id':_0xe27492[_0xeabc('0x52')]['id']}})[_0xeabc('0x29')](handleEntityNotFound(_0x152d99,null))[_0xeabc('0x29')](function(_0x2a29d7){if(_0x2a29d7){_0x550273['model']=_[_0xeabc('0x3d')](db['CmHopperBlack'][_0xeabc('0x39')]);_0x550273[_0xeabc('0x3c')]=_['keys'](_0xe27492[_0xeabc('0x3c')]);_0x550273['filters']=_[_0xeabc('0x53')](_0x550273[_0xeabc('0x3e')],_0x550273[_0xeabc('0x3c')]);_0x44dc85[_0xeabc('0x3f')]=_[_0xeabc('0x53')](_0x550273[_0xeabc('0x3e')],qs[_0xeabc('0x40')](_0xe27492[_0xeabc('0x3c')][_0xeabc('0x40')]));_0x44dc85['attributes']=_0x44dc85['attributes'][_0xeabc('0x41')]?_0x44dc85[_0xeabc('0x3f')]:_0x550273['model'];if(!_0xe27492[_0xeabc('0x3c')]['hasOwnProperty'](_0xeabc('0x6c'))){_0x44dc85[_0xeabc('0x23')]=qs[_0xeabc('0x23')](_0xe27492[_0xeabc('0x3c')][_0xeabc('0x23')]);_0x44dc85[_0xeabc('0x21')]=qs['offset'](_0xe27492[_0xeabc('0x3c')]['offset']);}_0x44dc85[_0xeabc('0x43')]=qs[_0xeabc('0x44')](_0xe27492[_0xeabc('0x3c')][_0xeabc('0x44')]);_0x44dc85['where']=qs[_0xeabc('0x47')](_[_0xeabc('0x46')](_0xe27492[_0xeabc('0x3c')],_0x550273['filters']));_0x44dc85[_0xeabc('0x45')][_0xeabc('0x67')]=_0x2a29d7['id'];if(_0xe27492[_0xeabc('0x3c')]['filter']){_0x44dc85['where']=_['merge'](_0x44dc85['where'],{'$or':_[_0xeabc('0x2f')](_0x44dc85[_0xeabc('0x3f')],function(_0x52e84f){var _0x12f024={};_0x12f024[_0x52e84f]={'$like':'%'+_0xe27492[_0xeabc('0x3c')][_0xeabc('0x4a')]+'%'};return _0x12f024;})});}_0x44dc85=_[_0xeabc('0x48')]({},_0x44dc85,_0xe27492[_0xeabc('0x4b')]);return db[_0xeabc('0x6e')][_0xeabc('0x24')]({'where':_0x44dc85[_0xeabc('0x45')]})[_0xeabc('0x29')](function(_0x4df674){_0x3b1f77[_0xeabc('0x24')]=_0x4df674;if(_0xe27492['query'][_0xeabc('0x4d')]){_0x44dc85[_0xeabc('0x4e')]=[{'all':!![]}];}return db[_0xeabc('0x6e')][_0xeabc('0x4f')](_0x44dc85);})[_0xeabc('0x29')](function(_0x3a43ad){_0x3b1f77[_0xeabc('0x68')]=_0x3a43ad;return _0x3b1f77;});}})['then'](respondWithFilteredResult(_0x152d99,_0x44dc85))[_0xeabc('0x50')](handleError(_0x152d99,null));};exports['getTeams']=function(_0x475160,_0x4d8953,_0x10d66b){var _0x12a042={};var _0x266b53={};var _0x1aee85;var _0x507037;return db['VoiceQueue'][_0xeabc('0x65')]({'where':{'id':_0x475160[_0xeabc('0x52')]['id']}})[_0xeabc('0x29')](handleEntityNotFound(_0x4d8953,null))[_0xeabc('0x29')](function(_0x3339ce){if(_0x3339ce){_0x1aee85=_0x3339ce;_0x266b53['model']=_[_0xeabc('0x3d')](db[_0xeabc('0x6f')][_0xeabc('0x39')]);_0x266b53[_0xeabc('0x3c')]=_[_0xeabc('0x3d')](_0x475160['query']);_0x266b53[_0xeabc('0x47')]=_['intersection'](_0x266b53[_0xeabc('0x3e')],_0x266b53[_0xeabc('0x3c')]);_0x12a042[_0xeabc('0x3f')]=_[_0xeabc('0x53')](_0x266b53[_0xeabc('0x3e')],qs[_0xeabc('0x40')](_0x475160[_0xeabc('0x3c')][_0xeabc('0x40')]));_0x12a042[_0xeabc('0x3f')]=_0x12a042[_0xeabc('0x3f')]['length']?_0x12a042[_0xeabc('0x3f')]:_0x266b53[_0xeabc('0x3e')];_0x12a042[_0xeabc('0x43')]=qs[_0xeabc('0x44')](_0x475160['query'][_0xeabc('0x44')]);_0x12a042['where']=qs['filters'](_[_0xeabc('0x46')](_0x475160[_0xeabc('0x3c')],_0x266b53[_0xeabc('0x47')]));if(_0x475160['query'][_0xeabc('0x4a')]){_0x12a042[_0xeabc('0x45')]=_[_0xeabc('0x48')](_0x12a042[_0xeabc('0x45')],{'$or':_[_0xeabc('0x2f')](_0x12a042['attributes'],function(_0x1dc0fc){var _0x316e15={};_0x316e15[_0x1dc0fc]={'$like':'%'+_0x475160['query']['filter']+'%'};return _0x316e15;})});}_0x12a042=_[_0xeabc('0x48')]({},_0x12a042,_0x475160[_0xeabc('0x4b')]);return _0x1aee85[_0xeabc('0x70')](_0x12a042);}})[_0xeabc('0x29')](function(_0x2a0075){if(_0x2a0075){_0x507037=_0x2a0075[_0xeabc('0x41')];if(!_0x475160[_0xeabc('0x3c')][_0xeabc('0x42')](_0xeabc('0x6c'))){_0x12a042['limit']=qs[_0xeabc('0x23')](_0x475160['query'][_0xeabc('0x23')]);_0x12a042['offset']=qs[_0xeabc('0x21')](_0x475160[_0xeabc('0x3c')][_0xeabc('0x21')]);}return _0x1aee85[_0xeabc('0x70')](_0x12a042);}})[_0xeabc('0x29')](function(_0x227f00){if(_0x227f00){return _0x227f00?{'count':_0x507037,'rows':_0x227f00}:null;}})[_0xeabc('0x29')](respondWithResult(_0x4d8953,null))[_0xeabc('0x50')](handleError(_0x4d8953,null));};exports[_0xeabc('0x71')]=function(_0x31f1bf,_0x5c83e5,_0x5629db){var _0x1ad48f=_0x31f1bf['body'][_0xeabc('0x72')];var _0x283d40=_['map'](_0x1ad48f,'id');return db['Team'][_0xeabc('0x4f')]({'where':{'id':_0x283d40},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xeabc('0x34'),'online','voicePause',_0xeabc('0x73')],'raw':!![]}]})[_0xeabc('0x29')](function(_0x4a2b27){if(_0x4a2b27){var _0x480bbd=_[_0xeabc('0x74')](_0x4a2b27,function(_0x2465f9){var _0x4b6717=_0x2465f9[_0xeabc('0x2b')]({'plain':!![]});_0x4b6717[_0xeabc('0x75')]['forEach'](function(_0x578fdc){_0x578fdc[_0xeabc('0x76')]=_[_0xeabc('0x33')](_0x1ad48f,{'id':_0x4b6717['id']})[_0xeabc('0x76')];});return _0x4b6717['Agents'];});return db[_0xeabc('0x4c')]['find']({'where':{'id':_0x31f1bf[_0xeabc('0x52')]['id']}})[_0xeabc('0x29')](function(_0x2055d8){return db['sequelize']['transaction'](function(_0x6dff2a){return _0x2055d8[_0xeabc('0x71')](_0x283d40,{'transaction':_0x6dff2a})[_0xeabc('0x29')](function(){return BPromise[_0xeabc('0x77')](_0x1ad48f,function(_0x40658b){return db[_0xeabc('0x78')][_0xeabc('0x79')]({'TeamId':_0x40658b['id'],'VoiceQueueId':_0x31f1bf[_0xeabc('0x52')]['id'],'penalty':_0x40658b['penalty']},{'transaction':_0x6dff2a});});})['then'](function(){return BPromise[_0xeabc('0x77')](_0x480bbd,function(_0x55e41e){return db[_0xeabc('0x7a')]['findOrCreate']({'where':{'UserId':_0x55e41e['id'],'VoiceQueueId':_0x31f1bf[_0xeabc('0x52')]['id']},'defaults':{'penalty':_0x55e41e[_0xeabc('0x76')]},'transaction':_0x6dff2a});});})[_0xeabc('0x29')](function(){return BPromise[_0xeabc('0x77')](_[_0xeabc('0x4a')](_0x480bbd,{'online':!![]}),function(_0x75f13b){return db[_0xeabc('0x7b')][_0xeabc('0x79')]({'membername':_0x75f13b['name'],'UserId':_0x75f13b['id'],'queue_name':_0x2055d8[_0xeabc('0x34')],'VoiceQueueId':_0x2055d8['id'],'interface':_[_0xeabc('0x7c')](_0x75f13b[_0xeabc('0x73')])?util[_0xeabc('0x7d')](_0xeabc('0x7e'),_0x75f13b[_0xeabc('0x34')]):_0x75f13b[_0xeabc('0x73')],'paused':_0x75f13b[_0xeabc('0x7f')]||![],'penalty':_0x75f13b[_0xeabc('0x76')]},{'transaction':_0x6dff2a});});})[_0xeabc('0x29')](function(){_0x480bbd[_0xeabc('0x80')](function(_0x1ba153){socket[_0xeabc('0x81')]('userVoiceQueue:save',{'UserId':_0x1ba153['id'],'VoiceQueueId':_0x2055d8['id']});});});});});}})[_0xeabc('0x29')](respondWithStatusCode(_0x5c83e5,null))[_0xeabc('0x50')](handleError(_0x5c83e5,null));};exports[_0xeabc('0x82')]=function(_0x2a0793,_0x198641,_0x34738e){return db[_0xeabc('0x6f')][_0xeabc('0x4f')]({'where':{'id':_0x2a0793[_0xeabc('0x3c')][_0xeabc('0x83')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xeabc('0x75'),'attributes':['id'],'raw':!![]}]})[_0xeabc('0x29')](handleEntityNotFound(_0x198641,null))['then'](function(_0x598105){var _0x5fc21a=_[_0xeabc('0x2f')](_0x598105,'id');var _0x201539=[];var _0x597bd0=[];var _0xba66a2=squel[_0xeabc('0x84')]();_0xba66a2[_0xeabc('0x85')]('tq.TeamId')[_0xeabc('0x86')](_0xeabc('0x87'),'tq')[_0xeabc('0x88')]('user_has_teams','ut',_0xeabc('0x89'))[_0xeabc('0x45')]('VoiceQueueId\x20=\x20?',_0x2a0793[_0xeabc('0x52')]['id']);for(var _0x50371d=0x0;_0x50371d<_0x598105[_0xeabc('0x41')];_0x50371d+=0x1){let _0x39916c=_0x598105[_0x50371d];for(var _0x5cc6d0=0x0;_0x5cc6d0<_0x39916c['Agents']['length'];_0x5cc6d0+=0x1){let _0x122f23=_0x39916c[_0xeabc('0x75')][_0x5cc6d0];var _0x3571c6=_0xba66a2['clone']();_0x3571c6['where']('ut.UserId\x20=\x20?',_0x122f23['id']);_0x597bd0[_0xeabc('0x8a')](db[_0xeabc('0x8b')]['query'](_0x3571c6[_0xeabc('0x8c')](),{'type':db[_0xeabc('0x8b')][_0xeabc('0x8d')][_0xeabc('0x8e')]})[_0xeabc('0x29')](function(_0x1ca3da){if(_0x1ca3da[_0xeabc('0x41')]===0x1){return _0x122f23['id'];}else{var _0x4a5555=_['every'](_['map'](_0x1ca3da,_0xeabc('0x8f')),function(_0x24cf0a){return _[_0xeabc('0x31')](_0x5fc21a,_0x24cf0a);});if(_0x4a5555){return _0x122f23['id'];}}}));}}return BPromise[_0xeabc('0x90')](_0x597bd0)[_0xeabc('0x29')](function(_0x564ebd){_0x201539=_(_0x201539)[_0xeabc('0x91')](_0x564ebd)['compact']()[_0xeabc('0x30')]();return db[_0xeabc('0x4c')][_0xeabc('0x33')]({'where':{'id':_0x2a0793[_0xeabc('0x52')]['id']}})[_0xeabc('0x29')](function(_0x94fb8e){return db[_0xeabc('0x8b')][_0xeabc('0x92')](function(_0x4287e3){return _0x94fb8e[_0xeabc('0x82')](_0x2a0793['query'][_0xeabc('0x83')],{'transaction':_0x4287e3})[_0xeabc('0x29')](function(){if(!_['isEmpty'](_0x201539)){return _0x94fb8e[_0xeabc('0x93')](_0x201539,{'transaction':_0x4287e3})['then'](function(){return db[_0xeabc('0x7b')][_0xeabc('0x2a')]({'where':{'VoiceQueueId':_0x2a0793[_0xeabc('0x52')]['id'],'UserId':_0x201539},'transaction':_0x4287e3});});}})[_0xeabc('0x29')](function(){_0x201539['forEach'](function(_0x40156a){socket[_0xeabc('0x81')](_0xeabc('0x94'),{'UserId':_0x40156a,'VoiceQueueId':_0x94fb8e['id']});});});});});});})[_0xeabc('0x29')](respondWithStatusCode(_0x198641,null))[_0xeabc('0x50')](handleError(_0x198641,null));};exports['addAgents']=function(_0x34fc2b,_0x43fa37,_0x4913cf){var _0x584b2b,_0xb28be5;return db[_0xeabc('0x4c')]['find']({'where':{'id':_0x34fc2b[_0xeabc('0x52')]['id']}})[_0xeabc('0x29')](handleEntityNotFound(_0x43fa37,null))['then'](function(_0x4d9ebd){if(_0x4d9ebd){_0xb28be5=_0x4d9ebd;return _0x4d9ebd[_0xeabc('0x95')](_0x34fc2b['body'][_0xeabc('0x83')],_[_0xeabc('0x5e')](_0x34fc2b[_0xeabc('0x55')],['ids','id'])||{})['spread'](function(_0x245991){for(var _0x3abe64=0x0;_0x3abe64<_0x34fc2b[_0xeabc('0x55')][_0xeabc('0x83')][_0xeabc('0x41')];_0x3abe64+=0x1){socket[_0xeabc('0x81')](_0xeabc('0x96'),{'UserId':Number(_0x34fc2b[_0xeabc('0x55')][_0xeabc('0x83')][_0x3abe64]),'VoiceQueueId':Number(_0x34fc2b['params']['id'])});}return _0x245991;});}})['then'](function(_0x1f0a8e){_0x584b2b=_0x1f0a8e||[];if(_0xb28be5){return db[_0xeabc('0x97')][_0xeabc('0x4f')]({'where':{'id':_0x34fc2b['body'][_0xeabc('0x83')]},'attributes':['id',_0xeabc('0x34'),_0xeabc('0x98'),_0xeabc('0x7f'),_0xeabc('0x73')],'raw':!![]});}})[_0xeabc('0x29')](function(_0x2f5ab8){if(!_[_0xeabc('0x99')](_0x2f5ab8)){var _0x1c77a0=[];for(var _0x10f354=0x0;_0x10f354<_0x2f5ab8[_0xeabc('0x41')];_0x10f354++){if(_0x2f5ab8[_0x10f354][_0xeabc('0x98')]){_0x1c77a0['push'](db[_0xeabc('0x7b')][_0xeabc('0x79')]({'membername':_0x2f5ab8[_0x10f354][_0xeabc('0x34')],'UserId':_0x2f5ab8[_0x10f354]['id'],'queue_name':_0xb28be5['name'],'VoiceQueueId':_0xb28be5['id'],'interface':_[_0xeabc('0x7c')](_0x2f5ab8[_0x10f354][_0xeabc('0x73')])?util['format'](_0xeabc('0x7e'),_0x2f5ab8[_0x10f354]['name']):_0x2f5ab8[_0x10f354][_0xeabc('0x73')],'paused':_0x2f5ab8[_0x10f354][_0xeabc('0x7f')]||![],'penalty':_0x34fc2b[_0xeabc('0x55')][_0xeabc('0x76')]||0x0}));}}return BPromise[_0xeabc('0x90')](_0x1c77a0);}})[_0xeabc('0x29')](function(){return _0x584b2b;})[_0xeabc('0x29')](respondWithResult(_0x43fa37,null))[_0xeabc('0x50')](handleError(_0x43fa37,null));};exports[_0xeabc('0x93')]=function(_0x4946af,_0x17a858,_0x4d3ead){return db['VoiceQueue'][_0xeabc('0x33')]({'where':{'id':_0x4946af[_0xeabc('0x52')]['id']}})[_0xeabc('0x29')](handleEntityNotFound(_0x17a858,null))[_0xeabc('0x29')](function(_0x224a0e){if(_0x224a0e){return _0x224a0e[_0xeabc('0x93')](_0x4946af[_0xeabc('0x3c')][_0xeabc('0x83')])[_0xeabc('0x29')](function(){if(_[_0xeabc('0x9a')](_0x4946af[_0xeabc('0x3c')]['ids'])){for(var _0x57cf40=0x0;_0x57cf40<_0x4946af[_0xeabc('0x3c')][_0xeabc('0x83')]['length'];_0x57cf40+=0x1){socket[_0xeabc('0x81')](_0xeabc('0x94'),{'UserId':Number(_0x4946af['query']['ids'][_0x57cf40]),'VoiceQueueId':Number(_0x4946af[_0xeabc('0x52')]['id'])});}}else{socket['emit']('userVoiceQueue:remove',{'UserId':Number(_0x4946af['query'][_0xeabc('0x83')]),'VoiceQueueId':Number(_0x4946af[_0xeabc('0x52')]['id'])});}});}})['then'](function(_0x58982a){return db[_0xeabc('0x7b')]['destroy']({'where':{'VoiceQueueId':_0x4946af[_0xeabc('0x52')]['id'],'UserId':_0x4946af['query']['ids']}})[_0xeabc('0x29')](function(){return _0x58982a;});})[_0xeabc('0x29')](respondWithStatusCode(_0x17a858,null))[_0xeabc('0x50')](handleError(_0x17a858,null));};exports[_0xeabc('0x9b')]=function(_0x2e23da,_0x1bf9a2,_0x29153b){var _0x114ffc={};var _0x235270={};var _0x23fab7;var _0x29b175;return db[_0xeabc('0x4c')][_0xeabc('0x65')]({'where':{'id':_0x2e23da['params']['id']}})[_0xeabc('0x29')](handleEntityNotFound(_0x1bf9a2,null))['then'](function(_0x42ceb1){if(_0x42ceb1){_0x23fab7=_0x42ceb1;_0x235270['model']=_[_0xeabc('0x3d')](db[_0xeabc('0x97')][_0xeabc('0x39')]);_0x235270['query']=_[_0xeabc('0x3d')](_0x2e23da['query']);_0x235270[_0xeabc('0x47')]=_[_0xeabc('0x53')](_0x235270[_0xeabc('0x3e')],_0x235270[_0xeabc('0x3c')]);_0x114ffc[_0xeabc('0x3f')]=_['intersection'](_0x235270[_0xeabc('0x3e')],qs[_0xeabc('0x40')](_0x2e23da[_0xeabc('0x3c')][_0xeabc('0x40')]));_0x114ffc[_0xeabc('0x3f')]=_0x114ffc[_0xeabc('0x3f')][_0xeabc('0x41')]?_0x114ffc[_0xeabc('0x3f')]:_0x235270[_0xeabc('0x3e')];_0x114ffc['order']=qs['sort'](_0x2e23da[_0xeabc('0x3c')][_0xeabc('0x44')]);_0x114ffc[_0xeabc('0x45')]=qs[_0xeabc('0x47')](_['pick'](_0x2e23da[_0xeabc('0x3c')],_0x235270[_0xeabc('0x47')]));if(_0x2e23da[_0xeabc('0x3c')][_0xeabc('0x4a')]){_0x114ffc['where']=_[_0xeabc('0x48')](_0x114ffc[_0xeabc('0x45')],{'$or':_[_0xeabc('0x2f')](_0x114ffc['attributes'],function(_0x497ee4){var _0x43e541={};_0x43e541[_0x497ee4]={'$like':'%'+_0x2e23da[_0xeabc('0x3c')][_0xeabc('0x4a')]+'%'};return _0x43e541;})});}_0x114ffc=_[_0xeabc('0x48')]({},_0x114ffc,_0x2e23da[_0xeabc('0x4b')]);return _0x23fab7[_0xeabc('0x9b')](_0x114ffc);}})[_0xeabc('0x29')](function(_0x4124c6){if(_0x4124c6){_0x29b175=_0x4124c6['length'];if(!_0x2e23da['query'][_0xeabc('0x42')](_0xeabc('0x6c'))){_0x114ffc[_0xeabc('0x23')]=qs['limit'](_0x2e23da[_0xeabc('0x3c')][_0xeabc('0x23')]);_0x114ffc[_0xeabc('0x21')]=qs[_0xeabc('0x21')](_0x2e23da[_0xeabc('0x3c')]['offset']);}return _0x23fab7[_0xeabc('0x9b')](_0x114ffc);}})[_0xeabc('0x29')](function(_0x207932){if(_0x207932){return _0x207932?{'count':_0x29b175,'rows':_0x207932}:null;}})[_0xeabc('0x29')](respondWithResult(_0x1bf9a2,null))[_0xeabc('0x50')](handleError(_0x1bf9a2,null));};exports[_0xeabc('0x9c')]=function(_0x35ed8a,_0x977d14,_0x141dbb){var _0x318be6={};var _0xf97e59={};var _0x1293ab;var _0x55c261;return db[_0xeabc('0x4c')][_0xeabc('0x65')]({'where':{'id':_0x35ed8a[_0xeabc('0x52')]['id']}})['then'](handleEntityNotFound(_0x977d14,null))[_0xeabc('0x29')](function(_0x26e38b){if(_0x26e38b){_0x1293ab=_0x26e38b;_0xf97e59['model']=_[_0xeabc('0x3d')](db[_0xeabc('0x7b')]['rawAttributes']);_0xf97e59['query']=_[_0xeabc('0x3d')](_0x35ed8a[_0xeabc('0x3c')]);_0xf97e59[_0xeabc('0x47')]=_[_0xeabc('0x53')](_0xf97e59[_0xeabc('0x3e')],_0xf97e59[_0xeabc('0x3c')]);_0x318be6[_0xeabc('0x3f')]=_[_0xeabc('0x53')](_0xf97e59['model'],qs['fields'](_0x35ed8a[_0xeabc('0x3c')][_0xeabc('0x40')]));_0x318be6[_0xeabc('0x3f')]=_0x318be6[_0xeabc('0x3f')]['length']?_0x318be6['attributes']:_0xf97e59[_0xeabc('0x3e')];_0x318be6[_0xeabc('0x43')]=qs[_0xeabc('0x44')](_0x35ed8a[_0xeabc('0x3c')][_0xeabc('0x44')]);_0x318be6[_0xeabc('0x45')]=qs[_0xeabc('0x47')](_['pick'](_0x35ed8a[_0xeabc('0x3c')],_0xf97e59[_0xeabc('0x47')]));if(_0x35ed8a[_0xeabc('0x3c')][_0xeabc('0x4a')]){_0x318be6['where']=_['merge'](_0x318be6[_0xeabc('0x45')],{'$or':_[_0xeabc('0x2f')](_0x318be6[_0xeabc('0x3f')],function(_0xb9df16){var _0x432709={};_0x432709[_0xb9df16]={'$like':'%'+_0x35ed8a[_0xeabc('0x3c')][_0xeabc('0x4a')]+'%'};return _0x432709;})});}_0x318be6=_[_0xeabc('0x48')]({},_0x318be6,_0x35ed8a[_0xeabc('0x4b')]);return _0x1293ab[_0xeabc('0x9c')](_0x318be6);}})[_0xeabc('0x29')](function(_0x2a3a5c){if(_0x2a3a5c){_0x55c261=_0x2a3a5c[_0xeabc('0x41')];if(!_0x35ed8a[_0xeabc('0x3c')][_0xeabc('0x42')](_0xeabc('0x6c'))){_0x318be6[_0xeabc('0x23')]=qs['limit'](_0x35ed8a['query']['limit']);_0x318be6['offset']=qs['offset'](_0x35ed8a[_0xeabc('0x3c')][_0xeabc('0x21')]);}return _0x1293ab['getMembers'](_0x318be6);}})[_0xeabc('0x29')](function(_0xdfb37a){return _0xdfb37a?{'count':_0x55c261,'rows':_0xdfb37a}:null;})[_0xeabc('0x29')](respondWithResult(_0x977d14,null))[_0xeabc('0x50')](handleError(_0x977d14,null));};exports[_0xeabc('0x9d')]=function(_0x366034,_0x5d16cb,_0x52c973){var _0x1f90b6={};var _0x1c0703={};var _0x5ad17f;var _0x3f6255;return db['VoiceQueue'][_0xeabc('0x65')]({'where':{'id':_0x366034['params']['id']}})[_0xeabc('0x29')](handleEntityNotFound(_0x5d16cb,null))[_0xeabc('0x29')](function(_0x31df33){if(_0x31df33){_0x5ad17f=_0x31df33;_0x1c0703[_0xeabc('0x3e')]=_['keys'](db[_0xeabc('0x9e')][_0xeabc('0x39')]);_0x1c0703[_0xeabc('0x3c')]=_[_0xeabc('0x3d')](_0x366034[_0xeabc('0x3c')]);_0x1c0703[_0xeabc('0x47')]=_[_0xeabc('0x53')](_0x1c0703[_0xeabc('0x3e')],_0x1c0703['query']);_0x1f90b6[_0xeabc('0x3f')]=_['intersection'](_0x1c0703[_0xeabc('0x3e')],qs[_0xeabc('0x40')](_0x366034[_0xeabc('0x3c')]['fields']));_0x1f90b6[_0xeabc('0x3f')]=_0x1f90b6['attributes']['length']?_0x1f90b6[_0xeabc('0x3f')]:_0x1c0703['model'];_0x1f90b6[_0xeabc('0x43')]=qs[_0xeabc('0x44')](_0x366034[_0xeabc('0x3c')]['sort']);_0x1f90b6[_0xeabc('0x45')]=qs['filters'](_['pick'](_0x366034[_0xeabc('0x3c')],_0x1c0703[_0xeabc('0x47')]));if(_0x366034['query']['filter']){_0x1f90b6[_0xeabc('0x45')]=_[_0xeabc('0x48')](_0x1f90b6[_0xeabc('0x45')],{'$or':_[_0xeabc('0x2f')](_0x1f90b6[_0xeabc('0x3f')],function(_0x274693){var _0x73de81={};_0x73de81[_0x274693]={'$like':'%'+_0x366034['query'][_0xeabc('0x4a')]+'%'};return _0x73de81;})});}_0x1f90b6=_['merge']({},_0x1f90b6,_0x366034[_0xeabc('0x4b')]);return _0x5ad17f[_0xeabc('0x9d')](_0x1f90b6);}})[_0xeabc('0x29')](function(_0x197261){if(_0x197261){_0x3f6255=_0x197261['length'];if(!_0x366034['query'][_0xeabc('0x42')](_0xeabc('0x6c'))){_0x1f90b6[_0xeabc('0x23')]=qs[_0xeabc('0x23')](_0x366034[_0xeabc('0x3c')][_0xeabc('0x23')]);_0x1f90b6[_0xeabc('0x21')]=qs[_0xeabc('0x21')](_0x366034[_0xeabc('0x3c')]['offset']);}return _0x5ad17f[_0xeabc('0x9d')](_0x1f90b6);}})[_0xeabc('0x29')](function(_0x16d3c1){if(_0x16d3c1){return _0x16d3c1?{'count':_0x3f6255,'rows':_0x16d3c1}:null;}})['then'](respondWithResult(_0x5d16cb,null))[_0xeabc('0x50')](handleError(_0x5d16cb,null));};exports[_0xeabc('0x9f')]=function(_0x5cf0e6,_0x4f8763,_0x534147){var _0x1708ec=moment()[_0xeabc('0x7d')](_0xeabc('0xa0'));var _0x394082,_0xc1fb57;return db[_0xeabc('0x4c')][_0xeabc('0x33')]({'where':{'id':_0x5cf0e6['params']['id']}})[_0xeabc('0x29')](handleEntityNotFound(_0x4f8763,null))['then'](function(_0x3939a5){if(_0x3939a5){_0xc1fb57=_0x3939a5;return _0x3939a5[_0xeabc('0x9f')](_0x5cf0e6[_0xeabc('0x55')][_0xeabc('0x83')],_[_0xeabc('0x5e')](_0x5cf0e6['body'],[_0xeabc('0x83'),'id'])||{});}return null;})[_0xeabc('0xa1')](function(_0x5a92db){var _0xceed5f;_0x394082=_0x5a92db||[];var _0x44ac6f=[];if(_0x5a92db){for(var _0x3b807d=0x0;_0x3b807d<_0x5a92db[_0xeabc('0x41')];_0x3b807d+=0x1){var _0x11128b=_0x5a92db[_0x3b807d][_0xeabc('0x2b')]({'plain':!![]});_0xc1fb57[_0xeabc('0xa2')]=_0x5cf0e6[_0xeabc('0x55')]['dialCheckDuplicateType']?_0x5cf0e6[_0xeabc('0x55')][_0xeabc('0xa2')]:_0xc1fb57[_0xeabc('0xa2')];switch(_0xc1fb57['dialCheckDuplicateType']){case _0xeabc('0xa3'):_0xceed5f=squel[_0xeabc('0xa4')]()[_0xeabc('0xa5')]('cm_hopper')[_0xeabc('0xa6')](['phone',_0xeabc('0xa7'),_0xeabc('0xa8'),_0xeabc('0xa9'),_0xeabc('0x67'),'createdAt',_0xeabc('0x60')],squel[_0xeabc('0x84')]()['field'](_0xeabc('0xaa'),'phone')[_0xeabc('0x85')]('\x27'+_0x1708ec+'\x27',_0xeabc('0xa7'))[_0xeabc('0x85')]('id',_0xeabc('0xa8'))['field'](_0x11128b[_0xeabc('0xab')][_0xeabc('0x8c')](),_0xeabc('0xa9'))[_0xeabc('0x85')](_0x5cf0e6['params']['id']['toString'](),_0xeabc('0x67'))['field']('\x27'+_0x1708ec+'\x27','createdAt')['field']('\x27'+_0x1708ec+'\x27','updatedAt')[_0xeabc('0x86')](_0xeabc('0xac'))['where'](_0xeabc('0xad'))[_0xeabc('0x45')](_0xeabc('0xae'),_0x11128b[_0xeabc('0xab')][_0xeabc('0x8c')]())[_0xeabc('0x45')]('phone\x20IS\x20NOT\x20NULL')[_0xeabc('0x45')](_0xeabc('0xaf'),squel[_0xeabc('0x84')]()[_0xeabc('0x85')](_0xeabc('0xb0'))[_0xeabc('0x86')](_0xeabc('0xb1'))[_0xeabc('0x45')](_0xeabc('0xb2'),_0x5cf0e6[_0xeabc('0x52')]['id'][_0xeabc('0x8c')]()))[_0xeabc('0x45')]('phone\x20NOT\x20IN\x20(?)',squel[_0xeabc('0x84')]()[_0xeabc('0x85')](_0xeabc('0xb3'))[_0xeabc('0x86')]('cm_hopper')[_0xeabc('0x45')](_0xeabc('0xb2'),_0x5cf0e6['params']['id']['toString']())))[_0xeabc('0x8c')]();break;case _0xeabc('0xb4'):_0xceed5f=squel[_0xeabc('0xa4')]()[_0xeabc('0xa5')](_0xeabc('0xb5'))['fromQuery']([_0xeabc('0xaa'),_0xeabc('0xa7'),_0xeabc('0xa8'),_0xeabc('0xa9'),_0xeabc('0x67'),_0xeabc('0x5f'),'updatedAt'],squel[_0xeabc('0x84')]()[_0xeabc('0x85')](_0xeabc('0xaa'),_0xeabc('0xaa'))[_0xeabc('0x85')]('\x27'+_0x1708ec+'\x27',_0xeabc('0xa7'))['field']('id',_0xeabc('0xa8'))[_0xeabc('0x85')](_0x11128b[_0xeabc('0xab')][_0xeabc('0x8c')](),'ListId')[_0xeabc('0x85')](_0x5cf0e6[_0xeabc('0x52')]['id']['toString'](),_0xeabc('0x67'))[_0xeabc('0x85')]('\x27'+_0x1708ec+'\x27',_0xeabc('0x5f'))[_0xeabc('0x85')]('\x27'+_0x1708ec+'\x27',_0xeabc('0x60'))[_0xeabc('0x86')](_0xeabc('0xac'))[_0xeabc('0x45')](_0xeabc('0xad'))[_0xeabc('0x45')](_0xeabc('0xae'),_0x11128b[_0xeabc('0xab')][_0xeabc('0x8c')]())['where']('phone\x20IS\x20NOT\x20NULL')['where'](_0xeabc('0xaf'),squel[_0xeabc('0x84')]()['field'](_0xeabc('0xb3'))[_0xeabc('0x86')](_0xeabc('0xb5'))['where'](_0xeabc('0xb2'),_0x5cf0e6[_0xeabc('0x52')]['id'][_0xeabc('0x8c')]())))[_0xeabc('0x8c')]();break;default:_0xceed5f=squel[_0xeabc('0xa4')]()[_0xeabc('0xa5')](_0xeabc('0xb5'))[_0xeabc('0xa6')](['phone','scheduledAt','ContactId',_0xeabc('0xa9'),_0xeabc('0x67'),'createdAt','updatedAt'],squel[_0xeabc('0x84')]()[_0xeabc('0x85')](_0xeabc('0xaa'),_0xeabc('0xaa'))['field']('\x27'+_0x1708ec+'\x27',_0xeabc('0xa7'))[_0xeabc('0x85')]('id',_0xeabc('0xa8'))[_0xeabc('0x85')](_0x11128b[_0xeabc('0xab')][_0xeabc('0x8c')](),'ListId')[_0xeabc('0x85')](_0x5cf0e6[_0xeabc('0x52')]['id']['toString'](),'VoiceQueueId')[_0xeabc('0x85')]('\x27'+_0x1708ec+'\x27',_0xeabc('0x5f'))['field']('\x27'+_0x1708ec+'\x27',_0xeabc('0x60'))[_0xeabc('0x86')]('cm_contacts')[_0xeabc('0x45')]('deletedAt\x20IS\x20NULL')[_0xeabc('0x45')](_0xeabc('0xae'),_0x11128b[_0xeabc('0xab')]['toString']())[_0xeabc('0x45')](_0xeabc('0xb6')))['toString']();}_0x44ac6f[_0xeabc('0x8a')](db[_0xeabc('0x8b')][_0xeabc('0x3c')](_0xceed5f));}return BPromise[_0xeabc('0x90')](_0x44ac6f);}})['then'](function(){var _0x390d90=[];var _0x414fc3=squel[_0xeabc('0xa4')]()[_0xeabc('0xa5')](_0xeabc('0xb7'))[_0xeabc('0xa6')]([_0xeabc('0xb8'),_0xeabc('0xaa'),_0xeabc('0xb9'),'createdAt',_0xeabc('0x60')],squel[_0xeabc('0x84')]()[_0xeabc('0x85')](_0xeabc('0xba'))[_0xeabc('0x85')]('ci.item')[_0xeabc('0x85')]('ci.OrderBy')[_0xeabc('0x85')]('\x27'+_0x1708ec+'\x27',_0xeabc('0x5f'))[_0xeabc('0x85')]('\x27'+_0x1708ec+'\x27','updatedAt')['from'](_0xeabc('0xbb'),'ci')[_0xeabc('0x88')](_0xeabc('0xb5'),'h','h.ContactId=ci.CmContactId')[_0xeabc('0x45')](_0xeabc('0xbc'),_0x1708ec)[_0xeabc('0x45')]('ci.ItemClass=?',_0xeabc('0xbd')))['toString']();_0x390d90[_0xeabc('0x8a')](db['sequelize'][_0xeabc('0x3c')](_0x414fc3));return BPromise[_0xeabc('0x90')](_0x390d90);})[_0xeabc('0x29')](function(){return _0x394082;})[_0xeabc('0x29')](respondWithResult(_0x4f8763,null))[_0xeabc('0x50')](handleError(_0x4f8763,null));};exports[_0xeabc('0xbe')]=function(_0x1216cf,_0x198c42,_0x21a0df){return db[_0xeabc('0x4c')][_0xeabc('0x33')]({'where':{'id':_0x1216cf['params']['id']}})[_0xeabc('0x29')](handleEntityNotFound(_0x198c42,null))[_0xeabc('0x29')](function(_0x42c8c9){if(_0x42c8c9){return _0x42c8c9[_0xeabc('0xbe')](_0x1216cf[_0xeabc('0x3c')][_0xeabc('0x83')]);}})['then'](function(_0x67df66){if(_0x67df66){return db[_0xeabc('0x66')][_0xeabc('0x2a')]({'where':{'ListId':_0x1216cf[_0xeabc('0x3c')][_0xeabc('0x83')],'VoiceQueueId':_0x1216cf[_0xeabc('0x52')]['id']}})[_0xeabc('0x29')](function(){return _0x67df66;});}})[_0xeabc('0x29')](respondWithStatusCode(_0x198c42,null))[_0xeabc('0x50')](handleError(_0x198c42,null));};exports['getBlackLists']=function(_0xaf0794,_0x47da72,_0x30b6a2){var _0xcc42a7={};var _0x13be21={};var _0x28a4cb;var _0x5ee7bb;return db[_0xeabc('0x4c')][_0xeabc('0x65')]({'where':{'id':_0xaf0794['params']['id']}})[_0xeabc('0x29')](handleEntityNotFound(_0x47da72,null))['then'](function(_0x22c237){if(_0x22c237){_0x28a4cb=_0x22c237;_0x13be21[_0xeabc('0x3e')]=_['keys'](db[_0xeabc('0x9e')]['rawAttributes']);_0x13be21['query']=_['keys'](_0xaf0794[_0xeabc('0x3c')]);_0x13be21[_0xeabc('0x47')]=_[_0xeabc('0x53')](_0x13be21[_0xeabc('0x3e')],_0x13be21[_0xeabc('0x3c')]);_0xcc42a7[_0xeabc('0x3f')]=_[_0xeabc('0x53')](_0x13be21[_0xeabc('0x3e')],qs[_0xeabc('0x40')](_0xaf0794[_0xeabc('0x3c')]['fields']));_0xcc42a7[_0xeabc('0x3f')]=_0xcc42a7['attributes'][_0xeabc('0x41')]?_0xcc42a7[_0xeabc('0x3f')]:_0x13be21[_0xeabc('0x3e')];_0xcc42a7['order']=qs[_0xeabc('0x44')](_0xaf0794['query']['sort']);_0xcc42a7[_0xeabc('0x45')]=qs['filters'](_[_0xeabc('0x46')](_0xaf0794[_0xeabc('0x3c')],_0x13be21['filters']));if(_0xaf0794[_0xeabc('0x3c')]['filter']){_0xcc42a7[_0xeabc('0x45')]=_['merge'](_0xcc42a7[_0xeabc('0x45')],{'$or':_['map'](_0xcc42a7[_0xeabc('0x3f')],function(_0x559792){var _0xb959bf={};_0xb959bf[_0x559792]={'$like':'%'+_0xaf0794[_0xeabc('0x3c')][_0xeabc('0x4a')]+'%'};return _0xb959bf;})});}_0xcc42a7=_[_0xeabc('0x48')]({},_0xcc42a7,_0xaf0794['options']);return _0x28a4cb['getBlackLists'](_0xcc42a7);}})['then'](function(_0x51f91d){if(_0x51f91d){_0x5ee7bb=_0x51f91d[_0xeabc('0x41')];if(!_0xaf0794[_0xeabc('0x3c')][_0xeabc('0x42')]('nolimit')){_0xcc42a7[_0xeabc('0x23')]=qs['limit'](_0xaf0794[_0xeabc('0x3c')][_0xeabc('0x23')]);_0xcc42a7[_0xeabc('0x21')]=qs[_0xeabc('0x21')](_0xaf0794['query']['offset']);}return _0x28a4cb['getBlackLists'](_0xcc42a7);}})[_0xeabc('0x29')](function(_0x457d82){if(_0x457d82){return _0x457d82?{'count':_0x5ee7bb,'rows':_0x457d82}:null;}})[_0xeabc('0x29')](respondWithResult(_0x47da72,null))[_0xeabc('0x50')](handleError(_0x47da72,null));};exports['addBlackLists']=function(_0x3d9f54,_0x440501,_0x11a8af){var _0x268aff,_0x1fbd9b;return db[_0xeabc('0x4c')][_0xeabc('0x33')]({'where':{'id':_0x3d9f54[_0xeabc('0x52')]['id']}})[_0xeabc('0x29')](handleEntityNotFound(_0x440501,null))[_0xeabc('0x29')](function(_0x5643f6){if(_0x5643f6){_0x1fbd9b=_0x5643f6;return _0x5643f6['addBlackLists'](_0x3d9f54['body'][_0xeabc('0x83')],_[_0xeabc('0x5e')](_0x3d9f54[_0xeabc('0x55')],[_0xeabc('0x83'),'id'])||{});}return null;})[_0xeabc('0xa1')](function(_0x18157e){var _0x404839;_0x268aff=_0x18157e||[];var _0x30eb6f=[];if(_0x18157e){for(var _0xba3953=0x0;_0xba3953<_0x18157e[_0xeabc('0x41')];_0xba3953+=0x1){var _0xa1613b=_0x18157e[_0xba3953][_0xeabc('0x2b')]({'plain':!![]});_0x404839=squel[_0xeabc('0xa4')]()['into']('cm_hopper_black')[_0xeabc('0xa6')](['phone',_0xeabc('0xa8'),'ListId',_0xeabc('0x67'),_0xeabc('0x5f'),'updatedAt'],squel['select']()[_0xeabc('0x85')](_0xeabc('0xaa'),_0xeabc('0xaa'))['field']('id',_0xeabc('0xa8'))[_0xeabc('0x85')](_0xa1613b[_0xeabc('0xab')][_0xeabc('0x8c')](),'ListId')[_0xeabc('0x85')](_0x3d9f54[_0xeabc('0x52')]['id'][_0xeabc('0x8c')](),_0xeabc('0x67'))[_0xeabc('0x85')](_0xeabc('0xbf'),_0xeabc('0x5f'))[_0xeabc('0x85')](_0xeabc('0xbf'),_0xeabc('0x60'))[_0xeabc('0x86')](_0xeabc('0xac'))[_0xeabc('0x45')](_0xeabc('0xad'))[_0xeabc('0x45')](_0xeabc('0xae'),_0xa1613b[_0xeabc('0xab')][_0xeabc('0x8c')]())[_0xeabc('0x45')]('phone\x20IS\x20NOT\x20NULL'))[_0xeabc('0x8c')]();_0x30eb6f[_0xeabc('0x8a')](db[_0xeabc('0x8b')][_0xeabc('0x3c')](_0x404839));}return BPromise[_0xeabc('0x90')](_0x30eb6f);}})[_0xeabc('0x29')](function(){return _0x268aff;})[_0xeabc('0x29')](respondWithResult(_0x440501,null))['catch'](handleError(_0x440501,null));};exports[_0xeabc('0xc0')]=function(_0xb22c9f,_0x24bc07,_0x52bc60){return db[_0xeabc('0x4c')][_0xeabc('0x33')]({'where':{'id':_0xb22c9f[_0xeabc('0x52')]['id']}})[_0xeabc('0x29')](handleEntityNotFound(_0x24bc07,null))['then'](function(_0x3a3d98){if(_0x3a3d98){return _0x3a3d98[_0xeabc('0xc0')](_0xb22c9f[_0xeabc('0x3c')][_0xeabc('0x83')]);}})[_0xeabc('0x29')](function(_0x14cf92){if(_0x14cf92){return db[_0xeabc('0x6e')][_0xeabc('0x2a')]({'where':{'ListId':_0xb22c9f[_0xeabc('0x3c')][_0xeabc('0x83')],'VoiceQueueId':_0xb22c9f[_0xeabc('0x52')]['id']}})[_0xeabc('0x29')](function(){return _0x14cf92;});}})[_0xeabc('0x29')](respondWithStatusCode(_0x24bc07,null))[_0xeabc('0x50')](handleError(_0x24bc07,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 4083c12..451551d 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 _0x94f0=['exports','events','VoiceQueue','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x2ff9fe,_0x6f9bfd){var _0x46e18d=function(_0x30aaab){while(--_0x30aaab){_0x2ff9fe['push'](_0x2ff9fe['shift']());}};_0x46e18d(++_0x6f9bfd);}(_0x94f0,0x1b1));var _0x094f=function(_0x1f6a87,_0x31aa8d){_0x1f6a87=_0x1f6a87-0x0;var _0x4db6f0=_0x94f0[_0x1f6a87];return _0x4db6f0;};'use strict';var EventEmitter=require(_0x094f('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0x094f('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x094f('0x2')](0x0);var events={'afterCreate':_0x094f('0x3'),'afterUpdate':_0x094f('0x4'),'afterDestroy':'remove'};function emitEvent(_0xb91398){return function(_0x2b5a3b,_0x15d939,_0x30da06){VoiceQueueEvents[_0x094f('0x5')](_0xb91398+':'+_0x2b5a3b['id'],_0x2b5a3b);VoiceQueueEvents[_0x094f('0x5')](_0xb91398,_0x2b5a3b);_0x30da06(null);};}for(var e in events){if(events[_0x094f('0x6')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x094f('0x7')]=VoiceQueueEvents; \ No newline at end of file +var _0x3f6c=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueue'];(function(_0x15f75e,_0x230427){var _0x53e41b=function(_0x275740){while(--_0x275740){_0x15f75e['push'](_0x15f75e['shift']());}};_0x53e41b(++_0x230427);}(_0x3f6c,0x15b));var _0xc3f6=function(_0xbe5e56,_0x3c15df){_0xbe5e56=_0xbe5e56-0x0;var _0x1a6a4a=_0x3f6c[_0xbe5e56];return _0x1a6a4a;};'use strict';var EventEmitter=require(_0xc3f6('0x0'));var VoiceQueue=require(_0xc3f6('0x1'))['db'][_0xc3f6('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xc3f6('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc3f6('0x4'),'afterDestroy':_0xc3f6('0x5')};function emitEvent(_0xef4d06){return function(_0x192b4f,_0x52b305,_0x1e6085){VoiceQueueEvents[_0xc3f6('0x6')](_0xef4d06+':'+_0x192b4f['id'],_0x192b4f);VoiceQueueEvents[_0xc3f6('0x6')](_0xef4d06,_0x192b4f);_0x1e6085(null);};}for(var e in events){if(events[_0xc3f6('0x7')](e)){var event=events[e];VoiceQueue[_0xc3f6('0x8')](e,emitEvent(event));}}module[_0xc3f6('0x9')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 3188fb0..ff2a1ba 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 _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0x50ea98,_0x20e2e2){var _0xaa7ea5=function(_0x4794d6){while(--_0x4794d6){_0x50ea98['push'](_0x50ea98['shift']());}};_0xaa7ea5(++_0x20e2e2);}(_0x34e8,0x12c));var _0x834e=function(_0x1ae7d4,_0x4e8336){_0x1ae7d4=_0x1ae7d4-0x0;var _0x2bb27d=_0x34e8[_0x1ae7d4];return _0x2bb27d;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e74=['exports','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes'];(function(_0x391802,_0xde0fd){var _0x3aa73b=function(_0x31d199){while(--_0x31d199){_0x391802['push'](_0x391802['shift']());}};_0x3aa73b(++_0xde0fd);}(_0x3e74,0x175));var _0x43e7=function(_0xb539f6,_0x5d6b73){_0xb539f6=_0xb539f6-0x0;var _0x55097a=_0x3e74[_0xb539f6];return _0x55097a;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 9e67d0a..399c189 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 _0x29aa=['raw','where','attributes','limit','include','map','model','catch','ShowVoiceQueue','VoiceQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','result','GetVoiceQueue','options'];(function(_0x119880,_0x4f291f){var _0x4a1707=function(_0x4e88c2){while(--_0x4e88c2){_0x119880['push'](_0x119880['shift']());}};_0x4a1707(++_0x4f291f);}(_0x29aa,0x142));var _0xa29a=function(_0x7cdb44,_0x3be490){_0x7cdb44=_0x7cdb44-0x0;var _0x1f7408=_0x29aa[_0x7cdb44];return _0x1f7408;};'use strict';var _=require(_0xa29a('0x0'));var util=require(_0xa29a('0x1'));var moment=require(_0xa29a('0x2'));var BPromise=require(_0xa29a('0x3'));var rs=require(_0xa29a('0x4'));var fs=require('fs');var Redis=require(_0xa29a('0x5'));var db=require(_0xa29a('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa29a('0x7'));var config=require(_0xa29a('0x8'));var jayson=require(_0xa29a('0x9'));var client=jayson[_0xa29a('0xa')][_0xa29a('0xb')]({'port':0x232a});config[_0xa29a('0xc')]=_['defaults'](config[_0xa29a('0xc')],{'host':_0xa29a('0xd'),'port':0x18eb});var socket=require(_0xa29a('0xe'))(new Redis(config[_0xa29a('0xc')]));require('./voiceQueue.socket')[_0xa29a('0xf')](socket);function respondWithRpcPromise(_0x51cfb5,_0x41c035,_0x166a77){return new BPromise(function(_0x2b9bce,_0x5a4ff7){return client[_0xa29a('0x10')](_0x51cfb5,_0x166a77)[_0xa29a('0x11')](function(_0x11be49){logger[_0xa29a('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x41c035,_0xa29a('0x13'));logger[_0xa29a('0x14')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x41c035,_0xa29a('0x13'),JSON[_0xa29a('0x15')](_0x11be49));if(_0x11be49[_0xa29a('0x16')]){if(_0x11be49[_0xa29a('0x16')][_0xa29a('0x17')]===0x1f4){logger[_0xa29a('0x16')](_0xa29a('0x18'),_0x41c035,_0x11be49['error']['message']);return _0x5a4ff7(_0x11be49[_0xa29a('0x16')]['message']);}logger[_0xa29a('0x16')](_0xa29a('0x18'),_0x41c035,_0x11be49['error'][_0xa29a('0x19')]);return _0x2b9bce(_0x11be49[_0xa29a('0x16')][_0xa29a('0x19')]);}else{logger[_0xa29a('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x41c035,_0xa29a('0x13'));_0x2b9bce(_0x11be49[_0xa29a('0x1a')][_0xa29a('0x19')]);}})['catch'](function(_0xda5adf){logger[_0xa29a('0x16')](_0xa29a('0x18'),_0x41c035,_0xda5adf);_0x5a4ff7(_0xda5adf);});});}exports[_0xa29a('0x1b')]=function(_0x4a701c){var _0x691028=this;return new Promise(function(_0x37762a,_0x4788c2){return db['VoiceQueue']['findAll']({'raw':_0x4a701c[_0xa29a('0x1c')]?_0x4a701c['options'][_0xa29a('0x1d')]===undefined?!![]:![]:!![],'where':_0x4a701c['options']?_0x4a701c[_0xa29a('0x1c')][_0xa29a('0x1e')]||null:null,'attributes':_0x4a701c[_0xa29a('0x1c')]?_0x4a701c[_0xa29a('0x1c')][_0xa29a('0x1f')]||null:null,'limit':_0x4a701c[_0xa29a('0x1c')]?_0x4a701c['options'][_0xa29a('0x20')]||null:null,'include':_0x4a701c[_0xa29a('0x1c')]?_0x4a701c[_0xa29a('0x1c')][_0xa29a('0x21')]?_[_0xa29a('0x22')](_0x4a701c[_0xa29a('0x1c')][_0xa29a('0x21')],function(_0x6a0521){return{'model':db[_0x6a0521['model']],'as':_0x6a0521['as'],'attributes':_0x6a0521[_0xa29a('0x1f')],'include':_0x6a0521[_0xa29a('0x21')]?_[_0xa29a('0x22')](_0x6a0521['include'],function(_0x3cec62){return{'model':db[_0x3cec62[_0xa29a('0x23')]],'as':_0x3cec62['as'],'attributes':_0x3cec62[_0xa29a('0x1f')],'include':_0x3cec62[_0xa29a('0x21')]?_['map'](_0x3cec62[_0xa29a('0x21')],function(_0x5560aa){return{'model':db[_0x5560aa[_0xa29a('0x23')]],'as':_0x5560aa['as'],'attributes':_0x5560aa[_0xa29a('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xd66bd1){logger[_0xa29a('0x12')](_0xa29a('0x1b'),_0x4a701c);logger[_0xa29a('0x14')](_0xa29a('0x1b'),_0x4a701c,JSON[_0xa29a('0x15')](_0xd66bd1));_0x37762a(_0xd66bd1);})[_0xa29a('0x24')](function(_0x32dcdd){logger[_0xa29a('0x16')]('GetVoiceQueue',_0x32dcdd[_0xa29a('0x19')],_0x4a701c);_0x4788c2(_0x691028[_0xa29a('0x16')](0x1f4,_0x32dcdd['message']));});});};exports[_0xa29a('0x25')]=function(_0x584e6a){var _0x33c27d=this;return new Promise(function(_0x4f1320,_0x428ab4){return db[_0xa29a('0x26')]['find']({'raw':_0x584e6a['options']?_0x584e6a[_0xa29a('0x1c')][_0xa29a('0x1d')]===undefined?!![]:![]:!![],'where':_0x584e6a[_0xa29a('0x1c')]?_0x584e6a['options'][_0xa29a('0x1e')]||null:null,'attributes':_0x584e6a['options']?_0x584e6a[_0xa29a('0x1c')][_0xa29a('0x1f')]||null:null,'include':_0x584e6a['options']?_0x584e6a[_0xa29a('0x1c')][_0xa29a('0x21')]?_[_0xa29a('0x22')](_0x584e6a[_0xa29a('0x1c')][_0xa29a('0x21')],function(_0x39a642){return{'model':db[_0x39a642['model']],'as':_0x39a642['as'],'attributes':_0x39a642[_0xa29a('0x1f')],'include':_0x39a642[_0xa29a('0x21')]?_[_0xa29a('0x22')](_0x39a642[_0xa29a('0x21')],function(_0x15e2cc){return{'model':db[_0x15e2cc[_0xa29a('0x23')]],'as':_0x15e2cc['as'],'attributes':_0x15e2cc[_0xa29a('0x1f')],'include':_0x15e2cc[_0xa29a('0x21')]?_[_0xa29a('0x22')](_0x15e2cc[_0xa29a('0x21')],function(_0x5d9585){return{'model':db[_0x5d9585['model']],'as':_0x5d9585['as'],'attributes':_0x5d9585[_0xa29a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa29a('0x11')](function(_0x3ef062){logger[_0xa29a('0x12')](_0xa29a('0x25'),_0x584e6a);logger[_0xa29a('0x14')](_0xa29a('0x25'),_0x584e6a,JSON[_0xa29a('0x15')](_0x3ef062));_0x4f1320(_0x3ef062);})[_0xa29a('0x24')](function(_0x5682c9){logger['error'](_0xa29a('0x25'),_0x5682c9[_0xa29a('0x19')],_0x584e6a);_0x428ab4(_0x33c27d[_0xa29a('0x16')](0x1f4,_0x5682c9[_0xa29a('0x19')]));});});}; \ No newline at end of file +var _0x0186=['message','request\x20sent','result','GetVoiceQueue','VoiceQueue','options','raw','where','attributes','include','then','debug','catch','find','map','model','ShowVoiceQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voiceQueue.socket','info','VoiceQueue,\x20%s,\x20%s','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3d0f33,_0x5e7157){var _0x11b93a=function(_0x113a40){while(--_0x113a40){_0x3d0f33['push'](_0x3d0f33['shift']());}};_0x11b93a(++_0x5e7157);}(_0x0186,0x151));var _0x6018=function(_0x5479f1,_0x5ca205){_0x5479f1=_0x5479f1-0x0;var _0x308f53=_0x0186[_0x5479f1];return _0x308f53;};'use strict';var _=require(_0x6018('0x0'));var util=require(_0x6018('0x1'));var moment=require(_0x6018('0x2'));var BPromise=require(_0x6018('0x3'));var rs=require(_0x6018('0x4'));var fs=require('fs');var Redis=require(_0x6018('0x5'));var db=require(_0x6018('0x6'))['db'];var utils=require(_0x6018('0x7'));var logger=require('../../config/logger')(_0x6018('0x8'));var config=require(_0x6018('0x9'));var jayson=require(_0x6018('0xa'));var client=jayson[_0x6018('0xb')][_0x6018('0xc')]({'port':0x232a});config[_0x6018('0xd')]=_[_0x6018('0xe')](config[_0x6018('0xd')],{'host':_0x6018('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6018('0xd')]));require(_0x6018('0x10'))['register'](socket);function respondWithRpcPromise(_0x492fe7,_0xcfbe84,_0x18f13c){return new BPromise(function(_0x2d3db6,_0x29a811){return client['request'](_0x492fe7,_0x18f13c)['then'](function(_0x9cb687){logger[_0x6018('0x11')](_0x6018('0x12'),_0xcfbe84,'request\x20sent');logger['debug'](_0x6018('0x13'),_0xcfbe84,'request\x20sent',JSON[_0x6018('0x14')](_0x9cb687));if(_0x9cb687[_0x6018('0x15')]){if(_0x9cb687[_0x6018('0x15')][_0x6018('0x16')]===0x1f4){logger[_0x6018('0x15')](_0x6018('0x12'),_0xcfbe84,_0x9cb687['error'][_0x6018('0x17')]);return _0x29a811(_0x9cb687[_0x6018('0x15')]['message']);}logger[_0x6018('0x15')](_0x6018('0x12'),_0xcfbe84,_0x9cb687[_0x6018('0x15')][_0x6018('0x17')]);return _0x2d3db6(_0x9cb687[_0x6018('0x15')]['message']);}else{logger[_0x6018('0x11')]('VoiceQueue,\x20%s,\x20%s',_0xcfbe84,_0x6018('0x18'));_0x2d3db6(_0x9cb687[_0x6018('0x19')][_0x6018('0x17')]);}})['catch'](function(_0x58ecde){logger[_0x6018('0x15')](_0x6018('0x12'),_0xcfbe84,_0x58ecde);_0x29a811(_0x58ecde);});});}exports[_0x6018('0x1a')]=function(_0x5334d6){var _0x560e76=this;return new Promise(function(_0x5bd738,_0x562914){return db[_0x6018('0x1b')]['findAll']({'raw':_0x5334d6[_0x6018('0x1c')]?_0x5334d6[_0x6018('0x1c')][_0x6018('0x1d')]===undefined?!![]:![]:!![],'where':_0x5334d6['options']?_0x5334d6['options'][_0x6018('0x1e')]||null:null,'attributes':_0x5334d6['options']?_0x5334d6[_0x6018('0x1c')][_0x6018('0x1f')]||null:null,'limit':_0x5334d6[_0x6018('0x1c')]?_0x5334d6['options']['limit']||null:null,'include':_0x5334d6['options']?_0x5334d6['options']['include']?_['map'](_0x5334d6[_0x6018('0x1c')][_0x6018('0x20')],function(_0x3a6b6f){return{'model':db[_0x3a6b6f['model']],'as':_0x3a6b6f['as'],'attributes':_0x3a6b6f[_0x6018('0x1f')],'include':_0x3a6b6f[_0x6018('0x20')]?_['map'](_0x3a6b6f[_0x6018('0x20')],function(_0x24b94c){return{'model':db[_0x24b94c['model']],'as':_0x24b94c['as'],'attributes':_0x24b94c[_0x6018('0x1f')],'include':_0x24b94c[_0x6018('0x20')]?_['map'](_0x24b94c[_0x6018('0x20')],function(_0x6f2ab5){return{'model':db[_0x6f2ab5['model']],'as':_0x6f2ab5['as'],'attributes':_0x6f2ab5['attributes']};}):[]};}):[]};}):[]:[]})[_0x6018('0x21')](function(_0x32184e){logger[_0x6018('0x11')]('GetVoiceQueue',_0x5334d6);logger[_0x6018('0x22')](_0x6018('0x1a'),_0x5334d6,JSON[_0x6018('0x14')](_0x32184e));_0x5bd738(_0x32184e);})[_0x6018('0x23')](function(_0x563dda){logger[_0x6018('0x15')](_0x6018('0x1a'),_0x563dda['message'],_0x5334d6);_0x562914(_0x560e76[_0x6018('0x15')](0x1f4,_0x563dda['message']));});});};exports['ShowVoiceQueue']=function(_0x1f2083){var _0xd3d5d9=this;return new Promise(function(_0x259e11,_0x2e50c9){return db[_0x6018('0x1b')][_0x6018('0x24')]({'raw':_0x1f2083[_0x6018('0x1c')]?_0x1f2083['options'][_0x6018('0x1d')]===undefined?!![]:![]:!![],'where':_0x1f2083[_0x6018('0x1c')]?_0x1f2083[_0x6018('0x1c')][_0x6018('0x1e')]||null:null,'attributes':_0x1f2083['options']?_0x1f2083[_0x6018('0x1c')][_0x6018('0x1f')]||null:null,'include':_0x1f2083['options']?_0x1f2083[_0x6018('0x1c')]['include']?_[_0x6018('0x25')](_0x1f2083['options']['include'],function(_0x44163e){return{'model':db[_0x44163e[_0x6018('0x26')]],'as':_0x44163e['as'],'attributes':_0x44163e['attributes'],'include':_0x44163e['include']?_[_0x6018('0x25')](_0x44163e[_0x6018('0x20')],function(_0x117d7f){return{'model':db[_0x117d7f['model']],'as':_0x117d7f['as'],'attributes':_0x117d7f['attributes'],'include':_0x117d7f[_0x6018('0x20')]?_[_0x6018('0x25')](_0x117d7f['include'],function(_0x745c6b){return{'model':db[_0x745c6b[_0x6018('0x26')]],'as':_0x745c6b['as'],'attributes':_0x745c6b[_0x6018('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1915cc){logger['info']('ShowVoiceQueue',_0x1f2083);logger[_0x6018('0x22')](_0x6018('0x27'),_0x1f2083,JSON['stringify'](_0x1915cc));_0x259e11(_0x1915cc);})[_0x6018('0x23')](function(_0x4cf97f){logger['error']('ShowVoiceQueue',_0x4cf97f[_0x6018('0x17')],_0x1f2083);_0x2e50c9(_0xd3d5d9[_0x6018('0x15')](0x1f4,_0x4cf97f[_0x6018('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 6df155d..d2601e9 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 _0x27fe=['./voiceQueue.events','save','update','emit','removeListener','register','voiceQueue:'];(function(_0x1d0456,_0x353c0b){var _0x1f4fbf=function(_0x21c62c){while(--_0x21c62c){_0x1d0456['push'](_0x1d0456['shift']());}};_0x1f4fbf(++_0x353c0b);}(_0x27fe,0xe7));var _0xe27f=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0x27fe[_0x3ce3c];return _0x55a2c9;};'use strict';var VoiceQueueEvents=require(_0xe27f('0x0'));var events=[_0xe27f('0x1'),'remove',_0xe27f('0x2')];function createListener(_0x23bf98,_0x19011b){return function(_0x27cb88){_0x19011b[_0xe27f('0x3')](_0x23bf98,_0x27cb88);};}function removeListener(_0x279866,_0xc2880e){return function(){VoiceQueueEvents[_0xe27f('0x4')](_0x279866,_0xc2880e);};}exports[_0xe27f('0x5')]=function(_0x1857e5){for(var _0x2a7284=0x0,_0x210cab=events['length'];_0x2a7284<_0x210cab;_0x2a7284++){var _0x521953=events[_0x2a7284];var _0x22f81d=createListener(_0xe27f('0x6')+_0x521953,_0x1857e5);VoiceQueueEvents['on'](_0x521953,_0x22f81d);}}; \ No newline at end of file +var _0xcc0b=['voiceQueue:','./voiceQueue.events','save','remove','removeListener','register'];(function(_0x562faf,_0x102bcc){var _0x22c1f6=function(_0x2cd3b8){while(--_0x2cd3b8){_0x562faf['push'](_0x562faf['shift']());}};_0x22c1f6(++_0x102bcc);}(_0xcc0b,0xf7));var _0xbcc0=function(_0x48d218,_0x38ae7b){_0x48d218=_0x48d218-0x0;var _0x5d86c7=_0xcc0b[_0x48d218];return _0x5d86c7;};'use strict';var VoiceQueueEvents=require(_0xbcc0('0x0'));var events=[_0xbcc0('0x1'),_0xbcc0('0x2'),'update'];function createListener(_0x540f21,_0x289b92){return function(_0x5d03f9){_0x289b92['emit'](_0x540f21,_0x5d03f9);};}function removeListener(_0x1581d3,_0x9605f2){return function(){VoiceQueueEvents[_0xbcc0('0x3')](_0x1581d3,_0x9605f2);};}exports[_0xbcc0('0x4')]=function(_0x517add){for(var _0x4330c6=0x0,_0x15b0e8=events['length'];_0x4330c6<_0x15b0e8;_0x4330c6++){var _0x2bd0b8=events[_0x4330c6];var _0x2b96a9=createListener(_0xbcc0('0x5')+_0x2bd0b8,_0x517add);VoiceQueueEvents['on'](_0x2bd0b8,_0x2b96a9);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index f7aa1c3..d648b30 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 _0x2023=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','index','get','/describe','isAuthenticated','describe','/index','getVoiceQueuesReport','/:id','show','post','create','put','delete','exports','util','connect-timeout','express'];(function(_0xce6f11,_0x3c3137){var _0x35b709=function(_0x1755c6){while(--_0x1755c6){_0xce6f11['push'](_0xce6f11['shift']());}};_0x35b709(++_0x3c3137);}(_0x2023,0x131));var _0x3202=function(_0x3e55eb,_0x24e873){_0x3e55eb=_0x3e55eb-0x0;var _0xf6c688=_0x2023[_0x3e55eb];return _0xf6c688;};'use strict';var multer=require('multer');var util=require(_0x3202('0x0'));var path=require('path');var timeout=require(_0x3202('0x1'));var express=require(_0x3202('0x2'));var router=express[_0x3202('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3202('0x4'));var interaction=require(_0x3202('0x5'));var config=require(_0x3202('0x6'));var controller=require(_0x3202('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x3202('0x8')]);router[_0x3202('0x9')](_0x3202('0xa'),auth[_0x3202('0xb')](),controller[_0x3202('0xc')]);router[_0x3202('0x9')](_0x3202('0xd'),auth[_0x3202('0xb')](),controller[_0x3202('0xe')]);router[_0x3202('0x9')](_0x3202('0xf'),auth['isAuthenticated'](),controller[_0x3202('0x10')]);router[_0x3202('0x11')]('/',auth[_0x3202('0xb')](),controller[_0x3202('0x12')]);router[_0x3202('0x13')](_0x3202('0xf'),auth[_0x3202('0xb')](),controller['update']);router[_0x3202('0x14')](_0x3202('0xf'),auth[_0x3202('0xb')](),controller['destroy']);module[_0x3202('0x15')]=router; \ No newline at end of file +var _0x44b2=['./voiceQueueReport.controller','get','index','/describe','isAuthenticated','describe','/index','getVoiceQueuesReport','/:id','show','post','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x24e0cd,_0x1f32c5){var _0x52bece=function(_0x16f98a){while(--_0x16f98a){_0x24e0cd['push'](_0x24e0cd['shift']());}};_0x52bece(++_0x1f32c5);}(_0x44b2,0xb7));var _0x244b=function(_0x11dda3,_0x482da8){_0x11dda3=_0x11dda3-0x0;var _0x16d273=_0x44b2[_0x11dda3];return _0x16d273;};'use strict';var multer=require(_0x244b('0x0'));var util=require(_0x244b('0x1'));var path=require(_0x244b('0x2'));var timeout=require(_0x244b('0x3'));var express=require(_0x244b('0x4'));var router=express[_0x244b('0x5')]();var fs_extra=require(_0x244b('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x244b('0x7'));var config=require(_0x244b('0x8'));var controller=require(_0x244b('0x9'));router[_0x244b('0xa')]('/',auth['isAuthenticated'](),controller[_0x244b('0xb')]);router[_0x244b('0xa')](_0x244b('0xc'),auth[_0x244b('0xd')](),controller[_0x244b('0xe')]);router[_0x244b('0xa')](_0x244b('0xf'),auth[_0x244b('0xd')](),controller[_0x244b('0x10')]);router['get'](_0x244b('0x11'),auth[_0x244b('0xd')](),controller[_0x244b('0x12')]);router[_0x244b('0x13')]('/',auth[_0x244b('0xd')](),controller['create']);router[_0x244b('0x14')](_0x244b('0x11'),auth[_0x244b('0xd')](),controller[_0x244b('0x15')]);router[_0x244b('0x16')](_0x244b('0x11'),auth['isAuthenticated'](),controller[_0x244b('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index d38322c..6f0f95e 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 _0x0798=['sequelize','moment','STRING','DATE','getDataValue','format','YYYY-MM-DD\x20HH:mm:ss','diff','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x657798,_0x35496e){var _0x58c7e1=function(_0x178198){while(--_0x178198){_0x657798['push'](_0x657798['shift']());}};_0x58c7e1(++_0x35496e);}(_0x0798,0x126));var _0x8079=function(_0xa572c1,_0xb11bd5){_0xa572c1=_0xa572c1-0x0;var _0x11753f=_0x0798[_0xa572c1];return _0x11753f;};'use strict';var Sequelize=require(_0x8079('0x0'));var moment=require(_0x8079('0x1'));module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x8079('0x2')]},'calleridnum':{'type':Sequelize[_0x8079('0x2')]},'calleridname':{'type':Sequelize[_0x8079('0x2')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x8079('0x3')],'set':function(_0x14fd2c){var _0x7d2be1=moment(_0x14fd2c);var _0x249457=moment(this[_0x8079('0x4')]('queuecallerjoinAt'))[_0x8079('0x5')](_0x8079('0x6'));var _0x377fbf=_0x7d2be1[_0x8079('0x7')](_0x249457,'seconds');this[_0x8079('0x8')](_0x8079('0x9'),_0x14fd2c);this[_0x8079('0x8')](_0x8079('0xa'),_0x377fbf||null);}},'position':{'type':Sequelize[_0x8079('0xb')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x8079('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x8079('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x8079('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x8079('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x8079('0x3')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x8079('0x2')]},'connectedlinenum':{'type':Sequelize[_0x8079('0x2')]},'connectedlinename':{'type':Sequelize[_0x8079('0x2')]},'accountcode':{'type':Sequelize[_0x8079('0x2')]},'context':{'type':Sequelize[_0x8079('0x2')]},'exten':{'type':Sequelize[_0x8079('0x2')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x8079('0xb')]},'mohtime':{'type':Sequelize[_0x8079('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x8079('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x8079('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x8079('0x2')],'comment':_0x8079('0xd')},'transferexten':{'type':Sequelize[_0x8079('0x2')]},'transferuniqueid':{'type':Sequelize[_0x8079('0x2')]},'disposition':{'type':Sequelize[_0x8079('0x2')]},'secondDisposition':{'type':Sequelize[_0x8079('0x2')]},'thirdDisposition':{'type':Sequelize[_0x8079('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x8079('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6ae4=['format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','DATE','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','moment','exports','STRING','getDataValue','queuecallerjoinAt'];(function(_0x40450d,_0x216ba0){var _0x1065a5=function(_0x2f1de1){while(--_0x2f1de1){_0x40450d['push'](_0x40450d['shift']());}};_0x1065a5(++_0x216ba0);}(_0x6ae4,0xeb));var _0x46ae=function(_0x3cb6e9,_0x1d1620){_0x3cb6e9=_0x3cb6e9-0x0;var _0x3b5a52=_0x6ae4[_0x3cb6e9];return _0x3b5a52;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x46ae('0x0'));module[_0x46ae('0x1')]={'type':{'type':Sequelize[_0x46ae('0x2')]},'uniqueid':{'type':Sequelize[_0x46ae('0x2')]},'calleridnum':{'type':Sequelize[_0x46ae('0x2')]},'calleridname':{'type':Sequelize[_0x46ae('0x2')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x29447b){var _0x3d5921=moment(_0x29447b);var _0x271d19=moment(this[_0x46ae('0x3')](_0x46ae('0x4')))[_0x46ae('0x5')](_0x46ae('0x6'));var _0x53517e=_0x3d5921[_0x46ae('0x7')](_0x271d19,_0x46ae('0x8'));this[_0x46ae('0x9')](_0x46ae('0xa'),_0x29447b);this[_0x46ae('0x9')](_0x46ae('0xb'),_0x53517e||null);}},'position':{'type':Sequelize[_0x46ae('0xc')]},'count':{'type':Sequelize[_0x46ae('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x46ae('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x46ae('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x46ae('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x46ae('0xe')]},'queuecallerexitreason':{'type':Sequelize[_0x46ae('0x2')],'comment':_0x46ae('0xf')},'originalposition':{'type':Sequelize[_0x46ae('0xc')]},'channel':{'type':Sequelize[_0x46ae('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x46ae('0x2')]},'accountcode':{'type':Sequelize[_0x46ae('0x2')]},'context':{'type':Sequelize[_0x46ae('0x2')]},'exten':{'type':Sequelize[_0x46ae('0x2')]},'priority':{'type':Sequelize[_0x46ae('0x2')]},'holdtime':{'type':Sequelize[_0x46ae('0xc')]},'mohtime':{'type':Sequelize[_0x46ae('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x46ae('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x46ae('0x2')]},'transfer':{'type':Sequelize[_0x46ae('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x46ae('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x46ae('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x46ae('0x2')]},'secondDisposition':{'type':Sequelize[_0x46ae('0x2')]},'thirdDisposition':{'type':Sequelize[_0x46ae('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x46ae('0xc')],'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 e6424b4..d914b45 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 _0x3d55=['map','VoiceQueueReport','rawAttributes','type','key','keys','query','filters','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','intersection','length','create','body','find','getVoiceQueuesReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index'];(function(_0x2eb898,_0x43c47b){var _0x58974f=function(_0x5cdc1){while(--_0x5cdc1){_0x2eb898['push'](_0x2eb898['shift']());}};_0x58974f(++_0x43c47b);}(_0x3d55,0x75));var _0x53d5=function(_0x17788a,_0x150887){_0x17788a=_0x17788a-0x0;var _0x33f47c=_0x3d55[_0x17788a];return _0x33f47c;};'use strict';var emlformat=require(_0x53d5('0x0'));var rimraf=require(_0x53d5('0x1'));var zipdir=require(_0x53d5('0x2'));var jsonpatch=require(_0x53d5('0x3'));var rp=require(_0x53d5('0x4'));var moment=require(_0x53d5('0x5'));var BPromise=require(_0x53d5('0x6'));var Mustache=require(_0x53d5('0x7'));var util=require('util');var path=require(_0x53d5('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x53d5('0x9'));var squel=require(_0x53d5('0xa'));var crypto=require('crypto');var jsforce=require(_0x53d5('0xb'));var deskjs=require(_0x53d5('0xc'));var toCsv=require(_0x53d5('0xd'));var querystring=require(_0x53d5('0xe'));var Papa=require(_0x53d5('0xf'));var Redis=require(_0x53d5('0x10'));var authService=require(_0x53d5('0x11'));var qs=require(_0x53d5('0x12'));var as=require(_0x53d5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x53d5('0x14'));var utils=require(_0x53d5('0x15'));var config=require(_0x53d5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x53d5('0x17'))['db'];config[_0x53d5('0x18')]=_[_0x53d5('0x19')](config[_0x53d5('0x18')],{'host':_0x53d5('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x53d5('0x1b'))[_0x53d5('0x1c')](socket);function respondWithStatusCode(_0x3cbefa,_0x2e67cf){_0x2e67cf=_0x2e67cf||0xcc;return function(_0x2cc6b2){if(_0x2cc6b2){return _0x3cbefa[_0x53d5('0x1d')](_0x2e67cf);}return _0x3cbefa[_0x53d5('0x1e')](_0x2e67cf)[_0x53d5('0x1f')]();};}function respondWithResult(_0x19a43e,_0x52a02f){_0x52a02f=_0x52a02f||0xc8;return function(_0x453242){if(_0x453242){return _0x19a43e['status'](_0x52a02f)[_0x53d5('0x20')](_0x453242);}};}function respondWithFilteredResult(_0x40e00a,_0x2b3c7f){return function(_0x161552){if(_0x161552){var _0x561809=typeof _0x2b3c7f[_0x53d5('0x21')]==='undefined'&&typeof _0x2b3c7f[_0x53d5('0x22')]===_0x53d5('0x23');var _0x28f886=_0x161552[_0x53d5('0x24')];var _0x126e18=_0x561809?0x0:_0x2b3c7f['offset'];var _0x3bdd1e=_0x561809?_0x161552[_0x53d5('0x24')]:_0x2b3c7f['offset']+_0x2b3c7f['limit'];var _0x1c5c1a;if(_0x3bdd1e>=_0x28f886){_0x3bdd1e=_0x28f886;_0x1c5c1a=0xc8;}else{_0x1c5c1a=0xce;}_0x40e00a[_0x53d5('0x1e')](_0x1c5c1a);return _0x40e00a[_0x53d5('0x25')](_0x53d5('0x26'),_0x126e18+'-'+_0x3bdd1e+'/'+_0x28f886)[_0x53d5('0x20')](_0x161552);}return null;};}function patchUpdates(_0x3ebeaf){return function(_0x3825d1){try{jsonpatch[_0x53d5('0x27')](_0x3825d1,_0x3ebeaf,!![]);}catch(_0x4083d0){return BPromise[_0x53d5('0x28')](_0x4083d0);}return _0x3825d1[_0x53d5('0x29')]();};}function saveUpdates(_0x5bd5ee,_0x251791){return function(_0x5ccf1e){if(_0x5ccf1e){return _0x5ccf1e[_0x53d5('0x2a')](_0x5bd5ee)[_0x53d5('0x2b')](function(_0x3fa43e){return _0x3fa43e;});}return null;};}function removeEntity(_0x12a678,_0x1424d4){return function(_0x238ad3){if(_0x238ad3){return _0x238ad3[_0x53d5('0x2c')]()[_0x53d5('0x2b')](function(){_0x12a678[_0x53d5('0x1e')](0xcc)[_0x53d5('0x1f')]();});}};}function handleEntityNotFound(_0x49e806,_0x1efff4){return function(_0x17261e){if(!_0x17261e){_0x49e806[_0x53d5('0x1d')](0x194);}return _0x17261e;};}function handleError(_0x4a1f69,_0x87ca12){_0x87ca12=_0x87ca12||0x1f4;return function(_0x4937b0){logger[_0x53d5('0x2d')](_0x4937b0['stack']);if(_0x4937b0[_0x53d5('0x2e')]){delete _0x4937b0['name'];}_0x4a1f69[_0x53d5('0x1e')](_0x87ca12)[_0x53d5('0x2f')](_0x4937b0);};}exports[_0x53d5('0x30')]=function(_0xb47996,_0x3a4453){var _0x4c1cfe={},_0x174cb6={},_0x4b550c={'count':0x0,'rows':[]};var _0x2f0126=_[_0x53d5('0x31')](db[_0x53d5('0x32')][_0x53d5('0x33')],function(_0x7ad244){return{'name':_0x7ad244['fieldName'],'type':_0x7ad244[_0x53d5('0x34')][_0x53d5('0x35')]};});_0x174cb6['model']=_[_0x53d5('0x31')](_0x2f0126,_0x53d5('0x2e'));_0x174cb6['query']=_[_0x53d5('0x36')](_0xb47996[_0x53d5('0x37')]);_0x174cb6[_0x53d5('0x38')]=_['intersection'](_0x174cb6[_0x53d5('0x39')],_0x174cb6['query']);_0x4c1cfe['attributes']=_['intersection'](_0x174cb6['model'],qs[_0x53d5('0x3a')](_0xb47996[_0x53d5('0x37')][_0x53d5('0x3a')]));_0x4c1cfe[_0x53d5('0x3b')]=_0x4c1cfe[_0x53d5('0x3b')]['length']?_0x4c1cfe['attributes']:_0x174cb6['model'];if(!_0xb47996[_0x53d5('0x37')][_0x53d5('0x3c')](_0x53d5('0x3d'))){_0x4c1cfe[_0x53d5('0x22')]=qs[_0x53d5('0x22')](_0xb47996[_0x53d5('0x37')][_0x53d5('0x22')]);_0x4c1cfe['offset']=qs['offset'](_0xb47996[_0x53d5('0x37')]['offset']);}_0x4c1cfe[_0x53d5('0x3e')]=qs[_0x53d5('0x3f')](_0xb47996['query'][_0x53d5('0x3f')]);_0x4c1cfe[_0x53d5('0x40')]=qs[_0x53d5('0x38')](_[_0x53d5('0x41')](_0xb47996[_0x53d5('0x37')],_0x174cb6['filters']),_0x2f0126);if(_0xb47996['query']['filter']){_0x4c1cfe[_0x53d5('0x40')]=_[_0x53d5('0x42')](_0x4c1cfe[_0x53d5('0x40')],{'$or':_[_0x53d5('0x31')](_0x2f0126,function(_0x3adbdf){if(_0x3adbdf[_0x53d5('0x34')]!==_0x53d5('0x43')){var _0x3fa9c8={};_0x3fa9c8[_0x3adbdf[_0x53d5('0x2e')]]={'$like':'%'+_0xb47996[_0x53d5('0x37')][_0x53d5('0x44')]+'%'};return _0x3fa9c8;}})});}_0x4c1cfe=_['merge']({},_0x4c1cfe,_0xb47996[_0x53d5('0x45')]);var _0x1f5991={'where':_0x4c1cfe['where']};return db[_0x53d5('0x32')][_0x53d5('0x24')](_0x1f5991)[_0x53d5('0x2b')](function(_0x55d501){_0x4b550c[_0x53d5('0x24')]=_0x55d501;if(_0xb47996[_0x53d5('0x37')][_0x53d5('0x46')]){_0x4c1cfe[_0x53d5('0x47')]=[{'all':!![]}];}return db[_0x53d5('0x32')][_0x53d5('0x48')](_0x4c1cfe);})['then'](function(_0x4ae649){_0x4b550c[_0x53d5('0x49')]=_0x4ae649;return _0x4b550c;})[_0x53d5('0x2b')](respondWithFilteredResult(_0x3a4453,_0x4c1cfe))[_0x53d5('0x4a')](handleError(_0x3a4453,null));};exports[_0x53d5('0x4b')]=function(_0xae35d2,_0x5d2fe9){var _0x3d018c={'raw':![],'where':{'id':_0xae35d2[_0x53d5('0x4c')]['id']}},_0x3ee106={};_0x3ee106[_0x53d5('0x39')]=_[_0x53d5('0x36')](db['VoiceQueueReport'][_0x53d5('0x33')]);_0x3ee106[_0x53d5('0x37')]=_['keys'](_0xae35d2[_0x53d5('0x37')]);_0x3ee106[_0x53d5('0x38')]=_[_0x53d5('0x4d')](_0x3ee106[_0x53d5('0x39')],_0x3ee106[_0x53d5('0x37')]);_0x3d018c[_0x53d5('0x3b')]=_[_0x53d5('0x4d')](_0x3ee106[_0x53d5('0x39')],qs['fields'](_0xae35d2[_0x53d5('0x37')][_0x53d5('0x3a')]));_0x3d018c[_0x53d5('0x3b')]=_0x3d018c[_0x53d5('0x3b')][_0x53d5('0x4e')]?_0x3d018c[_0x53d5('0x3b')]:_0x3ee106[_0x53d5('0x39')];if(_0xae35d2[_0x53d5('0x37')]['includeAll']){_0x3d018c['include']=[{'all':!![]}];}_0x3d018c=_[_0x53d5('0x42')]({},_0x3d018c,_0xae35d2[_0x53d5('0x45')]);return db[_0x53d5('0x32')]['find'](_0x3d018c)[_0x53d5('0x2b')](handleEntityNotFound(_0x5d2fe9,null))['then'](respondWithResult(_0x5d2fe9,null))[_0x53d5('0x4a')](handleError(_0x5d2fe9,null));};exports[_0x53d5('0x4f')]=function(_0x10b463,_0x52a222){return db[_0x53d5('0x32')][_0x53d5('0x4f')](_0x10b463[_0x53d5('0x50')],{})[_0x53d5('0x2b')](respondWithResult(_0x52a222,0xc9))['catch'](handleError(_0x52a222,null));};exports[_0x53d5('0x2a')]=function(_0x2988e1,_0x50835c){if(_0x2988e1[_0x53d5('0x50')]['id']){delete _0x2988e1['body']['id'];}return db[_0x53d5('0x32')][_0x53d5('0x51')]({'where':{'id':_0x2988e1[_0x53d5('0x4c')]['id']}})['then'](handleEntityNotFound(_0x50835c,null))[_0x53d5('0x2b')](saveUpdates(_0x2988e1[_0x53d5('0x50')],null))[_0x53d5('0x2b')](respondWithResult(_0x50835c,null))[_0x53d5('0x4a')](handleError(_0x50835c,null));};exports['destroy']=function(_0x233f70,_0x411356){return db[_0x53d5('0x32')][_0x53d5('0x51')]({'where':{'id':_0x233f70['params']['id']}})[_0x53d5('0x2b')](handleEntityNotFound(_0x411356,null))[_0x53d5('0x2b')](removeEntity(_0x411356,null))[_0x53d5('0x4a')](handleError(_0x411356,null));};exports['describe']=function(_0x452255,_0x5d3e7b){return db[_0x53d5('0x32')]['describe']()['then'](respondWithResult(_0x5d3e7b,null))[_0x53d5('0x4a')](handleError(_0x5d3e7b,null));};exports[_0x53d5('0x52')]=function(_0x154df8,_0x41f828){var _0x343c9c={},_0x42ad82={},_0x52366d={'count':0x0,'rows':[]};_0x42ad82[_0x53d5('0x39')]=_[_0x53d5('0x36')](db['VoiceQueueReport'][_0x53d5('0x33')]);_0x42ad82[_0x53d5('0x37')]=_['keys'](_0x154df8[_0x53d5('0x37')]);_0x42ad82[_0x53d5('0x38')]=_[_0x53d5('0x4d')](_0x42ad82['model'],_0x42ad82[_0x53d5('0x37')]);_0x343c9c[_0x53d5('0x3b')]=_['intersection'](_0x42ad82[_0x53d5('0x39')],qs[_0x53d5('0x3a')](_0x154df8[_0x53d5('0x37')][_0x53d5('0x3a')]));_0x343c9c[_0x53d5('0x3b')]=_0x343c9c['attributes']['length']?_0x343c9c['attributes']:_0x42ad82[_0x53d5('0x39')];if(!_0x154df8[_0x53d5('0x37')][_0x53d5('0x3c')]('nolimit')){_0x343c9c[_0x53d5('0x22')]=qs[_0x53d5('0x22')](_0x154df8[_0x53d5('0x37')]['limit']);_0x343c9c[_0x53d5('0x21')]=qs['offset'](_0x154df8[_0x53d5('0x37')]['offset']);}_0x343c9c[_0x53d5('0x3e')]=qs[_0x53d5('0x3f')](_0x154df8[_0x53d5('0x37')][_0x53d5('0x3f')]);_0x343c9c[_0x53d5('0x40')]=qs[_0x53d5('0x38')](_[_0x53d5('0x41')](_0x154df8[_0x53d5('0x37')],_0x42ad82['filters']));if(_0x154df8[_0x53d5('0x37')][_0x53d5('0x44')]){_0x343c9c['where']=_[_0x53d5('0x42')](_0x343c9c[_0x53d5('0x40')],{'$or':_[_0x53d5('0x31')](_0x343c9c['attributes'],function(_0x31d381){var _0x3719e3={};_0x3719e3[_0x31d381]={'$like':'%'+_0x154df8[_0x53d5('0x37')]['filter']+'%'};return _0x3719e3;})});}_0x343c9c=_[_0x53d5('0x42')]({},_0x343c9c,_0x154df8['options']);var _0x21fdc9={'where':_0x343c9c[_0x53d5('0x40')]};return db['VoiceQueueReport'][_0x53d5('0x24')](_0x21fdc9)[_0x53d5('0x2b')](function(_0x58d229){_0x52366d['count']=_0x58d229;if(_0x154df8[_0x53d5('0x37')][_0x53d5('0x46')]){_0x343c9c[_0x53d5('0x47')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x53d5('0x48')](_0x343c9c);})['then'](function(_0x37610c){_0x52366d[_0x53d5('0x49')]=_0x37610c;return _0x52366d;})[_0x53d5('0x2b')](respondWithFilteredResult(_0x41f828,_0x343c9c,_0x53d5('0x52')))[_0x53d5('0x4a')](handleError(_0x41f828,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0x4bc6=['socket.io-emitter','./voiceQueueReport.socket','status','end','offset','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','fieldName','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','filters','pick','filter','merge','type','VIRTUAL','options','where','includeAll','include','findAll','rows','show','params','VoiceQueueReport','rawAttributes','length','catch','create','body','find','describe','getVoiceQueuesReport','sort','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost'];(function(_0x276d10,_0x435d5f){var _0x56f291=function(_0x168ddb){while(--_0x168ddb){_0x276d10['push'](_0x276d10['shift']());}};_0x56f291(++_0x435d5f);}(_0x4bc6,0x90));var _0x64bc=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x4bc6[_0x36884e];return _0x1cc367;};'use strict';var emlformat=require(_0x64bc('0x0'));var rimraf=require(_0x64bc('0x1'));var zipdir=require(_0x64bc('0x2'));var jsonpatch=require(_0x64bc('0x3'));var rp=require(_0x64bc('0x4'));var moment=require(_0x64bc('0x5'));var BPromise=require(_0x64bc('0x6'));var Mustache=require('mustache');var util=require(_0x64bc('0x7'));var path=require(_0x64bc('0x8'));var sox=require(_0x64bc('0x9'));var csv=require(_0x64bc('0xa'));var ejs=require(_0x64bc('0xb'));var fs=require('fs');var fs_extra=require(_0x64bc('0xc'));var _=require('lodash');var squel=require(_0x64bc('0xd'));var crypto=require(_0x64bc('0xe'));var jsforce=require(_0x64bc('0xf'));var deskjs=require(_0x64bc('0x10'));var toCsv=require(_0x64bc('0xa'));var querystring=require(_0x64bc('0x11'));var Papa=require(_0x64bc('0x12'));var Redis=require('ioredis');var authService=require(_0x64bc('0x13'));var qs=require(_0x64bc('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x64bc('0x15'));var logger=require(_0x64bc('0x16'))(_0x64bc('0x17'));var utils=require('../../config/utils');var config=require(_0x64bc('0x18'));var licenseUtil=require(_0x64bc('0x19'));var db=require(_0x64bc('0x1a'))['db'];config[_0x64bc('0x1b')]=_[_0x64bc('0x1c')](config[_0x64bc('0x1b')],{'host':_0x64bc('0x1d'),'port':0x18eb});var socket=require(_0x64bc('0x1e'))(new Redis(config['redis']));require(_0x64bc('0x1f'))['register'](socket);function respondWithStatusCode(_0x138026,_0x2b6d44){_0x2b6d44=_0x2b6d44||0xcc;return function(_0x12da2f){if(_0x12da2f){return _0x138026['sendStatus'](_0x2b6d44);}return _0x138026[_0x64bc('0x20')](_0x2b6d44)[_0x64bc('0x21')]();};}function respondWithResult(_0x2b11e3,_0x48bacf){_0x48bacf=_0x48bacf||0xc8;return function(_0x3f4741){if(_0x3f4741){return _0x2b11e3['status'](_0x48bacf)['json'](_0x3f4741);}};}function respondWithFilteredResult(_0x529ae2,_0x317157){return function(_0x1474c7){if(_0x1474c7){var _0x497c95=typeof _0x317157[_0x64bc('0x22')]==='undefined'&&typeof _0x317157['limit']==='undefined';var _0x4a5924=_0x1474c7[_0x64bc('0x23')];var _0x38c13b=_0x497c95?0x0:_0x317157[_0x64bc('0x22')];var _0x143d3d=_0x497c95?_0x1474c7[_0x64bc('0x23')]:_0x317157[_0x64bc('0x22')]+_0x317157[_0x64bc('0x24')];var _0x54f577;if(_0x143d3d>=_0x4a5924){_0x143d3d=_0x4a5924;_0x54f577=0xc8;}else{_0x54f577=0xce;}_0x529ae2['status'](_0x54f577);return _0x529ae2[_0x64bc('0x25')](_0x64bc('0x26'),_0x38c13b+'-'+_0x143d3d+'/'+_0x4a5924)[_0x64bc('0x27')](_0x1474c7);}return null;};}function patchUpdates(_0x2488e0){return function(_0x1810cb){try{jsonpatch[_0x64bc('0x28')](_0x1810cb,_0x2488e0,!![]);}catch(_0x3d1b18){return BPromise[_0x64bc('0x29')](_0x3d1b18);}return _0x1810cb[_0x64bc('0x2a')]();};}function saveUpdates(_0x3f3933,_0xcced13){return function(_0x4a576a){if(_0x4a576a){return _0x4a576a[_0x64bc('0x2b')](_0x3f3933)[_0x64bc('0x2c')](function(_0xdcc50){return _0xdcc50;});}return null;};}function removeEntity(_0x33b15a,_0x42c2cb){return function(_0x4542b6){if(_0x4542b6){return _0x4542b6[_0x64bc('0x2d')]()['then'](function(){_0x33b15a[_0x64bc('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fe7d7,_0x2a4b5a){return function(_0x4e78e8){if(!_0x4e78e8){_0x1fe7d7[_0x64bc('0x2e')](0x194);}return _0x4e78e8;};}function handleError(_0x4d5e02,_0x325732){_0x325732=_0x325732||0x1f4;return function(_0x684223){logger[_0x64bc('0x2f')](_0x684223[_0x64bc('0x30')]);if(_0x684223[_0x64bc('0x31')]){delete _0x684223[_0x64bc('0x31')];}_0x4d5e02[_0x64bc('0x20')](_0x325732)[_0x64bc('0x32')](_0x684223);};}exports[_0x64bc('0x33')]=function(_0x67fe2b,_0x31b2f7){var _0x3d08a2={},_0x1cd11b={},_0x30d3df={'count':0x0,'rows':[]};var _0x279675=_[_0x64bc('0x34')](db['VoiceQueueReport']['rawAttributes'],function(_0x17104b){return{'name':_0x17104b[_0x64bc('0x35')],'type':_0x17104b['type']['key']};});_0x1cd11b[_0x64bc('0x36')]=_['map'](_0x279675,_0x64bc('0x31'));_0x1cd11b[_0x64bc('0x37')]=_[_0x64bc('0x38')](_0x67fe2b[_0x64bc('0x37')]);_0x1cd11b['filters']=_[_0x64bc('0x39')](_0x1cd11b[_0x64bc('0x36')],_0x1cd11b['query']);_0x3d08a2[_0x64bc('0x3a')]=_[_0x64bc('0x39')](_0x1cd11b[_0x64bc('0x36')],qs['fields'](_0x67fe2b['query'][_0x64bc('0x3b')]));_0x3d08a2[_0x64bc('0x3a')]=_0x3d08a2['attributes']['length']?_0x3d08a2[_0x64bc('0x3a')]:_0x1cd11b[_0x64bc('0x36')];if(!_0x67fe2b[_0x64bc('0x37')][_0x64bc('0x3c')](_0x64bc('0x3d'))){_0x3d08a2['limit']=qs['limit'](_0x67fe2b[_0x64bc('0x37')][_0x64bc('0x24')]);_0x3d08a2['offset']=qs[_0x64bc('0x22')](_0x67fe2b[_0x64bc('0x37')]['offset']);}_0x3d08a2[_0x64bc('0x3e')]=qs['sort'](_0x67fe2b[_0x64bc('0x37')]['sort']);_0x3d08a2['where']=qs[_0x64bc('0x3f')](_[_0x64bc('0x40')](_0x67fe2b[_0x64bc('0x37')],_0x1cd11b[_0x64bc('0x3f')]),_0x279675);if(_0x67fe2b[_0x64bc('0x37')][_0x64bc('0x41')]){_0x3d08a2['where']=_[_0x64bc('0x42')](_0x3d08a2['where'],{'$or':_[_0x64bc('0x34')](_0x279675,function(_0xfe7c0){if(_0xfe7c0[_0x64bc('0x43')]!==_0x64bc('0x44')){var _0x51525c={};_0x51525c[_0xfe7c0[_0x64bc('0x31')]]={'$like':'%'+_0x67fe2b[_0x64bc('0x37')]['filter']+'%'};return _0x51525c;}})});}_0x3d08a2=_[_0x64bc('0x42')]({},_0x3d08a2,_0x67fe2b[_0x64bc('0x45')]);var _0x1b1e5b={'where':_0x3d08a2[_0x64bc('0x46')]};return db['VoiceQueueReport'][_0x64bc('0x23')](_0x1b1e5b)[_0x64bc('0x2c')](function(_0x53509a){_0x30d3df[_0x64bc('0x23')]=_0x53509a;if(_0x67fe2b['query'][_0x64bc('0x47')]){_0x3d08a2[_0x64bc('0x48')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x64bc('0x49')](_0x3d08a2);})['then'](function(_0x3c6dc8){_0x30d3df[_0x64bc('0x4a')]=_0x3c6dc8;return _0x30d3df;})[_0x64bc('0x2c')](respondWithFilteredResult(_0x31b2f7,_0x3d08a2))['catch'](handleError(_0x31b2f7,null));};exports[_0x64bc('0x4b')]=function(_0x437ab6,_0x4b4652){var _0x2da1ed={'raw':![],'where':{'id':_0x437ab6[_0x64bc('0x4c')]['id']}},_0x3b9002={};_0x3b9002[_0x64bc('0x36')]=_[_0x64bc('0x38')](db[_0x64bc('0x4d')][_0x64bc('0x4e')]);_0x3b9002[_0x64bc('0x37')]=_[_0x64bc('0x38')](_0x437ab6['query']);_0x3b9002['filters']=_['intersection'](_0x3b9002[_0x64bc('0x36')],_0x3b9002[_0x64bc('0x37')]);_0x2da1ed[_0x64bc('0x3a')]=_[_0x64bc('0x39')](_0x3b9002['model'],qs[_0x64bc('0x3b')](_0x437ab6[_0x64bc('0x37')][_0x64bc('0x3b')]));_0x2da1ed[_0x64bc('0x3a')]=_0x2da1ed[_0x64bc('0x3a')][_0x64bc('0x4f')]?_0x2da1ed[_0x64bc('0x3a')]:_0x3b9002['model'];if(_0x437ab6['query'][_0x64bc('0x47')]){_0x2da1ed[_0x64bc('0x48')]=[{'all':!![]}];}_0x2da1ed=_['merge']({},_0x2da1ed,_0x437ab6['options']);return db['VoiceQueueReport']['find'](_0x2da1ed)['then'](handleEntityNotFound(_0x4b4652,null))[_0x64bc('0x2c')](respondWithResult(_0x4b4652,null))[_0x64bc('0x50')](handleError(_0x4b4652,null));};exports['create']=function(_0x4eee16,_0xc9eb02){return db[_0x64bc('0x4d')][_0x64bc('0x51')](_0x4eee16[_0x64bc('0x52')],{})['then'](respondWithResult(_0xc9eb02,0xc9))[_0x64bc('0x50')](handleError(_0xc9eb02,null));};exports[_0x64bc('0x2b')]=function(_0x4c38ca,_0x5792a7){if(_0x4c38ca['body']['id']){delete _0x4c38ca[_0x64bc('0x52')]['id'];}return db[_0x64bc('0x4d')][_0x64bc('0x53')]({'where':{'id':_0x4c38ca[_0x64bc('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5792a7,null))[_0x64bc('0x2c')](saveUpdates(_0x4c38ca['body'],null))['then'](respondWithResult(_0x5792a7,null))[_0x64bc('0x50')](handleError(_0x5792a7,null));};exports[_0x64bc('0x2d')]=function(_0x4c59a8,_0x1f8216){return db['VoiceQueueReport']['find']({'where':{'id':_0x4c59a8[_0x64bc('0x4c')]['id']}})[_0x64bc('0x2c')](handleEntityNotFound(_0x1f8216,null))[_0x64bc('0x2c')](removeEntity(_0x1f8216,null))[_0x64bc('0x50')](handleError(_0x1f8216,null));};exports['describe']=function(_0x27626a,_0x53cc4a){return db[_0x64bc('0x4d')][_0x64bc('0x54')]()['then'](respondWithResult(_0x53cc4a,null))[_0x64bc('0x50')](handleError(_0x53cc4a,null));};exports[_0x64bc('0x55')]=function(_0x2dc3ff,_0x44a12f){var _0x5d94ca={},_0x49521a={},_0x5f101d={'count':0x0,'rows':[]};_0x49521a[_0x64bc('0x36')]=_['keys'](db[_0x64bc('0x4d')][_0x64bc('0x4e')]);_0x49521a[_0x64bc('0x37')]=_[_0x64bc('0x38')](_0x2dc3ff[_0x64bc('0x37')]);_0x49521a['filters']=_[_0x64bc('0x39')](_0x49521a[_0x64bc('0x36')],_0x49521a[_0x64bc('0x37')]);_0x5d94ca[_0x64bc('0x3a')]=_[_0x64bc('0x39')](_0x49521a[_0x64bc('0x36')],qs[_0x64bc('0x3b')](_0x2dc3ff[_0x64bc('0x37')]['fields']));_0x5d94ca[_0x64bc('0x3a')]=_0x5d94ca['attributes'][_0x64bc('0x4f')]?_0x5d94ca[_0x64bc('0x3a')]:_0x49521a[_0x64bc('0x36')];if(!_0x2dc3ff['query'][_0x64bc('0x3c')]('nolimit')){_0x5d94ca[_0x64bc('0x24')]=qs[_0x64bc('0x24')](_0x2dc3ff[_0x64bc('0x37')][_0x64bc('0x24')]);_0x5d94ca[_0x64bc('0x22')]=qs['offset'](_0x2dc3ff['query'][_0x64bc('0x22')]);}_0x5d94ca[_0x64bc('0x3e')]=qs[_0x64bc('0x56')](_0x2dc3ff[_0x64bc('0x37')][_0x64bc('0x56')]);_0x5d94ca[_0x64bc('0x46')]=qs[_0x64bc('0x3f')](_[_0x64bc('0x40')](_0x2dc3ff[_0x64bc('0x37')],_0x49521a['filters']));if(_0x2dc3ff['query']['filter']){_0x5d94ca[_0x64bc('0x46')]=_[_0x64bc('0x42')](_0x5d94ca[_0x64bc('0x46')],{'$or':_[_0x64bc('0x34')](_0x5d94ca[_0x64bc('0x3a')],function(_0x39e3e5){var _0x15c0f0={};_0x15c0f0[_0x39e3e5]={'$like':'%'+_0x2dc3ff[_0x64bc('0x37')]['filter']+'%'};return _0x15c0f0;})});}_0x5d94ca=_['merge']({},_0x5d94ca,_0x2dc3ff['options']);var _0x1f9442={'where':_0x5d94ca[_0x64bc('0x46')]};return db['VoiceQueueReport'][_0x64bc('0x23')](_0x1f9442)['then'](function(_0x3ea58d){_0x5f101d[_0x64bc('0x23')]=_0x3ea58d;if(_0x2dc3ff['query'][_0x64bc('0x47')]){_0x5d94ca[_0x64bc('0x48')]=[{'all':!![]}];}return db[_0x64bc('0x4d')][_0x64bc('0x49')](_0x5d94ca);})[_0x64bc('0x2c')](function(_0x507bb7){_0x5f101d[_0x64bc('0x4a')]=_0x507bb7;return _0x5f101d;})[_0x64bc('0x2c')](respondWithFilteredResult(_0x44a12f,_0x5d94ca,_0x64bc('0x55')))[_0x64bc('0x50')](handleError(_0x44a12f,null,_0x64bc('0x55')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 8db70de..325596c 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 _0x224f=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','VoiceQueueReport'];(function(_0x1accf6,_0x4a9854){var _0x24e446=function(_0x487f51){while(--_0x487f51){_0x1accf6['push'](_0x1accf6['shift']());}};_0x24e446(++_0x4a9854);}(_0x224f,0x129));var _0xf224=function(_0x557fd2,_0x2c0a7a){_0x557fd2=_0x557fd2-0x0;var _0x1b54a2=_0x224f[_0x557fd2];return _0x1b54a2;};'use strict';var EventEmitter=require(_0xf224('0x0'));var VoiceQueueReport=require(_0xf224('0x1'))['db'][_0xf224('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xf224('0x3')](0x0);var events={'afterCreate':_0xf224('0x4'),'afterUpdate':_0xf224('0x5'),'afterDestroy':_0xf224('0x6')};function emitEvent(_0x1b6746){return function(_0x1341e,_0x1f7311,_0x1c3fb6){VoiceQueueReportEvents[_0xf224('0x7')](_0x1b6746+':'+_0x1341e['id'],_0x1341e);VoiceQueueReportEvents[_0xf224('0x7')](_0x1b6746,_0x1341e);_0x1c3fb6(null);};}for(var e in events){if(events[_0xf224('0x8')](e)){var event=events[e];VoiceQueueReport[_0xf224('0x9')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0x1568=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners','update'];(function(_0x546f7d,_0x112c08){var _0x181922=function(_0x475921){while(--_0x475921){_0x546f7d['push'](_0x546f7d['shift']());}};_0x181922(++_0x112c08);}(_0x1568,0x163));var _0x8156=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1568[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x8156('0x0'));var VoiceQueueReport=require(_0x8156('0x1'))['db'][_0x8156('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x8156('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8156('0x4'),'afterDestroy':'remove'};function emitEvent(_0x488a3e){return function(_0x5240d5,_0x47b301,_0x52444e){VoiceQueueReportEvents[_0x8156('0x5')](_0x488a3e+':'+_0x5240d5['id'],_0x5240d5);VoiceQueueReportEvents[_0x8156('0x5')](_0x488a3e,_0x5240d5);_0x52444e(null);};}for(var e in events){if(events[_0x8156('0x6')](e)){var event=events[e];VoiceQueueReport[_0x8156('0x7')](e,emitEvent(event));}}module[_0x8156('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 53306ae..cd7868d 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 _0x4848=['uniqueid','calleridnum','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','VoiceQueueReport'];(function(_0x12ad0f,_0x46f8f2){var _0x3b0fb9=function(_0x571b0c){while(--_0x571b0c){_0x12ad0f['push'](_0x12ad0f['shift']());}};_0x3b0fb9(++_0x46f8f2);}(_0x4848,0x195));var _0x8484=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x4848[_0x4fbfd9];return _0x31dc94;};'use strict';var _=require(_0x8484('0x0'));var util=require(_0x8484('0x1'));var logger=require(_0x8484('0x2'))(_0x8484('0x3'));var moment=require(_0x8484('0x4'));var BPromise=require('bluebird');var rp=require(_0x8484('0x5'));var fs=require('fs');var path=require(_0x8484('0x6'));var rimraf=require(_0x8484('0x7'));var config=require(_0x8484('0x8'));var attributes=require('./voiceQueueReport.attributes');module[_0x8484('0x9')]=function(_0x5f2d38,_0x27fab7){return _0x5f2d38['define'](_0x8484('0xa'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x8484('0xb')]},{'fields':[_0x8484('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0d9e=['uniqueid','calleridnum','lodash','api','bluebird','request-promise','path','rimraf','exports','define','VoiceQueueReport'];(function(_0x1deb72,_0x3f6338){var _0x18bbdf=function(_0x1b4b9b){while(--_0x1b4b9b){_0x1deb72['push'](_0x1deb72['shift']());}};_0x18bbdf(++_0x3f6338);}(_0x0d9e,0x18e));var _0xe0d9=function(_0x4c7dff,_0x1dc2ec){_0x4c7dff=_0x4c7dff-0x0;var _0x2fb3de=_0x0d9e[_0x4c7dff];return _0x2fb3de;};'use strict';var _=require(_0xe0d9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe0d9('0x1'));var moment=require('moment');var BPromise=require(_0xe0d9('0x2'));var rp=require(_0xe0d9('0x3'));var fs=require('fs');var path=require(_0xe0d9('0x4'));var rimraf=require(_0xe0d9('0x5'));var config=require('../../config/environment');var attributes=require('./voiceQueueReport.attributes');module[_0xe0d9('0x6')]=function(_0x4f02db,_0x33ff26){return _0x4f02db[_0xe0d9('0x7')](_0xe0d9('0x8'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0xe0d9('0x9')]},{'fields':[_0xe0d9('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index bc02a00..c37186e 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 _0x0b7a=['../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','then','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','where','include','map','model','attributes','CreateVoiceQueueReport','create','UpdateVoiceQueueReport','update','body','raw','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x57dacc,_0x4f7511){var _0xce9ecc=function(_0x26df7a){while(--_0x26df7a){_0x57dacc['push'](_0x57dacc['shift']());}};_0xce9ecc(++_0x4f7511);}(_0x0b7a,0x81));var _0xa0b7=function(_0x3612d9,_0x377ebb){_0x3612d9=_0x3612d9-0x0;var _0xe3f806=_0x0b7a[_0x3612d9];return _0xe3f806;};'use strict';var _=require(_0xa0b7('0x0'));var util=require(_0xa0b7('0x1'));var moment=require(_0xa0b7('0x2'));var BPromise=require('bluebird');var rs=require(_0xa0b7('0x3'));var fs=require('fs');var Redis=require(_0xa0b7('0x4'));var db=require(_0xa0b7('0x5'))['db'];var utils=require(_0xa0b7('0x6'));var logger=require('../../config/logger')(_0xa0b7('0x7'));var config=require(_0xa0b7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa0b7('0x9')][_0xa0b7('0xa')]({'port':0x232a});config[_0xa0b7('0xb')]=_[_0xa0b7('0xc')](config['redis'],{'host':_0xa0b7('0xd'),'port':0x18eb});var socket=require(_0xa0b7('0xe'))(new Redis(config[_0xa0b7('0xb')]));require(_0xa0b7('0xf'))[_0xa0b7('0x10')](socket);function respondWithRpcPromise(_0x3d89dd,_0x3559db,_0x3dcaf6){return new BPromise(function(_0x3158f7,_0x1bf6bf){return client['request'](_0x3d89dd,_0x3dcaf6)[_0xa0b7('0x11')](function(_0x4f5d62){logger['info'](_0xa0b7('0x12'),_0x3559db,'request\x20sent');logger[_0xa0b7('0x13')](_0xa0b7('0x14'),_0x3559db,_0xa0b7('0x15'),JSON[_0xa0b7('0x16')](_0x4f5d62));if(_0x4f5d62[_0xa0b7('0x17')]){if(_0x4f5d62[_0xa0b7('0x17')][_0xa0b7('0x18')]===0x1f4){logger[_0xa0b7('0x17')](_0xa0b7('0x12'),_0x3559db,_0x4f5d62[_0xa0b7('0x17')]['message']);return _0x1bf6bf(_0x4f5d62[_0xa0b7('0x17')][_0xa0b7('0x19')]);}logger[_0xa0b7('0x17')](_0xa0b7('0x12'),_0x3559db,_0x4f5d62[_0xa0b7('0x17')][_0xa0b7('0x19')]);return _0x3158f7(_0x4f5d62['error'][_0xa0b7('0x19')]);}else{logger[_0xa0b7('0x1a')]('VoiceQueueReport,\x20%s,\x20%s',_0x3559db,'request\x20sent');_0x3158f7(_0x4f5d62[_0xa0b7('0x1b')]['message']);}})[_0xa0b7('0x1c')](function(_0x31193b){logger[_0xa0b7('0x17')](_0xa0b7('0x12'),_0x3559db,_0x31193b);_0x1bf6bf(_0x31193b);});});}exports[_0xa0b7('0x1d')]=function(_0x2ba57b){var _0x80a673=this;return new Promise(function(_0x15615b,_0x3e8b13){return db[_0xa0b7('0x1e')][_0xa0b7('0x1f')]({'raw':_0x2ba57b[_0xa0b7('0x20')]?_0x2ba57b[_0xa0b7('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x2ba57b[_0xa0b7('0x20')]?_0x2ba57b[_0xa0b7('0x20')][_0xa0b7('0x21')]||null:null,'attributes':_0x2ba57b[_0xa0b7('0x20')]?_0x2ba57b[_0xa0b7('0x20')]['attributes']||null:null,'limit':_0x2ba57b[_0xa0b7('0x20')]?_0x2ba57b['options']['limit']||null:null,'include':_0x2ba57b[_0xa0b7('0x20')]?_0x2ba57b[_0xa0b7('0x20')][_0xa0b7('0x22')]?_[_0xa0b7('0x23')](_0x2ba57b[_0xa0b7('0x20')][_0xa0b7('0x22')],function(_0x332b6a){return{'model':db[_0x332b6a[_0xa0b7('0x24')]],'as':_0x332b6a['as'],'attributes':_0x332b6a['attributes'],'include':_0x332b6a[_0xa0b7('0x22')]?_['map'](_0x332b6a[_0xa0b7('0x22')],function(_0xb19c4b){return{'model':db[_0xb19c4b[_0xa0b7('0x24')]],'as':_0xb19c4b['as'],'attributes':_0xb19c4b[_0xa0b7('0x25')],'include':_0xb19c4b['include']?_['map'](_0xb19c4b['include'],function(_0x2bf1ae){return{'model':db[_0x2bf1ae[_0xa0b7('0x24')]],'as':_0x2bf1ae['as'],'attributes':_0x2bf1ae[_0xa0b7('0x25')]};}):[]};}):[]};}):[]:[]})[_0xa0b7('0x11')](function(_0x4fb315){logger[_0xa0b7('0x1a')](_0xa0b7('0x1d'),_0x2ba57b);logger[_0xa0b7('0x13')](_0xa0b7('0x1d'),_0x2ba57b,JSON['stringify'](_0x4fb315));_0x15615b(_0x4fb315);})['catch'](function(_0x429077){logger[_0xa0b7('0x17')](_0xa0b7('0x1d'),_0x429077['message'],_0x2ba57b);_0x3e8b13(_0x80a673['error'](0x1f4,_0x429077[_0xa0b7('0x19')]));});});};exports[_0xa0b7('0x26')]=function(_0x40507c){var _0x3e3331=this;return new Promise(function(_0x597b25,_0x36839b){return db[_0xa0b7('0x1e')][_0xa0b7('0x27')](_0x40507c['body'],{'raw':_0x40507c[_0xa0b7('0x20')]?_0x40507c[_0xa0b7('0x20')]['raw']===undefined?!![]:![]:!![]})[_0xa0b7('0x11')](function(_0x44f797){logger[_0xa0b7('0x1a')](_0xa0b7('0x26'),_0x40507c);logger[_0xa0b7('0x13')](_0xa0b7('0x26'),_0x40507c,JSON[_0xa0b7('0x16')](_0x44f797));_0x597b25(_0x44f797);})[_0xa0b7('0x1c')](function(_0xa19770){logger[_0xa0b7('0x17')](_0xa0b7('0x26'),_0xa19770[_0xa0b7('0x19')],_0x40507c);_0x36839b(_0x3e3331['error'](0x1f4,_0xa19770[_0xa0b7('0x19')]));});});};exports[_0xa0b7('0x28')]=function(_0x38cc03){var _0x475426=this;return new Promise(function(_0x576c93,_0x4ca201){return db[_0xa0b7('0x1e')][_0xa0b7('0x29')](_0x38cc03[_0xa0b7('0x2a')],{'raw':_0x38cc03['options']?_0x38cc03[_0xa0b7('0x20')][_0xa0b7('0x2b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38cc03[_0xa0b7('0x20')]?_0x38cc03[_0xa0b7('0x20')][_0xa0b7('0x21')]||null:null,'attributes':_0x38cc03[_0xa0b7('0x20')]?_0x38cc03['options']['attributes']||null:null,'limit':_0x38cc03[_0xa0b7('0x20')]?_0x38cc03[_0xa0b7('0x20')][_0xa0b7('0x2c')]||null:null})[_0xa0b7('0x11')](function(_0x4dedff){logger['info'](_0xa0b7('0x28'),_0x38cc03);logger[_0xa0b7('0x13')]('UpdateVoiceQueueReport',_0x38cc03,JSON[_0xa0b7('0x16')](_0x4dedff));_0x576c93(_0x4dedff);})[_0xa0b7('0x1c')](function(_0x5c3553){logger['error'](_0xa0b7('0x28'),_0x5c3553['message'],_0x38cc03);_0x4ca201(_0x475426[_0xa0b7('0x17')](0x1f4,_0x5c3553['message']));});});}; \ No newline at end of file +var _0xc43e=['create','body','raw','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','limit','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','attributes','include','map','model','GetVoiceQueueReport','VoiceQueueReport'];(function(_0x54021e,_0xd4e9ae){var _0x15fd8b=function(_0x4adb12){while(--_0x4adb12){_0x54021e['push'](_0x54021e['shift']());}};_0x15fd8b(++_0xd4e9ae);}(_0xc43e,0x13b));var _0xec43=function(_0x4b3edc,_0x53582f){_0x4b3edc=_0x4b3edc-0x0;var _0x319422=_0xc43e[_0x4b3edc];return _0x319422;};'use strict';var _=require(_0xec43('0x0'));var util=require(_0xec43('0x1'));var moment=require(_0xec43('0x2'));var BPromise=require(_0xec43('0x3'));var rs=require(_0xec43('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xec43('0x5'));var logger=require(_0xec43('0x6'))(_0xec43('0x7'));var config=require(_0xec43('0x8'));var jayson=require(_0xec43('0x9'));var client=jayson['client'][_0xec43('0xa')]({'port':0x232a});config[_0xec43('0xb')]=_[_0xec43('0xc')](config[_0xec43('0xb')],{'host':_0xec43('0xd'),'port':0x18eb});var socket=require(_0xec43('0xe'))(new Redis(config['redis']));require(_0xec43('0xf'))[_0xec43('0x10')](socket);function respondWithRpcPromise(_0x3fe39c,_0x22effc,_0xcb59b7){return new BPromise(function(_0x540033,_0xd0c9d5){return client[_0xec43('0x11')](_0x3fe39c,_0xcb59b7)[_0xec43('0x12')](function(_0x44db4e){logger[_0xec43('0x13')]('VoiceQueueReport,\x20%s,\x20%s',_0x22effc,_0xec43('0x14'));logger[_0xec43('0x15')](_0xec43('0x16'),_0x22effc,_0xec43('0x14'),JSON[_0xec43('0x17')](_0x44db4e));if(_0x44db4e['error']){if(_0x44db4e[_0xec43('0x18')][_0xec43('0x19')]===0x1f4){logger[_0xec43('0x18')]('VoiceQueueReport,\x20%s,\x20%s',_0x22effc,_0x44db4e[_0xec43('0x18')][_0xec43('0x1a')]);return _0xd0c9d5(_0x44db4e[_0xec43('0x18')]['message']);}logger[_0xec43('0x18')]('VoiceQueueReport,\x20%s,\x20%s',_0x22effc,_0x44db4e['error']['message']);return _0x540033(_0x44db4e[_0xec43('0x18')]['message']);}else{logger[_0xec43('0x13')]('VoiceQueueReport,\x20%s,\x20%s',_0x22effc,_0xec43('0x14'));_0x540033(_0x44db4e[_0xec43('0x1b')]['message']);}})[_0xec43('0x1c')](function(_0x44f354){logger[_0xec43('0x18')]('VoiceQueueReport,\x20%s,\x20%s',_0x22effc,_0x44f354);_0xd0c9d5(_0x44f354);});});}exports['GetVoiceQueueReport']=function(_0x218574){var _0x211d35=this;return new Promise(function(_0x514a47,_0x4e1175){return db['VoiceQueueReport'][_0xec43('0x1d')]({'raw':_0x218574[_0xec43('0x1e')]?_0x218574[_0xec43('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x218574[_0xec43('0x1e')]?_0x218574['options']['where']||null:null,'attributes':_0x218574['options']?_0x218574[_0xec43('0x1e')][_0xec43('0x1f')]||null:null,'limit':_0x218574['options']?_0x218574[_0xec43('0x1e')]['limit']||null:null,'include':_0x218574[_0xec43('0x1e')]?_0x218574[_0xec43('0x1e')][_0xec43('0x20')]?_[_0xec43('0x21')](_0x218574['options'][_0xec43('0x20')],function(_0x112b7d){return{'model':db[_0x112b7d[_0xec43('0x22')]],'as':_0x112b7d['as'],'attributes':_0x112b7d[_0xec43('0x1f')],'include':_0x112b7d[_0xec43('0x20')]?_['map'](_0x112b7d[_0xec43('0x20')],function(_0x1516b7){return{'model':db[_0x1516b7[_0xec43('0x22')]],'as':_0x1516b7['as'],'attributes':_0x1516b7['attributes'],'include':_0x1516b7[_0xec43('0x20')]?_['map'](_0x1516b7[_0xec43('0x20')],function(_0x180636){return{'model':db[_0x180636['model']],'as':_0x180636['as'],'attributes':_0x180636['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x32938a){logger[_0xec43('0x13')]('GetVoiceQueueReport',_0x218574);logger[_0xec43('0x15')](_0xec43('0x23'),_0x218574,JSON[_0xec43('0x17')](_0x32938a));_0x514a47(_0x32938a);})[_0xec43('0x1c')](function(_0x13013d){logger[_0xec43('0x18')](_0xec43('0x23'),_0x13013d[_0xec43('0x1a')],_0x218574);_0x4e1175(_0x211d35[_0xec43('0x18')](0x1f4,_0x13013d['message']));});});};exports['CreateVoiceQueueReport']=function(_0x294515){var _0x57c521=this;return new Promise(function(_0x594885,_0x2a60ae){return db[_0xec43('0x24')][_0xec43('0x25')](_0x294515[_0xec43('0x26')],{'raw':_0x294515['options']?_0x294515[_0xec43('0x1e')][_0xec43('0x27')]===undefined?!![]:![]:!![]})['then'](function(_0x201649){logger['info']('CreateVoiceQueueReport',_0x294515);logger['debug'](_0xec43('0x28'),_0x294515,JSON[_0xec43('0x17')](_0x201649));_0x594885(_0x201649);})[_0xec43('0x1c')](function(_0x36d555){logger[_0xec43('0x18')]('CreateVoiceQueueReport',_0x36d555[_0xec43('0x1a')],_0x294515);_0x2a60ae(_0x57c521[_0xec43('0x18')](0x1f4,_0x36d555[_0xec43('0x1a')]));});});};exports[_0xec43('0x29')]=function(_0x39084b){var _0x8eba3=this;return new Promise(function(_0x529dc4,_0x632752){return db[_0xec43('0x24')][_0xec43('0x2a')](_0x39084b[_0xec43('0x26')],{'raw':_0x39084b[_0xec43('0x1e')]?_0x39084b['options'][_0xec43('0x27')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39084b[_0xec43('0x1e')]?_0x39084b[_0xec43('0x1e')]['where']||null:null,'attributes':_0x39084b[_0xec43('0x1e')]?_0x39084b['options'][_0xec43('0x1f')]||null:null,'limit':_0x39084b['options']?_0x39084b['options'][_0xec43('0x2b')]||null:null})[_0xec43('0x12')](function(_0x4e6e15){logger[_0xec43('0x13')]('UpdateVoiceQueueReport',_0x39084b);logger[_0xec43('0x15')](_0xec43('0x29'),_0x39084b,JSON[_0xec43('0x17')](_0x4e6e15));_0x529dc4(_0x4e6e15);})['catch'](function(_0x11b3e1){logger[_0xec43('0x18')]('UpdateVoiceQueueReport',_0x11b3e1[_0xec43('0x1a')],_0x39084b);_0x632752(_0x8eba3['error'](0x1f4,_0x11b3e1[_0xec43('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index a5f00c9..7be759c 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 _0x1cb9=['update','emit','removeListener','register','length','./voiceQueueReport.events','remove'];(function(_0x163040,_0x38a58c){var _0x364667=function(_0x3b104f){while(--_0x3b104f){_0x163040['push'](_0x163040['shift']());}};_0x364667(++_0x38a58c);}(_0x1cb9,0x14e));var _0x91cb=function(_0x3d17d5,_0x2cdb4b){_0x3d17d5=_0x3d17d5-0x0;var _0x2f9bb6=_0x1cb9[_0x3d17d5];return _0x2f9bb6;};'use strict';var VoiceQueueReportEvents=require(_0x91cb('0x0'));var events=['save',_0x91cb('0x1'),_0x91cb('0x2')];function createListener(_0x2b1894,_0x351bdb){return function(_0x57ea48){_0x351bdb[_0x91cb('0x3')](_0x2b1894,_0x57ea48);};}function removeListener(_0x2b7314,_0x5652cd){return function(){VoiceQueueReportEvents[_0x91cb('0x4')](_0x2b7314,_0x5652cd);};}exports[_0x91cb('0x5')]=function(_0x186dc3){for(var _0x28543e=0x0,_0x3b9d98=events[_0x91cb('0x6')];_0x28543e<_0x3b9d98;_0x28543e++){var _0x4c1f56=events[_0x28543e];var _0x15c517=createListener('voiceQueueReport:'+_0x4c1f56,_0x186dc3);VoiceQueueReportEvents['on'](_0x4c1f56,_0x15c517);}}; \ No newline at end of file +var _0xe105=['emit','removeListener','register','./voiceQueueReport.events'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0xe105,0xef));var _0x5e10=function(_0x5e1630,_0x2bdf70){_0x5e1630=_0x5e1630-0x0;var _0x459093=_0xe105[_0x5e1630];return _0x459093;};'use strict';var VoiceQueueReportEvents=require(_0x5e10('0x0'));var events=['save','remove','update'];function createListener(_0x52e261,_0x161ccb){return function(_0x40da8e){_0x161ccb[_0x5e10('0x1')](_0x52e261,_0x40da8e);};}function removeListener(_0x191ab2,_0x4d50ed){return function(){VoiceQueueReportEvents[_0x5e10('0x2')](_0x191ab2,_0x4d50ed);};}exports[_0x5e10('0x3')]=function(_0x4b8ff2){for(var _0x1f3fc6=0x0,_0x508131=events['length'];_0x1f3fc6<_0x508131;_0x1f3fc6++){var _0x375cbd=events[_0x1f3fc6];var _0x3e8317=createListener('voiceQueueReport:'+_0x375cbd,_0x4b8ff2);VoiceQueueReportEvents['on'](_0x375cbd,_0x3e8317);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 3ed11d0..c298e29 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 _0x4278=['show','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id'];(function(_0x2e3e94,_0x3d75cc){var _0x1deca2=function(_0x34d92a){while(--_0x34d92a){_0x2e3e94['push'](_0x2e3e94['shift']());}};_0x1deca2(++_0x3d75cc);}(_0x4278,0x18d));var _0x8427=function(_0x378a4f,_0x45aed6){_0x378a4f=_0x378a4f-0x0;var _0x2289cb=_0x4278[_0x378a4f];return _0x2289cb;};'use strict';var multer=require('multer');var util=require(_0x8427('0x0'));var path=require(_0x8427('0x1'));var timeout=require(_0x8427('0x2'));var express=require(_0x8427('0x3'));var router=express[_0x8427('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8427('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8427('0x6'));router[_0x8427('0x7')]('/',auth[_0x8427('0x8')](),controller[_0x8427('0x9')]);router['get'](_0x8427('0xa'),auth[_0x8427('0x8')](),controller[_0x8427('0xb')]);router['post']('/',auth[_0x8427('0x8')](),controller[_0x8427('0xc')]);router[_0x8427('0xd')](_0x8427('0xa'),auth[_0x8427('0x8')](),controller[_0x8427('0xe')]);router[_0x8427('0xf')](_0x8427('0xa'),auth[_0x8427('0x8')](),controller[_0x8427('0x10')]);module['exports']=router; \ No newline at end of file +var _0x3f2b=['multer','path','connect-timeout','express','fs-extra','../../components/auth/service','./voiceQueuesLog.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports'];(function(_0x5c51d7,_0x45a85d){var _0xf3b7e5=function(_0x1cc0ec){while(--_0x1cc0ec){_0x5c51d7['push'](_0x5c51d7['shift']());}};_0xf3b7e5(++_0x45a85d);}(_0x3f2b,0x72));var _0xb3f2=function(_0x556720,_0x1ab47d){_0x556720=_0x556720-0x0;var _0x1b576b=_0x3f2b[_0x556720];return _0x1b576b;};'use strict';var multer=require(_0xb3f2('0x0'));var util=require('util');var path=require(_0xb3f2('0x1'));var timeout=require(_0xb3f2('0x2'));var express=require(_0xb3f2('0x3'));var router=express['Router']();var fs_extra=require(_0xb3f2('0x4'));var auth=require(_0xb3f2('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb3f2('0x6'));router[_0xb3f2('0x7')]('/',auth[_0xb3f2('0x8')](),controller[_0xb3f2('0x9')]);router['get']('/:id',auth[_0xb3f2('0x8')](),controller[_0xb3f2('0xa')]);router[_0xb3f2('0xb')]('/',auth[_0xb3f2('0x8')](),controller[_0xb3f2('0xc')]);router[_0xb3f2('0xd')](_0xb3f2('0xe'),auth[_0xb3f2('0x8')](),controller[_0xb3f2('0xf')]);router[_0xb3f2('0x10')](_0xb3f2('0xe'),auth[_0xb3f2('0x8')](),controller[_0xb3f2('0x11')]);module[_0xb3f2('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index c2bedda..3379aeb 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 _0x184e=['format','sequelize','moment','exports','STRING'];(function(_0x119c38,_0xd4b3aa){var _0x5ba417=function(_0x56a66b){while(--_0x56a66b){_0x119c38['push'](_0x119c38['shift']());}};_0x5ba417(++_0xd4b3aa);}(_0x184e,0x1a0));var _0xe184=function(_0x2f3794,_0x3c3bec){_0x2f3794=_0x2f3794-0x0;var _0x1c9fbe=_0x184e[_0x2f3794];return _0x1c9fbe;};'use strict';var Sequelize=require(_0xe184('0x0'));var moment=require(_0xe184('0x1'));module[_0xe184('0x2')]={'time':{'type':Sequelize[_0xe184('0x3')]},'callid':{'type':Sequelize[_0xe184('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xe184('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xe184('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xe184('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xe184('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xe184('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xe184('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0xe184('0x4')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file +var _0x8b28=['sequelize','moment','exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1ebd9a,_0x376b9e){var _0x611d71=function(_0x5d0f8){while(--_0x5d0f8){_0x1ebd9a['push'](_0x1ebd9a['shift']());}};_0x611d71(++_0x376b9e);}(_0x8b28,0x15e));var _0x88b2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8b28[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x88b2('0x0'));var moment=require(_0x88b2('0x1'));module[_0x88b2('0x2')]={'time':{'type':Sequelize[_0x88b2('0x3')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x88b2('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x88b2('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x88b2('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x88b2('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x88b2('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x88b2('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x88b2('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x88b2('0x4')],'allowNull':![],'defaultValue':moment()[_0x88b2('0x5')](_0x88b2('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index ad97397..e9b827e 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 _0xbde4=['limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','map','VoiceQueuesLog','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','catch','show','params','filters','include','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','lodash','squel','crypto','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined'];(function(_0x38e202,_0x1fcf51){var _0x2bb32d=function(_0x488a85){while(--_0x488a85){_0x38e202['push'](_0x38e202['shift']());}};_0x2bb32d(++_0x1fcf51);}(_0xbde4,0x18a));var _0x4bde=function(_0x54340b,_0x439f0a){_0x54340b=_0x54340b-0x0;var _0x496ea4=_0xbde4[_0x54340b];return _0x496ea4;};'use strict';var emlformat=require(_0x4bde('0x0'));var rimraf=require(_0x4bde('0x1'));var zipdir=require(_0x4bde('0x2'));var jsonpatch=require(_0x4bde('0x3'));var rp=require(_0x4bde('0x4'));var moment=require(_0x4bde('0x5'));var BPromise=require(_0x4bde('0x6'));var Mustache=require(_0x4bde('0x7'));var util=require(_0x4bde('0x8'));var path=require(_0x4bde('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4bde('0xa'));var squel=require(_0x4bde('0xb'));var crypto=require(_0x4bde('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4bde('0xd'));var querystring=require(_0x4bde('0xe'));var Papa=require(_0x4bde('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4bde('0x10'));var as=require(_0x4bde('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4bde('0x12'))('api');var utils=require(_0x4bde('0x13'));var config=require(_0x4bde('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x4bde('0x15'))['db'];function respondWithStatusCode(_0x43b4ed,_0x2afa67){_0x2afa67=_0x2afa67||0xcc;return function(_0x2acad9){if(_0x2acad9){return _0x43b4ed['sendStatus'](_0x2afa67);}return _0x43b4ed[_0x4bde('0x16')](_0x2afa67)[_0x4bde('0x17')]();};}function respondWithResult(_0x5d8081,_0x329e2d){_0x329e2d=_0x329e2d||0xc8;return function(_0x1fa493){if(_0x1fa493){return _0x5d8081[_0x4bde('0x16')](_0x329e2d)['json'](_0x1fa493);}};}function respondWithFilteredResult(_0x41c043,_0x2c04b8){return function(_0x245718){if(_0x245718){var _0x1b6c80=typeof _0x2c04b8[_0x4bde('0x18')]===_0x4bde('0x19')&&typeof _0x2c04b8[_0x4bde('0x1a')]===_0x4bde('0x19');var _0x5f1029=_0x245718['count'];var _0x33e4d4=_0x1b6c80?0x0:_0x2c04b8['offset'];var _0x4712f3=_0x1b6c80?_0x245718[_0x4bde('0x1b')]:_0x2c04b8[_0x4bde('0x18')]+_0x2c04b8[_0x4bde('0x1a')];var _0x502833;if(_0x4712f3>=_0x5f1029){_0x4712f3=_0x5f1029;_0x502833=0xc8;}else{_0x502833=0xce;}_0x41c043[_0x4bde('0x16')](_0x502833);return _0x41c043[_0x4bde('0x1c')](_0x4bde('0x1d'),_0x33e4d4+'-'+_0x4712f3+'/'+_0x5f1029)['json'](_0x245718);}return null;};}function patchUpdates(_0x20e1bb){return function(_0x92848d){try{jsonpatch[_0x4bde('0x1e')](_0x92848d,_0x20e1bb,!![]);}catch(_0x30ef4e){return BPromise[_0x4bde('0x1f')](_0x30ef4e);}return _0x92848d[_0x4bde('0x20')]();};}function saveUpdates(_0x3e3f18,_0x3ca6f9){return function(_0x46f31f){if(_0x46f31f){return _0x46f31f[_0x4bde('0x21')](_0x3e3f18)[_0x4bde('0x22')](function(_0x709469){return _0x709469;});}return null;};}function removeEntity(_0x2dd52c,_0x19e015){return function(_0x3bcc61){if(_0x3bcc61){return _0x3bcc61['destroy']()[_0x4bde('0x22')](function(){_0x2dd52c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x412ef7,_0x4723f6){return function(_0x4c719f){if(!_0x4c719f){_0x412ef7['sendStatus'](0x194);}return _0x4c719f;};}function handleError(_0x2cb759,_0x1cd17d){_0x1cd17d=_0x1cd17d||0x1f4;return function(_0x43a5e1){logger[_0x4bde('0x23')](_0x43a5e1[_0x4bde('0x24')]);if(_0x43a5e1['name']){delete _0x43a5e1[_0x4bde('0x25')];}_0x2cb759[_0x4bde('0x16')](_0x1cd17d)['send'](_0x43a5e1);};}exports['index']=function(_0x29060c,_0x5607a1){var _0x5d1bd1={},_0x3148db={},_0x4578f6={'count':0x0,'rows':[]};var _0x3e80da=_[_0x4bde('0x26')](db[_0x4bde('0x27')]['rawAttributes'],function(_0x2b8fd1){return{'name':_0x2b8fd1[_0x4bde('0x28')],'type':_0x2b8fd1[_0x4bde('0x29')][_0x4bde('0x2a')]};});_0x3148db[_0x4bde('0x2b')]=_[_0x4bde('0x26')](_0x3e80da,_0x4bde('0x25'));_0x3148db[_0x4bde('0x2c')]=_[_0x4bde('0x2d')](_0x29060c[_0x4bde('0x2c')]);_0x3148db['filters']=_[_0x4bde('0x2e')](_0x3148db[_0x4bde('0x2b')],_0x3148db[_0x4bde('0x2c')]);_0x5d1bd1[_0x4bde('0x2f')]=_[_0x4bde('0x2e')](_0x3148db[_0x4bde('0x2b')],qs[_0x4bde('0x30')](_0x29060c[_0x4bde('0x2c')][_0x4bde('0x30')]));_0x5d1bd1['attributes']=_0x5d1bd1[_0x4bde('0x2f')][_0x4bde('0x31')]?_0x5d1bd1[_0x4bde('0x2f')]:_0x3148db[_0x4bde('0x2b')];if(!_0x29060c[_0x4bde('0x2c')][_0x4bde('0x32')](_0x4bde('0x33'))){_0x5d1bd1[_0x4bde('0x1a')]=qs['limit'](_0x29060c['query'][_0x4bde('0x1a')]);_0x5d1bd1[_0x4bde('0x18')]=qs[_0x4bde('0x18')](_0x29060c['query'][_0x4bde('0x18')]);}_0x5d1bd1['order']=qs[_0x4bde('0x34')](_0x29060c['query'][_0x4bde('0x34')]);_0x5d1bd1[_0x4bde('0x35')]=qs['filters'](_[_0x4bde('0x36')](_0x29060c[_0x4bde('0x2c')],_0x3148db['filters']),_0x3e80da);if(_0x29060c['query']['filter']){_0x5d1bd1[_0x4bde('0x35')]=_['merge'](_0x5d1bd1[_0x4bde('0x35')],{'$or':_[_0x4bde('0x26')](_0x3e80da,function(_0x578252){if(_0x578252[_0x4bde('0x29')]!==_0x4bde('0x37')){var _0x22feaa={};_0x22feaa[_0x578252[_0x4bde('0x25')]]={'$like':'%'+_0x29060c[_0x4bde('0x2c')][_0x4bde('0x38')]+'%'};return _0x22feaa;}})});}_0x5d1bd1=_[_0x4bde('0x39')]({},_0x5d1bd1,_0x29060c[_0x4bde('0x3a')]);var _0x31249b={'where':_0x5d1bd1['where']};return db['VoiceQueuesLog'][_0x4bde('0x1b')](_0x31249b)[_0x4bde('0x22')](function(_0xcfeb11){_0x4578f6['count']=_0xcfeb11;if(_0x29060c[_0x4bde('0x2c')][_0x4bde('0x3b')]){_0x5d1bd1['include']=[{'all':!![]}];}return db[_0x4bde('0x27')][_0x4bde('0x3c')](_0x5d1bd1);})[_0x4bde('0x22')](function(_0xcf94ca){_0x4578f6['rows']=_0xcf94ca;return _0x4578f6;})[_0x4bde('0x22')](respondWithFilteredResult(_0x5607a1,_0x5d1bd1))[_0x4bde('0x3d')](handleError(_0x5607a1,null));};exports[_0x4bde('0x3e')]=function(_0x246ae9,_0x1a5665){var _0xa27fd8={'raw':!![],'where':{'id':_0x246ae9[_0x4bde('0x3f')]['id']}},_0x2d380f={};_0x2d380f[_0x4bde('0x2b')]=_['keys'](db[_0x4bde('0x27')]['rawAttributes']);_0x2d380f[_0x4bde('0x2c')]=_[_0x4bde('0x2d')](_0x246ae9['query']);_0x2d380f[_0x4bde('0x40')]=_[_0x4bde('0x2e')](_0x2d380f[_0x4bde('0x2b')],_0x2d380f[_0x4bde('0x2c')]);_0xa27fd8['attributes']=_['intersection'](_0x2d380f[_0x4bde('0x2b')],qs['fields'](_0x246ae9[_0x4bde('0x2c')][_0x4bde('0x30')]));_0xa27fd8[_0x4bde('0x2f')]=_0xa27fd8[_0x4bde('0x2f')][_0x4bde('0x31')]?_0xa27fd8[_0x4bde('0x2f')]:_0x2d380f[_0x4bde('0x2b')];if(_0x246ae9[_0x4bde('0x2c')][_0x4bde('0x3b')]){_0xa27fd8[_0x4bde('0x41')]=[{'all':!![]}];}_0xa27fd8=_[_0x4bde('0x39')]({},_0xa27fd8,_0x246ae9[_0x4bde('0x3a')]);return db[_0x4bde('0x27')][_0x4bde('0x42')](_0xa27fd8)[_0x4bde('0x22')](handleEntityNotFound(_0x1a5665,null))[_0x4bde('0x22')](respondWithResult(_0x1a5665,null))['catch'](handleError(_0x1a5665,null));};exports[_0x4bde('0x43')]=function(_0x13f39f,_0x4f618f){return db[_0x4bde('0x27')][_0x4bde('0x43')](_0x13f39f[_0x4bde('0x44')],{})[_0x4bde('0x22')](respondWithResult(_0x4f618f,0xc9))[_0x4bde('0x3d')](handleError(_0x4f618f,null));};exports[_0x4bde('0x21')]=function(_0x1a193b,_0x3e8f86){if(_0x1a193b[_0x4bde('0x44')]['id']){delete _0x1a193b[_0x4bde('0x44')]['id'];}return db[_0x4bde('0x27')][_0x4bde('0x42')]({'where':{'id':_0x1a193b[_0x4bde('0x3f')]['id']}})[_0x4bde('0x22')](handleEntityNotFound(_0x3e8f86,null))[_0x4bde('0x22')](saveUpdates(_0x1a193b[_0x4bde('0x44')],null))[_0x4bde('0x22')](respondWithResult(_0x3e8f86,null))[_0x4bde('0x3d')](handleError(_0x3e8f86,null));};exports[_0x4bde('0x45')]=function(_0x18ab20,_0x424998){return db[_0x4bde('0x27')]['find']({'where':{'id':_0x18ab20[_0x4bde('0x3f')]['id']}})['then'](handleEntityNotFound(_0x424998,null))[_0x4bde('0x22')](removeEntity(_0x424998,null))[_0x4bde('0x3d')](handleError(_0x424998,null));}; \ No newline at end of file +var _0xc656=['query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','send','index','map','VoiceQueuesLog','fieldName','type','key','name'];(function(_0x29e398,_0x890225){var _0xd799e2=function(_0x4fcf2f){while(--_0x4fcf2f){_0x29e398['push'](_0x29e398['shift']());}};_0xd799e2(++_0x890225);}(_0xc656,0x146));var _0x6c65=function(_0x307cb2,_0x5a17e9){_0x307cb2=_0x307cb2-0x0;var _0x366529=_0xc656[_0x307cb2];return _0x366529;};'use strict';var emlformat=require(_0x6c65('0x0'));var rimraf=require(_0x6c65('0x1'));var zipdir=require(_0x6c65('0x2'));var jsonpatch=require(_0x6c65('0x3'));var rp=require(_0x6c65('0x4'));var moment=require(_0x6c65('0x5'));var BPromise=require(_0x6c65('0x6'));var Mustache=require(_0x6c65('0x7'));var util=require(_0x6c65('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x6c65('0x9'));var ejs=require(_0x6c65('0xa'));var fs=require('fs');var fs_extra=require(_0x6c65('0xb'));var _=require(_0x6c65('0xc'));var squel=require(_0x6c65('0xd'));var crypto=require(_0x6c65('0xe'));var jsforce=require(_0x6c65('0xf'));var deskjs=require(_0x6c65('0x10'));var toCsv=require(_0x6c65('0x9'));var querystring=require('querystring');var Papa=require(_0x6c65('0x11'));var Redis=require(_0x6c65('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6c65('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x6c65('0x14'));var config=require(_0x6c65('0x15'));var licenseUtil=require(_0x6c65('0x16'));var db=require(_0x6c65('0x17'))['db'];function respondWithStatusCode(_0x4edbbd,_0x58011d){_0x58011d=_0x58011d||0xcc;return function(_0x59b2be){if(_0x59b2be){return _0x4edbbd[_0x6c65('0x18')](_0x58011d);}return _0x4edbbd[_0x6c65('0x19')](_0x58011d)[_0x6c65('0x1a')]();};}function respondWithResult(_0x5e41e9,_0x45aac0){_0x45aac0=_0x45aac0||0xc8;return function(_0x4788fe){if(_0x4788fe){return _0x5e41e9['status'](_0x45aac0)[_0x6c65('0x1b')](_0x4788fe);}};}function respondWithFilteredResult(_0xdf67f4,_0xd3764a){return function(_0x5354b2){if(_0x5354b2){var _0x336019=typeof _0xd3764a['offset']===_0x6c65('0x1c')&&typeof _0xd3764a[_0x6c65('0x1d')]==='undefined';var _0x207c30=_0x5354b2['count'];var _0x5bd921=_0x336019?0x0:_0xd3764a[_0x6c65('0x1e')];var _0x3feab2=_0x336019?_0x5354b2[_0x6c65('0x1f')]:_0xd3764a[_0x6c65('0x1e')]+_0xd3764a[_0x6c65('0x1d')];var _0xb3807e;if(_0x3feab2>=_0x207c30){_0x3feab2=_0x207c30;_0xb3807e=0xc8;}else{_0xb3807e=0xce;}_0xdf67f4[_0x6c65('0x19')](_0xb3807e);return _0xdf67f4[_0x6c65('0x20')](_0x6c65('0x21'),_0x5bd921+'-'+_0x3feab2+'/'+_0x207c30)[_0x6c65('0x1b')](_0x5354b2);}return null;};}function patchUpdates(_0x200bbf){return function(_0x514489){try{jsonpatch[_0x6c65('0x22')](_0x514489,_0x200bbf,!![]);}catch(_0x4555e8){return BPromise[_0x6c65('0x23')](_0x4555e8);}return _0x514489['save']();};}function saveUpdates(_0x12568e,_0x17956d){return function(_0x1c8b75){if(_0x1c8b75){return _0x1c8b75[_0x6c65('0x24')](_0x12568e)[_0x6c65('0x25')](function(_0x2b3e59){return _0x2b3e59;});}return null;};}function removeEntity(_0x3e51c4,_0x1cd2c3){return function(_0x2404bf){if(_0x2404bf){return _0x2404bf[_0x6c65('0x26')]()[_0x6c65('0x25')](function(){_0x3e51c4['status'](0xcc)[_0x6c65('0x1a')]();});}};}function handleEntityNotFound(_0x1274de,_0x29209a){return function(_0x2c2959){if(!_0x2c2959){_0x1274de[_0x6c65('0x18')](0x194);}return _0x2c2959;};}function handleError(_0x540faa,_0xe74b75){_0xe74b75=_0xe74b75||0x1f4;return function(_0x574b9b){logger[_0x6c65('0x27')](_0x574b9b[_0x6c65('0x28')]);if(_0x574b9b['name']){delete _0x574b9b['name'];}_0x540faa[_0x6c65('0x19')](_0xe74b75)[_0x6c65('0x29')](_0x574b9b);};}exports[_0x6c65('0x2a')]=function(_0x22223c,_0x179832){var _0x2b6c9d={},_0x2f4e89={},_0x2f0c20={'count':0x0,'rows':[]};var _0x332ae4=_[_0x6c65('0x2b')](db[_0x6c65('0x2c')]['rawAttributes'],function(_0x592301){return{'name':_0x592301[_0x6c65('0x2d')],'type':_0x592301[_0x6c65('0x2e')][_0x6c65('0x2f')]};});_0x2f4e89['model']=_[_0x6c65('0x2b')](_0x332ae4,_0x6c65('0x30'));_0x2f4e89[_0x6c65('0x31')]=_[_0x6c65('0x32')](_0x22223c[_0x6c65('0x31')]);_0x2f4e89[_0x6c65('0x33')]=_['intersection'](_0x2f4e89[_0x6c65('0x34')],_0x2f4e89['query']);_0x2b6c9d['attributes']=_[_0x6c65('0x35')](_0x2f4e89['model'],qs[_0x6c65('0x36')](_0x22223c[_0x6c65('0x31')][_0x6c65('0x36')]));_0x2b6c9d[_0x6c65('0x37')]=_0x2b6c9d[_0x6c65('0x37')][_0x6c65('0x38')]?_0x2b6c9d[_0x6c65('0x37')]:_0x2f4e89['model'];if(!_0x22223c[_0x6c65('0x31')][_0x6c65('0x39')](_0x6c65('0x3a'))){_0x2b6c9d['limit']=qs[_0x6c65('0x1d')](_0x22223c[_0x6c65('0x31')][_0x6c65('0x1d')]);_0x2b6c9d[_0x6c65('0x1e')]=qs['offset'](_0x22223c['query']['offset']);}_0x2b6c9d[_0x6c65('0x3b')]=qs[_0x6c65('0x3c')](_0x22223c[_0x6c65('0x31')][_0x6c65('0x3c')]);_0x2b6c9d['where']=qs[_0x6c65('0x33')](_[_0x6c65('0x3d')](_0x22223c[_0x6c65('0x31')],_0x2f4e89[_0x6c65('0x33')]),_0x332ae4);if(_0x22223c['query']['filter']){_0x2b6c9d[_0x6c65('0x3e')]=_[_0x6c65('0x3f')](_0x2b6c9d['where'],{'$or':_[_0x6c65('0x2b')](_0x332ae4,function(_0x4aec55){if(_0x4aec55['type']!==_0x6c65('0x40')){var _0x66f791={};_0x66f791[_0x4aec55[_0x6c65('0x30')]]={'$like':'%'+_0x22223c[_0x6c65('0x31')]['filter']+'%'};return _0x66f791;}})});}_0x2b6c9d=_[_0x6c65('0x3f')]({},_0x2b6c9d,_0x22223c[_0x6c65('0x41')]);var _0x127928={'where':_0x2b6c9d['where']};return db[_0x6c65('0x2c')][_0x6c65('0x1f')](_0x127928)[_0x6c65('0x25')](function(_0x563e64){_0x2f0c20[_0x6c65('0x1f')]=_0x563e64;if(_0x22223c[_0x6c65('0x31')][_0x6c65('0x42')]){_0x2b6c9d[_0x6c65('0x43')]=[{'all':!![]}];}return db[_0x6c65('0x2c')][_0x6c65('0x44')](_0x2b6c9d);})[_0x6c65('0x25')](function(_0xe291cf){_0x2f0c20[_0x6c65('0x45')]=_0xe291cf;return _0x2f0c20;})[_0x6c65('0x25')](respondWithFilteredResult(_0x179832,_0x2b6c9d))[_0x6c65('0x46')](handleError(_0x179832,null));};exports['show']=function(_0x1f457c,_0x5f11e3){var _0x3cb7a1={'raw':!![],'where':{'id':_0x1f457c[_0x6c65('0x47')]['id']}},_0x11513f={};_0x11513f[_0x6c65('0x34')]=_[_0x6c65('0x32')](db[_0x6c65('0x2c')]['rawAttributes']);_0x11513f[_0x6c65('0x31')]=_[_0x6c65('0x32')](_0x1f457c[_0x6c65('0x31')]);_0x11513f['filters']=_[_0x6c65('0x35')](_0x11513f[_0x6c65('0x34')],_0x11513f[_0x6c65('0x31')]);_0x3cb7a1[_0x6c65('0x37')]=_['intersection'](_0x11513f['model'],qs['fields'](_0x1f457c[_0x6c65('0x31')][_0x6c65('0x36')]));_0x3cb7a1[_0x6c65('0x37')]=_0x3cb7a1[_0x6c65('0x37')][_0x6c65('0x38')]?_0x3cb7a1[_0x6c65('0x37')]:_0x11513f['model'];if(_0x1f457c[_0x6c65('0x31')][_0x6c65('0x42')]){_0x3cb7a1[_0x6c65('0x43')]=[{'all':!![]}];}_0x3cb7a1=_[_0x6c65('0x3f')]({},_0x3cb7a1,_0x1f457c['options']);return db[_0x6c65('0x2c')][_0x6c65('0x48')](_0x3cb7a1)[_0x6c65('0x25')](handleEntityNotFound(_0x5f11e3,null))[_0x6c65('0x25')](respondWithResult(_0x5f11e3,null))[_0x6c65('0x46')](handleError(_0x5f11e3,null));};exports[_0x6c65('0x49')]=function(_0x1be75b,_0x13586d){return db[_0x6c65('0x2c')]['create'](_0x1be75b[_0x6c65('0x4a')],{})[_0x6c65('0x25')](respondWithResult(_0x13586d,0xc9))[_0x6c65('0x46')](handleError(_0x13586d,null));};exports[_0x6c65('0x24')]=function(_0xe7ac35,_0x58b052){if(_0xe7ac35['body']['id']){delete _0xe7ac35['body']['id'];}return db['VoiceQueuesLog'][_0x6c65('0x48')]({'where':{'id':_0xe7ac35['params']['id']}})[_0x6c65('0x25')](handleEntityNotFound(_0x58b052,null))[_0x6c65('0x25')](saveUpdates(_0xe7ac35[_0x6c65('0x4a')],null))[_0x6c65('0x25')](respondWithResult(_0x58b052,null))[_0x6c65('0x46')](handleError(_0x58b052,null));};exports[_0x6c65('0x26')]=function(_0x3813b0,_0x574e43){return db[_0x6c65('0x2c')][_0x6c65('0x48')]({'where':{'id':_0x3813b0[_0x6c65('0x47')]['id']}})[_0x6c65('0x25')](handleEntityNotFound(_0x574e43,null))['then'](removeEntity(_0x574e43,null))[_0x6c65('0x46')](handleError(_0x574e43,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index b630db4..97522c6 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 _0x66d9=['rimraf','define','VoiceQueuesLog','event_dtm','event','lodash','util','../../config/logger','api','moment','path'];(function(_0x3b33eb,_0x535569){var _0x207836=function(_0x255406){while(--_0x255406){_0x3b33eb['push'](_0x3b33eb['shift']());}};_0x207836(++_0x535569);}(_0x66d9,0x1e9));var _0x966d=function(_0x155ac2,_0x134492){_0x155ac2=_0x155ac2-0x0;var _0x4cbb9b=_0x66d9[_0x155ac2];return _0x4cbb9b;};'use strict';var _=require(_0x966d('0x0'));var util=require(_0x966d('0x1'));var logger=require(_0x966d('0x2'))(_0x966d('0x3'));var moment=require(_0x966d('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x966d('0x5'));var rimraf=require(_0x966d('0x6'));var config=require('../../config/environment');var attributes=require('./voiceQueuesLog.attributes');module['exports']=function(_0x11538a,_0x1aa2b7){return _0x11538a[_0x966d('0x7')](_0x966d('0x8'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x966d('0x9'),'fields':[_0x966d('0xa'),'dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0xb3ea=['event_dtm','event','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','voice_queues_log'];(function(_0x55cc6a,_0x5dbd65){var _0x26e2cd=function(_0x3d5c6b){while(--_0x3d5c6b){_0x55cc6a['push'](_0x55cc6a['shift']());}};_0x26e2cd(++_0x5dbd65);}(_0xb3ea,0xc5));var _0xab3e=function(_0x988365,_0x227cce){_0x988365=_0x988365-0x0;var _0x5950ab=_0xb3ea[_0x988365];return _0x5950ab;};'use strict';var _=require(_0xab3e('0x0'));var util=require(_0xab3e('0x1'));var logger=require(_0xab3e('0x2'))(_0xab3e('0x3'));var moment=require(_0xab3e('0x4'));var BPromise=require(_0xab3e('0x5'));var rp=require(_0xab3e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xab3e('0x7'));var config=require(_0xab3e('0x8'));var attributes=require('./voiceQueuesLog.attributes');module[_0xab3e('0x9')]=function(_0x5fa9c,_0x32a751){return _0x5fa9c['define']('VoiceQueuesLog',attributes,{'tableName':_0xab3e('0xa'),'paranoid':![],'indexes':[{'name':_0xab3e('0xb'),'fields':[_0xab3e('0xc'),'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 e6f472a..19becef 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 _0x1e00=['randomstring','ioredis','../../config/logger','rpc','client','request','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','moment'];(function(_0x5b21a2,_0x2c6461){var _0x57166b=function(_0x2c0c1a){while(--_0x2c0c1a){_0x5b21a2['push'](_0x5b21a2['shift']());}};_0x57166b(++_0x2c6461);}(_0x1e00,0x1df));var _0x01e0=function(_0x592c18,_0x3993ff){_0x592c18=_0x592c18-0x0;var _0x3d3510=_0x1e00[_0x592c18];return _0x3d3510;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x01e0('0x0'));var BPromise=require('bluebird');var rs=require(_0x01e0('0x1'));var fs=require('fs');var Redis=require(_0x01e0('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x01e0('0x3'))(_0x01e0('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x01e0('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5456cc,_0x2781fe,_0x31b1d6){return new BPromise(function(_0x2cebf5,_0x54366e){return client[_0x01e0('0x6')](_0x5456cc,_0x31b1d6)['then'](function(_0x16f432){logger[_0x01e0('0x7')](_0x01e0('0x8'),_0x2781fe,_0x01e0('0x9'));logger[_0x01e0('0xa')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x2781fe,_0x01e0('0x9'),JSON[_0x01e0('0xb')](_0x16f432));if(_0x16f432[_0x01e0('0xc')]){if(_0x16f432['error']['code']===0x1f4){logger[_0x01e0('0xc')](_0x01e0('0x8'),_0x2781fe,_0x16f432['error'][_0x01e0('0xd')]);return _0x54366e(_0x16f432[_0x01e0('0xc')][_0x01e0('0xd')]);}logger[_0x01e0('0xc')]('VoiceQueuesLog,\x20%s,\x20%s',_0x2781fe,_0x16f432[_0x01e0('0xc')]['message']);return _0x2cebf5(_0x16f432[_0x01e0('0xc')][_0x01e0('0xd')]);}else{logger[_0x01e0('0x7')](_0x01e0('0x8'),_0x2781fe,_0x01e0('0x9'));_0x2cebf5(_0x16f432[_0x01e0('0xe')][_0x01e0('0xd')]);}})['catch'](function(_0xfcab){logger[_0x01e0('0xc')](_0x01e0('0x8'),_0x2781fe,_0xfcab);_0x54366e(_0xfcab);});});} \ No newline at end of file +var _0x402b=['info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x3df548,_0x2b8767){var _0xc27204=function(_0xa2b77f){while(--_0xa2b77f){_0x3df548['push'](_0x3df548['shift']());}};_0xc27204(++_0x2b8767);}(_0x402b,0x1bb));var _0xb402=function(_0x3a485b,_0x1a1b38){_0x3a485b=_0x3a485b-0x0;var _0x379adc=_0x402b[_0x3a485b];return _0x379adc;};'use strict';var _=require(_0xb402('0x0'));var util=require('util');var moment=require(_0xb402('0x1'));var BPromise=require(_0xb402('0x2'));var rs=require(_0xb402('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb402('0x4'))['db'];var utils=require(_0xb402('0x5'));var logger=require('../../config/logger')(_0xb402('0x6'));var config=require(_0xb402('0x7'));var jayson=require(_0xb402('0x8'));var client=jayson[_0xb402('0x9')][_0xb402('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1eebf9,_0x2bfbba,_0x3457a5){return new BPromise(function(_0x32a239,_0x5beefc){return client[_0xb402('0xb')](_0x1eebf9,_0x3457a5)[_0xb402('0xc')](function(_0x1ec115){logger[_0xb402('0xd')](_0xb402('0xe'),_0x2bfbba,_0xb402('0xf'));logger[_0xb402('0x10')](_0xb402('0x11'),_0x2bfbba,_0xb402('0xf'),JSON[_0xb402('0x12')](_0x1ec115));if(_0x1ec115[_0xb402('0x13')]){if(_0x1ec115[_0xb402('0x13')][_0xb402('0x14')]===0x1f4){logger[_0xb402('0x13')](_0xb402('0xe'),_0x2bfbba,_0x1ec115[_0xb402('0x13')][_0xb402('0x15')]);return _0x5beefc(_0x1ec115[_0xb402('0x13')][_0xb402('0x15')]);}logger[_0xb402('0x13')]('VoiceQueuesLog,\x20%s,\x20%s',_0x2bfbba,_0x1ec115[_0xb402('0x13')]['message']);return _0x32a239(_0x1ec115[_0xb402('0x13')]['message']);}else{logger[_0xb402('0xd')](_0xb402('0xe'),_0x2bfbba,_0xb402('0xf'));_0x32a239(_0x1ec115[_0xb402('0x16')][_0xb402('0x15')]);}})[_0xb402('0x17')](function(_0x145a2d){logger[_0xb402('0x13')](_0xb402('0xe'),_0x2bfbba,_0x145a2d);_0x5beefc(_0x145a2d);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 1dae327..152eaa0 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 _0x7129=['destroy','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','put','update','delete'];(function(_0x2e12f5,_0x93d1f3){var _0x34370a=function(_0x3999d5){while(--_0x3999d5){_0x2e12f5['push'](_0x2e12f5['shift']());}};_0x34370a(++_0x93d1f3);}(_0x7129,0x65));var _0x9712=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x7129[_0x138adb];return _0x1b27f2;};'use strict';var multer=require(_0x9712('0x0'));var util=require(_0x9712('0x1'));var path=require(_0x9712('0x2'));var timeout=require('connect-timeout');var express=require(_0x9712('0x3'));var router=express[_0x9712('0x4')]();var fs_extra=require(_0x9712('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9712('0x6'));var config=require(_0x9712('0x7'));var controller=require('./voiceRecording.controller');router[_0x9712('0x8')]('/',auth[_0x9712('0x9')](),controller[_0x9712('0xa')]);router[_0x9712('0x8')](_0x9712('0xb'),auth[_0x9712('0x9')](),controller[_0x9712('0xc')]);router[_0x9712('0x8')](_0x9712('0xd'),auth['isAuthenticated'](),controller[_0x9712('0xe')]);router[_0x9712('0x8')](_0x9712('0xf'),auth[_0x9712('0x9')](),controller['download']);router[_0x9712('0x8')](_0x9712('0x10'),controller[_0x9712('0x11')]);router['get'](_0x9712('0x12'),auth[_0x9712('0x9')](),controller[_0x9712('0x13')]);router[_0x9712('0x14')]('/',auth[_0x9712('0x9')](),controller['create']);router[_0x9712('0x14')](_0x9712('0x12'),auth[_0x9712('0x9')](),controller['runTranscribe']);router[_0x9712('0x15')](_0x9712('0xd'),auth[_0x9712('0x9')](),controller[_0x9712('0x16')]);router[_0x9712('0x17')](_0x9712('0xd'),auth[_0x9712('0x9')](),controller[_0x9712('0x18')]);module['exports']=router; \ No newline at end of file +var _0x3d0a=['put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./voiceRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','/:id/downloads','downloadTranscribe','post','create','/:id/transcribe'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x3d0a,0x94));var _0xa3d0=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x3d0a[_0x273c39];return _0x46d6b5;};'use strict';var multer=require(_0xa3d0('0x0'));var util=require(_0xa3d0('0x1'));var path=require(_0xa3d0('0x2'));var timeout=require(_0xa3d0('0x3'));var express=require(_0xa3d0('0x4'));var router=express[_0xa3d0('0x5')]();var fs_extra=require(_0xa3d0('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa3d0('0x7'));var controller=require(_0xa3d0('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xa3d0('0x9')]('/describe',auth[_0xa3d0('0xa')](),controller['describe']);router['get'](_0xa3d0('0xb'),auth[_0xa3d0('0xa')](),controller[_0xa3d0('0xc')]);router[_0xa3d0('0x9')](_0xa3d0('0xd'),auth['isAuthenticated'](),controller[_0xa3d0('0xe')]);router[_0xa3d0('0x9')](_0xa3d0('0xf'),controller['downloads']);router[_0xa3d0('0x9')]('/:id/transcribe',auth[_0xa3d0('0xa')](),controller[_0xa3d0('0x10')]);router[_0xa3d0('0x11')]('/',auth[_0xa3d0('0xa')](),controller[_0xa3d0('0x12')]);router[_0xa3d0('0x11')](_0xa3d0('0x13'),auth[_0xa3d0('0xa')](),controller['runTranscribe']);router[_0xa3d0('0x14')](_0xa3d0('0xb'),auth[_0xa3d0('0xa')](),controller['update']);router[_0xa3d0('0x15')](_0xa3d0('0xb'),auth[_0xa3d0('0xa')](),controller[_0xa3d0('0x16')]);module[_0xa3d0('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 37c95a7..81cff9f 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(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'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(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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 6ea342c..abb7ecf 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 _0xe3b1=['upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJobName','transcribeName','TranscriptionJob','transcribeStatus','TranscriptionJobStatus','findOne','ValidationError','transcribe','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','IN_PROGRESS','tempSentiment','writeFile','downloadTranscribe','fileText','root','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','aws-sdk','uuid/v4','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','count','offset','limit','Content-Range','json','apply','reject','save','update','then','stack','name','map','VoiceRecording','rawAttributes','fieldName','type','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','VoiceRecording\x20not\x20found','filename','download','extname','send','Not\x20found','sequelize','MD5','col','token','$and','push','unlink','destroy','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','createBucket'];(function(_0x10a24c,_0x3609dd){var _0x2c2333=function(_0x13ddd0){while(--_0x13ddd0){_0x10a24c['push'](_0x10a24c['shift']());}};_0x2c2333(++_0x3609dd);}(_0xe3b1,0x152));var _0x1e3b=function(_0x3293e6,_0x83a410){_0x3293e6=_0x3293e6-0x0;var _0x35f5f4=_0xe3b1[_0x3293e6];return _0x35f5f4;};'use strict';var emlformat=require(_0x1e3b('0x0'));var rimraf=require(_0x1e3b('0x1'));var zipdir=require(_0x1e3b('0x2'));var jsonpatch=require(_0x1e3b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1e3b('0x4'));var Mustache=require(_0x1e3b('0x5'));var util=require(_0x1e3b('0x6'));var path=require('path');var sox=require(_0x1e3b('0x7'));var csv=require(_0x1e3b('0x8'));var ejs=require(_0x1e3b('0x9'));var fs=require('fs');var fs_extra=require(_0x1e3b('0xa'));var _=require(_0x1e3b('0xb'));var squel=require(_0x1e3b('0xc'));var crypto=require(_0x1e3b('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1e3b('0xe'));var Papa=require('papaparse');var AWS=require(_0x1e3b('0xf'));var uuidv4=require(_0x1e3b('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1e3b('0x11'));var as=require(_0x1e3b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1e3b('0x13'))('api');var utils=require(_0x1e3b('0x14'));var config=require(_0x1e3b('0x15'));var licenseUtil=require(_0x1e3b('0x16'));var db=require(_0x1e3b('0x17'))['db'];function respondWithStatusCode(_0x317355,_0x2668c3){_0x2668c3=_0x2668c3||0xcc;return function(_0x1a268b){if(_0x1a268b){return _0x317355[_0x1e3b('0x18')](_0x2668c3);}return _0x317355['status'](_0x2668c3)[_0x1e3b('0x19')]();};}function respondWithResult(_0x385309,_0xc8aef9){_0xc8aef9=_0xc8aef9||0xc8;return function(_0x341add){if(_0x341add){return _0x385309[_0x1e3b('0x1a')](_0xc8aef9)['json'](_0x341add);}};}function respondWithFilteredResult(_0x346f82,_0x17cd18){return function(_0x30e42d){if(_0x30e42d){var _0x53318a=typeof _0x17cd18['offset']===_0x1e3b('0x1b')&&typeof _0x17cd18['limit']==='undefined';var _0x48a2c3=_0x30e42d[_0x1e3b('0x1c')];var _0x78e648=_0x53318a?0x0:_0x17cd18['offset'];var _0x14f81a=_0x53318a?_0x30e42d['count']:_0x17cd18[_0x1e3b('0x1d')]+_0x17cd18[_0x1e3b('0x1e')];var _0x6b059;if(_0x14f81a>=_0x48a2c3){_0x14f81a=_0x48a2c3;_0x6b059=0xc8;}else{_0x6b059=0xce;}_0x346f82['status'](_0x6b059);return _0x346f82['set'](_0x1e3b('0x1f'),_0x78e648+'-'+_0x14f81a+'/'+_0x48a2c3)[_0x1e3b('0x20')](_0x30e42d);}return null;};}function patchUpdates(_0x36c47c){return function(_0x3aac36){try{jsonpatch[_0x1e3b('0x21')](_0x3aac36,_0x36c47c,!![]);}catch(_0x5e4ffd){return BPromise[_0x1e3b('0x22')](_0x5e4ffd);}return _0x3aac36[_0x1e3b('0x23')]();};}function saveUpdates(_0x2a2729,_0xeba1ae){return function(_0x349dd3){if(_0x349dd3){return _0x349dd3[_0x1e3b('0x24')](_0x2a2729)['then'](function(_0x449bbb){return _0x449bbb;});}return null;};}function removeEntity(_0x914f90,_0x37261d){return function(_0x4993d5){if(_0x4993d5){return _0x4993d5['destroy']()[_0x1e3b('0x25')](function(){_0x914f90[_0x1e3b('0x1a')](0xcc)[_0x1e3b('0x19')]();});}};}function handleEntityNotFound(_0x14345b,_0x1513a5){return function(_0x5e5cb9){if(!_0x5e5cb9){_0x14345b[_0x1e3b('0x18')](0x194);}return _0x5e5cb9;};}function handleError(_0x2effaa,_0x9dd64b){_0x9dd64b=_0x9dd64b||0x1f4;return function(_0x1da731){logger['error'](_0x1da731[_0x1e3b('0x26')]);if(_0x1da731[_0x1e3b('0x27')]){delete _0x1da731[_0x1e3b('0x27')];}_0x2effaa[_0x1e3b('0x1a')](_0x9dd64b)['send'](_0x1da731);};}exports['index']=function(_0x5c663c,_0x52119b){var _0x36ca19={},_0x302473={},_0x2b40d3={'count':0x0,'rows':[]};var _0x3abfe4=_[_0x1e3b('0x28')](db[_0x1e3b('0x29')][_0x1e3b('0x2a')],function(_0x50ae4c){return{'name':_0x50ae4c[_0x1e3b('0x2b')],'type':_0x50ae4c[_0x1e3b('0x2c')]['key']};});_0x302473[_0x1e3b('0x2d')]=_[_0x1e3b('0x2e')](_[_0x1e3b('0x28')](_0x3abfe4,_0x1e3b('0x27')),[_0x1e3b('0x2f')]);_0x302473[_0x1e3b('0x30')]=_[_0x1e3b('0x31')](_0x5c663c[_0x1e3b('0x30')]);_0x302473[_0x1e3b('0x32')]=_[_0x1e3b('0x33')](_0x302473[_0x1e3b('0x2d')],_0x302473[_0x1e3b('0x30')]);_0x36ca19[_0x1e3b('0x34')]=_['intersection'](_0x302473['model'],qs[_0x1e3b('0x35')](_0x5c663c[_0x1e3b('0x30')][_0x1e3b('0x35')]));_0x36ca19['attributes']=_0x36ca19[_0x1e3b('0x34')][_0x1e3b('0x36')]?_0x36ca19[_0x1e3b('0x34')]:_0x302473[_0x1e3b('0x2d')];if(!_0x5c663c['query'][_0x1e3b('0x37')]('nolimit')){_0x36ca19[_0x1e3b('0x1e')]=qs[_0x1e3b('0x1e')](_0x5c663c['query'][_0x1e3b('0x1e')]);_0x36ca19[_0x1e3b('0x1d')]=qs[_0x1e3b('0x1d')](_0x5c663c[_0x1e3b('0x30')][_0x1e3b('0x1d')]);}_0x36ca19[_0x1e3b('0x38')]=qs[_0x1e3b('0x39')](_0x5c663c[_0x1e3b('0x30')][_0x1e3b('0x39')]);_0x36ca19[_0x1e3b('0x3a')]=qs[_0x1e3b('0x32')](_[_0x1e3b('0x3b')](_0x5c663c[_0x1e3b('0x30')],_0x302473[_0x1e3b('0x32')]),_0x3abfe4);if(_0x5c663c[_0x1e3b('0x30')][_0x1e3b('0x3c')]){_0x36ca19[_0x1e3b('0x3a')]=_[_0x1e3b('0x3d')](_0x36ca19['where'],{'$or':_[_0x1e3b('0x28')](_0x3abfe4,function(_0x45a75c){if(_0x45a75c[_0x1e3b('0x2c')]!==_0x1e3b('0x3e')){var _0x43b1ec={};_0x43b1ec[_0x45a75c[_0x1e3b('0x27')]]={'$like':'%'+_0x5c663c[_0x1e3b('0x30')][_0x1e3b('0x3c')]+'%'};return _0x43b1ec;}})});}_0x36ca19=_[_0x1e3b('0x3d')]({},_0x36ca19,_0x5c663c[_0x1e3b('0x3f')]);var _0x2c80a2={'where':_0x36ca19['where']};return db[_0x1e3b('0x29')][_0x1e3b('0x1c')](_0x2c80a2)['then'](function(_0x223e6a){_0x2b40d3[_0x1e3b('0x1c')]=_0x223e6a;if(_0x5c663c[_0x1e3b('0x30')][_0x1e3b('0x40')]){_0x36ca19[_0x1e3b('0x41')]=[{'all':!![]}];}return db[_0x1e3b('0x29')][_0x1e3b('0x42')](_0x36ca19);})[_0x1e3b('0x25')](function(_0x5bf0c8){_0x2b40d3[_0x1e3b('0x43')]=_0x5bf0c8;return _0x2b40d3;})['then'](respondWithFilteredResult(_0x52119b,_0x36ca19))[_0x1e3b('0x44')](handleError(_0x52119b,null));};exports[_0x1e3b('0x45')]=function(_0x1fe974,_0x44663c){var _0x41e78b={'raw':![],'where':{'id':_0x1fe974[_0x1e3b('0x46')]['id']}},_0x1fd1c5={};_0x1fd1c5[_0x1e3b('0x2d')]=_[_0x1e3b('0x31')](db['VoiceRecording']['rawAttributes']);_0x1fd1c5['query']=_['keys'](_0x1fe974[_0x1e3b('0x30')]);_0x1fd1c5[_0x1e3b('0x32')]=_[_0x1e3b('0x33')](_0x1fd1c5['model'],_0x1fd1c5['query']);_0x41e78b[_0x1e3b('0x34')]=_[_0x1e3b('0x33')](_0x1fd1c5[_0x1e3b('0x2d')],qs['fields'](_0x1fe974['query'][_0x1e3b('0x35')]));_0x41e78b[_0x1e3b('0x34')]=_0x41e78b['attributes']['length']?_0x41e78b[_0x1e3b('0x34')]:_0x1fd1c5['model'];if(_0x1fe974[_0x1e3b('0x30')][_0x1e3b('0x40')]){_0x41e78b[_0x1e3b('0x41')]=[{'all':!![]}];}_0x41e78b=_['merge']({},_0x41e78b,_0x1fe974[_0x1e3b('0x3f')]);return db[_0x1e3b('0x29')]['find'](_0x41e78b)[_0x1e3b('0x25')](handleEntityNotFound(_0x44663c,null))[_0x1e3b('0x25')](respondWithResult(_0x44663c,null))['catch'](handleError(_0x44663c,null));};exports['create']=function(_0xa22972,_0x34dfda){return db[_0x1e3b('0x29')][_0x1e3b('0x47')](_0xa22972[_0x1e3b('0x48')],{})[_0x1e3b('0x25')](respondWithResult(_0x34dfda,0xc9))[_0x1e3b('0x44')](handleError(_0x34dfda,null));};exports['update']=function(_0x415aa7,_0x406a4b){if(_0x415aa7[_0x1e3b('0x48')]['id']){delete _0x415aa7[_0x1e3b('0x48')]['id'];}return db['VoiceRecording'][_0x1e3b('0x49')]({'where':{'id':_0x415aa7[_0x1e3b('0x46')]['id']}})[_0x1e3b('0x25')](handleEntityNotFound(_0x406a4b,null))[_0x1e3b('0x25')](saveUpdates(_0x415aa7[_0x1e3b('0x48')],null))[_0x1e3b('0x25')](respondWithResult(_0x406a4b,null))[_0x1e3b('0x44')](handleError(_0x406a4b,null));};exports[_0x1e3b('0x4a')]=function(_0xd68758,_0x5f1b92){return db['VoiceRecording'][_0x1e3b('0x4a')]()[_0x1e3b('0x25')](respondWithResult(_0x5f1b92,null))['catch'](handleError(_0x5f1b92,null));};exports['download']=function(_0x16810c,_0x113eb9,_0x1127b7){var _0x1183f5=require(_0x1e3b('0x4b'));var _0x489815=![];var _0x2169d0={};if(_0x16810c[_0x1e3b('0x30')]['type']&&_0x16810c[_0x1e3b('0x30')][_0x1e3b('0x2c')]===_0x1e3b('0x4c')){_0x2169d0[_0x1e3b('0x4c')]=_0x16810c[_0x1e3b('0x46')]['id'];}else{_0x2169d0['id']=_0x16810c['params']['id'];}return db[_0x1e3b('0x29')][_0x1e3b('0x49')]({'where':_0x2169d0,'attributes':['id',_0x1e3b('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0x113eb9,null))[_0x1e3b('0x25')](function(_0x31bb1c){if(_0x31bb1c){var _0x7fe687=_0x31bb1c[_0x1e3b('0x4d')];var _0x2a4760=util[_0x1e3b('0x2f')](_0x1e3b('0x4e'),_0x7fe687);if(fs[_0x1e3b('0x4f')](_0x2a4760)){_0x489815=!![];return _0x1183f5[_0x1e3b('0x50')](_0x2a4760,_0x7fe687,config[_0x1e3b('0x51')][_0x1e3b('0x52')])[_0x1e3b('0x25')](function(){return _0x31bb1c;});}return _0x31bb1c;}})[_0x1e3b('0x25')](function(_0x1b7836){if(_0x1b7836){var _0xba0ac1=_0x1b7836[_0x1e3b('0x4d')];if(!fs[_0x1e3b('0x4f')](_0xba0ac1)){throw new db[(_0x1e3b('0x53'))]['ValidationError'](_0x1e3b('0x54'));}if(_0x1b7836[_0x1e3b('0x55')]){return _0x113eb9[_0x1e3b('0x56')](_0xba0ac1,_0x1b7836[_0x1e3b('0x55')]+path[_0x1e3b('0x57')](_0xba0ac1),function(){if(_0x489815){fs['unlink'](_0xba0ac1);}});}else{return _0x113eb9['download'](_0xba0ac1,function(_0x3bf155){if(_0x489815){fs['unlink'](_0xba0ac1);}});}}})[_0x1e3b('0x44')](function(_0x18c8cd){if(_0x18c8cd['message']===_0x1e3b('0x54')){_0x113eb9[_0x1e3b('0x1a')](0x194)[_0x1e3b('0x58')](_0x1e3b('0x59'));}else{return handleError(_0x113eb9,null);}});};exports['downloads']=function(_0x49fb36,_0x537ca5,_0x46c47e){var _0x376461=require(_0x1e3b('0x4b'));var _0x2fb0fc=![];var _0x36631f={'$and':[db[_0x1e3b('0x5a')][_0x1e3b('0x3a')](db[_0x1e3b('0x5a')]['fn'](_0x1e3b('0x5b'),db[_0x1e3b('0x5a')][_0x1e3b('0x5c')](_0x1e3b('0x4c'))),_0x49fb36['query'][_0x1e3b('0x5d')])]};if(_0x49fb36['query'][_0x1e3b('0x2c')]&&_0x49fb36['query'][_0x1e3b('0x2c')]===_0x1e3b('0x4c')){_0x36631f[_0x1e3b('0x5e')][_0x1e3b('0x5f')]({'uniqueid':_0x49fb36[_0x1e3b('0x46')]['id']});}else{_0x36631f[_0x1e3b('0x5e')][_0x1e3b('0x5f')]({'id':_0x49fb36['params']['id']});}return db[_0x1e3b('0x29')][_0x1e3b('0x49')]({'where':_0x36631f,'attributes':['id',_0x1e3b('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0x537ca5,null))[_0x1e3b('0x25')](function(_0x3e91a3){if(_0x3e91a3){var _0x279ef5=util[_0x1e3b('0x2f')]('%s.cypher',_0x3e91a3[_0x1e3b('0x4d')]);if(fs[_0x1e3b('0x4f')](_0x279ef5)){_0x2fb0fc=!![];return _0x376461['decryptFile'](_0x279ef5,_0x3e91a3[_0x1e3b('0x4d')],config[_0x1e3b('0x51')]['recording'])[_0x1e3b('0x25')](function(){return _0x3e91a3;});}return _0x3e91a3;}})[_0x1e3b('0x25')](function(_0x382f84){if(_0x382f84){if(!fs[_0x1e3b('0x4f')](_0x382f84[_0x1e3b('0x4d')])){throw new db['Sequelize']['ValidationError'](_0x1e3b('0x54'));}if(_0x382f84[_0x1e3b('0x55')]){return _0x537ca5[_0x1e3b('0x56')](_0x382f84[_0x1e3b('0x4d')],_0x382f84[_0x1e3b('0x55')]+path[_0x1e3b('0x57')](_0x382f84[_0x1e3b('0x4d')]),function(){if(_0x2fb0fc){fs[_0x1e3b('0x60')](_0x382f84[_0x1e3b('0x4d')]);}});}else{return _0x537ca5[_0x1e3b('0x56')](_0x382f84['value'],function(_0x3a0f3e){if(_0x2fb0fc){fs[_0x1e3b('0x60')](_0x382f84[_0x1e3b('0x4d')]);}});}}})[_0x1e3b('0x44')](handleError(_0x537ca5,null));};exports[_0x1e3b('0x61')]=function(_0x2632f2,_0xec4e3d){return db[_0x1e3b('0x29')][_0x1e3b('0x49')]({'where':{'id':_0x2632f2['params']['id']}})[_0x1e3b('0x25')](function(_0x126e85){if(_[_0x1e3b('0x62')](_0x126e85)){throw new ReferenceError('Entity\x20not\x20found');}return _0x126e85;})[_0x1e3b('0x25')](function(_0x3efe5d){var _0x52f29e=_0x3efe5d[_0x1e3b('0x4d')];logger[_0x1e3b('0x63')](_0x1e3b('0x64'),_0x52f29e);if(!_[_0x1e3b('0x62')](_0x3efe5d[_0x1e3b('0x4d')])&&fs[_0x1e3b('0x4f')](_0x52f29e)){logger['info'](_0x1e3b('0x65')+_0x52f29e+_0x1e3b('0x66'));fs['unlinkSync'](_0x52f29e);}_0x52f29e=_0x52f29e+_0x1e3b('0x67');if(!_[_0x1e3b('0x62')](_0x3efe5d['value'])&&fs[_0x1e3b('0x4f')](_0x52f29e)){logger[_0x1e3b('0x63')]('File:\x20\x22'+_0x52f29e+_0x1e3b('0x66'));fs[_0x1e3b('0x68')](_0x52f29e);}return _0x3efe5d;})[_0x1e3b('0x25')](function(_0x56f7df){if(!_0x56f7df)throw new InternalError();return _0x56f7df[_0x1e3b('0x61')]();})['then'](function(){_0xec4e3d[_0x1e3b('0x1a')](0xcc)['end']();})['catch'](handleError(_0xec4e3d,null));};function getBucketslist(_0x1cd387,_0x582bef,_0x220008){return new Promise(function(_0xa08706,_0x24c43a){var _0x4a10ac=new AWS['S3']({'accessKeyId':_0x582bef,'secretAccessKey':_0x1cd387,'region':_0x220008});_0x4a10ac['listBuckets']({},function(_0x2a9b59,_0xd32d){if(_0x2a9b59){return _0x24c43a(_0x2a9b59);}else{return _0xa08706(_0xd32d);}});});}function createBucket(_0x2e9dc8,_0x4b6e50,_0x1d50e3,_0xb33711){return new Promise(function(_0x25c360,_0x1b5035){var _0x163f72=new AWS['S3']({'accessKeyId':_0x4b6e50,'secretAccessKey':_0x2e9dc8,'region':_0x1d50e3});_0x163f72[_0x1e3b('0x69')]({'Bucket':_0xb33711},function(_0x37be02,_0x187958){if(_0x37be02){return _0x1b5035(_0x37be02);}else{return _0x25c360(_0x187958);}});});}function uploadFile(_0x17eac8,_0x5320f6,_0x103707,_0x3531ba,_0x2a1141,_0x1f4b5d){return new Promise(function(_0x37e88b,_0x5604be){var _0x5f42f2=new AWS['S3']({'accessKeyId':_0x5320f6,'secretAccessKey':_0x17eac8,'region':_0x103707});_0x5f42f2[_0x1e3b('0x6a')]({'Bucket':_0x3531ba,'Key':_0x2a1141,'Body':_0x1f4b5d},function(_0x143de2,_0x300aaf){if(_0x143de2){return _0x5604be(_0x143de2);}else{return _0x37e88b(_0x300aaf);}});});}function startTranscribe(_0x26ebe7,_0x2d2237,_0x40b702,_0x2d9577,_0x5669de,_0x42fb20){return new Promise(function(_0x41d8ad,_0x3ba57a){var _0x497935=new AWS[(_0x1e3b('0x6b'))]({'accessKeyId':_0x2d2237,'secretAccessKey':_0x26ebe7,'region':_0x40b702});_0x497935[_0x1e3b('0x6c')]({'TranscriptionJobName':_0x2d9577,'LanguageCode':_0x5669de,'Media':{'MediaFileUri':_0x42fb20}},function(_0x3f2142,_0x2866be){if(_0x3f2142){return _0x3ba57a(_0x3f2142);}else{return _0x41d8ad(_0x2866be);}});});}function transcribe(_0xf486de,_0x2084dc,_0x372a5f,_0x3410dd,_0x32477d,_0x5ce6eb,_0x5b14d2){return new Promise(function(_0x52242d,_0x196a35){var _0x1767ea={};logger[_0x1e3b('0x63')](util[_0x1e3b('0x2f')](_0x1e3b('0x6d'),_0xf486de,_0x32477d));return uploadFile(_0x2084dc,_0x372a5f,_0x3410dd,_0x32477d,path['basename'](_0x5ce6eb),fs[_0x1e3b('0x6e')](_0x5ce6eb))['then'](function(_0x138561){logger[_0x1e3b('0x63')](util[_0x1e3b('0x2f')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0xf486de,_0x32477d,_0x138561[_0x1e3b('0x6f')]));_0x1767ea[_0x1e3b('0x70')]=_0x138561[_0x1e3b('0x71')];_0x1767ea[_0x1e3b('0x72')]=_0x138561['Location'];logger[_0x1e3b('0x63')](util[_0x1e3b('0x2f')](_0x1e3b('0x73'),_0xf486de));return startTranscribe(_0x2084dc,_0x372a5f,_0x3410dd,uuidv4(),_0x5b14d2,_0x138561[_0x1e3b('0x6f')]);})[_0x1e3b('0x25')](function(_0x89d0fc){logger['info'](util[_0x1e3b('0x2f')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0xf486de,_0x89d0fc['TranscriptionJob'][_0x1e3b('0x74')]));_0x1767ea[_0x1e3b('0x75')]=_0x89d0fc[_0x1e3b('0x76')][_0x1e3b('0x74')];_0x1767ea[_0x1e3b('0x77')]=_0x89d0fc['TranscriptionJob'][_0x1e3b('0x78')];return _0x52242d(_0x1767ea);})[_0x1e3b('0x44')](function(_0x564070){return _0x196a35(_0x564070);});});}exports['runTranscribe']=function(_0x35e632,_0x39918e,_0x51e999){var _0x246640;var _0x2c7154;var _0x2bc984;var _0x4b22d3=require(_0x1e3b('0x4b'));return db[_0x1e3b('0x29')][_0x1e3b('0x79')]({'where':{'id':_0x35e632['params']['id']}})['then'](function(_0x1c0b12){if(_0x1c0b12){var _0x1b9abe=util[_0x1e3b('0x2f')](_0x1e3b('0x4e'),_0x1c0b12[_0x1e3b('0x4d')]);if(fs[_0x1e3b('0x4f')](_0x1b9abe)){cypher=!![];return _0x4b22d3[_0x1e3b('0x50')](_0x1b9abe,_0x1c0b12['value'],config['secrets']['recording'])[_0x1e3b('0x25')](function(){return _0x1c0b12;});}return _0x1c0b12;}})[_0x1e3b('0x25')](function(_0x4107d0){if(!_0x4107d0){throw new db[(_0x1e3b('0x53'))][(_0x1e3b('0x7a'))]('Voice\x20Recording\x20not\x20found');}_0x2c7154=_0x4107d0;return db['Setting'][_0x1e3b('0x79')]({'where':{'id':0x1}});})[_0x1e3b('0x25')](handleEntityNotFound(_0x39918e,null))[_0x1e3b('0x25')](function(_0x11ea2d){if(_0x11ea2d){_0x246640=_0x11ea2d;if(!_0x246640[_0x1e3b('0x7b')]||!_0x246640['transcribeAccountId']||!_0x246640[_0x1e3b('0x7c')]||!_0x246640[_0x1e3b('0x7d')]||!_0x246640[_0x1e3b('0x70')]){throw new db['Sequelize'][(_0x1e3b('0x7a'))](_0x1e3b('0x7e'));}if(_0x35e632['body'][_0x1e3b('0x7f')]&&(!_0x246640[_0x1e3b('0x80')]||!_0x246640[_0x1e3b('0x81')]||!_0x246640[_0x1e3b('0x82')]||!_0x246640[_0x1e3b('0x7d')]||!_0x246640['bucket'])){throw new db['Sequelize'][(_0x1e3b('0x7a'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x1e3b('0x83')][_0x1e3b('0x79')]({'where':{'id':_0x246640[_0x1e3b('0x84')]}});}})[_0x1e3b('0x25')](function(_0x46321e){if(!_0x46321e){throw new db[(_0x1e3b('0x53'))][(_0x1e3b('0x7a'))](_0x1e3b('0x85'));}if(!_0x46321e[_0x1e3b('0x86')]||!_0x46321e[_0x1e3b('0x87')]){throw new db[(_0x1e3b('0x53'))][(_0x1e3b('0x7a'))]('Cloud\x20Provider\x20not\x20configured');}_0x2bc984=_0x46321e;return getBucketslist(_0x2bc984['data1'],_0x2bc984[_0x1e3b('0x87')],_0x246640[_0x1e3b('0x7c')]);})[_0x1e3b('0x25')](function(_0x5b7c29){if(_0x5b7c29&&_0x5b7c29[_0x1e3b('0x88')]){var _0x1f5e61=_[_0x1e3b('0x49')](_0x5b7c29[_0x1e3b('0x88')],function(_0x73b34f){return _0x73b34f[_0x1e3b('0x89')]===_0x246640[_0x1e3b('0x70')];});if(!_0x1f5e61){logger[_0x1e3b('0x63')](util[_0x1e3b('0x2f')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x35e632['params']['id'],_0x246640[_0x1e3b('0x70')]));return createBucket(_0x2bc984[_0x1e3b('0x86')],_0x2bc984['data2'],_0x246640[_0x1e3b('0x7c')],_0x246640[_0x1e3b('0x70')]);}logger['info'](util[_0x1e3b('0x2f')](_0x1e3b('0x8a'),_0x35e632['params']['id'],_0x246640[_0x1e3b('0x70')]));return;}})[_0x1e3b('0x25')](function(_0x533d95){if(_0x2c7154[_0x1e3b('0x77')]===_0x1e3b('0x8b')){return transcribe(_0x35e632['params']['id'],_0x2bc984[_0x1e3b('0x86')],_0x2bc984[_0x1e3b('0x87')],_0x246640['transcribeRegion'],_0x246640[_0x1e3b('0x70')],_0x2c7154[_0x1e3b('0x4d')],_0x246640['language']);}else{logger[_0x1e3b('0x63')](util[_0x1e3b('0x2f')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x35e632[_0x1e3b('0x46')]['id']));return{'transcribeStatus':_0x1e3b('0x8c')};}})[_0x1e3b('0x25')](function(_0x3b87b0){if(_0x3b87b0){_0x3b87b0[_0x1e3b('0x8d')]=_0x35e632[_0x1e3b('0x48')]['runSentiment'];return _0x2c7154['updateAttributes'](_0x3b87b0);}})[_0x1e3b('0x25')](respondWithResult(_0x39918e,null))['catch'](handleError(_0x39918e,null));};function writeFile(_0x11eb40,_0xfa6338){return new Promise(function(_0x363cc8,_0x3cd62d){fs[_0x1e3b('0x8e')](_0xfa6338,_0x11eb40,function(_0x1211c2,_0x3bdf4e){if(_0x1211c2){return _0x3cd62d(_0x1211c2);}else{return _0x363cc8(_0x3bdf4e);}});});}exports[_0x1e3b('0x8f')]=function(_0x41bd22,_0x43adcb,_0x2ce063){return db[_0x1e3b('0x29')][_0x1e3b('0x79')]({'where':{'id':_0x41bd22['params']['id']}})[_0x1e3b('0x25')](handleEntityNotFound(_0x43adcb))['then'](function(_0x499fa6){if(_0x499fa6&&_0x499fa6[_0x1e3b('0x90')]){var _0x48b197=_0x499fa6[_0x1e3b('0x90')];var _0x3c6ed9=config[_0x1e3b('0x91')]+'/server/files/transcribes/transcribe_'+_0x499fa6['id']+_0x1e3b('0x92');if(fs[_0x1e3b('0x4f')](_0x3c6ed9)){return _0x3c6ed9;}return writeFile(_0x48b197,_0x3c6ed9)[_0x1e3b('0x25')](function(){return _0x3c6ed9;});}else{throw new db[(_0x1e3b('0x53'))]['ValidationError'](_0x1e3b('0x93'));}})['then'](function(_0x391dfd){return _0x43adcb[_0x1e3b('0x56')](_0x391dfd);})[_0x1e3b('0x44')](handleError(_0x43adcb));}; \ No newline at end of file +var _0x63a9=['set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','map','VoiceRecording','fieldName','type','model','differenceBy','format','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','length','catch','create','update','body','find','describe','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','secrets','recording','Sequelize','ValidationError','filename','extname','unlink','message','VoiceRecording\x20not\x20found','Not\x20found','downloads','sequelize','MD5','col','token','push','$and','decryptFile','download','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','TranscriptionJobName','TranscriptionJobStatus','findOne','Setting','transcribe','transcribeAccountId','transcribeRegion','language','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','writeFile','fileText','root','.txt','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x63a9,0x11f));var _0x963a=function(_0x2390a9,_0x5029bf){_0x2390a9=_0x2390a9-0x0;var _0x1faabc=_0x63a9[_0x2390a9];return _0x1faabc;};'use strict';var emlformat=require(_0x963a('0x0'));var rimraf=require(_0x963a('0x1'));var zipdir=require(_0x963a('0x2'));var jsonpatch=require(_0x963a('0x3'));var rp=require(_0x963a('0x4'));var moment=require(_0x963a('0x5'));var BPromise=require(_0x963a('0x6'));var Mustache=require(_0x963a('0x7'));var util=require(_0x963a('0x8'));var path=require('path');var sox=require(_0x963a('0x9'));var csv=require(_0x963a('0xa'));var ejs=require(_0x963a('0xb'));var fs=require('fs');var fs_extra=require(_0x963a('0xc'));var _=require('lodash');var squel=require(_0x963a('0xd'));var crypto=require(_0x963a('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x963a('0xa'));var querystring=require('querystring');var Papa=require(_0x963a('0xf'));var AWS=require(_0x963a('0x10'));var uuidv4=require(_0x963a('0x11'));var Redis=require(_0x963a('0x12'));var authService=require(_0x963a('0x13'));var qs=require(_0x963a('0x14'));var as=require(_0x963a('0x15'));var hardwareService=require(_0x963a('0x16'));var logger=require(_0x963a('0x17'))('api');var utils=require(_0x963a('0x18'));var config=require(_0x963a('0x19'));var licenseUtil=require(_0x963a('0x1a'));var db=require(_0x963a('0x1b'))['db'];function respondWithStatusCode(_0x11c94e,_0xd852ea){_0xd852ea=_0xd852ea||0xcc;return function(_0x3276e3){if(_0x3276e3){return _0x11c94e[_0x963a('0x1c')](_0xd852ea);}return _0x11c94e[_0x963a('0x1d')](_0xd852ea)['end']();};}function respondWithResult(_0x10db00,_0xdf42fe){_0xdf42fe=_0xdf42fe||0xc8;return function(_0x445cb1){if(_0x445cb1){return _0x10db00[_0x963a('0x1d')](_0xdf42fe)[_0x963a('0x1e')](_0x445cb1);}};}function respondWithFilteredResult(_0x35a594,_0x40e1ce){return function(_0x18f4bd){if(_0x18f4bd){var _0x2bb71c=typeof _0x40e1ce[_0x963a('0x1f')]===_0x963a('0x20')&&typeof _0x40e1ce[_0x963a('0x21')]===_0x963a('0x20');var _0x4f9685=_0x18f4bd['count'];var _0x117bc4=_0x2bb71c?0x0:_0x40e1ce[_0x963a('0x1f')];var _0x76f6e4=_0x2bb71c?_0x18f4bd[_0x963a('0x22')]:_0x40e1ce[_0x963a('0x1f')]+_0x40e1ce[_0x963a('0x21')];var _0x5dc984;if(_0x76f6e4>=_0x4f9685){_0x76f6e4=_0x4f9685;_0x5dc984=0xc8;}else{_0x5dc984=0xce;}_0x35a594['status'](_0x5dc984);return _0x35a594[_0x963a('0x23')](_0x963a('0x24'),_0x117bc4+'-'+_0x76f6e4+'/'+_0x4f9685)[_0x963a('0x1e')](_0x18f4bd);}return null;};}function patchUpdates(_0x4429d9){return function(_0x755c1d){try{jsonpatch[_0x963a('0x25')](_0x755c1d,_0x4429d9,!![]);}catch(_0x447d25){return BPromise[_0x963a('0x26')](_0x447d25);}return _0x755c1d[_0x963a('0x27')]();};}function saveUpdates(_0x189ab0,_0x55ccae){return function(_0x1fff53){if(_0x1fff53){return _0x1fff53['update'](_0x189ab0)['then'](function(_0x457248){return _0x457248;});}return null;};}function removeEntity(_0x51627f,_0x884e12){return function(_0x2c6a9a){if(_0x2c6a9a){return _0x2c6a9a[_0x963a('0x28')]()[_0x963a('0x29')](function(){_0x51627f[_0x963a('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a7111,_0x2356c3){return function(_0x19338e){if(!_0x19338e){_0x1a7111['sendStatus'](0x194);}return _0x19338e;};}function handleError(_0x39d189,_0x3a6e25){_0x3a6e25=_0x3a6e25||0x1f4;return function(_0x4587b3){logger[_0x963a('0x2a')](_0x4587b3[_0x963a('0x2b')]);if(_0x4587b3['name']){delete _0x4587b3[_0x963a('0x2c')];}_0x39d189[_0x963a('0x1d')](_0x3a6e25)[_0x963a('0x2d')](_0x4587b3);};}exports[_0x963a('0x2e')]=function(_0x5435c7,_0x2c16a9){var _0x5dfcf9={},_0x2617a3={},_0x33ddd7={'count':0x0,'rows':[]};var _0x5f101b=_[_0x963a('0x2f')](db[_0x963a('0x30')]['rawAttributes'],function(_0x376af5){return{'name':_0x376af5[_0x963a('0x31')],'type':_0x376af5[_0x963a('0x32')]['key']};});_0x2617a3[_0x963a('0x33')]=_[_0x963a('0x34')](_[_0x963a('0x2f')](_0x5f101b,_0x963a('0x2c')),[_0x963a('0x35')]);_0x2617a3[_0x963a('0x36')]=_[_0x963a('0x37')](_0x5435c7[_0x963a('0x36')]);_0x2617a3[_0x963a('0x38')]=_[_0x963a('0x39')](_0x2617a3[_0x963a('0x33')],_0x2617a3[_0x963a('0x36')]);_0x5dfcf9['attributes']=_['intersection'](_0x2617a3[_0x963a('0x33')],qs[_0x963a('0x3a')](_0x5435c7[_0x963a('0x36')]['fields']));_0x5dfcf9['attributes']=_0x5dfcf9[_0x963a('0x3b')]['length']?_0x5dfcf9[_0x963a('0x3b')]:_0x2617a3[_0x963a('0x33')];if(!_0x5435c7[_0x963a('0x36')][_0x963a('0x3c')](_0x963a('0x3d'))){_0x5dfcf9['limit']=qs[_0x963a('0x21')](_0x5435c7[_0x963a('0x36')][_0x963a('0x21')]);_0x5dfcf9[_0x963a('0x1f')]=qs[_0x963a('0x1f')](_0x5435c7['query'][_0x963a('0x1f')]);}_0x5dfcf9[_0x963a('0x3e')]=qs[_0x963a('0x3f')](_0x5435c7[_0x963a('0x36')][_0x963a('0x3f')]);_0x5dfcf9['where']=qs['filters'](_[_0x963a('0x40')](_0x5435c7[_0x963a('0x36')],_0x2617a3[_0x963a('0x38')]),_0x5f101b);if(_0x5435c7[_0x963a('0x36')][_0x963a('0x41')]){_0x5dfcf9[_0x963a('0x42')]=_['merge'](_0x5dfcf9[_0x963a('0x42')],{'$or':_['map'](_0x5f101b,function(_0xfe02db){if(_0xfe02db[_0x963a('0x32')]!==_0x963a('0x43')){var _0x5b23a5={};_0x5b23a5[_0xfe02db['name']]={'$like':'%'+_0x5435c7[_0x963a('0x36')]['filter']+'%'};return _0x5b23a5;}})});}_0x5dfcf9=_[_0x963a('0x44')]({},_0x5dfcf9,_0x5435c7[_0x963a('0x45')]);var _0x467a17={'where':_0x5dfcf9['where']};return db[_0x963a('0x30')][_0x963a('0x22')](_0x467a17)[_0x963a('0x29')](function(_0x21bc94){_0x33ddd7['count']=_0x21bc94;if(_0x5435c7[_0x963a('0x36')][_0x963a('0x46')]){_0x5dfcf9[_0x963a('0x47')]=[{'all':!![]}];}return db[_0x963a('0x30')][_0x963a('0x48')](_0x5dfcf9);})['then'](function(_0x14da3a){_0x33ddd7[_0x963a('0x49')]=_0x14da3a;return _0x33ddd7;})[_0x963a('0x29')](respondWithFilteredResult(_0x2c16a9,_0x5dfcf9))['catch'](handleError(_0x2c16a9,null));};exports[_0x963a('0x4a')]=function(_0x3528ac,_0x124b6f){var _0x3727e8={'raw':![],'where':{'id':_0x3528ac[_0x963a('0x4b')]['id']}},_0x1fe461={};_0x1fe461['model']=_[_0x963a('0x37')](db[_0x963a('0x30')][_0x963a('0x4c')]);_0x1fe461[_0x963a('0x36')]=_[_0x963a('0x37')](_0x3528ac[_0x963a('0x36')]);_0x1fe461[_0x963a('0x38')]=_[_0x963a('0x39')](_0x1fe461[_0x963a('0x33')],_0x1fe461[_0x963a('0x36')]);_0x3727e8[_0x963a('0x3b')]=_[_0x963a('0x39')](_0x1fe461[_0x963a('0x33')],qs['fields'](_0x3528ac[_0x963a('0x36')][_0x963a('0x3a')]));_0x3727e8['attributes']=_0x3727e8[_0x963a('0x3b')][_0x963a('0x4d')]?_0x3727e8[_0x963a('0x3b')]:_0x1fe461['model'];if(_0x3528ac[_0x963a('0x36')][_0x963a('0x46')]){_0x3727e8[_0x963a('0x47')]=[{'all':!![]}];}_0x3727e8=_[_0x963a('0x44')]({},_0x3727e8,_0x3528ac[_0x963a('0x45')]);return db['VoiceRecording']['find'](_0x3727e8)['then'](handleEntityNotFound(_0x124b6f,null))[_0x963a('0x29')](respondWithResult(_0x124b6f,null))[_0x963a('0x4e')](handleError(_0x124b6f,null));};exports[_0x963a('0x4f')]=function(_0x40b487,_0x35070b){return db[_0x963a('0x30')][_0x963a('0x4f')](_0x40b487['body'],{})['then'](respondWithResult(_0x35070b,0xc9))[_0x963a('0x4e')](handleError(_0x35070b,null));};exports[_0x963a('0x50')]=function(_0x1e0169,_0x30ffd3){if(_0x1e0169['body']['id']){delete _0x1e0169[_0x963a('0x51')]['id'];}return db[_0x963a('0x30')][_0x963a('0x52')]({'where':{'id':_0x1e0169[_0x963a('0x4b')]['id']}})[_0x963a('0x29')](handleEntityNotFound(_0x30ffd3,null))[_0x963a('0x29')](saveUpdates(_0x1e0169['body'],null))[_0x963a('0x29')](respondWithResult(_0x30ffd3,null))[_0x963a('0x4e')](handleError(_0x30ffd3,null));};exports[_0x963a('0x53')]=function(_0x4db5ce,_0x14ee34){return db[_0x963a('0x30')]['describe']()[_0x963a('0x29')](respondWithResult(_0x14ee34,null))['catch'](handleError(_0x14ee34,null));};exports['download']=function(_0x417fc1,_0x1dc012,_0x533f07){var _0x37724c=require(_0x963a('0x54'));var _0x5b725b=![];var _0x2151c8={};if(_0x417fc1[_0x963a('0x36')][_0x963a('0x32')]&&_0x417fc1[_0x963a('0x36')][_0x963a('0x32')]===_0x963a('0x55')){_0x2151c8['uniqueid']=_0x417fc1[_0x963a('0x4b')]['id'];}else{_0x2151c8['id']=_0x417fc1[_0x963a('0x4b')]['id'];}return db[_0x963a('0x30')][_0x963a('0x52')]({'where':_0x2151c8,'attributes':['id','value'],'raw':!![]})[_0x963a('0x29')](handleEntityNotFound(_0x1dc012,null))[_0x963a('0x29')](function(_0x3adc02){if(_0x3adc02){var _0x428765=_0x3adc02[_0x963a('0x56')];var _0x8728df=util[_0x963a('0x35')](_0x963a('0x57'),_0x428765);if(fs[_0x963a('0x58')](_0x8728df)){_0x5b725b=!![];return _0x37724c['decryptFile'](_0x8728df,_0x428765,config[_0x963a('0x59')][_0x963a('0x5a')])[_0x963a('0x29')](function(){return _0x3adc02;});}return _0x3adc02;}})[_0x963a('0x29')](function(_0x3e3005){if(_0x3e3005){var _0x26b893=_0x3e3005[_0x963a('0x56')];if(!fs[_0x963a('0x58')](_0x26b893)){throw new db[(_0x963a('0x5b'))][(_0x963a('0x5c'))]('VoiceRecording\x20not\x20found');}if(_0x3e3005[_0x963a('0x5d')]){return _0x1dc012['download'](_0x26b893,_0x3e3005[_0x963a('0x5d')]+path[_0x963a('0x5e')](_0x26b893),function(){if(_0x5b725b){fs[_0x963a('0x5f')](_0x26b893);}});}else{return _0x1dc012['download'](_0x26b893,function(_0x5e739b){if(_0x5b725b){fs[_0x963a('0x5f')](_0x26b893);}});}}})['catch'](function(_0x8d2b94){if(_0x8d2b94[_0x963a('0x60')]===_0x963a('0x61')){_0x1dc012[_0x963a('0x1d')](0x194)[_0x963a('0x2d')](_0x963a('0x62'));}else{return handleError(_0x1dc012,null);}});};exports[_0x963a('0x63')]=function(_0xcf61cd,_0x368358,_0x2a3250){var _0x491f84=require('../../components/encryptor');var _0x3e8f2b=![];var _0xcfb3af={'$and':[db[_0x963a('0x64')][_0x963a('0x42')](db[_0x963a('0x64')]['fn'](_0x963a('0x65'),db[_0x963a('0x64')][_0x963a('0x66')](_0x963a('0x55'))),_0xcf61cd[_0x963a('0x36')][_0x963a('0x67')])]};if(_0xcf61cd['query'][_0x963a('0x32')]&&_0xcf61cd[_0x963a('0x36')][_0x963a('0x32')]===_0x963a('0x55')){_0xcfb3af['$and'][_0x963a('0x68')]({'uniqueid':_0xcf61cd[_0x963a('0x4b')]['id']});}else{_0xcfb3af[_0x963a('0x69')]['push']({'id':_0xcf61cd[_0x963a('0x4b')]['id']});}return db[_0x963a('0x30')][_0x963a('0x52')]({'where':_0xcfb3af,'attributes':['id',_0x963a('0x56')],'raw':!![]})[_0x963a('0x29')](handleEntityNotFound(_0x368358,null))[_0x963a('0x29')](function(_0x3da45e){if(_0x3da45e){var _0x33e93d=util['format'](_0x963a('0x57'),_0x3da45e['value']);if(fs['existsSync'](_0x33e93d)){_0x3e8f2b=!![];return _0x491f84[_0x963a('0x6a')](_0x33e93d,_0x3da45e[_0x963a('0x56')],config[_0x963a('0x59')]['recording'])[_0x963a('0x29')](function(){return _0x3da45e;});}return _0x3da45e;}})['then'](function(_0x1dedff){if(_0x1dedff){if(!fs[_0x963a('0x58')](_0x1dedff[_0x963a('0x56')])){throw new db[(_0x963a('0x5b'))]['ValidationError'](_0x963a('0x61'));}if(_0x1dedff['filename']){return _0x368358[_0x963a('0x6b')](_0x1dedff['value'],_0x1dedff['filename']+path[_0x963a('0x5e')](_0x1dedff[_0x963a('0x56')]),function(){if(_0x3e8f2b){fs['unlink'](_0x1dedff[_0x963a('0x56')]);}});}else{return _0x368358[_0x963a('0x6b')](_0x1dedff[_0x963a('0x56')],function(_0x19fd3e){if(_0x3e8f2b){fs['unlink'](_0x1dedff[_0x963a('0x56')]);}});}}})[_0x963a('0x4e')](handleError(_0x368358,null));};exports[_0x963a('0x28')]=function(_0x12c6ff,_0xd3c48f){return db[_0x963a('0x30')][_0x963a('0x52')]({'where':{'id':_0x12c6ff[_0x963a('0x4b')]['id']}})['then'](function(_0x402e43){if(_['isNil'](_0x402e43)){throw new ReferenceError(_0x963a('0x6c'));}return _0x402e43;})[_0x963a('0x29')](function(_0x531d25){var _0x6238d0=_0x531d25[_0x963a('0x56')];logger[_0x963a('0x6d')](_0x963a('0x6e'),_0x6238d0);if(!_[_0x963a('0x6f')](_0x531d25['value'])&&fs[_0x963a('0x58')](_0x6238d0)){logger['info'](_0x963a('0x70')+_0x6238d0+_0x963a('0x71'));fs[_0x963a('0x72')](_0x6238d0);}_0x6238d0=_0x6238d0+_0x963a('0x73');if(!_[_0x963a('0x6f')](_0x531d25['value'])&&fs[_0x963a('0x58')](_0x6238d0)){logger[_0x963a('0x6d')](_0x963a('0x70')+_0x6238d0+_0x963a('0x71'));fs[_0x963a('0x72')](_0x6238d0);}return _0x531d25;})[_0x963a('0x29')](function(_0x3ac3b6){if(!_0x3ac3b6)throw new InternalError();return _0x3ac3b6['destroy']();})['then'](function(){_0xd3c48f[_0x963a('0x1d')](0xcc)['end']();})['catch'](handleError(_0xd3c48f,null));};function getBucketslist(_0x57acb9,_0xd8041a,_0x56ecea){return new Promise(function(_0x4d6b70,_0x368f35){var _0x368dba=new AWS['S3']({'accessKeyId':_0xd8041a,'secretAccessKey':_0x57acb9,'region':_0x56ecea});_0x368dba[_0x963a('0x74')]({},function(_0x3c9c10,_0x45be9c){if(_0x3c9c10){return _0x368f35(_0x3c9c10);}else{return _0x4d6b70(_0x45be9c);}});});}function createBucket(_0x2eab4c,_0x1811de,_0x42d127,_0x5d6ecb){return new Promise(function(_0x385aa2,_0x1ebd82){var _0xdd5792=new AWS['S3']({'accessKeyId':_0x1811de,'secretAccessKey':_0x2eab4c,'region':_0x42d127});_0xdd5792['createBucket']({'Bucket':_0x5d6ecb},function(_0x54021a,_0x3192f4){if(_0x54021a){return _0x1ebd82(_0x54021a);}else{return _0x385aa2(_0x3192f4);}});});}function uploadFile(_0x4eb3b5,_0x519332,_0x2c97d3,_0x354bf7,_0x3352dc,_0x42b549){return new Promise(function(_0x1b7ecd,_0x24a991){var _0x31e7ee=new AWS['S3']({'accessKeyId':_0x519332,'secretAccessKey':_0x4eb3b5,'region':_0x2c97d3});_0x31e7ee[_0x963a('0x75')]({'Bucket':_0x354bf7,'Key':_0x3352dc,'Body':_0x42b549},function(_0x3014ab,_0x334e22){if(_0x3014ab){return _0x24a991(_0x3014ab);}else{return _0x1b7ecd(_0x334e22);}});});}function startTranscribe(_0x4e8b11,_0x49b1e3,_0x4223f0,_0x57a0bc,_0x5e1c1b,_0x5ae539){return new Promise(function(_0x51c3fa,_0xdb9d0d){var _0x3f4ff9=new AWS[(_0x963a('0x76'))]({'accessKeyId':_0x49b1e3,'secretAccessKey':_0x4e8b11,'region':_0x4223f0});_0x3f4ff9[_0x963a('0x77')]({'TranscriptionJobName':_0x57a0bc,'LanguageCode':_0x5e1c1b,'Media':{'MediaFileUri':_0x5ae539}},function(_0x2fed04,_0x4491fc){if(_0x2fed04){return _0xdb9d0d(_0x2fed04);}else{return _0x51c3fa(_0x4491fc);}});});}function transcribe(_0x192be3,_0x79d0e,_0x5d6886,_0x557aeb,_0x49dc7c,_0x24e1d5,_0x5bf3a9){return new Promise(function(_0x108c5d,_0x2fc69e){var _0x43fe2f={};logger[_0x963a('0x6d')](util[_0x963a('0x35')](_0x963a('0x78'),_0x192be3,_0x49dc7c));return uploadFile(_0x79d0e,_0x5d6886,_0x557aeb,_0x49dc7c,path[_0x963a('0x79')](_0x24e1d5),fs[_0x963a('0x7a')](_0x24e1d5))[_0x963a('0x29')](function(_0x558711){logger[_0x963a('0x6d')](util['format'](_0x963a('0x7b'),_0x192be3,_0x49dc7c,_0x558711['Location']));_0x43fe2f[_0x963a('0x7c')]=_0x558711[_0x963a('0x7d')];_0x43fe2f[_0x963a('0x7e')]=_0x558711[_0x963a('0x7f')];logger[_0x963a('0x6d')](util[_0x963a('0x35')](_0x963a('0x80'),_0x192be3));return startTranscribe(_0x79d0e,_0x5d6886,_0x557aeb,uuidv4(),_0x5bf3a9,_0x558711[_0x963a('0x7f')]);})[_0x963a('0x29')](function(_0x228afd){logger['info'](util[_0x963a('0x35')](_0x963a('0x81'),_0x192be3,_0x228afd[_0x963a('0x82')]['TranscriptionJobName']));_0x43fe2f[_0x963a('0x83')]=_0x228afd[_0x963a('0x82')][_0x963a('0x84')];_0x43fe2f['transcribeStatus']=_0x228afd[_0x963a('0x82')][_0x963a('0x85')];return _0x108c5d(_0x43fe2f);})['catch'](function(_0x4b4aed){return _0x2fc69e(_0x4b4aed);});});}exports['runTranscribe']=function(_0x40ac4f,_0x3803fa,_0x3d36c2){var _0x387bf5;var _0x310666;var _0x3a672e;var _0x52b0a0=require(_0x963a('0x54'));return db['VoiceRecording'][_0x963a('0x86')]({'where':{'id':_0x40ac4f[_0x963a('0x4b')]['id']}})[_0x963a('0x29')](function(_0xf3d9d2){if(_0xf3d9d2){var _0xfe9062=util[_0x963a('0x35')]('%s.cypher',_0xf3d9d2[_0x963a('0x56')]);if(fs['existsSync'](_0xfe9062)){cypher=!![];return _0x52b0a0['decryptFile'](_0xfe9062,_0xf3d9d2[_0x963a('0x56')],config[_0x963a('0x59')]['recording'])[_0x963a('0x29')](function(){return _0xf3d9d2;});}return _0xf3d9d2;}})[_0x963a('0x29')](function(_0x4b977e){if(!_0x4b977e){throw new db[(_0x963a('0x5b'))]['ValidationError']('Voice\x20Recording\x20not\x20found');}_0x310666=_0x4b977e;return db[_0x963a('0x87')][_0x963a('0x86')]({'where':{'id':0x1}});})[_0x963a('0x29')](handleEntityNotFound(_0x3803fa,null))[_0x963a('0x29')](function(_0x465f4b){if(_0x465f4b){_0x387bf5=_0x465f4b;if(!_0x387bf5[_0x963a('0x88')]||!_0x387bf5[_0x963a('0x89')]||!_0x387bf5[_0x963a('0x8a')]||!_0x387bf5[_0x963a('0x8b')]||!_0x387bf5[_0x963a('0x7c')]){throw new db[(_0x963a('0x5b'))][(_0x963a('0x5c'))]('Transcribe\x20not\x20configured');}if(_0x40ac4f['body'][_0x963a('0x8c')]&&(!_0x387bf5[_0x963a('0x8d')]||!_0x387bf5[_0x963a('0x8e')]||!_0x387bf5[_0x963a('0x8f')]||!_0x387bf5[_0x963a('0x8b')]||!_0x387bf5[_0x963a('0x7c')])){throw new db[(_0x963a('0x5b'))][(_0x963a('0x5c'))](_0x963a('0x90'));}return db[_0x963a('0x91')]['findOne']({'where':{'id':_0x387bf5['transcribeAccountId']}});}})['then'](function(_0x46777d){if(!_0x46777d){throw new db['Sequelize'][(_0x963a('0x5c'))](_0x963a('0x92'));}if(!_0x46777d[_0x963a('0x93')]||!_0x46777d[_0x963a('0x94')]){throw new db['Sequelize'][(_0x963a('0x5c'))]('Cloud\x20Provider\x20not\x20configured');}_0x3a672e=_0x46777d;return getBucketslist(_0x3a672e['data1'],_0x3a672e['data2'],_0x387bf5[_0x963a('0x8a')]);})[_0x963a('0x29')](function(_0x460252){if(_0x460252&&_0x460252[_0x963a('0x95')]){var _0x4c233f=_[_0x963a('0x52')](_0x460252[_0x963a('0x95')],function(_0x1ed9f3){return _0x1ed9f3['Name']===_0x387bf5[_0x963a('0x7c')];});if(!_0x4c233f){logger[_0x963a('0x6d')](util[_0x963a('0x35')](_0x963a('0x96'),_0x40ac4f[_0x963a('0x4b')]['id'],_0x387bf5['bucket']));return createBucket(_0x3a672e[_0x963a('0x93')],_0x3a672e[_0x963a('0x94')],_0x387bf5[_0x963a('0x8a')],_0x387bf5[_0x963a('0x7c')]);}logger[_0x963a('0x6d')](util[_0x963a('0x35')](_0x963a('0x97'),_0x40ac4f['params']['id'],_0x387bf5['bucket']));return;}})[_0x963a('0x29')](function(_0x52e4f1){if(_0x310666[_0x963a('0x98')]===_0x963a('0x99')){return transcribe(_0x40ac4f[_0x963a('0x4b')]['id'],_0x3a672e[_0x963a('0x93')],_0x3a672e['data2'],_0x387bf5[_0x963a('0x8a')],_0x387bf5[_0x963a('0x7c')],_0x310666[_0x963a('0x56')],_0x387bf5[_0x963a('0x8b')]);}else{logger[_0x963a('0x6d')](util['format'](_0x963a('0x9a'),_0x40ac4f[_0x963a('0x4b')]['id']));return{'transcribeStatus':_0x963a('0x9b')};}})['then'](function(_0xc97e7){if(_0xc97e7){_0xc97e7[_0x963a('0x9c')]=_0x40ac4f['body']['runSentiment'];return _0x310666['updateAttributes'](_0xc97e7);}})[_0x963a('0x29')](respondWithResult(_0x3803fa,null))['catch'](handleError(_0x3803fa,null));};function writeFile(_0x1cd2b8,_0x179687){return new Promise(function(_0x5ac2ed,_0x1d28b3){fs[_0x963a('0x9d')](_0x179687,_0x1cd2b8,function(_0x4cee98,_0x2c2337){if(_0x4cee98){return _0x1d28b3(_0x4cee98);}else{return _0x5ac2ed(_0x2c2337);}});});}exports['downloadTranscribe']=function(_0x25b7c0,_0x5968bc,_0x3b612b){return db['VoiceRecording'][_0x963a('0x86')]({'where':{'id':_0x25b7c0['params']['id']}})[_0x963a('0x29')](handleEntityNotFound(_0x5968bc))[_0x963a('0x29')](function(_0x4d7a9c){if(_0x4d7a9c&&_0x4d7a9c[_0x963a('0x9e')]){var _0x383bee=_0x4d7a9c[_0x963a('0x9e')];var _0x1ad588=config[_0x963a('0x9f')]+'/server/files/transcribes/transcribe_'+_0x4d7a9c['id']+_0x963a('0xa0');if(fs[_0x963a('0x58')](_0x1ad588)){return _0x1ad588;}return writeFile(_0x383bee,_0x1ad588)[_0x963a('0x29')](function(){return _0x1ad588;});}else{throw new db[(_0x963a('0x5b'))][(_0x963a('0x5c'))]('Transcript\x20not\x20available');}})[_0x963a('0x29')](function(_0x23d17e){return _0x5968bc[_0x963a('0x6b')](_0x23d17e);})[_0x963a('0x4e')](handleError(_0x5968bc));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index ec6badd..da18c3c 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 _0xdd8f=['lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings','uniqueid'];(function(_0x1933ec,_0x3af28e){var _0x29a85c=function(_0x8b3053){while(--_0x8b3053){_0x1933ec['push'](_0x1933ec['shift']());}};_0x29a85c(++_0x3af28e);}(_0xdd8f,0x1ad));var _0xfdd8=function(_0xfe4b24,_0x397414){_0xfe4b24=_0xfe4b24-0x0;var _0xa70d40=_0xdd8f[_0xfe4b24];return _0xa70d40;};'use strict';var _=require(_0xfdd8('0x0'));var util=require(_0xfdd8('0x1'));var logger=require(_0xfdd8('0x2'))('api');var moment=require('moment');var BPromise=require(_0xfdd8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfdd8('0x4'));var rimraf=require(_0xfdd8('0x5'));var config=require(_0xfdd8('0x6'));var attributes=require(_0xfdd8('0x7'));module[_0xfdd8('0x8')]=function(_0x4a7848,_0x5bc9dd){return _0x4a7848[_0xfdd8('0x9')](_0xfdd8('0xa'),attributes,{'tableName':_0xfdd8('0xb'),'paranoid':![],'indexes':[{'name':_0xfdd8('0xc'),'fields':[_0xfdd8('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x775e=['moment','bluebird','path','rimraf','./voiceRecording.attributes','exports','define','VoiceRecording','uniqueid','lodash','util'];(function(_0x102125,_0x1096f7){var _0x5725c8=function(_0x1408b9){while(--_0x1408b9){_0x102125['push'](_0x102125['shift']());}};_0x5725c8(++_0x1096f7);}(_0x775e,0xda));var _0xe775=function(_0x429282,_0x56e68e){_0x429282=_0x429282-0x0;var _0x54a18c=_0x775e[_0x429282];return _0x54a18c;};'use strict';var _=require(_0xe775('0x0'));var util=require(_0xe775('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe775('0x2'));var BPromise=require(_0xe775('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe775('0x4'));var rimraf=require(_0xe775('0x5'));var config=require('../../config/environment');var attributes=require(_0xe775('0x6'));module[_0xe775('0x7')]=function(_0x3f4f66,_0x19cda5){return _0x3f4f66[_0xe775('0x8')](_0xe775('0x9'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xe775('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index aa7c0ac..10b90f7 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 _0x7bd0=['callRecordingEncryption','create','existsSync','value','format','%s.cypher','encryptFile','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','VoiceRecording','update','body','options','raw','attributes','UpdateVoiceRecording','CreateVoiceRecording','Setting','findOne'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0x7bd0,0x111));var _0x07bd=function(_0x119280,_0x439c3e){_0x119280=_0x119280-0x0;var _0x481797=_0x7bd0[_0x119280];return _0x481797;};'use strict';var _=require(_0x07bd('0x0'));var util=require(_0x07bd('0x1'));var moment=require(_0x07bd('0x2'));var BPromise=require(_0x07bd('0x3'));var rs=require(_0x07bd('0x4'));var fs=require('fs');var Redis=require(_0x07bd('0x5'));var db=require(_0x07bd('0x6'))['db'];var utils=require(_0x07bd('0x7'));var logger=require('../../config/logger')(_0x07bd('0x8'));var config=require(_0x07bd('0x9'));var jayson=require(_0x07bd('0xa'));var client=jayson[_0x07bd('0xb')][_0x07bd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x422a22,_0x2e4cd1,_0x5a939d){return new BPromise(function(_0x3968d9,_0x5cd446){return client[_0x07bd('0xd')](_0x422a22,_0x5a939d)[_0x07bd('0xe')](function(_0x323724){logger['info'](_0x07bd('0xf'),_0x2e4cd1,_0x07bd('0x10'));logger[_0x07bd('0x11')](_0x07bd('0x12'),_0x2e4cd1,'request\x20sent',JSON[_0x07bd('0x13')](_0x323724));if(_0x323724[_0x07bd('0x14')]){if(_0x323724[_0x07bd('0x14')][_0x07bd('0x15')]===0x1f4){logger[_0x07bd('0x14')](_0x07bd('0xf'),_0x2e4cd1,_0x323724[_0x07bd('0x14')][_0x07bd('0x16')]);return _0x5cd446(_0x323724['error']['message']);}logger[_0x07bd('0x14')](_0x07bd('0xf'),_0x2e4cd1,_0x323724[_0x07bd('0x14')][_0x07bd('0x16')]);return _0x3968d9(_0x323724[_0x07bd('0x14')][_0x07bd('0x16')]);}else{logger[_0x07bd('0x17')]('VoiceRecording,\x20%s,\x20%s',_0x2e4cd1,_0x07bd('0x10'));_0x3968d9(_0x323724['result'][_0x07bd('0x16')]);}})[_0x07bd('0x18')](function(_0x31655a){logger[_0x07bd('0x14')](_0x07bd('0xf'),_0x2e4cd1,_0x31655a);_0x5cd446(_0x31655a);});});}exports['UpdateVoiceRecording']=function(_0x3f9f0b){var _0xc4cf4c=this;return new Promise(function(_0x4948f4,_0x3e8ec4){return db[_0x07bd('0x19')][_0x07bd('0x1a')](_0x3f9f0b[_0x07bd('0x1b')],{'raw':_0x3f9f0b[_0x07bd('0x1c')]?_0x3f9f0b[_0x07bd('0x1c')][_0x07bd('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f9f0b[_0x07bd('0x1c')]?_0x3f9f0b[_0x07bd('0x1c')]['where']||null:null,'attributes':_0x3f9f0b[_0x07bd('0x1c')]?_0x3f9f0b[_0x07bd('0x1c')][_0x07bd('0x1e')]||null:null,'limit':_0x3f9f0b[_0x07bd('0x1c')]?_0x3f9f0b[_0x07bd('0x1c')]['limit']||null:null})['then'](function(_0xbb7117){logger['info'](_0x07bd('0x1f'),_0x3f9f0b);logger['debug']('UpdateVoiceRecording',_0x3f9f0b,JSON[_0x07bd('0x13')](_0xbb7117));_0x4948f4(_0xbb7117);})[_0x07bd('0x18')](function(_0xf3b23c){logger[_0x07bd('0x14')](_0x07bd('0x1f'),_0xf3b23c[_0x07bd('0x16')],_0x3f9f0b);_0x3e8ec4(_0xc4cf4c['error'](0x1f4,_0xf3b23c[_0x07bd('0x16')]));});});};exports[_0x07bd('0x20')]=function(_0x3db9d0){var _0x2a7202=this;return new Promise(function(_0x12ce26,_0x1c1fda){var _0x571dab=require('../../components/encryptor');var _0x5184dc;return db[_0x07bd('0x21')][_0x07bd('0x22')]({'attributes':['id',_0x07bd('0x23')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x1a3aa9){_0x5184dc=_0x1a3aa9;return db[_0x07bd('0x19')][_0x07bd('0x24')](_0x3db9d0[_0x07bd('0x1b')]);})[_0x07bd('0xe')](function(_0x13bf6b){if(_0x5184dc['callRecordingEncryption']&&fs[_0x07bd('0x25')](_0x13bf6b[_0x07bd('0x26')])){var _0x4182b9=util[_0x07bd('0x27')](_0x07bd('0x28'),_0x13bf6b[_0x07bd('0x26')]);return _0x571dab[_0x07bd('0x29')](_0x13bf6b[_0x07bd('0x26')],_0x4182b9,config['secrets']['recording'])[_0x07bd('0xe')](function(){fs[_0x07bd('0x2a')](_0x13bf6b[_0x07bd('0x26')]);logger['info'](_0x07bd('0x2b'));return _0x13bf6b;});}return _0x13bf6b;})[_0x07bd('0xe')](function(_0x208aca){logger['info']('CreateVoiceRecording',_0x3db9d0);logger[_0x07bd('0x11')](_0x07bd('0x20'),_0x3db9d0,JSON[_0x07bd('0x13')](_0x208aca));_0x12ce26(_0x208aca);})[_0x07bd('0x18')](function(_0x5f29c5){logger[_0x07bd('0x14')](_0x07bd('0x20'),_0x5f29c5[_0x07bd('0x16')],_0x3db9d0);_0x1c1fda(_0x2a7202['error'](0x1f4,_0x5f29c5[_0x07bd('0x16')]));});});}; \ No newline at end of file +var _0x0295=['client','http','then','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','limit','UpdateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1f6154,_0x91c64e){var _0x8326c6=function(_0x3ef8b7){while(--_0x3ef8b7){_0x1f6154['push'](_0x1f6154['shift']());}};_0x8326c6(++_0x91c64e);}(_0x0295,0x1f0));var _0x5029=function(_0x2df3c1,_0x35b259){_0x2df3c1=_0x2df3c1-0x0;var _0xbfaae3=_0x0295[_0x2df3c1];return _0xbfaae3;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5029('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5029('0x2'))['db'];var utils=require(_0x5029('0x3'));var logger=require(_0x5029('0x4'))(_0x5029('0x5'));var config=require(_0x5029('0x6'));var jayson=require(_0x5029('0x7'));var client=jayson[_0x5029('0x8')][_0x5029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3cd,_0x502a62,_0x54978f){return new BPromise(function(_0x4ee867,_0xf4459b){return client['request'](_0x5b3cd,_0x54978f)[_0x5029('0xa')](function(_0x5bccfc){logger[_0x5029('0xb')]('VoiceRecording,\x20%s,\x20%s',_0x502a62,_0x5029('0xc'));logger[_0x5029('0xd')](_0x5029('0xe'),_0x502a62,'request\x20sent',JSON[_0x5029('0xf')](_0x5bccfc));if(_0x5bccfc[_0x5029('0x10')]){if(_0x5bccfc[_0x5029('0x10')]['code']===0x1f4){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc['error']['message']);return _0xf4459b(_0x5bccfc['error']['message']);}logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);return _0x4ee867(_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);}else{logger[_0x5029('0xb')](_0x5029('0x11'),_0x502a62,_0x5029('0xc'));_0x4ee867(_0x5bccfc[_0x5029('0x13')][_0x5029('0x12')]);}})[_0x5029('0x14')](function(_0x3786b5){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x3786b5);_0xf4459b(_0x3786b5);});});}exports['UpdateVoiceRecording']=function(_0x1ed567){var _0x31a155=this;return new Promise(function(_0x35de81,_0x4902f3){return db[_0x5029('0x15')][_0x5029('0x16')](_0x1ed567[_0x5029('0x17')],{'raw':_0x1ed567['options']?_0x1ed567[_0x5029('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ed567[_0x5029('0x18')]?_0x1ed567[_0x5029('0x18')][_0x5029('0x19')]||null:null,'attributes':_0x1ed567[_0x5029('0x18')]?_0x1ed567['options']['attributes']||null:null,'limit':_0x1ed567[_0x5029('0x18')]?_0x1ed567['options'][_0x5029('0x1a')]||null:null})[_0x5029('0xa')](function(_0x1eb228){logger[_0x5029('0xb')](_0x5029('0x1b'),_0x1ed567);logger[_0x5029('0xd')](_0x5029('0x1b'),_0x1ed567,JSON[_0x5029('0xf')](_0x1eb228));_0x35de81(_0x1eb228);})[_0x5029('0x14')](function(_0x4ceaae){logger['error']('UpdateVoiceRecording',_0x4ceaae[_0x5029('0x12')],_0x1ed567);_0x4902f3(_0x31a155[_0x5029('0x10')](0x1f4,_0x4ceaae['message']));});});};exports['CreateVoiceRecording']=function(_0x181da0){var _0x1e7e61=this;return new Promise(function(_0x36d810,_0x5527fc){var _0x2c501f=require(_0x5029('0x1c'));var _0x5e45c4;return db[_0x5029('0x1d')][_0x5029('0x1e')]({'attributes':['id',_0x5029('0x1f')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x32da06){_0x5e45c4=_0x32da06;return db[_0x5029('0x15')][_0x5029('0x20')](_0x181da0['body']);})[_0x5029('0xa')](function(_0x2bb398){if(_0x5e45c4['callRecordingEncryption']&&fs[_0x5029('0x21')](_0x2bb398[_0x5029('0x22')])){var _0x4434ff=util[_0x5029('0x23')](_0x5029('0x24'),_0x2bb398[_0x5029('0x22')]);return _0x2c501f[_0x5029('0x25')](_0x2bb398[_0x5029('0x22')],_0x4434ff,config[_0x5029('0x26')][_0x5029('0x27')])[_0x5029('0xa')](function(){fs[_0x5029('0x28')](_0x2bb398['value']);logger[_0x5029('0xb')]('CreateVoiceRecording\x20file\x20encrypted');return _0x2bb398;});}return _0x2bb398;})[_0x5029('0xa')](function(_0x4f672e){logger['info'](_0x5029('0x29'),_0x181da0);logger[_0x5029('0xd')](_0x5029('0x29'),_0x181da0,JSON['stringify'](_0x4f672e));_0x36d810(_0x4f672e);})[_0x5029('0x14')](function(_0x15d882){logger[_0x5029('0x10')](_0x5029('0x29'),_0x15d882[_0x5029('0x12')],_0x181da0);_0x5527fc(_0x1e7e61[_0x5029('0x10')](0x1f4,_0x15d882[_0x5029('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 057a930..69b25f0 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 _0xc83b=['describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index'];(function(_0x3ac463,_0x94bb9){var _0x499738=function(_0x194722){while(--_0x194722){_0x3ac463['push'](_0x3ac463['shift']());}};_0x499738(++_0x94bb9);}(_0xc83b,0x145));var _0xbc83=function(_0x4a0495,_0x38c733){_0x4a0495=_0x4a0495-0x0;var _0x2dc986=_0xc83b[_0x4a0495];return _0x2dc986;};'use strict';var multer=require(_0xbc83('0x0'));var util=require(_0xbc83('0x1'));var path=require('path');var timeout=require(_0xbc83('0x2'));var express=require('express');var router=express[_0xbc83('0x3')]();var fs_extra=require(_0xbc83('0x4'));var auth=require(_0xbc83('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbc83('0x6'));var controller=require(_0xbc83('0x7'));router[_0xbc83('0x8')]('/',auth[_0xbc83('0x9')](),controller[_0xbc83('0xa')]);router[_0xbc83('0x8')]('/describe',auth[_0xbc83('0x9')](),controller[_0xbc83('0xb')]);router[_0xbc83('0x8')]('/:id',auth[_0xbc83('0x9')](),controller[_0xbc83('0xc')]);router[_0xbc83('0xd')]('/',auth[_0xbc83('0x9')](),controller[_0xbc83('0xe')]);router[_0xbc83('0xf')](_0xbc83('0x10'),auth[_0xbc83('0x9')](),controller[_0xbc83('0x11')]);router[_0xbc83('0x12')](_0xbc83('0x10'),auth[_0xbc83('0x9')](),controller[_0xbc83('0x13')]);module[_0xbc83('0x14')]=router; \ No newline at end of file +var _0x696d=['fs-extra','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','/describe','show','put','/:id','delete','exports','multer','express','Router'];(function(_0x12b8ec,_0x1655be){var _0x21af77=function(_0xe59f){while(--_0xe59f){_0x12b8ec['push'](_0x12b8ec['shift']());}};_0x21af77(++_0x1655be);}(_0x696d,0x66));var _0xd696=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x696d[_0x13e741];return _0x3f8bb3;};'use strict';var multer=require(_0xd696('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd696('0x1'));var router=express[_0xd696('0x2')]();var fs_extra=require(_0xd696('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xd696('0x4'));var config=require(_0xd696('0x5'));var controller=require(_0xd696('0x6'));router[_0xd696('0x7')]('/',auth[_0xd696('0x8')](),controller['index']);router[_0xd696('0x7')](_0xd696('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xd696('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xd696('0xa')]);router['post']('/',auth[_0xd696('0x8')](),controller['create']);router[_0xd696('0xb')](_0xd696('0xc'),auth[_0xd696('0x8')](),controller['update']);router[_0xd696('0xd')](_0xd696('0xc'),auth[_0xd696('0x8')](),controller['destroy']);module[_0xd696('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 37e1970..4958a7f 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 _0x5fb9=['moment','exports','blind','attended','STRING','ENUM','sequelize'];(function(_0x36530c,_0x45a523){var _0x24ed93=function(_0x2a7e36){while(--_0x2a7e36){_0x36530c['push'](_0x36530c['shift']());}};_0x24ed93(++_0x45a523);}(_0x5fb9,0x99));var _0x95fb=function(_0x9e87ed,_0x4443c3){_0x9e87ed=_0x9e87ed-0x0;var _0xc7bdeb=_0x5fb9[_0x9e87ed];return _0xc7bdeb;};'use strict';var Sequelize=require(_0x95fb('0x0'));var moment=require(_0x95fb('0x1'));module[_0x95fb('0x2')]={'type':{'type':Sequelize['ENUM'](_0x95fb('0x3'),_0x95fb('0x4'))},'result':{'type':Sequelize[_0x95fb('0x5')]},'transfererchannel':{'type':Sequelize[_0x95fb('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x95fb('0x5')]},'transferercalleridname':{'type':Sequelize[_0x95fb('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x95fb('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x95fb('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x95fb('0x5')]},'transferercontext':{'type':Sequelize[_0x95fb('0x5')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x95fb('0x5')]},'transfereechannel':{'type':Sequelize[_0x95fb('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x95fb('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x95fb('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x95fb('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x95fb('0x5')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x95fb('0x5')]},'transfereeexten':{'type':Sequelize[_0x95fb('0x5')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x95fb('0x6')]('Yes','No')},'context':{'type':Sequelize[_0x95fb('0x5')]},'extension':{'type':Sequelize[_0x95fb('0x5')]}}; \ No newline at end of file +var _0xca73=['attended','STRING','Yes','moment','exports','ENUM','blind'];(function(_0x1a30ff,_0x2881b7){var _0x3eeefc=function(_0x28ae91){while(--_0x28ae91){_0x1a30ff['push'](_0x1a30ff['shift']());}};_0x3eeefc(++_0x2881b7);}(_0xca73,0x13e));var _0x3ca7=function(_0x8353d0,_0x592d3f){_0x8353d0=_0x8353d0-0x0;var _0x52ee64=_0xca73[_0x8353d0];return _0x52ee64;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x3ca7('0x0'));module[_0x3ca7('0x1')]={'type':{'type':Sequelize[_0x3ca7('0x2')](_0x3ca7('0x3'),_0x3ca7('0x4'))},'result':{'type':Sequelize[_0x3ca7('0x5')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x3ca7('0x5')]},'transferercalleridname':{'type':Sequelize[_0x3ca7('0x5')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x3ca7('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x3ca7('0x5')]},'transferercontext':{'type':Sequelize[_0x3ca7('0x5')]},'transfererexten':{'type':Sequelize[_0x3ca7('0x5')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x3ca7('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x3ca7('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x3ca7('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x3ca7('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x3ca7('0x5')]},'transfereecontext':{'type':Sequelize[_0x3ca7('0x5')]},'transfereeexten':{'type':Sequelize[_0x3ca7('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x3ca7('0x5')]},'isexternal':{'type':Sequelize[_0x3ca7('0x2')](_0x3ca7('0x6'),'No')},'context':{'type':Sequelize[_0x3ca7('0x5')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 0cbc519..e9a14d6 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 _0x2b9a=['crypto','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','end','status','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','VoiceTransferReport','catch','show','keys','includeAll','include','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel'];(function(_0xeb06b4,_0x1840e1){var _0x10226c=function(_0x15d2f9){while(--_0x15d2f9){_0xeb06b4['push'](_0xeb06b4['shift']());}};_0x10226c(++_0x1840e1);}(_0x2b9a,0x8b));var _0xa2b9=function(_0x2b505b,_0x27d646){_0x2b505b=_0x2b505b-0x0;var _0x17ce82=_0x2b9a[_0x2b505b];return _0x17ce82;};'use strict';var emlformat=require(_0xa2b9('0x0'));var rimraf=require(_0xa2b9('0x1'));var zipdir=require(_0xa2b9('0x2'));var jsonpatch=require(_0xa2b9('0x3'));var rp=require(_0xa2b9('0x4'));var moment=require('moment');var BPromise=require(_0xa2b9('0x5'));var Mustache=require(_0xa2b9('0x6'));var util=require(_0xa2b9('0x7'));var path=require(_0xa2b9('0x8'));var sox=require('sox');var csv=require(_0xa2b9('0x9'));var ejs=require(_0xa2b9('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa2b9('0xb'));var squel=require(_0xa2b9('0xc'));var crypto=require(_0xa2b9('0xd'));var jsforce=require(_0xa2b9('0xe'));var deskjs=require(_0xa2b9('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa2b9('0x10'));var Papa=require(_0xa2b9('0x11'));var Redis=require('ioredis');var authService=require(_0xa2b9('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa2b9('0x13'));var hardwareService=require(_0xa2b9('0x14'));var logger=require(_0xa2b9('0x15'))(_0xa2b9('0x16'));var utils=require(_0xa2b9('0x17'));var config=require(_0xa2b9('0x18'));var licenseUtil=require(_0xa2b9('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18b4cb,_0x58cf51){_0x58cf51=_0x58cf51||0xcc;return function(_0x331f13){if(_0x331f13){return _0x18b4cb[_0xa2b9('0x1a')](_0x58cf51);}return _0x18b4cb['status'](_0x58cf51)[_0xa2b9('0x1b')]();};}function respondWithResult(_0x7a0eda,_0x183beb){_0x183beb=_0x183beb||0xc8;return function(_0x382332){if(_0x382332){return _0x7a0eda[_0xa2b9('0x1c')](_0x183beb)[_0xa2b9('0x1d')](_0x382332);}};}function respondWithFilteredResult(_0x5233a8,_0x2c4356){return function(_0x5c8191){if(_0x5c8191){var _0x94657c=typeof _0x2c4356[_0xa2b9('0x1e')]===_0xa2b9('0x1f')&&typeof _0x2c4356[_0xa2b9('0x20')]===_0xa2b9('0x1f');var _0x5861cd=_0x5c8191['count'];var _0x3fc1ea=_0x94657c?0x0:_0x2c4356[_0xa2b9('0x1e')];var _0x1bac39=_0x94657c?_0x5c8191[_0xa2b9('0x21')]:_0x2c4356[_0xa2b9('0x1e')]+_0x2c4356[_0xa2b9('0x20')];var _0x1de6d7;if(_0x1bac39>=_0x5861cd){_0x1bac39=_0x5861cd;_0x1de6d7=0xc8;}else{_0x1de6d7=0xce;}_0x5233a8[_0xa2b9('0x1c')](_0x1de6d7);return _0x5233a8['set']('Content-Range',_0x3fc1ea+'-'+_0x1bac39+'/'+_0x5861cd)[_0xa2b9('0x1d')](_0x5c8191);}return null;};}function patchUpdates(_0x5c307c){return function(_0x1949fb){try{jsonpatch[_0xa2b9('0x22')](_0x1949fb,_0x5c307c,!![]);}catch(_0x258467){return BPromise[_0xa2b9('0x23')](_0x258467);}return _0x1949fb[_0xa2b9('0x24')]();};}function saveUpdates(_0x17cba2,_0x18b0eb){return function(_0x1d324f){if(_0x1d324f){return _0x1d324f[_0xa2b9('0x25')](_0x17cba2)[_0xa2b9('0x26')](function(_0x5200bc){return _0x5200bc;});}return null;};}function removeEntity(_0x5b165f,_0x5c9d12){return function(_0x1a9e4b){if(_0x1a9e4b){return _0x1a9e4b[_0xa2b9('0x27')]()[_0xa2b9('0x26')](function(){_0x5b165f[_0xa2b9('0x1c')](0xcc)[_0xa2b9('0x1b')]();});}};}function handleEntityNotFound(_0x1ce091,_0x49e66f){return function(_0x45f4ba){if(!_0x45f4ba){_0x1ce091[_0xa2b9('0x1a')](0x194);}return _0x45f4ba;};}function handleError(_0xa20724,_0x48f9fe){_0x48f9fe=_0x48f9fe||0x1f4;return function(_0x2e06e2){logger[_0xa2b9('0x28')](_0x2e06e2[_0xa2b9('0x29')]);if(_0x2e06e2[_0xa2b9('0x2a')]){delete _0x2e06e2[_0xa2b9('0x2a')];}_0xa20724[_0xa2b9('0x1c')](_0x48f9fe)[_0xa2b9('0x2b')](_0x2e06e2);};}exports[_0xa2b9('0x2c')]=function(_0x32092e,_0x1511be){var _0x392358={},_0xe3b9b4={},_0x10750d={'count':0x0,'rows':[]};var _0x870eb5=_[_0xa2b9('0x2d')](db['VoiceTransferReport'][_0xa2b9('0x2e')],function(_0x4f6ff5){return{'name':_0x4f6ff5['fieldName'],'type':_0x4f6ff5[_0xa2b9('0x2f')][_0xa2b9('0x30')]};});_0xe3b9b4[_0xa2b9('0x31')]=_[_0xa2b9('0x2d')](_0x870eb5,'name');_0xe3b9b4[_0xa2b9('0x32')]=_['keys'](_0x32092e[_0xa2b9('0x32')]);_0xe3b9b4[_0xa2b9('0x33')]=_[_0xa2b9('0x34')](_0xe3b9b4[_0xa2b9('0x31')],_0xe3b9b4[_0xa2b9('0x32')]);_0x392358[_0xa2b9('0x35')]=_[_0xa2b9('0x34')](_0xe3b9b4[_0xa2b9('0x31')],qs[_0xa2b9('0x36')](_0x32092e[_0xa2b9('0x32')][_0xa2b9('0x36')]));_0x392358[_0xa2b9('0x35')]=_0x392358['attributes'][_0xa2b9('0x37')]?_0x392358[_0xa2b9('0x35')]:_0xe3b9b4['model'];if(!_0x32092e[_0xa2b9('0x32')][_0xa2b9('0x38')](_0xa2b9('0x39'))){_0x392358['limit']=qs[_0xa2b9('0x20')](_0x32092e[_0xa2b9('0x32')][_0xa2b9('0x20')]);_0x392358[_0xa2b9('0x1e')]=qs[_0xa2b9('0x1e')](_0x32092e['query']['offset']);}_0x392358['order']=qs[_0xa2b9('0x3a')](_0x32092e[_0xa2b9('0x32')]['sort']);_0x392358[_0xa2b9('0x3b')]=qs['filters'](_[_0xa2b9('0x3c')](_0x32092e[_0xa2b9('0x32')],_0xe3b9b4[_0xa2b9('0x33')]),_0x870eb5);if(_0x32092e[_0xa2b9('0x32')][_0xa2b9('0x3d')]){_0x392358[_0xa2b9('0x3b')]=_[_0xa2b9('0x3e')](_0x392358['where'],{'$or':_[_0xa2b9('0x2d')](_0x870eb5,function(_0x24fa5e){if(_0x24fa5e[_0xa2b9('0x2f')]!==_0xa2b9('0x3f')){var _0x229bd1={};_0x229bd1[_0x24fa5e['name']]={'$like':'%'+_0x32092e['query'][_0xa2b9('0x3d')]+'%'};return _0x229bd1;}})});}_0x392358=_['merge']({},_0x392358,_0x32092e[_0xa2b9('0x40')]);var _0x1ffa1f={'where':_0x392358[_0xa2b9('0x3b')]};return db[_0xa2b9('0x41')][_0xa2b9('0x21')](_0x1ffa1f)[_0xa2b9('0x26')](function(_0x285c67){_0x10750d[_0xa2b9('0x21')]=_0x285c67;if(_0x32092e[_0xa2b9('0x32')]['includeAll']){_0x392358['include']=[{'all':!![]}];}return db[_0xa2b9('0x41')]['findAll'](_0x392358);})[_0xa2b9('0x26')](function(_0x533349){_0x10750d['rows']=_0x533349;return _0x10750d;})[_0xa2b9('0x26')](respondWithFilteredResult(_0x1511be,_0x392358))[_0xa2b9('0x42')](handleError(_0x1511be,null));};exports[_0xa2b9('0x43')]=function(_0x364db4,_0x2a002f){var _0x4cb00f={'raw':!![],'where':{'id':_0x364db4['params']['id']}},_0x527680={};_0x527680[_0xa2b9('0x31')]=_['keys'](db[_0xa2b9('0x41')][_0xa2b9('0x2e')]);_0x527680['query']=_[_0xa2b9('0x44')](_0x364db4['query']);_0x527680[_0xa2b9('0x33')]=_[_0xa2b9('0x34')](_0x527680['model'],_0x527680[_0xa2b9('0x32')]);_0x4cb00f[_0xa2b9('0x35')]=_[_0xa2b9('0x34')](_0x527680['model'],qs[_0xa2b9('0x36')](_0x364db4[_0xa2b9('0x32')][_0xa2b9('0x36')]));_0x4cb00f[_0xa2b9('0x35')]=_0x4cb00f[_0xa2b9('0x35')][_0xa2b9('0x37')]?_0x4cb00f['attributes']:_0x527680[_0xa2b9('0x31')];if(_0x364db4[_0xa2b9('0x32')][_0xa2b9('0x45')]){_0x4cb00f[_0xa2b9('0x46')]=[{'all':!![]}];}_0x4cb00f=_['merge']({},_0x4cb00f,_0x364db4[_0xa2b9('0x40')]);return db[_0xa2b9('0x41')][_0xa2b9('0x47')](_0x4cb00f)[_0xa2b9('0x26')](handleEntityNotFound(_0x2a002f,null))['then'](respondWithResult(_0x2a002f,null))['catch'](handleError(_0x2a002f,null));};exports[_0xa2b9('0x48')]=function(_0xe16928,_0x8163f8){return db[_0xa2b9('0x41')]['create'](_0xe16928[_0xa2b9('0x49')],{})[_0xa2b9('0x26')](respondWithResult(_0x8163f8,0xc9))[_0xa2b9('0x42')](handleError(_0x8163f8,null));};exports['update']=function(_0x435b58,_0x19504c){if(_0x435b58[_0xa2b9('0x49')]['id']){delete _0x435b58[_0xa2b9('0x49')]['id'];}return db['VoiceTransferReport'][_0xa2b9('0x47')]({'where':{'id':_0x435b58[_0xa2b9('0x4a')]['id']}})[_0xa2b9('0x26')](handleEntityNotFound(_0x19504c,null))['then'](saveUpdates(_0x435b58[_0xa2b9('0x49')],null))['then'](respondWithResult(_0x19504c,null))[_0xa2b9('0x42')](handleError(_0x19504c,null));};exports[_0xa2b9('0x27')]=function(_0x3f61ba,_0x278d58){return db['VoiceTransferReport'][_0xa2b9('0x47')]({'where':{'id':_0x3f61ba[_0xa2b9('0x4a')]['id']}})[_0xa2b9('0x26')](handleEntityNotFound(_0x278d58,null))[_0xa2b9('0x26')](removeEntity(_0x278d58,null))[_0xa2b9('0x42')](handleError(_0x278d58,null));};exports[_0xa2b9('0x4b')]=function(_0x497be3,_0x283252){return db[_0xa2b9('0x41')][_0xa2b9('0x4b')]()[_0xa2b9('0x26')](respondWithResult(_0x283252,null))['catch'](handleError(_0x283252,null));}; \ No newline at end of file +var _0x1b8c=['status','end','offset','limit','undefined','count','set','reject','update','then','stack','name','send','index','map','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','VoiceTransferReport','includeAll','include','findAll','rows','find','create','body','params','catch','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1b8c,0x1d9));var _0xc1b8=function(_0x26bf29,_0x3fb95d){_0x26bf29=_0x26bf29-0x0;var _0x5241a5=_0x1b8c[_0x26bf29];return _0x5241a5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc1b8('0x0'));var zipdir=require(_0xc1b8('0x1'));var jsonpatch=require(_0xc1b8('0x2'));var rp=require(_0xc1b8('0x3'));var moment=require(_0xc1b8('0x4'));var BPromise=require(_0xc1b8('0x5'));var Mustache=require('mustache');var util=require(_0xc1b8('0x6'));var path=require(_0xc1b8('0x7'));var sox=require(_0xc1b8('0x8'));var csv=require('to-csv');var ejs=require(_0xc1b8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc1b8('0xa'));var squel=require(_0xc1b8('0xb'));var crypto=require(_0xc1b8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc1b8('0xd'));var toCsv=require(_0xc1b8('0xe'));var querystring=require(_0xc1b8('0xf'));var Papa=require(_0xc1b8('0x10'));var Redis=require(_0xc1b8('0x11'));var authService=require(_0xc1b8('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc1b8('0x13'))(_0xc1b8('0x14'));var utils=require('../../config/utils');var config=require(_0xc1b8('0x15'));var licenseUtil=require(_0xc1b8('0x16'));var db=require(_0xc1b8('0x17'))['db'];function respondWithStatusCode(_0x286eb0,_0x57b374){_0x57b374=_0x57b374||0xcc;return function(_0xfeea){if(_0xfeea){return _0x286eb0['sendStatus'](_0x57b374);}return _0x286eb0[_0xc1b8('0x18')](_0x57b374)[_0xc1b8('0x19')]();};}function respondWithResult(_0x2a5d2b,_0x2f39c9){_0x2f39c9=_0x2f39c9||0xc8;return function(_0x23c943){if(_0x23c943){return _0x2a5d2b[_0xc1b8('0x18')](_0x2f39c9)['json'](_0x23c943);}};}function respondWithFilteredResult(_0x264618,_0x5dca60){return function(_0x338f98){if(_0x338f98){var _0x102386=typeof _0x5dca60[_0xc1b8('0x1a')]==='undefined'&&typeof _0x5dca60[_0xc1b8('0x1b')]===_0xc1b8('0x1c');var _0x2643c4=_0x338f98[_0xc1b8('0x1d')];var _0x5d76ce=_0x102386?0x0:_0x5dca60['offset'];var _0x303f3=_0x102386?_0x338f98[_0xc1b8('0x1d')]:_0x5dca60['offset']+_0x5dca60[_0xc1b8('0x1b')];var _0x800916;if(_0x303f3>=_0x2643c4){_0x303f3=_0x2643c4;_0x800916=0xc8;}else{_0x800916=0xce;}_0x264618[_0xc1b8('0x18')](_0x800916);return _0x264618[_0xc1b8('0x1e')]('Content-Range',_0x5d76ce+'-'+_0x303f3+'/'+_0x2643c4)['json'](_0x338f98);}return null;};}function patchUpdates(_0x1b1cd6){return function(_0x6ee1be){try{jsonpatch['apply'](_0x6ee1be,_0x1b1cd6,!![]);}catch(_0x14fac9){return BPromise[_0xc1b8('0x1f')](_0x14fac9);}return _0x6ee1be['save']();};}function saveUpdates(_0x49b88d,_0x24e9a5){return function(_0x3a4171){if(_0x3a4171){return _0x3a4171[_0xc1b8('0x20')](_0x49b88d)[_0xc1b8('0x21')](function(_0x251a71){return _0x251a71;});}return null;};}function removeEntity(_0x5334e3,_0x17e4d3){return function(_0x52c6a4){if(_0x52c6a4){return _0x52c6a4['destroy']()['then'](function(){_0x5334e3[_0xc1b8('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xdf9866,_0x3f5ef0){return function(_0x4f6fe6){if(!_0x4f6fe6){_0xdf9866['sendStatus'](0x194);}return _0x4f6fe6;};}function handleError(_0x560a51,_0x369d60){_0x369d60=_0x369d60||0x1f4;return function(_0x7354f2){logger['error'](_0x7354f2[_0xc1b8('0x22')]);if(_0x7354f2[_0xc1b8('0x23')]){delete _0x7354f2[_0xc1b8('0x23')];}_0x560a51[_0xc1b8('0x18')](_0x369d60)[_0xc1b8('0x24')](_0x7354f2);};}exports[_0xc1b8('0x25')]=function(_0x235fc5,_0xb0c632){var _0x115868={},_0x286923={},_0x11c169={'count':0x0,'rows':[]};var _0x5b5092=_[_0xc1b8('0x26')](db['VoiceTransferReport']['rawAttributes'],function(_0x42acd3){return{'name':_0x42acd3[_0xc1b8('0x27')],'type':_0x42acd3['type'][_0xc1b8('0x28')]};});_0x286923['model']=_[_0xc1b8('0x26')](_0x5b5092,_0xc1b8('0x23'));_0x286923[_0xc1b8('0x29')]=_[_0xc1b8('0x2a')](_0x235fc5[_0xc1b8('0x29')]);_0x286923[_0xc1b8('0x2b')]=_[_0xc1b8('0x2c')](_0x286923[_0xc1b8('0x2d')],_0x286923[_0xc1b8('0x29')]);_0x115868[_0xc1b8('0x2e')]=_[_0xc1b8('0x2c')](_0x286923['model'],qs[_0xc1b8('0x2f')](_0x235fc5[_0xc1b8('0x29')][_0xc1b8('0x2f')]));_0x115868[_0xc1b8('0x2e')]=_0x115868[_0xc1b8('0x2e')][_0xc1b8('0x30')]?_0x115868[_0xc1b8('0x2e')]:_0x286923[_0xc1b8('0x2d')];if(!_0x235fc5['query'][_0xc1b8('0x31')](_0xc1b8('0x32'))){_0x115868[_0xc1b8('0x1b')]=qs[_0xc1b8('0x1b')](_0x235fc5[_0xc1b8('0x29')][_0xc1b8('0x1b')]);_0x115868[_0xc1b8('0x1a')]=qs['offset'](_0x235fc5[_0xc1b8('0x29')][_0xc1b8('0x1a')]);}_0x115868['order']=qs[_0xc1b8('0x33')](_0x235fc5[_0xc1b8('0x29')][_0xc1b8('0x33')]);_0x115868[_0xc1b8('0x34')]=qs[_0xc1b8('0x2b')](_[_0xc1b8('0x35')](_0x235fc5[_0xc1b8('0x29')],_0x286923[_0xc1b8('0x2b')]),_0x5b5092);if(_0x235fc5[_0xc1b8('0x29')]['filter']){_0x115868[_0xc1b8('0x34')]=_[_0xc1b8('0x36')](_0x115868[_0xc1b8('0x34')],{'$or':_[_0xc1b8('0x26')](_0x5b5092,function(_0x21eefd){if(_0x21eefd[_0xc1b8('0x37')]!==_0xc1b8('0x38')){var _0x4ba1cf={};_0x4ba1cf[_0x21eefd['name']]={'$like':'%'+_0x235fc5[_0xc1b8('0x29')][_0xc1b8('0x39')]+'%'};return _0x4ba1cf;}})});}_0x115868=_[_0xc1b8('0x36')]({},_0x115868,_0x235fc5[_0xc1b8('0x3a')]);var _0x3180f0={'where':_0x115868[_0xc1b8('0x34')]};return db[_0xc1b8('0x3b')][_0xc1b8('0x1d')](_0x3180f0)[_0xc1b8('0x21')](function(_0x4d7b53){_0x11c169[_0xc1b8('0x1d')]=_0x4d7b53;if(_0x235fc5['query'][_0xc1b8('0x3c')]){_0x115868[_0xc1b8('0x3d')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0xc1b8('0x3e')](_0x115868);})[_0xc1b8('0x21')](function(_0x12128f){_0x11c169[_0xc1b8('0x3f')]=_0x12128f;return _0x11c169;})[_0xc1b8('0x21')](respondWithFilteredResult(_0xb0c632,_0x115868))['catch'](handleError(_0xb0c632,null));};exports['show']=function(_0x2fb2c5,_0x556ef3){var _0x3047e7={'raw':!![],'where':{'id':_0x2fb2c5['params']['id']}},_0x545b66={};_0x545b66[_0xc1b8('0x2d')]=_[_0xc1b8('0x2a')](db[_0xc1b8('0x3b')]['rawAttributes']);_0x545b66['query']=_['keys'](_0x2fb2c5[_0xc1b8('0x29')]);_0x545b66[_0xc1b8('0x2b')]=_[_0xc1b8('0x2c')](_0x545b66[_0xc1b8('0x2d')],_0x545b66[_0xc1b8('0x29')]);_0x3047e7['attributes']=_[_0xc1b8('0x2c')](_0x545b66[_0xc1b8('0x2d')],qs['fields'](_0x2fb2c5[_0xc1b8('0x29')][_0xc1b8('0x2f')]));_0x3047e7['attributes']=_0x3047e7['attributes'][_0xc1b8('0x30')]?_0x3047e7[_0xc1b8('0x2e')]:_0x545b66[_0xc1b8('0x2d')];if(_0x2fb2c5['query'][_0xc1b8('0x3c')]){_0x3047e7[_0xc1b8('0x3d')]=[{'all':!![]}];}_0x3047e7=_['merge']({},_0x3047e7,_0x2fb2c5[_0xc1b8('0x3a')]);return db['VoiceTransferReport'][_0xc1b8('0x40')](_0x3047e7)[_0xc1b8('0x21')](handleEntityNotFound(_0x556ef3,null))[_0xc1b8('0x21')](respondWithResult(_0x556ef3,null))['catch'](handleError(_0x556ef3,null));};exports[_0xc1b8('0x41')]=function(_0x102573,_0x3691f8){return db[_0xc1b8('0x3b')][_0xc1b8('0x41')](_0x102573[_0xc1b8('0x42')],{})['then'](respondWithResult(_0x3691f8,0xc9))['catch'](handleError(_0x3691f8,null));};exports[_0xc1b8('0x20')]=function(_0x19387f,_0x392297){if(_0x19387f[_0xc1b8('0x42')]['id']){delete _0x19387f[_0xc1b8('0x42')]['id'];}return db['VoiceTransferReport'][_0xc1b8('0x40')]({'where':{'id':_0x19387f[_0xc1b8('0x43')]['id']}})[_0xc1b8('0x21')](handleEntityNotFound(_0x392297,null))[_0xc1b8('0x21')](saveUpdates(_0x19387f[_0xc1b8('0x42')],null))[_0xc1b8('0x21')](respondWithResult(_0x392297,null))[_0xc1b8('0x44')](handleError(_0x392297,null));};exports[_0xc1b8('0x45')]=function(_0x2f8a60,_0x4e7d57){return db['VoiceTransferReport'][_0xc1b8('0x40')]({'where':{'id':_0x2f8a60[_0xc1b8('0x43')]['id']}})[_0xc1b8('0x21')](handleEntityNotFound(_0x4e7d57,null))['then'](removeEntity(_0x4e7d57,null))['catch'](handleError(_0x4e7d57,null));};exports[_0xc1b8('0x46')]=function(_0x5dce34,_0x552bcc){return db[_0xc1b8('0x3b')][_0xc1b8('0x46')]()[_0xc1b8('0x21')](respondWithResult(_0x552bcc,null))[_0xc1b8('0x44')](handleError(_0x552bcc,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 51753b7..81eb0b2 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 _0x4a65=['rimraf','../../config/environment','./voiceTransferReport.attributes','define','report_call_transfer','lodash','util','../../config/logger','api','request-promise'];(function(_0x5f2392,_0x45a5e7){var _0x574f39=function(_0x1f70d8){while(--_0x1f70d8){_0x5f2392['push'](_0x5f2392['shift']());}};_0x574f39(++_0x45a5e7);}(_0x4a65,0x181));var _0x54a6=function(_0x3b32f6,_0x450ee3){_0x3b32f6=_0x3b32f6-0x0;var _0x11f56c=_0x4a65[_0x3b32f6];return _0x11f56c;};'use strict';var _=require(_0x54a6('0x0'));var util=require(_0x54a6('0x1'));var logger=require(_0x54a6('0x2'))(_0x54a6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x54a6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x54a6('0x5'));var config=require(_0x54a6('0x6'));var attributes=require(_0x54a6('0x7'));module['exports']=function(_0x3de963,_0x38a830){return _0x3de963[_0x54a6('0x8')]('VoiceTransferReport',attributes,{'tableName':_0x54a6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x777a=['../../config/logger','api','bluebird','request-promise','path','define','VoiceTransferReport','lodash'];(function(_0x2c7895,_0x272f45){var _0xf95e08=function(_0x414a78){while(--_0x414a78){_0x2c7895['push'](_0x2c7895['shift']());}};_0xf95e08(++_0x272f45);}(_0x777a,0x137));var _0xa777=function(_0x547927,_0xc21079){_0x547927=_0x547927-0x0;var _0x924341=_0x777a[_0x547927];return _0x924341;};'use strict';var _=require(_0xa777('0x0'));var util=require('util');var logger=require(_0xa777('0x1'))(_0xa777('0x2'));var moment=require('moment');var BPromise=require(_0xa777('0x3'));var rp=require(_0xa777('0x4'));var fs=require('fs');var path=require(_0xa777('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceTransferReport.attributes');module['exports']=function(_0x1451ae,_0xcae826){return _0x1451ae[_0xa777('0x6')](_0xa777('0x7'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 0e2010f..ede5c16 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 _0x2a35=['VoiceTransferReport','create','options','raw','CreateVoiceTransferReport','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x55eaa9,_0x51228e){var _0x4e1c7e=function(_0x1f0999){while(--_0x1f0999){_0x55eaa9['push'](_0x55eaa9['shift']());}};_0x4e1c7e(++_0x51228e);}(_0x2a35,0x161));var _0x52a3=function(_0x11e444,_0x28f7dd){_0x11e444=_0x11e444-0x0;var _0xe20052=_0x2a35[_0x11e444];return _0xe20052;};'use strict';var _=require('lodash');var util=require(_0x52a3('0x0'));var moment=require('moment');var BPromise=require(_0x52a3('0x1'));var rs=require(_0x52a3('0x2'));var fs=require('fs');var Redis=require(_0x52a3('0x3'));var db=require(_0x52a3('0x4'))['db'];var utils=require(_0x52a3('0x5'));var logger=require(_0x52a3('0x6'))(_0x52a3('0x7'));var config=require('../../config/environment');var jayson=require(_0x52a3('0x8'));var client=jayson[_0x52a3('0x9')][_0x52a3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12d4c2,_0x339ef9,_0x20ec02){return new BPromise(function(_0x5e8094,_0x4c3fe5){return client[_0x52a3('0xb')](_0x12d4c2,_0x20ec02)[_0x52a3('0xc')](function(_0x560b09){logger[_0x52a3('0xd')](_0x52a3('0xe'),_0x339ef9,_0x52a3('0xf'));logger[_0x52a3('0x10')](_0x52a3('0x11'),_0x339ef9,_0x52a3('0xf'),JSON[_0x52a3('0x12')](_0x560b09));if(_0x560b09[_0x52a3('0x13')]){if(_0x560b09[_0x52a3('0x13')][_0x52a3('0x14')]===0x1f4){logger[_0x52a3('0x13')](_0x52a3('0xe'),_0x339ef9,_0x560b09[_0x52a3('0x13')][_0x52a3('0x15')]);return _0x4c3fe5(_0x560b09[_0x52a3('0x13')][_0x52a3('0x15')]);}logger[_0x52a3('0x13')](_0x52a3('0xe'),_0x339ef9,_0x560b09[_0x52a3('0x13')][_0x52a3('0x15')]);return _0x5e8094(_0x560b09[_0x52a3('0x13')][_0x52a3('0x15')]);}else{logger[_0x52a3('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x339ef9,_0x52a3('0xf'));_0x5e8094(_0x560b09[_0x52a3('0x16')][_0x52a3('0x15')]);}})[_0x52a3('0x17')](function(_0x4d406d){logger[_0x52a3('0x13')](_0x52a3('0xe'),_0x339ef9,_0x4d406d);_0x4c3fe5(_0x4d406d);});});}exports['CreateVoiceTransferReport']=function(_0x4a4565){var _0x282902=this;return new Promise(function(_0x4d32f3,_0x4429d2){return db[_0x52a3('0x18')][_0x52a3('0x19')](_0x4a4565['body'],{'raw':_0x4a4565['options']?_0x4a4565[_0x52a3('0x1a')][_0x52a3('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x1eb6e2){logger[_0x52a3('0xd')](_0x52a3('0x1c'),_0x4a4565);logger[_0x52a3('0x10')](_0x52a3('0x1c'),_0x4a4565,JSON[_0x52a3('0x12')](_0x1eb6e2));_0x4d32f3(_0x1eb6e2);})[_0x52a3('0x17')](function(_0xdf562f){logger[_0x52a3('0x13')]('CreateVoiceTransferReport',_0xdf562f['message'],_0x4a4565);_0x4429d2(_0x282902[_0x52a3('0x13')](0x1f4,_0xdf562f[_0x52a3('0x15')]));});});}; \ No newline at end of file +var _0x5345=['VoiceTransferReport','create','body','options','CreateVoiceTransferReport','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x2a1a31,_0x1b8b1a){var _0xe175e8=function(_0xa6f2c2){while(--_0xa6f2c2){_0x2a1a31['push'](_0x2a1a31['shift']());}};_0xe175e8(++_0x1b8b1a);}(_0x5345,0xa7));var _0x5534=function(_0x2169ad,_0x1f185e){_0x2169ad=_0x2169ad-0x0;var _0x3c8614=_0x5345[_0x2169ad];return _0x3c8614;};'use strict';var _=require('lodash');var util=require(_0x5534('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5534('0x1'));var fs=require('fs');var Redis=require(_0x5534('0x2'));var db=require(_0x5534('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5534('0x4'))(_0x5534('0x5'));var config=require(_0x5534('0x6'));var jayson=require(_0x5534('0x7'));var client=jayson[_0x5534('0x8')][_0x5534('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a5147,_0x582c56,_0x1f1483){return new BPromise(function(_0x541278,_0x3faf36){return client[_0x5534('0xa')](_0x4a5147,_0x1f1483)[_0x5534('0xb')](function(_0x403e91){logger[_0x5534('0xc')](_0x5534('0xd'),_0x582c56,_0x5534('0xe'));logger[_0x5534('0xf')](_0x5534('0x10'),_0x582c56,_0x5534('0xe'),JSON[_0x5534('0x11')](_0x403e91));if(_0x403e91[_0x5534('0x12')]){if(_0x403e91[_0x5534('0x12')][_0x5534('0x13')]===0x1f4){logger[_0x5534('0x12')](_0x5534('0xd'),_0x582c56,_0x403e91['error'][_0x5534('0x14')]);return _0x3faf36(_0x403e91[_0x5534('0x12')][_0x5534('0x14')]);}logger[_0x5534('0x12')](_0x5534('0xd'),_0x582c56,_0x403e91['error'][_0x5534('0x14')]);return _0x541278(_0x403e91['error'][_0x5534('0x14')]);}else{logger[_0x5534('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x582c56,_0x5534('0xe'));_0x541278(_0x403e91['result']['message']);}})[_0x5534('0x15')](function(_0x50f66f){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x582c56,_0x50f66f);_0x3faf36(_0x50f66f);});});}exports['CreateVoiceTransferReport']=function(_0x3f6af0){var _0x1b1756=this;return new Promise(function(_0x13c915,_0x449313){return db[_0x5534('0x16')][_0x5534('0x17')](_0x3f6af0[_0x5534('0x18')],{'raw':_0x3f6af0[_0x5534('0x19')]?_0x3f6af0[_0x5534('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x5534('0xb')](function(_0x108375){logger[_0x5534('0xc')](_0x5534('0x1a'),_0x3f6af0);logger[_0x5534('0xf')](_0x5534('0x1a'),_0x3f6af0,JSON[_0x5534('0x11')](_0x108375));_0x13c915(_0x108375);})[_0x5534('0x15')](function(_0x1d9351){logger['error'](_0x5534('0x1a'),_0x1d9351[_0x5534('0x14')],_0x3f6af0);_0x449313(_0x1b1756[_0x5534('0x12')](0x1f4,_0x1d9351[_0x5534('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index a3ff730..e729ca7 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 _0x9c7e=['/answer','answer','hold','/unhold','unhold','calls','/transfer','transfer','exports','Router','../../components/auth/service','/originate','canUpdate','originate','post','/hangup','isAuthenticated','hangup'];(function(_0x2f57c6,_0x401f36){var _0x47b7c0=function(_0x24532f){while(--_0x24532f){_0x2f57c6['push'](_0x2f57c6['shift']());}};_0x47b7c0(++_0x401f36);}(_0x9c7e,0x129));var _0xe9c7=function(_0x31bca3,_0x209a1e){_0x31bca3=_0x31bca3-0x0;var _0x2f10ea=_0x9c7e[_0x31bca3];return _0x2f10ea;};'use strict';var express=require('express');var router=express[_0xe9c7('0x0')]();var auth=require(_0xe9c7('0x1'));var controller=require('./webbar.controller');router['post'](_0xe9c7('0x2'),auth['isAuthenticated'](),auth[_0xe9c7('0x3')](),controller[_0xe9c7('0x4')]);router[_0xe9c7('0x5')](_0xe9c7('0x6'),auth[_0xe9c7('0x7')](),auth[_0xe9c7('0x3')](),controller[_0xe9c7('0x8')]);router[_0xe9c7('0x5')](_0xe9c7('0x9'),auth[_0xe9c7('0x7')](),auth[_0xe9c7('0x3')](),controller[_0xe9c7('0xa')]);router[_0xe9c7('0x5')]('/hold',auth[_0xe9c7('0x7')](),auth[_0xe9c7('0x3')](),controller[_0xe9c7('0xb')]);router[_0xe9c7('0x5')](_0xe9c7('0xc'),auth['isAuthenticated'](),auth[_0xe9c7('0x3')](),controller[_0xe9c7('0xd')]);router[_0xe9c7('0x5')]('/calls',auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xe9c7('0xe')]);router[_0xe9c7('0x5')](_0xe9c7('0xf'),auth[_0xe9c7('0x7')](),auth['canUpdate'](),controller[_0xe9c7('0x10')]);module[_0xe9c7('0x11')]=router; \ No newline at end of file +var _0xbd76=['hangup','answer','/hold','hold','unhold','/calls','/transfer','transfer','express','Router','./webbar.controller','/originate','isAuthenticated','canUpdate','originate','post','/hangup'];(function(_0x150c86,_0x3cacee){var _0x2dd546=function(_0x3fcff0){while(--_0x3fcff0){_0x150c86['push'](_0x150c86['shift']());}};_0x2dd546(++_0x3cacee);}(_0xbd76,0x18f));var _0x6bd7=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xbd76[_0x27af45];return _0x18df21;};'use strict';var express=require(_0x6bd7('0x0'));var router=express[_0x6bd7('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x6bd7('0x2'));router['post'](_0x6bd7('0x3'),auth[_0x6bd7('0x4')](),auth[_0x6bd7('0x5')](),controller[_0x6bd7('0x6')]);router[_0x6bd7('0x7')](_0x6bd7('0x8'),auth[_0x6bd7('0x4')](),auth['canUpdate'](),controller[_0x6bd7('0x9')]);router[_0x6bd7('0x7')]('/answer',auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x6bd7('0xa')]);router[_0x6bd7('0x7')](_0x6bd7('0xb'),auth[_0x6bd7('0x4')](),auth[_0x6bd7('0x5')](),controller[_0x6bd7('0xc')]);router[_0x6bd7('0x7')]('/unhold',auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x6bd7('0xd')]);router[_0x6bd7('0x7')](_0x6bd7('0xe'),auth['isAuthenticated'](),auth[_0x6bd7('0x5')](),controller['calls']);router[_0x6bd7('0x7')](_0x6bd7('0xf'),auth['isAuthenticated'](),auth[_0x6bd7('0x5')](),controller[_0x6bd7('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 78e650e..b941838 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 _0x222f=['json','userId','callNumber','callbackUrl','entityFound:','format','originate\x20executed!','hangup','sessionId','user:%s','answer','answer\x20fired:','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','jayson/promise','client','http','../../config/logger','ioredis','defaults','redis','socket.io-emitter','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','emit','log','handleError:','error','stack','name','status','send','NotFound','request','then','code','message','result','catch','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','length','sessionId\x20','\x20not\x20found!','originate','validate','body'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x222f,0x1a4));var _0xf222=function(_0x546ab6,_0x357f23){_0x546ab6=_0x546ab6-0x0;var _0x3952ca=_0x222f[_0x546ab6];return _0x3952ca;};'use strict';var path=require(_0xf222('0x0'));var fs=require('fs');var _=require(_0xf222('0x1'));var db=require(_0xf222('0x2'))['db'];var config=require(_0xf222('0x3'));var util=require('util');var BPromise=require('bluebird');var jayson=require(_0xf222('0x4'));var amiClient=jayson[_0xf222('0x5')][_0xf222('0x6')]({'port':0x232a});var logger=require(_0xf222('0x7'))('webbarapi');var Redis=require(_0xf222('0x8'));config['redis']=_[_0xf222('0x9')](config[_0xf222('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xf222('0xb'))(new Redis(config[_0xf222('0xa')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0xf222('0xc'),'required':[!![],_0xf222('0xd')]},'callNumber':{'type':_0xf222('0xe'),'required':[!![],_0xf222('0xf')]},'callerId':{'type':_0xf222('0xe')},'callbackUrl':{'type':_0xf222('0xe')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0xf222('0xd')]},'sessionId':{'type':_0xf222('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xf222('0xc'),'required':[!![],_0xf222('0xd')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0xf222('0xc'),'required':[!![],_0xf222('0xd')]},'sessionId':{'type':_0xf222('0xe'),'required':[!![],_0xf222('0x10')]},'transferNumber':{'type':_0xf222('0xe'),'required':[!![],_0xf222('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0xf222('0xc'),'required':[!![],_0xf222('0xd')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xf222('0xd')]},'sessionId':{'type':_0xf222('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0xf222('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':_0xf222('0xc'),'required':[!![],_0xf222('0xd')]}});function emit(_0x4392a0,_0x464060,_0x25e1c2){logger[_0xf222('0x12')](_0x4392a0,_0x464060,JSON['stringify'](_0x25e1c2));io['to'](_0x4392a0)[_0xf222('0x13')](_0x464060,_0x25e1c2);}function handleError(_0x823314){return function(_0x8783ab){console[_0xf222('0x14')](_0xf222('0x15'),_0x8783ab,_0x8783ab instanceof RangeError);logger[_0xf222('0x16')](_0x8783ab[_0xf222('0x17')]);if(_0x8783ab instanceof RangeError){if(_0x8783ab['name']){delete _0x8783ab[_0xf222('0x18')];}_0x823314[_0xf222('0x19')](0x194)[_0xf222('0x1a')](_0x8783ab);}else{if(_0x8783ab[_0xf222('0x18')]){delete _0x8783ab['name'];}_0x823314['status'](0x1f4)[_0xf222('0x1a')](_0x8783ab);}};}function checkError(){return function(_0x3e8875){if(!_0x3e8875){throw new RangeError(_0xf222('0x1b'));}return _0x3e8875;};}function respondWithRpcPromise(_0x33406d,_0x35539d){return new BPromise(function(_0x151a89,_0x51b872){var _0x176b20=amiClient;return _0x176b20[_0xf222('0x1c')](_0x33406d,_0x35539d)[_0xf222('0x1d')](function(_0x12d443){if(_0x12d443[_0xf222('0x16')]){if(_0x12d443[_0xf222('0x16')][_0xf222('0x1e')]===0x1f4){return _0x51b872(_0x12d443[_0xf222('0x16')]['message']);}return _0x151a89(_0x12d443[_0xf222('0x16')][_0xf222('0x1f')]);}else{_0x151a89(_0x12d443[_0xf222('0x20')]);}})[_0xf222('0x21')](function(_0x4305e0){_0x51b872(_0x4305e0);});});}function getAgent(_0x3e2a1c){return db[_0xf222('0x22')][_0xf222('0x23')]({'where':{'id':_0x3e2a1c,'role':_0xf222('0x24')}})[_0xf222('0x1d')](checkError());}function getAgentCheckSession(_0x2a8310,_0x501f8e){return new BPromise(function(_0x14b2b1,_0x1c5cd3){var _0x3d5508=respondWithRpcPromise(_0xf222('0x25'));var _0xe41039=getAgent(_0x2a8310);Promise[_0xf222('0x26')]([_0x3d5508,_0xe41039])[_0xf222('0x1d')](function(_0x1b928b){var _0x1e87ec=_0x1b928b[0x0];var _0x59721a=_0x1b928b[0x1];var _0x3bdf98=_[_0xf222('0x27')](_0x1e87ec[_0xf222('0x28')],function(_0x53a382){return _0x53a382[_0xf222('0x29')]==_0x59721a['id']&&_0x53a382['sessionId']==_0x501f8e;});if(_0x3bdf98[_0xf222('0x2a')]==0x1){_0x14b2b1(_0x59721a);}else{_0x1c5cd3(new RangeError(_0xf222('0x2b')+_0x501f8e+_0xf222('0x2c')));}});});}exports[_0xf222('0x2d')]=function(_0x37b4f7,_0x152d79){logger[_0xf222('0x12')]('originate\x20fired:',_0x37b4f7['body']);var _0x439c2f=originateValidation[_0xf222('0x2e')](_0x37b4f7[_0xf222('0x2f')]);if(_0x439c2f[_0xf222('0x2a')]>0x0){return _0x152d79[_0xf222('0x19')](0x190)[_0xf222('0x30')](_0x439c2f);}var _0x4e6a5e=_0x37b4f7[_0xf222('0x2f')][_0xf222('0x31')];var _0x13324a=_0x37b4f7['body'][_0xf222('0x32')];var _0x22ca97=_0x37b4f7[_0xf222('0x2f')]['callerId'];var _0x226d84=_0x37b4f7[_0xf222('0x2f')][_0xf222('0x33')];return getAgent(_0x4e6a5e)['then'](function(_0x3acea1){logger[_0xf222('0x12')](_0xf222('0x34'),_0x3acea1[_0xf222('0x18')]);emit(util[_0xf222('0x35')]('user:%s',_0x3acea1[_0xf222('0x18')]),'webbar:originate',{'callNumber':_0x13324a,'callerId':_0x22ca97,'callbackUrl':_0x226d84});return _0x152d79[_0xf222('0x19')](0xc8)[_0xf222('0x30')]({'error':![],'message':_0xf222('0x36')});})['catch'](handleError(_0x152d79));};exports[_0xf222('0x37')]=function(_0x3d70b0,_0x54a10d){logger[_0xf222('0x12')]('hangup\x20fired:',_0x3d70b0[_0xf222('0x2f')]);var _0x1b2f78=hangupValidation[_0xf222('0x2e')](_0x3d70b0['body']);if(_0x1b2f78[_0xf222('0x2a')]>0x0){return _0x54a10d[_0xf222('0x19')](0x190)[_0xf222('0x30')](_0x1b2f78);}var _0x2cacca=_0x3d70b0[_0xf222('0x2f')][_0xf222('0x31')];var _0x51154b=_0x3d70b0[_0xf222('0x2f')][_0xf222('0x38')];return getAgent(_0x2cacca)['then'](function(_0x49cad2){logger[_0xf222('0x12')]('entityFound:',_0x49cad2[_0xf222('0x18')]);emit(util[_0xf222('0x35')](_0xf222('0x39'),_0x49cad2[_0xf222('0x18')]),'webbar:hangup',{'sessionId':_0x51154b});return _0x54a10d['status'](0xc8)[_0xf222('0x30')]({'error':![],'message':'hangup\x20executed!'});})['catch'](handleError(_0x54a10d));};exports[_0xf222('0x3a')]=function(_0x278fb8,_0x153597){logger[_0xf222('0x12')](_0xf222('0x3b'),_0x278fb8[_0xf222('0x2f')]);var _0x5c60e6=answerValidation[_0xf222('0x2e')](_0x278fb8[_0xf222('0x2f')]);if(_0x5c60e6['length']>0x0){return _0x153597[_0xf222('0x19')](0x190)[_0xf222('0x30')](_0x5c60e6);}var _0x56a5f0=_0x278fb8[_0xf222('0x2f')]['userId'];var _0x149589=_0x278fb8[_0xf222('0x2f')][_0xf222('0x38')];return getAgent(_0x56a5f0)[_0xf222('0x1d')](function(_0x3a3185){logger[_0xf222('0x12')](_0xf222('0x34'),_0x3a3185[_0xf222('0x18')]);emit(util[_0xf222('0x35')](_0xf222('0x39'),_0x3a3185[_0xf222('0x18')]),'webbar:answer',{'sessionId':_0x149589});return _0x153597['status'](0xc8)['json']({'error':![],'message':_0xf222('0x3c')});})[_0xf222('0x21')](handleError(_0x153597));};exports[_0xf222('0x3d')]=function(_0x3cf89b,_0x5a0763){logger[_0xf222('0x12')](_0xf222('0x3e'),_0x3cf89b[_0xf222('0x2f')]);var _0x2841a2=holdValidation['validate'](_0x3cf89b[_0xf222('0x2f')]);if(_0x2841a2[_0xf222('0x2a')]>0x0){return _0x5a0763[_0xf222('0x19')](0x190)[_0xf222('0x30')](_0x2841a2);}var _0x1d60e5=_0x3cf89b[_0xf222('0x2f')][_0xf222('0x31')];var _0x7a8ea9=_0x3cf89b[_0xf222('0x2f')][_0xf222('0x38')];return getAgent(_0x1d60e5)['then'](function(_0x5d0d70){logger[_0xf222('0x12')]('entityFound:',_0x5d0d70[_0xf222('0x18')]);emit(util['format'](_0xf222('0x39'),_0x5d0d70['name']),_0xf222('0x3f'),{'sessionId':_0x7a8ea9});return _0x5a0763[_0xf222('0x19')](0xc8)[_0xf222('0x30')]({'error':![],'message':_0xf222('0x40')});})['catch'](handleError(_0x5a0763));};exports[_0xf222('0x41')]=function(_0x34fd50,_0x380642){logger[_0xf222('0x12')](_0xf222('0x42'),_0x34fd50[_0xf222('0x2f')]);var _0xe3809c=unholdValidation[_0xf222('0x2e')](_0x34fd50[_0xf222('0x2f')]);if(_0xe3809c[_0xf222('0x2a')]>0x0){return _0x380642[_0xf222('0x19')](0x190)[_0xf222('0x30')](_0xe3809c);}var _0x4aa98c=_0x34fd50['body'][_0xf222('0x31')];var _0x28c5d1=_0x34fd50[_0xf222('0x2f')][_0xf222('0x38')];return getAgent(_0x4aa98c)[_0xf222('0x1d')](function(_0x1be64c){logger[_0xf222('0x12')](_0xf222('0x34'),_0x1be64c[_0xf222('0x18')]);emit(util[_0xf222('0x35')](_0xf222('0x39'),_0x1be64c['name']),'webbar:unhold',{'sessionId':_0x28c5d1});return _0x380642[_0xf222('0x19')](0xc8)[_0xf222('0x30')]({'error':![],'message':_0xf222('0x43')});})[_0xf222('0x21')](handleError(_0x380642));};exports[_0xf222('0x44')]=function(_0x6eb194,_0x22bc07){logger[_0xf222('0x12')](_0xf222('0x45'),_0x22bc07[_0xf222('0x2f')]);var _0x32ec77=callsValidation[_0xf222('0x2e')](_0x6eb194[_0xf222('0x2f')]);if(_0x32ec77[_0xf222('0x2a')]>0x0){return _0x22bc07['status'](0x190)[_0xf222('0x30')](_0x32ec77);}var _0x5ee917=_0x6eb194[_0xf222('0x2f')][_0xf222('0x31')];var _0x2c9222=respondWithRpcPromise(_0xf222('0x25'));var _0x5dc3fa=getAgent(_0x5ee917);return Promise['all']([_0x2c9222,_0x5dc3fa])[_0xf222('0x1d')](function(_0x2fc98a){var _0x29eaa9=_0x2fc98a[0x0];var _0xd092fc=_0x2fc98a[0x1];var _0x356746=_['filter'](_0x29eaa9[_0xf222('0x28')],function(_0x497994){return _0x497994[_0xf222('0x29')]==_0xd092fc['id'];});return _0x22bc07[_0xf222('0x19')](0xc8)['json']({'count':_0x356746[_0xf222('0x2a')],'rows':_0x356746});})['catch'](handleError(_0x22bc07));};exports[_0xf222('0x46')]=function(_0x2b6181,_0x41469e){logger['info'](_0xf222('0x47'),_0x2b6181[_0xf222('0x2f')]);var _0x434e8e=conferenceValidation[_0xf222('0x2e')](_0x2b6181[_0xf222('0x2f')]);if(_0x434e8e[_0xf222('0x2a')]>0x0){return _0x41469e[_0xf222('0x19')](0x190)['json'](_0x434e8e);}var _0x286355=_0x2b6181[_0xf222('0x2f')]['userId'];return getAgent(_0x286355)['then'](function(_0x5befb8){logger[_0xf222('0x12')](_0xf222('0x34'),_0x5befb8[_0xf222('0x18')]);emit(util[_0xf222('0x35')]('user:%s',_0x5befb8[_0xf222('0x18')]),'webbar:conference');return _0x41469e[_0xf222('0x19')](0xc8)[_0xf222('0x30')]({'error':![],'message':_0xf222('0x48')});})[_0xf222('0x21')](handleError(_0x41469e));};exports[_0xf222('0x49')]=function(_0x369b85,_0x3bb273){logger[_0xf222('0x12')](_0xf222('0x4a'),_0x369b85['body']);var _0x4e7d09=transferValidation[_0xf222('0x2e')](_0x369b85['body']);if(_0x4e7d09[_0xf222('0x2a')]>0x0){return _0x3bb273[_0xf222('0x19')](0x190)[_0xf222('0x30')](_0x4e7d09);}var _0x5e14f1=_0x369b85[_0xf222('0x2f')]['userId'];var _0x3dbda2=_0x369b85[_0xf222('0x2f')][_0xf222('0x38')];var _0x476655=_0x369b85['body'][_0xf222('0x4b')];return getAgent(_0x5e14f1)[_0xf222('0x1d')](function(_0x3c6cda){logger[_0xf222('0x12')](_0xf222('0x34'),_0x3c6cda[_0xf222('0x18')]);emit(util[_0xf222('0x35')](_0xf222('0x39'),_0x3c6cda[_0xf222('0x18')]),_0xf222('0x4c'),{'sessionId':_0x3dbda2,'transferNumber':_0x476655});return _0x3bb273['status'](0xc8)[_0xf222('0x30')]({'error':![],'message':_0xf222('0x4d')});})[_0xf222('0x21')](handleError(_0x3bb273));}; \ No newline at end of file +var _0x74f0=['callbackUrl','entityFound:','user:%s','json','originate\x20executed!','catch','hangup','hangup\x20fired:','hangup\x20executed!','answer','answer\x20fired:','format','webbar:answer','hold','webbar:hold','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','rows','conference','conference\x20executed!','transfer','webbar:transfer','transfer\x20executed!','lodash','util','bluebird','jayson/promise','client','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','string','callNumber\x20is\x20required','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','emit','log','handleError:','error','name','status','send','NotFound','request','then','code','message','User','findOne','all','filter','UserId','sessionId','length','\x20not\x20found!','originate','originate\x20fired:','body','userId','callNumber','callerId'];(function(_0x406274,_0x1b729e){var _0x2e37bd=function(_0x50292a){while(--_0x50292a){_0x406274['push'](_0x406274['shift']());}};_0x2e37bd(++_0x1b729e);}(_0x74f0,0xf3));var _0x074f=function(_0x34933a,_0x327378){_0x34933a=_0x34933a-0x0;var _0x36abb4=_0x74f0[_0x34933a];return _0x36abb4;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x074f('0x0'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var util=require(_0x074f('0x1'));var BPromise=require(_0x074f('0x2'));var jayson=require(_0x074f('0x3'));var amiClient=jayson[_0x074f('0x4')]['http']({'port':0x232a});var logger=require('../../config/logger')(_0x074f('0x5'));var Redis=require(_0x074f('0x6'));config[_0x074f('0x7')]=_[_0x074f('0x8')](config[_0x074f('0x7')],{'host':_0x074f('0x9'),'port':0x18eb});var io=require(_0x074f('0xa'))(new Redis(config['redis']));var Schema=require(_0x074f('0xb'));var originateValidation=new Schema({'userId':{'type':_0x074f('0xc'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x074f('0xd'),'required':[!![],_0x074f('0xe')]},'callerId':{'type':_0x074f('0xd')},'callbackUrl':{'type':_0x074f('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0x074f('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0x074f('0xc'),'required':[!![],_0x074f('0xf')]},'sessionId':{'type':_0x074f('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x074f('0xc'),'required':[!![],_0x074f('0xf')]},'sessionId':{'type':_0x074f('0xd'),'required':[!![],_0x074f('0x10')]},'transferNumber':{'type':_0x074f('0xd'),'required':[!![],_0x074f('0x11')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x074f('0xf')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x074f('0xc'),'required':[!![],_0x074f('0xf')]},'sessionId':{'type':_0x074f('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x074f('0xc'),'required':[!![],_0x074f('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0x074f('0xc'),'required':[!![],_0x074f('0xf')]}});function emit(_0x1edf9c,_0x3f1a47,_0x428987){logger[_0x074f('0x12')](_0x1edf9c,_0x3f1a47,JSON['stringify'](_0x428987));io['to'](_0x1edf9c)[_0x074f('0x13')](_0x3f1a47,_0x428987);}function handleError(_0x367b52){return function(_0x200e43){console[_0x074f('0x14')](_0x074f('0x15'),_0x200e43,_0x200e43 instanceof RangeError);logger[_0x074f('0x16')](_0x200e43['stack']);if(_0x200e43 instanceof RangeError){if(_0x200e43['name']){delete _0x200e43[_0x074f('0x17')];}_0x367b52['status'](0x194)['send'](_0x200e43);}else{if(_0x200e43[_0x074f('0x17')]){delete _0x200e43[_0x074f('0x17')];}_0x367b52[_0x074f('0x18')](0x1f4)[_0x074f('0x19')](_0x200e43);}};}function checkError(){return function(_0xfa07ea){if(!_0xfa07ea){throw new RangeError(_0x074f('0x1a'));}return _0xfa07ea;};}function respondWithRpcPromise(_0x23406f,_0x3ecb4b){return new BPromise(function(_0x1acf0a,_0x2c3b23){var _0x335170=amiClient;return _0x335170[_0x074f('0x1b')](_0x23406f,_0x3ecb4b)[_0x074f('0x1c')](function(_0x2fc5b0){if(_0x2fc5b0[_0x074f('0x16')]){if(_0x2fc5b0[_0x074f('0x16')][_0x074f('0x1d')]===0x1f4){return _0x2c3b23(_0x2fc5b0[_0x074f('0x16')][_0x074f('0x1e')]);}return _0x1acf0a(_0x2fc5b0[_0x074f('0x16')]['message']);}else{_0x1acf0a(_0x2fc5b0['result']);}})['catch'](function(_0x1051ce){_0x2c3b23(_0x1051ce);});});}function getAgent(_0x22ce4f){return db[_0x074f('0x1f')][_0x074f('0x20')]({'where':{'id':_0x22ce4f,'role':'agent'}})[_0x074f('0x1c')](checkError());}function getAgentCheckSession(_0x339370,_0x3fb202){return new BPromise(function(_0x312119,_0x470acc){var _0xb9722a=respondWithRpcPromise('VoiceChannels');var _0x1bf574=getAgent(_0x339370);Promise[_0x074f('0x21')]([_0xb9722a,_0x1bf574])[_0x074f('0x1c')](function(_0x53b76d){var _0x1ee652=_0x53b76d[0x0];var _0x5d6edd=_0x53b76d[0x1];var _0x4fcfb5=_[_0x074f('0x22')](_0x1ee652['rows'],function(_0x4aa96f){return _0x4aa96f[_0x074f('0x23')]==_0x5d6edd['id']&&_0x4aa96f[_0x074f('0x24')]==_0x3fb202;});if(_0x4fcfb5[_0x074f('0x25')]==0x1){_0x312119(_0x5d6edd);}else{_0x470acc(new RangeError('sessionId\x20'+_0x3fb202+_0x074f('0x26')));}});});}exports[_0x074f('0x27')]=function(_0x269df3,_0x50314d){logger[_0x074f('0x12')](_0x074f('0x28'),_0x269df3[_0x074f('0x29')]);var _0x41ccb4=originateValidation[_0x074f('0xb')](_0x269df3['body']);if(_0x41ccb4[_0x074f('0x25')]>0x0){return _0x50314d[_0x074f('0x18')](0x190)['json'](_0x41ccb4);}var _0x16ff4c=_0x269df3[_0x074f('0x29')][_0x074f('0x2a')];var _0x498288=_0x269df3[_0x074f('0x29')][_0x074f('0x2b')];var _0x493cc3=_0x269df3[_0x074f('0x29')][_0x074f('0x2c')];var _0x3407bd=_0x269df3[_0x074f('0x29')][_0x074f('0x2d')];return getAgent(_0x16ff4c)[_0x074f('0x1c')](function(_0x283211){logger[_0x074f('0x12')](_0x074f('0x2e'),_0x283211[_0x074f('0x17')]);emit(util['format'](_0x074f('0x2f'),_0x283211[_0x074f('0x17')]),'webbar:originate',{'callNumber':_0x498288,'callerId':_0x493cc3,'callbackUrl':_0x3407bd});return _0x50314d[_0x074f('0x18')](0xc8)[_0x074f('0x30')]({'error':![],'message':_0x074f('0x31')});})[_0x074f('0x32')](handleError(_0x50314d));};exports[_0x074f('0x33')]=function(_0x380c0e,_0x29d5c7){logger['info'](_0x074f('0x34'),_0x380c0e[_0x074f('0x29')]);var _0x251532=hangupValidation[_0x074f('0xb')](_0x380c0e[_0x074f('0x29')]);if(_0x251532[_0x074f('0x25')]>0x0){return _0x29d5c7['status'](0x190)[_0x074f('0x30')](_0x251532);}var _0x19866e=_0x380c0e['body'][_0x074f('0x2a')];var _0x41b1f2=_0x380c0e[_0x074f('0x29')]['sessionId'];return getAgent(_0x19866e)['then'](function(_0x5f39e5){logger[_0x074f('0x12')](_0x074f('0x2e'),_0x5f39e5[_0x074f('0x17')]);emit(util['format'](_0x074f('0x2f'),_0x5f39e5[_0x074f('0x17')]),'webbar:hangup',{'sessionId':_0x41b1f2});return _0x29d5c7[_0x074f('0x18')](0xc8)[_0x074f('0x30')]({'error':![],'message':_0x074f('0x35')});})[_0x074f('0x32')](handleError(_0x29d5c7));};exports[_0x074f('0x36')]=function(_0x42de45,_0x40dac1){logger[_0x074f('0x12')](_0x074f('0x37'),_0x42de45[_0x074f('0x29')]);var _0x58ff4d=answerValidation[_0x074f('0xb')](_0x42de45['body']);if(_0x58ff4d[_0x074f('0x25')]>0x0){return _0x40dac1['status'](0x190)[_0x074f('0x30')](_0x58ff4d);}var _0x4c59ec=_0x42de45[_0x074f('0x29')]['userId'];var _0x654e6e=_0x42de45[_0x074f('0x29')][_0x074f('0x24')];return getAgent(_0x4c59ec)[_0x074f('0x1c')](function(_0xe20f2b){logger[_0x074f('0x12')](_0x074f('0x2e'),_0xe20f2b['name']);emit(util[_0x074f('0x38')](_0x074f('0x2f'),_0xe20f2b[_0x074f('0x17')]),_0x074f('0x39'),{'sessionId':_0x654e6e});return _0x40dac1['status'](0xc8)[_0x074f('0x30')]({'error':![],'message':'answer\x20executed!'});})[_0x074f('0x32')](handleError(_0x40dac1));};exports[_0x074f('0x3a')]=function(_0x324ca3,_0x5ebf87){logger[_0x074f('0x12')]('hold\x20fired:',_0x324ca3[_0x074f('0x29')]);var _0x2ed08a=holdValidation['validate'](_0x324ca3[_0x074f('0x29')]);if(_0x2ed08a['length']>0x0){return _0x5ebf87[_0x074f('0x18')](0x190)[_0x074f('0x30')](_0x2ed08a);}var _0x598fee=_0x324ca3['body']['userId'];var _0x4d5731=_0x324ca3[_0x074f('0x29')][_0x074f('0x24')];return getAgent(_0x598fee)[_0x074f('0x1c')](function(_0xdd3709){logger['info'](_0x074f('0x2e'),_0xdd3709[_0x074f('0x17')]);emit(util[_0x074f('0x38')](_0x074f('0x2f'),_0xdd3709[_0x074f('0x17')]),_0x074f('0x3b'),{'sessionId':_0x4d5731});return _0x5ebf87[_0x074f('0x18')](0xc8)[_0x074f('0x30')]({'error':![],'message':'hold\x20executed!'});})[_0x074f('0x32')](handleError(_0x5ebf87));};exports[_0x074f('0x3c')]=function(_0x2ff3ab,_0x306a17){logger['info'](_0x074f('0x3d'),_0x2ff3ab[_0x074f('0x29')]);var _0x50bb3d=unholdValidation['validate'](_0x2ff3ab[_0x074f('0x29')]);if(_0x50bb3d[_0x074f('0x25')]>0x0){return _0x306a17[_0x074f('0x18')](0x190)[_0x074f('0x30')](_0x50bb3d);}var _0x563343=_0x2ff3ab['body'][_0x074f('0x2a')];var _0xc38f21=_0x2ff3ab[_0x074f('0x29')][_0x074f('0x24')];return getAgent(_0x563343)[_0x074f('0x1c')](function(_0x151c90){logger[_0x074f('0x12')](_0x074f('0x2e'),_0x151c90[_0x074f('0x17')]);emit(util['format'](_0x074f('0x2f'),_0x151c90[_0x074f('0x17')]),_0x074f('0x3e'),{'sessionId':_0xc38f21});return _0x306a17[_0x074f('0x18')](0xc8)[_0x074f('0x30')]({'error':![],'message':_0x074f('0x3f')});})['catch'](handleError(_0x306a17));};exports[_0x074f('0x40')]=function(_0xe69ce5,_0x56b286){logger[_0x074f('0x12')](_0x074f('0x41'),_0x56b286[_0x074f('0x29')]);var _0x417fa1=callsValidation[_0x074f('0xb')](_0xe69ce5[_0x074f('0x29')]);if(_0x417fa1[_0x074f('0x25')]>0x0){return _0x56b286[_0x074f('0x18')](0x190)[_0x074f('0x30')](_0x417fa1);}var _0x2d2787=_0xe69ce5['body'][_0x074f('0x2a')];var _0x51ede6=respondWithRpcPromise('VoiceChannels');var _0x41aec7=getAgent(_0x2d2787);return Promise['all']([_0x51ede6,_0x41aec7])['then'](function(_0x24eb7a){var _0x183c51=_0x24eb7a[0x0];var _0x668a47=_0x24eb7a[0x1];var _0x3f3762=_[_0x074f('0x22')](_0x183c51[_0x074f('0x42')],function(_0x311d36){return _0x311d36[_0x074f('0x23')]==_0x668a47['id'];});return _0x56b286['status'](0xc8)['json']({'count':_0x3f3762[_0x074f('0x25')],'rows':_0x3f3762});})[_0x074f('0x32')](handleError(_0x56b286));};exports[_0x074f('0x43')]=function(_0x5ce8d2,_0x1de8f2){logger[_0x074f('0x12')]('conference\x20fired:',_0x5ce8d2['body']);var _0x274ce9=conferenceValidation['validate'](_0x5ce8d2[_0x074f('0x29')]);if(_0x274ce9[_0x074f('0x25')]>0x0){return _0x1de8f2['status'](0x190)[_0x074f('0x30')](_0x274ce9);}var _0x104933=_0x5ce8d2[_0x074f('0x29')][_0x074f('0x2a')];return getAgent(_0x104933)[_0x074f('0x1c')](function(_0x9fe79e){logger[_0x074f('0x12')](_0x074f('0x2e'),_0x9fe79e[_0x074f('0x17')]);emit(util[_0x074f('0x38')](_0x074f('0x2f'),_0x9fe79e[_0x074f('0x17')]),'webbar:conference');return _0x1de8f2['status'](0xc8)['json']({'error':![],'message':_0x074f('0x44')});})['catch'](handleError(_0x1de8f2));};exports[_0x074f('0x45')]=function(_0x4e449f,_0x30296f){logger[_0x074f('0x12')]('transfer\x20fired:',_0x4e449f[_0x074f('0x29')]);var _0x1253f7=transferValidation[_0x074f('0xb')](_0x4e449f[_0x074f('0x29')]);if(_0x1253f7[_0x074f('0x25')]>0x0){return _0x30296f[_0x074f('0x18')](0x190)[_0x074f('0x30')](_0x1253f7);}var _0x5bb76b=_0x4e449f[_0x074f('0x29')][_0x074f('0x2a')];var _0x547922=_0x4e449f[_0x074f('0x29')][_0x074f('0x24')];var _0x125d07=_0x4e449f[_0x074f('0x29')]['transferNumber'];return getAgent(_0x5bb76b)[_0x074f('0x1c')](function(_0x110fa1){logger[_0x074f('0x12')]('entityFound:',_0x110fa1['name']);emit(util[_0x074f('0x38')](_0x074f('0x2f'),_0x110fa1[_0x074f('0x17')]),_0x074f('0x46'),{'sessionId':_0x547922,'transferNumber':_0x125d07});return _0x30296f[_0x074f('0x18')](0xc8)['json']({'error':![],'message':_0x074f('0x47')});})['catch'](handleError(_0x30296f));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 5705619..57063c5 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 _0xef0f=['multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','/:id/applications','getApplications','post','create','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','update','delete','removeAnswers','exports'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0xef0f,0x168));var _0xfef0=function(_0x38ceec,_0x18526c){_0x38ceec=_0x38ceec-0x0;var _0x21956e=_0xef0f[_0x38ceec];return _0x21956e;};'use strict';var multer=require(_0xfef0('0x0'));var util=require('util');var path=require(_0xfef0('0x1'));var timeout=require(_0xfef0('0x2'));var express=require(_0xfef0('0x3'));var router=express['Router']();var fs_extra=require(_0xfef0('0x4'));var auth=require(_0xfef0('0x5'));var interaction=require(_0xfef0('0x6'));var config=require('../../config/environment');var controller=require(_0xfef0('0x7'));router[_0xfef0('0x8')]('/',auth[_0xfef0('0x9')](),controller[_0xfef0('0xa')]);router[_0xfef0('0x8')](_0xfef0('0xb'),auth['isAuthenticated'](),controller[_0xfef0('0xc')]);router['get'](_0xfef0('0xd'),auth[_0xfef0('0x9')](),controller[_0xfef0('0xe')]);router[_0xfef0('0x8')](_0xfef0('0xf'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x10')]);router[_0xfef0('0x8')](_0xfef0('0x11'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x12')]);router[_0xfef0('0x8')](_0xfef0('0x13'),auth[_0xfef0('0x9')](),controller['getAgents']);router[_0xfef0('0x8')](_0xfef0('0x14'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x15')]);router[_0xfef0('0x16')]('/',auth[_0xfef0('0x9')](),controller[_0xfef0('0x17')]);router['post'](_0xfef0('0xf'),auth['isAuthenticated'](),controller['addDisposition']);router['post'](_0xfef0('0x11'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x18')]);router[_0xfef0('0x16')](_0xfef0('0x13'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x19')]);router[_0xfef0('0x16')]('/:id/applications',auth[_0xfef0('0x9')](),controller[_0xfef0('0x1a')]);router[_0xfef0('0x16')](_0xfef0('0x1b'),controller[_0xfef0('0x1c')]);router['post'](_0xfef0('0x1d'),auth['isAuthenticated'](),controller[_0xfef0('0x1e')]);router[_0xfef0('0x1f')](_0xfef0('0xd'),auth['isAuthenticated'](),controller[_0xfef0('0x20')]);router['delete'](_0xfef0('0xd'),auth[_0xfef0('0x9')](),controller['destroy']);router['delete']('/:id/dispositions',auth[_0xfef0('0x9')](),controller['removeDispositions']);router[_0xfef0('0x21')](_0xfef0('0x11'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x22')]);router[_0xfef0('0x21')](_0xfef0('0x13'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xfef0('0x23')]=router; \ No newline at end of file +var _0xe2fe=['removeAgents','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','/:id/dispositions','getAgents','/:id/applications','getApplications','post','addDisposition','/:id/canned_answers','addAnswer','/:id/users','addAgents','addApplications','/:id/notify','notify','send','put','destroy','delete','removeDispositions','removeAnswers'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xee2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xee2f('0x1'));var express=require('express');var router=express[_0xee2f('0x2')]();var fs_extra=require(_0xee2f('0x3'));var auth=require(_0xee2f('0x4'));var interaction=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var controller=require('./whatsappAccount.controller');router[_0xee2f('0x7')]('/',auth[_0xee2f('0x8')](),controller['index']);router[_0xee2f('0x7')](_0xee2f('0x9'),auth['isAuthenticated'](),controller[_0xee2f('0xa')]);router['get'](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller['show']);router[_0xee2f('0x7')](_0xee2f('0xc'),auth['isAuthenticated'](),controller['getDispositions']);router['get']('/:id/canned_answers',auth[_0xee2f('0x8')](),controller['getAnswers']);router['get']('/:id/users',auth[_0xee2f('0x8')](),controller[_0xee2f('0xd')]);router[_0xee2f('0x7')](_0xee2f('0xe'),auth[_0xee2f('0x8')](),controller[_0xee2f('0xf')]);router['post']('/',auth[_0xee2f('0x8')](),controller['create']);router[_0xee2f('0x10')](_0xee2f('0xc'),auth['isAuthenticated'](),controller[_0xee2f('0x11')]);router[_0xee2f('0x10')](_0xee2f('0x12'),auth[_0xee2f('0x8')](),controller[_0xee2f('0x13')]);router['post'](_0xee2f('0x14'),auth['isAuthenticated'](),controller[_0xee2f('0x15')]);router[_0xee2f('0x10')]('/:id/applications',auth['isAuthenticated'](),controller[_0xee2f('0x16')]);router['post'](_0xee2f('0x17'),controller[_0xee2f('0x18')]);router[_0xee2f('0x10')]('/:id/send',auth[_0xee2f('0x8')](),controller[_0xee2f('0x19')]);router[_0xee2f('0x1a')](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller['update']);router['delete'](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller[_0xee2f('0x1b')]);router[_0xee2f('0x1c')](_0xee2f('0xc'),auth[_0xee2f('0x8')](),controller[_0xee2f('0x1d')]);router['delete'](_0xee2f('0x12'),auth[_0xee2f('0x8')](),controller[_0xee2f('0x1e')]);router[_0xee2f('0x1c')](_0xee2f('0x14'),auth[_0xee2f('0x8')](),controller[_0xee2f('0x1f')]);module[_0xee2f('0x20')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index a7d5ce8..212e2a4 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 _0x4743=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','TEXT'];(function(_0x31b88d,_0x32e9ef){var _0x1128c9=function(_0x243665){while(--_0x243665){_0x31b88d['push'](_0x31b88d['shift']());}};_0x1128c9(++_0x32e9ef);}(_0x4743,0x123));var _0x3474=function(_0x15ec4e,_0x40b7e0){_0x15ec4e=_0x15ec4e-0x0;var _0xb5e5dd=_0x4743[_0x15ec4e];return _0xb5e5dd;};'use strict';var Sequelize=require(_0x3474('0x0'));var rs=require(_0x3474('0x1'));module[_0x3474('0x2')]={'name':{'type':Sequelize[_0x3474('0x3')],'unique':_0x3474('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x3474('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x3474('0x3')],'defaultValue':function(){return rs[_0x3474('0x5')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x3474('0x6')](_0x3474('0x7'))},'accountSid':{'type':Sequelize[_0x3474('0x3')]},'authToken':{'type':Sequelize[_0x3474('0x3')]},'notificationTemplate':{'type':Sequelize[_0x3474('0x8')],'defaultValue':function(){return _0x3474('0x9');}},'notificationSound':{'type':Sequelize[_0x3474('0xa')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3474('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3474('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3474('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3474('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3474('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3474('0xb')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x3474('0xa')],'defaultValue':![],'comment':_0x3474('0xc'),'set':function(_0x339574){if(!_0x339574){this['setDataValue'](_0x3474('0xd'),null);}this['setDataValue'](_0x3474('0xe'),_0x339574);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xaa5e=['ENUM','twilio','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','randomstring','STRING','name','generate'];(function(_0x559322,_0x11010d){var _0x4d7443=function(_0x9373c6){while(--_0x9373c6){_0x559322['push'](_0x559322['shift']());}};_0x4d7443(++_0x11010d);}(_0xaa5e,0x15a));var _0xeaa5=function(_0x3e69fc,_0x2448cc){_0x3e69fc=_0x3e69fc-0x0;var _0x53b725=_0xaa5e[_0x3e69fc];return _0x53b725;};'use strict';var Sequelize=require(_0xeaa5('0x0'));var rs=require(_0xeaa5('0x1'));module['exports']={'name':{'type':Sequelize[_0xeaa5('0x2')],'unique':_0xeaa5('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xeaa5('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xeaa5('0x2')],'defaultValue':function(){return rs[_0xeaa5('0x4')]();}},'phone':{'type':Sequelize[_0xeaa5('0x2')]},'type':{'type':Sequelize[_0xeaa5('0x5')](_0xeaa5('0x6'))},'accountSid':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xeaa5('0x7');}},'notificationSound':{'type':Sequelize[_0xeaa5('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xeaa5('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xeaa5('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xeaa5('0x9')],'comment':_0xeaa5('0xa')},'mandatoryDisposition':{'type':Sequelize[_0xeaa5('0x8')],'defaultValue':![],'comment':_0xeaa5('0xb'),'set':function(_0x5d5f10){if(!_0x5d5f10){this['setDataValue'](_0xeaa5('0xc'),null);}this['setDataValue']('mandatoryDisposition',_0x5d5f10);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 866cf28..5c805f0 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 _0xad90=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','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','result','catch','sendStatus','status','json','offset','count','limit','set','Content-Range','apply','reject','save','update','then','get','WhatsappAccounts','destroy','end','stack','name','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','include','rows','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','body','params','describe','addDisposition','WhatsappAccountId','getDispositions','findOne','order','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findAll','removeAnswers','addAgents','omit','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','WhatsappApplication','findAndCountAll','priority','getApplications','notify','whatsapp','Applications','account','asc','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','twilio','From','whatsapp:','Body','messageId','MessageSid','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','CmContact','Contacts','list','contact','WhatsappInteraction','interaction','created','autoclose','applications','unmanaged','*,*,*,*','WhatsappMessage','AttachmentId','UserId','unshift','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','text/xml','send','\x0a','to\x20is\x20mandatory','List','out','Messages','dataValues','push','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x7f7cb2,_0x1cf149){var _0x23e68b=function(_0x5ac3f4){while(--_0x5ac3f4){_0x7f7cb2['push'](_0x7f7cb2['shift']());}};_0x23e68b(++_0x1cf149);}(_0xad90,0xab));var _0x0ad9=function(_0xbb9dbf,_0x5dafa4){_0xbb9dbf=_0xbb9dbf-0x0;var _0x30223c=_0xad90[_0xbb9dbf];return _0x30223c;};'use strict';var emlformat=require(_0x0ad9('0x0'));var rimraf=require(_0x0ad9('0x1'));var zipdir=require(_0x0ad9('0x2'));var jsonpatch=require(_0x0ad9('0x3'));var rp=require(_0x0ad9('0x4'));var moment=require('moment');var BPromise=require(_0x0ad9('0x5'));var Mustache=require('mustache');var util=require(_0x0ad9('0x6'));var path=require('path');var sox=require(_0x0ad9('0x7'));var csv=require(_0x0ad9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0ad9('0x9'));var squel=require(_0x0ad9('0xa'));var crypto=require(_0x0ad9('0xb'));var jsforce=require(_0x0ad9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0ad9('0x8'));var querystring=require(_0x0ad9('0xd'));var Papa=require(_0x0ad9('0xe'));var Redis=require('ioredis');var authService=require(_0x0ad9('0xf'));var qs=require(_0x0ad9('0x10'));var as=require(_0x0ad9('0x11'));var hardwareService=require(_0x0ad9('0x12'));var logger=require(_0x0ad9('0x13'))(_0x0ad9('0x14'));var utils=require(_0x0ad9('0x15'));var config=require(_0x0ad9('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x0ad9('0x17')]=_[_0x0ad9('0x18')](config[_0x0ad9('0x17')],{'host':_0x0ad9('0x19'),'port':0x18eb});var socket=require(_0x0ad9('0x1a'))(new Redis(config[_0x0ad9('0x17')]));require(_0x0ad9('0x1b'))[_0x0ad9('0x1c')](socket);var jayson=require(_0x0ad9('0x1d'));var client=jayson[_0x0ad9('0x1e')][_0x0ad9('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x3b171a,_0x5c3957,_0x35b457,_0x478589){return new BPromise(function(_0x88b3a,_0x1c5c64){var _0x28d8dd=_0x478589||client;return _0x28d8dd[_0x0ad9('0x20')](_0x3b171a,_0x35b457)['then'](function(_0x3ab49f){logger[_0x0ad9('0x21')](_0x0ad9('0x22'),_0x5c3957,_0x0ad9('0x23'));logger[_0x0ad9('0x24')](_0x0ad9('0x25'),_0x5c3957,_0x0ad9('0x23'),JSON['stringify'](_0x3ab49f));if(_0x3ab49f[_0x0ad9('0x26')]){if(_0x3ab49f[_0x0ad9('0x26')][_0x0ad9('0x27')]===0x1f4){logger[_0x0ad9('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0x5c3957,_0x3ab49f['error'][_0x0ad9('0x28')]);return _0x1c5c64(_0x3ab49f[_0x0ad9('0x26')]['message']);}logger[_0x0ad9('0x26')](_0x0ad9('0x22'),_0x5c3957,_0x3ab49f[_0x0ad9('0x26')][_0x0ad9('0x28')]);return _0x88b3a(_0x3ab49f[_0x0ad9('0x26')]['message']);}else{logger['info'](_0x0ad9('0x22'),_0x5c3957,'request\x20sent');_0x88b3a(_0x3ab49f[_0x0ad9('0x29')][_0x0ad9('0x28')]);}})[_0x0ad9('0x2a')](function(_0x2d41b0){logger[_0x0ad9('0x26')](_0x0ad9('0x22'),_0x5c3957,_0x2d41b0);_0x1c5c64(_0x2d41b0);});});}function respondWithStatusCode(_0x2baf09,_0x3dc9e4){_0x3dc9e4=_0x3dc9e4||0xcc;return function(_0x160bc1){if(_0x160bc1){return _0x2baf09[_0x0ad9('0x2b')](_0x3dc9e4);}return _0x2baf09['status'](_0x3dc9e4)['end']();};}function respondWithResult(_0x198e41,_0x42d52d){_0x42d52d=_0x42d52d||0xc8;return function(_0x5ed528){if(_0x5ed528){return _0x198e41[_0x0ad9('0x2c')](_0x42d52d)[_0x0ad9('0x2d')](_0x5ed528);}};}function respondWithFilteredResult(_0x40dd83,_0x369561){return function(_0x403198){if(_0x403198){var _0xba93b7=typeof _0x369561[_0x0ad9('0x2e')]==='undefined'&&typeof _0x369561['limit']==='undefined';var _0x4c0ee3=_0x403198[_0x0ad9('0x2f')];var _0x396099=_0xba93b7?0x0:_0x369561['offset'];var _0x4bbb87=_0xba93b7?_0x403198[_0x0ad9('0x2f')]:_0x369561[_0x0ad9('0x2e')]+_0x369561[_0x0ad9('0x30')];var _0xb16a46;if(_0x4bbb87>=_0x4c0ee3){_0x4bbb87=_0x4c0ee3;_0xb16a46=0xc8;}else{_0xb16a46=0xce;}_0x40dd83[_0x0ad9('0x2c')](_0xb16a46);return _0x40dd83[_0x0ad9('0x31')](_0x0ad9('0x32'),_0x396099+'-'+_0x4bbb87+'/'+_0x4c0ee3)[_0x0ad9('0x2d')](_0x403198);}return null;};}function patchUpdates(_0x5c95c7){return function(_0x4625b9){try{jsonpatch[_0x0ad9('0x33')](_0x4625b9,_0x5c95c7,!![]);}catch(_0x1f07c5){return BPromise[_0x0ad9('0x34')](_0x1f07c5);}return _0x4625b9[_0x0ad9('0x35')]();};}function saveUpdates(_0x3af971,_0x461420){return function(_0x5d8e50){if(_0x5d8e50){return _0x5d8e50[_0x0ad9('0x36')](_0x3af971)[_0x0ad9('0x37')](function(_0x1a6464){return _0x1a6464;});}return null;};}function removeEntity(_0x58d4f8,_0x4b759f){return function(_0x30996c){if(_0x30996c){return _0x30996c['destroy']()['then'](function(){var _0x447be4=_0x30996c[_0x0ad9('0x38')]({'plain':!![]});var _0x35677e=_0x0ad9('0x39');return db['UserProfileResource'][_0x0ad9('0x3a')]({'where':{'type':_0x35677e,'resourceId':_0x447be4['id']}})[_0x0ad9('0x37')](function(){return _0x30996c;});})[_0x0ad9('0x37')](function(){_0x58d4f8[_0x0ad9('0x2c')](0xcc)[_0x0ad9('0x3b')]();});}};}function handleEntityNotFound(_0x12ba1b,_0x1dc4ff){return function(_0x37c565){if(!_0x37c565){_0x12ba1b[_0x0ad9('0x2b')](0x194);}return _0x37c565;};}function handleError(_0x448de4,_0xd68df3){_0xd68df3=_0xd68df3||0x1f4;return function(_0x436789){logger[_0x0ad9('0x26')](_0x436789[_0x0ad9('0x3c')]);if(_0x436789['name']){delete _0x436789[_0x0ad9('0x3d')];}_0x448de4[_0x0ad9('0x2c')](_0xd68df3)['send'](_0x436789);};}exports['index']=function(_0x865926,_0x13e680){var _0x2e9581={'include':[{'model':db[_0x0ad9('0x3e')],'as':_0x0ad9('0x3f')}]},_0x1c0bc0={},_0x5e2668={'count':0x0,'rows':[]};var _0x2ae670=_[_0x0ad9('0x40')](db[_0x0ad9('0x41')][_0x0ad9('0x42')],function(_0x192818){return{'name':_0x192818['fieldName'],'type':_0x192818[_0x0ad9('0x43')][_0x0ad9('0x44')]};});_0x1c0bc0[_0x0ad9('0x45')]=_['map'](_0x2ae670,_0x0ad9('0x3d'));_0x1c0bc0['query']=_[_0x0ad9('0x46')](_0x865926[_0x0ad9('0x47')]);_0x1c0bc0[_0x0ad9('0x48')]=_[_0x0ad9('0x49')](_0x1c0bc0['model'],_0x1c0bc0[_0x0ad9('0x47')]);_0x2e9581[_0x0ad9('0x4a')]=_['intersection'](_0x1c0bc0[_0x0ad9('0x45')],qs[_0x0ad9('0x4b')](_0x865926[_0x0ad9('0x47')][_0x0ad9('0x4b')]));_0x2e9581[_0x0ad9('0x4a')]=_0x2e9581[_0x0ad9('0x4a')][_0x0ad9('0x4c')]?_0x2e9581['attributes']:_0x1c0bc0[_0x0ad9('0x45')];if(!_0x865926['query'][_0x0ad9('0x4d')](_0x0ad9('0x4e'))){_0x2e9581[_0x0ad9('0x30')]=qs[_0x0ad9('0x30')](_0x865926[_0x0ad9('0x47')][_0x0ad9('0x30')]);_0x2e9581[_0x0ad9('0x2e')]=qs['offset'](_0x865926[_0x0ad9('0x47')][_0x0ad9('0x2e')]);}_0x2e9581['order']=qs[_0x0ad9('0x4f')](_0x865926['query']['sort']);_0x2e9581['where']=qs['filters'](_[_0x0ad9('0x50')](_0x865926[_0x0ad9('0x47')],_0x1c0bc0[_0x0ad9('0x48')]),_0x2ae670);if(_0x865926[_0x0ad9('0x47')][_0x0ad9('0x51')]){_0x2e9581[_0x0ad9('0x52')]=_[_0x0ad9('0x53')](_0x2e9581[_0x0ad9('0x52')],{'$or':_['map'](_0x2ae670,function(_0xcb1eee){if(_0xcb1eee[_0x0ad9('0x43')]!==_0x0ad9('0x54')){var _0x96b9d3={};_0x96b9d3[_0xcb1eee[_0x0ad9('0x3d')]]={'$like':'%'+_0x865926[_0x0ad9('0x47')][_0x0ad9('0x51')]+'%'};return _0x96b9d3;}})});}_0x2e9581=_[_0x0ad9('0x53')]({},_0x2e9581,_0x865926[_0x0ad9('0x55')]);var _0x4c7740={'where':_0x2e9581['where']};return db[_0x0ad9('0x41')][_0x0ad9('0x2f')](_0x4c7740)['then'](function(_0x4c6c05){_0x5e2668[_0x0ad9('0x2f')]=_0x4c6c05;if(_0x865926[_0x0ad9('0x47')]['includeAll']){_0x2e9581[_0x0ad9('0x56')]=[{'all':!![]}];}return db[_0x0ad9('0x41')]['findAll'](_0x2e9581);})[_0x0ad9('0x37')](function(_0x41e65d){_0x5e2668[_0x0ad9('0x57')]=_0x41e65d;return _0x5e2668;})[_0x0ad9('0x37')](respondWithFilteredResult(_0x13e680,_0x2e9581))['catch'](handleError(_0x13e680,null));};exports['show']=function(_0x5c90d9,_0x103c80){var _0xeb9dad={'raw':![],'where':{'id':_0x5c90d9['params']['id']},'include':[{'model':db[_0x0ad9('0x3e')],'as':_0x0ad9('0x3f')}]},_0x4a027b={};_0x4a027b['model']=_[_0x0ad9('0x46')](db[_0x0ad9('0x41')][_0x0ad9('0x42')]);_0x4a027b['query']=_[_0x0ad9('0x46')](_0x5c90d9[_0x0ad9('0x47')]);_0x4a027b[_0x0ad9('0x48')]=_['intersection'](_0x4a027b[_0x0ad9('0x45')],_0x4a027b[_0x0ad9('0x47')]);_0xeb9dad['attributes']=_[_0x0ad9('0x49')](_0x4a027b[_0x0ad9('0x45')],qs[_0x0ad9('0x4b')](_0x5c90d9['query'][_0x0ad9('0x4b')]));_0xeb9dad[_0x0ad9('0x4a')]=_0xeb9dad[_0x0ad9('0x4a')][_0x0ad9('0x4c')]?_0xeb9dad[_0x0ad9('0x4a')]:_0x4a027b[_0x0ad9('0x45')];if(_0x5c90d9[_0x0ad9('0x47')][_0x0ad9('0x58')]){_0xeb9dad['include']=[{'all':!![]}];}_0xeb9dad=_[_0x0ad9('0x53')]({},_0xeb9dad,_0x5c90d9['options']);return db[_0x0ad9('0x41')][_0x0ad9('0x59')](_0xeb9dad)[_0x0ad9('0x37')](handleEntityNotFound(_0x103c80,null))[_0x0ad9('0x37')](respondWithResult(_0x103c80,null))[_0x0ad9('0x2a')](handleError(_0x103c80,null));};exports[_0x0ad9('0x5a')]=function(_0x496a04,_0x3adbd0){return db['WhatsappAccount']['create'](_0x496a04['body'],{})[_0x0ad9('0x37')](function(_0xaf8064){var _0x22b249=_0x496a04[_0x0ad9('0x5b')][_0x0ad9('0x38')]({'plain':!![]});if(!_0x22b249)throw new Error(_0x0ad9('0x5c'));if(_0x22b249[_0x0ad9('0x5d')]===_0x0ad9('0x5b')){var _0x3b9a42=_0xaf8064[_0x0ad9('0x38')]({'plain':!![]});var _0x18daff=_0x0ad9('0x39');return db['UserProfileSection']['find']({'where':{'name':_0x18daff,'userProfileId':_0x22b249[_0x0ad9('0x5e')]},'raw':!![]})[_0x0ad9('0x37')](function(_0x2987eb){if(_0x2987eb&&_0x2987eb[_0x0ad9('0x5f')]===0x0){return db[_0x0ad9('0x60')]['create']({'name':_0x3b9a42[_0x0ad9('0x3d')],'resourceId':_0x3b9a42['id'],'type':_0x2987eb[_0x0ad9('0x3d')],'sectionId':_0x2987eb['id']},{})['then'](function(){return _0xaf8064;});}else{return _0xaf8064;}})[_0x0ad9('0x2a')](function(_0x46a255){logger[_0x0ad9('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x46a255);throw _0x46a255;});}return _0xaf8064;})[_0x0ad9('0x37')](respondWithResult(_0x3adbd0,0xc9))[_0x0ad9('0x2a')](handleError(_0x3adbd0,null));};exports[_0x0ad9('0x36')]=function(_0x34b529,_0x45e132){if(_0x34b529[_0x0ad9('0x61')]['id']){delete _0x34b529[_0x0ad9('0x61')]['id'];}return db[_0x0ad9('0x41')][_0x0ad9('0x59')]({'where':{'id':_0x34b529[_0x0ad9('0x62')]['id']},'include':[{'model':db['Pause'],'as':_0x0ad9('0x3f')}]})[_0x0ad9('0x37')](handleEntityNotFound(_0x45e132,null))[_0x0ad9('0x37')](saveUpdates(_0x34b529['body'],null))['then'](respondWithResult(_0x45e132,null))['catch'](handleError(_0x45e132,null));};exports[_0x0ad9('0x3a')]=function(_0x23c494,_0x439b4e){return db[_0x0ad9('0x41')][_0x0ad9('0x59')]({'where':{'id':_0x23c494[_0x0ad9('0x62')]['id']}})['then'](handleEntityNotFound(_0x439b4e,null))['then'](removeEntity(_0x439b4e,null))[_0x0ad9('0x2a')](handleError(_0x439b4e,null));};exports[_0x0ad9('0x63')]=function(_0x387df9,_0x125d18){return db[_0x0ad9('0x41')][_0x0ad9('0x63')]()['then'](respondWithResult(_0x125d18,null))[_0x0ad9('0x2a')](handleError(_0x125d18,null));};exports[_0x0ad9('0x64')]=function(_0x34820d,_0x16b16a,_0x513c90){if(_0x34820d[_0x0ad9('0x61')]['id']){delete _0x34820d['body']['id'];}return db[_0x0ad9('0x41')][_0x0ad9('0x59')]({'where':{'id':_0x34820d[_0x0ad9('0x62')]['id']}})[_0x0ad9('0x37')](handleEntityNotFound(_0x16b16a,null))[_0x0ad9('0x37')](function(_0x12dc54){if(_0x12dc54){_0x34820d[_0x0ad9('0x61')][_0x0ad9('0x65')]=_0x12dc54['id'];return db['Disposition'][_0x0ad9('0x5a')](_0x34820d[_0x0ad9('0x61')]);}})[_0x0ad9('0x37')](respondWithResult(_0x16b16a,null))[_0x0ad9('0x2a')](handleError(_0x16b16a,null));};exports[_0x0ad9('0x66')]=function(_0x2806be,_0x45dd89,_0x1d289f){var _0x2b1fd7={'raw':![],'where':{}};var _0x28720a={};var _0x4def93={'count':0x0,'rows':[]};return db[_0x0ad9('0x41')][_0x0ad9('0x67')]({'where':{'id':_0x2806be[_0x0ad9('0x62')]['id']}})[_0x0ad9('0x37')](handleEntityNotFound(_0x45dd89,null))['then'](function(_0x3297a2){if(_0x3297a2){_0x28720a[_0x0ad9('0x45')]=_[_0x0ad9('0x46')](db['Disposition']['rawAttributes']);_0x28720a[_0x0ad9('0x47')]=_['keys'](_0x2806be[_0x0ad9('0x47')]);_0x28720a[_0x0ad9('0x48')]=_[_0x0ad9('0x49')](_0x28720a['model'],_0x28720a[_0x0ad9('0x47')]);_0x2b1fd7[_0x0ad9('0x4a')]=_[_0x0ad9('0x49')](_0x28720a[_0x0ad9('0x45')],qs[_0x0ad9('0x4b')](_0x2806be[_0x0ad9('0x47')][_0x0ad9('0x4b')]));_0x2b1fd7[_0x0ad9('0x4a')]=_0x2b1fd7[_0x0ad9('0x4a')][_0x0ad9('0x4c')]?_0x2b1fd7[_0x0ad9('0x4a')]:_0x28720a['model'];if(!_0x2806be[_0x0ad9('0x47')]['hasOwnProperty'](_0x0ad9('0x4e'))){_0x2b1fd7[_0x0ad9('0x30')]=qs[_0x0ad9('0x30')](_0x2806be[_0x0ad9('0x47')][_0x0ad9('0x30')]);_0x2b1fd7[_0x0ad9('0x2e')]=qs['offset'](_0x2806be[_0x0ad9('0x47')]['offset']);}_0x2b1fd7[_0x0ad9('0x68')]=qs['sort'](_0x2806be[_0x0ad9('0x47')][_0x0ad9('0x4f')]);_0x2b1fd7[_0x0ad9('0x52')]=qs[_0x0ad9('0x48')](_['pick'](_0x2806be[_0x0ad9('0x47')],_0x28720a[_0x0ad9('0x48')]));_0x2b1fd7[_0x0ad9('0x52')]['WhatsappAccountId']=_0x3297a2['id'];if(_0x2806be[_0x0ad9('0x47')][_0x0ad9('0x51')]){_0x2b1fd7[_0x0ad9('0x52')]=_[_0x0ad9('0x53')](_0x2b1fd7[_0x0ad9('0x52')],{'$or':_[_0x0ad9('0x40')](_0x2b1fd7[_0x0ad9('0x4a')],function(_0x512e56){var _0x3c2fe4={};_0x3c2fe4[_0x512e56]={'$like':'%'+_0x2806be[_0x0ad9('0x47')]['filter']+'%'};return _0x3c2fe4;})});}_0x2b1fd7=_[_0x0ad9('0x53')]({},_0x2b1fd7,_0x2806be[_0x0ad9('0x55')]);return db[_0x0ad9('0x69')]['count']({'where':_0x2b1fd7[_0x0ad9('0x52')]})['then'](function(_0x560146){_0x4def93[_0x0ad9('0x2f')]=_0x560146;if(_0x2806be['query']['includeAll']){_0x2b1fd7['include']=[{'all':!![]}];}return db[_0x0ad9('0x69')]['findAll'](_0x2b1fd7);})[_0x0ad9('0x37')](function(_0x92c60b){_0x4def93[_0x0ad9('0x57')]=_0x92c60b;return _0x4def93;});}})['then'](respondWithFilteredResult(_0x45dd89,_0x2b1fd7))['catch'](handleError(_0x45dd89,null));};exports['removeDispositions']=function(_0x31b5b3,_0x2aea7b,_0x35830d){return db['WhatsappAccount'][_0x0ad9('0x59')]({'where':{'id':_0x31b5b3[_0x0ad9('0x62')]['id']}})[_0x0ad9('0x37')](handleEntityNotFound(_0x2aea7b,null))[_0x0ad9('0x37')](function(_0x4c0e2e){if(_0x4c0e2e){return _0x4c0e2e[_0x0ad9('0x6a')](_0x31b5b3['query'][_0x0ad9('0x6b')]);}})['then'](respondWithStatusCode(_0x2aea7b,null))[_0x0ad9('0x2a')](handleError(_0x2aea7b,null));};exports[_0x0ad9('0x6c')]=function(_0x131cbe,_0x54573a,_0x43cc68){if(_0x131cbe[_0x0ad9('0x61')]['id']){delete _0x131cbe['body']['id'];}return db[_0x0ad9('0x41')][_0x0ad9('0x59')]({'where':{'id':_0x131cbe['params']['id']}})[_0x0ad9('0x37')](handleEntityNotFound(_0x54573a,null))['then'](function(_0x19e0ed){if(_0x19e0ed){_0x131cbe[_0x0ad9('0x61')]['WhatsappAccountId']=_0x19e0ed['id'];return db[_0x0ad9('0x6d')][_0x0ad9('0x5a')](_0x131cbe[_0x0ad9('0x61')]);}})[_0x0ad9('0x37')](respondWithResult(_0x54573a,null))[_0x0ad9('0x2a')](handleError(_0x54573a,null));};exports[_0x0ad9('0x6e')]=function(_0x1112fb,_0x29ea50,_0x4ddbb2){var _0x149674={'raw':![],'where':{}};var _0x2ccc39={};var _0x44fc22={'count':0x0,'rows':[]};return db[_0x0ad9('0x41')][_0x0ad9('0x67')]({'where':{'id':_0x1112fb['params']['id']}})[_0x0ad9('0x37')](handleEntityNotFound(_0x29ea50,null))['then'](function(_0x403d93){if(_0x403d93){_0x2ccc39[_0x0ad9('0x45')]=_[_0x0ad9('0x46')](db['CannedAnswer']['rawAttributes']);_0x2ccc39[_0x0ad9('0x47')]=_[_0x0ad9('0x46')](_0x1112fb[_0x0ad9('0x47')]);_0x2ccc39[_0x0ad9('0x48')]=_['intersection'](_0x2ccc39[_0x0ad9('0x45')],_0x2ccc39[_0x0ad9('0x47')]);_0x149674[_0x0ad9('0x4a')]=_['intersection'](_0x2ccc39['model'],qs[_0x0ad9('0x4b')](_0x1112fb[_0x0ad9('0x47')][_0x0ad9('0x4b')]));_0x149674['attributes']=_0x149674['attributes'][_0x0ad9('0x4c')]?_0x149674[_0x0ad9('0x4a')]:_0x2ccc39[_0x0ad9('0x45')];if(!_0x1112fb[_0x0ad9('0x47')][_0x0ad9('0x4d')](_0x0ad9('0x4e'))){_0x149674[_0x0ad9('0x30')]=qs[_0x0ad9('0x30')](_0x1112fb[_0x0ad9('0x47')][_0x0ad9('0x30')]);_0x149674[_0x0ad9('0x2e')]=qs['offset'](_0x1112fb[_0x0ad9('0x47')][_0x0ad9('0x2e')]);}_0x149674[_0x0ad9('0x68')]=qs['sort'](_0x1112fb[_0x0ad9('0x47')]['sort']);_0x149674[_0x0ad9('0x52')]=qs[_0x0ad9('0x48')](_[_0x0ad9('0x50')](_0x1112fb[_0x0ad9('0x47')],_0x2ccc39[_0x0ad9('0x48')]));_0x149674[_0x0ad9('0x52')][_0x0ad9('0x65')]=_0x403d93['id'];if(_0x1112fb[_0x0ad9('0x47')][_0x0ad9('0x51')]){_0x149674[_0x0ad9('0x52')]=_[_0x0ad9('0x53')](_0x149674[_0x0ad9('0x52')],{'$or':_['map'](_0x149674['attributes'],function(_0x1e8a49){var _0x3aac42={};_0x3aac42[_0x1e8a49]={'$like':'%'+_0x1112fb[_0x0ad9('0x47')][_0x0ad9('0x51')]+'%'};return _0x3aac42;})});}_0x149674=_[_0x0ad9('0x53')]({},_0x149674,_0x1112fb[_0x0ad9('0x55')]);return db[_0x0ad9('0x6d')][_0x0ad9('0x2f')]({'where':_0x149674['where']})[_0x0ad9('0x37')](function(_0x20789c){_0x44fc22[_0x0ad9('0x2f')]=_0x20789c;if(_0x1112fb[_0x0ad9('0x47')][_0x0ad9('0x58')]){_0x149674[_0x0ad9('0x56')]=[{'all':!![]}];}return db[_0x0ad9('0x6d')][_0x0ad9('0x6f')](_0x149674);})[_0x0ad9('0x37')](function(_0x1b017f){_0x44fc22['rows']=_0x1b017f;return _0x44fc22;});}})[_0x0ad9('0x37')](respondWithFilteredResult(_0x29ea50,_0x149674))[_0x0ad9('0x2a')](handleError(_0x29ea50,null));};exports[_0x0ad9('0x70')]=function(_0x3e2f81,_0x2d5589,_0x126f40){return db['WhatsappAccount'][_0x0ad9('0x59')]({'where':{'id':_0x3e2f81[_0x0ad9('0x62')]['id']}})[_0x0ad9('0x37')](handleEntityNotFound(_0x2d5589,null))[_0x0ad9('0x37')](function(_0xf320f0){if(_0xf320f0){return _0xf320f0['removeAnswers'](_0x3e2f81[_0x0ad9('0x47')]['ids']);}})[_0x0ad9('0x37')](respondWithStatusCode(_0x2d5589,null))[_0x0ad9('0x2a')](handleError(_0x2d5589,null));};exports[_0x0ad9('0x71')]=function(_0x43b9cd,_0x2d7bac,_0x3d1b4c){return db[_0x0ad9('0x41')]['find']({'where':{'id':_0x43b9cd[_0x0ad9('0x62')]['id']}})[_0x0ad9('0x37')](handleEntityNotFound(_0x2d7bac,null))[_0x0ad9('0x37')](function(_0x299ab4){if(_0x299ab4){return _0x299ab4[_0x0ad9('0x71')](_0x43b9cd[_0x0ad9('0x61')][_0x0ad9('0x6b')],_[_0x0ad9('0x72')](_0x43b9cd[_0x0ad9('0x61')],[_0x0ad9('0x6b'),'id'])||{})[_0x0ad9('0x73')](function(_0x301cff){for(var _0x46ab90=0x0;_0x46ab90<_0x43b9cd['body'][_0x0ad9('0x6b')][_0x0ad9('0x4c')];_0x46ab90+=0x1){socket[_0x0ad9('0x74')]('userWhatsappAccount:save',{'UserId':Number(_0x43b9cd['body']['ids'][_0x46ab90]),'WhatsappAccountId':Number(_0x43b9cd[_0x0ad9('0x62')]['id'])});}return _0x301cff;});}})[_0x0ad9('0x37')](respondWithResult(_0x2d7bac,null))[_0x0ad9('0x2a')](handleError(_0x2d7bac,null));};exports['removeAgents']=function(_0x250dcf,_0x30d177,_0x106608){return db[_0x0ad9('0x41')][_0x0ad9('0x59')]({'where':{'id':_0x250dcf[_0x0ad9('0x62')]['id']}})[_0x0ad9('0x37')](handleEntityNotFound(_0x30d177,null))[_0x0ad9('0x37')](function(_0x5c3f6c){if(_0x5c3f6c){return _0x5c3f6c[_0x0ad9('0x75')](_0x250dcf[_0x0ad9('0x47')][_0x0ad9('0x6b')])[_0x0ad9('0x37')](function(){if(_[_0x0ad9('0x76')](_0x250dcf[_0x0ad9('0x47')][_0x0ad9('0x6b')])){for(var _0x200f8d=0x0;_0x200f8d<_0x250dcf[_0x0ad9('0x47')]['ids'][_0x0ad9('0x4c')];_0x200f8d+=0x1){socket[_0x0ad9('0x74')](_0x0ad9('0x77'),{'UserId':Number(_0x250dcf[_0x0ad9('0x47')][_0x0ad9('0x6b')][_0x200f8d]),'WhatsappAccountId':Number(_0x250dcf[_0x0ad9('0x62')]['id'])});}}else{socket['emit'](_0x0ad9('0x77'),{'UserId':Number(_0x250dcf[_0x0ad9('0x47')][_0x0ad9('0x6b')]),'WhatsappAccountId':Number(_0x250dcf['params']['id'])});}});}})[_0x0ad9('0x37')](respondWithStatusCode(_0x30d177,null))[_0x0ad9('0x2a')](handleError(_0x30d177,null));};exports[_0x0ad9('0x78')]=function(_0x209cf8,_0x3ea565,_0x4e23f3){var _0x28431e={};var _0x4b7343={};var _0x1f6925;var _0x46a52d;return db['WhatsappAccount'][_0x0ad9('0x67')]({'where':{'id':_0x209cf8['params']['id']}})[_0x0ad9('0x37')](handleEntityNotFound(_0x3ea565,null))[_0x0ad9('0x37')](function(_0x4e691b){if(_0x4e691b){_0x1f6925=_0x4e691b;_0x4b7343[_0x0ad9('0x45')]=_['keys'](db[_0x0ad9('0x79')][_0x0ad9('0x42')]);_0x4b7343['query']=_[_0x0ad9('0x46')](_0x209cf8[_0x0ad9('0x47')]);_0x4b7343[_0x0ad9('0x48')]=_[_0x0ad9('0x49')](_0x4b7343[_0x0ad9('0x45')],_0x4b7343[_0x0ad9('0x47')]);_0x28431e[_0x0ad9('0x4a')]=_[_0x0ad9('0x49')](_0x4b7343[_0x0ad9('0x45')],qs['fields'](_0x209cf8[_0x0ad9('0x47')]['fields']));_0x28431e['attributes']=_0x28431e['attributes'][_0x0ad9('0x4c')]?_0x28431e[_0x0ad9('0x4a')]:_0x4b7343['model'];_0x28431e[_0x0ad9('0x68')]=qs['sort'](_0x209cf8[_0x0ad9('0x47')][_0x0ad9('0x4f')]);_0x28431e[_0x0ad9('0x52')]=qs[_0x0ad9('0x48')](_['pick'](_0x209cf8[_0x0ad9('0x47')],_0x4b7343[_0x0ad9('0x48')]));if(_0x209cf8[_0x0ad9('0x47')][_0x0ad9('0x51')]){_0x28431e[_0x0ad9('0x52')]=_[_0x0ad9('0x53')](_0x28431e[_0x0ad9('0x52')],{'$or':_[_0x0ad9('0x40')](_0x28431e[_0x0ad9('0x4a')],function(_0x19e892){var _0x3010b5={};_0x3010b5[_0x19e892]={'$like':'%'+_0x209cf8[_0x0ad9('0x47')][_0x0ad9('0x51')]+'%'};return _0x3010b5;})});}_0x28431e=_[_0x0ad9('0x53')]({},_0x28431e,_0x209cf8[_0x0ad9('0x55')]);return _0x1f6925['getAgents'](_0x28431e);}})[_0x0ad9('0x37')](function(_0x27ce01){if(_0x27ce01){_0x46a52d=_0x27ce01[_0x0ad9('0x4c')];if(!_0x209cf8[_0x0ad9('0x47')]['hasOwnProperty'](_0x0ad9('0x4e'))){_0x28431e[_0x0ad9('0x30')]=qs['limit'](_0x209cf8[_0x0ad9('0x47')][_0x0ad9('0x30')]);_0x28431e[_0x0ad9('0x2e')]=qs[_0x0ad9('0x2e')](_0x209cf8[_0x0ad9('0x47')]['offset']);}return _0x1f6925[_0x0ad9('0x78')](_0x28431e);}})[_0x0ad9('0x37')](function(_0xba8fd2){if(_0xba8fd2){return _0xba8fd2?{'count':_0x46a52d,'rows':_0xba8fd2}:null;}})[_0x0ad9('0x37')](respondWithResult(_0x3ea565,null))['catch'](handleError(_0x3ea565,null));};exports[_0x0ad9('0x7a')]=function(_0xc24c0,_0x402d5f,_0x3d0d21){return db[_0x0ad9('0x41')][_0x0ad9('0x67')]({'where':{'id':_0xc24c0[_0x0ad9('0x62')]['id']}})[_0x0ad9('0x37')](handleEntityNotFound(_0x402d5f,null))[_0x0ad9('0x37')](function(_0x24b9b7){if(_0x24b9b7){return db[_0x0ad9('0x7b')][_0x0ad9('0x7c')](function(_0x307d78){return db[_0x0ad9('0x7d')][_0x0ad9('0x3a')]({'where':{'WhatsappAccountId':_0xc24c0[_0x0ad9('0x62')]['id']},'transaction':_0x307d78})[_0x0ad9('0x37')](function(_0x5eaacc){var _0x4b436a=_['map'](_0xc24c0['body'],function(_0x2cc93f){_0x2cc93f[_0x0ad9('0x65')]=_0xc24c0[_0x0ad9('0x62')]['id'];return _0x2cc93f;});return db['WhatsappApplication']['bulkCreate'](_0x4b436a,{'transaction':_0x307d78});});})[_0x0ad9('0x37')](function(){return db[_0x0ad9('0x7d')][_0x0ad9('0x7e')]({'where':{'WhatsappAccountId':_0xc24c0[_0x0ad9('0x62')]['id']},'order':_0x0ad9('0x7f')});});}})['then'](respondWithResult(_0x402d5f,null))['catch'](handleError(_0x402d5f,null));};exports[_0x0ad9('0x80')]=function(_0x3f000d,_0x20e266,_0x3e0ec4){var _0x4bce40={};var _0xb7ee93={};var _0x4c3de9;var _0x2cc581;return db[_0x0ad9('0x41')]['findOne']({'where':{'id':_0x3f000d[_0x0ad9('0x62')]['id']}})[_0x0ad9('0x37')](handleEntityNotFound(_0x20e266,null))[_0x0ad9('0x37')](function(_0x46a337){if(_0x46a337){_0x4c3de9=_0x46a337;_0xb7ee93[_0x0ad9('0x45')]=_[_0x0ad9('0x46')](db[_0x0ad9('0x7d')][_0x0ad9('0x42')]);_0xb7ee93[_0x0ad9('0x47')]=_[_0x0ad9('0x46')](_0x3f000d[_0x0ad9('0x47')]);_0xb7ee93[_0x0ad9('0x48')]=_[_0x0ad9('0x49')](_0xb7ee93[_0x0ad9('0x45')],_0xb7ee93[_0x0ad9('0x47')]);_0x4bce40[_0x0ad9('0x4a')]=_[_0x0ad9('0x49')](_0xb7ee93[_0x0ad9('0x45')],qs['fields'](_0x3f000d['query'][_0x0ad9('0x4b')]));_0x4bce40[_0x0ad9('0x4a')]=_0x4bce40['attributes'][_0x0ad9('0x4c')]?_0x4bce40['attributes']:_0xb7ee93[_0x0ad9('0x45')];_0x4bce40[_0x0ad9('0x68')]=qs[_0x0ad9('0x4f')](_0x3f000d[_0x0ad9('0x47')][_0x0ad9('0x4f')]);_0x4bce40[_0x0ad9('0x52')]=qs[_0x0ad9('0x48')](_[_0x0ad9('0x50')](_0x3f000d['query'],_0xb7ee93[_0x0ad9('0x48')]));if(_0x3f000d['query'][_0x0ad9('0x51')]){_0x4bce40[_0x0ad9('0x52')]=_[_0x0ad9('0x53')](_0x4bce40[_0x0ad9('0x52')],{'$or':_[_0x0ad9('0x40')](_0x4bce40[_0x0ad9('0x4a')],function(_0x1083fc){var _0x490279={};_0x490279[_0x1083fc]={'$like':'%'+_0x3f000d[_0x0ad9('0x47')]['filter']+'%'};return _0x490279;})});}_0x4bce40=_['merge']({},_0x4bce40,_0x3f000d[_0x0ad9('0x55')]);return _0x4c3de9[_0x0ad9('0x80')](_0x4bce40);}})['then'](function(_0x3e6aeb){if(_0x3e6aeb){_0x2cc581=_0x3e6aeb['length'];if(!_0x3f000d['query'][_0x0ad9('0x4d')](_0x0ad9('0x4e'))){_0x4bce40[_0x0ad9('0x30')]=qs[_0x0ad9('0x30')](_0x3f000d['query'][_0x0ad9('0x30')]);_0x4bce40[_0x0ad9('0x2e')]=qs['offset'](_0x3f000d[_0x0ad9('0x47')][_0x0ad9('0x2e')]);}return _0x4c3de9[_0x0ad9('0x80')](_0x4bce40);}})[_0x0ad9('0x37')](function(_0x47a37a){if(_0x47a37a){return _0x47a37a?{'count':_0x2cc581,'rows':_0x47a37a}:null;}})[_0x0ad9('0x37')](respondWithResult(_0x20e266,null))[_0x0ad9('0x2a')](handleError(_0x20e266,null));};exports[_0x0ad9('0x81')]=function(_0x3a4d89,_0x4cb7e4,_0x5bbed8){var _0x1b73a0={'channel':_0x0ad9('0x82')};var _0x2db503=[];var _0x1c4f9f=[];var _0x495873={};return db['WhatsappAccount'][_0x0ad9('0x59')]({'where':{'id':_0x3a4d89[_0x0ad9('0x62')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x0ad9('0x83')}]})[_0x0ad9('0x37')](handleEntityNotFound(_0x4cb7e4,null))[_0x0ad9('0x37')](function(_0x240ddf){_0x1b73a0[_0x0ad9('0x84')]=_0x240ddf;_0x1b73a0['applications']=_['orderBy'](_0x240ddf[_0x0ad9('0x83')],[_0x0ad9('0x7f')],[_0x0ad9('0x85')]);if(_0x1b73a0['account']['Applications']){delete _0x1b73a0[_0x0ad9('0x84')][_0x0ad9('0x83')];}return db['CmContact'][_0x0ad9('0x63')]();})['then'](function(_0x363edf){if(!_0x363edf){throw new db[(_0x0ad9('0x86'))][(_0x0ad9('0x87'))](_0x0ad9('0x88'));}_0x2db503=_[_0x0ad9('0x89')](_[_0x0ad9('0x46')](_0x363edf),[_0x0ad9('0x8a'),_0x0ad9('0x8b')]);_0x1c4f9f=_[_0x0ad9('0x89')](_[_0x0ad9('0x46')](_0x363edf),[_0x0ad9('0x8a'),_0x0ad9('0x8b'),_0x0ad9('0x8c'),'ListId']);_0x1b73a0['body']={'mapKey':'mobile'};if(_0x1b73a0[_0x0ad9('0x84')][_0x0ad9('0x43')]&&_0x1b73a0[_0x0ad9('0x84')]['type']===_0x0ad9('0x8d')){_0x1b73a0[_0x0ad9('0x61')]['from']=_0x3a4d89[_0x0ad9('0x61')][_0x0ad9('0x8e')]['replace'](_0x0ad9('0x8f'),'');_0x1b73a0[_0x0ad9('0x61')][_0x0ad9('0x61')]=_0x3a4d89[_0x0ad9('0x61')][_0x0ad9('0x90')];_0x1b73a0['body'][_0x0ad9('0x91')]=_0x3a4d89['body'][_0x0ad9('0x92')];}if(_0x1b73a0[_0x0ad9('0x61')]['id']){delete _0x1b73a0[_0x0ad9('0x61')]['id'];}if(_[_0x0ad9('0x93')](_0x1b73a0[_0x0ad9('0x61')][_0x0ad9('0x94')])){throw new db[(_0x0ad9('0x86'))][(_0x0ad9('0x87'))](_0x0ad9('0x95'));}if(_[_0x0ad9('0x93')](_0x1b73a0[_0x0ad9('0x61')][_0x0ad9('0x61')])||_0x1b73a0[_0x0ad9('0x61')][_0x0ad9('0x61')]===''){throw new db[(_0x0ad9('0x86'))][(_0x0ad9('0x87'))](_0x0ad9('0x96'));}if(_[_0x0ad9('0x93')](_0x1b73a0['body']['mapKey'])){throw new db[(_0x0ad9('0x86'))][(_0x0ad9('0x87'))](_0x0ad9('0x97')+_0x1c4f9f);}if(!_['includes'](_0x1c4f9f,_0x1b73a0[_0x0ad9('0x61')][_0x0ad9('0x98')])){throw new db[(_0x0ad9('0x86'))][(_0x0ad9('0x87'))](_0x0ad9('0x99')+_0x1c4f9f);}_0x495873[_0x1b73a0[_0x0ad9('0x61')][_0x0ad9('0x98')]]=_0x1b73a0[_0x0ad9('0x61')][_0x0ad9('0x94')];return db[_0x0ad9('0x9a')][_0x0ad9('0x59')]({'where':{'id':_0x1b73a0[_0x0ad9('0x84')][_0x0ad9('0x9b')]},'include':[{'model':db[_0x0ad9('0x9c')],'as':_0x0ad9('0x9d'),'where':_0x495873,'limit':0x1,'order':[[_0x0ad9('0x8b'),'DESC']]}]});})[_0x0ad9('0x37')](handleEntityNotFound(_0x4cb7e4,null))[_0x0ad9('0x37')](function(_0x1a699d){if(_0x1a699d){_0x1b73a0[_0x0ad9('0x9e')]=_[_0x0ad9('0x72')](_0x1a699d,[_0x0ad9('0x9d')]);if(_0x1a699d['Contacts'][_0x0ad9('0x4c')]){return _0x1a699d[_0x0ad9('0x9d')][0x0];}var _0x3fde39=_[_0x0ad9('0x18')](_0x1b73a0['body'],{'firstName':_0x1b73a0[_0x0ad9('0x61')]['from'],'ListId':_0x1a699d['id']});_0x3fde39[_0x1b73a0[_0x0ad9('0x61')][_0x0ad9('0x98')]]=_0x1b73a0[_0x0ad9('0x61')][_0x0ad9('0x94')];return db[_0x0ad9('0x9c')][_0x0ad9('0x5a')](_0x3fde39,{'fields':_0x2db503,'raw':!![]});}})[_0x0ad9('0x37')](handleEntityNotFound(_0x4cb7e4,null))[_0x0ad9('0x37')](function(_0xe46970){if(_0xe46970){_0x1b73a0[_0x0ad9('0x9f')]=_0xe46970;var _0x557b7b={'ContactId':_0xe46970['id'],'phone':_0x1b73a0[_0x0ad9('0x61')][_0x0ad9('0x94')],'WhatsappAccountId':_0x3a4d89['params']['id']};var _0xbf9787={'ContactId':_0xe46970['id'],'WhatsappAccountId':_0x3a4d89[_0x0ad9('0x62')]['id'],'closed':![]};return db[_0x0ad9('0xa0')][_0x0ad9('0x59')]({'where':_0xbf9787})['then'](function(_0x51ecc){if(_0x51ecc){return[_0x51ecc,![]];}return db[_0x0ad9('0xa0')]['create'](_0x557b7b)[_0x0ad9('0x37')](function(_0x17d9bb){return[_0x17d9bb,!![]];});});}})[_0x0ad9('0x73')](function(_0x295eb5,_0x412243){_0x1b73a0[_0x0ad9('0xa1')]=_0x295eb5[_0x0ad9('0x38')]({'plain':!![]});_0x1b73a0[_0x0ad9('0xa1')][_0x0ad9('0xa2')]=![];if(_0x412243){if(_0x1b73a0[_0x0ad9('0x84')][_0x0ad9('0xa3')]){_0x1b73a0[_0x0ad9('0xa4')]['push']({'id':0x0,'priority':_0x1b73a0['applications']['length']+0x1,'app':'close','appdata':_0x0ad9('0xa5'),'interval':_0x0ad9('0xa6')});}_0x1b73a0[_0x0ad9('0xa1')][_0x0ad9('0xa2')]=!![];}return db[_0x0ad9('0xa7')][_0x0ad9('0x5a')]({'phone':_0x1b73a0[_0x0ad9('0x61')][_0x0ad9('0x94')],'messageId':_0x1b73a0['body'][_0x0ad9('0x91')],'body':_0x1b73a0[_0x0ad9('0x61')]['body'],'WhatsappAccountId':_0x3a4d89['params']['id'],'WhatsappInteractionId':_0x295eb5['id'],'direction':'in','ContactId':_0x295eb5['ContactId'],'AttachmentId':_0x1b73a0['body'][_0x0ad9('0xa8')]});})[_0x0ad9('0x37')](function(_0x285b94){_0x1b73a0['message']=_0x285b94;if(_0x1b73a0['interaction'][_0x0ad9('0xa9')]){return db[_0x0ad9('0x79')][_0x0ad9('0x59')]({'attributes':['id',_0x0ad9('0x3d')],'where':{'id':_0x1b73a0[_0x0ad9('0xa1')]['UserId']}})[_0x0ad9('0x37')](function(_0xe8f99c){if(_0xe8f99c){_0x1b73a0[_0x0ad9('0xa4')][_0x0ad9('0xaa')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xe8f99c['name']+','+(_0x1b73a0['account'][_0x0ad9('0xab')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x0ad9('0xac'),'startRouting',_0x1b73a0);});}return respondWithRpcPromise(_0x0ad9('0xac'),_0x0ad9('0xad'),_0x1b73a0);})['then'](function(_0x3cf8ad){if(_0x3cf8ad){var _0xb60d9c=0xc8;var _0x30fc97=_0x0ad9('0xae');logger[_0x0ad9('0x21')](_0x0ad9('0x25'),_0x30fc97,_0xb60d9c,_0x0ad9('0xaf'));logger[_0x0ad9('0x24')](_0x0ad9('0xb0'),_0x30fc97,_0xb60d9c,_0x0ad9('0xaf'),JSON[_0x0ad9('0xb1')](_0x3cf8ad));if(_0x1b73a0[_0x0ad9('0x84')]['type']===_0x0ad9('0x8d')){return _0x4cb7e4['status'](_0xb60d9c)['set'](_0x0ad9('0xb2'),_0x0ad9('0xb3'))[_0x0ad9('0xb4')](_0x0ad9('0xb5'));}else{return _0x4cb7e4[_0x0ad9('0x2c')](_0xb60d9c)['json'](_0x3cf8ad);}}})[_0x0ad9('0x2a')](handleError(_0x4cb7e4,null));};exports['send']=function(_0x31ed6e,_0x44ba4e,_0x4c6030){var _0x22624f,_0x5f8e5b,_0x2349a5;if(_[_0x0ad9('0x93')](_0x31ed6e[_0x0ad9('0x61')][_0x0ad9('0x61')])||_0x31ed6e[_0x0ad9('0x61')][_0x0ad9('0x61')]===''){throw new db[(_0x0ad9('0x86'))][(_0x0ad9('0x87'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x31ed6e[_0x0ad9('0x61')]['to'])){throw new db[(_0x0ad9('0x86'))][(_0x0ad9('0x87'))](_0x0ad9('0xb6'));}_0x22624f=_0x31ed6e[_0x0ad9('0x61')]['to'];return db[_0x0ad9('0x41')][_0x0ad9('0x59')]({'where':{'id':_0x31ed6e[_0x0ad9('0x62')]['id']},'include':[{'model':db[_0x0ad9('0x9a')],'as':_0x0ad9('0xb7'),'include':[{'model':db[_0x0ad9('0x9c')],'as':_0x0ad9('0x9d'),'where':{'mobile':_0x22624f},'limit':0x1,'order':[[_0x0ad9('0x8b'),'DESC']]}]}]})[_0x0ad9('0x37')](handleEntityNotFound(_0x44ba4e,null))['then'](function(_0x59e8f0){if(_0x59e8f0&&_0x59e8f0[_0x0ad9('0xb7')]){_0x5f8e5b=_0x59e8f0[_0x0ad9('0x38')]({'plain':!![]});if(_0x5f8e5b[_0x0ad9('0xb7')]&&_0x5f8e5b[_0x0ad9('0xb7')][_0x0ad9('0x9d')][_0x0ad9('0x4c')]){return _0x5f8e5b[_0x0ad9('0xb7')][_0x0ad9('0x9d')][0x0];}return db[_0x0ad9('0x9c')][_0x0ad9('0x5a')](_[_0x0ad9('0x18')](_0x31ed6e[_0x0ad9('0x61')],{'firstName':_0x22624f,'mobile':_0x22624f,'phone':_0x22624f,'ListId':_0x5f8e5b[_0x0ad9('0x9b')]}));}})['then'](handleEntityNotFound(_0x44ba4e,null))['then'](function(_0x2074a8){if(_0x2074a8){_0x2349a5=_0x2074a8;return db[_0x0ad9('0xa0')][_0x0ad9('0x59')]({'where':{'ContactId':_0x2349a5['id'],'closed':![],'WhatsappAccountId':_0x5f8e5b['id']}})['then'](function(_0x391187){if(_0x391187){return[_0x391187,![]];}return db[_0x0ad9('0xa0')][_0x0ad9('0x5a')]({'UserId':_0x31ed6e['user']['id'],'ContactId':_0x2349a5['id'],'WhatsappAccountId':_0x5f8e5b['id'],'phone':_0x22624f,'firstMsgDirection':_0x0ad9('0xb8'),'Messages':[_[_0x0ad9('0x53')](_0x31ed6e['body'],{'read':![],'body':_0x31ed6e[_0x0ad9('0x61')]['body'],'phone':_0x22624f,'WhatsappAccountId':_0x5f8e5b['id'],'UserId':_0x31ed6e[_0x0ad9('0x5b')]['id'],'ContactId':_0x2349a5['id']})]},{'include':[{'model':db[_0x0ad9('0xa7')],'as':_0x0ad9('0xb9')}]})[_0x0ad9('0x37')](function(_0x3a9fdc){return[_0x3a9fdc,!![]];});});}})[_0x0ad9('0x73')](function(_0x56607a,_0x4e58c4){if(_0x4e58c4){return _0x56607a;}return db[_0x0ad9('0xa7')]['create'](_[_0x0ad9('0x53')](_0x31ed6e[_0x0ad9('0x61')],{'read':![],'body':_0x31ed6e[_0x0ad9('0x61')][_0x0ad9('0x61')],'phone':_0x22624f,'WhatsappAccountId':_0x5f8e5b['id'],'WhatsappInteractionId':_0x56607a['id'],'UserId':_0x31ed6e['user']['id'],'ContactId':_0x2349a5['id']}))['then'](function(_0x12464a){_0x56607a['dataValues'][_0x0ad9('0xb9')]=[];_0x56607a[_0x0ad9('0xba')][_0x0ad9('0xb9')][_0x0ad9('0xbb')](_0x12464a['dataValues']);return _0x56607a;});})[_0x0ad9('0x37')](respondWithResult(_0x44ba4e,null))[_0x0ad9('0x2a')](handleError(_0x44ba4e,null));}; \ No newline at end of file +var _0xb77c=['create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','nolimit','order','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','userWhatsappAccount:save','removeAgents','emit','userWhatsappAccount:remove','getAgents','sequelize','transaction','WhatsappApplication','bulkCreate','getApplications','notify','Applications','applications','orderBy','priority','asc','account','Sequelize','no\x20available\x20attributes','difference','updatedAt','CompanyId','ListId','mobile','twilio','from','whatsapp:','Body','messageId','MessageSid','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','DESC','list','WhatsappInteraction','interaction','created','autoclose','push','close','*,*,*,*','WhatsappMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','set','text/xml','to\x20is\x20mandatory','List','out','Messages','user','dataValues','eml-format','rimraf','bluebird','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/license/util','../../mysqldb','defaults','redis','localhost','register','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','findAll','rows','show','include','find','body','role','UserProfileSection','userProfileId','autoAssociation'];(function(_0x2390bd,_0x212fbd){var _0x3a969d=function(_0x3dd049){while(--_0x3dd049){_0x2390bd['push'](_0x2390bd['shift']());}};_0x3a969d(++_0x212fbd);}(_0xb77c,0x1be));var _0xcb77=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xb77c[_0x263a74];return _0x2aa86c;};'use strict';var emlformat=require(_0xcb77('0x0'));var rimraf=require(_0xcb77('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xcb77('0x2'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xcb77('0x3'));var csv=require('to-csv');var ejs=require(_0xcb77('0x4'));var fs=require('fs');var fs_extra=require(_0xcb77('0x5'));var _=require(_0xcb77('0x6'));var squel=require(_0xcb77('0x7'));var crypto=require(_0xcb77('0x8'));var jsforce=require(_0xcb77('0x9'));var deskjs=require(_0xcb77('0xa'));var toCsv=require(_0xcb77('0xb'));var querystring=require(_0xcb77('0xc'));var Papa=require('papaparse');var Redis=require(_0xcb77('0xd'));var authService=require(_0xcb77('0xe'));var qs=require(_0xcb77('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcb77('0x10'));var logger=require('../../config/logger')(_0xcb77('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xcb77('0x12'));var db=require(_0xcb77('0x13'))['db'];config['redis']=_[_0xcb77('0x14')](config[_0xcb77('0x15')],{'host':_0xcb77('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcb77('0x15')]));require('./whatsappAccount.socket')[_0xcb77('0x17')](socket);var jayson=require(_0xcb77('0x18'));var client=jayson[_0xcb77('0x19')][_0xcb77('0x1a')]({'port':0x232c});function respondWithRpcPromise(_0x4d80a3,_0x374958,_0x9562ef,_0x4739e6){return new BPromise(function(_0x4ac26f,_0x582218){var _0x4b6be3=_0x4739e6||client;return _0x4b6be3[_0xcb77('0x1b')](_0x4d80a3,_0x9562ef)[_0xcb77('0x1c')](function(_0x38cd8e){logger[_0xcb77('0x1d')](_0xcb77('0x1e'),_0x374958,'request\x20sent');logger['debug'](_0xcb77('0x1f'),_0x374958,_0xcb77('0x20'),JSON[_0xcb77('0x21')](_0x38cd8e));if(_0x38cd8e[_0xcb77('0x22')]){if(_0x38cd8e['error'][_0xcb77('0x23')]===0x1f4){logger[_0xcb77('0x22')](_0xcb77('0x1e'),_0x374958,_0x38cd8e[_0xcb77('0x22')][_0xcb77('0x24')]);return _0x582218(_0x38cd8e[_0xcb77('0x22')]['message']);}logger[_0xcb77('0x22')](_0xcb77('0x1e'),_0x374958,_0x38cd8e[_0xcb77('0x22')]['message']);return _0x4ac26f(_0x38cd8e['error'][_0xcb77('0x24')]);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x374958,'request\x20sent');_0x4ac26f(_0x38cd8e['result']['message']);}})[_0xcb77('0x25')](function(_0x2ba39f){logger[_0xcb77('0x22')](_0xcb77('0x1e'),_0x374958,_0x2ba39f);_0x582218(_0x2ba39f);});});}function respondWithStatusCode(_0x47a5ed,_0xc9c908){_0xc9c908=_0xc9c908||0xcc;return function(_0x22d398){if(_0x22d398){return _0x47a5ed[_0xcb77('0x26')](_0xc9c908);}return _0x47a5ed[_0xcb77('0x27')](_0xc9c908)[_0xcb77('0x28')]();};}function respondWithResult(_0x562f4a,_0x37f134){_0x37f134=_0x37f134||0xc8;return function(_0x20cae4){if(_0x20cae4){return _0x562f4a[_0xcb77('0x27')](_0x37f134)[_0xcb77('0x29')](_0x20cae4);}};}function respondWithFilteredResult(_0x17832a,_0x4eea33){return function(_0x33697b){if(_0x33697b){var _0x14cafc=typeof _0x4eea33[_0xcb77('0x2a')]===_0xcb77('0x2b')&&typeof _0x4eea33[_0xcb77('0x2c')]===_0xcb77('0x2b');var _0x349f47=_0x33697b[_0xcb77('0x2d')];var _0x4e3c21=_0x14cafc?0x0:_0x4eea33[_0xcb77('0x2a')];var _0x521ae0=_0x14cafc?_0x33697b[_0xcb77('0x2d')]:_0x4eea33['offset']+_0x4eea33[_0xcb77('0x2c')];var _0x551084;if(_0x521ae0>=_0x349f47){_0x521ae0=_0x349f47;_0x551084=0xc8;}else{_0x551084=0xce;}_0x17832a[_0xcb77('0x27')](_0x551084);return _0x17832a['set'](_0xcb77('0x2e'),_0x4e3c21+'-'+_0x521ae0+'/'+_0x349f47)[_0xcb77('0x29')](_0x33697b);}return null;};}function patchUpdates(_0x23aeb8){return function(_0xd26583){try{jsonpatch[_0xcb77('0x2f')](_0xd26583,_0x23aeb8,!![]);}catch(_0x516310){return BPromise[_0xcb77('0x30')](_0x516310);}return _0xd26583['save']();};}function saveUpdates(_0x4b67b3,_0x549bf9){return function(_0xc0a8b4){if(_0xc0a8b4){return _0xc0a8b4[_0xcb77('0x31')](_0x4b67b3)['then'](function(_0x3b9473){return _0x3b9473;});}return null;};}function removeEntity(_0x53ba0d,_0x3b63e7){return function(_0x1d7779){if(_0x1d7779){return _0x1d7779[_0xcb77('0x32')]()['then'](function(){var _0x159aa7=_0x1d7779[_0xcb77('0x33')]({'plain':!![]});var _0x4e9688=_0xcb77('0x34');return db[_0xcb77('0x35')]['destroy']({'where':{'type':_0x4e9688,'resourceId':_0x159aa7['id']}})['then'](function(){return _0x1d7779;});})[_0xcb77('0x1c')](function(){_0x53ba0d[_0xcb77('0x27')](0xcc)[_0xcb77('0x28')]();});}};}function handleEntityNotFound(_0x1de1d6,_0x5a6d8b){return function(_0x2968a3){if(!_0x2968a3){_0x1de1d6[_0xcb77('0x26')](0x194);}return _0x2968a3;};}function handleError(_0x2725fd,_0x599889){_0x599889=_0x599889||0x1f4;return function(_0x45f4bd){logger[_0xcb77('0x22')](_0x45f4bd[_0xcb77('0x36')]);if(_0x45f4bd[_0xcb77('0x37')]){delete _0x45f4bd[_0xcb77('0x37')];}_0x2725fd['status'](_0x599889)[_0xcb77('0x38')](_0x45f4bd);};}exports[_0xcb77('0x39')]=function(_0x17e68e,_0x360e80){var _0x330b00={'include':[{'model':db['Pause'],'as':_0xcb77('0x3a')}]},_0x4ad097={},_0x7778ca={'count':0x0,'rows':[]};var _0x19b20c=_[_0xcb77('0x3b')](db[_0xcb77('0x3c')][_0xcb77('0x3d')],function(_0xaf0215){return{'name':_0xaf0215[_0xcb77('0x3e')],'type':_0xaf0215[_0xcb77('0x3f')][_0xcb77('0x40')]};});_0x4ad097[_0xcb77('0x41')]=_[_0xcb77('0x3b')](_0x19b20c,_0xcb77('0x37'));_0x4ad097[_0xcb77('0x42')]=_[_0xcb77('0x43')](_0x17e68e[_0xcb77('0x42')]);_0x4ad097[_0xcb77('0x44')]=_[_0xcb77('0x45')](_0x4ad097['model'],_0x4ad097[_0xcb77('0x42')]);_0x330b00['attributes']=_[_0xcb77('0x45')](_0x4ad097['model'],qs[_0xcb77('0x46')](_0x17e68e['query'][_0xcb77('0x46')]));_0x330b00[_0xcb77('0x47')]=_0x330b00['attributes'][_0xcb77('0x48')]?_0x330b00[_0xcb77('0x47')]:_0x4ad097[_0xcb77('0x41')];if(!_0x17e68e[_0xcb77('0x42')][_0xcb77('0x49')]('nolimit')){_0x330b00[_0xcb77('0x2c')]=qs[_0xcb77('0x2c')](_0x17e68e['query'][_0xcb77('0x2c')]);_0x330b00[_0xcb77('0x2a')]=qs['offset'](_0x17e68e[_0xcb77('0x42')][_0xcb77('0x2a')]);}_0x330b00['order']=qs[_0xcb77('0x4a')](_0x17e68e[_0xcb77('0x42')][_0xcb77('0x4a')]);_0x330b00[_0xcb77('0x4b')]=qs[_0xcb77('0x44')](_[_0xcb77('0x4c')](_0x17e68e[_0xcb77('0x42')],_0x4ad097[_0xcb77('0x44')]),_0x19b20c);if(_0x17e68e[_0xcb77('0x42')][_0xcb77('0x4d')]){_0x330b00['where']=_[_0xcb77('0x4e')](_0x330b00[_0xcb77('0x4b')],{'$or':_['map'](_0x19b20c,function(_0x57f3a1){if(_0x57f3a1[_0xcb77('0x3f')]!=='VIRTUAL'){var _0x373214={};_0x373214[_0x57f3a1[_0xcb77('0x37')]]={'$like':'%'+_0x17e68e[_0xcb77('0x42')][_0xcb77('0x4d')]+'%'};return _0x373214;}})});}_0x330b00=_[_0xcb77('0x4e')]({},_0x330b00,_0x17e68e[_0xcb77('0x4f')]);var _0x19cb9c={'where':_0x330b00['where']};return db['WhatsappAccount']['count'](_0x19cb9c)['then'](function(_0x4a9ab7){_0x7778ca[_0xcb77('0x2d')]=_0x4a9ab7;if(_0x17e68e[_0xcb77('0x42')][_0xcb77('0x50')]){_0x330b00['include']=[{'all':!![]}];}return db[_0xcb77('0x3c')][_0xcb77('0x51')](_0x330b00);})[_0xcb77('0x1c')](function(_0x529ff6){_0x7778ca[_0xcb77('0x52')]=_0x529ff6;return _0x7778ca;})[_0xcb77('0x1c')](respondWithFilteredResult(_0x360e80,_0x330b00))[_0xcb77('0x25')](handleError(_0x360e80,null));};exports[_0xcb77('0x53')]=function(_0x412f4f,_0x408578){var _0x440713={'raw':![],'where':{'id':_0x412f4f['params']['id']},'include':[{'model':db['Pause'],'as':_0xcb77('0x3a')}]},_0x2559f9={};_0x2559f9[_0xcb77('0x41')]=_['keys'](db[_0xcb77('0x3c')][_0xcb77('0x3d')]);_0x2559f9[_0xcb77('0x42')]=_[_0xcb77('0x43')](_0x412f4f[_0xcb77('0x42')]);_0x2559f9[_0xcb77('0x44')]=_[_0xcb77('0x45')](_0x2559f9['model'],_0x2559f9['query']);_0x440713[_0xcb77('0x47')]=_['intersection'](_0x2559f9[_0xcb77('0x41')],qs[_0xcb77('0x46')](_0x412f4f[_0xcb77('0x42')][_0xcb77('0x46')]));_0x440713[_0xcb77('0x47')]=_0x440713[_0xcb77('0x47')][_0xcb77('0x48')]?_0x440713['attributes']:_0x2559f9[_0xcb77('0x41')];if(_0x412f4f[_0xcb77('0x42')][_0xcb77('0x50')]){_0x440713[_0xcb77('0x54')]=[{'all':!![]}];}_0x440713=_['merge']({},_0x440713,_0x412f4f[_0xcb77('0x4f')]);return db['WhatsappAccount'][_0xcb77('0x55')](_0x440713)['then'](handleEntityNotFound(_0x408578,null))['then'](respondWithResult(_0x408578,null))[_0xcb77('0x25')](handleError(_0x408578,null));};exports['create']=function(_0x30eb8d,_0x5824c3){return db[_0xcb77('0x3c')]['create'](_0x30eb8d[_0xcb77('0x56')],{})['then'](function(_0x1a32ca){var _0x3a729b=_0x30eb8d['user']['get']({'plain':!![]});if(!_0x3a729b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a729b[_0xcb77('0x57')]==='user'){var _0x41d405=_0x1a32ca[_0xcb77('0x33')]({'plain':!![]});var _0x2eb3e2=_0xcb77('0x34');return db[_0xcb77('0x58')]['find']({'where':{'name':_0x2eb3e2,'userProfileId':_0x3a729b[_0xcb77('0x59')]},'raw':!![]})['then'](function(_0x1acdfc){if(_0x1acdfc&&_0x1acdfc[_0xcb77('0x5a')]===0x0){return db[_0xcb77('0x35')][_0xcb77('0x5b')]({'name':_0x41d405[_0xcb77('0x37')],'resourceId':_0x41d405['id'],'type':_0x1acdfc[_0xcb77('0x37')],'sectionId':_0x1acdfc['id']},{})[_0xcb77('0x1c')](function(){return _0x1a32ca;});}else{return _0x1a32ca;}})[_0xcb77('0x25')](function(_0x246ec8){logger['error'](_0xcb77('0x5c'),_0x246ec8);throw _0x246ec8;});}return _0x1a32ca;})['then'](respondWithResult(_0x5824c3,0xc9))[_0xcb77('0x25')](handleError(_0x5824c3,null));};exports[_0xcb77('0x31')]=function(_0x133b28,_0x5d96c2){if(_0x133b28['body']['id']){delete _0x133b28['body']['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x133b28['params']['id']},'include':[{'model':db['Pause'],'as':_0xcb77('0x3a')}]})[_0xcb77('0x1c')](handleEntityNotFound(_0x5d96c2,null))[_0xcb77('0x1c')](saveUpdates(_0x133b28[_0xcb77('0x56')],null))['then'](respondWithResult(_0x5d96c2,null))['catch'](handleError(_0x5d96c2,null));};exports[_0xcb77('0x32')]=function(_0x162b04,_0x4c0a81){return db[_0xcb77('0x3c')][_0xcb77('0x55')]({'where':{'id':_0x162b04[_0xcb77('0x5d')]['id']}})[_0xcb77('0x1c')](handleEntityNotFound(_0x4c0a81,null))[_0xcb77('0x1c')](removeEntity(_0x4c0a81,null))[_0xcb77('0x25')](handleError(_0x4c0a81,null));};exports[_0xcb77('0x5e')]=function(_0x4f2f38,_0x46a7a3){return db[_0xcb77('0x3c')][_0xcb77('0x5e')]()[_0xcb77('0x1c')](respondWithResult(_0x46a7a3,null))['catch'](handleError(_0x46a7a3,null));};exports[_0xcb77('0x5f')]=function(_0x530daf,_0x2916f0,_0x2c5a57){if(_0x530daf[_0xcb77('0x56')]['id']){delete _0x530daf['body']['id'];}return db['WhatsappAccount'][_0xcb77('0x55')]({'where':{'id':_0x530daf[_0xcb77('0x5d')]['id']}})[_0xcb77('0x1c')](handleEntityNotFound(_0x2916f0,null))[_0xcb77('0x1c')](function(_0x10c096){if(_0x10c096){_0x530daf[_0xcb77('0x56')][_0xcb77('0x60')]=_0x10c096['id'];return db[_0xcb77('0x61')][_0xcb77('0x5b')](_0x530daf['body']);}})['then'](respondWithResult(_0x2916f0,null))[_0xcb77('0x25')](handleError(_0x2916f0,null));};exports[_0xcb77('0x62')]=function(_0x1d3181,_0x3abab4,_0x17b353){var _0x4ba6f5={'raw':![],'where':{}};var _0x2fe2ce={};var _0x2addc7={'count':0x0,'rows':[]};return db[_0xcb77('0x3c')][_0xcb77('0x63')]({'where':{'id':_0x1d3181[_0xcb77('0x5d')]['id']}})[_0xcb77('0x1c')](handleEntityNotFound(_0x3abab4,null))[_0xcb77('0x1c')](function(_0x1258cd){if(_0x1258cd){_0x2fe2ce['model']=_[_0xcb77('0x43')](db[_0xcb77('0x61')][_0xcb77('0x3d')]);_0x2fe2ce['query']=_[_0xcb77('0x43')](_0x1d3181[_0xcb77('0x42')]);_0x2fe2ce[_0xcb77('0x44')]=_[_0xcb77('0x45')](_0x2fe2ce[_0xcb77('0x41')],_0x2fe2ce[_0xcb77('0x42')]);_0x4ba6f5[_0xcb77('0x47')]=_[_0xcb77('0x45')](_0x2fe2ce[_0xcb77('0x41')],qs[_0xcb77('0x46')](_0x1d3181[_0xcb77('0x42')][_0xcb77('0x46')]));_0x4ba6f5['attributes']=_0x4ba6f5[_0xcb77('0x47')][_0xcb77('0x48')]?_0x4ba6f5[_0xcb77('0x47')]:_0x2fe2ce['model'];if(!_0x1d3181[_0xcb77('0x42')][_0xcb77('0x49')](_0xcb77('0x64'))){_0x4ba6f5[_0xcb77('0x2c')]=qs[_0xcb77('0x2c')](_0x1d3181['query'][_0xcb77('0x2c')]);_0x4ba6f5[_0xcb77('0x2a')]=qs[_0xcb77('0x2a')](_0x1d3181[_0xcb77('0x42')][_0xcb77('0x2a')]);}_0x4ba6f5[_0xcb77('0x65')]=qs[_0xcb77('0x4a')](_0x1d3181[_0xcb77('0x42')][_0xcb77('0x4a')]);_0x4ba6f5[_0xcb77('0x4b')]=qs['filters'](_['pick'](_0x1d3181[_0xcb77('0x42')],_0x2fe2ce[_0xcb77('0x44')]));_0x4ba6f5[_0xcb77('0x4b')][_0xcb77('0x60')]=_0x1258cd['id'];if(_0x1d3181[_0xcb77('0x42')][_0xcb77('0x4d')]){_0x4ba6f5['where']=_[_0xcb77('0x4e')](_0x4ba6f5[_0xcb77('0x4b')],{'$or':_[_0xcb77('0x3b')](_0x4ba6f5[_0xcb77('0x47')],function(_0x296eee){var _0x162ae1={};_0x162ae1[_0x296eee]={'$like':'%'+_0x1d3181[_0xcb77('0x42')][_0xcb77('0x4d')]+'%'};return _0x162ae1;})});}_0x4ba6f5=_[_0xcb77('0x4e')]({},_0x4ba6f5,_0x1d3181[_0xcb77('0x4f')]);return db[_0xcb77('0x61')]['count']({'where':_0x4ba6f5[_0xcb77('0x4b')]})[_0xcb77('0x1c')](function(_0x53e4af){_0x2addc7['count']=_0x53e4af;if(_0x1d3181['query'][_0xcb77('0x50')]){_0x4ba6f5[_0xcb77('0x54')]=[{'all':!![]}];}return db[_0xcb77('0x61')][_0xcb77('0x51')](_0x4ba6f5);})[_0xcb77('0x1c')](function(_0x19f4fb){_0x2addc7[_0xcb77('0x52')]=_0x19f4fb;return _0x2addc7;});}})[_0xcb77('0x1c')](respondWithFilteredResult(_0x3abab4,_0x4ba6f5))[_0xcb77('0x25')](handleError(_0x3abab4,null));};exports[_0xcb77('0x66')]=function(_0x5e2ddb,_0x5606c8,_0x2baff9){return db[_0xcb77('0x3c')][_0xcb77('0x55')]({'where':{'id':_0x5e2ddb[_0xcb77('0x5d')]['id']}})[_0xcb77('0x1c')](handleEntityNotFound(_0x5606c8,null))['then'](function(_0x1f4320){if(_0x1f4320){return _0x1f4320['removeDispositions'](_0x5e2ddb[_0xcb77('0x42')][_0xcb77('0x67')]);}})[_0xcb77('0x1c')](respondWithStatusCode(_0x5606c8,null))['catch'](handleError(_0x5606c8,null));};exports['addAnswer']=function(_0x38a781,_0x389d39,_0x4647f4){if(_0x38a781['body']['id']){delete _0x38a781[_0xcb77('0x56')]['id'];}return db[_0xcb77('0x3c')]['find']({'where':{'id':_0x38a781[_0xcb77('0x5d')]['id']}})[_0xcb77('0x1c')](handleEntityNotFound(_0x389d39,null))['then'](function(_0x571286){if(_0x571286){_0x38a781['body'][_0xcb77('0x60')]=_0x571286['id'];return db[_0xcb77('0x68')]['create'](_0x38a781[_0xcb77('0x56')]);}})[_0xcb77('0x1c')](respondWithResult(_0x389d39,null))[_0xcb77('0x25')](handleError(_0x389d39,null));};exports[_0xcb77('0x69')]=function(_0x114a85,_0x53bb3c,_0x5c6d53){var _0x37c5cd={'raw':![],'where':{}};var _0x3b37e4={};var _0x1f22e2={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x114a85[_0xcb77('0x5d')]['id']}})[_0xcb77('0x1c')](handleEntityNotFound(_0x53bb3c,null))[_0xcb77('0x1c')](function(_0x5097bc){if(_0x5097bc){_0x3b37e4[_0xcb77('0x41')]=_[_0xcb77('0x43')](db[_0xcb77('0x68')][_0xcb77('0x3d')]);_0x3b37e4[_0xcb77('0x42')]=_[_0xcb77('0x43')](_0x114a85[_0xcb77('0x42')]);_0x3b37e4[_0xcb77('0x44')]=_[_0xcb77('0x45')](_0x3b37e4[_0xcb77('0x41')],_0x3b37e4[_0xcb77('0x42')]);_0x37c5cd[_0xcb77('0x47')]=_[_0xcb77('0x45')](_0x3b37e4[_0xcb77('0x41')],qs[_0xcb77('0x46')](_0x114a85[_0xcb77('0x42')][_0xcb77('0x46')]));_0x37c5cd[_0xcb77('0x47')]=_0x37c5cd[_0xcb77('0x47')]['length']?_0x37c5cd[_0xcb77('0x47')]:_0x3b37e4['model'];if(!_0x114a85[_0xcb77('0x42')][_0xcb77('0x49')](_0xcb77('0x64'))){_0x37c5cd['limit']=qs['limit'](_0x114a85[_0xcb77('0x42')][_0xcb77('0x2c')]);_0x37c5cd['offset']=qs[_0xcb77('0x2a')](_0x114a85[_0xcb77('0x42')][_0xcb77('0x2a')]);}_0x37c5cd[_0xcb77('0x65')]=qs[_0xcb77('0x4a')](_0x114a85[_0xcb77('0x42')]['sort']);_0x37c5cd['where']=qs[_0xcb77('0x44')](_['pick'](_0x114a85[_0xcb77('0x42')],_0x3b37e4[_0xcb77('0x44')]));_0x37c5cd['where'][_0xcb77('0x60')]=_0x5097bc['id'];if(_0x114a85[_0xcb77('0x42')][_0xcb77('0x4d')]){_0x37c5cd[_0xcb77('0x4b')]=_[_0xcb77('0x4e')](_0x37c5cd['where'],{'$or':_[_0xcb77('0x3b')](_0x37c5cd[_0xcb77('0x47')],function(_0x3d6937){var _0x4fa951={};_0x4fa951[_0x3d6937]={'$like':'%'+_0x114a85[_0xcb77('0x42')]['filter']+'%'};return _0x4fa951;})});}_0x37c5cd=_['merge']({},_0x37c5cd,_0x114a85[_0xcb77('0x4f')]);return db['CannedAnswer'][_0xcb77('0x2d')]({'where':_0x37c5cd['where']})[_0xcb77('0x1c')](function(_0x16e7fe){_0x1f22e2[_0xcb77('0x2d')]=_0x16e7fe;if(_0x114a85['query']['includeAll']){_0x37c5cd[_0xcb77('0x54')]=[{'all':!![]}];}return db['CannedAnswer'][_0xcb77('0x51')](_0x37c5cd);})[_0xcb77('0x1c')](function(_0x2358cd){_0x1f22e2[_0xcb77('0x52')]=_0x2358cd;return _0x1f22e2;});}})[_0xcb77('0x1c')](respondWithFilteredResult(_0x53bb3c,_0x37c5cd))[_0xcb77('0x25')](handleError(_0x53bb3c,null));};exports['removeAnswers']=function(_0x11fa40,_0xc04a6,_0x439ea4){return db[_0xcb77('0x3c')]['find']({'where':{'id':_0x11fa40[_0xcb77('0x5d')]['id']}})[_0xcb77('0x1c')](handleEntityNotFound(_0xc04a6,null))[_0xcb77('0x1c')](function(_0x1f97f1){if(_0x1f97f1){return _0x1f97f1[_0xcb77('0x6a')](_0x11fa40['query'][_0xcb77('0x67')]);}})[_0xcb77('0x1c')](respondWithStatusCode(_0xc04a6,null))[_0xcb77('0x25')](handleError(_0xc04a6,null));};exports[_0xcb77('0x6b')]=function(_0x281206,_0x55c2a8,_0x500f33){return db['WhatsappAccount']['find']({'where':{'id':_0x281206[_0xcb77('0x5d')]['id']}})[_0xcb77('0x1c')](handleEntityNotFound(_0x55c2a8,null))['then'](function(_0x39895b){if(_0x39895b){return _0x39895b[_0xcb77('0x6b')](_0x281206[_0xcb77('0x56')][_0xcb77('0x67')],_[_0xcb77('0x6c')](_0x281206['body'],[_0xcb77('0x67'),'id'])||{})[_0xcb77('0x6d')](function(_0x2f8a19){for(var _0x2baf72=0x0;_0x2baf72<_0x281206[_0xcb77('0x56')][_0xcb77('0x67')][_0xcb77('0x48')];_0x2baf72+=0x1){socket['emit'](_0xcb77('0x6e'),{'UserId':Number(_0x281206[_0xcb77('0x56')][_0xcb77('0x67')][_0x2baf72]),'WhatsappAccountId':Number(_0x281206['params']['id'])});}return _0x2f8a19;});}})['then'](respondWithResult(_0x55c2a8,null))[_0xcb77('0x25')](handleError(_0x55c2a8,null));};exports[_0xcb77('0x6f')]=function(_0x27025d,_0x57c785,_0x426d29){return db[_0xcb77('0x3c')][_0xcb77('0x55')]({'where':{'id':_0x27025d[_0xcb77('0x5d')]['id']}})['then'](handleEntityNotFound(_0x57c785,null))[_0xcb77('0x1c')](function(_0x4e9f12){if(_0x4e9f12){return _0x4e9f12['removeAgents'](_0x27025d[_0xcb77('0x42')][_0xcb77('0x67')])['then'](function(){if(_['isArray'](_0x27025d['query'][_0xcb77('0x67')])){for(var _0x250a1c=0x0;_0x250a1c<_0x27025d[_0xcb77('0x42')][_0xcb77('0x67')][_0xcb77('0x48')];_0x250a1c+=0x1){socket[_0xcb77('0x70')](_0xcb77('0x71'),{'UserId':Number(_0x27025d['query']['ids'][_0x250a1c]),'WhatsappAccountId':Number(_0x27025d[_0xcb77('0x5d')]['id'])});}}else{socket[_0xcb77('0x70')](_0xcb77('0x71'),{'UserId':Number(_0x27025d[_0xcb77('0x42')]['ids']),'WhatsappAccountId':Number(_0x27025d[_0xcb77('0x5d')]['id'])});}});}})[_0xcb77('0x1c')](respondWithStatusCode(_0x57c785,null))[_0xcb77('0x25')](handleError(_0x57c785,null));};exports[_0xcb77('0x72')]=function(_0x3100f4,_0xc7e980,_0x242738){var _0x14c910={};var _0x40df69={};var _0x5c7f13;var _0x5986cd;return db[_0xcb77('0x3c')][_0xcb77('0x63')]({'where':{'id':_0x3100f4['params']['id']}})[_0xcb77('0x1c')](handleEntityNotFound(_0xc7e980,null))[_0xcb77('0x1c')](function(_0x1ba113){if(_0x1ba113){_0x5c7f13=_0x1ba113;_0x40df69['model']=_['keys'](db['User']['rawAttributes']);_0x40df69['query']=_[_0xcb77('0x43')](_0x3100f4['query']);_0x40df69['filters']=_['intersection'](_0x40df69['model'],_0x40df69[_0xcb77('0x42')]);_0x14c910[_0xcb77('0x47')]=_[_0xcb77('0x45')](_0x40df69[_0xcb77('0x41')],qs['fields'](_0x3100f4[_0xcb77('0x42')][_0xcb77('0x46')]));_0x14c910[_0xcb77('0x47')]=_0x14c910[_0xcb77('0x47')][_0xcb77('0x48')]?_0x14c910[_0xcb77('0x47')]:_0x40df69[_0xcb77('0x41')];_0x14c910[_0xcb77('0x65')]=qs[_0xcb77('0x4a')](_0x3100f4['query'][_0xcb77('0x4a')]);_0x14c910[_0xcb77('0x4b')]=qs['filters'](_[_0xcb77('0x4c')](_0x3100f4['query'],_0x40df69[_0xcb77('0x44')]));if(_0x3100f4[_0xcb77('0x42')][_0xcb77('0x4d')]){_0x14c910[_0xcb77('0x4b')]=_[_0xcb77('0x4e')](_0x14c910[_0xcb77('0x4b')],{'$or':_['map'](_0x14c910[_0xcb77('0x47')],function(_0x1df0ae){var _0x3781b1={};_0x3781b1[_0x1df0ae]={'$like':'%'+_0x3100f4[_0xcb77('0x42')][_0xcb77('0x4d')]+'%'};return _0x3781b1;})});}_0x14c910=_[_0xcb77('0x4e')]({},_0x14c910,_0x3100f4[_0xcb77('0x4f')]);return _0x5c7f13[_0xcb77('0x72')](_0x14c910);}})[_0xcb77('0x1c')](function(_0xdd398b){if(_0xdd398b){_0x5986cd=_0xdd398b[_0xcb77('0x48')];if(!_0x3100f4[_0xcb77('0x42')][_0xcb77('0x49')]('nolimit')){_0x14c910[_0xcb77('0x2c')]=qs[_0xcb77('0x2c')](_0x3100f4[_0xcb77('0x42')][_0xcb77('0x2c')]);_0x14c910[_0xcb77('0x2a')]=qs[_0xcb77('0x2a')](_0x3100f4[_0xcb77('0x42')][_0xcb77('0x2a')]);}return _0x5c7f13['getAgents'](_0x14c910);}})[_0xcb77('0x1c')](function(_0x34733a){if(_0x34733a){return _0x34733a?{'count':_0x5986cd,'rows':_0x34733a}:null;}})[_0xcb77('0x1c')](respondWithResult(_0xc7e980,null))[_0xcb77('0x25')](handleError(_0xc7e980,null));};exports['addApplications']=function(_0x4f509a,_0x438b8d,_0x368e86){return db[_0xcb77('0x3c')]['findOne']({'where':{'id':_0x4f509a[_0xcb77('0x5d')]['id']}})['then'](handleEntityNotFound(_0x438b8d,null))['then'](function(_0x57dd19){if(_0x57dd19){return db[_0xcb77('0x73')][_0xcb77('0x74')](function(_0x389816){return db[_0xcb77('0x75')][_0xcb77('0x32')]({'where':{'WhatsappAccountId':_0x4f509a[_0xcb77('0x5d')]['id']},'transaction':_0x389816})[_0xcb77('0x1c')](function(_0x385117){var _0x273e36=_[_0xcb77('0x3b')](_0x4f509a[_0xcb77('0x56')],function(_0x1fcff4){_0x1fcff4[_0xcb77('0x60')]=_0x4f509a['params']['id'];return _0x1fcff4;});return db[_0xcb77('0x75')][_0xcb77('0x76')](_0x273e36,{'transaction':_0x389816});});})['then'](function(){return db['WhatsappApplication']['findAndCountAll']({'where':{'WhatsappAccountId':_0x4f509a['params']['id']},'order':'priority'});});}})['then'](respondWithResult(_0x438b8d,null))[_0xcb77('0x25')](handleError(_0x438b8d,null));};exports[_0xcb77('0x77')]=function(_0x2c1be3,_0x39a151,_0x2f5d43){var _0x2ab016={};var _0x42336b={};var _0x336b95;var _0xa0f269;return db[_0xcb77('0x3c')][_0xcb77('0x63')]({'where':{'id':_0x2c1be3['params']['id']}})[_0xcb77('0x1c')](handleEntityNotFound(_0x39a151,null))[_0xcb77('0x1c')](function(_0x391a9a){if(_0x391a9a){_0x336b95=_0x391a9a;_0x42336b[_0xcb77('0x41')]=_[_0xcb77('0x43')](db['WhatsappApplication'][_0xcb77('0x3d')]);_0x42336b[_0xcb77('0x42')]=_[_0xcb77('0x43')](_0x2c1be3['query']);_0x42336b[_0xcb77('0x44')]=_[_0xcb77('0x45')](_0x42336b[_0xcb77('0x41')],_0x42336b[_0xcb77('0x42')]);_0x2ab016['attributes']=_['intersection'](_0x42336b[_0xcb77('0x41')],qs[_0xcb77('0x46')](_0x2c1be3[_0xcb77('0x42')]['fields']));_0x2ab016[_0xcb77('0x47')]=_0x2ab016[_0xcb77('0x47')][_0xcb77('0x48')]?_0x2ab016[_0xcb77('0x47')]:_0x42336b[_0xcb77('0x41')];_0x2ab016[_0xcb77('0x65')]=qs[_0xcb77('0x4a')](_0x2c1be3[_0xcb77('0x42')][_0xcb77('0x4a')]);_0x2ab016[_0xcb77('0x4b')]=qs[_0xcb77('0x44')](_['pick'](_0x2c1be3[_0xcb77('0x42')],_0x42336b[_0xcb77('0x44')]));if(_0x2c1be3['query'][_0xcb77('0x4d')]){_0x2ab016['where']=_[_0xcb77('0x4e')](_0x2ab016[_0xcb77('0x4b')],{'$or':_['map'](_0x2ab016[_0xcb77('0x47')],function(_0x303833){var _0x39ecb1={};_0x39ecb1[_0x303833]={'$like':'%'+_0x2c1be3['query'][_0xcb77('0x4d')]+'%'};return _0x39ecb1;})});}_0x2ab016=_[_0xcb77('0x4e')]({},_0x2ab016,_0x2c1be3[_0xcb77('0x4f')]);return _0x336b95['getApplications'](_0x2ab016);}})[_0xcb77('0x1c')](function(_0x27ec3a){if(_0x27ec3a){_0xa0f269=_0x27ec3a[_0xcb77('0x48')];if(!_0x2c1be3[_0xcb77('0x42')][_0xcb77('0x49')]('nolimit')){_0x2ab016[_0xcb77('0x2c')]=qs[_0xcb77('0x2c')](_0x2c1be3[_0xcb77('0x42')][_0xcb77('0x2c')]);_0x2ab016[_0xcb77('0x2a')]=qs[_0xcb77('0x2a')](_0x2c1be3[_0xcb77('0x42')][_0xcb77('0x2a')]);}return _0x336b95['getApplications'](_0x2ab016);}})[_0xcb77('0x1c')](function(_0x1ac311){if(_0x1ac311){return _0x1ac311?{'count':_0xa0f269,'rows':_0x1ac311}:null;}})[_0xcb77('0x1c')](respondWithResult(_0x39a151,null))['catch'](handleError(_0x39a151,null));};exports[_0xcb77('0x78')]=function(_0x312ab2,_0x3db559,_0x154de4){var _0x2a1464={'channel':'whatsapp'};var _0x441062=[];var _0x49abf2=[];var _0x21a3c4={};return db[_0xcb77('0x3c')][_0xcb77('0x55')]({'where':{'id':_0x312ab2[_0xcb77('0x5d')]['id']},'include':[{'model':db[_0xcb77('0x75')],'as':_0xcb77('0x79')}]})[_0xcb77('0x1c')](handleEntityNotFound(_0x3db559,null))['then'](function(_0x2a0a1c){_0x2a1464['account']=_0x2a0a1c;_0x2a1464[_0xcb77('0x7a')]=_[_0xcb77('0x7b')](_0x2a0a1c['Applications'],[_0xcb77('0x7c')],[_0xcb77('0x7d')]);if(_0x2a1464[_0xcb77('0x7e')][_0xcb77('0x79')]){delete _0x2a1464[_0xcb77('0x7e')][_0xcb77('0x79')];}return db['CmContact'][_0xcb77('0x5e')]();})['then'](function(_0x2deccc){if(!_0x2deccc){throw new db[(_0xcb77('0x7f'))]['ValidationError'](_0xcb77('0x80'));}_0x441062=_[_0xcb77('0x81')](_[_0xcb77('0x43')](_0x2deccc),['createdAt',_0xcb77('0x82')]);_0x49abf2=_['difference'](_[_0xcb77('0x43')](_0x2deccc),['createdAt',_0xcb77('0x82'),_0xcb77('0x83'),_0xcb77('0x84')]);_0x2a1464[_0xcb77('0x56')]={'mapKey':_0xcb77('0x85')};if(_0x2a1464[_0xcb77('0x7e')]['type']&&_0x2a1464[_0xcb77('0x7e')][_0xcb77('0x3f')]===_0xcb77('0x86')){_0x2a1464['body'][_0xcb77('0x87')]=_0x312ab2[_0xcb77('0x56')]['From']['replace'](_0xcb77('0x88'),'');_0x2a1464[_0xcb77('0x56')][_0xcb77('0x56')]=_0x312ab2['body'][_0xcb77('0x89')];_0x2a1464[_0xcb77('0x56')][_0xcb77('0x8a')]=_0x312ab2[_0xcb77('0x56')][_0xcb77('0x8b')];}if(_0x2a1464[_0xcb77('0x56')]['id']){delete _0x2a1464[_0xcb77('0x56')]['id'];}if(_[_0xcb77('0x8c')](_0x2a1464['body'][_0xcb77('0x87')])){throw new db[(_0xcb77('0x7f'))][(_0xcb77('0x8d'))](_0xcb77('0x8e'));}if(_[_0xcb77('0x8c')](_0x2a1464[_0xcb77('0x56')][_0xcb77('0x56')])||_0x2a1464[_0xcb77('0x56')][_0xcb77('0x56')]===''){throw new db[(_0xcb77('0x7f'))][(_0xcb77('0x8d'))](_0xcb77('0x8f'));}if(_[_0xcb77('0x8c')](_0x2a1464['body'][_0xcb77('0x90')])){throw new db[(_0xcb77('0x7f'))][(_0xcb77('0x8d'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x49abf2);}if(!_[_0xcb77('0x91')](_0x49abf2,_0x2a1464['body'][_0xcb77('0x90')])){throw new db[(_0xcb77('0x7f'))][(_0xcb77('0x8d'))](_0xcb77('0x92')+_0x49abf2);}_0x21a3c4[_0x2a1464[_0xcb77('0x56')]['mapKey']]=_0x2a1464['body'][_0xcb77('0x87')];return db[_0xcb77('0x93')][_0xcb77('0x55')]({'where':{'id':_0x2a1464[_0xcb77('0x7e')][_0xcb77('0x84')]},'include':[{'model':db[_0xcb77('0x94')],'as':_0xcb77('0x95'),'where':_0x21a3c4,'limit':0x1,'order':[[_0xcb77('0x82'),_0xcb77('0x96')]]}]});})[_0xcb77('0x1c')](handleEntityNotFound(_0x3db559,null))[_0xcb77('0x1c')](function(_0x2b7983){if(_0x2b7983){_0x2a1464[_0xcb77('0x97')]=_[_0xcb77('0x6c')](_0x2b7983,[_0xcb77('0x95')]);if(_0x2b7983[_0xcb77('0x95')][_0xcb77('0x48')]){return _0x2b7983[_0xcb77('0x95')][0x0];}var _0x4e6167=_[_0xcb77('0x14')](_0x2a1464[_0xcb77('0x56')],{'firstName':_0x2a1464[_0xcb77('0x56')]['from'],'ListId':_0x2b7983['id']});_0x4e6167[_0x2a1464[_0xcb77('0x56')]['mapKey']]=_0x2a1464[_0xcb77('0x56')][_0xcb77('0x87')];return db[_0xcb77('0x94')]['create'](_0x4e6167,{'fields':_0x441062,'raw':!![]});}})[_0xcb77('0x1c')](handleEntityNotFound(_0x3db559,null))[_0xcb77('0x1c')](function(_0x446475){if(_0x446475){_0x2a1464['contact']=_0x446475;var _0x173b56={'ContactId':_0x446475['id'],'phone':_0x2a1464[_0xcb77('0x56')]['from'],'WhatsappAccountId':_0x312ab2[_0xcb77('0x5d')]['id']};var _0x118fea={'ContactId':_0x446475['id'],'WhatsappAccountId':_0x312ab2[_0xcb77('0x5d')]['id'],'closed':![]};return db[_0xcb77('0x98')][_0xcb77('0x55')]({'where':_0x118fea})[_0xcb77('0x1c')](function(_0x4eb904){if(_0x4eb904){return[_0x4eb904,![]];}return db[_0xcb77('0x98')][_0xcb77('0x5b')](_0x173b56)[_0xcb77('0x1c')](function(_0x3f3533){return[_0x3f3533,!![]];});});}})[_0xcb77('0x6d')](function(_0x2d81d7,_0x50a7ec){_0x2a1464[_0xcb77('0x99')]=_0x2d81d7[_0xcb77('0x33')]({'plain':!![]});_0x2a1464[_0xcb77('0x99')][_0xcb77('0x9a')]=![];if(_0x50a7ec){if(_0x2a1464[_0xcb77('0x7e')][_0xcb77('0x9b')]){_0x2a1464[_0xcb77('0x7a')][_0xcb77('0x9c')]({'id':0x0,'priority':_0x2a1464[_0xcb77('0x7a')]['length']+0x1,'app':_0xcb77('0x9d'),'appdata':'unmanaged','interval':_0xcb77('0x9e')});}_0x2a1464[_0xcb77('0x99')]['created']=!![];}return db[_0xcb77('0x9f')][_0xcb77('0x5b')]({'phone':_0x2a1464['body'][_0xcb77('0x87')],'messageId':_0x2a1464[_0xcb77('0x56')][_0xcb77('0x8a')],'body':_0x2a1464[_0xcb77('0x56')][_0xcb77('0x56')],'WhatsappAccountId':_0x312ab2[_0xcb77('0x5d')]['id'],'WhatsappInteractionId':_0x2d81d7['id'],'direction':'in','ContactId':_0x2d81d7['ContactId'],'AttachmentId':_0x2a1464[_0xcb77('0x56')][_0xcb77('0xa0')]});})[_0xcb77('0x1c')](function(_0x3f870a){_0x2a1464[_0xcb77('0x24')]=_0x3f870a;if(_0x2a1464[_0xcb77('0x99')][_0xcb77('0xa1')]){return db[_0xcb77('0xa2')]['find']({'attributes':['id',_0xcb77('0x37')],'where':{'id':_0x2a1464[_0xcb77('0x99')][_0xcb77('0xa1')]}})['then'](function(_0x59c060){if(_0x59c060){_0x2a1464['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xcb77('0xa3'),'appdata':_0x59c060[_0xcb77('0x37')]+','+(_0x2a1464['account'][_0xcb77('0xa4')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xcb77('0xa5'),_0xcb77('0xa6'),_0x2a1464);});}return respondWithRpcPromise(_0xcb77('0xa5'),'startRouting',_0x2a1464);})[_0xcb77('0x1c')](function(_0x608994){if(_0x608994){var _0x1e1bb4=0xc8;var _0x16bae9=_0xcb77('0xa7');logger['info']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x16bae9,_0x1e1bb4,'entity\x20found');logger[_0xcb77('0xa8')](_0xcb77('0xa9'),_0x16bae9,_0x1e1bb4,_0xcb77('0xaa'),JSON['stringify'](_0x608994));if(_0x2a1464[_0xcb77('0x7e')][_0xcb77('0x3f')]===_0xcb77('0x86')){return _0x3db559['status'](_0x1e1bb4)[_0xcb77('0xab')]('Content-Type',_0xcb77('0xac'))[_0xcb77('0x38')]('\x0a');}else{return _0x3db559['status'](_0x1e1bb4)[_0xcb77('0x29')](_0x608994);}}})[_0xcb77('0x25')](handleError(_0x3db559,null));};exports[_0xcb77('0x38')]=function(_0x31d0a4,_0x60b90d,_0x41805e){var _0x5b0c3f,_0x5ad0c4,_0x5b8fe7;if(_[_0xcb77('0x8c')](_0x31d0a4[_0xcb77('0x56')][_0xcb77('0x56')])||_0x31d0a4['body'][_0xcb77('0x56')]===''){throw new db[(_0xcb77('0x7f'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x31d0a4['body']['to'])){throw new db[(_0xcb77('0x7f'))][(_0xcb77('0x8d'))](_0xcb77('0xad'));}_0x5b0c3f=_0x31d0a4['body']['to'];return db[_0xcb77('0x3c')][_0xcb77('0x55')]({'where':{'id':_0x31d0a4['params']['id']},'include':[{'model':db[_0xcb77('0x93')],'as':_0xcb77('0xae'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'mobile':_0x5b0c3f},'limit':0x1,'order':[[_0xcb77('0x82'),'DESC']]}]}]})[_0xcb77('0x1c')](handleEntityNotFound(_0x60b90d,null))['then'](function(_0x439efa){if(_0x439efa&&_0x439efa[_0xcb77('0xae')]){_0x5ad0c4=_0x439efa[_0xcb77('0x33')]({'plain':!![]});if(_0x5ad0c4[_0xcb77('0xae')]&&_0x5ad0c4[_0xcb77('0xae')][_0xcb77('0x95')][_0xcb77('0x48')]){return _0x5ad0c4[_0xcb77('0xae')][_0xcb77('0x95')][0x0];}return db[_0xcb77('0x94')][_0xcb77('0x5b')](_[_0xcb77('0x14')](_0x31d0a4[_0xcb77('0x56')],{'firstName':_0x5b0c3f,'mobile':_0x5b0c3f,'phone':_0x5b0c3f,'ListId':_0x5ad0c4['ListId']}));}})[_0xcb77('0x1c')](handleEntityNotFound(_0x60b90d,null))[_0xcb77('0x1c')](function(_0x308230){if(_0x308230){_0x5b8fe7=_0x308230;return db[_0xcb77('0x98')]['find']({'where':{'ContactId':_0x5b8fe7['id'],'closed':![],'WhatsappAccountId':_0x5ad0c4['id']}})[_0xcb77('0x1c')](function(_0x481400){if(_0x481400){return[_0x481400,![]];}return db['WhatsappInteraction'][_0xcb77('0x5b')]({'UserId':_0x31d0a4['user']['id'],'ContactId':_0x5b8fe7['id'],'WhatsappAccountId':_0x5ad0c4['id'],'phone':_0x5b0c3f,'firstMsgDirection':_0xcb77('0xaf'),'Messages':[_['merge'](_0x31d0a4[_0xcb77('0x56')],{'read':![],'body':_0x31d0a4['body']['body'],'phone':_0x5b0c3f,'WhatsappAccountId':_0x5ad0c4['id'],'UserId':_0x31d0a4['user']['id'],'ContactId':_0x5b8fe7['id']})]},{'include':[{'model':db[_0xcb77('0x9f')],'as':_0xcb77('0xb0')}]})[_0xcb77('0x1c')](function(_0x2ac90f){return[_0x2ac90f,!![]];});});}})[_0xcb77('0x6d')](function(_0x1d274f,_0x3edae1){if(_0x3edae1){return _0x1d274f;}return db[_0xcb77('0x9f')]['create'](_[_0xcb77('0x4e')](_0x31d0a4[_0xcb77('0x56')],{'read':![],'body':_0x31d0a4[_0xcb77('0x56')][_0xcb77('0x56')],'phone':_0x5b0c3f,'WhatsappAccountId':_0x5ad0c4['id'],'WhatsappInteractionId':_0x1d274f['id'],'UserId':_0x31d0a4[_0xcb77('0xb1')]['id'],'ContactId':_0x5b8fe7['id']}))['then'](function(_0x3ea829){_0x1d274f[_0xcb77('0xb2')][_0xcb77('0xb0')]=[];_0x1d274f[_0xcb77('0xb2')][_0xcb77('0xb0')][_0xcb77('0x9c')](_0x3ea829['dataValues']);return _0x1d274f;});})[_0xcb77('0x1c')](respondWithResult(_0x60b90d,null))[_0xcb77('0x25')](handleError(_0x60b90d,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index f14a195..d204fb9 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 _0xe8b5=['WhatsappAccount','save','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x222b8e,_0x2745ef){var _0x3a05d5=function(_0x20b594){while(--_0x20b594){_0x222b8e['push'](_0x222b8e['shift']());}};_0x3a05d5(++_0x2745ef);}(_0xe8b5,0x66));var _0x5e8b=function(_0x5bef39,_0x12095f){_0x5bef39=_0x5bef39-0x0;var _0x132ed8=_0xe8b5[_0x5bef39];return _0x132ed8;};'use strict';var EventEmitter=require(_0x5e8b('0x0'));var WhatsappAccount=require(_0x5e8b('0x1'))['db'][_0x5e8b('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5e8b('0x3'),'afterUpdate':'update','afterDestroy':_0x5e8b('0x4')};function emitEvent(_0x5efadb){return function(_0x12aecb,_0x106bc0,_0xc9e02a){WhatsappAccountEvents[_0x5e8b('0x5')](_0x5efadb+':'+_0x12aecb['id'],_0x12aecb);WhatsappAccountEvents[_0x5e8b('0x5')](_0x5efadb,_0x12aecb);_0xc9e02a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x5e8b('0x6')](e,emitEvent(event));}}module[_0x5e8b('0x7')]=WhatsappAccountEvents; \ No newline at end of file +var _0x9e17=['save','update','remove','emit','hasOwnProperty','hook','WhatsappAccount','setMaxListeners'];(function(_0x705b98,_0x1c345b){var _0x47b72f=function(_0x44f02a){while(--_0x44f02a){_0x705b98['push'](_0x705b98['shift']());}};_0x47b72f(++_0x1c345b);}(_0x9e17,0x6e));var _0x79e1=function(_0x364e2b,_0x30b028){_0x364e2b=_0x364e2b-0x0;var _0x943fef=_0x9e17[_0x364e2b];return _0x943fef;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require('../../mysqldb')['db'][_0x79e1('0x0')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x79e1('0x1')](0x0);var events={'afterCreate':_0x79e1('0x2'),'afterUpdate':_0x79e1('0x3'),'afterDestroy':_0x79e1('0x4')};function emitEvent(_0x1df939){return function(_0x2b176a,_0x41f64c,_0x15e657){WhatsappAccountEvents[_0x79e1('0x5')](_0x1df939+':'+_0x2b176a['id'],_0x2b176a);WhatsappAccountEvents[_0x79e1('0x5')](_0x1df939,_0x2b176a);_0x15e657(null);};}for(var e in events){if(events[_0x79e1('0x6')](e)){var event=events[e];WhatsappAccount[_0x79e1('0x7')](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 4ff2641..26ad02e 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 _0x2c91=['bluebird','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','../../config/logger','moment'];(function(_0x4b4b0e,_0x6c674){var _0x4c2d91=function(_0x4d440d){while(--_0x4d440d){_0x4b4b0e['push'](_0x4b4b0e['shift']());}};_0x4c2d91(++_0x6c674);}(_0x2c91,0xe3));var _0x12c9=function(_0x3c1e72,_0x1e7f10){_0x3c1e72=_0x3c1e72-0x0;var _0x5748d5=_0x2c91[_0x3c1e72];return _0x5748d5;};'use strict';var _=require(_0x12c9('0x0'));var util=require('util');var logger=require(_0x12c9('0x1'))('api');var moment=require(_0x12c9('0x2'));var BPromise=require(_0x12c9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x12c9('0x4'));var attributes=require(_0x12c9('0x5'));module[_0x12c9('0x6')]=function(_0xcef6d3,_0x1903df){return _0xcef6d3[_0x12c9('0x7')](_0x12c9('0x8'),attributes,{'tableName':_0x12c9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2707=['define','WhatsappAccount','whatsapp_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports'];(function(_0x384c23,_0x30cd65){var _0x1fdf67=function(_0x21d205){while(--_0x21d205){_0x384c23['push'](_0x384c23['shift']());}};_0x1fdf67(++_0x30cd65);}(_0x2707,0x15f));var _0x7270=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0x2707[_0x176329];return _0x31997c;};'use strict';var _=require(_0x7270('0x0'));var util=require('util');var logger=require(_0x7270('0x1'))(_0x7270('0x2'));var moment=require(_0x7270('0x3'));var BPromise=require(_0x7270('0x4'));var rp=require(_0x7270('0x5'));var fs=require('fs');var path=require(_0x7270('0x6'));var rimraf=require(_0x7270('0x7'));var config=require('../../config/environment');var attributes=require('./whatsappAccount.attributes');module[_0x7270('0x8')]=function(_0x211376,_0x2ece8e){return _0x211376[_0x7270('0x9')](_0x7270('0xa'),attributes,{'tableName':_0x7270('0xb'),'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 63ff748..7f86018 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 _0xf672=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','ShowWhatsappAccount','options','where','include','map','model','attributes','lodash'];(function(_0x58cb0a,_0x50cece){var _0x3e9744=function(_0x1d0f0f){while(--_0x1d0f0f){_0x58cb0a['push'](_0x58cb0a['shift']());}};_0x3e9744(++_0x50cece);}(_0xf672,0xc5));var _0x2f67=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xf672[_0x36ed48];return _0x51c63a;};'use strict';var _=require(_0x2f67('0x0'));var util=require(_0x2f67('0x1'));var moment=require(_0x2f67('0x2'));var BPromise=require(_0x2f67('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2f67('0x4'));var db=require(_0x2f67('0x5'))['db'];var utils=require(_0x2f67('0x6'));var logger=require(_0x2f67('0x7'))('rpc');var config=require(_0x2f67('0x8'));var jayson=require(_0x2f67('0x9'));var client=jayson[_0x2f67('0xa')][_0x2f67('0xb')]({'port':0x232a});config['redis']=_[_0x2f67('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2f67('0xd'))(new Redis(config['redis']));require(_0x2f67('0xe'))[_0x2f67('0xf')](socket);function respondWithRpcPromise(_0x2a85ca,_0x398bbb,_0x37c5b3){return new BPromise(function(_0x3e6660,_0x4161c1){return client[_0x2f67('0x10')](_0x2a85ca,_0x37c5b3)[_0x2f67('0x11')](function(_0x46e31a){logger[_0x2f67('0x12')](_0x2f67('0x13'),_0x398bbb,'request\x20sent');logger[_0x2f67('0x14')](_0x2f67('0x15'),_0x398bbb,'request\x20sent',JSON[_0x2f67('0x16')](_0x46e31a));if(_0x46e31a['error']){if(_0x46e31a[_0x2f67('0x17')]['code']===0x1f4){logger[_0x2f67('0x17')](_0x2f67('0x13'),_0x398bbb,_0x46e31a[_0x2f67('0x17')]['message']);return _0x4161c1(_0x46e31a['error'][_0x2f67('0x18')]);}logger[_0x2f67('0x17')](_0x2f67('0x13'),_0x398bbb,_0x46e31a[_0x2f67('0x17')][_0x2f67('0x18')]);return _0x3e6660(_0x46e31a[_0x2f67('0x17')][_0x2f67('0x18')]);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x398bbb,'request\x20sent');_0x3e6660(_0x46e31a['result']['message']);}})[_0x2f67('0x19')](function(_0x2854a2){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x398bbb,_0x2854a2);_0x4161c1(_0x2854a2);});});}exports[_0x2f67('0x1a')]=function(_0x1e2017){var _0x22581d=this;return new Promise(function(_0x1fbd24,_0xbe8812){return db['WhatsappAccount']['find']({'raw':_0x1e2017[_0x2f67('0x1b')]?_0x1e2017[_0x2f67('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x1e2017[_0x2f67('0x1b')]?_0x1e2017[_0x2f67('0x1b')][_0x2f67('0x1c')]||null:null,'attributes':_0x1e2017[_0x2f67('0x1b')]?_0x1e2017[_0x2f67('0x1b')]['attributes']||null:null,'include':_0x1e2017[_0x2f67('0x1b')]?_0x1e2017[_0x2f67('0x1b')][_0x2f67('0x1d')]?_[_0x2f67('0x1e')](_0x1e2017[_0x2f67('0x1b')]['include'],function(_0x41a926){return{'model':db[_0x41a926[_0x2f67('0x1f')]],'as':_0x41a926['as'],'attributes':_0x41a926[_0x2f67('0x20')],'include':_0x41a926['include']?_['map'](_0x41a926[_0x2f67('0x1d')],function(_0x3636ef){return{'model':db[_0x3636ef[_0x2f67('0x1f')]],'as':_0x3636ef['as'],'attributes':_0x3636ef[_0x2f67('0x20')],'include':_0x3636ef['include']?_[_0x2f67('0x1e')](_0x3636ef[_0x2f67('0x1d')],function(_0x8227b7){return{'model':db[_0x8227b7[_0x2f67('0x1f')]],'as':_0x8227b7['as'],'attributes':_0x8227b7['attributes']};}):[]};}):[]};}):[]:[]})[_0x2f67('0x11')](function(_0x11a039){logger['info'](_0x2f67('0x1a'),_0x1e2017);logger[_0x2f67('0x14')](_0x2f67('0x1a'),_0x1e2017,JSON[_0x2f67('0x16')](_0x11a039));_0x1fbd24(_0x11a039);})[_0x2f67('0x19')](function(_0xdb28d3){logger[_0x2f67('0x17')](_0x2f67('0x1a'),_0xdb28d3[_0x2f67('0x18')],_0x1e2017);_0xbe8812(_0x22581d['error'](0x1f4,_0xdb28d3['message']));});});}; \ No newline at end of file +var _0xb5ad=['util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','find','options','raw','where','attributes','map','include','model','ShowWhatsappAccount','debug'];(function(_0x389a59,_0x33e529){var _0x5580e7=function(_0xfa3f5){while(--_0xfa3f5){_0x389a59['push'](_0x389a59['shift']());}};_0x5580e7(++_0x33e529);}(_0xb5ad,0x176));var _0xdb5a=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xb5ad[_0x376b45];return _0x2341b3;};'use strict';var _=require('lodash');var util=require(_0xdb5a('0x0'));var moment=require(_0xdb5a('0x1'));var BPromise=require(_0xdb5a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdb5a('0x3'))['db'];var utils=require(_0xdb5a('0x4'));var logger=require(_0xdb5a('0x5'))(_0xdb5a('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdb5a('0x7')][_0xdb5a('0x8')]({'port':0x232a});config[_0xdb5a('0x9')]=_[_0xdb5a('0xa')](config[_0xdb5a('0x9')],{'host':_0xdb5a('0xb'),'port':0x18eb});var socket=require(_0xdb5a('0xc'))(new Redis(config[_0xdb5a('0x9')]));require('./whatsappAccount.socket')['register'](socket);function respondWithRpcPromise(_0x28c9de,_0x2a0aec,_0x36588c){return new BPromise(function(_0x4f553a,_0xa1eb76){return client[_0xdb5a('0xd')](_0x28c9de,_0x36588c)[_0xdb5a('0xe')](function(_0x5b51be){logger[_0xdb5a('0xf')](_0xdb5a('0x10'),_0x2a0aec,_0xdb5a('0x11'));logger['debug'](_0xdb5a('0x12'),_0x2a0aec,_0xdb5a('0x11'),JSON[_0xdb5a('0x13')](_0x5b51be));if(_0x5b51be[_0xdb5a('0x14')]){if(_0x5b51be[_0xdb5a('0x14')]['code']===0x1f4){logger[_0xdb5a('0x14')](_0xdb5a('0x10'),_0x2a0aec,_0x5b51be[_0xdb5a('0x14')][_0xdb5a('0x15')]);return _0xa1eb76(_0x5b51be['error'][_0xdb5a('0x15')]);}logger[_0xdb5a('0x14')](_0xdb5a('0x10'),_0x2a0aec,_0x5b51be[_0xdb5a('0x14')][_0xdb5a('0x15')]);return _0x4f553a(_0x5b51be['error'][_0xdb5a('0x15')]);}else{logger[_0xdb5a('0xf')]('WhatsappAccount,\x20%s,\x20%s',_0x2a0aec,_0xdb5a('0x11'));_0x4f553a(_0x5b51be[_0xdb5a('0x16')][_0xdb5a('0x15')]);}})[_0xdb5a('0x17')](function(_0x5a0177){logger[_0xdb5a('0x14')](_0xdb5a('0x10'),_0x2a0aec,_0x5a0177);_0xa1eb76(_0x5a0177);});});}exports['ShowWhatsappAccount']=function(_0x563c33){var _0x477d42=this;return new Promise(function(_0x20933a,_0x422010){return db['WhatsappAccount'][_0xdb5a('0x18')]({'raw':_0x563c33[_0xdb5a('0x19')]?_0x563c33['options'][_0xdb5a('0x1a')]===undefined?!![]:![]:!![],'where':_0x563c33[_0xdb5a('0x19')]?_0x563c33[_0xdb5a('0x19')][_0xdb5a('0x1b')]||null:null,'attributes':_0x563c33[_0xdb5a('0x19')]?_0x563c33['options'][_0xdb5a('0x1c')]||null:null,'include':_0x563c33[_0xdb5a('0x19')]?_0x563c33[_0xdb5a('0x19')]['include']?_[_0xdb5a('0x1d')](_0x563c33[_0xdb5a('0x19')][_0xdb5a('0x1e')],function(_0x5daf13){return{'model':db[_0x5daf13['model']],'as':_0x5daf13['as'],'attributes':_0x5daf13[_0xdb5a('0x1c')],'include':_0x5daf13[_0xdb5a('0x1e')]?_['map'](_0x5daf13[_0xdb5a('0x1e')],function(_0x4ae4b0){return{'model':db[_0x4ae4b0['model']],'as':_0x4ae4b0['as'],'attributes':_0x4ae4b0['attributes'],'include':_0x4ae4b0[_0xdb5a('0x1e')]?_[_0xdb5a('0x1d')](_0x4ae4b0[_0xdb5a('0x1e')],function(_0x337179){return{'model':db[_0x337179[_0xdb5a('0x1f')]],'as':_0x337179['as'],'attributes':_0x337179['attributes']};}):[]};}):[]};}):[]:[]})[_0xdb5a('0xe')](function(_0x192b97){logger[_0xdb5a('0xf')](_0xdb5a('0x20'),_0x563c33);logger[_0xdb5a('0x21')](_0xdb5a('0x20'),_0x563c33,JSON['stringify'](_0x192b97));_0x20933a(_0x192b97);})[_0xdb5a('0x17')](function(_0x2fc29b){logger[_0xdb5a('0x14')]('ShowWhatsappAccount',_0x2fc29b[_0xdb5a('0x15')],_0x563c33);_0x422010(_0x477d42[_0xdb5a('0x14')](0x1f4,_0x2fc29b[_0xdb5a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 6b8f170..0348875 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 _0x2f03=['update','emit','register','./whatsappAccount.events','save','remove'];(function(_0x583292,_0x2277dd){var _0x1e1a32=function(_0x576c73){while(--_0x576c73){_0x583292['push'](_0x583292['shift']());}};_0x1e1a32(++_0x2277dd);}(_0x2f03,0x10b));var _0x32f0=function(_0x6be99e,_0x48cf79){_0x6be99e=_0x6be99e-0x0;var _0x3ccdb3=_0x2f03[_0x6be99e];return _0x3ccdb3;};'use strict';var WhatsappAccountEvents=require(_0x32f0('0x0'));var events=[_0x32f0('0x1'),_0x32f0('0x2'),_0x32f0('0x3')];function createListener(_0x476aaf,_0x341cb7){return function(_0x3bb768){_0x341cb7[_0x32f0('0x4')](_0x476aaf,_0x3bb768);};}function removeListener(_0x16e844,_0x1a032f){return function(){WhatsappAccountEvents['removeListener'](_0x16e844,_0x1a032f);};}exports[_0x32f0('0x5')]=function(_0x16a9cf){for(var _0x4546c8=0x0,_0x512853=events['length'];_0x4546c8<_0x512853;_0x4546c8++){var _0xe244a4=events[_0x4546c8];var _0x20ad2c=createListener('whatsappAccount:'+_0xe244a4,_0x16a9cf);WhatsappAccountEvents['on'](_0xe244a4,_0x20ad2c);}}; \ No newline at end of file +var _0xb03e=['remove','emit','removeListener','register','length','whatsappAccount:','./whatsappAccount.events'];(function(_0x554292,_0x82948a){var _0x3dd555=function(_0xab7590){while(--_0xab7590){_0x554292['push'](_0x554292['shift']());}};_0x3dd555(++_0x82948a);}(_0xb03e,0x102));var _0xeb03=function(_0x1adce0,_0x1f3df3){_0x1adce0=_0x1adce0-0x0;var _0x3df87c=_0xb03e[_0x1adce0];return _0x3df87c;};'use strict';var WhatsappAccountEvents=require(_0xeb03('0x0'));var events=['save',_0xeb03('0x1'),'update'];function createListener(_0x3b8ac8,_0x648e2d){return function(_0x54e58a){_0x648e2d[_0xeb03('0x2')](_0x3b8ac8,_0x54e58a);};}function removeListener(_0x2b102,_0x19dcf3){return function(){WhatsappAccountEvents[_0xeb03('0x3')](_0x2b102,_0x19dcf3);};}exports[_0xeb03('0x4')]=function(_0x5c90e0){for(var _0x2a5cb8=0x0,_0x4d760f=events[_0xeb03('0x5')];_0x2a5cb8<_0x4d760f;_0x2a5cb8++){var _0x28f4fa=events[_0x2a5cb8];var _0x4b9fcc=createListener(_0xeb03('0x6')+_0x28f4fa,_0x5c90e0);WhatsappAccountEvents['on'](_0x28f4fa,_0x4b9fcc);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index eecf36d..95e3486 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 _0x9c24=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','index','get','/:id','isAuthenticated','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0xecab8,_0x54c092){var _0x4bb052=function(_0x56ce4a){while(--_0x56ce4a){_0xecab8['push'](_0xecab8['shift']());}};_0x4bb052(++_0x54c092);}(_0x9c24,0xb0));var _0x49c2=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9c24[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x49c2('0x0'));var util=require(_0x49c2('0x1'));var path=require(_0x49c2('0x2'));var timeout=require(_0x49c2('0x3'));var express=require(_0x49c2('0x4'));var router=express[_0x49c2('0x5')]();var fs_extra=require(_0x49c2('0x6'));var auth=require(_0x49c2('0x7'));var interaction=require(_0x49c2('0x8'));var config=require('../../config/environment');var controller=require('./whatsappApplication.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x49c2('0x9')]);router[_0x49c2('0xa')](_0x49c2('0xb'),auth[_0x49c2('0xc')](),controller['show']);router[_0x49c2('0xd')]('/',auth[_0x49c2('0xc')](),controller[_0x49c2('0xe')]);router[_0x49c2('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x49c2('0x10')]);router[_0x49c2('0x11')](_0x49c2('0xb'),auth[_0x49c2('0xc')](),controller[_0x49c2('0x12')]);module[_0x49c2('0x13')]=router; \ No newline at end of file +var _0x2d74=['../../config/environment','./whatsappApplication.controller','isAuthenticated','index','get','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x3a6220,_0x4a80d1){var _0x1aea9d=function(_0x549c1f){while(--_0x549c1f){_0x3a6220['push'](_0x3a6220['shift']());}};_0x1aea9d(++_0x4a80d1);}(_0x2d74,0xa5));var _0x42d7=function(_0x1c3d85,_0x410748){_0x1c3d85=_0x1c3d85-0x0;var _0x3a7473=_0x2d74[_0x1c3d85];return _0x3a7473;};'use strict';var multer=require(_0x42d7('0x0'));var util=require(_0x42d7('0x1'));var path=require(_0x42d7('0x2'));var timeout=require(_0x42d7('0x3'));var express=require(_0x42d7('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x42d7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x42d7('0x6'));var controller=require(_0x42d7('0x7'));router['get']('/',auth[_0x42d7('0x8')](),controller[_0x42d7('0x9')]);router[_0x42d7('0xa')](_0x42d7('0xb'),auth[_0x42d7('0x8')](),controller[_0x42d7('0xc')]);router[_0x42d7('0xd')]('/',auth[_0x42d7('0x8')](),controller['create']);router[_0x42d7('0xe')](_0x42d7('0xb'),auth['isAuthenticated'](),controller[_0x42d7('0xf')]);router[_0x42d7('0x10')]('/:id',auth[_0x42d7('0x8')](),controller[_0x42d7('0x11')]);module[_0x42d7('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 4d9801e..9d81034 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 _0xd307=['STRING','*,*,*,*','sequelize','exports','INTEGER','noop','TEXT'];(function(_0x58a36d,_0x57d9cb){var _0x2d27e1=function(_0xf07e2a){while(--_0xf07e2a){_0x58a36d['push'](_0x58a36d['shift']());}};_0x2d27e1(++_0x57d9cb);}(_0xd307,0x1d7));var _0x7d30=function(_0x35cd44,_0x68d063){_0x35cd44=_0x35cd44-0x0;var _0x3f456f=_0xd307[_0x35cd44];return _0x3f456f;};'use strict';var Sequelize=require(_0x7d30('0x0'));module[_0x7d30('0x1')]={'priority':{'type':Sequelize[_0x7d30('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7d30('0x3')},'appdata':{'type':Sequelize[_0x7d30('0x4')]()},'description':{'type':Sequelize[_0x7d30('0x5')]},'interval':{'type':Sequelize[_0x7d30('0x5')],'defaultValue':_0x7d30('0x6')}}; \ No newline at end of file +var _0xb24b=['sequelize','exports','INTEGER','STRING','noop'];(function(_0x5ca4b4,_0x39ba62){var _0x39f263=function(_0x39d6f8){while(--_0x39d6f8){_0x5ca4b4['push'](_0x5ca4b4['shift']());}};_0x39f263(++_0x39ba62);}(_0xb24b,0x118));var _0xbb24=function(_0x47e082,_0x3e233b){_0x47e082=_0x47e082-0x0;var _0x121d8b=_0xb24b[_0x47e082];return _0x121d8b;};'use strict';var Sequelize=require(_0xbb24('0x0'));module[_0xbb24('0x1')]={'priority':{'type':Sequelize[_0xbb24('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xbb24('0x3')],'allowNull':![],'defaultValue':_0xbb24('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xbb24('0x3')]},'interval':{'type':Sequelize[_0xbb24('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 553c6c3..613f332 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 _0xba6f=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','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','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','map','WhatsappApplication','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','rawAttributes','options','find','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0xa1f4ad,_0x308e1c){var _0x11c356=function(_0x111bde){while(--_0x111bde){_0xa1f4ad['push'](_0xa1f4ad['shift']());}};_0x11c356(++_0x308e1c);}(_0xba6f,0x1d0));var _0xfba6=function(_0x3b677a,_0x274ecc){_0x3b677a=_0x3b677a-0x0;var _0x2e2eb6=_0xba6f[_0x3b677a];return _0x2e2eb6;};'use strict';var emlformat=require(_0xfba6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfba6('0x1'));var jsonpatch=require(_0xfba6('0x2'));var rp=require(_0xfba6('0x3'));var moment=require(_0xfba6('0x4'));var BPromise=require(_0xfba6('0x5'));var Mustache=require(_0xfba6('0x6'));var util=require(_0xfba6('0x7'));var path=require(_0xfba6('0x8'));var sox=require(_0xfba6('0x9'));var csv=require(_0xfba6('0xa'));var ejs=require(_0xfba6('0xb'));var fs=require('fs');var fs_extra=require(_0xfba6('0xc'));var _=require(_0xfba6('0xd'));var squel=require('squel');var crypto=require(_0xfba6('0xe'));var jsforce=require(_0xfba6('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfba6('0x10'));var Redis=require(_0xfba6('0x11'));var authService=require(_0xfba6('0x12'));var qs=require(_0xfba6('0x13'));var as=require(_0xfba6('0x14'));var hardwareService=require(_0xfba6('0x15'));var logger=require(_0xfba6('0x16'))(_0xfba6('0x17'));var utils=require(_0xfba6('0x18'));var config=require(_0xfba6('0x19'));var licenseUtil=require(_0xfba6('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xcfafdb,_0xd34d87){_0xd34d87=_0xd34d87||0xcc;return function(_0x315faf){if(_0x315faf){return _0xcfafdb[_0xfba6('0x1b')](_0xd34d87);}return _0xcfafdb['status'](_0xd34d87)[_0xfba6('0x1c')]();};}function respondWithResult(_0x5dc9e1,_0x4f465f){_0x4f465f=_0x4f465f||0xc8;return function(_0x184169){if(_0x184169){return _0x5dc9e1[_0xfba6('0x1d')](_0x4f465f)[_0xfba6('0x1e')](_0x184169);}};}function respondWithFilteredResult(_0x1d76de,_0x38055e){return function(_0x2c4692){if(_0x2c4692){var _0x24b6a0=typeof _0x38055e[_0xfba6('0x1f')]===_0xfba6('0x20')&&typeof _0x38055e[_0xfba6('0x21')]===_0xfba6('0x20');var _0xf3dbbc=_0x2c4692[_0xfba6('0x22')];var _0x5a29a4=_0x24b6a0?0x0:_0x38055e[_0xfba6('0x1f')];var _0x267c09=_0x24b6a0?_0x2c4692['count']:_0x38055e['offset']+_0x38055e[_0xfba6('0x21')];var _0x204784;if(_0x267c09>=_0xf3dbbc){_0x267c09=_0xf3dbbc;_0x204784=0xc8;}else{_0x204784=0xce;}_0x1d76de['status'](_0x204784);return _0x1d76de[_0xfba6('0x23')](_0xfba6('0x24'),_0x5a29a4+'-'+_0x267c09+'/'+_0xf3dbbc)[_0xfba6('0x1e')](_0x2c4692);}return null;};}function patchUpdates(_0x4f1d15){return function(_0x167528){try{jsonpatch[_0xfba6('0x25')](_0x167528,_0x4f1d15,!![]);}catch(_0xa16868){return BPromise['reject'](_0xa16868);}return _0x167528[_0xfba6('0x26')]();};}function saveUpdates(_0x12f000,_0x25e0ff){return function(_0x2afd26){if(_0x2afd26){return _0x2afd26[_0xfba6('0x27')](_0x12f000)[_0xfba6('0x28')](function(_0x203a4e){return _0x203a4e;});}return null;};}function removeEntity(_0x56b427,_0x5e09ff){return function(_0x41b356){if(_0x41b356){return _0x41b356[_0xfba6('0x29')]()[_0xfba6('0x28')](function(){_0x56b427[_0xfba6('0x1d')](0xcc)[_0xfba6('0x1c')]();});}};}function handleEntityNotFound(_0x53c99a,_0x408ccc){return function(_0x4114bc){if(!_0x4114bc){_0x53c99a[_0xfba6('0x1b')](0x194);}return _0x4114bc;};}function handleError(_0x11bde3,_0x3af399){_0x3af399=_0x3af399||0x1f4;return function(_0x7c7f6a){logger['error'](_0x7c7f6a[_0xfba6('0x2a')]);if(_0x7c7f6a[_0xfba6('0x2b')]){delete _0x7c7f6a['name'];}_0x11bde3[_0xfba6('0x1d')](_0x3af399)[_0xfba6('0x2c')](_0x7c7f6a);};}exports['index']=function(_0x2d703e,_0x3da118){var _0x5f31af={},_0x47973f={},_0x56e8e6={'count':0x0,'rows':[]};var _0xf8134a=_[_0xfba6('0x2d')](db[_0xfba6('0x2e')]['rawAttributes'],function(_0x17440e){return{'name':_0x17440e[_0xfba6('0x2f')],'type':_0x17440e[_0xfba6('0x30')][_0xfba6('0x31')]};});_0x47973f['model']=_[_0xfba6('0x2d')](_0xf8134a,'name');_0x47973f[_0xfba6('0x32')]=_[_0xfba6('0x33')](_0x2d703e[_0xfba6('0x32')]);_0x47973f[_0xfba6('0x34')]=_[_0xfba6('0x35')](_0x47973f['model'],_0x47973f[_0xfba6('0x32')]);_0x5f31af[_0xfba6('0x36')]=_['intersection'](_0x47973f[_0xfba6('0x37')],qs[_0xfba6('0x38')](_0x2d703e[_0xfba6('0x32')][_0xfba6('0x38')]));_0x5f31af[_0xfba6('0x36')]=_0x5f31af[_0xfba6('0x36')][_0xfba6('0x39')]?_0x5f31af[_0xfba6('0x36')]:_0x47973f[_0xfba6('0x37')];if(!_0x2d703e[_0xfba6('0x32')][_0xfba6('0x3a')](_0xfba6('0x3b'))){_0x5f31af['limit']=qs[_0xfba6('0x21')](_0x2d703e[_0xfba6('0x32')][_0xfba6('0x21')]);_0x5f31af[_0xfba6('0x1f')]=qs[_0xfba6('0x1f')](_0x2d703e[_0xfba6('0x32')][_0xfba6('0x1f')]);}_0x5f31af[_0xfba6('0x3c')]=qs[_0xfba6('0x3d')](_0x2d703e[_0xfba6('0x32')][_0xfba6('0x3d')]);_0x5f31af['where']=qs[_0xfba6('0x34')](_['pick'](_0x2d703e[_0xfba6('0x32')],_0x47973f[_0xfba6('0x34')]),_0xf8134a);if(_0x2d703e[_0xfba6('0x32')][_0xfba6('0x3e')]){_0x5f31af[_0xfba6('0x3f')]=_[_0xfba6('0x40')](_0x5f31af[_0xfba6('0x3f')],{'$or':_[_0xfba6('0x2d')](_0xf8134a,function(_0x5bad10){if(_0x5bad10[_0xfba6('0x30')]!==_0xfba6('0x41')){var _0x4807f5={};_0x4807f5[_0x5bad10[_0xfba6('0x2b')]]={'$like':'%'+_0x2d703e['query'][_0xfba6('0x3e')]+'%'};return _0x4807f5;}})});}_0x5f31af=_[_0xfba6('0x40')]({},_0x5f31af,_0x2d703e['options']);var _0x203c67={'where':_0x5f31af[_0xfba6('0x3f')]};return db[_0xfba6('0x2e')]['count'](_0x203c67)[_0xfba6('0x28')](function(_0x18d17c){_0x56e8e6[_0xfba6('0x22')]=_0x18d17c;if(_0x2d703e[_0xfba6('0x32')][_0xfba6('0x42')]){_0x5f31af[_0xfba6('0x43')]=[{'all':!![]}];}return db['WhatsappApplication'][_0xfba6('0x44')](_0x5f31af);})[_0xfba6('0x28')](function(_0x27a493){_0x56e8e6[_0xfba6('0x45')]=_0x27a493;return _0x56e8e6;})[_0xfba6('0x28')](respondWithFilteredResult(_0x3da118,_0x5f31af))[_0xfba6('0x46')](handleError(_0x3da118,null));};exports[_0xfba6('0x47')]=function(_0x28a9d6,_0x51ee39){var _0x47ca82={'raw':!![],'where':{'id':_0x28a9d6['params']['id']}},_0x18b81d={};_0x18b81d[_0xfba6('0x37')]=_[_0xfba6('0x33')](db[_0xfba6('0x2e')][_0xfba6('0x48')]);_0x18b81d['query']=_[_0xfba6('0x33')](_0x28a9d6['query']);_0x18b81d[_0xfba6('0x34')]=_['intersection'](_0x18b81d[_0xfba6('0x37')],_0x18b81d[_0xfba6('0x32')]);_0x47ca82[_0xfba6('0x36')]=_[_0xfba6('0x35')](_0x18b81d[_0xfba6('0x37')],qs[_0xfba6('0x38')](_0x28a9d6[_0xfba6('0x32')][_0xfba6('0x38')]));_0x47ca82[_0xfba6('0x36')]=_0x47ca82['attributes'][_0xfba6('0x39')]?_0x47ca82[_0xfba6('0x36')]:_0x18b81d[_0xfba6('0x37')];if(_0x28a9d6[_0xfba6('0x32')][_0xfba6('0x42')]){_0x47ca82[_0xfba6('0x43')]=[{'all':!![]}];}_0x47ca82=_[_0xfba6('0x40')]({},_0x47ca82,_0x28a9d6[_0xfba6('0x49')]);return db[_0xfba6('0x2e')][_0xfba6('0x4a')](_0x47ca82)[_0xfba6('0x28')](handleEntityNotFound(_0x51ee39,null))[_0xfba6('0x28')](respondWithResult(_0x51ee39,null))[_0xfba6('0x46')](handleError(_0x51ee39,null));};exports[_0xfba6('0x4b')]=function(_0x2c3e90,_0x56900e){return db[_0xfba6('0x2e')][_0xfba6('0x4b')](_0x2c3e90[_0xfba6('0x4c')],{})[_0xfba6('0x28')](respondWithResult(_0x56900e,0xc9))[_0xfba6('0x46')](handleError(_0x56900e,null));};exports[_0xfba6('0x27')]=function(_0x26c050,_0xb637ca){if(_0x26c050['body']['id']){delete _0x26c050['body']['id'];}return db[_0xfba6('0x2e')][_0xfba6('0x4a')]({'where':{'id':_0x26c050[_0xfba6('0x4d')]['id']}})[_0xfba6('0x28')](handleEntityNotFound(_0xb637ca,null))[_0xfba6('0x28')](saveUpdates(_0x26c050['body'],null))['then'](respondWithResult(_0xb637ca,null))[_0xfba6('0x46')](handleError(_0xb637ca,null));};exports[_0xfba6('0x29')]=function(_0x4f78ff,_0x4c150){return db[_0xfba6('0x2e')][_0xfba6('0x4a')]({'where':{'id':_0x4f78ff['params']['id']}})[_0xfba6('0x28')](handleEntityNotFound(_0x4c150,null))['then'](removeEntity(_0x4c150,null))[_0xfba6('0x46')](handleError(_0x4c150,null));}; \ No newline at end of file +var _0xf567=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','count','offset','set','apply','reject','save','update','then','destroy','end','error','name','send','key','map','query','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','filter','type','merge','options','WhatsappApplication','includeAll','include','findAll','rows','show','params','keys','create','body','catch','find','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x6de979,_0x4f6def){var _0x13c509=function(_0x2d9203){while(--_0x2d9203){_0x6de979['push'](_0x6de979['shift']());}};_0x13c509(++_0x4f6def);}(_0xf567,0x118));var _0x7f56=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xf567[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require(_0x7f56('0x0'));var rimraf=require(_0x7f56('0x1'));var zipdir=require(_0x7f56('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7f56('0x3'));var moment=require(_0x7f56('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7f56('0x5'));var util=require(_0x7f56('0x6'));var path=require(_0x7f56('0x7'));var sox=require(_0x7f56('0x8'));var csv=require('to-csv');var ejs=require(_0x7f56('0x9'));var fs=require('fs');var fs_extra=require(_0x7f56('0xa'));var _=require(_0x7f56('0xb'));var squel=require('squel');var crypto=require(_0x7f56('0xc'));var jsforce=require(_0x7f56('0xd'));var deskjs=require(_0x7f56('0xe'));var toCsv=require(_0x7f56('0xf'));var querystring=require(_0x7f56('0x10'));var Papa=require(_0x7f56('0x11'));var Redis=require(_0x7f56('0x12'));var authService=require(_0x7f56('0x13'));var qs=require(_0x7f56('0x14'));var as=require(_0x7f56('0x15'));var hardwareService=require(_0x7f56('0x16'));var logger=require(_0x7f56('0x17'))(_0x7f56('0x18'));var utils=require(_0x7f56('0x19'));var config=require(_0x7f56('0x1a'));var licenseUtil=require(_0x7f56('0x1b'));var db=require(_0x7f56('0x1c'))['db'];function respondWithStatusCode(_0x12557f,_0x3677af){_0x3677af=_0x3677af||0xcc;return function(_0x13b663){if(_0x13b663){return _0x12557f[_0x7f56('0x1d')](_0x3677af);}return _0x12557f[_0x7f56('0x1e')](_0x3677af)['end']();};}function respondWithResult(_0x3cc92b,_0x32119f){_0x32119f=_0x32119f||0xc8;return function(_0x11d663){if(_0x11d663){return _0x3cc92b['status'](_0x32119f)[_0x7f56('0x1f')](_0x11d663);}};}function respondWithFilteredResult(_0x211be1,_0x52e072){return function(_0x5f9e3c){if(_0x5f9e3c){var _0x441459=typeof _0x52e072['offset']==='undefined'&&typeof _0x52e072[_0x7f56('0x20')]==='undefined';var _0x415b6f=_0x5f9e3c[_0x7f56('0x21')];var _0x5201eb=_0x441459?0x0:_0x52e072[_0x7f56('0x22')];var _0x3779a9=_0x441459?_0x5f9e3c[_0x7f56('0x21')]:_0x52e072[_0x7f56('0x22')]+_0x52e072[_0x7f56('0x20')];var _0x24fe45;if(_0x3779a9>=_0x415b6f){_0x3779a9=_0x415b6f;_0x24fe45=0xc8;}else{_0x24fe45=0xce;}_0x211be1['status'](_0x24fe45);return _0x211be1[_0x7f56('0x23')]('Content-Range',_0x5201eb+'-'+_0x3779a9+'/'+_0x415b6f)[_0x7f56('0x1f')](_0x5f9e3c);}return null;};}function patchUpdates(_0x56ba40){return function(_0x38e7d5){try{jsonpatch[_0x7f56('0x24')](_0x38e7d5,_0x56ba40,!![]);}catch(_0x289207){return BPromise[_0x7f56('0x25')](_0x289207);}return _0x38e7d5[_0x7f56('0x26')]();};}function saveUpdates(_0x4480b1,_0x9b7f15){return function(_0x3f54f8){if(_0x3f54f8){return _0x3f54f8[_0x7f56('0x27')](_0x4480b1)[_0x7f56('0x28')](function(_0x52a902){return _0x52a902;});}return null;};}function removeEntity(_0x19bc9f,_0xe8f270){return function(_0x2943fe){if(_0x2943fe){return _0x2943fe[_0x7f56('0x29')]()[_0x7f56('0x28')](function(){_0x19bc9f[_0x7f56('0x1e')](0xcc)[_0x7f56('0x2a')]();});}};}function handleEntityNotFound(_0x5da9ce,_0x4a20d5){return function(_0x4a1f1b){if(!_0x4a1f1b){_0x5da9ce[_0x7f56('0x1d')](0x194);}return _0x4a1f1b;};}function handleError(_0x5d2c39,_0x243a16){_0x243a16=_0x243a16||0x1f4;return function(_0xc53c00){logger[_0x7f56('0x2b')](_0xc53c00['stack']);if(_0xc53c00[_0x7f56('0x2c')]){delete _0xc53c00[_0x7f56('0x2c')];}_0x5d2c39[_0x7f56('0x1e')](_0x243a16)[_0x7f56('0x2d')](_0xc53c00);};}exports['index']=function(_0x3d3095,_0x35d40b){var _0x20335a={},_0x57d1db={},_0x10372d={'count':0x0,'rows':[]};var _0x1f247e=_['map'](db['WhatsappApplication']['rawAttributes'],function(_0x2849f8){return{'name':_0x2849f8['fieldName'],'type':_0x2849f8['type'][_0x7f56('0x2e')]};});_0x57d1db['model']=_[_0x7f56('0x2f')](_0x1f247e,_0x7f56('0x2c'));_0x57d1db[_0x7f56('0x30')]=_['keys'](_0x3d3095[_0x7f56('0x30')]);_0x57d1db[_0x7f56('0x31')]=_[_0x7f56('0x32')](_0x57d1db['model'],_0x57d1db[_0x7f56('0x30')]);_0x20335a[_0x7f56('0x33')]=_[_0x7f56('0x32')](_0x57d1db[_0x7f56('0x34')],qs[_0x7f56('0x35')](_0x3d3095[_0x7f56('0x30')][_0x7f56('0x35')]));_0x20335a[_0x7f56('0x33')]=_0x20335a[_0x7f56('0x33')][_0x7f56('0x36')]?_0x20335a[_0x7f56('0x33')]:_0x57d1db[_0x7f56('0x34')];if(!_0x3d3095['query']['hasOwnProperty'](_0x7f56('0x37'))){_0x20335a['limit']=qs[_0x7f56('0x20')](_0x3d3095[_0x7f56('0x30')]['limit']);_0x20335a[_0x7f56('0x22')]=qs[_0x7f56('0x22')](_0x3d3095['query'][_0x7f56('0x22')]);}_0x20335a[_0x7f56('0x38')]=qs['sort'](_0x3d3095[_0x7f56('0x30')][_0x7f56('0x39')]);_0x20335a[_0x7f56('0x3a')]=qs['filters'](_[_0x7f56('0x3b')](_0x3d3095['query'],_0x57d1db[_0x7f56('0x31')]),_0x1f247e);if(_0x3d3095['query'][_0x7f56('0x3c')]){_0x20335a[_0x7f56('0x3a')]=_['merge'](_0x20335a['where'],{'$or':_['map'](_0x1f247e,function(_0x3b37fc){if(_0x3b37fc[_0x7f56('0x3d')]!=='VIRTUAL'){var _0x471e8b={};_0x471e8b[_0x3b37fc[_0x7f56('0x2c')]]={'$like':'%'+_0x3d3095[_0x7f56('0x30')][_0x7f56('0x3c')]+'%'};return _0x471e8b;}})});}_0x20335a=_[_0x7f56('0x3e')]({},_0x20335a,_0x3d3095[_0x7f56('0x3f')]);var _0x39c017={'where':_0x20335a[_0x7f56('0x3a')]};return db[_0x7f56('0x40')][_0x7f56('0x21')](_0x39c017)[_0x7f56('0x28')](function(_0x34c0d1){_0x10372d[_0x7f56('0x21')]=_0x34c0d1;if(_0x3d3095[_0x7f56('0x30')][_0x7f56('0x41')]){_0x20335a[_0x7f56('0x42')]=[{'all':!![]}];}return db[_0x7f56('0x40')][_0x7f56('0x43')](_0x20335a);})[_0x7f56('0x28')](function(_0xe02966){_0x10372d[_0x7f56('0x44')]=_0xe02966;return _0x10372d;})[_0x7f56('0x28')](respondWithFilteredResult(_0x35d40b,_0x20335a))['catch'](handleError(_0x35d40b,null));};exports[_0x7f56('0x45')]=function(_0x4a776b,_0x5e51d6){var _0x2ab999={'raw':!![],'where':{'id':_0x4a776b[_0x7f56('0x46')]['id']}},_0x438a30={};_0x438a30[_0x7f56('0x34')]=_[_0x7f56('0x47')](db[_0x7f56('0x40')]['rawAttributes']);_0x438a30[_0x7f56('0x30')]=_[_0x7f56('0x47')](_0x4a776b['query']);_0x438a30[_0x7f56('0x31')]=_[_0x7f56('0x32')](_0x438a30[_0x7f56('0x34')],_0x438a30[_0x7f56('0x30')]);_0x2ab999[_0x7f56('0x33')]=_[_0x7f56('0x32')](_0x438a30[_0x7f56('0x34')],qs[_0x7f56('0x35')](_0x4a776b[_0x7f56('0x30')][_0x7f56('0x35')]));_0x2ab999[_0x7f56('0x33')]=_0x2ab999['attributes']['length']?_0x2ab999[_0x7f56('0x33')]:_0x438a30[_0x7f56('0x34')];if(_0x4a776b['query'][_0x7f56('0x41')]){_0x2ab999['include']=[{'all':!![]}];}_0x2ab999=_[_0x7f56('0x3e')]({},_0x2ab999,_0x4a776b[_0x7f56('0x3f')]);return db[_0x7f56('0x40')]['find'](_0x2ab999)[_0x7f56('0x28')](handleEntityNotFound(_0x5e51d6,null))['then'](respondWithResult(_0x5e51d6,null))['catch'](handleError(_0x5e51d6,null));};exports[_0x7f56('0x48')]=function(_0x39cf30,_0x498259){return db[_0x7f56('0x40')]['create'](_0x39cf30[_0x7f56('0x49')],{})[_0x7f56('0x28')](respondWithResult(_0x498259,0xc9))[_0x7f56('0x4a')](handleError(_0x498259,null));};exports[_0x7f56('0x27')]=function(_0x5cc708,_0x25704f){if(_0x5cc708[_0x7f56('0x49')]['id']){delete _0x5cc708[_0x7f56('0x49')]['id'];}return db[_0x7f56('0x40')][_0x7f56('0x4b')]({'where':{'id':_0x5cc708[_0x7f56('0x46')]['id']}})[_0x7f56('0x28')](handleEntityNotFound(_0x25704f,null))[_0x7f56('0x28')](saveUpdates(_0x5cc708[_0x7f56('0x49')],null))['then'](respondWithResult(_0x25704f,null))['catch'](handleError(_0x25704f,null));};exports[_0x7f56('0x29')]=function(_0x5b9f6c,_0x1b2bfb){return db[_0x7f56('0x40')]['find']({'where':{'id':_0x5b9f6c[_0x7f56('0x46')]['id']}})[_0x7f56('0x28')](handleEntityNotFound(_0x1b2bfb,null))['then'](removeEntity(_0x1b2bfb,null))[_0x7f56('0x4a')](handleError(_0x1b2bfb,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index e9837bc..691be7e 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 _0xca8d=['whatsapp_applications','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication'];(function(_0x2b100f,_0x237749){var _0x38edf2=function(_0x7702b){while(--_0x7702b){_0x2b100f['push'](_0x2b100f['shift']());}};_0x38edf2(++_0x237749);}(_0xca8d,0x172));var _0xdca8=function(_0x4decad,_0x361d84){_0x4decad=_0x4decad-0x0;var _0x334651=_0xca8d[_0x4decad];return _0x334651;};'use strict';var _=require(_0xdca8('0x0'));var util=require(_0xdca8('0x1'));var logger=require(_0xdca8('0x2'))(_0xdca8('0x3'));var moment=require(_0xdca8('0x4'));var BPromise=require(_0xdca8('0x5'));var rp=require(_0xdca8('0x6'));var fs=require('fs');var path=require(_0xdca8('0x7'));var rimraf=require(_0xdca8('0x8'));var config=require(_0xdca8('0x9'));var attributes=require(_0xdca8('0xa'));module[_0xdca8('0xb')]=function(_0x4d6383,_0x3366d5){return _0x4d6383[_0xdca8('0xc')](_0xdca8('0xd'),attributes,{'tableName':_0xdca8('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdca8('0xf'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8b7c=['path','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0x8b7c,0x119));var _0xc8b7=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x8b7c[_0x24061a];return _0x82054e;};'use strict';var _=require(_0xc8b7('0x0'));var util=require(_0xc8b7('0x1'));var logger=require(_0xc8b7('0x2'))(_0xc8b7('0x3'));var moment=require(_0xc8b7('0x4'));var BPromise=require(_0xc8b7('0x5'));var rp=require(_0xc8b7('0x6'));var fs=require('fs');var path=require(_0xc8b7('0x7'));var rimraf=require('rimraf');var config=require(_0xc8b7('0x8'));var attributes=require(_0xc8b7('0x9'));module[_0xc8b7('0xa')]=function(_0x4a8b93,_0x256c78){return _0x4a8b93[_0xc8b7('0xb')](_0xc8b7('0xc'),attributes,{'tableName':_0xc8b7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc8b7('0xe'),'collate':_0xc8b7('0xf')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 5a4a5a8..7637858 100644 --- a/server/api/whatsappApplication/whatsappApplication.rpc.js +++ b/server/api/whatsappApplication/whatsappApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5c12=['../../config/environment','client','http','request','then','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','error','message','info','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xbec8e6,_0x2841b5){var _0x4aa6f2=function(_0x583a0a){while(--_0x583a0a){_0xbec8e6['push'](_0xbec8e6['shift']());}};_0x4aa6f2(++_0x2841b5);}(_0x5c12,0x188));var _0x25c1=function(_0x6aad74,_0x32ecf4){_0x6aad74=_0x6aad74-0x0;var _0x5b1c38=_0x5c12[_0x6aad74];return _0x5b1c38;};'use strict';var _=require('lodash');var util=require(_0x25c1('0x0'));var moment=require(_0x25c1('0x1'));var BPromise=require('bluebird');var rs=require(_0x25c1('0x2'));var fs=require('fs');var Redis=require(_0x25c1('0x3'));var db=require(_0x25c1('0x4'))['db'];var utils=require(_0x25c1('0x5'));var logger=require(_0x25c1('0x6'))(_0x25c1('0x7'));var config=require(_0x25c1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x25c1('0x9')][_0x25c1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x382922,_0x4ab674,_0x5c69b1){return new BPromise(function(_0x24981c,_0x3b69ba){return client[_0x25c1('0xb')](_0x382922,_0x5c69b1)[_0x25c1('0xc')](function(_0xf8363f){logger['info'](_0x25c1('0xd'),_0x4ab674,_0x25c1('0xe'));logger[_0x25c1('0xf')](_0x25c1('0x10'),_0x4ab674,_0x25c1('0xe'),JSON['stringify'](_0xf8363f));if(_0xf8363f[_0x25c1('0x11')]){if(_0xf8363f[_0x25c1('0x11')]['code']===0x1f4){logger[_0x25c1('0x11')](_0x25c1('0xd'),_0x4ab674,_0xf8363f[_0x25c1('0x11')][_0x25c1('0x12')]);return _0x3b69ba(_0xf8363f['error']['message']);}logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x4ab674,_0xf8363f[_0x25c1('0x11')][_0x25c1('0x12')]);return _0x24981c(_0xf8363f[_0x25c1('0x11')][_0x25c1('0x12')]);}else{logger[_0x25c1('0x13')]('WhatsappApplication,\x20%s,\x20%s',_0x4ab674,_0x25c1('0xe'));_0x24981c(_0xf8363f['result']['message']);}})['catch'](function(_0x284712){logger[_0x25c1('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x4ab674,_0x284712);_0x3b69ba(_0x284712);});});} \ No newline at end of file +var _0x0a9a=['WhatsappApplication,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x1c80e9,_0x3b7f77){var _0x509563=function(_0x33112d){while(--_0x33112d){_0x1c80e9['push'](_0x1c80e9['shift']());}};_0x509563(++_0x3b7f77);}(_0x0a9a,0x183));var _0xa0a9=function(_0x4de3a0,_0x189a3c){_0x4de3a0=_0x4de3a0-0x0;var _0x31c98a=_0x0a9a[_0x4de3a0];return _0x31c98a;};'use strict';var _=require('lodash');var util=require(_0xa0a9('0x0'));var moment=require('moment');var BPromise=require(_0xa0a9('0x1'));var rs=require(_0xa0a9('0x2'));var fs=require('fs');var Redis=require(_0xa0a9('0x3'));var db=require(_0xa0a9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa0a9('0x5'))(_0xa0a9('0x6'));var config=require('../../config/environment');var jayson=require(_0xa0a9('0x7'));var client=jayson[_0xa0a9('0x8')][_0xa0a9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31d689,_0x499a29,_0x2b2eb4){return new BPromise(function(_0x520f42,_0x10aa8a){return client[_0xa0a9('0xa')](_0x31d689,_0x2b2eb4)[_0xa0a9('0xb')](function(_0x2d6ac0){logger['info'](_0xa0a9('0xc'),_0x499a29,_0xa0a9('0xd'));logger['debug']('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x499a29,_0xa0a9('0xd'),JSON[_0xa0a9('0xe')](_0x2d6ac0));if(_0x2d6ac0['error']){if(_0x2d6ac0[_0xa0a9('0xf')]['code']===0x1f4){logger[_0xa0a9('0xf')]('WhatsappApplication,\x20%s,\x20%s',_0x499a29,_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);return _0x10aa8a(_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);}logger[_0xa0a9('0xf')]('WhatsappApplication,\x20%s,\x20%s',_0x499a29,_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);return _0x520f42(_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);}else{logger[_0xa0a9('0x11')](_0xa0a9('0xc'),_0x499a29,'request\x20sent');_0x520f42(_0x2d6ac0[_0xa0a9('0x12')]['message']);}})['catch'](function(_0x347092){logger[_0xa0a9('0xf')](_0xa0a9('0xc'),_0x499a29,_0x347092);_0x10aa8a(_0x347092);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index f2f093c..136c19d 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 _0x6596=['whatsappinteraction:destroy','delete','removeTags','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','whatsappinteraction:update','update'];(function(_0x2b33d7,_0x4c6a42){var _0x5f3a31=function(_0x6a72b0){while(--_0x6a72b0){_0x2b33d7['push'](_0x2b33d7['shift']());}};_0x5f3a31(++_0x4c6a42);}(_0x6596,0x1d3));var _0x6659=function(_0x59d9c0,_0x3b3459){_0x59d9c0=_0x59d9c0-0x0;var _0x2d27e1=_0x6596[_0x59d9c0];return _0x2d27e1;};'use strict';var multer=require(_0x6659('0x0'));var util=require(_0x6659('0x1'));var path=require('path');var timeout=require(_0x6659('0x2'));var express=require(_0x6659('0x3'));var router=express[_0x6659('0x4')]();var fs_extra=require(_0x6659('0x5'));var auth=require(_0x6659('0x6'));var interaction=require(_0x6659('0x7'));var config=require('../../config/environment');var controller=require('./whatsappInteraction.controller');router[_0x6659('0x8')]('/',auth[_0x6659('0x9')](),controller[_0x6659('0xa')]);router[_0x6659('0x8')](_0x6659('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x6659('0x8')](_0x6659('0xc'),auth[_0x6659('0x9')](),controller[_0x6659('0xd')]);router[_0x6659('0x8')](_0x6659('0xe'),auth['isAuthenticated'](),controller[_0x6659('0xf')]);router['get']('/:id/download',auth[_0x6659('0x9')](),controller['download']);router[_0x6659('0x10')]('/',auth[_0x6659('0x9')](),controller[_0x6659('0x11')]);router[_0x6659('0x10')]('/:id/messages',auth[_0x6659('0x9')](),controller[_0x6659('0x12')]);router['post'](_0x6659('0x13'),auth[_0x6659('0x9')](),interaction[_0x6659('0x14')](_0x6659('0x15'),_0x6659('0x16')),controller[_0x6659('0x17')]);router['put'](_0x6659('0xc'),auth[_0x6659('0x9')](),interaction[_0x6659('0x14')](_0x6659('0x15'),_0x6659('0x18')),controller[_0x6659('0x19')]);router['delete']('/:id',auth[_0x6659('0x9')](),interaction['tracked'](_0x6659('0x15'),_0x6659('0x1a')),controller['destroy']);router[_0x6659('0x1b')]('/:id/tags',auth[_0x6659('0x9')](),controller[_0x6659('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x1751=['getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','put','whatsappinteraction:update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages'];(function(_0x33e500,_0x490d6a){var _0x56d753=function(_0x38ed57){while(--_0x38ed57){_0x33e500['push'](_0x33e500['shift']());}};_0x56d753(++_0x490d6a);}(_0x1751,0x76));var _0x1175=function(_0x292da1,_0x17df7f){_0x292da1=_0x292da1-0x0;var _0x5562e8=_0x1751[_0x292da1];return _0x5562e8;};'use strict';var multer=require(_0x1175('0x0'));var util=require(_0x1175('0x1'));var path=require(_0x1175('0x2'));var timeout=require(_0x1175('0x3'));var express=require('express');var router=express[_0x1175('0x4')]();var fs_extra=require(_0x1175('0x5'));var auth=require(_0x1175('0x6'));var interaction=require(_0x1175('0x7'));var config=require(_0x1175('0x8'));var controller=require(_0x1175('0x9'));router[_0x1175('0xa')]('/',auth[_0x1175('0xb')](),controller[_0x1175('0xc')]);router[_0x1175('0xa')](_0x1175('0xd'),auth[_0x1175('0xb')](),controller[_0x1175('0xe')]);router[_0x1175('0xa')](_0x1175('0xf'),auth[_0x1175('0xb')](),controller[_0x1175('0x10')]);router[_0x1175('0xa')](_0x1175('0x11'),auth[_0x1175('0xb')](),controller[_0x1175('0x12')]);router[_0x1175('0xa')](_0x1175('0x13'),auth[_0x1175('0xb')](),controller[_0x1175('0x14')]);router[_0x1175('0x15')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1175('0x15')](_0x1175('0x11'),auth['isAuthenticated'](),controller[_0x1175('0x16')]);router[_0x1175('0x15')](_0x1175('0x17'),auth['isAuthenticated'](),interaction[_0x1175('0x18')](_0x1175('0x19'),_0x1175('0x1a')),controller['addTags']);router[_0x1175('0x1b')]('/:id',auth[_0x1175('0xb')](),interaction[_0x1175('0x18')](_0x1175('0x19'),_0x1175('0x1c')),controller['update']);router[_0x1175('0x1d')](_0x1175('0xf'),auth['isAuthenticated'](),interaction['tracked'](_0x1175('0x19'),_0x1175('0x1e')),controller[_0x1175('0x1f')]);router[_0x1175('0x1d')](_0x1175('0x17'),auth['isAuthenticated'](),controller[_0x1175('0x20')]);module[_0x1175('0x21')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index c47ef48..09a7d79 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 _0x5a63=['moment','DATE','STRING','ENUM','out','sequelize'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x5a63,0xe3));var _0x35a6=function(_0x49e3d6,_0x38ee36){_0x49e3d6=_0x49e3d6-0x0;var _0x5375a6=_0x5a63[_0x49e3d6];return _0x5375a6;};'use strict';var Sequelize=require(_0x35a6('0x0'));var moment=require(_0x35a6('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x35a6('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x35a6('0x3')]},'note':{'type':Sequelize[_0x35a6('0x3')]},'phone':{'type':Sequelize[_0x35a6('0x3')]},'read1stAt':{'type':Sequelize[_0x35a6('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x35a6('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x35a6('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x35a6('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x51f2=['STRING','ENUM','out','sequelize','moment','exports','BOOLEAN','DATE'];(function(_0x31991b,_0xaf75d2){var _0x307304=function(_0x2f36c5){while(--_0x2f36c5){_0x31991b['push'](_0x31991b['shift']());}};_0x307304(++_0xaf75d2);}(_0x51f2,0xeb));var _0x251f=function(_0x3aaea7,_0x33b8ba){_0x3aaea7=_0x3aaea7-0x0;var _0x38d50b=_0x51f2[_0x3aaea7];return _0x38d50b;};'use strict';var Sequelize=require(_0x251f('0x0'));var moment=require(_0x251f('0x1'));module[_0x251f('0x2')]={'closed':{'type':Sequelize[_0x251f('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x251f('0x4')]},'disposition':{'type':Sequelize[_0x251f('0x5')]},'secondDisposition':{'type':Sequelize[_0x251f('0x5')]},'thirdDisposition':{'type':Sequelize[_0x251f('0x5')]},'note':{'type':Sequelize[_0x251f('0x5')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x251f('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x251f('0x6')]('in',_0x251f('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x251f('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x251f('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x251f('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 485b590..3b73fea 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 _0x8ff9=['operator','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','compact','isEmpty','WhatsappAccountId','where','concat','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.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','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','contactName','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','all','rows','show','params','filters','includeAll','include','create','destroy','describe','addMessage','ids','omit','getMessages','findOne','WhatsappMessage','nolimit','WhatsappInteractionId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','addTags','spread','findAll','whatsappInteractionTags:save','removeTags','unix','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','secret','WhatsappAccount','Account','Owner','get','Whatsapp','N.A.','disposition','Messages','existsSync','createWriteStream','basename','direction','out','System','Contact','renderFile','views','transcript-','.pdf','createPdfFromHTML','download','err','unlinkSync','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./whatsappInteraction.socket','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','send','Users','map','fullname','Tags','TagIds','forEach','push','catch','index','WhatsappInteraction','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','pick','select','field','color','from','tools_tags','u.id','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','value','having','`\x20=\x200','`\x20>\x200'];(function(_0xc66c1b,_0x29125f){var _0x1f42be=function(_0x3d185f){while(--_0x3d185f){_0xc66c1b['push'](_0xc66c1b['shift']());}};_0x1f42be(++_0x29125f);}(_0x8ff9,0x188));var _0x98ff=function(_0x595fba,_0x16dcfc){_0x595fba=_0x595fba-0x0;var _0x5a4ae6=_0x8ff9[_0x595fba];return _0x5a4ae6;};'use strict';var emlformat=require(_0x98ff('0x0'));var rimraf=require(_0x98ff('0x1'));var zipdir=require(_0x98ff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x98ff('0x3'));var moment=require(_0x98ff('0x4'));var BPromise=require(_0x98ff('0x5'));var Mustache=require(_0x98ff('0x6'));var util=require(_0x98ff('0x7'));var path=require(_0x98ff('0x8'));var sox=require(_0x98ff('0x9'));var csv=require('to-csv');var ejs=require(_0x98ff('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x98ff('0xb'));var squel=require(_0x98ff('0xc'));var crypto=require('crypto');var jsforce=require(_0x98ff('0xd'));var deskjs=require(_0x98ff('0xe'));var toCsv=require(_0x98ff('0xf'));var querystring=require(_0x98ff('0x10'));var Papa=require(_0x98ff('0x11'));var Redis=require(_0x98ff('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x98ff('0x13'));var as=require(_0x98ff('0x14'));var pdf=require(_0x98ff('0x15'));var hardwareService=require(_0x98ff('0x16'));var logger=require('../../config/logger')(_0x98ff('0x17'));var utils=require(_0x98ff('0x18'));var config=require(_0x98ff('0x19'));var licenseUtil=require(_0x98ff('0x1a'));var db=require(_0x98ff('0x1b'))['db'];config[_0x98ff('0x1c')]=_['defaults'](config['redis'],{'host':_0x98ff('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x98ff('0x1c')]));require(_0x98ff('0x1e'))['register'](socket);function respondWithStatusCode(_0x45e5ae,_0x4f1bec){_0x4f1bec=_0x4f1bec||0xcc;return function(_0x18132e){if(_0x18132e){return _0x45e5ae[_0x98ff('0x1f')](_0x4f1bec);}return _0x45e5ae['status'](_0x4f1bec)[_0x98ff('0x20')]();};}function respondWithResult(_0x5471d5,_0x312c07){_0x312c07=_0x312c07||0xc8;return function(_0x142834){if(_0x142834){return _0x5471d5[_0x98ff('0x21')](_0x312c07)['json'](_0x142834);}};}function respondWithFilteredResult(_0x59b453,_0x19e1db){return function(_0x1108c0){if(_0x1108c0){var _0x48ca02=typeof _0x19e1db[_0x98ff('0x22')]===_0x98ff('0x23')&&typeof _0x19e1db[_0x98ff('0x24')]===_0x98ff('0x23');var _0x4449e1=_0x1108c0[_0x98ff('0x25')];var _0x1ce987=_0x48ca02?0x0:_0x19e1db[_0x98ff('0x22')];var _0x3b79db=_0x48ca02?_0x1108c0['count']:_0x19e1db[_0x98ff('0x22')]+_0x19e1db['limit'];var _0xc44631;if(_0x3b79db>=_0x4449e1){_0x3b79db=_0x4449e1;_0xc44631=0xc8;}else{_0xc44631=0xce;}_0x59b453[_0x98ff('0x21')](_0xc44631);return _0x59b453[_0x98ff('0x26')](_0x98ff('0x27'),_0x1ce987+'-'+_0x3b79db+'/'+_0x4449e1)['json'](_0x1108c0);}return null;};}function patchUpdates(_0x5c1e7c){return function(_0x904491){try{jsonpatch[_0x98ff('0x28')](_0x904491,_0x5c1e7c,!![]);}catch(_0x766b31){return BPromise['reject'](_0x766b31);}return _0x904491[_0x98ff('0x29')]();};}function saveUpdates(_0x34d7c7,_0x3d0fbb){return function(_0x107cd9){if(_0x107cd9){return _0x107cd9[_0x98ff('0x2a')](_0x34d7c7)[_0x98ff('0x2b')](function(_0x464a14){return _0x464a14;});}return null;};}function removeEntity(_0x2c4d4e,_0x5326eb){return function(_0x839545){if(_0x839545){return _0x839545['destroy']()[_0x98ff('0x2b')](function(){_0x2c4d4e[_0x98ff('0x21')](0xcc)[_0x98ff('0x20')]();});}};}function handleEntityNotFound(_0x285f72,_0x3311c1){return function(_0x9b284c){if(!_0x9b284c){_0x285f72[_0x98ff('0x1f')](0x194);}return _0x9b284c;};}function handleError(_0x1c4c64,_0xa9787c){_0xa9787c=_0xa9787c||0x1f4;return function(_0xa9a152){logger[_0x98ff('0x2c')](_0xa9a152[_0x98ff('0x2d')]);if(_0xa9a152[_0x98ff('0x2e')]){delete _0xa9a152[_0x98ff('0x2e')];}_0x1c4c64[_0x98ff('0x21')](_0xa9787c)[_0x98ff('0x2f')](_0xa9a152);};}function getInteractionUsers(_0x2b686b,_0x5af0dc){return new BPromise(function(_0x346dee,_0x371096){try{if(_0x5af0dc[_0x2b686b['id']]){_0x2b686b[_0x98ff('0x30')]=_[_0x98ff('0x31')](_0x5af0dc[_0x2b686b['id']],function(_0x55b72f){return{'id':_0x55b72f['id'],'fullname':_0x55b72f[_0x98ff('0x32')]};});}}catch(_0x4ca856){_0x371096(_0x4ca856);}_0x346dee(_0x2b686b);});}function getInteractionTags(_0x1d8ddd,_0x40f57d){return new BPromise(function(_0x303d06,_0x5c15ba){try{if(_0x1d8ddd['TagIds']){_0x1d8ddd[_0x98ff('0x33')]=[];_0x1d8ddd[_0x98ff('0x34')]['split'](',')[_0x98ff('0x35')](function(_0x23026c){_0x1d8ddd['Tags'][_0x98ff('0x36')](_0x40f57d[_0x23026c]);});}delete _0x1d8ddd[_0x98ff('0x34')];}catch(_0x53dff4){_0x5c15ba(_0x53dff4);}_0x303d06(_0x1d8ddd);});}function updateWhatsappInteraction(_0x45775a,_0x93fdec,_0x429ca3){return new BPromise(function(_0x45213a,_0x505bf4){return getInteractionUsers(_0x45775a,_0x429ca3)[_0x98ff('0x2b')](function(_0x4bf9f4){return getInteractionTags(_0x4bf9f4,_0x93fdec);})[_0x98ff('0x2b')](function(_0x42958c){_0x45213a(_0x42958c);})[_0x98ff('0x37')](function(_0x497db1){_0x505bf4(_0x497db1);});});}exports[_0x98ff('0x38')]=function(_0x179538,_0x1b1291){var _0x3c59c9={},_0x151ab1={},_0x2c3649={'count':0x0,'rows':[]};var _0x1d2054=_[_0x98ff('0x31')](db[_0x98ff('0x39')][_0x98ff('0x3a')],function(_0x202c37){return{'name':_0x202c37[_0x98ff('0x3b')],'type':_0x202c37['type'][_0x98ff('0x3c')]};});_0x151ab1[_0x98ff('0x3d')]=_['map'](_0x1d2054,'name');_0x151ab1[_0x98ff('0x3e')]=_[_0x98ff('0x3f')](_0x179538[_0x98ff('0x3e')]);_0x151ab1['filters']=_[_0x98ff('0x40')](_0x151ab1[_0x98ff('0x3d')],_0x151ab1['query']);_0x3c59c9[_0x98ff('0x41')]=_[_0x98ff('0x40')](_0x151ab1[_0x98ff('0x3d')],qs[_0x98ff('0x42')](_0x179538[_0x98ff('0x3e')]['fields']));_0x3c59c9[_0x98ff('0x41')]=_0x3c59c9['attributes'][_0x98ff('0x43')]?_0x3c59c9[_0x98ff('0x41')]:_0x151ab1[_0x98ff('0x3d')];if(!_0x179538[_0x98ff('0x3e')][_0x98ff('0x44')]('nolimit')){_0x3c59c9[_0x98ff('0x24')]=qs['limit'](_0x179538[_0x98ff('0x3e')][_0x98ff('0x24')]);_0x3c59c9['offset']=qs[_0x98ff('0x22')](_0x179538[_0x98ff('0x3e')][_0x98ff('0x22')]);}_0x3c59c9['order']=qs[_0x98ff('0x45')](_0x179538[_0x98ff('0x3e')]['sort']);_0x3c59c9['where']=qs['filters'](_[_0x98ff('0x46')](_0x179538[_0x98ff('0x3e')],_0x151ab1['filters']),_0x1d2054);var _0x47a32a=[];var _0x2eb351=squel[_0x98ff('0x47')]()[_0x98ff('0x48')]('id')['field']('name')['field'](_0x98ff('0x49'))[_0x98ff('0x4a')](_0x98ff('0x4b'));var _0x514e0c=squel[_0x98ff('0x47')]()['field'](_0x98ff('0x4c'))[_0x98ff('0x48')]('u.fullname')[_0x98ff('0x48')](_0x98ff('0x4d'))['from'](_0x98ff('0x4e'),'ui')[_0x98ff('0x4f')](_0x98ff('0x50'),'u','u.id\x20=\x20ui.UserId');var _0x58a089=squel[_0x98ff('0x47')]()[_0x98ff('0x4a')](_0x98ff('0x51'),'i')[_0x98ff('0x4f')](_0x98ff('0x52'),'c',_0x98ff('0x53'))[_0x98ff('0x4f')](_0x98ff('0x50'),'o',_0x98ff('0x54'))[_0x98ff('0x4f')](_0x98ff('0x55'),'a',_0x98ff('0x56'))[_0x98ff('0x4f')]('whatsapp_messages','me',_0x98ff('0x57'))[_0x98ff('0x4f')](_0x98ff('0x58'),'it',_0x98ff('0x59'))[_0x98ff('0x4f')](_0x98ff('0x4b'),'t',_0x98ff('0x5a'));var _0x4e14a0=squel[_0x98ff('0x5b')]();var _0x3885f8=[];var _0x57c562=squel[_0x98ff('0x5b')]();var _0x189258;if(_0x179538[_0x98ff('0x3e')][_0x98ff('0x5c')]){_0x189258=as[_0x98ff('0x5d')](_0x179538[_0x98ff('0x3e')][_0x98ff('0x5c')]);var _0x35da9b=_0x189258['sqlOperator'];for(var _0x58faf5=0x0;_0x58faf5<_0x189258[_0x98ff('0x5e')][_0x98ff('0x43')];_0x58faf5++){var _0x2fe731=_0x189258[_0x98ff('0x5e')][_0x58faf5];var _0x5ce204='i';var _0x2a7fad=_[_0x98ff('0x5f')](_0x1d2054,['name',_0x2fe731['field']]);if(!_0x2a7fad){switch(_0x2fe731['field']){case'unreadMessages':if(_0x2fe731[_0x98ff('0x60')]==0x1){_0x58a089[_0x98ff('0x61')]('`'+_0x2fe731[_0x98ff('0x48')]+_0x98ff('0x62'));}else{_0x58a089[_0x98ff('0x61')]('`'+_0x2fe731[_0x98ff('0x48')]+_0x98ff('0x63'));}break;case'Contact':if(_0x2fe731[_0x98ff('0x64')]==='$substring'){if(_0x2fe731[_0x98ff('0x60')][_0x98ff('0x65')]('\x20')[_0x98ff('0x43')]>0x1){_0x4e14a0[_0x35da9b](_0x98ff('0x66'),qs[_0x98ff('0x67')](_0x2fe731[_0x98ff('0x60')]),null);}else{var _0x2d1845='%'+_0x2fe731[_0x98ff('0x60')]+'%';_0x4e14a0[_0x35da9b](_0x98ff('0x68'),_0x2d1845,_0x2d1845,_0x2d1845);}}else{_0x2a7fad=_['find'](_0x1d2054,['name',_0x98ff('0x69')]);_0x2fe731[_0x98ff('0x48')]=_0x98ff('0x69');_0x4f4568=as[_0x98ff('0x6a')](_0x5ce204,_0x2a7fad[_0x98ff('0x6b')],_0x2fe731);_0x4e14a0[_0x35da9b](_0x4f4568['text'],_0x4f4568['value'][_0x98ff('0x6c')],_0x4f4568[_0x98ff('0x60')][_0x98ff('0x20')]);}break;case _0x98ff('0x6d'):var _0x28744d=_0x2fe731[_0x98ff('0x60')][_0x98ff('0x65')](',')[_0x98ff('0x31')](function(_0x42df02){return Number(_0x42df02);});_0x28744d['forEach'](function(_0x209c2d){_0x57c562['or'](_0x98ff('0x6e'),'%,'+_0x209c2d+',%');});_0x3885f8=_[_0x98ff('0x6f')](_0x3885f8,_0x28744d);break;case _0x98ff('0x70'):if(_0x2fe731[_0x98ff('0x64')]===_0x98ff('0x71')){_0x4e14a0[_0x35da9b](_0x98ff('0x72'),'%'+_0x2fe731[_0x98ff('0x60')]+'%',null);}else{_0x2a7fad=_[_0x98ff('0x5f')](_0x1d2054,[_0x98ff('0x2e'),_0x98ff('0x73')]);_0x2fe731[_0x98ff('0x48')]=_0x98ff('0x73');_0x4f4568=as[_0x98ff('0x6a')](_0x5ce204,_0x2a7fad[_0x98ff('0x6b')],_0x2fe731);_0x4e14a0[_0x35da9b](_0x4f4568[_0x98ff('0x74')],_0x4f4568['value'][_0x98ff('0x6c')],_0x4f4568[_0x98ff('0x60')][_0x98ff('0x20')]);}break;case _0x98ff('0x75'):_0x4f4568=as[_0x98ff('0x6a')]('me',null,_0x2fe731);_0x4e14a0[_0x35da9b](_0x4f4568[_0x98ff('0x74')],_0x4f4568[_0x98ff('0x60')][_0x98ff('0x6c')],_0x4f4568[_0x98ff('0x60')][_0x98ff('0x20')]);break;}}else{var _0x4f4568=as[_0x98ff('0x6a')](_0x5ce204,_0x2a7fad[_0x98ff('0x6b')],_0x2fe731);_0x4e14a0[_0x35da9b](_0x4f4568[_0x98ff('0x74')],_0x4f4568[_0x98ff('0x60')][_0x98ff('0x6c')],_0x4f4568[_0x98ff('0x60')][_0x98ff('0x20')]);}}}else{var _0x2a4138=_(_0x179538[_0x98ff('0x3e')])[_0x98ff('0x3f')]()[_0x98ff('0x31')](function(_0x370e97){return _['some'](_0x1d2054,[_0x98ff('0x2e'),_0x370e97])?_0x370e97:undefined;})[_0x98ff('0x76')]()[_0x98ff('0x60')]();if(!_[_0x98ff('0x77')](_0x2a4138)){_0x2a4138[_0x98ff('0x35')](function(_0x461878){if(_0x461878===_0x98ff('0x78')){_0x58a089[_0x98ff('0x79')]('i.WhatsappAccountId\x20IN\x20?',[][_0x98ff('0x7a')](_0x179538[_0x98ff('0x3e')][_0x461878]));}else if(_0x461878===_0x98ff('0x7b')){var _0xe1d35=JSON[_0x98ff('0x7c')](_0x179538[_0x98ff('0x3e')][_0x461878])['$gte'];var _0x2fefac=JSON['parse'](_0x179538[_0x98ff('0x3e')][_0x461878])['$lte'];_0x58a089[_0x98ff('0x79')](_0x98ff('0x7d'),_0xe1d35,_0x2fefac);}else{if(_0x179538['query'][_0x461878]===_0x98ff('0x7e')){_0x58a089[_0x98ff('0x79')]('i.'+_0x461878+_0x98ff('0x7f'));}else{_0x58a089[_0x98ff('0x79')]('i.'+_0x461878+'\x20=\x20?',_0x179538['query'][_0x461878]);}}});}if(_0x179538[_0x98ff('0x3e')]['read']){if(_0x179538[_0x98ff('0x3e')][_0x98ff('0x80')]==0x1){_0x58a089[_0x98ff('0x61')](_0x98ff('0x81'));}else{_0x58a089[_0x98ff('0x61')](_0x98ff('0x82'));}}if(_0x179538[_0x98ff('0x3e')][_0x98ff('0x83')]){_0x3885f8=_[_0x98ff('0x84')](_0x179538[_0x98ff('0x3e')][_0x98ff('0x83')])?_0x179538[_0x98ff('0x3e')][_0x98ff('0x83')]:new Array(_0x179538[_0x98ff('0x3e')]['tag']);_0x3885f8[_0x98ff('0x35')](function(_0x2ead57){_0x57c562['or'](_0x98ff('0x6e'),'%,'+_0x2ead57+',%');});}if(_0x179538[_0x98ff('0x3e')][_0x98ff('0x85')]){var _0x203ac0=_0x179538[_0x98ff('0x3e')]['filter'][_0x98ff('0x86')]('\x5c','\x5c\x5c')[_0x98ff('0x86')](/'/g,'\x27\x27');if(qs[_0x98ff('0x87')](_0x203ac0)){_0x4e14a0['or'](_0x98ff('0x88'),_0x203ac0+'%')['or'](_0x98ff('0x89'),_0x203ac0+'%');}else{_0x4e14a0['or'](_0x98ff('0x8a'),qs[_0x98ff('0x67')](_0x203ac0))['or'](_0x98ff('0x8b'),_0x203ac0+'%');}}}_0x58a089['where'](_0x4e14a0);_0x58a089[_0x98ff('0x8c')](_0x98ff('0x8d'));var _0x4ab7ac={'type':db[_0x98ff('0x8e')]['QueryTypes'][_0x98ff('0x8f')],'raw':!![]};var _0xc10c86=_0x58a089[_0x98ff('0x90')]();_0xc10c86[_0x98ff('0x48')](_0x98ff('0x8d'));_0xc10c86[_0x98ff('0x48')](_0x98ff('0x91'),_0x98ff('0x92'));if(_0x3c59c9[_0x98ff('0x93')]){_0x3c59c9['order'][_0x98ff('0x35')](function(_0x55a931){var _0x186205=_0x55a931[0x0]==='contactName'?_0x55a931[0x0]:'i.'+_0x55a931[0x0];_0x58a089[_0x98ff('0x93')](_0x186205,_0x55a931[0x1]===_0x98ff('0x94')?![]:!![]);});}if(!_[_0x98ff('0x77')](_0x3885f8)){_0x58a089['having'](_0x57c562);_0xc10c86[_0x98ff('0x79')](_0x98ff('0x95'),_0x3885f8);}BPromise[_0x98ff('0x96')]()[_0x98ff('0x2b')](function(){if(!_0x189258){if(_0x179538[_0x98ff('0x3e')]['WhatsappAccountId'])return;_0xc10c86['where'](_0x98ff('0x97'));_0x58a089[_0x98ff('0x79')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x179538['user'][_0x98ff('0x98')]!==_0x98ff('0x99'))return;return _0x179538[_0x98ff('0x9a')][_0x98ff('0x9b')]({'attributes':['id'],'raw':!![]})[_0x98ff('0x2b')](function(_0x2660b5){if(_['isEmpty'](_0x2660b5)){_0xc10c86['where'](_0x98ff('0x9c'));_0x58a089[_0x98ff('0x79')](_0x98ff('0x9c'));}else{_0xc10c86[_0x98ff('0x79')](_0x98ff('0x9d'),_[_0x98ff('0x31')](_0x2660b5,'id'));_0x58a089[_0x98ff('0x79')](_0x98ff('0x9d'),_['map'](_0x2660b5,'id'));}});})[_0x98ff('0x2b')](function(){if(_0x179538['user']['role']===_0x98ff('0x99')&&!_0x189258&&!_0x179538[_0x98ff('0x3e')][_0x98ff('0x78')])return[];return db[_0x98ff('0x9e')]['query'](_0xc10c86[_0x98ff('0x9f')](),_0x4ab7ac);})[_0x98ff('0x2b')](function(_0x154696){_0x2c3649[_0x98ff('0x25')]=_0x154696['length'];if(_0x2c3649[_0x98ff('0x25')]===0x0)return[];return db[_0x98ff('0x9e')]['query'](_0x2eb351['toString'](),_0x4ab7ac)['then'](function(_0x2292ba){_0x47a32a=_[_0x98ff('0xa0')](_0x2292ba,'id');_0x4ab7ac=_[_0x98ff('0xa1')](_0x4ab7ac,{'model':db[_0x98ff('0x39')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x179538[_0x98ff('0x3e')]['fields']){_0x3c59c9[_0x98ff('0x41')][_0x98ff('0x35')](function(_0x544288){_0x58a089[_0x98ff('0x48')]('i.'+_0x544288);});}else{_0x58a089['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x58a089['field'](_0x98ff('0xa2'),_0x98ff('0xa3'));_0x58a089['field'](_0x98ff('0xa4'),_0x98ff('0xa5'));_0x58a089['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',_0x98ff('0xa6'));_0x58a089[_0x98ff('0x48')](_0x98ff('0xa7'));_0x58a089[_0x98ff('0x48')](_0x98ff('0xa8'),_0x98ff('0xa9'));_0x58a089['field'](_0x98ff('0xaa'),_0x98ff('0xab'));_0x58a089['field'](_0x98ff('0xac'),'Contact.email');_0x58a089[_0x98ff('0x48')](_0x98ff('0xad'),_0x98ff('0xae'));_0x58a089[_0x98ff('0x48')](_0x98ff('0xaf'),_0x98ff('0xb0'));_0x58a089['field'](_0x98ff('0xb1'),_0x98ff('0xb2'));_0x58a089[_0x98ff('0x48')]('o.fullname',_0x98ff('0xb3'));_0x58a089[_0x98ff('0x48')]('o.internal','Owner.internal');_0x58a089[_0x98ff('0x48')](_0x98ff('0xb4'),_0x98ff('0x34'));}if(_0x3c59c9[_0x98ff('0x24')])_0x58a089[_0x98ff('0x24')](_0x3c59c9[_0x98ff('0x24')]);if(_0x3c59c9[_0x98ff('0x22')])_0x58a089[_0x98ff('0x22')](_0x3c59c9[_0x98ff('0x22')]);return db[_0x98ff('0x9e')][_0x98ff('0x3e')](_0x58a089['toString'](),_0x4ab7ac);})[_0x98ff('0x2b')](function(_0x187d3e){if(_0x187d3e[_0x98ff('0x43')]>0x0)_0x514e0c[_0x98ff('0x79')](_0x98ff('0xb5'),_[_0x98ff('0x31')](_0x187d3e,'id'));return db[_0x98ff('0x9e')][_0x98ff('0x3e')](_0x514e0c[_0x98ff('0x9f')](),_0x4ab7ac)[_0x98ff('0x2b')](function(_0xc86820){var _0xaba4b3=_[_0x98ff('0xb6')](_0xc86820,'WhatsappInteractionId');var _0x4684ad=[];_0x187d3e[_0x98ff('0x35')](function(_0x7bb23d){_0x4684ad['push'](updateWhatsappInteraction(_0x7bb23d,_0x47a32a,_0xaba4b3));});return BPromise[_0x98ff('0xb7')](_0x4684ad);});});})[_0x98ff('0x2b')](function(_0x2d28df){_0x2c3649[_0x98ff('0xb8')]=_0x2d28df;return _0x2c3649;})[_0x98ff('0x2b')](respondWithFilteredResult(_0x1b1291,_0x3c59c9))[_0x98ff('0x37')](handleError(_0x1b1291,null));};exports[_0x98ff('0xb9')]=function(_0x4b346d,_0x4a295f){var _0x1f3307={'raw':![],'where':{'id':_0x4b346d[_0x98ff('0xba')]['id']}},_0x5cc3d7={};_0x5cc3d7[_0x98ff('0x3d')]=_['keys'](db[_0x98ff('0x39')][_0x98ff('0x3a')]);_0x5cc3d7['query']=_[_0x98ff('0x3f')](_0x4b346d['query']);_0x5cc3d7[_0x98ff('0xbb')]=_[_0x98ff('0x40')](_0x5cc3d7[_0x98ff('0x3d')],_0x5cc3d7['query']);_0x1f3307[_0x98ff('0x41')]=_[_0x98ff('0x40')](_0x5cc3d7[_0x98ff('0x3d')],qs['fields'](_0x4b346d['query'][_0x98ff('0x42')]));_0x1f3307[_0x98ff('0x41')]=_0x1f3307['attributes'][_0x98ff('0x43')]?_0x1f3307[_0x98ff('0x41')]:_0x5cc3d7[_0x98ff('0x3d')];if(_0x4b346d[_0x98ff('0x3e')][_0x98ff('0xbc')]){_0x1f3307[_0x98ff('0xbd')]=[{'all':!![]}];}_0x1f3307=_[_0x98ff('0xa1')]({},_0x1f3307,_0x4b346d['options']);return db[_0x98ff('0x39')][_0x98ff('0x5f')](_0x1f3307)[_0x98ff('0x2b')](handleEntityNotFound(_0x4a295f,null))[_0x98ff('0x2b')](respondWithResult(_0x4a295f,null))['catch'](handleError(_0x4a295f,null));};exports[_0x98ff('0xbe')]=function(_0xfea44d,_0x2ebd35){return db[_0x98ff('0x39')][_0x98ff('0xbe')](_0xfea44d[_0x98ff('0x75')],{})[_0x98ff('0x2b')](respondWithResult(_0x2ebd35,0xc9))[_0x98ff('0x37')](handleError(_0x2ebd35,null));};exports['update']=function(_0x43a879,_0x227324){if(_0x43a879[_0x98ff('0x75')]['id']){delete _0x43a879[_0x98ff('0x75')]['id'];}return db[_0x98ff('0x39')][_0x98ff('0x5f')]({'where':{'id':_0x43a879[_0x98ff('0xba')]['id']}})['then'](handleEntityNotFound(_0x227324,null))['then'](saveUpdates(_0x43a879[_0x98ff('0x75')],null))['then'](respondWithResult(_0x227324,null))[_0x98ff('0x37')](handleError(_0x227324,null));};exports[_0x98ff('0xbf')]=function(_0x1f615b,_0x57b27c){return db['WhatsappInteraction'][_0x98ff('0x5f')]({'where':{'id':_0x1f615b[_0x98ff('0xba')]['id']}})['then'](handleEntityNotFound(_0x57b27c,null))[_0x98ff('0x2b')](removeEntity(_0x57b27c,null))[_0x98ff('0x37')](handleError(_0x57b27c,null));};exports[_0x98ff('0xc0')]=function(_0x4484d6,_0x25a7a6){return db['WhatsappInteraction'][_0x98ff('0xc0')]()[_0x98ff('0x2b')](respondWithResult(_0x25a7a6,null))[_0x98ff('0x37')](handleError(_0x25a7a6,null));};exports[_0x98ff('0xc1')]=function(_0x11d390,_0x50d9ae,_0x1c0972){return db['WhatsappMessage']['find']({'where':{'id':_0x11d390['params']['id']}})[_0x98ff('0x2b')](handleEntityNotFound(_0x50d9ae,null))[_0x98ff('0x2b')](function(_0x48d33a){if(_0x48d33a){return _0x48d33a[_0x98ff('0xc1')](_0x11d390['body'][_0x98ff('0xc2')],_[_0x98ff('0xc3')](_0x11d390['body'],['ids','id'])||{});}})[_0x98ff('0x2b')](respondWithResult(_0x50d9ae,null))[_0x98ff('0x37')](handleError(_0x50d9ae,null));};exports[_0x98ff('0xc4')]=function(_0x3c6c58,_0x12ec31,_0x16a1bf){var _0x2011b6={'raw':![],'where':{}};var _0x4d7d2c={};var _0x4d56c5={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x98ff('0xc5')]({'where':{'id':_0x3c6c58['params']['id']}})[_0x98ff('0x2b')](handleEntityNotFound(_0x12ec31,null))['then'](function(_0x32bb2d){if(_0x32bb2d){_0x4d7d2c[_0x98ff('0x3d')]=_[_0x98ff('0x3f')](db[_0x98ff('0xc6')][_0x98ff('0x3a')]);_0x4d7d2c[_0x98ff('0x3e')]=_[_0x98ff('0x3f')](_0x3c6c58['query']);_0x4d7d2c[_0x98ff('0xbb')]=_[_0x98ff('0x40')](_0x4d7d2c[_0x98ff('0x3d')],_0x4d7d2c[_0x98ff('0x3e')]);_0x2011b6[_0x98ff('0x41')]=_[_0x98ff('0x40')](_0x4d7d2c['model'],qs[_0x98ff('0x42')](_0x3c6c58[_0x98ff('0x3e')]['fields']));_0x2011b6[_0x98ff('0x41')]=_0x2011b6[_0x98ff('0x41')][_0x98ff('0x43')]?_0x2011b6[_0x98ff('0x41')]:_0x4d7d2c[_0x98ff('0x3d')];if(!_0x3c6c58[_0x98ff('0x3e')][_0x98ff('0x44')](_0x98ff('0xc7'))){_0x2011b6[_0x98ff('0x24')]=qs['limit'](_0x3c6c58[_0x98ff('0x3e')][_0x98ff('0x24')]);_0x2011b6[_0x98ff('0x22')]=qs[_0x98ff('0x22')](_0x3c6c58['query'][_0x98ff('0x22')]);}_0x2011b6['order']=qs[_0x98ff('0x45')](_0x3c6c58[_0x98ff('0x3e')][_0x98ff('0x45')]);_0x2011b6[_0x98ff('0x79')]=qs['filters'](_[_0x98ff('0x46')](_0x3c6c58[_0x98ff('0x3e')],_0x4d7d2c[_0x98ff('0xbb')]));_0x2011b6[_0x98ff('0x79')][_0x98ff('0xc8')]=_0x32bb2d['id'];if(_0x3c6c58[_0x98ff('0x3e')][_0x98ff('0x85')]){_0x2011b6[_0x98ff('0x79')]=_[_0x98ff('0xa1')](_0x2011b6[_0x98ff('0x79')],{'$or':_[_0x98ff('0x31')](_0x2011b6['attributes'],function(_0x3655fe){var _0x517969={};_0x517969[_0x3655fe]={'$like':'%'+_0x3c6c58[_0x98ff('0x3e')]['filter']+'%'};return _0x517969;})});}if(_0x3c6c58[_0x98ff('0x3e')][_0x98ff('0xc9')]){var _0x3e7ac7=_0x3c6c58[_0x98ff('0x3e')][_0x98ff('0xc9')]['split'](',');var _0x122a05={};_0x122a05[_0x3e7ac7[0x0]]={'$gte':moment(_0x3e7ac7[0x1])[_0x98ff('0xca')](_0x98ff('0xcb'))};_0x2011b6[_0x98ff('0x79')]=_[_0x98ff('0xa1')](_0x2011b6[_0x98ff('0x79')],_0x122a05);}_0x2011b6=_[_0x98ff('0xa1')]({},_0x2011b6,_0x3c6c58[_0x98ff('0xcc')]);return db[_0x98ff('0xc6')][_0x98ff('0x25')]({'where':_0x2011b6[_0x98ff('0x79')]})[_0x98ff('0x2b')](function(_0x469d98){_0x4d56c5[_0x98ff('0x25')]=_0x469d98;if(_0x3c6c58[_0x98ff('0x3e')][_0x98ff('0xbc')]){_0x2011b6[_0x98ff('0xbd')]=[{'all':!![]}];}return db[_0x98ff('0xc6')]['findAll'](_0x2011b6);})[_0x98ff('0x2b')](function(_0x1fffc2){_0x4d56c5['rows']=_0x1fffc2;return _0x4d56c5;});}})[_0x98ff('0x2b')](respondWithFilteredResult(_0x12ec31,_0x2011b6))[_0x98ff('0x37')](handleError(_0x12ec31,null));};exports[_0x98ff('0xcd')]=function(_0x43712e,_0x2721ab,_0x4213b2){return db['WhatsappInteraction']['find']({'where':{'id':_0x43712e['params']['id']}})[_0x98ff('0x2b')](handleEntityNotFound(_0x2721ab,null))[_0x98ff('0x2b')](function(_0x2765a2){if(_0x2765a2){return _0x2765a2['setTags'](_0x43712e[_0x98ff('0x75')][_0x98ff('0xc2')],_[_0x98ff('0xc3')](_0x43712e[_0x98ff('0x75')],[_0x98ff('0xc2'),'id'])||{})[_0x98ff('0xce')](function(){return db[_0x98ff('0x6d')][_0x98ff('0xcf')]({'attributes':['id',_0x98ff('0x2e'),_0x98ff('0x49')],'where':{'id':_0x43712e[_0x98ff('0x75')][_0x98ff('0xc2')]}});})['then'](function(_0x1ae263){socket['emit'](_0x98ff('0xd0'),{'id':Number(_0x43712e[_0x98ff('0xba')]['id']),'tags':_0x1ae263||[]});return{'id':Number(_0x43712e[_0x98ff('0xba')]['id']),'tags':_0x1ae263||[]};});}})[_0x98ff('0x2b')](respondWithResult(_0x2721ab,null))[_0x98ff('0x37')](handleError(_0x2721ab,null));};exports[_0x98ff('0xd1')]=function(_0x3380ca,_0x5473dd,_0x43abb5){return db[_0x98ff('0x39')][_0x98ff('0x5f')]({'where':{'id':_0x3380ca[_0x98ff('0xba')]['id']}})['then'](handleEntityNotFound(_0x5473dd,null))['then'](function(_0x351eb0){if(_0x351eb0){return _0x351eb0[_0x98ff('0xd1')](_0x3380ca['query'][_0x98ff('0xc2')]);}})[_0x98ff('0x2b')](respondWithStatusCode(_0x5473dd,null))[_0x98ff('0x37')](handleError(_0x5473dd,null));};exports['download']=function(_0x587f07,_0x1e3bba){var _0x25545b=moment()[_0x98ff('0xd2')]()['toString']();var _0x46b0a1=path['join'](config[_0x98ff('0xd3')],_0x98ff('0xd4'),_0x98ff('0xd5'),_0x98ff('0xd6'));var _0x2074b8=path[_0x98ff('0xd7')](config[_0x98ff('0xd3')],'server',_0x98ff('0xd5'),_0x98ff('0xd8'));var _0x6a47d0=path[_0x98ff('0xd7')](_0x46b0a1,_0x25545b);var _0xc8843c=util[_0x98ff('0xca')](_0x98ff('0xd9'),_0x587f07[_0x98ff('0xba')]['id'],_0x25545b);var _0x7c6fa1=path[_0x98ff('0xd7')](_0x46b0a1,_0xc8843c);var _0x3090d3=[];_0x3090d3[_0x98ff('0x36')]({'model':db[_0x98ff('0x70')],'as':_0x98ff('0x70'),'attributes':['id',_0x98ff('0x32')],'raw':!![]});_0x3090d3[_0x98ff('0x36')]({'model':db[_0x98ff('0xda')],'as':'Contact','attributes':['id',_0x98ff('0xdb'),_0x98ff('0xdc')],'raw':!![]});if(_0x587f07[_0x98ff('0x3e')][_0x98ff('0xd8')]){_0x3090d3[_0x98ff('0x36')]({'model':db[_0x98ff('0xdd')],'as':'Attachment','raw':!![]});}var _0x2d388d=[{'model':db[_0x98ff('0xc6')],'as':'Messages','attributes':['id','body','createdAt','direction',_0x98ff('0xde'),_0x98ff('0x80')],'include':_0x3090d3}];_0x2d388d['push']({'model':db[_0x98ff('0xdf')],'as':_0x98ff('0xe0'),'attributes':['id',_0x98ff('0x2e')]});_0x2d388d[_0x98ff('0x36')]({'model':db[_0x98ff('0x70')],'as':_0x98ff('0xe1'),'attributes':['id',_0x98ff('0x32')]});return db[_0x98ff('0x39')][_0x98ff('0x5f')]({'where':{'id':_0x587f07[_0x98ff('0xba')]['id']},'include':_0x2d388d})['then'](handleEntityNotFound(_0x1e3bba,null))[_0x98ff('0x2b')](function(_0x35e539){if(_0x35e539){var _0x5874a1=_0x35e539[_0x98ff('0xe2')]({'plain':!![]});fs['mkdirSync'](_0x6a47d0);var _0x5619ec={'channel':_0x98ff('0xe3'),'account':_0x5874a1[_0x98ff('0xe0')][_0x98ff('0x2e')],'agent':_0x5874a1[_0x98ff('0xe1')]?_0x5874a1[_0x98ff('0xe1')][_0x98ff('0x32')]:_0x98ff('0xe4'),'createdAt':moment(_0x5874a1['createdAt'])['format'](_0x98ff('0xcb'))['toString'](),'closedAt':_0x5874a1['closed']?moment(_0x5874a1['closedAt'])[_0x98ff('0xca')](_0x98ff('0xcb'))[_0x98ff('0x9f')]():'','disposition':_0x5874a1[_0x98ff('0xe5')],'messages':_(_0x5874a1[_0x98ff('0xe6')])['filter']({'secret':![]})[_0x98ff('0x31')](function(_0x13e34b){if(_0x13e34b[_0x98ff('0xdd')]){var _0x3895df=path[_0x98ff('0xd7')](_0x2074b8,_0x13e34b[_0x98ff('0xdd')]['basename']);if(fs[_0x98ff('0xe7')](_0x3895df)){fs['createReadStream'](_0x3895df)['pipe'](fs[_0x98ff('0xe8')](path['join'](_0x6a47d0,_0x13e34b[_0x98ff('0xdd')][_0x98ff('0xe9')])));}}return{'date':moment(_0x13e34b['createdAt'])[_0x98ff('0xca')](_0x98ff('0xcb'))[_0x98ff('0x9f')](),'sender':_0x13e34b[_0x98ff('0xea')]===_0x98ff('0xeb')?_0x13e34b[_0x98ff('0x70')]?_0x13e34b[_0x98ff('0x70')]['fullname']:_0x98ff('0xec'):_0x13e34b[_0x98ff('0xed')][_0x98ff('0xdb')]+(_0x13e34b[_0x98ff('0xed')][_0x98ff('0xdc')]?'\x20'+_0x13e34b[_0x98ff('0xed')]['lastName']:''),'body':_0x13e34b[_0x98ff('0xdd')]?_0x13e34b['Attachment'][_0x98ff('0xe9')]:_0x13e34b[_0x98ff('0x75')],'direction':_0x13e34b[_0x98ff('0xea')]==='out'?'A':'C','secret':_0x13e34b['secret'],'read':_0x13e34b[_0x98ff('0x80')],'attachment':_0x13e34b[_0x98ff('0xdd')]};})[_0x98ff('0x60')]()};return ejs[_0x98ff('0xee')](path['join'](config[_0x98ff('0xd3')],_0x98ff('0xd4'),_0x98ff('0xef'),'downloadInteraction.ejs'),{'interaction':_0x5619ec})[_0x98ff('0x2b')](function(_0x2b5aa2){var _0x36ac43=path[_0x98ff('0xd7')](_0x6a47d0,_0x98ff('0xf0')+_0x5874a1['id']+'-'+_0x25545b+_0x98ff('0xf1'));var _0x36ad0f={'path':_0x36ac43,'channel':_0x98ff('0xe3'),'interactionId':_0x5874a1['id']};return pdf[_0x98ff('0xf2')](_0x2b5aa2,_0x36ad0f);})[_0x98ff('0x2b')](function(){return new BPromise(function(_0x3fe57d,_0x5604c1){zipdir(_0x6a47d0,{'saveTo':_0x7c6fa1},function(_0x5cd2ee,_0x219623){if(_0x5cd2ee)return _0x5604c1(_0x5cd2ee);return _0x3fe57d(_0x219623);});})[_0x98ff('0x2b')](function(){return new BPromise(function(_0x202851,_0x135d03){rimraf(_0x6a47d0,function(_0x25135b){if(_0x25135b)_0x135d03(_0x25135b);return _0x202851();});});})[_0x98ff('0x2b')](function(){return _0x1e3bba[_0x98ff('0xf3')](_0x7c6fa1,_0xc8843c,function(_0x3f9e05){if(_0x3f9e05){console['log'](_0x98ff('0xf4'),_0x3f9e05);}else{fs[_0x98ff('0xf5')](_0x7c6fa1);}});});});}else{return _0x1e3bba[_0x98ff('0x1f')](0xc8);}})[_0x98ff('0x37')](handleError(_0x1e3bba,null));}; \ No newline at end of file +var _0x8406=['transcript-%d-%s.zip','User','CmContact','firstName','lastName','Attachment','secret','Account','Owner','get','mkdirSync','Whatsapp','N.A.','createdAt','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','out','direction','views','downloadInteraction.ejs','transcript-','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','error','name','map','fullname','TagIds','Tags','split','forEach','push','catch','index','WhatsappInteraction','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','from','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','whatsapp_accounts','me.WhatsappInteractionId\x20=\x20i.id','it.WhatsappInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20>\x200','Contact','operator','$substring','value','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','end','Tag','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','WhatsappAccountId','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','params','includeAll','options','create','describe','addMessage','WhatsappMessage','omit','ids','getMessages','findOne','findAll','addTags','setTags','color','emit','download','join','root','server','files','tmp','attachments','format'];(function(_0x4522f4,_0x3d2bfb){var _0x5ae9fe=function(_0x14936a){while(--_0x14936a){_0x4522f4['push'](_0x4522f4['shift']());}};_0x5ae9fe(++_0x3d2bfb);}(_0x8406,0x10c));var _0x6840=function(_0x5b4ea6,_0x2b6367){_0x5b4ea6=_0x5b4ea6-0x0;var _0x145159=_0x8406[_0x5b4ea6];return _0x145159;};'use strict';var emlformat=require(_0x6840('0x0'));var rimraf=require(_0x6840('0x1'));var zipdir=require(_0x6840('0x2'));var jsonpatch=require(_0x6840('0x3'));var rp=require(_0x6840('0x4'));var moment=require(_0x6840('0x5'));var BPromise=require(_0x6840('0x6'));var Mustache=require(_0x6840('0x7'));var util=require('util');var path=require(_0x6840('0x8'));var sox=require(_0x6840('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6840('0xa'));var _=require(_0x6840('0xb'));var squel=require(_0x6840('0xc'));var crypto=require(_0x6840('0xd'));var jsforce=require(_0x6840('0xe'));var deskjs=require(_0x6840('0xf'));var toCsv=require(_0x6840('0x10'));var querystring=require('querystring');var Papa=require(_0x6840('0x11'));var Redis=require('ioredis');var authService=require(_0x6840('0x12'));var qs=require(_0x6840('0x13'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x6840('0x14'));var hardwareService=require(_0x6840('0x15'));var logger=require(_0x6840('0x16'))('api');var utils=require(_0x6840('0x17'));var config=require(_0x6840('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x6840('0x19'))['db'];config[_0x6840('0x1a')]=_[_0x6840('0x1b')](config[_0x6840('0x1a')],{'host':_0x6840('0x1c'),'port':0x18eb});var socket=require(_0x6840('0x1d'))(new Redis(config[_0x6840('0x1a')]));require(_0x6840('0x1e'))[_0x6840('0x1f')](socket);function respondWithStatusCode(_0x348244,_0x5a154a){_0x5a154a=_0x5a154a||0xcc;return function(_0x349faa){if(_0x349faa){return _0x348244[_0x6840('0x20')](_0x5a154a);}return _0x348244[_0x6840('0x21')](_0x5a154a)['end']();};}function respondWithResult(_0x261295,_0x45e5cf){_0x45e5cf=_0x45e5cf||0xc8;return function(_0x16c89d){if(_0x16c89d){return _0x261295[_0x6840('0x21')](_0x45e5cf)[_0x6840('0x22')](_0x16c89d);}};}function respondWithFilteredResult(_0x528a24,_0x72b8f2){return function(_0x17f34d){if(_0x17f34d){var _0x39d2e=typeof _0x72b8f2[_0x6840('0x23')]===_0x6840('0x24')&&typeof _0x72b8f2['limit']===_0x6840('0x24');var _0x22f450=_0x17f34d[_0x6840('0x25')];var _0x46c0df=_0x39d2e?0x0:_0x72b8f2[_0x6840('0x23')];var _0x288529=_0x39d2e?_0x17f34d[_0x6840('0x25')]:_0x72b8f2[_0x6840('0x23')]+_0x72b8f2[_0x6840('0x26')];var _0x148652;if(_0x288529>=_0x22f450){_0x288529=_0x22f450;_0x148652=0xc8;}else{_0x148652=0xce;}_0x528a24[_0x6840('0x21')](_0x148652);return _0x528a24[_0x6840('0x27')]('Content-Range',_0x46c0df+'-'+_0x288529+'/'+_0x22f450)[_0x6840('0x22')](_0x17f34d);}return null;};}function patchUpdates(_0x5ea693){return function(_0x51d9d4){try{jsonpatch[_0x6840('0x28')](_0x51d9d4,_0x5ea693,!![]);}catch(_0xdb9751){return BPromise[_0x6840('0x29')](_0xdb9751);}return _0x51d9d4['save']();};}function saveUpdates(_0x4f08c8,_0x2f129f){return function(_0x6a35dc){if(_0x6a35dc){return _0x6a35dc[_0x6840('0x2a')](_0x4f08c8)[_0x6840('0x2b')](function(_0x4ccd94){return _0x4ccd94;});}return null;};}function removeEntity(_0x5bd3e8,_0x3eb2a7){return function(_0x46e8db){if(_0x46e8db){return _0x46e8db[_0x6840('0x2c')]()[_0x6840('0x2b')](function(){_0x5bd3e8[_0x6840('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c5135,_0x4cc982){return function(_0x5d5317){if(!_0x5d5317){_0x4c5135['sendStatus'](0x194);}return _0x5d5317;};}function handleError(_0x4f309f,_0x264028){_0x264028=_0x264028||0x1f4;return function(_0x32fa2e){logger[_0x6840('0x2d')](_0x32fa2e['stack']);if(_0x32fa2e[_0x6840('0x2e')]){delete _0x32fa2e['name'];}_0x4f309f['status'](_0x264028)['send'](_0x32fa2e);};}function getInteractionUsers(_0x553b55,_0x474c80){return new BPromise(function(_0x486e45,_0x551584){try{if(_0x474c80[_0x553b55['id']]){_0x553b55['Users']=_[_0x6840('0x2f')](_0x474c80[_0x553b55['id']],function(_0xd08b16){return{'id':_0xd08b16['id'],'fullname':_0xd08b16[_0x6840('0x30')]};});}}catch(_0x296292){_0x551584(_0x296292);}_0x486e45(_0x553b55);});}function getInteractionTags(_0x4b14e1,_0x3aa666){return new BPromise(function(_0xa259b8,_0x5b996a){try{if(_0x4b14e1[_0x6840('0x31')]){_0x4b14e1[_0x6840('0x32')]=[];_0x4b14e1[_0x6840('0x31')][_0x6840('0x33')](',')[_0x6840('0x34')](function(_0x1f7c2e){_0x4b14e1['Tags'][_0x6840('0x35')](_0x3aa666[_0x1f7c2e]);});}delete _0x4b14e1['TagIds'];}catch(_0x2fd9b7){_0x5b996a(_0x2fd9b7);}_0xa259b8(_0x4b14e1);});}function updateWhatsappInteraction(_0x36186d,_0x5c2038,_0x1a4478){return new BPromise(function(_0x2cf1f8,_0x44d472){return getInteractionUsers(_0x36186d,_0x1a4478)[_0x6840('0x2b')](function(_0x27fc7d){return getInteractionTags(_0x27fc7d,_0x5c2038);})['then'](function(_0x21fb00){_0x2cf1f8(_0x21fb00);})[_0x6840('0x36')](function(_0x25118a){_0x44d472(_0x25118a);});});}exports[_0x6840('0x37')]=function(_0x27df55,_0x51e58f){var _0x322a96={},_0x367d4a={},_0x573d21={'count':0x0,'rows':[]};var _0x312096=_[_0x6840('0x2f')](db[_0x6840('0x38')][_0x6840('0x39')],function(_0xc8ba9a){return{'name':_0xc8ba9a[_0x6840('0x3a')],'type':_0xc8ba9a[_0x6840('0x3b')][_0x6840('0x3c')]};});_0x367d4a[_0x6840('0x3d')]=_['map'](_0x312096,_0x6840('0x2e'));_0x367d4a['query']=_[_0x6840('0x3e')](_0x27df55['query']);_0x367d4a[_0x6840('0x3f')]=_[_0x6840('0x40')](_0x367d4a[_0x6840('0x3d')],_0x367d4a[_0x6840('0x41')]);_0x322a96[_0x6840('0x42')]=_[_0x6840('0x40')](_0x367d4a[_0x6840('0x3d')],qs['fields'](_0x27df55['query'][_0x6840('0x43')]));_0x322a96[_0x6840('0x42')]=_0x322a96[_0x6840('0x42')][_0x6840('0x44')]?_0x322a96[_0x6840('0x42')]:_0x367d4a[_0x6840('0x3d')];if(!_0x27df55[_0x6840('0x41')][_0x6840('0x45')](_0x6840('0x46'))){_0x322a96['limit']=qs['limit'](_0x27df55[_0x6840('0x41')]['limit']);_0x322a96[_0x6840('0x23')]=qs[_0x6840('0x23')](_0x27df55[_0x6840('0x41')][_0x6840('0x23')]);}_0x322a96[_0x6840('0x47')]=qs[_0x6840('0x48')](_0x27df55[_0x6840('0x41')][_0x6840('0x48')]);_0x322a96[_0x6840('0x49')]=qs[_0x6840('0x3f')](_[_0x6840('0x4a')](_0x27df55['query'],_0x367d4a[_0x6840('0x3f')]),_0x312096);var _0xaa5e40=[];var _0x246628=squel[_0x6840('0x4b')]()['field']('id')[_0x6840('0x4c')](_0x6840('0x2e'))[_0x6840('0x4c')]('color')[_0x6840('0x4d')](_0x6840('0x4e'));var _0x1b2ca0=squel[_0x6840('0x4b')]()['field'](_0x6840('0x4f'))['field'](_0x6840('0x50'))['field'](_0x6840('0x51'))[_0x6840('0x4d')](_0x6840('0x52'),'ui')[_0x6840('0x53')](_0x6840('0x54'),'u',_0x6840('0x55'));var _0x283375=squel[_0x6840('0x4b')]()[_0x6840('0x4d')](_0x6840('0x56'),'i')[_0x6840('0x53')](_0x6840('0x57'),'c',_0x6840('0x58'))[_0x6840('0x53')]('users','o','o.id\x20=\x20i.UserId')['left_join'](_0x6840('0x59'),'a','a.id\x20=\x20i.WhatsappAccountId')['left_join']('whatsapp_messages','me',_0x6840('0x5a'))[_0x6840('0x53')]('whatsapp_interaction_has_tags','it',_0x6840('0x5b'))[_0x6840('0x53')](_0x6840('0x4e'),'t','t.id\x20=\x20it.TagId');var _0x385f14=squel[_0x6840('0x5c')]();var _0x3a4834=[];var _0x27605b=squel[_0x6840('0x5c')]();var _0x4e1a00;if(_0x27df55['query'][_0x6840('0x5d')]){_0x4e1a00=as[_0x6840('0x5e')](_0x27df55[_0x6840('0x41')][_0x6840('0x5d')]);var _0x145054=_0x4e1a00[_0x6840('0x5f')];for(var _0x4f7eea=0x0;_0x4f7eea<_0x4e1a00[_0x6840('0x60')][_0x6840('0x44')];_0x4f7eea++){var _0x5499f7=_0x4e1a00[_0x6840('0x60')][_0x4f7eea];var _0x39ee8d='i';var _0x4ab45a=_[_0x6840('0x61')](_0x312096,[_0x6840('0x2e'),_0x5499f7[_0x6840('0x4c')]]);if(!_0x4ab45a){switch(_0x5499f7['field']){case _0x6840('0x62'):if(_0x5499f7['value']==0x1){_0x283375[_0x6840('0x63')]('`'+_0x5499f7[_0x6840('0x4c')]+'`\x20=\x200');}else{_0x283375['having']('`'+_0x5499f7[_0x6840('0x4c')]+_0x6840('0x64'));}break;case _0x6840('0x65'):if(_0x5499f7[_0x6840('0x66')]===_0x6840('0x67')){if(_0x5499f7[_0x6840('0x68')][_0x6840('0x33')]('\x20')[_0x6840('0x44')]>0x1){_0x385f14[_0x145054]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x6840('0x69')](_0x5499f7[_0x6840('0x68')]),null);}else{var _0x57ea45='%'+_0x5499f7['value']+'%';_0x385f14[_0x145054](_0x6840('0x6a'),_0x57ea45,_0x57ea45,_0x57ea45);}}else{_0x4ab45a=_['find'](_0x312096,[_0x6840('0x2e'),_0x6840('0x6b')]);_0x5499f7['field']=_0x6840('0x6b');_0x302a27=as[_0x6840('0x6c')](_0x39ee8d,_0x4ab45a[_0x6840('0x3b')],_0x5499f7);_0x385f14[_0x145054](_0x302a27[_0x6840('0x6d')],_0x302a27[_0x6840('0x68')][_0x6840('0x6e')],_0x302a27['value'][_0x6840('0x6f')]);}break;case _0x6840('0x70'):var _0x500cdb=_0x5499f7[_0x6840('0x68')][_0x6840('0x33')](',')[_0x6840('0x2f')](function(_0x6200c8){return Number(_0x6200c8);});_0x500cdb['forEach'](function(_0x1bfc9f){_0x27605b['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1bfc9f+',%');});_0x3a4834=_['union'](_0x3a4834,_0x500cdb);break;case'User':if(_0x5499f7[_0x6840('0x66')]===_0x6840('0x67')){_0x385f14[_0x145054](_0x6840('0x71'),'%'+_0x5499f7[_0x6840('0x68')]+'%',null);}else{_0x4ab45a=_[_0x6840('0x61')](_0x312096,[_0x6840('0x2e'),'UserId']);_0x5499f7['field']=_0x6840('0x72');_0x302a27=as['buildExpression'](_0x39ee8d,_0x4ab45a[_0x6840('0x3b')],_0x5499f7);_0x385f14[_0x145054](_0x302a27[_0x6840('0x6d')],_0x302a27[_0x6840('0x68')][_0x6840('0x6e')],_0x302a27[_0x6840('0x68')][_0x6840('0x6f')]);}break;case _0x6840('0x73'):_0x302a27=as[_0x6840('0x6c')]('me',null,_0x5499f7);_0x385f14[_0x145054](_0x302a27[_0x6840('0x6d')],_0x302a27[_0x6840('0x68')][_0x6840('0x6e')],_0x302a27[_0x6840('0x68')][_0x6840('0x6f')]);break;}}else{var _0x302a27=as['buildExpression'](_0x39ee8d,_0x4ab45a['type'],_0x5499f7);_0x385f14[_0x145054](_0x302a27[_0x6840('0x6d')],_0x302a27[_0x6840('0x68')][_0x6840('0x6e')],_0x302a27[_0x6840('0x68')][_0x6840('0x6f')]);}}}else{var _0x3e6ad3=_(_0x27df55[_0x6840('0x41')])[_0x6840('0x3e')]()[_0x6840('0x2f')](function(_0x34f771){return _['some'](_0x312096,[_0x6840('0x2e'),_0x34f771])?_0x34f771:undefined;})['compact']()[_0x6840('0x68')]();if(!_['isEmpty'](_0x3e6ad3)){_0x3e6ad3[_0x6840('0x34')](function(_0x2267ea){if(_0x2267ea===_0x6840('0x74')){_0x283375[_0x6840('0x49')]('i.WhatsappAccountId\x20IN\x20?',[][_0x6840('0x75')](_0x27df55['query'][_0x2267ea]));}else if(_0x2267ea==='createdAt'){var _0x2cc27b=JSON[_0x6840('0x76')](_0x27df55[_0x6840('0x41')][_0x2267ea])[_0x6840('0x77')];var _0x30e28b=JSON['parse'](_0x27df55['query'][_0x2267ea])[_0x6840('0x78')];_0x283375[_0x6840('0x49')](_0x6840('0x79'),_0x2cc27b,_0x30e28b);}else{if(_0x27df55[_0x6840('0x41')][_0x2267ea]===_0x6840('0x7a')){_0x283375[_0x6840('0x49')]('i.'+_0x2267ea+_0x6840('0x7b'));}else{_0x283375[_0x6840('0x49')]('i.'+_0x2267ea+_0x6840('0x7c'),_0x27df55['query'][_0x2267ea]);}}});}if(_0x27df55[_0x6840('0x41')][_0x6840('0x7d')]){if(_0x27df55[_0x6840('0x41')][_0x6840('0x7d')]==0x1){_0x283375[_0x6840('0x63')]('`unreadMessages`\x20=\x200');}else{_0x283375['having'](_0x6840('0x7e'));}}if(_0x27df55['query']['tag']){_0x3a4834=_[_0x6840('0x7f')](_0x27df55[_0x6840('0x41')]['tag'])?_0x27df55[_0x6840('0x41')]['tag']:new Array(_0x27df55['query'][_0x6840('0x80')]);_0x3a4834['forEach'](function(_0x43cf75){_0x27605b['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x43cf75+',%');});}if(_0x27df55[_0x6840('0x41')][_0x6840('0x81')]){var _0x561b2f=_0x27df55[_0x6840('0x41')]['filter'][_0x6840('0x82')]('\x5c','\x5c\x5c')[_0x6840('0x82')](/'/g,'\x27\x27');if(qs[_0x6840('0x83')](_0x561b2f)){_0x385f14['or'](_0x6840('0x84'),_0x561b2f+'%')['or'](_0x6840('0x85'),_0x561b2f+'%');}else{_0x385f14['or'](_0x6840('0x86'),qs['getFullTextValue'](_0x561b2f))['or'](_0x6840('0x87'),_0x561b2f+'%');}}}_0x283375[_0x6840('0x49')](_0x385f14);_0x283375[_0x6840('0x88')](_0x6840('0x89'));var _0x375b6e={'type':db[_0x6840('0x8a')][_0x6840('0x8b')][_0x6840('0x8c')],'raw':!![]};var _0x2caf66=_0x283375[_0x6840('0x8d')]();_0x2caf66[_0x6840('0x4c')](_0x6840('0x89'));_0x2caf66[_0x6840('0x4c')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x6840('0x62'));if(_0x322a96[_0x6840('0x47')]){_0x322a96[_0x6840('0x47')][_0x6840('0x34')](function(_0x2ec5d0){var _0x1bf8bb=_0x2ec5d0[0x0]==='contactName'?_0x2ec5d0[0x0]:'i.'+_0x2ec5d0[0x0];_0x283375['order'](_0x1bf8bb,_0x2ec5d0[0x1]===_0x6840('0x8e')?![]:!![]);});}if(!_[_0x6840('0x8f')](_0x3a4834)){_0x283375[_0x6840('0x63')](_0x27605b);_0x2caf66[_0x6840('0x49')](_0x6840('0x90'),_0x3a4834);}BPromise[_0x6840('0x91')]()[_0x6840('0x2b')](function(){if(!_0x4e1a00){if(_0x27df55[_0x6840('0x41')]['WhatsappAccountId'])return;_0x2caf66[_0x6840('0x49')](_0x6840('0x92'));_0x283375[_0x6840('0x49')](_0x6840('0x92'));return;}if(_0x27df55[_0x6840('0x93')][_0x6840('0x94')]!==_0x6840('0x95'))return;return _0x27df55[_0x6840('0x93')][_0x6840('0x96')]({'attributes':['id'],'raw':!![]})[_0x6840('0x2b')](function(_0x52f269){if(_[_0x6840('0x8f')](_0x52f269)){_0x2caf66[_0x6840('0x49')](_0x6840('0x97'));_0x283375[_0x6840('0x49')](_0x6840('0x97'));}else{_0x2caf66[_0x6840('0x49')](_0x6840('0x98'),_[_0x6840('0x2f')](_0x52f269,'id'));_0x283375[_0x6840('0x49')](_0x6840('0x98'),_['map'](_0x52f269,'id'));}});})['then'](function(){if(_0x27df55[_0x6840('0x93')][_0x6840('0x94')]===_0x6840('0x95')&&!_0x4e1a00&&!_0x27df55[_0x6840('0x41')][_0x6840('0x74')])return[];return db[_0x6840('0x99')][_0x6840('0x41')](_0x2caf66['toString'](),_0x375b6e);})[_0x6840('0x2b')](function(_0x1ad133){_0x573d21[_0x6840('0x25')]=_0x1ad133[_0x6840('0x44')];if(_0x573d21[_0x6840('0x25')]===0x0)return[];return db[_0x6840('0x99')]['query'](_0x246628[_0x6840('0x9a')](),_0x375b6e)[_0x6840('0x2b')](function(_0x52df21){_0xaa5e40=_[_0x6840('0x9b')](_0x52df21,'id');_0x375b6e=_[_0x6840('0x9c')](_0x375b6e,{'model':db[_0x6840('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x27df55[_0x6840('0x41')][_0x6840('0x43')]){_0x322a96[_0x6840('0x42')][_0x6840('0x34')](function(_0xbd6b93){_0x283375[_0x6840('0x4c')]('i.'+_0xbd6b93);});}else{_0x283375[_0x6840('0x4c')](_0x6840('0x9d'),_0x6840('0x62'));_0x283375[_0x6840('0x4c')](_0x6840('0x9e'),_0x6840('0x9f'));_0x283375[_0x6840('0x4c')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x283375[_0x6840('0x4c')](_0x6840('0xa0'),'contactName');_0x283375[_0x6840('0x4c')](_0x6840('0xa1'));_0x283375[_0x6840('0x4c')](_0x6840('0xa2'),_0x6840('0xa3'));_0x283375['field'](_0x6840('0xa4'),_0x6840('0xa5'));_0x283375['field'](_0x6840('0xa6'),_0x6840('0xa7'));_0x283375[_0x6840('0x4c')](_0x6840('0xa8'),_0x6840('0xa9'));_0x283375[_0x6840('0x4c')]('c.mobile',_0x6840('0xaa'));_0x283375['field'](_0x6840('0xab'),_0x6840('0xac'));_0x283375[_0x6840('0x4c')](_0x6840('0xad'),_0x6840('0xae'));_0x283375['field'](_0x6840('0xaf'),'Owner.internal');_0x283375[_0x6840('0x4c')](_0x6840('0xb0'),'TagIds');}if(_0x322a96[_0x6840('0x26')])_0x283375[_0x6840('0x26')](_0x322a96[_0x6840('0x26')]);if(_0x322a96[_0x6840('0x23')])_0x283375[_0x6840('0x23')](_0x322a96[_0x6840('0x23')]);return db[_0x6840('0x99')]['query'](_0x283375[_0x6840('0x9a')](),_0x375b6e);})[_0x6840('0x2b')](function(_0xc313fd){if(_0xc313fd[_0x6840('0x44')]>0x0)_0x1b2ca0[_0x6840('0x49')](_0x6840('0xb1'),_[_0x6840('0x2f')](_0xc313fd,'id'));return db[_0x6840('0x99')][_0x6840('0x41')](_0x1b2ca0[_0x6840('0x9a')](),_0x375b6e)[_0x6840('0x2b')](function(_0x22291b){var _0x5935be=_[_0x6840('0xb2')](_0x22291b,_0x6840('0xb3'));var _0x219b3d=[];_0xc313fd[_0x6840('0x34')](function(_0x186446){_0x219b3d[_0x6840('0x35')](updateWhatsappInteraction(_0x186446,_0xaa5e40,_0x5935be));});return BPromise[_0x6840('0xb4')](_0x219b3d);});});})[_0x6840('0x2b')](function(_0x5e6680){_0x573d21[_0x6840('0xb5')]=_0x5e6680;return _0x573d21;})['then'](respondWithFilteredResult(_0x51e58f,_0x322a96))[_0x6840('0x36')](handleError(_0x51e58f,null));};exports['show']=function(_0x2370df,_0x830647){var _0x16df32={'raw':![],'where':{'id':_0x2370df[_0x6840('0xb6')]['id']}},_0x1f56ec={};_0x1f56ec[_0x6840('0x3d')]=_[_0x6840('0x3e')](db[_0x6840('0x38')][_0x6840('0x39')]);_0x1f56ec[_0x6840('0x41')]=_['keys'](_0x2370df[_0x6840('0x41')]);_0x1f56ec[_0x6840('0x3f')]=_[_0x6840('0x40')](_0x1f56ec['model'],_0x1f56ec['query']);_0x16df32['attributes']=_['intersection'](_0x1f56ec[_0x6840('0x3d')],qs['fields'](_0x2370df[_0x6840('0x41')]['fields']));_0x16df32[_0x6840('0x42')]=_0x16df32[_0x6840('0x42')][_0x6840('0x44')]?_0x16df32[_0x6840('0x42')]:_0x1f56ec[_0x6840('0x3d')];if(_0x2370df['query'][_0x6840('0xb7')]){_0x16df32['include']=[{'all':!![]}];}_0x16df32=_['merge']({},_0x16df32,_0x2370df[_0x6840('0xb8')]);return db[_0x6840('0x38')][_0x6840('0x61')](_0x16df32)[_0x6840('0x2b')](handleEntityNotFound(_0x830647,null))[_0x6840('0x2b')](respondWithResult(_0x830647,null))['catch'](handleError(_0x830647,null));};exports[_0x6840('0xb9')]=function(_0x2e9722,_0x51d006){return db['WhatsappInteraction'][_0x6840('0xb9')](_0x2e9722[_0x6840('0x73')],{})[_0x6840('0x2b')](respondWithResult(_0x51d006,0xc9))[_0x6840('0x36')](handleError(_0x51d006,null));};exports[_0x6840('0x2a')]=function(_0x1eee7b,_0x3a34c2){if(_0x1eee7b[_0x6840('0x73')]['id']){delete _0x1eee7b[_0x6840('0x73')]['id'];}return db['WhatsappInteraction'][_0x6840('0x61')]({'where':{'id':_0x1eee7b[_0x6840('0xb6')]['id']}})[_0x6840('0x2b')](handleEntityNotFound(_0x3a34c2,null))[_0x6840('0x2b')](saveUpdates(_0x1eee7b[_0x6840('0x73')],null))[_0x6840('0x2b')](respondWithResult(_0x3a34c2,null))[_0x6840('0x36')](handleError(_0x3a34c2,null));};exports['destroy']=function(_0x4438f4,_0x30ec9c){return db[_0x6840('0x38')][_0x6840('0x61')]({'where':{'id':_0x4438f4[_0x6840('0xb6')]['id']}})[_0x6840('0x2b')](handleEntityNotFound(_0x30ec9c,null))['then'](removeEntity(_0x30ec9c,null))[_0x6840('0x36')](handleError(_0x30ec9c,null));};exports[_0x6840('0xba')]=function(_0x4f49ca,_0x3ceb6b){return db['WhatsappInteraction'][_0x6840('0xba')]()[_0x6840('0x2b')](respondWithResult(_0x3ceb6b,null))[_0x6840('0x36')](handleError(_0x3ceb6b,null));};exports[_0x6840('0xbb')]=function(_0x3c9986,_0x52764f,_0x1459ef){return db[_0x6840('0xbc')][_0x6840('0x61')]({'where':{'id':_0x3c9986[_0x6840('0xb6')]['id']}})[_0x6840('0x2b')](handleEntityNotFound(_0x52764f,null))[_0x6840('0x2b')](function(_0x1d1c8f){if(_0x1d1c8f){return _0x1d1c8f[_0x6840('0xbb')](_0x3c9986['body']['ids'],_[_0x6840('0xbd')](_0x3c9986[_0x6840('0x73')],[_0x6840('0xbe'),'id'])||{});}})[_0x6840('0x2b')](respondWithResult(_0x52764f,null))[_0x6840('0x36')](handleError(_0x52764f,null));};exports[_0x6840('0xbf')]=function(_0xbe3156,_0x140059,_0x34542d){var _0x41a6d3={'raw':![],'where':{}};var _0x241611={};var _0x403fb2={'count':0x0,'rows':[]};return db[_0x6840('0x38')][_0x6840('0xc0')]({'where':{'id':_0xbe3156['params']['id']}})[_0x6840('0x2b')](handleEntityNotFound(_0x140059,null))[_0x6840('0x2b')](function(_0x10c980){if(_0x10c980){_0x241611[_0x6840('0x3d')]=_['keys'](db[_0x6840('0xbc')][_0x6840('0x39')]);_0x241611[_0x6840('0x41')]=_[_0x6840('0x3e')](_0xbe3156[_0x6840('0x41')]);_0x241611['filters']=_[_0x6840('0x40')](_0x241611['model'],_0x241611['query']);_0x41a6d3[_0x6840('0x42')]=_['intersection'](_0x241611[_0x6840('0x3d')],qs['fields'](_0xbe3156[_0x6840('0x41')]['fields']));_0x41a6d3[_0x6840('0x42')]=_0x41a6d3[_0x6840('0x42')]['length']?_0x41a6d3[_0x6840('0x42')]:_0x241611['model'];if(!_0xbe3156['query'][_0x6840('0x45')](_0x6840('0x46'))){_0x41a6d3[_0x6840('0x26')]=qs[_0x6840('0x26')](_0xbe3156[_0x6840('0x41')][_0x6840('0x26')]);_0x41a6d3[_0x6840('0x23')]=qs[_0x6840('0x23')](_0xbe3156['query']['offset']);}_0x41a6d3[_0x6840('0x47')]=qs[_0x6840('0x48')](_0xbe3156[_0x6840('0x41')][_0x6840('0x48')]);_0x41a6d3[_0x6840('0x49')]=qs[_0x6840('0x3f')](_[_0x6840('0x4a')](_0xbe3156[_0x6840('0x41')],_0x241611['filters']));_0x41a6d3[_0x6840('0x49')][_0x6840('0xb3')]=_0x10c980['id'];if(_0xbe3156[_0x6840('0x41')][_0x6840('0x81')]){_0x41a6d3[_0x6840('0x49')]=_[_0x6840('0x9c')](_0x41a6d3[_0x6840('0x49')],{'$or':_['map'](_0x41a6d3[_0x6840('0x42')],function(_0x3edcf8){var _0x44837b={};_0x44837b[_0x3edcf8]={'$like':'%'+_0xbe3156[_0x6840('0x41')][_0x6840('0x81')]+'%'};return _0x44837b;})});}if(_0xbe3156[_0x6840('0x41')][_0x6840('0x77')]){var _0x3cb97d=_0xbe3156[_0x6840('0x41')][_0x6840('0x77')][_0x6840('0x33')](',');var _0x5d1b7b={};_0x5d1b7b[_0x3cb97d[0x0]]={'$gte':moment(_0x3cb97d[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x41a6d3[_0x6840('0x49')]=_[_0x6840('0x9c')](_0x41a6d3[_0x6840('0x49')],_0x5d1b7b);}_0x41a6d3=_[_0x6840('0x9c')]({},_0x41a6d3,_0xbe3156[_0x6840('0xb8')]);return db['WhatsappMessage']['count']({'where':_0x41a6d3[_0x6840('0x49')]})['then'](function(_0x36f740){_0x403fb2[_0x6840('0x25')]=_0x36f740;if(_0xbe3156[_0x6840('0x41')][_0x6840('0xb7')]){_0x41a6d3['include']=[{'all':!![]}];}return db[_0x6840('0xbc')][_0x6840('0xc1')](_0x41a6d3);})[_0x6840('0x2b')](function(_0x52c656){_0x403fb2[_0x6840('0xb5')]=_0x52c656;return _0x403fb2;});}})[_0x6840('0x2b')](respondWithFilteredResult(_0x140059,_0x41a6d3))[_0x6840('0x36')](handleError(_0x140059,null));};exports[_0x6840('0xc2')]=function(_0x29f8a2,_0x2a5e02,_0x2c548b){return db[_0x6840('0x38')][_0x6840('0x61')]({'where':{'id':_0x29f8a2[_0x6840('0xb6')]['id']}})[_0x6840('0x2b')](handleEntityNotFound(_0x2a5e02,null))[_0x6840('0x2b')](function(_0x196bea){if(_0x196bea){return _0x196bea[_0x6840('0xc3')](_0x29f8a2[_0x6840('0x73')]['ids'],_[_0x6840('0xbd')](_0x29f8a2[_0x6840('0x73')],[_0x6840('0xbe'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0x6840('0x2e'),_0x6840('0xc4')],'where':{'id':_0x29f8a2['body'][_0x6840('0xbe')]}});})[_0x6840('0x2b')](function(_0x2adf55){socket[_0x6840('0xc5')]('whatsappInteractionTags:save',{'id':Number(_0x29f8a2[_0x6840('0xb6')]['id']),'tags':_0x2adf55||[]});return{'id':Number(_0x29f8a2[_0x6840('0xb6')]['id']),'tags':_0x2adf55||[]};});}})[_0x6840('0x2b')](respondWithResult(_0x2a5e02,null))[_0x6840('0x36')](handleError(_0x2a5e02,null));};exports['removeTags']=function(_0x566de0,_0x1f0cf7,_0x2597e7){return db[_0x6840('0x38')][_0x6840('0x61')]({'where':{'id':_0x566de0['params']['id']}})[_0x6840('0x2b')](handleEntityNotFound(_0x1f0cf7,null))['then'](function(_0x21fa36){if(_0x21fa36){return _0x21fa36['removeTags'](_0x566de0[_0x6840('0x41')][_0x6840('0xbe')]);}})[_0x6840('0x2b')](respondWithStatusCode(_0x1f0cf7,null))[_0x6840('0x36')](handleError(_0x1f0cf7,null));};exports[_0x6840('0xc6')]=function(_0x34414b,_0x1e7cd8){var _0x5ae09b=moment()['unix']()['toString']();var _0x2d4821=path[_0x6840('0xc7')](config[_0x6840('0xc8')],_0x6840('0xc9'),_0x6840('0xca'),_0x6840('0xcb'));var _0xaad60=path[_0x6840('0xc7')](config['root'],'server',_0x6840('0xca'),_0x6840('0xcc'));var _0x49ebbf=path['join'](_0x2d4821,_0x5ae09b);var _0x288e19=util[_0x6840('0xcd')](_0x6840('0xce'),_0x34414b[_0x6840('0xb6')]['id'],_0x5ae09b);var _0x5bbdd7=path['join'](_0x2d4821,_0x288e19);var _0xf467f8=[];_0xf467f8[_0x6840('0x35')]({'model':db['User'],'as':_0x6840('0xcf'),'attributes':['id',_0x6840('0x30')],'raw':!![]});_0xf467f8[_0x6840('0x35')]({'model':db[_0x6840('0xd0')],'as':_0x6840('0x65'),'attributes':['id',_0x6840('0xd1'),_0x6840('0xd2')],'raw':!![]});if(_0x34414b['query'][_0x6840('0xcc')]){_0xf467f8[_0x6840('0x35')]({'model':db[_0x6840('0xd3')],'as':'Attachment','raw':!![]});}var _0x4c707c=[{'model':db[_0x6840('0xbc')],'as':'Messages','attributes':['id','body','createdAt','direction',_0x6840('0xd4'),'read'],'include':_0xf467f8}];_0x4c707c[_0x6840('0x35')]({'model':db['WhatsappAccount'],'as':_0x6840('0xd5'),'attributes':['id','name']});_0x4c707c[_0x6840('0x35')]({'model':db[_0x6840('0xcf')],'as':_0x6840('0xd6'),'attributes':['id',_0x6840('0x30')]});return db[_0x6840('0x38')][_0x6840('0x61')]({'where':{'id':_0x34414b[_0x6840('0xb6')]['id']},'include':_0x4c707c})[_0x6840('0x2b')](handleEntityNotFound(_0x1e7cd8,null))[_0x6840('0x2b')](function(_0x4b8f84){if(_0x4b8f84){var _0x1bf47f=_0x4b8f84[_0x6840('0xd7')]({'plain':!![]});fs[_0x6840('0xd8')](_0x49ebbf);var _0x3b55ae={'channel':_0x6840('0xd9'),'account':_0x1bf47f[_0x6840('0xd5')]['name'],'agent':_0x1bf47f[_0x6840('0xd6')]?_0x1bf47f['Owner']['fullname']:_0x6840('0xda'),'createdAt':moment(_0x1bf47f[_0x6840('0xdb')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x6840('0x9a')](),'closedAt':_0x1bf47f[_0x6840('0xdc')]?moment(_0x1bf47f[_0x6840('0xdd')])[_0x6840('0xcd')](_0x6840('0xde'))[_0x6840('0x9a')]():'','disposition':_0x1bf47f['disposition'],'messages':_(_0x1bf47f[_0x6840('0xdf')])[_0x6840('0x81')]({'secret':![]})[_0x6840('0x2f')](function(_0x45940a){if(_0x45940a[_0x6840('0xd3')]){var _0x30ed92=path[_0x6840('0xc7')](_0xaad60,_0x45940a[_0x6840('0xd3')][_0x6840('0xe0')]);if(fs[_0x6840('0xe1')](_0x30ed92)){fs[_0x6840('0xe2')](_0x30ed92)[_0x6840('0xe3')](fs[_0x6840('0xe4')](path[_0x6840('0xc7')](_0x49ebbf,_0x45940a[_0x6840('0xd3')]['basename'])));}}return{'date':moment(_0x45940a[_0x6840('0xdb')])['format'](_0x6840('0xde'))['toString'](),'sender':_0x45940a['direction']===_0x6840('0xe5')?_0x45940a[_0x6840('0xcf')]?_0x45940a[_0x6840('0xcf')][_0x6840('0x30')]:'System':_0x45940a['Contact'][_0x6840('0xd1')]+(_0x45940a[_0x6840('0x65')]['lastName']?'\x20'+_0x45940a[_0x6840('0x65')]['lastName']:''),'body':_0x45940a['Attachment']?_0x45940a['Attachment'][_0x6840('0xe0')]:_0x45940a['body'],'direction':_0x45940a[_0x6840('0xe6')]==='out'?'A':'C','secret':_0x45940a[_0x6840('0xd4')],'read':_0x45940a[_0x6840('0x7d')],'attachment':_0x45940a['Attachment']};})[_0x6840('0x68')]()};return ejs['renderFile'](path[_0x6840('0xc7')](config[_0x6840('0xc8')],_0x6840('0xc9'),_0x6840('0xe7'),_0x6840('0xe8')),{'interaction':_0x3b55ae})[_0x6840('0x2b')](function(_0x15cde2){var _0x3ee0dc=path[_0x6840('0xc7')](_0x49ebbf,_0x6840('0xe9')+_0x1bf47f['id']+'-'+_0x5ae09b+'.pdf');var _0x45028e={'path':_0x3ee0dc,'channel':'Whatsapp','interactionId':_0x1bf47f['id']};return pdf['createPdfFromHTML'](_0x15cde2,_0x45028e);})[_0x6840('0x2b')](function(){return new BPromise(function(_0x59bd8e,_0x62fc4c){zipdir(_0x49ebbf,{'saveTo':_0x5bbdd7},function(_0x47aaaa,_0x430f8d){if(_0x47aaaa)return _0x62fc4c(_0x47aaaa);return _0x59bd8e(_0x430f8d);});})[_0x6840('0x2b')](function(){return new BPromise(function(_0x4c44b6,_0x317b61){rimraf(_0x49ebbf,function(_0x2d602d){if(_0x2d602d)_0x317b61(_0x2d602d);return _0x4c44b6();});});})[_0x6840('0x2b')](function(){return _0x1e7cd8[_0x6840('0xc6')](_0x5bbdd7,_0x288e19,function(_0x5269cc){if(_0x5269cc){console[_0x6840('0xea')](_0x6840('0xeb'),_0x5269cc);}else{fs[_0x6840('0xec')](_0x5bbdd7);}});});});}else{return _0x1e7cd8[_0x6840('0x20')](0xc8);}})['catch'](handleError(_0x1e7cd8,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index bb663bd..5d36a1f 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 _0x1c8a=['map','findAll','length','emit','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','save','remove','getUsers','then','setDataValue','Users'];(function(_0x23fa4d,_0x5bd8f2){var _0x1a5b22=function(_0x3cf99a){while(--_0x3cf99a){_0x23fa4d['push'](_0x23fa4d['shift']());}};_0x1a5b22(++_0x5bd8f2);}(_0x1c8a,0x140));var _0xa1c8=function(_0x1507f6,_0x26269c){_0x1507f6=_0x1507f6-0x0;var _0x5991a7=_0x1c8a[_0x1507f6];return _0x5991a7;};'use strict';var EventEmitter=require(_0xa1c8('0x0'));var WhatsappInteraction=require(_0xa1c8('0x1'))['db'][_0xa1c8('0x2')];var WhatsappMessage=require(_0xa1c8('0x1'))['db'][_0xa1c8('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa1c8('0x4'),'afterUpdate':'update','afterDestroy':_0xa1c8('0x5')};function emitEvent(_0x1cdee0){return function(_0x4668e8,_0x559330,_0x331282){_0x4668e8[_0xa1c8('0x6')]({'attributes':['id'],'raw':!![]})[_0xa1c8('0x7')](function(_0x57d2d4){_0x4668e8[_0xa1c8('0x8')](_0xa1c8('0x9'),_0x57d2d4[_0xa1c8('0xa')](function(_0x4a5d71){return{'id':_0x4a5d71['id']};}));return WhatsappMessage[_0xa1c8('0xb')]({'where':{'WhatsappInteractionId':_0x4668e8['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa1c8('0x7')](function(_0x6e2ad7){_0x4668e8['setDataValue']('unreadMessages',_0x6e2ad7[_0xa1c8('0xc')]);WhatsappInteractionEvents['emit'](_0x1cdee0+':'+_0x4668e8['id'],_0x4668e8);WhatsappInteractionEvents[_0xa1c8('0xd')](_0x1cdee0,_0x4668e8);_0x331282(null);})['catch'](_0x331282(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xa1c8('0xe')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xde56=['events','WhatsappInteraction','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','unreadMessages','emit','catch','hasOwnProperty','exports'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0xde56,0x144));var _0x6de5=function(_0x3f3bad,_0x193f06){_0x3f3bad=_0x3f3bad-0x0;var _0x4f0801=_0xde56[_0x3f3bad];return _0x4f0801;};'use strict';var EventEmitter=require(_0x6de5('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0x6de5('0x1')];var WhatsappMessage=require(_0x6de5('0x2'))['db'][_0x6de5('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x6de5('0x4')](0x0);var events={'afterCreate':_0x6de5('0x5'),'afterUpdate':_0x6de5('0x6'),'afterDestroy':_0x6de5('0x7')};function emitEvent(_0x382a2a){return function(_0x20d71b,_0x22b78a,_0x4c65d1){_0x20d71b[_0x6de5('0x8')]({'attributes':['id'],'raw':!![]})[_0x6de5('0x9')](function(_0x27dcfe){_0x20d71b[_0x6de5('0xa')](_0x6de5('0xb'),_0x27dcfe[_0x6de5('0xc')](function(_0x570f37){return{'id':_0x570f37['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x20d71b['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6de5('0x9')](function(_0x3c7292){_0x20d71b[_0x6de5('0xa')](_0x6de5('0xd'),_0x3c7292['length']);WhatsappInteractionEvents[_0x6de5('0xe')](_0x382a2a+':'+_0x20d71b['id'],_0x20d71b);WhatsappInteractionEvents[_0x6de5('0xe')](_0x382a2a,_0x20d71b);_0x4c65d1(null);})[_0x6de5('0xf')](_0x4c65d1(null));};}for(var e in events){if(events[_0x6de5('0x10')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x6de5('0x11')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 065a946..58079dd 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 _0xe77e=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','whatsapp_interactions','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x5ad6b1,_0x426253){var _0x10c5a2=function(_0x4a2238){while(--_0x4a2238){_0x5ad6b1['push'](_0x5ad6b1['shift']());}};_0x10c5a2(++_0x426253);}(_0xe77e,0xc4));var _0xee77=function(_0x10ecc8,_0x2f7958){_0x10ecc8=_0x10ecc8-0x0;var _0x26b436=_0xe77e[_0x10ecc8];return _0x26b436;};'use strict';var _=require('lodash');var util=require(_0xee77('0x0'));var logger=require(_0xee77('0x1'))('api');var moment=require(_0xee77('0x2'));var BPromise=require(_0xee77('0x3'));var rp=require(_0xee77('0x4'));var fs=require('fs');var path=require(_0xee77('0x5'));var rimraf=require(_0xee77('0x6'));var config=require(_0xee77('0x7'));var attributes=require(_0xee77('0x8'));module[_0xee77('0x9')]=function(_0x320cef,_0x4c265c){return _0x320cef['define']('WhatsappInteraction',attributes,{'tableName':_0xee77('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4cb642,_0x209a0d,_0x5d2821){if(_0x4cb642['changed'](_0xee77('0xb'))){_0x4cb642[_0xee77('0xc')]=moment()['format'](_0xee77('0xd'));}_0x5d2821(null,_0x4cb642);}}});}; \ No newline at end of file +var _0x6ee2=['whatsapp_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction'];(function(_0x12669a,_0x1c5586){var _0x5ae6e2=function(_0x5e20a1){while(--_0x5e20a1){_0x12669a['push'](_0x12669a['shift']());}};_0x5ae6e2(++_0x1c5586);}(_0x6ee2,0x155));var _0x26ee=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0x6ee2[_0xa6cc5c];return _0x44803d;};'use strict';var _=require(_0x26ee('0x0'));var util=require(_0x26ee('0x1'));var logger=require(_0x26ee('0x2'))('api');var moment=require(_0x26ee('0x3'));var BPromise=require(_0x26ee('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x26ee('0x5'));var config=require(_0x26ee('0x6'));var attributes=require(_0x26ee('0x7'));module[_0x26ee('0x8')]=function(_0x10466e,_0x3d2e3b){return _0x10466e[_0x26ee('0x9')](_0x26ee('0xa'),attributes,{'tableName':_0x26ee('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4e87f8,_0x414d2c,_0x535544){if(_0x4e87f8['changed'](_0x26ee('0xc'))){_0x4e87f8[_0x26ee('0xd')]=moment()[_0x26ee('0xe')](_0x26ee('0xf'));}_0x535544(null,_0x4e87f8);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 726fc28..4fc908f 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 _0x2029=['AddTags','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','UpdateWhatsappInteraction','update','body','options','raw','where','attributes','stringify','WhatsappInteraction','find','addTags','ids','omit'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0x2029,0x1c9));var _0x9202=function(_0x12a224,_0x251044){_0x12a224=_0x12a224-0x0;var _0x244bac=_0x2029[_0x12a224];return _0x244bac;};'use strict';var _=require(_0x9202('0x0'));var util=require(_0x9202('0x1'));var moment=require('moment');var BPromise=require(_0x9202('0x2'));var rs=require(_0x9202('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9202('0x4'))['db'];var utils=require(_0x9202('0x5'));var logger=require(_0x9202('0x6'))('rpc');var config=require(_0x9202('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9202('0x8')][_0x9202('0x9')]({'port':0x232a});config[_0x9202('0xa')]=_[_0x9202('0xb')](config['redis'],{'host':_0x9202('0xc'),'port':0x18eb});var socket=require(_0x9202('0xd'))(new Redis(config[_0x9202('0xa')]));require('./whatsappInteraction.socket')[_0x9202('0xe')](socket);function respondWithRpcPromise(_0x54e634,_0x32de68,_0x5a733e){return new BPromise(function(_0x11cd33,_0x12dd7d){return client['request'](_0x54e634,_0x5a733e)[_0x9202('0xf')](function(_0x12ff41){logger[_0x9202('0x10')](_0x9202('0x11'),_0x32de68,_0x9202('0x12'));logger[_0x9202('0x13')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x32de68,_0x9202('0x12'),JSON['stringify'](_0x12ff41));if(_0x12ff41['error']){if(_0x12ff41[_0x9202('0x14')][_0x9202('0x15')]===0x1f4){logger[_0x9202('0x14')](_0x9202('0x11'),_0x32de68,_0x12ff41[_0x9202('0x14')][_0x9202('0x16')]);return _0x12dd7d(_0x12ff41[_0x9202('0x14')][_0x9202('0x16')]);}logger[_0x9202('0x14')]('WhatsappInteraction,\x20%s,\x20%s',_0x32de68,_0x12ff41['error'][_0x9202('0x16')]);return _0x11cd33(_0x12ff41[_0x9202('0x14')]['message']);}else{logger[_0x9202('0x10')](_0x9202('0x11'),_0x32de68,'request\x20sent');_0x11cd33(_0x12ff41['result'][_0x9202('0x16')]);}})[_0x9202('0x17')](function(_0x83076d){logger[_0x9202('0x14')](_0x9202('0x11'),_0x32de68,_0x83076d);_0x12dd7d(_0x83076d);});});}exports[_0x9202('0x18')]=function(_0x2c62cd){var _0x1ee69a=this;return new Promise(function(_0xed029e,_0x41770f){return db['WhatsappInteraction'][_0x9202('0x19')](_0x2c62cd[_0x9202('0x1a')],{'raw':_0x2c62cd['options']?_0x2c62cd[_0x9202('0x1b')][_0x9202('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c62cd[_0x9202('0x1b')]?_0x2c62cd[_0x9202('0x1b')][_0x9202('0x1d')]||null:null,'attributes':_0x2c62cd['options']?_0x2c62cd['options'][_0x9202('0x1e')]||null:null,'limit':_0x2c62cd[_0x9202('0x1b')]?_0x2c62cd['options']['limit']||null:null})[_0x9202('0xf')](function(_0x288579){logger['info'](_0x9202('0x18'),_0x2c62cd);logger[_0x9202('0x13')]('UpdateWhatsappInteraction',_0x2c62cd,JSON[_0x9202('0x1f')](_0x288579));_0xed029e(_0x288579);})['catch'](function(_0x4f0ae8){logger[_0x9202('0x14')]('UpdateWhatsappInteraction',_0x4f0ae8[_0x9202('0x16')],_0x2c62cd);_0x41770f(_0x1ee69a[_0x9202('0x14')](0x1f4,_0x4f0ae8[_0x9202('0x16')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x1ed6cd){return new Promise(function(_0x25bc2d,_0x277c3c){return db[_0x9202('0x20')][_0x9202('0x21')]({'where':_0x1ed6cd['options']?_0x1ed6cd[_0x9202('0x1b')][_0x9202('0x1d')]||null:null})['then'](function(_0x32a6c9){if(_0x32a6c9){return _0x32a6c9[_0x9202('0x22')](_0x1ed6cd[_0x9202('0x1a')][_0x9202('0x23')],_[_0x9202('0x24')](_0x1ed6cd[_0x9202('0x1a')],[_0x9202('0x23'),'id'])||{});}})['spread'](function(_0x20f7ee){logger[_0x9202('0x10')](_0x9202('0x25'),_0x1ed6cd);logger['debug']('AddTags',_0x1ed6cd,JSON[_0x9202('0x1f')](_0x20f7ee));_0x25bc2d(_0x20f7ee);})[_0x9202('0x17')](function(_0x20505d){logger[_0x9202('0x14')](_0x9202('0x25'),_0x20505d[_0x9202('0x16')],_0x1ed6cd);_0x277c3c(_this[_0x9202('0x14')](0x1f4,_0x20505d[_0x9202('0x16')]));});});}; \ No newline at end of file +var _0xb76c=['code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','attributes','limit','find','where','addTags','omit','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3c1e23,_0x1154ff){var _0x55a1d9=function(_0x4efeb5){while(--_0x4efeb5){_0x3c1e23['push'](_0x3c1e23['shift']());}};_0x55a1d9(++_0x1154ff);}(_0xb76c,0x11b));var _0xcb76=function(_0xe5b349,_0x5f06e4){_0xe5b349=_0xe5b349-0x0;var _0x26b0ad=_0xb76c[_0xe5b349];return _0x26b0ad;};'use strict';var _=require(_0xcb76('0x0'));var util=require(_0xcb76('0x1'));var moment=require(_0xcb76('0x2'));var BPromise=require(_0xcb76('0x3'));var rs=require(_0xcb76('0x4'));var fs=require('fs');var Redis=require(_0xcb76('0x5'));var db=require(_0xcb76('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xcb76('0x7'))(_0xcb76('0x8'));var config=require(_0xcb76('0x9'));var jayson=require(_0xcb76('0xa'));var client=jayson[_0xcb76('0xb')][_0xcb76('0xc')]({'port':0x232a});config[_0xcb76('0xd')]=_['defaults'](config[_0xcb76('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcb76('0xd')]));require(_0xcb76('0xe'))[_0xcb76('0xf')](socket);function respondWithRpcPromise(_0x59c731,_0x24d47f,_0x498190){return new BPromise(function(_0x3be769,_0xa97973){return client[_0xcb76('0x10')](_0x59c731,_0x498190)[_0xcb76('0x11')](function(_0x46e153){logger[_0xcb76('0x12')](_0xcb76('0x13'),_0x24d47f,_0xcb76('0x14'));logger[_0xcb76('0x15')](_0xcb76('0x16'),_0x24d47f,_0xcb76('0x14'),JSON[_0xcb76('0x17')](_0x46e153));if(_0x46e153[_0xcb76('0x18')]){if(_0x46e153[_0xcb76('0x18')][_0xcb76('0x19')]===0x1f4){logger[_0xcb76('0x18')](_0xcb76('0x13'),_0x24d47f,_0x46e153[_0xcb76('0x18')][_0xcb76('0x1a')]);return _0xa97973(_0x46e153['error'][_0xcb76('0x1a')]);}logger[_0xcb76('0x18')](_0xcb76('0x13'),_0x24d47f,_0x46e153['error'][_0xcb76('0x1a')]);return _0x3be769(_0x46e153['error'][_0xcb76('0x1a')]);}else{logger[_0xcb76('0x12')](_0xcb76('0x13'),_0x24d47f,_0xcb76('0x14'));_0x3be769(_0x46e153[_0xcb76('0x1b')][_0xcb76('0x1a')]);}})[_0xcb76('0x1c')](function(_0x58de2b){logger[_0xcb76('0x18')](_0xcb76('0x13'),_0x24d47f,_0x58de2b);_0xa97973(_0x58de2b);});});}exports[_0xcb76('0x1d')]=function(_0x2d1ab6){var _0x316fba=this;return new Promise(function(_0xa4c75d,_0x17cdbf){return db[_0xcb76('0x1e')][_0xcb76('0x1f')](_0x2d1ab6[_0xcb76('0x20')],{'raw':_0x2d1ab6['options']?_0x2d1ab6[_0xcb76('0x21')][_0xcb76('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d1ab6[_0xcb76('0x21')]?_0x2d1ab6['options']['where']||null:null,'attributes':_0x2d1ab6[_0xcb76('0x21')]?_0x2d1ab6['options'][_0xcb76('0x23')]||null:null,'limit':_0x2d1ab6[_0xcb76('0x21')]?_0x2d1ab6[_0xcb76('0x21')][_0xcb76('0x24')]||null:null})['then'](function(_0x18289f){logger['info'](_0xcb76('0x1d'),_0x2d1ab6);logger[_0xcb76('0x15')](_0xcb76('0x1d'),_0x2d1ab6,JSON[_0xcb76('0x17')](_0x18289f));_0xa4c75d(_0x18289f);})[_0xcb76('0x1c')](function(_0x5a5ede){logger[_0xcb76('0x18')](_0xcb76('0x1d'),_0x5a5ede[_0xcb76('0x1a')],_0x2d1ab6);_0x17cdbf(_0x316fba['error'](0x1f4,_0x5a5ede[_0xcb76('0x1a')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x4f6698){return new Promise(function(_0x197d44,_0x11d5c8){return db[_0xcb76('0x1e')][_0xcb76('0x25')]({'where':_0x4f6698[_0xcb76('0x21')]?_0x4f6698[_0xcb76('0x21')][_0xcb76('0x26')]||null:null})[_0xcb76('0x11')](function(_0x1ab5f6){if(_0x1ab5f6){return _0x1ab5f6[_0xcb76('0x27')](_0x4f6698[_0xcb76('0x20')]['ids'],_[_0xcb76('0x28')](_0x4f6698[_0xcb76('0x20')],[_0xcb76('0x29'),'id'])||{});}})[_0xcb76('0x2a')](function(_0x5874e2){logger[_0xcb76('0x12')](_0xcb76('0x2b'),_0x4f6698);logger[_0xcb76('0x15')]('AddTags',_0x4f6698,JSON[_0xcb76('0x17')](_0x5874e2));_0x197d44(_0x5874e2);})['catch'](function(_0x393dde){logger[_0xcb76('0x18')]('AddTags',_0x393dde['message'],_0x4f6698);_0x11d5c8(_this[_0xcb76('0x18')](0x1f4,_0x393dde[_0xcb76('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 496ea06..70d6105 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 _0x99d2=['remove','emit','removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events','save'];(function(_0x1deb72,_0x3f6338){var _0x18bbdf=function(_0x1b4b9b){while(--_0x1b4b9b){_0x1deb72['push'](_0x1deb72['shift']());}};_0x18bbdf(++_0x3f6338);}(_0x99d2,0xa6));var _0x299d=function(_0x5152ea,_0x368c99){_0x5152ea=_0x5152ea-0x0;var _0x5eeb3d=_0x99d2[_0x5152ea];return _0x5eeb3d;};'use strict';var WhatsappInteractionEvents=require(_0x299d('0x0'));var events=[_0x299d('0x1'),_0x299d('0x2'),'update'];function createListener(_0x3f47e9,_0x231b33){return function(_0x117292){_0x231b33[_0x299d('0x3')](_0x3f47e9,_0x117292);};}function removeListener(_0x32729a,_0x1d3bc6){return function(){WhatsappInteractionEvents[_0x299d('0x4')](_0x32729a,_0x1d3bc6);};}exports[_0x299d('0x5')]=function(_0x8ae208){for(var _0x3d7e0a=0x0,_0x11185d=events[_0x299d('0x6')];_0x3d7e0a<_0x11185d;_0x3d7e0a++){var _0x7f29fd=events[_0x3d7e0a];var _0x19917e=createListener(_0x299d('0x7')+_0x7f29fd,_0x8ae208);WhatsappInteractionEvents['on'](_0x7f29fd,_0x19917e);}}; \ No newline at end of file +var _0x7038=['./whatsappInteraction.events','save','update','removeListener','register'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x7038,0x91));var _0x8703=function(_0x446f07,_0x17e5ff){_0x446f07=_0x446f07-0x0;var _0xd899f6=_0x7038[_0x446f07];return _0xd899f6;};'use strict';var WhatsappInteractionEvents=require(_0x8703('0x0'));var events=[_0x8703('0x1'),'remove',_0x8703('0x2')];function createListener(_0x396175,_0x3c05d8){return function(_0x2e5292){_0x3c05d8['emit'](_0x396175,_0x2e5292);};}function removeListener(_0x38388c,_0x4599d6){return function(){WhatsappInteractionEvents[_0x8703('0x3')](_0x38388c,_0x4599d6);};}exports[_0x8703('0x4')]=function(_0x1b4f17){for(var _0x26471f=0x0,_0x3e2e3b=events['length'];_0x26471f<_0x3e2e3b;_0x26471f++){var _0x4fcb64=events[_0x26471f];var _0x3afe39=createListener('whatsappInteraction:'+_0x4fcb64,_0x1b4f17);WhatsappInteractionEvents['on'](_0x4fcb64,_0x3afe39);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 738eaeb..65f02a1 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 _0x720e=['multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show','post','tracked','create','put','/:id','update','accept','reject','delete','destroy','exports'];(function(_0x45a31b,_0x1ae643){var _0x5d9743=function(_0x3b36c7){while(--_0x3b36c7){_0x45a31b['push'](_0x45a31b['shift']());}};_0x5d9743(++_0x1ae643);}(_0x720e,0xb8));var _0xe720=function(_0x254b22,_0x27159f){_0x254b22=_0x254b22-0x0;var _0x1279db=_0x720e[_0x254b22];return _0x1279db;};'use strict';var multer=require(_0xe720('0x0'));var util=require(_0xe720('0x1'));var path=require(_0xe720('0x2'));var timeout=require(_0xe720('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe720('0x4'));var config=require(_0xe720('0x5'));var controller=require('./whatsappMessage.controller');router[_0xe720('0x6')]('/',auth['isAuthenticated'](),controller[_0xe720('0x7')]);router[_0xe720('0x6')](_0xe720('0x8'),auth[_0xe720('0x9')](),controller[_0xe720('0xa')]);router[_0xe720('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xe720('0xb')]);router[_0xe720('0xc')]('/',auth['isAuthenticated'](),interaction[_0xe720('0xd')]('whatsapp','whatsappmessage:create'),controller[_0xe720('0xe')]);router[_0xe720('0xc')]('/:id/status',controller['status']);router[_0xe720('0xf')](_0xe720('0x10'),auth[_0xe720('0x9')](),controller[_0xe720('0x11')]);router[_0xe720('0xf')]('/:id/accept',auth[_0xe720('0x9')](),controller[_0xe720('0x12')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0xe720('0x13')]);router[_0xe720('0x14')]('/:id',auth[_0xe720('0x9')](),controller[_0xe720('0x15')]);module[_0xe720('0x16')]=router; \ No newline at end of file +var _0x140b=['util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','whatsappmessage:create','create','status','put','update','/:id/accept','accept','reject','delete','destroy','exports','multer'];(function(_0x4d5721,_0x51a33d){var _0x88a224=function(_0x2b2609){while(--_0x2b2609){_0x4d5721['push'](_0x4d5721['shift']());}};_0x88a224(++_0x51a33d);}(_0x140b,0x15b));var _0xb140=function(_0x1a7b8c,_0x4d98b8){_0x1a7b8c=_0x1a7b8c-0x0;var _0x593546=_0x140b[_0x1a7b8c];return _0x593546;};'use strict';var multer=require(_0xb140('0x0'));var util=require(_0xb140('0x1'));var path=require('path');var timeout=require(_0xb140('0x2'));var express=require('express');var router=express[_0xb140('0x3')]();var fs_extra=require(_0xb140('0x4'));var auth=require(_0xb140('0x5'));var interaction=require(_0xb140('0x6'));var config=require(_0xb140('0x7'));var controller=require(_0xb140('0x8'));router[_0xb140('0x9')]('/',auth[_0xb140('0xa')](),controller[_0xb140('0xb')]);router[_0xb140('0x9')](_0xb140('0xc'),auth[_0xb140('0xa')](),controller[_0xb140('0xd')]);router[_0xb140('0x9')](_0xb140('0xe'),auth[_0xb140('0xa')](),controller[_0xb140('0xf')]);router[_0xb140('0x10')]('/',auth['isAuthenticated'](),interaction[_0xb140('0x11')]('whatsapp',_0xb140('0x12')),controller[_0xb140('0x13')]);router['post']('/:id/status',controller[_0xb140('0x14')]);router[_0xb140('0x15')](_0xb140('0xe'),auth[_0xb140('0xa')](),controller[_0xb140('0x16')]);router[_0xb140('0x15')](_0xb140('0x17'),auth[_0xb140('0xa')](),controller[_0xb140('0x18')]);router[_0xb140('0x15')]('/:id/reject',auth[_0xb140('0xa')](),controller[_0xb140('0x19')]);router[_0xb140('0x1a')](_0xb140('0xe'),auth[_0xb140('0xa')](),controller[_0xb140('0x1b')]);module[_0xb140('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index b16c2fa..c8c2126 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 _0xb4c7=['STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN','out'];(function(_0xa454d4,_0x298a6a){var _0x2daf62=function(_0x30907e){while(--_0x30907e){_0xa454d4['push'](_0xa454d4['shift']());}};_0x2daf62(++_0x298a6a);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x535bb0,_0xf7ba07){_0x535bb0=_0x535bb0-0x0;var _0x45e279=_0xb4c7[_0x535bb0];return _0x45e279;};'use strict';var Sequelize=require(_0x7b4c('0x0'));module[_0x7b4c('0x1')]={'body':{'type':Sequelize[_0x7b4c('0x2')](_0x7b4c('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x7b4c('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x7b4c('0x5')),'defaultValue':_0x7b4c('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x7b4c('0x6')](0xbe)},'phone':{'type':Sequelize[_0x7b4c('0x6')]},'readAt':{'type':Sequelize[_0x7b4c('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x7b4c('0x6')]},'providerResponse':{'type':Sequelize[_0x7b4c('0x2')]}}; \ No newline at end of file +var _0x360c=['ENUM','out','STRING','TEXT','sequelize','exports','medium','BOOLEAN'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x360c,0xac));var _0xc360=function(_0x24c973,_0x354d52){_0x24c973=_0x24c973-0x0;var _0x3a8c12=_0x360c[_0x24c973];return _0x3a8c12;};'use strict';var Sequelize=require(_0xc360('0x0'));module[_0xc360('0x1')]={'body':{'type':Sequelize['TEXT'](_0xc360('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xc360('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc360('0x4')]('in',_0xc360('0x5')),'defaultValue':_0xc360('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xc360('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xc360('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xc360('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 4816a19..3b74a5c 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 _0xa7ee=['key','map','keys','filters','intersection','query','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','params','options','create','body','describe','accept','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','find','WhatsappInteractionId','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','interface','format','SIP/%s','channel','event','EventManager','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','contact','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','MessageSid','messageId','MessageStatus','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','info','debug','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','request\x20sent','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','destroy','then','stack','name','send','index','WhatsappMessage','rawAttributes','fieldName','type'];(function(_0x4604ad,_0x2c516e){var _0x3ed8ef=function(_0x2cb13e){while(--_0x2cb13e){_0x4604ad['push'](_0x4604ad['shift']());}};_0x3ed8ef(++_0x2c516e);}(_0xa7ee,0x159));var _0xea7e=function(_0x16539a,_0x31409a){_0x16539a=_0x16539a-0x0;var _0x200796=_0xa7ee[_0x16539a];return _0x200796;};'use strict';var emlformat=require(_0xea7e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xea7e('0x1'));var jsonpatch=require(_0xea7e('0x2'));var rp=require(_0xea7e('0x3'));var moment=require(_0xea7e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xea7e('0x5'));var path=require('path');var sox=require(_0xea7e('0x6'));var csv=require(_0xea7e('0x7'));var ejs=require(_0xea7e('0x8'));var fs=require('fs');var fs_extra=require(_0xea7e('0x9'));var _=require('lodash');var squel=require(_0xea7e('0xa'));var crypto=require(_0xea7e('0xb'));var jsforce=require(_0xea7e('0xc'));var deskjs=require(_0xea7e('0xd'));var toCsv=require(_0xea7e('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xea7e('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xea7e('0xf'));var as=require(_0xea7e('0x10'));var hardwareService=require(_0xea7e('0x11'));var logger=require(_0xea7e('0x12'))('api');var utils=require(_0xea7e('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xea7e('0x14'));var db=require(_0xea7e('0x15'))['db'];config[_0xea7e('0x16')]=_[_0xea7e('0x17')](config[_0xea7e('0x16')],{'host':_0xea7e('0x18'),'port':0x18eb});var socket=require(_0xea7e('0x19'))(new Redis(config[_0xea7e('0x16')]));require('./whatsappMessage.socket')[_0xea7e('0x1a')](socket);var jayson=require(_0xea7e('0x1b'));var client=jayson[_0xea7e('0x1c')][_0xea7e('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0xea7e('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x4d3796,_0x5c7466,_0x3cd795,_0x2d5794){return new BPromise(function(_0x162c47,_0x519959){var _0x5c3b15=_0x2d5794||client;return _0x5c3b15[_0xea7e('0x1e')](_0x4d3796,_0x3cd795)['then'](function(_0x195d5a){logger[_0xea7e('0x1f')]('WhatsappMessage,\x20%s,\x20%s',_0x5c7466,'request\x20sent');logger[_0xea7e('0x20')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x5c7466,'request\x20sent',JSON[_0xea7e('0x21')](_0x195d5a));if(_0x195d5a['error']){if(_0x195d5a[_0xea7e('0x22')][_0xea7e('0x23')]===0x1f4){logger['error'](_0xea7e('0x24'),_0x5c7466,_0x195d5a['error'][_0xea7e('0x25')]);return _0x519959(_0x195d5a[_0xea7e('0x22')][_0xea7e('0x25')]);}logger[_0xea7e('0x22')](_0xea7e('0x24'),_0x5c7466,_0x195d5a[_0xea7e('0x22')]['message']);return _0x162c47(_0x195d5a[_0xea7e('0x22')][_0xea7e('0x25')]);}else{logger['info'](_0xea7e('0x24'),_0x5c7466,_0xea7e('0x26'));_0x162c47(_0x195d5a[_0xea7e('0x27')]['message']);}})[_0xea7e('0x28')](function(_0x400125){logger[_0xea7e('0x22')]('WhatsappMessage,\x20%s,\x20%s',_0x5c7466,_0x400125);_0x519959(_0x400125);});});}function respondWithStatusCode(_0x456222,_0x2a6623){_0x2a6623=_0x2a6623||0xcc;return function(_0x41d40c){if(_0x41d40c){return _0x456222[_0xea7e('0x29')](_0x2a6623);}return _0x456222[_0xea7e('0x2a')](_0x2a6623)[_0xea7e('0x2b')]();};}function respondWithResult(_0x31871e,_0x25b5a4){_0x25b5a4=_0x25b5a4||0xc8;return function(_0x1067cd){if(_0x1067cd){return _0x31871e[_0xea7e('0x2a')](_0x25b5a4)['json'](_0x1067cd);}};}function respondWithFilteredResult(_0x1744f3,_0xd856de){return function(_0x4d3c38){if(_0x4d3c38){var _0x2a1753=typeof _0xd856de[_0xea7e('0x2c')]===_0xea7e('0x2d')&&typeof _0xd856de[_0xea7e('0x2e')]===_0xea7e('0x2d');var _0x56ea98=_0x4d3c38[_0xea7e('0x2f')];var _0xd89897=_0x2a1753?0x0:_0xd856de['offset'];var _0x4cfa72=_0x2a1753?_0x4d3c38[_0xea7e('0x2f')]:_0xd856de['offset']+_0xd856de[_0xea7e('0x2e')];var _0x5c12d6;if(_0x4cfa72>=_0x56ea98){_0x4cfa72=_0x56ea98;_0x5c12d6=0xc8;}else{_0x5c12d6=0xce;}_0x1744f3[_0xea7e('0x2a')](_0x5c12d6);return _0x1744f3[_0xea7e('0x30')](_0xea7e('0x31'),_0xd89897+'-'+_0x4cfa72+'/'+_0x56ea98)[_0xea7e('0x32')](_0x4d3c38);}return null;};}function patchUpdates(_0xe60da3){return function(_0x352b07){try{jsonpatch['apply'](_0x352b07,_0xe60da3,!![]);}catch(_0x2a2272){return BPromise[_0xea7e('0x33')](_0x2a2272);}return _0x352b07[_0xea7e('0x34')]();};}function saveUpdates(_0x42922a,_0x419475){return function(_0x400c05){if(_0x400c05){return _0x400c05['update'](_0x42922a)['then'](function(_0xb53ef9){return _0xb53ef9;});}return null;};}function removeEntity(_0x2b3744,_0x1260e7){return function(_0x5e8f90){if(_0x5e8f90){return _0x5e8f90[_0xea7e('0x35')]()[_0xea7e('0x36')](function(){_0x2b3744[_0xea7e('0x2a')](0xcc)[_0xea7e('0x2b')]();});}};}function handleEntityNotFound(_0x2ab95b,_0x21ca5f){return function(_0x2291f2){if(!_0x2291f2){_0x2ab95b[_0xea7e('0x29')](0x194);}return _0x2291f2;};}function handleError(_0x3dd55b,_0x1c4d76){_0x1c4d76=_0x1c4d76||0x1f4;return function(_0x334324){logger[_0xea7e('0x22')](_0x334324[_0xea7e('0x37')]);if(_0x334324[_0xea7e('0x38')]){delete _0x334324[_0xea7e('0x38')];}_0x3dd55b['status'](_0x1c4d76)[_0xea7e('0x39')](_0x334324);};}exports[_0xea7e('0x3a')]=function(_0x3f3b2f,_0xfc3106){var _0x5cc121={},_0x165024={},_0x4ce7d3={'count':0x0,'rows':[]};var _0x226fa2=_['map'](db[_0xea7e('0x3b')][_0xea7e('0x3c')],function(_0x468606){return{'name':_0x468606[_0xea7e('0x3d')],'type':_0x468606[_0xea7e('0x3e')][_0xea7e('0x3f')]};});_0x165024['model']=_[_0xea7e('0x40')](_0x226fa2,_0xea7e('0x38'));_0x165024['query']=_[_0xea7e('0x41')](_0x3f3b2f['query']);_0x165024[_0xea7e('0x42')]=_[_0xea7e('0x43')](_0x165024['model'],_0x165024[_0xea7e('0x44')]);_0x5cc121[_0xea7e('0x45')]=_[_0xea7e('0x43')](_0x165024[_0xea7e('0x46')],qs[_0xea7e('0x47')](_0x3f3b2f[_0xea7e('0x44')][_0xea7e('0x47')]));_0x5cc121[_0xea7e('0x45')]=_0x5cc121[_0xea7e('0x45')][_0xea7e('0x48')]?_0x5cc121[_0xea7e('0x45')]:_0x165024[_0xea7e('0x46')];if(!_0x3f3b2f[_0xea7e('0x44')][_0xea7e('0x49')]('nolimit')){_0x5cc121['limit']=qs['limit'](_0x3f3b2f['query']['limit']);_0x5cc121['offset']=qs[_0xea7e('0x2c')](_0x3f3b2f['query'][_0xea7e('0x2c')]);}_0x5cc121[_0xea7e('0x4a')]=qs['sort'](_0x3f3b2f['query'][_0xea7e('0x4b')]);_0x5cc121[_0xea7e('0x4c')]=qs[_0xea7e('0x42')](_[_0xea7e('0x4d')](_0x3f3b2f['query'],_0x165024['filters']),_0x226fa2);if(_0x3f3b2f[_0xea7e('0x44')]['filter']){_0x5cc121[_0xea7e('0x4c')]=_[_0xea7e('0x4e')](_0x5cc121['where'],{'$or':_[_0xea7e('0x40')](_0x226fa2,function(_0x26a4f5){if(_0x26a4f5['type']!==_0xea7e('0x4f')){var _0x2d3034={};_0x2d3034[_0x26a4f5['name']]={'$like':'%'+_0x3f3b2f['query'][_0xea7e('0x50')]+'%'};return _0x2d3034;}})});}_0x5cc121=_[_0xea7e('0x4e')]({},_0x5cc121,_0x3f3b2f['options']);var _0x3fbaef={'where':_0x5cc121[_0xea7e('0x4c')]};return db['WhatsappMessage'][_0xea7e('0x2f')](_0x3fbaef)[_0xea7e('0x36')](function(_0x42446c){_0x4ce7d3[_0xea7e('0x2f')]=_0x42446c;if(_0x3f3b2f[_0xea7e('0x44')][_0xea7e('0x51')]){_0x5cc121[_0xea7e('0x52')]=[{'all':!![]}];}return db['WhatsappMessage'][_0xea7e('0x53')](_0x5cc121);})[_0xea7e('0x36')](function(_0xe137bf){_0x4ce7d3[_0xea7e('0x54')]=_0xe137bf;return _0x4ce7d3;})[_0xea7e('0x36')](respondWithFilteredResult(_0xfc3106,_0x5cc121))[_0xea7e('0x28')](handleError(_0xfc3106,null));};exports['show']=function(_0x4404e5,_0x1ba27f){var _0x273392={'raw':!![],'where':{'id':_0x4404e5[_0xea7e('0x55')]['id']}},_0x3347c7={};_0x3347c7[_0xea7e('0x46')]=_['keys'](db[_0xea7e('0x3b')][_0xea7e('0x3c')]);_0x3347c7[_0xea7e('0x44')]=_['keys'](_0x4404e5[_0xea7e('0x44')]);_0x3347c7[_0xea7e('0x42')]=_['intersection'](_0x3347c7[_0xea7e('0x46')],_0x3347c7[_0xea7e('0x44')]);_0x273392[_0xea7e('0x45')]=_[_0xea7e('0x43')](_0x3347c7[_0xea7e('0x46')],qs[_0xea7e('0x47')](_0x4404e5[_0xea7e('0x44')][_0xea7e('0x47')]));_0x273392[_0xea7e('0x45')]=_0x273392['attributes']['length']?_0x273392[_0xea7e('0x45')]:_0x3347c7[_0xea7e('0x46')];if(_0x4404e5['query'][_0xea7e('0x51')]){_0x273392['include']=[{'all':!![]}];}_0x273392=_[_0xea7e('0x4e')]({},_0x273392,_0x4404e5[_0xea7e('0x56')]);return db[_0xea7e('0x3b')]['find'](_0x273392)[_0xea7e('0x36')](handleEntityNotFound(_0x1ba27f,null))[_0xea7e('0x36')](respondWithResult(_0x1ba27f,null))[_0xea7e('0x28')](handleError(_0x1ba27f,null));};exports[_0xea7e('0x57')]=function(_0x9aa251,_0x4fa681){return db['WhatsappMessage'][_0xea7e('0x57')](_0x9aa251[_0xea7e('0x58')],{})[_0xea7e('0x36')](respondWithResult(_0x4fa681,0xc9))[_0xea7e('0x28')](handleError(_0x4fa681,null));};exports['update']=function(_0x2fde0c,_0x28529b){if(_0x2fde0c[_0xea7e('0x58')]['id']){delete _0x2fde0c[_0xea7e('0x58')]['id'];}return db[_0xea7e('0x3b')]['find']({'where':{'id':_0x2fde0c['params']['id']}})[_0xea7e('0x36')](handleEntityNotFound(_0x28529b,null))[_0xea7e('0x36')](saveUpdates(_0x2fde0c['body'],null))[_0xea7e('0x36')](respondWithResult(_0x28529b,null))[_0xea7e('0x28')](handleError(_0x28529b,null));};exports[_0xea7e('0x35')]=function(_0x107727,_0x2c6008){return db['WhatsappMessage']['find']({'where':{'id':_0x107727[_0xea7e('0x55')]['id']}})[_0xea7e('0x36')](handleEntityNotFound(_0x2c6008,null))[_0xea7e('0x36')](removeEntity(_0x2c6008,null))[_0xea7e('0x28')](handleError(_0x2c6008,null));};exports[_0xea7e('0x59')]=function(_0x2a76ad,_0x337ee7){return db['WhatsappMessage']['describe']()['then'](respondWithResult(_0x337ee7,null))[_0xea7e('0x28')](handleError(_0x337ee7,null));};var interaction_log=require(_0xea7e('0x12'))('whatsapp-interactions');exports[_0xea7e('0x5a')]=function(_0x4bf6c6,_0x590577,_0x3a8514){var _0x7b0c67={'agent':{},'channel':'whatsapp'};if(_0x4bf6c6[_0xea7e('0x58')]['id']){delete _0x4bf6c6[_0xea7e('0x58')]['id'];}_0x4bf6c6[_0xea7e('0x58')][_0xea7e('0x5b')]=!![];_0x4bf6c6[_0xea7e('0x58')]['readAt']=moment()['format'](_0xea7e('0x5c'));_0x4bf6c6[_0xea7e('0x58')][_0xea7e('0x5d')]=_0x4bf6c6['body'][_0xea7e('0x5d')]||_0x4bf6c6[_0xea7e('0x5e')]['id'];_0x7b0c67[_0xea7e('0x5f')]['id']=_0x4bf6c6[_0xea7e('0x58')][_0xea7e('0x5d')];return db['WhatsappMessage']['find']({'where':{'id':_0x4bf6c6[_0xea7e('0x55')]['id'],'UserId':null}})[_0xea7e('0x36')](handleEntityNotFound(_0x590577,null))['then'](saveUpdates(_0x4bf6c6[_0xea7e('0x58')],null))[_0xea7e('0x36')](function(_0x5e0797){if(_0x5e0797){_0x7b0c67[_0xea7e('0x25')]=_0x5e0797[_0xea7e('0x60')]({'plain':!![]});return db[_0xea7e('0x61')][_0xea7e('0x62')]({'where':{'id':_0x5e0797[_0xea7e('0x63')]}});}return null;})[_0xea7e('0x36')](handleEntityNotFound(_0x590577,null))['then'](function(_0x2cdc7b){if(_0x2cdc7b){return _0x2cdc7b['update']({'UserId':_0x4bf6c6[_0xea7e('0x58')][_0xea7e('0x5d')],'read1stAt':_[_0xea7e('0x64')](_0x2cdc7b[_0xea7e('0x65')])?moment()['format'](_0xea7e('0x5c')):undefined});}return null;})['then'](function(_0x460f8e){if(_0x460f8e){_0x7b0c67[_0xea7e('0x66')]=_0x460f8e['get']({'plain':!![]});interaction_log[_0xea7e('0x1f')](_0xea7e('0x67'),_0x4bf6c6[_0xea7e('0x5e')]['id'],_0x4bf6c6['user'][_0xea7e('0x38')],_0x4bf6c6['user']['role'],_0x7b0c67['interaction']['id'],_0x4bf6c6[_0xea7e('0x58')]?JSON['stringify'](_0x4bf6c6['body']):_0xea7e('0x68'));return respondWithRpcPromise(_0xea7e('0x69'),_0xea7e('0x6a'),_0x7b0c67);}return null;})[_0xea7e('0x36')](function(_0x364d14){var _0x585332=_0xea7e('0x6b')+_0x364d14['message']['ContactId'];return db[_0xea7e('0x6c')][_0xea7e('0x44')](_0x585332,{'type':db['Sequelize'][_0xea7e('0x6d')][_0xea7e('0x6e')],'raw':!![]})['then'](function(_0x5b4dfa){return _0x5b4dfa;});})['then'](function(_0x4fbaae){if(_0x4fbaae){_0x7b0c67[_0xea7e('0x25')]['contact']=_0x4fbaae[0x0];if(!_0x4bf6c6[_0xea7e('0x58')][_0xea7e('0x5d')])return;return db[_0xea7e('0x6f')]['find']({'where':{'id':_0x4bf6c6['body'][_0xea7e('0x5d')],'role':_0xea7e('0x5f')},'attributes':['id','name',_0xea7e('0x70'),_0xea7e('0x71'),_0xea7e('0x72')],'raw':!![]});}return null;})[_0xea7e('0x36')](function(_0x1314d0){if(!_0x1314d0)return null;_0x7b0c67[_0xea7e('0x25')][_0xea7e('0x5f')]=_0x1314d0;return _0x7b0c67;})[_0xea7e('0x36')](function(_0x38211e){if(_0x38211e){if(_0x4bf6c6[_0xea7e('0x58')][_0xea7e('0x73')]){_0x7b0c67['message'][_0xea7e('0x74')]=util[_0xea7e('0x75')](_0xea7e('0x76'),_0x4bf6c6['user'][_0xea7e('0x38')]);_0x7b0c67[_0xea7e('0x25')][_0xea7e('0x77')]=_0x7b0c67[_0xea7e('0x77')];_0x7b0c67[_0xea7e('0x25')][_0xea7e('0x78')]=_0xea7e('0x5a');return respondWithRpcPromise(_0xea7e('0x79'),_0xea7e('0x79'),{'event':'acceptmessage','message':_0x7b0c67[_0xea7e('0x25')]},client9002)['then'](function(){return _0x7b0c67;});}return _0x7b0c67;}return null;})[_0xea7e('0x36')](respondWithResult(_0x590577,null))[_0xea7e('0x28')](handleError(_0x590577,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports[_0xea7e('0x33')]=function(_0x47afc2,_0x5778a8,_0x170b17){var _0x49e982={'agent':{},'channel':'whatsapp'};if(_0x47afc2[_0xea7e('0x58')]['id']){delete _0x47afc2[_0xea7e('0x58')]['id'];}_0x47afc2[_0xea7e('0x58')][_0xea7e('0x5d')]=_0x47afc2[_0xea7e('0x58')][_0xea7e('0x5d')]||_0x47afc2[_0xea7e('0x5e')]['id'];_0x49e982[_0xea7e('0x5f')]['id']=_0x47afc2[_0xea7e('0x58')]['UserId'];return db['WhatsappMessage'][_0xea7e('0x62')]({'where':{'id':_0x47afc2[_0xea7e('0x55')]['id'],'UserId':null}})[_0xea7e('0x36')](handleEntityNotFound(_0x5778a8,null))[_0xea7e('0x36')](function(_0x397cdd){if(_0x397cdd){_0x49e982[_0xea7e('0x25')]=_0x397cdd[_0xea7e('0x60')]({'plain':!![]});return db[_0xea7e('0x61')][_0xea7e('0x62')]({'where':{'id':_0x397cdd[_0xea7e('0x63')]}});}return null;})[_0xea7e('0x36')](handleEntityNotFound(_0x5778a8,null))['then'](function(_0x44fa3d){if(_0x44fa3d){_0x49e982[_0xea7e('0x66')]=_0x44fa3d[_0xea7e('0x60')]({'plain':!![]});interaction_log[_0xea7e('0x1f')](_0xea7e('0x7a'),_0x47afc2[_0xea7e('0x5e')]['id'],_0x47afc2[_0xea7e('0x5e')][_0xea7e('0x38')],_0x47afc2[_0xea7e('0x5e')]['role'],_0x49e982[_0xea7e('0x66')]['id'],_0x47afc2[_0xea7e('0x58')]?JSON[_0xea7e('0x21')](_0x47afc2[_0xea7e('0x58')]):_0xea7e('0x68'));return respondWithRpcPromise(_0xea7e('0x7b'),_0xea7e('0x7c'),_0x49e982);}return null;})[_0xea7e('0x36')](function(_0x366f88){var _0x4a56e5=_0xea7e('0x6b')+_0x366f88[_0xea7e('0x25')]['ContactId'];return db[_0xea7e('0x6c')]['query'](_0x4a56e5,{'type':db[_0xea7e('0x7d')]['QueryTypes'][_0xea7e('0x6e')],'raw':!![]})[_0xea7e('0x36')](function(_0x297238){return _0x297238;});})[_0xea7e('0x36')](function(_0x51dcc5){if(_0x51dcc5){_0x49e982['message'][_0xea7e('0x7e')]=_0x51dcc5[0x0];if(!_0x47afc2[_0xea7e('0x58')]['UserId'])return;return db[_0xea7e('0x6f')]['find']({'where':{'id':_0x47afc2[_0xea7e('0x58')][_0xea7e('0x5d')],'role':'agent'},'attributes':['id',_0xea7e('0x38'),_0xea7e('0x70'),_0xea7e('0x71'),_0xea7e('0x72')],'raw':!![]});}return null;})['then'](function(_0x139e0c){if(!_0x139e0c)return null;_0x49e982[_0xea7e('0x25')][_0xea7e('0x5f')]=_0x139e0c;return _0x49e982;})['then'](function(_0x42ebee){if(_0x42ebee){_0x42ebee[_0xea7e('0x25')]['interface']=util['format'](_0xea7e('0x76'),_0x47afc2[_0xea7e('0x5e')]['name']);_0x42ebee['message']['channel']=_0x49e982[_0xea7e('0x77')];_0x42ebee[_0xea7e('0x25')][_0xea7e('0x78')]='reject';respondWithRpcPromise(_0xea7e('0x79'),_0xea7e('0x79'),{'event':_0xea7e('0x7f'),'message':_0x42ebee['message']},client9002);return _0x49e982;}return null;})['then'](respondWithResult(_0x5778a8,null))[_0xea7e('0x28')](handleError(_0x5778a8,null));};exports[_0xea7e('0x2a')]=function(_0x1325e9,_0x498d2c,_0x22080a){if(_0x1325e9[_0xea7e('0x58')]['id']){delete _0x1325e9[_0xea7e('0x58')]['id'];}var _0x1ef693;return db[_0xea7e('0x3b')][_0xea7e('0x62')]({'where':{'id':_0x1325e9[_0xea7e('0x55')]['id']}})[_0xea7e('0x36')](handleEntityNotFound(_0x498d2c,null))[_0xea7e('0x36')](function(_0x4a0b28){if(_0x4a0b28){_0x1ef693=_0x4a0b28;return db[_0xea7e('0x80')]['find']({'where':{'id':_0x4a0b28[_0xea7e('0x81')]}});}})[_0xea7e('0x36')](handleEntityNotFound(_0x498d2c,null))[_0xea7e('0x36')](function(_0xb3ec6a){if(_0xb3ec6a){logger['debug'](_0xea7e('0x82'),_0xea7e('0x2a'),'received\x20delivery\x20report\x20from',_0xb3ec6a[_0xea7e('0x3e')],util[_0xea7e('0x83')](_0x1325e9[_0xea7e('0x58')],{'showHidden':![],'depth':null}));switch(_0xb3ec6a['type']){case'twilio':if(_0x1325e9[_0xea7e('0x58')][_0xea7e('0x84')]&&_0x1325e9[_0xea7e('0x58')][_0xea7e('0x84')]===_0x1ef693[_0xea7e('0x85')]&&_0x1325e9['body'][_0xea7e('0x86')]&&_0x1325e9[_0xea7e('0x58')]['MessageStatus']==='read'){return _0x1ef693[_0xea7e('0x87')]({'read':!![]});}else{logger[_0xea7e('0x22')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xea7e('0x2a'),'twilio',util[_0xea7e('0x83')](_0x1325e9[_0xea7e('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x1ef693;}})[_0xea7e('0x36')](respondWithResult(_0x498d2c,null))[_0xea7e('0x28')](handleError(_0x498d2c,null));}; \ No newline at end of file +var _0xdf74=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','json','limit','undefined','count','Content-Range','apply','reject','save','then','destroy','end','sendStatus','stack','name','send','index','map','WhatsappMessage','rawAttributes','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','sort','merge','VIRTUAL','filter','options','where','include','findAll','rows','show','includeAll','find','create','body','update','params','describe','whatsapp','read','readAt','format','UserId','user','agent','get','WhatsappInteractionId','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','whatsapp-interactions','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring'];(function(_0x5796cb,_0x15b2e1){var _0x126d5e=function(_0x3d319e){while(--_0x3d319e){_0x5796cb['push'](_0x5796cb['shift']());}};_0x126d5e(++_0x15b2e1);}(_0xdf74,0x197));var _0x4df7=function(_0x1040f3,_0x57fe5c){_0x1040f3=_0x1040f3-0x0;var _0x45ec02=_0xdf74[_0x1040f3];return _0x45ec02;};'use strict';var emlformat=require(_0x4df7('0x0'));var rimraf=require(_0x4df7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4df7('0x2'));var rp=require(_0x4df7('0x3'));var moment=require(_0x4df7('0x4'));var BPromise=require(_0x4df7('0x5'));var Mustache=require(_0x4df7('0x6'));var util=require(_0x4df7('0x7'));var path=require(_0x4df7('0x8'));var sox=require('sox');var csv=require(_0x4df7('0x9'));var ejs=require(_0x4df7('0xa'));var fs=require('fs');var fs_extra=require(_0x4df7('0xb'));var _=require(_0x4df7('0xc'));var squel=require('squel');var crypto=require(_0x4df7('0xd'));var jsforce=require(_0x4df7('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4df7('0x9'));var querystring=require(_0x4df7('0xf'));var Papa=require('papaparse');var Redis=require(_0x4df7('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4df7('0x11'));var as=require(_0x4df7('0x12'));var hardwareService=require(_0x4df7('0x13'));var logger=require(_0x4df7('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x4df7('0x15'));var licenseUtil=require(_0x4df7('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x4df7('0x17')],{'host':_0x4df7('0x18'),'port':0x18eb});var socket=require(_0x4df7('0x19'))(new Redis(config[_0x4df7('0x17')]));require(_0x4df7('0x1a'))[_0x4df7('0x1b')](socket);var jayson=require(_0x4df7('0x1c'));var client=jayson[_0x4df7('0x1d')][_0x4df7('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x4df7('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x1df1c8,_0x4451fe,_0x4d174e,_0x450969){return new BPromise(function(_0x1d27c7,_0x5d8314){var _0x4d1f19=_0x450969||client;return _0x4d1f19[_0x4df7('0x1f')](_0x1df1c8,_0x4d174e)['then'](function(_0x54f6c8){logger[_0x4df7('0x20')](_0x4df7('0x21'),_0x4451fe,_0x4df7('0x22'));logger[_0x4df7('0x23')](_0x4df7('0x24'),_0x4451fe,_0x4df7('0x22'),JSON['stringify'](_0x54f6c8));if(_0x54f6c8[_0x4df7('0x25')]){if(_0x54f6c8['error'][_0x4df7('0x26')]===0x1f4){logger[_0x4df7('0x25')](_0x4df7('0x21'),_0x4451fe,_0x54f6c8[_0x4df7('0x25')]['message']);return _0x5d8314(_0x54f6c8[_0x4df7('0x25')][_0x4df7('0x27')]);}logger[_0x4df7('0x25')](_0x4df7('0x21'),_0x4451fe,_0x54f6c8[_0x4df7('0x25')][_0x4df7('0x27')]);return _0x1d27c7(_0x54f6c8['error'][_0x4df7('0x27')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x4451fe,_0x4df7('0x22'));_0x1d27c7(_0x54f6c8[_0x4df7('0x28')][_0x4df7('0x27')]);}})[_0x4df7('0x29')](function(_0x43d4b4){logger[_0x4df7('0x25')](_0x4df7('0x21'),_0x4451fe,_0x43d4b4);_0x5d8314(_0x43d4b4);});});}function respondWithStatusCode(_0x4cdf6e,_0x573683){_0x573683=_0x573683||0xcc;return function(_0x473e4d){if(_0x473e4d){return _0x4cdf6e['sendStatus'](_0x573683);}return _0x4cdf6e[_0x4df7('0x2a')](_0x573683)['end']();};}function respondWithResult(_0x343e73,_0xc3b8c6){_0xc3b8c6=_0xc3b8c6||0xc8;return function(_0x45cd3d){if(_0x45cd3d){return _0x343e73[_0x4df7('0x2a')](_0xc3b8c6)[_0x4df7('0x2b')](_0x45cd3d);}};}function respondWithFilteredResult(_0xa58366,_0x29d555){return function(_0x5e7155){if(_0x5e7155){var _0x259d38=typeof _0x29d555['offset']==='undefined'&&typeof _0x29d555[_0x4df7('0x2c')]===_0x4df7('0x2d');var _0x422aa7=_0x5e7155[_0x4df7('0x2e')];var _0x216f18=_0x259d38?0x0:_0x29d555['offset'];var _0x356e1b=_0x259d38?_0x5e7155[_0x4df7('0x2e')]:_0x29d555['offset']+_0x29d555['limit'];var _0x568bcc;if(_0x356e1b>=_0x422aa7){_0x356e1b=_0x422aa7;_0x568bcc=0xc8;}else{_0x568bcc=0xce;}_0xa58366[_0x4df7('0x2a')](_0x568bcc);return _0xa58366['set'](_0x4df7('0x2f'),_0x216f18+'-'+_0x356e1b+'/'+_0x422aa7)[_0x4df7('0x2b')](_0x5e7155);}return null;};}function patchUpdates(_0x45adb1){return function(_0x2bfd29){try{jsonpatch[_0x4df7('0x30')](_0x2bfd29,_0x45adb1,!![]);}catch(_0x5c3764){return BPromise[_0x4df7('0x31')](_0x5c3764);}return _0x2bfd29[_0x4df7('0x32')]();};}function saveUpdates(_0x326bde,_0x144502){return function(_0x584ad1){if(_0x584ad1){return _0x584ad1['update'](_0x326bde)[_0x4df7('0x33')](function(_0x25c5cc){return _0x25c5cc;});}return null;};}function removeEntity(_0x587657,_0x372b4a){return function(_0x3da26f){if(_0x3da26f){return _0x3da26f[_0x4df7('0x34')]()[_0x4df7('0x33')](function(){_0x587657[_0x4df7('0x2a')](0xcc)[_0x4df7('0x35')]();});}};}function handleEntityNotFound(_0x59e44b,_0x27cfa2){return function(_0x41a80a){if(!_0x41a80a){_0x59e44b[_0x4df7('0x36')](0x194);}return _0x41a80a;};}function handleError(_0x1d900d,_0x43fd78){_0x43fd78=_0x43fd78||0x1f4;return function(_0x55e983){logger[_0x4df7('0x25')](_0x55e983[_0x4df7('0x37')]);if(_0x55e983[_0x4df7('0x38')]){delete _0x55e983['name'];}_0x1d900d['status'](_0x43fd78)[_0x4df7('0x39')](_0x55e983);};}exports[_0x4df7('0x3a')]=function(_0x16d503,_0x598afb){var _0x5c6132={},_0x36a94a={},_0x2e09d0={'count':0x0,'rows':[]};var _0x51b49f=_[_0x4df7('0x3b')](db[_0x4df7('0x3c')][_0x4df7('0x3d')],function(_0x531883){return{'name':_0x531883['fieldName'],'type':_0x531883[_0x4df7('0x3e')][_0x4df7('0x3f')]};});_0x36a94a[_0x4df7('0x40')]=_[_0x4df7('0x3b')](_0x51b49f,_0x4df7('0x38'));_0x36a94a['query']=_[_0x4df7('0x41')](_0x16d503[_0x4df7('0x42')]);_0x36a94a[_0x4df7('0x43')]=_['intersection'](_0x36a94a['model'],_0x36a94a[_0x4df7('0x42')]);_0x5c6132[_0x4df7('0x44')]=_[_0x4df7('0x45')](_0x36a94a['model'],qs[_0x4df7('0x46')](_0x16d503[_0x4df7('0x42')][_0x4df7('0x46')]));_0x5c6132[_0x4df7('0x44')]=_0x5c6132[_0x4df7('0x44')][_0x4df7('0x47')]?_0x5c6132[_0x4df7('0x44')]:_0x36a94a[_0x4df7('0x40')];if(!_0x16d503[_0x4df7('0x42')][_0x4df7('0x48')](_0x4df7('0x49'))){_0x5c6132['limit']=qs[_0x4df7('0x2c')](_0x16d503[_0x4df7('0x42')][_0x4df7('0x2c')]);_0x5c6132[_0x4df7('0x4a')]=qs[_0x4df7('0x4a')](_0x16d503[_0x4df7('0x42')]['offset']);}_0x5c6132['order']=qs['sort'](_0x16d503[_0x4df7('0x42')][_0x4df7('0x4b')]);_0x5c6132['where']=qs['filters'](_['pick'](_0x16d503[_0x4df7('0x42')],_0x36a94a[_0x4df7('0x43')]),_0x51b49f);if(_0x16d503[_0x4df7('0x42')]['filter']){_0x5c6132['where']=_[_0x4df7('0x4c')](_0x5c6132['where'],{'$or':_[_0x4df7('0x3b')](_0x51b49f,function(_0x174b38){if(_0x174b38['type']!==_0x4df7('0x4d')){var _0x3ae4b2={};_0x3ae4b2[_0x174b38[_0x4df7('0x38')]]={'$like':'%'+_0x16d503[_0x4df7('0x42')][_0x4df7('0x4e')]+'%'};return _0x3ae4b2;}})});}_0x5c6132=_[_0x4df7('0x4c')]({},_0x5c6132,_0x16d503[_0x4df7('0x4f')]);var _0x40fb5f={'where':_0x5c6132[_0x4df7('0x50')]};return db['WhatsappMessage'][_0x4df7('0x2e')](_0x40fb5f)[_0x4df7('0x33')](function(_0x157199){_0x2e09d0['count']=_0x157199;if(_0x16d503[_0x4df7('0x42')]['includeAll']){_0x5c6132[_0x4df7('0x51')]=[{'all':!![]}];}return db[_0x4df7('0x3c')][_0x4df7('0x52')](_0x5c6132);})[_0x4df7('0x33')](function(_0x2a50f3){_0x2e09d0[_0x4df7('0x53')]=_0x2a50f3;return _0x2e09d0;})[_0x4df7('0x33')](respondWithFilteredResult(_0x598afb,_0x5c6132))[_0x4df7('0x29')](handleError(_0x598afb,null));};exports[_0x4df7('0x54')]=function(_0x1eedd1,_0xf53ca4){var _0x3f705b={'raw':!![],'where':{'id':_0x1eedd1['params']['id']}},_0x56dda3={};_0x56dda3['model']=_[_0x4df7('0x41')](db['WhatsappMessage'][_0x4df7('0x3d')]);_0x56dda3[_0x4df7('0x42')]=_['keys'](_0x1eedd1['query']);_0x56dda3[_0x4df7('0x43')]=_[_0x4df7('0x45')](_0x56dda3['model'],_0x56dda3[_0x4df7('0x42')]);_0x3f705b[_0x4df7('0x44')]=_[_0x4df7('0x45')](_0x56dda3[_0x4df7('0x40')],qs[_0x4df7('0x46')](_0x1eedd1[_0x4df7('0x42')][_0x4df7('0x46')]));_0x3f705b[_0x4df7('0x44')]=_0x3f705b[_0x4df7('0x44')][_0x4df7('0x47')]?_0x3f705b[_0x4df7('0x44')]:_0x56dda3[_0x4df7('0x40')];if(_0x1eedd1[_0x4df7('0x42')][_0x4df7('0x55')]){_0x3f705b[_0x4df7('0x51')]=[{'all':!![]}];}_0x3f705b=_[_0x4df7('0x4c')]({},_0x3f705b,_0x1eedd1[_0x4df7('0x4f')]);return db['WhatsappMessage'][_0x4df7('0x56')](_0x3f705b)[_0x4df7('0x33')](handleEntityNotFound(_0xf53ca4,null))[_0x4df7('0x33')](respondWithResult(_0xf53ca4,null))['catch'](handleError(_0xf53ca4,null));};exports[_0x4df7('0x57')]=function(_0x335aff,_0x4bd03b){return db[_0x4df7('0x3c')]['create'](_0x335aff[_0x4df7('0x58')],{})[_0x4df7('0x33')](respondWithResult(_0x4bd03b,0xc9))[_0x4df7('0x29')](handleError(_0x4bd03b,null));};exports[_0x4df7('0x59')]=function(_0x59c220,_0x4a2d82){if(_0x59c220[_0x4df7('0x58')]['id']){delete _0x59c220[_0x4df7('0x58')]['id'];}return db[_0x4df7('0x3c')][_0x4df7('0x56')]({'where':{'id':_0x59c220[_0x4df7('0x5a')]['id']}})[_0x4df7('0x33')](handleEntityNotFound(_0x4a2d82,null))['then'](saveUpdates(_0x59c220[_0x4df7('0x58')],null))[_0x4df7('0x33')](respondWithResult(_0x4a2d82,null))[_0x4df7('0x29')](handleError(_0x4a2d82,null));};exports['destroy']=function(_0x3e47e8,_0x4029b1){return db['WhatsappMessage'][_0x4df7('0x56')]({'where':{'id':_0x3e47e8['params']['id']}})['then'](handleEntityNotFound(_0x4029b1,null))['then'](removeEntity(_0x4029b1,null))[_0x4df7('0x29')](handleError(_0x4029b1,null));};exports[_0x4df7('0x5b')]=function(_0x30b8ef,_0x5b526d){return db[_0x4df7('0x3c')][_0x4df7('0x5b')]()['then'](respondWithResult(_0x5b526d,null))[_0x4df7('0x29')](handleError(_0x5b526d,null));};var interaction_log=require(_0x4df7('0x14'))('whatsapp-interactions');exports['accept']=function(_0x285780,_0x2facf9,_0x2eb37c){var _0x3ca2ad={'agent':{},'channel':_0x4df7('0x5c')};if(_0x285780[_0x4df7('0x58')]['id']){delete _0x285780[_0x4df7('0x58')]['id'];}_0x285780['body'][_0x4df7('0x5d')]=!![];_0x285780[_0x4df7('0x58')][_0x4df7('0x5e')]=moment()[_0x4df7('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x285780['body'][_0x4df7('0x60')]=_0x285780[_0x4df7('0x58')][_0x4df7('0x60')]||_0x285780[_0x4df7('0x61')]['id'];_0x3ca2ad[_0x4df7('0x62')]['id']=_0x285780[_0x4df7('0x58')][_0x4df7('0x60')];return db[_0x4df7('0x3c')]['find']({'where':{'id':_0x285780[_0x4df7('0x5a')]['id'],'UserId':null}})[_0x4df7('0x33')](handleEntityNotFound(_0x2facf9,null))[_0x4df7('0x33')](saveUpdates(_0x285780[_0x4df7('0x58')],null))[_0x4df7('0x33')](function(_0x4dc389){if(_0x4dc389){_0x3ca2ad[_0x4df7('0x27')]=_0x4dc389[_0x4df7('0x63')]({'plain':!![]});return db['WhatsappInteraction'][_0x4df7('0x56')]({'where':{'id':_0x4dc389[_0x4df7('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x2facf9,null))[_0x4df7('0x33')](function(_0x4ccdf1){if(_0x4ccdf1){return _0x4ccdf1[_0x4df7('0x59')]({'UserId':_0x285780[_0x4df7('0x58')]['UserId'],'read1stAt':_[_0x4df7('0x65')](_0x4ccdf1[_0x4df7('0x66')])?moment()[_0x4df7('0x5f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x4df7('0x33')](function(_0x59c81b){if(_0x59c81b){_0x3ca2ad[_0x4df7('0x67')]=_0x59c81b[_0x4df7('0x63')]({'plain':!![]});interaction_log[_0x4df7('0x20')](_0x4df7('0x68'),_0x285780[_0x4df7('0x61')]['id'],_0x285780[_0x4df7('0x61')][_0x4df7('0x38')],_0x285780['user'][_0x4df7('0x69')],_0x3ca2ad[_0x4df7('0x67')]['id'],_0x285780[_0x4df7('0x58')]?JSON[_0x4df7('0x6a')](_0x285780[_0x4df7('0x58')]):_0x4df7('0x6b'));return respondWithRpcPromise('AcceptMessage',_0x4df7('0x6c'),_0x3ca2ad);}return null;})[_0x4df7('0x33')](function(_0x136492){var _0x39e4d3=_0x4df7('0x6d')+_0x136492['message']['ContactId'];return db['sequelize'][_0x4df7('0x42')](_0x39e4d3,{'type':db[_0x4df7('0x6e')][_0x4df7('0x6f')][_0x4df7('0x70')],'raw':!![]})[_0x4df7('0x33')](function(_0x262907){return _0x262907;});})['then'](function(_0x744e5a){if(_0x744e5a){_0x3ca2ad[_0x4df7('0x27')][_0x4df7('0x71')]=_0x744e5a[0x0];if(!_0x285780[_0x4df7('0x58')][_0x4df7('0x60')])return;return db[_0x4df7('0x72')][_0x4df7('0x56')]({'where':{'id':_0x285780[_0x4df7('0x58')][_0x4df7('0x60')],'role':_0x4df7('0x62')},'attributes':['id',_0x4df7('0x38'),_0x4df7('0x73'),_0x4df7('0x74'),_0x4df7('0x75')],'raw':!![]});}return null;})['then'](function(_0x5f0c9c){if(!_0x5f0c9c)return null;_0x3ca2ad[_0x4df7('0x27')][_0x4df7('0x62')]=_0x5f0c9c;return _0x3ca2ad;})[_0x4df7('0x33')](function(_0x200d33){if(_0x200d33){if(_0x285780['body'][_0x4df7('0x76')]){_0x3ca2ad[_0x4df7('0x27')][_0x4df7('0x77')]=util[_0x4df7('0x5f')](_0x4df7('0x78'),_0x285780[_0x4df7('0x61')][_0x4df7('0x38')]);_0x3ca2ad[_0x4df7('0x27')]['channel']=_0x3ca2ad[_0x4df7('0x79')];_0x3ca2ad['message'][_0x4df7('0x7a')]=_0x4df7('0x7b');return respondWithRpcPromise(_0x4df7('0x7c'),'EventManager',{'event':_0x4df7('0x7d'),'message':_0x3ca2ad[_0x4df7('0x27')]},client9002)[_0x4df7('0x33')](function(){return _0x3ca2ad;});}return _0x3ca2ad;}return null;})[_0x4df7('0x33')](respondWithResult(_0x2facf9,null))[_0x4df7('0x29')](handleError(_0x2facf9,null));};var interaction_log=require(_0x4df7('0x14'))(_0x4df7('0x7e'));exports[_0x4df7('0x31')]=function(_0x23647c,_0x180370,_0xdc8961){var _0x5b7057={'agent':{},'channel':'whatsapp'};if(_0x23647c[_0x4df7('0x58')]['id']){delete _0x23647c['body']['id'];}_0x23647c[_0x4df7('0x58')][_0x4df7('0x60')]=_0x23647c['body'][_0x4df7('0x60')]||_0x23647c[_0x4df7('0x61')]['id'];_0x5b7057['agent']['id']=_0x23647c[_0x4df7('0x58')][_0x4df7('0x60')];return db[_0x4df7('0x3c')][_0x4df7('0x56')]({'where':{'id':_0x23647c['params']['id'],'UserId':null}})[_0x4df7('0x33')](handleEntityNotFound(_0x180370,null))[_0x4df7('0x33')](function(_0x32ec8c){if(_0x32ec8c){_0x5b7057[_0x4df7('0x27')]=_0x32ec8c[_0x4df7('0x63')]({'plain':!![]});return db[_0x4df7('0x7f')][_0x4df7('0x56')]({'where':{'id':_0x32ec8c[_0x4df7('0x64')]}});}return null;})[_0x4df7('0x33')](handleEntityNotFound(_0x180370,null))[_0x4df7('0x33')](function(_0x4b4728){if(_0x4b4728){_0x5b7057[_0x4df7('0x67')]=_0x4b4728[_0x4df7('0x63')]({'plain':!![]});interaction_log[_0x4df7('0x20')](_0x4df7('0x80'),_0x23647c['user']['id'],_0x23647c[_0x4df7('0x61')][_0x4df7('0x38')],_0x23647c[_0x4df7('0x61')][_0x4df7('0x69')],_0x5b7057[_0x4df7('0x67')]['id'],_0x23647c[_0x4df7('0x58')]?JSON[_0x4df7('0x6a')](_0x23647c[_0x4df7('0x58')]):'null');return respondWithRpcPromise(_0x4df7('0x81'),_0x4df7('0x82'),_0x5b7057);}return null;})[_0x4df7('0x33')](function(_0x9d33e0){var _0x34c1f7=_0x4df7('0x6d')+_0x9d33e0['message'][_0x4df7('0x83')];return db['sequelize'][_0x4df7('0x42')](_0x34c1f7,{'type':db[_0x4df7('0x6e')][_0x4df7('0x6f')][_0x4df7('0x70')],'raw':!![]})[_0x4df7('0x33')](function(_0x427ec2){return _0x427ec2;});})[_0x4df7('0x33')](function(_0x2779fe){if(_0x2779fe){_0x5b7057[_0x4df7('0x27')][_0x4df7('0x71')]=_0x2779fe[0x0];if(!_0x23647c[_0x4df7('0x58')][_0x4df7('0x60')])return;return db[_0x4df7('0x72')][_0x4df7('0x56')]({'where':{'id':_0x23647c[_0x4df7('0x58')][_0x4df7('0x60')],'role':_0x4df7('0x62')},'attributes':['id','name',_0x4df7('0x73'),_0x4df7('0x74'),_0x4df7('0x75')],'raw':!![]});}return null;})[_0x4df7('0x33')](function(_0x1e0e95){if(!_0x1e0e95)return null;_0x5b7057['message'][_0x4df7('0x62')]=_0x1e0e95;return _0x5b7057;})[_0x4df7('0x33')](function(_0x4cb6dd){if(_0x4cb6dd){_0x4cb6dd[_0x4df7('0x27')][_0x4df7('0x77')]=util['format'](_0x4df7('0x78'),_0x23647c['user'][_0x4df7('0x38')]);_0x4cb6dd[_0x4df7('0x27')][_0x4df7('0x79')]=_0x5b7057[_0x4df7('0x79')];_0x4cb6dd[_0x4df7('0x27')][_0x4df7('0x7a')]=_0x4df7('0x31');respondWithRpcPromise(_0x4df7('0x7c'),_0x4df7('0x7c'),{'event':_0x4df7('0x84'),'message':_0x4cb6dd['message']},client9002);return _0x5b7057;}return null;})[_0x4df7('0x33')](respondWithResult(_0x180370,null))['catch'](handleError(_0x180370,null));};exports[_0x4df7('0x2a')]=function(_0x169956,_0x32952c,_0x5346f3){if(_0x169956[_0x4df7('0x58')]['id']){delete _0x169956[_0x4df7('0x58')]['id'];}var _0x5cb536;return db[_0x4df7('0x3c')][_0x4df7('0x56')]({'where':{'id':_0x169956[_0x4df7('0x5a')]['id']}})['then'](handleEntityNotFound(_0x32952c,null))[_0x4df7('0x33')](function(_0x271141){if(_0x271141){_0x5cb536=_0x271141;return db[_0x4df7('0x85')][_0x4df7('0x56')]({'where':{'id':_0x271141[_0x4df7('0x86')]}});}})[_0x4df7('0x33')](handleEntityNotFound(_0x32952c,null))[_0x4df7('0x33')](function(_0x42c521){if(_0x42c521){logger[_0x4df7('0x23')](_0x4df7('0x87'),_0x4df7('0x2a'),'received\x20delivery\x20report\x20from',_0x42c521[_0x4df7('0x3e')],util[_0x4df7('0x88')](_0x169956[_0x4df7('0x58')],{'showHidden':![],'depth':null}));switch(_0x42c521[_0x4df7('0x3e')]){case _0x4df7('0x89'):if(_0x169956['body'][_0x4df7('0x8a')]&&_0x169956[_0x4df7('0x58')]['MessageSid']===_0x5cb536['messageId']&&_0x169956[_0x4df7('0x58')]['MessageStatus']&&_0x169956[_0x4df7('0x58')][_0x4df7('0x8b')]==='read'){return _0x5cb536[_0x4df7('0x59')]({'read':!![]});}else{logger[_0x4df7('0x25')](_0x4df7('0x8c'),_0x4df7('0x2a'),_0x4df7('0x89'),util[_0x4df7('0x88')](_0x169956[_0x4df7('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x5cb536;}})[_0x4df7('0x33')](respondWithResult(_0x32952c,null))[_0x4df7('0x29')](handleError(_0x32952c,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 20fd266..d29b1a5 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 _0x2547=['hasOwnProperty','exports','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','emit'];(function(_0x3dc68d,_0x1c1951){var _0xdf7f94=function(_0x339428){while(--_0x339428){_0x3dc68d['push'](_0x3dc68d['shift']());}};_0xdf7f94(++_0x1c1951);}(_0x2547,0x1cd));var _0x7254=function(_0x9e3b7f,_0x272d11){_0x9e3b7f=_0x9e3b7f-0x0;var _0x4fd9e4=_0x2547[_0x9e3b7f];return _0x4fd9e4;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x7254('0x0'))['db'][_0x7254('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x7254('0x2')](0x0);var events={'afterCreate':_0x7254('0x3'),'afterUpdate':_0x7254('0x4'),'afterDestroy':_0x7254('0x5')};function emitEvent(_0x9f3435){return function(_0x265ebf,_0x53a02f,_0x2ddeae){WhatsappMessageEvents[_0x7254('0x6')](_0x9f3435+':'+_0x265ebf['id'],_0x265ebf);WhatsappMessageEvents[_0x7254('0x6')](_0x9f3435,_0x265ebf);_0x2ddeae(null);};}for(var e in events){if(events[_0x7254('0x7')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x7254('0x8')]=WhatsappMessageEvents; \ No newline at end of file +var _0xc2da=['emit','hasOwnProperty','hook','exports','events','WhatsappMessage','save','remove'];(function(_0x75ce5b,_0x3b582f){var _0x22195e=function(_0x166668){while(--_0x166668){_0x75ce5b['push'](_0x75ce5b['shift']());}};_0x22195e(++_0x3b582f);}(_0xc2da,0x124));var _0xac2d=function(_0x354e7a,_0x4e4dc0){_0x354e7a=_0x354e7a-0x0;var _0x17b550=_0xc2da[_0x354e7a];return _0x17b550;};'use strict';var EventEmitter=require(_0xac2d('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xac2d('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xac2d('0x2'),'afterUpdate':'update','afterDestroy':_0xac2d('0x3')};function emitEvent(_0xb261fc){return function(_0xff0fff,_0x332f28,_0x120263){WhatsappMessageEvents[_0xac2d('0x4')](_0xb261fc+':'+_0xff0fff['id'],_0xff0fff);WhatsappMessageEvents[_0xac2d('0x4')](_0xb261fc,_0xff0fff);_0x120263(null);};}for(var e in events){if(events[_0xac2d('0x5')](e)){var event=events[e];WhatsappMessage[_0xac2d('0x6')](e,emitEvent(event));}}module[_0xac2d('0x7')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 80c94e5..bda4c65 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 _0x753c=['catch','error','WhatsappAccount','find','WhatsappAccountId','then','type','twilio','accountSid','authToken','phone','messages','create','body','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./whatsappMessage.attributes','exports','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','models','get','direction','toLowerCase','out','secret','isNil','findOne','update','createdAt'];(function(_0x2fce43,_0x1d9626){var _0x537102=function(_0xe100d2){while(--_0xe100d2){_0x2fce43['push'](_0x2fce43['shift']());}};_0x537102(++_0x1d9626);}(_0x753c,0x79));var _0xc753=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x753c[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0xc753('0x0'));var util=require(_0xc753('0x1'));var logger=require(_0xc753('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc753('0x3'));var rp=require(_0xc753('0x4'));var fs=require('fs');var path=require(_0xc753('0x5'));var rimraf=require('rimraf');var config=require(_0xc753('0x6'));var attributes=require(_0xc753('0x7'));module[_0xc753('0x8')]=function(_0x3908b3,_0x269f98){return _0x3908b3['define'](_0xc753('0x9'),attributes,{'tableName':_0xc753('0xa'),'paranoid':![],'indexes':[{'name':_0xc753('0xb'),'fields':[_0xc753('0xb')]},{'name':_0xc753('0xc'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x556e92,_0x1e4579,_0x3a153e){var _0x3013d0=_0x3908b3[_0xc753('0xd')];var _0x4482af=_0x556e92[_0xc753('0xe')]({'plain':!![]});if(_0x4482af[_0xc753('0xf')][_0xc753('0x10')]()==='in'||_0x4482af[_0xc753('0xf')]['toLowerCase']()===_0xc753('0x11')&&!_0x4482af[_0xc753('0x12')]&&!_[_0xc753('0x13')](_0x4482af['UserId'])){_0x3013d0['WhatsappInteraction'][_0xc753('0x14')]({'where':{'id':_0x4482af['WhatsappInteractionId']}})['then'](function(_0x63ed32){if(_0x63ed32){_0x63ed32[_0xc753('0x15')]({'lastMsgAt':_0x4482af[_0xc753('0x16')],'lastMsgDirection':_0x4482af[_0xc753('0xf')]['toLowerCase']()});}})[_0xc753('0x17')](function(_0x3fbfd6){console[_0xc753('0x18')](_0x3fbfd6);});}if(_0x4482af['direction']===_0xc753('0x11')&&!_0x4482af[_0xc753('0x12')]){var _0x22ed90;_0x3013d0[_0xc753('0x19')][_0xc753('0x1a')]({'where':{'id':_0x4482af[_0xc753('0x1b')]},'raw':!![]})[_0xc753('0x1c')](function(_0x41e1cc){_0x22ed90=_0x41e1cc;if(_0x22ed90&&_0x22ed90[_0xc753('0x1d')]){switch(_0x22ed90[_0xc753('0x1d')]){case _0xc753('0x1e'):var _0xdd73ec=require(_0xc753('0x1e'));if(_0x22ed90[_0xc753('0x1f')]&&_0x22ed90[_0xc753('0x20')]&&_0x22ed90[_0xc753('0x21')]){var _0x567c78=new _0xdd73ec(_0x22ed90[_0xc753('0x1f')],_0x22ed90[_0xc753('0x20')]);_0x567c78[_0xc753('0x22')][_0xc753('0x23')]({'body':_0x4482af[_0xc753('0x24')],'to':'whatsapp:'+_0x4482af[_0xc753('0x21')],'from':_0xc753('0x25')+_0x22ed90[_0xc753('0x21')],'statusCallback':_0x22ed90[_0xc753('0x26')]+_0xc753('0x27')+_0x4482af['id']+_0xc753('0x28')+_0x22ed90[_0xc753('0x29')]})['then'](function(_0x28a241){if(_0x28a241[_0xc753('0x2a')]){return _0x556e92[_0xc753('0x15')]({'messageId':_0x28a241[_0xc753('0x2a')]});}})[_0xc753('0x17')](function(_0x198c89){logger[_0xc753('0x18')](_0xc753('0x2b'),_0xc753('0x2c'),'twilio',util['inspect'](_0x198c89,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xc753('0x2b'),_0xc753('0x2c'),_0xc753('0x1e'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;}}})[_0xc753('0x2d')](function(){_0x3a153e();});}else{_0x3a153e();}}},'charset':_0xc753('0x2e'),'collate':_0xc753('0x2f')});}; \ No newline at end of file +var _0x2eb6=['exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','toLowerCase','direction','UserId','createdAt','catch','error','out','secret','WhatsappAccount','find','WhatsappAccountId','type','accountSid','authToken','messages','create','whatsapp:','phone','remote','/api/whatsapp/messages/','/status?token=','token','then','update','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','twilio','inspect','afterCreate','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path','rimraf','./whatsappMessage.attributes'];(function(_0x411870,_0x376770){var _0x2ce62e=function(_0x4dd764){while(--_0x4dd764){_0x411870['push'](_0x411870['shift']());}};_0x2ce62e(++_0x376770);}(_0x2eb6,0x1ce));var _0x62eb=function(_0x138e49,_0x52366f){_0x138e49=_0x138e49-0x0;var _0x3d5167=_0x2eb6[_0x138e49];return _0x3d5167;};'use strict';var _=require(_0x62eb('0x0'));var util=require(_0x62eb('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x62eb('0x2'));var BPromise=require(_0x62eb('0x3'));var rp=require(_0x62eb('0x4'));var fs=require('fs');var path=require(_0x62eb('0x5'));var rimraf=require(_0x62eb('0x6'));var config=require('../../config/environment');var attributes=require(_0x62eb('0x7'));module[_0x62eb('0x8')]=function(_0x1b7631,_0x5a0964){return _0x1b7631[_0x62eb('0x9')](_0x62eb('0xa'),attributes,{'tableName':_0x62eb('0xb'),'paranoid':![],'indexes':[{'name':_0x62eb('0xc'),'fields':['messageId']},{'name':_0x62eb('0xd'),'fields':[_0x62eb('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x208fcf,_0x20e772,_0x370a99){var _0xd35692=_0x1b7631['models'];var _0x4405c0=_0x208fcf['get']({'plain':!![]});if(_0x4405c0['direction'][_0x62eb('0xf')]()==='in'||_0x4405c0[_0x62eb('0x10')]['toLowerCase']()==='out'&&!_0x4405c0['secret']&&!_['isNil'](_0x4405c0[_0x62eb('0x11')])){_0xd35692['WhatsappInteraction']['findOne']({'where':{'id':_0x4405c0['WhatsappInteractionId']}})['then'](function(_0x48d0dc){if(_0x48d0dc){_0x48d0dc['update']({'lastMsgAt':_0x4405c0[_0x62eb('0x12')],'lastMsgDirection':_0x4405c0['direction'][_0x62eb('0xf')]()});}})[_0x62eb('0x13')](function(_0x289050){console[_0x62eb('0x14')](_0x289050);});}if(_0x4405c0[_0x62eb('0x10')]===_0x62eb('0x15')&&!_0x4405c0[_0x62eb('0x16')]){var _0x208f3d;_0xd35692[_0x62eb('0x17')][_0x62eb('0x18')]({'where':{'id':_0x4405c0[_0x62eb('0x19')]},'raw':!![]})['then'](function(_0xe23c02){_0x208f3d=_0xe23c02;if(_0x208f3d&&_0x208f3d[_0x62eb('0x1a')]){switch(_0x208f3d[_0x62eb('0x1a')]){case'twilio':var _0x298840=require('twilio');if(_0x208f3d[_0x62eb('0x1b')]&&_0x208f3d[_0x62eb('0x1c')]&&_0x208f3d['phone']){var _0x5b6da5=new _0x298840(_0x208f3d[_0x62eb('0x1b')],_0x208f3d[_0x62eb('0x1c')]);_0x5b6da5[_0x62eb('0x1d')][_0x62eb('0x1e')]({'body':_0x4405c0[_0x62eb('0xe')],'to':_0x62eb('0x1f')+_0x4405c0[_0x62eb('0x20')],'from':_0x62eb('0x1f')+_0x208f3d[_0x62eb('0x20')],'statusCallback':_0x208f3d[_0x62eb('0x21')]+_0x62eb('0x22')+_0x4405c0['id']+_0x62eb('0x23')+_0x208f3d[_0x62eb('0x24')]})[_0x62eb('0x25')](function(_0x4937ef){if(_0x4937ef['sid']){return _0x208fcf[_0x62eb('0x26')]({'messageId':_0x4937ef[_0x62eb('0x27')]});}})[_0x62eb('0x13')](function(_0x273221){logger[_0x62eb('0x14')](_0x62eb('0x28'),'afterCreate',_0x62eb('0x29'),util[_0x62eb('0x2a')](_0x273221,{'showHidden':![],'depth':null}));});}else{logger[_0x62eb('0x14')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x62eb('0x2b'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;}}})[_0x62eb('0x2c')](function(){_0x370a99();});}else{_0x370a99();}}},'charset':_0x62eb('0x2d'),'collate':_0x62eb('0x2e')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 2c3cc20..b0552e1 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 _0x8a58=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','CreateWhatsappMessage','WhatsappMessage','body','options','raw','util','moment','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x192306,_0x345a3c){var _0x211126=function(_0x587d65){while(--_0x587d65){_0x192306['push'](_0x192306['shift']());}};_0x211126(++_0x345a3c);}(_0x8a58,0x1db));var _0x88a5=function(_0x191460,_0x16a0cb){_0x191460=_0x191460-0x0;var _0x49eeaa=_0x8a58[_0x191460];return _0x49eeaa;};'use strict';var _=require('lodash');var util=require(_0x88a5('0x0'));var moment=require(_0x88a5('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x88a5('0x2'))['db'];var utils=require(_0x88a5('0x3'));var logger=require(_0x88a5('0x4'))(_0x88a5('0x5'));var config=require(_0x88a5('0x6'));var jayson=require(_0x88a5('0x7'));var client=jayson[_0x88a5('0x8')][_0x88a5('0x9')]({'port':0x232a});config[_0x88a5('0xa')]=_[_0x88a5('0xb')](config[_0x88a5('0xa')],{'host':_0x88a5('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x88a5('0xa')]));require('./whatsappMessage.socket')[_0x88a5('0xd')](socket);function respondWithRpcPromise(_0x551a72,_0x16db2f,_0x539b1d){return new BPromise(function(_0x1138e3,_0x2df392){return client[_0x88a5('0xe')](_0x551a72,_0x539b1d)[_0x88a5('0xf')](function(_0x108561){logger[_0x88a5('0x10')](_0x88a5('0x11'),_0x16db2f,_0x88a5('0x12'));logger[_0x88a5('0x13')](_0x88a5('0x14'),_0x16db2f,_0x88a5('0x12'),JSON[_0x88a5('0x15')](_0x108561));if(_0x108561['error']){if(_0x108561['error'][_0x88a5('0x16')]===0x1f4){logger[_0x88a5('0x17')](_0x88a5('0x11'),_0x16db2f,_0x108561[_0x88a5('0x17')][_0x88a5('0x18')]);return _0x2df392(_0x108561['error'][_0x88a5('0x18')]);}logger[_0x88a5('0x17')](_0x88a5('0x11'),_0x16db2f,_0x108561['error'][_0x88a5('0x18')]);return _0x1138e3(_0x108561['error'][_0x88a5('0x18')]);}else{logger[_0x88a5('0x10')](_0x88a5('0x11'),_0x16db2f,'request\x20sent');_0x1138e3(_0x108561[_0x88a5('0x19')]['message']);}})[_0x88a5('0x1a')](function(_0x35eb42){logger[_0x88a5('0x17')](_0x88a5('0x11'),_0x16db2f,_0x35eb42);_0x2df392(_0x35eb42);});});}exports[_0x88a5('0x1b')]=function(_0xb7c201){var _0x5b6be0=this;return new Promise(function(_0x2632fe,_0x572d5c){return db[_0x88a5('0x1c')]['create'](_0xb7c201[_0x88a5('0x1d')],{'raw':_0xb7c201[_0x88a5('0x1e')]?_0xb7c201[_0x88a5('0x1e')][_0x88a5('0x1f')]===undefined?!![]:![]:!![]})[_0x88a5('0xf')](function(_0x2eb457){logger['info'](_0x88a5('0x1b'),_0xb7c201);logger['debug'](_0x88a5('0x1b'),_0xb7c201,JSON[_0x88a5('0x15')](_0x2eb457));_0x2632fe(_0x2eb457);})[_0x88a5('0x1a')](function(_0x3ad7d1){logger[_0x88a5('0x17')](_0x88a5('0x1b'),_0x3ad7d1['message'],_0xb7c201);_0x572d5c(_0x5b6be0[_0x88a5('0x17')](0x1f4,_0x3ad7d1[_0x88a5('0x18')]));});});}; \ No newline at end of file +var _0x6a22=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','CreateWhatsappMessage','WhatsappMessage','body','options','raw','catch','lodash','util','bluebird'];(function(_0x44f6b7,_0x5b75af){var _0x5d612a=function(_0x122513){while(--_0x122513){_0x44f6b7['push'](_0x44f6b7['shift']());}};_0x5d612a(++_0x5b75af);}(_0x6a22,0x147));var _0x26a2=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x6a22[_0x13b02f];return _0x12e9a6;};'use strict';var _=require(_0x26a2('0x0'));var util=require(_0x26a2('0x1'));var moment=require('moment');var BPromise=require(_0x26a2('0x2'));var rs=require(_0x26a2('0x3'));var fs=require('fs');var Redis=require(_0x26a2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x26a2('0x5'));var logger=require(_0x26a2('0x6'))(_0x26a2('0x7'));var config=require(_0x26a2('0x8'));var jayson=require(_0x26a2('0x9'));var client=jayson[_0x26a2('0xa')]['http']({'port':0x232a});config[_0x26a2('0xb')]=_[_0x26a2('0xc')](config[_0x26a2('0xb')],{'host':_0x26a2('0xd'),'port':0x18eb});var socket=require(_0x26a2('0xe'))(new Redis(config[_0x26a2('0xb')]));require(_0x26a2('0xf'))[_0x26a2('0x10')](socket);function respondWithRpcPromise(_0x63d599,_0x2872bf,_0x107f05){return new BPromise(function(_0x40f92b,_0x549ca3){return client[_0x26a2('0x11')](_0x63d599,_0x107f05)[_0x26a2('0x12')](function(_0x334ec0){logger[_0x26a2('0x13')](_0x26a2('0x14'),_0x2872bf,'request\x20sent');logger[_0x26a2('0x15')](_0x26a2('0x16'),_0x2872bf,_0x26a2('0x17'),JSON['stringify'](_0x334ec0));if(_0x334ec0[_0x26a2('0x18')]){if(_0x334ec0[_0x26a2('0x18')][_0x26a2('0x19')]===0x1f4){logger[_0x26a2('0x18')]('WhatsappMessage,\x20%s,\x20%s',_0x2872bf,_0x334ec0[_0x26a2('0x18')][_0x26a2('0x1a')]);return _0x549ca3(_0x334ec0[_0x26a2('0x18')]['message']);}logger[_0x26a2('0x18')]('WhatsappMessage,\x20%s,\x20%s',_0x2872bf,_0x334ec0[_0x26a2('0x18')][_0x26a2('0x1a')]);return _0x40f92b(_0x334ec0[_0x26a2('0x18')]['message']);}else{logger[_0x26a2('0x13')]('WhatsappMessage,\x20%s,\x20%s',_0x2872bf,_0x26a2('0x17'));_0x40f92b(_0x334ec0['result']['message']);}})['catch'](function(_0x414579){logger[_0x26a2('0x18')](_0x26a2('0x14'),_0x2872bf,_0x414579);_0x549ca3(_0x414579);});});}exports[_0x26a2('0x1b')]=function(_0x322454){var _0x13892c=this;return new Promise(function(_0x3ab682,_0x435b36){return db[_0x26a2('0x1c')]['create'](_0x322454[_0x26a2('0x1d')],{'raw':_0x322454['options']?_0x322454[_0x26a2('0x1e')][_0x26a2('0x1f')]===undefined?!![]:![]:!![]})[_0x26a2('0x12')](function(_0x20e6f6){logger['info']('CreateWhatsappMessage',_0x322454);logger['debug']('CreateWhatsappMessage',_0x322454,JSON['stringify'](_0x20e6f6));_0x3ab682(_0x20e6f6);})[_0x26a2('0x20')](function(_0x1b7319){logger['error'](_0x26a2('0x1b'),_0x1b7319[_0x26a2('0x1a')],_0x322454);_0x435b36(_0x13892c[_0x26a2('0x18')](0x1f4,_0x1b7319[_0x26a2('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 8732385..96636e8 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 _0xc74d=['remove','update','emit','removeListener','register','length','./whatsappMessage.events','save'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xc74d,0x1ee));var _0xdc74=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xc74d[_0x413feb];return _0x40ee88;};'use strict';var WhatsappMessageEvents=require(_0xdc74('0x0'));var events=[_0xdc74('0x1'),_0xdc74('0x2'),_0xdc74('0x3')];function createListener(_0x1659f4,_0x998684){return function(_0x57aa54){_0x998684[_0xdc74('0x4')](_0x1659f4,_0x57aa54);};}function removeListener(_0x3da819,_0x49fb14){return function(){WhatsappMessageEvents[_0xdc74('0x5')](_0x3da819,_0x49fb14);};}exports[_0xdc74('0x6')]=function(_0x1ac09b){for(var _0x418a86=0x0,_0x72a6ff=events[_0xdc74('0x7')];_0x418a86<_0x72a6ff;_0x418a86++){var _0x52d67e=events[_0x418a86];var _0x77804f=createListener('whatsappMessage:'+_0x52d67e,_0x1ac09b);WhatsappMessageEvents['on'](_0x52d67e,_0x77804f);}}; \ No newline at end of file +var _0x5f4a=['register','length','whatsappMessage:','./whatsappMessage.events','save','remove','update','emit'];(function(_0x4933d4,_0x2b62b9){var _0x42ba96=function(_0x96df9f){while(--_0x96df9f){_0x4933d4['push'](_0x4933d4['shift']());}};_0x42ba96(++_0x2b62b9);}(_0x5f4a,0x14b));var _0xa5f4=function(_0x14e3dc,_0x46105a){_0x14e3dc=_0x14e3dc-0x0;var _0x9f6ef5=_0x5f4a[_0x14e3dc];return _0x9f6ef5;};'use strict';var WhatsappMessageEvents=require(_0xa5f4('0x0'));var events=[_0xa5f4('0x1'),_0xa5f4('0x2'),_0xa5f4('0x3')];function createListener(_0x3fac20,_0x98d203){return function(_0x1c2cf7){_0x98d203[_0xa5f4('0x4')](_0x3fac20,_0x1c2cf7);};}function removeListener(_0x5ed564,_0x1f3834){return function(){WhatsappMessageEvents['removeListener'](_0x5ed564,_0x1f3834);};}exports[_0xa5f4('0x5')]=function(_0x435b05){for(var _0x578288=0x0,_0x3645b0=events[_0xa5f4('0x6')];_0x578288<_0x3645b0;_0x578288++){var _0x103c73=events[_0x578288];var _0x4ee374=createListener(_0xa5f4('0x7')+_0x103c73,_0x435b05);WhatsappMessageEvents['on'](_0x103c73,_0x4ee374);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 1dff363..fc7dee6 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 _0x7961=['getAgents','post','addTeams','put','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','isAuthenticated','index','get','/describe','describe','show','getMembers','/:id/teams','getTeams','/:id/users'];(function(_0x228532,_0x30019c){var _0x82d902=function(_0x5546b8){while(--_0x5546b8){_0x228532['push'](_0x228532['shift']());}};_0x82d902(++_0x30019c);}(_0x7961,0x122));var _0x1796=function(_0x2d5805,_0x21954e){_0x2d5805=_0x2d5805-0x0;var _0x1cae4f=_0x7961[_0x2d5805];return _0x1cae4f;};'use strict';var multer=require(_0x1796('0x0'));var util=require(_0x1796('0x1'));var path=require(_0x1796('0x2'));var timeout=require(_0x1796('0x3'));var express=require(_0x1796('0x4'));var router=express[_0x1796('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x1796('0x6'));var interaction=require(_0x1796('0x7'));var config=require(_0x1796('0x8'));var controller=require(_0x1796('0x9'));router['get']('/',auth[_0x1796('0xa')](),controller[_0x1796('0xb')]);router[_0x1796('0xc')](_0x1796('0xd'),auth[_0x1796('0xa')](),controller[_0x1796('0xe')]);router[_0x1796('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x1796('0xf')]);router[_0x1796('0xc')]('/:id/members',auth[_0x1796('0xa')](),controller[_0x1796('0x10')]);router[_0x1796('0xc')](_0x1796('0x11'),auth[_0x1796('0xa')](),controller[_0x1796('0x12')]);router[_0x1796('0xc')](_0x1796('0x13'),auth[_0x1796('0xa')](),controller[_0x1796('0x14')]);router[_0x1796('0x15')]('/',auth[_0x1796('0xa')](),controller['create']);router[_0x1796('0x15')](_0x1796('0x11'),auth['isAuthenticated'](),controller[_0x1796('0x16')]);router[_0x1796('0x15')]('/:id/users',auth[_0x1796('0xa')](),controller['addAgents']);router[_0x1796('0x17')](_0x1796('0x18'),auth['isAuthenticated'](),controller[_0x1796('0x19')]);router[_0x1796('0x1a')](_0x1796('0x18'),auth['isAuthenticated'](),controller[_0x1796('0x1b')]);router[_0x1796('0x1a')](_0x1796('0x11'),auth[_0x1796('0xa')](),controller[_0x1796('0x1c')]);router['delete'](_0x1796('0x13'),auth[_0x1796('0xa')](),controller[_0x1796('0x1d')]);module[_0x1796('0x1e')]=router; \ No newline at end of file +var _0xe84a=['update','delete','destroy','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','put','/:id'];(function(_0x29802a,_0x2d2a54){var _0x11eb27=function(_0x25b281){while(--_0x25b281){_0x29802a['push'](_0x29802a['shift']());}};_0x11eb27(++_0x2d2a54);}(_0xe84a,0x113));var _0xae84=function(_0x41801d,_0x524d38){_0x41801d=_0x41801d-0x0;var _0x21c006=_0xe84a[_0x41801d];return _0x21c006;};'use strict';var multer=require(_0xae84('0x0'));var util=require(_0xae84('0x1'));var path=require(_0xae84('0x2'));var timeout=require(_0xae84('0x3'));var express=require(_0xae84('0x4'));var router=express[_0xae84('0x5')]();var fs_extra=require(_0xae84('0x6'));var auth=require(_0xae84('0x7'));var interaction=require(_0xae84('0x8'));var config=require(_0xae84('0x9'));var controller=require('./whatsappQueue.controller');router[_0xae84('0xa')]('/',auth['isAuthenticated'](),controller[_0xae84('0xb')]);router[_0xae84('0xa')]('/describe',auth[_0xae84('0xc')](),controller[_0xae84('0xd')]);router[_0xae84('0xa')]('/:id',auth[_0xae84('0xc')](),controller['show']);router[_0xae84('0xa')]('/:id/members',auth[_0xae84('0xc')](),controller['getMembers']);router[_0xae84('0xa')](_0xae84('0xe'),auth[_0xae84('0xc')](),controller[_0xae84('0xf')]);router[_0xae84('0xa')](_0xae84('0x10'),auth[_0xae84('0xc')](),controller[_0xae84('0x11')]);router[_0xae84('0x12')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xae84('0xe'),auth[_0xae84('0xc')](),controller[_0xae84('0x13')]);router['post'](_0xae84('0x10'),auth[_0xae84('0xc')](),controller['addAgents']);router[_0xae84('0x14')](_0xae84('0x15'),auth['isAuthenticated'](),controller[_0xae84('0x16')]);router[_0xae84('0x17')](_0xae84('0x15'),auth[_0xae84('0xc')](),controller[_0xae84('0x18')]);router['delete'](_0xae84('0xe'),auth[_0xae84('0xc')](),controller[_0xae84('0x19')]);router['delete']('/:id/users',auth[_0xae84('0xc')](),controller[_0xae84('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index ca55077..2be45ea 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 _0x98e5=['rrmemory','beepall','STRING','name','INTEGER'];(function(_0x1139d0,_0x41e5f8){var _0xcc01a6=function(_0x504ffa){while(--_0x504ffa){_0x1139d0['push'](_0x1139d0['shift']());}};_0xcc01a6(++_0x41e5f8);}(_0x98e5,0x8a));var _0x598e=function(_0x160d0c,_0x42b3ab){_0x160d0c=_0x160d0c-0x0;var _0x424352=_0x98e5[_0x160d0c];return _0x424352;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x598e('0x0'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x598e('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x598e('0x2'),_0x598e('0x3'),'roundrobin')},'description':{'type':Sequelize[_0x598e('0x4')]}}; \ No newline at end of file +var _0x8c99=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x228677,_0x2e4ec3){var _0x355360=function(_0xe18900){while(--_0xe18900){_0x228677['push'](_0x228677['shift']());}};_0x355360(++_0x2e4ec3);}(_0x8c99,0x1a8));var _0x98c9=function(_0x10bcc4,_0x4400e2){_0x10bcc4=_0x10bcc4-0x0;var _0x2da988=_0x8c99[_0x10bcc4];return _0x2da988;};'use strict';var Sequelize=require(_0x98c9('0x0'));module[_0x98c9('0x1')]={'name':{'type':Sequelize[_0x98c9('0x2')],'unique':_0x98c9('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x98c9('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x98c9('0x5')](_0x98c9('0x6'),_0x98c9('0x7'),_0x98c9('0x8'))},'description':{'type':Sequelize[_0x98c9('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 60f99df..1a4c1ce 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 _0xd838=['filters','pick','filter','merge','VIRTUAL','options','WhatsappQueue','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','hasOwnProperty','WhatsappQueueId','UserWhatsappQueue','User','findAndCountAll','UserId','agent','createdAt','format','%s/%s','whatsappPause','updatedAt','getTeams','findOne','Team','order','addTeams','ids','online','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','forEach','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','destroy','then','WhatsappQueues','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','sort','where'];(function(_0x4f8c39,_0x457239){var _0x479c07=function(_0xcc387c){while(--_0xcc387c){_0x4f8c39['push'](_0x4f8c39['shift']());}};_0x479c07(++_0x457239);}(_0xd838,0xe0));var _0x8d83=function(_0xce4303,_0x243abd){_0xce4303=_0xce4303-0x0;var _0x1d9f2f=_0xd838[_0xce4303];return _0x1d9f2f;};'use strict';var emlformat=require(_0x8d83('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8d83('0x1'));var BPromise=require(_0x8d83('0x2'));var Mustache=require(_0x8d83('0x3'));var util=require('util');var path=require(_0x8d83('0x4'));var sox=require(_0x8d83('0x5'));var csv=require(_0x8d83('0x6'));var ejs=require(_0x8d83('0x7'));var fs=require('fs');var fs_extra=require(_0x8d83('0x8'));var _=require('lodash');var squel=require(_0x8d83('0x9'));var crypto=require(_0x8d83('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x8d83('0xb'));var toCsv=require(_0x8d83('0x6'));var querystring=require(_0x8d83('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8d83('0xd'));var qs=require(_0x8d83('0xe'));var as=require(_0x8d83('0xf'));var hardwareService=require(_0x8d83('0x10'));var logger=require(_0x8d83('0x11'))(_0x8d83('0x12'));var utils=require(_0x8d83('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x8d83('0x14')]=_[_0x8d83('0x15')](config[_0x8d83('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0x8d83('0x16'))(new Redis(config['redis']));require('./whatsappQueue.socket')[_0x8d83('0x17')](socket);function respondWithStatusCode(_0x256c20,_0x1a2ffe){_0x1a2ffe=_0x1a2ffe||0xcc;return function(_0x245d1d){if(_0x245d1d){return _0x256c20[_0x8d83('0x18')](_0x1a2ffe);}return _0x256c20[_0x8d83('0x19')](_0x1a2ffe)[_0x8d83('0x1a')]();};}function respondWithResult(_0x2ba8f7,_0x5854c6){_0x5854c6=_0x5854c6||0xc8;return function(_0x4c49ea){if(_0x4c49ea){return _0x2ba8f7[_0x8d83('0x19')](_0x5854c6)[_0x8d83('0x1b')](_0x4c49ea);}};}function respondWithFilteredResult(_0x22f810,_0x9c5cdb){return function(_0x4abde6){if(_0x4abde6){var _0x2c3e23=typeof _0x9c5cdb[_0x8d83('0x1c')]==='undefined'&&typeof _0x9c5cdb['limit']===_0x8d83('0x1d');var _0x117390=_0x4abde6[_0x8d83('0x1e')];var _0x4ddfa7=_0x2c3e23?0x0:_0x9c5cdb[_0x8d83('0x1c')];var _0x14e442=_0x2c3e23?_0x4abde6[_0x8d83('0x1e')]:_0x9c5cdb['offset']+_0x9c5cdb[_0x8d83('0x1f')];var _0x34454e;if(_0x14e442>=_0x117390){_0x14e442=_0x117390;_0x34454e=0xc8;}else{_0x34454e=0xce;}_0x22f810['status'](_0x34454e);return _0x22f810[_0x8d83('0x20')](_0x8d83('0x21'),_0x4ddfa7+'-'+_0x14e442+'/'+_0x117390)[_0x8d83('0x1b')](_0x4abde6);}return null;};}function patchUpdates(_0x3b3ab0){return function(_0x5cbc13){try{jsonpatch[_0x8d83('0x22')](_0x5cbc13,_0x3b3ab0,!![]);}catch(_0x4d07de){return BPromise[_0x8d83('0x23')](_0x4d07de);}return _0x5cbc13['save']();};}function saveUpdates(_0x207710,_0x296315){return function(_0x4bf158){if(_0x4bf158){return _0x4bf158['update'](_0x207710)['then'](function(_0x407289){return _0x407289;});}return null;};}function removeEntity(_0x424647,_0x1cd1a9){return function(_0xb5e2b1){if(_0xb5e2b1){return _0xb5e2b1[_0x8d83('0x24')]()[_0x8d83('0x25')](function(){var _0xb777ab=_0xb5e2b1['get']({'plain':!![]});var _0x4b3f03=_0x8d83('0x26');return db['UserProfileResource'][_0x8d83('0x24')]({'where':{'type':_0x4b3f03,'resourceId':_0xb777ab['id']}})['then'](function(){return _0xb5e2b1;});})['then'](function(){_0x424647[_0x8d83('0x19')](0xcc)[_0x8d83('0x1a')]();});}};}function handleEntityNotFound(_0x4747b8,_0x134358){return function(_0x24c001){if(!_0x24c001){_0x4747b8['sendStatus'](0x194);}return _0x24c001;};}function handleError(_0x4c6586,_0x766655){_0x766655=_0x766655||0x1f4;return function(_0x3f7c03){logger[_0x8d83('0x27')](_0x3f7c03[_0x8d83('0x28')]);if(_0x3f7c03[_0x8d83('0x29')]){delete _0x3f7c03['name'];}_0x4c6586[_0x8d83('0x19')](_0x766655)[_0x8d83('0x2a')](_0x3f7c03);};}exports['index']=function(_0x5e7912,_0x23ae8b){var _0x29b251={},_0x3c05f3={},_0x57a6ec={'count':0x0,'rows':[]};var _0x2825fe=_[_0x8d83('0x2b')](db['WhatsappQueue'][_0x8d83('0x2c')],function(_0x309bdb){return{'name':_0x309bdb[_0x8d83('0x2d')],'type':_0x309bdb[_0x8d83('0x2e')][_0x8d83('0x2f')]};});_0x3c05f3[_0x8d83('0x30')]=_[_0x8d83('0x2b')](_0x2825fe,_0x8d83('0x29'));_0x3c05f3[_0x8d83('0x31')]=_[_0x8d83('0x32')](_0x5e7912[_0x8d83('0x31')]);_0x3c05f3['filters']=_['intersection'](_0x3c05f3[_0x8d83('0x30')],_0x3c05f3[_0x8d83('0x31')]);_0x29b251['attributes']=_[_0x8d83('0x33')](_0x3c05f3[_0x8d83('0x30')],qs['fields'](_0x5e7912['query'][_0x8d83('0x34')]));_0x29b251[_0x8d83('0x35')]=_0x29b251[_0x8d83('0x35')][_0x8d83('0x36')]?_0x29b251[_0x8d83('0x35')]:_0x3c05f3[_0x8d83('0x30')];if(!_0x5e7912[_0x8d83('0x31')]['hasOwnProperty'](_0x8d83('0x37'))){_0x29b251['limit']=qs[_0x8d83('0x1f')](_0x5e7912[_0x8d83('0x31')][_0x8d83('0x1f')]);_0x29b251[_0x8d83('0x1c')]=qs[_0x8d83('0x1c')](_0x5e7912['query'][_0x8d83('0x1c')]);}_0x29b251['order']=qs[_0x8d83('0x38')](_0x5e7912[_0x8d83('0x31')][_0x8d83('0x38')]);_0x29b251[_0x8d83('0x39')]=qs[_0x8d83('0x3a')](_[_0x8d83('0x3b')](_0x5e7912['query'],_0x3c05f3[_0x8d83('0x3a')]),_0x2825fe);if(_0x5e7912[_0x8d83('0x31')][_0x8d83('0x3c')]){_0x29b251['where']=_[_0x8d83('0x3d')](_0x29b251['where'],{'$or':_[_0x8d83('0x2b')](_0x2825fe,function(_0x197795){if(_0x197795['type']!==_0x8d83('0x3e')){var _0x38814f={};_0x38814f[_0x197795[_0x8d83('0x29')]]={'$like':'%'+_0x5e7912[_0x8d83('0x31')][_0x8d83('0x3c')]+'%'};return _0x38814f;}})});}_0x29b251=_['merge']({},_0x29b251,_0x5e7912[_0x8d83('0x3f')]);var _0x5bb159={'where':_0x29b251[_0x8d83('0x39')]};return db[_0x8d83('0x40')][_0x8d83('0x1e')](_0x5bb159)[_0x8d83('0x25')](function(_0x227f62){_0x57a6ec[_0x8d83('0x1e')]=_0x227f62;if(_0x5e7912[_0x8d83('0x31')]['includeAll']){_0x29b251[_0x8d83('0x41')]=[{'all':!![]}];}return db['WhatsappQueue'][_0x8d83('0x42')](_0x29b251);})[_0x8d83('0x25')](function(_0x4dd747){_0x57a6ec[_0x8d83('0x43')]=_0x4dd747;return _0x57a6ec;})[_0x8d83('0x25')](respondWithFilteredResult(_0x23ae8b,_0x29b251))[_0x8d83('0x44')](handleError(_0x23ae8b,null));};exports[_0x8d83('0x45')]=function(_0x9b5489,_0x3bac1a){var _0x11d205={'raw':!![],'where':{'id':_0x9b5489[_0x8d83('0x46')]['id']}},_0x53c7cd={};_0x53c7cd['model']=_[_0x8d83('0x32')](db[_0x8d83('0x40')]['rawAttributes']);_0x53c7cd['query']=_['keys'](_0x9b5489[_0x8d83('0x31')]);_0x53c7cd[_0x8d83('0x3a')]=_[_0x8d83('0x33')](_0x53c7cd[_0x8d83('0x30')],_0x53c7cd[_0x8d83('0x31')]);_0x11d205['attributes']=_[_0x8d83('0x33')](_0x53c7cd[_0x8d83('0x30')],qs[_0x8d83('0x34')](_0x9b5489['query'][_0x8d83('0x34')]));_0x11d205[_0x8d83('0x35')]=_0x11d205[_0x8d83('0x35')][_0x8d83('0x36')]?_0x11d205[_0x8d83('0x35')]:_0x53c7cd[_0x8d83('0x30')];if(_0x9b5489[_0x8d83('0x31')][_0x8d83('0x47')]){_0x11d205[_0x8d83('0x41')]=[{'all':!![]}];}_0x11d205=_[_0x8d83('0x3d')]({},_0x11d205,_0x9b5489[_0x8d83('0x3f')]);return db[_0x8d83('0x40')][_0x8d83('0x48')](_0x11d205)[_0x8d83('0x25')](handleEntityNotFound(_0x3bac1a,null))[_0x8d83('0x25')](respondWithResult(_0x3bac1a,null))[_0x8d83('0x44')](handleError(_0x3bac1a,null));};exports[_0x8d83('0x49')]=function(_0x1477ab,_0x2a101d){return db[_0x8d83('0x40')]['create'](_0x1477ab[_0x8d83('0x4a')],{})[_0x8d83('0x25')](function(_0xb3d593){var _0x491fc1=_0x1477ab[_0x8d83('0x4b')][_0x8d83('0x4c')]({'plain':!![]});if(!_0x491fc1)throw new Error(_0x8d83('0x4d'));if(_0x491fc1[_0x8d83('0x4e')]===_0x8d83('0x4b')){var _0x29169c=_0xb3d593[_0x8d83('0x4c')]({'plain':!![]});var _0x46f09a=_0x8d83('0x26');return db[_0x8d83('0x4f')]['find']({'where':{'name':_0x46f09a,'userProfileId':_0x491fc1['userProfileId']},'raw':!![]})['then'](function(_0x1c5876){if(_0x1c5876&&_0x1c5876['autoAssociation']===0x0){return db['UserProfileResource'][_0x8d83('0x49')]({'name':_0x29169c[_0x8d83('0x29')],'resourceId':_0x29169c['id'],'type':_0x1c5876['name'],'sectionId':_0x1c5876['id']},{})[_0x8d83('0x25')](function(){return _0xb3d593;});}else{return _0xb3d593;}})[_0x8d83('0x44')](function(_0x41126e){logger['error'](_0x8d83('0x50'),_0x41126e);throw _0x41126e;});}return _0xb3d593;})[_0x8d83('0x25')](respondWithResult(_0x2a101d,0xc9))[_0x8d83('0x44')](handleError(_0x2a101d,null));};exports[_0x8d83('0x51')]=function(_0x3085e9,_0x45680c){if(_0x3085e9[_0x8d83('0x4a')]['id']){delete _0x3085e9[_0x8d83('0x4a')]['id'];}return db[_0x8d83('0x40')][_0x8d83('0x48')]({'where':{'id':_0x3085e9['params']['id']}})[_0x8d83('0x25')](handleEntityNotFound(_0x45680c,null))[_0x8d83('0x25')](saveUpdates(_0x3085e9['body'],null))[_0x8d83('0x25')](respondWithResult(_0x45680c,null))[_0x8d83('0x44')](handleError(_0x45680c,null));};exports[_0x8d83('0x24')]=function(_0x53c7ae,_0x2b61a3){return db[_0x8d83('0x40')][_0x8d83('0x48')]({'where':{'id':_0x53c7ae[_0x8d83('0x46')]['id']}})[_0x8d83('0x25')](handleEntityNotFound(_0x2b61a3,null))[_0x8d83('0x25')](removeEntity(_0x2b61a3,null))['catch'](handleError(_0x2b61a3,null));};exports['describe']=function(_0x2fd5bd,_0x327420){return db[_0x8d83('0x40')][_0x8d83('0x52')]()['then'](respondWithResult(_0x327420,null))[_0x8d83('0x44')](handleError(_0x327420,null));};exports[_0x8d83('0x53')]=function(_0x568dcc,_0x2197af,_0x3817a5){var _0x32de38={'raw':!![],'where':{}},_0x321ced={},_0x2a7a09;return db[_0x8d83('0x40')]['findOne']({'where':{'id':_0x568dcc[_0x8d83('0x46')]['id']}})[_0x8d83('0x25')](handleEntityNotFound(_0x2197af,null))[_0x8d83('0x25')](function(_0x45430d){if(_0x45430d){_0x2a7a09=_0x45430d[_0x8d83('0x4c')]({'plain':!![]});_0x321ced['model']=_['keys'](db['UserWhatsappQueue'][_0x8d83('0x2c')]);_0x321ced['query']=_['keys'](_0x568dcc['query']);_0x321ced['filters']=_[_0x8d83('0x33')](_0x321ced['model'],_0x321ced[_0x8d83('0x31')]);_0x32de38[_0x8d83('0x35')]=_[_0x8d83('0x33')](_0x321ced[_0x8d83('0x30')],qs[_0x8d83('0x34')](_0x568dcc['query']['fields']));_0x32de38['attributes']=_0x32de38[_0x8d83('0x35')][_0x8d83('0x36')]?_0x32de38[_0x8d83('0x35')]:_0x321ced[_0x8d83('0x30')];if(!_0x568dcc['query'][_0x8d83('0x54')]('nolimit')){_0x32de38['limit']=qs[_0x8d83('0x1f')](_0x568dcc[_0x8d83('0x31')][_0x8d83('0x1f')]);_0x32de38[_0x8d83('0x1c')]=qs[_0x8d83('0x1c')](_0x568dcc[_0x8d83('0x31')][_0x8d83('0x1c')]);}_0x32de38['order']=qs[_0x8d83('0x38')](_0x568dcc['query'][_0x8d83('0x38')]);_0x32de38[_0x8d83('0x39')]=qs[_0x8d83('0x3a')](_[_0x8d83('0x3b')](_0x568dcc[_0x8d83('0x31')],_0x321ced[_0x8d83('0x3a')]));_0x32de38[_0x8d83('0x39')][_0x8d83('0x55')]=_0x45430d['id'];if(_0x568dcc['query'][_0x8d83('0x3c')]){_0x32de38[_0x8d83('0x39')]=_[_0x8d83('0x3d')](_0x32de38['where'],{'$or':_['map'](_0x32de38['attributes'],function(_0xa210cb){var _0xcc1692={};_0xcc1692[_0xa210cb]={'$like':'%'+_0x568dcc[_0x8d83('0x31')]['filter']+'%'};return _0xcc1692;})});}_0x32de38=_[_0x8d83('0x3d')]({},_0x32de38,_0x568dcc[_0x8d83('0x3f')]);return db[_0x8d83('0x56')][_0x8d83('0x42')](_0x32de38);}})[_0x8d83('0x25')](function(_0x2abe44){if(_0x2abe44){return db[_0x8d83('0x57')][_0x8d83('0x58')]({'where':{'id':_[_0x8d83('0x2b')](_0x2abe44,_0x8d83('0x59')),'role':_0x8d83('0x5a')},'attributes':['id',_0x8d83('0x29'),'whatsappPause','updatedAt',_0x8d83('0x5b')]});}})[_0x8d83('0x25')](function(_0x3f8d5a){if(_0x3f8d5a){return{'count':_0x3f8d5a[_0x8d83('0x1e')],'rows':_['map'](_0x3f8d5a[_0x8d83('0x43')],function(_0x4d247b){return{'membername':_0x4d247b[_0x8d83('0x29')],'UserId':_0x4d247b['id'],'queue_name':_0x2a7a09[_0x8d83('0x29')],'WhatsappQueueId':_0x2a7a09['id'],'interface':util[_0x8d83('0x5c')](_0x8d83('0x5d'),'SIP',_0x4d247b[_0x8d83('0x29')]),'penalty':0x0,'paused':_0x4d247b[_0x8d83('0x5e')],'createdAt':_0x4d247b[_0x8d83('0x5b')],'updatedAt':_0x4d247b[_0x8d83('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8d83('0x25')](respondWithFilteredResult(_0x2197af,_0x32de38))[_0x8d83('0x44')](handleError(_0x2197af,null));};exports[_0x8d83('0x60')]=function(_0x56ee8e,_0x490b67,_0x48f4b9){var _0xf5b1a7={};var _0xe0554={};var _0x28c9cf;var _0x33151e;return db['WhatsappQueue'][_0x8d83('0x61')]({'where':{'id':_0x56ee8e['params']['id']}})[_0x8d83('0x25')](handleEntityNotFound(_0x490b67,null))[_0x8d83('0x25')](function(_0xd78a8d){if(_0xd78a8d){_0x28c9cf=_0xd78a8d;_0xe0554[_0x8d83('0x30')]=_[_0x8d83('0x32')](db[_0x8d83('0x62')][_0x8d83('0x2c')]);_0xe0554['query']=_['keys'](_0x56ee8e[_0x8d83('0x31')]);_0xe0554[_0x8d83('0x3a')]=_[_0x8d83('0x33')](_0xe0554['model'],_0xe0554[_0x8d83('0x31')]);_0xf5b1a7[_0x8d83('0x35')]=_[_0x8d83('0x33')](_0xe0554[_0x8d83('0x30')],qs[_0x8d83('0x34')](_0x56ee8e[_0x8d83('0x31')][_0x8d83('0x34')]));_0xf5b1a7[_0x8d83('0x35')]=_0xf5b1a7[_0x8d83('0x35')][_0x8d83('0x36')]?_0xf5b1a7[_0x8d83('0x35')]:_0xe0554[_0x8d83('0x30')];_0xf5b1a7[_0x8d83('0x63')]=qs[_0x8d83('0x38')](_0x56ee8e[_0x8d83('0x31')]['sort']);_0xf5b1a7['where']=qs[_0x8d83('0x3a')](_['pick'](_0x56ee8e[_0x8d83('0x31')],_0xe0554[_0x8d83('0x3a')]));if(_0x56ee8e[_0x8d83('0x31')]['filter']){_0xf5b1a7['where']=_[_0x8d83('0x3d')](_0xf5b1a7[_0x8d83('0x39')],{'$or':_[_0x8d83('0x2b')](_0xf5b1a7['attributes'],function(_0xc6b817){var _0x16c889={};_0x16c889[_0xc6b817]={'$like':'%'+_0x56ee8e[_0x8d83('0x31')][_0x8d83('0x3c')]+'%'};return _0x16c889;})});}_0xf5b1a7=_[_0x8d83('0x3d')]({},_0xf5b1a7,_0x56ee8e[_0x8d83('0x3f')]);return _0x28c9cf['getTeams'](_0xf5b1a7);}})[_0x8d83('0x25')](function(_0x5cefe7){if(_0x5cefe7){_0x33151e=_0x5cefe7[_0x8d83('0x36')];if(!_0x56ee8e['query'][_0x8d83('0x54')](_0x8d83('0x37'))){_0xf5b1a7[_0x8d83('0x1f')]=qs['limit'](_0x56ee8e[_0x8d83('0x31')][_0x8d83('0x1f')]);_0xf5b1a7['offset']=qs[_0x8d83('0x1c')](_0x56ee8e[_0x8d83('0x31')][_0x8d83('0x1c')]);}return _0x28c9cf[_0x8d83('0x60')](_0xf5b1a7);}})[_0x8d83('0x25')](function(_0x279c3c){if(_0x279c3c){return _0x279c3c?{'count':_0x33151e,'rows':_0x279c3c}:null;}})[_0x8d83('0x25')](respondWithResult(_0x490b67,null))[_0x8d83('0x44')](handleError(_0x490b67,null));};exports[_0x8d83('0x64')]=function(_0x20ad4f,_0xafa989,_0x2956e3){var _0x57a860=_0x20ad4f[_0x8d83('0x4a')][_0x8d83('0x65')];return db[_0x8d83('0x62')][_0x8d83('0x42')]({'where':{'id':_0x57a860},'attributes':['id'],'include':[{'model':db[_0x8d83('0x57')],'as':'Agents','attributes':['id',_0x8d83('0x29'),_0x8d83('0x66'),'voicePause',_0x8d83('0x67')],'raw':!![]}]})[_0x8d83('0x25')](function(_0x5f0822){if(_0x5f0822){var _0x1e4df6=_[_0x8d83('0x68')](_0x5f0822,function(_0x1fceaf){var _0x3c2764=_0x1fceaf[_0x8d83('0x4c')]({'plain':!![]});return _0x3c2764[_0x8d83('0x69')];});return db['WhatsappQueue'][_0x8d83('0x48')]({'where':{'id':_0x20ad4f[_0x8d83('0x46')]['id']}})[_0x8d83('0x25')](function(_0x2328ed){return db[_0x8d83('0x6a')][_0x8d83('0x6b')](function(_0x590b05){return _0x2328ed['addTeams'](_0x57a860,{'transaction':_0x590b05})['then'](function(){return BPromise[_0x8d83('0x6c')](_0x1e4df6,function(_0x41b499){return db[_0x8d83('0x56')][_0x8d83('0x6d')]({'where':{'UserId':_0x41b499['id'],'WhatsappQueueId':_0x20ad4f[_0x8d83('0x46')]['id']},'transaction':_0x590b05});});})[_0x8d83('0x25')](function(){_0x1e4df6['forEach'](function(_0x24e037){socket[_0x8d83('0x6e')](_0x8d83('0x6f'),{'UserId':_0x24e037['id'],'WhatsappQueueId':_0x2328ed['id']});});});});});}})[_0x8d83('0x25')](respondWithStatusCode(_0xafa989,null))[_0x8d83('0x44')](handleError(_0xafa989,null));};exports[_0x8d83('0x70')]=function(_0x43ede1,_0x309c25,_0x513260){return db['Team']['findAll']({'where':{'id':_0x43ede1[_0x8d83('0x31')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8d83('0x69'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x309c25,null))['then'](function(_0x18f7d3){var _0xd5c991=_[_0x8d83('0x2b')](_0x18f7d3,'id');var _0x34d8c0=[];var _0x647afc=[];var _0x2d883f=squel[_0x8d83('0x71')]();_0x2d883f[_0x8d83('0x72')](_0x8d83('0x73'))[_0x8d83('0x74')](_0x8d83('0x75'),'tq')[_0x8d83('0x76')](_0x8d83('0x77'),'ut',_0x8d83('0x78'))[_0x8d83('0x39')](_0x8d83('0x79'),_0x43ede1[_0x8d83('0x46')]['id']);for(var _0x1b0c0d=0x0;_0x1b0c0d<_0x18f7d3[_0x8d83('0x36')];_0x1b0c0d+=0x1){let _0x3b2ded=_0x18f7d3[_0x1b0c0d];for(var _0x5778b8=0x0;_0x5778b8<_0x3b2ded['Agents'][_0x8d83('0x36')];_0x5778b8+=0x1){let _0x1232aa=_0x3b2ded[_0x8d83('0x69')][_0x5778b8];var _0x3bd804=_0x2d883f[_0x8d83('0x7a')]();_0x3bd804[_0x8d83('0x39')](_0x8d83('0x7b'),_0x1232aa['id']);_0x647afc['push'](db[_0x8d83('0x6a')][_0x8d83('0x31')](_0x3bd804[_0x8d83('0x7c')](),{'type':db['sequelize']['QueryTypes'][_0x8d83('0x7d')]})[_0x8d83('0x25')](function(_0x2d49f3){if(_0x2d49f3[_0x8d83('0x36')]===0x1){return _0x1232aa['id'];}else{var _0x14681c=_[_0x8d83('0x7e')](_[_0x8d83('0x2b')](_0x2d49f3,_0x8d83('0x7f')),function(_0x359a79){return _[_0x8d83('0x80')](_0xd5c991,_0x359a79);});if(_0x14681c){return _0x1232aa['id'];}}}));}}return BPromise[_0x8d83('0x81')](_0x647afc)[_0x8d83('0x25')](function(_0x174b40){_0x34d8c0=_(_0x34d8c0)[_0x8d83('0x82')](_0x174b40)[_0x8d83('0x83')]()[_0x8d83('0x84')]();return db[_0x8d83('0x40')][_0x8d83('0x48')]({'where':{'id':_0x43ede1[_0x8d83('0x46')]['id']}})['then'](function(_0x2fae4f){return db['sequelize'][_0x8d83('0x6b')](function(_0x257467){return _0x2fae4f[_0x8d83('0x70')](_0x43ede1[_0x8d83('0x31')][_0x8d83('0x65')],{'transaction':_0x257467})[_0x8d83('0x25')](function(){if(!_[_0x8d83('0x85')](_0x34d8c0)){return _0x2fae4f['removeAgents'](_0x34d8c0,{'transaction':_0x257467});}})['then'](function(){_0x34d8c0[_0x8d83('0x86')](function(_0x2ada7f){socket[_0x8d83('0x6e')](_0x8d83('0x87'),{'UserId':_0x2ada7f,'WhatsappQueueId':_0x2fae4f['id']});});});});});});})[_0x8d83('0x25')](respondWithStatusCode(_0x309c25,null))[_0x8d83('0x44')](handleError(_0x309c25,null));};exports[_0x8d83('0x88')]=function(_0x4cdd03,_0x4f7fce,_0x3c7f9b){return db[_0x8d83('0x40')][_0x8d83('0x48')]({'where':{'id':_0x4cdd03[_0x8d83('0x46')]['id']}})['then'](handleEntityNotFound(_0x4f7fce,null))['then'](function(_0x462e0e){if(_0x462e0e){return _0x462e0e[_0x8d83('0x88')](_0x4cdd03[_0x8d83('0x4a')][_0x8d83('0x65')],_[_0x8d83('0x89')](_0x4cdd03[_0x8d83('0x4a')],[_0x8d83('0x65'),'id'])||{})[_0x8d83('0x8a')](function(_0x1590b0){for(var _0x33cf1c=0x0;_0x33cf1c<_0x4cdd03[_0x8d83('0x4a')]['ids'][_0x8d83('0x36')];_0x33cf1c+=0x1){socket['emit']('userWhatsappQueue:save',{'UserId':Number(_0x4cdd03['body'][_0x8d83('0x65')][_0x33cf1c]),'WhatsappQueueId':Number(_0x4cdd03[_0x8d83('0x46')]['id'])});}return _0x1590b0;});}})[_0x8d83('0x25')](respondWithResult(_0x4f7fce,null))[_0x8d83('0x44')](handleError(_0x4f7fce,null));};exports['removeAgents']=function(_0x306e7a,_0x44e7e3,_0x4e0c4c){return db[_0x8d83('0x40')][_0x8d83('0x48')]({'where':{'id':_0x306e7a['params']['id']}})['then'](handleEntityNotFound(_0x44e7e3,null))[_0x8d83('0x25')](function(_0x351a2e){if(_0x351a2e){return _0x351a2e['removeAgents'](_0x306e7a[_0x8d83('0x31')][_0x8d83('0x65')])[_0x8d83('0x25')](function(){if(_[_0x8d83('0x8b')](_0x306e7a[_0x8d83('0x31')][_0x8d83('0x65')])){for(var _0x1a81e8=0x0;_0x1a81e8<_0x306e7a[_0x8d83('0x31')]['ids'][_0x8d83('0x36')];_0x1a81e8+=0x1){socket[_0x8d83('0x6e')](_0x8d83('0x87'),{'UserId':Number(_0x306e7a[_0x8d83('0x31')][_0x8d83('0x65')][_0x1a81e8]),'WhatsappQueueId':Number(_0x306e7a[_0x8d83('0x46')]['id'])});}}else{socket[_0x8d83('0x6e')]('userWhatsappQueue:remove',{'UserId':Number(_0x306e7a[_0x8d83('0x31')]['ids']),'WhatsappQueueId':Number(_0x306e7a[_0x8d83('0x46')]['id'])});}});}})[_0x8d83('0x25')](respondWithStatusCode(_0x44e7e3,null))[_0x8d83('0x44')](handleError(_0x44e7e3,null));};exports[_0x8d83('0x8c')]=function(_0x4af107,_0x270b1a,_0x3f2bbe){var _0x37f958={};var _0x4b0707={};var _0x41e64d;var _0x292e47;return db['WhatsappQueue'][_0x8d83('0x61')]({'where':{'id':_0x4af107['params']['id']}})[_0x8d83('0x25')](handleEntityNotFound(_0x270b1a,null))[_0x8d83('0x25')](function(_0x4b48b8){if(_0x4b48b8){_0x41e64d=_0x4b48b8;_0x4b0707['model']=_[_0x8d83('0x32')](db[_0x8d83('0x57')][_0x8d83('0x2c')]);_0x4b0707[_0x8d83('0x31')]=_[_0x8d83('0x32')](_0x4af107[_0x8d83('0x31')]);_0x4b0707[_0x8d83('0x3a')]=_['intersection'](_0x4b0707[_0x8d83('0x30')],_0x4b0707[_0x8d83('0x31')]);_0x37f958[_0x8d83('0x35')]=_[_0x8d83('0x33')](_0x4b0707['model'],qs[_0x8d83('0x34')](_0x4af107['query'][_0x8d83('0x34')]));_0x37f958[_0x8d83('0x35')]=_0x37f958[_0x8d83('0x35')][_0x8d83('0x36')]?_0x37f958[_0x8d83('0x35')]:_0x4b0707[_0x8d83('0x30')];_0x37f958[_0x8d83('0x63')]=qs[_0x8d83('0x38')](_0x4af107[_0x8d83('0x31')][_0x8d83('0x38')]);_0x37f958[_0x8d83('0x39')]=qs['filters'](_[_0x8d83('0x3b')](_0x4af107[_0x8d83('0x31')],_0x4b0707[_0x8d83('0x3a')]));if(_0x4af107[_0x8d83('0x31')][_0x8d83('0x3c')]){_0x37f958['where']=_['merge'](_0x37f958['where'],{'$or':_[_0x8d83('0x2b')](_0x37f958[_0x8d83('0x35')],function(_0x5bb41d){var _0x95e6c8={};_0x95e6c8[_0x5bb41d]={'$like':'%'+_0x4af107['query'][_0x8d83('0x3c')]+'%'};return _0x95e6c8;})});}_0x37f958=_[_0x8d83('0x3d')]({},_0x37f958,_0x4af107[_0x8d83('0x3f')]);return _0x41e64d[_0x8d83('0x8c')](_0x37f958);}})[_0x8d83('0x25')](function(_0x47aefe){if(_0x47aefe){_0x292e47=_0x47aefe[_0x8d83('0x36')];if(!_0x4af107[_0x8d83('0x31')][_0x8d83('0x54')](_0x8d83('0x37'))){_0x37f958[_0x8d83('0x1f')]=qs[_0x8d83('0x1f')](_0x4af107[_0x8d83('0x31')][_0x8d83('0x1f')]);_0x37f958[_0x8d83('0x1c')]=qs[_0x8d83('0x1c')](_0x4af107[_0x8d83('0x31')][_0x8d83('0x1c')]);}return _0x41e64d[_0x8d83('0x8c')](_0x37f958);}})[_0x8d83('0x25')](function(_0x215827){if(_0x215827){return _0x215827?{'count':_0x292e47,'rows':_0x215827}:null;}})[_0x8d83('0x25')](respondWithResult(_0x270b1a,null))[_0x8d83('0x44')](handleError(_0x270b1a,null));}; \ No newline at end of file +var _0x4df4=['UserWhatsappQueue','nolimit','WhatsappQueueId','User','findAndCountAll','agent','whatsappPause','updatedAt','format','%s/%s','SIP','createdAt','Team','getTeams','addTeams','ids','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','userWhatsappQueue:remove','addAgents','spread','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','end','status','json','offset','undefined','limit','Content-Range','apply','save','then','destroy','get','WhatsappQueues','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','count','includeAll','include','findAll','rows','catch','params','options','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','update','describe','getMembers','findOne'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4df4,0x1ed));var _0x44df=function(_0x4b6778,_0x505a76){_0x4b6778=_0x4b6778-0x0;var _0x22dbb9=_0x4df4[_0x4b6778];return _0x22dbb9;};'use strict';var emlformat=require(_0x44df('0x0'));var rimraf=require(_0x44df('0x1'));var zipdir=require(_0x44df('0x2'));var jsonpatch=require(_0x44df('0x3'));var rp=require('request-promise');var moment=require(_0x44df('0x4'));var BPromise=require(_0x44df('0x5'));var Mustache=require(_0x44df('0x6'));var util=require(_0x44df('0x7'));var path=require(_0x44df('0x8'));var sox=require(_0x44df('0x9'));var csv=require(_0x44df('0xa'));var ejs=require(_0x44df('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x44df('0xc'));var squel=require('squel');var crypto=require(_0x44df('0xd'));var jsforce=require(_0x44df('0xe'));var deskjs=require(_0x44df('0xf'));var toCsv=require(_0x44df('0xa'));var querystring=require(_0x44df('0x10'));var Papa=require('papaparse');var Redis=require(_0x44df('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x44df('0x12'));var as=require(_0x44df('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x44df('0x14'))(_0x44df('0x15'));var utils=require(_0x44df('0x16'));var config=require(_0x44df('0x17'));var licenseUtil=require(_0x44df('0x18'));var db=require(_0x44df('0x19'))['db'];config[_0x44df('0x1a')]=_['defaults'](config[_0x44df('0x1a')],{'host':_0x44df('0x1b'),'port':0x18eb});var socket=require(_0x44df('0x1c'))(new Redis(config[_0x44df('0x1a')]));require(_0x44df('0x1d'))[_0x44df('0x1e')](socket);function respondWithStatusCode(_0x6b5261,_0x5180be){_0x5180be=_0x5180be||0xcc;return function(_0x5bcf4d){if(_0x5bcf4d){return _0x6b5261[_0x44df('0x1f')](_0x5180be);}return _0x6b5261['status'](_0x5180be)[_0x44df('0x20')]();};}function respondWithResult(_0x36cce1,_0x3ef1e8){_0x3ef1e8=_0x3ef1e8||0xc8;return function(_0x5b8828){if(_0x5b8828){return _0x36cce1[_0x44df('0x21')](_0x3ef1e8)[_0x44df('0x22')](_0x5b8828);}};}function respondWithFilteredResult(_0x3756c1,_0x92ea57){return function(_0x36f642){if(_0x36f642){var _0x15fe57=typeof _0x92ea57[_0x44df('0x23')]===_0x44df('0x24')&&typeof _0x92ea57['limit']==='undefined';var _0x23b4c8=_0x36f642['count'];var _0x5c1dda=_0x15fe57?0x0:_0x92ea57[_0x44df('0x23')];var _0x2a6798=_0x15fe57?_0x36f642['count']:_0x92ea57['offset']+_0x92ea57[_0x44df('0x25')];var _0x2da07d;if(_0x2a6798>=_0x23b4c8){_0x2a6798=_0x23b4c8;_0x2da07d=0xc8;}else{_0x2da07d=0xce;}_0x3756c1['status'](_0x2da07d);return _0x3756c1['set'](_0x44df('0x26'),_0x5c1dda+'-'+_0x2a6798+'/'+_0x23b4c8)[_0x44df('0x22')](_0x36f642);}return null;};}function patchUpdates(_0x207169){return function(_0x443b2b){try{jsonpatch[_0x44df('0x27')](_0x443b2b,_0x207169,!![]);}catch(_0x1fb12e){return BPromise['reject'](_0x1fb12e);}return _0x443b2b[_0x44df('0x28')]();};}function saveUpdates(_0x3ec6ae,_0x3a1113){return function(_0x2ef244){if(_0x2ef244){return _0x2ef244['update'](_0x3ec6ae)[_0x44df('0x29')](function(_0x2f5d53){return _0x2f5d53;});}return null;};}function removeEntity(_0x3f4f14,_0xa3c279){return function(_0x228ab2){if(_0x228ab2){return _0x228ab2[_0x44df('0x2a')]()[_0x44df('0x29')](function(){var _0x44fc45=_0x228ab2[_0x44df('0x2b')]({'plain':!![]});var _0x507202=_0x44df('0x2c');return db['UserProfileResource'][_0x44df('0x2a')]({'where':{'type':_0x507202,'resourceId':_0x44fc45['id']}})['then'](function(){return _0x228ab2;});})['then'](function(){_0x3f4f14[_0x44df('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x491641,_0x300655){return function(_0x55b399){if(!_0x55b399){_0x491641['sendStatus'](0x194);}return _0x55b399;};}function handleError(_0x54ceea,_0x450c3a){_0x450c3a=_0x450c3a||0x1f4;return function(_0x15adce){logger[_0x44df('0x2d')](_0x15adce[_0x44df('0x2e')]);if(_0x15adce['name']){delete _0x15adce[_0x44df('0x2f')];}_0x54ceea[_0x44df('0x21')](_0x450c3a)[_0x44df('0x30')](_0x15adce);};}exports[_0x44df('0x31')]=function(_0x8e24af,_0x3ff115){var _0xc4e4d5={},_0x1550be={},_0x121bc5={'count':0x0,'rows':[]};var _0x5ecbec=_[_0x44df('0x32')](db[_0x44df('0x33')][_0x44df('0x34')],function(_0x460b42){return{'name':_0x460b42['fieldName'],'type':_0x460b42[_0x44df('0x35')][_0x44df('0x36')]};});_0x1550be[_0x44df('0x37')]=_[_0x44df('0x32')](_0x5ecbec,_0x44df('0x2f'));_0x1550be[_0x44df('0x38')]=_[_0x44df('0x39')](_0x8e24af[_0x44df('0x38')]);_0x1550be[_0x44df('0x3a')]=_['intersection'](_0x1550be[_0x44df('0x37')],_0x1550be[_0x44df('0x38')]);_0xc4e4d5[_0x44df('0x3b')]=_[_0x44df('0x3c')](_0x1550be['model'],qs[_0x44df('0x3d')](_0x8e24af[_0x44df('0x38')][_0x44df('0x3d')]));_0xc4e4d5['attributes']=_0xc4e4d5[_0x44df('0x3b')][_0x44df('0x3e')]?_0xc4e4d5[_0x44df('0x3b')]:_0x1550be[_0x44df('0x37')];if(!_0x8e24af[_0x44df('0x38')][_0x44df('0x3f')]('nolimit')){_0xc4e4d5[_0x44df('0x25')]=qs['limit'](_0x8e24af['query'][_0x44df('0x25')]);_0xc4e4d5[_0x44df('0x23')]=qs['offset'](_0x8e24af[_0x44df('0x38')]['offset']);}_0xc4e4d5[_0x44df('0x40')]=qs[_0x44df('0x41')](_0x8e24af[_0x44df('0x38')][_0x44df('0x41')]);_0xc4e4d5[_0x44df('0x42')]=qs['filters'](_[_0x44df('0x43')](_0x8e24af['query'],_0x1550be['filters']),_0x5ecbec);if(_0x8e24af['query']['filter']){_0xc4e4d5['where']=_[_0x44df('0x44')](_0xc4e4d5[_0x44df('0x42')],{'$or':_[_0x44df('0x32')](_0x5ecbec,function(_0x55d181){if(_0x55d181[_0x44df('0x35')]!==_0x44df('0x45')){var _0x407092={};_0x407092[_0x55d181[_0x44df('0x2f')]]={'$like':'%'+_0x8e24af[_0x44df('0x38')][_0x44df('0x46')]+'%'};return _0x407092;}})});}_0xc4e4d5=_[_0x44df('0x44')]({},_0xc4e4d5,_0x8e24af['options']);var _0x273c06={'where':_0xc4e4d5[_0x44df('0x42')]};return db['WhatsappQueue'][_0x44df('0x47')](_0x273c06)['then'](function(_0x115684){_0x121bc5[_0x44df('0x47')]=_0x115684;if(_0x8e24af['query'][_0x44df('0x48')]){_0xc4e4d5[_0x44df('0x49')]=[{'all':!![]}];}return db[_0x44df('0x33')][_0x44df('0x4a')](_0xc4e4d5);})[_0x44df('0x29')](function(_0xe7dbd5){_0x121bc5[_0x44df('0x4b')]=_0xe7dbd5;return _0x121bc5;})['then'](respondWithFilteredResult(_0x3ff115,_0xc4e4d5))[_0x44df('0x4c')](handleError(_0x3ff115,null));};exports['show']=function(_0x1d5156,_0xcff1b8){var _0x4cf099={'raw':!![],'where':{'id':_0x1d5156[_0x44df('0x4d')]['id']}},_0x35e0ec={};_0x35e0ec[_0x44df('0x37')]=_[_0x44df('0x39')](db['WhatsappQueue'][_0x44df('0x34')]);_0x35e0ec[_0x44df('0x38')]=_[_0x44df('0x39')](_0x1d5156[_0x44df('0x38')]);_0x35e0ec[_0x44df('0x3a')]=_[_0x44df('0x3c')](_0x35e0ec[_0x44df('0x37')],_0x35e0ec[_0x44df('0x38')]);_0x4cf099['attributes']=_[_0x44df('0x3c')](_0x35e0ec[_0x44df('0x37')],qs[_0x44df('0x3d')](_0x1d5156[_0x44df('0x38')][_0x44df('0x3d')]));_0x4cf099[_0x44df('0x3b')]=_0x4cf099[_0x44df('0x3b')]['length']?_0x4cf099[_0x44df('0x3b')]:_0x35e0ec['model'];if(_0x1d5156[_0x44df('0x38')]['includeAll']){_0x4cf099['include']=[{'all':!![]}];}_0x4cf099=_[_0x44df('0x44')]({},_0x4cf099,_0x1d5156[_0x44df('0x4e')]);return db[_0x44df('0x33')][_0x44df('0x4f')](_0x4cf099)[_0x44df('0x29')](handleEntityNotFound(_0xcff1b8,null))['then'](respondWithResult(_0xcff1b8,null))[_0x44df('0x4c')](handleError(_0xcff1b8,null));};exports[_0x44df('0x50')]=function(_0x5c3f0d,_0x1a541a){return db[_0x44df('0x33')]['create'](_0x5c3f0d[_0x44df('0x51')],{})[_0x44df('0x29')](function(_0x589adb){var _0x2e4cdf=_0x5c3f0d['user'][_0x44df('0x2b')]({'plain':!![]});if(!_0x2e4cdf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e4cdf[_0x44df('0x52')]===_0x44df('0x53')){var _0x2aad7d=_0x589adb[_0x44df('0x2b')]({'plain':!![]});var _0x4dbe87='WhatsappQueues';return db[_0x44df('0x54')]['find']({'where':{'name':_0x4dbe87,'userProfileId':_0x2e4cdf[_0x44df('0x55')]},'raw':!![]})[_0x44df('0x29')](function(_0x54ca25){if(_0x54ca25&&_0x54ca25[_0x44df('0x56')]===0x0){return db['UserProfileResource'][_0x44df('0x50')]({'name':_0x2aad7d[_0x44df('0x2f')],'resourceId':_0x2aad7d['id'],'type':_0x54ca25[_0x44df('0x2f')],'sectionId':_0x54ca25['id']},{})[_0x44df('0x29')](function(){return _0x589adb;});}else{return _0x589adb;}})[_0x44df('0x4c')](function(_0x5d0e6a){logger[_0x44df('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5d0e6a);throw _0x5d0e6a;});}return _0x589adb;})['then'](respondWithResult(_0x1a541a,0xc9))[_0x44df('0x4c')](handleError(_0x1a541a,null));};exports[_0x44df('0x57')]=function(_0x47d3ae,_0x20eea3){if(_0x47d3ae[_0x44df('0x51')]['id']){delete _0x47d3ae['body']['id'];}return db[_0x44df('0x33')][_0x44df('0x4f')]({'where':{'id':_0x47d3ae[_0x44df('0x4d')]['id']}})[_0x44df('0x29')](handleEntityNotFound(_0x20eea3,null))['then'](saveUpdates(_0x47d3ae['body'],null))[_0x44df('0x29')](respondWithResult(_0x20eea3,null))[_0x44df('0x4c')](handleError(_0x20eea3,null));};exports['destroy']=function(_0x1126c1,_0x19b3d5){return db[_0x44df('0x33')][_0x44df('0x4f')]({'where':{'id':_0x1126c1[_0x44df('0x4d')]['id']}})[_0x44df('0x29')](handleEntityNotFound(_0x19b3d5,null))[_0x44df('0x29')](removeEntity(_0x19b3d5,null))[_0x44df('0x4c')](handleError(_0x19b3d5,null));};exports[_0x44df('0x58')]=function(_0x3161e2,_0x24a9c8){return db[_0x44df('0x33')][_0x44df('0x58')]()['then'](respondWithResult(_0x24a9c8,null))[_0x44df('0x4c')](handleError(_0x24a9c8,null));};exports[_0x44df('0x59')]=function(_0x1eed73,_0x67eab5,_0x32abfd){var _0x529649={'raw':!![],'where':{}},_0x396a4b={},_0x178e21;return db[_0x44df('0x33')][_0x44df('0x5a')]({'where':{'id':_0x1eed73[_0x44df('0x4d')]['id']}})[_0x44df('0x29')](handleEntityNotFound(_0x67eab5,null))['then'](function(_0x2c84cf){if(_0x2c84cf){_0x178e21=_0x2c84cf['get']({'plain':!![]});_0x396a4b[_0x44df('0x37')]=_[_0x44df('0x39')](db[_0x44df('0x5b')]['rawAttributes']);_0x396a4b[_0x44df('0x38')]=_[_0x44df('0x39')](_0x1eed73[_0x44df('0x38')]);_0x396a4b['filters']=_[_0x44df('0x3c')](_0x396a4b[_0x44df('0x37')],_0x396a4b[_0x44df('0x38')]);_0x529649['attributes']=_['intersection'](_0x396a4b[_0x44df('0x37')],qs[_0x44df('0x3d')](_0x1eed73[_0x44df('0x38')]['fields']));_0x529649[_0x44df('0x3b')]=_0x529649['attributes'][_0x44df('0x3e')]?_0x529649[_0x44df('0x3b')]:_0x396a4b[_0x44df('0x37')];if(!_0x1eed73[_0x44df('0x38')][_0x44df('0x3f')](_0x44df('0x5c'))){_0x529649['limit']=qs[_0x44df('0x25')](_0x1eed73['query'][_0x44df('0x25')]);_0x529649[_0x44df('0x23')]=qs[_0x44df('0x23')](_0x1eed73[_0x44df('0x38')][_0x44df('0x23')]);}_0x529649[_0x44df('0x40')]=qs['sort'](_0x1eed73['query'][_0x44df('0x41')]);_0x529649[_0x44df('0x42')]=qs[_0x44df('0x3a')](_['pick'](_0x1eed73[_0x44df('0x38')],_0x396a4b['filters']));_0x529649['where'][_0x44df('0x5d')]=_0x2c84cf['id'];if(_0x1eed73['query']['filter']){_0x529649[_0x44df('0x42')]=_[_0x44df('0x44')](_0x529649[_0x44df('0x42')],{'$or':_[_0x44df('0x32')](_0x529649[_0x44df('0x3b')],function(_0x2a423b){var _0x275dc1={};_0x275dc1[_0x2a423b]={'$like':'%'+_0x1eed73[_0x44df('0x38')][_0x44df('0x46')]+'%'};return _0x275dc1;})});}_0x529649=_[_0x44df('0x44')]({},_0x529649,_0x1eed73[_0x44df('0x4e')]);return db[_0x44df('0x5b')][_0x44df('0x4a')](_0x529649);}})['then'](function(_0x2a01f6){if(_0x2a01f6){return db[_0x44df('0x5e')][_0x44df('0x5f')]({'where':{'id':_[_0x44df('0x32')](_0x2a01f6,'UserId'),'role':_0x44df('0x60')},'attributes':['id','name',_0x44df('0x61'),_0x44df('0x62'),'createdAt']});}})['then'](function(_0x9f026e){if(_0x9f026e){return{'count':_0x9f026e['count'],'rows':_[_0x44df('0x32')](_0x9f026e[_0x44df('0x4b')],function(_0x21ed6e){return{'membername':_0x21ed6e['name'],'UserId':_0x21ed6e['id'],'queue_name':_0x178e21[_0x44df('0x2f')],'WhatsappQueueId':_0x178e21['id'],'interface':util[_0x44df('0x63')](_0x44df('0x64'),_0x44df('0x65'),_0x21ed6e[_0x44df('0x2f')]),'penalty':0x0,'paused':_0x21ed6e[_0x44df('0x61')],'createdAt':_0x21ed6e[_0x44df('0x66')],'updatedAt':_0x21ed6e[_0x44df('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x44df('0x29')](respondWithFilteredResult(_0x67eab5,_0x529649))[_0x44df('0x4c')](handleError(_0x67eab5,null));};exports['getTeams']=function(_0x371705,_0x3bae6b,_0x576195){var _0x58683c={};var _0x270e3d={};var _0x1a444e;var _0x2dc4d3;return db[_0x44df('0x33')][_0x44df('0x5a')]({'where':{'id':_0x371705[_0x44df('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3bae6b,null))[_0x44df('0x29')](function(_0x57730f){if(_0x57730f){_0x1a444e=_0x57730f;_0x270e3d[_0x44df('0x37')]=_[_0x44df('0x39')](db[_0x44df('0x67')][_0x44df('0x34')]);_0x270e3d[_0x44df('0x38')]=_[_0x44df('0x39')](_0x371705[_0x44df('0x38')]);_0x270e3d[_0x44df('0x3a')]=_['intersection'](_0x270e3d[_0x44df('0x37')],_0x270e3d[_0x44df('0x38')]);_0x58683c[_0x44df('0x3b')]=_[_0x44df('0x3c')](_0x270e3d['model'],qs[_0x44df('0x3d')](_0x371705[_0x44df('0x38')][_0x44df('0x3d')]));_0x58683c[_0x44df('0x3b')]=_0x58683c[_0x44df('0x3b')]['length']?_0x58683c[_0x44df('0x3b')]:_0x270e3d[_0x44df('0x37')];_0x58683c[_0x44df('0x40')]=qs[_0x44df('0x41')](_0x371705['query'][_0x44df('0x41')]);_0x58683c[_0x44df('0x42')]=qs[_0x44df('0x3a')](_[_0x44df('0x43')](_0x371705[_0x44df('0x38')],_0x270e3d[_0x44df('0x3a')]));if(_0x371705[_0x44df('0x38')][_0x44df('0x46')]){_0x58683c[_0x44df('0x42')]=_[_0x44df('0x44')](_0x58683c[_0x44df('0x42')],{'$or':_['map'](_0x58683c[_0x44df('0x3b')],function(_0x239bcf){var _0x1f70c6={};_0x1f70c6[_0x239bcf]={'$like':'%'+_0x371705[_0x44df('0x38')]['filter']+'%'};return _0x1f70c6;})});}_0x58683c=_[_0x44df('0x44')]({},_0x58683c,_0x371705['options']);return _0x1a444e[_0x44df('0x68')](_0x58683c);}})['then'](function(_0x4059a8){if(_0x4059a8){_0x2dc4d3=_0x4059a8[_0x44df('0x3e')];if(!_0x371705[_0x44df('0x38')]['hasOwnProperty'](_0x44df('0x5c'))){_0x58683c[_0x44df('0x25')]=qs[_0x44df('0x25')](_0x371705[_0x44df('0x38')][_0x44df('0x25')]);_0x58683c[_0x44df('0x23')]=qs['offset'](_0x371705[_0x44df('0x38')][_0x44df('0x23')]);}return _0x1a444e[_0x44df('0x68')](_0x58683c);}})['then'](function(_0x3c468b){if(_0x3c468b){return _0x3c468b?{'count':_0x2dc4d3,'rows':_0x3c468b}:null;}})['then'](respondWithResult(_0x3bae6b,null))[_0x44df('0x4c')](handleError(_0x3bae6b,null));};exports[_0x44df('0x69')]=function(_0x331d09,_0x379c47,_0x73ce18){var _0x5a5eda=_0x331d09[_0x44df('0x51')][_0x44df('0x6a')];return db[_0x44df('0x67')][_0x44df('0x4a')]({'where':{'id':_0x5a5eda},'attributes':['id'],'include':[{'model':db[_0x44df('0x5e')],'as':'Agents','attributes':['id',_0x44df('0x2f'),_0x44df('0x6b'),_0x44df('0x6c'),_0x44df('0x6d')],'raw':!![]}]})[_0x44df('0x29')](function(_0x3b189e){if(_0x3b189e){var _0x3c4c8a=_[_0x44df('0x6e')](_0x3b189e,function(_0x2e5140){var _0xf3834d=_0x2e5140[_0x44df('0x2b')]({'plain':!![]});return _0xf3834d[_0x44df('0x6f')];});return db[_0x44df('0x33')][_0x44df('0x4f')]({'where':{'id':_0x331d09[_0x44df('0x4d')]['id']}})[_0x44df('0x29')](function(_0x18e2c1){return db[_0x44df('0x70')][_0x44df('0x71')](function(_0x2ea071){return _0x18e2c1['addTeams'](_0x5a5eda,{'transaction':_0x2ea071})[_0x44df('0x29')](function(){return BPromise[_0x44df('0x72')](_0x3c4c8a,function(_0x3b71fd){return db[_0x44df('0x5b')][_0x44df('0x73')]({'where':{'UserId':_0x3b71fd['id'],'WhatsappQueueId':_0x331d09[_0x44df('0x4d')]['id']},'transaction':_0x2ea071});});})[_0x44df('0x29')](function(){_0x3c4c8a[_0x44df('0x74')](function(_0xb7acb6){socket[_0x44df('0x75')](_0x44df('0x76'),{'UserId':_0xb7acb6['id'],'WhatsappQueueId':_0x18e2c1['id']});});});});});}})[_0x44df('0x29')](respondWithStatusCode(_0x379c47,null))['catch'](handleError(_0x379c47,null));};exports[_0x44df('0x77')]=function(_0x50d4f5,_0x5188cd,_0x5e6fcb){return db['Team'][_0x44df('0x4a')]({'where':{'id':_0x50d4f5[_0x44df('0x38')][_0x44df('0x6a')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x44df('0x29')](handleEntityNotFound(_0x5188cd,null))['then'](function(_0x5cf198){var _0x253b2e=_['map'](_0x5cf198,'id');var _0x5264e4=[];var _0x1b75a2=[];var _0x45fe0e=squel[_0x44df('0x78')]();_0x45fe0e[_0x44df('0x79')](_0x44df('0x7a'))[_0x44df('0x7b')](_0x44df('0x7c'),'tq')[_0x44df('0x7d')]('user_has_teams','ut',_0x44df('0x7e'))[_0x44df('0x42')](_0x44df('0x7f'),_0x50d4f5['params']['id']);for(var _0x4d4bb8=0x0;_0x4d4bb8<_0x5cf198[_0x44df('0x3e')];_0x4d4bb8+=0x1){let _0x5aa8d8=_0x5cf198[_0x4d4bb8];for(var _0x5c1742=0x0;_0x5c1742<_0x5aa8d8[_0x44df('0x6f')][_0x44df('0x3e')];_0x5c1742+=0x1){let _0x4a6994=_0x5aa8d8[_0x44df('0x6f')][_0x5c1742];var _0x25c22f=_0x45fe0e[_0x44df('0x80')]();_0x25c22f['where'](_0x44df('0x81'),_0x4a6994['id']);_0x1b75a2[_0x44df('0x82')](db[_0x44df('0x70')][_0x44df('0x38')](_0x25c22f[_0x44df('0x83')](),{'type':db[_0x44df('0x70')][_0x44df('0x84')][_0x44df('0x85')]})[_0x44df('0x29')](function(_0x488e99){if(_0x488e99[_0x44df('0x3e')]===0x1){return _0x4a6994['id'];}else{var _0x1915d5=_[_0x44df('0x86')](_['map'](_0x488e99,'TeamId'),function(_0x6d885a){return _[_0x44df('0x87')](_0x253b2e,_0x6d885a);});if(_0x1915d5){return _0x4a6994['id'];}}}));}}return BPromise[_0x44df('0x88')](_0x1b75a2)[_0x44df('0x29')](function(_0x2f1d49){_0x5264e4=_(_0x5264e4)[_0x44df('0x89')](_0x2f1d49)[_0x44df('0x8a')]()[_0x44df('0x8b')]();return db[_0x44df('0x33')][_0x44df('0x4f')]({'where':{'id':_0x50d4f5[_0x44df('0x4d')]['id']}})[_0x44df('0x29')](function(_0x9157f){return db[_0x44df('0x70')][_0x44df('0x71')](function(_0x42cba1){return _0x9157f['removeTeams'](_0x50d4f5['query']['ids'],{'transaction':_0x42cba1})['then'](function(){if(!_['isEmpty'](_0x5264e4)){return _0x9157f['removeAgents'](_0x5264e4,{'transaction':_0x42cba1});}})[_0x44df('0x29')](function(){_0x5264e4[_0x44df('0x74')](function(_0x3b3d86){socket['emit'](_0x44df('0x8c'),{'UserId':_0x3b3d86,'WhatsappQueueId':_0x9157f['id']});});});});});});})[_0x44df('0x29')](respondWithStatusCode(_0x5188cd,null))[_0x44df('0x4c')](handleError(_0x5188cd,null));};exports[_0x44df('0x8d')]=function(_0x504fe6,_0x31d0e7,_0x51104d){return db['WhatsappQueue'][_0x44df('0x4f')]({'where':{'id':_0x504fe6[_0x44df('0x4d')]['id']}})[_0x44df('0x29')](handleEntityNotFound(_0x31d0e7,null))[_0x44df('0x29')](function(_0x2b5245){if(_0x2b5245){return _0x2b5245[_0x44df('0x8d')](_0x504fe6[_0x44df('0x51')][_0x44df('0x6a')],_['omit'](_0x504fe6[_0x44df('0x51')],['ids','id'])||{})[_0x44df('0x8e')](function(_0x2aa2ce){for(var _0x45f874=0x0;_0x45f874<_0x504fe6[_0x44df('0x51')][_0x44df('0x6a')]['length'];_0x45f874+=0x1){socket[_0x44df('0x75')]('userWhatsappQueue:save',{'UserId':Number(_0x504fe6['body'][_0x44df('0x6a')][_0x45f874]),'WhatsappQueueId':Number(_0x504fe6[_0x44df('0x4d')]['id'])});}return _0x2aa2ce;});}})['then'](respondWithResult(_0x31d0e7,null))[_0x44df('0x4c')](handleError(_0x31d0e7,null));};exports[_0x44df('0x8f')]=function(_0x3546ff,_0x3ec767,_0x301f88){return db[_0x44df('0x33')][_0x44df('0x4f')]({'where':{'id':_0x3546ff[_0x44df('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3ec767,null))['then'](function(_0x22f7ee){if(_0x22f7ee){return _0x22f7ee[_0x44df('0x8f')](_0x3546ff[_0x44df('0x38')][_0x44df('0x6a')])[_0x44df('0x29')](function(){if(_[_0x44df('0x90')](_0x3546ff[_0x44df('0x38')][_0x44df('0x6a')])){for(var _0x3e3120=0x0;_0x3e3120<_0x3546ff[_0x44df('0x38')][_0x44df('0x6a')][_0x44df('0x3e')];_0x3e3120+=0x1){socket[_0x44df('0x75')]('userWhatsappQueue:remove',{'UserId':Number(_0x3546ff[_0x44df('0x38')]['ids'][_0x3e3120]),'WhatsappQueueId':Number(_0x3546ff[_0x44df('0x4d')]['id'])});}}else{socket[_0x44df('0x75')](_0x44df('0x8c'),{'UserId':Number(_0x3546ff['query']['ids']),'WhatsappQueueId':Number(_0x3546ff[_0x44df('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x3ec767,null))[_0x44df('0x4c')](handleError(_0x3ec767,null));};exports[_0x44df('0x91')]=function(_0x5a5d0a,_0x575eb1,_0x25f0f6){var _0x174b11={};var _0x3664d1={};var _0x182d38;var _0x134330;return db['WhatsappQueue']['findOne']({'where':{'id':_0x5a5d0a[_0x44df('0x4d')]['id']}})[_0x44df('0x29')](handleEntityNotFound(_0x575eb1,null))[_0x44df('0x29')](function(_0x21626d){if(_0x21626d){_0x182d38=_0x21626d;_0x3664d1[_0x44df('0x37')]=_[_0x44df('0x39')](db[_0x44df('0x5e')][_0x44df('0x34')]);_0x3664d1['query']=_[_0x44df('0x39')](_0x5a5d0a[_0x44df('0x38')]);_0x3664d1['filters']=_[_0x44df('0x3c')](_0x3664d1[_0x44df('0x37')],_0x3664d1[_0x44df('0x38')]);_0x174b11[_0x44df('0x3b')]=_[_0x44df('0x3c')](_0x3664d1[_0x44df('0x37')],qs['fields'](_0x5a5d0a[_0x44df('0x38')]['fields']));_0x174b11['attributes']=_0x174b11[_0x44df('0x3b')][_0x44df('0x3e')]?_0x174b11[_0x44df('0x3b')]:_0x3664d1[_0x44df('0x37')];_0x174b11[_0x44df('0x40')]=qs[_0x44df('0x41')](_0x5a5d0a[_0x44df('0x38')][_0x44df('0x41')]);_0x174b11['where']=qs['filters'](_['pick'](_0x5a5d0a[_0x44df('0x38')],_0x3664d1[_0x44df('0x3a')]));if(_0x5a5d0a[_0x44df('0x38')][_0x44df('0x46')]){_0x174b11[_0x44df('0x42')]=_[_0x44df('0x44')](_0x174b11[_0x44df('0x42')],{'$or':_[_0x44df('0x32')](_0x174b11[_0x44df('0x3b')],function(_0x36551b){var _0x20d78f={};_0x20d78f[_0x36551b]={'$like':'%'+_0x5a5d0a['query'][_0x44df('0x46')]+'%'};return _0x20d78f;})});}_0x174b11=_[_0x44df('0x44')]({},_0x174b11,_0x5a5d0a[_0x44df('0x4e')]);return _0x182d38['getAgents'](_0x174b11);}})[_0x44df('0x29')](function(_0x1c2657){if(_0x1c2657){_0x134330=_0x1c2657[_0x44df('0x3e')];if(!_0x5a5d0a['query'][_0x44df('0x3f')](_0x44df('0x5c'))){_0x174b11[_0x44df('0x25')]=qs[_0x44df('0x25')](_0x5a5d0a[_0x44df('0x38')]['limit']);_0x174b11[_0x44df('0x23')]=qs[_0x44df('0x23')](_0x5a5d0a[_0x44df('0x38')][_0x44df('0x23')]);}return _0x182d38[_0x44df('0x91')](_0x174b11);}})[_0x44df('0x29')](function(_0x298525){if(_0x298525){return _0x298525?{'count':_0x134330,'rows':_0x298525}:null;}})['then'](respondWithResult(_0x575eb1,null))[_0x44df('0x4c')](handleError(_0x575eb1,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 7bd8770..dc4fbb2 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 _0x9862=['update','remove','emit','hasOwnProperty','hook','exports','WhatsappQueue','setMaxListeners'];(function(_0x2f62aa,_0x108e95){var _0x1a341f=function(_0x3aedcf){while(--_0x3aedcf){_0x2f62aa['push'](_0x2f62aa['shift']());}};_0x1a341f(++_0x108e95);}(_0x9862,0x8e));var _0x2986=function(_0x3df68a,_0x2666de){_0x3df68a=_0x3df68a-0x0;var _0x14d7d4=_0x9862[_0x3df68a];return _0x14d7d4;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require('../../mysqldb')['db'][_0x2986('0x0')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x2986('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2986('0x2'),'afterDestroy':_0x2986('0x3')};function emitEvent(_0x3548b9){return function(_0x80b64a,_0x5e717a,_0x4fb2af){WhatsappQueueEvents[_0x2986('0x4')](_0x3548b9+':'+_0x80b64a['id'],_0x80b64a);WhatsappQueueEvents['emit'](_0x3548b9,_0x80b64a);_0x4fb2af(null);};}for(var e in events){if(events[_0x2986('0x5')](e)){var event=events[e];WhatsappQueue[_0x2986('0x6')](e,emitEvent(event));}}module[_0x2986('0x7')]=WhatsappQueueEvents; \ No newline at end of file +var _0xe23c=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','WhatsappQueue','setMaxListeners','update'];(function(_0x2e2dfa,_0xc069ab){var _0x2d3787=function(_0xb47c86){while(--_0xb47c86){_0x2e2dfa['push'](_0x2e2dfa['shift']());}};_0x2d3787(++_0xc069ab);}(_0xe23c,0x1cf));var _0xce23=function(_0x2e8418,_0x58c529){_0x2e8418=_0x2e8418-0x0;var _0x548fe6=_0xe23c[_0x2e8418];return _0x548fe6;};'use strict';var EventEmitter=require(_0xce23('0x0'));var WhatsappQueue=require(_0xce23('0x1'))['db'][_0xce23('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xce23('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xce23('0x4'),'afterDestroy':_0xce23('0x5')};function emitEvent(_0x57d833){return function(_0x1b3329,_0xe8679d,_0x458418){WhatsappQueueEvents['emit'](_0x57d833+':'+_0x1b3329['id'],_0x1b3329);WhatsappQueueEvents[_0xce23('0x6')](_0x57d833,_0x1b3329);_0x458418(null);};}for(var e in events){if(events[_0xce23('0x7')](e)){var event=events[e];WhatsappQueue[_0xce23('0x8')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index b8abe12..309bca0 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 _0xb585=['path','rimraf','../../config/environment','exports','WhatsappQueue','whatsapp_queues','lodash','../../config/logger','moment'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xb585,0xe7));var _0x5b58=function(_0x39d2c6,_0x32fdbd){_0x39d2c6=_0x39d2c6-0x0;var _0x424548=_0xb585[_0x39d2c6];return _0x424548;};'use strict';var _=require(_0x5b58('0x0'));var util=require('util');var logger=require(_0x5b58('0x1'))('api');var moment=require(_0x5b58('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5b58('0x3'));var rimraf=require(_0x5b58('0x4'));var config=require(_0x5b58('0x5'));var attributes=require('./whatsappQueue.attributes');module[_0x5b58('0x6')]=function(_0x5191b4,_0x46f0bb){return _0x5191b4['define'](_0x5b58('0x7'),attributes,{'tableName':_0x5b58('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6096=['api','moment','bluebird','request-promise','exports','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger'];(function(_0x211b59,_0x3640d0){var _0x56e337=function(_0x10a3e2){while(--_0x10a3e2){_0x211b59['push'](_0x211b59['shift']());}};_0x56e337(++_0x3640d0);}(_0x6096,0x11f));var _0x6609=function(_0x284496,_0x268838){_0x284496=_0x284496-0x0;var _0x1e7762=_0x6096[_0x284496];return _0x1e7762;};'use strict';var _=require(_0x6609('0x0'));var util=require(_0x6609('0x1'));var logger=require(_0x6609('0x2'))(_0x6609('0x3'));var moment=require(_0x6609('0x4'));var BPromise=require(_0x6609('0x5'));var rp=require(_0x6609('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./whatsappQueue.attributes');module[_0x6609('0x7')]=function(_0x1aca03,_0x1135f4){return _0x1aca03['define'](_0x6609('0x8'),attributes,{'tableName':_0x6609('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 4e1821a..77856b0 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 _0x3909=['message','result','catch','GetWhatsappQueue','WhatsappQueue','raw','options','where','attributes','limit','include','map','model','find','ShowWhatsappQueue','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1ee496,_0x489e26){var _0x8b9d5a=function(_0x2d1f2c){while(--_0x2d1f2c){_0x1ee496['push'](_0x1ee496['shift']());}};_0x8b9d5a(++_0x489e26);}(_0x3909,0x120));var _0x9390=function(_0x386306,_0x1363c9){_0x386306=_0x386306-0x0;var _0xcb23d=_0x3909[_0x386306];return _0xcb23d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9390('0x0'));var BPromise=require(_0x9390('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9390('0x2'))['db'];var utils=require(_0x9390('0x3'));var logger=require(_0x9390('0x4'))(_0x9390('0x5'));var config=require(_0x9390('0x6'));var jayson=require(_0x9390('0x7'));var client=jayson[_0x9390('0x8')]['http']({'port':0x232a});config[_0x9390('0x9')]=_[_0x9390('0xa')](config['redis'],{'host':_0x9390('0xb'),'port':0x18eb});var socket=require(_0x9390('0xc'))(new Redis(config['redis']));require(_0x9390('0xd'))[_0x9390('0xe')](socket);function respondWithRpcPromise(_0x7d1e86,_0x32bc4,_0x53f938){return new BPromise(function(_0x2d813f,_0x5c4a2c){return client[_0x9390('0xf')](_0x7d1e86,_0x53f938)[_0x9390('0x10')](function(_0x23c560){logger[_0x9390('0x11')](_0x9390('0x12'),_0x32bc4,_0x9390('0x13'));logger[_0x9390('0x14')](_0x9390('0x15'),_0x32bc4,_0x9390('0x13'),JSON[_0x9390('0x16')](_0x23c560));if(_0x23c560['error']){if(_0x23c560['error']['code']===0x1f4){logger[_0x9390('0x17')](_0x9390('0x12'),_0x32bc4,_0x23c560[_0x9390('0x17')][_0x9390('0x18')]);return _0x5c4a2c(_0x23c560[_0x9390('0x17')][_0x9390('0x18')]);}logger['error'](_0x9390('0x12'),_0x32bc4,_0x23c560[_0x9390('0x17')][_0x9390('0x18')]);return _0x2d813f(_0x23c560[_0x9390('0x17')][_0x9390('0x18')]);}else{logger[_0x9390('0x11')](_0x9390('0x12'),_0x32bc4,_0x9390('0x13'));_0x2d813f(_0x23c560[_0x9390('0x19')][_0x9390('0x18')]);}})[_0x9390('0x1a')](function(_0x52435b){logger[_0x9390('0x17')](_0x9390('0x12'),_0x32bc4,_0x52435b);_0x5c4a2c(_0x52435b);});});}exports[_0x9390('0x1b')]=function(_0x44f909){var _0x1fb94c=this;return new Promise(function(_0x511b8b,_0x3108a2){return db[_0x9390('0x1c')]['findAll']({'raw':_0x44f909['options']?_0x44f909['options'][_0x9390('0x1d')]===undefined?!![]:![]:!![],'where':_0x44f909[_0x9390('0x1e')]?_0x44f909[_0x9390('0x1e')][_0x9390('0x1f')]||null:null,'attributes':_0x44f909[_0x9390('0x1e')]?_0x44f909[_0x9390('0x1e')][_0x9390('0x20')]||null:null,'limit':_0x44f909[_0x9390('0x1e')]?_0x44f909['options'][_0x9390('0x21')]||null:null,'include':_0x44f909['options']?_0x44f909[_0x9390('0x1e')][_0x9390('0x22')]?_[_0x9390('0x23')](_0x44f909['options'][_0x9390('0x22')],function(_0xd8db7b){return{'model':db[_0xd8db7b[_0x9390('0x24')]],'as':_0xd8db7b['as'],'attributes':_0xd8db7b[_0x9390('0x20')],'include':_0xd8db7b[_0x9390('0x22')]?_['map'](_0xd8db7b[_0x9390('0x22')],function(_0x585e55){return{'model':db[_0x585e55['model']],'as':_0x585e55['as'],'attributes':_0x585e55[_0x9390('0x20')],'include':_0x585e55[_0x9390('0x22')]?_[_0x9390('0x23')](_0x585e55[_0x9390('0x22')],function(_0x4680d4){return{'model':db[_0x4680d4['model']],'as':_0x4680d4['as'],'attributes':_0x4680d4[_0x9390('0x20')]};}):[]};}):[]};}):[]:[]})[_0x9390('0x10')](function(_0x5dd99a){logger['info'](_0x9390('0x1b'),_0x44f909);logger['debug'](_0x9390('0x1b'),_0x44f909,JSON[_0x9390('0x16')](_0x5dd99a));_0x511b8b(_0x5dd99a);})['catch'](function(_0x1a006b){logger[_0x9390('0x17')](_0x9390('0x1b'),_0x1a006b[_0x9390('0x18')],_0x44f909);_0x3108a2(_0x1fb94c[_0x9390('0x17')](0x1f4,_0x1a006b['message']));});});};exports['ShowWhatsappQueue']=function(_0x50b617){var _0x491772=this;return new Promise(function(_0x4dd362,_0x18182c){return db[_0x9390('0x1c')][_0x9390('0x25')]({'raw':_0x50b617[_0x9390('0x1e')]?_0x50b617[_0x9390('0x1e')][_0x9390('0x1d')]===undefined?!![]:![]:!![],'where':_0x50b617[_0x9390('0x1e')]?_0x50b617[_0x9390('0x1e')]['where']||null:null,'attributes':_0x50b617[_0x9390('0x1e')]?_0x50b617[_0x9390('0x1e')][_0x9390('0x20')]||null:null,'include':_0x50b617['options']?_0x50b617['options']['include']?_[_0x9390('0x23')](_0x50b617['options'][_0x9390('0x22')],function(_0x43ebac){return{'model':db[_0x43ebac[_0x9390('0x24')]],'as':_0x43ebac['as'],'attributes':_0x43ebac[_0x9390('0x20')],'include':_0x43ebac[_0x9390('0x22')]?_[_0x9390('0x23')](_0x43ebac[_0x9390('0x22')],function(_0x424319){return{'model':db[_0x424319['model']],'as':_0x424319['as'],'attributes':_0x424319[_0x9390('0x20')],'include':_0x424319[_0x9390('0x22')]?_[_0x9390('0x23')](_0x424319[_0x9390('0x22')],function(_0x3a8812){return{'model':db[_0x3a8812[_0x9390('0x24')]],'as':_0x3a8812['as'],'attributes':_0x3a8812['attributes']};}):[]};}):[]};}):[]:[]})[_0x9390('0x10')](function(_0x57c979){logger[_0x9390('0x11')](_0x9390('0x26'),_0x50b617);logger[_0x9390('0x14')](_0x9390('0x26'),_0x50b617,JSON[_0x9390('0x16')](_0x57c979));_0x4dd362(_0x57c979);})[_0x9390('0x1a')](function(_0x1817e9){logger[_0x9390('0x17')](_0x9390('0x26'),_0x1817e9[_0x9390('0x18')],_0x50b617);_0x18182c(_0x491772[_0x9390('0x17')](0x1f4,_0x1817e9[_0x9390('0x18')]));});});}; \ No newline at end of file +var _0xa646=['then','info','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','WhatsappQueue','findAll','options','raw','where','limit','include','map','model','attributes','GetWhatsappQueue','ShowWhatsappQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','http','redis','localhost','socket.io-emitter'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0xa646,0x1bc));var _0x6a64=function(_0x3d3f50,_0x91af8e){_0x3d3f50=_0x3d3f50-0x0;var _0x110fb6=_0xa646[_0x3d3f50];return _0x110fb6;};'use strict';var _=require(_0x6a64('0x0'));var util=require('util');var moment=require(_0x6a64('0x1'));var BPromise=require(_0x6a64('0x2'));var rs=require(_0x6a64('0x3'));var fs=require('fs');var Redis=require(_0x6a64('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6a64('0x5'))(_0x6a64('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x6a64('0x7')]({'port':0x232a});config[_0x6a64('0x8')]=_['defaults'](config[_0x6a64('0x8')],{'host':_0x6a64('0x9'),'port':0x18eb});var socket=require(_0x6a64('0xa'))(new Redis(config[_0x6a64('0x8')]));require('./whatsappQueue.socket')['register'](socket);function respondWithRpcPromise(_0x2000aa,_0x1b1837,_0x479ad7){return new BPromise(function(_0x5e82ef,_0x223729){return client['request'](_0x2000aa,_0x479ad7)[_0x6a64('0xb')](function(_0x3d1d67){logger[_0x6a64('0xc')](_0x6a64('0xd'),_0x1b1837,'request\x20sent');logger[_0x6a64('0xe')](_0x6a64('0xf'),_0x1b1837,_0x6a64('0x10'),JSON[_0x6a64('0x11')](_0x3d1d67));if(_0x3d1d67[_0x6a64('0x12')]){if(_0x3d1d67['error'][_0x6a64('0x13')]===0x1f4){logger[_0x6a64('0x12')](_0x6a64('0xd'),_0x1b1837,_0x3d1d67['error'][_0x6a64('0x14')]);return _0x223729(_0x3d1d67[_0x6a64('0x12')][_0x6a64('0x14')]);}logger[_0x6a64('0x12')]('WhatsappQueue,\x20%s,\x20%s',_0x1b1837,_0x3d1d67['error'][_0x6a64('0x14')]);return _0x5e82ef(_0x3d1d67[_0x6a64('0x12')][_0x6a64('0x14')]);}else{logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x1b1837,'request\x20sent');_0x5e82ef(_0x3d1d67['result'][_0x6a64('0x14')]);}})[_0x6a64('0x15')](function(_0x3cb7b5){logger[_0x6a64('0x12')](_0x6a64('0xd'),_0x1b1837,_0x3cb7b5);_0x223729(_0x3cb7b5);});});}exports['GetWhatsappQueue']=function(_0x2a35e7){var _0x1be9fa=this;return new Promise(function(_0x4e602f,_0x223431){return db[_0x6a64('0x16')][_0x6a64('0x17')]({'raw':_0x2a35e7[_0x6a64('0x18')]?_0x2a35e7[_0x6a64('0x18')][_0x6a64('0x19')]===undefined?!![]:![]:!![],'where':_0x2a35e7[_0x6a64('0x18')]?_0x2a35e7['options'][_0x6a64('0x1a')]||null:null,'attributes':_0x2a35e7[_0x6a64('0x18')]?_0x2a35e7[_0x6a64('0x18')]['attributes']||null:null,'limit':_0x2a35e7[_0x6a64('0x18')]?_0x2a35e7[_0x6a64('0x18')][_0x6a64('0x1b')]||null:null,'include':_0x2a35e7['options']?_0x2a35e7[_0x6a64('0x18')][_0x6a64('0x1c')]?_[_0x6a64('0x1d')](_0x2a35e7[_0x6a64('0x18')][_0x6a64('0x1c')],function(_0x1c58ef){return{'model':db[_0x1c58ef[_0x6a64('0x1e')]],'as':_0x1c58ef['as'],'attributes':_0x1c58ef[_0x6a64('0x1f')],'include':_0x1c58ef['include']?_[_0x6a64('0x1d')](_0x1c58ef[_0x6a64('0x1c')],function(_0x2080a8){return{'model':db[_0x2080a8[_0x6a64('0x1e')]],'as':_0x2080a8['as'],'attributes':_0x2080a8[_0x6a64('0x1f')],'include':_0x2080a8['include']?_['map'](_0x2080a8[_0x6a64('0x1c')],function(_0x5f48ac){return{'model':db[_0x5f48ac[_0x6a64('0x1e')]],'as':_0x5f48ac['as'],'attributes':_0x5f48ac[_0x6a64('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6a64('0xb')](function(_0x5c08fc){logger[_0x6a64('0xc')]('GetWhatsappQueue',_0x2a35e7);logger[_0x6a64('0xe')]('GetWhatsappQueue',_0x2a35e7,JSON[_0x6a64('0x11')](_0x5c08fc));_0x4e602f(_0x5c08fc);})['catch'](function(_0x55e821){logger[_0x6a64('0x12')](_0x6a64('0x20'),_0x55e821['message'],_0x2a35e7);_0x223431(_0x1be9fa['error'](0x1f4,_0x55e821['message']));});});};exports[_0x6a64('0x21')]=function(_0x249fcc){var _0x496909=this;return new Promise(function(_0x486b8c,_0x5c291e){return db[_0x6a64('0x16')][_0x6a64('0x22')]({'raw':_0x249fcc['options']?_0x249fcc[_0x6a64('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x249fcc['options']?_0x249fcc[_0x6a64('0x18')][_0x6a64('0x1a')]||null:null,'attributes':_0x249fcc['options']?_0x249fcc['options']['attributes']||null:null,'include':_0x249fcc[_0x6a64('0x18')]?_0x249fcc['options'][_0x6a64('0x1c')]?_[_0x6a64('0x1d')](_0x249fcc[_0x6a64('0x18')]['include'],function(_0x20d127){return{'model':db[_0x20d127[_0x6a64('0x1e')]],'as':_0x20d127['as'],'attributes':_0x20d127[_0x6a64('0x1f')],'include':_0x20d127[_0x6a64('0x1c')]?_[_0x6a64('0x1d')](_0x20d127['include'],function(_0x5757b2){return{'model':db[_0x5757b2[_0x6a64('0x1e')]],'as':_0x5757b2['as'],'attributes':_0x5757b2['attributes'],'include':_0x5757b2[_0x6a64('0x1c')]?_[_0x6a64('0x1d')](_0x5757b2[_0x6a64('0x1c')],function(_0x277b16){return{'model':db[_0x277b16[_0x6a64('0x1e')]],'as':_0x277b16['as'],'attributes':_0x277b16[_0x6a64('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x32dc25){logger[_0x6a64('0xc')](_0x6a64('0x21'),_0x249fcc);logger[_0x6a64('0xe')](_0x6a64('0x21'),_0x249fcc,JSON[_0x6a64('0x11')](_0x32dc25));_0x486b8c(_0x32dc25);})[_0x6a64('0x15')](function(_0x5dd437){logger[_0x6a64('0x12')]('ShowWhatsappQueue',_0x5dd437['message'],_0x249fcc);_0x5c291e(_0x496909[_0x6a64('0x12')](0x1f4,_0x5dd437[_0x6a64('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index fedc0d1..da9d35a 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 _0xca72=['register','length','./whatsappQueue.events','remove','update','emit','removeListener'];(function(_0x6dcb0d,_0x15ea31){var _0x3cec29=function(_0x2b02e1){while(--_0x2b02e1){_0x6dcb0d['push'](_0x6dcb0d['shift']());}};_0x3cec29(++_0x15ea31);}(_0xca72,0x19f));var _0x2ca7=function(_0x54c695,_0x5d6677){_0x54c695=_0x54c695-0x0;var _0x3ce06b=_0xca72[_0x54c695];return _0x3ce06b;};'use strict';var WhatsappQueueEvents=require(_0x2ca7('0x0'));var events=['save',_0x2ca7('0x1'),_0x2ca7('0x2')];function createListener(_0x6011d1,_0x5982b0){return function(_0x549990){_0x5982b0[_0x2ca7('0x3')](_0x6011d1,_0x549990);};}function removeListener(_0x2194df,_0x423372){return function(){WhatsappQueueEvents[_0x2ca7('0x4')](_0x2194df,_0x423372);};}exports[_0x2ca7('0x5')]=function(_0x16c588){for(var _0x43e7dd=0x0,_0xc4236f=events[_0x2ca7('0x6')];_0x43e7dd<_0xc4236f;_0x43e7dd++){var _0x2d6ac8=events[_0x43e7dd];var _0x5b72e2=createListener('whatsappQueue:'+_0x2d6ac8,_0x16c588);WhatsappQueueEvents['on'](_0x2d6ac8,_0x5b72e2);}}; \ No newline at end of file +var _0xf929=['length','whatsappQueue:','./whatsappQueue.events','save','remove','update','removeListener','register'];(function(_0x509850,_0x2f4655){var _0xf2a663=function(_0x529117){while(--_0x529117){_0x509850['push'](_0x509850['shift']());}};_0xf2a663(++_0x2f4655);}(_0xf929,0x162));var _0x9f92=function(_0x5a7093,_0x2ddd28){_0x5a7093=_0x5a7093-0x0;var _0x3e2b64=_0xf929[_0x5a7093];return _0x3e2b64;};'use strict';var WhatsappQueueEvents=require(_0x9f92('0x0'));var events=[_0x9f92('0x1'),_0x9f92('0x2'),_0x9f92('0x3')];function createListener(_0x2a0fa5,_0x171a15){return function(_0x6ea37b){_0x171a15['emit'](_0x2a0fa5,_0x6ea37b);};}function removeListener(_0x2ccbef,_0x119696){return function(){WhatsappQueueEvents[_0x9f92('0x4')](_0x2ccbef,_0x119696);};}exports[_0x9f92('0x5')]=function(_0x279bd5){for(var _0xd61da1=0x0,_0x448222=events[_0x9f92('0x6')];_0xd61da1<_0x448222;_0xd61da1++){var _0x34c995=events[_0xd61da1];var _0x4475c8=createListener(_0x9f92('0x7')+_0x34c995,_0x279bd5);WhatsappQueueEvents['on'](_0x34c995,_0x4475c8);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 0a0d788..2c367b8 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 _0x0ef7=['multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./whatsappQueueReport.controller','isAuthenticated','index','get','describe','/:id','show','post','create','delete','destroy'];(function(_0x2aa50b,_0x4c23c9){var _0x102c25=function(_0x3f0d2c){while(--_0x3f0d2c){_0x2aa50b['push'](_0x2aa50b['shift']());}};_0x102c25(++_0x4c23c9);}(_0x0ef7,0x187));var _0x70ef=function(_0x35ef6b,_0x202c42){_0x35ef6b=_0x35ef6b-0x0;var _0x3ad145=_0x0ef7[_0x35ef6b];return _0x3ad145;};'use strict';var multer=require(_0x70ef('0x0'));var util=require('util');var path=require(_0x70ef('0x1'));var timeout=require(_0x70ef('0x2'));var express=require('express');var router=express[_0x70ef('0x3')]();var fs_extra=require(_0x70ef('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x70ef('0x5'));var config=require('../../config/environment');var controller=require(_0x70ef('0x6'));router['get']('/',auth[_0x70ef('0x7')](),controller[_0x70ef('0x8')]);router[_0x70ef('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x70ef('0xa')]);router[_0x70ef('0x9')](_0x70ef('0xb'),auth[_0x70ef('0x7')](),controller[_0x70ef('0xc')]);router[_0x70ef('0xd')]('/',auth[_0x70ef('0x7')](),controller[_0x70ef('0xe')]);router['put'](_0x70ef('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x70ef('0xf')]('/:id',auth[_0x70ef('0x7')](),controller[_0x70ef('0x10')]);module['exports']=router; \ No newline at end of file +var _0x808d=['get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller'];(function(_0x571714,_0x30d2b3){var _0x599a14=function(_0x3874fa){while(--_0x3874fa){_0x571714['push'](_0x571714['shift']());}};_0x599a14(++_0x30d2b3);}(_0x808d,0x175));var _0xd808=function(_0x931956,_0x3bc281){_0x931956=_0x931956-0x0;var _0x4d19d0=_0x808d[_0x931956];return _0x4d19d0;};'use strict';var multer=require('multer');var util=require(_0xd808('0x0'));var path=require('path');var timeout=require(_0xd808('0x1'));var express=require(_0xd808('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd808('0x3'));var interaction=require(_0xd808('0x4'));var config=require(_0xd808('0x5'));var controller=require(_0xd808('0x6'));router[_0xd808('0x7')]('/',auth[_0xd808('0x8')](),controller[_0xd808('0x9')]);router['get'](_0xd808('0xa'),auth[_0xd808('0x8')](),controller[_0xd808('0xb')]);router[_0xd808('0x7')](_0xd808('0xc'),auth[_0xd808('0x8')](),controller['show']);router[_0xd808('0xd')]('/',auth[_0xd808('0x8')](),controller[_0xd808('0xe')]);router[_0xd808('0xf')](_0xd808('0xc'),auth[_0xd808('0x8')](),controller[_0xd808('0x10')]);router[_0xd808('0x11')](_0xd808('0xc'),auth[_0xd808('0x8')](),controller[_0xd808('0x12')]);module[_0xd808('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 58cb642..1eb108f 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(_0x37a949,_0x447368){var _0x1b33db=function(_0x58f6b6){while(--_0x58f6b6){_0x37a949['push'](_0x37a949['shift']());}};_0x1b33db(++_0x447368);}(_0x7a54,0x106));var _0x47a5=function(_0x29be1f,_0x36c67a){_0x29be1f=_0x29be1f-0x0;var _0x1936ca=_0x7a54[_0x29be1f];return _0x1936ca;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x52ac45,_0xa3be46){var _0x28bfdb=function(_0x49905f){while(--_0x49905f){_0x52ac45['push'](_0x52ac45['shift']());}};_0x28bfdb(++_0xa3be46);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index b8c15a8..1a489c7 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 _0x63a5=['filter','merge','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','WhatsappQueueReport','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x14ab4b,_0x15b381){var _0x3fa444=function(_0x21261d){while(--_0x21261d){_0x14ab4b['push'](_0x14ab4b['shift']());}};_0x3fa444(++_0x15b381);}(_0x63a5,0x18e));var _0x563a=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0x63a5[_0x2d34d6];return _0x1d3d12;};'use strict';var emlformat=require(_0x563a('0x0'));var rimraf=require(_0x563a('0x1'));var zipdir=require(_0x563a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x563a('0x3'));var moment=require('moment');var BPromise=require(_0x563a('0x4'));var Mustache=require(_0x563a('0x5'));var util=require(_0x563a('0x6'));var path=require(_0x563a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x563a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x563a('0x9'));var squel=require(_0x563a('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x563a('0xb'));var toCsv=require(_0x563a('0xc'));var querystring=require(_0x563a('0xd'));var Papa=require(_0x563a('0xe'));var Redis=require(_0x563a('0xf'));var authService=require(_0x563a('0x10'));var qs=require(_0x563a('0x11'));var as=require(_0x563a('0x12'));var hardwareService=require(_0x563a('0x13'));var logger=require(_0x563a('0x14'))(_0x563a('0x15'));var utils=require(_0x563a('0x16'));var config=require(_0x563a('0x17'));var licenseUtil=require(_0x563a('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x61d5b2,_0x214f42){_0x214f42=_0x214f42||0xcc;return function(_0x10de2e){if(_0x10de2e){return _0x61d5b2[_0x563a('0x19')](_0x214f42);}return _0x61d5b2[_0x563a('0x1a')](_0x214f42)[_0x563a('0x1b')]();};}function respondWithResult(_0x50396b,_0x2cf052){_0x2cf052=_0x2cf052||0xc8;return function(_0x3045ac){if(_0x3045ac){return _0x50396b[_0x563a('0x1a')](_0x2cf052)[_0x563a('0x1c')](_0x3045ac);}};}function respondWithFilteredResult(_0x5a2980,_0x504cb7){return function(_0x414535){if(_0x414535){var _0x2ad667=typeof _0x504cb7['offset']===_0x563a('0x1d')&&typeof _0x504cb7[_0x563a('0x1e')]===_0x563a('0x1d');var _0x9c2f77=_0x414535['count'];var _0x598693=_0x2ad667?0x0:_0x504cb7[_0x563a('0x1f')];var _0x422aaf=_0x2ad667?_0x414535[_0x563a('0x20')]:_0x504cb7['offset']+_0x504cb7['limit'];var _0x52b99a;if(_0x422aaf>=_0x9c2f77){_0x422aaf=_0x9c2f77;_0x52b99a=0xc8;}else{_0x52b99a=0xce;}_0x5a2980['status'](_0x52b99a);return _0x5a2980[_0x563a('0x21')](_0x563a('0x22'),_0x598693+'-'+_0x422aaf+'/'+_0x9c2f77)[_0x563a('0x1c')](_0x414535);}return null;};}function patchUpdates(_0x43b7a8){return function(_0x562fce){try{jsonpatch['apply'](_0x562fce,_0x43b7a8,!![]);}catch(_0x3930f0){return BPromise[_0x563a('0x23')](_0x3930f0);}return _0x562fce[_0x563a('0x24')]();};}function saveUpdates(_0x2beccb,_0x1bf502){return function(_0x2dc7e2){if(_0x2dc7e2){return _0x2dc7e2[_0x563a('0x25')](_0x2beccb)[_0x563a('0x26')](function(_0x506491){return _0x506491;});}return null;};}function removeEntity(_0xd59ba8,_0x5422f6){return function(_0x44e2c1){if(_0x44e2c1){return _0x44e2c1[_0x563a('0x27')]()[_0x563a('0x26')](function(){_0xd59ba8[_0x563a('0x1a')](0xcc)[_0x563a('0x1b')]();});}};}function handleEntityNotFound(_0x1682ee,_0x3642b3){return function(_0x173990){if(!_0x173990){_0x1682ee['sendStatus'](0x194);}return _0x173990;};}function handleError(_0x146ea0,_0x2b688e){_0x2b688e=_0x2b688e||0x1f4;return function(_0x2311f2){logger[_0x563a('0x28')](_0x2311f2[_0x563a('0x29')]);if(_0x2311f2[_0x563a('0x2a')]){delete _0x2311f2[_0x563a('0x2a')];}_0x146ea0[_0x563a('0x1a')](_0x2b688e)[_0x563a('0x2b')](_0x2311f2);};}exports[_0x563a('0x2c')]=function(_0x1a69d5,_0x24d1a8){var _0x1bdfb0={},_0x7696c2={},_0x579cb5={'count':0x0,'rows':[]};var _0x43379c=_[_0x563a('0x2d')](db[_0x563a('0x2e')]['rawAttributes'],function(_0x1e8d43){return{'name':_0x1e8d43[_0x563a('0x2f')],'type':_0x1e8d43[_0x563a('0x30')][_0x563a('0x31')]};});_0x7696c2[_0x563a('0x32')]=_[_0x563a('0x2d')](_0x43379c,_0x563a('0x2a'));_0x7696c2['query']=_[_0x563a('0x33')](_0x1a69d5[_0x563a('0x34')]);_0x7696c2[_0x563a('0x35')]=_[_0x563a('0x36')](_0x7696c2[_0x563a('0x32')],_0x7696c2['query']);_0x1bdfb0['attributes']=_['intersection'](_0x7696c2['model'],qs[_0x563a('0x37')](_0x1a69d5[_0x563a('0x34')][_0x563a('0x37')]));_0x1bdfb0[_0x563a('0x38')]=_0x1bdfb0[_0x563a('0x38')][_0x563a('0x39')]?_0x1bdfb0['attributes']:_0x7696c2['model'];if(!_0x1a69d5[_0x563a('0x34')][_0x563a('0x3a')](_0x563a('0x3b'))){_0x1bdfb0[_0x563a('0x1e')]=qs[_0x563a('0x1e')](_0x1a69d5[_0x563a('0x34')][_0x563a('0x1e')]);_0x1bdfb0[_0x563a('0x1f')]=qs[_0x563a('0x1f')](_0x1a69d5[_0x563a('0x34')][_0x563a('0x1f')]);}_0x1bdfb0[_0x563a('0x3c')]=qs[_0x563a('0x3d')](_0x1a69d5[_0x563a('0x34')][_0x563a('0x3d')]);_0x1bdfb0[_0x563a('0x3e')]=qs['filters'](_[_0x563a('0x3f')](_0x1a69d5[_0x563a('0x34')],_0x7696c2[_0x563a('0x35')]),_0x43379c);if(_0x1a69d5['query'][_0x563a('0x40')]){_0x1bdfb0['where']=_[_0x563a('0x41')](_0x1bdfb0[_0x563a('0x3e')],{'$or':_['map'](_0x43379c,function(_0x52e4a2){if(_0x52e4a2[_0x563a('0x30')]!=='VIRTUAL'){var _0x13b795={};_0x13b795[_0x52e4a2[_0x563a('0x2a')]]={'$like':'%'+_0x1a69d5[_0x563a('0x34')][_0x563a('0x40')]+'%'};return _0x13b795;}})});}_0x1bdfb0=_['merge']({},_0x1bdfb0,_0x1a69d5['options']);var _0x615d2e={'where':_0x1bdfb0['where']};return db[_0x563a('0x2e')][_0x563a('0x20')](_0x615d2e)[_0x563a('0x26')](function(_0x9c392c){_0x579cb5[_0x563a('0x20')]=_0x9c392c;if(_0x1a69d5[_0x563a('0x34')][_0x563a('0x42')]){_0x1bdfb0[_0x563a('0x43')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x563a('0x44')](_0x1bdfb0);})['then'](function(_0x20c142){_0x579cb5[_0x563a('0x45')]=_0x20c142;return _0x579cb5;})[_0x563a('0x26')](respondWithFilteredResult(_0x24d1a8,_0x1bdfb0))[_0x563a('0x46')](handleError(_0x24d1a8,null));};exports['show']=function(_0x4b3d38,_0x54ac1e){var _0x2221d4={'raw':!![],'where':{'id':_0x4b3d38[_0x563a('0x47')]['id']}},_0x1255da={};_0x1255da[_0x563a('0x32')]=_[_0x563a('0x33')](db[_0x563a('0x2e')][_0x563a('0x48')]);_0x1255da[_0x563a('0x34')]=_[_0x563a('0x33')](_0x4b3d38[_0x563a('0x34')]);_0x1255da[_0x563a('0x35')]=_[_0x563a('0x36')](_0x1255da[_0x563a('0x32')],_0x1255da[_0x563a('0x34')]);_0x2221d4[_0x563a('0x38')]=_[_0x563a('0x36')](_0x1255da[_0x563a('0x32')],qs[_0x563a('0x37')](_0x4b3d38[_0x563a('0x34')]['fields']));_0x2221d4['attributes']=_0x2221d4[_0x563a('0x38')][_0x563a('0x39')]?_0x2221d4[_0x563a('0x38')]:_0x1255da[_0x563a('0x32')];if(_0x4b3d38[_0x563a('0x34')][_0x563a('0x42')]){_0x2221d4[_0x563a('0x43')]=[{'all':!![]}];}_0x2221d4=_[_0x563a('0x41')]({},_0x2221d4,_0x4b3d38['options']);return db['WhatsappQueueReport'][_0x563a('0x49')](_0x2221d4)[_0x563a('0x26')](handleEntityNotFound(_0x54ac1e,null))[_0x563a('0x26')](respondWithResult(_0x54ac1e,null))[_0x563a('0x46')](handleError(_0x54ac1e,null));};exports[_0x563a('0x4a')]=function(_0x3f2c5d,_0x2689b5){return db[_0x563a('0x2e')]['create'](_0x3f2c5d[_0x563a('0x4b')],{})[_0x563a('0x26')](respondWithResult(_0x2689b5,0xc9))['catch'](handleError(_0x2689b5,null));};exports[_0x563a('0x25')]=function(_0x5a063a,_0x3ea787){if(_0x5a063a[_0x563a('0x4b')]['id']){delete _0x5a063a[_0x563a('0x4b')]['id'];}return db['WhatsappQueueReport'][_0x563a('0x49')]({'where':{'id':_0x5a063a[_0x563a('0x47')]['id']}})[_0x563a('0x26')](handleEntityNotFound(_0x3ea787,null))[_0x563a('0x26')](saveUpdates(_0x5a063a[_0x563a('0x4b')],null))[_0x563a('0x26')](respondWithResult(_0x3ea787,null))[_0x563a('0x46')](handleError(_0x3ea787,null));};exports[_0x563a('0x27')]=function(_0x277d54,_0x2008d4){return db[_0x563a('0x2e')][_0x563a('0x49')]({'where':{'id':_0x277d54[_0x563a('0x47')]['id']}})['then'](handleEntityNotFound(_0x2008d4,null))['then'](removeEntity(_0x2008d4,null))[_0x563a('0x46')](handleError(_0x2008d4,null));};exports[_0x563a('0x4c')]=function(_0x143daa,_0x4a807f){return db['WhatsappQueueReport'][_0x563a('0x4c')]()[_0x563a('0x26')](respondWithResult(_0x4a807f,null))['catch'](handleError(_0x4a807f,null));}; \ No newline at end of file +var _0x9354=['rows','show','keys','length','find','catch','create','body','params','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','apply','reject','save','update','then','destroy','error','stack','name','map','WhatsappQueueReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','offset','sort','filter','where','merge','type','options','includeAll','include','findAll'];(function(_0x308d5b,_0x41078b){var _0x4b8b3c=function(_0xd2b774){while(--_0xd2b774){_0x308d5b['push'](_0x308d5b['shift']());}};_0x4b8b3c(++_0x41078b);}(_0x9354,0x96));var _0x4935=function(_0x22bdd3,_0x552e50){_0x22bdd3=_0x22bdd3-0x0;var _0x44d9d9=_0x9354[_0x22bdd3];return _0x44d9d9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4935('0x0'));var zipdir=require(_0x4935('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4935('0x2'));var moment=require(_0x4935('0x3'));var BPromise=require(_0x4935('0x4'));var Mustache=require(_0x4935('0x5'));var util=require('util');var path=require(_0x4935('0x6'));var sox=require(_0x4935('0x7'));var csv=require(_0x4935('0x8'));var ejs=require(_0x4935('0x9'));var fs=require('fs');var fs_extra=require(_0x4935('0xa'));var _=require(_0x4935('0xb'));var squel=require(_0x4935('0xc'));var crypto=require(_0x4935('0xd'));var jsforce=require(_0x4935('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4935('0x8'));var querystring=require('querystring');var Papa=require(_0x4935('0xf'));var Redis=require(_0x4935('0x10'));var authService=require(_0x4935('0x11'));var qs=require(_0x4935('0x12'));var as=require(_0x4935('0x13'));var hardwareService=require(_0x4935('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x4935('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4935('0x16'))['db'];function respondWithStatusCode(_0x32916f,_0x3bb388){_0x3bb388=_0x3bb388||0xcc;return function(_0x1c6c22){if(_0x1c6c22){return _0x32916f[_0x4935('0x17')](_0x3bb388);}return _0x32916f[_0x4935('0x18')](_0x3bb388)[_0x4935('0x19')]();};}function respondWithResult(_0x3a7c30,_0x57549f){_0x57549f=_0x57549f||0xc8;return function(_0x237e28){if(_0x237e28){return _0x3a7c30[_0x4935('0x18')](_0x57549f)[_0x4935('0x1a')](_0x237e28);}};}function respondWithFilteredResult(_0xa41961,_0x3652c4){return function(_0x24cc99){if(_0x24cc99){var _0x395a43=typeof _0x3652c4['offset']===_0x4935('0x1b')&&typeof _0x3652c4[_0x4935('0x1c')]===_0x4935('0x1b');var _0x123300=_0x24cc99[_0x4935('0x1d')];var _0x429ef3=_0x395a43?0x0:_0x3652c4['offset'];var _0xd70eff=_0x395a43?_0x24cc99[_0x4935('0x1d')]:_0x3652c4['offset']+_0x3652c4[_0x4935('0x1c')];var _0x10407f;if(_0xd70eff>=_0x123300){_0xd70eff=_0x123300;_0x10407f=0xc8;}else{_0x10407f=0xce;}_0xa41961[_0x4935('0x18')](_0x10407f);return _0xa41961['set']('Content-Range',_0x429ef3+'-'+_0xd70eff+'/'+_0x123300)[_0x4935('0x1a')](_0x24cc99);}return null;};}function patchUpdates(_0x6b849f){return function(_0x1ae059){try{jsonpatch[_0x4935('0x1e')](_0x1ae059,_0x6b849f,!![]);}catch(_0x41d76e){return BPromise[_0x4935('0x1f')](_0x41d76e);}return _0x1ae059[_0x4935('0x20')]();};}function saveUpdates(_0xe482a5,_0x58b2f3){return function(_0x2f520a){if(_0x2f520a){return _0x2f520a[_0x4935('0x21')](_0xe482a5)[_0x4935('0x22')](function(_0x2c701f){return _0x2c701f;});}return null;};}function removeEntity(_0x52c65a,_0x53530f){return function(_0x4dc1f5){if(_0x4dc1f5){return _0x4dc1f5[_0x4935('0x23')]()[_0x4935('0x22')](function(){_0x52c65a[_0x4935('0x18')](0xcc)[_0x4935('0x19')]();});}};}function handleEntityNotFound(_0x344e51,_0x1c37ba){return function(_0x3784f9){if(!_0x3784f9){_0x344e51[_0x4935('0x17')](0x194);}return _0x3784f9;};}function handleError(_0x2e1583,_0xf4abb2){_0xf4abb2=_0xf4abb2||0x1f4;return function(_0x1d08b5){logger[_0x4935('0x24')](_0x1d08b5[_0x4935('0x25')]);if(_0x1d08b5[_0x4935('0x26')]){delete _0x1d08b5[_0x4935('0x26')];}_0x2e1583['status'](_0xf4abb2)['send'](_0x1d08b5);};}exports['index']=function(_0x1fc218,_0x76ea7d){var _0x4f1163={},_0x3f0707={},_0x20755a={'count':0x0,'rows':[]};var _0x24a3b6=_[_0x4935('0x27')](db[_0x4935('0x28')][_0x4935('0x29')],function(_0x28afc2){return{'name':_0x28afc2[_0x4935('0x2a')],'type':_0x28afc2['type'][_0x4935('0x2b')]};});_0x3f0707[_0x4935('0x2c')]=_['map'](_0x24a3b6,'name');_0x3f0707[_0x4935('0x2d')]=_['keys'](_0x1fc218[_0x4935('0x2d')]);_0x3f0707[_0x4935('0x2e')]=_[_0x4935('0x2f')](_0x3f0707['model'],_0x3f0707['query']);_0x4f1163[_0x4935('0x30')]=_[_0x4935('0x2f')](_0x3f0707['model'],qs[_0x4935('0x31')](_0x1fc218[_0x4935('0x2d')][_0x4935('0x31')]));_0x4f1163[_0x4935('0x30')]=_0x4f1163[_0x4935('0x30')]['length']?_0x4f1163['attributes']:_0x3f0707[_0x4935('0x2c')];if(!_0x1fc218[_0x4935('0x2d')]['hasOwnProperty']('nolimit')){_0x4f1163[_0x4935('0x1c')]=qs['limit'](_0x1fc218[_0x4935('0x2d')][_0x4935('0x1c')]);_0x4f1163[_0x4935('0x32')]=qs[_0x4935('0x32')](_0x1fc218[_0x4935('0x2d')][_0x4935('0x32')]);}_0x4f1163['order']=qs[_0x4935('0x33')](_0x1fc218['query'][_0x4935('0x33')]);_0x4f1163['where']=qs[_0x4935('0x2e')](_['pick'](_0x1fc218[_0x4935('0x2d')],_0x3f0707[_0x4935('0x2e')]),_0x24a3b6);if(_0x1fc218[_0x4935('0x2d')][_0x4935('0x34')]){_0x4f1163[_0x4935('0x35')]=_[_0x4935('0x36')](_0x4f1163[_0x4935('0x35')],{'$or':_['map'](_0x24a3b6,function(_0x57e1ca){if(_0x57e1ca[_0x4935('0x37')]!=='VIRTUAL'){var _0x4e8b2e={};_0x4e8b2e[_0x57e1ca[_0x4935('0x26')]]={'$like':'%'+_0x1fc218['query'][_0x4935('0x34')]+'%'};return _0x4e8b2e;}})});}_0x4f1163=_[_0x4935('0x36')]({},_0x4f1163,_0x1fc218[_0x4935('0x38')]);var _0x99b7c5={'where':_0x4f1163[_0x4935('0x35')]};return db['WhatsappQueueReport']['count'](_0x99b7c5)[_0x4935('0x22')](function(_0x2be169){_0x20755a[_0x4935('0x1d')]=_0x2be169;if(_0x1fc218[_0x4935('0x2d')][_0x4935('0x39')]){_0x4f1163[_0x4935('0x3a')]=[{'all':!![]}];}return db[_0x4935('0x28')][_0x4935('0x3b')](_0x4f1163);})['then'](function(_0x4e94f6){_0x20755a[_0x4935('0x3c')]=_0x4e94f6;return _0x20755a;})[_0x4935('0x22')](respondWithFilteredResult(_0x76ea7d,_0x4f1163))['catch'](handleError(_0x76ea7d,null));};exports[_0x4935('0x3d')]=function(_0x157950,_0x4706eb){var _0xe5c9f5={'raw':!![],'where':{'id':_0x157950['params']['id']}},_0x52ab0c={};_0x52ab0c[_0x4935('0x2c')]=_[_0x4935('0x3e')](db['WhatsappQueueReport'][_0x4935('0x29')]);_0x52ab0c[_0x4935('0x2d')]=_[_0x4935('0x3e')](_0x157950['query']);_0x52ab0c[_0x4935('0x2e')]=_[_0x4935('0x2f')](_0x52ab0c[_0x4935('0x2c')],_0x52ab0c[_0x4935('0x2d')]);_0xe5c9f5[_0x4935('0x30')]=_[_0x4935('0x2f')](_0x52ab0c[_0x4935('0x2c')],qs[_0x4935('0x31')](_0x157950[_0x4935('0x2d')][_0x4935('0x31')]));_0xe5c9f5[_0x4935('0x30')]=_0xe5c9f5[_0x4935('0x30')][_0x4935('0x3f')]?_0xe5c9f5[_0x4935('0x30')]:_0x52ab0c[_0x4935('0x2c')];if(_0x157950[_0x4935('0x2d')][_0x4935('0x39')]){_0xe5c9f5[_0x4935('0x3a')]=[{'all':!![]}];}_0xe5c9f5=_['merge']({},_0xe5c9f5,_0x157950[_0x4935('0x38')]);return db['WhatsappQueueReport'][_0x4935('0x40')](_0xe5c9f5)[_0x4935('0x22')](handleEntityNotFound(_0x4706eb,null))[_0x4935('0x22')](respondWithResult(_0x4706eb,null))[_0x4935('0x41')](handleError(_0x4706eb,null));};exports['create']=function(_0x2a3404,_0x9c8bad){return db[_0x4935('0x28')][_0x4935('0x42')](_0x2a3404[_0x4935('0x43')],{})[_0x4935('0x22')](respondWithResult(_0x9c8bad,0xc9))[_0x4935('0x41')](handleError(_0x9c8bad,null));};exports[_0x4935('0x21')]=function(_0x29b932,_0x392cba){if(_0x29b932['body']['id']){delete _0x29b932[_0x4935('0x43')]['id'];}return db[_0x4935('0x28')]['find']({'where':{'id':_0x29b932[_0x4935('0x44')]['id']}})[_0x4935('0x22')](handleEntityNotFound(_0x392cba,null))[_0x4935('0x22')](saveUpdates(_0x29b932[_0x4935('0x43')],null))[_0x4935('0x22')](respondWithResult(_0x392cba,null))[_0x4935('0x41')](handleError(_0x392cba,null));};exports[_0x4935('0x23')]=function(_0x471fb1,_0x4b9c70){return db[_0x4935('0x28')]['find']({'where':{'id':_0x471fb1['params']['id']}})[_0x4935('0x22')](handleEntityNotFound(_0x4b9c70,null))[_0x4935('0x22')](removeEntity(_0x4b9c70,null))[_0x4935('0x41')](handleError(_0x4b9c70,null));};exports[_0x4935('0x45')]=function(_0x2dd30f,_0x487cf3){return db[_0x4935('0x28')][_0x4935('0x45')]()[_0x4935('0x22')](respondWithResult(_0x487cf3,null))[_0x4935('0x41')](handleError(_0x487cf3,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 9b8db92..2e93522 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 _0x1c58=['rimraf','../../config/environment','./whatsappQueueReport.attributes','define','WhatsappQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x1c58,0x164));var _0x81c5=function(_0xff44a,_0x3c80e2){_0xff44a=_0xff44a-0x0;var _0x5766fd=_0x1c58[_0xff44a];return _0x5766fd;};'use strict';var _=require(_0x81c5('0x0'));var util=require(_0x81c5('0x1'));var logger=require(_0x81c5('0x2'))(_0x81c5('0x3'));var moment=require(_0x81c5('0x4'));var BPromise=require(_0x81c5('0x5'));var rp=require(_0x81c5('0x6'));var fs=require('fs');var path=require(_0x81c5('0x7'));var rimraf=require(_0x81c5('0x8'));var config=require(_0x81c5('0x9'));var attributes=require(_0x81c5('0xa'));module['exports']=function(_0x680a47,_0x33fdc2){return _0x680a47[_0x81c5('0xb')](_0x81c5('0xc'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x81c5('0xd'),'fields':[_0x81c5('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8205=['rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','WhatsappQueueReport','uniqueid','../../config/logger','api','moment','request-promise','path'];(function(_0x4a13c0,_0x28ecd8){var _0xf19dcc=function(_0x25dcdd){while(--_0x25dcdd){_0x4a13c0['push'](_0x4a13c0['shift']());}};_0xf19dcc(++_0x28ecd8);}(_0x8205,0x1a8));var _0x5820=function(_0x71102b,_0x46d590){_0x71102b=_0x71102b-0x0;var _0x210cde=_0x8205[_0x71102b];return _0x210cde;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5820('0x0'))(_0x5820('0x1'));var moment=require(_0x5820('0x2'));var BPromise=require('bluebird');var rp=require(_0x5820('0x3'));var fs=require('fs');var path=require(_0x5820('0x4'));var rimraf=require(_0x5820('0x5'));var config=require(_0x5820('0x6'));var attributes=require(_0x5820('0x7'));module[_0x5820('0x8')]=function(_0x52d7e1,_0x29c6e9){return _0x52d7e1['define'](_0x5820('0x9'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x5820('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index a8e3343..6eae95f 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 _0x9ce5=['stringify','UpdateWhatsappQueueReport','update','raw','where','attributes','limit','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','WhatsappQueueReport,\x20%s,\x20%s','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options'];(function(_0x31ce3d,_0x581047){var _0x203d95=function(_0x9b9243){while(--_0x9b9243){_0x31ce3d['push'](_0x31ce3d['shift']());}};_0x203d95(++_0x581047);}(_0x9ce5,0x193));var _0x59ce=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0x9ce5[_0x3fba9f];return _0x192cf1;};'use strict';var _=require('lodash');var util=require(_0x59ce('0x0'));var moment=require(_0x59ce('0x1'));var BPromise=require(_0x59ce('0x2'));var rs=require(_0x59ce('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x59ce('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x59ce('0x5'))('rpc');var config=require(_0x59ce('0x6'));var jayson=require(_0x59ce('0x7'));var client=jayson[_0x59ce('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14fb16,_0x5524b8,_0x494c3e){return new BPromise(function(_0x105d26,_0xbdb5c6){return client[_0x59ce('0x9')](_0x14fb16,_0x494c3e)[_0x59ce('0xa')](function(_0x23e243){logger['info'](_0x59ce('0xb'),_0x5524b8,'request\x20sent');logger[_0x59ce('0xc')](_0x59ce('0xd'),_0x5524b8,_0x59ce('0xe'),JSON['stringify'](_0x23e243));if(_0x23e243[_0x59ce('0xf')]){if(_0x23e243[_0x59ce('0xf')][_0x59ce('0x10')]===0x1f4){logger[_0x59ce('0xf')](_0x59ce('0xb'),_0x5524b8,_0x23e243[_0x59ce('0xf')]['message']);return _0xbdb5c6(_0x23e243[_0x59ce('0xf')][_0x59ce('0x11')]);}logger['error'](_0x59ce('0xb'),_0x5524b8,_0x23e243[_0x59ce('0xf')][_0x59ce('0x11')]);return _0x105d26(_0x23e243[_0x59ce('0xf')]['message']);}else{logger[_0x59ce('0x12')](_0x59ce('0xb'),_0x5524b8,_0x59ce('0xe'));_0x105d26(_0x23e243[_0x59ce('0x13')][_0x59ce('0x11')]);}})[_0x59ce('0x14')](function(_0x1f121c){logger[_0x59ce('0xf')]('WhatsappQueueReport,\x20%s,\x20%s',_0x5524b8,_0x1f121c);_0xbdb5c6(_0x1f121c);});});}exports[_0x59ce('0x15')]=function(_0x40cecd){var _0x5e4627=this;return new Promise(function(_0x31f05c,_0x4eef8d){return db[_0x59ce('0x16')][_0x59ce('0x17')](_0x40cecd[_0x59ce('0x18')],{'raw':_0x40cecd[_0x59ce('0x19')]?_0x40cecd[_0x59ce('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x59ce('0xa')](function(_0x51d40a){logger[_0x59ce('0x12')]('CreateWhatsappQueueReport',_0x40cecd);logger['debug'](_0x59ce('0x15'),_0x40cecd,JSON[_0x59ce('0x1a')](_0x51d40a));_0x31f05c(_0x51d40a);})[_0x59ce('0x14')](function(_0x31e16e){logger['error'](_0x59ce('0x15'),_0x31e16e[_0x59ce('0x11')],_0x40cecd);_0x4eef8d(_0x5e4627[_0x59ce('0xf')](0x1f4,_0x31e16e[_0x59ce('0x11')]));});});};exports[_0x59ce('0x1b')]=function(_0x5528b4){var _0x27b20b=this;return new Promise(function(_0x5a7a06,_0x5c473f){return db['WhatsappQueueReport'][_0x59ce('0x1c')](_0x5528b4[_0x59ce('0x18')],{'raw':_0x5528b4[_0x59ce('0x19')]?_0x5528b4[_0x59ce('0x19')][_0x59ce('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5528b4['options']?_0x5528b4[_0x59ce('0x19')][_0x59ce('0x1e')]||null:null,'attributes':_0x5528b4[_0x59ce('0x19')]?_0x5528b4[_0x59ce('0x19')][_0x59ce('0x1f')]||null:null,'limit':_0x5528b4[_0x59ce('0x19')]?_0x5528b4['options'][_0x59ce('0x20')]||null:null})[_0x59ce('0xa')](function(_0x403c4b){logger[_0x59ce('0x12')](_0x59ce('0x1b'),_0x5528b4);logger[_0x59ce('0xc')](_0x59ce('0x1b'),_0x5528b4,JSON[_0x59ce('0x1a')](_0x403c4b));_0x5a7a06(_0x403c4b);})[_0x59ce('0x14')](function(_0x3b39b7){logger[_0x59ce('0xf')](_0x59ce('0x1b'),_0x3b39b7['message'],_0x5528b4);_0x5c473f(_0x27b20b[_0x59ce('0xf')](0x1f4,_0x3b39b7[_0x59ce('0x11')]));});});}; \ No newline at end of file +var _0x1564=['then','catch','UpdateWhatsappQueueReport','update','raw','where','attributes','limit','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','http','info','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','result','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1564,0x13e));var _0x4156=function(_0x5180c3,_0x4b35f7){_0x5180c3=_0x5180c3-0x0;var _0x55c975=_0x1564[_0x5180c3];return _0x55c975;};'use strict';var _=require('lodash');var util=require(_0x4156('0x0'));var moment=require(_0x4156('0x1'));var BPromise=require(_0x4156('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4156('0x3'));var db=require(_0x4156('0x4'))['db'];var utils=require(_0x4156('0x5'));var logger=require('../../config/logger')(_0x4156('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4156('0x7')][_0x4156('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x7f0d5,_0x289220,_0x58b6c8){return new BPromise(function(_0x493f7d,_0x185e99){return client['request'](_0x7f0d5,_0x58b6c8)['then'](function(_0x3228cc){logger[_0x4156('0x9')]('WhatsappQueueReport,\x20%s,\x20%s',_0x289220,_0x4156('0xa'));logger['debug'](_0x4156('0xb'),_0x289220,'request\x20sent',JSON[_0x4156('0xc')](_0x3228cc));if(_0x3228cc[_0x4156('0xd')]){if(_0x3228cc[_0x4156('0xd')][_0x4156('0xe')]===0x1f4){logger[_0x4156('0xd')](_0x4156('0xf'),_0x289220,_0x3228cc[_0x4156('0xd')]['message']);return _0x185e99(_0x3228cc[_0x4156('0xd')][_0x4156('0x10')]);}logger[_0x4156('0xd')](_0x4156('0xf'),_0x289220,_0x3228cc[_0x4156('0xd')][_0x4156('0x10')]);return _0x493f7d(_0x3228cc[_0x4156('0xd')][_0x4156('0x10')]);}else{logger[_0x4156('0x9')](_0x4156('0xf'),_0x289220,_0x4156('0xa'));_0x493f7d(_0x3228cc[_0x4156('0x11')]['message']);}})['catch'](function(_0x10d27c){logger[_0x4156('0xd')](_0x4156('0xf'),_0x289220,_0x10d27c);_0x185e99(_0x10d27c);});});}exports[_0x4156('0x12')]=function(_0x28acda){var _0x37bec6=this;return new Promise(function(_0x57e0c1,_0x252c46){return db[_0x4156('0x13')][_0x4156('0x14')](_0x28acda[_0x4156('0x15')],{'raw':_0x28acda[_0x4156('0x16')]?_0x28acda[_0x4156('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x4156('0x17')](function(_0x541e92){logger['info'](_0x4156('0x12'),_0x28acda);logger['debug']('CreateWhatsappQueueReport',_0x28acda,JSON[_0x4156('0xc')](_0x541e92));_0x57e0c1(_0x541e92);})[_0x4156('0x18')](function(_0x3cafb2){logger[_0x4156('0xd')](_0x4156('0x12'),_0x3cafb2[_0x4156('0x10')],_0x28acda);_0x252c46(_0x37bec6[_0x4156('0xd')](0x1f4,_0x3cafb2[_0x4156('0x10')]));});});};exports[_0x4156('0x19')]=function(_0x320fa7){var _0x4f8368=this;return new Promise(function(_0x5e070d,_0x45c660){return db['WhatsappQueueReport'][_0x4156('0x1a')](_0x320fa7['body'],{'raw':_0x320fa7['options']?_0x320fa7[_0x4156('0x16')][_0x4156('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x320fa7['options']?_0x320fa7[_0x4156('0x16')][_0x4156('0x1c')]||null:null,'attributes':_0x320fa7[_0x4156('0x16')]?_0x320fa7[_0x4156('0x16')][_0x4156('0x1d')]||null:null,'limit':_0x320fa7[_0x4156('0x16')]?_0x320fa7[_0x4156('0x16')][_0x4156('0x1e')]||null:null})[_0x4156('0x17')](function(_0x524bd5){logger[_0x4156('0x9')]('UpdateWhatsappQueueReport',_0x320fa7);logger['debug']('UpdateWhatsappQueueReport',_0x320fa7,JSON[_0x4156('0xc')](_0x524bd5));_0x5e070d(_0x524bd5);})[_0x4156('0x18')](function(_0x1ed955){logger[_0x4156('0xd')](_0x4156('0x19'),_0x1ed955[_0x4156('0x10')],_0x320fa7);_0x45c660(_0x4f8368[_0x4156('0xd')](0x1f4,_0x1ed955[_0x4156('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 9a908f7..8bd27aa 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 _0xbb7f=['delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update'];(function(_0x5bdfa5,_0x7506df){var _0x483c74=function(_0x55fbd0){while(--_0x55fbd0){_0x5bdfa5['push'](_0x5bdfa5['shift']());}};_0x483c74(++_0x7506df);}(_0xbb7f,0x1a1));var _0xfbb7=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xbb7f[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require('multer');var util=require(_0xfbb7('0x0'));var path=require(_0xfbb7('0x1'));var timeout=require(_0xfbb7('0x2'));var express=require(_0xfbb7('0x3'));var router=express[_0xfbb7('0x4')]();var fs_extra=require(_0xfbb7('0x5'));var auth=require(_0xfbb7('0x6'));var interaction=require(_0xfbb7('0x7'));var config=require(_0xfbb7('0x8'));var controller=require('./whatsappTransferReport.controller');router['get']('/',auth[_0xfbb7('0x9')](),controller[_0xfbb7('0xa')]);router[_0xfbb7('0xb')](_0xfbb7('0xc'),auth[_0xfbb7('0x9')](),controller[_0xfbb7('0xd')]);router['get'](_0xfbb7('0xe'),auth[_0xfbb7('0x9')](),controller[_0xfbb7('0xf')]);router[_0xfbb7('0x10')]('/',auth[_0xfbb7('0x9')](),controller[_0xfbb7('0x11')]);router[_0xfbb7('0x12')]('/:id',auth[_0xfbb7('0x9')](),controller[_0xfbb7('0x13')]);router[_0xfbb7('0x14')](_0xfbb7('0xe'),auth[_0xfbb7('0x9')](),controller[_0xfbb7('0x15')]);module[_0xfbb7('0x16')]=router; \ No newline at end of file +var _0x61e0=['show','post','create','put','update','delete','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0x1c2f37,_0x2f722f){var _0x2376ac=function(_0x1bb5ab){while(--_0x1bb5ab){_0x1c2f37['push'](_0x1c2f37['shift']());}};_0x2376ac(++_0x2f722f);}(_0x61e0,0x151));var _0x061e=function(_0x3a465c,_0x9c7349){_0x3a465c=_0x3a465c-0x0;var _0x4b8ce7=_0x61e0[_0x3a465c];return _0x4b8ce7;};'use strict';var multer=require('multer');var util=require(_0x061e('0x0'));var path=require(_0x061e('0x1'));var timeout=require('connect-timeout');var express=require(_0x061e('0x2'));var router=express[_0x061e('0x3')]();var fs_extra=require(_0x061e('0x4'));var auth=require(_0x061e('0x5'));var interaction=require(_0x061e('0x6'));var config=require(_0x061e('0x7'));var controller=require(_0x061e('0x8'));router['get']('/',auth[_0x061e('0x9')](),controller[_0x061e('0xa')]);router[_0x061e('0xb')](_0x061e('0xc'),auth[_0x061e('0x9')](),controller[_0x061e('0xd')]);router[_0x061e('0xb')](_0x061e('0xe'),auth[_0x061e('0x9')](),controller[_0x061e('0xf')]);router[_0x061e('0x10')]('/',auth[_0x061e('0x9')](),controller[_0x061e('0x11')]);router[_0x061e('0x12')]('/:id',auth[_0x061e('0x9')](),controller[_0x061e('0x13')]);router[_0x061e('0x14')](_0x061e('0xe'),auth[_0x061e('0x9')](),controller['destroy']);module[_0x061e('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 d4019ff..f982920 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 _0xd48a=['agent','queue','DATE','sequelize','STRING','ENUM','account'];(function(_0x5d8afd,_0xd7f769){var _0x336c61=function(_0x539e58){while(--_0x539e58){_0x5d8afd['push'](_0x5d8afd['shift']());}};_0x336c61(++_0xd7f769);}(_0xd48a,0x96));var _0xad48=function(_0xf008f4,_0x51891d){_0xf008f4=_0xf008f4-0x0;var _0x4767b0=_0xd48a[_0xf008f4];return _0x4767b0;};'use strict';var Sequelize=require(_0xad48('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xad48('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xad48('0x2')](_0xad48('0x3'),_0xad48('0x4'),_0xad48('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xad48('0x6')]}}; \ No newline at end of file +var _0x9c02=['STRING','DATE','sequelize','exports'];(function(_0x40a9cb,_0x2f880f){var _0x38eb0e=function(_0x544964){while(--_0x544964){_0x40a9cb['push'](_0x40a9cb['shift']());}};_0x38eb0e(++_0x2f880f);}(_0x9c02,0x196));var _0x29c0=function(_0x2ec7b0,_0x2cc1d6){_0x2ec7b0=_0x2ec7b0-0x0;var _0x54e81c=_0x9c02[_0x2ec7b0];return _0x54e81c;};'use strict';var Sequelize=require(_0x29c0('0x0'));module[_0x29c0('0x1')]={'uniqueid':{'type':Sequelize[_0x29c0('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account','agent','queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x29c0('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index ebfc099..07eeeaf 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 _0x917d=['fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','nolimit','order','sort','filters','pick','filter','where','merge','options','WhatsappTransferReport','includeAll','include','findAll','rows','show','params','catch','create','update','find','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs'];(function(_0x336280,_0x10a45c){var _0x2a1b5b=function(_0x3c99ea){while(--_0x3c99ea){_0x336280['push'](_0x336280['shift']());}};_0x2a1b5b(++_0x10a45c);}(_0x917d,0x17c));var _0xd917=function(_0x124a03,_0x25633e){_0x124a03=_0x124a03-0x0;var _0x4f3cbb=_0x917d[_0x124a03];return _0x4f3cbb;};'use strict';var emlformat=require(_0xd917('0x0'));var rimraf=require(_0xd917('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd917('0x2'));var rp=require(_0xd917('0x3'));var moment=require(_0xd917('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd917('0x5'));var util=require(_0xd917('0x6'));var path=require('path');var sox=require(_0xd917('0x7'));var csv=require(_0xd917('0x8'));var ejs=require(_0xd917('0x9'));var fs=require('fs');var fs_extra=require(_0xd917('0xa'));var _=require(_0xd917('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd917('0xc'));var deskjs=require(_0xd917('0xd'));var toCsv=require(_0xd917('0x8'));var querystring=require(_0xd917('0xe'));var Papa=require(_0xd917('0xf'));var Redis=require(_0xd917('0x10'));var authService=require(_0xd917('0x11'));var qs=require(_0xd917('0x12'));var as=require(_0xd917('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd917('0x14'))(_0xd917('0x15'));var utils=require('../../config/utils');var config=require(_0xd917('0x16'));var licenseUtil=require(_0xd917('0x17'));var db=require(_0xd917('0x18'))['db'];function respondWithStatusCode(_0x3bd54b,_0x5ce552){_0x5ce552=_0x5ce552||0xcc;return function(_0x342ddb){if(_0x342ddb){return _0x3bd54b['sendStatus'](_0x5ce552);}return _0x3bd54b[_0xd917('0x19')](_0x5ce552)[_0xd917('0x1a')]();};}function respondWithResult(_0x6cdfa7,_0x5b8eda){_0x5b8eda=_0x5b8eda||0xc8;return function(_0x17b81e){if(_0x17b81e){return _0x6cdfa7[_0xd917('0x19')](_0x5b8eda)[_0xd917('0x1b')](_0x17b81e);}};}function respondWithFilteredResult(_0x193ec0,_0x4d4f8b){return function(_0x5d05b7){if(_0x5d05b7){var _0x5e9c8d=typeof _0x4d4f8b[_0xd917('0x1c')]==='undefined'&&typeof _0x4d4f8b[_0xd917('0x1d')]===_0xd917('0x1e');var _0x4ce3a7=_0x5d05b7[_0xd917('0x1f')];var _0x1cfb52=_0x5e9c8d?0x0:_0x4d4f8b[_0xd917('0x1c')];var _0x18e7cf=_0x5e9c8d?_0x5d05b7[_0xd917('0x1f')]:_0x4d4f8b[_0xd917('0x1c')]+_0x4d4f8b['limit'];var _0xe50f2e;if(_0x18e7cf>=_0x4ce3a7){_0x18e7cf=_0x4ce3a7;_0xe50f2e=0xc8;}else{_0xe50f2e=0xce;}_0x193ec0[_0xd917('0x19')](_0xe50f2e);return _0x193ec0[_0xd917('0x20')](_0xd917('0x21'),_0x1cfb52+'-'+_0x18e7cf+'/'+_0x4ce3a7)['json'](_0x5d05b7);}return null;};}function patchUpdates(_0x2eab97){return function(_0x53c693){try{jsonpatch[_0xd917('0x22')](_0x53c693,_0x2eab97,!![]);}catch(_0x3c10d3){return BPromise[_0xd917('0x23')](_0x3c10d3);}return _0x53c693[_0xd917('0x24')]();};}function saveUpdates(_0x44d518,_0x352a7c){return function(_0x363d7c){if(_0x363d7c){return _0x363d7c['update'](_0x44d518)['then'](function(_0x5748c2){return _0x5748c2;});}return null;};}function removeEntity(_0x16a45a,_0x4628b5){return function(_0x585971){if(_0x585971){return _0x585971['destroy']()[_0xd917('0x25')](function(){_0x16a45a['status'](0xcc)[_0xd917('0x1a')]();});}};}function handleEntityNotFound(_0x505d5e,_0x14b025){return function(_0x1f146a){if(!_0x1f146a){_0x505d5e[_0xd917('0x26')](0x194);}return _0x1f146a;};}function handleError(_0x3d3709,_0x866ed4){_0x866ed4=_0x866ed4||0x1f4;return function(_0x37fe27){logger[_0xd917('0x27')](_0x37fe27[_0xd917('0x28')]);if(_0x37fe27[_0xd917('0x29')]){delete _0x37fe27[_0xd917('0x29')];}_0x3d3709[_0xd917('0x19')](_0x866ed4)[_0xd917('0x2a')](_0x37fe27);};}exports[_0xd917('0x2b')]=function(_0x2f4939,_0x151655){var _0x2632cf={},_0x554322={},_0x46bb6d={'count':0x0,'rows':[]};var _0x28d802=_[_0xd917('0x2c')](db['WhatsappTransferReport'][_0xd917('0x2d')],function(_0x1dee51){return{'name':_0x1dee51[_0xd917('0x2e')],'type':_0x1dee51[_0xd917('0x2f')][_0xd917('0x30')]};});_0x554322[_0xd917('0x31')]=_[_0xd917('0x2c')](_0x28d802,_0xd917('0x29'));_0x554322['query']=_[_0xd917('0x32')](_0x2f4939[_0xd917('0x33')]);_0x554322['filters']=_[_0xd917('0x34')](_0x554322[_0xd917('0x31')],_0x554322[_0xd917('0x33')]);_0x2632cf['attributes']=_[_0xd917('0x34')](_0x554322[_0xd917('0x31')],qs[_0xd917('0x35')](_0x2f4939[_0xd917('0x33')][_0xd917('0x35')]));_0x2632cf[_0xd917('0x36')]=_0x2632cf[_0xd917('0x36')][_0xd917('0x37')]?_0x2632cf[_0xd917('0x36')]:_0x554322[_0xd917('0x31')];if(!_0x2f4939[_0xd917('0x33')]['hasOwnProperty'](_0xd917('0x38'))){_0x2632cf[_0xd917('0x1d')]=qs['limit'](_0x2f4939[_0xd917('0x33')][_0xd917('0x1d')]);_0x2632cf[_0xd917('0x1c')]=qs['offset'](_0x2f4939[_0xd917('0x33')][_0xd917('0x1c')]);}_0x2632cf[_0xd917('0x39')]=qs[_0xd917('0x3a')](_0x2f4939[_0xd917('0x33')][_0xd917('0x3a')]);_0x2632cf['where']=qs[_0xd917('0x3b')](_[_0xd917('0x3c')](_0x2f4939[_0xd917('0x33')],_0x554322[_0xd917('0x3b')]),_0x28d802);if(_0x2f4939['query'][_0xd917('0x3d')]){_0x2632cf[_0xd917('0x3e')]=_['merge'](_0x2632cf[_0xd917('0x3e')],{'$or':_[_0xd917('0x2c')](_0x28d802,function(_0x1cc5e5){if(_0x1cc5e5[_0xd917('0x2f')]!=='VIRTUAL'){var _0x129f0b={};_0x129f0b[_0x1cc5e5['name']]={'$like':'%'+_0x2f4939[_0xd917('0x33')][_0xd917('0x3d')]+'%'};return _0x129f0b;}})});}_0x2632cf=_[_0xd917('0x3f')]({},_0x2632cf,_0x2f4939[_0xd917('0x40')]);var _0x4ca586={'where':_0x2632cf[_0xd917('0x3e')]};return db[_0xd917('0x41')][_0xd917('0x1f')](_0x4ca586)[_0xd917('0x25')](function(_0x45e0d8){_0x46bb6d[_0xd917('0x1f')]=_0x45e0d8;if(_0x2f4939[_0xd917('0x33')][_0xd917('0x42')]){_0x2632cf[_0xd917('0x43')]=[{'all':!![]}];}return db[_0xd917('0x41')][_0xd917('0x44')](_0x2632cf);})[_0xd917('0x25')](function(_0x15c211){_0x46bb6d[_0xd917('0x45')]=_0x15c211;return _0x46bb6d;})[_0xd917('0x25')](respondWithFilteredResult(_0x151655,_0x2632cf))['catch'](handleError(_0x151655,null));};exports[_0xd917('0x46')]=function(_0x463b45,_0x3d980b){var _0x59495b={'raw':!![],'where':{'id':_0x463b45[_0xd917('0x47')]['id']}},_0xb7c939={};_0xb7c939[_0xd917('0x31')]=_[_0xd917('0x32')](db[_0xd917('0x41')][_0xd917('0x2d')]);_0xb7c939[_0xd917('0x33')]=_[_0xd917('0x32')](_0x463b45[_0xd917('0x33')]);_0xb7c939[_0xd917('0x3b')]=_[_0xd917('0x34')](_0xb7c939[_0xd917('0x31')],_0xb7c939[_0xd917('0x33')]);_0x59495b[_0xd917('0x36')]=_[_0xd917('0x34')](_0xb7c939[_0xd917('0x31')],qs['fields'](_0x463b45[_0xd917('0x33')][_0xd917('0x35')]));_0x59495b[_0xd917('0x36')]=_0x59495b[_0xd917('0x36')][_0xd917('0x37')]?_0x59495b[_0xd917('0x36')]:_0xb7c939[_0xd917('0x31')];if(_0x463b45[_0xd917('0x33')]['includeAll']){_0x59495b[_0xd917('0x43')]=[{'all':!![]}];}_0x59495b=_[_0xd917('0x3f')]({},_0x59495b,_0x463b45[_0xd917('0x40')]);return db['WhatsappTransferReport']['find'](_0x59495b)[_0xd917('0x25')](handleEntityNotFound(_0x3d980b,null))['then'](respondWithResult(_0x3d980b,null))[_0xd917('0x48')](handleError(_0x3d980b,null));};exports[_0xd917('0x49')]=function(_0x4495db,_0x2c1d21){return db[_0xd917('0x41')]['create'](_0x4495db['body'],{})['then'](respondWithResult(_0x2c1d21,0xc9))[_0xd917('0x48')](handleError(_0x2c1d21,null));};exports[_0xd917('0x4a')]=function(_0x520afe,_0x17d3dc){if(_0x520afe['body']['id']){delete _0x520afe['body']['id'];}return db[_0xd917('0x41')][_0xd917('0x4b')]({'where':{'id':_0x520afe['params']['id']}})[_0xd917('0x25')](handleEntityNotFound(_0x17d3dc,null))[_0xd917('0x25')](saveUpdates(_0x520afe[_0xd917('0x4c')],null))[_0xd917('0x25')](respondWithResult(_0x17d3dc,null))[_0xd917('0x48')](handleError(_0x17d3dc,null));};exports['destroy']=function(_0x268a4e,_0x5290fa){return db[_0xd917('0x41')][_0xd917('0x4b')]({'where':{'id':_0x268a4e['params']['id']}})[_0xd917('0x25')](handleEntityNotFound(_0x5290fa,null))[_0xd917('0x25')](removeEntity(_0x5290fa,null))[_0xd917('0x48')](handleError(_0x5290fa,null));};exports[_0xd917('0x4d')]=function(_0x5ca86c,_0x3a4abf){return db[_0xd917('0x41')][_0xd917('0x4d')]()[_0xd917('0x25')](respondWithResult(_0x3a4abf,null))['catch'](handleError(_0x3a4abf,null));}; \ No newline at end of file +var _0x011a=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','map','WhatsappTransferReport','fieldName','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','findAll','show','keys','rawAttributes','includeAll','include','create','body','catch','find','params','describe'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x011a,0x1c8));var _0xa011=function(_0x45b900,_0x2d7019){_0x45b900=_0x45b900-0x0;var _0x40233d=_0x011a[_0x45b900];return _0x40233d;};'use strict';var emlformat=require(_0xa011('0x0'));var rimraf=require(_0xa011('0x1'));var zipdir=require(_0xa011('0x2'));var jsonpatch=require(_0xa011('0x3'));var rp=require('request-promise');var moment=require(_0xa011('0x4'));var BPromise=require(_0xa011('0x5'));var Mustache=require(_0xa011('0x6'));var util=require(_0xa011('0x7'));var path=require(_0xa011('0x8'));var sox=require(_0xa011('0x9'));var csv=require(_0xa011('0xa'));var ejs=require(_0xa011('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa011('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa011('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa011('0xe'));var Papa=require(_0xa011('0xf'));var Redis=require('ioredis');var authService=require(_0xa011('0x10'));var qs=require(_0xa011('0x11'));var as=require(_0xa011('0x12'));var hardwareService=require(_0xa011('0x13'));var logger=require(_0xa011('0x14'))(_0xa011('0x15'));var utils=require('../../config/utils');var config=require(_0xa011('0x16'));var licenseUtil=require(_0xa011('0x17'));var db=require(_0xa011('0x18'))['db'];function respondWithStatusCode(_0x1993f0,_0x8dd0f3){_0x8dd0f3=_0x8dd0f3||0xcc;return function(_0x2f5164){if(_0x2f5164){return _0x1993f0[_0xa011('0x19')](_0x8dd0f3);}return _0x1993f0[_0xa011('0x1a')](_0x8dd0f3)[_0xa011('0x1b')]();};}function respondWithResult(_0x246eca,_0x510c70){_0x510c70=_0x510c70||0xc8;return function(_0x2b5a76){if(_0x2b5a76){return _0x246eca[_0xa011('0x1a')](_0x510c70)[_0xa011('0x1c')](_0x2b5a76);}};}function respondWithFilteredResult(_0x2c09b8,_0x14823e){return function(_0x37fc22){if(_0x37fc22){var _0x5abecd=typeof _0x14823e[_0xa011('0x1d')]==='undefined'&&typeof _0x14823e[_0xa011('0x1e')]===_0xa011('0x1f');var _0x1f5cb2=_0x37fc22[_0xa011('0x20')];var _0x1b24e8=_0x5abecd?0x0:_0x14823e[_0xa011('0x1d')];var _0x36c361=_0x5abecd?_0x37fc22[_0xa011('0x20')]:_0x14823e['offset']+_0x14823e['limit'];var _0x5b0ce5;if(_0x36c361>=_0x1f5cb2){_0x36c361=_0x1f5cb2;_0x5b0ce5=0xc8;}else{_0x5b0ce5=0xce;}_0x2c09b8[_0xa011('0x1a')](_0x5b0ce5);return _0x2c09b8[_0xa011('0x21')](_0xa011('0x22'),_0x1b24e8+'-'+_0x36c361+'/'+_0x1f5cb2)[_0xa011('0x1c')](_0x37fc22);}return null;};}function patchUpdates(_0x443652){return function(_0x5afb38){try{jsonpatch[_0xa011('0x23')](_0x5afb38,_0x443652,!![]);}catch(_0x2901fb){return BPromise['reject'](_0x2901fb);}return _0x5afb38[_0xa011('0x24')]();};}function saveUpdates(_0x33cc33,_0x173a07){return function(_0x1d706e){if(_0x1d706e){return _0x1d706e[_0xa011('0x25')](_0x33cc33)['then'](function(_0x19c1b4){return _0x19c1b4;});}return null;};}function removeEntity(_0x5f107b,_0xa0265c){return function(_0x3661b6){if(_0x3661b6){return _0x3661b6[_0xa011('0x26')]()[_0xa011('0x27')](function(){_0x5f107b[_0xa011('0x1a')](0xcc)[_0xa011('0x1b')]();});}};}function handleEntityNotFound(_0x526cbd,_0x3ec26d){return function(_0x22d731){if(!_0x22d731){_0x526cbd['sendStatus'](0x194);}return _0x22d731;};}function handleError(_0x22f5e6,_0x193810){_0x193810=_0x193810||0x1f4;return function(_0xf9ae60){logger[_0xa011('0x28')](_0xf9ae60[_0xa011('0x29')]);if(_0xf9ae60[_0xa011('0x2a')]){delete _0xf9ae60[_0xa011('0x2a')];}_0x22f5e6['status'](_0x193810)[_0xa011('0x2b')](_0xf9ae60);};}exports[_0xa011('0x2c')]=function(_0x3cbdb4,_0x5a1891){var _0x5a0ae7={},_0x437198={},_0x2288a7={'count':0x0,'rows':[]};var _0xbf262f=_[_0xa011('0x2d')](db[_0xa011('0x2e')]['rawAttributes'],function(_0x13ec7b){return{'name':_0x13ec7b[_0xa011('0x2f')],'type':_0x13ec7b['type']['key']};});_0x437198[_0xa011('0x30')]=_[_0xa011('0x2d')](_0xbf262f,_0xa011('0x2a'));_0x437198[_0xa011('0x31')]=_['keys'](_0x3cbdb4[_0xa011('0x31')]);_0x437198[_0xa011('0x32')]=_[_0xa011('0x33')](_0x437198[_0xa011('0x30')],_0x437198[_0xa011('0x31')]);_0x5a0ae7['attributes']=_[_0xa011('0x33')](_0x437198[_0xa011('0x30')],qs[_0xa011('0x34')](_0x3cbdb4[_0xa011('0x31')][_0xa011('0x34')]));_0x5a0ae7[_0xa011('0x35')]=_0x5a0ae7[_0xa011('0x35')][_0xa011('0x36')]?_0x5a0ae7[_0xa011('0x35')]:_0x437198[_0xa011('0x30')];if(!_0x3cbdb4[_0xa011('0x31')][_0xa011('0x37')]('nolimit')){_0x5a0ae7[_0xa011('0x1e')]=qs[_0xa011('0x1e')](_0x3cbdb4['query'][_0xa011('0x1e')]);_0x5a0ae7[_0xa011('0x1d')]=qs[_0xa011('0x1d')](_0x3cbdb4[_0xa011('0x31')]['offset']);}_0x5a0ae7['order']=qs[_0xa011('0x38')](_0x3cbdb4[_0xa011('0x31')][_0xa011('0x38')]);_0x5a0ae7[_0xa011('0x39')]=qs[_0xa011('0x32')](_[_0xa011('0x3a')](_0x3cbdb4[_0xa011('0x31')],_0x437198[_0xa011('0x32')]),_0xbf262f);if(_0x3cbdb4['query'][_0xa011('0x3b')]){_0x5a0ae7[_0xa011('0x39')]=_[_0xa011('0x3c')](_0x5a0ae7['where'],{'$or':_[_0xa011('0x2d')](_0xbf262f,function(_0x3cd833){if(_0x3cd833[_0xa011('0x3d')]!==_0xa011('0x3e')){var _0xf87da2={};_0xf87da2[_0x3cd833[_0xa011('0x2a')]]={'$like':'%'+_0x3cbdb4[_0xa011('0x31')][_0xa011('0x3b')]+'%'};return _0xf87da2;}})});}_0x5a0ae7=_[_0xa011('0x3c')]({},_0x5a0ae7,_0x3cbdb4[_0xa011('0x3f')]);var _0x180e2b={'where':_0x5a0ae7['where']};return db[_0xa011('0x2e')][_0xa011('0x20')](_0x180e2b)['then'](function(_0x1e087e){_0x2288a7['count']=_0x1e087e;if(_0x3cbdb4[_0xa011('0x31')]['includeAll']){_0x5a0ae7['include']=[{'all':!![]}];}return db['WhatsappTransferReport'][_0xa011('0x40')](_0x5a0ae7);})['then'](function(_0x1b9241){_0x2288a7['rows']=_0x1b9241;return _0x2288a7;})[_0xa011('0x27')](respondWithFilteredResult(_0x5a1891,_0x5a0ae7))['catch'](handleError(_0x5a1891,null));};exports[_0xa011('0x41')]=function(_0x51b2a1,_0x36ae0b){var _0x1f8c5b={'raw':!![],'where':{'id':_0x51b2a1['params']['id']}},_0xefcbab={};_0xefcbab[_0xa011('0x30')]=_[_0xa011('0x42')](db[_0xa011('0x2e')][_0xa011('0x43')]);_0xefcbab[_0xa011('0x31')]=_['keys'](_0x51b2a1[_0xa011('0x31')]);_0xefcbab[_0xa011('0x32')]=_[_0xa011('0x33')](_0xefcbab[_0xa011('0x30')],_0xefcbab[_0xa011('0x31')]);_0x1f8c5b['attributes']=_[_0xa011('0x33')](_0xefcbab['model'],qs['fields'](_0x51b2a1[_0xa011('0x31')][_0xa011('0x34')]));_0x1f8c5b[_0xa011('0x35')]=_0x1f8c5b[_0xa011('0x35')]['length']?_0x1f8c5b[_0xa011('0x35')]:_0xefcbab[_0xa011('0x30')];if(_0x51b2a1[_0xa011('0x31')][_0xa011('0x44')]){_0x1f8c5b[_0xa011('0x45')]=[{'all':!![]}];}_0x1f8c5b=_[_0xa011('0x3c')]({},_0x1f8c5b,_0x51b2a1['options']);return db[_0xa011('0x2e')]['find'](_0x1f8c5b)[_0xa011('0x27')](handleEntityNotFound(_0x36ae0b,null))[_0xa011('0x27')](respondWithResult(_0x36ae0b,null))['catch'](handleError(_0x36ae0b,null));};exports['create']=function(_0x2f839b,_0x46af8b){return db[_0xa011('0x2e')][_0xa011('0x46')](_0x2f839b[_0xa011('0x47')],{})[_0xa011('0x27')](respondWithResult(_0x46af8b,0xc9))[_0xa011('0x48')](handleError(_0x46af8b,null));};exports[_0xa011('0x25')]=function(_0x2331fc,_0x2b759b){if(_0x2331fc[_0xa011('0x47')]['id']){delete _0x2331fc[_0xa011('0x47')]['id'];}return db['WhatsappTransferReport'][_0xa011('0x49')]({'where':{'id':_0x2331fc[_0xa011('0x4a')]['id']}})[_0xa011('0x27')](handleEntityNotFound(_0x2b759b,null))[_0xa011('0x27')](saveUpdates(_0x2331fc['body'],null))['then'](respondWithResult(_0x2b759b,null))[_0xa011('0x48')](handleError(_0x2b759b,null));};exports[_0xa011('0x26')]=function(_0x322f6a,_0x171377){return db[_0xa011('0x2e')][_0xa011('0x49')]({'where':{'id':_0x322f6a[_0xa011('0x4a')]['id']}})[_0xa011('0x27')](handleEntityNotFound(_0x171377,null))['then'](removeEntity(_0x171377,null))[_0xa011('0x48')](handleError(_0x171377,null));};exports[_0xa011('0x4b')]=function(_0x352c70,_0x2cd083){return db['WhatsappTransferReport']['describe']()['then'](respondWithResult(_0x2cd083,null))[_0xa011('0x48')](handleError(_0x2cd083,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 3e8bc7c..57c87a5 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 _0x1e6d=['uniqueid','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','report_whatsapp_transfer'];(function(_0x24f4eb,_0x2536cd){var _0x420875=function(_0x14464b){while(--_0x14464b){_0x24f4eb['push'](_0x24f4eb['shift']());}};_0x420875(++_0x2536cd);}(_0x1e6d,0x1b1));var _0xd1e6=function(_0xd050c6,_0x58ffb4){_0xd050c6=_0xd050c6-0x0;var _0x7278a=_0x1e6d[_0xd050c6];return _0x7278a;};'use strict';var _=require('lodash');var util=require(_0xd1e6('0x0'));var logger=require(_0xd1e6('0x1'))('api');var moment=require(_0xd1e6('0x2'));var BPromise=require(_0xd1e6('0x3'));var rp=require(_0xd1e6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd1e6('0x5'));var config=require(_0xd1e6('0x6'));var attributes=require(_0xd1e6('0x7'));module[_0xd1e6('0x8')]=function(_0x6e607d,_0x2902cb){return _0x6e607d[_0xd1e6('0x9')]('WhatsappTransferReport',attributes,{'tableName':_0xd1e6('0xa'),'paranoid':![],'indexes':[{'name':_0xd1e6('0xb'),'fields':[_0xd1e6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfbce=['report_whatsapp_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./whatsappTransferReport.attributes','exports','WhatsappTransferReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfbce,0xc2));var _0xefbc=function(_0x3dcbc8,_0x4f9f95){_0x3dcbc8=_0x3dcbc8-0x0;var _0x312aed=_0xfbce[_0x3dcbc8];return _0x312aed;};'use strict';var _=require('lodash');var util=require(_0xefbc('0x0'));var logger=require(_0xefbc('0x1'))(_0xefbc('0x2'));var moment=require(_0xefbc('0x3'));var BPromise=require(_0xefbc('0x4'));var rp=require(_0xefbc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xefbc('0x6'));var config=require('../../config/environment');var attributes=require(_0xefbc('0x7'));module[_0xefbc('0x8')]=function(_0x467181,_0x4b0b0a){return _0x467181['define'](_0xefbc('0x9'),attributes,{'tableName':_0xefbc('0xa'),'paranoid':![],'indexes':[{'name':_0xefbc('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 4058d9a..a2483d7 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 _0x49ee=['http','request','then','WhatsappTransferReport,\x20%s,\x20%s','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x4f1abc,_0xe26531){var _0x7f0012=function(_0x2955de){while(--_0x2955de){_0x4f1abc['push'](_0x4f1abc['shift']());}};_0x7f0012(++_0xe26531);}(_0x49ee,0x199));var _0xe49e=function(_0x3d87f7,_0x3caae7){_0x3d87f7=_0x3d87f7-0x0;var _0x5440f9=_0x49ee[_0x3d87f7];return _0x5440f9;};'use strict';var _=require(_0xe49e('0x0'));var util=require('util');var moment=require(_0xe49e('0x1'));var BPromise=require(_0xe49e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe49e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe49e('0x4'));var logger=require(_0xe49e('0x5'))(_0xe49e('0x6'));var config=require(_0xe49e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe49e('0x8')][_0xe49e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37e881,_0x171e23,_0x2dd666){return new BPromise(function(_0x28ca24,_0x41757d){return client[_0xe49e('0xa')](_0x37e881,_0x2dd666)[_0xe49e('0xb')](function(_0x2321d8){logger['info'](_0xe49e('0xc'),_0x171e23,'request\x20sent');logger[_0xe49e('0xd')](_0xe49e('0xe'),_0x171e23,_0xe49e('0xf'),JSON[_0xe49e('0x10')](_0x2321d8));if(_0x2321d8['error']){if(_0x2321d8[_0xe49e('0x11')][_0xe49e('0x12')]===0x1f4){logger[_0xe49e('0x11')](_0xe49e('0xc'),_0x171e23,_0x2321d8[_0xe49e('0x11')]['message']);return _0x41757d(_0x2321d8['error'][_0xe49e('0x13')]);}logger[_0xe49e('0x11')](_0xe49e('0xc'),_0x171e23,_0x2321d8[_0xe49e('0x11')][_0xe49e('0x13')]);return _0x28ca24(_0x2321d8[_0xe49e('0x11')]['message']);}else{logger[_0xe49e('0x14')](_0xe49e('0xc'),_0x171e23,_0xe49e('0xf'));_0x28ca24(_0x2321d8[_0xe49e('0x15')][_0xe49e('0x13')]);}})['catch'](function(_0x4bdf1a){logger[_0xe49e('0x11')](_0xe49e('0xc'),_0x171e23,_0x4bdf1a);_0x41757d(_0x4bdf1a);});});} \ No newline at end of file +var _0xd93f=['../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','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','randomstring','ioredis','../../mysqldb'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0xd93f,0xba));var _0xfd93=function(_0x4eb6d2,_0x278ce9){_0x4eb6d2=_0x4eb6d2-0x0;var _0x40e60c=_0xd93f[_0x4eb6d2];return _0x40e60c;};'use strict';var _=require(_0xfd93('0x0'));var util=require(_0xfd93('0x1'));var moment=require(_0xfd93('0x2'));var BPromise=require('bluebird');var rs=require(_0xfd93('0x3'));var fs=require('fs');var Redis=require(_0xfd93('0x4'));var db=require(_0xfd93('0x5'))['db'];var utils=require(_0xfd93('0x6'));var logger=require(_0xfd93('0x7'))(_0xfd93('0x8'));var config=require(_0xfd93('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xfd93('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29a997,_0x184c34,_0x30ac62){return new BPromise(function(_0x1928ba,_0x15b1c4){return client[_0xfd93('0xb')](_0x29a997,_0x30ac62)[_0xfd93('0xc')](function(_0x4a417f){logger[_0xfd93('0xd')](_0xfd93('0xe'),_0x184c34,_0xfd93('0xf'));logger[_0xfd93('0x10')](_0xfd93('0x11'),_0x184c34,_0xfd93('0xf'),JSON[_0xfd93('0x12')](_0x4a417f));if(_0x4a417f[_0xfd93('0x13')]){if(_0x4a417f['error'][_0xfd93('0x14')]===0x1f4){logger[_0xfd93('0x13')](_0xfd93('0xe'),_0x184c34,_0x4a417f[_0xfd93('0x13')][_0xfd93('0x15')]);return _0x15b1c4(_0x4a417f[_0xfd93('0x13')][_0xfd93('0x15')]);}logger[_0xfd93('0x13')](_0xfd93('0xe'),_0x184c34,_0x4a417f['error'][_0xfd93('0x15')]);return _0x1928ba(_0x4a417f[_0xfd93('0x13')][_0xfd93('0x15')]);}else{logger[_0xfd93('0xd')](_0xfd93('0xe'),_0x184c34,_0xfd93('0xf'));_0x1928ba(_0x4a417f[_0xfd93('0x16')][_0xfd93('0x15')]);}})[_0xfd93('0x17')](function(_0x43af4d){logger['error'](_0xfd93('0xe'),_0x184c34,_0x43af4d);_0x15b1c4(_0x43af4d);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 17c62f5..571f770 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3235=['map','filter','join','Offline\x20apps:','status','online','seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./rpc','./config/environment','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','then','listen','info','start','Online\x20apps:'];(function(_0x203cf5,_0x8421e0){var _0x17a51d=function(_0x466b7a){while(--_0x466b7a){_0x203cf5['push'](_0x203cf5['shift']());}};_0x17a51d(++_0x8421e0);}(_0x3235,0x16a));var _0x5323=function(_0x372484,_0x5ecdbc){_0x372484=_0x372484-0x0;var _0x1d98d6=_0x3235[_0x372484];return _0x1d98d6;};'use strict';var _=require(_0x5323('0x0'));var mysqldb=require('./mysqldb');var rpc=require(_0x5323('0x1'));var config=require(_0x5323('0x2'));var logger=require('./config/logger')('app');var pm2=require('./config/pm2');var pm2Config=require('./config/pm2/config');var schedule=require(_0x5323('0x3'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x5323('0x4'));var transcribe=require(_0x5323('0x5'));function main(){return mysqldb['db'][_0x5323('0x6')][_0x5323('0x7')]()[_0x5323('0x8')](function(){return rpc[_0x5323('0x9')]();})[_0x5323('0x8')](function(_0x491e3e){logger[_0x5323('0xa')](_0x491e3e);return chat[_0x5323('0xb')]();})['then'](function(){return whatsapp[_0x5323('0xb')]();})['then'](function(){return schedule[_0x5323('0xb')]();})[_0x5323('0x8')](function(){return transcribe[_0x5323('0xb')]();})[_0x5323('0x8')](function(_0x34b147){logger['info'](_0x34b147);return pm2['start'](pm2Config);})[_0x5323('0x8')](function(_0x398f8a){logger[_0x5323('0xa')](_0x5323('0xc'),_[_0x5323('0xd')](_[_0x5323('0xe')](_0x398f8a,{'status':'online'}),'name')[_0x5323('0xf')]());logger[_0x5323('0xa')](_0x5323('0x10'),_[_0x5323('0xd')](_[_0x5323('0xe')](_0x398f8a,function(_0x3e9b2e){return _0x3e9b2e[_0x5323('0x11')]!==_0x5323('0x12');}),'name')['join']()||'None');config[_0x5323('0x13')]&&require('./config/seedDB')[_0x5323('0x14')]();require(_0x5323('0x15'))[_0x5323('0x14')]();})[_0x5323('0x16')](function(_0x2a4591){logger[_0x5323('0x17')](_0x5323('0x18'),_0x2a4591);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x0d56=['name','join','Offline\x20apps:','map','filter','status','None','default','error','exit','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule/chat','sequelize','sync','then','listen','info','start','Online\x20apps:','online'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x0d56,0x181));var _0x60d5=function(_0x5e5882,_0x699de4){_0x5e5882=_0x5e5882-0x0;var _0x3ea2dc=_0x0d56[_0x5e5882];return _0x3ea2dc;};'use strict';var _=require('lodash');var mysqldb=require('./mysqldb');var rpc=require(_0x60d5('0x0'));var config=require(_0x60d5('0x1'));var logger=require(_0x60d5('0x2'))(_0x60d5('0x3'));var pm2=require(_0x60d5('0x4'));var pm2Config=require(_0x60d5('0x5'));var schedule=require('./config/schedule');var chat=require(_0x60d5('0x6'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db'][_0x60d5('0x7')][_0x60d5('0x8')]()[_0x60d5('0x9')](function(){return rpc[_0x60d5('0xa')]();})['then'](function(_0x464d29){logger[_0x60d5('0xb')](_0x464d29);return chat['start']();})[_0x60d5('0x9')](function(){return whatsapp[_0x60d5('0xc')]();})[_0x60d5('0x9')](function(){return schedule[_0x60d5('0xc')]();})[_0x60d5('0x9')](function(){return transcribe['start']();})[_0x60d5('0x9')](function(_0x18c73a){logger[_0x60d5('0xb')](_0x18c73a);return pm2['start'](pm2Config);})[_0x60d5('0x9')](function(_0x45b775){logger[_0x60d5('0xb')](_0x60d5('0xd'),_['map'](_['filter'](_0x45b775,{'status':_0x60d5('0xe')}),_0x60d5('0xf'))[_0x60d5('0x10')]());logger[_0x60d5('0xb')](_0x60d5('0x11'),_[_0x60d5('0x12')](_[_0x60d5('0x13')](_0x45b775,function(_0x33bfc6){return _0x33bfc6[_0x60d5('0x14')]!==_0x60d5('0xe');}),_0x60d5('0xf'))[_0x60d5('0x10')]()||_0x60d5('0x15'));config['seedDB']&&require('./config/seedDB')['default']();require('./config/license')[_0x60d5('0x16')]();})['catch'](function(_0x41ab1b){logger[_0x60d5('0x17')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x41ab1b);process[_0x60d5('0x18')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 5c04f3c..b7861fd 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 _0x68c9=['find','name','then','authenticate','pass','Wrong\x20credentials.','apikey','getUuid','query','Setting','blockDuration','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','minutes','user','User\x20object\x20not\x20found.','canUpdate','update','Forbidden','isMiddleware','cookie','redirect','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','decryptString','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','split','length','splice','encryptString','join','sign','payload','options','verify','secrets','toString','hex','floor','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','jsonwebtoken','express-jwt','basic-auth','bluebird','util','moment','session','role','internal','email','userpic','permissions','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','lastPauseAt','crudPermissions','allowmessenger','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','isAuthenticated','ChatInteraction','params','closed','disposition','status','unmanaged','json','Unmanaged.','Forbidden.','catch','use','authorization','startsWith','headers','User'];(function(_0x3f1d02,_0x533c27){var _0x3da535=function(_0x145083){while(--_0x145083){_0x3f1d02['push'](_0x3f1d02['shift']());}};_0x3da535(++_0x533c27);}(_0x68c9,0x184));var _0x968c=function(_0x262ada,_0x3d1a45){_0x262ada=_0x262ada-0x0;var _0x5b2f76=_0x68c9[_0x262ada];return _0x5b2f76;};'use strict';var db=require(_0x968c('0x0'))['db'];var config=require(_0x968c('0x1'));var hardwareConf=require(_0x968c('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require('../encryptor');var _=require('lodash');var jwt=require(_0x968c('0x3'));var expressJwt=require(_0x968c('0x4'));var compose=require('composable-middleware');var basicAuth=require(_0x968c('0x5'));var crypto=require('crypto');var BPromise=require(_0x968c('0x6'));var util=require(_0x968c('0x7'));var moment=require(_0x968c('0x8'));var validateJwt=expressJwt({'secret':config['secrets'][_0x968c('0x9')]});var userAttributes=['id',_0x968c('0xa'),'fullname','name',_0x968c('0xb'),_0x968c('0xc'),_0x968c('0xd'),_0x968c('0xe'),'md5secret',_0x968c('0xf'),_0x968c('0x10'),_0x968c('0x11'),_0x968c('0x12'),_0x968c('0x13'),_0x968c('0x14'),_0x968c('0x15'),'showWebBar','lastLoginAt',_0x968c('0x16'),_0x968c('0x17'),_0x968c('0x18'),'passwordResetAt',_0x968c('0x19'),_0x968c('0x1a'),_0x968c('0x1b'),'phoneBarDnd',_0x968c('0x1c'),_0x968c('0x1d'),_0x968c('0x1e'),'phoneBarExpires','phoneBarPrefixRequired',_0x968c('0x1f'),_0x968c('0x20'),'hotdesk',_0x968c('0x21'),_0x968c('0x22'),'privacyEnabled',_0x968c('0x23'),_0x968c('0x24'),_0x968c('0x25'),_0x968c('0x26'),_0x968c('0x27')];exports['isChatInteractionAuthorized']=function(){return this[_0x968c('0x28')](!![])['use'](function(_0x514822,_0x2e9b84,_0xacfeb8){if(_0x514822['user']){_0xacfeb8();}else{return db[_0x968c('0x29')]['findOne']({'where':{'id':_0x514822[_0x968c('0x2a')]['id']},'attributes':['id',_0x968c('0x2b'),_0x968c('0x2c')],'raw':!![]})['then'](function(_0x280c58){if(_0x280c58&&_0x280c58['closed']){return _0x2e9b84[_0x968c('0x2d')](_0x280c58[_0x968c('0x2c')]===_0x968c('0x2e')?0x195:0x193)[_0x968c('0x2f')]({'message':_0x280c58[_0x968c('0x2c')]===_0x968c('0x2e')?_0x968c('0x30'):_0x968c('0x31')});}else{_0xacfeb8();}})[_0x968c('0x32')](function(_0x517ce4){_0xacfeb8(_0x517ce4);});}});};exports['isAuthenticated']=function isAuthenticated(_0x18c6aa){return compose()[_0x968c('0x33')](function(_0x54999e,_0x5969d8,_0xf2b74f){var _0x199ea9;if(_0x54999e['headers'][_0x968c('0x34')]){if(_[_0x968c('0x35')](_0x54999e[_0x968c('0x36')][_0x968c('0x34')],'Basic')){var _0x161304=basicAuth(_0x54999e);db[_0x968c('0x37')][_0x968c('0x38')]({'where':{'name':_0x161304[_0x968c('0x39')]}})[_0x968c('0x3a')](function(_0x3f04b2){if(!_0x3f04b2||!_0x3f04b2[_0x968c('0x3b')](_0x161304[_0x968c('0x3c')])){return _0x5969d8[_0x968c('0x2d')](0x191)['json']({'message':_0x968c('0x3d')});}_0x54999e['user']={'id':_0x3f04b2['id']};_0xf2b74f();})[_0x968c('0x32')](function(_0xd0dc74){_0xf2b74f(_0xd0dc74);});}else if(_[_0x968c('0x35')](_0x54999e[_0x968c('0x36')]['authorization'],'Bearer')){validateJwt(_0x54999e,_0x5969d8,_0xf2b74f);}else{if(_0x18c6aa){_0xf2b74f();}else{return _0x5969d8['status'](0x193)[_0x968c('0x2f')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x54999e['query'][_0x968c('0x3e')]){try{var _0x199e78={'audience':hardwareConf[_0x968c('0x3f')](),'issuer':hardwareConf[_0x968c('0x3f')]()};verifyJwt(_0x54999e[_0x968c('0x40')][_0x968c('0x3e')],_0x199e78)['then'](function(_0x348f26){return db[_0x968c('0x37')][_0x968c('0x38')]({'where':{'id':_0x348f26['sub']}})[_0x968c('0x3a')](function(_0x566f53){_0x199ea9=_0x566f53;return db[_0x968c('0x41')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x968c('0x42')],'raw':!![]});})['then'](function(_0x352695){if(!_0x199ea9||!_[_0x968c('0x43')](_0x199ea9[_0x968c('0x44')],_0x348f26['nonce'])){return _0x5969d8[_0x968c('0x2d')](0x191)[_0x968c('0x2f')]({'message':_0x968c('0x45')});}if(_0x199ea9[_0x968c('0x46')]){return _0x5969d8[_0x968c('0x2d')](0x191)['json']({'message':_0x968c('0x47')});}if(_0x199ea9[_0x968c('0x48')]){if(_0x352695[_0x968c('0x42')]>0x0){if(moment(_0x199ea9[_0x968c('0x49')])['add'](_0x352695[_0x968c('0x42')],_0x968c('0x4a'))>moment()){return _0x5969d8[_0x968c('0x2d')](0x191)[_0x968c('0x2f')]({'message':_0x968c('0x47')});}}else{return _0x5969d8[_0x968c('0x2d')](0x191)[_0x968c('0x2f')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x54999e[_0x968c('0x4b')]={'id':_0x199ea9['id']};_0xf2b74f();});})['catch'](function(){return _0x5969d8[_0x968c('0x2d')](0x191)['json']({'message':_0x968c('0x47')});});}catch(_0x283445){_0xf2b74f(_0x283445);}}else if(_0x18c6aa){_0xf2b74f();}else{return _0x5969d8[_0x968c('0x2d')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}})[_0x968c('0x33')](function(_0x4666ba,_0x4f9d12,_0x50ed25){if(_0x4666ba['user']){db['User'][_0x968c('0x38')]({'where':{'id':_0x4666ba[_0x968c('0x4b')]['id']},'attributes':userAttributes})[_0x968c('0x3a')](function(_0x1c4e7b){if(!_0x1c4e7b){return _0x4f9d12['status'](0x194)[_0x968c('0x2f')]({'message':'User\x20not\x20found.'});}_0x4666ba[_0x968c('0x4b')]=_0x1c4e7b;_0x50ed25();})[_0x968c('0x32')](function(_0x6e4b12){_0x50ed25(_0x6e4b12);});}else if(_0x18c6aa){_0x50ed25();}else{return _0x4f9d12[_0x968c('0x2d')](0x194)[_0x968c('0x2f')]({'message':_0x968c('0x4c')});}});};exports[_0x968c('0x4d')]=function canUpdate(){return compose()[_0x968c('0x33')](function(_0x5aa84c,_0x5f0b41,_0x22ee5f){return licenseUtil['getLicense']()[_0x968c('0x3a')](function(_0xfa9ea0){if(_0xfa9ea0[_0x968c('0x4e')]){_0x22ee5f();}else{return _0x5f0b41['status'](0x193)[_0x968c('0x2f')]({'message':_0x968c('0x4f')});}})[_0x968c('0x32')](function(_0x5efe94){_0x22ee5f(_0x5efe94);});});};exports[_0x968c('0x50')]=function(_0x49134b,_0xebba12,_0x3f3baa){_0x49134b[_0x968c('0x50')]=!![];return _0x3f3baa();};exports['signToken']=function signToken(_0x3548df){return signJwt(_0x3548df);};exports['setTokenCookie']=function(_0x219029,_0x403b90){if(!_0x219029[_0x968c('0x4b')]){return _0x403b90[_0x968c('0x2d')](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x3ee47a={'payload':{'id':_0x219029[_0x968c('0x4b')]['id'],'role':_0x219029[_0x968c('0x4b')][_0x968c('0xa')]},'options':{'expiresIn':0x15180}};return signJwt(_0x3ee47a)[_0x968c('0x3a')](function(_0x53508d){_0x403b90[_0x968c('0x51')]('motion.token',_0x53508d);_0x403b90[_0x968c('0x52')]('/dashboards/general');})[_0x968c('0x32')](function(_0x272c3d){return _0x403b90[_0x968c('0x2d')](0x1f4)['send'](_0x272c3d);});};exports[_0x968c('0x53')]=function(_0x436009){if(_[_0x968c('0x54')](_0x436009['apiKeyNonce'])||_[_0x968c('0x54')](_0x436009[_0x968c('0x55')])){return null;}else{return createJwt(_0x436009);}};exports[_0x968c('0x56')]=function(_0xcc2a8){_0xcc2a8[_0x968c('0x44')]=generateNonce();_0xcc2a8[_0x968c('0x55')]=generateIssuedAt();return createJwt(_0xcc2a8);};exports[_0x968c('0x57')]=function(_0x269899,_0x14e2f0){var _0x1d9511=_0x269899[_0x968c('0x40')][_0x968c('0x3e')];if(_0x1d9511){var _0x34457b={'nonce':_0x14e2f0[_0x968c('0x44')],'iat':_0x14e2f0['apiKeyIat'],'audience':hardwareConf[_0x968c('0x3f')](),'issuer':hardwareConf[_0x968c('0x3f')]()};return verifyJwt(_0x1d9511,_0x34457b)[_0x968c('0x3a')](function(){return generateApiKey(_0x14e2f0);});}else{throw{'message':_0x968c('0x58')};}};exports[_0x968c('0x59')]=function(_0x2a06ce){var _0x480a1d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x480a1d[_0x968c('0x5a')](_0x2a06ce))throw new db['Sequelize'][(_0x968c('0x5b'))](_0x968c('0x5c'));return;};exports['validatePasswordHistory']=function(_0xbae998,_0x48255f,_0x4feda4){var _0x2083a8=encryptor[_0x968c('0x5d')](_0x48255f)['split'](',');for(var _0x2cfa71=0x0;_0x2cfa71<_0x4feda4;_0x2cfa71++){if(!_0x2083a8[_0x2cfa71])break;if(_0xbae998['toLowerCase']()===_0x2083a8[_0x2cfa71]['toLowerCase']()){var _0x49fc2b=util['format'](_0x968c('0x5e'),_0x4feda4);if(_0x4feda4===0x1){_0x49fc2b=_0x968c('0x5f');}throw new db[(_0x968c('0x60'))][(_0x968c('0x5b'))](_0x49fc2b);}}return;};exports['updatePasswordsHistory']=function(_0x1df9d1,_0x30cb9a){var _0x111602=_0x30cb9a?encryptor['decryptString'](_0x30cb9a)[_0x968c('0x61')](','):[];if(_0x111602[_0x968c('0x62')]===0x5){_0x111602[_0x968c('0x63')](-0x1,0x1);}_0x111602['unshift'](_0x1df9d1);return encryptor[_0x968c('0x64')](_0x111602[_0x968c('0x65')](','));};function signJwt(_0x31d535){var _0x2d347f=BPromise['promisify'](jwt[_0x968c('0x66')],{'context':jwt});var _0x2fa84a=_0x31d535['secret']||config['secrets']['session'];return new BPromise(function(_0x44d338,_0x289b43){_0x2d347f(_0x31d535[_0x968c('0x67')],_0x2fa84a,_0x31d535[_0x968c('0x68')])[_0x968c('0x3a')](function(_0x115d25){_0x44d338(_0x115d25);})[_0x968c('0x32')](function(_0x4b3c35){_0x289b43(_0x4b3c35);});});}function verifyJwt(_0x560e00,_0xe87d69,_0x2579ea){var _0xd44bc3=BPromise['promisify'](jwt[_0x968c('0x69')],{'context':jwt});var _0x354e67=_0x2579ea||config[_0x968c('0x6a')][_0x968c('0x9')];return new BPromise(function(_0x4561cb,_0x5bd229){_0xd44bc3(_0x560e00,_0x354e67,_0xe87d69)['then'](function(_0x5b32be){_0x4561cb(_0x5b32be);})[_0x968c('0x32')](function(_0x246cea){_0x5bd229(_0x246cea);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x968c('0x6b')](_0x968c('0x6c'));}function generateIssuedAt(){return Math[_0x968c('0x6d')](Date['now']()/0x3e8)[_0x968c('0x6b')]();}function createJwt(_0x4ba383){var _0x253490={'payload':{'iat':_0x4ba383[_0x968c('0x55')],'nonce':_0x4ba383[_0x968c('0x44')]},'options':{'algorithm':_0x968c('0x6e'),'subject':_0x4ba383['id'][_0x968c('0x6b')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x253490)[_0x968c('0x3a')](function(_0x5d7f07){return{'iat':_0x4ba383['apiKeyIat'],'nonce':_0x4ba383[_0x968c('0x44')],'token':_0x5d7f07};});} \ No newline at end of file +var _0x6b82=['md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','isChatInteractionAuthorized','use','user','ChatInteraction','closed','disposition','then','status','json','unmanaged','Unmanaged.','catch','isAuthenticated','headers','authorization','User','find','authenticate','Wrong\x20credentials.','startsWith','Unknown\x20authorization\x20format','query','apikey','Setting','allowedLoginAttempts','blockDuration','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','send','retrieveApiKey','isNil','apiKeyNonce','generateApiKey','apiKeyIat','regenerateApiKey','getUuid','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','splice','unshift','encryptString','join','promisify','secret','payload','verify','toString','hex','floor','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','secrets','session','role','fullname','name','userpic','permissions'];(function(_0x58befc,_0x185458){var _0x3129bf=function(_0x287807){while(--_0x287807){_0x58befc['push'](_0x58befc['shift']());}};_0x3129bf(++_0x185458);}(_0x6b82,0x1e0));var _0x26b8=function(_0x22fe5c,_0x28645c){_0x22fe5c=_0x22fe5c-0x0;var _0x17a217=_0x6b82[_0x22fe5c];return _0x17a217;};'use strict';var db=require(_0x26b8('0x0'))['db'];var config=require(_0x26b8('0x1'));var hardwareConf=require(_0x26b8('0x2'));var licenseUtil=require(_0x26b8('0x3'));var encryptor=require(_0x26b8('0x4'));var _=require(_0x26b8('0x5'));var jwt=require(_0x26b8('0x6'));var expressJwt=require(_0x26b8('0x7'));var compose=require(_0x26b8('0x8'));var basicAuth=require(_0x26b8('0x9'));var crypto=require(_0x26b8('0xa'));var BPromise=require(_0x26b8('0xb'));var util=require(_0x26b8('0xc'));var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0x26b8('0xd')][_0x26b8('0xe')]});var userAttributes=['id',_0x26b8('0xf'),_0x26b8('0x10'),_0x26b8('0x11'),'internal','email',_0x26b8('0x12'),_0x26b8('0x13'),_0x26b8('0x14'),_0x26b8('0x15'),_0x26b8('0x16'),_0x26b8('0x17'),_0x26b8('0x18'),_0x26b8('0x19'),'openchannelPause','pauseType',_0x26b8('0x1a'),_0x26b8('0x1b'),_0x26b8('0x1c'),_0x26b8('0x1d'),_0x26b8('0x1e'),_0x26b8('0x1f'),'alias',_0x26b8('0x20'),_0x26b8('0x21'),'phoneBarDnd',_0x26b8('0x22'),'phoneBarEnableDtmfTone',_0x26b8('0x23'),_0x26b8('0x24'),_0x26b8('0x25'),_0x26b8('0x26'),_0x26b8('0x27'),_0x26b8('0x28'),_0x26b8('0x29'),_0x26b8('0x2a'),'privacyEnabled',_0x26b8('0x2b'),_0x26b8('0x2c'),_0x26b8('0x2d'),_0x26b8('0x2e'),_0x26b8('0x2f')];exports[_0x26b8('0x30')]=function(){return this['isAuthenticated'](!![])[_0x26b8('0x31')](function(_0x1f8622,_0x48af76,_0x596956){if(_0x1f8622[_0x26b8('0x32')]){_0x596956();}else{return db[_0x26b8('0x33')]['findOne']({'where':{'id':_0x1f8622['params']['id']},'attributes':['id',_0x26b8('0x34'),_0x26b8('0x35')],'raw':!![]})[_0x26b8('0x36')](function(_0x57b7e8){if(_0x57b7e8&&_0x57b7e8[_0x26b8('0x34')]){return _0x48af76[_0x26b8('0x37')](_0x57b7e8[_0x26b8('0x35')]==='unmanaged'?0x195:0x193)[_0x26b8('0x38')]({'message':_0x57b7e8[_0x26b8('0x35')]===_0x26b8('0x39')?_0x26b8('0x3a'):'Forbidden.'});}else{_0x596956();}})[_0x26b8('0x3b')](function(_0x1103b4){_0x596956(_0x1103b4);});}});};exports[_0x26b8('0x3c')]=function isAuthenticated(_0xd81787){return compose()[_0x26b8('0x31')](function(_0x2fd2d4,_0x4e8755,_0x2d8a50){var _0xd5b79e;if(_0x2fd2d4[_0x26b8('0x3d')][_0x26b8('0x3e')]){if(_['startsWith'](_0x2fd2d4[_0x26b8('0x3d')][_0x26b8('0x3e')],'Basic')){var _0x3dcdca=basicAuth(_0x2fd2d4);db[_0x26b8('0x3f')][_0x26b8('0x40')]({'where':{'name':_0x3dcdca['name']}})[_0x26b8('0x36')](function(_0x2405e5){if(!_0x2405e5||!_0x2405e5[_0x26b8('0x41')](_0x3dcdca['pass'])){return _0x4e8755[_0x26b8('0x37')](0x191)[_0x26b8('0x38')]({'message':_0x26b8('0x42')});}_0x2fd2d4['user']={'id':_0x2405e5['id']};_0x2d8a50();})[_0x26b8('0x3b')](function(_0x2a7b02){_0x2d8a50(_0x2a7b02);});}else if(_[_0x26b8('0x43')](_0x2fd2d4[_0x26b8('0x3d')]['authorization'],'Bearer')){validateJwt(_0x2fd2d4,_0x4e8755,_0x2d8a50);}else{if(_0xd81787){_0x2d8a50();}else{return _0x4e8755['status'](0x193)[_0x26b8('0x38')]({'message':_0x26b8('0x44')});}}}else if(_0x2fd2d4[_0x26b8('0x45')][_0x26b8('0x46')]){try{var _0x6e35f4={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x2fd2d4[_0x26b8('0x45')][_0x26b8('0x46')],_0x6e35f4)[_0x26b8('0x36')](function(_0x342b63){return db[_0x26b8('0x3f')][_0x26b8('0x40')]({'where':{'id':_0x342b63['sub']}})[_0x26b8('0x36')](function(_0x124255){_0xd5b79e=_0x124255;return db[_0x26b8('0x47')]['findOne']({'where':{'id':0x1},'attributes':[_0x26b8('0x48'),_0x26b8('0x49')],'raw':!![]});})[_0x26b8('0x36')](function(_0x46c4de){if(!_0xd5b79e||!_[_0x26b8('0x4a')](_0xd5b79e['apiKeyNonce'],_0x342b63[_0x26b8('0x4b')])){return _0x4e8755[_0x26b8('0x37')](0x191)['json']({'message':_0x26b8('0x4c')});}if(_0xd5b79e[_0x26b8('0x4d')]){return _0x4e8755[_0x26b8('0x37')](0x191)[_0x26b8('0x38')]({'message':_0x26b8('0x4e')});}if(_0xd5b79e[_0x26b8('0x4f')]){if(_0x46c4de[_0x26b8('0x49')]>0x0){if(moment(_0xd5b79e[_0x26b8('0x50')])[_0x26b8('0x51')](_0x46c4de['blockDuration'],_0x26b8('0x52'))>moment()){return _0x4e8755[_0x26b8('0x37')](0x191)['json']({'message':_0x26b8('0x4e')});}}else{return _0x4e8755['status'](0x191)[_0x26b8('0x38')]({'message':_0x26b8('0x4e')});}}_0x2fd2d4['user']={'id':_0xd5b79e['id']};_0x2d8a50();});})[_0x26b8('0x3b')](function(){return _0x4e8755[_0x26b8('0x37')](0x191)[_0x26b8('0x38')]({'message':_0x26b8('0x4e')});});}catch(_0x35cf1d){_0x2d8a50(_0x35cf1d);}}else if(_0xd81787){_0x2d8a50();}else{return _0x4e8755[_0x26b8('0x37')](0x193)['json']({'message':_0x26b8('0x44')});}})[_0x26b8('0x31')](function(_0x92a458,_0x2d7e03,_0x5d6b80){if(_0x92a458[_0x26b8('0x32')]){db['User'][_0x26b8('0x40')]({'where':{'id':_0x92a458[_0x26b8('0x32')]['id']},'attributes':userAttributes})[_0x26b8('0x36')](function(_0x3fd121){if(!_0x3fd121){return _0x2d7e03[_0x26b8('0x37')](0x194)[_0x26b8('0x38')]({'message':_0x26b8('0x53')});}_0x92a458[_0x26b8('0x32')]=_0x3fd121;_0x5d6b80();})[_0x26b8('0x3b')](function(_0x29e1d8){_0x5d6b80(_0x29e1d8);});}else if(_0xd81787){_0x5d6b80();}else{return _0x2d7e03[_0x26b8('0x37')](0x194)[_0x26b8('0x38')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x26b8('0x54')]=function canUpdate(){return compose()['use'](function(_0x3eb32e,_0x251507,_0x16318f){return licenseUtil[_0x26b8('0x55')]()['then'](function(_0x1d9548){if(_0x1d9548[_0x26b8('0x56')]){_0x16318f();}else{return _0x251507[_0x26b8('0x37')](0x193)['json']({'message':_0x26b8('0x57')});}})['catch'](function(_0x22f062){_0x16318f(_0x22f062);});});};exports['isMiddleware']=function(_0x3b8cdf,_0x31c721,_0x485efa){_0x3b8cdf[_0x26b8('0x58')]=!![];return _0x485efa();};exports[_0x26b8('0x59')]=function signToken(_0x57cb90){return signJwt(_0x57cb90);};exports[_0x26b8('0x5a')]=function(_0x5016e2,_0x5df98b){if(!_0x5016e2[_0x26b8('0x32')]){return _0x5df98b[_0x26b8('0x37')](0x194)[_0x26b8('0x38')]({'message':_0x26b8('0x5b')});}var _0x517222={'payload':{'id':_0x5016e2['user']['id'],'role':_0x5016e2[_0x26b8('0x32')][_0x26b8('0xf')]},'options':{'expiresIn':0x15180}};return signJwt(_0x517222)[_0x26b8('0x36')](function(_0x31189c){_0x5df98b[_0x26b8('0x5c')](_0x26b8('0x5d'),_0x31189c);_0x5df98b[_0x26b8('0x5e')]('/dashboards/general');})['catch'](function(_0x2ce6b8){return _0x5df98b[_0x26b8('0x37')](0x1f4)[_0x26b8('0x5f')](_0x2ce6b8);});};exports[_0x26b8('0x60')]=function(_0x1407c0){if(_[_0x26b8('0x61')](_0x1407c0[_0x26b8('0x62')])||_[_0x26b8('0x61')](_0x1407c0['apiKeyIat'])){return null;}else{return createJwt(_0x1407c0);}};exports[_0x26b8('0x63')]=function(_0x25ef57){_0x25ef57[_0x26b8('0x62')]=generateNonce();_0x25ef57[_0x26b8('0x64')]=generateIssuedAt();return createJwt(_0x25ef57);};exports[_0x26b8('0x65')]=function(_0x298236,_0x334169){var _0x25c9d6=_0x298236[_0x26b8('0x45')]['apikey'];if(_0x25c9d6){var _0x581488={'nonce':_0x334169[_0x26b8('0x62')],'iat':_0x334169[_0x26b8('0x64')],'audience':hardwareConf[_0x26b8('0x66')](),'issuer':hardwareConf[_0x26b8('0x66')]()};return verifyJwt(_0x25c9d6,_0x581488)['then'](function(){return generateApiKey(_0x334169);});}else{throw{'message':_0x26b8('0x67')};}};exports[_0x26b8('0x68')]=function(_0x1c92a1){var _0xfd02de=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0xfd02de[_0x26b8('0x69')](_0x1c92a1))throw new db[(_0x26b8('0x6a'))][(_0x26b8('0x6b'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0x26b8('0x6c')]=function(_0x315833,_0xf5f5a7,_0x532b84){var _0x4bae9a=encryptor[_0x26b8('0x6d')](_0xf5f5a7)[_0x26b8('0x6e')](',');for(var _0x448a90=0x0;_0x448a90<_0x532b84;_0x448a90++){if(!_0x4bae9a[_0x448a90])break;if(_0x315833['toLowerCase']()===_0x4bae9a[_0x448a90][_0x26b8('0x6f')]()){var _0x502b76=util['format'](_0x26b8('0x70'),_0x532b84);if(_0x532b84===0x1){_0x502b76=_0x26b8('0x71');}throw new db[(_0x26b8('0x6a'))][(_0x26b8('0x6b'))](_0x502b76);}}return;};exports['updatePasswordsHistory']=function(_0x20dd7f,_0xd487e1){var _0x3d72ed=_0xd487e1?encryptor[_0x26b8('0x6d')](_0xd487e1)['split'](','):[];if(_0x3d72ed['length']===0x5){_0x3d72ed[_0x26b8('0x72')](-0x1,0x1);}_0x3d72ed[_0x26b8('0x73')](_0x20dd7f);return encryptor[_0x26b8('0x74')](_0x3d72ed[_0x26b8('0x75')](','));};function signJwt(_0x25590c){var _0x2cc089=BPromise[_0x26b8('0x76')](jwt['sign'],{'context':jwt});var _0x2ad186=_0x25590c[_0x26b8('0x77')]||config['secrets']['session'];return new BPromise(function(_0xb254bd,_0xb01be3){_0x2cc089(_0x25590c[_0x26b8('0x78')],_0x2ad186,_0x25590c['options'])[_0x26b8('0x36')](function(_0x4233bf){_0xb254bd(_0x4233bf);})['catch'](function(_0x49a517){_0xb01be3(_0x49a517);});});}function verifyJwt(_0xcecd67,_0x37966c,_0x4bf8f5){var _0x2e5150=BPromise[_0x26b8('0x76')](jwt[_0x26b8('0x79')],{'context':jwt});var _0x474d8d=_0x4bf8f5||config[_0x26b8('0xd')][_0x26b8('0xe')];return new BPromise(function(_0x28d0ba,_0x461b5c){_0x2e5150(_0xcecd67,_0x474d8d,_0x37966c)[_0x26b8('0x36')](function(_0x495a9f){_0x28d0ba(_0x495a9f);})['catch'](function(_0x3b2d64){_0x461b5c(_0x3b2d64);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x26b8('0x7a')](_0x26b8('0x7b'));}function generateIssuedAt(){return Math[_0x26b8('0x7c')](Date['now']()/0x3e8)['toString']();}function createJwt(_0x453d8b){var _0x512293={'payload':{'iat':_0x453d8b[_0x26b8('0x64')],'nonce':_0x453d8b['apiKeyNonce']},'options':{'algorithm':'HS512','subject':_0x453d8b['id'][_0x26b8('0x7a')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x512293)[_0x26b8('0x36')](function(_0x41fff9){return{'iat':_0x453d8b['apiKeyIat'],'nonce':_0x453d8b[_0x26b8('0x62')],'token':_0x41fff9};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index a5bbeec..5295104 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 _0xe721=['close','unlink','createReadStream','createDecipher','secret','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','indexOf','createWriteStream','createCipher','data','update','binary','write','end','final'];(function(_0x1a9e9e,_0x4e02c0){var _0x461061=function(_0x595613){while(--_0x595613){_0x1a9e9e['push'](_0x1a9e9e['shift']());}};_0x461061(++_0x4e02c0);}(_0xe721,0x10f));var _0x1e72=function(_0x144eea,_0x1a8159){_0x144eea=_0x144eea-0x0;var _0x1ec64b=_0xe721[_0x144eea];return _0x1ec64b;};'use strict';var crypto=require(_0x1e72('0x0'));var fs=require('fs');var BPromise=require(_0x1e72('0x1'));var _=require(_0x1e72('0x2'));var config=require(_0x1e72('0x3'));var logger=require(_0x1e72('0x4'))(_0x1e72('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x1e72('0x6')][_0x1e72('0x7')],'algorithm':_0x1e72('0x8')};const fileOptions={'algorithm':_0x1e72('0x9')};if(config[_0x1e72('0xa')]&&config[_0x1e72('0xa')][_0x1e72('0xb')]){var isSupported=isAlgorithmSupported(config[_0x1e72('0xa')][_0x1e72('0xb')]);if(isSupported){fileOptions[_0x1e72('0xb')]=config[_0x1e72('0xa')][_0x1e72('0xb')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x1e72('0xc')](',\x20');logger[_0x1e72('0xd')](config[_0x1e72('0xa')][_0x1e72('0xb')],_0x1e72('0xe'),supportedAlgorithms);}}function isASupportedCipher(_0x2c75e0){return AES_SUPPORTED_RX[_0x1e72('0xf')](_0x2c75e0);}function getSupportedCiphers(){return crypto[_0x1e72('0x10')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x9eca0d){return getSupportedCiphers()[_0x1e72('0x11')](_0x9eca0d)>-0x1;}function combineOptions(_0x40a330){var _0x101768={};for(var _0x597724 in fileOptions){if(fileOptions['hasOwnProperty'](_0x597724)){_0x101768[_0x597724]=fileOptions[_0x597724];}}if(_0x40a330){for(var _0x5646cd in _0x40a330){if(_0x40a330['hasOwnProperty'](_0x5646cd)){_0x101768[_0x5646cd]=_0x40a330[_0x5646cd];}}}return _0x101768;}exports['encryptFile']=function(_0x53bdd9,_0x558bfe,_0x4de5d8,_0x57c471){return new BPromise(function(_0x123932,_0xec4b3b){_0x57c471=combineOptions(_0x57c471);var _0x46d30d=new Buffer(_0x4de5d8);var _0x300f55=fs['createReadStream'](_0x53bdd9);var _0x90650d=fs[_0x1e72('0x12')](_0x558bfe);var _0x15228d=crypto[_0x1e72('0x13')](_0x57c471[_0x1e72('0xb')],_0x46d30d);_0x300f55['on'](_0x1e72('0x14'),function(_0x35379f){var _0x102887=new Buffer(_0x15228d[_0x1e72('0x15')](_0x35379f),_0x1e72('0x16'));_0x90650d[_0x1e72('0x17')](_0x102887);});_0x300f55['on'](_0x1e72('0x18'),function(){try{var _0x4d8eaf=new Buffer(_0x15228d[_0x1e72('0x19')](_0x1e72('0x16')),_0x1e72('0x16'));_0x90650d[_0x1e72('0x17')](_0x4d8eaf);_0x90650d['end']();_0x90650d['on'](_0x1e72('0x1a'),function(){return _0x123932(_0x558bfe);});}catch(_0x13ea76){fs[_0x1e72('0x1b')](_0x558bfe);return _0xec4b3b(_0x13ea76);}});});};exports['decryptFile']=function(_0x50dd7d,_0x36e300,_0x24fcaa,_0x9b474){return new BPromise(function(_0x1d991d,_0x2a32d1){_0x9b474=combineOptions(_0x9b474);var _0xed33a5=new Buffer(_0x24fcaa);var _0x4da694=fs[_0x1e72('0x1c')](_0x50dd7d);var _0x193d27=fs[_0x1e72('0x12')](_0x36e300);var _0x1b7caf=crypto[_0x1e72('0x1d')](_0x9b474[_0x1e72('0xb')],_0xed33a5);_0x4da694['on'](_0x1e72('0x14'),function(_0x550c32){var _0xef182=new Buffer(_0x1b7caf[_0x1e72('0x15')](_0x550c32),'binary');_0x193d27['write'](_0xef182);});_0x4da694['on']('end',function(){try{var _0x105dd1=new Buffer(_0x1b7caf[_0x1e72('0x19')](_0x1e72('0x16')),_0x1e72('0x16'));_0x193d27[_0x1e72('0x17')](_0x105dd1);_0x193d27[_0x1e72('0x18')]();_0x193d27['on'](_0x1e72('0x1a'),function(){return _0x1d991d(_0x36e300);});}catch(_0x15b60a){fs[_0x1e72('0x1b')](_0x36e300);return _0x2a32d1(_0x15b60a);}});});};exports['encryptString']=function(_0x578b6d,_0x37bc6a,_0x10e256){var _0x17d44d=_0x10e256||stringOptions[_0x1e72('0xb')];var _0x5e0724=_0x37bc6a||stringOptions[_0x1e72('0x1e')];var _0x2bcb5f=crypto[_0x1e72('0x13')](_0x17d44d,_0x5e0724);var _0x275d0c=_0x2bcb5f[_0x1e72('0x15')](_0x578b6d,'utf8',_0x1e72('0x1f'));_0x275d0c+=_0x2bcb5f[_0x1e72('0x19')](_0x1e72('0x1f'));return _0x275d0c;};exports[_0x1e72('0x20')]=function(_0x5b2584,_0x2514a0,_0x35fb16){var _0x24c819=_0x35fb16||stringOptions[_0x1e72('0xb')];var _0x1d41aa=_0x2514a0||stringOptions[_0x1e72('0x1e')];var _0x10444f=crypto['createDecipher'](_0x24c819,_0x1d41aa);var _0xb87658=_0x10444f['update'](_0x5b2584,'base64','utf8');_0xb87658+=_0x10444f[_0x1e72('0x19')]('utf8');return _0xb87658;}; \ No newline at end of file +var _0x9327=['../../config/logger','session','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','hasOwnProperty','createReadStream','createWriteStream','data','update','binary','write','end','final','close','unlink','createDecipher','encryptString','secret','createCipher','utf8','base64','decryptString','crypto','lodash'];(function(_0x1d4c88,_0x2cd92f){var _0x486b2f=function(_0x1c9ab0){while(--_0x1c9ab0){_0x1d4c88['push'](_0x1d4c88['shift']());}};_0x486b2f(++_0x2cd92f);}(_0x9327,0x94));var _0x7932=function(_0x18851f,_0x5e8881){_0x18851f=_0x18851f-0x0;var _0x47078c=_0x9327[_0x18851f];return _0x47078c;};'use strict';var crypto=require(_0x7932('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x7932('0x1'));var config=require('../../config/environment');var logger=require(_0x7932('0x2'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0x7932('0x3')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':'aes192'};if(config['encrypt']&&config[_0x7932('0x4')][_0x7932('0x5')]){var isSupported=isAlgorithmSupported(config['encrypt']['algorithm']);if(isSupported){fileOptions[_0x7932('0x5')]=config['encrypt'][_0x7932('0x5')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x7932('0x6')](',\x20');logger[_0x7932('0x7')](config[_0x7932('0x4')][_0x7932('0x5')],_0x7932('0x8'),supportedAlgorithms);}}function isASupportedCipher(_0x20bcca){return AES_SUPPORTED_RX[_0x7932('0x9')](_0x20bcca);}function getSupportedCiphers(){return crypto[_0x7932('0xa')]()[_0x7932('0xb')](isASupportedCipher);}function isAlgorithmSupported(_0x1f599d){return getSupportedCiphers()['indexOf'](_0x1f599d)>-0x1;}function combineOptions(_0x47c4ac){var _0x5dce5d={};for(var _0x307969 in fileOptions){if(fileOptions[_0x7932('0xc')](_0x307969)){_0x5dce5d[_0x307969]=fileOptions[_0x307969];}}if(_0x47c4ac){for(var _0x30a116 in _0x47c4ac){if(_0x47c4ac[_0x7932('0xc')](_0x30a116)){_0x5dce5d[_0x30a116]=_0x47c4ac[_0x30a116];}}}return _0x5dce5d;}exports['encryptFile']=function(_0x55eeeb,_0x1ec96a,_0x318af5,_0x37d749){return new BPromise(function(_0x53226e,_0x2445f1){_0x37d749=combineOptions(_0x37d749);var _0xf6b155=new Buffer(_0x318af5);var _0x532a1a=fs[_0x7932('0xd')](_0x55eeeb);var _0x4d78f9=fs[_0x7932('0xe')](_0x1ec96a);var _0x197832=crypto['createCipher'](_0x37d749[_0x7932('0x5')],_0xf6b155);_0x532a1a['on'](_0x7932('0xf'),function(_0x48bc9d){var _0x45b669=new Buffer(_0x197832[_0x7932('0x10')](_0x48bc9d),_0x7932('0x11'));_0x4d78f9[_0x7932('0x12')](_0x45b669);});_0x532a1a['on'](_0x7932('0x13'),function(){try{var _0x152b61=new Buffer(_0x197832[_0x7932('0x14')]('binary'),_0x7932('0x11'));_0x4d78f9[_0x7932('0x12')](_0x152b61);_0x4d78f9[_0x7932('0x13')]();_0x4d78f9['on'](_0x7932('0x15'),function(){return _0x53226e(_0x1ec96a);});}catch(_0x53b14a){fs[_0x7932('0x16')](_0x1ec96a);return _0x2445f1(_0x53b14a);}});});};exports['decryptFile']=function(_0x409968,_0x7cd705,_0x5bcad1,_0x440065){return new BPromise(function(_0x1f4c0f,_0x36d034){_0x440065=combineOptions(_0x440065);var _0x4522f4=new Buffer(_0x5bcad1);var _0x41e1b0=fs[_0x7932('0xd')](_0x409968);var _0x2705a2=fs[_0x7932('0xe')](_0x7cd705);var _0x1a7fe4=crypto[_0x7932('0x17')](_0x440065[_0x7932('0x5')],_0x4522f4);_0x41e1b0['on']('data',function(_0x231a42){var _0x8f9a0f=new Buffer(_0x1a7fe4[_0x7932('0x10')](_0x231a42),_0x7932('0x11'));_0x2705a2[_0x7932('0x12')](_0x8f9a0f);});_0x41e1b0['on'](_0x7932('0x13'),function(){try{var _0x89a21e=new Buffer(_0x1a7fe4[_0x7932('0x14')](_0x7932('0x11')),_0x7932('0x11'));_0x2705a2['write'](_0x89a21e);_0x2705a2[_0x7932('0x13')]();_0x2705a2['on'](_0x7932('0x15'),function(){return _0x1f4c0f(_0x7cd705);});}catch(_0xe65f32){fs['unlink'](_0x7cd705);return _0x36d034(_0xe65f32);}});});};exports[_0x7932('0x18')]=function(_0x51599a,_0xd2e73e,_0x510843){var _0x4cd7d7=_0x510843||stringOptions[_0x7932('0x5')];var _0x10d470=_0xd2e73e||stringOptions[_0x7932('0x19')];var _0x10fde6=crypto[_0x7932('0x1a')](_0x4cd7d7,_0x10d470);var _0x26c45a=_0x10fde6['update'](_0x51599a,_0x7932('0x1b'),'base64');_0x26c45a+=_0x10fde6['final'](_0x7932('0x1c'));return _0x26c45a;};exports[_0x7932('0x1d')]=function(_0x2e2b9f,_0x328abd,_0x4775d9){var _0x3764aa=_0x4775d9||stringOptions[_0x7932('0x5')];var _0x33e75c=_0x328abd||stringOptions[_0x7932('0x19')];var _0x24fae6=crypto[_0x7932('0x17')](_0x3764aa,_0x33e75c);var _0xf44cec=_0x24fae6[_0x7932('0x10')](_0x2e2b9f,_0x7932('0x1c'),_0x7932('0x1b'));_0xf44cec+=_0x24fae6[_0x7932('0x14')](_0x7932('0x1b'));return _0xf44cec;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 1d7bcb2..ef84812 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 _0xcea2=['finally','exit','util','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','splitSizeCsv','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','num','Empty','length','push','sequelize','SELECT','QueryTypes','dirname','basename','existsSync','join','each','%s%d.%s','csv','writeFileSync','%s.%s','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format'];(function(_0x2f23c3,_0x17259f){var _0x593147=function(_0x57d33){while(--_0x57d33){_0x2f23c3['push'](_0x2f23c3['shift']());}};_0x593147(++_0x17259f);}(_0xcea2,0x15a));var _0x2cea=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xcea2[_0x36eaaa];return _0x461349;};'use strict';var util=require(_0x2cea('0x0'));var path=require('path');var _=require(_0x2cea('0x1'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x2cea('0x2'));var zipdir=require(_0x2cea('0x3'));var rimraf=require(_0x2cea('0x4'));var db=require('../../mysqldb')['db'];var dbH=require(_0x2cea('0x5'))[_0x2cea('0x6')];var logger=require(_0x2cea('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x2cea('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x2cea('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xc04963,_0x805a1b){var _0x160cca={'status':_0xc04963};var _0x11c5c0={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x805a1b){_0x160cca[_0x2cea('0x9')]=_0x805a1b;}return db['AnalyticExtractedReport'][_0x2cea('0xa')](_0x160cca,_0x11c5c0);}function main(){var _0x42191a=0x1388;var _0x205a4e;logger[_0x2cea('0xb')](util[_0x2cea('0xc')](_0x2cea('0xd'),EXTRACTED_REPORT_ID,_0x2cea('0xe')));return db[_0x2cea('0xf')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x2cea('0x10')]})[_0x2cea('0x11')](function(_0x528c1d){if(_0x528c1d){_0x205a4e=_0x528c1d;_0x42191a=_0x205a4e['splitSizeCsv']||0x1388;}})[_0x2cea('0x11')](function(){return dbH['sequelize'][_0x2cea('0x12')](util[_0x2cea('0xc')](_0x2cea('0x13'),QUERY),{'type':dbH['sequelize']['QueryTypes']['SELECT']});})[_0x2cea('0x11')](function(_0x586ad5){if(!_0x586ad5[0x0][_0x2cea('0x14')]){return analyticExtractedReport(_0x2cea('0x15'));}var _0x981e3f=[];var _0x17322c=0x0;var _0x232dad=!![];if(_0x586ad5&&_0x586ad5[_0x2cea('0x16')]){var _0x3530d7=_0x586ad5[0x0][_0x2cea('0x14')]%(_0x17322c+_0x42191a);if(_0x205a4e['split']){for(;_0x232dad;_0x17322c+=_0x42191a,_0x3530d7=_0x586ad5[0x0][_0x2cea('0x14')]%(_0x17322c+_0x42191a)){if(_0x3530d7==0x0||_0x3530d7==_0x586ad5[0x0][_0x2cea('0x14')]){_0x232dad=![];}_0x981e3f[_0x2cea('0x17')](dbH[_0x2cea('0x18')][_0x2cea('0x12')](util[_0x2cea('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x42191a,_0x17322c),{'type':dbH[_0x2cea('0x18')]['QueryTypes'][_0x2cea('0x19')]}));}}else{_0x981e3f[_0x2cea('0x17')](dbH[_0x2cea('0x18')]['query'](QUERY,{'type':dbH[_0x2cea('0x18')][_0x2cea('0x1a')][_0x2cea('0x19')]}));}}var _0x1b389b=path[_0x2cea('0x1b')](PATH);var _0x3f6f0e=path[_0x2cea('0x1c')](PATH,'.csv');var _0x443f5d=_0x205a4e['split']&&_0x981e3f[_0x2cea('0x16')]>0x1;var _0x4926ff=[];if(!fs[_0x2cea('0x1d')](path[_0x2cea('0x1e')](_0x1b389b,_0x3f6f0e))&&_0x443f5d){fs['mkdirSync'](path[_0x2cea('0x1e')](_0x1b389b,_0x3f6f0e));}return BPromise[_0x2cea('0x1f')](_0x981e3f,function(_0x101314){_0x4926ff[_0x2cea('0x17')](_0x101314);})[_0x2cea('0x11')](function(){for(var _0x79529b=0x0;_0x79529b<_0x4926ff['length'];_0x79529b+=0x1){var _0x4ec9b3;var _0x32b6a3=_0x4926ff[_0x79529b];if(_0x443f5d){_0x4ec9b3=path[_0x2cea('0x1e')](_0x1b389b,_0x3f6f0e,util[_0x2cea('0xc')](_0x2cea('0x20'),_0x3f6f0e,_0x79529b,_0x2cea('0x21')));}else{_0x4ec9b3=path[_0x2cea('0x1e')](_0x1b389b,util[_0x2cea('0xc')]('%s.%s',_0x3f6f0e,_0x2cea('0x21')));}fs[_0x2cea('0x22')](_0x4ec9b3,csv(_0x32b6a3));}})['then'](function(){if(_0x443f5d){zipdir(path[_0x2cea('0x1e')](_0x1b389b,_0x3f6f0e),{'saveTo':path[_0x2cea('0x1e')](_0x1b389b,util[_0x2cea('0xc')](_0x2cea('0x23'),_0x3f6f0e,'zip'))},function(_0x3c0066,_0x128934){});rimraf(path['join'](_0x1b389b,_0x3f6f0e),function(){});}})[_0x2cea('0x11')](function(){logger[_0x2cea('0xb')](util[_0x2cea('0xc')](_0x2cea('0x24'),EXTRACTED_REPORT_ID,_0x2cea('0xe')));return analyticExtractedReport(_0x2cea('0x25'),_0x443f5d?util[_0x2cea('0xc')](_0x2cea('0x23'),_0x3f6f0e,_0x443f5d?_0x2cea('0x26'):_0x2cea('0x21')):null);});})[_0x2cea('0x27')](function(_0x47ea58){logger[_0x2cea('0xb')](util[_0x2cea('0xc')](_0x2cea('0x28'),EXTRACTED_REPORT_ID,_0x2cea('0xe')),util['inspect'](_0x47ea58,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x2cea('0x29')](function(){process[_0x2cea('0x2a')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xf403=['../../mysqldb','dbH','argv','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','split','splitSizeCsv','then','sequelize','query','QueryTypes','SELECT','Empty','num','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','existsSync','join','length','%s%d.%s','%s.%s','writeFileSync','zip','info','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','lodash','to-csv','bluebird','zip-dir','rimraf'];(function(_0x5e662d,_0x3e6d57){var _0x4d2f92=function(_0x5c8ec1){while(--_0x5c8ec1){_0x5e662d['push'](_0x5e662d['shift']());}};_0x4d2f92(++_0x3e6d57);}(_0xf403,0x1d3));var _0x3f40=function(_0x2cc484,_0x1562d7){_0x2cc484=_0x2cc484-0x0;var _0x1ad0f8=_0xf403[_0x2cc484];return _0x1ad0f8;};'use strict';var util=require(_0x3f40('0x0'));var path=require('path');var _=require(_0x3f40('0x1'));var csv=require(_0x3f40('0x2'));var fs=require('fs');var BPromise=require(_0x3f40('0x3'));var zipdir=require(_0x3f40('0x4'));var rimraf=require(_0x3f40('0x5'));var db=require(_0x3f40('0x6'))['db'];var dbH=require(_0x3f40('0x6'))[_0x3f40('0x7')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x3f40('0x8')][0x2]);var QUERY=process[_0x3f40('0x8')][0x3];var PATH=process[_0x3f40('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1f21fa,_0x5878f9){var _0x1dffe8={'status':_0x1f21fa};var _0x4c1694={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5878f9){_0x1dffe8['savename']=_0x5878f9;}return db[_0x3f40('0x9')][_0x3f40('0xa')](_0x1dffe8,_0x4c1694);}function main(){var _0x40d198=0x1388;var _0x5bf41d;logger['info'](util[_0x3f40('0xb')](_0x3f40('0xc'),EXTRACTED_REPORT_ID,_0x3f40('0xd')));return db['Setting'][_0x3f40('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x3f40('0xf'),_0x3f40('0x10')]})['then'](function(_0x332635){if(_0x332635){_0x5bf41d=_0x332635;_0x40d198=_0x5bf41d['splitSizeCsv']||0x1388;}})[_0x3f40('0x11')](function(){return dbH[_0x3f40('0x12')][_0x3f40('0x13')](util[_0x3f40('0xb')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x3f40('0x12')][_0x3f40('0x14')][_0x3f40('0x15')]});})[_0x3f40('0x11')](function(_0x232241){if(!_0x232241[0x0]['num']){return analyticExtractedReport(_0x3f40('0x16'));}var _0x3d11c9=[];var _0x535f85=0x0;var _0x4ef80e=!![];if(_0x232241&&_0x232241['length']){var _0x206630=_0x232241[0x0][_0x3f40('0x17')]%(_0x535f85+_0x40d198);if(_0x5bf41d[_0x3f40('0xf')]){for(;_0x4ef80e;_0x535f85+=_0x40d198,_0x206630=_0x232241[0x0][_0x3f40('0x17')]%(_0x535f85+_0x40d198)){if(_0x206630==0x0||_0x206630==_0x232241[0x0][_0x3f40('0x17')]){_0x4ef80e=![];}_0x3d11c9['push'](dbH[_0x3f40('0x12')][_0x3f40('0x13')](util[_0x3f40('0xb')](_0x3f40('0x18'),QUERY,_0x40d198,_0x535f85),{'type':dbH[_0x3f40('0x12')]['QueryTypes'][_0x3f40('0x15')]}));}}else{_0x3d11c9['push'](dbH[_0x3f40('0x12')][_0x3f40('0x13')](QUERY,{'type':dbH[_0x3f40('0x12')][_0x3f40('0x14')][_0x3f40('0x15')]}));}}var _0x4aa559=path[_0x3f40('0x19')](PATH);var _0x379b4e=path[_0x3f40('0x1a')](PATH,_0x3f40('0x1b'));var _0x258de9=_0x5bf41d[_0x3f40('0xf')]&&_0x3d11c9['length']>0x1;var _0x31fc91=[];if(!fs[_0x3f40('0x1c')](path[_0x3f40('0x1d')](_0x4aa559,_0x379b4e))&&_0x258de9){fs['mkdirSync'](path[_0x3f40('0x1d')](_0x4aa559,_0x379b4e));}return BPromise['each'](_0x3d11c9,function(_0x37b47e){_0x31fc91['push'](_0x37b47e);})['then'](function(){for(var _0x4b0ade=0x0;_0x4b0ade<_0x31fc91[_0x3f40('0x1e')];_0x4b0ade+=0x1){var _0x26e46b;var _0x140044=_0x31fc91[_0x4b0ade];if(_0x258de9){_0x26e46b=path[_0x3f40('0x1d')](_0x4aa559,_0x379b4e,util['format'](_0x3f40('0x1f'),_0x379b4e,_0x4b0ade,'csv'));}else{_0x26e46b=path[_0x3f40('0x1d')](_0x4aa559,util[_0x3f40('0xb')](_0x3f40('0x20'),_0x379b4e,'csv'));}fs[_0x3f40('0x21')](_0x26e46b,csv(_0x140044));}})['then'](function(){if(_0x258de9){zipdir(path[_0x3f40('0x1d')](_0x4aa559,_0x379b4e),{'saveTo':path['join'](_0x4aa559,util['format'](_0x3f40('0x20'),_0x379b4e,_0x3f40('0x22')))},function(_0x14fdfd,_0xb23186){});rimraf(path[_0x3f40('0x1d')](_0x4aa559,_0x379b4e),function(){});}})[_0x3f40('0x11')](function(){logger[_0x3f40('0x23')](util[_0x3f40('0xb')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x3f40('0xd')));return analyticExtractedReport(_0x3f40('0x24'),_0x258de9?util[_0x3f40('0xb')](_0x3f40('0x20'),_0x379b4e,_0x258de9?_0x3f40('0x22'):'csv'):null);});})[_0x3f40('0x25')](function(_0x86d9cb){logger[_0x3f40('0x23')](util['format'](_0x3f40('0x26'),EXTRACTED_REPORT_ID,_0x3f40('0xd')),util[_0x3f40('0x27')](_0x86d9cb,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x3f40('0x28'));})[_0x3f40('0x29')](function(){process[_0x3f40('0x2a')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index a20ecb3..6a52e14 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 _0x20d5=['AnalyticExtractedReport','update','map','pick','toString','value','fill','length','auto','body','concat','chunk','keys','forEach','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','format','push','header','pageBreak','before','landscape','\x20/\x20','footer','Arial','right','num','dirname','basename','.pdf','join','pdf','Setting','find','split','splitSizePdf','then','sequelize','query','QueryTypes','SELECT','existsSync','mkdirSync','all','flatten','%s%d.%s','%s.%s','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','zip','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','createPdfFromHTML','createPdfKitDocument','path','lodash','util','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','window','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a'];(function(_0x27f2d2,_0x29cb8c){var _0x88abea=function(_0x311ac2){while(--_0x311ac2){_0x27f2d2['push'](_0x27f2d2['shift']());}};_0x88abea(++_0x29cb8c);}(_0x20d5,0x162));var _0x520d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x20d5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x520d('0x0'));var fs=require('fs');var util=require(_0x520d('0x1'));var path=require('path');var moment=require(_0x520d('0x2'));var htmlToPdfmake=require(_0x520d('0x3'));var PdfPrinter=require(_0x520d('0x4'));var zipdir=require(_0x520d('0x5'));var rimraf=require(_0x520d('0x6'));var JSDOM=require(_0x520d('0x7'))['JSDOM'];var window=new JSDOM('')[_0x520d('0x8')];var db=require(_0x520d('0x9'))['db'];var dbH=require(_0x520d('0x9'))[_0x520d('0xa')];var logger=require(_0x520d('0xb'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x520d('0xc')][0x2]);var QUERY=process[_0x520d('0xc')][0x3];var PATH=process[_0x520d('0xc')][0x4];var NAME=process[_0x520d('0xc')][0x5];var FORMAT=_0x520d('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x549dcc,_0x269d71){var _0x4843e2={'status':_0x549dcc};var _0x3cb7b2={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x269d71){_0x4843e2['savename']=_0x269d71;}return db[_0x520d('0xe')][_0x520d('0xf')](_0x4843e2,_0x3cb7b2);}function getHeaders(_0x177a90){return _[_0x520d('0x10')](_0x177a90,function(_0x340d7a){return{'text':_0x340d7a,'style':'tableHeader'};});}function getRows(_0x3f5c55,_0x5f0ad2){return _[_0x520d('0x10')](_0x5f0ad2,function(_0x5d0fa4){return _(_0x5d0fa4)[_0x520d('0x11')](_0x3f5c55)['map'](function(_0x1d1f5d){return _0x1d1f5d?_[_0x520d('0x12')](_0x1d1f5d):'';})[_0x520d('0x13')]();});}function createTable(_0x4f456f,_0x51e6a9){var _0xfc4148={'widths':_[_0x520d('0x14')](Array(_0x4f456f[_0x520d('0x15')]),0x91),'heights':function(_0x13fd62){return _0x13fd62===0x0?_0x520d('0x16'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x58bf8e=getHeaders(_0x4f456f);_0xfc4148[_0x520d('0x17')]['push'](_0x58bf8e);var _0x32c3ad=getRows(_0x4f456f,_0x51e6a9);_0xfc4148[_0x520d('0x17')]=_0xfc4148['body'][_0x520d('0x18')](_0x32c3ad);return _0xfc4148;}function createTables(_0x190dce){var _0x3bf705=[];var _0x30236c=_[_0x520d('0x19')](Object[_0x520d('0x1a')](_0x190dce[0x0]),0x5);_0x30236c[_0x520d('0x1b')](function(_0x5bd669){_0x3bf705['push'](createTable(_0x5bd669,_0x190dce));});return _0x3bf705;}function getPDFDocDefinition(_0x45d696){var _0x9aebe0=util['format'](_0x520d('0x1c'),NAME,EXTRACTED_REPORT[_0x520d('0x1d')],moment(EXTRACTED_REPORT[_0x520d('0x1e')])[_0x520d('0x1f')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x520d('0x1f')](FORMAT));var _0x3fa0b6=[];for(var _0x25dd49=0x0;_0x25dd49<_0x45d696[_0x520d('0x15')];_0x25dd49++){var _0x48cdcf=[];if(_0x25dd49===0x0){_0x48cdcf[_0x520d('0x20')]({'text':_0x9aebe0,'style':_0x520d('0x21')});}var _0x11600c={'table':_0x45d696[_0x25dd49]};if(_0x25dd49>0x0){_0x11600c[_0x520d('0x22')]=_0x520d('0x23');_0x11600c['margin']=[0x0,0x46,0x0,0x0];}_0x48cdcf['push'](_0x11600c);_0x3fa0b6['push'](_0x48cdcf);}return{'pageSize':'A4','pageOrientation':_0x520d('0x24'),'content':_0x3fa0b6,'footer':function(_0x9d5e43,_0x2d6544){return{'text':_0x9d5e43[_0x520d('0x12')]()+_0x520d('0x25')+_0x2d6544,'style':_0x520d('0x26')};},'defaultStyle':{'font':_0x520d('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0x520d('0x28'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x35fe26){var _0x233fc7=0x1388;var _0x28c342;if(!_0x35fe26[0x0][_0x520d('0x29')]){return analyticExtractedReport('Empty');}var _0x2ffe35=[];var _0x337fde=0x0;var _0x4a293d=!![];var _0x41e417=path[_0x520d('0x2a')](PATH);var _0x41872c=path[_0x520d('0x2b')](PATH,_0x520d('0x2c'));var _0x30513e=path[_0x520d('0x2d')](_0x41e417,util[_0x520d('0x1f')]('%s.%s',_0x41872c,_0x520d('0x2e')));var _0x1f4892=![];return db[_0x520d('0x2f')][_0x520d('0x30')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x520d('0x31'),_0x520d('0x32')]})[_0x520d('0x33')](function(_0x3a73a3){if(_0x3a73a3){_0x28c342=_0x3a73a3;_0x233fc7=_0x28c342[_0x520d('0x32')]||0x3e8;}})[_0x520d('0x33')](function(){if(_0x35fe26&&_0x35fe26[_0x520d('0x15')]){var _0x1f1991=_0x35fe26[0x0][_0x520d('0x29')]%(_0x337fde+_0x233fc7);if(_0x28c342[_0x520d('0x31')]){for(;_0x4a293d;_0x337fde+=_0x233fc7,_0x1f1991=_0x35fe26[0x0][_0x520d('0x29')]%(_0x337fde+_0x233fc7)){if(_0x1f1991==0x0||_0x1f1991==_0x35fe26[0x0][_0x520d('0x29')]){_0x4a293d=![];}_0x2ffe35[_0x520d('0x20')](dbH[_0x520d('0x34')][_0x520d('0x35')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x233fc7,_0x337fde),{'type':dbH['sequelize'][_0x520d('0x36')][_0x520d('0x37')]}));}}else{_0x2ffe35[_0x520d('0x20')](dbH[_0x520d('0x34')][_0x520d('0x35')](QUERY,{'type':dbH[_0x520d('0x34')]['QueryTypes'][_0x520d('0x37')]}));}}_0x1f4892=_0x28c342[_0x520d('0x31')]&&_0x2ffe35[_0x520d('0x15')]>0x1;if(!fs[_0x520d('0x38')](path[_0x520d('0x2d')](_0x41e417,_0x41872c))&&_0x1f4892){fs[_0x520d('0x39')](path[_0x520d('0x2d')](_0x41e417,_0x41872c));}return Promise[_0x520d('0x3a')](_0x2ffe35);})[_0x520d('0x33')](function(_0x37900c){return createTables(_[_0x520d('0x3b')](_0x37900c));})[_0x520d('0x33')](function(_0x3fa7b3){var _0x376ada=getPDFDocDefinition(_0x3fa7b3);var _0x570096=getPDFPrinter();var _0x29772a=_0x570096['createPdfKitDocument'](_0x376ada);if(_0x1f4892)_0x30513e=path[_0x520d('0x2d')](_0x41e417,_0x41872c,util[_0x520d('0x1f')](_0x520d('0x3c'),_0x41872c,index,_0x520d('0x2e')));return writePDFDocument(_0x29772a,_0x30513e);})[_0x520d('0x33')](function(){if(!_0x1f4892)return;zipdir(path[_0x520d('0x2d')](_0x41e417,_0x41872c),{'saveTo':path[_0x520d('0x2d')](_0x41e417,util['format'](_0x520d('0x3d'),_0x41872c,'zip'))},function(_0x5051eb){if(_0x5051eb)throw _0x5051eb;return;});})[_0x520d('0x33')](function(){if(!_0x1f4892)return;rimraf(path['join'](_0x41e417,_0x41872c),function(){});})[_0x520d('0x33')](function(){logger[_0x520d('0x3e')](util[_0x520d('0x1f')](_0x520d('0x3f'),EXTRACTED_REPORT_ID,_0x520d('0x40')));return analyticExtractedReport(_0x520d('0x41'),_0x1f4892?util['format'](_0x520d('0x3d'),_0x41872c,_0x1f4892?_0x520d('0x42'):_0x520d('0x2e')):null);});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x520d('0x3e')](util[_0x520d('0x1f')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x520d('0x43')));return db['AnalyticExtractedReport'][_0x520d('0x44')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x520d('0x33')](function(_0x1a0cf0){EXTRACTED_REPORT=_0x1a0cf0;return dbH[_0x520d('0x34')]['query'](util[_0x520d('0x1f')](_0x520d('0x45'),QUERY),{'type':dbH[_0x520d('0x34')]['QueryTypes'][_0x520d('0x37')]});})[_0x520d('0x33')](extractReport)[_0x520d('0x46')](function(_0x8cfb7b){logger[_0x520d('0x3e')](util[_0x520d('0x1f')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'PDF'),util[_0x520d('0x47')](_0x8cfb7b,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x520d('0x48'));})[_0x520d('0x49')](function(){process[_0x520d('0x4a')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x5af7d8=new PdfPrinter({'Arial':{'normal':__dirname+_0x520d('0x4b'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x520d('0x4c'),'bolditalics':__dirname+_0x520d('0x4d')}});return _0x5af7d8;}function getPDFDocDefinitionFromHTML(_0x35e0f1,_0x1c83b7){var _0x181e9f=util['format'](_0x520d('0x4e'),_0x1c83b7[_0x520d('0x4f')],_0x1c83b7['interactionId']);var _0x327591=moment()['format'](_0x520d('0x50'))[_0x520d('0x12')]();var _0x497460=htmlToPdfmake(_0x35e0f1,{'window':window,'tableAutoSize':!![]});return{'content':[_0x497460],'defaultStyle':{'font':_0x520d('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x520d('0x51'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0x520d('0x52'),'style':_0x520d('0x21')}];},'footer':function(_0x3fbed7,_0x29c01c){return[{'text':util['format'](_0x520d('0x53'),_0x181e9f,_0x3fbed7,_0x29c01c,_0x327591),'style':'footer'}];}};}function writePDFDocument(_0x1ce463,_0x430cef){return new Promise(function(_0x390781,_0x23ffd4){var _0x160dd9=_0x1ce463[_0x520d('0x54')](fs[_0x520d('0x55')](_0x430cef));_0x160dd9['on'](_0x520d('0x56'),function(){_0x390781('finish');});_0x160dd9['on'](_0x520d('0x57'),function(_0xb0d222){_0x23ffd4(_0xb0d222);});_0x1ce463[_0x520d('0x58')]();});}exports[_0x520d('0x59')]=function(_0x1d2d10,_0x586260){var _0x529608=getPDFPrinter();var _0x254ddd=getPDFDocDefinitionFromHTML(_0x1d2d10,_0x586260);var _0x57db96=_0x529608[_0x520d('0x5a')](_0x254ddd);return writePDFDocument(_0x57db96,_0x586260[_0x520d('0x5b')])['catch'](function(_0x5d32d2){throw _0x5d32d2;});}; \ No newline at end of file +var _0x36a2=['\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','createWriteStream','finish','end','createPdfFromHTML','lodash','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','jsdom','JSDOM','../../mysqldb','dbH','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','pick','toString','fill','length','auto','body','push','chunk','keys','forEach','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','format','header','pageBreak','margin','landscape','\x20/\x20','black','num','Empty','basename','.pdf','join','pdf','Setting','split','splitSizePdf','then','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','existsSync','all','createPdfKitDocument','%s%d.%s','%s.%s','zip','CSV','Completed','PDF','findOne','sequelize','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','channel','YYYY-MM-DD','Arial','center','Interaction\x20Transcript'];(function(_0x757e3a,_0x416444){var _0x26a535=function(_0xb1644f){while(--_0xb1644f){_0x757e3a['push'](_0x757e3a['shift']());}};_0x26a535(++_0x416444);}(_0x36a2,0xa6));var _0x236a=function(_0x17dcd1,_0x3b7ccb){_0x17dcd1=_0x17dcd1-0x0;var _0x12af77=_0x36a2[_0x17dcd1];return _0x12af77;};'use strict';var _=require(_0x236a('0x0'));var fs=require('fs');var util=require('util');var path=require(_0x236a('0x1'));var moment=require(_0x236a('0x2'));var htmlToPdfmake=require(_0x236a('0x3'));var PdfPrinter=require(_0x236a('0x4'));var zipdir=require(_0x236a('0x5'));var rimraf=require('rimraf');var JSDOM=require(_0x236a('0x6'))[_0x236a('0x7')];var window=new JSDOM('')['window'];var db=require(_0x236a('0x8'))['db'];var dbH=require(_0x236a('0x8'))[_0x236a('0x9')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x236a('0xa')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x236a('0xa')][0x5];var FORMAT=_0x236a('0xb');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x11df58,_0x953cf2){var _0xe87f04={'status':_0x11df58};var _0x7d85fb={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x953cf2){_0xe87f04[_0x236a('0xc')]=_0x953cf2;}return db[_0x236a('0xd')][_0x236a('0xe')](_0xe87f04,_0x7d85fb);}function getHeaders(_0x3cb6c3){return _[_0x236a('0xf')](_0x3cb6c3,function(_0x3c36a5){return{'text':_0x3c36a5,'style':'tableHeader'};});}function getRows(_0xe54e47,_0x2915fd){return _[_0x236a('0xf')](_0x2915fd,function(_0x42719b){return _(_0x42719b)[_0x236a('0x10')](_0xe54e47)[_0x236a('0xf')](function(_0x5f2b84){return _0x5f2b84?_[_0x236a('0x11')](_0x5f2b84):'';})['value']();});}function createTable(_0x13b581,_0x3afdae){var _0x136aba={'widths':_[_0x236a('0x12')](Array(_0x13b581[_0x236a('0x13')]),0x91),'heights':function(_0x40ccbe){return _0x40ccbe===0x0?_0x236a('0x14'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x457c09=getHeaders(_0x13b581);_0x136aba[_0x236a('0x15')][_0x236a('0x16')](_0x457c09);var _0x8c331f=getRows(_0x13b581,_0x3afdae);_0x136aba[_0x236a('0x15')]=_0x136aba[_0x236a('0x15')]['concat'](_0x8c331f);return _0x136aba;}function createTables(_0x37aab0){var _0x39280b=[];var _0x2e1aab=_[_0x236a('0x17')](Object[_0x236a('0x18')](_0x37aab0[0x0]),0x5);_0x2e1aab[_0x236a('0x19')](function(_0x33a5ad){_0x39280b[_0x236a('0x16')](createTable(_0x33a5ad,_0x37aab0));});return _0x39280b;}function getPDFDocDefinition(_0x43f161){var _0x3ad797=util['format'](_0x236a('0x1a'),NAME,EXTRACTED_REPORT[_0x236a('0x1b')],moment(EXTRACTED_REPORT[_0x236a('0x1c')])[_0x236a('0x1d')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x236a('0x1d')](FORMAT));var _0x5baeaa=[];for(var _0x3db00e=0x0;_0x3db00e<_0x43f161[_0x236a('0x13')];_0x3db00e++){var _0xfe069f=[];if(_0x3db00e===0x0){_0xfe069f[_0x236a('0x16')]({'text':_0x3ad797,'style':_0x236a('0x1e')});}var _0x4f32e9={'table':_0x43f161[_0x3db00e]};if(_0x3db00e>0x0){_0x4f32e9[_0x236a('0x1f')]='before';_0x4f32e9[_0x236a('0x20')]=[0x0,0x46,0x0,0x0];}_0xfe069f[_0x236a('0x16')](_0x4f32e9);_0x5baeaa[_0x236a('0x16')](_0xfe069f);}return{'pageSize':'A4','pageOrientation':_0x236a('0x21'),'content':_0x5baeaa,'footer':function(_0x5bb461,_0x306303){return{'text':_0x5bb461[_0x236a('0x11')]()+_0x236a('0x22')+_0x306303,'style':'footer'};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x236a('0x23')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x1a1f3d){var _0x26cc35=0x1388;var _0x463b93;if(!_0x1a1f3d[0x0][_0x236a('0x24')]){return analyticExtractedReport(_0x236a('0x25'));}var _0x45c779=[];var _0x1d3c0c=0x0;var _0x5952df=!![];var _0x84c5a6=path['dirname'](PATH);var _0x55d101=path[_0x236a('0x26')](PATH,_0x236a('0x27'));var _0x471381=path[_0x236a('0x28')](_0x84c5a6,util[_0x236a('0x1d')]('%s.%s',_0x55d101,_0x236a('0x29')));var _0x1caba8=![];return db[_0x236a('0x2a')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x236a('0x2b'),_0x236a('0x2c')]})[_0x236a('0x2d')](function(_0xc212d4){if(_0xc212d4){_0x463b93=_0xc212d4;_0x26cc35=_0x463b93[_0x236a('0x2c')]||0x3e8;}})[_0x236a('0x2d')](function(){if(_0x1a1f3d&&_0x1a1f3d['length']){var _0x4c135d=_0x1a1f3d[0x0][_0x236a('0x24')]%(_0x1d3c0c+_0x26cc35);if(_0x463b93[_0x236a('0x2b')]){for(;_0x5952df;_0x1d3c0c+=_0x26cc35,_0x4c135d=_0x1a1f3d[0x0][_0x236a('0x24')]%(_0x1d3c0c+_0x26cc35)){if(_0x4c135d==0x0||_0x4c135d==_0x1a1f3d[0x0]['num']){_0x5952df=![];}_0x45c779[_0x236a('0x16')](dbH['sequelize'][_0x236a('0x2e')](util['format'](_0x236a('0x2f'),QUERY,_0x26cc35,_0x1d3c0c),{'type':dbH['sequelize'][_0x236a('0x30')]['SELECT']}));}}else{_0x45c779[_0x236a('0x16')](dbH['sequelize'][_0x236a('0x2e')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0x236a('0x31')]}));}}_0x1caba8=_0x463b93[_0x236a('0x2b')]&&_0x45c779['length']>0x1;if(!fs[_0x236a('0x32')](path[_0x236a('0x28')](_0x84c5a6,_0x55d101))&&_0x1caba8){fs['mkdirSync'](path['join'](_0x84c5a6,_0x55d101));}return Promise[_0x236a('0x33')](_0x45c779);})['then'](function(_0x5ec8a6){return createTables(_['flatten'](_0x5ec8a6));})['then'](function(_0x512333){var _0x50d6e1=getPDFDocDefinition(_0x512333);var _0x4c24d2=getPDFPrinter();var _0x3abe76=_0x4c24d2[_0x236a('0x34')](_0x50d6e1);if(_0x1caba8)_0x471381=path[_0x236a('0x28')](_0x84c5a6,_0x55d101,util[_0x236a('0x1d')](_0x236a('0x35'),_0x55d101,index,_0x236a('0x29')));return writePDFDocument(_0x3abe76,_0x471381);})[_0x236a('0x2d')](function(){if(!_0x1caba8)return;zipdir(path[_0x236a('0x28')](_0x84c5a6,_0x55d101),{'saveTo':path[_0x236a('0x28')](_0x84c5a6,util[_0x236a('0x1d')](_0x236a('0x36'),_0x55d101,_0x236a('0x37')))},function(_0x141412){if(_0x141412)throw _0x141412;return;});})['then'](function(){if(!_0x1caba8)return;rimraf(path[_0x236a('0x28')](_0x84c5a6,_0x55d101),function(){});})[_0x236a('0x2d')](function(){logger['info'](util[_0x236a('0x1d')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x236a('0x38')));return analyticExtractedReport(_0x236a('0x39'),_0x1caba8?util[_0x236a('0x1d')](_0x236a('0x36'),_0x55d101,_0x1caba8?_0x236a('0x37'):'pdf'):null);});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x236a('0x3a')));return db[_0x236a('0xd')][_0x236a('0x3b')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x236a('0x2d')](function(_0x321c4f){EXTRACTED_REPORT=_0x321c4f;return dbH[_0x236a('0x3c')][_0x236a('0x2e')](util[_0x236a('0x1d')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x236a('0x3c')][_0x236a('0x30')][_0x236a('0x31')]});})[_0x236a('0x2d')](extractReport)[_0x236a('0x3d')](function(_0x44293a){logger['info'](util[_0x236a('0x1d')](_0x236a('0x3e'),EXTRACTED_REPORT_ID,_0x236a('0x3a')),util[_0x236a('0x3f')](_0x44293a,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x236a('0x40'));})[_0x236a('0x41')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x445f38=new PdfPrinter({'Arial':{'normal':__dirname+_0x236a('0x42'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x236a('0x43'),'bolditalics':__dirname+_0x236a('0x44')}});return _0x445f38;}function getPDFDocDefinitionFromHTML(_0x31d093,_0x1af904){var _0x18554e=util[_0x236a('0x1d')]('%s\x20#%d',_0x1af904[_0x236a('0x45')],_0x1af904['interactionId']);var _0x565956=moment()[_0x236a('0x1d')](_0x236a('0x46'))[_0x236a('0x11')]();var _0x58ac22=htmlToPdfmake(_0x31d093,{'window':window,'tableAutoSize':!![]});return{'content':[_0x58ac22],'defaultStyle':{'font':_0x236a('0x47')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x236a('0x48'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x236a('0x48'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0x236a('0x49'),'style':_0x236a('0x1e')}];},'footer':function(_0x1aafd9,_0x4073b7){return[{'text':util['format'](_0x236a('0x4a'),_0x18554e,_0x1aafd9,_0x4073b7,_0x565956),'style':_0x236a('0x4b')}];}};}function writePDFDocument(_0x4990d5,_0x57dfe6){return new Promise(function(_0x4869d9,_0x2a2bb1){var _0x36ff54=_0x4990d5['pipe'](fs[_0x236a('0x4c')](_0x57dfe6));_0x36ff54['on']('finish',function(){_0x4869d9(_0x236a('0x4d'));});_0x36ff54['on']('error',function(_0xd21393){_0x2a2bb1(_0xd21393);});_0x4990d5[_0x236a('0x4e')]();});}exports[_0x236a('0x4f')]=function(_0x53c095,_0x76289f){var _0x336146=getPDFPrinter();var _0x311659=getPDFDocDefinitionFromHTML(_0x53c095,_0x76289f);var _0x454bed=_0x336146['createPdfKitDocument'](_0x311659);return writePDFDocument(_0x454bed,_0x76289f[_0x236a('0x1')])[_0x236a('0x3d')](function(_0x4ada17){throw _0x4ada17;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 074ac5e..0cf8fb2 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 _0xcc2e=['writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','.xlsx','existsSync','mkdirSync','join','each','%s%d.%s','xlsx','%s.%s'];(function(_0x41daf6,_0x3459d7){var _0x5168b4=function(_0x10adb0){while(--_0x10adb0){_0x41daf6['push'](_0x41daf6['shift']());}};_0x5168b4(++_0x3459d7);}(_0xcc2e,0x65));var _0xecc2=function(_0x49f3bd,_0x29343b){_0x49f3bd=_0x49f3bd-0x0;var _0x4e5341=_0xcc2e[_0x49f3bd];return _0x4e5341;};'use strict';var util=require('util');var path=require('path');var _=require(_0xecc2('0x0'));var fs=require('fs');var json2xls=require(_0xecc2('0x1'));var BPromise=require(_0xecc2('0x2'));var zipdir=require(_0xecc2('0x3'));var rimraf=require(_0xecc2('0x4'));var db=require(_0xecc2('0x5'))['db'];var dbH=require(_0xecc2('0x5'))[_0xecc2('0x6')];var logger=require('../../config/logger')(_0xecc2('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xecc2('0x8')][0x2]);var QUERY=process[_0xecc2('0x8')][0x3];var PATH=process[_0xecc2('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x38c8f4,_0x2f1a64){var _0x51df04={'status':_0x38c8f4};var _0x570971={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2f1a64){_0x51df04['savename']=_0x2f1a64;}return db['AnalyticExtractedReport'][_0xecc2('0x9')](_0x51df04,_0x570971);}function main(){var _0x2b220d=0x1388;var _0x16c203;logger[_0xecc2('0xa')](util[_0xecc2('0xb')](_0xecc2('0xc'),EXTRACTED_REPORT_ID,_0xecc2('0xd')));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xecc2('0xe'),_0xecc2('0xf')]})[_0xecc2('0x10')](function(_0x3802e3){if(_0x3802e3){_0x16c203=_0x3802e3;_0x2b220d=_0x16c203[_0xecc2('0xf')]||0x1388;}})['then'](function(){return dbH[_0xecc2('0x11')][_0xecc2('0x12')](util[_0xecc2('0xb')](_0xecc2('0x13'),QUERY),{'type':dbH[_0xecc2('0x11')]['QueryTypes'][_0xecc2('0x14')]});})[_0xecc2('0x10')](function(_0x1167fd){if(!_0x1167fd[0x0][_0xecc2('0x15')]){return analyticExtractedReport(_0xecc2('0x16'));}var _0xc5364=[];var _0x35b462=0x0;var _0x1f14b7=!![];if(_0x16c203['split']){if(_0x1167fd&&_0x1167fd[_0xecc2('0x17')]){var _0x19b365=_0x1167fd[0x0][_0xecc2('0x15')]%(_0x35b462+_0x2b220d);for(;_0x1f14b7;_0x35b462+=_0x2b220d,_0x19b365=_0x1167fd[0x0][_0xecc2('0x15')]%(_0x35b462+_0x2b220d)){if(_0x19b365==0x0||_0x19b365==_0x1167fd[0x0][_0xecc2('0x15')]){_0x1f14b7=![];}_0xc5364[_0xecc2('0x18')](dbH[_0xecc2('0x11')]['query'](util[_0xecc2('0xb')](_0xecc2('0x19'),QUERY,_0x2b220d,_0x35b462),{'type':dbH[_0xecc2('0x11')][_0xecc2('0x1a')][_0xecc2('0x14')]}));}}}else{_0xc5364[_0xecc2('0x18')](dbH[_0xecc2('0x11')]['query'](QUERY,{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}var _0x4a19d0=path[_0xecc2('0x1b')](PATH);var _0x128bbe=path[_0xecc2('0x1c')](PATH,_0xecc2('0x1d'));var _0x578017=_0x16c203[_0xecc2('0xe')]&&_0xc5364[_0xecc2('0x17')]>0x1;var _0x38243a=[];if(!fs[_0xecc2('0x1e')](path['join'](_0x4a19d0,_0x128bbe))&&_0x578017){fs[_0xecc2('0x1f')](path[_0xecc2('0x20')](_0x4a19d0,_0x128bbe));}return BPromise[_0xecc2('0x21')](_0xc5364,function(_0xa09448){_0x38243a[_0xecc2('0x18')](_0xa09448);})[_0xecc2('0x10')](function(){for(var _0x143a62=0x0;_0x143a62<_0x38243a[_0xecc2('0x17')];_0x143a62+=0x1){var _0x175df4;var _0x1ecda3=_0x38243a[_0x143a62];if(_0x578017){_0x175df4=path['join'](_0x4a19d0,_0x128bbe,util[_0xecc2('0xb')](_0xecc2('0x22'),_0x128bbe,_0x143a62,_0xecc2('0x23')));}else{_0x175df4=path[_0xecc2('0x20')](_0x4a19d0,util['format'](_0xecc2('0x24'),_0x128bbe,'xlsx'));}fs[_0xecc2('0x25')](_0x175df4,json2xls(_0x1ecda3),_0xecc2('0x26'));}})[_0xecc2('0x10')](function(){if(_0x578017){zipdir(path[_0xecc2('0x20')](_0x4a19d0,_0x128bbe),{'saveTo':path[_0xecc2('0x20')](_0x4a19d0,util[_0xecc2('0xb')]('%s.%s',_0x128bbe,_0xecc2('0x27')))},function(_0x4462f3,_0x127bda){});rimraf(path[_0xecc2('0x20')](_0x4a19d0,_0x128bbe),function(){});}})['then'](function(){logger[_0xecc2('0xa')](util['format'](_0xecc2('0x28'),EXTRACTED_REPORT_ID,_0xecc2('0xd')));return analyticExtractedReport('Completed',_0x578017?util[_0xecc2('0xb')](_0xecc2('0x24'),_0x128bbe,_0x578017?'zip':'xlsx'):null);});})[_0xecc2('0x29')](function(_0xfc152d){logger[_0xecc2('0xa')](util[_0xecc2('0xb')](_0xecc2('0x2a'),EXTRACTED_REPORT_ID,_0xecc2('0xd')),util[_0xecc2('0x2b')](_0xfc152d,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xecc2('0x2c'));})[_0xecc2('0x2d')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x9623=['Failed','finally','exit','path','lodash','json2xls','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','push','dirname','basename','.xlsx','existsSync','mkdirSync','join','each','%s%d.%s','xlsx','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','%s.%s','inspect'];(function(_0x582274,_0x2cbd9c){var _0x8f14d3=function(_0x1cfe08){while(--_0x1cfe08){_0x582274['push'](_0x582274['shift']());}};_0x8f14d3(++_0x2cbd9c);}(_0x9623,0x8d));var _0x3962=function(_0x2cb7f3,_0x166787){_0x2cb7f3=_0x2cb7f3-0x0;var _0x29a4ee=_0x9623[_0x2cb7f3];return _0x29a4ee;};'use strict';var util=require('util');var path=require(_0x3962('0x0'));var _=require(_0x3962('0x1'));var fs=require('fs');var json2xls=require(_0x3962('0x2'));var BPromise=require('bluebird');var zipdir=require(_0x3962('0x3'));var rimraf=require(_0x3962('0x4'));var db=require(_0x3962('0x5'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0x3962('0x6'))(_0x3962('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x3962('0x8')][0x2]);var QUERY=process[_0x3962('0x8')][0x3];var PATH=process[_0x3962('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x156a4a,_0x157faa){var _0x34cf8f={'status':_0x156a4a};var _0x565083={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x157faa){_0x34cf8f['savename']=_0x157faa;}return db[_0x3962('0x9')][_0x3962('0xa')](_0x34cf8f,_0x565083);}function main(){var _0x495cdc=0x1388;var _0x5c6d94;logger[_0x3962('0xb')](util[_0x3962('0xc')](_0x3962('0xd'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0x3962('0xe')][_0x3962('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x3962('0x10'),'splitSizeXlsx']})[_0x3962('0x11')](function(_0x9fbc4){if(_0x9fbc4){_0x5c6d94=_0x9fbc4;_0x495cdc=_0x5c6d94['splitSizeXlsx']||0x1388;}})['then'](function(){return dbH[_0x3962('0x12')][_0x3962('0x13')](util['format'](_0x3962('0x14'),QUERY),{'type':dbH[_0x3962('0x12')][_0x3962('0x15')][_0x3962('0x16')]});})[_0x3962('0x11')](function(_0x1d4583){if(!_0x1d4583[0x0][_0x3962('0x17')]){return analyticExtractedReport(_0x3962('0x18'));}var _0x4e4f88=[];var _0x5382e6=0x0;var _0x34cf02=!![];if(_0x5c6d94[_0x3962('0x10')]){if(_0x1d4583&&_0x1d4583[_0x3962('0x19')]){var _0x65494c=_0x1d4583[0x0][_0x3962('0x17')]%(_0x5382e6+_0x495cdc);for(;_0x34cf02;_0x5382e6+=_0x495cdc,_0x65494c=_0x1d4583[0x0][_0x3962('0x17')]%(_0x5382e6+_0x495cdc)){if(_0x65494c==0x0||_0x65494c==_0x1d4583[0x0][_0x3962('0x17')]){_0x34cf02=![];}_0x4e4f88[_0x3962('0x1a')](dbH[_0x3962('0x12')][_0x3962('0x13')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x495cdc,_0x5382e6),{'type':dbH[_0x3962('0x12')][_0x3962('0x15')][_0x3962('0x16')]}));}}}else{_0x4e4f88[_0x3962('0x1a')](dbH[_0x3962('0x12')]['query'](QUERY,{'type':dbH[_0x3962('0x12')]['QueryTypes'][_0x3962('0x16')]}));}var _0x2679ef=path[_0x3962('0x1b')](PATH);var _0x16316f=path[_0x3962('0x1c')](PATH,_0x3962('0x1d'));var _0x27be4e=_0x5c6d94['split']&&_0x4e4f88[_0x3962('0x19')]>0x1;var _0x1fd6c3=[];if(!fs[_0x3962('0x1e')](path['join'](_0x2679ef,_0x16316f))&&_0x27be4e){fs[_0x3962('0x1f')](path[_0x3962('0x20')](_0x2679ef,_0x16316f));}return BPromise[_0x3962('0x21')](_0x4e4f88,function(_0x12ae8d){_0x1fd6c3[_0x3962('0x1a')](_0x12ae8d);})[_0x3962('0x11')](function(){for(var _0x1940a7=0x0;_0x1940a7<_0x1fd6c3['length'];_0x1940a7+=0x1){var _0x45f55b;var _0x26fac7=_0x1fd6c3[_0x1940a7];if(_0x27be4e){_0x45f55b=path['join'](_0x2679ef,_0x16316f,util['format'](_0x3962('0x22'),_0x16316f,_0x1940a7,_0x3962('0x23')));}else{_0x45f55b=path[_0x3962('0x20')](_0x2679ef,util[_0x3962('0xc')]('%s.%s',_0x16316f,_0x3962('0x23')));}fs['writeFileSync'](_0x45f55b,json2xls(_0x26fac7),_0x3962('0x24'));}})[_0x3962('0x11')](function(){if(_0x27be4e){zipdir(path['join'](_0x2679ef,_0x16316f),{'saveTo':path[_0x3962('0x20')](_0x2679ef,util[_0x3962('0xc')]('%s.%s',_0x16316f,_0x3962('0x25')))},function(_0x1bd6c7,_0x1c873c){});rimraf(path[_0x3962('0x20')](_0x2679ef,_0x16316f),function(){});}})['then'](function(){logger['info'](util[_0x3962('0xc')](_0x3962('0x26'),EXTRACTED_REPORT_ID,_0x3962('0x27')));return analyticExtractedReport(_0x3962('0x28'),_0x27be4e?util[_0x3962('0xc')](_0x3962('0x29'),_0x16316f,_0x27be4e?_0x3962('0x25'):_0x3962('0x23')):null);});})['catch'](function(_0x3d6bcb){logger[_0x3962('0xb')](util[_0x3962('0xc')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'),util[_0x3962('0x2a')](_0x3d6bcb,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x3962('0x2b'));})[_0x3962('0x2c')](function(){process[_0x3962('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index e2592ae..dd127e4 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 _0xf13b=['none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','GotoIfTime',',${EXTEN},','last','Hangup','transaction','bulkCreate','sortBy','catch','rewrite','Interval','findAll','then','intervals','models','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','push','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','inbound','CDR(routeid)=','outbound','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat'];(function(_0x5ceafb,_0x1f28bf){var _0x438e3c=function(_0x525702){while(--_0x525702){_0x5ceafb['push'](_0x5ceafb['shift']());}};_0x438e3c(++_0x1f28bf);}(_0xf13b,0xed));var _0xbf13=function(_0x8ab515,_0x1d32de){_0x8ab515=_0x8ab515-0x0;var _0x581b31=_0xf13b[_0x8ab515];return _0x581b31;};'use strict';var _=require('lodash');var util=require('util');function rewrite(_0x1b80d3,_0x37b8c5){var _0x240b51=this;return _0x1b80d3['models'][_0xbf13('0x0')][_0xbf13('0x1')]({'raw':!![]})[_0xbf13('0x2')](function(_0x2a3c7c){_0x240b51[_0xbf13('0x3')]=_0x2a3c7c;return _0x1b80d3[_0xbf13('0x4')][_0xbf13('0x5')][_0xbf13('0x1')]({'where':{'IntervalId':_0x37b8c5[_0xbf13('0x6')]},'raw':!![]});})[_0xbf13('0x2')](function(_0xb70c5){return _0x1b80d3[_0xbf13('0x4')]['VoiceExtension']['findAll']({'where':{'exten':{'$in':_[_0xbf13('0x7')](_[_0xbf13('0x8')](_0xb70c5,_0xbf13('0x9')))}},'order':[{'raw':_0xbf13('0xa')}],'raw':!![]});})[_0xbf13('0x2')](function(_0x2aa793){var _0x32a72=_[_0xbf13('0xb')](_0x2aa793,{'priority':'1'});var _0xbb923b=_['filter'](_0x2aa793,{'isApp':0x1});var _0x2f6a1c=_[_0xbf13('0xc')](_0xbb923b,_0xbf13('0x9'));var _0xb4d38f=[_0xbf13('0xd'),_0xbf13('0xe')];var _0x3ca2e0=[];var _0x1ddb7d=[];for(var _0x3f69d0 in _0x2f6a1c){if(_0x2f6a1c[_0xbf13('0xf')](_0x3f69d0)){_0x240b51[_0xbf13('0x10')]=0x2;_0x240b51[_0xbf13('0x11')]=[];_0x240b51[_0xbf13('0x12')]=_['find'](_0x32a72,{'exten':_0x2f6a1c[_0x3f69d0][0x0][_0xbf13('0x9')]});_0x240b51[_0xbf13('0x11')][_0xbf13('0x13')]({'type':_0x2f6a1c[_0x3f69d0][0x0][_0xbf13('0x14')],'app':_0xbf13('0x15'),'appdata':util[_0xbf13('0x16')](_0xbf13('0x17'),_0x2f6a1c[_0x3f69d0][0x0][_0xbf13('0x14')]),'context':_0x2f6a1c[_0x3f69d0][0x0][_0xbf13('0x18')],'exten':_0x2f6a1c[_0x3f69d0][0x0][_0xbf13('0x9')],'priority':_0x240b51['priority']++,'VoiceExtensionId':_0x2f6a1c[_0x3f69d0][0x0][_0xbf13('0x19')]});if(_0x2f6a1c[_0x3f69d0][0x0][_0xbf13('0x14')]===_0xbf13('0x1a')){_0x240b51[_0xbf13('0x11')][_0xbf13('0x13')]({'type':_0x2f6a1c[_0x3f69d0][0x0]['type'],'app':_0xbf13('0x15'),'appdata':_0xbf13('0x1b')+_0x2f6a1c[_0x3f69d0][0x0][_0xbf13('0x19')],'context':_0x2f6a1c[_0x3f69d0][0x0][_0xbf13('0x18')],'exten':_0x2f6a1c[_0x3f69d0][0x0][_0xbf13('0x9')],'priority':_0x240b51[_0xbf13('0x10')]++,'VoiceExtensionId':_0x2f6a1c[_0x3f69d0][0x0]['VoiceExtensionId']});}else if(_0x2f6a1c[_0x3f69d0][0x0]['type']===_0xbf13('0x1c')){if(_0x240b51[_0xbf13('0x12')]){_0x240b51[_0xbf13('0x11')][_0xbf13('0x13')]({'type':_0x2f6a1c[_0x3f69d0][0x0][_0xbf13('0x14')],'app':_0xbf13('0x15'),'appdata':'CDR(destination)='+(_0x240b51[_0xbf13('0x12')][_0xbf13('0x1d')]?_0xbf13('0x1e')+_0x240b51['extension'][_0xbf13('0x1d')]+'}':_0xbf13('0x1f')),'context':_0x2f6a1c[_0x3f69d0][0x0]['context'],'exten':_0x2f6a1c[_0x3f69d0][0x0]['exten'],'priority':_0x240b51['priority']++,'VoiceExtensionId':_0x2f6a1c[_0x3f69d0][0x0][_0xbf13('0x19')]});}_0x240b51[_0xbf13('0x11')][_0xbf13('0x13')]({'type':_0x2f6a1c[_0x3f69d0][0x0][_0xbf13('0x14')],'app':_0xbf13('0x15'),'appdata':_0xbf13('0x1b')+_0x2f6a1c[_0x3f69d0][0x0]['VoiceExtensionId'],'context':_0x2f6a1c[_0x3f69d0][0x0][_0xbf13('0x18')],'exten':_0x2f6a1c[_0x3f69d0][0x0][_0xbf13('0x9')],'priority':_0x240b51[_0xbf13('0x10')]++,'VoiceExtensionId':_0x2f6a1c[_0x3f69d0][0x0]['VoiceExtensionId']});var _0x4398e1=_0x240b51[_0xbf13('0x10')]++;_0x240b51[_0xbf13('0x11')][_0xbf13('0x13')]({'type':_0x2f6a1c[_0x3f69d0][0x0][_0xbf13('0x14')],'app':_0xbf13('0x20'),'appdata':_0xbf13('0x21')+(_0x4398e1+0x2)+_0xbf13('0x22')+(_0x4398e1+0x1)+')','context':_0x2f6a1c[_0x3f69d0][0x0][_0xbf13('0x18')],'exten':_0x2f6a1c[_0x3f69d0][0x0]['exten'],'priority':_0x4398e1,'VoiceExtensionId':_0x2f6a1c[_0x3f69d0][0x0][_0xbf13('0x19')]});if(_0x240b51[_0xbf13('0x12')]){_0x240b51[_0xbf13('0x11')]['push']({'type':_0x2f6a1c[_0x3f69d0][0x0]['type'],'app':'Set','appdata':_0x240b51[_0xbf13('0x12')][_0xbf13('0x1d')]?_0xbf13('0x23')+_0x240b51['extension'][_0xbf13('0x1d')]+'}':_0xbf13('0x24'),'context':_0x2f6a1c[_0x3f69d0][0x0][_0xbf13('0x18')],'exten':_0x2f6a1c[_0x3f69d0][0x0][_0xbf13('0x9')],'priority':_0x240b51[_0xbf13('0x10')]++,'VoiceExtensionId':_0x2f6a1c[_0x3f69d0][0x0][_0xbf13('0x19')]});}_0x240b51[_0xbf13('0x11')]['push']({'type':_0x2f6a1c[_0x3f69d0][0x0][_0xbf13('0x14')],'app':_0xbf13('0x15'),'appdata':_0xbf13('0x25')+_0x2f6a1c[_0x3f69d0][0x0][_0xbf13('0x19')],'context':_0x2f6a1c[_0x3f69d0][0x0][_0xbf13('0x18')],'exten':_0x2f6a1c[_0x3f69d0][0x0][_0xbf13('0x9')],'priority':_0x240b51[_0xbf13('0x10')]++,'VoiceExtensionId':_0x2f6a1c[_0x3f69d0][0x0][_0xbf13('0x19')]});if(_0x240b51[_0xbf13('0x12')]&&_0x240b51[_0xbf13('0x12')][_0xbf13('0xf')]('recordingFormat')&&_0x240b51[_0xbf13('0x12')][_0xbf13('0x26')]!==_0xbf13('0x27')){_0x240b51['extensions'][_0xbf13('0x13')]({'type':_0x2f6a1c[_0x3f69d0][0x0][_0xbf13('0x14')],'app':'Set','appdata':_0xbf13('0x28'),'context':_0x2f6a1c[_0x3f69d0][0x0][_0xbf13('0x18')],'exten':_0x2f6a1c[_0x3f69d0][0x0][_0xbf13('0x9')],'priority':_0x240b51[_0xbf13('0x10')]++,'VoiceExtensionId':_0x2f6a1c[_0x3f69d0][0x0]['VoiceExtensionId']});_0x240b51[_0xbf13('0x11')]['push']({'type':_0x2f6a1c[_0x3f69d0][0x0]['type'],'app':_0xbf13('0x15'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x240b51[_0xbf13('0x12')][_0xbf13('0x26')]||_0xbf13('0x29'),'context':_0x2f6a1c[_0x3f69d0][0x0][_0xbf13('0x18')],'exten':_0x2f6a1c[_0x3f69d0][0x0][_0xbf13('0x9')],'priority':_0x240b51[_0xbf13('0x10')]++,'VoiceExtensionId':_0x2f6a1c[_0x3f69d0][0x0][_0xbf13('0x19')]});}}_0x240b51[_0xbf13('0x11')][_0xbf13('0x13')]({'type':_0x2f6a1c[_0x3f69d0][0x0][_0xbf13('0x14')],'app':'Set','appdata':_0xbf13('0x2a'),'context':_0x2f6a1c[_0x3f69d0][0x0][_0xbf13('0x18')],'exten':_0x2f6a1c[_0x3f69d0][0x0][_0xbf13('0x9')],'priority':_0x240b51[_0xbf13('0x10')]++,'VoiceExtensionId':_0x2f6a1c[_0x3f69d0][0x0][_0xbf13('0x19')]});_0x240b51['extensions'][_0xbf13('0x13')]({'type':_0x2f6a1c[_0x3f69d0][0x0][_0xbf13('0x14')],'app':_0xbf13('0x15'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x2f6a1c[_0x3f69d0][0x0][_0xbf13('0x18')],'exten':_0x2f6a1c[_0x3f69d0][0x0]['exten'],'priority':_0x240b51[_0xbf13('0x10')]++,'VoiceExtensionId':_0x2f6a1c[_0x3f69d0][0x0][_0xbf13('0x19')]});_0x240b51[_0xbf13('0x11')][_0xbf13('0x13')]({'type':_0x2f6a1c[_0x3f69d0][0x0][_0xbf13('0x14')],'app':'Set','appdata':_0xbf13('0x2b'),'context':_0x2f6a1c[_0x3f69d0][0x0][_0xbf13('0x18')],'exten':_0x2f6a1c[_0x3f69d0][0x0][_0xbf13('0x9')],'priority':_0x240b51[_0xbf13('0x10')]++,'VoiceExtensionId':_0x2f6a1c[_0x3f69d0][0x0][_0xbf13('0x19')]});for(var _0x413c01=0x0,_0x3dae85=0x0;_0x413c01<_0x2f6a1c[_0x3f69d0][_0xbf13('0x2c')];_0x413c01+=0x1,_0x3dae85=0x0){var _0x33f43f=_0x2f6a1c[_0x3f69d0][_0x413c01];if(_0x33f43f['type']){_0x33f43f[_0xbf13('0x14')]=_0x33f43f[_0xbf13('0x14')][_0xbf13('0x2d')]();}var _0x276e5e=[];var _0x46bb6a=[];delete _0x33f43f['id'];delete _0x33f43f[_0xbf13('0x2e')];delete _0x33f43f[_0xbf13('0x2f')];var _0x37a214=_0x33f43f['interval']!=='*,*,*,*'?[_0x33f43f[_0xbf13('0x30')]]:_0x33f43f['IntervalId']?_[_0xbf13('0x8')](_[_0xbf13('0xb')](_0x240b51[_0xbf13('0x3')],{'IntervalId':_0x33f43f[_0xbf13('0x6')]}),'interval'):[];if(_0x33f43f[_0xbf13('0xf')](_0xbf13('0x31'))){if(_0x33f43f['tag']&&_0x33f43f[_0xbf13('0x31')]!=='--'){_0x276e5e[_0xbf13('0x13')]({'type':_0x33f43f[_0xbf13('0x14')],'app':'Set','appdata':'CDR(tag)='+_0x33f43f[_0xbf13('0x31')],'context':_0x33f43f[_0xbf13('0x18')],'exten':_0x33f43f['exten'],'priority':_0x37a214[_0xbf13('0x2c')]+_0x240b51[_0xbf13('0x10')]+_0x3dae85++,'VoiceExtensionId':_0x33f43f[_0xbf13('0x19')]});}}if(_0x33f43f[_0xbf13('0x14')]===_0xbf13('0x1c')&&_0x33f43f[_0xbf13('0xf')](_0xbf13('0x32'))){if(_0x33f43f[_0xbf13('0x32')]){_0x276e5e['push']({'type':_0x33f43f[_0xbf13('0x14')],'app':'ExecIf','appdata':_0xbf13('0x33')+_0x33f43f[_0xbf13('0x32')]+')','context':_0x33f43f['context'],'exten':_0x33f43f['exten'],'priority':_0x37a214[_0xbf13('0x2c')]+_0x240b51[_0xbf13('0x10')]+_0x3dae85++,'VoiceExtensionId':_0x33f43f[_0xbf13('0x19')]});}else{_0x276e5e[_0xbf13('0x13')]({'type':_0x33f43f[_0xbf13('0x14')],'app':_0xbf13('0x20'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x33f43f[_0xbf13('0x18')],'exten':_0x33f43f[_0xbf13('0x9')],'priority':_0x37a214[_0xbf13('0x2c')]+_0x240b51[_0xbf13('0x10')]+_0x3dae85++,'VoiceExtensionId':_0x33f43f[_0xbf13('0x19')]});}}if(_0x33f43f[_0xbf13('0xf')](_0xbf13('0x34'))){if(_0xb4d38f[_0xbf13('0x35')](_0x33f43f[_0xbf13('0x36')][_0xbf13('0x2d')]())>=0x0&&_0x33f43f[_0xbf13('0x37')]!==_0xbf13('0x38')){if(_0x33f43f[_0xbf13('0x34')]){_0x276e5e[_0xbf13('0x13')]({'type':_0x33f43f[_0xbf13('0x14')],'app':'ExecIf','appdata':_0xbf13('0x39'),'context':_0x33f43f['context'],'exten':_0x33f43f['exten'],'priority':_0x37a214[_0xbf13('0x2c')]+_0x240b51[_0xbf13('0x10')]+_0x3dae85++,'VoiceExtensionId':_0x33f43f[_0xbf13('0x19')]});_0x276e5e[_0xbf13('0x13')]({'type':_0x33f43f[_0xbf13('0x14')],'app':_0xbf13('0x15'),'appdata':_0xbf13('0x3a'),'context':_0x33f43f[_0xbf13('0x18')],'exten':_0x33f43f[_0xbf13('0x9')],'priority':_0x37a214[_0xbf13('0x2c')]+_0x240b51[_0xbf13('0x10')]+_0x3dae85++,'VoiceExtensionId':_0x33f43f['VoiceExtensionId']});}else{_0x276e5e['push']({'type':_0x33f43f[_0xbf13('0x14')],'app':_0xbf13('0x20'),'appdata':_0xbf13('0x3b'),'context':_0x33f43f[_0xbf13('0x18')],'exten':_0x33f43f[_0xbf13('0x9')],'priority':_0x37a214['length']+_0x240b51[_0xbf13('0x10')]+_0x3dae85++,'VoiceExtensionId':_0x33f43f[_0xbf13('0x19')]});_0x276e5e['push']({'type':_0x33f43f[_0xbf13('0x14')],'app':_0xbf13('0x15'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x33f43f[_0xbf13('0x18')],'exten':_0x33f43f[_0xbf13('0x9')],'priority':_0x37a214['length']+_0x240b51[_0xbf13('0x10')]+_0x3dae85++,'VoiceExtensionId':_0x33f43f[_0xbf13('0x19')]});}}}for(var _0x35dda5=0x0;_0x35dda5<_0x37a214['length'];_0x35dda5+=0x1){var _0x2f8474=_0x240b51[_0xbf13('0x10')]+_0x37a214[_0xbf13('0x2c')];var _0x14eab4=_0x35dda5===_0x37a214[_0xbf13('0x2c')]-0x1?_0x240b51[_0xbf13('0x10')]+_0x276e5e[_0xbf13('0x2c')]+_0x46bb6a[_0xbf13('0x2c')]+0x2:_0x240b51['priority']+_0x35dda5+0x1;_0x276e5e['splice'](_0x35dda5,0x0,{'type':_0x33f43f['type'],'app':_0xbf13('0x3c'),'appdata':_0x37a214[_0x35dda5]+'?'+_0x33f43f[_0xbf13('0x18')]+_0xbf13('0x3d')+_0x2f8474+':'+_0x33f43f[_0xbf13('0x18')]+_0xbf13('0x3d')+_0x14eab4,'exten':_0x33f43f[_0xbf13('0x9')],'context':_0x33f43f[_0xbf13('0x18')],'priority':_0x240b51['priority']+_0x35dda5,'VoiceExtensionId':_0x2f6a1c[_0x3f69d0][0x0]['VoiceExtensionId']});}_0x33f43f['priority']=_0x276e5e['length']?_[_0xbf13('0x3e')](_0x276e5e)[_0xbf13('0x10')]+0x1:_0x240b51['priority'];_0x240b51[_0xbf13('0x10')]=(_0x46bb6a[_0xbf13('0x2c')]?_[_0xbf13('0x3e')](_0x46bb6a)[_0xbf13('0x10')]:_0x33f43f['priority'])+0x1;_0x240b51['extensions']=_['concat'](_0x240b51['extensions'],_0x276e5e,[_0x33f43f],_0x46bb6a);}_0x240b51[_0xbf13('0x11')]['push']({'type':_0x2f6a1c[_0x3f69d0][0x0][_0xbf13('0x14')],'app':_0xbf13('0x3f'),'exten':_0x2f6a1c[_0x3f69d0][0x0]['exten'],'context':_0x2f6a1c[_0x3f69d0][0x0][_0xbf13('0x18')],'priority':_0x240b51[_0xbf13('0x10')],'VoiceExtensionId':_0x2f6a1c[_0x3f69d0][0x0][_0xbf13('0x19')]});_0x3ca2e0['push'](_0x2f6a1c[_0x3f69d0][0x0][_0xbf13('0x19')]);_0x1ddb7d=_['concat'](_0x1ddb7d,_0x240b51[_0xbf13('0x11')]);}}return _0x1b80d3[_0xbf13('0x40')](function(_0x4f9797){return _0x1b80d3[_0xbf13('0x4')][_0xbf13('0x5')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x3ca2e0}},'transaction':_0x4f9797})[_0xbf13('0x2')](function(_0x2641e0){return _0x1b80d3[_0xbf13('0x4')][_0xbf13('0x5')][_0xbf13('0x41')](_[_0xbf13('0x42')](_0x1ddb7d,'priority'),{'transaction':_0x4f9797});});});})[_0xbf13('0x43')](function(_0x1d78c0){console['error'](_0x1d78c0);});}exports[_0xbf13('0x44')]=rewrite; \ No newline at end of file +var _0xd411=['CDR(routeid)=','outbound','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','MONITOR_OPTIONS=ab','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','IntervalId','tag','CDR(tag)=','length','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','app','appType','custom','answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','sortBy','catch','lodash','util','models','then','intervals','VoiceExtension','findAll','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','hasOwnProperty','priority','extensions','extension','find','push','type','Set','CDR(type)=%s','context','VoiceExtensionId','inbound'];(function(_0x146484,_0x27a7f0){var _0x4c7aa3=function(_0x481b98){while(--_0x481b98){_0x146484['push'](_0x146484['shift']());}};_0x4c7aa3(++_0x27a7f0);}(_0xd411,0x71));var _0x1d41=function(_0x9f65a9,_0x2aef64){_0x9f65a9=_0x9f65a9-0x0;var _0x20ac6f=_0xd411[_0x9f65a9];return _0x20ac6f;};'use strict';var _=require(_0x1d41('0x0'));var util=require(_0x1d41('0x1'));function rewrite(_0x462684,_0x517555){var _0x2a494e=this;return _0x462684[_0x1d41('0x2')]['Interval']['findAll']({'raw':!![]})[_0x1d41('0x3')](function(_0x1dfccd){_0x2a494e[_0x1d41('0x4')]=_0x1dfccd;return _0x462684[_0x1d41('0x2')][_0x1d41('0x5')][_0x1d41('0x6')]({'where':{'IntervalId':_0x517555['IntervalId']},'raw':!![]});})[_0x1d41('0x3')](function(_0xfdacf7){return _0x462684[_0x1d41('0x2')][_0x1d41('0x5')][_0x1d41('0x6')]({'where':{'exten':{'$in':_['uniq'](_[_0x1d41('0x7')](_0xfdacf7,_0x1d41('0x8')))}},'order':[{'raw':_0x1d41('0x9')}],'raw':!![]});})[_0x1d41('0x3')](function(_0x3f353d){var _0xbb6657=_['filter'](_0x3f353d,{'priority':'1'});var _0xed5d08=_[_0x1d41('0xa')](_0x3f353d,{'isApp':0x1});var _0x83c72e=_[_0x1d41('0xb')](_0xed5d08,_0x1d41('0x8'));var _0x266053=[_0x1d41('0xc'),'playback'];var _0x2550bb=[];var _0x541d87=[];for(var _0x333ebf in _0x83c72e){if(_0x83c72e[_0x1d41('0xd')](_0x333ebf)){_0x2a494e[_0x1d41('0xe')]=0x2;_0x2a494e[_0x1d41('0xf')]=[];_0x2a494e[_0x1d41('0x10')]=_[_0x1d41('0x11')](_0xbb6657,{'exten':_0x83c72e[_0x333ebf][0x0][_0x1d41('0x8')]});_0x2a494e[_0x1d41('0xf')][_0x1d41('0x12')]({'type':_0x83c72e[_0x333ebf][0x0][_0x1d41('0x13')],'app':_0x1d41('0x14'),'appdata':util['format'](_0x1d41('0x15'),_0x83c72e[_0x333ebf][0x0][_0x1d41('0x13')]),'context':_0x83c72e[_0x333ebf][0x0][_0x1d41('0x16')],'exten':_0x83c72e[_0x333ebf][0x0]['exten'],'priority':_0x2a494e[_0x1d41('0xe')]++,'VoiceExtensionId':_0x83c72e[_0x333ebf][0x0][_0x1d41('0x17')]});if(_0x83c72e[_0x333ebf][0x0]['type']===_0x1d41('0x18')){_0x2a494e[_0x1d41('0xf')][_0x1d41('0x12')]({'type':_0x83c72e[_0x333ebf][0x0]['type'],'app':'Set','appdata':_0x1d41('0x19')+_0x83c72e[_0x333ebf][0x0][_0x1d41('0x17')],'context':_0x83c72e[_0x333ebf][0x0][_0x1d41('0x16')],'exten':_0x83c72e[_0x333ebf][0x0]['exten'],'priority':_0x2a494e[_0x1d41('0xe')]++,'VoiceExtensionId':_0x83c72e[_0x333ebf][0x0][_0x1d41('0x17')]});}else if(_0x83c72e[_0x333ebf][0x0][_0x1d41('0x13')]===_0x1d41('0x1a')){if(_0x2a494e[_0x1d41('0x10')]){_0x2a494e[_0x1d41('0xf')][_0x1d41('0x12')]({'type':_0x83c72e[_0x333ebf][0x0]['type'],'app':_0x1d41('0x14'),'appdata':'CDR(destination)='+(_0x2a494e[_0x1d41('0x10')][_0x1d41('0x1b')]?_0x1d41('0x1c')+_0x2a494e[_0x1d41('0x10')][_0x1d41('0x1b')]+'}':'${EXTEN}'),'context':_0x83c72e[_0x333ebf][0x0]['context'],'exten':_0x83c72e[_0x333ebf][0x0][_0x1d41('0x8')],'priority':_0x2a494e[_0x1d41('0xe')]++,'VoiceExtensionId':_0x83c72e[_0x333ebf][0x0][_0x1d41('0x17')]});}_0x2a494e['extensions']['push']({'type':_0x83c72e[_0x333ebf][0x0][_0x1d41('0x13')],'app':_0x1d41('0x14'),'appdata':_0x1d41('0x19')+_0x83c72e[_0x333ebf][0x0][_0x1d41('0x17')],'context':_0x83c72e[_0x333ebf][0x0][_0x1d41('0x16')],'exten':_0x83c72e[_0x333ebf][0x0][_0x1d41('0x8')],'priority':_0x2a494e[_0x1d41('0xe')]++,'VoiceExtensionId':_0x83c72e[_0x333ebf][0x0][_0x1d41('0x17')]});var _0x50797f=_0x2a494e[_0x1d41('0xe')]++;_0x2a494e[_0x1d41('0xf')][_0x1d41('0x12')]({'type':_0x83c72e[_0x333ebf][0x0]['type'],'app':_0x1d41('0x1d'),'appdata':_0x1d41('0x1e')+(_0x50797f+0x2)+_0x1d41('0x1f')+(_0x50797f+0x1)+')','context':_0x83c72e[_0x333ebf][0x0]['context'],'exten':_0x83c72e[_0x333ebf][0x0][_0x1d41('0x8')],'priority':_0x50797f,'VoiceExtensionId':_0x83c72e[_0x333ebf][0x0][_0x1d41('0x17')]});if(_0x2a494e[_0x1d41('0x10')]){_0x2a494e[_0x1d41('0xf')][_0x1d41('0x12')]({'type':_0x83c72e[_0x333ebf][0x0][_0x1d41('0x13')],'app':_0x1d41('0x14'),'appdata':_0x2a494e[_0x1d41('0x10')][_0x1d41('0x1b')]?_0x1d41('0x20')+_0x2a494e[_0x1d41('0x10')]['cutdigits']+'}':_0x1d41('0x21'),'context':_0x83c72e[_0x333ebf][0x0][_0x1d41('0x16')],'exten':_0x83c72e[_0x333ebf][0x0][_0x1d41('0x8')],'priority':_0x2a494e[_0x1d41('0xe')]++,'VoiceExtensionId':_0x83c72e[_0x333ebf][0x0]['VoiceExtensionId']});}_0x2a494e[_0x1d41('0xf')][_0x1d41('0x12')]({'type':_0x83c72e[_0x333ebf][0x0][_0x1d41('0x13')],'app':'Set','appdata':_0x1d41('0x22')+_0x83c72e[_0x333ebf][0x0][_0x1d41('0x17')],'context':_0x83c72e[_0x333ebf][0x0][_0x1d41('0x16')],'exten':_0x83c72e[_0x333ebf][0x0][_0x1d41('0x8')],'priority':_0x2a494e['priority']++,'VoiceExtensionId':_0x83c72e[_0x333ebf][0x0][_0x1d41('0x17')]});if(_0x2a494e[_0x1d41('0x10')]&&_0x2a494e[_0x1d41('0x10')][_0x1d41('0xd')](_0x1d41('0x23'))&&_0x2a494e[_0x1d41('0x10')][_0x1d41('0x23')]!==_0x1d41('0x24')){_0x2a494e[_0x1d41('0xf')][_0x1d41('0x12')]({'type':_0x83c72e[_0x333ebf][0x0][_0x1d41('0x13')],'app':_0x1d41('0x14'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x83c72e[_0x333ebf][0x0][_0x1d41('0x16')],'exten':_0x83c72e[_0x333ebf][0x0][_0x1d41('0x8')],'priority':_0x2a494e[_0x1d41('0xe')]++,'VoiceExtensionId':_0x83c72e[_0x333ebf][0x0][_0x1d41('0x17')]});_0x2a494e[_0x1d41('0xf')]['push']({'type':_0x83c72e[_0x333ebf][0x0][_0x1d41('0x13')],'app':_0x1d41('0x14'),'appdata':_0x1d41('0x25')+_0x2a494e[_0x1d41('0x10')][_0x1d41('0x23')]||_0x1d41('0x26'),'context':_0x83c72e[_0x333ebf][0x0]['context'],'exten':_0x83c72e[_0x333ebf][0x0][_0x1d41('0x8')],'priority':_0x2a494e[_0x1d41('0xe')]++,'VoiceExtensionId':_0x83c72e[_0x333ebf][0x0][_0x1d41('0x17')]});}}_0x2a494e[_0x1d41('0xf')][_0x1d41('0x12')]({'type':_0x83c72e[_0x333ebf][0x0][_0x1d41('0x13')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x83c72e[_0x333ebf][0x0][_0x1d41('0x16')],'exten':_0x83c72e[_0x333ebf][0x0][_0x1d41('0x8')],'priority':_0x2a494e[_0x1d41('0xe')]++,'VoiceExtensionId':_0x83c72e[_0x333ebf][0x0][_0x1d41('0x17')]});_0x2a494e['extensions'][_0x1d41('0x12')]({'type':_0x83c72e[_0x333ebf][0x0]['type'],'app':_0x1d41('0x14'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x83c72e[_0x333ebf][0x0][_0x1d41('0x16')],'exten':_0x83c72e[_0x333ebf][0x0][_0x1d41('0x8')],'priority':_0x2a494e[_0x1d41('0xe')]++,'VoiceExtensionId':_0x83c72e[_0x333ebf][0x0][_0x1d41('0x17')]});_0x2a494e['extensions'][_0x1d41('0x12')]({'type':_0x83c72e[_0x333ebf][0x0][_0x1d41('0x13')],'app':_0x1d41('0x14'),'appdata':_0x1d41('0x27'),'context':_0x83c72e[_0x333ebf][0x0]['context'],'exten':_0x83c72e[_0x333ebf][0x0]['exten'],'priority':_0x2a494e[_0x1d41('0xe')]++,'VoiceExtensionId':_0x83c72e[_0x333ebf][0x0][_0x1d41('0x17')]});for(var _0x537dd5=0x0,_0x382161=0x0;_0x537dd5<_0x83c72e[_0x333ebf]['length'];_0x537dd5+=0x1,_0x382161=0x0){var _0x33f7e7=_0x83c72e[_0x333ebf][_0x537dd5];if(_0x33f7e7[_0x1d41('0x13')]){_0x33f7e7['type']=_0x33f7e7['type'][_0x1d41('0x28')]();}var _0x169279=[];var _0x137f48=[];delete _0x33f7e7['id'];delete _0x33f7e7[_0x1d41('0x29')];delete _0x33f7e7[_0x1d41('0x2a')];var _0x62c2e4=_0x33f7e7[_0x1d41('0x2b')]!==_0x1d41('0x2c')?[_0x33f7e7[_0x1d41('0x2b')]]:_0x33f7e7['IntervalId']?_['map'](_['filter'](_0x2a494e[_0x1d41('0x4')],{'IntervalId':_0x33f7e7[_0x1d41('0x2d')]}),_0x1d41('0x2b')):[];if(_0x33f7e7[_0x1d41('0xd')](_0x1d41('0x2e'))){if(_0x33f7e7[_0x1d41('0x2e')]&&_0x33f7e7[_0x1d41('0x2e')]!=='--'){_0x169279['push']({'type':_0x33f7e7[_0x1d41('0x13')],'app':'Set','appdata':_0x1d41('0x2f')+_0x33f7e7[_0x1d41('0x2e')],'context':_0x33f7e7['context'],'exten':_0x33f7e7[_0x1d41('0x8')],'priority':_0x62c2e4[_0x1d41('0x30')]+_0x2a494e[_0x1d41('0xe')]+_0x382161++,'VoiceExtensionId':_0x33f7e7[_0x1d41('0x17')]});}}if(_0x33f7e7[_0x1d41('0x13')]===_0x1d41('0x1a')&&_0x33f7e7[_0x1d41('0xd')](_0x1d41('0x31'))){if(_0x33f7e7[_0x1d41('0x31')]){_0x169279[_0x1d41('0x12')]({'type':_0x33f7e7[_0x1d41('0x13')],'app':_0x1d41('0x1d'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x33f7e7[_0x1d41('0x31')]+')','context':_0x33f7e7['context'],'exten':_0x33f7e7[_0x1d41('0x8')],'priority':_0x62c2e4[_0x1d41('0x30')]+_0x2a494e[_0x1d41('0xe')]+_0x382161++,'VoiceExtensionId':_0x33f7e7['VoiceExtensionId']});}else{_0x169279[_0x1d41('0x12')]({'type':_0x33f7e7[_0x1d41('0x13')],'app':_0x1d41('0x1d'),'appdata':_0x1d41('0x32'),'context':_0x33f7e7[_0x1d41('0x16')],'exten':_0x33f7e7[_0x1d41('0x8')],'priority':_0x62c2e4[_0x1d41('0x30')]+_0x2a494e[_0x1d41('0xe')]+_0x382161++,'VoiceExtensionId':_0x33f7e7[_0x1d41('0x17')]});}}if(_0x33f7e7[_0x1d41('0xd')]('answer')){if(_0x266053[_0x1d41('0x33')](_0x33f7e7[_0x1d41('0x34')][_0x1d41('0x28')]())>=0x0&&_0x33f7e7[_0x1d41('0x35')]!==_0x1d41('0x36')){if(_0x33f7e7[_0x1d41('0x37')]){_0x169279[_0x1d41('0x12')]({'type':_0x33f7e7[_0x1d41('0x13')],'app':_0x1d41('0x1d'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x33f7e7[_0x1d41('0x16')],'exten':_0x33f7e7[_0x1d41('0x8')],'priority':_0x62c2e4[_0x1d41('0x30')]+_0x2a494e['priority']+_0x382161++,'VoiceExtensionId':_0x33f7e7[_0x1d41('0x17')]});_0x169279[_0x1d41('0x12')]({'type':_0x33f7e7[_0x1d41('0x13')],'app':'Set','appdata':_0x1d41('0x38'),'context':_0x33f7e7[_0x1d41('0x16')],'exten':_0x33f7e7[_0x1d41('0x8')],'priority':_0x62c2e4[_0x1d41('0x30')]+_0x2a494e[_0x1d41('0xe')]+_0x382161++,'VoiceExtensionId':_0x33f7e7['VoiceExtensionId']});}else{_0x169279[_0x1d41('0x12')]({'type':_0x33f7e7[_0x1d41('0x13')],'app':_0x1d41('0x1d'),'appdata':_0x1d41('0x39'),'context':_0x33f7e7['context'],'exten':_0x33f7e7[_0x1d41('0x8')],'priority':_0x62c2e4['length']+_0x2a494e[_0x1d41('0xe')]+_0x382161++,'VoiceExtensionId':_0x33f7e7['VoiceExtensionId']});_0x169279['push']({'type':_0x33f7e7[_0x1d41('0x13')],'app':_0x1d41('0x14'),'appdata':_0x1d41('0x3a'),'context':_0x33f7e7[_0x1d41('0x16')],'exten':_0x33f7e7[_0x1d41('0x8')],'priority':_0x62c2e4['length']+_0x2a494e[_0x1d41('0xe')]+_0x382161++,'VoiceExtensionId':_0x33f7e7[_0x1d41('0x17')]});}}}for(var _0x2026ed=0x0;_0x2026ed<_0x62c2e4[_0x1d41('0x30')];_0x2026ed+=0x1){var _0x182ca9=_0x2a494e['priority']+_0x62c2e4[_0x1d41('0x30')];var _0x3a8dae=_0x2026ed===_0x62c2e4[_0x1d41('0x30')]-0x1?_0x2a494e[_0x1d41('0xe')]+_0x169279[_0x1d41('0x30')]+_0x137f48[_0x1d41('0x30')]+0x2:_0x2a494e[_0x1d41('0xe')]+_0x2026ed+0x1;_0x169279[_0x1d41('0x3b')](_0x2026ed,0x0,{'type':_0x33f7e7['type'],'app':_0x1d41('0x3c'),'appdata':_0x62c2e4[_0x2026ed]+'?'+_0x33f7e7[_0x1d41('0x16')]+_0x1d41('0x3d')+_0x182ca9+':'+_0x33f7e7[_0x1d41('0x16')]+_0x1d41('0x3d')+_0x3a8dae,'exten':_0x33f7e7[_0x1d41('0x8')],'context':_0x33f7e7[_0x1d41('0x16')],'priority':_0x2a494e[_0x1d41('0xe')]+_0x2026ed,'VoiceExtensionId':_0x83c72e[_0x333ebf][0x0][_0x1d41('0x17')]});}_0x33f7e7[_0x1d41('0xe')]=_0x169279[_0x1d41('0x30')]?_[_0x1d41('0x3e')](_0x169279)[_0x1d41('0xe')]+0x1:_0x2a494e[_0x1d41('0xe')];_0x2a494e[_0x1d41('0xe')]=(_0x137f48[_0x1d41('0x30')]?_[_0x1d41('0x3e')](_0x137f48)[_0x1d41('0xe')]:_0x33f7e7['priority'])+0x1;_0x2a494e[_0x1d41('0xf')]=_[_0x1d41('0x3f')](_0x2a494e['extensions'],_0x169279,[_0x33f7e7],_0x137f48);}_0x2a494e[_0x1d41('0xf')][_0x1d41('0x12')]({'type':_0x83c72e[_0x333ebf][0x0][_0x1d41('0x13')],'app':_0x1d41('0x40'),'exten':_0x83c72e[_0x333ebf][0x0]['exten'],'context':_0x83c72e[_0x333ebf][0x0][_0x1d41('0x16')],'priority':_0x2a494e['priority'],'VoiceExtensionId':_0x83c72e[_0x333ebf][0x0][_0x1d41('0x17')]});_0x2550bb[_0x1d41('0x12')](_0x83c72e[_0x333ebf][0x0][_0x1d41('0x17')]);_0x541d87=_[_0x1d41('0x3f')](_0x541d87,_0x2a494e['extensions']);}}return _0x462684[_0x1d41('0x41')](function(_0x3ea1bd){return _0x462684[_0x1d41('0x2')][_0x1d41('0x5')][_0x1d41('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x2550bb}},'transaction':_0x3ea1bd})[_0x1d41('0x3')](function(_0x4256cf){return _0x462684[_0x1d41('0x2')][_0x1d41('0x5')]['bulkCreate'](_[_0x1d41('0x43')](_0x541d87,_0x1d41('0xe')),{'transaction':_0x3ea1bd});});});})[_0x1d41('0x44')](function(_0x382c4f){console['error'](_0x382c4f);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index c4dfe35..82c3e04 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 _0x7fe9=['undefined','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','join','hasOwnProperty','data','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','CompanyId','duplicate','Duplicate\x20Contact','CmContact','keys','then','push','pick','catch','message','stringify','checkHopper','inspect','into','cm_hopper','fromQuery','scheduledAt','ListId','createdAt','field','NOW()','updatedAt','cm_contacts','where','ListId\x20=\x20?','toString','select','\x20=\x20?','insert','ContactId','from','id\x20IN\x20?','str','calleridnum','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','cm_hopper_black','findAll','outbound','dialCheckDuplicateType','CmList','VoiceQueueId','onlyIfOpen','sequelize','query','all','get','Lists','always','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','emit','contact:csv_','resume','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','util','lodash','squel','papaparse','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','Missing\x20filepath\x20parameter!'];(function(_0x2c412e,_0x32c6a3){var _0x5c816b=function(_0x2fe569){while(--_0x2fe569){_0x2c412e['push'](_0x2c412e['shift']());}};_0x5c816b(++_0x32c6a3);}(_0x7fe9,0xd0));var _0x97fe=function(_0x2d775e,_0x4c0165){_0x2d775e=_0x2d775e-0x0;var _0x47e959=_0x7fe9[_0x2d775e];return _0x47e959;};'use strict';var BPromise=require('bluebird');var util=require(_0x97fe('0x0'));var _=require(_0x97fe('0x1'));var fs=require('fs');var squel=require(_0x97fe('0x2'));var Papa=require(_0x97fe('0x3'));var Redis=require('ioredis');var db=require(_0x97fe('0x4'))['db'];var config=require(_0x97fe('0x5'));var logger=require(_0x97fe('0x6'))(_0x97fe('0x7'));config[_0x97fe('0x8')]=_[_0x97fe('0x9')](config['redis'],{'host':_0x97fe('0xa'),'port':0x18eb});var socket=require(_0x97fe('0xb'))(new Redis(config['redis']));require(_0x97fe('0xc'))[_0x97fe('0xd')](socket);try{if(!process[_0x97fe('0xe')][0x2]||process[_0x97fe('0xe')][0x2]==='undefined'||process[_0x97fe('0xe')][0x2]==='null'){throw new Error(_0x97fe('0xf'));}var FILEPATH=process[_0x97fe('0xe')][0x2];if(!process['argv'][0x3]||process[_0x97fe('0xe')][0x3]===_0x97fe('0x10')||process[_0x97fe('0xe')][0x3]===_0x97fe('0x11')||!process[_0x97fe('0xe')][0x4]||process[_0x97fe('0xe')][0x4]===_0x97fe('0x10')||process[_0x97fe('0xe')][0x4]===_0x97fe('0x11')){throw new Error(_0x97fe('0x12'));}var FIELDS=_[_0x97fe('0x13')](process[_0x97fe('0xe')][0x3]['split'](','),process[_0x97fe('0xe')][0x4][_0x97fe('0x14')](','));if(!process['argv'][0x5]||process[_0x97fe('0xe')][0x5]===_0x97fe('0x10')||process[_0x97fe('0xe')][0x5]===_0x97fe('0x11')){throw new Error(_0x97fe('0x15'));}var LISTID=process[_0x97fe('0xe')][0x5];var COMPANYID=process[_0x97fe('0xe')][0x6]&&process[_0x97fe('0xe')][0x6]!=='undefined'&&process['argv'][0x6]!==_0x97fe('0x11')?process['argv'][0x6]:null;var DUPLICATES=process[_0x97fe('0xe')][0x7]&&process[_0x97fe('0xe')][0x7]!==_0x97fe('0x10')&&process['argv'][0x7]!==_0x97fe('0x11')?process[_0x97fe('0xe')][0x7]:null;if(!process[_0x97fe('0xe')][0x8]||process[_0x97fe('0xe')][0x8]===_0x97fe('0x10')||process[_0x97fe('0xe')][0x8]===_0x97fe('0x11')){throw new Error(_0x97fe('0x16'));}var SOCKET_TIMESTAMP=process[_0x97fe('0xe')][0x8];}catch(_0x1033c7){logger[_0x97fe('0x17')](_0x1033c7);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(_0x47daf1,_0x35b38a,_0xaaeec0,_0x276501){var _0x173fad={'message':_0x35b38a};_0x173fad[_0x47daf1]=!![];if(_0xaaeec0){_0x173fad[_0x97fe('0x18')]=_0xaaeec0;}if(_0x276501){_0x173fad[_0x97fe('0x19')]=_0x276501;}return _0x173fad;}function isEmail(_0x105546){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))*$/[_0x97fe('0x1a')](_0x105546);}function checkRow(_0x465700,_0x56a8a6,_0xe752ac){return new BPromise(function(_0x4d98ec,_0x4adf34){if(_[_0x97fe('0x1b')](_0x465700)){return _0x4adf34(handleCheckRowError(_0x97fe('0x17'),_0x97fe('0x1c'),null,_0xe752ac));}if(_0x465700[_0x97fe('0x1d')]&&_0x465700['errors'][_0x97fe('0x1e')]){var _0x4afc0a=_['map'](_0x465700['errors'],'message')[_0x97fe('0x1f')](';');return _0x4adf34(handleCheckRowError('error',_0x4afc0a,null,_0xe752ac));}var _0xafb4c={};for(var _0x28d48f in FIELDS){if(FIELDS[_0x97fe('0x20')](_0x28d48f)&&FIELDS[_0x28d48f]){_0xafb4c[_0x28d48f]=_0x465700['data'][0x0][FIELDS[_0x28d48f]]||_0x465700[_0x97fe('0x21')][0x0]['\ufeff'+FIELDS[_0x28d48f]];}}if(!_0xafb4c['firstName']){return _0x4adf34(handleCheckRowError('error',_0x97fe('0x22'),null,_0xe752ac));}if(!_0xafb4c[_0x97fe('0x23')]){return _0x4adf34(handleCheckRowError('error',_0x97fe('0x24'),null,_0xe752ac));}if(_0xafb4c[_0x97fe('0x25')]){var _0x3332d1=moment(_0xafb4c[_0x97fe('0x25')],_0x97fe('0x26'));if(!_0x3332d1[_0x97fe('0x27')]()){return _0x4adf34(handleCheckRowError(_0x97fe('0x17'),_0x97fe('0x28'),null,_0xe752ac));}}if(_0xafb4c[_0x97fe('0x29')]){if(!isEmail(_0xafb4c[_0x97fe('0x29')])){return _0x4adf34(handleCheckRowError(_0x97fe('0x17'),_0x97fe('0x2a'),null,_0xe752ac));}}_0xafb4c['ListId']=LISTID;_0xafb4c[_0x97fe('0x2b')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x97fe('0x1e')]&&_0x56a8a6){var _0x5a136e={};for(var _0x225c7b=0x0,_0x28a8a3=DUPLICATES[_0x97fe('0x1e')];_0x225c7b<_0x28a8a3;_0x225c7b+=0x1){_0x5a136e[DUPLICATES[_0x225c7b]]=_0xafb4c[DUPLICATES[_0x225c7b]];}var _0x3d0835=_['find'](_0x56a8a6,_0x5a136e);if(_0x3d0835){return _0x4adf34(handleCheckRowError(_0x97fe('0x2c'),_0x97fe('0x2d'),_0x3d0835,_0xe752ac));}}return db[_0x97fe('0x2e')]['create'](_0xafb4c,{'raw':!![],'hooks':![],'fields':_[_0x97fe('0x2f')](_0xafb4c)})[_0x97fe('0x30')](function(_0x52631b){if(DUPLICATES&&DUPLICATES[_0x97fe('0x1e')]&&_0x56a8a6){_0x56a8a6[_0x97fe('0x31')](_[_0x97fe('0x32')](_0xafb4c,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x52631b['id'];return _0x4d98ec();})[_0x97fe('0x33')](function(_0x571ff9){return _0x4adf34(handleCheckRowError(_0x97fe('0x17'),'Error\x20while\x20creating\x20contact:\x20'+(_0x571ff9[_0x97fe('0x34')]||JSON[_0x97fe('0x35')](_0x571ff9)),null,_0xe752ac));});});}function checkHopper(){function _0x5370fe(){return function(_0x433538){logger[_0x97fe('0x17')]('cmContact',_0x97fe('0x36'),util[_0x97fe('0x37')](_0x433538,{'showHidden':![],'depth':null}));};}var _0x9225a1=function(_0x7a1a85,_0x6a590f){var _0x5acebe=squel['insert']()[_0x97fe('0x38')](_0x97fe('0x39'))[_0x97fe('0x3a')]([_0x97fe('0x23'),_0x97fe('0x3b'),'ContactId',_0x97fe('0x3c'),_0x6a590f,_0x97fe('0x3d'),'updatedAt'],squel['select']()['field']('phone','phone')[_0x97fe('0x3e')]('NOW()','scheduledAt')[_0x97fe('0x3e')]('id','ContactId')[_0x97fe('0x3e')](LISTID['toString'](),_0x97fe('0x3c'))[_0x97fe('0x3e')](_0x7a1a85['id']['toString'](),_0x6a590f)[_0x97fe('0x3e')](_0x97fe('0x3f'),_0x97fe('0x3d'))[_0x97fe('0x3e')](_0x97fe('0x3f'),_0x97fe('0x40'))['from'](_0x97fe('0x41'))[_0x97fe('0x42')]('deletedAt\x20IS\x20NULL')[_0x97fe('0x42')](_0x97fe('0x43'),LISTID[_0x97fe('0x44')]())[_0x97fe('0x42')]('phone\x20IS\x20NOT\x20NULL')[_0x97fe('0x42')]('phone\x20NOT\x20IN\x20(?)',squel[_0x97fe('0x45')]()['field'](_0x97fe('0x23'))['from']('cm_hopper')[_0x97fe('0x42')](_0x6a590f+_0x97fe('0x46'),_0x7a1a85['id'][_0x97fe('0x44')]())))[_0x97fe('0x44')]();return _0x5acebe;};var _0x37557f=function(_0xf229b1,_0x3b38f8){var _0x4fc539=squel[_0x97fe('0x47')]()[_0x97fe('0x38')](_0x97fe('0x39'))[_0x97fe('0x3a')](['phone',_0x97fe('0x3b'),_0x97fe('0x48'),'ListId',_0x3b38f8,_0x97fe('0x3d'),'updatedAt'],squel['select']()[_0x97fe('0x3e')](_0x97fe('0x23'),_0x97fe('0x23'))[_0x97fe('0x3e')]('NOW()','scheduledAt')[_0x97fe('0x3e')]('id',_0x97fe('0x48'))[_0x97fe('0x3e')](LISTID[_0x97fe('0x44')](),'ListId')[_0x97fe('0x3e')](_0xf229b1['id'][_0x97fe('0x44')](),_0x3b38f8)[_0x97fe('0x3e')](_0x97fe('0x3f'),_0x97fe('0x3d'))[_0x97fe('0x3e')](_0x97fe('0x3f'),_0x97fe('0x40'))[_0x97fe('0x49')](_0x97fe('0x41'))[_0x97fe('0x42')]('deletedAt\x20IS\x20NULL')[_0x97fe('0x42')](_0x97fe('0x43'),LISTID[_0x97fe('0x44')]())[_0x97fe('0x42')](_0x97fe('0x4a'),squel[_0x97fe('0x4b')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x97fe('0x45')]()['field'](_0x97fe('0x4c'))[_0x97fe('0x49')](_0x97fe('0x4d'))[_0x97fe('0x42')](_0x3b38f8+'\x20=\x20?',_0xf229b1['id']['toString']()))[_0x97fe('0x42')](_0x97fe('0x4e'),squel[_0x97fe('0x45')]()[_0x97fe('0x3e')](_0x97fe('0x23'))['from']('cm_hopper')[_0x97fe('0x42')](_0x3b38f8+'\x20=\x20?',_0xf229b1['id'][_0x97fe('0x44')]())))['toString']();return _0x4fc539;};function _0x2eaac9(_0x29ff16,_0x948acb){var _0x1c6846=squel[_0x97fe('0x47')]()[_0x97fe('0x38')]('cm_hopper')['fromQuery']([_0x97fe('0x23'),'scheduledAt',_0x97fe('0x48'),'ListId',_0x948acb,_0x97fe('0x3d'),_0x97fe('0x40')],squel[_0x97fe('0x45')]()[_0x97fe('0x3e')](_0x97fe('0x23'),_0x97fe('0x23'))['field'](_0x97fe('0x3f'),_0x97fe('0x3b'))[_0x97fe('0x3e')]('id',_0x97fe('0x48'))[_0x97fe('0x3e')](LISTID[_0x97fe('0x44')](),_0x97fe('0x3c'))[_0x97fe('0x3e')](_0x29ff16['id']['toString'](),_0x948acb)[_0x97fe('0x3e')](_0x97fe('0x3f'),'createdAt')[_0x97fe('0x3e')](_0x97fe('0x3f'),_0x97fe('0x40'))[_0x97fe('0x49')](_0x97fe('0x41'))['where'](_0x97fe('0x4f'))[_0x97fe('0x42')](_0x97fe('0x43'),LISTID[_0x97fe('0x44')]())[_0x97fe('0x42')](_0x97fe('0x4a'),squel[_0x97fe('0x4b')](hopperContacts))[_0x97fe('0x42')](_0x97fe('0x50')))['toString']();return _0x1c6846;}function _0x1a763d(_0x430f5a,_0x439221){var _0x3ded25=squel[_0x97fe('0x47')]()[_0x97fe('0x38')](_0x97fe('0x51'))[_0x97fe('0x3a')](['phone',_0x97fe('0x48'),'ListId',_0x439221,_0x97fe('0x3d'),_0x97fe('0x40')],squel['select']()[_0x97fe('0x3e')]('phone',_0x97fe('0x23'))[_0x97fe('0x3e')]('id',_0x97fe('0x48'))[_0x97fe('0x3e')](LISTID[_0x97fe('0x44')](),'ListId')[_0x97fe('0x3e')](_0x430f5a['id']['toString'](),_0x439221)['field'](_0x97fe('0x3f'),_0x97fe('0x3d'))['field'](_0x97fe('0x3f'),_0x97fe('0x40'))['from'](_0x97fe('0x41'))[_0x97fe('0x42')](_0x97fe('0x4f'))[_0x97fe('0x42')](_0x97fe('0x43'),LISTID[_0x97fe('0x44')]())[_0x97fe('0x42')](_0x97fe('0x4a'),squel[_0x97fe('0x4b')](hopperContacts))[_0x97fe('0x42')](_0x97fe('0x50')))[_0x97fe('0x44')]();return _0x3ded25;}return db['VoiceQueue'][_0x97fe('0x52')]({'where':{'type':_0x97fe('0x53')},'attributes':['id',_0x97fe('0x54')],'include':[{'model':db[_0x97fe('0x55')],'as':'Lists','where':{'id':LISTID}}]})[_0x97fe('0x30')](function(_0x751d1c){var _0x24bc93=[];if(_0x751d1c){var _0x318bdc;for(var _0x4b0a7d=0x0,_0xfb56c9;_0x4b0a7d<_0x751d1c[_0x97fe('0x1e')];_0x4b0a7d+=0x1){_0xfb56c9=_0x751d1c[_0x4b0a7d]['get']({'plain':!![]});switch(_0xfb56c9[_0x97fe('0x54')]){case'always':_0x24bc93['push'](db['sequelize']['query'](_0x37557f(_0xfb56c9,_0x97fe('0x56')))[_0x97fe('0x30')](function(){})[_0x97fe('0x33')](_0x5370fe()));break;case _0x97fe('0x57'):_0x24bc93['push'](db[_0x97fe('0x58')][_0x97fe('0x59')](_0x9225a1(_0xfb56c9,_0x97fe('0x56')))['then'](function(){})['catch'](_0x5370fe()));break;default:_0x24bc93[_0x97fe('0x31')](db['sequelize']['query'](_0x2eaac9(_0xfb56c9,_0x97fe('0x56')))[_0x97fe('0x30')](function(){})[_0x97fe('0x33')](_0x5370fe()));}}}return _0x24bc93;})[_0x97fe('0x5a')]()[_0x97fe('0x30')](function(){return db['VoiceQueue']['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x97fe('0x55')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x97fe('0x30')](function(_0x20ffd5){var _0x5d4eb2=[];if(_0x20ffd5){var _0x49dea8;for(var _0x17370e=0x0,_0x56b7ae;_0x17370e<_0x20ffd5['length'];_0x17370e+=0x1){_0x56b7ae=_0x20ffd5[_0x17370e][_0x97fe('0x5b')]({'plain':!![]});_0x5d4eb2[_0x97fe('0x31')](db[_0x97fe('0x58')][_0x97fe('0x59')](_0x1a763d(_0x56b7ae,_0x97fe('0x56')))[_0x97fe('0x30')](function(){})['catch'](_0x5370fe()));}}return _0x5d4eb2;})[_0x97fe('0x5a')]();})['then'](function(){return db['Campaign'][_0x97fe('0x52')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0x97fe('0x5c'),'where':{'id':LISTID}}]})[_0x97fe('0x30')](function(_0x13f533){var _0x23fe09=[];if(_0x13f533){for(var _0x2c338a=0x0,_0x298999;_0x2c338a<_0x13f533[_0x97fe('0x1e')];_0x2c338a+=0x1){_0x298999=_0x13f533[_0x2c338a][_0x97fe('0x5b')]({'plain':!![]});switch(_0x298999[_0x97fe('0x54')]){case _0x97fe('0x5d'):_0x23fe09['push'](db[_0x97fe('0x58')][_0x97fe('0x59')](_0x37557f(_0x298999,_0x97fe('0x5e')))[_0x97fe('0x30')](function(){})[_0x97fe('0x33')](_0x5370fe()));break;case _0x97fe('0x57'):_0x23fe09[_0x97fe('0x31')](db[_0x97fe('0x58')]['query'](_0x9225a1(_0x298999,_0x97fe('0x5e')))[_0x97fe('0x30')](function(){})[_0x97fe('0x33')](_0x5370fe()));break;default:_0x23fe09['push'](db[_0x97fe('0x58')][_0x97fe('0x59')](_0x2eaac9(_0x298999,_0x97fe('0x5e')))[_0x97fe('0x30')](function(){})[_0x97fe('0x33')](_0x5370fe()));}}}return _0x23fe09;})[_0x97fe('0x5a')]();})[_0x97fe('0x30')](function(){return db['Campaign'][_0x97fe('0x52')]({'attributes':['id'],'include':[{'model':db[_0x97fe('0x55')],'as':_0x97fe('0x5f'),'where':{'id':LISTID}}]})[_0x97fe('0x30')](function(_0x5cccfe){var _0x553412=[];if(_0x5cccfe){for(var _0xbfc035=0x0,_0x5ecdda;_0xbfc035<_0x5cccfe[_0x97fe('0x1e')];_0xbfc035+=0x1){_0x5ecdda=_0x5cccfe[_0xbfc035][_0x97fe('0x5b')]({'plain':!![]});_0x553412['push'](db[_0x97fe('0x58')][_0x97fe('0x59')](_0x1a763d(_0x5ecdda,_0x97fe('0x5e')))['then'](function(){})[_0x97fe('0x33')](_0x5370fe()));}}return _0x553412;})[_0x97fe('0x5a')]();})[_0x97fe('0x33')](function(_0x3a8956){logger[_0x97fe('0x17')](_0x97fe('0x60'),'generalCheckHopper',_0x3a8956[_0x97fe('0x34')]);});}var processPromises=function(_0x15ac09){return BPromise[_0x97fe('0x5a')](promises)['then'](function(_0x2cfe4d){})[_0x97fe('0x33')](function(_0x55406e){logger[_0x97fe('0x17')](_0x97fe('0x61'),JSON[_0x97fe('0x35')](_0x55406e));})['finally'](function(){socket[_0x97fe('0x62')](_0x97fe('0x63')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x15ac09){return _0x15ac09[_0x97fe('0x64')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x97fe('0x30')](function(){if(hopperContacts){return checkHopper();}})[_0x97fe('0x30')](function(){socket[_0x97fe('0x62')](_0x97fe('0x63')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x55a93b){logger['error'](_0x97fe('0x65'),JSON['stringify'](_0x55a93b));}finally{process[_0x97fe('0x66')](0x0);}});};process['on'](_0x97fe('0x67'),function(){logger[_0x97fe('0x68')](_0x97fe('0x69'));endCsv();});function main(){return BPromise[_0x97fe('0x6a')]()[_0x97fe('0x30')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x97fe('0x14')](',');return db[_0x97fe('0x2e')][_0x97fe('0x52')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x97fe('0x30')](function(_0x26de7d){var _0x316697=fs[_0x97fe('0x6b')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x97fe('0x6c')](_0x316697,{'header':!![],'skipEmptyLines':!![],'step':function(_0x14d8a7,_0x50db84){total+=0x1;var _0x1bbfd6=total;promises[_0x97fe('0x31')](checkRow(_0x14d8a7,_0x26de7d,_0x1bbfd6)[_0x97fe('0x30')](function(){success+=0x1;})['catch'](function(_0x3efae2){if(_0x3efae2[_0x97fe('0x17')]){errors+=0x1;delete _0x3efae2['error'];}else if(_0x3efae2['duplicate']){duplicates+=0x1;delete _0x3efae2['duplicate'];}rows['push'](_0x3efae2);}));if(total%0xc8===0x0){_0x50db84[_0x97fe('0x6d')]();return processPromises(_0x50db84);}},'complete':function(){return processPromises()[_0x97fe('0x30')](function(){logger[_0x97fe('0x68')](_0x97fe('0x6e'));endCsv();});},'error':function(_0x32ea9e,_0x569e99){logger[_0x97fe('0x68')]('CSV\x20parse\x20error',JSON['stringify'](_0x32ea9e));endCsv();}});})['catch'](function(_0x5e7ccc){logger[_0x97fe('0x17')](_0x97fe('0x6f'),JSON['stringify'](_0x5e7ccc));});}main(); \ No newline at end of file +var _0xf6cf=['cm_contacts','cm_hopper_black','outbound','CmList','Lists','then','get','dialCheckDuplicateType','always','sequelize','VoiceQueueId','query','all','VoiceQueue','BlackLists','Campaign','CampaignId','findAll','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','contact:csv_','resume','resolve','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','CSV\x20import\x20process\x20stopped!','parse','duplicate','pause','CSV\x20parsed\x20correctly!','info','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','api','defaults','localhost','socket.io-emitter','redis','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','message','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','length','find','Duplicate\x20Contact','create','keys','push','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','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(?)','from','insert','id\x20IN\x20?','str','cm_hopper_final','\x20=\x20?'];(function(_0x5e678b,_0x2150a5){var _0x21f9f6=function(_0x7b30a9){while(--_0x7b30a9){_0x5e678b['push'](_0x5e678b['shift']());}};_0x21f9f6(++_0x2150a5);}(_0xf6cf,0x91));var _0xff6c=function(_0x2b7c8f,_0x30566c){_0x2b7c8f=_0x2b7c8f-0x0;var _0x3997f0=_0xf6cf[_0x2b7c8f];return _0x3997f0;};'use strict';var BPromise=require(_0xff6c('0x0'));var util=require(_0xff6c('0x1'));var _=require(_0xff6c('0x2'));var fs=require('fs');var squel=require(_0xff6c('0x3'));var Papa=require(_0xff6c('0x4'));var Redis=require(_0xff6c('0x5'));var db=require(_0xff6c('0x6'))['db'];var config=require(_0xff6c('0x7'));var logger=require('../../../config/logger')(_0xff6c('0x8'));config['redis']=_[_0xff6c('0x9')](config['redis'],{'host':_0xff6c('0xa'),'port':0x18eb});var socket=require(_0xff6c('0xb'))(new Redis(config[_0xff6c('0xc')]));require('../../../api/cmContact/cmContact.socket')[_0xff6c('0xd')](socket);try{if(!process[_0xff6c('0xe')][0x2]||process[_0xff6c('0xe')][0x2]===_0xff6c('0xf')||process['argv'][0x2]===_0xff6c('0x10')){throw new Error(_0xff6c('0x11'));}var FILEPATH=process['argv'][0x2];if(!process['argv'][0x3]||process['argv'][0x3]==='undefined'||process[_0xff6c('0xe')][0x3]==='null'||!process['argv'][0x4]||process[_0xff6c('0xe')][0x4]===_0xff6c('0xf')||process[_0xff6c('0xe')][0x4]===_0xff6c('0x10')){throw new Error(_0xff6c('0x12'));}var FIELDS=_[_0xff6c('0x13')](process[_0xff6c('0xe')][0x3][_0xff6c('0x14')](','),process[_0xff6c('0xe')][0x4][_0xff6c('0x14')](','));if(!process[_0xff6c('0xe')][0x5]||process[_0xff6c('0xe')][0x5]===_0xff6c('0xf')||process[_0xff6c('0xe')][0x5]===_0xff6c('0x10')){throw new Error(_0xff6c('0x15'));}var LISTID=process['argv'][0x5];var COMPANYID=process['argv'][0x6]&&process[_0xff6c('0xe')][0x6]!==_0xff6c('0xf')&&process[_0xff6c('0xe')][0x6]!==_0xff6c('0x10')?process['argv'][0x6]:null;var DUPLICATES=process[_0xff6c('0xe')][0x7]&&process['argv'][0x7]!=='undefined'&&process[_0xff6c('0xe')][0x7]!=='null'?process[_0xff6c('0xe')][0x7]:null;if(!process[_0xff6c('0xe')][0x8]||process[_0xff6c('0xe')][0x8]===_0xff6c('0xf')||process[_0xff6c('0xe')][0x8]===_0xff6c('0x10')){throw new Error(_0xff6c('0x16'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x45ce21){logger[_0xff6c('0x17')](_0x45ce21);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(_0x112edd,_0x4d7b25,_0x204b59,_0x29682e){var _0x43af85={'message':_0x4d7b25};_0x43af85[_0x112edd]=!![];if(_0x204b59){_0x43af85[_0xff6c('0x18')]=_0x204b59;}if(_0x29682e){_0x43af85[_0xff6c('0x19')]=_0x29682e;}return _0x43af85;}function isEmail(_0x1a6f65){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))*$/[_0xff6c('0x1a')](_0x1a6f65);}function checkRow(_0x300535,_0x151ea0,_0x4720d9){return new BPromise(function(_0x216d29,_0x3ef6af){if(_[_0xff6c('0x1b')](_0x300535)){return _0x3ef6af(handleCheckRowError(_0xff6c('0x17'),_0xff6c('0x1c'),null,_0x4720d9));}if(_0x300535[_0xff6c('0x1d')]&&_0x300535[_0xff6c('0x1d')]['length']){var _0x3d4be6=_['map'](_0x300535[_0xff6c('0x1d')],_0xff6c('0x1e'))['join'](';');return _0x3ef6af(handleCheckRowError('error',_0x3d4be6,null,_0x4720d9));}var _0x30d48f={};for(var _0x358edb in FIELDS){if(FIELDS['hasOwnProperty'](_0x358edb)&&FIELDS[_0x358edb]){_0x30d48f[_0x358edb]=_0x300535[_0xff6c('0x1f')][0x0][FIELDS[_0x358edb]]||_0x300535[_0xff6c('0x1f')][0x0]['\ufeff'+FIELDS[_0x358edb]];}}if(!_0x30d48f[_0xff6c('0x20')]){return _0x3ef6af(handleCheckRowError('error',_0xff6c('0x21'),null,_0x4720d9));}if(!_0x30d48f[_0xff6c('0x22')]){return _0x3ef6af(handleCheckRowError('error',_0xff6c('0x23'),null,_0x4720d9));}if(_0x30d48f['birthDate']){var _0x2d49cf=moment(_0x30d48f[_0xff6c('0x24')],_0xff6c('0x25'));if(!_0x2d49cf[_0xff6c('0x26')]()){return _0x3ef6af(handleCheckRowError(_0xff6c('0x17'),_0xff6c('0x27'),null,_0x4720d9));}}if(_0x30d48f['email']){if(!isEmail(_0x30d48f['email'])){return _0x3ef6af(handleCheckRowError('error',_0xff6c('0x28'),null,_0x4720d9));}}_0x30d48f[_0xff6c('0x29')]=LISTID;_0x30d48f[_0xff6c('0x2a')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xff6c('0x2b')]&&_0x151ea0){var _0x3b479b={};for(var _0x23c412=0x0,_0x353fbe=DUPLICATES[_0xff6c('0x2b')];_0x23c412<_0x353fbe;_0x23c412+=0x1){_0x3b479b[DUPLICATES[_0x23c412]]=_0x30d48f[DUPLICATES[_0x23c412]];}var _0x109978=_[_0xff6c('0x2c')](_0x151ea0,_0x3b479b);if(_0x109978){return _0x3ef6af(handleCheckRowError('duplicate',_0xff6c('0x2d'),_0x109978,_0x4720d9));}}return db['CmContact'][_0xff6c('0x2e')](_0x30d48f,{'raw':!![],'hooks':![],'fields':_[_0xff6c('0x2f')](_0x30d48f)})['then'](function(_0x1fcb90){if(DUPLICATES&&DUPLICATES[_0xff6c('0x2b')]&&_0x151ea0){_0x151ea0[_0xff6c('0x30')](_['pick'](_0x30d48f,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x1fcb90['id'];return _0x216d29();})[_0xff6c('0x31')](function(_0x2c5267){return _0x3ef6af(handleCheckRowError(_0xff6c('0x17'),_0xff6c('0x32')+(_0x2c5267[_0xff6c('0x1e')]||JSON[_0xff6c('0x33')](_0x2c5267)),null,_0x4720d9));});});}function checkHopper(){function _0x1d72e1(){return function(_0xa6f06b){logger[_0xff6c('0x17')](_0xff6c('0x34'),_0xff6c('0x35'),util[_0xff6c('0x36')](_0xa6f06b,{'showHidden':![],'depth':null}));};}var _0x1c8e73=function(_0x23b36b,_0x49222b){var _0x1b5227=squel['insert']()[_0xff6c('0x37')](_0xff6c('0x38'))[_0xff6c('0x39')](['phone',_0xff6c('0x3a'),_0xff6c('0x3b'),_0xff6c('0x29'),_0x49222b,_0xff6c('0x3c'),_0xff6c('0x3d')],squel[_0xff6c('0x3e')]()[_0xff6c('0x3f')](_0xff6c('0x22'),_0xff6c('0x22'))[_0xff6c('0x3f')](_0xff6c('0x40'),_0xff6c('0x3a'))['field']('id',_0xff6c('0x3b'))['field'](LISTID[_0xff6c('0x41')](),_0xff6c('0x29'))[_0xff6c('0x3f')](_0x23b36b['id']['toString'](),_0x49222b)[_0xff6c('0x3f')]('NOW()',_0xff6c('0x3c'))[_0xff6c('0x3f')](_0xff6c('0x40'),_0xff6c('0x3d'))['from']('cm_contacts')[_0xff6c('0x42')](_0xff6c('0x43'))['where'](_0xff6c('0x44'),LISTID[_0xff6c('0x41')]())[_0xff6c('0x42')](_0xff6c('0x45'))[_0xff6c('0x42')](_0xff6c('0x46'),squel[_0xff6c('0x3e')]()['field'](_0xff6c('0x22'))[_0xff6c('0x47')](_0xff6c('0x38'))[_0xff6c('0x42')](_0x49222b+'\x20=\x20?',_0x23b36b['id']['toString']())))[_0xff6c('0x41')]();return _0x1b5227;};var _0x5f4116=function(_0x28ec53,_0x32342b){var _0x482117=squel[_0xff6c('0x48')]()['into']('cm_hopper')['fromQuery']([_0xff6c('0x22'),'scheduledAt','ContactId',_0xff6c('0x29'),_0x32342b,_0xff6c('0x3c'),'updatedAt'],squel['select']()[_0xff6c('0x3f')](_0xff6c('0x22'),_0xff6c('0x22'))[_0xff6c('0x3f')]('NOW()',_0xff6c('0x3a'))['field']('id',_0xff6c('0x3b'))['field'](LISTID[_0xff6c('0x41')](),'ListId')[_0xff6c('0x3f')](_0x28ec53['id'][_0xff6c('0x41')](),_0x32342b)[_0xff6c('0x3f')](_0xff6c('0x40'),'createdAt')[_0xff6c('0x3f')](_0xff6c('0x40'),_0xff6c('0x3d'))[_0xff6c('0x47')]('cm_contacts')[_0xff6c('0x42')](_0xff6c('0x43'))[_0xff6c('0x42')](_0xff6c('0x44'),LISTID[_0xff6c('0x41')]())['where'](_0xff6c('0x49'),squel[_0xff6c('0x4a')](hopperContacts))[_0xff6c('0x42')](_0xff6c('0x45'))[_0xff6c('0x42')](_0xff6c('0x46'),squel[_0xff6c('0x3e')]()[_0xff6c('0x3f')]('calleridnum')[_0xff6c('0x47')](_0xff6c('0x4b'))['where'](_0x32342b+_0xff6c('0x4c'),_0x28ec53['id'][_0xff6c('0x41')]()))[_0xff6c('0x42')](_0xff6c('0x46'),squel[_0xff6c('0x3e')]()[_0xff6c('0x3f')]('phone')['from'](_0xff6c('0x38'))[_0xff6c('0x42')](_0x32342b+_0xff6c('0x4c'),_0x28ec53['id'][_0xff6c('0x41')]())))[_0xff6c('0x41')]();return _0x482117;};function _0x1c0ecd(_0x4c743d,_0x293096){var _0x5e8804=squel[_0xff6c('0x48')]()[_0xff6c('0x37')](_0xff6c('0x38'))['fromQuery']([_0xff6c('0x22'),_0xff6c('0x3a'),'ContactId',_0xff6c('0x29'),_0x293096,_0xff6c('0x3c'),_0xff6c('0x3d')],squel[_0xff6c('0x3e')]()['field'](_0xff6c('0x22'),_0xff6c('0x22'))[_0xff6c('0x3f')](_0xff6c('0x40'),'scheduledAt')[_0xff6c('0x3f')]('id',_0xff6c('0x3b'))['field'](LISTID[_0xff6c('0x41')](),_0xff6c('0x29'))[_0xff6c('0x3f')](_0x4c743d['id'][_0xff6c('0x41')](),_0x293096)[_0xff6c('0x3f')](_0xff6c('0x40'),_0xff6c('0x3c'))['field'](_0xff6c('0x40'),_0xff6c('0x3d'))[_0xff6c('0x47')](_0xff6c('0x4d'))[_0xff6c('0x42')](_0xff6c('0x43'))[_0xff6c('0x42')](_0xff6c('0x44'),LISTID[_0xff6c('0x41')]())[_0xff6c('0x42')](_0xff6c('0x49'),squel[_0xff6c('0x4a')](hopperContacts))[_0xff6c('0x42')](_0xff6c('0x45')))[_0xff6c('0x41')]();return _0x5e8804;}function _0x1debed(_0x13b2da,_0x3c897c){var _0x50185d=squel[_0xff6c('0x48')]()['into'](_0xff6c('0x4e'))[_0xff6c('0x39')](['phone','ContactId',_0xff6c('0x29'),_0x3c897c,'createdAt','updatedAt'],squel[_0xff6c('0x3e')]()['field']('phone','phone')[_0xff6c('0x3f')]('id','ContactId')[_0xff6c('0x3f')](LISTID[_0xff6c('0x41')](),_0xff6c('0x29'))[_0xff6c('0x3f')](_0x13b2da['id'][_0xff6c('0x41')](),_0x3c897c)[_0xff6c('0x3f')]('NOW()',_0xff6c('0x3c'))['field'](_0xff6c('0x40'),_0xff6c('0x3d'))[_0xff6c('0x47')](_0xff6c('0x4d'))['where'](_0xff6c('0x43'))[_0xff6c('0x42')]('ListId\x20=\x20?',LISTID['toString']())[_0xff6c('0x42')](_0xff6c('0x49'),squel[_0xff6c('0x4a')](hopperContacts))[_0xff6c('0x42')](_0xff6c('0x45')))[_0xff6c('0x41')]();return _0x50185d;}return db['VoiceQueue']['findAll']({'where':{'type':_0xff6c('0x4f')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xff6c('0x50')],'as':_0xff6c('0x51'),'where':{'id':LISTID}}]})[_0xff6c('0x52')](function(_0x5b3d77){var _0x3338dd=[];if(_0x5b3d77){var _0x51d5d2;for(var _0x4ba626=0x0,_0x1ada91;_0x4ba626<_0x5b3d77[_0xff6c('0x2b')];_0x4ba626+=0x1){_0x1ada91=_0x5b3d77[_0x4ba626][_0xff6c('0x53')]({'plain':!![]});switch(_0x1ada91[_0xff6c('0x54')]){case _0xff6c('0x55'):_0x3338dd[_0xff6c('0x30')](db[_0xff6c('0x56')]['query'](_0x5f4116(_0x1ada91,_0xff6c('0x57')))[_0xff6c('0x52')](function(){})[_0xff6c('0x31')](_0x1d72e1()));break;case'onlyIfOpen':_0x3338dd[_0xff6c('0x30')](db[_0xff6c('0x56')][_0xff6c('0x58')](_0x1c8e73(_0x1ada91,'VoiceQueueId'))[_0xff6c('0x52')](function(){})[_0xff6c('0x31')](_0x1d72e1()));break;default:_0x3338dd['push'](db[_0xff6c('0x56')][_0xff6c('0x58')](_0x1c0ecd(_0x1ada91,_0xff6c('0x57')))['then'](function(){})[_0xff6c('0x31')](_0x1d72e1()));}}}return _0x3338dd;})[_0xff6c('0x59')]()[_0xff6c('0x52')](function(){return db[_0xff6c('0x5a')]['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xff6c('0x5b'),'where':{'id':LISTID}}]})[_0xff6c('0x52')](function(_0x453fbe){var _0xcd0ae2=[];if(_0x453fbe){var _0x29b76c;for(var _0x62caab=0x0,_0x4f9b7f;_0x62caab<_0x453fbe[_0xff6c('0x2b')];_0x62caab+=0x1){_0x4f9b7f=_0x453fbe[_0x62caab][_0xff6c('0x53')]({'plain':!![]});_0xcd0ae2['push'](db[_0xff6c('0x56')][_0xff6c('0x58')](_0x1debed(_0x4f9b7f,'VoiceQueueId'))['then'](function(){})[_0xff6c('0x31')](_0x1d72e1()));}}return _0xcd0ae2;})[_0xff6c('0x59')]();})[_0xff6c('0x52')](function(){return db[_0xff6c('0x5c')]['findAll']({'attributes':['id',_0xff6c('0x54')],'include':[{'model':db[_0xff6c('0x50')],'as':_0xff6c('0x51'),'where':{'id':LISTID}}]})[_0xff6c('0x52')](function(_0x3f7657){var _0x1c04cd=[];if(_0x3f7657){for(var _0x3a6d2b=0x0,_0x4093a6;_0x3a6d2b<_0x3f7657['length'];_0x3a6d2b+=0x1){_0x4093a6=_0x3f7657[_0x3a6d2b][_0xff6c('0x53')]({'plain':!![]});switch(_0x4093a6[_0xff6c('0x54')]){case'always':_0x1c04cd['push'](db['sequelize']['query'](_0x5f4116(_0x4093a6,'CampaignId'))[_0xff6c('0x52')](function(){})[_0xff6c('0x31')](_0x1d72e1()));break;case'onlyIfOpen':_0x1c04cd[_0xff6c('0x30')](db[_0xff6c('0x56')][_0xff6c('0x58')](_0x1c8e73(_0x4093a6,_0xff6c('0x5d')))[_0xff6c('0x52')](function(){})[_0xff6c('0x31')](_0x1d72e1()));break;default:_0x1c04cd[_0xff6c('0x30')](db[_0xff6c('0x56')][_0xff6c('0x58')](_0x1c0ecd(_0x4093a6,_0xff6c('0x5d')))['then'](function(){})[_0xff6c('0x31')](_0x1d72e1()));}}}return _0x1c04cd;})[_0xff6c('0x59')]();})[_0xff6c('0x52')](function(){return db['Campaign'][_0xff6c('0x5e')]({'attributes':['id'],'include':[{'model':db[_0xff6c('0x50')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xff6c('0x52')](function(_0x231cfa){var _0x3a1f2e=[];if(_0x231cfa){for(var _0x404837=0x0,_0x2e5081;_0x404837<_0x231cfa[_0xff6c('0x2b')];_0x404837+=0x1){_0x2e5081=_0x231cfa[_0x404837][_0xff6c('0x53')]({'plain':!![]});_0x3a1f2e[_0xff6c('0x30')](db[_0xff6c('0x56')]['query'](_0x1debed(_0x2e5081,_0xff6c('0x5d')))[_0xff6c('0x52')](function(){})['catch'](_0x1d72e1()));}}return _0x3a1f2e;})['all']();})['catch'](function(_0x39b520){logger['error'](_0xff6c('0x5f'),_0xff6c('0x60'),_0x39b520['message']);});}var processPromises=function(_0x201964){return BPromise[_0xff6c('0x59')](promises)['then'](function(_0x5058f8){})['catch'](function(_0xb05fd9){logger[_0xff6c('0x17')](_0xff6c('0x61'),JSON[_0xff6c('0x33')](_0xb05fd9));})[_0xff6c('0x62')](function(){socket['emit'](_0xff6c('0x63')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x201964){return _0x201964[_0xff6c('0x64')]();}});};var endCsv=function(){return BPromise[_0xff6c('0x65')]()[_0xff6c('0x52')](function(){if(hopperContacts){return checkHopper();}})[_0xff6c('0x52')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x41b25c){logger[_0xff6c('0x17')](_0xff6c('0x66'),JSON[_0xff6c('0x33')](_0x41b25c));}finally{process['exit'](0x0);}});};process['on'](_0xff6c('0x67'),function(){logger['info'](_0xff6c('0x68'));endCsv();});function main(){return BPromise[_0xff6c('0x65')]()[_0xff6c('0x52')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xff6c('0x14')](',');return db['CmContact']['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x4e8eb8){var _0x1b1064=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xff6c('0x69')](_0x1b1064,{'header':!![],'skipEmptyLines':!![],'step':function(_0x53ab6b,_0x28fca8){total+=0x1;var _0x13f0e9=total;promises[_0xff6c('0x30')](checkRow(_0x53ab6b,_0x4e8eb8,_0x13f0e9)[_0xff6c('0x52')](function(){success+=0x1;})[_0xff6c('0x31')](function(_0x4eb8f4){if(_0x4eb8f4[_0xff6c('0x17')]){errors+=0x1;delete _0x4eb8f4['error'];}else if(_0x4eb8f4[_0xff6c('0x6a')]){duplicates+=0x1;delete _0x4eb8f4[_0xff6c('0x6a')];}rows[_0xff6c('0x30')](_0x4eb8f4);}));if(total%0xc8===0x0){_0x28fca8[_0xff6c('0x6b')]();return processPromises(_0x28fca8);}},'complete':function(){return processPromises()[_0xff6c('0x52')](function(){logger['info'](_0xff6c('0x6c'));endCsv();});},'error':function(_0x5d6005,_0x343ec2){logger[_0xff6c('0x6d')]('CSV\x20parse\x20error',JSON[_0xff6c('0x33')](_0x5d6005));endCsv();}});})[_0xff6c('0x31')](function(_0x129d8d){logger['error'](_0xff6c('0x6e'),JSON[_0xff6c('0x33')](_0x129d8d));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index a5c0a11..85fceda 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 _0xac9f=['voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','campaigns','each','affectedRows','contact:import:','unlink','complete','argv','arguments\x20\x20\x20','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','lodash','papaparse','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','CmContact','findAll','AdditionalPhones','length','push','all','then','split','findOne','CmContactHasItem','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.UserId','into','cm_hopper','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','cm_contacts','.CmListId','cm_contacts.createdAt\x20=\x20?','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_contacts.updatedAt','insert','cm_hopper_black','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','select','\x20=\x20?','toString','cm_contact_has_items.createdAt','cm_hopper_additional_phones','fromQuery','CmHopperId','OrderBy','fields','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','group','Received\x20SIGINT','message','exit','errors','sequelize','query','spread','catch','error','info','main','stringify','start','binding','clone','socket_timestamp','root','server/files/tmp','.csv','body','ContactItemType','name','_description','header','writeFileSync','parse','createReadStream','data','rows','find','isNil','hasOwnProperty','trim','replace','scheduledat','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','\x20not\x20specified','itemTypeId','description','SystemRow','emit','Abort\x20parser','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','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','contactId','contactTypeId','orderBy','voice_queues_has_cm_lists'];(function(_0x561d8f,_0x457076){var _0x21d9f0=function(_0xf1681f){while(--_0xf1681f){_0x561d8f['push'](_0x561d8f['shift']());}};_0x21d9f0(++_0x457076);}(_0xac9f,0x15e));var _0xfac9=function(_0x3ba6ef,_0x37af5d){_0x3ba6ef=_0x3ba6ef-0x0;var _0x1f983e=_0xac9f[_0x3ba6ef];return _0x1f983e;};'use strict';var fs=require('fs');var path=require(_0xfac9('0x0'));var _=require(_0xfac9('0x1'));var Papa=require(_0xfac9('0x2'));var util=require(_0xfac9('0x3'));var BPromise=require('bluebird');var moment=require(_0xfac9('0x4'));var squel=require(_0xfac9('0x5'));var Redis=require(_0xfac9('0x6'));var db=require(_0xfac9('0x7'))['db'];var config=require(_0xfac9('0x8'));var logger=require(_0xfac9('0x9'))('import');config[_0xfac9('0xa')]=_['defaults'](config[_0xfac9('0xa')],{'host':_0xfac9('0xb'),'port':0x18eb});var socket=require(_0xfac9('0xc'))(new Redis(config[_0xfac9('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xfac9('0xd')](_0xfac9('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x2a8b05){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))*$/[_0xfac9('0xf')](_0x2a8b05);}function selectNotIn(_0x2430dd,_0x154c99,_0x2fa86b,_0x51a8e8,_0x34c625){return squel['select']()[_0xfac9('0x10')](_0xfac9('0x11'))[_0xfac9('0x12')](_0x51a8e8)[_0xfac9('0x13')](_0x154c99,null,_0x154c99+_0xfac9('0x14')+_0x51a8e8+'.'+_0x2fa86b)[_0xfac9('0x15')](_0x51a8e8+'.'+_0x2fa86b+_0xfac9('0x16')+_0x2430dd+'.'+_0x2fa86b)['where'](_0x154c99+'.dialCheckDuplicateType\x20IN\x20('+_0x34c625[_0xfac9('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x3e1d9b,_0x577281){promisesAdditionalPhones=[];return db[_0xfac9('0x17')][_0xfac9('0x18')]({'raw':!![],'attributes':['id',_0xfac9('0x19')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0x5c94d3){if(_0x5c94d3!==null){var _0x156913=[];for(var _0x383a3b=0x0;_0x383a3b<_0x5c94d3[_0xfac9('0x1a')];_0x383a3b++){var _0x1d27bd=_0x5c94d3[_0x383a3b];_0x156913[_0xfac9('0x1b')](insertAdditionalPhones(_0x1d27bd));}}Promise[_0xfac9('0x1c')](_0x156913)[_0xfac9('0x1d')](function(){_0x3e1d9b({'val':0x1});});});});}function insertAdditionalPhones(_0xb274ec){return new Promise(function(_0x4bc3e7,_0x2ba9be){var _0x507286=_0xb274ec[_0xfac9('0x19')];var _0x41acae=_0x507286[_0xfac9('0x1e')](';');var _0x42435d=[];orderBy=0x0;for(var _0x5d4a37=0x0;_0x5d4a37<_0x41acae[_0xfac9('0x1a')];_0x5d4a37++){_0x42435d['push'](splitAdditionalPhone(_0xb274ec['id'],_0x41acae[_0x5d4a37]));}Promise[_0xfac9('0x1c')](_0x42435d)[_0xfac9('0x1d')](function(){_0x4bc3e7({'val':_0x41acae[_0xfac9('0x1a')]});});});}function splitAdditionalPhone(_0x5108dd,_0x4a54b1){return new Promise(function(_0x26a036,_0x158603){var _0x26489b=_0x4a54b1[_0xfac9('0x1e')](':');var _0x382f07=_0x26489b[0x0];var _0x418571=_0x26489b[0x1];if(_0x418571!==''){var _0x1807dd=_0x418571['split']('|');var _0x326c2a=[];for(var _0x245fc9=0x0;_0x245fc9<_0x1807dd['length'];_0x245fc9++){if(_0x1807dd[_0x245fc9]!==''){var _0x42a29e=_['filter'](promisesAdditionalPhones,{'contactId':_0x5108dd,'phone':_0x1807dd[_0x245fc9]});if(_0x42a29e[_0xfac9('0x1a')]==0x0){orderBy++;promisesAdditionalPhones[_0xfac9('0x1b')]({'contactId':_0x5108dd,'contactTypeId':_0x382f07,'phone':_0x1807dd[_0x245fc9],'orderBy':orderBy});}}}_0x26a036({'ok':0x1});}else _0x26a036({'res':0x0});});}function createAdditionalPhone(_0x16e9aa,_0x4000e6,_0x173437,_0x52028c){var _0x2017ee='';var _0x1b9ef7='';var _0x482a8b=_0x173437[_0xfac9('0x1e')]('§');_0x2017ee=_0x482a8b[0x0];if(_0x482a8b[_0xfac9('0x1a')]==0x2)_0x1b9ef7=_0x482a8b[0x1];return new Promise(function(_0x3d6deb,_0x1c735b){return db['CmContactHasItem'][_0xfac9('0x1f')]({'where':{'CmContactId':_0x16e9aa,'item':_0x2017ee}})[_0xfac9('0x1d')](function(_0x39a5f5){if(_0x39a5f5){return db[_0xfac9('0x20')]['update']({'ItemTypeId':_0x4000e6,'description':_0x1b9ef7,'OrderBy':_0x52028c},{'where':{'CmContactId':_0x16e9aa,'item':_0x2017ee}})['then'](function(_0x4009a4){_0x3d6deb({'res':'updated'});});}else{return db[_0xfac9('0x20')][_0xfac9('0x21')]({'CmContactId':_0x16e9aa,'item':_0x2017ee,'description':_0x1b9ef7,'ItemTypeId':_0x4000e6,'OrderBy':_0x52028c,'ItemClass':_0xfac9('0x22')})[_0xfac9('0x1d')](function(_0x37d5e8){_0x3d6deb({'res':_0xfac9('0x23')});});}});});}function insertCmHopper(_0xd31f24,_0x28424e,_0x5a69ee,_0x23656d,_0x56d07c){var _0x70c266=[_0xfac9('0x24'),_0xfac9('0x25'),_0xfac9('0x26'),_0xfac9('0x27'),_0x28424e+'.'+_0x23656d,_0xfac9('0x28'),'cm_contacts.updatedAt','cm_contacts.priority',_0xfac9('0x29'),'\x22'+_0x56d07c+'\x22'];return squel['insert']()[_0xfac9('0x2a')](_0xfac9('0x2b'))['fromQuery']([_0xfac9('0x11'),'scheduledat',_0xfac9('0x2c'),_0xfac9('0x2d'),_0x23656d,_0xfac9('0x2e'),_0xfac9('0x2f'),_0xfac9('0x30'),_0xfac9('0x31'),_0xfac9('0x32')],squel['select']()['fields'](_0x70c266)['from'](_0x28424e)[_0xfac9('0x13')](_0xfac9('0x33'),null,'cm_contacts.ListId\x20=\x20'+_0x28424e+_0xfac9('0x34'))[_0xfac9('0x13')](_0x5a69ee,null,_0x5a69ee+_0xfac9('0x14')+_0x28424e+'.'+_0x23656d)[_0xfac9('0x15')](_0x28424e+'.CmListId\x20=\x20?',_0xd31f24)[_0xfac9('0x15')](_0xfac9('0x35'),NOW)[_0xfac9('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x28424e,_0x5a69ee,_0x23656d,'cm_hopper',['\x22always\x22',_0xfac9('0x36')]))['where'](_0xfac9('0x37'),selectNotIn(_0x28424e,_0x5a69ee,_0x23656d,'cm_hopper',['\x22always\x22'])))['toString']();}function insertCmHopperBlack(_0x4e8f1c,_0x253682,_0x331a8e,_0x53adf2){var _0x1df995=[_0xfac9('0x24'),_0xfac9('0x26'),_0xfac9('0x27'),_0x253682+'.'+_0x53adf2,_0xfac9('0x28'),_0xfac9('0x38')];return squel[_0xfac9('0x39')]()['into'](_0xfac9('0x3a'))['fromQuery']([_0xfac9('0x11'),_0xfac9('0x2c'),_0xfac9('0x2d'),_0x53adf2,_0xfac9('0x2e'),_0xfac9('0x2f')],squel['select']()['fields'](_0x1df995)['from'](_0x253682)[_0xfac9('0x13')](_0xfac9('0x33'),null,_0xfac9('0x3b')+_0x253682+_0xfac9('0x34'))[_0xfac9('0x13')](_0x331a8e,null,_0x331a8e+_0xfac9('0x14')+_0x253682+'.'+_0x53adf2)[_0xfac9('0x15')](_0x253682+_0xfac9('0x3c'),_0x4e8f1c)[_0xfac9('0x15')](_0xfac9('0x35'),NOW)[_0xfac9('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xfac9('0x3d')]()[_0xfac9('0x10')]('phone')['from'](_0xfac9('0x3a'))['where']('ListId\x20=\x20?',_0x4e8f1c)[_0xfac9('0x15')](_0x53adf2+_0xfac9('0x3e'),_0x253682+'.'+_0x53adf2)))[_0xfac9('0x3f')]();}function insertCmHopperAdditionalPhones(_0x441567){var _0x9e634f=['cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy',_0xfac9('0x40'),'cm_contact_has_items.updatedAt'];return squel['insert']()[_0xfac9('0x2a')](_0xfac9('0x41'))[_0xfac9('0x42')]([_0xfac9('0x43'),_0xfac9('0x11'),_0xfac9('0x44'),_0xfac9('0x2e'),_0xfac9('0x2f')],squel['select']()[_0xfac9('0x45')](_0x9e634f)[_0xfac9('0x12')](_0xfac9('0x2b'))[_0xfac9('0x13')](_0xfac9('0x33'),null,_0xfac9('0x46'))[_0xfac9('0x13')]('cm_contact_has_items',null,_0xfac9('0x47'))[_0xfac9('0x15')](_0xfac9('0x48'),_0x441567)[_0xfac9('0x15')](_0xfac9('0x35'),NOW))[_0xfac9('0x3f')]();}function insertCmContact(_0x17566a,_0x4a5847,_0x58224a,_0x75a0b6){var _0x528882=_[_0xfac9('0x49')](_[_0xfac9('0x4a')](_0x75a0b6),[_0xfac9('0x2d'),_0xfac9('0x4b'),_0xfac9('0x2e'),'updatedAt']);return squel[_0xfac9('0x39')]()['into'](_0xfac9('0x33'))[_0xfac9('0x42')](_0x528882,squel[_0xfac9('0x3d')]()[_0xfac9('0x45')](_0x528882)['from'](_0x4a5847)[_0xfac9('0x15')]('('+_0x58224a[_0xfac9('0x13')](',')+_0xfac9('0x4c'),squel['select']()['fields'](_0x58224a)[_0xfac9('0x12')]('cm_contacts')[_0xfac9('0x15')]('ListId\x20=\x20?',_0x17566a)['where']('deletedAt\x20IS\x20NULL'))[_0xfac9('0x15')](_0xfac9('0x4d'),squel['select']()[_0xfac9('0x10')](_0xfac9('0x4e'),'min_id')[_0xfac9('0x12')](_0x4a5847)[_0xfac9('0x4f')](_0x58224a[_0xfac9('0x13')](','))))[_0xfac9('0x3f')]();}function handleStop(){logger['info'](_0xfac9('0x50'));stopped=!![];}function handleUncaughtException(_0xe67408){logger['error'](_0xe67408[_0xfac9('0x51')]);process[_0xfac9('0x52')](0x1);}function handleError(_0x2b3d2f,_0x58dc2c){stats[_0xfac9('0x53')][_0xfac9('0x1b')]({'name':_0x58dc2c['code'],'message':_0x58dc2c[_0xfac9('0x51')],'row':_0x2b3d2f});}function handleQuery(_0x4a691d){logger['info'](_0x4a691d);return db[_0xfac9('0x54')][_0xfac9('0x55')](_0x4a691d)[_0xfac9('0x56')](function(_0x4d74c1){results[_0xfac9('0x1b')](_0x4d74c1);})[_0xfac9('0x57')](function(_0x6e4b6a){logger[_0xfac9('0x58')](_0x6e4b6a[_0xfac9('0x51')]);});}function main(_0x352a6c,_0x7f2b9d,_0x1534b7,_0x243bff){logger[_0xfac9('0x59')](_0xfac9('0x5a'),_0x352a6c,JSON[_0xfac9('0x5b')](_0x7f2b9d));process['send'](_0xfac9('0x5c'));var _0x2c126f=_0x7f2b9d[_0xfac9('0x5d')];var _0x41122e=_[_0xfac9('0x5e')](_0x2c126f);var _0x1f083a=_0x7f2b9d[_0xfac9('0x5f')];var _0x270983=path['join'](config[_0xfac9('0x60')],_0xfac9('0x61'),_0x1f083a+_0xfac9('0x62'));logger['info'](_0xfac9('0x63'),_0x7f2b9d);db[_0xfac9('0x64')][_0xfac9('0x18')]({'raw':!![],'attributes':['id','name']})['then'](function(_0x43b59e){for(var _0x5dcb31=0x0;_0x5dcb31<_0x43b59e[_0xfac9('0x1a')];_0x5dcb31++){if(_0x43b59e[_0x5dcb31][_0xfac9('0x65')]in _0x2c126f){contactItemTypes['push'](_0x43b59e[_0x5dcb31]);delete _0x41122e[_0x43b59e[_0x5dcb31]['name']];hasAdditionalPhones=!![];}for(var _0x34589a in _0x2c126f){if(_0x43b59e[_0x5dcb31][_0xfac9('0x65')]+_0xfac9('0x66')===_0x34589a){phoneDescriptions[_0xfac9('0x1b')]({'itemTypeId':_0x43b59e[_0x5dcb31]['id'],'description':_0x34589a});delete _0x41122e[_0x34589a];}}}if(hasAdditionalPhones)_0x41122e[_0xfac9('0x19')]='';var _0x3d0973=_[_0xfac9('0x4a')](_0x41122e)[_0xfac9('0x13')]();logger[_0xfac9('0x59')](_0xfac9('0x67'),_0x3d0973);fs[_0xfac9('0x68')](_0x270983,_0x3d0973+'\x0a');Papa[_0xfac9('0x69')](fs[_0xfac9('0x6a')](_0x352a6c),{'header':!![],'skipEmptyLines':!![],'step':function(_0x4557e8,_0x16ebe9){try{for(var _0x223e9d=0x0,_0x4fbe64=[];_0x223e9d<_0x4557e8[_0xfac9('0x6b')][_0xfac9('0x1a')];_0x223e9d++){stats[_0xfac9('0x6c')]+=0x1;if(_0x4557e8[_0xfac9('0x53')][_0x223e9d]){handleError(_0x4557e8[_0xfac9('0x6b')][_0x223e9d],_0x4557e8[_0xfac9('0x53')][_0x223e9d]);}else{var _0x2dca24=[];var _0x18dba9=[];var _0x113c47={};for(var _0x20f0ec in _0x2c126f){let _0xffc2a7=contactItemTypes[_0xfac9('0x6d')](_0x49e38a=>_0x49e38a[_0xfac9('0x65')]===_0x20f0ec);let _0x3faf29=contactItemTypes[_0xfac9('0x6d')](_0x2d0680=>_0x2d0680[_0xfac9('0x65')]+_0xfac9('0x66')===_0x20f0ec);if(_['isNil'](_0xffc2a7)&&_[_0xfac9('0x6e')](_0x3faf29)){if(_0x2c126f[_0xfac9('0x6f')](_0x20f0ec)){if(_0x4557e8[_0xfac9('0x6b')][_0x223e9d][_0x2c126f[_0x20f0ec]]){var _0xe53834=_[_0xfac9('0x70')](_0x4557e8[_0xfac9('0x6b')][_0x223e9d][_0x2c126f[_0x20f0ec]][_0xfac9('0x71')](/"/g,'\x27'));switch(_0x20f0ec){case _0xfac9('0x72'):var _0x540b32=moment(_0xe53834,_0xfac9('0xe'),!![]);if(_0x540b32[_0xfac9('0x73')]()){_0x4fbe64[_0xfac9('0x1b')]('\x22'+_0xe53834+'\x22');}else{_0x2dca24['push'](_0xfac9('0x74'));}break;case'priority':var _0x42a802=parseInt(_0xe53834);_0xe53834=_[_0xfac9('0x75')](_0x42a802)||_0x42a802<0x0||_0x42a802>0x4?_0x243bff?0x3:0x2:_0x42a802;_0x4fbe64[_0xfac9('0x1b')]('\x22'+_0xe53834+'\x22');break;case _0xfac9('0x31'):var _0x58ca4e=parseInt(_0xe53834);if(_[_0xfac9('0x76')](_0x58ca4e)&&_['includes'](_0x1534b7,_0x58ca4e)){_0x4fbe64[_0xfac9('0x1b')]('\x22'+_0x58ca4e+'\x22');}else{_0x2dca24[_0xfac9('0x1b')](_0xfac9('0x77'));}break;case _0xfac9('0x78'):if(isEmail(_0xe53834)){_0x4fbe64[_0xfac9('0x1b')]('\x22'+_0xe53834+'\x22');}else{_0x2dca24[_0xfac9('0x1b')](_0xfac9('0x79'));}break;case _0xfac9('0x7a'):var _0x46a852=moment(_0xe53834,_0xfac9('0x7b'),!![]);if(_0x46a852[_0xfac9('0x73')]()){_0x4fbe64[_0xfac9('0x1b')]('\x22'+_0xe53834+'\x22');}else{_0x2dca24[_0xfac9('0x1b')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x4fbe64['push']('\x22'+_0xe53834+'\x22');}}else{switch(_0x20f0ec){case'firstName':case _0xfac9('0x11'):_0x2dca24[_0xfac9('0x1b')](_0x20f0ec+_0xfac9('0x7c'));break;default:_0x4fbe64[_0xfac9('0x1b')]('\x22\x22');}}}}else{var _0xef9d80='';if(!_[_0xfac9('0x6e')](_0xffc2a7)){if(!_0x113c47[_0xfac9('0x6f')](_0xffc2a7['id'])){for(var _0xcdad10=0x0;_0xcdad10<_0x2c126f[_0x20f0ec][_0xfac9('0x1a')];_0xcdad10++){var _0xe53834=_[_0xfac9('0x70')](_0x4557e8[_0xfac9('0x6b')][_0x223e9d][_0x2c126f[_0x20f0ec][_0xcdad10]][_0xfac9('0x71')](/"/g,'\x27'));var _0x35a9a9=phoneDescriptions[_0xfac9('0x6d')](_0x362802=>_0x362802[_0xfac9('0x7d')]===_0xffc2a7['id']);if(!_[_0xfac9('0x6e')](_0x35a9a9)){var _0x4d9cb4=_[_0xfac9('0x70')](_0x4557e8[_0xfac9('0x6b')][_0x223e9d][_0x2c126f[_0x35a9a9[_0xfac9('0x7e')]][0x0]]['replace'](/"/g,'\x27'));if(!_[_0xfac9('0x6e')](_0x4d9cb4))_0xe53834=_0xe53834+'§'+_0x4d9cb4;}if(_0xef9d80=='')_0xef9d80=_0xe53834;else _0xef9d80+='|'+_0xe53834;}_0x18dba9[_0xfac9('0x1b')](_0xffc2a7['id']+':'+_0xef9d80);_0x113c47[_0xffc2a7['id']]=0x1;}}}}if(hasAdditionalPhones){_0x4fbe64[_0xfac9('0x1b')]('\x22'+_0x18dba9['join'](';')+'\x22');}if(_0x2dca24['length']){handleError(_0x4557e8[_0xfac9('0x6b')][_0x223e9d],{'code':_0xfac9('0x7f'),'message':_0x2dca24[_0xfac9('0x13')]()});}else{fs['appendFileSync'](_0x270983,_0x4fbe64['join']()+'\x0a');}_0x4fbe64=[];}if(!(stats['rows']%0xc8)){socket[_0xfac9('0x80')]('contact:import:'+_0x1f083a,stats);stats[_0xfac9('0x53')]=[];}}if(stopped){logger['info'](_0xfac9('0x81'));_0x16ebe9['abort']();}}catch(_0x499c29){handleError(_0x4557e8[_0xfac9('0x6b')][_0x223e9d],{'code':_0xfac9('0x82'),'message':_0x499c29['message']});logger[_0xfac9('0x58')](_0xfac9('0x83'),_0x499c29['message']);}},'complete':function(){try{var _0x224c8c=[];var _0x10a5f2=_0xfac9('0x33');if(_0x7f2b9d[_0xfac9('0x84')]&&_0x7f2b9d[_0xfac9('0x84')][_0xfac9('0x1a')]){_0x10a5f2=_0xfac9('0x85')+_0x1f083a;_0x224c8c[_0xfac9('0x1b')](_0xfac9('0x86')+_0x10a5f2+_0xfac9('0x87'));}logger[_0xfac9('0x59')]('CIS\x20len',contactItemTypes[_0xfac9('0x1a')]);var _0x2ae4ea=util[_0xfac9('0xd')](_0xfac9('0x88'),_0x270983,_0x10a5f2,_0x3d0973,_0x7f2b9d[_0xfac9('0x2d')],_0x7f2b9d[_0xfac9('0x4b')]||null,NOW,NOW);if(_['isNil'](_0x2c126f[_0xfac9('0x72')])){_0x2ae4ea+=',\x20scheduledAt\x20=\x20NOW()';}_0x224c8c['push'](_0x2ae4ea);if(_0x7f2b9d[_0xfac9('0x84')]&&_0x7f2b9d[_0xfac9('0x84')][_0xfac9('0x1a')]){_0x224c8c[_0xfac9('0x1b')](insertCmContact(_0x7f2b9d['ListId'],_0x10a5f2,_0x7f2b9d[_0xfac9('0x84')],_0x2c126f));_0x224c8c[_0xfac9('0x1b')](_0xfac9('0x89')+_0x10a5f2+';');}BPromise['each'](_0x224c8c,handleQuery)[_0xfac9('0x1d')](function(_0x1eb3dd){BPromise[_0xfac9('0x1c')]([handleAdditionalPhones()])['then'](function(){_0x224c8c=[];for(var _0x1c383e=0x0;_0x1c383e\x20\x20','root','server/files/tmp','file\x20doesn\x27t\x20exists','parse','binding','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','uncaughtException','path','lodash','papaparse','bluebird','moment','../../../config/environment','import','redis','defaults','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','field','phone','join','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','then','length','push','all','split','CmContactHasItem','update','PHONE','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','priority','UserId','recallme','select','fields','from','cm_contacts.ListId\x20=\x20','.id\x20=\x20','where','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','toString','cm_contacts.phone','cm_contacts.ListId','into','updatedAt','cm_contacts','cm_contacts.createdAt\x20=\x20?','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','min_id','group','info','Received\x20SIGINT','error','message','exit','code','sequelize','query','spread','catch','main','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd6cd,0xe9));var _0xdd6c=function(_0x21469e,_0x286c10){_0x21469e=_0x21469e-0x0;var _0x1efb8c=_0xd6cd[_0x21469e];return _0x1efb8c;};'use strict';var fs=require('fs');var path=require(_0xdd6c('0x0'));var _=require(_0xdd6c('0x1'));var Papa=require(_0xdd6c('0x2'));var util=require('util');var BPromise=require(_0xdd6c('0x3'));var moment=require(_0xdd6c('0x4'));var squel=require('squel');var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require(_0xdd6c('0x5'));var logger=require('../../../config/logger')(_0xdd6c('0x6'));config[_0xdd6c('0x7')]=_[_0xdd6c('0x8')](config[_0xdd6c('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xdd6c('0x9'))(new Redis(config[_0xdd6c('0x7')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xdd6c('0xa')](_0xdd6c('0xb'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x2692fb){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))*$/[_0xdd6c('0xc')](_0x2692fb);}function selectNotIn(_0x2461bc,_0x565e19,_0xa5ba54,_0x45f82a,_0x4711ea){return squel['select']()[_0xdd6c('0xd')](_0xdd6c('0xe'))['from'](_0x45f82a)[_0xdd6c('0xf')](_0x565e19,null,_0x565e19+'.id\x20=\x20'+_0x45f82a+'.'+_0xa5ba54)['where'](_0x45f82a+'.'+_0xa5ba54+'\x20=\x20'+_0x2461bc+'.'+_0xa5ba54)['where'](_0x565e19+_0xdd6c('0x10')+_0x4711ea[_0xdd6c('0xf')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x4650b8,_0x7e4d58){promisesAdditionalPhones=[];return db[_0xdd6c('0x11')][_0xdd6c('0x12')]({'raw':!![],'attributes':['id',_0xdd6c('0x13')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xdd6c('0x14')](function(_0x392ac4){if(_0x392ac4!==null){var _0xf621a2=[];for(var _0x43550a=0x0;_0x43550a<_0x392ac4[_0xdd6c('0x15')];_0x43550a++){var _0x451d59=_0x392ac4[_0x43550a];_0xf621a2[_0xdd6c('0x16')](insertAdditionalPhones(_0x451d59));}}Promise[_0xdd6c('0x17')](_0xf621a2)[_0xdd6c('0x14')](function(){_0x4650b8({'val':0x1});});});});}function insertAdditionalPhones(_0x51786a){return new Promise(function(_0x2e672b,_0x1a2d92){var _0x3c71f8=_0x51786a[_0xdd6c('0x13')];var _0x244235=_0x3c71f8[_0xdd6c('0x18')](';');var _0x51ffdb=[];orderBy=0x0;for(var _0x44e774=0x0;_0x44e774<_0x244235['length'];_0x44e774++){_0x51ffdb[_0xdd6c('0x16')](splitAdditionalPhone(_0x51786a['id'],_0x244235[_0x44e774]));}Promise['all'](_0x51ffdb)['then'](function(){_0x2e672b({'val':_0x244235[_0xdd6c('0x15')]});});});}function splitAdditionalPhone(_0x3bf064,_0x5225d4){return new Promise(function(_0x28cf88,_0x5e5b2b){var _0x422a28=_0x5225d4[_0xdd6c('0x18')](':');var _0x2dd9fa=_0x422a28[0x0];var _0x2e9ea5=_0x422a28[0x1];if(_0x2e9ea5!==''){var _0x5e16db=_0x2e9ea5[_0xdd6c('0x18')]('|');var _0x246151=[];for(var _0x2fca81=0x0;_0x2fca81<_0x5e16db[_0xdd6c('0x15')];_0x2fca81++){if(_0x5e16db[_0x2fca81]!==''){var _0x4ede00=_['filter'](promisesAdditionalPhones,{'contactId':_0x3bf064,'phone':_0x5e16db[_0x2fca81]});if(_0x4ede00[_0xdd6c('0x15')]==0x0){orderBy++;promisesAdditionalPhones[_0xdd6c('0x16')]({'contactId':_0x3bf064,'contactTypeId':_0x2dd9fa,'phone':_0x5e16db[_0x2fca81],'orderBy':orderBy});}}}_0x28cf88({'ok':0x1});}else _0x28cf88({'res':0x0});});}function createAdditionalPhone(_0x21a814,_0x459b30,_0x24fa45,_0x29e456){var _0x2ff17a='';var _0x52e40b='';var _0x1d8df9=_0x24fa45[_0xdd6c('0x18')]('§');_0x2ff17a=_0x1d8df9[0x0];if(_0x1d8df9['length']==0x2)_0x52e40b=_0x1d8df9[0x1];return new Promise(function(_0x491afe,_0x15956c){return db[_0xdd6c('0x19')]['findOne']({'where':{'CmContactId':_0x21a814,'item':_0x2ff17a}})['then'](function(_0x12f777){if(_0x12f777){return db[_0xdd6c('0x19')][_0xdd6c('0x1a')]({'ItemTypeId':_0x459b30,'description':_0x52e40b,'OrderBy':_0x29e456},{'where':{'CmContactId':_0x21a814,'item':_0x2ff17a}})[_0xdd6c('0x14')](function(_0xc8f9f8){_0x491afe({'res':'updated'});});}else{return db['CmContactHasItem']['create']({'CmContactId':_0x21a814,'item':_0x2ff17a,'description':_0x52e40b,'ItemTypeId':_0x459b30,'OrderBy':_0x29e456,'ItemClass':_0xdd6c('0x1b')})[_0xdd6c('0x14')](function(_0xda20c2){_0x491afe({'res':'inserted'});});}});});}function insertCmHopper(_0x5370c2,_0x2d0730,_0x5545e9,_0x20169b,_0x29e9ed){var _0x418c89=['cm_contacts.phone',_0xdd6c('0x1c'),_0xdd6c('0x1d'),'cm_contacts.ListId',_0x2d0730+'.'+_0x20169b,_0xdd6c('0x1e'),_0xdd6c('0x1f'),_0xdd6c('0x20'),_0xdd6c('0x21'),'\x22'+_0x29e9ed+'\x22'];return squel[_0xdd6c('0x22')]()['into'](_0xdd6c('0x23'))[_0xdd6c('0x24')](['phone',_0xdd6c('0x25'),_0xdd6c('0x26'),_0xdd6c('0x27'),_0x20169b,_0xdd6c('0x28'),'updatedAt',_0xdd6c('0x29'),_0xdd6c('0x2a'),_0xdd6c('0x2b')],squel[_0xdd6c('0x2c')]()[_0xdd6c('0x2d')](_0x418c89)[_0xdd6c('0x2e')](_0x2d0730)[_0xdd6c('0xf')]('cm_contacts',null,_0xdd6c('0x2f')+_0x2d0730+'.CmListId')['join'](_0x5545e9,null,_0x5545e9+_0xdd6c('0x30')+_0x2d0730+'.'+_0x20169b)[_0xdd6c('0x31')](_0x2d0730+'.CmListId\x20=\x20?',_0x5370c2)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0xdd6c('0x31')](_0xdd6c('0x32'),selectNotIn(_0x2d0730,_0x5545e9,_0x20169b,_0xdd6c('0x23'),['\x22always\x22',_0xdd6c('0x33')]))[_0xdd6c('0x31')](_0xdd6c('0x32'),selectNotIn(_0x2d0730,_0x5545e9,_0x20169b,_0xdd6c('0x23'),['\x22always\x22'])))[_0xdd6c('0x34')]();}function insertCmHopperBlack(_0x55e79f,_0x1e4805,_0x37bb0d,_0x367df5){var _0x4a5c9d=[_0xdd6c('0x35'),'cm_contacts.id',_0xdd6c('0x36'),_0x1e4805+'.'+_0x367df5,_0xdd6c('0x1e'),'cm_contacts.updatedAt'];return squel[_0xdd6c('0x22')]()[_0xdd6c('0x37')]('cm_hopper_black')['fromQuery'](['phone',_0xdd6c('0x26'),'ListId',_0x367df5,'createdAt',_0xdd6c('0x38')],squel[_0xdd6c('0x2c')]()[_0xdd6c('0x2d')](_0x4a5c9d)[_0xdd6c('0x2e')](_0x1e4805)['join'](_0xdd6c('0x39'),null,'cm_contacts.ListId\x20=\x20'+_0x1e4805+'.CmListId')[_0xdd6c('0xf')](_0x37bb0d,null,_0x37bb0d+_0xdd6c('0x30')+_0x1e4805+'.'+_0x367df5)[_0xdd6c('0x31')](_0x1e4805+'.CmListId\x20=\x20?',_0x55e79f)[_0xdd6c('0x31')](_0xdd6c('0x3a'),NOW)[_0xdd6c('0x31')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xdd6c('0x2c')]()['field'](_0xdd6c('0xe'))[_0xdd6c('0x2e')](_0xdd6c('0x3b'))['where'](_0xdd6c('0x3c'),_0x55e79f)[_0xdd6c('0x31')](_0x367df5+_0xdd6c('0x3d'),_0x1e4805+'.'+_0x367df5)))['toString']();}function insertCmHopperAdditionalPhones(_0x363746){var _0x4e3cc9=[_0xdd6c('0x3e'),_0xdd6c('0x3f'),_0xdd6c('0x40'),'cm_contact_has_items.createdAt',_0xdd6c('0x41')];return squel[_0xdd6c('0x22')]()[_0xdd6c('0x37')](_0xdd6c('0x42'))[_0xdd6c('0x24')]([_0xdd6c('0x43'),'phone',_0xdd6c('0x44'),_0xdd6c('0x28'),_0xdd6c('0x38')],squel[_0xdd6c('0x2c')]()['fields'](_0x4e3cc9)[_0xdd6c('0x2e')](_0xdd6c('0x23'))[_0xdd6c('0xf')](_0xdd6c('0x39'),null,_0xdd6c('0x45'))[_0xdd6c('0xf')](_0xdd6c('0x46'),null,_0xdd6c('0x47'))[_0xdd6c('0x31')](_0xdd6c('0x48'),_0x363746)[_0xdd6c('0x31')](_0xdd6c('0x3a'),NOW))[_0xdd6c('0x34')]();}function insertCmContact(_0x3e7a32,_0x3b10a0,_0x9192cd,_0x558fcd){var _0x48783c=_[_0xdd6c('0x49')](_[_0xdd6c('0x4a')](_0x558fcd),['ListId',_0xdd6c('0x4b'),'createdAt',_0xdd6c('0x38')]);return squel[_0xdd6c('0x22')]()['into'](_0xdd6c('0x39'))[_0xdd6c('0x24')](_0x48783c,squel[_0xdd6c('0x2c')]()[_0xdd6c('0x2d')](_0x48783c)[_0xdd6c('0x2e')](_0x3b10a0)['where']('('+_0x9192cd[_0xdd6c('0xf')](',')+_0xdd6c('0x4c'),squel[_0xdd6c('0x2c')]()[_0xdd6c('0x2d')](_0x9192cd)[_0xdd6c('0x2e')](_0xdd6c('0x39'))[_0xdd6c('0x31')](_0xdd6c('0x3c'),_0x3e7a32)[_0xdd6c('0x31')]('deletedAt\x20IS\x20NULL'))[_0xdd6c('0x31')]('id\x20IN\x20?',squel[_0xdd6c('0x2c')]()[_0xdd6c('0xd')]('MIN(id)',_0xdd6c('0x4d'))['from'](_0x3b10a0)[_0xdd6c('0x4e')](_0x9192cd[_0xdd6c('0xf')](','))))[_0xdd6c('0x34')]();}function handleStop(){logger[_0xdd6c('0x4f')](_0xdd6c('0x50'));stopped=!![];}function handleUncaughtException(_0x25f62c){logger[_0xdd6c('0x51')](_0x25f62c[_0xdd6c('0x52')]);process[_0xdd6c('0x53')](0x1);}function handleError(_0x1a8ebb,_0x247c78){stats['errors'][_0xdd6c('0x16')]({'name':_0x247c78[_0xdd6c('0x54')],'message':_0x247c78[_0xdd6c('0x52')],'row':_0x1a8ebb});}function handleQuery(_0x29b715){logger[_0xdd6c('0x4f')](_0x29b715);return db[_0xdd6c('0x55')][_0xdd6c('0x56')](_0x29b715)[_0xdd6c('0x57')](function(_0x3dbe41){results[_0xdd6c('0x16')](_0x3dbe41);})[_0xdd6c('0x58')](function(_0xc1c01f){logger[_0xdd6c('0x51')](_0xc1c01f['message']);});}function main(_0xe01197,_0x394ebe,_0x40609e,_0xa0fa46){logger[_0xdd6c('0x4f')](_0xdd6c('0x59'),_0xe01197,JSON[_0xdd6c('0x5a')](_0x394ebe));process[_0xdd6c('0x5b')](_0xdd6c('0x5c'));var _0x23cbcb=_0x394ebe['binding'];var _0x4c1166=_['clone'](_0x23cbcb);var _0x2268d6=_0x394ebe[_0xdd6c('0x5d')];var _0x24465d=path[_0xdd6c('0xf')](config['root'],'server/files/tmp',_0x2268d6+_0xdd6c('0x5e'));logger['info'](_0xdd6c('0x5f'),_0x394ebe);db[_0xdd6c('0x60')][_0xdd6c('0x12')]({'raw':!![],'attributes':['id','name']})['then'](function(_0x29d835){for(var _0x17f729=0x0;_0x17f729<_0x29d835[_0xdd6c('0x15')];_0x17f729++){if(_0x29d835[_0x17f729][_0xdd6c('0x61')]in _0x23cbcb){contactItemTypes[_0xdd6c('0x16')](_0x29d835[_0x17f729]);delete _0x4c1166[_0x29d835[_0x17f729]['name']];hasAdditionalPhones=!![];}for(var _0x5cf490 in _0x23cbcb){if(_0x29d835[_0x17f729][_0xdd6c('0x61')]+_0xdd6c('0x62')===_0x5cf490){phoneDescriptions[_0xdd6c('0x16')]({'itemTypeId':_0x29d835[_0x17f729]['id'],'description':_0x5cf490});delete _0x4c1166[_0x5cf490];}}}if(hasAdditionalPhones)_0x4c1166[_0xdd6c('0x13')]='';var _0x430894=_[_0xdd6c('0x4a')](_0x4c1166)[_0xdd6c('0xf')]();logger[_0xdd6c('0x4f')](_0xdd6c('0x63'),_0x430894);fs[_0xdd6c('0x64')](_0x24465d,_0x430894+'\x0a');Papa['parse'](fs[_0xdd6c('0x65')](_0xe01197),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2945ab,_0x5962dc){try{for(var _0x139100=0x0,_0x38fc5e=[];_0x139100<_0x2945ab[_0xdd6c('0x66')][_0xdd6c('0x15')];_0x139100++){stats[_0xdd6c('0x67')]+=0x1;if(_0x2945ab[_0xdd6c('0x68')][_0x139100]){handleError(_0x2945ab['data'][_0x139100],_0x2945ab[_0xdd6c('0x68')][_0x139100]);}else{var _0x5ee508=[];var _0xca05f1=[];var _0x1cacc5={};for(var _0x5bfe5b in _0x23cbcb){let _0x48d3b1=contactItemTypes[_0xdd6c('0x69')](_0x95d64b=>_0x95d64b[_0xdd6c('0x61')]===_0x5bfe5b);let _0xebf580=contactItemTypes[_0xdd6c('0x69')](_0x58691b=>_0x58691b['name']+'_description'===_0x5bfe5b);if(_[_0xdd6c('0x6a')](_0x48d3b1)&&_[_0xdd6c('0x6a')](_0xebf580)){if(_0x23cbcb[_0xdd6c('0x6b')](_0x5bfe5b)){if(_0x2945ab['data'][_0x139100][_0x23cbcb[_0x5bfe5b]]){var _0x35a909=_['trim'](_0x2945ab[_0xdd6c('0x66')][_0x139100][_0x23cbcb[_0x5bfe5b]][_0xdd6c('0x6c')](/"/g,'\x27'));switch(_0x5bfe5b){case'scheduledat':var _0x4fe0bf=moment(_0x35a909,_0xdd6c('0xb'),!![]);if(_0x4fe0bf[_0xdd6c('0x6d')]()){_0x38fc5e[_0xdd6c('0x16')]('\x22'+_0x35a909+'\x22');}else{_0x5ee508['push'](_0xdd6c('0x6e'));}break;case _0xdd6c('0x29'):var _0x19f46f=parseInt(_0x35a909);_0x35a909=_[_0xdd6c('0x6f')](_0x19f46f)||_0x19f46f<0x0||_0x19f46f>0x4?_0xa0fa46?0x3:0x2:_0x19f46f;_0x38fc5e['push']('\x22'+_0x35a909+'\x22');break;case'UserId':var _0x1f10f6=parseInt(_0x35a909);if(_[_0xdd6c('0x70')](_0x1f10f6)&&_[_0xdd6c('0x71')](_0x40609e,_0x1f10f6)){_0x38fc5e[_0xdd6c('0x16')]('\x22'+_0x1f10f6+'\x22');}else{_0x5ee508[_0xdd6c('0x16')](_0xdd6c('0x72'));}break;case _0xdd6c('0x73'):if(isEmail(_0x35a909)){_0x38fc5e[_0xdd6c('0x16')]('\x22'+_0x35a909+'\x22');}else{_0x5ee508[_0xdd6c('0x16')]('email\x20wrong\x20format');}break;case'dateOfBirth':var _0xe3f05f=moment(_0x35a909,'YYYY-MM-DD',!![]);if(_0xe3f05f[_0xdd6c('0x6d')]()){_0x38fc5e[_0xdd6c('0x16')]('\x22'+_0x35a909+'\x22');}else{_0x5ee508['push'](_0xdd6c('0x74'));}break;default:_0x38fc5e[_0xdd6c('0x16')]('\x22'+_0x35a909+'\x22');}}else{switch(_0x5bfe5b){case _0xdd6c('0x75'):case _0xdd6c('0xe'):_0x5ee508['push'](_0x5bfe5b+_0xdd6c('0x76'));break;default:_0x38fc5e['push']('\x22\x22');}}}}else{var _0x4cc117='';if(!_[_0xdd6c('0x6a')](_0x48d3b1)){if(!_0x1cacc5[_0xdd6c('0x6b')](_0x48d3b1['id'])){for(var _0x1cb16c=0x0;_0x1cb16c<_0x23cbcb[_0x5bfe5b][_0xdd6c('0x15')];_0x1cb16c++){var _0x35a909=_[_0xdd6c('0x77')](_0x2945ab['data'][_0x139100][_0x23cbcb[_0x5bfe5b][_0x1cb16c]][_0xdd6c('0x6c')](/"/g,'\x27'));var _0x5efd1f=phoneDescriptions[_0xdd6c('0x69')](_0x5a072b=>_0x5a072b[_0xdd6c('0x78')]===_0x48d3b1['id']);if(!_[_0xdd6c('0x6a')](_0x5efd1f)){var _0xbee19d=_[_0xdd6c('0x77')](_0x2945ab['data'][_0x139100][_0x23cbcb[_0x5efd1f[_0xdd6c('0x79')]][0x0]]['replace'](/"/g,'\x27'));if(!_[_0xdd6c('0x6a')](_0xbee19d))_0x35a909=_0x35a909+'§'+_0xbee19d;}if(_0x4cc117=='')_0x4cc117=_0x35a909;else _0x4cc117+='|'+_0x35a909;}_0xca05f1[_0xdd6c('0x16')](_0x48d3b1['id']+':'+_0x4cc117);_0x1cacc5[_0x48d3b1['id']]=0x1;}}}}if(hasAdditionalPhones){_0x38fc5e[_0xdd6c('0x16')]('\x22'+_0xca05f1[_0xdd6c('0xf')](';')+'\x22');}if(_0x5ee508[_0xdd6c('0x15')]){handleError(_0x2945ab[_0xdd6c('0x66')][_0x139100],{'code':_0xdd6c('0x7a'),'message':_0x5ee508[_0xdd6c('0xf')]()});}else{fs[_0xdd6c('0x7b')](_0x24465d,_0x38fc5e[_0xdd6c('0xf')]()+'\x0a');}_0x38fc5e=[];}if(!(stats[_0xdd6c('0x67')]%0xc8)){socket[_0xdd6c('0x7c')](_0xdd6c('0x7d')+_0x2268d6,stats);stats['errors']=[];}}if(stopped){logger[_0xdd6c('0x4f')]('Abort\x20parser');_0x5962dc['abort']();}}catch(_0x18485a){handleError(_0x2945ab[_0xdd6c('0x66')][_0x139100],{'code':_0xdd6c('0x7e'),'message':_0x18485a[_0xdd6c('0x52')]});logger[_0xdd6c('0x51')](_0xdd6c('0x7f'),_0x18485a[_0xdd6c('0x52')]);}},'complete':function(){try{var _0x33b754=[];var _0x58c454=_0xdd6c('0x39');if(_0x394ebe['duplicates']&&_0x394ebe[_0xdd6c('0x80')][_0xdd6c('0x15')]){_0x58c454=_0xdd6c('0x81')+_0x2268d6;_0x33b754['push'](_0xdd6c('0x82')+_0x58c454+_0xdd6c('0x83'));}logger['info'](_0xdd6c('0x84'),contactItemTypes[_0xdd6c('0x15')]);var _0x493292=util['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',_0x24465d,_0x58c454,_0x430894,_0x394ebe[_0xdd6c('0x27')],_0x394ebe[_0xdd6c('0x4b')]||null,NOW,NOW);if(_[_0xdd6c('0x6a')](_0x23cbcb['scheduledat'])){_0x493292+=',\x20scheduledAt\x20=\x20NOW()';}_0x33b754[_0xdd6c('0x16')](_0x493292);if(_0x394ebe[_0xdd6c('0x80')]&&_0x394ebe[_0xdd6c('0x80')][_0xdd6c('0x15')]){_0x33b754[_0xdd6c('0x16')](insertCmContact(_0x394ebe['ListId'],_0x58c454,_0x394ebe[_0xdd6c('0x80')],_0x23cbcb));_0x33b754['push']('DROP\x20TABLE\x20'+_0x58c454+';');}BPromise[_0xdd6c('0x85')](_0x33b754,handleQuery)[_0xdd6c('0x14')](function(_0x30d8f8){BPromise[_0xdd6c('0x17')]([handleAdditionalPhones()])['then'](function(){_0x33b754=[];for(var _0x4c515a=0x0;_0x4c515a\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','phone','from','join'];(function(_0x474d97,_0x5909ce){var _0x1edf25=function(_0x2831df){while(--_0x2831df){_0x474d97['push'](_0x474d97['shift']());}};_0x1edf25(++_0x5909ce);}(_0xf99c,0x129));var _0xcf99=function(_0x34dce9,_0xa6c831){_0x34dce9=_0x34dce9-0x0;var _0x21a091=_0xf99c[_0x34dce9];return _0x21a091;};'use strict';var fs=require('fs');var path=require(_0xcf99('0x0'));var _=require(_0xcf99('0x1'));var Papa=require(_0xcf99('0x2'));var util=require(_0xcf99('0x3'));var BPromise=require(_0xcf99('0x4'));var moment=require(_0xcf99('0x5'));var squel=require(_0xcf99('0x6'));var Redis=require(_0xcf99('0x7'));var db=require(_0xcf99('0x8'))['db'];var config=require(_0xcf99('0x9'));var logger=require(_0xcf99('0xa'))('import');config[_0xcf99('0xb')]=_[_0xcf99('0xc')](config[_0xcf99('0xb')],{'host':_0xcf99('0xd'),'port':0x18eb});var socket=require(_0xcf99('0xe'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format'](_0xcf99('0xf'));var tempTableName=_0xcf99('0x10')+moment()['format'](_0xcf99('0x11'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x291ed8){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))*$/[_0xcf99('0x12')](_0x291ed8);}function selectNotIn(_0x4378ca,_0x44482c,_0x294b6d,_0x4a79da,_0x107941){return squel[_0xcf99('0x13')]()['field'](_0xcf99('0x14'))[_0xcf99('0x15')](_0x4a79da)[_0xcf99('0x16')](_0x44482c,null,_0x44482c+_0xcf99('0x17')+_0x4a79da+'.'+_0x294b6d)[_0xcf99('0x18')](_0x4a79da+'.'+_0x294b6d+_0xcf99('0x19')+_0x4378ca+'.'+_0x294b6d)[_0xcf99('0x18')](_0x44482c+'.dialCheckDuplicateType\x20IN\x20('+_0x107941['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x30028e,_0x1d8d00){promisesAdditionalPhones=[];promisesContact=[];return db[_0xcf99('0x1a')][_0xcf99('0x1b')](_0xcf99('0x1c')+tempTableName)[_0xcf99('0x1d')](function(_0x1c88bd){if(_0x1c88bd!==null){var _0x180f8f=[];for(var _0x297ed2=0x0;_0x297ed2<_0x1c88bd[_0xcf99('0x1e')];_0x297ed2++){var _0x12e6c5=_0x1c88bd[_0x297ed2];if(!_[_0xcf99('0x1f')](_0x12e6c5[_0xcf99('0x14')])){if(!_[_0xcf99('0x1f')](_0x12e6c5[_0xcf99('0x20')]))_0x180f8f['push'](insertAdditionalPhones(_0x12e6c5));promisesContact['push']({'contact':_0x12e6c5});}}}Promise[_0xcf99('0x21')](_0x180f8f)['then'](function(){_0x30028e({'val':0x1});});})[_0xcf99('0x22')](function(_0x2946e2){logger[_0xcf99('0x23')](_0x2946e2['message']);});});}function insertAdditionalPhones(_0x546e4f){return new Promise(function(_0x204978,_0x542bd6){var _0x19fdb1=_0x546e4f['AdditionalPhones'];if(_[_0xcf99('0x1f')](_0x19fdb1))_0x542bd6({'val':0x0});else{var _0x135965=_0x19fdb1['split'](';');var _0x2b2df5=[];orderBy=0x0;for(var _0x4d0535=0x0;_0x4d0535<_0x135965[_0xcf99('0x1e')];_0x4d0535++){_0x2b2df5[_0xcf99('0x24')](splitAdditionalPhone(_0x546e4f['id'],_0x135965[_0x4d0535]));}Promise[_0xcf99('0x21')](_0x2b2df5)[_0xcf99('0x25')](function(){_0x204978({'val':_0x135965[_0xcf99('0x1e')]});});}});}function splitAdditionalPhone(_0x551903,_0x2d3335){return new Promise(function(_0x48d0f6,_0x1fdf28){var _0x4ac08b=_0x2d3335['split'](':');var _0x1a9c7c=_0x4ac08b[0x0];var _0x4bd074=_0x4ac08b[0x1];if(_0x4bd074!==''){var _0x5ad7c4=_0x4bd074[_0xcf99('0x26')]('|');var _0x521d5d=[];for(var _0x1363cf=0x0;_0x1363cf<_0x5ad7c4[_0xcf99('0x1e')];_0x1363cf++){if(_0x5ad7c4[_0x1363cf]!==''){var _0x3404b7=_['filter'](promisesAdditionalPhones,{'contactId':_0x551903,'phone':_0x5ad7c4[_0x1363cf]});if(_0x3404b7[_0xcf99('0x1e')]==0x0){orderBy++;promisesAdditionalPhones[_0xcf99('0x24')]({'contactId':_0x551903,'contactTypeId':_0x1a9c7c,'phone':_0x5ad7c4[_0x1363cf],'orderBy':orderBy});}}}_0x48d0f6({'ok':0x1});}else _0x48d0f6({'res':0x0});});}function createAdditionalPhone(_0x55e0f2,_0x18f199,_0x59a686,_0x1f08fe){var _0x89a346='';var _0x20d1b9='';var _0x2ed0f1=_0x59a686[_0xcf99('0x26')]('§');_0x89a346=_0x2ed0f1[0x0];if(_0x2ed0f1[_0xcf99('0x1e')]==0x2)_0x20d1b9=_0x2ed0f1[0x1];return new Promise(function(_0x5156d5,_0x26bad9){return db['CmContactHasItem']['findOne']({'where':{'CmContactId':_0x55e0f2,'item':_0x89a346}})[_0xcf99('0x25')](function(_0x37f19b){if(_0x37f19b){return db[_0xcf99('0x27')][_0xcf99('0x28')]({'ItemTypeId':_0x18f199,'description':_0x20d1b9,'OrderBy':_0x1f08fe},{'where':{'CmContactId':_0x55e0f2,'item':_0x89a346}})[_0xcf99('0x25')](function(_0x51220b){_0x5156d5({'res':_0xcf99('0x29')});});}else{return db['CmContactHasItem'][_0xcf99('0x2a')]({'CmContactId':_0x55e0f2,'item':_0x89a346,'ItemTypeId':_0x18f199,'description':_0x20d1b9,'OrderBy':_0x1f08fe,'ItemClass':_0xcf99('0x2b')})[_0xcf99('0x25')](function(_0x42d200){_0x5156d5({'res':_0xcf99('0x2c')});});}});});}function updateContact(_0x403ebe){return new Promise(function(_0x2ce172,_0x50d7e9){var _0x131742=_0x403ebe['id'];delete _0x403ebe['id'];return db['CmContact']['update'](_0x403ebe,{'where':{'id':_0x131742}})['then'](function(_0x23bc19){updatedRows+=0x1;return db[_0xcf99('0x2d')][_0xcf99('0x28')]({'phone':_0x403ebe[_0xcf99('0x14')]},{'where':{'ContactId':_0x131742}})['then'](function(_0x3f47c8){_0x2ce172({'ret':'OK'});});});});}function insertCmHopper(_0x1d3e66,_0x462f43,_0x5efdaa,_0x9fa98c,_0x2de35b){var _0x2683ea=[_0xcf99('0x2e'),'cm_contacts.scheduledat',_0xcf99('0x2f'),_0xcf99('0x30'),_0x462f43+'.'+_0x9fa98c,_0xcf99('0x31'),_0xcf99('0x32'),_0xcf99('0x33'),'cm_contacts.UserId','\x22'+_0x2de35b+'\x22'];return squel[_0xcf99('0x34')]()[_0xcf99('0x35')](_0xcf99('0x36'))[_0xcf99('0x37')]([_0xcf99('0x14'),_0xcf99('0x38'),_0xcf99('0x39'),_0xcf99('0x3a'),_0x9fa98c,'createdAt',_0xcf99('0x3b'),_0xcf99('0x3c'),_0xcf99('0x3d'),_0xcf99('0x3e')],squel[_0xcf99('0x13')]()[_0xcf99('0x3f')](_0x2683ea)[_0xcf99('0x15')](_0x462f43)[_0xcf99('0x16')](_0xcf99('0x40'),null,'cm_contacts.ListId\x20=\x20'+_0x462f43+'.CmListId')['join'](_0x5efdaa,null,_0x5efdaa+_0xcf99('0x17')+_0x462f43+'.'+_0x9fa98c)[_0xcf99('0x18')](_0x462f43+_0xcf99('0x41'),_0x1d3e66)['where'](_0xcf99('0x42'),NOW)['where'](_0xcf99('0x43'),selectNotIn(_0x462f43,_0x5efdaa,_0x9fa98c,'cm_hopper',[_0xcf99('0x44'),_0xcf99('0x45')]))[_0xcf99('0x18')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x462f43,_0x5efdaa,_0x9fa98c,_0xcf99('0x36'),[_0xcf99('0x44')])))[_0xcf99('0x46')]();}function insertCmHopperBlack(_0x4feaad,_0x329234,_0x597b9c,_0x3de957){var _0x58b890=[_0xcf99('0x2e'),_0xcf99('0x2f'),'cm_contacts.ListId',_0x329234+'.'+_0x3de957,'cm_contacts.createdAt',_0xcf99('0x32')];return squel[_0xcf99('0x34')]()['into'](_0xcf99('0x47'))[_0xcf99('0x37')]([_0xcf99('0x14'),'ContactId','ListId',_0x3de957,_0xcf99('0x48'),_0xcf99('0x3b')],squel['select']()[_0xcf99('0x3f')](_0x58b890)['from'](_0x329234)[_0xcf99('0x16')](_0xcf99('0x40'),null,'cm_contacts.ListId\x20=\x20'+_0x329234+_0xcf99('0x49'))[_0xcf99('0x16')](_0x597b9c,null,_0x597b9c+_0xcf99('0x17')+_0x329234+'.'+_0x3de957)[_0xcf99('0x18')](_0x329234+'.CmListId\x20=\x20?',_0x4feaad)[_0xcf99('0x18')](_0xcf99('0x42'),NOW)[_0xcf99('0x18')](_0xcf99('0x43'),squel[_0xcf99('0x13')]()['field'](_0xcf99('0x14'))['from'](_0xcf99('0x47'))[_0xcf99('0x18')](_0xcf99('0x4a'),_0x4feaad)['where'](_0x3de957+_0xcf99('0x4b'),_0x329234+'.'+_0x3de957)))[_0xcf99('0x46')]();}function insertCmHopperAdditionalPhones(_0xd2d489){var _0x5e78bd=['cm_hopper.id',_0xcf99('0x4c'),'cm_contact_has_items.OrderBy',_0xcf99('0x4d'),_0xcf99('0x4e')];return squel[_0xcf99('0x34')]()[_0xcf99('0x35')](_0xcf99('0x4f'))['fromQuery']([_0xcf99('0x50'),_0xcf99('0x14'),_0xcf99('0x51'),_0xcf99('0x48'),'updatedAt'],squel[_0xcf99('0x13')]()[_0xcf99('0x3f')](_0x5e78bd)['from'](_0xcf99('0x36'))[_0xcf99('0x16')](_0xcf99('0x40'),null,_0xcf99('0x52'))['join'](_0xcf99('0x53'),null,_0xcf99('0x54'))['where'](_0xcf99('0x55'),_0xd2d489)[_0xcf99('0x18')](_0xcf99('0x42'),NOW))[_0xcf99('0x46')]();}function insertCmContact(_0x39d891,_0x2294c6,_0x27ddd3,_0x40585e){var _0x2e38fa=_[_0xcf99('0x56')](_[_0xcf99('0x57')](_0x40585e),[_0xcf99('0x3a'),_0xcf99('0x58'),_0xcf99('0x48'),_0xcf99('0x3b')]);return squel[_0xcf99('0x34')]()[_0xcf99('0x35')](_0xcf99('0x40'))[_0xcf99('0x37')](_0x2e38fa,squel[_0xcf99('0x13')]()['fields'](_0x2e38fa)[_0xcf99('0x15')](_0x2294c6)[_0xcf99('0x18')]('('+_0x27ddd3['join'](',')+')\x20NOT\x20IN\x20?',squel['select']()['fields'](_0x27ddd3)[_0xcf99('0x15')]('cm_contacts')[_0xcf99('0x18')](_0xcf99('0x4a'),_0x39d891))[_0xcf99('0x18')]('id\x20IN\x20?',squel[_0xcf99('0x13')]()[_0xcf99('0x59')](_0xcf99('0x5a'),_0xcf99('0x5b'))[_0xcf99('0x15')](_0x2294c6)[_0xcf99('0x5c')](_0x27ddd3[_0xcf99('0x16')](','))))[_0xcf99('0x46')]();}function handleStop(){logger[_0xcf99('0x5d')](_0xcf99('0x5e'));stopped=!![];}function handleUncaughtException(_0x32ca09){logger[_0xcf99('0x23')](_0x32ca09[_0xcf99('0x5f')]);process[_0xcf99('0x60')](0x1);}function handleError(_0x3f8316,_0x25ed1c){stats[_0xcf99('0x61')][_0xcf99('0x24')]({'name':_0x25ed1c[_0xcf99('0x62')],'message':_0x25ed1c[_0xcf99('0x5f')],'row':_0x3f8316});}function handleQuery(_0xf47122){logger[_0xcf99('0x5d')](_0xf47122);return db[_0xcf99('0x1a')][_0xcf99('0x1b')](_0xf47122)[_0xcf99('0x1d')](function(_0x5c4441){results['push'](_0x5c4441);})[_0xcf99('0x22')](function(_0x17910e){logger['error'](_0x17910e[_0xcf99('0x5f')]);});}function main(_0x43d94f,_0x169b6b,_0x3e0eff,_0x36f351){logger['info'](_0xcf99('0x63'),_0x43d94f,JSON[_0xcf99('0x64')](_0x169b6b));process[_0xcf99('0x65')](_0xcf99('0x66'));var _0x30e055=_0x169b6b[_0xcf99('0x67')];var _0x2d71d5=_[_0xcf99('0x68')](_0x30e055);var _0x3de937=_0x169b6b['socket_timestamp'];var _0x50b61a=path[_0xcf99('0x16')](config[_0xcf99('0x69')],_0xcf99('0x6a'),_0x3de937+_0xcf99('0x6b'));logger[_0xcf99('0x5d')](_0xcf99('0x6c'),_0x169b6b);db[_0xcf99('0x6d')][_0xcf99('0x6e')]({'raw':!![],'attributes':['id',_0xcf99('0x6f')]})[_0xcf99('0x25')](function(_0x376cf7){for(var _0x54c24f=0x0;_0x54c24f<_0x376cf7['length'];_0x54c24f++){if(_0x376cf7[_0x54c24f][_0xcf99('0x6f')]in _0x30e055){contactItemTypes[_0xcf99('0x24')](_0x376cf7[_0x54c24f]);delete _0x2d71d5[_0x376cf7[_0x54c24f][_0xcf99('0x6f')]];hasAdditionalPhones=!![];}for(var _0x108378 in _0x30e055){if(_0x376cf7[_0x54c24f][_0xcf99('0x6f')]+_0xcf99('0x70')===_0x108378){phoneDescriptions[_0xcf99('0x24')]({'itemTypeId':_0x376cf7[_0x54c24f]['id'],'description':_0x108378});delete _0x2d71d5[_0x108378];}}}if(hasAdditionalPhones)_0x2d71d5[_0xcf99('0x20')]='';var _0x253204=_['keys'](_0x2d71d5)['join']();logger[_0xcf99('0x5d')](_0xcf99('0x71'),_0x253204);fs[_0xcf99('0x72')](_0x50b61a,_0x253204+'\x0a');Papa[_0xcf99('0x73')](fs[_0xcf99('0x74')](_0x43d94f),{'header':!![],'skipEmptyLines':!![],'step':function(_0xbee6dd,_0x1be35d){try{for(var _0x15a911=0x0,_0x59fdbd=[];_0x15a911<_0xbee6dd['data']['length'];_0x15a911++){stats[_0xcf99('0x75')]+=0x1;if(_0xbee6dd[_0xcf99('0x61')][_0x15a911]){handleError(_0xbee6dd[_0xcf99('0x76')][_0x15a911],_0xbee6dd[_0xcf99('0x61')][_0x15a911]);}else{var _0x153528=[];var _0x248c5b=[];var _0x397d3c={};for(var _0x27e178 in _0x30e055){let _0x26bc4a=contactItemTypes[_0xcf99('0x77')](_0x3373ce=>_0x3373ce[_0xcf99('0x6f')]===_0x27e178);let _0x3e1fb9=contactItemTypes[_0xcf99('0x77')](_0x45da8e=>_0x45da8e[_0xcf99('0x6f')]+_0xcf99('0x70')===_0x27e178);if(_['isNil'](_0x26bc4a)&&_['isNil'](_0x3e1fb9)){if(_0x30e055[_0xcf99('0x78')](_0x27e178)){if(_0xbee6dd[_0xcf99('0x76')][_0x15a911][_0x30e055[_0x27e178]]){var _0x57c567=_['trim'](_0xbee6dd[_0xcf99('0x76')][_0x15a911][_0x30e055[_0x27e178]]['replace'](/"/g,'\x27'));switch(_0x27e178){case _0xcf99('0x38'):var _0x41cf70=moment(_0x57c567,_0xcf99('0xf'),!![]);if(_0x41cf70['isValid']()){_0x59fdbd['push']('\x22'+_0x57c567+'\x22');}else{_0x153528[_0xcf99('0x24')](_0xcf99('0x79'));}break;case _0xcf99('0x3c'):var _0x49231e=parseInt(_0x57c567);_0x57c567=_[_0xcf99('0x7a')](_0x49231e)||_0x49231e<0x0||_0x49231e>0x4?_0x36f351?0x3:0x2:_0x49231e;_0x59fdbd[_0xcf99('0x24')]('\x22'+_0x57c567+'\x22');break;case _0xcf99('0x3d'):var _0x51afaf=parseInt(_0x57c567);if(_['isNumber'](_0x51afaf)&&_['includes'](_0x3e0eff,_0x51afaf)){_0x59fdbd[_0xcf99('0x24')]('\x22'+_0x51afaf+'\x22');}else{_0x153528[_0xcf99('0x24')](_0xcf99('0x7b'));}break;case _0xcf99('0x7c'):if(isEmail(_0x57c567)){_0x59fdbd['push']('\x22'+_0x57c567+'\x22');}else{_0x153528[_0xcf99('0x24')](_0xcf99('0x7d'));}break;case'dateOfBirth':var _0x575e2a=moment(_0x57c567,_0xcf99('0x7e'),!![]);if(_0x575e2a['isValid']()){_0x59fdbd[_0xcf99('0x24')]('\x22'+_0x57c567+'\x22');}else{_0x153528[_0xcf99('0x24')](_0xcf99('0x7f'));}break;default:_0x59fdbd[_0xcf99('0x24')]('\x22'+_0x57c567+'\x22');}}else{switch(_0x27e178){case _0xcf99('0x80'):case'phone':_0x153528[_0xcf99('0x24')](_0x27e178+_0xcf99('0x81'));break;default:_0x59fdbd['push']('\x22\x22');}}}}else{var _0x5c7ce9='';if(!_[_0xcf99('0x1f')](_0x26bc4a)){if(!_0x397d3c['hasOwnProperty'](_0x26bc4a['id'])){for(var _0x2024b=0x0;_0x2024b<_0x30e055[_0x27e178][_0xcf99('0x1e')];_0x2024b++){var _0x57c567=_[_0xcf99('0x82')](_0xbee6dd[_0xcf99('0x76')][_0x15a911][_0x30e055[_0x27e178][_0x2024b]]['replace'](/"/g,'\x27'));var _0x25c769=phoneDescriptions[_0xcf99('0x77')](_0xd628be=>_0xd628be['itemTypeId']===_0x26bc4a['id']);if(!_['isNil'](_0x25c769)){var _0x204575=_[_0xcf99('0x82')](_0xbee6dd[_0xcf99('0x76')][_0x15a911][_0x30e055[_0x25c769['description']][0x0]][_0xcf99('0x83')](/"/g,'\x27'));if(!_['isNil'](_0x204575))_0x57c567=_0x57c567+'§'+_0x204575;}if(_0x5c7ce9=='')_0x5c7ce9=_0x57c567;else _0x5c7ce9+='|'+_0x57c567;}_0x248c5b['push'](_0x26bc4a['id']+':'+_0x5c7ce9);_0x397d3c[_0x26bc4a['id']]=0x1;}}}}if(hasAdditionalPhones){_0x59fdbd['push']('\x22'+_0x248c5b[_0xcf99('0x16')](';')+'\x22');}if(_0x153528[_0xcf99('0x1e')]){handleError(_0xbee6dd[_0xcf99('0x76')][_0x15a911],{'code':_0xcf99('0x84'),'message':_0x153528[_0xcf99('0x16')]()});}else{fs[_0xcf99('0x85')](_0x50b61a,_0x59fdbd[_0xcf99('0x16')]()+'\x0a');}_0x59fdbd=[];}if(!(stats[_0xcf99('0x75')]%0xc8)){socket[_0xcf99('0x86')](_0xcf99('0x87')+_0x3de937,stats);stats[_0xcf99('0x61')]=[];}}if(stopped){logger[_0xcf99('0x5d')](_0xcf99('0x88'));_0x1be35d[_0xcf99('0x89')]();}}catch(_0x1ffa77){handleError(_0xbee6dd[_0xcf99('0x76')][_0x15a911],{'code':_0xcf99('0x8a'),'message':_0x1ffa77[_0xcf99('0x5f')]});logger[_0xcf99('0x23')]('step',_0x1ffa77[_0xcf99('0x5f')]);}},'complete':function(){try{var _0x138f6b=[];var _0x20b835=tempTableName;_0x138f6b[_0xcf99('0x24')]('CREATE\x20TABLE\x20'+_0x20b835+_0xcf99('0x8b'));logger[_0xcf99('0x5d')](_0xcf99('0x8c'),contactItemTypes[_0xcf99('0x1e')]);var _0x465f82=util[_0xcf99('0x8d')](_0xcf99('0x8e'),_0x50b61a,_0x20b835,_0x253204,_0x169b6b[_0xcf99('0x3a')],_0x169b6b[_0xcf99('0x58')]||null,NOW,NOW);if(_[_0xcf99('0x1f')](_0x30e055[_0xcf99('0x38')])){_0x465f82+=_0xcf99('0x8f');}_0x138f6b['push'](_0x465f82);BPromise[_0xcf99('0x90')](_0x138f6b,handleQuery)[_0xcf99('0x25')](function(_0x417c92){BPromise[_0xcf99('0x21')]([handleAdditionalPhones()])[_0xcf99('0x25')](function(){_0x138f6b=[];for(var _0x45487c=0x0;_0x45487c\x20\x20','existsSync','file\x20doesn\x27t\x20exists','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','papaparse','util','moment','ioredis','../../../mysqldb','../../../config/logger','redis','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','format','select','field','phone','from','join','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','spread','length','isNil','AdditionalPhones','push','all','then','catch','message','split','findOne','CmContactHasItem','update','updated','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','scheduledat','ListId','createdAt','updatedAt','priority','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.createdAt','cm_hopper_black','fromQuery','ContactId','fields','cm_contacts.phone\x20NOT\x20IN\x20(?)','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_hopper_additional_phones','CmHopperId','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat',')\x20NOT\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','exit','errors','code','main','stringify','send','start','binding','clone','root','server/files/tmp','body','findAll','name','_description','keys','header','writeFileSync','parse','createReadStream','rows','find','hasOwnProperty','data','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','UserId','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','trim','itemTypeId','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','\x20LIKE\x20cm_contacts;','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId'];(function(_0x539a7d,_0x113ba5){var _0x1997de=function(_0x5841e3){while(--_0x5841e3){_0x539a7d['push'](_0x539a7d['shift']());}};_0x1997de(++_0x113ba5);}(_0xb1ef,0x146));var _0xfb1e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xb1ef[_0x122ef9];return _0x42fba0;};'use strict';var fs=require('fs');var path=require(_0xfb1e('0x0'));var _=require('lodash');var Papa=require(_0xfb1e('0x1'));var util=require(_0xfb1e('0x2'));var BPromise=require('bluebird');var moment=require(_0xfb1e('0x3'));var squel=require('squel');var Redis=require(_0xfb1e('0x4'));var db=require(_0xfb1e('0x5'))['db'];var config=require('../../../config/environment');var logger=require(_0xfb1e('0x6'))('import');config[_0xfb1e('0x7')]=_['defaults'](config['redis'],{'host':_0xfb1e('0x8'),'port':0x18eb});var socket=require(_0xfb1e('0x9'))(new Redis(config[_0xfb1e('0x7')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format'](_0xfb1e('0xa'));var tempTableName=_0xfb1e('0xb')+moment()[_0xfb1e('0xc')]('YYYYMMDDHHmmss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x3e648b){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'](_0x3e648b);}function selectNotIn(_0x301566,_0x228c95,_0x528105,_0x2f45a8,_0x273e58){return squel[_0xfb1e('0xd')]()[_0xfb1e('0xe')](_0xfb1e('0xf'))[_0xfb1e('0x10')](_0x2f45a8)[_0xfb1e('0x11')](_0x228c95,null,_0x228c95+'.id\x20=\x20'+_0x2f45a8+'.'+_0x528105)[_0xfb1e('0x12')](_0x2f45a8+'.'+_0x528105+_0xfb1e('0x13')+_0x301566+'.'+_0x528105)[_0xfb1e('0x12')](_0x228c95+_0xfb1e('0x14')+_0x273e58[_0xfb1e('0x11')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x28d758,_0x5201f1){promisesAdditionalPhones=[];promisesContact=[];return db[_0xfb1e('0x15')][_0xfb1e('0x16')]('select\x20*\x20from\x20'+tempTableName)[_0xfb1e('0x17')](function(_0x5e2a98){if(_0x5e2a98!==null){var _0x3c7277=[];for(var _0x338b9a=0x0;_0x338b9a<_0x5e2a98[_0xfb1e('0x18')];_0x338b9a++){var _0x2d3101=_0x5e2a98[_0x338b9a];if(!_[_0xfb1e('0x19')](_0x2d3101['phone'])){if(!_[_0xfb1e('0x19')](_0x2d3101[_0xfb1e('0x1a')]))_0x3c7277[_0xfb1e('0x1b')](insertAdditionalPhones(_0x2d3101));promisesContact[_0xfb1e('0x1b')]({'contact':_0x2d3101});}}}Promise[_0xfb1e('0x1c')](_0x3c7277)[_0xfb1e('0x1d')](function(){_0x28d758({'val':0x1});});})[_0xfb1e('0x1e')](function(_0x27c705){logger['error'](_0x27c705[_0xfb1e('0x1f')]);});});}function insertAdditionalPhones(_0x1594de){return new Promise(function(_0x2b8c7b,_0x329c13){var _0x55de2e=_0x1594de[_0xfb1e('0x1a')];if(_[_0xfb1e('0x19')](_0x55de2e))_0x329c13({'val':0x0});else{var _0x58f3e0=_0x55de2e[_0xfb1e('0x20')](';');var _0xc15ea8=[];orderBy=0x0;for(var _0x44c7de=0x0;_0x44c7de<_0x58f3e0[_0xfb1e('0x18')];_0x44c7de++){_0xc15ea8[_0xfb1e('0x1b')](splitAdditionalPhone(_0x1594de['id'],_0x58f3e0[_0x44c7de]));}Promise[_0xfb1e('0x1c')](_0xc15ea8)[_0xfb1e('0x1d')](function(){_0x2b8c7b({'val':_0x58f3e0[_0xfb1e('0x18')]});});}});}function splitAdditionalPhone(_0x2b11cd,_0x5d2d1a){return new Promise(function(_0x507909,_0x561455){var _0x387961=_0x5d2d1a['split'](':');var _0x3eb09d=_0x387961[0x0];var _0x16c328=_0x387961[0x1];if(_0x16c328!==''){var _0x27abb3=_0x16c328[_0xfb1e('0x20')]('|');var _0x1e0d2b=[];for(var _0x16a4ba=0x0;_0x16a4ba<_0x27abb3[_0xfb1e('0x18')];_0x16a4ba++){if(_0x27abb3[_0x16a4ba]!==''){var _0x2f6c0f=_['filter'](promisesAdditionalPhones,{'contactId':_0x2b11cd,'phone':_0x27abb3[_0x16a4ba]});if(_0x2f6c0f[_0xfb1e('0x18')]==0x0){orderBy++;promisesAdditionalPhones[_0xfb1e('0x1b')]({'contactId':_0x2b11cd,'contactTypeId':_0x3eb09d,'phone':_0x27abb3[_0x16a4ba],'orderBy':orderBy});}}}_0x507909({'ok':0x1});}else _0x507909({'res':0x0});});}function createAdditionalPhone(_0x303c41,_0x25fe9d,_0x3b891c,_0x483f67){var _0x279698='';var _0x204624='';var _0x1266f6=_0x3b891c[_0xfb1e('0x20')]('§');_0x279698=_0x1266f6[0x0];if(_0x1266f6[_0xfb1e('0x18')]==0x2)_0x204624=_0x1266f6[0x1];return new Promise(function(_0x406bad,_0x40b534){return db['CmContactHasItem'][_0xfb1e('0x21')]({'where':{'CmContactId':_0x303c41,'item':_0x279698}})[_0xfb1e('0x1d')](function(_0x2d5faa){if(_0x2d5faa){return db[_0xfb1e('0x22')][_0xfb1e('0x23')]({'ItemTypeId':_0x25fe9d,'description':_0x204624,'OrderBy':_0x483f67},{'where':{'CmContactId':_0x303c41,'item':_0x279698}})['then'](function(_0x3048e3){_0x406bad({'res':_0xfb1e('0x24')});});}else{return db[_0xfb1e('0x22')]['create']({'CmContactId':_0x303c41,'item':_0x279698,'ItemTypeId':_0x25fe9d,'description':_0x204624,'OrderBy':_0x483f67,'ItemClass':'PHONE'})[_0xfb1e('0x1d')](function(_0x13f565){_0x406bad({'res':_0xfb1e('0x25')});});}});});}function updateContact(_0x7aa58e){return new Promise(function(_0x39fe05,_0x31890d){var _0x5e4bfb=_0x7aa58e['id'];delete _0x7aa58e['id'];return db['CmContact'][_0xfb1e('0x23')](_0x7aa58e,{'where':{'id':_0x5e4bfb}})[_0xfb1e('0x1d')](function(_0x3111b8){updatedRows+=0x1;return db['CmHopper']['update']({'phone':_0x7aa58e['phone']},{'where':{'ContactId':_0x5e4bfb}})[_0xfb1e('0x1d')](function(_0x258b64){_0x39fe05({'ret':'OK'});});});});}function insertCmHopper(_0x178abf,_0x29fe01,_0x40024b,_0x1ee4b6,_0x3bcaf6){var _0x41c71a=[_0xfb1e('0x26'),_0xfb1e('0x27'),_0xfb1e('0x28'),_0xfb1e('0x29'),_0x29fe01+'.'+_0x1ee4b6,'cm_contacts.createdAt',_0xfb1e('0x2a'),_0xfb1e('0x2b'),_0xfb1e('0x2c'),'\x22'+_0x3bcaf6+'\x22'];return squel[_0xfb1e('0x2d')]()[_0xfb1e('0x2e')](_0xfb1e('0x2f'))['fromQuery']([_0xfb1e('0xf'),_0xfb1e('0x30'),'ContactId',_0xfb1e('0x31'),_0x1ee4b6,_0xfb1e('0x32'),_0xfb1e('0x33'),_0xfb1e('0x34'),'UserId','recallme'],squel[_0xfb1e('0xd')]()['fields'](_0x41c71a)[_0xfb1e('0x10')](_0x29fe01)['join'](_0xfb1e('0x35'),null,_0xfb1e('0x36')+_0x29fe01+_0xfb1e('0x37'))[_0xfb1e('0x11')](_0x40024b,null,_0x40024b+_0xfb1e('0x38')+_0x29fe01+'.'+_0x1ee4b6)['where'](_0x29fe01+_0xfb1e('0x39'),_0x178abf)[_0xfb1e('0x12')](_0xfb1e('0x3a'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x29fe01,_0x40024b,_0x1ee4b6,'cm_hopper',[_0xfb1e('0x3b'),_0xfb1e('0x3c')]))[_0xfb1e('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x29fe01,_0x40024b,_0x1ee4b6,_0xfb1e('0x2f'),[_0xfb1e('0x3b')])))[_0xfb1e('0x3d')]();}function insertCmHopperBlack(_0x3b8789,_0x16ab3b,_0x52fdae,_0x2767f5){var _0x2a7a1c=[_0xfb1e('0x26'),_0xfb1e('0x28'),_0xfb1e('0x29'),_0x16ab3b+'.'+_0x2767f5,_0xfb1e('0x3e'),_0xfb1e('0x2a')];return squel['insert']()['into'](_0xfb1e('0x3f'))[_0xfb1e('0x40')]([_0xfb1e('0xf'),_0xfb1e('0x41'),'ListId',_0x2767f5,_0xfb1e('0x32'),_0xfb1e('0x33')],squel[_0xfb1e('0xd')]()[_0xfb1e('0x42')](_0x2a7a1c)[_0xfb1e('0x10')](_0x16ab3b)[_0xfb1e('0x11')](_0xfb1e('0x35'),null,'cm_contacts.ListId\x20=\x20'+_0x16ab3b+_0xfb1e('0x37'))[_0xfb1e('0x11')](_0x52fdae,null,_0x52fdae+_0xfb1e('0x38')+_0x16ab3b+'.'+_0x2767f5)[_0xfb1e('0x12')](_0x16ab3b+'.CmListId\x20=\x20?',_0x3b8789)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0xfb1e('0x12')](_0xfb1e('0x43'),squel['select']()[_0xfb1e('0xe')](_0xfb1e('0xf'))[_0xfb1e('0x10')](_0xfb1e('0x3f'))['where'](_0xfb1e('0x44'),_0x3b8789)[_0xfb1e('0x12')](_0x2767f5+_0xfb1e('0x45'),_0x16ab3b+'.'+_0x2767f5)))['toString']();}function insertCmHopperAdditionalPhones(_0x1c172c){var _0x13a20f=[_0xfb1e('0x46'),_0xfb1e('0x47'),_0xfb1e('0x48'),_0xfb1e('0x49'),'cm_contact_has_items.updatedAt'];return squel['insert']()['into'](_0xfb1e('0x4a'))[_0xfb1e('0x40')]([_0xfb1e('0x4b'),_0xfb1e('0xf'),'OrderBy',_0xfb1e('0x32'),_0xfb1e('0x33')],squel[_0xfb1e('0xd')]()[_0xfb1e('0x42')](_0x13a20f)[_0xfb1e('0x10')](_0xfb1e('0x2f'))[_0xfb1e('0x11')](_0xfb1e('0x35'),null,_0xfb1e('0x4c'))[_0xfb1e('0x11')](_0xfb1e('0x4d'),null,_0xfb1e('0x4e'))['where'](_0xfb1e('0x4f'),_0x1c172c)[_0xfb1e('0x12')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0xfb1e('0x3d')]();}function insertCmContact(_0x564a42,_0x19cb2d,_0x4e8f38,_0x4d275a){var _0x4affff=_[_0xfb1e('0x50')](_['keys'](_0x4d275a),[_0xfb1e('0x31'),'CompanyId','createdAt','updatedAt']);return squel[_0xfb1e('0x2d')]()[_0xfb1e('0x2e')](_0xfb1e('0x35'))[_0xfb1e('0x40')](_0x4affff,squel[_0xfb1e('0xd')]()['fields'](_0x4affff)[_0xfb1e('0x10')](_0x19cb2d)[_0xfb1e('0x12')]('('+_0x4e8f38['join'](',')+_0xfb1e('0x51'),squel[_0xfb1e('0xd')]()[_0xfb1e('0x42')](_0x4e8f38)[_0xfb1e('0x10')](_0xfb1e('0x35'))[_0xfb1e('0x12')](_0xfb1e('0x44'),_0x564a42))[_0xfb1e('0x12')]('id\x20IN\x20?',squel[_0xfb1e('0xd')]()['field'](_0xfb1e('0x52'),_0xfb1e('0x53'))[_0xfb1e('0x10')](_0x19cb2d)[_0xfb1e('0x54')](_0x4e8f38['join'](','))))[_0xfb1e('0x3d')]();}function handleStop(){logger[_0xfb1e('0x55')](_0xfb1e('0x56'));stopped=!![];}function handleUncaughtException(_0x47536d){logger[_0xfb1e('0x57')](_0x47536d[_0xfb1e('0x1f')]);process[_0xfb1e('0x58')](0x1);}function handleError(_0x40c055,_0x412acd){stats[_0xfb1e('0x59')]['push']({'name':_0x412acd[_0xfb1e('0x5a')],'message':_0x412acd['message'],'row':_0x40c055});}function handleQuery(_0x37bacd){logger['info'](_0x37bacd);return db[_0xfb1e('0x15')]['query'](_0x37bacd)[_0xfb1e('0x17')](function(_0x4a7425){results[_0xfb1e('0x1b')](_0x4a7425);})[_0xfb1e('0x1e')](function(_0x17ddd5){logger[_0xfb1e('0x57')](_0x17ddd5[_0xfb1e('0x1f')]);});}function main(_0x1a02c7,_0x17cbcd,_0x185712,_0x18b642){logger[_0xfb1e('0x55')](_0xfb1e('0x5b'),_0x1a02c7,JSON[_0xfb1e('0x5c')](_0x17cbcd));process[_0xfb1e('0x5d')](_0xfb1e('0x5e'));var _0x4d7d3a=_0x17cbcd[_0xfb1e('0x5f')];var _0x5605a0=_[_0xfb1e('0x60')](_0x4d7d3a);var _0x1bbb6d=_0x17cbcd['socket_timestamp'];var _0x57c993=path['join'](config[_0xfb1e('0x61')],_0xfb1e('0x62'),_0x1bbb6d+'.csv');logger[_0xfb1e('0x55')](_0xfb1e('0x63'),_0x17cbcd);db['ContactItemType'][_0xfb1e('0x64')]({'raw':!![],'attributes':['id',_0xfb1e('0x65')]})['then'](function(_0x45d931){for(var _0x31777d=0x0;_0x31777d<_0x45d931[_0xfb1e('0x18')];_0x31777d++){if(_0x45d931[_0x31777d][_0xfb1e('0x65')]in _0x4d7d3a){contactItemTypes[_0xfb1e('0x1b')](_0x45d931[_0x31777d]);delete _0x5605a0[_0x45d931[_0x31777d][_0xfb1e('0x65')]];hasAdditionalPhones=!![];}for(var _0x4aadc6 in _0x4d7d3a){if(_0x45d931[_0x31777d][_0xfb1e('0x65')]+_0xfb1e('0x66')===_0x4aadc6){phoneDescriptions[_0xfb1e('0x1b')]({'itemTypeId':_0x45d931[_0x31777d]['id'],'description':_0x4aadc6});delete _0x5605a0[_0x4aadc6];}}}if(hasAdditionalPhones)_0x5605a0[_0xfb1e('0x1a')]='';var _0x1d1e0b=_[_0xfb1e('0x67')](_0x5605a0)['join']();logger[_0xfb1e('0x55')](_0xfb1e('0x68'),_0x1d1e0b);fs[_0xfb1e('0x69')](_0x57c993,_0x1d1e0b+'\x0a');Papa[_0xfb1e('0x6a')](fs[_0xfb1e('0x6b')](_0x1a02c7),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3394d9,_0x833e65){try{for(var _0x2fb358=0x0,_0x133d1f=[];_0x2fb358<_0x3394d9['data'][_0xfb1e('0x18')];_0x2fb358++){stats[_0xfb1e('0x6c')]+=0x1;if(_0x3394d9['errors'][_0x2fb358]){handleError(_0x3394d9['data'][_0x2fb358],_0x3394d9[_0xfb1e('0x59')][_0x2fb358]);}else{var _0x15d8e9=[];var _0x2fccd4=[];var _0x155704={};for(var _0xae4f26 in _0x4d7d3a){let _0x596d06=contactItemTypes[_0xfb1e('0x6d')](_0xf1fd83=>_0xf1fd83[_0xfb1e('0x65')]===_0xae4f26);let _0x220390=contactItemTypes[_0xfb1e('0x6d')](_0x24fd12=>_0x24fd12[_0xfb1e('0x65')]+_0xfb1e('0x66')===_0xae4f26);if(_[_0xfb1e('0x19')](_0x596d06)&&_[_0xfb1e('0x19')](_0x220390)){if(_0x4d7d3a[_0xfb1e('0x6e')](_0xae4f26)){if(_0x3394d9['data'][_0x2fb358][_0x4d7d3a[_0xae4f26]]){var _0x5a7d69=_['trim'](_0x3394d9[_0xfb1e('0x6f')][_0x2fb358][_0x4d7d3a[_0xae4f26]][_0xfb1e('0x70')](/"/g,'\x27'));switch(_0xae4f26){case'scheduledat':var _0x39cf2a=moment(_0x5a7d69,_0xfb1e('0xa'),!![]);if(_0x39cf2a[_0xfb1e('0x71')]()){_0x133d1f[_0xfb1e('0x1b')]('\x22'+_0x5a7d69+'\x22');}else{_0x15d8e9[_0xfb1e('0x1b')](_0xfb1e('0x72'));}break;case _0xfb1e('0x34'):var _0x2deaec=parseInt(_0x5a7d69);_0x5a7d69=_['isNaN'](_0x2deaec)||_0x2deaec<0x0||_0x2deaec>0x4?_0x18b642?0x3:0x2:_0x2deaec;_0x133d1f[_0xfb1e('0x1b')]('\x22'+_0x5a7d69+'\x22');break;case _0xfb1e('0x73'):var _0x2dce5d=parseInt(_0x5a7d69);if(_[_0xfb1e('0x74')](_0x2dce5d)&&_[_0xfb1e('0x75')](_0x185712,_0x2dce5d)){_0x133d1f['push']('\x22'+_0x2dce5d+'\x22');}else{_0x15d8e9[_0xfb1e('0x1b')](_0xfb1e('0x76'));}break;case _0xfb1e('0x77'):if(isEmail(_0x5a7d69)){_0x133d1f[_0xfb1e('0x1b')]('\x22'+_0x5a7d69+'\x22');}else{_0x15d8e9['push'](_0xfb1e('0x78'));}break;case _0xfb1e('0x79'):var _0x1da1c2=moment(_0x5a7d69,_0xfb1e('0x7a'),!![]);if(_0x1da1c2['isValid']()){_0x133d1f[_0xfb1e('0x1b')]('\x22'+_0x5a7d69+'\x22');}else{_0x15d8e9['push'](_0xfb1e('0x7b'));}break;default:_0x133d1f[_0xfb1e('0x1b')]('\x22'+_0x5a7d69+'\x22');}}else{switch(_0xae4f26){case _0xfb1e('0x7c'):case'phone':_0x15d8e9[_0xfb1e('0x1b')](_0xae4f26+_0xfb1e('0x7d'));break;default:_0x133d1f[_0xfb1e('0x1b')]('\x22\x22');}}}}else{var _0x509cf8='';if(!_['isNil'](_0x596d06)){if(!_0x155704[_0xfb1e('0x6e')](_0x596d06['id'])){for(var _0x403076=0x0;_0x403076<_0x4d7d3a[_0xae4f26][_0xfb1e('0x18')];_0x403076++){var _0x5a7d69=_[_0xfb1e('0x7e')](_0x3394d9['data'][_0x2fb358][_0x4d7d3a[_0xae4f26][_0x403076]][_0xfb1e('0x70')](/"/g,'\x27'));var _0x1f7dec=phoneDescriptions[_0xfb1e('0x6d')](_0x58d733=>_0x58d733[_0xfb1e('0x7f')]===_0x596d06['id']);if(!_[_0xfb1e('0x19')](_0x1f7dec)){var _0x37283e=_[_0xfb1e('0x7e')](_0x3394d9[_0xfb1e('0x6f')][_0x2fb358][_0x4d7d3a[_0x1f7dec['description']][0x0]][_0xfb1e('0x70')](/"/g,'\x27'));if(!_[_0xfb1e('0x19')](_0x37283e))_0x5a7d69=_0x5a7d69+'§'+_0x37283e;}if(_0x509cf8=='')_0x509cf8=_0x5a7d69;else _0x509cf8+='|'+_0x5a7d69;}_0x2fccd4[_0xfb1e('0x1b')](_0x596d06['id']+':'+_0x509cf8);_0x155704[_0x596d06['id']]=0x1;}}}}if(hasAdditionalPhones){_0x133d1f[_0xfb1e('0x1b')]('\x22'+_0x2fccd4[_0xfb1e('0x11')](';')+'\x22');}if(_0x15d8e9[_0xfb1e('0x18')]){handleError(_0x3394d9[_0xfb1e('0x6f')][_0x2fb358],{'code':_0xfb1e('0x80'),'message':_0x15d8e9['join']()});}else{fs[_0xfb1e('0x81')](_0x57c993,_0x133d1f[_0xfb1e('0x11')]()+'\x0a');}_0x133d1f=[];}if(!(stats[_0xfb1e('0x6c')]%0xc8)){socket[_0xfb1e('0x82')](_0xfb1e('0x83')+_0x1bbb6d,stats);stats[_0xfb1e('0x59')]=[];}}if(stopped){logger[_0xfb1e('0x55')](_0xfb1e('0x84'));_0x833e65[_0xfb1e('0x85')]();}}catch(_0x3cb956){handleError(_0x3394d9[_0xfb1e('0x6f')][_0x2fb358],{'code':_0xfb1e('0x86'),'message':_0x3cb956[_0xfb1e('0x1f')]});logger['error']('step',_0x3cb956[_0xfb1e('0x1f')]);}},'complete':function(){try{var _0x20179d=[];var _0x348545=tempTableName;_0x20179d[_0xfb1e('0x1b')]('CREATE\x20TABLE\x20'+_0x348545+_0xfb1e('0x87'));logger[_0xfb1e('0x55')](_0xfb1e('0x88'),contactItemTypes[_0xfb1e('0x18')]);var _0x5c9fd2=util[_0xfb1e('0xc')](_0xfb1e('0x89'),_0x57c993,_0x348545,_0x1d1e0b,_0x17cbcd[_0xfb1e('0x31')],_0x17cbcd[_0xfb1e('0x8a')]||null,NOW,NOW);if(_[_0xfb1e('0x19')](_0x4d7d3a[_0xfb1e('0x30')])){_0x5c9fd2+=_0xfb1e('0x8b');}_0x20179d[_0xfb1e('0x1b')](_0x5c9fd2);BPromise[_0xfb1e('0x8c')](_0x20179d,handleQuery)[_0xfb1e('0x1d')](function(_0xae1359){BPromise[_0xfb1e('0x1c')]([handleAdditionalPhones()])['then'](function(){_0x20179d=[];for(var _0x5bd682=0x0;_0x5bd682=_0x5b1a1b){return _0x7a7222[_0xee1a('0x12')](0x193)[_0xee1a('0x13')]({'message':util['format'](_0xee1a('0x14'),_0x5e68f5)});}_0xdcf24c();})['catch'](function(_0x278f7c){_0xdcf24c(_0x278f7c);});});}function isUserLimit(){return isLimit(_0xee1a('0x15'),0x1,db[_0xee1a('0x16')],{'where':{'$or':[{'role':_0xee1a('0x17')},{'role':'user'}]}});}exports[_0xee1a('0x18')]=isUserLimit; \ No newline at end of file +var _0x7a8d=['Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','admin','user','isUserLimit','crypto','util','../../mysqldb','../../config/environment','data1','license','split','createDecipher','format','update','base64','final','utf8','parse','hasOwnProperty','use','License','findOne','then','count','status'];(function(_0x5cc3d4,_0xbcbf9b){var _0x17ca31=function(_0x5dbd6d){while(--_0x5dbd6d){_0x5cc3d4['push'](_0x5cc3d4['shift']());}};_0x17ca31(++_0xbcbf9b);}(_0x7a8d,0x8d));var _0xd7a8=function(_0x105e43,_0x4f7cfc){_0x105e43=_0x105e43-0x0;var _0x5a58c7=_0x7a8d[_0x105e43];return _0x5a58c7;};'use strict';var crypto=require(_0xd7a8('0x0'));var util=require(_0xd7a8('0x1'));var compose=require('composable-middleware');var db=require(_0xd7a8('0x2'))['db'];var config=require(_0xd7a8('0x3'));function getValueFromLicense(_0x21b4d3,_0x491ca2){if(_0x21b4d3&&_0x491ca2){if(_0x491ca2[_0xd7a8('0x4')]&&_0x491ca2[_0xd7a8('0x5')]){var _0x29700f=_0x491ca2[_0xd7a8('0x4')];var _0x40896d=_0x491ca2[_0xd7a8('0x5')];var _0x1fa0ce=_0x29700f[_0xd7a8('0x6')]('-')[0x4];var _0x2499f2=_0x29700f[_0xd7a8('0x6')]('-')[0x0];var _0x3532bf=crypto[_0xd7a8('0x7')]('aes-256-ctr',util[_0xd7a8('0x8')]('%s:%s:%s',_0x1fa0ce,_0x29700f,_0x2499f2));var _0x477372=_0x3532bf[_0xd7a8('0x9')](_0x40896d,_0xd7a8('0xa'),'utf8');_0x477372+=_0x3532bf[_0xd7a8('0xb')](_0xd7a8('0xc'));var _0x2c7d06=JSON[_0xd7a8('0xd')](_0x477372);return _0x2c7d06[_0xd7a8('0xe')](_0x21b4d3)?_0x2c7d06[_0x21b4d3]:null;}}return null;}function isLimit(_0x5523fc,_0x45e36d,_0x14e3f5,_0x960210){var _0x4b0e60=_0x45e36d;return compose()[_0xd7a8('0xf')](function(_0x1b0a72,_0x205f4b,_0x8a2049){return db[_0xd7a8('0x10')][_0xd7a8('0x11')]({'where':{'id':0x1},'raw':!![]})[_0xd7a8('0x12')](function(_0x36dda1){var _0x93666d=getValueFromLicense(_0x5523fc,_0x36dda1);return _0x93666d?_0x93666d:_0x4b0e60;})[_0xd7a8('0x12')](function(_0x2864b2){_0x4b0e60=_0x2864b2;return _0x14e3f5[_0xd7a8('0x13')](_0x960210);})['then'](function(_0x21d7d0){if(_0x21d7d0>=_0x4b0e60){return _0x205f4b[_0xd7a8('0x14')](0x193)['json']({'message':util[_0xd7a8('0x8')](_0xd7a8('0x15'),_0x5523fc)});}_0x8a2049();})[_0xd7a8('0x16')](function(_0x48dab2){_0x8a2049(_0x48dab2);});});}function isUserLimit(){return isLimit(_0xd7a8('0x17'),0x1,db['User'],{'where':{'$or':[{'role':_0xd7a8('0x18')},{'role':_0xd7a8('0x19')}]}});}exports[_0xd7a8('0x1a')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 2e2118f..8ab4385 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 _0xff4c=['length','slice','forEach','match','filter','map','push','buildExpression','DATE','$eq','value','$gt','$lte','operator','add','days','format','castTo','text','CAST(','\x20AS\x20','field','includes','$ne','\x20OR\x20','$in','$notIn','NOT\x20IN\x20?','=\x20?','$substring','$startsWith','$endsWith','$lt','>\x20?','$gte','>=\x20?','$between','BETWEEN\x20?\x20AND\x20?','start','shift','utcOffset','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','[$and]','replace','split'];(function(_0x4cbfee,_0x19c6ec){var _0x3f2b97=function(_0x3adf66){while(--_0x3adf66){_0x4cbfee['push'](_0x4cbfee['shift']());}};_0x3f2b97(++_0x19c6ec);}(_0xff4c,0x98));var _0xcff4=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0xff4c[_0x125ff8];return _0x2d9ef;};'use strict';var _=require(_0xcff4('0x0'));var moment=require(_0xcff4('0x1'));exports[_0xcff4('0x2')]=function(_0x123ab7){var _0x30232c={'conditions':[]};_0x30232c[_0xcff4('0x3')]=_[_0xcff4('0x4')](_0x123ab7,_0xcff4('0x5'))?'or':_0xcff4('0x6');var _0x18f0c7=_0x123ab7['replace'](_0xcff4('0x7'),'')[_0xcff4('0x8')](_0xcff4('0x5'),'')[_0xcff4('0x9')]('||');for(var _0x40ee62=0x0;_0x40ee62<_0x18f0c7[_0xcff4('0xa')];_0x40ee62++){var _0x551620=_0x18f0c7[_0x40ee62][_0xcff4('0x9')](':=');var _0x44efb6=_0x551620[0x0];var _0x428bb1=_0x551620[_0xcff4('0xb')](0x1);_0x428bb1[_0xcff4('0xc')](function(_0x493232){var _0xf6d0ad=_0x493232[_0xcff4('0x9')]('[')['shift']();var _0xee72d0=_0x493232[_0xcff4('0xd')](/\[(.*?)\]/g);_0xee72d0[_0xcff4('0xc')](function(_0x4ebaf0){var _0x268541=_0x4ebaf0[_0xcff4('0x9')]('[')[_0xcff4('0xe')](function(_0xcc16e6){return _0xcc16e6['indexOf'](']')>-0x1;})[_0xcff4('0xf')](function(_0x3ebc5f){return _0x3ebc5f[_0xcff4('0x9')](']')[0x0];})[0x0];_0x30232c['conditions'][_0xcff4('0x10')]({'field':_0x44efb6,'operator':_0xf6d0ad,'value':_0x268541});});});}return _0x30232c;};exports[_0xcff4('0x11')]=function(_0x10181c,_0x4d04dc,_0x153ce0){var _0x310aac={};if(_0x4d04dc===_0xcff4('0x12')){if(_0x153ce0['operator']===_0xcff4('0x13')){_0x153ce0['operator']='$between';_0x153ce0[_0xcff4('0x14')]+=','+_0x153ce0[_0xcff4('0x14')];}else if(_['includes']([_0xcff4('0x15'),_0xcff4('0x16')],_0x153ce0[_0xcff4('0x17')])){_0x153ce0['value']=moment(_0x153ce0[_0xcff4('0x14')])[_0xcff4('0x18')](0x1,_0xcff4('0x19'))[_0xcff4('0x1a')]('YYYY-MM-DD');}}if(_0x153ce0[_0xcff4('0x1b')]){_0x4d04dc=_0x153ce0[_0xcff4('0x1b')];_0x310aac[_0xcff4('0x1c')]=_0xcff4('0x1d')+_0x10181c+'.'+_0x153ce0['field']+_0xcff4('0x1e')+_0x153ce0[_0xcff4('0x1b')]+')\x20'+parseOperator(_0x153ce0[_0xcff4('0x17')]);}else{_0x310aac[_0xcff4('0x1c')]=_0x10181c+'.'+_0x153ce0[_0xcff4('0x1f')]+'\x20'+parseOperator(_0x153ce0[_0xcff4('0x17')]);}if(_[_0xcff4('0x20')]([_0xcff4('0x21'),'$notIn'],_0x153ce0[_0xcff4('0x17')]))_0x310aac[_0xcff4('0x1c')]='('+_0x310aac[_0xcff4('0x1c')]+_0xcff4('0x22')+_0x10181c+'.'+_0x153ce0['field']+'\x20IS\x20NULL)';_0x310aac['value']=parseValue(_0x4d04dc,_0x153ce0[_0xcff4('0x17')],_0x153ce0['value']);return _0x310aac;};function parseOperator(_0x1e76e3){var _0x24570b;switch(_0x1e76e3){case _0xcff4('0x23'):_0x24570b='IN\x20?';break;case _0xcff4('0x24'):_0x24570b=_0xcff4('0x25');break;case'$eq':_0x24570b=_0xcff4('0x26');break;case _0xcff4('0x21'):_0x24570b='<>\x20?';break;case _0xcff4('0x27'):case _0xcff4('0x28'):case _0xcff4('0x29'):_0x24570b='LIKE\x20?';break;case _0xcff4('0x2a'):_0x24570b='<\x20?';break;case'$gt':_0x24570b=_0xcff4('0x2b');break;case _0xcff4('0x16'):_0x24570b='<=\x20?';break;case _0xcff4('0x2c'):_0x24570b=_0xcff4('0x2d');break;case _0xcff4('0x2e'):_0x24570b=_0xcff4('0x2f');break;}return _0x24570b;}function parseValue(_0xfc7690,_0x4f1984,_0xa52f74){var _0x4eed02={'start':undefined,'end':undefined};switch(_0x4f1984){case'$in':case _0xcff4('0x24'):_0x4eed02[_0xcff4('0x30')]=_0xa52f74[_0xcff4('0x9')](',');break;case _0xcff4('0x27'):_0x4eed02['start']='%'+_0xa52f74+'%';break;case _0xcff4('0x28'):_0x4eed02[_0xcff4('0x30')]=_0xa52f74+'%';break;case _0xcff4('0x29'):_0x4eed02[_0xcff4('0x30')]='%'+_0xa52f74;break;case _0xcff4('0x2e'):var _0x388596=_0xa52f74[_0xcff4('0x9')](',');var _0xa52f74=_0x388596[_0xcff4('0x31')]();var _0x55bab7=_0x388596['pop']();if(_0xfc7690===_0xcff4('0x12')){_0xa52f74=moment(_0xa52f74)[_0xcff4('0x32')](0x0,!![])['format']();_0x55bab7=moment(_0x55bab7)[_0xcff4('0x32')](0x0,!![])[_0xcff4('0x18')](0x17,_0xcff4('0x33'))['add'](0x3b,_0xcff4('0x34'))[_0xcff4('0x18')](0x3b,_0xcff4('0x35'))[_0xcff4('0x1a')]();}_0x4eed02={'start':_0xa52f74,'end':_0x55bab7};break;default:_0x4eed02[_0xcff4('0x30')]=_0xa52f74;break;}return _0x4eed02;} \ No newline at end of file +var _0x591b=['utcOffset','hours','minutes','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','forEach','shift','filter','indexOf','map','conditions','push','DATE','$eq','operator','$between','value','includes','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','\x20OR\x20','\x20IS\x20NULL)','$in','$notIn','NOT\x20IN\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','>\x20?','<=\x20?','$gte','start','pop'];(function(_0x2b3b3a,_0x3226e0){var _0x4b1b2c=function(_0x53b585){while(--_0x53b585){_0x2b3b3a['push'](_0x2b3b3a['shift']());}};_0x4b1b2c(++_0x3226e0);}(_0x591b,0x176));var _0xb591=function(_0x21cc62,_0x526306){_0x21cc62=_0x21cc62-0x0;var _0x4f5940=_0x591b[_0x21cc62];return _0x4f5940;};'use strict';var _=require(_0xb591('0x0'));var moment=require(_0xb591('0x1'));exports[_0xb591('0x2')]=function(_0x2188de){var _0x16b28a={'conditions':[]};_0x16b28a[_0xb591('0x3')]=_[_0xb591('0x4')](_0x2188de,_0xb591('0x5'))?'or':_0xb591('0x6');var _0x1ae07e=_0x2188de[_0xb591('0x7')](_0xb591('0x8'),'')[_0xb591('0x7')]('[$or]','')[_0xb591('0x9')]('||');for(var _0x1da29f=0x0;_0x1da29f<_0x1ae07e['length'];_0x1da29f++){var _0x176d34=_0x1ae07e[_0x1da29f][_0xb591('0x9')](':=');var _0x4f5a25=_0x176d34[0x0];var _0x25efd1=_0x176d34['slice'](0x1);_0x25efd1[_0xb591('0xa')](function(_0x372cb0){var _0x552829=_0x372cb0[_0xb591('0x9')]('[')[_0xb591('0xb')]();var _0x12823f=_0x372cb0['match'](/\[(.*?)\]/g);_0x12823f[_0xb591('0xa')](function(_0x1edcb1){var _0x3cd669=_0x1edcb1[_0xb591('0x9')]('[')[_0xb591('0xc')](function(_0x5c276c){return _0x5c276c[_0xb591('0xd')](']')>-0x1;})[_0xb591('0xe')](function(_0x472ab5){return _0x472ab5[_0xb591('0x9')](']')[0x0];})[0x0];_0x16b28a[_0xb591('0xf')][_0xb591('0x10')]({'field':_0x4f5a25,'operator':_0x552829,'value':_0x3cd669});});});}return _0x16b28a;};exports['buildExpression']=function(_0x120e39,_0x4a4167,_0x561af2){var _0x2ccf57={};if(_0x4a4167===_0xb591('0x11')){if(_0x561af2['operator']===_0xb591('0x12')){_0x561af2[_0xb591('0x13')]=_0xb591('0x14');_0x561af2[_0xb591('0x15')]+=','+_0x561af2['value'];}else if(_[_0xb591('0x16')]([_0xb591('0x17'),_0xb591('0x18')],_0x561af2[_0xb591('0x13')])){_0x561af2['value']=moment(_0x561af2[_0xb591('0x15')])[_0xb591('0x19')](0x1,_0xb591('0x1a'))[_0xb591('0x1b')](_0xb591('0x1c'));}}if(_0x561af2[_0xb591('0x1d')]){_0x4a4167=_0x561af2[_0xb591('0x1d')];_0x2ccf57[_0xb591('0x1e')]=_0xb591('0x1f')+_0x120e39+'.'+_0x561af2[_0xb591('0x20')]+_0xb591('0x21')+_0x561af2[_0xb591('0x1d')]+')\x20'+parseOperator(_0x561af2['operator']);}else{_0x2ccf57[_0xb591('0x1e')]=_0x120e39+'.'+_0x561af2['field']+'\x20'+parseOperator(_0x561af2['operator']);}if(_[_0xb591('0x16')]([_0xb591('0x22'),'$notIn'],_0x561af2['operator']))_0x2ccf57[_0xb591('0x1e')]='('+_0x2ccf57[_0xb591('0x1e')]+_0xb591('0x23')+_0x120e39+'.'+_0x561af2['field']+_0xb591('0x24');_0x2ccf57['value']=parseValue(_0x4a4167,_0x561af2[_0xb591('0x13')],_0x561af2['value']);return _0x2ccf57;};function parseOperator(_0x352442){var _0x3bc320;switch(_0x352442){case _0xb591('0x25'):_0x3bc320='IN\x20?';break;case _0xb591('0x26'):_0x3bc320=_0xb591('0x27');break;case _0xb591('0x12'):_0x3bc320='=\x20?';break;case _0xb591('0x22'):_0x3bc320='<>\x20?';break;case _0xb591('0x28'):case _0xb591('0x29'):case _0xb591('0x2a'):_0x3bc320=_0xb591('0x2b');break;case _0xb591('0x2c'):_0x3bc320='<\x20?';break;case'$gt':_0x3bc320=_0xb591('0x2d');break;case _0xb591('0x18'):_0x3bc320=_0xb591('0x2e');break;case _0xb591('0x2f'):_0x3bc320='>=\x20?';break;case _0xb591('0x14'):_0x3bc320='BETWEEN\x20?\x20AND\x20?';break;}return _0x3bc320;}function parseValue(_0x1e4203,_0x2d7ef8,_0x2a5a98){var _0x5ac244={'start':undefined,'end':undefined};switch(_0x2d7ef8){case _0xb591('0x25'):case'$notIn':_0x5ac244[_0xb591('0x30')]=_0x2a5a98[_0xb591('0x9')](',');break;case _0xb591('0x28'):_0x5ac244[_0xb591('0x30')]='%'+_0x2a5a98+'%';break;case _0xb591('0x29'):_0x5ac244['start']=_0x2a5a98+'%';break;case _0xb591('0x2a'):_0x5ac244[_0xb591('0x30')]='%'+_0x2a5a98;break;case _0xb591('0x14'):var _0x451f46=_0x2a5a98[_0xb591('0x9')](',');var _0x2a5a98=_0x451f46[_0xb591('0xb')]();var _0x365d0a=_0x451f46[_0xb591('0x31')]();if(_0x1e4203===_0xb591('0x11')){_0x2a5a98=moment(_0x2a5a98)[_0xb591('0x32')](0x0,!![])[_0xb591('0x1b')]();_0x365d0a=moment(_0x365d0a)['utcOffset'](0x0,!![])[_0xb591('0x19')](0x17,_0xb591('0x33'))[_0xb591('0x19')](0x3b,_0xb591('0x34'))[_0xb591('0x19')](0x3b,'seconds')[_0xb591('0x1b')]();}_0x5ac244={'start':_0x2a5a98,'end':_0x365d0a};break;default:_0x5ac244[_0xb591('0x30')]=_0x2a5a98;break;}return _0x5ac244;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 8f2cefe..f3b2796 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 _0xa5c1=['intersection','fields','order','where','pick','filter','merge','VIRTUAL','lower','options','lodash','sequelize','moment','parse','keys','split','filters','forOwn','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','subtract','name','uniqueid','limit','offset','sort','map','priority','cast','col','unsigned','substr','DESC','ASC','omit','isEmpty','isArray','length','isObject','unset','hasOwnProperty','^[+]?[0-9]*$','isEmail','match','getFullTextValue','forEach','replace','push','join','query','$id','model','attributes'];(function(_0x2d4d5b,_0x528f86){var _0xf4aac6=function(_0x3eae4a){while(--_0x3eae4a){_0x2d4d5b['push'](_0x2d4d5b['shift']());}};_0xf4aac6(++_0x528f86);}(_0xa5c1,0x80));var _0x1a5c=function(_0x343b64,_0x4b830c){_0x343b64=_0x343b64-0x0;var _0x1fb805=_0xa5c1[_0x343b64];return _0x1fb805;};'use strict';var _=require(_0x1a5c('0x0'));var sequelize=require(_0x1a5c('0x1'));var moment=require(_0x1a5c('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x4c59d0){var _0xfe64a6=['ne'];try{var _0x3415a0=JSON[_0x1a5c('0x3')](_0x4c59d0);var _0x48be5d=Object[_0x1a5c('0x4')](_0x3415a0)[0x0];return _0xfe64a6['includes'](_0x48be5d);}catch(_0x45792f){return![];}}function getOperatorValue(_0x57dd9a){var _0x5d7ef9=JSON[_0x1a5c('0x3')](_0x57dd9a);var _0x1fb50e=Object['keys'](_0x5d7ef9)[0x0];var _0x27e0a3=_0x5d7ef9[_0x1fb50e];return{['$'+_0x1fb50e]:_0x27e0a3};}exports['fields']=function(_0x105319){var _0x2d30ab=null;if(_0x105319){_0x2d30ab=_0x105319[_0x1a5c('0x5')](',');}return _0x2d30ab;};exports[_0x1a5c('0x6')]=function(_0x57b76d,_0x34d35a){var _0x1cb3c9={};if(!_['isEmpty'](_0x57b76d)){_[_0x1a5c('0x7')](_0x57b76d,function(_0x446274,_0x4eceb3){try{if(_0x34d35a){var _0x1f9c82=_[_0x1a5c('0x8')](_0x34d35a,{'name':_0x4eceb3})||{};if(hasSequelizeOperator(_0x446274)){_0x1cb3c9[_0x4eceb3]=getOperatorValue(_0x446274);}else if(_0x1f9c82[_0x1a5c('0x9')]===_0x1a5c('0xa')&&_[_0x1a5c('0xb')](_0x446274)){var _0xbbded0=JSON[_0x1a5c('0x3')](_0x446274);var _0x3f767e={'$gte':moment(moment(_0xbbded0[_0x1a5c('0xc')])[_0x1a5c('0xd')](_0x1a5c('0xe')))[_0x1a5c('0xf')]()[_0x1a5c('0xd')](),'$lte':moment(moment(_0xbbded0['$lte'])[_0x1a5c('0xd')](_0x1a5c('0xe')))[_0x1a5c('0xf')]()[_0x1a5c('0x10')](0x1,'s')[_0x1a5c('0xd')]()};_0x1cb3c9[_0x4eceb3]=_0x3f767e;}else if(_0x1f9c82[_0x1a5c('0x11')]===_0x1a5c('0x12')){_0x1cb3c9[_0x4eceb3]=_0x446274;}else{_0x1cb3c9[_0x4eceb3]=_['isArray'](_0x446274)?_0x446274:JSON['parse'](_0x446274);}}else{_0x1cb3c9[_0x4eceb3]=_['isArray'](_0x446274)?_0x446274:JSON[_0x1a5c('0x3')](_0x446274);}}catch(_0xb40eb6){_0x1cb3c9[_0x4eceb3]=_0x446274[_0x1a5c('0x5')](',');}});}return _0x1cb3c9;};exports[_0x1a5c('0x13')]=function(_0x3f6be7){_0x3f6be7=parseInt(_0x3f6be7,0xa);if(!_0x3f6be7||_0x3f6be7<0x0){_0x3f6be7=LIMIT_VALUE;}return _0x3f6be7;};exports[_0x1a5c('0x14')]=function(_0x1d4d1b){_0x1d4d1b=parseInt(_0x1d4d1b,0xa);if(!_0x1d4d1b||_0x1d4d1b<0x0){_0x1d4d1b=0x0;}return _0x1d4d1b;};exports[_0x1a5c('0x15')]=function(_0x36c48b){var _0x3588ef,_0x2473c1=null;if(_0x36c48b){_0x3588ef=_0x36c48b[_0x1a5c('0x5')](',');_0x2473c1=_[_0x1a5c('0x16')](_0x3588ef,function(_0x4d8a30){if(_0x4d8a30['indexOf']('-')===0x0){return[_0x4d8a30===_0x1a5c('0x17')?sequelize[_0x1a5c('0x18')](sequelize[_0x1a5c('0x19')]('priority'),_0x1a5c('0x1a')):_0x4d8a30[_0x1a5c('0x1b')](0x1),_0x1a5c('0x1c')];}else{return[_0x4d8a30==='priority'?sequelize[_0x1a5c('0x18')](sequelize[_0x1a5c('0x19')]('priority'),_0x1a5c('0x1a')):_0x4d8a30,_0x1a5c('0x1d')];}});}return _0x2473c1;};exports[_0x1a5c('0x1e')]=function(_0x1b195a,_0x2dafad){if(_[_0x1a5c('0x1f')](_0x1b195a)){return _0x1b195a;}if(_[_0x1a5c('0x20')](_0x1b195a)){for(var _0x14bb98=0x0;_0x14bb98<_0x1b195a[_0x1a5c('0x21')];_0x14bb98+=0x1){_0x1b195a[_0x14bb98]=this[_0x1a5c('0x1e')](_0x1b195a[_0x14bb98],_0x2dafad);}return _0x1b195a;}if(!_[_0x1a5c('0x22')](_0x1b195a)){return _0x1b195a;}if(_['isString'](_0x2dafad)){_0x2dafad=[_0x2dafad];}if(!_[_0x1a5c('0x20')](_0x2dafad)){return _0x1b195a;}for(var _0x5202ca=0x0;_0x5202ca<_0x2dafad[_0x1a5c('0x21')];_0x5202ca+=0x1){_[_0x1a5c('0x23')](_0x1b195a,_0x2dafad[_0x5202ca]);}for(var _0x4665b1 in _0x1b195a){if(_0x1b195a[_0x1a5c('0x24')](_0x4665b1)){_0x1b195a[_0x4665b1]=this['omit'](_0x1b195a[_0x4665b1],_0x2dafad);}}return _0x1b195a;};exports['isNumeric']=function(_0x15ef1c){return _0x15ef1c['match'](RegExp(_0x1a5c('0x25')))?!![]:![];};exports[_0x1a5c('0x26')]=function(_0x38694e){return _0x38694e[_0x1a5c('0x27')](/^\S+@\S+$/)?!![]:![];};exports[_0x1a5c('0x28')]=function(_0x1c4a91){var _0x4901ba=[];_0x1c4a91[_0x1a5c('0x5')](/[ ,]+/)[_0x1a5c('0x29')](function(_0x336156){_0x336156=_0x336156[_0x1a5c('0x2a')](/([^:]")"+/g,'$1');_0x336156='+'+_0x336156+'*';if(_0x336156['includes']('@'))_0x336156='\x22'+_0x336156+'\x22';_0x4901ba[_0x1a5c('0x2b')](_0x336156);});return _0x4901ba[_0x1a5c('0x2c')]('\x20');};exports['getOptions']=function(_0x5238bd,_0x50f4ba,_0x32f36e){var _0x447cf5={},_0x3b071d={};if(_0x50f4ba[_0x1a5c('0x2d')][_0x1a5c('0x2e')]){_0x50f4ba[_0x1a5c('0x2d')]['id']=_0x50f4ba[_0x1a5c('0x2d')]['$id'];delete _0x50f4ba[_0x1a5c('0x2d')][_0x1a5c('0x2e')];}_0x447cf5[_0x1a5c('0x2f')]=_[_0x1a5c('0x16')](_0x5238bd,_0x1a5c('0x11'));_0x447cf5[_0x1a5c('0x2d')]=_[_0x1a5c('0x4')](_0x50f4ba[_0x1a5c('0x2d')]);_0x447cf5[_0x1a5c('0x6')]=_['intersection'](_0x447cf5[_0x1a5c('0x2f')],_0x447cf5[_0x1a5c('0x2d')]);_0x3b071d[_0x1a5c('0x30')]=_[_0x1a5c('0x31')](_0x447cf5['model'],this[_0x1a5c('0x32')](_0x50f4ba['query'][_0x1a5c('0x32')]));_0x3b071d[_0x1a5c('0x30')]=_0x3b071d[_0x1a5c('0x30')][_0x1a5c('0x21')]?_0x3b071d[_0x1a5c('0x30')]:_0x447cf5['model'];if(!_0x50f4ba[_0x1a5c('0x2d')]['hasOwnProperty']('nolimit')){_0x3b071d['limit']=this['limit'](_0x50f4ba['query'][_0x1a5c('0x13')]);_0x3b071d[_0x1a5c('0x14')]=this['offset'](_0x50f4ba[_0x1a5c('0x2d')]['offset']);}_0x3b071d[_0x1a5c('0x33')]=this[_0x1a5c('0x15')](_0x50f4ba[_0x1a5c('0x2d')][_0x1a5c('0x15')]);_0x3b071d[_0x1a5c('0x34')]=this[_0x1a5c('0x6')](_[_0x1a5c('0x35')](_0x50f4ba[_0x1a5c('0x2d')],_0x447cf5['filters']),_0x5238bd);if(_0x50f4ba[_0x1a5c('0x2d')][_0x1a5c('0x36')]){_0x3b071d[_0x1a5c('0x34')]=_[_0x1a5c('0x37')](_0x3b071d['where'],{'$or':_['map'](_0x5238bd,function(_0x150e7d){if(_0x150e7d['type']!==_0x1a5c('0x38')){if(_0x32f36e){return sequelize[_0x1a5c('0x34')](sequelize['fn'](_0x1a5c('0x39'),sequelize['col'](_0x150e7d[_0x1a5c('0x11')])),{'$like':sequelize['fn']('lower','%'+_0x50f4ba[_0x1a5c('0x2d')]['filter']+'%')});}else{var _0x459b42={};_0x459b42[_0x150e7d[_0x1a5c('0x11')]]={'$like':'%'+_0x50f4ba[_0x1a5c('0x2d')]['filter']+'%'};return _0x459b42;}}})});}_0x3b071d=_['merge']({},_0x3b071d,_0x50f4ba[_0x1a5c('0x3a')]);return _0x3b071d;}; \ No newline at end of file +var _0x8f5d=['cast','unsigned','omit','length','isString','unset','hasOwnProperty','^[+]?[0-9]*$','isEmail','forEach','replace','push','join','getOptions','query','$id','intersection','model','attributes','nolimit','limit','offset','order','pick','filter','where','merge','VIRTUAL','lower','sequelize','moment','parse','includes','keys','fields','split','filters','isEmpty','find','type','isPlainObject','$gte','format','YYYY-MM-DD','utc','subtract','name','uniqueid','isArray','sort','map','indexOf','priority'];(function(_0x53c448,_0x221de9){var _0x8d1b20=function(_0x1fdd4d){while(--_0x1fdd4d){_0x53c448['push'](_0x53c448['shift']());}};_0x8d1b20(++_0x221de9);}(_0x8f5d,0xf1));var _0xd8f5=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0x8f5d[_0x176329];return _0x31997c;};'use strict';var _=require('lodash');var sequelize=require(_0xd8f5('0x0'));var moment=require(_0xd8f5('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x4201b3){var _0x464bd5=['ne'];try{var _0x4a85a7=JSON[_0xd8f5('0x2')](_0x4201b3);var _0x260b59=Object['keys'](_0x4a85a7)[0x0];return _0x464bd5[_0xd8f5('0x3')](_0x260b59);}catch(_0x2a3392){return![];}}function getOperatorValue(_0x2846fc){var _0x4d7050=JSON[_0xd8f5('0x2')](_0x2846fc);var _0x1ddb8c=Object[_0xd8f5('0x4')](_0x4d7050)[0x0];var _0x525496=_0x4d7050[_0x1ddb8c];return{['$'+_0x1ddb8c]:_0x525496};}exports[_0xd8f5('0x5')]=function(_0x9592d9){var _0x503b9a=null;if(_0x9592d9){_0x503b9a=_0x9592d9[_0xd8f5('0x6')](',');}return _0x503b9a;};exports[_0xd8f5('0x7')]=function(_0x482e68,_0x6cbbf3){var _0x5933e5={};if(!_[_0xd8f5('0x8')](_0x482e68)){_['forOwn'](_0x482e68,function(_0x3f0846,_0x31d496){try{if(_0x6cbbf3){var _0x2e882b=_[_0xd8f5('0x9')](_0x6cbbf3,{'name':_0x31d496})||{};if(hasSequelizeOperator(_0x3f0846)){_0x5933e5[_0x31d496]=getOperatorValue(_0x3f0846);}else if(_0x2e882b[_0xd8f5('0xa')]==='DATE'&&_[_0xd8f5('0xb')](_0x3f0846)){var _0x3c1291=JSON[_0xd8f5('0x2')](_0x3f0846);var _0x2c07fe={'$gte':moment(moment(_0x3c1291[_0xd8f5('0xc')])[_0xd8f5('0xd')](_0xd8f5('0xe')))[_0xd8f5('0xf')]()[_0xd8f5('0xd')](),'$lte':moment(moment(_0x3c1291['$lte'])[_0xd8f5('0xd')](_0xd8f5('0xe')))[_0xd8f5('0xf')]()[_0xd8f5('0x10')](0x1,'s')[_0xd8f5('0xd')]()};_0x5933e5[_0x31d496]=_0x2c07fe;}else if(_0x2e882b[_0xd8f5('0x11')]===_0xd8f5('0x12')){_0x5933e5[_0x31d496]=_0x3f0846;}else{_0x5933e5[_0x31d496]=_[_0xd8f5('0x13')](_0x3f0846)?_0x3f0846:JSON[_0xd8f5('0x2')](_0x3f0846);}}else{_0x5933e5[_0x31d496]=_[_0xd8f5('0x13')](_0x3f0846)?_0x3f0846:JSON[_0xd8f5('0x2')](_0x3f0846);}}catch(_0x329220){_0x5933e5[_0x31d496]=_0x3f0846[_0xd8f5('0x6')](',');}});}return _0x5933e5;};exports['limit']=function(_0x4c0572){_0x4c0572=parseInt(_0x4c0572,0xa);if(!_0x4c0572||_0x4c0572<0x0){_0x4c0572=LIMIT_VALUE;}return _0x4c0572;};exports['offset']=function(_0x35d5d9){_0x35d5d9=parseInt(_0x35d5d9,0xa);if(!_0x35d5d9||_0x35d5d9<0x0){_0x35d5d9=0x0;}return _0x35d5d9;};exports[_0xd8f5('0x14')]=function(_0xa00e0){var _0x48bd94,_0x312dd8=null;if(_0xa00e0){_0x48bd94=_0xa00e0['split'](',');_0x312dd8=_[_0xd8f5('0x15')](_0x48bd94,function(_0x238f09){if(_0x238f09[_0xd8f5('0x16')]('-')===0x0){return[_0x238f09===_0xd8f5('0x17')?sequelize[_0xd8f5('0x18')](sequelize['col'](_0xd8f5('0x17')),_0xd8f5('0x19')):_0x238f09['substr'](0x1),'DESC'];}else{return[_0x238f09===_0xd8f5('0x17')?sequelize[_0xd8f5('0x18')](sequelize['col'](_0xd8f5('0x17')),'unsigned'):_0x238f09,'ASC'];}});}return _0x312dd8;};exports[_0xd8f5('0x1a')]=function(_0xf8fdaa,_0x45eb29){if(_[_0xd8f5('0x8')](_0xf8fdaa)){return _0xf8fdaa;}if(_['isArray'](_0xf8fdaa)){for(var _0x44e9ac=0x0;_0x44e9ac<_0xf8fdaa[_0xd8f5('0x1b')];_0x44e9ac+=0x1){_0xf8fdaa[_0x44e9ac]=this['omit'](_0xf8fdaa[_0x44e9ac],_0x45eb29);}return _0xf8fdaa;}if(!_['isObject'](_0xf8fdaa)){return _0xf8fdaa;}if(_[_0xd8f5('0x1c')](_0x45eb29)){_0x45eb29=[_0x45eb29];}if(!_[_0xd8f5('0x13')](_0x45eb29)){return _0xf8fdaa;}for(var _0x4727f7=0x0;_0x4727f7<_0x45eb29[_0xd8f5('0x1b')];_0x4727f7+=0x1){_[_0xd8f5('0x1d')](_0xf8fdaa,_0x45eb29[_0x4727f7]);}for(var _0x226313 in _0xf8fdaa){if(_0xf8fdaa[_0xd8f5('0x1e')](_0x226313)){_0xf8fdaa[_0x226313]=this['omit'](_0xf8fdaa[_0x226313],_0x45eb29);}}return _0xf8fdaa;};exports['isNumeric']=function(_0x110eea){return _0x110eea['match'](RegExp(_0xd8f5('0x1f')))?!![]:![];};exports[_0xd8f5('0x20')]=function(_0x3bb0e1){return _0x3bb0e1['match'](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x3fcea6){var _0x37cf15=[];_0x3fcea6['split'](/[ ,]+/)[_0xd8f5('0x21')](function(_0x444983){_0x444983=_0x444983[_0xd8f5('0x22')](/([^:]")"+/g,'$1');_0x444983='+'+_0x444983+'*';if(_0x444983['includes']('@'))_0x444983='\x22'+_0x444983+'\x22';_0x37cf15[_0xd8f5('0x23')](_0x444983);});return _0x37cf15[_0xd8f5('0x24')]('\x20');};exports[_0xd8f5('0x25')]=function(_0x508fac,_0x3d66e5,_0x650229){var _0x5f1cf5={},_0x3c2ec5={};if(_0x3d66e5[_0xd8f5('0x26')]['$id']){_0x3d66e5['query']['id']=_0x3d66e5[_0xd8f5('0x26')]['$id'];delete _0x3d66e5[_0xd8f5('0x26')][_0xd8f5('0x27')];}_0x5f1cf5['model']=_['map'](_0x508fac,_0xd8f5('0x11'));_0x5f1cf5[_0xd8f5('0x26')]=_[_0xd8f5('0x4')](_0x3d66e5[_0xd8f5('0x26')]);_0x5f1cf5['filters']=_[_0xd8f5('0x28')](_0x5f1cf5[_0xd8f5('0x29')],_0x5f1cf5[_0xd8f5('0x26')]);_0x3c2ec5[_0xd8f5('0x2a')]=_['intersection'](_0x5f1cf5[_0xd8f5('0x29')],this['fields'](_0x3d66e5['query'][_0xd8f5('0x5')]));_0x3c2ec5[_0xd8f5('0x2a')]=_0x3c2ec5[_0xd8f5('0x2a')]['length']?_0x3c2ec5[_0xd8f5('0x2a')]:_0x5f1cf5[_0xd8f5('0x29')];if(!_0x3d66e5['query'][_0xd8f5('0x1e')](_0xd8f5('0x2b'))){_0x3c2ec5[_0xd8f5('0x2c')]=this[_0xd8f5('0x2c')](_0x3d66e5[_0xd8f5('0x26')][_0xd8f5('0x2c')]);_0x3c2ec5['offset']=this[_0xd8f5('0x2d')](_0x3d66e5[_0xd8f5('0x26')]['offset']);}_0x3c2ec5[_0xd8f5('0x2e')]=this[_0xd8f5('0x14')](_0x3d66e5[_0xd8f5('0x26')][_0xd8f5('0x14')]);_0x3c2ec5['where']=this[_0xd8f5('0x7')](_[_0xd8f5('0x2f')](_0x3d66e5[_0xd8f5('0x26')],_0x5f1cf5['filters']),_0x508fac);if(_0x3d66e5[_0xd8f5('0x26')][_0xd8f5('0x30')]){_0x3c2ec5[_0xd8f5('0x31')]=_[_0xd8f5('0x32')](_0x3c2ec5[_0xd8f5('0x31')],{'$or':_[_0xd8f5('0x15')](_0x508fac,function(_0x1085ef){if(_0x1085ef[_0xd8f5('0xa')]!==_0xd8f5('0x33')){if(_0x650229){return sequelize['where'](sequelize['fn'](_0xd8f5('0x34'),sequelize['col'](_0x1085ef[_0xd8f5('0x11')])),{'$like':sequelize['fn'](_0xd8f5('0x34'),'%'+_0x3d66e5['query']['filter']+'%')});}else{var _0x12fdbe={};_0x12fdbe[_0x1085ef[_0xd8f5('0x11')]]={'$like':'%'+_0x3d66e5[_0xd8f5('0x26')][_0xd8f5('0x30')]+'%'};return _0x12fdbe;}}})});}_0x3c2ec5=_['merge']({},_0x3c2ec5,_0x3d66e5['options']);return _0x3c2ec5;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 058ed62..2604906 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe5b7=['passport','cors','moment','./environment','../mysqldb','default','get','env','production','set','join','public','development','appPath','root','use','split','static','views','/server/views','html','ejs','renderFile','view\x20engine','50mb','initialize','body-parser','method-override','errorhandler'];(function(_0x1ea2a7,_0x2cd538){var _0x5c9923=function(_0x275f56){while(--_0x275f56){_0x1ea2a7['push'](_0x1ea2a7['shift']());}};_0x5c9923(++_0x2cd538);}(_0xe5b7,0x1ea));var _0x7e5b=function(_0x493356,_0xd8e807){_0x493356=_0x493356-0x0;var _0xa9116f=_0xe5b7[_0x493356];return _0xa9116f;};'use strict';var express=require('express');var favicon=require('serve-favicon');var bodyParser=require(_0x7e5b('0x0'));var methodOverride=require(_0x7e5b('0x1'));var cookieParser=require('cookie-parser');var errorHandler=require(_0x7e5b('0x2'));var path=require('path');var passport=require(_0x7e5b('0x3'));var cors=require(_0x7e5b('0x4'));var moment=require(_0x7e5b('0x5'));var config=require(_0x7e5b('0x6'));var db=require(_0x7e5b('0x7'))['db'];exports[_0x7e5b('0x8')]=function(_0x38222e){var _0x222b39=_0x38222e[_0x7e5b('0x9')](_0x7e5b('0xa'));if(_0x222b39===_0x7e5b('0xb')){_0x38222e[_0x7e5b('0xc')]('appPath',path[_0x7e5b('0xd')](config['root'],_0x7e5b('0xe')));}if(_0x222b39===_0x7e5b('0xf')||_0x222b39==='test'){_0x38222e[_0x7e5b('0xc')](_0x7e5b('0x10'),path['join'](config[_0x7e5b('0x11')],'client'));_0x38222e[_0x7e5b('0x12')](errorHandler());}_0x38222e[_0x7e5b('0xc')]('json\x20replacer',function(_0x2b742a,_0x4d5c2f){if(this[_0x2b742a]instanceof Date){_0x4d5c2f=this[_0x2b742a]['toISOString']()[_0x7e5b('0x13')]('.')[0x0]+'Z';}return _0x4d5c2f;});_0x38222e['use'](express[_0x7e5b('0x14')](_0x38222e[_0x7e5b('0x9')](_0x7e5b('0x10'))));_0x38222e['set'](_0x7e5b('0x15'),config[_0x7e5b('0x11')]+_0x7e5b('0x16'));_0x38222e['engine'](_0x7e5b('0x17'),require(_0x7e5b('0x18'))[_0x7e5b('0x19')]);_0x38222e['set'](_0x7e5b('0x1a'),'html');_0x38222e[_0x7e5b('0x12')](bodyParser['urlencoded']({'limit':_0x7e5b('0x1b'),'extended':!![]}));_0x38222e[_0x7e5b('0x12')](bodyParser['json']({'limit':_0x7e5b('0x1b')}));_0x38222e[_0x7e5b('0x12')](cors());_0x38222e[_0x7e5b('0x12')](methodOverride());_0x38222e[_0x7e5b('0x12')](cookieParser());_0x38222e[_0x7e5b('0x12')](passport[_0x7e5b('0x1c')]());}; \ No newline at end of file +var _0x3c84=['path','cors','moment','./environment','../mysqldb','default','get','set','appPath','join','root','public','test','client','use','json\x20replacer','toISOString','static','views','/server/views','engine','html','renderFile','urlencoded','50mb','json','initialize','express','body-parser','method-override','cookie-parser','errorhandler'];(function(_0x250c83,_0x4ae994){var _0x28a3a9=function(_0x48e2c0){while(--_0x48e2c0){_0x250c83['push'](_0x250c83['shift']());}};_0x28a3a9(++_0x4ae994);}(_0x3c84,0x7b));var _0x43c8=function(_0x5813fd,_0x19a5ca){_0x5813fd=_0x5813fd-0x0;var _0xce0ac9=_0x3c84[_0x5813fd];return _0xce0ac9;};'use strict';var express=require(_0x43c8('0x0'));var favicon=require('serve-favicon');var bodyParser=require(_0x43c8('0x1'));var methodOverride=require(_0x43c8('0x2'));var cookieParser=require(_0x43c8('0x3'));var errorHandler=require(_0x43c8('0x4'));var path=require(_0x43c8('0x5'));var passport=require('passport');var cors=require(_0x43c8('0x6'));var moment=require(_0x43c8('0x7'));var config=require(_0x43c8('0x8'));var db=require(_0x43c8('0x9'))['db'];exports[_0x43c8('0xa')]=function(_0x1f24a0){var _0x56097c=_0x1f24a0[_0x43c8('0xb')]('env');if(_0x56097c==='production'){_0x1f24a0[_0x43c8('0xc')](_0x43c8('0xd'),path[_0x43c8('0xe')](config[_0x43c8('0xf')],_0x43c8('0x10')));}if(_0x56097c==='development'||_0x56097c===_0x43c8('0x11')){_0x1f24a0[_0x43c8('0xc')]('appPath',path[_0x43c8('0xe')](config[_0x43c8('0xf')],_0x43c8('0x12')));_0x1f24a0[_0x43c8('0x13')](errorHandler());}_0x1f24a0['set'](_0x43c8('0x14'),function(_0x753305,_0x5794d){if(this[_0x753305]instanceof Date){_0x5794d=this[_0x753305][_0x43c8('0x15')]()['split']('.')[0x0]+'Z';}return _0x5794d;});_0x1f24a0[_0x43c8('0x13')](express[_0x43c8('0x16')](_0x1f24a0[_0x43c8('0xb')](_0x43c8('0xd'))));_0x1f24a0[_0x43c8('0xc')](_0x43c8('0x17'),config['root']+_0x43c8('0x18'));_0x1f24a0[_0x43c8('0x19')](_0x43c8('0x1a'),require('ejs')[_0x43c8('0x1b')]);_0x1f24a0[_0x43c8('0xc')]('view\x20engine',_0x43c8('0x1a'));_0x1f24a0['use'](bodyParser[_0x43c8('0x1c')]({'limit':_0x43c8('0x1d'),'extended':!![]}));_0x1f24a0[_0x43c8('0x13')](bodyParser[_0x43c8('0x1e')]({'limit':_0x43c8('0x1d')}));_0x1f24a0[_0x43c8('0x13')](cors());_0x1f24a0[_0x43c8('0x13')](methodOverride());_0x1f24a0[_0x43c8('0x13')](cookieParser());_0x1f24a0[_0x43c8('0x13')](passport[_0x43c8('0x1f')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 0b9880c..c4fc59a 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 _0xd9ef=['ipAddress','hex','substring','lodash','bimedia-machine-uuid','child_process','../environment','networkInterfaces','length','filter','family','IPv4','internal','concat','head','mac','address','127.0.0.1','getFirstInterface','model','createHash','update','digest','platform','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','replace'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0xd9ef,0xce));var _0xfd9e=function(_0x3d53e6,_0x7a8d60){_0x3d53e6=_0x3d53e6-0x0;var _0x5651d5=_0xd9ef[_0x3d53e6];return _0x5651d5;};'use strict';var _=require(_0xfd9e('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0xfd9e('0x1'));var exec=require(_0xfd9e('0x2'))['execSync'];var config=require(_0xfd9e('0x3'));function getInterfaces(){var _0x442928=[];var _0x399903=os[_0xfd9e('0x4')]();var _0xd222ff=_['orderBy'](_['keys'](_0x399903));for(var _0x8246d2=0x0;_0x8246d2<_0xd222ff[_0xfd9e('0x5')];_0x8246d2++){var _0x4cc905=_0x399903[_0xd222ff[_0x8246d2]][_0xfd9e('0x6')](function(_0x183afb){return _0x183afb[_0xfd9e('0x7')]===_0xfd9e('0x8')&&_0x183afb[_0xfd9e('0x9')]===![];});_0x442928=_0x442928[_0xfd9e('0xa')](_0x4cc905);}return _0x442928;}function getFirstInterface(){var _0x113529=_[_0xfd9e('0xb')](getInterfaces());return{'macAddress':_0x113529&&_0x113529[_0xfd9e('0xc')]?_0x113529[_0xfd9e('0xc')]:'00:00:00:00:00:00','ipAddress':_0x113529&&_0x113529[_0xfd9e('0xd')]?_0x113529['address']:_0xfd9e('0xe')};}exports[_0xfd9e('0xf')]=getFirstInterface;function getCPUhash(){var _0x2eeb24=_['orderBy'](os['cpus']()['map'](function(_0x557a5a){return _0x557a5a[_0xfd9e('0x10')];}))['join'](':');return crypto[_0xfd9e('0x11')]('md5')[_0xfd9e('0x12')](_0x2eeb24)[_0xfd9e('0x13')]('hex');}exports['getUuid']=function(){var _0x3c1936=os[_0xfd9e('0x14')]();var _0x3ac8b0=/[0-9a-f-]{36}/;if(config[_0xfd9e('0x15')]&&_0x3ac8b0['test'](config['licenseToken'])){return config[_0xfd9e('0x15')];}else if(_0x3c1936===_0xfd9e('0x16')){return exec(_0xfd9e('0x17'),{'encoding':_0xfd9e('0x18')})[_0xfd9e('0x19')]('\x0d\x0a','');}else{var _0x341176=getFirstInterface();var _0x2bb22c=getCPUhash();var _0x160637=_0x2bb22c+'|'+os['hostname']()+'|'+_0x341176['macAddress']+'|'+_0x341176[_0xfd9e('0x1a')];var _0x4ec98d=crypto[_0xfd9e('0x11')]('md5')[_0xfd9e('0x12')](_0x160637)[_0xfd9e('0x13')](_0xfd9e('0x1b'));return _0x4ec98d['substring'](0x0,0x8)+'-'+_0x4ec98d['substring'](0x8,0xc)+'-'+_0x4ec98d[_0xfd9e('0x1c')](0xc,0x10)+'-'+_0x4ec98d['substring'](0x10,0x14)+'-'+_0x4ec98d['substring'](0x14);}}; \ No newline at end of file +var _0x89a7=['length','filter','family','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','createHash','md5','digest','getUuid','platform','licenseToken','test','dmidecode\x20--string\x20system-uuid','utf8','replace','macAddress','ipAddress','update','hex','substring','lodash','crypto','child_process','execSync','../environment','networkInterfaces','orderBy','keys'];(function(_0x43cb7b,_0x4c16c5){var _0x58d5e8=function(_0x8260f){while(--_0x8260f){_0x43cb7b['push'](_0x43cb7b['shift']());}};_0x58d5e8(++_0x4c16c5);}(_0x89a7,0x179));var _0x789a=function(_0x1ffbbe,_0x54aa8f){_0x1ffbbe=_0x1ffbbe-0x0;var _0x4165e0=_0x89a7[_0x1ffbbe];return _0x4165e0;};'use strict';var _=require(_0x789a('0x0'));var os=require('os');var crypto=require(_0x789a('0x1'));var machine=require('bimedia-machine-uuid');var exec=require(_0x789a('0x2'))[_0x789a('0x3')];var config=require(_0x789a('0x4'));function getInterfaces(){var _0x13456e=[];var _0x281bf0=os[_0x789a('0x5')]();var _0x39349d=_[_0x789a('0x6')](_[_0x789a('0x7')](_0x281bf0));for(var _0x2bd02d=0x0;_0x2bd02d<_0x39349d[_0x789a('0x8')];_0x2bd02d++){var _0x3b19b2=_0x281bf0[_0x39349d[_0x2bd02d]][_0x789a('0x9')](function(_0x561253){return _0x561253[_0x789a('0xa')]==='IPv4'&&_0x561253['internal']===![];});_0x13456e=_0x13456e['concat'](_0x3b19b2);}return _0x13456e;}function getFirstInterface(){var _0x36d0ce=_[_0x789a('0xb')](getInterfaces());return{'macAddress':_0x36d0ce&&_0x36d0ce[_0x789a('0xc')]?_0x36d0ce[_0x789a('0xc')]:_0x789a('0xd'),'ipAddress':_0x36d0ce&&_0x36d0ce[_0x789a('0xe')]?_0x36d0ce[_0x789a('0xe')]:_0x789a('0xf')};}exports[_0x789a('0x10')]=getFirstInterface;function getCPUhash(){var _0x4b1863=_[_0x789a('0x6')](os[_0x789a('0x11')]()[_0x789a('0x12')](function(_0x2b292){return _0x2b292[_0x789a('0x13')];}))['join'](':');return crypto[_0x789a('0x14')](_0x789a('0x15'))['update'](_0x4b1863)[_0x789a('0x16')]('hex');}exports[_0x789a('0x17')]=function(){var _0x3cec15=os[_0x789a('0x18')]();var _0x1813b3=/[0-9a-f-]{36}/;if(config[_0x789a('0x19')]&&_0x1813b3[_0x789a('0x1a')](config[_0x789a('0x19')])){return config[_0x789a('0x19')];}else if(_0x3cec15==='win32'){return exec(_0x789a('0x1b'),{'encoding':_0x789a('0x1c')})[_0x789a('0x1d')]('\x0d\x0a','');}else{var _0x4753e5=getFirstInterface();var _0x4d5449=getCPUhash();var _0x355b7c=_0x4d5449+'|'+os['hostname']()+'|'+_0x4753e5[_0x789a('0x1e')]+'|'+_0x4753e5[_0x789a('0x1f')];var _0x2f1243=crypto[_0x789a('0x14')](_0x789a('0x15'))[_0x789a('0x20')](_0x355b7c)[_0x789a('0x16')](_0x789a('0x21'));return _0x2f1243[_0x789a('0x22')](0x0,0x8)+'-'+_0x2f1243[_0x789a('0x22')](0x8,0xc)+'-'+_0x2f1243[_0x789a('0x22')](0xc,0x10)+'-'+_0x2f1243['substring'](0x10,0x14)+'-'+_0x2f1243['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 928cdee..341f4fd 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 _0xe5d2=['THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','YYYY-MM-DD\x20HH:mm','encryptString','diff','catch','error','message','finally','getUuid','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','request-promise','bluebird','version','../../mysqldb','../logger','license','%s/api/servers/%s/check?version=%s','exports','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','get','data1','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xe5d2,0x90));var _0x2e5d=function(_0x372400,_0xdaeb10){_0x372400=_0x372400-0x0;var _0x4cd28c=_0xe5d2[_0x372400];return _0x4cd28c;};'use strict';var util=require(_0x2e5d('0x0'));var moment=require(_0x2e5d('0x1'));var rp=require(_0x2e5d('0x2'));var BPromise=require(_0x2e5d('0x3'));var pkginfo=require('pkginfo')(module,_0x2e5d('0x4'));var db=require(_0x2e5d('0x5'))['db'];var encryptor=require('../../components/encryptor');var hardware=require('./hardware');var logger=require(_0x2e5d('0x6'))(_0x2e5d('0x7'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x616521){return new BPromise(function(_0x58c2f9,_0x19616c){var _0x2b71e2=util['format'](_0x2e5d('0x8'),HOST,_0x616521,module[_0x2e5d('0x9')][_0x2e5d('0x4')]);if(oldToken){_0x2b71e2=util[_0x2e5d('0xa')](_0x2e5d('0xb'),HOST,_0x616521,module[_0x2e5d('0x9')][_0x2e5d('0x4')],oldToken);}var _0x2a41ba={'uri':_0x2b71e2,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x2a41ba)[_0x2e5d('0xc')](function(_0x5cafed){_0x58c2f9(_0x5cafed);})['catch'](function(_0x13cfba){_0x19616c(_0x13cfba);});});}function manageLicense(_0x3119e4,_0x15a000){var _0x25e94f=_0x15a000[_0x2e5d('0xd')]({'plain':!![]});if(!isOldTokenSent&&_0x25e94f['data1']!==_0x3119e4&&!_0x25e94f['data2']){oldToken=_0x25e94f[_0x2e5d('0xe')];}httpRequest(_0x3119e4)[_0x2e5d('0xc')](function(_0x4952d7){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x4952d7[_0x2e5d('0xf')]){isOldTokenSent=![];if(!_0x25e94f['license']&&_0x25e94f[_0x2e5d('0x7')]!=_0x4952d7[_0x2e5d('0x7')]||_0x25e94f[_0x2e5d('0x7')]&&_0x25e94f[_0x2e5d('0x10')]){logger[_0x2e5d('0x11')](_0x2e5d('0x12'));}if(_0x25e94f[_0x2e5d('0x7')]&&!_0x25e94f[_0x2e5d('0x10')]&&_0x25e94f[_0x2e5d('0x7')]!=_0x4952d7['license']){logger[_0x2e5d('0x11')](_0x2e5d('0x13'));}if(_0x25e94f[_0x2e5d('0x7')]&&!_0x25e94f[_0x2e5d('0x10')]&&_0x25e94f[_0x2e5d('0x7')]==_0x4952d7['license']){return _0x15a000;}return _0x15a000[_0x2e5d('0x14')]({'data1':_0x3119e4,'data2':null,'license':_0x4952d7[_0x2e5d('0x7')]});}else{if(_0x4952d7[_0x2e5d('0x7')]||_0x25e94f[_0x2e5d('0x7')]){if(!_0x25e94f[_0x2e5d('0x10')]){if(_0x25e94f['data1']==_0x3119e4){GRAY_PERIOD_REASON='Disabled';logger[_0x2e5d('0x11')](_0x2e5d('0x15'));}else{GRAY_PERIOD_REASON='Changed';logger[_0x2e5d('0x11')](_0x2e5d('0x16'),_0x25e94f[_0x2e5d('0xe')],_0x3119e4);}logger['info']('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x2e5d('0xa')](_0x2e5d('0x17')));return _0x15a000[_0x2e5d('0x14')]({'data2':encryptor[_0x2e5d('0x18')](moment()[_0x2e5d('0xa')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x2e5d('0x19')](encryptor['decryptString'](_0x25e94f[_0x2e5d('0x10')]),'days')>DAYS){logger[_0x2e5d('0x11')]('DEMO\x20START\x20AT\x20%s',moment()[_0x2e5d('0xa')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x15a000['update']({'data1':_0x3119e4,'data2':null,'license':null});}}}else{if(_0x25e94f[_0x2e5d('0xe')]!=_0x3119e4){logger[_0x2e5d('0x11')](_0x2e5d('0x16'),_0x25e94f[_0x2e5d('0xe')],_0x3119e4);return _0x15a000[_0x2e5d('0x14')]({'data1':_0x3119e4,'data2':null,'license':null});}}}return _0x15a000;})[_0x2e5d('0xc')](function(_0x177f17){_0x15a000=_0x177f17;})[_0x2e5d('0x1a')](function(_0x19c7be){logger[_0x2e5d('0x1b')](_0x19c7be[_0x2e5d('0x1c')]);})[_0x2e5d('0x1d')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x15a000);},TIME);});}function defaultLicense(){var _0x34d73e=hardware[_0x2e5d('0x1e')]();if(_0x34d73e){return db['License']['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x34d73e}})['spread'](function(_0x5d6789,_0x547c36){logger['info'](_0x2e5d('0x1f'),_0x34d73e);manageLicense(_0x34d73e,_0x5d6789);})['catch'](function(_0x320c27){logger[_0x2e5d('0x1b')](_0x320c27['message']);});}}exports[_0x2e5d('0x20')]=defaultLicense; \ No newline at end of file +var _0x1332=['THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','request-promise','version','../../mysqldb','../../components/encryptor','../logger','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1','data2','active','license','info'];(function(_0x350b7d,_0x51ca56){var _0x5020ad=function(_0x559fa5){while(--_0x559fa5){_0x350b7d['push'](_0x350b7d['shift']());}};_0x5020ad(++_0x51ca56);}(_0x1332,0x65));var _0x2133=function(_0x29269e,_0x4803c5){_0x29269e=_0x29269e-0x0;var _0x19fcd7=_0x1332[_0x29269e];return _0x19fcd7;};'use strict';var util=require(_0x2133('0x0'));var moment=require('moment');var rp=require(_0x2133('0x1'));var BPromise=require('bluebird');var pkginfo=require('pkginfo')(module,_0x2133('0x2'));var db=require(_0x2133('0x3'))['db'];var encryptor=require(_0x2133('0x4'));var hardware=require('./hardware');var logger=require(_0x2133('0x5'))('license');var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x1cf5e6){return new BPromise(function(_0x175fc6,_0x568ebd){var _0x3d5075=util[_0x2133('0x6')](_0x2133('0x7'),HOST,_0x1cf5e6,module[_0x2133('0x8')][_0x2133('0x2')]);if(oldToken){_0x3d5075=util['format'](_0x2133('0x9'),HOST,_0x1cf5e6,module[_0x2133('0x8')][_0x2133('0x2')],oldToken);}var _0xd7ac79={'uri':_0x3d5075,'method':_0x2133('0xa'),'timeout':0xea60,'json':!![]};return rp(_0xd7ac79)[_0x2133('0xb')](function(_0x25a528){_0x175fc6(_0x25a528);})[_0x2133('0xc')](function(_0x37faa8){_0x568ebd(_0x37faa8);});});}function manageLicense(_0x39efca,_0x3a8494){var _0x248023=_0x3a8494[_0x2133('0xd')]({'plain':!![]});if(!isOldTokenSent&&_0x248023[_0x2133('0xe')]!==_0x39efca&&!_0x248023[_0x2133('0xf')]){oldToken=_0x248023['data1'];}httpRequest(_0x39efca)['then'](function(_0x19d0f1){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x19d0f1[_0x2133('0x10')]){isOldTokenSent=![];if(!_0x248023[_0x2133('0x11')]&&_0x248023['license']!=_0x19d0f1['license']||_0x248023[_0x2133('0x11')]&&_0x248023['data2']){logger[_0x2133('0x12')](_0x2133('0x13'));}if(_0x248023['license']&&!_0x248023[_0x2133('0xf')]&&_0x248023['license']!=_0x19d0f1[_0x2133('0x11')]){logger[_0x2133('0x12')](_0x2133('0x14'));}if(_0x248023[_0x2133('0x11')]&&!_0x248023['data2']&&_0x248023[_0x2133('0x11')]==_0x19d0f1[_0x2133('0x11')]){return _0x3a8494;}return _0x3a8494[_0x2133('0x15')]({'data1':_0x39efca,'data2':null,'license':_0x19d0f1[_0x2133('0x11')]});}else{if(_0x19d0f1[_0x2133('0x11')]||_0x248023[_0x2133('0x11')]){if(!_0x248023['data2']){if(_0x248023[_0x2133('0xe')]==_0x39efca){GRAY_PERIOD_REASON=_0x2133('0x16');logger[_0x2133('0x12')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON='Changed';logger[_0x2133('0x12')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x248023[_0x2133('0xe')],_0x39efca);}logger['info'](_0x2133('0x17'),GRAY_PERIOD_REASON[_0x2133('0x18')](),moment()['format'](_0x2133('0x19')));return _0x3a8494[_0x2133('0x15')]({'data2':encryptor[_0x2133('0x1a')](moment()[_0x2133('0x6')](_0x2133('0x19')))});}else{if(moment()[_0x2133('0x1b')](encryptor[_0x2133('0x1c')](_0x248023[_0x2133('0xf')]),_0x2133('0x1d'))>DAYS){logger['info'](_0x2133('0x1e'),moment()[_0x2133('0x6')](_0x2133('0x19')));isOldTokenSent=![];return _0x3a8494['update']({'data1':_0x39efca,'data2':null,'license':null});}}}else{if(_0x248023[_0x2133('0xe')]!=_0x39efca){logger[_0x2133('0x12')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x248023[_0x2133('0xe')],_0x39efca);return _0x3a8494[_0x2133('0x15')]({'data1':_0x39efca,'data2':null,'license':null});}}}return _0x3a8494;})[_0x2133('0xb')](function(_0x5f4cb4){_0x3a8494=_0x5f4cb4;})[_0x2133('0xc')](function(_0x2a80f1){logger[_0x2133('0x1f')](_0x2a80f1[_0x2133('0x20')]);})[_0x2133('0x21')](function(){setTimeout(function(){manageLicense(hardware[_0x2133('0x22')](),_0x3a8494);},TIME);});}function defaultLicense(){var _0x5b931a=hardware[_0x2133('0x22')]();if(_0x5b931a){return db[_0x2133('0x23')][_0x2133('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0x5b931a}})[_0x2133('0x25')](function(_0x54cdbc,_0x5f07d7){logger[_0x2133('0x12')](_0x2133('0x26'),_0x5b931a);manageLicense(_0x5b931a,_0x54cdbc);})[_0x2133('0xc')](function(_0x362ac6){logger[_0x2133('0x1f')](_0x362ac6[_0x2133('0x20')]);});}}exports[_0x2133('0x27')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 9daa73c..a54eb80 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 _0x209d=['%s:%s:%s','parse','demo','gray','machineUuid','changed','User','findAll','role','COUNT','col','count','admin','telephones','forEach','user','pick','countBy','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','lodash','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','defaults','then','catch','uuid','license','data1','data2','split','decryptString'];(function(_0x44feaf,_0x46068f){var _0x19ea54=function(_0x530743){while(--_0x530743){_0x44feaf['push'](_0x44feaf['shift']());}};_0x19ea54(++_0x46068f);}(_0x209d,0xba));var _0xd209=function(_0x12a8b8,_0x3da515){_0x12a8b8=_0x12a8b8-0x0;var _0x454358=_0x209d[_0x12a8b8];return _0x454358;};'use strict';var util=require('util');var _=require(_0xd209('0x0'));var moment=require('moment');var BPromise=require(_0xd209('0x1'));var hardware=require(_0xd209('0x2'));var encryptor=require(_0xd209('0x3'));var db=require(_0xd209('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xd209('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xd209('0x6'),'machineUuid':hardware[_0xd209('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xd209('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xd209('0x8'),'machineUuid':hardware[_0xd209('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x4063e8){return new BPromise(function(_0x363ccf,_0x104058){return db[_0xd209('0x9')]['find'](_[_0xd209('0xa')](_0x4063e8,{'raw':!![],'where':{'id':0x1}}))[_0xd209('0xb')](function(_0x5aa6a8){return checkLicense(_0x5aa6a8,null);})[_0xd209('0xb')](function(_0x4a3570){_0x363ccf(_0x4a3570);return;})[_0xd209('0xc')](function(_0x2d6f91){_0x104058(_0x2d6f91);});});}function checkLicense(_0x513474,_0x4c7d2c){if(!_0x513474){demoLicense[_0xd209('0xd')]=_0x513474['data1'];return demoLicense;}try{var _0x1f6fab=_0x4c7d2c||_0x513474[_0xd209('0xe')];if(_['isEmpty'](_0x1f6fab)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x12b983=_0x513474[_0xd209('0xf')];var _0x3f5ff6=_0x513474[_0xd209('0x10')];var _0x182946=_0x12b983[_0xd209('0x11')]('-')[0x4];var _0x2f0f0c=_0x12b983[_0xd209('0x11')]('-')[0x0];var _0x1ca4ff=encryptor[_0xd209('0x12')](_0x1f6fab,util['format'](_0xd209('0x13'),_0x182946,_0x12b983,_0x2f0f0c));var _0x3b8a7f=JSON[_0xd209('0x14')](_0x1ca4ff);_0x3b8a7f[_0xd209('0x15')]=![];_0x3b8a7f['uuid']=_0x12b983;_0x3b8a7f['machineUuid']=hardware['getUuid']();if(_0x3f5ff6){var _0x5f0fb9=encryptor[_0xd209('0x12')](_0x3f5ff6);_0x3b8a7f[_0xd209('0x16')]=_0x5f0fb9;_0x3b8a7f['deadline']=moment(_0x5f0fb9)['add'](0x7,'days')['format']();_0x3b8a7f['grayReason']=_0x3b8a7f[_0xd209('0xd')]!=_0x3b8a7f[_0xd209('0x17')]?_0xd209('0x18'):'disabled';}return _0x3b8a7f;}catch(_0x33f845){breakingLicense['uuid']=_0x513474['data1'];breakingLicense['message']=_0x33f845['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x4514ef,_0x91050b){getLicense()[_0xd209('0xb')](function(_0x165718){return db[_0xd209('0x19')][_0xd209('0x1a')]({'attributes':[_0xd209('0x1b'),[db['sequelize']['fn'](_0xd209('0x1c'),db['sequelize'][_0xd209('0x1d')](_0xd209('0x1b'))),_0xd209('0x1e')]],'group':_0xd209('0x1b'),'where':{'role':{'$or':[_0xd209('0x1f'),'user','telephone']}},'raw':!![]})[_0xd209('0xb')](function(_0x2c5204){var _0x440e79={'user':_0x165718['users']||0x0,'telephone':_0x165718[_0xd209('0x20')]||0x0};_0x2c5204[_0xd209('0x21')](function(_0x835a00){var _0x436897=_0x835a00['role']===_0xd209('0x1f')?_0xd209('0x22'):_0x835a00[_0xd209('0x1b')];_0x440e79[_0x436897]-=_0x835a00[_0xd209('0x1e')];if(_0x440e79[_0x436897]<0x0)_0x440e79[_0x436897]=0x0;});_0x4514ef(_0x440e79);return;});})[_0xd209('0xc')](function(_0x452377){_0x91050b(_0x452377);});});}function checkUserLimits(_0x181a64){return new BPromise(function(_0x2bf87a,_0xbaf1e8){getLimits()['then'](function(_0x4d1c27){var _0x497edf=_[_0xd209('0x23')](_[_0xd209('0x24')](_0x181a64,_0xd209('0x1b')),[_0xd209('0x1f'),_0xd209('0x22'),_0xd209('0x25')]);var _0x56538a=(_0x497edf[_0xd209('0x1f')]||0x0)+(_0x497edf[_0xd209('0x22')]||0x0);var _0x554208=_0x497edf[_0xd209('0x25')]||0x0;if(_0x56538a>_0x4d1c27[_0xd209('0x22')])return _0xbaf1e8(_0xd209('0x26'));if(_0x554208>_0x4d1c27['telephone'])return _0xbaf1e8(_0xd209('0x27'));return _0x2bf87a();})[_0xd209('0xc')](function(_0x2ff567){_0xbaf1e8(_0x2ff567);});});}module[_0xd209('0x28')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x4276=['format','%s:%s:%s','parse','demo','machineUuid','deadline','add','days','grayReason','changed','disabled','message','User','findAll','sequelize','COUNT','col','role','admin','telephone','users','telephones','user','count','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','catch','uuid','data1','License\x20key\x20value\x20not\x20found','data2','split','decryptString'];(function(_0x5c6f1c,_0x3f27d7){var _0x4d7f8b=function(_0x2c3498){while(--_0x2c3498){_0x5c6f1c['push'](_0x5c6f1c['shift']());}};_0x4d7f8b(++_0x3f27d7);}(_0x4276,0xe1));var _0x6427=function(_0x2ab82f,_0x55e8a2){_0x2ab82f=_0x2ab82f-0x0;var _0x1f5686=_0x4276[_0x2ab82f];return _0x1f5686;};'use strict';var util=require(_0x6427('0x0'));var _=require(_0x6427('0x1'));var moment=require(_0x6427('0x2'));var BPromise=require(_0x6427('0x3'));var hardware=require('./hardware');var encryptor=require('../../components/encryptor');var db=require(_0x6427('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6427('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x6427('0x6'),'machineUuid':hardware[_0x6427('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6427('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x6427('0x8'),'machineUuid':hardware[_0x6427('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x3795b8){return new BPromise(function(_0x264af8,_0x1969ba){return db[_0x6427('0x9')][_0x6427('0xa')](_[_0x6427('0xb')](_0x3795b8,{'raw':!![],'where':{'id':0x1}}))[_0x6427('0xc')](function(_0x22c582){return checkLicense(_0x22c582,null);})[_0x6427('0xc')](function(_0xc22903){_0x264af8(_0xc22903);return;})[_0x6427('0xd')](function(_0x3dccaa){_0x1969ba(_0x3dccaa);});});}function checkLicense(_0x462837,_0x2e03cf){if(!_0x462837){demoLicense[_0x6427('0xe')]=_0x462837[_0x6427('0xf')];return demoLicense;}try{var _0x1460c9=_0x2e03cf||_0x462837['license'];if(_['isEmpty'](_0x1460c9)){throw new Error(_0x6427('0x10'));}var _0x2ed935=_0x462837['data1'];var _0x1f68fb=_0x462837[_0x6427('0x11')];var _0xcdc837=_0x2ed935[_0x6427('0x12')]('-')[0x4];var _0x57e820=_0x2ed935[_0x6427('0x12')]('-')[0x0];var _0x5804d9=encryptor[_0x6427('0x13')](_0x1460c9,util[_0x6427('0x14')](_0x6427('0x15'),_0xcdc837,_0x2ed935,_0x57e820));var _0x35e932=JSON[_0x6427('0x16')](_0x5804d9);_0x35e932[_0x6427('0x17')]=![];_0x35e932[_0x6427('0xe')]=_0x2ed935;_0x35e932[_0x6427('0x18')]=hardware[_0x6427('0x7')]();if(_0x1f68fb){var _0x17937f=encryptor[_0x6427('0x13')](_0x1f68fb);_0x35e932['gray']=_0x17937f;_0x35e932[_0x6427('0x19')]=moment(_0x17937f)[_0x6427('0x1a')](0x7,_0x6427('0x1b'))[_0x6427('0x14')]();_0x35e932[_0x6427('0x1c')]=_0x35e932[_0x6427('0xe')]!=_0x35e932[_0x6427('0x18')]?_0x6427('0x1d'):_0x6427('0x1e');}return _0x35e932;}catch(_0x5c4dd8){breakingLicense['uuid']=_0x462837[_0x6427('0xf')];breakingLicense[_0x6427('0x1f')]=_0x5c4dd8[_0x6427('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x10f03d,_0x9a64f6){getLicense()[_0x6427('0xc')](function(_0x3fd6fc){return db[_0x6427('0x20')][_0x6427('0x21')]({'attributes':['role',[db[_0x6427('0x22')]['fn'](_0x6427('0x23'),db['sequelize'][_0x6427('0x24')](_0x6427('0x25'))),'count']],'group':_0x6427('0x25'),'where':{'role':{'$or':[_0x6427('0x26'),'user',_0x6427('0x27')]}},'raw':!![]})['then'](function(_0x5d0e04){var _0x18c37d={'user':_0x3fd6fc[_0x6427('0x28')]||0x0,'telephone':_0x3fd6fc[_0x6427('0x29')]||0x0};_0x5d0e04['forEach'](function(_0xfb75ef){var _0x2bde12=_0xfb75ef['role']===_0x6427('0x26')?_0x6427('0x2a'):_0xfb75ef[_0x6427('0x25')];_0x18c37d[_0x2bde12]-=_0xfb75ef[_0x6427('0x2b')];if(_0x18c37d[_0x2bde12]<0x0)_0x18c37d[_0x2bde12]=0x0;});_0x10f03d(_0x18c37d);return;});})[_0x6427('0xd')](function(_0x11adbc){_0x9a64f6(_0x11adbc);});});}function checkUserLimits(_0x356d45){return new BPromise(function(_0x497a96,_0x1a571a){getLimits()[_0x6427('0xc')](function(_0x2847d7){var _0x442859=_[_0x6427('0x2c')](_[_0x6427('0x2d')](_0x356d45,_0x6427('0x25')),[_0x6427('0x26'),_0x6427('0x2a'),_0x6427('0x27')]);var _0xdf7f59=(_0x442859[_0x6427('0x26')]||0x0)+(_0x442859[_0x6427('0x2a')]||0x0);var _0x49b33c=_0x442859[_0x6427('0x27')]||0x0;if(_0xdf7f59>_0x2847d7[_0x6427('0x2a')])return _0x1a571a(_0x6427('0x2e'));if(_0x49b33c>_0x2847d7[_0x6427('0x27')])return _0x1a571a(_0x6427('0x2f'));return _0x497a96();})[_0x6427('0xd')](function(_0x3aadc4){_0x1a571a(_0x3aadc4);});});}module[_0x6427('0x30')]={'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 84ff231..1210281 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 _0x5eb8=['app-id','secret','myappanuglar-secret'];(function(_0xaf1e1d,_0x3f228c){var _0x3e7b93=function(_0x4c2659){while(--_0x4c2659){_0xaf1e1d['push'](_0xaf1e1d['shift']());}};_0x3e7b93(++_0x3f228c);}(_0x5eb8,0xb0));var _0x85eb=function(_0x3238ea,_0x91809d){_0x3238ea=_0x3238ea-0x0;var _0x4aaac2=_0x5eb8[_0x3238ea];return _0x4aaac2;};'use strict';module['exports']={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x85eb('0x0'),'GOOGLE_ID':_0x85eb('0x1'),'GOOGLE_SECRET':_0x85eb('0x2'),'DEBUG':''}; \ No newline at end of file +var _0xdd4f=['exports','secret'];(function(_0x630041,_0x14ad6a){var _0x22f9f6=function(_0x162f03){while(--_0x162f03){_0x630041['push'](_0x630041['shift']());}};_0x22f9f6(++_0x14ad6a);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x15145f,_0x4f60ca){_0x15145f=_0x15145f-0x0;var _0x5d6fa9=_0xdd4f[_0x15145f];return _0x5d6fa9;};'use strict';module[_0xfdd4('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':'app-id','GOOGLE_SECRET':_0xfdd4('0x1'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 22d37a1..3374060 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa4d3=['INFO','join','/var','xcally','format','%s-%s.log','message','replace','}}}','level','toUpperCase','exports','transports','File','%s-%s','error','info','Console','env','moment','path'];(function(_0x2c8864,_0x4ab5af){var _0x5a74b6=function(_0x12b9cb){while(--_0x12b9cb){_0x2c8864['push'](_0x2c8864['shift']());}};_0x5a74b6(++_0x4ab5af);}(_0xa4d3,0xe5));var _0x3a4d=function(_0x4fc0e1,_0x49089b){_0x4fc0e1=_0x4fc0e1-0x0;var _0x1a136a=_0xa4d3[_0x4fc0e1];return _0x1a136a;};'use strict';var moment=require(_0x3a4d('0x0'));var winston=require('winston');var util=require('util');var path=require(_0x3a4d('0x1'));var debugLevel=_0x3a4d('0x2');function filename(_0x2b95b5,_0x302900){return path[_0x3a4d('0x3')](_0x3a4d('0x4'),'log',_0x3a4d('0x5'),util[_0x3a4d('0x6')](_0x3a4d('0x7'),_0x2b95b5,_0x302900));}function formatter(_0x5950e4,_0x4a3a4c){_0x4a3a4c[_0x3a4d('0x8')]=_0x4a3a4c[_0x3a4d('0x8')]['replace'](/@@{/g,'{{{')[_0x3a4d('0x9')](/}@@/g,_0x3a4d('0xa'))[_0x3a4d('0x9')](/@{/g,'{{')[_0x3a4d('0x9')](/}@/g,'}}');return util[_0x3a4d('0x6')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x3a4d('0x6')]('YYYY-MM-DD\x20HH:mm:ss'),_0x4a3a4c[_0x3a4d('0xb')][_0x3a4d('0xc')](),_0x5950e4,_0x4a3a4c[_0x3a4d('0x8')]);}module[_0x3a4d('0xd')]=function(_0x94f8c6){return new winston['Logger']({'transports':[new winston[(_0x3a4d('0xe'))][(_0x3a4d('0xf'))]({'name':util[_0x3a4d('0x6')](_0x3a4d('0x10'),_0x94f8c6,_0x3a4d('0x11')),'filename':filename(_0x94f8c6,_0x3a4d('0x11')),'level':_0x3a4d('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x23da26){return formatter(_0x94f8c6,_0x23da26);}}),new winston[(_0x3a4d('0xe'))]['File']({'name':util[_0x3a4d('0x6')](_0x3a4d('0x10'),_0x94f8c6,_0x3a4d('0x12')),'filename':filename(_0x94f8c6,_0x3a4d('0x12')),'level':_0x3a4d('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1c6b0a){return formatter(_0x94f8c6,_0x1c6b0a);}}),new winston[(_0x3a4d('0xe'))][(_0x3a4d('0x13'))]({'level':process[_0x3a4d('0x14')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0x1a1736){return formatter(_0x94f8c6,_0x1a1736);}})]});}; \ No newline at end of file +var _0x3fa9=['xcally','format','%s-%s.log','message','{{{','replace','}}}','YYYY-MM-DD\x20HH:mm:ss','exports','transports','File','%s-%s','error','info','Console','debugLevel','moment','util','INFO','join','/var','log'];(function(_0x1baf7b,_0x7d4056){var _0x4b3bcb=function(_0x47c6fe){while(--_0x47c6fe){_0x1baf7b['push'](_0x1baf7b['shift']());}};_0x4b3bcb(++_0x7d4056);}(_0x3fa9,0x12e));var _0x93fa=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0x3fa9[_0x521929];return _0x632436;};'use strict';var moment=require(_0x93fa('0x0'));var winston=require('winston');var util=require(_0x93fa('0x1'));var path=require('path');var debugLevel=_0x93fa('0x2');function filename(_0x496939,_0x41774d){return path[_0x93fa('0x3')](_0x93fa('0x4'),_0x93fa('0x5'),_0x93fa('0x6'),util[_0x93fa('0x7')](_0x93fa('0x8'),_0x496939,_0x41774d));}function formatter(_0x573064,_0x52e312){_0x52e312[_0x93fa('0x9')]=_0x52e312[_0x93fa('0x9')]['replace'](/@@{/g,_0x93fa('0xa'))[_0x93fa('0xb')](/}@@/g,_0x93fa('0xc'))[_0x93fa('0xb')](/@{/g,'{{')[_0x93fa('0xb')](/}@/g,'}}');return util[_0x93fa('0x7')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x93fa('0x7')](_0x93fa('0xd')),_0x52e312['level']['toUpperCase'](),_0x573064,_0x52e312[_0x93fa('0x9')]);}module[_0x93fa('0xe')]=function(_0x2cae76){return new winston['Logger']({'transports':[new winston[(_0x93fa('0xf'))][(_0x93fa('0x10'))]({'name':util[_0x93fa('0x7')](_0x93fa('0x11'),_0x2cae76,_0x93fa('0x12')),'filename':filename(_0x2cae76,_0x93fa('0x12')),'level':_0x93fa('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x398b76){return formatter(_0x2cae76,_0x398b76);}}),new winston[(_0x93fa('0xf'))]['File']({'name':util[_0x93fa('0x7')](_0x93fa('0x11'),_0x2cae76,_0x93fa('0x13')),'filename':filename(_0x2cae76,_0x93fa('0x13')),'level':_0x93fa('0x13'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1386b1){return formatter(_0x2cae76,_0x1386b1);}}),new winston[(_0x93fa('0xf'))][(_0x93fa('0x14'))]({'level':process['env'][_0x93fa('0x15')]||debugLevel,'json':![],'formatter':function(_0x186cee){return formatter(_0x2cae76,_0x186cee);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index e3b748a..6b3cd24 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 _0x378e=['../../services/ami/index.js','../../services/agi/index.js','email','../../services/routing/index.js','xdr','../../services/xdr/index.js','path','join','../../services/express/index.js','ami'];(function(_0x1770f8,_0x3e1dfd){var _0x58546b=function(_0x1541d2){while(--_0x1541d2){_0x1770f8['push'](_0x1770f8['shift']());}};_0x58546b(++_0x3e1dfd);}(_0x378e,0x100));var _0xe378=function(_0x315ea4,_0x497e7e){_0x315ea4=_0x315ea4-0x0;var _0x508914=_0x378e[_0x315ea4];return _0x508914;};'use strict';var path=require(_0xe378('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path[_0xe378('0x1')](__dirname,_0xe378('0x2'))},{'name':_0xe378('0x3'),'script':path[_0xe378('0x1')](__dirname,_0xe378('0x4'))},{'name':'agi','script':path['join'](__dirname,_0xe378('0x5'))},{'name':_0xe378('0x6'),'script':path[_0xe378('0x1')](__dirname,'../../services/email/index.js')},{'name':'routing','script':path[_0xe378('0x1')](__dirname,_0xe378('0x7'))},{'name':_0xe378('0x8'),'script':path[_0xe378('0x1')](__dirname,_0xe378('0x9'))}]};module['exports']=config; \ No newline at end of file +var _0x5286=['ami','../../services/ami/index.js','agi','../../services/agi/index.js','../../services/email/index.js','../../services/routing/index.js','xdr','exports','express','join','../../services/express/index.js'];(function(_0xaa6a4,_0x64b067){var _0xdc31a4=function(_0x4269d8){while(--_0x4269d8){_0xaa6a4['push'](_0xaa6a4['shift']());}};_0xdc31a4(++_0x64b067);}(_0x5286,0xfa));var _0x6528=function(_0x1158ca,_0x3862f3){_0x1158ca=_0x1158ca-0x0;var _0x42092b=_0x5286[_0x1158ca];return _0x42092b;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0x6528('0x0'),'script':path[_0x6528('0x1')](__dirname,_0x6528('0x2'))},{'name':_0x6528('0x3'),'script':path[_0x6528('0x1')](__dirname,_0x6528('0x4'))},{'name':_0x6528('0x5'),'script':path[_0x6528('0x1')](__dirname,_0x6528('0x6'))},{'name':'email','script':path[_0x6528('0x1')](__dirname,_0x6528('0x7'))},{'name':'routing','script':path[_0x6528('0x1')](__dirname,_0x6528('0x8'))},{'name':_0x6528('0x9'),'script':path[_0x6528('0x1')](__dirname,'../../services/xdr/index.js')}]};module[_0x6528('0xa')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 29fa77c..eb35f55 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 _0x05ee=['connect','connected','then','start','disconnect','stop','restart','list','describe','delete','dump','bluebird'];(function(_0x265003,_0xf0f023){var _0x33c743=function(_0x326a5d){while(--_0x326a5d){_0x265003['push'](_0x265003['shift']());}};_0x33c743(++_0xf0f023);}(_0x05ee,0x1bb));var _0xe05e=function(_0x1bf611,_0x5a169b){_0x1bf611=_0x1bf611-0x0;var _0x46c450=_0x05ee[_0x1bf611];return _0x46c450;};'use strict';var pm2=require('pm2');var BPromise=require(_0xe05e('0x0'));var config=require('./config');function connect(){return new BPromise(function(_0x37ec98,_0x4167c0){return pm2[_0xe05e('0x1')](function(_0x31e5c1){if(_0x31e5c1){return _0x4167c0(_0x31e5c1);}return _0x37ec98(_0xe05e('0x2'));});});};exports['start']=function(_0x96fdc2){return connect()[_0xe05e('0x3')](function(){return new BPromise(function(_0x5bc4a6,_0x405ac5){return pm2[_0xe05e('0x4')](_0x96fdc2,function(_0xfe0b73,_0x2b2d82){if(_0xfe0b73){return _0x405ac5(_0xfe0b73);}pm2[_0xe05e('0x5')]();return _0x5bc4a6(_0x2b2d82);});});});};exports[_0xe05e('0x6')]=function(_0x36934b){return connect()[_0xe05e('0x3')](function(){return new BPromise(function(_0x154f4b,_0x594361){return pm2[_0xe05e('0x6')](_0x36934b,function(_0x1c261c,_0x23ae4f){if(_0x1c261c){return _0x594361(_0x1c261c);}pm2[_0xe05e('0x5')]();return _0x154f4b(_0x23ae4f);});});});};exports[_0xe05e('0x7')]=function(_0x19d0dd){return connect()['then'](function(){return new BPromise(function(_0x4ac417,_0x3c6cfb){return pm2[_0xe05e('0x7')](_0x19d0dd,function(_0xb34c63,_0x574819){if(_0xb34c63){return _0x3c6cfb(_0xb34c63);}pm2[_0xe05e('0x5')]();return _0x4ac417(_0x574819);});});});};exports[_0xe05e('0x8')]=function(){return connect()[_0xe05e('0x3')](function(){return new BPromise(function(_0xc32ba1,_0x15cc2f){return pm2[_0xe05e('0x8')](function(_0x58ee3e,_0x3b9054){if(_0x58ee3e){return _0x15cc2f(_0x58ee3e);}pm2[_0xe05e('0x5')]();return _0xc32ba1(_0x3b9054);});});});};exports[_0xe05e('0x9')]=function(_0x30bf3e){return connect()['then'](function(){return new BPromise(function(_0x330c6f,_0x524bbe){return pm2[_0xe05e('0x9')](_0x30bf3e,function(_0x574889,_0x4ea2e6){if(_0x574889){return _0x524bbe(_0x574889);}pm2['disconnect']();return _0x330c6f(_0x4ea2e6);});});});};exports['delete']=function(_0x32a309){return connect()[_0xe05e('0x3')](function(){return new BPromise(function(_0x136a34,_0x2ebf87){return pm2[_0xe05e('0xa')](_0x32a309,function(_0x25b8ce,_0x546643){if(_0x25b8ce){return _0x2ebf87(_0x25b8ce);}pm2[_0xe05e('0x5')]();return _0x136a34(_0x546643);});});});};exports[_0xe05e('0xb')]=function(){return connect()[_0xe05e('0x3')](function(){return new BPromise(function(_0x18920a,_0x5ce6ea){return pm2[_0xe05e('0xb')](function(_0x1dcf3e){if(_0x1dcf3e){return _0x5ce6ea(_0x1dcf3e);}return _0x18920a('saved');});});});}; \ No newline at end of file +var _0x5971=['disconnect','stop','then','restart','list','describe','delete','dump','saved','pm2','./config','connect','connected','start'];(function(_0x57761e,_0xf463b9){var _0x1b9d69=function(_0x4efa7c){while(--_0x4efa7c){_0x57761e['push'](_0x57761e['shift']());}};_0x1b9d69(++_0xf463b9);}(_0x5971,0xbf));var _0x1597=function(_0x3aaa30,_0x33dd2a){_0x3aaa30=_0x3aaa30-0x0;var _0x56d0b3=_0x5971[_0x3aaa30];return _0x56d0b3;};'use strict';var pm2=require(_0x1597('0x0'));var BPromise=require('bluebird');var config=require(_0x1597('0x1'));function connect(){return new BPromise(function(_0x5da4b7,_0x45f751){return pm2[_0x1597('0x2')](function(_0x3a8ed6){if(_0x3a8ed6){return _0x45f751(_0x3a8ed6);}return _0x5da4b7(_0x1597('0x3'));});});};exports[_0x1597('0x4')]=function(_0x15f0d7){return connect()['then'](function(){return new BPromise(function(_0x3a597a,_0x366f5b){return pm2[_0x1597('0x4')](_0x15f0d7,function(_0x58a4dd,_0x53a70c){if(_0x58a4dd){return _0x366f5b(_0x58a4dd);}pm2[_0x1597('0x5')]();return _0x3a597a(_0x53a70c);});});});};exports[_0x1597('0x6')]=function(_0x2fb863){return connect()[_0x1597('0x7')](function(){return new BPromise(function(_0x23b2bf,_0x1ff2dc){return pm2[_0x1597('0x6')](_0x2fb863,function(_0x46db09,_0x300c1b){if(_0x46db09){return _0x1ff2dc(_0x46db09);}pm2['disconnect']();return _0x23b2bf(_0x300c1b);});});});};exports[_0x1597('0x8')]=function(_0x72f0f1){return connect()[_0x1597('0x7')](function(){return new BPromise(function(_0x566d21,_0x1b7046){return pm2[_0x1597('0x8')](_0x72f0f1,function(_0x419de5,_0x1f227e){if(_0x419de5){return _0x1b7046(_0x419de5);}pm2[_0x1597('0x5')]();return _0x566d21(_0x1f227e);});});});};exports[_0x1597('0x9')]=function(){return connect()[_0x1597('0x7')](function(){return new BPromise(function(_0x49248e,_0xc5468a){return pm2['list'](function(_0x5e14cc,_0x1202b5){if(_0x5e14cc){return _0xc5468a(_0x5e14cc);}pm2[_0x1597('0x5')]();return _0x49248e(_0x1202b5);});});});};exports[_0x1597('0xa')]=function(_0x2bf6b2){return connect()[_0x1597('0x7')](function(){return new BPromise(function(_0x585152,_0x5304a3){return pm2[_0x1597('0xa')](_0x2bf6b2,function(_0x3dc570,_0x2b8a51){if(_0x3dc570){return _0x5304a3(_0x3dc570);}pm2[_0x1597('0x5')]();return _0x585152(_0x2b8a51);});});});};exports['delete']=function(_0x13f076){return connect()[_0x1597('0x7')](function(){return new BPromise(function(_0x293344,_0xd3c8f7){return pm2[_0x1597('0xb')](_0x13f076,function(_0x3a1e20,_0x3746ea){if(_0x3a1e20){return _0xd3c8f7(_0x3a1e20);}pm2[_0x1597('0x5')]();return _0x293344(_0x3746ea);});});});};exports['dump']=function(){return connect()[_0x1597('0x7')](function(){return new BPromise(function(_0x355586,_0x51c465){return pm2[_0x1597('0xc')](function(_0x262094){if(_0x262094){return _0x51c465(_0x262094);}return _0x355586(_0x1597('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 64033fd..a03e842 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 _0x9ef8=['emit','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','moment','../../config/environment','../logger','defaults','redis','socket.io-emitter','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','map','[CHAT]\x20Interactions\x20to\x20close:','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x9ef8,0x109));var _0x89ef=function(_0x18546c,_0x4daf94){_0x18546c=_0x18546c-0x0;var _0x46ef43=_0x9ef8[_0x18546c];return _0x46ef43;};'use strict';var _=require('lodash');var moment=require(_0x89ef('0x0'));var Redis=require('ioredis');var util=require('util');var config=require(_0x89ef('0x1'));var db=require('../../mysqldb')['db'];var logger=require(_0x89ef('0x2'))('schedule');config['redis']=_[_0x89ef('0x3')](config[_0x89ef('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x89ef('0x5'))(new Redis(config[_0x89ef('0x4')]));function closeInteractions(){var _0x2f1ac7=0x0;var _0x1eb4d6=[];return db['Setting'][_0x89ef('0x6')]({'raw':!![],'attributes':['id',_0x89ef('0x7')],'where':{'id':0x1}})[_0x89ef('0x8')](function(_0x5ca178){_0x2f1ac7=_0x5ca178[_0x89ef('0x7')];if(_0x2f1ac7){return db[_0x89ef('0x9')][_0x89ef('0xa')]({'raw':!![],'attributes':['id',_0x89ef('0xb')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x89ef('0xc')](_0x5ca178[_0x89ef('0x7')],_0x89ef('0xd'))}}});}else{return[];}})['then'](function(_0x3ad40e){if(_0x3ad40e&&_0x3ad40e[_0x89ef('0xe')]){_0x1eb4d6=_[_0x89ef('0xf')](_0x3ad40e||[],'id');logger['info'](_0x89ef('0x10'),_0x1eb4d6['join']());return db[_0x89ef('0x9')][_0x89ef('0x11')]({'closeReason':_0x89ef('0x12'),'disposition':_0x89ef('0x13'),'closed':!![],'closedAt':moment()[_0x89ef('0x14')](_0x89ef('0x15'))},{'where':{'id':_0x1eb4d6}});}})[_0x89ef('0x8')](function(){if(_0x1eb4d6&&_0x1eb4d6[_0x89ef('0xe')]){logger[_0x89ef('0x16')](_0x89ef('0x17'),_0x1eb4d6[_0x89ef('0x18')]());for(var _0x3dd4e2=0x0;_0x3dd4e2<_0x1eb4d6[_0x89ef('0xe')];_0x3dd4e2++){io[_0x89ef('0x19')]('chatInteraction:update',{'id':_0x1eb4d6[_0x3dd4e2],'closed':!![]});}}})['catch'](function(_0x26e71f){logger['error'](_0x89ef('0x1a'),_0x26e71f?util[_0x89ef('0x1b')](_0x26e71f,{'showHidden':![],'depth':null}):'');});}exports[_0x89ef('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x184c=['emit','chatInteraction:update','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','length','map','info','join','update','system','format','[CHAT]\x20Sending\x20updates\x20for\x20interactions:'];(function(_0x420d81,_0x4c4c54){var _0x17b70b=function(_0x6eeb67){while(--_0x6eeb67){_0x420d81['push'](_0x420d81['shift']());}};_0x17b70b(++_0x4c4c54);}(_0x184c,0x192));var _0xc184=function(_0xf21671,_0x607eee){_0xf21671=_0xf21671-0x0;var _0xec0155=_0x184c[_0xf21671];return _0xec0155;};'use strict';var _=require(_0xc184('0x0'));var moment=require(_0xc184('0x1'));var Redis=require(_0xc184('0x2'));var util=require(_0xc184('0x3'));var config=require(_0xc184('0x4'));var db=require(_0xc184('0x5'))['db'];var logger=require(_0xc184('0x6'))(_0xc184('0x7'));config[_0xc184('0x8')]=_[_0xc184('0x9')](config[_0xc184('0x8')],{'host':_0xc184('0xa'),'port':0x18eb});var io=require(_0xc184('0xb'))(new Redis(config['redis']));function closeInteractions(){var _0x52a7e7=0x0;var _0x1e035c=[];return db[_0xc184('0xc')][_0xc184('0xd')]({'raw':!![],'attributes':['id',_0xc184('0xe')],'where':{'id':0x1}})[_0xc184('0xf')](function(_0x102b00){_0x52a7e7=_0x102b00[_0xc184('0xe')];if(_0x52a7e7){return db[_0xc184('0x10')][_0xc184('0x11')]({'raw':!![],'attributes':['id',_0xc184('0x12')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x102b00[_0xc184('0xe')],'minutes')}}});}else{return[];}})['then'](function(_0x519a31){if(_0x519a31&&_0x519a31[_0xc184('0x13')]){_0x1e035c=_[_0xc184('0x14')](_0x519a31||[],'id');logger[_0xc184('0x15')]('[CHAT]\x20Interactions\x20to\x20close:',_0x1e035c[_0xc184('0x16')]());return db[_0xc184('0x10')][_0xc184('0x17')]({'closeReason':_0xc184('0x18'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xc184('0x19')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x1e035c}});}})['then'](function(){if(_0x1e035c&&_0x1e035c['length']){logger[_0xc184('0x15')](_0xc184('0x1a'),_0x1e035c[_0xc184('0x16')]());for(var _0x278e1c=0x0;_0x278e1c<_0x1e035c['length'];_0x278e1c++){io[_0xc184('0x1b')](_0xc184('0x1c'),{'id':_0x1e035c[_0x278e1c],'closed':!![]});}}})['catch'](function(_0x411535){logger[_0xc184('0x1d')](_0xc184('0x1e'),_0x411535?util[_0xc184('0x1f')](_0x411535,{'showHidden':![],'depth':null}):'');});}exports[_0xc184('0x20')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 73b5698..bb979be 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 _0xda47=['exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','jobs','map','toString','intersection','difference','length','exists','stop','delete\x20cron','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','deleteJob','stop\x20cron','update','update\x20cron','run','util','lodash','cron-job-manager','bluebird','../logger','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','email','Smtp','service','host','MailAccount','port','secure','authentication','user','pass','format','\x22%s\x22\x20<%s>','name','bcc','subtractNumber','join','../../files/reports','savename','%s.%s','basename','zip','existsSync','status','Sent','message','attachments','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','SendMail','then','error','error\x20mail','info','email\x20sent','stringify','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','subtractUnit','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','catch','CustomReportId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xda47,0xcd));var _0x7da4=function(_0x4709c8,_0x3384ca){_0x4709c8=_0x4709c8-0x0;var _0x478cdd=_0xda47[_0x4709c8];return _0x478cdd;};'use strict';var fs=require('fs');var util=require(_0x7da4('0x0'));var path=require('path');var _=require(_0x7da4('0x1'));var moment=require('moment');var CronJobManager=require(_0x7da4('0x2'));var jayson=require('jayson/promise');var BPromise=require(_0x7da4('0x3'));var logger=require(_0x7da4('0x4'))('schedule');var db=require('../../mysqldb')['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x7da4('0x5'));var client=jayson[_0x7da4('0x6')][_0x7da4('0x7')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0xbd0ddf,_0x3d8183){return function(){logger['info']('Try\x20to\x20send\x20a\x20mail\x20to',_0xbd0ddf[_0x7da4('0x8')]);var _0x33ba64=!![];var _0x479a26={'tls':{'rejectUnauthorized':![]}};if(_0xbd0ddf['MailAccount'][_0x7da4('0x9')][_0x7da4('0xa')]){_0x479a26[_0x7da4('0xa')]=_0xbd0ddf['MailAccount']['Smtp'][_0x7da4('0xa')];}else{_0x479a26[_0x7da4('0xb')]=_0xbd0ddf[_0x7da4('0xc')][_0x7da4('0x9')]['host'];_0x479a26[_0x7da4('0xd')]=_0xbd0ddf[_0x7da4('0xc')]['Smtp'][_0x7da4('0xd')];_0x479a26[_0x7da4('0xe')]=_0xbd0ddf[_0x7da4('0xc')][_0x7da4('0x9')][_0x7da4('0xe')];}if(_0xbd0ddf[_0x7da4('0xc')]['Smtp'][_0x7da4('0xf')]){_0x479a26['auth']={'user':_0xbd0ddf[_0x7da4('0xc')]['Smtp'][_0x7da4('0x10')],'pass':_0xbd0ddf[_0x7da4('0xc')][_0x7da4('0x9')][_0x7da4('0x11')]};}var _0x2e4fd5={'account':_0x479a26,'message':{'from':util[_0x7da4('0x12')](_0x7da4('0x13'),_0xbd0ddf['MailAccount'][_0x7da4('0x14')],_0xbd0ddf[_0x7da4('0xc')][_0x7da4('0x8')]||_0xbd0ddf[_0x7da4('0xc')][_0x7da4('0x9')][_0x7da4('0x10')]),'to':_0xbd0ddf[_0x7da4('0x8')],'cc':_0xbd0ddf['cc'],'bcc':_0xbd0ddf[_0x7da4('0x15')],'subject':util[_0x7da4('0x12')]('Report\x20%s\x20last\x20%s\x20%s',_0x3d8183[_0x7da4('0x14')],_0xbd0ddf[_0x7da4('0x16')],_0xbd0ddf['subtractUnit'])}};var _0x12c95e=path[_0x7da4('0x17')](__dirname,_0x7da4('0x18'));var _0x11b072=_0x3d8183[_0x7da4('0x19')];var _0x314b89=util[_0x7da4('0x12')](_0x7da4('0x1a'),path[_0x7da4('0x1b')](_0x3d8183[_0x7da4('0x19')],path['extname'](_0x3d8183['savename'])),_0x7da4('0x1c'));var _0x4ce9d7=path['join'](_0x12c95e,_0x11b072);var _0x1276b3=path[_0x7da4('0x17')](_0x12c95e,_0x314b89);if(fs[_0x7da4('0x1d')](_0x4ce9d7)){_0x3d8183[_0x7da4('0x1e')]=_0x7da4('0x1f');_0x2e4fd5[_0x7da4('0x20')][_0x7da4('0x21')]=[{'filename':_0x11b072,'path':_0x4ce9d7}];_0x2e4fd5['message'][_0x7da4('0x22')]=util[_0x7da4('0x12')]('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'](_0x3d8183,null,0x2));}else if(fs[_0x7da4('0x1d')](_0x1276b3)){_0x3d8183[_0x7da4('0x1e')]=_0x7da4('0x1f');_0x2e4fd5[_0x7da4('0x20')][_0x7da4('0x21')]=[{'filename':_0x314b89,'path':_0x1276b3}];}else{_0x2e4fd5[_0x7da4('0x20')][_0x7da4('0x22')]=_0x7da4('0x23');if(!_0xbd0ddf[_0x7da4('0x24')]){_0x33ba64=![];logger['info']('empty\x20file,\x20email\x20not\x20sent');}}if(_0x33ba64){return client['request'](_0x7da4('0x25'),_0x2e4fd5)[_0x7da4('0x26')](function(_0x2b6db2){if(_0x2b6db2[_0x7da4('0x27')]){return logger[_0x7da4('0x27')](_0x7da4('0x28'),JSON['stringify'](_0x2b6db2));}return logger[_0x7da4('0x29')](_0x7da4('0x2a'));})['catch'](function(_0x419e67){return logger[_0x7da4('0x27')](_0x7da4('0x28'),JSON[_0x7da4('0x2b')](_0x419e67));});}};}function handleError(){return function(_0x19a5bf){return logger[_0x7da4('0x27')](JSON[_0x7da4('0x2b')](_0x19a5bf));};}function handleResult(_0xb23e56){return function(_0x8846a0){logger[_0x7da4('0x29')]('data',JSON['stringify'](_0x8846a0));if(_0xb23e56[_0x7da4('0xc')]&&_0xb23e56[_0x7da4('0xc')][_0x7da4('0x9')]&&!_['isNil'](_0xb23e56[_0x7da4('0x8')])){setTimeout(handleSendEmail(_0xb23e56,_0x8846a0),0x3c*0x3e8);}};}function handleJob(_0x1a9f27){return function(){try{if(_[_0x7da4('0x2c')](_0x1a9f27[_0x7da4('0x16')])){return logger[_0x7da4('0x29')](_0x7da4('0x2d'));}if(_[_0x7da4('0x2c')](_0x1a9f27['subtractUnit'])){return logger[_0x7da4('0x29')](_0x7da4('0x2e'));}var _0x8f29f6={'startDate':moment()[_0x7da4('0x2f')](_0x1a9f27[_0x7da4('0x16')],_0x1a9f27[_0x7da4('0x30')])[_0x7da4('0x12')](_0x7da4('0x31')),'endDate':moment()[_0x7da4('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'type':'scheduled','output':_0x1a9f27[_0x7da4('0x32')],'name':_0x1a9f27['name']};if(!_[_0x7da4('0x2c')](_0x1a9f27[_0x7da4('0x33')])){logger[_0x7da4('0x29')](_0x7da4('0x34'),_0x1a9f27['DefaultReportId']);return analyticDefaultReportController[_0x7da4('0x35')]({'id':_0x1a9f27['DefaultReportId']},_0x8f29f6)[_0x7da4('0x26')](handleResult(_0x1a9f27))[_0x7da4('0x36')](handleError());}if(!_['isNil'](_0x1a9f27[_0x7da4('0x37')])){logger['info'](_0x7da4('0x38'),_0x1a9f27[_0x7da4('0x37')]);return analyticCustomReportController[_0x7da4('0x35')]({'id':_0x1a9f27[_0x7da4('0x37')]},_0x8f29f6)['then'](handleResult(_0x1a9f27))['catch'](handleError());}}catch(_0x47d93){logger[_0x7da4('0x27')](JSON[_0x7da4('0x2b')](_0x47d93));}return logger[_0x7da4('0x29')](_0x7da4('0x39'));};}function getJobs(_0x238ec8){var _0x2bfa20={};if(_0x238ec8){_0x2bfa20['id']=_0x238ec8;}return db[_0x7da4('0x3a')][_0x7da4('0x3b')]({'where':_0x2bfa20,'include':[{'model':db[_0x7da4('0xc')],'attributes':['id','name',_0x7da4('0x8')],'include':[{'model':db[_0x7da4('0x3c')],'as':_0x7da4('0x9')}]}]})[_0x7da4('0x26')](function(_0x3a844a){var _0x35f05a=_['keys'](manager[_0x7da4('0x3d')]);var _0x14c7d3=_[_0x7da4('0x3e')](_0x3a844a,function(_0x341cc1){return _0x341cc1['id'][_0x7da4('0x3f')]();});var _0x4625e7=_['keyBy'](_0x3a844a,function(_0x2a6a59){return _0x2a6a59['id']['toString']();});var _0x36ae01=_0x238ec8?_0x14c7d3:_['difference'](_0x14c7d3,_0x35f05a);var _0x25a8ef=_[_0x7da4('0x40')](_0x14c7d3,_0x35f05a);var _0x312348=_[_0x7da4('0x41')](_0x35f05a,_0x14c7d3);var _0x421e8b;var _0x501479;for(_0x421e8b=0x0;_0x421e8b<_0x312348[_0x7da4('0x42')]&&!_0x238ec8;_0x421e8b+=0x1){_0x501479=_0x312348[_0x421e8b][_0x7da4('0x3f')]();if(manager[_0x7da4('0x43')](_0x501479)){manager[_0x7da4('0x44')](_0x501479);manager['deleteJob'](_0x501479);logger[_0x7da4('0x29')](_0x7da4('0x45'),_0x501479);}}logger[_0x7da4('0x29')]('toRun',JSON[_0x7da4('0x2b')](_0x36ae01));for(_0x421e8b=0x0;_0x421e8b<_0x36ae01[_0x7da4('0x42')];_0x421e8b+=0x1){_0x501479=_0x36ae01[_0x421e8b][_0x7da4('0x3f')]();logger[_0x7da4('0x29')](_0x7da4('0x46'),_0x501479);if(_0x238ec8){logger['info'](_0x7da4('0x47'),_0x238ec8);logger[_0x7da4('0x29')](JSON[_0x7da4('0x2b')](_0x4625e7[_0x501479]));BPromise[_0x7da4('0x48')]()[_0x7da4('0x26')](handleJob(_0x4625e7[_0x501479]));logger[_0x7da4('0x29')](_0x7da4('0x49'),_0x4625e7[_0x501479][_0x7da4('0x14')],_0x4625e7[_0x501479]['cron']);}else if(_0x4625e7[_0x501479][_0x7da4('0x4a')]&&_0x4625e7[_0x501479][_0x7da4('0x4b')]&&moment()[_0x7da4('0x4c')](_0x4625e7[_0x501479][_0x7da4('0x4d')],_0x4625e7[_0x501479][_0x7da4('0x4e')])){manager[_0x7da4('0x4f')](_0x501479,_0x4625e7[_0x501479]['cron'],handleJob(_0x4625e7[_0x501479]));manager[_0x7da4('0x50')](_0x501479);logger[_0x7da4('0x29')](_0x7da4('0x51'),_0x4625e7[_0x501479][_0x7da4('0x14')],_0x4625e7[_0x501479][_0x7da4('0x4a')]);}else if(manager[_0x7da4('0x43')](_0x501479)){manager[_0x7da4('0x44')](_0x501479);manager[_0x7da4('0x52')](_0x501479);logger[_0x7da4('0x29')](_0x7da4('0x53'),_0x4625e7[_0x501479][_0x7da4('0x14')],_0x4625e7[_0x501479][_0x7da4('0x4a')]);}}for(_0x421e8b=0x0,_0x501479;_0x421e8b<_0x25a8ef[_0x7da4('0x42')]&&!_0x238ec8;_0x421e8b+=0x1){_0x501479=_0x25a8ef[_0x421e8b][_0x7da4('0x3f')]();if(manager['exists'](_0x501479)){if(_0x4625e7[_0x501479]['cron']&&_0x4625e7[_0x501479][_0x7da4('0x4b')]&&moment()['isBetween'](_0x4625e7[_0x501479][_0x7da4('0x4d')],_0x4625e7[_0x501479][_0x7da4('0x4e')])){manager[_0x7da4('0x54')](_0x501479,_0x4625e7[_0x501479][_0x7da4('0x4a')],handleJob(_0x4625e7[_0x501479]));logger['info'](_0x7da4('0x55'),_0x4625e7[_0x501479][_0x7da4('0x14')],_0x4625e7[_0x501479][_0x7da4('0x4a')]);}else{manager[_0x7da4('0x44')](_0x501479);manager[_0x7da4('0x52')](_0x501479);logger[_0x7da4('0x29')](_0x7da4('0x53'),_0x4625e7[_0x501479][_0x7da4('0x14')],_0x4625e7[_0x501479]['cron']);}}}})[_0x7da4('0x36')](function(_0x489f45){logger[_0x7da4('0x27')](JSON['stringify'](_0x489f45));});}exports[_0x7da4('0x56')]=function(_0x2161f5){return getJobs(_0x2161f5);};exports[_0x7da4('0x50')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x2571=['cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','Smtp','service','MailAccount','host','port','authentication','auth','user','\x22%s\x22\x20<%s>','bcc','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','../../files/reports','savename','format','%s.%s','basename','extname','join','existsSync','status','Sent','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','text','SendMail','then','error','email\x20sent','catch','error\x20mail','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','scheduled','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','jobs','map','toString','keyBy','intersection','difference','length','toRun','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','deleteJob','stop\x20cron','exists','update','update\x20cron','stop','run','util','path','moment'];(function(_0x1beaa4,_0x511c17){var _0x3780fd=function(_0x55c4c4){while(--_0x55c4c4){_0x1beaa4['push'](_0x1beaa4['shift']());}};_0x3780fd(++_0x511c17);}(_0x2571,0x171));var _0x1257=function(_0x1d2bbb,_0x202267){_0x1d2bbb=_0x1d2bbb-0x0;var _0x38082b=_0x2571[_0x1d2bbb];return _0x38082b;};'use strict';var fs=require('fs');var util=require(_0x1257('0x0'));var path=require(_0x1257('0x1'));var _=require('lodash');var moment=require(_0x1257('0x2'));var CronJobManager=require(_0x1257('0x3'));var jayson=require(_0x1257('0x4'));var BPromise=require(_0x1257('0x5'));var logger=require(_0x1257('0x6'))(_0x1257('0x7'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x1257('0x8'));var analyticDefaultReportController=require(_0x1257('0x9'));var client=jayson[_0x1257('0xa')][_0x1257('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x465d08,_0x4b5385){return function(){logger[_0x1257('0xc')](_0x1257('0xd'),_0x465d08[_0x1257('0xe')]);var _0x32ab53=!![];var _0x3b6906={'tls':{'rejectUnauthorized':![]}};if(_0x465d08['MailAccount'][_0x1257('0xf')][_0x1257('0x10')]){_0x3b6906[_0x1257('0x10')]=_0x465d08[_0x1257('0x11')]['Smtp'][_0x1257('0x10')];}else{_0x3b6906[_0x1257('0x12')]=_0x465d08[_0x1257('0x11')][_0x1257('0xf')][_0x1257('0x12')];_0x3b6906[_0x1257('0x13')]=_0x465d08[_0x1257('0x11')][_0x1257('0xf')][_0x1257('0x13')];_0x3b6906['secure']=_0x465d08[_0x1257('0x11')][_0x1257('0xf')]['secure'];}if(_0x465d08['MailAccount'][_0x1257('0xf')][_0x1257('0x14')]){_0x3b6906[_0x1257('0x15')]={'user':_0x465d08[_0x1257('0x11')][_0x1257('0xf')][_0x1257('0x16')],'pass':_0x465d08[_0x1257('0x11')][_0x1257('0xf')]['pass']};}var _0x5b8a2c={'account':_0x3b6906,'message':{'from':util['format'](_0x1257('0x17'),_0x465d08[_0x1257('0x11')]['name'],_0x465d08[_0x1257('0x11')][_0x1257('0xe')]||_0x465d08['MailAccount'][_0x1257('0xf')][_0x1257('0x16')]),'to':_0x465d08[_0x1257('0xe')],'cc':_0x465d08['cc'],'bcc':_0x465d08[_0x1257('0x18')],'subject':util['format'](_0x1257('0x19'),_0x4b5385[_0x1257('0x1a')],_0x465d08[_0x1257('0x1b')],_0x465d08['subtractUnit'])}};var _0x3e988a=path['join'](__dirname,_0x1257('0x1c'));var _0x3fb8d3=_0x4b5385[_0x1257('0x1d')];var _0x49c5ff=util[_0x1257('0x1e')](_0x1257('0x1f'),path[_0x1257('0x20')](_0x4b5385[_0x1257('0x1d')],path[_0x1257('0x21')](_0x4b5385[_0x1257('0x1d')])),'zip');var _0x1c9798=path['join'](_0x3e988a,_0x3fb8d3);var _0x25ccb7=path[_0x1257('0x22')](_0x3e988a,_0x49c5ff);if(fs[_0x1257('0x23')](_0x1c9798)){_0x4b5385[_0x1257('0x24')]=_0x1257('0x25');_0x5b8a2c[_0x1257('0x26')][_0x1257('0x27')]=[{'filename':_0x3fb8d3,'path':_0x1c9798}];_0x5b8a2c[_0x1257('0x26')]['text']=util['format'](_0x1257('0x28'),JSON[_0x1257('0x29')](_0x4b5385,null,0x2));}else if(fs[_0x1257('0x23')](_0x25ccb7)){_0x4b5385[_0x1257('0x24')]=_0x1257('0x25');_0x5b8a2c[_0x1257('0x26')][_0x1257('0x27')]=[{'filename':_0x49c5ff,'path':_0x25ccb7}];}else{_0x5b8a2c[_0x1257('0x26')][_0x1257('0x2a')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x465d08['sendIfEmpty']){_0x32ab53=![];logger[_0x1257('0xc')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x32ab53){return client['request'](_0x1257('0x2b'),_0x5b8a2c)[_0x1257('0x2c')](function(_0x291d7c){if(_0x291d7c['error']){return logger[_0x1257('0x2d')]('error\x20mail',JSON[_0x1257('0x29')](_0x291d7c));}return logger[_0x1257('0xc')](_0x1257('0x2e'));})[_0x1257('0x2f')](function(_0x57b2a5){return logger[_0x1257('0x2d')](_0x1257('0x30'),JSON[_0x1257('0x29')](_0x57b2a5));});}};}function handleError(){return function(_0x4390c3){return logger['error'](JSON[_0x1257('0x29')](_0x4390c3));};}function handleResult(_0x6eac6b){return function(_0x3ad80f){logger[_0x1257('0xc')](_0x1257('0x31'),JSON[_0x1257('0x29')](_0x3ad80f));if(_0x6eac6b[_0x1257('0x11')]&&_0x6eac6b[_0x1257('0x11')][_0x1257('0xf')]&&!_[_0x1257('0x32')](_0x6eac6b['email'])){setTimeout(handleSendEmail(_0x6eac6b,_0x3ad80f),0x3c*0x3e8);}};}function handleJob(_0x55d1af){return function(){try{if(_[_0x1257('0x32')](_0x55d1af[_0x1257('0x1b')])){return logger['info'](_0x1257('0x33'));}if(_[_0x1257('0x32')](_0x55d1af[_0x1257('0x34')])){return logger[_0x1257('0xc')](_0x1257('0x35'));}var _0x14617b={'startDate':moment()[_0x1257('0x36')](_0x55d1af[_0x1257('0x1b')],_0x55d1af['subtractUnit'])[_0x1257('0x1e')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x1257('0x1e')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x1257('0x37'),'output':_0x55d1af['output'],'name':_0x55d1af['name']};if(!_[_0x1257('0x32')](_0x55d1af[_0x1257('0x38')])){logger['info'](_0x1257('0x39'),_0x55d1af[_0x1257('0x38')]);return analyticDefaultReportController[_0x1257('0x3a')]({'id':_0x55d1af[_0x1257('0x38')]},_0x14617b)[_0x1257('0x2c')](handleResult(_0x55d1af))[_0x1257('0x2f')](handleError());}if(!_[_0x1257('0x32')](_0x55d1af['CustomReportId'])){logger[_0x1257('0xc')](_0x1257('0x3b'),_0x55d1af['CustomReportId']);return analyticCustomReportController['runReport']({'id':_0x55d1af[_0x1257('0x3c')]},_0x14617b)[_0x1257('0x2c')](handleResult(_0x55d1af))['catch'](handleError());}}catch(_0x26f52b){logger[_0x1257('0x2d')](JSON[_0x1257('0x29')](_0x26f52b));}return logger[_0x1257('0xc')](_0x1257('0x3d'));};}function getJobs(_0x861f74){var _0x1e5c83={};if(_0x861f74){_0x1e5c83['id']=_0x861f74;}return db[_0x1257('0x3e')][_0x1257('0x3f')]({'where':_0x1e5c83,'include':[{'model':db[_0x1257('0x11')],'attributes':['id','name',_0x1257('0xe')],'include':[{'model':db[_0x1257('0x40')],'as':'Smtp'}]}]})[_0x1257('0x2c')](function(_0x584da3){var _0x51ab8f=_[_0x1257('0x41')](manager[_0x1257('0x42')]);var _0x13e8cf=_[_0x1257('0x43')](_0x584da3,function(_0xfa850e){return _0xfa850e['id'][_0x1257('0x44')]();});var _0x682582=_[_0x1257('0x45')](_0x584da3,function(_0x380209){return _0x380209['id']['toString']();});var _0x3151a4=_0x861f74?_0x13e8cf:_['difference'](_0x13e8cf,_0x51ab8f);var _0x5005d1=_[_0x1257('0x46')](_0x13e8cf,_0x51ab8f);var _0x1a56af=_[_0x1257('0x47')](_0x51ab8f,_0x13e8cf);var _0x52d330;var _0x3422dc;for(_0x52d330=0x0;_0x52d330<_0x1a56af[_0x1257('0x48')]&&!_0x861f74;_0x52d330+=0x1){_0x3422dc=_0x1a56af[_0x52d330][_0x1257('0x44')]();if(manager['exists'](_0x3422dc)){manager['stop'](_0x3422dc);manager['deleteJob'](_0x3422dc);logger['info']('delete\x20cron',_0x3422dc);}}logger[_0x1257('0xc')](_0x1257('0x49'),JSON[_0x1257('0x29')](_0x3151a4));for(_0x52d330=0x0;_0x52d330<_0x3151a4[_0x1257('0x48')];_0x52d330+=0x1){_0x3422dc=_0x3151a4[_0x52d330]['toString']();logger[_0x1257('0xc')](_0x1257('0x4a'),_0x3422dc);if(_0x861f74){logger['info'](_0x1257('0x4b'),_0x861f74);logger[_0x1257('0xc')](JSON[_0x1257('0x29')](_0x682582[_0x3422dc]));BPromise[_0x1257('0x4c')]()[_0x1257('0x2c')](handleJob(_0x682582[_0x3422dc]));logger[_0x1257('0xc')](_0x1257('0x4d'),_0x682582[_0x3422dc]['name'],_0x682582[_0x3422dc][_0x1257('0x4e')]);}else if(_0x682582[_0x3422dc][_0x1257('0x4e')]&&_0x682582[_0x3422dc][_0x1257('0x4f')]&&moment()[_0x1257('0x50')](_0x682582[_0x3422dc][_0x1257('0x51')],_0x682582[_0x3422dc][_0x1257('0x52')])){manager[_0x1257('0x53')](_0x3422dc,_0x682582[_0x3422dc][_0x1257('0x4e')],handleJob(_0x682582[_0x3422dc]));manager[_0x1257('0x54')](_0x3422dc);logger['info'](_0x1257('0x55'),_0x682582[_0x3422dc][_0x1257('0x1a')],_0x682582[_0x3422dc][_0x1257('0x4e')]);}else if(manager['exists'](_0x3422dc)){manager['stop'](_0x3422dc);manager[_0x1257('0x56')](_0x3422dc);logger['info'](_0x1257('0x57'),_0x682582[_0x3422dc]['name'],_0x682582[_0x3422dc]['cron']);}}for(_0x52d330=0x0,_0x3422dc;_0x52d330<_0x5005d1[_0x1257('0x48')]&&!_0x861f74;_0x52d330+=0x1){_0x3422dc=_0x5005d1[_0x52d330][_0x1257('0x44')]();if(manager[_0x1257('0x58')](_0x3422dc)){if(_0x682582[_0x3422dc][_0x1257('0x4e')]&&_0x682582[_0x3422dc][_0x1257('0x4f')]&&moment()[_0x1257('0x50')](_0x682582[_0x3422dc][_0x1257('0x51')],_0x682582[_0x3422dc][_0x1257('0x52')])){manager[_0x1257('0x59')](_0x3422dc,_0x682582[_0x3422dc][_0x1257('0x4e')],handleJob(_0x682582[_0x3422dc]));logger[_0x1257('0xc')](_0x1257('0x5a'),_0x682582[_0x3422dc][_0x1257('0x1a')],_0x682582[_0x3422dc][_0x1257('0x4e')]);}else{manager[_0x1257('0x5b')](_0x3422dc);manager[_0x1257('0x56')](_0x3422dc);logger[_0x1257('0xc')](_0x1257('0x57'),_0x682582[_0x3422dc]['name'],_0x682582[_0x3422dc][_0x1257('0x4e')]);}}}})[_0x1257('0x2f')](function(_0x226c7e){logger[_0x1257('0x2d')](JSON[_0x1257('0x29')](_0x226c7e));});}exports[_0x1257('0x5c')]=function(_0x3d2a14){return getJobs(_0x3d2a14);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index 5c0b92b..93af0ac 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 _0x02f7=['Sequelize','ValidationError','sentimentAccountId','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','findOne','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Negative','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','sentiment','CloudProvider','Cloud\x20Provider\x20not\x20available','COMPLETED','catch','name','error','inspect','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','Transcribe\x20not\x20configured','transcribeAccountId','push','all','start','lodash','aws-sdk','request-promise','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','transcribeRegion','then','TranscriptionJobStatus','fileText','TranscriptionJob','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','tempSentiment'];(function(_0x1de0b9,_0xc6f046){var _0x18edae=function(_0x2d3ad1){while(--_0x2d3ad1){_0x1de0b9['push'](_0x1de0b9['shift']());}};_0x18edae(++_0xc6f046);}(_0x02f7,0x1d3));var _0x702f=function(_0x219cc1,_0x3d03b5){_0x219cc1=_0x219cc1-0x0;var _0x177034=_0x02f7[_0x219cc1];return _0x177034;};var _=require(_0x702f('0x0'));var AWS=require(_0x702f('0x1'));var rp=require(_0x702f('0x2'));var util=require('util');var BPromise=require(_0x702f('0x3'));var db=require(_0x702f('0x4'))['db'];var logger=require(_0x702f('0x5'))(_0x702f('0x6'));function getTranscriptionJob(_0x7afcee,_0x2d4d5a,_0x47db23,_0x5f1d5d){return new Promise(function(_0x449ba1,_0x4ff1d2){var _0x69295=new AWS[(_0x702f('0x7'))]({'accessKeyId':_0x2d4d5a,'secretAccessKey':_0x7afcee,'region':_0x47db23});_0x69295[_0x702f('0x8')]({'TranscriptionJobName':_0x5f1d5d},function(_0xfe27d7,_0x39371c){if(_0xfe27d7){return _0x4ff1d2(_0xfe27d7);}else{return _0x449ba1(_0x39371c);}});});}function sentiment(_0x4f24bb,_0x5e0fa9,_0x389c21,_0x2408f5,_0x5c4f84){return new Promise(function(_0x3d6f55,_0x23d739){var _0x351a30=new AWS['Comprehend']({'accessKeyId':_0x5e0fa9,'secretAccessKey':_0x4f24bb,'region':_0x389c21});_0x351a30['detectSentiment']({'Text':_0x2408f5,'LanguageCode':_0x5c4f84[_0x702f('0x9')](0x0,0x2)},function(_0x202ae5,_0x3ba9cf){if(_0x202ae5){return _0x23d739(_0x202ae5);}else{return _0x3d6f55(_0x3ba9cf);}});});}function checkTranscribeJob(_0x4aa91c,_0xb0ce29,_0x3ac816){var _0x4f8528;return new BPromise(function(_0x39c277,_0x7a0582){logger[_0x702f('0xa')](util[_0x702f('0xb')](_0x702f('0xc'),_0x4aa91c['id'],_0x4aa91c[_0x702f('0xd')]));return getTranscriptionJob(_0x3ac816[_0x702f('0xe')],_0x3ac816['data2'],_0xb0ce29[_0x702f('0xf')],_0x4aa91c[_0x702f('0xd')])[_0x702f('0x10')](function(_0x67a47e){logger[_0x702f('0xa')](util['format']('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x4aa91c['id'],_0x4aa91c[_0x702f('0xd')],_0x67a47e['TranscriptionJob'][_0x702f('0x11')]));if(!_0x4aa91c[_0x702f('0x12')]){switch(_0x67a47e[_0x702f('0x13')][_0x702f('0x11')]){case'COMPLETED':var _0x1eb91a={'transcribeStatus':_0x67a47e['TranscriptionJob']['TranscriptionJobStatus'],'fileUri':_0x67a47e[_0x702f('0x13')][_0x702f('0x14')][_0x702f('0x15')]};logger['info'](util[_0x702f('0xb')](_0x702f('0x16'),_0x4aa91c['id']));return rp({'uri':_0x67a47e[_0x702f('0x13')]['Transcript'][_0x702f('0x15')],'json':!![]})[_0x702f('0x10')](function(_0xadc8c1){logger[_0x702f('0xa')](util[_0x702f('0xb')](_0x702f('0x17'),_0x4aa91c['id']));if(_0xadc8c1&&_0xadc8c1[_0x702f('0x18')]&&_0xadc8c1[_0x702f('0x18')][_0x702f('0x19')]&&_0xadc8c1[_0x702f('0x18')][_0x702f('0x19')][_0x702f('0x1a')]){_0x1eb91a[_0x702f('0x12')]='';for(var _0x362c3f=0x0;_0x362c3f<_0xadc8c1[_0x702f('0x18')][_0x702f('0x19')][_0x702f('0x1a')];_0x362c3f++){_0x1eb91a['fileText']+=_0xadc8c1[_0x702f('0x18')][_0x702f('0x19')][_0x362c3f][_0x702f('0x1b')]+'';}}return _0x4aa91c[_0x702f('0x1c')](_0x1eb91a);})[_0x702f('0x10')](function(){logger['info'](util[_0x702f('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x4aa91c['id']));if(!_0x4aa91c[_0x702f('0x1d')]){throw new db[(_0x702f('0x1e'))][(_0x702f('0x1f'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0xb0ce29['sentiment']||!_0xb0ce29[_0x702f('0x20')]||!_0xb0ce29['sentimentRegion']||!_0xb0ce29[_0x702f('0x21')]||!_0xb0ce29[_0x702f('0x22')]){throw new db[(_0x702f('0x1e'))]['ValidationError'](_0x702f('0x23'));}if(!_0x1eb91a[_0x702f('0x12')]){throw new Error(_0x702f('0x24'));}if(_0xb0ce29['sentimentAccountId']===_0x3ac816['id']){return _0x3ac816;}else{return db['CloudProvider'][_0x702f('0x25')]({'where':{'id':_settings[_0x702f('0x20')]}});}})[_0x702f('0x10')](function(_0x7c0902){if(!_0x7c0902){throw new db[(_0x702f('0x1e'))][(_0x702f('0x1f'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x7c0902[_0x702f('0xe')]||!_0x7c0902[_0x702f('0x26')]){throw new db[(_0x702f('0x1e'))][(_0x702f('0x1f'))](_0x702f('0x27'));}_0x4f8528=_0x7c0902;logger['info'](util[_0x702f('0xb')](_0x702f('0x28'),_0x4aa91c['id']));return sentiment(_0x4f8528[_0x702f('0xe')],_0x4f8528['data2'],_0xb0ce29[_0x702f('0x29')],_0x1eb91a[_0x702f('0x12')],_0xb0ce29[_0x702f('0x21')]);})[_0x702f('0x10')](function(_0x1975a8){logger[_0x702f('0xa')](util[_0x702f('0xb')](_0x702f('0x2a'),_0x4aa91c['id']));return _0x4aa91c[_0x702f('0x1c')]({'sentiment':_0x1975a8[_0x702f('0x2b')],'sPositive':_0x1975a8[_0x702f('0x2c')]['Positive'],'sNegative':_0x1975a8['SentimentScore'][_0x702f('0x2d')],'sMixed':_0x1975a8[_0x702f('0x2c')][_0x702f('0x2e')],'sNeutral':_0x1975a8[_0x702f('0x2c')][_0x702f('0x2f')]});})[_0x702f('0x10')](function(){logger['info'](util[_0x702f('0xb')](_0x702f('0x30'),_0x4aa91c['id']));_0x39c277();});case _0x702f('0x31'):return _0x4aa91c[_0x702f('0x1c')]({'transcribeStatus':_0x702f('0x31'),'failureReason':_0x67a47e[_0x702f('0x13')][_0x702f('0x32')]})['then'](function(){logger[_0x702f('0xa')](util[_0x702f('0xb')](_0x702f('0x30'),_0x4aa91c['id']));_0x39c277();});default:logger[_0x702f('0xa')](util[_0x702f('0xb')](_0x702f('0x33'),_0x4aa91c['id']));break;}}else{return BPromise[_0x702f('0x34')]()['then'](function(){if(!_0x4aa91c['tempSentiment']){throw new db[(_0x702f('0x1e'))][(_0x702f('0x1f'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0xb0ce29[_0x702f('0x35')]||!_0xb0ce29[_0x702f('0x20')]||!_0xb0ce29['sentimentRegion']||!_0xb0ce29[_0x702f('0x21')]||!_0xb0ce29[_0x702f('0x22')]){throw new db[(_0x702f('0x1e'))][(_0x702f('0x1f'))](_0x702f('0x23'));}if(!_0x4aa91c[_0x702f('0x12')]){throw new Error(_0x702f('0x24'));}if(_0xb0ce29[_0x702f('0x20')]===_0x3ac816['id']){return _0x3ac816;}else{return db[_0x702f('0x36')][_0x702f('0x25')]({'where':{'id':_settings[_0x702f('0x20')]}});}})[_0x702f('0x10')](function(_0x4d49ff){if(!_0x4d49ff){throw new db['Sequelize'][(_0x702f('0x1f'))](_0x702f('0x37'));}if(!_0x4d49ff[_0x702f('0xe')]||!_0x4d49ff[_0x702f('0x26')]){throw new db[(_0x702f('0x1e'))][(_0x702f('0x1f'))](_0x702f('0x27'));}_0x4f8528=_0x4d49ff;logger[_0x702f('0xa')](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x4aa91c['id']));return sentiment(_0x4f8528[_0x702f('0xe')],_0x4f8528[_0x702f('0x26')],_0xb0ce29[_0x702f('0x29')],_0x4aa91c[_0x702f('0x12')],_0xb0ce29['language']);})[_0x702f('0x10')](function(_0x56bb9f){logger[_0x702f('0xa')](util[_0x702f('0xb')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x4aa91c['id']));return _0x4aa91c['update']({'sentiment':_0x56bb9f[_0x702f('0x2b')],'sPositive':_0x56bb9f[_0x702f('0x2c')]['Positive'],'sNegative':_0x56bb9f['SentimentScore'][_0x702f('0x2d')],'sMixed':_0x56bb9f[_0x702f('0x2c')][_0x702f('0x2e')],'sNeutral':_0x56bb9f[_0x702f('0x2c')][_0x702f('0x2f')],'transcribeStatus':_0x702f('0x38')});})['then'](function(){logger['info'](util[_0x702f('0xb')](_0x702f('0x30'),_0x4aa91c['id']));_0x39c277();});}})[_0x702f('0x39')](function(_0x3c40f1){if(_0x3c40f1){if(!_0x3c40f1[_0x702f('0x3a')]||_0x3c40f1[_0x702f('0x3a')]!=='SequelizeValidationError'){logger[_0x702f('0x3b')](util[_0x702f('0xb')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x4aa91c['id']),util[_0x702f('0x3c')](_0x3c40f1,{'showHidden':![],'depth':null}));}}_0x39c277();});});}function checkTranscribe(){var _0x493252;var _0x5a133e;var _0x5e11b5;return db[_0x702f('0x3d')][_0x702f('0x3e')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x702f('0x10')](function(_0x4b4f3c){if(!_0x4b4f3c||!_0x4b4f3c[_0x702f('0x1a')]){throw new db[(_0x702f('0x1e'))][(_0x702f('0x1f'))](_0x702f('0x3f'));}_0x493252=_0x4b4f3c;return db[_0x702f('0x40')][_0x702f('0x25')]({'where':{'id':0x1}});})[_0x702f('0x10')](function(_0x261172){if(!_0x261172){throw new db[(_0x702f('0x1e'))][(_0x702f('0x1f'))](_0x702f('0x41'));}_0x5a133e=_0x261172;if(!_0x5a133e[_0x702f('0x6')]||!_0x5a133e['transcribeAccountId']||!_0x5a133e[_0x702f('0xf')]||!_0x5a133e[_0x702f('0x21')]||!_0x5a133e[_0x702f('0x22')]){throw new db[(_0x702f('0x1e'))]['ValidationError'](_0x702f('0x42'));}return db[_0x702f('0x36')][_0x702f('0x25')]({'where':{'id':_0x5a133e[_0x702f('0x43')]}});})[_0x702f('0x10')](function(_0x3f5899){if(!_0x3f5899){throw new db['Sequelize'][(_0x702f('0x1f'))](_0x702f('0x37'));}if(!_0x3f5899[_0x702f('0xe')]||!_0x3f5899[_0x702f('0x26')]){throw new db['Sequelize'][(_0x702f('0x1f'))](_0x702f('0x27'));}_0x5e11b5=_0x3f5899;var _0x1bdcd1=[];_0x493252['forEach'](function(_0x653405){_0x1bdcd1[_0x702f('0x44')](checkTranscribeJob(_0x653405,_0x5a133e,_0x5e11b5));});return BPromise[_0x702f('0x45')](_0x1bdcd1);})[_0x702f('0x39')](function(_0x217919){if(_0x217919){if(!_0x217919['name']||_0x217919[_0x702f('0x3a')]!=='SequelizeValidationError'){logger[_0x702f('0x3b')](util[_0x702f('0x3c')](_0x217919,{'showHidden':![],'depth':null}));}}});}exports[_0x702f('0x46')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xce25=['TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','format','[RECORDING:%d]\x20Get\x20transcript','results','transcripts','fileText','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Negative','Mixed','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','forEach','push','all','start','request-promise','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','substring','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','data2','transcribeRegion','then','info','transcribeName'];(function(_0x5d93bb,_0x4ea01e){var _0x101ef0=function(_0x44662f){while(--_0x44662f){_0x5d93bb['push'](_0x5d93bb['shift']());}};_0x101ef0(++_0x4ea01e);}(_0xce25,0x196));var _0x5ce2=function(_0x3f8157,_0x34cc64){_0x3f8157=_0x3f8157-0x0;var _0x27aead=_0xce25[_0x3f8157];return _0x27aead;};var _=require('lodash');var AWS=require('aws-sdk');var rp=require(_0x5ce2('0x0'));var util=require('util');var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require(_0x5ce2('0x1'))(_0x5ce2('0x2'));function getTranscriptionJob(_0x58f9eb,_0x3f4b36,_0x41a229,_0x54f598){return new Promise(function(_0x57a7a5,_0x41fb85){var _0x417149=new AWS[(_0x5ce2('0x3'))]({'accessKeyId':_0x3f4b36,'secretAccessKey':_0x58f9eb,'region':_0x41a229});_0x417149[_0x5ce2('0x4')]({'TranscriptionJobName':_0x54f598},function(_0x4a57a6,_0x2ccf81){if(_0x4a57a6){return _0x41fb85(_0x4a57a6);}else{return _0x57a7a5(_0x2ccf81);}});});}function sentiment(_0x412b62,_0x166c86,_0x49ede4,_0x2c2cee,_0x13e872){return new Promise(function(_0x1ff8d9,_0x363850){var _0x22e433=new AWS[(_0x5ce2('0x5'))]({'accessKeyId':_0x166c86,'secretAccessKey':_0x412b62,'region':_0x49ede4});_0x22e433['detectSentiment']({'Text':_0x2c2cee,'LanguageCode':_0x13e872[_0x5ce2('0x6')](0x0,0x2)},function(_0x4f7a36,_0xf8525c){if(_0x4f7a36){return _0x363850(_0x4f7a36);}else{return _0x1ff8d9(_0xf8525c);}});});}function checkTranscribeJob(_0x3b027b,_0x5387b2,_0x496c1e){var _0x595d33;return new BPromise(function(_0x550fb3,_0x15a95e){logger['info'](util['format'](_0x5ce2('0x7'),_0x3b027b['id'],_0x3b027b['transcribeName']));return getTranscriptionJob(_0x496c1e[_0x5ce2('0x8')],_0x496c1e[_0x5ce2('0x9')],_0x5387b2[_0x5ce2('0xa')],_0x3b027b['transcribeName'])[_0x5ce2('0xb')](function(_0x2727c7){logger[_0x5ce2('0xc')](util['format']('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x3b027b['id'],_0x3b027b[_0x5ce2('0xd')],_0x2727c7[_0x5ce2('0xe')][_0x5ce2('0xf')]));if(!_0x3b027b['fileText']){switch(_0x2727c7[_0x5ce2('0xe')][_0x5ce2('0xf')]){case _0x5ce2('0x10'):var _0x385d2e={'transcribeStatus':_0x2727c7[_0x5ce2('0xe')][_0x5ce2('0xf')],'fileUri':_0x2727c7[_0x5ce2('0xe')][_0x5ce2('0x11')][_0x5ce2('0x12')]};logger[_0x5ce2('0xc')](util[_0x5ce2('0x13')](_0x5ce2('0x14'),_0x3b027b['id']));return rp({'uri':_0x2727c7[_0x5ce2('0xe')][_0x5ce2('0x11')][_0x5ce2('0x12')],'json':!![]})[_0x5ce2('0xb')](function(_0x13d32d){logger[_0x5ce2('0xc')](util[_0x5ce2('0x13')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x3b027b['id']));if(_0x13d32d&&_0x13d32d['results']&&_0x13d32d[_0x5ce2('0x15')][_0x5ce2('0x16')]&&_0x13d32d[_0x5ce2('0x15')]['transcripts']['length']){_0x385d2e[_0x5ce2('0x17')]='';for(var _0x43580f=0x0;_0x43580f<_0x13d32d['results'][_0x5ce2('0x16')][_0x5ce2('0x18')];_0x43580f++){_0x385d2e[_0x5ce2('0x17')]+=_0x13d32d[_0x5ce2('0x15')][_0x5ce2('0x16')][_0x43580f][_0x5ce2('0x19')]+'';}}return _0x3b027b[_0x5ce2('0x1a')](_0x385d2e);})[_0x5ce2('0xb')](function(){logger[_0x5ce2('0xc')](util[_0x5ce2('0x13')](_0x5ce2('0x1b'),_0x3b027b['id']));if(!_0x3b027b[_0x5ce2('0x1c')]){throw new db[(_0x5ce2('0x1d'))][(_0x5ce2('0x1e'))](_0x5ce2('0x1f'));}if(!_0x5387b2[_0x5ce2('0x20')]||!_0x5387b2[_0x5ce2('0x21')]||!_0x5387b2[_0x5ce2('0x22')]||!_0x5387b2[_0x5ce2('0x23')]||!_0x5387b2[_0x5ce2('0x24')]){throw new db[(_0x5ce2('0x1d'))][(_0x5ce2('0x1e'))](_0x5ce2('0x25'));}if(!_0x385d2e[_0x5ce2('0x17')]){throw new Error(_0x5ce2('0x26'));}if(_0x5387b2[_0x5ce2('0x21')]===_0x496c1e['id']){return _0x496c1e;}else{return db[_0x5ce2('0x27')][_0x5ce2('0x28')]({'where':{'id':_settings[_0x5ce2('0x21')]}});}})[_0x5ce2('0xb')](function(_0x2c956c){if(!_0x2c956c){throw new db[(_0x5ce2('0x1d'))]['ValidationError'](_0x5ce2('0x29'));}if(!_0x2c956c[_0x5ce2('0x8')]||!_0x2c956c[_0x5ce2('0x9')]){throw new db['Sequelize']['ValidationError'](_0x5ce2('0x2a'));}_0x595d33=_0x2c956c;logger[_0x5ce2('0xc')](util[_0x5ce2('0x13')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x3b027b['id']));return sentiment(_0x595d33['data1'],_0x595d33[_0x5ce2('0x9')],_0x5387b2[_0x5ce2('0x22')],_0x385d2e['fileText'],_0x5387b2[_0x5ce2('0x23')]);})[_0x5ce2('0xb')](function(_0x106ecc){logger[_0x5ce2('0xc')](util[_0x5ce2('0x13')](_0x5ce2('0x2b'),_0x3b027b['id']));return _0x3b027b[_0x5ce2('0x1a')]({'sentiment':_0x106ecc[_0x5ce2('0x2c')],'sPositive':_0x106ecc[_0x5ce2('0x2d')][_0x5ce2('0x2e')],'sNegative':_0x106ecc[_0x5ce2('0x2d')]['Negative'],'sMixed':_0x106ecc['SentimentScore']['Mixed'],'sNeutral':_0x106ecc['SentimentScore'][_0x5ce2('0x2f')]});})[_0x5ce2('0xb')](function(){logger[_0x5ce2('0xc')](util[_0x5ce2('0x13')](_0x5ce2('0x1b'),_0x3b027b['id']));_0x550fb3();});case _0x5ce2('0x30'):return _0x3b027b[_0x5ce2('0x1a')]({'transcribeStatus':_0x5ce2('0x30'),'failureReason':_0x2727c7[_0x5ce2('0xe')][_0x5ce2('0x31')]})[_0x5ce2('0xb')](function(){logger[_0x5ce2('0xc')](util['format'](_0x5ce2('0x1b'),_0x3b027b['id']));_0x550fb3();});default:logger[_0x5ce2('0xc')](util['format'](_0x5ce2('0x32'),_0x3b027b['id']));break;}}else{return BPromise[_0x5ce2('0x33')]()[_0x5ce2('0xb')](function(){if(!_0x3b027b[_0x5ce2('0x1c')]){throw new db['Sequelize'][(_0x5ce2('0x1e'))](_0x5ce2('0x1f'));}if(!_0x5387b2[_0x5ce2('0x20')]||!_0x5387b2[_0x5ce2('0x21')]||!_0x5387b2[_0x5ce2('0x22')]||!_0x5387b2[_0x5ce2('0x23')]||!_0x5387b2['bucket']){throw new db[(_0x5ce2('0x1d'))][(_0x5ce2('0x1e'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x3b027b[_0x5ce2('0x17')]){throw new Error(_0x5ce2('0x26'));}if(_0x5387b2['sentimentAccountId']===_0x496c1e['id']){return _0x496c1e;}else{return db[_0x5ce2('0x27')][_0x5ce2('0x28')]({'where':{'id':_settings[_0x5ce2('0x21')]}});}})[_0x5ce2('0xb')](function(_0x3af34a){if(!_0x3af34a){throw new db[(_0x5ce2('0x1d'))][(_0x5ce2('0x1e'))](_0x5ce2('0x29'));}if(!_0x3af34a[_0x5ce2('0x8')]||!_0x3af34a['data2']){throw new db[(_0x5ce2('0x1d'))][(_0x5ce2('0x1e'))]('Cloud\x20Provider\x20not\x20configured');}_0x595d33=_0x3af34a;logger[_0x5ce2('0xc')](util['format'](_0x5ce2('0x34'),_0x3b027b['id']));return sentiment(_0x595d33[_0x5ce2('0x8')],_0x595d33[_0x5ce2('0x9')],_0x5387b2[_0x5ce2('0x22')],_0x3b027b[_0x5ce2('0x17')],_0x5387b2[_0x5ce2('0x23')]);})[_0x5ce2('0xb')](function(_0x495af2){logger[_0x5ce2('0xc')](util[_0x5ce2('0x13')](_0x5ce2('0x2b'),_0x3b027b['id']));return _0x3b027b[_0x5ce2('0x1a')]({'sentiment':_0x495af2['Sentiment'],'sPositive':_0x495af2[_0x5ce2('0x2d')][_0x5ce2('0x2e')],'sNegative':_0x495af2[_0x5ce2('0x2d')][_0x5ce2('0x35')],'sMixed':_0x495af2['SentimentScore'][_0x5ce2('0x36')],'sNeutral':_0x495af2[_0x5ce2('0x2d')][_0x5ce2('0x2f')],'transcribeStatus':_0x5ce2('0x10')});})['then'](function(){logger[_0x5ce2('0xc')](util[_0x5ce2('0x13')](_0x5ce2('0x1b'),_0x3b027b['id']));_0x550fb3();});}})[_0x5ce2('0x37')](function(_0x1029e9){if(_0x1029e9){if(!_0x1029e9['name']||_0x1029e9[_0x5ce2('0x38')]!==_0x5ce2('0x39')){logger[_0x5ce2('0x3a')](util[_0x5ce2('0x13')](_0x5ce2('0x3b'),_0x3b027b['id']),util[_0x5ce2('0x3c')](_0x1029e9,{'showHidden':![],'depth':null}));}}_0x550fb3();});});}function checkTranscribe(){var _0x21c98c;var _0x35bc3c;var _0x1c29af;return db[_0x5ce2('0x3d')]['findAll']({'where':{'transcribeStatus':_0x5ce2('0x3e')}})[_0x5ce2('0xb')](function(_0x1e5a07){if(!_0x1e5a07||!_0x1e5a07['length']){throw new db[(_0x5ce2('0x1d'))]['ValidationError'](_0x5ce2('0x3f'));}_0x21c98c=_0x1e5a07;return db['Setting'][_0x5ce2('0x28')]({'where':{'id':0x1}});})['then'](function(_0x50568c){if(!_0x50568c){throw new db['Sequelize'][(_0x5ce2('0x1e'))](_0x5ce2('0x40'));}_0x35bc3c=_0x50568c;if(!_0x35bc3c[_0x5ce2('0x2')]||!_0x35bc3c[_0x5ce2('0x41')]||!_0x35bc3c[_0x5ce2('0xa')]||!_0x35bc3c[_0x5ce2('0x23')]||!_0x35bc3c[_0x5ce2('0x24')]){throw new db['Sequelize']['ValidationError']('Transcribe\x20not\x20configured');}return db['CloudProvider'][_0x5ce2('0x28')]({'where':{'id':_0x35bc3c['transcribeAccountId']}});})[_0x5ce2('0xb')](function(_0x296ea8){if(!_0x296ea8){throw new db[(_0x5ce2('0x1d'))][(_0x5ce2('0x1e'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x296ea8[_0x5ce2('0x8')]||!_0x296ea8[_0x5ce2('0x9')]){throw new db[(_0x5ce2('0x1d'))][(_0x5ce2('0x1e'))](_0x5ce2('0x2a'));}_0x1c29af=_0x296ea8;var _0x2b5fc5=[];_0x21c98c[_0x5ce2('0x42')](function(_0x568288){_0x2b5fc5[_0x5ce2('0x43')](checkTranscribeJob(_0x568288,_0x35bc3c,_0x1c29af));});return BPromise[_0x5ce2('0x44')](_0x2b5fc5);})[_0x5ce2('0x37')](function(_0x3ddf21){if(_0x3ddf21){if(!_0x3ddf21['name']||_0x3ddf21[_0x5ce2('0x38')]!==_0x5ce2('0x39')){logger['error'](util[_0x5ce2('0x3c')](_0x3ddf21,{'showHidden':![],'depth':null}));}}});}exports[_0x5ce2('0x45')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 24bfefa..db0a4c7 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 _0x439c=['map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','then','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','start','lodash','moment','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','hours','length'];(function(_0x388408,_0x25ccdc){var _0x353cf5=function(_0x898f7c){while(--_0x898f7c){_0x388408['push'](_0x388408['shift']());}};_0x353cf5(++_0x25ccdc);}(_0x439c,0x86));var _0xc439=function(_0x1649c0,_0x2051b5){_0x1649c0=_0x1649c0-0x0;var _0x18b601=_0x439c[_0x1649c0];return _0x18b601;};'use strict';var _=require(_0xc439('0x0'));var moment=require(_0xc439('0x1'));var Redis=require('ioredis');var util=require(_0xc439('0x2'));var config=require(_0xc439('0x3'));var db=require(_0xc439('0x4'))['db'];var logger=require(_0xc439('0x5'))(_0xc439('0x6'));config[_0xc439('0x7')]=_[_0xc439('0x8')](config[_0xc439('0x7')],{'host':_0xc439('0x9'),'port':0x18eb});var io=require(_0xc439('0xa'))(new Redis(config[_0xc439('0x7')]));function closeInteractions(){var _0x2e6a99=[];return db[_0xc439('0xb')][_0xc439('0xc')]({'raw':!![],'attributes':['id',_0xc439('0xd')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xc439('0xe'))}}})['then'](function(_0xab05c8){if(_0xab05c8&&_0xab05c8[_0xc439('0xf')]){_0x2e6a99=_[_0xc439('0x10')](_0xab05c8||[],'id');logger[_0xc439('0x11')](_0xc439('0x12'),_0x2e6a99[_0xc439('0x13')]());return db[_0xc439('0xb')][_0xc439('0x14')]({'closeReason':_0xc439('0x15'),'disposition':_0xc439('0x16'),'closed':!![],'closedAt':moment()['format'](_0xc439('0x17'))},{'where':{'id':_0x2e6a99}});}})[_0xc439('0x18')](function(){if(_0x2e6a99&&_0x2e6a99[_0xc439('0xf')]){logger[_0xc439('0x11')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x2e6a99[_0xc439('0x13')]());for(var _0x2c0505=0x0;_0x2c0505<_0x2e6a99[_0xc439('0xf')];_0x2c0505++){io['emit'](_0xc439('0x19'),{'id':_0x2e6a99[_0x2c0505],'closed':!![]});}}})[_0xc439('0x1a')](function(_0x4d850e){logger[_0xc439('0x1b')](_0xc439('0x1c'),_0x4d850e?util['inspect'](_0x4d850e,{'showHidden':![],'depth':null}):'');});}exports[_0xc439('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x23cd=['findAll','lastMsgAt','subtract','hours','then','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','format','length','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../mysqldb','schedule','defaults','redis','socket.io-emitter','WhatsappInteraction'];(function(_0x554cfb,_0x1b75b1){var _0x78cdba=function(_0x1bab9e){while(--_0x1bab9e){_0x554cfb['push'](_0x554cfb['shift']());}};_0x78cdba(++_0x1b75b1);}(_0x23cd,0x8c));var _0xd23c=function(_0x61ebd8,_0x3fc0ba){_0x61ebd8=_0x61ebd8-0x0;var _0x531f66=_0x23cd[_0x61ebd8];return _0x531f66;};'use strict';var _=require(_0xd23c('0x0'));var moment=require(_0xd23c('0x1'));var Redis=require(_0xd23c('0x2'));var util=require(_0xd23c('0x3'));var config=require('../../config/environment');var db=require(_0xd23c('0x4'))['db'];var logger=require('../logger')(_0xd23c('0x5'));config['redis']=_[_0xd23c('0x6')](config[_0xd23c('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xd23c('0x8'))(new Redis(config[_0xd23c('0x7')]));function closeInteractions(){var _0x3d166e=[];return db[_0xd23c('0x9')][_0xd23c('0xa')]({'raw':!![],'attributes':['id',_0xd23c('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xd23c('0xc')](0x18,_0xd23c('0xd'))}}})[_0xd23c('0xe')](function(_0x220e5d){if(_0x220e5d&&_0x220e5d['length']){_0x3d166e=_['map'](_0x220e5d||[],'id');logger[_0xd23c('0xf')](_0xd23c('0x10'),_0x3d166e[_0xd23c('0x11')]());return db['WhatsappInteraction'][_0xd23c('0x12')]({'closeReason':_0xd23c('0x13'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xd23c('0x14')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x3d166e}});}})['then'](function(){if(_0x3d166e&&_0x3d166e[_0xd23c('0x15')]){logger['info'](_0xd23c('0x16'),_0x3d166e[_0xd23c('0x11')]());for(var _0x87458a=0x0;_0x87458a<_0x3d166e[_0xd23c('0x15')];_0x87458a++){io[_0xd23c('0x17')](_0xd23c('0x18'),{'id':_0x3d166e[_0x87458a],'closed':!![]});}}})[_0xd23c('0x19')](function(_0x19c89c){logger[_0xd23c('0x1a')](_0xd23c('0x1b'),_0x19c89c?util[_0xd23c('0x1c')](_0x19c89c,{'showHidden':![],'depth':null}):'');});}exports[_0xd23c('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 6b8d78a..2e4dd24 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x843f=['CmContact','bulkCreate','log','finished\x20populating','CmHopper','hopper1','hopper2','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','now','@xcally.com','destroy','then'];(function(_0x4fcb37,_0xc5ff25){var _0x3dc093=function(_0x33f251){while(--_0x33f251){_0x4fcb37['push'](_0x4fcb37['shift']());}};_0x3dc093(++_0xc5ff25);}(_0x843f,0x1b7));var _0xf843=function(_0x1efb32,_0x14073f){_0x1efb32=_0x1efb32-0x0;var _0x48adb8=_0x843f[_0x1efb32];return _0x48adb8;};'use strict';var util=require('util');var db=require(_0xf843('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xf843('0x1')]({'id':i,'firstName':_0xf843('0x2')+i,'lastName':_0xf843('0x3')+i,'phone':0xf879fb460+i,'email':_0xf843('0x4')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xf843('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xf843('0x1')]({'id':i,'firstName':_0xf843('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xf843('0x4')+i+_0xf843('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xf843('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xf843('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date['now']()});}db['CmContact'][_0xf843('0x7')]({'where':{}})[_0xf843('0x8')](function(){return db[_0xf843('0x9')][_0xf843('0xa')](contacts);})[_0xf843('0x8')](function(){console[_0xf843('0xb')](_0xf843('0xc'),'contacts1');return db[_0xf843('0xd')]['destroy']({'where':{}});})[_0xf843('0x8')](function(){return db[_0xf843('0xd')][_0xf843('0xa')](hopper);})['then'](function(){console[_0xf843('0xb')]('finished\x20populating',_0xf843('0xe'));return db[_0xf843('0x9')][_0xf843('0xa')](contacts2);})[_0xf843('0x8')](function(){console[_0xf843('0xb')](_0xf843('0xc'),'contacts2');return db[_0xf843('0xd')][_0xf843('0xa')](hopper2);})['then'](function(){console[_0xf843('0xb')]('finished\x20populating',_0xf843('0xf'));})['catch'](function(_0x51dbed){console[_0xf843('0xb')](_0x51dbed);}); \ No newline at end of file +var _0x7a51=['bulkCreate','hopper1','contacts2','hopper2','util','../mysqldb','push','Biondo','innocenzo.biondo','now','Innocenzo','@xcally.com','CmContact','destroy','then','log','finished\x20populating','contacts1','CmHopper'];(function(_0x49cfcc,_0xf15540){var _0x44d1cc=function(_0x20eab9){while(--_0x20eab9){_0x49cfcc['push'](_0x49cfcc['shift']());}};_0x44d1cc(++_0xf15540);}(_0x7a51,0x1a6));var _0x17a5=function(_0xaeb12c,_0x1262f0){_0xaeb12c=_0xaeb12c-0x0;var _0x5a0ae0=_0x7a51[_0xaeb12c];return _0x5a0ae0;};'use strict';var util=require(_0x17a5('0x0'));var db=require(_0x17a5('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x17a5('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x17a5('0x3')+i,'phone':0xf879fb460+i,'email':_0x17a5('0x4')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x17a5('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x17a5('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x17a5('0x5')](),'updatedAt':Date[_0x17a5('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x17a5('0x2')]({'id':i,'firstName':_0x17a5('0x6')+i,'lastName':_0x17a5('0x3')+i,'phone':0xf879fb460+i,'email':_0x17a5('0x4')+i+_0x17a5('0x7')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date['now']()});}db[_0x17a5('0x8')][_0x17a5('0x9')]({'where':{}})[_0x17a5('0xa')](function(){return db[_0x17a5('0x8')]['bulkCreate'](contacts);})[_0x17a5('0xa')](function(){console[_0x17a5('0xb')](_0x17a5('0xc'),_0x17a5('0xd'));return db[_0x17a5('0xe')][_0x17a5('0x9')]({'where':{}});})['then'](function(){return db[_0x17a5('0xe')][_0x17a5('0xf')](hopper);})[_0x17a5('0xa')](function(){console[_0x17a5('0xb')](_0x17a5('0xc'),_0x17a5('0x10'));return db[_0x17a5('0x8')][_0x17a5('0xf')](contacts2);})[_0x17a5('0xa')](function(){console[_0x17a5('0xb')](_0x17a5('0xc'),_0x17a5('0x11'));return db[_0x17a5('0xe')][_0x17a5('0xf')](hopper2);})['then'](function(){console[_0x17a5('0xb')](_0x17a5('0xc'),_0x17a5('0x12'));})['catch'](function(_0x1b0ab7){console[_0x17a5('0xb')](_0x1b0ab7);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 777212c..90ff081 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7671=['password','friend','udp','wss','ulaw','yes','actpass','User','then','log','add\x20user','catch','../mysqldb','format','%s%s','agent','%s%s@xcally.com'];(function(_0x565a21,_0x3a57fd){var _0x2882e5=function(_0x24de84){while(--_0x24de84){_0x565a21['push'](_0x565a21['shift']());}};_0x2882e5(++_0x3a57fd);}(_0x7671,0x1e8));var _0x1767=function(_0x1e07d4,_0x390176){_0x1e07d4=_0x1e07d4-0x0;var _0x3d3a3d=_0x7671[_0x1e07d4];return _0x3d3a3d;};'use strict';var util=require('util');var db=require(_0x1767('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x1767('0x1')](_0x1767('0x2'),'agent',i),'fullname':util[_0x1767('0x1')](_0x1767('0x2'),_0x1767('0x3'),i),'email':util[_0x1767('0x1')](_0x1767('0x4'),_0x1767('0x3'),i),'role':_0x1767('0x3'),'password':_0x1767('0x5'),'internal':0xfa0+i,'type':_0x1767('0x6'),'transport':[_0x1767('0x7'),'ws',_0x1767('0x8')],'disallow':['all'],'allow':[_0x1767('0x9')],'defaultuser':util[_0x1767('0x1')](_0x1767('0x2'),_0x1767('0x3'),i),'encryption':_0x1767('0xa'),'avpf':'yes','force_avp':_0x1767('0xa'),'icesupport':'yes','dtlsenable':_0x1767('0xa'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x1767('0xb'),'callerid':util['format']('\x22%s\x22\x20<%s>',util[_0x1767('0x1')]('%s%s',_0x1767('0x3'),i),0xfa0+i)});}db[_0x1767('0xc')]['bulkCreate'](users)[_0x1767('0xd')](function(){console[_0x1767('0xe')](_0x1767('0xf'));})[_0x1767('0x10')](function(_0x566842){console[_0x1767('0xe')](_0x566842);}); \ No newline at end of file +var _0xc322=['password','friend','udp','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com'];(function(_0x599616,_0x3c3dc6){var _0x568f92=function(_0xc34b2){while(--_0xc34b2){_0x599616['push'](_0x599616['shift']());}};_0x568f92(++_0x3c3dc6);}(_0xc322,0x152));var _0x2c32=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xc322[_0x2bf141];return _0x48277b;};'use strict';var util=require(_0x2c32('0x0'));var db=require(_0x2c32('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x2c32('0x2')]({'name':util[_0x2c32('0x3')](_0x2c32('0x4'),'agent',i),'fullname':util['format'](_0x2c32('0x4'),_0x2c32('0x5'),i),'email':util['format'](_0x2c32('0x6'),'agent',i),'role':_0x2c32('0x5'),'password':_0x2c32('0x7'),'internal':0xfa0+i,'type':_0x2c32('0x8'),'transport':[_0x2c32('0x9'),'ws','wss'],'disallow':[_0x2c32('0xa')],'allow':[_0x2c32('0xb')],'defaultuser':util[_0x2c32('0x3')](_0x2c32('0x4'),'agent',i),'encryption':_0x2c32('0xc'),'avpf':_0x2c32('0xc'),'force_avp':_0x2c32('0xc'),'icesupport':_0x2c32('0xc'),'dtlsenable':_0x2c32('0xc'),'dtlsverify':'no','dtlscertfile':_0x2c32('0xd'),'dtlsprivatekey':_0x2c32('0xe'),'dtlssetup':_0x2c32('0xf'),'callerid':util['format'](_0x2c32('0x10'),util[_0x2c32('0x3')](_0x2c32('0x4'),_0x2c32('0x5'),i),0xfa0+i)});}db[_0x2c32('0x11')][_0x2c32('0x12')](users)[_0x2c32('0x13')](function(){console[_0x2c32('0x14')](_0x2c32('0x15'));})[_0x2c32('0x16')](function(_0x37a9b7){console[_0x2c32('0x14')](_0x37a9b7);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 6442367..d8992b4 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0447=['getWhatsappQueues','all','length','voice','fax','sms','mail','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','removeChatInteractions','emit','user_has_chat_interactions:remove','leave','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','setMaxListeners','request','connection','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','address','disconnect','lodash','util','bluebird','../mysqldb','./environment','Agents','User','name','role','agent','telephone','type','ivr','UserProfileSection','then','autoAssociation','VoiceQueues','FaxQueues','WhatsappQueues','findAll','Telephones','IvrCampaigns','resourceId','map','where','Campaign','format','%s:queue:%s','user:%s','handshake','query','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','include','push','FaxQueue','MailQueue','Trunk','user','voice:outbound','ChatQueues','ChatQueue','SmsQueues','SmsQueue','MailQueues','OpenchannelQueue','WhatsappQueue','getVoiceQueues','getChatQueues','getSmsQueues','getMailQueues'];(function(_0x135d00,_0x23d934){var _0x1e1b1b=function(_0x426069){while(--_0x426069){_0x135d00['push'](_0x135d00['shift']());}};_0x1e1b1b(++_0x23d934);}(_0x0447,0x8b));var _0x7044=function(_0x4d95c4,_0x2248cb){_0x4d95c4=_0x4d95c4-0x0;var _0x4fe1bf=_0x0447[_0x4d95c4];return _0x4fe1bf;};'use strict';var _=require(_0x7044('0x0'));var util=require(_0x7044('0x1'));var BPromise=require(_0x7044('0x2'));var db=require(_0x7044('0x3'))['db'];var config=require(_0x7044('0x4'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0x7044('0x5'),'model':db[_0x7044('0x6')],'attributes':['id',_0x7044('0x7'),_0x7044('0x8')],'raw':!![],'where':{'role':_0x7044('0x9')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x7044('0x7')],'where':{'role':_0x7044('0xa')}};var queryTrunks={'raw':!![],'attributes':['id',_0x7044('0x7')]};var queryAgents={'raw':!![],'attributes':['id',_0x7044('0x7')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x7044('0x7'),_0x7044('0xb')],'where':{'type':_0x7044('0xc')}};function getAssociatedResources(_0x42aa4,_0x4ee462,_0x41616d){return db[_0x7044('0xd')]['findOne']({'where':{'name':_0x42aa4,'userProfileId':_0x4ee462},'raw':!![]})[_0x7044('0xe')](function(_0xf38837){if(_0xf38837){if(_0xf38837[_0x7044('0xf')]){switch(_0x42aa4){case _0x7044('0x10'):case'ChatQueues':case _0x7044('0x11'):case'SmsQueues':case'MailQueues':case'OpenchannelQueues':case _0x7044('0x12'):return db[_0x41616d][_0x7044('0x13')](queryQueues);case _0x7044('0x14'):return db[_0x41616d][_0x7044('0x13')](queryTelephones);case'Trunks':return db[_0x41616d]['findAll'](queryTrunks);case _0x7044('0x15'):return db[_0x41616d][_0x7044('0x13')](queryCampaigns);}}else{return db['UserProfileResource']['findAll']({'attributes':[_0x7044('0x16')],'where':{'sectionId':_0xf38837['id']},'raw':!![]})[_0x7044('0xe')](function(_0x79f418){if(_0x79f418){var _0x35769e={'where':{'id':_[_0x7044('0x17')](_0x79f418,_0x7044('0x16'))},'raw':!![]};switch(_0x41616d){case'User':_0x35769e[_0x7044('0x18')][_0x7044('0x8')]=_0x7044('0xa');break;case _0x7044('0x19'):_0x35769e[_0x7044('0x18')][_0x7044('0xb')]='ivr';break;}return db[_0x41616d][_0x7044('0x13')](_0x35769e);}else{return[];}});}}else{return[];}})[_0x7044('0xe')](function(_0x1eeb45){return _0x1eeb45;});}function joinOrLeaveQueues(_0x4e7285,_0x4bbdb3,_0x543be8,_0xced6e4){_0x4e7285[_0x4bbdb3](util[_0x7044('0x1a')](_0x7044('0x1b'),_0x543be8,_0xced6e4[_0x7044('0x7')]));if(_0xced6e4[_0x7044('0x5')]){for(var _0x4faffe=0x0;_0x4faffe<_0xced6e4[_0x7044('0x5')]['length'];_0x4faffe+=0x1){_0x4e7285[_0x4bbdb3](util['format'](_0x7044('0x1c'),_0xced6e4[_0x7044('0x5')][_0x4faffe][_0x7044('0x7')]));}}}function joinOrLeave(_0x294915,_0x39d85e,_0x105da8){var _0x41a079;if(_0x294915[_0x7044('0x1d')][_0x7044('0x1e')]['id']){db['User']['find']({'attributes':['id',_0x7044('0x7'),_0x7044('0x8'),_0x7044('0x1f')],'where':{'id':_0x294915[_0x7044('0x1d')][_0x7044('0x1e')]['id']},'include':[{'model':db[_0x7044('0x20')],'as':_0x7044('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0x7044('0x22')],'as':_0x7044('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x7044('0x24')],'as':_0x7044('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x7044('0x26')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x7044('0x27')],'as':_0x7044('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x7044('0x29')],'as':_0x7044('0x2a'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x2261af){if(_0x2261af){_0x41a079=_0x2261af;_0x294915[_0x39d85e](util['format']('user:%s',_0x2261af['name']));var _0x29501a=[];switch(_0x2261af['role']){case _0x7044('0x2b'):_0x294915[_0x39d85e](_0x7044('0x2c'));_0x294915[_0x39d85e]('voice:outbound');if(queryQueues['hasOwnProperty'](_0x7044('0x2d'))){delete queryQueues['include'];}_0x29501a['push'](db['VoiceQueue'][_0x7044('0x13')](queryQueues));_0x29501a[_0x7044('0x2e')](db['ChatQueue'][_0x7044('0x13')](queryQueues));_0x29501a[_0x7044('0x2e')](db[_0x7044('0x2f')][_0x7044('0x13')](queryQueues));_0x29501a[_0x7044('0x2e')](db['SmsQueue'][_0x7044('0x13')](queryQueues));_0x29501a[_0x7044('0x2e')](db[_0x7044('0x30')][_0x7044('0x13')](queryQueues));_0x29501a[_0x7044('0x2e')](db['OpenchannelQueue'][_0x7044('0x13')](queryQueues));_0x29501a[_0x7044('0x2e')](db['WhatsappQueue'][_0x7044('0x13')](queryQueues));_0x29501a[_0x7044('0x2e')](db[_0x7044('0x6')][_0x7044('0x13')](queryTelephones));_0x29501a[_0x7044('0x2e')](db[_0x7044('0x31')]['findAll'](queryTrunks));_0x29501a['push'](db[_0x7044('0x19')][_0x7044('0x13')](queryCampaigns));_0x29501a['push'](db[_0x7044('0x6')][_0x7044('0x13')](queryAgents));break;case _0x7044('0x32'):_0x294915[_0x39d85e](_0x7044('0x2c'));_0x294915[_0x39d85e](_0x7044('0x33'));_0x29501a[_0x7044('0x2e')](getAssociatedResources(_0x7044('0x10'),_0x2261af[_0x7044('0x1f')],'VoiceQueue'));_0x29501a['push'](getAssociatedResources(_0x7044('0x34'),_0x2261af[_0x7044('0x1f')],_0x7044('0x35')));_0x29501a[_0x7044('0x2e')](getAssociatedResources(_0x7044('0x11'),_0x2261af[_0x7044('0x1f')],_0x7044('0x2f')));_0x29501a['push'](getAssociatedResources(_0x7044('0x36'),_0x2261af[_0x7044('0x1f')],_0x7044('0x37')));_0x29501a['push'](getAssociatedResources(_0x7044('0x38'),_0x2261af['userProfileId'],'MailQueue'));_0x29501a[_0x7044('0x2e')](getAssociatedResources('OpenchannelQueues',_0x2261af[_0x7044('0x1f')],_0x7044('0x39')));_0x29501a[_0x7044('0x2e')](getAssociatedResources(_0x7044('0x12'),_0x2261af[_0x7044('0x1f')],_0x7044('0x3a')));_0x29501a[_0x7044('0x2e')](getAssociatedResources(_0x7044('0x14'),_0x2261af[_0x7044('0x1f')],_0x7044('0x6')));_0x29501a['push'](getAssociatedResources('Trunks',_0x2261af['userProfileId'],_0x7044('0x31')));_0x29501a[_0x7044('0x2e')](getAssociatedResources(_0x7044('0x15'),_0x2261af[_0x7044('0x1f')],'Campaign'));_0x29501a['push'](db['User'][_0x7044('0x13')](queryAgents));break;case _0x7044('0x9'):_0x294915[_0x39d85e](_0x7044('0x2c'));_0x294915[_0x39d85e](_0x7044('0x33'));_0x29501a[_0x7044('0x2e')](_0x2261af[_0x7044('0x3b')]({'attributes':['id',_0x7044('0x7')]}));_0x29501a[_0x7044('0x2e')](_0x2261af[_0x7044('0x3c')]({'attributes':['id','name']}));_0x29501a['push'](_0x2261af['getFaxQueues']({'attributes':['id',_0x7044('0x7')]}));_0x29501a[_0x7044('0x2e')](_0x2261af[_0x7044('0x3d')]({'attributes':['id',_0x7044('0x7')]}));_0x29501a[_0x7044('0x2e')](_0x2261af[_0x7044('0x3e')]({'attributes':['id',_0x7044('0x7')]}));_0x29501a['push'](_0x2261af['getOpenchannelQueues']({'attributes':['id',_0x7044('0x7')]}));_0x29501a[_0x7044('0x2e')](_0x2261af[_0x7044('0x3f')]({'attributes':['id',_0x7044('0x7')]}));break;}return BPromise[_0x7044('0x40')](_0x29501a);}})[_0x7044('0xe')](function(_0x4e4d17){if(_0x4e4d17&&_0x4e4d17['length']){for(var _0x52514c=0x0;_0x52514c<_0x4e4d17[_0x7044('0x41')];_0x52514c+=0x1){for(var _0x45e1da=0x0;_0x45e1da<_0x4e4d17[_0x52514c][_0x7044('0x41')];_0x45e1da+=0x1){switch(_0x52514c){case 0x0:joinOrLeaveQueues(_0x294915,_0x39d85e,_0x7044('0x42'),_0x4e4d17[_0x52514c][_0x45e1da]);break;case 0x1:joinOrLeaveQueues(_0x294915,_0x39d85e,'chat',_0x4e4d17[_0x52514c][_0x45e1da]);break;case 0x2:joinOrLeaveQueues(_0x294915,_0x39d85e,_0x7044('0x43'),_0x4e4d17[_0x52514c][_0x45e1da]);break;case 0x3:joinOrLeaveQueues(_0x294915,_0x39d85e,_0x7044('0x44'),_0x4e4d17[_0x52514c][_0x45e1da]);break;case 0x4:joinOrLeaveQueues(_0x294915,_0x39d85e,_0x7044('0x45'),_0x4e4d17[_0x52514c][_0x45e1da]);break;case 0x5:joinOrLeaveQueues(_0x294915,_0x39d85e,'openchannel',_0x4e4d17[_0x52514c][_0x45e1da]);break;case 0x6:joinOrLeaveQueues(_0x294915,_0x39d85e,_0x7044('0x46'),_0x4e4d17[_0x52514c][_0x45e1da]);break;case 0x7:if(_0x41a079[_0x7044('0x8')]!==_0x7044('0x9'))_0x294915[_0x39d85e](util['format'](_0x7044('0x47'),_0x4e4d17[_0x52514c][_0x45e1da][_0x7044('0x7')]));break;case 0x8:if(_0x41a079[_0x7044('0x8')]!==_0x7044('0x9'))_0x294915[_0x39d85e](util['format'](_0x7044('0x48'),_0x4e4d17[_0x52514c][_0x45e1da][_0x7044('0x7')]));break;case 0x9:if(_0x41a079['role']!==_0x7044('0x9'))_0x294915[_0x39d85e](util[_0x7044('0x1a')](_0x7044('0x49'),_0x4e4d17[_0x52514c][_0x45e1da][_0x7044('0xb')],_0x4e4d17[_0x52514c][_0x45e1da][_0x7044('0x7')]));break;case 0xa:_0x294915[_0x39d85e](util['format'](_0x7044('0x1c'),_0x4e4d17[_0x52514c][_0x45e1da][_0x7044('0x7')]));break;}}}}})['then'](function(){if(_0x39d85e==='leave'){var _0x1e4b69=_[_0x7044('0x17')](_0x41a079[_0x7044('0x21')],'id');return _0x41a079[_0x7044('0x4a')](_0x1e4b69)['then'](function(){for(var _0x1ae35d=0x0;_0x1ae35d<_0x1e4b69[_0x7044('0x41')];_0x1ae35d+=0x1){_0x105da8[_0x7044('0x4b')](_0x7044('0x4c'),{'ChatInteractionId':Number(_0x1e4b69[_0x1ae35d]),'UserId':Number(_0x41a079['id'])});}});}})[_0x7044('0xe')](function(){if(_0x39d85e===_0x7044('0x4d')){var _0x344f38=_[_0x7044('0x17')](_0x41a079[_0x7044('0x23')],'id');return _0x41a079[_0x7044('0x4e')](_0x344f38)[_0x7044('0xe')](function(){for(var _0xd0e940=0x0;_0xd0e940<_0x344f38[_0x7044('0x41')];_0xd0e940+=0x1){_0x105da8[_0x7044('0x4b')](_0x7044('0x4f'),{'MailInteractionId':Number(_0x344f38[_0xd0e940]),'UserId':Number(_0x41a079['id'])});}});}})['then'](function(){if(_0x39d85e==='leave'){var _0x4dbd9c=_[_0x7044('0x17')](_0x41a079[_0x7044('0x25')],'id');return _0x41a079[_0x7044('0x50')](_0x4dbd9c)[_0x7044('0xe')](function(){for(var _0x11d41f=0x0;_0x11d41f<_0x4dbd9c[_0x7044('0x41')];_0x11d41f+=0x1){_0x105da8['emit'](_0x7044('0x51'),{'FaxInteractionId':Number(_0x4dbd9c[_0x11d41f]),'UserId':Number(_0x41a079['id'])});}});}})['then'](function(){if(_0x39d85e===_0x7044('0x4d')){var _0x394534=_[_0x7044('0x17')](_0x41a079[_0x7044('0x52')],'id');return _0x41a079[_0x7044('0x53')](_0x394534)[_0x7044('0xe')](function(){for(var _0x505d42=0x0;_0x505d42<_0x394534['length'];_0x505d42+=0x1){_0x105da8[_0x7044('0x4b')](_0x7044('0x54'),{'SmsInteractionId':Number(_0x394534[_0x505d42]),'UserId':Number(_0x41a079['id'])});}});}})[_0x7044('0xe')](function(){if(_0x39d85e===_0x7044('0x4d')){var _0x1346a0=_[_0x7044('0x17')](_0x41a079[_0x7044('0x28')],'id');return _0x41a079['removeOpenchannelInteractions'](_0x1346a0)[_0x7044('0xe')](function(){for(var _0x45f689=0x0;_0x45f689<_0x1346a0['length'];_0x45f689+=0x1){_0x105da8[_0x7044('0x4b')](_0x7044('0x55'),{'OpenchannelInteractionId':Number(_0x1346a0[_0x45f689]),'UserId':Number(_0x41a079['id'])});}});}})[_0x7044('0xe')](function(){if(_0x39d85e===_0x7044('0x4d')){var _0x1dc5f9=_['map'](_0x41a079['WhatsappInteractions'],'id');return _0x41a079[_0x7044('0x56')](_0x1dc5f9)[_0x7044('0xe')](function(){for(var _0x5b076e=0x0;_0x5b076e<_0x1dc5f9[_0x7044('0x41')];_0x5b076e+=0x1){_0x105da8[_0x7044('0x4b')](_0x7044('0x57'),{'WhatsappInteractionId':Number(_0x1dc5f9[_0x5b076e]),'UserId':Number(_0x41a079['id'])});}});}})[_0x7044('0x58')](function(_0x42d8c0){_0x294915[_0x7044('0x59')](_0x42d8c0);});}}function onDisconnect(_0x5e3fa4,_0x46b13d){joinOrLeave(_0x5e3fa4,_0x7044('0x4d'),_0x46b13d);}function onConnect(_0x20e207){joinOrLeave(_0x20e207,_0x7044('0x5a'));}exports['default']=function(_0x37485b){_0x37485b['on']('connection',function(_0x304bdd){_0x304bdd[_0x7044('0x5b')](0x0);_0x304bdd['address']=_0x304bdd[_0x7044('0x5c')][_0x7044('0x5d')][_0x7044('0x5e')]+':'+_0x304bdd[_0x7044('0x5c')][_0x7044('0x5d')][_0x7044('0x5f')];_0x304bdd[_0x7044('0x60')]=new Date();_0x304bdd[_0x7044('0x59')]=function(_0x471859){console[_0x7044('0x59')](_0x7044('0x61')+_0x304bdd[_0x7044('0x62')][_0x7044('0x7')]+'['+_0x304bdd[_0x7044('0x63')]+']',_0x471859);};_0x304bdd['on'](_0x7044('0x64'),function(){onDisconnect(_0x304bdd,_0x37485b);_0x304bdd['log']('DISCONNECTED');});onConnect(_0x304bdd);_0x304bdd[_0x7044('0x59')]('CONNECTED');});}; \ No newline at end of file +var _0xc43c=['SocketIO\x20','nsp','disconnect','CONNECTED','lodash','util','bluebird','Agents','agent','name','telephone','type','ivr','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','Telephones','findAll','Trunks','UserProfileResource','resourceId','map','User','role','Campaign','%s:queue:%s','format','handshake','query','find','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','user:%s','admin','voice:inbound','voice:outbound','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','userProfileId','IvrCampaigns','getChatQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','length','chat','fax','sms','mail','whatsapp','telephone:%s','trunk:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','FaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','setMaxListeners','address','request','connection','remoteAddress','remotePort','connectedAt'];(function(_0x3ec83e,_0x130d8f){var _0x555606=function(_0x178f9e){while(--_0x178f9e){_0x3ec83e['push'](_0x3ec83e['shift']());}};_0x555606(++_0x130d8f);}(_0xc43c,0xd4));var _0xcc43=function(_0x2e130b,_0x4fcc15){_0x2e130b=_0x2e130b-0x0;var _0x43999b=_0xc43c[_0x2e130b];return _0x43999b;};'use strict';var _=require(_0xcc43('0x0'));var util=require(_0xcc43('0x1'));var BPromise=require(_0xcc43('0x2'));var db=require('../mysqldb')['db'];var config=require('./environment');var queryQueues={'attributes':['id','name'],'include':[{'as':_0xcc43('0x3'),'model':db['User'],'attributes':['id','name','role'],'raw':!![],'where':{'role':_0xcc43('0x4')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xcc43('0x5')],'where':{'role':_0xcc43('0x6')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0xcc43('0x5')],'where':{'role':_0xcc43('0x4')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xcc43('0x5'),_0xcc43('0x7')],'where':{'type':_0xcc43('0x8')}};function getAssociatedResources(_0x327c4e,_0x3d0462,_0xd311b1){return db['UserProfileSection'][_0xcc43('0x9')]({'where':{'name':_0x327c4e,'userProfileId':_0x3d0462},'raw':!![]})[_0xcc43('0xa')](function(_0x2656bc){if(_0x2656bc){if(_0x2656bc[_0xcc43('0xb')]){switch(_0x327c4e){case _0xcc43('0xc'):case _0xcc43('0xd'):case _0xcc43('0xe'):case _0xcc43('0xf'):case _0xcc43('0x10'):case _0xcc43('0x11'):case _0xcc43('0x12'):return db[_0xd311b1]['findAll'](queryQueues);case _0xcc43('0x13'):return db[_0xd311b1][_0xcc43('0x14')](queryTelephones);case _0xcc43('0x15'):return db[_0xd311b1][_0xcc43('0x14')](queryTrunks);case'IvrCampaigns':return db[_0xd311b1][_0xcc43('0x14')](queryCampaigns);}}else{return db[_0xcc43('0x16')][_0xcc43('0x14')]({'attributes':[_0xcc43('0x17')],'where':{'sectionId':_0x2656bc['id']},'raw':!![]})[_0xcc43('0xa')](function(_0x538d67){if(_0x538d67){var _0x2e2a21={'where':{'id':_[_0xcc43('0x18')](_0x538d67,'resourceId')},'raw':!![]};switch(_0xd311b1){case _0xcc43('0x19'):_0x2e2a21['where'][_0xcc43('0x1a')]=_0xcc43('0x6');break;case _0xcc43('0x1b'):_0x2e2a21['where'][_0xcc43('0x7')]=_0xcc43('0x8');break;}return db[_0xd311b1][_0xcc43('0x14')](_0x2e2a21);}else{return[];}});}}else{return[];}})[_0xcc43('0xa')](function(_0x485d14){return _0x485d14;});}function joinOrLeaveQueues(_0x2d526e,_0x42e028,_0x57bd2d,_0x7ec240){_0x2d526e[_0x42e028](util['format'](_0xcc43('0x1c'),_0x57bd2d,_0x7ec240['name']));if(_0x7ec240[_0xcc43('0x3')]){for(var _0x2a604e=0x0;_0x2a604e<_0x7ec240[_0xcc43('0x3')]['length'];_0x2a604e+=0x1){_0x2d526e[_0x42e028](util[_0xcc43('0x1d')]('user:%s',_0x7ec240[_0xcc43('0x3')][_0x2a604e][_0xcc43('0x5')]));}}}function joinOrLeave(_0x3fd749,_0x948783,_0x36b655){var _0x5b9195;if(_0x3fd749[_0xcc43('0x1e')][_0xcc43('0x1f')]['id']){db['User'][_0xcc43('0x20')]({'attributes':['id',_0xcc43('0x5'),_0xcc43('0x1a'),'userProfileId'],'where':{'id':_0x3fd749[_0xcc43('0x1e')]['query']['id']},'include':[{'model':db[_0xcc43('0x21')],'as':_0xcc43('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0xcc43('0x23')],'as':_0xcc43('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xcc43('0x25')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xcc43('0x26')],'as':_0xcc43('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xcc43('0x28')],'as':_0xcc43('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0xcc43('0x2a')],'as':_0xcc43('0x2b'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x17acce){if(_0x17acce){_0x5b9195=_0x17acce;_0x3fd749[_0x948783](util[_0xcc43('0x1d')](_0xcc43('0x2c'),_0x17acce[_0xcc43('0x5')]));var _0x532526=[];switch(_0x17acce[_0xcc43('0x1a')]){case _0xcc43('0x2d'):_0x3fd749[_0x948783](_0xcc43('0x2e'));_0x3fd749[_0x948783](_0xcc43('0x2f'));if(queryQueues['hasOwnProperty'](_0xcc43('0x30'))){delete queryQueues[_0xcc43('0x30')];}_0x532526[_0xcc43('0x31')](db[_0xcc43('0x32')]['findAll'](queryQueues));_0x532526['push'](db[_0xcc43('0x33')][_0xcc43('0x14')](queryQueues));_0x532526[_0xcc43('0x31')](db[_0xcc43('0x34')][_0xcc43('0x14')](queryQueues));_0x532526[_0xcc43('0x31')](db[_0xcc43('0x35')][_0xcc43('0x14')](queryQueues));_0x532526['push'](db[_0xcc43('0x36')]['findAll'](queryQueues));_0x532526['push'](db[_0xcc43('0x37')][_0xcc43('0x14')](queryQueues));_0x532526[_0xcc43('0x31')](db[_0xcc43('0x38')][_0xcc43('0x14')](queryQueues));_0x532526['push'](db['User']['findAll'](queryTelephones));_0x532526['push'](db[_0xcc43('0x39')][_0xcc43('0x14')](queryTrunks));_0x532526[_0xcc43('0x31')](db['Campaign'][_0xcc43('0x14')](queryCampaigns));_0x532526[_0xcc43('0x31')](db[_0xcc43('0x19')]['findAll'](queryAgents));break;case _0xcc43('0x3a'):_0x3fd749[_0x948783](_0xcc43('0x2e'));_0x3fd749[_0x948783]('voice:outbound');_0x532526[_0xcc43('0x31')](getAssociatedResources(_0xcc43('0xc'),_0x17acce[_0xcc43('0x3b')],_0xcc43('0x32')));_0x532526[_0xcc43('0x31')](getAssociatedResources(_0xcc43('0xd'),_0x17acce[_0xcc43('0x3b')],_0xcc43('0x33')));_0x532526[_0xcc43('0x31')](getAssociatedResources(_0xcc43('0xe'),_0x17acce[_0xcc43('0x3b')],_0xcc43('0x34')));_0x532526[_0xcc43('0x31')](getAssociatedResources(_0xcc43('0xf'),_0x17acce['userProfileId'],_0xcc43('0x35')));_0x532526[_0xcc43('0x31')](getAssociatedResources('MailQueues',_0x17acce[_0xcc43('0x3b')],'MailQueue'));_0x532526[_0xcc43('0x31')](getAssociatedResources(_0xcc43('0x11'),_0x17acce[_0xcc43('0x3b')],_0xcc43('0x37')));_0x532526[_0xcc43('0x31')](getAssociatedResources(_0xcc43('0x12'),_0x17acce[_0xcc43('0x3b')],_0xcc43('0x38')));_0x532526['push'](getAssociatedResources('Telephones',_0x17acce['userProfileId'],_0xcc43('0x19')));_0x532526[_0xcc43('0x31')](getAssociatedResources(_0xcc43('0x15'),_0x17acce[_0xcc43('0x3b')],'Trunk'));_0x532526[_0xcc43('0x31')](getAssociatedResources(_0xcc43('0x3c'),_0x17acce[_0xcc43('0x3b')],'Campaign'));_0x532526['push'](db[_0xcc43('0x19')][_0xcc43('0x14')](queryAgents));break;case _0xcc43('0x4'):_0x3fd749[_0x948783](_0xcc43('0x2e'));_0x3fd749[_0x948783]('voice:outbound');_0x532526[_0xcc43('0x31')](_0x17acce['getVoiceQueues']({'attributes':['id','name']}));_0x532526[_0xcc43('0x31')](_0x17acce[_0xcc43('0x3d')]({'attributes':['id',_0xcc43('0x5')]}));_0x532526[_0xcc43('0x31')](_0x17acce['getFaxQueues']({'attributes':['id','name']}));_0x532526[_0xcc43('0x31')](_0x17acce[_0xcc43('0x3e')]({'attributes':['id',_0xcc43('0x5')]}));_0x532526[_0xcc43('0x31')](_0x17acce[_0xcc43('0x3f')]({'attributes':['id',_0xcc43('0x5')]}));_0x532526[_0xcc43('0x31')](_0x17acce[_0xcc43('0x40')]({'attributes':['id',_0xcc43('0x5')]}));_0x532526[_0xcc43('0x31')](_0x17acce[_0xcc43('0x41')]({'attributes':['id',_0xcc43('0x5')]}));break;}return BPromise[_0xcc43('0x42')](_0x532526);}})[_0xcc43('0xa')](function(_0x318ca7){if(_0x318ca7&&_0x318ca7[_0xcc43('0x43')]){for(var _0x15b6a5=0x0;_0x15b6a5<_0x318ca7[_0xcc43('0x43')];_0x15b6a5+=0x1){for(var _0x5b04eb=0x0;_0x5b04eb<_0x318ca7[_0x15b6a5][_0xcc43('0x43')];_0x5b04eb+=0x1){switch(_0x15b6a5){case 0x0:joinOrLeaveQueues(_0x3fd749,_0x948783,'voice',_0x318ca7[_0x15b6a5][_0x5b04eb]);break;case 0x1:joinOrLeaveQueues(_0x3fd749,_0x948783,_0xcc43('0x44'),_0x318ca7[_0x15b6a5][_0x5b04eb]);break;case 0x2:joinOrLeaveQueues(_0x3fd749,_0x948783,_0xcc43('0x45'),_0x318ca7[_0x15b6a5][_0x5b04eb]);break;case 0x3:joinOrLeaveQueues(_0x3fd749,_0x948783,_0xcc43('0x46'),_0x318ca7[_0x15b6a5][_0x5b04eb]);break;case 0x4:joinOrLeaveQueues(_0x3fd749,_0x948783,_0xcc43('0x47'),_0x318ca7[_0x15b6a5][_0x5b04eb]);break;case 0x5:joinOrLeaveQueues(_0x3fd749,_0x948783,'openchannel',_0x318ca7[_0x15b6a5][_0x5b04eb]);break;case 0x6:joinOrLeaveQueues(_0x3fd749,_0x948783,_0xcc43('0x48'),_0x318ca7[_0x15b6a5][_0x5b04eb]);break;case 0x7:if(_0x5b9195[_0xcc43('0x1a')]!=='agent')_0x3fd749[_0x948783](util[_0xcc43('0x1d')](_0xcc43('0x49'),_0x318ca7[_0x15b6a5][_0x5b04eb][_0xcc43('0x5')]));break;case 0x8:if(_0x5b9195[_0xcc43('0x1a')]!==_0xcc43('0x4'))_0x3fd749[_0x948783](util[_0xcc43('0x1d')](_0xcc43('0x4a'),_0x318ca7[_0x15b6a5][_0x5b04eb][_0xcc43('0x5')]));break;case 0x9:if(_0x5b9195[_0xcc43('0x1a')]!==_0xcc43('0x4'))_0x3fd749[_0x948783](util[_0xcc43('0x1d')]('campaign:%s:%s',_0x318ca7[_0x15b6a5][_0x5b04eb][_0xcc43('0x7')],_0x318ca7[_0x15b6a5][_0x5b04eb][_0xcc43('0x5')]));break;case 0xa:_0x3fd749[_0x948783](util['format'](_0xcc43('0x2c'),_0x318ca7[_0x15b6a5][_0x5b04eb][_0xcc43('0x5')]));break;}}}}})[_0xcc43('0xa')](function(){if(_0x948783===_0xcc43('0x4b')){var _0x3f00e6=_['map'](_0x5b9195[_0xcc43('0x22')],'id');return _0x5b9195[_0xcc43('0x4c')](_0x3f00e6)[_0xcc43('0xa')](function(){for(var _0x1c8491=0x0;_0x1c8491<_0x3f00e6[_0xcc43('0x43')];_0x1c8491+=0x1){_0x36b655[_0xcc43('0x4d')](_0xcc43('0x4e'),{'ChatInteractionId':Number(_0x3f00e6[_0x1c8491]),'UserId':Number(_0x5b9195['id'])});}});}})[_0xcc43('0xa')](function(){if(_0x948783===_0xcc43('0x4b')){var _0x3e2398=_[_0xcc43('0x18')](_0x5b9195[_0xcc43('0x24')],'id');return _0x5b9195[_0xcc43('0x4f')](_0x3e2398)['then'](function(){for(var _0x395c76=0x0;_0x395c76<_0x3e2398['length'];_0x395c76+=0x1){_0x36b655[_0xcc43('0x4d')](_0xcc43('0x50'),{'MailInteractionId':Number(_0x3e2398[_0x395c76]),'UserId':Number(_0x5b9195['id'])});}});}})[_0xcc43('0xa')](function(){if(_0x948783===_0xcc43('0x4b')){var _0x39f9bd=_['map'](_0x5b9195[_0xcc43('0x51')],'id');return _0x5b9195['removeFaxInteractions'](_0x39f9bd)[_0xcc43('0xa')](function(){for(var _0x46528c=0x0;_0x46528c<_0x39f9bd[_0xcc43('0x43')];_0x46528c+=0x1){_0x36b655[_0xcc43('0x4d')](_0xcc43('0x52'),{'FaxInteractionId':Number(_0x39f9bd[_0x46528c]),'UserId':Number(_0x5b9195['id'])});}});}})[_0xcc43('0xa')](function(){if(_0x948783===_0xcc43('0x4b')){var _0x3ec04b=_[_0xcc43('0x18')](_0x5b9195[_0xcc43('0x27')],'id');return _0x5b9195[_0xcc43('0x53')](_0x3ec04b)[_0xcc43('0xa')](function(){for(var _0x12c739=0x0;_0x12c739<_0x3ec04b[_0xcc43('0x43')];_0x12c739+=0x1){_0x36b655[_0xcc43('0x4d')](_0xcc43('0x54'),{'SmsInteractionId':Number(_0x3ec04b[_0x12c739]),'UserId':Number(_0x5b9195['id'])});}});}})[_0xcc43('0xa')](function(){if(_0x948783==='leave'){var _0x107394=_[_0xcc43('0x18')](_0x5b9195[_0xcc43('0x29')],'id');return _0x5b9195[_0xcc43('0x55')](_0x107394)[_0xcc43('0xa')](function(){for(var _0x44fc66=0x0;_0x44fc66<_0x107394[_0xcc43('0x43')];_0x44fc66+=0x1){_0x36b655[_0xcc43('0x4d')](_0xcc43('0x56'),{'OpenchannelInteractionId':Number(_0x107394[_0x44fc66]),'UserId':Number(_0x5b9195['id'])});}});}})['then'](function(){if(_0x948783===_0xcc43('0x4b')){var _0x54acee=_['map'](_0x5b9195[_0xcc43('0x2b')],'id');return _0x5b9195[_0xcc43('0x57')](_0x54acee)[_0xcc43('0xa')](function(){for(var _0x11c82b=0x0;_0x11c82b<_0x54acee[_0xcc43('0x43')];_0x11c82b+=0x1){_0x36b655['emit'](_0xcc43('0x58'),{'WhatsappInteractionId':Number(_0x54acee[_0x11c82b]),'UserId':Number(_0x5b9195['id'])});}});}})[_0xcc43('0x59')](function(_0xc3fbf7){_0x3fd749[_0xcc43('0x5a')](_0xc3fbf7);});}}function onDisconnect(_0x133ab9,_0x151338){joinOrLeave(_0x133ab9,_0xcc43('0x4b'),_0x151338);}function onConnect(_0x56d6b5){joinOrLeave(_0x56d6b5,_0xcc43('0x5b'));}exports[_0xcc43('0x5c')]=function(_0x19520f){_0x19520f['on']('connection',function(_0x274896){_0x274896[_0xcc43('0x5d')](0x0);_0x274896[_0xcc43('0x5e')]=_0x274896[_0xcc43('0x5f')][_0xcc43('0x60')][_0xcc43('0x61')]+':'+_0x274896['request']['connection'][_0xcc43('0x62')];_0x274896[_0xcc43('0x63')]=new Date();_0x274896[_0xcc43('0x5a')]=function(_0x27c689){console['log'](_0xcc43('0x64')+_0x274896[_0xcc43('0x65')]['name']+'['+_0x274896[_0xcc43('0x5e')]+']',_0x27c689);};_0x274896['on'](_0xcc43('0x66'),function(){onDisconnect(_0x274896,_0x19520f);_0x274896[_0xcc43('0x5a')]('DISCONNECTED');});onConnect(_0x274896);_0x274896[_0xcc43('0x5a')](_0xcc43('0x67'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 1229476..6b4dbe3 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 _0xf1c4=['channel','event','query','Sequelize','QueryTypes','SELECT','contact','User','find','UserId','fullname','email','internal','interface','SIP/%s','name','agent','incomingmessage','get','opened','ContactId','sequelize','changed','closed','length','hasOwnProperty','hook','callback','condition','util','../../mysqldb','../logger','triggers','lodash','client','http','ChatInteraction','afterCreate','Chat','afterUpdate','closedinteraction','ChatMessage','newmessage','SmsInteraction','Sms','Whatsapp','newinteraction','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','OpenchannelInteraction','Openchannel','OpenchannelMessage','EventManager','then','info','Trigger,\x20%s','error','code','catch'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xf1c4,0x19d));var _0x4f1c=function(_0x12c0f7,_0x2730ce){_0x12c0f7=_0x12c0f7-0x0;var _0x1b34d4=_0xf1c4[_0x12c0f7];return _0x1b34d4;};'use strict';var util=require(_0x4f1c('0x0'));var db=require(_0x4f1c('0x1'))['db'];var jayson=require('jayson/promise');var logger=require(_0x4f1c('0x2'))(_0x4f1c('0x3'));var _=require(_0x4f1c('0x4'));var client=jayson[_0x4f1c('0x5')][_0x4f1c('0x6')]({'port':0x232a});var triggers=[{'channel':'Chat','model':_0x4f1c('0x7'),'event':_0x4f1c('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x4f1c('0x9'),'model':_0x4f1c('0x7'),'event':_0x4f1c('0xa'),'condition':_0x4f1c('0xb'),'callback':afterUpdate},{'channel':'Chat','model':_0x4f1c('0xc'),'event':'afterCreate','condition':_0x4f1c('0xd'),'callback':afterCreateMessage},{'channel':'Sms','model':_0x4f1c('0xe'),'event':_0x4f1c('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x4f1c('0xf'),'model':_0x4f1c('0xe'),'event':_0x4f1c('0xa'),'condition':_0x4f1c('0xb'),'callback':afterUpdate},{'channel':'Sms','model':'SmsMessage','event':'afterCreate','condition':_0x4f1c('0xd'),'callback':afterCreateMessage},{'channel':_0x4f1c('0x10'),'model':'WhatsappInteraction','event':_0x4f1c('0x8'),'condition':_0x4f1c('0x11'),'callback':afterCreate},{'channel':_0x4f1c('0x10'),'model':_0x4f1c('0x12'),'event':_0x4f1c('0xa'),'condition':_0x4f1c('0xb'),'callback':afterUpdate},{'channel':_0x4f1c('0x10'),'model':_0x4f1c('0x13'),'event':_0x4f1c('0x8'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Fax','model':'FaxInteraction','event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0x4f1c('0x14'),'model':_0x4f1c('0x15'),'event':_0x4f1c('0xa'),'condition':_0x4f1c('0xb'),'callback':afterUpdate},{'channel':_0x4f1c('0x14'),'model':_0x4f1c('0x16'),'event':_0x4f1c('0x8'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x4f1c('0x17'),'model':'MailInteraction','event':'afterCreate','condition':_0x4f1c('0x11'),'callback':afterCreate},{'channel':_0x4f1c('0x17'),'model':_0x4f1c('0x18'),'event':_0x4f1c('0xa'),'condition':_0x4f1c('0xb'),'callback':afterUpdate},{'channel':_0x4f1c('0x17'),'model':'MailMessage','event':'afterCreate','condition':_0x4f1c('0xd'),'callback':afterCreateMessage},{'channel':'Openchannel','model':_0x4f1c('0x19'),'event':_0x4f1c('0x8'),'condition':_0x4f1c('0x11'),'callback':afterCreate},{'channel':'Openchannel','model':_0x4f1c('0x19'),'event':_0x4f1c('0xa'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x4f1c('0x1a'),'model':_0x4f1c('0x1b'),'event':'afterCreate','condition':_0x4f1c('0xd'),'callback':afterCreateMessage}];function request(_0xf60c3a){return client['request'](_0x4f1c('0x1c'),_0xf60c3a)[_0x4f1c('0x1d')](function(_0x1542e5){logger[_0x4f1c('0x1e')](_0x4f1c('0x1f'),_0x4f1c('0x1c'),_0x1542e5);if(_0x1542e5[_0x4f1c('0x20')]){if(_0x1542e5[_0x4f1c('0x20')][_0x4f1c('0x21')]===0x1f4){logger[_0x4f1c('0x20')]('Trigger,\x20%s',_0x4f1c('0x1c'),_0x1542e5['error']);}}})[_0x4f1c('0x22')](function(_0x3775a0){logger['error']('Trigger,\x20%s',_0x4f1c('0x1c'),_0x3775a0);});}function afterCreateMessage(_0x34cb12,_0x26123d){return function(_0x20ac35,_0x360d5f){_0x20ac35=_0x20ac35['get']({'plain':!![]});_0x20ac35[_0x4f1c('0x23')]=_0x34cb12;_0x20ac35[_0x4f1c('0x24')]=_0x20ac35['direction'];var _0x127a85='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x20ac35['ContactId'];return db['sequelize'][_0x4f1c('0x25')](_0x127a85,{'type':db[_0x4f1c('0x26')][_0x4f1c('0x27')][_0x4f1c('0x28')],'raw':!![]})[_0x4f1c('0x1d')](function(_0x54dc0c){return _0x54dc0c;})['then'](function(_0x206cc6){if(_0x206cc6){_0x20ac35[_0x4f1c('0x29')]=_0x206cc6[0x0];}if(_0x20ac35['UserId']){return db[_0x4f1c('0x2a')][_0x4f1c('0x2b')]({'where':{'id':_0x20ac35[_0x4f1c('0x2c')]},'attributes':['id','name',_0x4f1c('0x2d'),_0x4f1c('0x2e'),_0x4f1c('0x2f')],'raw':!![]})[_0x4f1c('0x1d')](function(_0x39d67b){_0x20ac35[_0x4f1c('0x30')]=util['format'](_0x4f1c('0x31'),_0x39d67b[_0x4f1c('0x32')]);_0x20ac35[_0x4f1c('0x23')]=_0x34cb12;_0x20ac35[_0x4f1c('0x33')]=_0x39d67b;return request({'event':_0x4f1c('0x34'),'message':_0x20ac35});})[_0x4f1c('0x22')](function(_0xcc5e0c){console[_0x4f1c('0x20')](_0xcc5e0c);});}else{return request({'event':'outgoingmessage','message':_0x20ac35});}});};}function afterCreate(_0x3287e9,_0x1cfd8f){return function(_0x5b0f59,_0x11f984){_0x5b0f59=_0x5b0f59[_0x4f1c('0x35')]({'plain':!![]});_0x5b0f59[_0x4f1c('0x23')]=_0x3287e9;_0x5b0f59['event']=_0x4f1c('0x36');var _0xb12116='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5b0f59[_0x4f1c('0x37')];return db[_0x4f1c('0x38')][_0x4f1c('0x25')](_0xb12116,{'type':db[_0x4f1c('0x26')][_0x4f1c('0x27')][_0x4f1c('0x28')],'raw':!![]})[_0x4f1c('0x1d')](function(_0x415074){return _0x415074;})[_0x4f1c('0x1d')](function(_0x36b096){if(_0x36b096){_0x5b0f59[_0x4f1c('0x29')]=_0x36b096[0x0];}return request({'event':_0x1cfd8f,'message':_0x5b0f59});});};}function afterUpdate(_0x2d62e6,_0x58d599){return function(_0xa00ad0,_0x2f9884){if(_0xa00ad0[_0x4f1c('0x39')]('closed')&&_0xa00ad0[_0x4f1c('0x3a')]){_0xa00ad0=_0xa00ad0['get']({'plain':!![]});_0xa00ad0['channel']=_0x2d62e6;_0xa00ad0[_0x4f1c('0x24')]=_0x4f1c('0x3a');var _0x2f16fa='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xa00ad0['ContactId'];return db[_0x4f1c('0x38')][_0x4f1c('0x25')](_0x2f16fa,{'type':db[_0x4f1c('0x26')][_0x4f1c('0x27')][_0x4f1c('0x28')],'raw':!![]})[_0x4f1c('0x1d')](function(_0x1c2fd6){return _0x1c2fd6;})[_0x4f1c('0x1d')](function(_0x429eb6){if(_0x429eb6){_0xa00ad0[_0x4f1c('0x29')]=_0x429eb6[0x0];}if(_0xa00ad0[_0x4f1c('0x2c')]){return db[_0x4f1c('0x2a')][_0x4f1c('0x2b')]({'where':{'id':_0xa00ad0[_0x4f1c('0x2c')]},'attributes':['id',_0x4f1c('0x32'),_0x4f1c('0x2d'),_0x4f1c('0x2e'),_0x4f1c('0x2f')],'raw':!![]})[_0x4f1c('0x1d')](function(_0x2e957d){_0xa00ad0[_0x4f1c('0x30')]=util['format'](_0x4f1c('0x31'),_0x2e957d[_0x4f1c('0x32')]);_0xa00ad0[_0x4f1c('0x33')]=_0x2e957d;return request({'event':_0x58d599,'message':_0xa00ad0});})[_0x4f1c('0x22')](function(_0x2920e2){console[_0x4f1c('0x20')](_0x2920e2);});}else{return request({'event':_0x58d599,'message':_0xa00ad0});}});}};}exports['default']=function(){for(var _0x55e017=0x0;_0x55e017=_0x16b889['agents']){throw Error(_0x82a0('0x16'));}_0x1846f4(_0x2914cd);})[_0x82a0('0x17')](function(_0x44d2a7){_0x550fc4(_0x44d2a7);});});}; \ No newline at end of file +var _0xcaef=['agent','count','then','agents','catch','lodash','../mysqldb','./license/util','mail','chat','sms','whatsapp','openchannel','getChannels','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','role'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xcaef,0x195));var _0xfcae=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0xcaef[_0x44bcb0];return _0xfaf881;};'use strict';var _=require(_0xfcae('0x0'));var BPromise=require('bluebird');var db=require(_0xfcae('0x1'))['db'];var util=require(_0xfcae('0x2'));var channels=['voice',_0xfcae('0x3'),_0xfcae('0x4'),'fax',_0xfcae('0x5'),_0xfcae('0x6'),_0xfcae('0x7')];exports[_0xfcae('0x8')]=function(){return channels;};exports['isValidChannel']=function(_0x27758d){_0x27758d=_0x27758d['toLowerCase']();return _['includes'](channels,_0x27758d);};exports[_0xfcae('0x9')]=function(_0x5f1881,_0x37141d,_0x2cc73b,_0x57709d){var _0x4e7434={'loginAttempts':_0x37141d,'blocked':_0x2cc73b};if(!_[_0xfcae('0xa')](_0x57709d)){_0x4e7434[_0xfcae('0xb')]=_0x57709d;}return _0x5f1881[_0xfcae('0xc')](_0x4e7434);};exports[_0xfcae('0xd')]=function(_0x15f894){return new BPromise(function(_0x308e94,_0xd97cfa){var _0x492320=0x0;if(_0x15f894[_0xfcae('0xe')]!==_0xfcae('0xf')){_0x308e94(_0x15f894);}db['User'][_0xfcae('0x10')]({'where':{'role':_0xfcae('0xf'),'online':!![],'id':{'$ne':_0x15f894['id']}}})[_0xfcae('0x11')](function(_0x33f3ee){_0x492320=_0x33f3ee;return util['getLicense']();})[_0xfcae('0x11')](function(_0x11f4ee){if(_0x11f4ee&&_0x11f4ee[_0xfcae('0x12')]&&_0x492320>=_0x11f4ee[_0xfcae('0x12')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x308e94(_0x15f894);})[_0xfcae('0x13')](function(_0xe3828e){_0xd97cfa(_0xe3828e);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 62dfbc2..b032f04 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2e3a=['send','exports','404','status','render','json'];(function(_0x480706,_0x18e6db){var _0x20bc42=function(_0x50fa46){while(--_0x50fa46){_0x480706['push'](_0x480706['shift']());}};_0x20bc42(++_0x18e6db);}(_0x2e3a,0x145));var _0xa2e3=function(_0x45356b,_0x4bcd63){_0x45356b=_0x45356b-0x0;var _0xb3884e=_0x2e3a[_0x45356b];return _0xb3884e;};'use strict';module[_0xa2e3('0x0')][0x194]=function pageNotFound(_0x5da920,_0x31d096){var _0x538c72=_0xa2e3('0x1');var _0xf62ed=0x194;var _0x415808={'status':_0xf62ed};_0x31d096[_0xa2e3('0x2')](_0x415808[_0xa2e3('0x2')]);_0x31d096[_0xa2e3('0x3')](_0x538c72,{},function(_0x116806,_0x287fec){if(_0x116806){return _0x31d096[_0xa2e3('0x2')](_0x415808[_0xa2e3('0x2')])[_0xa2e3('0x4')](_0x415808);}_0x31d096[_0xa2e3('0x5')](_0x287fec);});}; \ No newline at end of file +var _0xb09d=['render','json','send','exports','404','status'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0xb09d,0xed));var _0xdb09=function(_0x16a9bf,_0x40d4c5){_0x16a9bf=_0x16a9bf-0x0;var _0x1fabb4=_0xb09d[_0x16a9bf];return _0x1fabb4;};'use strict';module[_0xdb09('0x0')][0x194]=function pageNotFound(_0x42309a,_0x165dc3){var _0x3b27ff=_0xdb09('0x1');var _0x3bf74b=0x194;var _0x2388f0={'status':_0x3bf74b};_0x165dc3[_0xdb09('0x2')](_0x2388f0['status']);_0x165dc3[_0xdb09('0x3')](_0x3b27ff,{},function(_0xe5dd2b,_0x169a80){if(_0xe5dd2b){return _0x165dc3[_0xdb09('0x2')](_0x2388f0[_0xdb09('0x2')])[_0xdb09('0x4')](_0x2388f0);}_0x165dc3[_0xdb09('0x5')](_0x169a80);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 924bbd8..ddfeef1 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4dfc=['MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','userProfileId','Groups','belongsToMany','Contacts','cm_user_has_contacts','CmList','user_has_teams','user_has_mail_interactions','ChatInteraction','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','MailQueue','MailQueues','UserMailQueue','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','cm_user_has_lists','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccount','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SpiedAgents','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','CmHopper','Hoppers','HopperBlacks','JscriptySessionReport','belongsTo','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','Agents','BlackLists','voice_queues_has_cm_blacklists','ScreenRecording','VoiceMailMessage','mailbox','mailboxuser','QueueCalls','uniqueid','AgentReports','ContactId','MailAccountId','Imap','Smtp','Dispositions','Answers','Messages','Interactions','MailApplication','ListId','TemplateId','team_has_mail_queues','Teams','MailInteractionId','Account','Owner','Tag','mail_interaction_has_tags','Tags','Contact','Interaction','ChatWebsiteId','ChatOfflineMessageId','restrict','TagId','List','Items','FaxAccountId','FaxApplication','Exntensions','FaxMessage','FaxInteractionId','fax_interaction_has_tags','AttachmentId','SmsAccountId','SmsMessage','SmsInteraction','sms_interaction_has_tags','ThroughTags','Users','SmsInteractionId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ProactiveActions','ChatApplication','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','Attachments','ChatGroupId','chat_group_has_users','CmContactId','HopperHistories','Company','CompanyId','cm_contact_has_tags','CmHopperAdditionalPhone','CmHopperId','Campaign','CampaignId','All','AutomationAllId','Any','OneAny','AutomationAnyId','Intervals','MailApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Hopper','AllConditions','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Fields','MetricId','Configurations','AccountId','Subjects','SubjectId','DescriptionId','Subject','Description','Field','SugarcrmField','Descriptions','FieldId','VariableId','int_desk_configuration_has_tags','int_zendesk_configuration_has_tags','ServicenowField','Dynamics365Configuration','Dynamics365Account','FreshsalesConfiguration','FromId','ToId','SessionId','JscriptyProject','ProjectId','SquareProject','user_has_square_projects','team_has_chat_queues','team_has_fax_queues','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ChatTransferReport','FromChatWebsiteId','FromAccount','FromUserId','ToChatWebsiteId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','ToSmsAccountId','CustomFields','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','FromWhatsappAccountId','WhatsappTransferReport','ToQueueId','team_has_whatsapp_queues','lodash','jstz','determine','sequelize','defaultsDeep','motion2','mysql','utf8mb4','utf8','utf8_general_ci','sequelizeHistory','xcall','xC@LL1234','127.0.0.1','name','database','username','password','options','User','VoiceChanSpy','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','UserFaxQueue','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailSubstatus','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','FaxAccount','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsApplication','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','SmsQueue','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','Sound','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','../api/integration/integration.model','IntegrationReport','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Integration','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','Team','../api/team/team.model','License','../api/license/license.model','../api/campaign/campaign.model','Migration','Attachment','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','OpenchannelTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','UserNotification','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappQueue','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','hasOne','VoiceMail','cascade','UserId','Recordings','hasMany','UserVoiceQueueRt','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction'];(function(_0x485ece,_0x4e765d){var _0x3a90f7=function(_0x2b1614){while(--_0x2b1614){_0x485ece['push'](_0x485ece['shift']());}};_0x3a90f7(++_0x4e765d);}(_0x4dfc,0xda));var _0xc4df=function(_0x3a0ebd,_0x47f368){_0x3a0ebd=_0x3a0ebd-0x0;var _0x51a660=_0x4dfc[_0x3a0ebd];return _0x51a660;};'use strict';var path=require('path');var config=require('../config/environment');var Sequelize=require('sequelize');var _=require(_0xc4df('0x0'));var jstz=require(_0xc4df('0x1'));var timezone=jstz[_0xc4df('0x2')]();config[_0xc4df('0x3')]=_[_0xc4df('0x4')](config[_0xc4df('0x3')],{'database':_0xc4df('0x5'),'username':'xcall','password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xc4df('0x6'),'dialectOptions':{'charset':_0xc4df('0x7')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xc4df('0x8'),'collate':_0xc4df('0x9')}}});config[_0xc4df('0xa')]=_['defaultsDeep'](config[_0xc4df('0xa')],{'database':_0xc4df('0x5'),'username':_0xc4df('0xb'),'password':_0xc4df('0xc'),'options':{'host':_0xc4df('0xd'),'port':0xcea,'dialect':_0xc4df('0x6'),'dialectOptions':{'charset':_0xc4df('0x7')},'logging':![],'timezone':timezone[_0xc4df('0xe')](),'define':{'charset':'utf8','collate':_0xc4df('0x9')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xc4df('0x3')][_0xc4df('0xf')],config[_0xc4df('0x3')][_0xc4df('0x10')],config[_0xc4df('0x3')][_0xc4df('0x11')],config[_0xc4df('0x3')][_0xc4df('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xc4df('0xa')][_0xc4df('0xf')],config[_0xc4df('0xa')][_0xc4df('0x10')],config[_0xc4df('0xa')][_0xc4df('0x11')],config[_0xc4df('0xa')]['options'])};db[_0xc4df('0x13')]=db[_0xc4df('0x3')]['import']('../api/user/user.model');db[_0xc4df('0x14')]=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0x16'));db[_0xc4df('0x17')]=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0x18'));db[_0xc4df('0x19')]=db['sequelize'][_0xc4df('0x15')](_0xc4df('0x1a'));db[_0xc4df('0x1b')]=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0x1c'));db[_0xc4df('0x1d')]=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0x1e'));db[_0xc4df('0x1f')]=db[_0xc4df('0x3')]['import'](_0xc4df('0x20'));db['ScreenRecording']=db[_0xc4df('0x3')]['import']('../api/screenRecording/screenRecording.model');db['VoiceMail']=db['sequelize'][_0xc4df('0x15')](_0xc4df('0x21'));db['VoiceMailMessage']=db['sequelize'][_0xc4df('0x15')](_0xc4df('0x22'));db[_0xc4df('0x23')]=db[_0xc4df('0x3')]['import'](_0xc4df('0x24'));db[_0xc4df('0x25')]=db[_0xc4df('0x3')][_0xc4df('0x15')]('../api/voiceDialReport/voiceDialReport.model');db[_0xc4df('0x26')]=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0x27'));db[_0xc4df('0x28')]=db['sequelize'][_0xc4df('0x15')](_0xc4df('0x29'));db[_0xc4df('0x2a')]=db['sequelize'][_0xc4df('0x15')]('../api/memberReport/memberReport.model');db[_0xc4df('0x2b')]=db['sequelize'][_0xc4df('0x15')](_0xc4df('0x2c'));db[_0xc4df('0x2d')]=db[_0xc4df('0x3')]['import'](_0xc4df('0x2e'));db['UserVoiceQueueRt']=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0x2f'));db[_0xc4df('0x30')]=db['sequelize']['import']('../api/userVoiceQueue/userVoiceQueue.model');db['UserChatQueue']=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0x31'));db['UserMailQueue']=db['sequelize'][_0xc4df('0x15')](_0xc4df('0x32'));db[_0xc4df('0x33')]=db[_0xc4df('0x3')][_0xc4df('0x15')]('../api/userFaxQueue/userFaxQueue.model');db[_0xc4df('0x34')]=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0x35'));db[_0xc4df('0x36')]=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0x37'));db[_0xc4df('0x38')]=db[_0xc4df('0x3')]['import']('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0xc4df('0x39')]=db[_0xc4df('0x3')]['import'](_0xc4df('0x3a'));db[_0xc4df('0x3b')]=db['sequelize']['import'](_0xc4df('0x3c'));db[_0xc4df('0x3d')]=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0x3e'));db['MailQueue']=db[_0xc4df('0x3')]['import']('../api/mailQueue/mailQueue.model');db[_0xc4df('0x3f')]=db[_0xc4df('0x3')][_0xc4df('0x15')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0x40'));db[_0xc4df('0x41')]=db[_0xc4df('0x3')]['import'](_0xc4df('0x42'));db['MailApplication']=db[_0xc4df('0x3')][_0xc4df('0x15')]('../api/mailApplication/mailApplication.model');db[_0xc4df('0x43')]=db['sequelize'][_0xc4df('0x15')](_0xc4df('0x44'));db[_0xc4df('0x45')]=db[_0xc4df('0x3')]['import']('../api/dashboard/dashboard.model');db[_0xc4df('0x46')]=db[_0xc4df('0x3')]['import']('../api/dashboardItem/dashboardItem.model');db[_0xc4df('0x47')]=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0x48'));db['FaxApplication']=db[_0xc4df('0x3')]['import'](_0xc4df('0x49'));db['FaxInteraction']=db['sequelize']['import'](_0xc4df('0x4a'));db['FaxMessage']=db[_0xc4df('0x3')]['import'](_0xc4df('0x4b'));db[_0xc4df('0x4c')]=db[_0xc4df('0x3')]['import'](_0xc4df('0x4d'));db[_0xc4df('0x4e')]=db['sequelize'][_0xc4df('0x15')](_0xc4df('0x4f'));db['SmsAccount']=db[_0xc4df('0x3')]['import']('../api/smsAccount/smsAccount.model');db[_0xc4df('0x50')]=db[_0xc4df('0x3')][_0xc4df('0x15')]('../api/smsApplication/smsApplication.model');db['SmsInteraction']=db['sequelize'][_0xc4df('0x15')](_0xc4df('0x51'));db['SmsMessage']=db['sequelize'][_0xc4df('0x15')](_0xc4df('0x52'));db[_0xc4df('0x53')]=db[_0xc4df('0x3')][_0xc4df('0x15')]('../api/smsQueue/smsQueue.model');db[_0xc4df('0x54')]=db['sequelize'][_0xc4df('0x15')](_0xc4df('0x55'));db[_0xc4df('0x56')]=db[_0xc4df('0x3')]['import']('../api/openchannelApplication/openchannelApplication.model');db[_0xc4df('0x57')]=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0x58'));db[_0xc4df('0x59')]=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0x5a'));db[_0xc4df('0x5b')]=db['sequelize'][_0xc4df('0x15')](_0xc4df('0x5c'));db[_0xc4df('0x5d')]=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0x5e'));db[_0xc4df('0x5f')]=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0x60'));db['ChatApplication']=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0x61'));db['ChatInteraction']=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0x62'));db[_0xc4df('0x63')]=db['sequelize']['import'](_0xc4df('0x64'));db[_0xc4df('0x65')]=db[_0xc4df('0x3')]['import'](_0xc4df('0x66'));db[_0xc4df('0x67')]=db[_0xc4df('0x3')][_0xc4df('0x15')]('../api/chatQueue/chatQueue.model');db[_0xc4df('0x68')]=db['sequelize'][_0xc4df('0x15')](_0xc4df('0x69'));db[_0xc4df('0x6a')]=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0x6b'));db[_0xc4df('0x6c')]=db['sequelize']['import'](_0xc4df('0x6d'));db[_0xc4df('0x6e')]=db['sequelize'][_0xc4df('0x15')]('../api/cmContact/cmContact.model');db['CmHopper']=db['sequelize']['import'](_0xc4df('0x6f'));db[_0xc4df('0x70')]=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0x71'));db[_0xc4df('0x72')]=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0x73'));db[_0xc4df('0x74')]=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0x75'));db[_0xc4df('0x76')]=db[_0xc4df('0x3')]['import'](_0xc4df('0x77'));db[_0xc4df('0x78')]=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0x79'));db[_0xc4df('0x7a')]=db[_0xc4df('0x3')]['import'](_0xc4df('0x7b'));db[_0xc4df('0x7c')]=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0x7d'));db[_0xc4df('0x7e')]=db['sequelize'][_0xc4df('0x15')](_0xc4df('0x7f'));db[_0xc4df('0x80')]=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0x81'));db[_0xc4df('0x82')]=db[_0xc4df('0x3')][_0xc4df('0x15')]('../api/condition/condition.model');db[_0xc4df('0x83')]=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0x84'));db[_0xc4df('0x85')]=db['sequelize'][_0xc4df('0x15')](_0xc4df('0x86'));db[_0xc4df('0x87')]=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0x88'));db[_0xc4df('0x89')]=db['sequelize'][_0xc4df('0x15')](_0xc4df('0x8a'));db[_0xc4df('0x8b')]=db[_0xc4df('0x3')][_0xc4df('0x15')]('../api/schedule/schedule.model');db[_0xc4df('0x8c')]=db[_0xc4df('0x3')][_0xc4df('0x15')]('../api/sound/sound.model');db['Tag']=db[_0xc4df('0x3')]['import'](_0xc4df('0x8d'));db[_0xc4df('0x8e')]=db['sequelize'][_0xc4df('0x15')](_0xc4df('0x8f'));db[_0xc4df('0x90')]=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0x91'));db['CmHopperAdditionalPhone']=db[_0xc4df('0x3')][_0xc4df('0x15')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0xc4df('0x92')]=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0x93'));db[_0xc4df('0x94')]=db[_0xc4df('0x3')]['import'](_0xc4df('0x95'));db[_0xc4df('0x96')]=db['sequelize'][_0xc4df('0x15')](_0xc4df('0x97'));db['Integration']=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0x98'));db[_0xc4df('0x99')]=db['sequelize'][_0xc4df('0x15')]('../api/integrationReport/integrationReport.model');db[_0xc4df('0x9a')]=db[_0xc4df('0x3')]['import'](_0xc4df('0x9b'));db[_0xc4df('0x9c')]=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0x9d'));db['AnalyticExtractedReport']=db['sequelize'][_0xc4df('0x15')](_0xc4df('0x9e'));db[_0xc4df('0x9f')]=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0xa0'));db[_0xc4df('0xa1')]=db['sequelize'][_0xc4df('0x15')](_0xc4df('0xa2'));db[_0xc4df('0xa3')]=db[_0xc4df('0x3')]['import']('../api/analyticTreeReport/analyticTreeReport.model');db[_0xc4df('0xa4')]=db[_0xc4df('0x3')][_0xc4df('0x15')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0xc4df('0xa5')]=db[_0xc4df('0x3')]['import'](_0xc4df('0xa6'));db[_0xc4df('0xa7')]=db[_0xc4df('0x3')]['import'](_0xc4df('0xa8'));db[_0xc4df('0xa9')]=db['sequelize'][_0xc4df('0x15')](_0xc4df('0xaa'));db[_0xc4df('0xab')]=db[_0xc4df('0x3')]['import'](_0xc4df('0xac'));db['SugarcrmField']=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0xad'));db[_0xc4df('0xae')]=db[_0xc4df('0x3')][_0xc4df('0x15')]('../api/intDeskAccount/intDeskAccount.model');db[_0xc4df('0xaf')]=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0xb0'));db[_0xc4df('0xb1')]=db[_0xc4df('0x3')][_0xc4df('0x15')]('../api/intDeskField/intDeskField.model');db[_0xc4df('0xb2')]=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0xb3'));db[_0xc4df('0xb4')]=db['sequelize'][_0xc4df('0x15')](_0xc4df('0xb5'));db[_0xc4df('0xb6')]=db[_0xc4df('0x3')]['import'](_0xc4df('0xb7'));db[_0xc4df('0xb8')]=db[_0xc4df('0x3')]['import'](_0xc4df('0xb9'));db[_0xc4df('0xba')]=db['sequelize'][_0xc4df('0x15')](_0xc4df('0xbb'));db[_0xc4df('0xbc')]=db['sequelize']['import'](_0xc4df('0xbd'));db[_0xc4df('0xbe')]=db[_0xc4df('0x3')]['import']('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0xc4df('0xbf')]=db['sequelize']['import'](_0xc4df('0xc0'));db[_0xc4df('0xc1')]=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0xc2'));db[_0xc4df('0xc3')]=db['sequelize'][_0xc4df('0x15')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0xc4df('0xc4')]=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0xc5'));db[_0xc4df('0xc6')]=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0xc7'));db[_0xc4df('0xc8')]=db[_0xc4df('0x3')][_0xc4df('0x15')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0xc4df('0xc9')]=db['sequelize'][_0xc4df('0x15')](_0xc4df('0xca'));db['ServicenowField']=db['sequelize'][_0xc4df('0x15')]('../api/intServicenowField/intServicenowField.model');db['Dynamics365Account']=db[_0xc4df('0x3')][_0xc4df('0x15')]('../api/intDynamics365Account/intDynamics365Account.model');db['Dynamics365Configuration']=db['sequelize'][_0xc4df('0x15')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0xc4df('0xcb')]=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0xcc'));db[_0xc4df('0xcd')]=db[_0xc4df('0x3')]['import']('../api/intFreshsalesAccount/intFreshsalesAccount.model');db['FreshsalesConfiguration']=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0xce'));db[_0xc4df('0xcf')]=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0xd0'));db[_0xc4df('0xd1')]=db[_0xc4df('0x3')][_0xc4df('0x15')]('../api/integration/integration.model');db['Network']=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0xd2'));db[_0xc4df('0xd3')]=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0xd4'));db[_0xc4df('0xd5')]=db[_0xc4df('0x3')][_0xc4df('0x15')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0xc4df('0xd6')]=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0xd7'));db[_0xc4df('0xd8')]=db['sequelize'][_0xc4df('0x15')](_0xc4df('0xd9'));db['JscriptySessionReport']=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0xda'));db[_0xc4df('0xdb')]=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0xdc'));db['SquareReport']=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0xdd'));db['SquareDetailsReport']=db['sequelize'][_0xc4df('0x15')](_0xc4df('0xde'));db['JscriptyProject']=db[_0xc4df('0x3')]['import'](_0xc4df('0xdf'));db['Setting']=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0xe0'));db[_0xc4df('0xe1')]=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0xe2'));db['SquareProject']=db[_0xc4df('0x3')]['import'](_0xc4df('0xe3'));db[_0xc4df('0xe4')]=db[_0xc4df('0x3')][_0xc4df('0x15')]('../api/squareRecording/squareRecording.model');db[_0xc4df('0xe5')]=db[_0xc4df('0x3')][_0xc4df('0x15')]('../api/squareMessage/squareMessage.model');db[_0xc4df('0xe6')]=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0xe7'));db[_0xc4df('0xe8')]=db['sequelize']['import'](_0xc4df('0xe9'));db['Campaign']=db['sequelize'][_0xc4df('0x15')](_0xc4df('0xea'));db[_0xc4df('0xeb')]=db[_0xc4df('0x3')][_0xc4df('0x15')]('../api/migration/migration.model');db[_0xc4df('0xec')]=db['sequelize']['import']('../api/attachment/attachment.model');db[_0xc4df('0xed')]=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0xee'));db[_0xc4df('0xef')]=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0xf0'));db['ChatTransferReport']=db['sequelize'][_0xc4df('0x15')](_0xc4df('0xf1'));db[_0xc4df('0xf2')]=db[_0xc4df('0x3')][_0xc4df('0x15')]('../api/faxTransferReport/faxTransferReport.model');db[_0xc4df('0xf3')]=db['sequelize'][_0xc4df('0x15')]('../api/openchannelTransferReport/openchannelTransferReport.model');db['SmsTransferReport']=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0xf4'));db['CmList']=db[_0xc4df('0x3')]['import'](_0xc4df('0xf5'));db[_0xc4df('0xf6')]=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0xf7'));db[_0xc4df('0xf8')]=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0xf9'));db[_0xc4df('0xfa')]=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0xfb'));db[_0xc4df('0xfc')]=db[_0xc4df('0x3')][_0xc4df('0x15')]('../api/userProfileResource/userProfileResource.model');db[_0xc4df('0xfd')]=db[_0xc4df('0x3')][_0xc4df('0x15')]('../api/userNotification/userNotification.model');db[_0xc4df('0xfe')]=db['sequelize'][_0xc4df('0x15')](_0xc4df('0xff'));db[_0xc4df('0x100')]=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0x101'));db[_0xc4df('0x102')]=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0x103'));db[_0xc4df('0x104')]=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0x105'));db[_0xc4df('0x106')]=db[_0xc4df('0x3')]['import'](_0xc4df('0x107'));db['WhatsappTransferReport']=db['sequelize'][_0xc4df('0x15')]('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0xc4df('0x108')]=db['sequelize'][_0xc4df('0x15')]('../api/whatsappQueue/whatsappQueue.model');db[_0xc4df('0x109')]=db['sequelize'][_0xc4df('0x15')](_0xc4df('0x10a'));db['Realtime']=db[_0xc4df('0x3')]['import']('../api/realtime/realtime.model');db[_0xc4df('0x10b')]=db[_0xc4df('0x3')][_0xc4df('0x15')](_0xc4df('0x10c'));db['User'][_0xc4df('0x10d')](db[_0xc4df('0x10e')],{'as':_0xc4df('0x10e'),'onDelete':_0xc4df('0x10f'),'foreignKey':_0xc4df('0x110')});db['User']['hasMany'](db['VoiceRecording'],{'as':_0xc4df('0x111'),'foreignKey':_0xc4df('0x110')});db[_0xc4df('0x13')][_0xc4df('0x112')](db[_0xc4df('0x113')],{'as':_0xc4df('0x114'),'foreignKey':_0xc4df('0x110')});db[_0xc4df('0x13')][_0xc4df('0x112')](db[_0xc4df('0x19')],{'as':_0xc4df('0x115'),'onDelete':'cascade','hooks':!![]});db[_0xc4df('0x13')]['hasMany'](db['CmHopperFinal'],{'as':_0xc4df('0x116'),'foreignKey':_0xc4df('0x110')});db['User'][_0xc4df('0x112')](db[_0xc4df('0x74')],{'as':_0xc4df('0x117'),'foreignKey':_0xc4df('0x110')});db[_0xc4df('0x13')][_0xc4df('0x112')](db['ReportAgentPreview'],{'as':_0xc4df('0x76'),'foreignKey':_0xc4df('0x110')});db['User']['hasMany'](db['OpenchannelInteraction'],{'as':_0xc4df('0x118'),'foreignKey':_0xc4df('0x110')});db[_0xc4df('0x13')]['hasMany'](db['ChatInteraction'],{'as':_0xc4df('0x119'),'foreignKey':_0xc4df('0x110')});db[_0xc4df('0x13')][_0xc4df('0x112')](db['SmsInteraction'],{'as':_0xc4df('0x11a'),'foreignKey':_0xc4df('0x110')});db[_0xc4df('0x13')]['hasMany'](db[_0xc4df('0x11b')],{'as':'FaxInteractions','foreignKey':_0xc4df('0x110')});db['User'][_0xc4df('0x112')](db[_0xc4df('0x11c')],{'as':_0xc4df('0x11d'),'foreignKey':'UserId'});db[_0xc4df('0x13')]['hasMany'](db[_0xc4df('0x102')],{'as':_0xc4df('0x11e'),'foreignKey':_0xc4df('0x110')});db[_0xc4df('0x13')]['hasMany'](db[_0xc4df('0xfd')],{'as':_0xc4df('0x11f'),'foreignKey':_0xc4df('0x120')});db[_0xc4df('0x13')]['belongsTo'](db[_0xc4df('0xf8')],{'as':_0xc4df('0xf8'),'foreignKey':_0xc4df('0x121')});db[_0xc4df('0x13')]['belongsToMany'](db[_0xc4df('0x68')],{'as':_0xc4df('0x122'),'through':'chat_group_has_users'});db[_0xc4df('0x13')][_0xc4df('0x123')](db[_0xc4df('0x6e')],{'as':_0xc4df('0x124'),'through':_0xc4df('0x125')});db[_0xc4df('0x13')][_0xc4df('0x123')](db[_0xc4df('0x126')],{'as':'Lists','through':'cm_user_has_lists'});db[_0xc4df('0x13')]['belongsToMany'](db['Team'],{'through':_0xc4df('0x127')});db[_0xc4df('0x13')][_0xc4df('0x123')](db['MailInteraction'],{'as':_0xc4df('0x11d'),'through':_0xc4df('0x128')});db[_0xc4df('0x13')][_0xc4df('0x123')](db[_0xc4df('0x129')],{'as':_0xc4df('0x119'),'through':_0xc4df('0x12a')});db[_0xc4df('0x13')][_0xc4df('0x123')](db[_0xc4df('0x11b')],{'as':_0xc4df('0x12b'),'through':_0xc4df('0x12c')});db[_0xc4df('0x13')]['belongsToMany'](db['SmsInteraction'],{'as':'SmsInteractions','through':_0xc4df('0x12d')});db[_0xc4df('0x13')]['belongsToMany'](db[_0xc4df('0x57')],{'as':'OpenchannelInteractions','through':_0xc4df('0x12e')});db[_0xc4df('0x13')][_0xc4df('0x123')](db[_0xc4df('0x102')],{'as':_0xc4df('0x11e'),'through':_0xc4df('0x12f')});db['User'][_0xc4df('0x123')](db[_0xc4df('0x1d')],{'as':_0xc4df('0x130'),'through':'UserVoiceQueue','required':![]});db[_0xc4df('0x13')]['belongsToMany'](db[_0xc4df('0x131')],{'as':_0xc4df('0x132'),'through':_0xc4df('0x133'),'required':![]});db[_0xc4df('0x13')]['belongsToMany'](db[_0xc4df('0x67')],{'as':_0xc4df('0x134'),'through':_0xc4df('0x135'),'required':![],'hooks':!![]});db[_0xc4df('0x13')][_0xc4df('0x123')](db['FaxQueue'],{'as':_0xc4df('0x136'),'through':_0xc4df('0x33'),'required':![]});db[_0xc4df('0x13')][_0xc4df('0x123')](db[_0xc4df('0x53')],{'as':_0xc4df('0x137'),'through':'UserSmsQueue','required':![]});db[_0xc4df('0x13')][_0xc4df('0x123')](db[_0xc4df('0x5b')],{'as':_0xc4df('0x138'),'through':'UserOpenchannelQueue','required':![]});db[_0xc4df('0x13')][_0xc4df('0x123')](db[_0xc4df('0x108')],{'as':_0xc4df('0x139'),'through':_0xc4df('0x38'),'required':![]});db[_0xc4df('0x13')][_0xc4df('0x123')](db[_0xc4df('0x126')],{'through':_0xc4df('0x13a')});db['User']['belongsToMany'](db[_0xc4df('0xf6')],{'as':_0xc4df('0x13b'),'through':_0xc4df('0x13c'),'required':![]});db[_0xc4df('0x13')]['belongsToMany'](db['ChatWebsite'],{'as':_0xc4df('0x13d'),'through':_0xc4df('0x13e')});db[_0xc4df('0x13')][_0xc4df('0x123')](db[_0xc4df('0x47')],{'as':_0xc4df('0x13f'),'through':_0xc4df('0x140')});db['User'][_0xc4df('0x123')](db[_0xc4df('0x3d')],{'as':_0xc4df('0x141'),'through':_0xc4df('0x142')});db['User']['belongsToMany'](db['OpenchannelAccount'],{'as':_0xc4df('0x143'),'through':_0xc4df('0x144')});db[_0xc4df('0x13')]['belongsToMany'](db[_0xc4df('0x145')],{'as':_0xc4df('0x146'),'through':_0xc4df('0x147')});db[_0xc4df('0x13')]['belongsToMany'](db[_0xc4df('0xfe')],{'as':_0xc4df('0x148'),'through':_0xc4df('0x149')});db[_0xc4df('0x13')][_0xc4df('0x123')](db['SquareProject'],{'as':'SquareProjects','through':'user_has_square_projects'});db[_0xc4df('0x14')][_0xc4df('0x112')](db[_0xc4df('0x19')],{'as':_0xc4df('0x14a'),'onDelete':_0xc4df('0x10f'),'foreignKey':'ChanSpyId'});db[_0xc4df('0x17')]['hasMany'](db['VoiceExtension'],{'onDelete':_0xc4df('0x10f')});db[_0xc4df('0x19')][_0xc4df('0x112')](db[_0xc4df('0x19')],{'as':_0xc4df('0x14b'),'onDelete':'cascade'});db[_0xc4df('0x1b')][_0xc4df('0x123')](db['Sound'],{'as':_0xc4df('0x14c'),'through':_0xc4df('0x14d')});db[_0xc4df('0x1d')]['hasMany'](db['UserVoiceQueueRt'],{'as':_0xc4df('0x14e'),'foreignKey':_0xc4df('0x14f')});db['VoiceQueue']['hasMany'](db[_0xc4df('0x150')],{'as':_0xc4df('0x151'),'foreignKey':'VoiceQueueId'});db[_0xc4df('0x1d')][_0xc4df('0x112')](db[_0xc4df('0x72')],{'as':_0xc4df('0x116'),'foreignKey':_0xc4df('0x14f')});db[_0xc4df('0x1d')]['hasMany'](db[_0xc4df('0x74')],{'as':'HopperHistories','foreignKey':_0xc4df('0x14f')});db[_0xc4df('0x1d')][_0xc4df('0x112')](db['ReportAgentPreview'],{'as':_0xc4df('0x76'),'foreignKey':_0xc4df('0x14f')});db['VoiceQueue'][_0xc4df('0x112')](db[_0xc4df('0x70')],{'as':_0xc4df('0x152'),'foreignKey':_0xc4df('0x14f')});db[_0xc4df('0x1d')][_0xc4df('0x112')](db[_0xc4df('0x153')],{'as':'JscriptySessions','foreignKey':_0xc4df('0x14f')});db['VoiceQueue'][_0xc4df('0x154')](db[_0xc4df('0x2b')],{'as':_0xc4df('0x2b'),'foreignKey':_0xc4df('0x155')});db[_0xc4df('0x1d')][_0xc4df('0x154')](db[_0xc4df('0x2b')],{'as':_0xc4df('0x156'),'foreignKey':_0xc4df('0x157')});db[_0xc4df('0x1d')][_0xc4df('0x154')](db[_0xc4df('0x83')],{'as':_0xc4df('0x83'),'foreignKey':_0xc4df('0x158')});db[_0xc4df('0x1d')]['belongsTo'](db[_0xc4df('0x85')],{'as':_0xc4df('0x159'),'foreignKey':_0xc4df('0x15a')});db[_0xc4df('0x1d')][_0xc4df('0x123')](db[_0xc4df('0x126')],{'as':_0xc4df('0x15b'),'through':_0xc4df('0x15c')});db[_0xc4df('0x1d')][_0xc4df('0x123')](db['User'],{'as':_0xc4df('0x15d'),'through':_0xc4df('0x30')});db[_0xc4df('0x1d')][_0xc4df('0x123')](db['Team'],{'as':'Teams','through':_0xc4df('0x10b')});db['VoiceQueue'][_0xc4df('0x123')](db[_0xc4df('0x126')],{'as':_0xc4df('0x15e'),'through':_0xc4df('0x15f')});db['VoiceRecording']['belongsTo'](db[_0xc4df('0x13')],{'as':_0xc4df('0x13'),'foreignKey':_0xc4df('0x110')});db[_0xc4df('0x160')][_0xc4df('0x154')](db[_0xc4df('0x13')],{'as':'User','foreignKey':_0xc4df('0x110')});db[_0xc4df('0x10e')][_0xc4df('0x112')](db[_0xc4df('0x161')],{'as':'Messages','onDelete':_0xc4df('0x10f'),'foreignKey':'mailboxuser','sourceKey':_0xc4df('0x162')});db[_0xc4df('0x161')][_0xc4df('0x154')](db[_0xc4df('0x10e')],{'foreignKey':_0xc4df('0x163'),'targetKey':_0xc4df('0x162')});db[_0xc4df('0x23')][_0xc4df('0x112')](db[_0xc4df('0x28')],{'as':_0xc4df('0x164'),'foreignKey':_0xc4df('0x165'),'constraints':![]});db['VoiceCallReport'][_0xc4df('0x112')](db[_0xc4df('0x26')],{'as':_0xc4df('0x166'),'foreignKey':_0xc4df('0x165'),'constraints':![]});db[_0xc4df('0x23')][_0xc4df('0x154')](db['User'],{'as':_0xc4df('0x13'),'foreignKey':_0xc4df('0x110')});db[_0xc4df('0x23')][_0xc4df('0x154')](db[_0xc4df('0x6e')],{'as':'Contact','foreignKey':_0xc4df('0x167')});db['MailServerIn']['belongsTo'](db[_0xc4df('0x3d')],{'as':'MailAccount','foreignKey':_0xc4df('0x168')});db[_0xc4df('0x3b')][_0xc4df('0x154')](db[_0xc4df('0x3d')],{'as':_0xc4df('0x3d'),'foreignKey':_0xc4df('0x168')});db[_0xc4df('0x3d')][_0xc4df('0x10d')](db['MailServerIn'],{'as':_0xc4df('0x169'),'onDelete':_0xc4df('0x10f')});db[_0xc4df('0x3d')]['hasOne'](db['MailServerOut'],{'as':_0xc4df('0x16a'),'onDelete':_0xc4df('0x10f')});db[_0xc4df('0x3d')][_0xc4df('0x112')](db[_0xc4df('0x80')],{'as':_0xc4df('0x16b'),'foreignKey':'MailAccountId','onDelete':'cascade'});db[_0xc4df('0x3d')][_0xc4df('0x112')](db[_0xc4df('0x7e')],{'as':_0xc4df('0x16c'),'foreignKey':_0xc4df('0x168')});db[_0xc4df('0x3d')][_0xc4df('0x112')](db[_0xc4df('0x41')],{'as':_0xc4df('0x16d'),'foreignKey':_0xc4df('0x168')});db[_0xc4df('0x3d')]['hasMany'](db[_0xc4df('0x11c')],{'as':_0xc4df('0x16e')});db[_0xc4df('0x3d')]['hasMany'](db[_0xc4df('0x16f')],{'as':_0xc4df('0x14b')});db['MailAccount'][_0xc4df('0x154')](db[_0xc4df('0x126')],{'as':'List','foreignKey':_0xc4df('0x170')});db['MailAccount'][_0xc4df('0x154')](db[_0xc4df('0x92')],{'as':'Template','foreignKey':_0xc4df('0x171')});db['MailAccount'][_0xc4df('0x154')](db[_0xc4df('0x85')],{'as':_0xc4df('0x159'),'foreignKey':_0xc4df('0x15a')});db[_0xc4df('0x3d')][_0xc4df('0x123')](db[_0xc4df('0x13')],{'as':_0xc4df('0x15d'),'through':_0xc4df('0x142')});db[_0xc4df('0x131')]['belongsToMany'](db[_0xc4df('0x13')],{'as':_0xc4df('0x15d'),'through':_0xc4df('0x133')});db[_0xc4df('0x131')][_0xc4df('0x123')](db[_0xc4df('0xe6')],{'through':_0xc4df('0x172'),'as':_0xc4df('0x173')});db['MailInteraction'][_0xc4df('0x112')](db[_0xc4df('0x41')],{'as':_0xc4df('0x16d'),'onDelete':_0xc4df('0x10f'),'foreignKey':_0xc4df('0x174')});db['MailInteraction'][_0xc4df('0x154')](db[_0xc4df('0x3d')],{'as':_0xc4df('0x175'),'foreignKey':_0xc4df('0x168')});db[_0xc4df('0x11c')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0xc4df('0x167')});db[_0xc4df('0x11c')][_0xc4df('0x154')](db['User'],{'as':_0xc4df('0x176'),'foreignKey':_0xc4df('0x110')});db[_0xc4df('0x11c')]['belongsToMany'](db[_0xc4df('0x177')],{'through':_0xc4df('0x178'),'as':_0xc4df('0x179')});db[_0xc4df('0x11c')]['belongsToMany'](db[_0xc4df('0x177')],{'through':'mail_interaction_has_tags','as':'ThroughTags'});db[_0xc4df('0x11c')][_0xc4df('0x123')](db[_0xc4df('0x13')],{'as':'Users','through':'user_has_mail_interactions','foreignKey':_0xc4df('0x174')});db[_0xc4df('0x41')][_0xc4df('0x112')](db[_0xc4df('0xec')],{'as':'Attachments','onDelete':_0xc4df('0x10f')});db[_0xc4df('0x41')][_0xc4df('0x154')](db[_0xc4df('0x13')],{'as':_0xc4df('0x13')});db[_0xc4df('0x41')][_0xc4df('0x154')](db[_0xc4df('0x6e')],{'onDelete':_0xc4df('0x10f'),'as':_0xc4df('0x17a')});db['MailMessage']['belongsTo'](db['MailInteraction'],{'as':_0xc4df('0x17b'),'foreignKey':_0xc4df('0x174')});db[_0xc4df('0x41')][_0xc4df('0x154')](db[_0xc4df('0x3d')],{'as':_0xc4df('0x175'),'foreignKey':_0xc4df('0x168')});db[_0xc4df('0x41')][_0xc4df('0x154')](db[_0xc4df('0x5d')],{'as':_0xc4df('0x5d'),'foreignKey':_0xc4df('0x17c')});db['MailMessage']['belongsTo'](db[_0xc4df('0x65')],{'as':'ChatOfflineMessage','foreignKey':_0xc4df('0x17d')});db[_0xc4df('0x16f')]['belongsTo'](db[_0xc4df('0x13')],{'onDelete':_0xc4df('0x17e')});db[_0xc4df('0x16f')][_0xc4df('0x154')](db[_0xc4df('0x131')],{'onDelete':_0xc4df('0x17e')});db[_0xc4df('0x16f')][_0xc4df('0x154')](db[_0xc4df('0x3d')],{'onDelete':_0xc4df('0x17e')});db[_0xc4df('0x16f')][_0xc4df('0x154')](db[_0xc4df('0x83')],{'onDelete':_0xc4df('0x17e'),'foreignKey':_0xc4df('0x158')});db[_0xc4df('0x16f')][_0xc4df('0x154')](db[_0xc4df('0x177')],{'onDelete':_0xc4df('0x17e'),'foreignKey':_0xc4df('0x17f')});db[_0xc4df('0x43')][_0xc4df('0x154')](db[_0xc4df('0x3d')],{});db[_0xc4df('0x43')][_0xc4df('0x154')](db[_0xc4df('0x126')],{'as':_0xc4df('0x180'),'foreignKey':'ListId'});db['MailQueueReport'][_0xc4df('0x154')](db[_0xc4df('0x6e')],{'as':_0xc4df('0x17a'),'foreignKey':_0xc4df('0x167')});db[_0xc4df('0x43')][_0xc4df('0x154')](db[_0xc4df('0x11c')],{});db[_0xc4df('0x43')][_0xc4df('0x154')](db['MailMessage'],{});db[_0xc4df('0x43')][_0xc4df('0x154')](db[_0xc4df('0x13')],{});db['MailQueueReport'][_0xc4df('0x154')](db[_0xc4df('0x131')],{});db[_0xc4df('0x45')][_0xc4df('0x112')](db[_0xc4df('0x46')],{'as':_0xc4df('0x181'),'onDelete':_0xc4df('0x10f')});db[_0xc4df('0x47')][_0xc4df('0x112')](db[_0xc4df('0x80')],{'as':_0xc4df('0x16b'),'foreignKey':_0xc4df('0x182'),'onDelete':_0xc4df('0x10f')});db[_0xc4df('0x47')][_0xc4df('0x112')](db[_0xc4df('0x7e')],{'as':'Answers','foreignKey':_0xc4df('0x182')});db[_0xc4df('0x47')][_0xc4df('0x112')](db[_0xc4df('0x11b')],{'as':_0xc4df('0x16e')});db['FaxAccount'][_0xc4df('0x112')](db[_0xc4df('0x183')],{'as':_0xc4df('0x14b')});db[_0xc4df('0x47')]['hasMany'](db[_0xc4df('0x19')],{'as':_0xc4df('0x184'),'onDelete':_0xc4df('0x10f')});db['FaxAccount'][_0xc4df('0x112')](db[_0xc4df('0x185')],{'as':_0xc4df('0x16d')});db[_0xc4df('0x47')][_0xc4df('0x154')](db[_0xc4df('0x2b')],{'as':_0xc4df('0x2b')});db[_0xc4df('0x47')][_0xc4df('0x154')](db[_0xc4df('0x126')],{'as':_0xc4df('0x180'),'foreignKey':'ListId'});db['FaxAccount'][_0xc4df('0x154')](db['Pause'],{'as':_0xc4df('0x159'),'foreignKey':_0xc4df('0x15a')});db[_0xc4df('0x47')][_0xc4df('0x123')](db[_0xc4df('0x13')],{'as':_0xc4df('0x15d'),'through':'user_has_fax_accounts'});db['FaxApplication'][_0xc4df('0x154')](db[_0xc4df('0x13')],{'onDelete':_0xc4df('0x17e')});db['FaxApplication']['belongsTo'](db[_0xc4df('0x4c')],{'onDelete':_0xc4df('0x17e')});db['FaxApplication'][_0xc4df('0x154')](db['FaxAccount'],{'onDelete':_0xc4df('0x17e')});db[_0xc4df('0x183')][_0xc4df('0x154')](db[_0xc4df('0x177')],{'onDelete':'restrict','foreignKey':_0xc4df('0x17f')});db['FaxInteraction'][_0xc4df('0x112')](db[_0xc4df('0x185')],{'as':_0xc4df('0x16d'),'onDelete':'cascade','foreignKey':_0xc4df('0x186')});db[_0xc4df('0x11b')][_0xc4df('0x154')](db[_0xc4df('0x47')],{'as':_0xc4df('0x175'),'foreignKey':_0xc4df('0x182')});db['FaxInteraction'][_0xc4df('0x154')](db[_0xc4df('0x6e')],{'as':_0xc4df('0x17a'),'foreignKey':_0xc4df('0x167')});db[_0xc4df('0x11b')][_0xc4df('0x154')](db[_0xc4df('0x13')],{'as':_0xc4df('0x176'),'foreignKey':'UserId'});db[_0xc4df('0x11b')][_0xc4df('0x123')](db[_0xc4df('0x177')],{'through':_0xc4df('0x187'),'as':_0xc4df('0x179')});db['FaxInteraction'][_0xc4df('0x123')](db['Tag'],{'through':'fax_interaction_has_tags','as':'ThroughTags'});db[_0xc4df('0x11b')][_0xc4df('0x123')](db['User'],{'as':'Users','through':'user_has_fax_interactions','foreignKey':'FaxInteractionId'});db[_0xc4df('0x185')][_0xc4df('0x154')](db[_0xc4df('0x13')],{'onDelete':'cascade','as':'User'});db[_0xc4df('0x185')][_0xc4df('0x154')](db['FaxInteraction'],{'as':'Interaction','foreignKey':_0xc4df('0x186')});db['FaxMessage'][_0xc4df('0x154')](db['CmContact'],{'onDelete':'cascade','as':'Contact'});db['FaxMessage'][_0xc4df('0x154')](db[_0xc4df('0xec')],{'as':'Attachment','foreignKey':_0xc4df('0x188')});db[_0xc4df('0x185')][_0xc4df('0x154')](db['FaxAccount'],{'as':_0xc4df('0x175'),'foreignKey':_0xc4df('0x182')});db['FaxQueue']['belongsToMany'](db[_0xc4df('0x13')],{'as':'Agents','through':_0xc4df('0x33')});db[_0xc4df('0x4c')][_0xc4df('0x123')](db[_0xc4df('0xe6')],{'through':'team_has_fax_queues','as':_0xc4df('0x173')});db[_0xc4df('0x4e')][_0xc4df('0x154')](db[_0xc4df('0x47')],{});db[_0xc4df('0x4e')][_0xc4df('0x154')](db['CmList'],{'as':_0xc4df('0x180'),'foreignKey':_0xc4df('0x170')});db[_0xc4df('0x4e')][_0xc4df('0x154')](db[_0xc4df('0x6e')],{'as':_0xc4df('0x17a'),'foreignKey':_0xc4df('0x167')});db['FaxQueueReport'][_0xc4df('0x154')](db[_0xc4df('0x11b')],{});db[_0xc4df('0x4e')]['belongsTo'](db[_0xc4df('0x185')],{});db[_0xc4df('0x4e')][_0xc4df('0x154')](db[_0xc4df('0x13')],{});db['FaxQueueReport']['belongsTo'](db[_0xc4df('0x4c')],{});db[_0xc4df('0x145')][_0xc4df('0x112')](db[_0xc4df('0x80')],{'as':'Dispositions','foreignKey':'SmsAccountId','onDelete':_0xc4df('0x10f')});db[_0xc4df('0x145')][_0xc4df('0x112')](db[_0xc4df('0x7e')],{'as':_0xc4df('0x16c'),'foreignKey':_0xc4df('0x189')});db['SmsAccount']['hasMany'](db[_0xc4df('0x18a')],{'as':_0xc4df('0x16d'),'foreignKey':'SmsAccountId'});db[_0xc4df('0x145')][_0xc4df('0x112')](db[_0xc4df('0x18b')],{'as':'Interactions'});db[_0xc4df('0x145')][_0xc4df('0x112')](db[_0xc4df('0x50')],{'as':_0xc4df('0x14b')});db['SmsAccount'][_0xc4df('0x154')](db[_0xc4df('0x126')],{'as':'List','foreignKey':_0xc4df('0x170')});db[_0xc4df('0x145')]['belongsTo'](db['Pause'],{'as':_0xc4df('0x159'),'foreignKey':_0xc4df('0x15a')});db[_0xc4df('0x145')][_0xc4df('0x123')](db[_0xc4df('0x13')],{'as':'Agents','through':_0xc4df('0x147')});db[_0xc4df('0x50')]['belongsTo'](db[_0xc4df('0x13')],{'onDelete':_0xc4df('0x17e')});db['SmsApplication']['belongsTo'](db[_0xc4df('0x53')],{'onDelete':_0xc4df('0x17e')});db[_0xc4df('0x50')][_0xc4df('0x154')](db[_0xc4df('0x145')],{'onDelete':_0xc4df('0x17e')});db[_0xc4df('0x50')][_0xc4df('0x154')](db['Interval'],{'onDelete':_0xc4df('0x17e'),'foreignKey':_0xc4df('0x158')});db[_0xc4df('0x50')][_0xc4df('0x154')](db['Tag'],{'onDelete':'restrict','foreignKey':_0xc4df('0x17f')});db[_0xc4df('0x18b')][_0xc4df('0x112')](db[_0xc4df('0x18a')],{'as':'Messages','onDelete':_0xc4df('0x10f'),'foreignKey':'SmsInteractionId'});db[_0xc4df('0x18b')]['belongsTo'](db[_0xc4df('0x145')],{'as':_0xc4df('0x175'),'foreignKey':_0xc4df('0x189')});db['SmsInteraction'][_0xc4df('0x154')](db['CmContact'],{'as':_0xc4df('0x17a'),'foreignKey':_0xc4df('0x167')});db['SmsInteraction'][_0xc4df('0x154')](db[_0xc4df('0x13')],{'as':'Owner','foreignKey':_0xc4df('0x110')});db[_0xc4df('0x18b')]['belongsToMany'](db[_0xc4df('0x177')],{'through':_0xc4df('0x18c'),'as':_0xc4df('0x179')});db[_0xc4df('0x18b')][_0xc4df('0x123')](db[_0xc4df('0x177')],{'through':_0xc4df('0x18c'),'as':_0xc4df('0x18d')});db['SmsInteraction'][_0xc4df('0x123')](db[_0xc4df('0x13')],{'as':_0xc4df('0x18e'),'through':'user_has_sms_interactions','foreignKey':_0xc4df('0x18f')});db[_0xc4df('0x18a')][_0xc4df('0x154')](db[_0xc4df('0x13')],{'as':_0xc4df('0x13')});db[_0xc4df('0x18a')][_0xc4df('0x154')](db[_0xc4df('0x6e')],{'onDelete':_0xc4df('0x10f'),'as':'Contact'});db[_0xc4df('0x18a')][_0xc4df('0x154')](db['SmsInteraction'],{'onDelete':_0xc4df('0x10f'),'as':'Interaction','foreignKey':_0xc4df('0x18f')});db[_0xc4df('0x18a')][_0xc4df('0x154')](db[_0xc4df('0x145')],{'as':_0xc4df('0x175'),'foreignKey':_0xc4df('0x189')});db['SmsQueue'][_0xc4df('0x123')](db[_0xc4df('0x13')],{'as':_0xc4df('0x15d'),'through':_0xc4df('0x34'),'foreignKey':'SmsQueueId'});db[_0xc4df('0x53')]['belongsToMany'](db[_0xc4df('0xe6')],{'through':_0xc4df('0x190'),'as':_0xc4df('0x173')});db[_0xc4df('0x54')]['hasMany'](db[_0xc4df('0x80')],{'as':_0xc4df('0x16b'),'foreignKey':'OpenchannelAccountId','onDelete':_0xc4df('0x10f')});db[_0xc4df('0x54')][_0xc4df('0x112')](db[_0xc4df('0x7e')],{'as':_0xc4df('0x16c'),'foreignKey':_0xc4df('0x191')});db['OpenchannelAccount'][_0xc4df('0x112')](db[_0xc4df('0x57')],{'as':_0xc4df('0x16e'),'foreignKey':_0xc4df('0x191')});db[_0xc4df('0x54')][_0xc4df('0x112')](db[_0xc4df('0x59')],{'as':_0xc4df('0x16d'),'foreignKey':_0xc4df('0x191')});db['OpenchannelAccount'][_0xc4df('0x112')](db['OpenchannelApplication'],{'as':_0xc4df('0x14b'),'foreignKey':_0xc4df('0x191')});db['OpenchannelAccount'][_0xc4df('0x154')](db[_0xc4df('0x126')],{'as':_0xc4df('0x180'),'foreignKey':_0xc4df('0x170')});db['OpenchannelAccount'][_0xc4df('0x154')](db['Pause'],{'as':_0xc4df('0x159'),'foreignKey':_0xc4df('0x15a')});db[_0xc4df('0x54')][_0xc4df('0x123')](db[_0xc4df('0x13')],{'as':_0xc4df('0x15d'),'through':_0xc4df('0x144')});db[_0xc4df('0x56')][_0xc4df('0x154')](db[_0xc4df('0x13')],{'onDelete':_0xc4df('0x17e')});db[_0xc4df('0x56')][_0xc4df('0x154')](db[_0xc4df('0x5b')],{'onDelete':_0xc4df('0x17e'),'foreignKey':_0xc4df('0x192')});db[_0xc4df('0x56')][_0xc4df('0x154')](db['OpenchannelAccount'],{'onDelete':'restrict','foreignKey':_0xc4df('0x191')});db[_0xc4df('0x56')][_0xc4df('0x154')](db['Interval'],{'onDelete':_0xc4df('0x17e'),'foreignKey':'IntervalId'});db['OpenchannelApplication']['belongsTo'](db[_0xc4df('0x177')],{'onDelete':_0xc4df('0x17e'),'foreignKey':_0xc4df('0x17f')});db[_0xc4df('0x57')][_0xc4df('0x112')](db[_0xc4df('0x59')],{'as':_0xc4df('0x16d'),'onDelete':'cascade','foreignKey':'OpenchannelInteractionId'});db[_0xc4df('0x57')]['belongsTo'](db[_0xc4df('0x54')],{'as':_0xc4df('0x175'),'foreignKey':_0xc4df('0x191')});db['OpenchannelInteraction'][_0xc4df('0x154')](db[_0xc4df('0x6e')],{'as':'Contact','foreignKey':'ContactId'});db[_0xc4df('0x57')][_0xc4df('0x154')](db[_0xc4df('0x13')],{'as':_0xc4df('0x176'),'foreignKey':'UserId'});db[_0xc4df('0x57')]['belongsToMany'](db[_0xc4df('0x177')],{'through':'openchannel_interaction_has_tags','as':'Tags'});db['OpenchannelInteraction'][_0xc4df('0x123')](db[_0xc4df('0x177')],{'through':'openchannel_interaction_has_tags','as':'ThroughTags'});db[_0xc4df('0x57')][_0xc4df('0x123')](db[_0xc4df('0x13')],{'as':'Users','through':_0xc4df('0x12e'),'foreignKey':_0xc4df('0x193')});db[_0xc4df('0x59')]['belongsTo'](db[_0xc4df('0x13')],{'onDelete':_0xc4df('0x10f'),'as':_0xc4df('0x13')});db[_0xc4df('0x59')][_0xc4df('0x154')](db[_0xc4df('0x6e')],{'onDelete':_0xc4df('0x10f'),'as':_0xc4df('0x17a')});db[_0xc4df('0x59')]['belongsTo'](db['OpenchannelInteraction'],{'onDelete':_0xc4df('0x10f'),'as':'Interaction','foreignKey':_0xc4df('0x193')});db[_0xc4df('0x59')][_0xc4df('0x154')](db[_0xc4df('0xec')],{'as':_0xc4df('0xec'),'foreignKey':_0xc4df('0x188')});db[_0xc4df('0x59')]['belongsTo'](db[_0xc4df('0x54')],{'as':'Account','foreignKey':'OpenchannelAccountId'});db[_0xc4df('0x5b')][_0xc4df('0x123')](db['User'],{'as':'Agents','through':'UserOpenchannelQueue','foreignKey':_0xc4df('0x192')});db['OpenchannelQueue'][_0xc4df('0x123')](db[_0xc4df('0xe6')],{'through':_0xc4df('0x194'),'as':_0xc4df('0x173')});db[_0xc4df('0x5d')][_0xc4df('0x112')](db[_0xc4df('0x80')],{'as':_0xc4df('0x16b'),'foreignKey':_0xc4df('0x17c'),'onDelete':'cascade'});db[_0xc4df('0x5d')][_0xc4df('0x112')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0xc4df('0x17c')});db[_0xc4df('0x5d')][_0xc4df('0x112')](db[_0xc4df('0x6a')],{'as':_0xc4df('0x195')});db[_0xc4df('0x5d')][_0xc4df('0x112')](db[_0xc4df('0x129')],{'as':_0xc4df('0x16e')});db[_0xc4df('0x5d')][_0xc4df('0x112')](db[_0xc4df('0x196')],{'as':_0xc4df('0x14b')});db[_0xc4df('0x5d')]['hasMany'](db[_0xc4df('0x63')],{'as':'Messages'});db[_0xc4df('0x5d')][_0xc4df('0x154')](db[_0xc4df('0x126')],{'as':_0xc4df('0x180'),'foreignKey':_0xc4df('0x170')});db[_0xc4df('0x5d')]['belongsTo'](db[_0xc4df('0x83')],{'as':'Interval','foreignKey':_0xc4df('0x158')});db['ChatWebsite'][_0xc4df('0x154')](db[_0xc4df('0x3d')],{'as':_0xc4df('0x3d'),'foreignKey':'MailAccountId'});db['ChatWebsite'][_0xc4df('0x154')](db[_0xc4df('0x85')],{'as':_0xc4df('0x159'),'foreignKey':_0xc4df('0x15a')});db[_0xc4df('0x5d')]['belongsToMany'](db['User'],{'as':_0xc4df('0x15d'),'through':'user_has_chat_websites'});db[_0xc4df('0x5f')]['belongsTo'](db[_0xc4df('0x54')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0xc4df('0x126')],{'as':_0xc4df('0x180'),'foreignKey':_0xc4df('0x170')});db[_0xc4df('0x5f')][_0xc4df('0x154')](db['CmContact'],{'as':_0xc4df('0x17a'),'foreignKey':_0xc4df('0x167')});db[_0xc4df('0x5f')][_0xc4df('0x154')](db[_0xc4df('0x57')],{});db[_0xc4df('0x5f')]['belongsTo'](db[_0xc4df('0x59')],{});db[_0xc4df('0x5f')]['belongsTo'](db[_0xc4df('0x13')],{});db[_0xc4df('0x5f')][_0xc4df('0x154')](db['OpenchannelQueue'],{});db[_0xc4df('0x196')][_0xc4df('0x154')](db['User'],{'as':_0xc4df('0x197'),'foreignKey':'UserId','onDelete':_0xc4df('0x17e')});db['ChatApplication'][_0xc4df('0x154')](db[_0xc4df('0x67')],{'as':_0xc4df('0x198'),'foreignKey':_0xc4df('0x199'),'onDelete':_0xc4df('0x17e')});db[_0xc4df('0x196')]['belongsTo'](db['ChatWebsite'],{'as':_0xc4df('0x19a'),'foreignKey':'ChatWebsiteId','onDelete':_0xc4df('0x17e')});db[_0xc4df('0x196')][_0xc4df('0x154')](db[_0xc4df('0x177')],{'onDelete':_0xc4df('0x17e'),'foreignKey':_0xc4df('0x17f')});db[_0xc4df('0x129')]['hasMany'](db[_0xc4df('0x63')],{'as':_0xc4df('0x16d'),'onDelete':_0xc4df('0x10f'),'foreignKey':_0xc4df('0x19b')});db[_0xc4df('0x129')][_0xc4df('0x154')](db[_0xc4df('0x5d')],{'as':'Account','foreignKey':_0xc4df('0x17c')});db['ChatInteraction'][_0xc4df('0x154')](db[_0xc4df('0x6e')],{'as':'Contact','foreignKey':_0xc4df('0x167')});db[_0xc4df('0x129')][_0xc4df('0x154')](db['User'],{'as':_0xc4df('0x176'),'foreignKey':_0xc4df('0x110')});db[_0xc4df('0x129')][_0xc4df('0x123')](db['Tag'],{'through':_0xc4df('0x19c'),'as':_0xc4df('0x179')});db[_0xc4df('0x129')][_0xc4df('0x123')](db[_0xc4df('0x177')],{'through':_0xc4df('0x19c'),'as':_0xc4df('0x18d')});db[_0xc4df('0x129')][_0xc4df('0x123')](db[_0xc4df('0x13')],{'as':_0xc4df('0x18e'),'through':_0xc4df('0x12a'),'foreignKey':_0xc4df('0x19b')});db[_0xc4df('0x63')][_0xc4df('0x154')](db[_0xc4df('0x13')],{'onDelete':_0xc4df('0x10f'),'as':_0xc4df('0x13')});db[_0xc4df('0x63')][_0xc4df('0x154')](db['CmContact'],{'onDelete':_0xc4df('0x10f'),'as':_0xc4df('0x17a'),'foreignKey':_0xc4df('0x167')});db[_0xc4df('0x63')][_0xc4df('0x154')](db[_0xc4df('0x129')],{'onDelete':_0xc4df('0x10f'),'as':_0xc4df('0x17b'),'foreignKey':_0xc4df('0x19b')});db['ChatMessage']['belongsTo'](db[_0xc4df('0xec')],{'as':_0xc4df('0xec'),'foreignKey':'AttachmentId'});db['ChatMessage']['belongsTo'](db[_0xc4df('0x5d')],{'as':'Account','foreignKey':_0xc4df('0x17c')});db[_0xc4df('0x65')]['hasMany'](db[_0xc4df('0xec')],{'as':_0xc4df('0x19d'),'foreignKey':_0xc4df('0x17d'),'onDelete':'cascade','hooks':!![]});db[_0xc4df('0x65')][_0xc4df('0x154')](db[_0xc4df('0x6e')],{'onDelete':_0xc4df('0x10f'),'as':'Contact','foreignKey':_0xc4df('0x167')});db[_0xc4df('0x65')][_0xc4df('0x154')](db['ChatWebsite'],{'as':_0xc4df('0x175'),'foreignKey':_0xc4df('0x17c')});db[_0xc4df('0x67')]['belongsToMany'](db[_0xc4df('0x13')],{'as':'Agents','through':_0xc4df('0x135'),'hooks':!![]});db[_0xc4df('0x67')][_0xc4df('0x123')](db[_0xc4df('0xe6')],{'through':'team_has_chat_queues','as':_0xc4df('0x173')});db['ChatGroup']['hasMany'](db['ChatInternalMessage'],{'as':'Messages','foreignKey':_0xc4df('0x19e'),'onDelete':'cascade'});db[_0xc4df('0x68')]['belongsToMany'](db[_0xc4df('0x13')],{'as':_0xc4df('0x14e'),'through':_0xc4df('0x19f')});db['ChatProactiveAction'][_0xc4df('0x154')](db[_0xc4df('0x5d')],{'as':_0xc4df('0x19a'),'foreignKey':_0xc4df('0x17c')});db[_0xc4df('0x6c')][_0xc4df('0x112')](db[_0xc4df('0x6e')],{'as':'Contacts','foreignKey':'CompanyId'});db[_0xc4df('0x6e')]['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0xc4df('0x1a0')});db[_0xc4df('0x6e')][_0xc4df('0x112')](db['CmHopper'],{'as':'Hoppers','foreignKey':_0xc4df('0x167')});db['CmContact']['hasMany'](db[_0xc4df('0x72')],{'as':_0xc4df('0x116'),'foreignKey':'ContactId'});db[_0xc4df('0x6e')][_0xc4df('0x112')](db[_0xc4df('0x74')],{'as':_0xc4df('0x1a1'),'foreignKey':_0xc4df('0x167')});db[_0xc4df('0x6e')][_0xc4df('0x112')](db[_0xc4df('0x76')],{'as':'ReportAgentPreview','foreignKey':_0xc4df('0x167')});db['CmContact'][_0xc4df('0x112')](db[_0xc4df('0x153')],{'as':'JscriptySessions','foreignKey':_0xc4df('0x167')});db[_0xc4df('0x6e')]['hasMany'](db[_0xc4df('0x57')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':'restrict'});db[_0xc4df('0x6e')][_0xc4df('0x112')](db[_0xc4df('0x129')],{'as':_0xc4df('0x119'),'foreignKey':_0xc4df('0x167'),'onDelete':_0xc4df('0x17e')});db['CmContact'][_0xc4df('0x112')](db['SmsInteraction'],{'as':_0xc4df('0x11a'),'foreignKey':_0xc4df('0x167'),'onDelete':'restrict'});db[_0xc4df('0x6e')][_0xc4df('0x112')](db[_0xc4df('0x11b')],{'as':'FaxInteractions','foreignKey':_0xc4df('0x167'),'onDelete':_0xc4df('0x17e')});db[_0xc4df('0x6e')]['hasMany'](db[_0xc4df('0x11c')],{'as':_0xc4df('0x11d'),'foreignKey':_0xc4df('0x167'),'onDelete':'restrict'});db[_0xc4df('0x6e')]['belongsTo'](db[_0xc4df('0x6c')],{'as':_0xc4df('0x1a2'),'foreignKey':_0xc4df('0x1a3')});db['CmContact'][_0xc4df('0x154')](db[_0xc4df('0x126')],{'as':_0xc4df('0x180'),'foreignKey':_0xc4df('0x170'),'onDelete':_0xc4df('0x10f')});db[_0xc4df('0x6e')][_0xc4df('0x123')](db[_0xc4df('0x13')],{'as':_0xc4df('0x18e'),'through':'cm_user_has_contacts'});db[_0xc4df('0x6e')][_0xc4df('0x123')](db[_0xc4df('0x177')],{'as':_0xc4df('0x179'),'through':_0xc4df('0x1a4')});db['CmContact'][_0xc4df('0x123')](db['Tag'],{'through':_0xc4df('0x1a4'),'as':_0xc4df('0x18d')});db[_0xc4df('0x150')]['hasMany'](db[_0xc4df('0x1a5')],{'as':'AdditionalPhones','foreignKey':_0xc4df('0x1a6')});db['CmHopper'][_0xc4df('0x154')](db[_0xc4df('0x6e')],{'as':_0xc4df('0x17a'),'foreignKey':_0xc4df('0x167'),'onDelete':'cascade'});db[_0xc4df('0x150')][_0xc4df('0x154')](db[_0xc4df('0x126')],{'as':_0xc4df('0x180'),'foreignKey':_0xc4df('0x170'),'onDelete':_0xc4df('0x10f')});db['CmHopper']['belongsTo'](db[_0xc4df('0x13')],{'as':_0xc4df('0x197'),'foreignKey':_0xc4df('0x110')});db[_0xc4df('0x150')][_0xc4df('0x154')](db[_0xc4df('0x1d')],{'as':_0xc4df('0x198'),'foreignKey':_0xc4df('0x14f'),'onDelete':'cascade'});db[_0xc4df('0x150')]['belongsTo'](db[_0xc4df('0x1a7')],{'as':_0xc4df('0x1a7'),'foreignKey':_0xc4df('0x1a8'),'onDelete':_0xc4df('0x10f')});db[_0xc4df('0x150')][_0xc4df('0x154')](db[_0xc4df('0x13')],{'as':_0xc4df('0x176'),'foreignKey':'OwnerId'});db[_0xc4df('0x70')][_0xc4df('0x154')](db[_0xc4df('0x6e')],{'as':_0xc4df('0x17a'),'foreignKey':_0xc4df('0x167'),'onDelete':_0xc4df('0x10f')});db['CmHopperBlack'][_0xc4df('0x154')](db['CmList'],{'as':_0xc4df('0x180'),'foreignKey':_0xc4df('0x170'),'onDelete':_0xc4df('0x10f')});db[_0xc4df('0x70')][_0xc4df('0x154')](db['VoiceQueue'],{'as':_0xc4df('0x198'),'foreignKey':_0xc4df('0x14f'),'onDelete':'cascade'});db[_0xc4df('0x70')][_0xc4df('0x154')](db[_0xc4df('0x1a7')],{'as':'Campaign','foreignKey':_0xc4df('0x1a8'),'onDelete':'cascade'});db[_0xc4df('0x7c')][_0xc4df('0x112')](db[_0xc4df('0x82')],{'as':{'plural':_0xc4df('0x1a9'),'singular':'OneAll'},'foreignKey':_0xc4df('0x1aa'),'onDelete':'cascade','hooks':!![]});db[_0xc4df('0x7c')][_0xc4df('0x112')](db['Condition'],{'as':{'plural':_0xc4df('0x1ab'),'singular':_0xc4df('0x1ac')},'foreignKey':_0xc4df('0x1ad'),'onDelete':_0xc4df('0x10f'),'hooks':!![]});db[_0xc4df('0x7c')][_0xc4df('0x112')](db[_0xc4df('0x7a')],{'as':'Actions','foreignKey':'AutomationId','onDelete':_0xc4df('0x10f'),'hooks':!![]});db[_0xc4df('0x80')]['hasMany'](db[_0xc4df('0x80')],{'as':_0xc4df('0x16b'),'foreignKey':'ParentId','onDelete':_0xc4df('0x10f')});db[_0xc4df('0x83')]['hasMany'](db[_0xc4df('0x83')],{'as':_0xc4df('0x1ae'),'foreignKey':_0xc4df('0x158'),'onDelete':_0xc4df('0x10f'),'hooks':!![],'required':![]});db[_0xc4df('0x83')]['hasMany'](db[_0xc4df('0x19')],{'as':_0xc4df('0x115'),'foreignKey':'IntervalId','onDelete':'restrict'});db[_0xc4df('0x83')]['hasMany'](db[_0xc4df('0x16f')],{'as':_0xc4df('0x1af'),'foreignKey':_0xc4df('0x158')});db['Interval'][_0xc4df('0x112')](db[_0xc4df('0x196')],{'as':'ChatApplications','foreignKey':'IntervalId'});db['Interval'][_0xc4df('0x112')](db[_0xc4df('0x183')],{'as':_0xc4df('0x1b0'),'foreignKey':_0xc4df('0x158')});db[_0xc4df('0x83')][_0xc4df('0x112')](db['SmsApplication'],{'as':_0xc4df('0x1b1'),'foreignKey':_0xc4df('0x158')});db['Schedule'][_0xc4df('0x154')](db[_0xc4df('0x3d')],{});db['Schedule'][_0xc4df('0x154')](db['AnalyticDefaultReport'],{'foreignKey':_0xc4df('0x1b2')});db[_0xc4df('0x8b')][_0xc4df('0x154')](db['AnalyticCustomReport'],{'foreignKey':_0xc4df('0x1b3')});db['Sound'][_0xc4df('0x123')](db[_0xc4df('0x1b')],{'as':_0xc4df('0x1b4'),'through':_0xc4df('0x14d'),'onDelete':'restrict'});db[_0xc4df('0x177')]['belongsToMany'](db['CmContact'],{'through':_0xc4df('0x1a4')});db[_0xc4df('0x177')][_0xc4df('0x123')](db[_0xc4df('0x129')],{'through':'chat_interaction_has_tags'});db['Tag'][_0xc4df('0x123')](db[_0xc4df('0x11c')],{'through':_0xc4df('0x178')});db[_0xc4df('0x177')][_0xc4df('0x123')](db[_0xc4df('0x18b')],{'through':_0xc4df('0x18c')});db[_0xc4df('0x177')]['belongsToMany'](db[_0xc4df('0x11b')],{'through':_0xc4df('0x187')});db[_0xc4df('0x177')][_0xc4df('0x123')](db['OpenchannelInteraction'],{'through':'openchannel_interaction_has_tags'});db[_0xc4df('0x177')][_0xc4df('0x123')](db[_0xc4df('0x102')],{'through':_0xc4df('0x1b5')});db[_0xc4df('0x90')]['belongsTo'](db[_0xc4df('0x8e')],{'as':_0xc4df('0x1b6'),'foreignKey':_0xc4df('0x1b7')});db['CmHopperAdditionalPhone'][_0xc4df('0x154')](db[_0xc4df('0x150')],{'as':_0xc4df('0x1b8'),'foreignKey':_0xc4df('0x1a6')});db[_0xc4df('0x94')]['hasMany'](db[_0xc4df('0x82')],{'as':{'plural':_0xc4df('0x1b9'),'singular':'AllCondition'},'foreignKey':_0xc4df('0x1ba'),'onDelete':_0xc4df('0x10f'),'hooks':!![]});db[_0xc4df('0x94')][_0xc4df('0x112')](db[_0xc4df('0x82')],{'as':{'plural':_0xc4df('0x1bb'),'singular':_0xc4df('0x1bc')},'foreignKey':_0xc4df('0x1bd'),'onDelete':_0xc4df('0x10f'),'hooks':!![]});db[_0xc4df('0x94')][_0xc4df('0x112')](db['Action'],{'as':'Actions','foreignKey':'TriggerId','onDelete':'cascade','hooks':!![]});db['AnalyticCustomReport'][_0xc4df('0x112')](db[_0xc4df('0xa1')],{'as':_0xc4df('0x1be'),'onDelete':_0xc4df('0x10f'),'foreignKey':'CustomReportId','hooks':!![]});db[_0xc4df('0x9c')][_0xc4df('0x112')](db['AnalyticFieldReport'],{'as':_0xc4df('0x1be'),'onDelete':_0xc4df('0x10f'),'foreignKey':_0xc4df('0x1b2')});db[_0xc4df('0x9f')][_0xc4df('0x112')](db[_0xc4df('0xa1')],{'as':_0xc4df('0x1be'),'onDelete':_0xc4df('0x10f'),'foreignKey':_0xc4df('0x1bf')});db[_0xc4df('0xa1')][_0xc4df('0x154')](db['AnalyticMetric'],{'foreignKey':_0xc4df('0x1bf')});db[_0xc4df('0xa4')][_0xc4df('0x112')](db[_0xc4df('0xa5')],{'as':_0xc4df('0x1c0'),'onDelete':_0xc4df('0x10f'),'foreignKey':_0xc4df('0x1c1')});db[_0xc4df('0xa5')][_0xc4df('0x112')](db[_0xc4df('0xa7')],{'as':_0xc4df('0x1c2'),'onDelete':'cascade','foreignKey':_0xc4df('0x1c3')});db[_0xc4df('0xa5')][_0xc4df('0x112')](db['SalesforceField'],{'as':'Descriptions','onDelete':_0xc4df('0x10f'),'foreignKey':_0xc4df('0x1c4')});db[_0xc4df('0xa5')][_0xc4df('0x112')](db[_0xc4df('0xa7')],{'as':_0xc4df('0x1be'),'onDelete':_0xc4df('0x10f'),'foreignKey':'FieldId'});db[_0xc4df('0xa5')]['belongsTo'](db['SalesforceAccount'],{'as':_0xc4df('0x175'),'foreignKey':_0xc4df('0x1c1')});db[_0xc4df('0xa7')][_0xc4df('0x112')](db[_0xc4df('0xa7')],{'as':_0xc4df('0x1c5'),'foreignKey':_0xc4df('0x1c3')});db['SalesforceField']['hasMany'](db[_0xc4df('0xa7')],{'as':_0xc4df('0x1c6'),'foreignKey':'DescriptionId'});db[_0xc4df('0xa7')][_0xc4df('0x112')](db[_0xc4df('0xa7')],{'as':_0xc4df('0x1c7'),'foreignKey':'FieldId'});db[_0xc4df('0xa7')][_0xc4df('0x154')](db[_0xc4df('0x96')],{'as':_0xc4df('0x96'),'foreignKey':'VariableId'});db['SugarcrmAccount'][_0xc4df('0x112')](db[_0xc4df('0xab')],{'as':_0xc4df('0x1c0'),'onDelete':'cascade','foreignKey':_0xc4df('0x1c1')});db[_0xc4df('0xab')]['hasMany'](db['SugarcrmField'],{'as':'Subjects','onDelete':_0xc4df('0x10f'),'foreignKey':'SubjectId'});db[_0xc4df('0xab')]['hasMany'](db[_0xc4df('0x1c8')],{'as':_0xc4df('0x1c9'),'onDelete':_0xc4df('0x10f'),'foreignKey':_0xc4df('0x1c4')});db[_0xc4df('0xab')][_0xc4df('0x112')](db[_0xc4df('0x1c8')],{'as':_0xc4df('0x1be'),'onDelete':_0xc4df('0x10f'),'foreignKey':_0xc4df('0x1ca')});db[_0xc4df('0xab')][_0xc4df('0x154')](db[_0xc4df('0xa9')],{'as':_0xc4df('0x175'),'foreignKey':_0xc4df('0x1c1')});db[_0xc4df('0x1c8')]['hasMany'](db[_0xc4df('0x1c8')],{'as':_0xc4df('0x1c5'),'foreignKey':'SubjectId'});db['SugarcrmField'][_0xc4df('0x112')](db[_0xc4df('0x1c8')],{'as':_0xc4df('0x1c6'),'foreignKey':_0xc4df('0x1c4')});db[_0xc4df('0x1c8')][_0xc4df('0x112')](db[_0xc4df('0x1c8')],{'as':_0xc4df('0x1c7'),'foreignKey':_0xc4df('0x1ca')});db[_0xc4df('0x1c8')][_0xc4df('0x154')](db[_0xc4df('0x96')],{'as':_0xc4df('0x96'),'foreignKey':_0xc4df('0x1cb')});db[_0xc4df('0xae')][_0xc4df('0x112')](db['DeskConfiguration'],{'as':_0xc4df('0x1c0'),'onDelete':_0xc4df('0x10f'),'foreignKey':'AccountId'});db['DeskConfiguration'][_0xc4df('0x112')](db[_0xc4df('0xb1')],{'as':_0xc4df('0x1c2'),'onDelete':_0xc4df('0x10f'),'foreignKey':_0xc4df('0x1c3')});db[_0xc4df('0xaf')][_0xc4df('0x112')](db[_0xc4df('0xb1')],{'as':'Descriptions','onDelete':_0xc4df('0x10f'),'foreignKey':_0xc4df('0x1c4')});db['DeskConfiguration']['hasMany'](db[_0xc4df('0xb1')],{'as':_0xc4df('0x1be'),'onDelete':_0xc4df('0x10f'),'foreignKey':_0xc4df('0x1ca')});db[_0xc4df('0xaf')][_0xc4df('0x154')](db['DeskAccount'],{'as':_0xc4df('0x175'),'foreignKey':'AccountId'});db[_0xc4df('0xaf')]['belongsToMany'](db[_0xc4df('0x177')],{'through':_0xc4df('0x1cc')});db[_0xc4df('0xb1')]['hasMany'](db[_0xc4df('0xb1')],{'as':_0xc4df('0x1c5'),'foreignKey':_0xc4df('0x1c3')});db[_0xc4df('0xb1')][_0xc4df('0x112')](db[_0xc4df('0xb1')],{'as':_0xc4df('0x1c6'),'foreignKey':_0xc4df('0x1c4')});db[_0xc4df('0xb1')][_0xc4df('0x112')](db[_0xc4df('0xb1')],{'as':'Field','foreignKey':_0xc4df('0x1ca')});db['DeskField']['belongsTo'](db[_0xc4df('0x96')],{'as':_0xc4df('0x96'),'foreignKey':'VariableId'});db['ZohoAccount']['hasMany'](db[_0xc4df('0xb4')],{'as':'Configurations','onDelete':_0xc4df('0x10f'),'foreignKey':_0xc4df('0x1c1')});db[_0xc4df('0xb4')][_0xc4df('0x112')](db[_0xc4df('0xb6')],{'as':'Subjects','onDelete':_0xc4df('0x10f'),'foreignKey':_0xc4df('0x1c3')});db['ZohoConfiguration'][_0xc4df('0x112')](db[_0xc4df('0xb6')],{'as':_0xc4df('0x1c9'),'onDelete':_0xc4df('0x10f'),'foreignKey':_0xc4df('0x1c4')});db[_0xc4df('0xb4')][_0xc4df('0x112')](db[_0xc4df('0xb6')],{'as':_0xc4df('0x1be'),'onDelete':_0xc4df('0x10f'),'foreignKey':'FieldId'});db[_0xc4df('0xb4')][_0xc4df('0x154')](db[_0xc4df('0xb2')],{'as':'Account','foreignKey':_0xc4df('0x1c1')});db['ZohoField'][_0xc4df('0x112')](db[_0xc4df('0xb6')],{'as':'Subject','foreignKey':_0xc4df('0x1c3')});db['ZohoField']['hasMany'](db['ZohoField'],{'as':_0xc4df('0x1c6'),'foreignKey':_0xc4df('0x1c4')});db['ZohoField'][_0xc4df('0x112')](db[_0xc4df('0xb6')],{'as':_0xc4df('0x1c7'),'foreignKey':_0xc4df('0x1ca')});db[_0xc4df('0xb6')][_0xc4df('0x154')](db[_0xc4df('0x96')],{'as':_0xc4df('0x96'),'foreignKey':_0xc4df('0x1cb')});db[_0xc4df('0xb8')][_0xc4df('0x112')](db[_0xc4df('0xba')],{'as':_0xc4df('0x1c0'),'onDelete':_0xc4df('0x10f'),'foreignKey':_0xc4df('0x1c1')});db[_0xc4df('0xba')][_0xc4df('0x112')](db[_0xc4df('0xbc')],{'as':_0xc4df('0x1c2'),'foreignKey':_0xc4df('0x1c3')});db[_0xc4df('0xba')]['hasMany'](db[_0xc4df('0xbc')],{'as':_0xc4df('0x1c9'),'foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0xc4df('0x112')](db[_0xc4df('0xbc')],{'as':_0xc4df('0x1be'),'foreignKey':_0xc4df('0x1ca')});db[_0xc4df('0xba')][_0xc4df('0x154')](db[_0xc4df('0xb8')],{'as':_0xc4df('0x175'),'foreignKey':'AccountId'});db[_0xc4df('0xba')][_0xc4df('0x123')](db['Tag'],{'through':_0xc4df('0x1cd')});db['ZendeskField'][_0xc4df('0x112')](db[_0xc4df('0xbc')],{'as':_0xc4df('0x1c5'),'foreignKey':_0xc4df('0x1c3')});db[_0xc4df('0xbc')][_0xc4df('0x112')](db['ZendeskField'],{'as':_0xc4df('0x1c6'),'foreignKey':'DescriptionId'});db[_0xc4df('0xbc')]['hasMany'](db[_0xc4df('0xbc')],{'as':'Field','foreignKey':_0xc4df('0x1ca')});db[_0xc4df('0xbc')][_0xc4df('0x154')](db[_0xc4df('0x96')],{'as':_0xc4df('0x96'),'foreignKey':_0xc4df('0x1cb')});db[_0xc4df('0xbe')]['hasMany'](db['FreshdeskConfiguration'],{'as':_0xc4df('0x1c0'),'onDelete':'cascade','foreignKey':_0xc4df('0x1c1')});db['FreshdeskConfiguration'][_0xc4df('0x112')](db[_0xc4df('0xc1')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0xc4df('0x1c3')});db[_0xc4df('0xbf')]['hasMany'](db['FreshdeskField'],{'as':_0xc4df('0x1c9'),'onDelete':_0xc4df('0x10f'),'foreignKey':'DescriptionId'});db['FreshdeskConfiguration']['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0xc4df('0x10f'),'foreignKey':'FieldId'});db['FreshdeskConfiguration'][_0xc4df('0x154')](db[_0xc4df('0xbe')],{'as':_0xc4df('0x175'),'foreignKey':_0xc4df('0x1c1')});db[_0xc4df('0xbf')][_0xc4df('0x123')](db[_0xc4df('0x177')],{'through':'int_freshdesk_configuration_has_tags'});db['FreshdeskField']['hasMany'](db['FreshdeskField'],{'as':_0xc4df('0x1c5'),'foreignKey':'SubjectId'});db[_0xc4df('0xc1')]['hasMany'](db[_0xc4df('0xc1')],{'as':'Description','foreignKey':_0xc4df('0x1c4')});db[_0xc4df('0xc1')][_0xc4df('0x112')](db[_0xc4df('0xc1')],{'as':_0xc4df('0x1c7'),'foreignKey':_0xc4df('0x1ca')});db[_0xc4df('0xc1')][_0xc4df('0x154')](db[_0xc4df('0x96')],{'as':'Variable','foreignKey':_0xc4df('0x1cb')});db[_0xc4df('0xc3')][_0xc4df('0x112')](db[_0xc4df('0xc4')],{'as':_0xc4df('0x1c0'),'onDelete':_0xc4df('0x10f'),'foreignKey':_0xc4df('0x1c1')});db[_0xc4df('0xc4')]['hasMany'](db[_0xc4df('0xc6')],{'as':_0xc4df('0x1c2'),'foreignKey':_0xc4df('0x1c3')});db[_0xc4df('0xc4')][_0xc4df('0x112')](db[_0xc4df('0xc6')],{'as':_0xc4df('0x1c9'),'foreignKey':_0xc4df('0x1c4')});db['VtigerConfiguration'][_0xc4df('0x112')](db[_0xc4df('0xc6')],{'as':'Fields','foreignKey':'FieldId'});db[_0xc4df('0xc4')]['belongsTo'](db[_0xc4df('0xc3')],{'as':_0xc4df('0x175'),'foreignKey':_0xc4df('0x1c1')});db[_0xc4df('0xc6')][_0xc4df('0x112')](db['VtigerField'],{'as':_0xc4df('0x1c5'),'foreignKey':_0xc4df('0x1c3')});db['VtigerField'][_0xc4df('0x112')](db[_0xc4df('0xc6')],{'as':_0xc4df('0x1c6'),'foreignKey':_0xc4df('0x1c4')});db['VtigerField']['hasMany'](db[_0xc4df('0xc6')],{'as':'Field','foreignKey':_0xc4df('0x1ca')});db[_0xc4df('0xc6')][_0xc4df('0x154')](db[_0xc4df('0x96')],{'as':_0xc4df('0x96'),'foreignKey':_0xc4df('0x1cb')});db[_0xc4df('0xc8')][_0xc4df('0x112')](db[_0xc4df('0xc9')],{'as':_0xc4df('0x1c0'),'onDelete':_0xc4df('0x10f'),'foreignKey':'AccountId'});db[_0xc4df('0xc9')][_0xc4df('0x112')](db[_0xc4df('0x1ce')],{'as':_0xc4df('0x1c2'),'foreignKey':_0xc4df('0x1c3')});db[_0xc4df('0xc9')][_0xc4df('0x112')](db[_0xc4df('0x1ce')],{'as':_0xc4df('0x1c9'),'foreignKey':_0xc4df('0x1c4')});db[_0xc4df('0xc9')]['hasMany'](db[_0xc4df('0x1ce')],{'as':'Fields','foreignKey':_0xc4df('0x1ca')});db[_0xc4df('0xc9')][_0xc4df('0x154')](db[_0xc4df('0xc8')],{'as':'Account','foreignKey':_0xc4df('0x1c1')});db[_0xc4df('0x1ce')]['hasMany'](db[_0xc4df('0x1ce')],{'as':'Subject','foreignKey':_0xc4df('0x1c3')});db[_0xc4df('0x1ce')][_0xc4df('0x112')](db[_0xc4df('0x1ce')],{'as':_0xc4df('0x1c6'),'foreignKey':_0xc4df('0x1c4')});db[_0xc4df('0x1ce')]['hasMany'](db[_0xc4df('0x1ce')],{'as':_0xc4df('0x1c7'),'foreignKey':_0xc4df('0x1ca')});db[_0xc4df('0x1ce')][_0xc4df('0x154')](db[_0xc4df('0x96')],{'as':_0xc4df('0x96'),'foreignKey':_0xc4df('0x1cb')});db['Dynamics365Account']['hasMany'](db[_0xc4df('0x1cf')],{'as':_0xc4df('0x1c0'),'onDelete':_0xc4df('0x10f'),'foreignKey':_0xc4df('0x1c1')});db['Dynamics365Configuration'][_0xc4df('0x112')](db[_0xc4df('0xcb')],{'as':_0xc4df('0x1c2'),'onDelete':_0xc4df('0x10f'),'foreignKey':_0xc4df('0x1c3')});db[_0xc4df('0x1cf')]['hasMany'](db[_0xc4df('0xcb')],{'as':_0xc4df('0x1c9'),'onDelete':_0xc4df('0x10f'),'foreignKey':'DescriptionId'});db[_0xc4df('0x1cf')][_0xc4df('0x112')](db[_0xc4df('0xcb')],{'as':_0xc4df('0x1be'),'onDelete':_0xc4df('0x10f'),'foreignKey':_0xc4df('0x1ca')});db[_0xc4df('0x1cf')][_0xc4df('0x154')](db[_0xc4df('0x1d0')],{'as':_0xc4df('0x175'),'foreignKey':_0xc4df('0x1c1')});db[_0xc4df('0xcb')]['hasMany'](db['Dynamics365Field'],{'as':_0xc4df('0x1c5'),'foreignKey':_0xc4df('0x1c3')});db[_0xc4df('0xcb')]['hasMany'](db[_0xc4df('0xcb')],{'as':_0xc4df('0x1c6'),'foreignKey':_0xc4df('0x1c4')});db['Dynamics365Field'][_0xc4df('0x112')](db[_0xc4df('0xcb')],{'as':_0xc4df('0x1c7'),'foreignKey':_0xc4df('0x1ca')});db[_0xc4df('0xcb')][_0xc4df('0x154')](db[_0xc4df('0x96')],{'as':_0xc4df('0x96'),'foreignKey':_0xc4df('0x1cb')});db[_0xc4df('0xcd')][_0xc4df('0x112')](db[_0xc4df('0x1d1')],{'as':'Configurations','onDelete':_0xc4df('0x10f'),'foreignKey':_0xc4df('0x1c1')});db[_0xc4df('0x1d1')][_0xc4df('0x112')](db[_0xc4df('0xcf')],{'as':_0xc4df('0x1c2'),'foreignKey':_0xc4df('0x1c3')});db[_0xc4df('0x1d1')][_0xc4df('0x112')](db[_0xc4df('0xcf')],{'as':_0xc4df('0x1c9'),'foreignKey':'DescriptionId'});db[_0xc4df('0x1d1')]['hasMany'](db[_0xc4df('0xcf')],{'as':_0xc4df('0x1be'),'foreignKey':'FieldId'});db['FreshsalesConfiguration'][_0xc4df('0x154')](db[_0xc4df('0xcd')],{'as':_0xc4df('0x175'),'foreignKey':_0xc4df('0x1c1')});db[_0xc4df('0xcf')][_0xc4df('0x112')](db[_0xc4df('0xcf')],{'as':'Subject','foreignKey':_0xc4df('0x1c3')});db[_0xc4df('0xcf')]['hasMany'](db[_0xc4df('0xcf')],{'as':_0xc4df('0x1c6'),'foreignKey':_0xc4df('0x1c4')});db['FreshsalesField'][_0xc4df('0x112')](db[_0xc4df('0xcf')],{'as':_0xc4df('0x1c7'),'foreignKey':'FieldId'});db[_0xc4df('0xcf')]['belongsTo'](db[_0xc4df('0x96')],{'as':'Variable','foreignKey':_0xc4df('0x1cb')});db['ChatQueueReport'][_0xc4df('0x154')](db[_0xc4df('0x5d')],{});db[_0xc4df('0xd3')]['belongsTo'](db[_0xc4df('0x126')],{'as':_0xc4df('0x180'),'foreignKey':_0xc4df('0x170')});db['ChatQueueReport'][_0xc4df('0x154')](db[_0xc4df('0x6e')],{'as':_0xc4df('0x17a'),'foreignKey':'ContactId'});db['ChatQueueReport'][_0xc4df('0x154')](db[_0xc4df('0x129')],{});db[_0xc4df('0xd3')][_0xc4df('0x154')](db[_0xc4df('0x63')],{});db[_0xc4df('0xd3')]['belongsTo'](db['User'],{});db[_0xc4df('0xd3')]['belongsTo'](db[_0xc4df('0x67')],{});db['ChatInternalMessage'][_0xc4df('0x154')](db[_0xc4df('0x13')],{'onDelete':_0xc4df('0x10f'),'foreignKey':_0xc4df('0x1d2')});db['ChatInternalMessage'][_0xc4df('0x154')](db[_0xc4df('0x13')],{'onDelete':_0xc4df('0x10f'),'foreignKey':_0xc4df('0x1d3')});db[_0xc4df('0x153')]['hasMany'](db[_0xc4df('0xd8')],{'foreignKey':_0xc4df('0x1d4'),'onDelete':_0xc4df('0x10f')});db[_0xc4df('0x153')][_0xc4df('0x112')](db[_0xc4df('0xd6')],{'foreignKey':'SessionId','onDelete':_0xc4df('0x10f')});db[_0xc4df('0xdb')]['belongsTo'](db[_0xc4df('0x145')],{});db['SmsQueueReport']['belongsTo'](db[_0xc4df('0x126')],{'as':_0xc4df('0x180'),'foreignKey':'ListId'});db[_0xc4df('0xdb')][_0xc4df('0x154')](db[_0xc4df('0x6e')],{'as':'Contact','foreignKey':_0xc4df('0x167')});db['SmsQueueReport'][_0xc4df('0x154')](db[_0xc4df('0x18b')],{});db[_0xc4df('0xdb')][_0xc4df('0x154')](db['SmsMessage'],{});db[_0xc4df('0xdb')]['belongsTo'](db['User'],{});db[_0xc4df('0xdb')][_0xc4df('0x154')](db['SmsQueue'],{});db[_0xc4df('0x1d5')]['hasMany'](db[_0xc4df('0x153')],{'foreignKey':_0xc4df('0x1d6')});db[_0xc4df('0x1d5')][_0xc4df('0x112')](db[_0xc4df('0xd8')],{'foreignKey':_0xc4df('0x1d6')});db['JscriptyProject'][_0xc4df('0x112')](db[_0xc4df('0xd6')],{'foreignKey':_0xc4df('0x1d6')});db[_0xc4df('0x1d7')][_0xc4df('0x123')](db[_0xc4df('0x13')],{'as':'Users','through':_0xc4df('0x1d8')});db['Team'][_0xc4df('0x123')](db[_0xc4df('0x13')],{'as':_0xc4df('0x15d'),'through':'user_has_teams'});db[_0xc4df('0xe6')][_0xc4df('0x123')](db['VoiceQueue'],{'through':'TeamVoiceQueue','as':_0xc4df('0x130')});db[_0xc4df('0xe6')][_0xc4df('0x123')](db[_0xc4df('0x131')],{'through':_0xc4df('0x172'),'as':'MailQueues'});db[_0xc4df('0xe6')][_0xc4df('0x123')](db[_0xc4df('0x67')],{'through':_0xc4df('0x1d9'),'as':_0xc4df('0x134')});db[_0xc4df('0xe6')][_0xc4df('0x123')](db[_0xc4df('0x4c')],{'through':_0xc4df('0x1da'),'as':_0xc4df('0x136')});db[_0xc4df('0xe6')]['belongsToMany'](db[_0xc4df('0x53')],{'through':'team_has_sms_queues','as':_0xc4df('0x137')});db[_0xc4df('0xe6')][_0xc4df('0x123')](db[_0xc4df('0x5b')],{'through':_0xc4df('0x194'),'as':_0xc4df('0x138')});db[_0xc4df('0xe6')]['belongsToMany'](db[_0xc4df('0x108')],{'through':'team_has_whatsapp_queues','as':_0xc4df('0x139')});db['Campaign'][_0xc4df('0x112')](db[_0xc4df('0x150')],{'as':_0xc4df('0x151'),'foreignKey':_0xc4df('0x1a8')});db[_0xc4df('0x1a7')]['hasMany'](db[_0xc4df('0x72')],{'as':_0xc4df('0x116'),'foreignKey':'CampaignId'});db[_0xc4df('0x1a7')]['hasMany'](db[_0xc4df('0x74')],{'as':_0xc4df('0x1a1'),'foreignKey':_0xc4df('0x1a8')});db[_0xc4df('0x1a7')]['hasMany'](db[_0xc4df('0x70')],{'as':_0xc4df('0x152'),'foreignKey':_0xc4df('0x1a8')});db[_0xc4df('0x1a7')][_0xc4df('0x154')](db['Trunk'],{'as':_0xc4df('0x2b'),'foreignKey':_0xc4df('0x155')});db['Campaign'][_0xc4df('0x154')](db[_0xc4df('0x2b')],{'as':_0xc4df('0x156'),'foreignKey':'TrunkBackupId'});db[_0xc4df('0x1a7')]['belongsTo'](db[_0xc4df('0x83')],{'as':_0xc4df('0x83'),'foreignKey':_0xc4df('0x158')});db['Campaign']['belongsTo'](db[_0xc4df('0x1d7')],{'as':_0xc4df('0x1d7'),'foreignKey':'SquareProjectId'});db[_0xc4df('0x1a7')][_0xc4df('0x123')](db['CmList'],{'as':'Lists','through':'campaigns_has_cm_lists'});db['Campaign']['belongsToMany'](db[_0xc4df('0x126')],{'as':_0xc4df('0x15e'),'through':'campaigns_has_cm_blacklists'});db[_0xc4df('0xec')][_0xc4df('0x154')](db[_0xc4df('0x65')],{'as':_0xc4df('0x65'),'foreignKey':_0xc4df('0x17d')});db[_0xc4df('0xef')][_0xc4df('0x154')](db[_0xc4df('0x41')],{});db['MailTransferReport'][_0xc4df('0x154')](db[_0xc4df('0x11c')],{});db[_0xc4df('0xef')][_0xc4df('0x154')](db[_0xc4df('0x3d')],{'foreignKey':'FromMailAccountId','as':'FromAccount'});db[_0xc4df('0xef')][_0xc4df('0x154')](db[_0xc4df('0x13')],{'foreignKey':'FromUserId','as':_0xc4df('0x1db')});db[_0xc4df('0xef')]['belongsTo'](db[_0xc4df('0x13')],{'foreignKey':_0xc4df('0x1dc'),'as':_0xc4df('0x1dd')});db['MailTransferReport']['belongsTo'](db[_0xc4df('0x131')],{'foreignKey':_0xc4df('0x1de'),'as':_0xc4df('0x1df')});db['MailTransferReport'][_0xc4df('0x154')](db[_0xc4df('0x3d')],{'foreignKey':_0xc4df('0x1e0'),'as':_0xc4df('0x1e1')});db['ChatTransferReport'][_0xc4df('0x154')](db['ChatMessage'],{});db[_0xc4df('0x1e2')]['belongsTo'](db[_0xc4df('0x129')],{});db[_0xc4df('0x1e2')]['belongsTo'](db[_0xc4df('0x5d')],{'foreignKey':_0xc4df('0x1e3'),'as':_0xc4df('0x1e4')});db['ChatTransferReport'][_0xc4df('0x154')](db[_0xc4df('0x13')],{'foreignKey':_0xc4df('0x1e5'),'as':_0xc4df('0x1db')});db[_0xc4df('0x1e2')]['belongsTo'](db[_0xc4df('0x13')],{'foreignKey':'ToUserId','as':_0xc4df('0x1dd')});db[_0xc4df('0x1e2')]['belongsTo'](db['ChatQueue'],{'foreignKey':'ToChatQueueId','as':_0xc4df('0x1df')});db[_0xc4df('0x1e2')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0xc4df('0x1e6'),'as':_0xc4df('0x1e1')});db[_0xc4df('0xf2')][_0xc4df('0x154')](db[_0xc4df('0x185')],{});db['FaxTransferReport'][_0xc4df('0x154')](db[_0xc4df('0x11b')],{});db[_0xc4df('0xf2')][_0xc4df('0x154')](db['FaxAccount'],{'foreignKey':'FromFaxAccountId','as':'FromAccount'});db[_0xc4df('0xf2')][_0xc4df('0x154')](db['User'],{'foreignKey':_0xc4df('0x1e5'),'as':_0xc4df('0x1db')});db[_0xc4df('0xf2')][_0xc4df('0x154')](db[_0xc4df('0x13')],{'foreignKey':_0xc4df('0x1dc'),'as':_0xc4df('0x1dd')});db[_0xc4df('0xf2')][_0xc4df('0x154')](db[_0xc4df('0x4c')],{'foreignKey':'ToFaxQueueId','as':'ToQueue'});db[_0xc4df('0xf2')][_0xc4df('0x154')](db[_0xc4df('0x47')],{'foreignKey':_0xc4df('0x1e7'),'as':_0xc4df('0x1e1')});db['OpenchannelTransferReport'][_0xc4df('0x154')](db[_0xc4df('0x59')],{});db[_0xc4df('0xf3')]['belongsTo'](db[_0xc4df('0x57')],{});db['OpenchannelTransferReport'][_0xc4df('0x154')](db[_0xc4df('0x54')],{'foreignKey':_0xc4df('0x1e8'),'as':'FromAccount'});db['OpenchannelTransferReport'][_0xc4df('0x154')](db[_0xc4df('0x13')],{'foreignKey':_0xc4df('0x1e5'),'as':_0xc4df('0x1db')});db[_0xc4df('0xf3')][_0xc4df('0x154')](db[_0xc4df('0x13')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xc4df('0xf3')][_0xc4df('0x154')](db[_0xc4df('0x5b')],{'foreignKey':_0xc4df('0x1e9'),'as':_0xc4df('0x1df')});db[_0xc4df('0xf3')]['belongsTo'](db[_0xc4df('0x54')],{'foreignKey':_0xc4df('0x1ea'),'as':_0xc4df('0x1e1')});db[_0xc4df('0x1eb')][_0xc4df('0x154')](db[_0xc4df('0x18a')],{});db[_0xc4df('0x1eb')][_0xc4df('0x154')](db[_0xc4df('0x18b')],{});db[_0xc4df('0x1eb')][_0xc4df('0x154')](db[_0xc4df('0x145')],{'foreignKey':'FromSmsAccountId','as':_0xc4df('0x1e4')});db[_0xc4df('0x1eb')][_0xc4df('0x154')](db[_0xc4df('0x13')],{'foreignKey':_0xc4df('0x1e5'),'as':_0xc4df('0x1db')});db['SmsTransferReport']['belongsTo'](db[_0xc4df('0x13')],{'foreignKey':_0xc4df('0x1dc'),'as':_0xc4df('0x1dd')});db[_0xc4df('0x1eb')][_0xc4df('0x154')](db[_0xc4df('0x53')],{'foreignKey':'ToSmsQueueId','as':_0xc4df('0x1df')});db[_0xc4df('0x1eb')][_0xc4df('0x154')](db[_0xc4df('0x145')],{'foreignKey':_0xc4df('0x1ec'),'as':'ToAccount'});db[_0xc4df('0x126')][_0xc4df('0x112')](db[_0xc4df('0x80')],{'as':_0xc4df('0x16b'),'foreignKey':_0xc4df('0x170'),'onDelete':_0xc4df('0x10f')});db[_0xc4df('0x126')][_0xc4df('0x112')](db[_0xc4df('0x78')],{'as':_0xc4df('0x1ed'),'foreignKey':_0xc4df('0x170')});db[_0xc4df('0x126')]['hasMany'](db[_0xc4df('0x6e')],{'as':'Contacts','onDelete':_0xc4df('0x10f'),'foreignKey':_0xc4df('0x170')});db[_0xc4df('0x126')][_0xc4df('0x112')](db[_0xc4df('0x72')],{'as':_0xc4df('0x116'),'foreignKey':_0xc4df('0x170')});db[_0xc4df('0x126')][_0xc4df('0x112')](db[_0xc4df('0x74')],{'as':_0xc4df('0x117'),'foreignKey':_0xc4df('0x170')});db['CmList'][_0xc4df('0x112')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':'ListId'});db[_0xc4df('0x126')][_0xc4df('0x123')](db['VoiceQueue'],{'as':'Queues','through':_0xc4df('0x15c')});db[_0xc4df('0x126')][_0xc4df('0x123')](db['User'],{'as':_0xc4df('0x15d'),'through':_0xc4df('0x13a')});db[_0xc4df('0xf6')][_0xc4df('0x112')](db[_0xc4df('0x19')],{'as':_0xc4df('0x115'),'onDelete':_0xc4df('0x10f')});db[_0xc4df('0xf6')][_0xc4df('0x123')](db['User'],{'as':'Agents','through':_0xc4df('0x13c')});db['UserProfile']['hasMany'](db[_0xc4df('0x13')],{'as':_0xc4df('0x18e'),'foreignKey':_0xc4df('0x121')});db[_0xc4df('0xf8')][_0xc4df('0x112')](db[_0xc4df('0xfa')],{'as':'UserProfileSections','foreignKey':_0xc4df('0x121'),'onDelete':_0xc4df('0x10f')});db[_0xc4df('0xfa')]['hasMany'](db[_0xc4df('0xfc')],{'as':_0xc4df('0x1ee'),'foreignKey':_0xc4df('0x1ef'),'onDelete':_0xc4df('0x10f')});db[_0xc4df('0xfe')][_0xc4df('0x112')](db[_0xc4df('0x80')],{'as':'Dispositions','foreignKey':_0xc4df('0x1f0'),'onDelete':_0xc4df('0x10f')});db['WhatsappAccount'][_0xc4df('0x112')](db[_0xc4df('0x7e')],{'as':_0xc4df('0x16c'),'foreignKey':_0xc4df('0x1f0')});db[_0xc4df('0xfe')][_0xc4df('0x112')](db[_0xc4df('0x104')],{'as':_0xc4df('0x16d'),'foreignKey':_0xc4df('0x1f0')});db['WhatsappAccount'][_0xc4df('0x112')](db[_0xc4df('0x102')],{'as':_0xc4df('0x16e')});db[_0xc4df('0xfe')][_0xc4df('0x112')](db[_0xc4df('0x100')],{'as':_0xc4df('0x14b')});db[_0xc4df('0xfe')][_0xc4df('0x154')](db['CmList'],{'as':_0xc4df('0x180'),'foreignKey':_0xc4df('0x170')});db[_0xc4df('0xfe')][_0xc4df('0x154')](db[_0xc4df('0x85')],{'as':_0xc4df('0x159'),'foreignKey':'mandatoryDispositionPauseId'});db['WhatsappAccount'][_0xc4df('0x123')](db[_0xc4df('0x13')],{'as':_0xc4df('0x15d'),'through':_0xc4df('0x149')});db[_0xc4df('0x100')][_0xc4df('0x154')](db[_0xc4df('0x13')],{'onDelete':'restrict'});db[_0xc4df('0x100')][_0xc4df('0x154')](db[_0xc4df('0x108')],{'onDelete':'restrict'});db[_0xc4df('0x100')]['belongsTo'](db[_0xc4df('0xfe')],{'onDelete':_0xc4df('0x17e')});db[_0xc4df('0x100')][_0xc4df('0x154')](db[_0xc4df('0x83')],{'onDelete':'restrict','foreignKey':_0xc4df('0x158')});db['WhatsappApplication'][_0xc4df('0x154')](db[_0xc4df('0x177')],{'onDelete':'restrict','foreignKey':_0xc4df('0x17f')});db[_0xc4df('0x102')][_0xc4df('0x112')](db[_0xc4df('0x104')],{'as':_0xc4df('0x16d'),'onDelete':'cascade','foreignKey':'WhatsappInteractionId'});db[_0xc4df('0x102')][_0xc4df('0x154')](db[_0xc4df('0xfe')],{'as':_0xc4df('0x175'),'foreignKey':_0xc4df('0x1f0')});db[_0xc4df('0x102')][_0xc4df('0x154')](db[_0xc4df('0x6e')],{'as':_0xc4df('0x17a'),'foreignKey':_0xc4df('0x167')});db['WhatsappInteraction'][_0xc4df('0x154')](db[_0xc4df('0x13')],{'as':_0xc4df('0x176'),'foreignKey':_0xc4df('0x110')});db[_0xc4df('0x102')][_0xc4df('0x123')](db[_0xc4df('0x177')],{'through':_0xc4df('0x1b5'),'as':'Tags'});db['WhatsappInteraction']['belongsToMany'](db[_0xc4df('0x177')],{'through':_0xc4df('0x1b5'),'as':'ThroughTags'});db[_0xc4df('0x102')][_0xc4df('0x123')](db['User'],{'as':'Users','through':'user_has_whatsapp_interactions','foreignKey':'WhatsappInteractionId'});db['WhatsappMessage'][_0xc4df('0x154')](db[_0xc4df('0x13')],{'as':_0xc4df('0x13')});db[_0xc4df('0x104')][_0xc4df('0x154')](db[_0xc4df('0x6e')],{'onDelete':_0xc4df('0x10f'),'as':_0xc4df('0x17a')});db[_0xc4df('0x104')]['belongsTo'](db[_0xc4df('0x102')],{'onDelete':_0xc4df('0x10f'),'as':_0xc4df('0x17b'),'foreignKey':_0xc4df('0x1f1')});db[_0xc4df('0x104')][_0xc4df('0x154')](db['WhatsappAccount'],{'as':_0xc4df('0x175'),'foreignKey':_0xc4df('0x1f0')});db[_0xc4df('0x106')][_0xc4df('0x154')](db[_0xc4df('0xfe')],{});db['WhatsappQueueReport']['belongsTo'](db[_0xc4df('0x126')],{'as':_0xc4df('0x180'),'foreignKey':_0xc4df('0x170')});db[_0xc4df('0x106')]['belongsTo'](db[_0xc4df('0x6e')],{'as':_0xc4df('0x17a'),'foreignKey':_0xc4df('0x167')});db[_0xc4df('0x106')][_0xc4df('0x154')](db[_0xc4df('0x102')],{});db[_0xc4df('0x106')][_0xc4df('0x154')](db[_0xc4df('0x108')],{});db[_0xc4df('0x106')][_0xc4df('0x154')](db[_0xc4df('0x104')],{});db['WhatsappQueueReport']['belongsTo'](db[_0xc4df('0x13')],{});db['WhatsappTransferReport']['belongsTo'](db[_0xc4df('0x104')],{});db['WhatsappTransferReport'][_0xc4df('0x154')](db[_0xc4df('0x102')],{});db['WhatsappTransferReport'][_0xc4df('0x154')](db[_0xc4df('0xfe')],{'foreignKey':_0xc4df('0x1f2'),'as':'FromAccount'});db[_0xc4df('0x1f3')][_0xc4df('0x154')](db[_0xc4df('0xfe')],{'foreignKey':'ToWhatsappAccountId','as':_0xc4df('0x1e1')});db['WhatsappTransferReport']['belongsTo'](db[_0xc4df('0x108')],{'foreignKey':_0xc4df('0x1f4'),'as':_0xc4df('0x1df')});db[_0xc4df('0x1f3')]['belongsTo'](db[_0xc4df('0x13')],{'foreignKey':_0xc4df('0x1e5'),'as':_0xc4df('0x1db')});db[_0xc4df('0x1f3')][_0xc4df('0x154')](db[_0xc4df('0x13')],{'foreignKey':'ToUserId','as':_0xc4df('0x1dd')});db[_0xc4df('0x108')][_0xc4df('0x123')](db[_0xc4df('0x13')],{'as':_0xc4df('0x15d'),'through':_0xc4df('0x38'),'foreignKey':'WhatsappQueueId'});db['WhatsappQueue']['belongsToMany'](db[_0xc4df('0xe6')],{'through':_0xc4df('0x1f5'),'as':_0xc4df('0x173')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xc74b=['user_has_fax_interactions','SmsAccountId','CannedAnswer','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','openchannel_interaction_has_tags','OpenchannelInteractionId','AttachmentId','OpenchannelQueueId','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','Attachments','ChatOfflineMessageId','team_has_chat_queues','ChatInternalMessage','ChatGroupId','Contacts','CompanyId','Phones','CmContactId','CmHopper','HopperHistories','Company','cm_contact_has_tags','AdditionalPhones','CmHopperId','CampaignId','All','Any','OneAny','AutomationAnyId','Actions','AutomationId','Intervals','MailApplications','ChatApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Trigger','Condition','AllConditions','AllCondition','AnyConditions','AnyCondition','Action','TriggerId','Fields','MetricId','SalesforceAccount','SalesforceConfiguration','Configurations','AccountId','SalesforceField','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','Field','VariableId','DeskAccount','int_desk_configuration_has_tags','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','FreshdeskField','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowConfiguration','Dynamics365Field','ChatQueueReport','FromId','ToId','JscriptyAnswerReport','SessionId','ProjectId','MailQueues','team_has_fax_queues','SmsQueues','team_has_whatsapp_queues','TrunkId','TrunkBackup','SquareProjectId','campaigns_has_cm_lists','BlackLists','campaigns_has_cm_blacklists','FromMailAccountId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromAccount','FromUserId','ToChatQueueId','ToChatWebsiteId','FaxTransferReport','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsAccountId','CustomFields','HopperHistory','user_has_voice_prefixes','UserProfileSections','Resources','sectionId','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','WhatsappQueueId','exports','path','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','mysql','utf8mb4','name','utf8','sequelizeHistory','127.0.0.1','utf8_general_ci','database','username','password','options','User','import','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','VoiceAgentReport','VoiceQueueReport','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','SmsMessage','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','OpenchannelAccount','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Automation','Disposition','../api/disposition/disposition.model','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/integration/integration.model','Network','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','JscriptySessionReport','SmsQueueReport','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','../api/userNotification/userNotification.model','WhatsappAccount','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','Realtime','../api/realtime/realtime.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','hasOne','cascade','UserId','hasMany','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteraction','WhatsappInteractions','UserNotification','UserNotifications','userProfileId','belongsToMany','ChatGroup','chat_group_has_users','cm_user_has_contacts','Lists','user_has_teams','MailInteractions','user_has_chat_interactions','FaxInteractions','SmsInteractions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','UserMailQueue','UserChatQueue','FaxQueues','SmsQueue','OpenchannelQueue','OpenchannelQueues','WhatsappQueues','CmList','cm_user_has_lists','VoicePrefixes','ChatWebsite','ChatWebsites','user_has_chat_websites','FaxAccount','MailAccount','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','SquareProject','SquareProjects','user_has_square_projects','VoiceChanSpy','SpiedAgents','Applications','VoiceMusicOnHold','Sounds','moh_has_sounds','VoiceQueueId','Hoppers','ReportAgentPreview','HopperBlacks','JscriptySessions','belongsTo','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','VoiceRecording','ScreenRecording','Messages','mailbox','QueueCalls','AgentReports','uniqueid','MailServerIn','MailAccountId','Imap','Smtp','Dispositions','Answers','Interactions','List','ListId','TemplateId','mandatoryDispositionPause','team_has_mail_queues','Account','ContactId','Owner','mail_interaction_has_tags','Tags','ThroughTags','user_has_mail_interactions','Contact','Interaction','MailInteractionId','ChatWebsiteId','restrict','TagId','Exntensions','user_has_fax_accounts','FaxInteractionId','FaxAccountId','fax_interaction_has_tags','Users'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xc74b,0x88));var _0xbc74=function(_0x283ddd,_0xd857f8){_0x283ddd=_0x283ddd-0x0;var _0xb68a69=_0xc74b[_0x283ddd];return _0xb68a69;};'use strict';var path=require(_0xbc74('0x0'));var config=require('../config/environment');var Sequelize=require(_0xbc74('0x1'));var _=require(_0xbc74('0x2'));var jstz=require(_0xbc74('0x3'));var timezone=jstz[_0xbc74('0x4')]();config[_0xbc74('0x1')]=_[_0xbc74('0x5')](config[_0xbc74('0x1')],{'database':_0xbc74('0x6'),'username':_0xbc74('0x7'),'password':_0xbc74('0x8'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xbc74('0x9'),'dialectOptions':{'charset':_0xbc74('0xa')},'logging':![],'timezone':timezone[_0xbc74('0xb')](),'define':{'charset':_0xbc74('0xc'),'collate':'utf8_general_ci'}}});config[_0xbc74('0xd')]=_[_0xbc74('0x5')](config[_0xbc74('0xd')],{'database':_0xbc74('0x6'),'username':'xcall','password':'xC@LL1234','options':{'host':_0xbc74('0xe'),'port':0xcea,'dialect':_0xbc74('0x9'),'dialectOptions':{'charset':_0xbc74('0xa')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xbc74('0xc'),'collate':_0xbc74('0xf')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0xbc74('0x10')],config['sequelize'][_0xbc74('0x11')],config['sequelize'][_0xbc74('0x12')],config[_0xbc74('0x1')][_0xbc74('0x13')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xbc74('0xd')][_0xbc74('0x10')],config[_0xbc74('0xd')]['username'],config['sequelizeHistory']['password'],config['sequelizeHistory']['options'])};db[_0xbc74('0x14')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0x16'));db['VoiceChanSpy']=db['sequelize'][_0xbc74('0x15')](_0xbc74('0x17'));db[_0xbc74('0x18')]=db['sequelize'][_0xbc74('0x15')](_0xbc74('0x19'));db[_0xbc74('0x1a')]=db[_0xbc74('0x1')]['import'](_0xbc74('0x1b'));db['VoiceMusicOnHold']=db[_0xbc74('0x1')]['import']('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0xbc74('0x1c')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0x1d'));db['VoiceRecording']=db['sequelize'][_0xbc74('0x15')](_0xbc74('0x1e'));db['ScreenRecording']=db[_0xbc74('0x1')][_0xbc74('0x15')]('../api/screenRecording/screenRecording.model');db[_0xbc74('0x1f')]=db['sequelize'][_0xbc74('0x15')](_0xbc74('0x20'));db[_0xbc74('0x21')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0x22'));db[_0xbc74('0x23')]=db['sequelize']['import'](_0xbc74('0x24'));db[_0xbc74('0x25')]=db[_0xbc74('0x1')][_0xbc74('0x15')]('../api/voiceDialReport/voiceDialReport.model');db[_0xbc74('0x26')]=db[_0xbc74('0x1')][_0xbc74('0x15')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0xbc74('0x27')]=db[_0xbc74('0x1')][_0xbc74('0x15')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0xbc74('0x28')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0x29'));db[_0xbc74('0x2a')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0x2b'));db['VoiceTransferReport']=db[_0xbc74('0x1')][_0xbc74('0x15')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0xbc74('0x2c')]=db['sequelize']['import']('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0xbc74('0x2d')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0x2e'));db['UserChatQueue']=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0x2f'));db['UserMailQueue']=db[_0xbc74('0x1')][_0xbc74('0x15')]('../api/userMailQueue/userMailQueue.model');db[_0xbc74('0x30')]=db[_0xbc74('0x1')]['import'](_0xbc74('0x31'));db[_0xbc74('0x32')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0x33'));db[_0xbc74('0x34')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0x35'));db[_0xbc74('0x36')]=db[_0xbc74('0x1')][_0xbc74('0x15')]('../api/userWhatsappQueue/userWhatsappQueue.model');db['MailServerIn']=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0x37'));db[_0xbc74('0x38')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0x39'));db['MailAccount']=db[_0xbc74('0x1')]['import'](_0xbc74('0x3a'));db[_0xbc74('0x3b')]=db[_0xbc74('0x1')][_0xbc74('0x15')]('../api/mailQueue/mailQueue.model');db[_0xbc74('0x3c')]=db[_0xbc74('0x1')][_0xbc74('0x15')]('../api/mailSubstatus/mailSubstatus.model');db[_0xbc74('0x3d')]=db['sequelize']['import'](_0xbc74('0x3e'));db[_0xbc74('0x3f')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0x40'));db[_0xbc74('0x41')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0x42'));db[_0xbc74('0x43')]=db['sequelize'][_0xbc74('0x15')](_0xbc74('0x44'));db[_0xbc74('0x45')]=db[_0xbc74('0x1')][_0xbc74('0x15')]('../api/dashboard/dashboard.model');db[_0xbc74('0x46')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0x47'));db['FaxAccount']=db[_0xbc74('0x1')][_0xbc74('0x15')]('../api/faxAccount/faxAccount.model');db[_0xbc74('0x48')]=db['sequelize'][_0xbc74('0x15')](_0xbc74('0x49'));db[_0xbc74('0x4a')]=db[_0xbc74('0x1')]['import'](_0xbc74('0x4b'));db[_0xbc74('0x4c')]=db['sequelize'][_0xbc74('0x15')]('../api/faxMessage/faxMessage.model');db[_0xbc74('0x4d')]=db['sequelize'][_0xbc74('0x15')](_0xbc74('0x4e'));db[_0xbc74('0x4f')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0x50'));db[_0xbc74('0x51')]=db[_0xbc74('0x1')][_0xbc74('0x15')]('../api/smsAccount/smsAccount.model');db[_0xbc74('0x52')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0x53'));db['SmsInteraction']=db[_0xbc74('0x1')][_0xbc74('0x15')]('../api/smsInteraction/smsInteraction.model');db[_0xbc74('0x54')]=db[_0xbc74('0x1')]['import'](_0xbc74('0x55'));db['SmsQueue']=db[_0xbc74('0x1')]['import'](_0xbc74('0x56'));db[_0xbc74('0x57')]=db[_0xbc74('0x1')][_0xbc74('0x15')]('../api/openchannelAccount/openchannelAccount.model');db[_0xbc74('0x58')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0x59'));db[_0xbc74('0x5a')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0x5b'));db[_0xbc74('0x5c')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0x5d'));db['OpenchannelQueue']=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0x5e'));db['ChatWebsite']=db['sequelize'][_0xbc74('0x15')](_0xbc74('0x5f'));db[_0xbc74('0x60')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0xbc74('0x61')]=db[_0xbc74('0x1')][_0xbc74('0x15')]('../api/chatApplication/chatApplication.model');db[_0xbc74('0x62')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0x63'));db[_0xbc74('0x64')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0x65'));db[_0xbc74('0x66')]=db['sequelize']['import'](_0xbc74('0x67'));db[_0xbc74('0x68')]=db[_0xbc74('0x1')]['import']('../api/chatQueue/chatQueue.model');db['ChatGroup']=db['sequelize']['import'](_0xbc74('0x69'));db[_0xbc74('0x6a')]=db['sequelize'][_0xbc74('0x15')](_0xbc74('0x6b'));db[_0xbc74('0x6c')]=db[_0xbc74('0x1')]['import'](_0xbc74('0x6d'));db[_0xbc74('0x6e')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0x6f'));db['CmHopper']=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0x70'));db[_0xbc74('0x71')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0x72'));db[_0xbc74('0x73')]=db[_0xbc74('0x1')]['import'](_0xbc74('0x74'));db['CmHopperHistory']=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0x75'));db['ReportAgentPreview']=db['sequelize'][_0xbc74('0x15')](_0xbc74('0x76'));db[_0xbc74('0x77')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0x78'));db['Action']=db[_0xbc74('0x1')]['import']('../api/action/action.model');db[_0xbc74('0x79')]=db[_0xbc74('0x1')][_0xbc74('0x15')]('../api/automation/automation.model');db['CannedAnswer']=db[_0xbc74('0x1')][_0xbc74('0x15')]('../api/cannedAnswer/cannedAnswer.model');db[_0xbc74('0x7a')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0x7b'));db['Condition']=db[_0xbc74('0x1')]['import'](_0xbc74('0x7c'));db[_0xbc74('0x7d')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0x7e'));db[_0xbc74('0x7f')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0x80'));db[_0xbc74('0x81')]=db[_0xbc74('0x1')][_0xbc74('0x15')]('../api/cdr/cdr.model');db[_0xbc74('0x82')]=db[_0xbc74('0x1')]['import'](_0xbc74('0x83'));db[_0xbc74('0x84')]=db['sequelize'][_0xbc74('0x15')](_0xbc74('0x85'));db[_0xbc74('0x86')]=db['sequelize'][_0xbc74('0x15')](_0xbc74('0x87'));db[_0xbc74('0x88')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0x89'));db[_0xbc74('0x8a')]=db[_0xbc74('0x1')][_0xbc74('0x15')]('../api/contactItemType/contactItemType.model');db[_0xbc74('0x8b')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0x8c'));db[_0xbc74('0x8d')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0x8e'));db[_0xbc74('0x8f')]=db['sequelize']['import'](_0xbc74('0x90'));db['Trigger']=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0x91'));db[_0xbc74('0x92')]=db[_0xbc74('0x1')]['import'](_0xbc74('0x93'));db[_0xbc74('0x94')]=db[_0xbc74('0x1')][_0xbc74('0x15')]('../api/integration/integration.model');db['IntegrationReport']=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0x95'));db[_0xbc74('0x96')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0x97'));db[_0xbc74('0x98')]=db['sequelize']['import'](_0xbc74('0x99'));db[_0xbc74('0x9a')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0x9b'));db[_0xbc74('0x9c')]=db[_0xbc74('0x1')]['import'](_0xbc74('0x9d'));db[_0xbc74('0x9e')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0x9f'));db[_0xbc74('0xa0')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0xa1'));db['SalesforceAccount']=db[_0xbc74('0x1')]['import']('../api/intSalesforceAccount/intSalesforceAccount.model');db['SalesforceConfiguration']=db[_0xbc74('0x1')]['import'](_0xbc74('0xa2'));db['SalesforceField']=db[_0xbc74('0x1')]['import'](_0xbc74('0xa3'));db[_0xbc74('0xa4')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0xa5'));db[_0xbc74('0xa6')]=db[_0xbc74('0x1')]['import'](_0xbc74('0xa7'));db[_0xbc74('0xa8')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0xa9'));db['DeskAccount']=db[_0xbc74('0x1')][_0xbc74('0x15')]('../api/intDeskAccount/intDeskAccount.model');db[_0xbc74('0xaa')]=db['sequelize']['import'](_0xbc74('0xab'));db[_0xbc74('0xac')]=db[_0xbc74('0x1')][_0xbc74('0x15')]('../api/intDeskField/intDeskField.model');db[_0xbc74('0xad')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0xae'));db[_0xbc74('0xaf')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0xb0'));db[_0xbc74('0xb1')]=db[_0xbc74('0x1')]['import'](_0xbc74('0xb2'));db[_0xbc74('0xb3')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0xb4'));db[_0xbc74('0xb5')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0xb6'));db[_0xbc74('0xb7')]=db[_0xbc74('0x1')][_0xbc74('0x15')]('../api/intZendeskField/intZendeskField.model');db['FreshdeskAccount']=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0xb8'));db['FreshdeskConfiguration']=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0xb9'));db['FreshdeskField']=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0xba'));db['VtigerAccount']=db[_0xbc74('0x1')][_0xbc74('0x15')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0xbc74('0xbb')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0xbc'));db[_0xbc74('0xbd')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0xbe'));db[_0xbc74('0xbf')]=db[_0xbc74('0x1')][_0xbc74('0x15')]('../api/intServicenowAccount/intServicenowAccount.model');db['ServicenowConfiguration']=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0xc0'));db[_0xbc74('0xc1')]=db['sequelize'][_0xbc74('0x15')](_0xbc74('0xc2'));db[_0xbc74('0xc3')]=db[_0xbc74('0x1')][_0xbc74('0x15')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0xbc74('0xc4')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0xc5'));db['Dynamics365Field']=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0xc6'));db[_0xbc74('0xc7')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0xc8'));db[_0xbc74('0xc9')]=db[_0xbc74('0x1')]['import'](_0xbc74('0xca'));db[_0xbc74('0xcb')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0xcc'));db[_0xbc74('0x94')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0xcd'));db[_0xbc74('0xce')]=db[_0xbc74('0x1')][_0xbc74('0x15')]('../api/network/network.model');db['ChatQueueReport']=db['sequelize'][_0xbc74('0x15')](_0xbc74('0xcf'));db['ChatInternalMessage']=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0xd0'));db['JscriptyAnswerReport']=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0xd1'));db[_0xbc74('0xd2')]=db['sequelize'][_0xbc74('0x15')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0xbc74('0xd3')]=db[_0xbc74('0x1')]['import']('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0xbc74('0xd4')]=db['sequelize'][_0xbc74('0x15')]('../api/smsQueueReport/smsQueueReport.model');db[_0xbc74('0xd5')]=db['sequelize'][_0xbc74('0x15')](_0xbc74('0xd6'));db[_0xbc74('0xd7')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0xd8'));db[_0xbc74('0xd9')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0xda'));db[_0xbc74('0xdb')]=db['sequelize'][_0xbc74('0x15')]('../api/setting/setting.model');db['SquareOdbc']=db['sequelize'][_0xbc74('0x15')]('../api/squareOdbc/squareOdbc.model');db['SquareProject']=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0xdc'));db[_0xbc74('0xdd')]=db[_0xbc74('0x1')][_0xbc74('0x15')]('../api/squareRecording/squareRecording.model');db[_0xbc74('0xde')]=db['sequelize']['import'](_0xbc74('0xdf'));db[_0xbc74('0xe0')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0xe1'));db['License']=db[_0xbc74('0x1')]['import'](_0xbc74('0xe2'));db[_0xbc74('0xe3')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0xe4'));db[_0xbc74('0xe5')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0xe6'));db[_0xbc74('0xe7')]=db['sequelize'][_0xbc74('0x15')](_0xbc74('0xe8'));db[_0xbc74('0xe9')]=db['sequelize']['import'](_0xbc74('0xea'));db[_0xbc74('0xeb')]=db[_0xbc74('0x1')]['import']('../api/mailTransferReport/mailTransferReport.model');db[_0xbc74('0xec')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0xed'));db['FaxTransferReport']=db[_0xbc74('0x1')]['import']('../api/faxTransferReport/faxTransferReport.model');db[_0xbc74('0xee')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0xef'));db[_0xbc74('0xf0')]=db[_0xbc74('0x1')]['import'](_0xbc74('0xf1'));db['CmList']=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0xf2'));db[_0xbc74('0xf3')]=db[_0xbc74('0x1')]['import'](_0xbc74('0xf4'));db[_0xbc74('0xf5')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0xf6'));db[_0xbc74('0xf7')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0xf8'));db[_0xbc74('0xf9')]=db[_0xbc74('0x1')]['import'](_0xbc74('0xfa'));db['UserNotification']=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0xfb'));db[_0xbc74('0xfc')]=db[_0xbc74('0x1')][_0xbc74('0x15')]('../api/whatsappAccount/whatsappAccount.model');db[_0xbc74('0xfd')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0xfe'));db[_0xbc74('0xff')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0x100'));db[_0xbc74('0x101')]=db['sequelize'][_0xbc74('0x15')](_0xbc74('0x102'));db[_0xbc74('0x103')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0x104'));db['WhatsappTransferReport']=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0x105'));db[_0xbc74('0x106')]=db['sequelize'][_0xbc74('0x15')](_0xbc74('0x107'));db['CloudProvider']=db[_0xbc74('0x1')]['import']('../api/cloudProvider/cloudProvider.model');db[_0xbc74('0x108')]=db[_0xbc74('0x1')]['import'](_0xbc74('0x109'));db[_0xbc74('0x10a')]=db[_0xbc74('0x1')][_0xbc74('0x15')](_0xbc74('0x10b'));db['User'][_0xbc74('0x10c')](db[_0xbc74('0x1f')],{'as':'VoiceMail','onDelete':_0xbc74('0x10d'),'foreignKey':_0xbc74('0x10e')});db['User'][_0xbc74('0x10f')](db['VoiceRecording'],{'as':'Recordings','foreignKey':'UserId'});db['User']['hasMany'](db[_0xbc74('0x2c')],{'as':_0xbc74('0x110'),'foreignKey':_0xbc74('0x10e')});db[_0xbc74('0x14')][_0xbc74('0x10f')](db[_0xbc74('0x1a')],{'as':_0xbc74('0x111'),'onDelete':_0xbc74('0x10d'),'hooks':!![]});db[_0xbc74('0x14')][_0xbc74('0x10f')](db['CmHopperFinal'],{'as':_0xbc74('0x112'),'foreignKey':_0xbc74('0x10e')});db[_0xbc74('0x14')][_0xbc74('0x10f')](db[_0xbc74('0x113')],{'as':'HopperHistory','foreignKey':_0xbc74('0x10e')});db[_0xbc74('0x14')][_0xbc74('0x10f')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0xbc74('0x10e')});db[_0xbc74('0x14')][_0xbc74('0x10f')](db[_0xbc74('0x5a')],{'as':_0xbc74('0x114'),'foreignKey':'UserId'});db['User']['hasMany'](db[_0xbc74('0x62')],{'as':_0xbc74('0x115'),'foreignKey':'UserId'});db[_0xbc74('0x14')][_0xbc74('0x10f')](db[_0xbc74('0x116')],{'as':'SmsInteractions','foreignKey':_0xbc74('0x10e')});db[_0xbc74('0x14')][_0xbc74('0x10f')](db['FaxInteraction'],{'as':'FaxInteractions','foreignKey':_0xbc74('0x10e')});db['User'][_0xbc74('0x10f')](db['MailInteraction'],{'as':'MailInteractions','foreignKey':_0xbc74('0x10e')});db['User'][_0xbc74('0x10f')](db[_0xbc74('0xff')],{'as':_0xbc74('0x117'),'foreignKey':_0xbc74('0x10e')});db[_0xbc74('0x14')][_0xbc74('0x10f')](db[_0xbc74('0x118')],{'as':_0xbc74('0x119'),'foreignKey':'SenderId'});db[_0xbc74('0x14')]['belongsTo'](db[_0xbc74('0xf5')],{'as':_0xbc74('0xf5'),'foreignKey':_0xbc74('0x11a')});db[_0xbc74('0x14')][_0xbc74('0x11b')](db[_0xbc74('0x11c')],{'as':'Groups','through':_0xbc74('0x11d')});db[_0xbc74('0x14')]['belongsToMany'](db[_0xbc74('0x6e')],{'as':'Contacts','through':_0xbc74('0x11e')});db['User']['belongsToMany'](db['CmList'],{'as':_0xbc74('0x11f'),'through':'cm_user_has_lists'});db['User'][_0xbc74('0x11b')](db[_0xbc74('0xe0')],{'through':_0xbc74('0x120')});db[_0xbc74('0x14')][_0xbc74('0x11b')](db[_0xbc74('0x3d')],{'as':_0xbc74('0x121'),'through':'user_has_mail_interactions'});db['User'][_0xbc74('0x11b')](db[_0xbc74('0x62')],{'as':_0xbc74('0x115'),'through':_0xbc74('0x122')});db['User'][_0xbc74('0x11b')](db[_0xbc74('0x4a')],{'as':_0xbc74('0x123'),'through':'user_has_fax_interactions'});db[_0xbc74('0x14')][_0xbc74('0x11b')](db['SmsInteraction'],{'as':_0xbc74('0x124'),'through':_0xbc74('0x125')});db[_0xbc74('0x14')][_0xbc74('0x11b')](db[_0xbc74('0x5a')],{'as':_0xbc74('0x114'),'through':_0xbc74('0x126')});db[_0xbc74('0x14')][_0xbc74('0x11b')](db['WhatsappInteraction'],{'as':'WhatsappInteractions','through':_0xbc74('0x127')});db[_0xbc74('0x14')][_0xbc74('0x11b')](db[_0xbc74('0x1c')],{'as':_0xbc74('0x128'),'through':_0xbc74('0x2d'),'required':![]});db[_0xbc74('0x14')]['belongsToMany'](db[_0xbc74('0x3b')],{'as':'MailQueues','through':_0xbc74('0x129'),'required':![]});db[_0xbc74('0x14')]['belongsToMany'](db[_0xbc74('0x68')],{'as':'ChatQueues','through':_0xbc74('0x12a'),'required':![],'hooks':!![]});db['User']['belongsToMany'](db[_0xbc74('0x4d')],{'as':_0xbc74('0x12b'),'through':_0xbc74('0x30'),'required':![]});db[_0xbc74('0x14')][_0xbc74('0x11b')](db[_0xbc74('0x12c')],{'as':'SmsQueues','through':_0xbc74('0x32'),'required':![]});db[_0xbc74('0x14')][_0xbc74('0x11b')](db[_0xbc74('0x12d')],{'as':_0xbc74('0x12e'),'through':_0xbc74('0x34'),'required':![]});db[_0xbc74('0x14')][_0xbc74('0x11b')](db[_0xbc74('0x106')],{'as':_0xbc74('0x12f'),'through':_0xbc74('0x36'),'required':![]});db[_0xbc74('0x14')][_0xbc74('0x11b')](db[_0xbc74('0x130')],{'through':_0xbc74('0x131')});db[_0xbc74('0x14')]['belongsToMany'](db[_0xbc74('0xf3')],{'as':_0xbc74('0x132'),'through':'user_has_voice_prefixes','required':![]});db[_0xbc74('0x14')][_0xbc74('0x11b')](db[_0xbc74('0x133')],{'as':_0xbc74('0x134'),'through':_0xbc74('0x135')});db['User'][_0xbc74('0x11b')](db[_0xbc74('0x136')],{'as':'FaxAccounts','through':'user_has_fax_accounts'});db['User']['belongsToMany'](db[_0xbc74('0x137')],{'as':_0xbc74('0x138'),'through':_0xbc74('0x139')});db[_0xbc74('0x14')][_0xbc74('0x11b')](db['OpenchannelAccount'],{'as':_0xbc74('0x13a'),'through':_0xbc74('0x13b')});db[_0xbc74('0x14')][_0xbc74('0x11b')](db[_0xbc74('0x51')],{'as':_0xbc74('0x13c'),'through':_0xbc74('0x13d')});db[_0xbc74('0x14')][_0xbc74('0x11b')](db[_0xbc74('0xfc')],{'as':'WhatsappAccounts','through':'user_has_whatsapp_accounts'});db[_0xbc74('0x14')][_0xbc74('0x11b')](db[_0xbc74('0x13e')],{'as':_0xbc74('0x13f'),'through':_0xbc74('0x140')});db[_0xbc74('0x141')]['hasMany'](db[_0xbc74('0x1a')],{'as':_0xbc74('0x142'),'onDelete':'cascade','foreignKey':'ChanSpyId'});db[_0xbc74('0x18')][_0xbc74('0x10f')](db[_0xbc74('0x1a')],{'onDelete':'cascade'});db['VoiceExtension']['hasMany'](db[_0xbc74('0x1a')],{'as':_0xbc74('0x143'),'onDelete':'cascade'});db[_0xbc74('0x144')][_0xbc74('0x11b')](db['Sound'],{'as':_0xbc74('0x145'),'through':_0xbc74('0x146')});db[_0xbc74('0x1c')][_0xbc74('0x10f')](db['UserVoiceQueueRt'],{'as':'Members','foreignKey':_0xbc74('0x147')});db['VoiceQueue'][_0xbc74('0x10f')](db['CmHopper'],{'as':_0xbc74('0x148'),'foreignKey':_0xbc74('0x147')});db[_0xbc74('0x1c')]['hasMany'](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':'VoiceQueueId'});db[_0xbc74('0x1c')][_0xbc74('0x10f')](db[_0xbc74('0x113')],{'as':'HopperHistories','foreignKey':_0xbc74('0x147')});db[_0xbc74('0x1c')][_0xbc74('0x10f')](db[_0xbc74('0x149')],{'as':'ReportAgentPreview','foreignKey':'VoiceQueueId'});db[_0xbc74('0x1c')]['hasMany'](db[_0xbc74('0x71')],{'as':_0xbc74('0x14a'),'foreignKey':_0xbc74('0x147')});db[_0xbc74('0x1c')][_0xbc74('0x10f')](db[_0xbc74('0xd3')],{'as':_0xbc74('0x14b'),'foreignKey':_0xbc74('0x147')});db[_0xbc74('0x1c')][_0xbc74('0x14c')](db[_0xbc74('0x2a')],{'as':_0xbc74('0x2a'),'foreignKey':'TrunkId'});db[_0xbc74('0x1c')][_0xbc74('0x14c')](db[_0xbc74('0x2a')],{'as':'TrunkBackup','foreignKey':_0xbc74('0x14d')});db[_0xbc74('0x1c')][_0xbc74('0x14c')](db[_0xbc74('0x7d')],{'as':_0xbc74('0x7d'),'foreignKey':_0xbc74('0x14e')});db[_0xbc74('0x1c')]['belongsTo'](db[_0xbc74('0x7f')],{'as':'mandatoryDispositionPause','foreignKey':_0xbc74('0x14f')});db[_0xbc74('0x1c')][_0xbc74('0x11b')](db['CmList'],{'as':_0xbc74('0x11f'),'through':_0xbc74('0x150')});db['VoiceQueue'][_0xbc74('0x11b')](db[_0xbc74('0x14')],{'as':_0xbc74('0x151'),'through':_0xbc74('0x2d')});db[_0xbc74('0x1c')][_0xbc74('0x11b')](db[_0xbc74('0xe0')],{'as':_0xbc74('0x152'),'through':_0xbc74('0x10a')});db[_0xbc74('0x1c')]['belongsToMany'](db[_0xbc74('0x130')],{'as':'BlackLists','through':'voice_queues_has_cm_blacklists'});db[_0xbc74('0x153')]['belongsTo'](db[_0xbc74('0x14')],{'as':_0xbc74('0x14'),'foreignKey':'UserId'});db[_0xbc74('0x154')]['belongsTo'](db[_0xbc74('0x14')],{'as':'User','foreignKey':_0xbc74('0x10e')});db[_0xbc74('0x1f')][_0xbc74('0x10f')](db['VoiceMailMessage'],{'as':_0xbc74('0x155'),'onDelete':_0xbc74('0x10d'),'foreignKey':'mailboxuser','sourceKey':_0xbc74('0x156')});db['VoiceMailMessage'][_0xbc74('0x14c')](db[_0xbc74('0x1f')],{'foreignKey':'mailboxuser','targetKey':_0xbc74('0x156')});db[_0xbc74('0x23')][_0xbc74('0x10f')](db['VoiceQueueReport'],{'as':_0xbc74('0x157'),'foreignKey':'uniqueid','constraints':![]});db[_0xbc74('0x23')][_0xbc74('0x10f')](db[_0xbc74('0x26')],{'as':_0xbc74('0x158'),'foreignKey':_0xbc74('0x159'),'constraints':![]});db['VoiceCallReport'][_0xbc74('0x14c')](db[_0xbc74('0x14')],{'as':_0xbc74('0x14'),'foreignKey':_0xbc74('0x10e')});db['VoiceCallReport']['belongsTo'](db[_0xbc74('0x6e')],{'as':'Contact','foreignKey':'ContactId'});db[_0xbc74('0x15a')][_0xbc74('0x14c')](db[_0xbc74('0x137')],{'as':_0xbc74('0x137'),'foreignKey':_0xbc74('0x15b')});db[_0xbc74('0x38')][_0xbc74('0x14c')](db[_0xbc74('0x137')],{'as':'MailAccount','foreignKey':_0xbc74('0x15b')});db[_0xbc74('0x137')]['hasOne'](db[_0xbc74('0x15a')],{'as':_0xbc74('0x15c'),'onDelete':_0xbc74('0x10d')});db['MailAccount']['hasOne'](db[_0xbc74('0x38')],{'as':_0xbc74('0x15d'),'onDelete':_0xbc74('0x10d')});db[_0xbc74('0x137')][_0xbc74('0x10f')](db['Disposition'],{'as':_0xbc74('0x15e'),'foreignKey':_0xbc74('0x15b'),'onDelete':'cascade'});db[_0xbc74('0x137')][_0xbc74('0x10f')](db['CannedAnswer'],{'as':_0xbc74('0x15f'),'foreignKey':_0xbc74('0x15b')});db[_0xbc74('0x137')][_0xbc74('0x10f')](db[_0xbc74('0x3f')],{'as':_0xbc74('0x155'),'foreignKey':_0xbc74('0x15b')});db[_0xbc74('0x137')]['hasMany'](db[_0xbc74('0x3d')],{'as':_0xbc74('0x160')});db['MailAccount'][_0xbc74('0x10f')](db[_0xbc74('0x41')],{'as':'Applications'});db[_0xbc74('0x137')][_0xbc74('0x14c')](db[_0xbc74('0x130')],{'as':_0xbc74('0x161'),'foreignKey':_0xbc74('0x162')});db[_0xbc74('0x137')][_0xbc74('0x14c')](db[_0xbc74('0x8f')],{'as':_0xbc74('0x8f'),'foreignKey':_0xbc74('0x163')});db[_0xbc74('0x137')][_0xbc74('0x14c')](db['Pause'],{'as':_0xbc74('0x164'),'foreignKey':_0xbc74('0x14f')});db[_0xbc74('0x137')][_0xbc74('0x11b')](db['User'],{'as':_0xbc74('0x151'),'through':_0xbc74('0x139')});db[_0xbc74('0x3b')][_0xbc74('0x11b')](db[_0xbc74('0x14')],{'as':_0xbc74('0x151'),'through':_0xbc74('0x129')});db[_0xbc74('0x3b')][_0xbc74('0x11b')](db[_0xbc74('0xe0')],{'through':_0xbc74('0x165'),'as':_0xbc74('0x152')});db[_0xbc74('0x3d')][_0xbc74('0x10f')](db[_0xbc74('0x3f')],{'as':_0xbc74('0x155'),'onDelete':_0xbc74('0x10d'),'foreignKey':'MailInteractionId'});db[_0xbc74('0x3d')]['belongsTo'](db[_0xbc74('0x137')],{'as':_0xbc74('0x166'),'foreignKey':'MailAccountId'});db[_0xbc74('0x3d')][_0xbc74('0x14c')](db[_0xbc74('0x6e')],{'as':'Contact','foreignKey':_0xbc74('0x167')});db['MailInteraction'][_0xbc74('0x14c')](db[_0xbc74('0x14')],{'as':_0xbc74('0x168'),'foreignKey':_0xbc74('0x10e')});db['MailInteraction'][_0xbc74('0x11b')](db['Tag'],{'through':_0xbc74('0x169'),'as':_0xbc74('0x16a')});db[_0xbc74('0x3d')]['belongsToMany'](db[_0xbc74('0x88')],{'through':_0xbc74('0x169'),'as':_0xbc74('0x16b')});db['MailInteraction'][_0xbc74('0x11b')](db[_0xbc74('0x14')],{'as':'Users','through':_0xbc74('0x16c'),'foreignKey':'MailInteractionId'});db['MailMessage']['hasMany'](db[_0xbc74('0xe7')],{'as':'Attachments','onDelete':_0xbc74('0x10d')});db[_0xbc74('0x3f')][_0xbc74('0x14c')](db[_0xbc74('0x14')],{'as':_0xbc74('0x14')});db['MailMessage']['belongsTo'](db[_0xbc74('0x6e')],{'onDelete':_0xbc74('0x10d'),'as':_0xbc74('0x16d')});db[_0xbc74('0x3f')]['belongsTo'](db['MailInteraction'],{'as':_0xbc74('0x16e'),'foreignKey':_0xbc74('0x16f')});db['MailMessage'][_0xbc74('0x14c')](db[_0xbc74('0x137')],{'as':_0xbc74('0x166'),'foreignKey':_0xbc74('0x15b')});db['MailMessage'][_0xbc74('0x14c')](db[_0xbc74('0x133')],{'as':_0xbc74('0x133'),'foreignKey':_0xbc74('0x170')});db[_0xbc74('0x3f')][_0xbc74('0x14c')](db[_0xbc74('0x66')],{'as':_0xbc74('0x66'),'foreignKey':'ChatOfflineMessageId'});db['MailApplication'][_0xbc74('0x14c')](db[_0xbc74('0x14')],{'onDelete':_0xbc74('0x171')});db[_0xbc74('0x41')]['belongsTo'](db[_0xbc74('0x3b')],{'onDelete':'restrict'});db[_0xbc74('0x41')][_0xbc74('0x14c')](db[_0xbc74('0x137')],{'onDelete':_0xbc74('0x171')});db[_0xbc74('0x41')][_0xbc74('0x14c')](db[_0xbc74('0x7d')],{'onDelete':_0xbc74('0x171'),'foreignKey':_0xbc74('0x14e')});db['MailApplication'][_0xbc74('0x14c')](db['Tag'],{'onDelete':_0xbc74('0x171'),'foreignKey':_0xbc74('0x172')});db[_0xbc74('0x43')][_0xbc74('0x14c')](db[_0xbc74('0x137')],{});db['MailQueueReport'][_0xbc74('0x14c')](db[_0xbc74('0x130')],{'as':_0xbc74('0x161'),'foreignKey':'ListId'});db['MailQueueReport'][_0xbc74('0x14c')](db[_0xbc74('0x6e')],{'as':_0xbc74('0x16d'),'foreignKey':_0xbc74('0x167')});db[_0xbc74('0x43')][_0xbc74('0x14c')](db[_0xbc74('0x3d')],{});db[_0xbc74('0x43')][_0xbc74('0x14c')](db[_0xbc74('0x3f')],{});db['MailQueueReport']['belongsTo'](db['User'],{});db[_0xbc74('0x43')][_0xbc74('0x14c')](db[_0xbc74('0x3b')],{});db[_0xbc74('0x45')]['hasMany'](db[_0xbc74('0x46')],{'as':'Items','onDelete':'cascade'});db[_0xbc74('0x136')]['hasMany'](db[_0xbc74('0x7a')],{'as':_0xbc74('0x15e'),'foreignKey':'FaxAccountId','onDelete':'cascade'});db[_0xbc74('0x136')][_0xbc74('0x10f')](db['CannedAnswer'],{'as':'Answers','foreignKey':'FaxAccountId'});db[_0xbc74('0x136')][_0xbc74('0x10f')](db[_0xbc74('0x4a')],{'as':_0xbc74('0x160')});db['FaxAccount']['hasMany'](db[_0xbc74('0x48')],{'as':_0xbc74('0x143')});db['FaxAccount'][_0xbc74('0x10f')](db[_0xbc74('0x1a')],{'as':_0xbc74('0x173'),'onDelete':_0xbc74('0x10d')});db[_0xbc74('0x136')][_0xbc74('0x10f')](db['FaxMessage'],{'as':_0xbc74('0x155')});db[_0xbc74('0x136')][_0xbc74('0x14c')](db[_0xbc74('0x2a')],{'as':_0xbc74('0x2a')});db[_0xbc74('0x136')][_0xbc74('0x14c')](db[_0xbc74('0x130')],{'as':_0xbc74('0x161'),'foreignKey':_0xbc74('0x162')});db['FaxAccount'][_0xbc74('0x14c')](db[_0xbc74('0x7f')],{'as':'mandatoryDispositionPause','foreignKey':_0xbc74('0x14f')});db[_0xbc74('0x136')][_0xbc74('0x11b')](db[_0xbc74('0x14')],{'as':'Agents','through':_0xbc74('0x174')});db['FaxApplication'][_0xbc74('0x14c')](db[_0xbc74('0x14')],{'onDelete':_0xbc74('0x171')});db[_0xbc74('0x48')][_0xbc74('0x14c')](db['FaxQueue'],{'onDelete':'restrict'});db[_0xbc74('0x48')]['belongsTo'](db[_0xbc74('0x136')],{'onDelete':_0xbc74('0x171')});db[_0xbc74('0x48')][_0xbc74('0x14c')](db[_0xbc74('0x88')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0xbc74('0x4a')]['hasMany'](db['FaxMessage'],{'as':_0xbc74('0x155'),'onDelete':_0xbc74('0x10d'),'foreignKey':_0xbc74('0x175')});db['FaxInteraction']['belongsTo'](db[_0xbc74('0x136')],{'as':'Account','foreignKey':_0xbc74('0x176')});db[_0xbc74('0x4a')]['belongsTo'](db['CmContact'],{'as':_0xbc74('0x16d'),'foreignKey':_0xbc74('0x167')});db[_0xbc74('0x4a')][_0xbc74('0x14c')](db['User'],{'as':_0xbc74('0x168'),'foreignKey':_0xbc74('0x10e')});db[_0xbc74('0x4a')][_0xbc74('0x11b')](db[_0xbc74('0x88')],{'through':'fax_interaction_has_tags','as':'Tags'});db[_0xbc74('0x4a')]['belongsToMany'](db[_0xbc74('0x88')],{'through':_0xbc74('0x177'),'as':_0xbc74('0x16b')});db['FaxInteraction'][_0xbc74('0x11b')](db[_0xbc74('0x14')],{'as':_0xbc74('0x178'),'through':_0xbc74('0x179'),'foreignKey':_0xbc74('0x175')});db[_0xbc74('0x4c')][_0xbc74('0x14c')](db[_0xbc74('0x14')],{'onDelete':_0xbc74('0x10d'),'as':_0xbc74('0x14')});db[_0xbc74('0x4c')][_0xbc74('0x14c')](db[_0xbc74('0x4a')],{'as':_0xbc74('0x16e'),'foreignKey':_0xbc74('0x175')});db[_0xbc74('0x4c')][_0xbc74('0x14c')](db[_0xbc74('0x6e')],{'onDelete':_0xbc74('0x10d'),'as':'Contact'});db[_0xbc74('0x4c')][_0xbc74('0x14c')](db[_0xbc74('0xe7')],{'as':_0xbc74('0xe7'),'foreignKey':'AttachmentId'});db['FaxMessage']['belongsTo'](db[_0xbc74('0x136')],{'as':_0xbc74('0x166'),'foreignKey':_0xbc74('0x176')});db[_0xbc74('0x4d')]['belongsToMany'](db['User'],{'as':_0xbc74('0x151'),'through':'UserFaxQueue'});db[_0xbc74('0x4d')]['belongsToMany'](db[_0xbc74('0xe0')],{'through':'team_has_fax_queues','as':'Teams'});db[_0xbc74('0x4f')][_0xbc74('0x14c')](db[_0xbc74('0x136')],{});db[_0xbc74('0x4f')][_0xbc74('0x14c')](db[_0xbc74('0x130')],{'as':'List','foreignKey':_0xbc74('0x162')});db[_0xbc74('0x4f')][_0xbc74('0x14c')](db[_0xbc74('0x6e')],{'as':_0xbc74('0x16d'),'foreignKey':_0xbc74('0x167')});db[_0xbc74('0x4f')][_0xbc74('0x14c')](db[_0xbc74('0x4a')],{});db['FaxQueueReport'][_0xbc74('0x14c')](db[_0xbc74('0x4c')],{});db[_0xbc74('0x4f')][_0xbc74('0x14c')](db['User'],{});db['FaxQueueReport']['belongsTo'](db[_0xbc74('0x4d')],{});db['SmsAccount'][_0xbc74('0x10f')](db['Disposition'],{'as':_0xbc74('0x15e'),'foreignKey':_0xbc74('0x17a'),'onDelete':_0xbc74('0x10d')});db['SmsAccount'][_0xbc74('0x10f')](db[_0xbc74('0x17b')],{'as':_0xbc74('0x15f'),'foreignKey':_0xbc74('0x17a')});db[_0xbc74('0x51')][_0xbc74('0x10f')](db['SmsMessage'],{'as':'Messages','foreignKey':_0xbc74('0x17a')});db[_0xbc74('0x51')][_0xbc74('0x10f')](db[_0xbc74('0x116')],{'as':_0xbc74('0x160')});db[_0xbc74('0x51')][_0xbc74('0x10f')](db['SmsApplication'],{'as':'Applications'});db[_0xbc74('0x51')][_0xbc74('0x14c')](db[_0xbc74('0x130')],{'as':_0xbc74('0x161'),'foreignKey':'ListId'});db['SmsAccount'][_0xbc74('0x14c')](db[_0xbc74('0x7f')],{'as':'mandatoryDispositionPause','foreignKey':_0xbc74('0x14f')});db['SmsAccount'][_0xbc74('0x11b')](db[_0xbc74('0x14')],{'as':_0xbc74('0x151'),'through':_0xbc74('0x13d')});db[_0xbc74('0x52')]['belongsTo'](db['User'],{'onDelete':'restrict'});db[_0xbc74('0x52')][_0xbc74('0x14c')](db[_0xbc74('0x12c')],{'onDelete':'restrict'});db[_0xbc74('0x52')][_0xbc74('0x14c')](db['SmsAccount'],{'onDelete':_0xbc74('0x171')});db[_0xbc74('0x52')][_0xbc74('0x14c')](db[_0xbc74('0x7d')],{'onDelete':_0xbc74('0x171'),'foreignKey':_0xbc74('0x14e')});db['SmsApplication'][_0xbc74('0x14c')](db[_0xbc74('0x88')],{'onDelete':'restrict','foreignKey':_0xbc74('0x172')});db['SmsInteraction'][_0xbc74('0x10f')](db[_0xbc74('0x54')],{'as':_0xbc74('0x155'),'onDelete':'cascade','foreignKey':_0xbc74('0x17c')});db[_0xbc74('0x116')][_0xbc74('0x14c')](db[_0xbc74('0x51')],{'as':_0xbc74('0x166'),'foreignKey':_0xbc74('0x17a')});db[_0xbc74('0x116')]['belongsTo'](db[_0xbc74('0x6e')],{'as':_0xbc74('0x16d'),'foreignKey':_0xbc74('0x167')});db[_0xbc74('0x116')][_0xbc74('0x14c')](db['User'],{'as':_0xbc74('0x168'),'foreignKey':_0xbc74('0x10e')});db[_0xbc74('0x116')][_0xbc74('0x11b')](db['Tag'],{'through':'sms_interaction_has_tags','as':_0xbc74('0x16a')});db['SmsInteraction'][_0xbc74('0x11b')](db[_0xbc74('0x88')],{'through':_0xbc74('0x17d'),'as':_0xbc74('0x16b')});db[_0xbc74('0x116')][_0xbc74('0x11b')](db['User'],{'as':_0xbc74('0x178'),'through':_0xbc74('0x125'),'foreignKey':'SmsInteractionId'});db[_0xbc74('0x54')][_0xbc74('0x14c')](db[_0xbc74('0x14')],{'as':_0xbc74('0x14')});db[_0xbc74('0x54')][_0xbc74('0x14c')](db[_0xbc74('0x6e')],{'onDelete':'cascade','as':_0xbc74('0x16d')});db[_0xbc74('0x54')][_0xbc74('0x14c')](db[_0xbc74('0x116')],{'onDelete':_0xbc74('0x10d'),'as':_0xbc74('0x16e'),'foreignKey':_0xbc74('0x17c')});db[_0xbc74('0x54')][_0xbc74('0x14c')](db[_0xbc74('0x51')],{'as':_0xbc74('0x166'),'foreignKey':_0xbc74('0x17a')});db[_0xbc74('0x12c')][_0xbc74('0x11b')](db['User'],{'as':_0xbc74('0x151'),'through':'UserSmsQueue','foreignKey':_0xbc74('0x17e')});db[_0xbc74('0x12c')][_0xbc74('0x11b')](db[_0xbc74('0xe0')],{'through':_0xbc74('0x17f'),'as':_0xbc74('0x152')});db[_0xbc74('0x57')]['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':_0xbc74('0x180'),'onDelete':_0xbc74('0x10d')});db['OpenchannelAccount']['hasMany'](db[_0xbc74('0x17b')],{'as':_0xbc74('0x15f'),'foreignKey':_0xbc74('0x180')});db[_0xbc74('0x57')][_0xbc74('0x10f')](db['OpenchannelInteraction'],{'as':_0xbc74('0x160'),'foreignKey':_0xbc74('0x180')});db[_0xbc74('0x57')][_0xbc74('0x10f')](db[_0xbc74('0x5c')],{'as':_0xbc74('0x155'),'foreignKey':_0xbc74('0x180')});db[_0xbc74('0x57')][_0xbc74('0x10f')](db[_0xbc74('0x58')],{'as':_0xbc74('0x143'),'foreignKey':_0xbc74('0x180')});db[_0xbc74('0x57')][_0xbc74('0x14c')](db[_0xbc74('0x130')],{'as':_0xbc74('0x161'),'foreignKey':_0xbc74('0x162')});db[_0xbc74('0x57')][_0xbc74('0x14c')](db[_0xbc74('0x7f')],{'as':'mandatoryDispositionPause','foreignKey':_0xbc74('0x14f')});db[_0xbc74('0x57')][_0xbc74('0x11b')](db[_0xbc74('0x14')],{'as':'Agents','through':'user_has_openchannel_accounts'});db[_0xbc74('0x58')]['belongsTo'](db[_0xbc74('0x14')],{'onDelete':'restrict'});db[_0xbc74('0x58')][_0xbc74('0x14c')](db[_0xbc74('0x12d')],{'onDelete':_0xbc74('0x171'),'foreignKey':'OpenchannelQueueId'});db[_0xbc74('0x58')]['belongsTo'](db[_0xbc74('0x57')],{'onDelete':_0xbc74('0x171'),'foreignKey':'OpenchannelAccountId'});db[_0xbc74('0x58')][_0xbc74('0x14c')](db[_0xbc74('0x7d')],{'onDelete':_0xbc74('0x171'),'foreignKey':'IntervalId'});db[_0xbc74('0x58')][_0xbc74('0x14c')](db[_0xbc74('0x88')],{'onDelete':_0xbc74('0x171'),'foreignKey':_0xbc74('0x172')});db[_0xbc74('0x5a')][_0xbc74('0x10f')](db[_0xbc74('0x5c')],{'as':'Messages','onDelete':_0xbc74('0x10d'),'foreignKey':'OpenchannelInteractionId'});db[_0xbc74('0x5a')][_0xbc74('0x14c')](db[_0xbc74('0x57')],{'as':_0xbc74('0x166'),'foreignKey':_0xbc74('0x180')});db['OpenchannelInteraction']['belongsTo'](db['CmContact'],{'as':_0xbc74('0x16d'),'foreignKey':'ContactId'});db[_0xbc74('0x5a')][_0xbc74('0x14c')](db[_0xbc74('0x14')],{'as':_0xbc74('0x168'),'foreignKey':_0xbc74('0x10e')});db['OpenchannelInteraction'][_0xbc74('0x11b')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0xbc74('0x16a')});db['OpenchannelInteraction'][_0xbc74('0x11b')](db[_0xbc74('0x88')],{'through':_0xbc74('0x181'),'as':'ThroughTags'});db[_0xbc74('0x5a')][_0xbc74('0x11b')](db[_0xbc74('0x14')],{'as':_0xbc74('0x178'),'through':_0xbc74('0x126'),'foreignKey':_0xbc74('0x182')});db['OpenchannelMessage'][_0xbc74('0x14c')](db['User'],{'onDelete':_0xbc74('0x10d'),'as':_0xbc74('0x14')});db[_0xbc74('0x5c')][_0xbc74('0x14c')](db[_0xbc74('0x6e')],{'onDelete':_0xbc74('0x10d'),'as':_0xbc74('0x16d')});db['OpenchannelMessage']['belongsTo'](db[_0xbc74('0x5a')],{'onDelete':_0xbc74('0x10d'),'as':'Interaction','foreignKey':_0xbc74('0x182')});db['OpenchannelMessage'][_0xbc74('0x14c')](db[_0xbc74('0xe7')],{'as':_0xbc74('0xe7'),'foreignKey':_0xbc74('0x183')});db[_0xbc74('0x5c')]['belongsTo'](db[_0xbc74('0x57')],{'as':_0xbc74('0x166'),'foreignKey':_0xbc74('0x180')});db[_0xbc74('0x12d')]['belongsToMany'](db[_0xbc74('0x14')],{'as':_0xbc74('0x151'),'through':_0xbc74('0x34'),'foreignKey':_0xbc74('0x184')});db['OpenchannelQueue'][_0xbc74('0x11b')](db[_0xbc74('0xe0')],{'through':'team_has_openchannel_queues','as':_0xbc74('0x152')});db['ChatWebsite']['hasMany'](db[_0xbc74('0x7a')],{'as':_0xbc74('0x15e'),'foreignKey':_0xbc74('0x170'),'onDelete':_0xbc74('0x10d')});db[_0xbc74('0x133')]['hasMany'](db[_0xbc74('0x17b')],{'as':'Answers','foreignKey':'ChatWebsiteId'});db[_0xbc74('0x133')]['hasMany'](db[_0xbc74('0x6a')],{'as':_0xbc74('0x185')});db[_0xbc74('0x133')][_0xbc74('0x10f')](db[_0xbc74('0x62')],{'as':'Interactions'});db[_0xbc74('0x133')][_0xbc74('0x10f')](db[_0xbc74('0x61')],{'as':_0xbc74('0x143')});db[_0xbc74('0x133')][_0xbc74('0x10f')](db['ChatMessage'],{'as':_0xbc74('0x155')});db[_0xbc74('0x133')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0xbc74('0x162')});db[_0xbc74('0x133')][_0xbc74('0x14c')](db[_0xbc74('0x7d')],{'as':_0xbc74('0x7d'),'foreignKey':'IntervalId'});db[_0xbc74('0x133')][_0xbc74('0x14c')](db[_0xbc74('0x137')],{'as':'MailAccount','foreignKey':_0xbc74('0x15b')});db[_0xbc74('0x133')][_0xbc74('0x14c')](db[_0xbc74('0x7f')],{'as':'mandatoryDispositionPause','foreignKey':_0xbc74('0x14f')});db[_0xbc74('0x133')][_0xbc74('0x11b')](db[_0xbc74('0x14')],{'as':_0xbc74('0x151'),'through':_0xbc74('0x135')});db[_0xbc74('0x60')][_0xbc74('0x14c')](db[_0xbc74('0x57')],{});db[_0xbc74('0x60')][_0xbc74('0x14c')](db[_0xbc74('0x130')],{'as':_0xbc74('0x161'),'foreignKey':'ListId'});db[_0xbc74('0x60')][_0xbc74('0x14c')](db[_0xbc74('0x6e')],{'as':_0xbc74('0x16d'),'foreignKey':_0xbc74('0x167')});db['OpenchannelQueueReport'][_0xbc74('0x14c')](db[_0xbc74('0x5a')],{});db[_0xbc74('0x60')]['belongsTo'](db['OpenchannelMessage'],{});db[_0xbc74('0x60')][_0xbc74('0x14c')](db[_0xbc74('0x14')],{});db[_0xbc74('0x60')][_0xbc74('0x14c')](db[_0xbc74('0x12d')],{});db['ChatApplication'][_0xbc74('0x14c')](db[_0xbc74('0x14')],{'as':_0xbc74('0x186'),'foreignKey':'UserId','onDelete':_0xbc74('0x171')});db[_0xbc74('0x61')]['belongsTo'](db[_0xbc74('0x68')],{'as':_0xbc74('0x187'),'foreignKey':_0xbc74('0x188'),'onDelete':_0xbc74('0x171')});db['ChatApplication'][_0xbc74('0x14c')](db[_0xbc74('0x133')],{'as':_0xbc74('0x189'),'foreignKey':'ChatWebsiteId','onDelete':'restrict'});db[_0xbc74('0x61')][_0xbc74('0x14c')](db[_0xbc74('0x88')],{'onDelete':_0xbc74('0x171'),'foreignKey':_0xbc74('0x172')});db['ChatInteraction'][_0xbc74('0x10f')](db['ChatMessage'],{'as':'Messages','onDelete':_0xbc74('0x10d'),'foreignKey':_0xbc74('0x18a')});db[_0xbc74('0x62')][_0xbc74('0x14c')](db[_0xbc74('0x133')],{'as':_0xbc74('0x166'),'foreignKey':_0xbc74('0x170')});db[_0xbc74('0x62')][_0xbc74('0x14c')](db[_0xbc74('0x6e')],{'as':_0xbc74('0x16d'),'foreignKey':_0xbc74('0x167')});db[_0xbc74('0x62')][_0xbc74('0x14c')](db[_0xbc74('0x14')],{'as':_0xbc74('0x168'),'foreignKey':_0xbc74('0x10e')});db[_0xbc74('0x62')]['belongsToMany'](db[_0xbc74('0x88')],{'through':_0xbc74('0x18b'),'as':_0xbc74('0x16a')});db[_0xbc74('0x62')]['belongsToMany'](db[_0xbc74('0x88')],{'through':'chat_interaction_has_tags','as':_0xbc74('0x16b')});db[_0xbc74('0x62')]['belongsToMany'](db[_0xbc74('0x14')],{'as':_0xbc74('0x178'),'through':_0xbc74('0x122'),'foreignKey':_0xbc74('0x18a')});db[_0xbc74('0x64')][_0xbc74('0x14c')](db[_0xbc74('0x14')],{'onDelete':'cascade','as':_0xbc74('0x14')});db[_0xbc74('0x64')][_0xbc74('0x14c')](db[_0xbc74('0x6e')],{'onDelete':_0xbc74('0x10d'),'as':_0xbc74('0x16d'),'foreignKey':'ContactId'});db[_0xbc74('0x64')][_0xbc74('0x14c')](db['ChatInteraction'],{'onDelete':_0xbc74('0x10d'),'as':'Interaction','foreignKey':'ChatInteractionId'});db[_0xbc74('0x64')][_0xbc74('0x14c')](db['Attachment'],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0xbc74('0x64')][_0xbc74('0x14c')](db[_0xbc74('0x133')],{'as':_0xbc74('0x166'),'foreignKey':'ChatWebsiteId'});db[_0xbc74('0x66')]['hasMany'](db[_0xbc74('0xe7')],{'as':_0xbc74('0x18c'),'foreignKey':_0xbc74('0x18d'),'onDelete':_0xbc74('0x10d'),'hooks':!![]});db[_0xbc74('0x66')][_0xbc74('0x14c')](db[_0xbc74('0x6e')],{'onDelete':_0xbc74('0x10d'),'as':_0xbc74('0x16d'),'foreignKey':_0xbc74('0x167')});db[_0xbc74('0x66')][_0xbc74('0x14c')](db['ChatWebsite'],{'as':_0xbc74('0x166'),'foreignKey':_0xbc74('0x170')});db[_0xbc74('0x68')][_0xbc74('0x11b')](db['User'],{'as':_0xbc74('0x151'),'through':_0xbc74('0x12a'),'hooks':!![]});db[_0xbc74('0x68')][_0xbc74('0x11b')](db['Team'],{'through':_0xbc74('0x18e'),'as':_0xbc74('0x152')});db[_0xbc74('0x11c')][_0xbc74('0x10f')](db[_0xbc74('0x18f')],{'as':'Messages','foreignKey':_0xbc74('0x190'),'onDelete':_0xbc74('0x10d')});db['ChatGroup'][_0xbc74('0x11b')](db['User'],{'as':'Members','through':_0xbc74('0x11d')});db['ChatProactiveAction'][_0xbc74('0x14c')](db[_0xbc74('0x133')],{'as':_0xbc74('0x189'),'foreignKey':_0xbc74('0x170')});db[_0xbc74('0x6c')][_0xbc74('0x10f')](db['CmContact'],{'as':_0xbc74('0x191'),'foreignKey':_0xbc74('0x192')});db[_0xbc74('0x6e')][_0xbc74('0x10f')](db[_0xbc74('0x8b')],{'as':_0xbc74('0x193'),'foreignKey':_0xbc74('0x194')});db[_0xbc74('0x6e')][_0xbc74('0x10f')](db[_0xbc74('0x195')],{'as':'Hoppers','foreignKey':'ContactId'});db['CmContact'][_0xbc74('0x10f')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0xbc74('0x167')});db[_0xbc74('0x6e')][_0xbc74('0x10f')](db[_0xbc74('0x113')],{'as':_0xbc74('0x196'),'foreignKey':_0xbc74('0x167')});db[_0xbc74('0x6e')][_0xbc74('0x10f')](db[_0xbc74('0x149')],{'as':_0xbc74('0x149'),'foreignKey':_0xbc74('0x167')});db[_0xbc74('0x6e')]['hasMany'](db[_0xbc74('0xd3')],{'as':_0xbc74('0x14b'),'foreignKey':_0xbc74('0x167')});db[_0xbc74('0x6e')]['hasMany'](db['OpenchannelInteraction'],{'as':_0xbc74('0x114'),'foreignKey':_0xbc74('0x167'),'onDelete':_0xbc74('0x171')});db[_0xbc74('0x6e')][_0xbc74('0x10f')](db['ChatInteraction'],{'as':_0xbc74('0x115'),'foreignKey':_0xbc74('0x167'),'onDelete':_0xbc74('0x171')});db[_0xbc74('0x6e')][_0xbc74('0x10f')](db[_0xbc74('0x116')],{'as':_0xbc74('0x124'),'foreignKey':_0xbc74('0x167'),'onDelete':_0xbc74('0x171')});db['CmContact'][_0xbc74('0x10f')](db[_0xbc74('0x4a')],{'as':_0xbc74('0x123'),'foreignKey':'ContactId','onDelete':_0xbc74('0x171')});db[_0xbc74('0x6e')][_0xbc74('0x10f')](db[_0xbc74('0x3d')],{'as':_0xbc74('0x121'),'foreignKey':_0xbc74('0x167'),'onDelete':_0xbc74('0x171')});db['CmContact'][_0xbc74('0x14c')](db[_0xbc74('0x6c')],{'as':_0xbc74('0x197'),'foreignKey':_0xbc74('0x192')});db[_0xbc74('0x6e')][_0xbc74('0x14c')](db[_0xbc74('0x130')],{'as':_0xbc74('0x161'),'foreignKey':_0xbc74('0x162'),'onDelete':_0xbc74('0x10d')});db['CmContact'][_0xbc74('0x11b')](db[_0xbc74('0x14')],{'as':_0xbc74('0x178'),'through':_0xbc74('0x11e')});db[_0xbc74('0x6e')][_0xbc74('0x11b')](db[_0xbc74('0x88')],{'as':'Tags','through':_0xbc74('0x198')});db['CmContact']['belongsToMany'](db[_0xbc74('0x88')],{'through':_0xbc74('0x198'),'as':_0xbc74('0x16b')});db['CmHopper'][_0xbc74('0x10f')](db['CmHopperAdditionalPhone'],{'as':_0xbc74('0x199'),'foreignKey':_0xbc74('0x19a')});db[_0xbc74('0x195')][_0xbc74('0x14c')](db[_0xbc74('0x6e')],{'as':'Contact','foreignKey':_0xbc74('0x167'),'onDelete':_0xbc74('0x10d')});db[_0xbc74('0x195')]['belongsTo'](db[_0xbc74('0x130')],{'as':_0xbc74('0x161'),'foreignKey':_0xbc74('0x162'),'onDelete':_0xbc74('0x10d')});db[_0xbc74('0x195')][_0xbc74('0x14c')](db[_0xbc74('0x14')],{'as':_0xbc74('0x186'),'foreignKey':_0xbc74('0x10e')});db[_0xbc74('0x195')][_0xbc74('0x14c')](db['VoiceQueue'],{'as':_0xbc74('0x187'),'foreignKey':'VoiceQueueId','onDelete':_0xbc74('0x10d')});db[_0xbc74('0x195')][_0xbc74('0x14c')](db[_0xbc74('0xe3')],{'as':'Campaign','foreignKey':_0xbc74('0x19b'),'onDelete':'cascade'});db[_0xbc74('0x195')]['belongsTo'](db[_0xbc74('0x14')],{'as':_0xbc74('0x168'),'foreignKey':'OwnerId'});db['CmHopperBlack'][_0xbc74('0x14c')](db['CmContact'],{'as':_0xbc74('0x16d'),'foreignKey':_0xbc74('0x167'),'onDelete':_0xbc74('0x10d')});db[_0xbc74('0x71')][_0xbc74('0x14c')](db[_0xbc74('0x130')],{'as':_0xbc74('0x161'),'foreignKey':'ListId','onDelete':_0xbc74('0x10d')});db['CmHopperBlack'][_0xbc74('0x14c')](db[_0xbc74('0x1c')],{'as':'Queue','foreignKey':_0xbc74('0x147'),'onDelete':'cascade'});db['CmHopperBlack']['belongsTo'](db[_0xbc74('0xe3')],{'as':_0xbc74('0xe3'),'foreignKey':_0xbc74('0x19b'),'onDelete':'cascade'});db['Automation'][_0xbc74('0x10f')](db['Condition'],{'as':{'plural':_0xbc74('0x19c'),'singular':'OneAll'},'foreignKey':'AutomationAllId','onDelete':_0xbc74('0x10d'),'hooks':!![]});db[_0xbc74('0x79')][_0xbc74('0x10f')](db['Condition'],{'as':{'plural':_0xbc74('0x19d'),'singular':_0xbc74('0x19e')},'foreignKey':_0xbc74('0x19f'),'onDelete':'cascade','hooks':!![]});db[_0xbc74('0x79')][_0xbc74('0x10f')](db['Action'],{'as':_0xbc74('0x1a0'),'foreignKey':_0xbc74('0x1a1'),'onDelete':_0xbc74('0x10d'),'hooks':!![]});db['Disposition'][_0xbc74('0x10f')](db['Disposition'],{'as':_0xbc74('0x15e'),'foreignKey':'ParentId','onDelete':'cascade'});db[_0xbc74('0x7d')][_0xbc74('0x10f')](db['Interval'],{'as':_0xbc74('0x1a2'),'foreignKey':_0xbc74('0x14e'),'onDelete':_0xbc74('0x10d'),'hooks':!![],'required':![]});db['Interval'][_0xbc74('0x10f')](db[_0xbc74('0x1a')],{'as':_0xbc74('0x111'),'foreignKey':_0xbc74('0x14e'),'onDelete':_0xbc74('0x171')});db[_0xbc74('0x7d')][_0xbc74('0x10f')](db[_0xbc74('0x41')],{'as':_0xbc74('0x1a3'),'foreignKey':_0xbc74('0x14e')});db[_0xbc74('0x7d')][_0xbc74('0x10f')](db[_0xbc74('0x61')],{'as':_0xbc74('0x1a4'),'foreignKey':_0xbc74('0x14e')});db['Interval'][_0xbc74('0x10f')](db[_0xbc74('0x48')],{'as':'FaxApplications','foreignKey':_0xbc74('0x14e')});db['Interval']['hasMany'](db['SmsApplication'],{'as':_0xbc74('0x1a5'),'foreignKey':'IntervalId'});db['Schedule'][_0xbc74('0x14c')](db[_0xbc74('0x137')],{});db[_0xbc74('0x84')][_0xbc74('0x14c')](db[_0xbc74('0x98')],{'foreignKey':_0xbc74('0x1a6')});db['Schedule'][_0xbc74('0x14c')](db['AnalyticCustomReport'],{'foreignKey':_0xbc74('0x1a7')});db[_0xbc74('0x86')][_0xbc74('0x11b')](db[_0xbc74('0x144')],{'as':_0xbc74('0x1a8'),'through':_0xbc74('0x146'),'onDelete':'restrict'});db['Tag'][_0xbc74('0x11b')](db[_0xbc74('0x6e')],{'through':_0xbc74('0x198')});db[_0xbc74('0x88')][_0xbc74('0x11b')](db[_0xbc74('0x62')],{'through':_0xbc74('0x18b')});db[_0xbc74('0x88')][_0xbc74('0x11b')](db['MailInteraction'],{'through':_0xbc74('0x169')});db[_0xbc74('0x88')][_0xbc74('0x11b')](db['SmsInteraction'],{'through':_0xbc74('0x17d')});db[_0xbc74('0x88')][_0xbc74('0x11b')](db[_0xbc74('0x4a')],{'through':_0xbc74('0x177')});db[_0xbc74('0x88')]['belongsToMany'](db['OpenchannelInteraction'],{'through':'openchannel_interaction_has_tags'});db[_0xbc74('0x88')]['belongsToMany'](db['WhatsappInteraction'],{'through':_0xbc74('0x1a9')});db['CmContactHasItem']['belongsTo'](db[_0xbc74('0x8a')],{'as':_0xbc74('0x1aa'),'foreignKey':_0xbc74('0x1ab')});db[_0xbc74('0x8d')][_0xbc74('0x14c')](db[_0xbc74('0x195')],{'as':'Hopper','foreignKey':'CmHopperId'});db[_0xbc74('0x1ac')][_0xbc74('0x10f')](db[_0xbc74('0x1ad')],{'as':{'plural':_0xbc74('0x1ae'),'singular':_0xbc74('0x1af')},'foreignKey':'TriggerAllId','onDelete':_0xbc74('0x10d'),'hooks':!![]});db[_0xbc74('0x1ac')][_0xbc74('0x10f')](db[_0xbc74('0x1ad')],{'as':{'plural':_0xbc74('0x1b0'),'singular':_0xbc74('0x1b1')},'foreignKey':'TriggerAnyId','onDelete':'cascade','hooks':!![]});db['Trigger'][_0xbc74('0x10f')](db[_0xbc74('0x1b2')],{'as':_0xbc74('0x1a0'),'foreignKey':_0xbc74('0x1b3'),'onDelete':_0xbc74('0x10d'),'hooks':!![]});db[_0xbc74('0x96')][_0xbc74('0x10f')](db[_0xbc74('0x9e')],{'as':_0xbc74('0x1b4'),'onDelete':_0xbc74('0x10d'),'foreignKey':_0xbc74('0x1a7'),'hooks':!![]});db[_0xbc74('0x98')][_0xbc74('0x10f')](db['AnalyticFieldReport'],{'as':_0xbc74('0x1b4'),'onDelete':_0xbc74('0x10d'),'foreignKey':_0xbc74('0x1a6')});db[_0xbc74('0x9c')]['hasMany'](db[_0xbc74('0x9e')],{'as':_0xbc74('0x1b4'),'onDelete':_0xbc74('0x10d'),'foreignKey':_0xbc74('0x1b5')});db[_0xbc74('0x9e')][_0xbc74('0x14c')](db['AnalyticMetric'],{'foreignKey':_0xbc74('0x1b5')});db[_0xbc74('0x1b6')][_0xbc74('0x10f')](db[_0xbc74('0x1b7')],{'as':_0xbc74('0x1b8'),'onDelete':_0xbc74('0x10d'),'foreignKey':_0xbc74('0x1b9')});db[_0xbc74('0x1b7')][_0xbc74('0x10f')](db[_0xbc74('0x1ba')],{'as':_0xbc74('0x1bb'),'onDelete':_0xbc74('0x10d'),'foreignKey':_0xbc74('0x1bc')});db[_0xbc74('0x1b7')][_0xbc74('0x10f')](db['SalesforceField'],{'as':_0xbc74('0x1bd'),'onDelete':_0xbc74('0x10d'),'foreignKey':_0xbc74('0x1be')});db[_0xbc74('0x1b7')]['hasMany'](db[_0xbc74('0x1ba')],{'as':'Fields','onDelete':_0xbc74('0x10d'),'foreignKey':_0xbc74('0x1bf')});db[_0xbc74('0x1b7')]['belongsTo'](db[_0xbc74('0x1b6')],{'as':_0xbc74('0x166'),'foreignKey':'AccountId'});db['SalesforceField'][_0xbc74('0x10f')](db['SalesforceField'],{'as':'Subject','foreignKey':_0xbc74('0x1bc')});db['SalesforceField'][_0xbc74('0x10f')](db[_0xbc74('0x1ba')],{'as':'Description','foreignKey':_0xbc74('0x1be')});db[_0xbc74('0x1ba')]['hasMany'](db[_0xbc74('0x1ba')],{'as':'Field','foreignKey':_0xbc74('0x1bf')});db[_0xbc74('0x1ba')][_0xbc74('0x14c')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db['SugarcrmAccount'][_0xbc74('0x10f')](db[_0xbc74('0xa6')],{'as':'Configurations','onDelete':_0xbc74('0x10d'),'foreignKey':'AccountId'});db[_0xbc74('0xa6')][_0xbc74('0x10f')](db['SugarcrmField'],{'as':'Subjects','onDelete':_0xbc74('0x10d'),'foreignKey':_0xbc74('0x1bc')});db[_0xbc74('0xa6')][_0xbc74('0x10f')](db[_0xbc74('0xa8')],{'as':_0xbc74('0x1bd'),'onDelete':_0xbc74('0x10d'),'foreignKey':'DescriptionId'});db['SugarcrmConfiguration']['hasMany'](db['SugarcrmField'],{'as':_0xbc74('0x1b4'),'onDelete':_0xbc74('0x10d'),'foreignKey':_0xbc74('0x1bf')});db[_0xbc74('0xa6')][_0xbc74('0x14c')](db['SugarcrmAccount'],{'as':_0xbc74('0x166'),'foreignKey':'AccountId'});db[_0xbc74('0xa8')][_0xbc74('0x10f')](db[_0xbc74('0xa8')],{'as':_0xbc74('0x1c0'),'foreignKey':_0xbc74('0x1bc')});db[_0xbc74('0xa8')]['hasMany'](db[_0xbc74('0xa8')],{'as':_0xbc74('0x1c1'),'foreignKey':_0xbc74('0x1be')});db[_0xbc74('0xa8')]['hasMany'](db[_0xbc74('0xa8')],{'as':_0xbc74('0x1c2'),'foreignKey':_0xbc74('0x1bf')});db['SugarcrmField']['belongsTo'](db['Variable'],{'as':_0xbc74('0x92'),'foreignKey':_0xbc74('0x1c3')});db[_0xbc74('0x1c4')]['hasMany'](db[_0xbc74('0xaa')],{'as':_0xbc74('0x1b8'),'onDelete':_0xbc74('0x10d'),'foreignKey':'AccountId'});db[_0xbc74('0xaa')][_0xbc74('0x10f')](db['DeskField'],{'as':_0xbc74('0x1bb'),'onDelete':'cascade','foreignKey':_0xbc74('0x1bc')});db[_0xbc74('0xaa')][_0xbc74('0x10f')](db[_0xbc74('0xac')],{'as':'Descriptions','onDelete':_0xbc74('0x10d'),'foreignKey':_0xbc74('0x1be')});db[_0xbc74('0xaa')][_0xbc74('0x10f')](db[_0xbc74('0xac')],{'as':'Fields','onDelete':_0xbc74('0x10d'),'foreignKey':_0xbc74('0x1bf')});db[_0xbc74('0xaa')][_0xbc74('0x14c')](db[_0xbc74('0x1c4')],{'as':_0xbc74('0x166'),'foreignKey':_0xbc74('0x1b9')});db[_0xbc74('0xaa')][_0xbc74('0x11b')](db[_0xbc74('0x88')],{'through':_0xbc74('0x1c5')});db[_0xbc74('0xac')]['hasMany'](db[_0xbc74('0xac')],{'as':_0xbc74('0x1c0'),'foreignKey':_0xbc74('0x1bc')});db[_0xbc74('0xac')][_0xbc74('0x10f')](db[_0xbc74('0xac')],{'as':_0xbc74('0x1c1'),'foreignKey':_0xbc74('0x1be')});db[_0xbc74('0xac')][_0xbc74('0x10f')](db['DeskField'],{'as':'Field','foreignKey':'FieldId'});db[_0xbc74('0xac')][_0xbc74('0x14c')](db[_0xbc74('0x92')],{'as':_0xbc74('0x92'),'foreignKey':_0xbc74('0x1c3')});db[_0xbc74('0xad')][_0xbc74('0x10f')](db['ZohoConfiguration'],{'as':_0xbc74('0x1b8'),'onDelete':_0xbc74('0x10d'),'foreignKey':_0xbc74('0x1b9')});db[_0xbc74('0xaf')][_0xbc74('0x10f')](db[_0xbc74('0xb1')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0xbc74('0x1bc')});db['ZohoConfiguration'][_0xbc74('0x10f')](db[_0xbc74('0xb1')],{'as':_0xbc74('0x1bd'),'onDelete':_0xbc74('0x10d'),'foreignKey':_0xbc74('0x1be')});db[_0xbc74('0xaf')][_0xbc74('0x10f')](db[_0xbc74('0xb1')],{'as':'Fields','onDelete':_0xbc74('0x10d'),'foreignKey':'FieldId'});db[_0xbc74('0xaf')][_0xbc74('0x14c')](db[_0xbc74('0xad')],{'as':'Account','foreignKey':_0xbc74('0x1b9')});db['ZohoField'][_0xbc74('0x10f')](db[_0xbc74('0xb1')],{'as':_0xbc74('0x1c0'),'foreignKey':'SubjectId'});db[_0xbc74('0xb1')]['hasMany'](db['ZohoField'],{'as':'Description','foreignKey':'DescriptionId'});db['ZohoField'][_0xbc74('0x10f')](db[_0xbc74('0xb1')],{'as':_0xbc74('0x1c2'),'foreignKey':_0xbc74('0x1bf')});db[_0xbc74('0xb1')][_0xbc74('0x14c')](db[_0xbc74('0x92')],{'as':'Variable','foreignKey':_0xbc74('0x1c3')});db[_0xbc74('0xb3')][_0xbc74('0x10f')](db[_0xbc74('0xb5')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xbc74('0x1b9')});db[_0xbc74('0xb5')]['hasMany'](db[_0xbc74('0xb7')],{'as':'Subjects','foreignKey':_0xbc74('0x1bc')});db['ZendeskConfiguration'][_0xbc74('0x10f')](db['ZendeskField'],{'as':_0xbc74('0x1bd'),'foreignKey':_0xbc74('0x1be')});db['ZendeskConfiguration'][_0xbc74('0x10f')](db[_0xbc74('0xb7')],{'as':_0xbc74('0x1b4'),'foreignKey':_0xbc74('0x1bf')});db[_0xbc74('0xb5')]['belongsTo'](db[_0xbc74('0xb3')],{'as':_0xbc74('0x166'),'foreignKey':_0xbc74('0x1b9')});db['ZendeskConfiguration'][_0xbc74('0x11b')](db[_0xbc74('0x88')],{'through':_0xbc74('0x1c6')});db[_0xbc74('0xb7')][_0xbc74('0x10f')](db[_0xbc74('0xb7')],{'as':_0xbc74('0x1c0'),'foreignKey':_0xbc74('0x1bc')});db[_0xbc74('0xb7')][_0xbc74('0x10f')](db[_0xbc74('0xb7')],{'as':_0xbc74('0x1c1'),'foreignKey':_0xbc74('0x1be')});db[_0xbc74('0xb7')]['hasMany'](db[_0xbc74('0xb7')],{'as':'Field','foreignKey':_0xbc74('0x1bf')});db['ZendeskField'][_0xbc74('0x14c')](db['Variable'],{'as':'Variable','foreignKey':_0xbc74('0x1c3')});db[_0xbc74('0x1c7')][_0xbc74('0x10f')](db[_0xbc74('0x1c8')],{'as':_0xbc74('0x1b8'),'onDelete':'cascade','foreignKey':_0xbc74('0x1b9')});db['FreshdeskConfiguration'][_0xbc74('0x10f')](db[_0xbc74('0x1c9')],{'as':'Subjects','onDelete':_0xbc74('0x10d'),'foreignKey':_0xbc74('0x1bc')});db[_0xbc74('0x1c8')][_0xbc74('0x10f')](db[_0xbc74('0x1c9')],{'as':'Descriptions','onDelete':_0xbc74('0x10d'),'foreignKey':_0xbc74('0x1be')});db[_0xbc74('0x1c8')][_0xbc74('0x10f')](db['FreshdeskField'],{'as':'Fields','onDelete':_0xbc74('0x10d'),'foreignKey':'FieldId'});db[_0xbc74('0x1c8')][_0xbc74('0x14c')](db[_0xbc74('0x1c7')],{'as':_0xbc74('0x166'),'foreignKey':_0xbc74('0x1b9')});db[_0xbc74('0x1c8')][_0xbc74('0x11b')](db[_0xbc74('0x88')],{'through':_0xbc74('0x1ca')});db[_0xbc74('0x1c9')][_0xbc74('0x10f')](db[_0xbc74('0x1c9')],{'as':'Subject','foreignKey':_0xbc74('0x1bc')});db[_0xbc74('0x1c9')][_0xbc74('0x10f')](db[_0xbc74('0x1c9')],{'as':'Description','foreignKey':_0xbc74('0x1be')});db['FreshdeskField'][_0xbc74('0x10f')](db['FreshdeskField'],{'as':'Field','foreignKey':'FieldId'});db[_0xbc74('0x1c9')][_0xbc74('0x14c')](db[_0xbc74('0x92')],{'as':'Variable','foreignKey':_0xbc74('0x1c3')});db[_0xbc74('0x1cb')]['hasMany'](db[_0xbc74('0xbb')],{'as':_0xbc74('0x1b8'),'onDelete':'cascade','foreignKey':_0xbc74('0x1b9')});db['VtigerConfiguration'][_0xbc74('0x10f')](db[_0xbc74('0xbd')],{'as':_0xbc74('0x1bb'),'foreignKey':_0xbc74('0x1bc')});db[_0xbc74('0xbb')][_0xbc74('0x10f')](db[_0xbc74('0xbd')],{'as':_0xbc74('0x1bd'),'foreignKey':'DescriptionId'});db[_0xbc74('0xbb')][_0xbc74('0x10f')](db[_0xbc74('0xbd')],{'as':_0xbc74('0x1b4'),'foreignKey':_0xbc74('0x1bf')});db[_0xbc74('0xbb')][_0xbc74('0x14c')](db['VtigerAccount'],{'as':_0xbc74('0x166'),'foreignKey':_0xbc74('0x1b9')});db['VtigerField'][_0xbc74('0x10f')](db[_0xbc74('0xbd')],{'as':_0xbc74('0x1c0'),'foreignKey':'SubjectId'});db[_0xbc74('0xbd')][_0xbc74('0x10f')](db[_0xbc74('0xbd')],{'as':_0xbc74('0x1c1'),'foreignKey':_0xbc74('0x1be')});db[_0xbc74('0xbd')][_0xbc74('0x10f')](db[_0xbc74('0xbd')],{'as':'Field','foreignKey':_0xbc74('0x1bf')});db['VtigerField'][_0xbc74('0x14c')](db[_0xbc74('0x92')],{'as':_0xbc74('0x92'),'foreignKey':_0xbc74('0x1c3')});db[_0xbc74('0xbf')][_0xbc74('0x10f')](db[_0xbc74('0x1cc')],{'as':_0xbc74('0x1b8'),'onDelete':_0xbc74('0x10d'),'foreignKey':_0xbc74('0x1b9')});db[_0xbc74('0x1cc')][_0xbc74('0x10f')](db[_0xbc74('0xc1')],{'as':_0xbc74('0x1bb'),'foreignKey':_0xbc74('0x1bc')});db[_0xbc74('0x1cc')][_0xbc74('0x10f')](db[_0xbc74('0xc1')],{'as':_0xbc74('0x1bd'),'foreignKey':'DescriptionId'});db[_0xbc74('0x1cc')]['hasMany'](db['ServicenowField'],{'as':_0xbc74('0x1b4'),'foreignKey':_0xbc74('0x1bf')});db['ServicenowConfiguration'][_0xbc74('0x14c')](db['ServicenowAccount'],{'as':_0xbc74('0x166'),'foreignKey':_0xbc74('0x1b9')});db['ServicenowField'][_0xbc74('0x10f')](db[_0xbc74('0xc1')],{'as':_0xbc74('0x1c0'),'foreignKey':_0xbc74('0x1bc')});db[_0xbc74('0xc1')][_0xbc74('0x10f')](db[_0xbc74('0xc1')],{'as':_0xbc74('0x1c1'),'foreignKey':'DescriptionId'});db[_0xbc74('0xc1')][_0xbc74('0x10f')](db[_0xbc74('0xc1')],{'as':'Field','foreignKey':_0xbc74('0x1bf')});db[_0xbc74('0xc1')][_0xbc74('0x14c')](db[_0xbc74('0x92')],{'as':_0xbc74('0x92'),'foreignKey':_0xbc74('0x1c3')});db[_0xbc74('0xc3')][_0xbc74('0x10f')](db[_0xbc74('0xc4')],{'as':_0xbc74('0x1b8'),'onDelete':_0xbc74('0x10d'),'foreignKey':'AccountId'});db[_0xbc74('0xc4')]['hasMany'](db[_0xbc74('0x1cd')],{'as':'Subjects','onDelete':_0xbc74('0x10d'),'foreignKey':'SubjectId'});db[_0xbc74('0xc4')][_0xbc74('0x10f')](db[_0xbc74('0x1cd')],{'as':_0xbc74('0x1bd'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xbc74('0xc4')][_0xbc74('0x10f')](db['Dynamics365Field'],{'as':'Fields','onDelete':'cascade','foreignKey':_0xbc74('0x1bf')});db[_0xbc74('0xc4')][_0xbc74('0x14c')](db['Dynamics365Account'],{'as':'Account','foreignKey':_0xbc74('0x1b9')});db[_0xbc74('0x1cd')]['hasMany'](db[_0xbc74('0x1cd')],{'as':_0xbc74('0x1c0'),'foreignKey':'SubjectId'});db[_0xbc74('0x1cd')]['hasMany'](db[_0xbc74('0x1cd')],{'as':_0xbc74('0x1c1'),'foreignKey':_0xbc74('0x1be')});db['Dynamics365Field'][_0xbc74('0x10f')](db['Dynamics365Field'],{'as':_0xbc74('0x1c2'),'foreignKey':_0xbc74('0x1bf')});db[_0xbc74('0x1cd')][_0xbc74('0x14c')](db[_0xbc74('0x92')],{'as':_0xbc74('0x92'),'foreignKey':_0xbc74('0x1c3')});db[_0xbc74('0xc7')][_0xbc74('0x10f')](db[_0xbc74('0xc9')],{'as':_0xbc74('0x1b8'),'onDelete':_0xbc74('0x10d'),'foreignKey':'AccountId'});db['FreshsalesConfiguration'][_0xbc74('0x10f')](db[_0xbc74('0xcb')],{'as':_0xbc74('0x1bb'),'foreignKey':_0xbc74('0x1bc')});db[_0xbc74('0xc9')][_0xbc74('0x10f')](db[_0xbc74('0xcb')],{'as':_0xbc74('0x1bd'),'foreignKey':_0xbc74('0x1be')});db[_0xbc74('0xc9')]['hasMany'](db[_0xbc74('0xcb')],{'as':_0xbc74('0x1b4'),'foreignKey':_0xbc74('0x1bf')});db[_0xbc74('0xc9')][_0xbc74('0x14c')](db[_0xbc74('0xc7')],{'as':_0xbc74('0x166'),'foreignKey':_0xbc74('0x1b9')});db[_0xbc74('0xcb')][_0xbc74('0x10f')](db[_0xbc74('0xcb')],{'as':_0xbc74('0x1c0'),'foreignKey':_0xbc74('0x1bc')});db[_0xbc74('0xcb')][_0xbc74('0x10f')](db[_0xbc74('0xcb')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xbc74('0xcb')][_0xbc74('0x10f')](db[_0xbc74('0xcb')],{'as':_0xbc74('0x1c2'),'foreignKey':_0xbc74('0x1bf')});db[_0xbc74('0xcb')][_0xbc74('0x14c')](db[_0xbc74('0x92')],{'as':_0xbc74('0x92'),'foreignKey':_0xbc74('0x1c3')});db[_0xbc74('0x1ce')]['belongsTo'](db[_0xbc74('0x133')],{});db[_0xbc74('0x1ce')]['belongsTo'](db['CmList'],{'as':_0xbc74('0x161'),'foreignKey':'ListId'});db[_0xbc74('0x1ce')][_0xbc74('0x14c')](db[_0xbc74('0x6e')],{'as':_0xbc74('0x16d'),'foreignKey':_0xbc74('0x167')});db[_0xbc74('0x1ce')][_0xbc74('0x14c')](db[_0xbc74('0x62')],{});db[_0xbc74('0x1ce')][_0xbc74('0x14c')](db[_0xbc74('0x64')],{});db['ChatQueueReport'][_0xbc74('0x14c')](db['User'],{});db[_0xbc74('0x1ce')][_0xbc74('0x14c')](db[_0xbc74('0x68')],{});db[_0xbc74('0x18f')]['belongsTo'](db[_0xbc74('0x14')],{'onDelete':_0xbc74('0x10d'),'foreignKey':_0xbc74('0x1cf')});db[_0xbc74('0x18f')][_0xbc74('0x14c')](db[_0xbc74('0x14')],{'onDelete':'cascade','foreignKey':_0xbc74('0x1d0')});db[_0xbc74('0xd3')][_0xbc74('0x10f')](db['JscriptyQuestionReport'],{'foreignKey':'SessionId','onDelete':_0xbc74('0x10d')});db[_0xbc74('0xd3')]['hasMany'](db[_0xbc74('0x1d1')],{'foreignKey':_0xbc74('0x1d2'),'onDelete':_0xbc74('0x10d')});db[_0xbc74('0xd4')][_0xbc74('0x14c')](db[_0xbc74('0x51')],{});db['SmsQueueReport'][_0xbc74('0x14c')](db['CmList'],{'as':_0xbc74('0x161'),'foreignKey':_0xbc74('0x162')});db[_0xbc74('0xd4')][_0xbc74('0x14c')](db['CmContact'],{'as':_0xbc74('0x16d'),'foreignKey':_0xbc74('0x167')});db[_0xbc74('0xd4')][_0xbc74('0x14c')](db[_0xbc74('0x116')],{});db[_0xbc74('0xd4')][_0xbc74('0x14c')](db[_0xbc74('0x54')],{});db[_0xbc74('0xd4')][_0xbc74('0x14c')](db['User'],{});db[_0xbc74('0xd4')][_0xbc74('0x14c')](db[_0xbc74('0x12c')],{});db[_0xbc74('0xd9')][_0xbc74('0x10f')](db[_0xbc74('0xd3')],{'foreignKey':_0xbc74('0x1d3')});db[_0xbc74('0xd9')][_0xbc74('0x10f')](db[_0xbc74('0xd2')],{'foreignKey':_0xbc74('0x1d3')});db[_0xbc74('0xd9')][_0xbc74('0x10f')](db[_0xbc74('0x1d1')],{'foreignKey':'ProjectId'});db[_0xbc74('0x13e')][_0xbc74('0x11b')](db[_0xbc74('0x14')],{'as':_0xbc74('0x178'),'through':_0xbc74('0x140')});db[_0xbc74('0xe0')]['belongsToMany'](db[_0xbc74('0x14')],{'as':_0xbc74('0x151'),'through':_0xbc74('0x120')});db[_0xbc74('0xe0')]['belongsToMany'](db['VoiceQueue'],{'through':_0xbc74('0x10a'),'as':_0xbc74('0x128')});db[_0xbc74('0xe0')]['belongsToMany'](db[_0xbc74('0x3b')],{'through':'team_has_mail_queues','as':_0xbc74('0x1d4')});db[_0xbc74('0xe0')][_0xbc74('0x11b')](db['ChatQueue'],{'through':_0xbc74('0x18e'),'as':'ChatQueues'});db[_0xbc74('0xe0')]['belongsToMany'](db[_0xbc74('0x4d')],{'through':_0xbc74('0x1d5'),'as':_0xbc74('0x12b')});db['Team'][_0xbc74('0x11b')](db[_0xbc74('0x12c')],{'through':_0xbc74('0x17f'),'as':_0xbc74('0x1d6')});db[_0xbc74('0xe0')][_0xbc74('0x11b')](db['OpenchannelQueue'],{'through':'team_has_openchannel_queues','as':'OpenchannelQueues'});db[_0xbc74('0xe0')][_0xbc74('0x11b')](db[_0xbc74('0x106')],{'through':_0xbc74('0x1d7'),'as':_0xbc74('0x12f')});db[_0xbc74('0xe3')]['hasMany'](db[_0xbc74('0x195')],{'as':'Hoppers','foreignKey':_0xbc74('0x19b')});db[_0xbc74('0xe3')]['hasMany'](db[_0xbc74('0x73')],{'as':_0xbc74('0x112'),'foreignKey':'CampaignId'});db['Campaign'][_0xbc74('0x10f')](db['CmHopperHistory'],{'as':_0xbc74('0x196'),'foreignKey':_0xbc74('0x19b')});db[_0xbc74('0xe3')]['hasMany'](db[_0xbc74('0x71')],{'as':'HopperBlacks','foreignKey':_0xbc74('0x19b')});db[_0xbc74('0xe3')]['belongsTo'](db[_0xbc74('0x2a')],{'as':_0xbc74('0x2a'),'foreignKey':_0xbc74('0x1d8')});db['Campaign'][_0xbc74('0x14c')](db[_0xbc74('0x2a')],{'as':_0xbc74('0x1d9'),'foreignKey':_0xbc74('0x14d')});db[_0xbc74('0xe3')][_0xbc74('0x14c')](db[_0xbc74('0x7d')],{'as':_0xbc74('0x7d'),'foreignKey':_0xbc74('0x14e')});db[_0xbc74('0xe3')]['belongsTo'](db[_0xbc74('0x13e')],{'as':_0xbc74('0x13e'),'foreignKey':_0xbc74('0x1da')});db['Campaign'][_0xbc74('0x11b')](db[_0xbc74('0x130')],{'as':_0xbc74('0x11f'),'through':_0xbc74('0x1db')});db['Campaign'][_0xbc74('0x11b')](db['CmList'],{'as':_0xbc74('0x1dc'),'through':_0xbc74('0x1dd')});db[_0xbc74('0xe7')][_0xbc74('0x14c')](db[_0xbc74('0x66')],{'as':_0xbc74('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0xbc74('0xeb')]['belongsTo'](db[_0xbc74('0x3f')],{});db[_0xbc74('0xeb')][_0xbc74('0x14c')](db[_0xbc74('0x3d')],{});db[_0xbc74('0xeb')][_0xbc74('0x14c')](db[_0xbc74('0x137')],{'foreignKey':_0xbc74('0x1de'),'as':'FromAccount'});db['MailTransferReport'][_0xbc74('0x14c')](db[_0xbc74('0x14')],{'foreignKey':'FromUserId','as':_0xbc74('0x1df')});db[_0xbc74('0xeb')][_0xbc74('0x14c')](db['User'],{'foreignKey':_0xbc74('0x1e0'),'as':_0xbc74('0x1e1')});db[_0xbc74('0xeb')][_0xbc74('0x14c')](db['MailQueue'],{'foreignKey':_0xbc74('0x1e2'),'as':_0xbc74('0x1e3')});db['MailTransferReport'][_0xbc74('0x14c')](db[_0xbc74('0x137')],{'foreignKey':_0xbc74('0x1e4'),'as':_0xbc74('0x1e5')});db[_0xbc74('0xec')][_0xbc74('0x14c')](db[_0xbc74('0x64')],{});db[_0xbc74('0xec')]['belongsTo'](db['ChatInteraction'],{});db[_0xbc74('0xec')][_0xbc74('0x14c')](db[_0xbc74('0x133')],{'foreignKey':_0xbc74('0x1e6'),'as':_0xbc74('0x1e7')});db['ChatTransferReport'][_0xbc74('0x14c')](db['User'],{'foreignKey':_0xbc74('0x1e8'),'as':'FromAgent'});db['ChatTransferReport'][_0xbc74('0x14c')](db[_0xbc74('0x14')],{'foreignKey':_0xbc74('0x1e0'),'as':'ToAgent'});db['ChatTransferReport'][_0xbc74('0x14c')](db[_0xbc74('0x68')],{'foreignKey':_0xbc74('0x1e9'),'as':_0xbc74('0x1e3')});db[_0xbc74('0xec')][_0xbc74('0x14c')](db['ChatWebsite'],{'foreignKey':_0xbc74('0x1ea'),'as':'ToAccount'});db[_0xbc74('0x1eb')][_0xbc74('0x14c')](db[_0xbc74('0x4c')],{});db['FaxTransferReport'][_0xbc74('0x14c')](db['FaxInteraction'],{});db[_0xbc74('0x1eb')]['belongsTo'](db[_0xbc74('0x136')],{'foreignKey':'FromFaxAccountId','as':'FromAccount'});db[_0xbc74('0x1eb')][_0xbc74('0x14c')](db[_0xbc74('0x14')],{'foreignKey':_0xbc74('0x1e8'),'as':'FromAgent'});db[_0xbc74('0x1eb')][_0xbc74('0x14c')](db['User'],{'foreignKey':_0xbc74('0x1e0'),'as':_0xbc74('0x1e1')});db[_0xbc74('0x1eb')][_0xbc74('0x14c')](db[_0xbc74('0x4d')],{'foreignKey':_0xbc74('0x1ec'),'as':_0xbc74('0x1e3')});db[_0xbc74('0x1eb')]['belongsTo'](db[_0xbc74('0x136')],{'foreignKey':_0xbc74('0x1ed'),'as':_0xbc74('0x1e5')});db['OpenchannelTransferReport'][_0xbc74('0x14c')](db[_0xbc74('0x5c')],{});db[_0xbc74('0xee')][_0xbc74('0x14c')](db[_0xbc74('0x5a')],{});db['OpenchannelTransferReport'][_0xbc74('0x14c')](db[_0xbc74('0x57')],{'foreignKey':_0xbc74('0x1ee'),'as':_0xbc74('0x1e7')});db[_0xbc74('0xee')][_0xbc74('0x14c')](db['User'],{'foreignKey':_0xbc74('0x1e8'),'as':_0xbc74('0x1df')});db[_0xbc74('0xee')]['belongsTo'](db['User'],{'foreignKey':_0xbc74('0x1e0'),'as':_0xbc74('0x1e1')});db[_0xbc74('0xee')][_0xbc74('0x14c')](db[_0xbc74('0x12d')],{'foreignKey':_0xbc74('0x1ef'),'as':_0xbc74('0x1e3')});db[_0xbc74('0xee')][_0xbc74('0x14c')](db[_0xbc74('0x57')],{'foreignKey':_0xbc74('0x1f0'),'as':_0xbc74('0x1e5')});db['SmsTransferReport'][_0xbc74('0x14c')](db[_0xbc74('0x54')],{});db['SmsTransferReport'][_0xbc74('0x14c')](db[_0xbc74('0x116')],{});db[_0xbc74('0xf0')][_0xbc74('0x14c')](db['SmsAccount'],{'foreignKey':_0xbc74('0x1f1'),'as':_0xbc74('0x1e7')});db['SmsTransferReport'][_0xbc74('0x14c')](db[_0xbc74('0x14')],{'foreignKey':_0xbc74('0x1e8'),'as':_0xbc74('0x1df')});db['SmsTransferReport'][_0xbc74('0x14c')](db[_0xbc74('0x14')],{'foreignKey':'ToUserId','as':_0xbc74('0x1e1')});db[_0xbc74('0xf0')][_0xbc74('0x14c')](db[_0xbc74('0x12c')],{'foreignKey':'ToSmsQueueId','as':'ToQueue'});db[_0xbc74('0xf0')][_0xbc74('0x14c')](db[_0xbc74('0x51')],{'foreignKey':_0xbc74('0x1f2'),'as':_0xbc74('0x1e5')});db[_0xbc74('0x130')][_0xbc74('0x10f')](db['Disposition'],{'as':_0xbc74('0x15e'),'foreignKey':'ListId','onDelete':'cascade'});db[_0xbc74('0x130')]['hasMany'](db[_0xbc74('0x77')],{'as':_0xbc74('0x1f3'),'foreignKey':'ListId'});db[_0xbc74('0x130')][_0xbc74('0x10f')](db[_0xbc74('0x6e')],{'as':_0xbc74('0x191'),'onDelete':_0xbc74('0x10d'),'foreignKey':_0xbc74('0x162')});db[_0xbc74('0x130')]['hasMany'](db[_0xbc74('0x73')],{'as':_0xbc74('0x112'),'foreignKey':_0xbc74('0x162')});db['CmList'][_0xbc74('0x10f')](db[_0xbc74('0x113')],{'as':_0xbc74('0x1f4'),'foreignKey':_0xbc74('0x162')});db[_0xbc74('0x130')]['hasMany'](db[_0xbc74('0x149')],{'as':_0xbc74('0x149'),'foreignKey':_0xbc74('0x162')});db[_0xbc74('0x130')]['belongsToMany'](db[_0xbc74('0x1c')],{'as':'Queues','through':_0xbc74('0x150')});db[_0xbc74('0x130')][_0xbc74('0x11b')](db[_0xbc74('0x14')],{'as':'Agents','through':_0xbc74('0x131')});db['VoicePrefix']['hasMany'](db[_0xbc74('0x1a')],{'as':_0xbc74('0x111'),'onDelete':_0xbc74('0x10d')});db[_0xbc74('0xf3')][_0xbc74('0x11b')](db['User'],{'as':_0xbc74('0x151'),'through':_0xbc74('0x1f5')});db[_0xbc74('0xf5')][_0xbc74('0x10f')](db[_0xbc74('0x14')],{'as':_0xbc74('0x178'),'foreignKey':_0xbc74('0x11a')});db[_0xbc74('0xf5')]['hasMany'](db[_0xbc74('0xf7')],{'as':_0xbc74('0x1f6'),'foreignKey':_0xbc74('0x11a'),'onDelete':_0xbc74('0x10d')});db[_0xbc74('0xf7')][_0xbc74('0x10f')](db['UserProfileResource'],{'as':_0xbc74('0x1f7'),'foreignKey':_0xbc74('0x1f8'),'onDelete':_0xbc74('0x10d')});db[_0xbc74('0xfc')][_0xbc74('0x10f')](db[_0xbc74('0x7a')],{'as':_0xbc74('0x15e'),'foreignKey':_0xbc74('0x1f9'),'onDelete':'cascade'});db[_0xbc74('0xfc')][_0xbc74('0x10f')](db[_0xbc74('0x17b')],{'as':_0xbc74('0x15f'),'foreignKey':_0xbc74('0x1f9')});db[_0xbc74('0xfc')]['hasMany'](db[_0xbc74('0x101')],{'as':_0xbc74('0x155'),'foreignKey':'WhatsappAccountId'});db['WhatsappAccount']['hasMany'](db[_0xbc74('0xff')],{'as':_0xbc74('0x160')});db[_0xbc74('0xfc')][_0xbc74('0x10f')](db[_0xbc74('0xfd')],{'as':'Applications'});db[_0xbc74('0xfc')][_0xbc74('0x14c')](db[_0xbc74('0x130')],{'as':_0xbc74('0x161'),'foreignKey':'ListId'});db[_0xbc74('0xfc')][_0xbc74('0x14c')](db['Pause'],{'as':_0xbc74('0x164'),'foreignKey':_0xbc74('0x14f')});db[_0xbc74('0xfc')][_0xbc74('0x11b')](db[_0xbc74('0x14')],{'as':_0xbc74('0x151'),'through':_0xbc74('0x1fa')});db[_0xbc74('0xfd')]['belongsTo'](db[_0xbc74('0x14')],{'onDelete':_0xbc74('0x171')});db['WhatsappApplication'][_0xbc74('0x14c')](db[_0xbc74('0x106')],{'onDelete':_0xbc74('0x171')});db[_0xbc74('0xfd')][_0xbc74('0x14c')](db[_0xbc74('0xfc')],{'onDelete':_0xbc74('0x171')});db[_0xbc74('0xfd')][_0xbc74('0x14c')](db[_0xbc74('0x7d')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0xbc74('0xfd')][_0xbc74('0x14c')](db[_0xbc74('0x88')],{'onDelete':'restrict','foreignKey':_0xbc74('0x172')});db[_0xbc74('0xff')][_0xbc74('0x10f')](db[_0xbc74('0x101')],{'as':_0xbc74('0x155'),'onDelete':_0xbc74('0x10d'),'foreignKey':_0xbc74('0x1fb')});db[_0xbc74('0xff')][_0xbc74('0x14c')](db[_0xbc74('0xfc')],{'as':_0xbc74('0x166'),'foreignKey':_0xbc74('0x1f9')});db[_0xbc74('0xff')]['belongsTo'](db[_0xbc74('0x6e')],{'as':_0xbc74('0x16d'),'foreignKey':_0xbc74('0x167')});db[_0xbc74('0xff')][_0xbc74('0x14c')](db['User'],{'as':_0xbc74('0x168'),'foreignKey':_0xbc74('0x10e')});db[_0xbc74('0xff')][_0xbc74('0x11b')](db[_0xbc74('0x88')],{'through':_0xbc74('0x1a9'),'as':_0xbc74('0x16a')});db[_0xbc74('0xff')]['belongsToMany'](db[_0xbc74('0x88')],{'through':_0xbc74('0x1a9'),'as':_0xbc74('0x16b')});db['WhatsappInteraction'][_0xbc74('0x11b')](db[_0xbc74('0x14')],{'as':_0xbc74('0x178'),'through':_0xbc74('0x127'),'foreignKey':'WhatsappInteractionId'});db[_0xbc74('0x101')][_0xbc74('0x14c')](db[_0xbc74('0x14')],{'as':_0xbc74('0x14')});db[_0xbc74('0x101')][_0xbc74('0x14c')](db[_0xbc74('0x6e')],{'onDelete':_0xbc74('0x10d'),'as':_0xbc74('0x16d')});db[_0xbc74('0x101')][_0xbc74('0x14c')](db[_0xbc74('0xff')],{'onDelete':_0xbc74('0x10d'),'as':_0xbc74('0x16e'),'foreignKey':'WhatsappInteractionId'});db[_0xbc74('0x101')][_0xbc74('0x14c')](db[_0xbc74('0xfc')],{'as':_0xbc74('0x166'),'foreignKey':'WhatsappAccountId'});db[_0xbc74('0x103')][_0xbc74('0x14c')](db[_0xbc74('0xfc')],{});db[_0xbc74('0x103')][_0xbc74('0x14c')](db[_0xbc74('0x130')],{'as':_0xbc74('0x161'),'foreignKey':_0xbc74('0x162')});db[_0xbc74('0x103')][_0xbc74('0x14c')](db['CmContact'],{'as':_0xbc74('0x16d'),'foreignKey':_0xbc74('0x167')});db[_0xbc74('0x103')]['belongsTo'](db[_0xbc74('0xff')],{});db[_0xbc74('0x103')][_0xbc74('0x14c')](db[_0xbc74('0x106')],{});db[_0xbc74('0x103')][_0xbc74('0x14c')](db['WhatsappMessage'],{});db['WhatsappQueueReport'][_0xbc74('0x14c')](db[_0xbc74('0x14')],{});db[_0xbc74('0x1fc')][_0xbc74('0x14c')](db[_0xbc74('0x101')],{});db[_0xbc74('0x1fc')][_0xbc74('0x14c')](db[_0xbc74('0xff')],{});db[_0xbc74('0x1fc')]['belongsTo'](db[_0xbc74('0xfc')],{'foreignKey':_0xbc74('0x1fd'),'as':_0xbc74('0x1e7')});db[_0xbc74('0x1fc')]['belongsTo'](db[_0xbc74('0xfc')],{'foreignKey':_0xbc74('0x1fe'),'as':_0xbc74('0x1e5')});db[_0xbc74('0x1fc')][_0xbc74('0x14c')](db['WhatsappQueue'],{'foreignKey':'ToQueueId','as':_0xbc74('0x1e3')});db['WhatsappTransferReport'][_0xbc74('0x14c')](db[_0xbc74('0x14')],{'foreignKey':'FromUserId','as':_0xbc74('0x1df')});db[_0xbc74('0x1fc')][_0xbc74('0x14c')](db[_0xbc74('0x14')],{'foreignKey':_0xbc74('0x1e0'),'as':_0xbc74('0x1e1')});db[_0xbc74('0x106')][_0xbc74('0x11b')](db[_0xbc74('0x14')],{'as':_0xbc74('0x151'),'through':_0xbc74('0x36'),'foreignKey':_0xbc74('0x1ff')});db[_0xbc74('0x106')][_0xbc74('0x11b')](db['Team'],{'through':_0xbc74('0x1d7'),'as':_0xbc74('0x152')});module[_0xbc74('0x200')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 8de237b..2059254 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb091=['/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','./api/intFreshdeskField','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/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/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','/api/jscripty/questions/reports','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/team','./api/campaign','./api/migration','/api/plugins','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','/api/realtime','./api/realtime','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','./api/jira','/api/rpc','/api/version','/api/system','./api/system','/api/pm2','/api/webbar','./api/webbar','/apidoc','/www','static','join','root','/demo','/snippet','3.0.0','/plugins','/server/files/plugins','get','route','sendFile','username','password','newPassword','apiKey','firstName','lastName','street','phone','mobile','fax','email','clientId','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','authToken','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','privateKey','accesskeyid','key','pass','accountSid','localstationid','dsn','secret','oldPassword','isPlainObject','isArray','length','isString','replace','@@{','}@@','includes','lodash','path','express','util','./errors','api','auth','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','method','headers','x-forwarded-for','connection','remoteAddress','statusCode','responseTime','user','name','role','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','other','agent_name','test','url','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/queues','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','./api/memberReport','/api/trunks','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','./api/mailQueue','./api/mailSubstatus','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/faxAccount','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','/api/sms/messages','/api/sms/queues','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','./api/tag','/api/contact_item_types','/api/cm_contact_has_items','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','/api/variables','./api/variable','/api/integrations','./api/integrationReport','/api/analytics/custom_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField'];(function(_0x4314d7,_0x355218){var _0x5c599b=function(_0x556354){while(--_0x556354){_0x4314d7['push'](_0x4314d7['shift']());}};_0x5c599b(++_0x355218);}(_0xb091,0x9d));var _0x1b09=function(_0x158cbd,_0x1df425){_0x158cbd=_0x158cbd-0x0;var _0x13ea32=_0xb091[_0x158cbd];return _0x13ea32;};'use strict';var _=require(_0x1b09('0x0'));var path=require(_0x1b09('0x1'));var express=require(_0x1b09('0x2'));var ewinston=require('express-winston');var util=require(_0x1b09('0x3'));var errors=require(_0x1b09('0x4'));var config=require('./config/environment');var logger=require('./config/logger')(_0x1b09('0x5'));var authLogger=require('./config/logger')(_0x1b09('0x6'));exports[_0x1b09('0x7')]=function(_0x3012d2){_0x3012d2[_0x1b09('0x8')](ewinston[_0x1b09('0x9')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x307ee4,_0x5d1d35){var _0x22296b=_0x1b09('0xa');if(!_[_0x1b09('0xb')](_0x307ee4[_0x1b09('0xc')])){_0x22296b+='\x20body=%s';var _0x21d262=_0x307ee4[_0x1b09('0xc')];maskSensitiveData(_0x21d262);}return util[_0x1b09('0xd')](_0x22296b,_0x307ee4[_0x1b09('0xe')],_0x307ee4[_0x1b09('0xf')]['x-forwarded-for']?_0x307ee4[_0x1b09('0xf')][_0x1b09('0x10')]:_0x307ee4[_0x1b09('0x11')][_0x1b09('0x12')]||_0x307ee4['ip'],_0x307ee4['url'],_0x5d1d35[_0x1b09('0x13')],_0x5d1d35[_0x1b09('0x14')],_0x307ee4[_0x1b09('0x15')]?_0x307ee4[_0x1b09('0x15')]['id']:null,_0x307ee4[_0x1b09('0x15')]?_0x307ee4['user'][_0x1b09('0x16')]:null,_0x307ee4['user']?_0x307ee4[_0x1b09('0x15')][_0x1b09('0x17')]:null,_0x21d262?util['inspect'](_0x21d262,![],null):'');}}));_0x3012d2[_0x1b09('0x8')](ewinston['logger']({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x438512,_0x14059){var _0x5b410e=_0x1b09('0x18');if(_0x438512['body']&&_0x438512['body'][_0x1b09('0x19')]&&_0x438512[_0x1b09('0xc')][_0x1b09('0x1a')]){_0x5b410e=_0x1b09('0x1b');}return util['format'](_0x5b410e,_0x438512[_0x1b09('0xe')],_0x438512[_0x1b09('0xf')][_0x1b09('0x10')]?_0x438512['headers'][_0x1b09('0x10')]:_0x438512[_0x1b09('0x11')][_0x1b09('0x12')]||_0x438512['ip'],_0x438512['url'],_0x14059['statusCode'],_0x14059[_0x1b09('0x14')],_0x438512[_0x1b09('0x15')]?_0x438512[_0x1b09('0x15')]['id']:null,_0x438512[_0x1b09('0x15')]?_0x438512['user'][_0x1b09('0x16')]:null,_0x438512[_0x1b09('0x15')]?_0x438512['user'][_0x1b09('0x17')]:null,_0x438512[_0x1b09('0xc')]&&_0x438512[_0x1b09('0xc')][_0x1b09('0x19')]?_0x438512[_0x1b09('0xc')][_0x1b09('0x19')]:_0x1b09('0x1c'),_0x438512['body']&&_0x438512[_0x1b09('0xc')][_0x1b09('0x1a')]?_0x438512[_0x1b09('0xc')][_0x1b09('0x1a')]:'',_0x438512['body']&&_0x438512[_0x1b09('0xc')][_0x1b09('0x1d')]?_0x438512['body'][_0x1b09('0x1d')]:'');},'ignoreRoute':function(_0x5a853b){var _0xbacf42=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0xbacf42[_0x1b09('0x1e')](_0x5a853b[_0x1b09('0x1f')]);}}));_0x3012d2['use'](_0x1b09('0x20'),require(_0x1b09('0x21')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x22'),require(_0x1b09('0x23')));_0x3012d2['use'](_0x1b09('0x24'),require(_0x1b09('0x25')));_0x3012d2['use'](_0x1b09('0x26'),require(_0x1b09('0x27')));_0x3012d2[_0x1b09('0x8')]('/api/voice/mohs',require('./api/voiceMusicOnHold'));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x28'),require('./api/voiceQueue'));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x29'),require('./api/voiceRecording'));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x2a'),require(_0x1b09('0x2b')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x2c'),require('./api/voiceMail'));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x2d'),require(_0x1b09('0x2e')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x2f'),require('./api/voiceCallReport'));_0x3012d2[_0x1b09('0x8')]('/api/voice/dials/reports',require(_0x1b09('0x30')));_0x3012d2['use'](_0x1b09('0x31'),require(_0x1b09('0x32')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x33'),require(_0x1b09('0x34')));_0x3012d2['use']('/api/members/reports',require(_0x1b09('0x35')));_0x3012d2['use'](_0x1b09('0x36'),require('./api/trunk'));_0x3012d2[_0x1b09('0x8')]('/api/voice/transfers/reports',require(_0x1b09('0x37')));_0x3012d2['use'](_0x1b09('0x38'),require(_0x1b09('0x39')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x3a'),require('./api/mailAccount'));_0x3012d2['use'](_0x1b09('0x3b'),require(_0x1b09('0x3c')));_0x3012d2['use']('/api/mail/substatuses',require(_0x1b09('0x3d')));_0x3012d2[_0x1b09('0x8')]('/api/mail/interactions',require('./api/mailInteraction'));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x3e'),require(_0x1b09('0x3f')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x40'),require(_0x1b09('0x41')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x42'),require(_0x1b09('0x43')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x44'),require(_0x1b09('0x45')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x46'),require('./api/dashboardItem'));_0x3012d2[_0x1b09('0x8')]('/api/fax/accounts',require(_0x1b09('0x47')));_0x3012d2[_0x1b09('0x8')]('/api/fax/applications',require(_0x1b09('0x48')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x49'),require(_0x1b09('0x4a')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x4b'),require(_0x1b09('0x4c')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x4d'),require('./api/faxQueue'));_0x3012d2['use'](_0x1b09('0x4e'),require(_0x1b09('0x4f')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x50'),require(_0x1b09('0x51')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x52'),require(_0x1b09('0x53')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x54'),require('./api/smsInteraction'));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x55'),require('./api/smsMessage'));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x56'),require('./api/smsQueue'));_0x3012d2['use']('/api/openchannel/accounts',require(_0x1b09('0x57')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x58'),require(_0x1b09('0x59')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x5a'),require('./api/openchannelInteraction'));_0x3012d2[_0x1b09('0x8')]('/api/openchannel/messages',require('./api/openchannelMessage'));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x5b'),require('./api/openchannelQueue'));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x5c'),require(_0x1b09('0x5d')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x5e'),require(_0x1b09('0x5f')));_0x3012d2[_0x1b09('0x8')]('/api/chat/applications',require('./api/chatApplication'));_0x3012d2['use']('/api/chat/interactions',require('./api/chatInteraction'));_0x3012d2['use']('/api/chat/messages',require(_0x1b09('0x60')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x61'),require(_0x1b09('0x62')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x63'),require('./api/chatQueue'));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x64'),require(_0x1b09('0x65')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x66'),require(_0x1b09('0x67')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x68'),require(_0x1b09('0x69')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x6a'),require('./api/cmContact'));_0x3012d2[_0x1b09('0x8')]('/api/cm/hopper',require('./api/cmHopper'));_0x3012d2['use'](_0x1b09('0x6b'),require(_0x1b09('0x6c')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x6d'),require(_0x1b09('0x6e')));_0x3012d2['use'](_0x1b09('0x6f'),require(_0x1b09('0x70')));_0x3012d2[_0x1b09('0x8')]('/api/cm/custom_fields',require(_0x1b09('0x71')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x72'),require(_0x1b09('0x73')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x74'),require(_0x1b09('0x75')));_0x3012d2['use'](_0x1b09('0x76'),require(_0x1b09('0x77')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x78'),require(_0x1b09('0x79')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x7a'),require(_0x1b09('0x7b')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x7c'),require(_0x1b09('0x7d')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x7e'),require('./api/pause'));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x7f'),require(_0x1b09('0x80')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x81'),require(_0x1b09('0x82')));_0x3012d2['use'](_0x1b09('0x83'),require(_0x1b09('0x84')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x85'),require(_0x1b09('0x86')));_0x3012d2[_0x1b09('0x8')]('/api/tags',require(_0x1b09('0x87')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x88'),require('./api/contactItemType'));_0x3012d2['use'](_0x1b09('0x89'),require('./api/cmContactHasItem'));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x8a'),require(_0x1b09('0x8b')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x8c'),require(_0x1b09('0x8d')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x8e'),require('./api/trigger'));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x8f'),require(_0x1b09('0x90')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x91'),require('./api/integration'));_0x3012d2[_0x1b09('0x8')]('/api/integrations/reports',require(_0x1b09('0x92')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x93'),require('./api/analyticCustomReport'));_0x3012d2[_0x1b09('0x8')]('/api/analytics/default_reports',require(_0x1b09('0x94')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x95'),require(_0x1b09('0x96')));_0x3012d2['use'](_0x1b09('0x97'),require(_0x1b09('0x98')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x99'),require(_0x1b09('0x9a')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x9b'),require('./api/analyticTreeReport'));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x9c'),require('./api/intSalesforceAccount'));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x9d'),require(_0x1b09('0x9e')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x9f'),require(_0x1b09('0xa0')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0xa1'),require(_0x1b09('0xa2')));_0x3012d2[_0x1b09('0x8')]('/api/integrations/sugarcrm/configurations',require('./api/intSugarcrmConfiguration'));_0x3012d2['use'](_0x1b09('0xa3'),require(_0x1b09('0xa4')));_0x3012d2['use'](_0x1b09('0xa5'),require('./api/intDeskAccount'));_0x3012d2[_0x1b09('0x8')](_0x1b09('0xa6'),require(_0x1b09('0xa7')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0xa8'),require(_0x1b09('0xa9')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0xaa'),require(_0x1b09('0xab')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0xac'),require(_0x1b09('0xad')));_0x3012d2[_0x1b09('0x8')]('/api/integrations/zoho/fields',require(_0x1b09('0xae')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0xaf'),require(_0x1b09('0xb0')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0xb1'),require(_0x1b09('0xb2')));_0x3012d2['use'](_0x1b09('0xb3'),require(_0x1b09('0xb4')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0xb5'),require(_0x1b09('0xb6')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0xb7'),require(_0x1b09('0xb8')));_0x3012d2[_0x1b09('0x8')]('/api/integrations/freshdesk/fields',require(_0x1b09('0xb9')));_0x3012d2['use']('/api/integrations/vtiger/accounts',require(_0x1b09('0xba')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0xbb'),require(_0x1b09('0xbc')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0xbd'),require(_0x1b09('0xbe')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0xbf'),require('./api/intServicenowAccount'));_0x3012d2[_0x1b09('0x8')](_0x1b09('0xc0'),require('./api/intServicenowConfiguration'));_0x3012d2['use'](_0x1b09('0xc1'),require(_0x1b09('0xc2')));_0x3012d2[_0x1b09('0x8')]('/api/integrations/dynamics365/accounts',require(_0x1b09('0xc3')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0xc4'),require('./api/intDynamics365Configuration'));_0x3012d2['use'](_0x1b09('0xc5'),require(_0x1b09('0xc6')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0xc7'),require(_0x1b09('0xc8')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0xc9'),require(_0x1b09('0xca')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0xcb'),require('./api/intFreshsalesField'));_0x3012d2[_0x1b09('0x8')](_0x1b09('0xcc'),require(_0x1b09('0xcd')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0xce'),require(_0x1b09('0xcf')));_0x3012d2['use'](_0x1b09('0xd0'),require('./api/chatInternalMessage'));_0x3012d2[_0x1b09('0x8')](_0x1b09('0xd1'),require('./api/jscriptyAnswerReport'));_0x3012d2['use'](_0x1b09('0xd2'),require('./api/jscriptyQuestionReport'));_0x3012d2[_0x1b09('0x8')](_0x1b09('0xd3'),require(_0x1b09('0xd4')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0xd5'),require('./api/smsQueueReport'));_0x3012d2['use'](_0x1b09('0xd6'),require(_0x1b09('0xd7')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0xd8'),require(_0x1b09('0xd9')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0xda'),require(_0x1b09('0xdb')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0xdc'),require(_0x1b09('0xdd')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0xde'),require('./api/squareOdbc'));_0x3012d2[_0x1b09('0x8')]('/api/square/projects',require(_0x1b09('0xdf')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0xe0'),require(_0x1b09('0xe1')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0xe2'),require('./api/squareMessage'));_0x3012d2[_0x1b09('0x8')]('/api/teams',require(_0x1b09('0xe3')));_0x3012d2[_0x1b09('0x8')]('/api/license',require('./api/license'));_0x3012d2[_0x1b09('0x8')]('/api/campaigns',require(_0x1b09('0xe4')));_0x3012d2[_0x1b09('0x8')]('/api/migrations',require(_0x1b09('0xe5')));_0x3012d2[_0x1b09('0x8')]('/api/attachments',require('./api/attachment'));_0x3012d2[_0x1b09('0x8')](_0x1b09('0xe6'),require('./api/plugin'));_0x3012d2[_0x1b09('0x8')](_0x1b09('0xe7'),require('./api/mailTransferReport'));_0x3012d2[_0x1b09('0x8')](_0x1b09('0xe8'),require(_0x1b09('0xe9')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0xea'),require(_0x1b09('0xeb')));_0x3012d2['use'](_0x1b09('0xec'),require(_0x1b09('0xed')));_0x3012d2[_0x1b09('0x8')]('/api/sms/reports/transfer',require(_0x1b09('0xee')));_0x3012d2['use'](_0x1b09('0xef'),require(_0x1b09('0xf0')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0xf1'),require(_0x1b09('0xf2')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0xf3'),require(_0x1b09('0xf4')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0xf5'),require(_0x1b09('0xf6')));_0x3012d2['use'](_0x1b09('0xf7'),require(_0x1b09('0xf8')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0xf9'),require('./api/userNotification'));_0x3012d2[_0x1b09('0x8')]('/api/whatsapp/accounts',require(_0x1b09('0xfa')));_0x3012d2['use'](_0x1b09('0xfb'),require(_0x1b09('0xfc')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0xfd'),require(_0x1b09('0xfe')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0xff'),require(_0x1b09('0x100')));_0x3012d2['use'](_0x1b09('0x101'),require(_0x1b09('0x102')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x103'),require(_0x1b09('0x104')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x105'),require('./api/whatsappQueue'));_0x3012d2[_0x1b09('0x8')]('/api/cloudProviders',require('./api/cloudProvider'));_0x3012d2['use'](_0x1b09('0x106'),require(_0x1b09('0x107')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x108'),require(_0x1b09('0x109')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x10a'),require(_0x1b09('0x10b')));_0x3012d2[_0x1b09('0x8')]('/api/jira',require(_0x1b09('0x10c')));_0x3012d2['use'](_0x1b09('0x10d'),require('./api/rpc'));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x10e'),require('./api/version'));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x10f'),require(_0x1b09('0x110')));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x111'),require('./api/pm2'));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x112'),require(_0x1b09('0x113')));_0x3012d2[_0x1b09('0x8')]('/apidoc',express['static'](path['join'](config['root'],_0x1b09('0x114'))));_0x3012d2['use'](_0x1b09('0x115'),express[_0x1b09('0x116')](path[_0x1b09('0x117')](config[_0x1b09('0x118')],_0x1b09('0x115'))));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x119'),express[_0x1b09('0x116')](path[_0x1b09('0x117')](config[_0x1b09('0x118')],_0x1b09('0x119'))));_0x3012d2[_0x1b09('0x8')](_0x1b09('0x11a'),express[_0x1b09('0x116')](path[_0x1b09('0x117')](config[_0x1b09('0x118')],'snippet',_0x1b09('0x11b'))));_0x3012d2['use'](_0x1b09('0x11c'),express[_0x1b09('0x116')](path[_0x1b09('0x117')](config[_0x1b09('0x118')],_0x1b09('0x11d'))));_0x3012d2['route']('/:url(api|auth|components|app|bower_components|assets)/*')[_0x1b09('0x11e')](errors[0x194]);_0x3012d2[_0x1b09('0x11f')]('/*')['get'](function(_0x39eac3,_0x46a5e4){_0x46a5e4[_0x1b09('0x120')](path['resolve'](_0x3012d2[_0x1b09('0x11e')]('appPath')+'/index.html'));});};var sensitiveFields=[_0x1b09('0x121'),_0x1b09('0x122'),_0x1b09('0x123'),_0x1b09('0x124'),_0x1b09('0x125'),_0x1b09('0x126'),_0x1b09('0x127'),_0x1b09('0x128'),_0x1b09('0x129'),_0x1b09('0x12a'),_0x1b09('0x12b'),_0x1b09('0x12c'),'clientSecret',_0x1b09('0x12d'),_0x1b09('0x12e'),_0x1b09('0x12f'),_0x1b09('0x130'),_0x1b09('0x131'),_0x1b09('0x132'),_0x1b09('0x133'),'accessTokenSecret',_0x1b09('0x134'),'consumerKey',_0x1b09('0x135'),_0x1b09('0x136'),_0x1b09('0x137'),_0x1b09('0x138'),_0x1b09('0x139'),_0x1b09('0x13a'),'clientEmail',_0x1b09('0x13b'),_0x1b09('0x13c'),'secretaccesskey',_0x1b09('0x13d'),_0x1b09('0x15'),_0x1b09('0x13e'),_0x1b09('0x13f'),_0x1b09('0x140'),_0x1b09('0x141'),_0x1b09('0x142'),'registry',_0x1b09('0x143')];function maskSensitiveData(_0x144ca4){var _0x332de1=/(?!^)[\s\S](?!$)/g;if(!_[_0x1b09('0x144')](_0x144ca4))return;for(var _0x5e4e7e in _0x144ca4){if(_[_0x1b09('0x145')](_0x144ca4[_0x5e4e7e])){for(var _0x589259=0x0;_0x589259<_0x144ca4[_0x5e4e7e][_0x1b09('0x146')];_0x589259++){maskSensitiveData(_0x144ca4[_0x5e4e7e][_0x589259]);}}else if(_[_0x1b09('0x144')](_0x144ca4[_0x5e4e7e])){maskSensitiveData(_0x144ca4[_0x5e4e7e]);}else if(_[_0x1b09('0x147')](_0x144ca4[_0x5e4e7e])){_0x144ca4[_0x5e4e7e]=_0x144ca4[_0x5e4e7e][_0x1b09('0x148')](/{{{/g,_0x1b09('0x149'))[_0x1b09('0x148')](/}}}/g,_0x1b09('0x14a'))[_0x1b09('0x148')](/{{/g,'@{')[_0x1b09('0x148')](/}}/g,'}@');if(_[_0x1b09('0x14b')](sensitiveFields,_0x5e4e7e)){_0x144ca4[_0x5e4e7e]=_0x144ca4[_0x5e4e7e]['replace'](_0x332de1,'*');}}}} \ No newline at end of file +var _0xb87c=['./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','./api/cmList','./api/voicePrefix','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','./api/userNotification','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','./api/realtime','/api/auth/local','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','/apidoc','static','/www','join','root','/demo','/snippet','3.0.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','appPath','/index.html','password','apiKey','lastName','street','phone','mobile','fax','email','clientSecret','securityToken','code','accessKey','tenantId','token','accessToken','accessTokenSecret','authToken','consumerSecret','membername','calleridname','calleridnum','exten','clientEmail','privateKey','accesskeyid','key','pass','accountSid','localstationid','dsn','registry','isPlainObject','isArray','length','isString','replace','@@{','}@@','path','express','express-winston','util','./errors','./config/environment','./config/logger','api','auth','default','use','logger','isEmpty','body','\x20body=%s','format','method','x-forwarded-for','headers','connection','remoteAddress','url','statusCode','responseTime','user','role','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','name','other','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','./api/smsInteraction','./api/smsMessage','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/interactions','/api/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','./api/cmCustomField','/api/actions','./api/automation','/api/canned_answers','/api/dispositions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','./api/schedule','/api/sounds','./api/sound','./api/tag','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','/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/network','/api/chat/internal/messages','./api/chatInternalMessage','./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/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/squareMessage','/api/teams','./api/team','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xb87c,0x1b4));var _0xcb87=function(_0x526027,_0x2a584b){_0x526027=_0x526027-0x0;var _0x1896bb=_0xb87c[_0x526027];return _0x1896bb;};'use strict';var _=require('lodash');var path=require(_0xcb87('0x0'));var express=require(_0xcb87('0x1'));var ewinston=require(_0xcb87('0x2'));var util=require(_0xcb87('0x3'));var errors=require(_0xcb87('0x4'));var config=require(_0xcb87('0x5'));var logger=require(_0xcb87('0x6'))(_0xcb87('0x7'));var authLogger=require(_0xcb87('0x6'))(_0xcb87('0x8'));exports[_0xcb87('0x9')]=function(_0x59e290){_0x59e290[_0xcb87('0xa')](ewinston[_0xcb87('0xb')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x58f42f,_0x152014){var _0x45e1ae='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0xcb87('0xc')](_0x58f42f[_0xcb87('0xd')])){_0x45e1ae+=_0xcb87('0xe');var _0x7c2c7d=_0x58f42f[_0xcb87('0xd')];maskSensitiveData(_0x7c2c7d);}return util[_0xcb87('0xf')](_0x45e1ae,_0x58f42f[_0xcb87('0x10')],_0x58f42f['headers'][_0xcb87('0x11')]?_0x58f42f[_0xcb87('0x12')][_0xcb87('0x11')]:_0x58f42f[_0xcb87('0x13')][_0xcb87('0x14')]||_0x58f42f['ip'],_0x58f42f[_0xcb87('0x15')],_0x152014[_0xcb87('0x16')],_0x152014[_0xcb87('0x17')],_0x58f42f[_0xcb87('0x18')]?_0x58f42f[_0xcb87('0x18')]['id']:null,_0x58f42f['user']?_0x58f42f[_0xcb87('0x18')]['name']:null,_0x58f42f['user']?_0x58f42f[_0xcb87('0x18')][_0xcb87('0x19')]:null,_0x7c2c7d?util[_0xcb87('0x1a')](_0x7c2c7d,![],null):'');}}));_0x59e290[_0xcb87('0xa')](ewinston[_0xcb87('0xb')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x313bb6,_0x5e15a5){var _0x1d98a2=_0xcb87('0x1b');if(_0x313bb6[_0xcb87('0xd')]&&_0x313bb6['body'][_0xcb87('0x1c')]&&_0x313bb6[_0xcb87('0xd')][_0xcb87('0x1d')]){_0x1d98a2=_0xcb87('0x1e');}return util[_0xcb87('0xf')](_0x1d98a2,_0x313bb6[_0xcb87('0x10')],_0x313bb6[_0xcb87('0x12')][_0xcb87('0x11')]?_0x313bb6[_0xcb87('0x12')][_0xcb87('0x11')]:_0x313bb6['connection'][_0xcb87('0x14')]||_0x313bb6['ip'],_0x313bb6['url'],_0x5e15a5[_0xcb87('0x16')],_0x5e15a5[_0xcb87('0x17')],_0x313bb6[_0xcb87('0x18')]?_0x313bb6[_0xcb87('0x18')]['id']:null,_0x313bb6[_0xcb87('0x18')]?_0x313bb6[_0xcb87('0x18')][_0xcb87('0x1f')]:null,_0x313bb6[_0xcb87('0x18')]?_0x313bb6[_0xcb87('0x18')]['role']:null,_0x313bb6[_0xcb87('0xd')]&&_0x313bb6['body'][_0xcb87('0x1c')]?_0x313bb6[_0xcb87('0xd')][_0xcb87('0x1c')]:_0xcb87('0x20'),_0x313bb6[_0xcb87('0xd')]&&_0x313bb6[_0xcb87('0xd')]['agent_id']?_0x313bb6[_0xcb87('0xd')][_0xcb87('0x1d')]:'',_0x313bb6[_0xcb87('0xd')]&&_0x313bb6['body'][_0xcb87('0x21')]?_0x313bb6[_0xcb87('0xd')][_0xcb87('0x21')]:'');},'ignoreRoute':function(_0x508330){var _0x51dd29=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x51dd29[_0xcb87('0x22')](_0x508330['url']);}}));_0x59e290[_0xcb87('0xa')](_0xcb87('0x23'),require(_0xcb87('0x24')));_0x59e290[_0xcb87('0xa')](_0xcb87('0x25'),require(_0xcb87('0x26')));_0x59e290[_0xcb87('0xa')]('/api/voice/contexts',require(_0xcb87('0x27')));_0x59e290[_0xcb87('0xa')](_0xcb87('0x28'),require(_0xcb87('0x29')));_0x59e290[_0xcb87('0xa')](_0xcb87('0x2a'),require(_0xcb87('0x2b')));_0x59e290['use'](_0xcb87('0x2c'),require(_0xcb87('0x2d')));_0x59e290[_0xcb87('0xa')](_0xcb87('0x2e'),require('./api/voiceRecording'));_0x59e290['use'](_0xcb87('0x2f'),require(_0xcb87('0x30')));_0x59e290[_0xcb87('0xa')](_0xcb87('0x31'),require(_0xcb87('0x32')));_0x59e290['use']('/api/voice/mails/messages',require(_0xcb87('0x33')));_0x59e290[_0xcb87('0xa')](_0xcb87('0x34'),require('./api/voiceCallReport'));_0x59e290['use'](_0xcb87('0x35'),require(_0xcb87('0x36')));_0x59e290['use'](_0xcb87('0x37'),require(_0xcb87('0x38')));_0x59e290[_0xcb87('0xa')](_0xcb87('0x39'),require(_0xcb87('0x3a')));_0x59e290['use'](_0xcb87('0x3b'),require(_0xcb87('0x3c')));_0x59e290[_0xcb87('0xa')](_0xcb87('0x3d'),require(_0xcb87('0x3e')));_0x59e290['use'](_0xcb87('0x3f'),require('./api/voiceTransferReport'));_0x59e290[_0xcb87('0xa')]('/api/mail/out_servers',require(_0xcb87('0x40')));_0x59e290['use'](_0xcb87('0x41'),require(_0xcb87('0x42')));_0x59e290[_0xcb87('0xa')](_0xcb87('0x43'),require(_0xcb87('0x44')));_0x59e290['use'](_0xcb87('0x45'),require(_0xcb87('0x46')));_0x59e290[_0xcb87('0xa')]('/api/mail/interactions',require(_0xcb87('0x47')));_0x59e290[_0xcb87('0xa')]('/api/mail/messages',require(_0xcb87('0x48')));_0x59e290[_0xcb87('0xa')](_0xcb87('0x49'),require(_0xcb87('0x4a')));_0x59e290['use'](_0xcb87('0x4b'),require(_0xcb87('0x4c')));_0x59e290[_0xcb87('0xa')](_0xcb87('0x4d'),require(_0xcb87('0x4e')));_0x59e290[_0xcb87('0xa')](_0xcb87('0x4f'),require(_0xcb87('0x50')));_0x59e290[_0xcb87('0xa')](_0xcb87('0x51'),require(_0xcb87('0x52')));_0x59e290['use'](_0xcb87('0x53'),require(_0xcb87('0x54')));_0x59e290[_0xcb87('0xa')](_0xcb87('0x55'),require(_0xcb87('0x56')));_0x59e290[_0xcb87('0xa')](_0xcb87('0x57'),require(_0xcb87('0x58')));_0x59e290['use']('/api/fax/queues',require(_0xcb87('0x59')));_0x59e290['use'](_0xcb87('0x5a'),require('./api/faxQueueReport'));_0x59e290[_0xcb87('0xa')](_0xcb87('0x5b'),require(_0xcb87('0x5c')));_0x59e290[_0xcb87('0xa')](_0xcb87('0x5d'),require(_0xcb87('0x5e')));_0x59e290[_0xcb87('0xa')]('/api/sms/interactions',require(_0xcb87('0x5f')));_0x59e290[_0xcb87('0xa')]('/api/sms/messages',require(_0xcb87('0x60')));_0x59e290[_0xcb87('0xa')](_0xcb87('0x61'),require(_0xcb87('0x62')));_0x59e290['use']('/api/openchannel/accounts',require(_0xcb87('0x63')));_0x59e290['use']('/api/openchannel/applications',require(_0xcb87('0x64')));_0x59e290[_0xcb87('0xa')](_0xcb87('0x65'),require('./api/openchannelInteraction'));_0x59e290[_0xcb87('0xa')](_0xcb87('0x66'),require('./api/openchannelMessage'));_0x59e290[_0xcb87('0xa')](_0xcb87('0x67'),require(_0xcb87('0x68')));_0x59e290['use']('/api/chat/websites',require('./api/chatWebsite'));_0x59e290['use'](_0xcb87('0x69'),require(_0xcb87('0x6a')));_0x59e290[_0xcb87('0xa')]('/api/chat/applications',require('./api/chatApplication'));_0x59e290[_0xcb87('0xa')](_0xcb87('0x6b'),require('./api/chatInteraction'));_0x59e290[_0xcb87('0xa')](_0xcb87('0x6c'),require('./api/chatMessage'));_0x59e290['use'](_0xcb87('0x6d'),require(_0xcb87('0x6e')));_0x59e290[_0xcb87('0xa')](_0xcb87('0x6f'),require(_0xcb87('0x70')));_0x59e290['use'](_0xcb87('0x71'),require(_0xcb87('0x72')));_0x59e290[_0xcb87('0xa')]('/api/chat/proactive_actions',require(_0xcb87('0x73')));_0x59e290[_0xcb87('0xa')](_0xcb87('0x74'),require(_0xcb87('0x75')));_0x59e290[_0xcb87('0xa')](_0xcb87('0x76'),require(_0xcb87('0x77')));_0x59e290['use']('/api/cm/hopper',require(_0xcb87('0x78')));_0x59e290['use'](_0xcb87('0x79'),require(_0xcb87('0x7a')));_0x59e290[_0xcb87('0xa')]('/api/cm/hopper_final',require(_0xcb87('0x7b')));_0x59e290['use'](_0xcb87('0x7c'),require(_0xcb87('0x7d')));_0x59e290[_0xcb87('0xa')]('/api/cm/custom_fields',require(_0xcb87('0x7e')));_0x59e290[_0xcb87('0xa')](_0xcb87('0x7f'),require('./api/action'));_0x59e290['use']('/api/automations',require(_0xcb87('0x80')));_0x59e290['use'](_0xcb87('0x81'),require('./api/cannedAnswer'));_0x59e290[_0xcb87('0xa')](_0xcb87('0x82'),require('./api/disposition'));_0x59e290[_0xcb87('0xa')]('/api/conditions',require(_0xcb87('0x83')));_0x59e290[_0xcb87('0xa')](_0xcb87('0x84'),require(_0xcb87('0x85')));_0x59e290[_0xcb87('0xa')](_0xcb87('0x86'),require('./api/pause'));_0x59e290[_0xcb87('0xa')]('/api/cdr',require(_0xcb87('0x87')));_0x59e290['use'](_0xcb87('0x88'),require(_0xcb87('0x89')));_0x59e290[_0xcb87('0xa')]('/api/schedules',require(_0xcb87('0x8a')));_0x59e290['use'](_0xcb87('0x8b'),require(_0xcb87('0x8c')));_0x59e290[_0xcb87('0xa')]('/api/tags',require(_0xcb87('0x8d')));_0x59e290[_0xcb87('0xa')]('/api/contact_item_types',require(_0xcb87('0x8e')));_0x59e290['use'](_0xcb87('0x8f'),require(_0xcb87('0x90')));_0x59e290[_0xcb87('0xa')](_0xcb87('0x91'),require(_0xcb87('0x92')));_0x59e290['use'](_0xcb87('0x93'),require(_0xcb87('0x94')));_0x59e290[_0xcb87('0xa')](_0xcb87('0x95'),require(_0xcb87('0x96')));_0x59e290[_0xcb87('0xa')](_0xcb87('0x97'),require(_0xcb87('0x98')));_0x59e290[_0xcb87('0xa')](_0xcb87('0x99'),require(_0xcb87('0x9a')));_0x59e290[_0xcb87('0xa')]('/api/integrations/reports',require(_0xcb87('0x9b')));_0x59e290[_0xcb87('0xa')](_0xcb87('0x9c'),require(_0xcb87('0x9d')));_0x59e290['use']('/api/analytics/default_reports',require(_0xcb87('0x9e')));_0x59e290[_0xcb87('0xa')](_0xcb87('0x9f'),require(_0xcb87('0xa0')));_0x59e290[_0xcb87('0xa')](_0xcb87('0xa1'),require(_0xcb87('0xa2')));_0x59e290[_0xcb87('0xa')](_0xcb87('0xa3'),require('./api/analyticFieldReport'));_0x59e290[_0xcb87('0xa')](_0xcb87('0xa4'),require(_0xcb87('0xa5')));_0x59e290[_0xcb87('0xa')](_0xcb87('0xa6'),require(_0xcb87('0xa7')));_0x59e290['use']('/api/integrations/salesforce/configurations',require(_0xcb87('0xa8')));_0x59e290[_0xcb87('0xa')]('/api/integrations/salesforce/fields',require(_0xcb87('0xa9')));_0x59e290['use'](_0xcb87('0xaa'),require('./api/intSugarcrmAccount'));_0x59e290[_0xcb87('0xa')](_0xcb87('0xab'),require(_0xcb87('0xac')));_0x59e290[_0xcb87('0xa')]('/api/integrations/sugarcrm/fields',require('./api/intSugarcrmField'));_0x59e290[_0xcb87('0xa')](_0xcb87('0xad'),require(_0xcb87('0xae')));_0x59e290[_0xcb87('0xa')](_0xcb87('0xaf'),require(_0xcb87('0xb0')));_0x59e290[_0xcb87('0xa')]('/api/integrations/desk/fields',require(_0xcb87('0xb1')));_0x59e290[_0xcb87('0xa')](_0xcb87('0xb2'),require(_0xcb87('0xb3')));_0x59e290[_0xcb87('0xa')](_0xcb87('0xb4'),require(_0xcb87('0xb5')));_0x59e290[_0xcb87('0xa')]('/api/integrations/zoho/fields',require(_0xcb87('0xb6')));_0x59e290['use'](_0xcb87('0xb7'),require('./api/intZendeskAccount'));_0x59e290[_0xcb87('0xa')](_0xcb87('0xb8'),require('./api/intZendeskConfiguration'));_0x59e290[_0xcb87('0xa')](_0xcb87('0xb9'),require(_0xcb87('0xba')));_0x59e290[_0xcb87('0xa')](_0xcb87('0xbb'),require(_0xcb87('0xbc')));_0x59e290[_0xcb87('0xa')](_0xcb87('0xbd'),require('./api/intFreshdeskConfiguration'));_0x59e290[_0xcb87('0xa')](_0xcb87('0xbe'),require(_0xcb87('0xbf')));_0x59e290[_0xcb87('0xa')](_0xcb87('0xc0'),require('./api/intVtigerAccount'));_0x59e290['use'](_0xcb87('0xc1'),require(_0xcb87('0xc2')));_0x59e290[_0xcb87('0xa')](_0xcb87('0xc3'),require(_0xcb87('0xc4')));_0x59e290[_0xcb87('0xa')](_0xcb87('0xc5'),require('./api/intServicenowAccount'));_0x59e290['use'](_0xcb87('0xc6'),require('./api/intServicenowConfiguration'));_0x59e290[_0xcb87('0xa')](_0xcb87('0xc7'),require(_0xcb87('0xc8')));_0x59e290[_0xcb87('0xa')]('/api/integrations/dynamics365/accounts',require('./api/intDynamics365Account'));_0x59e290['use'](_0xcb87('0xc9'),require(_0xcb87('0xca')));_0x59e290[_0xcb87('0xa')](_0xcb87('0xcb'),require(_0xcb87('0xcc')));_0x59e290[_0xcb87('0xa')](_0xcb87('0xcd'),require(_0xcb87('0xce')));_0x59e290[_0xcb87('0xa')](_0xcb87('0xcf'),require(_0xcb87('0xd0')));_0x59e290[_0xcb87('0xa')](_0xcb87('0xd1'),require('./api/intFreshsalesField'));_0x59e290[_0xcb87('0xa')]('/api/networks',require(_0xcb87('0xd2')));_0x59e290['use']('/api/chat/reports/queue',require('./api/chatQueueReport'));_0x59e290[_0xcb87('0xa')](_0xcb87('0xd3'),require(_0xcb87('0xd4')));_0x59e290[_0xcb87('0xa')]('/api/jscripty/answers/reports',require(_0xcb87('0xd5')));_0x59e290[_0xcb87('0xa')](_0xcb87('0xd6'),require(_0xcb87('0xd7')));_0x59e290[_0xcb87('0xa')](_0xcb87('0xd8'),require(_0xcb87('0xd9')));_0x59e290[_0xcb87('0xa')]('/api/sms/reports/queue',require(_0xcb87('0xda')));_0x59e290[_0xcb87('0xa')](_0xcb87('0xdb'),require(_0xcb87('0xdc')));_0x59e290[_0xcb87('0xa')](_0xcb87('0xdd'),require('./api/squareReportDetail'));_0x59e290['use'](_0xcb87('0xde'),require(_0xcb87('0xdf')));_0x59e290['use'](_0xcb87('0xe0'),require(_0xcb87('0xe1')));_0x59e290[_0xcb87('0xa')](_0xcb87('0xe2'),require(_0xcb87('0xe3')));_0x59e290[_0xcb87('0xa')](_0xcb87('0xe4'),require(_0xcb87('0xe5')));_0x59e290[_0xcb87('0xa')](_0xcb87('0xe6'),require(_0xcb87('0xe7')));_0x59e290[_0xcb87('0xa')]('/api/square/messages',require(_0xcb87('0xe8')));_0x59e290[_0xcb87('0xa')](_0xcb87('0xe9'),require(_0xcb87('0xea')));_0x59e290[_0xcb87('0xa')]('/api/license',require(_0xcb87('0xeb')));_0x59e290[_0xcb87('0xa')](_0xcb87('0xec'),require(_0xcb87('0xed')));_0x59e290[_0xcb87('0xa')](_0xcb87('0xee'),require(_0xcb87('0xef')));_0x59e290[_0xcb87('0xa')](_0xcb87('0xf0'),require(_0xcb87('0xf1')));_0x59e290['use']('/api/plugins',require(_0xcb87('0xf2')));_0x59e290['use'](_0xcb87('0xf3'),require(_0xcb87('0xf4')));_0x59e290['use'](_0xcb87('0xf5'),require(_0xcb87('0xf6')));_0x59e290['use'](_0xcb87('0xf7'),require(_0xcb87('0xf8')));_0x59e290[_0xcb87('0xa')](_0xcb87('0xf9'),require(_0xcb87('0xfa')));_0x59e290[_0xcb87('0xa')]('/api/sms/reports/transfer',require(_0xcb87('0xfb')));_0x59e290[_0xcb87('0xa')]('/api/cm/lists',require(_0xcb87('0xfc')));_0x59e290['use']('/api/voice/prefixes',require(_0xcb87('0xfd')));_0x59e290[_0xcb87('0xa')]('/api/userProfiles',require(_0xcb87('0xfe')));_0x59e290['use'](_0xcb87('0xff'),require(_0xcb87('0x100')));_0x59e290[_0xcb87('0xa')](_0xcb87('0x101'),require(_0xcb87('0x102')));_0x59e290['use']('/api/userNotifications',require(_0xcb87('0x103')));_0x59e290[_0xcb87('0xa')]('/api/whatsapp/accounts',require(_0xcb87('0x104')));_0x59e290[_0xcb87('0xa')](_0xcb87('0x105'),require(_0xcb87('0x106')));_0x59e290[_0xcb87('0xa')](_0xcb87('0x107'),require(_0xcb87('0x108')));_0x59e290['use'](_0xcb87('0x109'),require(_0xcb87('0x10a')));_0x59e290['use']('/api/whatsapp/reports/queue',require(_0xcb87('0x10b')));_0x59e290['use'](_0xcb87('0x10c'),require(_0xcb87('0x10d')));_0x59e290[_0xcb87('0xa')]('/api/whatsapp/queues',require(_0xcb87('0x10e')));_0x59e290[_0xcb87('0xa')](_0xcb87('0x10f'),require(_0xcb87('0x110')));_0x59e290[_0xcb87('0xa')]('/api/realtime',require(_0xcb87('0x111')));_0x59e290[_0xcb87('0xa')](_0xcb87('0x112'),require('./api/authLocal'));_0x59e290[_0xcb87('0xa')](_0xcb87('0x113'),require(_0xcb87('0x114')));_0x59e290[_0xcb87('0xa')](_0xcb87('0x115'),require(_0xcb87('0x116')));_0x59e290[_0xcb87('0xa')](_0xcb87('0x117'),require(_0xcb87('0x118')));_0x59e290[_0xcb87('0xa')](_0xcb87('0x119'),require(_0xcb87('0x11a')));_0x59e290[_0xcb87('0xa')](_0xcb87('0x11b'),require(_0xcb87('0x11c')));_0x59e290[_0xcb87('0xa')](_0xcb87('0x11d'),require(_0xcb87('0x11e')));_0x59e290['use'](_0xcb87('0x11f'),require('./api/webbar'));_0x59e290[_0xcb87('0xa')](_0xcb87('0x120'),express[_0xcb87('0x121')](path['join'](config['root'],_0xcb87('0x120'))));_0x59e290[_0xcb87('0xa')](_0xcb87('0x122'),express[_0xcb87('0x121')](path[_0xcb87('0x123')](config[_0xcb87('0x124')],'/www')));_0x59e290['use'](_0xcb87('0x125'),express[_0xcb87('0x121')](path['join'](config[_0xcb87('0x124')],'/demo')));_0x59e290[_0xcb87('0xa')](_0xcb87('0x126'),express[_0xcb87('0x121')](path[_0xcb87('0x123')](config[_0xcb87('0x124')],'snippet',_0xcb87('0x127'))));_0x59e290[_0xcb87('0xa')](_0xcb87('0x128'),express[_0xcb87('0x121')](path[_0xcb87('0x123')](config[_0xcb87('0x124')],_0xcb87('0x129'))));_0x59e290[_0xcb87('0x12a')](_0xcb87('0x12b'))[_0xcb87('0x12c')](errors[0x194]);_0x59e290[_0xcb87('0x12a')]('/*')[_0xcb87('0x12c')](function(_0x428e6a,_0x5f1ac6){_0x5f1ac6['sendFile'](path[_0xcb87('0x12d')](_0x59e290['get'](_0xcb87('0x12e'))+_0xcb87('0x12f')));});};var sensitiveFields=['username',_0xcb87('0x130'),'newPassword',_0xcb87('0x131'),'firstName',_0xcb87('0x132'),_0xcb87('0x133'),_0xcb87('0x134'),_0xcb87('0x135'),_0xcb87('0x136'),_0xcb87('0x137'),'clientId',_0xcb87('0x138'),_0xcb87('0x139'),_0xcb87('0x13a'),_0xcb87('0x13b'),_0xcb87('0x13c'),_0xcb87('0x13d'),'channelSecret',_0xcb87('0x13e'),_0xcb87('0x13f'),_0xcb87('0x140'),'consumerKey',_0xcb87('0x141'),_0xcb87('0x142'),_0xcb87('0x143'),_0xcb87('0x144'),_0xcb87('0x145'),'vidaooApiKey',_0xcb87('0x146'),_0xcb87('0x147'),_0xcb87('0x148'),'secretaccesskey',_0xcb87('0x149'),_0xcb87('0x18'),_0xcb87('0x14a'),_0xcb87('0x14b'),_0xcb87('0x14c'),_0xcb87('0x14d'),'secret',_0xcb87('0x14e'),'oldPassword'];function maskSensitiveData(_0x36f8ae){var _0x29ba82=/(?!^)[\s\S](?!$)/g;if(!_[_0xcb87('0x14f')](_0x36f8ae))return;for(var _0x533e0c in _0x36f8ae){if(_[_0xcb87('0x150')](_0x36f8ae[_0x533e0c])){for(var _0x314ad5=0x0;_0x314ad5<_0x36f8ae[_0x533e0c][_0xcb87('0x151')];_0x314ad5++){maskSensitiveData(_0x36f8ae[_0x533e0c][_0x314ad5]);}}else if(_['isPlainObject'](_0x36f8ae[_0x533e0c])){maskSensitiveData(_0x36f8ae[_0x533e0c]);}else if(_[_0xcb87('0x152')](_0x36f8ae[_0x533e0c])){_0x36f8ae[_0x533e0c]=_0x36f8ae[_0x533e0c][_0xcb87('0x153')](/{{{/g,_0xcb87('0x154'))[_0xcb87('0x153')](/}}}/g,_0xcb87('0x155'))[_0xcb87('0x153')](/{{/g,'@{')[_0xcb87('0x153')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x533e0c)){_0x36f8ae[_0x533e0c]=_0x36f8ae[_0x533e0c][_0xcb87('0x153')](_0x29ba82,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 7366e08..2fea451 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x666c=['log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','RPC\x20listening\x20on\x20','bluebird','lodash','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error'];(function(_0x1b70e3,_0x3a15b1){var _0x1452ab=function(_0x692883){while(--_0x692883){_0x1b70e3['push'](_0x1b70e3['shift']());}};_0x1452ab(++_0x3a15b1);}(_0x666c,0x1ed));var _0xc666=function(_0x55c3d9,_0x3bf75c){_0x55c3d9=_0x55c3d9-0x0;var _0x19fd97=_0x666c[_0x55c3d9];return _0x19fd97;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xc666('0x0'));var _=require(_0xc666('0x1'));var config=require('../config/environment');exports[_0xc666('0x2')]=function(){return new BPromise(function(_0x4b05eb,_0x1d0645){var _0x5b77f3={};_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require(_0xc666('0x4')));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require(_0xc666('0x5')));_0x5b77f3=_['merge'](_0x5b77f3,require(_0xc666('0x6')));_0x5b77f3=_['merge'](_0x5b77f3,require(_0xc666('0x7')));_0x5b77f3=_['merge'](_0x5b77f3,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x5b77f3=_['merge'](_0x5b77f3,require(_0xc666('0x8')));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x5b77f3=_['merge'](_0x5b77f3,require(_0xc666('0x9')));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require('../api/memberReport/memberReport.rpc'));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require(_0xc666('0xa')));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require(_0xc666('0xb')));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require(_0xc666('0xc')));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require('../api/mailAccount/mailAccount.rpc'));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require(_0xc666('0xd')));_0x5b77f3=_['merge'](_0x5b77f3,require(_0xc666('0xe')));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require(_0xc666('0xf')));_0x5b77f3=_['merge'](_0x5b77f3,require(_0xc666('0x10')));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require(_0xc666('0x11')));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require(_0xc666('0x12')));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require(_0xc666('0x13')));_0x5b77f3=_['merge'](_0x5b77f3,require(_0xc666('0x14')));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require(_0xc666('0x15')));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require(_0xc666('0x16')));_0x5b77f3=_['merge'](_0x5b77f3,require(_0xc666('0x17')));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require('../api/smsAccount/smsAccount.rpc'));_0x5b77f3=_['merge'](_0x5b77f3,require('../api/smsInteraction/smsInteraction.rpc'));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require(_0xc666('0x18')));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require(_0xc666('0x19')));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require(_0xc666('0x1a')));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require(_0xc666('0x1b')));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require(_0xc666('0x1c')));_0x5b77f3=_['merge'](_0x5b77f3,require(_0xc666('0x1d')));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require(_0xc666('0x1e')));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require(_0xc666('0x1f')));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require('../api/cmContact/cmContact.rpc'));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require(_0xc666('0x20')));_0x5b77f3=_['merge'](_0x5b77f3,require(_0xc666('0x21')));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require(_0xc666('0x22')));_0x5b77f3=_['merge'](_0x5b77f3,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require(_0xc666('0x23')));_0x5b77f3=_['merge'](_0x5b77f3,require(_0xc666('0x24')));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require(_0xc666('0x25')));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require(_0xc666('0x26')));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require(_0xc666('0x27')));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require(_0xc666('0x28')));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require(_0xc666('0x29')));_0x5b77f3=_['merge'](_0x5b77f3,require('../api/variable/variable.rpc'));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require(_0xc666('0x2a')));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require(_0xc666('0x2b')));_0x5b77f3=_['merge'](_0x5b77f3,require(_0xc666('0x2c')));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require(_0xc666('0x2d')));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require(_0xc666('0x2e')));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require(_0xc666('0x2f')));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require(_0xc666('0x30')));_0x5b77f3=_['merge'](_0x5b77f3,require(_0xc666('0x31')));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require(_0xc666('0x32')));_0x5b77f3=_['merge'](_0x5b77f3,require(_0xc666('0x33')));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require(_0xc666('0x34')));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require(_0xc666('0x35')));_0x5b77f3=_['merge'](_0x5b77f3,require('../api/setting/setting.rpc'));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require(_0xc666('0x36')));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require(_0xc666('0x37')));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require(_0xc666('0x38')));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require(_0xc666('0x39')));_0x5b77f3=_['merge'](_0x5b77f3,require(_0xc666('0x3a')));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require('../api/attachment/attachment.rpc'));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require('../api/plugin/plugin.rpc'));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require(_0xc666('0x3b')));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x5b77f3=_['merge'](_0x5b77f3,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x5b77f3=_[_0xc666('0x3')](_0x5b77f3,require(_0xc666('0x3c')));var _0x1cf992=jayson[_0xc666('0x3d')](_0x5b77f3)[_0xc666('0x3e')]();var _0x48d592=config[_0xc666('0x3f')][_0xc666('0x40')]||config[_0xc666('0x40')]+0x1;var _0x51e5b1=config[_0xc666('0x3f')]['ip']||_0xc666('0x41');_0x1cf992['on'](_0xc666('0x42'),function(_0x40cb36){return _0x1d0645(_0x40cb36);});_0x1cf992[_0xc666('0x2')](_0x48d592,_0x51e5b1,function(){console[_0xc666('0x43')](_0xc666('0x44'),_0x51e5b1,_0x48d592);require('../config/triggers')['default']();return _0x4b05eb(_0xc666('0x45')+_0x51e5b1+':'+_0x48d592);});});}; \ No newline at end of file +var _0xbcf5=['default','jayson/promise','bluebird','lodash','listen','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.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/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','port','rpc','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers'];(function(_0x5466d3,_0x3e47ae){var _0x147302=function(_0x5087aa){while(--_0x5087aa){_0x5466d3['push'](_0x5466d3['shift']());}};_0x147302(++_0x3e47ae);}(_0xbcf5,0x182));var _0x5bcf=function(_0x4b97c6,_0xc984fd){_0x4b97c6=_0x4b97c6-0x0;var _0x4126d8=_0xbcf5[_0x4b97c6];return _0x4126d8;};'use strict';var jayson=require(_0x5bcf('0x0'));var BPromise=require(_0x5bcf('0x1'));var _=require(_0x5bcf('0x2'));var config=require('../config/environment');exports[_0x5bcf('0x3')]=function(){return new BPromise(function(_0xb3fb84,_0x33f617){var _0x28e942={};_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require(_0x5bcf('0x5')));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require('../api/voiceExtension/voiceExtension.rpc'));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require(_0x5bcf('0x6')));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require('../api/voiceRecording/voiceRecording.rpc'));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require(_0x5bcf('0x7')));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require(_0x5bcf('0x8')));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require(_0x5bcf('0x9')));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require(_0x5bcf('0xa')));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require(_0x5bcf('0xb')));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require(_0x5bcf('0xc')));_0x28e942=_['merge'](_0x28e942,require(_0x5bcf('0xd')));_0x28e942=_['merge'](_0x28e942,require(_0x5bcf('0xe')));_0x28e942=_['merge'](_0x28e942,require(_0x5bcf('0xf')));_0x28e942=_['merge'](_0x28e942,require(_0x5bcf('0x10')));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require('../api/mailMessage/mailMessage.rpc'));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require(_0x5bcf('0x11')));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require(_0x5bcf('0x12')));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require(_0x5bcf('0x13')));_0x28e942=_['merge'](_0x28e942,require('../api/faxApplication/faxApplication.rpc'));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require(_0x5bcf('0x14')));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require(_0x5bcf('0x15')));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require(_0x5bcf('0x16')));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require(_0x5bcf('0x17')));_0x28e942=_['merge'](_0x28e942,require(_0x5bcf('0x18')));_0x28e942=_['merge'](_0x28e942,require(_0x5bcf('0x19')));_0x28e942=_['merge'](_0x28e942,require('../api/smsMessage/smsMessage.rpc'));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require(_0x5bcf('0x1a')));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require(_0x5bcf('0x1b')));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x28e942=_['merge'](_0x28e942,require(_0x5bcf('0x1c')));_0x28e942=_['merge'](_0x28e942,require(_0x5bcf('0x1d')));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require(_0x5bcf('0x1e')));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require(_0x5bcf('0x1f')));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require(_0x5bcf('0x20')));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require('../api/chatQueue/chatQueue.rpc'));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require(_0x5bcf('0x21')));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require(_0x5bcf('0x22')));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require(_0x5bcf('0x23')));_0x28e942=_['merge'](_0x28e942,require(_0x5bcf('0x24')));_0x28e942=_['merge'](_0x28e942,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require(_0x5bcf('0x25')));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require('../api/interval/interval.rpc'));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require(_0x5bcf('0x26')));_0x28e942=_['merge'](_0x28e942,require(_0x5bcf('0x27')));_0x28e942=_['merge'](_0x28e942,require(_0x5bcf('0x28')));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require(_0x5bcf('0x29')));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require(_0x5bcf('0x2a')));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require(_0x5bcf('0x2b')));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require(_0x5bcf('0x2c')));_0x28e942=_['merge'](_0x28e942,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require(_0x5bcf('0x2d')));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require(_0x5bcf('0x2e')));_0x28e942=_['merge'](_0x28e942,require(_0x5bcf('0x2f')));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require(_0x5bcf('0x30')));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require(_0x5bcf('0x31')));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require(_0x5bcf('0x32')));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require(_0x5bcf('0x33')));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require(_0x5bcf('0x34')));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require(_0x5bcf('0x35')));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require(_0x5bcf('0x36')));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require('../api/setting/setting.rpc'));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require(_0x5bcf('0x37')));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require(_0x5bcf('0x38')));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require(_0x5bcf('0x39')));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require(_0x5bcf('0x3a')));_0x28e942=_['merge'](_0x28e942,require(_0x5bcf('0x3b')));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require(_0x5bcf('0x3c')));_0x28e942=_['merge'](_0x28e942,require(_0x5bcf('0x3d')));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require(_0x5bcf('0x3e')));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require(_0x5bcf('0x3f')));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require(_0x5bcf('0x40')));_0x28e942=_['merge'](_0x28e942,require(_0x5bcf('0x41')));_0x28e942=_[_0x5bcf('0x4')](_0x28e942,require(_0x5bcf('0x42')));var _0x1397bb=jayson[_0x5bcf('0x43')](_0x28e942)[_0x5bcf('0x44')]();var _0x1e01b3=config['rpc'][_0x5bcf('0x45')]||config['port']+0x1;var _0x2b9bcf=config[_0x5bcf('0x46')]['ip']||_0x5bcf('0x47');_0x1397bb['on'](_0x5bcf('0x48'),function(_0x48f7f8){return _0x33f617(_0x48f7f8);});_0x1397bb[_0x5bcf('0x3')](_0x1e01b3,_0x2b9bcf,function(){console[_0x5bcf('0x49')](_0x5bcf('0x4a'),_0x2b9bcf,_0x1e01b3);require(_0x5bcf('0x4b'))[_0x5bcf('0x4c')]();return _0xb3fb84('RPC\x20listening\x20on\x20'+_0x2b9bcf+':'+_0x1e01b3);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index f9aa6ee..e8a8876 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 _0x3ff6=['ANSWER','getData','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','SET\x20CONTEXT\x20%s','setExtension','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setContext','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','WAIT','exports','util','lodash','events','EventEmitter','./reply','./error','call','setEncoding','setTimeout','utf8','emit','ready','line','toLowerCase','hangup','520-Invalid','search','520\x20End\x20of\x20proper','function','substring','no\x20code','replace','result=','indexOf','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','prototype','sendRequest','sync','answer'];(function(_0x28488f,_0x4fffb1){var _0x11bab7=function(_0x220b92){while(--_0x220b92){_0x28488f['push'](_0x28488f['shift']());}};_0x11bab7(++_0x4fffb1);}(_0x3ff6,0x1a3));var _0x63ff=function(_0x585f0c,_0x2853fc){_0x585f0c=_0x585f0c-0x0;var _0x5c580a=_0x3ff6[_0x585f0c];return _0x5c580a;};'use strict';var util=require(_0x63ff('0x0'));var _=require(_0x63ff('0x1'));var EventEmitter=require(_0x63ff('0x2'))[_0x63ff('0x3')];var AGIReply=require(_0x63ff('0x4'));var AGIError=require(_0x63ff('0x5'));function AGIChannel(_0x2b7fd7){var _0x587f75=this,_0x2a1350=new AGIReply(),_0x4310ae=![],_0xef8702={};EventEmitter[_0x63ff('0x6')](_0x587f75);_0x2b7fd7[_0x63ff('0x7')]('utf8');_0x2b7fd7[_0x63ff('0x8')](0x8*0x3c*0x3c*0x3e8);_0x2a1350[_0x63ff('0x7')](_0x63ff('0x9'));_0x2a1350['on']('headers',function(_0x181f99){for(var _0xd6107e in _0x181f99){_0x587f75[_0xd6107e]=_0x181f99[_0xd6107e];}_0x587f75[_0x63ff('0xa')](_0x63ff('0xb'));});_0x2a1350['on'](_0x63ff('0xc'),function(_0xb631c7){if(_0xb631c7[_0x63ff('0xd')]()==_0x63ff('0xe')){_0x587f75[_0x63ff('0xa')](_0x63ff('0xe'));return;}if(_0xb631c7['substring'](0x0,0xb)==_0x63ff('0xf')){_0x4310ae=!![];}if(_0x4310ae){_0xef8702['rx']+=_0xb631c7+'\x0a';if(_0xb631c7[_0x63ff('0x10')](_0x63ff('0x11'))!=-0x1){_0x4310ae=![];}}else{_0xef8702['rx']=_0xb631c7;}if(_0x4310ae){return;}if(typeof _0xef8702['cb']==_0x63ff('0x12')){var _0x1afce4=_0xef8702['rx'][_0x63ff('0x13')](0x0,0x3),_0x19c605=null,_0x3b12f1=null;_0x1afce4=parseInt(_0x1afce4);if(isNaN(_0x1afce4)){_0xef8702['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x63ff('0x14')});return;}if(_0x1afce4!=0xc8){_0xef8702['cb'](null,{'code':_0x1afce4,'result':-0x1,'extra':'KO'});return;}_0x19c605=_0xef8702['rx'][_0x63ff('0x13')](0x4)[_0x63ff('0x15')](_0x63ff('0x16'),'');if(_0x19c605[_0x63ff('0x17')]('\x20')!=-0x1){_0x19c605=_0x19c605['substr'](0x0,_0x19c605[_0x63ff('0x17')]('\x20'));}if(_[_0x63ff('0x18')](_0x19c605,'-1')){_0x19c605=parseInt(_0x19c605);}_0x3b12f1=_0xef8702['rx'][_0x63ff('0x19')]('\x20');if(_0x3b12f1[_0x63ff('0x1a')]==0x3){_0x3b12f1=_0x3b12f1[0x2][_0x63ff('0x13')](0x1,_0x3b12f1[0x2][_0x63ff('0x1a')]-0x1);}else if(_0x3b12f1[_0x63ff('0x1a')]>0x3){var _0x5a4d23=/\((.+)\)/;var _0x52c346=_0xef8702['rx'][_0x63ff('0x1b')](_0x5a4d23);if(_0x52c346){_0x3b12f1=_0x52c346[0x1];}else{_0x3b12f1=null;}}else{_0x3b12f1=null;}_0xef8702['cb'](null,{'code':_0x1afce4,'result':_0x19c605,'extra':_0x3b12f1});}});_0x2b7fd7['on'](_0x63ff('0x1c'),function(_0x14db2e){_0x587f75['emit'](_0x63ff('0x1c'),new AGIError(_0x63ff('0x1d'),_0x14db2e[_0x63ff('0x1e')]));});_0x2b7fd7['on'](_0x63ff('0x1f'),function(){_0x587f75[_0x63ff('0xa')](_0x63ff('0x1f'),new AGIError(_0x63ff('0x20')));});_0x2b7fd7['on'](_0x63ff('0x21'),function(){_0x587f75['emit'](_0x63ff('0x21'),new AGIError(_0x63ff('0x22')));_0x2b7fd7[_0x63ff('0x23')]();});_0x2b7fd7[_0x63ff('0x24')](_0x2a1350);this[_0x63ff('0x25')]=function(_0x164a60,_0x2f67c2){var _0x164a60=_0x164a60||'',_0x2f67c2=typeof _0x2f67c2=='function'?_0x2f67c2:new Function();_0xef8702={'tx':_0x164a60,'rx':'','cb':_0x2f67c2};_0x2b7fd7[_0x63ff('0x26')](_0x164a60+'\x0a');},this[_0x63ff('0x1f')]=function(){_0x2b7fd7[_0x63ff('0x23')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x63ff('0x27')][_0x63ff('0x28')]=function(_0xadaf12){return this[_0x63ff('0x25')][_0x63ff('0x29')](this,_0xadaf12);};AGIChannel[_0x63ff('0x27')][_0x63ff('0x2a')]=function(){return this[_0x63ff('0x28')](_0x63ff('0x2b'));};AGIChannel[_0x63ff('0x27')][_0x63ff('0x2c')]=function(_0x27ac32,_0x55653f,_0x333ddf){_0x27ac32=_0x27ac32===undefined?_0x63ff('0x2d'):_0x27ac32;_0x55653f=_0x55653f===undefined?'5':_0x55653f;_0x333ddf=_0x333ddf===undefined?'1':_0x333ddf;return this[_0x63ff('0x28')](util[_0x63ff('0x2e')](_0x63ff('0x2f'),_0x27ac32,_0x55653f*0x3e8,_0x333ddf));};AGIChannel[_0x63ff('0x27')][_0x63ff('0x30')]=function(_0x43343f){_0x43343f=_0x43343f||_0x63ff('0x31');return this[_0x63ff('0x28')](util[_0x63ff('0x2e')](_0x63ff('0x32'),_0x43343f));};AGIChannel[_0x63ff('0x27')][_0x63ff('0x33')]=function(_0xe2a2cb,_0x55ce77){if(_[_0x63ff('0x34')](_0x55ce77)){return this[_0x63ff('0x28')](util[_0x63ff('0x2e')](_0x63ff('0x35'),_0xe2a2cb,_0x55ce77[_0x63ff('0x36')](',')));}return this[_0x63ff('0x28')](util['format'](_0x63ff('0x35'),_0xe2a2cb,_0x55ce77));};AGIChannel[_0x63ff('0x27')]['setContext']=function(_0x209a93){return this['sendRequest'](util[_0x63ff('0x2e')](_0x63ff('0x37'),_0x209a93));};AGIChannel['prototype'][_0x63ff('0x38')]=function(_0xf7c0dd){return this[_0x63ff('0x28')](util[_0x63ff('0x2e')]('SET\x20EXTENSION\x20%s',_0xf7c0dd));};AGIChannel['prototype'][_0x63ff('0x39')]=function(_0xde76a2){return this[_0x63ff('0x28')](util[_0x63ff('0x2e')](_0x63ff('0x3a'),_0xde76a2));};AGIChannel['prototype'][_0x63ff('0xe')]=function(){return this[_0x63ff('0x28')](_0x63ff('0x3b'));};AGIChannel[_0x63ff('0x27')][_0x63ff('0x3c')]=function(_0x41d6da,_0x23f94d){var _0x2e8cfd=_[_0x63ff('0x3d')](_0x23f94d)||_['isNumber'](_0x23f94d)?_0x23f94d[_0x63ff('0x3e')]():_0x23f94d;return this['sendRequest'](util[_0x63ff('0x2e')](_0x63ff('0x3f'),_0x41d6da,_0x2e8cfd?_0x2e8cfd[_0x63ff('0x3e')]()[_0x63ff('0x15')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x63ff('0x27')]['sayNumber']=function(_0x408269,_0x3be123){return this[_0x63ff('0x28')](util[_0x63ff('0x2e')]('SAY\x20NUMBER\x20%s\x20%s',_0x408269,_0x3be123));};AGIChannel['prototype']['sayDigits']=function(_0x15385b,_0x5a7c7a){return this[_0x63ff('0x28')](util['format']('SAY\x20DIGITS\x20%s\x20%s',_0x15385b,_0x5a7c7a));};AGIChannel[_0x63ff('0x27')]['sayPhonetic']=function(_0x1d111f,_0x3bd746){return this['sendRequest'](util['format'](_0x63ff('0x40'),_0x1d111f,_0x3bd746));};AGIChannel[_0x63ff('0x27')][_0x63ff('0x41')]=function(_0x5eb12c,_0x16c516,_0xfe6adf){_0x16c516=_0x16c516||this['extension'];_0xfe6adf=_0xfe6adf||0x1;this[_0x63ff('0x42')](_0x5eb12c);this['setExtension'](_0x16c516);this[_0x63ff('0x39')](_0xfe6adf);return this['noop'](util[_0x63ff('0x2e')](_0x63ff('0x43'),_0x5eb12c,_0x16c516,_0xfe6adf));};AGIChannel['prototype'][_0x63ff('0x44')]=function(_0x5a00fb){return this[_0x63ff('0x28')](util[_0x63ff('0x2e')](_0x63ff('0x45'),_0x5a00fb));};AGIChannel[_0x63ff('0x27')][_0x63ff('0x46')]=function(_0x5dcf62,_0x8a197c,_0x132f64,_0x479f15,_0x50ac97,_0x14b2b0){_0x8a197c=_0x8a197c||'wav';_0x132f64=_0x132f64||'';_0x479f15=_0x479f15===undefined?-0x1:_0x479f15==='-1'?-0x1:_0x479f15*0x3e8;_0x50ac97=_0x50ac97===undefined?'':'s='+_0x50ac97;_0x14b2b0=_0x14b2b0?_0x63ff('0x47'):'';return this['sendRequest'](util[_0x63ff('0x2e')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x5dcf62,_0x8a197c,_0x132f64,_0x479f15,_0x14b2b0,_0x50ac97));};AGIChannel[_0x63ff('0x27')]['streamFile']=function(_0xc918ce,_0x51e3e8){_0x51e3e8=_0x51e3e8||'';return this[_0x63ff('0x28')](util['format'](_0x63ff('0x48'),_0xc918ce,_0x51e3e8));};AGIChannel[_0x63ff('0x27')][_0x63ff('0x49')]=function(_0x58ff4a){return this[_0x63ff('0x33')](_0x63ff('0x4a'),_0x58ff4a);};AGIChannel['prototype']['wait']=function(_0x562fda){return this['exec'](_0x63ff('0x4b'),_0x562fda);};AGIChannel[_0x63ff('0x27')][_0x63ff('0x1c')]=function(_0x4fdefb,_0x34af1b){this['noop'](util[_0x63ff('0x2e')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x4fdefb['id'],_0x4fdefb['label'],_0x34af1b));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x63ff('0x4c')]=AGIChannel; \ No newline at end of file +var _0x3ca6=['wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','lodash','events','EventEmitter','./reply','./error','call','utf8','setTimeout','setEncoding','emit','line','toLowerCase','hangup','substring','search','function','result=','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','timeout','destroy','pipe','command','write','inherits','sync','prototype','answer','sendRequest','ANSWER','getData','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','format','VERBOSE\x20\x22%s\x22','exec','isArray','join','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','continueAt','extension','setPriority','noop','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI'];(function(_0xe3446,_0x31bd5e){var _0x17aa42=function(_0x493e99){while(--_0x493e99){_0xe3446['push'](_0xe3446['shift']());}};_0x17aa42(++_0x31bd5e);}(_0x3ca6,0xe1));var _0x63ca=function(_0x495511,_0x2f8bf0){_0x495511=_0x495511-0x0;var _0x4411ee=_0x3ca6[_0x495511];return _0x4411ee;};'use strict';var util=require('util');var _=require(_0x63ca('0x0'));var EventEmitter=require(_0x63ca('0x1'))[_0x63ca('0x2')];var AGIReply=require(_0x63ca('0x3'));var AGIError=require(_0x63ca('0x4'));function AGIChannel(_0xe8505f){var _0x17fe1d=this,_0x23a351=new AGIReply(),_0x1cd6a1=![],_0x5385fd={};EventEmitter[_0x63ca('0x5')](_0x17fe1d);_0xe8505f['setEncoding'](_0x63ca('0x6'));_0xe8505f[_0x63ca('0x7')](0x8*0x3c*0x3c*0x3e8);_0x23a351[_0x63ca('0x8')](_0x63ca('0x6'));_0x23a351['on']('headers',function(_0x38e6c9){for(var _0xf500fd in _0x38e6c9){_0x17fe1d[_0xf500fd]=_0x38e6c9[_0xf500fd];}_0x17fe1d[_0x63ca('0x9')]('ready');});_0x23a351['on'](_0x63ca('0xa'),function(_0x2c6a33){if(_0x2c6a33[_0x63ca('0xb')]()==_0x63ca('0xc')){_0x17fe1d[_0x63ca('0x9')](_0x63ca('0xc'));return;}if(_0x2c6a33[_0x63ca('0xd')](0x0,0xb)=='520-Invalid'){_0x1cd6a1=!![];}if(_0x1cd6a1){_0x5385fd['rx']+=_0x2c6a33+'\x0a';if(_0x2c6a33[_0x63ca('0xe')]('520\x20End\x20of\x20proper')!=-0x1){_0x1cd6a1=![];}}else{_0x5385fd['rx']=_0x2c6a33;}if(_0x1cd6a1){return;}if(typeof _0x5385fd['cb']==_0x63ca('0xf')){var _0x4058d1=_0x5385fd['rx'][_0x63ca('0xd')](0x0,0x3),_0x14e4a3=null,_0xe31689=null;_0x4058d1=parseInt(_0x4058d1);if(isNaN(_0x4058d1)){_0x5385fd['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x4058d1!=0xc8){_0x5385fd['cb'](null,{'code':_0x4058d1,'result':-0x1,'extra':'KO'});return;}_0x14e4a3=_0x5385fd['rx']['substring'](0x4)['replace'](_0x63ca('0x10'),'');if(_0x14e4a3[_0x63ca('0x11')]('\x20')!=-0x1){_0x14e4a3=_0x14e4a3[_0x63ca('0x12')](0x0,_0x14e4a3[_0x63ca('0x11')]('\x20'));}if(_[_0x63ca('0x13')](_0x14e4a3,'-1')){_0x14e4a3=parseInt(_0x14e4a3);}_0xe31689=_0x5385fd['rx'][_0x63ca('0x14')]('\x20');if(_0xe31689[_0x63ca('0x15')]==0x3){_0xe31689=_0xe31689[0x2][_0x63ca('0xd')](0x1,_0xe31689[0x2][_0x63ca('0x15')]-0x1);}else if(_0xe31689[_0x63ca('0x15')]>0x3){var _0x4e6325=/\((.+)\)/;var _0x3e8b84=_0x5385fd['rx'][_0x63ca('0x16')](_0x4e6325);if(_0x3e8b84){_0xe31689=_0x3e8b84[0x1];}else{_0xe31689=null;}}else{_0xe31689=null;}_0x5385fd['cb'](null,{'code':_0x4058d1,'result':_0x14e4a3,'extra':_0xe31689});}});_0xe8505f['on'](_0x63ca('0x17'),function(_0x2d5abb){_0x17fe1d[_0x63ca('0x9')](_0x63ca('0x17'),new AGIError(_0x63ca('0x18'),_0x2d5abb[_0x63ca('0x19')]));});_0xe8505f['on']('close',function(){_0x17fe1d['emit'](_0x63ca('0x1a'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0xe8505f['on'](_0x63ca('0x1b'),function(){_0x17fe1d[_0x63ca('0x9')](_0x63ca('0x1b'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0xe8505f[_0x63ca('0x1c')]();});_0xe8505f[_0x63ca('0x1d')](_0x23a351);this[_0x63ca('0x1e')]=function(_0x4098b5,_0xa1c63d){var _0x4098b5=_0x4098b5||'',_0xa1c63d=typeof _0xa1c63d==_0x63ca('0xf')?_0xa1c63d:new Function();_0x5385fd={'tx':_0x4098b5,'rx':'','cb':_0xa1c63d};_0xe8505f[_0x63ca('0x1f')](_0x4098b5+'\x0a');},this[_0x63ca('0x1a')]=function(){_0xe8505f['destroy']();};}util[_0x63ca('0x20')](AGIChannel,EventEmitter);AGIChannel['prototype']['sendRequest']=function(_0x54b508){return this[_0x63ca('0x1e')][_0x63ca('0x21')](this,_0x54b508);};AGIChannel[_0x63ca('0x22')][_0x63ca('0x23')]=function(){return this[_0x63ca('0x24')](_0x63ca('0x25'));};AGIChannel[_0x63ca('0x22')][_0x63ca('0x26')]=function(_0x54ced4,_0x1b20c4,_0x12dbd2){_0x54ced4=_0x54ced4===undefined?_0x63ca('0x27'):_0x54ced4;_0x1b20c4=_0x1b20c4===undefined?'5':_0x1b20c4;_0x12dbd2=_0x12dbd2===undefined?'1':_0x12dbd2;return this[_0x63ca('0x24')](util['format'](_0x63ca('0x28'),_0x54ced4,_0x1b20c4*0x3e8,_0x12dbd2));};AGIChannel['prototype']['noop']=function(_0x6dbf9d){_0x6dbf9d=_0x6dbf9d||_0x63ca('0x29');return this[_0x63ca('0x24')](util[_0x63ca('0x2a')](_0x63ca('0x2b'),_0x6dbf9d));};AGIChannel[_0x63ca('0x22')][_0x63ca('0x2c')]=function(_0x74490e,_0x36a03e){if(_[_0x63ca('0x2d')](_0x36a03e)){return this[_0x63ca('0x24')](util[_0x63ca('0x2a')]('EXEC\x20%s\x20%s',_0x74490e,_0x36a03e[_0x63ca('0x2e')](',')));}return this[_0x63ca('0x24')](util['format'](_0x63ca('0x2f'),_0x74490e,_0x36a03e));};AGIChannel[_0x63ca('0x22')][_0x63ca('0x30')]=function(_0x1428c2){return this['sendRequest'](util[_0x63ca('0x2a')](_0x63ca('0x31'),_0x1428c2));};AGIChannel['prototype'][_0x63ca('0x32')]=function(_0x3d67b3){return this[_0x63ca('0x24')](util[_0x63ca('0x2a')]('SET\x20EXTENSION\x20%s',_0x3d67b3));};AGIChannel[_0x63ca('0x22')]['setPriority']=function(_0x50ba44){return this[_0x63ca('0x24')](util[_0x63ca('0x2a')](_0x63ca('0x33'),_0x50ba44));};AGIChannel['prototype']['hangup']=function(){return this[_0x63ca('0x24')](_0x63ca('0x34'));};AGIChannel['prototype'][_0x63ca('0x35')]=function(_0x120b62,_0xd4cfe0){var _0x3a102a=_[_0x63ca('0x36')](_0xd4cfe0)||_[_0x63ca('0x37')](_0xd4cfe0)?_0xd4cfe0[_0x63ca('0x38')]():_0xd4cfe0;return this['sendRequest'](util[_0x63ca('0x2a')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x120b62,_0x3a102a?_0x3a102a[_0x63ca('0x38')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x63ca('0x22')]['sayNumber']=function(_0x4ca940,_0x509216){return this[_0x63ca('0x24')](util[_0x63ca('0x2a')](_0x63ca('0x39'),_0x4ca940,_0x509216));};AGIChannel[_0x63ca('0x22')][_0x63ca('0x3a')]=function(_0x422afb,_0x145d96){return this[_0x63ca('0x24')](util[_0x63ca('0x2a')]('SAY\x20DIGITS\x20%s\x20%s',_0x422afb,_0x145d96));};AGIChannel[_0x63ca('0x22')][_0x63ca('0x3b')]=function(_0x510f35,_0x112398){return this[_0x63ca('0x24')](util[_0x63ca('0x2a')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x510f35,_0x112398));};AGIChannel['prototype'][_0x63ca('0x3c')]=function(_0x4fd45a,_0x59f9ad,_0x3805fa){_0x59f9ad=_0x59f9ad||this[_0x63ca('0x3d')];_0x3805fa=_0x3805fa||0x1;this[_0x63ca('0x30')](_0x4fd45a);this[_0x63ca('0x32')](_0x59f9ad);this[_0x63ca('0x3e')](_0x3805fa);return this[_0x63ca('0x3f')](util[_0x63ca('0x2a')](_0x63ca('0x40'),_0x4fd45a,_0x59f9ad,_0x3805fa));};AGIChannel[_0x63ca('0x22')]['getVariable']=function(_0x172daf){return this[_0x63ca('0x24')](util['format'](_0x63ca('0x41'),_0x172daf));};AGIChannel[_0x63ca('0x22')][_0x63ca('0x42')]=function(_0x483d7c,_0x415b86,_0x2013f4,_0xe261b9,_0x41c71c,_0x17fc7e){_0x415b86=_0x415b86||_0x63ca('0x43');_0x2013f4=_0x2013f4||'';_0xe261b9=_0xe261b9===undefined?-0x1:_0xe261b9==='-1'?-0x1:_0xe261b9*0x3e8;_0x41c71c=_0x41c71c===undefined?'':'s='+_0x41c71c;_0x17fc7e=_0x17fc7e?'BEEP':'';return this[_0x63ca('0x24')](util['format']('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x483d7c,_0x415b86,_0x2013f4,_0xe261b9,_0x17fc7e,_0x41c71c));};AGIChannel[_0x63ca('0x22')][_0x63ca('0x44')]=function(_0x15d5ea,_0x5e8126){_0x5e8126=_0x5e8126||'';return this[_0x63ca('0x24')](util[_0x63ca('0x2a')](_0x63ca('0x45'),_0x15d5ea,_0x5e8126));};AGIChannel[_0x63ca('0x22')]['agi']=function(_0x45d1a){return this['exec'](_0x63ca('0x46'),_0x45d1a);};AGIChannel[_0x63ca('0x22')][_0x63ca('0x47')]=function(_0x4683de){return this[_0x63ca('0x2c')](_0x63ca('0x48'),_0x4683de);};AGIChannel[_0x63ca('0x22')][_0x63ca('0x17')]=function(_0xff531,_0x2a030b){this['noop'](util[_0x63ca('0x2a')](_0x63ca('0x49'),_0xff531['id'],_0xff531['label'],_0x2a030b));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 4e64cf0..aae38c9 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 _0xe4fd=['E_AGI_UNDEFINED','push','format','message','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20timeout.','Missing\x20\x27ivr.entry\x27\x20menu.'];(function(_0x4fb614,_0x3f1326){var _0x14222b=function(_0x5e3873){while(--_0x5e3873){_0x4fb614['push'](_0x4fb614['shift']());}};_0x14222b(++_0x3f1326);}(_0xe4fd,0x7c));var _0xde4f=function(_0x34a156,_0x3f57ea){_0x34a156=_0x34a156-0x0;var _0x42c18e=_0xe4fd[_0x34a156];return _0x42c18e;};'use strict';var util=require(_0xde4f('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0xde4f('0x1'),'E_AGI_SERVER_ERROR':_0xde4f('0x2'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0xde4f('0x3'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0xde4f('0x4'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0xde4f('0x5')};function AGIError(_0xf10899){var _0xf10899=_0xf10899||null,_0x9df056=_0x9df056||[],_0x513ab4=0x1,_0x5ec528='';if(!error[_0xf10899]){_0xf10899=_0xde4f('0x6');}_0x9df056['push'](error[_0xf10899]);while(arguments[_0x513ab4]){_0x9df056[_0xde4f('0x7')](arguments[_0x513ab4]);_0x513ab4++;}_0x5ec528=util[_0xde4f('0x8')]['apply'](util,_0x9df056);this[_0xde4f('0x9')]=_0x5ec528;this['name']=_0xf10899;}module['exports']=AGIError; \ No newline at end of file +var _0xf557=['apply','exports','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format'];(function(_0x6c8d7e,_0x42f30f){var _0x1a679b=function(_0x4310e0){while(--_0x4310e0){_0x6c8d7e['push'](_0x6c8d7e['shift']());}};_0x1a679b(++_0x42f30f);}(_0xf557,0xe3));var _0x7f55=function(_0x145a3f,_0x90e0a5){_0x145a3f=_0x145a3f-0x0;var _0x18dec0=_0xf557[_0x145a3f];return _0x18dec0;};'use strict';var util=require(_0x7f55('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x7f55('0x1'),'E_AGI_SERVER_ERROR':_0x7f55('0x2'),'E_AGI_SERVER_CLOSE':_0x7f55('0x3'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x7f55('0x4'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x7f55('0x5'),'E_AGI_SOCKET_TIMEOUT':_0x7f55('0x6'),'E_AGI_COMMAND_EMPTY':_0x7f55('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x7f55('0x8'),'E_AGI_IVR_ENTRY':_0x7f55('0x9')};function AGIError(_0x376afd){var _0x376afd=_0x376afd||null,_0x5cb7ed=_0x5cb7ed||[],_0x5acf92=0x1,_0x4ab731='';if(!error[_0x376afd]){_0x376afd=_0x7f55('0xa');}_0x5cb7ed['push'](error[_0x376afd]);while(arguments[_0x5acf92]){_0x5cb7ed[_0x7f55('0xb')](arguments[_0x5acf92]);_0x5acf92++;}_0x4ab731=util[_0x7f55('0xc')][_0x7f55('0xd')](util,_0x5cb7ed);this['message']=_0x4ab731;this['name']=_0x376afd;}module[_0x7f55('0xe')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index ba5bd48..83aef1f 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 _0xff03=['../../../config/logger','agi','menu','vertices','edges','numberOfEdges','prototype','addVertex','size','relations','getVertex','traverseBFS','no\x20vertex\x20found','info','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','vswitch','target','agicommand','default\x20on\x20switch\x20not\x20found','includes','condition\x20not\x20found','exports','lodash'];(function(_0x44de5c,_0x2983ae){var _0x1bb293=function(_0x19b6a4){while(--_0x19b6a4){_0x44de5c['push'](_0x44de5c['shift']());}};_0x1bb293(++_0x2983ae);}(_0xff03,0x143));var _0x3ff0=function(_0x79bf24,_0x63139d){_0x79bf24=_0x79bf24-0x0;var _0x35d78e=_0xff03[_0x79bf24];return _0x35d78e;};'use strict';var _=require(_0x3ff0('0x0'));var logger=require(_0x3ff0('0x1'))(_0x3ff0('0x2'));var verticesWithRetry=[_0x3ff0('0x3'),'getdigits','getsecretdigits'];var Graph=function(){this[_0x3ff0('0x4')]={};this[_0x3ff0('0x5')]={};this[_0x3ff0('0x6')]=0x0;};Graph[_0x3ff0('0x7')][_0x3ff0('0x8')]=function(_0x22f371){this[_0x3ff0('0x4')][_0x22f371['id']]=_0x22f371;this[_0x3ff0('0x5')][_0x22f371['id']]=[];};Graph['prototype']['addEdge']=function(_0x174dab,_0x2d2152,_0x2cb86c){this[_0x3ff0('0x5')][_0x174dab]['push']({'target':_0x2d2152,'condition':_0x2cb86c});this[_0x3ff0('0x6')]+=0x1;};Graph[_0x3ff0('0x7')]['size']=function(){return _[_0x3ff0('0x9')](this[_0x3ff0('0x4')]);};Graph[_0x3ff0('0x7')][_0x3ff0('0xa')]=function(){return this[_0x3ff0('0x6')];};Graph['prototype'][_0x3ff0('0xb')]=function(_0x45407d){return this[_0x3ff0('0x4')][_0x45407d];};Graph['prototype'][_0x3ff0('0xc')]=function(_0x28b864,_0x1dddef){if(!this[_0x3ff0('0x4')][_0x28b864]){return logger['info'](_0x3ff0('0xd'));}var _0x3ee8c8=_0x1dddef(this['vertices'][_0x28b864]);if(!_0x3ee8c8){return logger[_0x3ff0('0xe')](_0x3ff0('0xf'));}if(this[_0x3ff0('0x5')][_0x28b864][_0x3ff0('0x10')]===0x0){return logger['info'](_0x3ff0('0x11'));}for(var _0x2cc54c=0x0,_0x2dfb4f=[],_0x284032=![];_0x2cc54c\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','Project\x20%s\x20not\x20published','continueAt','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','syncho','util','../../config/environment','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','agi','127.0.0.1','nextTick','error','stack','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','dnid','uniqueid','arg_1','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','evtHangup','toJson','mxGraphModel','root','agicommand'];(function(_0xbbfe59,_0x46067f){var _0x28a2a4=function(_0xfe230){while(--_0xfe230){_0xbbfe59['push'](_0xbbfe59['shift']());}};_0x28a2a4(++_0x46067f);}(_0x8261,0x89));var _0x1826=function(_0x5b83c9,_0x121086){_0x5b83c9=_0x5b83c9-0x0;var _0x31f8e5=_0x8261[_0x5b83c9];return _0x31f8e5;};'use strict';var parser=require('xml2json');var _=require('lodash');var syncho=require(_0x1826('0x0'));var util=require(_0x1826('0x1'));var moment=require('moment');var config=require(_0x1826('0x2'));var logger=require('../../config/logger')('agi');var utilLicense=require(_0x1826('0x3'));var rpc=require(_0x1826('0x4'));var mailRpc=require(_0x1826('0x5'));var Graph=require(_0x1826('0x6'));var Vertices=require(_0x1826('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x1826('0x8')]=_['defaults'](config['agi'],{'ip':_0x1826('0x9'),'port':0x11dd});function connectionHandler(_0x4db8d5){process[_0x1826('0xa')](function(){syncho(function(){try{setChannelVariables(_0x4db8d5);agiHandler(_0x4db8d5);}catch(_0x371eae){logger[_0x1826('0xb')](_0x371eae[_0x1826('0xc')]);}});});}function listeningHandler(){console['log'](_0x1826('0xd'),config[_0x1826('0x8')][_0x1826('0xe')]);logger[_0x1826('0xf')](util[_0x1826('0x10')](_0x1826('0x11'),config[_0x1826('0x8')]['ip'],config['agi'][_0x1826('0xe')]));}function errorHandler(_0x2f891d){if(_0x2f891d&&_0x2f891d[_0x1826('0x12')]&&_0x2f891d['message']){logger['error'](util[_0x1826('0x10')]('[%s]\x20%s',_0x2f891d[_0x1826('0x12')],_0x2f891d[_0x1826('0x13')]));}else{logger['error'](util[_0x1826('0x10')](_0x1826('0x14'),_0x2f891d[_0x1826('0xc')]));}}function closeHandler(){logger[_0x1826('0xf')](util[_0x1826('0x10')](_0x1826('0x15'),this['arg_1'],this[_0x1826('0x16')],this['callerid'],this[_0x1826('0x17')],this[_0x1826('0x18')]));try{createSquareReport(this);}catch(_0x5f1da8){logger[_0x1826('0xb')](_0x5f1da8['stack']);}}function timeoutHandler(){logger[_0x1826('0xf')](util[_0x1826('0x10')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x1826('0x19')],this[_0x1826('0x16')],this['callerid'],this[_0x1826('0x17')],this[_0x1826('0x18')]));}function hangupHandler(){logger[_0x1826('0xf')](util[_0x1826('0x10')](_0x1826('0x1a'),this[_0x1826('0x19')],this['calleridname'],this[_0x1826('0x1b')],this[_0x1826('0x17')],this[_0x1826('0x18')]));this[_0x1826('0x1c')]=!![];}function getRoot(_0x44916e){return parser[_0x1826('0x1d')](_0x44916e,{'object':!![]})[_0x1826('0x1e')][_0x1826('0x1f')];}function addVertex(_0x2e04cd,_0x27034e,_0x4f3345){_0x27034e[_0x1826('0x20')]=_0x4f3345;if(_0x27034e[_0x1826('0x21')](_0x1826('0x22'))){_0x27034e[_0x1826('0x23')]=parseInt(_0x27034e[_0x1826('0x22')],0xa);}_0x2e04cd[_0x1826('0x24')](_['omit'](_0x27034e,_0x1826('0x25')));}function initGraph(_0x5b91dc,_0x2317bc){var _0xcfa13d=new Graph();for(var _0x3bb58c in _0x5b91dc){if(_0x5b91dc['hasOwnProperty'](_0x3bb58c)){if(_[_0x1826('0x26')](_0x5b91dc[_0x3bb58c])){for(var _0x5a4ff0=0x0;_0x5a4ff0<_0x5b91dc[_0x3bb58c][_0x1826('0x27')];_0x5a4ff0+=0x1){addVertex(_0xcfa13d,_0x5b91dc[_0x3bb58c][_0x5a4ff0],_0x3bb58c);}}else{addVertex(_0xcfa13d,_0x5b91dc[_0x3bb58c],_0x3bb58c);}}}for(var _0x2b0b55=0x0;_0x2b0b55<_0x2317bc[_0x1826('0x27')];_0x2b0b55+=0x1){if(_0x2317bc[_0x2b0b55]['source']&&_0x2317bc[_0x2b0b55][_0x1826('0x28')]){_0xcfa13d['addEdge'](_0x2317bc[_0x2b0b55]['source'],_0x2317bc[_0x2b0b55]['target'],_0x2317bc[_0x2b0b55]['value']);}}return _0xcfa13d;}function getSquareProject(_0xbf70d9,_0x28966a){rpc['getSquareProject'](_0xbf70d9)[_0x1826('0x29')](function(_0x1f7f22){_0x28966a(null,_0x1f7f22);})[_0x1826('0x2a')](function(_0x32093d){_0x28966a(null,_0x32093d);});}function createSquareReport(_0x21f690,_0x549ffa){rpc[_0x1826('0x2b')](_0x21f690)[_0x1826('0x29')](function(_0x3bc34e){if(_0x549ffa){_0x549ffa(null,_0x3bc34e);}})['catch'](function(_0x129441){if(_0x549ffa){_0x549ffa(null,_0x129441);}});}function setChannelVariables(_0x3b06d9){for(var _0x41ab2c in _0x3b06d9){if(_0x3b06d9[_0x1826('0x21')](_0x41ab2c)){if(_0x41ab2c['indexOf'](_0x1826('0x2c'))===0x0){_0x3b06d9[_0x41ab2c['substring'](0x4)]=_0x3b06d9[_0x41ab2c];delete _0x3b06d9[_0x41ab2c];}}}}function getLogFromObject(_0xf1736e){return util[_0x1826('0x2d')](_0xf1736e,{'showHidden':![],'depth':null});}function agiHandler(_0x3c4b70){var _0xc42fc4,_0x2022dc,_0x2c5d7b,_0x28c3bc,_0x25f7ee;logger[_0x1826('0x2e')](_0x1826('0x2f'),JSON[_0x1826('0x30')](_0x3c4b70,null,0x2));logger['info'](util[_0x1826('0x10')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x3c4b70[_0x1826('0x19')],_0x3c4b70[_0x1826('0x16')],_0x3c4b70[_0x1826('0x1b')],_0x3c4b70[_0x1826('0x17')],_0x3c4b70[_0x1826('0x18')]));_0x3c4b70['on'](_0x1826('0xb'),errorHandler);_0x3c4b70['on'](_0x1826('0x31'),closeHandler);_0x3c4b70['on'](_0x1826('0x32'),timeoutHandler);_0x3c4b70['evtHangup']=![];_0x3c4b70['on'](_0x1826('0x33'),hangupHandler);var _0x3d324c=getSquareProject[_0x1826('0x34')](null,_0x3c4b70['arg_1']);if(_0x3d324c){if(_0x3d324c[_0x1826('0x35')]){_0xc42fc4=getRoot(_0x3d324c[_0x1826('0x35')]);if(_0xc42fc4&&_0xc42fc4[_0x1826('0x36')]){logger['debug'](_0x1826('0x1f'),JSON['stringify'](_0xc42fc4,null,0x2));_0x3c4b70[_0x1826('0x37')]=moment()[_0x1826('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x2022dc=initGraph(_['omit'](_0xc42fc4,'mxCell'),_0xc42fc4[_0x1826('0x25')]);_0x2c5d7b=new Vertices(_0x3c4b70,rpc,mailRpc);logger[_0x1826('0xf')](util[_0x1826('0x10')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x3c4b70[_0x1826('0x19')],_0x3c4b70[_0x1826('0x16')],_0x3c4b70[_0x1826('0x1b')],_0x3c4b70[_0x1826('0x17')],_0x3c4b70[_0x1826('0x18')]));_0x2022dc[_0x1826('0x38')](_0xc42fc4[_0x1826('0x36')]['id'],function(_0x1e64cd){try{_0x1e64cd=_0x2c5d7b[_0x1826('0x39')](_0x1e64cd);logger[_0x1826('0x2e')](_0x1826('0x3a'),JSON[_0x1826('0x30')](_0x1e64cd,null,0x2));if(_0x1e64cd[_0x1826('0x20')]===_0x1826('0x3b')){logger[_0x1826('0xf')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x3c4b70['context']=_0x1e64cd[_0x1826('0x3c')]||_0x3c4b70['context'];_0x3c4b70[_0x1826('0x3d')]=_0x1e64cd['extension'];_0x3c4b70['priority']=_0x1e64cd[_0x1826('0x3e')]?_0x1e64cd[_0x1826('0x3e')]-0x1:0x1;return null;}else if(_0x1e64cd&&_0x2c5d7b[_0x1e64cd[_0x1826('0x20')]]){_0x25f7ee=_0x2c5d7b[_0x1e64cd['agicommand']](_0x1e64cd);logger['info']('response',JSON['stringify'](_0x25f7ee,null,0x2));if(_0x25f7ee&&_0x25f7ee['code']===AGI_CODE_SUCCESS&&_0x25f7ee[_0x1826('0x3f')]!==AGI_RESULT_ERROR&&!_0x3c4b70['evtHangup']){logger[_0x1826('0x2e')](_0x1826('0x40'),getLogFromObject(_0x25f7ee));return _[_0x1826('0x41')](_0x25f7ee['result'])?null:_0x25f7ee[_0x1826('0x3f')][_0x1826('0x42')]();}else{logger['error'](_0x1826('0x40'),getLogFromObject(_0x25f7ee));return null;}}else{logger[_0x1826('0xb')](_0x1826('0x43'));return null;}}catch(_0x4a8550){logger[_0x1826('0xb')](_0x4a8550[_0x1826('0xc')]);return null;}});if(_0xc42fc4[_0x1826('0x44')]){logger['info'](util[_0x1826('0x10')](_0x1826('0x45'),_0x3c4b70[_0x1826('0x19')],_0x3c4b70[_0x1826('0x16')],_0x3c4b70['callerid'],_0x3c4b70['dnid'],_0x3c4b70[_0x1826('0x18')]));_0x2022dc[_0x1826('0x38')](_0xc42fc4[_0x1826('0x44')]['id'],function(_0x44e0fb){try{_0x44e0fb=_0x2c5d7b['clear'](_0x44e0fb);logger[_0x1826('0x2e')](_0x1826('0x3a'),JSON[_0x1826('0x30')](_0x44e0fb,null,0x2));if(_0x44e0fb&&_0x2c5d7b[_0x44e0fb[_0x1826('0x20')]]){_0x25f7ee=_0x2c5d7b[_0x44e0fb[_0x1826('0x20')]](_0x44e0fb);if(_0x25f7ee){logger[_0x1826('0x2e')](_0x1826('0x40'),getLogFromObject(_0x25f7ee));return _[_0x1826('0x41')](_0x25f7ee[_0x1826('0x3f')])?null:_0x25f7ee[_0x1826('0x3f')][_0x1826('0x42')]();}else{logger[_0x1826('0xb')](_0x1826('0x40'),getLogFromObject(_0x25f7ee));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x35ab30){logger[_0x1826('0xb')](_0x35ab30[_0x1826('0xc')]);return null;}});}logger[_0x1826('0xf')](util[_0x1826('0x10')](_0x1826('0x46'),_0x3c4b70['arg_1'],_0x3c4b70['calleridname'],_0x3c4b70[_0x1826('0x1b')],_0x3c4b70[_0x1826('0x17')],_0x3c4b70[_0x1826('0x18')]));logger[_0x1826('0xf')](util[_0x1826('0x10')](_0x1826('0x47'),_0x3c4b70['context'],_0x3c4b70[_0x1826('0x3d')],parseInt(_0x3c4b70['priority'],0xa)+0x1));_0x3c4b70['continueAt'](_0x3c4b70['context'],_0x3c4b70[_0x1826('0x3d')],parseInt(_0x3c4b70['priority'],0xa)+0x1);_0x3c4b70[_0x1826('0x31')]();}}else{logger[_0x1826('0xb')](util[_0x1826('0x10')](_0x1826('0x48'),_0x3c4b70['arg_1']));_0x3c4b70[_0x1826('0x49')](_0x3c4b70[_0x1826('0x3c')],_0x3c4b70[_0x1826('0x3d')],parseInt(_0x3c4b70[_0x1826('0x3e')],0xa)+0x1);_0x3c4b70[_0x1826('0x31')]();}}else{logger[_0x1826('0xb')](util[_0x1826('0x10')](_0x1826('0x4a'),_0x3c4b70[_0x1826('0x19')]));_0x3c4b70['continueAt'](_0x3c4b70[_0x1826('0x3c')],_0x3c4b70[_0x1826('0x3d')],parseInt(_0x3c4b70[_0x1826('0x3e')],0xa)+0x1);_0x3c4b70['close']();}}function main(){var _0x1798e3;return utilLicense[_0x1826('0x4b')]()[_0x1826('0x29')](function(_0x5846a4){if(_0x5846a4){if(_0x5846a4[_0x1826('0x4c')]){if(_0x5846a4[_0x1826('0x4d')]&&_0x5846a4[_0x1826('0x4d')]>0x0){logger[_0x1826('0xf')](util[_0x1826('0x10')](_0x1826('0x4e'),_0x5846a4['callysquare']));_0x1798e3=_0x5846a4[_0x1826('0x4d')];}else{logger[_0x1826('0xf')](_0x1826('0x4f'));}}else{logger[_0x1826('0xf')](_0x1826('0x50'));_0x1798e3=-0x1;}}})[_0x1826('0x2a')](function(_0x1e526c){logger[_0x1826('0xb')](_0x1826('0x51'),_0x1e526c[_0x1826('0xc')]);})[_0x1826('0x44')](function(){var _0x275b6b=require(_0x1826('0x52'))(config[_0x1826('0x8')][_0x1826('0xe')],config[_0x1826('0x8')]['ip'],_0x1798e3);_0x275b6b['on']('error',errorHandler);_0x275b6b['on'](_0x1826('0x53'),listeningHandler);_0x275b6b['on'](_0x1826('0x54'),connectionHandler);_0x275b6b['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0xdd41=['Project\x20%s\x20not\x20published','continueAt','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','xml2json','lodash','syncho','util','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./mailRpc','./vertices','defaults','nextTick','stack','log','port','format','name','[%s]\x20%s','message','error','info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','length','source','target','addEdge','getSquareProject','then','catch','createSquareReport','indexOf','agi_','inspect','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','hangup','sync','production','joinAt','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','clear','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','isUndefined','agicommand\x20not\x20found','finally','traverseBFS','vertex','toString','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','close'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0xdd41,0x17d));var _0x1dd4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd41[_0x3dd15e];return _0x231fd0;};'use strict';var parser=require(_0x1dd4('0x0'));var _=require(_0x1dd4('0x1'));var syncho=require(_0x1dd4('0x2'));var util=require(_0x1dd4('0x3'));var moment=require(_0x1dd4('0x4'));var config=require(_0x1dd4('0x5'));var logger=require(_0x1dd4('0x6'))(_0x1dd4('0x7'));var utilLicense=require(_0x1dd4('0x8'));var rpc=require('./rpc');var mailRpc=require(_0x1dd4('0x9'));var Graph=require('./graph');var Vertices=require(_0x1dd4('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x1dd4('0x7')]=_[_0x1dd4('0xb')](config[_0x1dd4('0x7')],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x37072f){process[_0x1dd4('0xc')](function(){syncho(function(){try{setChannelVariables(_0x37072f);agiHandler(_0x37072f);}catch(_0x1bb2a5){logger['error'](_0x1bb2a5[_0x1dd4('0xd')]);}});});}function listeningHandler(){console[_0x1dd4('0xe')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x1dd4('0x7')][_0x1dd4('0xf')]);logger['info'](util[_0x1dd4('0x10')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x1dd4('0x7')]['ip'],config[_0x1dd4('0x7')][_0x1dd4('0xf')]));}function errorHandler(_0x48b65b){if(_0x48b65b&&_0x48b65b[_0x1dd4('0x11')]&&_0x48b65b['message']){logger['error'](util[_0x1dd4('0x10')](_0x1dd4('0x12'),_0x48b65b[_0x1dd4('0x11')],_0x48b65b[_0x1dd4('0x13')]));}else{logger[_0x1dd4('0x14')](util[_0x1dd4('0x10')]('[ERROR]\x20%s',_0x48b65b[_0x1dd4('0xd')]));}}function closeHandler(){logger[_0x1dd4('0x15')](util['format'](_0x1dd4('0x16'),this['arg_1'],this[_0x1dd4('0x17')],this[_0x1dd4('0x18')],this['dnid'],this[_0x1dd4('0x19')]));try{createSquareReport(this);}catch(_0xfa484b){logger['error'](_0xfa484b[_0x1dd4('0xd')]);}}function timeoutHandler(){logger[_0x1dd4('0x15')](util['format'](_0x1dd4('0x1a'),this[_0x1dd4('0x1b')],this['calleridname'],this[_0x1dd4('0x18')],this[_0x1dd4('0x1c')],this[_0x1dd4('0x19')]));}function hangupHandler(){logger[_0x1dd4('0x15')](util['format'](_0x1dd4('0x1d'),this['arg_1'],this[_0x1dd4('0x17')],this[_0x1dd4('0x18')],this[_0x1dd4('0x1c')],this[_0x1dd4('0x19')]));this[_0x1dd4('0x1e')]=!![];}function getRoot(_0xb628a8){return parser[_0x1dd4('0x1f')](_0xb628a8,{'object':!![]})[_0x1dd4('0x20')][_0x1dd4('0x21')];}function addVertex(_0x539b38,_0x14271a,_0x1148b7){_0x14271a[_0x1dd4('0x22')]=_0x1148b7;if(_0x14271a[_0x1dd4('0x23')](_0x1dd4('0x24'))){_0x14271a[_0x1dd4('0x25')]=parseInt(_0x14271a[_0x1dd4('0x24')],0xa);}_0x539b38[_0x1dd4('0x26')](_[_0x1dd4('0x27')](_0x14271a,_0x1dd4('0x28')));}function initGraph(_0x39454f,_0xa15f48){var _0x1679ac=new Graph();for(var _0x2eef64 in _0x39454f){if(_0x39454f[_0x1dd4('0x23')](_0x2eef64)){if(_['isArray'](_0x39454f[_0x2eef64])){for(var _0x17bd16=0x0;_0x17bd16<_0x39454f[_0x2eef64][_0x1dd4('0x29')];_0x17bd16+=0x1){addVertex(_0x1679ac,_0x39454f[_0x2eef64][_0x17bd16],_0x2eef64);}}else{addVertex(_0x1679ac,_0x39454f[_0x2eef64],_0x2eef64);}}}for(var _0x23b57d=0x0;_0x23b57d<_0xa15f48[_0x1dd4('0x29')];_0x23b57d+=0x1){if(_0xa15f48[_0x23b57d][_0x1dd4('0x2a')]&&_0xa15f48[_0x23b57d][_0x1dd4('0x2b')]){_0x1679ac[_0x1dd4('0x2c')](_0xa15f48[_0x23b57d][_0x1dd4('0x2a')],_0xa15f48[_0x23b57d][_0x1dd4('0x2b')],_0xa15f48[_0x23b57d]['value']);}}return _0x1679ac;}function getSquareProject(_0x30d0fe,_0x51e5d1){rpc[_0x1dd4('0x2d')](_0x30d0fe)[_0x1dd4('0x2e')](function(_0x5aa00a){_0x51e5d1(null,_0x5aa00a);})[_0x1dd4('0x2f')](function(_0x278820){_0x51e5d1(null,_0x278820);});}function createSquareReport(_0x16096c,_0x325ec0){rpc[_0x1dd4('0x30')](_0x16096c)['then'](function(_0x167816){if(_0x325ec0){_0x325ec0(null,_0x167816);}})[_0x1dd4('0x2f')](function(_0x9d147e){if(_0x325ec0){_0x325ec0(null,_0x9d147e);}});}function setChannelVariables(_0x32d2a1){for(var _0x5170f7 in _0x32d2a1){if(_0x32d2a1[_0x1dd4('0x23')](_0x5170f7)){if(_0x5170f7[_0x1dd4('0x31')](_0x1dd4('0x32'))===0x0){_0x32d2a1[_0x5170f7['substring'](0x4)]=_0x32d2a1[_0x5170f7];delete _0x32d2a1[_0x5170f7];}}}}function getLogFromObject(_0x249ff9){return util[_0x1dd4('0x33')](_0x249ff9,{'showHidden':![],'depth':null});}function agiHandler(_0x56f955){var _0x361930,_0x549828,_0x38d29c,_0x3db0b1,_0x5c826d;logger[_0x1dd4('0x34')](_0x1dd4('0x35'),JSON[_0x1dd4('0x36')](_0x56f955,null,0x2));logger['info'](util[_0x1dd4('0x10')](_0x1dd4('0x37'),_0x56f955['arg_1'],_0x56f955[_0x1dd4('0x17')],_0x56f955[_0x1dd4('0x18')],_0x56f955[_0x1dd4('0x1c')],_0x56f955[_0x1dd4('0x19')]));_0x56f955['on'](_0x1dd4('0x14'),errorHandler);_0x56f955['on']('close',closeHandler);_0x56f955['on']('timeout',timeoutHandler);_0x56f955['evtHangup']=![];_0x56f955['on'](_0x1dd4('0x38'),hangupHandler);var _0x3faaad=getSquareProject[_0x1dd4('0x39')](null,_0x56f955[_0x1dd4('0x1b')]);if(_0x3faaad){if(_0x3faaad['production']){_0x361930=getRoot(_0x3faaad[_0x1dd4('0x3a')]);if(_0x361930&&_0x361930['start']){logger[_0x1dd4('0x34')](_0x1dd4('0x21'),JSON[_0x1dd4('0x36')](_0x361930,null,0x2));_0x56f955[_0x1dd4('0x3b')]=moment()[_0x1dd4('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x549828=initGraph(_[_0x1dd4('0x27')](_0x361930,'mxCell'),_0x361930['mxCell']);_0x38d29c=new Vertices(_0x56f955,rpc,mailRpc);logger['info'](util[_0x1dd4('0x10')](_0x1dd4('0x3c'),_0x56f955[_0x1dd4('0x1b')],_0x56f955['calleridname'],_0x56f955[_0x1dd4('0x18')],_0x56f955[_0x1dd4('0x1c')],_0x56f955[_0x1dd4('0x19')]));_0x549828['traverseBFS'](_0x361930['start']['id'],function(_0x1863cb){try{_0x1863cb=_0x38d29c[_0x1dd4('0x3d')](_0x1863cb);logger[_0x1dd4('0x34')]('vertex',JSON[_0x1dd4('0x36')](_0x1863cb,null,0x2));if(_0x1863cb[_0x1dd4('0x22')]===_0x1dd4('0x3e')){logger[_0x1dd4('0x15')](_0x1dd4('0x3f'));_0x56f955[_0x1dd4('0x40')]=_0x1863cb[_0x1dd4('0x40')]||_0x56f955['context'];_0x56f955[_0x1dd4('0x41')]=_0x1863cb['extension'];_0x56f955[_0x1dd4('0x42')]=_0x1863cb[_0x1dd4('0x42')]?_0x1863cb[_0x1dd4('0x42')]-0x1:0x1;return null;}else if(_0x1863cb&&_0x38d29c[_0x1863cb['agicommand']]){_0x5c826d=_0x38d29c[_0x1863cb['agicommand']](_0x1863cb);logger[_0x1dd4('0x15')](_0x1dd4('0x43'),JSON[_0x1dd4('0x36')](_0x5c826d,null,0x2));if(_0x5c826d&&_0x5c826d[_0x1dd4('0x44')]===AGI_CODE_SUCCESS&&_0x5c826d[_0x1dd4('0x45')]!==AGI_RESULT_ERROR&&!_0x56f955[_0x1dd4('0x1e')]){logger[_0x1dd4('0x34')]('response',getLogFromObject(_0x5c826d));return _[_0x1dd4('0x46')](_0x5c826d[_0x1dd4('0x45')])?null:_0x5c826d[_0x1dd4('0x45')]['toString']();}else{logger[_0x1dd4('0x14')]('response',getLogFromObject(_0x5c826d));return null;}}else{logger[_0x1dd4('0x14')](_0x1dd4('0x47'));return null;}}catch(_0x2465a9){logger[_0x1dd4('0x14')](_0x2465a9['stack']);return null;}});if(_0x361930[_0x1dd4('0x48')]){logger[_0x1dd4('0x15')](util['format']('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x56f955[_0x1dd4('0x1b')],_0x56f955['calleridname'],_0x56f955['callerid'],_0x56f955[_0x1dd4('0x1c')],_0x56f955[_0x1dd4('0x19')]));_0x549828[_0x1dd4('0x49')](_0x361930[_0x1dd4('0x48')]['id'],function(_0x1baa00){try{_0x1baa00=_0x38d29c[_0x1dd4('0x3d')](_0x1baa00);logger[_0x1dd4('0x34')](_0x1dd4('0x4a'),JSON[_0x1dd4('0x36')](_0x1baa00,null,0x2));if(_0x1baa00&&_0x38d29c[_0x1baa00[_0x1dd4('0x22')]]){_0x5c826d=_0x38d29c[_0x1baa00[_0x1dd4('0x22')]](_0x1baa00);if(_0x5c826d){logger[_0x1dd4('0x34')](_0x1dd4('0x43'),getLogFromObject(_0x5c826d));return _[_0x1dd4('0x46')](_0x5c826d['result'])?null:_0x5c826d['result'][_0x1dd4('0x4b')]();}else{logger['error'](_0x1dd4('0x43'),getLogFromObject(_0x5c826d));return null;}}else{logger[_0x1dd4('0x14')](_0x1dd4('0x47'));return null;}}catch(_0x17f4f7){logger[_0x1dd4('0x14')](_0x17f4f7[_0x1dd4('0xd')]);return null;}});}logger['info'](util[_0x1dd4('0x10')](_0x1dd4('0x4c'),_0x56f955[_0x1dd4('0x1b')],_0x56f955['calleridname'],_0x56f955['callerid'],_0x56f955['dnid'],_0x56f955['uniqueid']));logger[_0x1dd4('0x15')](util[_0x1dd4('0x10')](_0x1dd4('0x4d'),_0x56f955[_0x1dd4('0x40')],_0x56f955['extension'],parseInt(_0x56f955[_0x1dd4('0x42')],0xa)+0x1));_0x56f955['continueAt'](_0x56f955['context'],_0x56f955['extension'],parseInt(_0x56f955[_0x1dd4('0x42')],0xa)+0x1);_0x56f955[_0x1dd4('0x4e')]();}}else{logger['error'](util['format'](_0x1dd4('0x4f'),_0x56f955[_0x1dd4('0x1b')]));_0x56f955[_0x1dd4('0x50')](_0x56f955[_0x1dd4('0x40')],_0x56f955[_0x1dd4('0x41')],parseInt(_0x56f955['priority'],0xa)+0x1);_0x56f955[_0x1dd4('0x4e')]();}}else{logger['error'](util[_0x1dd4('0x10')](_0x1dd4('0x51'),_0x56f955['arg_1']));_0x56f955['continueAt'](_0x56f955[_0x1dd4('0x40')],_0x56f955['extension'],parseInt(_0x56f955['priority'],0xa)+0x1);_0x56f955[_0x1dd4('0x4e')]();}}function main(){var _0x1f8fe7;return utilLicense[_0x1dd4('0x52')]()[_0x1dd4('0x2e')](function(_0x820378){if(_0x820378){if(_0x820378[_0x1dd4('0x53')]){if(_0x820378[_0x1dd4('0x54')]&&_0x820378[_0x1dd4('0x54')]>0x0){logger[_0x1dd4('0x15')](util[_0x1dd4('0x10')](_0x1dd4('0x55'),_0x820378['callysquare']));_0x1f8fe7=_0x820378['callysquare'];}else{logger[_0x1dd4('0x15')](_0x1dd4('0x56'));}}else{logger['info'](_0x1dd4('0x57'));_0x1f8fe7=-0x1;}}})[_0x1dd4('0x2f')](function(_0x4e9082){logger[_0x1dd4('0x14')](_0x1dd4('0x58'),_0x4e9082[_0x1dd4('0xd')]);})[_0x1dd4('0x48')](function(){var _0x2f7a6e=require(_0x1dd4('0x59'))(config['agi'][_0x1dd4('0xf')],config[_0x1dd4('0x7')]['ip'],_0x1f8fe7);_0x2f7a6e['on'](_0x1dd4('0x14'),errorHandler);_0x2f7a6e['on'](_0x1dd4('0x5a'),listeningHandler);_0x2f7a6e['on'](_0x1dd4('0x5b'),connectionHandler);_0x2f7a6e['on'](_0x1dd4('0x4e'),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 f60404c..d436b2b 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 _0x32bf=['client','http','request','error','message','catch','sendMailMessage','bluebird','jayson/promise'];(function(_0x2c1104,_0x4cee08){var _0x48bf85=function(_0x4a7858){while(--_0x4a7858){_0x2c1104['push'](_0x2c1104['shift']());}};_0x48bf85(++_0x4cee08);}(_0x32bf,0x11e));var _0xf32b=function(_0x201c2f,_0x400fc4){_0x201c2f=_0x201c2f-0x0;var _0x1b973a=_0x32bf[_0x201c2f];return _0x1b973a;};'use strict';var BPromise=require(_0xf32b('0x0'));var jayson=require(_0xf32b('0x1'));var client=jayson[_0xf32b('0x2')][_0xf32b('0x3')]({'port':0x232b});function request(_0x4a91fa,_0x183b08){return new BPromise(function(_0x17a136,_0x22fda1){return client[_0xf32b('0x4')](_0x4a91fa,_0x183b08)['then'](function(_0x26bd3a){if(_0x26bd3a[_0xf32b('0x5')]){return _0x22fda1(_0x26bd3a[_0xf32b('0x5')][_0xf32b('0x6')]);}else{return _0x17a136(_0x26bd3a['result']);}})[_0xf32b('0x7')](function(_0x1fcf75){return _0x22fda1(_0x1fcf75);});});}exports[_0xf32b('0x8')]=function(_0x3007e8,_0x2af52f){return request('SendMail',{'account':_0x3007e8,'message':_0x2af52f});}; \ No newline at end of file +var _0xa56f=['sendMailMessage','SendMail','bluebird','jayson/promise','client','then','error'];(function(_0x3dc351,_0x54901a){var _0x66cf97=function(_0x2a1e3f){while(--_0x2a1e3f){_0x3dc351['push'](_0x3dc351['shift']());}};_0x66cf97(++_0x54901a);}(_0xa56f,0x183));var _0xfa56=function(_0x946a31,_0x203a2e){_0x946a31=_0x946a31-0x0;var _0x3c4094=_0xa56f[_0x946a31];return _0x3c4094;};'use strict';var BPromise=require(_0xfa56('0x0'));var jayson=require(_0xfa56('0x1'));var client=jayson[_0xfa56('0x2')]['http']({'port':0x232b});function request(_0x1e3e25,_0x12b90a){return new BPromise(function(_0x1ffd36,_0x5eb7d5){return client['request'](_0x1e3e25,_0x12b90a)[_0xfa56('0x3')](function(_0x220a81){if(_0x220a81[_0xfa56('0x4')]){return _0x5eb7d5(_0x220a81[_0xfa56('0x4')]['message']);}else{return _0x1ffd36(_0x220a81['result']);}})['catch'](function(_0x4fa29b){return _0x5eb7d5(_0x4fa29b);});});}exports[_0xfa56('0x5')]=function(_0x5cc428,_0x4e4615){return request(_0xfa56('0x6'),{'account':_0x5cc428,'message':_0x4e4615});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index f82f586..557cb04 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 _0x8912=['trim','emit','headers','substring','line','exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','prototype','_transform','indexOf','length','split','slice'];(function(_0xf46b1c,_0x3e8408){var _0xda1d66=function(_0x12ec30){while(--_0x12ec30){_0xf46b1c['push'](_0xf46b1c['shift']());}};_0xda1d66(++_0x3e8408);}(_0x8912,0xc4));var _0x2891=function(_0x4507de,_0x2b3caa){_0x4507de=_0x4507de-0x0;var _0x2229c5=_0x8912[_0x4507de];return _0x2229c5;};'use strict';var util=require(_0x2891('0x0'));var Transform=require(_0x2891('0x1'))[_0x2891('0x2')];function AGIReply(_0x12ecb2){Transform[_0x2891('0x3')](this,_0x12ecb2);this[_0x2891('0x4')]='';this[_0x2891('0x5')]=![];}util[_0x2891('0x6')](AGIReply,Transform);AGIReply[_0x2891('0x7')][_0x2891('0x8')]=function(_0x397cdc,_0x18cad1,_0x1dbe95){var _0x1c62e5='\x0a',_0x5982a8=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x142a0e=-0x1,_0x3d460d=-0x1,_0xc45f27='',_0x5630e2=0x0,_0x17bac0='',_0x3f1110='';this[_0x2891('0x4')]+=_0x397cdc['toString']();_0x17bac0=this['_localBuffer'];if(!this[_0x2891('0x5')]){_0x5630e2=0x0;while(_0x5982a8[_0x5630e2]){while((_0x3d460d=_0x17bac0[_0x2891('0x9')](_0x5982a8[_0x5630e2]))!=-0x1){_0xc45f27=_0x5982a8[_0x5630e2];_0x3f1110=_0x17bac0['substring'](0x0,_0x3d460d);_0x17bac0=_0x17bac0['substring'](_0x3d460d+_0xc45f27[_0x2891('0xa')]);var _0xb8f64=_0x3f1110[_0x2891('0xb')](_0x1c62e5),_0x4e566b=0x0,_0x2d3a23={},_0xe944d9='',_0x400310='',_0x417bc7=-0x1;while(_0xb8f64[_0x4e566b]){_0x417bc7=_0xb8f64[_0x4e566b][_0x2891('0x9')](':');if(_0x417bc7!=-0x1){_0xe944d9=_0xb8f64[_0x4e566b][_0x2891('0xc')](0x0,_0x417bc7)[_0x2891('0xd')]();_0x400310=_0xb8f64[_0x4e566b]['slice'](_0x417bc7+0x1)[_0x2891('0xd')]();if(_0xe944d9[_0x2891('0xa')]>0x0){_0x2d3a23[_0xe944d9]=_0x400310;}}else{}_0x4e566b++;}this[_0x2891('0xe')](_0x2891('0xf'),_0x2d3a23);this[_0x2891('0x5')]=!![];}_0x5630e2++;}this[_0x2891('0x4')]=_0x17bac0;}else{while((_0x142a0e=_0x17bac0[_0x2891('0x9')](_0x1c62e5))!=-0x1){_0x3f1110=_0x17bac0[_0x2891('0x10')](0x0,_0x142a0e);this[_0x2891('0xe')](_0x2891('0x11'),_0x3f1110);_0x17bac0=_0x17bac0[_0x2891('0x10')](_0x142a0e+_0x1c62e5[_0x2891('0xa')]);}this[_0x2891('0x4')]=_0x17bac0;}_0x1dbe95();};module[_0x2891('0x12')]=AGIReply; \ No newline at end of file +var _0x768a=['_inBody','inherits','prototype','\x0d\x0a\x0d\x0a','indexOf','substring','length','split','slice','trim','headers','emit','exports','stream','Transform','_localBuffer'];(function(_0xd09a56,_0x470a22){var _0x1d386c=function(_0x5851a3){while(--_0x5851a3){_0xd09a56['push'](_0xd09a56['shift']());}};_0x1d386c(++_0x470a22);}(_0x768a,0x10d));var _0xa768=function(_0x4a72d3,_0x4dbce3){_0x4a72d3=_0x4a72d3-0x0;var _0x124dfd=_0x768a[_0x4a72d3];return _0x124dfd;};'use strict';var util=require('util');var Transform=require(_0xa768('0x0'))[_0xa768('0x1')];function AGIReply(_0x845262){Transform['call'](this,_0x845262);this[_0xa768('0x2')]='';this[_0xa768('0x3')]=![];}util[_0xa768('0x4')](AGIReply,Transform);AGIReply[_0xa768('0x5')]['_transform']=function(_0x12f2fe,_0x251d28,_0x1280af){var _0x1de3f4='\x0a',_0x148ab4=['\x0a\x0a',_0xa768('0x6')],_0x3c1679=-0x1,_0x2bcd66=-0x1,_0x39095a='',_0x4ff0d5=0x0,_0x462706='',_0x34d986='';this['_localBuffer']+=_0x12f2fe['toString']();_0x462706=this[_0xa768('0x2')];if(!this[_0xa768('0x3')]){_0x4ff0d5=0x0;while(_0x148ab4[_0x4ff0d5]){while((_0x2bcd66=_0x462706[_0xa768('0x7')](_0x148ab4[_0x4ff0d5]))!=-0x1){_0x39095a=_0x148ab4[_0x4ff0d5];_0x34d986=_0x462706[_0xa768('0x8')](0x0,_0x2bcd66);_0x462706=_0x462706[_0xa768('0x8')](_0x2bcd66+_0x39095a[_0xa768('0x9')]);var _0x58edae=_0x34d986[_0xa768('0xa')](_0x1de3f4),_0x329676=0x0,_0x4b83de={},_0x2164e9='',_0x5c2fcd='',_0x2dced5=-0x1;while(_0x58edae[_0x329676]){_0x2dced5=_0x58edae[_0x329676]['indexOf'](':');if(_0x2dced5!=-0x1){_0x2164e9=_0x58edae[_0x329676][_0xa768('0xb')](0x0,_0x2dced5)['trim']();_0x5c2fcd=_0x58edae[_0x329676]['slice'](_0x2dced5+0x1)[_0xa768('0xc')]();if(_0x2164e9['length']>0x0){_0x4b83de[_0x2164e9]=_0x5c2fcd;}}else{}_0x329676++;}this['emit'](_0xa768('0xd'),_0x4b83de);this[_0xa768('0x3')]=!![];}_0x4ff0d5++;}this['_localBuffer']=_0x462706;}else{while((_0x3c1679=_0x462706[_0xa768('0x7')](_0x1de3f4))!=-0x1){_0x34d986=_0x462706[_0xa768('0x8')](0x0,_0x3c1679);this[_0xa768('0xe')]('line',_0x34d986);_0x462706=_0x462706[_0xa768('0x8')](_0x3c1679+_0x1de3f4[_0xa768('0x9')]);}this['_localBuffer']=_0x462706;}_0x1280af();};module[_0xa768('0xf')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index e66ee59..499220b 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 _0x916b=['message','catch','getMailAccountById','ShowMailAccount','MailServerOut','name','email','getSquareProjectById','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','ShowVariable','getSquareOdbcById','ShowSquareOdbc','ShowUser','ShowSound','save_name','getIntervalById','Interval','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','createCmContact','phone','ListId','getPauseById','ShowPause','LoginUser','agentPause','agentUnpause','UnpauseUser','agentLogout','bluebird','lodash','util','jayson/promise','http','then','error'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x916b,0xf8));var _0xb916=function(_0x4934fd,_0x13c8ed){_0x4934fd=_0x4934fd-0x0;var _0x3c4b1d=_0x916b[_0x4934fd];return _0x3c4b1d;};'use strict';var BPromise=require(_0xb916('0x0'));var moment=require('moment');var _=require(_0xb916('0x1'));var util=require(_0xb916('0x2'));var jayson=require(_0xb916('0x3'));var client=jayson['client'][_0xb916('0x4')]({'port':0x2329});function request(_0x6cce49,_0xf76e50){return new BPromise(function(_0x273b35,_0x3ee1d1){return client['request'](_0x6cce49,_0xf76e50)[_0xb916('0x5')](function(_0x2dc0ed){if(_0x2dc0ed[_0xb916('0x6')]){return _0x3ee1d1(_0x2dc0ed['error'][_0xb916('0x7')]);}else{return _0x273b35(_0x2dc0ed['result']);}})[_0xb916('0x8')](function(_0x3d3e19){return _0x3ee1d1(_0x3d3e19);});});}exports['getSquareProject']=function(_0x36a558){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x36a558},'attributes':['production']}});};exports[_0xb916('0x9')]=function(_0x6654ec){return request(_0xb916('0xa'),{'options':{'raw':![],'where':{'id':_0x6654ec},'include':[{'model':_0xb916('0xb'),'as':'Smtp'}],'attributes':['id',_0xb916('0xc'),_0xb916('0xd')]}});};exports[_0xb916('0xe')]=function(_0xb990fb){return request(_0xb916('0xf'),{'options':{'where':{'id':_0xb990fb},'attributes':['name']}});};exports[_0xb916('0x10')]=function(_0x3d3c6b){return request(_0xb916('0x11'),{'options':{'where':{'id':_0x3d3c6b},'attributes':[_0xb916('0xc')]}});};exports['getVariableById']=function(_0x180847){return request(_0xb916('0x12'),{'options':{'where':{'id':_0x180847},'attributes':[_0xb916('0xc')]}});};exports[_0xb916('0x13')]=function(_0x57592d){return request(_0xb916('0x14'),{'options':{'where':{'id':_0x57592d},'attributes':['dsn']}});};exports['getUserById']=function(_0x58be22){return request(_0xb916('0x15'),{'options':{'where':{'id':_0x58be22},'attributes':[_0xb916('0xc')]}});};exports['getTrunkById']=function(_0x4ffbfc){return request('ShowTrunk',{'options':{'where':{'id':_0x4ffbfc},'attributes':[_0xb916('0xc')]}});};exports['getSoundById']=function(_0x30c1a9){return request(_0xb916('0x16'),{'options':{'where':{'id':_0x30c1a9},'attributes':[_0xb916('0x17')]}});};exports[_0xb916('0x18')]=function(_0x31e457){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x31e457},'include':[{'model':_0xb916('0x19'),'as':'Intervals'}]}});};exports[_0xb916('0x1a')]=function(_0x11f8ee){return request(_0xb916('0x1b'),{'options':{'where':{'id':_0x11f8ee},'attributes':['id',_0xb916('0xc')]}});};exports[_0xb916('0x1c')]=function(_0x28bd76){return request(_0xb916('0x1d'),{'body':_0x28bd76});};exports['createSquareDetailsReport']=function(_0x21ed21){return request(_0xb916('0x1e'),{'body':_0x21ed21});};exports[_0xb916('0x1f')]=function(_0xf6faf5){return request(_0xb916('0x20'),{'body':_[_0xb916('0x21')](_0xf6faf5,{'project_name':_0xf6faf5[_0xb916('0x22')],'prev_project_name':_0xf6faf5[_0xb916('0x23')]||'','is_subproject':_0xf6faf5[_0xb916('0x23')]?!![]:![],'leaveAt':moment()[_0xb916('0x24')](_0xb916('0x25'))})});};exports[_0xb916('0x26')]=function(_0x139b61){return request(_0xb916('0x27'),{'body':_0x139b61});};exports[_0xb916('0x28')]=function(_0xb99fc5){return request('CreateSquareMessage',{'body':_0xb99fc5});};exports[_0xb916('0x29')]=function(_0x504c47){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x504c47[_0xb916('0x2a')],'ListId':_0x504c47[_0xb916('0x2b')]}}})[_0xb916('0x5')](function(_0x9e2408){if(_0x9e2408){return _0x9e2408;}return request('CreateCmContact',{'body':_0x504c47});});};exports[_0xb916('0x2c')]=function(_0x594bf3){return request(_0xb916('0x2d'),{'options':{'where':{'id':_0x594bf3},'attributes':['name']}});};exports['agentLogin']=function(_0x5df5f2,_0x3752d3){return request(_0xb916('0x2e'),{'body':{'interface':_0x3752d3},'options':{'where':_0x5df5f2}});};exports[_0xb916('0x2f')]=function(_0x467d51,_0x3a2588,_0x5199fa){return request('PauseUser',{'body':{'type':_0x3a2588,'uniqueid':_0x5199fa},'options':{'where':_0x467d51}});};exports[_0xb916('0x30')]=function(_0x457c30){return request(_0xb916('0x31'),{'body':{},'options':{'where':_0x457c30}});};exports[_0xb916('0x32')]=function(_0x182383){return request('LogoutUser',{'body':{},'options':{'where':_0x182383}});}; \ No newline at end of file +var _0xf050=['ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','then','CreateCmContact','getPauseById','LoginUser','agentPause','PauseUser','UnpauseUser','LogoutUser','lodash','util','jayson/promise','client','http','request','error','message','result','catch','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','ShowVoiceQueue','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','ShowInterval','Interval','getSmsAccountById'];(function(_0x203500,_0x349407){var _0x1ef643=function(_0x1d0556){while(--_0x1d0556){_0x203500['push'](_0x203500['shift']());}};_0x1ef643(++_0x349407);}(_0xf050,0x1ea));var _0x0f05=function(_0x542d80,_0x150561){_0x542d80=_0x542d80-0x0;var _0x1f4492=_0xf050[_0x542d80];return _0x1f4492;};'use strict';var BPromise=require('bluebird');var moment=require('moment');var _=require(_0x0f05('0x0'));var util=require(_0x0f05('0x1'));var jayson=require(_0x0f05('0x2'));var client=jayson[_0x0f05('0x3')][_0x0f05('0x4')]({'port':0x2329});function request(_0x231800,_0x54f083){return new BPromise(function(_0x20af1e,_0x298148){return client[_0x0f05('0x5')](_0x231800,_0x54f083)['then'](function(_0x5567f8){if(_0x5567f8[_0x0f05('0x6')]){return _0x298148(_0x5567f8['error'][_0x0f05('0x7')]);}else{return _0x20af1e(_0x5567f8[_0x0f05('0x8')]);}})[_0x0f05('0x9')](function(_0x449d16){return _0x298148(_0x449d16);});});}exports[_0x0f05('0xa')]=function(_0x27b3ad){return request(_0x0f05('0xb'),{'options':{'raw':![],'where':{'name':_0x27b3ad},'attributes':['production']}});};exports[_0x0f05('0xc')]=function(_0x4ed741){return request(_0x0f05('0xd'),{'options':{'raw':![],'where':{'id':_0x4ed741},'include':[{'model':_0x0f05('0xe'),'as':_0x0f05('0xf')}],'attributes':['id',_0x0f05('0x10'),_0x0f05('0x11')]}});};exports[_0x0f05('0x12')]=function(_0x2a373e){return request('ShowSquareProject',{'options':{'where':{'id':_0x2a373e},'attributes':[_0x0f05('0x10')]}});};exports['getVoiceQueueById']=function(_0x9bac4d){return request(_0x0f05('0x13'),{'options':{'where':{'id':_0x9bac4d},'attributes':[_0x0f05('0x10')]}});};exports['getVariableById']=function(_0x26a194){return request(_0x0f05('0x14'),{'options':{'where':{'id':_0x26a194},'attributes':['name']}});};exports[_0x0f05('0x15')]=function(_0x1561d1){return request(_0x0f05('0x16'),{'options':{'where':{'id':_0x1561d1},'attributes':[_0x0f05('0x17')]}});};exports['getUserById']=function(_0x41ded3){return request('ShowUser',{'options':{'where':{'id':_0x41ded3},'attributes':['name']}});};exports[_0x0f05('0x18')]=function(_0x110487){return request(_0x0f05('0x19'),{'options':{'where':{'id':_0x110487},'attributes':[_0x0f05('0x10')]}});};exports[_0x0f05('0x1a')]=function(_0x45ee5d){return request(_0x0f05('0x1b'),{'options':{'where':{'id':_0x45ee5d},'attributes':[_0x0f05('0x1c')]}});};exports['getIntervalById']=function(_0x40ece9){return request(_0x0f05('0x1d'),{'options':{'raw':![],'where':{'id':_0x40ece9},'include':[{'model':_0x0f05('0x1e'),'as':'Intervals'}]}});};exports[_0x0f05('0x1f')]=function(_0x2739b7){return request(_0x0f05('0x20'),{'options':{'where':{'id':_0x2739b7},'attributes':['id',_0x0f05('0x10')]}});};exports[_0x0f05('0x21')]=function(_0x2bcd62){return request(_0x0f05('0x22'),{'body':_0x2bcd62});};exports[_0x0f05('0x23')]=function(_0x582e1d){return request(_0x0f05('0x24'),{'body':_0x582e1d});};exports[_0x0f05('0x25')]=function(_0x5c26d2){return request(_0x0f05('0x26'),{'body':_['merge'](_0x5c26d2,{'project_name':_0x5c26d2[_0x0f05('0x27')],'prev_project_name':_0x5c26d2[_0x0f05('0x28')]||'','is_subproject':_0x5c26d2[_0x0f05('0x28')]?!![]:![],'leaveAt':moment()['format'](_0x0f05('0x29'))})});};exports[_0x0f05('0x2a')]=function(_0x282358){return request(_0x0f05('0x2b'),{'body':_0x282358});};exports[_0x0f05('0x2c')]=function(_0x36b569){return request(_0x0f05('0x2d'),{'body':_0x36b569});};exports[_0x0f05('0x2e')]=function(_0x450625){return request(_0x0f05('0x2f'),{'options':{'raw':![],'where':{'phone':_0x450625[_0x0f05('0x30')],'ListId':_0x450625[_0x0f05('0x31')]}}})[_0x0f05('0x32')](function(_0x728138){if(_0x728138){return _0x728138;}return request(_0x0f05('0x33'),{'body':_0x450625});});};exports[_0x0f05('0x34')]=function(_0x374cab){return request('ShowPause',{'options':{'where':{'id':_0x374cab},'attributes':['name']}});};exports['agentLogin']=function(_0x42b6ad,_0x3479de){return request(_0x0f05('0x35'),{'body':{'interface':_0x3479de},'options':{'where':_0x42b6ad}});};exports[_0x0f05('0x36')]=function(_0x184dfe,_0xeec946,_0x163b54){return request(_0x0f05('0x37'),{'body':{'type':_0xeec946,'uniqueid':_0x163b54},'options':{'where':_0x184dfe}});};exports['agentUnpause']=function(_0x5104cc){return request(_0x0f05('0x38'),{'body':{},'options':{'where':_0x5104cc}});};exports['agentLogout']=function(_0x30edb3){return request(_0x0f05('0x39'),{'body':{},'options':{'where':_0x30edb3}});}; \ 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 4226624..74af186 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 _0x5655=['./lex','exports','./polly'];(function(_0x427784,_0x357d9f){var _0x11985b=function(_0x173896){while(--_0x173896){_0x427784['push'](_0x427784['shift']());}};_0x11985b(++_0x357d9f);}(_0x5655,0x15e));var _0x5565=function(_0x3d0a36,_0x12a318){_0x3d0a36=_0x3d0a36-0x0;var _0x286e5b=_0x5655[_0x3d0a36];return _0x286e5b;};var polly=require(_0x5565('0x0'));var lex=require(_0x5565('0x1'));module[_0x5565('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xf52f=['./lex','exports','./polly'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xf52f,0x113));var _0xff52=function(_0x31bc48,_0x18759e){_0x31bc48=_0x31bc48-0x0;var _0x3abd4a=_0xf52f[_0x31bc48];return _0x3abd4a;};var polly=require(_0xff52('0x0'));var lex=require(_0xff52('0x1'));module[_0xff52('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 425ed33..2ff1556 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 _0x750a=['exports'];(function(_0x56af11,_0x452744){var _0x3ded02=function(_0x134220){while(--_0x134220){_0x56af11['push'](_0x56af11['shift']());}};_0x3ded02(++_0x452744);}(_0x750a,0x140));var _0xa750=function(_0x2ae584,_0xd4b7e8){_0x2ae584=_0x2ae584-0x0;var _0x11e670=_0x750a[_0x2ae584];return _0x11e670;};'use strict';var lex=require('./lib/api');module[_0xa750('0x0')]=function(_0x5368b2,_0x499583,_0x139fa5,_0xeb020d,_0x1b459c,_0x19bd5f){return lex(_0x5368b2,_0x499583,_0x139fa5,_0xeb020d,_0x1b459c,_0x19bd5f);}; \ No newline at end of file +var _0xa9e0=['exports','./lib/api'];(function(_0x962fc5,_0x58f074){var _0x43667c=function(_0x5e6ec0){while(--_0x5e6ec0){_0x962fc5['push'](_0x962fc5['shift']());}};_0x43667c(++_0x58f074);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var lex=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]=function(_0x29929c,_0x5dd881,_0x550fbc,_0x18d5c9,_0x4ce2f1,_0x333808){return lex(_0x29929c,_0x5dd881,_0x550fbc,_0x18d5c9,_0x4ce2f1,_0x333808);}; \ 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 4fda657..39a3df3 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(_0x131c95,_0x3f33fb){var _0x81b062=function(_0x9b97fd){while(--_0x9b97fd){_0x131c95['push'](_0x131c95['shift']());}};_0x81b062(++_0x3f33fb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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(_0x223649,_0x18832f){var _0x426eec=function(_0x26b532){while(--_0x26b532){_0x223649['push'](_0x223649['shift']());}};_0x426eec(++_0x18832f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/polly/index.js b/server/services/agi/scripts/aws/polly/index.js index b536f14..02f3c21 100644 --- a/server/services/agi/scripts/aws/polly/index.js +++ b/server/services/agi/scripts/aws/polly/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x32eb=['exports'];(function(_0x4d4f18,_0x43608b){var _0x5b283f=function(_0x165efe){while(--_0x165efe){_0x4d4f18['push'](_0x4d4f18['shift']());}};_0x5b283f(++_0x43608b);}(_0x32eb,0x97));var _0xb32e=function(_0x79a6e8,_0x1c2b24){_0x79a6e8=_0x79a6e8-0x0;var _0xeeb993=_0x32eb[_0x79a6e8];return _0xeeb993;};'use strict';var polly=require('./lib/api');module[_0xb32e('0x0')]=function(_0x3da4dc,_0x412494,_0x2b97c5,_0x5314a7,_0xada3ae,_0x32d8d3,_0x54448d){return polly(_0x3da4dc,_0x412494,_0x2b97c5,_0x5314a7,_0xada3ae,_0x32d8d3,_0x54448d);}; \ No newline at end of file +var _0xa1e8=['./lib/api','exports'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xa1e8,0xec));var _0x8a1e=function(_0x32cd54,_0x3db807){_0x32cd54=_0x32cd54-0x0;var _0x2108d7=_0xa1e8[_0x32cd54];return _0x2108d7;};'use strict';var polly=require(_0x8a1e('0x0'));module[_0x8a1e('0x1')]=function(_0x3cdd78,_0x463f47,_0x254819,_0x3d4ac8,_0x3b9b4d,_0x93960a,_0x294253){return polly(_0x3cdd78,_0x463f47,_0x254819,_0x3d4ac8,_0x3b9b4d,_0x93960a,_0x294253);}; \ 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 c8e36d4..0b349ef 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 _0x1401=['randomstring','synthesizeSpeech','AudioStream','writeFile','exports','Polly','text','bluebird'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x1401,0x16f));var _0x1140=function(_0x1c3aa3,_0x38a01a){_0x1c3aa3=_0x1c3aa3-0x0;var _0x5252dc=_0x1401[_0x1c3aa3];return _0x5252dc;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x1140('0x0'));var rs=require(_0x1140('0x1'));var AWS=require('aws-sdk');function pollyResult(_0x20d702,_0x400068,_0x336e8c){return new BPromise(function(_0xbe8ab0,_0x45b5e6){_0x20d702[_0x1140('0x2')](_0x400068,function(_0x466137,_0x34945d){if(_0x466137){_0x45b5e6(_0x466137);}else if(_0x34945d){if(_0x34945d[_0x1140('0x3')]instanceof Buffer){fs[_0x1140('0x4')](_0x336e8c,_0x34945d[_0x1140('0x3')],function(_0x365aaf){if(_0x365aaf){_0x45b5e6(_0x365aaf);}else{_0xbe8ab0();}});}else{_0x45b5e6(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x45b5e6(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x1140('0x5')]=function(_0x2ea29a,_0x3a5ed7,_0xaf606,_0x47e171,_0x2c81ba,_0x44c73f,_0x34b73){var _0x11dd75=new AWS[(_0x1140('0x6'))]({'accessKeyId':_0x2ea29a,'secretAccessKey':_0x3a5ed7,'region':_0xaf606});var _0x178402={'Text':_0x2c81ba,'TextType':_0x44c73f||_0x1140('0x7'),'OutputFormat':'mp3','VoiceId':_0x47e171};return pollyResult(_0x11dd75,_0x178402,_0x34b73);}; \ No newline at end of file +var _0x72cc=['writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream'];(function(_0xc5d16d,_0x1bdef3){var _0x5a1e52=function(_0x3c2aee){while(--_0x3c2aee){_0xc5d16d['push'](_0xc5d16d['shift']());}};_0x5a1e52(++_0x1bdef3);}(_0x72cc,0x123));var _0xc72c=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x72cc[_0x42245d];return _0x4b211a;};'use strict';var fs=require('fs');var path=require(_0xc72c('0x0'));var BPromise=require(_0xc72c('0x1'));var rs=require(_0xc72c('0x2'));var AWS=require(_0xc72c('0x3'));function pollyResult(_0x23a673,_0x5b24f3,_0x1c4799){return new BPromise(function(_0x314c10,_0x18ef0c){_0x23a673[_0xc72c('0x4')](_0x5b24f3,function(_0x215b09,_0x5ca1c9){if(_0x215b09){_0x18ef0c(_0x215b09);}else if(_0x5ca1c9){if(_0x5ca1c9[_0xc72c('0x5')]instanceof Buffer){fs[_0xc72c('0x6')](_0x1c4799,_0x5ca1c9[_0xc72c('0x5')],function(_0x8014bb){if(_0x8014bb){_0x18ef0c(_0x8014bb);}else{_0x314c10();}});}else{_0x18ef0c(new Error(_0xc72c('0x7')));}}else{_0x18ef0c(new Error(_0xc72c('0x8')));}});});}module[_0xc72c('0x9')]=function(_0x2b35b0,_0x2140fb,_0x1c5bde,_0x128d83,_0x54c3d8,_0x1abdad,_0x3c7ea3){var _0x188c6c=new AWS['Polly']({'accessKeyId':_0x2b35b0,'secretAccessKey':_0x2140fb,'region':_0x1c5bde});var _0xbed119={'Text':_0x54c3d8,'TextType':_0x1abdad||'text','OutputFormat':_0xc72c('0xa'),'VoiceId':_0x128d83};return pollyResult(_0x188c6c,_0xbed119,_0x3c7ea3);}; \ 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 cbb2831..b210b76 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 _0x67fe=['./lib/api','exports'];(function(_0x45b649,_0x4ab854){var _0x117a8e=function(_0x566ce8){while(--_0x566ce8){_0x45b649['push'](_0x45b649['shift']());}};_0x117a8e(++_0x4ab854);}(_0x67fe,0x172));var _0xe67f=function(_0x5b2d6c,_0x3519d3){_0x5b2d6c=_0x5b2d6c-0x0;var _0x25ef43=_0x67fe[_0x5b2d6c];return _0x25ef43;};'use strict';var asr=require(_0xe67f('0x0'));module[_0xe67f('0x1')]=function(_0x1e67b6,_0x410f64,_0x3d7226,_0x3d544a){return asr(_0x1e67b6,_0x410f64,_0x3d7226);}; \ No newline at end of file +var _0x8ce5=['./lib/api','exports'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x8ce5,0x158));var _0x58ce=function(_0x23602a,_0x515a2a){_0x23602a=_0x23602a-0x0;var _0x5023ae=_0x8ce5[_0x23602a];return _0x5023ae;};'use strict';var asr=require(_0x58ce('0x0'));module[_0x58ce('0x1')]=function(_0x204926,_0x36fd72,_0x204868,_0x45acac){return asr(_0x204926,_0x36fd72,_0x204868);}; \ 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 817b805..16ba88f 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 _0x9f62=['string','length','key\x20should\x20be\x20a\x20string','undefined','base64','LINEAR16','8000','bluebird','exports'];(function(_0xc47b52,_0x447123){var _0x3e3696=function(_0xf07b28){while(--_0xf07b28){_0xc47b52['push'](_0xc47b52['shift']());}};_0x3e3696(++_0x447123);}(_0x9f62,0x154));var _0x29f6=function(_0x3b437d,_0x1ed52a){_0x3b437d=_0x3b437d-0x0;var _0x142128=_0x9f62[_0x3b437d];return _0x142128;};'use strict';var url=require('url');var BPromise=require(_0x29f6('0x0'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0x29f6('0x1')]=function(_0x254ab3,_0x548050,_0x5618b7){return new BPromise(function(_0x54d164,_0x258ddd){var _0x2f0420;if(typeof _0x254ab3!==_0x29f6('0x2')||_0x254ab3[_0x29f6('0x3')]===0x0){return _0x258ddd('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x548050!==_0x29f6('0x2')||_0x548050[_0x29f6('0x3')]===0x0){return _0x258ddd(_0x29f6('0x4'));}if(typeof _0x5618b7!==_0x29f6('0x5')&&(typeof _0x5618b7!==_0x29f6('0x2')||_0x5618b7['length']===0x0)){return _0x258ddd('lang\x20should\x20be\x20a\x20string');}try{_0x2f0420=fs['readFileSync'](_0x254ab3)['toString'](_0x29f6('0x6'));}catch(_0x44db16){return _0x258ddd(_0x44db16);}return _0x54d164({'method':'POST','uri':host+'/v1/speech:recognize?key='+_0x548050,'body':{'config':{'encoding':_0x29f6('0x7'),'sampleRateHertz':_0x29f6('0x8'),'languageCode':_0x5618b7},'audio':{'content':_0x2f0420}},'json':!![]});});}; \ No newline at end of file +var _0x6b19=['exports','string','filepath\x20should\x20be\x20a\x20string','length','lang\x20should\x20be\x20a\x20string','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird'];(function(_0x71cd05,_0x36ac11){var _0x59c9e7=function(_0x5472cd){while(--_0x5472cd){_0x71cd05['push'](_0x71cd05['shift']());}};_0x59c9e7(++_0x36ac11);}(_0x6b19,0xe8));var _0x96b1=function(_0x3a1afb,_0x3a9ae8){_0x3a1afb=_0x3a1afb-0x0;var _0x3f7a45=_0x6b19[_0x3a1afb];return _0x3f7a45;};'use strict';var url=require(_0x96b1('0x0'));var BPromise=require(_0x96b1('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0x96b1('0x2')]=function(_0x582556,_0x573f03,_0x2cf16d){return new BPromise(function(_0x408fae,_0x1a104c){var _0x31332a;if(typeof _0x582556!==_0x96b1('0x3')||_0x582556['length']===0x0){return _0x1a104c(_0x96b1('0x4'));}if(typeof _0x573f03!=='string'||_0x573f03[_0x96b1('0x5')]===0x0){return _0x1a104c('key\x20should\x20be\x20a\x20string');}if(typeof _0x2cf16d!=='undefined'&&(typeof _0x2cf16d!==_0x96b1('0x3')||_0x2cf16d['length']===0x0)){return _0x1a104c(_0x96b1('0x6'));}try{_0x31332a=fs['readFileSync'](_0x582556)[_0x96b1('0x7')](_0x96b1('0x8'));}catch(_0x366a60){return _0x1a104c(_0x366a60);}return _0x408fae({'method':_0x96b1('0x9'),'uri':host+_0x96b1('0xa')+_0x573f03,'body':{'config':{'encoding':_0x96b1('0xb'),'sampleRateHertz':_0x96b1('0xc'),'languageCode':_0x2cf16d},'audio':{'content':_0x31332a}},'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 5744a1e..7957f83 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 _0xf6df=['./asr','exports'];(function(_0x431c5b,_0x103781){var _0x3b50b5=function(_0x4b71a2){while(--_0x4b71a2){_0x431c5b['push'](_0x431c5b['shift']());}};_0x3b50b5(++_0x103781);}(_0xf6df,0x1c0));var _0xff6d=function(_0x3c1f99,_0x577f8a){_0x3c1f99=_0x3c1f99-0x0;var _0x503774=_0xf6df[_0x3c1f99];return _0x503774;};var asr=require(_0xff6d('0x0'));module[_0xff6d('0x1')]={'asr':asr}; \ No newline at end of file +var _0x2603=['./asr','exports'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x2603,0x15c));var _0x3260=function(_0x338391,_0x4d5e84){_0x338391=_0x338391-0x0;var _0x363e1c=_0x2603[_0x338391];return _0x363e1c;};var asr=require(_0x3260('0x0'));module[_0x3260('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 3ca4b27..f9287ce 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 _0xa4d3=['model=%s','freeform=3','sestekNDA','nda','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','bluebird','http','https','querystring','request-promise','google-tts-api','url','parse','util','./aws','./google','./tilde','agi','https://api.ispeech.org/api/rest','protocol','https:','host','error','statusMessage','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','path','WHAT_EVER','get','statusCode','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','.wav','base64','chmodSync','777','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','input','MP3','text:synthesize','POST','then','generate','.mp3','from','audioContent','writeFile','split','utf8','f.req=','jQ1olc','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','writeFileSync','googleASR','asr','uri','results','alternatives','transcript','join','map','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','textRequest','source','result','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','Dialogflow\x20V2\x20response:','stringify','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','languageCode','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','awsPolly','awsLex','lex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s'];(function(_0x4150e6,_0x345b50){var _0x1a039d=function(_0x3bf8cb){while(--_0x3bf8cb){_0x4150e6['push'](_0x4150e6['shift']());}};_0x1a039d(++_0x345b50);}(_0xa4d3,0x11b));var _0x3a4d=function(_0x23813b,_0x55f947){_0x23813b=_0x23813b-0x0;var _0x318a80=_0xa4d3[_0x23813b];return _0x318a80;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0x3a4d('0x0'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x3a4d('0x1'));var https=require(_0x3a4d('0x2'));var md5=require('md5');var path=require('path');var querystring=require(_0x3a4d('0x3'));var rp=require(_0x3a4d('0x4'));var rs=require('randomstring');var sox=require('sox');var tts=require(_0x3a4d('0x5'));var urlParse=require(_0x3a4d('0x6'))[_0x3a4d('0x7')];var util=require(_0x3a4d('0x8'));var aws=require(_0x3a4d('0x9'));var google=require(_0x3a4d('0xa'));var sestek=require('./sestek');var tilde=require(_0x3a4d('0xb'));var logger=require('../../../config/logger')(_0x3a4d('0xc'));var ISPEECH_API=_0x3a4d('0xd');function downloadFile(_0x28895e,_0x3f2810){return new BPromise(function(_0x4444df,_0x54dc77){var _0x392972=urlParse(_0x28895e);var _0x24fca5=_0x392972[_0x3a4d('0xe')]===_0x3a4d('0xf')?https:http;var _0x78b384={'host':_0x392972[_0x3a4d('0x10')],'path':_0x392972['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x24fca5['get'](_0x78b384,function(_0x5cc7e6){if(_0x5cc7e6['statusCode']!==0xc8){logger[_0x3a4d('0x11')]('request\x20to\x20'+_0x28895e+'\x20failed,\x20status\x20code\x20=\x20'+_0x5cc7e6['statusCode']+'\x20('+_0x5cc7e6[_0x3a4d('0x12')]+')');_0x54dc77(new Error(_0x3a4d('0x13')+_0x28895e+_0x3a4d('0x14')+_0x5cc7e6['statusCode']+'\x20('+_0x5cc7e6[_0x3a4d('0x12')]+')'));return;}var _0x6d831b=fs[_0x3a4d('0x15')](_0x3f2810);_0x6d831b['on'](_0x3a4d('0x16'),function(){logger[_0x3a4d('0x17')](_0x3a4d('0x18'));_0x6d831b[_0x3a4d('0x19')](_0x4444df);});_0x6d831b['on']('error',function(_0x2d6402){fs[_0x3a4d('0x1a')](_0x3f2810);logger['error'](_0x3a4d('0x1b'),_0x2d6402);_0x54dc77(_0x2d6402);});_0x5cc7e6[_0x3a4d('0x1c')](_0x6d831b);})['on'](_0x3a4d('0x11'),function(_0x4f7bb7){logger[_0x3a4d('0x11')](_0x4f7bb7);_0x54dc77(_0x4f7bb7);})[_0x3a4d('0x1d')]();});}function uploadFile(_0x174f33){return new BPromise(function(_0x3a2ae5,_0x4e2beb){var _0x361a04=urlParse(_0x174f33);var _0x5991d4=_0x361a04[_0x3a4d('0xe')]==='https:'?https:http;var _0x2bcaaf={'host':_0x361a04[_0x3a4d('0x10')],'path':_0x361a04[_0x3a4d('0x1e')],'headers':{'user-agent':_0x3a4d('0x1f')}};_0x5991d4[_0x3a4d('0x20')](_0x2bcaaf,function(_0x11952d){if(_0x11952d[_0x3a4d('0x21')]!==0xc8){_0x4e2beb(new Error(_0x3a4d('0x13')+_0x174f33+_0x3a4d('0x14')+_0x11952d[_0x3a4d('0x21')]+'\x20('+_0x11952d[_0x3a4d('0x12')]+')'));return;}var _0x3e2130='';_0x11952d['on'](_0x3a4d('0x22'),function(_0x4e6e2c){_0x3e2130+=_0x4e6e2c;});_0x11952d['on'](_0x3a4d('0x1d'),function(){_0x3a2ae5(_0x3e2130);});})['on'](_0x3a4d('0x11'),function(_0x29ba43){_0x4e2beb(_0x29ba43);})['end']();});}function convertFile(_0xc04998,_0x9a2f63){return new BPromise(function(_0x2015e0,_0x12e9bb){var _0x15dc4a=sox[_0x3a4d('0x23')](_0xc04998,_0x9a2f63,{'sampleRate':0x1f40,'format':_0x3a4d('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x15dc4a['on'](_0x3a4d('0x11'),function(_0x92d40b){logger[_0x3a4d('0x11')](_0x3a4d('0x25'),_0x92d40b);_0x12e9bb(_0x92d40b);});_0x15dc4a['on'](_0x3a4d('0x1d'),function(){logger[_0x3a4d('0x17')](_0x3a4d('0x26'));_0x2015e0();});_0x15dc4a[_0x3a4d('0x27')]();});}function base64Decode(_0x4d54c1,_0x4959fb){var _0x2fd486=path[_0x3a4d('0x28')](__dirname,_0x3a4d('0x29'),rs['generate'](0x4)+_0x3a4d('0x2a'));fs['writeFileSync'](_0x2fd486,_0x4d54c1,_0x3a4d('0x2b'));return convertFile(_0x2fd486,_0x4959fb)['then'](function(){try{fs[_0x3a4d('0x1a')](_0x2fd486);fs[_0x3a4d('0x2c')](_0x4959fb,_0x3a4d('0x2d'));}catch(_0x99b81f){logger['error'](_0x99b81f);}return _0x4959fb['split']('.')[0x0];});}function base64Encode(_0x298ba5){var _0x5b7c3f=fs[_0x3a4d('0x2e')](_0x298ba5);return new Buffer(_0x5b7c3f)[_0x3a4d('0x2f')](_0x3a4d('0x2b'));}exports[_0x3a4d('0x30')]=function(_0x4327b0,_0x5bf85a,_0x1bc8a3,_0x4526ae,_0x2d0501,_0x4ca923){var _0x1ec0eb,_0x421411;var _0x507257=_0x3a4d('0x31');var _0x357d66='?key='+_0x4327b0;var _0x4ae0b9={};if(_0x5bf85a==='ssml'){_0x4ae0b9[_0x3a4d('0x32')]={'ssml':_0x1bc8a3};}else{_0x4ae0b9[_0x3a4d('0x32')]={'text':_0x1bc8a3};};_0x4ae0b9['voice']={'languageCode':_0x4526ae,'ssmlGender':_0x2d0501};_0x4ae0b9['audioConfig']={'audioEncoding':_0x3a4d('0x33'),'sampleRateHertz':0x1f40};var _0x296213={'url':_0x507257+_0x3a4d('0x34')+_0x357d66,'method':_0x3a4d('0x35'),'json':!![],'body':_0x4ae0b9};return rp(_0x296213)[_0x3a4d('0x36')](function(_0x5a5205){return new BPromise(function(_0x49bc27,_0x4c5051){_0x1ec0eb=path[_0x3a4d('0x28')](__dirname,_0x3a4d('0x29'),rs[_0x3a4d('0x37')](0x4)+_0x3a4d('0x38'));var _0x1831ff=Buffer[_0x3a4d('0x39')](_0x5a5205[_0x3a4d('0x3a')],_0x3a4d('0x2b'));return fs[_0x3a4d('0x3b')](_0x1ec0eb,_0x1831ff,function(_0x14ccd4){_0x4c5051(_0x14ccd4);},function(_0x1b7589){fs[_0x3a4d('0x2c')](_0x1ec0eb,_0x3a4d('0x2d'));_0x49bc27(_0x1b7589);});});})['then'](function(_0x350e40){_0x421411=path[_0x3a4d('0x28')](__dirname,'tmp',rs[_0x3a4d('0x37')](0x4)+_0x3a4d('0x2a'));return convertFile(_0x1ec0eb,_0x421411);})['then'](function(){try{fs[_0x3a4d('0x1a')](_0x1ec0eb);fs[_0x3a4d('0x2c')](_0x421411,_0x3a4d('0x2d'));}catch(_0x59fd8b){logger[_0x3a4d('0x11')](_0x59fd8b);}logger[_0x3a4d('0x17')]('googleCloudTTS\x20path',_0x421411['split']('.')[0x0]);return _0x421411[_0x3a4d('0x3c')]('.')[0x0];});};exports['googleTTS']=function(_0x138afc,_0x560d1f){var _0x549c80='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x52a26b,_0x276640;var _0x4dc7a0;var _0x29e04d={'encoding':_0x3a4d('0x3d'),'method':_0x3a4d('0x35'),'timeout':0x2710,'url':_0x549c80,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0x3a4d('0x3e')+encodeURIComponent(JSON['stringify']([[[_0x3a4d('0x3f'),JSON['stringify']([_0x138afc,_0x560d1f||'en',![],'null']),null,_0x3a4d('0x40')]]]))};return rp(_0x29e04d)['then'](function(_0x5ae8e9){try{_0x4dc7a0=eval(_0x5ae8e9[_0x3a4d('0x41')](0x5))[0x0][0x2];}catch(_0x44a328){throw new Error(_0x3a4d('0x42')+_0x5ae8e9['data']);}if(!_0x4dc7a0){if(_0x138afc[_0x3a4d('0x43')]>0xc8){throw new Error(_0x3a4d('0x44'));}else{throw new Error('lang\x20\x22'+_0x560d1f+_0x3a4d('0x45'));}}try{_0x4dc7a0=eval(_0x4dc7a0)[0x0];}catch(_0x36f902){throw new Error(_0x3a4d('0x42')+res[_0x3a4d('0x22')]);}const _0x51a7a4=_0x4dc7a0;_0x52a26b=path[_0x3a4d('0x28')](__dirname,_0x3a4d('0x29'),rs[_0x3a4d('0x37')](0x4)+'.mp3');fs[_0x3a4d('0x46')](_0x52a26b,_0x4dc7a0,{'encoding':_0x3a4d('0x2b')});_0x276640=path[_0x3a4d('0x28')](__dirname,_0x3a4d('0x29'),rs[_0x3a4d('0x37')](0x4)+_0x3a4d('0x2a'));return convertFile(_0x52a26b,_0x276640);})['then'](function(){try{fs[_0x3a4d('0x1a')](_0x52a26b);fs[_0x3a4d('0x2c')](_0x276640,'777');}catch(_0x237f18){logger[_0x3a4d('0x11')](_0x237f18);}logger[_0x3a4d('0x17')]('goggleTTS\x20path',_0x276640[_0x3a4d('0x3c')]('.')[0x0]);return _0x276640[_0x3a4d('0x3c')]('.')[0x0];});};exports[_0x3a4d('0x47')]=function(_0x20c19f,_0x1b4739,_0xb6d8b0){return google[_0x3a4d('0x48')](_0x20c19f,_0x1b4739,_0xb6d8b0)[_0x3a4d('0x36')](function(_0x54ff05){logger['info'](_0x54ff05[_0x3a4d('0x49')]);return rp(_0x54ff05);})[_0x3a4d('0x36')](function(_0x57974e){var _0x33a0d3='';var _0x1afa28=0x0;try{fs[_0x3a4d('0x1a')](_0x20c19f);}catch(_0x303571){logger['error'](_0x303571);}if(_0x57974e&&_0x57974e[_0x3a4d('0x4a')]){_0x33a0d3=_0x57974e[_0x3a4d('0x4a')]['map'](function(_0x46ed85){return _0x46ed85&&_0x46ed85[_0x3a4d('0x4b')][0x0]&&_0x46ed85[_0x3a4d('0x4b')][0x0][_0x3a4d('0x4c')]?_0x46ed85[_0x3a4d('0x4b')][0x0]['transcript']:'';})[_0x3a4d('0x4d')]('\x0a');_0x1afa28=_0x57974e['results'][_0x3a4d('0x4e')](function(_0xa956c2){return _0xa956c2&&_0xa956c2[_0x3a4d('0x4b')][0x0]&&_0xa956c2[_0x3a4d('0x4b')][0x0][_0x3a4d('0x4f')]?_0xa956c2['alternatives'][0x0][_0x3a4d('0x4f')]:0x0;})[_0x3a4d('0x4d')]('\x0a');}logger['info'](_0x3a4d('0x50'),_0x33a0d3);logger[_0x3a4d('0x17')](_0x3a4d('0x51'),_0x1afa28);return{'transcript':_0x33a0d3,'confidence':_0x1afa28};})[_0x3a4d('0x52')](function(_0x2a299c){logger[_0x3a4d('0x11')](_0x3a4d('0x53'),_0x2a299c[_0x3a4d('0x21')],_0x2a299c[_0x3a4d('0x54')],_0x2a299c[_0x3a4d('0x55')]);});};exports['googleDialogflow']=function(_0x43d2b6,_0x591989,_0x5f12f2,_0x5dd794){var _0x22e47b=apiai(_0x591989,{'language':_0x5dd794||'en'});return _0x22e47b[_0x3a4d('0x56')](_0x5f12f2,{'sessionId':md5(_0x43d2b6)})['then'](function(_0x115a06){logger[_0x3a4d('0x17')](JSON['stringify'](_0x115a06));return{'source':_0x115a06['result'][_0x3a4d('0x57')],'resolvedQuery':_0x115a06[_0x3a4d('0x58')]['resolvedQuery'],'action':_0x115a06['result'][_0x3a4d('0x59')],'actionIncomplete':_0x115a06['result'][_0x3a4d('0x5a')],'speech':_0x115a06[_0x3a4d('0x58')][_0x3a4d('0x5b')][_0x3a4d('0x5c')],'score':_0x115a06[_0x3a4d('0x58')][_0x3a4d('0x5d')],'statusCode':_0x115a06[_0x3a4d('0x5e')][_0x3a4d('0x5f')],'endConversation':_0x115a06[_0x3a4d('0x58')][_0x3a4d('0x60')][_0x3a4d('0x61')]||![],'isFallbackIntent':_0x115a06[_0x3a4d('0x58')][_0x3a4d('0x60')][_0x3a4d('0x62')]};});};exports[_0x3a4d('0x63')]=function(_0x3ddb9d,_0xb5f7a6,_0x4e9839,_0x371daf,_0x3a0cbe,_0x455c37){var _0x4ee759=_0x371daf[_0x3a4d('0x64')](/\\n/g,'\x0a');var _0x2d8633={'credentials':{'private_key':_0x4ee759,'client_email':_0x4e9839}};var _0x3c1ed9=new dialogflow[(_0x3a4d('0x65'))](_0x2d8633);var _0x4d8f17=_0x3c1ed9[_0x3a4d('0x66')](_0xb5f7a6,md5(_0x3ddb9d));var _0x345709={'session':_0x4d8f17,'queryInput':{'text':{'text':_0x3a0cbe,'languageCode':_0x455c37}}};return _0x3c1ed9['detectIntent'](_0x345709)[_0x3a4d('0x36')](function(_0x57f5ba){if(_0x57f5ba&&_0x57f5ba['length']){logger['info'](_0x3a4d('0x67'),JSON[_0x3a4d('0x68')](_0x57f5ba));var _0x3c7159=_0x57f5ba[0x0];if(_0x3c7159){var _0x543849={'action':_0x3c7159[_0x3a4d('0x69')][_0x3a4d('0x59')],'allRequiredParamsPresent':_0x3c7159[_0x3a4d('0x69')][_0x3a4d('0x6a')],'endConversation':_0x3c7159[_0x3a4d('0x69')][_0x3a4d('0x6b')]&&_0x3c7159[_0x3a4d('0x69')]['diagnosticInfo'][_0x3a4d('0x6c')]?_0x3c7159['queryResult'][_0x3a4d('0x6b')][_0x3a4d('0x6c')][_0x3a4d('0x6d')][_0x3a4d('0x6e')]:![],'fulfillmentText':_0x3c7159[_0x3a4d('0x69')][_0x3a4d('0x6f')],'intentName':_0x3c7159['queryResult'][_0x3a4d('0x70')][_0x3a4d('0x54')],'intentDisplayName':_0x3c7159[_0x3a4d('0x69')][_0x3a4d('0x70')]['displayName'],'isFallbackIntent':_0x3c7159[_0x3a4d('0x69')][_0x3a4d('0x70')]['isFallback'],'languageCode':_0x3c7159[_0x3a4d('0x69')][_0x3a4d('0x71')],'queryText':_0x3c7159[_0x3a4d('0x69')]['queryText'],'responseId':_0x3c7159[_0x3a4d('0x72')],'score':_0x3c7159[_0x3a4d('0x69')][_0x3a4d('0x73')],'speech':_0x3c7159[_0x3a4d('0x69')][_0x3a4d('0x6f')],'providerResponse':JSON[_0x3a4d('0x68')](_0x57f5ba)};return _0x543849;}}});};exports[_0x3a4d('0x74')]=function(_0x43a55d,_0x19a1a4,_0x3b1b5b,_0x2c9fcf){return tilde[_0x3a4d('0x48')](_0x43a55d,_0x19a1a4,_0x3b1b5b,_0x2c9fcf)[_0x3a4d('0x36')](function(_0x2c1f28){try{fs[_0x3a4d('0x1a')](_0x43a55d);}catch(_0x121139){logger[_0x3a4d('0x11')](_0x121139);}logger[_0x3a4d('0x17')](_0x3a4d('0x75'),_0x2c1f28[_0x3a4d('0x4c')]);logger[_0x3a4d('0x17')]('Tilde\x20ASR\x20confidence',_0x2c1f28[_0x3a4d('0x4f')]);return _0x2c1f28;});};exports[_0x3a4d('0x76')]=function(_0x46503e,_0x43ba0d,_0x51ad57,_0x11425a,_0x15624e,_0x155abf){var _0x3b57e2=path[_0x3a4d('0x28')](__dirname,_0x3a4d('0x29'),rs[_0x3a4d('0x37')](0x4)+_0x3a4d('0x38'));var _0x4e2677;return aws['polly'](_0x46503e,_0x43ba0d,_0x51ad57,_0x11425a,_0x15624e,_0x155abf,_0x3b57e2)[_0x3a4d('0x36')](function(){_0x4e2677=path[_0x3a4d('0x28')](__dirname,_0x3a4d('0x29'),rs[_0x3a4d('0x37')](0x4)+'.wav');return convertFile(_0x3b57e2,_0x4e2677);})[_0x3a4d('0x36')](function(){try{fs[_0x3a4d('0x1a')](_0x3b57e2);fs[_0x3a4d('0x2c')](_0x4e2677,_0x3a4d('0x2d'));}catch(_0x4c83a1){logger[_0x3a4d('0x11')](_0x4c83a1);}return _0x4e2677[_0x3a4d('0x3c')]('.')[0x0];});};exports[_0x3a4d('0x77')]=function(_0x80dec6,_0xe75cbc,_0x42ee02,_0x50e473,_0xe8847c,_0x8f5bf){return aws[_0x3a4d('0x78')](_0x80dec6,_0xe75cbc,_0x42ee02,_0x50e473,_0xe8847c,_0x8f5bf)['then'](function(_0x254b8a){logger[_0x3a4d('0x17')](JSON[_0x3a4d('0x68')](_0x254b8a));return _0x254b8a;});};exports['ispeechTTS']=function(_0xdba5c6,_0x1b5d2,_0x3e5771,_0x318971){var _0x1ea4ef=util[_0x3a4d('0x79')](_0x3a4d('0x7a'),ISPEECH_API,_0xdba5c6,encodeURIComponent(_0x1b5d2),_0x3e5771,_0x318971);var _0x34fac2=path['resolve'](__dirname,'tmp',rs[_0x3a4d('0x37')](0x4)+'.mp3');var _0x935f8d;return downloadFile(_0x1ea4ef,_0x34fac2)[_0x3a4d('0x36')](function(){_0x935f8d=path[_0x3a4d('0x28')](__dirname,'tmp',rs[_0x3a4d('0x37')](0x4)+_0x3a4d('0x2a'));return convertFile(_0x34fac2,_0x935f8d);})[_0x3a4d('0x36')](function(){try{fs[_0x3a4d('0x1a')](_0x34fac2);fs[_0x3a4d('0x2c')](_0x935f8d,'777');}catch(_0x53a315){logger[_0x3a4d('0x11')](_0x53a315);}return _0x935f8d[_0x3a4d('0x3c')]('.')[0x0];});};exports[_0x3a4d('0x7b')]=function(_0x1a377e,_0x5459e1,_0x270324,_0x2b6100){var _0xa0255e=util[_0x3a4d('0x79')](_0x3a4d('0x7c'),ISPEECH_API,_0x5459e1,_0x270324,base64Encode(_0x1a377e),_0x2b6100?util[_0x3a4d('0x79')](_0x3a4d('0x7d'),encodeURIComponent(_0x2b6100)):_0x3a4d('0x7e'));return uploadFile(_0xa0255e)['then'](function(_0x2d89b8){return querystring[_0x3a4d('0x7')](_0x2d89b8);});};exports[_0x3a4d('0x7f')]=function(_0x229de8,_0x53af45){return sestek[_0x3a4d('0x80')](_0x229de8,_0x53af45)[_0x3a4d('0x36')](function(_0xfd1141){logger[_0x3a4d('0x17')](JSON[_0x3a4d('0x68')](_0xfd1141));var _0x5ae160={'speech':_0xfd1141['text'],'action':_0xfd1141[_0x3a4d('0x81')]?_0xfd1141[_0x3a4d('0x81')][_0x3a4d('0x82')]:undefined,'actiondata':_0xfd1141[_0x3a4d('0x81')]?_0xfd1141[_0x3a4d('0x81')][_0x3a4d('0x83')]:undefined};if(_0xfd1141[_0x3a4d('0x81')]&&_0xfd1141['channelData'][_0x3a4d('0x84')]){return base64Decode(_0xfd1141[_0x3a4d('0x81')][_0x3a4d('0x84')][_0x3a4d('0x85')],path['resolve'](__dirname,_0x3a4d('0x29'),rs[_0x3a4d('0x37')](0x4)+_0x3a4d('0x2a')))[_0x3a4d('0x36')](function(_0x446aa9){_0x5ae160[_0x3a4d('0x86')]=_0x446aa9;return _0x5ae160;});}return _0x5ae160;});};exports[_0x3a4d('0x87')]=function(){return __dirname;}; \ No newline at end of file +var _0xc3ef=['googleASR\x20confidence','catch','name','textRequest','result','source','action','actionIncomplete','fulfillment','speech','score','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','SessionsClient','sessionPath','detectIntent','length','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','isFallback','languageCode','queryText','intentDetectionConfidence','asr','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','model=%s','freeform=3','sestekNDA','nda','channelData','CustomAction','AudioFromTts','Data','audiofile','apiai-promise','dialogflow','http','https','md5','path','request-promise','randomstring','sox','google-tts-api','parse','util','./google','./sestek','./tilde','../../../config/logger','agi','protocol','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','finish\x20download\x20file','unlink','download\x20error','pipe','end','transcode','error\x20convert','finish\x20to\x20convert','start','resolve','generate','.wav','writeFileSync','777','split','readFileSync','https://texttospeech.googleapis.com/v1/','?key=','input','voice','audioConfig','MP3','then','tmp','.mp3','from','audioContent','base64','writeFile','chmodSync','info','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','POST','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','generic','parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','data','goggleTTS\x20path','googleASR','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription'];(function(_0x329e45,_0x2a09db){var _0x25c632=function(_0x257b65){while(--_0x257b65){_0x329e45['push'](_0x329e45['shift']());}};_0x25c632(++_0x2a09db);}(_0xc3ef,0x138));var _0xfc3e=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xc3ef[_0x4b055c];return _0x4b62bb;};'use strict';var apiai=require(_0xfc3e('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0xfc3e('0x1'));var fs=require('fs');var http=require(_0xfc3e('0x2'));var https=require(_0xfc3e('0x3'));var md5=require(_0xfc3e('0x4'));var path=require(_0xfc3e('0x5'));var querystring=require('querystring');var rp=require(_0xfc3e('0x6'));var rs=require(_0xfc3e('0x7'));var sox=require(_0xfc3e('0x8'));var tts=require(_0xfc3e('0x9'));var urlParse=require('url')[_0xfc3e('0xa')];var util=require(_0xfc3e('0xb'));var aws=require('./aws');var google=require(_0xfc3e('0xc'));var sestek=require(_0xfc3e('0xd'));var tilde=require(_0xfc3e('0xe'));var logger=require(_0xfc3e('0xf'))(_0xfc3e('0x10'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x2e5834,_0xfa0843){return new BPromise(function(_0xecc338,_0x3b3149){var _0x255d5d=urlParse(_0x2e5834);var _0x1bca82=_0x255d5d[_0xfc3e('0x11')]===_0xfc3e('0x12')?https:http;var _0x229299={'host':_0x255d5d[_0xfc3e('0x13')],'path':_0x255d5d[_0xfc3e('0x5')],'headers':{'user-agent':_0xfc3e('0x14')}};_0x1bca82[_0xfc3e('0x15')](_0x229299,function(_0x52d83b){if(_0x52d83b[_0xfc3e('0x16')]!==0xc8){logger[_0xfc3e('0x17')](_0xfc3e('0x18')+_0x2e5834+_0xfc3e('0x19')+_0x52d83b['statusCode']+'\x20('+_0x52d83b[_0xfc3e('0x1a')]+')');_0x3b3149(new Error(_0xfc3e('0x18')+_0x2e5834+_0xfc3e('0x19')+_0x52d83b[_0xfc3e('0x16')]+'\x20('+_0x52d83b[_0xfc3e('0x1a')]+')'));return;}var _0x4df046=fs['createWriteStream'](_0xfa0843);_0x4df046['on'](_0xfc3e('0x1b'),function(){logger['info'](_0xfc3e('0x1c'));_0x4df046['close'](_0xecc338);});_0x4df046['on'](_0xfc3e('0x17'),function(_0xaa777b){fs[_0xfc3e('0x1d')](_0xfa0843);logger[_0xfc3e('0x17')](_0xfc3e('0x1e'),_0xaa777b);_0x3b3149(_0xaa777b);});_0x52d83b[_0xfc3e('0x1f')](_0x4df046);})['on']('error',function(_0xf8b50b){logger['error'](_0xf8b50b);_0x3b3149(_0xf8b50b);})[_0xfc3e('0x20')]();});}function uploadFile(_0x285f86){return new BPromise(function(_0x1d1e09,_0x1f6c11){var _0x4bd171=urlParse(_0x285f86);var _0x535755=_0x4bd171['protocol']===_0xfc3e('0x12')?https:http;var _0x4afbf3={'host':_0x4bd171[_0xfc3e('0x13')],'path':_0x4bd171['path'],'headers':{'user-agent':_0xfc3e('0x14')}};_0x535755[_0xfc3e('0x15')](_0x4afbf3,function(_0x52aabc){if(_0x52aabc['statusCode']!==0xc8){_0x1f6c11(new Error(_0xfc3e('0x18')+_0x285f86+_0xfc3e('0x19')+_0x52aabc[_0xfc3e('0x16')]+'\x20('+_0x52aabc['statusMessage']+')'));return;}var _0x4e2650='';_0x52aabc['on']('data',function(_0x2ff451){_0x4e2650+=_0x2ff451;});_0x52aabc['on'](_0xfc3e('0x20'),function(){_0x1d1e09(_0x4e2650);});})['on']('error',function(_0x2743b7){_0x1f6c11(_0x2743b7);})[_0xfc3e('0x20')]();});}function convertFile(_0x391b58,_0x1022c4){return new BPromise(function(_0x4dbfe7,_0x3b1fdb){var _0x56f656=sox[_0xfc3e('0x21')](_0x391b58,_0x1022c4,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x56f656['on'](_0xfc3e('0x17'),function(_0x5a5680){logger[_0xfc3e('0x17')](_0xfc3e('0x22'),_0x5a5680);_0x3b1fdb(_0x5a5680);});_0x56f656['on']('end',function(){logger['info'](_0xfc3e('0x23'));_0x4dbfe7();});_0x56f656[_0xfc3e('0x24')]();});}function base64Decode(_0x23353c,_0x3b0b56){var _0x29dc48=path[_0xfc3e('0x25')](__dirname,'tmp',rs[_0xfc3e('0x26')](0x4)+_0xfc3e('0x27'));fs[_0xfc3e('0x28')](_0x29dc48,_0x23353c,'base64');return convertFile(_0x29dc48,_0x3b0b56)['then'](function(){try{fs[_0xfc3e('0x1d')](_0x29dc48);fs['chmodSync'](_0x3b0b56,_0xfc3e('0x29'));}catch(_0x336c9c){logger[_0xfc3e('0x17')](_0x336c9c);}return _0x3b0b56[_0xfc3e('0x2a')]('.')[0x0];});}function base64Encode(_0x4fdd97){var _0x50d157=fs[_0xfc3e('0x2b')](_0x4fdd97);return new Buffer(_0x50d157)['toString']('base64');}exports['googleCloudTTS']=function(_0x285689,_0x4a9d0e,_0x5a1450,_0x387ddd,_0x316ac3,_0x15d323){var _0xfe8482,_0x3b01d4;var _0x275d10=_0xfc3e('0x2c');var _0x376146=_0xfc3e('0x2d')+_0x285689;var _0x504033={};if(_0x4a9d0e==='ssml'){_0x504033[_0xfc3e('0x2e')]={'ssml':_0x5a1450};}else{_0x504033[_0xfc3e('0x2e')]={'text':_0x5a1450};};_0x504033[_0xfc3e('0x2f')]={'languageCode':_0x387ddd,'ssmlGender':_0x316ac3};_0x504033[_0xfc3e('0x30')]={'audioEncoding':_0xfc3e('0x31'),'sampleRateHertz':0x1f40};var _0x3bf600={'url':_0x275d10+'text:synthesize'+_0x376146,'method':'POST','json':!![],'body':_0x504033};return rp(_0x3bf600)[_0xfc3e('0x32')](function(_0x12d635){return new BPromise(function(_0x499e8b,_0x39c1fe){_0xfe8482=path[_0xfc3e('0x25')](__dirname,_0xfc3e('0x33'),rs[_0xfc3e('0x26')](0x4)+_0xfc3e('0x34'));var _0x5811b1=Buffer[_0xfc3e('0x35')](_0x12d635[_0xfc3e('0x36')],_0xfc3e('0x37'));return fs[_0xfc3e('0x38')](_0xfe8482,_0x5811b1,function(_0x45c075){_0x39c1fe(_0x45c075);},function(_0x3c080e){fs[_0xfc3e('0x39')](_0xfe8482,_0xfc3e('0x29'));_0x499e8b(_0x3c080e);});});})[_0xfc3e('0x32')](function(_0x19f89e){_0x3b01d4=path[_0xfc3e('0x25')](__dirname,_0xfc3e('0x33'),rs['generate'](0x4)+_0xfc3e('0x27'));return convertFile(_0xfe8482,_0x3b01d4);})[_0xfc3e('0x32')](function(){try{fs['unlink'](_0xfe8482);fs[_0xfc3e('0x39')](_0x3b01d4,_0xfc3e('0x29'));}catch(_0xdc3f93){logger[_0xfc3e('0x17')](_0xdc3f93);}logger[_0xfc3e('0x3a')](_0xfc3e('0x3b'),_0x3b01d4['split']('.')[0x0]);return _0x3b01d4[_0xfc3e('0x2a')]('.')[0x0];});};exports[_0xfc3e('0x3c')]=function(_0x20dedf,_0x162a5a){var _0xa97276=_0xfc3e('0x3d');var _0x5a1363,_0x22fdbe;var _0x4015a4;var _0x8e4068={'encoding':'utf8','method':_0xfc3e('0x3e'),'timeout':0x2710,'url':_0xa97276,'headers':{'Content-Type':_0xfc3e('0x3f')},'body':_0xfc3e('0x40')+encodeURIComponent(JSON[_0xfc3e('0x41')]([[[_0xfc3e('0x42'),JSON[_0xfc3e('0x41')]([_0x20dedf,_0x162a5a||'en',![],'null']),null,_0xfc3e('0x43')]]]))};return rp(_0x8e4068)['then'](function(_0x24c2da){try{_0x4015a4=eval(_0x24c2da['slice'](0x5))[0x0][0x2];}catch(_0x3c4830){throw new Error(_0xfc3e('0x44')+_0x24c2da['data']);}if(!_0x4015a4){if(_0x20dedf['length']>0xc8){throw new Error(_0xfc3e('0x45'));}else{throw new Error('lang\x20\x22'+_0x162a5a+_0xfc3e('0x46'));}}try{_0x4015a4=eval(_0x4015a4)[0x0];}catch(_0x15a584){throw new Error(_0xfc3e('0x44')+res[_0xfc3e('0x47')]);}const _0x39c4b6=_0x4015a4;_0x5a1363=path[_0xfc3e('0x25')](__dirname,_0xfc3e('0x33'),rs[_0xfc3e('0x26')](0x4)+'.mp3');fs[_0xfc3e('0x28')](_0x5a1363,_0x4015a4,{'encoding':_0xfc3e('0x37')});_0x22fdbe=path[_0xfc3e('0x25')](__dirname,'tmp',rs[_0xfc3e('0x26')](0x4)+_0xfc3e('0x27'));return convertFile(_0x5a1363,_0x22fdbe);})[_0xfc3e('0x32')](function(){try{fs['unlink'](_0x5a1363);fs[_0xfc3e('0x39')](_0x22fdbe,'777');}catch(_0x435997){logger[_0xfc3e('0x17')](_0x435997);}logger[_0xfc3e('0x3a')](_0xfc3e('0x48'),_0x22fdbe['split']('.')[0x0]);return _0x22fdbe[_0xfc3e('0x2a')]('.')[0x0];});};exports[_0xfc3e('0x49')]=function(_0x3d6c41,_0x23661a,_0x1af23b){return google['asr'](_0x3d6c41,_0x23661a,_0x1af23b)[_0xfc3e('0x32')](function(_0x1745d0){logger[_0xfc3e('0x3a')](_0x1745d0['uri']);return rp(_0x1745d0);})[_0xfc3e('0x32')](function(_0x49f24b){var _0x2b2d7f='';var _0x1e65da=0x0;try{fs[_0xfc3e('0x1d')](_0x3d6c41);}catch(_0xb13cc3){logger[_0xfc3e('0x17')](_0xb13cc3);}if(_0x49f24b&&_0x49f24b[_0xfc3e('0x4a')]){_0x2b2d7f=_0x49f24b[_0xfc3e('0x4a')][_0xfc3e('0x4b')](function(_0x59ba9d){return _0x59ba9d&&_0x59ba9d[_0xfc3e('0x4c')][0x0]&&_0x59ba9d[_0xfc3e('0x4c')][0x0][_0xfc3e('0x4d')]?_0x59ba9d[_0xfc3e('0x4c')][0x0][_0xfc3e('0x4d')]:'';})[_0xfc3e('0x4e')]('\x0a');_0x1e65da=_0x49f24b[_0xfc3e('0x4a')][_0xfc3e('0x4b')](function(_0x5d6fc1){return _0x5d6fc1&&_0x5d6fc1['alternatives'][0x0]&&_0x5d6fc1[_0xfc3e('0x4c')][0x0][_0xfc3e('0x4f')]?_0x5d6fc1[_0xfc3e('0x4c')][0x0][_0xfc3e('0x4f')]:0x0;})[_0xfc3e('0x4e')]('\x0a');}logger[_0xfc3e('0x3a')](_0xfc3e('0x50'),_0x2b2d7f);logger[_0xfc3e('0x3a')](_0xfc3e('0x51'),_0x1e65da);return{'transcript':_0x2b2d7f,'confidence':_0x1e65da};})[_0xfc3e('0x52')](function(_0x2f733c){logger[_0xfc3e('0x17')]('[%s]\x20%s:%s',_0x2f733c[_0xfc3e('0x16')],_0x2f733c[_0xfc3e('0x53')],_0x2f733c['message']);});};exports['googleDialogflow']=function(_0xe733b7,_0x415a51,_0x32e2dd,_0x1511d4){var _0x23b736=apiai(_0x415a51,{'language':_0x1511d4||'en'});return _0x23b736[_0xfc3e('0x54')](_0x32e2dd,{'sessionId':md5(_0xe733b7)})[_0xfc3e('0x32')](function(_0x379bfc){logger[_0xfc3e('0x3a')](JSON[_0xfc3e('0x41')](_0x379bfc));return{'source':_0x379bfc[_0xfc3e('0x55')][_0xfc3e('0x56')],'resolvedQuery':_0x379bfc[_0xfc3e('0x55')]['resolvedQuery'],'action':_0x379bfc[_0xfc3e('0x55')][_0xfc3e('0x57')],'actionIncomplete':_0x379bfc[_0xfc3e('0x55')][_0xfc3e('0x58')],'speech':_0x379bfc[_0xfc3e('0x55')][_0xfc3e('0x59')][_0xfc3e('0x5a')],'score':_0x379bfc[_0xfc3e('0x55')][_0xfc3e('0x5b')],'statusCode':_0x379bfc['status'][_0xfc3e('0x5c')],'endConversation':_0x379bfc[_0xfc3e('0x55')][_0xfc3e('0x5d')][_0xfc3e('0x5e')]||![],'isFallbackIntent':_0x379bfc[_0xfc3e('0x55')][_0xfc3e('0x5d')][_0xfc3e('0x5f')]};});};exports[_0xfc3e('0x60')]=function(_0x330301,_0x1b24e7,_0x333eb2,_0x44e7f1,_0x1b2968,_0x18354f){var _0x23ae02=_0x44e7f1['replace'](/\\n/g,'\x0a');var _0x424f0e={'credentials':{'private_key':_0x23ae02,'client_email':_0x333eb2}};var _0x2fcc7e=new dialogflow[(_0xfc3e('0x61'))](_0x424f0e);var _0x45a82d=_0x2fcc7e[_0xfc3e('0x62')](_0x1b24e7,md5(_0x330301));var _0x3037e9={'session':_0x45a82d,'queryInput':{'text':{'text':_0x1b2968,'languageCode':_0x18354f}}};return _0x2fcc7e[_0xfc3e('0x63')](_0x3037e9)[_0xfc3e('0x32')](function(_0x35ec9a){if(_0x35ec9a&&_0x35ec9a[_0xfc3e('0x64')]){logger['info'](_0xfc3e('0x65'),JSON['stringify'](_0x35ec9a));var _0x3d32a7=_0x35ec9a[0x0];if(_0x3d32a7){var _0x50310f={'action':_0x3d32a7[_0xfc3e('0x66')]['action'],'allRequiredParamsPresent':_0x3d32a7[_0xfc3e('0x66')][_0xfc3e('0x67')],'endConversation':_0x3d32a7['queryResult'][_0xfc3e('0x68')]&&_0x3d32a7[_0xfc3e('0x66')]['diagnosticInfo']['fields']?_0x3d32a7[_0xfc3e('0x66')]['diagnosticInfo'][_0xfc3e('0x69')][_0xfc3e('0x6a')][_0xfc3e('0x6b')]:![],'fulfillmentText':_0x3d32a7[_0xfc3e('0x66')][_0xfc3e('0x6c')],'intentName':_0x3d32a7['queryResult']['intent'][_0xfc3e('0x53')],'intentDisplayName':_0x3d32a7[_0xfc3e('0x66')][_0xfc3e('0x6d')]['displayName'],'isFallbackIntent':_0x3d32a7[_0xfc3e('0x66')][_0xfc3e('0x6d')][_0xfc3e('0x6e')],'languageCode':_0x3d32a7[_0xfc3e('0x66')][_0xfc3e('0x6f')],'queryText':_0x3d32a7[_0xfc3e('0x66')][_0xfc3e('0x70')],'responseId':_0x3d32a7['responseId'],'score':_0x3d32a7[_0xfc3e('0x66')][_0xfc3e('0x71')],'speech':_0x3d32a7[_0xfc3e('0x66')]['fulfillmentText'],'providerResponse':JSON[_0xfc3e('0x41')](_0x35ec9a)};return _0x50310f;}}});};exports['tildeASR']=function(_0x526f26,_0x380879,_0xa96505,_0x4355b7){return tilde[_0xfc3e('0x72')](_0x526f26,_0x380879,_0xa96505,_0x4355b7)['then'](function(_0x136232){try{fs['unlink'](_0x526f26);}catch(_0x1836e6){logger[_0xfc3e('0x17')](_0x1836e6);}logger['info'](_0xfc3e('0x73'),_0x136232[_0xfc3e('0x4d')]);logger[_0xfc3e('0x3a')](_0xfc3e('0x74'),_0x136232[_0xfc3e('0x4f')]);return _0x136232;});};exports[_0xfc3e('0x75')]=function(_0x5cccb6,_0x159ae6,_0x2ab2c9,_0x2b3313,_0x3e2dd5,_0x5432d0){var _0x30e6ad=path[_0xfc3e('0x25')](__dirname,_0xfc3e('0x33'),rs[_0xfc3e('0x26')](0x4)+_0xfc3e('0x34'));var _0x589128;return aws['polly'](_0x5cccb6,_0x159ae6,_0x2ab2c9,_0x2b3313,_0x3e2dd5,_0x5432d0,_0x30e6ad)[_0xfc3e('0x32')](function(){_0x589128=path[_0xfc3e('0x25')](__dirname,_0xfc3e('0x33'),rs['generate'](0x4)+_0xfc3e('0x27'));return convertFile(_0x30e6ad,_0x589128);})[_0xfc3e('0x32')](function(){try{fs[_0xfc3e('0x1d')](_0x30e6ad);fs[_0xfc3e('0x39')](_0x589128,_0xfc3e('0x29'));}catch(_0x1258ba){logger[_0xfc3e('0x17')](_0x1258ba);}return _0x589128[_0xfc3e('0x2a')]('.')[0x0];});};exports['awsLex']=function(_0x2201fd,_0x168fd4,_0x11a248,_0x59d858,_0x407df1,_0x1b3e2a){return aws['lex'](_0x2201fd,_0x168fd4,_0x11a248,_0x59d858,_0x407df1,_0x1b3e2a)[_0xfc3e('0x32')](function(_0x4926a5){logger[_0xfc3e('0x3a')](JSON[_0xfc3e('0x41')](_0x4926a5));return _0x4926a5;});};exports[_0xfc3e('0x76')]=function(_0x54d66f,_0x409461,_0x29b072,_0xeaf3c2){var _0x18f926=util['format'](_0xfc3e('0x77'),ISPEECH_API,_0x54d66f,encodeURIComponent(_0x409461),_0x29b072,_0xeaf3c2);var _0x3f82b6=path[_0xfc3e('0x25')](__dirname,_0xfc3e('0x33'),rs[_0xfc3e('0x26')](0x4)+_0xfc3e('0x34'));var _0x27fbfd;return downloadFile(_0x18f926,_0x3f82b6)[_0xfc3e('0x32')](function(){_0x27fbfd=path[_0xfc3e('0x25')](__dirname,_0xfc3e('0x33'),rs[_0xfc3e('0x26')](0x4)+'.wav');return convertFile(_0x3f82b6,_0x27fbfd);})['then'](function(){try{fs[_0xfc3e('0x1d')](_0x3f82b6);fs[_0xfc3e('0x39')](_0x27fbfd,_0xfc3e('0x29'));}catch(_0x109cdc){logger[_0xfc3e('0x17')](_0x109cdc);}return _0x27fbfd[_0xfc3e('0x2a')]('.')[0x0];});};exports[_0xfc3e('0x78')]=function(_0x11cb58,_0x3b863c,_0x3959f2,_0x331f77){var _0x464a47=util['format']('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x3b863c,_0x3959f2,base64Encode(_0x11cb58),_0x331f77?util[_0xfc3e('0x79')](_0xfc3e('0x7a'),encodeURIComponent(_0x331f77)):_0xfc3e('0x7b'));return uploadFile(_0x464a47)[_0xfc3e('0x32')](function(_0xa373d8){return querystring[_0xfc3e('0xa')](_0xa373d8);});};exports[_0xfc3e('0x7c')]=function(_0x515b81,_0x3aa32a){return sestek[_0xfc3e('0x7d')](_0x515b81,_0x3aa32a)[_0xfc3e('0x32')](function(_0x3ee4e6){logger['info'](JSON[_0xfc3e('0x41')](_0x3ee4e6));var _0x1d2ce2={'speech':_0x3ee4e6['text'],'action':_0x3ee4e6[_0xfc3e('0x7e')]?_0x3ee4e6[_0xfc3e('0x7e')][_0xfc3e('0x7f')]:undefined,'actiondata':_0x3ee4e6['channelData']?_0x3ee4e6[_0xfc3e('0x7e')]['CustomActionData']:undefined};if(_0x3ee4e6['channelData']&&_0x3ee4e6[_0xfc3e('0x7e')]['AudioFromTts']){return base64Decode(_0x3ee4e6[_0xfc3e('0x7e')][_0xfc3e('0x80')][_0xfc3e('0x81')],path[_0xfc3e('0x25')](__dirname,_0xfc3e('0x33'),rs[_0xfc3e('0x26')](0x4)+_0xfc3e('0x27')))[_0xfc3e('0x32')](function(_0x386898){_0x1d2ce2[_0xfc3e('0x82')]=_0x386898;return _0x1d2ce2;});}return _0x1d2ce2;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index 4aa4351..08b1b2a 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 _0xc4a9=['./nda','exports'];(function(_0x17e0a2,_0x48410c){var _0x35be95=function(_0x2cc0b4){while(--_0x2cc0b4){_0x17e0a2['push'](_0x17e0a2['shift']());}};_0x35be95(++_0x48410c);}(_0xc4a9,0x138));var _0x9c4a=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0xc4a9[_0x243b2f];return _0xcb3c2d;};var nda=require(_0x9c4a('0x0'));module[_0x9c4a('0x1')]={'nda':nda}; \ No newline at end of file +var _0xf5f1=['exports'];(function(_0x3e3ec5,_0xbc691b){var _0x17e1f9=function(_0x3f13a5){while(--_0x3f13a5){_0x3e3ec5['push'](_0x3e3ec5['shift']());}};_0x17e1f9(++_0xbc691b);}(_0xf5f1,0x150));var _0x1f5f=function(_0xbbd7c0,_0x2c4275){_0xbbd7c0=_0xbbd7c0-0x0;var _0x52d163=_0xf5f1[_0xbbd7c0];return _0x52d163;};var nda=require('./nda');module[_0x1f5f('0x0')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index c74c3db..5919166 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 _0x7eb9=['audio/wav','custom_action','CustomAction','CustomActionData','custom_action_data','info','stringify','request-promise','agi','POST','ndauth_url','password','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings'];(function(_0x1990e7,_0x179602){var _0x3a9c46=function(_0x3d274c){while(--_0x3d274c){_0x1990e7['push'](_0x1990e7['shift']());}};_0x3a9c46(++_0x179602);}(_0x7eb9,0xd9));var _0x97eb=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x7eb9[_0x122ef9];return _0x42fba0;};'use strict';var rp=require(_0x97eb('0x0'));var url=require('url');var logger=require('../../../../../config/logger')(_0x97eb('0x1'));module['exports']=function(_0x580fd1,_0x41d2c7){var _0x67960={'method':_0x97eb('0x2'),'uri':url['resolve'](_0x41d2c7[_0x97eb('0x3')],'/token'),'form':{'grant_type':_0x97eb('0x4'),'username':_0x41d2c7['username'],'password':_0x41d2c7[_0x97eb('0x4')]},'json':!![]};return rp(_0x67960)['then'](function(_0x5227f4){var _0x429ed6={'method':'POST','uri':url[_0x97eb('0x5')](_0x41d2c7[_0x97eb('0x6')],_0x97eb('0x7')),'body':{'type':_0x41d2c7[_0x97eb('0x8')]||_0x97eb('0x9'),'channelId':'Nda','conversation':{'id':_0x580fd1['uniqueid']},'from':{'id':_0x580fd1[_0x97eb('0xa')],'name':_0x580fd1[_0x97eb('0xb')]},'recipient':{'id':_0x580fd1[_0x97eb('0xc')],'name':_0x580fd1[_0x97eb('0xd')]},'text':_0x41d2c7[_0x97eb('0xe')],'channelData':{}},'headers':{'Authorization':_0x97eb('0xf')+_0x5227f4[_0x97eb('0x10')]},'json':!![]};if(_0x41d2c7[_0x97eb('0x11')]){_0x429ed6[_0x97eb('0x12')][_0x97eb('0x13')][_0x97eb('0x14')]=_0x41d2c7[_0x97eb('0x11')];}if(_0x41d2c7[_0x97eb('0x15')]=='1'){_0x429ed6[_0x97eb('0x12')]['channelData'][_0x97eb('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x97eb('0x17')};}if(_0x41d2c7[_0x97eb('0x18')]){_0x429ed6['body'][_0x97eb('0x13')][_0x97eb('0x19')]=_0x41d2c7[_0x97eb('0x18')];if(_0x41d2c7['custom_action_data']){_0x429ed6['body'][_0x97eb('0x13')][_0x97eb('0x1a')]=_0x41d2c7[_0x97eb('0x1b')];}}logger[_0x97eb('0x1c')](JSON[_0x97eb('0x1d')](_0x429ed6));return rp(_0x429ed6);});}; \ No newline at end of file +var _0xa101=['POST','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','uniqueid','callerid','calleridname','extension','text','Bearer\x20','project','body','channelData','ProjectName','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','url','agi','exports','resolve','ndauth_url','/token','password','username'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa101,0x15f));var _0x1a10=function(_0x479509,_0x1daf8a){_0x479509=_0x479509-0x0;var _0x382da8=_0xa101[_0x479509];return _0x382da8;};'use strict';var rp=require(_0x1a10('0x0'));var url=require(_0x1a10('0x1'));var logger=require('../../../../../config/logger')(_0x1a10('0x2'));module[_0x1a10('0x3')]=function(_0x522253,_0x9e0102){var _0x2a9c51={'method':'POST','uri':url[_0x1a10('0x4')](_0x9e0102[_0x1a10('0x5')],_0x1a10('0x6')),'form':{'grant_type':_0x1a10('0x7'),'username':_0x9e0102[_0x1a10('0x8')],'password':_0x9e0102[_0x1a10('0x7')]},'json':!![]};return rp(_0x2a9c51)['then'](function(_0x4f0cd4){var _0x3c90fa={'method':_0x1a10('0x9'),'uri':url[_0x1a10('0x4')](_0x9e0102[_0x1a10('0xa')],_0x1a10('0xb')),'body':{'type':_0x9e0102[_0x1a10('0xc')]||_0x1a10('0xd'),'channelId':'Nda','conversation':{'id':_0x522253[_0x1a10('0xe')]},'from':{'id':_0x522253[_0x1a10('0xf')],'name':_0x522253[_0x1a10('0x10')]},'recipient':{'id':_0x522253['dnid'],'name':_0x522253[_0x1a10('0x11')]},'text':_0x9e0102[_0x1a10('0x12')],'channelData':{}},'headers':{'Authorization':_0x1a10('0x13')+_0x4f0cd4['access_token']},'json':!![]};if(_0x9e0102[_0x1a10('0x14')]){_0x3c90fa[_0x1a10('0x15')][_0x1a10('0x16')][_0x1a10('0x17')]=_0x9e0102[_0x1a10('0x14')];}if(_0x9e0102['ndagenerate_audio']=='1'){_0x3c90fa[_0x1a10('0x15')]['channelData']['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x9e0102[_0x1a10('0x18')]){_0x3c90fa[_0x1a10('0x15')][_0x1a10('0x16')][_0x1a10('0x19')]=_0x9e0102['custom_action'];if(_0x9e0102[_0x1a10('0x1a')]){_0x3c90fa[_0x1a10('0x15')]['channelData'][_0x1a10('0x1b')]=_0x9e0102[_0x1a10('0x1a')];}}logger[_0x1a10('0x1c')](JSON[_0x1a10('0x1d')](_0x3c90fa));return rp(_0x3c90fa);});}; \ 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 f3b37bb..0c48cc6 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 _0x62b2=['exports'];(function(_0x3cfd31,_0x55084f){var _0x294e12=function(_0x3c73){while(--_0x3c73){_0x3cfd31['push'](_0x3cfd31['shift']());}};_0x294e12(++_0x55084f);}(_0x62b2,0x177));var _0x262b=function(_0x117d07,_0x15c24d){_0x117d07=_0x117d07-0x0;var _0x527407=_0x62b2[_0x117d07];return _0x527407;};'use strict';var asr=require('./lib/api');module[_0x262b('0x0')]=function(_0x118d45,_0x7ad8dd,_0x2ee757,_0x1e4bfe){return asr(_0x118d45,_0x7ad8dd,_0x2ee757,_0x1e4bfe);}; \ No newline at end of file +var _0x4347=['./lib/api','exports'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0x4347,0xea));var _0x7434=function(_0x2d12df,_0x1c8763){_0x2d12df=_0x2d12df-0x0;var _0x158885=_0x4347[_0x2d12df];return _0x158885;};'use strict';var asr=require(_0x7434('0x0'));module[_0x7434('0x1')]=function(_0x4b49ca,_0x2bda83,_0x3dd677,_0x272b28){return asr(_0x4b49ca,_0x2bda83,_0x3dd677,_0x272b28);}; \ 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 33e452d..6d2e06d 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 _0xb7ec=['hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','moment','crypto','exports','info','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','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','Tilde\x20ASR\x20hypoteses'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xb7ec,0x1bb));var _0xcb7e=function(_0x58176f,_0x55a4e5){_0x58176f=_0x58176f-0x0;var _0x14ccb0=_0xb7ec[_0x58176f];return _0x14ccb0;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xcb7e('0x0'));var crypto=require(_0xcb7e('0x1'));var logger=require('../../../../../../config/logger')('agi');module[_0xcb7e('0x2')]=function(_0x1882d4,_0x30ffc3,_0x3c966d,_0x41e941){return new BPromise(function(_0x5d9834,_0x247867){logger[_0xcb7e('0x3')]('Tilde\x20URI',_0x41e941||_0xcb7e('0x4'));var _0x3cb091=new WebSocket(_0x41e941||_0xcb7e('0x4'),{'perMessageDeflate':![]});var _0x38ada6='';var _0x5567b8='0';var _0x586adb='1';var _0x1b15e1=_0xcb7e('0x5');function _0x1e01b9(_0x10e6de){var _0x4e88a7=crypto['createHash'](_0xcb7e('0x6'));_0x4e88a7[_0xcb7e('0x7')](_0x10e6de);return _0x4e88a7[_0xcb7e('0x8')](_0xcb7e('0x9'));}function _0x4b99fb(){try{logger[_0xcb7e('0x3')](_0xcb7e('0xa'));var _0x26a153=moment()[_0xcb7e('0xb')]();var _0x2433db=_0x1e01b9(_0x26a153+_0x30ffc3+_0x3c966d);_0x3cb091[_0xcb7e('0xc')](JSON[_0xcb7e('0xd')]({'appID':_0x30ffc3,'timestamp':_0x26a153,'appKey':_0x2433db}));var _0x3b88be=fs[_0xcb7e('0xe')](_0x1882d4);_0x3b88be['on'](_0xcb7e('0xf'),function(_0x1b283b){_0x3cb091['send'](_0x1b283b);});_0x3b88be['on'](_0xcb7e('0x10'),function(){_0x3cb091[_0xcb7e('0xc')](_0xcb7e('0x11'));});}catch(_0x1dfe74){logger[_0xcb7e('0x12')](_0xcb7e('0x13'),JSON[_0xcb7e('0xd')](_0x1dfe74));_0x3cb091[_0xcb7e('0x14')]();}}function _0x3c4cf0(_0x425f67){try{if(_0x425f67){var _0x107351=JSON[_0xcb7e('0x15')](_0x425f67);switch(_0x107351[_0xcb7e('0x16')]){case 0x0:if(_0x107351[_0xcb7e('0x17')]){if(_0x107351['result']['final']){logger['info'](_0xcb7e('0x18'),JSON[_0xcb7e('0xd')](_0x107351['result']['hypotheses']));_0x38ada6=_0x107351[_0xcb7e('0x17')][_0xcb7e('0x19')][0x0][_0xcb7e('0x1a')];_0x5567b8=_0x107351[_0xcb7e('0x17')][_0xcb7e('0x19')][0x0][_0xcb7e('0x1b')];_0x586adb='0';_0x1b15e1=_0xcb7e('0x1c');_0x3cb091['terminate']();}}break;case 0x1:logger[_0xcb7e('0x3')](_0xcb7e('0x5'));_0x586adb='1';_0x1b15e1=_0xcb7e('0x5');break;case 0x2:logger['info'](_0xcb7e('0x1d'));_0x586adb='2';_0x1b15e1=_0xcb7e('0x1d');break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x586adb='9';_0x1b15e1=_0xcb7e('0x1e');break;case 0xa:logger[_0xcb7e('0x3')](_0xcb7e('0x1f'));_0x586adb='10';_0x1b15e1='Authentication\x20failed.';break;case 0xb:logger[_0xcb7e('0x3')](_0xcb7e('0x20'));_0x586adb='11';_0x1b15e1=_0xcb7e('0x20');}}}catch(_0x15d623){logger[_0xcb7e('0x12')]('Tilde\x20ASR\x20parse\x20error',JSON[_0xcb7e('0xd')](_0x15d623));_0x3cb091['terminate']();}}function _0x21963f(){logger[_0xcb7e('0x3')](_0xcb7e('0x21'));_0x5d9834({'transcript':_0x38ada6,'confidence':_0x5567b8,'status':_0x586adb,'status_message':_0x1b15e1});}function _0x5b8da7(_0x48967b){logger[_0xcb7e('0x12')](_0xcb7e('0x22'));if(!_[_0xcb7e('0x23')](_0x48967b)){logger[_0xcb7e('0x12')](_[_0xcb7e('0x24')](_0x48967b)?JSON[_0xcb7e('0xd')](_0x48967b):_0x48967b);}}_0x3cb091['on'](_0xcb7e('0x25'),_0x4b99fb);_0x3cb091['on'](_0xcb7e('0x26'),_0x3c4cf0);_0x3cb091['on']('close',_0x21963f);_0x3cb091['on'](_0xcb7e('0x12'),_0x5b8da7);});}; \ No newline at end of file +var _0xb152=['close','error','Tilde\x20ASR\x20send\x20error','terminate','result','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','message','bluebird','lodash','../../../../../../config/logger','agi','exports','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','digest','hex','info','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify'];(function(_0x496250,_0xfc83db){var _0x403a74=function(_0x59b147){while(--_0x59b147){_0x496250['push'](_0x496250['shift']());}};_0x403a74(++_0xfc83db);}(_0xb152,0xb7));var _0x2b15=function(_0x23018a,_0x1d176b){_0x23018a=_0x23018a-0x0;var _0x24489f=_0xb152[_0x23018a];return _0x24489f;};'use strict';var BPromise=require(_0x2b15('0x0'));var _=require(_0x2b15('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require('crypto');var logger=require(_0x2b15('0x2'))(_0x2b15('0x3'));module[_0x2b15('0x4')]=function(_0x25dec7,_0x566295,_0x5e6ff4,_0x49a66a){return new BPromise(function(_0x4d30d5,_0x3d7c98){logger['info'](_0x2b15('0x5'),_0x49a66a||_0x2b15('0x6'));var _0x10e2a6=new WebSocket(_0x49a66a||_0x2b15('0x6'),{'perMessageDeflate':![]});var _0x9449c7='';var _0x293e07='0';var _0x329d6b='1';var _0x427d73='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x1a3ec4(_0x49b1c2){var _0x449d7a=crypto[_0x2b15('0x7')]('sha1');_0x449d7a['update'](_0x49b1c2);return _0x449d7a[_0x2b15('0x8')](_0x2b15('0x9'));}function _0x82ad9a(){try{logger[_0x2b15('0xa')](_0x2b15('0xb'));var _0x489d51=moment()[_0x2b15('0xc')]();var _0x4edff7=_0x1a3ec4(_0x489d51+_0x566295+_0x5e6ff4);_0x10e2a6[_0x2b15('0xd')](JSON[_0x2b15('0xe')]({'appID':_0x566295,'timestamp':_0x489d51,'appKey':_0x4edff7}));var _0x13845d=fs['createReadStream'](_0x25dec7);_0x13845d['on']('data',function(_0x44bde9){_0x10e2a6[_0x2b15('0xd')](_0x44bde9);});_0x13845d['on'](_0x2b15('0xf'),function(){_0x10e2a6[_0x2b15('0xd')]('EOS');});}catch(_0x85fa2f){logger[_0x2b15('0x10')](_0x2b15('0x11'),JSON[_0x2b15('0xe')](_0x85fa2f));_0x10e2a6[_0x2b15('0x12')]();}}function _0x26f320(_0x25e6ae){try{if(_0x25e6ae){var _0x5d4e62=JSON['parse'](_0x25e6ae);switch(_0x5d4e62['status']){case 0x0:if(_0x5d4e62[_0x2b15('0x13')]){if(_0x5d4e62['result']['final']){logger[_0x2b15('0xa')](_0x2b15('0x14'),JSON[_0x2b15('0xe')](_0x5d4e62[_0x2b15('0x13')][_0x2b15('0x15')]));_0x9449c7=_0x5d4e62[_0x2b15('0x13')][_0x2b15('0x15')][0x0]['transcript'];_0x293e07=_0x5d4e62[_0x2b15('0x13')]['hypotheses'][0x0][_0x2b15('0x16')];_0x329d6b='0';_0x427d73=_0x2b15('0x17');_0x10e2a6[_0x2b15('0x12')]();}}break;case 0x1:logger['info']('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x329d6b='1';_0x427d73=_0x2b15('0x18');break;case 0x2:logger[_0x2b15('0xa')](_0x2b15('0x19'));_0x329d6b='2';_0x427d73=_0x2b15('0x19');break;case 0x9:logger[_0x2b15('0xa')](_0x2b15('0x1a'));_0x329d6b='9';_0x427d73=_0x2b15('0x1a');break;case 0xa:logger[_0x2b15('0xa')](_0x2b15('0x1b'));_0x329d6b='10';_0x427d73=_0x2b15('0x1b');break;case 0xb:logger[_0x2b15('0xa')](_0x2b15('0x1c'));_0x329d6b='11';_0x427d73=_0x2b15('0x1c');}}}catch(_0x2a2aab){logger[_0x2b15('0x10')]('Tilde\x20ASR\x20parse\x20error',JSON[_0x2b15('0xe')](_0x2a2aab));_0x10e2a6[_0x2b15('0x12')]();}}function _0x20bfe1(){logger[_0x2b15('0xa')]('Close\x20Tilde\x20ASR\x20socket');_0x4d30d5({'transcript':_0x9449c7,'confidence':_0x293e07,'status':_0x329d6b,'status_message':_0x427d73});}function _0x1a62fa(_0x3a6fd7){logger['error'](_0x2b15('0x1d'));if(!_[_0x2b15('0x1e')](_0x3a6fd7)){logger[_0x2b15('0x10')](_[_0x2b15('0x1f')](_0x3a6fd7)?JSON[_0x2b15('0xe')](_0x3a6fd7):_0x3a6fd7);}}_0x10e2a6['on']('open',_0x82ad9a);_0x10e2a6['on'](_0x2b15('0x20'),_0x26f320);_0x10e2a6['on'](_0x2b15('0xf'),_0x20bfe1);_0x10e2a6['on'](_0x2b15('0x10'),_0x1a62fa);});}; \ 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 0b88225..fb4f852 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 _0xf20b=['exports','./asr'];(function(_0x1accef,_0x28c73c){var _0x22410f=function(_0x4d3539){while(--_0x4d3539){_0x1accef['push'](_0x1accef['shift']());}};_0x22410f(++_0x28c73c);}(_0xf20b,0x1eb));var _0xbf20=function(_0x28f2b3,_0x355700){_0x28f2b3=_0x28f2b3-0x0;var _0x3a2d76=_0xf20b[_0x28f2b3];return _0x3a2d76;};var asr=require(_0xbf20('0x0'));module[_0xbf20('0x1')]={'asr':asr}; \ No newline at end of file +var _0x759d=['./asr'];(function(_0x47ae1f,_0x328d68){var _0x2a0233=function(_0x53dd41){while(--_0x53dd41){_0x47ae1f['push'](_0x47ae1f['shift']());}};_0x2a0233(++_0x328d68);}(_0x759d,0xb3));var _0xd759=function(_0x443929,_0x595cfe){_0x443929=_0x443929-0x0;var _0x5946fc=_0x759d[_0x443929];return _0x5946fc;};var asr=require(_0xd759('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index b650e94..b09604a 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 _0x3a6f=['EventEmitter','127.0.0.1','call','emit','E_AGI_ARGUMENT_PORT','createServer','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','inherits','util','net','events'];(function(_0x55821d,_0x27a22e){var _0x58ea8a=function(_0x5bdd3d){while(--_0x5bdd3d){_0x55821d['push'](_0x55821d['shift']());}};_0x58ea8a(++_0x27a22e);}(_0x3a6f,0x11b));var _0xf3a6=function(_0x52e860,_0x232b82){_0x52e860=_0x52e860-0x0;var _0x38f915=_0x3a6f[_0x52e860];return _0x38f915;};'use strict';var util=require(_0xf3a6('0x0'));var net=require(_0xf3a6('0x1'));var EventEmitter=require(_0xf3a6('0x2'))[_0xf3a6('0x3')];var AGIError=require('./error');var AGIChannel=require('./channel');var AGIServer=function(_0x149a6d,_0x54caab,_0x61860b){var _0x2a91a9=this,_0x149a6d=_0x149a6d||0x11dd,_0x54caab=_0x54caab||_0xf3a6('0x4'),_0x2e7803=null,_0x9bfafd=0x0;EventEmitter[_0xf3a6('0x5')](_0x2a91a9);function _0xbcc133(){if(!_0x149a6d){_0x2a91a9[_0xf3a6('0x6')]('error',new AGIError(_0xf3a6('0x7')));return![];}_0x2e7803=net[_0xf3a6('0x8')]();_0x2e7803['listen'](_0x149a6d,_0x54caab);_0x2e7803['on'](_0xf3a6('0x9'),function(){_0x2a91a9[_0xf3a6('0x6')](_0xf3a6('0x9'));});_0x2e7803['on'](_0xf3a6('0xa'),function(_0x3597ce){_0x2e7803[_0xf3a6('0xb')](function(_0x4f29b5,_0x323152){if(_0x4f29b5){_0x2a91a9['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0x4f29b5));}else if(_0x61860b&&_0x61860b<0x0){_0x2a91a9['emit'](_0xf3a6('0xc'),new AGIError(_0xf3a6('0xd')));_0x3597ce[_0xf3a6('0xe')]();}else if(_0x61860b&&_0x61860b>0x0&&_0x61860b<_0x323152){_0x9bfafd+=0x1;_0x2a91a9['emit'](_0xf3a6('0xc'),new AGIError(_0xf3a6('0xf'),_0x9bfafd));_0x3597ce[_0xf3a6('0xe')]();}else{var _0x172986=new AGIChannel(_0x3597ce);_0x172986['on'](_0xf3a6('0x10'),function(){_0x2a91a9[_0xf3a6('0x6')]('connection',_0x172986);});}});});_0x2e7803['on'](_0xf3a6('0xc'),function(_0x588e1b){_0x2a91a9['emit']('error',new AGIError(_0xf3a6('0x11'),_0x588e1b[_0xf3a6('0x12')]));});_0x2e7803['on'](_0xf3a6('0x13'),function(){_0x2a91a9[_0xf3a6('0x6')](_0xf3a6('0x13'),new AGIError(_0xf3a6('0x14')));});}process['nextTick'](function(){_0xbcc133();});};util[_0xf3a6('0x15')](AGIServer,EventEmitter);module['exports']=function(_0x374fc3,_0x5e9af7,_0x4778cb){return new AGIServer(_0x374fc3,_0x5e9af7,_0x4778cb);}; \ No newline at end of file +var _0x7ee2=['listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','net','events','EventEmitter','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer'];(function(_0x24679e,_0x22d9d7){var _0x291f21=function(_0x329529){while(--_0x329529){_0x24679e['push'](_0x24679e['shift']());}};_0x291f21(++_0x22d9d7);}(_0x7ee2,0x15d));var _0x27ee=function(_0x38ed57,_0x3ef332){_0x38ed57=_0x38ed57-0x0;var _0xf48082=_0x7ee2[_0x38ed57];return _0xf48082;};'use strict';var util=require('util');var net=require(_0x27ee('0x0'));var EventEmitter=require(_0x27ee('0x1'))[_0x27ee('0x2')];var AGIError=require(_0x27ee('0x3'));var AGIChannel=require(_0x27ee('0x4'));var AGIServer=function(_0x2d690f,_0x511fba,_0x449fde){var _0x31961a=this,_0x2d690f=_0x2d690f||0x11dd,_0x511fba=_0x511fba||_0x27ee('0x5'),_0x142099=null,_0x21683b=0x0;EventEmitter[_0x27ee('0x6')](_0x31961a);function _0x132305(){if(!_0x2d690f){_0x31961a[_0x27ee('0x7')](_0x27ee('0x8'),new AGIError(_0x27ee('0x9')));return![];}_0x142099=net[_0x27ee('0xa')]();_0x142099[_0x27ee('0xb')](_0x2d690f,_0x511fba);_0x142099['on'](_0x27ee('0xc'),function(){_0x31961a[_0x27ee('0x7')](_0x27ee('0xc'));});_0x142099['on'](_0x27ee('0xd'),function(_0x2207e1){_0x142099[_0x27ee('0xe')](function(_0x8d8a5c,_0x1bc51d){if(_0x8d8a5c){_0x31961a[_0x27ee('0x7')](_0x27ee('0x8'),new AGIError(_0x27ee('0xf'),_0x8d8a5c));}else if(_0x449fde&&_0x449fde<0x0){_0x31961a[_0x27ee('0x7')](_0x27ee('0x8'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x2207e1[_0x27ee('0x10')]();}else if(_0x449fde&&_0x449fde>0x0&&_0x449fde<_0x1bc51d){_0x21683b+=0x1;_0x31961a[_0x27ee('0x7')](_0x27ee('0x8'),new AGIError(_0x27ee('0x11'),_0x21683b));_0x2207e1[_0x27ee('0x10')]();}else{var _0x5f2431=new AGIChannel(_0x2207e1);_0x5f2431['on'](_0x27ee('0x12'),function(){_0x31961a[_0x27ee('0x7')](_0x27ee('0xd'),_0x5f2431);});}});});_0x142099['on'](_0x27ee('0x8'),function(_0x3115c3){_0x31961a[_0x27ee('0x7')](_0x27ee('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0x3115c3[_0x27ee('0x13')]));});_0x142099['on'](_0x27ee('0x14'),function(){_0x31961a['emit'](_0x27ee('0x14'),new AGIError(_0x27ee('0x15')));});}process[_0x27ee('0x16')](function(){_0x132305();});};util[_0x27ee('0x17')](AGIServer,EventEmitter);module['exports']=function(_0x574b63,_0x35cdc7,_0x2193dc){return new AGIServer(_0x574b63,_0x35cdc7,_0x2193dc);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 8fd5dc2..28c9ac7 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 _0xd456=['Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','getAndSetVariable','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','no\x20list\x20selected','delay','add','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','MRCPSynth','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20query\x20configured','replace','variable_id','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','client_email','no\x20private_key\x20configured','bot','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','out','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','substr','goal','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','awsPolly','aws\x20Polly\x20%s\x20file\x20created','streamFile','.wav','aws\x20Polly\x20is\x20unreachable','awslex','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','no\x20key\x20configured','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','appid','no\x20appid\x20configured','tilde\x20%s\x20file\x20created','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','context','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','success','failure','no\x20operation\x20configured','math\x20%s','operation','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','getVoiceQueue','indexOf','toLowerCase','QUEUE','macro','gosub','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','RECORDING_SAVENAME','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','sayDigits','digits','escape_digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','service','host','port','secure','authentication','auth','pass','template_id','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','getSmsAccount','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','path','odbc','randomstring','mustache','request-promise','../../config/logger','agi','../../config/environment','/var/opt/motion2/server/files','rawBody','getdigits','channel','rpc','mailRpc','getVariable','getVariableById','then','name','prototype','getVoiceQueueById','catch','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','%s/sounds/converted/%s','getQueryOdbc','error','info','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','createSmsMessage','createSquareDetailsReport','label','arg_1','createSquareRecording','uniqueid','callerid','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','scheduledAt','callback','toString','getPause','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','format','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','url','method','timeout','number','POST','PUT','toUpperCase','body','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','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','ispeechASR','isConfigured','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_bot_name','googleASR','google_asr_language','tildeASR','appsecret','clear','includes','clone','isString','replaceObjectAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','isArray','length','replaceAllVariables','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','retry','maxRetry','mrcpsynth'];(function(_0x1a828e,_0x55aa8d){var _0x4a03d9=function(_0x2e4ab7){while(--_0x2e4ab7){_0x1a828e['push'](_0x1a828e['shift']());}};_0x4a03d9(++_0x55aa8d);}(_0xd456,0x12a));var _0x6d45=function(_0x2491e0,_0x1ea0ad){_0x2491e0=_0x2491e0-0x0;var _0x21c7cb=_0xd456[_0x2491e0];return _0x21c7cb;};'use strict';var fs=require('fs');var path=require(_0x6d45('0x0'));var util=require('util');var _=require('lodash');var sh=require('shelljs');var odbc=require(_0x6d45('0x1'))();var rs=require(_0x6d45('0x2'));var moment=require('moment');var Mustache=require(_0x6d45('0x3'));var rp=require(_0x6d45('0x4'));var logger=require(_0x6d45('0x5'))(_0x6d45('0x6'));var config=require(_0x6d45('0x7'));var scripts=require('./scripts');var FILES_PATH=_0x6d45('0x8');var recursiveMapAttributes=['rawHeaders',_0x6d45('0x9')];var verticesWithRetry=['menu',_0x6d45('0xa'),'getsecretdigits'];var AGIVertices=function(_0x2c3965,_0x3a2e8a,_0x193a4f){this[_0x6d45('0xb')]=_0x2c3965;this[_0x6d45('0xc')]=_0x3a2e8a;this[_0x6d45('0xd')]=_0x193a4f;};AGIVertices['prototype'][_0x6d45('0xe')]=function(_0x51d4cc,_0x38c03b){this[_0x6d45('0xc')][_0x6d45('0xf')](_0x51d4cc)[_0x6d45('0x10')](function(_0x3e3f4c){_0x38c03b(null,_0x3e3f4c?_0x3e3f4c[_0x6d45('0x11')]:![]);})['catch'](function(_0x3c872e){_0x38c03b(_0x3c872e);});};AGIVertices[_0x6d45('0x12')]['getVoiceQueue']=function(_0x3ee20c,_0x5a4d04){this[_0x6d45('0xc')][_0x6d45('0x13')](_0x3ee20c)['then'](function(_0xaaef6a){_0x5a4d04(null,_0xaaef6a?_0xaaef6a[_0x6d45('0x11')]:![]);})[_0x6d45('0x14')](function(_0x1f39a5){_0x5a4d04(_0x1f39a5);});};AGIVertices['prototype'][_0x6d45('0x15')]=function(_0x20934c,_0x534fbc){this['rpc'][_0x6d45('0x16')](_0x20934c)[_0x6d45('0x10')](function(_0x28404b){_0x534fbc(null,_0x28404b?_0x28404b[_0x6d45('0x11')]:![]);})[_0x6d45('0x14')](function(_0x5a3855){_0x534fbc(_0x5a3855);});};AGIVertices[_0x6d45('0x12')][_0x6d45('0x17')]=function(_0x55ef27,_0x2cbb7f){this[_0x6d45('0xc')][_0x6d45('0x18')](_0x55ef27)['then'](function(_0x2b671c){_0x2cbb7f(null,_0x2b671c?_0x2b671c[_0x6d45('0x19')]:![]);})[_0x6d45('0x14')](function(_0x3540c0){_0x2cbb7f(_0x3540c0);});};AGIVertices[_0x6d45('0x12')][_0x6d45('0x1a')]=function(_0x55ddc6,_0x525427){this['rpc'][_0x6d45('0x1b')](_0x55ddc6)['then'](function(_0x39bc17){_0x525427(null,_0x39bc17?_0x39bc17[_0x6d45('0x11')]:![]);})[_0x6d45('0x14')](function(_0x32267c){_0x525427(_0x32267c);});};AGIVertices[_0x6d45('0x12')]['getTrunk']=function(_0x194698,_0x2959dd){this[_0x6d45('0xc')]['getTrunkById'](_0x194698)[_0x6d45('0x10')](function(_0x3f4a42){_0x2959dd(null,_0x3f4a42?_0x3f4a42[_0x6d45('0x11')]:![]);})[_0x6d45('0x14')](function(_0x45c442){_0x2959dd(_0x45c442);});};AGIVertices[_0x6d45('0x12')][_0x6d45('0x1c')]=function(_0x119a5e,_0x25ddbf){var _0x2c2739=this;this[_0x6d45('0xc')][_0x6d45('0x1d')](_0x119a5e)['then'](function(_0x597aa7){_0x25ddbf(null,_0x597aa7?_0x2c2739[_0x6d45('0x1e')](_0x597aa7[_0x6d45('0x1f')]):![]);})[_0x6d45('0x14')](function(_0x44add9){_0x25ddbf(_0x44add9);});};AGIVertices['prototype'][_0x6d45('0x20')]=function(_0x323e36,_0x5a9f28){this[_0x6d45('0xc')][_0x6d45('0x21')](_0x323e36)[_0x6d45('0x10')](function(_0x1a151e){_0x5a9f28(null,_0x1a151e?_0x1a151e:![]);})[_0x6d45('0x14')](function(_0x2e5151){_0x5a9f28(_0x2e5151);});};AGIVertices[_0x6d45('0x12')]['sendMailMessage']=function(_0x49f66c,_0xc09676,_0x31b6b0){this[_0x6d45('0xd')][_0x6d45('0x22')](_0x49f66c,_0xc09676)[_0x6d45('0x10')](function(){_0x31b6b0(null);})[_0x6d45('0x14')](function(_0x369507){_0x31b6b0(_0x369507);});};AGIVertices[_0x6d45('0x12')][_0x6d45('0x23')]=function(_0x24b5f7,_0x259ff6){this[_0x6d45('0xc')][_0x6d45('0x24')](_0x24b5f7)[_0x6d45('0x10')](function(_0xc2e1b9){if(_0xc2e1b9){if(_0xc2e1b9[_0x6d45('0x25')]){_0x259ff6(null,[_0xc2e1b9[_0x6d45('0x26')]]);}else{_0x259ff6(null,_[_0x6d45('0x27')](_0xc2e1b9[_0x6d45('0x28')],_0x6d45('0x26')));}}else{_0x259ff6(null,![]);}})[_0x6d45('0x14')](function(_0x28c488){_0x259ff6(_0x28c488);});};AGIVertices[_0x6d45('0x12')][_0x6d45('0x1e')]=function(_0x100fc5){return util['format'](_0x6d45('0x29'),FILES_PATH,_0x100fc5);};AGIVertices['prototype'][_0x6d45('0x2a')]=function(_0x29f160,_0x1427c7,_0x3ce655){odbc['open'](_0x29f160,function(_0x491ca6){if(_0x491ca6){logger[_0x6d45('0x2b')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x491ca6);_0x3ce655(_0x491ca6);}else{logger[_0x6d45('0x2c')]('ODBC\x20connection\x20successfully');odbc[_0x6d45('0x2d')](_0x1427c7,function(_0x5aad17,_0x1218c1){if(_0x5aad17){logger[_0x6d45('0x2c')](_0x6d45('0x2e'),_0x1427c7);_0x3ce655(_0x5aad17);}else{logger[_0x6d45('0x2c')](_0x6d45('0x2f'),_0x1427c7);odbc[_0x6d45('0x30')](function(_0x59c07f){if(_0x59c07f){logger[_0x6d45('0x2b')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x59c07f);}_0x3ce655(null,_0x1218c1);});}});}});};AGIVertices[_0x6d45('0x12')]['getSmsAccount']=function(_0x2c36d6,_0x497a95){this[_0x6d45('0xc')]['getSmsAccountById'](_0x2c36d6)[_0x6d45('0x10')](function(_0x3ea460){_0x497a95(null,_0x3ea460?_0x3ea460:![]);})[_0x6d45('0x14')](function(_0x275439){_0x497a95(_0x275439);});};AGIVertices[_0x6d45('0x12')][_0x6d45('0x31')]=function(_0x352689,_0x3e9ee3){this['rpc'][_0x6d45('0x31')](_0x352689)[_0x6d45('0x10')](function(_0x4898f6){_0x3e9ee3(null,_0x4898f6);})[_0x6d45('0x14')](function(_0x444317){_0x3e9ee3(_0x444317);});};AGIVertices[_0x6d45('0x12')][_0x6d45('0x32')]=function(_0xebb07e,_0xd19f53,_0x268a82){this[_0x6d45('0xc')][_0x6d45('0x32')]({'uniqueid':this[_0x6d45('0xb')]['uniqueid'],'node':_0xebb07e[_0x6d45('0x33')],'application':_0xebb07e['agicommand'],'data':_0xd19f53||null,'project_name':this[_0x6d45('0xb')][_0x6d45('0x34')],'callerid':this[_0x6d45('0xb')]['callerid']})['then'](function(_0x1edeca){if(_0x268a82){_0x268a82(null,_0x1edeca);}})[_0x6d45('0x14')](function(_0x20bc3c){if(_0x268a82){_0x268a82(_0x20bc3c);}});};AGIVertices[_0x6d45('0x12')][_0x6d45('0x35')]=function(_0x1542a4,_0x5bcb4c,_0x2d1f55,_0x1ff79d){this[_0x6d45('0xc')][_0x6d45('0x35')]({'uniqueid':this[_0x6d45('0xb')][_0x6d45('0x36')],'callerid':this[_0x6d45('0xb')][_0x6d45('0x37')],'calleridname':this['channel']['calleridname'],'context':this['channel']['context'],'extension':this[_0x6d45('0xb')][_0x6d45('0x38')],'priority':this['channel'][_0x6d45('0x39')],'accountcode':this[_0x6d45('0xb')][_0x6d45('0x3a')],'dnid':this['channel'][_0x6d45('0x3b')],'projectName':this[_0x6d45('0xb')][_0x6d45('0x34')],'saveName':_0x5bcb4c,'filename':_0x1542a4[_0x6d45('0x3c')]||_0x5bcb4c,'savePath':_0x2d1f55})[_0x6d45('0x10')](function(_0x2ceb09){_0x1ff79d(null,_0x2ceb09);})['catch'](function(_0x1eb7d6){_0x1ff79d(_0x1eb7d6);});};AGIVertices[_0x6d45('0x12')][_0x6d45('0x3d')]=function(_0x371d9d,_0x106588,_0x3d30ef,_0xa07a94,_0x2eec17){this[_0x6d45('0xc')][_0x6d45('0x3d')]({'uniqueid':this[_0x6d45('0xb')][_0x6d45('0x36')],'body':_0x371d9d,'direction':_0x106588,'providerName':_0x3d30ef,'providerResponse':_0xa07a94})['then'](function(_0x40c781){if(_0x2eec17){_0x2eec17(null,_0x40c781);}})[_0x6d45('0x14')](function(_0x539f61){if(_0x2eec17){_0x2eec17(_0x539f61);}});};AGIVertices[_0x6d45('0x12')][_0x6d45('0x3e')]=function(_0x46087c,_0x5a1999){this['rpc'][_0x6d45('0x3e')]({'firstName':_[_0x6d45('0x3f')](_0x46087c[_0x6d45('0x11')])||_[_0x6d45('0x40')](_0x46087c[_0x6d45('0x11')])?_0x6d45('0x41')+Math[_0x6d45('0x42')]():_0x46087c[_0x6d45('0x11')],'lastName':_['isEmpty'](_0x46087c[_0x6d45('0x43')])||_['isNil'](_0x46087c[_0x6d45('0x43')])?null:_0x46087c[_0x6d45('0x43')],'phone':_0x46087c[_0x6d45('0x44')],'ListId':_0x46087c['list_id'],'scheduledat':_0x46087c[_0x6d45('0x45')],'callbackUniqueid':this[_0x6d45('0xb')]['uniqueid'],'tags':_0x6d45('0x46'),'description':'Callback\x20scheduled\x20at\x20'+_0x46087c['scheduledAt'][_0x6d45('0x47')](),'priority':_0x46087c['callback_priority']})[_0x6d45('0x10')](function(_0x2bfe06){_0x5a1999(null,_0x2bfe06);})[_0x6d45('0x14')](function(_0x435bde){_0x5a1999(_0x435bde);});};AGIVertices['prototype'][_0x6d45('0x48')]=function(_0xd8ffbb,_0x19963){this['rpc']['getPauseById'](_0xd8ffbb)[_0x6d45('0x10')](function(_0x518ec1){_0x19963(null,_0x518ec1?_0x518ec1[_0x6d45('0x11')]:![]);})[_0x6d45('0x14')](function(_0x5ed46a){_0x19963(_0x5ed46a);});};AGIVertices[_0x6d45('0x12')][_0x6d45('0x49')]=function(_0x296ab0,_0x5edab3,_0x7fb9e){var _0x10b73b={'role':_0x6d45('0x4a')};_0x10b73b[_0x296ab0]=this[_0x6d45('0xb')][_0x6d45('0x37')];this[_0x6d45('0xc')]['agentPause'](_0x10b73b,_0x5edab3,this[_0x6d45('0xb')][_0x6d45('0x36')])[_0x6d45('0x10')](function(_0x28e7f6){_0x7fb9e(null,_[_0x6d45('0x40')](_0x28e7f6)?![]:!![]);})['catch'](function(_0x123a43){logger[_0x6d45('0x2b')](_0x123a43);_0x7fb9e(null,![]);});};AGIVertices[_0x6d45('0x12')][_0x6d45('0x4b')]=function(_0x19a17d,_0x52dcf5){var _0x1cb086={'role':_0x6d45('0x4a')};_0x1cb086[_0x19a17d]=this[_0x6d45('0xb')][_0x6d45('0x37')];this[_0x6d45('0xc')][_0x6d45('0x4b')](_0x1cb086)[_0x6d45('0x10')](function(_0xbf2183){_0x52dcf5(null,_[_0x6d45('0x40')](_0xbf2183)?![]:!![]);})[_0x6d45('0x14')](function(_0x2d88fc){logger[_0x6d45('0x2b')](_0x2d88fc);_0x52dcf5(null,![]);});};AGIVertices['prototype']['agentLogout']=function(_0x3607d9,_0xfee5d9){var _0x4a84dd={'role':_0x6d45('0x4a')};_0x4a84dd[_0x3607d9]=this[_0x6d45('0xb')]['callerid'];this['rpc'][_0x6d45('0x4c')](_0x4a84dd)[_0x6d45('0x10')](function(_0x44732a){_0xfee5d9(null,_['isNil'](_0x44732a)?![]:!![]);})[_0x6d45('0x14')](function(_0xac6761){logger[_0x6d45('0x2b')](_0xac6761);_0xfee5d9(null,![]);});};AGIVertices[_0x6d45('0x12')][_0x6d45('0x4d')]=function(_0x2ca91d,_0x196aad){var _0x56c091={'role':_0x6d45('0x4a')};_0x56c091[_0x2ca91d]=this['channel'][_0x6d45('0x37')];var _0x40dfc4=_0x2ca91d!=_0x6d45('0x4e')?util[_0x6d45('0x4f')](_0x6d45('0x50'),_0x6d45('0x51'),this[_0x6d45('0xb')][_0x6d45('0x37')]):undefined;this[_0x6d45('0xc')]['agentLogin'](_0x56c091,_0x40dfc4)[_0x6d45('0x10')](function(_0x10b803){_0x196aad(null,_[_0x6d45('0x40')](_0x10b803)?![]:!![]);})[_0x6d45('0x14')](function(_0x59995a){logger[_0x6d45('0x2b')](_0x59995a);_0x196aad(null,![]);});};AGIVertices['prototype'][_0x6d45('0x52')]=function(_0x55198f,_0x3148d9){sh[_0x6d45('0x53')](_[_0x6d45('0x54')](_0x55198f),function(_0x335bfa,_0x2543ec){var _0x4403e0=_0x2543ec['replace'](/(\r\n|\n|\r)/gm,'');_0x3148d9(null,_0x4403e0);});};AGIVertices[_0x6d45('0x12')][_0x6d45('0x55')]=function(_0x2ee935,_0x8d2eae){scripts['googleCloudTTS'](_0x2ee935[_0x6d45('0x56')],_0x2ee935[_0x6d45('0x57')]||_0x6d45('0x58'),_0x2ee935[_0x6d45('0x58')],_0x2ee935[_0x6d45('0x59')]||_0x6d45('0x5a'),_0x2ee935[_0x6d45('0x5b')]||_0x6d45('0x5c'),_0x2ee935[_0x6d45('0x5d')]||_0x6d45('0x5e'))[_0x6d45('0x10')](function(_0x3d6017){_0x8d2eae(null,_0x3d6017);})[_0x6d45('0x14')](function(_0x3e00f7){_0x8d2eae(_0x3e00f7);});};AGIVertices[_0x6d45('0x12')][_0x6d45('0x5f')]=function(_0x440f90,_0x15f657){scripts[_0x6d45('0x5f')](_0x440f90[_0x6d45('0x58')],_0x440f90[_0x6d45('0x60')]||'en',0x1)[_0x6d45('0x10')](function(_0x4157df){_0x15f657(null,_0x4157df);})[_0x6d45('0x14')](function(_0x1ce4a6){_0x15f657(_0x1ce4a6);});};AGIVertices['prototype']['restAPI']=function(_0x1a7a68,_0x5c1712){var _0x4e6f9a={'uri':_0x1a7a68[_0x6d45('0x61')],'method':_0x1a7a68[_0x6d45('0x62')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x1a7a68[_0x6d45('0x63')])===_0x6d45('0x64')&&parseInt(_0x1a7a68[_0x6d45('0x63')])>=0x1?parseInt(_0x1a7a68['timeout'])*0x3e8:0x5*0x3e8};if(_['includes']([_0x6d45('0x65'),_0x6d45('0x66')],_0x4e6f9a[_0x6d45('0x62')][_0x6d45('0x67')]())){try{_0x4e6f9a[_0x6d45('0x68')]=_0x1a7a68[_0x6d45('0x9')]?JSON['parse'](_0x1a7a68[_0x6d45('0x9')]):{};}catch(_0x191eb3){logger[_0x6d45('0x2b')](_0x6d45('0x69'),_0x191eb3);}}try{_0x4e6f9a[_0x6d45('0x6a')]=_0x1a7a68[_0x6d45('0x6b')]?JSON['parse'](_0x1a7a68[_0x6d45('0x6b')]):{};}catch(_0x5cbe0e){logger['error'](_0x6d45('0x6c'),_0x5cbe0e);}if(_0x1a7a68[_0x6d45('0x6d')]){try{var _0xb8bae6=require(_0x1a7a68[_0x6d45('0x6d')])[_0x6d45('0x6e')](this,_0x4e6f9a);_0x4e6f9a[_0x6d45('0x6f')]=Mustache[_0x6d45('0x70')](_0x1a7a68[_0x6d45('0x61')],_0xb8bae6,{},['$$','$$']);if(_0x4e6f9a['headers']){_0x4e6f9a['headers']=JSON['parse'](Mustache[_0x6d45('0x70')](JSON[_0x6d45('0x71')](_0x4e6f9a[_0x6d45('0x6a')]),_0xb8bae6,{},['$$','$$']));}if(_0x4e6f9a[_0x6d45('0x68')]){_0x4e6f9a[_0x6d45('0x68')]=JSON['parse'](Mustache['render'](JSON[_0x6d45('0x71')](_0x4e6f9a[_0x6d45('0x68')]),_0xb8bae6,{},['$$','$$']));}}catch(_0x156370){logger[_0x6d45('0x2b')](_0x6d45('0x72'),_0x156370);}}rp(_0x4e6f9a)[_0x6d45('0x10')](function(_0x56b02b){var _0x1f3d92={'statusCode':_0x56b02b[_0x6d45('0x73')]||0xc8,'statusMessage':_0x56b02b[_0x6d45('0x74')]||'OK','headers':_0x56b02b[_0x6d45('0x6a')]||{},'body':_0x56b02b[_0x6d45('0x68')]||{}};_0x5c1712(null,_0x1f3d92);})[_0x6d45('0x14')](function(_0x596910){var _0x366c28={'statusCode':_0x596910[_0x6d45('0x73')]||0x1f4,'statusMessage':_0x596910[_0x6d45('0x75')]||_0x6d45('0x76'),'headers':_0x596910[_0x6d45('0x77')][_0x6d45('0x6a')]||{},'body':_0x596910[_0x6d45('0x77')][_0x6d45('0x68')]||{}};_0x5c1712(null,_0x366c28);});};AGIVertices['prototype'][_0x6d45('0x78')]=function(_0x6483dc,_0x3b7919){scripts[_0x6d45('0x78')](this[_0x6d45('0xb')]['uniqueid'],_0x6483dc[_0x6d45('0x79')],_0x6483dc[_0x6d45('0x58')],_0x6483dc[_0x6d45('0x7a')]||'en')[_0x6d45('0x10')](function(_0x5716af){_0x3b7919(null,_0x5716af);})[_0x6d45('0x14')](function(_0x48120f){_0x3b7919(_0x48120f);});};AGIVertices['prototype']['googleDialogflowV2']=function(_0xbbfc70,_0x1d3aa8){scripts[_0x6d45('0x7b')](this[_0x6d45('0xb')][_0x6d45('0x36')],_0xbbfc70['dialogflowV2_project_id'],_0xbbfc70['client_email'],_0xbbfc70[_0x6d45('0x7c')],_0xbbfc70[_0x6d45('0x58')],_0xbbfc70[_0x6d45('0x7d')]||'en')['then'](function(_0x4f8993){_0x1d3aa8(null,_0x4f8993);})[_0x6d45('0x14')](function(_0x3dfdca){_0x1d3aa8(_0x3dfdca);});};AGIVertices[_0x6d45('0x12')][_0x6d45('0x7e')]=function(_0x3eb664,_0x2d82da){scripts['sestekNDA'](this[_0x6d45('0xb')],_0x3eb664)[_0x6d45('0x10')](function(_0x5cfbed){_0x2d82da(null,_0x5cfbed);})['catch'](function(_0x5ae989){_0x2d82da(_0x5ae989);});};AGIVertices[_0x6d45('0x12')][_0x6d45('0x7f')]=function(_0x4ee197,_0x4a417e){scripts['ispeechTTS'](_0x4ee197[_0x6d45('0x79')],_0x4ee197[_0x6d45('0x58')],_0x4ee197[_0x6d45('0x80')]||'en-US',_0x4ee197['speed'])[_0x6d45('0x10')](function(_0x17be2f){_0x4a417e(null,_0x17be2f);})[_0x6d45('0x14')](function(_0x765288){_0x4a417e(_0x765288);});};AGIVertices[_0x6d45('0x12')]['ispeechASR']=function(_0x28679a,_0x293d5b,_0x598dc3){scripts[_0x6d45('0x81')](_0x293d5b,_0x28679a[_0x6d45('0x79')],_0x28679a['ispeech_asr_language']||'en-US',this[_0x6d45('0x82')](_0x28679a['model'])?_0x28679a['model']:undefined)[_0x6d45('0x10')](function(_0x3691c1){_0x598dc3(null,_0x3691c1);})[_0x6d45('0x14')](function(_0x184838){_0x598dc3(_0x184838);});};AGIVertices[_0x6d45('0x12')]['awsPolly']=function(_0x3ac013,_0x29f9ed){scripts['awsPolly'](_0x3ac013[_0x6d45('0x83')],_0x3ac013[_0x6d45('0x84')],_0x3ac013[_0x6d45('0x85')],_0x3ac013[_0x6d45('0x86')]||_0x6d45('0x87'),_0x3ac013[_0x6d45('0x58')],_0x3ac013[_0x6d45('0x88')]||_0x6d45('0x58'))['then'](function(_0x4dcdcf){_0x29f9ed(null,_0x4dcdcf);})[_0x6d45('0x14')](function(_0x261e95){_0x29f9ed(_0x261e95);});};AGIVertices['prototype'][_0x6d45('0x89')]=function(_0x25b58b,_0x209426){scripts['awsLex'](this['channel']['uniqueid'],_0x25b58b[_0x6d45('0x83')],_0x25b58b['aws_secret_access_key'],_0x25b58b['aws_lex_region'],_0x25b58b[_0x6d45('0x58')],_0x25b58b[_0x6d45('0x8a')])[_0x6d45('0x10')](function(_0x5f4296){_0x209426(null,_0x5f4296);})['catch'](function(_0x1196dc){_0x209426(_0x1196dc);});};AGIVertices[_0x6d45('0x12')][_0x6d45('0x8b')]=function(_0x2b53c2,_0x2cf046,_0xca5a97){scripts['googleASR'](_0x2cf046,_0x2b53c2['key'],_0x2b53c2[_0x6d45('0x8c')]||_0x6d45('0x5a'))[_0x6d45('0x10')](function(_0x8e5d90){_0xca5a97(null,_0x8e5d90);})[_0x6d45('0x14')](function(_0x1875ad){_0xca5a97(_0x1875ad);});};AGIVertices[_0x6d45('0x12')][_0x6d45('0x8d')]=function(_0x45a645,_0x3cd6c1,_0x55fe99){scripts[_0x6d45('0x8d')](_0x3cd6c1,_0x45a645['appid'],_0x45a645[_0x6d45('0x8e')],_0x45a645['uri'])['then'](function(_0x37c738){_0x55fe99(null,_0x37c738);})['catch'](function(_0x387019){_0x55fe99(_0x387019);});};AGIVertices[_0x6d45('0x12')][_0x6d45('0x8f')]=function(_0x30dac7){var _0x577d82=_[_0x6d45('0x90')](verticesWithRetry,_0x30dac7['agicommand'])?_0x30dac7:_[_0x6d45('0x91')](_0x30dac7);for(var _0x27e33a in _0x577d82){if(_0x577d82['hasOwnProperty'](_0x27e33a)){if(_0x577d82[_0x27e33a]&&_[_0x6d45('0x92')](_0x577d82[_0x27e33a])){if(_[_0x6d45('0x90')](recursiveMapAttributes,_0x27e33a)){_0x577d82[_0x27e33a]=this[_0x6d45('0x93')](_0x577d82[_0x27e33a]);}else{_0x577d82[_0x27e33a]=this['replaceAllVariables'](_0x577d82[_0x27e33a]);}}}}return _0x577d82;};AGIVertices[_0x6d45('0x12')][_0x6d45('0x94')]=function(_0x41519e){for(var _0x3dece0 in _0x41519e){if(_0x41519e[_0x6d45('0x95')](_0x3dece0)){if(_[_0x6d45('0x96')](_0x41519e[_0x3dece0])){this['recursiveNodeIndex'](_0x41519e[_0x3dece0]);}else if(_[_0x6d45('0x97')](_0x41519e[_0x3dece0])){for(var _0x10cd27=0x0;_0x10cd27<_0x41519e[_0x3dece0][_0x6d45('0x98')];_0x10cd27++){this[_0x6d45('0x94')](_0x41519e[_0x3dece0][_0x10cd27]);}}else if(_['isString'](_0x41519e[_0x3dece0])){_0x41519e[_0x3dece0]=this[_0x6d45('0x99')](_0x41519e[_0x3dece0]);}}}};AGIVertices[_0x6d45('0x12')][_0x6d45('0x9a')]=function(_0x29351a,_0x2ddbaf){for(var _0x349b67 in _0x29351a){if(_0x29351a['hasOwnProperty'](_0x349b67)){if(_[_0x6d45('0x96')](_0x29351a[_0x349b67])){if(!_['isEmpty'](_0x29351a[_0x349b67])){this[_0x6d45('0x9a')](_0x29351a[_0x349b67],util['format'](_0x6d45('0x9b'),_0x2ddbaf,_0x349b67));}}else if(_['isArray'](_0x29351a[_0x349b67])){for(var _0x186daf=0x0;_0x186daf<_0x29351a[_0x349b67]['length'];_0x186daf++){this[_0x6d45('0x9a')](_0x29351a[_0x349b67][_0x186daf],util[_0x6d45('0x4f')](_0x6d45('0x9b'),_0x2ddbaf,_0x349b67+'['+_0x186daf+']'));}}else{if(!_[_0x6d45('0x40')](_0x29351a[_0x349b67])){this[_0x6d45('0xb')][_0x6d45('0x9c')](util[_0x6d45('0x4f')](_0x6d45('0x9b'),_0x2ddbaf,_0x349b67),_0x29351a[_0x349b67]);}}}}};AGIVertices[_0x6d45('0x12')]['replaceObjectAllVariables']=function(_0x361d54){try{var _0x44217b=JSON['parse'](_0x361d54);this[_0x6d45('0x94')](_0x44217b);return JSON[_0x6d45('0x71')](_0x44217b);}catch(_0x249dc6){return this[_0x6d45('0x99')](_0x361d54);}};AGIVertices['prototype'][_0x6d45('0x99')]=function(_0x1fcb8e){var _0x142ddf=_0x1fcb8e[_0x6d45('0x9d')]('{');for(var _0x468df6=0x1;_0x468df6<_0x142ddf['length'];_0x468df6+=0x1){var _0x5d7f8c=_0x142ddf[_0x468df6][_0x6d45('0x9d')]('}');if(_0x5d7f8c[_0x6d45('0x98')]>0x1){_0x1fcb8e=_0x1fcb8e[_0x6d45('0x9e')]('{'+_0x5d7f8c[0x0]+'}',this[_0x6d45('0xb')][_0x6d45('0xe')](_0x5d7f8c[0x0])[_0x6d45('0x9f')]||_0x5d7f8c[0x0]);}}if(_0x142ddf[_0x6d45('0x98')]===0x1){return _0x1fcb8e['toString']();}return this['replaceAllVariables'](_0x1fcb8e);};AGIVertices[_0x6d45('0x12')]['getAndSetVariable']=function(_0x5aecce,_0x1301f9){var _0x1a78ed=this[_0x6d45('0xb')][_0x6d45('0xe')](_0x5aecce);if(_0x1a78ed[_0x6d45('0xa0')]===-0x1){return _0x1a78ed;}logger[_0x6d45('0x2c')](util['format'](_0x6d45('0xa1'),_0x1301f9,_0x1a78ed['extra']));return this[_0x6d45('0xb')][_0x6d45('0x9c')](_0x1301f9,_0x1a78ed['extra']);};AGIVertices[_0x6d45('0x12')][_0x6d45('0x82')]=function(_0x450d0e){return _0x450d0e&&_0x450d0e!=='0'&&_0x450d0e!=='-1'&&_0x450d0e!=='';};AGIVertices[_0x6d45('0x12')]['maxRetry']=function(_0xfafb74){this[_0x6d45('0x32')][_0x6d45('0x6e')](this,_0xfafb74,'-');_0xfafb74[_0x6d45('0xa2')]=_0xfafb74[_0x6d45('0xa3')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x6d45('0xa4')]=function(_0x3bbc37){logger['info'](util[_0x6d45('0x4f')](_0x6d45('0xa5'),_0x3bbc37[_0x6d45('0x33')]));if(!this[_0x6d45('0x82')](_0x3bbc37[_0x6d45('0x58')])){return this[_0x6d45('0xb')]['noop'](_0x6d45('0xa6'));}var _0x75d9b5='\x22'+_0x3bbc37[_0x6d45('0x58')]+'\x22';if(this[_0x6d45('0x82')](_0x3bbc37[_0x6d45('0x77')])){_0x75d9b5+=','+_0x3bbc37['options'];}var _0x5ce360=this[_0x6d45('0xb')][_0x6d45('0x53')]('MRCPSynth',_0x75d9b5);if(_0x5ce360[_0x6d45('0xa0')]===-0x1){return _0x5ce360;}return this[_0x6d45('0xb')][_0x6d45('0xa7')](util[_0x6d45('0x4f')](_0x6d45('0xa8'),_0x75d9b5));};AGIVertices[_0x6d45('0x12')][_0x6d45('0xa9')]=function(_0x3241ad){logger[_0x6d45('0x2c')](util[_0x6d45('0x4f')](_0x6d45('0xaa'),_0x3241ad['label']));if(!this[_0x6d45('0x82')](_0x3241ad[_0x6d45('0xab')])){return this[_0x6d45('0xb')][_0x6d45('0xa7')]('no\x20grammar\x20configured');}var _0x10639b=_0x3241ad[_0x6d45('0xab')];if(this[_0x6d45('0x82')](_0x3241ad[_0x6d45('0x77')])){_0x10639b+=','+_0x3241ad[_0x6d45('0x77')];}var _0x53a16e=this[_0x6d45('0xb')][_0x6d45('0x53')](_0x6d45('0xac'),_0x10639b);if(_0x53a16e['result']===-0x1){return _0x53a16e;}var _0x1a4c16=this[_0x6d45('0xad')]('RECOG_CONFIDENCE()',_0x6d45('0xae'));if(_0x1a4c16[_0x6d45('0xa0')]===-0x1){return _0x1a4c16;}var _0x3deb34=this[_0x6d45('0xad')](_0x6d45('0xaf'),_0x6d45('0xb0'));if(_0x3deb34[_0x6d45('0xa0')]===-0x1){return _0x3deb34;}var _0x24c905=this[_0x6d45('0xad')](_0x6d45('0xb1'),_0x6d45('0xb2'));if(_0x24c905[_0x6d45('0xa0')]===-0x1){return _0x24c905;}return this[_0x6d45('0xb')][_0x6d45('0xa7')](util[_0x6d45('0x4f')](_0x6d45('0xb3'),_0x10639b));};AGIVertices['prototype'][_0x6d45('0x6')]=function(_0x5f2ffd){logger[_0x6d45('0x2c')](util[_0x6d45('0x4f')](_0x6d45('0xb4'),_0x5f2ffd[_0x6d45('0x33')]));return this[_0x6d45('0xb')][_0x6d45('0x6')]([_0x5f2ffd[_0x6d45('0xb5')],_0x5f2ffd['args']]);};AGIVertices[_0x6d45('0x12')][_0x6d45('0xb6')]=function(_0xf050b8){logger[_0x6d45('0x2c')](util[_0x6d45('0x4f')](_0x6d45('0xb7'),_0xf050b8[_0x6d45('0x33')]));if(this[_0x6d45('0x82')](_0xf050b8[_0x6d45('0x63')])){logger[_0x6d45('0x2c')](util[_0x6d45('0x4f')]('Wait\x20%s\x20seconds\x20before\x20answer',_0xf050b8[_0x6d45('0x63')]));var _0x429ff2=this[_0x6d45('0xb')][_0x6d45('0xb8')](_0xf050b8[_0x6d45('0x63')]);if(_0x429ff2[_0x6d45('0xa0')]===-0x1){return _0x429ff2;}}return this['channel'][_0x6d45('0xb6')]();};AGIVertices[_0x6d45('0x12')][_0x6d45('0x46')]=function(_0x1335d0){logger[_0x6d45('0x2c')](util[_0x6d45('0x4f')](_0x6d45('0xb9'),_0x1335d0[_0x6d45('0x33')]));if(!this['isConfigured'](_0x1335d0[_0x6d45('0xba')])){return this[_0x6d45('0xb')][_0x6d45('0x2b')](_0x1335d0,_0x6d45('0xbb'));}_0x1335d0['scheduledAt']=moment();if(this[_0x6d45('0x82')](_0x1335d0[_0x6d45('0xbc')])){_0x1335d0['scheduledAt']=moment()[_0x6d45('0xbd')](_0x1335d0['delay'],'minutes');}if(!this[_0x6d45('0x82')](_0x1335d0[_0x6d45('0xbe')])){_0x1335d0[_0x6d45('0xbe')]=0x2;}this['createCmContact']['sync'](this,_0x1335d0);return this[_0x6d45('0xb')][_0x6d45('0xa7')](util[_0x6d45('0x4f')](_0x6d45('0xbf'),_0x1335d0[_0x6d45('0x44')],_0x1335d0[_0x6d45('0xba')],_0x1335d0[_0x6d45('0x45')]));};AGIVertices[_0x6d45('0x12')][_0x6d45('0xc0')]=function(_0x3c4c99){logger[_0x6d45('0x2c')](util[_0x6d45('0x4f')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x3c4c99[_0x6d45('0x33')]));var _0x4c329b=this['channel'][_0x6d45('0x53')](_0x3c4c99[_0x6d45('0xc1')],_0x3c4c99[_0x6d45('0x77')]);if(_0x4c329b[_0x6d45('0xa0')]===-0x1){return _0x4c329b;}return this[_0x6d45('0xb')][_0x6d45('0xa7')](util['format'](_0x6d45('0xc2'),_0x3c4c99[_0x6d45('0xc1')],_0x3c4c99[_0x6d45('0x77')]));};AGIVertices['prototype'][_0x6d45('0xc3')]=function(_0x2feaad){logger[_0x6d45('0x2c')](util['format']('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x2feaad['label']));if(!this[_0x6d45('0x82')](_0x2feaad['text'])){return this[_0x6d45('0xb')][_0x6d45('0xa7')](_0x6d45('0xa6'));}var _0x4fb3cf='\x22'+_0x2feaad['text']+'\x22';if(this[_0x6d45('0x82')](_0x2feaad[_0x6d45('0x77')])){_0x4fb3cf+=','+_0x2feaad[_0x6d45('0x77')];}var _0x1c7bb9=this[_0x6d45('0xb')]['exec'](_0x6d45('0xc4'),_0x4fb3cf);if(_0x1c7bb9[_0x6d45('0xa0')]===-0x1){return _0x1c7bb9;}return this[_0x6d45('0xb')][_0x6d45('0xa7')](util[_0x6d45('0x4f')](_0x6d45('0xa8'),_0x4fb3cf));};AGIVertices[_0x6d45('0x12')][_0x6d45('0xc5')]=function(_0xd52f2b){logger[_0x6d45('0x2c')](util[_0x6d45('0x4f')](_0x6d45('0xc6'),_0xd52f2b[_0x6d45('0x33')]));if(!this[_0x6d45('0x82')](_0xd52f2b[_0x6d45('0x58')])){return this['channel'][_0x6d45('0xa7')](_0x6d45('0xa6'));}var _0x2f2b36='\x22'+_0xd52f2b['text']+'\x22';if(this[_0x6d45('0x82')](_0xd52f2b[_0x6d45('0x77')])){_0x2f2b36+=','+_0xd52f2b['options'];}var _0x4017fd=this[_0x6d45('0xb')][_0x6d45('0x53')]('MRCPSynth',_0x2f2b36);if(_0x4017fd[_0x6d45('0xa0')]===-0x1){return _0x4017fd;}return this[_0x6d45('0xb')][_0x6d45('0xa7')](util[_0x6d45('0x4f')]('Executed\x20command\x20MRCPSynth\x20%s',_0x2f2b36));};AGIVertices[_0x6d45('0x12')][_0x6d45('0xc7')]=function(_0xe49d35){logger['info'](util[_0x6d45('0x4f')](_0x6d45('0xc8'),_0xe49d35[_0x6d45('0x33')]));if(!this[_0x6d45('0x82')](_0xe49d35[_0x6d45('0xab')])){return this[_0x6d45('0xb')][_0x6d45('0xa7')](_0x6d45('0xc9'));}var _0x32d01c=_0xe49d35['grammar'];if(this[_0x6d45('0x82')](_0xe49d35['options'])){_0x32d01c+=','+_0xe49d35[_0x6d45('0x77')];}var _0x3d921a=this['channel'][_0x6d45('0x53')]('MRCPRecog',_0x32d01c);if(_0x3d921a[_0x6d45('0xa0')]===-0x1){return _0x3d921a;}var _0x16ef04=this[_0x6d45('0xad')](_0x6d45('0xca'),_0x6d45('0xcb'));if(_0x16ef04[_0x6d45('0xa0')]===-0x1){return _0x16ef04;}var _0x544d5a=this[_0x6d45('0xad')](_0x6d45('0xaf'),_0x6d45('0xcc'));if(_0x544d5a['result']===-0x1){return _0x544d5a;}var _0x5005c6=this[_0x6d45('0xad')](_0x6d45('0xb1'),'LUMENVOX_ASR_INSTANCE');if(_0x5005c6[_0x6d45('0xa0')]===-0x1){return _0x5005c6;}return this[_0x6d45('0xb')][_0x6d45('0xa7')](util[_0x6d45('0x4f')](_0x6d45('0xb3'),_0x32d01c));};AGIVertices[_0x6d45('0x12')][_0x6d45('0xcd')]=function(_0x1aad24){logger[_0x6d45('0x2c')](util[_0x6d45('0x4f')](_0x6d45('0xce'),_0x1aad24['label']));if(!this[_0x6d45('0x82')](_0x1aad24[_0x6d45('0xab')])){return this[_0x6d45('0xb')][_0x6d45('0xa7')]('no\x20grammar\x20configured');}var _0x9d3b8c=_0x1aad24['grammar'];if(this[_0x6d45('0x82')](_0x1aad24[_0x6d45('0x77')])){_0x9d3b8c+=','+_0x1aad24[_0x6d45('0x77')];}var _0x584da1=this[_0x6d45('0xb')]['exec'](_0x6d45('0xac'),_0x9d3b8c);if(_0x584da1[_0x6d45('0xa0')]===-0x1){return _0x584da1;}var _0x7570d9=this[_0x6d45('0xad')](_0x6d45('0xca'),_0x6d45('0xcf'));if(_0x7570d9[_0x6d45('0xa0')]===-0x1){return _0x7570d9;}var _0x5b719f=this[_0x6d45('0xad')](_0x6d45('0xaf'),_0x6d45('0xd0'));if(_0x5b719f[_0x6d45('0xa0')]===-0x1){return _0x5b719f;}var _0x440668=this[_0x6d45('0xad')](_0x6d45('0xb1'),_0x6d45('0xd1'));if(_0x440668[_0x6d45('0xa0')]===-0x1){return _0x440668;}return this[_0x6d45('0xb')][_0x6d45('0xa7')](util[_0x6d45('0x4f')]('Executed\x20command\x20MRCPRecog\x20%s',_0x9d3b8c));};AGIVertices[_0x6d45('0x12')]['database']=function(_0x386b12){logger['info'](util[_0x6d45('0x4f')](_0x6d45('0xd2'),_0x386b12[_0x6d45('0x33')]));if(!this[_0x6d45('0x82')](_0x386b12[_0x6d45('0xd3')])){return this['channel'][_0x6d45('0x2b')](_0x386b12,_0x6d45('0xd4'));}var _0x173c17=this[_0x6d45('0x17')][_0x6d45('0x6e')](this,_0x386b12[_0x6d45('0xd3')]);if(!_0x173c17){return this[_0x6d45('0xb')][_0x6d45('0x2b')](_0x386b12,'no\x20odbc\x20database\x20found');}if(!this[_0x6d45('0x82')](_0x386b12[_0x6d45('0x2d')])){return this[_0x6d45('0xb')]['error'](_0x386b12,_0x6d45('0xd5'));}var _0x1fb037=_0x386b12['query'][_0x6d45('0xd6')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x6d45('0xa7')](util['format']('query:\x20%s',_0x1fb037));var _0x1e36d3=this[_0x6d45('0x2a')]['sync'](this,_0x173c17,_0x1fb037);this['createSquareDetailsReport'][_0x6d45('0x6e')](this,_0x386b12,_0x1fb037);if(!this['isConfigured'](_0x386b12[_0x6d45('0xd7')])){return this['channel'][_0x6d45('0xa7')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x400bc2=this['getVariable']['sync'](this,_0x386b12[_0x6d45('0xd7')]);if(!_0x400bc2){return this[_0x6d45('0xb')][_0x6d45('0x2b')](_0x386b12,_0x6d45('0xd8'));}var _0x2ade08=this;_0x1e36d3[_0x6d45('0xd9')](function(_0x4fade2,_0x3bf2){Object[_0x6d45('0xda')](_0x4fade2)[_0x6d45('0xd9')](function(_0x3868b7){_0x2ade08['channel'][_0x6d45('0x9c')](util[_0x6d45('0x4f')](_0x6d45('0xdb'),_0x400bc2,_0x3bf2,_0x3868b7),_0x4fade2[_0x3868b7]);});});this[_0x6d45('0xb')][_0x6d45('0x9c')](util['format'](_0x6d45('0xdc'),_0x400bc2),_0x1e36d3[_0x6d45('0x98')]);return this[_0x6d45('0xb')][_0x6d45('0xa7')](util[_0x6d45('0x4f')](_0x6d45('0xdd'),_0x400bc2));};AGIVertices[_0x6d45('0x12')][_0x6d45('0xde')]=function(_0x468768){logger['debug'](util['format'](_0x6d45('0xdf'),_0x468768[_0x6d45('0x33')]));if(!this['isConfigured'](_0x468768['sip_id'])){return this['channel'][_0x6d45('0x2b')](_0x468768,_0x6d45('0xe0'));}var _0x6532dd=this[_0x6d45('0x1a')][_0x6d45('0x6e')](this,_0x468768[_0x6d45('0xe1')]);if(!_0x6532dd){return this['channel'][_0x6d45('0x2b')](_0x468768,_0x6d45('0xe2'));}var _0xefef2f=this[_0x6d45('0xb')][_0x6d45('0x53')](_0x6d45('0xe3'),[util[_0x6d45('0x4f')](_0x6d45('0xe4'),_0x6532dd),_0x468768[_0x6d45('0x63')],_0x468768[_0x6d45('0xe5')],_0x468768[_0x6d45('0x61')]]);if(_0xefef2f[_0x6d45('0xa0')]===-0x1){return _0xefef2f;}return this['channel']['noop'](util[_0x6d45('0x4f')](_0x6d45('0xe6'),'DIAL'));};AGIVertices['prototype'][_0x6d45('0xe7')]=function(_0x21090e){logger['info'](util[_0x6d45('0x4f')](_0x6d45('0xe8'),_0x21090e[_0x6d45('0x33')]));if(!this[_0x6d45('0x82')](_0x21090e[_0x6d45('0x79')])){return this[_0x6d45('0xb')]['noop']('no\x20key\x20configured');}if(!this[_0x6d45('0x82')](_0x21090e['text'])){return this[_0x6d45('0xb')]['noop']('no\x20text\x20configured');}this[_0x6d45('0xb')]['bot']=!![];this[_0x6d45('0x32')](_0x21090e);this[_0x6d45('0x3d')](_0x21090e[_0x6d45('0x58')],'in','','');this[_0x6d45('0xb')][_0x6d45('0xa7')](util[_0x6d45('0x4f')](_0x6d45('0xe9'),_0x21090e[_0x6d45('0x58')]));var _0x5a4f62=this['googleDialogflow'][_0x6d45('0x6e')](this,_0x21090e);if(_0x5a4f62){for(var _0x30075d in _0x5a4f62){if(_0x5a4f62[_0x6d45('0x95')](_0x30075d)){this['channel'][_0x6d45('0x9c')](util[_0x6d45('0x4f')](_0x6d45('0xea'),_0x30075d[_0x6d45('0x67')]()),_0x5a4f62[_0x30075d]);}}this[_0x6d45('0x3d')](_0x5a4f62[_0x6d45('0xeb')],'out','dialogflow','');return this[_0x6d45('0xb')]['noop'](util[_0x6d45('0x4f')]('Dialogflow\x20Result\x20%s',_0x5a4f62[_0x6d45('0xeb')]));}return this[_0x6d45('0xb')]['error'](_0x21090e,_0x6d45('0xec'));};AGIVertices[_0x6d45('0x12')][_0x6d45('0xed')]=function(_0x59961a){logger[_0x6d45('0x2c')](util[_0x6d45('0x4f')](_0x6d45('0xee'),_0x59961a[_0x6d45('0x33')]));if(!this[_0x6d45('0x82')](_0x59961a[_0x6d45('0xef')])){return this['channel'][_0x6d45('0xa7')]('no\x20project_id\x20configured');}if(!this['isConfigured'](_0x59961a[_0x6d45('0xf0')])){return this['channel'][_0x6d45('0xa7')]('no\x20client_email\x20configured');}if(!this['isConfigured'](_0x59961a[_0x6d45('0x7c')])){return this[_0x6d45('0xb')]['noop'](_0x6d45('0xf1'));}if(!this[_0x6d45('0x82')](_0x59961a[_0x6d45('0x7d')])){return this[_0x6d45('0xb')][_0x6d45('0xa7')]('no\x20anguage\x20configured');}if(!this[_0x6d45('0x82')](_0x59961a[_0x6d45('0x58')])){return this[_0x6d45('0xb')][_0x6d45('0xa7')](_0x6d45('0xa6'));}this['channel'][_0x6d45('0xf2')]=!![];this['createSquareDetailsReport'](_0x59961a);this[_0x6d45('0x3d')](_0x59961a[_0x6d45('0x58')],'in','','');this[_0x6d45('0xb')][_0x6d45('0xa7')](util[_0x6d45('0x4f')](_0x6d45('0xf3'),_0x59961a[_0x6d45('0x58')]));var _0x443917=this['googleDialogflowV2']['sync'](this,_0x59961a);if(_0x443917){for(var _0x4a0875 in _0x443917){if(_0x443917[_0x6d45('0x95')](_0x4a0875)){if(_0x4a0875!==_0x6d45('0xf4')){this[_0x6d45('0xb')][_0x6d45('0x9c')](util[_0x6d45('0x4f')](_0x6d45('0xea'),_0x4a0875[_0x6d45('0x67')]()),_0x443917[_0x4a0875]);}}}this[_0x6d45('0x3d')](_0x443917[_0x6d45('0xeb')],'out',_0x6d45('0xed'),_0x443917[_0x6d45('0xf4')]);return this[_0x6d45('0xb')][_0x6d45('0xa7')](util[_0x6d45('0x4f')](_0x6d45('0xf5'),_0x443917[_0x6d45('0xeb')]));}return this[_0x6d45('0xb')][_0x6d45('0x2b')](_0x59961a,'DialogflowV2\x20is\x20unreachable');};AGIVertices['prototype'][_0x6d45('0xf6')]=function(_0x1443cf){logger[_0x6d45('0x2c')](util[_0x6d45('0x4f')](_0x6d45('0xf7'),_0x1443cf[_0x6d45('0x33')]));if(!this[_0x6d45('0x82')](_0x1443cf[_0x6d45('0xf8')])){return this[_0x6d45('0xb')][_0x6d45('0xa7')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x6d45('0x82')](_0x1443cf[_0x6d45('0xf9')])){return this[_0x6d45('0xb')][_0x6d45('0xa7')]('no\x20username\x20configured');}if(!this['isConfigured'](_0x1443cf['password'])){return this[_0x6d45('0xb')][_0x6d45('0xa7')](_0x6d45('0xfa'));}if(!this[_0x6d45('0x82')](_0x1443cf[_0x6d45('0xfb')])){return this[_0x6d45('0xb')][_0x6d45('0xa7')](_0x6d45('0xa6'));}this[_0x6d45('0xb')][_0x6d45('0xf2')]=!![];this['createSquareDetailsReport'](_0x1443cf);this[_0x6d45('0x3d')](_0x1443cf[_0x6d45('0x58')],'in','','');this[_0x6d45('0xb')]['noop'](util[_0x6d45('0x4f')](_0x6d45('0xfc'),_0x1443cf['text']));var _0x215982=this[_0x6d45('0x7e')][_0x6d45('0x6e')](this,_0x1443cf);if(_0x215982){for(var _0x3e9e8d in _0x215982){if(_0x215982[_0x6d45('0x95')](_0x3e9e8d)){this['channel'][_0x6d45('0x9c')](util[_0x6d45('0x4f')](_0x6d45('0xfd'),_0x3e9e8d[_0x6d45('0x67')]()),_0x215982[_0x3e9e8d]);}}this['createSquareMessage'](_0x215982[_0x6d45('0xeb')],_0x6d45('0xfe'),_0x6d45('0xf6'),'');if(_0x215982[_0x6d45('0xff')]){this['channel'][_0x6d45('0xa7')](util[_0x6d45('0x4f')](_0x6d45('0x100'),_0x215982[_0x6d45('0xff')]));var _0x1c75b0=this['channel']['streamFile'](_0x215982[_0x6d45('0xff')]);try{fs[_0x6d45('0x101')](_0x215982['audiofile']+'.wav');}catch(_0x32ba12){logger[_0x6d45('0x2b')](_0x32ba12);}return _0x1c75b0;}else{return this[_0x6d45('0xb')][_0x6d45('0xa7')](util['format'](_0x6d45('0x102'),_0x215982[_0x6d45('0xeb')]));}}return this['channel'][_0x6d45('0x2b')](_0x1443cf,_0x6d45('0x103'));};AGIVertices[_0x6d45('0x12')][_0x6d45('0x104')]=function(_0x28975c){logger[_0x6d45('0x2c')](util[_0x6d45('0x4f')](_0x6d45('0x105'),_0x28975c[_0x6d45('0x33')]));return this[_0x6d45('0xb')][_0x6d45('0xa7')](_0x6d45('0x104'));};AGIVertices[_0x6d45('0x12')][_0x6d45('0x106')]=function(_0x11477c){logger[_0x6d45('0x2c')](util[_0x6d45('0x4f')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x11477c['label']));var _0x5d4a6e='';if(_0x11477c[_0x6d45('0x107')]){if(!this[_0x6d45('0x82')](_0x11477c[_0x6d45('0x107')])){return this[_0x6d45('0xb')][_0x6d45('0x2b')](_0x11477c,_0x6d45('0x108'));}else{var _0x57e893=parseInt(_0x11477c[_0x6d45('0x107')],0xa);if(isNaN(_0x57e893)){_0x5d4a6e=_0x11477c[_0x6d45('0x107')];}else{_0x5d4a6e=this['getTrunk']['sync'](this,_0x11477c[_0x6d45('0x107')]);if(!_0x5d4a6e){return this[_0x6d45('0xb')][_0x6d45('0x2b')](_0x11477c,_0x6d45('0x109'));}}}}else if(_0x11477c[_0x6d45('0x10a')]){_0x5d4a6e=_0x11477c[_0x6d45('0x10a')];}else{return this[_0x6d45('0xb')]['error'](_0x11477c,_0x6d45('0x108'));}var _0x2f3d50=this[_0x6d45('0xb')][_0x6d45('0x53')]('DIAL',[util[_0x6d45('0x4f')](_0x6d45('0x10b'),_0x5d4a6e,_0x11477c[_0x6d45('0x44')]),_0x11477c[_0x6d45('0x63')],_0x11477c[_0x6d45('0xe5')],_0x11477c[_0x6d45('0x61')]]);if(_0x2f3d50[_0x6d45('0xa0')]===-0x1){return _0x2f3d50;}return this[_0x6d45('0xb')][_0x6d45('0xa7')](util['format'](_0x6d45('0xe6'),_0x6d45('0xe3')));};AGIVertices['prototype'][_0x6d45('0x10c')]=function(_0x42c264){logger[_0x6d45('0x2c')](util[_0x6d45('0x4f')](_0x6d45('0x10d'),_0x42c264[_0x6d45('0x33')]));return this[_0x6d45('0xb')][_0x6d45('0xa7')](_0x6d45('0x10c'));};AGIVertices['prototype'][_0x6d45('0xa')]=function(_0x4a63dd){logger['info'](util[_0x6d45('0x4f')](_0x6d45('0x10e'),_0x4a63dd[_0x6d45('0x33')]));if(_0x4a63dd[_0x6d45('0xa2')]===0x0){return this[_0x6d45('0xa3')](_0x4a63dd);}_0x4a63dd[_0x6d45('0xa2')]-=0x1;if(!this[_0x6d45('0x82')](_0x4a63dd[_0x6d45('0x10f')])){return this['channel'][_0x6d45('0x2b')](_0x4a63dd,'no\x20file\x20audio\x20selected');}var _0x37026e=this[_0x6d45('0x1c')][_0x6d45('0x6e')](this,_0x4a63dd[_0x6d45('0x10f')]);if(!_0x37026e){return this[_0x6d45('0xb')][_0x6d45('0x2b')](_0x4a63dd,_0x6d45('0x110'));}if(!this[_0x6d45('0x82')](_0x4a63dd[_0x6d45('0xd7')])){return this[_0x6d45('0xb')][_0x6d45('0x2b')](_0x6d45('0x111'));}var _0x2f77d5=this[_0x6d45('0xb')][_0x6d45('0x112')](_0x37026e,_0x4a63dd[_0x6d45('0x113')],_0x4a63dd[_0x6d45('0x114')]);var _0xff1498=_0x2f77d5[_0x6d45('0xa0')]?_0x2f77d5['result']['toString']():'';logger[_0x6d45('0x2c')](_0x6d45('0x115'),JSON['stringify'](_0x2f77d5));if(_0x2f77d5[_0x6d45('0xa0')]===-0x1){this[_0x6d45('0x32')][_0x6d45('0x6e')](this,_0x4a63dd,_0xff1498);return _0x2f77d5;}else if(_0x2f77d5[_0x6d45('0x9f')]==='timeout'){_0x2f77d5[_0x6d45('0xa0')]=_0xff1498['length']>=parseInt(_0x4a63dd['mindigit'])?'x':'i';}else{_0x2f77d5[_0x6d45('0xa0')]=_0xff1498['length']>=parseInt(_0x4a63dd[_0x6d45('0x116')])&&_0xff1498['length']<=parseInt(_0x4a63dd[_0x6d45('0x114')])?'x':'i';}var _0x533c0c=this[_0x6d45('0xe')]['sync'](this,_0x4a63dd[_0x6d45('0xd7')]);if(!_0x533c0c){return this[_0x6d45('0xb')][_0x6d45('0x2b')](_0x4a63dd,_0x6d45('0xd8'));}this[_0x6d45('0xb')][_0x6d45('0x9c')](_0x533c0c,_0xff1498);if(this[_0x6d45('0x82')](_0x4a63dd[_0x6d45('0x117')])){var _0x5ce02c=parseInt(_0x4a63dd['hiddendigitsnum'],0xa);var _0x10f4a0=rs[_0x6d45('0x118')]({'charset':'*','length':_0x5ce02c});var _0x1eda6f=_0xff1498[_0x6d45('0x98')];if(_0x1eda6f>0x0){if(_0x1eda6f>_0x5ce02c){this[_0x6d45('0x32')][_0x6d45('0x6e')](this,_0x4a63dd,_0x4a63dd[_0x6d45('0x119')]==='first'?_0x10f4a0+_0xff1498[_0x6d45('0x11a')](_0x5ce02c):_0xff1498[_0x6d45('0x11a')](0x0,_0x1eda6f-_0x5ce02c)+_0x10f4a0);}else{this[_0x6d45('0x32')]['sync'](this,_0x4a63dd,rs[_0x6d45('0x118')]({'charset':'*','length':_0x1eda6f}));}}else{this[_0x6d45('0x32')][_0x6d45('0x6e')](this,_0x4a63dd,'');}}else{this[_0x6d45('0x32')][_0x6d45('0x6e')](this,_0x4a63dd,_0xff1498);}return _0x2f77d5;};AGIVertices['prototype']['getsecretdigits']=function(_0x30e22a){logger[_0x6d45('0x2c')](util[_0x6d45('0x4f')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x30e22a['label']));return this[_0x6d45('0xa')](_0x30e22a);};AGIVertices['prototype'][_0x6d45('0x11b')]=function(_0x4db133){logger[_0x6d45('0x2c')](util[_0x6d45('0x4f')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x4db133[_0x6d45('0x33')]));this['createSquareDetailsReport']['sync'](this,_0x4db133,_0x4db133[_0x6d45('0x11c')]);return this[_0x6d45('0xb')][_0x6d45('0xa7')](util['format'](_0x6d45('0x11d'),_0x4db133['goalname']));};AGIVertices[_0x6d45('0x12')][_0x6d45('0x11e')]=function(_0x5ecaf2){logger[_0x6d45('0x2c')](util['format'](_0x6d45('0x11f'),_0x5ecaf2[_0x6d45('0x33')]));if(!this['isConfigured'](_0x5ecaf2['aws_access_key_id'])||!this[_0x6d45('0x82')](_0x5ecaf2[_0x6d45('0x84')])){return this['channel'][_0x6d45('0xa7')](_0x6d45('0x120'));}if(!this[_0x6d45('0x82')](_0x5ecaf2[_0x6d45('0x58')])){return this[_0x6d45('0xb')][_0x6d45('0xa7')](_0x6d45('0xa6'));}this['channel'][_0x6d45('0xa7')](util[_0x6d45('0x4f')](_0x6d45('0x121'),_0x5ecaf2[_0x6d45('0x58')]));var _0x446a61=this[_0x6d45('0x122')][_0x6d45('0x6e')](this,_0x5ecaf2);if(_0x446a61){this[_0x6d45('0xb')][_0x6d45('0xa7')](util[_0x6d45('0x4f')](_0x6d45('0x123'),_0x446a61));var _0x3c9f04=this[_0x6d45('0xb')][_0x6d45('0x124')](_0x446a61);try{fs[_0x6d45('0x101')](_0x446a61+_0x6d45('0x125'));}catch(_0x520d8e){logger[_0x6d45('0x2b')](_0x520d8e);}return _0x3c9f04;}return this[_0x6d45('0xb')][_0x6d45('0x2b')](_0x5ecaf2,_0x6d45('0x126'));};AGIVertices[_0x6d45('0x12')][_0x6d45('0x127')]=function(_0x42ac54){logger['info'](util[_0x6d45('0x4f')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x42ac54['label']));if(!this[_0x6d45('0x82')](_0x42ac54[_0x6d45('0x83')])||!this[_0x6d45('0x82')](_0x42ac54[_0x6d45('0x84')])){return this[_0x6d45('0xb')][_0x6d45('0xa7')](_0x6d45('0x120'));}if(!this[_0x6d45('0x82')](_0x42ac54[_0x6d45('0x8a')])){return this[_0x6d45('0xb')][_0x6d45('0xa7')]('no\x20bot\x20name\x20configured');}if(!this[_0x6d45('0x82')](_0x42ac54['text'])){return this[_0x6d45('0xb')][_0x6d45('0xa7')](_0x6d45('0xa6'));}this['channel'][_0x6d45('0xf2')]=!![];this[_0x6d45('0x32')](_0x42ac54);this[_0x6d45('0x3d')](_0x42ac54['text'],'in','','');this[_0x6d45('0xb')][_0x6d45('0xa7')](util[_0x6d45('0x4f')](_0x6d45('0x128'),_0x42ac54[_0x6d45('0x58')]));var _0x5f36d5=this[_0x6d45('0x89')]['sync'](this,_0x42ac54);if(_0x5f36d5){for(var _0x17e6c5 in _0x5f36d5){if(_0x5f36d5[_0x6d45('0x95')](_0x17e6c5)&&_[_0x6d45('0x92')](_0x5f36d5[_0x17e6c5])){this['channel'][_0x6d45('0x9c')](util['format']('AWS_LEX_%s',_0x17e6c5[_0x6d45('0x67')]()),_0x5f36d5[_0x17e6c5]);}}if(_[_0x6d45('0x40')](_0x5f36d5[_0x6d45('0x75')])){return this[_0x6d45('0xb')][_0x6d45('0xa7')](_0x6d45('0x129'));}else{this[_0x6d45('0x3d')](_0x5f36d5['message'],'out',_0x6d45('0x12a'),'');return this[_0x6d45('0xb')][_0x6d45('0xa7')](util['format'](_0x6d45('0x12b'),_0x5f36d5[_0x6d45('0x75')]));}}return this[_0x6d45('0xb')]['error'](_0x42ac54,_0x6d45('0x12c'));};AGIVertices['prototype']['googleasr']=function(_0x1238c4){logger['info'](util[_0x6d45('0x4f')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x1238c4[_0x6d45('0x33')],_0x1238c4[_0x6d45('0x63')]));if(!this[_0x6d45('0x82')](_0x1238c4[_0x6d45('0x79')])){return this[_0x6d45('0xb')]['noop'](_0x6d45('0x12d'));}var _0x3e2bca=_0x6d45('0x12e');var _0x36a18f=util['format'](_0x6d45('0x12f'),FILES_PATH,rs[_0x6d45('0x118')](0x4));var _0x3ae076=util[_0x6d45('0x4f')](_0x6d45('0x9b'),_0x36a18f,_0x3e2bca);var _0x492c52=!![];if(_0x1238c4[_0x6d45('0x130')]===_0x6d45('0x131')){_0x492c52=![];}var _0x4f6f1b=this[_0x6d45('0xb')][_0x6d45('0x132')](_0x36a18f,_0x3e2bca,_0x1238c4[_0x6d45('0x133')],_0x1238c4[_0x6d45('0x63')],undefined,_0x492c52);if(_0x4f6f1b[_0x6d45('0xa0')]!==-0x1){this['channel'][_0x6d45('0xa7')](util[_0x6d45('0x4f')](_0x6d45('0x134'),_0x3ae076));var _0x26528c=this[_0x6d45('0x8b')]['sync'](this,_0x1238c4,_0x3ae076);if(_0x26528c){for(var _0x3b3177 in _0x26528c){if(_0x26528c[_0x6d45('0x95')](_0x3b3177)){this[_0x6d45('0xb')]['setVariable'](util[_0x6d45('0x4f')]('GOOGLE_ASR_%s',_0x3b3177['toUpperCase']()),_0x26528c[_0x3b3177]);}}return this[_0x6d45('0xb')]['noop'](util[_0x6d45('0x4f')](_0x6d45('0x135'),JSON['stringify'](_0x26528c)));}}return _0x4f6f1b;};AGIVertices[_0x6d45('0x12')]['tildeasr']=function(_0x22ff19){logger[_0x6d45('0x2c')](util['format']('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x22ff19[_0x6d45('0x33')]));if(!this['isConfigured'](_0x22ff19[_0x6d45('0x136')])){return this[_0x6d45('0xb')]['noop'](_0x6d45('0x137'));}if(!this['isConfigured'](_0x22ff19['appsecret'])){return this[_0x6d45('0xb')]['noop']('no\x20appsecret\x20configured');}var _0x1d4883=_0x6d45('0x12e');var _0x547630=util[_0x6d45('0x4f')](_0x6d45('0x12f'),FILES_PATH,rs[_0x6d45('0x118')](0x4));var _0x350561=util[_0x6d45('0x4f')](_0x6d45('0x9b'),_0x547630,_0x1d4883);var _0x52308a=!![];if(_0x22ff19[_0x6d45('0x130')]===_0x6d45('0x131')){_0x52308a=![];}var _0x44b9af=this['channel'][_0x6d45('0x132')](_0x547630,_0x1d4883,_0x22ff19['intKey'],_0x22ff19[_0x6d45('0x63')],undefined,_0x52308a);if(_0x44b9af[_0x6d45('0xa0')]!==-0x1){this[_0x6d45('0xb')][_0x6d45('0xa7')](util['format'](_0x6d45('0x138'),_0x350561));var _0x10b11f=this[_0x6d45('0x8d')][_0x6d45('0x6e')](this,_0x22ff19,_0x350561);if(_0x10b11f){for(var _0x4d2a73 in _0x10b11f){if(_0x10b11f[_0x6d45('0x95')](_0x4d2a73)){this[_0x6d45('0xb')][_0x6d45('0x9c')](util[_0x6d45('0x4f')]('TILDE_ASR_%s',_0x4d2a73[_0x6d45('0x67')]()),_0x10b11f[_0x4d2a73]);}}return this[_0x6d45('0xb')][_0x6d45('0xa7')](util[_0x6d45('0x4f')]('TildeASR\x20Result\x20%s',JSON[_0x6d45('0x71')](_0x10b11f)));}}return _0x44b9af;};AGIVertices[_0x6d45('0x12')][_0x6d45('0x139')]=function(_0x4d03c1){logger[_0x6d45('0x2c')](util[_0x6d45('0x4f')](_0x6d45('0x13a'),_0x4d03c1[_0x6d45('0x33')]));return this['channel']['continueAt'](_0x4d03c1[_0x6d45('0x13b')],_0x4d03c1[_0x6d45('0x38')],_0x4d03c1[_0x6d45('0x39')]);};AGIVertices['prototype'][_0x6d45('0x13c')]=function(_0x4892f5){logger[_0x6d45('0x2c')](util[_0x6d45('0x4f')](_0x6d45('0x13d'),_0x4892f5[_0x6d45('0x33')]));if(!this[_0x6d45('0x82')](_0x4892f5[_0x6d45('0x13e')])){return this['channel']['error'](_0x4892f5,'no\x20condition\x20configured');}try{var _0x1cdcc6=eval(_0x4892f5[_0x6d45('0x13e')])?'true':_0x6d45('0x13f');this[_0x6d45('0xb')][_0x6d45('0xa7')](util[_0x6d45('0x4f')](_0x6d45('0x140'),_0x4892f5[_0x6d45('0x13e')],_0x1cdcc6));return{'code':0xc8,'result':_0x1cdcc6};}catch(_0x41c94b){return{'code':0xc8,'result':_0x6d45('0x13f')};}};AGIVertices['prototype'][_0x6d45('0x141')]=function(_0xd45b59){logger['info'](util[_0x6d45('0x4f')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0xd45b59[_0x6d45('0x33')]));if(!this[_0x6d45('0x82')](_0xd45b59[_0x6d45('0x142')])){return this['channel'][_0x6d45('0x2b')](_0xd45b59,_0x6d45('0x143'));}var _0x27bcfd=this[_0x6d45('0x23')][_0x6d45('0x6e')](this,_0xd45b59['interval_id']);if(!_0x27bcfd){return this[_0x6d45('0xb')]['error'](_0xd45b59,_0x6d45('0x144'));}for(var _0x20c407=0x0;_0x20c407<_0x27bcfd[_0x6d45('0x98')];_0x20c407+=0x1){var _0x24957d=this[_0x6d45('0xb')][_0x6d45('0xe')](util[_0x6d45('0x4f')](_0x6d45('0x145'),_0x27bcfd[_0x20c407]));if(_0x24957d[_0x6d45('0xa0')]===-0x1){return _0x24957d;}logger[_0x6d45('0x2c')](util[_0x6d45('0x4f')](_0x6d45('0x146'),_0x27bcfd[_0x20c407],_0x24957d[_0x6d45('0x9f')]));if(_0x24957d['extra']===_0x6d45('0x147')){logger[_0x6d45('0x2c')](util[_0x6d45('0x4f')](_0x6d45('0x146'),_0x27bcfd[_0x20c407],_0x6d45('0x147')));this[_0x6d45('0xb')][_0x6d45('0xa7')](util[_0x6d45('0x4f')](_0x6d45('0x146'),_0x27bcfd[_0x20c407],_0x6d45('0x147')));return{'code':0xc8,'result':'true'};}else{logger['info'](util[_0x6d45('0x4f')]('IFTIME\x20%s\x20%s',_0x27bcfd[_0x20c407],_0x6d45('0x13f')));this[_0x6d45('0xb')][_0x6d45('0xa7')](util[_0x6d45('0x4f')](_0x6d45('0x146'),_0x27bcfd[_0x20c407],_0x6d45('0x13f')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x6d45('0x12')][_0x6d45('0x148')]=function(_0x459dda){logger[_0x6d45('0x2c')](util[_0x6d45('0x4f')](_0x6d45('0x149'),_0x459dda[_0x6d45('0x33')]));return this['channel']['hangup']();};AGIVertices['prototype'][_0x6d45('0x14a')]=function(_0x53acec){logger['info'](util[_0x6d45('0x4f')](_0x6d45('0x14b'),_0x53acec[_0x6d45('0x33')]));if(!this[_0x6d45('0x82')](_0x53acec['key'])){return this['channel'][_0x6d45('0xa7')](_0x6d45('0x12d'));}var _0x4983ff=_0x6d45('0x12e');var _0x5a3400=util[_0x6d45('0x4f')](_0x6d45('0x12f'),FILES_PATH,rs[_0x6d45('0x118')](0x4));var _0x299c46=util[_0x6d45('0x4f')](_0x6d45('0x9b'),_0x5a3400,_0x4983ff);var _0x3db58f=!![];if(_0x53acec[_0x6d45('0x130')]==='NOBEEP'){_0x3db58f=![];}var _0x47c40c=this['channel'][_0x6d45('0x132')](_0x5a3400,_0x4983ff,_0x53acec['intKey'],_0x53acec['timeout'],undefined,_0x3db58f);if(_0x47c40c[_0x6d45('0xa0')]!==-0x1){this['channel'][_0x6d45('0xa7')](util[_0x6d45('0x4f')](_0x6d45('0x14c'),_0x299c46));var _0x153d87=this[_0x6d45('0x81')][_0x6d45('0x6e')](this,_0x53acec,_0x299c46);if(_0x153d87){for(var _0x4b0ffc in _0x153d87){if(_0x153d87[_0x6d45('0x95')](_0x4b0ffc)){this['channel']['setVariable'](util[_0x6d45('0x4f')](_0x6d45('0x14d'),_0x4b0ffc[_0x6d45('0x67')]()),_0x153d87[_0x4b0ffc]);}}return this[_0x6d45('0xb')][_0x6d45('0xa7')](util[_0x6d45('0x4f')](_0x6d45('0x14e'),JSON[_0x6d45('0x71')](_0x153d87)));}}return _0x47c40c;};AGIVertices['prototype']['ispeechtts']=function(_0x2a00d3){logger[_0x6d45('0x2c')](util['format'](_0x6d45('0x14f'),_0x2a00d3[_0x6d45('0x33')]));if(!this['isConfigured'](_0x2a00d3['key'])){return this[_0x6d45('0xb')][_0x6d45('0xa7')]('no\x20key\x20configured');}if(!this[_0x6d45('0x82')](_0x2a00d3[_0x6d45('0x58')])){return this[_0x6d45('0xb')][_0x6d45('0xa7')]('no\x20text\x20configured');}this['channel'][_0x6d45('0xa7')](util[_0x6d45('0x4f')](_0x6d45('0x150'),_0x2a00d3[_0x6d45('0x58')]));var _0x289654=this['ispeechTTS']['sync'](this,_0x2a00d3);if(_0x289654){this[_0x6d45('0xb')][_0x6d45('0xa7')](util['format'](_0x6d45('0x14c'),_0x289654));var _0x2796d6=this[_0x6d45('0xb')][_0x6d45('0x124')](_0x289654,_0x2a00d3[_0x6d45('0x133')]);try{fs[_0x6d45('0x101')](_0x289654+_0x6d45('0x125'));}catch(_0x4686f9){logger[_0x6d45('0x2b')](_0x4686f9);}return _0x2796d6;}return this[_0x6d45('0xb')][_0x6d45('0x2b')](_0x2a00d3,_0x6d45('0x151'));};AGIVertices[_0x6d45('0x12')]['login']=function(_0x273337){logger['info'](util['format']('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x273337[_0x6d45('0x33')]));if(!this[_0x6d45('0x82')](_0x273337[_0x6d45('0x152')])){return this[_0x6d45('0xb')][_0x6d45('0x2b')](_0x273337,_0x6d45('0x153'));}logger['info'](util[_0x6d45('0x4f')](_0x6d45('0x154'),this['channel'][_0x6d45('0x37')],_0x273337[_0x6d45('0x152')]));var _0x22aab6=this[_0x6d45('0x4d')][_0x6d45('0x6e')](this,_0x273337[_0x6d45('0x152')]);if(_0x22aab6){logger[_0x6d45('0x2c')](util[_0x6d45('0x4f')](_0x6d45('0x155'),this['channel'][_0x6d45('0x37')],_0x273337[_0x6d45('0x152')]));this['channel']['noop'](util[_0x6d45('0x4f')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x6d45('0xb')][_0x6d45('0x37')],_0x273337[_0x6d45('0x152')]));return{'code':0xc8,'result':'success'};}else{logger[_0x6d45('0x2c')](util[_0x6d45('0x4f')](_0x6d45('0x156'),this['channel'][_0x6d45('0x37')],_0x273337['findBy']));this[_0x6d45('0xb')][_0x6d45('0xa7')](util[_0x6d45('0x4f')](_0x6d45('0x156'),this[_0x6d45('0xb')][_0x6d45('0x37')],_0x273337['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x6d45('0x12')][_0x6d45('0x157')]=function(_0x1ed0e6){logger[_0x6d45('0x2c')](util[_0x6d45('0x4f')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x1ed0e6['label']));if(!this[_0x6d45('0x82')](_0x1ed0e6['findBy'])){return this[_0x6d45('0xb')][_0x6d45('0x2b')](_0x1ed0e6,_0x6d45('0x153'));}logger[_0x6d45('0x2c')](util[_0x6d45('0x4f')](_0x6d45('0x154'),this['channel'][_0x6d45('0x37')],_0x1ed0e6[_0x6d45('0x152')]));var _0x205519=this['agentLogout'][_0x6d45('0x6e')](this,_0x1ed0e6['findBy']);if(_0x205519){logger[_0x6d45('0x2c')](util[_0x6d45('0x4f')](_0x6d45('0x155'),this[_0x6d45('0xb')][_0x6d45('0x37')],_0x1ed0e6[_0x6d45('0x152')]));this[_0x6d45('0xb')][_0x6d45('0xa7')](util['format'](_0x6d45('0x155'),this[_0x6d45('0xb')][_0x6d45('0x37')],_0x1ed0e6[_0x6d45('0x152')]));return{'code':0xc8,'result':_0x6d45('0x158')};}else{logger[_0x6d45('0x2c')](util[_0x6d45('0x4f')](_0x6d45('0x156'),this['channel'][_0x6d45('0x37')],_0x1ed0e6[_0x6d45('0x152')]));this['channel'][_0x6d45('0xa7')](util[_0x6d45('0x4f')](_0x6d45('0x156'),this['channel']['callerid'],_0x1ed0e6['findBy']));return{'code':0xc8,'result':_0x6d45('0x159')};}};AGIVertices[_0x6d45('0x12')]['math']=function(_0x35152f){logger[_0x6d45('0x2c')](util['format']('Enter\x20in\x20MATH\x20(%s)\x20block',_0x35152f[_0x6d45('0x33')]));if(!this[_0x6d45('0x82')](_0x35152f['operation'])){return this[_0x6d45('0xb')]['error'](_0x35152f,_0x6d45('0x15a'));}this[_0x6d45('0xb')][_0x6d45('0xa7')](util[_0x6d45('0x4f')](_0x6d45('0x15b'),_0x35152f[_0x6d45('0x15c')]));var _0x3f65a3=eval(_0x35152f['operation']);if(!this[_0x6d45('0x82')](_0x35152f[_0x6d45('0xd7')])){return this[_0x6d45('0xb')][_0x6d45('0xa7')](_0x6d45('0x111'));}var _0xc727ec=this['getVariable'][_0x6d45('0x6e')](this,_0x35152f['variable_id']);if(!_0xc727ec){return this[_0x6d45('0xb')][_0x6d45('0x2b')](_0x35152f,_0x6d45('0xd8'));}if(_['isArray'](_0x3f65a3)){var _0x16a7a3=this;_0x3f65a3[_0x6d45('0xd9')](function(_0x59c426,_0x4f087d){_0x16a7a3[_0x6d45('0xb')]['setVariable'](util[_0x6d45('0x4f')](_0x6d45('0x15d'),_0xc727ec,_0x4f087d),_0x59c426);});return this[_0x6d45('0xb')]['noop'](util[_0x6d45('0x4f')](_0x6d45('0x15e'),_0xc727ec));}else{return this[_0x6d45('0xb')][_0x6d45('0x9c')](_0xc727ec,_0x3f65a3);}};AGIVertices['prototype']['menu']=function(_0x14a9ae){logger[_0x6d45('0x2c')](util[_0x6d45('0x4f')](_0x6d45('0x15f'),_0x14a9ae[_0x6d45('0x33')]));if(_0x14a9ae[_0x6d45('0xa2')]===0x0){return this[_0x6d45('0xa3')](_0x14a9ae);}_0x14a9ae[_0x6d45('0xa2')]-=0x1;if(!this[_0x6d45('0x82')](_0x14a9ae[_0x6d45('0x10f')])){return this[_0x6d45('0xb')][_0x6d45('0x2b')](_0x14a9ae,_0x6d45('0x160'));}var _0x371012=this[_0x6d45('0x1c')][_0x6d45('0x6e')](this,_0x14a9ae[_0x6d45('0x10f')]);if(!_0x371012){return this['channel'][_0x6d45('0x2b')](_0x14a9ae,'no\x20file\x20audio\x20found');}var _0x122c93=this[_0x6d45('0xb')][_0x6d45('0x112')](_0x371012,_0x14a9ae[_0x6d45('0x113')],_0x14a9ae['digit']);var _0x43259a=_0x122c93[_0x6d45('0xa0')];if(_0x122c93['result']===-0x1){this[_0x6d45('0x32')][_0x6d45('0x6e')](this,_0x14a9ae,'-1');return _0x122c93;}else if(_0x122c93[_0x6d45('0x9f')]===_0x6d45('0x63')){_0x122c93[_0x6d45('0xa0')]=_0x122c93[_0x6d45('0xa0')][_0x6d45('0x98')]>0x0?_0x122c93[_0x6d45('0xa0')]:'t';}else if(_[_0x6d45('0x3f')](_0x122c93[_0x6d45('0xa0')])){_0x122c93[_0x6d45('0xa0')]='#';_0x43259a='#';}if(!this[_0x6d45('0x82')](_0x14a9ae['variable_id'])){this[_0x6d45('0xb')][_0x6d45('0xa7')](_0x6d45('0x111'));}else{var _0x41c849=this[_0x6d45('0xe')][_0x6d45('0x6e')](this,_0x14a9ae[_0x6d45('0xd7')]);if(!_0x41c849){return this[_0x6d45('0xb')][_0x6d45('0x2b')](_0x14a9ae,'no\x20variable\x20found');}this[_0x6d45('0xb')][_0x6d45('0x9c')](_0x41c849,_0x43259a);}this[_0x6d45('0x32')][_0x6d45('0x6e')](this,_0x14a9ae,_0x43259a);return _0x122c93;};AGIVertices[_0x6d45('0x12')][_0x6d45('0xa7')]=function(_0x473eb7){logger[_0x6d45('0x2c')](util['format'](_0x6d45('0x161'),_0x473eb7[_0x6d45('0x33')]));return this[_0x6d45('0xb')]['noop'](_0x473eb7['output']||_0x473eb7[_0x6d45('0x33')]);};AGIVertices[_0x6d45('0x12')][_0x6d45('0x162')]=function(_0x3aaacc){logger[_0x6d45('0x2c')](util[_0x6d45('0x4f')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x3aaacc[_0x6d45('0x33')]));if(!this[_0x6d45('0x82')](_0x3aaacc[_0x6d45('0x152')])){return this['channel'][_0x6d45('0x2b')](_0x3aaacc,'no\x20find\x20by\x20configured');}logger[_0x6d45('0x2c')](util[_0x6d45('0x4f')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x6d45('0x37')],_0x3aaacc[_0x6d45('0x152')]));var _0xff39d5=this[_0x6d45('0x48')][_0x6d45('0x6e')](this,_0x3aaacc['pause_id']);var _0x5afcc3=this[_0x6d45('0x49')][_0x6d45('0x6e')](this,_0x3aaacc[_0x6d45('0x152')],_0xff39d5);if(_0x5afcc3){logger['info'](util['format'](_0x6d45('0x155'),this['channel'][_0x6d45('0x37')],_0x3aaacc[_0x6d45('0x152')]));this['channel'][_0x6d45('0xa7')](util['format'](_0x6d45('0x155'),this[_0x6d45('0xb')][_0x6d45('0x37')],_0x3aaacc[_0x6d45('0x152')]));return{'code':0xc8,'result':_0x6d45('0x158')};}else{logger[_0x6d45('0x2c')](util['format'](_0x6d45('0x156'),this[_0x6d45('0xb')][_0x6d45('0x37')],_0x3aaacc['findBy']));this['channel'][_0x6d45('0xa7')](util['format'](_0x6d45('0x155'),this[_0x6d45('0xb')][_0x6d45('0x37')],_0x3aaacc[_0x6d45('0x152')]));return{'code':0xc8,'result':_0x6d45('0x159')};}};AGIVertices[_0x6d45('0x12')][_0x6d45('0x163')]=function(_0x127fb7){logger[_0x6d45('0x2c')](util['format'](_0x6d45('0x164'),_0x127fb7['label']));if(!this[_0x6d45('0x82')](_0x127fb7[_0x6d45('0x10f')])){return this[_0x6d45('0xb')][_0x6d45('0x2b')](_0x127fb7,_0x6d45('0x160'));}var _0x5981c4=this[_0x6d45('0x1c')][_0x6d45('0x6e')](this,_0x127fb7[_0x6d45('0x10f')]);if(!_0x5981c4){return this[_0x6d45('0xb')][_0x6d45('0x2b')](_0x127fb7,_0x6d45('0x110'));}var _0x505c22=this['channel'][_0x6d45('0x53')](_0x6d45('0x165'),[_0x5981c4,_0x127fb7[_0x6d45('0xe5')]]);if(_0x505c22[_0x6d45('0xa0')]===-0x1){return _0x505c22;}return this['channel'][_0x6d45('0xa7')](util[_0x6d45('0x4f')](_0x6d45('0xc2'),_0x6d45('0x165'),_0x5981c4));};AGIVertices[_0x6d45('0x12')][_0x6d45('0x166')]=function(_0x4b7817){logger[_0x6d45('0x2c')](util[_0x6d45('0x4f')](_0x6d45('0x167'),_0x4b7817[_0x6d45('0x33')]));if(!this[_0x6d45('0x82')](_0x4b7817['queue_id'])){return this[_0x6d45('0xb')]['error'](_0x4b7817,_0x6d45('0x168'));}var _0x561c2d='';var _0x5a25b3=parseInt(_0x4b7817['queue_id'],0xa);if(isNaN(_0x5a25b3)){_0x561c2d=_0x4b7817[_0x6d45('0x169')];}else{_0x561c2d=this[_0x6d45('0x16a')][_0x6d45('0x6e')](this,_0x4b7817[_0x6d45('0x169')]);if(!_0x561c2d){return this[_0x6d45('0xb')]['error'](_0x4b7817,'no\x20queue\x20found');}}var _0x142864='';if(this[_0x6d45('0x82')](_0x4b7817[_0x6d45('0x10f')])){var _0x3e3937=this['getSound'][_0x6d45('0x6e')](this,_0x4b7817[_0x6d45('0x10f')]);if(_0x3e3937){_0x142864=_0x3e3937;}}this[_0x6d45('0x32')]['sync'](this,_0x4b7817,_0x561c2d);if(_0x4b7817['opts']['indexOf']('x')<0x0){_0x4b7817[_0x6d45('0xe5')]+='x';}if(_0x4b7817[_0x6d45('0xe5')][_0x6d45('0x16b')]('X')<0x0){_0x4b7817[_0x6d45('0xe5')]+='X';}this[_0x6d45('0xb')][_0x6d45('0x9c')]('XMCS-QUEUE',_0x561c2d?_0x561c2d[_0x6d45('0x16c')]():'');var _0x104e02=this[_0x6d45('0xb')][_0x6d45('0x53')](_0x6d45('0x16d'),[_0x561c2d,_0x4b7817['opts'],_0x4b7817[_0x6d45('0x61')],_0x142864,_0x4b7817[_0x6d45('0x63')],_0x4b7817[_0x6d45('0x6')],_0x4b7817[_0x6d45('0x16e')],_0x4b7817[_0x6d45('0x16f')],'',_0x4b7817['position']]);if(_0x104e02[_0x6d45('0xa0')]===-0x1){return _0x104e02;}return this[_0x6d45('0xb')][_0x6d45('0xa7')](util[_0x6d45('0x4f')]('Executed\x20command\x20%s\x20%s',_0x6d45('0x16d'),_0x561c2d));};AGIVertices[_0x6d45('0x12')][_0x6d45('0x170')]=function(_0xeec03b){logger['info'](util[_0x6d45('0x4f')](_0x6d45('0x171'),_0xeec03b[_0x6d45('0x33')]));var _0xe3e8b3=_0xeec03b[_0x6d45('0x172')]||_0x6d45('0x12e');var _0x4ebd2d=util[_0x6d45('0x4f')](_0x6d45('0x173'),this['channel'][_0x6d45('0x36')],rs[_0x6d45('0x118')](0x5));var _0x418cc3=util[_0x6d45('0x4f')]('%s/recordings/%s.%s',FILES_PATH,_0x4ebd2d,_0xe3e8b3);var _0x5470be=util[_0x6d45('0x4f')]('%s/recordings/%s',FILES_PATH,_0x4ebd2d);this['createSquareRecording']['sync'](this,_0xeec03b,_0x4ebd2d,_0x418cc3);this[_0x6d45('0xb')][_0x6d45('0x9c')](_0x6d45('0x174'),_0x4ebd2d);logger[_0x6d45('0x2c')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x5470be,_0xe3e8b3,_0xeec03b['escape_digits'],_0xeec03b[_0x6d45('0x63')]);return this[_0x6d45('0xb')][_0x6d45('0x132')](_0x5470be,_0xe3e8b3,_0xeec03b['escape_digits'],_0xeec03b[_0x6d45('0x63')],undefined,!![]);};AGIVertices[_0x6d45('0x12')][_0x6d45('0x175')]=function(_0x1d0cf9){logger[_0x6d45('0x2c')](util[_0x6d45('0x4f')](_0x6d45('0x176'),_0x1d0cf9[_0x6d45('0x33')]));if(!this[_0x6d45('0x82')](_0x1d0cf9[_0x6d45('0x61')])){return this['channel'][_0x6d45('0xa7')](_0x6d45('0x177'));}var _0x461dcb=this[_0x6d45('0x178')][_0x6d45('0x6e')](this,_0x1d0cf9);logger['info'](util[_0x6d45('0x4f')]('Response:',util[_0x6d45('0x179')](_0x461dcb,{'showHidden':![],'depth':null})));if(!this[_0x6d45('0x82')](_0x1d0cf9[_0x6d45('0xd7')])){return this[_0x6d45('0xb')]['noop'](_0x6d45('0x17a'));}var _0x45f4a=this['getVariable']['sync'](this,_0x1d0cf9[_0x6d45('0xd7')]);if(!_0x45f4a){return this[_0x6d45('0xb')][_0x6d45('0x2b')](_0x1d0cf9,'no\x20variable\x20found');}this[_0x6d45('0xb')][_0x6d45('0x9c')](util[_0x6d45('0x4f')](_0x6d45('0x17b'),_0x45f4a),_0x461dcb[_0x6d45('0x73')]?_0x461dcb[_0x6d45('0x73')]:_0x6d45('0x17c'));this['channel'][_0x6d45('0x9c')](util[_0x6d45('0x4f')]('%s_STATUS_MESSAGE',_0x45f4a),_0x461dcb[_0x6d45('0x74')]?_0x461dcb[_0x6d45('0x74')]:'OK');if(_0x461dcb[_0x6d45('0x68')]){try{this[_0x6d45('0x9a')](_0x461dcb[_0x6d45('0x68')],_0x45f4a);}catch(_0x4db1cc){logger['error'](util[_0x6d45('0x4f')](_0x6d45('0x17d'),_0x45f4a));}}return this[_0x6d45('0xb')]['noop'](util['format'](_0x6d45('0xdd'),_0x45f4a));};AGIVertices[_0x6d45('0x12')][_0x6d45('0x17e')]=function(_0x29ac34){logger[_0x6d45('0x2c')](util[_0x6d45('0x4f')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x29ac34[_0x6d45('0x33')]));return this[_0x6d45('0xb')][_0x6d45('0x17f')](_0x29ac34[_0x6d45('0x180')][_0x6d45('0xd6')](/\s+/g,''),_0x29ac34[_0x6d45('0x181')]);};AGIVertices['prototype'][_0x6d45('0x182')]=function(_0x57ee72){logger[_0x6d45('0x2c')](util[_0x6d45('0x4f')](_0x6d45('0x183'),_0x57ee72[_0x6d45('0x33')]));return this[_0x6d45('0xb')]['sayNumber'](_0x57ee72['number']['replace'](/\s+/g,''),_0x57ee72['escape_digits']);};AGIVertices['prototype'][_0x6d45('0x184')]=function(_0x515a18){logger['info'](util[_0x6d45('0x4f')](_0x6d45('0x185'),_0x515a18[_0x6d45('0x33')]));return this[_0x6d45('0xb')][_0x6d45('0x186')](_0x515a18[_0x6d45('0x58')],_0x515a18['escape_digits']);};AGIVertices[_0x6d45('0x12')][_0x6d45('0x187')]=function(_0x245ac9){logger['info'](util[_0x6d45('0x4f')](_0x6d45('0x188'),_0x245ac9[_0x6d45('0x33')]));if(!this[_0x6d45('0x82')](_0x245ac9[_0x6d45('0x189')])){return this['channel'][_0x6d45('0xa7')](_0x6d45('0x18a'));}var _0x5d5156=this['getMailAccount'][_0x6d45('0x6e')](this,_0x245ac9[_0x6d45('0x189')]);if(!_0x5d5156||!_0x5d5156[_0x6d45('0x18b')]){return this[_0x6d45('0xb')]['error'](_0x245ac9,_0x6d45('0x18c'));}var _0x1096c3={'from':util[_0x6d45('0x4f')](_0x6d45('0x18d'),_0x5d5156[_0x6d45('0x11')],_0x5d5156[_0x6d45('0x18e')]||_0x5d5156[_0x6d45('0x18b')][_0x6d45('0x18f')]),'to':_0x245ac9['to']||'','cc':_0x245ac9['cc']||'','bcc':_0x245ac9[_0x6d45('0x190')]||'','subject':_0x245ac9[_0x6d45('0x191')],'html':_0x245ac9['text'],'text':_0x245ac9[_0x6d45('0x58')]};var _0x59b67c={'tls':{'rejectUnauthorized':![]}};if(_0x5d5156['Smtp']['service']){_0x59b67c['service']=_0x5d5156[_0x6d45('0x18b')][_0x6d45('0x192')];}else{_0x59b67c[_0x6d45('0x193')]=_0x5d5156[_0x6d45('0x18b')][_0x6d45('0x193')];_0x59b67c[_0x6d45('0x194')]=_0x5d5156[_0x6d45('0x18b')][_0x6d45('0x194')];_0x59b67c[_0x6d45('0x195')]=_0x5d5156[_0x6d45('0x18b')][_0x6d45('0x195')];}if(_0x5d5156[_0x6d45('0x18b')][_0x6d45('0x196')]){_0x59b67c[_0x6d45('0x197')]={'user':_0x5d5156['Smtp'][_0x6d45('0x18f')],'pass':_0x5d5156[_0x6d45('0x18b')][_0x6d45('0x198')]};}if(this[_0x6d45('0x82')](_0x245ac9[_0x6d45('0x199')])){}logger[_0x6d45('0x19a')](_0x6d45('0x19b'),JSON[_0x6d45('0x71')](_0x1096c3));this[_0x6d45('0x32')][_0x6d45('0x6e')](this,_0x245ac9,_0x245ac9['account_id']);this['channel']['noop'](util[_0x6d45('0x4f')](_0x6d45('0x19c'),_0x5d5156[_0x6d45('0x11')]));this['sendMailMessage'][_0x6d45('0x6e')](this,_0x59b67c,_0x1096c3);return this[_0x6d45('0xb')][_0x6d45('0xa7')](_0x6d45('0x19d'));};AGIVertices['prototype'][_0x6d45('0x19e')]=function(_0x5eb3b1){logger[_0x6d45('0x2c')](util[_0x6d45('0x4f')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x5eb3b1[_0x6d45('0x33')]));return this[_0x6d45('0xb')][_0x6d45('0xa7')](_0x6d45('0x19f'));};AGIVertices[_0x6d45('0x12')][_0x6d45('0x1a0')]=function(_0x22dd51){logger[_0x6d45('0x2c')](util[_0x6d45('0x4f')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x22dd51[_0x6d45('0x33')]));if(!this[_0x6d45('0x82')](_0x22dd51[_0x6d45('0x1a1')])){return this[_0x6d45('0xb')][_0x6d45('0xa7')]('no\x20sms\x20account\x20configured');}var _0x3b6d95=this[_0x6d45('0x1a2')][_0x6d45('0x6e')](this,_0x22dd51[_0x6d45('0x1a1')]);if(!_0x3b6d95){return this[_0x6d45('0xb')][_0x6d45('0x2b')](_0x22dd51,'no\x20sms\x20account\x20found');}var _0x27df7d={'body':_0x22dd51[_0x6d45('0x1a3')],'phone':_0x22dd51['to']||'','SmsAccountId':_0x3b6d95['id']};logger[_0x6d45('0x19a')](_0x6d45('0x1a4'),JSON[_0x6d45('0x71')](_0x27df7d));this[_0x6d45('0x32')][_0x6d45('0x6e')](this,_0x22dd51,_0x22dd51['sms_account_id']);this[_0x6d45('0xb')][_0x6d45('0xa7')](util['format'](_0x6d45('0x1a5'),_0x3b6d95[_0x6d45('0x11')]));this[_0x6d45('0x31')][_0x6d45('0x6e')](this,_0x27df7d);return this['channel'][_0x6d45('0xa7')](_0x6d45('0x1a6'));};AGIVertices[_0x6d45('0x12')][_0x6d45('0x1a7')]=function(_0x58edb1){logger[_0x6d45('0x2c')](util['format'](_0x6d45('0x1a8'),_0x58edb1['label']));if(!this[_0x6d45('0x82')](_0x58edb1[_0x6d45('0xd7')])){return this[_0x6d45('0xb')][_0x6d45('0x2b')](_0x58edb1,_0x6d45('0x1a9'));}var _0x1b701c=this['getVariable'][_0x6d45('0x6e')](this,_0x58edb1[_0x6d45('0xd7')]);if(!_0x1b701c){return this['channel'][_0x6d45('0x2b')](_0x58edb1,_0x6d45('0xd8'));}return this['channel']['setVariable'](_0x1b701c,_0x58edb1[_0x6d45('0x1aa')]);};AGIVertices['prototype'][_0x6d45('0x1ab')]=function(_0x72f0bb){logger[_0x6d45('0x2c')](util[_0x6d45('0x4f')](_0x6d45('0x1ac'),_0x72f0bb[_0x6d45('0x33')]));this[_0x6d45('0xb')]['noop'](_0x6d45('0x1ad'));if(_0x72f0bb[_0x6d45('0xb6')]===_0x6d45('0x1ae')){this['channel'][_0x6d45('0xa7')](_0x6d45('0x1af'));return this[_0x6d45('0xb')][_0x6d45('0xb6')]();}return this['channel'][_0x6d45('0xa7')](_0x6d45('0x1b0'));};AGIVertices['prototype'][_0x6d45('0x1b1')]=function(_0xff88af){logger['info'](util[_0x6d45('0x4f')](_0x6d45('0x1b2'),_0xff88af[_0x6d45('0x33')]));if(!this[_0x6d45('0x82')](_0xff88af[_0x6d45('0x1b3')])){return this['channel']['error'](_0xff88af,_0x6d45('0x1b4'));}var _0x4958ed=this[_0x6d45('0x15')][_0x6d45('0x6e')](this,_0xff88af[_0x6d45('0x1b3')]);if(!this[_0x6d45('0x82')](_0x4958ed)){return this['channel'][_0x6d45('0x2b')](_0xff88af,util['format'](_0x6d45('0x1b5'),_0xff88af['project_id']));}if(_0x4958ed===this[_0x6d45('0xb')][_0x6d45('0x34')]){return this[_0x6d45('0xb')]['error'](_0xff88af,_0x6d45('0x1b6'));}this[_0x6d45('0x32')][_0x6d45('0x6e')](this,_0xff88af,_0x4958ed);var _0x9af2=this[_0x6d45('0xb')][_0x6d45('0x53')](_0x6d45('0x1b7'),util[_0x6d45('0x4f')](_0x6d45('0x1b8'),config[_0x6d45('0x6')][_0x6d45('0x193')]||_0x6d45('0x1b9'),_0x4958ed,this[_0x6d45('0xb')][_0x6d45('0x34')]));if(_0x9af2[_0x6d45('0xa0')]===-0x1){return _0x9af2;}return this[_0x6d45('0xb')][_0x6d45('0xa7')](util[_0x6d45('0x4f')](_0x6d45('0xc2'),_0x6d45('0x1b7'),_0x4958ed));};AGIVertices[_0x6d45('0x12')][_0x6d45('0x1ba')]=function(_0x325188){logger[_0x6d45('0x2c')](util['format'](_0x6d45('0x1bb'),_0x325188[_0x6d45('0x33')]));var _0x44f7cf=this[_0x6d45('0x52')][_0x6d45('0x6e')](this,_0x325188[_0x6d45('0xb5')]);this[_0x6d45('0x32')]['sync'](this,_0x325188,_0x325188[_0x6d45('0xb5')]);if(this[_0x6d45('0x82')](_0x325188[_0x6d45('0xd7')])){var _0x1fd393=this['getVariable'][_0x6d45('0x6e')](this,_0x325188['variable_id']);if(_0x1fd393){this['channel'][_0x6d45('0x9c')](_0x1fd393,_0x44f7cf);return this[_0x6d45('0xb')][_0x6d45('0xa7')](util[_0x6d45('0x4f')](_0x6d45('0x1bc'),_0x325188['command'],_0x1fd393));}}return this[_0x6d45('0xb')][_0x6d45('0xa7')](util['format']('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x325188[_0x6d45('0xb5')]));};AGIVertices[_0x6d45('0x12')][_0x6d45('0x1bd')]=function(_0x27dc5d){logger['info'](util[_0x6d45('0x4f')](_0x6d45('0x1be'),_0x27dc5d[_0x6d45('0x33')]));_0x27dc5d[_0x6d45('0x58')]=_0x27dc5d['text'][_0x6d45('0xd6')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x6d45('0x82')](_0x27dc5d[_0x6d45('0x56')])){return this[_0x6d45('0xb')]['noop'](_0x6d45('0x1bf'));}if(!this[_0x6d45('0x82')](_0x27dc5d['text'])){return this[_0x6d45('0xb')][_0x6d45('0xa7')](_0x6d45('0xa6'));}this[_0x6d45('0xb')][_0x6d45('0xa7')](util[_0x6d45('0x4f')](_0x6d45('0x1c0'),_0x27dc5d['text']));var _0x10eb25=this[_0x6d45('0x55')][_0x6d45('0x6e')](this,_0x27dc5d);if(_0x10eb25){this[_0x6d45('0xb')][_0x6d45('0xa7')](util[_0x6d45('0x4f')](_0x6d45('0x1c1'),_0x10eb25));var _0x522607=this[_0x6d45('0xb')][_0x6d45('0x124')](_0x10eb25);try{fs[_0x6d45('0x101')](_0x10eb25+_0x6d45('0x125'));}catch(_0x430ca2){logger['error'](_0x430ca2);}return _0x522607;}return this[_0x6d45('0xb')][_0x6d45('0x2b')](_0x27dc5d,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0x6d45('0x1c2')]=function(_0x2c2e02){logger[_0x6d45('0x2c')](util[_0x6d45('0x4f')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x2c2e02[_0x6d45('0x33')]));_0x2c2e02[_0x6d45('0x58')]=_0x2c2e02[_0x6d45('0x58')][_0x6d45('0xd6')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x6d45('0x82')](_0x2c2e02[_0x6d45('0x58')])){return this[_0x6d45('0xb')][_0x6d45('0xa7')]('no\x20text\x20configured');}this[_0x6d45('0xb')][_0x6d45('0xa7')](util[_0x6d45('0x4f')](_0x6d45('0x1c3'),_0x2c2e02[_0x6d45('0x58')]));var _0x39a8ad=this[_0x6d45('0x5f')]['sync'](this,_0x2c2e02);if(_0x39a8ad){this[_0x6d45('0xb')][_0x6d45('0xa7')](util[_0x6d45('0x4f')](_0x6d45('0x1c4'),_0x39a8ad));var _0x2b2421=this['channel'][_0x6d45('0x124')](_0x39a8ad);try{fs[_0x6d45('0x101')](_0x39a8ad+_0x6d45('0x125'));}catch(_0x3a5666){logger[_0x6d45('0x2b')](_0x3a5666);}return _0x2b2421;}return this[_0x6d45('0xb')][_0x6d45('0x2b')](_0x2c2e02,_0x6d45('0x1c5'));};AGIVertices[_0x6d45('0x12')][_0x6d45('0x1c6')]=function(_0x2e6742){logger['info'](util[_0x6d45('0x4f')](_0x6d45('0x1c7'),_0x2e6742[_0x6d45('0x33')]));if(!this[_0x6d45('0x82')](_0x2e6742[_0x6d45('0x152')])){return this['channel']['error'](_0x2e6742,'no\x20find\x20by\x20configured');}logger[_0x6d45('0x2c')](util['format'](_0x6d45('0x154'),this[_0x6d45('0xb')][_0x6d45('0x37')],_0x2e6742[_0x6d45('0x152')]));var _0x146043=this[_0x6d45('0x4b')][_0x6d45('0x6e')](this,_0x2e6742[_0x6d45('0x152')]);if(_0x146043){logger[_0x6d45('0x2c')](util[_0x6d45('0x4f')](_0x6d45('0x155'),this['channel']['callerid'],_0x2e6742[_0x6d45('0x152')]));this[_0x6d45('0xb')]['noop'](util[_0x6d45('0x4f')](_0x6d45('0x155'),this[_0x6d45('0xb')]['callerid'],_0x2e6742[_0x6d45('0x152')]));return{'code':0xc8,'result':'success'};}else{logger[_0x6d45('0x2c')](util[_0x6d45('0x4f')](_0x6d45('0x156'),this[_0x6d45('0xb')][_0x6d45('0x37')],_0x2e6742[_0x6d45('0x152')]));this[_0x6d45('0xb')]['noop'](util['format'](_0x6d45('0x156'),this[_0x6d45('0xb')][_0x6d45('0x37')],_0x2e6742[_0x6d45('0x152')]));return{'code':0xc8,'result':_0x6d45('0x159')};}};AGIVertices['prototype'][_0x6d45('0x1c8')]=function(_0x1675e4){logger['info'](util['format'](_0x6d45('0x1c9'),_0x1675e4[_0x6d45('0x33')]));var _0x427e12=this[_0x6d45('0xb')][_0x6d45('0x53')](_0x6d45('0x1ca'),[_0x1675e4[_0x6d45('0x1cb')],_0x1675e4['options']]);if(_0x427e12['result']===-0x1){return _0x427e12;}return this[_0x6d45('0xb')][_0x6d45('0xa7')](util[_0x6d45('0x4f')]('Executed\x20command\x20%s\x20%s','VOICEMAIL',_0x1675e4[_0x6d45('0x1cb')]));};AGIVertices['prototype'][_0x6d45('0x1cc')]=function(_0x5cbc75){logger['info'](util[_0x6d45('0x4f')](_0x6d45('0x1cd'),_0x5cbc75['label']));if(!this['isConfigured'](_0x5cbc75[_0x6d45('0xd7')])){return this[_0x6d45('0xb')][_0x6d45('0x2b')](_0x5cbc75,_0x6d45('0x1a9'));}var _0x25e897=this['getVariable'][_0x6d45('0x6e')](this,_0x5cbc75[_0x6d45('0xd7')]);if(!_0x25e897){return this[_0x6d45('0xb')][_0x6d45('0x2b')](_0x5cbc75,_0x6d45('0xd8'));}var _0x149e60=this[_0x6d45('0xb')][_0x6d45('0xe')](_0x25e897);return{'code':0xc8,'result':_0x149e60[_0x6d45('0x9f')]?_0x149e60[_0x6d45('0x9f')]:'-'};};String['prototype'][_0x6d45('0x9e')]=function(_0xee53f4,_0x25d9ca){return this[_0x6d45('0x9d')](_0xee53f4)['join'](_0x25d9ca);};module[_0x6d45('0x1ce')]=AGIVertices; \ No newline at end of file +var _0xff89=['aws_secret_access_key','aws_text_type','aws_bot_name','googleASR','google_asr_language','appid','clear','includes','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isArray','length','saveRestApiResult','isPlainObject','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','sync','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','exec','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','Wait\x20%s\x20seconds\x20before\x20answer','wait','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','no\x20text\x20configured','MRCPSynth','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','no\x20grammar\x20configured','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','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','sip_id','no\x20user\x20selected','no\x20user\x20found','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20anguage\x20configured','bot','Trying\x20DialogflowV2:\x20%s','DialogflowV2\x20Result\x20%s','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','ndassistant_url','SESTEK_NDA_%s','sesteknda','streamFile','.wav','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','phone','DIAL','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','getData','response','maxdigit','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','unlink','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','awsLex','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','beep','NOBEEP','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appsecret','no\x20appsecret\x20configured','%s/recordings/%s','recordFile','tildeASR','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','ispeech\x20TTS\x20is\x20unreachable','login','no\x20find\x20by\x20configured','findBy','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','success','math','operation','%s[%s]','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','digit','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','QUEUE','macro','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','sayDigits','saynumber','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','service','host','port','secure','authentication','debug','sendMail\x20message','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','answer','Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','path','util','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','getsecretdigits','channel','rpc','mailRpc','getVariable','then','name','prototype','getVoiceQueue','getVoiceQueueById','catch','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunk','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','%s/sounds/converted/%s','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','agicommand','arg_1','callerid','createSquareRecording','context','extension','priority','accountcode','dnid','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','format','%s/%s@from-sip/n','LOCAL','shellCommand','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','restAPI','url','timeout','PUT','method','toUpperCase','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','headers','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id'];(function(_0x4f480e,_0x537d02){var _0x2071a3=function(_0x47e5af){while(--_0x47e5af){_0x4f480e['push'](_0x4f480e['shift']());}};_0x2071a3(++_0x537d02);}(_0xff89,0x149));var _0x9ff8=function(_0x409137,_0x4b42dc){_0x409137=_0x409137-0x0;var _0x107bdd=_0xff89[_0x409137];return _0x107bdd;};'use strict';var fs=require('fs');var path=require(_0x9ff8('0x0'));var util=require(_0x9ff8('0x1'));var _=require(_0x9ff8('0x2'));var sh=require(_0x9ff8('0x3'));var odbc=require(_0x9ff8('0x4'))();var rs=require(_0x9ff8('0x5'));var moment=require(_0x9ff8('0x6'));var Mustache=require(_0x9ff8('0x7'));var rp=require(_0x9ff8('0x8'));var logger=require(_0x9ff8('0x9'))(_0x9ff8('0xa'));var config=require(_0x9ff8('0xb'));var scripts=require('./scripts');var FILES_PATH=_0x9ff8('0xc');var recursiveMapAttributes=[_0x9ff8('0xd'),_0x9ff8('0xe')];var verticesWithRetry=['menu',_0x9ff8('0xf'),_0x9ff8('0x10')];var AGIVertices=function(_0x152cf6,_0x2e2251,_0x11e6d9){this[_0x9ff8('0x11')]=_0x152cf6;this[_0x9ff8('0x12')]=_0x2e2251;this[_0x9ff8('0x13')]=_0x11e6d9;};AGIVertices['prototype'][_0x9ff8('0x14')]=function(_0x2340c0,_0x2075f8){this[_0x9ff8('0x12')]['getVariableById'](_0x2340c0)[_0x9ff8('0x15')](function(_0x2216a1){_0x2075f8(null,_0x2216a1?_0x2216a1[_0x9ff8('0x16')]:![]);})['catch'](function(_0x308d24){_0x2075f8(_0x308d24);});};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0x18')]=function(_0x4c5364,_0x1f32d1){this['rpc'][_0x9ff8('0x19')](_0x4c5364)[_0x9ff8('0x15')](function(_0xd630a4){_0x1f32d1(null,_0xd630a4?_0xd630a4['name']:![]);})[_0x9ff8('0x1a')](function(_0x33508d){_0x1f32d1(_0x33508d);});};AGIVertices[_0x9ff8('0x17')]['getSquareProject']=function(_0x3952c8,_0x231e26){this[_0x9ff8('0x12')][_0x9ff8('0x1b')](_0x3952c8)[_0x9ff8('0x15')](function(_0x220eb4){_0x231e26(null,_0x220eb4?_0x220eb4[_0x9ff8('0x16')]:![]);})['catch'](function(_0x16560d){_0x231e26(_0x16560d);});};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0x1c')]=function(_0x2e297e,_0x11cc96){this['rpc'][_0x9ff8('0x1d')](_0x2e297e)['then'](function(_0x15b991){_0x11cc96(null,_0x15b991?_0x15b991['dsn']:![]);})[_0x9ff8('0x1a')](function(_0x5c9a26){_0x11cc96(_0x5c9a26);});};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0x1e')]=function(_0x4925e1,_0x2b45b7){this[_0x9ff8('0x12')][_0x9ff8('0x1f')](_0x4925e1)[_0x9ff8('0x15')](function(_0x4a7b6d){_0x2b45b7(null,_0x4a7b6d?_0x4a7b6d[_0x9ff8('0x16')]:![]);})[_0x9ff8('0x1a')](function(_0x4ab43f){_0x2b45b7(_0x4ab43f);});};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0x20')]=function(_0x54c645,_0x150428){this[_0x9ff8('0x12')][_0x9ff8('0x21')](_0x54c645)[_0x9ff8('0x15')](function(_0x2680a0){_0x150428(null,_0x2680a0?_0x2680a0[_0x9ff8('0x16')]:![]);})[_0x9ff8('0x1a')](function(_0x266dc7){_0x150428(_0x266dc7);});};AGIVertices[_0x9ff8('0x17')]['getSound']=function(_0x446361,_0x460519){var _0x495eff=this;this[_0x9ff8('0x12')][_0x9ff8('0x22')](_0x446361)['then'](function(_0x464406){_0x460519(null,_0x464406?_0x495eff[_0x9ff8('0x23')](_0x464406[_0x9ff8('0x24')]):![]);})[_0x9ff8('0x1a')](function(_0x33a874){_0x460519(_0x33a874);});};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0x25')]=function(_0xe2c681,_0x5e6cad){this[_0x9ff8('0x12')][_0x9ff8('0x26')](_0xe2c681)[_0x9ff8('0x15')](function(_0x431f80){_0x5e6cad(null,_0x431f80?_0x431f80:![]);})['catch'](function(_0x2f3186){_0x5e6cad(_0x2f3186);});};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0x27')]=function(_0x17cd64,_0x36445c,_0x212067){this['mailRpc'][_0x9ff8('0x27')](_0x17cd64,_0x36445c)[_0x9ff8('0x15')](function(){_0x212067(null);})['catch'](function(_0x247ac1){_0x212067(_0x247ac1);});};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0x28')]=function(_0x341588,_0x1f5bd9){this[_0x9ff8('0x12')][_0x9ff8('0x29')](_0x341588)[_0x9ff8('0x15')](function(_0x4a9bbc){if(_0x4a9bbc){if(_0x4a9bbc[_0x9ff8('0x2a')]){_0x1f5bd9(null,[_0x4a9bbc[_0x9ff8('0x2b')]]);}else{_0x1f5bd9(null,_[_0x9ff8('0x2c')](_0x4a9bbc[_0x9ff8('0x2d')],_0x9ff8('0x2b')));}}else{_0x1f5bd9(null,![]);}})[_0x9ff8('0x1a')](function(_0x52cbe9){_0x1f5bd9(_0x52cbe9);});};AGIVertices[_0x9ff8('0x17')]['getSoundPath']=function(_0x5ef4f0){return util['format'](_0x9ff8('0x2e'),FILES_PATH,_0x5ef4f0);};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0x2f')]=function(_0x2a2b6f,_0x30d732,_0x21b9b1){odbc['open'](_0x2a2b6f,function(_0x56af0f){if(_0x56af0f){logger[_0x9ff8('0x30')](_0x9ff8('0x31'),_0x56af0f);_0x21b9b1(_0x56af0f);}else{logger[_0x9ff8('0x32')](_0x9ff8('0x33'));odbc[_0x9ff8('0x34')](_0x30d732,function(_0x1810ab,_0x596cf2){if(_0x1810ab){logger[_0x9ff8('0x32')](_0x9ff8('0x35'),_0x30d732);_0x21b9b1(_0x1810ab);}else{logger[_0x9ff8('0x32')](_0x9ff8('0x36'),_0x30d732);odbc[_0x9ff8('0x37')](function(_0x37f6cc){if(_0x37f6cc){logger[_0x9ff8('0x30')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x37f6cc);}_0x21b9b1(null,_0x596cf2);});}});}});};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0x38')]=function(_0xd92153,_0x260014){this[_0x9ff8('0x12')][_0x9ff8('0x39')](_0xd92153)[_0x9ff8('0x15')](function(_0x457b6e){_0x260014(null,_0x457b6e?_0x457b6e:![]);})[_0x9ff8('0x1a')](function(_0x46c3ff){_0x260014(_0x46c3ff);});};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0x3a')]=function(_0x46c063,_0x598726){this['rpc'][_0x9ff8('0x3a')](_0x46c063)[_0x9ff8('0x15')](function(_0x14d44b){_0x598726(null,_0x14d44b);})[_0x9ff8('0x1a')](function(_0x6a1a82){_0x598726(_0x6a1a82);});};AGIVertices['prototype'][_0x9ff8('0x3b')]=function(_0x3f98e7,_0x53a71e,_0x3c7ed1){this[_0x9ff8('0x12')][_0x9ff8('0x3b')]({'uniqueid':this[_0x9ff8('0x11')][_0x9ff8('0x3c')],'node':_0x3f98e7['label'],'application':_0x3f98e7[_0x9ff8('0x3d')],'data':_0x53a71e||null,'project_name':this[_0x9ff8('0x11')][_0x9ff8('0x3e')],'callerid':this['channel'][_0x9ff8('0x3f')]})[_0x9ff8('0x15')](function(_0x19ce98){if(_0x3c7ed1){_0x3c7ed1(null,_0x19ce98);}})[_0x9ff8('0x1a')](function(_0x46dc1b){if(_0x3c7ed1){_0x3c7ed1(_0x46dc1b);}});};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0x40')]=function(_0x5a85ec,_0x215b84,_0x52b0c9,_0x298106){this[_0x9ff8('0x12')]['createSquareRecording']({'uniqueid':this['channel'][_0x9ff8('0x3c')],'callerid':this[_0x9ff8('0x11')][_0x9ff8('0x3f')],'calleridname':this[_0x9ff8('0x11')]['calleridname'],'context':this['channel'][_0x9ff8('0x41')],'extension':this[_0x9ff8('0x11')][_0x9ff8('0x42')],'priority':this[_0x9ff8('0x11')][_0x9ff8('0x43')],'accountcode':this[_0x9ff8('0x11')][_0x9ff8('0x44')],'dnid':this[_0x9ff8('0x11')][_0x9ff8('0x45')],'projectName':this['channel'][_0x9ff8('0x3e')],'saveName':_0x215b84,'filename':_0x5a85ec['file']||_0x215b84,'savePath':_0x52b0c9})[_0x9ff8('0x15')](function(_0xa1903d){_0x298106(null,_0xa1903d);})['catch'](function(_0x22c775){_0x298106(_0x22c775);});};AGIVertices['prototype']['createSquareMessage']=function(_0x1cbf20,_0x52169a,_0x4c7ff8,_0x4c6065,_0x2a387){this[_0x9ff8('0x12')][_0x9ff8('0x46')]({'uniqueid':this['channel'][_0x9ff8('0x3c')],'body':_0x1cbf20,'direction':_0x52169a,'providerName':_0x4c7ff8,'providerResponse':_0x4c6065})[_0x9ff8('0x15')](function(_0x2a077a){if(_0x2a387){_0x2a387(null,_0x2a077a);}})[_0x9ff8('0x1a')](function(_0x23c96b){if(_0x2a387){_0x2a387(_0x23c96b);}});};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0x47')]=function(_0x5765fe,_0x163558){this['rpc'][_0x9ff8('0x47')]({'firstName':_[_0x9ff8('0x48')](_0x5765fe['name'])||_[_0x9ff8('0x49')](_0x5765fe[_0x9ff8('0x16')])?_0x9ff8('0x4a')+Math[_0x9ff8('0x4b')]():_0x5765fe[_0x9ff8('0x16')],'lastName':_[_0x9ff8('0x48')](_0x5765fe[_0x9ff8('0x4c')])||_[_0x9ff8('0x49')](_0x5765fe[_0x9ff8('0x4c')])?null:_0x5765fe[_0x9ff8('0x4c')],'phone':_0x5765fe['phone'],'ListId':_0x5765fe[_0x9ff8('0x4d')],'scheduledat':_0x5765fe[_0x9ff8('0x4e')],'callbackUniqueid':this[_0x9ff8('0x11')][_0x9ff8('0x3c')],'tags':'callback','description':_0x9ff8('0x4f')+_0x5765fe[_0x9ff8('0x4e')][_0x9ff8('0x50')](),'priority':_0x5765fe['callback_priority']})[_0x9ff8('0x15')](function(_0x4712e0){_0x163558(null,_0x4712e0);})[_0x9ff8('0x1a')](function(_0x40edc7){_0x163558(_0x40edc7);});};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0x51')]=function(_0xa300f6,_0x38a5c8){this['rpc'][_0x9ff8('0x52')](_0xa300f6)[_0x9ff8('0x15')](function(_0x3ac0db){_0x38a5c8(null,_0x3ac0db?_0x3ac0db[_0x9ff8('0x16')]:![]);})['catch'](function(_0x5618fb){_0x38a5c8(_0x5618fb);});};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0x53')]=function(_0x2d4667,_0x2f3630,_0x3f56a9){var _0x2853d2={'role':_0x9ff8('0x54')};_0x2853d2[_0x2d4667]=this[_0x9ff8('0x11')]['callerid'];this[_0x9ff8('0x12')][_0x9ff8('0x53')](_0x2853d2,_0x2f3630,this[_0x9ff8('0x11')][_0x9ff8('0x3c')])[_0x9ff8('0x15')](function(_0x2015b9){_0x3f56a9(null,_[_0x9ff8('0x49')](_0x2015b9)?![]:!![]);})[_0x9ff8('0x1a')](function(_0x2d0c1d){logger['error'](_0x2d0c1d);_0x3f56a9(null,![]);});};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0x55')]=function(_0x15526d,_0x1aa88a){var _0x44c2b8={'role':_0x9ff8('0x54')};_0x44c2b8[_0x15526d]=this['channel'][_0x9ff8('0x3f')];this[_0x9ff8('0x12')][_0x9ff8('0x55')](_0x44c2b8)['then'](function(_0x721aa0){_0x1aa88a(null,_['isNil'](_0x721aa0)?![]:!![]);})[_0x9ff8('0x1a')](function(_0x45079c){logger[_0x9ff8('0x30')](_0x45079c);_0x1aa88a(null,![]);});};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0x56')]=function(_0x45d5ca,_0x2c0a7c){var _0x368ee4={'role':'agent'};_0x368ee4[_0x45d5ca]=this[_0x9ff8('0x11')][_0x9ff8('0x3f')];this[_0x9ff8('0x12')][_0x9ff8('0x56')](_0x368ee4)[_0x9ff8('0x15')](function(_0x3cb541){_0x2c0a7c(null,_['isNil'](_0x3cb541)?![]:!![]);})['catch'](function(_0x14d759){logger[_0x9ff8('0x30')](_0x14d759);_0x2c0a7c(null,![]);});};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0x57')]=function(_0x2a244f,_0x22e56e){var _0x123a68={'role':_0x9ff8('0x54')};_0x123a68[_0x2a244f]=this[_0x9ff8('0x11')][_0x9ff8('0x3f')];var _0x1a909f=_0x2a244f!=_0x9ff8('0x58')?util[_0x9ff8('0x59')](_0x9ff8('0x5a'),_0x9ff8('0x5b'),this[_0x9ff8('0x11')][_0x9ff8('0x3f')]):undefined;this[_0x9ff8('0x12')][_0x9ff8('0x57')](_0x123a68,_0x1a909f)[_0x9ff8('0x15')](function(_0x3ebd38){_0x22e56e(null,_[_0x9ff8('0x49')](_0x3ebd38)?![]:!![]);})[_0x9ff8('0x1a')](function(_0x3d7991){logger[_0x9ff8('0x30')](_0x3d7991);_0x22e56e(null,![]);});};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0x5c')]=function(_0x53ed7f,_0x50bc09){sh['exec'](_[_0x9ff8('0x5d')](_0x53ed7f),function(_0x508851,_0x2d795d){var _0x53444d=_0x2d795d[_0x9ff8('0x5e')](/(\r\n|\n|\r)/gm,'');_0x50bc09(null,_0x53444d);});};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0x5f')]=function(_0x288adc,_0x3be0cb){scripts['googleCloudTTS'](_0x288adc[_0x9ff8('0x60')],_0x288adc[_0x9ff8('0x61')]||_0x9ff8('0x62'),_0x288adc[_0x9ff8('0x62')],_0x288adc['languageCode']||_0x9ff8('0x63'),_0x288adc[_0x9ff8('0x64')]||_0x9ff8('0x65'),_0x288adc[_0x9ff8('0x66')]||_0x9ff8('0x67'))[_0x9ff8('0x15')](function(_0x98d465){_0x3be0cb(null,_0x98d465);})[_0x9ff8('0x1a')](function(_0x5b96eb){_0x3be0cb(_0x5b96eb);});};AGIVertices[_0x9ff8('0x17')]['googleTTS']=function(_0x5686ca,_0x18ed13){scripts[_0x9ff8('0x68')](_0x5686ca[_0x9ff8('0x62')],_0x5686ca['google_tts_language']||'en',0x1)[_0x9ff8('0x15')](function(_0x381603){_0x18ed13(null,_0x381603);})[_0x9ff8('0x1a')](function(_0x4cc940){_0x18ed13(_0x4cc940);});};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0x69')]=function(_0x48847f,_0x345e28){var _0x26ba98={'uri':_0x48847f[_0x9ff8('0x6a')],'method':_0x48847f['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x48847f['timeout'])==='number'&&parseInt(_0x48847f[_0x9ff8('0x6b')])>=0x1?parseInt(_0x48847f[_0x9ff8('0x6b')])*0x3e8:0x5*0x3e8};if(_['includes'](['POST',_0x9ff8('0x6c')],_0x26ba98[_0x9ff8('0x6d')][_0x9ff8('0x6e')]())){try{_0x26ba98[_0x9ff8('0x6f')]=_0x48847f['rawBody']?JSON['parse'](_0x48847f['rawBody']):{};}catch(_0xd26f27){logger[_0x9ff8('0x30')](_0x9ff8('0x70'),_0xd26f27);}}try{_0x26ba98['headers']=_0x48847f[_0x9ff8('0xd')]?JSON[_0x9ff8('0x71')](_0x48847f['rawHeaders']):{};}catch(_0xf38020){logger[_0x9ff8('0x30')](_0x9ff8('0x72'),_0xf38020);}if(_0x48847f[_0x9ff8('0x73')]){try{var _0x1d0c83=require(_0x48847f[_0x9ff8('0x73')])['sync'](this,_0x26ba98);_0x26ba98[_0x9ff8('0x74')]=Mustache[_0x9ff8('0x75')](_0x48847f[_0x9ff8('0x6a')],_0x1d0c83,{},['$$','$$']);if(_0x26ba98[_0x9ff8('0x76')]){_0x26ba98[_0x9ff8('0x76')]=JSON['parse'](Mustache[_0x9ff8('0x75')](JSON[_0x9ff8('0x77')](_0x26ba98[_0x9ff8('0x76')]),_0x1d0c83,{},['$$','$$']));}if(_0x26ba98[_0x9ff8('0x6f')]){_0x26ba98[_0x9ff8('0x6f')]=JSON[_0x9ff8('0x71')](Mustache[_0x9ff8('0x75')](JSON[_0x9ff8('0x77')](_0x26ba98[_0x9ff8('0x6f')]),_0x1d0c83,{},['$$','$$']));}}catch(_0x2d89cf){logger[_0x9ff8('0x30')](_0x9ff8('0x78'),_0x2d89cf);}}rp(_0x26ba98)[_0x9ff8('0x15')](function(_0x8ca1bf){var _0x424c0c={'statusCode':_0x8ca1bf[_0x9ff8('0x79')]||0xc8,'statusMessage':_0x8ca1bf[_0x9ff8('0x7a')]||'OK','headers':_0x8ca1bf['headers']||{},'body':_0x8ca1bf[_0x9ff8('0x6f')]||{}};_0x345e28(null,_0x424c0c);})[_0x9ff8('0x1a')](function(_0x274f98){var _0x3de2e4={'statusCode':_0x274f98[_0x9ff8('0x79')]||0x1f4,'statusMessage':_0x274f98[_0x9ff8('0x7b')]||_0x9ff8('0x7c'),'headers':_0x274f98[_0x9ff8('0x7d')]['headers']||{},'body':_0x274f98[_0x9ff8('0x7d')][_0x9ff8('0x6f')]||{}};_0x345e28(null,_0x3de2e4);});};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0x7e')]=function(_0x2c1e07,_0xe337dc){scripts[_0x9ff8('0x7e')](this[_0x9ff8('0x11')][_0x9ff8('0x3c')],_0x2c1e07[_0x9ff8('0x7f')],_0x2c1e07[_0x9ff8('0x62')],_0x2c1e07[_0x9ff8('0x80')]||'en')['then'](function(_0x41af0d){_0xe337dc(null,_0x41af0d);})[_0x9ff8('0x1a')](function(_0x1fe9d4){_0xe337dc(_0x1fe9d4);});};AGIVertices['prototype'][_0x9ff8('0x81')]=function(_0xfaffdf,_0x4fa04d){scripts[_0x9ff8('0x81')](this[_0x9ff8('0x11')][_0x9ff8('0x3c')],_0xfaffdf[_0x9ff8('0x82')],_0xfaffdf[_0x9ff8('0x83')],_0xfaffdf[_0x9ff8('0x84')],_0xfaffdf[_0x9ff8('0x62')],_0xfaffdf[_0x9ff8('0x85')]||'en')[_0x9ff8('0x15')](function(_0x4270b5){_0x4fa04d(null,_0x4270b5);})[_0x9ff8('0x1a')](function(_0x357d8f){_0x4fa04d(_0x357d8f);});};AGIVertices['prototype'][_0x9ff8('0x86')]=function(_0x9bd174,_0x208f49){scripts[_0x9ff8('0x86')](this[_0x9ff8('0x11')],_0x9bd174)[_0x9ff8('0x15')](function(_0xa1bccf){_0x208f49(null,_0xa1bccf);})['catch'](function(_0x114b00){_0x208f49(_0x114b00);});};AGIVertices['prototype'][_0x9ff8('0x87')]=function(_0x20aa8b,_0x5c507e){scripts[_0x9ff8('0x87')](_0x20aa8b[_0x9ff8('0x7f')],_0x20aa8b[_0x9ff8('0x62')],_0x20aa8b[_0x9ff8('0x88')]||_0x9ff8('0x63'),_0x20aa8b[_0x9ff8('0x89')])[_0x9ff8('0x15')](function(_0xaeb87e){_0x5c507e(null,_0xaeb87e);})['catch'](function(_0x4ff503){_0x5c507e(_0x4ff503);});};AGIVertices[_0x9ff8('0x17')]['ispeechASR']=function(_0x675151,_0x45b058,_0x12ef8c){scripts['ispeechASR'](_0x45b058,_0x675151[_0x9ff8('0x7f')],_0x675151[_0x9ff8('0x8a')]||_0x9ff8('0x63'),this[_0x9ff8('0x8b')](_0x675151['model'])?_0x675151[_0x9ff8('0x8c')]:undefined)[_0x9ff8('0x15')](function(_0x59254f){_0x12ef8c(null,_0x59254f);})[_0x9ff8('0x1a')](function(_0x362ce2){_0x12ef8c(_0x362ce2);});};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0x8d')]=function(_0x1ab5d8,_0x2acfcc){scripts['awsPolly'](_0x1ab5d8[_0x9ff8('0x8e')],_0x1ab5d8[_0x9ff8('0x8f')],_0x1ab5d8['aws_polly_region'],_0x1ab5d8['aws_polly_voice']||'Amy',_0x1ab5d8['text'],_0x1ab5d8[_0x9ff8('0x90')]||_0x9ff8('0x62'))[_0x9ff8('0x15')](function(_0x1a712c){_0x2acfcc(null,_0x1a712c);})['catch'](function(_0x1be424){_0x2acfcc(_0x1be424);});};AGIVertices[_0x9ff8('0x17')]['awsLex']=function(_0x3ac29d,_0x2b4c95){scripts['awsLex'](this[_0x9ff8('0x11')]['uniqueid'],_0x3ac29d[_0x9ff8('0x8e')],_0x3ac29d[_0x9ff8('0x8f')],_0x3ac29d['aws_lex_region'],_0x3ac29d[_0x9ff8('0x62')],_0x3ac29d[_0x9ff8('0x91')])['then'](function(_0xe427e4){_0x2b4c95(null,_0xe427e4);})[_0x9ff8('0x1a')](function(_0xdbc135){_0x2b4c95(_0xdbc135);});};AGIVertices[_0x9ff8('0x17')]['googleASR']=function(_0x1baf92,_0x4bbfa2,_0x1c9653){scripts[_0x9ff8('0x92')](_0x4bbfa2,_0x1baf92[_0x9ff8('0x7f')],_0x1baf92[_0x9ff8('0x93')]||'en-US')[_0x9ff8('0x15')](function(_0x48a8b3){_0x1c9653(null,_0x48a8b3);})['catch'](function(_0xb18458){_0x1c9653(_0xb18458);});};AGIVertices[_0x9ff8('0x17')]['tildeASR']=function(_0x1369d9,_0x2f337f,_0x55c419){scripts['tildeASR'](_0x2f337f,_0x1369d9[_0x9ff8('0x94')],_0x1369d9['appsecret'],_0x1369d9['uri'])[_0x9ff8('0x15')](function(_0x40ca2f){_0x55c419(null,_0x40ca2f);})[_0x9ff8('0x1a')](function(_0x4eb491){_0x55c419(_0x4eb491);});};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0x95')]=function(_0x28281b){var _0x27b712=_[_0x9ff8('0x96')](verticesWithRetry,_0x28281b[_0x9ff8('0x3d')])?_0x28281b:_[_0x9ff8('0x97')](_0x28281b);for(var _0xe5b8d8 in _0x27b712){if(_0x27b712[_0x9ff8('0x98')](_0xe5b8d8)){if(_0x27b712[_0xe5b8d8]&&_[_0x9ff8('0x99')](_0x27b712[_0xe5b8d8])){if(_['includes'](recursiveMapAttributes,_0xe5b8d8)){_0x27b712[_0xe5b8d8]=this[_0x9ff8('0x9a')](_0x27b712[_0xe5b8d8]);}else{_0x27b712[_0xe5b8d8]=this[_0x9ff8('0x9b')](_0x27b712[_0xe5b8d8]);}}}}return _0x27b712;};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0x9c')]=function(_0x2e9d8d){for(var _0x116c28 in _0x2e9d8d){if(_0x2e9d8d['hasOwnProperty'](_0x116c28)){if(_['isPlainObject'](_0x2e9d8d[_0x116c28])){this[_0x9ff8('0x9c')](_0x2e9d8d[_0x116c28]);}else if(_[_0x9ff8('0x9d')](_0x2e9d8d[_0x116c28])){for(var _0x12f1b7=0x0;_0x12f1b7<_0x2e9d8d[_0x116c28][_0x9ff8('0x9e')];_0x12f1b7++){this['recursiveNodeIndex'](_0x2e9d8d[_0x116c28][_0x12f1b7]);}}else if(_['isString'](_0x2e9d8d[_0x116c28])){_0x2e9d8d[_0x116c28]=this[_0x9ff8('0x9b')](_0x2e9d8d[_0x116c28]);}}}};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0x9f')]=function(_0x15553a,_0x31ed23){for(var _0xcf1e64 in _0x15553a){if(_0x15553a[_0x9ff8('0x98')](_0xcf1e64)){if(_[_0x9ff8('0xa0')](_0x15553a[_0xcf1e64])){if(!_[_0x9ff8('0x48')](_0x15553a[_0xcf1e64])){this[_0x9ff8('0x9f')](_0x15553a[_0xcf1e64],util[_0x9ff8('0x59')]('%s.%s',_0x31ed23,_0xcf1e64));}}else if(_['isArray'](_0x15553a[_0xcf1e64])){for(var _0x5c7482=0x0;_0x5c7482<_0x15553a[_0xcf1e64][_0x9ff8('0x9e')];_0x5c7482++){this[_0x9ff8('0x9f')](_0x15553a[_0xcf1e64][_0x5c7482],util[_0x9ff8('0x59')](_0x9ff8('0xa1'),_0x31ed23,_0xcf1e64+'['+_0x5c7482+']'));}}else{if(!_[_0x9ff8('0x49')](_0x15553a[_0xcf1e64])){this[_0x9ff8('0x11')][_0x9ff8('0xa2')](util[_0x9ff8('0x59')](_0x9ff8('0xa1'),_0x31ed23,_0xcf1e64),_0x15553a[_0xcf1e64]);}}}}};AGIVertices[_0x9ff8('0x17')]['replaceObjectAllVariables']=function(_0x4ce9db){try{var _0x4b21aa=JSON['parse'](_0x4ce9db);this['recursiveNodeIndex'](_0x4b21aa);return JSON[_0x9ff8('0x77')](_0x4b21aa);}catch(_0x2e958e){return this[_0x9ff8('0x9b')](_0x4ce9db);}};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0x9b')]=function(_0x433f31){var _0x2bc34b=_0x433f31[_0x9ff8('0xa3')]('{');for(var _0x53b527=0x1;_0x53b527<_0x2bc34b[_0x9ff8('0x9e')];_0x53b527+=0x1){var _0x24beaf=_0x2bc34b[_0x53b527]['split']('}');if(_0x24beaf[_0x9ff8('0x9e')]>0x1){_0x433f31=_0x433f31[_0x9ff8('0xa4')]('{'+_0x24beaf[0x0]+'}',this[_0x9ff8('0x11')][_0x9ff8('0x14')](_0x24beaf[0x0])[_0x9ff8('0xa5')]||_0x24beaf[0x0]);}}if(_0x2bc34b[_0x9ff8('0x9e')]===0x1){return _0x433f31[_0x9ff8('0x50')]();}return this['replaceAllVariables'](_0x433f31);};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0xa6')]=function(_0x2b4055,_0x101d68){var _0xe99923=this[_0x9ff8('0x11')][_0x9ff8('0x14')](_0x2b4055);if(_0xe99923[_0x9ff8('0xa7')]===-0x1){return _0xe99923;}logger[_0x9ff8('0x32')](util[_0x9ff8('0x59')](_0x9ff8('0xa8'),_0x101d68,_0xe99923[_0x9ff8('0xa5')]));return this[_0x9ff8('0x11')][_0x9ff8('0xa2')](_0x101d68,_0xe99923['extra']);};AGIVertices[_0x9ff8('0x17')]['isConfigured']=function(_0x5b8448){return _0x5b8448&&_0x5b8448!=='0'&&_0x5b8448!=='-1'&&_0x5b8448!=='';};AGIVertices['prototype']['maxRetry']=function(_0x5853c2){this[_0x9ff8('0x3b')][_0x9ff8('0xa9')](this,_0x5853c2,'-');_0x5853c2['retry']=_0x5853c2[_0x9ff8('0xaa')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0xab')]=function(_0x154501){logger[_0x9ff8('0x32')](util[_0x9ff8('0x59')](_0x9ff8('0xac'),_0x154501[_0x9ff8('0xad')]));if(!this[_0x9ff8('0x8b')](_0x154501[_0x9ff8('0x62')])){return this[_0x9ff8('0x11')]['noop']('no\x20text\x20configured');}var _0x206532='\x22'+_0x154501[_0x9ff8('0x62')]+'\x22';if(this[_0x9ff8('0x8b')](_0x154501[_0x9ff8('0x7d')])){_0x206532+=','+_0x154501[_0x9ff8('0x7d')];}var _0x1be48b=this[_0x9ff8('0x11')][_0x9ff8('0xae')]('MRCPSynth',_0x206532);if(_0x1be48b['result']===-0x1){return _0x1be48b;}return this[_0x9ff8('0x11')][_0x9ff8('0xaf')](util[_0x9ff8('0x59')](_0x9ff8('0xb0'),_0x206532));};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0xb1')]=function(_0x5aeecb){logger['info'](util[_0x9ff8('0x59')](_0x9ff8('0xb2'),_0x5aeecb[_0x9ff8('0xad')]));if(!this[_0x9ff8('0x8b')](_0x5aeecb[_0x9ff8('0xb3')])){return this[_0x9ff8('0x11')][_0x9ff8('0xaf')]('no\x20grammar\x20configured');}var _0x2809a6=_0x5aeecb[_0x9ff8('0xb3')];if(this[_0x9ff8('0x8b')](_0x5aeecb['options'])){_0x2809a6+=','+_0x5aeecb['options'];}var _0x5355c7=this['channel'][_0x9ff8('0xae')](_0x9ff8('0xb4'),_0x2809a6);if(_0x5355c7[_0x9ff8('0xa7')]===-0x1){return _0x5355c7;}var _0xdd1c9d=this['getAndSetVariable'](_0x9ff8('0xb5'),_0x9ff8('0xb6'));if(_0xdd1c9d[_0x9ff8('0xa7')]===-0x1){return _0xdd1c9d;}var _0x180e12=this['getAndSetVariable'](_0x9ff8('0xb7'),'MRCP_RECOG_TRANSCRIPT');if(_0x180e12['result']===-0x1){return _0x180e12;}var _0x5351d0=this['getAndSetVariable']('RECOG_INSTANCE()',_0x9ff8('0xb8'));if(_0x5351d0[_0x9ff8('0xa7')]===-0x1){return _0x5351d0;}return this['channel']['noop'](util[_0x9ff8('0x59')](_0x9ff8('0xb9'),_0x2809a6));};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0xa')]=function(_0x39fbca){logger[_0x9ff8('0x32')](util[_0x9ff8('0x59')](_0x9ff8('0xba'),_0x39fbca['label']));return this[_0x9ff8('0x11')][_0x9ff8('0xa')]([_0x39fbca[_0x9ff8('0xbb')],_0x39fbca[_0x9ff8('0xbc')]]);};AGIVertices[_0x9ff8('0x17')]['answer']=function(_0x22e737){logger[_0x9ff8('0x32')](util[_0x9ff8('0x59')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x22e737[_0x9ff8('0xad')]));if(this['isConfigured'](_0x22e737['timeout'])){logger['info'](util[_0x9ff8('0x59')](_0x9ff8('0xbd'),_0x22e737[_0x9ff8('0x6b')]));var _0x18ddc1=this[_0x9ff8('0x11')][_0x9ff8('0xbe')](_0x22e737[_0x9ff8('0x6b')]);if(_0x18ddc1['result']===-0x1){return _0x18ddc1;}}return this[_0x9ff8('0x11')]['answer']();};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0xbf')]=function(_0x5ce96f){logger[_0x9ff8('0x32')](util[_0x9ff8('0x59')](_0x9ff8('0xc0'),_0x5ce96f[_0x9ff8('0xad')]));if(!this[_0x9ff8('0x8b')](_0x5ce96f['list_id'])){return this[_0x9ff8('0x11')]['error'](_0x5ce96f,_0x9ff8('0xc1'));}_0x5ce96f[_0x9ff8('0x4e')]=moment();if(this['isConfigured'](_0x5ce96f[_0x9ff8('0xc2')])){_0x5ce96f[_0x9ff8('0x4e')]=moment()[_0x9ff8('0xc3')](_0x5ce96f[_0x9ff8('0xc2')],_0x9ff8('0xc4'));}if(!this[_0x9ff8('0x8b')](_0x5ce96f[_0x9ff8('0xc5')])){_0x5ce96f[_0x9ff8('0xc5')]=0x2;}this['createCmContact'][_0x9ff8('0xa9')](this,_0x5ce96f);return this[_0x9ff8('0x11')][_0x9ff8('0xaf')](util[_0x9ff8('0x59')](_0x9ff8('0xc6'),_0x5ce96f['phone'],_0x5ce96f[_0x9ff8('0x4d')],_0x5ce96f['scheduledAt']));};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0xc7')]=function(_0xb373b3){logger[_0x9ff8('0x32')](util['format'](_0x9ff8('0xc8'),_0xb373b3[_0x9ff8('0xad')]));var _0x5c6155=this[_0x9ff8('0x11')][_0x9ff8('0xae')](_0xb373b3[_0x9ff8('0xc9')],_0xb373b3['options']);if(_0x5c6155[_0x9ff8('0xa7')]===-0x1){return _0x5c6155;}return this[_0x9ff8('0x11')]['noop'](util['format'](_0x9ff8('0xca'),_0xb373b3[_0x9ff8('0xc9')],_0xb373b3['options']));};AGIVertices[_0x9ff8('0x17')]['lumenvoxtts']=function(_0x2ae70e){logger['info'](util['format']('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x2ae70e[_0x9ff8('0xad')]));if(!this[_0x9ff8('0x8b')](_0x2ae70e[_0x9ff8('0x62')])){return this[_0x9ff8('0x11')][_0x9ff8('0xaf')](_0x9ff8('0xcb'));}var _0x27ebf0='\x22'+_0x2ae70e[_0x9ff8('0x62')]+'\x22';if(this['isConfigured'](_0x2ae70e[_0x9ff8('0x7d')])){_0x27ebf0+=','+_0x2ae70e['options'];}var _0x35eee3=this[_0x9ff8('0x11')][_0x9ff8('0xae')](_0x9ff8('0xcc'),_0x27ebf0);if(_0x35eee3[_0x9ff8('0xa7')]===-0x1){return _0x35eee3;}return this[_0x9ff8('0x11')]['noop'](util[_0x9ff8('0x59')](_0x9ff8('0xb0'),_0x27ebf0));};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0xcd')]=function(_0x406500){logger[_0x9ff8('0x32')](util[_0x9ff8('0x59')](_0x9ff8('0xce'),_0x406500[_0x9ff8('0xad')]));if(!this['isConfigured'](_0x406500[_0x9ff8('0x62')])){return this[_0x9ff8('0x11')][_0x9ff8('0xaf')](_0x9ff8('0xcb'));}var _0xcd34e='\x22'+_0x406500[_0x9ff8('0x62')]+'\x22';if(this['isConfigured'](_0x406500[_0x9ff8('0x7d')])){_0xcd34e+=','+_0x406500[_0x9ff8('0x7d')];}var _0x270b6c=this[_0x9ff8('0x11')][_0x9ff8('0xae')](_0x9ff8('0xcc'),_0xcd34e);if(_0x270b6c[_0x9ff8('0xa7')]===-0x1){return _0x270b6c;}return this['channel']['noop'](util[_0x9ff8('0x59')](_0x9ff8('0xb0'),_0xcd34e));};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0xcf')]=function(_0x3f8eda){logger[_0x9ff8('0x32')](util[_0x9ff8('0x59')](_0x9ff8('0xd0'),_0x3f8eda['label']));if(!this['isConfigured'](_0x3f8eda['grammar'])){return this[_0x9ff8('0x11')][_0x9ff8('0xaf')]('no\x20grammar\x20configured');}var _0x1b9688=_0x3f8eda[_0x9ff8('0xb3')];if(this[_0x9ff8('0x8b')](_0x3f8eda['options'])){_0x1b9688+=','+_0x3f8eda[_0x9ff8('0x7d')];}var _0x569588=this[_0x9ff8('0x11')][_0x9ff8('0xae')](_0x9ff8('0xb4'),_0x1b9688);if(_0x569588['result']===-0x1){return _0x569588;}var _0x322176=this[_0x9ff8('0xa6')]('RECOG_CONFIDENCE()',_0x9ff8('0xd1'));if(_0x322176['result']===-0x1){return _0x322176;}var _0xbb47b3=this[_0x9ff8('0xa6')]('RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT');if(_0xbb47b3[_0x9ff8('0xa7')]===-0x1){return _0xbb47b3;}var _0x292d41=this[_0x9ff8('0xa6')](_0x9ff8('0xd2'),_0x9ff8('0xd3'));if(_0x292d41['result']===-0x1){return _0x292d41;}return this['channel'][_0x9ff8('0xaf')](util[_0x9ff8('0x59')](_0x9ff8('0xb9'),_0x1b9688));};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0xd4')]=function(_0x5f14f3){logger[_0x9ff8('0x32')](util[_0x9ff8('0x59')](_0x9ff8('0xd5'),_0x5f14f3['label']));if(!this[_0x9ff8('0x8b')](_0x5f14f3[_0x9ff8('0xb3')])){return this['channel'][_0x9ff8('0xaf')](_0x9ff8('0xd6'));}var _0x7a1df=_0x5f14f3[_0x9ff8('0xb3')];if(this['isConfigured'](_0x5f14f3[_0x9ff8('0x7d')])){_0x7a1df+=','+_0x5f14f3[_0x9ff8('0x7d')];}var _0x1450be=this[_0x9ff8('0x11')][_0x9ff8('0xae')](_0x9ff8('0xb4'),_0x7a1df);if(_0x1450be[_0x9ff8('0xa7')]===-0x1){return _0x1450be;}var _0x3e7ab1=this[_0x9ff8('0xa6')](_0x9ff8('0xb5'),_0x9ff8('0xd7'));if(_0x3e7ab1['result']===-0x1){return _0x3e7ab1;}var _0x4d4989=this['getAndSetVariable'](_0x9ff8('0xb7'),_0x9ff8('0xd8'));if(_0x4d4989[_0x9ff8('0xa7')]===-0x1){return _0x4d4989;}var _0x1fa2e1=this[_0x9ff8('0xa6')]('RECOG_INSTANCE()',_0x9ff8('0xd9'));if(_0x1fa2e1[_0x9ff8('0xa7')]===-0x1){return _0x1fa2e1;}return this[_0x9ff8('0x11')]['noop'](util[_0x9ff8('0x59')](_0x9ff8('0xb9'),_0x7a1df));};AGIVertices[_0x9ff8('0x17')]['database']=function(_0x2117f7){logger['info'](util[_0x9ff8('0x59')](_0x9ff8('0xda'),_0x2117f7[_0x9ff8('0xad')]));if(!this[_0x9ff8('0x8b')](_0x2117f7[_0x9ff8('0xdb')])){return this[_0x9ff8('0x11')][_0x9ff8('0x30')](_0x2117f7,_0x9ff8('0xdc'));}var _0x263b4e=this[_0x9ff8('0x1c')][_0x9ff8('0xa9')](this,_0x2117f7[_0x9ff8('0xdb')]);if(!_0x263b4e){return this[_0x9ff8('0x11')]['error'](_0x2117f7,_0x9ff8('0xdd'));}if(!this[_0x9ff8('0x8b')](_0x2117f7[_0x9ff8('0x34')])){return this[_0x9ff8('0x11')]['error'](_0x2117f7,_0x9ff8('0xde'));}var _0x2d8487=_0x2117f7[_0x9ff8('0x34')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x9ff8('0x11')][_0x9ff8('0xaf')](util[_0x9ff8('0x59')](_0x9ff8('0xdf'),_0x2d8487));var _0xbd3d93=this['getQueryOdbc'][_0x9ff8('0xa9')](this,_0x263b4e,_0x2d8487);this[_0x9ff8('0x3b')][_0x9ff8('0xa9')](this,_0x2117f7,_0x2d8487);if(!this[_0x9ff8('0x8b')](_0x2117f7[_0x9ff8('0xe0')])){return this[_0x9ff8('0x11')]['noop'](_0x9ff8('0xe1'));}var _0x1ec4e0=this[_0x9ff8('0x14')][_0x9ff8('0xa9')](this,_0x2117f7[_0x9ff8('0xe0')]);if(!_0x1ec4e0){return this[_0x9ff8('0x11')][_0x9ff8('0x30')](_0x2117f7,'no\x20variable\x20found');}var _0x3e0bbd=this;_0xbd3d93[_0x9ff8('0xe2')](function(_0x41dfda,_0x592efb){Object[_0x9ff8('0xe3')](_0x41dfda)['forEach'](function(_0x5cb1fb){_0x3e0bbd[_0x9ff8('0x11')][_0x9ff8('0xa2')](util[_0x9ff8('0x59')](_0x9ff8('0xe4'),_0x1ec4e0,_0x592efb,_0x5cb1fb),_0x41dfda[_0x5cb1fb]);});});this[_0x9ff8('0x11')]['setVariable'](util[_0x9ff8('0x59')](_0x9ff8('0xe5'),_0x1ec4e0),_0xbd3d93[_0x9ff8('0x9e')]);return this[_0x9ff8('0x11')][_0x9ff8('0xaf')](util[_0x9ff8('0x59')](_0x9ff8('0xe6'),_0x1ec4e0));};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0xe7')]=function(_0x2b47fb){logger['debug'](util[_0x9ff8('0x59')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x2b47fb['label']));if(!this[_0x9ff8('0x8b')](_0x2b47fb[_0x9ff8('0xe8')])){return this[_0x9ff8('0x11')]['error'](_0x2b47fb,_0x9ff8('0xe9'));}var _0x260673=this[_0x9ff8('0x1e')][_0x9ff8('0xa9')](this,_0x2b47fb[_0x9ff8('0xe8')]);if(!_0x260673){return this['channel'][_0x9ff8('0x30')](_0x2b47fb,_0x9ff8('0xea'));}var _0x2f7d5e=this[_0x9ff8('0x11')]['exec']('DIAL',[util[_0x9ff8('0x59')](_0x9ff8('0xeb'),_0x260673),_0x2b47fb[_0x9ff8('0x6b')],_0x2b47fb[_0x9ff8('0xec')],_0x2b47fb[_0x9ff8('0x6a')]]);if(_0x2f7d5e[_0x9ff8('0xa7')]===-0x1){return _0x2f7d5e;}return this[_0x9ff8('0x11')][_0x9ff8('0xaf')](util[_0x9ff8('0x59')](_0x9ff8('0xed'),'DIAL'));};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0xee')]=function(_0x5b25df){logger[_0x9ff8('0x32')](util[_0x9ff8('0x59')](_0x9ff8('0xef'),_0x5b25df[_0x9ff8('0xad')]));if(!this[_0x9ff8('0x8b')](_0x5b25df[_0x9ff8('0x7f')])){return this[_0x9ff8('0x11')]['noop'](_0x9ff8('0xf0'));}if(!this[_0x9ff8('0x8b')](_0x5b25df['text'])){return this[_0x9ff8('0x11')]['noop'](_0x9ff8('0xcb'));}this[_0x9ff8('0x11')]['bot']=!![];this[_0x9ff8('0x3b')](_0x5b25df);this['createSquareMessage'](_0x5b25df[_0x9ff8('0x62')],'in','','');this[_0x9ff8('0x11')][_0x9ff8('0xaf')](util['format'](_0x9ff8('0xf1'),_0x5b25df[_0x9ff8('0x62')]));var _0x3330d1=this[_0x9ff8('0x7e')][_0x9ff8('0xa9')](this,_0x5b25df);if(_0x3330d1){for(var _0x2101af in _0x3330d1){if(_0x3330d1['hasOwnProperty'](_0x2101af)){this[_0x9ff8('0x11')][_0x9ff8('0xa2')](util['format'](_0x9ff8('0xf2'),_0x2101af[_0x9ff8('0x6e')]()),_0x3330d1[_0x2101af]);}}this['createSquareMessage'](_0x3330d1[_0x9ff8('0xf3')],_0x9ff8('0xf4'),'dialogflow','');return this[_0x9ff8('0x11')][_0x9ff8('0xaf')](util[_0x9ff8('0x59')](_0x9ff8('0xf5'),_0x3330d1['speech']));}return this[_0x9ff8('0x11')][_0x9ff8('0x30')](_0x5b25df,_0x9ff8('0xf6'));};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0xf7')]=function(_0x48388a){logger[_0x9ff8('0x32')](util[_0x9ff8('0x59')](_0x9ff8('0xf8'),_0x48388a[_0x9ff8('0xad')]));if(!this[_0x9ff8('0x8b')](_0x48388a[_0x9ff8('0x82')])){return this[_0x9ff8('0x11')][_0x9ff8('0xaf')](_0x9ff8('0xf9'));}if(!this['isConfigured'](_0x48388a[_0x9ff8('0x83')])){return this[_0x9ff8('0x11')]['noop'](_0x9ff8('0xfa'));}if(!this[_0x9ff8('0x8b')](_0x48388a[_0x9ff8('0x84')])){return this[_0x9ff8('0x11')][_0x9ff8('0xaf')]('no\x20private_key\x20configured');}if(!this[_0x9ff8('0x8b')](_0x48388a[_0x9ff8('0x85')])){return this['channel'][_0x9ff8('0xaf')](_0x9ff8('0xfb'));}if(!this[_0x9ff8('0x8b')](_0x48388a['text'])){return this[_0x9ff8('0x11')][_0x9ff8('0xaf')](_0x9ff8('0xcb'));}this[_0x9ff8('0x11')][_0x9ff8('0xfc')]=!![];this[_0x9ff8('0x3b')](_0x48388a);this[_0x9ff8('0x46')](_0x48388a[_0x9ff8('0x62')],'in','','');this[_0x9ff8('0x11')][_0x9ff8('0xaf')](util[_0x9ff8('0x59')](_0x9ff8('0xfd'),_0x48388a[_0x9ff8('0x62')]));var _0x8fc5f=this[_0x9ff8('0x81')][_0x9ff8('0xa9')](this,_0x48388a);if(_0x8fc5f){for(var _0x303efe in _0x8fc5f){if(_0x8fc5f[_0x9ff8('0x98')](_0x303efe)){if(_0x303efe!=='providerResponse'){this[_0x9ff8('0x11')][_0x9ff8('0xa2')](util[_0x9ff8('0x59')]('DIALOGFLOW_%s',_0x303efe[_0x9ff8('0x6e')]()),_0x8fc5f[_0x303efe]);}}}this[_0x9ff8('0x46')](_0x8fc5f[_0x9ff8('0xf3')],_0x9ff8('0xf4'),_0x9ff8('0xf7'),_0x8fc5f['providerResponse']);return this[_0x9ff8('0x11')][_0x9ff8('0xaf')](util[_0x9ff8('0x59')](_0x9ff8('0xfe'),_0x8fc5f[_0x9ff8('0xf3')]));}return this['channel']['error'](_0x48388a,'DialogflowV2\x20is\x20unreachable');};AGIVertices['prototype']['sesteknda']=function(_0x4df8bd){logger[_0x9ff8('0x32')](util[_0x9ff8('0x59')](_0x9ff8('0xff'),_0x4df8bd[_0x9ff8('0xad')]));if(!this[_0x9ff8('0x8b')](_0x4df8bd[_0x9ff8('0x100')])){return this[_0x9ff8('0x11')]['noop'](_0x9ff8('0x101'));}if(!this[_0x9ff8('0x8b')](_0x4df8bd[_0x9ff8('0x102')])){return this[_0x9ff8('0x11')][_0x9ff8('0xaf')](_0x9ff8('0x103'));}if(!this[_0x9ff8('0x8b')](_0x4df8bd[_0x9ff8('0x104')])){return this[_0x9ff8('0x11')][_0x9ff8('0xaf')]('no\x20password\x20configured');}if(!this['isConfigured'](_0x4df8bd[_0x9ff8('0x105')])){return this[_0x9ff8('0x11')][_0x9ff8('0xaf')]('no\x20text\x20configured');}this[_0x9ff8('0x11')][_0x9ff8('0xfc')]=!![];this[_0x9ff8('0x3b')](_0x4df8bd);this[_0x9ff8('0x46')](_0x4df8bd[_0x9ff8('0x62')],'in','','');this[_0x9ff8('0x11')][_0x9ff8('0xaf')](util['format']('Trying\x20SestekNDA:\x20%s',_0x4df8bd[_0x9ff8('0x62')]));var _0x1bfcc9=this[_0x9ff8('0x86')][_0x9ff8('0xa9')](this,_0x4df8bd);if(_0x1bfcc9){for(var _0x94e1cb in _0x1bfcc9){if(_0x1bfcc9[_0x9ff8('0x98')](_0x94e1cb)){this['channel']['setVariable'](util[_0x9ff8('0x59')](_0x9ff8('0x106'),_0x94e1cb['toUpperCase']()),_0x1bfcc9[_0x94e1cb]);}}this['createSquareMessage'](_0x1bfcc9[_0x9ff8('0xf3')],_0x9ff8('0xf4'),_0x9ff8('0x107'),'');if(_0x1bfcc9['audiofile']){this[_0x9ff8('0x11')]['noop'](util[_0x9ff8('0x59')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x1bfcc9['audiofile']));var _0x16f878=this['channel'][_0x9ff8('0x108')](_0x1bfcc9['audiofile']);try{fs['unlink'](_0x1bfcc9['audiofile']+_0x9ff8('0x109'));}catch(_0x2ef9af){logger[_0x9ff8('0x30')](_0x2ef9af);}return _0x16f878;}else{return this[_0x9ff8('0x11')][_0x9ff8('0xaf')](util[_0x9ff8('0x59')]('SestekNDA\x20Result\x20%s',_0x1bfcc9[_0x9ff8('0xf3')]));}}return this[_0x9ff8('0x11')][_0x9ff8('0x30')](_0x4df8bd,_0x9ff8('0x10a'));};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0x10b')]=function(_0x3b810f){logger['info'](util['format'](_0x9ff8('0x10c'),_0x3b810f[_0x9ff8('0xad')]));return this[_0x9ff8('0x11')][_0x9ff8('0xaf')](_0x9ff8('0x10b'));};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0x10d')]=function(_0x27fa15){logger[_0x9ff8('0x32')](util['format']('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x27fa15[_0x9ff8('0xad')]));var _0x4a82e5='';if(_0x27fa15[_0x9ff8('0x10e')]){if(!this[_0x9ff8('0x8b')](_0x27fa15[_0x9ff8('0x10e')])){return this[_0x9ff8('0x11')][_0x9ff8('0x30')](_0x27fa15,_0x9ff8('0x10f'));}else{var _0x3899f3=parseInt(_0x27fa15[_0x9ff8('0x10e')],0xa);if(isNaN(_0x3899f3)){_0x4a82e5=_0x27fa15['trunk_id'];}else{_0x4a82e5=this[_0x9ff8('0x20')]['sync'](this,_0x27fa15['trunk_id']);if(!_0x4a82e5){return this['channel']['error'](_0x27fa15,_0x9ff8('0x110'));}}}}else if(_0x27fa15[_0x9ff8('0x111')]){_0x4a82e5=_0x27fa15[_0x9ff8('0x111')];}else{return this[_0x9ff8('0x11')][_0x9ff8('0x30')](_0x27fa15,_0x9ff8('0x10f'));}var _0x91983b=this[_0x9ff8('0x11')][_0x9ff8('0xae')]('DIAL',[util['format'](_0x9ff8('0x112'),_0x4a82e5,_0x27fa15[_0x9ff8('0x113')]),_0x27fa15['timeout'],_0x27fa15[_0x9ff8('0xec')],_0x27fa15[_0x9ff8('0x6a')]]);if(_0x91983b[_0x9ff8('0xa7')]===-0x1){return _0x91983b;}return this[_0x9ff8('0x11')][_0x9ff8('0xaf')](util[_0x9ff8('0x59')](_0x9ff8('0xed'),_0x9ff8('0x114')));};AGIVertices[_0x9ff8('0x17')]['finally']=function(_0x54463f){logger[_0x9ff8('0x32')](util[_0x9ff8('0x59')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x54463f['label']));return this[_0x9ff8('0x11')]['noop'](_0x9ff8('0x115'));};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0xf')]=function(_0x21f8f6){logger['info'](util[_0x9ff8('0x59')](_0x9ff8('0x116'),_0x21f8f6['label']));if(_0x21f8f6[_0x9ff8('0x117')]===0x0){return this[_0x9ff8('0xaa')](_0x21f8f6);}_0x21f8f6[_0x9ff8('0x117')]-=0x1;if(!this[_0x9ff8('0x8b')](_0x21f8f6[_0x9ff8('0x118')])){return this[_0x9ff8('0x11')][_0x9ff8('0x30')](_0x21f8f6,_0x9ff8('0x119'));}var _0x1a41bf=this[_0x9ff8('0x11a')]['sync'](this,_0x21f8f6[_0x9ff8('0x118')]);if(!_0x1a41bf){return this[_0x9ff8('0x11')][_0x9ff8('0x30')](_0x21f8f6,_0x9ff8('0x11b'));}if(!this[_0x9ff8('0x8b')](_0x21f8f6['variable_id'])){return this[_0x9ff8('0x11')][_0x9ff8('0x30')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x1d6ce4=this[_0x9ff8('0x11')][_0x9ff8('0x11c')](_0x1a41bf,_0x21f8f6[_0x9ff8('0x11d')],_0x21f8f6[_0x9ff8('0x11e')]);var _0x3c71c4=_0x1d6ce4[_0x9ff8('0xa7')]?_0x1d6ce4[_0x9ff8('0xa7')][_0x9ff8('0x50')]():'';logger['info']('test',JSON['stringify'](_0x1d6ce4));if(_0x1d6ce4[_0x9ff8('0xa7')]===-0x1){this[_0x9ff8('0x3b')][_0x9ff8('0xa9')](this,_0x21f8f6,_0x3c71c4);return _0x1d6ce4;}else if(_0x1d6ce4[_0x9ff8('0xa5')]==='timeout'){_0x1d6ce4[_0x9ff8('0xa7')]=_0x3c71c4['length']>=parseInt(_0x21f8f6['mindigit'])?'x':'i';}else{_0x1d6ce4[_0x9ff8('0xa7')]=_0x3c71c4[_0x9ff8('0x9e')]>=parseInt(_0x21f8f6[_0x9ff8('0x11f')])&&_0x3c71c4[_0x9ff8('0x9e')]<=parseInt(_0x21f8f6['maxdigit'])?'x':'i';}var _0x24cdde=this[_0x9ff8('0x14')]['sync'](this,_0x21f8f6[_0x9ff8('0xe0')]);if(!_0x24cdde){return this['channel'][_0x9ff8('0x30')](_0x21f8f6,_0x9ff8('0x120'));}this[_0x9ff8('0x11')][_0x9ff8('0xa2')](_0x24cdde,_0x3c71c4);if(this[_0x9ff8('0x8b')](_0x21f8f6[_0x9ff8('0x121')])){var _0x2acf90=parseInt(_0x21f8f6[_0x9ff8('0x121')],0xa);var _0x588c91=rs[_0x9ff8('0x122')]({'charset':'*','length':_0x2acf90});var _0x24573b=_0x3c71c4['length'];if(_0x24573b>0x0){if(_0x24573b>_0x2acf90){this[_0x9ff8('0x3b')][_0x9ff8('0xa9')](this,_0x21f8f6,_0x21f8f6[_0x9ff8('0x123')]===_0x9ff8('0x124')?_0x588c91+_0x3c71c4['substr'](_0x2acf90):_0x3c71c4[_0x9ff8('0x125')](0x0,_0x24573b-_0x2acf90)+_0x588c91);}else{this['createSquareDetailsReport']['sync'](this,_0x21f8f6,rs[_0x9ff8('0x122')]({'charset':'*','length':_0x24573b}));}}else{this['createSquareDetailsReport']['sync'](this,_0x21f8f6,'');}}else{this[_0x9ff8('0x3b')][_0x9ff8('0xa9')](this,_0x21f8f6,_0x3c71c4);}return _0x1d6ce4;};AGIVertices['prototype']['getsecretdigits']=function(_0x84ca74){logger[_0x9ff8('0x32')](util[_0x9ff8('0x59')](_0x9ff8('0x126'),_0x84ca74[_0x9ff8('0xad')]));return this['getdigits'](_0x84ca74);};AGIVertices[_0x9ff8('0x17')]['goal']=function(_0x457139){logger[_0x9ff8('0x32')](util['format'](_0x9ff8('0x127'),_0x457139[_0x9ff8('0xad')]));this[_0x9ff8('0x3b')][_0x9ff8('0xa9')](this,_0x457139,_0x457139[_0x9ff8('0x128')]);return this[_0x9ff8('0x11')][_0x9ff8('0xaf')](util[_0x9ff8('0x59')]('GOAL\x20%s',_0x457139[_0x9ff8('0x128')]));};AGIVertices[_0x9ff8('0x17')]['awspolly']=function(_0x1a2969){logger[_0x9ff8('0x32')](util[_0x9ff8('0x59')](_0x9ff8('0x129'),_0x1a2969[_0x9ff8('0xad')]));if(!this[_0x9ff8('0x8b')](_0x1a2969['aws_access_key_id'])||!this['isConfigured'](_0x1a2969[_0x9ff8('0x8f')])){return this['channel'][_0x9ff8('0xaf')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x9ff8('0x8b')](_0x1a2969[_0x9ff8('0x62')])){return this[_0x9ff8('0x11')]['noop'](_0x9ff8('0xcb'));}this[_0x9ff8('0x11')]['noop'](util['format'](_0x9ff8('0x12a'),_0x1a2969[_0x9ff8('0x62')]));var _0x5654bb=this[_0x9ff8('0x8d')]['sync'](this,_0x1a2969);if(_0x5654bb){this[_0x9ff8('0x11')][_0x9ff8('0xaf')](util['format'](_0x9ff8('0x12b'),_0x5654bb));var _0x219110=this[_0x9ff8('0x11')]['streamFile'](_0x5654bb);try{fs[_0x9ff8('0x12c')](_0x5654bb+'.wav');}catch(_0x54fe2c){logger[_0x9ff8('0x30')](_0x54fe2c);}return _0x219110;}return this['channel'][_0x9ff8('0x30')](_0x1a2969,_0x9ff8('0x12d'));};AGIVertices['prototype']['awslex']=function(_0x2161c3){logger[_0x9ff8('0x32')](util['format'](_0x9ff8('0x12e'),_0x2161c3['label']));if(!this[_0x9ff8('0x8b')](_0x2161c3['aws_access_key_id'])||!this[_0x9ff8('0x8b')](_0x2161c3['aws_secret_access_key'])){return this[_0x9ff8('0x11')][_0x9ff8('0xaf')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x2161c3['aws_bot_name'])){return this[_0x9ff8('0x11')][_0x9ff8('0xaf')](_0x9ff8('0x12f'));}if(!this[_0x9ff8('0x8b')](_0x2161c3[_0x9ff8('0x62')])){return this[_0x9ff8('0x11')][_0x9ff8('0xaf')](_0x9ff8('0xcb'));}this[_0x9ff8('0x11')][_0x9ff8('0xfc')]=!![];this[_0x9ff8('0x3b')](_0x2161c3);this[_0x9ff8('0x46')](_0x2161c3[_0x9ff8('0x62')],'in','','');this[_0x9ff8('0x11')]['noop'](util[_0x9ff8('0x59')](_0x9ff8('0x130'),_0x2161c3['text']));var _0x54efaf=this[_0x9ff8('0x131')][_0x9ff8('0xa9')](this,_0x2161c3);if(_0x54efaf){for(var _0x160802 in _0x54efaf){if(_0x54efaf[_0x9ff8('0x98')](_0x160802)&&_[_0x9ff8('0x99')](_0x54efaf[_0x160802])){this[_0x9ff8('0x11')][_0x9ff8('0xa2')](util[_0x9ff8('0x59')](_0x9ff8('0x132'),_0x160802['toUpperCase']()),_0x54efaf[_0x160802]);}}if(_[_0x9ff8('0x49')](_0x54efaf['message'])){return this[_0x9ff8('0x11')][_0x9ff8('0xaf')](_0x9ff8('0x133'));}else{this[_0x9ff8('0x46')](_0x54efaf[_0x9ff8('0x7b')],_0x9ff8('0xf4'),'amazonlex','');return this[_0x9ff8('0x11')][_0x9ff8('0xaf')](util['format'](_0x9ff8('0x134'),_0x54efaf[_0x9ff8('0x7b')]));}}return this[_0x9ff8('0x11')][_0x9ff8('0x30')](_0x2161c3,_0x9ff8('0x135'));};AGIVertices[_0x9ff8('0x17')]['googleasr']=function(_0x296be8){logger[_0x9ff8('0x32')](util[_0x9ff8('0x59')](_0x9ff8('0x136'),_0x296be8[_0x9ff8('0xad')],_0x296be8['timeout']));if(!this[_0x9ff8('0x8b')](_0x296be8[_0x9ff8('0x7f')])){return this['channel'][_0x9ff8('0xaf')](_0x9ff8('0xf0'));}var _0x1b8bc7=_0x9ff8('0x137');var _0x55f2c9=util[_0x9ff8('0x59')]('%s/recordings/%s',FILES_PATH,rs[_0x9ff8('0x122')](0x4));var _0x60d498=util[_0x9ff8('0x59')](_0x9ff8('0xa1'),_0x55f2c9,_0x1b8bc7);var _0x19d866=!![];if(_0x296be8[_0x9ff8('0x138')]===_0x9ff8('0x139')){_0x19d866=![];}var _0x2f639c=this[_0x9ff8('0x11')]['recordFile'](_0x55f2c9,_0x1b8bc7,_0x296be8[_0x9ff8('0x13a')],_0x296be8['timeout'],undefined,_0x19d866);if(_0x2f639c[_0x9ff8('0xa7')]!==-0x1){this[_0x9ff8('0x11')]['noop'](util['format'](_0x9ff8('0x13b'),_0x60d498));var _0x2e7eb3=this[_0x9ff8('0x92')]['sync'](this,_0x296be8,_0x60d498);if(_0x2e7eb3){for(var _0x3364fb in _0x2e7eb3){if(_0x2e7eb3[_0x9ff8('0x98')](_0x3364fb)){this[_0x9ff8('0x11')]['setVariable'](util[_0x9ff8('0x59')]('GOOGLE_ASR_%s',_0x3364fb[_0x9ff8('0x6e')]()),_0x2e7eb3[_0x3364fb]);}}return this[_0x9ff8('0x11')][_0x9ff8('0xaf')](util['format'](_0x9ff8('0x13c'),JSON[_0x9ff8('0x77')](_0x2e7eb3)));}}return _0x2f639c;};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0x13d')]=function(_0x4c76a4){logger['info'](util[_0x9ff8('0x59')](_0x9ff8('0x13e'),_0x4c76a4[_0x9ff8('0xad')]));if(!this[_0x9ff8('0x8b')](_0x4c76a4[_0x9ff8('0x94')])){return this[_0x9ff8('0x11')][_0x9ff8('0xaf')]('no\x20appid\x20configured');}if(!this[_0x9ff8('0x8b')](_0x4c76a4[_0x9ff8('0x13f')])){return this['channel']['noop'](_0x9ff8('0x140'));}var _0x3b83e2='wav';var _0x2e4466=util[_0x9ff8('0x59')](_0x9ff8('0x141'),FILES_PATH,rs['generate'](0x4));var _0x313d2b=util['format']('%s.%s',_0x2e4466,_0x3b83e2);var _0x2194b9=!![];if(_0x4c76a4[_0x9ff8('0x138')]===_0x9ff8('0x139')){_0x2194b9=![];}var _0x28df2c=this['channel'][_0x9ff8('0x142')](_0x2e4466,_0x3b83e2,_0x4c76a4['intKey'],_0x4c76a4[_0x9ff8('0x6b')],undefined,_0x2194b9);if(_0x28df2c[_0x9ff8('0xa7')]!==-0x1){this[_0x9ff8('0x11')]['noop'](util['format']('tilde\x20%s\x20file\x20created',_0x313d2b));var _0x1c5580=this[_0x9ff8('0x143')][_0x9ff8('0xa9')](this,_0x4c76a4,_0x313d2b);if(_0x1c5580){for(var _0x197f64 in _0x1c5580){if(_0x1c5580['hasOwnProperty'](_0x197f64)){this[_0x9ff8('0x11')][_0x9ff8('0xa2')](util[_0x9ff8('0x59')](_0x9ff8('0x144'),_0x197f64[_0x9ff8('0x6e')]()),_0x1c5580[_0x197f64]);}}return this[_0x9ff8('0x11')][_0x9ff8('0xaf')](util[_0x9ff8('0x59')](_0x9ff8('0x145'),JSON[_0x9ff8('0x77')](_0x1c5580)));}}return _0x28df2c;};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0x146')]=function(_0x293909){logger[_0x9ff8('0x32')](util[_0x9ff8('0x59')](_0x9ff8('0x147'),_0x293909[_0x9ff8('0xad')]));return this[_0x9ff8('0x11')]['continueAt'](_0x293909[_0x9ff8('0x41')],_0x293909[_0x9ff8('0x42')],_0x293909[_0x9ff8('0x43')]);};AGIVertices['prototype']['gotoif']=function(_0x2a3ced){logger[_0x9ff8('0x32')](util['format']('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x2a3ced[_0x9ff8('0xad')]));if(!this['isConfigured'](_0x2a3ced[_0x9ff8('0x148')])){return this['channel']['error'](_0x2a3ced,_0x9ff8('0x149'));}try{var _0xdc2247=eval(_0x2a3ced[_0x9ff8('0x148')])?_0x9ff8('0x14a'):_0x9ff8('0x14b');this[_0x9ff8('0x11')][_0x9ff8('0xaf')](util[_0x9ff8('0x59')](_0x9ff8('0x14c'),_0x2a3ced[_0x9ff8('0x148')],_0xdc2247));return{'code':0xc8,'result':_0xdc2247};}catch(_0x583753){return{'code':0xc8,'result':_0x9ff8('0x14b')};}};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0x14d')]=function(_0x288139){logger['info'](util[_0x9ff8('0x59')](_0x9ff8('0x14e'),_0x288139[_0x9ff8('0xad')]));if(!this[_0x9ff8('0x8b')](_0x288139['interval_id'])){return this[_0x9ff8('0x11')][_0x9ff8('0x30')](_0x288139,_0x9ff8('0x14f'));}var _0x3ae090=this[_0x9ff8('0x28')]['sync'](this,_0x288139[_0x9ff8('0x150')]);if(!_0x3ae090){return this['channel'][_0x9ff8('0x30')](_0x288139,_0x9ff8('0x151'));}for(var _0x4b3810=0x0;_0x4b3810<_0x3ae090[_0x9ff8('0x9e')];_0x4b3810+=0x1){var _0x567acb=this[_0x9ff8('0x11')][_0x9ff8('0x14')](util[_0x9ff8('0x59')](_0x9ff8('0x152'),_0x3ae090[_0x4b3810]));if(_0x567acb[_0x9ff8('0xa7')]===-0x1){return _0x567acb;}logger[_0x9ff8('0x32')](util[_0x9ff8('0x59')](_0x9ff8('0x153'),_0x3ae090[_0x4b3810],_0x567acb[_0x9ff8('0xa5')]));if(_0x567acb[_0x9ff8('0xa5')]===_0x9ff8('0x14a')){logger['info'](util[_0x9ff8('0x59')](_0x9ff8('0x153'),_0x3ae090[_0x4b3810],_0x9ff8('0x14a')));this[_0x9ff8('0x11')][_0x9ff8('0xaf')](util[_0x9ff8('0x59')]('IFTIME\x20%s\x20%s',_0x3ae090[_0x4b3810],'true'));return{'code':0xc8,'result':'true'};}else{logger[_0x9ff8('0x32')](util[_0x9ff8('0x59')](_0x9ff8('0x153'),_0x3ae090[_0x4b3810],_0x9ff8('0x14b')));this[_0x9ff8('0x11')][_0x9ff8('0xaf')](util[_0x9ff8('0x59')](_0x9ff8('0x153'),_0x3ae090[_0x4b3810],_0x9ff8('0x14b')));}}return{'code':0xc8,'result':_0x9ff8('0x14b')};};AGIVertices['prototype'][_0x9ff8('0x154')]=function(_0x185c6c){logger['info'](util[_0x9ff8('0x59')](_0x9ff8('0x155'),_0x185c6c['label']));return this[_0x9ff8('0x11')][_0x9ff8('0x154')]();};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0x156')]=function(_0x5086c0){logger[_0x9ff8('0x32')](util[_0x9ff8('0x59')](_0x9ff8('0x157'),_0x5086c0[_0x9ff8('0xad')]));if(!this[_0x9ff8('0x8b')](_0x5086c0[_0x9ff8('0x7f')])){return this[_0x9ff8('0x11')][_0x9ff8('0xaf')](_0x9ff8('0xf0'));}var _0x13aff1=_0x9ff8('0x137');var _0x4aa912=util[_0x9ff8('0x59')](_0x9ff8('0x141'),FILES_PATH,rs[_0x9ff8('0x122')](0x4));var _0x51a9d6=util[_0x9ff8('0x59')]('%s.%s',_0x4aa912,_0x13aff1);var _0x49b45a=!![];if(_0x5086c0[_0x9ff8('0x138')]===_0x9ff8('0x139')){_0x49b45a=![];}var _0x5f03ea=this[_0x9ff8('0x11')]['recordFile'](_0x4aa912,_0x13aff1,_0x5086c0[_0x9ff8('0x13a')],_0x5086c0[_0x9ff8('0x6b')],undefined,_0x49b45a);if(_0x5f03ea[_0x9ff8('0xa7')]!==-0x1){this[_0x9ff8('0x11')]['noop'](util['format']('ispeech\x20%s\x20file\x20created',_0x51a9d6));var _0x55260c=this['ispeechASR']['sync'](this,_0x5086c0,_0x51a9d6);if(_0x55260c){for(var _0x1cdd80 in _0x55260c){if(_0x55260c[_0x9ff8('0x98')](_0x1cdd80)){this[_0x9ff8('0x11')][_0x9ff8('0xa2')](util[_0x9ff8('0x59')]('ISPEECH_ASR_%s',_0x1cdd80[_0x9ff8('0x6e')]()),_0x55260c[_0x1cdd80]);}}return this[_0x9ff8('0x11')]['noop'](util[_0x9ff8('0x59')](_0x9ff8('0x158'),JSON[_0x9ff8('0x77')](_0x55260c)));}}return _0x5f03ea;};AGIVertices['prototype'][_0x9ff8('0x159')]=function(_0x13defc){logger[_0x9ff8('0x32')](util[_0x9ff8('0x59')](_0x9ff8('0x15a'),_0x13defc[_0x9ff8('0xad')]));if(!this[_0x9ff8('0x8b')](_0x13defc[_0x9ff8('0x7f')])){return this['channel'][_0x9ff8('0xaf')](_0x9ff8('0xf0'));}if(!this['isConfigured'](_0x13defc[_0x9ff8('0x62')])){return this[_0x9ff8('0x11')][_0x9ff8('0xaf')]('no\x20text\x20configured');}this[_0x9ff8('0x11')][_0x9ff8('0xaf')](util[_0x9ff8('0x59')](_0x9ff8('0x15b'),_0x13defc['text']));var _0x1810b4=this[_0x9ff8('0x87')][_0x9ff8('0xa9')](this,_0x13defc);if(_0x1810b4){this[_0x9ff8('0x11')][_0x9ff8('0xaf')](util[_0x9ff8('0x59')](_0x9ff8('0x15c'),_0x1810b4));var _0x2f5ad7=this[_0x9ff8('0x11')][_0x9ff8('0x108')](_0x1810b4,_0x13defc[_0x9ff8('0x13a')]);try{fs[_0x9ff8('0x12c')](_0x1810b4+_0x9ff8('0x109'));}catch(_0x1451e4){logger[_0x9ff8('0x30')](_0x1451e4);}return _0x2f5ad7;}return this['channel'][_0x9ff8('0x30')](_0x13defc,_0x9ff8('0x15d'));};AGIVertices['prototype'][_0x9ff8('0x15e')]=function(_0x50812b){logger[_0x9ff8('0x32')](util[_0x9ff8('0x59')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x50812b[_0x9ff8('0xad')]));if(!this[_0x9ff8('0x8b')](_0x50812b['findBy'])){return this['channel'][_0x9ff8('0x30')](_0x50812b,_0x9ff8('0x15f'));}logger[_0x9ff8('0x32')](util[_0x9ff8('0x59')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x9ff8('0x11')][_0x9ff8('0x3f')],_0x50812b[_0x9ff8('0x160')]));var _0x727b0b=this[_0x9ff8('0x57')][_0x9ff8('0xa9')](this,_0x50812b['findBy']);if(_0x727b0b){logger[_0x9ff8('0x32')](util[_0x9ff8('0x59')](_0x9ff8('0x161'),this['channel'][_0x9ff8('0x3f')],_0x50812b[_0x9ff8('0x160')]));this[_0x9ff8('0x11')]['noop'](util[_0x9ff8('0x59')](_0x9ff8('0x161'),this[_0x9ff8('0x11')]['callerid'],_0x50812b[_0x9ff8('0x160')]));return{'code':0xc8,'result':'success'};}else{logger[_0x9ff8('0x32')](util[_0x9ff8('0x59')](_0x9ff8('0x162'),this[_0x9ff8('0x11')]['callerid'],_0x50812b['findBy']));this[_0x9ff8('0x11')][_0x9ff8('0xaf')](util[_0x9ff8('0x59')](_0x9ff8('0x162'),this[_0x9ff8('0x11')][_0x9ff8('0x3f')],_0x50812b[_0x9ff8('0x160')]));return{'code':0xc8,'result':_0x9ff8('0x163')};}};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0x164')]=function(_0x537a19){logger['info'](util[_0x9ff8('0x59')](_0x9ff8('0x165'),_0x537a19[_0x9ff8('0xad')]));if(!this['isConfigured'](_0x537a19['findBy'])){return this['channel'][_0x9ff8('0x30')](_0x537a19,_0x9ff8('0x15f'));}logger['info'](util[_0x9ff8('0x59')](_0x9ff8('0x166'),this[_0x9ff8('0x11')][_0x9ff8('0x3f')],_0x537a19[_0x9ff8('0x160')]));var _0x52e48c=this[_0x9ff8('0x56')]['sync'](this,_0x537a19[_0x9ff8('0x160')]);if(_0x52e48c){logger[_0x9ff8('0x32')](util[_0x9ff8('0x59')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x9ff8('0x3f')],_0x537a19['findBy']));this[_0x9ff8('0x11')][_0x9ff8('0xaf')](util['format'](_0x9ff8('0x161'),this[_0x9ff8('0x11')][_0x9ff8('0x3f')],_0x537a19[_0x9ff8('0x160')]));return{'code':0xc8,'result':_0x9ff8('0x167')};}else{logger[_0x9ff8('0x32')](util[_0x9ff8('0x59')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x9ff8('0x11')]['callerid'],_0x537a19['findBy']));this[_0x9ff8('0x11')][_0x9ff8('0xaf')](util[_0x9ff8('0x59')](_0x9ff8('0x162'),this[_0x9ff8('0x11')][_0x9ff8('0x3f')],_0x537a19['findBy']));return{'code':0xc8,'result':_0x9ff8('0x163')};}};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0x168')]=function(_0x513745){logger[_0x9ff8('0x32')](util[_0x9ff8('0x59')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x513745[_0x9ff8('0xad')]));if(!this[_0x9ff8('0x8b')](_0x513745[_0x9ff8('0x169')])){return this['channel'][_0x9ff8('0x30')](_0x513745,'no\x20operation\x20configured');}this[_0x9ff8('0x11')]['noop'](util[_0x9ff8('0x59')]('math\x20%s',_0x513745[_0x9ff8('0x169')]));var _0x4f65b7=eval(_0x513745[_0x9ff8('0x169')]);if(!this[_0x9ff8('0x8b')](_0x513745[_0x9ff8('0xe0')])){return this[_0x9ff8('0x11')][_0x9ff8('0xaf')](_0x9ff8('0xe1'));}var _0x5fd7f0=this[_0x9ff8('0x14')][_0x9ff8('0xa9')](this,_0x513745['variable_id']);if(!_0x5fd7f0){return this[_0x9ff8('0x11')][_0x9ff8('0x30')](_0x513745,'no\x20variable\x20found');}if(_['isArray'](_0x4f65b7)){var _0x308f0b=this;_0x4f65b7[_0x9ff8('0xe2')](function(_0x17d590,_0xa09a7c){_0x308f0b[_0x9ff8('0x11')][_0x9ff8('0xa2')](util['format'](_0x9ff8('0x16a'),_0x5fd7f0,_0xa09a7c),_0x17d590);});return this[_0x9ff8('0x11')][_0x9ff8('0xaf')](util['format'](_0x9ff8('0x16b'),_0x5fd7f0));}else{return this[_0x9ff8('0x11')][_0x9ff8('0xa2')](_0x5fd7f0,_0x4f65b7);}};AGIVertices['prototype'][_0x9ff8('0x16c')]=function(_0xcffb11){logger[_0x9ff8('0x32')](util[_0x9ff8('0x59')](_0x9ff8('0x16d'),_0xcffb11['label']));if(_0xcffb11[_0x9ff8('0x117')]===0x0){return this[_0x9ff8('0xaa')](_0xcffb11);}_0xcffb11[_0x9ff8('0x117')]-=0x1;if(!this[_0x9ff8('0x8b')](_0xcffb11['file_id'])){return this[_0x9ff8('0x11')][_0x9ff8('0x30')](_0xcffb11,_0x9ff8('0x119'));}var _0x3ddf71=this[_0x9ff8('0x11a')][_0x9ff8('0xa9')](this,_0xcffb11[_0x9ff8('0x118')]);if(!_0x3ddf71){return this[_0x9ff8('0x11')][_0x9ff8('0x30')](_0xcffb11,'no\x20file\x20audio\x20found');}var _0x558137=this['channel'][_0x9ff8('0x11c')](_0x3ddf71,_0xcffb11[_0x9ff8('0x11d')],_0xcffb11[_0x9ff8('0x16e')]);var _0xff4f28=_0x558137[_0x9ff8('0xa7')];if(_0x558137[_0x9ff8('0xa7')]===-0x1){this[_0x9ff8('0x3b')]['sync'](this,_0xcffb11,'-1');return _0x558137;}else if(_0x558137[_0x9ff8('0xa5')]===_0x9ff8('0x6b')){_0x558137[_0x9ff8('0xa7')]=_0x558137[_0x9ff8('0xa7')]['length']>0x0?_0x558137[_0x9ff8('0xa7')]:'t';}else if(_[_0x9ff8('0x48')](_0x558137[_0x9ff8('0xa7')])){_0x558137['result']='#';_0xff4f28='#';}if(!this['isConfigured'](_0xcffb11[_0x9ff8('0xe0')])){this[_0x9ff8('0x11')][_0x9ff8('0xaf')](_0x9ff8('0xe1'));}else{var _0xe39b79=this[_0x9ff8('0x14')][_0x9ff8('0xa9')](this,_0xcffb11[_0x9ff8('0xe0')]);if(!_0xe39b79){return this[_0x9ff8('0x11')]['error'](_0xcffb11,_0x9ff8('0x120'));}this[_0x9ff8('0x11')][_0x9ff8('0xa2')](_0xe39b79,_0xff4f28);}this[_0x9ff8('0x3b')][_0x9ff8('0xa9')](this,_0xcffb11,_0xff4f28);return _0x558137;};AGIVertices[_0x9ff8('0x17')]['noop']=function(_0x742a4){logger['info'](util[_0x9ff8('0x59')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x742a4[_0x9ff8('0xad')]));return this[_0x9ff8('0x11')][_0x9ff8('0xaf')](_0x742a4[_0x9ff8('0x16f')]||_0x742a4[_0x9ff8('0xad')]);};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0x170')]=function(_0x13aabe){logger['info'](util[_0x9ff8('0x59')](_0x9ff8('0x171'),_0x13aabe['label']));if(!this[_0x9ff8('0x8b')](_0x13aabe['findBy'])){return this[_0x9ff8('0x11')]['error'](_0x13aabe,_0x9ff8('0x15f'));}logger[_0x9ff8('0x32')](util[_0x9ff8('0x59')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x9ff8('0x11')][_0x9ff8('0x3f')],_0x13aabe['findBy']));var _0x22af22=this['getPause']['sync'](this,_0x13aabe[_0x9ff8('0x172')]);var _0x30f11d=this['agentPause'][_0x9ff8('0xa9')](this,_0x13aabe[_0x9ff8('0x160')],_0x22af22);if(_0x30f11d){logger['info'](util[_0x9ff8('0x59')](_0x9ff8('0x161'),this[_0x9ff8('0x11')][_0x9ff8('0x3f')],_0x13aabe['findBy']));this[_0x9ff8('0x11')][_0x9ff8('0xaf')](util[_0x9ff8('0x59')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x9ff8('0x3f')],_0x13aabe[_0x9ff8('0x160')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x9ff8('0x59')](_0x9ff8('0x162'),this[_0x9ff8('0x11')][_0x9ff8('0x3f')],_0x13aabe[_0x9ff8('0x160')]));this['channel'][_0x9ff8('0xaf')](util[_0x9ff8('0x59')](_0x9ff8('0x161'),this[_0x9ff8('0x11')][_0x9ff8('0x3f')],_0x13aabe[_0x9ff8('0x160')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0x173')]=function(_0x2c1bca){logger[_0x9ff8('0x32')](util[_0x9ff8('0x59')](_0x9ff8('0x174'),_0x2c1bca[_0x9ff8('0xad')]));if(!this[_0x9ff8('0x8b')](_0x2c1bca[_0x9ff8('0x118')])){return this[_0x9ff8('0x11')][_0x9ff8('0x30')](_0x2c1bca,_0x9ff8('0x119'));}var _0x5c64df=this[_0x9ff8('0x11a')][_0x9ff8('0xa9')](this,_0x2c1bca[_0x9ff8('0x118')]);if(!_0x5c64df){return this[_0x9ff8('0x11')][_0x9ff8('0x30')](_0x2c1bca,_0x9ff8('0x11b'));}var _0x812108=this[_0x9ff8('0x11')][_0x9ff8('0xae')]('PLAYBACK',[_0x5c64df,_0x2c1bca[_0x9ff8('0xec')]]);if(_0x812108['result']===-0x1){return _0x812108;}return this[_0x9ff8('0x11')][_0x9ff8('0xaf')](util[_0x9ff8('0x59')](_0x9ff8('0xca'),'PLAYBACK',_0x5c64df));};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0x175')]=function(_0x3875d9){logger[_0x9ff8('0x32')](util[_0x9ff8('0x59')](_0x9ff8('0x176'),_0x3875d9[_0x9ff8('0xad')]));if(!this[_0x9ff8('0x8b')](_0x3875d9[_0x9ff8('0x177')])){return this[_0x9ff8('0x11')][_0x9ff8('0x30')](_0x3875d9,_0x9ff8('0x178'));}var _0x137e29='';var _0x5b54e8=parseInt(_0x3875d9[_0x9ff8('0x177')],0xa);if(isNaN(_0x5b54e8)){_0x137e29=_0x3875d9[_0x9ff8('0x177')];}else{_0x137e29=this['getVoiceQueue'][_0x9ff8('0xa9')](this,_0x3875d9[_0x9ff8('0x177')]);if(!_0x137e29){return this[_0x9ff8('0x11')][_0x9ff8('0x30')](_0x3875d9,_0x9ff8('0x179'));}}var _0x568511='';if(this[_0x9ff8('0x8b')](_0x3875d9['file_id'])){var _0xe83732=this['getSound'][_0x9ff8('0xa9')](this,_0x3875d9['file_id']);if(_0xe83732){_0x568511=_0xe83732;}}this['createSquareDetailsReport']['sync'](this,_0x3875d9,_0x137e29);if(_0x3875d9[_0x9ff8('0xec')][_0x9ff8('0x17a')]('x')<0x0){_0x3875d9[_0x9ff8('0xec')]+='x';}if(_0x3875d9[_0x9ff8('0xec')][_0x9ff8('0x17a')]('X')<0x0){_0x3875d9[_0x9ff8('0xec')]+='X';}this[_0x9ff8('0x11')][_0x9ff8('0xa2')](_0x9ff8('0x17b'),_0x137e29?_0x137e29['toLowerCase']():'');var _0x43ea88=this[_0x9ff8('0x11')][_0x9ff8('0xae')](_0x9ff8('0x17c'),[_0x137e29,_0x3875d9[_0x9ff8('0xec')],_0x3875d9[_0x9ff8('0x6a')],_0x568511,_0x3875d9[_0x9ff8('0x6b')],_0x3875d9[_0x9ff8('0xa')],_0x3875d9[_0x9ff8('0x17d')],_0x3875d9[_0x9ff8('0x17e')],'',_0x3875d9[_0x9ff8('0x17f')]]);if(_0x43ea88[_0x9ff8('0xa7')]===-0x1){return _0x43ea88;}return this[_0x9ff8('0x11')][_0x9ff8('0xaf')](util[_0x9ff8('0x59')](_0x9ff8('0xca'),_0x9ff8('0x17c'),_0x137e29));};AGIVertices[_0x9ff8('0x17')]['record']=function(_0x509d3f){logger['info'](util[_0x9ff8('0x59')](_0x9ff8('0x180'),_0x509d3f['label']));var _0x406157=_0x509d3f['recordingFormat']||_0x9ff8('0x137');var _0x36b3d7=util['format'](_0x9ff8('0x181'),this[_0x9ff8('0x11')][_0x9ff8('0x3c')],rs['generate'](0x5));var _0x24aa26=util['format'](_0x9ff8('0x182'),FILES_PATH,_0x36b3d7,_0x406157);var _0x1d5a53=util[_0x9ff8('0x59')]('%s/recordings/%s',FILES_PATH,_0x36b3d7);this['createSquareRecording'][_0x9ff8('0xa9')](this,_0x509d3f,_0x36b3d7,_0x24aa26);this['channel']['setVariable'](_0x9ff8('0x183'),_0x36b3d7);logger['info'](_0x9ff8('0x184'),_0x1d5a53,_0x406157,_0x509d3f[_0x9ff8('0x185')],_0x509d3f[_0x9ff8('0x6b')]);return this[_0x9ff8('0x11')]['recordFile'](_0x1d5a53,_0x406157,_0x509d3f[_0x9ff8('0x185')],_0x509d3f[_0x9ff8('0x6b')],undefined,!![]);};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0x186')]=function(_0x1513b1){logger[_0x9ff8('0x32')](util[_0x9ff8('0x59')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x1513b1[_0x9ff8('0xad')]));if(!this[_0x9ff8('0x8b')](_0x1513b1[_0x9ff8('0x6a')])){return this[_0x9ff8('0x11')][_0x9ff8('0xaf')]('no\x20url\x20configured');}var _0x183847=this[_0x9ff8('0x69')][_0x9ff8('0xa9')](this,_0x1513b1);logger[_0x9ff8('0x32')](util[_0x9ff8('0x59')](_0x9ff8('0x187'),util[_0x9ff8('0x188')](_0x183847,{'showHidden':![],'depth':null})));if(!this[_0x9ff8('0x8b')](_0x1513b1[_0x9ff8('0xe0')])){return this[_0x9ff8('0x11')][_0x9ff8('0xaf')](_0x9ff8('0x189'));}var _0x54a221=this[_0x9ff8('0x14')][_0x9ff8('0xa9')](this,_0x1513b1[_0x9ff8('0xe0')]);if(!_0x54a221){return this['channel'][_0x9ff8('0x30')](_0x1513b1,_0x9ff8('0x120'));}this[_0x9ff8('0x11')][_0x9ff8('0xa2')](util['format'](_0x9ff8('0x18a'),_0x54a221),_0x183847[_0x9ff8('0x79')]?_0x183847[_0x9ff8('0x79')]:'200');this['channel'][_0x9ff8('0xa2')](util[_0x9ff8('0x59')](_0x9ff8('0x18b'),_0x54a221),_0x183847['statusMessage']?_0x183847['statusMessage']:'OK');if(_0x183847[_0x9ff8('0x6f')]){try{this[_0x9ff8('0x9f')](_0x183847[_0x9ff8('0x6f')],_0x54a221);}catch(_0x4682dd){logger[_0x9ff8('0x30')](util[_0x9ff8('0x59')](_0x9ff8('0x18c'),_0x54a221));}}return this[_0x9ff8('0x11')][_0x9ff8('0xaf')](util[_0x9ff8('0x59')](_0x9ff8('0xe6'),_0x54a221));};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0x18d')]=function(_0x1b1471){logger[_0x9ff8('0x32')](util[_0x9ff8('0x59')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x1b1471['label']));return this[_0x9ff8('0x11')][_0x9ff8('0x18e')](_0x1b1471['digits'][_0x9ff8('0x5e')](/\s+/g,''),_0x1b1471[_0x9ff8('0x185')]);};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0x18f')]=function(_0x4dc781){logger[_0x9ff8('0x32')](util[_0x9ff8('0x59')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x4dc781[_0x9ff8('0xad')]));return this[_0x9ff8('0x11')][_0x9ff8('0x190')](_0x4dc781['number'][_0x9ff8('0x5e')](/\s+/g,''),_0x4dc781[_0x9ff8('0x185')]);};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0x191')]=function(_0x55e3c1){logger[_0x9ff8('0x32')](util[_0x9ff8('0x59')](_0x9ff8('0x192'),_0x55e3c1[_0x9ff8('0xad')]));return this[_0x9ff8('0x11')]['sayPhonetic'](_0x55e3c1[_0x9ff8('0x62')],_0x55e3c1[_0x9ff8('0x185')]);};AGIVertices[_0x9ff8('0x17')]['sendMail']=function(_0x5b4f13){logger[_0x9ff8('0x32')](util[_0x9ff8('0x59')](_0x9ff8('0x193'),_0x5b4f13[_0x9ff8('0xad')]));if(!this[_0x9ff8('0x8b')](_0x5b4f13[_0x9ff8('0x194')])){return this[_0x9ff8('0x11')][_0x9ff8('0xaf')](_0x9ff8('0x195'));}var _0x10b6a1=this['getMailAccount'][_0x9ff8('0xa9')](this,_0x5b4f13[_0x9ff8('0x194')]);if(!_0x10b6a1||!_0x10b6a1[_0x9ff8('0x196')]){return this['channel']['error'](_0x5b4f13,_0x9ff8('0x197'));}var _0x2ca9d1={'from':util[_0x9ff8('0x59')](_0x9ff8('0x198'),_0x10b6a1[_0x9ff8('0x16')],_0x10b6a1[_0x9ff8('0x199')]||_0x10b6a1[_0x9ff8('0x196')][_0x9ff8('0x19a')]),'to':_0x5b4f13['to']||'','cc':_0x5b4f13['cc']||'','bcc':_0x5b4f13[_0x9ff8('0x19b')]||'','subject':_0x5b4f13[_0x9ff8('0x19c')],'html':_0x5b4f13['text'],'text':_0x5b4f13[_0x9ff8('0x62')]};var _0x1625cc={'tls':{'rejectUnauthorized':![]}};if(_0x10b6a1['Smtp'][_0x9ff8('0x19d')]){_0x1625cc[_0x9ff8('0x19d')]=_0x10b6a1['Smtp'][_0x9ff8('0x19d')];}else{_0x1625cc['host']=_0x10b6a1['Smtp'][_0x9ff8('0x19e')];_0x1625cc[_0x9ff8('0x19f')]=_0x10b6a1[_0x9ff8('0x196')][_0x9ff8('0x19f')];_0x1625cc[_0x9ff8('0x1a0')]=_0x10b6a1[_0x9ff8('0x196')][_0x9ff8('0x1a0')];}if(_0x10b6a1[_0x9ff8('0x196')][_0x9ff8('0x1a1')]){_0x1625cc['auth']={'user':_0x10b6a1[_0x9ff8('0x196')][_0x9ff8('0x19a')],'pass':_0x10b6a1[_0x9ff8('0x196')]['pass']};}if(this['isConfigured'](_0x5b4f13['template_id'])){}logger[_0x9ff8('0x1a2')](_0x9ff8('0x1a3'),JSON[_0x9ff8('0x77')](_0x2ca9d1));this[_0x9ff8('0x3b')]['sync'](this,_0x5b4f13,_0x5b4f13[_0x9ff8('0x194')]);this[_0x9ff8('0x11')][_0x9ff8('0xaf')](util[_0x9ff8('0x59')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x10b6a1[_0x9ff8('0x16')]));this[_0x9ff8('0x27')]['sync'](this,_0x1625cc,_0x2ca9d1);return this['channel'][_0x9ff8('0xaf')](_0x9ff8('0x1a4'));};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0x1a5')]=function(_0x400bcf){logger[_0x9ff8('0x32')](util['format']('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x400bcf[_0x9ff8('0xad')]));return this['channel'][_0x9ff8('0xaf')](_0x9ff8('0x1a6'));};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0x1a7')]=function(_0xa5ce44){logger[_0x9ff8('0x32')](util[_0x9ff8('0x59')](_0x9ff8('0x1a8'),_0xa5ce44['label']));if(!this[_0x9ff8('0x8b')](_0xa5ce44[_0x9ff8('0x1a9')])){return this[_0x9ff8('0x11')]['noop'](_0x9ff8('0x1aa'));}var _0x37d804=this[_0x9ff8('0x38')]['sync'](this,_0xa5ce44[_0x9ff8('0x1a9')]);if(!_0x37d804){return this[_0x9ff8('0x11')][_0x9ff8('0x30')](_0xa5ce44,_0x9ff8('0x1ab'));}var _0x4e102f={'body':_0xa5ce44[_0x9ff8('0x1ac')],'phone':_0xa5ce44['to']||'','SmsAccountId':_0x37d804['id']};logger['debug'](_0x9ff8('0x1ad'),JSON['stringify'](_0x4e102f));this[_0x9ff8('0x3b')]['sync'](this,_0xa5ce44,_0xa5ce44[_0x9ff8('0x1a9')]);this['channel']['noop'](util[_0x9ff8('0x59')](_0x9ff8('0x1ae'),_0x37d804[_0x9ff8('0x16')]));this[_0x9ff8('0x3a')][_0x9ff8('0xa9')](this,_0x4e102f);return this['channel'][_0x9ff8('0xaf')](_0x9ff8('0x1af'));};AGIVertices['prototype'][_0x9ff8('0x1b0')]=function(_0x28d32e){logger[_0x9ff8('0x32')](util[_0x9ff8('0x59')](_0x9ff8('0x1b1'),_0x28d32e[_0x9ff8('0xad')]));if(!this['isConfigured'](_0x28d32e[_0x9ff8('0xe0')])){return this['channel'][_0x9ff8('0x30')](_0x28d32e,_0x9ff8('0x1b2'));}var _0x5d2744=this[_0x9ff8('0x14')][_0x9ff8('0xa9')](this,_0x28d32e[_0x9ff8('0xe0')]);if(!_0x5d2744){return this[_0x9ff8('0x11')][_0x9ff8('0x30')](_0x28d32e,_0x9ff8('0x120'));}return this[_0x9ff8('0x11')][_0x9ff8('0xa2')](_0x5d2744,_0x28d32e[_0x9ff8('0x1b3')]);};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0x1b4')]=function(_0x250cfe){logger[_0x9ff8('0x32')](util[_0x9ff8('0x59')](_0x9ff8('0x1b5'),_0x250cfe[_0x9ff8('0xad')]));this[_0x9ff8('0x11')][_0x9ff8('0xaf')](_0x9ff8('0x1b6'));if(_0x250cfe[_0x9ff8('0x1b7')]==='yes'){this['channel'][_0x9ff8('0xaf')](_0x9ff8('0x1b8'));return this[_0x9ff8('0x11')][_0x9ff8('0x1b7')]();}return this[_0x9ff8('0x11')][_0x9ff8('0xaf')]('Skipped\x20Answer');};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0x1b9')]=function(_0x3f0b54){logger[_0x9ff8('0x32')](util[_0x9ff8('0x59')](_0x9ff8('0x1ba'),_0x3f0b54[_0x9ff8('0xad')]));if(!this[_0x9ff8('0x8b')](_0x3f0b54[_0x9ff8('0x1bb')])){return this[_0x9ff8('0x11')][_0x9ff8('0x30')](_0x3f0b54,_0x9ff8('0x1bc'));}var _0x24d4e0=this[_0x9ff8('0x1bd')]['sync'](this,_0x3f0b54[_0x9ff8('0x1bb')]);if(!this[_0x9ff8('0x8b')](_0x24d4e0)){return this[_0x9ff8('0x11')][_0x9ff8('0x30')](_0x3f0b54,util['format'](_0x9ff8('0x1be'),_0x3f0b54[_0x9ff8('0x1bb')]));}if(_0x24d4e0===this['channel'][_0x9ff8('0x3e')]){return this['channel'][_0x9ff8('0x30')](_0x3f0b54,_0x9ff8('0x1bf'));}this[_0x9ff8('0x3b')][_0x9ff8('0xa9')](this,_0x3f0b54,_0x24d4e0);var _0x229569=this[_0x9ff8('0x11')][_0x9ff8('0xae')](_0x9ff8('0x1c0'),util['format'](_0x9ff8('0x1c1'),config[_0x9ff8('0xa')][_0x9ff8('0x19e')]||_0x9ff8('0x1c2'),_0x24d4e0,this[_0x9ff8('0x11')][_0x9ff8('0x3e')]));if(_0x229569['result']===-0x1){return _0x229569;}return this[_0x9ff8('0x11')][_0x9ff8('0xaf')](util['format'](_0x9ff8('0xca'),_0x9ff8('0x1c0'),_0x24d4e0));};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0x1c3')]=function(_0x3aac66){logger[_0x9ff8('0x32')](util[_0x9ff8('0x59')](_0x9ff8('0x1c4'),_0x3aac66['label']));var _0x311b9e=this[_0x9ff8('0x5c')]['sync'](this,_0x3aac66[_0x9ff8('0xbb')]);this[_0x9ff8('0x3b')]['sync'](this,_0x3aac66,_0x3aac66[_0x9ff8('0xbb')]);if(this[_0x9ff8('0x8b')](_0x3aac66[_0x9ff8('0xe0')])){var _0x3239d8=this[_0x9ff8('0x14')][_0x9ff8('0xa9')](this,_0x3aac66[_0x9ff8('0xe0')]);if(_0x3239d8){this['channel'][_0x9ff8('0xa2')](_0x3239d8,_0x311b9e);return this[_0x9ff8('0x11')][_0x9ff8('0xaf')](util['format'](_0x9ff8('0x1c5'),_0x3aac66['command'],_0x3239d8));}}return this[_0x9ff8('0x11')][_0x9ff8('0xaf')](util['format'](_0x9ff8('0x1c6'),_0x3aac66['command']));};AGIVertices[_0x9ff8('0x17')]['google_cloud_tts']=function(_0x42afe8){logger[_0x9ff8('0x32')](util['format']('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x42afe8[_0x9ff8('0xad')]));_0x42afe8['text']=_0x42afe8[_0x9ff8('0x62')][_0x9ff8('0x5e')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x42afe8[_0x9ff8('0x60')])){return this[_0x9ff8('0x11')]['noop'](_0x9ff8('0x1c7'));}if(!this[_0x9ff8('0x8b')](_0x42afe8[_0x9ff8('0x62')])){return this[_0x9ff8('0x11')][_0x9ff8('0xaf')]('no\x20text\x20configured');}this[_0x9ff8('0x11')]['noop'](util['format'](_0x9ff8('0x1c8'),_0x42afe8[_0x9ff8('0x62')]));var _0x12bebf=this[_0x9ff8('0x5f')][_0x9ff8('0xa9')](this,_0x42afe8);if(_0x12bebf){this[_0x9ff8('0x11')][_0x9ff8('0xaf')](util['format'](_0x9ff8('0x1c9'),_0x12bebf));var _0x497d07=this['channel'][_0x9ff8('0x108')](_0x12bebf);try{fs['unlink'](_0x12bebf+_0x9ff8('0x109'));}catch(_0x344828){logger[_0x9ff8('0x30')](_0x344828);}return _0x497d07;}return this[_0x9ff8('0x11')][_0x9ff8('0x30')](_0x42afe8,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0x9ff8('0x1ca')]=function(_0x1f3df8){logger[_0x9ff8('0x32')](util[_0x9ff8('0x59')](_0x9ff8('0x1cb'),_0x1f3df8[_0x9ff8('0xad')]));_0x1f3df8[_0x9ff8('0x62')]=_0x1f3df8[_0x9ff8('0x62')][_0x9ff8('0x5e')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x9ff8('0x8b')](_0x1f3df8['text'])){return this[_0x9ff8('0x11')][_0x9ff8('0xaf')](_0x9ff8('0xcb'));}this[_0x9ff8('0x11')]['noop'](util[_0x9ff8('0x59')](_0x9ff8('0x1cc'),_0x1f3df8[_0x9ff8('0x62')]));var _0x128045=this[_0x9ff8('0x68')][_0x9ff8('0xa9')](this,_0x1f3df8);if(_0x128045){this[_0x9ff8('0x11')][_0x9ff8('0xaf')](util[_0x9ff8('0x59')](_0x9ff8('0x1cd'),_0x128045));var _0x5c2b26=this[_0x9ff8('0x11')][_0x9ff8('0x108')](_0x128045);try{fs[_0x9ff8('0x12c')](_0x128045+_0x9ff8('0x109'));}catch(_0x489a18){logger['error'](_0x489a18);}return _0x5c2b26;}return this['channel']['error'](_0x1f3df8,_0x9ff8('0x1ce'));};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0x1cf')]=function(_0x49b5d9){logger[_0x9ff8('0x32')](util[_0x9ff8('0x59')](_0x9ff8('0x1d0'),_0x49b5d9[_0x9ff8('0xad')]));if(!this['isConfigured'](_0x49b5d9[_0x9ff8('0x160')])){return this['channel'][_0x9ff8('0x30')](_0x49b5d9,_0x9ff8('0x15f'));}logger[_0x9ff8('0x32')](util[_0x9ff8('0x59')](_0x9ff8('0x166'),this[_0x9ff8('0x11')][_0x9ff8('0x3f')],_0x49b5d9[_0x9ff8('0x160')]));var _0x1d7f49=this['agentUnpause'][_0x9ff8('0xa9')](this,_0x49b5d9[_0x9ff8('0x160')]);if(_0x1d7f49){logger[_0x9ff8('0x32')](util['format'](_0x9ff8('0x161'),this[_0x9ff8('0x11')][_0x9ff8('0x3f')],_0x49b5d9['findBy']));this[_0x9ff8('0x11')]['noop'](util[_0x9ff8('0x59')](_0x9ff8('0x161'),this[_0x9ff8('0x11')][_0x9ff8('0x3f')],_0x49b5d9[_0x9ff8('0x160')]));return{'code':0xc8,'result':_0x9ff8('0x167')};}else{logger[_0x9ff8('0x32')](util[_0x9ff8('0x59')](_0x9ff8('0x162'),this['channel'][_0x9ff8('0x3f')],_0x49b5d9['findBy']));this[_0x9ff8('0x11')][_0x9ff8('0xaf')](util['format'](_0x9ff8('0x162'),this[_0x9ff8('0x11')]['callerid'],_0x49b5d9[_0x9ff8('0x160')]));return{'code':0xc8,'result':_0x9ff8('0x163')};}};AGIVertices[_0x9ff8('0x17')][_0x9ff8('0x1d1')]=function(_0x2b0e79){logger[_0x9ff8('0x32')](util[_0x9ff8('0x59')](_0x9ff8('0x1d2'),_0x2b0e79[_0x9ff8('0xad')]));var _0x5de6e0=this[_0x9ff8('0x11')][_0x9ff8('0xae')](_0x9ff8('0x1d3'),[_0x2b0e79[_0x9ff8('0x1d4')],_0x2b0e79['options']]);if(_0x5de6e0[_0x9ff8('0xa7')]===-0x1){return _0x5de6e0;}return this['channel'][_0x9ff8('0xaf')](util[_0x9ff8('0x59')]('Executed\x20command\x20%s\x20%s',_0x9ff8('0x1d3'),_0x2b0e79[_0x9ff8('0x1d4')]));};AGIVertices[_0x9ff8('0x17')]['vswitch']=function(_0x1ba12d){logger[_0x9ff8('0x32')](util['format'](_0x9ff8('0x1d5'),_0x1ba12d[_0x9ff8('0xad')]));if(!this['isConfigured'](_0x1ba12d[_0x9ff8('0xe0')])){return this['channel'][_0x9ff8('0x30')](_0x1ba12d,_0x9ff8('0x1b2'));}var _0x3f390c=this[_0x9ff8('0x14')][_0x9ff8('0xa9')](this,_0x1ba12d['variable_id']);if(!_0x3f390c){return this[_0x9ff8('0x11')][_0x9ff8('0x30')](_0x1ba12d,'no\x20variable\x20found');}var _0x96048f=this[_0x9ff8('0x11')][_0x9ff8('0x14')](_0x3f390c);return{'code':0xc8,'result':_0x96048f[_0x9ff8('0xa5')]?_0x96048f['extra']:'-'};};String[_0x9ff8('0x17')][_0x9ff8('0xa4')]=function(_0x44d1b5,_0x5943c3){return this[_0x9ff8('0xa3')](_0x44d1b5)[_0x9ff8('0x1d6')](_0x5943c3);};module[_0x9ff8('0x1d7')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index affb0fa..4d4492a 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 _0x4377=['seconds','prototype','startAcw','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','then','agents','voicePause','destlinkedid','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','uniqueid','queue','updateAcw','update','info','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','finally','[ACW][START]\x20%s','message','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','attended','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','syncHangup','agentringnoanswer','attendedtransfer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff'];(function(_0x3eeda3,_0x44105c){var _0x3131d4=function(_0x32460e){while(--_0x32460e){_0x3eeda3['push'](_0x3eeda3['shift']());}};_0x3131d4(++_0x44105c);}(_0x4377,0x1e0));var _0x7437=function(_0x4279dd,_0x47382b){_0x4279dd=_0x4279dd-0x0;var _0x584787=_0x4377[_0x4279dd];return _0x584787;};'use strict';var util=require(_0x7437('0x0'));var _=require(_0x7437('0x1'));var moment=require(_0x7437('0x2'));var ami=require(_0x7437('0x3'));var logger=require(_0x7437('0x4'))(_0x7437('0x5'));var RpcUser=require(_0x7437('0x6'));var RpcVoiceAgentReport=require(_0x7437('0x7'));function Acw(_0x1b2ed6){this[_0x7437('0x8')]=_0x1b2ed6[_0x7437('0x8')];this['agents']=_0x1b2ed6['agents'];this[_0x7437('0x9')]=_0x1b2ed6[_0x7437('0x9')];this[_0x7437('0xa')]={};ami['on'](_0x7437('0xb'),this[_0x7437('0xc')][_0x7437('0xd')](this));ami['on'](_0x7437('0xe'),this[_0x7437('0xf')][_0x7437('0xd')](this));ami['on']('hangup',this[_0x7437('0x10')][_0x7437('0xd')](this));ami['on'](_0x7437('0x11'),this['syncAgentRingNoAnswer']['bind'](this));ami['on'](_0x7437('0x12'),this['syncAttendedTransfer']['bind'](this));ami['on'](_0x7437('0x13'),this['syncBlindTransfer'][_0x7437('0xd')](this));ami['on'](_0x7437('0x14'),this[_0x7437('0x15')][_0x7437('0xd')](this));}function getDiff(_0x4c09bb){var _0x2fa4ef=moment()['milliseconds'](0x0);var _0x12609a=moment(_0x4c09bb)[_0x7437('0x16')](0x0);return _0x2fa4ef[_0x7437('0x17')](_0x12609a,_0x7437('0x18'));}Acw[_0x7437('0x19')][_0x7437('0x1a')]=function(_0x639d03){try{var _0x150447=this;var _0x19480c=this[_0x7437('0xa')][_0x639d03][_0x7437('0x1b')];var _0x429768=this[_0x7437('0xa')][_0x639d03]['queue'];var _0x43ae91=this['voiceQueues'][_0x429768];var _0x59055b=![];var _0x5902e7=_0x7437('0x1c');if(_0x43ae91[_0x7437('0x1d')]){if(_0x43ae91[_0x7437('0x1e')]['name']){_0x59055b=!![];_0x5902e7=_0x43ae91[_0x7437('0x1e')][_0x7437('0x1f')];}}ami[_0x7437('0x20')]({'action':'QueuePause','interface':_0x19480c,'paused':!![],'reason':_0x5902e7})[_0x7437('0x21')](function(_0x1f5f7a){if(_0x150447[_0x7437('0x22')][_0x19480c]){return RpcUser['getAgent'](_0x150447['agents'][_0x19480c]['id'])['then'](function(_0x2331a6){if(_0x2331a6&&!_0x2331a6[_0x7437('0x23')]){logger['info']('[%s][START][AGENT:%s][QUEUE:%s]',_0x639d03,_0x19480c,_0x429768);var _0x1f8388=_0x150447[_0x7437('0xa')][_0x639d03]['attended']&&_0x150447[_0x7437('0xa')][_0x639d03][_0x7437('0x24')]?_0x150447[_0x7437('0xa')][_0x639d03][_0x7437('0x24')]:_0x639d03;return RpcUser['savePause'](_0x150447['agents'][_0x19480c],_0x5902e7,_0x1f8388)[_0x7437('0x21')](function(_0x3f00e5){if(!_0x59055b){_0x150447[_0x7437('0x9')][_0x19480c]={};logger['info'](_0x7437('0x25'),_0x639d03,_0x150447[_0x7437('0x8')][_0x429768][_0x7437('0x26')],_0x19480c,_0x429768);_0x150447[_0x7437('0x9')][_0x19480c][_0x7437('0x27')]=setTimeout(_0x150447[_0x7437('0x28')]['bind'](_0x150447,_0x19480c),_0x150447[_0x7437('0x8')][_0x429768][_0x7437('0x26')]*0x3e8);_0x150447['timers'][_0x19480c][_0x7437('0x29')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x150447['timers'][_0x19480c][_0x7437('0x2a')]=_0x639d03;_0x150447[_0x7437('0x9')][_0x19480c][_0x7437('0x2b')]=_0x429768;_0x150447['timers'][_0x19480c][_0x7437('0x2c')]=function(){var _0xd025=getDiff(_0x150447[_0x7437('0x9')][_0x19480c]['lastPauseAt']);clearTimeout(_0x150447[_0x7437('0x9')][_0x19480c][_0x7437('0x27')]);_0x150447[_0x7437('0x9')][_0x19480c][_0x7437('0x27')]=![];RpcVoiceAgentReport[_0x7437('0x2d')]({'acwtime':_0xd025},_0x150447[_0x7437('0x9')][_0x19480c][_0x7437('0x2a')],_0x19480c)[_0x7437('0x21')](function(_0x59ba8a){logger[_0x7437('0x2e')](_0x7437('0x2f'),_0x639d03,_0xd025,_0x59ba8a);})[_0x7437('0x30')](function(_0x2ab6e0){logger['error'](_0x7437('0x31'),_0x639d03,_0x2ab6e0);});delete _0x150447[_0x7437('0x9')][_0x19480c];};}});}else{logger[_0x7437('0x2e')](_0x7437('0x32'),_0x639d03,_0x19480c,_0x429768);}});}})[_0x7437('0x30')](function(_0x19044d){logger[_0x7437('0x33')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x639d03,_0x150447[_0x7437('0x8')][_0x429768][_0x7437('0x26')],_0x19480c,_0x429768);})[_0x7437('0x34')](function(){delete _0x150447[_0x7437('0xa')][_0x639d03];});}catch(_0x2c459a){logger[_0x7437('0x33')](_0x7437('0x35'),_0x2c459a[_0x7437('0x36')]);}};Acw['prototype'][_0x7437('0x28')]=function(_0x41ee17){try{var _0x4cf3c6=this;if(_0x4cf3c6['timers'][_0x41ee17]){_0x4cf3c6[_0x7437('0x9')][_0x41ee17][_0x7437('0x27')]=![];var _0x5cec9c=_0x4cf3c6[_0x7437('0x9')][_0x41ee17][_0x7437('0x2a')];var _0x2af01b=_0x4cf3c6['timers'][_0x41ee17][_0x7437('0x2b')];var _0x332379=_0x4cf3c6[_0x7437('0x8')][_0x2af01b]['acwTimeout'];logger[_0x7437('0x2e')]('[%s][TIMER][STOP][AGENT:%s]',_0x5cec9c,_0x41ee17);RpcUser['saveUnpause'](this['agents'][_0x41ee17]);RpcVoiceAgentReport['update']({'acwtime':_0x332379,'agentacw':!![]},_0x5cec9c,_0x41ee17)['then'](function(_0xf4c1cb){logger[_0x7437('0x2e')](_0x7437('0x2f'),_0x5cec9c,_0x332379,_0xf4c1cb);})['catch'](function(_0x1d7524){logger[_0x7437('0x33')](_0x7437('0x31'),_0x5cec9c,_0x1d7524);});}else{logger[_0x7437('0x33')](_0x7437('0x37'),_0x41ee17);if(_0x4cf3c6[_0x7437('0x9')]){logger[_0x7437('0x2e')](_0x7437('0x38'),JSON[_0x7437('0x39')](_0x4cf3c6[_0x7437('0x9')]));}}}catch(_0x19a6bb){logger[_0x7437('0x33')]('[ACW][STOP]\x20%s',_0x19a6bb[_0x7437('0x36')]);}};Acw[_0x7437('0x19')]['syncAgentConnect']=function(_0x22116d){try{if(this[_0x7437('0x8')][_0x22116d[_0x7437('0x2b')]]&&(this[_0x7437('0x8')][_0x22116d['queue']]['acw']||this[_0x7437('0x8')][_0x22116d[_0x7437('0x2b')]][_0x7437('0x1d')])){if(this['agents'][_0x22116d[_0x7437('0x1b')]]){this[_0x7437('0xa')][_0x22116d[_0x7437('0x2a')]]={'queue':_0x22116d[_0x7437('0x2b')],'interface':_0x22116d[_0x7437('0x1b')],'destlinkedid':_0x22116d['destlinkedid']};}}}catch(_0x3862c4){logger['error'](_0x7437('0x3a'),_0x3862c4[_0x7437('0x36')]);}};Acw[_0x7437('0x19')][_0x7437('0x15')]=function(_0x3942c0){try{if(this[_0x7437('0x8')][_0x3942c0[_0x7437('0x2b')]]&&(this[_0x7437('0x8')][_0x3942c0[_0x7437('0x2b')]][_0x7437('0x5')]||this[_0x7437('0x8')][_0x3942c0[_0x7437('0x2b')]][_0x7437('0x1d')])){if(this[_0x7437('0x22')][_0x3942c0['interface']]){this['channels'][_0x3942c0[_0x7437('0x2a')]]={'queue':_0x3942c0[_0x7437('0x2b')],'interface':_0x3942c0[_0x7437('0x1b')]};}}}catch(_0x337173){logger[_0x7437('0x33')](_0x7437('0x3b'),_0x337173[_0x7437('0x36')]);}};Acw[_0x7437('0x19')]['syncHangupRequest']=function(_0x3bb0f1){try{if(this[_0x7437('0xa')][_0x3bb0f1[_0x7437('0x2a')]]&&_['isUndefined'](this['channels'][_0x3bb0f1[_0x7437('0x2a')]][_0x7437('0x3c')])){logger['info']('[%s][HANGUP:UNIQUEID]',_0x3bb0f1[_0x7437('0x2a')]);this[_0x7437('0x1a')](_0x3bb0f1[_0x7437('0x2a')]);}else if(this[_0x7437('0xa')][_0x3bb0f1[_0x7437('0x3d')]]&&_['isUndefined'](this[_0x7437('0xa')][_0x3bb0f1['linkedid']][_0x7437('0x3c')])){logger[_0x7437('0x2e')](_0x7437('0x3e'),_0x3bb0f1[_0x7437('0x3d')]);this[_0x7437('0x1a')](_0x3bb0f1[_0x7437('0x3d')]);}}catch(_0x2a839f){logger[_0x7437('0x33')]('[ACW][syncHangupRequest]\x20%s',_0x2a839f[_0x7437('0x36')]);}};Acw[_0x7437('0x19')][_0x7437('0x10')]=function(_0x2049e5){try{if(this[_0x7437('0xa')][_0x2049e5['uniqueid']]&&this['channels'][_0x2049e5[_0x7437('0x2a')]][_0x7437('0x3c')]){logger[_0x7437('0x2e')](_0x7437('0x3f'),_0x2049e5[_0x7437('0x2a')]);this['startAcw'](_0x2049e5[_0x7437('0x2a')]);}else if(this[_0x7437('0xa')][_0x2049e5[_0x7437('0x3d')]]&&this['channels'][_0x2049e5[_0x7437('0x3d')]]['attended']){logger['info'](_0x7437('0x40'),_0x2049e5['linkedid']);this[_0x7437('0x1a')](_0x2049e5['linkedid']);}}catch(_0x26254b){logger['error'](_0x7437('0x41'),_0x26254b[_0x7437('0x36')]);}};Acw[_0x7437('0x19')][_0x7437('0x42')]=function(_0x26f373){try{if(!_[_0x7437('0x43')](this['channels'][_0x26f373[_0x7437('0x44')]])){this[_0x7437('0x1a')](_0x26f373['transfereeuniqueid']);if(this[_0x7437('0xa')][_0x26f373[_0x7437('0x45')]]){this['channels'][_0x26f373[_0x7437('0x45')]]['attended']=!![];this[_0x7437('0xa')][_0x26f373[_0x7437('0x46')]]=this[_0x7437('0xa')][_0x26f373[_0x7437('0x45')]];delete this[_0x7437('0xa')][_0x26f373['secondtransfereruniqueid']];}}else if(!_['isNil'](this[_0x7437('0xa')][_0x26f373['transfertargetuniqueid']])){this[_0x7437('0x1a')](_0x26f373[_0x7437('0x46')]);if(this[_0x7437('0xa')][_0x26f373[_0x7437('0x47')]]){this[_0x7437('0xa')][_0x26f373[_0x7437('0x47')]][_0x7437('0x3c')]=!![];this[_0x7437('0xa')][_0x26f373[_0x7437('0x44')]]=this['channels'][_0x26f373[_0x7437('0x47')]];delete this[_0x7437('0xa')][_0x26f373[_0x7437('0x47')]];}}}catch(_0x453fb6){logger['error'](_0x7437('0x48'),_0x453fb6[_0x7437('0x36')]);}};Acw[_0x7437('0x19')][_0x7437('0x49')]=function(_0x4686ef){try{if(this[_0x7437('0xa')][_0x4686ef[_0x7437('0x4a')]]){logger[_0x7437('0x2e')](_0x7437('0x4b'),JSON[_0x7437('0x39')](_0x4686ef['transfereruniqueid']));this[_0x7437('0x1a')](_0x4686ef[_0x7437('0x4a')]);}else if(this[_0x7437('0xa')][_0x4686ef[_0x7437('0x4c')]]){logger[_0x7437('0x2e')](_0x7437('0x4d'),JSON['stringify'](_0x4686ef[_0x7437('0x4c')]));this[_0x7437('0x1a')](_0x4686ef['transfererlinkedid']);}}catch(_0x57de41){logger[_0x7437('0x33')]('[ACW][syncBlindTransfer]\x20%s',_0x57de41['message']);}};Acw[_0x7437('0x19')]['syncAgentRingNoAnswer']=function(_0x5dbb67){try{if(this[_0x7437('0x8')][_0x5dbb67['queue']]&&this[_0x7437('0x8')][_0x5dbb67[_0x7437('0x2b')]][_0x7437('0x4e')]==='all'){if(this[_0x7437('0x22')][_0x5dbb67['interface']]){logger[_0x7437('0x2e')](_0x7437('0x4f'),_0x5dbb67[_0x7437('0x2a')],_0x5dbb67['interface'],_0x5dbb67['queue']);return RpcUser[_0x7437('0x50')](this[_0x7437('0x22')][_0x5dbb67[_0x7437('0x1b')]],_0x7437('0x51'),_0x5dbb67[_0x7437('0x2a')]);}}}catch(_0x820638){logger['error'](_0x7437('0x52'),_0x820638[_0x7437('0x36')]);}};module[_0x7437('0x53')]=Acw; \ No newline at end of file +var _0xbd44=['uniqueid','queue','updateAcw','lastPauseAt','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','prototype','stopAcw','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','acw','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','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','syncBlindTransfer','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','exports','util','lodash','moment','../ami','../../../config/logger','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','syncAgentConnect','hanguprequest','syncHangupRequest','hangup','syncAgentRingNoAnswer','bind','attendedtransfer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','startAcw','channels','interface','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbd44,0x141));var _0x4bd4=function(_0x3ae872,_0x1a3f01){_0x3ae872=_0x3ae872-0x0;var _0x3c76fe=_0xbd44[_0x3ae872];return _0x3c76fe;};'use strict';var util=require(_0x4bd4('0x0'));var _=require(_0x4bd4('0x1'));var moment=require(_0x4bd4('0x2'));var ami=require(_0x4bd4('0x3'));var logger=require(_0x4bd4('0x4'))('acw');var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x4bd4('0x5'));function Acw(_0x2420bb){this[_0x4bd4('0x6')]=_0x2420bb[_0x4bd4('0x6')];this[_0x4bd4('0x7')]=_0x2420bb[_0x4bd4('0x7')];this[_0x4bd4('0x8')]=_0x2420bb[_0x4bd4('0x8')];this['channels']={};ami['on'](_0x4bd4('0x9'),this[_0x4bd4('0xa')]['bind'](this));ami['on'](_0x4bd4('0xb'),this[_0x4bd4('0xc')]['bind'](this));ami['on'](_0x4bd4('0xd'),this['syncHangup']['bind'](this));ami['on']('agentringnoanswer',this[_0x4bd4('0xe')][_0x4bd4('0xf')](this));ami['on'](_0x4bd4('0x10'),this[_0x4bd4('0x11')][_0x4bd4('0xf')](this));ami['on'](_0x4bd4('0x12'),this['syncBlindTransfer'][_0x4bd4('0xf')](this));ami['on'](_0x4bd4('0x13'),this[_0x4bd4('0x14')][_0x4bd4('0xf')](this));}function getDiff(_0x1680ba){var _0x40ce94=moment()[_0x4bd4('0x15')](0x0);var _0x1d6c33=moment(_0x1680ba)['milliseconds'](0x0);return _0x40ce94[_0x4bd4('0x16')](_0x1d6c33,_0x4bd4('0x17'));}Acw['prototype'][_0x4bd4('0x18')]=function(_0x237dcc){try{var _0x499e93=this;var _0x320d08=this[_0x4bd4('0x19')][_0x237dcc][_0x4bd4('0x1a')];var _0x35152e=this[_0x4bd4('0x19')][_0x237dcc]['queue'];var _0x1ce3cb=this[_0x4bd4('0x6')][_0x35152e];var _0x5ca877=![];var _0xf874bf='ACW';if(_0x1ce3cb[_0x4bd4('0x1b')]){if(_0x1ce3cb[_0x4bd4('0x1c')][_0x4bd4('0x1d')]){_0x5ca877=!![];_0xf874bf=_0x1ce3cb['mandatoryDispositionPause'][_0x4bd4('0x1d')];}}ami[_0x4bd4('0x1e')]({'action':_0x4bd4('0x1f'),'interface':_0x320d08,'paused':!![],'reason':_0xf874bf})[_0x4bd4('0x20')](function(_0x57eca1){if(_0x499e93['agents'][_0x320d08]){return RpcUser[_0x4bd4('0x21')](_0x499e93[_0x4bd4('0x7')][_0x320d08]['id'])[_0x4bd4('0x20')](function(_0x20abc2){if(_0x20abc2&&!_0x20abc2[_0x4bd4('0x22')]){logger[_0x4bd4('0x23')](_0x4bd4('0x24'),_0x237dcc,_0x320d08,_0x35152e);var _0x584730=_0x499e93[_0x4bd4('0x19')][_0x237dcc][_0x4bd4('0x25')]&&_0x499e93[_0x4bd4('0x19')][_0x237dcc]['destlinkedid']?_0x499e93[_0x4bd4('0x19')][_0x237dcc][_0x4bd4('0x26')]:_0x237dcc;return RpcUser['savePause'](_0x499e93[_0x4bd4('0x7')][_0x320d08],_0xf874bf,_0x584730)[_0x4bd4('0x20')](function(_0x1796ce){if(!_0x5ca877){_0x499e93['timers'][_0x320d08]={};logger[_0x4bd4('0x23')](_0x4bd4('0x27'),_0x237dcc,_0x499e93[_0x4bd4('0x6')][_0x35152e][_0x4bd4('0x28')],_0x320d08,_0x35152e);_0x499e93[_0x4bd4('0x8')][_0x320d08][_0x4bd4('0x29')]=setTimeout(_0x499e93['stopAcw'][_0x4bd4('0xf')](_0x499e93,_0x320d08),_0x499e93[_0x4bd4('0x6')][_0x35152e]['acwTimeout']*0x3e8);_0x499e93['timers'][_0x320d08]['lastPauseAt']=moment()['format'](_0x4bd4('0x2a'));_0x499e93[_0x4bd4('0x8')][_0x320d08][_0x4bd4('0x2b')]=_0x237dcc;_0x499e93['timers'][_0x320d08][_0x4bd4('0x2c')]=_0x35152e;_0x499e93[_0x4bd4('0x8')][_0x320d08][_0x4bd4('0x2d')]=function(){var _0x2d42b0=getDiff(_0x499e93[_0x4bd4('0x8')][_0x320d08][_0x4bd4('0x2e')]);clearTimeout(_0x499e93[_0x4bd4('0x8')][_0x320d08][_0x4bd4('0x29')]);_0x499e93[_0x4bd4('0x8')][_0x320d08][_0x4bd4('0x29')]=![];RpcVoiceAgentReport[_0x4bd4('0x2f')]({'acwtime':_0x2d42b0},_0x499e93['timers'][_0x320d08][_0x4bd4('0x2b')],_0x320d08)[_0x4bd4('0x20')](function(_0x5c098a){logger[_0x4bd4('0x23')](_0x4bd4('0x30'),_0x237dcc,_0x2d42b0,_0x5c098a);})[_0x4bd4('0x31')](function(_0x313a1f){logger[_0x4bd4('0x32')](_0x4bd4('0x33'),_0x237dcc,_0x313a1f);});delete _0x499e93[_0x4bd4('0x8')][_0x320d08];};}});}else{logger['info'](_0x4bd4('0x34'),_0x237dcc,_0x320d08,_0x35152e);}});}})[_0x4bd4('0x31')](function(_0x4ec1f2){logger['error'](_0x4bd4('0x27'),_0x237dcc,_0x499e93[_0x4bd4('0x6')][_0x35152e][_0x4bd4('0x28')],_0x320d08,_0x35152e);})[_0x4bd4('0x35')](function(){delete _0x499e93['channels'][_0x237dcc];});}catch(_0x166f76){logger['error'](_0x4bd4('0x36'),_0x166f76[_0x4bd4('0x37')]);}};Acw[_0x4bd4('0x38')][_0x4bd4('0x39')]=function(_0x2f3a7b){try{var _0x23315c=this;if(_0x23315c[_0x4bd4('0x8')][_0x2f3a7b]){_0x23315c[_0x4bd4('0x8')][_0x2f3a7b][_0x4bd4('0x29')]=![];var _0x1eab63=_0x23315c[_0x4bd4('0x8')][_0x2f3a7b][_0x4bd4('0x2b')];var _0x13b412=_0x23315c[_0x4bd4('0x8')][_0x2f3a7b]['queue'];var _0x28d873=_0x23315c[_0x4bd4('0x6')][_0x13b412][_0x4bd4('0x28')];logger['info'](_0x4bd4('0x3a'),_0x1eab63,_0x2f3a7b);RpcUser[_0x4bd4('0x3b')](this[_0x4bd4('0x7')][_0x2f3a7b]);RpcVoiceAgentReport['update']({'acwtime':_0x28d873,'agentacw':!![]},_0x1eab63,_0x2f3a7b)[_0x4bd4('0x20')](function(_0x135176){logger[_0x4bd4('0x23')](_0x4bd4('0x30'),_0x1eab63,_0x28d873,_0x135176);})[_0x4bd4('0x31')](function(_0x30d27d){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x1eab63,_0x30d27d);});}else{logger[_0x4bd4('0x32')](_0x4bd4('0x3c'),_0x2f3a7b);if(_0x23315c[_0x4bd4('0x8')]){logger[_0x4bd4('0x23')]('[ACW][TIMERS]',JSON[_0x4bd4('0x3d')](_0x23315c[_0x4bd4('0x8')]));}}}catch(_0x1fa241){logger[_0x4bd4('0x32')](_0x4bd4('0x3e'),_0x1fa241['message']);}};Acw[_0x4bd4('0x38')][_0x4bd4('0xa')]=function(_0x275c0e){try{if(this[_0x4bd4('0x6')][_0x275c0e['queue']]&&(this[_0x4bd4('0x6')][_0x275c0e[_0x4bd4('0x2c')]][_0x4bd4('0x3f')]||this['voiceQueues'][_0x275c0e[_0x4bd4('0x2c')]][_0x4bd4('0x1b')])){if(this[_0x4bd4('0x7')][_0x275c0e[_0x4bd4('0x1a')]]){this[_0x4bd4('0x19')][_0x275c0e[_0x4bd4('0x2b')]]={'queue':_0x275c0e[_0x4bd4('0x2c')],'interface':_0x275c0e[_0x4bd4('0x1a')],'destlinkedid':_0x275c0e[_0x4bd4('0x26')]};}}}catch(_0x1a2760){logger[_0x4bd4('0x32')](_0x4bd4('0x40'),_0x1a2760[_0x4bd4('0x37')]);}};Acw[_0x4bd4('0x38')][_0x4bd4('0x14')]=function(_0x3fad48){try{if(this[_0x4bd4('0x6')][_0x3fad48[_0x4bd4('0x2c')]]&&(this[_0x4bd4('0x6')][_0x3fad48[_0x4bd4('0x2c')]][_0x4bd4('0x3f')]||this[_0x4bd4('0x6')][_0x3fad48[_0x4bd4('0x2c')]][_0x4bd4('0x1b')])){if(this[_0x4bd4('0x7')][_0x3fad48['interface']]){this[_0x4bd4('0x19')][_0x3fad48[_0x4bd4('0x2b')]]={'queue':_0x3fad48[_0x4bd4('0x2c')],'interface':_0x3fad48[_0x4bd4('0x1a')]};}}}catch(_0x40010a){logger[_0x4bd4('0x32')](_0x4bd4('0x41'),_0x40010a[_0x4bd4('0x37')]);}};Acw[_0x4bd4('0x38')][_0x4bd4('0xc')]=function(_0x1e8499){try{if(this[_0x4bd4('0x19')][_0x1e8499[_0x4bd4('0x2b')]]&&_[_0x4bd4('0x42')](this[_0x4bd4('0x19')][_0x1e8499[_0x4bd4('0x2b')]][_0x4bd4('0x25')])){logger['info'](_0x4bd4('0x43'),_0x1e8499[_0x4bd4('0x2b')]);this[_0x4bd4('0x18')](_0x1e8499[_0x4bd4('0x2b')]);}else if(this[_0x4bd4('0x19')][_0x1e8499['linkedid']]&&_['isUndefined'](this['channels'][_0x1e8499[_0x4bd4('0x44')]][_0x4bd4('0x25')])){logger[_0x4bd4('0x23')](_0x4bd4('0x45'),_0x1e8499[_0x4bd4('0x44')]);this[_0x4bd4('0x18')](_0x1e8499['linkedid']);}}catch(_0x3d5f96){logger[_0x4bd4('0x32')](_0x4bd4('0x46'),_0x3d5f96[_0x4bd4('0x37')]);}};Acw[_0x4bd4('0x38')][_0x4bd4('0x47')]=function(_0x4474dc){try{if(this['channels'][_0x4474dc[_0x4bd4('0x2b')]]&&this[_0x4bd4('0x19')][_0x4474dc['uniqueid']]['attended']){logger[_0x4bd4('0x23')](_0x4bd4('0x48'),_0x4474dc['uniqueid']);this[_0x4bd4('0x18')](_0x4474dc[_0x4bd4('0x2b')]);}else if(this[_0x4bd4('0x19')][_0x4474dc[_0x4bd4('0x44')]]&&this[_0x4bd4('0x19')][_0x4474dc[_0x4bd4('0x44')]][_0x4bd4('0x25')]){logger[_0x4bd4('0x23')](_0x4bd4('0x49'),_0x4474dc[_0x4bd4('0x44')]);this[_0x4bd4('0x18')](_0x4474dc[_0x4bd4('0x44')]);}}catch(_0x92b14){logger[_0x4bd4('0x32')](_0x4bd4('0x4a'),_0x92b14[_0x4bd4('0x37')]);}};Acw[_0x4bd4('0x38')][_0x4bd4('0x11')]=function(_0x4255a1){try{if(!_[_0x4bd4('0x4b')](this[_0x4bd4('0x19')][_0x4255a1[_0x4bd4('0x4c')]])){this[_0x4bd4('0x18')](_0x4255a1[_0x4bd4('0x4c')]);if(this[_0x4bd4('0x19')][_0x4255a1[_0x4bd4('0x4d')]]){this[_0x4bd4('0x19')][_0x4255a1['secondtransfereruniqueid']][_0x4bd4('0x25')]=!![];this['channels'][_0x4255a1[_0x4bd4('0x4e')]]=this[_0x4bd4('0x19')][_0x4255a1[_0x4bd4('0x4d')]];delete this[_0x4bd4('0x19')][_0x4255a1[_0x4bd4('0x4d')]];}}else if(!_[_0x4bd4('0x4b')](this['channels'][_0x4255a1['transfertargetuniqueid']])){this[_0x4bd4('0x18')](_0x4255a1[_0x4bd4('0x4e')]);if(this[_0x4bd4('0x19')][_0x4255a1['origtransfereruniqueid']]){this[_0x4bd4('0x19')][_0x4255a1['origtransfereruniqueid']]['attended']=!![];this[_0x4bd4('0x19')][_0x4255a1[_0x4bd4('0x4c')]]=this[_0x4bd4('0x19')][_0x4255a1[_0x4bd4('0x4f')]];delete this[_0x4bd4('0x19')][_0x4255a1['origtransfereruniqueid']];}}}catch(_0x3769ac){logger[_0x4bd4('0x32')](_0x4bd4('0x50'),_0x3769ac[_0x4bd4('0x37')]);}};Acw[_0x4bd4('0x38')][_0x4bd4('0x51')]=function(_0x13d7c1){try{if(this[_0x4bd4('0x19')][_0x13d7c1['transfereruniqueid']]){logger[_0x4bd4('0x23')](_0x4bd4('0x52'),JSON['stringify'](_0x13d7c1[_0x4bd4('0x53')]));this['startAcw'](_0x13d7c1[_0x4bd4('0x53')]);}else if(this['channels'][_0x13d7c1[_0x4bd4('0x54')]]){logger['info'](_0x4bd4('0x55'),JSON[_0x4bd4('0x3d')](_0x13d7c1['transfererlinkedid']));this[_0x4bd4('0x18')](_0x13d7c1[_0x4bd4('0x54')]);}}catch(_0x50e0d4){logger[_0x4bd4('0x32')]('[ACW][syncBlindTransfer]\x20%s',_0x50e0d4[_0x4bd4('0x37')]);}};Acw[_0x4bd4('0x38')][_0x4bd4('0xe')]=function(_0x32d246){try{if(this[_0x4bd4('0x6')][_0x32d246[_0x4bd4('0x2c')]]&&this['voiceQueues'][_0x32d246['queue']][_0x4bd4('0x56')]===_0x4bd4('0x57')){if(this['agents'][_0x32d246[_0x4bd4('0x1a')]]){logger[_0x4bd4('0x23')](_0x4bd4('0x58'),_0x32d246[_0x4bd4('0x2b')],_0x32d246[_0x4bd4('0x1a')],_0x32d246[_0x4bd4('0x2c')]);return RpcUser[_0x4bd4('0x59')](this['agents'][_0x32d246[_0x4bd4('0x1a')]],'Auto-Pause',_0x32d246[_0x4bd4('0x2b')]);}}}catch(_0x1c8d05){logger[_0x4bd4('0x32')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x1c8d05[_0x4bd4('0x37')]);}};module[_0x4bd4('0x5a')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index e195abb..eda0560 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 _0x8eaa=['moment','lodash','../../config/logger','ami','asterisk','username','keepConnected','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','Action','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','log','exports','asterisk-manager','bluebird'];(function(_0x5b5554,_0x1cfd35){var _0x3f1b4d=function(_0x3eb682){while(--_0x3eb682){_0x5b5554['push'](_0x5b5554['shift']());}};_0x3f1b4d(++_0x1cfd35);}(_0x8eaa,0x154));var _0xa8ea=function(_0x56ab48,_0xfab19f){_0x56ab48=_0x56ab48-0x0;var _0x5bf5d1=_0x8eaa[_0x56ab48];return _0x5bf5d1;};'use strict';var Manager=require(_0xa8ea('0x0'));var BPromise=require(_0xa8ea('0x1'));var moment=require(_0xa8ea('0x2'));var util=require('util');var _=require(_0xa8ea('0x3'));var logger=require(_0xa8ea('0x4'))(_0xa8ea('0x5'));var config=require('../../config/environment');var ami=new Manager(config[_0xa8ea('0x6')]['port'],config[_0xa8ea('0x6')]['ip'],config['asterisk'][_0xa8ea('0x7')],config[_0xa8ea('0x6')]['password'],!![]);ami[_0xa8ea('0x8')]();ami['Action']=BPromise['promisify'](ami[_0xa8ea('0x9')]);function error(_0x5e3a72){logger[_0xa8ea('0xa')](util[_0xa8ea('0xb')](_0xa8ea('0xc'),config[_0xa8ea('0x6')][_0xa8ea('0x7')],config[_0xa8ea('0x6')]['ip'],config['asterisk'][_0xa8ea('0xd')],util[_0xa8ea('0xe')](_0x5e3a72,![],null)));}function close(){logger[_0xa8ea('0xa')](util[_0xa8ea('0xb')](_0xa8ea('0xf'),config[_0xa8ea('0x6')]['username'],config[_0xa8ea('0x6')]['ip'],config[_0xa8ea('0x6')]['port']));}ami[_0xa8ea('0x10')]=function(){return function(){return ami[_0xa8ea('0x11')]({'action':_0xa8ea('0x12')});};};ami[_0xa8ea('0x13')]=function(){return function(){return ami[_0xa8ea('0x11')]({'action':_0xa8ea('0x14')});};};ami[_0xa8ea('0x15')]=function(){return function(){return ami[_0xa8ea('0x11')]({'action':_0xa8ea('0x16')});};};ami[_0xa8ea('0x17')]=function(){return function(){return ami[_0xa8ea('0x11')]({'action':_0xa8ea('0x18')});};};ami[_0xa8ea('0x19')]=function(){return function(){return ami[_0xa8ea('0x11')]({'action':'coreshowchannels'});};};function connect(_0x3683df){logger[_0xa8ea('0x1a')](util['format'](_0xa8ea('0x1b'),config[_0xa8ea('0x6')][_0xa8ea('0x7')],config[_0xa8ea('0x6')]['ip'],config['asterisk']['port']));ami[_0xa8ea('0x1c')](_0xa8ea('0xa'),error);ami[_0xa8ea('0x1c')](_0xa8ea('0x1d'),close);}ami['on'](_0xa8ea('0x1e'),connect);ami['on'](_0xa8ea('0x1f'),function(_0x1578aa){logger[_0xa8ea('0x1a')](util[_0xa8ea('0xb')](_0xa8ea('0x20'),config['asterisk']['username'],config[_0xa8ea('0x6')]['ip'],config['asterisk'][_0xa8ea('0xd')],util[_0xa8ea('0xe')](_0x1578aa,![],null)));});ami['on']('fullybooted',function(_0x20054a){logger[_0xa8ea('0x1a')](util[_0xa8ea('0xb')](_0xa8ea('0x21'),config['asterisk'][_0xa8ea('0x7')],config['asterisk']['ip'],config['asterisk'][_0xa8ea('0xd')]));return BPromise[_0xa8ea('0x22')]()[_0xa8ea('0x23')](ami['actionSipShowRegistry']())[_0xa8ea('0x23')](ami[_0xa8ea('0x13')]())[_0xa8ea('0x23')](ami[_0xa8ea('0x15')]())[_0xa8ea('0x23')](ami[_0xa8ea('0x17')]())[_0xa8ea('0x23')](ami['actionCoreShowChannels']())['catch'](function(_0x2e5d13){console[_0xa8ea('0x24')](_0x2e5d13);});});ami[_0xa8ea('0x1c')](_0xa8ea('0xa'),error);ami['once'](_0xa8ea('0x1d'),close);module[_0xa8ea('0x25')]=ami; \ No newline at end of file +var _0x80af=['Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipPeerStatus','log','exports','asterisk-manager','bluebird','moment','util','lodash','../../config/logger','ami','../../config/environment','asterisk','port','password','keepConnected','Action','promisify','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','inspect','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s'];(function(_0x2baddd,_0x278938){var _0x568547=function(_0x1c002f){while(--_0x1c002f){_0x2baddd['push'](_0x2baddd['shift']());}};_0x568547(++_0x278938);}(_0x80af,0x13e));var _0xf80a=function(_0x454546,_0x144f1a){_0x454546=_0x454546-0x0;var _0x4bc707=_0x80af[_0x454546];return _0x4bc707;};'use strict';var Manager=require(_0xf80a('0x0'));var BPromise=require(_0xf80a('0x1'));var moment=require(_0xf80a('0x2'));var util=require(_0xf80a('0x3'));var _=require(_0xf80a('0x4'));var logger=require(_0xf80a('0x5'))(_0xf80a('0x6'));var config=require(_0xf80a('0x7'));var ami=new Manager(config[_0xf80a('0x8')][_0xf80a('0x9')],config['asterisk']['ip'],config['asterisk']['username'],config['asterisk'][_0xf80a('0xa')],!![]);ami[_0xf80a('0xb')]();ami[_0xf80a('0xc')]=BPromise[_0xf80a('0xd')](ami['action']);function error(_0x7de7cd){logger['error'](util[_0xf80a('0xe')](_0xf80a('0xf'),config[_0xf80a('0x8')][_0xf80a('0x10')],config[_0xf80a('0x8')]['ip'],config[_0xf80a('0x8')]['port'],util[_0xf80a('0x11')](_0x7de7cd,![],null)));}function close(){logger[_0xf80a('0x12')](util[_0xf80a('0xe')](_0xf80a('0x13'),config[_0xf80a('0x8')][_0xf80a('0x10')],config['asterisk']['ip'],config[_0xf80a('0x8')][_0xf80a('0x9')]));}ami[_0xf80a('0x14')]=function(){return function(){return ami['Action']({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0xf80a('0xc')]({'action':'devicestatelist'});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0xf80a('0xc')]({'action':_0xf80a('0x15')});};};ami[_0xf80a('0x16')]=function(){return function(){return ami['Action']({'action':_0xf80a('0x17')});};};ami[_0xf80a('0x18')]=function(){return function(){return ami[_0xf80a('0xc')]({'action':_0xf80a('0x19')});};};function connect(_0x50cf4d){logger[_0xf80a('0x1a')](util[_0xf80a('0xe')](_0xf80a('0x1b'),config['asterisk'][_0xf80a('0x10')],config['asterisk']['ip'],config[_0xf80a('0x8')][_0xf80a('0x9')]));ami[_0xf80a('0x1c')]('error',error);ami['once'](_0xf80a('0x1d'),close);}ami['on'](_0xf80a('0x1e'),connect);ami['on'](_0xf80a('0x1f'),function(_0x54a05f){logger[_0xf80a('0x1a')](util[_0xf80a('0xe')](_0xf80a('0x20'),config[_0xf80a('0x8')]['username'],config['asterisk']['ip'],config['asterisk'][_0xf80a('0x9')],util[_0xf80a('0x11')](_0x54a05f,![],null)));});ami['on']('fullybooted',function(_0x156b2a){logger[_0xf80a('0x1a')](util[_0xf80a('0xe')](_0xf80a('0x21'),config[_0xf80a('0x8')][_0xf80a('0x10')],config[_0xf80a('0x8')]['ip'],config[_0xf80a('0x8')][_0xf80a('0x9')]));return BPromise[_0xf80a('0x22')]()[_0xf80a('0x23')](ami[_0xf80a('0x14')]())[_0xf80a('0x23')](ami['actionDeviceStateList']())['then'](ami[_0xf80a('0x24')]())[_0xf80a('0x23')](ami[_0xf80a('0x16')]())[_0xf80a('0x23')](ami['actionCoreShowChannels']())['catch'](function(_0x34348a){console[_0xf80a('0x25')](_0x34348a);});});ami['once'](_0xf80a('0x12'),error);ami[_0xf80a('0x1c')](_0xf80a('0x1d'),close);module[_0xf80a('0x26')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 6f67487..bd6eb57 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 _0xaa88=['bluebird','../../config/logger','ami','http','Request','rpc','memberReport','error','message','result','catch','jayson/promise'];(function(_0x590610,_0x7ad28e){var _0x51a526=function(_0x4edbe3){while(--_0x4edbe3){_0x590610['push'](_0x590610['shift']());}};_0x51a526(++_0x7ad28e);}(_0xaa88,0x137));var _0x8aa8=function(_0x349a9e,_0x473cb8){_0x349a9e=_0x349a9e-0x0;var _0x24c207=_0xaa88[_0x349a9e];return _0x24c207;};'use strict';var jayson=require(_0x8aa8('0x0'));var BPromise=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var client=jayson['client'][_0x8aa8('0x4')]({'port':0x2329});client[_0x8aa8('0x5')]=function(_0x43f7e4,_0x3b2c88){return new BPromise(function(_0x3e3b70,_0x350e8b){return client['request'](_0x43f7e4,_0x3b2c88)['then'](function(_0x460042){logger['debug'](_0x8aa8('0x6'),_0x8aa8('0x7'),_0x43f7e4,_0x3b2c88,_0x460042);if(_0x460042[_0x8aa8('0x8')]){logger[_0x8aa8('0x8')]('rpc',_0x8aa8('0x7'),_0x43f7e4,_0x460042[_0x8aa8('0x8')][_0x8aa8('0x9')],_0x3b2c88);return _0x350e8b(_0x460042['error'][_0x8aa8('0x9')]);}else{return _0x3e3b70(_0x460042[_0x8aa8('0xa')]);}})[_0x8aa8('0xb')](function(_0x33cc5c){logger['error'](_0x8aa8('0x6'),_0x8aa8('0x7'),_0x43f7e4,_0x33cc5c,_0x3b2c88);return _0x350e8b(_0x33cc5c);});});};module['exports']=client; \ No newline at end of file +var _0x0713=['rpc','memberReport','error','message','result','catch','exports','../../config/logger','ami','client','http','Request','request','then','debug'];(function(_0x4b2bbb,_0x594ca3){var _0x52ba0d=function(_0x137a71){while(--_0x137a71){_0x4b2bbb['push'](_0x4b2bbb['shift']());}};_0x52ba0d(++_0x594ca3);}(_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 cc28cf1..37cb3cb 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 _0xd065=['callback','callbackuniqueid','callbackat','originatecalleridnum','originatecalleridname','prototype','getCaller','voiceQueue','dialCutDigit','number','util','lodash','string','isNil','uniqueid','firstName','Contact','lastName','phone','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0xd065,0x85));var _0x5d06=function(_0x1c9898,_0x25b040){_0x1c9898=_0x1c9898-0x0;var _0x4ece89=_0xd065[_0x1c9898];return _0x4ece89;};'use strict';var util=require(_0x5d06('0x0'));var _=require(_0x5d06('0x1'));var moment=require('moment');function checkNameSurname(_0x495833,_0x169ac3,_0x24f468){var _0x36ad1a='';if(!_['isNil'](_0x169ac3)&&_0x5d06('0x2')===typeof _0x169ac3){_0x36ad1a+=_0x169ac3;}if(!_[_0x5d06('0x3')](_0x24f468)&&'string'===typeof _0x24f468){_0x36ad1a+='\x20'+_0x24f468;}if(_0x36ad1a!==''){return _0x36ad1a;}return _0x495833;}function Action(_0x28fdb8,_0x20a274,_0x3f5656){this['voiceQueue']=_0x28fdb8;this[_0x5d06('0x4')]=_0x3f5656||undefined;this['name']=checkNameSurname(_0x20a274['Contact']['phone'],_0x20a274['Contact'][_0x5d06('0x5')],_0x20a274[_0x5d06('0x6')][_0x5d06('0x7')]);this['number']=_0x20a274[_0x5d06('0x8')];this['queue']=_0x28fdb8[_0x5d06('0x9')];this[_0x5d06('0xa')]=_0x20a274[_0x5d06('0xa')]||![];this['type']=_0x28fdb8[_0x5d06('0xb')];this[_0x5d06('0xc')]=_0x28fdb8[_0x5d06('0xc')]||0x3;this['scheduledat']=_0x20a274[_0x5d06('0xd')];this[_0x5d06('0xe')]=_0x20a274[_0x5d06('0xe')];this[_0x5d06('0xf')]=_0x20a274[_0x5d06('0xf')];this[_0x5d06('0x10')]=_0x20a274['countnoanswerretry'];this[_0x5d06('0x11')]=_0x20a274[_0x5d06('0x11')];this[_0x5d06('0x12')]=_0x20a274[_0x5d06('0x12')];this[_0x5d06('0x13')]=_0x20a274[_0x5d06('0x13')];this['countmachineretry']=_0x20a274[_0x5d06('0x14')];this[_0x5d06('0x15')]=_0x20a274['countagentrejectretry'];this['ContactId']=_0x20a274[_0x5d06('0x16')];this['ListId']=_0x20a274[_0x5d06('0x17')];this[_0x5d06('0x18')]=_0x20a274['UserId'];this['VoiceQueueId']=_0x20a274[_0x5d06('0x19')];this[_0x5d06('0x1a')]=_0x20a274[_0x5d06('0x1a')];this[_0x5d06('0x1b')]=_0x20a274['id'];this[_0x5d06('0x1c')]=_0x20a274['Contact'][_0x5d06('0x5')]||'';this['starttime']=moment()[_0x5d06('0x1d')](_0x5d06('0x1e'));this['callback']=_0x20a274[_0x5d06('0x1f')];this[_0x5d06('0x20')]=_0x20a274[_0x5d06('0x20')];this[_0x5d06('0x21')]=_0x20a274[_0x5d06('0x21')];this['recallme']=_0x20a274['recallme'];this[_0x5d06('0x22')]='';this[_0x5d06('0x23')]='';}Action[_0x5d06('0x24')][_0x5d06('0x25')]=function(){return util[_0x5d06('0x1d')]('\x22%s\x22\x20<%s>',this[_0x5d06('0x9')],this[_0x5d06('0x26')][_0x5d06('0x27')]>0x0?this[_0x5d06('0x28')]['substring'](this['voiceQueue']['dialCutDigit']):this[_0x5d06('0x28')]);};Action[_0x5d06('0x24')]['getQueue']=function(){return this['queue'];};module['exports']=Action; \ No newline at end of file +var _0x2783=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','voiceQueue','dialCutDigit','substring','getQueue','queue','exports','util','lodash','isNil','string','uniqueid','name','Contact','phone','firstName','lastName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry'];(function(_0x3126d3,_0x5cd707){var _0x5c1ef6=function(_0x2ab509){while(--_0x2ab509){_0x3126d3['push'](_0x3126d3['shift']());}};_0x5c1ef6(++_0x5cd707);}(_0x2783,0x17f));var _0x3278=function(_0x117c6d,_0x73db55){_0x117c6d=_0x117c6d-0x0;var _0x365836=_0x2783[_0x117c6d];return _0x365836;};'use strict';var util=require(_0x3278('0x0'));var _=require(_0x3278('0x1'));var moment=require('moment');function checkNameSurname(_0x445553,_0x7e06ab,_0x74c115){var _0x3d296a='';if(!_[_0x3278('0x2')](_0x7e06ab)&&'string'===typeof _0x7e06ab){_0x3d296a+=_0x7e06ab;}if(!_[_0x3278('0x2')](_0x74c115)&&_0x3278('0x3')===typeof _0x74c115){_0x3d296a+='\x20'+_0x74c115;}if(_0x3d296a!==''){return _0x3d296a;}return _0x445553;}function Action(_0xf8831,_0x5f5cfb,_0x36bca5){this['voiceQueue']=_0xf8831;this[_0x3278('0x4')]=_0x36bca5||undefined;this[_0x3278('0x5')]=checkNameSurname(_0x5f5cfb[_0x3278('0x6')][_0x3278('0x7')],_0x5f5cfb['Contact'][_0x3278('0x8')],_0x5f5cfb[_0x3278('0x6')][_0x3278('0x9')]);this[_0x3278('0xa')]=_0x5f5cfb[_0x3278('0x7')];this['queue']=_0xf8831['name'];this[_0x3278('0xb')]=_0x5f5cfb[_0x3278('0xb')]||![];this[_0x3278('0xc')]=_0xf8831[_0x3278('0xc')];this['dialQueueTimeout']=_0xf8831[_0x3278('0xd')]||0x3;this[_0x3278('0xe')]=_0x5f5cfb[_0x3278('0xe')];this[_0x3278('0xf')]=_0x5f5cfb[_0x3278('0xf')];this['countcongestionretry']=_0x5f5cfb['countcongestionretry'];this[_0x3278('0x10')]=_0x5f5cfb[_0x3278('0x10')];this[_0x3278('0x11')]=_0x5f5cfb['countnosuchnumberretry'];this['countdropretry']=_0x5f5cfb[_0x3278('0x12')];this[_0x3278('0x13')]=_0x5f5cfb['countabandonedretry'];this[_0x3278('0x14')]=_0x5f5cfb[_0x3278('0x14')];this[_0x3278('0x15')]=_0x5f5cfb[_0x3278('0x15')];this[_0x3278('0x16')]=_0x5f5cfb[_0x3278('0x16')];this[_0x3278('0x17')]=_0x5f5cfb[_0x3278('0x17')];this['UserId']=_0x5f5cfb[_0x3278('0x18')];this[_0x3278('0x19')]=_0x5f5cfb[_0x3278('0x19')];this[_0x3278('0x1a')]=_0x5f5cfb[_0x3278('0x1a')];this['idHopper']=_0x5f5cfb['id'];this[_0x3278('0x1b')]=_0x5f5cfb['Contact'][_0x3278('0x8')]||'';this[_0x3278('0x1c')]=moment()[_0x3278('0x1d')](_0x3278('0x1e'));this[_0x3278('0x1f')]=_0x5f5cfb[_0x3278('0x1f')];this[_0x3278('0x20')]=_0x5f5cfb[_0x3278('0x20')];this[_0x3278('0x21')]=_0x5f5cfb['callbackat'];this[_0x3278('0x22')]=_0x5f5cfb['recallme'];this[_0x3278('0x23')]='';this[_0x3278('0x24')]='';}Action[_0x3278('0x25')][_0x3278('0x26')]=function(){return util[_0x3278('0x1d')]('\x22%s\x22\x20<%s>',this[_0x3278('0x5')],this[_0x3278('0x27')][_0x3278('0x28')]>0x0?this[_0x3278('0xa')][_0x3278('0x29')](this[_0x3278('0x27')][_0x3278('0x28')]):this[_0x3278('0xa')]);};Action[_0x3278('0x25')][_0x3278('0x2a')]=function(){return this[_0x3278('0x2b')];};module[_0x3278('0x2c')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/additionalPhone.js b/server/services/ami/dialer/additionalPhone.js index a9c2ab5..53f0614 100644 --- a/server/services/ami/dialer/additionalPhone.js +++ b/server/services/ami/dialer/additionalPhone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54ab=['countnosuchnumberretry','name','number','responsetime','endtime','ringtime','starttime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry'];(function(_0x2ca4b6,_0xfd3fbf){var _0x196f25=function(_0x26ad33){while(--_0x26ad33){_0x2ca4b6['push'](_0x2ca4b6['shift']());}};_0x196f25(++_0xfd3fbf);}(_0x54ab,0x64));var _0xb54a=function(_0x52aa1d,_0x2c150f){_0x52aa1d=_0x52aa1d-0x0;var _0x8024f8=_0x54ab[_0x52aa1d];return _0x8024f8;};'use strict';var util=require(_0xb54a('0x0'));var _=require(_0xb54a('0x1'));var moment=require(_0xb54a('0x2'));function getSeconds(_0x5cc4d6,_0x505f9b){var _0x2a7aaa=moment(_0x5cc4d6)[_0xb54a('0x3')](0x0);var _0x1fb134=moment(_0x505f9b)[_0xb54a('0x3')](0x0);return _0x2a7aaa[_0xb54a('0x4')](_0x1fb134,_0xb54a('0x5'));}function AdditionalPhone(_0x55e2f3){this[_0xb54a('0x6')]=_0x55e2f3[_0xb54a('0x6')];this[_0xb54a('0x7')]=_0x55e2f3['scheduledat']||undefined;this[_0xb54a('0x8')]=_0x55e2f3[_0xb54a('0x8')];this[_0xb54a('0x9')]=_0x55e2f3[_0xb54a('0x8')]===_0xb54a('0xa')?_0xb54a('0xb'):_0x55e2f3[_0xb54a('0x8')];this[_0xb54a('0xc')]=_0x55e2f3[_0xb54a('0xc')];this[_0xb54a('0xd')]=_0x55e2f3[_0xb54a('0xd')];this[_0xb54a('0xe')]=_0x55e2f3[_0xb54a('0xe')];this[_0xb54a('0xf')]=_0x55e2f3[_0xb54a('0xc')]+_0x55e2f3[_0xb54a('0xd')]+_0x55e2f3['countnoanswerretry']+_0x55e2f3['countnosuchnumberretry']+_0x55e2f3[_0xb54a('0x10')]+_0x55e2f3[_0xb54a('0x11')]+_0x55e2f3[_0xb54a('0x12')]+_0x55e2f3[_0xb54a('0x13')];this[_0xb54a('0x14')]=_0x55e2f3['countnosuchnumberretry'];this[_0xb54a('0x10')]=_0x55e2f3['countdropretry'];this[_0xb54a('0x11')]=_0x55e2f3[_0xb54a('0x11')];this[_0xb54a('0x12')]=_0x55e2f3[_0xb54a('0x12')];this[_0xb54a('0x13')]=_0x55e2f3[_0xb54a('0x13')];this[_0xb54a('0xb')]=_0x55e2f3['queue'];this['calleridname']=_0x55e2f3[_0xb54a('0x15')];this['calleridnum']=_0x55e2f3[_0xb54a('0x16')];this['starttime']=_0x55e2f3['starttime'];this[_0xb54a('0x17')]=_0x55e2f3['responsetime'];this[_0xb54a('0x18')]=_0x55e2f3['responsetime'];this[_0xb54a('0x19')]=getSeconds(_0x55e2f3[_0xb54a('0x17')],_0x55e2f3[_0xb54a('0x1a')]);this[_0xb54a('0x1b')]=0x0;this[_0xb54a('0x1c')]=0x0;this[_0xb54a('0x1d')]=_0x55e2f3[_0xb54a('0x1d')];this[_0xb54a('0x1e')]=_0x55e2f3['callbackuniqueid'];this[_0xb54a('0x1f')]=_0x55e2f3[_0xb54a('0x1f')];this[_0xb54a('0x20')]=_0x55e2f3[_0xb54a('0x20')];this[_0xb54a('0x21')]=_0x55e2f3[_0xb54a('0x21')];this[_0xb54a('0x22')]=_0x55e2f3['ListId'];this['UserId']=_0x55e2f3['UserId'];this[_0xb54a('0x23')]=_0x55e2f3[_0xb54a('0x23')];this[_0xb54a('0x24')]=_0x55e2f3[_0xb54a('0x24')];this[_0xb54a('0x25')]=_0x55e2f3[_0xb54a('0x25')]||'';this[_0xb54a('0x26')]=_0x55e2f3[_0xb54a('0x26')]||'';}module[_0xb54a('0x27')]=History; \ No newline at end of file +var _0x37aa=['ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','talktime','callback','callbackuniqueid','callbackat','ContactId'];(function(_0x59eb00,_0x42235a){var _0x7a3e1b=function(_0x531b8d){while(--_0x531b8d){_0x59eb00['push'](_0x59eb00['shift']());}};_0x7a3e1b(++_0x42235a);}(_0x37aa,0xf7));var _0xa37a=function(_0x58c20f,_0x4cdb1b){_0x58c20f=_0x58c20f-0x0;var _0x3b0318=_0x37aa[_0x58c20f];return _0x3b0318;};'use strict';var util=require(_0xa37a('0x0'));var _=require(_0xa37a('0x1'));var moment=require(_0xa37a('0x2'));function getSeconds(_0x530359,_0x1058bb){var _0x5aab5f=moment(_0x530359)[_0xa37a('0x3')](0x0);var _0x475523=moment(_0x1058bb)[_0xa37a('0x3')](0x0);return _0x5aab5f[_0xa37a('0x4')](_0x475523,_0xa37a('0x5'));}function AdditionalPhone(_0x5c7973){this[_0xa37a('0x6')]=_0x5c7973[_0xa37a('0x6')];this['scheduledat']=_0x5c7973[_0xa37a('0x7')]||undefined;this[_0xa37a('0x8')]=_0x5c7973['type'];this['campaigntype']=_0x5c7973[_0xa37a('0x8')]===_0xa37a('0x9')?_0xa37a('0xa'):_0x5c7973['type'];this[_0xa37a('0xb')]=_0x5c7973[_0xa37a('0xb')];this['countcongestionretry']=_0x5c7973[_0xa37a('0xc')];this['countnoanswerretry']=_0x5c7973[_0xa37a('0xd')];this[_0xa37a('0xe')]=_0x5c7973[_0xa37a('0xb')]+_0x5c7973[_0xa37a('0xc')]+_0x5c7973['countnoanswerretry']+_0x5c7973[_0xa37a('0xf')]+_0x5c7973[_0xa37a('0x10')]+_0x5c7973['countabandonedretry']+_0x5c7973[_0xa37a('0x11')]+_0x5c7973[_0xa37a('0x12')];this[_0xa37a('0xf')]=_0x5c7973[_0xa37a('0xf')];this[_0xa37a('0x10')]=_0x5c7973[_0xa37a('0x10')];this[_0xa37a('0x13')]=_0x5c7973[_0xa37a('0x13')];this[_0xa37a('0x11')]=_0x5c7973['countmachineretry'];this['countagentrejectretry']=_0x5c7973['countagentrejectretry'];this[_0xa37a('0xa')]=_0x5c7973['queue'];this[_0xa37a('0x14')]=_0x5c7973[_0xa37a('0x15')];this[_0xa37a('0x16')]=_0x5c7973[_0xa37a('0x17')];this['starttime']=_0x5c7973[_0xa37a('0x18')];this[_0xa37a('0x19')]=_0x5c7973[_0xa37a('0x19')];this[_0xa37a('0x1a')]=_0x5c7973[_0xa37a('0x19')];this[_0xa37a('0x1b')]=getSeconds(_0x5c7973[_0xa37a('0x19')],_0x5c7973[_0xa37a('0x18')]);this['holdtime']=0x0;this[_0xa37a('0x1c')]=0x0;this['callback']=_0x5c7973[_0xa37a('0x1d')];this[_0xa37a('0x1e')]=_0x5c7973[_0xa37a('0x1e')];this['callbackat']=_0x5c7973[_0xa37a('0x1f')];this['recallme']=_0x5c7973['recallme'];this[_0xa37a('0x20')]=_0x5c7973['ContactId'];this[_0xa37a('0x21')]=_0x5c7973[_0xa37a('0x21')];this[_0xa37a('0x22')]=_0x5c7973['UserId'];this[_0xa37a('0x23')]=_0x5c7973[_0xa37a('0x23')];this[_0xa37a('0x24')]=_0x5c7973[_0xa37a('0x24')];this[_0xa37a('0x25')]=_0x5c7973[_0xa37a('0x25')]||'';this[_0xa37a('0x26')]=_0x5c7973[_0xa37a('0x26')]||'';}module[_0xa37a('0x27')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index f2d86ac..f4eacaf 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 _0x976c=['ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','seconds','state','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','number','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4db470,_0x4fb527){var _0x54488a=function(_0x471930){while(--_0x471930){_0x4db470['push'](_0x4db470['shift']());}};_0x54488a(++_0x4fb527);}(_0x976c,0xb8));var _0xc976=function(_0x5aa81b,_0x1f24a0){_0x5aa81b=_0x5aa81b-0x0;var _0x14b066=_0x976c[_0x5aa81b];return _0x14b066;};'use strict';var util=require(_0xc976('0x0'));var _=require(_0xc976('0x1'));var moment=require('moment');function getSeconds(_0x3c3598,_0x4176b2){var _0x8bcd0c=moment(_0x3c3598)[_0xc976('0x2')](0x0);var _0x2a7445=moment(_0x4176b2)[_0xc976('0x2')](0x0);return _0x8bcd0c['diff'](_0x2a7445,_0xc976('0x3'));}function AgentComplete(_0x3c55d6,_0x3a7963){this[_0xc976('0x4')]=0x4;this['statedesc']='Answer';this[_0xc976('0x5')]=_0x3c55d6[_0xc976('0x5')];this[_0xc976('0x6')]=_0x3c55d6[_0xc976('0x6')];this[_0xc976('0x7')]=_0x3c55d6['type']===_0xc976('0x8')?_0xc976('0x9'):_0x3c55d6[_0xc976('0x6')];this[_0xc976('0xa')]=_0x3c55d6[_0xc976('0xa')];this[_0xc976('0xb')]=_0x3c55d6[_0xc976('0xb')];this['countnoanswerretry']=_0x3c55d6['countnoanswerretry'];this[_0xc976('0xc')]=_0x3c55d6[_0xc976('0xa')]+_0x3c55d6[_0xc976('0xb')]+_0x3c55d6['countnoanswerretry']+_0x3c55d6[_0xc976('0xd')]+_0x3c55d6[_0xc976('0xe')]+_0x3c55d6[_0xc976('0xf')]+_0x3c55d6[_0xc976('0x10')]+_0x3c55d6[_0xc976('0x11')];this[_0xc976('0xd')]=_0x3c55d6['countnosuchnumberretry'];this[_0xc976('0xe')]=_0x3c55d6[_0xc976('0xe')];this[_0xc976('0xf')]=_0x3c55d6['countabandonedretry'];this[_0xc976('0x10')]=_0x3c55d6[_0xc976('0x10')];this[_0xc976('0x11')]=_0x3c55d6[_0xc976('0x11')];this['uniqueid']=_0x3a7963['uniqueid'];this[_0xc976('0x12')]=_0x3c55d6['name'];this[_0xc976('0x13')]=_0x3c55d6[_0xc976('0x14')];this[_0xc976('0x15')]=_0x3c55d6['starttime'];this[_0xc976('0x16')]=_0x3c55d6[_0xc976('0x16')];this['answertime']=_0x3c55d6[_0xc976('0x17')];this[_0xc976('0x18')]=moment()['format'](_0xc976('0x19'));this[_0xc976('0x1a')]=getSeconds(_0x3c55d6[_0xc976('0x16')],_0x3c55d6[_0xc976('0x15')]);this[_0xc976('0x1b')]=getSeconds(_0x3c55d6[_0xc976('0x17')],_0x3c55d6['responsetime']);this[_0xc976('0x1c')]=getSeconds(this[_0xc976('0x18')],_0x3c55d6[_0xc976('0x17')]);this[_0xc976('0x9')]=_0x3a7963['queue'];this['membername']=_0x3a7963[_0xc976('0x1d')];this[_0xc976('0x1e')]=_0x3a7963[_0xc976('0x1e')];this[_0xc976('0x1f')]=_0x3c55d6['callback'];this['callbackuniqueid']=_0x3c55d6[_0xc976('0x20')];this[_0xc976('0x21')]=_0x3c55d6[_0xc976('0x21')];this[_0xc976('0x22')]=_0x3c55d6['recallme'];this[_0xc976('0x23')]=_0x3c55d6[_0xc976('0x23')];this[_0xc976('0x24')]=_0x3c55d6[_0xc976('0x24')];this[_0xc976('0x25')]=_0x3c55d6['UserId'];this['VoiceQueueId']=_0x3c55d6['VoiceQueueId'];this[_0xc976('0x26')]=_0x3c55d6[_0xc976('0x26')];this[_0xc976('0x27')]=_0x3c55d6[_0xc976('0x27')]||'';this[_0xc976('0x28')]=_0x3c55d6['originatecalleridname']||'';}module[_0xc976('0x29')]=AgentComplete; \ No newline at end of file +var _0x561c=['CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','statedesc','Answer','scheduledat','campaigntype','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime','endtime','membername','reason','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x389832,_0x10a4a9){var _0x59429e=function(_0x5f3562){while(--_0x5f3562){_0x389832['push'](_0x389832['shift']());}};_0x59429e(++_0x10a4a9);}(_0x561c,0x164));var _0xc561=function(_0x3eeda3,_0x44105c){_0x3eeda3=_0x3eeda3-0x0;var _0x3131d4=_0x561c[_0x3eeda3];return _0x3131d4;};'use strict';var util=require('util');var _=require(_0xc561('0x0'));var moment=require(_0xc561('0x1'));function getSeconds(_0x5729dd,_0x42e8c6){var _0x8ee8db=moment(_0x5729dd)[_0xc561('0x2')](0x0);var _0xfd4b70=moment(_0x42e8c6)[_0xc561('0x2')](0x0);return _0x8ee8db['diff'](_0xfd4b70,'seconds');}function AgentComplete(_0x81dede,_0x1b8a9c){this['state']=0x4;this[_0xc561('0x3')]=_0xc561('0x4');this['scheduledat']=_0x81dede[_0xc561('0x5')];this['type']=_0x81dede['type'];this[_0xc561('0x6')]=_0x81dede[_0xc561('0x7')]===_0xc561('0x8')?_0xc561('0x9'):_0x81dede['type'];this['countbusyretry']=_0x81dede[_0xc561('0xa')];this['countcongestionretry']=_0x81dede[_0xc561('0xb')];this[_0xc561('0xc')]=_0x81dede[_0xc561('0xc')];this['countglobal']=_0x81dede[_0xc561('0xa')]+_0x81dede[_0xc561('0xb')]+_0x81dede[_0xc561('0xc')]+_0x81dede[_0xc561('0xd')]+_0x81dede[_0xc561('0xe')]+_0x81dede[_0xc561('0xf')]+_0x81dede[_0xc561('0x10')]+_0x81dede[_0xc561('0x11')];this[_0xc561('0xd')]=_0x81dede[_0xc561('0xd')];this[_0xc561('0xe')]=_0x81dede['countdropretry'];this[_0xc561('0xf')]=_0x81dede[_0xc561('0xf')];this[_0xc561('0x10')]=_0x81dede[_0xc561('0x10')];this[_0xc561('0x11')]=_0x81dede[_0xc561('0x11')];this[_0xc561('0x12')]=_0x1b8a9c[_0xc561('0x12')];this[_0xc561('0x13')]=_0x81dede[_0xc561('0x14')];this[_0xc561('0x15')]=_0x81dede[_0xc561('0x16')];this[_0xc561('0x17')]=_0x81dede[_0xc561('0x17')];this[_0xc561('0x18')]=_0x81dede['responsetime'];this[_0xc561('0x19')]=_0x81dede[_0xc561('0x19')];this['endtime']=moment()[_0xc561('0x1a')](_0xc561('0x1b'));this['ringtime']=getSeconds(_0x81dede[_0xc561('0x18')],_0x81dede[_0xc561('0x17')]);this[_0xc561('0x1c')]=getSeconds(_0x81dede[_0xc561('0x19')],_0x81dede[_0xc561('0x18')]);this[_0xc561('0x1d')]=getSeconds(this[_0xc561('0x1e')],_0x81dede[_0xc561('0x19')]);this[_0xc561('0x9')]=_0x1b8a9c[_0xc561('0x9')];this[_0xc561('0x1f')]=_0x1b8a9c[_0xc561('0x1f')];this['reason']=_0x1b8a9c[_0xc561('0x20')];this[_0xc561('0x21')]=_0x81dede[_0xc561('0x21')];this[_0xc561('0x22')]=_0x81dede['callbackuniqueid'];this['callbackat']=_0x81dede['callbackat'];this['recallme']=_0x81dede[_0xc561('0x23')];this[_0xc561('0x24')]=_0x81dede[_0xc561('0x24')];this['ListId']=_0x81dede[_0xc561('0x25')];this[_0xc561('0x26')]=_0x81dede[_0xc561('0x26')];this[_0xc561('0x27')]=_0x81dede[_0xc561('0x27')];this['CampaignId']=_0x81dede[_0xc561('0x28')];this['originatecalleridnum']=_0x81dede[_0xc561('0x29')]||'';this[_0xc561('0x2a')]=_0x81dede['originatecalleridname']||'';}module[_0xc561('0x2b')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index faf67c1..98f545c 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 _0x81bd=['CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x53e787,_0x4298e6){var _0x2781a0=function(_0x21f861){while(--_0x21f861){_0x53e787['push'](_0x53e787['shift']());}};_0x2781a0(++_0x4298e6);}(_0x81bd,0x7c));var _0xd81b=function(_0x3fb5a8,_0x57d3f6){_0x3fb5a8=_0x3fb5a8-0x0;var _0x519841=_0x81bd[_0x3fb5a8];return _0x519841;};'use strict';var util=require(_0xd81b('0x0'));var _=require(_0xd81b('0x1'));var moment=require(_0xd81b('0x2'));function getSeconds(_0x2337b1,_0x2d27cb){var _0x2ec03a=moment(_0x2337b1)[_0xd81b('0x3')](0x0);var _0x54e096=moment(_0x2d27cb)[_0xd81b('0x3')](0x0);return _0x2ec03a[_0xd81b('0x4')](_0x54e096,_0xd81b('0x5'));}function Final(_0x4d8e7e){this[_0xd81b('0x6')]=_0x4d8e7e[_0xd81b('0x6')];this[_0xd81b('0x7')]=_0x4d8e7e['scheduledat'];this['type']=_0x4d8e7e[_0xd81b('0x8')];this['campaigntype']=_0x4d8e7e[_0xd81b('0x8')]===_0xd81b('0x9')?_0xd81b('0xa'):_0x4d8e7e[_0xd81b('0x8')];this[_0xd81b('0xb')]=_0x4d8e7e[_0xd81b('0xb')];this[_0xd81b('0xc')]=_0x4d8e7e[_0xd81b('0xc')];this[_0xd81b('0xd')]=_0x4d8e7e[_0xd81b('0xd')];this[_0xd81b('0xe')]=_0x4d8e7e[_0xd81b('0xb')]+_0x4d8e7e[_0xd81b('0xc')]+_0x4d8e7e['countnoanswerretry']+_0x4d8e7e[_0xd81b('0xf')]+_0x4d8e7e['countdropretry']+_0x4d8e7e[_0xd81b('0x10')]+_0x4d8e7e[_0xd81b('0x11')]+_0x4d8e7e['countagentrejectretry'];this[_0xd81b('0xf')]=_0x4d8e7e['countnosuchnumberretry'];this[_0xd81b('0x12')]=_0x4d8e7e[_0xd81b('0x12')];this[_0xd81b('0x10')]=_0x4d8e7e[_0xd81b('0x10')];this[_0xd81b('0x11')]=_0x4d8e7e['countmachineretry'];this[_0xd81b('0x13')]=_0x4d8e7e[_0xd81b('0x13')];this['queue']=_0x4d8e7e[_0xd81b('0xa')];this[_0xd81b('0x14')]=_0x4d8e7e[_0xd81b('0x14')];this[_0xd81b('0x15')]=_0x4d8e7e[_0xd81b('0x15')];this[_0xd81b('0x16')]=_0x4d8e7e[_0xd81b('0x16')];this[_0xd81b('0x17')]=_0x4d8e7e[_0xd81b('0x17')];this[_0xd81b('0x18')]=_0x4d8e7e[_0xd81b('0x17')];this[_0xd81b('0x19')]=_0x4d8e7e[_0xd81b('0x19')]||0x0;this[_0xd81b('0x1a')]=_0x4d8e7e[_0xd81b('0x1a')]||0x0;this[_0xd81b('0x1b')]=_0x4d8e7e['talktime']||0x0;this['callback']=_0x4d8e7e[_0xd81b('0x1c')];this[_0xd81b('0x1d')]=_0x4d8e7e[_0xd81b('0x1d')];this['callbackat']=_0x4d8e7e[_0xd81b('0x1e')];this[_0xd81b('0x1f')]=_0x4d8e7e['recallme'];this[_0xd81b('0x20')]=_0x4d8e7e[_0xd81b('0x20')];this[_0xd81b('0x21')]=_0x4d8e7e[_0xd81b('0x21')];this[_0xd81b('0x22')]=_0x4d8e7e[_0xd81b('0x22')];this[_0xd81b('0x23')]=_0x4d8e7e[_0xd81b('0x23')];this[_0xd81b('0x24')]=_0x4d8e7e[_0xd81b('0x24')];this[_0xd81b('0x25')]=_0x4d8e7e[_0xd81b('0x25')]||'';this['originatecalleridname']=_0x4d8e7e[_0xd81b('0x26')]||'';}module[_0xd81b('0x27')]=Final; \ No newline at end of file +var _0x5ad3=['holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','queue','calleridname','calleridnum','starttime','responsetime','endtime'];(function(_0x40bdb3,_0x5a81f2){var _0xeac086=function(_0x199fba){while(--_0x199fba){_0x40bdb3['push'](_0x40bdb3['shift']());}};_0xeac086(++_0x5a81f2);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x16de68,_0x33d7ff){_0x16de68=_0x16de68-0x0;var _0x1c277e=_0x5ad3[_0x16de68];return _0x1c277e;};'use strict';var util=require(_0x35ad('0x0'));var _=require(_0x35ad('0x1'));var moment=require(_0x35ad('0x2'));function getSeconds(_0x2a45b7,_0x5543d1){var _0x468072=moment(_0x2a45b7)[_0x35ad('0x3')](0x0);var _0xc77352=moment(_0x5543d1)[_0x35ad('0x3')](0x0);return _0x468072[_0x35ad('0x4')](_0xc77352,_0x35ad('0x5'));}function Final(_0x729a01){this[_0x35ad('0x6')]=_0x729a01[_0x35ad('0x6')];this[_0x35ad('0x7')]=_0x729a01['scheduledat'];this[_0x35ad('0x8')]=_0x729a01[_0x35ad('0x8')];this[_0x35ad('0x9')]=_0x729a01['type']===_0x35ad('0xa')?'queue':_0x729a01['type'];this[_0x35ad('0xb')]=_0x729a01[_0x35ad('0xb')];this['countcongestionretry']=_0x729a01[_0x35ad('0xc')];this[_0x35ad('0xd')]=_0x729a01['countnoanswerretry'];this['countglobal']=_0x729a01[_0x35ad('0xb')]+_0x729a01[_0x35ad('0xc')]+_0x729a01['countnoanswerretry']+_0x729a01[_0x35ad('0xe')]+_0x729a01[_0x35ad('0xf')]+_0x729a01['countabandonedretry']+_0x729a01['countmachineretry']+_0x729a01[_0x35ad('0x10')];this[_0x35ad('0xe')]=_0x729a01[_0x35ad('0xe')];this['countdropretry']=_0x729a01[_0x35ad('0xf')];this[_0x35ad('0x11')]=_0x729a01['countabandonedretry'];this[_0x35ad('0x12')]=_0x729a01['countmachineretry'];this['countagentrejectretry']=_0x729a01[_0x35ad('0x10')];this[_0x35ad('0x13')]=_0x729a01[_0x35ad('0x13')];this['calleridname']=_0x729a01[_0x35ad('0x14')];this[_0x35ad('0x15')]=_0x729a01[_0x35ad('0x15')];this[_0x35ad('0x16')]=_0x729a01[_0x35ad('0x16')];this[_0x35ad('0x17')]=_0x729a01['responsetime'];this[_0x35ad('0x18')]=_0x729a01[_0x35ad('0x17')];this['ringtime']=_0x729a01['ringtime']||0x0;this[_0x35ad('0x19')]=_0x729a01[_0x35ad('0x19')]||0x0;this['talktime']=_0x729a01[_0x35ad('0x1a')]||0x0;this[_0x35ad('0x1b')]=_0x729a01['callback'];this[_0x35ad('0x1c')]=_0x729a01[_0x35ad('0x1c')];this[_0x35ad('0x1d')]=_0x729a01[_0x35ad('0x1d')];this[_0x35ad('0x1e')]=_0x729a01[_0x35ad('0x1e')];this[_0x35ad('0x1f')]=_0x729a01[_0x35ad('0x1f')];this[_0x35ad('0x20')]=_0x729a01[_0x35ad('0x20')];this['UserId']=_0x729a01[_0x35ad('0x21')];this[_0x35ad('0x22')]=_0x729a01['VoiceQueueId'];this[_0x35ad('0x23')]=_0x729a01[_0x35ad('0x23')];this[_0x35ad('0x24')]=_0x729a01[_0x35ad('0x24')]||'';this[_0x35ad('0x25')]=_0x729a01['originatecalleridname']||'';}module[_0x35ad('0x26')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index eb4ac40..3bc5d94 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 _0x64f0=['ringtime','holdtime','talktime','IVR','reason','cause-txt','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','exports','util','lodash','milliseconds','seconds','state','statedesc','Answer','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x914ea4,_0x5d3045){var _0x1de3cc=function(_0x161e15){while(--_0x161e15){_0x914ea4['push'](_0x914ea4['shift']());}};_0x1de3cc(++_0x5d3045);}(_0x64f0,0x110));var _0x064f=function(_0x2f4c1c,_0x5a3dd4){_0x2f4c1c=_0x2f4c1c-0x0;var _0x25e0f2=_0x64f0[_0x2f4c1c];return _0x25e0f2;};'use strict';var util=require(_0x064f('0x0'));var _=require(_0x064f('0x1'));var moment=require('moment');function getSeconds(_0x19d5b4,_0x1b591f){var _0xfee014=moment(_0x19d5b4)[_0x064f('0x2')](0x0);var _0x1b9881=moment(_0x1b591f)['milliseconds'](0x0);return _0xfee014['diff'](_0x1b9881,_0x064f('0x3'));}function Hangup(_0x3fd0d9,_0x17b255){this[_0x064f('0x4')]=0x4;this[_0x064f('0x5')]=_0x064f('0x6');this['scheduledat']=_0x3fd0d9['scheduledat'];this['type']=_0x3fd0d9[_0x064f('0x7')];this['campaigntype']=_0x3fd0d9[_0x064f('0x7')]===_0x064f('0x8')?_0x064f('0x9'):_0x3fd0d9['type'];this[_0x064f('0xa')]=_0x3fd0d9[_0x064f('0xa')];this['countcongestionretry']=_0x3fd0d9[_0x064f('0xb')];this[_0x064f('0xc')]=_0x3fd0d9['countnoanswerretry'];this[_0x064f('0xd')]=_0x3fd0d9['countbusyretry']+_0x3fd0d9['countcongestionretry']+_0x3fd0d9[_0x064f('0xc')]+_0x3fd0d9[_0x064f('0xe')]+_0x3fd0d9[_0x064f('0xf')]+_0x3fd0d9['countabandonedretry']+_0x3fd0d9[_0x064f('0x10')]+_0x3fd0d9['countagentrejectretry'];this['countnosuchnumberretry']=_0x3fd0d9[_0x064f('0xe')];this[_0x064f('0xf')]=_0x3fd0d9[_0x064f('0xf')];this['countabandonedretry']=_0x3fd0d9[_0x064f('0x11')];this[_0x064f('0x10')]=_0x3fd0d9[_0x064f('0x10')];this[_0x064f('0x12')]=_0x3fd0d9['countagentrejectretry'];this['uniqueid']=_0x17b255[_0x064f('0x13')];this[_0x064f('0x14')]=_0x3fd0d9[_0x064f('0x15')];this[_0x064f('0x16')]=_0x3fd0d9[_0x064f('0x17')];this[_0x064f('0x18')]=_0x3fd0d9[_0x064f('0x18')];this['responsetime']=_0x3fd0d9[_0x064f('0x19')];this[_0x064f('0x1a')]=moment()[_0x064f('0x1b')](_0x064f('0x1c'));this[_0x064f('0x1d')]=getSeconds(_0x3fd0d9[_0x064f('0x19')],_0x3fd0d9[_0x064f('0x18')]);this[_0x064f('0x1e')]=0x0;this[_0x064f('0x1f')]=getSeconds(this['endtime'],_0x3fd0d9['responsetime']);this['queue']=_0x3fd0d9['queue'];this['membername']=_0x064f('0x20');this[_0x064f('0x21')]=_0x17b255[_0x064f('0x22')];this['callback']=_0x3fd0d9['callback'];this[_0x064f('0x23')]=_0x3fd0d9[_0x064f('0x23')];this[_0x064f('0x24')]=_0x3fd0d9[_0x064f('0x24')];this['recallme']=_0x3fd0d9[_0x064f('0x25')];this['ContactId']=_0x3fd0d9[_0x064f('0x26')];this[_0x064f('0x27')]=_0x3fd0d9[_0x064f('0x27')];this[_0x064f('0x28')]=_0x3fd0d9[_0x064f('0x28')];this[_0x064f('0x29')]=_0x3fd0d9[_0x064f('0x29')];this['CampaignId']=_0x3fd0d9['CampaignId'];}module[_0x064f('0x2a')]=Hangup; \ No newline at end of file +var _0x3bb1=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','seconds','state','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','responsetime','holdtime','talktime','membername','IVR','cause-txt','callback','callbackuniqueid'];(function(_0x58c30a,_0x2dcd61){var _0x39950c=function(_0x24a6db){while(--_0x24a6db){_0x58c30a['push'](_0x58c30a['shift']());}};_0x39950c(++_0x2dcd61);}(_0x3bb1,0xbc));var _0x13bb=function(_0x2508a2,_0x401221){_0x2508a2=_0x2508a2-0x0;var _0x2fce13=_0x3bb1[_0x2508a2];return _0x2fce13;};'use strict';var util=require(_0x13bb('0x0'));var _=require(_0x13bb('0x1'));var moment=require(_0x13bb('0x2'));function getSeconds(_0x53f6d1,_0x39b0c7){var _0x10fa8f=moment(_0x53f6d1)[_0x13bb('0x3')](0x0);var _0x285a76=moment(_0x39b0c7)['milliseconds'](0x0);return _0x10fa8f['diff'](_0x285a76,_0x13bb('0x4'));}function Hangup(_0x1ee310,_0x37b8ba){this[_0x13bb('0x5')]=0x4;this[_0x13bb('0x6')]='Answer';this[_0x13bb('0x7')]=_0x1ee310[_0x13bb('0x7')];this[_0x13bb('0x8')]=_0x1ee310['type'];this[_0x13bb('0x9')]=_0x1ee310[_0x13bb('0x8')]===_0x13bb('0xa')?_0x13bb('0xb'):_0x1ee310['type'];this[_0x13bb('0xc')]=_0x1ee310[_0x13bb('0xc')];this[_0x13bb('0xd')]=_0x1ee310[_0x13bb('0xd')];this[_0x13bb('0xe')]=_0x1ee310[_0x13bb('0xe')];this[_0x13bb('0xf')]=_0x1ee310[_0x13bb('0xc')]+_0x1ee310[_0x13bb('0xd')]+_0x1ee310[_0x13bb('0xe')]+_0x1ee310[_0x13bb('0x10')]+_0x1ee310[_0x13bb('0x11')]+_0x1ee310[_0x13bb('0x12')]+_0x1ee310[_0x13bb('0x13')]+_0x1ee310['countagentrejectretry'];this[_0x13bb('0x10')]=_0x1ee310[_0x13bb('0x10')];this[_0x13bb('0x11')]=_0x1ee310[_0x13bb('0x11')];this['countabandonedretry']=_0x1ee310[_0x13bb('0x12')];this[_0x13bb('0x13')]=_0x1ee310[_0x13bb('0x13')];this[_0x13bb('0x14')]=_0x1ee310[_0x13bb('0x14')];this[_0x13bb('0x15')]=_0x37b8ba['uniqueid'];this[_0x13bb('0x16')]=_0x1ee310[_0x13bb('0x17')];this[_0x13bb('0x18')]=_0x1ee310['number'];this[_0x13bb('0x19')]=_0x1ee310[_0x13bb('0x19')];this['responsetime']=_0x1ee310['responsetime'];this[_0x13bb('0x1a')]=moment()['format'](_0x13bb('0x1b'));this[_0x13bb('0x1c')]=getSeconds(_0x1ee310[_0x13bb('0x1d')],_0x1ee310[_0x13bb('0x19')]);this[_0x13bb('0x1e')]=0x0;this[_0x13bb('0x1f')]=getSeconds(this[_0x13bb('0x1a')],_0x1ee310[_0x13bb('0x1d')]);this[_0x13bb('0xb')]=_0x1ee310[_0x13bb('0xb')];this[_0x13bb('0x20')]=_0x13bb('0x21');this['reason']=_0x37b8ba[_0x13bb('0x22')];this[_0x13bb('0x23')]=_0x1ee310['callback'];this[_0x13bb('0x24')]=_0x1ee310[_0x13bb('0x24')];this[_0x13bb('0x25')]=_0x1ee310[_0x13bb('0x25')];this[_0x13bb('0x26')]=_0x1ee310[_0x13bb('0x26')];this[_0x13bb('0x27')]=_0x1ee310[_0x13bb('0x27')];this[_0x13bb('0x28')]=_0x1ee310[_0x13bb('0x28')];this['UserId']=_0x1ee310[_0x13bb('0x29')];this[_0x13bb('0x2a')]=_0x1ee310[_0x13bb('0x2a')];this[_0x13bb('0x2b')]=_0x1ee310['CampaignId'];}module[_0x13bb('0x2c')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 15bbd7c..32cf21e 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 _0xc4fa=['queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','exports','util','lodash','moment','milliseconds','diff','uniqueid','type','outbound'];(function(_0x339c87,_0x3ae7be){var _0x9ca4fc=function(_0x21d89e){while(--_0x21d89e){_0x339c87['push'](_0x339c87['shift']());}};_0x9ca4fc(++_0x3ae7be);}(_0xc4fa,0x1e6));var _0xac4f=function(_0x4deb98,_0x29ebdd){_0x4deb98=_0x4deb98-0x0;var _0x2c5f93=_0xc4fa[_0x4deb98];return _0x2c5f93;};'use strict';var util=require(_0xac4f('0x0'));var _=require(_0xac4f('0x1'));var moment=require(_0xac4f('0x2'));function getSeconds(_0x4ee231,_0x4fe7b6){var _0x59604b=moment(_0x4ee231)[_0xac4f('0x3')](0x0);var _0x2672d9=moment(_0x4fe7b6)[_0xac4f('0x3')](0x0);return _0x59604b[_0xac4f('0x4')](_0x2672d9,'seconds');}function History(_0x44b159){this[_0xac4f('0x5')]=_0x44b159[_0xac4f('0x5')];this['scheduledat']=_0x44b159['scheduledat']||undefined;this[_0xac4f('0x6')]=_0x44b159[_0xac4f('0x6')];this['campaigntype']=_0x44b159[_0xac4f('0x6')]===_0xac4f('0x7')?_0xac4f('0x8'):_0x44b159[_0xac4f('0x6')];this[_0xac4f('0x9')]=_0x44b159[_0xac4f('0x9')];this[_0xac4f('0xa')]=_0x44b159['countcongestionretry'];this['countnoanswerretry']=_0x44b159[_0xac4f('0xb')];this[_0xac4f('0xc')]=_0x44b159[_0xac4f('0x9')]+_0x44b159[_0xac4f('0xa')]+_0x44b159[_0xac4f('0xb')]+_0x44b159['countnosuchnumberretry']+_0x44b159[_0xac4f('0xd')]+_0x44b159[_0xac4f('0xe')]+_0x44b159[_0xac4f('0xf')]+_0x44b159[_0xac4f('0x10')];this[_0xac4f('0x11')]=_0x44b159[_0xac4f('0x11')];this[_0xac4f('0xd')]=_0x44b159['countdropretry'];this['countabandonedretry']=_0x44b159[_0xac4f('0xe')];this[_0xac4f('0xf')]=_0x44b159[_0xac4f('0xf')];this[_0xac4f('0x10')]=_0x44b159[_0xac4f('0x10')];this[_0xac4f('0x8')]=_0x44b159['queue'];this[_0xac4f('0x12')]=_0x44b159[_0xac4f('0x13')];this[_0xac4f('0x14')]=_0x44b159[_0xac4f('0x15')];this[_0xac4f('0x16')]=_0x44b159[_0xac4f('0x16')];this[_0xac4f('0x17')]=_0x44b159['responsetime'];this[_0xac4f('0x18')]=_0x44b159[_0xac4f('0x17')];this[_0xac4f('0x19')]=getSeconds(_0x44b159[_0xac4f('0x17')],_0x44b159[_0xac4f('0x16')]);this[_0xac4f('0x1a')]=0x0;this['talktime']=0x0;this[_0xac4f('0x1b')]=_0x44b159[_0xac4f('0x1b')];this[_0xac4f('0x1c')]=_0x44b159['callbackuniqueid'];this[_0xac4f('0x1d')]=_0x44b159[_0xac4f('0x1d')];this[_0xac4f('0x1e')]=_0x44b159[_0xac4f('0x1e')];this[_0xac4f('0x1f')]=_0x44b159[_0xac4f('0x1f')];this[_0xac4f('0x20')]=_0x44b159[_0xac4f('0x20')];this[_0xac4f('0x21')]=_0x44b159[_0xac4f('0x21')];this[_0xac4f('0x22')]=_0x44b159['VoiceQueueId'];this[_0xac4f('0x23')]=_0x44b159[_0xac4f('0x23')];this[_0xac4f('0x24')]=_0x44b159[_0xac4f('0x24')]||'';this['originatecalleridname']=_0x44b159['originatecalleridname']||'';}module[_0xac4f('0x25')]=History; \ No newline at end of file +var _0x721e=['type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','queue','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat'];(function(_0x51cf63,_0x303401){var _0x86ff61=function(_0x16a214){while(--_0x16a214){_0x51cf63['push'](_0x51cf63['shift']());}};_0x86ff61(++_0x303401);}(_0x721e,0x188));var _0xe721=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x721e[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xe721('0x0'));var _=require(_0xe721('0x1'));var moment=require(_0xe721('0x2'));function getSeconds(_0x26b28a,_0x119a6e){var _0x1735f5=moment(_0x26b28a)[_0xe721('0x3')](0x0);var _0x1aee1c=moment(_0x119a6e)[_0xe721('0x3')](0x0);return _0x1735f5[_0xe721('0x4')](_0x1aee1c,_0xe721('0x5'));}function History(_0x1a609b){this['uniqueid']=_0x1a609b[_0xe721('0x6')];this[_0xe721('0x7')]=_0x1a609b['scheduledat']||undefined;this[_0xe721('0x8')]=_0x1a609b[_0xe721('0x8')];this[_0xe721('0x9')]=_0x1a609b['type']===_0xe721('0xa')?'queue':_0x1a609b[_0xe721('0x8')];this['countbusyretry']=_0x1a609b[_0xe721('0xb')];this[_0xe721('0xc')]=_0x1a609b[_0xe721('0xc')];this[_0xe721('0xd')]=_0x1a609b[_0xe721('0xd')];this[_0xe721('0xe')]=_0x1a609b[_0xe721('0xb')]+_0x1a609b[_0xe721('0xc')]+_0x1a609b[_0xe721('0xd')]+_0x1a609b[_0xe721('0xf')]+_0x1a609b[_0xe721('0x10')]+_0x1a609b[_0xe721('0x11')]+_0x1a609b['countmachineretry']+_0x1a609b[_0xe721('0x12')];this['countnosuchnumberretry']=_0x1a609b[_0xe721('0xf')];this['countdropretry']=_0x1a609b[_0xe721('0x10')];this[_0xe721('0x11')]=_0x1a609b[_0xe721('0x11')];this[_0xe721('0x13')]=_0x1a609b['countmachineretry'];this[_0xe721('0x12')]=_0x1a609b[_0xe721('0x12')];this[_0xe721('0x14')]=_0x1a609b[_0xe721('0x14')];this['calleridname']=_0x1a609b[_0xe721('0x15')];this[_0xe721('0x16')]=_0x1a609b[_0xe721('0x17')];this[_0xe721('0x18')]=_0x1a609b[_0xe721('0x18')];this[_0xe721('0x19')]=_0x1a609b[_0xe721('0x19')];this[_0xe721('0x1a')]=_0x1a609b[_0xe721('0x19')];this[_0xe721('0x1b')]=getSeconds(_0x1a609b[_0xe721('0x19')],_0x1a609b[_0xe721('0x18')]);this[_0xe721('0x1c')]=0x0;this[_0xe721('0x1d')]=0x0;this[_0xe721('0x1e')]=_0x1a609b[_0xe721('0x1e')];this[_0xe721('0x1f')]=_0x1a609b['callbackuniqueid'];this[_0xe721('0x20')]=_0x1a609b[_0xe721('0x20')];this[_0xe721('0x21')]=_0x1a609b[_0xe721('0x21')];this[_0xe721('0x22')]=_0x1a609b[_0xe721('0x22')];this['ListId']=_0x1a609b[_0xe721('0x23')];this[_0xe721('0x24')]=_0x1a609b[_0xe721('0x24')];this['VoiceQueueId']=_0x1a609b['VoiceQueueId'];this[_0xe721('0x25')]=_0x1a609b[_0xe721('0x25')];this[_0xe721('0x26')]=_0x1a609b[_0xe721('0x26')]||'';this['originatecalleridname']=_0x1a609b[_0xe721('0x27')]||'';}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 53cb298..ac1ba81 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 _0x3c8e=['[originate][error]','originate\x20action\x20Error','responsetime','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','noanswer','dialNoAnswerRetryFrequency','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','contact\x20not\x20moved','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','[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','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dropRate','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','busyFactor','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalAnsweredCalls','[CatchErlangB]','[getDataPredictive]','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','actionOriginate','scheduledat','dialRecallMeTimeout','Agent','outboundReCallsDay','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','reachable','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','Amax\x20=\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','[busyFactor]','m\x20=\x20','interval\x20=\x20','Umin\x20=\x20','util','lodash','moment','md5','ioredis','../../../config/environment/','../../../config/logger','dialer','predictive','predictiveCalls','../ami','defaults','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperFinal','../rpc/cmHopperBlack','./action','./agentComplete','./queueCallerAbandon','./hangup','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','optionPredictive','startPredictive','ivrOriginated','queueBooked','agentconnect','syncAgentConnect','queuecallerabandon','syncQueueCallerAbandon','bind','originateresponse','syncOriginateResponse','agentcomplete','syncQueueSummary','hangup','syncHangup','newexten','varset','syncVarSet','queuemember','syncQueueMember','loopCampaigns','loopClearZombieChannels','isUndefined','message','name','\x20NOT\x20Active','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Interval','Intervals','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','type','strategy','answered','available','pTalking','sumDuration','sumHoldTime','talking','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','callerid','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','---------\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','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','outbound','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','inspect','error','stack','length','originated','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[getContactDialer2][ReScheduled]','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','[uniqueid]','clearZombieChannels','isNil','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel][ivr]','countReScheduled','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','resolve','then','verifyAdditionalPhones','[verifyAdditionalPhone]\x20','swapAdditionalPhones','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','saveInDb','pick','ContactId','ListId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','unmonitored','uniqueId','uniqueid','variable','amdstatus','exten','value','HANGUP','HangupInAMD','custom:amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','MACHINE','membername','AMD','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','buildObj','[syncHangupInAMDIvr]','Machine','countglobal','dialGlobalMaxRetry','add','[syncHangupIvr][createHistory]','AnswerAGI','AGI','[syncHangupIvr]','dialQueueProject','outboundUnknownCallsDay','cause-txt','syncAgentComplete','reason','agent','agiafterat','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','dialQueueTimeout','Drop','dropreason','dialQueueProject2','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropMaxRetry','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','locked','paused','stateinterface','idHopper','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','syncQueueStatusComplete','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','contactAgent-idHopper:\x20','Agent:\x20','[booked][unlock]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','ifTime','checkIfTimeIntervals','\x20Intervals\x20is\x20null\x20','Failure','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','push','iftime\x20%s,%s','content','indexOf','true','command','all','GLOBAL_INTERVAL_IS_OVERTIME','Global:\x20','Timezone:\x20','checkDialMethod','progressive','power','handlePower','booked','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','loggedIn','checkIfTime','dialGlobalInterval','dialTimezone','[syncQueueSummary]','\x5cw{0,','pow','replace','random','match','object','originate','voiceQueue\x20is\x20undefine','phone','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','ACTIVE','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','Contact','tags','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','TrunkBackup','dialOriginateCallerIdName','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','OriginateError'];(function(_0x5a3604,_0x3d15b5){var _0x17ce7e=function(_0x1ccff8){while(--_0x1ccff8){_0x5a3604['push'](_0x5a3604['shift']());}};_0x17ce7e(++_0x3d15b5);}(_0x3c8e,0x89));var _0xe3c8=function(_0x972b14,_0x1186c6){_0x972b14=_0x972b14-0x0;var _0x2157ee=_0x3c8e[_0x972b14];return _0x2157ee;};'use strict';var util=require(_0xe3c8('0x0'));var _=require(_0xe3c8('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0xe3c8('0x2'));var rr=require('rr');var md5=require(_0xe3c8('0x3'));var Redis=require(_0xe3c8('0x4'));var ut=require('../preview/util/util');var config=require(_0xe3c8('0x5'));var logger=require(_0xe3c8('0x6'))(_0xe3c8('0x7'));var loggerBooked=require(_0xe3c8('0x6'))('booked');var loggerPredictive=require(_0xe3c8('0x6'))(_0xe3c8('0x8'));var loggerPredictiveCalls=require(_0xe3c8('0x6'))(_0xe3c8('0x9'));var loggerSyncQueueSummary=require(_0xe3c8('0x6'))('syncQueueSummary');var ami=require(_0xe3c8('0xa'));config['redis']=_[_0xe3c8('0xb')](config[_0xe3c8('0xc')],{'host':_0xe3c8('0xd'),'port':0x18eb});var io=require(_0xe3c8('0xe'))(new Redis(config['redis']));var cmHopper=require(_0xe3c8('0xf'));var cmHopperHistory=require(_0xe3c8('0x10'));var cmHopperFinal=require(_0xe3c8('0x11'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0xe3c8('0x12'));var voiceQueueRt=require('../rpc/voiceQueueRt');var Action=require(_0xe3c8('0x13'));var History=require('./history');var Final=require('./final');var AgentComplete=require(_0xe3c8('0x14'));var QueueCallerAbandon=require(_0xe3c8('0x15'));var Hangup=require(_0xe3c8('0x16'));var ipAgi=process['env'][_0xe3c8('0x17')]||_0xe3c8('0x18');var strategy={'rrmemory':_0xe3c8('0x19'),'roundrobin':_0xe3c8('0x1a')};var Sequence=function(){};Sequence[_0xe3c8('0x1b')][_0xe3c8('0x1c')]=function(_0x4c9604){this[_0xe3c8('0x1d')]=this[_0xe3c8('0x1d')]?this['tail'][_0xe3c8('0x1e')](_0x4c9604):_0x4c9604();};function Dialer(_0x10d57b,_0x17e26c){this['sequence']=new Sequence();this[_0xe3c8('0x1f')]=_0x17e26c;this[_0xe3c8('0x20')]=_0x10d57b[_0xe3c8('0x20')];this[_0xe3c8('0x21')]=_0x10d57b[_0xe3c8('0x21')];this[_0xe3c8('0x22')]=_0x10d57b[_0xe3c8('0x22')];this['trunks']=_0x10d57b[_0xe3c8('0x23')];this[_0xe3c8('0x24')]=config[_0xe3c8('0x24')]||0x2;this[_0xe3c8('0x25')]={};this[_0xe3c8('0x26')]={};this[_0xe3c8('0x27')]={};this['uniqueId']={};this[_0xe3c8('0x28')]={};this[_0xe3c8('0x29')]={};this['startProgressive']={};this[_0xe3c8('0x2a')]={};this[_0xe3c8('0x2b')]={};this['queueBookedRR']={};ami['on'](_0xe3c8('0x2c'),this[_0xe3c8('0x2d')]['bind'](this));ami['on'](_0xe3c8('0x2e'),this[_0xe3c8('0x2f')][_0xe3c8('0x30')](this));ami['on'](_0xe3c8('0x31'),this[_0xe3c8('0x32')]['bind'](this));ami['on'](_0xe3c8('0x33'),this['syncAgentComplete']['bind'](this));ami['on']('custom:queuesummary',this[_0xe3c8('0x34')]['bind'](this));ami['on'](_0xe3c8('0x35'),this[_0xe3c8('0x36')]['bind'](this));ami['on'](_0xe3c8('0x37'),this['syncNewExten'][_0xe3c8('0x30')](this));ami['on'](_0xe3c8('0x38'),this[_0xe3c8('0x39')][_0xe3c8('0x30')](this));ami['on'](_0xe3c8('0x3a'),this[_0xe3c8('0x3b')][_0xe3c8('0x30')](this));ami['on']('queuestatuscomplete',this['syncQueueStatusComplete'][_0xe3c8('0x30')](this));this[_0xe3c8('0x3c')]();this[_0xe3c8('0x3d')]();}function isNotNull(_0x564b86){return _0x564b86!==null&&!_[_0xe3c8('0x3e')](_0x564b86);}function checkIsLoggedIn(_0x266399,_0x2c928a){return function(){if(_0x2c928a<=0x0){_0x266399[_0xe3c8('0x3f')]='AGENTS_NOT_LOGGED';throw _0x266399[_0xe3c8('0x40')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x364fa3){return _0x364fa3;}function checkIsActive(_0x96af8e,_0x2df20a){return function(){if(!isActive(_0x2df20a)){_0x96af8e[_0xe3c8('0x3f')]='NOT_ACTIVE';throw _0x96af8e[_0xe3c8('0x40')]+_0xe3c8('0x41');}};}function checkInterval(_0x27df97){return function(){if(!isNotNull(_0x27df97['Interval'])){_0x27df97[_0xe3c8('0x3f')]=_0xe3c8('0x42');throw _0x27df97[_0xe3c8('0x40')]+_0xe3c8('0x43');}if(!isNotNull(_0x27df97[_0xe3c8('0x44')][_0xe3c8('0x45')])){_0x27df97['message']=_0xe3c8('0x42');throw _0x27df97['name']+_0xe3c8('0x43');}if(!isNotNull(_[_0xe3c8('0x46')](_0x27df97[_0xe3c8('0x44')][_0xe3c8('0x45')]))){_0x27df97[_0xe3c8('0x3f')]=_0xe3c8('0x42');throw _0x27df97[_0xe3c8('0x40')]+_0xe3c8('0x43');}};}function msgResponse(_0x553991,_0xc78c55,_0x47cb7c){return{'action':_0x553991,'response':_0xc78c55,'message':_0x47cb7c,'stack':_0x47cb7c};}function myreject(_0x5b8378){return function(_0x3ce1f9){return _0x5b8378(msgResponse(_0xe3c8('0x47'),_0xe3c8('0x48'),JSON[_0xe3c8('0x49')](_0x3ce1f9)));};}function getSeconds(_0x4cdd95,_0x462b04){var _0x4c5f06=moment(_0x4cdd95)[_0xe3c8('0x4a')](0x0);var _0x4138c2=moment(_0x462b04)[_0xe3c8('0x4a')](0x0);return _0x4c5f06[_0xe3c8('0x4b')](_0x4138c2,_0xe3c8('0x4c'));}function emit(_0x543d70,_0x257c02,_0x19f577){io['to'](_0x543d70)[_0xe3c8('0x4d')](_0x257c02,_0x19f577);}function emitVoiceQueueSummary(_0x201217){if(_0x201217[_0xe3c8('0x4e')]==='outbound'){var _0x5322ed={'id':_0x201217['id'],'name':_0x201217[_0xe3c8('0x40')],'strategy':_0x201217[_0xe3c8('0x4f')],'answered':_0x201217[_0xe3c8('0x50')],'available':_0x201217[_0xe3c8('0x51')],'loggedIn':_0x201217['loggedIn'],'pTalking':_0x201217[_0xe3c8('0x52')],'sumBillable':_0x201217['sumBillable'],'sumDuration':_0x201217[_0xe3c8('0x53')],'sumHoldTime':_0x201217[_0xe3c8('0x54')]||0x0,'talking':_0x201217[_0xe3c8('0x55')],'total':_0x201217['total'],'type':_0x201217[_0xe3c8('0x4e')],'unmanaged':_0x201217[_0xe3c8('0x56')],'abandoned':_0x201217[_0xe3c8('0x57')],'waiting':_0x201217[_0xe3c8('0x58')],'loggedInDb':_0x201217[_0xe3c8('0x59')],'dialActive':_0x201217[_0xe3c8('0x5a')],'dialMethod':_0x201217[_0xe3c8('0x5b')],'dialOriginateCallerIdName':_0x201217['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x201217['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x201217[_0xe3c8('0x5c')],'dialPrefix':_0x201217['dialPrefix'],'outboundAnswerAgiCallsDay':_0x201217[_0xe3c8('0x5d')],'outboundAnswerCallsDay':_0x201217[_0xe3c8('0x5e')],'outboundBlacklistCallsDay':_0x201217[_0xe3c8('0x5f')],'outboundBusyCallsDay':_0x201217[_0xe3c8('0x60')],'outboundCongestionCallsDay':_0x201217[_0xe3c8('0x61')],'outboundDropCallsDayACS':_0x201217[_0xe3c8('0x62')],'outboundDropCallsDayCallersExit':_0x201217['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x201217[_0xe3c8('0x63')],'outboundNoAnswerCallsDay':_0x201217[_0xe3c8('0x64')],'outboundNoSuchCallsDay':_0x201217[_0xe3c8('0x65')],'outboundOriginateFailureCallsDay':_0x201217[_0xe3c8('0x66')],'outboundReCallsDay':_0x201217['outboundReCallsDay'],'outboundRejectCallsDay':_0x201217['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x201217['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x201217['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x201217[_0xe3c8('0x67')],'predictiveIntervalAvgTalktime':_0x201217[_0xe3c8('0x68')],'predictiveIntervalDroppedCallsCallersExit':_0x201217[_0xe3c8('0x69')],'predictiveIntervalDroppedCallsTimeout':_0x201217['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x201217['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x201217[_0xe3c8('0x6a')],'predictiveIntervalHitRate':_0x201217[_0xe3c8('0x6b')],'predictiveIntervalMultiplicativeFactor':_0x201217[_0xe3c8('0x6c')],'predictiveIntervalPauses':_0x201217[_0xe3c8('0x6d')],'predictiveIntervalAvailable':_0x201217[_0xe3c8('0x6e')],'predictiveIntervalTotalCalls':_0x201217[_0xe3c8('0x6f')],'message':_0x201217[_0xe3c8('0x3f')],'originated':_0x201217['originated'],'erlangCalls':_0x201217[_0xe3c8('0x70')],'erlangCallToSecond':_0x201217[_0xe3c8('0x71')],'erlangAbandonmentRate':_0x201217[_0xe3c8('0x72')],'erlangBusyFactor':_0x201217[_0xe3c8('0x73')],'startPredictive':_0x201217[_0xe3c8('0x29')],'startProgressive':_0x201217[_0xe3c8('0x74')]};if(_0x201217['Trunk']){_0x5322ed[_0xe3c8('0x75')]={'id':_0x201217[_0xe3c8('0x75')]['id'],'name':_0x201217['Trunk']['name'],'active':_0x201217[_0xe3c8('0x75')][_0xe3c8('0x76')],'callerid':_0x201217['Trunk'][_0xe3c8('0x77')]};}if(_0x201217[_0xe3c8('0x44')]){_0x5322ed['Interval']={'id':_0x201217[_0xe3c8('0x44')]['id'],'name':_0x201217[_0xe3c8('0x44')][_0xe3c8('0x40')]};}var _0x16ed1f=md5(JSON[_0xe3c8('0x49')](_0x5322ed));if(_0x201217[_0xe3c8('0x3')]!==_0x16ed1f){_0x201217[_0xe3c8('0x3')]=_0x16ed1f;emit(util['format']('voice:queue:%s',_0x5322ed[_0xe3c8('0x40')]),_0xe3c8('0x78'),_0x5322ed);}}}function emitCampaignSummary(_0xcd39a){if(_0xcd39a[_0xe3c8('0x4e')]===_0xe3c8('0x79')){emit(util['format'](_0xe3c8('0x7a'),_0xcd39a[_0xe3c8('0x40')]),_0xe3c8('0x7b'),_0xcd39a);}}function checkGetDataPredictive(_0x24ac44){if(isNotNull(_0x24ac44)&&!_[_0xe3c8('0x46')](_0x24ac44)){loggerPredictive[_0xe3c8('0x7c')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0xe3c8('0x7c')](_0xe3c8('0x7d'),_0x24ac44[_0xe3c8('0x6f')]);loggerPredictive[_0xe3c8('0x7c')](_0xe3c8('0x7e'),_0x24ac44['predictiveIntervalAnsweredCalls']);loggerPredictive['info'](_0xe3c8('0x7f'),_0x24ac44[_0xe3c8('0x80')]);loggerPredictive[_0xe3c8('0x7c')](_0xe3c8('0x81'),_0x24ac44[_0xe3c8('0x69')]);loggerPredictive[_0xe3c8('0x7c')](_0xe3c8('0x82'),_0x24ac44[_0xe3c8('0x67')]);loggerPredictive[_0xe3c8('0x7c')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x24ac44[_0xe3c8('0x68')]);loggerPredictive[_0xe3c8('0x7c')](_0xe3c8('0x83'));if(_0x24ac44['predictiveIntervalTotalCalls']>0x0){if(!_['isUndefined'](_0x24ac44['predictiveIntervalAvgTalktime'])&&_0x24ac44[_0xe3c8('0x68')]>0x0){return!![];}loggerPredictive[_0xe3c8('0x7c')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0xe3c8('0x3e')](_0x24ac44[_0xe3c8('0x67')])&&_0x24ac44['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive['info']('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive['info']('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0xe3c8('0x7c')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x36a8ce){return function(_0x2e99fb){loggerPredictive[_0xe3c8('0x7c')](_0xe3c8('0x84'));loggerPredictive[_0xe3c8('0x7c')](_0xe3c8('0x85'),_0x2e99fb[_0xe3c8('0x70')]);loggerPredictive['info'](_0xe3c8('0x86'),_0x2e99fb[_0xe3c8('0x71')]);loggerPredictive[_0xe3c8('0x7c')](_0xe3c8('0x87'),_0x2e99fb['erlangAbandonmentRate']);loggerPredictive[_0xe3c8('0x7c')](_0xe3c8('0x88'),_0x2e99fb[_0xe3c8('0x73')]);loggerPredictive[_0xe3c8('0x7c')](_0xe3c8('0x87'),_0x2e99fb['erlangAbandonmentRate']);loggerPredictive['info'](_0xe3c8('0x83'));_[_0xe3c8('0x89')](_0x36a8ce,_0x2e99fb);};}function getDiff(_0x22b691){var _0x55671a=moment()[_0xe3c8('0x4a')](0x0);var _0x424cf2=moment(_0x22b691)[_0xe3c8('0x4a')](0x0);return _0x55671a['diff'](_0x424cf2,_0xe3c8('0x4c'));}function ifInterval(_0x5f58cb,_0x7333da){if(_[_0xe3c8('0x3e')](_0x7333da)){return![];}return getDiff(_0x7333da)<_0x5f58cb*0x3c;}function freeVariablesPredictive(_0x126072){if(isNotNull(_0x126072)){if(!_[_0xe3c8('0x3e')](_0x126072['startProgressive'])){_0x126072[_0xe3c8('0x74')]=undefined;loggerPredictive[_0xe3c8('0x7c')](_0x126072[_0xe3c8('0x40')],_0xe3c8('0x8a'));}if(!_[_0xe3c8('0x3e')](_0x126072[_0xe3c8('0x29')])){_0x126072[_0xe3c8('0x29')]=undefined;loggerPredictive['info'](_0x126072[_0xe3c8('0x40')],_0xe3c8('0x8b'));}if(!_[_0xe3c8('0x3e')](_0x126072[_0xe3c8('0x8c')])){clearInterval(_0x126072[_0xe3c8('0x8c')]);_0x126072['handlePredictive']=undefined;loggerPredictive[_0xe3c8('0x7c')](_0x126072[_0xe3c8('0x40')],_0xe3c8('0x8d'));}}}function erlangb(_0x392187,_0x4d8052){if(_0x4d8052===0x0){return 0x0;}var _0x38f7c0=0x1;for(var _0x225413=0x1;_0x225413<=_0x4d8052;_0x225413+=0x1){_0x38f7c0=0x1+_0x38f7c0*_0x225413/_0x392187;}return 0x1/_0x38f7c0;}function isVoiceQueueOutbound(_0x372257){return _0x372257===_0xe3c8('0x8e');}function isNotPreview(_0x21ac27){return _0x21ac27!==_0xe3c8('0x1f');}function isCampaignIvr(_0x321d38){return _0x321d38==='ivr';}function getCallerId(_0x15a0eb,_0x43d8c9,_0x526947){if(!_[_0xe3c8('0x3e')](_0x526947)&&typeof _0x526947===_0xe3c8('0x8f')&&!_['isEmpty'](_0x526947)){if(!_[_0xe3c8('0x3e')](_0x43d8c9)&&typeof _0x43d8c9===_0xe3c8('0x8f')&&!_['isEmpty'](_0x43d8c9)){return util[_0xe3c8('0x90')](_0xe3c8('0x91'),_0x43d8c9,_0x526947);}return util[_0xe3c8('0x90')](_0xe3c8('0x91'),_0x526947,_0x526947);}if(!_['isUndefined'](_0x15a0eb)&&typeof _0x15a0eb===_0xe3c8('0x8f')&&!_['isEmpty'](_0x15a0eb)){return _0x15a0eb;}return _0xe3c8('0x92');}function loggerCatchQueueSummary(_0x22323a,_0x181bf0){return function(_0x3ac8fe){freeVariablesPredictive(_0x181bf0);emitVoiceQueueSummary(_0x181bf0);emitCampaignSummary(_0x181bf0);loggerSyncQueueSummary['error'](_0x22323a,util[_0xe3c8('0x93')](_0x3ac8fe,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x389248,_0x54f692){return function(_0x32612f){loggerPredictive[_0xe3c8('0x94')](_0x54f692['name'],_0x389248);loggerPredictive[_0xe3c8('0x94')](_0x32612f[_0xe3c8('0x95')]);freeVariablesPredictive(_0x54f692);};}function loggerCatch(_0x41cae0){return function(_0x5a61b3){logger[_0xe3c8('0x94')](_0x41cae0,util['inspect'](_0x5a61b3,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x484da2){return _0x484da2&&!_[_0xe3c8('0x3e')](_0x484da2)&&_0x484da2[_0xe3c8('0x96')]>0x0;}function decremetOriginate(_0x418d68){if(!_['isUndefined'](_0x418d68)&&_0x418d68!==null){if(typeof _0x418d68[_0xe3c8('0x97')]!==_0xe3c8('0x98')){if(_0x418d68[_0xe3c8('0x97')]>0x0){_0x418d68['originated']-=0x1;}else{logger['error'](_0xe3c8('0x99'));}}}else{logger[_0xe3c8('0x94')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x1b4b89,_0x58b517,_0x4f3c32){if(_0x58b517>_0x4f3c32){for(var _0x358ba2=0x0;_0x358ba2<_0x58b517-_0x4f3c32;_0x358ba2+=0x1){decremetOriginate(_0x1b4b89);}}}function loggerGetContactDialer(_0x806332,_0x185738,_0x215072){return function(_0x34d4d4){checkContactLowerLimitOriginate(_0x185738,_0x215072,0x0);logger[_0xe3c8('0x94')](_0x806332,util[_0xe3c8('0x93')](_0x34d4d4,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2e4e33){return function(_0x966021){if(isNotNull(_0x966021)&&isNotNull(_0x966021[0x0])){if(_0x966021[0x0]['contactsRescheduled']>0x0){_0x2e4e33[_0xe3c8('0x3f')]='RESCHEDULED_CONTACTS';logger[_0xe3c8('0x7c')](_0xe3c8('0x9a')+_0x2e4e33[_0xe3c8('0x40')],_0x966021[0x0]['contactsRescheduled'],'contacts');}else{_0x2e4e33[_0xe3c8('0x3f')]=_0xe3c8('0x9b');logger[_0xe3c8('0x7c')](_0xe3c8('0x9c')+_0x2e4e33[_0xe3c8('0x40')]);}}};}function notSendMessagesQueue(_0x38a33a){if(_0x38a33a[_0xe3c8('0x9d')]){freeVariablesPredictive(_0x38a33a);if(_0x38a33a['originated']===0x0&&_0x38a33a[_0xe3c8('0x55')]===0x0&&_0x38a33a['waiting']===0x0&&(_0x38a33a['pTalking']||0x0)===0x0){_0x38a33a['sendMessageOneNotActive']=![];_0x38a33a['available']=0x0;_0x38a33a[_0xe3c8('0x3f')]=_0xe3c8('0x9e');loggerSyncQueueSummary[_0xe3c8('0x94')](_0xe3c8('0x9f'),_0x38a33a[_0xe3c8('0x40')],_0xe3c8('0xa0'));}else{_0x38a33a[_0xe3c8('0x3f')]=_0xe3c8('0xa1');loggerSyncQueueSummary[_0xe3c8('0x94')](_0xe3c8('0x9f'),_0x38a33a[_0xe3c8('0x40')],_0xe3c8('0xa2'));}emitVoiceQueueSummary(_0x38a33a);}}function notSendMessagesCampaign(_0xa2aafa){if(_0xa2aafa['sendMessageOneNotActive']){if(_0xa2aafa['originated']===0x0){_0xa2aafa[_0xe3c8('0x9d')]=![];_0xa2aafa[_0xe3c8('0x3f')]=_0xe3c8('0x9e');loggerSyncQueueSummary[_0xe3c8('0x94')](_0xe3c8('0xa3'),_0xa2aafa[_0xe3c8('0x40')],_0xe3c8('0xa0'));}else{_0xa2aafa[_0xe3c8('0x3f')]=_0xe3c8('0xa1');loggerSyncQueueSummary[_0xe3c8('0x94')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0xa2aafa[_0xe3c8('0x40')],_0xe3c8('0xa2'));}emitCampaignSummary(_0xa2aafa);}}function createObjHistory(_0x1eb65d,_0x32953d,_0x3588,_0x53fbd5,_0x22879b){_0x1eb65d[_0xe3c8('0x3f')]=_0x3588;var _0x5e5099=new Action(_0x1eb65d,_0x32953d);var _0xa669bd=new History(_0x5e5099);_0xa669bd[_0xe3c8('0xa4')]=_0x53fbd5;_0xa669bd[_0xe3c8('0xa5')]=_0x22879b;_0xa669bd[_0xe3c8('0xa6')]=_0x5e5099[_0xe3c8('0xa7')];return _0xa669bd;}Dialer[_0xe3c8('0x1b')][_0xe3c8('0x3d')]=function(){var _0xd2a1ae=this;setInterval(function(){_0xd2a1ae['clearZombieChannels'](_0xd2a1ae['uniqueId'],_0xe3c8('0xa8'));_0xd2a1ae[_0xe3c8('0xa9')](_0xd2a1ae['actions'],'[actions]');},0x32c8);};Dialer[_0xe3c8('0x1b')][_0xe3c8('0xa9')]=function(_0x5e063b,_0x1f4b62){var _0x612af5=this;for(var _0xe9d3a1 in _0x5e063b){if(typeof _0x5e063b[_0xe9d3a1]!==_0xe3c8('0x98')){this['sequence']['enqueue'](function(){if(!_[_0xe3c8('0xaa')](_0x5e063b[_0xe9d3a1])){return ami[_0xe3c8('0xab')]({'action':_0xe3c8('0xac'),'channel':_0x5e063b[_0xe9d3a1][_0xe3c8('0xad')]})[_0xe3c8('0xae')](function(_0x38d006){if(_0x38d006['message']===_0xe3c8('0xaf')){setTimeout(function(){if(_0x5e063b[_0xe9d3a1]&&_0x5e063b[_0xe9d3a1][_0xe3c8('0x4e')]!=='ivr'){_0x612af5[_0xe3c8('0xb0')](_0x612af5[_0xe3c8('0x20')][_0x5e063b[_0xe9d3a1][_0xe3c8('0xb1')]]);logger[_0xe3c8('0x94')]('[Dialer][checkChannel]',_0x1f4b62,_0xe9d3a1,_0x5e063b[_0xe9d3a1][_0xe3c8('0xb1')]);delete _0x5e063b[_0xe9d3a1];}if(_0x5e063b[_0xe9d3a1]&&_0x5e063b[_0xe9d3a1]['type']==='ivr'){_0x612af5[_0xe3c8('0xb0')](_0x612af5['campaigns'][_0x5e063b[_0xe9d3a1]['queue']]);logger[_0xe3c8('0x94')](_0xe3c8('0xb2'),_0x1f4b62,_0xe9d3a1,_0x5e063b[_0xe9d3a1][_0xe3c8('0xb1')]);delete _0x5e063b[_0xe9d3a1];}},0x2328);}});}});}}};Dialer[_0xe3c8('0x1b')][_0xe3c8('0xb3')]=function(_0x492a57){return BPromise['resolve']()['then'](cmHopper[_0xe3c8('0xb3')](_0x492a57))[_0xe3c8('0xae')](loggerCatch(_0xe3c8('0xb4')));};Dialer['prototype'][_0xe3c8('0xb5')]=function(_0x2acfac){return BPromise['resolve']()['then'](cmHopperBlack['checkIsBlackList'](_0x2acfac))[_0xe3c8('0xae')](loggerCatch(_0xe3c8('0xb6')));};Dialer['prototype']['verifyAdditionalPhones']=function(_0x462826,_0x3126bf,_0x40e69f){return BPromise[_0xe3c8('0xb7')]()[_0xe3c8('0xb8')](cmHopperAdditionalPhone[_0xe3c8('0xb9')](_0x462826,_0x3126bf,_0x40e69f))[_0xe3c8('0xae')](loggerCatch(_0xe3c8('0xba')));};Dialer['prototype'][_0xe3c8('0xbb')]=function(_0x239170,_0x5c744c,_0x2b1b24){return BPromise[_0xe3c8('0xb7')]()[_0xe3c8('0xb8')](cmHopperAdditionalPhone[_0xe3c8('0xbb')](_0x239170,_0x5c744c,_0x2b1b24))[_0xe3c8('0xae')](loggerCatch('[swapAdditionalPhone]\x20'));};Dialer[_0xe3c8('0x1b')][_0xe3c8('0xbc')]=function(_0x5800a6){return BPromise['resolve']()[_0xe3c8('0xb8')](cmHopperBlack[_0xe3c8('0xbc')](_0x5800a6))[_0xe3c8('0xae')](loggerCatch(_0xe3c8('0xbd')));};Dialer[_0xe3c8('0x1b')][_0xe3c8('0xbe')]=function(_0x55d91f){return BPromise[_0xe3c8('0xb7')]()[_0xe3c8('0xb8')](cmHopperHistory[_0xe3c8('0xbf')](_0x55d91f))['catch'](loggerCatch('[averageHandleTime]\x20'));};Dialer['prototype'][_0xe3c8('0xc0')]=function(_0x5e714b){return BPromise[_0xe3c8('0xb7')]()[_0xe3c8('0xb8')](cmHopper[_0xe3c8('0xc0')](_0x5e714b))[_0xe3c8('0xae')](loggerCatch(_0xe3c8('0xc1')));};Dialer[_0xe3c8('0x1b')]['unlockContact']=function(_0x4b1a92,_0x277683,_0x562b01){return BPromise[_0xe3c8('0xb7')]()[_0xe3c8('0xb8')](cmHopper[_0xe3c8('0xc2')](_0x4b1a92,_0x277683,_0x562b01))['catch'](loggerCatch(_0xe3c8('0xc3')));};Dialer['prototype'][_0xe3c8('0xc4')]=function(_0x10c8a2,_0x50b843,_0x44a0b7,_0x1653cf,_0x5ad0ac){return BPromise['resolve']()[_0xe3c8('0xb8')](cmHopper[_0xe3c8('0xc4')](_0x10c8a2,_0x50b843,_0x44a0b7,_0x1653cf))['catch'](function(_0x3eb79b){_0x5ad0ac[_0xe3c8('0xc5')]-=_0x44a0b7;_0x5ad0ac[_0xe3c8('0xc5')]=_0x5ad0ac[_0xe3c8('0xc5')]>0x0?_0x5ad0ac[_0xe3c8('0xc5')]:0x0;loggerCatch(_0xe3c8('0xc6'))(_0x3eb79b);});};Dialer[_0xe3c8('0x1b')][_0xe3c8('0xc7')]=function(_0x3a5dd1,_0x56ebe1,_0x4a9309,_0x21321f){return BPromise[_0xe3c8('0xb7')]()[_0xe3c8('0xb8')](cmHopper[_0xe3c8('0xc7')](_0x3a5dd1,_0x56ebe1,_0x4a9309))['catch'](function(_0x55f0bd){_0x21321f[_0xe3c8('0xc5')]-=_0x56ebe1;_0x21321f[_0xe3c8('0xc5')]=_0x21321f[_0xe3c8('0xc5')]>0x0?_0x21321f[_0xe3c8('0xc5')]:0x0;loggerCatch(_0xe3c8('0xc8'))(_0x55f0bd);});};Dialer[_0xe3c8('0x1b')][_0xe3c8('0xc9')]=function(_0x4ed30d){return BPromise[_0xe3c8('0xb7')]()['then'](voiceQueueRt[_0xe3c8('0xc9')](_0x4ed30d))[_0xe3c8('0xae')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0xe3c8('0x1b')][_0xe3c8('0xca')]=function(_0x4c0403){return BPromise[_0xe3c8('0xb7')]()[_0xe3c8('0xb8')](cmHopper[_0xe3c8('0xca')](_0x4c0403))[_0xe3c8('0xae')](loggerCatch(_0xe3c8('0xcb')));};Dialer[_0xe3c8('0x1b')]['createHistory']=function(_0x571dd4){return BPromise['resolve']()[_0xe3c8('0xb8')](cmHopperHistory[_0xe3c8('0xcc')](_0x571dd4))[_0xe3c8('0xae')](loggerCatch(_0xe3c8('0xcd')));};Dialer[_0xe3c8('0x1b')][_0xe3c8('0xb0')]=function(_0x2a7998){if(!_[_0xe3c8('0x3e')](_0x2a7998)&&_0x2a7998!==null){if(typeof _0x2a7998[_0xe3c8('0x97')]!==_0xe3c8('0x98')){if(_0x2a7998[_0xe3c8('0x97')]>0x0){_0x2a7998[_0xe3c8('0x97')]-=0x1;}else{logger[_0xe3c8('0x94')](_0xe3c8('0xce'));}}}else{logger[_0xe3c8('0x94')](_0xe3c8('0xcf'));}};Dialer[_0xe3c8('0x1b')][_0xe3c8('0xd0')]=function(_0x5695d7,_0x3406a9){var _0x2b7404=this;return function(_0x1d70dd){_0x2b7404[_0xe3c8('0xb0')](_0x3406a9);logger['error'](_0x5695d7,util[_0xe3c8('0x93')](_0x1d70dd,{'showHidden':![],'depth':null}));};};Dialer[_0xe3c8('0x1b')][_0xe3c8('0xd1')]=function(_0x4fc558,_0xb37076,_0x15fea0){var _0x3f4f5d={'state':0x19,'statedesc':'notFound'};this['updateOriginated'](_0xb37076);this[_0xe3c8('0xd2')](_[_0xe3c8('0x89')](_0x3f4f5d,_[_0xe3c8('0xd3')](_0x15fea0,[_0xe3c8('0xd4'),_0xe3c8('0xd5'),'UserId',_0xe3c8('0xd6'),_0xe3c8('0xd7')])),_0xe3c8('0xd8'),_0xe3c8('0xd9'));logger[_0xe3c8('0x94')](_0x4fc558);};Dialer[_0xe3c8('0x1b')][_0xe3c8('0xda')]=function(_0x5083eb){return _0x5083eb===_0xe3c8('0xdb');};Dialer[_0xe3c8('0x1b')][_0xe3c8('0xdc')]=function(_0x23626f){return!_[_0xe3c8('0x3e')](_0x23626f)&&_0x23626f&&!_[_0xe3c8('0x3e')](_0x23626f[_0xe3c8('0x40')])&&!_[_0xe3c8('0x3e')](_0x23626f[_0xe3c8('0x76')])&&_0x23626f[_0xe3c8('0x76')]&&(this['trunks'][util[_0xe3c8('0x90')]('SIP/%s',_0x23626f[_0xe3c8('0x40')])][_0xe3c8('0xac')]==='reachable'||this[_0xe3c8('0x23')][util[_0xe3c8('0x90')](_0xe3c8('0xdd'),_0x23626f[_0xe3c8('0x40')])][_0xe3c8('0xac')]===_0xe3c8('0xde'));};Dialer['prototype'][_0xe3c8('0xd2')]=function(_0x1cf045,_0x15e56e,_0x452411){this[_0xe3c8('0xcc')](_0x1cf045)[_0xe3c8('0xae')](loggerCatch(_0x15e56e));this[_0xe3c8('0xca')](_0x1cf045)[_0xe3c8('0xae')](loggerCatch(_0x452411));};Dialer[_0xe3c8('0x1b')][_0xe3c8('0x39')]=function(_0x57c576){var _0x336528=this[_0xe3c8('0xdf')][_0x57c576[_0xe3c8('0xe0')]];var _0x40ba8b;if(!_[_0xe3c8('0xaa')](_0x57c576)&&!_['isNil'](_0x57c576[_0xe3c8('0xe1')])&&!_[_0xe3c8('0xaa')](_0x57c576[_0xe3c8('0xe1')][_0xe3c8('0xe2')])&&_0x57c576[_0xe3c8('0xe3')]==='xcally-motion-dialer'&&_0x336528){if(_0x336528[_0xe3c8('0x4e')]!==_0xe3c8('0x79')&&this[_0xe3c8('0x20')][_0x336528[_0xe3c8('0xb1')]]['dialAMDActive']&&_0x57c576[_0xe3c8('0xe4')]===_0xe3c8('0xe5')){delete this[_0xe3c8('0xdf')][_0x57c576[_0xe3c8('0xe0')]];this[_0xe3c8('0xb0')](this[_0xe3c8('0x20')][_0x336528[_0xe3c8('0xb1')]]);this[_0xe3c8('0x20')][_0x336528['queue']][_0xe3c8('0x5e')]+=0x1;this['voiceQueues'][_0x336528[_0xe3c8('0xb1')]][_0xe3c8('0x5d')]+=0x1;_0x40ba8b=new Hangup(_0x336528,_0x57c576);_0x40ba8b[_0xe3c8('0xa4')]=0x12;_0x40ba8b['statedesc']=_0xe3c8('0xe6');_0x40ba8b['membername']='AMD';ami[_0xe3c8('0x4d')](_0xe3c8('0xe7'),ut['buildObj'](_0x40ba8b,'amd'));this['saveInDb'](_0x40ba8b,_0xe3c8('0xe8'),_0xe3c8('0xe9'));}if(_0x336528[_0xe3c8('0x4e')]!=='ivr'&&this[_0xe3c8('0x20')][_0x336528[_0xe3c8('0xb1')]][_0xe3c8('0xea')]&&_0x57c576['value']===_0xe3c8('0xeb')){var _0x17ccc1=this;return new BPromise(function(_0x32b124,_0x2eca0f){delete _0x17ccc1[_0xe3c8('0xdf')][_0x57c576['uniqueid']];_0x17ccc1[_0xe3c8('0xb0')](_0x17ccc1[_0xe3c8('0x20')][_0x336528[_0xe3c8('0xb1')]]);_0x17ccc1['voiceQueues'][_0x336528['queue']]['outboundAnswerCallsDay']+=0x1;_0x17ccc1['voiceQueues'][_0x336528['queue']]['outboundAnswerAgiCallsDay']+=0x1;var _0x5229af=_0x17ccc1[_0xe3c8('0x20')][_0x336528[_0xe3c8('0xb1')]];var _0x3d6446=new Hangup(_0x336528,_0x57c576);_0x3d6446[_0xe3c8('0xa4')]=0x13;_0x3d6446[_0xe3c8('0xa5')]='Machine';_0x3d6446[_0xe3c8('0xec')]=_0xe3c8('0xed');_0x3d6446['countmachineretry']+=0x1;_0x3d6446['countglobal']+=0x1;_0x3d6446[_0xe3c8('0xee')]=!![];ami['emit'](_0xe3c8('0xe7'),ut['buildObj'](_0x3d6446,_0xe3c8('0xee')));_0x17ccc1[_0xe3c8('0xcc')](_0x3d6446)['catch'](loggerCatch(_0xe3c8('0xef')));if(_0x3d6446[_0xe3c8('0xf0')]+_0x3d6446[_0xe3c8('0xf1')]+_0x3d6446[_0xe3c8('0xf2')]+_0x3d6446[_0xe3c8('0xf3')]+_0x3d6446[_0xe3c8('0xf4')]+_0x3d6446[_0xe3c8('0xf5')]+_0x3d6446[_0xe3c8('0xf6')]+_0x3d6446[_0xe3c8('0xf7')]>=_0x5229af['dialGlobalMaxRetry']){_0x17ccc1[_0xe3c8('0xf8')](_0x3d6446,_0x32b124,_0x2eca0f,_0xe3c8('0xf9'));}else{if(_0x3d6446[_0xe3c8('0xf6')]>=_0x5229af[_0xe3c8('0xfa')]){_0x17ccc1[_0xe3c8('0xfb')](_0x3d6446,_0x32b124,_0x2eca0f,_0xe3c8('0xfc'));}else{_0x17ccc1[_0xe3c8('0xc0')]({'active':![],'countmachineretry':_0x3d6446[_0xe3c8('0xf6')],'scheduledat':moment()['add'](_0x5229af[_0xe3c8('0xfd')],_0xe3c8('0xfe'))[_0xe3c8('0x90')](_0xe3c8('0xff')),'ContactId':_0x3d6446[_0xe3c8('0xd4')],'ListId':_0x3d6446[_0xe3c8('0xd5')],'VoiceQueueId':_0x3d6446[_0xe3c8('0xd6')]||undefined,'CampaignId':_0x3d6446[_0xe3c8('0xd7')]||undefined})[_0xe3c8('0xae')](loggerCatch(_0xe3c8('0x100')));_0x32b124({'reschedule':0x1});}}});}if(_0x336528[_0xe3c8('0x4e')]===_0xe3c8('0x79')&&this[_0xe3c8('0x21')][_0x336528[_0xe3c8('0xb1')]]['dialAMDActive']&&_0x57c576[_0xe3c8('0xe4')]==='HANGUP'){delete this['uniqueId'][_0x57c576['uniqueid']];this[_0xe3c8('0xb0')](this[_0xe3c8('0x21')][_0x336528[_0xe3c8('0xb1')]]);_0x40ba8b=new Hangup(_0x336528,_0x57c576);_0x40ba8b[_0xe3c8('0xa4')]=0x12;_0x40ba8b['statedesc']=_0xe3c8('0xe6');_0x40ba8b['membername']=_0xe3c8('0xed');ami['emit'](_0xe3c8('0xe7'),ut[_0xe3c8('0x101')](_0x40ba8b,'amd'));this['saveInDb'](_0x40ba8b,'[syncHangupInAMDIvr][createHistory]',_0xe3c8('0x102'));}if(_0x336528[_0xe3c8('0x4e')]===_0xe3c8('0x79')&&this[_0xe3c8('0x21')][_0x336528[_0xe3c8('0xb1')]][_0xe3c8('0xea')]&&_0x57c576[_0xe3c8('0xe4')]===_0xe3c8('0xeb')){var _0x17ccc1=this;return new BPromise(function(_0x19f2e3,_0x8b5695){delete _0x17ccc1[_0xe3c8('0xdf')][_0x57c576[_0xe3c8('0xe0')]];_0x17ccc1[_0xe3c8('0xb0')](_0x17ccc1[_0xe3c8('0x21')][_0x336528[_0xe3c8('0xb1')]]);_0x17ccc1[_0xe3c8('0x21')][_0x336528[_0xe3c8('0xb1')]][_0xe3c8('0x5e')]+=0x1;_0x17ccc1['campaigns'][_0x336528['queue']][_0xe3c8('0x5d')]+=0x1;var _0x2b78fc=_0x17ccc1['campaigns'][_0x336528['queue']];var _0x1223c1=new Hangup(_0x336528,_0x57c576);_0x1223c1[_0xe3c8('0xa4')]=0x13;_0x1223c1[_0xe3c8('0xa5')]=_0xe3c8('0x103');_0x1223c1[_0xe3c8('0xec')]=_0xe3c8('0xed');_0x1223c1[_0xe3c8('0xf6')]+=0x1;_0x1223c1[_0xe3c8('0x104')]+=0x1;_0x1223c1[_0xe3c8('0xee')]=!![];ami[_0xe3c8('0x4d')](_0xe3c8('0xe7'),ut['buildObj'](_0x1223c1,'amd'));_0x17ccc1[_0xe3c8('0xcc')](_0x1223c1)[_0xe3c8('0xae')](loggerCatch(_0xe3c8('0xef')));if(_0x1223c1['countbusyretry']+_0x1223c1[_0xe3c8('0xf1')]+_0x1223c1[_0xe3c8('0xf2')]+_0x1223c1[_0xe3c8('0xf3')]+_0x1223c1[_0xe3c8('0xf4')]+_0x1223c1[_0xe3c8('0xf5')]+_0x1223c1['countmachineretry']+_0x1223c1[_0xe3c8('0xf7')]>=_0x2b78fc[_0xe3c8('0x105')]){_0x17ccc1[_0xe3c8('0xf8')](_0x1223c1,_0x19f2e3,_0x8b5695,'reason19\x20machine....');}else{if(_0x1223c1['countmachineretry']>=_0x2b78fc[_0xe3c8('0xfa')]){_0x17ccc1['createStateFinal'](_0x1223c1,_0x19f2e3,_0x8b5695,_0xe3c8('0xfc'));}else{_0x17ccc1[_0xe3c8('0xc0')]({'active':![],'countmachineretry':_0x1223c1[_0xe3c8('0xf6')],'scheduledat':moment()[_0xe3c8('0x106')](_0x2b78fc[_0xe3c8('0xfd')],'minutes')[_0xe3c8('0x90')](_0xe3c8('0xff')),'ContactId':_0x1223c1[_0xe3c8('0xd4')],'ListId':_0x1223c1[_0xe3c8('0xd5')],'VoiceQueueId':_0x1223c1[_0xe3c8('0xd6')]||undefined,'CampaignId':_0x1223c1[_0xe3c8('0xd7')]||undefined})[_0xe3c8('0xae')](loggerCatch(_0xe3c8('0x100')));_0x19f2e3({'reschedule':0x1});}}});}}};Dialer[_0xe3c8('0x1b')][_0xe3c8('0x36')]=function(_0x5064b2){var _0x2427c2=this[_0xe3c8('0xdf')][_0x5064b2[_0xe3c8('0xe0')]];var _0x265b12=this;var _0x2b1323;if(_0x2427c2&&_0x2427c2['type']===_0xe3c8('0x79')){delete this['uniqueId'][_0x5064b2[_0xe3c8('0xe0')]];this['updateOriginated'](this['campaigns'][_0x2427c2['queue']]);this[_0xe3c8('0x21')][_0x2427c2[_0xe3c8('0xb1')]]['ivrAnswerCallsDay']+=0x1;_0x2b1323=new Hangup(_0x2427c2,_0x5064b2);this[_0xe3c8('0xcc')](_0x2b1323)[_0xe3c8('0xae')](loggerCatch(_0xe3c8('0x107')));this[_0xe3c8('0xca')](_0x2b1323)[_0xe3c8('0xae')](loggerCatch('[syncHangupIvr]'));}if(_0x2427c2&&_0x2427c2['type']!==_0xe3c8('0x79')&&isNotNull(this[_0xe3c8('0x20')][_0x2427c2[_0xe3c8('0xb1')]]['dialQueueProject'])){delete this[_0xe3c8('0xdf')][_0x5064b2['uniqueid']];this[_0xe3c8('0xb0')](this[_0xe3c8('0x20')][_0x2427c2[_0xe3c8('0xb1')]]);this[_0xe3c8('0x20')][_0x2427c2['queue']][_0xe3c8('0x5e')]+=0x1;this[_0xe3c8('0x20')][_0x2427c2['queue']][_0xe3c8('0x5d')]+=0x1;_0x2b1323=new Hangup(_0x2427c2,_0x5064b2);_0x2b1323['state']=0x10;_0x2b1323['statedesc']=_0xe3c8('0x108');_0x2b1323[_0xe3c8('0xec')]=_0xe3c8('0x109');this['createHistory'](_0x2b1323)[_0xe3c8('0xae')](loggerCatch(_0xe3c8('0x107')));this[_0xe3c8('0xca')](_0x2b1323)[_0xe3c8('0xae')](loggerCatch(_0xe3c8('0x10a')));}if(_0x2427c2&&_0x2427c2[_0xe3c8('0x4e')]!==_0xe3c8('0x79')&&!isNotNull(this[_0xe3c8('0x20')][_0x2427c2[_0xe3c8('0xb1')]][_0xe3c8('0x10b')])){delete this[_0xe3c8('0xdf')][_0x5064b2[_0xe3c8('0xe0')]];this[_0xe3c8('0xb0')](this[_0xe3c8('0x20')][_0x2427c2[_0xe3c8('0xb1')]]);this[_0xe3c8('0x20')][_0x2427c2['queue']][_0xe3c8('0x10c')]+=0x1;_0x2b1323=new Hangup(_0x2427c2,_0x5064b2);_0x2b1323[_0xe3c8('0xa4')]=0xc;_0x2b1323[_0xe3c8('0xa5')]=_0x5064b2[_0xe3c8('0x10d')];_0x2b1323[_0xe3c8('0xec')]='Unknow';this[_0xe3c8('0xcc')](_0x2b1323)[_0xe3c8('0xae')](loggerCatch(_0xe3c8('0x107')));this['moveContactManagedDialer'](_0x2b1323)[_0xe3c8('0xae')](loggerCatch(_0xe3c8('0x10a')));}};Dialer[_0xe3c8('0x1b')][_0xe3c8('0x10e')]=function(_0x35aee7){var _0x247fce=this[_0xe3c8('0xdf')][_0x35aee7['uniqueid']];var _0x25eb58=this;if(this[_0xe3c8('0x20')][_0x35aee7[_0xe3c8('0xb1')]]){if(_0x247fce&&_0x247fce[_0xe3c8('0x4e')]!==_0xe3c8('0x79')){delete this[_0xe3c8('0xdf')][_0x35aee7[_0xe3c8('0xe0')]];this['voiceQueues'][_0x35aee7[_0xe3c8('0xb1')]][_0xe3c8('0x5e')]+=0x1;var _0x5adc6b=new AgentComplete(_0x247fce,_0x35aee7);if(_0x35aee7[_0xe3c8('0x10f')]===_0xe3c8('0x110')){_0x5adc6b[_0xe3c8('0x111')]=this[_0xe3c8('0x20')][_0x35aee7[_0xe3c8('0xb1')]]['dialQueueProject2']&&this['voiceQueues'][_0x35aee7['queue']][_0xe3c8('0x112')]?moment()[_0xe3c8('0x90')](_0xe3c8('0xff')):undefined;}this[_0xe3c8('0xcc')](_0x5adc6b)[_0xe3c8('0xae')](loggerCatch(_0xe3c8('0x113')));this[_0xe3c8('0xca')](_0x5adc6b)[_0xe3c8('0xae')](loggerCatch('[syncAgentComplete]'));}}};Dialer['prototype'][_0xe3c8('0x2d')]=function(_0x32d24d){if(this[_0xe3c8('0x20')][_0x32d24d[_0xe3c8('0xb1')]]){if(this['uniqueId'][_0x32d24d[_0xe3c8('0xe0')]]&&this['uniqueId'][_0x32d24d['uniqueid']]['type']!==_0xe3c8('0x79')){this['updateOriginated'](this[_0xe3c8('0x20')][_0x32d24d[_0xe3c8('0xb1')]]);this[_0xe3c8('0xdf')][_0x32d24d[_0xe3c8('0xe0')]][_0xe3c8('0x114')]=moment()[_0xe3c8('0x90')](_0xe3c8('0xff'));}}};Dialer[_0xe3c8('0x1b')][_0xe3c8('0x115')]=function(_0x392b49,_0x44b059){this[_0xe3c8('0xcc')](_0x392b49)[_0xe3c8('0xae')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x44b059==0x0){this['moveContactManagedDialer'](_0x392b49)['catch'](loggerCatch(_0xe3c8('0x116')));}};Dialer['prototype']['syncQueueCallerAbandon']=function(_0x38d247){var _0x782406=this[_0xe3c8('0xdf')][_0x38d247[_0xe3c8('0xe0')]];var _0x4e2b7c=this;var _0x271fbd=![];var _0xc4dffd;var _0x83bb65;if(this[_0xe3c8('0x20')][_0x38d247[_0xe3c8('0xb1')]]){if(_0x782406&&_0x782406[_0xe3c8('0x4e')]!=='ivr'){delete this[_0xe3c8('0xdf')][_0x38d247[_0xe3c8('0xe0')]];this[_0xe3c8('0xb0')](this[_0xe3c8('0x20')][_0x38d247[_0xe3c8('0xb1')]]);_0x782406[_0xe3c8('0x117')]=moment()[_0xe3c8('0x90')]('YYYY-MM-DD\x20HH:mm:ss');var _0x45cfb8=new QueueCallerAbandon(_0x782406,_0x38d247);if(getSeconds(_0x782406[_0xe3c8('0x117')],_0x782406['responsetime'])>=_0x782406[_0xe3c8('0x118')]){this['voiceQueues'][_0x38d247[_0xe3c8('0xb1')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0xe3c8('0x20')][_0x38d247[_0xe3c8('0xb1')]]['outboundDropCallsDayTimeout']+=0x1;this[_0xe3c8('0x20')][_0x38d247['queue']]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x45cfb8['state']=0xa;_0x45cfb8[_0xe3c8('0xa5')]=_0xe3c8('0x119');_0x45cfb8[_0xe3c8('0x11a')]='TIMEOUT';_0x45cfb8[_0xe3c8('0x111')]=this['voiceQueues'][_0x38d247[_0xe3c8('0xb1')]][_0xe3c8('0x11b')]?moment()[_0xe3c8('0x90')](_0xe3c8('0xff')):undefined;_0x45cfb8[_0xe3c8('0xf4')]+=0x1;_0x45cfb8[_0xe3c8('0x104')]+=0x1;_0xc4dffd=this[_0xe3c8('0x20')][_0x38d247[_0xe3c8('0xb1')]][_0xe3c8('0x11c')];_0x83bb65=this['voiceQueues'][_0x38d247['queue']][_0xe3c8('0x11d')];_0x4e2b7c[_0xe3c8('0xb9')](_0x45cfb8,_0x45cfb8['state'],_0x782406[_0xe3c8('0x11e')])[_0xe3c8('0xb8')](function(_0x301649){_0x271fbd=_0x301649[_0xe3c8('0x11f')]==0x1;if(_0x45cfb8[_0xe3c8('0xf4')]>=_0x4e2b7c[_0xe3c8('0x20')][_0x38d247[_0xe3c8('0xb1')]][_0xe3c8('0x120')]){_0x4e2b7c[_0xe3c8('0x115')](_0x45cfb8,_0x301649[_0xe3c8('0x11f')]);}else{_0x4e2b7c[_0xe3c8('0xc0')]({'active':![],'countdropretry':_0x45cfb8[_0xe3c8('0xf4')],'scheduledat':moment()[_0xe3c8('0x106')](_0x4e2b7c['voiceQueues'][_0x38d247[_0xe3c8('0xb1')]][_0xe3c8('0x11c')],_0xe3c8('0xfe'))[_0xe3c8('0x90')](_0xe3c8('0xff')),'ContactId':_0x782406[_0xe3c8('0xd4')],'ListId':_0x782406[_0xe3c8('0xd5')],'VoiceQueueId':_0x782406[_0xe3c8('0xd6')]||undefined,'CampaignId':_0x782406[_0xe3c8('0xd7')]||undefined})[_0xe3c8('0xae')](loggerCatch(_0xe3c8('0x121')));var _0xdcff5d=new History(_0x45cfb8);_0xdcff5d[_0xe3c8('0xa4')]=0xa;_0xdcff5d[_0xe3c8('0xa5')]=_0xe3c8('0x119');_0xdcff5d[_0xe3c8('0xa7')]=moment()[_0xe3c8('0x90')](_0xe3c8('0xff'));_0xdcff5d[_0xe3c8('0xa6')]=_0xdcff5d[_0xe3c8('0xa7')];_0xdcff5d[_0xe3c8('0x122')]=_0x45cfb8[_0xe3c8('0x122')];_0xdcff5d[_0xe3c8('0x123')]=_0x45cfb8['calleridnum'];_0x4e2b7c['createHistory'](_0xdcff5d)[_0xe3c8('0xae')](loggerCatch(_0xe3c8('0x124')));}})[_0xe3c8('0xb8')](function(_0x587815){if(_0x271fbd)_0x4e2b7c[_0xe3c8('0xbb')](_0x45cfb8,_0xc4dffd,_0x83bb65)[_0xe3c8('0xb8')](function(_0x595dcd){return 0x1;});});}else{this[_0xe3c8('0x20')][_0x38d247[_0xe3c8('0xb1')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0xe3c8('0x20')][_0x38d247[_0xe3c8('0xb1')]][_0xe3c8('0x125')]+=0x1;_0x45cfb8[_0xe3c8('0xa4')]=0xb;_0x45cfb8[_0xe3c8('0xa5')]=_0xe3c8('0x126');_0x45cfb8[_0xe3c8('0x11a')]=_0xe3c8('0x127');_0x45cfb8[_0xe3c8('0xf5')]+=0x1;_0x45cfb8[_0xe3c8('0x104')]+=0x1;_0xc4dffd=this['voiceQueues'][_0x38d247[_0xe3c8('0xb1')]][_0xe3c8('0x128')];_0x83bb65=this[_0xe3c8('0x20')][_0x38d247['queue']][_0xe3c8('0x11d')];_0x4e2b7c[_0xe3c8('0xb9')](_0x45cfb8,_0x45cfb8['state'],_0x782406[_0xe3c8('0x11e')])[_0xe3c8('0xb8')](function(_0x61fa2b){if(_0x45cfb8[_0xe3c8('0xf5')]>=_0x4e2b7c['voiceQueues'][_0x38d247[_0xe3c8('0xb1')]][_0xe3c8('0x129')]){_0x4e2b7c['queueCallerAbandonCreateState'](_0x45cfb8,_0x61fa2b[_0xe3c8('0x11f')]);}else{_0x4e2b7c['rescheduleContact']({'active':![],'countabandonedretry':_0x45cfb8[_0xe3c8('0xf5')],'scheduledat':moment()['add'](_0x4e2b7c['voiceQueues'][_0x38d247[_0xe3c8('0xb1')]][_0xe3c8('0x128')],'minutes')[_0xe3c8('0x90')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x782406['ContactId'],'ListId':_0x782406[_0xe3c8('0xd5')],'VoiceQueueId':_0x782406['VoiceQueueId']||undefined,'CampaignId':_0x782406['CampaignId']||undefined})[_0xe3c8('0xae')](loggerCatch(_0xe3c8('0x12a')));var _0x2d509b=new History(_0x45cfb8);_0x2d509b['state']=0xb;_0x2d509b[_0xe3c8('0xa5')]=_0xe3c8('0x126');_0x2d509b[_0xe3c8('0xa7')]=moment()[_0xe3c8('0x90')](_0xe3c8('0xff'));_0x2d509b[_0xe3c8('0xa6')]=_0x2d509b[_0xe3c8('0xa7')];_0x2d509b[_0xe3c8('0x122')]=_0x45cfb8[_0xe3c8('0x122')];_0x2d509b[_0xe3c8('0x123')]=_0x45cfb8['calleridnum'];_0x4e2b7c[_0xe3c8('0xcc')](_0x2d509b)[_0xe3c8('0xae')](loggerCatch(_0xe3c8('0x12b')));}})['then'](function(_0x36030e){if(_0x271fbd)_0x4e2b7c[_0xe3c8('0xbb')](_0x45cfb8,_0xc4dffd,_0x83bb65)[_0xe3c8('0xb8')](function(_0xd978ba){return 0x1;});});}}}};Dialer[_0xe3c8('0x1b')]['syncNewExten']=function(_0x2d5da7){if(this[_0xe3c8('0x26')][_0x2d5da7[_0xe3c8('0xe0')]]){this[_0xe3c8('0x26')][_0x2d5da7[_0xe3c8('0xe0')]][_0xe3c8('0xad')]=_0x2d5da7['channel'];}if(this['uniqueId'][_0x2d5da7[_0xe3c8('0xe0')]]){this[_0xe3c8('0xdf')][_0x2d5da7[_0xe3c8('0xe0')]][_0xe3c8('0xad')]=_0x2d5da7[_0xe3c8('0xad')];}};Dialer[_0xe3c8('0x1b')][_0xe3c8('0x3b')]=function(_0x3f73f4){if(strategy[this[_0xe3c8('0x20')][this['actions'][_0x3f73f4['actionid']][_0xe3c8('0xb1')]][_0xe3c8('0x4f')]]==='roundrobin'){if(this[_0xe3c8('0x26')][_0x3f73f4[_0xe3c8('0x12c')]]&&_[_0xe3c8('0xaa')](this[_0xe3c8('0x26')][_0x3f73f4[_0xe3c8('0x12c')]][_0xe3c8('0x12d')])&&_0x3f73f4['status']==='1'&&_0x3f73f4[_0xe3c8('0x12e')]==='0'){if(this[_0xe3c8('0x22')][_0x3f73f4[_0xe3c8('0x12f')]]){if(!this['agents'][_0x3f73f4[_0xe3c8('0x12f')]][_0xe3c8('0x12d')]){this['agents'][_0x3f73f4[_0xe3c8('0x12f')]][_0xe3c8('0x12d')]=!![];this[_0xe3c8('0x26')][_0x3f73f4[_0xe3c8('0x12c')]][_0xe3c8('0x12d')]=!![];this[_0xe3c8('0x26')][_0x3f73f4['actionid']][_0xe3c8('0x12f')]=_0x3f73f4['stateinterface'];}}}}else if((strategy[this['voiceQueues'][this[_0xe3c8('0x26')][_0x3f73f4[_0xe3c8('0x12c')]][_0xe3c8('0xb1')]]['strategy']]||_0xe3c8('0x19'))===_0xe3c8('0x19')){if(this['actions'][_0x3f73f4[_0xe3c8('0x12c')]]){if(this[_0xe3c8('0x22')][_0x3f73f4[_0xe3c8('0x12f')]]){this[_0xe3c8('0x26')][_0x3f73f4[_0xe3c8('0x12c')]][_0xe3c8('0x12f')]=_0x3f73f4[_0xe3c8('0x12f')];if(_[_0xe3c8('0xaa')](this[_0xe3c8('0x2b')][this[_0xe3c8('0x26')][_0x3f73f4['actionid']][_0xe3c8('0xb1')]])){this['queueBooked'][this[_0xe3c8('0x26')][_0x3f73f4[_0xe3c8('0x12c')]][_0xe3c8('0xb1')]]=[];}this[_0xe3c8('0x2b')][this[_0xe3c8('0x26')][_0x3f73f4['actionid']]['queue']]['push'](_[_0xe3c8('0x89')](_[_0xe3c8('0xd3')](this[_0xe3c8('0x26')][_0x3f73f4['actionid']],[_0xe3c8('0x130'),_0xe3c8('0x12f')]),{'status':_0x3f73f4['status'],'paused':_0x3f73f4['paused']}));}}}};function unlockQueueStatus(_0x27f397,_0x5e898c){setTimeout(function(){if(_['isUndefined'](_0x27f397['queueStatusComplete'])){loggerBooked[_0xe3c8('0x94')](_0xe3c8('0x131'),_0x5e898c);}_0x27f397[_0xe3c8('0x132')]=!![];loggerBooked['info'](_0xe3c8('0x133'),_0x5e898c,JSON['stringify'](_['pick'](_0x27f397,[_0xe3c8('0x40'),_0xe3c8('0x132')])));},0x1f3);}Dialer[_0xe3c8('0x1b')][_0xe3c8('0x134')]=function(_0x99d6eb){var _0x9286b7=this;var _0x4eeb7a=_0x9286b7[_0xe3c8('0x20')][_0x9286b7[_0xe3c8('0x26')][_0x99d6eb[_0xe3c8('0x12c')]][_0xe3c8('0xb1')]];if(strategy[this[_0xe3c8('0x20')][this['actions'][_0x99d6eb[_0xe3c8('0x12c')]][_0xe3c8('0xb1')]][_0xe3c8('0x4f')]]===_0xe3c8('0x1a')){if(this[_0xe3c8('0x26')][_0x99d6eb[_0xe3c8('0x12c')]]&&this[_0xe3c8('0x26')][_0x99d6eb[_0xe3c8('0x12c')]][_0xe3c8('0x12f')]){this[_0xe3c8('0x1f')][_0xe3c8('0x135')](this[_0xe3c8('0x26')][_0x99d6eb[_0xe3c8('0x12c')]][_0xe3c8('0x130')],this['actions'][_0x99d6eb[_0xe3c8('0x12c')]][_0xe3c8('0x12f')])['catch'](function(_0x7fbe50){logger[_0xe3c8('0x94')](_0xe3c8('0x136'),util['inspect'](_0x7fbe50,{'showHidden':![],'depth':null}));})[_0xe3c8('0x1e')](function(){_0x9286b7[_0xe3c8('0xb0')](_0x9286b7[_0xe3c8('0x20')][_0x9286b7['actions'][_0x99d6eb[_0xe3c8('0x12c')]][_0xe3c8('0xb1')]]);_0x9286b7[_0xe3c8('0x22')][_0x9286b7[_0xe3c8('0x26')][_0x99d6eb[_0xe3c8('0x12c')]][_0xe3c8('0x12f')]]['locked']=![];delete _0x9286b7['actions'][_0x99d6eb[_0xe3c8('0x12c')]];unlockQueueStatus(_0x4eeb7a);});}else{this['updateOriginated'](this[_0xe3c8('0x20')][this[_0xe3c8('0x26')][_0x99d6eb[_0xe3c8('0x12c')]][_0xe3c8('0xb1')]]);this[_0xe3c8('0xc0')]({'active':![],'ContactId':this[_0xe3c8('0x26')][_0x99d6eb['actionid']][_0xe3c8('0xd4')],'ListId':this[_0xe3c8('0x26')][_0x99d6eb[_0xe3c8('0x12c')]][_0xe3c8('0xd5')],'VoiceQueueId':this['actions'][_0x99d6eb[_0xe3c8('0x12c')]]['VoiceQueueId']||undefined,'CampaignId':this['actions'][_0x99d6eb[_0xe3c8('0x12c')]][_0xe3c8('0xd7')]||undefined})[_0xe3c8('0xae')](loggerCatch(_0xe3c8('0x137')));delete this[_0xe3c8('0x26')][_0x99d6eb[_0xe3c8('0x12c')]];unlockQueueStatus(_0x4eeb7a);}}else if((strategy[this[_0xe3c8('0x20')][this['actions'][_0x99d6eb[_0xe3c8('0x12c')]]['queue']][_0xe3c8('0x4f')]]||_0xe3c8('0x19'))===_0xe3c8('0x19')){var _0x1a25a0;if(this[_0xe3c8('0x26')][_0x99d6eb['actionid']]&&!_['isEmpty'](this[_0xe3c8('0x2b')][this[_0xe3c8('0x26')][_0x99d6eb['actionid']][_0xe3c8('0xb1')]])){if(this[_0xe3c8('0x138')][_0x9286b7[_0xe3c8('0x26')][_0x99d6eb[_0xe3c8('0x12c')]]['queue']]){this['queueBookedRR'][_0x9286b7[_0xe3c8('0x26')][_0x99d6eb[_0xe3c8('0x12c')]][_0xe3c8('0xb1')]]=this[_0xe3c8('0x138')][this[_0xe3c8('0x26')][_0x99d6eb[_0xe3c8('0x12c')]]['queue']]?this[_0xe3c8('0x138')][this[_0xe3c8('0x26')][_0x99d6eb[_0xe3c8('0x12c')]]['queue']]:this[_0xe3c8('0x2b')][this[_0xe3c8('0x26')][_0x99d6eb[_0xe3c8('0x12c')]]['queue']]?this[_0xe3c8('0x2b')][this[_0xe3c8('0x26')][_0x99d6eb[_0xe3c8('0x12c')]]['queue']]['_rr']||0x0:0x0;}this['queueBooked'][this[_0xe3c8('0x26')][_0x99d6eb[_0xe3c8('0x12c')]][_0xe3c8('0xb1')]][_0xe3c8('0x139')]=this[_0xe3c8('0x138')][this['actions'][_0x99d6eb[_0xe3c8('0x12c')]][_0xe3c8('0xb1')]];for(var _0x37795b=0x0;_0x37795b=0x0;})[_0xe3c8('0xae')](myreject(_0x5bd15c)));}}else{_0xbb7091[_0xe3c8('0x14b')](ami['Action']({'action':_0xe3c8('0x150'),'command':util[_0xe3c8('0x90')](_0xe3c8('0x14c'),_0x4e72ad,!_['isUndefined'](config[_0xe3c8('0x149')][_0x119e0b])?_0x119e0b:'')})[_0xe3c8('0xb8')](function(_0x302e79){return _0x302e79[_0xe3c8('0x14d')][_0xe3c8('0x14e')](_0xe3c8('0x14f'))>=0x0;})[_0xe3c8('0xae')](myreject(_0x5bd15c)));}BPromise[_0xe3c8('0x151')](_0xbb7091)[_0xe3c8('0xb8')](function(_0x1c7034){var _0x1f1fb1=_['some'](_0x1c7034);if(_0x1f1fb1){return _0x3d181a(_0x1f1fb1);}else{_0x12f5e3[_0xe3c8('0x3f')]=_0x801825?_0xe3c8('0x152'):'INTERVAL_IS_OVERTIME';return _0x5bd15c(msgResponse('[ifTime][promiseAll]',_0xe3c8('0x147'),_0xe3c8('0x153')+_0x801825+'\x20'+_0x4afdce+'\x20Interval\x20is\x20overtime:\x20'+util[_0xe3c8('0x93')](_0x4e72ad,{'showHidden':![],'depth':null})+_0xe3c8('0x154')+_0x119e0b));}})[_0xe3c8('0xae')](function(_0x14d42c){return _0x5bd15c(msgResponse('ifTime','Failure',JSON[_0xe3c8('0x49')](_0x14d42c)));});});};Dialer['prototype'][_0xe3c8('0x155')]=function(_0x30ee11){var _0x45a0e3=this;return function(){switch(_0x30ee11[_0xe3c8('0x5b')]){case _0xe3c8('0x156'):freeVariablesPredictive(_0x30ee11);_0x45a0e3['handlePower'](_0x30ee11,0x1);break;case _0xe3c8('0x157'):freeVariablesPredictive(_0x30ee11);_0x45a0e3[_0xe3c8('0x158')](_0x30ee11,_0x30ee11['dialPowerLevel']);break;case'predictive':_0x45a0e3[_0xe3c8('0x8')](_0x30ee11);break;case _0xe3c8('0x159'):freeVariablesPredictive(_0x30ee11);_0x45a0e3[_0xe3c8('0x158')](_0x30ee11,0x1);break;default:freeVariablesPredictive(_0x30ee11);logger[_0xe3c8('0x94')](_0xe3c8('0x15a'),_0x30ee11['name'],_0xe3c8('0x15b'));}};};Dialer[_0xe3c8('0x1b')][_0xe3c8('0x15c')]=function(_0x21673e){var _0x4d72dc=this;return function(){_0x4d72dc[_0xe3c8('0x15d')](_0x21673e);};};Dialer['prototype'][_0xe3c8('0x34')]=function(_0xd2c042){var _0x1b3cb3=this;if(isNotPreview(_0xd2c042[_0xe3c8('0x5b')])){if(isVoiceQueueOutbound(_0xd2c042[_0xe3c8('0x4e')])&&isActive(_0xd2c042[_0xe3c8('0x5a')])){_0xd2c042[_0xe3c8('0x9d')]=!![];BPromise[_0xe3c8('0xb7')]()[_0xe3c8('0xb8')](checkIsLoggedIn(_0xd2c042,_0xd2c042[_0xe3c8('0x15e')]))[_0xe3c8('0xb8')](checkIsActive(_0xd2c042,_0xd2c042[_0xe3c8('0x5a')]))['then'](checkInterval(_0xd2c042))['then'](_0x1b3cb3['checkIsTrunkReachable'](_0xd2c042))[_0xe3c8('0xb8')](_0x1b3cb3[_0xe3c8('0x15f')](_0xd2c042[_0xe3c8('0x160')],_0xd2c042[_0xe3c8('0x161')],_0xd2c042[_0xe3c8('0x40')],_0xd2c042))[_0xe3c8('0xb8')](_0x1b3cb3['checkIfTimeIntervals'](_0xd2c042[_0xe3c8('0x44')],_0xd2c042['dialTimezone'],_0xd2c042['name'],_0xd2c042))[_0xe3c8('0xb8')](_0x1b3cb3[_0xe3c8('0x155')](_0xd2c042))['catch'](loggerCatchQueueSummary(_0xe3c8('0x162'),_0xd2c042));}else{notSendMessagesQueue(_0xd2c042);}}else{freeVariablesPredictive(_0xd2c042);}};Dialer[_0xe3c8('0x1b')][_0xe3c8('0x140')]=function(){var _0x620149=this;var _0x3af681;for(var _0x3b414a in this['campaigns']){if(typeof this[_0xe3c8('0x21')][_0x3b414a]!==_0xe3c8('0x98')){_0x3af681=this[_0xe3c8('0x21')][_0x3b414a];if(isCampaignIvr(_0x3af681['type'])&&isActive(_0x3af681['active'])){_0x3af681[_0xe3c8('0x9d')]=!![];BPromise['resolve']()[_0xe3c8('0xb8')](checkIsActive(_0x3af681,_0x3af681[_0xe3c8('0x76')]))[_0xe3c8('0xb8')](checkInterval(_0x3af681))['then'](_0x620149[_0xe3c8('0x141')](_0x3af681))['then'](_0x620149['checkIfTime'](_0x3af681[_0xe3c8('0x160')],_0x3af681['dialTimezone'],_0x3af681[_0xe3c8('0x40')],_0x3af681))[_0xe3c8('0xb8')](_0x620149[_0xe3c8('0x145')](_0x3af681[_0xe3c8('0x44')],_0x3af681['dialTimezone'],_0x3af681['name'],_0x3af681))[_0xe3c8('0xb8')](_0x620149[_0xe3c8('0x15c')](_0x3af681))[_0xe3c8('0xae')](loggerCatchQueueSummary('[syncCampaigns]',_0x3af681));}else{notSendMessagesCampaign(_0x3af681);}}}};function getCallerIdRandom(_0x525dbd,_0xb42358){var _0x1d45c2;var _0x3f903f;var _0x359c03;if(_0xb42358<=0x0){_0xb42358=0x1;}_0x1d45c2=new RegExp(_0xe3c8('0x163')+_0xb42358+'}$');_0x3f903f=Math[_0xe3c8('0x164')](0xa,_0xb42358-0x1);_0x359c03=Math[_0xe3c8('0x164')](0xa,_0xb42358)-0x1;return util[_0xe3c8('0x90')]('%s',_[_0xe3c8('0x165')](_0x525dbd,_0x1d45c2,_[_0xe3c8('0x166')](_0x3f903f,_0x359c03)));}function extractCalleridName(_0x5b11b7){var _0xa628f2=_0x5b11b7['match'](/"(.*?)"/);return _0xa628f2?_0xa628f2[0x1]:_0x5b11b7;}function extractCalleridNumber(_0x37c404){var _0x2931b0=_0x37c404[_0xe3c8('0x167')](/<(.*?)>/);return _0x2931b0?_0x2931b0[0x1]:_0x37c404;}Dialer[_0xe3c8('0x1b')]['actionOriginate']=function(_0x5af216,_0x455703){var _0x34ad7d=this;var _0x115e47=uuid['v4']();this[_0xe3c8('0x26')][_0x115e47]=new Action(_0x5af216,_0x455703,_0x115e47);return new BPromise(function(_0x15cd8f,_0x22b7f7){if(_[_0xe3c8('0x3e')](_0x5af216)&&typeof _0x5af216!==_0xe3c8('0x168')){return _0x22b7f7(msgResponse(_0xe3c8('0x169'),_0xe3c8('0x147'),_0xe3c8('0x16a')));}if(_[_0xe3c8('0x3e')](_0x455703[_0xe3c8('0x16b')])||_0x455703[_0xe3c8('0x16b')]===null){return _0x22b7f7(msgResponse('originate',_0xe3c8('0x147'),'contact\x20is\x20undefine'));}var _0x39e78c={'XMD-CALLERID':_0x34ad7d[_0xe3c8('0x26')][_0x115e47][_0xe3c8('0x16c')](),'XMD-AGI':_0x5af216[_0xe3c8('0x10b')]?util['format'](_0xe3c8('0x16d'),ipAgi,_0x5af216[_0xe3c8('0x10b')]):_0xe3c8('0x16e'),'XMD-AGIAFTER':_0x5af216[_0xe3c8('0x11b')]?util[_0xe3c8('0x90')](_0xe3c8('0x16d'),ipAgi,_0x5af216['dialQueueProject2']):_0xe3c8('0x16e'),'XMD-QUEUE':_0x5af216[_0xe3c8('0x4e')]===_0xe3c8('0x8e')?util['format'](_0xe3c8('0x16f'),_0x5af216[_0xe3c8('0x40')],_0x5af216[_0xe3c8('0x170')]||'',_0x5af216[_0xe3c8('0x112')]?'c':'',_0x5af216[_0xe3c8('0x118')]||0x3):_0xe3c8('0x16e'),'XMD-CONTACTID':_0x455703['ContactId'],'XMD-CDRTYPE':_0xe3c8('0x7'),'CALLERID(all)':_0x34ad7d[_0xe3c8('0x26')][_0x115e47][_0xe3c8('0x16c')](),'XMD-AMD':_0x5af216['dialAMDActive']?_0xe3c8('0x171'):_0xe3c8('0x16e'),'XMD-DESTINATION':_0xe3c8('0x172')};if(_0x5af216[_0xe3c8('0xea')]){_0x39e78c[_0xe3c8('0x173')]=_0x5af216[_0xe3c8('0x174')]||0x9c4;_0x39e78c[_0xe3c8('0x175')]=_0x5af216[_0xe3c8('0x176')]||0x5dc;_0x39e78c['XMD-AMDAFTERGREETINGSILENCE']=_0x5af216[_0xe3c8('0x177')]||0x320;_0x39e78c['XMD-AMDTOTALANALYSISTIME']=_0x5af216[_0xe3c8('0x178')]||0x1388;_0x39e78c[_0xe3c8('0x179')]=_0x5af216[_0xe3c8('0x17a')]||0x64;_0x39e78c[_0xe3c8('0x17b')]=_0x5af216['dialAMDBetweenWordsSilence']||0x32;_0x39e78c['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x5af216['dialAMDMaximumNumberOfWords']||0x3;_0x39e78c[_0xe3c8('0x17c')]=_0x5af216[_0xe3c8('0x17d')]||0x100;_0x39e78c[_0xe3c8('0x17e')]=_0x5af216['dialAMDMaximumWordLength']||0x1388;}if(_0x5af216['type']===_0xe3c8('0x8e')){_0x39e78c[_0xe3c8('0x17f')]=_0x455703[_0xe3c8('0xd6')];}else{_0x39e78c['XMD-CAMPAIGNID']=_0x455703['CampaignId'];}for(var _0x20da39 in _0x455703[_0xe3c8('0x180')]){if(typeof _0x455703[_0xe3c8('0x180')][_0x20da39]!==_0xe3c8('0x98')){if(isNotNull(_0x455703[_0xe3c8('0x180')][_0x20da39])&&_0x20da39!=='id'&&_0x20da39!==_0xe3c8('0x181')&&_0x20da39!=='createdAt'&&_0x20da39!==_0xe3c8('0x182')){_0x39e78c[util[_0xe3c8('0x90')](_0xe3c8('0x183'),_0xe3c8('0x184'),_[_0xe3c8('0x185')](_0x20da39))]=_0x455703[_0xe3c8('0x180')][_0x20da39];}}}var _0x582cb5=_0x34ad7d[_0xe3c8('0xdc')](_0x5af216[_0xe3c8('0x75')])?getCallerId(_0x5af216[_0xe3c8('0x75')][_0xe3c8('0x77')],_0x5af216['dialOriginateCallerIdName'],_0x5af216[_0xe3c8('0x186')]>0x0?getCallerIdRandom(_0x5af216[_0xe3c8('0x187')],_0x5af216[_0xe3c8('0x186')]):_0x5af216['dialOriginateCallerIdNumber']):getCallerId(_[_0xe3c8('0xaa')](_0x5af216[_0xe3c8('0x188')])?_0x5af216[_0xe3c8('0x75')]['callerid']:_0x5af216['TrunkBackup'][_0xe3c8('0x77')],_0x5af216[_0xe3c8('0x189')],_0x5af216[_0xe3c8('0x186')]>0x0?getCallerIdRandom(_0x5af216['dialOriginateCallerIdNumber'],_0x5af216[_0xe3c8('0x186')]):_0x5af216[_0xe3c8('0x187')]);if(_0x582cb5){_0x39e78c[_0xe3c8('0x18a')]=_0x34ad7d[_0xe3c8('0x26')][_0x115e47][_0xe3c8('0x18b')]=extractCalleridName(_0x582cb5);_0x39e78c[_0xe3c8('0x18c')]=_0x455703['phone'];}return ami[_0xe3c8('0xab')]({'actionid':_0x115e47,'action':_0xe3c8('0x169'),'channel':_0x34ad7d[_0xe3c8('0xdc')](_0x5af216[_0xe3c8('0x75')])?util[_0xe3c8('0x90')](_0xe3c8('0x18d'),_0x5af216[_0xe3c8('0x75')][_0xe3c8('0x40')],isNotNull(_0x5af216[_0xe3c8('0x18e')])?_0x5af216[_0xe3c8('0x18e')][_0xe3c8('0x18f')]()||'':'',_0x5af216[_0xe3c8('0x190')]>0x0?_0x455703[_0xe3c8('0x16b')][_0xe3c8('0x191')](_0x5af216[_0xe3c8('0x190')]):_0x455703['phone']):util['format'](_0xe3c8('0x18d'),_['isNil'](_0x5af216['TrunkBackup'])?_0x5af216[_0xe3c8('0x75')][_0xe3c8('0x40')]:_0x5af216[_0xe3c8('0x188')]['name'],isNotNull(_0x5af216['dialPrefix'])?_0x5af216[_0xe3c8('0x18e')]['trim']()||'':'',_0x5af216[_0xe3c8('0x190')]>0x0?_0x455703[_0xe3c8('0x16b')][_0xe3c8('0x191')](_0x5af216['dialCutDigit']):_0x455703[_0xe3c8('0x16b')]),'callerid':_0x582cb5,'Exten':_0xe3c8('0x172'),'Context':_0xe3c8('0x192'),'Priority':'1','variable':_0x39e78c,'timeout':(_0x5af216[_0xe3c8('0x5c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x115e47})['then'](function(_0x5e7b6a){return _0x15cd8f(_0x5e7b6a);})[_0xe3c8('0xae')](function(_0x1c11cd){_0x5af216['outboundOriginateFailureCallsDay']+=0x1;var _0x540635=new History(_0x34ad7d[_0xe3c8('0x26')][_0x115e47]);logger[_0xe3c8('0x94')](util[_0xe3c8('0x90')]('[originateError]:\x20%s',JSON[_0xe3c8('0x49')](_0x1c11cd)));_0x540635['state']=0xe;_0x540635[_0xe3c8('0xa5')]=_0xe3c8('0x193');_0x540635[_0xe3c8('0xa7')]=moment()[_0xe3c8('0x90')](_0xe3c8('0xff'));_0x540635[_0xe3c8('0xa6')]=_0x540635[_0xe3c8('0xa7')];_0x34ad7d[_0xe3c8('0xcc')](_0x540635)['catch'](loggerCatch('[originate][error]'));_0x34ad7d[_0xe3c8('0xca')](_0x540635)['catch'](loggerCatch(_0xe3c8('0x194')))['finally'](function(){delete _0x34ad7d['actions'][_0x115e47];return _0x22b7f7(msgResponse(_0xe3c8('0x169'),_0xe3c8('0x48'),_0xe3c8('0x195')));});});});};Dialer[_0xe3c8('0x1b')][_0xe3c8('0x32')]=function(_0x3f40c2){var _0x2154a8=this['actions'][_0x3f40c2[_0xe3c8('0x12c')]];if(_0x2154a8){delete this[_0xe3c8('0x26')][_0x3f40c2[_0xe3c8('0x12c')]];_0x2154a8[_0xe3c8('0x196')]=moment()[_0xe3c8('0x90')](_0xe3c8('0xff'));var _0x26ab6a=_0x2154a8['type']===_0xe3c8('0x79')?this[_0xe3c8('0x21')][_0x2154a8[_0xe3c8('0xb1')]]:this[_0xe3c8('0x20')][_0x2154a8['getQueue']()];if(!this[_0xe3c8('0xda')](_0x3f40c2['response'])){this[_0xe3c8('0xb0')](_0x26ab6a);return this[_0xe3c8('0x197')](_0x2154a8,_0x26ab6a,_0x3f40c2)[_0xe3c8('0xae')](loggerCatch(_0xe3c8('0x198')));}this['uniqueId'][_0x3f40c2[_0xe3c8('0xe0')]]=_0x2154a8;}};Dialer[_0xe3c8('0x1b')][_0xe3c8('0x199')]=function(_0x58a177,_0x5072b6,_0x1fb2fa){var _0x17cdef=new History(_0x5072b6);if(_0x17cdef[_0xe3c8('0xf0')]+_0x17cdef[_0xe3c8('0xf1')]+_0x17cdef[_0xe3c8('0xf2')]+_0x17cdef[_0xe3c8('0xf3')]+_0x17cdef['countdropretry']+_0x17cdef[_0xe3c8('0xf5')]+_0x17cdef[_0xe3c8('0xf6')]+_0x17cdef[_0xe3c8('0xf7')]>=_0x1fb2fa[_0xe3c8('0x105')]-0x1){return!![];}switch(_0x58a177){case 0x3:if(_0x17cdef[_0xe3c8('0xf2')]>=_0x1fb2fa[_0xe3c8('0x19a')]-0x1){return!![];}this[_0xe3c8('0xc0')]({'active':![],'countnoanswerretry':_0x17cdef[_0xe3c8('0xf2')]+=0x1,'scheduledat':moment()[_0xe3c8('0x106')](_0x1fb2fa['dialNoAnswerRetryFrequency'],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x17cdef[_0xe3c8('0xd4')],'ListId':_0x17cdef[_0xe3c8('0xd5')],'VoiceQueueId':_0x17cdef[_0xe3c8('0xd6')]||undefined,'CampaignId':_0x17cdef['CampaignId']||undefined})['catch'](loggerCatch(_0xe3c8('0x19b')));break;case 0x5:if(_0x17cdef[_0xe3c8('0xf0')]>=_0x1fb2fa[_0xe3c8('0x19c')]-0x1){return!![];}this[_0xe3c8('0xc0')]({'active':![],'countbusyretry':_0x17cdef[_0xe3c8('0xf0')]+=0x1,'scheduledat':moment()[_0xe3c8('0x106')](_0x1fb2fa[_0xe3c8('0x19d')],_0xe3c8('0xfe'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x17cdef[_0xe3c8('0xd4')],'ListId':_0x17cdef['ListId'],'VoiceQueueId':_0x17cdef['VoiceQueueId']||undefined,'CampaignId':_0x17cdef[_0xe3c8('0xd7')]||undefined})[_0xe3c8('0xae')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x17cdef[_0xe3c8('0xf1')]>=_0x1fb2fa[_0xe3c8('0x19e')]-0x1){return!![];}this[_0xe3c8('0xc0')]({'active':![],'countcongestionretry':_0x17cdef[_0xe3c8('0xf1')]+=0x1,'scheduledat':moment()[_0xe3c8('0x106')](_0x1fb2fa[_0xe3c8('0x19f')],_0xe3c8('0xfe'))[_0xe3c8('0x90')](_0xe3c8('0xff')),'ContactId':_0x17cdef[_0xe3c8('0xd4')],'ListId':_0x17cdef[_0xe3c8('0xd5')],'VoiceQueueId':_0x17cdef[_0xe3c8('0xd6')]||undefined,'CampaignId':_0x17cdef[_0xe3c8('0xd7')]||undefined})[_0xe3c8('0xae')](loggerCatch(_0xe3c8('0x1a0')));break;case 0x0:if(_0x17cdef[_0xe3c8('0xf3')]>=_0x1fb2fa[_0xe3c8('0x1a1')]-0x1){return!![];}else{this[_0xe3c8('0xc0')]({'active':![],'countnosuchnumberretry':_0x17cdef['countnosuchnumberretry']+=0x1,'scheduledat':moment()['add'](_0x1fb2fa[_0xe3c8('0x1a2')],_0xe3c8('0xfe'))['format'](_0xe3c8('0xff')),'ContactId':_0x17cdef['ContactId'],'ListId':_0x17cdef[_0xe3c8('0xd5')],'VoiceQueueId':_0x17cdef[_0xe3c8('0xd6')]||undefined,'CampaignId':_0x17cdef[_0xe3c8('0xd7')]||undefined})[_0xe3c8('0xae')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x17cdef[_0xe3c8('0xf4')]>=_0x1fb2fa[_0xe3c8('0x120')]-0x1){return!![];}this[_0xe3c8('0xc0')]({'active':![],'countdropretry':_0x17cdef[_0xe3c8('0xf4')]+=0x1,'scheduledat':moment()[_0xe3c8('0x106')](_0x1fb2fa[_0xe3c8('0x11c')],'minutes')[_0xe3c8('0x90')](_0xe3c8('0xff')),'ContactId':_0x17cdef[_0xe3c8('0xd4')],'ListId':_0x17cdef[_0xe3c8('0xd5')],'VoiceQueueId':_0x17cdef[_0xe3c8('0xd6')]||undefined,'CampaignId':_0x17cdef[_0xe3c8('0xd7')]||undefined})[_0xe3c8('0xae')](loggerCatch(_0xe3c8('0x121')));break;case 0xb:if(_0x17cdef[_0xe3c8('0xf5')]>=_0x1fb2fa['dialAbandonedMaxRetry']-0x1){return!![];}this[_0xe3c8('0xc0')]({'active':![],'countabandonedretry':_0x17cdef[_0xe3c8('0xf5')]+=0x1,'scheduledat':moment()[_0xe3c8('0x106')](_0x1fb2fa[_0xe3c8('0x128')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x17cdef[_0xe3c8('0xd4')],'ListId':_0x17cdef[_0xe3c8('0xd5')],'VoiceQueueId':_0x17cdef[_0xe3c8('0xd6')]||undefined,'CampaignId':_0x17cdef['CampaignId']||undefined})[_0xe3c8('0xae')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x17cdef[_0xe3c8('0xf6')]>=_0x1fb2fa['dialMachineMaxRetry']-0x1){return!![];}this[_0xe3c8('0xc0')]({'active':![],'countmachineretry':_0x17cdef[_0xe3c8('0xf6')]+=0x1,'scheduledat':moment()[_0xe3c8('0x106')](_0x1fb2fa[_0xe3c8('0xfd')],'minutes')[_0xe3c8('0x90')](_0xe3c8('0xff')),'ContactId':_0x17cdef[_0xe3c8('0xd4')],'ListId':_0x17cdef[_0xe3c8('0xd5')],'VoiceQueueId':_0x17cdef[_0xe3c8('0xd6')]||undefined,'CampaignId':_0x17cdef[_0xe3c8('0xd7')]||undefined})['catch'](loggerCatch(_0xe3c8('0x100')));break;case 0x14:if(_0x17cdef[_0xe3c8('0xf7')]>=_0x1fb2fa[_0xe3c8('0x1a3')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x17cdef[_0xe3c8('0xf7')]+=0x1,'scheduledat':moment()[_0xe3c8('0x106')](_0x1fb2fa[_0xe3c8('0x1a4')],_0xe3c8('0xfe'))[_0xe3c8('0x90')](_0xe3c8('0xff')),'ContactId':_0x17cdef['ContactId'],'ListId':_0x17cdef[_0xe3c8('0xd5')],'VoiceQueueId':_0x17cdef[_0xe3c8('0xd6')]||undefined,'CampaignId':_0x17cdef[_0xe3c8('0xd7')]||undefined})[_0xe3c8('0xae')](loggerCatch(_0xe3c8('0x1a5')));break;default:return!![];}};Dialer['prototype'][_0xe3c8('0x197')]=function(_0x2a3462,_0x46684a,_0x5b8b7a){var _0x5d2e4d=this;var _0x114b59=new History(_0x2a3462);var _0x153713=![];var _0x408b84;var _0x3539ba;return new BPromise(function(_0x17fa7f,_0x2f0c49){if(_[_0xe3c8('0x3e')](_0x46684a)&&typeof _0x46684a!=='object'){return _0x2f0c49(msgResponse(_0xe3c8('0x1a6'),'Failure','entity\x20is\x20undefine'));}if(_[_0xe3c8('0x3e')](_0x5b8b7a)&&typeof _0x5b8b7a!=='object'){return _0x2f0c49(msgResponse('[callProgressDetecting]','Failure',_0xe3c8('0x1a7')));}_0x5d2e4d[_0xe3c8('0xb9')](_0x114b59,_0x5b8b7a[_0xe3c8('0x10f')],_0x46684a)[_0xe3c8('0xb8')](function(_0x59d91a){if(_0x59d91a[_0xe3c8('0x11f')]==0x1)_0x153713=!![];switch(_0x5b8b7a[_0xe3c8('0x10f')]){case'0':_0x46684a['outboundNoSuchCallsDay']+=0x1;_0x114b59['state']=0x0;_0x114b59[_0xe3c8('0xa5')]=_0xe3c8('0x1a8');_0x114b59[_0xe3c8('0xf3')]+=0x1;_0x114b59[_0xe3c8('0x104')]+=0x1;ami['emit'](_0xe3c8('0x1a9'),ut[_0xe3c8('0x101')](_0x2a3462,_0xe3c8('0x1aa')));_0x408b84=_0x46684a['dialNoSuchNumberRetryFrequency'];_0x3539ba=_0x46684a[_0xe3c8('0x11d')];_0x5d2e4d['createHistory'](_0x114b59)['catch'](loggerCatch(_0xe3c8('0xef')));if(_0x5d2e4d[_0xe3c8('0x199')](0x0,_0x2a3462,_0x46684a)&&!_0x153713){if(_0x114b59[_0xe3c8('0xf3')]>=_0x46684a[_0xe3c8('0x1a1')]){_0x5d2e4d[_0xe3c8('0xfb')](_0x114b59,_0x17fa7f,_0x2f0c49,_0xe3c8('0x1ab'));}else{_0x5d2e4d[_0xe3c8('0xf8')](_0x114b59,_0x17fa7f,_0x2f0c49,_0xe3c8('0x1ab'));}}break;case'3':_0x46684a['outboundNoAnswerCallsDay']+=0x1;_0x114b59[_0xe3c8('0xa4')]=0x3;_0x114b59['statedesc']=_0xe3c8('0x1ac');_0x114b59[_0xe3c8('0xf2')]+=0x1;_0x114b59[_0xe3c8('0x104')]+=0x1;ami[_0xe3c8('0x4d')]('custom:agentnoanswer',ut[_0xe3c8('0x101')](_0x2a3462,_0xe3c8('0x1ad')));_0x408b84=_0x46684a[_0xe3c8('0x1ae')];_0x3539ba=_0x46684a[_0xe3c8('0x11d')];_0x5d2e4d[_0xe3c8('0xcc')](_0x114b59)[_0xe3c8('0xae')](loggerCatch(_0xe3c8('0x1af')));if(_0x5d2e4d[_0xe3c8('0x199')](0x3,_0x2a3462,_0x46684a)&&!_0x153713){if(_0x114b59[_0xe3c8('0xf2')]>=_0x46684a['dialNoAnswerMaxRetry']){_0x5d2e4d[_0xe3c8('0xfb')](_0x114b59,_0x17fa7f,_0x2f0c49,_0xe3c8('0x1b0'));}else{_0x5d2e4d['stateGlobal'](_0x114b59,_0x17fa7f,_0x2f0c49,_0xe3c8('0x1b0'));}}break;case'5':_0x46684a[_0xe3c8('0x60')]+=0x1;_0x114b59[_0xe3c8('0xa4')]=0x5;_0x114b59[_0xe3c8('0xa5')]=_0xe3c8('0x1b1');_0x114b59[_0xe3c8('0xf0')]+=0x1;_0x114b59[_0xe3c8('0x104')]+=0x1;ami['emit']('custom:agentbusy',ut[_0xe3c8('0x101')](_0x2a3462,_0xe3c8('0x1b2')));_0x408b84=_0x46684a['dialBusyRetryFrequency'];_0x3539ba=_0x46684a[_0xe3c8('0x11d')];_0x5d2e4d[_0xe3c8('0xcc')](_0x114b59)['catch'](loggerCatch(_0xe3c8('0x1b3')));if(_0x5d2e4d[_0xe3c8('0x199')](0x5,_0x2a3462,_0x46684a)&&!_0x153713){if(_0x114b59[_0xe3c8('0xf0')]>=_0x46684a[_0xe3c8('0x19c')]){_0x5d2e4d[_0xe3c8('0xfb')](_0x114b59,_0x17fa7f,_0x2f0c49,_0xe3c8('0x1b4'));}else{_0x5d2e4d[_0xe3c8('0xf8')](_0x114b59,_0x17fa7f,_0x2f0c49,_0xe3c8('0x1b4'));}}break;case'8':_0x46684a['outboundCongestionCallsDay']+=0x1;_0x114b59['state']=0x8;_0x114b59[_0xe3c8('0xa5')]=_0xe3c8('0x1b5');_0x114b59[_0xe3c8('0xf1')]+=0x1;_0x114b59[_0xe3c8('0x104')]+=0x1;_0x408b84=_0x46684a['dialCongestionRetryFrequency'];_0x3539ba=_0x46684a[_0xe3c8('0x11d')];ami[_0xe3c8('0x4d')](_0xe3c8('0x1b6'),ut[_0xe3c8('0x101')](_0x2a3462,'congestion'));_0x5d2e4d[_0xe3c8('0xcc')](_0x114b59)[_0xe3c8('0xae')](loggerCatch(_0xe3c8('0x1b7')));if(_0x5d2e4d['checkRetriveMax'](0x8,_0x2a3462,_0x46684a)&&!_0x153713){if(_0x114b59[_0xe3c8('0xf1')]>=_0x46684a[_0xe3c8('0x19e')]){_0x5d2e4d[_0xe3c8('0xfb')](_0x114b59,_0x17fa7f,_0x2f0c49,_0xe3c8('0x1b8'));}else{_0x5d2e4d['stateGlobal'](_0x114b59,_0x17fa7f,_0x2f0c49,_0xe3c8('0x1b8'));}}break;case'11':_0x46684a[_0xe3c8('0x1b9')]+=0x1;_0x114b59['state']=0xb;_0x114b59[_0xe3c8('0xa5')]=_0xe3c8('0x126');_0x114b59['countabandonedretry']+=0x1;_0x114b59[_0xe3c8('0x104')]+=0x1;_0x408b84=_0x46684a['dialAbandonedRetryFrequency'];_0x3539ba=_0x46684a[_0xe3c8('0x11d')];_0x5d2e4d[_0xe3c8('0xcc')](_0x114b59)[_0xe3c8('0xae')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x5d2e4d[_0xe3c8('0x199')](0xb,_0x2a3462,_0x46684a)&&!_0x153713){if(_0x114b59[_0xe3c8('0xf5')]>=_0x46684a[_0xe3c8('0x129')]){_0x5d2e4d[_0xe3c8('0xfb')](_0x114b59,_0x17fa7f,_0x2f0c49,_0xe3c8('0x1ba'));}else{_0x5d2e4d[_0xe3c8('0xf8')](_0x114b59,_0x17fa7f,_0x2f0c49,_0xe3c8('0x1ba'));}}break;case'20':_0x46684a[_0xe3c8('0x1bb')]+=0x1;_0x114b59[_0xe3c8('0xa4')]=0x14;_0x114b59[_0xe3c8('0xa5')]=_0xe3c8('0x1bc');_0x114b59[_0xe3c8('0xf7')]+=0x1;_0x114b59[_0xe3c8('0x104')]+=0x1;_0x408b84=_0x46684a[_0xe3c8('0x1a4')];_0x3539ba=_0x46684a[_0xe3c8('0x11d')];ami[_0xe3c8('0x4d')](_0xe3c8('0x1bd'),ut[_0xe3c8('0x101')](_0x2a3462,_0xe3c8('0x1be')));_0x5d2e4d['createHistory'](_0x114b59)[_0xe3c8('0xae')](loggerCatch(_0xe3c8('0x1bf')));if(_0x5d2e4d['checkRetriveMax'](0x14,_0x2a3462,_0x46684a)&&!_0x153713){if(_0x114b59['countagentrejectretry']>=_0x46684a[_0xe3c8('0x1a3')]){_0x5d2e4d[_0xe3c8('0xfb')](_0x114b59,_0x17fa7f,_0x2f0c49,_0xe3c8('0x1c0'));}else{_0x5d2e4d[_0xe3c8('0xf8')](_0x114b59,_0x17fa7f,_0x2f0c49,_0xe3c8('0x1c0'));}}break;default:_0x46684a[_0xe3c8('0x10c')]+=0x1;_0x114b59[_0xe3c8('0xa4')]=0xc;_0x114b59[_0xe3c8('0xa5')]=_0x5b8b7a[_0xe3c8('0x10f')];_0x408b84=_0x46684a[_0xe3c8('0x1a4')];_0x3539ba=_0x46684a[_0xe3c8('0x11d')];_0x5d2e4d[_0xe3c8('0xcc')](_0x114b59)[_0xe3c8('0xae')](loggerCatch(_0xe3c8('0x1c1')));if(_0x5d2e4d['checkRetriveMax'](_0x5b8b7a['reason'],_0x2a3462,_0x46684a)&&!_0x153713){if(_0x114b59[_0xe3c8('0xf0')]+_0x114b59[_0xe3c8('0xf1')]+_0x114b59['countnoanswerretry']+_0x114b59[_0xe3c8('0xf3')]+_0x114b59[_0xe3c8('0xf4')]+_0x114b59['countabandonedretry']+_0x114b59[_0xe3c8('0xf6')]+_0x114b59[_0xe3c8('0xf7')]>=_0x46684a[_0xe3c8('0x105')]){_0x5d2e4d['stateGlobal'](_0x114b59,_0x17fa7f,_0x2f0c49,_0x5b8b7a['reason']);}else{_0x5d2e4d[_0xe3c8('0xfb')](_0x114b59,_0x17fa7f,_0x2f0c49,_0x5b8b7a[_0xe3c8('0x10f')]);}}}})[_0xe3c8('0xb8')](function(_0x3c3989){if(_0x153713){_0x5d2e4d['swapAdditionalPhones'](_0x114b59,_0x408b84,_0x3539ba)[_0xe3c8('0xb8')](function(_0x536c5a){return _0x17fa7f(0x1);});}});});};Dialer[_0xe3c8('0x1b')][_0xe3c8('0xf8')]=function(_0x355c23,_0x2f3821,_0x171b7c,_0xa00267){var _0x25bc94=new Final(_0x355c23);_0x25bc94[_0xe3c8('0xa4')]=0xf;_0x25bc94[_0xe3c8('0xa5')]=_0xe3c8('0x1c2');this['createStateFinal'](_0x25bc94,_0x2f3821,_0x171b7c,_0xa00267);};Dialer[_0xe3c8('0x1b')][_0xe3c8('0xfb')]=function(_0x393b30,_0x3bb92c,_0x4b0a28,_0x2fda39){this[_0xe3c8('0xca')](_0x393b30)[_0xe3c8('0xb8')](function(){return _0x3bb92c(msgResponse(_0xe3c8('0x1a6'),'Success',_0x2fda39));})[_0xe3c8('0xae')](function(){return _0x4b0a28(msgResponse('[moveContactManagedDialer][0]','Failure',_0xe3c8('0x1c3')));});};Dialer[_0xe3c8('0x1b')][_0xe3c8('0x8')]=function(_0x109fdb){var _0x537794=_0x109fdb['dialPredictiveOptimizationPercentage']/0x64;var _0x9c4816=_0x109fdb[_0xe3c8('0x63')]/(_0x109fdb['outboundDropCallsDayTimeout']+_0x109fdb['outboundAnswerCallsDay']);var _0x135d95=Math[_0xe3c8('0x1c4')](_0x109fdb[_0xe3c8('0x6e')]*(_0x109fdb[_0xe3c8('0x1c5')]/0x64));var _0xa6cbdb=Math['round'](_0x109fdb[_0xe3c8('0x6e')]*(_0x109fdb[_0xe3c8('0x1c6')]/0x64));var _0x441f5e=_0x109fdb['available']+_0x109fdb[_0xe3c8('0x55')];var _0x2e9e19=Math[_0xe3c8('0x1c7')](_0x109fdb[_0xe3c8('0x70')]*_0x109fdb['erlangAbandonmentRate']*_0x109fdb[_0xe3c8('0x6b')]*_0x109fdb['predictiveIntervalMultiplicativeFactor']);if(_['isUndefined'](_0x109fdb[_0xe3c8('0x74')])){if(!_['isUndefined'](_0x109fdb[_0xe3c8('0x29')])){_0x109fdb[_0xe3c8('0x29')]=undefined;loggerPredictive[_0xe3c8('0x94')]('[startMethodPredictive][StartProgressive]',_0xe3c8('0x1c8'));}if(!_[_0xe3c8('0x3e')](_0x109fdb['handlePredictive'])){loggerPredictive[_0xe3c8('0x94')](_0xe3c8('0x1c9'),_0xe3c8('0x1ca'));clearInterval(_0x109fdb['handlePredictive']);_0x109fdb[_0xe3c8('0x8c')]=undefined;}_0x109fdb['startProgressive']=moment()['format'](_0xe3c8('0xff'));loggerPredictive[_0xe3c8('0x7c')](_0x109fdb[_0xe3c8('0x40')],_0xe3c8('0x1cb'),_0x109fdb[_0xe3c8('0x74')]);this[_0xe3c8('0x158')](_0x109fdb,0x1);}else if(ifInterval(_0x109fdb[_0xe3c8('0x1cc')],_0x109fdb[_0xe3c8('0x74')])){this[_0xe3c8('0x158')](_0x109fdb,0x1);loggerPredictiveCalls['info'](_0xe3c8('0x1cd'),_0x109fdb[_0xe3c8('0x74')],_0x109fdb[_0xe3c8('0x40')]);_0x109fdb[_0xe3c8('0x70')]=0x0;_0x109fdb[_0xe3c8('0x6a')]=0x0;}else if(_0x537794<_0x9c4816&&_0x109fdb[_0xe3c8('0x1ce')]==='dropRate'){freeVariablesPredictive(_0x109fdb);loggerPredictive[_0xe3c8('0x7c')](_0xe3c8('0x1cf'),_0xe3c8('0x1d0'),_0x9c4816,'startProgressive',_0x109fdb[_0xe3c8('0x40')]);}else if(_0x2e9e19<_0x109fdb['predictiveIntervalErlangCallsDroppedCalls']&&_0x109fdb[_0xe3c8('0x1ce')]==='dropRate'){freeVariablesPredictive(_0x109fdb);loggerPredictive[_0xe3c8('0x7c')](_0xe3c8('0x1d1'),_0xe3c8('0x1d2'),_0x2e9e19,_0xe3c8('0x1d3'),_0x109fdb['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0x109fdb[_0xe3c8('0x40')]);}else if(!ifInterval(_0x109fdb[_0xe3c8('0x1cc')],_0x109fdb[_0xe3c8('0x74')])&&_['isUndefined'](_0x109fdb['startPredictive'])&&!_[_0xe3c8('0x3e')](_0x109fdb[_0xe3c8('0x74')])){_0x109fdb[_0xe3c8('0x29')]=moment()[_0xe3c8('0x90')](_0xe3c8('0xff'));loggerPredictive[_0xe3c8('0x7c')](_0x109fdb[_0xe3c8('0x40')],_0xe3c8('0x1d4'),_0x109fdb[_0xe3c8('0x29')]);this[_0xe3c8('0xbe')](_0x109fdb[_0xe3c8('0x1cc')])[_0xe3c8('0xb8')](this[_0xe3c8('0x1d5')](_0x109fdb))['then'](mergeDataErlangB(_0x109fdb))[_0xe3c8('0xb8')](this[_0xe3c8('0x1d6')](_0x109fdb))[_0xe3c8('0xae')](loggerCatchPredictive(_0xe3c8('0x1d7'),_0x109fdb));}else if(!ifInterval(_0x109fdb['dialPredictiveInterval'],_0x109fdb[_0xe3c8('0x29')])){_0x109fdb['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x109fdb['startPredictive']=moment()[_0xe3c8('0x90')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x109fdb['name'],'recalculate\x20predictive\x20at',_0x109fdb['startPredictive']);clearInterval(_0x109fdb[_0xe3c8('0x8c')]);_0x109fdb['handlePredictive']=undefined;this[_0xe3c8('0xbe')](_0x109fdb[_0xe3c8('0x1cc')])[_0xe3c8('0xb8')](this[_0xe3c8('0x1d5')](_0x109fdb))[_0xe3c8('0xb8')](mergeDataErlangB(_0x109fdb))[_0xe3c8('0xb8')](this['startMethodPredictive'](_0x109fdb))['catch'](loggerCatchPredictive(_0xe3c8('0x1d8'),_0x109fdb));}else if(_0x109fdb[_0xe3c8('0x6e')]&&_0x441f5e<_0x109fdb[_0xe3c8('0x6e')]-_0xa6cbdb){freeVariablesPredictive(_0x109fdb);loggerPredictive[_0xe3c8('0x7c')](_0x109fdb[_0xe3c8('0x40')],_0xe3c8('0x1d9'),_0x441f5e,_0xe3c8('0x1da'),_0x109fdb[_0xe3c8('0x6e')],'-',_0xa6cbdb,'=',_0x109fdb['predictiveIntervalAvailable']-_0xa6cbdb,')');}else if(_0x109fdb['predictiveIntervalAvailable']&&_0x441f5e>_0x109fdb[_0xe3c8('0x6e')]+_0x135d95){freeVariablesPredictive(_0x109fdb);loggerPredictive[_0xe3c8('0x7c')](_0x109fdb[_0xe3c8('0x40')],_0xe3c8('0x1d9'),_0x441f5e,_0xe3c8('0x1db'),_0x109fdb[_0xe3c8('0x6e')],'+',_0x135d95,'=',_0x109fdb[_0xe3c8('0x6e')]+_0x135d95,')');}};Dialer['prototype'][_0xe3c8('0x1d5')]=function(_0x44668b){var _0x560480=this;return function(_0x24177e){return new BPromise(function(_0xe0ddd9,_0x1e9fc0){_[_0xe3c8('0x89')](_0x44668b,_0x24177e[0x0]);if(checkGetDataPredictive(_0x24177e[0x0])){var _0x434d75=_0x44668b['predictiveIntervalAvailable']=_0x44668b[_0xe3c8('0x55')]+_0x44668b[_0xe3c8('0x51')];var _0x309dd5=_0x44668b[_0xe3c8('0x1cc')]*0x3c;var _0xd6cd51=_0x24177e[0x0][_0xe3c8('0x68')]+_0x24177e[0x0][_0xe3c8('0x67')];var _0x2aff50=(_0x24177e[0x0]['predictiveIntervalAnsweredCalls']+_0x24177e[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x24177e[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x24177e[0x0][_0xe3c8('0x6f')];_0x44668b['predictiveIntervalHitRate']=_0x2aff50>0x0?_0x2aff50:0x1;switch(_0x44668b[_0xe3c8('0x1ce')]){case _0xe3c8('0x1dc'):var _0x45d14a=_0x44668b[_0xe3c8('0x1dd')]/0x64;return _0x560480[_0xe3c8('0x1de')](_0x434d75,_0x309dd5,_0xd6cd51,_0x2aff50,_0x45d14a)[_0xe3c8('0xb8')](function(_0x1ae2f0){return _0xe0ddd9(_0x1ae2f0);});case _0xe3c8('0x1df'):var _0x3eb836=_0x44668b['dialPredictiveOptimizationPercentage']/0x64;return _0x560480[_0xe3c8('0x1e0')](_0x434d75,_0x309dd5,_0xd6cd51,_0x2aff50,_0x3eb836)[_0xe3c8('0xb8')](function(_0x175471){return _0xe0ddd9(_0x175471);});default:return _0x1e9fc0(msgResponse('[getDataPredictive]',_0xe3c8('0x147'),'Unknown\x20Predictive'));}}else{return _0x1e9fc0(msgResponse('[getDataPredictive]',_0xe3c8('0x147'),_0xe3c8('0x1e1')));}});};};Dialer['prototype'][_0xe3c8('0x1e2')]=function(_0x4dd42b){var _0x3c1c31=this;return function(_0x48706d){return new BPromise(function(_0x1e80ce,_0x3d8cce){_[_0xe3c8('0x89')](_0x4dd42b,_0x48706d[0x0]);if(checkGetDataPredictive(_0x48706d[0x0])){loggerPredictive[_0xe3c8('0x7c')](JSON[_0xe3c8('0x49')](_0x48706d[0x0]));if(_0x4dd42b[_0xe3c8('0x1ce')]===_0xe3c8('0x1dc')){return _0x3c1c31['getVoiceQueueRtPauses'](_0x4dd42b['id'])[_0xe3c8('0xb8')](function(_0x4f056e){var _0x4124f6=_0x4dd42b[_0xe3c8('0x15e')]-_0x4f056e[0x0][_0xe3c8('0x1e3')];var _0x3f33e2=_0x4dd42b['dialPredictiveInterval']*0x3c;var _0x35efa8=_0x48706d[0x0][_0xe3c8('0x68')]+_0x48706d[0x0][_0xe3c8('0x67')];var _0x3d1a59=(_0x48706d[0x0][_0xe3c8('0x1e4')]+_0x48706d[0x0][_0xe3c8('0x80')]+_0x48706d[0x0][_0xe3c8('0x69')])/_0x48706d[0x0][_0xe3c8('0x6f')];var _0x2af7a8=_0x4dd42b[_0xe3c8('0x1dd')]/0x64;_0x4dd42b['predictiveIntervalPauses']=_0x4f056e[0x0][_0xe3c8('0x1e3')]||0x0;_0x4dd42b[_0xe3c8('0x6b')]=_0x3d1a59>0x0?_0x3d1a59:0x1;return _0x3c1c31[_0xe3c8('0x1de')](_0x4124f6,_0x3f33e2,_0x35efa8,_0x3d1a59,_0x2af7a8);})[_0xe3c8('0xb8')](function(_0x3f6b67){return _0x1e80ce(_0x3f6b67);})[_0xe3c8('0xae')](function(_0x5b9e1f){return _0x3d8cce(msgResponse(_0xe3c8('0x1e5'),_0xe3c8('0x147'),JSON[_0xe3c8('0x49')](_0x5b9e1f)));});}if(_0x4dd42b[_0xe3c8('0x1ce')]===_0xe3c8('0x1df')){return _0x3c1c31['getVoiceQueueRtPauses'](_0x4dd42b['id'])[_0xe3c8('0xb8')](function(_0x217353){var _0x34e536=_0x4dd42b[_0xe3c8('0x15e')]-_0x217353[0x0][_0xe3c8('0x1e3')];var _0x13ad89=_0x4dd42b[_0xe3c8('0x1cc')]*0x3c;var _0x41e0fe=_0x48706d[0x0][_0xe3c8('0x68')]+_0x48706d[0x0]['predictiveIntervalAvgHoldtime'];var _0x424fc3=(_0x48706d[0x0]['predictiveIntervalAnsweredCalls']+_0x48706d[0x0][_0xe3c8('0x80')]+_0x48706d[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x48706d[0x0][_0xe3c8('0x6f')];var _0x4b22f6=_0x4dd42b[_0xe3c8('0x1dd')]/0x64;_0x4dd42b[_0xe3c8('0x6d')]=_0x217353[0x0][_0xe3c8('0x1e3')]||0x0;_0x4dd42b[_0xe3c8('0x6b')]=_0x424fc3>0x0?_0x424fc3:0x1;return _0x3c1c31[_0xe3c8('0x1e0')](_0x34e536,_0x13ad89,_0x41e0fe,_0x424fc3,_0x4b22f6);})[_0xe3c8('0xb8')](function(_0x428dc8){return _0x1e80ce(_0x428dc8);})[_0xe3c8('0xae')](function(_0x39266f){return _0x3d8cce(msgResponse('[CatchErlangB]',_0xe3c8('0x147'),JSON[_0xe3c8('0x49')](_0x39266f)));});}}else{return _0x3d8cce(msgResponse(_0xe3c8('0x1e6'),_0xe3c8('0x147'),'check\x20failure'));}});};};Dialer['prototype'][_0xe3c8('0x1d6')]=function(_0x102528){var _0x47330a=this;return function(){var _0x15e498=0x0;var _0x432687=Math['floor'](_0x102528[_0xe3c8('0x71')]*0x3e8);if(_0x432687>0x0){_0x432687=_0x432687<0x64?0x64:_0x432687;loggerPredictive[_0xe3c8('0x7c')](_0x102528[_0xe3c8('0x40')],_0xe3c8('0x1e7'),_0x432687,_0xe3c8('0x4a'));_0x102528[_0xe3c8('0x8c')]=setInterval(function(){_0x47330a[_0xe3c8('0x8c')](_0x102528);loggerPredictiveCalls[_0xe3c8('0x7c')]('[handlePredictive]',_0x15e498+=0x1);},_0x432687);}else{loggerPredictive[_0xe3c8('0x7c')](_0x102528[_0xe3c8('0x40')],_0xe3c8('0x1e8'));}};};Dialer[_0xe3c8('0x1b')][_0xe3c8('0x1e9')]=function(_0x4ae3e6,_0x3ad527){var _0x4858e9=this;return function(_0x4b4cc4){if(_[_0xe3c8('0x46')](_0x4b4cc4)){if(_[_0xe3c8('0xaa')](_0x3ad527[_0xe3c8('0x1ea')])||!_0x3ad527[_0xe3c8('0x1eb')]){if(_0x4ae3e6[_0xe3c8('0x5b')]===_0xe3c8('0x159')){_0x4ae3e6[_0xe3c8('0x132')]=_[_0xe3c8('0x3e')](_0x4ae3e6[_0xe3c8('0x132')])?!![]:_0x4ae3e6['queueStatusComplete'];var _0x2feb80=uuid['v4']();_0x4858e9[_0xe3c8('0x26')][_0x2feb80]=new Action(_0x4ae3e6,_0x3ad527,_0x2feb80);loggerBooked[_0xe3c8('0x7c')](_0xe3c8('0x1ec'),_0x2feb80,_0xe3c8('0x1ed'),JSON[_0xe3c8('0x49')](_0x4ae3e6[_0xe3c8('0x132')]),_0xe3c8('0x1ee'),_0x4ae3e6[_0xe3c8('0x40')]);if(_0x4ae3e6[_0xe3c8('0x132')]){_0x4ae3e6['queueStatusComplete']=![];_0x4858e9[_0xe3c8('0x2b')][_0x4858e9[_0xe3c8('0x26')][_0x2feb80][_0xe3c8('0xb1')]]=[];ami[_0xe3c8('0xab')]({'actionid':_0x2feb80,'action':_0xe3c8('0x1ef'),'queue':_0x4ae3e6[_0xe3c8('0x40')]})['catch'](function(){_0x4858e9[_0xe3c8('0xb0')](_0x4ae3e6);_0x4858e9[_0xe3c8('0xc0')]({'active':![],'ContactId':_0x4858e9[_0xe3c8('0x26')][_0x2feb80][_0xe3c8('0xd4')],'ListId':_0x4858e9[_0xe3c8('0x26')][_0x2feb80][_0xe3c8('0xd5')],'VoiceQueueId':_0x4858e9[_0xe3c8('0x26')][_0x2feb80][_0xe3c8('0xd6')]||undefined,'CampaignId':_0x4858e9[_0xe3c8('0x26')][_0x2feb80][_0xe3c8('0xd7')]||undefined})['catch'](loggerCatch(_0xe3c8('0x1f0')));delete _0x4858e9[_0xe3c8('0x26')][_0x2feb80];});}else{loggerBooked['info'](_0xe3c8('0x1f1'),JSON[_0xe3c8('0x49')](_0x4ae3e6[_0xe3c8('0x132')]),'Queue:\x20',_0x4ae3e6[_0xe3c8('0x40')]);_0x4858e9[_0xe3c8('0xb0')](_0x4ae3e6);_0x4858e9['rescheduleContact']({'active':![],'ContactId':_0x4858e9[_0xe3c8('0x26')][_0x2feb80]['ContactId'],'ListId':_0x4858e9[_0xe3c8('0x26')][_0x2feb80]['ListId'],'VoiceQueueId':_0x4858e9[_0xe3c8('0x26')][_0x2feb80]['VoiceQueueId']||undefined,'CampaignId':_0x4858e9[_0xe3c8('0x26')][_0x2feb80]['CampaignId']||undefined})[_0xe3c8('0xae')](loggerCatch(_0xe3c8('0x1f0')));delete _0x4858e9['actions'][_0x2feb80];}}else{return _0x4858e9[_0xe3c8('0x1f2')](_0x4ae3e6,_0x3ad527);}}else{if(getDiff(_0x3ad527[_0xe3c8('0x1f3')])<_0x4ae3e6[_0xe3c8('0x1f4')]*0x3c){if(_0x3ad527[_0xe3c8('0x1f5')]&&!_0x3ad527[_0xe3c8('0x1f5')]['voicePause']){_0x4858e9[_0xe3c8('0x1f')][_0xe3c8('0x135')](_0x3ad527['id'])[_0xe3c8('0x1e')](function(){_0x4858e9[_0xe3c8('0xb0')](_0x4ae3e6);});}else{_0x4858e9[_0xe3c8('0xc2')]({'active':![]},_0x3ad527['id'],0x1)[_0xe3c8('0x1e')](function(){_0x4858e9[_0xe3c8('0xb0')](_0x4ae3e6);});}}else{_0x4ae3e6[_0xe3c8('0x1f6')]+=0x1;_0x4858e9[_0xe3c8('0xb0')](_0x4ae3e6);if(_0x4ae3e6['dialRecallInQueue']){_0x4858e9['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x3ad527['ContactId'],'ListId':_0x3ad527['ListId'],'VoiceQueueId':_0x3ad527[_0xe3c8('0xd6')]||undefined,'CampaignId':_0x3ad527[_0xe3c8('0xd7')]||undefined})[_0xe3c8('0xae')](loggerCatch(_0xe3c8('0x1f7')));_0x4858e9['createHistory'](createObjHistory(_0x4ae3e6,_0x3ad527,_0xe3c8('0x1f8'),0x17,_0xe3c8('0x1f9')))[_0xe3c8('0xae')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x4858e9['saveInDb'](createObjHistory(_0x4ae3e6,_0x3ad527,_0xe3c8('0x1fa'),0x16,'RecallFailedTimeout'),_0xe3c8('0x1fb'),_0xe3c8('0x1fc'));}}}}else{_0x4ae3e6[_0xe3c8('0x5f')]+=0x1;_0x4858e9['saveInDb'](createObjHistory(_0x4ae3e6,_0x3ad527,_0xe3c8('0x1fd'),0xd,'Blacklist'),_0xe3c8('0x1fe'),_0xe3c8('0x1ff'));throw _0xe3c8('0x200');}};};Dialer[_0xe3c8('0x1b')][_0xe3c8('0x15d')]=function(_0x575617){var _0x2d122d=this;var _0x448a62=_0x575617['limitCalls']-_0x575617[_0xe3c8('0x97')]-_0x575617['temp'];emitCampaignSummary(_0x575617);if(_0x448a62>0x0){if(_0x448a62>this[_0xe3c8('0x24')]){_0x448a62=this[_0xe3c8('0x24')];}_0x575617[_0xe3c8('0xc5')]+=_0x448a62;this[_0xe3c8('0xc7')](_0x575617['id'],_0x448a62,_0x575617[_0xe3c8('0x201')],_0x575617)[_0xe3c8('0xb8')](function(_0x3f5b8d){_0x575617[_0xe3c8('0xc5')]-=_0x448a62;_0x575617['temp']=_0x575617[_0xe3c8('0xc5')]>0x0?_0x575617[_0xe3c8('0xc5')]:0x0;if(!checkContactEmpty(_0x3f5b8d)){_0x575617[_0xe3c8('0x3f')]='AVAILABLE_CONTACTS_FINISHED';logger['info'](_0xe3c8('0x202')+_0x575617['name']);}else{_0x575617['originated']+=_0x3f5b8d[_0xe3c8('0x96')];_0x575617[_0xe3c8('0x3f')]=_0xe3c8('0x203');for(var _0xe5b712=0x0;_0xe5b712<_0x3f5b8d[_0xe3c8('0x96')];_0xe5b712+=0x1){_0x575617[_0xe3c8('0x204')]+=0x1;if(_['isNil'](_0x3f5b8d[_0xe5b712])||_[_0xe3c8('0xaa')](_0x3f5b8d[_0xe5b712][_0xe3c8('0x180')])||_[_0xe3c8('0xaa')](_0x3f5b8d[_0xe5b712][_0xe3c8('0x16b')])){_0x2d122d[_0xe3c8('0xd1')](_0xe3c8('0x205'),_0x575617,_0x3f5b8d[_0xe5b712]);}else{_0x2d122d[_0xe3c8('0xbc')](_[_0xe3c8('0xd3')](_0x3f5b8d[_0xe5b712],[_0xe3c8('0xd7'),_0xe3c8('0x206')]))['then'](_0x2d122d['checkContactBlack'](_0x575617,_0x3f5b8d[_0xe5b712]))[_0xe3c8('0xae')](_0x2d122d[_0xe3c8('0xd0')](_0xe3c8('0x207'),_0x575617));}}}})['catch'](loggerGetContactDialer(_0xe3c8('0x208'),_0x575617,_0x448a62));}};Dialer[_0xe3c8('0x1b')][_0xe3c8('0x158')]=function(_0x47c3cd,_0x4ead34){var _0xe86f4d=this;var _0xe15ac7=[];var _0x17a8ec=_0x4ead34>=0x1?_0x4ead34:0x1;if(_0x47c3cd['dialMethod']===_0xe3c8('0x159')){_0x17a8ec=0x1;}var _0x4e9084=Math[_0xe3c8('0x1c7')](_0x47c3cd[_0xe3c8('0x51')]*_0x17a8ec)-_0x47c3cd[_0xe3c8('0x97')]-_0x47c3cd[_0xe3c8('0xc5')];emitVoiceQueueSummary(_0x47c3cd);if(_0x47c3cd[_0xe3c8('0x209')]>0x0){var _0x5b1b16=_0x47c3cd['dialLimitQueue']-_0x47c3cd[_0xe3c8('0x97')]-_0x47c3cd[_0xe3c8('0x55')]-_0x47c3cd['temp']-_0x47c3cd[_0xe3c8('0x52')];if(_0x4e9084>_0x5b1b16){_0x4e9084=_0x5b1b16;}}if(_0x4e9084>0x0){if(_0x47c3cd[_0xe3c8('0x5b')]===_0xe3c8('0x159')){_0x4e9084=0x1;}if(_0x4e9084>this[_0xe3c8('0x24')]){_0x4e9084=this[_0xe3c8('0x24')];}_0x47c3cd['temp']+=_0x4e9084;for(var _0x3e5357 in this[_0xe3c8('0x22')]){if(typeof this[_0xe3c8('0x22')][_0x3e5357]!==_0xe3c8('0x98')){if(this['agents'][_0x3e5357][_0xe3c8('0xa4')]===_0xe3c8('0x20a')&&this[_0xe3c8('0x22')][_0x3e5357][_0xe3c8('0xac')]===_0xe3c8('0x20b')){_0xe15ac7['push'](this[_0xe3c8('0x22')][_0x3e5357]['id']);}}}this[_0xe3c8('0xc4')](_0x47c3cd['id'],_0xe15ac7,_0x4e9084,_0x47c3cd[_0xe3c8('0x201')],_0x47c3cd)[_0xe3c8('0xb8')](function(_0x542f04){_0x47c3cd[_0xe3c8('0xc5')]-=_0x4e9084;_0x47c3cd[_0xe3c8('0xc5')]=_0x47c3cd[_0xe3c8('0xc5')]>0x0?_0x47c3cd[_0xe3c8('0xc5')]:0x0;if(!checkContactEmpty(_0x542f04)){_0xe86f4d['countReScheduled'](_0x47c3cd)['then'](sendMessageReschedule(_0x47c3cd))['catch'](loggerCatch(_0xe3c8('0xb4')));}else{_0x47c3cd[_0xe3c8('0x97')]+=_0x542f04[_0xe3c8('0x96')];_0x47c3cd[_0xe3c8('0x3f')]=_0x47c3cd[_0xe3c8('0x5b')]===_0xe3c8('0x159')?_0xe3c8('0x171'):_0xe3c8('0x203');for(var _0x5c855d=0x0;_0x5c855d<_0x542f04[_0xe3c8('0x96')];_0x5c855d+=0x1){if(_[_0xe3c8('0xaa')](_0x542f04[_0x5c855d])||_[_0xe3c8('0xaa')](_0x542f04[_0x5c855d][_0xe3c8('0x180')])||_['isNil'](_0x542f04[_0x5c855d][_0xe3c8('0x16b')])){_0xe86f4d['emptyContact'](_0xe3c8('0x205'),_0x47c3cd,_0x542f04[_0x5c855d]);}else{_0xe86f4d[_0xe3c8('0xb5')](_[_0xe3c8('0xd3')](_0x542f04[_0x5c855d],[_0xe3c8('0xd6'),_0xe3c8('0x206')]))[_0xe3c8('0xb8')](_0xe86f4d[_0xe3c8('0x1e9')](_0x47c3cd,_0x542f04[_0x5c855d]))['catch'](_0xe86f4d[_0xe3c8('0xd0')](_0xe3c8('0x205'),_0x47c3cd));}}}})[_0xe3c8('0xae')](loggerGetContactDialer(_0xe3c8('0x20c'),_0x47c3cd,_0x4e9084));}};Dialer['prototype'][_0xe3c8('0x8c')]=function(_0x54f5a7){if(_0x54f5a7[_0xe3c8('0x209')]>0x0){var _0x25a3a6=_0x54f5a7[_0xe3c8('0x209')]-_0x54f5a7[_0xe3c8('0x97')]-_0x54f5a7[_0xe3c8('0x55')];if(_0x25a3a6>0x0){this[_0xe3c8('0x20d')](_0x54f5a7);}else{loggerPredictiveCalls[_0xe3c8('0x7c')](_0xe3c8('0x20e'));}}else{this[_0xe3c8('0x20d')](_0x54f5a7);}};Dialer[_0xe3c8('0x1b')][_0xe3c8('0x20d')]=function(_0x5a3082){var _0x388f1d=this;var _0x16663b=[];_0x5a3082['originated']+=0x1;for(var _0x2af592 in this[_0xe3c8('0x22')]){if(typeof this[_0xe3c8('0x22')][_0x2af592]!==_0xe3c8('0x98')){if(this[_0xe3c8('0x22')][_0x2af592]['state']===_0xe3c8('0x20a')&&this['agents'][_0x2af592]['status']===_0xe3c8('0x20b')){_0x16663b['push'](this[_0xe3c8('0x22')][_0x2af592]['id']);}}}this['getContactDialer'](_0x5a3082['id'],_0x16663b,0x1,_0x5a3082['dialOrderByScheduledAt'],_0x5a3082)['then'](function(_0x201782){if(!checkContactEmpty(_0x201782)){checkContactLowerLimitOriginate(_0x5a3082,0x1,0x0);_0x388f1d['countReScheduled'](_0x5a3082)['then'](sendMessageReschedule(_0x5a3082))['catch'](loggerCatch(_0xe3c8('0xb4')));}else{_0x5a3082[_0xe3c8('0x3f')]=_0xe3c8('0x203');if(_[_0xe3c8('0xaa')](_0x201782[0x0])||_[_0xe3c8('0xaa')](_0x201782[0x0][_0xe3c8('0x180')])||_[_0xe3c8('0xaa')](_0x201782[0x0][_0xe3c8('0x16b')])){_0x388f1d[_0xe3c8('0xd1')](_0xe3c8('0x205'),_0x5a3082,_0x201782[0x0]);}else{_0x388f1d['checkIsBlackList'](_[_0xe3c8('0xd3')](_0x201782[0x0],[_0xe3c8('0xd6'),'Contact.phone']))['then'](_0x388f1d[_0xe3c8('0x1e9')](_0x5a3082,_0x201782[0x0]))['catch'](_0x388f1d[_0xe3c8('0xd0')](_0xe3c8('0x20f'),_0x5a3082));}}})['catch'](loggerGetContactDialer(_0xe3c8('0x210'),_0x5a3082,0x1));emitVoiceQueueSummary(_0x5a3082);};Dialer[_0xe3c8('0x1b')][_0xe3c8('0x1de')]=function(_0x1c1738,_0x49f2a6,_0x5c7213,_0x5f5d3b,_0x44af85,_0xbd3aba){loggerPredictive[_0xe3c8('0x7c')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0xe3c8('0x7c')]('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',_0x1c1738);loggerPredictive[_0xe3c8('0x7c')](_0xe3c8('0x211'),_0x49f2a6);loggerPredictive[_0xe3c8('0x7c')](_0xe3c8('0x212'),_0x5c7213);loggerPredictive[_0xe3c8('0x7c')](_0xe3c8('0x213'),_0x5f5d3b);loggerPredictive[_0xe3c8('0x7c')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x44af85);loggerPredictive[_0xe3c8('0x7c')](_0xe3c8('0x83'));return new BPromise(function(_0x36241f,_0x2c334c){if(_0x1c1738<=0x0||isNaN(_0x1c1738)){return _0x2c334c(msgResponse(_0xe3c8('0x214'),'Error','m\x20=\x20'+_0x1c1738));}if(_0x5c7213<=0x0||isNaN(_0x5c7213)){return _0x2c334c(msgResponse('[abandonmentRate]',_0xe3c8('0x48'),_0xe3c8('0x215')+_0x5c7213));}if(_0x5f5d3b<=0x0||isNaN(_0x5f5d3b)){return _0x2c334c(msgResponse(_0xe3c8('0x214'),_0xe3c8('0x48'),_0xe3c8('0x216')+_0x5f5d3b));}if(_0x49f2a6<=0x0||isNaN(_0x49f2a6)){return _0x2c334c(msgResponse(_0xe3c8('0x214'),_0xe3c8('0x48'),'interval\x20=\x20'+_0x49f2a6));}if(_0x44af85<=0x0||isNaN(_0x44af85)){return _0x2c334c(msgResponse(_0xe3c8('0x214'),'Error',_0xe3c8('0x217')+_0x44af85));}_0xbd3aba=_0xbd3aba||0x0;var _0x450853=0x1/_0x5c7213;var _0x140bc4=0x0;var _0x35e7ad=0x0;var _0x222df3=0x0;var _0x33cadf=0x0;for(var _0x36a271=0x0;_0x222df3<_0x44af85;_0x36a271+=0x1){_0x35e7ad=_0x36a271/_0x49f2a6;_0x140bc4=(_0x5f5d3b*_0x35e7ad+_0xbd3aba)/_0x450853;_0x222df3=erlangb(_0x140bc4,_0x1c1738);_0x33cadf=_0x140bc4/_0x1c1738*(0x1-erlangb(_0x140bc4,_0x1c1738));}return _0x36241f({'erlangCalls':_0x36a271,'erlangCallToSecond':_0x49f2a6/_0x36a271,'erlangAbandonmentRate':_0x222df3,'erlangBusyFactor':_0x33cadf});});};Dialer[_0xe3c8('0x1b')]['busyFactor']=function(_0x3280a3,_0x4a8682,_0x2645f3,_0x4c4f29,_0x7f741,_0x4bf03c){loggerPredictive[_0xe3c8('0x7c')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0xe3c8('0x7c')](_0xe3c8('0x218'),_0x3280a3);loggerPredictive[_0xe3c8('0x7c')](_0xe3c8('0x211'),_0x4a8682);loggerPredictive[_0xe3c8('0x7c')]('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',_0x2645f3);loggerPredictive['info'](_0xe3c8('0x213'),_0x4c4f29);loggerPredictive[_0xe3c8('0x7c')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x7f741);loggerPredictive[_0xe3c8('0x7c')](_0xe3c8('0x83'));return new BPromise(function(_0xa23868,_0x50821b){if(_0x3280a3<=0x0||isNaN(_0x3280a3)){return _0x50821b(msgResponse(_0xe3c8('0x219'),_0xe3c8('0x48'),_0xe3c8('0x21a')+_0x3280a3));}if(_0x2645f3<=0x0||isNaN(_0x2645f3)){return _0x50821b(msgResponse(_0xe3c8('0x219'),_0xe3c8('0x48'),_0xe3c8('0x215')+_0x2645f3));}if(_0x4c4f29<=0x0||isNaN(_0x4c4f29)){return _0x50821b(msgResponse('[busyFactor]',_0xe3c8('0x48'),'p\x20=\x20'+_0x4c4f29));}if(_0x4a8682<=0x0||isNaN(_0x4a8682)){return _0x50821b(msgResponse(_0xe3c8('0x219'),'Error',_0xe3c8('0x21b')+_0x4a8682));}if(_0x7f741<=0x0||isNaN(_0x7f741)){return _0x50821b(msgResponse(_0xe3c8('0x219'),_0xe3c8('0x48'),_0xe3c8('0x21c')+_0x7f741));}_0x4bf03c=_0x4bf03c||0x0;var _0x582824=0x1/_0x2645f3;var _0x4b589d=0x0;var _0x47a5da=0x0;var _0x31f427=0x0;var _0x1a37cc=0x0;for(var _0x48e98c=0x0;_0x1a37cc<_0x7f741;_0x48e98c+=0x1){_0x47a5da=_0x48e98c/_0x4a8682;_0x4b589d=(_0x4c4f29*_0x47a5da+_0x4bf03c)/_0x582824;_0x31f427=erlangb(_0x4b589d,_0x3280a3);_0x1a37cc=_0x4b589d/_0x3280a3*(0x1-erlangb(_0x4b589d,_0x3280a3));}return _0xa23868({'erlangCalls':_0x48e98c,'erlangCallToSecond':_0x4a8682/_0x48e98c,'erlangAbandonmentRate':_0x31f427,'erlangBusyFactor':_0x1a37cc});});};module['exports']=Dialer; \ No newline at end of file +var _0x5523=['dialAMDActive','value','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','MACHINE','Machine','countmachineretry','emit','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','dialGlobalMaxRetry','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','HANGUP','[syncHangupInAMDIvr]','countglobal','countagentrejectretry','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','cause-txt','Unknow','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','Drop','dropreason','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropMaxRetry','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','syncNewExten','channel','actionid','strategy','locked','paused','stateinterface','queueBooked','idHopper','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','preview','run','[Catch][Preview][syncQueueStatusComplete]','finally','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','syncCampaigns','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','isArray','command','iftime\x20%s,%s','interval','content','true','indexOf','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','progressive','handlePower','power','dialPowerLevel','predictive','Queue','launchHandleIvr','handleIvr','dialGlobalInterval','dialTimezone','checkDialMethod','[syncQueueSummary]','[syncCampaigns]','replace','random','match','actionOriginate','object','voiceQueue\x20is\x20undefine','phone','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-CAMPAIGNID','Contact','tags','updatedAt','%s%s','dialRandomLastDigitCallerIdNumber','callerid','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','dialCutDigit','trim','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate','Error','originate\x20action\x20Error','syncOriginateResponse','getQueue','callProgressDetecting','checkRetriveMax','countnoanswerretry','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','stateGlobal','NoAnswer','custom:agentnoanswer','createStateFinal','reason\x203\x20ringing\x20no\x20answer','custom:agentbusy','busy','reason\x205\x20busy','Congestion','custom:agentcongestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','AgentReject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','available','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','dialPredictiveInterval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','dialPredictiveOptimizationPercentage','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','predictiveIntervalAnsweredCalls','predictiveIntervalPauses','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','voicePause','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','ivrTotalCallsDays','[actionOriginate]\x20','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','push','dialOrderByScheduledAt','RUNNING','Contact.phone','tryOriginatePredictive','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','bluebird','uuid','moment','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictiveCalls','syncQueueSummary','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperFinal','../rpc/cmHopperAdditionalPhone','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./agentComplete','./queueCallerAbandon','./hangup','127.0.0.1','rrmemory','roundrobin','prototype','tail','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','uniqueId','optionPredictive','startPredictive','ivrOriginated','queueBookedRR','syncAgentConnect','bind','syncQueueCallerAbandon','originateresponse','syncAgentComplete','custom:queuesummary','hangup','syncHangup','syncVarSet','queuemember','syncQueueMember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','AGENTS_NOT_LOGGED','message','NOT_ACTIVE','name','\x20NOT\x20Active','\x20INTERVAL_IS_NULL','INTERVAL_IS_NULL','isEmpty','Interval','Intervals','[ifTime][Action]','stringify','milliseconds','diff','seconds','type','outbound','answered','loggedIn','pTalking','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','voice:queue:%s','voice_queue:save','ivr','format','campaign:ivr:%s','campaign:save','-----\x20Stats\x20Predictive\x20---','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','isUndefined','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','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','---------------------------','startProgressive','clearing\x20variable\x20start\x20predictive','handlePredictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','[getContactDialer2][ReScheduled]','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','state','statedesc','endtime','starttime','clearZombieChannels','[uniqueid]','enqueue','isNil','Action','status','catch','No\x20such\x20channel','updateOriginated','[Dialer][checkChannel]','queue','countReScheduled','resolve','[countReScheduled]\x20','checkIsBlackList','then','[checkIsBlackList]\x20','verifyAdditionalPhones','[verifyAdditionalPhone]\x20','swapAdditionalPhones','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','notFound','saveInDb','merge','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','isSuccess','Success','isTrunkReachable','SIP/%s','reachable','unmonitored','uniqueid','variable','amdstatus','exten','xcally-motion-dialer'];(function(_0x456b66,_0x1517c6){var _0x52ba8b=function(_0x273a54){while(--_0x273a54){_0x456b66['push'](_0x456b66['shift']());}};_0x52ba8b(++_0x1517c6);}(_0x5523,0x137));var _0x3552=function(_0x3ed151,_0x49b56b){_0x3ed151=_0x3ed151-0x0;var _0x2c48d6=_0x5523[_0x3ed151];return _0x2c48d6;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0x3552('0x0'));var uuid=require(_0x3552('0x1'));var moment=require(_0x3552('0x2'));var rr=require('rr');var md5=require(_0x3552('0x3'));var Redis=require(_0x3552('0x4'));var ut=require(_0x3552('0x5'));var config=require(_0x3552('0x6'));var logger=require(_0x3552('0x7'))(_0x3552('0x8'));var loggerBooked=require(_0x3552('0x7'))(_0x3552('0x9'));var loggerPredictive=require('../../../config/logger')('predictive');var loggerPredictiveCalls=require('../../../config/logger')(_0x3552('0xa'));var loggerSyncQueueSummary=require('../../../config/logger')(_0x3552('0xb'));var ami=require(_0x3552('0xc'));config[_0x3552('0xd')]=_['defaults'](config['redis'],{'host':_0x3552('0xe'),'port':0x18eb});var io=require(_0x3552('0xf'))(new Redis(config[_0x3552('0xd')]));var cmHopper=require(_0x3552('0x10'));var cmHopperHistory=require(_0x3552('0x11'));var cmHopperFinal=require(_0x3552('0x12'));var cmHopperAdditionalPhone=require(_0x3552('0x13'));var cmHopperBlack=require(_0x3552('0x14'));var voiceQueueRt=require(_0x3552('0x15'));var Action=require(_0x3552('0x16'));var History=require(_0x3552('0x17'));var Final=require('./final');var AgentComplete=require(_0x3552('0x18'));var QueueCallerAbandon=require(_0x3552('0x19'));var Hangup=require(_0x3552('0x1a'));var ipAgi=process['env']['XCALLY_IP_AGI']||_0x3552('0x1b');var strategy={'rrmemory':_0x3552('0x1c'),'roundrobin':_0x3552('0x1d')};var Sequence=function(){};Sequence[_0x3552('0x1e')]['enqueue']=function(_0x3b9f0a){this[_0x3552('0x1f')]=this[_0x3552('0x1f')]?this[_0x3552('0x1f')]['finally'](_0x3b9f0a):_0x3b9f0a();};function Dialer(_0x28dd81,_0x2fdd80){this[_0x3552('0x20')]=new Sequence();this['preview']=_0x2fdd80;this[_0x3552('0x21')]=_0x28dd81[_0x3552('0x21')];this['campaigns']=_0x28dd81[_0x3552('0x22')];this[_0x3552('0x23')]=_0x28dd81[_0x3552('0x23')];this[_0x3552('0x24')]=_0x28dd81['trunks'];this[_0x3552('0x25')]=config[_0x3552('0x25')]||0x2;this['channels']={};this[_0x3552('0x26')]={};this[_0x3552('0x27')]={};this[_0x3552('0x28')]={};this[_0x3552('0x29')]={};this[_0x3552('0x2a')]={};this['startProgressive']={};this[_0x3552('0x2b')]={};this['queueBooked']={};this[_0x3552('0x2c')]={};ami['on']('agentconnect',this[_0x3552('0x2d')][_0x3552('0x2e')](this));ami['on']('queuecallerabandon',this[_0x3552('0x2f')]['bind'](this));ami['on'](_0x3552('0x30'),this['syncOriginateResponse'][_0x3552('0x2e')](this));ami['on']('agentcomplete',this[_0x3552('0x31')][_0x3552('0x2e')](this));ami['on'](_0x3552('0x32'),this[_0x3552('0xb')][_0x3552('0x2e')](this));ami['on'](_0x3552('0x33'),this[_0x3552('0x34')][_0x3552('0x2e')](this));ami['on']('newexten',this['syncNewExten'][_0x3552('0x2e')](this));ami['on']('varset',this[_0x3552('0x35')][_0x3552('0x2e')](this));ami['on'](_0x3552('0x36'),this[_0x3552('0x37')][_0x3552('0x2e')](this));ami['on']('queuestatuscomplete',this[_0x3552('0x38')][_0x3552('0x2e')](this));this[_0x3552('0x39')]();this[_0x3552('0x3a')]();}function isNotNull(_0x212185){return _0x212185!==null&&!_['isUndefined'](_0x212185);}function checkIsLoggedIn(_0x32b45f,_0x144d92){return function(){if(_0x144d92<=0x0){_0x32b45f['message']=_0x3552('0x3b');throw _0x32b45f['name']+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x1cd291){return _0x1cd291;}function checkIsActive(_0xe41ad6,_0x118534){return function(){if(!isActive(_0x118534)){_0xe41ad6[_0x3552('0x3c')]=_0x3552('0x3d');throw _0xe41ad6[_0x3552('0x3e')]+_0x3552('0x3f');}};}function checkInterval(_0x270c0f){return function(){if(!isNotNull(_0x270c0f['Interval'])){_0x270c0f['message']='INTERVAL_IS_NULL';throw _0x270c0f[_0x3552('0x3e')]+_0x3552('0x40');}if(!isNotNull(_0x270c0f['Interval']['Intervals'])){_0x270c0f[_0x3552('0x3c')]=_0x3552('0x41');throw _0x270c0f[_0x3552('0x3e')]+_0x3552('0x40');}if(!isNotNull(_[_0x3552('0x42')](_0x270c0f[_0x3552('0x43')][_0x3552('0x44')]))){_0x270c0f['message']=_0x3552('0x41');throw _0x270c0f[_0x3552('0x3e')]+_0x3552('0x40');}};}function msgResponse(_0x16894f,_0x19b87d,_0x5e1b89){return{'action':_0x16894f,'response':_0x19b87d,'message':_0x5e1b89,'stack':_0x5e1b89};}function myreject(_0x2606c1){return function(_0x4ebcad){return _0x2606c1(msgResponse(_0x3552('0x45'),'Error',JSON[_0x3552('0x46')](_0x4ebcad)));};}function getSeconds(_0x354d78,_0x3a22c5){var _0xe9ed77=moment(_0x354d78)[_0x3552('0x47')](0x0);var _0x2d2c72=moment(_0x3a22c5)[_0x3552('0x47')](0x0);return _0xe9ed77[_0x3552('0x48')](_0x2d2c72,_0x3552('0x49'));}function emit(_0x5d4e53,_0x148067,_0x219452){io['to'](_0x5d4e53)['emit'](_0x148067,_0x219452);}function emitVoiceQueueSummary(_0x34a126){if(_0x34a126[_0x3552('0x4a')]===_0x3552('0x4b')){var _0x1b6064={'id':_0x34a126['id'],'name':_0x34a126[_0x3552('0x3e')],'strategy':_0x34a126['strategy'],'answered':_0x34a126[_0x3552('0x4c')],'available':_0x34a126['available'],'loggedIn':_0x34a126[_0x3552('0x4d')],'pTalking':_0x34a126[_0x3552('0x4e')],'sumBillable':_0x34a126['sumBillable'],'sumDuration':_0x34a126[_0x3552('0x4f')],'sumHoldTime':_0x34a126[_0x3552('0x50')]||0x0,'talking':_0x34a126[_0x3552('0x51')],'total':_0x34a126[_0x3552('0x52')],'type':_0x34a126[_0x3552('0x4a')],'unmanaged':_0x34a126[_0x3552('0x53')],'abandoned':_0x34a126[_0x3552('0x54')],'waiting':_0x34a126[_0x3552('0x55')],'loggedInDb':_0x34a126[_0x3552('0x56')],'dialActive':_0x34a126[_0x3552('0x57')],'dialMethod':_0x34a126[_0x3552('0x58')],'dialOriginateCallerIdName':_0x34a126[_0x3552('0x59')],'dialOriginateCallerIdNumber':_0x34a126['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x34a126[_0x3552('0x5a')],'dialPrefix':_0x34a126[_0x3552('0x5b')],'outboundAnswerAgiCallsDay':_0x34a126[_0x3552('0x5c')],'outboundAnswerCallsDay':_0x34a126[_0x3552('0x5d')],'outboundBlacklistCallsDay':_0x34a126[_0x3552('0x5e')],'outboundBusyCallsDay':_0x34a126[_0x3552('0x5f')],'outboundCongestionCallsDay':_0x34a126[_0x3552('0x60')],'outboundDropCallsDayACS':_0x34a126[_0x3552('0x61')],'outboundDropCallsDayCallersExit':_0x34a126['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x34a126[_0x3552('0x62')],'outboundNoAnswerCallsDay':_0x34a126[_0x3552('0x63')],'outboundNoSuchCallsDay':_0x34a126[_0x3552('0x64')],'outboundOriginateFailureCallsDay':_0x34a126[_0x3552('0x65')],'outboundReCallsDay':_0x34a126[_0x3552('0x66')],'outboundRejectCallsDay':_0x34a126[_0x3552('0x67')],'outboundUnknownCallsDay':_0x34a126[_0x3552('0x68')],'predictiveIntervalAnsweredCalls':_0x34a126['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x34a126[_0x3552('0x69')],'predictiveIntervalAvgTalktime':_0x34a126[_0x3552('0x6a')],'predictiveIntervalDroppedCallsCallersExit':_0x34a126[_0x3552('0x6b')],'predictiveIntervalDroppedCallsTimeout':_0x34a126[_0x3552('0x6c')],'predictiveIntervalErlangCalls':_0x34a126[_0x3552('0x6d')],'predictiveIntervalErlangCallsDroppedCalls':_0x34a126[_0x3552('0x6e')],'predictiveIntervalHitRate':_0x34a126[_0x3552('0x6f')],'predictiveIntervalMultiplicativeFactor':_0x34a126[_0x3552('0x70')],'predictiveIntervalPauses':_0x34a126['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x34a126[_0x3552('0x71')],'predictiveIntervalTotalCalls':_0x34a126[_0x3552('0x72')],'message':_0x34a126[_0x3552('0x3c')],'originated':_0x34a126[_0x3552('0x73')],'erlangCalls':_0x34a126[_0x3552('0x74')],'erlangCallToSecond':_0x34a126[_0x3552('0x75')],'erlangAbandonmentRate':_0x34a126[_0x3552('0x76')],'erlangBusyFactor':_0x34a126[_0x3552('0x77')],'startPredictive':_0x34a126[_0x3552('0x2a')],'startProgressive':_0x34a126['startProgressive']};if(_0x34a126[_0x3552('0x78')]){_0x1b6064['Trunk']={'id':_0x34a126[_0x3552('0x78')]['id'],'name':_0x34a126[_0x3552('0x78')]['name'],'active':_0x34a126['Trunk'][_0x3552('0x79')],'callerid':_0x34a126[_0x3552('0x78')]['callerid']};}if(_0x34a126[_0x3552('0x43')]){_0x1b6064[_0x3552('0x43')]={'id':_0x34a126[_0x3552('0x43')]['id'],'name':_0x34a126[_0x3552('0x43')][_0x3552('0x3e')]};}var _0x536185=md5(JSON[_0x3552('0x46')](_0x1b6064));if(_0x34a126[_0x3552('0x3')]!==_0x536185){_0x34a126[_0x3552('0x3')]=_0x536185;emit(util['format'](_0x3552('0x7a'),_0x1b6064[_0x3552('0x3e')]),_0x3552('0x7b'),_0x1b6064);}}}function emitCampaignSummary(_0x3204e6){if(_0x3204e6[_0x3552('0x4a')]===_0x3552('0x7c')){emit(util[_0x3552('0x7d')](_0x3552('0x7e'),_0x3204e6[_0x3552('0x3e')]),_0x3552('0x7f'),_0x3204e6);}}function checkGetDataPredictive(_0x3459b1){if(isNotNull(_0x3459b1)&&!_[_0x3552('0x42')](_0x3459b1)){loggerPredictive['info'](_0x3552('0x80'));loggerPredictive[_0x3552('0x81')](_0x3552('0x82'),_0x3459b1[_0x3552('0x72')]);loggerPredictive[_0x3552('0x81')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3459b1['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x3552('0x81')](_0x3552('0x83'),_0x3459b1[_0x3552('0x6c')]);loggerPredictive['info']('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3459b1['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x3552('0x81')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3459b1['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x3552('0x81')](_0x3552('0x84'),_0x3459b1[_0x3552('0x6a')]);loggerPredictive[_0x3552('0x81')]('---------------------------');if(_0x3459b1[_0x3552('0x72')]>0x0){if(!_[_0x3552('0x85')](_0x3459b1[_0x3552('0x6a')])&&_0x3459b1[_0x3552('0x6a')]>0x0){return!![];}loggerPredictive[_0x3552('0x81')](_0x3552('0x86'));if(!_['isUndefined'](_0x3459b1[_0x3552('0x69')])&&_0x3459b1[_0x3552('0x69')]>0x0){return!![];}loggerPredictive[_0x3552('0x81')](_0x3552('0x87'));}else{loggerPredictive['info'](_0x3552('0x88'));}}else{loggerPredictive[_0x3552('0x81')](_0x3552('0x89'));}return![];}function mergeDataErlangB(_0x3a7e3f){return function(_0x3e6974){loggerPredictive[_0x3552('0x81')]('---------\x20ErlangB\x20---------');loggerPredictive[_0x3552('0x81')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3e6974['erlangCalls']);loggerPredictive[_0x3552('0x81')](_0x3552('0x8a'),_0x3e6974[_0x3552('0x75')]);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3e6974['erlangAbandonmentRate']);loggerPredictive['info']('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3e6974[_0x3552('0x77')]);loggerPredictive[_0x3552('0x81')](_0x3552('0x8b'),_0x3e6974[_0x3552('0x76')]);loggerPredictive[_0x3552('0x81')](_0x3552('0x8c'));_['merge'](_0x3a7e3f,_0x3e6974);};}function getDiff(_0x48509f){var _0x5b7876=moment()[_0x3552('0x47')](0x0);var _0x318e4c=moment(_0x48509f)['milliseconds'](0x0);return _0x5b7876['diff'](_0x318e4c,_0x3552('0x49'));}function ifInterval(_0x42eaaf,_0x4f1d6d){if(_['isUndefined'](_0x4f1d6d)){return![];}return getDiff(_0x4f1d6d)<_0x42eaaf*0x3c;}function freeVariablesPredictive(_0x1039b0){if(isNotNull(_0x1039b0)){if(!_[_0x3552('0x85')](_0x1039b0[_0x3552('0x8d')])){_0x1039b0['startProgressive']=undefined;loggerPredictive[_0x3552('0x81')](_0x1039b0[_0x3552('0x3e')],'clearing\x20variable\x20start\x20progressive');}if(!_['isUndefined'](_0x1039b0['startPredictive'])){_0x1039b0['startPredictive']=undefined;loggerPredictive[_0x3552('0x81')](_0x1039b0[_0x3552('0x3e')],_0x3552('0x8e'));}if(!_[_0x3552('0x85')](_0x1039b0[_0x3552('0x8f')])){clearInterval(_0x1039b0['handlePredictive']);_0x1039b0['handlePredictive']=undefined;loggerPredictive['info'](_0x1039b0[_0x3552('0x3e')],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x1abaec,_0x310df6){if(_0x310df6===0x0){return 0x0;}var _0x8a4545=0x1;for(var _0x4bf9ff=0x1;_0x4bf9ff<=_0x310df6;_0x4bf9ff+=0x1){_0x8a4545=0x1+_0x8a4545*_0x4bf9ff/_0x1abaec;}return 0x1/_0x8a4545;}function isVoiceQueueOutbound(_0x1a478a){return _0x1a478a===_0x3552('0x4b');}function isNotPreview(_0x1ab5e5){return _0x1ab5e5!=='preview';}function isCampaignIvr(_0x3bcb14){return _0x3bcb14===_0x3552('0x7c');}function getCallerId(_0x2c3ca5,_0x5816f0,_0x12c6cb){if(!_['isUndefined'](_0x12c6cb)&&typeof _0x12c6cb===_0x3552('0x90')&&!_[_0x3552('0x42')](_0x12c6cb)){if(!_['isUndefined'](_0x5816f0)&&typeof _0x5816f0===_0x3552('0x90')&&!_['isEmpty'](_0x5816f0)){return util['format'](_0x3552('0x91'),_0x5816f0,_0x12c6cb);}return util[_0x3552('0x7d')](_0x3552('0x91'),_0x12c6cb,_0x12c6cb);}if(!_[_0x3552('0x85')](_0x2c3ca5)&&typeof _0x2c3ca5===_0x3552('0x90')&&!_[_0x3552('0x42')](_0x2c3ca5)){return _0x2c3ca5;}return _0x3552('0x92');}function loggerCatchQueueSummary(_0x4702bc,_0x27aa33){return function(_0x1eacba){freeVariablesPredictive(_0x27aa33);emitVoiceQueueSummary(_0x27aa33);emitCampaignSummary(_0x27aa33);loggerSyncQueueSummary[_0x3552('0x93')](_0x4702bc,util[_0x3552('0x94')](_0x1eacba,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x5639bb,_0x36d8a4){return function(_0x422c62){loggerPredictive[_0x3552('0x93')](_0x36d8a4[_0x3552('0x3e')],_0x5639bb);loggerPredictive[_0x3552('0x93')](_0x422c62[_0x3552('0x95')]);freeVariablesPredictive(_0x36d8a4);};}function loggerCatch(_0x53a719){return function(_0x5d1916){logger[_0x3552('0x93')](_0x53a719,util[_0x3552('0x94')](_0x5d1916,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x1f58e6){return _0x1f58e6&&!_[_0x3552('0x85')](_0x1f58e6)&&_0x1f58e6[_0x3552('0x96')]>0x0;}function decremetOriginate(_0x5b3f02){if(!_[_0x3552('0x85')](_0x5b3f02)&&_0x5b3f02!==null){if(typeof _0x5b3f02[_0x3552('0x73')]!==_0x3552('0x97')){if(_0x5b3f02[_0x3552('0x73')]>0x0){_0x5b3f02[_0x3552('0x73')]-=0x1;}else{logger[_0x3552('0x93')](_0x3552('0x98'));}}}else{logger[_0x3552('0x93')](_0x3552('0x99'));}}function checkContactLowerLimitOriginate(_0x13a74f,_0x26fda8,_0x324c34){if(_0x26fda8>_0x324c34){for(var _0x50d985=0x0;_0x50d985<_0x26fda8-_0x324c34;_0x50d985+=0x1){decremetOriginate(_0x13a74f);}}}function loggerGetContactDialer(_0x3b4370,_0x2b9b74,_0x2474ad){return function(_0x13a240){checkContactLowerLimitOriginate(_0x2b9b74,_0x2474ad,0x0);logger['error'](_0x3b4370,util[_0x3552('0x94')](_0x13a240,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5854ea){return function(_0x16694a){if(isNotNull(_0x16694a)&&isNotNull(_0x16694a[0x0])){if(_0x16694a[0x0][_0x3552('0x9a')]>0x0){_0x5854ea['message']='RESCHEDULED_CONTACTS';logger[_0x3552('0x81')](_0x3552('0x9b')+_0x5854ea[_0x3552('0x3e')],_0x16694a[0x0]['contactsRescheduled'],'contacts');}else{_0x5854ea[_0x3552('0x3c')]=_0x3552('0x9c');logger[_0x3552('0x81')](_0x3552('0x9d')+_0x5854ea[_0x3552('0x3e')]);}}};}function notSendMessagesQueue(_0x525097){if(_0x525097[_0x3552('0x9e')]){freeVariablesPredictive(_0x525097);if(_0x525097[_0x3552('0x73')]===0x0&&_0x525097[_0x3552('0x51')]===0x0&&_0x525097[_0x3552('0x55')]===0x0&&(_0x525097[_0x3552('0x4e')]||0x0)===0x0){_0x525097[_0x3552('0x9e')]=![];_0x525097['available']=0x0;_0x525097[_0x3552('0x3c')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x3552('0x93')](_0x3552('0x9f'),_0x525097[_0x3552('0x3e')],'is\x20not\x20active');}else{_0x525097[_0x3552('0x3c')]='IS_DISACTIVED';loggerSyncQueueSummary['error'](_0x3552('0x9f'),_0x525097[_0x3552('0x3e')],'is\x20disactive');}emitVoiceQueueSummary(_0x525097);}}function notSendMessagesCampaign(_0x57436d){if(_0x57436d[_0x3552('0x9e')]){if(_0x57436d['originated']===0x0){_0x57436d['sendMessageOneNotActive']=![];_0x57436d[_0x3552('0x3c')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x3552('0x93')](_0x3552('0xa0'),_0x57436d['name'],_0x3552('0xa1'));}else{_0x57436d['message']=_0x3552('0xa2');loggerSyncQueueSummary[_0x3552('0x93')](_0x3552('0xa0'),_0x57436d[_0x3552('0x3e')],_0x3552('0xa3'));}emitCampaignSummary(_0x57436d);}}function createObjHistory(_0x201568,_0x33965b,_0x5e4fc7,_0x354139,_0x336b58){_0x201568['message']=_0x5e4fc7;var _0x49fa69=new Action(_0x201568,_0x33965b);var _0x514c4d=new History(_0x49fa69);_0x514c4d[_0x3552('0xa4')]=_0x354139;_0x514c4d[_0x3552('0xa5')]=_0x336b58;_0x514c4d[_0x3552('0xa6')]=_0x49fa69[_0x3552('0xa7')];return _0x514c4d;}Dialer[_0x3552('0x1e')][_0x3552('0x3a')]=function(){var _0x10edc2=this;setInterval(function(){_0x10edc2[_0x3552('0xa8')](_0x10edc2['uniqueId'],_0x3552('0xa9'));_0x10edc2[_0x3552('0xa8')](_0x10edc2[_0x3552('0x26')],'[actions]');},0x32c8);};Dialer[_0x3552('0x1e')][_0x3552('0xa8')]=function(_0x2878dd,_0x1d5020){var _0x23ed80=this;for(var _0x57d58f in _0x2878dd){if(typeof _0x2878dd[_0x57d58f]!=='undefined'){this['sequence'][_0x3552('0xaa')](function(){if(!_[_0x3552('0xab')](_0x2878dd[_0x57d58f])){return ami[_0x3552('0xac')]({'action':_0x3552('0xad'),'channel':_0x2878dd[_0x57d58f]['channel']})[_0x3552('0xae')](function(_0x572332){if(_0x572332[_0x3552('0x3c')]===_0x3552('0xaf')){setTimeout(function(){if(_0x2878dd[_0x57d58f]&&_0x2878dd[_0x57d58f]['type']!==_0x3552('0x7c')){_0x23ed80[_0x3552('0xb0')](_0x23ed80['voiceQueues'][_0x2878dd[_0x57d58f]['queue']]);logger[_0x3552('0x93')](_0x3552('0xb1'),_0x1d5020,_0x57d58f,_0x2878dd[_0x57d58f]['queue']);delete _0x2878dd[_0x57d58f];}if(_0x2878dd[_0x57d58f]&&_0x2878dd[_0x57d58f][_0x3552('0x4a')]===_0x3552('0x7c')){_0x23ed80[_0x3552('0xb0')](_0x23ed80[_0x3552('0x22')][_0x2878dd[_0x57d58f][_0x3552('0xb2')]]);logger[_0x3552('0x93')]('[Dialer][checkChannel][ivr]',_0x1d5020,_0x57d58f,_0x2878dd[_0x57d58f][_0x3552('0xb2')]);delete _0x2878dd[_0x57d58f];}},0x2328);}});}});}}};Dialer[_0x3552('0x1e')][_0x3552('0xb3')]=function(_0x88b8a2){return BPromise[_0x3552('0xb4')]()['then'](cmHopper[_0x3552('0xb3')](_0x88b8a2))[_0x3552('0xae')](loggerCatch(_0x3552('0xb5')));};Dialer[_0x3552('0x1e')][_0x3552('0xb6')]=function(_0x33bc75){return BPromise[_0x3552('0xb4')]()[_0x3552('0xb7')](cmHopperBlack[_0x3552('0xb6')](_0x33bc75))[_0x3552('0xae')](loggerCatch(_0x3552('0xb8')));};Dialer[_0x3552('0x1e')]['verifyAdditionalPhones']=function(_0x38953c,_0x636db,_0x4044c5){return BPromise[_0x3552('0xb4')]()[_0x3552('0xb7')](cmHopperAdditionalPhone[_0x3552('0xb9')](_0x38953c,_0x636db,_0x4044c5))[_0x3552('0xae')](loggerCatch(_0x3552('0xba')));};Dialer[_0x3552('0x1e')][_0x3552('0xbb')]=function(_0x36c4af,_0x38f38f,_0x29a239){return BPromise[_0x3552('0xb4')]()[_0x3552('0xb7')](cmHopperAdditionalPhone[_0x3552('0xbb')](_0x36c4af,_0x38f38f,_0x29a239))[_0x3552('0xae')](loggerCatch('[swapAdditionalPhone]\x20'));};Dialer[_0x3552('0x1e')][_0x3552('0xbc')]=function(_0x46e1a5){return BPromise['resolve']()[_0x3552('0xb7')](cmHopperBlack['checkIsBlackListIvr'](_0x46e1a5))[_0x3552('0xae')](loggerCatch(_0x3552('0xbd')));};Dialer[_0x3552('0x1e')][_0x3552('0xbe')]=function(_0x4927c5){return BPromise[_0x3552('0xb4')]()['then'](cmHopperHistory[_0x3552('0xbf')](_0x4927c5))['catch'](loggerCatch(_0x3552('0xc0')));};Dialer[_0x3552('0x1e')][_0x3552('0xc1')]=function(_0x26a923){return BPromise['resolve']()[_0x3552('0xb7')](cmHopper[_0x3552('0xc1')](_0x26a923))[_0x3552('0xae')](loggerCatch(_0x3552('0xc2')));};Dialer[_0x3552('0x1e')][_0x3552('0xc3')]=function(_0x181d72,_0x6db262,_0x552223){return BPromise[_0x3552('0xb4')]()[_0x3552('0xb7')](cmHopper['unlockContact'](_0x181d72,_0x6db262,_0x552223))['catch'](loggerCatch(_0x3552('0xc4')));};Dialer[_0x3552('0x1e')][_0x3552('0xc5')]=function(_0x567cb6,_0x2708b6,_0x5ce6f6,_0x41d5d2,_0x4a6d15){return BPromise[_0x3552('0xb4')]()[_0x3552('0xb7')](cmHopper['getContactDialer'](_0x567cb6,_0x2708b6,_0x5ce6f6,_0x41d5d2))[_0x3552('0xae')](function(_0x21278b){_0x4a6d15[_0x3552('0xc6')]-=_0x5ce6f6;_0x4a6d15[_0x3552('0xc6')]=_0x4a6d15['temp']>0x0?_0x4a6d15[_0x3552('0xc6')]:0x0;loggerCatch(_0x3552('0xc7'))(_0x21278b);});};Dialer[_0x3552('0x1e')][_0x3552('0xc8')]=function(_0x4edd90,_0x3d97c8,_0x1f58b7,_0x1a57ac){return BPromise[_0x3552('0xb4')]()[_0x3552('0xb7')](cmHopper[_0x3552('0xc8')](_0x4edd90,_0x3d97c8,_0x1f58b7))[_0x3552('0xae')](function(_0x57d87a){_0x1a57ac[_0x3552('0xc6')]-=_0x3d97c8;_0x1a57ac[_0x3552('0xc6')]=_0x1a57ac['temp']>0x0?_0x1a57ac['temp']:0x0;loggerCatch('[getContactDialerIvr]\x20')(_0x57d87a);});};Dialer[_0x3552('0x1e')][_0x3552('0xc9')]=function(_0x1df6d7){return BPromise[_0x3552('0xb4')]()[_0x3552('0xb7')](voiceQueueRt[_0x3552('0xc9')](_0x1df6d7))[_0x3552('0xae')](loggerCatch(_0x3552('0xca')));};Dialer[_0x3552('0x1e')][_0x3552('0xcb')]=function(_0x32e57c){return BPromise[_0x3552('0xb4')]()['then'](cmHopper[_0x3552('0xcb')](_0x32e57c))[_0x3552('0xae')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer['prototype'][_0x3552('0xcc')]=function(_0x3ac102){return BPromise['resolve']()[_0x3552('0xb7')](cmHopperHistory[_0x3552('0xcc')](_0x3ac102))[_0x3552('0xae')](loggerCatch('[createHistory]\x20'));};Dialer[_0x3552('0x1e')]['updateOriginated']=function(_0x440b3e){if(!_['isUndefined'](_0x440b3e)&&_0x440b3e!==null){if(typeof _0x440b3e[_0x3552('0x73')]!==_0x3552('0x97')){if(_0x440b3e[_0x3552('0x73')]>0x0){_0x440b3e[_0x3552('0x73')]-=0x1;}else{logger[_0x3552('0x93')](_0x3552('0xcd'));}}}else{logger[_0x3552('0x93')](_0x3552('0xce'));}};Dialer['prototype']['loggerHandler']=function(_0x1ccd2d,_0x227eb8){var _0x15f7a1=this;return function(_0x56fc3b){_0x15f7a1['updateOriginated'](_0x227eb8);logger['error'](_0x1ccd2d,util[_0x3552('0x94')](_0x56fc3b,{'showHidden':![],'depth':null}));};};Dialer[_0x3552('0x1e')][_0x3552('0xcf')]=function(_0x467567,_0x27ed14,_0x1ccc5e){var _0x5b3e11={'state':0x19,'statedesc':_0x3552('0xd0')};this['updateOriginated'](_0x27ed14);this[_0x3552('0xd1')](_[_0x3552('0xd2')](_0x5b3e11,_[_0x3552('0xd3')](_0x1ccc5e,[_0x3552('0xd4'),_0x3552('0xd5'),_0x3552('0xd6'),_0x3552('0xd7'),_0x3552('0xd8')])),_0x3552('0xd9'),'[emptyContact]');logger['error'](_0x467567);};Dialer[_0x3552('0x1e')][_0x3552('0xda')]=function(_0x186661){return _0x186661===_0x3552('0xdb');};Dialer['prototype'][_0x3552('0xdc')]=function(_0x33fae8){return!_[_0x3552('0x85')](_0x33fae8)&&_0x33fae8&&!_['isUndefined'](_0x33fae8['name'])&&!_[_0x3552('0x85')](_0x33fae8['active'])&&_0x33fae8['active']&&(this[_0x3552('0x24')][util[_0x3552('0x7d')](_0x3552('0xdd'),_0x33fae8[_0x3552('0x3e')])][_0x3552('0xad')]===_0x3552('0xde')||this[_0x3552('0x24')][util[_0x3552('0x7d')](_0x3552('0xdd'),_0x33fae8[_0x3552('0x3e')])]['status']===_0x3552('0xdf'));};Dialer[_0x3552('0x1e')]['saveInDb']=function(_0x43bb10,_0x8b1694,_0xfff1c6){this[_0x3552('0xcc')](_0x43bb10)['catch'](loggerCatch(_0x8b1694));this[_0x3552('0xcb')](_0x43bb10)['catch'](loggerCatch(_0xfff1c6));};Dialer[_0x3552('0x1e')][_0x3552('0x35')]=function(_0x1b6bc7){var _0x4bbfc1=this[_0x3552('0x28')][_0x1b6bc7[_0x3552('0xe0')]];var _0x1542e4;if(!_[_0x3552('0xab')](_0x1b6bc7)&&!_[_0x3552('0xab')](_0x1b6bc7[_0x3552('0xe1')])&&!_[_0x3552('0xab')](_0x1b6bc7[_0x3552('0xe1')][_0x3552('0xe2')])&&_0x1b6bc7[_0x3552('0xe3')]===_0x3552('0xe4')&&_0x4bbfc1){if(_0x4bbfc1[_0x3552('0x4a')]!==_0x3552('0x7c')&&this['voiceQueues'][_0x4bbfc1[_0x3552('0xb2')]][_0x3552('0xe5')]&&_0x1b6bc7[_0x3552('0xe6')]==='HANGUP'){delete this[_0x3552('0x28')][_0x1b6bc7[_0x3552('0xe0')]];this[_0x3552('0xb0')](this[_0x3552('0x21')][_0x4bbfc1[_0x3552('0xb2')]]);this[_0x3552('0x21')][_0x4bbfc1[_0x3552('0xb2')]][_0x3552('0x5d')]+=0x1;this[_0x3552('0x21')][_0x4bbfc1['queue']][_0x3552('0x5c')]+=0x1;_0x1542e4=new Hangup(_0x4bbfc1,_0x1b6bc7);_0x1542e4[_0x3552('0xa4')]=0x12;_0x1542e4[_0x3552('0xa5')]=_0x3552('0xe7');_0x1542e4[_0x3552('0xe8')]=_0x3552('0xe9');ami['emit'](_0x3552('0xea'),ut[_0x3552('0xeb')](_0x1542e4,_0x3552('0xec')));this['saveInDb'](_0x1542e4,_0x3552('0xed'),'[syncHangupInAMD]');}if(_0x4bbfc1['type']!=='ivr'&&this['voiceQueues'][_0x4bbfc1[_0x3552('0xb2')]][_0x3552('0xe5')]&&_0x1b6bc7['value']===_0x3552('0xee')){var _0x23ff72=this;return new BPromise(function(_0x3c590f,_0x195b8f){delete _0x23ff72[_0x3552('0x28')][_0x1b6bc7[_0x3552('0xe0')]];_0x23ff72[_0x3552('0xb0')](_0x23ff72[_0x3552('0x21')][_0x4bbfc1[_0x3552('0xb2')]]);_0x23ff72[_0x3552('0x21')][_0x4bbfc1[_0x3552('0xb2')]][_0x3552('0x5d')]+=0x1;_0x23ff72[_0x3552('0x21')][_0x4bbfc1['queue']][_0x3552('0x5c')]+=0x1;var _0x31b72b=_0x23ff72[_0x3552('0x21')][_0x4bbfc1[_0x3552('0xb2')]];var _0x24b25d=new Hangup(_0x4bbfc1,_0x1b6bc7);_0x24b25d[_0x3552('0xa4')]=0x13;_0x24b25d[_0x3552('0xa5')]=_0x3552('0xef');_0x24b25d['membername']=_0x3552('0xe9');_0x24b25d[_0x3552('0xf0')]+=0x1;_0x24b25d['countglobal']+=0x1;_0x24b25d[_0x3552('0xec')]=!![];ami[_0x3552('0xf1')](_0x3552('0xea'),ut['buildObj'](_0x24b25d,_0x3552('0xec')));_0x23ff72[_0x3552('0xcc')](_0x24b25d)['catch'](loggerCatch(_0x3552('0xf2')));if(_0x24b25d[_0x3552('0xf3')]+_0x24b25d[_0x3552('0xf4')]+_0x24b25d['countnoanswerretry']+_0x24b25d[_0x3552('0xf5')]+_0x24b25d[_0x3552('0xf6')]+_0x24b25d[_0x3552('0xf7')]+_0x24b25d[_0x3552('0xf0')]+_0x24b25d['countagentrejectretry']>=_0x31b72b[_0x3552('0xf8')]){_0x23ff72['stateGlobal'](_0x24b25d,_0x3c590f,_0x195b8f,_0x3552('0xf9'));}else{if(_0x24b25d[_0x3552('0xf0')]>=_0x31b72b[_0x3552('0xfa')]){_0x23ff72['createStateFinal'](_0x24b25d,_0x3c590f,_0x195b8f,_0x3552('0xfb'));}else{_0x23ff72[_0x3552('0xc1')]({'active':![],'countmachineretry':_0x24b25d[_0x3552('0xf0')],'scheduledat':moment()[_0x3552('0xfc')](_0x31b72b[_0x3552('0xfd')],_0x3552('0xfe'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x24b25d[_0x3552('0xd4')],'ListId':_0x24b25d['ListId'],'VoiceQueueId':_0x24b25d[_0x3552('0xd7')]||undefined,'CampaignId':_0x24b25d[_0x3552('0xd8')]||undefined})[_0x3552('0xae')](loggerCatch('[rescheduleContact][Machine]'));_0x3c590f({'reschedule':0x1});}}});}if(_0x4bbfc1[_0x3552('0x4a')]===_0x3552('0x7c')&&this[_0x3552('0x22')][_0x4bbfc1['queue']]['dialAMDActive']&&_0x1b6bc7['value']===_0x3552('0xff')){delete this[_0x3552('0x28')][_0x1b6bc7[_0x3552('0xe0')]];this['updateOriginated'](this[_0x3552('0x22')][_0x4bbfc1['queue']]);_0x1542e4=new Hangup(_0x4bbfc1,_0x1b6bc7);_0x1542e4[_0x3552('0xa4')]=0x12;_0x1542e4[_0x3552('0xa5')]=_0x3552('0xe7');_0x1542e4[_0x3552('0xe8')]='AMD';ami['emit']('custom:amd',ut[_0x3552('0xeb')](_0x1542e4,'amd'));this[_0x3552('0xd1')](_0x1542e4,'[syncHangupInAMDIvr][createHistory]',_0x3552('0x100'));}if(_0x4bbfc1['type']===_0x3552('0x7c')&&this[_0x3552('0x22')][_0x4bbfc1['queue']][_0x3552('0xe5')]&&_0x1b6bc7[_0x3552('0xe6')]===_0x3552('0xee')){var _0x23ff72=this;return new BPromise(function(_0x392ac0,_0x19f113){delete _0x23ff72[_0x3552('0x28')][_0x1b6bc7[_0x3552('0xe0')]];_0x23ff72['updateOriginated'](_0x23ff72[_0x3552('0x22')][_0x4bbfc1[_0x3552('0xb2')]]);_0x23ff72[_0x3552('0x22')][_0x4bbfc1['queue']][_0x3552('0x5d')]+=0x1;_0x23ff72[_0x3552('0x22')][_0x4bbfc1[_0x3552('0xb2')]][_0x3552('0x5c')]+=0x1;var _0x49c418=_0x23ff72[_0x3552('0x22')][_0x4bbfc1['queue']];var _0xd46db2=new Hangup(_0x4bbfc1,_0x1b6bc7);_0xd46db2['state']=0x13;_0xd46db2[_0x3552('0xa5')]=_0x3552('0xef');_0xd46db2['membername']=_0x3552('0xe9');_0xd46db2[_0x3552('0xf0')]+=0x1;_0xd46db2[_0x3552('0x101')]+=0x1;_0xd46db2[_0x3552('0xec')]=!![];ami['emit'](_0x3552('0xea'),ut[_0x3552('0xeb')](_0xd46db2,_0x3552('0xec')));_0x23ff72[_0x3552('0xcc')](_0xd46db2)[_0x3552('0xae')](loggerCatch(_0x3552('0xf2')));if(_0xd46db2[_0x3552('0xf3')]+_0xd46db2['countcongestionretry']+_0xd46db2['countnoanswerretry']+_0xd46db2[_0x3552('0xf5')]+_0xd46db2[_0x3552('0xf6')]+_0xd46db2[_0x3552('0xf7')]+_0xd46db2['countmachineretry']+_0xd46db2[_0x3552('0x102')]>=_0x49c418['dialGlobalMaxRetry']){_0x23ff72['stateGlobal'](_0xd46db2,_0x392ac0,_0x19f113,_0x3552('0xf9'));}else{if(_0xd46db2[_0x3552('0xf0')]>=_0x49c418['dialMachineMaxRetry']){_0x23ff72['createStateFinal'](_0xd46db2,_0x392ac0,_0x19f113,_0x3552('0xfb'));}else{_0x23ff72['rescheduleContact']({'active':![],'countmachineretry':_0xd46db2[_0x3552('0xf0')],'scheduledat':moment()['add'](_0x49c418['dialMachineRetryFrequency'],_0x3552('0xfe'))['format'](_0x3552('0x103')),'ContactId':_0xd46db2[_0x3552('0xd4')],'ListId':_0xd46db2[_0x3552('0xd5')],'VoiceQueueId':_0xd46db2[_0x3552('0xd7')]||undefined,'CampaignId':_0xd46db2['CampaignId']||undefined})[_0x3552('0xae')](loggerCatch(_0x3552('0x104')));_0x392ac0({'reschedule':0x1});}}});}}};Dialer[_0x3552('0x1e')]['syncHangup']=function(_0x69b2c3){var _0x27edd5=this[_0x3552('0x28')][_0x69b2c3['uniqueid']];var _0x36b7ed=this;var _0x2f31c9;if(_0x27edd5&&_0x27edd5[_0x3552('0x4a')]===_0x3552('0x7c')){delete this[_0x3552('0x28')][_0x69b2c3[_0x3552('0xe0')]];this[_0x3552('0xb0')](this['campaigns'][_0x27edd5[_0x3552('0xb2')]]);this['campaigns'][_0x27edd5[_0x3552('0xb2')]][_0x3552('0x105')]+=0x1;_0x2f31c9=new Hangup(_0x27edd5,_0x69b2c3);this[_0x3552('0xcc')](_0x2f31c9)[_0x3552('0xae')](loggerCatch(_0x3552('0x106')));this[_0x3552('0xcb')](_0x2f31c9)['catch'](loggerCatch(_0x3552('0x107')));}if(_0x27edd5&&_0x27edd5[_0x3552('0x4a')]!==_0x3552('0x7c')&&isNotNull(this[_0x3552('0x21')][_0x27edd5['queue']][_0x3552('0x108')])){delete this[_0x3552('0x28')][_0x69b2c3['uniqueid']];this[_0x3552('0xb0')](this[_0x3552('0x21')][_0x27edd5[_0x3552('0xb2')]]);this['voiceQueues'][_0x27edd5[_0x3552('0xb2')]][_0x3552('0x5d')]+=0x1;this[_0x3552('0x21')][_0x27edd5[_0x3552('0xb2')]]['outboundAnswerAgiCallsDay']+=0x1;_0x2f31c9=new Hangup(_0x27edd5,_0x69b2c3);_0x2f31c9[_0x3552('0xa4')]=0x10;_0x2f31c9[_0x3552('0xa5')]=_0x3552('0x109');_0x2f31c9['membername']='AGI';this['createHistory'](_0x2f31c9)[_0x3552('0xae')](loggerCatch(_0x3552('0x106')));this[_0x3552('0xcb')](_0x2f31c9)[_0x3552('0xae')](loggerCatch(_0x3552('0x107')));}if(_0x27edd5&&_0x27edd5[_0x3552('0x4a')]!==_0x3552('0x7c')&&!isNotNull(this[_0x3552('0x21')][_0x27edd5[_0x3552('0xb2')]][_0x3552('0x108')])){delete this[_0x3552('0x28')][_0x69b2c3[_0x3552('0xe0')]];this[_0x3552('0xb0')](this[_0x3552('0x21')][_0x27edd5['queue']]);this[_0x3552('0x21')][_0x27edd5[_0x3552('0xb2')]][_0x3552('0x68')]+=0x1;_0x2f31c9=new Hangup(_0x27edd5,_0x69b2c3);_0x2f31c9['state']=0xc;_0x2f31c9[_0x3552('0xa5')]=_0x69b2c3[_0x3552('0x10a')];_0x2f31c9['membername']=_0x3552('0x10b');this[_0x3552('0xcc')](_0x2f31c9)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x3552('0xcb')](_0x2f31c9)[_0x3552('0xae')](loggerCatch(_0x3552('0x107')));}};Dialer[_0x3552('0x1e')]['syncAgentComplete']=function(_0x77e4a5){var _0x3b4f06=this['uniqueId'][_0x77e4a5[_0x3552('0xe0')]];var _0x415548=this;if(this[_0x3552('0x21')][_0x77e4a5[_0x3552('0xb2')]]){if(_0x3b4f06&&_0x3b4f06['type']!==_0x3552('0x7c')){delete this[_0x3552('0x28')][_0x77e4a5[_0x3552('0xe0')]];this[_0x3552('0x21')][_0x77e4a5[_0x3552('0xb2')]][_0x3552('0x5d')]+=0x1;var _0x25e24e=new AgentComplete(_0x3b4f06,_0x77e4a5);if(_0x77e4a5[_0x3552('0x10c')]===_0x3552('0x10d')){_0x25e24e[_0x3552('0x10e')]=this[_0x3552('0x21')][_0x77e4a5[_0x3552('0xb2')]][_0x3552('0x10f')]&&this[_0x3552('0x21')][_0x77e4a5[_0x3552('0xb2')]][_0x3552('0x110')]?moment()[_0x3552('0x7d')](_0x3552('0x103')):undefined;}this[_0x3552('0xcc')](_0x25e24e)[_0x3552('0xae')](loggerCatch(_0x3552('0x111')));this[_0x3552('0xcb')](_0x25e24e)[_0x3552('0xae')](loggerCatch(_0x3552('0x112')));}}};Dialer[_0x3552('0x1e')][_0x3552('0x2d')]=function(_0x5886db){if(this[_0x3552('0x21')][_0x5886db[_0x3552('0xb2')]]){if(this[_0x3552('0x28')][_0x5886db[_0x3552('0xe0')]]&&this['uniqueId'][_0x5886db[_0x3552('0xe0')]][_0x3552('0x4a')]!==_0x3552('0x7c')){this[_0x3552('0xb0')](this[_0x3552('0x21')][_0x5886db[_0x3552('0xb2')]]);this['uniqueId'][_0x5886db[_0x3552('0xe0')]][_0x3552('0x113')]=moment()['format'](_0x3552('0x103'));}}};Dialer['prototype'][_0x3552('0x114')]=function(_0x5b9ebd,_0x37aa25){this[_0x3552('0xcc')](_0x5b9ebd)[_0x3552('0xae')](loggerCatch(_0x3552('0x111')));if(_0x37aa25==0x0){this[_0x3552('0xcb')](_0x5b9ebd)[_0x3552('0xae')](loggerCatch(_0x3552('0x115')));}};Dialer[_0x3552('0x1e')][_0x3552('0x2f')]=function(_0x5d05cb){var _0x5060e1=this['uniqueId'][_0x5d05cb[_0x3552('0xe0')]];var _0x3da98e=this;var _0x226b0a=![];var _0x47068c;var _0x86bcdd;if(this[_0x3552('0x21')][_0x5d05cb[_0x3552('0xb2')]]){if(_0x5060e1&&_0x5060e1[_0x3552('0x4a')]!==_0x3552('0x7c')){delete this[_0x3552('0x28')][_0x5d05cb['uniqueid']];this[_0x3552('0xb0')](this['voiceQueues'][_0x5d05cb[_0x3552('0xb2')]]);_0x5060e1[_0x3552('0x116')]=moment()[_0x3552('0x7d')](_0x3552('0x103'));var _0x39d646=new QueueCallerAbandon(_0x5060e1,_0x5d05cb);if(getSeconds(_0x5060e1['droptime'],_0x5060e1[_0x3552('0x117')])>=_0x5060e1[_0x3552('0x118')]){this['voiceQueues'][_0x5d05cb[_0x3552('0xb2')]][_0x3552('0x6c')]+=0x1;this[_0x3552('0x21')][_0x5d05cb[_0x3552('0xb2')]][_0x3552('0x62')]+=0x1;this[_0x3552('0x21')][_0x5d05cb[_0x3552('0xb2')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x39d646[_0x3552('0xa4')]=0xa;_0x39d646[_0x3552('0xa5')]=_0x3552('0x119');_0x39d646[_0x3552('0x11a')]='TIMEOUT';_0x39d646['agiafterat']=this[_0x3552('0x21')][_0x5d05cb['queue']]['dialQueueProject2']?moment()[_0x3552('0x7d')](_0x3552('0x103')):undefined;_0x39d646[_0x3552('0xf6')]+=0x1;_0x39d646[_0x3552('0x101')]+=0x1;_0x47068c=this[_0x3552('0x21')][_0x5d05cb[_0x3552('0xb2')]][_0x3552('0x11b')];_0x86bcdd=this[_0x3552('0x21')][_0x5d05cb[_0x3552('0xb2')]][_0x3552('0x11c')];_0x3da98e[_0x3552('0xb9')](_0x39d646,_0x39d646[_0x3552('0xa4')],_0x5060e1[_0x3552('0x11d')])[_0x3552('0xb7')](function(_0x23b9e7){_0x226b0a=_0x23b9e7[_0x3552('0x11e')]==0x1;if(_0x39d646[_0x3552('0xf6')]>=_0x3da98e[_0x3552('0x21')][_0x5d05cb[_0x3552('0xb2')]][_0x3552('0x11f')]){_0x3da98e[_0x3552('0x114')](_0x39d646,_0x23b9e7['additional']);}else{_0x3da98e[_0x3552('0xc1')]({'active':![],'countdropretry':_0x39d646[_0x3552('0xf6')],'scheduledat':moment()[_0x3552('0xfc')](_0x3da98e[_0x3552('0x21')][_0x5d05cb[_0x3552('0xb2')]][_0x3552('0x11b')],_0x3552('0xfe'))['format'](_0x3552('0x103')),'ContactId':_0x5060e1[_0x3552('0xd4')],'ListId':_0x5060e1[_0x3552('0xd5')],'VoiceQueueId':_0x5060e1['VoiceQueueId']||undefined,'CampaignId':_0x5060e1[_0x3552('0xd8')]||undefined})[_0x3552('0xae')](loggerCatch(_0x3552('0x120')));var _0x167e07=new History(_0x39d646);_0x167e07['state']=0xa;_0x167e07[_0x3552('0xa5')]=_0x3552('0x119');_0x167e07[_0x3552('0xa7')]=moment()[_0x3552('0x7d')](_0x3552('0x103'));_0x167e07[_0x3552('0xa6')]=_0x167e07[_0x3552('0xa7')];_0x167e07[_0x3552('0x121')]=_0x39d646['calleridname'];_0x167e07[_0x3552('0x122')]=_0x39d646[_0x3552('0x122')];_0x3da98e['createHistory'](_0x167e07)[_0x3552('0xae')](loggerCatch(_0x3552('0x123')));}})[_0x3552('0xb7')](function(_0x3c918c){if(_0x226b0a)_0x3da98e[_0x3552('0xbb')](_0x39d646,_0x47068c,_0x86bcdd)[_0x3552('0xb7')](function(_0x34069c){return 0x1;});});}else{this[_0x3552('0x21')][_0x5d05cb[_0x3552('0xb2')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x3552('0x21')][_0x5d05cb[_0x3552('0xb2')]]['outboundDropCallsDayCallersExit']+=0x1;_0x39d646[_0x3552('0xa4')]=0xb;_0x39d646[_0x3552('0xa5')]=_0x3552('0x124');_0x39d646[_0x3552('0x11a')]='CALLEREXIT';_0x39d646['countabandonedretry']+=0x1;_0x39d646[_0x3552('0x101')]+=0x1;_0x47068c=this[_0x3552('0x21')][_0x5d05cb['queue']]['dialAbandonedRetryFrequency'];_0x86bcdd=this[_0x3552('0x21')][_0x5d05cb[_0x3552('0xb2')]][_0x3552('0x11c')];_0x3da98e[_0x3552('0xb9')](_0x39d646,_0x39d646['state'],_0x5060e1[_0x3552('0x11d')])['then'](function(_0xa46f42){if(_0x39d646[_0x3552('0xf7')]>=_0x3da98e['voiceQueues'][_0x5d05cb['queue']][_0x3552('0x125')]){_0x3da98e['queueCallerAbandonCreateState'](_0x39d646,_0xa46f42[_0x3552('0x11e')]);}else{_0x3da98e[_0x3552('0xc1')]({'active':![],'countabandonedretry':_0x39d646[_0x3552('0xf7')],'scheduledat':moment()['add'](_0x3da98e[_0x3552('0x21')][_0x5d05cb[_0x3552('0xb2')]][_0x3552('0x126')],_0x3552('0xfe'))[_0x3552('0x7d')](_0x3552('0x103')),'ContactId':_0x5060e1['ContactId'],'ListId':_0x5060e1[_0x3552('0xd5')],'VoiceQueueId':_0x5060e1[_0x3552('0xd7')]||undefined,'CampaignId':_0x5060e1[_0x3552('0xd8')]||undefined})[_0x3552('0xae')](loggerCatch(_0x3552('0x127')));var _0x673fe3=new History(_0x39d646);_0x673fe3['state']=0xb;_0x673fe3[_0x3552('0xa5')]=_0x3552('0x124');_0x673fe3[_0x3552('0xa7')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x673fe3[_0x3552('0xa6')]=_0x673fe3[_0x3552('0xa7')];_0x673fe3[_0x3552('0x121')]=_0x39d646[_0x3552('0x121')];_0x673fe3[_0x3552('0x122')]=_0x39d646['calleridnum'];_0x3da98e['createHistory'](_0x673fe3)[_0x3552('0xae')](loggerCatch(_0x3552('0x128')));}})[_0x3552('0xb7')](function(_0x28eeed){if(_0x226b0a)_0x3da98e['swapAdditionalPhones'](_0x39d646,_0x47068c,_0x86bcdd)[_0x3552('0xb7')](function(_0x29acd0){return 0x1;});});}}}};Dialer['prototype'][_0x3552('0x129')]=function(_0x43d984){if(this[_0x3552('0x26')][_0x43d984[_0x3552('0xe0')]]){this[_0x3552('0x26')][_0x43d984[_0x3552('0xe0')]]['channel']=_0x43d984[_0x3552('0x12a')];}if(this[_0x3552('0x28')][_0x43d984[_0x3552('0xe0')]]){this[_0x3552('0x28')][_0x43d984[_0x3552('0xe0')]]['channel']=_0x43d984[_0x3552('0x12a')];}};Dialer[_0x3552('0x1e')]['syncQueueMember']=function(_0x407c9d){if(strategy[this['voiceQueues'][this[_0x3552('0x26')][_0x407c9d[_0x3552('0x12b')]][_0x3552('0xb2')]][_0x3552('0x12c')]]===_0x3552('0x1d')){if(this[_0x3552('0x26')][_0x407c9d[_0x3552('0x12b')]]&&_['isNil'](this[_0x3552('0x26')][_0x407c9d['actionid']][_0x3552('0x12d')])&&_0x407c9d[_0x3552('0xad')]==='1'&&_0x407c9d[_0x3552('0x12e')]==='0'){if(this[_0x3552('0x23')][_0x407c9d[_0x3552('0x12f')]]){if(!this[_0x3552('0x23')][_0x407c9d['stateinterface']][_0x3552('0x12d')]){this[_0x3552('0x23')][_0x407c9d['stateinterface']][_0x3552('0x12d')]=!![];this[_0x3552('0x26')][_0x407c9d['actionid']][_0x3552('0x12d')]=!![];this[_0x3552('0x26')][_0x407c9d[_0x3552('0x12b')]]['stateinterface']=_0x407c9d['stateinterface'];}}}}else if((strategy[this[_0x3552('0x21')][this[_0x3552('0x26')][_0x407c9d[_0x3552('0x12b')]][_0x3552('0xb2')]]['strategy']]||_0x3552('0x1c'))===_0x3552('0x1c')){if(this[_0x3552('0x26')][_0x407c9d['actionid']]){if(this[_0x3552('0x23')][_0x407c9d['stateinterface']]){this[_0x3552('0x26')][_0x407c9d[_0x3552('0x12b')]][_0x3552('0x12f')]=_0x407c9d['stateinterface'];if(_['isNil'](this[_0x3552('0x130')][this[_0x3552('0x26')][_0x407c9d['actionid']]['queue']])){this[_0x3552('0x130')][this[_0x3552('0x26')][_0x407c9d['actionid']][_0x3552('0xb2')]]=[];}this[_0x3552('0x130')][this[_0x3552('0x26')][_0x407c9d[_0x3552('0x12b')]][_0x3552('0xb2')]]['push'](_[_0x3552('0xd2')](_['pick'](this['actions'][_0x407c9d[_0x3552('0x12b')]],[_0x3552('0x131'),_0x3552('0x12f')]),{'status':_0x407c9d[_0x3552('0xad')],'paused':_0x407c9d[_0x3552('0x12e')]}));}}}};function unlockQueueStatus(_0x7059e3,_0x85430d){setTimeout(function(){if(_['isUndefined'](_0x7059e3['queueStatusComplete'])){loggerBooked[_0x3552('0x93')](_0x3552('0x132'),_0x85430d);}_0x7059e3[_0x3552('0x133')]=!![];loggerBooked[_0x3552('0x81')](_0x3552('0x134'),_0x85430d,JSON['stringify'](_['pick'](_0x7059e3,['name','queueStatusComplete'])));},0x1f3);}Dialer['prototype'][_0x3552('0x38')]=function(_0xcadfa2){var _0x475a8a=this;var _0x1e779d=_0x475a8a[_0x3552('0x21')][_0x475a8a[_0x3552('0x26')][_0xcadfa2[_0x3552('0x12b')]][_0x3552('0xb2')]];if(strategy[this[_0x3552('0x21')][this['actions'][_0xcadfa2[_0x3552('0x12b')]][_0x3552('0xb2')]][_0x3552('0x12c')]]===_0x3552('0x1d')){if(this[_0x3552('0x26')][_0xcadfa2[_0x3552('0x12b')]]&&this[_0x3552('0x26')][_0xcadfa2[_0x3552('0x12b')]][_0x3552('0x12f')]){this[_0x3552('0x135')][_0x3552('0x136')](this[_0x3552('0x26')][_0xcadfa2['actionid']][_0x3552('0x131')],this[_0x3552('0x26')][_0xcadfa2[_0x3552('0x12b')]]['stateinterface'])[_0x3552('0xae')](function(_0x475771){logger[_0x3552('0x93')](_0x3552('0x137'),util[_0x3552('0x94')](_0x475771,{'showHidden':![],'depth':null}));})[_0x3552('0x138')](function(){_0x475a8a[_0x3552('0xb0')](_0x475a8a['voiceQueues'][_0x475a8a[_0x3552('0x26')][_0xcadfa2[_0x3552('0x12b')]][_0x3552('0xb2')]]);_0x475a8a[_0x3552('0x23')][_0x475a8a[_0x3552('0x26')][_0xcadfa2['actionid']][_0x3552('0x12f')]][_0x3552('0x12d')]=![];delete _0x475a8a['actions'][_0xcadfa2['actionid']];unlockQueueStatus(_0x1e779d);});}else{this[_0x3552('0xb0')](this[_0x3552('0x21')][this[_0x3552('0x26')][_0xcadfa2['actionid']][_0x3552('0xb2')]]);this[_0x3552('0xc1')]({'active':![],'ContactId':this['actions'][_0xcadfa2[_0x3552('0x12b')]][_0x3552('0xd4')],'ListId':this[_0x3552('0x26')][_0xcadfa2[_0x3552('0x12b')]][_0x3552('0xd5')],'VoiceQueueId':this[_0x3552('0x26')][_0xcadfa2[_0x3552('0x12b')]][_0x3552('0xd7')]||undefined,'CampaignId':this[_0x3552('0x26')][_0xcadfa2['actionid']][_0x3552('0xd8')]||undefined})[_0x3552('0xae')](loggerCatch(_0x3552('0x139')));delete this['actions'][_0xcadfa2[_0x3552('0x12b')]];unlockQueueStatus(_0x1e779d);}}else if((strategy[this[_0x3552('0x21')][this[_0x3552('0x26')][_0xcadfa2['actionid']][_0x3552('0xb2')]][_0x3552('0x12c')]]||_0x3552('0x1c'))===_0x3552('0x1c')){var _0x58a392;if(this[_0x3552('0x26')][_0xcadfa2[_0x3552('0x12b')]]&&!_[_0x3552('0x42')](this[_0x3552('0x130')][this[_0x3552('0x26')][_0xcadfa2['actionid']][_0x3552('0xb2')]])){if(this[_0x3552('0x2c')][_0x475a8a[_0x3552('0x26')][_0xcadfa2[_0x3552('0x12b')]][_0x3552('0xb2')]]){this['queueBookedRR'][_0x475a8a[_0x3552('0x26')][_0xcadfa2[_0x3552('0x12b')]]['queue']]=this[_0x3552('0x2c')][this['actions'][_0xcadfa2[_0x3552('0x12b')]]['queue']]?this['queueBookedRR'][this[_0x3552('0x26')][_0xcadfa2[_0x3552('0x12b')]][_0x3552('0xb2')]]:this[_0x3552('0x130')][this[_0x3552('0x26')][_0xcadfa2[_0x3552('0x12b')]][_0x3552('0xb2')]]?this[_0x3552('0x130')][this['actions'][_0xcadfa2[_0x3552('0x12b')]][_0x3552('0xb2')]][_0x3552('0x13a')]||0x0:0x0;}this['queueBooked'][this[_0x3552('0x26')][_0xcadfa2[_0x3552('0x12b')]][_0x3552('0xb2')]][_0x3552('0x13a')]=this[_0x3552('0x2c')][this['actions'][_0xcadfa2[_0x3552('0x12b')]][_0x3552('0xb2')]];for(var _0x4b4de0=0x0;_0x4b4de0=0x0;})[_0x3552('0xae')](myreject(_0x5ddb4c)));}}else{_0x1d8b39['push'](ami[_0x3552('0xac')]({'action':_0x3552('0x151'),'command':util[_0x3552('0x7d')](_0x3552('0x152'),_0x52bb04,!_['isUndefined'](config[_0x3552('0x14d')][_0x592209])?_0x592209:'')})['then'](function(_0x1714c7){return _0x1714c7[_0x3552('0x154')][_0x3552('0x156')](_0x3552('0x155'))>=0x0;})[_0x3552('0xae')](myreject(_0x5ddb4c)));}BPromise[_0x3552('0x157')](_0x1d8b39)[_0x3552('0xb7')](function(_0x5c219a){var _0x2991cb=_[_0x3552('0x158')](_0x5c219a);if(_0x2991cb){return _0x32a658(_0x2991cb);}else{_0x81c8e9[_0x3552('0x3c')]=_0x49f7ff?_0x3552('0x159'):_0x3552('0x15a');return _0x5ddb4c(msgResponse('[ifTime][promiseAll]',_0x3552('0x149'),'Global:\x20'+_0x49f7ff+'\x20'+_0x2655d7+_0x3552('0x15b')+util['inspect'](_0x52bb04,{'showHidden':![],'depth':null})+_0x3552('0x15c')+_0x592209));}})[_0x3552('0xae')](function(_0x4a7a77){return _0x5ddb4c(msgResponse(_0x3552('0x147'),_0x3552('0x149'),JSON[_0x3552('0x46')](_0x4a7a77)));});});};Dialer['prototype']['checkDialMethod']=function(_0x1b6462){var _0x478273=this;return function(){switch(_0x1b6462[_0x3552('0x58')]){case _0x3552('0x15d'):freeVariablesPredictive(_0x1b6462);_0x478273[_0x3552('0x15e')](_0x1b6462,0x1);break;case _0x3552('0x15f'):freeVariablesPredictive(_0x1b6462);_0x478273[_0x3552('0x15e')](_0x1b6462,_0x1b6462[_0x3552('0x160')]);break;case _0x3552('0x161'):_0x478273[_0x3552('0x161')](_0x1b6462);break;case _0x3552('0x9'):freeVariablesPredictive(_0x1b6462);_0x478273['handlePower'](_0x1b6462,0x1);break;default:freeVariablesPredictive(_0x1b6462);logger['error'](_0x3552('0x162'),_0x1b6462['name'],'method\x20not\x20recognized');}};};Dialer[_0x3552('0x1e')][_0x3552('0x163')]=function(_0x17f136){var _0x5edffe=this;return function(){_0x5edffe[_0x3552('0x164')](_0x17f136);};};Dialer[_0x3552('0x1e')][_0x3552('0xb')]=function(_0x4693eb){var _0x3e9f7b=this;if(isNotPreview(_0x4693eb['dialMethod'])){if(isVoiceQueueOutbound(_0x4693eb[_0x3552('0x4a')])&&isActive(_0x4693eb[_0x3552('0x57')])){_0x4693eb[_0x3552('0x9e')]=!![];BPromise[_0x3552('0xb4')]()['then'](checkIsLoggedIn(_0x4693eb,_0x4693eb[_0x3552('0x4d')]))[_0x3552('0xb7')](checkIsActive(_0x4693eb,_0x4693eb[_0x3552('0x57')]))[_0x3552('0xb7')](checkInterval(_0x4693eb))[_0x3552('0xb7')](_0x3e9f7b['checkIsTrunkReachable'](_0x4693eb))[_0x3552('0xb7')](_0x3e9f7b[_0x3552('0x146')](_0x4693eb[_0x3552('0x165')],_0x4693eb[_0x3552('0x166')],_0x4693eb['name'],_0x4693eb))[_0x3552('0xb7')](_0x3e9f7b[_0x3552('0x148')](_0x4693eb['Interval'],_0x4693eb[_0x3552('0x166')],_0x4693eb[_0x3552('0x3e')],_0x4693eb))[_0x3552('0xb7')](_0x3e9f7b[_0x3552('0x167')](_0x4693eb))[_0x3552('0xae')](loggerCatchQueueSummary(_0x3552('0x168'),_0x4693eb));}else{notSendMessagesQueue(_0x4693eb);}}else{freeVariablesPredictive(_0x4693eb);}};Dialer['prototype']['syncCampaigns']=function(){var _0x496593=this;var _0x1edfec;for(var _0x579dfd in this[_0x3552('0x22')]){if(typeof this[_0x3552('0x22')][_0x579dfd]!==_0x3552('0x97')){_0x1edfec=this[_0x3552('0x22')][_0x579dfd];if(isCampaignIvr(_0x1edfec[_0x3552('0x4a')])&&isActive(_0x1edfec[_0x3552('0x79')])){_0x1edfec[_0x3552('0x9e')]=!![];BPromise['resolve']()['then'](checkIsActive(_0x1edfec,_0x1edfec[_0x3552('0x79')]))[_0x3552('0xb7')](checkInterval(_0x1edfec))['then'](_0x496593[_0x3552('0x142')](_0x1edfec))[_0x3552('0xb7')](_0x496593[_0x3552('0x146')](_0x1edfec['dialGlobalInterval'],_0x1edfec[_0x3552('0x166')],_0x1edfec[_0x3552('0x3e')],_0x1edfec))[_0x3552('0xb7')](_0x496593[_0x3552('0x148')](_0x1edfec[_0x3552('0x43')],_0x1edfec[_0x3552('0x166')],_0x1edfec[_0x3552('0x3e')],_0x1edfec))['then'](_0x496593['launchHandleIvr'](_0x1edfec))[_0x3552('0xae')](loggerCatchQueueSummary(_0x3552('0x169'),_0x1edfec));}else{notSendMessagesCampaign(_0x1edfec);}}}};function getCallerIdRandom(_0x3985f5,_0x1d2adb){var _0x5d9192;var _0x39a06e;var _0x1d86a7;if(_0x1d2adb<=0x0){_0x1d2adb=0x1;}_0x5d9192=new RegExp('\x5cw{0,'+_0x1d2adb+'}$');_0x39a06e=Math['pow'](0xa,_0x1d2adb-0x1);_0x1d86a7=Math['pow'](0xa,_0x1d2adb)-0x1;return util[_0x3552('0x7d')]('%s',_[_0x3552('0x16a')](_0x3985f5,_0x5d9192,_[_0x3552('0x16b')](_0x39a06e,_0x1d86a7)));}function extractCalleridName(_0xf30b99){var _0x11123a=_0xf30b99[_0x3552('0x16c')](/"(.*?)"/);return _0x11123a?_0x11123a[0x1]:_0xf30b99;}function extractCalleridNumber(_0x202e2b){var _0x5a10f2=_0x202e2b[_0x3552('0x16c')](/<(.*?)>/);return _0x5a10f2?_0x5a10f2[0x1]:_0x202e2b;}Dialer[_0x3552('0x1e')][_0x3552('0x16d')]=function(_0x4f0351,_0x2d7f52){var _0x392e6c=this;var _0x4d824a=uuid['v4']();this['actions'][_0x4d824a]=new Action(_0x4f0351,_0x2d7f52,_0x4d824a);return new BPromise(function(_0x34ef65,_0x3756f0){if(_['isUndefined'](_0x4f0351)&&typeof _0x4f0351!==_0x3552('0x16e')){return _0x3756f0(msgResponse('originate',_0x3552('0x149'),_0x3552('0x16f')));}if(_['isUndefined'](_0x2d7f52[_0x3552('0x170')])||_0x2d7f52[_0x3552('0x170')]===null){return _0x3756f0(msgResponse('originate','Failure','contact\x20is\x20undefine'));}var _0x29ff54={'XMD-CALLERID':_0x392e6c[_0x3552('0x26')][_0x4d824a]['getCaller'](),'XMD-AGI':_0x4f0351[_0x3552('0x108')]?util[_0x3552('0x7d')](_0x3552('0x171'),ipAgi,_0x4f0351['dialQueueProject']):_0x3552('0x172'),'XMD-AGIAFTER':_0x4f0351[_0x3552('0x10f')]?util[_0x3552('0x7d')](_0x3552('0x171'),ipAgi,_0x4f0351['dialQueueProject2']):_0x3552('0x172'),'XMD-QUEUE':_0x4f0351[_0x3552('0x4a')]==='outbound'?util[_0x3552('0x7d')](_0x3552('0x173'),_0x4f0351[_0x3552('0x3e')],_0x4f0351[_0x3552('0x174')]||'',_0x4f0351[_0x3552('0x110')]?'c':'',_0x4f0351[_0x3552('0x118')]||0x3):_0x3552('0x172'),'XMD-CONTACTID':_0x2d7f52[_0x3552('0xd4')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x392e6c[_0x3552('0x26')][_0x4d824a]['getCaller'](),'XMD-AMD':_0x4f0351[_0x3552('0xe5')]?_0x3552('0x175'):_0x3552('0x172'),'XMD-DESTINATION':_0x3552('0xe4')};if(_0x4f0351[_0x3552('0xe5')]){_0x29ff54[_0x3552('0x176')]=_0x4f0351[_0x3552('0x177')]||0x9c4;_0x29ff54['XMD-AMDGREETING']=_0x4f0351[_0x3552('0x178')]||0x5dc;_0x29ff54['XMD-AMDAFTERGREETINGSILENCE']=_0x4f0351['dialAMDAfterGreetingSilence']||0x320;_0x29ff54[_0x3552('0x179')]=_0x4f0351[_0x3552('0x17a')]||0x1388;_0x29ff54['XMD-AMDMINWORDLENGTH']=_0x4f0351[_0x3552('0x17b')]||0x64;_0x29ff54[_0x3552('0x17c')]=_0x4f0351[_0x3552('0x17d')]||0x32;_0x29ff54[_0x3552('0x17e')]=_0x4f0351[_0x3552('0x17f')]||0x3;_0x29ff54[_0x3552('0x180')]=_0x4f0351[_0x3552('0x181')]||0x100;_0x29ff54[_0x3552('0x182')]=_0x4f0351[_0x3552('0x183')]||0x1388;}if(_0x4f0351['type']===_0x3552('0x4b')){_0x29ff54['XMD-VOICEQUEUEID']=_0x2d7f52[_0x3552('0xd7')];}else{_0x29ff54[_0x3552('0x184')]=_0x2d7f52['CampaignId'];}for(var _0x3fc289 in _0x2d7f52[_0x3552('0x185')]){if(typeof _0x2d7f52[_0x3552('0x185')][_0x3fc289]!==_0x3552('0x97')){if(isNotNull(_0x2d7f52[_0x3552('0x185')][_0x3fc289])&&_0x3fc289!=='id'&&_0x3fc289!==_0x3552('0x186')&&_0x3fc289!=='createdAt'&&_0x3fc289!==_0x3552('0x187')){_0x29ff54[util['format'](_0x3552('0x188'),'XMD-',_['toUpper'](_0x3fc289))]=_0x2d7f52[_0x3552('0x185')][_0x3fc289];}}}var _0x426bd7=_0x392e6c[_0x3552('0xdc')](_0x4f0351[_0x3552('0x78')])?getCallerId(_0x4f0351[_0x3552('0x78')]['callerid'],_0x4f0351[_0x3552('0x59')],_0x4f0351['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x4f0351['dialOriginateCallerIdNumber'],_0x4f0351[_0x3552('0x189')]):_0x4f0351['dialOriginateCallerIdNumber']):getCallerId(_[_0x3552('0xab')](_0x4f0351[_0x3552('0x143')])?_0x4f0351[_0x3552('0x78')]['callerid']:_0x4f0351[_0x3552('0x143')][_0x3552('0x18a')],_0x4f0351[_0x3552('0x59')],_0x4f0351[_0x3552('0x189')]>0x0?getCallerIdRandom(_0x4f0351[_0x3552('0x18b')],_0x4f0351['dialRandomLastDigitCallerIdNumber']):_0x4f0351[_0x3552('0x18b')]);if(_0x426bd7){_0x29ff54[_0x3552('0x18c')]=_0x392e6c['actions'][_0x4d824a][_0x3552('0x18d')]=extractCalleridName(_0x426bd7);_0x29ff54[_0x3552('0x18e')]=_0x2d7f52[_0x3552('0x170')];}return ami['Action']({'actionid':_0x4d824a,'action':'originate','channel':_0x392e6c[_0x3552('0xdc')](_0x4f0351[_0x3552('0x78')])?util[_0x3552('0x7d')](_0x3552('0x18f'),_0x4f0351[_0x3552('0x78')][_0x3552('0x3e')],isNotNull(_0x4f0351[_0x3552('0x5b')])?_0x4f0351['dialPrefix']['trim']()||'':'',_0x4f0351[_0x3552('0x190')]>0x0?_0x2d7f52[_0x3552('0x170')]['substring'](_0x4f0351[_0x3552('0x190')]):_0x2d7f52[_0x3552('0x170')]):util[_0x3552('0x7d')](_0x3552('0x18f'),_[_0x3552('0xab')](_0x4f0351[_0x3552('0x143')])?_0x4f0351['Trunk'][_0x3552('0x3e')]:_0x4f0351[_0x3552('0x143')][_0x3552('0x3e')],isNotNull(_0x4f0351[_0x3552('0x5b')])?_0x4f0351[_0x3552('0x5b')][_0x3552('0x191')]()||'':'',_0x4f0351[_0x3552('0x190')]>0x0?_0x2d7f52['phone']['substring'](_0x4f0351[_0x3552('0x190')]):_0x2d7f52['phone']),'callerid':_0x426bd7,'Exten':'xcally-motion-dialer','Context':_0x3552('0x192'),'Priority':'1','variable':_0x29ff54,'timeout':(_0x4f0351[_0x3552('0x5a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4d824a})['then'](function(_0x325b90){return _0x34ef65(_0x325b90);})[_0x3552('0xae')](function(_0x2d7170){_0x4f0351[_0x3552('0x65')]+=0x1;var _0x192912=new History(_0x392e6c[_0x3552('0x26')][_0x4d824a]);logger[_0x3552('0x93')](util[_0x3552('0x7d')](_0x3552('0x193'),JSON['stringify'](_0x2d7170)));_0x192912[_0x3552('0xa4')]=0xe;_0x192912['statedesc']=_0x3552('0x194');_0x192912[_0x3552('0xa7')]=moment()[_0x3552('0x7d')](_0x3552('0x103'));_0x192912[_0x3552('0xa6')]=_0x192912[_0x3552('0xa7')];_0x392e6c[_0x3552('0xcc')](_0x192912)['catch'](loggerCatch(_0x3552('0x195')));_0x392e6c[_0x3552('0xcb')](_0x192912)[_0x3552('0xae')](loggerCatch(_0x3552('0x195')))['finally'](function(){delete _0x392e6c[_0x3552('0x26')][_0x4d824a];return _0x3756f0(msgResponse(_0x3552('0x196'),_0x3552('0x197'),_0x3552('0x198')));});});});};Dialer[_0x3552('0x1e')][_0x3552('0x199')]=function(_0x375e95){var _0x4a18bb=this[_0x3552('0x26')][_0x375e95[_0x3552('0x12b')]];if(_0x4a18bb){delete this['actions'][_0x375e95[_0x3552('0x12b')]];_0x4a18bb[_0x3552('0x117')]=moment()[_0x3552('0x7d')](_0x3552('0x103'));var _0x47a7dc=_0x4a18bb[_0x3552('0x4a')]===_0x3552('0x7c')?this[_0x3552('0x22')][_0x4a18bb[_0x3552('0xb2')]]:this[_0x3552('0x21')][_0x4a18bb[_0x3552('0x19a')]()];if(!this[_0x3552('0xda')](_0x375e95['response'])){this['updateOriginated'](_0x47a7dc);return this[_0x3552('0x19b')](_0x4a18bb,_0x47a7dc,_0x375e95)['catch'](loggerCatch('[callProgressDetecting]\x20'));}this[_0x3552('0x28')][_0x375e95[_0x3552('0xe0')]]=_0x4a18bb;}};Dialer[_0x3552('0x1e')][_0x3552('0x19c')]=function(_0x2a65cc,_0x1306aa,_0x23d288){var _0x358295=new History(_0x1306aa);if(_0x358295[_0x3552('0xf3')]+_0x358295['countcongestionretry']+_0x358295['countnoanswerretry']+_0x358295[_0x3552('0xf5')]+_0x358295[_0x3552('0xf6')]+_0x358295[_0x3552('0xf7')]+_0x358295[_0x3552('0xf0')]+_0x358295[_0x3552('0x102')]>=_0x23d288[_0x3552('0xf8')]-0x1){return!![];}switch(_0x2a65cc){case 0x3:if(_0x358295[_0x3552('0x19d')]>=_0x23d288[_0x3552('0x19e')]-0x1){return!![];}this[_0x3552('0xc1')]({'active':![],'countnoanswerretry':_0x358295[_0x3552('0x19d')]+=0x1,'scheduledat':moment()[_0x3552('0xfc')](_0x23d288['dialNoAnswerRetryFrequency'],'minutes')[_0x3552('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x358295['ContactId'],'ListId':_0x358295['ListId'],'VoiceQueueId':_0x358295[_0x3552('0xd7')]||undefined,'CampaignId':_0x358295[_0x3552('0xd8')]||undefined})[_0x3552('0xae')](loggerCatch(_0x3552('0x19f')));break;case 0x5:if(_0x358295[_0x3552('0xf3')]>=_0x23d288[_0x3552('0x1a0')]-0x1){return!![];}this[_0x3552('0xc1')]({'active':![],'countbusyretry':_0x358295[_0x3552('0xf3')]+=0x1,'scheduledat':moment()['add'](_0x23d288[_0x3552('0x1a1')],'minutes')[_0x3552('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x358295[_0x3552('0xd4')],'ListId':_0x358295[_0x3552('0xd5')],'VoiceQueueId':_0x358295[_0x3552('0xd7')]||undefined,'CampaignId':_0x358295[_0x3552('0xd8')]||undefined})['catch'](loggerCatch(_0x3552('0x1a2')));break;case 0x8:if(_0x358295['countcongestionretry']>=_0x23d288[_0x3552('0x1a3')]-0x1){return!![];}this[_0x3552('0xc1')]({'active':![],'countcongestionretry':_0x358295[_0x3552('0xf4')]+=0x1,'scheduledat':moment()[_0x3552('0xfc')](_0x23d288[_0x3552('0x1a4')],_0x3552('0xfe'))['format'](_0x3552('0x103')),'ContactId':_0x358295[_0x3552('0xd4')],'ListId':_0x358295[_0x3552('0xd5')],'VoiceQueueId':_0x358295[_0x3552('0xd7')]||undefined,'CampaignId':_0x358295['CampaignId']||undefined})[_0x3552('0xae')](loggerCatch(_0x3552('0x1a5')));break;case 0x0:if(_0x358295[_0x3552('0xf5')]>=_0x23d288['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x358295[_0x3552('0xf5')]+=0x1,'scheduledat':moment()['add'](_0x23d288[_0x3552('0x1a6')],_0x3552('0xfe'))[_0x3552('0x7d')](_0x3552('0x103')),'ContactId':_0x358295['ContactId'],'ListId':_0x358295[_0x3552('0xd5')],'VoiceQueueId':_0x358295[_0x3552('0xd7')]||undefined,'CampaignId':_0x358295['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x358295['countdropretry']>=_0x23d288['dialDropMaxRetry']-0x1){return!![];}this[_0x3552('0xc1')]({'active':![],'countdropretry':_0x358295[_0x3552('0xf6')]+=0x1,'scheduledat':moment()[_0x3552('0xfc')](_0x23d288[_0x3552('0x11b')],_0x3552('0xfe'))[_0x3552('0x7d')](_0x3552('0x103')),'ContactId':_0x358295[_0x3552('0xd4')],'ListId':_0x358295[_0x3552('0xd5')],'VoiceQueueId':_0x358295[_0x3552('0xd7')]||undefined,'CampaignId':_0x358295[_0x3552('0xd8')]||undefined})[_0x3552('0xae')](loggerCatch(_0x3552('0x120')));break;case 0xb:if(_0x358295[_0x3552('0xf7')]>=_0x23d288[_0x3552('0x125')]-0x1){return!![];}this[_0x3552('0xc1')]({'active':![],'countabandonedretry':_0x358295[_0x3552('0xf7')]+=0x1,'scheduledat':moment()[_0x3552('0xfc')](_0x23d288[_0x3552('0x126')],_0x3552('0xfe'))[_0x3552('0x7d')](_0x3552('0x103')),'ContactId':_0x358295[_0x3552('0xd4')],'ListId':_0x358295['ListId'],'VoiceQueueId':_0x358295[_0x3552('0xd7')]||undefined,'CampaignId':_0x358295['CampaignId']||undefined})[_0x3552('0xae')](loggerCatch(_0x3552('0x127')));break;case 0x13:if(_0x358295[_0x3552('0xf0')]>=_0x23d288['dialMachineMaxRetry']-0x1){return!![];}this[_0x3552('0xc1')]({'active':![],'countmachineretry':_0x358295[_0x3552('0xf0')]+=0x1,'scheduledat':moment()[_0x3552('0xfc')](_0x23d288[_0x3552('0xfd')],'minutes')[_0x3552('0x7d')](_0x3552('0x103')),'ContactId':_0x358295['ContactId'],'ListId':_0x358295['ListId'],'VoiceQueueId':_0x358295[_0x3552('0xd7')]||undefined,'CampaignId':_0x358295[_0x3552('0xd8')]||undefined})[_0x3552('0xae')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x358295[_0x3552('0x102')]>=_0x23d288[_0x3552('0x1a7')]-0x1){return!![];}this[_0x3552('0xc1')]({'active':![],'countagentrejectretry':_0x358295[_0x3552('0x102')]+=0x1,'scheduledat':moment()[_0x3552('0xfc')](_0x23d288[_0x3552('0x1a8')],_0x3552('0xfe'))[_0x3552('0x7d')](_0x3552('0x103')),'ContactId':_0x358295['ContactId'],'ListId':_0x358295[_0x3552('0xd5')],'VoiceQueueId':_0x358295[_0x3552('0xd7')]||undefined,'CampaignId':_0x358295[_0x3552('0xd8')]||undefined})[_0x3552('0xae')](loggerCatch(_0x3552('0x1a9')));break;default:return!![];}};Dialer['prototype'][_0x3552('0x19b')]=function(_0x4714d9,_0x218d0d,_0x31a1f0){var _0x506dc2=this;var _0x13a0d6=new History(_0x4714d9);var _0x331181=![];var _0x2a32b2;var _0x489ac5;return new BPromise(function(_0x4fed0c,_0x17c269){if(_[_0x3552('0x85')](_0x218d0d)&&typeof _0x218d0d!=='object'){return _0x17c269(msgResponse(_0x3552('0x1aa'),_0x3552('0x149'),_0x3552('0x1ab')));}if(_['isUndefined'](_0x31a1f0)&&typeof _0x31a1f0!==_0x3552('0x16e')){return _0x17c269(msgResponse(_0x3552('0x1aa'),_0x3552('0x149'),_0x3552('0x1ac')));}_0x506dc2[_0x3552('0xb9')](_0x13a0d6,_0x31a1f0['reason'],_0x218d0d)['then'](function(_0x1b7490){if(_0x1b7490[_0x3552('0x11e')]==0x1)_0x331181=!![];switch(_0x31a1f0['reason']){case'0':_0x218d0d[_0x3552('0x64')]+=0x1;_0x13a0d6['state']=0x0;_0x13a0d6[_0x3552('0xa5')]=_0x3552('0x1ad');_0x13a0d6[_0x3552('0xf5')]+=0x1;_0x13a0d6['countglobal']+=0x1;ami[_0x3552('0xf1')](_0x3552('0x1ae'),ut['buildObj'](_0x4714d9,'nosuchnumber'));_0x2a32b2=_0x218d0d['dialNoSuchNumberRetryFrequency'];_0x489ac5=_0x218d0d[_0x3552('0x11c')];_0x506dc2[_0x3552('0xcc')](_0x13a0d6)[_0x3552('0xae')](loggerCatch(_0x3552('0xf2')));if(_0x506dc2[_0x3552('0x19c')](0x0,_0x4714d9,_0x218d0d)&&!_0x331181){if(_0x13a0d6['countnosuchnumberretry']>=_0x218d0d[_0x3552('0x1af')]){_0x506dc2['createStateFinal'](_0x13a0d6,_0x4fed0c,_0x17c269,_0x3552('0x1b0'));}else{_0x506dc2[_0x3552('0x1b1')](_0x13a0d6,_0x4fed0c,_0x17c269,_0x3552('0x1b0'));}}break;case'3':_0x218d0d[_0x3552('0x63')]+=0x1;_0x13a0d6['state']=0x3;_0x13a0d6[_0x3552('0xa5')]=_0x3552('0x1b2');_0x13a0d6[_0x3552('0x19d')]+=0x1;_0x13a0d6[_0x3552('0x101')]+=0x1;ami[_0x3552('0xf1')](_0x3552('0x1b3'),ut['buildObj'](_0x4714d9,'noanswer'));_0x2a32b2=_0x218d0d['dialNoAnswerRetryFrequency'];_0x489ac5=_0x218d0d[_0x3552('0x11c')];_0x506dc2[_0x3552('0xcc')](_0x13a0d6)[_0x3552('0xae')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x506dc2['checkRetriveMax'](0x3,_0x4714d9,_0x218d0d)&&!_0x331181){if(_0x13a0d6[_0x3552('0x19d')]>=_0x218d0d[_0x3552('0x19e')]){_0x506dc2[_0x3552('0x1b4')](_0x13a0d6,_0x4fed0c,_0x17c269,_0x3552('0x1b5'));}else{_0x506dc2[_0x3552('0x1b1')](_0x13a0d6,_0x4fed0c,_0x17c269,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x218d0d[_0x3552('0x5f')]+=0x1;_0x13a0d6['state']=0x5;_0x13a0d6['statedesc']='Busy';_0x13a0d6['countbusyretry']+=0x1;_0x13a0d6[_0x3552('0x101')]+=0x1;ami[_0x3552('0xf1')](_0x3552('0x1b6'),ut[_0x3552('0xeb')](_0x4714d9,_0x3552('0x1b7')));_0x2a32b2=_0x218d0d[_0x3552('0x1a1')];_0x489ac5=_0x218d0d[_0x3552('0x11c')];_0x506dc2[_0x3552('0xcc')](_0x13a0d6)[_0x3552('0xae')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x506dc2['checkRetriveMax'](0x5,_0x4714d9,_0x218d0d)&&!_0x331181){if(_0x13a0d6[_0x3552('0xf3')]>=_0x218d0d[_0x3552('0x1a0')]){_0x506dc2['createStateFinal'](_0x13a0d6,_0x4fed0c,_0x17c269,_0x3552('0x1b8'));}else{_0x506dc2[_0x3552('0x1b1')](_0x13a0d6,_0x4fed0c,_0x17c269,_0x3552('0x1b8'));}}break;case'8':_0x218d0d[_0x3552('0x60')]+=0x1;_0x13a0d6[_0x3552('0xa4')]=0x8;_0x13a0d6[_0x3552('0xa5')]=_0x3552('0x1b9');_0x13a0d6[_0x3552('0xf4')]+=0x1;_0x13a0d6[_0x3552('0x101')]+=0x1;_0x2a32b2=_0x218d0d['dialCongestionRetryFrequency'];_0x489ac5=_0x218d0d['callAdditionalPhoneAfterMin'];ami['emit'](_0x3552('0x1ba'),ut['buildObj'](_0x4714d9,'congestion'));_0x506dc2[_0x3552('0xcc')](_0x13a0d6)['catch'](loggerCatch(_0x3552('0x1bb')));if(_0x506dc2[_0x3552('0x19c')](0x8,_0x4714d9,_0x218d0d)&&!_0x331181){if(_0x13a0d6[_0x3552('0xf4')]>=_0x218d0d[_0x3552('0x1a3')]){_0x506dc2[_0x3552('0x1b4')](_0x13a0d6,_0x4fed0c,_0x17c269,_0x3552('0x1bc'));}else{_0x506dc2[_0x3552('0x1b1')](_0x13a0d6,_0x4fed0c,_0x17c269,_0x3552('0x1bc'));}}break;case'11':_0x218d0d['outboundAbandonedCallsDay']+=0x1;_0x13a0d6[_0x3552('0xa4')]=0xb;_0x13a0d6[_0x3552('0xa5')]=_0x3552('0x124');_0x13a0d6[_0x3552('0xf7')]+=0x1;_0x13a0d6[_0x3552('0x101')]+=0x1;_0x2a32b2=_0x218d0d[_0x3552('0x126')];_0x489ac5=_0x218d0d[_0x3552('0x11c')];_0x506dc2[_0x3552('0xcc')](_0x13a0d6)[_0x3552('0xae')](loggerCatch(_0x3552('0x128')));if(_0x506dc2[_0x3552('0x19c')](0xb,_0x4714d9,_0x218d0d)&&!_0x331181){if(_0x13a0d6['countabandonedretry']>=_0x218d0d[_0x3552('0x125')]){_0x506dc2[_0x3552('0x1b4')](_0x13a0d6,_0x4fed0c,_0x17c269,'reason\x2011\x20abandoned');}else{_0x506dc2[_0x3552('0x1b1')](_0x13a0d6,_0x4fed0c,_0x17c269,_0x3552('0x1bd'));}}break;case'20':_0x218d0d[_0x3552('0x67')]+=0x1;_0x13a0d6[_0x3552('0xa4')]=0x14;_0x13a0d6[_0x3552('0xa5')]=_0x3552('0x1be');_0x13a0d6['countagentrejectretry']+=0x1;_0x13a0d6[_0x3552('0x101')]+=0x1;_0x2a32b2=_0x218d0d[_0x3552('0x1a8')];_0x489ac5=_0x218d0d['callAdditionalPhoneAfterMin'];ami[_0x3552('0xf1')]('custom:agentreject',ut[_0x3552('0xeb')](_0x4714d9,'agentreject'));_0x506dc2[_0x3552('0xcc')](_0x13a0d6)[_0x3552('0xae')](loggerCatch(_0x3552('0x1bf')));if(_0x506dc2['checkRetriveMax'](0x14,_0x4714d9,_0x218d0d)&&!_0x331181){if(_0x13a0d6['countagentrejectretry']>=_0x218d0d[_0x3552('0x1a7')]){_0x506dc2[_0x3552('0x1b4')](_0x13a0d6,_0x4fed0c,_0x17c269,'reason\x2020\x20agentreject');}else{_0x506dc2[_0x3552('0x1b1')](_0x13a0d6,_0x4fed0c,_0x17c269,_0x3552('0x1c0'));}}break;default:_0x218d0d[_0x3552('0x68')]+=0x1;_0x13a0d6[_0x3552('0xa4')]=0xc;_0x13a0d6[_0x3552('0xa5')]=_0x31a1f0[_0x3552('0x10c')];_0x2a32b2=_0x218d0d[_0x3552('0x1a8')];_0x489ac5=_0x218d0d[_0x3552('0x11c')];_0x506dc2['createHistory'](_0x13a0d6)[_0x3552('0xae')](loggerCatch(_0x3552('0x1c1')));if(_0x506dc2[_0x3552('0x19c')](_0x31a1f0[_0x3552('0x10c')],_0x4714d9,_0x218d0d)&&!_0x331181){if(_0x13a0d6[_0x3552('0xf3')]+_0x13a0d6[_0x3552('0xf4')]+_0x13a0d6[_0x3552('0x19d')]+_0x13a0d6[_0x3552('0xf5')]+_0x13a0d6[_0x3552('0xf6')]+_0x13a0d6['countabandonedretry']+_0x13a0d6[_0x3552('0xf0')]+_0x13a0d6[_0x3552('0x102')]>=_0x218d0d[_0x3552('0xf8')]){_0x506dc2[_0x3552('0x1b1')](_0x13a0d6,_0x4fed0c,_0x17c269,_0x31a1f0['reason']);}else{_0x506dc2['createStateFinal'](_0x13a0d6,_0x4fed0c,_0x17c269,_0x31a1f0[_0x3552('0x10c')]);}}}})[_0x3552('0xb7')](function(_0x26cba1){if(_0x331181){_0x506dc2[_0x3552('0xbb')](_0x13a0d6,_0x2a32b2,_0x489ac5)['then'](function(_0x5e0efd){return _0x4fed0c(0x1);});}});});};Dialer[_0x3552('0x1e')][_0x3552('0x1b1')]=function(_0x2d543e,_0x4ef93f,_0x569838,_0x12d8a6){var _0x2b4c24=new Final(_0x2d543e);_0x2b4c24[_0x3552('0xa4')]=0xf;_0x2b4c24[_0x3552('0xa5')]='Global';this['createStateFinal'](_0x2b4c24,_0x4ef93f,_0x569838,_0x12d8a6);};Dialer[_0x3552('0x1e')][_0x3552('0x1b4')]=function(_0x5b75c0,_0x3928bc,_0x25da01,_0x49ddf4){this['moveContactManagedDialer'](_0x5b75c0)[_0x3552('0xb7')](function(){return _0x3928bc(msgResponse(_0x3552('0x1aa'),_0x3552('0xdb'),_0x49ddf4));})['catch'](function(){return _0x25da01(msgResponse(_0x3552('0x1c2'),'Failure',_0x3552('0x1c3')));});};Dialer[_0x3552('0x1e')]['predictive']=function(_0xd0f416){var _0x315631=_0xd0f416['dialPredictiveOptimizationPercentage']/0x64;var _0x2a7c39=_0xd0f416[_0x3552('0x62')]/(_0xd0f416[_0x3552('0x62')]+_0xd0f416[_0x3552('0x5d')]);var _0x326942=Math[_0x3552('0x1c4')](_0xd0f416[_0x3552('0x71')]*(_0xd0f416['predictiveIntervalMaxThreshold']/0x64));var _0x56c27a=Math[_0x3552('0x1c4')](_0xd0f416[_0x3552('0x71')]*(_0xd0f416['predictiveIntervalMinThreshold']/0x64));var _0x438c10=_0xd0f416[_0x3552('0x1c5')]+_0xd0f416['talking'];var _0x14e796=Math[_0x3552('0x1c6')](_0xd0f416['erlangCalls']*_0xd0f416['erlangAbandonmentRate']*_0xd0f416[_0x3552('0x6f')]*_0xd0f416[_0x3552('0x70')]);if(_[_0x3552('0x85')](_0xd0f416[_0x3552('0x8d')])){if(!_[_0x3552('0x85')](_0xd0f416[_0x3552('0x2a')])){_0xd0f416[_0x3552('0x2a')]=undefined;loggerPredictive['error'](_0x3552('0x1c7'),_0x3552('0x1c8'));}if(!_[_0x3552('0x85')](_0xd0f416['handlePredictive'])){loggerPredictive[_0x3552('0x93')](_0x3552('0x1c7'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0xd0f416[_0x3552('0x8f')]);_0xd0f416[_0x3552('0x8f')]=undefined;}_0xd0f416['startProgressive']=moment()[_0x3552('0x7d')](_0x3552('0x103'));loggerPredictive[_0x3552('0x81')](_0xd0f416[_0x3552('0x3e')],_0x3552('0x1c9'),_0xd0f416[_0x3552('0x8d')]);this[_0x3552('0x15e')](_0xd0f416,0x1);}else if(ifInterval(_0xd0f416['dialPredictiveInterval'],_0xd0f416['startProgressive'])){this[_0x3552('0x15e')](_0xd0f416,0x1);loggerPredictiveCalls[_0x3552('0x81')](_0x3552('0x1ca'),_0xd0f416[_0x3552('0x8d')],_0xd0f416[_0x3552('0x3e')]);_0xd0f416[_0x3552('0x74')]=0x0;_0xd0f416[_0x3552('0x6e')]=0x0;}else if(_0x315631<_0x2a7c39&&_0xd0f416[_0x3552('0x1cb')]===_0x3552('0x1cc')){freeVariablesPredictive(_0xd0f416);loggerPredictive[_0x3552('0x81')](_0x3552('0x1cd'),_0x3552('0x1ce'),_0x2a7c39,_0x3552('0x8d'),_0xd0f416[_0x3552('0x3e')]);}else if(_0x14e796<_0xd0f416['predictiveIntervalErlangCallsDroppedCalls']&&_0xd0f416[_0x3552('0x1cb')]===_0x3552('0x1cc')){freeVariablesPredictive(_0xd0f416);loggerPredictive[_0x3552('0x81')](_0x3552('0x1cf'),_0x3552('0x1d0'),_0x14e796,'Drop\x20in\x20this\x20interval',_0xd0f416['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0xd0f416[_0x3552('0x3e')]);}else if(!ifInterval(_0xd0f416['dialPredictiveInterval'],_0xd0f416[_0x3552('0x8d')])&&_[_0x3552('0x85')](_0xd0f416['startPredictive'])&&!_['isUndefined'](_0xd0f416['startProgressive'])){_0xd0f416['startPredictive']=moment()[_0x3552('0x7d')](_0x3552('0x103'));loggerPredictive[_0x3552('0x81')](_0xd0f416[_0x3552('0x3e')],_0x3552('0x1d1'),_0xd0f416['startPredictive']);this[_0x3552('0xbe')](_0xd0f416['dialPredictiveInterval'])[_0x3552('0xb7')](this[_0x3552('0x1d2')](_0xd0f416))[_0x3552('0xb7')](mergeDataErlangB(_0xd0f416))[_0x3552('0xb7')](this[_0x3552('0x1d3')](_0xd0f416))[_0x3552('0xae')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0xd0f416));}else if(!ifInterval(_0xd0f416[_0x3552('0x1d4')],_0xd0f416[_0x3552('0x2a')])){_0xd0f416['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0xd0f416[_0x3552('0x2a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x3552('0x81')](_0xd0f416[_0x3552('0x3e')],_0x3552('0x1d5'),_0xd0f416[_0x3552('0x2a')]);clearInterval(_0xd0f416['handlePredictive']);_0xd0f416[_0x3552('0x8f')]=undefined;this[_0x3552('0xbe')](_0xd0f416[_0x3552('0x1d4')])[_0x3552('0xb7')](this[_0x3552('0x1d2')](_0xd0f416))[_0x3552('0xb7')](mergeDataErlangB(_0xd0f416))[_0x3552('0xb7')](this['startMethodPredictive'](_0xd0f416))[_0x3552('0xae')](loggerCatchPredictive(_0x3552('0x1d6'),_0xd0f416));}else if(_0xd0f416[_0x3552('0x71')]&&_0x438c10<_0xd0f416['predictiveIntervalAvailable']-_0x56c27a){freeVariablesPredictive(_0xd0f416);loggerPredictive[_0x3552('0x81')](_0xd0f416['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x438c10,_0x3552('0x1d7'),_0xd0f416[_0x3552('0x71')],'-',_0x56c27a,'=',_0xd0f416['predictiveIntervalAvailable']-_0x56c27a,')');}else if(_0xd0f416[_0x3552('0x71')]&&_0x438c10>_0xd0f416[_0x3552('0x71')]+_0x326942){freeVariablesPredictive(_0xd0f416);loggerPredictive[_0x3552('0x81')](_0xd0f416[_0x3552('0x3e')],_0x3552('0x1d8'),_0x438c10,_0x3552('0x1d9'),_0xd0f416[_0x3552('0x71')],'+',_0x326942,'=',_0xd0f416[_0x3552('0x71')]+_0x326942,')');}};Dialer['prototype'][_0x3552('0x1d2')]=function(_0x12f245){var _0x1e498b=this;return function(_0xd22eca){return new BPromise(function(_0x5ad1e2,_0x1c67c1){_[_0x3552('0xd2')](_0x12f245,_0xd22eca[0x0]);if(checkGetDataPredictive(_0xd22eca[0x0])){var _0x4e9c52=_0x12f245[_0x3552('0x71')]=_0x12f245['talking']+_0x12f245[_0x3552('0x1c5')];var _0x3dcbf3=_0x12f245[_0x3552('0x1d4')]*0x3c;var _0x12487d=_0xd22eca[0x0][_0x3552('0x6a')]+_0xd22eca[0x0][_0x3552('0x69')];var _0x37701=(_0xd22eca[0x0]['predictiveIntervalAnsweredCalls']+_0xd22eca[0x0][_0x3552('0x6c')]+_0xd22eca[0x0][_0x3552('0x6b')])/_0xd22eca[0x0][_0x3552('0x72')];_0x12f245['predictiveIntervalHitRate']=_0x37701>0x0?_0x37701:0x1;switch(_0x12f245['dialPredictiveOptimization']){case'dropRate':var _0x26952d=_0x12f245['dialPredictiveOptimizationPercentage']/0x64;return _0x1e498b[_0x3552('0x1da')](_0x4e9c52,_0x3dcbf3,_0x12487d,_0x37701,_0x26952d)[_0x3552('0xb7')](function(_0x3ce5fc){return _0x5ad1e2(_0x3ce5fc);});case _0x3552('0x1db'):var _0xac1cca=_0x12f245[_0x3552('0x1dc')]/0x64;return _0x1e498b[_0x3552('0x1dd')](_0x4e9c52,_0x3dcbf3,_0x12487d,_0x37701,_0xac1cca)[_0x3552('0xb7')](function(_0x4d2459){return _0x5ad1e2(_0x4d2459);});default:return _0x1c67c1(msgResponse(_0x3552('0x1de'),'Failure',_0x3552('0x1df')));}}else{return _0x1c67c1(msgResponse(_0x3552('0x1de'),_0x3552('0x149'),_0x3552('0x1e0')));}});};};Dialer[_0x3552('0x1e')][_0x3552('0x1e1')]=function(_0x5d9258){var _0x35c48b=this;return function(_0x38ab44){return new BPromise(function(_0x16512f,_0x16d8a3){_[_0x3552('0xd2')](_0x5d9258,_0x38ab44[0x0]);if(checkGetDataPredictive(_0x38ab44[0x0])){loggerPredictive[_0x3552('0x81')](JSON[_0x3552('0x46')](_0x38ab44[0x0]));if(_0x5d9258[_0x3552('0x1cb')]===_0x3552('0x1cc')){return _0x35c48b[_0x3552('0xc9')](_0x5d9258['id'])[_0x3552('0xb7')](function(_0x11cb9b){var _0x309725=_0x5d9258[_0x3552('0x4d')]-_0x11cb9b[0x0]['outboundQueuePauses'];var _0x1505f9=_0x5d9258[_0x3552('0x1d4')]*0x3c;var _0x54f44a=_0x38ab44[0x0][_0x3552('0x6a')]+_0x38ab44[0x0]['predictiveIntervalAvgHoldtime'];var _0x459c16=(_0x38ab44[0x0][_0x3552('0x1e2')]+_0x38ab44[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x38ab44[0x0][_0x3552('0x6b')])/_0x38ab44[0x0][_0x3552('0x72')];var _0x58cb49=_0x5d9258[_0x3552('0x1dc')]/0x64;_0x5d9258[_0x3552('0x1e3')]=_0x11cb9b[0x0][_0x3552('0x1e4')]||0x0;_0x5d9258['predictiveIntervalHitRate']=_0x459c16>0x0?_0x459c16:0x1;return _0x35c48b[_0x3552('0x1da')](_0x309725,_0x1505f9,_0x54f44a,_0x459c16,_0x58cb49);})[_0x3552('0xb7')](function(_0x3da2a8){return _0x16512f(_0x3da2a8);})[_0x3552('0xae')](function(_0x5d9ead){return _0x16d8a3(msgResponse('[CatchErlangB]',_0x3552('0x149'),JSON[_0x3552('0x46')](_0x5d9ead)));});}if(_0x5d9258[_0x3552('0x1cb')]===_0x3552('0x1db')){return _0x35c48b['getVoiceQueueRtPauses'](_0x5d9258['id'])[_0x3552('0xb7')](function(_0x127004){var _0x5997aa=_0x5d9258[_0x3552('0x4d')]-_0x127004[0x0][_0x3552('0x1e4')];var _0xeeab1=_0x5d9258['dialPredictiveInterval']*0x3c;var _0x23e0b4=_0x38ab44[0x0]['predictiveIntervalAvgTalktime']+_0x38ab44[0x0]['predictiveIntervalAvgHoldtime'];var _0x592d91=(_0x38ab44[0x0][_0x3552('0x1e2')]+_0x38ab44[0x0][_0x3552('0x6c')]+_0x38ab44[0x0][_0x3552('0x6b')])/_0x38ab44[0x0][_0x3552('0x72')];var _0x63fafa=_0x5d9258[_0x3552('0x1dc')]/0x64;_0x5d9258[_0x3552('0x1e3')]=_0x127004[0x0][_0x3552('0x1e4')]||0x0;_0x5d9258['predictiveIntervalHitRate']=_0x592d91>0x0?_0x592d91:0x1;return _0x35c48b[_0x3552('0x1dd')](_0x5997aa,_0xeeab1,_0x23e0b4,_0x592d91,_0x63fafa);})['then'](function(_0x17e1b8){return _0x16512f(_0x17e1b8);})[_0x3552('0xae')](function(_0x178f9e){return _0x16d8a3(msgResponse(_0x3552('0x1e5'),_0x3552('0x149'),JSON[_0x3552('0x46')](_0x178f9e)));});}}else{return _0x16d8a3(msgResponse('[getDataPredictive]','Failure',_0x3552('0x1e0')));}});};};Dialer[_0x3552('0x1e')]['startMethodPredictive']=function(_0x544fc1){var _0x296343=this;return function(){var _0x43be1e=0x0;var _0x3412e9=Math[_0x3552('0x1c6')](_0x544fc1['erlangCallToSecond']*0x3e8);if(_0x3412e9>0x0){_0x3412e9=_0x3412e9<0x64?0x64:_0x3412e9;loggerPredictive[_0x3552('0x81')](_0x544fc1['name'],_0x3552('0x1e6'),_0x3412e9,_0x3552('0x47'));_0x544fc1[_0x3552('0x8f')]=setInterval(function(){_0x296343[_0x3552('0x8f')](_0x544fc1);loggerPredictiveCalls[_0x3552('0x81')](_0x3552('0x1e7'),_0x43be1e+=0x1);},_0x3412e9);}else{loggerPredictive['info'](_0x544fc1[_0x3552('0x3e')],_0x3552('0x1e8'));}};};Dialer[_0x3552('0x1e')][_0x3552('0x1e9')]=function(_0x26a965,_0x74e0a7){var _0x4cac7e=this;return function(_0x346028){if(_[_0x3552('0x42')](_0x346028)){if(_['isNil'](_0x74e0a7[_0x3552('0xd6')])||!_0x74e0a7['recallme']){if(_0x26a965[_0x3552('0x58')]===_0x3552('0x9')){_0x26a965[_0x3552('0x133')]=_[_0x3552('0x85')](_0x26a965['queueStatusComplete'])?!![]:_0x26a965['queueStatusComplete'];var _0x180558=uuid['v4']();_0x4cac7e['actions'][_0x180558]=new Action(_0x26a965,_0x74e0a7,_0x180558);loggerBooked[_0x3552('0x81')](_0x3552('0x1ea'),_0x180558,_0x3552('0x1eb'),JSON[_0x3552('0x46')](_0x26a965[_0x3552('0x133')]),_0x3552('0x1ec'),_0x26a965[_0x3552('0x3e')]);if(_0x26a965[_0x3552('0x133')]){_0x26a965[_0x3552('0x133')]=![];_0x4cac7e['queueBooked'][_0x4cac7e[_0x3552('0x26')][_0x180558]['queue']]=[];ami[_0x3552('0xac')]({'actionid':_0x180558,'action':_0x3552('0x1ed'),'queue':_0x26a965[_0x3552('0x3e')]})[_0x3552('0xae')](function(){_0x4cac7e[_0x3552('0xb0')](_0x26a965);_0x4cac7e['rescheduleContact']({'active':![],'ContactId':_0x4cac7e[_0x3552('0x26')][_0x180558][_0x3552('0xd4')],'ListId':_0x4cac7e[_0x3552('0x26')][_0x180558][_0x3552('0xd5')],'VoiceQueueId':_0x4cac7e[_0x3552('0x26')][_0x180558][_0x3552('0xd7')]||undefined,'CampaignId':_0x4cac7e['actions'][_0x180558][_0x3552('0xd8')]||undefined})[_0x3552('0xae')](loggerCatch(_0x3552('0x1ee')));delete _0x4cac7e[_0x3552('0x26')][_0x180558];});}else{loggerBooked['info'](_0x3552('0x1ef'),JSON[_0x3552('0x46')](_0x26a965['queueStatusComplete']),_0x3552('0x1ec'),_0x26a965['name']);_0x4cac7e['updateOriginated'](_0x26a965);_0x4cac7e['rescheduleContact']({'active':![],'ContactId':_0x4cac7e[_0x3552('0x26')][_0x180558][_0x3552('0xd4')],'ListId':_0x4cac7e[_0x3552('0x26')][_0x180558][_0x3552('0xd5')],'VoiceQueueId':_0x4cac7e[_0x3552('0x26')][_0x180558][_0x3552('0xd7')]||undefined,'CampaignId':_0x4cac7e[_0x3552('0x26')][_0x180558][_0x3552('0xd8')]||undefined})[_0x3552('0xae')](loggerCatch(_0x3552('0x1ee')));delete _0x4cac7e[_0x3552('0x26')][_0x180558];}}else{return _0x4cac7e[_0x3552('0x16d')](_0x26a965,_0x74e0a7);}}else{if(getDiff(_0x74e0a7[_0x3552('0x1f0')])<_0x26a965[_0x3552('0x1f1')]*0x3c){if(_0x74e0a7[_0x3552('0x1f2')]&&!_0x74e0a7[_0x3552('0x1f2')][_0x3552('0x1f3')]){_0x4cac7e[_0x3552('0x135')][_0x3552('0x136')](_0x74e0a7['id'])[_0x3552('0x138')](function(){_0x4cac7e[_0x3552('0xb0')](_0x26a965);});}else{_0x4cac7e[_0x3552('0xc3')]({'active':![]},_0x74e0a7['id'],0x1)['finally'](function(){_0x4cac7e[_0x3552('0xb0')](_0x26a965);});}}else{_0x26a965['outboundReCallsDay']+=0x1;_0x4cac7e['updateOriginated'](_0x26a965);if(_0x26a965['dialRecallInQueue']){_0x4cac7e[_0x3552('0xc1')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x74e0a7[_0x3552('0xd4')],'ListId':_0x74e0a7[_0x3552('0xd5')],'VoiceQueueId':_0x74e0a7[_0x3552('0xd7')]||undefined,'CampaignId':_0x74e0a7[_0x3552('0xd8')]||undefined})[_0x3552('0xae')](loggerCatch(_0x3552('0x1f4')));_0x4cac7e[_0x3552('0xcc')](createObjHistory(_0x26a965,_0x74e0a7,'RECALLINQUEUE',0x17,_0x3552('0x1f5')))['catch'](loggerCatch(_0x3552('0x1f6')));}else{_0x4cac7e[_0x3552('0xd1')](createObjHistory(_0x26a965,_0x74e0a7,'RECALLFAILEDTIMEOUT',0x16,_0x3552('0x1f7')),'[Originate][HistoryRecallClose][historyCatch]',_0x3552('0x1f8'));}}}}else{_0x26a965['outboundBlacklistCallsDay']+=0x1;_0x4cac7e[_0x3552('0xd1')](createObjHistory(_0x26a965,_0x74e0a7,_0x3552('0x1f9'),0xd,_0x3552('0x1fa')),_0x3552('0x1fb'),_0x3552('0x1fc'));throw _0x3552('0x1fd');}};};Dialer['prototype'][_0x3552('0x164')]=function(_0x4bd3dc){var _0x42fac5=this;var _0xe59f7b=_0x4bd3dc[_0x3552('0x1fe')]-_0x4bd3dc[_0x3552('0x73')]-_0x4bd3dc['temp'];emitCampaignSummary(_0x4bd3dc);if(_0xe59f7b>0x0){if(_0xe59f7b>this[_0x3552('0x25')]){_0xe59f7b=this[_0x3552('0x25')];}_0x4bd3dc[_0x3552('0xc6')]+=_0xe59f7b;this[_0x3552('0xc8')](_0x4bd3dc['id'],_0xe59f7b,_0x4bd3dc['dialOrderByScheduledAt'],_0x4bd3dc)[_0x3552('0xb7')](function(_0x1cc3b3){_0x4bd3dc[_0x3552('0xc6')]-=_0xe59f7b;_0x4bd3dc[_0x3552('0xc6')]=_0x4bd3dc[_0x3552('0xc6')]>0x0?_0x4bd3dc[_0x3552('0xc6')]:0x0;if(!checkContactEmpty(_0x1cc3b3)){_0x4bd3dc[_0x3552('0x3c')]=_0x3552('0x9c');logger[_0x3552('0x81')]('[getContactCampaign2][Empty]'+_0x4bd3dc['name']);}else{_0x4bd3dc[_0x3552('0x73')]+=_0x1cc3b3['length'];_0x4bd3dc[_0x3552('0x3c')]='RUNNING';for(var _0xb2c783=0x0;_0xb2c783<_0x1cc3b3[_0x3552('0x96')];_0xb2c783+=0x1){_0x4bd3dc[_0x3552('0x1ff')]+=0x1;if(_[_0x3552('0xab')](_0x1cc3b3[_0xb2c783])||_[_0x3552('0xab')](_0x1cc3b3[_0xb2c783][_0x3552('0x185')])||_[_0x3552('0xab')](_0x1cc3b3[_0xb2c783][_0x3552('0x170')])){_0x42fac5[_0x3552('0xcf')](_0x3552('0x200'),_0x4bd3dc,_0x1cc3b3[_0xb2c783]);}else{_0x42fac5['checkIsBlackListIvr'](_[_0x3552('0xd3')](_0x1cc3b3[_0xb2c783],[_0x3552('0xd8'),'Contact.phone']))['then'](_0x42fac5['checkContactBlack'](_0x4bd3dc,_0x1cc3b3[_0xb2c783]))['catch'](_0x42fac5[_0x3552('0x201')](_0x3552('0x202'),_0x4bd3dc));}}}})[_0x3552('0xae')](loggerGetContactDialer(_0x3552('0x203'),_0x4bd3dc,_0xe59f7b));}};Dialer['prototype']['handlePower']=function(_0x494310,_0x4c915f){var _0x42592e=this;var _0x3c4e53=[];var _0x1fefd2=_0x4c915f>=0x1?_0x4c915f:0x1;if(_0x494310[_0x3552('0x58')]==='booked'){_0x1fefd2=0x1;}var _0x4e4c5b=Math[_0x3552('0x1c6')](_0x494310['available']*_0x1fefd2)-_0x494310['originated']-_0x494310[_0x3552('0xc6')];emitVoiceQueueSummary(_0x494310);if(_0x494310['dialLimitQueue']>0x0){var _0x432ce3=_0x494310[_0x3552('0x204')]-_0x494310[_0x3552('0x73')]-_0x494310['talking']-_0x494310[_0x3552('0xc6')]-_0x494310[_0x3552('0x4e')];if(_0x4e4c5b>_0x432ce3){_0x4e4c5b=_0x432ce3;}}if(_0x4e4c5b>0x0){if(_0x494310[_0x3552('0x58')]===_0x3552('0x9')){_0x4e4c5b=0x1;}if(_0x4e4c5b>this[_0x3552('0x25')]){_0x4e4c5b=this[_0x3552('0x25')];}_0x494310[_0x3552('0xc6')]+=_0x4e4c5b;for(var _0x3df5f2 in this[_0x3552('0x23')]){if(typeof this[_0x3552('0x23')][_0x3df5f2]!=='undefined'){if(this['agents'][_0x3df5f2][_0x3552('0xa4')]===_0x3552('0x205')&&this[_0x3552('0x23')][_0x3df5f2]['status']===_0x3552('0xde')){_0x3c4e53[_0x3552('0x206')](this[_0x3552('0x23')][_0x3df5f2]['id']);}}}this[_0x3552('0xc5')](_0x494310['id'],_0x3c4e53,_0x4e4c5b,_0x494310[_0x3552('0x207')],_0x494310)[_0x3552('0xb7')](function(_0x418637){_0x494310['temp']-=_0x4e4c5b;_0x494310['temp']=_0x494310['temp']>0x0?_0x494310[_0x3552('0xc6')]:0x0;if(!checkContactEmpty(_0x418637)){_0x42592e['countReScheduled'](_0x494310)[_0x3552('0xb7')](sendMessageReschedule(_0x494310))[_0x3552('0xae')](loggerCatch('[countReScheduled]\x20'));}else{_0x494310[_0x3552('0x73')]+=_0x418637[_0x3552('0x96')];_0x494310[_0x3552('0x3c')]=_0x494310['dialMethod']===_0x3552('0x9')?_0x3552('0x175'):_0x3552('0x208');for(var _0x3f57fe=0x0;_0x3f57fe<_0x418637['length'];_0x3f57fe+=0x1){if(_[_0x3552('0xab')](_0x418637[_0x3f57fe])||_[_0x3552('0xab')](_0x418637[_0x3f57fe][_0x3552('0x185')])||_[_0x3552('0xab')](_0x418637[_0x3f57fe][_0x3552('0x170')])){_0x42592e[_0x3552('0xcf')]('[actionOriginate]\x20',_0x494310,_0x418637[_0x3f57fe]);}else{_0x42592e[_0x3552('0xb6')](_[_0x3552('0xd3')](_0x418637[_0x3f57fe],['VoiceQueueId',_0x3552('0x209')]))['then'](_0x42592e[_0x3552('0x1e9')](_0x494310,_0x418637[_0x3f57fe]))[_0x3552('0xae')](_0x42592e[_0x3552('0x201')](_0x3552('0x200'),_0x494310));}}}})[_0x3552('0xae')](loggerGetContactDialer('[getContactDialer2]',_0x494310,_0x4e4c5b));}};Dialer['prototype'][_0x3552('0x8f')]=function(_0x4d90be){if(_0x4d90be['dialLimitQueue']>0x0){var _0x588459=_0x4d90be[_0x3552('0x204')]-_0x4d90be[_0x3552('0x73')]-_0x4d90be[_0x3552('0x51')];if(_0x588459>0x0){this['tryOriginatePredictive'](_0x4d90be);}else{loggerPredictiveCalls[_0x3552('0x81')]('[handlePredictive][limitChannel]');}}else{this[_0x3552('0x20a')](_0x4d90be);}};Dialer[_0x3552('0x1e')][_0x3552('0x20a')]=function(_0x18deb3){var _0x6349b7=this;var _0x4cebac=[];_0x18deb3[_0x3552('0x73')]+=0x1;for(var _0xebe5b0 in this[_0x3552('0x23')]){if(typeof this[_0x3552('0x23')][_0xebe5b0]!=='undefined'){if(this['agents'][_0xebe5b0][_0x3552('0xa4')]===_0x3552('0x205')&&this[_0x3552('0x23')][_0xebe5b0][_0x3552('0xad')]===_0x3552('0xde')){_0x4cebac['push'](this[_0x3552('0x23')][_0xebe5b0]['id']);}}}this[_0x3552('0xc5')](_0x18deb3['id'],_0x4cebac,0x1,_0x18deb3[_0x3552('0x207')],_0x18deb3)[_0x3552('0xb7')](function(_0x17f3ea){if(!checkContactEmpty(_0x17f3ea)){checkContactLowerLimitOriginate(_0x18deb3,0x1,0x0);_0x6349b7[_0x3552('0xb3')](_0x18deb3)[_0x3552('0xb7')](sendMessageReschedule(_0x18deb3))[_0x3552('0xae')](loggerCatch(_0x3552('0xb5')));}else{_0x18deb3[_0x3552('0x3c')]=_0x3552('0x208');if(_[_0x3552('0xab')](_0x17f3ea[0x0])||_[_0x3552('0xab')](_0x17f3ea[0x0][_0x3552('0x185')])||_[_0x3552('0xab')](_0x17f3ea[0x0]['phone'])){_0x6349b7[_0x3552('0xcf')](_0x3552('0x200'),_0x18deb3,_0x17f3ea[0x0]);}else{_0x6349b7[_0x3552('0xb6')](_[_0x3552('0xd3')](_0x17f3ea[0x0],[_0x3552('0xd7'),_0x3552('0x209')]))[_0x3552('0xb7')](_0x6349b7[_0x3552('0x1e9')](_0x18deb3,_0x17f3ea[0x0]))[_0x3552('0xae')](_0x6349b7[_0x3552('0x201')](_0x3552('0x20b'),_0x18deb3));}}})['catch'](loggerGetContactDialer('[getContactDialerPredictive]',_0x18deb3,0x1));emitVoiceQueueSummary(_0x18deb3);};Dialer['prototype'][_0x3552('0x1da')]=function(_0x4fc274,_0x337ec1,_0x16d066,_0x1b4237,_0x171ee8,_0xf6cbb0){loggerPredictive[_0x3552('0x81')](_0x3552('0x20c'));loggerPredictive[_0x3552('0x81')](_0x3552('0x20d'),_0x4fc274);loggerPredictive[_0x3552('0x81')](_0x3552('0x20e'),_0x337ec1);loggerPredictive['info'](_0x3552('0x20f'),_0x16d066);loggerPredictive['info'](_0x3552('0x210'),_0x1b4237);loggerPredictive[_0x3552('0x81')](_0x3552('0x211'),_0x171ee8);loggerPredictive[_0x3552('0x81')](_0x3552('0x8c'));return new BPromise(function(_0x4a4317,_0x20c623){if(_0x4fc274<=0x0||isNaN(_0x4fc274)){return _0x20c623(msgResponse(_0x3552('0x212'),_0x3552('0x197'),_0x3552('0x213')+_0x4fc274));}if(_0x16d066<=0x0||isNaN(_0x16d066)){return _0x20c623(msgResponse(_0x3552('0x212'),_0x3552('0x197'),_0x3552('0x214')+_0x16d066));}if(_0x1b4237<=0x0||isNaN(_0x1b4237)){return _0x20c623(msgResponse('[abandonmentRate]',_0x3552('0x197'),_0x3552('0x215')+_0x1b4237));}if(_0x337ec1<=0x0||isNaN(_0x337ec1)){return _0x20c623(msgResponse('[abandonmentRate]',_0x3552('0x197'),_0x3552('0x216')+_0x337ec1));}if(_0x171ee8<=0x0||isNaN(_0x171ee8)){return _0x20c623(msgResponse(_0x3552('0x212'),_0x3552('0x197'),'Amax\x20=\x20'+_0x171ee8));}_0xf6cbb0=_0xf6cbb0||0x0;var _0x1d150f=0x1/_0x16d066;var _0x1d4dc7=0x0;var _0x3cd191=0x0;var _0x3e9ae1=0x0;var _0x1aecba=0x0;for(var _0x21d4d3=0x0;_0x3e9ae1<_0x171ee8;_0x21d4d3+=0x1){_0x3cd191=_0x21d4d3/_0x337ec1;_0x1d4dc7=(_0x1b4237*_0x3cd191+_0xf6cbb0)/_0x1d150f;_0x3e9ae1=erlangb(_0x1d4dc7,_0x4fc274);_0x1aecba=_0x1d4dc7/_0x4fc274*(0x1-erlangb(_0x1d4dc7,_0x4fc274));}return _0x4a4317({'erlangCalls':_0x21d4d3,'erlangCallToSecond':_0x337ec1/_0x21d4d3,'erlangAbandonmentRate':_0x3e9ae1,'erlangBusyFactor':_0x1aecba});});};Dialer['prototype'][_0x3552('0x1dd')]=function(_0x26251d,_0x4f61c5,_0x2e56a9,_0x210857,_0x4edcad,_0x3fd3c3){loggerPredictive['info'](_0x3552('0x217'));loggerPredictive[_0x3552('0x81')](_0x3552('0x20d'),_0x26251d);loggerPredictive[_0x3552('0x81')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4f61c5);loggerPredictive[_0x3552('0x81')]('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',_0x2e56a9);loggerPredictive[_0x3552('0x81')](_0x3552('0x210'),_0x210857);loggerPredictive['info'](_0x3552('0x218'),_0x4edcad);loggerPredictive[_0x3552('0x81')](_0x3552('0x8c'));return new BPromise(function(_0x480efd,_0x2dea97){if(_0x26251d<=0x0||isNaN(_0x26251d)){return _0x2dea97(msgResponse('[busyFactor]',_0x3552('0x197'),_0x3552('0x213')+_0x26251d));}if(_0x2e56a9<=0x0||isNaN(_0x2e56a9)){return _0x2dea97(msgResponse('[busyFactor]',_0x3552('0x197'),_0x3552('0x214')+_0x2e56a9));}if(_0x210857<=0x0||isNaN(_0x210857)){return _0x2dea97(msgResponse(_0x3552('0x219'),_0x3552('0x197'),_0x3552('0x215')+_0x210857));}if(_0x4f61c5<=0x0||isNaN(_0x4f61c5)){return _0x2dea97(msgResponse('[busyFactor]',_0x3552('0x197'),_0x3552('0x216')+_0x4f61c5));}if(_0x4edcad<=0x0||isNaN(_0x4edcad)){return _0x2dea97(msgResponse(_0x3552('0x219'),_0x3552('0x197'),_0x3552('0x21a')+_0x4edcad));}_0x3fd3c3=_0x3fd3c3||0x0;var _0x4db776=0x1/_0x2e56a9;var _0x5038e5=0x0;var _0x32dc37=0x0;var _0x2ee2ca=0x0;var _0x558f30=0x0;for(var _0x500cb0=0x0;_0x558f30<_0x4edcad;_0x500cb0+=0x1){_0x32dc37=_0x500cb0/_0x4f61c5;_0x5038e5=(_0x210857*_0x32dc37+_0x3fd3c3)/_0x4db776;_0x2ee2ca=erlangb(_0x5038e5,_0x26251d);_0x558f30=_0x5038e5/_0x26251d*(0x1-erlangb(_0x5038e5,_0x26251d));}return _0x480efd({'erlangCalls':_0x500cb0,'erlangCallToSecond':_0x4f61c5/_0x500cb0,'erlangAbandonmentRate':_0x2ee2ca,'erlangBusyFactor':_0x558f30});});};module[_0x3552('0x21b')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index c820ed4..ff23fbf 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 _0xc09f=['endtime','ringtime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','droptime'];(function(_0x3a67f1,_0x5d307e){var _0x41c1ee=function(_0x1f85e7){while(--_0x1f85e7){_0x3a67f1['push'](_0x3a67f1['shift']());}};_0x41c1ee(++_0x5d307e);}(_0xc09f,0xe4));var _0xfc09=function(_0x35f969,_0x2c03bd){_0x35f969=_0x35f969-0x0;var _0x373c46=_0xc09f[_0x35f969];return _0x373c46;};'use strict';var util=require(_0xfc09('0x0'));var _=require(_0xfc09('0x1'));var moment=require('moment');function getSeconds(_0x1bb2c0,_0x43face){var _0x14a2a7=moment(_0x1bb2c0)['milliseconds'](0x0);var _0x1bfdb5=moment(_0x43face)['milliseconds'](0x0);return _0x14a2a7[_0xfc09('0x2')](_0x1bfdb5,_0xfc09('0x3'));}function QueueCallerAbandon(_0x40b006,_0x391a64){this['scheduledat']=_0x40b006[_0xfc09('0x4')];this[_0xfc09('0x5')]=_0x40b006[_0xfc09('0x5')];this[_0xfc09('0x6')]=_0x40b006[_0xfc09('0x5')]===_0xfc09('0x7')?_0xfc09('0x8'):_0x40b006[_0xfc09('0x5')];this[_0xfc09('0x9')]=_0x40b006[_0xfc09('0x9')];this[_0xfc09('0xa')]=_0x40b006['countcongestionretry'];this[_0xfc09('0xb')]=_0x40b006[_0xfc09('0xb')];this['countglobal']=_0x40b006['countbusyretry']+_0x40b006[_0xfc09('0xa')]+_0x40b006[_0xfc09('0xb')]+_0x40b006[_0xfc09('0xc')]+_0x40b006[_0xfc09('0xd')]+_0x40b006[_0xfc09('0xe')]+_0x40b006['countmachineretry']+_0x40b006[_0xfc09('0xf')];this[_0xfc09('0xc')]=_0x40b006['countnosuchnumberretry'];this['countdropretry']=_0x40b006[_0xfc09('0xd')];this[_0xfc09('0xe')]=_0x40b006[_0xfc09('0xe')];this['countmachineretry']=_0x40b006[_0xfc09('0x10')];this[_0xfc09('0xf')]=_0x40b006[_0xfc09('0xf')];this[_0xfc09('0x11')]=_0x391a64[_0xfc09('0x11')];this[_0xfc09('0x12')]=_0x40b006[_0xfc09('0x13')];this[_0xfc09('0x14')]=_0x40b006['number'];this['starttime']=_0x40b006[_0xfc09('0x15')];this[_0xfc09('0x16')]=_0x40b006[_0xfc09('0x16')];this['droptime']=_0x40b006[_0xfc09('0x17')];this[_0xfc09('0x18')]=this[_0xfc09('0x17')];this[_0xfc09('0x19')]=getSeconds(_0x40b006[_0xfc09('0x16')],_0x40b006[_0xfc09('0x15')]);this[_0xfc09('0x1a')]=getSeconds(this[_0xfc09('0x17')],_0x40b006[_0xfc09('0x16')]);this[_0xfc09('0x1b')]=0x0;this['queue']=_0x391a64['queue'];this[_0xfc09('0x1c')]=_0x391a64[_0xfc09('0x1d')];this[_0xfc09('0x1e')]=_0x391a64[_0xfc09('0x1e')];this[_0xfc09('0x1f')]=_0x40b006[_0xfc09('0x1f')];this[_0xfc09('0x20')]=_0x40b006[_0xfc09('0x20')];this[_0xfc09('0x21')]=_0x40b006['callbackat'];this['recallme']=_0x40b006[_0xfc09('0x22')];this['ContactId']=_0x40b006[_0xfc09('0x23')];this['ListId']=_0x40b006['ListId'];this[_0xfc09('0x24')]=_0x40b006[_0xfc09('0x24')];this[_0xfc09('0x25')]=_0x40b006[_0xfc09('0x25')];this['CampaignId']=_0x40b006[_0xfc09('0x26')];this[_0xfc09('0x27')]=_0x40b006['originatecalleridnum']||'';this[_0xfc09('0x28')]=_0x40b006[_0xfc09('0x28')]||'';}module[_0xfc09('0x29')]=QueueCallerAbandon; \ No newline at end of file +var _0x3600=['countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','droptime','endtime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x7a7f84,_0xe1b7a9){var _0x46a5df=function(_0x4d71c1){while(--_0x4d71c1){_0x7a7f84['push'](_0x7a7f84['shift']());}};_0x46a5df(++_0xe1b7a9);}(_0x3600,0x142));var _0x0360=function(_0x46644f,_0x1bf71){_0x46644f=_0x46644f-0x0;var _0x11dd3f=_0x3600[_0x46644f];return _0x11dd3f;};'use strict';var util=require(_0x0360('0x0'));var _=require(_0x0360('0x1'));var moment=require(_0x0360('0x2'));function getSeconds(_0x397c2b,_0x54ae3f){var _0x2a8514=moment(_0x397c2b)[_0x0360('0x3')](0x0);var _0x4b2a02=moment(_0x54ae3f)[_0x0360('0x3')](0x0);return _0x2a8514[_0x0360('0x4')](_0x4b2a02,_0x0360('0x5'));}function QueueCallerAbandon(_0x3c03af,_0x3172f7){this['scheduledat']=_0x3c03af[_0x0360('0x6')];this[_0x0360('0x7')]=_0x3c03af[_0x0360('0x7')];this[_0x0360('0x8')]=_0x3c03af[_0x0360('0x7')]==='outbound'?_0x0360('0x9'):_0x3c03af['type'];this[_0x0360('0xa')]=_0x3c03af[_0x0360('0xa')];this[_0x0360('0xb')]=_0x3c03af[_0x0360('0xb')];this['countnoanswerretry']=_0x3c03af[_0x0360('0xc')];this[_0x0360('0xd')]=_0x3c03af[_0x0360('0xa')]+_0x3c03af[_0x0360('0xb')]+_0x3c03af[_0x0360('0xc')]+_0x3c03af[_0x0360('0xe')]+_0x3c03af['countdropretry']+_0x3c03af['countabandonedretry']+_0x3c03af[_0x0360('0xf')]+_0x3c03af[_0x0360('0x10')];this[_0x0360('0xe')]=_0x3c03af[_0x0360('0xe')];this[_0x0360('0x11')]=_0x3c03af[_0x0360('0x11')];this[_0x0360('0x12')]=_0x3c03af[_0x0360('0x12')];this[_0x0360('0xf')]=_0x3c03af[_0x0360('0xf')];this[_0x0360('0x10')]=_0x3c03af[_0x0360('0x10')];this[_0x0360('0x13')]=_0x3172f7[_0x0360('0x13')];this[_0x0360('0x14')]=_0x3c03af['name'];this[_0x0360('0x15')]=_0x3c03af[_0x0360('0x16')];this[_0x0360('0x17')]=_0x3c03af[_0x0360('0x17')];this[_0x0360('0x18')]=_0x3c03af[_0x0360('0x18')];this[_0x0360('0x19')]=_0x3c03af[_0x0360('0x19')];this[_0x0360('0x1a')]=this[_0x0360('0x19')];this['ringtime']=getSeconds(_0x3c03af[_0x0360('0x18')],_0x3c03af[_0x0360('0x17')]);this[_0x0360('0x1b')]=getSeconds(this[_0x0360('0x19')],_0x3c03af['responsetime']);this[_0x0360('0x1c')]=0x0;this['queue']=_0x3172f7[_0x0360('0x9')];this[_0x0360('0x1d')]=_0x3172f7[_0x0360('0x1e')];this[_0x0360('0x1f')]=_0x3172f7[_0x0360('0x1f')];this[_0x0360('0x20')]=_0x3c03af[_0x0360('0x20')];this[_0x0360('0x21')]=_0x3c03af[_0x0360('0x21')];this[_0x0360('0x22')]=_0x3c03af[_0x0360('0x22')];this[_0x0360('0x23')]=_0x3c03af['recallme'];this[_0x0360('0x24')]=_0x3c03af[_0x0360('0x24')];this[_0x0360('0x25')]=_0x3c03af['ListId'];this[_0x0360('0x26')]=_0x3c03af[_0x0360('0x26')];this[_0x0360('0x27')]=_0x3c03af[_0x0360('0x27')];this[_0x0360('0x28')]=_0x3c03af[_0x0360('0x28')];this['originatecalleridnum']=_0x3c03af['originatecalleridnum']||'';this[_0x0360('0x29')]=_0x3c03af['originatecalleridname']||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index bd68181..f0eac25 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(_0x2c5927,_0x1ff12a){var _0x3e60d5=function(_0x230e0f){while(--_0x230e0f){_0x2c5927['push'](_0x2c5927['shift']());}};_0x3e60d5(++_0x1ff12a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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(_0x57bf80,_0x50034b){var _0x3aed5=function(_0x12bd9a){while(--_0x12bd9a){_0x57bf80['push'](_0x57bf80['shift']());}};_0x3aed5(++_0x50034b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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 690cd76..4dddd42 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 _0x0203=['[Fax][checkTrunk][Trunk\x20not\x20work]','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','lodash','bluebird','uuid','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','actions','newchannel','syncNewchannel','bind','syncVarSet','newstate','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','syncNewState','channelstate','channelstatedesc','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','then','error','\x20notify\x20','catch','\x20receiveFax\x20','stringify','merge','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][NoUpdate1]','\x20hangup\x20sendFile\x20','faxpages','faxstatusstring','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','ext','isTrunkReachable','isNil','active','trunks','SIP/%s','reachable','unmonitored'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0x0203,0xeb));var _0x3020=function(_0x3e5674,_0x3d5148){_0x3e5674=_0x3e5674-0x0;var _0x105877=_0x0203[_0x3e5674];return _0x105877;};'use strict';var util=require('util');var _=require(_0x3020('0x0'));var BPromise=require(_0x3020('0x1'));var uuid=require(_0x3020('0x2'));var moment=require('moment');var path=require('path');var tiff2pdf=require(_0x3020('0x3'));var gs=require(_0x3020('0x4'));var logger=require(_0x3020('0x5'))(_0x3020('0x6'));var ami=require(_0x3020('0x7'));var rpcDb=require(_0x3020('0x8'));var Channel=require(_0x3020('0x9'));var ut=require(_0x3020('0xa'));var Action=require(_0x3020('0xb'));var faxAccount=require(_0x3020('0xc'));var attachment=require(_0x3020('0xd'));var faxMessage=require(_0x3020('0xe'));function Fax(_0x59ee68){this[_0x3020('0xf')]={};this[_0x3020('0x10')]=_0x59ee68[_0x3020('0x10')];this['trunks']=_0x59ee68['trunks'];this[_0x3020('0x11')]={};ami['on'](_0x3020('0x12'),this[_0x3020('0x13')][_0x3020('0x14')](this));ami['on']('varset',this[_0x3020('0x15')][_0x3020('0x14')](this));ami['on'](_0x3020('0x16'),this['syncNewState']['bind'](this));ami['on']('newexten',this[_0x3020('0x17')][_0x3020('0x14')](this));ami['on'](_0x3020('0x18'),this[_0x3020('0x19')][_0x3020('0x14')](this));ami['on'](_0x3020('0x1a'),this[_0x3020('0x1b')][_0x3020('0x14')](this));ami['on'](_0x3020('0x1c'),this[_0x3020('0x1d')]['bind'](this));ami['on'](_0x3020('0x1e'),this[_0x3020('0x1f')][_0x3020('0x14')](this));}Fax[_0x3020('0x20')][_0x3020('0x13')]=function(_0x5685e){if(_0x5685e[_0x3020('0x21')]==='from-voip-provider'){for(var _0x3ac75c in this[_0x3020('0x10')]){if(this['faxAccounts'][_0x3020('0x22')](_0x3ac75c)){if(_0x5685e[_0x3020('0x23')]===this[_0x3020('0x10')][_0x3ac75c][_0x3020('0x24')]){this[_0x3020('0xf')][_0x5685e['uniqueid']]={};this[_0x3020('0xf')][_0x5685e[_0x3020('0x25')]][_0x3020('0x26')]=_0x5685e['channel'];this[_0x3020('0xf')][_0x5685e[_0x3020('0x25')]]['id']=this['faxAccounts'][_0x3ac75c]['id'];this[_0x3020('0xf')][_0x5685e[_0x3020('0x25')]][_0x3020('0x27')]=this[_0x3020('0x10')][_0x3ac75c][_0x3020('0x27')];logger[_0x3020('0x28')](_0x5685e['uniqueid'],'\x20syncNewchannel\x20');}}}}if(this['actions'][_0x5685e[_0x3020('0x25')]]){this[_0x3020('0xf')][_0x5685e[_0x3020('0x25')]]={};this['channels'][_0x5685e[_0x3020('0x25')]][_0x3020('0x26')]=_0x5685e[_0x3020('0x26')];logger[_0x3020('0x28')](_0x5685e[_0x3020('0x25')],_0x3020('0x29'));}};Fax[_0x3020('0x20')][_0x3020('0x15')]=function(_0x307ce9){if(this[_0x3020('0xf')][_0x307ce9['uniqueid']]){for(var _0x448568 in _0x307ce9[_0x3020('0x2a')]){if(_0x307ce9[_0x3020('0x2a')]['hasOwnProperty'](_0x448568)){this[_0x3020('0xf')][_0x307ce9['uniqueid']][_0x448568]=_0x307ce9[_0x3020('0x2b')];}}}};Fax[_0x3020('0x20')][_0x3020('0x2c')]=function(_0x4e817c){if(this[_0x3020('0xf')][_0x4e817c[_0x3020('0x25')]]){this[_0x3020('0xf')][_0x4e817c[_0x3020('0x25')]]['channelstate']=_0x4e817c[_0x3020('0x2d')];this['channels'][_0x4e817c[_0x3020('0x25')]][_0x3020('0x2e')]=_0x4e817c[_0x3020('0x2e')];}};Fax[_0x3020('0x20')][_0x3020('0x17')]=function(_0x19a990){if(this[_0x3020('0xf')][_0x19a990['uniqueid']]){for(var _0xc0c7d2 in _0x19a990[_0x3020('0x2a')]){if(_0x19a990[_0x3020('0x2a')]['hasOwnProperty'](_0xc0c7d2)){this[_0x3020('0xf')][_0x19a990[_0x3020('0x25')]][_0xc0c7d2]=_0x19a990[_0x3020('0x2b')];}}}};Fax['prototype'][_0x3020('0x19')]=function(_0x4ce499){if(this[_0x3020('0xf')][_0x4ce499[_0x3020('0x25')]]){this[_0x3020('0xf')][_0x4ce499[_0x3020('0x25')]][_0x3020('0x2f')]=_0x4ce499[_0x3020('0x2f')];this[_0x3020('0xf')][_0x4ce499[_0x3020('0x25')]][_0x3020('0x30')]=_0x4ce499[_0x3020('0x30')];this['channels'][_0x4ce499[_0x3020('0x25')]][_0x3020('0x24')]=_0x4ce499['localstationid'];this[_0x3020('0xf')][_0x4ce499['uniqueid']][_0x3020('0x31')]=_0x4ce499[_0x3020('0x31')];logger[_0x3020('0x28')](_0x4ce499[_0x3020('0x25')],'\x20syncFaxStatus\x20');}};Fax['prototype'][_0x3020('0x1b')]=function(_0xb4ef47){var _0x4385c1=this;if(this['channels'][_0xb4ef47['uniqueid']]){var _0x32b183=this[_0x3020('0xf')][_0xb4ef47['uniqueid']]['id'];this[_0x3020('0xf')][_0xb4ef47[_0x3020('0x25')]]['remotestationid']=_0xb4ef47[_0x3020('0x32')];this[_0x3020('0xf')][_0xb4ef47[_0x3020('0x25')]][_0x3020('0x33')]=_0xb4ef47[_0x3020('0x33')];this[_0x3020('0xf')][_0xb4ef47['uniqueid']][_0x3020('0x24')]=_0xb4ef47[_0x3020('0x24')];this[_0x3020('0xf')][_0xb4ef47['uniqueid']][_0x3020('0x34')]=_0xb4ef47[_0x3020('0x34')];this['channels'][_0xb4ef47['uniqueid']][_0x3020('0x35')]=_0xb4ef47[_0x3020('0x35')];this[_0x3020('0xf')][_0xb4ef47[_0x3020('0x25')]]['filename']=_0xb4ef47[_0x3020('0x31')];this[_0x3020('0xf')][_0xb4ef47['uniqueid']][_0x3020('0x36')]=_0xb4ef47[_0x3020('0x36')];if(this[_0x3020('0xf')][_0xb4ef47[_0x3020('0x25')]][_0x3020('0x33')]>0x0){tiff2pdf(_0xb4ef47[_0x3020('0x31')],'/var/opt/motion2/server/files/attachments/',function(_0xb97335){logger[_0x3020('0x28')](_0xb4ef47['uniqueid'],_0x3020('0x37'),_0xb97335[_0x3020('0x38')]);attachment[_0x3020('0x39')]({'name':path[_0x3020('0x3a')](_0xb4ef47[_0x3020('0x31')])[_0x3020('0x27')],'basename':path['parse'](_0xb4ef47[_0x3020('0x31')])[_0x3020('0x27')]+_0x3020('0x3b'),'type':'application/pdf'})[_0x3020('0x3c')](function(_0x2b45e8){faxAccount['notify'](_0x32b183,{'from':_0xb4ef47[_0x3020('0x36')],'mapKey':'fax','body':path[_0x3020('0x3a')](_0xb4ef47['filename'])['name']+_0x3020('0x3b'),'AttachmentId':_0x2b45e8['id']})['catch'](function(_0x376cb2){logger[_0x3020('0x3d')](_0xb4ef47[_0x3020('0x25')],_0x3020('0x3e'),JSON['stringify'](_0x376cb2));});})[_0x3020('0x3f')](function(_0x2876f7){logger['error'](_0xb4ef47[_0x3020('0x25')],_0x3020('0x40'),JSON[_0x3020('0x41')](_0x2876f7));});});}logger[_0x3020('0x28')](_0xb4ef47[_0x3020('0x25')],_0x3020('0x40'));}};Fax[_0x3020('0x20')][_0x3020('0x1f')]=function(_0x30f053){if(this[_0x3020('0x11')][_0x30f053['uniqueid']]){_[_0x3020('0x42')](this['channels'][_0x30f053[_0x3020('0x25')]],_['pick'](_0x30f053,['response',_0x3020('0x43')]));}};function updateStatus(_0x470a82){if(_0x470a82[_0x3020('0x44')]){faxMessage[_0x3020('0x45')](_0x470a82[_0x3020('0x44')],{'failMessage':_0x3020('0x46')})[_0x3020('0x3c')](function(_0x4bb9af){ut[_0x3020('0x47')](_0x3020('0x48'),_0x4bb9af);})[_0x3020('0x3f')](function(_0xa797fa){ut['logger']('[Fax][Message][Error][NoUpdate1]',_0xa797fa);});}else{ut[_0x3020('0x47')](_0x3020('0x49'));}}Fax['prototype'][_0x3020('0x4a')]=function(_0x49bd72,_0x52da08,_0x49693b){var _0x32f8a2=this;var _0x51bc0c={};if(_0x52da08){_0x51bc0c={'read':_0x52da08};}else{_0x51bc0c={'failMessage':_0x49693b};}if(this[_0x3020('0x11')][_0x49bd72]['AttachmentId']){faxMessage[_0x3020('0x45')](this[_0x3020('0x11')][_0x49bd72][_0x3020('0x44')],_0x51bc0c)[_0x3020('0x3c')](function(_0x58feee){ut[_0x3020('0x47')]('[Fax][Message][Updated]',_0x58feee);})['catch'](function(_0x3a965c){ut[_0x3020('0x47')](_0x3020('0x4b'),_0x3a965c);})['finally'](function(){delete _0x32f8a2[_0x3020('0xf')][_0x49bd72];delete _0x32f8a2[_0x3020('0x11')][_0x49bd72];});}else{ut['logger']('[Fax][Message][NoUpdate2]');delete this[_0x3020('0xf')][_0x49bd72];delete this[_0x3020('0x11')][_0x49bd72];}};Fax[_0x3020('0x20')][_0x3020('0x1d')]=function(_0x122710){var _0x18c025=this;if(this[_0x3020('0xf')][_0x122710[_0x3020('0x25')]]){if(this[_0x3020('0x11')][_0x122710[_0x3020('0x25')]]){this[_0x3020('0xf')][_0x122710[_0x3020('0x25')]]['id']=this['actions'][_0x122710[_0x3020('0x25')]]['id'];this['channels'][_0x122710[_0x3020('0x25')]][_0x3020('0x27')]=this['actions'][_0x122710[_0x3020('0x25')]][_0x3020('0x27')];}logger['info'](_0x122710[_0x3020('0x25')],this['actions'][_0x122710[_0x3020('0x25')]]?_0x3020('0x4c'):'\x20hangup\x20faxRiceive\x20',JSON[_0x3020('0x41')](this[_0x3020('0xf')][_0x122710[_0x3020('0x25')]]));if(this['actions'][_0x122710[_0x3020('0x25')]]){if(this[_0x3020('0xf')][_0x122710[_0x3020('0x25')]][_0x3020('0x4d')]>0x0&&this[_0x3020('0xf')][_0x122710['uniqueid']][_0x3020('0x18')]==='SUCCESS'){this[_0x3020('0x4a')](_0x122710[_0x3020('0x25')],!![]);}else{this[_0x3020('0x4a')](_0x122710[_0x3020('0x25')],![],this[_0x3020('0xf')][_0x122710[_0x3020('0x25')]][_0x3020('0x4e')]?'SENDING\x20FAILED:\x20'+this['channels'][_0x122710[_0x3020('0x25')]][_0x3020('0x4e')]:'SENDING\x20FAILED');}}}};Fax[_0x3020('0x20')]['send']=function(_0x3c473c){var _0xaadb0d=this;return new BPromise(function(_0x57395a,_0x338b42){_0xaadb0d['execOriginate'](_0x3c473c,_0xaadb0d[_0x3020('0x10')][_0x3c473c[_0x3020('0x4f')]])['then'](function(_0x3a05cc){ut[_0x3020('0x47')](_0x3020('0x50'),_0x3a05cc);_0x57395a(ut[_0x3020('0x38')](_0x3020('0x51')));})[_0x3020('0x3f')](function(_0x108571){ut[_0x3020('0x47')](_0x3020('0x52'),_0x108571);updateStatus(_0x3c473c);_0x338b42(ut['message'](_0x3020('0x53')));});});};Fax[_0x3020('0x20')]['checkAfterSend']=function(_0x757ac4){var _0x2eae75=this;return new BPromise(function(_0x5f57f3,_0x3ff3a1){var _0xb4ecda=_0x2eae75[_0x3020('0x54')](_0x2eae75[_0x3020('0x10')][_0x757ac4[_0x3020('0x4f')]][_0x3020('0x55')],_0x757ac4);if(_0xb4ecda[_0x3020('0x56')]){_0x5f57f3(ut[_0x3020('0x38')](_0x3020('0x57')));}else{_0x3ff3a1(ut[_0x3020('0x38')](_0xb4ecda['message']));}});};function originate(_0x2ccda3,_0x205af8,_0x3179a2){return new BPromise(function(_0x36b066,_0x2a07fa){if(_0x3179a2){var _0x1a4440=util[_0x3020('0x58')](_0x3020('0x59'),path[_0x3020('0x3a')](_0x2ccda3[_0x3020('0x5a')])[_0x3020('0x27')],_0x2ccda3[_0x3020('0x5a')]);gs[_0x3020('0x5b')](_0x1a4440)[_0x3020('0x3c')](function(){_0x2ccda3[_0x3020('0x5a')]=util[_0x3020('0x58')](_0x3020('0x5c'),path[_0x3020('0x3a')](_0x2ccda3['path'])[_0x3020('0x5d')],path[_0x3020('0x3a')](_0x2ccda3[_0x3020('0x5a')])[_0x3020('0x27')]);_0x205af8[_0x3020('0x5e')]=_0x2ccda3['path'];ut[_0x3020('0x47')](_0x3020('0x5f'),'');ami[_0x3020('0x60')](ut[_0x3020('0x61')](_0x2ccda3,_0x205af8))[_0x3020('0x3c')](function(_0x4356ec){_0x36b066(_0x4356ec);})[_0x3020('0x3f')](function(_0x4f0ddb){_0x2a07fa(_0x4f0ddb);});})['catch'](function(_0x362e08){_0x2a07fa(_0x362e08);});}else{ami[_0x3020('0x60')](ut[_0x3020('0x61')](_0x2ccda3,_0x205af8))[_0x3020('0x3c')](function(_0x74cc12){_0x36b066(_0x74cc12);})[_0x3020('0x3f')](function(_0x4fe6b0){_0x2a07fa(_0x4fe6b0);});}});}Fax['prototype'][_0x3020('0x62')]=function(_0x3a6c49,_0x326a7f){var _0x4a5a80=this;return new BPromise(function(_0x5a9809,_0x3f026d){var _0x79cfec=uuid['v4']();var _0x57e17f=ut['addVariables'](_0x3a6c49,_0x326a7f);_0x4a5a80[_0x3020('0x11')][_0x79cfec]=new Action(_0x79cfec,_0x326a7f,_0x3a6c49);var _0x271da8=_0x4a5a80[_0x3020('0x11')][_0x79cfec];if(path[_0x3020('0x3a')](_0x3a6c49['path'])[_0x3020('0x63')]===_0x3020('0x3b')){originate(_0x271da8,_0x57e17f,!![])[_0x3020('0x3c')](function(_0x2fb64f){_0x5a9809(_0x2fb64f);})[_0x3020('0x3f')](function(_0x143a85){_0x3f026d(_0x143a85);});}else{originate(_0x271da8,_0x57e17f,![])[_0x3020('0x3c')](function(_0x807b81){_0x5a9809(_0x807b81);})[_0x3020('0x3f')](function(_0x303c69){_0x3f026d(_0x303c69);});}});};Fax[_0x3020('0x20')][_0x3020('0x64')]=function(_0x150bdf){return!_['isNil'](_0x150bdf)&&!_[_0x3020('0x65')](_0x150bdf['name'])&&!_[_0x3020('0x65')](_0x150bdf[_0x3020('0x66')])&&_0x150bdf[_0x3020('0x66')]&&!_[_0x3020('0x65')](this[_0x3020('0x67')][util[_0x3020('0x58')](_0x3020('0x68'),_0x150bdf[_0x3020('0x27')])])&&!_['isNil'](this[_0x3020('0x67')][util[_0x3020('0x58')](_0x3020('0x68'),_0x150bdf[_0x3020('0x27')])][_0x3020('0x30')])&&(this[_0x3020('0x67')][util[_0x3020('0x58')]('SIP/%s',_0x150bdf[_0x3020('0x27')])][_0x3020('0x30')]===_0x3020('0x69')||this[_0x3020('0x67')][util[_0x3020('0x58')]('SIP/%s',_0x150bdf['name'])][_0x3020('0x30')]===_0x3020('0x6a'));};Fax[_0x3020('0x20')][_0x3020('0x54')]=function(_0x227f83,_0x54a105){if(!this[_0x3020('0x64')](_0x227f83)){ut[_0x3020('0x47')](_0x3020('0x6b'),_[_0x3020('0x65')](_0x227f83)?'':_0x227f83[_0x3020('0x27')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x3020('0x6c')};}if(_[_0x3020('0x65')](_0x54a105['fax'])){ut[_0x3020('0x47')](_0x3020('0x6d'),JSON['stringify'](_0x54a105));return{'isValid':![],'message':_0x3020('0x6e')};}if(_[_0x3020('0x65')](_0x54a105[_0x3020('0x5a')])){ut[_0x3020('0x47')](_0x3020('0x6f'),JSON[_0x3020('0x41')](_0x54a105));return{'isValid':![],'message':_0x3020('0x70')};}return{'isValid':!![],'message':_0x3020('0x71')};};module['exports']=Fax; \ No newline at end of file +var _0xfd33=['Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','exports','util','lodash','bluebird','uuid','moment','./util/gs','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','syncNewState','newexten','faxstatus','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','channelstate','channelstatedesc','syncNewExten','variable','syncFaxStatus','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','create','parse','then','notify','.pdf','error','\x20notify\x20','catch','pick','reason','AttachmentId','logger','[Fax][Message][Error][NoUpdate1]','update','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','stringify','faxpages','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','Fax\x20received','message','Fax\x20failed','checkAfterSend','Trunk','isValid','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','variablesAction','Action','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active'];(function(_0x45c11f,_0x3c1f86){var _0x4d3543=function(_0x18c9de){while(--_0x18c9de){_0x45c11f['push'](_0x45c11f['shift']());}};_0x4d3543(++_0x3c1f86);}(_0xfd33,0xf4));var _0x3fd3=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xfd33[_0x397e5f];return _0x5302b8;};'use strict';var util=require(_0x3fd3('0x0'));var _=require(_0x3fd3('0x1'));var BPromise=require(_0x3fd3('0x2'));var uuid=require(_0x3fd3('0x3'));var moment=require(_0x3fd3('0x4'));var path=require('path');var tiff2pdf=require('tiff2pdf');var gs=require(_0x3fd3('0x5'));var logger=require('../../../config/logger')(_0x3fd3('0x6'));var ami=require(_0x3fd3('0x7'));var rpcDb=require(_0x3fd3('0x8'));var Channel=require(_0x3fd3('0x9'));var ut=require(_0x3fd3('0xa'));var Action=require(_0x3fd3('0xb'));var faxAccount=require(_0x3fd3('0xc'));var attachment=require(_0x3fd3('0xd'));var faxMessage=require(_0x3fd3('0xe'));function Fax(_0x2b8d4c){this['channels']={};this[_0x3fd3('0xf')]=_0x2b8d4c[_0x3fd3('0xf')];this[_0x3fd3('0x10')]=_0x2b8d4c[_0x3fd3('0x10')];this[_0x3fd3('0x11')]={};ami['on'](_0x3fd3('0x12'),this[_0x3fd3('0x13')][_0x3fd3('0x14')](this));ami['on'](_0x3fd3('0x15'),this[_0x3fd3('0x16')][_0x3fd3('0x14')](this));ami['on']('newstate',this[_0x3fd3('0x17')][_0x3fd3('0x14')](this));ami['on'](_0x3fd3('0x18'),this['syncNewExten'][_0x3fd3('0x14')](this));ami['on'](_0x3fd3('0x19'),this['syncFaxStatus'][_0x3fd3('0x14')](this));ami['on']('receivefax',this[_0x3fd3('0x1a')]['bind'](this));ami['on'](_0x3fd3('0x1b'),this[_0x3fd3('0x1c')][_0x3fd3('0x14')](this));ami['on'](_0x3fd3('0x1d'),this[_0x3fd3('0x1e')][_0x3fd3('0x14')](this));}Fax[_0x3fd3('0x1f')]['syncNewchannel']=function(_0x4ec25b){if(_0x4ec25b[_0x3fd3('0x20')]===_0x3fd3('0x21')){for(var _0x2b5856 in this[_0x3fd3('0xf')]){if(this[_0x3fd3('0xf')][_0x3fd3('0x22')](_0x2b5856)){if(_0x4ec25b[_0x3fd3('0x23')]===this[_0x3fd3('0xf')][_0x2b5856][_0x3fd3('0x24')]){this[_0x3fd3('0x25')][_0x4ec25b[_0x3fd3('0x26')]]={};this['channels'][_0x4ec25b[_0x3fd3('0x26')]][_0x3fd3('0x27')]=_0x4ec25b[_0x3fd3('0x27')];this[_0x3fd3('0x25')][_0x4ec25b['uniqueid']]['id']=this[_0x3fd3('0xf')][_0x2b5856]['id'];this[_0x3fd3('0x25')][_0x4ec25b[_0x3fd3('0x26')]][_0x3fd3('0x28')]=this['faxAccounts'][_0x2b5856]['name'];logger[_0x3fd3('0x29')](_0x4ec25b[_0x3fd3('0x26')],_0x3fd3('0x2a'));}}}}if(this[_0x3fd3('0x11')][_0x4ec25b[_0x3fd3('0x26')]]){this[_0x3fd3('0x25')][_0x4ec25b[_0x3fd3('0x26')]]={};this[_0x3fd3('0x25')][_0x4ec25b['uniqueid']][_0x3fd3('0x27')]=_0x4ec25b[_0x3fd3('0x27')];logger[_0x3fd3('0x29')](_0x4ec25b[_0x3fd3('0x26')],'\x20syncNewchannel\x20');}};Fax[_0x3fd3('0x1f')][_0x3fd3('0x16')]=function(_0x42295e){if(this[_0x3fd3('0x25')][_0x42295e[_0x3fd3('0x26')]]){for(var _0x485aea in _0x42295e['variable']){if(_0x42295e['variable']['hasOwnProperty'](_0x485aea)){this[_0x3fd3('0x25')][_0x42295e[_0x3fd3('0x26')]][_0x485aea]=_0x42295e['value'];}}}};Fax[_0x3fd3('0x1f')]['syncNewState']=function(_0x277ed7){if(this[_0x3fd3('0x25')][_0x277ed7[_0x3fd3('0x26')]]){this[_0x3fd3('0x25')][_0x277ed7['uniqueid']][_0x3fd3('0x2b')]=_0x277ed7['channelstate'];this[_0x3fd3('0x25')][_0x277ed7[_0x3fd3('0x26')]][_0x3fd3('0x2c')]=_0x277ed7[_0x3fd3('0x2c')];}};Fax[_0x3fd3('0x1f')][_0x3fd3('0x2d')]=function(_0x42879f){if(this[_0x3fd3('0x25')][_0x42879f[_0x3fd3('0x26')]]){for(var _0x8cc22b in _0x42879f['variable']){if(_0x42879f[_0x3fd3('0x2e')]['hasOwnProperty'](_0x8cc22b)){this['channels'][_0x42879f[_0x3fd3('0x26')]][_0x8cc22b]=_0x42879f['value'];}}}};Fax[_0x3fd3('0x1f')][_0x3fd3('0x2f')]=function(_0x185a4b){if(this[_0x3fd3('0x25')][_0x185a4b[_0x3fd3('0x26')]]){this['channels'][_0x185a4b[_0x3fd3('0x26')]][_0x3fd3('0x30')]=_0x185a4b[_0x3fd3('0x30')];this['channels'][_0x185a4b[_0x3fd3('0x26')]][_0x3fd3('0x31')]=_0x185a4b[_0x3fd3('0x31')];this[_0x3fd3('0x25')][_0x185a4b['uniqueid']][_0x3fd3('0x24')]=_0x185a4b[_0x3fd3('0x24')];this[_0x3fd3('0x25')][_0x185a4b[_0x3fd3('0x26')]][_0x3fd3('0x32')]=_0x185a4b[_0x3fd3('0x32')];logger[_0x3fd3('0x29')](_0x185a4b[_0x3fd3('0x26')],_0x3fd3('0x33'));}};Fax[_0x3fd3('0x1f')][_0x3fd3('0x1a')]=function(_0x20f28f){var _0xb438c=this;if(this[_0x3fd3('0x25')][_0x20f28f[_0x3fd3('0x26')]]){var _0x55e5f3=this[_0x3fd3('0x25')][_0x20f28f[_0x3fd3('0x26')]]['id'];this[_0x3fd3('0x25')][_0x20f28f[_0x3fd3('0x26')]]['remotestationid']=_0x20f28f[_0x3fd3('0x34')];this[_0x3fd3('0x25')][_0x20f28f[_0x3fd3('0x26')]][_0x3fd3('0x35')]=_0x20f28f[_0x3fd3('0x35')];this[_0x3fd3('0x25')][_0x20f28f[_0x3fd3('0x26')]][_0x3fd3('0x24')]=_0x20f28f[_0x3fd3('0x24')];this[_0x3fd3('0x25')][_0x20f28f['uniqueid']][_0x3fd3('0x36')]=_0x20f28f['resolution'];this[_0x3fd3('0x25')][_0x20f28f[_0x3fd3('0x26')]][_0x3fd3('0x37')]=_0x20f28f[_0x3fd3('0x37')];this[_0x3fd3('0x25')][_0x20f28f['uniqueid']][_0x3fd3('0x32')]=_0x20f28f[_0x3fd3('0x32')];this['channels'][_0x20f28f['uniqueid']]['calleridnum']=_0x20f28f[_0x3fd3('0x38')];if(this[_0x3fd3('0x25')][_0x20f28f[_0x3fd3('0x26')]][_0x3fd3('0x35')]>0x0){tiff2pdf(_0x20f28f[_0x3fd3('0x32')],_0x3fd3('0x39'),function(_0x538618){logger['info'](_0x20f28f[_0x3fd3('0x26')],_0x3fd3('0x3a'),_0x538618['message']);attachment[_0x3fd3('0x3b')]({'name':path[_0x3fd3('0x3c')](_0x20f28f[_0x3fd3('0x32')])[_0x3fd3('0x28')],'basename':path['parse'](_0x20f28f[_0x3fd3('0x32')])[_0x3fd3('0x28')]+'.pdf','type':'application/pdf'})[_0x3fd3('0x3d')](function(_0x3b83d2){faxAccount[_0x3fd3('0x3e')](_0x55e5f3,{'from':_0x20f28f['calleridnum'],'mapKey':_0x3fd3('0x6'),'body':path['parse'](_0x20f28f[_0x3fd3('0x32')])[_0x3fd3('0x28')]+_0x3fd3('0x3f'),'AttachmentId':_0x3b83d2['id']})['catch'](function(_0x444b94){logger[_0x3fd3('0x40')](_0x20f28f[_0x3fd3('0x26')],_0x3fd3('0x41'),JSON['stringify'](_0x444b94));});})[_0x3fd3('0x42')](function(_0x1d7f13){logger[_0x3fd3('0x40')](_0x20f28f[_0x3fd3('0x26')],'\x20receiveFax\x20',JSON['stringify'](_0x1d7f13));});});}logger[_0x3fd3('0x29')](_0x20f28f['uniqueid'],'\x20receiveFax\x20');}};Fax['prototype']['syncOriginateResponse']=function(_0x5c136d){if(this[_0x3fd3('0x11')][_0x5c136d['uniqueid']]){_['merge'](this[_0x3fd3('0x25')][_0x5c136d[_0x3fd3('0x26')]],_[_0x3fd3('0x43')](_0x5c136d,['response',_0x3fd3('0x44')]));}};function updateStatus(_0x4e90e7){if(_0x4e90e7[_0x3fd3('0x45')]){faxMessage['update'](_0x4e90e7[_0x3fd3('0x45')],{'failMessage':'SENDING\x20FAILED\x20'})['then'](function(_0x5b6d54){ut['logger']('[Fax][Message][Error][Updated]',_0x5b6d54);})[_0x3fd3('0x42')](function(_0xcceda2){ut[_0x3fd3('0x46')](_0x3fd3('0x47'),_0xcceda2);});}else{ut[_0x3fd3('0x46')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x3fd3('0x1f')]['updateStatus']=function(_0x355e50,_0x2f0619,_0x1e06c5){var _0x2b2b77=this;var _0xacace={};if(_0x2f0619){_0xacace={'read':_0x2f0619};}else{_0xacace={'failMessage':_0x1e06c5};}if(this['actions'][_0x355e50][_0x3fd3('0x45')]){faxMessage[_0x3fd3('0x48')](this[_0x3fd3('0x11')][_0x355e50][_0x3fd3('0x45')],_0xacace)['then'](function(_0x19ffb8){ut[_0x3fd3('0x46')](_0x3fd3('0x49'),_0x19ffb8);})[_0x3fd3('0x42')](function(_0x41f972){ut[_0x3fd3('0x46')](_0x3fd3('0x4a'),_0x41f972);})[_0x3fd3('0x4b')](function(){delete _0x2b2b77[_0x3fd3('0x25')][_0x355e50];delete _0x2b2b77[_0x3fd3('0x11')][_0x355e50];});}else{ut['logger'](_0x3fd3('0x4c'));delete this[_0x3fd3('0x25')][_0x355e50];delete this[_0x3fd3('0x11')][_0x355e50];}};Fax[_0x3fd3('0x1f')][_0x3fd3('0x1c')]=function(_0xe88a55){var _0x276de6=this;if(this[_0x3fd3('0x25')][_0xe88a55[_0x3fd3('0x26')]]){if(this[_0x3fd3('0x11')][_0xe88a55[_0x3fd3('0x26')]]){this['channels'][_0xe88a55[_0x3fd3('0x26')]]['id']=this[_0x3fd3('0x11')][_0xe88a55[_0x3fd3('0x26')]]['id'];this[_0x3fd3('0x25')][_0xe88a55[_0x3fd3('0x26')]][_0x3fd3('0x28')]=this[_0x3fd3('0x11')][_0xe88a55[_0x3fd3('0x26')]]['name'];}logger[_0x3fd3('0x29')](_0xe88a55[_0x3fd3('0x26')],this[_0x3fd3('0x11')][_0xe88a55[_0x3fd3('0x26')]]?_0x3fd3('0x4d'):_0x3fd3('0x4e'),JSON[_0x3fd3('0x4f')](this[_0x3fd3('0x25')][_0xe88a55[_0x3fd3('0x26')]]));if(this['actions'][_0xe88a55[_0x3fd3('0x26')]]){if(this[_0x3fd3('0x25')][_0xe88a55[_0x3fd3('0x26')]][_0x3fd3('0x50')]>0x0&&this[_0x3fd3('0x25')][_0xe88a55[_0x3fd3('0x26')]][_0x3fd3('0x19')]===_0x3fd3('0x51')){this[_0x3fd3('0x52')](_0xe88a55[_0x3fd3('0x26')],!![]);}else{this['updateStatus'](_0xe88a55[_0x3fd3('0x26')],![],this[_0x3fd3('0x25')][_0xe88a55[_0x3fd3('0x26')]][_0x3fd3('0x53')]?_0x3fd3('0x54')+this['channels'][_0xe88a55[_0x3fd3('0x26')]]['faxstatusstring']:_0x3fd3('0x55'));}}}};Fax['prototype'][_0x3fd3('0x56')]=function(_0x3f9a2b){var _0x55172b=this;return new BPromise(function(_0x58f8ee,_0x7c0913){_0x55172b[_0x3fd3('0x57')](_0x3f9a2b,_0x55172b[_0x3fd3('0xf')][_0x3f9a2b[_0x3fd3('0x58')]])[_0x3fd3('0x3d')](function(_0x2fff6a){ut[_0x3fd3('0x46')]('[Fax][execOriginate][success]',_0x2fff6a);_0x58f8ee(ut['message'](_0x3fd3('0x59')));})[_0x3fd3('0x42')](function(_0x5d3f36){ut[_0x3fd3('0x46')]('[Fax][execOriginate][failure]',_0x5d3f36);updateStatus(_0x3f9a2b);_0x7c0913(ut[_0x3fd3('0x5a')](_0x3fd3('0x5b')));});});};Fax[_0x3fd3('0x1f')][_0x3fd3('0x5c')]=function(_0x376811){var _0x45d90d=this;return new BPromise(function(_0x6189c7,_0x3f8bbf){var _0x2a5eb9=_0x45d90d['checkTrunk'](_0x45d90d['faxAccounts'][_0x376811['FaxAccountId']][_0x3fd3('0x5d')],_0x376811);if(_0x2a5eb9[_0x3fd3('0x5e')]){_0x6189c7(ut[_0x3fd3('0x5a')]('Trunk\x20Reachable'));}else{_0x3f8bbf(ut[_0x3fd3('0x5a')](_0x2a5eb9[_0x3fd3('0x5a')]));}});};function originate(_0x422cc9,_0xeb224,_0x18f911){return new BPromise(function(_0x4b5ab9,_0x2c9eb4){if(_0x18f911){var _0x2bc021=util[_0x3fd3('0x5f')](_0x3fd3('0x60'),path[_0x3fd3('0x3c')](_0x422cc9[_0x3fd3('0x61')])[_0x3fd3('0x28')],_0x422cc9[_0x3fd3('0x61')]);gs[_0x3fd3('0x62')](_0x2bc021)[_0x3fd3('0x3d')](function(){_0x422cc9[_0x3fd3('0x61')]=util[_0x3fd3('0x5f')](_0x3fd3('0x63'),path['parse'](_0x422cc9['path'])[_0x3fd3('0x64')],path[_0x3fd3('0x3c')](_0x422cc9[_0x3fd3('0x61')])[_0x3fd3('0x28')]);_0xeb224[_0x3fd3('0x65')]=_0x422cc9[_0x3fd3('0x61')];ut[_0x3fd3('0x46')](_0x3fd3('0x66'),'');ami['Action'](ut[_0x3fd3('0x67')](_0x422cc9,_0xeb224))['then'](function(_0x2dcbc4){_0x4b5ab9(_0x2dcbc4);})[_0x3fd3('0x42')](function(_0x1f97d6){_0x2c9eb4(_0x1f97d6);});})['catch'](function(_0x522b42){_0x2c9eb4(_0x522b42);});}else{ami[_0x3fd3('0x68')](ut['variablesAction'](_0x422cc9,_0xeb224))[_0x3fd3('0x3d')](function(_0x59188c){_0x4b5ab9(_0x59188c);})['catch'](function(_0x54e1ab){_0x2c9eb4(_0x54e1ab);});}});}Fax[_0x3fd3('0x1f')][_0x3fd3('0x57')]=function(_0x52fb3c,_0x2af5fe){var _0xace287=this;return new BPromise(function(_0x26af00,_0x42c23f){var _0x543bc7=uuid['v4']();var _0x209a73=ut[_0x3fd3('0x69')](_0x52fb3c,_0x2af5fe);_0xace287[_0x3fd3('0x11')][_0x543bc7]=new Action(_0x543bc7,_0x2af5fe,_0x52fb3c);var _0x14f759=_0xace287[_0x3fd3('0x11')][_0x543bc7];if(path['parse'](_0x52fb3c[_0x3fd3('0x61')])[_0x3fd3('0x6a')]===_0x3fd3('0x3f')){originate(_0x14f759,_0x209a73,!![])[_0x3fd3('0x3d')](function(_0x447935){_0x26af00(_0x447935);})[_0x3fd3('0x42')](function(_0x1ad184){_0x42c23f(_0x1ad184);});}else{originate(_0x14f759,_0x209a73,![])[_0x3fd3('0x3d')](function(_0x2114ef){_0x26af00(_0x2114ef);})[_0x3fd3('0x42')](function(_0x27f9e6){_0x42c23f(_0x27f9e6);});}});};Fax[_0x3fd3('0x1f')][_0x3fd3('0x6b')]=function(_0x56bd9a){return!_['isNil'](_0x56bd9a)&&!_[_0x3fd3('0x6c')](_0x56bd9a[_0x3fd3('0x28')])&&!_[_0x3fd3('0x6c')](_0x56bd9a[_0x3fd3('0x6d')])&&_0x56bd9a[_0x3fd3('0x6d')]&&!_[_0x3fd3('0x6c')](this[_0x3fd3('0x10')][util[_0x3fd3('0x5f')]('SIP/%s',_0x56bd9a['name'])])&&!_[_0x3fd3('0x6c')](this['trunks'][util[_0x3fd3('0x5f')](_0x3fd3('0x6e'),_0x56bd9a['name'])][_0x3fd3('0x31')])&&(this[_0x3fd3('0x10')][util[_0x3fd3('0x5f')](_0x3fd3('0x6e'),_0x56bd9a[_0x3fd3('0x28')])][_0x3fd3('0x31')]===_0x3fd3('0x6f')||this[_0x3fd3('0x10')][util[_0x3fd3('0x5f')](_0x3fd3('0x6e'),_0x56bd9a[_0x3fd3('0x28')])]['status']===_0x3fd3('0x70'));};Fax[_0x3fd3('0x1f')][_0x3fd3('0x71')]=function(_0x91dcf3,_0x54245a){if(!this[_0x3fd3('0x6b')](_0x91dcf3)){ut[_0x3fd3('0x46')](_0x3fd3('0x72'),_['isNil'](_0x91dcf3)?'':_0x91dcf3['name']+_0x3fd3('0x73'));return{'isValid':![],'message':_0x3fd3('0x74')};}if(_[_0x3fd3('0x6c')](_0x54245a[_0x3fd3('0x6')])){ut[_0x3fd3('0x46')](_0x3fd3('0x75'),JSON[_0x3fd3('0x4f')](_0x54245a));return{'isValid':![],'message':_0x3fd3('0x76')};}if(_['isNil'](_0x54245a['path'])){ut[_0x3fd3('0x46')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0x3fd3('0x4f')](_0x54245a));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x3fd3('0x77')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 156357a..88e8aa4 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 _0x9782=['[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','notify','then','catch'];(function(_0x3eb99d,_0x1ef7ef){var _0x16093b=function(_0x543a06){while(--_0x543a06){_0x3eb99d['push'](_0x3eb99d['shift']());}};_0x16093b(++_0x1ef7ef);}(_0x9782,0x1a5));var _0x2978=function(_0x54cef6,_0x146b0e){_0x54cef6=_0x54cef6-0x0;var _0x39aacf=_0x9782[_0x54cef6];return _0x39aacf;};'use strict';var util=require(_0x2978('0x0'));var BPromise=require(_0x2978('0x1'));var logger=require(_0x2978('0x2'))(_0x2978('0x3'));var _=require(_0x2978('0x4'));var faxAccount=require(_0x2978('0x5'));function loggerCatch(_0x5f2f8d){return function(_0x48fb65){logger[_0x2978('0x6')](_0x5f2f8d,util[_0x2978('0x7')](_0x48fb65,{'showHidden':![],'depth':null}));};}exports[_0x2978('0x8')]=function(_0x24916f,_0x2c5632){return BPromise['resolve']()[_0x2978('0x9')](faxAccount[_0x2978('0x8')](_0x24916f,_0x2c5632))[_0x2978('0xa')](loggerCatch(_0x2978('0xb')));}; \ No newline at end of file +var _0x49b3=['notify','catch','[Notify]\x20','util','bluebird','../../../config/logger','lodash','../rpc/faxAccount','error','inspect','resolve','then'];(function(_0x11414f,_0x10601e){var _0x18a37d=function(_0x545e50){while(--_0x545e50){_0x11414f['push'](_0x11414f['shift']());}};_0x18a37d(++_0x10601e);}(_0x49b3,0x177));var _0x349b=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x49b3[_0x3ff085];return _0x2b68c3;};'use strict';var util=require(_0x349b('0x0'));var BPromise=require(_0x349b('0x1'));var logger=require(_0x349b('0x2'))('preview');var _=require(_0x349b('0x3'));var faxAccount=require(_0x349b('0x4'));function loggerCatch(_0x35c44c){return function(_0x12f8c7){logger[_0x349b('0x5')](_0x35c44c,util[_0x349b('0x6')](_0x12f8c7,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x406544,_0x2560fb){return BPromise[_0x349b('0x7')]()[_0x349b('0x8')](faxAccount[_0x349b('0x9')](_0x406544,_0x2560fb))[_0x349b('0xa')](loggerCatch(_0x349b('0xb')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 96ed326..77cad03 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 _0x9cc8=['util','../../../../config/logger','bluebird','child_process','exec','execute','info','Exec\x20gs'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0x9cc8,0x1b0));var _0x89cc=function(_0x314a28,_0x2f5bd6){_0x314a28=_0x314a28-0x0;var _0x280796=_0x9cc8[_0x314a28];return _0x280796;};'use strict';var util=require(_0x89cc('0x0'));var logger=require(_0x89cc('0x1'))('fax');var BPromise=require(_0x89cc('0x2'));var exec=require(_0x89cc('0x3'))[_0x89cc('0x4')];exports[_0x89cc('0x5')]=function(_0x1099b3){return new BPromise(function(_0x4f1506,_0x1bd5a1){exec(_0x1099b3,function(_0x338860,_0x2f1dc5,_0x56ae64){logger[_0x89cc('0x6')](_0x89cc('0x7'),_0x2f1dc5);if(_0x338860){logger[_0x89cc('0x6')]('Exec\x20gs','\x20Error\x20:',util['inspect'](_0x338860,{'showHidden':![],'depth':null}),_0x2f1dc5,_0x56ae64);_0x1bd5a1(_0x338860);}_0x4f1506(_0x2f1dc5);});});}; \ No newline at end of file +var _0xbea2=['exec','execute','info','Exec\x20gs','\x20Error\x20:','util','../../../../config/logger','fax'];(function(_0x262323,_0x4a81f1){var _0xa963c3=function(_0x5c715e){while(--_0x5c715e){_0x262323['push'](_0x262323['shift']());}};_0xa963c3(++_0x4a81f1);}(_0xbea2,0x115));var _0x2bea=function(_0x324eae,_0x5c9c9a){_0x324eae=_0x324eae-0x0;var _0xf6f723=_0xbea2[_0x324eae];return _0xf6f723;};'use strict';var util=require(_0x2bea('0x0'));var logger=require(_0x2bea('0x1'))(_0x2bea('0x2'));var BPromise=require('bluebird');var exec=require('child_process')[_0x2bea('0x3')];exports[_0x2bea('0x4')]=function(_0x3739c4){return new BPromise(function(_0xe3d2f9,_0x4605b2){exec(_0x3739c4,function(_0x344dfe,_0x2fef71,_0x23dea3){logger[_0x2bea('0x5')](_0x2bea('0x6'),_0x2fef71);if(_0x344dfe){logger['info'](_0x2bea('0x6'),_0x2bea('0x7'),util['inspect'](_0x344dfe,{'showHidden':![],'depth':null}),_0x2fef71,_0x23dea3);_0x4605b2(_0x344dfe);}_0xe3d2f9(_0x2fef71);});});}; \ 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 4f2eba4..55afc28 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 _0x4faa=['modem','gateway','t38timeout','localstationid','path','uniqueid','channel','xcally-motion-fax','from-sip','format','\x22%s\x22\x20<%s>','headerinfo','util','lodash','moment','../../../../config/logger','fax','message','logger','info','inspect','ecm','maxrate','\x22%s\x22'];(function(_0x538dab,_0x2e949c){var _0x3ddd28=function(_0x1fbdfb){while(--_0x1fbdfb){_0x538dab['push'](_0x538dab['shift']());}};_0x3ddd28(++_0x2e949c);}(_0x4faa,0x18c));var _0xa4fa=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0x4faa[_0xbe200f];return _0x192597;};'use strict';var util=require(_0xa4fa('0x0'));var _=require(_0xa4fa('0x1'));var moment=require(_0xa4fa('0x2'));var logger=require(_0xa4fa('0x3'))(_0xa4fa('0x4'));exports[_0xa4fa('0x5')]=function(_0x324ecb){return{'message':_0x324ecb};};exports[_0xa4fa('0x6')]=function(_0x241d66,_0x4b2d34){logger[_0xa4fa('0x7')](_0x241d66,util[_0xa4fa('0x8')](_0x4b2d34,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x118358,_0x45b1c6){var _0x4d38fc={'XMF-ECM':_0x45b1c6[_0xa4fa('0x9')],'XMF-HEADERINFO':_0x45b1c6['headerinfo'],'XMF-MINRATE':_0x45b1c6['minrate'],'XMF-MAXRATE':_0x45b1c6[_0xa4fa('0xa')],'XMF-MODEM':util['format'](_0xa4fa('0xb'),_0x45b1c6[_0xa4fa('0xc')]),'XMF-GATEWAY':_0x45b1c6[_0xa4fa('0xd')],'XMF-FAXDETECT':_0x45b1c6['faxdetect'],'XMF-T38TIMEOUT':_0x45b1c6[_0xa4fa('0xe')],'XMF-LOCALSTATIONID':_0x45b1c6[_0xa4fa('0xf')],'XMF-PATH':_0x118358[_0xa4fa('0x10')]};return _0x4d38fc;};exports['variablesAction']=function(_0x41d10f,_0x492c8a){return{'actionid':_0x41d10f[_0xa4fa('0x11')],'action':'originate','channel':_0x41d10f[_0xa4fa('0x12')],'Exten':_0xa4fa('0x13'),'Context':_0xa4fa('0x14'),'Priority':'1','callerid':util[_0xa4fa('0x15')](_0xa4fa('0x16'),_0x41d10f['headerinfo']?_0x41d10f[_0xa4fa('0x17')]:'',_0x41d10f[_0xa4fa('0xf')]),'variable':_0x492c8a,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x41d10f[_0xa4fa('0x11')]};}; \ No newline at end of file +var _0x16e8=['uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','headerinfo','localstationid','util','lodash','moment','fax','logger','info','inspect','minrate','maxrate','\x22%s\x22','modem','gateway','faxdetect','t38timeout','path','variablesAction'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x16e8,0xc8));var _0x816e=function(_0x2d7133,_0x511d3f){_0x2d7133=_0x2d7133-0x0;var _0x495c07=_0x16e8[_0x2d7133];return _0x495c07;};'use strict';var util=require(_0x816e('0x0'));var _=require(_0x816e('0x1'));var moment=require(_0x816e('0x2'));var logger=require('../../../../config/logger')(_0x816e('0x3'));exports['message']=function(_0x4933bb){return{'message':_0x4933bb};};exports[_0x816e('0x4')]=function(_0x12862a,_0x300189){logger[_0x816e('0x5')](_0x12862a,util[_0x816e('0x6')](_0x300189,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x2382ab,_0x53bf00){var _0x24e13b={'XMF-ECM':_0x53bf00['ecm'],'XMF-HEADERINFO':_0x53bf00['headerinfo'],'XMF-MINRATE':_0x53bf00[_0x816e('0x7')],'XMF-MAXRATE':_0x53bf00[_0x816e('0x8')],'XMF-MODEM':util['format'](_0x816e('0x9'),_0x53bf00[_0x816e('0xa')]),'XMF-GATEWAY':_0x53bf00[_0x816e('0xb')],'XMF-FAXDETECT':_0x53bf00[_0x816e('0xc')],'XMF-T38TIMEOUT':_0x53bf00[_0x816e('0xd')],'XMF-LOCALSTATIONID':_0x53bf00['localstationid'],'XMF-PATH':_0x2382ab[_0x816e('0xe')]};return _0x24e13b;};exports[_0x816e('0xf')]=function(_0x2fc0b5,_0x13db2a){return{'actionid':_0x2fc0b5[_0x816e('0x10')],'action':_0x816e('0x11'),'channel':_0x2fc0b5[_0x816e('0x12')],'Exten':_0x816e('0x13'),'Context':_0x816e('0x14'),'Priority':'1','callerid':util['format'](_0x816e('0x15'),_0x2fc0b5[_0x816e('0x16')]?_0x2fc0b5[_0x816e('0x16')]:'',_0x2fc0b5[_0x816e('0x17')]),'variable':_0x13db2a,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x2fc0b5[_0x816e('0x10')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 821393e..f272699 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 _0x60c9=['initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','initZendeskAccounts','initSalesforceAccounts','initSugarcrmAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','log','listen','sync','catch','util','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','getAgents','then','initAgents','getTelephones','getTrunks','initTrunks','getVoiceQueues'];(function(_0x4b2b03,_0x31f748){var _0x64651c=function(_0x2f9395){while(--_0x2f9395){_0x4b2b03['push'](_0x4b2b03['shift']());}};_0x64651c(++_0x31f748);}(_0x60c9,0x136));var _0x960c=function(_0x44fde7,_0x13bca8){_0x44fde7=_0x44fde7-0x0;var _0x729ad3=_0x60c9[_0x44fde7];return _0x729ad3;};'use strict';var BPromise=require('bluebird');var util=require(_0x960c('0x0'));var moment=require('moment');var server=require('./server');var Realtime=require(_0x960c('0x1'));var Report=require(_0x960c('0x2'));var Acw=require(_0x960c('0x3'));var Trigger=require(_0x960c('0x4'));var Dialer=require(_0x960c('0x5'));var Preview=require(_0x960c('0x6'));var Fax=require(_0x960c('0x7'));var user=require(_0x960c('0x8'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x960c('0x9'));var trunk=require(_0x960c('0xa'));var trigger=require('./rpc/trigger');var template=require(_0x960c('0xb'));var cmHopperHistory=require(_0x960c('0xc'));var campaign=require(_0x960c('0xd'));var voiceExtension=require(_0x960c('0xe'));var faxAccount=require(_0x960c('0xf'));var zendesk=require(_0x960c('0x10'));var salesforce=require(_0x960c('0x11'));var sugarcrm=require(_0x960c('0x12'));var freshdesk=require(_0x960c('0x13'));var desk=require('./rpc/integrations/desk');var zoho=require(_0x960c('0x14'));var vtiger=require(_0x960c('0x15'));var freshsales=require(_0x960c('0x16'));var servicenow=require(_0x960c('0x17'));var dynamics365=require(_0x960c('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 isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x960c('0x19')](_0x960c('0x1a'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x960c('0x19')](_0x960c('0x1a'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x960c('0x1b')]()['then'](user[_0x960c('0x1c')]())[_0x960c('0x1d')](realtime[_0x960c('0x1e')]())['then'](user[_0x960c('0x1f')]())[_0x960c('0x1d')](realtime['initTelephones']())[_0x960c('0x1d')](trunk[_0x960c('0x20')]())[_0x960c('0x1d')](realtime[_0x960c('0x21')]())['then'](voiceQueue[_0x960c('0x22')]())['then'](realtime[_0x960c('0x23')]())[_0x960c('0x1d')](trigger[_0x960c('0x24')]())[_0x960c('0x1d')](realtime[_0x960c('0x25')]())[_0x960c('0x1d')](template[_0x960c('0x26')]())[_0x960c('0x1d')](realtime[_0x960c('0x27')]())[_0x960c('0x1d')](zendesk['getZendeskAccounts']())[_0x960c('0x1d')](realtime[_0x960c('0x28')]())[_0x960c('0x1d')](salesforce['getSalesforceAccounts']())[_0x960c('0x1d')](realtime[_0x960c('0x29')]())[_0x960c('0x1d')](sugarcrm['getSugarcrmAccounts']())[_0x960c('0x1d')](realtime[_0x960c('0x2a')]())['then'](freshdesk['getFreshdeskAccounts']())['then'](realtime['initFreshdeskAccounts']())[_0x960c('0x1d')](desk['getDeskAccounts']())['then'](realtime[_0x960c('0x2b')]())[_0x960c('0x1d')](zoho[_0x960c('0x2c')]())[_0x960c('0x1d')](realtime[_0x960c('0x2d')]())[_0x960c('0x1d')](vtiger[_0x960c('0x2e')]())['then'](realtime[_0x960c('0x2f')]())[_0x960c('0x1d')](freshsales[_0x960c('0x30')]())[_0x960c('0x1d')](realtime[_0x960c('0x31')]())[_0x960c('0x1d')](servicenow['getServicenowAccounts']())[_0x960c('0x1d')](realtime['initServicenowAccounts']())['then'](dynamics365[_0x960c('0x32')]())[_0x960c('0x1d')](realtime[_0x960c('0x33')]())[_0x960c('0x1d')](campaign[_0x960c('0x34')]())['then'](realtime[_0x960c('0x35')]())[_0x960c('0x1d')](voiceExtension[_0x960c('0x36')]())[_0x960c('0x1d')](realtime[_0x960c('0x37')]())[_0x960c('0x1d')](faxAccount[_0x960c('0x38')]())[_0x960c('0x1d')](realtime[_0x960c('0x39')]())['then'](function(){return realtime;});}function initParams(){return BPromise[_0x960c('0x1b')]()[_0x960c('0x1d')](voiceQueueReport['getVoiceQueueReports']())[_0x960c('0x1d')](realtime[_0x960c('0x3a')]())[_0x960c('0x1d')](cmHopperHistory[_0x960c('0x3b')]())[_0x960c('0x1d')](realtime[_0x960c('0x3c')]())[_0x960c('0x1d')](cmHopperHistory[_0x960c('0x3d')]())['then'](realtime[_0x960c('0x3e')]())['then'](voiceCallReport[_0x960c('0x3f')]())[_0x960c('0x1d')](realtime[_0x960c('0x40')]())[_0x960c('0x1d')](function(_0x46a1db){})['catch'](function(_0x2ec4da){console[_0x960c('0x41')](_0x2ec4da);});}function main(){return server[_0x960c('0x42')](realtime,preview,fax)[_0x960c('0x1d')](function(_0x16b71a){return initRealtime();})[_0x960c('0x1d')](function(){return initParams();})['then'](function(){report[_0x960c('0x43')]();setInterval(initRealtime,0x1388);})[_0x960c('0x44')](function(_0x18eaec){console['log'](_0x18eaec);});}main(); \ No newline at end of file +var _0x39db=['resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getZendeskAccounts','initZendeskAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initCampaignHopperHistory','catch','log','listen','sync','bluebird','util','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./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/servicenow','./rpc/integrations/dynamics365','hour','get'];(function(_0x351b46,_0x26b265){var _0x1515df=function(_0x22896a){while(--_0x22896a){_0x351b46['push'](_0x351b46['shift']());}};_0x1515df(++_0x26b265);}(_0x39db,0x17a));var _0xb39d=function(_0x1c1da1,_0x4755d8){_0x1c1da1=_0x1c1da1-0x0;var _0x3c1816=_0x39db[_0x1c1da1];return _0x3c1816;};'use strict';var BPromise=require(_0xb39d('0x0'));var util=require(_0xb39d('0x1'));var moment=require(_0xb39d('0x2'));var server=require(_0xb39d('0x3'));var Realtime=require(_0xb39d('0x4'));var Report=require(_0xb39d('0x5'));var Acw=require(_0xb39d('0x6'));var Trigger=require(_0xb39d('0x7'));var Dialer=require(_0xb39d('0x8'));var Preview=require(_0xb39d('0x9'));var Fax=require(_0xb39d('0xa'));var user=require(_0xb39d('0xb'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0xb39d('0xc'));var voiceCallReport=require(_0xb39d('0xd'));var trunk=require(_0xb39d('0xe'));var trigger=require(_0xb39d('0xf'));var template=require(_0xb39d('0x10'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0xb39d('0x11'));var voiceExtension=require(_0xb39d('0x12'));var faxAccount=require(_0xb39d('0x13'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0xb39d('0x14'));var sugarcrm=require(_0xb39d('0x15'));var freshdesk=require(_0xb39d('0x16'));var desk=require(_0xb39d('0x17'));var zoho=require(_0xb39d('0x18'));var vtiger=require(_0xb39d('0x19'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0xb39d('0x1a'));var dynamics365=require(_0xb39d('0x1b'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0xb39d('0x1c'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xb39d('0x1d')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xb39d('0x1e')]()[_0xb39d('0x1f')](user[_0xb39d('0x20')]())['then'](realtime[_0xb39d('0x21')]())[_0xb39d('0x1f')](user[_0xb39d('0x22')]())[_0xb39d('0x1f')](realtime[_0xb39d('0x23')]())['then'](trunk[_0xb39d('0x24')]())[_0xb39d('0x1f')](realtime['initTrunks']())[_0xb39d('0x1f')](voiceQueue[_0xb39d('0x25')]())['then'](realtime[_0xb39d('0x26')]())[_0xb39d('0x1f')](trigger[_0xb39d('0x27')]())[_0xb39d('0x1f')](realtime[_0xb39d('0x28')]())[_0xb39d('0x1f')](template['getTemplates']())[_0xb39d('0x1f')](realtime['initTemplates']())[_0xb39d('0x1f')](zendesk[_0xb39d('0x29')]())[_0xb39d('0x1f')](realtime[_0xb39d('0x2a')]())['then'](salesforce['getSalesforceAccounts']())['then'](realtime['initSalesforceAccounts']())[_0xb39d('0x1f')](sugarcrm[_0xb39d('0x2b')]())[_0xb39d('0x1f')](realtime[_0xb39d('0x2c')]())[_0xb39d('0x1f')](freshdesk[_0xb39d('0x2d')]())[_0xb39d('0x1f')](realtime['initFreshdeskAccounts']())[_0xb39d('0x1f')](desk['getDeskAccounts']())[_0xb39d('0x1f')](realtime[_0xb39d('0x2e')]())['then'](zoho[_0xb39d('0x2f')]())[_0xb39d('0x1f')](realtime[_0xb39d('0x30')]())[_0xb39d('0x1f')](vtiger['getVtigerAccounts']())['then'](realtime[_0xb39d('0x31')]())[_0xb39d('0x1f')](freshsales['getFreshsalesAccounts']())[_0xb39d('0x1f')](realtime[_0xb39d('0x32')]())[_0xb39d('0x1f')](servicenow[_0xb39d('0x33')]())['then'](realtime[_0xb39d('0x34')]())[_0xb39d('0x1f')](dynamics365[_0xb39d('0x35')]())[_0xb39d('0x1f')](realtime[_0xb39d('0x36')]())[_0xb39d('0x1f')](campaign['getCampaigns']())[_0xb39d('0x1f')](realtime[_0xb39d('0x37')]())['then'](voiceExtension[_0xb39d('0x38')]())[_0xb39d('0x1f')](realtime[_0xb39d('0x39')]())[_0xb39d('0x1f')](faxAccount[_0xb39d('0x3a')]())[_0xb39d('0x1f')](realtime[_0xb39d('0x3b')]())[_0xb39d('0x1f')](function(){return realtime;});}function initParams(){return BPromise[_0xb39d('0x1e')]()[_0xb39d('0x1f')](voiceQueueReport[_0xb39d('0x3c')]())[_0xb39d('0x1f')](realtime[_0xb39d('0x3d')]())[_0xb39d('0x1f')](cmHopperHistory[_0xb39d('0x3e')]())[_0xb39d('0x1f')](realtime['initVoiceQueueHopperHistory']())[_0xb39d('0x1f')](cmHopperHistory['getCampaignHopperHistory']())[_0xb39d('0x1f')](realtime[_0xb39d('0x3f')]())[_0xb39d('0x1f')](voiceCallReport['getVoiceCallReports']())['then'](realtime['initVoiceCallReports']())[_0xb39d('0x1f')](function(_0x42ce34){})[_0xb39d('0x40')](function(_0x193f04){console[_0xb39d('0x41')](_0x193f04);});}function main(){return server[_0xb39d('0x42')](realtime,preview,fax)[_0xb39d('0x1f')](function(_0xfb4b0c){return initRealtime();})['then'](function(){return initParams();})[_0xb39d('0x1f')](function(){report[_0xb39d('0x43')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x22fec4){console[_0xb39d('0x41')](_0x22fec4);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index fd49d1d..11edf85 100644 --- a/server/services/ami/model/agent.js +++ b/server/services/ami/model/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['idle','inuse','talking','voiceStatusTime','toNumber','format','voiceStatusQueue','stringify','user:%s','emit','user:save','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusCallerIdNumber','onhold','local','prototype','state','toLowerCase','not_inuse'];(function(_0xa7fe35,_0x297e00){var _0x321bde=function(_0x437ab5){while(--_0x437ab5){_0xa7fe35['push'](_0xa7fe35['shift']());}};_0x321bde(++_0x297e00);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var md5=require(_0x3071('0x1'));var Redis=require(_0x3071('0x2'));var config=require(_0x3071('0x3'));config[_0x3071('0x4')]=_['defaults'](config[_0x3071('0x4')],{'host':_0x3071('0x5'),'port':0x18eb});var io=require(_0x3071('0x6'))(new Redis(config[_0x3071('0x4')]));function Agent(_0xabd7b6){this['id']=_0xabd7b6['id']||0x0;this[_0x3071('0x7')]=_0xabd7b6[_0x3071('0x7')]||'';this[_0x3071('0x8')]=_0xabd7b6[_0x3071('0x8')]||'';this[_0x3071('0x9')]=_0xabd7b6[_0x3071('0x9')]||'';this[_0x3071('0xa')]=_0xabd7b6[_0x3071('0xa')]||'';this['state']=_0x3071('0xb');this[_0x3071('0xc')]=0x0;this[_0x3071('0xd')]=_0x3071('0xb');this[_0x3071('0xe')]='';this['phone']='';this[_0x3071('0xf')]='';this[_0x3071('0x10')]='';this[_0x3071('0x11')]=_0xabd7b6[_0x3071('0x11')]||![];this[_0x3071('0x12')]='unknown';this['voiceStatusTime']=0x0;this[_0x3071('0x13')]='';this['voiceStatusQueue']='';this[_0x3071('0x14')]=![];this[_0x3071('0x15')]=![];this['md5']='';}Agent[_0x3071('0x16')]['updateStatusRealtime']=function(_0x2fc15d){var _0x45c93b;if(_0x2fc15d&&_0x2fc15d[_0x3071('0x17')]){_0x45c93b=_0x2fc15d[_0x3071('0x17')][_0x3071('0x18')]();switch(_0x45c93b){case _0x3071('0x19'):_0x45c93b=_0x3071('0x1a');break;case _0x3071('0x1b'):_0x45c93b=_0x3071('0x1c');break;}}if(_0x45c93b&&this[_0x3071('0x12')]!==_0x45c93b||_0x2fc15d['statePause']){this[_0x3071('0x1d')]=_[_0x3071('0x1e')](moment()[_0x3071('0x1f')]('x'));}if(_0x45c93b){this[_0x3071('0x12')]=_0x45c93b;}var _0x3acf0e={'id':this['id'],'name':this[_0x3071('0x7')],'email':this[_0x3071('0x8')],'accountcode':this[_0x3071('0x9')],'fullname':this['fullname'],'state':this[_0x3071('0x17')],'stateTime':this[_0x3071('0xc')],'status':this[_0x3071('0xd')],'address':this['address'],'online':this[_0x3071('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x3071('0x1d')],'voiceStatusCallerIdNumber':this[_0x3071('0x13')],'voiceStatusQueue':this[_0x3071('0x20')],'interface':this[_0x3071('0x10')],'onhold':this[_0x3071('0x14')]};var _0x34c50e=md5(JSON[_0x3071('0x21')](_0x3acf0e));if(this[_0x3071('0x1')]!==_0x34c50e){this['md5']=_0x34c50e;io['to'](util['format'](_0x3071('0x22'),_0x3acf0e[_0x3071('0x7')]))[_0x3071('0x23')](_0x3071('0x24'),_0x3acf0e);io[_0x3071('0x23')](_0x3071('0x25'),_0x3acf0e);}};module[_0x3071('0x26')]=Agent; \ No newline at end of file +var _0x9c44=['phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','statePause','stateTime','address','voiceStatusQueue','stringify','format','user:%s','emit','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','state','status','unknown'];(function(_0x4dbff0,_0xd80451){var _0xf762b6=function(_0x3b5c4f){while(--_0x3b5c4f){_0x4dbff0['push'](_0x4dbff0['shift']());}};_0xf762b6(++_0xd80451);}(_0x9c44,0x178));var _0x49c4=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x9c44[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var Redis=require(_0x49c4('0x2'));var config=require(_0x49c4('0x3'));config[_0x49c4('0x4')]=_[_0x49c4('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x49c4('0x6'))(new Redis(config['redis']));function Agent(_0xc1278f){this['id']=_0xc1278f['id']||0x0;this[_0x49c4('0x7')]=_0xc1278f[_0x49c4('0x7')]||'';this[_0x49c4('0x8')]=_0xc1278f[_0x49c4('0x8')]||'';this['accountcode']=_0xc1278f[_0x49c4('0x9')]||'';this[_0x49c4('0xa')]=_0xc1278f[_0x49c4('0xa')]||'';this[_0x49c4('0xb')]='unknown';this['stateTime']=0x0;this[_0x49c4('0xc')]=_0x49c4('0xd');this['address']='';this[_0x49c4('0xe')]='';this[_0x49c4('0xf')]='';this['interface']='';this['online']=_0xc1278f[_0x49c4('0x10')]||![];this[_0x49c4('0x11')]='unknown';this[_0x49c4('0x12')]=0x0;this[_0x49c4('0x13')]='';this['voiceStatusQueue']='';this[_0x49c4('0x14')]=![];this[_0x49c4('0x15')]=![];this[_0x49c4('0x1')]='';}Agent[_0x49c4('0x16')][_0x49c4('0x17')]=function(_0x18211c){var _0x75ea8;if(_0x18211c&&_0x18211c[_0x49c4('0xb')]){_0x75ea8=_0x18211c['state'][_0x49c4('0x18')]();switch(_0x75ea8){case _0x49c4('0x19'):_0x75ea8=_0x49c4('0x1a');break;case _0x49c4('0x1b'):_0x75ea8=_0x49c4('0x1c');break;}}if(_0x75ea8&&this['voiceStatus']!==_0x75ea8||_0x18211c[_0x49c4('0x1d')]){this[_0x49c4('0x12')]=_['toNumber'](moment()['format']('x'));}if(_0x75ea8){this[_0x49c4('0x11')]=_0x75ea8;}var _0x2f82d5={'id':this['id'],'name':this[_0x49c4('0x7')],'email':this['email'],'accountcode':this[_0x49c4('0x9')],'fullname':this['fullname'],'state':this[_0x49c4('0xb')],'stateTime':this[_0x49c4('0x1e')],'status':this[_0x49c4('0xc')],'address':this[_0x49c4('0x1f')],'online':this[_0x49c4('0x10')],'voiceStatus':this[_0x49c4('0x11')],'voiceStatusTime':this[_0x49c4('0x12')],'voiceStatusCallerIdNumber':this[_0x49c4('0x13')],'voiceStatusQueue':this[_0x49c4('0x20')],'interface':this['interface'],'onhold':this['onhold']};var _0x57f502=md5(JSON[_0x49c4('0x21')](_0x2f82d5));if(this['md5']!==_0x57f502){this['md5']=_0x57f502;io['to'](util[_0x49c4('0x22')](_0x49c4('0x23'),_0x2f82d5[_0x49c4('0x7')]))[_0x49c4('0x24')]('user:save',_0x2f82d5);io['emit'](_0x49c4('0x25'),_0x2f82d5);}};module[_0x49c4('0x26')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 6016e70..96abd0b 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 _0x4802=['dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency'];(function(_0x8ba19a,_0x1d2b2b){var _0x2bd8b4=function(_0xee823f){while(--_0xee823f){_0x8ba19a['push'](_0x8ba19a['shift']());}};_0x2bd8b4(++_0x1d2b2b);}(_0x4802,0x152));var _0x2480=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x4802[_0x23e7c1];return _0x1add43;};'use strict';function Campaign(_0x1c91ac){this['id']=_0x1c91ac['id']||0x0;this[_0x2480('0x0')]=_0x1c91ac[_0x2480('0x0')]||'';this[_0x2480('0x1')]=_0x1c91ac['type']||_0x2480('0x2');this[_0x2480('0x3')]=0x0;this[_0x2480('0x4')]=0x0;this[_0x2480('0x5')]=0x0;this[_0x2480('0x6')]=0x0;this[_0x2480('0x7')]='';this[_0x2480('0x8')]=!![];this['active']=_0x1c91ac['active'];this['limitCalls']=_0x1c91ac[_0x2480('0x9')];this[_0x2480('0xa')]=_0x1c91ac['dialTimezone']||null;this[_0x2480('0xb')]=_0x1c91ac[_0x2480('0xb')]?_0x1c91ac[_0x2480('0xb')]:null;this[_0x2480('0xc')]=_0x1c91ac[_0x2480('0xc')];this[_0x2480('0xd')]=_0x1c91ac['dialOriginateCallerIdNumber'];this[_0x2480('0xe')]=_0x1c91ac[_0x2480('0xe')]||0x1e;this[_0x2480('0xf')]=_0x1c91ac['dialCongestionMaxRetry'];this[_0x2480('0x10')]=_0x1c91ac[_0x2480('0x10')];this[_0x2480('0x11')]=_0x1c91ac[_0x2480('0x11')];this[_0x2480('0x12')]=_0x1c91ac[_0x2480('0x12')];this[_0x2480('0x13')]=_0x1c91ac[_0x2480('0x13')];this[_0x2480('0x14')]=_0x1c91ac[_0x2480('0x14')];this['dialGlobalMaxRetry']=_0x1c91ac[_0x2480('0x15')];this[_0x2480('0x16')]=_0x1c91ac['dialNoSuchNumberMaxRetry']||0x3;this[_0x2480('0x17')]=_0x1c91ac[_0x2480('0x17')]||0x96;this['dialDropMaxRetry']=_0x1c91ac[_0x2480('0x18')]||0x3;this['dialDropRetryFrequency']=_0x1c91ac[_0x2480('0x19')]||0x96;this['dialAbandonedMaxRetry']=_0x1c91ac[_0x2480('0x1a')]||0x3;this[_0x2480('0x1b')]=_0x1c91ac[_0x2480('0x1b')]||0x96;this[_0x2480('0x1c')]=_0x1c91ac[_0x2480('0x1c')]||0x3;this[_0x2480('0x1d')]=_0x1c91ac[_0x2480('0x1d')]||0x96;this[_0x2480('0x1e')]=_0x1c91ac['dialAgentRejectMaxRetry']||0x3;this[_0x2480('0x1f')]=_0x1c91ac[_0x2480('0x1f')]||0x96;this[_0x2480('0x20')]=_0x1c91ac[_0x2480('0x20')]||'DESC';this[_0x2480('0x21')]=_0x1c91ac[_0x2480('0x21')]||undefined;this[_0x2480('0x22')]=_0x1c91ac['dialRandomLastDigitCallerIdNumber']||undefined;this['dialCutDigit']=_0x1c91ac[_0x2480('0x23')]||undefined;this[_0x2480('0x24')]=_0x1c91ac['TrunkBackup']?_0x1c91ac[_0x2480('0x24')]:undefined;this[_0x2480('0x25')]=_0x1c91ac[_0x2480('0x25')]?_0x1c91ac[_0x2480('0x25')]:undefined;this[_0x2480('0x26')]=_0x1c91ac['Interval']?_0x1c91ac[_0x2480('0x26')]:undefined;this[_0x2480('0x27')]=_0x1c91ac[_0x2480('0x27')]?_0x1c91ac[_0x2480('0x27')]:undefined;this[_0x2480('0x28')]=_0x1c91ac['SquareProject']?_0x1c91ac['SquareProject'][_0x2480('0x0')]:undefined;this[_0x2480('0x29')]=_0x1c91ac['dialAMDActive']||![];this[_0x2480('0x2a')]=_0x1c91ac[_0x2480('0x2a')];this[_0x2480('0x2b')]=_0x1c91ac[_0x2480('0x2b')];this[_0x2480('0x2c')]=_0x1c91ac[_0x2480('0x2c')];this['dialAMDTotalAnalysisTime']=_0x1c91ac[_0x2480('0x2d')];this[_0x2480('0x2e')]=_0x1c91ac[_0x2480('0x2e')];this[_0x2480('0x2f')]=_0x1c91ac[_0x2480('0x2f')];this[_0x2480('0x30')]=_0x1c91ac['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x1c91ac[_0x2480('0x31')];this[_0x2480('0x32')]=_0x1c91ac[_0x2480('0x32')];}module['exports']=Campaign; \ No newline at end of file +var _0x9bf2=['dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','exports','name','type','campaign','temp','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry'];(function(_0x14363e,_0x4f0e0d){var _0x17c56d=function(_0x1c7bac){while(--_0x1c7bac){_0x14363e['push'](_0x14363e['shift']());}};_0x17c56d(++_0x4f0e0d);}(_0x9bf2,0xbb));var _0x29bf=function(_0x18ae07,_0x2bbab9){_0x18ae07=_0x18ae07-0x0;var _0x2152c1=_0x9bf2[_0x18ae07];return _0x2152c1;};'use strict';function Campaign(_0x551b77){this['id']=_0x551b77['id']||0x0;this[_0x29bf('0x0')]=_0x551b77[_0x29bf('0x0')]||'';this[_0x29bf('0x1')]=_0x551b77[_0x29bf('0x1')]||_0x29bf('0x2');this['originated']=0x0;this[_0x29bf('0x3')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x29bf('0x4')]=0x0;this[_0x29bf('0x5')]='';this[_0x29bf('0x6')]=!![];this[_0x29bf('0x7')]=_0x551b77[_0x29bf('0x7')];this[_0x29bf('0x8')]=_0x551b77[_0x29bf('0x8')];this[_0x29bf('0x9')]=_0x551b77['dialTimezone']||null;this[_0x29bf('0xa')]=_0x551b77[_0x29bf('0xa')]?_0x551b77[_0x29bf('0xa')]:null;this[_0x29bf('0xb')]=_0x551b77[_0x29bf('0xb')];this[_0x29bf('0xc')]=_0x551b77[_0x29bf('0xc')];this[_0x29bf('0xd')]=_0x551b77['dialOriginateTimeout']||0x1e;this[_0x29bf('0xe')]=_0x551b77[_0x29bf('0xe')];this['dialCongestionRetryFrequency']=_0x551b77[_0x29bf('0xf')];this[_0x29bf('0x10')]=_0x551b77[_0x29bf('0x10')];this[_0x29bf('0x11')]=_0x551b77[_0x29bf('0x11')];this['dialNoAnswerMaxRetry']=_0x551b77[_0x29bf('0x12')];this['dialNoAnswerRetryFrequency']=_0x551b77[_0x29bf('0x13')];this[_0x29bf('0x14')]=_0x551b77[_0x29bf('0x14')];this[_0x29bf('0x15')]=_0x551b77[_0x29bf('0x15')]||0x3;this[_0x29bf('0x16')]=_0x551b77[_0x29bf('0x16')]||0x96;this['dialDropMaxRetry']=_0x551b77[_0x29bf('0x17')]||0x3;this[_0x29bf('0x18')]=_0x551b77['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x551b77[_0x29bf('0x19')]||0x3;this[_0x29bf('0x1a')]=_0x551b77[_0x29bf('0x1a')]||0x96;this[_0x29bf('0x1b')]=_0x551b77[_0x29bf('0x1b')]||0x3;this['dialMachineRetryFrequency']=_0x551b77[_0x29bf('0x1c')]||0x96;this['dialAgentRejectMaxRetry']=_0x551b77[_0x29bf('0x1d')]||0x3;this['dialAgentRejectRetryFrequency']=_0x551b77[_0x29bf('0x1e')]||0x96;this['dialOrderByScheduledAt']=_0x551b77[_0x29bf('0x1f')]||_0x29bf('0x20');this[_0x29bf('0x21')]=_0x551b77[_0x29bf('0x21')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x551b77[_0x29bf('0x22')]||undefined;this[_0x29bf('0x23')]=_0x551b77[_0x29bf('0x23')]||undefined;this[_0x29bf('0x24')]=_0x551b77['TrunkBackup']?_0x551b77['TrunkBackup']:undefined;this[_0x29bf('0x25')]=_0x551b77[_0x29bf('0x25')]?_0x551b77[_0x29bf('0x25')]:undefined;this[_0x29bf('0x26')]=_0x551b77[_0x29bf('0x26')]?_0x551b77[_0x29bf('0x26')]:undefined;this[_0x29bf('0x27')]=_0x551b77[_0x29bf('0x27')]?_0x551b77[_0x29bf('0x27')]:undefined;this[_0x29bf('0x28')]=_0x551b77[_0x29bf('0x27')]?_0x551b77['SquareProject'][_0x29bf('0x0')]:undefined;this[_0x29bf('0x29')]=_0x551b77[_0x29bf('0x29')]||![];this['dialAMDInitialSilence']=_0x551b77[_0x29bf('0x2a')];this[_0x29bf('0x2b')]=_0x551b77['dialAMDGreeting'];this[_0x29bf('0x2c')]=_0x551b77[_0x29bf('0x2c')];this[_0x29bf('0x2d')]=_0x551b77['dialAMDTotalAnalysisTime'];this[_0x29bf('0x2e')]=_0x551b77[_0x29bf('0x2e')];this['dialAMDBetweenWordsSilence']=_0x551b77[_0x29bf('0x2f')];this[_0x29bf('0x30')]=_0x551b77['dialAMDMaximumNumberOfWords'];this[_0x29bf('0x31')]=_0x551b77[_0x29bf('0x31')];this['dialAMDMaximumWordLength']=_0x551b77['dialAMDMaximumWordLength'];}module[_0x29bf('0x32')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 6f1ac9b..03b64be 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 _0x7334=['accountcode','context','uniqueid','linkedid','exten','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','monitor','monitorFilename','monitors','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','connectedlinenum'];(function(_0x927ad8,_0x3da4aa){var _0x47b234=function(_0x241785){while(--_0x241785){_0x927ad8['push'](_0x927ad8['shift']());}};_0x47b234(++_0x3da4aa);}(_0x7334,0x184));var _0x4733=function(_0x5077c5,_0xa29350){_0x5077c5=_0x5077c5-0x0;var _0x359a7f=_0x7334[_0x5077c5];return _0x359a7f;};'use strict';function Channel(){this[_0x4733('0x0')]=null;this[_0x4733('0x1')]='';this[_0x4733('0x2')]='';this['calleridnum']=0x0;this['calleridname']='';this[_0x4733('0x3')]=undefined;this['connectedlinename']=undefined;this[_0x4733('0x4')]=0x0;this[_0x4733('0x5')]='';this[_0x4733('0x6')]=0x0;this[_0x4733('0x7')]=0x0;this[_0x4733('0x8')]=0x0;this[_0x4733('0x9')]=![];this[_0x4733('0xa')]=null;this[_0x4733('0xb')]=null;this[_0x4733('0xc')]=![];this[_0x4733('0xd')]=![];this[_0x4733('0xe')]='';this[_0x4733('0xf')]='';this[_0x4733('0x10')]=0x0;this[_0x4733('0x11')]=0x0;this[_0x4733('0x12')]=0x0;this[_0x4733('0x13')]=null;this[_0x4733('0x14')]=null;this['disposition']=null;this[_0x4733('0x15')]=![];this[_0x4733('0x16')]=null;this['queue']=null;this[_0x4733('0x17')]=[];this['transfercalleridnum']=undefined;this[_0x4733('0x18')]=undefined;this[_0x4733('0x19')]=undefined;this[_0x4733('0x1a')]=0x0;}module[_0x4733('0x1b')]=Channel; \ No newline at end of file +var _0x2432=['transferType','mohtime','starttime','channel','destinationchannel','calleridnum','connectedlinenum','accountcode','context','uniqueid','linkedid','exten','answered','answertime','endtime','unmanaged','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum'];(function(_0xed83db,_0x1b1aa8){var _0x3ff37e=function(_0xf7f40d){while(--_0xf7f40d){_0xed83db['push'](_0xed83db['shift']());}};_0x3ff37e(++_0x1b1aa8);}(_0x2432,0x7a));var _0x2243=function(_0x204031,_0x27abe2){_0x204031=_0x204031-0x0;var _0x40a84b=_0x2432[_0x204031];return _0x40a84b;};'use strict';function Channel(){this[_0x2243('0x0')]=null;this[_0x2243('0x1')]='';this[_0x2243('0x2')]='';this[_0x2243('0x3')]=0x0;this['calleridname']='';this[_0x2243('0x4')]=undefined;this['connectedlinename']=undefined;this[_0x2243('0x5')]=0x0;this[_0x2243('0x6')]='';this[_0x2243('0x7')]=0x0;this[_0x2243('0x8')]=0x0;this[_0x2243('0x9')]=0x0;this[_0x2243('0xa')]=![];this[_0x2243('0xb')]=null;this[_0x2243('0xc')]=null;this[_0x2243('0xd')]=![];this['abandoned']=![];this[_0x2243('0xe')]='';this[_0x2243('0xf')]='';this[_0x2243('0x10')]=0x0;this[_0x2243('0x11')]=0x0;this[_0x2243('0x12')]=0x0;this[_0x2243('0x13')]=null;this[_0x2243('0x14')]=null;this[_0x2243('0x15')]=null;this[_0x2243('0x16')]=![];this[_0x2243('0x17')]=null;this[_0x2243('0x18')]=null;this[_0x2243('0x19')]=[];this[_0x2243('0x1a')]=undefined;this[_0x2243('0x1b')]=undefined;this[_0x2243('0x1c')]=undefined;this[_0x2243('0x1d')]=0x0;}module['exports']=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 95900c6..e20b630 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 _0x09c7=['remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username'];(function(_0x32a6d8,_0x15a10c){var _0x42e00c=function(_0x3f6c43){while(--_0x3f6c43){_0x32a6d8['push'](_0x32a6d8['shift']());}};_0x42e00c(++_0x15a10c);}(_0x09c7,0x15d));var _0x709c=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x09c7[_0x110c3d];return _0x226d67;};'use strict';function DeskAccount(_0x391eca){this['id']=_0x391eca['id']||0x0;this[_0x709c('0x0')]=_0x391eca[_0x709c('0x0')]||'';this['username']=_0x391eca[_0x709c('0x1')]||'';this[_0x709c('0x2')]=_0x391eca[_0x709c('0x2')]||'';this[_0x709c('0x3')]=_0x391eca[_0x709c('0x3')]||'';this[_0x709c('0x4')]=_0x391eca[_0x709c('0x4')]||'';this[_0x709c('0x5')]=_0x391eca[_0x709c('0x5')]||'';this['consumerSecret']=_0x391eca[_0x709c('0x6')]||'';this[_0x709c('0x7')]=_0x391eca[_0x709c('0x7')]||'';this[_0x709c('0x8')]=_0x391eca[_0x709c('0x8')]||'';this['type']=_0x391eca[_0x709c('0x9')]||'';this[_0x709c('0xa')]=_0x391eca[_0x709c('0xa')]||'';this[_0x709c('0xb')]=_0x391eca[_0x709c('0xb')]||{};}module[_0x709c('0xc')]=DeskAccount; \ No newline at end of file +var _0x5157=['token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret'];(function(_0x22c0b9,_0x34d306){var _0x3e7ef8=function(_0x162e4b){while(--_0x162e4b){_0x22c0b9['push'](_0x22c0b9['shift']());}};_0x3e7ef8(++_0x34d306);}(_0x5157,0x1da));var _0x7515=function(_0x320ae7,_0x3d283a){_0x320ae7=_0x320ae7-0x0;var _0x3f2482=_0x5157[_0x320ae7];return _0x3f2482;};'use strict';function DeskAccount(_0x34df92){this['id']=_0x34df92['id']||0x0;this[_0x7515('0x0')]=_0x34df92[_0x7515('0x0')]||'';this[_0x7515('0x1')]=_0x34df92[_0x7515('0x1')]||'';this[_0x7515('0x2')]=_0x34df92[_0x7515('0x2')]||'';this[_0x7515('0x3')]=_0x34df92['authType']||'';this[_0x7515('0x4')]=_0x34df92['password']||'';this[_0x7515('0x5')]=_0x34df92[_0x7515('0x5')]||'';this[_0x7515('0x6')]=_0x34df92[_0x7515('0x6')]||'';this[_0x7515('0x7')]=_0x34df92[_0x7515('0x7')]||'';this[_0x7515('0x8')]=_0x34df92[_0x7515('0x8')]||'';this[_0x7515('0x9')]=_0x34df92['type']||'';this[_0x7515('0xa')]=_0x34df92[_0x7515('0xa')]||'';this[_0x7515('0xb')]=_0x34df92[_0x7515('0xb')]||{};}module[_0x7515('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index f4c6235..a6c57de 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 _0xb688=['remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations','exports','name','username','password'];(function(_0x2b0ff0,_0x559448){var _0x2c2c72=function(_0x23d7c6){while(--_0x23d7c6){_0x2b0ff0['push'](_0x2b0ff0['shift']());}};_0x2c2c72(++_0x559448);}(_0xb688,0xcf));var _0x8b68=function(_0x4496c1,_0x103294){_0x4496c1=_0x4496c1-0x0;var _0xa2da11=_0xb688[_0x4496c1];return _0xa2da11;};'use strict';function Dynamics365Account(_0x185590){this['id']=_0x185590['id']||0x0;this[_0x8b68('0x0')]=_0x185590[_0x8b68('0x0')]||'';this[_0x8b68('0x1')]=_0x185590[_0x8b68('0x1')]||'';this[_0x8b68('0x2')]=_0x185590[_0x8b68('0x2')]||'';this['remoteUri']=_0x185590[_0x8b68('0x3')]||'';this[_0x8b68('0x4')]=_0x185590[_0x8b68('0x4')]||'';this[_0x8b68('0x5')]=_0x185590['clientId']||'';this[_0x8b68('0x6')]=_0x185590['clientSecret']||{};this[_0x8b68('0x7')]=_0x185590[_0x8b68('0x7')]||'';this[_0x8b68('0x8')]=_0x185590[_0x8b68('0x8')]||{};}module[_0x8b68('0x9')]=Dynamics365Account; \ No newline at end of file +var _0xd64b=['exports','name','username','password','remoteUri','clientSecret','serverUrl','Configurations'];(function(_0x171d22,_0x26a803){var _0x4b43d0=function(_0x1c364c){while(--_0x1c364c){_0x171d22['push'](_0x171d22['shift']());}};_0x4b43d0(++_0x26a803);}(_0xd64b,0xc1));var _0xbd64=function(_0x47195e,_0x347734){_0x47195e=_0x47195e-0x0;var _0x571abb=_0xd64b[_0x47195e];return _0x571abb;};'use strict';function Dynamics365Account(_0x272488){this['id']=_0x272488['id']||0x0;this['name']=_0x272488[_0xbd64('0x0')]||'';this['username']=_0x272488[_0xbd64('0x1')]||'';this[_0xbd64('0x2')]=_0x272488[_0xbd64('0x2')]||'';this[_0xbd64('0x3')]=_0x272488[_0xbd64('0x3')]||'';this['tenantId']=_0x272488['tenantId']||'';this['clientId']=_0x272488['clientId']||'';this[_0xbd64('0x4')]=_0x272488[_0xbd64('0x4')]||{};this[_0xbd64('0x5')]=_0x272488[_0xbd64('0x5')]||'';this[_0xbd64('0x6')]=_0x272488[_0xbd64('0x6')]||{};}module[_0xbd64('0x7')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 0221316..cd3592c 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 _0xf7eb=['Trunk','ListId','name','description','headerinfo','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xf7eb,0x9e));var _0xbf7e=function(_0x93cc2,_0x4abacc){_0x93cc2=_0x93cc2-0x0;var _0x1d3a3e=_0xf7eb[_0x93cc2];return _0x1d3a3e;};'use strict';function FaxAccount(_0x1f2b44){this['id']=_0x1f2b44['id']||0x0;this[_0xbf7e('0x0')]=_0x1f2b44[_0xbf7e('0x0')]||'';this[_0xbf7e('0x1')]=_0x1f2b44[_0xbf7e('0x1')];this['ecm']=_0x1f2b44['ecm'];this[_0xbf7e('0x2')]=_0x1f2b44['headerinfo'];this['localstationid']=_0x1f2b44['localstationid'];this[_0xbf7e('0x3')]=_0x1f2b44[_0xbf7e('0x3')]||0x960;this['maxrate']=_0x1f2b44[_0xbf7e('0x4')]||0x3840;this[_0xbf7e('0x5')]=_0x1f2b44[_0xbf7e('0x5')]||'v17,v27,v29';this[_0xbf7e('0x6')]=_0x1f2b44[_0xbf7e('0x6')]||'no';this['faxdetect']=_0x1f2b44[_0xbf7e('0x7')]||'no';this['t38timeout']=_0x1f2b44[_0xbf7e('0x8')]||0x1388;this[_0xbf7e('0x9')]=_0x1f2b44[_0xbf7e('0x9')]||'SIP';this[_0xbf7e('0xa')]=_0x1f2b44[_0xbf7e('0xa')]?_0x1f2b44[_0xbf7e('0xa')]:undefined;this[_0xbf7e('0xb')]=_0x1f2b44[_0xbf7e('0xb')];this['key']=_0x1f2b44['key'];}module['exports']=FaxAccount; \ No newline at end of file +var _0x76ea=['Trunk','ListId','key','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP'];(function(_0x13c174,_0xda25fe){var _0x160654=function(_0x1b6ac2){while(--_0x1b6ac2){_0x13c174['push'](_0x13c174['shift']());}};_0x160654(++_0xda25fe);}(_0x76ea,0xf1));var _0xa76e=function(_0x10a6bb,_0x460616){_0x10a6bb=_0x10a6bb-0x0;var _0x561131=_0x76ea[_0x10a6bb];return _0x561131;};'use strict';function FaxAccount(_0x340324){this['id']=_0x340324['id']||0x0;this['name']=_0x340324[_0xa76e('0x0')]||'';this['description']=_0x340324[_0xa76e('0x1')];this[_0xa76e('0x2')]=_0x340324[_0xa76e('0x2')];this[_0xa76e('0x3')]=_0x340324[_0xa76e('0x3')];this[_0xa76e('0x4')]=_0x340324['localstationid'];this[_0xa76e('0x5')]=_0x340324[_0xa76e('0x5')]||0x960;this[_0xa76e('0x6')]=_0x340324[_0xa76e('0x6')]||0x3840;this[_0xa76e('0x7')]=_0x340324[_0xa76e('0x7')]||_0xa76e('0x8');this[_0xa76e('0x9')]=_0x340324[_0xa76e('0x9')]||'no';this[_0xa76e('0xa')]=_0x340324[_0xa76e('0xa')]||'no';this['t38timeout']=_0x340324[_0xa76e('0xb')]||0x1388;this['tech']=_0x340324[_0xa76e('0xc')]||_0xa76e('0xd');this[_0xa76e('0xe')]=_0x340324[_0xa76e('0xe')]?_0x340324['Trunk']:undefined;this[_0xa76e('0xf')]=_0x340324[_0xa76e('0xf')];this[_0xa76e('0x10')]=_0x340324[_0xa76e('0x10')];}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 655fda5..4f12179 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 _0x7ab5=['username','apiKey','remoteUri','serverUrl','Configurations','name'];(function(_0x18f4a0,_0x3c3735){var _0x179e96=function(_0x3c068e){while(--_0x3c068e){_0x18f4a0['push'](_0x18f4a0['shift']());}};_0x179e96(++_0x3c3735);}(_0x7ab5,0x149));var _0x57ab=function(_0x35ea83,_0x5526dd){_0x35ea83=_0x35ea83-0x0;var _0x4c24e3=_0x7ab5[_0x35ea83];return _0x4c24e3;};'use strict';function FreshdeskAccount(_0x1c03e8){this['id']=_0x1c03e8['id']||0x0;this[_0x57ab('0x0')]=_0x1c03e8[_0x57ab('0x0')]||'';this['username']=_0x1c03e8[_0x57ab('0x1')]||'';this[_0x57ab('0x2')]=_0x1c03e8['token']||'';this['remoteUri']=_0x1c03e8[_0x57ab('0x3')]||'';this[_0x57ab('0x4')]=_0x1c03e8['serverUrl']||'';this[_0x57ab('0x5')]=_0x1c03e8[_0x57ab('0x5')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0x0359=['serverUrl','Configurations','exports','name','username','token','remoteUri'];(function(_0x4b9a92,_0x522f7b){var _0x3565b1=function(_0x5c1aa1){while(--_0x5c1aa1){_0x4b9a92['push'](_0x4b9a92['shift']());}};_0x3565b1(++_0x522f7b);}(_0x0359,0x13e));var _0x9035=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x0359[_0x5f309e];return _0x487b5e;};'use strict';function FreshdeskAccount(_0xb66c1e){this['id']=_0xb66c1e['id']||0x0;this['name']=_0xb66c1e[_0x9035('0x0')]||'';this[_0x9035('0x1')]=_0xb66c1e[_0x9035('0x1')]||'';this['apiKey']=_0xb66c1e[_0x9035('0x2')]||'';this[_0x9035('0x3')]=_0xb66c1e[_0x9035('0x3')]||'';this[_0x9035('0x4')]=_0xb66c1e[_0x9035('0x4')]||'';this[_0x9035('0x5')]=_0xb66c1e[_0x9035('0x5')]||{};}module[_0x9035('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 8a2aa63..a1afd4f 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 _0x4453=['Configurations','exports','name','username','token','remoteUri','serverUrl'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4453,0x9c));var _0x3445=function(_0x367c8e,_0x3a6502){_0x367c8e=_0x367c8e-0x0;var _0x1c2789=_0x4453[_0x367c8e];return _0x1c2789;};'use strict';function FreshsalesAccount(_0x813dea){this['id']=_0x813dea['id']||0x0;this[_0x3445('0x0')]=_0x813dea['name']||'';this[_0x3445('0x1')]=_0x813dea[_0x3445('0x1')]||'';this['apiKey']=_0x813dea[_0x3445('0x2')]||'';this[_0x3445('0x3')]=_0x813dea[_0x3445('0x3')]||'';this[_0x3445('0x4')]=_0x813dea[_0x3445('0x4')]||'';this[_0x3445('0x5')]=_0x813dea[_0x3445('0x5')]||{};}module[_0x3445('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0xa423=['name','username','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x28d151,_0x446e87){var _0x4340a8=function(_0x499a73){while(--_0x499a73){_0x28d151['push'](_0x28d151['shift']());}};_0x4340a8(++_0x446e87);}(_0xa423,0x16c));var _0x3a42=function(_0x5ea3b1,_0x16189f){_0x5ea3b1=_0x5ea3b1-0x0;var _0x35d4b7=_0xa423[_0x5ea3b1];return _0x35d4b7;};'use strict';function FreshsalesAccount(_0xdee23a){this['id']=_0xdee23a['id']||0x0;this[_0x3a42('0x0')]=_0xdee23a[_0x3a42('0x0')]||'';this[_0x3a42('0x1')]=_0xdee23a[_0x3a42('0x1')]||'';this['apiKey']=_0xdee23a[_0x3a42('0x2')]||'';this[_0x3a42('0x3')]=_0xdee23a['remoteUri']||'';this[_0x3a42('0x4')]=_0xdee23a[_0x3a42('0x4')]||'';this[_0x3a42('0x5')]=_0xdee23a[_0x3a42('0x5')]||{};}module[_0x3a42('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 aa00075..fa11ee5 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 _0x249b=['lastAssignedTo','mohtime','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinename','accountcode','context','exten','priority','assigned'];(function(_0x2ef251,_0x3687e5){var _0x5c931b=function(_0x3e1e36){while(--_0x3e1e36){_0x2ef251['push'](_0x2ef251['shift']());}};_0x5c931b(++_0x3687e5);}(_0x249b,0x16a));var _0xb249=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x249b[_0x46aff0];return _0x9d78cf;};'use strict';function QueueReport(){this[_0xb249('0x0')]=_0xb249('0x1');this[_0xb249('0x2')]='';this[_0xb249('0x3')]='';this[_0xb249('0x4')]='';this[_0xb249('0x5')]='';this[_0xb249('0x6')]=null;this[_0xb249('0x7')]=null;this[_0xb249('0x8')]=0x1;this['count']=0x1;this[_0xb249('0x9')]=![];this[_0xb249('0xa')]=null;this[_0xb249('0xb')]=![];this['queuecallercompleteAt']=null;this[_0xb249('0xc')]=![];this[_0xb249('0xd')]=null;this[_0xb249('0xe')]=0x1;this[_0xb249('0xf')]='';this['connectedlinenum']='';this[_0xb249('0x10')]='';this[_0xb249('0x11')]='';this[_0xb249('0x12')]='';this[_0xb249('0x13')]='';this[_0xb249('0x14')]='';this['holdtime']=0x0;this[_0xb249('0x15')]=![];this[_0xb249('0x16')]='';this[_0xb249('0x17')]=0x0;this['variables']={};}module['exports']=QueueReport; \ No newline at end of file +var _0x7120=['connectedlinename','accountcode','exten','priority','holdtime','mohtime','variables','type','inbound','uniqueid','calleridnum','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','connectedlinenum'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x7120,0x1cf));var _0x0712=function(_0x3106e2,_0x2b5c47){_0x3106e2=_0x3106e2-0x0;var _0x2f2a55=_0x7120[_0x3106e2];return _0x2f2a55;};'use strict';function QueueReport(){this[_0x0712('0x0')]=_0x0712('0x1');this[_0x0712('0x2')]='';this[_0x0712('0x3')]='';this['calleridname']='';this[_0x0712('0x4')]='';this[_0x0712('0x5')]=null;this[_0x0712('0x6')]=null;this[_0x0712('0x7')]=0x1;this[_0x0712('0x8')]=0x1;this[_0x0712('0x9')]=![];this[_0x0712('0xa')]=null;this[_0x0712('0xb')]=![];this[_0x0712('0xc')]=null;this[_0x0712('0xd')]=![];this[_0x0712('0xe')]=null;this[_0x0712('0xf')]=0x1;this['channel']='';this[_0x0712('0x10')]='';this[_0x0712('0x11')]='';this[_0x0712('0x12')]='';this['context']='';this[_0x0712('0x13')]='';this[_0x0712('0x14')]='';this[_0x0712('0x15')]=0x0;this['assigned']=![];this['lastAssignedTo']='';this[_0x0712('0x16')]=0x0;this[_0x0712('0x17')]={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index a14754a..303b6fc 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 _0x11b7=['name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports'];(function(_0xd635bb,_0x4ae093){var _0x6ca6d0=function(_0x50f81d){while(--_0x50f81d){_0xd635bb['push'](_0xd635bb['shift']());}};_0x6ca6d0(++_0x4ae093);}(_0x11b7,0x180));var _0x711b=function(_0x4749bc,_0xd777b9){_0x4749bc=_0x4749bc-0x0;var _0x4b5918=_0x11b7[_0x4749bc];return _0x4b5918;};'use strict';function SalesforceAccount(_0xd847e6){this['id']=_0xd847e6['id']||0x0;this[_0x711b('0x0')]=_0xd847e6['name']||'';this[_0x711b('0x1')]=_0xd847e6[_0x711b('0x1')]||'';this[_0x711b('0x2')]=_0xd847e6['remoteUri']||'';this[_0x711b('0x3')]=_0xd847e6[_0x711b('0x3')]||'';this[_0x711b('0x4')]=_0xd847e6[_0x711b('0x4')]||'';this[_0x711b('0x5')]=_0xd847e6['clientSecret']||'';this[_0x711b('0x6')]=_0xd847e6[_0x711b('0x6')]||'';this[_0x711b('0x7')]=_0xd847e6[_0x711b('0x7')]||_0x711b('0x8');this[_0x711b('0x9')]=_0xd847e6[_0x711b('0x9')]||'';this['Configurations']=_0xd847e6[_0x711b('0xa')]||{};}module[_0x711b('0xb')]=SalesforceAccount; \ No newline at end of file +var _0xc4f6=['name','username','remoteUri','password','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xc4f6,0x64));var _0x6c4f=function(_0x4bae11,_0x50bf58){_0x4bae11=_0x4bae11-0x0;var _0xbe7bd7=_0xc4f6[_0x4bae11];return _0xbe7bd7;};'use strict';function SalesforceAccount(_0x45c282){this['id']=_0x45c282['id']||0x0;this[_0x6c4f('0x0')]=_0x45c282['name']||'';this[_0x6c4f('0x1')]=_0x45c282[_0x6c4f('0x1')]||'';this[_0x6c4f('0x2')]=_0x45c282[_0x6c4f('0x2')]||'';this[_0x6c4f('0x3')]=_0x45c282[_0x6c4f('0x3')]||'';this['clientId']=_0x45c282['clientId']||'';this[_0x6c4f('0x4')]=_0x45c282[_0x6c4f('0x4')]||'';this[_0x6c4f('0x5')]=_0x45c282[_0x6c4f('0x5')]||'';this[_0x6c4f('0x6')]=_0x45c282[_0x6c4f('0x6')]||_0x6c4f('0x7');this[_0x6c4f('0x8')]=_0x45c282['serverUrl']||'';this[_0x6c4f('0x9')]=_0x45c282[_0x6c4f('0x9')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index fa951a1..e168f57 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 _0xcf34=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0xa65f76,_0x3d8b0c){var _0x527146=function(_0x44a7aa){while(--_0x44a7aa){_0xa65f76['push'](_0xa65f76['shift']());}};_0x527146(++_0x3d8b0c);}(_0xcf34,0x1f2));var _0x4cf3=function(_0x596284,_0x1cd02b){_0x596284=_0x596284-0x0;var _0x5313c6=_0xcf34[_0x596284];return _0x5313c6;};'use strict';function ServicenowAccount(_0x340f88){this['id']=_0x340f88['id']||0x0;this[_0x4cf3('0x0')]=_0x340f88['name']||'';this[_0x4cf3('0x1')]=_0x340f88[_0x4cf3('0x1')]||'';this[_0x4cf3('0x2')]=_0x340f88[_0x4cf3('0x2')]||'';this[_0x4cf3('0x3')]=_0x340f88[_0x4cf3('0x3')]||'';this[_0x4cf3('0x4')]=_0x340f88[_0x4cf3('0x4')]||'';this[_0x4cf3('0x5')]=_0x340f88[_0x4cf3('0x5')]||{};}module[_0x4cf3('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x1292=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0xd84b4,_0x5b36b1){var _0x10402d=function(_0x119d45){while(--_0x119d45){_0xd84b4['push'](_0xd84b4['shift']());}};_0x10402d(++_0x5b36b1);}(_0x1292,0x167));var _0x2129=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x1292[_0x11005e];return _0x29338f;};'use strict';function ServicenowAccount(_0x22d471){this['id']=_0x22d471['id']||0x0;this['name']=_0x22d471[_0x2129('0x0')]||'';this['username']=_0x22d471[_0x2129('0x1')]||'';this[_0x2129('0x2')]=_0x22d471[_0x2129('0x2')]||'';this[_0x2129('0x3')]=_0x22d471['remoteUri']||'';this[_0x2129('0x4')]=_0x22d471[_0x2129('0x4')]||'';this[_0x2129('0x5')]=_0x22d471[_0x2129('0x5')]||{};}module[_0x2129('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 9f630c6..5af6a02 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 _0xfe36=['remoteUri','serverUrl','Configurations','name','username','password'];(function(_0x4fcebc,_0x1c92da){var _0x1b70a1=function(_0x46d59a){while(--_0x46d59a){_0x4fcebc['push'](_0x4fcebc['shift']());}};_0x1b70a1(++_0x1c92da);}(_0xfe36,0x153));var _0x6fe3=function(_0x4cbbe3,_0x1a8efd){_0x4cbbe3=_0x4cbbe3-0x0;var _0x5c5c26=_0xfe36[_0x4cbbe3];return _0x5c5c26;};'use strict';function SugarcrmAccount(_0x7b3cef){this['id']=_0x7b3cef['id']||0x0;this[_0x6fe3('0x0')]=_0x7b3cef[_0x6fe3('0x0')]||'';this['username']=_0x7b3cef[_0x6fe3('0x1')]||'';this[_0x6fe3('0x2')]=_0x7b3cef[_0x6fe3('0x2')]||'';this[_0x6fe3('0x3')]=_0x7b3cef[_0x6fe3('0x3')]||'';this[_0x6fe3('0x4')]=_0x7b3cef['serverUrl']||'';this[_0x6fe3('0x5')]=_0x7b3cef[_0x6fe3('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0xe6ec=['password','remoteUri','Configurations','exports','name','username'];(function(_0x320733,_0x2a85d0){var _0x177a79=function(_0x5eaca9){while(--_0x5eaca9){_0x320733['push'](_0x320733['shift']());}};_0x177a79(++_0x2a85d0);}(_0xe6ec,0x1cc));var _0xce6e=function(_0x5867be,_0x492b5c){_0x5867be=_0x5867be-0x0;var _0xab4997=_0xe6ec[_0x5867be];return _0xab4997;};'use strict';function SugarcrmAccount(_0x1488df){this['id']=_0x1488df['id']||0x0;this[_0xce6e('0x0')]=_0x1488df[_0xce6e('0x0')]||'';this[_0xce6e('0x1')]=_0x1488df[_0xce6e('0x1')]||'';this['password']=_0x1488df[_0xce6e('0x2')]||'';this[_0xce6e('0x3')]=_0x1488df[_0xce6e('0x3')]||'';this['serverUrl']=_0x1488df['serverUrl']||'';this[_0xce6e('0x4')]=_0x1488df['Configurations']||{};}module[_0xce6e('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 4ef37db..b8e4bba 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 _0xd732=['unknown','exports','name','state'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0xd732,0x18e));var _0x2d73=function(_0x3d4498,_0x3b6416){_0x3d4498=_0x3d4498-0x0;var _0x529459=_0xd732[_0x3d4498];return _0x529459;};'use strict';function Telephone(_0x45bd01){this['id']=_0x45bd01['id']||0x0;this['name']=_0x45bd01[_0x2d73('0x0')]||'';this['accountcode']=_0x45bd01['accountcode']||'';this[_0x2d73('0x1')]=_0x2d73('0x2');this['stateTime']=0x0;this['status']=_0x2d73('0x2');this['address']='';}module[_0x2d73('0x3')]=Telephone; \ No newline at end of file +var _0x4f9b=['exports','name','accountcode','state','unknown','stateTime'];(function(_0x248aee,_0x4654d9){var _0x3b8159=function(_0x171c93){while(--_0x171c93){_0x248aee['push'](_0x248aee['shift']());}};_0x3b8159(++_0x4654d9);}(_0x4f9b,0x6d));var _0xb4f9=function(_0x411631,_0x5cc5c3){_0x411631=_0x411631-0x0;var _0x490190=_0x4f9b[_0x411631];return _0x490190;};'use strict';function Telephone(_0x250137){this['id']=_0x250137['id']||0x0;this[_0xb4f9('0x0')]=_0x250137[_0xb4f9('0x0')]||'';this[_0xb4f9('0x1')]=_0x250137[_0xb4f9('0x1')]||'';this[_0xb4f9('0x2')]=_0xb4f9('0x3');this[_0xb4f9('0x4')]=0x0;this['status']='unknown';this['address']='';}module[_0xb4f9('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 e2729c5..5dd8a77 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(_0x565374,_0x1153ea){var _0xc1ba69=function(_0x1c96c9){while(--_0x1c96c9){_0x565374['push'](_0x565374['shift']());}};_0xc1ba69(++_0x1153ea);}(_0xb10b,0x12a));var _0xbb10=function(_0x7880d2,_0x32e7d6){_0x7880d2=_0x7880d2-0x0;var _0x35ebbe=_0xb10b[_0x7880d2];return _0x35ebbe;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x5e705f,_0x1a99a3){var _0x167320=function(_0x6c71ff){while(--_0x6c71ff){_0x5e705f['push'](_0x5e705f['shift']());}};_0x167320(++_0x1a99a3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 6c04dd3..dd80b10 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 _0x0b0e=['channel','voice','status','AllConditions','AnyConditions','Actions','exports','name'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0b0e,0x187));var _0xe0b0=function(_0x44caf4,_0x238750){_0x44caf4=_0x44caf4-0x0;var _0x117cad=_0x0b0e[_0x44caf4];return _0x117cad;};'use strict';function Trigger(_0x29cd1e){this['id']=_0x29cd1e['id']||0x0;this['name']=_0x29cd1e[_0xe0b0('0x0')]||'';this['channel']=_0x29cd1e[_0xe0b0('0x1')]||_0xe0b0('0x2');this[_0xe0b0('0x3')]=_0x29cd1e[_0xe0b0('0x3')]||![];this[_0xe0b0('0x4')]=_0x29cd1e[_0xe0b0('0x4')]||[];this[_0xe0b0('0x5')]=_0x29cd1e[_0xe0b0('0x5')]||[];this[_0xe0b0('0x6')]=_0x29cd1e[_0xe0b0('0x6')]||[];}module[_0xe0b0('0x7')]=Trigger; \ No newline at end of file +var _0x8603=['exports','name','channel','status','AllConditions','AnyConditions','Actions'];(function(_0x3a5da6,_0x50e790){var _0x30253d=function(_0x5e41e4){while(--_0x5e41e4){_0x3a5da6['push'](_0x3a5da6['shift']());}};_0x30253d(++_0x50e790);}(_0x8603,0x190));var _0x3860=function(_0xa55801,_0x3d483e){_0xa55801=_0xa55801-0x0;var _0x2ee55a=_0x8603[_0xa55801];return _0x2ee55a;};'use strict';function Trigger(_0xba4b79){this['id']=_0xba4b79['id']||0x0;this[_0x3860('0x0')]=_0xba4b79[_0x3860('0x0')]||'';this[_0x3860('0x1')]=_0xba4b79['channel']||'voice';this[_0x3860('0x2')]=_0xba4b79[_0x3860('0x2')]||![];this[_0x3860('0x3')]=_0xba4b79['AllConditions']||[];this[_0x3860('0x4')]=_0xba4b79['AnyConditions']||[];this[_0x3860('0x5')]=_0xba4b79[_0x3860('0x5')]||[];}module[_0x3860('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 49a653c..40e513d 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 _0x937c=['unknown','stateTime','status','registry','split','host','port','domain','domainport','refresh','registrationtime','address','defaultuser','exports','active','name'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x937c,0x11e));var _0xc937=function(_0x1a886c,_0x449182){_0x1a886c=_0x1a886c-0x0;var _0x571e48=_0x937c[_0x1a886c];return _0x571e48;};'use strict';function Trunk(_0x1d0225){this['id']=_0x1d0225['id']||0x0;this['active']=_0x1d0225[_0xc937('0x0')]||![];this[_0xc937('0x1')]=_0x1d0225[_0xc937('0x1')]||'';this['state']=_0xc937('0x2');this[_0xc937('0x3')]=0x0;this[_0xc937('0x4')]=_0xc937('0x2');this[_0xc937('0x5')]=_0x1d0225[_0xc937('0x5')]&&_0x1d0225[_0xc937('0x5')]['indexOf'](':')?_0x1d0225['registry'][_0xc937('0x6')](':')[0x0]:'';this[_0xc937('0x7')]='';this[_0xc937('0x8')]='';this[_0xc937('0x9')]='';this[_0xc937('0xa')]='';this[_0xc937('0xb')]='';this['stateRegistry']=_0xc937('0x2');this[_0xc937('0xc')]='';this[_0xc937('0xd')]='';this['defaultuser']=_0x1d0225[_0xc937('0xe')]||'';}module[_0xc937('0xf')]=Trunk; \ No newline at end of file +var _0x7c70=['stateRegistry','registrationtime','defaultuser','active','name','unknown','stateTime','status','registry','indexOf','split','domain','domainport','refresh'];(function(_0x51f77c,_0xa9c783){var _0x5d407c=function(_0x4f2d1c){while(--_0x4f2d1c){_0x51f77c['push'](_0x51f77c['shift']());}};_0x5d407c(++_0xa9c783);}(_0x7c70,0x18b));var _0x07c7=function(_0x3a8c85,_0x4ce1bf){_0x3a8c85=_0x3a8c85-0x0;var _0x3c11bf=_0x7c70[_0x3a8c85];return _0x3c11bf;};'use strict';function Trunk(_0x33ce35){this['id']=_0x33ce35['id']||0x0;this[_0x07c7('0x0')]=_0x33ce35['active']||![];this[_0x07c7('0x1')]=_0x33ce35[_0x07c7('0x1')]||'';this['state']=_0x07c7('0x2');this[_0x07c7('0x3')]=0x0;this[_0x07c7('0x4')]=_0x07c7('0x2');this[_0x07c7('0x5')]=_0x33ce35['registry']&&_0x33ce35['registry'][_0x07c7('0x6')](':')?_0x33ce35[_0x07c7('0x5')][_0x07c7('0x7')](':')[0x0]:'';this['host']='';this['port']='';this[_0x07c7('0x8')]='';this[_0x07c7('0x9')]='';this[_0x07c7('0xa')]='';this[_0x07c7('0xb')]='unknown';this[_0x07c7('0xc')]='';this['address']='';this[_0x07c7('0xd')]=_0x33ce35[_0x07c7('0xd')]||'';}module['exports']=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index f43e9f0..0195b95 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 _0x3ce5=['exten','recordingFormat','none','mandatoryDisposition','exports'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x3ce5,0x19a));var _0x53ce=function(_0x68196e,_0x2e32d4){_0x68196e=_0x68196e-0x0;var _0x2ed821=_0x3ce5[_0x68196e];return _0x2ed821;};'use strict';function voiceExtension(_0x419bbc){this['id']=_0x419bbc['id']||0x0;this[_0x53ce('0x0')]=_0x419bbc[_0x53ce('0x0')]||'';this[_0x53ce('0x1')]=_0x419bbc[_0x53ce('0x1')]||_0x53ce('0x2');this['mandatoryDisposition']=_0x419bbc[_0x53ce('0x3')]||![];}module[_0x53ce('0x4')]=voiceExtension; \ No newline at end of file +var _0x1dc9=['none','mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x2ceb31,_0x40ecf1){var _0x168859=function(_0x3de469){while(--_0x3de469){_0x2ceb31['push'](_0x2ceb31['shift']());}};_0x168859(++_0x40ecf1);}(_0x1dc9,0x10c));var _0x91dc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1dc9[_0x14add3];return _0x4a174f;};'use strict';function voiceExtension(_0x4b252c){this['id']=_0x4b252c['id']||0x0;this['exten']=_0x4b252c[_0x91dc('0x0')]||'';this[_0x91dc('0x1')]=_0x4b252c[_0x91dc('0x1')]||_0x91dc('0x2');this[_0x91dc('0x3')]=_0x4b252c['mandatoryDisposition']||![];}module[_0x91dc('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 ebe5ea4..966f0c4 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 _0x347d=['predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','invalid','unavailable','ringinuse','onhold','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','talking','total','sumDuration','sumHoldTime','sumBillable','unmanaged','available','acw','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startPredictive','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable'];(function(_0x51a214,_0x275581){var _0x40e771=function(_0x4fceb6){while(--_0x4fceb6){_0x51a214['push'](_0x51a214['shift']());}};_0x40e771(++_0x275581);}(_0x347d,0x1ec));var _0xd347=function(_0xeced0d,_0x33c430){_0xeced0d=_0xeced0d-0x0;var _0x4379bb=_0x347d[_0xeced0d];return _0x4379bb;};'use strict';var statusDesc=[_0xd347('0x0'),_0xd347('0x1'),_0xd347('0x2'),_0xd347('0x3'),_0xd347('0x4'),_0xd347('0x5'),'ringing',_0xd347('0x6'),_0xd347('0x7')];var monitorFormat={'wav':_0xd347('0x8'),'wav49':_0xd347('0x9'),'gsm':_0xd347('0xa')};var strategy={'rrmemory':_0xd347('0xb'),'roundrobin':_0xd347('0xc')};function VoiceQueue(_0x56ca9a){this['id']=_0x56ca9a['id']||0x0;this[_0xd347('0xd')]=_0x56ca9a[_0xd347('0xd')]||'';this[_0xd347('0xe')]=_0x56ca9a[_0xd347('0xe')]||'';this[_0xd347('0xf')]=_0x56ca9a[_0xd347('0xf')]||_0xd347('0x10');this['waiting']=0x0;this[_0xd347('0x11')]=0x0;this[_0xd347('0x12')]=0x0;this['answered']=0x0;this[_0xd347('0x13')]=0x0;this[_0xd347('0x14')]=0x0;this[_0xd347('0x15')]=0x0;this[_0xd347('0x16')]=0x0;this['abandoned']=0x0;this['loggedIn']=0x0;this[_0xd347('0x17')]=0x0;this[_0xd347('0x18')]=_0x56ca9a[_0xd347('0x18')]||![];this['acwTimeout']=_0x56ca9a['acwTimeout']||0xa;this[_0xd347('0x19')]=_0x56ca9a['autopause']||'no';this[_0xd347('0x1a')]=!![];this[_0xd347('0x1b')]='';this[_0xd347('0x1c')]=0x0;this[_0xd347('0x1d')]=0x0;this[_0xd347('0x1e')]=_0x56ca9a[_0xd347('0x1e')]||null;this[_0xd347('0x1f')]=_0x56ca9a[_0xd347('0x1f')]?_0x56ca9a[_0xd347('0x1f')]:null;this[_0xd347('0x20')]=_0x56ca9a[_0xd347('0x20')];this[_0xd347('0x21')]=_0x56ca9a[_0xd347('0x21')]||_0xd347('0x22');this['dialLimitChannel']=_0x56ca9a[_0xd347('0x23')]||0x0;this[_0xd347('0x24')]=_0x56ca9a['dialLimitQueue']||0x0;this[_0xd347('0x25')]=_0x56ca9a[_0xd347('0x25')]||0x1;this['dialPredictiveOptimization']=_0x56ca9a[_0xd347('0x26')]||'dropRate';this[_0xd347('0x27')]=_0x56ca9a[_0xd347('0x27')]||0.03;this[_0xd347('0x28')]=_0x56ca9a[_0xd347('0x28')]||0x258;this[_0xd347('0x29')]=_0x56ca9a[_0xd347('0x29')]||_0xd347('0x2a');this['dialOriginateCallerIdNumber']=_0x56ca9a[_0xd347('0x2b')]||_0xd347('0x2a');this[_0xd347('0x2c')]=_0x56ca9a[_0xd347('0x2c')]||0x1e;this[_0xd347('0x2d')]=_0x56ca9a[_0xd347('0x2d')]||'tTxX';this['dialQueueTimeout']=_0x56ca9a[_0xd347('0x2e')]||0x3;this['dialQueueProject']=_0x56ca9a[_0xd347('0x2f')]||undefined;this[_0xd347('0x30')]=_0x56ca9a['dialCongestionMaxRetry']||0x3;this['dialCongestionRetryFrequency']=_0x56ca9a['dialCongestionRetryFrequency']||0x96;this[_0xd347('0x31')]=_0x56ca9a[_0xd347('0x31')]||0x3;this[_0xd347('0x32')]=_0x56ca9a['dialBusyRetryFrequency']||0x96;this[_0xd347('0x33')]=_0x56ca9a['dialNoAnswerMaxRetry']||0x3;this[_0xd347('0x34')]=_0x56ca9a['dialNoAnswerRetryFrequency']||0x96;this[_0xd347('0x35')]=_0x56ca9a[_0xd347('0x35')]||0x3;this[_0xd347('0x36')]=_0x56ca9a[_0xd347('0x36')]||0x96;this[_0xd347('0x37')]=_0x56ca9a[_0xd347('0x37')]||0x3;this[_0xd347('0x38')]=_0x56ca9a[_0xd347('0x38')]||0x96;this['dialAbandonedMaxRetry']=_0x56ca9a[_0xd347('0x39')]||0x3;this[_0xd347('0x3a')]=_0x56ca9a[_0xd347('0x3a')]||0x96;this[_0xd347('0x3b')]=_0x56ca9a['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x56ca9a[_0xd347('0x3c')]||0x96;this['dialAgentRejectMaxRetry']=_0x56ca9a['dialAgentRejectMaxRetry']||0x3;this[_0xd347('0x3d')]=_0x56ca9a[_0xd347('0x3d')]||0x96;this['callAdditionalPhoneAfterMin']=_0x56ca9a['callAdditionalPhoneAfterMin']||0x3;this[_0xd347('0x3e')]=_0x56ca9a[_0xd347('0x3e')]||0x4;this[_0xd347('0x3f')]=_0x56ca9a[_0xd347('0x3f')]?_0x56ca9a[_0xd347('0x3f')]:undefined;this[_0xd347('0x40')]=_0x56ca9a[_0xd347('0x40')]?_0x56ca9a[_0xd347('0x40')]:undefined;this[_0xd347('0x41')]=_0x56ca9a[_0xd347('0x41')]||undefined;this['Interval']=_0x56ca9a[_0xd347('0x42')]?_0x56ca9a['Interval']:undefined;this[_0xd347('0x43')]=_0x56ca9a['dialOrderByScheduledAt']||_0xd347('0x44');this[_0xd347('0x45')]=_0x56ca9a[_0xd347('0x45')]||undefined;this[_0xd347('0x46')]=_0x56ca9a['dialCutDigit']||undefined;this[_0xd347('0x47')]=strategy[_0x56ca9a[_0xd347('0x47')]]||'rrmemory';this[_0xd347('0x48')]=!![];this['dialAMDActive']=_0x56ca9a[_0xd347('0x49')]||![];this[_0xd347('0x4a')]=_0x56ca9a[_0xd347('0x4a')];this[_0xd347('0x4b')]=_0x56ca9a[_0xd347('0x4b')];this[_0xd347('0x4c')]=_0x56ca9a[_0xd347('0x4c')];this[_0xd347('0x4d')]=_0x56ca9a[_0xd347('0x4d')];this[_0xd347('0x4e')]=_0x56ca9a[_0xd347('0x4e')];this[_0xd347('0x4f')]=_0x56ca9a['dialAMDBetweenWordsSilence'];this[_0xd347('0x50')]=_0x56ca9a[_0xd347('0x50')];this[_0xd347('0x51')]=_0x56ca9a[_0xd347('0x51')];this[_0xd347('0x52')]=_0x56ca9a[_0xd347('0x52')];this['outboundRejectCallsDay']=0x0;this[_0xd347('0x53')]=0x0;this[_0xd347('0x54')]=_0x56ca9a[_0xd347('0x54')];this[_0xd347('0x55')]=0x0;this[_0xd347('0x56')]=0x0;this[_0xd347('0x57')]=0x0;this[_0xd347('0x58')]=0x0;this[_0xd347('0x59')]=0x0;this['outboundNoSuchCallsDay']=0x0;this['outboundUnknownCallsDay']=0x0;this[_0xd347('0x5a')]=0x0;this[_0xd347('0x5b')]=0x0;this[_0xd347('0x5c')]=0x0;this[_0xd347('0x5d')]=0x0;this[_0xd347('0x5e')]=0x0;this[_0xd347('0x5f')]=0x0;this[_0xd347('0x60')]=0x0;this['startProgressive']=undefined;this[_0xd347('0x61')]=undefined;this['handlePredictive']=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0xd347('0x62')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0xd347('0x63')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0xd347('0x64')]=0x0;this[_0xd347('0x65')]=0x0;this[_0xd347('0x66')]=0x0;this[_0xd347('0x67')]=_0x56ca9a[_0xd347('0x68')]||0x14;this[_0xd347('0x69')]=_0x56ca9a[_0xd347('0x68')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0xd347('0x6a')]=0x0;this[_0xd347('0x6b')]=0x1;this[_0xd347('0x6c')]=0x0;this['erlangCallToSecond']=0x0;this[_0xd347('0x6d')]=0x0;this[_0xd347('0x6e')]=0x0;this[_0xd347('0x6f')]=_0x56ca9a['dialRecallMeTimeout']||0x1e;this[_0xd347('0x70')]=_0x56ca9a[_0xd347('0x70')]||![];this[_0xd347('0x71')]=_0x56ca9a[_0xd347('0x71')]||undefined;this['dialAgiAfterHangupClient']=_0x56ca9a[_0xd347('0x72')]||![];this[_0xd347('0x73')]=_0x56ca9a[_0xd347('0x73')]||![];this['monitor_format']=monitorFormat[_0x56ca9a[_0xd347('0xe')]]?monitorFormat[_0x56ca9a['monitor_format']]:undefined;this[_0xd347('0x74')]=_0x56ca9a[_0xd347('0x74')]||![];this[_0xd347('0x75')]=_0x56ca9a[_0xd347('0x75')]?_0x56ca9a[_0xd347('0x75')]:undefined;}module[_0xd347('0x76')]=VoiceQueue; \ No newline at end of file +var _0x0d8a=['startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','gsm','roundrobin','name','monitor_format','inbound','waiting','talking','total','answered','sumDuration','sumBillable','unmanaged','abandoned','loggedIn','available','acwTimeout','autopause','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay'];(function(_0x42ca58,_0x423bf9){var _0x1a3a40=function(_0x1d4a8a){while(--_0x1d4a8a){_0x42ca58['push'](_0x42ca58['shift']());}};_0x1a3a40(++_0x423bf9);}(_0x0d8a,0x10b));var _0xa0d8=function(_0x166033,_0x247d60){_0x166033=_0x166033-0x0;var _0x38e31d=_0x0d8a[_0x166033];return _0x38e31d;};'use strict';var statusDesc=[_0xa0d8('0x0'),_0xa0d8('0x1'),_0xa0d8('0x2'),_0xa0d8('0x3'),_0xa0d8('0x4'),_0xa0d8('0x5'),_0xa0d8('0x6'),_0xa0d8('0x7'),_0xa0d8('0x8')];var monitorFormat={'wav':'wav','wav49':'wav49','gsm':_0xa0d8('0x9')};var strategy={'rrmemory':'rrmemory','roundrobin':_0xa0d8('0xa')};function VoiceQueue(_0x40195c){this['id']=_0x40195c['id']||0x0;this[_0xa0d8('0xb')]=_0x40195c[_0xa0d8('0xb')]||'';this['monitor_format']=_0x40195c[_0xa0d8('0xc')]||'';this['type']=_0x40195c['type']||_0xa0d8('0xd');this[_0xa0d8('0xe')]=0x0;this[_0xa0d8('0xf')]=0x0;this[_0xa0d8('0x10')]=0x0;this[_0xa0d8('0x11')]=0x0;this[_0xa0d8('0x12')]=0x0;this['sumHoldTime']=0x0;this[_0xa0d8('0x13')]=0x0;this[_0xa0d8('0x14')]=0x0;this[_0xa0d8('0x15')]=0x0;this[_0xa0d8('0x16')]=0x0;this[_0xa0d8('0x17')]=0x0;this['acw']=_0x40195c['acw']||![];this[_0xa0d8('0x18')]=_0x40195c['acwTimeout']||0xa;this[_0xa0d8('0x19')]=_0x40195c[_0xa0d8('0x19')]||'no';this['sendMessageOneNotActive']=!![];this['message']='';this['originated']=0x0;this['temp']=0x0;this[_0xa0d8('0x1a')]=_0x40195c[_0xa0d8('0x1a')]||null;this[_0xa0d8('0x1b')]=_0x40195c['dialGlobalInterval']?_0x40195c['dialGlobalInterval']:null;this[_0xa0d8('0x1c')]=_0x40195c[_0xa0d8('0x1c')];this[_0xa0d8('0x1d')]=_0x40195c[_0xa0d8('0x1d')]||_0xa0d8('0x1e');this[_0xa0d8('0x1f')]=_0x40195c[_0xa0d8('0x1f')]||0x0;this[_0xa0d8('0x20')]=_0x40195c[_0xa0d8('0x20')]||0x0;this[_0xa0d8('0x21')]=_0x40195c[_0xa0d8('0x21')]||0x1;this[_0xa0d8('0x22')]=_0x40195c[_0xa0d8('0x22')]||_0xa0d8('0x23');this['dialPredictiveOptimizationPercentage']=_0x40195c[_0xa0d8('0x24')]||0.03;this['dialPredictiveInterval']=_0x40195c[_0xa0d8('0x25')]||0x258;this[_0xa0d8('0x26')]=_0x40195c['dialOriginateCallerIdName']||_0xa0d8('0x27');this[_0xa0d8('0x28')]=_0x40195c['dialOriginateCallerIdNumber']||_0xa0d8('0x27');this[_0xa0d8('0x29')]=_0x40195c[_0xa0d8('0x29')]||0x1e;this[_0xa0d8('0x2a')]=_0x40195c['dialQueueOptions']||_0xa0d8('0x2b');this['dialQueueTimeout']=_0x40195c[_0xa0d8('0x2c')]||0x3;this[_0xa0d8('0x2d')]=_0x40195c['dialQueueProject']||undefined;this[_0xa0d8('0x2e')]=_0x40195c['dialCongestionMaxRetry']||0x3;this[_0xa0d8('0x2f')]=_0x40195c['dialCongestionRetryFrequency']||0x96;this[_0xa0d8('0x30')]=_0x40195c[_0xa0d8('0x30')]||0x3;this[_0xa0d8('0x31')]=_0x40195c[_0xa0d8('0x31')]||0x96;this[_0xa0d8('0x32')]=_0x40195c[_0xa0d8('0x32')]||0x3;this[_0xa0d8('0x33')]=_0x40195c[_0xa0d8('0x33')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x40195c[_0xa0d8('0x34')]||0x3;this[_0xa0d8('0x35')]=_0x40195c['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x40195c[_0xa0d8('0x36')]||0x3;this[_0xa0d8('0x37')]=_0x40195c['dialDropRetryFrequency']||0x96;this[_0xa0d8('0x38')]=_0x40195c[_0xa0d8('0x38')]||0x3;this[_0xa0d8('0x39')]=_0x40195c[_0xa0d8('0x39')]||0x96;this[_0xa0d8('0x3a')]=_0x40195c[_0xa0d8('0x3a')]||0x3;this[_0xa0d8('0x3b')]=_0x40195c['dialMachineRetryFrequency']||0x96;this[_0xa0d8('0x3c')]=_0x40195c['dialAgentRejectMaxRetry']||0x3;this[_0xa0d8('0x3d')]=_0x40195c[_0xa0d8('0x3d')]||0x96;this[_0xa0d8('0x3e')]=_0x40195c[_0xa0d8('0x3e')]||0x3;this['dialGlobalMaxRetry']=_0x40195c[_0xa0d8('0x3f')]||0x4;this[_0xa0d8('0x40')]=_0x40195c[_0xa0d8('0x40')]?_0x40195c[_0xa0d8('0x40')]:undefined;this[_0xa0d8('0x41')]=_0x40195c[_0xa0d8('0x41')]?_0x40195c['TrunkBackup']:undefined;this[_0xa0d8('0x42')]=_0x40195c[_0xa0d8('0x42')]||undefined;this[_0xa0d8('0x43')]=_0x40195c[_0xa0d8('0x43')]?_0x40195c[_0xa0d8('0x43')]:undefined;this[_0xa0d8('0x44')]=_0x40195c[_0xa0d8('0x44')]||_0xa0d8('0x45');this[_0xa0d8('0x46')]=_0x40195c['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xa0d8('0x47')]=_0x40195c['dialCutDigit']||undefined;this['strategy']=strategy[_0x40195c[_0xa0d8('0x48')]]||_0xa0d8('0x49');this[_0xa0d8('0x4a')]=!![];this[_0xa0d8('0x4b')]=_0x40195c[_0xa0d8('0x4b')]||![];this[_0xa0d8('0x4c')]=_0x40195c[_0xa0d8('0x4c')];this['dialAMDGreeting']=_0x40195c[_0xa0d8('0x4d')];this[_0xa0d8('0x4e')]=_0x40195c[_0xa0d8('0x4e')];this[_0xa0d8('0x4f')]=_0x40195c['dialAMDTotalAnalysisTime'];this[_0xa0d8('0x50')]=_0x40195c[_0xa0d8('0x50')];this[_0xa0d8('0x51')]=_0x40195c[_0xa0d8('0x51')];this['dialAMDMaximumNumberOfWords']=_0x40195c['dialAMDMaximumNumberOfWords'];this[_0xa0d8('0x52')]=_0x40195c[_0xa0d8('0x52')];this[_0xa0d8('0x53')]=_0x40195c[_0xa0d8('0x53')];this[_0xa0d8('0x54')]=0x0;this['pTalking']=0x0;this['timeout']=_0x40195c[_0xa0d8('0x55')];this[_0xa0d8('0x56')]=0x0;this[_0xa0d8('0x57')]=0x0;this[_0xa0d8('0x58')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0xa0d8('0x59')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0xa0d8('0x5a')]=0x0;this[_0xa0d8('0x5b')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0xa0d8('0x5c')]=0x0;this[_0xa0d8('0x5d')]=0x0;this[_0xa0d8('0x5e')]=0x0;this['outboundReCallsDay']=0x0;this[_0xa0d8('0x5f')]=0x0;this[_0xa0d8('0x60')]=undefined;this['startPredictive']=undefined;this[_0xa0d8('0x61')]=undefined;this[_0xa0d8('0x62')]=1.05;this[_0xa0d8('0x63')]=0x0;this[_0xa0d8('0x64')]=0x0;this[_0xa0d8('0x65')]=0x0;this[_0xa0d8('0x66')]=0x0;this[_0xa0d8('0x67')]=0x0;this[_0xa0d8('0x68')]=0x0;this[_0xa0d8('0x69')]=0x0;this[_0xa0d8('0x6a')]=0x0;this[_0xa0d8('0x6b')]=_0x40195c[_0xa0d8('0x6c')]||0x14;this[_0xa0d8('0x6d')]=_0x40195c['dialPredictiveIntervalMaxThreshold']||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0xa0d8('0x6e')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0xa0d8('0x6f')]=0x0;this[_0xa0d8('0x70')]=0x0;this[_0xa0d8('0x71')]=0x0;this[_0xa0d8('0x72')]=0x0;this['dialRecallMeTimeout']=_0x40195c['dialRecallMeTimeout']||0x1e;this['dialRecallInQueue']=_0x40195c['dialRecallInQueue']||![];this[_0xa0d8('0x73')]=_0x40195c[_0xa0d8('0x73')]||undefined;this['dialAgiAfterHangupClient']=_0x40195c[_0xa0d8('0x74')]||![];this['dialAgiAfterHangupAgent']=_0x40195c[_0xa0d8('0x75')]||![];this['monitor_format']=monitorFormat[_0x40195c[_0xa0d8('0xc')]]?monitorFormat[_0x40195c['monitor_format']]:undefined;this[_0xa0d8('0x76')]=_0x40195c[_0xa0d8('0x76')]||![];this['mandatoryDispositionPause']=_0x40195c[_0xa0d8('0x77')]?_0x40195c['mandatoryDispositionPause']:undefined;}module[_0xa0d8('0x78')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 7668604..47c529c 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 _0x9089=['name','username','accessKey','remoteUri','serverUrl','Configurations','exports'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x9089,0x149));var _0x9908=function(_0x267c52,_0x3c0df3){_0x267c52=_0x267c52-0x0;var _0x46c47b=_0x9089[_0x267c52];return _0x46c47b;};'use strict';function VtigerAccount(_0x1bceff){this['id']=_0x1bceff['id']||0x0;this['name']=_0x1bceff[_0x9908('0x0')]||'';this[_0x9908('0x1')]=_0x1bceff[_0x9908('0x1')]||'';this[_0x9908('0x2')]=_0x1bceff['accessKey']||'';this[_0x9908('0x3')]=_0x1bceff['remoteUri']||'';this['serverUrl']=_0x1bceff[_0x9908('0x4')]||'';this[_0x9908('0x5')]=_0x1bceff[_0x9908('0x5')]||{};}module[_0x9908('0x6')]=VtigerAccount; \ No newline at end of file +var _0x455b=['serverUrl','Configurations','name','username','accessKey','remoteUri'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x455b,0x14c));var _0xb455=function(_0x17f5ab,_0x9c8da2){_0x17f5ab=_0x17f5ab-0x0;var _0x1bc96b=_0x455b[_0x17f5ab];return _0x1bc96b;};'use strict';function VtigerAccount(_0x2af7e2){this['id']=_0x2af7e2['id']||0x0;this[_0xb455('0x0')]=_0x2af7e2[_0xb455('0x0')]||'';this[_0xb455('0x1')]=_0x2af7e2['username']||'';this['accessKey']=_0x2af7e2[_0xb455('0x2')]||'';this[_0xb455('0x3')]=_0x2af7e2[_0xb455('0x3')]||'';this[_0xb455('0x4')]=_0x2af7e2[_0xb455('0x4')]||'';this['Configurations']=_0x2af7e2[_0xb455('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 6cd870a..4085564 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 _0xc900=['remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password','token'];(function(_0x10165c,_0x5ad2b4){var _0x454073=function(_0x3ca33c){while(--_0x3ca33c){_0x10165c['push'](_0x10165c['shift']());}};_0x454073(++_0x5ad2b4);}(_0xc900,0x11a));var _0x0c90=function(_0x52e5a3,_0x540a32){_0x52e5a3=_0x52e5a3-0x0;var _0x139f5e=_0xc900[_0x52e5a3];return _0x139f5e;};'use strict';function ZendeskAccount(_0x5cf0ac){this['id']=_0x5cf0ac['id']||0x0;this[_0x0c90('0x0')]=_0x5cf0ac[_0x0c90('0x0')]||'';this[_0x0c90('0x1')]=_0x5cf0ac[_0x0c90('0x1')]||'';this['password']=_0x5cf0ac[_0x0c90('0x2')]||'';this[_0x0c90('0x3')]=_0x5cf0ac[_0x0c90('0x3')]||'';this[_0x0c90('0x4')]=_0x5cf0ac[_0x0c90('0x4')]||'';this['authType']=_0x5cf0ac[_0x0c90('0x5')]||'';this['type']=_0x5cf0ac[_0x0c90('0x6')]||_0x0c90('0x7');this[_0x0c90('0x8')]=_0x5cf0ac[_0x0c90('0x8')]||'';this[_0x0c90('0x9')]=_0x5cf0ac[_0x0c90('0x9')]||{};}module[_0x0c90('0xa')]=ZendeskAccount; \ No newline at end of file +var _0x00ae=['username','password','token','remoteUri','authType','type','serverUrl','Configurations','exports','name'];(function(_0x31451d,_0xfaaae){var _0x3e23b7=function(_0x151b83){while(--_0x151b83){_0x31451d['push'](_0x31451d['shift']());}};_0x3e23b7(++_0xfaaae);}(_0x00ae,0x149));var _0xe00a=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x00ae[_0x50a0c2];return _0x5ebadd;};'use strict';function ZendeskAccount(_0x4ae0a8){this['id']=_0x4ae0a8['id']||0x0;this[_0xe00a('0x0')]=_0x4ae0a8[_0xe00a('0x0')]||'';this['username']=_0x4ae0a8[_0xe00a('0x1')]||'';this[_0xe00a('0x2')]=_0x4ae0a8['password']||'';this['token']=_0x4ae0a8[_0xe00a('0x3')]||'';this[_0xe00a('0x4')]=_0x4ae0a8[_0xe00a('0x4')]||'';this[_0xe00a('0x5')]=_0x4ae0a8[_0xe00a('0x5')]||'';this[_0xe00a('0x6')]=_0x4ae0a8[_0xe00a('0x6')]||'integrationTab';this[_0xe00a('0x7')]=_0x4ae0a8[_0xe00a('0x7')]||'';this[_0xe00a('0x8')]=_0x4ae0a8[_0xe00a('0x8')]||{};}module[_0xe00a('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index d8d4fd6..7c316b1 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 _0xa46d=['refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl','code'];(function(_0xe5530b,_0x4477ea){var _0x549c66=function(_0x495293){while(--_0x495293){_0xe5530b['push'](_0xe5530b['shift']());}};_0x549c66(++_0x4477ea);}(_0xa46d,0xd4));var _0xda46=function(_0x34c527,_0x7796ab){_0x34c527=_0x34c527-0x0;var _0x555dfc=_0xa46d[_0x34c527];return _0x555dfc;};'use strict';function ZohoAccount(_0x1edee9){this['id']=_0x1edee9['id']||0x0;this['name']=_0x1edee9[_0xda46('0x0')]||'';this[_0xda46('0x1')]=_0x1edee9[_0xda46('0x1')]||'';this[_0xda46('0x2')]=_0x1edee9['host']||'';this['zone']=_0x1edee9[_0xda46('0x3')]||'';this['clientId']=_0x1edee9[_0xda46('0x4')]||'';this[_0xda46('0x5')]=_0x1edee9[_0xda46('0x5')]||'';this[_0xda46('0x6')]=_0x1edee9[_0xda46('0x6')]||'';this[_0xda46('0x7')]=_0x1edee9[_0xda46('0x7')]||'';this[_0xda46('0x8')]=_0x1edee9[_0xda46('0x8')]||'';this[_0xda46('0x9')]=_0x1edee9['Configurations']||{};}module[_0xda46('0xa')]=ZohoAccount; \ No newline at end of file +var _0xe429=['code','refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0xe429,0x138));var _0x9e42=function(_0x266cd5,_0x2d9257){_0x266cd5=_0x266cd5-0x0;var _0x437456=_0xe429[_0x266cd5];return _0x437456;};'use strict';function ZohoAccount(_0x56e0f0){this['id']=_0x56e0f0['id']||0x0;this['name']=_0x56e0f0[_0x9e42('0x0')]||'';this[_0x9e42('0x1')]=_0x56e0f0[_0x9e42('0x1')]||'';this[_0x9e42('0x2')]=_0x56e0f0[_0x9e42('0x2')]||'';this[_0x9e42('0x3')]=_0x56e0f0[_0x9e42('0x3')]||'';this[_0x9e42('0x4')]=_0x56e0f0[_0x9e42('0x4')]||'';this[_0x9e42('0x5')]=_0x56e0f0[_0x9e42('0x5')]||'';this['serverUrl']=_0x56e0f0[_0x9e42('0x6')]||'';this[_0x9e42('0x7')]=_0x56e0f0[_0x9e42('0x7')]||'';this[_0x9e42('0x8')]=_0x56e0f0['refreshToken']||'';this[_0x9e42('0x9')]=_0x56e0f0[_0x9e42('0x9')]||{};}module[_0x9e42('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 2c27daa..23fc3e2 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 _0x3d04=['callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','idContact','queue','name','type','dialAnswer','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry'];(function(_0x2734cf,_0x2cce97){var _0xc230b7=function(_0x7a5400){while(--_0x7a5400){_0x2734cf['push'](_0x2734cf['shift']());}};_0xc230b7(++_0x2cce97);}(_0x3d04,0xbe));var _0x43d0=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x3d04[_0x3bf83f];return _0x22c4a9;};'use strict';var util=require(_0x43d0('0x0'));var _=require(_0x43d0('0x1'));var moment=require(_0x43d0('0x2'));function checkNameSurname(_0x105c73,_0x191de5,_0x143fea){var _0x3d6e62='';if(!_[_0x43d0('0x3')](_0x191de5)&&'string'===typeof _0x191de5){_0x3d6e62+=_0x191de5;}if(!_[_0x43d0('0x3')](_0x143fea)&&_0x43d0('0x4')===typeof _0x143fea){_0x3d6e62+='\x20'+_0x143fea;}if(_0x3d6e62!==''){return _0x3d6e62;}return _0x105c73;}function Action(_0x746f5e,_0x617bf,_0x5e284f,_0x484271,_0x50919e){this['uniqueid']=_0x5e284f||undefined;this[_0x43d0('0x5')]=_0x746f5e['id'];this[_0x43d0('0x6')]=_0x617bf[_0x43d0('0x7')];this[_0x43d0('0x8')]=_0x617bf[_0x43d0('0x8')];this['campaigntype']='queue';this[_0x43d0('0x9')]=![];this['membername']=_['isNil'](_0x746f5e[_0x43d0('0xa')])?undefined:_0x746f5e[_0x43d0('0xa')][_0x43d0('0x7')];this[_0x43d0('0xb')]=this['membername']?util[_0x43d0('0xc')](_0x43d0('0xd'),this['membername']):_0x484271||undefined;this[_0x43d0('0xe')]=checkNameSurname(_0x746f5e[_0x43d0('0xf')][_0x43d0('0x10')],_0x746f5e['Contact'][_0x43d0('0x11')],_0x746f5e[_0x43d0('0xf')][_0x43d0('0x12')]);this['active']=_0x746f5e[_0x43d0('0x13')]||![];this[_0x43d0('0x14')]=_0x746f5e[_0x43d0('0x10')];this[_0x43d0('0x15')]=_0x746f5e[_0x43d0('0x15')];this['countbusyretry']=_0x746f5e['countbusyretry']||0x0;this[_0x43d0('0x16')]=_0x746f5e[_0x43d0('0x16')]||0x0;this[_0x43d0('0x17')]=_0x746f5e['countnoanswerretry']||0x0;this[_0x43d0('0x18')]=(_0x746f5e['countbusyretry']||0x0)+(_0x746f5e[_0x43d0('0x16')]||0x0)+(_0x746f5e[_0x43d0('0x17')]||0x0)+(_0x746f5e[_0x43d0('0x19')]||0x0)+(_0x746f5e['countdropretry']||0x0)+(_0x746f5e[_0x43d0('0x1a')]||0x0)+(_0x746f5e[_0x43d0('0x1b')]||0x0)+(_0x746f5e['countagentrejectretry']||0x0);this[_0x43d0('0x19')]=_0x746f5e[_0x43d0('0x19')]||0x0;this[_0x43d0('0x1c')]=_0x746f5e[_0x43d0('0x1c')]||0x0;this[_0x43d0('0x1a')]=_0x746f5e[_0x43d0('0x1a')]||0x0;this[_0x43d0('0x1b')]=_0x746f5e[_0x43d0('0x1b')]||0x0;this[_0x43d0('0x1d')]=_0x746f5e[_0x43d0('0x1d')]||0x0;this[_0x43d0('0x1e')]=_0x746f5e[_0x43d0('0x1e')];this[_0x43d0('0x1f')]=_0x746f5e[_0x43d0('0x1f')];this[_0x43d0('0x20')]=_0x746f5e['callbackat'];this[_0x43d0('0x21')]=_0x746f5e[_0x43d0('0x21')];this['ContactId']=_0x746f5e[_0x43d0('0x22')];this['ListId']=_0x746f5e[_0x43d0('0x23')];this[_0x43d0('0x24')]=_['isNil'](_0x746f5e[_0x43d0('0xa')])?_0x746f5e[_0x43d0('0x24')]:_0x746f5e['Agent']['id'];this[_0x43d0('0x25')]=_0x746f5e[_0x43d0('0x25')];this[_0x43d0('0x26')]='';this['originatecalleridname']='';}Action[_0x43d0('0x27')][_0x43d0('0x28')]=function(){return util[_0x43d0('0xc')](_0x43d0('0x29'),this[_0x43d0('0xe')],this[_0x43d0('0x2a')]);};module[_0x43d0('0x2b')]=Action; \ No newline at end of file +var _0xa30a=['Agent','channelAgent','membername','SIP/%s','calleridname','phone','Contact','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','uniqueid','queue','name','type','campaigntype'];(function(_0x3266b2,_0x529084){var _0x14fa5a=function(_0x30dd57){while(--_0x30dd57){_0x3266b2['push'](_0x3266b2['shift']());}};_0x14fa5a(++_0x529084);}(_0xa30a,0xd7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0xaa30('0x0'));var _=require(_0xaa30('0x1'));var moment=require(_0xaa30('0x2'));function checkNameSurname(_0x4dfa7e,_0x49b545,_0x1ebf61){var _0x36f517='';if(!_[_0xaa30('0x3')](_0x49b545)&&_0xaa30('0x4')===typeof _0x49b545){_0x36f517+=_0x49b545;}if(!_[_0xaa30('0x3')](_0x1ebf61)&&_0xaa30('0x4')===typeof _0x1ebf61){_0x36f517+='\x20'+_0x1ebf61;}if(_0x36f517!==''){return _0x36f517;}return _0x4dfa7e;}function Action(_0x555947,_0x347cd5,_0x4efe89,_0x8af448,_0x14fe09){this[_0xaa30('0x5')]=_0x4efe89||undefined;this['idContact']=_0x555947['id'];this[_0xaa30('0x6')]=_0x347cd5[_0xaa30('0x7')];this[_0xaa30('0x8')]=_0x347cd5[_0xaa30('0x8')];this[_0xaa30('0x9')]=_0xaa30('0x6');this['dialAnswer']=![];this['membername']=_[_0xaa30('0x3')](_0x555947['Agent'])?undefined:_0x555947[_0xaa30('0xa')][_0xaa30('0x7')];this[_0xaa30('0xb')]=this[_0xaa30('0xc')]?util['format'](_0xaa30('0xd'),this[_0xaa30('0xc')]):_0x8af448||undefined;this[_0xaa30('0xe')]=checkNameSurname(_0x555947['Contact'][_0xaa30('0xf')],_0x555947[_0xaa30('0x10')][_0xaa30('0x11')],_0x555947[_0xaa30('0x10')][_0xaa30('0x12')]);this[_0xaa30('0x13')]=_0x555947[_0xaa30('0x13')]||![];this[_0xaa30('0x14')]=_0x555947[_0xaa30('0xf')];this[_0xaa30('0x15')]=_0x555947['scheduledat'];this[_0xaa30('0x16')]=_0x555947['countbusyretry']||0x0;this['countcongestionretry']=_0x555947[_0xaa30('0x17')]||0x0;this[_0xaa30('0x18')]=_0x555947[_0xaa30('0x18')]||0x0;this['countglobal']=(_0x555947['countbusyretry']||0x0)+(_0x555947['countcongestionretry']||0x0)+(_0x555947[_0xaa30('0x18')]||0x0)+(_0x555947['countnosuchnumberretry']||0x0)+(_0x555947[_0xaa30('0x19')]||0x0)+(_0x555947[_0xaa30('0x1a')]||0x0)+(_0x555947['countmachineretry']||0x0)+(_0x555947['countagentrejectretry']||0x0);this['countnosuchnumberretry']=_0x555947[_0xaa30('0x1b')]||0x0;this[_0xaa30('0x19')]=_0x555947[_0xaa30('0x19')]||0x0;this[_0xaa30('0x1a')]=_0x555947[_0xaa30('0x1a')]||0x0;this['countmachineretry']=_0x555947[_0xaa30('0x1c')]||0x0;this[_0xaa30('0x1d')]=_0x555947[_0xaa30('0x1d')]||0x0;this[_0xaa30('0x1e')]=_0x555947[_0xaa30('0x1e')];this['callbackuniqueid']=_0x555947[_0xaa30('0x1f')];this[_0xaa30('0x20')]=_0x555947[_0xaa30('0x20')];this[_0xaa30('0x21')]=_0x555947['recallme'];this[_0xaa30('0x22')]=_0x555947[_0xaa30('0x22')];this[_0xaa30('0x23')]=_0x555947[_0xaa30('0x23')];this[_0xaa30('0x24')]=_[_0xaa30('0x3')](_0x555947['Agent'])?_0x555947[_0xaa30('0x24')]:_0x555947[_0xaa30('0xa')]['id'];this['VoiceQueueId']=_0x555947[_0xaa30('0x25')];this['originatecalleridnum']='';this[_0xaa30('0x26')]='';}Action[_0xaa30('0x27')][_0xaa30('0x28')]=function(){return util[_0xaa30('0x29')](_0xaa30('0x2a'),this[_0xaa30('0xe')],this[_0xaa30('0x2b')]);};module[_0xaa30('0x2c')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 8499e98..6729eed 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 _0x716c=['originatecalleridnum','extractCalleridNumber','addVariables','toLowerVariables','Action','variablesAction','channelAgent','destconnectedlinenum','calleridnum','user:agentconnect','accountcode','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','channelstate','transfer','[syncHangup][talking][transfer]','addVariable','variables','filterKey','keys','value','error','[syncVarSet][Preview]','inspect','syncAttendedTransfer','transfertargetlinkedid','exports','util','lodash','uuid','moment','md5','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','syncHangup','bind','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','outbound','name','strategy','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','total','abandoned','waiting','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','erlangCallToSecond','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','format','voice:queue:%s','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','paused','[CampaignPreview]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','logger','syncCampaigns','booked','type','clearZombieChannels','hasOwnProperty','dialActive','setMessage','recallMe','sequence','queue','originated:\x20','originated','pTalking:\x20','pick','contactId','UserId','VoiceQueueId','ListId','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','dialAnswer','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[action]','size','clearZombieChannel','agentReadyId','isNil','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','custom:agentnosuchnumber','nosuchnumber','createCustomerHistory','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','then','additional','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','custom:agentconnect','buildObj','connect','acw','buildAcw','custom:agentcomplete','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','\x20Queue','BUSY','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','busy','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','dialNoAnswerRetryFrequency','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','unlockAgent','CONGESTION','outboundCongestionCallsDay','countcongestionretry','dialCongestionRetryFrequency','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','AgentReject','custom:agentreject','agentreject','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','destlinkedid','object','isUndefined','reason','logAgent','NoSuchNumber','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','Queue','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','run','execRun','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0x716c,0x18e));var _0xc716=function(_0xd73c06,_0x442578){_0xd73c06=_0xd73c06-0x0;var _0x55b164=_0x716c[_0xd73c06];return _0x55b164;};'use strict';var util=require(_0xc716('0x0'));var _=require(_0xc716('0x1'));var BPromise=require('bluebird');var uuid=require(_0xc716('0x2'));var moment=require(_0xc716('0x3'));var md5=require(_0xc716('0x4'));var Redis=require('ioredis');var config=require(_0xc716('0x5'));var logger=require(_0xc716('0x6'))(_0xc716('0x7'));var loggerAction=require(_0xc716('0x6'))(_0xc716('0x8'));var ami=require(_0xc716('0x9'));var rpcDb=require(_0xc716('0xa'));var cmHopperAdditionalPhone=require(_0xc716('0xb'));var Action=require(_0xc716('0xc'));var ut=require(_0xc716('0xd'));config[_0xc716('0xe')]=_['defaults'](config[_0xc716('0xe')],{'host':_0xc716('0xf'),'port':0x18eb});var io=require(_0xc716('0x10'))(new Redis(config[_0xc716('0xe')]));var Sequence=function(){};Sequence[_0xc716('0x11')][_0xc716('0x12')]=function(_0xd6e7a1){this['tail']=this[_0xc716('0x13')]?this[_0xc716('0x13')][_0xc716('0x14')](_0xd6e7a1):_0xd6e7a1();};function Preview(_0x56302b){this['sequence']=new Sequence();this[_0xc716('0x15')]=_0x56302b[_0xc716('0x16')];this[_0xc716('0x17')]=_0x56302b[_0xc716('0x17')];this[_0xc716('0x18')]={};this[_0xc716('0x19')]=_0x56302b['agents'];this[_0xc716('0x1a')]=0x0;ami['on'](_0xc716('0x1b'),this[_0xc716('0x1c')]['bind'](this));ami['on']('hangup',this[_0xc716('0x1d')][_0xc716('0x1e')](this));ami['on'](_0xc716('0x1f'),this[_0xc716('0x20')][_0xc716('0x1e')](this));ami['on'](_0xc716('0x21'),this[_0xc716('0x22')][_0xc716('0x1e')](this));ami['on'](_0xc716('0x23'),this[_0xc716('0x24')][_0xc716('0x1e')](this));ami['on'](_0xc716('0x25'),this[_0xc716('0x26')][_0xc716('0x1e')](this));ami['on'](_0xc716('0x27'),this['syncAttendedTransfer'][_0xc716('0x1e')](this));ami['on'](_0xc716('0x28'),this[_0xc716('0x29')]['bind'](this));this[_0xc716('0x2a')](this[_0xc716('0x15')]);}function emit(_0xbb3a39,_0x303df7,_0x13f9b2){io['to'](_0xbb3a39)[_0xc716('0x2b')](_0x303df7,_0x13f9b2);}function emitCampaignPreview(_0x5ce2c3){if(_0x5ce2c3['type']===_0xc716('0x2c')){var _0x16a1ff={'id':_0x5ce2c3['id'],'name':_0x5ce2c3[_0xc716('0x2d')],'strategy':_0x5ce2c3[_0xc716('0x2e')],'answered':_0x5ce2c3[_0xc716('0x2f')],'available':_0x5ce2c3[_0xc716('0x30')],'loggedIn':_0x5ce2c3[_0xc716('0x31')],'pTalking':_0x5ce2c3[_0xc716('0x32')],'sumBillable':_0x5ce2c3[_0xc716('0x33')],'sumDuration':_0x5ce2c3['sumDuration'],'sumHoldTime':_0x5ce2c3[_0xc716('0x34')]||0x0,'talking':_0x5ce2c3[_0xc716('0x35')],'total':_0x5ce2c3[_0xc716('0x36')],'type':_0x5ce2c3['type'],'unmanaged':_0x5ce2c3['unmanaged'],'abandoned':_0x5ce2c3[_0xc716('0x37')],'waiting':_0x5ce2c3[_0xc716('0x38')],'loggedInDb':_0x5ce2c3['loggedInDb'],'dialActive':_0x5ce2c3['dialActive'],'dialMethod':_0x5ce2c3[_0xc716('0x39')],'dialOriginateCallerIdName':_0x5ce2c3[_0xc716('0x3a')],'dialOriginateCallerIdNumber':_0x5ce2c3[_0xc716('0x3b')],'dialOriginateTimeout':_0x5ce2c3[_0xc716('0x3c')],'dialPrefix':_0x5ce2c3['dialPrefix'],'outboundAnswerAgiCallsDay':_0x5ce2c3['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x5ce2c3[_0xc716('0x3d')],'outboundBlacklistCallsDay':_0x5ce2c3['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x5ce2c3[_0xc716('0x3e')],'outboundCongestionCallsDay':_0x5ce2c3['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x5ce2c3[_0xc716('0x3f')],'outboundDropCallsDayCallersExit':_0x5ce2c3[_0xc716('0x40')],'outboundDropCallsDayTimeout':_0x5ce2c3[_0xc716('0x41')],'outboundNoAnswerCallsDay':_0x5ce2c3['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x5ce2c3[_0xc716('0x42')],'outboundOriginateFailureCallsDay':_0x5ce2c3[_0xc716('0x43')],'outboundReCallsDay':_0x5ce2c3['outboundReCallsDay'],'outboundRejectCallsDay':_0x5ce2c3[_0xc716('0x44')],'outboundUnknownCallsDay':_0x5ce2c3[_0xc716('0x45')],'outboundAbandonedCallsDay':_0x5ce2c3[_0xc716('0x46')],'predictiveIntervalAnsweredCalls':_0x5ce2c3['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x5ce2c3['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x5ce2c3['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x5ce2c3[_0xc716('0x47')],'predictiveIntervalDroppedCallsTimeout':_0x5ce2c3[_0xc716('0x48')],'predictiveIntervalErlangCalls':_0x5ce2c3[_0xc716('0x49')],'predictiveIntervalErlangCallsDroppedCalls':_0x5ce2c3['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x5ce2c3[_0xc716('0x4a')],'predictiveIntervalMultiplicativeFactor':_0x5ce2c3[_0xc716('0x4b')],'predictiveIntervalPauses':_0x5ce2c3[_0xc716('0x4c')],'predictiveIntervalAvailable':_0x5ce2c3[_0xc716('0x4d')],'predictiveIntervalTotalCalls':_0x5ce2c3[_0xc716('0x4e')],'message':_0x5ce2c3[_0xc716('0x4f')],'originated':_0x5ce2c3['originated'],'erlangCalls':_0x5ce2c3['erlangCalls'],'erlangCallToSecond':_0x5ce2c3[_0xc716('0x50')],'erlangAbandonmentRate':_0x5ce2c3['erlangAbandonmentRate'],'erlangBusyFactor':_0x5ce2c3[_0xc716('0x51')],'startPredictive':_0x5ce2c3[_0xc716('0x52')],'startProgressive':_0x5ce2c3[_0xc716('0x53')]};if(_0x5ce2c3['Trunk']){_0x16a1ff[_0xc716('0x54')]={'id':_0x5ce2c3[_0xc716('0x54')]['id'],'name':_0x5ce2c3[_0xc716('0x54')][_0xc716('0x2d')],'active':_0x5ce2c3['Trunk'][_0xc716('0x55')],'callerid':_0x5ce2c3[_0xc716('0x54')][_0xc716('0x56')]};}if(_0x5ce2c3[_0xc716('0x57')]){_0x16a1ff['Interval']={'id':_0x5ce2c3['Interval']['id'],'name':_0x5ce2c3[_0xc716('0x57')]['name']};}var _0x36073f=md5(JSON[_0xc716('0x58')](_0x16a1ff));if(_0x5ce2c3[_0xc716('0x4')]!==_0x36073f){_0x5ce2c3[_0xc716('0x4')]=_0x36073f;emit(util[_0xc716('0x59')](_0xc716('0x5a'),_0x16a1ff[_0xc716('0x2d')]),'voice_queue:save',_0x16a1ff);}}}function emitVoiceQueueChannelRemove(_0x36d077){logger[_0xc716('0x5b')](_0xc716('0x5c'),JSON[_0xc716('0x58')](_0x36d077));emit(util[_0xc716('0x59')](_0xc716('0x5a'),_0x36d077[_0xc716('0x2d')]),_0xc716('0x5d'),_0x36d077);io[_0xc716('0x2b')](_0xc716('0x5e'),_0x36d077);}function notSendMessagesQueue(_0x1b097f){if(_0x1b097f[_0xc716('0x5f')]){if(_0x1b097f['originated']===0x0&&_0x1b097f['pTalking']===0x0){_0x1b097f[_0xc716('0x5f')]=![];_0x1b097f[_0xc716('0x30')]=0x0;_0x1b097f[_0xc716('0x60')]=0x0;_0x1b097f['message']='NOT_ACTIVE';ut['logger'](_0xc716('0x61'),_0x1b097f[_0xc716('0x2d')]+'\x20is\x20not\x20active');}else{_0x1b097f['message']=_0xc716('0x62');ut[_0xc716('0x63')](_0xc716('0x61'),_0x1b097f['name']+'\x20is\x20disactive');}emitCampaignPreview(_0x1b097f);}}Preview[_0xc716('0x11')][_0xc716('0x2a')]=function(){var _0x1ccc18=this;setInterval(function(){_0x1ccc18['syncCampaigns']();},0x7cf);};Preview[_0xc716('0x11')][_0xc716('0x64')]=function(){var _0x36ca15=this['campaignsPreview'];this[_0xc716('0x1a')]+=0x1;for(var _0x465301 in _0x36ca15){if(_0x36ca15['hasOwnProperty'](_0x465301)&&(_0x36ca15[_0x465301][_0xc716('0x39')]===_0xc716('0x7')||_0x36ca15[_0x465301]['dialMethod']===_0xc716('0x65'))&&_0x36ca15[_0x465301][_0xc716('0x66')]===_0xc716('0x2c')){if(this[_0xc716('0x1a')]>0x7){this[_0xc716('0x1a')]=0x0;this[_0xc716('0x67')]();}}if(_0x36ca15[_0xc716('0x68')](_0x465301)&&_0x36ca15[_0x465301][_0xc716('0x39')]===_0xc716('0x7')&&_0x36ca15[_0x465301][_0xc716('0x66')]===_0xc716('0x2c')){if(_0x36ca15[_0x465301][_0xc716('0x69')]){this[_0xc716('0x6a')](_0x36ca15[_0x465301]);this[_0xc716('0x6b')](_0x36ca15[_0x465301]);}else{notSendMessagesQueue(_0x36ca15[_0x465301]);}}}};Preview['prototype']['clearZombieChannel']=function(_0x4d5e13){var _0xf41046=this;this[_0xc716('0x6c')][_0xc716('0x12')](function(){if(!_['isNil'](_0xf41046[_0xc716('0x18')][_0x4d5e13])){loggerAction[_0xc716('0x5b')]('[clearZombieChannels][talking]',_0x4d5e13,'Queue',_0xf41046[_0xc716('0x18')][_0x4d5e13][_0xc716('0x6d')],_0xc716('0x6e'),JSON[_0xc716('0x58')](_0xf41046[_0xc716('0x15')][_0xf41046['actions'][_0x4d5e13][_0xc716('0x6d')]][_0xc716('0x6f')]),_0xc716('0x70'),JSON['stringify'](_0xf41046['campaignsPreview'][_0xf41046[_0xc716('0x18')][_0x4d5e13][_0xc716('0x6d')]][_0xc716('0x32')]),JSON[_0xc716('0x58')](_0xf41046[_0xc716('0x18')][_0x4d5e13]['dialAnswer']),JSON[_0xc716('0x58')](_[_0xc716('0x71')](_0xf41046[_0xc716('0x18')][_0x4d5e13],[_0xc716('0x72'),_0xc716('0x73'),_0xc716('0x74'),_0xc716('0x75')])));return ami['Action']({'action':_0xc716('0x76'),'channel':_0xf41046[_0xc716('0x18')][_0x4d5e13][_0xc716('0x77')]})[_0xc716('0x78')](function(_0x46211b){if(_0x46211b[_0xc716('0x4f')]===_0xc716('0x79')){setTimeout(function(){if(_0xf41046[_0xc716('0x18')][_0x4d5e13]){ut[_0xc716('0x7a')](_0xf41046[_0xc716('0x15')][_0xf41046[_0xc716('0x18')][_0x4d5e13][_0xc716('0x6d')]],_0xc716('0x7b'));if(_0xf41046[_0xc716('0x18')][_0x4d5e13][_0xc716('0x7c')]===!![]){ut[_0xc716('0x7d')](_0xf41046[_0xc716('0x15')][_0xf41046[_0xc716('0x18')][_0x4d5e13][_0xc716('0x6d')]],_0xc716('0x7b'));ut[_0xc716('0x7e')](_0xc716('0x7f')+_0x4d5e13,_0xf41046[_0xc716('0x18')][_0x4d5e13][_0xc716('0x6d')]);}ut['loggerError']('[Dialer][checkChannel][Preview]'+_0x4d5e13,_0xf41046[_0xc716('0x18')][_0x4d5e13][_0xc716('0x6d')]);delete _0xf41046['actions'][_0x4d5e13];}},0x2328);}});}});};Preview['prototype'][_0xc716('0x67')]=function(){var _0xb08cb9=this;loggerAction[_0xc716('0x5b')](_0xc716('0x80'),_[_0xc716('0x81')](this['actions']));for(var _0x46f78d in this['actions']){if(_0xb08cb9[_0xc716('0x18')][_0xc716('0x68')](_0x46f78d)){_0xb08cb9[_0xc716('0x82')](_0x46f78d);}}};Preview['prototype'][_0xc716('0x6b')]=function(_0x1bd050){var _0x1a0400=this;rpcDb['getContactRecallMe'](_0x1bd050['id'],ut[_0xc716('0x83')](this[_0xc716('0x19')]))['then'](function(_0x1632ae){if(!_[_0xc716('0x84')](_0x1632ae)){for(var _0x1c043b=0x0;_0x1c043b<_0x1632ae[_0xc716('0x85')];_0x1c043b+=0x1){if(ut[_0xc716('0x86')](_0x1632ae[_0x1c043b][_0xc716('0x87')])<_0x1bd050[_0xc716('0x88')]*0x3c){if(_0x1632ae[_0x1c043b][_0xc716('0x89')]&&!_0x1632ae[_0x1c043b]['Agent'][_0xc716('0x8a')]){_0x1a0400['run'](_0x1632ae[_0x1c043b]['id'])['then'](ut[_0xc716('0x8b')](_0xc716('0x8c')))[_0xc716('0x78')](ut[_0xc716('0x8b')](_0xc716('0x8c')));}else{rpcDb[_0xc716('0x8d')](_0x1632ae[_0x1c043b]['id']);}}else{var _0x45e1e1=new Action(_0x1632ae[_0x1c043b],_0x1bd050);_0x45e1e1[_0xc716('0x8e')]=moment()[_0xc716('0x59')](_0xc716('0x8f'));_0x1bd050[_0xc716('0x90')]+=0x1;ut[_0xc716('0x91')](_0x45e1e1,0x17,_0xc716('0x92'));if(_0x1bd050['dialRecallInQueue']){rpcDb['rescheduleContactInQueue'](ut[_0xc716('0x93')](_0x1632ae[_0x1c043b]));rpcDb['createCustomerHistory'](_0x45e1e1,_0xc716('0x94'));}else{ut[_0xc716('0x91')](_0x45e1e1,0x16,_0xc716('0x95'));rpcDb['createCustomerHistory'](_0x45e1e1,_0xc716('0x96'));rpcDb[_0xc716('0x97')](_0x45e1e1,_0xc716('0x96'));}}}}})[_0xc716('0x78')](ut['logger2'](_0xc716('0x98')));};Preview[_0xc716('0x11')][_0xc716('0x6a')]=function(_0x2421bd){_0x2421bd[_0xc716('0x5f')]=!![];if(ut[_0xc716('0x99')](_0x2421bd[_0xc716('0x31')])){_0x2421bd[_0xc716('0x4f')]=_0xc716('0x9a');}else if(!ut[_0xc716('0x9b')](_0x2421bd[_0xc716('0x69')])){_0x2421bd['message']='NOT_ACTIVE';}else if(!this['isTrunkReachable'](_0x2421bd[_0xc716('0x54')])){if(!this[_0xc716('0x9c')](_0x2421bd[_0xc716('0x9d')])){_0x2421bd[_0xc716('0x4f')]=_0xc716('0x9e');}else{_0x2421bd['message']=_0xc716('0x9f');}}else{_0x2421bd[_0xc716('0x4f')]=_0xc716('0x9f');}emitCampaignPreview(_0x2421bd);};Preview['prototype'][_0xc716('0xa0')]=function(_0x13892c,_0x12b9cf,_0x332e4c){var _0x47ebfe=this;var _0x39f8e8=this[_0xc716('0x18')][_0x12b9cf];var _0x40f4b2=this[_0xc716('0x15')][_0x39f8e8[_0xc716('0x6d')]];var _0x1b5102;var _0x23fd25=![];var _0x1ac5cd=0x2;var _0x17a24a=0x3;if(_0x40f4b2){switch(_0x332e4c){case'1':_0x40f4b2[_0xc716('0x42')]+=0x1;_0x39f8e8[_0xc716('0xa1')]+=0x1;_0x39f8e8[_0xc716('0xa2')]=ut[_0xc716('0xa3')](_0x39f8e8);ut['logCustomer'](_0x39f8e8,0x0,'NoSuchNumber');ami[_0xc716('0x2b')](_0xc716('0xa4'),ut['buildObj'](_0x39f8e8,_0xc716('0xa5')));rpcDb[_0xc716('0xa6')](_0x39f8e8,_0xc716('0xa7'));_0x47ebfe[_0xc716('0xa8')](_0x39f8e8,'0',_0x40f4b2)[_0xc716('0xa9')](function(_0x5e17fa){_0x23fd25=_0x5e17fa[_0xc716('0xaa')]==0x1;_0x1ac5cd=_0x40f4b2['dialNoSuchNumberRetryFrequency'];_0x17a24a=_0x40f4b2[_0xc716('0xab')];if(!_0x23fd25){if(ut['totalGlobal'](_0x39f8e8)>=_0x40f4b2[_0xc716('0xac')]){_0x1b5102=ut[_0xc716('0xad')](_0x39f8e8,0xf,_0xc716('0xae'));rpcDb[_0xc716('0x97')](_0x1b5102,_0xc716('0xaf'));}else{if(_0x39f8e8[_0xc716('0xa1')]>=_0x40f4b2['dialNoSuchNumberMaxRetry']){rpcDb['createCustomerFinal'](_0x39f8e8,_0xc716('0xaf'));}else{rpcDb[_0xc716('0xb0')](ut[_0xc716('0xb1')](_0x39f8e8,_0xc716('0xa1'),_0x40f4b2[_0xc716('0xb2')]),_0x39f8e8['unlockAgent'],_0x39f8e8[_0xc716('0xb3')]);}}delete this[_0xc716('0x18')][_0x13892c[_0xc716('0xb4')]];}else{_0x39f8e8[_0xc716('0xa1')]++;logger['info'](_0xc716('0xb5'),_0x39f8e8[_0xc716('0xa1')]);logger[_0xc716('0x5b')]('id',_0x39f8e8[_0xc716('0xb6')]);_0x47ebfe[_0xc716('0xb7')]({'id':_0x39f8e8[_0xc716('0xb6')],'field':{'countnosuchnumberretry':_0x39f8e8['countnosuchnumberretry']}})[_0xc716('0xa9')](function(){_0x47ebfe[_0xc716('0xb8')](_0x39f8e8,_0x1ac5cd,_0x17a24a)[_0xc716('0xa9')](function(){});});}});break;case _0xc716('0xb9'):var _0x309326=moment()[_0xc716('0x59')](_0xc716('0x8f'));_0x39f8e8[_0xc716('0xba')]=_0x309326;_0x39f8e8[_0xc716('0xbb')]=_0x309326;_0x39f8e8[_0xc716('0x7c')]=!![];_0x40f4b2[_0xc716('0x32')]+=0x1;logger[_0xc716('0x5b')](_0xc716('0xbc'),_0x39f8e8[_0xc716('0xbd')],'\x20Queue',_0x40f4b2[_0xc716('0x2d')],_0xc716('0x70'),_0x40f4b2[_0xc716('0x32')]);ami[_0xc716('0x2b')](_0xc716('0xbe'),ut[_0xc716('0xbf')](_0x39f8e8,_0xc716('0xc0'),this['campaignsPreview'][_0x39f8e8[_0xc716('0x6d')]]));if(_0x40f4b2[_0xc716('0xc1')]){ami[_0xc716('0x2b')]('custom:agentConnectPreview',ut[_0xc716('0xc2')](_0x39f8e8));}break;case'16':ami[_0xc716('0x2b')](_0xc716('0xc3'),ut[_0xc716('0xbf')](_0x39f8e8,'complete',this[_0xc716('0x15')][_0x39f8e8['queue']]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x39f8e8,_0xc716('0xc4')));_0x40f4b2[_0xc716('0x3d')]+=0x1;_0x40f4b2[_0xc716('0x36')]+=0x1;_0x40f4b2[_0xc716('0x2f')]+=0x1;ut['decrementTalkink'](_0x40f4b2,_0xc716('0xc5'));_0x39f8e8[_0xc716('0xa2')]=ut[_0xc716('0xa3')](_0x39f8e8);ut[_0xc716('0x91')](_0x39f8e8,0x4,_0xc716('0xc6'));rpcDb[_0xc716('0xa6')](_0x39f8e8,_0xc716('0xc7'));rpcDb[_0xc716('0x97')](_0x39f8e8,_0xc716('0xc8'));rpcDb[_0xc716('0xc9')](_0x39f8e8);_0x40f4b2['sumDuration']+=_0x39f8e8[_0xc716('0xca')];_0x40f4b2[_0xc716('0x33')]+=_0x39f8e8[_0xc716('0xca')];logger['info'](_0xc716('0xcb'),_0x39f8e8['uniqueid'],_0xc716('0xcc'),_0x40f4b2[_0xc716('0x2d')],'pTalking:\x20',_0x40f4b2[_0xc716('0x32')]);delete this[_0xc716('0x18')][_0x13892c[_0xc716('0xb4')]];break;case _0xc716('0xcd'):_0x40f4b2['outboundBusyCallsDay']+=0x1;_0x39f8e8[_0xc716('0xce')]+=0x1;_0x39f8e8[_0xc716('0xa2')]=ut[_0xc716('0xa3')](_0x39f8e8);ut[_0xc716('0x91')](_0x39f8e8,0x5,_0xc716('0xcf'));_0x1ac5cd=_0x40f4b2[_0xc716('0xd0')];_0x17a24a=_0x40f4b2[_0xc716('0xab')];ami['emit'](_0xc716('0xd1'),ut[_0xc716('0xbf')](_0x39f8e8,_0xc716('0xd2')));rpcDb['createCustomerHistory'](_0x39f8e8,'[callProgressDetectingCustomer][logBusy]');_0x47ebfe[_0xc716('0xa8')](_0x39f8e8,'5',_0x40f4b2)[_0xc716('0xa9')](function(_0x1a5399){_0x23fd25=_0x1a5399[_0xc716('0xaa')]==0x1;if(!_0x23fd25){if(ut[_0xc716('0xa3')](_0x39f8e8)>=_0x40f4b2[_0xc716('0xac')]){_0x1b5102=ut[_0xc716('0xad')](_0x39f8e8,0xf,_0xc716('0xae'));rpcDb[_0xc716('0x97')](_0x1b5102,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x39f8e8[_0xc716('0xce')]>=_0x40f4b2[_0xc716('0xd3')]){rpcDb[_0xc716('0x97')](_0x39f8e8,_0xc716('0xd4'));}else{rpcDb[_0xc716('0xb0')](ut[_0xc716('0xb1')](_0x39f8e8,_0xc716('0xce'),_0x40f4b2[_0xc716('0xd0')]),_0x39f8e8['unlockAgent'],_0x39f8e8[_0xc716('0xb3')]);}}}else{_0x39f8e8[_0xc716('0xce')]++;_0x47ebfe['incrementPreviewCounters']({'id':_0x39f8e8[_0xc716('0xb6')],'field':{'countbusyretry':_0x39f8e8['countbusyretry']}})[_0xc716('0xa9')](function(){_0x47ebfe['swapAdditionalPhones'](_0x39f8e8,_0x1ac5cd,_0x17a24a)[_0xc716('0xa9')](function(){});});}});break;case'NOANSWER':_0x40f4b2['outboundNoAnswerCallsDay']+=0x1;_0x39f8e8['countnoanswerretry']+=0x1;_0x39f8e8[_0xc716('0xa2')]=ut['totalGlobal'](_0x39f8e8);ut[_0xc716('0x91')](_0x39f8e8,0x3,'NoAnswer');_0x1ac5cd=_0x40f4b2[_0xc716('0xd5')];_0x17a24a=_0x40f4b2[_0xc716('0xab')];ami[_0xc716('0x2b')](_0xc716('0xd6'),ut[_0xc716('0xbf')](_0x39f8e8,_0xc716('0xd7')));rpcDb[_0xc716('0xa6')](_0x39f8e8,_0xc716('0xd8'));_0x47ebfe[_0xc716('0xa8')](_0x39f8e8,'3',_0x40f4b2)[_0xc716('0xa9')](function(_0x44eadf){_0x23fd25=_0x44eadf[_0xc716('0xaa')]==0x1;if(!_0x23fd25){if(ut[_0xc716('0xa3')](_0x39f8e8)>=_0x40f4b2[_0xc716('0xac')]){_0x1b5102=ut[_0xc716('0xad')](_0x39f8e8,0xf,_0xc716('0xae'));rpcDb['createCustomerFinal'](_0x1b5102,_0xc716('0xd9'));}else{if(_0x39f8e8[_0xc716('0xda')]>=_0x40f4b2['dialNoAnswerMaxRetry']){rpcDb['createCustomerFinal'](_0x39f8e8,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0xc716('0xb0')](ut['scheduledAt'](_0x39f8e8,_0xc716('0xda'),_0x40f4b2[_0xc716('0xd5')]),_0x39f8e8[_0xc716('0xdb')],_0x39f8e8[_0xc716('0xb3')]);}}}else{_0x39f8e8[_0xc716('0xda')]++;_0x47ebfe['incrementPreviewCounters']({'id':_0x39f8e8[_0xc716('0xb6')],'field':{'countnoanswerretry':_0x39f8e8['countnoanswerretry']}})[_0xc716('0xa9')](function(){_0x47ebfe[_0xc716('0xb8')](_0x39f8e8,_0x1ac5cd,_0x17a24a)[_0xc716('0xa9')](function(){});});}});break;case _0xc716('0xdc'):_0x40f4b2[_0xc716('0xdd')]+=0x1;_0x39f8e8[_0xc716('0xde')]+=0x1;_0x39f8e8['countglobal']=ut[_0xc716('0xa3')](_0x39f8e8);ut[_0xc716('0x91')](_0x39f8e8,0x8,'Congestion');_0x1ac5cd=_0x40f4b2[_0xc716('0xdf')];_0x17a24a=_0x40f4b2[_0xc716('0xab')];ami[_0xc716('0x2b')]('custom:agentcongestion',ut[_0xc716('0xbf')](_0x39f8e8,_0xc716('0xe0')));rpcDb['createCustomerHistory'](_0x39f8e8,_0xc716('0xe1'));_0x47ebfe[_0xc716('0xa8')](_0x39f8e8,'8',_0x40f4b2)['then'](function(_0x1f73e3){_0x23fd25=_0x1f73e3[_0xc716('0xaa')]==0x1;if(!_0x23fd25){if(ut[_0xc716('0xa3')](_0x39f8e8)>=_0x40f4b2['dialGlobalMaxRetry']){_0x1b5102=ut[_0xc716('0xad')](_0x39f8e8,0xf,_0xc716('0xae'));rpcDb[_0xc716('0x97')](_0x1b5102,_0xc716('0xe2'));}else{if(_0x39f8e8[_0xc716('0xde')]>=_0x40f4b2[_0xc716('0xe3')]){rpcDb['createCustomerFinal'](_0x39f8e8,_0xc716('0xe1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x39f8e8,'countcongestionretry',_0x40f4b2[_0xc716('0xd0')]),_0x39f8e8[_0xc716('0xdb')],_0x39f8e8[_0xc716('0xb3')]);}}}else{_0x39f8e8[_0xc716('0xde')]++;_0x47ebfe['incrementPreviewCounters']({'id':_0x39f8e8[_0xc716('0xb6')],'field':{'countcongestionretry':_0x39f8e8[_0xc716('0xde')]}})['then'](function(){_0x47ebfe[_0xc716('0xb8')](_0x39f8e8,_0x1ac5cd,_0x17a24a)[_0xc716('0xa9')](function(){});});}});break;case _0xc716('0xe4'):_0x40f4b2[_0xc716('0x44')]+=0x1;_0x39f8e8['countagentrejectretry']+=0x1;_0x39f8e8[_0xc716('0xa2')]=ut['totalGlobal'](_0x39f8e8);ut[_0xc716('0x91')](_0x39f8e8,0x14,_0xc716('0xe5'));_0x1ac5cd=_0x40f4b2['dialAgentRejectRetryFrequency'];_0x17a24a=_0x40f4b2[_0xc716('0xab')];ami[_0xc716('0x2b')](_0xc716('0xe6'),ut[_0xc716('0xbf')](_0x39f8e8,_0xc716('0xe7')));rpcDb[_0xc716('0xa6')](_0x39f8e8,'[syncHangupRequest][logAgentReject]');_0x47ebfe[_0xc716('0xa8')](_0x39f8e8,'20',_0x40f4b2)[_0xc716('0xa9')](function(_0x2c358e){_0x23fd25=_0x2c358e[_0xc716('0xaa')]==0x1;if(!_0x23fd25){if(ut[_0xc716('0xa3')](_0x39f8e8)>=_0x40f4b2[_0xc716('0xac')]){_0x1b5102=ut[_0xc716('0xad')](_0x39f8e8,0x14,'AgentReject');rpcDb['createCustomerFinal'](_0x1b5102,_0xc716('0xe8'));}else{if(_0x39f8e8[_0xc716('0xe9')]>=_0x40f4b2[_0xc716('0xea')]){rpcDb[_0xc716('0x97')](_0x39f8e8,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0xc716('0xb0')](ut[_0xc716('0xb1')](_0x39f8e8,_0xc716('0xe9'),_0x40f4b2[_0xc716('0xeb')]),_0x39f8e8[_0xc716('0xdb')],_0x39f8e8[_0xc716('0xb3')]);}}}else{_0x39f8e8[_0xc716('0xda')]++;_0x47ebfe['incrementPreviewCounters']({'id':_0x39f8e8[_0xc716('0xb6')],'field':{'countnoanswerretry':_0x39f8e8[_0xc716('0xda')]}})[_0xc716('0xa9')](function(){_0x47ebfe['swapAdditionalPhones'](_0x39f8e8,_0x1ac5cd,_0x17a24a)[_0xc716('0xa9')](function(){});});}});break;case _0xc716('0xec'):_0x40f4b2[_0xc716('0x46')]+=0x1;_0x39f8e8[_0xc716('0xed')]+=0x1;_0x39f8e8[_0xc716('0xa2')]=ut[_0xc716('0xa3')](_0x39f8e8);ut[_0xc716('0x91')](_0x39f8e8,0xb,_0xc716('0xee'));rpcDb['createCustomerHistory'](_0x39f8e8,_0xc716('0xef'));_0x47ebfe[_0xc716('0xa8')](_0x39f8e8,'11',_0x40f4b2)[_0xc716('0xa9')](function(_0x5adf65){_0x23fd25=_0x5adf65[_0xc716('0xaa')]==0x1;if(!_0x23fd25){if(ut['totalGlobal'](_0x39f8e8)>=_0x40f4b2[_0xc716('0xac')]){_0x1b5102=ut[_0xc716('0xad')](_0x39f8e8,0xf,_0xc716('0xae'));rpcDb[_0xc716('0x97')](_0x1b5102,_0xc716('0xef'));}else{if(_0x39f8e8[_0xc716('0xf0')]>=_0x40f4b2[_0xc716('0xf1')]){rpcDb[_0xc716('0x97')](_0x39f8e8,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0xc716('0xb0')](ut[_0xc716('0xb1')](_0x39f8e8,'countabandonedretry',_0x40f4b2['dialAbandonedRetryFrequency']),_0x39f8e8['unlockAgent'],_0x39f8e8[_0xc716('0xb3')]);}}}else{_0x39f8e8[_0xc716('0xda')]++;_0x47ebfe[_0xc716('0xb7')]({'id':_0x39f8e8[_0xc716('0xb6')],'field':{'countnoanswerretry':_0x39f8e8[_0xc716('0xda')]}})[_0xc716('0xa9')](function(){_0x47ebfe[_0xc716('0xb8')](_0x39f8e8,_0x1ac5cd,_0x17a24a)[_0xc716('0xa9')](function(){});});}});break;case'18':_0x40f4b2['outboundUnknownCallsDay']+=0x1;_0x39f8e8['countmachineretry']+=0x1;_0x39f8e8['countglobal']=ut[_0xc716('0xa3')](_0x39f8e8);ut[_0xc716('0x91')](_0x39f8e8,0x12,_0x13892c[_0xc716('0xf2')]||_0x13892c[_0xc716('0xf3')]);ami['emit'](_0xc716('0xf4'),ut[_0xc716('0xbf')](_0x39f8e8,_0xc716('0xf5')));rpcDb['createCustomerHistory'](_0x39f8e8,_0xc716('0xf6'));_0x47ebfe[_0xc716('0xa8')](_0x39f8e8,'18',_0x40f4b2)[_0xc716('0xa9')](function(_0x1143b5){_0x23fd25=_0x1143b5[_0xc716('0xaa')]==0x1;if(!_0x23fd25){if(ut[_0xc716('0xa3')](_0x39f8e8)>=_0x40f4b2[_0xc716('0xac')]){_0x1b5102=ut[_0xc716('0xad')](_0x39f8e8,0x12,_0xc716('0xae'));rpcDb['createCustomerFinal'](_0x1b5102,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0xc716('0x97')](_0x39f8e8,'[callProgressDetectingCustomer][hangupInAMD]');}}else{_0x39f8e8['countnoanswerretry']++;_0x47ebfe[_0xc716('0xb7')]({'id':_0x39f8e8['idContact'],'field':{'countnoanswerretry':_0x39f8e8[_0xc716('0xda')]}})[_0xc716('0xa9')](function(){_0x47ebfe[_0xc716('0xb8')](_0x39f8e8,_0x1ac5cd,_0x17a24a)[_0xc716('0xa9')](function(){});});}});delete this[_0xc716('0x18')][_0x13892c['linkedid']];break;case'19':_0x40f4b2[_0xc716('0x45')]+=0x1;_0x39f8e8[_0xc716('0xa2')]=ut[_0xc716('0xa3')](_0x39f8e8);ut[_0xc716('0x91')](_0x39f8e8,0x13,_0x13892c[_0xc716('0xf2')]||_0x13892c[_0xc716('0xf3')]);ami['emit'](_0xc716('0xf4'),ut[_0xc716('0xbf')](_0x39f8e8,'amd'));rpcDb['createCustomerHistory'](_0x39f8e8,_0xc716('0xf7'));_0x47ebfe['verifyAdditionalPhones'](_0x39f8e8,'18',_0x40f4b2)[_0xc716('0xa9')](function(_0x3bbb6e){_0x23fd25=_0x3bbb6e[_0xc716('0xaa')]==0x1;if(!_0x23fd25){if(ut[_0xc716('0xa3')](_0x39f8e8)>=_0x40f4b2[_0xc716('0xac')]){_0x1b5102=ut[_0xc716('0xad')](_0x39f8e8,0xf,_0xc716('0xae'));rpcDb[_0xc716('0x97')](_0x1b5102,_0xc716('0xf7'));}else{rpcDb[_0xc716('0x97')](_0x39f8e8,_0xc716('0xf7'));}}else{_0x39f8e8[_0xc716('0xda')]++;_0x47ebfe[_0xc716('0xb7')]({'id':_0x39f8e8[_0xc716('0xb6')],'field':{'countnoanswerretry':_0x39f8e8[_0xc716('0xda')]}})['then'](function(){_0x47ebfe[_0xc716('0xb8')](_0x39f8e8,_0x1ac5cd,_0x17a24a)[_0xc716('0xa9')](function(){});});}});delete this[_0xc716('0x18')][_0x13892c[_0xc716('0xb4')]];break;default:if(_0x39f8e8[_0xc716('0x7c')]){ut['decrementTalkink'](_0x40f4b2,_0xc716('0xf8'));ut[_0xc716('0x7e')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x40f4b2[_0xc716('0x2d')],_0x13892c);}_0x40f4b2[_0xc716('0x45')]+=0x1;_0x39f8e8['countglobal']=ut[_0xc716('0xa3')](_0x39f8e8);ut[_0xc716('0x91')](_0x39f8e8,0xc,_0x13892c[_0xc716('0xf2')]||_0x13892c[_0xc716('0xf3')]);_0x1ac5cd=_0x40f4b2[_0xc716('0xeb')];_0x17a24a=_0x40f4b2[_0xc716('0xab')];rpcDb[_0xc716('0xa6')](_0x39f8e8,_0xc716('0xf9'));_0x47ebfe[_0xc716('0xa8')](_0x39f8e8,'20',_0x40f4b2)[_0xc716('0xa9')](function(_0x3191df){_0x23fd25=_0x3191df['additional']==0x1;if(!_0x23fd25){if(ut[_0xc716('0xa3')](_0x39f8e8)>=_0x40f4b2[_0xc716('0xac')]){_0x1b5102=ut[_0xc716('0xad')](_0x39f8e8,0xf,_0xc716('0xae'));rpcDb['createCustomerFinal'](_0x1b5102,_0xc716('0xfa'));}else{rpcDb[_0xc716('0x97')](_0x39f8e8,_0xc716('0xfa'));}delete this['actions'][_0x13892c['linkedid']];}else{_0x47ebfe[_0xc716('0xb8')](_0x39f8e8,_0x1ac5cd,_0x17a24a)['then'](function(_0x4c8ca6){});}});}if(!(_0x39f8e8['dialAnswer']&&_0x332e4c==='16')){ut[_0xc716('0x7a')](_0x40f4b2,_0xc716('0xfb'));logger['info']('[originated][decrement][callProgressDetectingCustomer]',_0x39f8e8[_0xc716('0xbd')],'\x20Queue',_0x40f4b2[_0xc716('0x2d')],_0xc716('0x6e'),_0x40f4b2[_0xc716('0x6f')]);}if(_0x332e4c!==_0xc716('0xb9')){delete this[_0xc716('0x18')][_0x13892c[_0xc716('0xb4')]];delete this[_0xc716('0x18')][_0x13892c[_0xc716('0xfc')]];}}};Preview[_0xc716('0x11')]['callProgressDetectingAgent']=function(_0x3d6aff,_0x41c938,_0x295212){if(_['isUndefined'](_0x41c938)&&_0xc716('0xfd')!==typeof _0x41c938){return;}if(_[_0xc716('0xfe')](_0x295212)&&'object'!==typeof _0x295212){return;}switch(_0x295212[_0xc716('0xff')]){case'0':ut[_0xc716('0x100')](_0x3d6aff,0x0,_0xc716('0x101'));rpcDb['createAgentHistory'](_0x3d6aff,_0xc716('0x102'));break;case'3':ut[_0xc716('0x100')](_0x3d6aff,0x3,_0xc716('0x103'));rpcDb[_0xc716('0x104')](_0x3d6aff,_0xc716('0x105'));break;case'5':ut['logAgent'](_0x3d6aff,0x5,_0xc716('0xcf'));rpcDb['createAgentHistory'](_0x3d6aff,_0xc716('0x106'));break;case'8':ut['logAgent'](_0x3d6aff,0x8,_0xc716('0x107'));rpcDb[_0xc716('0x104')](_0x3d6aff,_0xc716('0x108'));break;case'22':ut[_0xc716('0x100')](_0x3d6aff,0x16,'AnswerAGI');rpcDb['createAgentHistory'](_0x3d6aff,_0xc716('0x109'));break;default:ut[_0xc716('0x100')](_0x3d6aff,0xc,_0x295212['reason']);rpcDb[_0xc716('0x104')](_0x3d6aff,'[callProgressDetectingAgent][logCongestion]');}ut[_0xc716('0x7a')](_0x41c938,_0xc716('0x10a'));logger['info']('[originated][decrement][callProgressDetectingAgent]',_0x3d6aff[_0xc716('0xbd')],_0xc716('0xcc'),_0x41c938[_0xc716('0x2d')],'originated:\x20',_0x41c938[_0xc716('0x6f')]);delete this[_0xc716('0x18')][_0x3d6aff[_0xc716('0xbd')]];};Preview[_0xc716('0x11')]['verifyAdditionalPhones']=function(_0x34ffad,_0x56157b,_0x3b53f1){return BPromise[_0xc716('0x10b')]()[_0xc716('0xa9')](cmHopperAdditionalPhone[_0xc716('0xa8')](_0x34ffad,_0x56157b,_0x3b53f1))[_0xc716('0x78')](logger[_0xc716('0x5b')]('[verifyAdditionalPhone]\x20'));};Preview[_0xc716('0x11')][_0xc716('0xb8')]=function(_0x2c3dad,_0x43ae1e,_0x441ebf){return BPromise[_0xc716('0x10b')]()[_0xc716('0xa9')](cmHopperAdditionalPhone[_0xc716('0xb8')](_0x2c3dad,_0x43ae1e,_0x441ebf))[_0xc716('0x78')](logger[_0xc716('0x5b')]('[swapAdditionalPhone]\x20'));};Preview[_0xc716('0x11')][_0xc716('0xb7')]=function(_0x27dfb0){return BPromise['resolve']()['then'](cmHopperAdditionalPhone[_0xc716('0xb7')](_0x27dfb0))[_0xc716('0x78')](logger[_0xc716('0x5b')]('[incrementPreviewCounters]\x20'));};Preview[_0xc716('0x11')][_0xc716('0x10c')]=function(_0x1476c5,_0x5963ec,_0x2e81cb,_0x208e5f,_0x5687b7){var _0x250288=this;return new BPromise(function(_0x4ec9e0,_0x56963a){if(_[_0xc716('0x84')](_0x5963ec)||_[_0xc716('0x84')](_0x5963ec[_0xc716('0x10d')])||_[_0xc716('0x84')](_0x5963ec[_0xc716('0x10e')])||_[_0xc716('0x84')](_0x5963ec[_0xc716('0x74')])){_0x56963a(ut[_0xc716('0x4f')](_0xc716('0x10f'),_0x208e5f,_0x5687b7));return;}var _0x1ea1b5=uuid['v4']();var _0x618959=_0x250288[_0xc716('0x15')][_0x5963ec[_0xc716('0x110')]['name']];var _0x4143bc=_0x2e81cb?_0x250288[_0xc716('0x19')][_0x2e81cb]['id']:undefined;_0x250288['actions'][_0x1ea1b5]=new Action(_0x5963ec,_0x618959,_0x1ea1b5,_0x2e81cb,_0x4143bc);var _0x51ea85=_0x250288[_0xc716('0x18')][_0x1ea1b5];_0x51ea85[_0xc716('0xdb')]=_0x208e5f;_0x51ea85[_0xc716('0xb3')]=_0x5687b7;_0x51ea85[_0xc716('0x111')]=_0x2e81cb;if(_[_0xc716('0x112')](_0x1476c5)){_0x250288[_0xc716('0x113')](_0x51ea85,_0x618959,_0x5963ec,_0x2e81cb)[_0xc716('0xa9')](function(_0x2dea39){logger['info'](_0xc716('0x114'),_0xc716('0x115')+_0x51ea85[_0xc716('0x6d')]+_0xc716('0x116')+_0x51ea85[_0xc716('0xb6')],JSON[_0xc716('0x58')](_0x2dea39));ami[_0xc716('0x2b')](_0xc716('0x117'),ut['buildObj'](_0x51ea85,_0xc716('0x118'),_0x250288[_0xc716('0x15')][_0x51ea85[_0xc716('0x6d')]]));_0x4ec9e0(ut[_0xc716('0x4f')](_0xc716('0x119')));})[_0xc716('0x78')](function(_0x1879a9){ut[_0xc716('0x63')](_0xc716('0x11a'),_0x1879a9);_0x56963a(ut[_0xc716('0x4f')](_0xc716('0x11b'),_0x208e5f,_0x5687b7));});}else{_0x618959[_0xc716('0x11c')]+=0x1;ut[_0xc716('0x11d')](_0x51ea85);rpcDb[_0xc716('0x11e')](_0x51ea85,_0xc716('0x11f'));delete _0x250288[_0xc716('0x18')][_0x1ea1b5];_0x56963a(ut[_0xc716('0x4f')](_0xc716('0x120'),_0x208e5f,_0x5687b7));}});};Preview[_0xc716('0x11')][_0xc716('0x9c')]=function(_0x2266e4){return!_['isNil'](_0x2266e4)&&!_[_0xc716('0x84')](_0x2266e4[_0xc716('0x2d')])&&!_[_0xc716('0x84')](_0x2266e4[_0xc716('0x55')])&&_0x2266e4['active']&&!_['isNil'](this[_0xc716('0x17')][util[_0xc716('0x59')](_0xc716('0x121'),_0x2266e4[_0xc716('0x2d')])])&&!_['isNil'](this['trunks'][util[_0xc716('0x59')](_0xc716('0x121'),_0x2266e4[_0xc716('0x2d')])][_0xc716('0x76')])&&(this['trunks'][util['format'](_0xc716('0x121'),_0x2266e4[_0xc716('0x2d')])][_0xc716('0x76')]==='reachable'||this[_0xc716('0x17')][util[_0xc716('0x59')](_0xc716('0x121'),_0x2266e4['name'])]['status']==='unmonitored');};Preview[_0xc716('0x11')][_0xc716('0x122')]=function(_0x15e3de,_0x4acf5d){var _0x2d5ffd=this;return new BPromise(function(_0x1c394c,_0x1357cf){_0x2d5ffd[_0xc716('0x123')](_0x15e3de,_0x4acf5d)[_0xc716('0xa9')](function(_0xb4bec2){_0x1c394c(_['pick'](_0xb4bec2,['message']));})[_0xc716('0x78')](function(_0x5e2411){if(_0x5e2411['unlock']){rpcDb[_0xc716('0x124')](_0x15e3de);}if(_0x5e2411[_0xc716('0x55')]){rpcDb[_0xc716('0x8d')](_0x15e3de);}_0x1357cf(_[_0xc716('0x71')](_0x5e2411,[_0xc716('0x4f')]));});});};Preview[_0xc716('0x11')][_0xc716('0x123')]=function(_0x15c68a,_0x1195b2){var _0x54142d=this;return new BPromise(function(_0x119bb8,_0x347a9f){var _0x802865,_0x29c68b;rpcDb[_0xc716('0x125')](_0x15c68a)[_0xc716('0xa9')](function(_0x497b38){if(!_['isNil'](_0x497b38[0x0])){_0x29c68b=_0x497b38[0x0][_0xc716('0x126')]?![]:!![];_0x802865=_0x497b38[0x0][_0xc716('0x126')]?!![]:![];_0x802865=_0x1195b2?!![]:_0x802865;}var _0x26247f=_0x54142d[_0xc716('0x127')](_0x497b38);if(_0x26247f[_0xc716('0x128')]){rpcDb[_0xc716('0x129')](_[_0xc716('0x71')](_0x497b38[0x0],[_0xc716('0x74'),_0xc716('0x10e')]))['then'](function(_0x503d61){_0x54142d['checkInBlack'](_0x503d61,_0x497b38[0x0],_0x1195b2,_0x29c68b,_0x802865)['then'](function(_0x4176cf){_0x119bb8(_0x4176cf);})['catch'](function(_0x344e89){_0x347a9f(_0x344e89);});})['catch'](function(_0x1d3997){ut[_0xc716('0x63')]('[Preview][checkIsBlackList]',_0x1d3997);_0x347a9f(ut[_0xc716('0x4f')](_0xc716('0x12a'),_0x29c68b,_0x802865));});}else{_0x347a9f(ut[_0xc716('0x4f')](_0x26247f[_0xc716('0x4f')],_0x29c68b,_0x802865));}})[_0xc716('0x78')](function(_0x2f4b7d){ut[_0xc716('0x63')](_0xc716('0x12b'),_0x2f4b7d);_0x347a9f(ut[_0xc716('0x4f')](_0xc716('0x12a'),![],!![]));});});};Preview['prototype'][_0xc716('0x127')]=function(_0x4cc712){if(_[_0xc716('0x84')](_0x4cc712)||_[_0xc716('0x112')](_0x4cc712)||!_[_0xc716('0x84')](_0x4cc712[0x0][_0xc716('0x89')])&&_[_0xc716('0x84')](_0x4cc712[0x0]['Agent'][_0xc716('0x2d')])){ut[_0xc716('0x63')](_0xc716('0x12c'),_0x4cc712);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x5538d8=this[_0xc716('0x15')][_0x4cc712[0x0][_0xc716('0x110')][_0xc716('0x2d')]];_0x5538d8[_0xc716('0x4f')]=_0xc716('0x9f');if(_[_0xc716('0x84')](_0x5538d8)){ut['logger'](_0xc716('0x12d'),_0x5538d8);return{'isValid':![],'message':_0xc716('0x12e')};}if(!this[_0xc716('0x9c')](_0x5538d8[_0xc716('0x54')])){ut[_0xc716('0x63')](_0xc716('0x12f'),_0xc716('0x130')+_0x5538d8[_0xc716('0x2d')]+_0xc716('0x131'));if(!this['isTrunkReachable'](_0x5538d8[_0xc716('0x9d')])){ut[_0xc716('0x63')](_0xc716('0x12f'),_0x5538d8['name']+_0xc716('0x132'));return{'isValid':![],'message':_0xc716('0x133')};}}if(!ut[_0xc716('0x9b')](_0x5538d8[_0xc716('0x69')])){ut[_0xc716('0x63')]('[Preview][validateContact][Campaign\x20Active]',_0x5538d8[_0xc716('0x2d')]+_0xc716('0x134'));return{'isValid':![],'message':_0xc716('0x130')+_0x5538d8[_0xc716('0x2d')]+_0xc716('0x134')};}return{'isValid':!![],'message':_0xc716('0x135')};};Preview[_0xc716('0x11')][_0xc716('0x113')]=function(_0x690dfd,_0x199701,_0x52c897,_0x4d0fc2){var _0x1e8773=this;return new BPromise(function(_0x39c30f,_0x2772fe){var _0x3ce33f=_0x690dfd[_0xc716('0xbd')];var _0x1a2130=_0x1e8773[_0xc716('0x9c')](_0x199701['Trunk'])?util['format'](_0xc716('0x136'),_0x199701[_0xc716('0x54')]['name'],_['isNil'](_0x199701[_0xc716('0x137')])?'':_0x199701[_0xc716('0x137')][_0xc716('0x138')]()||'',_0x199701[_0xc716('0x139')]>0x0?_0x52c897[_0xc716('0x10e')][_0xc716('0x13a')](_0x199701[_0xc716('0x139')]):_0x52c897[_0xc716('0x10e')]):util[_0xc716('0x59')](_0xc716('0x136'),_['isNil'](_0x199701[_0xc716('0x9d')])?_0x199701[_0xc716('0x54')][_0xc716('0x2d')]:_0x199701[_0xc716('0x9d')][_0xc716('0x2d')],_[_0xc716('0x84')](_0x199701['dialPrefix'])?'':_0x199701[_0xc716('0x137')][_0xc716('0x138')]()||'',_0x199701['dialCutDigit']>0x0?_0x52c897[_0xc716('0x10e')][_0xc716('0x13a')](_0x199701[_0xc716('0x139')]):_0x52c897[_0xc716('0x10e')]);var _0x3a1c4d=_0x1e8773[_0xc716('0x9c')](_0x199701[_0xc716('0x54')])?ut[_0xc716('0x13b')](_0x199701[_0xc716('0x54')]['callerid'],_0x199701[_0xc716('0x3a')],_0x199701[_0xc716('0x13c')]>0x0?ut[_0xc716('0x13d')](_0x199701[_0xc716('0x3b')],_0x199701[_0xc716('0x13c')]):_0x199701[_0xc716('0x3b')]):ut['getCallerId'](_['isNil'](_0x199701[_0xc716('0x9d')])?_0x199701[_0xc716('0x54')][_0xc716('0x56')]:_0x199701[_0xc716('0x9d')][_0xc716('0x56')],_0x199701[_0xc716('0x3a')],_0x199701['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xc716('0x13d')](_0x199701[_0xc716('0x3b')],_0x199701[_0xc716('0x13c')]):_0x199701[_0xc716('0x3b')]);if(_0x3a1c4d){_0x690dfd[_0xc716('0x13e')]=ut[_0xc716('0x13f')](_0x3a1c4d);_0x690dfd[_0xc716('0x140')]=ut[_0xc716('0x141')](_0x3a1c4d);}var _0x835f7=ut[_0xc716('0x142')](_0x199701,_0x52c897,_0x1a2130,_0x3a1c4d,_0x3ce33f,_0x690dfd);_['merge'](_0x690dfd,ut[_0xc716('0x143')](_0x835f7));_0x690dfd['starttime']=moment()['format'](_0xc716('0x8f'));ami[_0xc716('0x144')](ut[_0xc716('0x145')](_0x690dfd,_0x199701,_0x835f7,_0x690dfd[_0xc716('0xb3')],_0x4d0fc2))['then'](function(_0x1beaff){var _0x54658a=_0x690dfd[_0xc716('0x146')];if(!_['isNil'](_0x54658a)){if(!_['isNil'](_0x1e8773['agents'][_0x54658a])){_0x1e8773[_0xc716('0x19')][_0x54658a][_0xc716('0x147')]=_0x690dfd[_0xc716('0x148')];emit(util['format']('user:%s',_0x1e8773['agents'][_0x54658a][_0xc716('0x2d')]),_0xc716('0x149'),{'destaccountcode':_0x1e8773['agents'][_0x54658a][_0xc716('0x14a')],'destconnectedlinenum':_0x690dfd['calleridnum']});}}_0x199701['originated']+=0x1;logger['info']('[originated][increment]',_0x3ce33f,_0xc716('0xcc'),_0x199701[_0xc716('0x2d')],_0xc716('0x6e'),_0x199701[_0xc716('0x6f')]);_0x39c30f(_0x1beaff);})[_0xc716('0x78')](function(_0x192b6a){ut['logAgent'](_0x690dfd,0xe,_0xc716('0x14b'));rpcDb[_0xc716('0x104')](_0x690dfd,_0xc716('0x14c'));_0x2772fe(_0x192b6a);});});};Preview[_0xc716('0x11')][_0xc716('0x24')]=function(_0x37799c){if(this[_0xc716('0x18')][_0x37799c[_0xc716('0xb4')]]){this[_0xc716('0x18')][_0x37799c[_0xc716('0xb4')]][_0xc716('0x77')]=_0x37799c[_0xc716('0x77')];}};Preview[_0xc716('0x11')][_0xc716('0x1c')]=function(_0x5ad135){var _0x520f80=this;var _0x23445c=this[_0xc716('0x18')][_0x5ad135[_0xc716('0x14d')]];if(_0x23445c){if(_0x23445c['lookAgent']&&this[_0xc716('0x19')][_0x23445c[_0xc716('0x111')]]){ut[_0xc716('0x14e')](_0x23445c,this[_0xc716('0x19')][_0x23445c[_0xc716('0x111')]][_0xc716('0x2d')],this[_0xc716('0x19')][_0x23445c[_0xc716('0x111')]]['id']);}var _0x269e9f=_[_0xc716('0x14f')](_0x23445c);_0x269e9f[_0xc716('0xba')]=moment()['format'](_0xc716('0x8f'));var _0xef3702=_0x520f80[_0xc716('0x15')][_0x23445c[_0xc716('0x6d')]];if(ut[_0xc716('0x150')](_0x5ad135[_0xc716('0x151')])){if(_0x23445c[_0xc716('0xdb')]){rpcDb['unlockContact'](_0x23445c[_0xc716('0xb6')]);}if(_0x23445c[_0xc716('0xb3')]){rpcDb[_0xc716('0x8d')](_0x23445c['idContact']);}ami[_0xc716('0x2b')](_0xc716('0x152'),ut[_0xc716('0xbf')](_0x23445c,_0xc716('0x153'),this[_0xc716('0x15')][_0x23445c['queue']]));this[_0xc716('0x154')](_0x269e9f,_0xef3702,_0x5ad135);}else{_0x23445c[_0xc716('0x8e')]=moment()[_0xc716('0x59')]('YYYY-MM-DD\x20HH:mm:ss');ut['logAgent'](_0x269e9f,0x4,_0xc716('0xc6'));rpcDb['createAgentHistory'](_0x269e9f,_0xc716('0x155'));}}};Preview[_0xc716('0x11')]['syncHangup']=function(_0x3652d4){var _0x234d32=this;var _0x370e21=this[_0xc716('0x18')][_0x3652d4[_0xc716('0xb4')]];var _0x173f2c;if(_0x370e21){_0x173f2c=this[_0xc716('0x15')][_0x370e21['queue']];logger[_0xc716('0x5b')](_0xc716('0x156'),_0x3652d4['linkedid'],_0xc716('0xcc'),_0x173f2c[_0xc716('0x2d')],_0xc716('0x70'),_0x173f2c[_0xc716('0x32')]);}if(this[_0xc716('0x18')][_0x3652d4[_0xc716('0xb4')]]&&_0x3652d4[_0xc716('0xb4')]!==_0x3652d4['uniqueid']){if(_0x3652d4[_0xc716('0x157')]==='16'&&this[_0xc716('0x18')][_0x3652d4['linkedid']][_0xc716('0x7c')]){this['callProgressDetectingCustomer'](_0x3652d4,_0x3652d4[_0xc716('0xb4')],_0x3652d4['cause']);}else if(this[_0xc716('0x18')][_0x3652d4[_0xc716('0xb4')]][_0xc716('0x7c')]){logger[_0xc716('0x5b')](_0xc716('0x158'),_0x3652d4[_0xc716('0xb4')],_0x3652d4[_0xc716('0x157')],_0xc716('0xcc'),_0x173f2c[_0xc716('0x2d')],_0xc716('0x70'),_0x173f2c[_0xc716('0x32')]);this[_0xc716('0xa0')](_0x3652d4,_0x3652d4[_0xc716('0xb4')],_0x3652d4[_0xc716('0x157')]);}}else if(_0x370e21&&_[_0xc716('0x84')](_0x370e21['statedesc'])&&_0x173f2c['dialQueueProject']&&_0x3652d4['linkedid']===_0x3652d4[_0xc716('0xbd')]&&_[_0xc716('0x84')](_0x3652d4[_0xc716('0xff')])&&_0x3652d4[_0xc716('0x157')]==='16'&&_0x3652d4[_0xc716('0x159')]==='6'&&_[_0xc716('0xfe')](_0x370e21[_0xc716('0x15a')])){if(_0x370e21['unlockAgent']){rpcDb['unlockContact'](_0x370e21[_0xc716('0xb6')]);}if(_0x370e21[_0xc716('0xb3')]){rpcDb[_0xc716('0x8d')](_0x370e21[_0xc716('0xb6')]);}_0x3652d4[_0xc716('0xff')]='22';this['callProgressDetectingAgent'](_0x370e21,_0x173f2c,_0x3652d4);}else if(_0x370e21&&_0x370e21[_0xc716('0x15a')]){if(_0x3652d4[_0xc716('0x157')]==='16'&&this[_0xc716('0x18')][_0x3652d4[_0xc716('0xb4')]]['dialAnswer']){logger[_0xc716('0x5b')](_0xc716('0x15b'),_0x3652d4['linkedid'],_0x3652d4[_0xc716('0x157')],_0xc716('0xcc'),_0x173f2c[_0xc716('0x2d')],'pTalking:\x20',_0x173f2c[_0xc716('0x32')]);this['callProgressDetectingCustomer'](_0x3652d4,_0x3652d4[_0xc716('0xb4')],_0x3652d4[_0xc716('0x157')]);}else if(this[_0xc716('0x18')][_0x3652d4[_0xc716('0xb4')]][_0xc716('0x7c')]){logger[_0xc716('0x5b')]('[syncHangup][talking][cause]',_0x3652d4[_0xc716('0xb4')],_0x3652d4['cause'],_0xc716('0xcc'),_0x173f2c[_0xc716('0x2d')],_0xc716('0x70'),_0x173f2c['pTalking']);this[_0xc716('0xa0')](_0x3652d4,_0x3652d4['linkedid'],_0x3652d4[_0xc716('0x157')]);}}};Preview[_0xc716('0x11')][_0xc716('0x22')]=function(_0x1bf99a){if(this[_0xc716('0x18')][_0x1bf99a[_0xc716('0xfc')]]&&_0x1bf99a[_0xc716('0xfc')]!==_0x1bf99a['destuniqueid']){this[_0xc716('0xa0')](_0x1bf99a,_0x1bf99a[_0xc716('0xfc')],_0x1bf99a[_0xc716('0xf3')]);}};Preview['prototype']['syncHangupRequest']=function(_0x2360dd){if(this[_0xc716('0x18')][_0x2360dd['linkedid']]&&_0x2360dd['linkedid']!==_0x2360dd[_0xc716('0xbd')]&&!this['actions'][_0x2360dd[_0xc716('0xb4')]][_0xc716('0x7c')]){if(_0x2360dd[_0xc716('0x157')]==='1'){this[_0xc716('0xa0')](_0x2360dd,_0x2360dd[_0xc716('0xb4')],_0x2360dd[_0xc716('0x157')]);}}};Preview[_0xc716('0x11')][_0xc716('0x15c')]=function(_0x2c7c58,_0x41060b,_0x488822){if(this[_0xc716('0x18')][_0x2c7c58]){if(_[_0xc716('0x84')](this[_0xc716('0x18')][_0x2c7c58][_0xc716('0x15d')])){this[_0xc716('0x18')][_0x2c7c58][_0xc716('0x15d')]={};}this['actions'][_0x2c7c58][_0xc716('0x15d')][_0x41060b]=_0x488822;}};Preview[_0xc716('0x11')][_0xc716('0x26')]=function(_0x5adcaf){try{if(!_['isNil'](_0x5adcaf)){if(ut[_0xc716('0x15e')](_['keys'](_0x5adcaf['variable'])[0x0])){this['addVariable'](_0x5adcaf['uniqueid'],_[_0xc716('0x15f')](_0x5adcaf['variable'])[0x0],_0x5adcaf[_0xc716('0x160')]);}}}catch(_0x30cd4d){logger[_0xc716('0x161')](_0xc716('0x162'),util[_0xc716('0x163')](_0x30cd4d,{'showHidden':![],'depth':null}));}};Preview[_0xc716('0x11')][_0xc716('0x164')]=function(_0x36fb0e){if(_0x36fb0e){if(this[_0xc716('0x18')][_0x36fb0e[_0xc716('0x165')]]){this[_0xc716('0x18')][_0x36fb0e['transfertargetlinkedid']]['transfer']=!![];}}};Preview[_0xc716('0x11')][_0xc716('0x29')]=function(_0x2aef60){if(_0x2aef60){if(this[_0xc716('0x18')][_0x2aef60['transfererlinkedid']]){this[_0xc716('0x18')][_0x2aef60['transfererlinkedid']][_0xc716('0x15a')]=!![];}}};module[_0xc716('0x166')]=Preview; \ No newline at end of file +var _0x9303=['custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','isTrunkReachable','active','SIP/%s','reachable','unmonitored','execRun','unlock','getContactPreview','recallme','validateContact','isValid','[Preview][checkIsBlackList]','Call\x20unsuccessful','Empty\x20Contact','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','campaign\x20Name:\x20','Is\x20Valid','execCall','SIP/%s/%s%s','trim','substring','dialCutDigit','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','extractCalleridName','originatecalleridnum','addVariables','toLowerVariables','variablesAction','channelAgent','destconnectedlinenum','user:%s','accountcode','calleridnum','[originated][increment]','OriginateError','channel','syncOriginateResponse','actionid','logLookAgent','clone','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','statedesc','dialQueueProject','transfer','unlockContact','[syncHangup][talking][transfer]','addVariable','variables','keys','variable','[syncVarSet][Preview]','transfertargetlinkedid','transfererlinkedid','exports','uuid','moment','../../../config/environment','../../../config/logger','preview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','voiceQueues','trunks','agents','clockClearZombieChannels','originateresponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','campaignsPreview','emit','type','outbound','name','strategy','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','total','unmanaged','abandoned','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','originated','erlangCallToSecond','erlangBusyFactor','startPredictive','startProgressive','Trunk','Interval','md5','format','voice:queue:%s','voice_queue:save','info','stringify','voice_queue_channel:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','syncCampaigns','dialMethod','booked','clearZombieChannels','hasOwnProperty','setMessage','recallMe','isNil','[clearZombieChannels][talking]','Queue','actions','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','UserId','VoiceQueueId','ListId','Action','status','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','clearZombieChannel','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','run','logger2','[RecallMe]','disableContact','starttime','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','logCustomer','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','message','AGENTS_NOT_LOGGED','isActive','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','custom:agentnosuchnumber','buildObj','createCustomerHistory','[callProgressDetectingCustomer][logNoSuch]','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','countnosuchnumberretry','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','sumDuration','talktime','[syncHangup][talking][decrement]','uniqueid','BUSY','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','verifyAdditionalPhones','Global','dialBusyMaxRetry','dialBusyRetryFrequency','unlockAgent','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','dialNoAnswerRetryFrequency','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','CANCEL','AgentReject','custom:agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','dialAgentRejectMaxRetry','ABANDONED','countabandonedretry','dialAbandonedMaxRety','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','[callProgressDetectingCustomer][machine]','[default]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','resolve','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','[Preview][execCall][success]','Queue:\x20'];(function(_0x2997a0,_0x347897){var _0x18c4ab=function(_0xff9c53){while(--_0xff9c53){_0x2997a0['push'](_0x2997a0['shift']());}};_0x18c4ab(++_0x347897);}(_0x9303,0x1b5));var _0x3930=function(_0x52e251,_0x3b6303){_0x52e251=_0x52e251-0x0;var _0x5eee63=_0x9303[_0x52e251];return _0x5eee63;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0x3930('0x0'));var moment=require(_0x3930('0x1'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x3930('0x2'));var logger=require(_0x3930('0x3'))(_0x3930('0x4'));var loggerAction=require(_0x3930('0x3'))('actionPreview');var ami=require(_0x3930('0x5'));var rpcDb=require(_0x3930('0x6'));var cmHopperAdditionalPhone=require(_0x3930('0x7'));var Action=require(_0x3930('0x8'));var ut=require(_0x3930('0x9'));config[_0x3930('0xa')]=_[_0x3930('0xb')](config[_0x3930('0xa')],{'host':_0x3930('0xc'),'port':0x18eb});var io=require(_0x3930('0xd'))(new Redis(config[_0x3930('0xa')]));var Sequence=function(){};Sequence[_0x3930('0xe')][_0x3930('0xf')]=function(_0x6e6580){this[_0x3930('0x10')]=this[_0x3930('0x10')]?this[_0x3930('0x10')][_0x3930('0x11')](_0x6e6580):_0x6e6580();};function Preview(_0x1f6537){this[_0x3930('0x12')]=new Sequence();this['campaignsPreview']=_0x1f6537[_0x3930('0x13')];this[_0x3930('0x14')]=_0x1f6537[_0x3930('0x14')];this['actions']={};this[_0x3930('0x15')]=_0x1f6537[_0x3930('0x15')];this[_0x3930('0x16')]=0x0;ami['on'](_0x3930('0x17'),this['syncOriginateResponse'][_0x3930('0x18')](this));ami['on'](_0x3930('0x19'),this[_0x3930('0x1a')]['bind'](this));ami['on'](_0x3930('0x1b'),this[_0x3930('0x1c')][_0x3930('0x18')](this));ami['on']('dialend',this[_0x3930('0x1d')]['bind'](this));ami['on'](_0x3930('0x1e'),this[_0x3930('0x1f')][_0x3930('0x18')](this));ami['on'](_0x3930('0x20'),this[_0x3930('0x21')]['bind'](this));ami['on'](_0x3930('0x22'),this[_0x3930('0x23')][_0x3930('0x18')](this));ami['on'](_0x3930('0x24'),this[_0x3930('0x25')]['bind'](this));this[_0x3930('0x26')](this[_0x3930('0x27')]);}function emit(_0xff6948,_0x5b827e,_0x5890b3){io['to'](_0xff6948)[_0x3930('0x28')](_0x5b827e,_0x5890b3);}function emitCampaignPreview(_0x4027ae){if(_0x4027ae[_0x3930('0x29')]===_0x3930('0x2a')){var _0x8b25f2={'id':_0x4027ae['id'],'name':_0x4027ae[_0x3930('0x2b')],'strategy':_0x4027ae[_0x3930('0x2c')],'answered':_0x4027ae[_0x3930('0x2d')],'available':_0x4027ae[_0x3930('0x2e')],'loggedIn':_0x4027ae[_0x3930('0x2f')],'pTalking':_0x4027ae[_0x3930('0x30')],'sumBillable':_0x4027ae[_0x3930('0x31')],'sumDuration':_0x4027ae['sumDuration'],'sumHoldTime':_0x4027ae[_0x3930('0x32')]||0x0,'talking':_0x4027ae[_0x3930('0x33')],'total':_0x4027ae[_0x3930('0x34')],'type':_0x4027ae[_0x3930('0x29')],'unmanaged':_0x4027ae[_0x3930('0x35')],'abandoned':_0x4027ae[_0x3930('0x36')],'waiting':_0x4027ae['waiting'],'loggedInDb':_0x4027ae[_0x3930('0x37')],'dialActive':_0x4027ae[_0x3930('0x38')],'dialMethod':_0x4027ae['dialMethod'],'dialOriginateCallerIdName':_0x4027ae[_0x3930('0x39')],'dialOriginateCallerIdNumber':_0x4027ae['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x4027ae[_0x3930('0x3a')],'dialPrefix':_0x4027ae[_0x3930('0x3b')],'outboundAnswerAgiCallsDay':_0x4027ae[_0x3930('0x3c')],'outboundAnswerCallsDay':_0x4027ae[_0x3930('0x3d')],'outboundBlacklistCallsDay':_0x4027ae[_0x3930('0x3e')],'outboundBusyCallsDay':_0x4027ae[_0x3930('0x3f')],'outboundCongestionCallsDay':_0x4027ae[_0x3930('0x40')],'outboundDropCallsDayACS':_0x4027ae[_0x3930('0x41')],'outboundDropCallsDayCallersExit':_0x4027ae[_0x3930('0x42')],'outboundDropCallsDayTimeout':_0x4027ae[_0x3930('0x43')],'outboundNoAnswerCallsDay':_0x4027ae['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x4027ae[_0x3930('0x44')],'outboundOriginateFailureCallsDay':_0x4027ae[_0x3930('0x45')],'outboundReCallsDay':_0x4027ae[_0x3930('0x46')],'outboundRejectCallsDay':_0x4027ae[_0x3930('0x47')],'outboundUnknownCallsDay':_0x4027ae['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x4027ae['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x4027ae['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x4027ae[_0x3930('0x48')],'predictiveIntervalAvgTalktime':_0x4027ae['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x4027ae['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x4027ae[_0x3930('0x49')],'predictiveIntervalErlangCalls':_0x4027ae[_0x3930('0x4a')],'predictiveIntervalErlangCallsDroppedCalls':_0x4027ae['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x4027ae['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x4027ae[_0x3930('0x4b')],'predictiveIntervalPauses':_0x4027ae[_0x3930('0x4c')],'predictiveIntervalAvailable':_0x4027ae[_0x3930('0x4d')],'predictiveIntervalTotalCalls':_0x4027ae['predictiveIntervalTotalCalls'],'message':_0x4027ae['message'],'originated':_0x4027ae[_0x3930('0x4e')],'erlangCalls':_0x4027ae['erlangCalls'],'erlangCallToSecond':_0x4027ae[_0x3930('0x4f')],'erlangAbandonmentRate':_0x4027ae['erlangAbandonmentRate'],'erlangBusyFactor':_0x4027ae[_0x3930('0x50')],'startPredictive':_0x4027ae[_0x3930('0x51')],'startProgressive':_0x4027ae[_0x3930('0x52')]};if(_0x4027ae[_0x3930('0x53')]){_0x8b25f2['Trunk']={'id':_0x4027ae[_0x3930('0x53')]['id'],'name':_0x4027ae[_0x3930('0x53')][_0x3930('0x2b')],'active':_0x4027ae[_0x3930('0x53')]['active'],'callerid':_0x4027ae[_0x3930('0x53')]['callerid']};}if(_0x4027ae[_0x3930('0x54')]){_0x8b25f2['Interval']={'id':_0x4027ae[_0x3930('0x54')]['id'],'name':_0x4027ae[_0x3930('0x54')][_0x3930('0x2b')]};}var _0xd47c3b=md5(JSON['stringify'](_0x8b25f2));if(_0x4027ae[_0x3930('0x55')]!==_0xd47c3b){_0x4027ae[_0x3930('0x55')]=_0xd47c3b;emit(util[_0x3930('0x56')](_0x3930('0x57'),_0x8b25f2[_0x3930('0x2b')]),_0x3930('0x58'),_0x8b25f2);}}}function emitVoiceQueueChannelRemove(_0x5ea7c1){logger[_0x3930('0x59')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x3930('0x5a')](_0x5ea7c1));emit(util[_0x3930('0x56')](_0x3930('0x57'),_0x5ea7c1[_0x3930('0x2b')]),_0x3930('0x5b'),_0x5ea7c1);io[_0x3930('0x28')]('voice_queue_presence:remove',_0x5ea7c1);}function notSendMessagesQueue(_0xef0540){if(_0xef0540[_0x3930('0x5c')]){if(_0xef0540[_0x3930('0x4e')]===0x0&&_0xef0540[_0x3930('0x30')]===0x0){_0xef0540['sendMessageOneNotActive']=![];_0xef0540[_0x3930('0x2e')]=0x0;_0xef0540[_0x3930('0x5d')]=0x0;_0xef0540['message']=_0x3930('0x5e');ut[_0x3930('0x5f')](_0x3930('0x60'),_0xef0540[_0x3930('0x2b')]+_0x3930('0x61'));}else{_0xef0540['message']=_0x3930('0x62');ut[_0x3930('0x5f')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0xef0540[_0x3930('0x2b')]+'\x20is\x20disactive');}emitCampaignPreview(_0xef0540);}}Preview[_0x3930('0xe')][_0x3930('0x26')]=function(){var _0x26446a=this;setInterval(function(){_0x26446a[_0x3930('0x63')]();},0x7cf);};Preview[_0x3930('0xe')][_0x3930('0x63')]=function(){var _0x55bdf0=this['campaignsPreview'];this[_0x3930('0x16')]+=0x1;for(var _0x26cae0 in _0x55bdf0){if(_0x55bdf0['hasOwnProperty'](_0x26cae0)&&(_0x55bdf0[_0x26cae0][_0x3930('0x64')]===_0x3930('0x4')||_0x55bdf0[_0x26cae0][_0x3930('0x64')]===_0x3930('0x65'))&&_0x55bdf0[_0x26cae0][_0x3930('0x29')]===_0x3930('0x2a')){if(this['clockClearZombieChannels']>0x7){this[_0x3930('0x16')]=0x0;this[_0x3930('0x66')]();}}if(_0x55bdf0[_0x3930('0x67')](_0x26cae0)&&_0x55bdf0[_0x26cae0]['dialMethod']===_0x3930('0x4')&&_0x55bdf0[_0x26cae0][_0x3930('0x29')]===_0x3930('0x2a')){if(_0x55bdf0[_0x26cae0][_0x3930('0x38')]){this[_0x3930('0x68')](_0x55bdf0[_0x26cae0]);this[_0x3930('0x69')](_0x55bdf0[_0x26cae0]);}else{notSendMessagesQueue(_0x55bdf0[_0x26cae0]);}}}};Preview['prototype']['clearZombieChannel']=function(_0x35f131){var _0x3e35d0=this;this[_0x3930('0x12')][_0x3930('0xf')](function(){if(!_[_0x3930('0x6a')](_0x3e35d0['actions'][_0x35f131])){loggerAction[_0x3930('0x59')](_0x3930('0x6b'),_0x35f131,_0x3930('0x6c'),_0x3e35d0[_0x3930('0x6d')][_0x35f131][_0x3930('0x6e')],_0x3930('0x6f'),JSON[_0x3930('0x5a')](_0x3e35d0[_0x3930('0x27')][_0x3e35d0[_0x3930('0x6d')][_0x35f131]['queue']][_0x3930('0x4e')]),_0x3930('0x70'),JSON[_0x3930('0x5a')](_0x3e35d0['campaignsPreview'][_0x3e35d0[_0x3930('0x6d')][_0x35f131][_0x3930('0x6e')]]['pTalking']),JSON[_0x3930('0x5a')](_0x3e35d0[_0x3930('0x6d')][_0x35f131][_0x3930('0x71')]),JSON[_0x3930('0x5a')](_[_0x3930('0x72')](_0x3e35d0[_0x3930('0x6d')][_0x35f131],['contactId',_0x3930('0x73'),_0x3930('0x74'),_0x3930('0x75')])));return ami[_0x3930('0x76')]({'action':_0x3930('0x77'),'channel':_0x3e35d0['actions'][_0x35f131]['channel']})[_0x3930('0x78')](function(_0x2b1774){if(_0x2b1774['message']===_0x3930('0x79')){setTimeout(function(){if(_0x3e35d0['actions'][_0x35f131]){ut[_0x3930('0x7a')](_0x3e35d0['campaignsPreview'][_0x3e35d0[_0x3930('0x6d')][_0x35f131][_0x3930('0x6e')]],_0x3930('0x7b'));if(_0x3e35d0[_0x3930('0x6d')][_0x35f131][_0x3930('0x71')]===!![]){ut[_0x3930('0x7c')](_0x3e35d0[_0x3930('0x27')][_0x3e35d0['actions'][_0x35f131][_0x3930('0x6e')]],_0x3930('0x7b'));ut[_0x3930('0x7d')]('[Dialer][checkChannel][pTalking][Preview]'+_0x35f131,_0x3e35d0[_0x3930('0x6d')][_0x35f131][_0x3930('0x6e')]);}ut[_0x3930('0x7d')](_0x3930('0x7e')+_0x35f131,_0x3e35d0[_0x3930('0x6d')][_0x35f131][_0x3930('0x6e')]);delete _0x3e35d0['actions'][_0x35f131];}},0x2328);}});}});};Preview[_0x3930('0xe')]['clearZombieChannels']=function(){var _0xfef214=this;loggerAction[_0x3930('0x59')]('[action]',_['size'](this['actions']));for(var _0x4e3f71 in this[_0x3930('0x6d')]){if(_0xfef214['actions'][_0x3930('0x67')](_0x4e3f71)){_0xfef214[_0x3930('0x7f')](_0x4e3f71);}}};Preview[_0x3930('0xe')][_0x3930('0x69')]=function(_0x5236a3){var _0x627eb6=this;rpcDb[_0x3930('0x80')](_0x5236a3['id'],ut[_0x3930('0x81')](this[_0x3930('0x15')]))[_0x3930('0x82')](function(_0x272f21){if(!_['isNil'](_0x272f21)){for(var _0x5f4961=0x0;_0x5f4961<_0x272f21[_0x3930('0x83')];_0x5f4961+=0x1){if(ut[_0x3930('0x84')](_0x272f21[_0x5f4961][_0x3930('0x85')])<_0x5236a3[_0x3930('0x86')]*0x3c){if(_0x272f21[_0x5f4961][_0x3930('0x87')]&&!_0x272f21[_0x5f4961][_0x3930('0x87')]['voicePause']){_0x627eb6[_0x3930('0x88')](_0x272f21[_0x5f4961]['id'])[_0x3930('0x82')](ut[_0x3930('0x89')](_0x3930('0x8a')))[_0x3930('0x78')](ut[_0x3930('0x89')](_0x3930('0x8a')));}else{rpcDb[_0x3930('0x8b')](_0x272f21[_0x5f4961]['id']);}}else{var _0x5d38dd=new Action(_0x272f21[_0x5f4961],_0x5236a3);_0x5d38dd[_0x3930('0x8c')]=moment()[_0x3930('0x56')]('YYYY-MM-DD\x20HH:mm:ss');_0x5236a3[_0x3930('0x46')]+=0x1;ut['logCustomer'](_0x5d38dd,0x17,_0x3930('0x8d'));if(_0x5236a3[_0x3930('0x8e')]){rpcDb[_0x3930('0x8f')](ut[_0x3930('0x90')](_0x272f21[_0x5f4961]));rpcDb['createCustomerHistory'](_0x5d38dd,_0x3930('0x91'));}else{ut[_0x3930('0x92')](_0x5d38dd,0x16,_0x3930('0x93'));rpcDb['createCustomerHistory'](_0x5d38dd,_0x3930('0x94'));rpcDb[_0x3930('0x95')](_0x5d38dd,'[HistoryRecallClose]');}}}}})[_0x3930('0x78')](ut[_0x3930('0x89')](_0x3930('0x96')));};Preview[_0x3930('0xe')][_0x3930('0x68')]=function(_0x30f2be){_0x30f2be['sendMessageOneNotActive']=!![];if(ut[_0x3930('0x97')](_0x30f2be[_0x3930('0x2f')])){_0x30f2be[_0x3930('0x98')]=_0x3930('0x99');}else if(!ut[_0x3930('0x9a')](_0x30f2be[_0x3930('0x38')])){_0x30f2be[_0x3930('0x98')]=_0x3930('0x5e');}else if(!this['isTrunkReachable'](_0x30f2be[_0x3930('0x53')])){if(!this['isTrunkReachable'](_0x30f2be['TrunkBackup'])){_0x30f2be[_0x3930('0x98')]=_0x3930('0x9b');}else{_0x30f2be[_0x3930('0x98')]=_0x3930('0x9c');}}else{_0x30f2be['message']=_0x3930('0x9c');}emitCampaignPreview(_0x30f2be);};Preview[_0x3930('0xe')][_0x3930('0x9d')]=function(_0x553e98,_0x29f25b,_0x1d3ab1){var _0x144535=this;var _0x394b69=this[_0x3930('0x6d')][_0x29f25b];var _0x1566ae=this[_0x3930('0x27')][_0x394b69[_0x3930('0x6e')]];var _0x32f81a;var _0xf339a7=![];var _0x36f1ef=0x2;var _0x5b7219=0x3;if(_0x1566ae){switch(_0x1d3ab1){case'1':_0x1566ae[_0x3930('0x44')]+=0x1;_0x394b69['countnosuchnumberretry']+=0x1;_0x394b69[_0x3930('0x9e')]=ut[_0x3930('0x9f')](_0x394b69);ut[_0x3930('0x92')](_0x394b69,0x0,'NoSuchNumber');ami['emit'](_0x3930('0xa0'),ut[_0x3930('0xa1')](_0x394b69,'nosuchnumber'));rpcDb[_0x3930('0xa2')](_0x394b69,_0x3930('0xa3'));_0x144535['verifyAdditionalPhones'](_0x394b69,'0',_0x1566ae)[_0x3930('0x82')](function(_0x190e07){_0xf339a7=_0x190e07[_0x3930('0xa4')]==0x1;_0x36f1ef=_0x1566ae[_0x3930('0xa5')];_0x5b7219=_0x1566ae[_0x3930('0xa6')];if(!_0xf339a7){if(ut['totalGlobal'](_0x394b69)>=_0x1566ae[_0x3930('0xa7')]){_0x32f81a=ut[_0x3930('0xa8')](_0x394b69,0xf,'Global');rpcDb['createCustomerFinal'](_0x32f81a,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x394b69['countnosuchnumberretry']>=_0x1566ae['dialNoSuchNumberMaxRetry']){rpcDb[_0x3930('0x95')](_0x394b69,_0x3930('0xa9'));}else{rpcDb[_0x3930('0xaa')](ut[_0x3930('0xab')](_0x394b69,_0x3930('0xac'),_0x1566ae[_0x3930('0xa5')]),_0x394b69['unlockAgent'],_0x394b69[_0x3930('0xad')]);}}delete this[_0x3930('0x6d')][_0x553e98[_0x3930('0xae')]];}else{_0x394b69[_0x3930('0xac')]++;logger[_0x3930('0x59')](_0x3930('0xaf'),_0x394b69['countnosuchnumberretry']);logger[_0x3930('0x59')]('id',_0x394b69[_0x3930('0xb0')]);_0x144535[_0x3930('0xb1')]({'id':_0x394b69[_0x3930('0xb0')],'field':{'countnosuchnumberretry':_0x394b69[_0x3930('0xac')]}})[_0x3930('0x82')](function(){_0x144535[_0x3930('0xb2')](_0x394b69,_0x36f1ef,_0x5b7219)[_0x3930('0x82')](function(){});});}});break;case _0x3930('0xb3'):var _0x1ac02b=moment()[_0x3930('0x56')](_0x3930('0xb4'));_0x394b69[_0x3930('0xb5')]=_0x1ac02b;_0x394b69[_0x3930('0xb6')]=_0x1ac02b;_0x394b69[_0x3930('0x71')]=!![];_0x1566ae[_0x3930('0x30')]+=0x1;logger[_0x3930('0x59')](_0x3930('0xb7'),_0x394b69['uniqueid'],_0x3930('0xb8'),_0x1566ae['name'],_0x3930('0x70'),_0x1566ae[_0x3930('0x30')]);ami[_0x3930('0x28')](_0x3930('0xb9'),ut[_0x3930('0xa1')](_0x394b69,_0x3930('0xba'),this[_0x3930('0x27')][_0x394b69[_0x3930('0x6e')]]));if(_0x1566ae[_0x3930('0xbb')]){ami[_0x3930('0x28')](_0x3930('0xbc'),ut[_0x3930('0xbd')](_0x394b69));}break;case'16':ami[_0x3930('0x28')](_0x3930('0xbe'),ut[_0x3930('0xa1')](_0x394b69,_0x3930('0xbf'),this[_0x3930('0x27')][_0x394b69[_0x3930('0x6e')]]));emitVoiceQueueChannelRemove(ut[_0x3930('0xa1')](_0x394b69,_0x3930('0xbf')));_0x1566ae[_0x3930('0x3d')]+=0x1;_0x1566ae[_0x3930('0x34')]+=0x1;_0x1566ae[_0x3930('0x2d')]+=0x1;ut[_0x3930('0x7c')](_0x1566ae,_0x3930('0xc0'));_0x394b69['countglobal']=ut['totalGlobal'](_0x394b69);ut[_0x3930('0x92')](_0x394b69,0x4,_0x3930('0xc1'));rpcDb['createCustomerHistory'](_0x394b69,_0x3930('0xc2'));rpcDb[_0x3930('0x95')](_0x394b69,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x3930('0xc3')](_0x394b69);_0x1566ae[_0x3930('0xc4')]+=_0x394b69[_0x3930('0xc5')];_0x1566ae[_0x3930('0x31')]+=_0x394b69[_0x3930('0xc5')];logger['info'](_0x3930('0xc6'),_0x394b69[_0x3930('0xc7')],_0x3930('0xb8'),_0x1566ae[_0x3930('0x2b')],_0x3930('0x70'),_0x1566ae[_0x3930('0x30')]);delete this[_0x3930('0x6d')][_0x553e98['linkedid']];break;case _0x3930('0xc8'):_0x1566ae[_0x3930('0x3f')]+=0x1;_0x394b69[_0x3930('0xc9')]+=0x1;_0x394b69[_0x3930('0x9e')]=ut[_0x3930('0x9f')](_0x394b69);ut[_0x3930('0x92')](_0x394b69,0x5,_0x3930('0xca'));_0x36f1ef=_0x1566ae['dialBusyRetryFrequency'];_0x5b7219=_0x1566ae[_0x3930('0xa6')];ami[_0x3930('0x28')](_0x3930('0xcb'),ut[_0x3930('0xa1')](_0x394b69,_0x3930('0xcc')));rpcDb[_0x3930('0xa2')](_0x394b69,_0x3930('0xcd'));_0x144535[_0x3930('0xce')](_0x394b69,'5',_0x1566ae)[_0x3930('0x82')](function(_0x52566e){_0xf339a7=_0x52566e[_0x3930('0xa4')]==0x1;if(!_0xf339a7){if(ut[_0x3930('0x9f')](_0x394b69)>=_0x1566ae[_0x3930('0xa7')]){_0x32f81a=ut[_0x3930('0xa8')](_0x394b69,0xf,_0x3930('0xcf'));rpcDb[_0x3930('0x95')](_0x32f81a,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x394b69[_0x3930('0xc9')]>=_0x1566ae[_0x3930('0xd0')]){rpcDb[_0x3930('0x95')](_0x394b69,_0x3930('0xcd'));}else{rpcDb[_0x3930('0xaa')](ut[_0x3930('0xab')](_0x394b69,'countbusyretry',_0x1566ae[_0x3930('0xd1')]),_0x394b69[_0x3930('0xd2')],_0x394b69[_0x3930('0xad')]);}}}else{_0x394b69[_0x3930('0xc9')]++;_0x144535[_0x3930('0xb1')]({'id':_0x394b69['idContact'],'field':{'countbusyretry':_0x394b69['countbusyretry']}})['then'](function(){_0x144535[_0x3930('0xb2')](_0x394b69,_0x36f1ef,_0x5b7219)['then'](function(){});});}});break;case _0x3930('0xd3'):_0x1566ae[_0x3930('0xd4')]+=0x1;_0x394b69[_0x3930('0xd5')]+=0x1;_0x394b69[_0x3930('0x9e')]=ut[_0x3930('0x9f')](_0x394b69);ut[_0x3930('0x92')](_0x394b69,0x3,'NoAnswer');_0x36f1ef=_0x1566ae[_0x3930('0xd6')];_0x5b7219=_0x1566ae[_0x3930('0xa6')];ami['emit'](_0x3930('0xd7'),ut[_0x3930('0xa1')](_0x394b69,_0x3930('0xd8')));rpcDb[_0x3930('0xa2')](_0x394b69,_0x3930('0xd9'));_0x144535[_0x3930('0xce')](_0x394b69,'3',_0x1566ae)['then'](function(_0xd48e2b){_0xf339a7=_0xd48e2b['additional']==0x1;if(!_0xf339a7){if(ut[_0x3930('0x9f')](_0x394b69)>=_0x1566ae['dialGlobalMaxRetry']){_0x32f81a=ut[_0x3930('0xa8')](_0x394b69,0xf,_0x3930('0xcf'));rpcDb[_0x3930('0x95')](_0x32f81a,_0x3930('0xda'));}else{if(_0x394b69['countnoanswerretry']>=_0x1566ae[_0x3930('0xdb')]){rpcDb['createCustomerFinal'](_0x394b69,_0x3930('0xd9'));}else{rpcDb[_0x3930('0xaa')](ut[_0x3930('0xab')](_0x394b69,_0x3930('0xd5'),_0x1566ae[_0x3930('0xd6')]),_0x394b69[_0x3930('0xd2')],_0x394b69[_0x3930('0xad')]);}}}else{_0x394b69[_0x3930('0xd5')]++;_0x144535['incrementPreviewCounters']({'id':_0x394b69[_0x3930('0xb0')],'field':{'countnoanswerretry':_0x394b69[_0x3930('0xd5')]}})[_0x3930('0x82')](function(){_0x144535['swapAdditionalPhones'](_0x394b69,_0x36f1ef,_0x5b7219)[_0x3930('0x82')](function(){});});}});break;case _0x3930('0xdc'):_0x1566ae[_0x3930('0x40')]+=0x1;_0x394b69[_0x3930('0xdd')]+=0x1;_0x394b69[_0x3930('0x9e')]=ut[_0x3930('0x9f')](_0x394b69);ut[_0x3930('0x92')](_0x394b69,0x8,_0x3930('0xde'));_0x36f1ef=_0x1566ae[_0x3930('0xdf')];_0x5b7219=_0x1566ae[_0x3930('0xa6')];ami[_0x3930('0x28')](_0x3930('0xe0'),ut['buildObj'](_0x394b69,_0x3930('0xe1')));rpcDb[_0x3930('0xa2')](_0x394b69,'[callProgressDetectingCustomer][logCongestion]');_0x144535['verifyAdditionalPhones'](_0x394b69,'8',_0x1566ae)[_0x3930('0x82')](function(_0x48fad6){_0xf339a7=_0x48fad6[_0x3930('0xa4')]==0x1;if(!_0xf339a7){if(ut[_0x3930('0x9f')](_0x394b69)>=_0x1566ae['dialGlobalMaxRetry']){_0x32f81a=ut['cloneAction'](_0x394b69,0xf,'Global');rpcDb[_0x3930('0x95')](_0x32f81a,_0x3930('0xe2'));}else{if(_0x394b69['countcongestionretry']>=_0x1566ae[_0x3930('0xe3')]){rpcDb[_0x3930('0x95')](_0x394b69,_0x3930('0xe4'));}else{rpcDb[_0x3930('0xaa')](ut['scheduledAt'](_0x394b69,_0x3930('0xdd'),_0x1566ae['dialBusyRetryFrequency']),_0x394b69[_0x3930('0xd2')],_0x394b69['activeContact']);}}}else{_0x394b69[_0x3930('0xdd')]++;_0x144535['incrementPreviewCounters']({'id':_0x394b69[_0x3930('0xb0')],'field':{'countcongestionretry':_0x394b69[_0x3930('0xdd')]}})[_0x3930('0x82')](function(){_0x144535['swapAdditionalPhones'](_0x394b69,_0x36f1ef,_0x5b7219)[_0x3930('0x82')](function(){});});}});break;case _0x3930('0xe5'):_0x1566ae['outboundRejectCallsDay']+=0x1;_0x394b69['countagentrejectretry']+=0x1;_0x394b69[_0x3930('0x9e')]=ut[_0x3930('0x9f')](_0x394b69);ut[_0x3930('0x92')](_0x394b69,0x14,_0x3930('0xe6'));_0x36f1ef=_0x1566ae['dialAgentRejectRetryFrequency'];_0x5b7219=_0x1566ae[_0x3930('0xa6')];ami[_0x3930('0x28')](_0x3930('0xe7'),ut[_0x3930('0xa1')](_0x394b69,'agentreject'));rpcDb[_0x3930('0xa2')](_0x394b69,_0x3930('0xe8'));_0x144535[_0x3930('0xce')](_0x394b69,'20',_0x1566ae)[_0x3930('0x82')](function(_0x1cb520){_0xf339a7=_0x1cb520['additional']==0x1;if(!_0xf339a7){if(ut[_0x3930('0x9f')](_0x394b69)>=_0x1566ae[_0x3930('0xa7')]){_0x32f81a=ut[_0x3930('0xa8')](_0x394b69,0x14,_0x3930('0xe6'));rpcDb[_0x3930('0x95')](_0x32f81a,_0x3930('0xe9'));}else{if(_0x394b69[_0x3930('0xea')]>=_0x1566ae[_0x3930('0xeb')]){rpcDb[_0x3930('0x95')](_0x394b69,_0x3930('0xe9'));}else{rpcDb[_0x3930('0xaa')](ut['scheduledAt'](_0x394b69,_0x3930('0xea'),_0x1566ae['dialAgentRejectRetryFrequency']),_0x394b69[_0x3930('0xd2')],_0x394b69[_0x3930('0xad')]);}}}else{_0x394b69[_0x3930('0xd5')]++;_0x144535[_0x3930('0xb1')]({'id':_0x394b69['idContact'],'field':{'countnoanswerretry':_0x394b69[_0x3930('0xd5')]}})[_0x3930('0x82')](function(){_0x144535[_0x3930('0xb2')](_0x394b69,_0x36f1ef,_0x5b7219)[_0x3930('0x82')](function(){});});}});break;case _0x3930('0xec'):_0x1566ae['outboundAbandonedCallsDay']+=0x1;_0x394b69[_0x3930('0xed')]+=0x1;_0x394b69['countglobal']=ut[_0x3930('0x9f')](_0x394b69);ut['logCustomer'](_0x394b69,0xb,'Abandoned');rpcDb['createCustomerHistory'](_0x394b69,'[callProgressDetectingCustomer][logAbandoned]');_0x144535[_0x3930('0xce')](_0x394b69,'11',_0x1566ae)[_0x3930('0x82')](function(_0x387386){_0xf339a7=_0x387386[_0x3930('0xa4')]==0x1;if(!_0xf339a7){if(ut['totalGlobal'](_0x394b69)>=_0x1566ae[_0x3930('0xa7')]){_0x32f81a=ut[_0x3930('0xa8')](_0x394b69,0xf,'Global');rpcDb[_0x3930('0x95')](_0x32f81a,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x394b69['countabandonedetry']>=_0x1566ae[_0x3930('0xee')]){rpcDb[_0x3930('0x95')](_0x394b69,_0x3930('0xef'));}else{rpcDb[_0x3930('0xaa')](ut[_0x3930('0xab')](_0x394b69,_0x3930('0xed'),_0x1566ae[_0x3930('0xf0')]),_0x394b69[_0x3930('0xd2')],_0x394b69[_0x3930('0xad')]);}}}else{_0x394b69['countnoanswerretry']++;_0x144535[_0x3930('0xb1')]({'id':_0x394b69[_0x3930('0xb0')],'field':{'countnoanswerretry':_0x394b69[_0x3930('0xd5')]}})[_0x3930('0x82')](function(){_0x144535['swapAdditionalPhones'](_0x394b69,_0x36f1ef,_0x5b7219)[_0x3930('0x82')](function(){});});}});break;case'18':_0x1566ae['outboundUnknownCallsDay']+=0x1;_0x394b69[_0x3930('0xf1')]+=0x1;_0x394b69[_0x3930('0x9e')]=ut[_0x3930('0x9f')](_0x394b69);ut[_0x3930('0x92')](_0x394b69,0x12,_0x553e98[_0x3930('0xf2')]||_0x553e98[_0x3930('0xf3')]);ami[_0x3930('0x28')](_0x3930('0xf4'),ut[_0x3930('0xa1')](_0x394b69,_0x3930('0xf5')));rpcDb[_0x3930('0xa2')](_0x394b69,_0x3930('0xf6'));_0x144535[_0x3930('0xce')](_0x394b69,'18',_0x1566ae)[_0x3930('0x82')](function(_0x14e9c6){_0xf339a7=_0x14e9c6[_0x3930('0xa4')]==0x1;if(!_0xf339a7){if(ut[_0x3930('0x9f')](_0x394b69)>=_0x1566ae['dialGlobalMaxRetry']){_0x32f81a=ut[_0x3930('0xa8')](_0x394b69,0x12,'Global');rpcDb[_0x3930('0x95')](_0x32f81a,_0x3930('0xf6'));}else{rpcDb[_0x3930('0x95')](_0x394b69,'[callProgressDetectingCustomer][hangupInAMD]');}}else{_0x394b69['countnoanswerretry']++;_0x144535['incrementPreviewCounters']({'id':_0x394b69[_0x3930('0xb0')],'field':{'countnoanswerretry':_0x394b69[_0x3930('0xd5')]}})[_0x3930('0x82')](function(){_0x144535['swapAdditionalPhones'](_0x394b69,_0x36f1ef,_0x5b7219)['then'](function(){});});}});delete this[_0x3930('0x6d')][_0x553e98[_0x3930('0xae')]];break;case'19':_0x1566ae[_0x3930('0xf7')]+=0x1;_0x394b69[_0x3930('0x9e')]=ut['totalGlobal'](_0x394b69);ut[_0x3930('0x92')](_0x394b69,0x13,_0x553e98[_0x3930('0xf2')]||_0x553e98[_0x3930('0xf3')]);ami[_0x3930('0x28')](_0x3930('0xf4'),ut['buildObj'](_0x394b69,'amd'));rpcDb['createCustomerHistory'](_0x394b69,_0x3930('0xf8'));_0x144535[_0x3930('0xce')](_0x394b69,'18',_0x1566ae)[_0x3930('0x82')](function(_0x173a33){_0xf339a7=_0x173a33['additional']==0x1;if(!_0xf339a7){if(ut[_0x3930('0x9f')](_0x394b69)>=_0x1566ae[_0x3930('0xa7')]){_0x32f81a=ut[_0x3930('0xa8')](_0x394b69,0xf,_0x3930('0xcf'));rpcDb[_0x3930('0x95')](_0x32f81a,_0x3930('0xf8'));}else{rpcDb['createCustomerFinal'](_0x394b69,_0x3930('0xf8'));}}else{_0x394b69[_0x3930('0xd5')]++;_0x144535[_0x3930('0xb1')]({'id':_0x394b69[_0x3930('0xb0')],'field':{'countnoanswerretry':_0x394b69[_0x3930('0xd5')]}})[_0x3930('0x82')](function(){_0x144535[_0x3930('0xb2')](_0x394b69,_0x36f1ef,_0x5b7219)[_0x3930('0x82')](function(){});});}});delete this[_0x3930('0x6d')][_0x553e98[_0x3930('0xae')]];break;default:if(_0x394b69['dialAnswer']){ut[_0x3930('0x7c')](_0x1566ae,_0x3930('0xf9'));ut[_0x3930('0x7d')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x1566ae[_0x3930('0x2b')],_0x553e98);}_0x1566ae[_0x3930('0xf7')]+=0x1;_0x394b69[_0x3930('0x9e')]=ut[_0x3930('0x9f')](_0x394b69);ut[_0x3930('0x92')](_0x394b69,0xc,_0x553e98[_0x3930('0xf2')]||_0x553e98[_0x3930('0xf3')]);_0x36f1ef=_0x1566ae['dialAgentRejectRetryFrequency'];_0x5b7219=_0x1566ae[_0x3930('0xa6')];rpcDb['createCustomerHistory'](_0x394b69,_0x3930('0xfa'));_0x144535[_0x3930('0xce')](_0x394b69,'20',_0x1566ae)['then'](function(_0x236fcf){_0xf339a7=_0x236fcf[_0x3930('0xa4')]==0x1;if(!_0xf339a7){if(ut[_0x3930('0x9f')](_0x394b69)>=_0x1566ae[_0x3930('0xa7')]){_0x32f81a=ut[_0x3930('0xa8')](_0x394b69,0xf,_0x3930('0xcf'));rpcDb[_0x3930('0x95')](_0x32f81a,_0x3930('0xfb'));}else{rpcDb[_0x3930('0x95')](_0x394b69,_0x3930('0xfb'));}delete this[_0x3930('0x6d')][_0x553e98[_0x3930('0xae')]];}else{_0x144535[_0x3930('0xb2')](_0x394b69,_0x36f1ef,_0x5b7219)['then'](function(_0x2ee314){});}});}if(!(_0x394b69['dialAnswer']&&_0x1d3ab1==='16')){ut[_0x3930('0x7a')](_0x1566ae,_0x3930('0xfc'));logger[_0x3930('0x59')]('[originated][decrement][callProgressDetectingCustomer]',_0x394b69['uniqueid'],_0x3930('0xb8'),_0x1566ae[_0x3930('0x2b')],_0x3930('0x6f'),_0x1566ae[_0x3930('0x4e')]);}if(_0x1d3ab1!==_0x3930('0xb3')){delete this[_0x3930('0x6d')][_0x553e98[_0x3930('0xae')]];delete this[_0x3930('0x6d')][_0x553e98[_0x3930('0xfd')]];}}};Preview[_0x3930('0xe')][_0x3930('0xfe')]=function(_0x36f9ff,_0x32b9f3,_0xccb5a5){if(_['isUndefined'](_0x32b9f3)&&_0x3930('0xff')!==typeof _0x32b9f3){return;}if(_[_0x3930('0x100')](_0xccb5a5)&&_0x3930('0xff')!==typeof _0xccb5a5){return;}switch(_0xccb5a5['reason']){case'0':ut[_0x3930('0x101')](_0x36f9ff,0x0,'NoSuchNumber');rpcDb[_0x3930('0x102')](_0x36f9ff,_0x3930('0x103'));break;case'3':ut['logAgent'](_0x36f9ff,0x3,_0x3930('0x104'));rpcDb['createAgentHistory'](_0x36f9ff,_0x3930('0x105'));break;case'5':ut[_0x3930('0x101')](_0x36f9ff,0x5,_0x3930('0xca'));rpcDb[_0x3930('0x102')](_0x36f9ff,_0x3930('0x106'));break;case'8':ut[_0x3930('0x101')](_0x36f9ff,0x8,_0x3930('0xde'));rpcDb[_0x3930('0x102')](_0x36f9ff,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x3930('0x101')](_0x36f9ff,0x16,_0x3930('0x107'));rpcDb[_0x3930('0x102')](_0x36f9ff,_0x3930('0x108'));break;default:ut[_0x3930('0x101')](_0x36f9ff,0xc,_0xccb5a5[_0x3930('0x109')]);rpcDb[_0x3930('0x102')](_0x36f9ff,_0x3930('0x10a'));}ut[_0x3930('0x7a')](_0x32b9f3,_0x3930('0x10b'));logger[_0x3930('0x59')](_0x3930('0x10c'),_0x36f9ff[_0x3930('0xc7')],_0x3930('0xb8'),_0x32b9f3[_0x3930('0x2b')],_0x3930('0x6f'),_0x32b9f3[_0x3930('0x4e')]);delete this[_0x3930('0x6d')][_0x36f9ff['uniqueid']];};Preview['prototype'][_0x3930('0xce')]=function(_0x506421,_0x4b3570,_0x1f394f){return BPromise[_0x3930('0x10d')]()[_0x3930('0x82')](cmHopperAdditionalPhone[_0x3930('0xce')](_0x506421,_0x4b3570,_0x1f394f))[_0x3930('0x78')](logger[_0x3930('0x59')](_0x3930('0x10e')));};Preview[_0x3930('0xe')][_0x3930('0xb2')]=function(_0x30983d,_0x4ea93f,_0x2d389f){return BPromise[_0x3930('0x10d')]()[_0x3930('0x82')](cmHopperAdditionalPhone[_0x3930('0xb2')](_0x30983d,_0x4ea93f,_0x2d389f))[_0x3930('0x78')](logger[_0x3930('0x59')](_0x3930('0x10f')));};Preview[_0x3930('0xe')][_0x3930('0xb1')]=function(_0x3936de){return BPromise['resolve']()[_0x3930('0x82')](cmHopperAdditionalPhone[_0x3930('0xb1')](_0x3936de))[_0x3930('0x78')](logger[_0x3930('0x59')]('[incrementPreviewCounters]\x20'));};Preview[_0x3930('0xe')][_0x3930('0x110')]=function(_0x58c6ea,_0x1bad01,_0x39b454,_0x231800,_0xe398f9){var _0xfccef8=this;return new BPromise(function(_0x401e00,_0x33cc81){if(_['isNil'](_0x1bad01)||_['isNil'](_0x1bad01[_0x3930('0x111')])||_[_0x3930('0x6a')](_0x1bad01[_0x3930('0x112')])||_[_0x3930('0x6a')](_0x1bad01[_0x3930('0x74')])){_0x33cc81(ut['message'](_0x3930('0x113'),_0x231800,_0xe398f9));return;}var _0x208094=uuid['v4']();var _0x30a273=_0xfccef8[_0x3930('0x27')][_0x1bad01[_0x3930('0x6c')][_0x3930('0x2b')]];var _0x399b80=_0x39b454?_0xfccef8[_0x3930('0x15')][_0x39b454]['id']:undefined;_0xfccef8['actions'][_0x208094]=new Action(_0x1bad01,_0x30a273,_0x208094,_0x39b454,_0x399b80);var _0x70fb0a=_0xfccef8['actions'][_0x208094];_0x70fb0a[_0x3930('0xd2')]=_0x231800;_0x70fb0a['activeContact']=_0xe398f9;_0x70fb0a[_0x3930('0x114')]=_0x39b454;if(_['isEmpty'](_0x58c6ea)){_0xfccef8['execCall'](_0x70fb0a,_0x30a273,_0x1bad01,_0x39b454)[_0x3930('0x82')](function(_0x341ff2){logger['info'](_0x3930('0x115'),_0x3930('0x116')+_0x70fb0a[_0x3930('0x6e')]+'\x20IdHopper:\x20'+_0x70fb0a[_0x3930('0xb0')],JSON['stringify'](_0x341ff2));ami[_0x3930('0x28')](_0x3930('0x117'),ut[_0x3930('0xa1')](_0x70fb0a,_0x3930('0x118'),_0xfccef8[_0x3930('0x27')][_0x70fb0a[_0x3930('0x6e')]]));_0x401e00(ut[_0x3930('0x98')](_0x3930('0x119')));})['catch'](function(_0x140d9e){ut[_0x3930('0x5f')](_0x3930('0x11a'),_0x140d9e);_0x33cc81(ut[_0x3930('0x98')](_0x3930('0x11b'),_0x231800,_0xe398f9));});}else{_0x30a273[_0x3930('0x3e')]+=0x1;ut[_0x3930('0x11c')](_0x70fb0a);rpcDb[_0x3930('0x11d')](_0x70fb0a,_0x3930('0x11e'));delete _0xfccef8[_0x3930('0x6d')][_0x208094];_0x33cc81(ut[_0x3930('0x98')](_0x3930('0x11f'),_0x231800,_0xe398f9));}});};Preview[_0x3930('0xe')][_0x3930('0x120')]=function(_0x1eafae){return!_[_0x3930('0x6a')](_0x1eafae)&&!_[_0x3930('0x6a')](_0x1eafae[_0x3930('0x2b')])&&!_[_0x3930('0x6a')](_0x1eafae['active'])&&_0x1eafae[_0x3930('0x121')]&&!_['isNil'](this[_0x3930('0x14')][util['format'](_0x3930('0x122'),_0x1eafae[_0x3930('0x2b')])])&&!_[_0x3930('0x6a')](this[_0x3930('0x14')][util[_0x3930('0x56')](_0x3930('0x122'),_0x1eafae[_0x3930('0x2b')])][_0x3930('0x77')])&&(this[_0x3930('0x14')][util[_0x3930('0x56')]('SIP/%s',_0x1eafae[_0x3930('0x2b')])][_0x3930('0x77')]===_0x3930('0x123')||this[_0x3930('0x14')][util['format'](_0x3930('0x122'),_0x1eafae['name'])][_0x3930('0x77')]===_0x3930('0x124'));};Preview['prototype'][_0x3930('0x88')]=function(_0x21a240,_0xfb2c1d){var _0x42bc70=this;return new BPromise(function(_0x5d0937,_0x419a5f){_0x42bc70[_0x3930('0x125')](_0x21a240,_0xfb2c1d)['then'](function(_0x55c007){_0x5d0937(_['pick'](_0x55c007,['message']));})[_0x3930('0x78')](function(_0x367c6b){if(_0x367c6b[_0x3930('0x126')]){rpcDb['unlockContact'](_0x21a240);}if(_0x367c6b[_0x3930('0x121')]){rpcDb[_0x3930('0x8b')](_0x21a240);}_0x419a5f(_[_0x3930('0x72')](_0x367c6b,['message']));});});};Preview[_0x3930('0xe')][_0x3930('0x125')]=function(_0x33a05e,_0x2de281){var _0x30561f=this;return new BPromise(function(_0x4f8751,_0x28f9d7){var _0x5d6b15,_0x1c8dd6;rpcDb[_0x3930('0x127')](_0x33a05e)['then'](function(_0xe32dbf){if(!_['isNil'](_0xe32dbf[0x0])){_0x1c8dd6=_0xe32dbf[0x0][_0x3930('0x128')]?![]:!![];_0x5d6b15=_0xe32dbf[0x0][_0x3930('0x128')]?!![]:![];_0x5d6b15=_0x2de281?!![]:_0x5d6b15;}var _0xa1f794=_0x30561f[_0x3930('0x129')](_0xe32dbf);if(_0xa1f794[_0x3930('0x12a')]){rpcDb['checkIsBlackList'](_[_0x3930('0x72')](_0xe32dbf[0x0],[_0x3930('0x74'),_0x3930('0x112')]))[_0x3930('0x82')](function(_0x20163b){_0x30561f[_0x3930('0x110')](_0x20163b,_0xe32dbf[0x0],_0x2de281,_0x1c8dd6,_0x5d6b15)[_0x3930('0x82')](function(_0x5f1579){_0x4f8751(_0x5f1579);})['catch'](function(_0x4fe498){_0x28f9d7(_0x4fe498);});})[_0x3930('0x78')](function(_0x55c675){ut['logger'](_0x3930('0x12b'),_0x55c675);_0x28f9d7(ut[_0x3930('0x98')](_0x3930('0x12c'),_0x1c8dd6,_0x5d6b15));});}else{_0x28f9d7(ut[_0x3930('0x98')](_0xa1f794[_0x3930('0x98')],_0x1c8dd6,_0x5d6b15));}})[_0x3930('0x78')](function(_0x1111f2){ut[_0x3930('0x5f')]('[Preview][getContactPreview]',_0x1111f2);_0x28f9d7(ut['message'](_0x3930('0x12c'),![],!![]));});});};Preview[_0x3930('0xe')]['validateContact']=function(_0x8dbe1){if(_[_0x3930('0x6a')](_0x8dbe1)||_['isEmpty'](_0x8dbe1)||!_[_0x3930('0x6a')](_0x8dbe1[0x0][_0x3930('0x87')])&&_[_0x3930('0x6a')](_0x8dbe1[0x0][_0x3930('0x87')][_0x3930('0x2b')])){ut[_0x3930('0x5f')]('[Preview][validateContact][Empty\x20Contact]',_0x8dbe1);return{'isValid':![],'message':_0x3930('0x12d')};}var _0x2e8d6f=this[_0x3930('0x27')][_0x8dbe1[0x0][_0x3930('0x6c')]['name']];_0x2e8d6f[_0x3930('0x98')]=_0x3930('0x9c');if(_[_0x3930('0x6a')](_0x2e8d6f)){ut['logger']('[Preview][validateContact][Empty\x20Campaign]',_0x2e8d6f);return{'isValid':![],'message':_0x3930('0x12e')};}if(!this['isTrunkReachable'](_0x2e8d6f[_0x3930('0x53')])){ut[_0x3930('0x5f')](_0x3930('0x12f'),'campaign\x20Name:\x20'+_0x2e8d6f[_0x3930('0x2b')]+_0x3930('0x130'));if(!this[_0x3930('0x120')](_0x2e8d6f[_0x3930('0x131')])){ut['logger'](_0x3930('0x12f'),_0x2e8d6f[_0x3930('0x2b')]+_0x3930('0x132'));return{'isValid':![],'message':_0x3930('0x133')};}}if(!ut['isActive'](_0x2e8d6f[_0x3930('0x38')])){ut[_0x3930('0x5f')](_0x3930('0x134'),_0x2e8d6f[_0x3930('0x2b')]+_0x3930('0x135'));return{'isValid':![],'message':_0x3930('0x136')+_0x2e8d6f[_0x3930('0x2b')]+_0x3930('0x135')};}return{'isValid':!![],'message':_0x3930('0x137')};};Preview[_0x3930('0xe')][_0x3930('0x138')]=function(_0x2169f2,_0x2ff4d,_0x288f3f,_0x3ebe9d){var _0x124c90=this;return new BPromise(function(_0x2f90ed,_0x31912c){var _0x5b27c6=_0x2169f2['uniqueid'];var _0x2928d2=_0x124c90[_0x3930('0x120')](_0x2ff4d[_0x3930('0x53')])?util[_0x3930('0x56')](_0x3930('0x139'),_0x2ff4d['Trunk'][_0x3930('0x2b')],_[_0x3930('0x6a')](_0x2ff4d[_0x3930('0x3b')])?'':_0x2ff4d[_0x3930('0x3b')][_0x3930('0x13a')]()||'',_0x2ff4d['dialCutDigit']>0x0?_0x288f3f['phone'][_0x3930('0x13b')](_0x2ff4d[_0x3930('0x13c')]):_0x288f3f['phone']):util[_0x3930('0x56')]('SIP/%s/%s%s',_[_0x3930('0x6a')](_0x2ff4d[_0x3930('0x131')])?_0x2ff4d[_0x3930('0x53')][_0x3930('0x2b')]:_0x2ff4d[_0x3930('0x131')][_0x3930('0x2b')],_[_0x3930('0x6a')](_0x2ff4d[_0x3930('0x3b')])?'':_0x2ff4d[_0x3930('0x3b')][_0x3930('0x13a')]()||'',_0x2ff4d[_0x3930('0x13c')]>0x0?_0x288f3f[_0x3930('0x112')][_0x3930('0x13b')](_0x2ff4d[_0x3930('0x13c')]):_0x288f3f[_0x3930('0x112')]);var _0xc5fdd3=_0x124c90['isTrunkReachable'](_0x2ff4d['Trunk'])?ut[_0x3930('0x13d')](_0x2ff4d['Trunk'][_0x3930('0x13e')],_0x2ff4d['dialOriginateCallerIdName'],_0x2ff4d[_0x3930('0x13f')]>0x0?ut[_0x3930('0x140')](_0x2ff4d['dialOriginateCallerIdNumber'],_0x2ff4d[_0x3930('0x13f')]):_0x2ff4d[_0x3930('0x141')]):ut['getCallerId'](_[_0x3930('0x6a')](_0x2ff4d['TrunkBackup'])?_0x2ff4d['Trunk'][_0x3930('0x13e')]:_0x2ff4d[_0x3930('0x131')][_0x3930('0x13e')],_0x2ff4d['dialOriginateCallerIdName'],_0x2ff4d['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x3930('0x140')](_0x2ff4d[_0x3930('0x141')],_0x2ff4d[_0x3930('0x13f')]):_0x2ff4d[_0x3930('0x141')]);if(_0xc5fdd3){_0x2169f2['originatecalleridname']=ut[_0x3930('0x142')](_0xc5fdd3);_0x2169f2[_0x3930('0x143')]=ut['extractCalleridNumber'](_0xc5fdd3);}var _0x267614=ut[_0x3930('0x144')](_0x2ff4d,_0x288f3f,_0x2928d2,_0xc5fdd3,_0x5b27c6,_0x2169f2);_['merge'](_0x2169f2,ut[_0x3930('0x145')](_0x267614));_0x2169f2[_0x3930('0x8c')]=moment()[_0x3930('0x56')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0x3930('0x76')](ut[_0x3930('0x146')](_0x2169f2,_0x2ff4d,_0x267614,_0x2169f2[_0x3930('0xad')],_0x3ebe9d))[_0x3930('0x82')](function(_0x519409){var _0x1ca013=_0x2169f2[_0x3930('0x147')];if(!_[_0x3930('0x6a')](_0x1ca013)){if(!_[_0x3930('0x6a')](_0x124c90[_0x3930('0x15')][_0x1ca013])){_0x124c90[_0x3930('0x15')][_0x1ca013][_0x3930('0x148')]=_0x2169f2['calleridnum'];emit(util[_0x3930('0x56')](_0x3930('0x149'),_0x124c90['agents'][_0x1ca013][_0x3930('0x2b')]),'user:agentconnect',{'destaccountcode':_0x124c90[_0x3930('0x15')][_0x1ca013][_0x3930('0x14a')],'destconnectedlinenum':_0x2169f2[_0x3930('0x14b')]});}}_0x2ff4d[_0x3930('0x4e')]+=0x1;logger[_0x3930('0x59')](_0x3930('0x14c'),_0x5b27c6,_0x3930('0xb8'),_0x2ff4d[_0x3930('0x2b')],'originated:\x20',_0x2ff4d[_0x3930('0x4e')]);_0x2f90ed(_0x519409);})[_0x3930('0x78')](function(_0x1363e3){ut[_0x3930('0x101')](_0x2169f2,0xe,_0x3930('0x14d'));rpcDb[_0x3930('0x102')](_0x2169f2,'[originateFailure][logOriginateFailure]');_0x31912c(_0x1363e3);});});};Preview[_0x3930('0xe')][_0x3930('0x1f')]=function(_0x1cbdd2){if(this[_0x3930('0x6d')][_0x1cbdd2[_0x3930('0xae')]]){this[_0x3930('0x6d')][_0x1cbdd2[_0x3930('0xae')]][_0x3930('0x14e')]=_0x1cbdd2[_0x3930('0x14e')];}};Preview[_0x3930('0xe')][_0x3930('0x14f')]=function(_0x60f809){var _0x583829=this;var _0x54bf04=this[_0x3930('0x6d')][_0x60f809[_0x3930('0x150')]];if(_0x54bf04){if(_0x54bf04[_0x3930('0x114')]&&this[_0x3930('0x15')][_0x54bf04[_0x3930('0x114')]]){ut[_0x3930('0x151')](_0x54bf04,this[_0x3930('0x15')][_0x54bf04[_0x3930('0x114')]][_0x3930('0x2b')],this[_0x3930('0x15')][_0x54bf04[_0x3930('0x114')]]['id']);}var _0x12cedb=_[_0x3930('0x152')](_0x54bf04);_0x12cedb[_0x3930('0xb5')]=moment()[_0x3930('0x56')](_0x3930('0xb4'));var _0x2ef039=_0x583829[_0x3930('0x27')][_0x54bf04['queue']];if(ut['isFailure'](_0x60f809[_0x3930('0x153')])){if(_0x54bf04[_0x3930('0xd2')]){rpcDb['unlockContact'](_0x54bf04[_0x3930('0xb0')]);}if(_0x54bf04[_0x3930('0xad')]){rpcDb[_0x3930('0x8b')](_0x54bf04[_0x3930('0xb0')]);}ami[_0x3930('0x28')](_0x3930('0x154'),ut[_0x3930('0xa1')](_0x54bf04,_0x3930('0x155'),this[_0x3930('0x27')][_0x54bf04[_0x3930('0x6e')]]));this[_0x3930('0xfe')](_0x12cedb,_0x2ef039,_0x60f809);}else{_0x54bf04[_0x3930('0x8c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');ut[_0x3930('0x101')](_0x12cedb,0x4,_0x3930('0xc1'));rpcDb[_0x3930('0x102')](_0x12cedb,_0x3930('0x156'));}}};Preview[_0x3930('0xe')]['syncHangup']=function(_0x527a41){var _0x3559a1=this;var _0x403075=this[_0x3930('0x6d')][_0x527a41['linkedid']];var _0x28f26b;if(_0x403075){_0x28f26b=this['campaignsPreview'][_0x403075[_0x3930('0x6e')]];logger[_0x3930('0x59')](_0x3930('0x157'),_0x527a41[_0x3930('0xae')],'\x20Queue',_0x28f26b[_0x3930('0x2b')],_0x3930('0x70'),_0x28f26b[_0x3930('0x30')]);}if(this['actions'][_0x527a41[_0x3930('0xae')]]&&_0x527a41['linkedid']!==_0x527a41[_0x3930('0xc7')]){if(_0x527a41['cause']==='16'&&this[_0x3930('0x6d')][_0x527a41[_0x3930('0xae')]][_0x3930('0x71')]){this[_0x3930('0x9d')](_0x527a41,_0x527a41['linkedid'],_0x527a41[_0x3930('0x158')]);}else if(this[_0x3930('0x6d')][_0x527a41[_0x3930('0xae')]][_0x3930('0x71')]){logger[_0x3930('0x59')]('[syncHangup][talking][cause]',_0x527a41[_0x3930('0xae')],_0x527a41[_0x3930('0x158')],'\x20Queue',_0x28f26b[_0x3930('0x2b')],'pTalking:\x20',_0x28f26b[_0x3930('0x30')]);this['callProgressDetectingCustomer'](_0x527a41,_0x527a41[_0x3930('0xae')],_0x527a41[_0x3930('0x158')]);}}else if(_0x403075&&_['isNil'](_0x403075[_0x3930('0x159')])&&_0x28f26b[_0x3930('0x15a')]&&_0x527a41['linkedid']===_0x527a41['uniqueid']&&_[_0x3930('0x6a')](_0x527a41[_0x3930('0x109')])&&_0x527a41[_0x3930('0x158')]==='16'&&_0x527a41['channelstate']==='6'&&_['isUndefined'](_0x403075[_0x3930('0x15b')])){if(_0x403075[_0x3930('0xd2')]){rpcDb[_0x3930('0x15c')](_0x403075[_0x3930('0xb0')]);}if(_0x403075[_0x3930('0xad')]){rpcDb[_0x3930('0x8b')](_0x403075[_0x3930('0xb0')]);}_0x527a41[_0x3930('0x109')]='22';this[_0x3930('0xfe')](_0x403075,_0x28f26b,_0x527a41);}else if(_0x403075&&_0x403075[_0x3930('0x15b')]){if(_0x527a41[_0x3930('0x158')]==='16'&&this['actions'][_0x527a41[_0x3930('0xae')]]['dialAnswer']){logger[_0x3930('0x59')](_0x3930('0x15d'),_0x527a41['linkedid'],_0x527a41[_0x3930('0x158')],_0x3930('0xb8'),_0x28f26b[_0x3930('0x2b')],_0x3930('0x70'),_0x28f26b[_0x3930('0x30')]);this[_0x3930('0x9d')](_0x527a41,_0x527a41['linkedid'],_0x527a41[_0x3930('0x158')]);}else if(this[_0x3930('0x6d')][_0x527a41[_0x3930('0xae')]]['dialAnswer']){logger[_0x3930('0x59')]('[syncHangup][talking][cause]',_0x527a41[_0x3930('0xae')],_0x527a41[_0x3930('0x158')],_0x3930('0xb8'),_0x28f26b[_0x3930('0x2b')],_0x3930('0x70'),_0x28f26b[_0x3930('0x30')]);this[_0x3930('0x9d')](_0x527a41,_0x527a41['linkedid'],_0x527a41['cause']);}}};Preview['prototype'][_0x3930('0x1d')]=function(_0x15cece){if(this[_0x3930('0x6d')][_0x15cece['destlinkedid']]&&_0x15cece[_0x3930('0xfd')]!==_0x15cece['destuniqueid']){this[_0x3930('0x9d')](_0x15cece,_0x15cece[_0x3930('0xfd')],_0x15cece[_0x3930('0xf3')]);}};Preview[_0x3930('0xe')]['syncHangupRequest']=function(_0x5cecaf){if(this[_0x3930('0x6d')][_0x5cecaf['linkedid']]&&_0x5cecaf[_0x3930('0xae')]!==_0x5cecaf[_0x3930('0xc7')]&&!this[_0x3930('0x6d')][_0x5cecaf[_0x3930('0xae')]][_0x3930('0x71')]){if(_0x5cecaf[_0x3930('0x158')]==='1'){this[_0x3930('0x9d')](_0x5cecaf,_0x5cecaf[_0x3930('0xae')],_0x5cecaf[_0x3930('0x158')]);}}};Preview[_0x3930('0xe')][_0x3930('0x15e')]=function(_0x327ef8,_0x571d56,_0x1ee610){if(this['actions'][_0x327ef8]){if(_[_0x3930('0x6a')](this['actions'][_0x327ef8][_0x3930('0x15f')])){this[_0x3930('0x6d')][_0x327ef8][_0x3930('0x15f')]={};}this[_0x3930('0x6d')][_0x327ef8]['variables'][_0x571d56]=_0x1ee610;}};Preview[_0x3930('0xe')][_0x3930('0x21')]=function(_0xc476ca){try{if(!_[_0x3930('0x6a')](_0xc476ca)){if(ut['filterKey'](_[_0x3930('0x160')](_0xc476ca[_0x3930('0x161')])[0x0])){this[_0x3930('0x15e')](_0xc476ca[_0x3930('0xc7')],_[_0x3930('0x160')](_0xc476ca[_0x3930('0x161')])[0x0],_0xc476ca['value']);}}}catch(_0x38c0ad){logger['error'](_0x3930('0x162'),util['inspect'](_0x38c0ad,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0x3930('0x23')]=function(_0x1f7edd){if(_0x1f7edd){if(this[_0x3930('0x6d')][_0x1f7edd[_0x3930('0x163')]]){this[_0x3930('0x6d')][_0x1f7edd[_0x3930('0x163')]][_0x3930('0x15b')]=!![];}}};Preview['prototype'][_0x3930('0x25')]=function(_0x1a7913){if(_0x1a7913){if(this[_0x3930('0x6d')][_0x1a7913['transfererlinkedid']]){this[_0x3930('0x6d')][_0x1a7913[_0x3930('0x164')]][_0x3930('0x15b')]=!![];}}};module[_0x3930('0x165')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 032e23c..d2f99a5 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 _0xbe02=['getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','membername','from-sip','exten','xcally-motion-preview','holdtime','lastAssignedTo','queuecallerexitreason','create','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','../../../config/logger','preview','lodash','../rpc/cmHopperFinal','../rpc/cmHopperBlack','inspect','resolve','catch','[createHistory]\x20','createHistory','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20'];(function(_0x2d774a,_0x332522){var _0x120d99=function(_0x13ad40){while(--_0x13ad40){_0x2d774a['push'](_0x2d774a['shift']());}};_0x120d99(++_0x332522);}(_0xbe02,0x1b3));var _0x2be0=function(_0x348a8a,_0xfd672f){_0x348a8a=_0x348a8a-0x0;var _0x58c714=_0xbe02[_0x348a8a];return _0x58c714;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0x2be0('0x0'))(_0x2be0('0x1'));var _=require(_0x2be0('0x2'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0x2be0('0x3'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x2be0('0x4'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x1ab41b){return function(_0x39c696){logger['error'](_0x1ab41b,util[_0x2be0('0x5')](_0x39c696,{'showHidden':![],'depth':null}));};}function create(_0x58e32){return BPromise[_0x2be0('0x6')]()['then'](cmHopperHistory['createHistory'](_0x58e32))[_0x2be0('0x7')](loggerCatch(_0x2be0('0x8')));}function createAgent(_0x40fcf9){return BPromise['resolve']()['then'](agentReportPreview[_0x2be0('0x9')](_0x40fcf9))[_0x2be0('0x7')](loggerCatch(_0x2be0('0x8')));}function moveContact(_0x1bbd4b){return BPromise[_0x2be0('0x6')]()[_0x2be0('0xa')](cmHopper[_0x2be0('0xb')](_0x1bbd4b,!![]))[_0x2be0('0x7')](loggerCatch(_0x2be0('0xc')));}exports[_0x2be0('0xd')]=function(_0x55264b){return BPromise[_0x2be0('0x6')]()['then'](cmHopperBlack[_0x2be0('0xd')](_0x55264b))[_0x2be0('0x7')](loggerCatch(_0x2be0('0xe')));};exports[_0x2be0('0xf')]=function(_0x27620d){return BPromise[_0x2be0('0x6')]()[_0x2be0('0xa')](cmHopper[_0x2be0('0xf')](_0x27620d))[_0x2be0('0x7')](loggerCatch(_0x2be0('0x10')));};exports[_0x2be0('0x9')]=function(_0x2c7782,_0x2a043b){create(_0x2c7782)[_0x2be0('0x7')](loggerCatch(_0x2a043b));moveContact(_0x2c7782)[_0x2be0('0x7')](loggerCatch(_0x2a043b));};exports[_0x2be0('0x11')]=function(_0x28c04f,_0x545d5a){createAgent(_0x28c04f)[_0x2be0('0x7')](loggerCatch(_0x545d5a));};exports[_0x2be0('0x12')]=function(_0x453d87,_0x44c30d){create(_0x453d87)[_0x2be0('0x7')](loggerCatch(_0x44c30d));};exports['createCustomerFinal']=function(_0x2c4844,_0x3b7998){moveContact(_0x2c4844)[_0x2be0('0x7')](loggerCatch(_0x3b7998));};exports[_0x2be0('0x13')]=function(_0x34c60e,_0x83fcae,_0x5ed41d){if(_0x83fcae){_0x34c60e[_0x2be0('0x14')]=null;}if(_0x5ed41d){_0x34c60e[_0x2be0('0x15')]=![];}return BPromise[_0x2be0('0x6')]()[_0x2be0('0xa')](cmHopper[_0x2be0('0x13')](_0x34c60e))['catch'](loggerCatch(_0x2be0('0x16')));};exports[_0x2be0('0x17')]=function(_0x60d703){return BPromise[_0x2be0('0x6')]()[_0x2be0('0xa')](cmHopper[_0x2be0('0x17')](_0x60d703))[_0x2be0('0x7')](loggerCatch(_0x2be0('0x18')));};exports[_0x2be0('0x19')]=function(_0x261dca){return BPromise[_0x2be0('0x6')]()[_0x2be0('0xa')](cmHopper['unlockContact']({'UserId':null},_0x261dca,0x1))[_0x2be0('0x7')](loggerCatch(_0x2be0('0x1a')));};exports[_0x2be0('0x1b')]=function(_0x5820e){return BPromise[_0x2be0('0x6')]()['then'](cmHopper['unlockContact']({'active':![]},_0x5820e,0x1))[_0x2be0('0x7')](loggerCatch(_0x2be0('0x1c')));};exports[_0x2be0('0x1d')]=function(_0x557b67){var _0x3f5fa4={};_0x3f5fa4[_0x2be0('0x1e')]=_0x557b67['type'];_0x3f5fa4[_0x2be0('0x1f')]=_0x557b67[_0x2be0('0x1f')];_0x3f5fa4[_0x2be0('0x20')]=_0x557b67[_0x2be0('0x20')];_0x3f5fa4['calleridname']=_0x557b67[_0x2be0('0x21')];_0x3f5fa4[_0x2be0('0x22')]=_0x557b67['queue'];_0x3f5fa4['queuecallerjoinAt']=_0x557b67['answertime'];_0x3f5fa4[_0x2be0('0x23')]=_0x557b67['answertime'];_0x3f5fa4[_0x2be0('0x24')]=0x1;_0x3f5fa4[_0x2be0('0x25')]=_0x557b67[_0x2be0('0x26')];_0x3f5fa4['connectedlinename']=_0x557b67[_0x2be0('0x27')];_0x3f5fa4['context']=_0x2be0('0x28');_0x3f5fa4[_0x2be0('0x29')]=_0x2be0('0x2a');_0x3f5fa4[_0x2be0('0x2b')]=0x0;_0x3f5fa4['assigned']=0x1;_0x3f5fa4[_0x2be0('0x2c')]=_0x557b67[_0x2be0('0x27')];_0x3f5fa4[_0x2be0('0x2d')]='COMPLETED';return BPromise[_0x2be0('0x6')]()[_0x2be0('0xa')](voiceQueueReport[_0x2be0('0x2e')](_0x3f5fa4))[_0x2be0('0x7')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x2be0('0x2f')]=function(_0x197722,_0x2890fa){return BPromise[_0x2be0('0x6')]()[_0x2be0('0xa')](cmHopper[_0x2be0('0x2f')](_0x197722,_0x2890fa))[_0x2be0('0x7')](loggerCatch(_0x2be0('0x30')));};exports[_0x2be0('0x31')]=function(_0xe59e77){return BPromise[_0x2be0('0x6')]()[_0x2be0('0xa')](cmHopper[_0x2be0('0x13')](_0xe59e77,!![],!![]))[_0x2be0('0x7')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0xe4c0=['lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then','catch','[createHistory]\x20','createHistory','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','UserId','active','rescheduleContact','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercompleteAt','connectedlinename','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','membername','queuecallerexitreason','COMPLETED','create','getContactRecallMe','[GetContactRecallMe]\x20','util','bluebird','../../../config/logger'];(function(_0x2f503a,_0x7506e9){var _0x8871e6=function(_0x3ac452){while(--_0x3ac452){_0x2f503a['push'](_0x2f503a['shift']());}};_0x8871e6(++_0x7506e9);}(_0xe4c0,0xa8));var _0x0e4c=function(_0x1aae33,_0x110a80){_0x1aae33=_0x1aae33-0x0;var _0x2e91e9=_0xe4c0[_0x1aae33];return _0x2e91e9;};'use strict';var util=require(_0x0e4c('0x0'));var BPromise=require(_0x0e4c('0x1'));var logger=require(_0x0e4c('0x2'))('preview');var _=require(_0x0e4c('0x3'));var cmHopper=require(_0x0e4c('0x4'));var cmHopperFinal=require(_0x0e4c('0x5'));var cmHopperHistory=require(_0x0e4c('0x6'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x0e4c('0x7'));var agentReportPreview=require(_0x0e4c('0x8'));var voiceQueueReport=require(_0x0e4c('0x9'));function loggerCatch(_0x5a03e4){return function(_0x30100e){logger[_0x0e4c('0xa')](_0x5a03e4,util[_0x0e4c('0xb')](_0x30100e,{'showHidden':![],'depth':null}));};}function create(_0x65d789){return BPromise[_0x0e4c('0xc')]()[_0x0e4c('0xd')](cmHopperHistory['createHistory'](_0x65d789))[_0x0e4c('0xe')](loggerCatch(_0x0e4c('0xf')));}function createAgent(_0x288364){return BPromise[_0x0e4c('0xc')]()[_0x0e4c('0xd')](agentReportPreview[_0x0e4c('0x10')](_0x288364))[_0x0e4c('0xe')](loggerCatch(_0x0e4c('0xf')));}function moveContact(_0x217289){return BPromise[_0x0e4c('0xc')]()[_0x0e4c('0xd')](cmHopper[_0x0e4c('0x11')](_0x217289,!![]))['catch'](loggerCatch(_0x0e4c('0x12')));}exports[_0x0e4c('0x13')]=function(_0x349ce5){return BPromise[_0x0e4c('0xc')]()[_0x0e4c('0xd')](cmHopperBlack[_0x0e4c('0x13')](_0x349ce5))[_0x0e4c('0xe')](loggerCatch(_0x0e4c('0x14')));};exports[_0x0e4c('0x15')]=function(_0x37f2d1){return BPromise[_0x0e4c('0xc')]()[_0x0e4c('0xd')](cmHopper[_0x0e4c('0x15')](_0x37f2d1))['catch'](loggerCatch(_0x0e4c('0x16')));};exports[_0x0e4c('0x10')]=function(_0x8f087c,_0xe8ef02){create(_0x8f087c)[_0x0e4c('0xe')](loggerCatch(_0xe8ef02));moveContact(_0x8f087c)[_0x0e4c('0xe')](loggerCatch(_0xe8ef02));};exports[_0x0e4c('0x17')]=function(_0x282e9a,_0x1e345a){createAgent(_0x282e9a)[_0x0e4c('0xe')](loggerCatch(_0x1e345a));};exports['createCustomerHistory']=function(_0x2963c5,_0x135eca){create(_0x2963c5)[_0x0e4c('0xe')](loggerCatch(_0x135eca));};exports[_0x0e4c('0x18')]=function(_0x519764,_0x57478f){moveContact(_0x519764)['catch'](loggerCatch(_0x57478f));};exports['rescheduleContact']=function(_0x127e5d,_0x5f13e1,_0x5e3fda){if(_0x5f13e1){_0x127e5d[_0x0e4c('0x19')]=null;}if(_0x5e3fda){_0x127e5d[_0x0e4c('0x1a')]=![];}return BPromise[_0x0e4c('0xc')]()['then'](cmHopper[_0x0e4c('0x1b')](_0x127e5d))[_0x0e4c('0xe')](loggerCatch(_0x0e4c('0x1c')));};exports[_0x0e4c('0x1d')]=function(_0x3b431d){return BPromise[_0x0e4c('0xc')]()[_0x0e4c('0xd')](cmHopper[_0x0e4c('0x1d')](_0x3b431d))['catch'](loggerCatch('[countReScheduled]\x20'));};exports[_0x0e4c('0x1e')]=function(_0x3ba74f){return BPromise[_0x0e4c('0xc')]()[_0x0e4c('0xd')](cmHopper[_0x0e4c('0x1e')]({'UserId':null},_0x3ba74f,0x1))[_0x0e4c('0xe')](loggerCatch(_0x0e4c('0x1f')));};exports[_0x0e4c('0x20')]=function(_0x106e09){return BPromise[_0x0e4c('0xc')]()[_0x0e4c('0xd')](cmHopper[_0x0e4c('0x1e')]({'active':![]},_0x106e09,0x1))['catch'](loggerCatch(_0x0e4c('0x21')));};exports[_0x0e4c('0x22')]=function(_0x40b383){var _0x34ac3d={};_0x34ac3d[_0x0e4c('0x23')]=_0x40b383[_0x0e4c('0x23')];_0x34ac3d['uniqueid']=_0x40b383[_0x0e4c('0x24')];_0x34ac3d[_0x0e4c('0x25')]=_0x40b383[_0x0e4c('0x25')];_0x34ac3d[_0x0e4c('0x26')]=_0x40b383[_0x0e4c('0x26')];_0x34ac3d[_0x0e4c('0x27')]=_0x40b383['queue'];_0x34ac3d[_0x0e4c('0x28')]=_0x40b383['answertime'];_0x34ac3d['queuecallerleaveAt']=_0x40b383[_0x0e4c('0x29')];_0x34ac3d['queuecallercomplete']=0x1;_0x34ac3d[_0x0e4c('0x2a')]=_0x40b383['endtime'];_0x34ac3d[_0x0e4c('0x2b')]=_0x40b383['membername'];_0x34ac3d[_0x0e4c('0x2c')]=_0x0e4c('0x2d');_0x34ac3d[_0x0e4c('0x2e')]=_0x0e4c('0x2f');_0x34ac3d[_0x0e4c('0x30')]=0x0;_0x34ac3d[_0x0e4c('0x31')]=0x1;_0x34ac3d[_0x0e4c('0x32')]=_0x40b383[_0x0e4c('0x33')];_0x34ac3d[_0x0e4c('0x34')]=_0x0e4c('0x35');return BPromise[_0x0e4c('0xc')]()[_0x0e4c('0xd')](voiceQueueReport[_0x0e4c('0x36')](_0x34ac3d))[_0x0e4c('0xe')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x0e4c('0x37')]=function(_0xf87a37,_0x3736b9){return BPromise[_0x0e4c('0xc')]()[_0x0e4c('0xd')](cmHopper[_0x0e4c('0x37')](_0xf87a37,_0x3736b9))['catch'](loggerCatch(_0x0e4c('0x38')));};exports['rescheduleContactInQueue']=function(_0x6da2ff){return BPromise[_0x0e4c('0xc')]()[_0x0e4c('0xd')](cmHopper[_0x0e4c('0x1b')](_0x6da2ff,!![],!![]))[_0x0e4c('0xe')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 5fe2f48..85ba105 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 _0x081a=['xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitterbridged','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','random','extractCalleridName','match','util','moment','preview','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','loggerCatch','logger','inspect','loggerError','logger2','info','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridname','monitor_format','_XCALLY_MIXMONITOR_UNIQUEID','hasOwnProperty','Contact','createdAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','error','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','statedesc','Blacklist','starttime','endtime','logAgent','state','logLookAgent','membername','responsetime','talktime','answertime','RECALL','BOOKED','uniqueid','channelAgent','xcally-motion-preview','timeout','countbusyretry','countnoanswerretry','countagentrejectretry','cloneAction','clone','Global','scheduledAt','scheduledat','minutes','ListId','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','name','queue','interface','mandatoryDisposition','buildAcw','not_inuse','status','reachable','push','getDiff','seconds','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','countcongestionretry','callback','callbackuniqueid','recallme','UserId','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialtimeout','xmd-dialoptions','xmd-dialid'];(function(_0x349ed8,_0x4eee47){var _0x2ad3f9=function(_0x2e7680){while(--_0x2e7680){_0x349ed8['push'](_0x349ed8['shift']());}};_0x2ad3f9(++_0x4eee47);}(_0x081a,0x9c));var _0xa081=function(_0x2e6a69,_0x1ba014){_0x2e6a69=_0x2e6a69-0x0;var _0x583b2a=_0x081a[_0x2e6a69];return _0x583b2a;};'use strict';var util=require(_0xa081('0x0'));var _=require('lodash');var moment=require(_0xa081('0x1'));var logger=require('../../../../config/logger')(_0xa081('0x2'));var ipAgi=process['env'][_0xa081('0x3')]||_0xa081('0x4');function getSeconds(_0x1c6c1b,_0x153bd8){var _0x3fae56=moment(_0x1c6c1b)[_0xa081('0x5')](0x0);var _0x484dcf=moment(_0x153bd8)['milliseconds'](0x0);return _0x3fae56[_0xa081('0x6')](_0x484dcf,'seconds');}exports[_0xa081('0x7')]=function(_0x2d4c4a){return function(_0x3bb879){logger['error'](_0x2d4c4a,util['inspect'](_0x3bb879,{'showHidden':![],'depth':null}));};};exports[_0xa081('0x8')]=function(_0x3eec31,_0x5aa36b){logger['info'](_0x3eec31,util[_0xa081('0x9')](_0x5aa36b,{'showHidden':![],'depth':null}));};exports[_0xa081('0xa')]=function(_0x23c9c5,_0x3434ea){logger['error'](_0x23c9c5,util[_0xa081('0x9')](_0x3434ea,{'showHidden':![],'depth':null}));};exports[_0xa081('0xb')]=function(_0x4fc4c0){return function(_0x5281ea){logger[_0xa081('0xc')](_0x4fc4c0,util['inspect'](_0x5281ea,{'showHidden':![],'depth':null}));};};exports[_0xa081('0xd')]=function(_0x22c9a5,_0x463924,_0x4bdf9f){return{'message':_0x22c9a5,'unlock':_0x463924,'active':_0x4bdf9f};};exports[_0xa081('0xe')]=function(_0x289bfe,_0x3fc95a,_0x2dd803){if(!_[_0xa081('0xf')](_0x2dd803)&&_0xa081('0x10')===typeof _0x2dd803&&!_[_0xa081('0x11')](_0x2dd803)){if(!_[_0xa081('0xf')](_0x3fc95a)&&_0xa081('0x10')===typeof _0x3fc95a&&!_[_0xa081('0x11')](_0x3fc95a)){return util[_0xa081('0x12')](_0xa081('0x13'),_0x3fc95a,_0x2dd803);}return util[_0xa081('0x12')](_0xa081('0x13'),_0x2dd803,_0x2dd803);}if(!_[_0xa081('0xf')](_0x289bfe)&&_0xa081('0x10')===typeof _0x289bfe&&!_['isEmpty'](_0x289bfe)){return _0x289bfe;}return _0xa081('0x14');};exports[_0xa081('0x15')]=function(_0x2b4761){if(_[_0xa081('0x16')](_0x2b4761)){return![];}return _0x2b4761;};exports[_0xa081('0x17')]=function(_0x5d0445,_0x395bb5,_0x3696df,_0x3538a2,_0x3ec19c,_0x16740a){var _0x47210d={'XMD-QUEUE':_0x395bb5['Queue']?_0x395bb5[_0xa081('0x18')]['name']:'','XMD-CALLERID':_0x3538a2,'XMD-CALLERID-PREVIEW':_0x16740a?util['format']('\x22%s\x22\x20<%s>',_0x16740a[_0xa081('0x19')],_0x16740a[_0xa081('0x1a')]):_0x3538a2,'XMD-DIALID':_0x3ec19c,'XMD-CONTACTID':_0x395bb5[_0xa081('0x1b')],'XMD-CDRTYPE':_0xa081('0x1c'),'CALLERID(all)':_0x3538a2,'XMD-VOICEQUEUEID':_0x395bb5[_0xa081('0x1d')],'XMD-DIALCHANNEL':_0x3696df,'XMD-DIALTIMEOUT':_0x5d0445[_0xa081('0x1e')]||0x1e,'XMD-DIALOPTIONS':util[_0xa081('0x12')](_0xa081('0x1f'),_0x5d0445['dialQueueProject2']?'g':'',_[_0xa081('0x11')](_0x5d0445['monitor_format'])?'':_0xa081('0x20')),'XMD-DIALURL':_0x5d0445[_0xa081('0x21')]||'','XMD-AGI':_0x5d0445[_0xa081('0x22')]?util[_0xa081('0x12')](_0xa081('0x23'),ipAgi,_0x5d0445[_0xa081('0x22')]):_0xa081('0x24'),'XMD-AGIAFTER':_0x5d0445[_0xa081('0x25')]?util[_0xa081('0x12')](_0xa081('0x23'),ipAgi,_0x5d0445[_0xa081('0x25')]):_0xa081('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x16740a?_0x16740a['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x16740a?_0x16740a[_0xa081('0x26')]:'','XMD-DESTINATION':'xcally-motion-preview'};if(!_['isEmpty'](_0x5d0445[_0xa081('0x27')])){_0x47210d[util[_0xa081('0x12')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x5d0445['monitor_format'];_0x47210d[util[_0xa081('0x12')]('%s',_0xa081('0x28'))]=_0x3ec19c;}if(_0x395bb5&&_0x395bb5['Contact']){for(var _0x34511b in _0x395bb5['Contact']){if(_0x395bb5['Contact'][_0xa081('0x29')](_0x34511b)){if(!_['isNil'](_0x395bb5[_0xa081('0x2a')][_0x34511b])&&_0x34511b!=='id'&&_0x34511b!=='tags'&&_0x34511b!==_0xa081('0x2b')&&_0x34511b!=='updatedAt'){_0x47210d[util[_0xa081('0x12')](_0xa081('0x2c'),_0xa081('0x2d'),_[_0xa081('0x2e')](_0x34511b))]=_0x395bb5[_0xa081('0x2a')][_0x34511b];}}}}return _0x47210d;};exports[_0xa081('0x2f')]=function(_0xef459a){var _0x4fba3b={};for(var _0x4e4a0f in _0xef459a){if(_0xef459a[_0xa081('0x29')](_0x4e4a0f)){_0x4fba3b[util[_0xa081('0x12')]('%s',_[_0xa081('0x30')](_0x4e4a0f))]=_0xef459a[_0x4e4a0f];}}return{'variables':_0x4fba3b};};exports[_0xa081('0x31')]=function(_0x59ddbf,_0x1e5bcc){if(!_[_0xa081('0x16')](_0x59ddbf)){if(_0x59ddbf['hasOwnProperty'](_0xa081('0x32'))){if(_0x59ddbf['originated']>0x0){_0x59ddbf[_0xa081('0x32')]-=0x1;}else{logger[_0xa081('0x33')](_0xa081('0x34'),_0x1e5bcc);}}}else{logger[_0xa081('0x33')](_0xa081('0x35'),_0x1e5bcc);}};exports[_0xa081('0x36')]=function(_0x151be4){var _0x34dbb0=moment()['format'](_0xa081('0x37'));_0x151be4['state']=0xd;_0x151be4[_0xa081('0x38')]=_0xa081('0x39');_0x151be4[_0xa081('0x3a')]=_0x34dbb0;_0x151be4['responsetime']=_0x34dbb0;_0x151be4[_0xa081('0x3b')]=_0x34dbb0;};exports[_0xa081('0x3c')]=function(_0x141458,_0x504148,_0x391659){var _0x56afaf=moment()[_0xa081('0x12')](_0xa081('0x37'));_0x141458[_0xa081('0x3d')]=_0x504148;_0x141458[_0xa081('0x38')]=_0x391659;_0x141458['responsetime']=_0x56afaf;_0x141458['ringtime']=getSeconds(_0x141458['responsetime'],_0x141458[_0xa081('0x3a')]);};exports[_0xa081('0x3e')]=function(_0xd95eb8,_0x5afdd9,_0x226031){_0xd95eb8[_0xa081('0x3f')]=_0x5afdd9;_0xd95eb8['UserId']=_0x226031;};exports['logCustomer']=function(_0x1f9d80,_0x20371f,_0x1b6ac5){var _0x5cd24e=moment()['format'](_0xa081('0x37'));_0x1f9d80[_0xa081('0x3d')]=_0x20371f;_0x1f9d80[_0xa081('0x38')]=_0x1b6ac5;_0x1f9d80[_0xa081('0x40')]=_0x1f9d80['responsetime']?_0x1f9d80[_0xa081('0x40')]:_0x5cd24e;_0x1f9d80['endtime']=_0x1f9d80[_0xa081('0x3b')]?_0x1f9d80['endtime']:_0x5cd24e;_0x1f9d80['ringtime']=getSeconds(_0x1f9d80['responsetime']||0x0,_0x1f9d80['starttime']||0x0);_0x1f9d80[_0xa081('0x41')]=_0x1f9d80[_0xa081('0x42')]?getSeconds(_0x1f9d80[_0xa081('0x3b')],_0x1f9d80[_0xa081('0x42')]):0x0;};exports['isFailure']=function(_0x4129f6){return _0x4129f6==='Failure';};exports['variablesAction']=function(_0x2c7370,_0x3c31cf,_0xd06025,_0x12df1f,_0x25d765){var _0x39bd2b=_0x12df1f?_0xa081('0x43'):_0x2c7370[_0xa081('0x19')];_0x39bd2b=_0x25d765?_0xa081('0x44'):_0x39bd2b;return{'actionid':_0x2c7370[_0xa081('0x45')],'action':'originate','channel':_0x2c7370[_0xa081('0x46')],'callerid':util[_0xa081('0x12')](_0xa081('0x13'),_0x39bd2b,_0x2c7370[_0xa081('0x1a')]),'Exten':_0xa081('0x47'),'Context':'from-sip','Priority':'1','variable':_0xd06025,'timeout':(_0x3c31cf[_0xa081('0x48')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2c7370[_0xa081('0x45')]};};exports['totalGlobal']=function(_0x2e6924){return _0x2e6924[_0xa081('0x49')]+_0x2e6924['countcongestionretry']+_0x2e6924[_0xa081('0x4a')]+_0x2e6924[_0xa081('0x4b')]+_0x2e6924['countnosuchnumberretry'];};exports[_0xa081('0x4c')]=function(_0x560646){var _0x393d07=_[_0xa081('0x4d')](_0x560646);_0x393d07[_0xa081('0x3d')]=0xf;_0x393d07[_0xa081('0x38')]=_0xa081('0x4e');return _0x393d07;};exports[_0xa081('0x4f')]=function(_0x306d89,_0x272502,_0x7dbb97){var _0x4f7535={};_0x4f7535[_0x272502]=_0x306d89[_0x272502];_0x4f7535['active']=![];_0x4f7535[_0xa081('0x50')]=moment()['add'](_0x7dbb97,_0xa081('0x51'))[_0xa081('0x12')](_0xa081('0x37'));_0x4f7535['ContactId']=_0x306d89[_0xa081('0x1b')];_0x4f7535['ListId']=_0x306d89[_0xa081('0x52')];_0x4f7535['VoiceQueueId']=_0x306d89[_0xa081('0x1d')]||undefined;return _0x4f7535;};exports['decrementTalkink']=function(_0x2109da,_0x3c41b2){if(!_[_0xa081('0x16')](_0x2109da)){if(_0x2109da[_0xa081('0x53')]>0x0){_0x2109da[_0xa081('0x53')]-=0x1;}else{logger['error'](_0x3c41b2,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xa081('0x33')](_0x3c41b2,_0xa081('0x54'));}};exports[_0xa081('0x55')]=function(_0x134706){if(_0x134706<=0x0){return!![];}return![];};exports['buildObj']=function(_0x17f401,_0x29fb35,_0x4810d2){_0x17f401[_0xa081('0x56')]=_0x29fb35;_0x17f401[_0xa081('0x57')]=_0x17f401[_0xa081('0x58')];_0x17f401[_0xa081('0x59')]=_0x17f401['channelAgent'];if(_0x4810d2){_0x17f401[_0xa081('0x5a')]=_0x4810d2[_0xa081('0x5a')];}return _0x17f401;};exports[_0xa081('0x5b')]=function(_0x5c1cc1){var _0x494f19={};_0x494f19['queue']=_0x5c1cc1[_0xa081('0x58')];_0x494f19[_0xa081('0x59')]=_0x5c1cc1[_0xa081('0x46')];_0x494f19[_0xa081('0x45')]=_0x5c1cc1[_0xa081('0x45')];return _0x494f19;};exports['agentReadyId']=function(_0x1ca9ea){var _0x35a6e2=[];for(var _0x147adb in _0x1ca9ea){if(_0x1ca9ea[_0xa081('0x29')](_0x147adb)){if(!_[_0xa081('0x16')](_0x1ca9ea[_0x147adb])&&_0x1ca9ea[_0x147adb][_0xa081('0x3d')]===_0xa081('0x5c')&&_0x1ca9ea[_0x147adb][_0xa081('0x5d')]===_0xa081('0x5e')){_0x35a6e2[_0xa081('0x5f')](_0x1ca9ea[_0x147adb]['id']);}}}return _0x35a6e2;};exports[_0xa081('0x60')]=function(_0x4cd8ce){var _0x1116fd=moment()['milliseconds'](0x0);var _0xb3e6d4=moment(_0x4cd8ce)[_0xa081('0x5')](0x0);return _0x1116fd['diff'](_0xb3e6d4,_0xa081('0x61'));};exports[_0xa081('0x62')]=function(_0x1fb132){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x1fb132['ContactId'],'ListId':_0x1fb132[_0xa081('0x52')],'VoiceQueueId':_0x1fb132[_0xa081('0x1d')]||undefined,'CampaignId':_0x1fb132[_0xa081('0x63')]||undefined};};exports[_0xa081('0x64')]=function(_0x17d66a){if(_0x17d66a===_0xa081('0x45')||_0x17d66a===_0xa081('0x65')||_0x17d66a===_0xa081('0x58')||_0x17d66a===_0xa081('0x66')||_0x17d66a===_0xa081('0x67')||_0x17d66a===_0xa081('0x68')||_0x17d66a===_0xa081('0x3f')||_0x17d66a==='channelAgent'||_0x17d66a===_0xa081('0x19')||_0x17d66a==='active'||_0x17d66a===_0xa081('0x1a')||_0x17d66a===_0xa081('0x50')||_0x17d66a===_0xa081('0x49')||_0x17d66a===_0xa081('0x69')||_0x17d66a===_0xa081('0x4a')||_0x17d66a==='countglobal'||_0x17d66a===_0xa081('0x6a')||_0x17d66a===_0xa081('0x6b')||_0x17d66a==='callbackat'||_0x17d66a===_0xa081('0x6c')||_0x17d66a===_0xa081('0x1b')||_0x17d66a===_0xa081('0x52')||_0x17d66a===_0xa081('0x6d')||_0x17d66a===_0xa081('0x1d')||_0x17d66a===_0xa081('0x6e')||_0x17d66a===_0xa081('0x6f')||_0x17d66a===_0xa081('0x70')||_0x17d66a===_0xa081('0x71')||_0x17d66a===_0xa081('0x72')||_0x17d66a==='xmd-dialurl'||_0x17d66a===_0xa081('0x73')||_0x17d66a===_0xa081('0x74')||_0x17d66a===_0xa081('0x75')||_0x17d66a===_0xa081('0x76')||_0x17d66a===_0xa081('0x77')||_0x17d66a===_0xa081('0x78')||_0x17d66a===_0xa081('0x79')||_0x17d66a==='xmd-agiafter'||_0x17d66a==='xmd-agi'||_0x17d66a===_0xa081('0x7a')||_0x17d66a===_0xa081('0x7b')||_0x17d66a===_0xa081('0x7c')||_0x17d66a==='rtpaudioqosjitterbridged'||_0x17d66a===_0xa081('0x7d')||_0x17d66a===_0xa081('0x7e')||_0x17d66a===_0xa081('0x7f')||_0x17d66a===_0xa081('0x80')||_0x17d66a===_0xa081('0x7a')||_0x17d66a===_0xa081('0x7b')||_0x17d66a===_0xa081('0x7c')||_0x17d66a===_0xa081('0x81')||_0x17d66a==='rtpaudioqosloss'||_0x17d66a===_0xa081('0x7e')||_0x17d66a===_0xa081('0x7f')||_0x17d66a===_0xa081('0x80')||_0x17d66a==='bridgepeer'||_0x17d66a===_0xa081('0x82')||_0x17d66a===_0xa081('0x3d')||_0x17d66a==='statedesc'){return![];}return!![];};exports[_0xa081('0x83')]=function(_0x553fb2,_0x2a2aed){var _0x56cc8d,_0x4f254a,_0x1e4267;if(_0x2a2aed<=0x0){_0x2a2aed=0x1;}_0x56cc8d=new RegExp(_0xa081('0x84')+_0x2a2aed+'}$');_0x4f254a=Math[_0xa081('0x85')](0xa,_0x2a2aed-0x1);_0x1e4267=Math['pow'](0xa,_0x2a2aed)-0x1;return util['format']('%s',_['replace'](_0x553fb2,_0x56cc8d,_[_0xa081('0x86')](_0x4f254a,_0x1e4267)));};exports[_0xa081('0x87')]=function(_0x5b12c1){var _0xeb8495=_0x5b12c1['match'](/"(.*?)"/);return _0xeb8495?_0xeb8495[0x1]:_0x5b12c1;};exports['extractCalleridNumber']=function(_0x148020){var _0x2ae31b=_0x148020[_0xa081('0x88')](/<(.*?)>/);return _0x2ae31b?_0x2ae31b[0x1]:_0x148020;}; \ No newline at end of file +var _0xed11=['Queue','calleridname','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','toUpper','toLowerVariables','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','statedesc','Blacklist','starttime','responsetime','logAgent','state','ringtime','logLookAgent','membername','UserId','logCustomer','endtime','talktime','answertime','isFailure','variablesAction','BOOKED','uniqueid','originate','channelAgent','calleridnum','from-sip','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','Global','active','scheduledat','add','minutes','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','buildObj','lastevent','queue','interface','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status','reachable','push','getDiff','createBody','CampaignId','filterKey','type','campaigntype','dialAnswer','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-callerid','xmd-agiafter','rtpaudioqosbridged','rtpaudioqosloss','rtpaudioqos','rtpaudioqosjitter','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepvtcallid','\x5cw{0,','pow','replace','random','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','inspect','info','loggerError','message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','isActive','isNil','addVariables'];(function(_0x45eabb,_0x109669){var _0x1fe229=function(_0x5d895a){while(--_0x5d895a){_0x45eabb['push'](_0x45eabb['shift']());}};_0x1fe229(++_0x109669);}(_0xed11,0x72));var _0x1ed1=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xed11[_0x17d9e3];return _0x14192d;};'use strict';var util=require(_0x1ed1('0x0'));var _=require(_0x1ed1('0x1'));var moment=require(_0x1ed1('0x2'));var logger=require(_0x1ed1('0x3'))(_0x1ed1('0x4'));var ipAgi=process[_0x1ed1('0x5')][_0x1ed1('0x6')]||_0x1ed1('0x7');function getSeconds(_0x4496ec,_0x39f1c8){var _0x378ffc=moment(_0x4496ec)[_0x1ed1('0x8')](0x0);var _0x173ced=moment(_0x39f1c8)[_0x1ed1('0x8')](0x0);return _0x378ffc[_0x1ed1('0x9')](_0x173ced,_0x1ed1('0xa'));}exports[_0x1ed1('0xb')]=function(_0x275966){return function(_0x5aec22){logger[_0x1ed1('0xc')](_0x275966,util[_0x1ed1('0xd')](_0x5aec22,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0xd5175e,_0x1abea6){logger[_0x1ed1('0xe')](_0xd5175e,util[_0x1ed1('0xd')](_0x1abea6,{'showHidden':![],'depth':null}));};exports[_0x1ed1('0xf')]=function(_0x38cf78,_0x5e2586){logger[_0x1ed1('0xc')](_0x38cf78,util[_0x1ed1('0xd')](_0x5e2586,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x140924){return function(_0x55e68b){logger[_0x1ed1('0xe')](_0x140924,util[_0x1ed1('0xd')](_0x55e68b,{'showHidden':![],'depth':null}));};};exports[_0x1ed1('0x10')]=function(_0x56db6d,_0x1ad62f,_0x505063){return{'message':_0x56db6d,'unlock':_0x1ad62f,'active':_0x505063};};exports[_0x1ed1('0x11')]=function(_0x1e7f20,_0x43565c,_0x5b292a){if(!_[_0x1ed1('0x12')](_0x5b292a)&&_0x1ed1('0x13')===typeof _0x5b292a&&!_[_0x1ed1('0x14')](_0x5b292a)){if(!_[_0x1ed1('0x12')](_0x43565c)&&_0x1ed1('0x13')===typeof _0x43565c&&!_[_0x1ed1('0x14')](_0x43565c)){return util['format'](_0x1ed1('0x15'),_0x43565c,_0x5b292a);}return util[_0x1ed1('0x16')]('\x22%s\x22\x20<%s>',_0x5b292a,_0x5b292a);}if(!_[_0x1ed1('0x12')](_0x1e7f20)&&_0x1ed1('0x13')===typeof _0x1e7f20&&!_[_0x1ed1('0x14')](_0x1e7f20)){return _0x1e7f20;}return _0x1ed1('0x17');};exports[_0x1ed1('0x18')]=function(_0x55c336){if(_[_0x1ed1('0x19')](_0x55c336)){return![];}return _0x55c336;};exports[_0x1ed1('0x1a')]=function(_0x1b338b,_0x15d04f,_0x1d5c46,_0x3bdf2b,_0x5cf54f,_0x17eb15){var _0x112d51={'XMD-QUEUE':_0x15d04f[_0x1ed1('0x1b')]?_0x15d04f['Queue']['name']:'','XMD-CALLERID':_0x3bdf2b,'XMD-CALLERID-PREVIEW':_0x17eb15?util[_0x1ed1('0x16')](_0x1ed1('0x15'),_0x17eb15[_0x1ed1('0x1c')],_0x17eb15['calleridnum']):_0x3bdf2b,'XMD-DIALID':_0x5cf54f,'XMD-CONTACTID':_0x15d04f[_0x1ed1('0x1d')],'XMD-CDRTYPE':_0x1ed1('0x1e'),'CALLERID(all)':_0x3bdf2b,'XMD-VOICEQUEUEID':_0x15d04f[_0x1ed1('0x1f')],'XMD-DIALCHANNEL':_0x1d5c46,'XMD-DIALTIMEOUT':_0x1b338b[_0x1ed1('0x20')]||0x1e,'XMD-DIALOPTIONS':util[_0x1ed1('0x16')](_0x1ed1('0x21'),_0x1b338b['dialQueueProject2']?'g':'',_['isEmpty'](_0x1b338b[_0x1ed1('0x22')])?'':_0x1ed1('0x23')),'XMD-DIALURL':_0x1b338b[_0x1ed1('0x24')]||'','XMD-AGI':_0x1b338b[_0x1ed1('0x25')]?util['format'](_0x1ed1('0x26'),ipAgi,_0x1b338b[_0x1ed1('0x25')]):_0x1ed1('0x27'),'XMD-AGIAFTER':_0x1b338b[_0x1ed1('0x28')]?util['format'](_0x1ed1('0x26'),ipAgi,_0x1b338b[_0x1ed1('0x28')]):_0x1ed1('0x27'),'XMD-ORIGINATECALLERIDNUM':_0x17eb15?_0x17eb15[_0x1ed1('0x29')]:'','XMD-ORIGINATECALLERIDNAME':_0x17eb15?_0x17eb15[_0x1ed1('0x2a')]:'','XMD-DESTINATION':_0x1ed1('0x2b')};if(!_[_0x1ed1('0x14')](_0x1b338b[_0x1ed1('0x22')])){_0x112d51[util[_0x1ed1('0x16')]('%s',_0x1ed1('0x2c'))]=_0x1b338b[_0x1ed1('0x22')];_0x112d51[util['format']('%s',_0x1ed1('0x2d'))]=_0x5cf54f;}if(_0x15d04f&&_0x15d04f[_0x1ed1('0x2e')]){for(var _0x5139d3 in _0x15d04f['Contact']){if(_0x15d04f[_0x1ed1('0x2e')][_0x1ed1('0x2f')](_0x5139d3)){if(!_[_0x1ed1('0x19')](_0x15d04f[_0x1ed1('0x2e')][_0x5139d3])&&_0x5139d3!=='id'&&_0x5139d3!==_0x1ed1('0x30')&&_0x5139d3!==_0x1ed1('0x31')&&_0x5139d3!==_0x1ed1('0x32')){_0x112d51[util['format'](_0x1ed1('0x33'),'XMD-',_[_0x1ed1('0x34')](_0x5139d3))]=_0x15d04f[_0x1ed1('0x2e')][_0x5139d3];}}}}return _0x112d51;};exports[_0x1ed1('0x35')]=function(_0x431618){var _0x1834c8={};for(var _0x549276 in _0x431618){if(_0x431618[_0x1ed1('0x2f')](_0x549276)){_0x1834c8[util[_0x1ed1('0x16')]('%s',_['toLower'](_0x549276))]=_0x431618[_0x549276];}}return{'variables':_0x1834c8};};exports['updateOriginated']=function(_0x121d6b,_0x321324){if(!_[_0x1ed1('0x19')](_0x121d6b)){if(_0x121d6b['hasOwnProperty'](_0x1ed1('0x36'))){if(_0x121d6b[_0x1ed1('0x36')]>0x0){_0x121d6b[_0x1ed1('0x36')]-=0x1;}else{logger[_0x1ed1('0xc')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x321324);}}}else{logger[_0x1ed1('0xc')](_0x1ed1('0x37'),_0x321324);}};exports[_0x1ed1('0x38')]=function(_0x3b8052){var _0x7c02e0=moment()['format'](_0x1ed1('0x39'));_0x3b8052['state']=0xd;_0x3b8052[_0x1ed1('0x3a')]=_0x1ed1('0x3b');_0x3b8052[_0x1ed1('0x3c')]=_0x7c02e0;_0x3b8052[_0x1ed1('0x3d')]=_0x7c02e0;_0x3b8052['endtime']=_0x7c02e0;};exports[_0x1ed1('0x3e')]=function(_0x616402,_0x4ae428,_0x415ecb){var _0xa838bd=moment()['format'](_0x1ed1('0x39'));_0x616402[_0x1ed1('0x3f')]=_0x4ae428;_0x616402[_0x1ed1('0x3a')]=_0x415ecb;_0x616402['responsetime']=_0xa838bd;_0x616402[_0x1ed1('0x40')]=getSeconds(_0x616402['responsetime'],_0x616402[_0x1ed1('0x3c')]);};exports[_0x1ed1('0x41')]=function(_0xb2bc00,_0x553f01,_0x172f73){_0xb2bc00[_0x1ed1('0x42')]=_0x553f01;_0xb2bc00[_0x1ed1('0x43')]=_0x172f73;};exports[_0x1ed1('0x44')]=function(_0x3cc7dc,_0x5a2fea,_0x5b453a){var _0x10e1e7=moment()[_0x1ed1('0x16')](_0x1ed1('0x39'));_0x3cc7dc['state']=_0x5a2fea;_0x3cc7dc[_0x1ed1('0x3a')]=_0x5b453a;_0x3cc7dc['responsetime']=_0x3cc7dc[_0x1ed1('0x3d')]?_0x3cc7dc[_0x1ed1('0x3d')]:_0x10e1e7;_0x3cc7dc[_0x1ed1('0x45')]=_0x3cc7dc[_0x1ed1('0x45')]?_0x3cc7dc[_0x1ed1('0x45')]:_0x10e1e7;_0x3cc7dc[_0x1ed1('0x40')]=getSeconds(_0x3cc7dc[_0x1ed1('0x3d')]||0x0,_0x3cc7dc[_0x1ed1('0x3c')]||0x0);_0x3cc7dc[_0x1ed1('0x46')]=_0x3cc7dc[_0x1ed1('0x47')]?getSeconds(_0x3cc7dc[_0x1ed1('0x45')],_0x3cc7dc[_0x1ed1('0x47')]):0x0;};exports[_0x1ed1('0x48')]=function(_0x5e59f4){return _0x5e59f4==='Failure';};exports[_0x1ed1('0x49')]=function(_0x497ae5,_0x179bdd,_0x1b7de5,_0x5dd302,_0x3323ae){var _0x3c20f1=_0x5dd302?'RECALL':_0x497ae5[_0x1ed1('0x1c')];_0x3c20f1=_0x3323ae?_0x1ed1('0x4a'):_0x3c20f1;return{'actionid':_0x497ae5[_0x1ed1('0x4b')],'action':_0x1ed1('0x4c'),'channel':_0x497ae5[_0x1ed1('0x4d')],'callerid':util['format'](_0x1ed1('0x15'),_0x3c20f1,_0x497ae5[_0x1ed1('0x4e')]),'Exten':_0x1ed1('0x2b'),'Context':_0x1ed1('0x4f'),'Priority':'1','variable':_0x1b7de5,'timeout':(_0x179bdd['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x497ae5[_0x1ed1('0x4b')]};};exports[_0x1ed1('0x50')]=function(_0x3d394d){return _0x3d394d[_0x1ed1('0x51')]+_0x3d394d[_0x1ed1('0x52')]+_0x3d394d[_0x1ed1('0x53')]+_0x3d394d[_0x1ed1('0x54')]+_0x3d394d[_0x1ed1('0x55')];};exports['cloneAction']=function(_0x18cd04){var _0x5c7366=_['clone'](_0x18cd04);_0x5c7366[_0x1ed1('0x3f')]=0xf;_0x5c7366[_0x1ed1('0x3a')]=_0x1ed1('0x56');return _0x5c7366;};exports['scheduledAt']=function(_0x328f54,_0x5c32dc,_0x1d02da){var _0x2abffb={};_0x2abffb[_0x5c32dc]=_0x328f54[_0x5c32dc];_0x2abffb[_0x1ed1('0x57')]=![];_0x2abffb[_0x1ed1('0x58')]=moment()[_0x1ed1('0x59')](_0x1d02da,_0x1ed1('0x5a'))[_0x1ed1('0x16')](_0x1ed1('0x39'));_0x2abffb[_0x1ed1('0x1d')]=_0x328f54[_0x1ed1('0x1d')];_0x2abffb['ListId']=_0x328f54[_0x1ed1('0x5b')];_0x2abffb[_0x1ed1('0x1f')]=_0x328f54[_0x1ed1('0x1f')]||undefined;return _0x2abffb;};exports['decrementTalkink']=function(_0x489fe5,_0x53c846){if(!_[_0x1ed1('0x19')](_0x489fe5)){if(_0x489fe5[_0x1ed1('0x5c')]>0x0){_0x489fe5[_0x1ed1('0x5c')]-=0x1;}else{logger[_0x1ed1('0xc')](_0x53c846,_0x1ed1('0x5d'));}}else{logger[_0x1ed1('0xc')](_0x53c846,_0x1ed1('0x5e'));}};exports['IsNotLoggedIn']=function(_0x1f1b56){if(_0x1f1b56<=0x0){return!![];}return![];};exports[_0x1ed1('0x5f')]=function(_0x35ef91,_0x2d299f,_0x327680){_0x35ef91[_0x1ed1('0x60')]=_0x2d299f;_0x35ef91['name']=_0x35ef91[_0x1ed1('0x61')];_0x35ef91[_0x1ed1('0x62')]=_0x35ef91[_0x1ed1('0x4d')];if(_0x327680){_0x35ef91['mandatoryDisposition']=_0x327680[_0x1ed1('0x63')];}return _0x35ef91;};exports[_0x1ed1('0x64')]=function(_0x1e3d7f){var _0xd3be3e={};_0xd3be3e['queue']=_0x1e3d7f[_0x1ed1('0x61')];_0xd3be3e[_0x1ed1('0x62')]=_0x1e3d7f[_0x1ed1('0x4d')];_0xd3be3e[_0x1ed1('0x4b')]=_0x1e3d7f[_0x1ed1('0x4b')];return _0xd3be3e;};exports[_0x1ed1('0x65')]=function(_0x5d31af){var _0x3d860b=[];for(var _0x27919a in _0x5d31af){if(_0x5d31af[_0x1ed1('0x2f')](_0x27919a)){if(!_['isNil'](_0x5d31af[_0x27919a])&&_0x5d31af[_0x27919a][_0x1ed1('0x3f')]===_0x1ed1('0x66')&&_0x5d31af[_0x27919a][_0x1ed1('0x67')]===_0x1ed1('0x68')){_0x3d860b[_0x1ed1('0x69')](_0x5d31af[_0x27919a]['id']);}}}return _0x3d860b;};exports[_0x1ed1('0x6a')]=function(_0x15a275){var _0x138b2c=moment()[_0x1ed1('0x8')](0x0);var _0x4c3266=moment(_0x15a275)[_0x1ed1('0x8')](0x0);return _0x138b2c[_0x1ed1('0x9')](_0x4c3266,_0x1ed1('0xa'));};exports[_0x1ed1('0x6b')]=function(_0x56124d){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x56124d[_0x1ed1('0x1d')],'ListId':_0x56124d[_0x1ed1('0x5b')],'VoiceQueueId':_0x56124d[_0x1ed1('0x1f')]||undefined,'CampaignId':_0x56124d[_0x1ed1('0x6c')]||undefined};};exports[_0x1ed1('0x6d')]=function(_0x4b9a9d){if(_0x4b9a9d===_0x1ed1('0x4b')||_0x4b9a9d==='idContact'||_0x4b9a9d===_0x1ed1('0x61')||_0x4b9a9d===_0x1ed1('0x6e')||_0x4b9a9d===_0x1ed1('0x6f')||_0x4b9a9d===_0x1ed1('0x70')||_0x4b9a9d===_0x1ed1('0x42')||_0x4b9a9d===_0x1ed1('0x4d')||_0x4b9a9d===_0x1ed1('0x1c')||_0x4b9a9d===_0x1ed1('0x57')||_0x4b9a9d===_0x1ed1('0x4e')||_0x4b9a9d===_0x1ed1('0x58')||_0x4b9a9d===_0x1ed1('0x51')||_0x4b9a9d===_0x1ed1('0x52')||_0x4b9a9d===_0x1ed1('0x53')||_0x4b9a9d===_0x1ed1('0x71')||_0x4b9a9d===_0x1ed1('0x72')||_0x4b9a9d===_0x1ed1('0x73')||_0x4b9a9d===_0x1ed1('0x74')||_0x4b9a9d===_0x1ed1('0x75')||_0x4b9a9d==='ContactId'||_0x4b9a9d===_0x1ed1('0x5b')||_0x4b9a9d===_0x1ed1('0x43')||_0x4b9a9d===_0x1ed1('0x1f')||_0x4b9a9d===_0x1ed1('0x76')||_0x4b9a9d===_0x1ed1('0x77')||_0x4b9a9d==='xmd-queue'||_0x4b9a9d==='xmd-phone'||_0x4b9a9d===_0x1ed1('0x78')||_0x4b9a9d===_0x1ed1('0x79')||_0x4b9a9d===_0x1ed1('0x7a')||_0x4b9a9d===_0x1ed1('0x7b')||_0x4b9a9d==='xmd-dialid'||_0x4b9a9d===_0x1ed1('0x7c')||_0x4b9a9d==='xmd-contactid'||_0x4b9a9d==='xmd-cdrtype'||_0x4b9a9d===_0x1ed1('0x7d')||_0x4b9a9d===_0x1ed1('0x7e')||_0x4b9a9d==='xmd-agi'||_0x4b9a9d==='rtpaudioqos'||_0x4b9a9d===_0x1ed1('0x7f')||_0x4b9a9d==='rtpaudioqosjitter'||_0x4b9a9d==='rtpaudioqosjitterbridged'||_0x4b9a9d===_0x1ed1('0x80')||_0x4b9a9d==='rtpaudioqoslossbridged'||_0x4b9a9d==='rtpaudioqosrtt'||_0x4b9a9d==='rtpaudioqosrttbridged'||_0x4b9a9d===_0x1ed1('0x81')||_0x4b9a9d===_0x1ed1('0x7f')||_0x4b9a9d===_0x1ed1('0x82')||_0x4b9a9d==='rtpaudioqosjitterbridged'||_0x4b9a9d===_0x1ed1('0x80')||_0x4b9a9d===_0x1ed1('0x83')||_0x4b9a9d===_0x1ed1('0x84')||_0x4b9a9d===_0x1ed1('0x85')||_0x4b9a9d==='bridgepeer'||_0x4b9a9d===_0x1ed1('0x86')||_0x4b9a9d==='state'||_0x4b9a9d===_0x1ed1('0x3a')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x24379d,_0x426530){var _0x18b03f,_0x39bd51,_0x513f4d;if(_0x426530<=0x0){_0x426530=0x1;}_0x18b03f=new RegExp(_0x1ed1('0x87')+_0x426530+'}$');_0x39bd51=Math[_0x1ed1('0x88')](0xa,_0x426530-0x1);_0x513f4d=Math[_0x1ed1('0x88')](0xa,_0x426530)-0x1;return util[_0x1ed1('0x16')]('%s',_[_0x1ed1('0x89')](_0x24379d,_0x18b03f,_[_0x1ed1('0x8a')](_0x39bd51,_0x513f4d)));};exports['extractCalleridName']=function(_0x1bb999){var _0x115f90=_0x1bb999[_0x1ed1('0x8b')](/"(.*?)"/);return _0x115f90?_0x115f90[0x1]:_0x1bb999;};exports[_0x1ed1('0x8c')]=function(_0x2fa07b){var _0xb3436a=_0x2fa07b[_0x1ed1('0x8b')](/<(.*?)>/);return _0xb3436a?_0xb3436a[0x1]:_0x2fa07b;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index ee4bb9f..feb1770 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 _0xaa61=['string','boolean','queueremove','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd'];(function(_0x2245a8,_0x3e9a40){var _0x2f74a0=function(_0x3a9e8f){while(--_0x3a9e8f){_0x2245a8['push'](_0x2245a8['shift']());}};_0x2f74a0(++_0x3e9a40);}(_0xaa61,0xfb));var _0x1aa6=function(_0x1bcb9c,_0x2e58c8){_0x1bcb9c=_0x1bcb9c-0x0;var _0x15aa32=_0xaa61[_0x1bcb9c];return _0x15aa32;};'use strict';exports[_0x1aa6('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x1aa6('0x1'),'required':!![]},'membername':{'type':_0x1aa6('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0x1aa6('0x2'),'required':![]}};exports[_0x1aa6('0x3')]={'queue':{'type':_0x1aa6('0x1'),'required':!![]},'interface':{'type':_0x1aa6('0x1'),'required':!![]}};exports[_0x1aa6('0x4')]={'interface':{'type':'string','required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0x1aa6('0x1'),'required':![]}};exports[_0x1aa6('0x5')]={'module':{'type':_0x1aa6('0x1'),'required':![]}};exports[_0x1aa6('0x6')]={'uniqueid':{'type':_0x1aa6('0x1'),'required':!![]}};exports[_0x1aa6('0x7')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x1aa6('0x1')},'format':{'type':_0x1aa6('0x1')},'mixmonitorid':{'type':'string'}};exports[_0x1aa6('0x8')]={'uniqueid':{'type':'string','required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x1aa6('0x1'),'required':!![]},'exten':{'type':_0x1aa6('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0xad3c=['voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','queueremove','queuepause','boolean','reload','voicequeuechannel'];(function(_0x3a7caa,_0x5d78ed){var _0x33ef41=function(_0xe9fc49){while(--_0xe9fc49){_0x3a7caa['push'](_0x3a7caa['shift']());}};_0x33ef41(++_0x5d78ed);}(_0xad3c,0x12e));var _0xcad3=function(_0x493ca7,_0x4d050e){_0x493ca7=_0x493ca7-0x0;var _0x25b114=_0xad3c[_0x493ca7];return _0x25b114;};'use strict';exports[_0xcad3('0x0')]={'queue':{'type':_0xcad3('0x1'),'required':!![]},'interface':{'type':_0xcad3('0x1'),'required':!![]},'membername':{'type':_0xcad3('0x1'),'required':!![]},'penalty':{'type':_0xcad3('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xcad3('0x3')]={'queue':{'type':_0xcad3('0x1'),'required':!![]},'interface':{'type':_0xcad3('0x1'),'required':!![]}};exports[_0xcad3('0x4')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0xcad3('0x5')},'reason':{'type':_0xcad3('0x1'),'required':![]}};exports[_0xcad3('0x6')]={'module':{'type':_0xcad3('0x1'),'required':![]}};exports[_0xcad3('0x7')]={'uniqueid':{'type':_0xcad3('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0xcad3('0x1'),'required':!![]},'filename':{'type':_0xcad3('0x1')},'format':{'type':_0xcad3('0x1')},'mixmonitorid':{'type':'string'}};exports[_0xcad3('0x8')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xcad3('0x9')]={'uniqueid':{'type':_0xcad3('0x1'),'required':!![]},'exten':{'type':_0xcad3('0x1'),'required':!![]},'context':{'type':_0xcad3('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 7479876..981dd3e 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 _0xae5a=['bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','voiceQueues','triggers','campaigns','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','hasOwnProperty','mapKeys','SIP/%s','name','isNil','interface','total','answered','sumHoldTime','sumBillable','isEmpty','ivrTotalCallsDays','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','length','format','mergeFromDatabase','initTelephones','telephones','isUndefined','initTrunks','trunks','initTriggers','initTemplates','templates','initZendeskAccounts','initSalesforceAccounts','freshdeskAccounts','initZohoAccounts','initDeskAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','uniqueid','queuecallerexit','unmanaged','queuecallerleaveAt','queuecallerjoinAt','seconds','sumDuration','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','diff','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initCampaignHopperHistory','initFaxAccounts','faxAccounts'];(function(_0x486cb8,_0x2e8838){var _0x1e7d94=function(_0x34a00e){while(--_0x34a00e){_0x486cb8['push'](_0x486cb8['shift']());}};_0x1e7d94(++_0x2e8838);}(_0xae5a,0x15c));var _0xaae5=function(_0x5189e2,_0x565ba4){_0x5189e2=_0x5189e2-0x0;var _0x5f2763=_0xae5a[_0x5189e2];return _0x5f2763;};'use strict';var BPromise=require(_0xaae5('0x0'));var util=require(_0xaae5('0x1'));var _=require(_0xaae5('0x2'));var moment=require(_0xaae5('0x3'));var Agent=require(_0xaae5('0x4'));var Telephone=require(_0xaae5('0x5'));var Trunk=require(_0xaae5('0x6'));var VoiceQueue=require(_0xaae5('0x7'));var Trigger=require(_0xaae5('0x8'));var Template=require(_0xaae5('0x9'));var Campaign=require('../model/campaign');var VoiceExtension=require(_0xaae5('0xa'));var ZendeskAccount=require(_0xaae5('0xb'));var SalesforceAccount=require(_0xaae5('0xc'));var FreshdeskAccount=require(_0xaae5('0xd'));var SugarcrmAccount=require(_0xaae5('0xe'));var ZohoAccount=require(_0xaae5('0xf'));var DeskAccount=require(_0xaae5('0x10'));var VtigerAccount=require(_0xaae5('0x11'));var ServicenowAccount=require(_0xaae5('0x12'));var Dynamics365Account=require(_0xaae5('0x13'));var FreshsalesAccount=require(_0xaae5('0x14'));var FaxAccount=require(_0xaae5('0x15'));var Realtime=function(){this[_0xaae5('0x16')]={};this['telephones']={};this['trunks']={};this[_0xaae5('0x17')]={};this[_0xaae5('0x18')]={};this[_0xaae5('0x19')]={};this['templates']={};this[_0xaae5('0x1a')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xaae5('0x1b')]={};this[_0xaae5('0x1c')]={};this[_0xaae5('0x1d')]={};this[_0xaae5('0x1e')]={};this[_0xaae5('0x1f')]={};this[_0xaae5('0x20')]={};this[_0xaae5('0x21')]={};this[_0xaae5('0x22')]={};this['sugarcrmAccounts']={};this['freshdeskAccounts']={};this[_0xaae5('0x23')]={};this[_0xaae5('0x24')]={};this[_0xaae5('0x25')]={};this['servicenowAccounts']={};this[_0xaae5('0x26')]={};this[_0xaae5('0x27')]={};this['faxAccounts']={};};function freeIsNotKey(_0x4c6fd1,_0x35cd6,_0x18fa09){var _0x836026=_['mapKeys'](_0x4c6fd1,function(_0x930454,_0x5ae3cd){return _0x930454[_0x18fa09];});for(var _0x47d896 in _0x35cd6){if(_0x35cd6[_0xaae5('0x28')](_0x47d896)){if(!_0x836026[_0x47d896]){delete _0x35cd6[_0x47d896];}}}}function freeIsNotKeySip(_0x32ed06,_0x5da3f0){var _0x329d9b=_[_0xaae5('0x29')](_0x32ed06,function(_0x21f77d,_0x37f95b){return util['format'](_0xaae5('0x2a'),_0x21f77d[_0xaae5('0x2b')]);});for(var _0x487c49 in _0x5da3f0){if(_0x5da3f0['hasOwnProperty'](_0x487c49)){if(!_0x329d9b[_0x487c49]){delete _0x5da3f0[_0x487c49];}}}}function freeIsNotKeyAgent(_0x195603,_0x467b57){var _0x16f7fe=_['mapKeys'](_0x195603,function(_0x38ef98,_0x4fa6e8){var _0x2225d9=_[_0xaae5('0x2c')](_0x38ef98['interface'])?util['format'](_0xaae5('0x2a'),_0x38ef98[_0xaae5('0x2b')]):_0x38ef98[_0xaae5('0x2d')];return _0x2225d9;});for(var _0x10d9d3 in _0x467b57){if(_0x467b57['hasOwnProperty'](_0x10d9d3)){if(!_0x16f7fe[_0x10d9d3]){delete _0x467b57[_0x10d9d3];}}}}function clearVoiceCallReports(_0x5da932){_0x5da932[_0xaae5('0x2e')]=0x0;_0x5da932[_0xaae5('0x2f')]=0x0;_0x5da932[_0xaae5('0x30')]=0x0;_0x5da932['sumDuration']=0x0;_0x5da932[_0xaae5('0x31')]=0x0;}function clearCampaigns(_0x30a4ee){if(!_[_0xaae5('0x32')](_0x30a4ee)){for(var _0x266eb4 in _0x30a4ee){if(_0x30a4ee[_0xaae5('0x28')](_0x266eb4)){_0x30a4ee[_0x266eb4][_0xaae5('0x33')]=0x0;_0x30a4ee[_0x266eb4]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x5cdc92){if(!_['isEmpty'](_0x5cdc92)){for(var _0x435fca in _0x5cdc92){if(_0x5cdc92[_0xaae5('0x28')](_0x435fca)){_0x5cdc92[_0x435fca][_0xaae5('0x2e')]=0x0;_0x5cdc92[_0x435fca][_0xaae5('0x2f')]=0x0;_0x5cdc92[_0x435fca]['unmanaged']=0x0;_0x5cdc92[_0x435fca][_0xaae5('0x34')]=0x0;_0x5cdc92[_0x435fca]['sumHoldTime']=0x0;_0x5cdc92[_0x435fca]['sumDuration']=0x0;_0x5cdc92[_0x435fca][_0xaae5('0x31')]=0x0;_0x5cdc92[_0x435fca][_0xaae5('0x35')]=0x0;_0x5cdc92[_0x435fca][_0xaae5('0x36')]=0x0;_0x5cdc92[_0x435fca][_0xaae5('0x37')]=0x0;_0x5cdc92[_0x435fca][_0xaae5('0x38')]=0x0;_0x5cdc92[_0x435fca][_0xaae5('0x39')]=0x0;_0x5cdc92[_0x435fca][_0xaae5('0x3a')]=0x0;_0x5cdc92[_0x435fca][_0xaae5('0x3b')]=0x0;_0x5cdc92[_0x435fca][_0xaae5('0x3c')]=0x0;_0x5cdc92[_0x435fca]['outboundBlacklistCallsDay']=0x0;_0x5cdc92[_0x435fca][_0xaae5('0x3d')]=0x0;_0x5cdc92[_0x435fca][_0xaae5('0x3e')]=0x0;_0x5cdc92[_0x435fca][_0xaae5('0x3f')]=0x0;_0x5cdc92[_0x435fca]['outboundAnswerAgiCallsDay']=0x0;_0x5cdc92[_0x435fca][_0xaae5('0x40')]=0x0;_0x5cdc92[_0x435fca][_0xaae5('0x41')]=!![];}}}}Realtime[_0xaae5('0x42')]['mergeFromDatabase']=function(_0x2ff07a,_0x1af213){for(var _0x20695e in _0x1af213){if(_0x2ff07a[_0xaae5('0x28')](_0x20695e)){_0x2ff07a[_0x20695e]=_0x1af213[_0x20695e];}}};Realtime[_0xaae5('0x42')][_0xaae5('0x43')]=function(){var _0x31399a=this;return function(_0x28dfe2){if(_0x28dfe2){freeIsNotKeyAgent(_0x28dfe2,_0x31399a[_0xaae5('0x16')]);for(var _0x639f3=0x0,_0x27d640={},_0x207864={};_0x639f3<_0x28dfe2[_0xaae5('0x44')];_0x639f3+=0x1){_0x27d640=_0x28dfe2[_0x639f3];var _0x349b73=_[_0xaae5('0x2c')](_0x27d640[_0xaae5('0x2d')])?util[_0xaae5('0x45')](_0xaae5('0x2a'),_0x27d640[_0xaae5('0x2b')]):_0x27d640['interface'];if(_['isUndefined'](_0x31399a[_0xaae5('0x16')][_0x349b73])){_0x31399a[_0xaae5('0x16')][_0x349b73]=new Agent(_0x27d640);}else{_0x31399a[_0xaae5('0x46')](_0x31399a[_0xaae5('0x16')][_0x349b73],_0x27d640);}}}return _0x31399a[_0xaae5('0x16')];};};Realtime['prototype'][_0xaae5('0x47')]=function(){var _0x3eae7d=this;return function(_0x674e6){if(_0x674e6){freeIsNotKeySip(_0x674e6,_0x3eae7d[_0xaae5('0x48')]);for(var _0x1e60e6=0x0,_0x2451f5={},_0x4dc843={};_0x1e60e6<_0x674e6[_0xaae5('0x44')];_0x1e60e6+=0x1){_0x2451f5=_0x674e6[_0x1e60e6];if(_[_0xaae5('0x49')](_0x3eae7d[_0xaae5('0x48')][util[_0xaae5('0x45')](_0xaae5('0x2a'),_0x2451f5[_0xaae5('0x2b')])])){_0x3eae7d[_0xaae5('0x48')][util[_0xaae5('0x45')](_0xaae5('0x2a'),_0x2451f5[_0xaae5('0x2b')])]=new Telephone(_0x2451f5);}else{_0x3eae7d[_0xaae5('0x46')](_0x3eae7d[_0xaae5('0x48')][util[_0xaae5('0x45')](_0xaae5('0x2a'),_0x2451f5[_0xaae5('0x2b')])],_0x2451f5);}}}return _0x3eae7d[_0xaae5('0x48')];};};Realtime[_0xaae5('0x42')][_0xaae5('0x4a')]=function(){var _0x334dc8=this;return function(_0x5585c1){if(_0x5585c1){freeIsNotKeySip(_0x5585c1,_0x334dc8[_0xaae5('0x4b')]);for(var _0xcc35ab=0x0,_0x201c0c={},_0x3070d5={};_0xcc35ab<_0x5585c1['length'];_0xcc35ab+=0x1){_0x201c0c=_0x5585c1[_0xcc35ab];if(_[_0xaae5('0x49')](_0x334dc8['trunks'][util[_0xaae5('0x45')](_0xaae5('0x2a'),_0x201c0c['name'])])){_0x334dc8['trunks'][util[_0xaae5('0x45')](_0xaae5('0x2a'),_0x201c0c[_0xaae5('0x2b')])]=new Trunk(_0x201c0c);}else{_0x334dc8[_0xaae5('0x46')](_0x334dc8[_0xaae5('0x4b')][util[_0xaae5('0x45')](_0xaae5('0x2a'),_0x201c0c[_0xaae5('0x2b')])],_0x201c0c);}}}return _0x334dc8[_0xaae5('0x4b')];};};Realtime[_0xaae5('0x42')]['initVoiceQueues']=function(){var _0x4f1ea9=this;return function(_0x4bbe76){if(_0x4bbe76){freeIsNotKey(_0x4bbe76,_0x4f1ea9[_0xaae5('0x17')],_0xaae5('0x2b'));for(var _0x4e30be=0x0,_0x259a0c={},_0xe7d801={};_0x4e30be<_0x4bbe76[_0xaae5('0x44')];_0x4e30be+=0x1){_0x259a0c=_0x4bbe76[_0x4e30be];if(_[_0xaae5('0x49')](_0x4f1ea9[_0xaae5('0x17')][_0x259a0c[_0xaae5('0x2b')]])){_0x4f1ea9[_0xaae5('0x17')][_0x259a0c[_0xaae5('0x2b')]]=new VoiceQueue(_0x259a0c);}else{_0x4f1ea9[_0xaae5('0x46')](_0x4f1ea9[_0xaae5('0x17')][_0x259a0c[_0xaae5('0x2b')]],_0x259a0c);}}}return _0x4f1ea9[_0xaae5('0x17')];};};Realtime[_0xaae5('0x42')][_0xaae5('0x4c')]=function(){var _0x229da5=this;return function(_0xe2035){if(_0xe2035){freeIsNotKey(_0xe2035,_0x229da5['triggers'],'id');for(var _0x2e437f=0x0,_0x49b31f={},_0x23cf57={};_0x2e437f<_0xe2035[_0xaae5('0x44')];_0x2e437f+=0x1){_0x49b31f=_0xe2035[_0x2e437f];if(_['isUndefined'](_0x229da5[_0xaae5('0x18')][_0x49b31f['id']])){_0x229da5[_0xaae5('0x18')][_0x49b31f['id']]=new Trigger(_0x49b31f);}else{_0x229da5[_0xaae5('0x46')](_0x229da5[_0xaae5('0x18')][_0x49b31f['id']],_0x49b31f);}}}return _0x229da5['triggers'];};};Realtime[_0xaae5('0x42')][_0xaae5('0x4d')]=function(){var _0x18d6c8=this;return function(_0x372117){if(_0x372117){freeIsNotKey(_0x372117,_0x18d6c8[_0xaae5('0x4e')],'id');for(var _0x3dca59=0x0,_0x3d58d6={},_0x3fac16={};_0x3dca59<_0x372117[_0xaae5('0x44')];_0x3dca59+=0x1){_0x3d58d6=_0x372117[_0x3dca59];if(_['isUndefined'](_0x18d6c8[_0xaae5('0x4e')][_0x3d58d6['id']])){_0x18d6c8[_0xaae5('0x4e')][_0x3d58d6['id']]=new Template(_0x3d58d6);}else{_0x18d6c8['mergeFromDatabase'](_0x18d6c8['templates'][_0x3d58d6['id']],_0x3d58d6);}}}return _0x18d6c8[_0xaae5('0x4e')];};};Realtime[_0xaae5('0x42')][_0xaae5('0x4f')]=function(){var _0x5c0909=this;return function(_0x4898c7){if(_0x4898c7){freeIsNotKey(_0x4898c7,_0x5c0909[_0xaae5('0x21')],'id');for(var _0x307555=0x0,_0xd56068={},_0x157cc3={};_0x307555<_0x4898c7['length'];_0x307555+=0x1){_0xd56068=_0x4898c7[_0x307555];if(_[_0xaae5('0x49')](_0x5c0909['zendeskAccounts'][_0xd56068['id']])){_0x5c0909[_0xaae5('0x21')][_0xd56068['id']]=new ZendeskAccount(_0xd56068);}else{_0x5c0909[_0xaae5('0x46')](_0x5c0909[_0xaae5('0x21')][_0xd56068['id']],_0xd56068);}}}return _0x5c0909['zendeskAccounts'];};};Realtime[_0xaae5('0x42')][_0xaae5('0x50')]=function(){var _0x23c24e=this;return function(_0x382266){if(_0x382266){freeIsNotKey(_0x382266,_0x23c24e[_0xaae5('0x22')],'id');for(var _0x7d6cfc=0x0,_0x4fde3d={},_0x170851={};_0x7d6cfc<_0x382266[_0xaae5('0x44')];_0x7d6cfc+=0x1){_0x4fde3d=_0x382266[_0x7d6cfc];if(_[_0xaae5('0x49')](_0x23c24e[_0xaae5('0x22')][_0x4fde3d['id']])){_0x23c24e[_0xaae5('0x22')][_0x4fde3d['id']]=new SalesforceAccount(_0x4fde3d);}else{_0x23c24e[_0xaae5('0x46')](_0x23c24e['salesforceAccounts'][_0x4fde3d['id']],_0x4fde3d);}}}return _0x23c24e['salesforceAccounts'];};};Realtime[_0xaae5('0x42')]['initFreshdeskAccounts']=function(){var _0xbdaf9e=this;return function(_0x123f0e){if(_0x123f0e){freeIsNotKey(_0x123f0e,_0xbdaf9e[_0xaae5('0x51')],'id');for(var _0x48ec30=0x0,_0x3626fb={},_0x564ecb={};_0x48ec30<_0x123f0e[_0xaae5('0x44')];_0x48ec30+=0x1){_0x3626fb=_0x123f0e[_0x48ec30];if(_[_0xaae5('0x49')](_0xbdaf9e['freshdeskAccounts'][_0x3626fb['id']])){_0xbdaf9e[_0xaae5('0x51')][_0x3626fb['id']]=new FreshdeskAccount(_0x3626fb);}else{_0xbdaf9e[_0xaae5('0x46')](_0xbdaf9e[_0xaae5('0x51')][_0x3626fb['id']],_0x3626fb);}}}return _0xbdaf9e[_0xaae5('0x51')];};};Realtime[_0xaae5('0x42')][_0xaae5('0x52')]=function(){var _0x4f22a4=this;return function(_0x101520){if(_0x101520){freeIsNotKey(_0x101520,_0x4f22a4['zohoAccounts'],'id');for(var _0x2beb36=0x0,_0x20d03d={},_0x2cd245={};_0x2beb36<_0x101520[_0xaae5('0x44')];_0x2beb36+=0x1){_0x20d03d=_0x101520[_0x2beb36];if(_[_0xaae5('0x49')](_0x4f22a4['zohoAccounts'][_0x20d03d['id']])){_0x4f22a4[_0xaae5('0x23')][_0x20d03d['id']]=new ZohoAccount(_0x20d03d);}else{_0x4f22a4[_0xaae5('0x46')](_0x4f22a4['zohoAccounts'][_0x20d03d['id']],_0x20d03d);}}}return _0x4f22a4[_0xaae5('0x23')];};};Realtime[_0xaae5('0x42')][_0xaae5('0x53')]=function(){var _0x308da0=this;return function(_0x4e1e11){if(_0x4e1e11){freeIsNotKey(_0x4e1e11,_0x308da0['deskAccounts'],'id');for(var _0x17fa64=0x0,_0x2d7829={},_0x2a7a6f={};_0x17fa64<_0x4e1e11['length'];_0x17fa64+=0x1){_0x2d7829=_0x4e1e11[_0x17fa64];if(_['isUndefined'](_0x308da0['deskAccounts'][_0x2d7829['id']])){_0x308da0['deskAccounts'][_0x2d7829['id']]=new DeskAccount(_0x2d7829);}else{_0x308da0[_0xaae5('0x46')](_0x308da0[_0xaae5('0x24')][_0x2d7829['id']],_0x2d7829);}}}return _0x308da0['deskAccounts'];};};Realtime['prototype']['initSugarcrmAccounts']=function(){var _0x1e93a7=this;return function(_0x312a8f){if(_0x312a8f){freeIsNotKey(_0x312a8f,_0x1e93a7['sugarcrmAccounts'],'id');for(var _0x4c3ba0=0x0,_0x5e69cb={},_0x4c994a={};_0x4c3ba0<_0x312a8f[_0xaae5('0x44')];_0x4c3ba0+=0x1){_0x5e69cb=_0x312a8f[_0x4c3ba0];if(_['isUndefined'](_0x1e93a7[_0xaae5('0x54')][_0x5e69cb['id']])){_0x1e93a7[_0xaae5('0x54')][_0x5e69cb['id']]=new SugarcrmAccount(_0x5e69cb);}else{_0x1e93a7[_0xaae5('0x46')](_0x1e93a7[_0xaae5('0x54')][_0x5e69cb['id']],_0x5e69cb);}}}return _0x1e93a7[_0xaae5('0x54')];};};Realtime['prototype'][_0xaae5('0x55')]=function(){var _0x1b8090=this;return function(_0x2399a6){if(_0x2399a6){freeIsNotKey(_0x2399a6,_0x1b8090[_0xaae5('0x25')],'id');for(var _0x1e8010=0x0,_0x1d139b={},_0x6629d5={};_0x1e8010<_0x2399a6['length'];_0x1e8010+=0x1){_0x1d139b=_0x2399a6[_0x1e8010];if(_[_0xaae5('0x49')](_0x1b8090[_0xaae5('0x25')][_0x1d139b['id']])){_0x1b8090[_0xaae5('0x25')][_0x1d139b['id']]=new VtigerAccount(_0x1d139b);}else{_0x1b8090['mergeFromDatabase'](_0x1b8090[_0xaae5('0x25')][_0x1d139b['id']],_0x1d139b);}}}return _0x1b8090[_0xaae5('0x25')];};};Realtime[_0xaae5('0x42')][_0xaae5('0x56')]=function(){var _0x22a0ea=this;return function(_0x31aabe){if(_0x31aabe){freeIsNotKey(_0x31aabe,_0x22a0ea['servicenowAccounts'],'id');for(var _0x3ccee4=0x0,_0x2f45e8={},_0x27a212={};_0x3ccee4<_0x31aabe['length'];_0x3ccee4+=0x1){_0x2f45e8=_0x31aabe[_0x3ccee4];if(_[_0xaae5('0x49')](_0x22a0ea[_0xaae5('0x57')][_0x2f45e8['id']])){_0x22a0ea['servicenowAccounts'][_0x2f45e8['id']]=new ServicenowAccount(_0x2f45e8);}else{_0x22a0ea[_0xaae5('0x46')](_0x22a0ea[_0xaae5('0x57')][_0x2f45e8['id']],_0x2f45e8);}}}return _0x22a0ea[_0xaae5('0x57')];};};Realtime[_0xaae5('0x42')][_0xaae5('0x58')]=function(){var _0x158f19=this;return function(_0x556f39){if(_0x556f39){freeIsNotKey(_0x556f39,_0x158f19[_0xaae5('0x26')],'id');for(var _0x209adc=0x0,_0x4fb015={},_0x485d19={};_0x209adc<_0x556f39['length'];_0x209adc+=0x1){_0x4fb015=_0x556f39[_0x209adc];if(_[_0xaae5('0x49')](_0x158f19[_0xaae5('0x26')][_0x4fb015['id']])){_0x158f19[_0xaae5('0x26')][_0x4fb015['id']]=new Dynamics365Account(_0x4fb015);}else{_0x158f19[_0xaae5('0x46')](_0x158f19['dynamics365Accounts'][_0x4fb015['id']],_0x4fb015);}}}return _0x158f19['dynamics365Accounts'];};};Realtime[_0xaae5('0x42')][_0xaae5('0x59')]=function(){var _0x22862e=this;return function(_0x31dde5){if(_0x31dde5){freeIsNotKey(_0x31dde5,_0x22862e[_0xaae5('0x27')],'id');for(var _0x58d6c1=0x0,_0x514602={},_0x873c80={};_0x58d6c1<_0x31dde5['length'];_0x58d6c1+=0x1){_0x514602=_0x31dde5[_0x58d6c1];if(_[_0xaae5('0x49')](_0x22862e[_0xaae5('0x27')][_0x514602['id']])){_0x22862e[_0xaae5('0x27')][_0x514602['id']]=new FreshsalesAccount(_0x514602);}else{_0x22862e[_0xaae5('0x46')](_0x22862e[_0xaae5('0x27')][_0x514602['id']],_0x514602);}}}return _0x22862e[_0xaae5('0x27')];};};Realtime['prototype'][_0xaae5('0x5a')]=function(){var _0x43c924=this;return function(_0x22428d){for(var _0xb55af9=0x0;_0xb55af9<_0x22428d['length'];_0xb55af9+=0x1){_[_0xaae5('0x5b')](_0x43c924[_0xaae5('0x17')][_0x22428d[_0xb55af9][_0xaae5('0x2b')]],_0x22428d[_0xb55af9]);}return _0x43c924['voiceQueues'];};};Realtime[_0xaae5('0x42')]['initVoiceQueueReports']=function(){var _0xd3ad=this;return function(_0x4b0e48){clearVoiceQueues(_0xd3ad['voiceQueues']);if(_0x4b0e48){_0x4b0e48=_[_0xaae5('0x5c')](_0x4b0e48,_0xaae5('0x5d'));for(var _0x7d8bc0 in _0x4b0e48){if(_0x4b0e48[_0xaae5('0x28')](_0x7d8bc0)){var _0x282a9a={};for(var _0x75e579=0x0;_0x75e579<_0x4b0e48[_0x7d8bc0][_0xaae5('0x44')];_0x75e579+=0x1){var _0x83f704=_0x4b0e48[_0x7d8bc0][_0x75e579]['queue'];if(_0xd3ad[_0xaae5('0x17')][_0x83f704]){if(_0x4b0e48[_0x7d8bc0][_0x75e579][_0xaae5('0x5e')]){_0xd3ad['voiceQueues'][_0x83f704][_0xaae5('0x5f')]+=0x1;}if(_0x4b0e48[_0x7d8bc0][_0x75e579]['queuecallerabandon']){_0xd3ad[_0xaae5('0x17')][_0x83f704]['abandoned']+=0x1;}_0xd3ad[_0xaae5('0x17')][_0x83f704][_0xaae5('0x30')]+=moment(_0x4b0e48[_0x7d8bc0][_0x75e579][_0xaae5('0x60')])['diff'](moment(_0x4b0e48[_0x7d8bc0][_0x75e579][_0xaae5('0x61')]),_0xaae5('0x62'))||0x0;if(_0x75e579===_0x4b0e48[_0x7d8bc0][_0xaae5('0x44')]-0x1){_0xd3ad[_0xaae5('0x17')][_0x83f704][_0xaae5('0x63')]+=moment(_0x4b0e48[_0x7d8bc0][_0x75e579][_0xaae5('0x64')]||_0x4b0e48[_0x7d8bc0][_0x75e579][_0xaae5('0x65')]||_0x4b0e48[_0x7d8bc0][_0x75e579][_0xaae5('0x66')])[_0xaae5('0x67')](moment(_0x4b0e48[_0x7d8bc0][_0x75e579][_0xaae5('0x61')]),'seconds')||0x0;_0xd3ad[_0xaae5('0x17')][_0x83f704][_0xaae5('0x2e')]+=0x1;if(_0x4b0e48[_0x7d8bc0][_0x75e579][_0xaae5('0x68')]){_0xd3ad[_0xaae5('0x17')][_0x83f704]['answered']+=0x1;_0xd3ad['voiceQueues'][_0x83f704][_0xaae5('0x31')]+=moment(_0x4b0e48[_0x7d8bc0][_0x75e579]['queuecallercompleteAt'])[_0xaae5('0x67')](moment(_0x4b0e48[_0x7d8bc0][_0x75e579][_0xaae5('0x60')]),_0xaae5('0x62'))||0x0;}}else{_0xd3ad[_0xaae5('0x17')][_0x83f704][_0xaae5('0x63')]+=_0xd3ad[_0xaae5('0x17')][_0x83f704][_0xaae5('0x30')]||0x0;}}}}}}return _0xd3ad[_0xaae5('0x17')];};};Realtime[_0xaae5('0x42')][_0xaae5('0x69')]=function(){var _0xc7e3ca=this;return function(_0x1878b4){clearVoiceCallReports(_0xc7e3ca['outbound']);if(_0x1878b4){for(var _0x5134bd=0x0;_0x5134bd<_0x1878b4[_0xaae5('0x44')];_0x5134bd+=0x1){_0xc7e3ca['outbound'][_0xaae5('0x2e')]+=0x1;_0xc7e3ca[_0xaae5('0x1a')][_0xaae5('0x63')]+=_0x1878b4[_0x5134bd][_0xaae5('0x6a')];if(_0x1878b4[_0x5134bd][_0xaae5('0x6b')]===_0xaae5('0x6c')){_0xc7e3ca[_0xaae5('0x1a')][_0xaae5('0x2f')]+=0x1;_0xc7e3ca['outbound']['sumHoldTime']+=_0x1878b4[_0x5134bd][_0xaae5('0x6a')]-_0x1878b4[_0x5134bd]['billableseconds']||0x0;_0xc7e3ca[_0xaae5('0x1a')][_0xaae5('0x31')]+=_0x1878b4[_0x5134bd][_0xaae5('0x6d')];}}}return _0xc7e3ca['outbound'];};};Realtime[_0xaae5('0x42')][_0xaae5('0x6e')]=function(){var _0x113618=this;return function(_0x2b74c9){if(_0x2b74c9){freeIsNotKey(_0x2b74c9,_0x113618[_0xaae5('0x19')],'name');for(var _0xe9eef4=0x0,_0x197092={};_0xe9eef4<_0x2b74c9[_0xaae5('0x44')];_0xe9eef4+=0x1){_0x197092=_0x2b74c9[_0xe9eef4];if(_[_0xaae5('0x49')](_0x113618[_0xaae5('0x19')][_0x197092[_0xaae5('0x2b')]])){_0x113618[_0xaae5('0x19')][_0x197092[_0xaae5('0x2b')]]=new Campaign(_0x197092);}else{_0x113618[_0xaae5('0x46')](_0x113618['campaigns'][_0x197092[_0xaae5('0x2b')]],_0x197092);_0x113618[_0xaae5('0x19')][_0x197092[_0xaae5('0x2b')]][_0xaae5('0x6f')]=_0x197092[_0xaae5('0x70')]?_0x197092[_0xaae5('0x70')][_0xaae5('0x2b')]:undefined;}}}return _0x113618[_0xaae5('0x19')];};};Realtime[_0xaae5('0x42')]['initVoiceExtensions']=function(){var _0x1e25e7=this;return function(_0x326e61){if(_0x326e61){freeIsNotKey(_0x326e61,_0x1e25e7[_0xaae5('0x1b')],'id');for(var _0x3721ef=0x0,_0xd0d819={};_0x3721ef<_0x326e61[_0xaae5('0x44')];_0x3721ef+=0x1){_0xd0d819=_0x326e61[_0x3721ef];if(_[_0xaae5('0x49')](_0x1e25e7[_0xaae5('0x1b')][_0xd0d819['id']])){_0x1e25e7[_0xaae5('0x1b')][_0xd0d819['id']]=new VoiceExtension(_0xd0d819);}else{_0x1e25e7[_0xaae5('0x46')](_0x1e25e7[_0xaae5('0x1b')][_0xd0d819['id']],_0xd0d819);}}}return _0x1e25e7[_0xaae5('0x1b')];};};Realtime[_0xaae5('0x42')][_0xaae5('0x71')]=function(){var _0x2882d5=this;return function(_0x4ce27d){clearCampaigns(_0x2882d5[_0xaae5('0x19')]);for(var _0x1920d7=0x0;_0x1920d7<_0x4ce27d[_0xaae5('0x44')];_0x1920d7+=0x1){_[_0xaae5('0x5b')](_0x2882d5[_0xaae5('0x19')][_0x4ce27d[_0x1920d7][_0xaae5('0x2b')]],_0x4ce27d[_0x1920d7]);}return _0x2882d5[_0xaae5('0x19')];};};Realtime[_0xaae5('0x42')][_0xaae5('0x72')]=function(){var _0x2d8d3c=this;return function(_0x782ea){if(_0x782ea){freeIsNotKey(_0x782ea,_0x2d8d3c[_0xaae5('0x73')],'id');for(var _0xaa62db=0x0,_0x21a019={},_0x20e90f={};_0xaa62db<_0x782ea[_0xaae5('0x44')];_0xaa62db+=0x1){_0x21a019=_0x782ea[_0xaa62db];if(_['isUndefined'](_0x2d8d3c[_0xaae5('0x73')][_0x21a019['id']])){_0x2d8d3c['faxAccounts'][_0x21a019['id']]=new FaxAccount(_0x21a019);}else{_0x2d8d3c[_0xaae5('0x46')](_0x2d8d3c[_0xaae5('0x73')][_0x21a019['id']],_0x21a019);}}}return _0x2d8d3c[_0xaae5('0x73')];};};module['exports']=Realtime; \ No newline at end of file +var _0x0d44=['isUndefined','mergeFromDatabase','initTelephones','telephones','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initDeskAccounts','initVtigerAccounts','vtigerAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','queuecallerleaveAt','seconds','queuecallercompleteAt','queuecallerexitAt','diff','queuecallerjoinAt','total','queuecallercomplete','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','util','moment','../model/agent','../model/telephone','../model/template','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/freshsalesAccount','../model/faxAccount','agents','trunks','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','length'];(function(_0x14e4da,_0x15a496){var _0x16b5f1=function(_0x5c6dbe){while(--_0x5c6dbe){_0x14e4da['push'](_0x14e4da['shift']());}};_0x16b5f1(++_0x15a496);}(_0x0d44,0x104));var _0x40d4=function(_0x29a1bd,_0x13e842){_0x29a1bd=_0x29a1bd-0x0;var _0x15ae1c=_0x0d44[_0x29a1bd];return _0x15ae1c;};'use strict';var BPromise=require('bluebird');var util=require(_0x40d4('0x0'));var _=require('lodash');var moment=require(_0x40d4('0x1'));var Agent=require(_0x40d4('0x2'));var Telephone=require(_0x40d4('0x3'));var Trunk=require('../model/trunk');var VoiceQueue=require('../model/voiceQueue');var Trigger=require('../model/trigger');var Template=require(_0x40d4('0x4'));var Campaign=require('../model/campaign');var VoiceExtension=require(_0x40d4('0x5'));var ZendeskAccount=require(_0x40d4('0x6'));var SalesforceAccount=require(_0x40d4('0x7'));var FreshdeskAccount=require(_0x40d4('0x8'));var SugarcrmAccount=require(_0x40d4('0x9'));var ZohoAccount=require(_0x40d4('0xa'));var DeskAccount=require(_0x40d4('0xb'));var VtigerAccount=require(_0x40d4('0xc'));var ServicenowAccount=require(_0x40d4('0xd'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0x40d4('0xe'));var FaxAccount=require(_0x40d4('0xf'));var Realtime=function(){this[_0x40d4('0x10')]={};this['telephones']={};this[_0x40d4('0x11')]={};this[_0x40d4('0x12')]={};this[_0x40d4('0x13')]={};this[_0x40d4('0x14')]={};this[_0x40d4('0x15')]={};this[_0x40d4('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x40d4('0x17')]={};this['channels']={};this[_0x40d4('0x18')]={};this[_0x40d4('0x19')]={};this[_0x40d4('0x1a')]={};this[_0x40d4('0x1b')]={};this[_0x40d4('0x1c')]={};this[_0x40d4('0x1d')]={};this[_0x40d4('0x1e')]={};this[_0x40d4('0x1f')]={};this[_0x40d4('0x20')]={};this[_0x40d4('0x21')]={};this['vtigerAccounts']={};this[_0x40d4('0x22')]={};this[_0x40d4('0x23')]={};this[_0x40d4('0x24')]={};this[_0x40d4('0x25')]={};};function freeIsNotKey(_0x3ae0f3,_0x20cf5b,_0x1f2d61){var _0x3d0168=_[_0x40d4('0x26')](_0x3ae0f3,function(_0x281e79,_0x1104a7){return _0x281e79[_0x1f2d61];});for(var _0x160126 in _0x20cf5b){if(_0x20cf5b[_0x40d4('0x27')](_0x160126)){if(!_0x3d0168[_0x160126]){delete _0x20cf5b[_0x160126];}}}}function freeIsNotKeySip(_0x13a041,_0x4d1db6){var _0x320ecc=_[_0x40d4('0x26')](_0x13a041,function(_0xb263b7,_0x49e555){return util[_0x40d4('0x28')](_0x40d4('0x29'),_0xb263b7[_0x40d4('0x2a')]);});for(var _0x14efd3 in _0x4d1db6){if(_0x4d1db6[_0x40d4('0x27')](_0x14efd3)){if(!_0x320ecc[_0x14efd3]){delete _0x4d1db6[_0x14efd3];}}}}function freeIsNotKeyAgent(_0x125a52,_0xd35df5){var _0x42fdb7=_[_0x40d4('0x26')](_0x125a52,function(_0x1de33a,_0x446b91){var _0x35ada3=_[_0x40d4('0x2b')](_0x1de33a[_0x40d4('0x2c')])?util['format'](_0x40d4('0x29'),_0x1de33a[_0x40d4('0x2a')]):_0x1de33a['interface'];return _0x35ada3;});for(var _0x1980d0 in _0xd35df5){if(_0xd35df5['hasOwnProperty'](_0x1980d0)){if(!_0x42fdb7[_0x1980d0]){delete _0xd35df5[_0x1980d0];}}}}function clearVoiceCallReports(_0x86b67d){_0x86b67d['total']=0x0;_0x86b67d[_0x40d4('0x2d')]=0x0;_0x86b67d[_0x40d4('0x2e')]=0x0;_0x86b67d[_0x40d4('0x2f')]=0x0;_0x86b67d[_0x40d4('0x30')]=0x0;}function clearCampaigns(_0x1fa725){if(!_[_0x40d4('0x31')](_0x1fa725)){for(var _0x45827d in _0x1fa725){if(_0x1fa725[_0x40d4('0x27')](_0x45827d)){_0x1fa725[_0x45827d][_0x40d4('0x32')]=0x0;_0x1fa725[_0x45827d][_0x40d4('0x33')]=0x0;}}}}function clearVoiceQueues(_0x8f5b57){if(!_[_0x40d4('0x31')](_0x8f5b57)){for(var _0x243ed4 in _0x8f5b57){if(_0x8f5b57[_0x40d4('0x27')](_0x243ed4)){_0x8f5b57[_0x243ed4]['total']=0x0;_0x8f5b57[_0x243ed4]['answered']=0x0;_0x8f5b57[_0x243ed4][_0x40d4('0x34')]=0x0;_0x8f5b57[_0x243ed4]['abandoned']=0x0;_0x8f5b57[_0x243ed4][_0x40d4('0x2e')]=0x0;_0x8f5b57[_0x243ed4][_0x40d4('0x2f')]=0x0;_0x8f5b57[_0x243ed4][_0x40d4('0x30')]=0x0;_0x8f5b57[_0x243ed4][_0x40d4('0x35')]=0x0;_0x8f5b57[_0x243ed4][_0x40d4('0x36')]=0x0;_0x8f5b57[_0x243ed4][_0x40d4('0x37')]=0x0;_0x8f5b57[_0x243ed4][_0x40d4('0x38')]=0x0;_0x8f5b57[_0x243ed4][_0x40d4('0x39')]=0x0;_0x8f5b57[_0x243ed4][_0x40d4('0x3a')]=0x0;_0x8f5b57[_0x243ed4][_0x40d4('0x3b')]=0x0;_0x8f5b57[_0x243ed4][_0x40d4('0x3c')]=0x0;_0x8f5b57[_0x243ed4][_0x40d4('0x3d')]=0x0;_0x8f5b57[_0x243ed4][_0x40d4('0x3e')]=0x0;_0x8f5b57[_0x243ed4][_0x40d4('0x3f')]=0x0;_0x8f5b57[_0x243ed4][_0x40d4('0x40')]=0x0;_0x8f5b57[_0x243ed4][_0x40d4('0x35')]=0x0;_0x8f5b57[_0x243ed4][_0x40d4('0x41')]=0x0;_0x8f5b57[_0x243ed4][_0x40d4('0x42')]=!![];}}}}Realtime[_0x40d4('0x43')]['mergeFromDatabase']=function(_0x15b840,_0x48fb58){for(var _0x2eebee in _0x48fb58){if(_0x15b840['hasOwnProperty'](_0x2eebee)){_0x15b840[_0x2eebee]=_0x48fb58[_0x2eebee];}}};Realtime['prototype'][_0x40d4('0x44')]=function(){var _0xae1d8=this;return function(_0x3e9cae){if(_0x3e9cae){freeIsNotKeyAgent(_0x3e9cae,_0xae1d8[_0x40d4('0x10')]);for(var _0x3d8216=0x0,_0xc3e42c={},_0x58787b={};_0x3d8216<_0x3e9cae[_0x40d4('0x45')];_0x3d8216+=0x1){_0xc3e42c=_0x3e9cae[_0x3d8216];var _0x5e181e=_[_0x40d4('0x2b')](_0xc3e42c[_0x40d4('0x2c')])?util['format']('SIP/%s',_0xc3e42c[_0x40d4('0x2a')]):_0xc3e42c[_0x40d4('0x2c')];if(_[_0x40d4('0x46')](_0xae1d8['agents'][_0x5e181e])){_0xae1d8[_0x40d4('0x10')][_0x5e181e]=new Agent(_0xc3e42c);}else{_0xae1d8[_0x40d4('0x47')](_0xae1d8['agents'][_0x5e181e],_0xc3e42c);}}}return _0xae1d8[_0x40d4('0x10')];};};Realtime['prototype'][_0x40d4('0x48')]=function(){var _0x509cd6=this;return function(_0x90c02){if(_0x90c02){freeIsNotKeySip(_0x90c02,_0x509cd6[_0x40d4('0x49')]);for(var _0x56b9d4=0x0,_0x3654fd={},_0x3af3bf={};_0x56b9d4<_0x90c02[_0x40d4('0x45')];_0x56b9d4+=0x1){_0x3654fd=_0x90c02[_0x56b9d4];if(_['isUndefined'](_0x509cd6[_0x40d4('0x49')][util['format']('SIP/%s',_0x3654fd[_0x40d4('0x2a')])])){_0x509cd6['telephones'][util[_0x40d4('0x28')](_0x40d4('0x29'),_0x3654fd[_0x40d4('0x2a')])]=new Telephone(_0x3654fd);}else{_0x509cd6[_0x40d4('0x47')](_0x509cd6[_0x40d4('0x49')][util['format'](_0x40d4('0x29'),_0x3654fd[_0x40d4('0x2a')])],_0x3654fd);}}}return _0x509cd6[_0x40d4('0x49')];};};Realtime['prototype']['initTrunks']=function(){var _0x4f1952=this;return function(_0x3b3e31){if(_0x3b3e31){freeIsNotKeySip(_0x3b3e31,_0x4f1952[_0x40d4('0x11')]);for(var _0xad3f16=0x0,_0x57280c={},_0x31a643={};_0xad3f16<_0x3b3e31[_0x40d4('0x45')];_0xad3f16+=0x1){_0x57280c=_0x3b3e31[_0xad3f16];if(_[_0x40d4('0x46')](_0x4f1952[_0x40d4('0x11')][util[_0x40d4('0x28')](_0x40d4('0x29'),_0x57280c[_0x40d4('0x2a')])])){_0x4f1952[_0x40d4('0x11')][util[_0x40d4('0x28')]('SIP/%s',_0x57280c[_0x40d4('0x2a')])]=new Trunk(_0x57280c);}else{_0x4f1952[_0x40d4('0x47')](_0x4f1952[_0x40d4('0x11')][util['format'](_0x40d4('0x29'),_0x57280c[_0x40d4('0x2a')])],_0x57280c);}}}return _0x4f1952[_0x40d4('0x11')];};};Realtime[_0x40d4('0x43')]['initVoiceQueues']=function(){var _0xb87c36=this;return function(_0xc9c3e1){if(_0xc9c3e1){freeIsNotKey(_0xc9c3e1,_0xb87c36[_0x40d4('0x12')],_0x40d4('0x2a'));for(var _0x170ddb=0x0,_0x2bbf5d={},_0x45d683={};_0x170ddb<_0xc9c3e1[_0x40d4('0x45')];_0x170ddb+=0x1){_0x2bbf5d=_0xc9c3e1[_0x170ddb];if(_[_0x40d4('0x46')](_0xb87c36[_0x40d4('0x12')][_0x2bbf5d[_0x40d4('0x2a')]])){_0xb87c36[_0x40d4('0x12')][_0x2bbf5d[_0x40d4('0x2a')]]=new VoiceQueue(_0x2bbf5d);}else{_0xb87c36[_0x40d4('0x47')](_0xb87c36['voiceQueues'][_0x2bbf5d[_0x40d4('0x2a')]],_0x2bbf5d);}}}return _0xb87c36[_0x40d4('0x12')];};};Realtime[_0x40d4('0x43')][_0x40d4('0x4a')]=function(){var _0x32c422=this;return function(_0x43f194){if(_0x43f194){freeIsNotKey(_0x43f194,_0x32c422[_0x40d4('0x13')],'id');for(var _0x47ba9d=0x0,_0x5e5b20={},_0x507525={};_0x47ba9d<_0x43f194[_0x40d4('0x45')];_0x47ba9d+=0x1){_0x5e5b20=_0x43f194[_0x47ba9d];if(_[_0x40d4('0x46')](_0x32c422[_0x40d4('0x13')][_0x5e5b20['id']])){_0x32c422[_0x40d4('0x13')][_0x5e5b20['id']]=new Trigger(_0x5e5b20);}else{_0x32c422[_0x40d4('0x47')](_0x32c422[_0x40d4('0x13')][_0x5e5b20['id']],_0x5e5b20);}}}return _0x32c422[_0x40d4('0x13')];};};Realtime[_0x40d4('0x43')][_0x40d4('0x4b')]=function(){var _0x40c442=this;return function(_0x975793){if(_0x975793){freeIsNotKey(_0x975793,_0x40c442[_0x40d4('0x15')],'id');for(var _0x3b3617=0x0,_0x22b90a={},_0x369ea1={};_0x3b3617<_0x975793[_0x40d4('0x45')];_0x3b3617+=0x1){_0x22b90a=_0x975793[_0x3b3617];if(_[_0x40d4('0x46')](_0x40c442[_0x40d4('0x15')][_0x22b90a['id']])){_0x40c442[_0x40d4('0x15')][_0x22b90a['id']]=new Template(_0x22b90a);}else{_0x40c442[_0x40d4('0x47')](_0x40c442[_0x40d4('0x15')][_0x22b90a['id']],_0x22b90a);}}}return _0x40c442['templates'];};};Realtime[_0x40d4('0x43')][_0x40d4('0x4c')]=function(){var _0x54e4f1=this;return function(_0x35a855){if(_0x35a855){freeIsNotKey(_0x35a855,_0x54e4f1[_0x40d4('0x1c')],'id');for(var _0x51bece=0x0,_0x4ddbde={},_0x4a22c0={};_0x51bece<_0x35a855[_0x40d4('0x45')];_0x51bece+=0x1){_0x4ddbde=_0x35a855[_0x51bece];if(_['isUndefined'](_0x54e4f1[_0x40d4('0x1c')][_0x4ddbde['id']])){_0x54e4f1[_0x40d4('0x1c')][_0x4ddbde['id']]=new ZendeskAccount(_0x4ddbde);}else{_0x54e4f1[_0x40d4('0x47')](_0x54e4f1[_0x40d4('0x1c')][_0x4ddbde['id']],_0x4ddbde);}}}return _0x54e4f1[_0x40d4('0x1c')];};};Realtime[_0x40d4('0x43')][_0x40d4('0x4d')]=function(){var _0x584cf4=this;return function(_0x5baeb7){if(_0x5baeb7){freeIsNotKey(_0x5baeb7,_0x584cf4[_0x40d4('0x1d')],'id');for(var _0x2135a6=0x0,_0x4be49c={},_0x1e635d={};_0x2135a6<_0x5baeb7['length'];_0x2135a6+=0x1){_0x4be49c=_0x5baeb7[_0x2135a6];if(_['isUndefined'](_0x584cf4[_0x40d4('0x1d')][_0x4be49c['id']])){_0x584cf4[_0x40d4('0x1d')][_0x4be49c['id']]=new SalesforceAccount(_0x4be49c);}else{_0x584cf4[_0x40d4('0x47')](_0x584cf4[_0x40d4('0x1d')][_0x4be49c['id']],_0x4be49c);}}}return _0x584cf4[_0x40d4('0x1d')];};};Realtime[_0x40d4('0x43')]['initFreshdeskAccounts']=function(){var _0x6f8d2f=this;return function(_0x49d5e8){if(_0x49d5e8){freeIsNotKey(_0x49d5e8,_0x6f8d2f[_0x40d4('0x1f')],'id');for(var _0x1f1c92=0x0,_0x4ec128={},_0x3e26d9={};_0x1f1c92<_0x49d5e8[_0x40d4('0x45')];_0x1f1c92+=0x1){_0x4ec128=_0x49d5e8[_0x1f1c92];if(_[_0x40d4('0x46')](_0x6f8d2f[_0x40d4('0x1f')][_0x4ec128['id']])){_0x6f8d2f[_0x40d4('0x1f')][_0x4ec128['id']]=new FreshdeskAccount(_0x4ec128);}else{_0x6f8d2f[_0x40d4('0x47')](_0x6f8d2f[_0x40d4('0x1f')][_0x4ec128['id']],_0x4ec128);}}}return _0x6f8d2f['freshdeskAccounts'];};};Realtime['prototype']['initZohoAccounts']=function(){var _0x3e29fd=this;return function(_0x52743a){if(_0x52743a){freeIsNotKey(_0x52743a,_0x3e29fd[_0x40d4('0x20')],'id');for(var _0x54231a=0x0,_0x4758e2={},_0x2ed935={};_0x54231a<_0x52743a[_0x40d4('0x45')];_0x54231a+=0x1){_0x4758e2=_0x52743a[_0x54231a];if(_[_0x40d4('0x46')](_0x3e29fd[_0x40d4('0x20')][_0x4758e2['id']])){_0x3e29fd[_0x40d4('0x20')][_0x4758e2['id']]=new ZohoAccount(_0x4758e2);}else{_0x3e29fd[_0x40d4('0x47')](_0x3e29fd['zohoAccounts'][_0x4758e2['id']],_0x4758e2);}}}return _0x3e29fd[_0x40d4('0x20')];};};Realtime['prototype'][_0x40d4('0x4e')]=function(){var _0x47ae9f=this;return function(_0x311469){if(_0x311469){freeIsNotKey(_0x311469,_0x47ae9f['deskAccounts'],'id');for(var _0x35f848=0x0,_0x3c809a={},_0x3b65e6={};_0x35f848<_0x311469['length'];_0x35f848+=0x1){_0x3c809a=_0x311469[_0x35f848];if(_[_0x40d4('0x46')](_0x47ae9f['deskAccounts'][_0x3c809a['id']])){_0x47ae9f['deskAccounts'][_0x3c809a['id']]=new DeskAccount(_0x3c809a);}else{_0x47ae9f[_0x40d4('0x47')](_0x47ae9f[_0x40d4('0x21')][_0x3c809a['id']],_0x3c809a);}}}return _0x47ae9f[_0x40d4('0x21')];};};Realtime['prototype']['initSugarcrmAccounts']=function(){var _0x32ca38=this;return function(_0x23210d){if(_0x23210d){freeIsNotKey(_0x23210d,_0x32ca38[_0x40d4('0x1e')],'id');for(var _0x20bbbd=0x0,_0xf61564={},_0x3d1547={};_0x20bbbd<_0x23210d[_0x40d4('0x45')];_0x20bbbd+=0x1){_0xf61564=_0x23210d[_0x20bbbd];if(_[_0x40d4('0x46')](_0x32ca38[_0x40d4('0x1e')][_0xf61564['id']])){_0x32ca38[_0x40d4('0x1e')][_0xf61564['id']]=new SugarcrmAccount(_0xf61564);}else{_0x32ca38[_0x40d4('0x47')](_0x32ca38['sugarcrmAccounts'][_0xf61564['id']],_0xf61564);}}}return _0x32ca38[_0x40d4('0x1e')];};};Realtime[_0x40d4('0x43')][_0x40d4('0x4f')]=function(){var _0x4980ae=this;return function(_0xe4a499){if(_0xe4a499){freeIsNotKey(_0xe4a499,_0x4980ae[_0x40d4('0x50')],'id');for(var _0x18336a=0x0,_0x34d577={},_0x5136fb={};_0x18336a<_0xe4a499['length'];_0x18336a+=0x1){_0x34d577=_0xe4a499[_0x18336a];if(_['isUndefined'](_0x4980ae[_0x40d4('0x50')][_0x34d577['id']])){_0x4980ae[_0x40d4('0x50')][_0x34d577['id']]=new VtigerAccount(_0x34d577);}else{_0x4980ae['mergeFromDatabase'](_0x4980ae[_0x40d4('0x50')][_0x34d577['id']],_0x34d577);}}}return _0x4980ae[_0x40d4('0x50')];};};Realtime[_0x40d4('0x43')]['initServicenowAccounts']=function(){var _0xc9c92a=this;return function(_0x55c26b){if(_0x55c26b){freeIsNotKey(_0x55c26b,_0xc9c92a[_0x40d4('0x22')],'id');for(var _0x3a14fe=0x0,_0x47fd13={},_0xd921ee={};_0x3a14fe<_0x55c26b[_0x40d4('0x45')];_0x3a14fe+=0x1){_0x47fd13=_0x55c26b[_0x3a14fe];if(_['isUndefined'](_0xc9c92a['servicenowAccounts'][_0x47fd13['id']])){_0xc9c92a[_0x40d4('0x22')][_0x47fd13['id']]=new ServicenowAccount(_0x47fd13);}else{_0xc9c92a[_0x40d4('0x47')](_0xc9c92a[_0x40d4('0x22')][_0x47fd13['id']],_0x47fd13);}}}return _0xc9c92a['servicenowAccounts'];};};Realtime[_0x40d4('0x43')][_0x40d4('0x51')]=function(){var _0x5cb4b6=this;return function(_0x2f6d38){if(_0x2f6d38){freeIsNotKey(_0x2f6d38,_0x5cb4b6[_0x40d4('0x23')],'id');for(var _0x246a5b=0x0,_0x208572={},_0x3f12c7={};_0x246a5b<_0x2f6d38['length'];_0x246a5b+=0x1){_0x208572=_0x2f6d38[_0x246a5b];if(_['isUndefined'](_0x5cb4b6[_0x40d4('0x23')][_0x208572['id']])){_0x5cb4b6['dynamics365Accounts'][_0x208572['id']]=new Dynamics365Account(_0x208572);}else{_0x5cb4b6[_0x40d4('0x47')](_0x5cb4b6[_0x40d4('0x23')][_0x208572['id']],_0x208572);}}}return _0x5cb4b6[_0x40d4('0x23')];};};Realtime[_0x40d4('0x43')][_0x40d4('0x52')]=function(){var _0x2c93dd=this;return function(_0x20bff6){if(_0x20bff6){freeIsNotKey(_0x20bff6,_0x2c93dd[_0x40d4('0x24')],'id');for(var _0x1b466d=0x0,_0x34150c={},_0x30c714={};_0x1b466d<_0x20bff6['length'];_0x1b466d+=0x1){_0x34150c=_0x20bff6[_0x1b466d];if(_['isUndefined'](_0x2c93dd[_0x40d4('0x24')][_0x34150c['id']])){_0x2c93dd['freshsalesAccounts'][_0x34150c['id']]=new FreshsalesAccount(_0x34150c);}else{_0x2c93dd[_0x40d4('0x47')](_0x2c93dd[_0x40d4('0x24')][_0x34150c['id']],_0x34150c);}}}return _0x2c93dd['freshsalesAccounts'];};};Realtime[_0x40d4('0x43')][_0x40d4('0x53')]=function(){var _0x249206=this;return function(_0x3fb6f1){for(var _0x457e2c=0x0;_0x457e2c<_0x3fb6f1['length'];_0x457e2c+=0x1){_[_0x40d4('0x54')](_0x249206['voiceQueues'][_0x3fb6f1[_0x457e2c][_0x40d4('0x2a')]],_0x3fb6f1[_0x457e2c]);}return _0x249206['voiceQueues'];};};Realtime['prototype']['initVoiceQueueReports']=function(){var _0x3ea636=this;return function(_0x2ec5ac){clearVoiceQueues(_0x3ea636[_0x40d4('0x12')]);if(_0x2ec5ac){_0x2ec5ac=_[_0x40d4('0x55')](_0x2ec5ac,_0x40d4('0x56'));for(var _0x1c41d0 in _0x2ec5ac){if(_0x2ec5ac[_0x40d4('0x27')](_0x1c41d0)){var _0x1feffc={};for(var _0x3ac856=0x0;_0x3ac856<_0x2ec5ac[_0x1c41d0]['length'];_0x3ac856+=0x1){var _0x2bb4a8=_0x2ec5ac[_0x1c41d0][_0x3ac856][_0x40d4('0x57')];if(_0x3ea636[_0x40d4('0x12')][_0x2bb4a8]){if(_0x2ec5ac[_0x1c41d0][_0x3ac856][_0x40d4('0x58')]){_0x3ea636[_0x40d4('0x12')][_0x2bb4a8][_0x40d4('0x34')]+=0x1;}if(_0x2ec5ac[_0x1c41d0][_0x3ac856][_0x40d4('0x59')]){_0x3ea636[_0x40d4('0x12')][_0x2bb4a8][_0x40d4('0x5a')]+=0x1;}_0x3ea636[_0x40d4('0x12')][_0x2bb4a8][_0x40d4('0x2e')]+=moment(_0x2ec5ac[_0x1c41d0][_0x3ac856][_0x40d4('0x5b')])['diff'](moment(_0x2ec5ac[_0x1c41d0][_0x3ac856]['queuecallerjoinAt']),_0x40d4('0x5c'))||0x0;if(_0x3ac856===_0x2ec5ac[_0x1c41d0][_0x40d4('0x45')]-0x1){_0x3ea636['voiceQueues'][_0x2bb4a8][_0x40d4('0x2f')]+=moment(_0x2ec5ac[_0x1c41d0][_0x3ac856][_0x40d4('0x5d')]||_0x2ec5ac[_0x1c41d0][_0x3ac856]['queuecallerabandonAt']||_0x2ec5ac[_0x1c41d0][_0x3ac856][_0x40d4('0x5e')])[_0x40d4('0x5f')](moment(_0x2ec5ac[_0x1c41d0][_0x3ac856][_0x40d4('0x60')]),_0x40d4('0x5c'))||0x0;_0x3ea636['voiceQueues'][_0x2bb4a8][_0x40d4('0x61')]+=0x1;if(_0x2ec5ac[_0x1c41d0][_0x3ac856][_0x40d4('0x62')]){_0x3ea636['voiceQueues'][_0x2bb4a8][_0x40d4('0x2d')]+=0x1;_0x3ea636['voiceQueues'][_0x2bb4a8][_0x40d4('0x30')]+=moment(_0x2ec5ac[_0x1c41d0][_0x3ac856][_0x40d4('0x5d')])['diff'](moment(_0x2ec5ac[_0x1c41d0][_0x3ac856][_0x40d4('0x5b')]),_0x40d4('0x5c'))||0x0;}}else{_0x3ea636[_0x40d4('0x12')][_0x2bb4a8][_0x40d4('0x2f')]+=_0x3ea636[_0x40d4('0x12')][_0x2bb4a8][_0x40d4('0x2e')]||0x0;}}}}}}return _0x3ea636[_0x40d4('0x12')];};};Realtime[_0x40d4('0x43')]['initVoiceCallReports']=function(){var _0x333532=this;return function(_0xdda174){clearVoiceCallReports(_0x333532['outbound']);if(_0xdda174){for(var _0x41d551=0x0;_0x41d551<_0xdda174[_0x40d4('0x45')];_0x41d551+=0x1){_0x333532[_0x40d4('0x16')][_0x40d4('0x61')]+=0x1;_0x333532[_0x40d4('0x16')]['sumDuration']+=_0xdda174[_0x41d551][_0x40d4('0x63')];if(_0xdda174[_0x41d551][_0x40d4('0x64')]===_0x40d4('0x65')){_0x333532[_0x40d4('0x16')][_0x40d4('0x2d')]+=0x1;_0x333532['outbound']['sumHoldTime']+=_0xdda174[_0x41d551]['duration']-_0xdda174[_0x41d551][_0x40d4('0x66')]||0x0;_0x333532['outbound'][_0x40d4('0x30')]+=_0xdda174[_0x41d551]['billableseconds'];}}}return _0x333532['outbound'];};};Realtime[_0x40d4('0x43')][_0x40d4('0x67')]=function(){var _0x2be664=this;return function(_0xbf9397){if(_0xbf9397){freeIsNotKey(_0xbf9397,_0x2be664['campaigns'],'name');for(var _0x4db556=0x0,_0x9ea73f={};_0x4db556<_0xbf9397['length'];_0x4db556+=0x1){_0x9ea73f=_0xbf9397[_0x4db556];if(_[_0x40d4('0x46')](_0x2be664[_0x40d4('0x14')][_0x9ea73f['name']])){_0x2be664[_0x40d4('0x14')][_0x9ea73f[_0x40d4('0x2a')]]=new Campaign(_0x9ea73f);}else{_0x2be664['mergeFromDatabase'](_0x2be664['campaigns'][_0x9ea73f[_0x40d4('0x2a')]],_0x9ea73f);_0x2be664[_0x40d4('0x14')][_0x9ea73f[_0x40d4('0x2a')]][_0x40d4('0x68')]=_0x9ea73f[_0x40d4('0x69')]?_0x9ea73f['SquareProject'][_0x40d4('0x2a')]:undefined;}}}return _0x2be664[_0x40d4('0x14')];};};Realtime['prototype'][_0x40d4('0x6a')]=function(){var _0x266086=this;return function(_0x28e0d7){if(_0x28e0d7){freeIsNotKey(_0x28e0d7,_0x266086['voiceExtensions'],'id');for(var _0x12eb1f=0x0,_0x5a4e5e={};_0x12eb1f<_0x28e0d7[_0x40d4('0x45')];_0x12eb1f+=0x1){_0x5a4e5e=_0x28e0d7[_0x12eb1f];if(_['isUndefined'](_0x266086[_0x40d4('0x17')][_0x5a4e5e['id']])){_0x266086[_0x40d4('0x17')][_0x5a4e5e['id']]=new VoiceExtension(_0x5a4e5e);}else{_0x266086[_0x40d4('0x47')](_0x266086[_0x40d4('0x17')][_0x5a4e5e['id']],_0x5a4e5e);}}}return _0x266086[_0x40d4('0x17')];};};Realtime[_0x40d4('0x43')][_0x40d4('0x6b')]=function(){var _0x1eefc6=this;return function(_0x3e9bae){clearCampaigns(_0x1eefc6['campaigns']);for(var _0x36ca04=0x0;_0x36ca04<_0x3e9bae['length'];_0x36ca04+=0x1){_[_0x40d4('0x54')](_0x1eefc6['campaigns'][_0x3e9bae[_0x36ca04][_0x40d4('0x2a')]],_0x3e9bae[_0x36ca04]);}return _0x1eefc6[_0x40d4('0x14')];};};Realtime[_0x40d4('0x43')][_0x40d4('0x6c')]=function(){var _0x41d612=this;return function(_0xbd2551){if(_0xbd2551){freeIsNotKey(_0xbd2551,_0x41d612[_0x40d4('0x25')],'id');for(var _0x3cb040=0x0,_0x3de3cd={},_0x241890={};_0x3cb040<_0xbd2551['length'];_0x3cb040+=0x1){_0x3de3cd=_0xbd2551[_0x3cb040];if(_['isUndefined'](_0x41d612['faxAccounts'][_0x3de3cd['id']])){_0x41d612[_0x40d4('0x25')][_0x3de3cd['id']]=new FaxAccount(_0x3de3cd);}else{_0x41d612[_0x40d4('0x47')](_0x41d612[_0x40d4('0x25')][_0x3de3cd['id']],_0x3de3cd);}}}return _0x41d612[_0x40d4('0x25')];};};module[_0x40d4('0x6d')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index bda2a5d..44e6b5e 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 _0x0534=['linkedid','transfereelinkedid','create','monitors','monitorFilename','filename','createdAt','calleridname','connectedlinename','membername','xcally-motion-dialer','voiceAgentReport','isArray','Local','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','disabled','custom:voiceQueueReport','voiceQueueReport','bind','voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','SIP/%s','length','assigned','format','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','destination','exten','type','dialer','queue','from-voip-provider','callerid','context','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','channel','calleridnum','disposition','connectedlinenum','\x22%s\x22\x20<%s>','transfers'];(function(_0x449dbd,_0x57c85d){var _0xff433e=function(_0x146cb4){while(--_0x146cb4){_0x449dbd['push'](_0x449dbd['shift']());}};_0xff433e(++_0x57c85d);}(_0x0534,0x16d));var _0x4053=function(_0x4fa291,_0x56e289){_0x4fa291=_0x4fa291-0x0;var _0x506d9b=_0x0534[_0x4fa291];return _0x506d9b;};'use strict';var _=require(_0x4053('0x0'));var moment=require(_0x4053('0x1'));var util=require(_0x4053('0x2'));var config=require(_0x4053('0x3'));var ami=require(_0x4053('0x4'));var RpcVoiceAgentReport=require(_0x4053('0x5'));var RpcVoiceCallReport=require(_0x4053('0x6'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x4053('0x7'));var RpcVoiceQueueReport=require(_0x4053('0x8'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0x4053('0x9'));var VoiceQueueReport=require(_0x4053('0xa'));var VoiceCallReport=require(_0x4053('0xb'));var VoiceAgentReport=require(_0x4053('0xc'));var VoiceDialReport=require(_0x4053('0xd'));var UserReport=require(_0x4053('0xe'));function Report(_0x4b289d){this[_0x4053('0xf')]=_0x4b289d;this[_0x4053('0x10')]=_0x4b289d[_0x4053('0x10')];this[_0x4053('0x11')]=_0x4b289d[_0x4053('0x11')];}Report[_0x4053('0x12')][_0x4053('0x13')]=function(_0x1d9445){var _0x24cebf=new VoiceQueueReport(this[_0x4053('0xf')]);var _0x46242b=new VoiceAgentReport(this[_0x4053('0xf')]);var _0x36a1c4=new VoiceDialReport(this['realtime']);var _0x23313c=new VoiceCallReport(this[_0x4053('0xf')]);var _0x172767=new UserReport(this[_0x4053('0xf')]);if(config['xdr']&&config['xdr'][_0x4053('0x14')]){ami['on'](_0x4053('0x15'),this[_0x4053('0x16')][_0x4053('0x17')](this));ami['on']('custom:voiceCallReport',this[_0x4053('0x18')][_0x4053('0x17')](this));ami['on'](_0x4053('0x19'),this['voiceAgentReport']['bind'](this));ami['on'](_0x4053('0x1a'),this[_0x4053('0x1b')][_0x4053('0x17')](this));ami['on'](_0x4053('0x1c'),this[_0x4053('0x1d')][_0x4053('0x17')](this));ami['on'](_0x4053('0x1e'),this[_0x4053('0x1f')][_0x4053('0x17')](this));}};Report[_0x4053('0x12')][_0x4053('0x20')]=function(_0x9de686){var _0x5a6914;_0x5a6914=_[_0x4053('0x21')](this[_0x4053('0x10')],function(_0x54615e){return _0x54615e[_0x4053('0x22')]==_0x9de686||_0x54615e[_0x4053('0x23')]==_0x9de686;});if(_[_0x4053('0x24')](_0x5a6914)){var _0x40e379=_[_0x4053('0x21')](this[_0x4053('0x11')],function(_0x41a1d9){return _0x41a1d9[_0x4053('0x22')]==_0x9de686||_0x41a1d9['name']==_0x9de686;});if(_0x40e379){_0x5a6914=_[_0x4053('0x21')](this[_0x4053('0x10')],function(_0x21cb43){return _0x21cb43[_0x4053('0x25')]==util['format'](_0x4053('0x26'),_0x40e379['name']);});}}return _0x5a6914;};Report[_0x4053('0x12')][_0x4053('0x16')]=function(_0x4eb47f){for(var _0x55f392=0x0;_0x55f392<_0x4eb47f[_0x4053('0x27')];_0x55f392+=0x1){var _0x3d7406=this[_0x4053('0x20')](_0x4eb47f[_0x55f392]['connectedlinenum']);if(_0x3d7406){_0x4eb47f[_0x55f392][_0x4053('0x22')]=_0x3d7406[_0x4053('0x22')];_0x4eb47f[_0x55f392][_0x4053('0x28')]=!![];_0x4eb47f[_0x55f392]['lastAssignedTo']=_0x3d7406['name'];_0x4eb47f[_0x55f392][_0x4053('0x25')]=_[_0x4053('0x24')](_0x3d7406[_0x4053('0x25')])?util[_0x4053('0x29')](_0x4053('0x26'),_0x3d7406[_0x4053('0x23')]):_0x3d7406[_0x4053('0x25')];if(_0x4eb47f[_0x55f392][_0x4053('0x2a')]){_0x4eb47f[_0x55f392][_0x4053('0x2b')]=moment()[_0x4053('0x29')](_0x4053('0x2c'));}if(_0x4eb47f[_0x55f392][_0x4053('0x2d')]){_0x4eb47f[_0x55f392]['queuecallerexitAt']=moment()[_0x4053('0x29')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport['voiceQueueReport'](_0x4eb47f[_0x55f392]);}RpcVoiceQueueReport['create'](_0x4eb47f[_0x55f392]);}};function extractCalleridNumber(_0x1da475){var _0x2f6d94=_0x1da475['match'](/<(.*?)>/);return _0x2f6d94?_0x2f6d94[0x1]:_0x1da475;}Report['prototype'][_0x4053('0x18')]=function(_0x177116){_0x177116[_0x4053('0x2e')]=_0x177116[_0x4053('0x2e')]||_0x177116[_0x4053('0x2f')];if(_0x177116[_0x4053('0x30')]==_0x4053('0x31')){_0x177116['lastapplication']=_0x4053('0x32');_0x177116['lastdata']=_0x177116[_0x4053('0x32')];if(_0x177116['context']==_0x4053('0x33')){_0x177116[_0x4053('0x22')]='';_0x177116['destination']=extractCalleridNumber(_0x177116[_0x4053('0x34')]);}else if(_0x177116[_0x4053('0x35')]==_0x4053('0x36')){if(_0x177116[_0x4053('0x2e')]==_0x4053('0x37')){_0x177116[_0x4053('0x2e')]=extractCalleridNumber(_0x177116[_0x4053('0x38')]);_0x177116['calleridnum']=_0x177116[_0x4053('0x39')];_0x177116[_0x4053('0x3a')]=[_0x177116['channel'],_0x177116[_0x4053('0x3b')]=_0x177116[_0x4053('0x3a')]][0x0];_0x177116[_0x4053('0x34')]=_0x177116[_0x4053('0x38')];}else{_0x177116[_0x4053('0x2e')]=_0x177116[_0x4053('0x3c')];_0x177116[_0x4053('0x3c')]=_0x177116[_0x4053('0x39')];if(_0x177116[_0x4053('0x3d')]=='ANSWERED'){_0x177116[_0x4053('0x22')]=_0x177116[_0x4053('0x3e')];}else{_0x177116[_0x4053('0x22')]='';}}}}else{_0x177116['callerid']=util[_0x4053('0x29')](_0x4053('0x3f'),_0x177116['calleridname'],_0x177116['calleridnum']);}if(RpcVoiceTransferReport[_0x4053('0x40')][_0x177116[_0x4053('0x41')]]){var _0x4c1459=RpcVoiceTransferReport[_0x4053('0x40')][_0x177116['linkedid']];_0x4c1459[_0x4053('0x42')]=_0x177116['uniqueid'];RpcVoiceTransferReport[_0x4053('0x1d')](_0x4c1459);delete RpcVoiceTransferReport[_0x4053('0x40')][_0x177116[_0x4053('0x41')]];}RpcVoiceCallReport[_0x4053('0x43')](_0x177116);if(_0x177116['monitor']){for(var _0x1e47ce=0x0;_0x1e47ce<_0x177116[_0x4053('0x44')][_0x4053('0x27')];_0x1e47ce+=0x1){_0x177116[_0x4053('0x45')]=_0x177116['monitors'][_0x1e47ce][_0x4053('0x46')];_0x177116[_0x4053('0x47')]=_0x177116[_0x4053('0x44')][_0x1e47ce][_0x4053('0x47')];if(_0x177116[_0x4053('0x2f')]==_0x4053('0x37')){_0x177116['calleridnum']=_0x177116['connectedlinenum'];_0x177116[_0x4053('0x48')]=_0x177116[_0x4053('0x49')];_0x177116[_0x4053('0x3e')]=_0x177116[_0x4053('0x22')];_0x177116['connectedlinename']=_0x177116[_0x4053('0x4a')];_0x177116[_0x4053('0x2f')]=_0x177116[_0x4053('0x39')];}else if(_0x177116['exten']==_0x4053('0x4b')){_0x177116[_0x4053('0x3c')]=_0x177116['destination'];_0x177116[_0x4053('0x2f')]=_0x177116[_0x4053('0x39')];}RpcVoiceRecording[_0x4053('0x43')](_0x177116);}}};Report[_0x4053('0x12')][_0x4053('0x4c')]=function(_0x4dae73){if(_[_0x4053('0x4d')](_0x4dae73)){_0x4dae73['forEach'](function(_0x262f48){RpcVoiceAgentReport[_0x4053('0x43')](_0x262f48);});}else{RpcVoiceAgentReport[_0x4053('0x43')](_0x4dae73);}};Report[_0x4053('0x12')][_0x4053('0x1b')]=function(_0x30b0a5){RpcVoiceDialReport['create'](_0x30b0a5);var _0x4be46a;var _0xeed082;var _0x480283=_0x30b0a5['channel'];if(_['startsWith'](_0x480283,_0x4053('0x4e'))){_0xeed082=_0x480283[_0x4053('0x4f')](_0x480283[_0x4053('0x50')]('/')+0x1,_0x480283['indexOf']('@'));_0x4be46a=_[_0x4053('0x21')](this[_0x4053('0x10')],function(_0x569203){return _0x569203[_0x4053('0x51')]==_0xeed082||_0x569203[_0x4053('0x52')]==_0xeed082||_0x569203[_0x4053('0x22')]==_0xeed082;});}else{_0xeed082=_0x480283[_0x4053('0x4f')](_0x480283[_0x4053('0x50')]('/')+0x1,_0x480283[_0x4053('0x53')]('-'));_0x4be46a=this['findAgent'](_0xeed082);}if(_0x4be46a){_0x30b0a5[_0x4053('0x25')]=_[_0x4053('0x24')](_0x4be46a[_0x4053('0x25')])?util['format'](_0x4053('0x26'),_0x4be46a[_0x4053('0x23')]):_0x4be46a['interface'];_0x30b0a5['membername']=_0x4be46a[_0x4053('0x23')];_0x30b0a5[_0x4053('0x22')]=_0x4be46a['accountcode'];RpcMemberReport['voiceDialReport'](_0x30b0a5);}};Report[_0x4053('0x12')][_0x4053('0x1d')]=function(_0x31f220){RpcVoiceTransferReport[_0x4053('0x40')][_0x31f220[_0x4053('0x54')]]=_0x31f220;};Report[_0x4053('0x12')]['attendedTransfer']=function(_0xa75bc5){RpcVoiceTransferReport[_0x4053('0x1f')](_0xa75bc5);};module[_0x4053('0x55')]=Report; \ No newline at end of file +var _0xa339=['mobile','phone','lastIndexOf','transfererlinkedid','moment','../ami','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceCallReport','./voiceAgentReport','./userReport','realtime','agents','telephones','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindTransfer','attendedtransfer','attendedTransfer','prototype','findAgent','accountcode','name','isNil','find','interface','format','length','connectedlinenum','assigned','SIP/%s','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','create','match','destination','exten','type','dialer','lastapplication','queue','context','callerid','from-sip','xcally-motion-preview','calleridnum','originatecalleridnum','destinationchannel','calleridpreview','disposition','ANSWERED','calleridname','linkedid','transfereelinkedid','uniqueid','transfers','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','membername','forEach','channel','startsWith','Local','substring','indexOf'];(function(_0x567fff,_0xd8acd8){var _0x465a37=function(_0x9d7bf7){while(--_0x9d7bf7){_0x567fff['push'](_0x567fff['shift']());}};_0x465a37(++_0xd8acd8);}(_0xa339,0xac));var _0x9a33=function(_0x2f8aa2,_0x548f3b){_0x2f8aa2=_0x2f8aa2-0x0;var _0x551fe9=_0xa339[_0x2f8aa2];return _0x551fe9;};'use strict';var _=require('lodash');var moment=require(_0x9a33('0x0'));var util=require('util');var config=require('../../../config/environment');var ami=require(_0x9a33('0x1'));var RpcVoiceAgentReport=require(_0x9a33('0x2'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x9a33('0x3'));var RpcMemberReport=require(_0x9a33('0x4'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x9a33('0x5'));var RpcVoiceTransferReport=require(_0x9a33('0x6'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x9a33('0x7'));var VoiceAgentReport=require(_0x9a33('0x8'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x9a33('0x9'));function Report(_0x5b0ac4){this[_0x9a33('0xa')]=_0x5b0ac4;this['agents']=_0x5b0ac4[_0x9a33('0xb')];this[_0x9a33('0xc')]=_0x5b0ac4[_0x9a33('0xc')];}Report['prototype'][_0x9a33('0xd')]=function(_0x340376){var _0x5c70b6=new VoiceQueueReport(this[_0x9a33('0xa')]);var _0x681d7d=new VoiceAgentReport(this[_0x9a33('0xa')]);var _0x494bde=new VoiceDialReport(this[_0x9a33('0xa')]);var _0x26bbc2=new VoiceCallReport(this[_0x9a33('0xa')]);var _0x11c90c=new UserReport(this[_0x9a33('0xa')]);if(config[_0x9a33('0xe')]&&config['xdr'][_0x9a33('0xf')]){ami['on'](_0x9a33('0x10'),this[_0x9a33('0x11')][_0x9a33('0x12')](this));ami['on'](_0x9a33('0x13'),this[_0x9a33('0x14')]['bind'](this));ami['on'](_0x9a33('0x15'),this[_0x9a33('0x16')]['bind'](this));ami['on'](_0x9a33('0x17'),this[_0x9a33('0x18')][_0x9a33('0x12')](this));ami['on']('blindtransfer',this[_0x9a33('0x19')][_0x9a33('0x12')](this));ami['on'](_0x9a33('0x1a'),this[_0x9a33('0x1b')]['bind'](this));}};Report[_0x9a33('0x1c')][_0x9a33('0x1d')]=function(_0x499c34){var _0x42204c;_0x42204c=_['find'](this[_0x9a33('0xb')],function(_0x576719){return _0x576719[_0x9a33('0x1e')]==_0x499c34||_0x576719[_0x9a33('0x1f')]==_0x499c34;});if(_[_0x9a33('0x20')](_0x42204c)){var _0x19aa50=_[_0x9a33('0x21')](this[_0x9a33('0xc')],function(_0x5a79ed){return _0x5a79ed[_0x9a33('0x1e')]==_0x499c34||_0x5a79ed['name']==_0x499c34;});if(_0x19aa50){_0x42204c=_[_0x9a33('0x21')](this[_0x9a33('0xb')],function(_0x566217){return _0x566217[_0x9a33('0x22')]==util[_0x9a33('0x23')]('SIP/%s',_0x19aa50[_0x9a33('0x1f')]);});}}return _0x42204c;};Report[_0x9a33('0x1c')][_0x9a33('0x11')]=function(_0x4ccb80){for(var _0x307bb0=0x0;_0x307bb0<_0x4ccb80[_0x9a33('0x24')];_0x307bb0+=0x1){var _0x8f2049=this[_0x9a33('0x1d')](_0x4ccb80[_0x307bb0][_0x9a33('0x25')]);if(_0x8f2049){_0x4ccb80[_0x307bb0][_0x9a33('0x1e')]=_0x8f2049[_0x9a33('0x1e')];_0x4ccb80[_0x307bb0][_0x9a33('0x26')]=!![];_0x4ccb80[_0x307bb0]['lastAssignedTo']=_0x8f2049[_0x9a33('0x1f')];_0x4ccb80[_0x307bb0]['interface']=_[_0x9a33('0x20')](_0x8f2049[_0x9a33('0x22')])?util[_0x9a33('0x23')](_0x9a33('0x27'),_0x8f2049[_0x9a33('0x1f')]):_0x8f2049[_0x9a33('0x22')];if(_0x4ccb80[_0x307bb0][_0x9a33('0x28')]){_0x4ccb80[_0x307bb0][_0x9a33('0x29')]=moment()[_0x9a33('0x23')](_0x9a33('0x2a'));}if(_0x4ccb80[_0x307bb0][_0x9a33('0x2b')]){_0x4ccb80[_0x307bb0]['queuecallerexitAt']=moment()['format'](_0x9a33('0x2a'));}RpcMemberReport[_0x9a33('0x11')](_0x4ccb80[_0x307bb0]);}RpcVoiceQueueReport[_0x9a33('0x2c')](_0x4ccb80[_0x307bb0]);}};function extractCalleridNumber(_0x592322){var _0x1df0f9=_0x592322[_0x9a33('0x2d')](/<(.*?)>/);return _0x1df0f9?_0x1df0f9[0x1]:_0x592322;}Report[_0x9a33('0x1c')]['voiceCallReport']=function(_0x1cd3d3){_0x1cd3d3[_0x9a33('0x2e')]=_0x1cd3d3[_0x9a33('0x2e')]||_0x1cd3d3[_0x9a33('0x2f')];if(_0x1cd3d3[_0x9a33('0x30')]==_0x9a33('0x31')){_0x1cd3d3[_0x9a33('0x32')]='queue';_0x1cd3d3['lastdata']=_0x1cd3d3[_0x9a33('0x33')];if(_0x1cd3d3[_0x9a33('0x34')]=='from-voip-provider'){_0x1cd3d3[_0x9a33('0x1e')]='';_0x1cd3d3[_0x9a33('0x2e')]=extractCalleridNumber(_0x1cd3d3[_0x9a33('0x35')]);}else if(_0x1cd3d3[_0x9a33('0x34')]==_0x9a33('0x36')){if(_0x1cd3d3[_0x9a33('0x2e')]==_0x9a33('0x37')){_0x1cd3d3['destination']=extractCalleridNumber(_0x1cd3d3['calleridpreview']);_0x1cd3d3[_0x9a33('0x38')]=_0x1cd3d3[_0x9a33('0x39')];_0x1cd3d3[_0x9a33('0x3a')]=[_0x1cd3d3['channel'],_0x1cd3d3['channel']=_0x1cd3d3[_0x9a33('0x3a')]][0x0];_0x1cd3d3[_0x9a33('0x35')]=_0x1cd3d3[_0x9a33('0x3b')];}else{_0x1cd3d3['destination']=_0x1cd3d3['calleridnum'];_0x1cd3d3[_0x9a33('0x38')]=_0x1cd3d3[_0x9a33('0x39')];if(_0x1cd3d3[_0x9a33('0x3c')]==_0x9a33('0x3d')){_0x1cd3d3[_0x9a33('0x1e')]=_0x1cd3d3[_0x9a33('0x25')];}else{_0x1cd3d3['accountcode']='';}}}}else{_0x1cd3d3['callerid']=util['format']('\x22%s\x22\x20<%s>',_0x1cd3d3[_0x9a33('0x3e')],_0x1cd3d3[_0x9a33('0x38')]);}if(RpcVoiceTransferReport['transfers'][_0x1cd3d3[_0x9a33('0x3f')]]){var _0x30c82d=RpcVoiceTransferReport['transfers'][_0x1cd3d3[_0x9a33('0x3f')]];_0x30c82d[_0x9a33('0x40')]=_0x1cd3d3[_0x9a33('0x41')];RpcVoiceTransferReport[_0x9a33('0x19')](_0x30c82d);delete RpcVoiceTransferReport[_0x9a33('0x42')][_0x1cd3d3[_0x9a33('0x3f')]];}RpcVoiceCallReport[_0x9a33('0x2c')](_0x1cd3d3);if(_0x1cd3d3[_0x9a33('0x43')]){for(var _0x5a36ca=0x0;_0x5a36ca<_0x1cd3d3[_0x9a33('0x44')][_0x9a33('0x24')];_0x5a36ca+=0x1){_0x1cd3d3[_0x9a33('0x45')]=_0x1cd3d3[_0x9a33('0x44')][_0x5a36ca][_0x9a33('0x46')];_0x1cd3d3[_0x9a33('0x47')]=_0x1cd3d3['monitors'][_0x5a36ca][_0x9a33('0x47')];if(_0x1cd3d3[_0x9a33('0x2f')]==_0x9a33('0x37')){_0x1cd3d3[_0x9a33('0x38')]=_0x1cd3d3[_0x9a33('0x25')];_0x1cd3d3['calleridname']=_0x1cd3d3[_0x9a33('0x48')];_0x1cd3d3[_0x9a33('0x25')]=_0x1cd3d3[_0x9a33('0x1e')];_0x1cd3d3[_0x9a33('0x48')]=_0x1cd3d3[_0x9a33('0x49')];_0x1cd3d3[_0x9a33('0x2f')]=_0x1cd3d3[_0x9a33('0x39')];}else if(_0x1cd3d3[_0x9a33('0x2f')]=='xcally-motion-dialer'){_0x1cd3d3[_0x9a33('0x38')]=_0x1cd3d3['destination'];_0x1cd3d3[_0x9a33('0x2f')]=_0x1cd3d3['originatecalleridnum'];}RpcVoiceRecording[_0x9a33('0x2c')](_0x1cd3d3);}}};Report[_0x9a33('0x1c')][_0x9a33('0x16')]=function(_0x987afe){if(_['isArray'](_0x987afe)){_0x987afe[_0x9a33('0x4a')](function(_0x1c2bfb){RpcVoiceAgentReport[_0x9a33('0x2c')](_0x1c2bfb);});}else{RpcVoiceAgentReport[_0x9a33('0x2c')](_0x987afe);}};Report[_0x9a33('0x1c')]['voiceDialReport']=function(_0x7e3c80){RpcVoiceDialReport[_0x9a33('0x2c')](_0x7e3c80);var _0x5b49a6;var _0x53ee3f;var _0x5affcf=_0x7e3c80[_0x9a33('0x4b')];if(_[_0x9a33('0x4c')](_0x5affcf,_0x9a33('0x4d'))){_0x53ee3f=_0x5affcf[_0x9a33('0x4e')](_0x5affcf['indexOf']('/')+0x1,_0x5affcf[_0x9a33('0x4f')]('@'));_0x5b49a6=_['find'](this[_0x9a33('0xb')],function(_0x198158){return _0x198158[_0x9a33('0x50')]==_0x53ee3f||_0x198158[_0x9a33('0x51')]==_0x53ee3f||_0x198158[_0x9a33('0x1e')]==_0x53ee3f;});}else{_0x53ee3f=_0x5affcf['substring'](_0x5affcf[_0x9a33('0x4f')]('/')+0x1,_0x5affcf[_0x9a33('0x52')]('-'));_0x5b49a6=this[_0x9a33('0x1d')](_0x53ee3f);}if(_0x5b49a6){_0x7e3c80[_0x9a33('0x22')]=_[_0x9a33('0x20')](_0x5b49a6[_0x9a33('0x22')])?util[_0x9a33('0x23')](_0x9a33('0x27'),_0x5b49a6[_0x9a33('0x1f')]):_0x5b49a6[_0x9a33('0x22')];_0x7e3c80[_0x9a33('0x49')]=_0x5b49a6[_0x9a33('0x1f')];_0x7e3c80[_0x9a33('0x1e')]=_0x5b49a6[_0x9a33('0x1e')];RpcMemberReport[_0x9a33('0x18')](_0x7e3c80);}};Report[_0x9a33('0x1c')][_0x9a33('0x19')]=function(_0x1f5ec0){RpcVoiceTransferReport[_0x9a33('0x42')][_0x1f5ec0[_0x9a33('0x53')]]=_0x1f5ec0;};Report[_0x9a33('0x1c')]['attendedTransfer']=function(_0x143a44){RpcVoiceTransferReport[_0x9a33('0x1b')](_0x143a44);};module['exports']=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index d137f1d..30da640 100644 --- a/server/services/ami/report/userReport.js +++ b/server/services/ami/report/userReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9f5c=['isNotNull','info','state','debug','[userReport][registry]','find','stateRegistry','omit','username','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','name','trunk:save','device','[userReport][devicestatechange]','local','toLowerCase','inuse','stateTime','toNumber','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','trunk:%s','startsWith','Local','substring','indexOf','mobile','phone','accountcode','syncPeerStatus','peer','address','registered','status','updateStatusRealtime','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]','moment','util','ioredis','bluebird','../../../config/logger','../ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','registry','bind','syncDeviceState','peerstatus','syncRealtimeShow','then','actionSipShowRegistry','catch','[userReport][sipshowregistry]','inspect','actionDeviceStateList','error','[userReport][devicestatelist]','resolve','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','emit'];(function(_0x18b191,_0x4e0684){var _0x43e146=function(_0x4b464e){while(--_0x4b464e){_0x18b191['push'](_0x18b191['shift']());}};_0x43e146(++_0x4e0684);}(_0x9f5c,0x183));var _0xc9f5=function(_0x52dd54,_0x4c37a3){_0x52dd54=_0x52dd54-0x0;var _0x385e14=_0x9f5c[_0x52dd54];return _0x385e14;};'use strict';var _=require('lodash');var moment=require(_0xc9f5('0x0'));var util=require(_0xc9f5('0x1'));var Redis=require(_0xc9f5('0x2'));var BPromise=require(_0xc9f5('0x3'));var config=require('../../../config/environment');var logger=require(_0xc9f5('0x4'))('ami');var ami=require(_0xc9f5('0x5'));config[_0xc9f5('0x6')]=_[_0xc9f5('0x7')](config['redis'],{'host':_0xc9f5('0x8'),'port':0x18eb});var io=require(_0xc9f5('0x9'))(new Redis(config[_0xc9f5('0x6')]));function UserReport(_0x3d5be8){this[_0xc9f5('0xa')]=_0x3d5be8['trunks'];this[_0xc9f5('0xb')]=_0x3d5be8[_0xc9f5('0xb')];this[_0xc9f5('0xc')]=_0x3d5be8['telephones'];ami['on'](_0xc9f5('0xd'),this[_0xc9f5('0xe')]['bind'](this));ami['on'](_0xc9f5('0xf'),this[_0xc9f5('0xe')][_0xc9f5('0x10')](this));ami['on']('devicestatechange',this[_0xc9f5('0x11')][_0xc9f5('0x10')](this));ami['on'](_0xc9f5('0x12'),this['syncPeerStatus'][_0xc9f5('0x10')](this));return this[_0xc9f5('0x13')]();}function showSipRegistrations(){Promise['resolve']()[_0xc9f5('0x14')](ami[_0xc9f5('0x15')]())[_0xc9f5('0x16')](function(_0x54f41a){logger['error'](_0xc9f5('0x17'),util[_0xc9f5('0x18')](_0x54f41a,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()[_0xc9f5('0x14')](ami[_0xc9f5('0x19')]())[_0xc9f5('0x16')](function(_0x715463){logger[_0xc9f5('0x1a')](_0xc9f5('0x1b'),util[_0xc9f5('0x18')](_0x715463,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xc9f5('0x1c')]()[_0xc9f5('0x14')](ami[_0xc9f5('0x1d')]())['catch'](function(_0x7f96e){logger[_0xc9f5('0x1a')](_0xc9f5('0x1e'),util['inspect'](_0x7f96e,{'showHidden':![],'depth':null}));});}UserReport['prototype'][_0xc9f5('0x13')]=function(){setInterval(function(){BPromise[_0xc9f5('0x1c')]()[_0xc9f5('0x14')](showSipRegistrations())[_0xc9f5('0x14')](listDeviceStates())['then'](showPeersStatus());},0x32c8);};UserReport[_0xc9f5('0x1f')]['isNotNull']=function(_0x3568b2){return _0x3568b2!==null&&!_['isUndefined'](_0x3568b2);};UserReport['prototype'][_0xc9f5('0x20')]=function(_0xa66544,_0x4a19fe,_0x41dc8a){io['to'](_0xa66544)['emit'](_0x4a19fe,_0x41dc8a);};UserReport[_0xc9f5('0x1f')][_0xc9f5('0xe')]=function(_0xfce97b){try{if(this[_0xc9f5('0x21')](_0xfce97b)){logger[_0xc9f5('0x22')]('[userReport][registry]\x20registry:%s\x20state:%s',_0xfce97b['username'],_0xfce97b[_0xc9f5('0x23')]);logger[_0xc9f5('0x24')](_0xc9f5('0x25'),util[_0xc9f5('0x18')](_0xfce97b,{'showHidden':![],'depth':null}));var _0x27df82=_[_0xc9f5('0x26')](this[_0xc9f5('0xa')],{'defaultuser':_0xfce97b['username']});if(_0x27df82){_0xfce97b[_0xc9f5('0x27')]=_0xfce97b['state'];_['merge'](_0x27df82,_[_0xc9f5('0x28')](_0xfce97b,['event','actionid',_0xc9f5('0x29'),_0xc9f5('0x23')]));logger[_0xc9f5('0x24')](_0xc9f5('0x2a'),util['inspect'](_0x27df82,{'showHidden':![],'depth':null}));this['emit'](util[_0xc9f5('0x2b')]('trunk:%s',_0x27df82[_0xc9f5('0x2c')]),_0xc9f5('0x2d'),_0x27df82);}}}catch(_0x84bc94){logger[_0xc9f5('0x1a')](_0xc9f5('0x25'),util['inspect'](_0x84bc94,{'showHidden':![],'depth':null}));}};UserReport[_0xc9f5('0x1f')]['syncDeviceState']=function(_0x3661ff){try{if(this[_0xc9f5('0x21')](_0x3661ff)){logger[_0xc9f5('0x22')]('[userReport][devicestatechange]\x20device:%s\x20state:%s',_0x3661ff[_0xc9f5('0x2e')],_0x3661ff[_0xc9f5('0x23')]);logger['debug'](_0xc9f5('0x2f'),util[_0xc9f5('0x18')](_0x3661ff,{'showHidden':![],'depth':null}));if(this[_0xc9f5('0xb')][_0x3661ff['device']]){if(!this[_0xc9f5('0xb')][_0x3661ff['device']][_0xc9f5('0x30')]||_0x3661ff[_0xc9f5('0x23')][_0xc9f5('0x31')]()==_0xc9f5('0x32')){this[_0xc9f5('0xb')][_0x3661ff[_0xc9f5('0x2e')]][_0xc9f5('0x30')]=![];if(this[_0xc9f5('0xb')][_0x3661ff[_0xc9f5('0x2e')]][_0xc9f5('0x23')]!==_0x3661ff[_0xc9f5('0x23')][_0xc9f5('0x31')]()){this['agents'][_0x3661ff[_0xc9f5('0x2e')]][_0xc9f5('0x33')]=_[_0xc9f5('0x34')](moment()[_0xc9f5('0x2b')]('x'));}this[_0xc9f5('0xb')][_0x3661ff[_0xc9f5('0x2e')]]['state']=_0x3661ff[_0xc9f5('0x23')][_0xc9f5('0x31')]();this[_0xc9f5('0xb')][_0x3661ff[_0xc9f5('0x2e')]]['updateStatusRealtime'](_0x3661ff);}}else if(this[_0xc9f5('0xc')][_0x3661ff[_0xc9f5('0x2e')]]){if(this[_0xc9f5('0xc')][_0x3661ff[_0xc9f5('0x2e')]]['state']!==_0x3661ff[_0xc9f5('0x23')][_0xc9f5('0x31')]()){this[_0xc9f5('0xc')][_0x3661ff[_0xc9f5('0x2e')]]['stateTime']=_[_0xc9f5('0x34')](moment()[_0xc9f5('0x2b')]('x'));}this['telephones'][_0x3661ff[_0xc9f5('0x2e')]][_0xc9f5('0x23')]=_0x3661ff[_0xc9f5('0x23')][_0xc9f5('0x31')]();logger[_0xc9f5('0x24')]('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util['inspect'](this[_0xc9f5('0xc')][_0x3661ff[_0xc9f5('0x2e')]],{'showHidden':![],'depth':null}));this['emit'](util['format']('telephone:%s',this['telephones'][_0x3661ff[_0xc9f5('0x2e')]]['name']),'telephone:save',this[_0xc9f5('0xc')][_0x3661ff[_0xc9f5('0x2e')]]);}else if(this[_0xc9f5('0xa')][_0x3661ff[_0xc9f5('0x2e')]]){if(this[_0xc9f5('0xa')][_0x3661ff[_0xc9f5('0x2e')]][_0xc9f5('0x23')]!==_0x3661ff[_0xc9f5('0x23')][_0xc9f5('0x31')]()){this[_0xc9f5('0xa')][_0x3661ff[_0xc9f5('0x2e')]][_0xc9f5('0x33')]=_[_0xc9f5('0x34')](moment()[_0xc9f5('0x2b')]('x'));}this[_0xc9f5('0xa')][_0x3661ff[_0xc9f5('0x2e')]]['state']=_0x3661ff['state'][_0xc9f5('0x31')]();logger['debug'](_0xc9f5('0x35'),util[_0xc9f5('0x18')](this[_0xc9f5('0xa')][_0x3661ff[_0xc9f5('0x2e')]],{'showHidden':![],'depth':null}));this[_0xc9f5('0x20')](util['format'](_0xc9f5('0x36'),this[_0xc9f5('0xa')][_0x3661ff[_0xc9f5('0x2e')]][_0xc9f5('0x2c')]),'trunk:save',this[_0xc9f5('0xa')][_0x3661ff[_0xc9f5('0x2e')]]);}else if(_[_0xc9f5('0x37')](_0x3661ff[_0xc9f5('0x2e')],_0xc9f5('0x38'))){var _0x514c8d=_0x3661ff[_0xc9f5('0x2e')];var _0x152968=_0x514c8d[_0xc9f5('0x39')](_0x514c8d[_0xc9f5('0x3a')]('/')+0x1,_0x514c8d[_0xc9f5('0x3a')]('@'));var _0x97e18a=_[_0xc9f5('0x26')](this[_0xc9f5('0xb')],function(_0xba6df1){return _0xba6df1[_0xc9f5('0x3b')]==_0x152968||_0xba6df1[_0xc9f5('0x3c')]==_0x152968||_0xba6df1[_0xc9f5('0x3d')]==_0x152968;});if(_0x97e18a){if(_0x97e18a[_0xc9f5('0x23')]!==_0x3661ff[_0xc9f5('0x23')][_0xc9f5('0x31')]()){_0x97e18a['stateTime']=_[_0xc9f5('0x34')](moment()['format']('x'));}_0x97e18a[_0xc9f5('0x23')]=_0x3661ff['state'][_0xc9f5('0x31')]();_0x97e18a[_0xc9f5('0x30')]=!![];_0x97e18a['updateStatusRealtime'](_0x3661ff);}}}}catch(_0x5529a2){logger[_0xc9f5('0x1a')](_0xc9f5('0x2f'),util[_0xc9f5('0x18')](_0x5529a2,{'showHidden':![],'depth':null}));}};UserReport[_0xc9f5('0x1f')][_0xc9f5('0x3e')]=function(_0x495446){try{if(this[_0xc9f5('0x21')](_0x495446)&&this['isNotNull'](_0x495446['peerstatus'])){logger[_0xc9f5('0x22')]('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x495446[_0xc9f5('0x3f')],_0x495446[_0xc9f5('0x40')],_0x495446[_0xc9f5('0x12')]);logger['debug']('[userReport][peerstatus]',util[_0xc9f5('0x18')](_0x495446,{'showHidden':![],'depth':null}));if(this[_0xc9f5('0xb')][_0x495446['peer']]){if(!this[_0xc9f5('0xb')][_0x495446[_0xc9f5('0x3f')]][_0xc9f5('0x30')]||_0x495446[_0xc9f5('0x12')]['toLowerCase']()==_0xc9f5('0x41')){this['agents'][_0x495446[_0xc9f5('0x3f')]]['local']=![];this[_0xc9f5('0xb')][_0x495446['peer']][_0xc9f5('0x42')]=_0x495446['peerstatus']['toLowerCase']();this[_0xc9f5('0xb')][_0x495446[_0xc9f5('0x3f')]][_0xc9f5('0x40')]=_0x495446[_0xc9f5('0x40')];this[_0xc9f5('0xb')][_0x495446['peer']][_0xc9f5('0x43')](_0x495446);}}else if(this[_0xc9f5('0xc')][_0x495446['peer']]){this['telephones'][_0x495446[_0xc9f5('0x3f')]][_0xc9f5('0x42')]=_0x495446[_0xc9f5('0x12')]['toLowerCase']();this[_0xc9f5('0xc')][_0x495446[_0xc9f5('0x3f')]]['address']=_0x495446[_0xc9f5('0x40')];logger[_0xc9f5('0x24')](_0xc9f5('0x44'),util['inspect'](this['telephones'][_0x495446[_0xc9f5('0x3f')]],{'showHidden':![],'depth':null}));this['emit'](util['format']('telephone:%s',this[_0xc9f5('0xc')][_0x495446['peer']][_0xc9f5('0x2c')]),'telephone:save',this['telephones'][_0x495446['peer']]);}else if(this[_0xc9f5('0xa')][_0x495446[_0xc9f5('0x3f')]]){this[_0xc9f5('0xa')][_0x495446['peer']][_0xc9f5('0x42')]=_0x495446[_0xc9f5('0x12')][_0xc9f5('0x31')]();this[_0xc9f5('0xa')][_0x495446['peer']][_0xc9f5('0x40')]=_0x495446['address'];logger[_0xc9f5('0x24')]('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util[_0xc9f5('0x18')](this[_0xc9f5('0xa')][_0x495446['peer']],{'showHidden':![],'depth':null}));this[_0xc9f5('0x20')](util[_0xc9f5('0x2b')]('trunk:%s',this[_0xc9f5('0xa')][_0x495446[_0xc9f5('0x3f')]][_0xc9f5('0x2c')]),_0xc9f5('0x2d'),this[_0xc9f5('0xa')][_0x495446['peer']]);}}}catch(_0x56863a){logger[_0xc9f5('0x1a')](_0xc9f5('0x45'),util['inspect'](_0x56863a,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file +var _0x2118=['[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','info','username','state','[userReport][registry]','find','stateRegistry','merge','omit','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','trunk:save','device','debug','[userReport][devicestatechange]','local','toLowerCase','stateTime','updateStatusRealtime','toNumber','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','substring','indexOf','mobile','phone','accountcode','peerstatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','moment','util','ioredis','bluebird','../../../config/environment','../../../config/logger','ami','defaults','localhost','socket.io-emitter','redis','trunks','agents','telephones','registryentry','syncRegistry','bind','devicestatechange','syncDeviceState','syncPeerStatus','syncRealtimeShow','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','resolve','actionDeviceStateList'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2118,0x1bd));var _0x8211=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x2118[_0x27af45];return _0x18df21;};'use strict';var _=require('lodash');var moment=require(_0x8211('0x0'));var util=require(_0x8211('0x1'));var Redis=require(_0x8211('0x2'));var BPromise=require(_0x8211('0x3'));var config=require(_0x8211('0x4'));var logger=require(_0x8211('0x5'))(_0x8211('0x6'));var ami=require('../ami');config['redis']=_[_0x8211('0x7')](config['redis'],{'host':_0x8211('0x8'),'port':0x18eb});var io=require(_0x8211('0x9'))(new Redis(config[_0x8211('0xa')]));function UserReport(_0x3182d6){this[_0x8211('0xb')]=_0x3182d6[_0x8211('0xb')];this[_0x8211('0xc')]=_0x3182d6[_0x8211('0xc')];this['telephones']=_0x3182d6[_0x8211('0xd')];ami['on'](_0x8211('0xe'),this[_0x8211('0xf')]['bind'](this));ami['on']('registry',this[_0x8211('0xf')][_0x8211('0x10')](this));ami['on'](_0x8211('0x11'),this[_0x8211('0x12')][_0x8211('0x10')](this));ami['on']('peerstatus',this[_0x8211('0x13')][_0x8211('0x10')](this));return this[_0x8211('0x14')]();}function showSipRegistrations(){Promise['resolve']()[_0x8211('0x15')](ami[_0x8211('0x16')]())[_0x8211('0x17')](function(_0x32f323){logger[_0x8211('0x18')](_0x8211('0x19'),util[_0x8211('0x1a')](_0x32f323,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x8211('0x1b')]()[_0x8211('0x15')](ami[_0x8211('0x1c')]())['catch'](function(_0x199a85){logger[_0x8211('0x18')](_0x8211('0x1d'),util[_0x8211('0x1a')](_0x199a85,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x8211('0x1b')]()[_0x8211('0x15')](ami[_0x8211('0x1e')]())[_0x8211('0x17')](function(_0x2368b9){logger[_0x8211('0x18')](_0x8211('0x1f'),util[_0x8211('0x1a')](_0x2368b9,{'showHidden':![],'depth':null}));});}UserReport[_0x8211('0x20')][_0x8211('0x14')]=function(){setInterval(function(){BPromise[_0x8211('0x1b')]()['then'](showSipRegistrations())[_0x8211('0x15')](listDeviceStates())[_0x8211('0x15')](showPeersStatus());},0x32c8);};UserReport['prototype'][_0x8211('0x21')]=function(_0x350a73){return _0x350a73!==null&&!_[_0x8211('0x22')](_0x350a73);};UserReport['prototype'][_0x8211('0x23')]=function(_0x351fc4,_0x29a3fd,_0x1da999){io['to'](_0x351fc4)[_0x8211('0x23')](_0x29a3fd,_0x1da999);};UserReport[_0x8211('0x20')][_0x8211('0xf')]=function(_0xf3071){try{if(this[_0x8211('0x21')](_0xf3071)){logger[_0x8211('0x24')]('[userReport][registry]\x20registry:%s\x20state:%s',_0xf3071[_0x8211('0x25')],_0xf3071[_0x8211('0x26')]);logger['debug'](_0x8211('0x27'),util['inspect'](_0xf3071,{'showHidden':![],'depth':null}));var _0x11f1f5=_[_0x8211('0x28')](this[_0x8211('0xb')],{'defaultuser':_0xf3071[_0x8211('0x25')]});if(_0x11f1f5){_0xf3071[_0x8211('0x29')]=_0xf3071['state'];_[_0x8211('0x2a')](_0x11f1f5,_[_0x8211('0x2b')](_0xf3071,['event',_0x8211('0x2c'),'username',_0x8211('0x26')]));logger['debug'](_0x8211('0x2d'),util['inspect'](_0x11f1f5,{'showHidden':![],'depth':null}));this['emit'](util[_0x8211('0x2e')](_0x8211('0x2f'),_0x11f1f5[_0x8211('0x30')]),_0x8211('0x31'),_0x11f1f5);}}}catch(_0xc9634e){logger[_0x8211('0x18')](_0x8211('0x27'),util['inspect'](_0xc9634e,{'showHidden':![],'depth':null}));}};UserReport[_0x8211('0x20')][_0x8211('0x12')]=function(_0x1f88cb){try{if(this['isNotNull'](_0x1f88cb)){logger['info']('[userReport][devicestatechange]\x20device:%s\x20state:%s',_0x1f88cb[_0x8211('0x32')],_0x1f88cb[_0x8211('0x26')]);logger[_0x8211('0x33')](_0x8211('0x34'),util[_0x8211('0x1a')](_0x1f88cb,{'showHidden':![],'depth':null}));if(this[_0x8211('0xc')][_0x1f88cb[_0x8211('0x32')]]){if(!this[_0x8211('0xc')][_0x1f88cb[_0x8211('0x32')]][_0x8211('0x35')]||_0x1f88cb[_0x8211('0x26')][_0x8211('0x36')]()=='inuse'){this[_0x8211('0xc')][_0x1f88cb[_0x8211('0x32')]][_0x8211('0x35')]=![];if(this[_0x8211('0xc')][_0x1f88cb[_0x8211('0x32')]][_0x8211('0x26')]!==_0x1f88cb['state'][_0x8211('0x36')]()){this[_0x8211('0xc')][_0x1f88cb[_0x8211('0x32')]][_0x8211('0x37')]=_['toNumber'](moment()['format']('x'));}this[_0x8211('0xc')][_0x1f88cb[_0x8211('0x32')]][_0x8211('0x26')]=_0x1f88cb['state'][_0x8211('0x36')]();this[_0x8211('0xc')][_0x1f88cb[_0x8211('0x32')]][_0x8211('0x38')](_0x1f88cb);}}else if(this[_0x8211('0xd')][_0x1f88cb[_0x8211('0x32')]]){if(this['telephones'][_0x1f88cb['device']][_0x8211('0x26')]!==_0x1f88cb[_0x8211('0x26')]['toLowerCase']()){this[_0x8211('0xd')][_0x1f88cb[_0x8211('0x32')]][_0x8211('0x37')]=_[_0x8211('0x39')](moment()['format']('x'));}this[_0x8211('0xd')][_0x1f88cb['device']]['state']=_0x1f88cb['state'][_0x8211('0x36')]();logger[_0x8211('0x33')](_0x8211('0x3a'),util[_0x8211('0x1a')](this[_0x8211('0xd')][_0x1f88cb[_0x8211('0x32')]],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x8211('0x3b'),this['telephones'][_0x1f88cb[_0x8211('0x32')]][_0x8211('0x30')]),_0x8211('0x3c'),this[_0x8211('0xd')][_0x1f88cb[_0x8211('0x32')]]);}else if(this[_0x8211('0xb')][_0x1f88cb[_0x8211('0x32')]]){if(this[_0x8211('0xb')][_0x1f88cb[_0x8211('0x32')]][_0x8211('0x26')]!==_0x1f88cb[_0x8211('0x26')][_0x8211('0x36')]()){this[_0x8211('0xb')][_0x1f88cb[_0x8211('0x32')]][_0x8211('0x37')]=_[_0x8211('0x39')](moment()[_0x8211('0x2e')]('x'));}this[_0x8211('0xb')][_0x1f88cb['device']]['state']=_0x1f88cb[_0x8211('0x26')][_0x8211('0x36')]();logger[_0x8211('0x33')](_0x8211('0x3d'),util[_0x8211('0x1a')](this[_0x8211('0xb')][_0x1f88cb['device']],{'showHidden':![],'depth':null}));this['emit'](util[_0x8211('0x2e')](_0x8211('0x2f'),this['trunks'][_0x1f88cb[_0x8211('0x32')]]['name']),_0x8211('0x31'),this[_0x8211('0xb')][_0x1f88cb['device']]);}else if(_[_0x8211('0x3e')](_0x1f88cb[_0x8211('0x32')],_0x8211('0x3f'))){var _0x44fb01=_0x1f88cb[_0x8211('0x32')];var _0x43d15b=_0x44fb01[_0x8211('0x40')](_0x44fb01[_0x8211('0x41')]('/')+0x1,_0x44fb01[_0x8211('0x41')]('@'));var _0x332603=_['find'](this['agents'],function(_0x384a25){return _0x384a25[_0x8211('0x42')]==_0x43d15b||_0x384a25[_0x8211('0x43')]==_0x43d15b||_0x384a25[_0x8211('0x44')]==_0x43d15b;});if(_0x332603){if(_0x332603[_0x8211('0x26')]!==_0x1f88cb[_0x8211('0x26')]['toLowerCase']()){_0x332603['stateTime']=_[_0x8211('0x39')](moment()['format']('x'));}_0x332603['state']=_0x1f88cb['state'][_0x8211('0x36')]();_0x332603[_0x8211('0x35')]=!![];_0x332603[_0x8211('0x38')](_0x1f88cb);}}}}catch(_0x4ad9f0){logger['error'](_0x8211('0x34'),util[_0x8211('0x1a')](_0x4ad9f0,{'showHidden':![],'depth':null}));}};UserReport[_0x8211('0x20')][_0x8211('0x13')]=function(_0x912f34){try{if(this[_0x8211('0x21')](_0x912f34)&&this[_0x8211('0x21')](_0x912f34[_0x8211('0x45')])){logger['info'](_0x8211('0x46'),_0x912f34[_0x8211('0x47')],_0x912f34[_0x8211('0x48')],_0x912f34[_0x8211('0x45')]);logger[_0x8211('0x33')](_0x8211('0x49'),util['inspect'](_0x912f34,{'showHidden':![],'depth':null}));if(this[_0x8211('0xc')][_0x912f34[_0x8211('0x47')]]){if(!this[_0x8211('0xc')][_0x912f34[_0x8211('0x47')]][_0x8211('0x35')]||_0x912f34[_0x8211('0x45')][_0x8211('0x36')]()==_0x8211('0x4a')){this[_0x8211('0xc')][_0x912f34[_0x8211('0x47')]][_0x8211('0x35')]=![];this[_0x8211('0xc')][_0x912f34[_0x8211('0x47')]][_0x8211('0x4b')]=_0x912f34[_0x8211('0x45')][_0x8211('0x36')]();this[_0x8211('0xc')][_0x912f34[_0x8211('0x47')]][_0x8211('0x48')]=_0x912f34[_0x8211('0x48')];this[_0x8211('0xc')][_0x912f34[_0x8211('0x47')]][_0x8211('0x38')](_0x912f34);}}else if(this[_0x8211('0xd')][_0x912f34[_0x8211('0x47')]]){this[_0x8211('0xd')][_0x912f34[_0x8211('0x47')]][_0x8211('0x4b')]=_0x912f34[_0x8211('0x45')]['toLowerCase']();this[_0x8211('0xd')][_0x912f34[_0x8211('0x47')]][_0x8211('0x48')]=_0x912f34[_0x8211('0x48')];logger['debug'](_0x8211('0x4c'),util[_0x8211('0x1a')](this[_0x8211('0xd')][_0x912f34[_0x8211('0x47')]],{'showHidden':![],'depth':null}));this[_0x8211('0x23')](util[_0x8211('0x2e')](_0x8211('0x3b'),this[_0x8211('0xd')][_0x912f34[_0x8211('0x47')]][_0x8211('0x30')]),'telephone:save',this[_0x8211('0xd')][_0x912f34[_0x8211('0x47')]]);}else if(this[_0x8211('0xb')][_0x912f34[_0x8211('0x47')]]){this[_0x8211('0xb')][_0x912f34[_0x8211('0x47')]][_0x8211('0x4b')]=_0x912f34[_0x8211('0x45')][_0x8211('0x36')]();this[_0x8211('0xb')][_0x912f34[_0x8211('0x47')]]['address']=_0x912f34[_0x8211('0x48')];logger[_0x8211('0x33')](_0x8211('0x4d'),util[_0x8211('0x1a')](this[_0x8211('0xb')][_0x912f34[_0x8211('0x47')]],{'showHidden':![],'depth':null}));this[_0x8211('0x23')](util[_0x8211('0x2e')]('trunk:%s',this['trunks'][_0x912f34['peer']]['name']),_0x8211('0x31'),this[_0x8211('0xb')][_0x912f34[_0x8211('0x47')]]);}}}catch(_0x3e101c){logger[_0x8211('0x18')](_0x8211('0x49'),util[_0x8211('0x1a')](_0x3e101c,{'showHidden':![],'depth':null}));}};module[_0x8211('0x4e')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index a59a545..87731ec 100644 --- a/server/services/ami/report/voiceAgentReport.js +++ b/server/services/ami/report/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['redis','defaults','localhost','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','uniqueid','YYYY-MM-DD\x20HH:mm:ss','queue','mandatoryDisposition','type','inbound','merge','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','voiceChannels','routealias','interface','pick','destconnectedlinenum','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:%s','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answered_elsewhere','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','error','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','agentringnoanswer','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','reason','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acw','acwtime','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]','lodash','moment','util','../../../config/logger','../ami'];(function(_0x235038,_0x15a378){var _0xc45e16=function(_0x49574c){while(--_0x49574c){_0x235038['push'](_0x235038['shift']());}};_0xc45e16(++_0x15a378);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var _=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x0a9e('0x3'))('ami');var ami=require(_0x0a9e('0x4'));config[_0x0a9e('0x5')]=_[_0x0a9e('0x6')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x5')]));function VoiceAgentReport(_0x441e3a){this[_0x0a9e('0x8')]={};this['voiceChannels']=_0x441e3a['channels'];this[_0x0a9e('0x9')]=_0x441e3a['voiceQueues'];this['agents']=_0x441e3a[_0x0a9e('0xa')];this[_0x0a9e('0xb')]={};ami['on'](_0x0a9e('0xc'),this[_0x0a9e('0xd')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0xf'),this['syncAgentConnect']['bind'](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x10'),this[_0x0a9e('0x11')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x12'),this[_0x0a9e('0x13')]['bind'](this));ami['on'](_0x0a9e('0x14'),this[_0x0a9e('0x15')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0xe')](this));ami['on']('musiconholdstart',this[_0x0a9e('0x18')]['bind'](this));ami['on'](_0x0a9e('0x19'),this['syncMusicOnHoldStop'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x1a'),this['syncAttendedTransfer'][_0x0a9e('0xe')](this));ami['on']('blindtransfer',this[_0x0a9e('0x1b')][_0x0a9e('0xe')](this));}VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1d')]=function(_0x31b1ca,_0x2eb11f,_0x530eb7){io['to'](_0x31b1ca)[_0x0a9e('0x1d')](_0x2eb11f,_0x530eb7);};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1e')]=function(_0x1c696a){return _0x1c696a!==null&&!_[_0x0a9e('0x1f')](_0x1c696a);};VoiceAgentReport['prototype'][_0x0a9e('0xd')]=function(_0x155cce){try{if(this['isNotNull'](_0x155cce)){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x155cce['uniqueid'],_0x155cce[_0x0a9e('0x21')],_0x155cce[_0x0a9e('0x22')]);logger[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x155cce,{'showHidden':![],'depth':null}));if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]]={};}if(_[_0x0a9e('0x1f')](this['channels'][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]={'agentcalledAt':moment()['format'](_0x0a9e('0x27')),'lastevent':'called','mandatoryDisposition':this[_0x0a9e('0x9')][_0x155cce['queue']]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x29')]||![]:![],'type':this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x2a')]||'inbound':_0x0a9e('0x2b'),'variables':this[_0x0a9e('0xb')][_0x155cce[_0x0a9e('0x26')]]};}_[_0x0a9e('0x2c')](this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],_[_0x0a9e('0x2d')](_0x155cce,[_0x0a9e('0x2e'),_0x0a9e('0x2f')]));logger[_0x0a9e('0x23')](_0x0a9e('0x30'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x31'),this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]);logger['debug'](_0x0a9e('0x32'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x33')]('user:%s',_0x155cce[_0x0a9e('0x21')]),'user:called',this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]);}}catch(_0x3f3d41){logger['error'](_0x0a9e('0x34'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x3f3d41,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncAgentConnect']=function(_0x54135e){try{if(this[_0x0a9e('0x1e')](_0x54135e)){if(this['channels'][_0x54135e[_0x0a9e('0x26')]]){logger[_0x0a9e('0x23')](_0x0a9e('0x35'),_0x54135e[_0x0a9e('0x26')],util['inspect'](_0x54135e,{'showHidden':![],'depth':null}));for(var _0x31916f in this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]]){if(this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x31916f)){if(_0x54135e[_0x0a9e('0x22')]===_0x31916f){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x54135e[_0x0a9e('0x26')],_0x54135e[_0x0a9e('0x21')],_0x54135e['destuniqueid']);this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x37')]=moment()[_0x0a9e('0x33')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x38')]=_0x54135e['connectedlinename'];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x39')]=_0x54135e['connectedlinenum'];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3a')]=_0x54135e[_0x0a9e('0x3a')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3b')]=_0x54135e[_0x0a9e('0x3b')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3c')]=_0x54135e[_0x0a9e('0x3c')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3d')]='connect';if(this['voiceChannels'][this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x26')]]){var _0x315881=this[_0x0a9e('0x3e')][this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x26')]][_0x0a9e('0x3f')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3f')]=_0x315881;_0x54135e['routealias']=_0x315881;}_[_0x0a9e('0x2c')](this[_0x0a9e('0xa')][_0x54135e[_0x0a9e('0x40')]],_[_0x0a9e('0x41')](_0x54135e,[_0x0a9e('0x28'),_0x0a9e('0x42'),_0x0a9e('0x3f')]));logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:',_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami['emit'](_0x0a9e('0x43'),this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]]);logger[_0x0a9e('0x23')](_0x0a9e('0x44'),_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x33')](_0x0a9e('0x45'),_0x54135e[_0x0a9e('0x21')]),_0x0a9e('0x46'),this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x54135e[_0x0a9e('0x22')]]);}else if(!this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['agentringnoanswer']&&!this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')](_0x0a9e('0x47'),_0x54135e[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x21')],_0x31916f);this['channels'][_0x54135e['uniqueid']][_0x31916f]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x48')]=moment()['format'](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['answeredelsewheredestinationuniqueid']=_0x54135e[_0x0a9e('0x22')];this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f]['answeredelsewheremembername']=_0x54135e[_0x0a9e('0x21')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f]['lastevent']=_0x0a9e('0x49');this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['reason']=_0x0a9e('0x49');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')]('custom:agentansweredelsewhere',this['channels'][_0x54135e['uniqueid']][_0x31916f]);}}}}}}catch(_0x2da03c){logger['error'](_0x0a9e('0x4a'),_0x54135e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2da03c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x4b')]=function(_0x272738){try{if(this[_0x0a9e('0x1e')](_0x272738)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x272738[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x272738,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]]&&this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']]){logger[_0x0a9e('0x20')](_0x0a9e('0x4c'),_0x272738['uniqueid'],_0x272738[_0x0a9e('0x21')],_0x272738['destuniqueid']);this[_0x0a9e('0x8')][_0x272738['uniqueid']][_0x272738['destuniqueid']]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x272738['uniqueid']][_0x272738[_0x0a9e('0x22')]][_0x0a9e('0x48')]=moment()[_0x0a9e('0x33')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']][_0x0a9e('0x3d')]='rejected';this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738[_0x0a9e('0x22')]]['reason']=_0x0a9e('0x4d');logger[_0x0a9e('0x23')](_0x0a9e('0x4e'),_0x272738[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x4f'),this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738[_0x0a9e('0x22')]]);}}}catch(_0x4d4a35){logger[_0x0a9e('0x50')](_0x0a9e('0x51'),_0x272738[_0x0a9e('0x26')],util['inspect'](_0x4d4a35,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncQueueCallerAbandon']=function(_0x5211e3){try{if(this[_0x0a9e('0x1e')](_0x5211e3)){logger[_0x0a9e('0x23')](_0x0a9e('0x52'),_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x5211e3,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]]){for(var _0x54a37d in this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x54a37d)&&!this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x53')]&&!this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d]['agentcomplete']){logger[_0x0a9e('0x20')](_0x0a9e('0x54'),_0x5211e3[_0x0a9e('0x26')],this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x21')],_0x54a37d);this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x53')]=!![];this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x48')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x3d')]=_0x0a9e('0x55');this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x56')]=_0x0a9e('0x55');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x5211e3['uniqueid']][_0x54a37d],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')]('custom:agentqueuecallerabandon',this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d]);}}}}}catch(_0x4c46c1){logger[_0x0a9e('0x50')](_0x0a9e('0x57'),_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4c46c1,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x13')]=function(_0x2e9552){try{if(this[_0x0a9e('0x1e')](_0x2e9552)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2e9552,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]]){for(var _0x4abc8f in this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x4abc8f)){if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x37')]&&!this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')](_0x0a9e('0x58'),_0x2e9552[_0x0a9e('0x26')],this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x21')],_0x4abc8f);this[_0x0a9e('0x8')][_0x2e9552['uniqueid']][_0x4abc8f][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x59')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]['lastevent']=_0x0a9e('0x5a');this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x56')]=_0x2e9552['reason']==_0x0a9e('0x5b')?_0x0a9e('0x5c'):_0x2e9552[_0x0a9e('0x56')];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x5d')]=_0x2e9552[_0x0a9e('0x5d')];if(this['voiceQueues'][_0x2e9552[_0x0a9e('0x28')]]&&this[_0x0a9e('0x9')][_0x2e9552[_0x0a9e('0x28')]][_0x0a9e('0x5e')]){this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x5f')]=this['voiceQueues'][_0x2e9552[_0x0a9e('0x28')]]['acwTimeout'];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x60')]=!![];}this[_0x0a9e('0xa')][_0x2e9552['interface']]=_['omit'](this[_0x0a9e('0xa')][_0x2e9552[_0x0a9e('0x40')]],[_0x0a9e('0x28'),'destconnectedlinenum']);logger[_0x0a9e('0x23')](_0x0a9e('0x61'),_0x2e9552['uniqueid'],util['inspect'](this[_0x0a9e('0x8')][_0x2e9552['uniqueid']][_0x4abc8f],{'showHidden':![],'depth':null}));ami['emit']('custom:agentcomplete',this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]);logger[_0x0a9e('0x23')](_0x0a9e('0x62'),_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f],{'showHidden':![],'depth':null}));this['emit'](util[_0x0a9e('0x33')](_0x0a9e('0x45'),_0x2e9552[_0x0a9e('0x21')]),_0x0a9e('0x63'),this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]);}}}}}}catch(_0x32f761){logger[_0x0a9e('0x50')]('[%s][voiceAgentReport][agentcomplete]',_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x32f761,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x15')]=function(_0x255e49){try{if(this[_0x0a9e('0x1e')](_0x255e49)){logger[_0x0a9e('0x23')](_0x0a9e('0x64'),_0x255e49['uniqueid'],util[_0x0a9e('0x25')](_0x255e49,{'showHidden':![],'depth':null}));this[_0x0a9e('0x65')](_0x255e49['uniqueid'],_[_0x0a9e('0x66')](_0x255e49[_0x0a9e('0x67')])[0x0],_0x255e49[_0x0a9e('0x68')]);if(this['channels'][_0x255e49[_0x0a9e('0x26')]]){for(var _0x52ec10 in this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x52ec10)){logger[_0x0a9e('0x20')](_0x0a9e('0x69'),_0x255e49[_0x0a9e('0x26')],_0x52ec10,_['keys'](_0x255e49[_0x0a9e('0x67')])[0x0],_0x255e49[_0x0a9e('0x68')]);if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')])){this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')]={};}this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')]=this[_0x0a9e('0xb')][_0x255e49['uniqueid']];}}}}}catch(_0xc81b64){logger[_0x0a9e('0x50')](_0x0a9e('0x6a'),_0x255e49[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xc81b64,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x65')]=function(_0x1756c7,_0x5ce99d,_0x23b447){var _0x5e725e=[_0x0a9e('0x6b'),_0x0a9e('0x6c'),_0x0a9e('0x6d'),_0x0a9e('0x6e'),'rtpaudioqosloss',_0x0a9e('0x6f'),'rtpaudioqosrtt',_0x0a9e('0x70'),_0x0a9e('0x71'),'sipuri',_0x0a9e('0x72'),_0x0a9e('0x73'),_0x0a9e('0x74'),'memberdynamic','memberinterface',_0x0a9e('0x75'),_0x0a9e('0x21'),_0x0a9e('0x76'),_0x0a9e('0x77')];if(!_[_0x0a9e('0x78')](_0x5ce99d)&&!_[_0x0a9e('0x79')](_0x5e725e,_0x5ce99d)){if(_[_0x0a9e('0x1f')](this[_0x0a9e('0xb')][_0x1756c7])){this[_0x0a9e('0xb')][_0x1756c7]={};}this['variables'][_0x1756c7][_0x5ce99d]=_0x23b447;}};VoiceAgentReport[_0x0a9e('0x1c')]['syncHangup']=function(_0x287324){try{if(this[_0x0a9e('0x1e')](_0x287324)){logger[_0x0a9e('0x23')](_0x0a9e('0x7a'),_0x287324[_0x0a9e('0x26')],util['inspect'](_0x287324,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]){for(var _0x2791c5 in this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]){if(this['channels'][_0x287324['uniqueid']][_0x0a9e('0x36')](_0x2791c5)){if(this['channels'][_0x287324[_0x0a9e('0x26')]][_0x2791c5][_0x0a9e('0x56')]==_0x0a9e('0x5b')&&this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]][_0x2791c5][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x287324[_0x0a9e('0x26')],_0x2791c5);this['channels'][_0x287324[_0x0a9e('0x26')]][_0x2791c5]['agentcompleteAt']=moment()[_0x0a9e('0x33')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger['debug'](_0x0a9e('0x7b'),_0x287324[_0x0a9e('0x26')],util['inspect'](_[_0x0a9e('0x7c')](this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x7d'),_['values'](this['channels'][_0x287324[_0x0a9e('0x26')]]));delete this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]];}if(this[_0x0a9e('0xb')][_0x287324[_0x0a9e('0x26')]]){delete this['variables'][_0x287324[_0x0a9e('0x26')]];}}}catch(_0xadce3d){logger['error'](_0x0a9e('0x7e'),_0x287324[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xadce3d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x7f')]=function(_0x23b39e){try{if(this[_0x0a9e('0x1e')](_0x23b39e)){logger[_0x0a9e('0x23')](_0x0a9e('0x80'),_0x23b39e[_0x0a9e('0x26')],util['inspect'](_0x23b39e,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]]){for(var _0x2ada60 in this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]]){if(this['channels'][_0x23b39e['transfereeuniqueid']][_0x0a9e('0x36')](_0x2ada60)){if(_0x23b39e[_0x0a9e('0x82')]===_0x2ada60){logger[_0x0a9e('0x20')](_0x0a9e('0x83'),_0x23b39e[_0x0a9e('0x26')],this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x21')],_0x2ada60);var _0x3450ae=moment();this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x23b39e['transfereeuniqueid']][_0x2ada60][_0x0a9e('0x59')]=moment()[_0x0a9e('0x33')](_0x0a9e('0x27'));this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60]['lastevent']=_0x0a9e('0x5a');this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x56')]=_0x0a9e('0x5b');this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x5d')]=_0x3450ae[_0x0a9e('0x84')](this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x37')],_0x0a9e('0x85'));}}}}if(this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x86')]]){var _0x248368=this['channels'][_0x23b39e['secondtransfereruniqueid']];this[_0x0a9e('0x8')][_0x23b39e['secondtransfereruniqueid']]=this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]];this['channels'][_0x23b39e[_0x0a9e('0x81')]]=_0x248368;}}}catch(_0xe2b083){logger[_0x0a9e('0x50')](_0x0a9e('0x87'),_0x23b39e['uniqueid'],util[_0x0a9e('0x25')](_0xe2b083,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1b')]=function(_0x34a791){try{if(this['isNotNull'](_0x34a791)){logger[_0x0a9e('0x23')](_0x0a9e('0x88'),_0x34a791[_0x0a9e('0x26')],util['inspect'](_0x34a791,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]]){for(var _0x17b29d in this['channels'][_0x34a791[_0x0a9e('0x81')]]){if(this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x0a9e('0x36')](_0x17b29d)){if(_0x34a791[_0x0a9e('0x89')]===_0x17b29d){logger['info'](_0x0a9e('0x8a'),_0x34a791[_0x0a9e('0x26')],this['channels'][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x21')],_0x17b29d);var _0x1f6f1c=moment();this['channels'][_0x34a791['transfereeuniqueid']][_0x17b29d]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d]['agentcompleteAt']=_0x1f6f1c;this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x3d')]='complete';this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x56')]=_0x0a9e('0x5b');this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x5d')]=_0x1f6f1c[_0x0a9e('0x84')](this[_0x0a9e('0x8')][_0x34a791['transfereeuniqueid']][_0x17b29d][_0x0a9e('0x37')],'seconds');}}}}}}catch(_0x138cf5){logger[_0x0a9e('0x50')](_0x0a9e('0x8b'),_0x34a791[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x138cf5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncMusicOnHoldStart']=function(_0x1a0314){var _0x33da81='';try{if(this[_0x0a9e('0x1e')](_0x1a0314)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x1a0314[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x1a0314,{'showHidden':![],'depth':null}));if(_0x1a0314[_0x0a9e('0x8c')]){_0x33da81=_0x1a0314[_0x0a9e('0x8c')][_0x0a9e('0x8d')](0x0,_0x1a0314[_0x0a9e('0x8c')][_0x0a9e('0x8e')]('-'));if(this[_0x0a9e('0xa')][_0x33da81]){logger[_0x0a9e('0x20')](_0x0a9e('0x8f'),_0x1a0314['uniqueid'],_0x33da81);this[_0x0a9e('0xa')][_0x33da81][_0x0a9e('0x90')]=!![];}}}}catch(_0x2ff265){logger[_0x0a9e('0x50')](_0x0a9e('0x91'),_0x1a0314[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2ff265,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncMusicOnHoldStop']=function(_0x3b581c){var _0xd2391='';try{if(this[_0x0a9e('0x1e')](_0x3b581c)){logger['debug'](_0x0a9e('0x92'),_0x3b581c[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x3b581c,{'showHidden':![],'depth':null}));if(_0x3b581c[_0x0a9e('0x8c')]){_0xd2391=_0x3b581c[_0x0a9e('0x8c')][_0x0a9e('0x8d')](0x0,_0x3b581c[_0x0a9e('0x8c')][_0x0a9e('0x8e')]('-'));if(this[_0x0a9e('0xa')][_0xd2391]){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x3b581c[_0x0a9e('0x26')],_0xd2391);this[_0x0a9e('0xa')][_0xd2391][_0x0a9e('0x90')]=![];}}}}catch(_0x3db98f){logger[_0x0a9e('0x50')](_0x0a9e('0x93'),_0x3b581c['uniqueid'],util[_0x0a9e('0x25')](_0x3db98f,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0xa9e0=['redis','defaults','localhost','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','uniqueid','YYYY-MM-DD\x20HH:mm:ss','queue','mandatoryDisposition','type','inbound','merge','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','voiceChannels','routealias','interface','pick','destconnectedlinenum','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:%s','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answered_elsewhere','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','error','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','agentringnoanswer','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','reason','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acw','acwtime','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]','lodash','moment','util','../../../config/logger','../ami'];(function(_0x29da6f,_0x371d2e){var _0x317b05=function(_0x3acf24){while(--_0x3acf24){_0x29da6f['push'](_0x29da6f['shift']());}};_0x317b05(++_0x371d2e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x0a9e('0x3'))('ami');var ami=require(_0x0a9e('0x4'));config[_0x0a9e('0x5')]=_[_0x0a9e('0x6')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x5')]));function VoiceAgentReport(_0x441e3a){this[_0x0a9e('0x8')]={};this['voiceChannels']=_0x441e3a['channels'];this[_0x0a9e('0x9')]=_0x441e3a['voiceQueues'];this['agents']=_0x441e3a[_0x0a9e('0xa')];this[_0x0a9e('0xb')]={};ami['on'](_0x0a9e('0xc'),this[_0x0a9e('0xd')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0xf'),this['syncAgentConnect']['bind'](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x10'),this[_0x0a9e('0x11')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x12'),this[_0x0a9e('0x13')]['bind'](this));ami['on'](_0x0a9e('0x14'),this[_0x0a9e('0x15')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0xe')](this));ami['on']('musiconholdstart',this[_0x0a9e('0x18')]['bind'](this));ami['on'](_0x0a9e('0x19'),this['syncMusicOnHoldStop'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x1a'),this['syncAttendedTransfer'][_0x0a9e('0xe')](this));ami['on']('blindtransfer',this[_0x0a9e('0x1b')][_0x0a9e('0xe')](this));}VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1d')]=function(_0x31b1ca,_0x2eb11f,_0x530eb7){io['to'](_0x31b1ca)[_0x0a9e('0x1d')](_0x2eb11f,_0x530eb7);};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1e')]=function(_0x1c696a){return _0x1c696a!==null&&!_[_0x0a9e('0x1f')](_0x1c696a);};VoiceAgentReport['prototype'][_0x0a9e('0xd')]=function(_0x155cce){try{if(this['isNotNull'](_0x155cce)){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x155cce['uniqueid'],_0x155cce[_0x0a9e('0x21')],_0x155cce[_0x0a9e('0x22')]);logger[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x155cce,{'showHidden':![],'depth':null}));if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]]={};}if(_[_0x0a9e('0x1f')](this['channels'][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]={'agentcalledAt':moment()['format'](_0x0a9e('0x27')),'lastevent':'called','mandatoryDisposition':this[_0x0a9e('0x9')][_0x155cce['queue']]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x29')]||![]:![],'type':this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x2a')]||'inbound':_0x0a9e('0x2b'),'variables':this[_0x0a9e('0xb')][_0x155cce[_0x0a9e('0x26')]]};}_[_0x0a9e('0x2c')](this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],_[_0x0a9e('0x2d')](_0x155cce,[_0x0a9e('0x2e'),_0x0a9e('0x2f')]));logger[_0x0a9e('0x23')](_0x0a9e('0x30'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x31'),this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]);logger['debug'](_0x0a9e('0x32'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x33')]('user:%s',_0x155cce[_0x0a9e('0x21')]),'user:called',this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]);}}catch(_0x3f3d41){logger['error'](_0x0a9e('0x34'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x3f3d41,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncAgentConnect']=function(_0x54135e){try{if(this[_0x0a9e('0x1e')](_0x54135e)){if(this['channels'][_0x54135e[_0x0a9e('0x26')]]){logger[_0x0a9e('0x23')](_0x0a9e('0x35'),_0x54135e[_0x0a9e('0x26')],util['inspect'](_0x54135e,{'showHidden':![],'depth':null}));for(var _0x31916f in this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]]){if(this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x31916f)){if(_0x54135e[_0x0a9e('0x22')]===_0x31916f){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x54135e[_0x0a9e('0x26')],_0x54135e[_0x0a9e('0x21')],_0x54135e['destuniqueid']);this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x37')]=moment()[_0x0a9e('0x33')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x38')]=_0x54135e['connectedlinename'];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x39')]=_0x54135e['connectedlinenum'];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3a')]=_0x54135e[_0x0a9e('0x3a')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3b')]=_0x54135e[_0x0a9e('0x3b')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3c')]=_0x54135e[_0x0a9e('0x3c')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3d')]='connect';if(this['voiceChannels'][this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x26')]]){var _0x315881=this[_0x0a9e('0x3e')][this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x26')]][_0x0a9e('0x3f')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3f')]=_0x315881;_0x54135e['routealias']=_0x315881;}_[_0x0a9e('0x2c')](this[_0x0a9e('0xa')][_0x54135e[_0x0a9e('0x40')]],_[_0x0a9e('0x41')](_0x54135e,[_0x0a9e('0x28'),_0x0a9e('0x42'),_0x0a9e('0x3f')]));logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:',_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami['emit'](_0x0a9e('0x43'),this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]]);logger[_0x0a9e('0x23')](_0x0a9e('0x44'),_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x33')](_0x0a9e('0x45'),_0x54135e[_0x0a9e('0x21')]),_0x0a9e('0x46'),this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x54135e[_0x0a9e('0x22')]]);}else if(!this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['agentringnoanswer']&&!this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')](_0x0a9e('0x47'),_0x54135e[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x21')],_0x31916f);this['channels'][_0x54135e['uniqueid']][_0x31916f]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x48')]=moment()['format'](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['answeredelsewheredestinationuniqueid']=_0x54135e[_0x0a9e('0x22')];this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f]['answeredelsewheremembername']=_0x54135e[_0x0a9e('0x21')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f]['lastevent']=_0x0a9e('0x49');this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['reason']=_0x0a9e('0x49');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')]('custom:agentansweredelsewhere',this['channels'][_0x54135e['uniqueid']][_0x31916f]);}}}}}}catch(_0x2da03c){logger['error'](_0x0a9e('0x4a'),_0x54135e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2da03c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x4b')]=function(_0x272738){try{if(this[_0x0a9e('0x1e')](_0x272738)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x272738[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x272738,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]]&&this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']]){logger[_0x0a9e('0x20')](_0x0a9e('0x4c'),_0x272738['uniqueid'],_0x272738[_0x0a9e('0x21')],_0x272738['destuniqueid']);this[_0x0a9e('0x8')][_0x272738['uniqueid']][_0x272738['destuniqueid']]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x272738['uniqueid']][_0x272738[_0x0a9e('0x22')]][_0x0a9e('0x48')]=moment()[_0x0a9e('0x33')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']][_0x0a9e('0x3d')]='rejected';this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738[_0x0a9e('0x22')]]['reason']=_0x0a9e('0x4d');logger[_0x0a9e('0x23')](_0x0a9e('0x4e'),_0x272738[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x4f'),this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738[_0x0a9e('0x22')]]);}}}catch(_0x4d4a35){logger[_0x0a9e('0x50')](_0x0a9e('0x51'),_0x272738[_0x0a9e('0x26')],util['inspect'](_0x4d4a35,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncQueueCallerAbandon']=function(_0x5211e3){try{if(this[_0x0a9e('0x1e')](_0x5211e3)){logger[_0x0a9e('0x23')](_0x0a9e('0x52'),_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x5211e3,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]]){for(var _0x54a37d in this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x54a37d)&&!this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x53')]&&!this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d]['agentcomplete']){logger[_0x0a9e('0x20')](_0x0a9e('0x54'),_0x5211e3[_0x0a9e('0x26')],this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x21')],_0x54a37d);this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x53')]=!![];this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x48')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x3d')]=_0x0a9e('0x55');this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x56')]=_0x0a9e('0x55');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x5211e3['uniqueid']][_0x54a37d],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')]('custom:agentqueuecallerabandon',this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d]);}}}}}catch(_0x4c46c1){logger[_0x0a9e('0x50')](_0x0a9e('0x57'),_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4c46c1,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x13')]=function(_0x2e9552){try{if(this[_0x0a9e('0x1e')](_0x2e9552)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2e9552,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]]){for(var _0x4abc8f in this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x4abc8f)){if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x37')]&&!this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')](_0x0a9e('0x58'),_0x2e9552[_0x0a9e('0x26')],this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x21')],_0x4abc8f);this[_0x0a9e('0x8')][_0x2e9552['uniqueid']][_0x4abc8f][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x59')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]['lastevent']=_0x0a9e('0x5a');this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x56')]=_0x2e9552['reason']==_0x0a9e('0x5b')?_0x0a9e('0x5c'):_0x2e9552[_0x0a9e('0x56')];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x5d')]=_0x2e9552[_0x0a9e('0x5d')];if(this['voiceQueues'][_0x2e9552[_0x0a9e('0x28')]]&&this[_0x0a9e('0x9')][_0x2e9552[_0x0a9e('0x28')]][_0x0a9e('0x5e')]){this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x5f')]=this['voiceQueues'][_0x2e9552[_0x0a9e('0x28')]]['acwTimeout'];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x60')]=!![];}this[_0x0a9e('0xa')][_0x2e9552['interface']]=_['omit'](this[_0x0a9e('0xa')][_0x2e9552[_0x0a9e('0x40')]],[_0x0a9e('0x28'),'destconnectedlinenum']);logger[_0x0a9e('0x23')](_0x0a9e('0x61'),_0x2e9552['uniqueid'],util['inspect'](this[_0x0a9e('0x8')][_0x2e9552['uniqueid']][_0x4abc8f],{'showHidden':![],'depth':null}));ami['emit']('custom:agentcomplete',this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]);logger[_0x0a9e('0x23')](_0x0a9e('0x62'),_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f],{'showHidden':![],'depth':null}));this['emit'](util[_0x0a9e('0x33')](_0x0a9e('0x45'),_0x2e9552[_0x0a9e('0x21')]),_0x0a9e('0x63'),this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]);}}}}}}catch(_0x32f761){logger[_0x0a9e('0x50')]('[%s][voiceAgentReport][agentcomplete]',_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x32f761,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x15')]=function(_0x255e49){try{if(this[_0x0a9e('0x1e')](_0x255e49)){logger[_0x0a9e('0x23')](_0x0a9e('0x64'),_0x255e49['uniqueid'],util[_0x0a9e('0x25')](_0x255e49,{'showHidden':![],'depth':null}));this[_0x0a9e('0x65')](_0x255e49['uniqueid'],_[_0x0a9e('0x66')](_0x255e49[_0x0a9e('0x67')])[0x0],_0x255e49[_0x0a9e('0x68')]);if(this['channels'][_0x255e49[_0x0a9e('0x26')]]){for(var _0x52ec10 in this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x52ec10)){logger[_0x0a9e('0x20')](_0x0a9e('0x69'),_0x255e49[_0x0a9e('0x26')],_0x52ec10,_['keys'](_0x255e49[_0x0a9e('0x67')])[0x0],_0x255e49[_0x0a9e('0x68')]);if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')])){this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')]={};}this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')]=this[_0x0a9e('0xb')][_0x255e49['uniqueid']];}}}}}catch(_0xc81b64){logger[_0x0a9e('0x50')](_0x0a9e('0x6a'),_0x255e49[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xc81b64,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x65')]=function(_0x1756c7,_0x5ce99d,_0x23b447){var _0x5e725e=[_0x0a9e('0x6b'),_0x0a9e('0x6c'),_0x0a9e('0x6d'),_0x0a9e('0x6e'),'rtpaudioqosloss',_0x0a9e('0x6f'),'rtpaudioqosrtt',_0x0a9e('0x70'),_0x0a9e('0x71'),'sipuri',_0x0a9e('0x72'),_0x0a9e('0x73'),_0x0a9e('0x74'),'memberdynamic','memberinterface',_0x0a9e('0x75'),_0x0a9e('0x21'),_0x0a9e('0x76'),_0x0a9e('0x77')];if(!_[_0x0a9e('0x78')](_0x5ce99d)&&!_[_0x0a9e('0x79')](_0x5e725e,_0x5ce99d)){if(_[_0x0a9e('0x1f')](this[_0x0a9e('0xb')][_0x1756c7])){this[_0x0a9e('0xb')][_0x1756c7]={};}this['variables'][_0x1756c7][_0x5ce99d]=_0x23b447;}};VoiceAgentReport[_0x0a9e('0x1c')]['syncHangup']=function(_0x287324){try{if(this[_0x0a9e('0x1e')](_0x287324)){logger[_0x0a9e('0x23')](_0x0a9e('0x7a'),_0x287324[_0x0a9e('0x26')],util['inspect'](_0x287324,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]){for(var _0x2791c5 in this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]){if(this['channels'][_0x287324['uniqueid']][_0x0a9e('0x36')](_0x2791c5)){if(this['channels'][_0x287324[_0x0a9e('0x26')]][_0x2791c5][_0x0a9e('0x56')]==_0x0a9e('0x5b')&&this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]][_0x2791c5][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x287324[_0x0a9e('0x26')],_0x2791c5);this['channels'][_0x287324[_0x0a9e('0x26')]][_0x2791c5]['agentcompleteAt']=moment()[_0x0a9e('0x33')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger['debug'](_0x0a9e('0x7b'),_0x287324[_0x0a9e('0x26')],util['inspect'](_[_0x0a9e('0x7c')](this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x7d'),_['values'](this['channels'][_0x287324[_0x0a9e('0x26')]]));delete this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]];}if(this[_0x0a9e('0xb')][_0x287324[_0x0a9e('0x26')]]){delete this['variables'][_0x287324[_0x0a9e('0x26')]];}}}catch(_0xadce3d){logger['error'](_0x0a9e('0x7e'),_0x287324[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xadce3d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x7f')]=function(_0x23b39e){try{if(this[_0x0a9e('0x1e')](_0x23b39e)){logger[_0x0a9e('0x23')](_0x0a9e('0x80'),_0x23b39e[_0x0a9e('0x26')],util['inspect'](_0x23b39e,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]]){for(var _0x2ada60 in this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]]){if(this['channels'][_0x23b39e['transfereeuniqueid']][_0x0a9e('0x36')](_0x2ada60)){if(_0x23b39e[_0x0a9e('0x82')]===_0x2ada60){logger[_0x0a9e('0x20')](_0x0a9e('0x83'),_0x23b39e[_0x0a9e('0x26')],this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x21')],_0x2ada60);var _0x3450ae=moment();this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x23b39e['transfereeuniqueid']][_0x2ada60][_0x0a9e('0x59')]=moment()[_0x0a9e('0x33')](_0x0a9e('0x27'));this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60]['lastevent']=_0x0a9e('0x5a');this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x56')]=_0x0a9e('0x5b');this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x5d')]=_0x3450ae[_0x0a9e('0x84')](this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x37')],_0x0a9e('0x85'));}}}}if(this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x86')]]){var _0x248368=this['channels'][_0x23b39e['secondtransfereruniqueid']];this[_0x0a9e('0x8')][_0x23b39e['secondtransfereruniqueid']]=this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]];this['channels'][_0x23b39e[_0x0a9e('0x81')]]=_0x248368;}}}catch(_0xe2b083){logger[_0x0a9e('0x50')](_0x0a9e('0x87'),_0x23b39e['uniqueid'],util[_0x0a9e('0x25')](_0xe2b083,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1b')]=function(_0x34a791){try{if(this['isNotNull'](_0x34a791)){logger[_0x0a9e('0x23')](_0x0a9e('0x88'),_0x34a791[_0x0a9e('0x26')],util['inspect'](_0x34a791,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]]){for(var _0x17b29d in this['channels'][_0x34a791[_0x0a9e('0x81')]]){if(this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x0a9e('0x36')](_0x17b29d)){if(_0x34a791[_0x0a9e('0x89')]===_0x17b29d){logger['info'](_0x0a9e('0x8a'),_0x34a791[_0x0a9e('0x26')],this['channels'][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x21')],_0x17b29d);var _0x1f6f1c=moment();this['channels'][_0x34a791['transfereeuniqueid']][_0x17b29d]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d]['agentcompleteAt']=_0x1f6f1c;this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x3d')]='complete';this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x56')]=_0x0a9e('0x5b');this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x5d')]=_0x1f6f1c[_0x0a9e('0x84')](this[_0x0a9e('0x8')][_0x34a791['transfereeuniqueid']][_0x17b29d][_0x0a9e('0x37')],'seconds');}}}}}}catch(_0x138cf5){logger[_0x0a9e('0x50')](_0x0a9e('0x8b'),_0x34a791[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x138cf5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncMusicOnHoldStart']=function(_0x1a0314){var _0x33da81='';try{if(this[_0x0a9e('0x1e')](_0x1a0314)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x1a0314[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x1a0314,{'showHidden':![],'depth':null}));if(_0x1a0314[_0x0a9e('0x8c')]){_0x33da81=_0x1a0314[_0x0a9e('0x8c')][_0x0a9e('0x8d')](0x0,_0x1a0314[_0x0a9e('0x8c')][_0x0a9e('0x8e')]('-'));if(this[_0x0a9e('0xa')][_0x33da81]){logger[_0x0a9e('0x20')](_0x0a9e('0x8f'),_0x1a0314['uniqueid'],_0x33da81);this[_0x0a9e('0xa')][_0x33da81][_0x0a9e('0x90')]=!![];}}}}catch(_0x2ff265){logger[_0x0a9e('0x50')](_0x0a9e('0x91'),_0x1a0314[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2ff265,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncMusicOnHoldStop']=function(_0x3b581c){var _0xd2391='';try{if(this[_0x0a9e('0x1e')](_0x3b581c)){logger['debug'](_0x0a9e('0x92'),_0x3b581c[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x3b581c,{'showHidden':![],'depth':null}));if(_0x3b581c[_0x0a9e('0x8c')]){_0xd2391=_0x3b581c[_0x0a9e('0x8c')][_0x0a9e('0x8d')](0x0,_0x3b581c[_0x0a9e('0x8c')][_0x0a9e('0x8e')]('-'));if(this[_0x0a9e('0xa')][_0xd2391]){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x3b581c[_0x0a9e('0x26')],_0xd2391);this[_0x0a9e('0xa')][_0xd2391][_0x0a9e('0x90')]=![];}}}}catch(_0x3db98f){logger[_0x0a9e('0x50')](_0x0a9e('0x93'),_0x3b581c['uniqueid'],util[_0x0a9e('0x25')](_0x3db98f,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index fbc81da..a2cb310 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1b42=['some','routeid','ATTENDED','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','BlindTransfer','transfererchannel','transfereruniqueid','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','lodash','moment','util','path','../../../config/environment','ami','../model/channel','../rpc/setting','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','agi','playback','NO\x20ANSWER','FAILED','BUSY','redis','defaults','localhost','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','varset','syncVarSet','hangup','syncHangup','syncNewCallerId','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','actionCoreShowChannels','[voiceCallReport][coreshowchannels]','isNotNull','prototype','emit','info','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','inspect','isUndefined','uniqueid','pick','keys','from-sip','channel','split','exten','connectedlinenum','format','accountcode','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','YYYY-MM-DD\x20HH:mm:ss','disposition','merge','context','destconnectedlinenum','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','user:%s','user:agentconnect','error','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','linkedid','OutgoingSpoolFailed','application','toLowerCase','applicationdata','startsWith','CDR(routeAlias)','appdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','starttime','duration','subtract','seconds','includes','lastapplication','set','match','queue','[%s][voiceCallReport][newexten]','syncNewState','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','channelstate','answered','holdtime','diff','xcally-motion-preview','connectedlinename','destinationchannel','toNumber','UserId','membername','name','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','monitor','endsWith','.wav49','monitorFilename','find','monitors','isNil','push','rec','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','sipcallid','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20reason:%s','billableseconds','answertime','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','then','transferType','undefined','isEmpty','stopRecordingOnTransfer','resolve','Action','StopMixMonitor','finally','webbar:stopmonitors','event','blindTransfers','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','origtransferercalleridnum','transfertargetcalleridnum','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid'];(function(_0x3382df,_0x547339){var _0x4277af=function(_0x305e78){while(--_0x305e78){_0x3382df['push'](_0x3382df['shift']());}};_0x4277af(++_0x547339);}(_0x1b42,0xe2));var _0x21b4=function(_0x516b8b,_0x52d1bc){_0x516b8b=_0x516b8b-0x0;var _0x162b73=_0x1b42[_0x516b8b];return _0x162b73;};'use strict';var BPromise=require('bluebird');var _=require(_0x21b4('0x0'));var moment=require(_0x21b4('0x1'));var util=require(_0x21b4('0x2'));var path=require(_0x21b4('0x3'));var Redis=require('ioredis');var config=require(_0x21b4('0x4'));var logger=require('../../../config/logger')(_0x21b4('0x5'));var ami=require('../ami');var Channel=require(_0x21b4('0x6'));var RpcSetting=require(_0x21b4('0x7'));var statusDesc=['unknown','not_inuse',_0x21b4('0x8'),_0x21b4('0x9'),_0x21b4('0xa'),_0x21b4('0xb'),_0x21b4('0xc'),_0x21b4('0xd'),_0x21b4('0xe')];var applications=['set','queue',_0x21b4('0xf'),'dial',_0x21b4('0x10'),'voicemail'];var dispositions=[_0x21b4('0x11'),_0x21b4('0x12'),_0x21b4('0x12'),_0x21b4('0x11'),'NO\x20ANSWER',_0x21b4('0x11'),'ANSWERED',_0x21b4('0x13'),'FAILED',_0x21b4('0x12'),'FAILED'];var actions={};config[_0x21b4('0x14')]=_[_0x21b4('0x15')](config[_0x21b4('0x14')],{'host':_0x21b4('0x16'),'port':0x18eb});var io=require(_0x21b4('0x17'))(new Redis(config['redis']));function VoiceCallReport(_0x1e5dba){this[_0x21b4('0x18')]=_0x1e5dba['channels'];this[_0x21b4('0x19')]=_0x1e5dba['agents'];this['blindTransfers']={};ami['on'](_0x21b4('0x1a'),this[_0x21b4('0x1b')][_0x21b4('0x1c')](this));ami['on'](_0x21b4('0x1d'),this[_0x21b4('0x1b')][_0x21b4('0x1c')](this));ami['on'](_0x21b4('0x1e'),this[_0x21b4('0x1f')][_0x21b4('0x1c')](this));ami['on'](_0x21b4('0x20'),this['syncNewState'][_0x21b4('0x1c')](this));ami['on'](_0x21b4('0x21'),this[_0x21b4('0x22')][_0x21b4('0x1c')](this));ami['on'](_0x21b4('0x23'),this[_0x21b4('0x24')][_0x21b4('0x1c')](this));ami['on']('newcallerid',this[_0x21b4('0x25')][_0x21b4('0x1c')](this));ami['on']('attendedtransfer',this[_0x21b4('0x26')]['bind'](this));ami['on'](_0x21b4('0x27'),this[_0x21b4('0x28')][_0x21b4('0x1c')](this));ami['on'](_0x21b4('0x29'),this[_0x21b4('0x2a')][_0x21b4('0x1c')](this));ami['on'](_0x21b4('0x2b'),this[_0x21b4('0x2c')][_0x21b4('0x1c')](this));try{logger['info']('[voiceCallReport][coreshowchannels]\x20started');ami[_0x21b4('0x2d')]();}catch(_0x28523d){logger['error'](_0x21b4('0x2e'),util['inspect'](_0x28523d,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype'][_0x21b4('0x2f')]=function(_0x7674aa){return _0x7674aa!==null&&!_['isUndefined'](_0x7674aa);};VoiceCallReport[_0x21b4('0x30')][_0x21b4('0x31')]=function(_0x2a4296,_0x372e17,_0x4549db){io['to'](_0x2a4296)[_0x21b4('0x31')](_0x372e17,_0x4549db);};VoiceCallReport[_0x21b4('0x30')][_0x21b4('0x25')]=function(_0x595fa0){try{if(this[_0x21b4('0x2f')](_0x595fa0)){logger[_0x21b4('0x32')](_0x21b4('0x33'),_0x595fa0['uniqueid'],_0x595fa0[_0x21b4('0x34')],_0x595fa0[_0x21b4('0x35')]);logger[_0x21b4('0x36')](_0x21b4('0x37'),_0x595fa0['uniqueid'],util[_0x21b4('0x38')](_0x595fa0,{'showHidden':![],'depth':null}));if(_0x595fa0['uniqueid']===_0x595fa0['linkedid']){if(!_[_0x21b4('0x39')](this[_0x21b4('0x18')][_0x595fa0[_0x21b4('0x3a')]])){_['merge'](this[_0x21b4('0x18')][_0x595fa0[_0x21b4('0x3a')]],_[_0x21b4('0x3b')](_0x595fa0,_[_0x21b4('0x3c')](this[_0x21b4('0x18')][_0x595fa0[_0x21b4('0x3a')]])));}}if(_0x595fa0['context']===_0x21b4('0x3d')){if(this[_0x21b4('0x19')][_0x595fa0[_0x21b4('0x3e')][_0x21b4('0x3f')]('-')[0x0]]){if(_0x595fa0[_0x21b4('0x40')]=='xcally-motion-preview'){this['agents'][_0x595fa0['channel']['split']('-')[0x0]]['destconnectedlinenum']=_0x595fa0[_0x21b4('0x41')];this['emit'](util[_0x21b4('0x42')]('user:%s',this[_0x21b4('0x19')][_0x595fa0[_0x21b4('0x3e')][_0x21b4('0x3f')]('-')[0x0]]['name']),'user:agentconnect',{'destaccountcode':this['agents'][_0x595fa0['channel'][_0x21b4('0x3f')]('-')[0x0]][_0x21b4('0x43')],'destconnectedlinenum':_0x595fa0['connectedlinenum']});}}}}}catch(_0x4e5c19){logger['error'](_0x21b4('0x44'),_0x595fa0[_0x21b4('0x3a')],util[_0x21b4('0x38')](_0x4e5c19,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x21b4('0x1f')]=function(_0xadcd56){try{if(this['isNotNull'](_0xadcd56)){logger['debug']('[%s][voiceCallReport][newchannel]\x20event:',_0xadcd56['uniqueid'],util[_0x21b4('0x38')](_0xadcd56,{'showHidden':![],'depth':null}));if(_0xadcd56['uniqueid']===_0xadcd56['linkedid']&&_0xadcd56[_0x21b4('0x3e')]!='OutgoingSpoolFailed'){if(_[_0x21b4('0x39')](this[_0x21b4('0x18')][_0xadcd56[_0x21b4('0x3a')]])){logger[_0x21b4('0x32')](_0x21b4('0x45'),_0xadcd56[_0x21b4('0x3a')],_0xadcd56['context'],_0xadcd56['exten']);this[_0x21b4('0x18')][_0xadcd56[_0x21b4('0x3a')]]=new Channel();this[_0x21b4('0x18')][_0xadcd56[_0x21b4('0x3a')]]['starttime']=moment()[_0x21b4('0x42')](_0x21b4('0x46'));this[_0x21b4('0x18')][_0xadcd56[_0x21b4('0x3a')]][_0x21b4('0x47')]=dispositions[_['toNumber'](_0xadcd56['channelstate'])];_[_0x21b4('0x48')](this['channels'][_0xadcd56[_0x21b4('0x3a')]],_[_0x21b4('0x3b')](_0xadcd56,_[_0x21b4('0x3c')](this[_0x21b4('0x18')][_0xadcd56[_0x21b4('0x3a')]])));if(_0xadcd56[_0x21b4('0x49')]===_0x21b4('0x3d')){if(this[_0x21b4('0x19')][_0xadcd56[_0x21b4('0x3e')][_0x21b4('0x3f')]('-')[0x0]]){if(_[_0x21b4('0x39')](this[_0x21b4('0x19')][_0xadcd56[_0x21b4('0x3e')][_0x21b4('0x3f')]('-')[0x0]]['destconnectedlinenum'])){this[_0x21b4('0x19')][_0xadcd56[_0x21b4('0x3e')][_0x21b4('0x3f')]('-')[0x0]][_0x21b4('0x4a')]=_0xadcd56[_0x21b4('0x40')];logger['debug'](_0x21b4('0x4b'),_0xadcd56[_0x21b4('0x3a')],util['inspect']({'destaccountcode':this[_0x21b4('0x19')][_0xadcd56[_0x21b4('0x3e')]['split']('-')[0x0]][_0x21b4('0x43')],'destconnectedlinenum':_0xadcd56[_0x21b4('0x40')]},{'showHidden':![],'depth':null}));this[_0x21b4('0x31')](util[_0x21b4('0x42')](_0x21b4('0x4c'),this[_0x21b4('0x19')][_0xadcd56[_0x21b4('0x3e')][_0x21b4('0x3f')]('-')[0x0]]['name']),_0x21b4('0x4d'),{'destaccountcode':this[_0x21b4('0x19')][_0xadcd56[_0x21b4('0x3e')][_0x21b4('0x3f')]('-')[0x0]][_0x21b4('0x43')],'destconnectedlinenum':_0xadcd56['exten']});}}}}}}}catch(_0x5aa1ab){logger[_0x21b4('0x4e')](_0x21b4('0x4f'),_0xadcd56['uniqueid'],util[_0x21b4('0x38')](_0x5aa1ab,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x21b4('0x1b')]=function(_0x22a2a1){try{if(this[_0x21b4('0x2f')](_0x22a2a1)){logger[_0x21b4('0x36')](_0x21b4('0x50'),_0x22a2a1[_0x21b4('0x3a')],util['inspect'](_0x22a2a1,{'showHidden':![],'depth':null}));if(_0x22a2a1[_0x21b4('0x3a')]===_0x22a2a1[_0x21b4('0x51')]&&_0x22a2a1[_0x21b4('0x40')]!='h'&&_0x22a2a1[_0x21b4('0x3e')]!=_0x21b4('0x52')){_0x22a2a1[_0x21b4('0x53')]=_0x22a2a1[_0x21b4('0x53')][_0x21b4('0x54')]();_0x22a2a1[_0x21b4('0x55')]=_0x22a2a1['appdata']&&_0x22a2a1['appdata'][_0x21b4('0x56')](_0x21b4('0x57'))?_0x22a2a1[_0x21b4('0x58')]:(_0x22a2a1[_0x21b4('0x58')]||_0x22a2a1[_0x21b4('0x55')])[_0x21b4('0x54')]();logger['info'](_0x21b4('0x59'),_0x22a2a1['uniqueid'],_0x22a2a1[_0x21b4('0x53')],_0x22a2a1[_0x21b4('0x55')]);if(_['isUndefined'](this[_0x21b4('0x18')][_0x22a2a1[_0x21b4('0x3a')]])){this[_0x21b4('0x18')][_0x22a2a1['uniqueid']]=new Channel();this[_0x21b4('0x18')][_0x22a2a1[_0x21b4('0x3a')]][_0x21b4('0x5a')]=_0x22a2a1[_0x21b4('0x5b')]?moment()[_0x21b4('0x5c')](moment[_0x21b4('0x5b')](_0x22a2a1['duration'])[_0x21b4('0x5d')](),_0x21b4('0x5d'))[_0x21b4('0x42')]('YYYY-MM-DD\x20HH:mm:ss'):moment()['format'](_0x21b4('0x46'));this[_0x21b4('0x18')][_0x22a2a1[_0x21b4('0x3a')]][_0x21b4('0x47')]=_0x21b4('0x11');}_['merge'](this[_0x21b4('0x18')][_0x22a2a1[_0x21b4('0x3a')]],_[_0x21b4('0x3b')](_0x22a2a1,_[_0x21b4('0x3c')](this[_0x21b4('0x18')][_0x22a2a1[_0x21b4('0x3a')]])));if(_[_0x21b4('0x5e')](applications,_0x22a2a1['application'])){this[_0x21b4('0x18')][_0x22a2a1['uniqueid']][_0x21b4('0x5f')]=_0x22a2a1[_0x21b4('0x53')];this[_0x21b4('0x18')][_0x22a2a1['uniqueid']]['lastdata']=_0x22a2a1[_0x21b4('0x55')];if(_0x22a2a1[_0x21b4('0x53')]===_0x21b4('0x60')&&_[_0x21b4('0x56')](_0x22a2a1[_0x21b4('0x55')][_0x21b4('0x54')](),'cdr(')){var _0xa6fbfd=_0x22a2a1[_0x21b4('0x55')]['split']('=');var _0x57e55a=_0xa6fbfd[0x0][_0x21b4('0x54')]()[_0x21b4('0x61')](/cdr\((.*)\)/);if(_0x57e55a){this[_0x21b4('0x18')][_0x22a2a1[_0x21b4('0x3a')]][_0x57e55a[0x1]]=_0xa6fbfd[0x1];}}else if(_0x22a2a1[_0x21b4('0x53')]==='queue'){this[_0x21b4('0x18')][_0x22a2a1[_0x21b4('0x3a')]][_0x21b4('0x62')]=_0x22a2a1[_0x21b4('0x55')][_0x21b4('0x3f')](',')[0x0];}}}}}catch(_0x23d1cc){logger['error'](_0x21b4('0x63'),_0x22a2a1[_0x21b4('0x3a')],util[_0x21b4('0x38')](_0x23d1cc,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x21b4('0x64')]=function(_0x4cb066){try{if(this['isNotNull'](_0x4cb066)){logger[_0x21b4('0x32')](_0x21b4('0x65'),_0x4cb066['uniqueid'],_0x4cb066[_0x21b4('0x51')],_0x4cb066[_0x21b4('0x34')],_0x4cb066['calleridnum']);logger[_0x21b4('0x36')]('[%s][voiceCallReport][newstate]\x20event:',_0x4cb066[_0x21b4('0x3a')],util['inspect'](_0x4cb066,{'showHidden':![],'depth':null}));if(_0x4cb066['uniqueid']!==_0x4cb066[_0x21b4('0x51')]){if(this[_0x21b4('0x18')][_0x4cb066[_0x21b4('0x51')]]){if(_0x4cb066[_0x21b4('0x66')]==='6'){if(!this['channels'][_0x4cb066[_0x21b4('0x51')]][_0x21b4('0x67')]){var _0x39a278=moment();this[_0x21b4('0x18')][_0x4cb066['linkedid']]['answered']=!![];this[_0x21b4('0x18')][_0x4cb066[_0x21b4('0x51')]]['answertime']=_0x39a278[_0x21b4('0x42')](_0x21b4('0x46'));if(this[_0x21b4('0x18')][_0x4cb066['linkedid']]['starttime']){this[_0x21b4('0x18')][_0x4cb066[_0x21b4('0x51')]][_0x21b4('0x68')]=_0x39a278[_0x21b4('0x69')](this[_0x21b4('0x18')][_0x4cb066[_0x21b4('0x51')]]['starttime'],'seconds');}}this[_0x21b4('0x18')][_0x4cb066[_0x21b4('0x51')]][_0x21b4('0x51')]=_0x4cb066[_0x21b4('0x3a')];if(_0x4cb066[_0x21b4('0x35')]!==_0x21b4('0x6a')){this[_0x21b4('0x18')][_0x4cb066[_0x21b4('0x51')]][_0x21b4('0x41')]=_0x4cb066['calleridnum'];}this[_0x21b4('0x18')][_0x4cb066[_0x21b4('0x51')]][_0x21b4('0x6b')]=_0x4cb066[_0x21b4('0x34')];this['channels'][_0x4cb066['linkedid']][_0x21b4('0x6c')]=_0x4cb066[_0x21b4('0x3e')];this[_0x21b4('0x18')][_0x4cb066[_0x21b4('0x51')]]['disposition']=dispositions[_[_0x21b4('0x6d')](_0x4cb066['channelstate'])];if(this['agents'][_0x4cb066[_0x21b4('0x3e')]['split']('-')[0x0]]){this[_0x21b4('0x18')][_0x4cb066[_0x21b4('0x51')]][_0x21b4('0x6e')]=this[_0x21b4('0x19')][_0x4cb066[_0x21b4('0x3e')][_0x21b4('0x3f')]('-')[0x0]]['id'];this['channels'][_0x4cb066[_0x21b4('0x51')]]['membername']=this[_0x21b4('0x19')][_0x4cb066[_0x21b4('0x3e')][_0x21b4('0x3f')]('-')[0x0]]['name'];}}}}else{if(this[_0x21b4('0x18')][_0x4cb066[_0x21b4('0x3a')]]){if(_0x4cb066[_0x21b4('0x66')]==='6'){if(this['agents'][_0x4cb066[_0x21b4('0x3e')][_0x21b4('0x3f')]('-')[0x0]]){this[_0x21b4('0x18')][_0x4cb066[_0x21b4('0x3a')]][_0x21b4('0x6e')]=this[_0x21b4('0x19')][_0x4cb066[_0x21b4('0x3e')][_0x21b4('0x3f')]('-')[0x0]]['id'];this[_0x21b4('0x18')][_0x4cb066[_0x21b4('0x3a')]][_0x21b4('0x6f')]=this['agents'][_0x4cb066['channel'][_0x21b4('0x3f')]('-')[0x0]]['name'];}}}}if(_0x4cb066[_0x21b4('0x66')]==='6'&&_0x4cb066[_0x21b4('0x49')]==='from-sip'){if(this['agents'][_0x4cb066[_0x21b4('0x3e')][_0x21b4('0x3f')]('-')[0x0]]){this[_0x21b4('0x19')][_0x4cb066[_0x21b4('0x3e')][_0x21b4('0x3f')]('-')[0x0]][_0x21b4('0x4a')]=_0x4cb066['exten'];var _0xf179;if(this[_0x21b4('0x18')][_0x4cb066[_0x21b4('0x3a')]])_0xf179=this[_0x21b4('0x18')][_0x4cb066[_0x21b4('0x3a')]]['routealias'];else if(this['channels'][_0x4cb066[_0x21b4('0x51')]])_0xf179=this['channels'][_0x4cb066[_0x21b4('0x51')]]['routealias'];logger[_0x21b4('0x36')]('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x4cb066[_0x21b4('0x3a')],util[_0x21b4('0x38')]({'destaccountcode':this[_0x21b4('0x19')][_0x4cb066[_0x21b4('0x3e')][_0x21b4('0x3f')]('-')[0x0]][_0x21b4('0x43')],'destconnectedlinenum':_0x4cb066[_0x21b4('0x40')],'routealias':_0xf179},{'showHidden':![],'depth':null}));this[_0x21b4('0x31')](util['format']('user:%s',this[_0x21b4('0x19')][_0x4cb066[_0x21b4('0x3e')][_0x21b4('0x3f')]('-')[0x0]][_0x21b4('0x70')]),'user:agentconnect',{'destaccountcode':this[_0x21b4('0x19')][_0x4cb066['channel'][_0x21b4('0x3f')]('-')[0x0]][_0x21b4('0x43')],'destconnectedlinenum':_0x4cb066[_0x21b4('0x40')],'routealias':_0xf179});}}}}catch(_0x478988){logger[_0x21b4('0x4e')](_0x21b4('0x71'),_0x4cb066['uniqueid'],util[_0x21b4('0x38')](_0x478988,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x21b4('0x30')][_0x21b4('0x72')]=function(_0x59d83e,_0x1ae943){try{if(this[_0x21b4('0x18')][_0x59d83e]){logger[_0x21b4('0x32')]('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x59d83e,_0x1ae943);this[_0x21b4('0x18')][_0x59d83e][_0x21b4('0x73')]=!![];if(_[_0x21b4('0x74')](_0x1ae943,_0x21b4('0x75'))){_0x1ae943=_0x1ae943['replace'](_0x21b4('0x75'),'.WAV');}this[_0x21b4('0x18')][_0x59d83e][_0x21b4('0x76')]=_0x1ae943;var _0x605ed5=_[_0x21b4('0x77')](this['channels'][_0x59d83e][_0x21b4('0x78')],{'filename':_0x1ae943});if(_[_0x21b4('0x79')](_0x605ed5)){this['channels'][_0x59d83e][_0x21b4('0x78')][_0x21b4('0x7a')]({'filename':_0x1ae943,'createdAt':moment()[_0x21b4('0x42')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0x21b4('0x7b')});}}}catch(_0x3a64df){logger[_0x21b4('0x4e')]('[%s][voiceCallReport][mixMonitorFilename]',_0x59d83e,util[_0x21b4('0x38')](_0x3a64df,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x21b4('0x30')][_0x21b4('0x22')]=function(_0x44a9f0){try{if(this['isNotNull'](_0x44a9f0)){logger[_0x21b4('0x36')](_0x21b4('0x7c'),_0x44a9f0[_0x21b4('0x3a')],util['inspect'](_0x44a9f0,{'showHidden':![],'depth':null}));if(this[_0x21b4('0x18')][_0x44a9f0[_0x21b4('0x3a')]]&&_0x44a9f0[_0x21b4('0x3e')]!='OutgoingSpoolFailed'){if(this[_0x21b4('0x2f')](_0x44a9f0[_0x21b4('0x7d')])){if(this['isNotNull'](_0x44a9f0[_0x21b4('0x7d')][_0x21b4('0x7e')])){logger[_0x21b4('0x32')](_0x21b4('0x7f'),_0x44a9f0[_0x21b4('0x3a')],_0x44a9f0['value']);this[_0x21b4('0x72')](_0x44a9f0[_0x21b4('0x3a')],_0x44a9f0[_0x21b4('0x80')]);}else if(this[_0x21b4('0x2f')](_0x44a9f0['variable'][_0x21b4('0x81')])){logger[_0x21b4('0x32')](_0x21b4('0x82'),_0x44a9f0['uniqueid'],_0x44a9f0[_0x21b4('0x80')]);this['channels'][_0x44a9f0['uniqueid']][_0x21b4('0x35')]=_0x44a9f0[_0x21b4('0x80')];}else if(this[_0x21b4('0x2f')](_0x44a9f0[_0x21b4('0x7d')]['xmd-callerid'])){logger[_0x21b4('0x32')](_0x21b4('0x83'),_0x44a9f0[_0x21b4('0x3a')],_0x44a9f0['value']);this[_0x21b4('0x18')][_0x44a9f0[_0x21b4('0x3a')]][_0x21b4('0x84')]=_0x44a9f0[_0x21b4('0x80')];}else if(this[_0x21b4('0x2f')](_0x44a9f0[_0x21b4('0x7d')][_0x21b4('0x85')])){logger[_0x21b4('0x32')](_0x21b4('0x86'),_0x44a9f0[_0x21b4('0x3a')],_0x44a9f0['value']);this[_0x21b4('0x18')][_0x44a9f0[_0x21b4('0x3a')]][_0x21b4('0x87')]=_0x44a9f0[_0x21b4('0x80')];}else if(this[_0x21b4('0x2f')](_0x44a9f0[_0x21b4('0x7d')][_0x21b4('0x88')])){logger[_0x21b4('0x32')](_0x21b4('0x89'),_0x44a9f0[_0x21b4('0x3a')],_0x44a9f0[_0x21b4('0x80')]['split'](',')[0x0]);this['channels'][_0x44a9f0['uniqueid']][_0x21b4('0x62')]=_0x44a9f0[_0x21b4('0x80')][_0x21b4('0x3f')](',')[0x0];}else if(this[_0x21b4('0x2f')](_0x44a9f0[_0x21b4('0x7d')]['xmd-originatecalleridnum'])){logger[_0x21b4('0x32')](_0x21b4('0x8a'),_0x44a9f0[_0x21b4('0x3a')],_0x44a9f0[_0x21b4('0x80')]);this[_0x21b4('0x18')][_0x44a9f0[_0x21b4('0x3a')]][_0x21b4('0x8b')]=_0x44a9f0['value'];}else if(this[_0x21b4('0x2f')](_0x44a9f0[_0x21b4('0x7d')][_0x21b4('0x8c')])){logger['info'](_0x21b4('0x8d'),_0x44a9f0[_0x21b4('0x3a')],_0x44a9f0[_0x21b4('0x80')]);this[_0x21b4('0x18')][_0x44a9f0[_0x21b4('0x3a')]][_0x21b4('0x8e')]=_0x44a9f0[_0x21b4('0x80')];}else if(this[_0x21b4('0x2f')](_0x44a9f0[_0x21b4('0x7d')][_0x21b4('0x8f')])){logger[_0x21b4('0x32')](_0x21b4('0x90'),_0x44a9f0[_0x21b4('0x3a')],_0x44a9f0[_0x21b4('0x80')]);this['channels'][_0x44a9f0[_0x21b4('0x3a')]]['calleridpreview']=_0x44a9f0[_0x21b4('0x80')];}else if(this['isNotNull'](_0x44a9f0[_0x21b4('0x7d')][_0x21b4('0x91')])){logger[_0x21b4('0x32')]('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x44a9f0[_0x21b4('0x3a')],_0x44a9f0[_0x21b4('0x80')]);this[_0x21b4('0x18')][_0x44a9f0[_0x21b4('0x3a')]][_0x21b4('0x62')]=_0x44a9f0['value'];}else if(this[_0x21b4('0x2f')](_0x44a9f0[_0x21b4('0x7d')]['sipcallid'])){logger[_0x21b4('0x32')](_0x21b4('0x92'),_0x44a9f0['uniqueid'],_0x44a9f0[_0x21b4('0x80')]);this[_0x21b4('0x18')][_0x44a9f0['uniqueid']][_0x21b4('0x93')]=_0x44a9f0[_0x21b4('0x80')];}}}else if(this[_0x21b4('0x2f')](_0x44a9f0[_0x21b4('0x7d')][_0x21b4('0x7e')])){if(_0x44a9f0[_0x21b4('0x80')]){var _0x4a75a6=path[_0x21b4('0x94')](_0x44a9f0[_0x21b4('0x80')])[_0x21b4('0x70')];logger[_0x21b4('0x32')](_0x21b4('0x7f'),_0x4a75a6,_0x44a9f0['value']);this[_0x21b4('0x72')](_0x4a75a6,_0x44a9f0[_0x21b4('0x80')]);}}else if(this[_0x21b4('0x18')][_0x44a9f0['linkedid']]){if(this[_0x21b4('0x2f')](_0x44a9f0[_0x21b4('0x7d')])){if(this[_0x21b4('0x2f')](_0x44a9f0['variable'][_0x21b4('0x95')])){logger[_0x21b4('0x32')](_0x21b4('0x92'),_0x44a9f0[_0x21b4('0x51')],_0x44a9f0['value']);this[_0x21b4('0x18')][_0x44a9f0[_0x21b4('0x51')]][_0x21b4('0x96')]=_0x44a9f0[_0x21b4('0x80')];}}}}}catch(_0x1e18ba){logger[_0x21b4('0x4e')](_0x21b4('0x97'),_0x44a9f0[_0x21b4('0x3a')],util[_0x21b4('0x38')](_0x1e18ba,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x21b4('0x30')]['syncHangup']=function(_0x185155){try{if(this[_0x21b4('0x2f')](_0x185155)){logger['debug']('[%s][voiceCallReport][hangup]\x20event:',_0x185155[_0x21b4('0x3a')],util[_0x21b4('0x38')](_0x185155,{'showHidden':![],'depth':null}));if(this[_0x21b4('0x18')][_0x185155[_0x21b4('0x3a')]]){logger[_0x21b4('0x32')](_0x21b4('0x98'),_0x185155['uniqueid'],_0x185155['cause-txt']);var _0x54838c=moment();this[_0x21b4('0x18')][_0x185155[_0x21b4('0x3a')]]['endtime']=_0x54838c['format'](_0x21b4('0x46'));this['channels'][_0x185155[_0x21b4('0x3a')]][_0x21b4('0x5b')]=_0x54838c[_0x21b4('0x69')](this[_0x21b4('0x18')][_0x185155['uniqueid']][_0x21b4('0x5a')],'seconds');if(this['channels'][_0x185155['uniqueid']]['answered']){this[_0x21b4('0x18')][_0x185155[_0x21b4('0x3a')]][_0x21b4('0x99')]=_0x54838c[_0x21b4('0x69')](this['channels'][_0x185155[_0x21b4('0x3a')]][_0x21b4('0x9a')],_0x21b4('0x5d'));this['channels'][_0x185155[_0x21b4('0x3a')]][_0x21b4('0x68')]=this[_0x21b4('0x18')][_0x185155[_0x21b4('0x3a')]][_0x21b4('0x5b')]-this[_0x21b4('0x18')][_0x185155[_0x21b4('0x3a')]][_0x21b4('0x99')];}if(_0x185155[_0x21b4('0x49')]===_0x21b4('0x3d')){if(this[_0x21b4('0x19')][_0x185155[_0x21b4('0x3e')][_0x21b4('0x3f')]('-')[0x0]]){this['agents'][_0x185155[_0x21b4('0x3e')][_0x21b4('0x3f')]('-')[0x0]]=_['omit'](this[_0x21b4('0x19')][_0x185155[_0x21b4('0x3e')][_0x21b4('0x3f')]('-')[0x0]],[_0x21b4('0x4a')]);logger[_0x21b4('0x36')](_0x21b4('0x9b'),_0x185155[_0x21b4('0x3a')],util[_0x21b4('0x38')]({'id':this['agents'][_0x185155[_0x21b4('0x3e')][_0x21b4('0x3f')]('-')[0x0]]['id'],'destaccountcode':this[_0x21b4('0x19')][_0x185155['channel'][_0x21b4('0x3f')]('-')[0x0]][_0x21b4('0x43')]},{'showHidden':![],'depth':null}));this[_0x21b4('0x31')](util[_0x21b4('0x42')]('user:%s',this['agents'][_0x185155[_0x21b4('0x3e')]['split']('-')[0x0]][_0x21b4('0x70')]),_0x21b4('0x9c'),{'id':this[_0x21b4('0x19')][_0x185155[_0x21b4('0x3e')][_0x21b4('0x3f')]('-')[0x0]]['id'],'destaccountcode':this[_0x21b4('0x19')][_0x185155[_0x21b4('0x3e')][_0x21b4('0x3f')]('-')[0x0]][_0x21b4('0x43')]});}}var _0x39014c=this;Promise['resolve']()[_0x21b4('0x9d')](function(){var _0x175a08=_0x39014c['channels'][_0x185155[_0x21b4('0x3a')]];if(typeof _0x175a08[_0x21b4('0x9e')]===_0x21b4('0x9f'))return;if(_[_0x21b4('0xa0')](_0x175a08[_0x21b4('0x78')]))return;return RpcSetting['getSettings']()[_0x21b4('0x9d')](function(_0x50b45f){if(!_0x50b45f[_0x21b4('0xa1')])return;return Promise[_0x21b4('0xa2')]()[_0x21b4('0x9d')](function(){return ami[_0x21b4('0xa3')]({'action':'StopMixMonitor','channel':_0x175a08[_0x21b4('0x3e')]})['catch'](function(){});})[_0x21b4('0x9d')](function(){return ami[_0x21b4('0xa3')]({'action':_0x21b4('0xa4'),'channel':_0x175a08[_0x21b4('0x6c')]})['catch'](function(){})[_0x21b4('0xa5')](function(){var _0xb8eee8=_0x39014c[_0x21b4('0x19')][_0x175a08[_0x21b4('0x6c')][_0x21b4('0x3f')]('-')[0x0]];if(!_0xb8eee8)return;io[_0x21b4('0x31')](_0x21b4('0xa6'),{'agentId':_0xb8eee8['id'],'uniqueid':_0x175a08[_0x21b4('0x3a')]});});});});})[_0x21b4('0x9d')](function(){if(_0x185155[_0x21b4('0xa7')]==='BlindTransfer'){_0x39014c[_0x21b4('0xa8')][_0x185155[_0x21b4('0x3a')]]=_0x39014c[_0x21b4('0x18')][_0x185155[_0x21b4('0x3a')]];}else{if(_0x39014c[_0x21b4('0x18')][_0x185155['uniqueid']]['type']===_0x21b4('0xa9')&&_0x39014c[_0x21b4('0xa8')][_0x185155[_0x21b4('0x3a')]]){_0x39014c[_0x21b4('0x18')][_0x185155['uniqueid']][_0x21b4('0x3a')]=[_0x39014c['channels'][_0x185155[_0x21b4('0x3a')]][_0x21b4('0x51')],_0x39014c['channels'][_0x185155[_0x21b4('0x3a')]]['linkedid']=_0x39014c[_0x21b4('0x18')][_0x185155['uniqueid']][_0x21b4('0x3a')]][0x0];delete _0x39014c[_0x21b4('0xa8')][_0x185155[_0x21b4('0x3a')]];}}logger['debug'](_0x21b4('0xaa'),_0x185155['uniqueid'],util['inspect'](_0x39014c[_0x21b4('0x18')][_0x185155['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x21b4('0x31')](_0x21b4('0xab'),_0x39014c[_0x21b4('0x18')][_0x185155[_0x21b4('0x3a')]]);delete _0x39014c[_0x21b4('0x18')][_0x185155[_0x21b4('0x3a')]];});}}}catch(_0xf7ec1a){logger[_0x21b4('0x4e')](_0x21b4('0xac'),_0x185155[_0x21b4('0x3a')],util[_0x21b4('0x38')](_0xf7ec1a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x21b4('0x30')][_0x21b4('0x26')]=function(_0x19180b){try{if(this[_0x21b4('0x2f')](_0x19180b)){logger[_0x21b4('0x32')]('[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x19180b[_0x21b4('0x3a')],_0x19180b[_0x21b4('0xad')],_0x19180b[_0x21b4('0xae')]);logger[_0x21b4('0x36')]('[%s][voiceCallReport][attendedtransfer]\x20event:',_0x19180b[_0x21b4('0x3a')],util[_0x21b4('0x38')](_0x19180b,{'showHidden':![],'depth':null}));if(this[_0x21b4('0x18')][_0x19180b[_0x21b4('0xaf')]]){this[_0x21b4('0x18')][_0x19180b[_0x21b4('0xaf')]][_0x21b4('0xb0')]=_0x19180b[_0x21b4('0xad')];this[_0x21b4('0x18')][_0x19180b[_0x21b4('0xaf')]][_0x21b4('0xb1')]=_0x19180b['transfertargetcalleridnum'];if(this[_0x21b4('0x18')][_0x19180b[_0x21b4('0xb2')]]){var _0x5bdcb9=this[_0x21b4('0x18')][_0x19180b[_0x21b4('0xb2')]];this[_0x21b4('0x18')][_0x19180b[_0x21b4('0xb2')]]=this['channels'][_0x19180b[_0x21b4('0xaf')]];this[_0x21b4('0x18')][_0x19180b['transfereeuniqueid']]=_0x5bdcb9;}}else if(this[_0x21b4('0x18')][_0x19180b[_0x21b4('0xb3')]]){this[_0x21b4('0x18')][_0x19180b[_0x21b4('0xb3')]][_0x21b4('0xb0')]=_0x19180b['origtransferercalleridnum'];this[_0x21b4('0x18')][_0x19180b[_0x21b4('0xb3')]][_0x21b4('0xb1')]=_0x19180b[_0x21b4('0xae')];if(this['channels'][_0x19180b[_0x21b4('0xb4')]]){var _0x5bdcb9=this[_0x21b4('0x18')][_0x19180b[_0x21b4('0xb4')]];this[_0x21b4('0x18')][_0x19180b['origtransfereruniqueid']]=this[_0x21b4('0x18')][_0x19180b[_0x21b4('0xb3')]];this['channels'][_0x19180b['transfertargetuniqueid']]=_0x5bdcb9;}}if((this[_0x21b4('0x18')][_0x19180b['origtransfereruniqueid']]||this[_0x21b4('0x18')][_0x19180b[_0x21b4('0xb5')]])&&this[_0x21b4('0x18')][_0x19180b[_0x21b4('0xb2')]]){var _0x37b228=_[_0x21b4('0xb6')]([this[_0x21b4('0x18')][_0x19180b[_0x21b4('0xb4')]],this[_0x21b4('0x18')][_0x19180b[_0x21b4('0xb5')]],this[_0x21b4('0x18')][_0x19180b[_0x21b4('0xb2')]]],function(_0x362abb){return _0x362abb&&_0x362abb[_0x21b4('0x87')]==='outbound'&&_0x362abb[_0x21b4('0xb7')];});if(_0x37b228){if(this[_0x21b4('0x18')][_0x19180b[_0x21b4('0xb4')]])this[_0x21b4('0x18')][_0x19180b[_0x21b4('0xb4')]][_0x21b4('0x9e')]='ATTENDED';if(this[_0x21b4('0x18')][_0x19180b[_0x21b4('0xb5')]])this[_0x21b4('0x18')][_0x19180b['origtransfererlinkedid']][_0x21b4('0x9e')]='ATTENDED';this[_0x21b4('0x18')][_0x19180b[_0x21b4('0xb2')]]['transferType']=_0x21b4('0xb8');}}}}catch(_0x434aea){logger[_0x21b4('0x4e')](_0x21b4('0xb9'),_0x19180b[_0x21b4('0x3a')],util['inspect'](_0x434aea,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x21b4('0x30')]['syncBlindTransfer']=function(_0x845e8d){try{if(this[_0x21b4('0x2f')](_0x845e8d)){logger[_0x21b4('0x32')](_0x21b4('0xba'),_0x845e8d[_0x21b4('0x3a')],_0x845e8d[_0x21b4('0xbb')],_0x845e8d[_0x21b4('0xbc')]);logger[_0x21b4('0x36')](_0x21b4('0xbd'),_0x845e8d[_0x21b4('0x3a')],util['inspect'](_0x845e8d,{'showHidden':![],'depth':null}));if(this[_0x21b4('0x18')][_0x845e8d[_0x21b4('0xaf')]]){this[_0x21b4('0x18')][_0x845e8d[_0x21b4('0xaf')]][_0x21b4('0xb0')]=_0x845e8d[_0x21b4('0xbb')];this[_0x21b4('0x18')][_0x845e8d[_0x21b4('0xaf')]][_0x21b4('0xb1')]=_0x845e8d[_0x21b4('0xbc')];this[_0x21b4('0x18')][_0x845e8d[_0x21b4('0xaf')]]['transferType']=_0x21b4('0xbe');this[_0x21b4('0x24')]({'event':_0x21b4('0xbf'),'uniqueid':_0x845e8d[_0x21b4('0xaf')],'context':_0x845e8d[_0x21b4('0x49')],'channel':_0x845e8d[_0x21b4('0xc0')]});}else{this['channels'][_0x845e8d[_0x21b4('0xc1')]]['transferType']=_0x21b4('0xbe');}}}catch(_0x4ec6d4){logger['error'](_0x21b4('0xc2'),_0x845e8d['uniqueid'],util[_0x21b4('0x38')](_0x4ec6d4,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x21b4('0x30')]['syncMusicOnHoldStart']=function(_0x484685){try{if(this['isNotNull'](_0x484685)){logger[_0x21b4('0x36')](_0x21b4('0xc3'),_0x484685[_0x21b4('0x3a')],util[_0x21b4('0x38')](_0x484685,{'showHidden':![],'depth':null}));if(this[_0x21b4('0x18')][_0x484685['uniqueid']]){if(!_[_0x21b4('0x79')](this[_0x21b4('0x18')][_0x484685[_0x21b4('0x3a')]][_0x21b4('0x9a')])){this[_0x21b4('0x18')][_0x484685[_0x21b4('0x3a')]][_0x21b4('0xc4')]=moment()[_0x21b4('0x42')](_0x21b4('0x46'));logger[_0x21b4('0x32')]('[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s',_0x484685[_0x21b4('0x3a')],this['channels'][_0x484685[_0x21b4('0x3a')]][_0x21b4('0xc4')]);}}}}catch(_0x5ec633){logger[_0x21b4('0x4e')](_0x21b4('0xc5'),_0x484685[_0x21b4('0x3a')],util['inspect'](_0x5ec633,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x21b4('0x30')][_0x21b4('0x2c')]=function(_0x26159a){try{if(this[_0x21b4('0x2f')](_0x26159a)){logger[_0x21b4('0x36')](_0x21b4('0xc6'),_0x26159a[_0x21b4('0x3a')],util[_0x21b4('0x38')](_0x26159a,{'showHidden':![],'depth':null}));if(this[_0x21b4('0x18')][_0x26159a[_0x21b4('0x3a')]]){if(!_[_0x21b4('0x79')](this[_0x21b4('0x18')][_0x26159a['uniqueid']][_0x21b4('0xc4')])){this[_0x21b4('0x18')][_0x26159a[_0x21b4('0x3a')]][_0x21b4('0xc7')]+=moment()[_0x21b4('0xc8')](0x0)[_0x21b4('0x69')](this[_0x21b4('0x18')][_0x26159a['uniqueid']][_0x21b4('0xc4')],_0x21b4('0x5d'));logger[_0x21b4('0x32')](_0x21b4('0xc9'),_0x26159a[_0x21b4('0x3a')],this[_0x21b4('0x18')][_0x26159a['uniqueid']]['mohtime']);delete this['channels'][_0x26159a[_0x21b4('0x3a')]][_0x21b4('0xc4')];}}}}catch(_0x3ccfb7){logger['error'](_0x21b4('0xca'),_0x26159a['uniqueid'],util[_0x21b4('0x38')](_0x3ccfb7,{'showHidden':![],'depth':null}));}};module[_0x21b4('0xcb')]=VoiceCallReport; \ No newline at end of file +var _0x95ad=['[%s][voiceCallReport][musiconholdstop]','exports','bluebird','lodash','moment','path','ioredis','../../../config/environment','ami','../ami','../rpc/setting','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','set','queue','agi','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','redis','localhost','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','syncNewChannel','newstate','varset','syncVarSet','hangup','syncHangup','newcallerid','attendedtransfer','syncAttendedTransfer','blindtransfer','musiconholdstart','syncMusicOnHoldStop','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','[voiceCallReport][coreshowchannels]','isUndefined','prototype','emit','syncNewCallerId','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','keys','from-sip','channel','exten','xcally-motion-preview','split','destconnectedlinenum','connectedlinenum','format','user:agentconnect','accountcode','[%s][voiceCallReport][newcallerid]','isNotNull','[%s][voiceCallReport][newchannel]\x20event:','inspect','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','name','error','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','startsWith','CDR(routeAlias)','info','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','seconds','pick','lastapplication','lastdata','cdr(','match','[%s][voiceCallReport][newexten]','syncNewState','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','channelstate','answered','answertime','starttime','holdtime','diff','connectedlinename','destinationchannel','UserId','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','user:%s','[%s][voiceCallReport][newstate]','endsWith','.wav49','replace','.WAV','monitorFilename','find','monitors','isNil','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','syncMixMonitorFilename','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','cause-txt','endtime','billableseconds','omit','user:agentcomplete','resolve','then','isEmpty','getSettings','stopRecordingOnTransfer','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','event','BlindTransfer','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','outbound','routeid','transferType','ATTENDED','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','transfererchannel','transfereruniqueid','[%s][voiceCallReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0x95ad,0x19a));var _0xd95a=function(_0x3cb7db,_0x4bdd79){_0x3cb7db=_0x3cb7db-0x0;var _0x37463a=_0x95ad[_0x3cb7db];return _0x37463a;};'use strict';var BPromise=require(_0xd95a('0x0'));var _=require(_0xd95a('0x1'));var moment=require(_0xd95a('0x2'));var util=require('util');var path=require(_0xd95a('0x3'));var Redis=require(_0xd95a('0x4'));var config=require(_0xd95a('0x5'));var logger=require('../../../config/logger')(_0xd95a('0x6'));var ami=require(_0xd95a('0x7'));var Channel=require('../model/channel');var RpcSetting=require(_0xd95a('0x8'));var statusDesc=['unknown','not_inuse',_0xd95a('0x9'),_0xd95a('0xa'),_0xd95a('0xb'),_0xd95a('0xc'),_0xd95a('0xd'),_0xd95a('0xe'),_0xd95a('0xf')];var applications=[_0xd95a('0x10'),_0xd95a('0x11'),_0xd95a('0x12'),'dial',_0xd95a('0x13'),_0xd95a('0x14')];var dispositions=[_0xd95a('0x15'),_0xd95a('0x16'),'FAILED',_0xd95a('0x15'),_0xd95a('0x15'),'NO\x20ANSWER',_0xd95a('0x17'),'BUSY','FAILED',_0xd95a('0x16'),'FAILED'];var actions={};config[_0xd95a('0x18')]=_['defaults'](config['redis'],{'host':_0xd95a('0x19'),'port':0x18eb});var io=require(_0xd95a('0x1a'))(new Redis(config[_0xd95a('0x18')]));function VoiceCallReport(_0x4d4139){this['channels']=_0x4d4139[_0xd95a('0x1b')];this[_0xd95a('0x1c')]=_0x4d4139[_0xd95a('0x1c')];this[_0xd95a('0x1d')]={};ami['on'](_0xd95a('0x1e'),this[_0xd95a('0x1f')][_0xd95a('0x20')](this));ami['on']('newexten',this['syncNewExten'][_0xd95a('0x20')](this));ami['on']('newchannel',this[_0xd95a('0x21')][_0xd95a('0x20')](this));ami['on'](_0xd95a('0x22'),this['syncNewState'][_0xd95a('0x20')](this));ami['on'](_0xd95a('0x23'),this[_0xd95a('0x24')]['bind'](this));ami['on'](_0xd95a('0x25'),this[_0xd95a('0x26')][_0xd95a('0x20')](this));ami['on'](_0xd95a('0x27'),this['syncNewCallerId'][_0xd95a('0x20')](this));ami['on'](_0xd95a('0x28'),this[_0xd95a('0x29')][_0xd95a('0x20')](this));ami['on'](_0xd95a('0x2a'),this['syncBlindTransfer']['bind'](this));ami['on'](_0xd95a('0x2b'),this['syncMusicOnHoldStart'][_0xd95a('0x20')](this));ami['on']('musiconholdstop',this[_0xd95a('0x2c')][_0xd95a('0x20')](this));try{logger['info'](_0xd95a('0x2d'));ami[_0xd95a('0x2e')]();}catch(_0x5cceb2){logger['error'](_0xd95a('0x2f'),util['inspect'](_0x5cceb2,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype']['isNotNull']=function(_0xe29b2b){return _0xe29b2b!==null&&!_[_0xd95a('0x30')](_0xe29b2b);};VoiceCallReport[_0xd95a('0x31')]['emit']=function(_0x3a7168,_0x17b580,_0x2865b7){io['to'](_0x3a7168)[_0xd95a('0x32')](_0x17b580,_0x2865b7);};VoiceCallReport[_0xd95a('0x31')][_0xd95a('0x33')]=function(_0x41faf4){try{if(this['isNotNull'](_0x41faf4)){logger['info']('[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s',_0x41faf4[_0xd95a('0x34')],_0x41faf4[_0xd95a('0x35')],_0x41faf4[_0xd95a('0x36')]);logger[_0xd95a('0x37')](_0xd95a('0x38'),_0x41faf4['uniqueid'],util['inspect'](_0x41faf4,{'showHidden':![],'depth':null}));if(_0x41faf4[_0xd95a('0x34')]===_0x41faf4[_0xd95a('0x39')]){if(!_[_0xd95a('0x30')](this[_0xd95a('0x1b')][_0x41faf4[_0xd95a('0x34')]])){_[_0xd95a('0x3a')](this['channels'][_0x41faf4[_0xd95a('0x34')]],_['pick'](_0x41faf4,_[_0xd95a('0x3b')](this[_0xd95a('0x1b')][_0x41faf4['uniqueid']])));}}if(_0x41faf4['context']===_0xd95a('0x3c')){if(this[_0xd95a('0x1c')][_0x41faf4[_0xd95a('0x3d')]['split']('-')[0x0]]){if(_0x41faf4[_0xd95a('0x3e')]==_0xd95a('0x3f')){this['agents'][_0x41faf4['channel'][_0xd95a('0x40')]('-')[0x0]][_0xd95a('0x41')]=_0x41faf4[_0xd95a('0x42')];this[_0xd95a('0x32')](util[_0xd95a('0x43')]('user:%s',this[_0xd95a('0x1c')][_0x41faf4[_0xd95a('0x3d')][_0xd95a('0x40')]('-')[0x0]]['name']),_0xd95a('0x44'),{'destaccountcode':this[_0xd95a('0x1c')][_0x41faf4['channel'][_0xd95a('0x40')]('-')[0x0]][_0xd95a('0x45')],'destconnectedlinenum':_0x41faf4[_0xd95a('0x42')]});}}}}}catch(_0x36758d){logger['error'](_0xd95a('0x46'),_0x41faf4[_0xd95a('0x34')],util['inspect'](_0x36758d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd95a('0x31')][_0xd95a('0x21')]=function(_0x1f5a76){try{if(this[_0xd95a('0x47')](_0x1f5a76)){logger[_0xd95a('0x37')](_0xd95a('0x48'),_0x1f5a76['uniqueid'],util[_0xd95a('0x49')](_0x1f5a76,{'showHidden':![],'depth':null}));if(_0x1f5a76[_0xd95a('0x34')]===_0x1f5a76['linkedid']&&_0x1f5a76['channel']!=_0xd95a('0x4a')){if(_['isUndefined'](this[_0xd95a('0x1b')][_0x1f5a76['uniqueid']])){logger['info'](_0xd95a('0x4b'),_0x1f5a76[_0xd95a('0x34')],_0x1f5a76[_0xd95a('0x4c')],_0x1f5a76[_0xd95a('0x3e')]);this[_0xd95a('0x1b')][_0x1f5a76[_0xd95a('0x34')]]=new Channel();this['channels'][_0x1f5a76['uniqueid']]['starttime']=moment()[_0xd95a('0x43')](_0xd95a('0x4d'));this['channels'][_0x1f5a76['uniqueid']][_0xd95a('0x4e')]=dispositions[_[_0xd95a('0x4f')](_0x1f5a76['channelstate'])];_['merge'](this['channels'][_0x1f5a76['uniqueid']],_['pick'](_0x1f5a76,_[_0xd95a('0x3b')](this['channels'][_0x1f5a76[_0xd95a('0x34')]])));if(_0x1f5a76['context']===_0xd95a('0x3c')){if(this[_0xd95a('0x1c')][_0x1f5a76['channel']['split']('-')[0x0]]){if(_['isUndefined'](this[_0xd95a('0x1c')][_0x1f5a76['channel'][_0xd95a('0x40')]('-')[0x0]][_0xd95a('0x41')])){this['agents'][_0x1f5a76[_0xd95a('0x3d')][_0xd95a('0x40')]('-')[0x0]][_0xd95a('0x41')]=_0x1f5a76[_0xd95a('0x3e')];logger[_0xd95a('0x37')](_0xd95a('0x50'),_0x1f5a76[_0xd95a('0x34')],util[_0xd95a('0x49')]({'destaccountcode':this[_0xd95a('0x1c')][_0x1f5a76[_0xd95a('0x3d')][_0xd95a('0x40')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x1f5a76[_0xd95a('0x3e')]},{'showHidden':![],'depth':null}));this[_0xd95a('0x32')](util['format']('user:%s',this[_0xd95a('0x1c')][_0x1f5a76[_0xd95a('0x3d')][_0xd95a('0x40')]('-')[0x0]][_0xd95a('0x51')]),_0xd95a('0x44'),{'destaccountcode':this[_0xd95a('0x1c')][_0x1f5a76['channel'][_0xd95a('0x40')]('-')[0x0]][_0xd95a('0x45')],'destconnectedlinenum':_0x1f5a76[_0xd95a('0x3e')]});}}}}}}}catch(_0x570a49){logger[_0xd95a('0x52')](_0xd95a('0x53'),_0x1f5a76[_0xd95a('0x34')],util[_0xd95a('0x49')](_0x570a49,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd95a('0x31')][_0xd95a('0x1f')]=function(_0x5a29bf){try{if(this[_0xd95a('0x47')](_0x5a29bf)){logger['debug'](_0xd95a('0x54'),_0x5a29bf[_0xd95a('0x34')],util['inspect'](_0x5a29bf,{'showHidden':![],'depth':null}));if(_0x5a29bf[_0xd95a('0x34')]===_0x5a29bf[_0xd95a('0x39')]&&_0x5a29bf[_0xd95a('0x3e')]!='h'&&_0x5a29bf[_0xd95a('0x3d')]!=_0xd95a('0x4a')){_0x5a29bf['application']=_0x5a29bf[_0xd95a('0x55')][_0xd95a('0x56')]();_0x5a29bf[_0xd95a('0x57')]=_0x5a29bf[_0xd95a('0x58')]&&_0x5a29bf[_0xd95a('0x58')][_0xd95a('0x59')](_0xd95a('0x5a'))?_0x5a29bf[_0xd95a('0x58')]:(_0x5a29bf[_0xd95a('0x58')]||_0x5a29bf[_0xd95a('0x57')])[_0xd95a('0x56')]();logger[_0xd95a('0x5b')](_0xd95a('0x5c'),_0x5a29bf[_0xd95a('0x34')],_0x5a29bf['application'],_0x5a29bf[_0xd95a('0x57')]);if(_[_0xd95a('0x30')](this[_0xd95a('0x1b')][_0x5a29bf[_0xd95a('0x34')]])){this[_0xd95a('0x1b')][_0x5a29bf[_0xd95a('0x34')]]=new Channel();this[_0xd95a('0x1b')][_0x5a29bf[_0xd95a('0x34')]]['starttime']=_0x5a29bf[_0xd95a('0x5d')]?moment()[_0xd95a('0x5e')](moment[_0xd95a('0x5d')](_0x5a29bf[_0xd95a('0x5d')])[_0xd95a('0x5f')](),'seconds')['format'](_0xd95a('0x4d')):moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xd95a('0x1b')][_0x5a29bf[_0xd95a('0x34')]][_0xd95a('0x4e')]=_0xd95a('0x15');}_[_0xd95a('0x3a')](this[_0xd95a('0x1b')][_0x5a29bf[_0xd95a('0x34')]],_[_0xd95a('0x60')](_0x5a29bf,_[_0xd95a('0x3b')](this[_0xd95a('0x1b')][_0x5a29bf[_0xd95a('0x34')]])));if(_['includes'](applications,_0x5a29bf['application'])){this[_0xd95a('0x1b')][_0x5a29bf[_0xd95a('0x34')]][_0xd95a('0x61')]=_0x5a29bf[_0xd95a('0x55')];this[_0xd95a('0x1b')][_0x5a29bf['uniqueid']][_0xd95a('0x62')]=_0x5a29bf[_0xd95a('0x57')];if(_0x5a29bf[_0xd95a('0x55')]===_0xd95a('0x10')&&_[_0xd95a('0x59')](_0x5a29bf[_0xd95a('0x57')]['toLowerCase'](),_0xd95a('0x63'))){var _0x1901ab=_0x5a29bf[_0xd95a('0x57')][_0xd95a('0x40')]('=');var _0x590892=_0x1901ab[0x0][_0xd95a('0x56')]()[_0xd95a('0x64')](/cdr\((.*)\)/);if(_0x590892){this[_0xd95a('0x1b')][_0x5a29bf['uniqueid']][_0x590892[0x1]]=_0x1901ab[0x1];}}else if(_0x5a29bf[_0xd95a('0x55')]==='queue'){this['channels'][_0x5a29bf[_0xd95a('0x34')]][_0xd95a('0x11')]=_0x5a29bf[_0xd95a('0x57')][_0xd95a('0x40')](',')[0x0];}}}}}catch(_0x22cabe){logger[_0xd95a('0x52')](_0xd95a('0x65'),_0x5a29bf[_0xd95a('0x34')],util[_0xd95a('0x49')](_0x22cabe,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xd95a('0x66')]=function(_0x562ccc){try{if(this[_0xd95a('0x47')](_0x562ccc)){logger[_0xd95a('0x5b')](_0xd95a('0x67'),_0x562ccc[_0xd95a('0x34')],_0x562ccc[_0xd95a('0x39')],_0x562ccc[_0xd95a('0x35')],_0x562ccc[_0xd95a('0x36')]);logger['debug']('[%s][voiceCallReport][newstate]\x20event:',_0x562ccc[_0xd95a('0x34')],util['inspect'](_0x562ccc,{'showHidden':![],'depth':null}));if(_0x562ccc[_0xd95a('0x34')]!==_0x562ccc[_0xd95a('0x39')]){if(this[_0xd95a('0x1b')][_0x562ccc[_0xd95a('0x39')]]){if(_0x562ccc[_0xd95a('0x68')]==='6'){if(!this[_0xd95a('0x1b')][_0x562ccc['linkedid']]['answered']){var _0x2fb50e=moment();this['channels'][_0x562ccc[_0xd95a('0x39')]][_0xd95a('0x69')]=!![];this[_0xd95a('0x1b')][_0x562ccc['linkedid']][_0xd95a('0x6a')]=_0x2fb50e[_0xd95a('0x43')](_0xd95a('0x4d'));if(this['channels'][_0x562ccc[_0xd95a('0x39')]][_0xd95a('0x6b')]){this['channels'][_0x562ccc[_0xd95a('0x39')]][_0xd95a('0x6c')]=_0x2fb50e[_0xd95a('0x6d')](this[_0xd95a('0x1b')][_0x562ccc[_0xd95a('0x39')]]['starttime'],'seconds');}}this[_0xd95a('0x1b')][_0x562ccc[_0xd95a('0x39')]]['linkedid']=_0x562ccc[_0xd95a('0x34')];if(_0x562ccc[_0xd95a('0x36')]!==_0xd95a('0x3f')){this[_0xd95a('0x1b')][_0x562ccc['linkedid']][_0xd95a('0x42')]=_0x562ccc[_0xd95a('0x36')];}this[_0xd95a('0x1b')][_0x562ccc[_0xd95a('0x39')]][_0xd95a('0x6e')]=_0x562ccc['calleridname'];this[_0xd95a('0x1b')][_0x562ccc['linkedid']][_0xd95a('0x6f')]=_0x562ccc[_0xd95a('0x3d')];this[_0xd95a('0x1b')][_0x562ccc[_0xd95a('0x39')]][_0xd95a('0x4e')]=dispositions[_[_0xd95a('0x4f')](_0x562ccc[_0xd95a('0x68')])];if(this[_0xd95a('0x1c')][_0x562ccc[_0xd95a('0x3d')][_0xd95a('0x40')]('-')[0x0]]){this[_0xd95a('0x1b')][_0x562ccc[_0xd95a('0x39')]][_0xd95a('0x70')]=this[_0xd95a('0x1c')][_0x562ccc[_0xd95a('0x3d')][_0xd95a('0x40')]('-')[0x0]]['id'];this[_0xd95a('0x1b')][_0x562ccc[_0xd95a('0x39')]]['membername']=this[_0xd95a('0x1c')][_0x562ccc[_0xd95a('0x3d')][_0xd95a('0x40')]('-')[0x0]][_0xd95a('0x51')];}}}}else{if(this['channels'][_0x562ccc[_0xd95a('0x34')]]){if(_0x562ccc[_0xd95a('0x68')]==='6'){if(this[_0xd95a('0x1c')][_0x562ccc[_0xd95a('0x3d')][_0xd95a('0x40')]('-')[0x0]]){this[_0xd95a('0x1b')][_0x562ccc[_0xd95a('0x34')]][_0xd95a('0x70')]=this[_0xd95a('0x1c')][_0x562ccc['channel'][_0xd95a('0x40')]('-')[0x0]]['id'];this['channels'][_0x562ccc[_0xd95a('0x34')]]['membername']=this[_0xd95a('0x1c')][_0x562ccc[_0xd95a('0x3d')][_0xd95a('0x40')]('-')[0x0]][_0xd95a('0x51')];}}}}if(_0x562ccc[_0xd95a('0x68')]==='6'&&_0x562ccc[_0xd95a('0x4c')]===_0xd95a('0x3c')){if(this[_0xd95a('0x1c')][_0x562ccc[_0xd95a('0x3d')][_0xd95a('0x40')]('-')[0x0]]){this[_0xd95a('0x1c')][_0x562ccc[_0xd95a('0x3d')][_0xd95a('0x40')]('-')[0x0]][_0xd95a('0x41')]=_0x562ccc[_0xd95a('0x3e')];var _0x385ca2;if(this[_0xd95a('0x1b')][_0x562ccc[_0xd95a('0x34')]])_0x385ca2=this[_0xd95a('0x1b')][_0x562ccc[_0xd95a('0x34')]][_0xd95a('0x71')];else if(this[_0xd95a('0x1b')][_0x562ccc[_0xd95a('0x39')]])_0x385ca2=this[_0xd95a('0x1b')][_0x562ccc[_0xd95a('0x39')]][_0xd95a('0x71')];logger[_0xd95a('0x37')](_0xd95a('0x72'),_0x562ccc[_0xd95a('0x34')],util[_0xd95a('0x49')]({'destaccountcode':this['agents'][_0x562ccc['channel'][_0xd95a('0x40')]('-')[0x0]][_0xd95a('0x45')],'destconnectedlinenum':_0x562ccc[_0xd95a('0x3e')],'routealias':_0x385ca2},{'showHidden':![],'depth':null}));this[_0xd95a('0x32')](util[_0xd95a('0x43')](_0xd95a('0x73'),this[_0xd95a('0x1c')][_0x562ccc[_0xd95a('0x3d')]['split']('-')[0x0]][_0xd95a('0x51')]),_0xd95a('0x44'),{'destaccountcode':this['agents'][_0x562ccc['channel'][_0xd95a('0x40')]('-')[0x0]][_0xd95a('0x45')],'destconnectedlinenum':_0x562ccc[_0xd95a('0x3e')],'routealias':_0x385ca2});}}}}catch(_0x8b97d7){logger['error'](_0xd95a('0x74'),_0x562ccc[_0xd95a('0x34')],util['inspect'](_0x8b97d7,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd95a('0x31')]['syncMixMonitorFilename']=function(_0x1947b1,_0x2c3dfb){try{if(this[_0xd95a('0x1b')][_0x1947b1]){logger[_0xd95a('0x5b')]('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x1947b1,_0x2c3dfb);this['channels'][_0x1947b1]['monitor']=!![];if(_[_0xd95a('0x75')](_0x2c3dfb,_0xd95a('0x76'))){_0x2c3dfb=_0x2c3dfb[_0xd95a('0x77')](_0xd95a('0x76'),_0xd95a('0x78'));}this[_0xd95a('0x1b')][_0x1947b1][_0xd95a('0x79')]=_0x2c3dfb;var _0x196a24=_[_0xd95a('0x7a')](this[_0xd95a('0x1b')][_0x1947b1][_0xd95a('0x7b')],{'filename':_0x2c3dfb});if(_[_0xd95a('0x7c')](_0x196a24)){this[_0xd95a('0x1b')][_0x1947b1][_0xd95a('0x7b')]['push']({'filename':_0x2c3dfb,'createdAt':moment()[_0xd95a('0x43')](_0xd95a('0x4d')),'mixmonitorid':'','status':_0xd95a('0x7d')});}}}catch(_0x829032){logger[_0xd95a('0x52')](_0xd95a('0x7e'),_0x1947b1,util[_0xd95a('0x49')](_0x829032,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xd95a('0x24')]=function(_0x4d50d7){try{if(this[_0xd95a('0x47')](_0x4d50d7)){logger[_0xd95a('0x37')](_0xd95a('0x7f'),_0x4d50d7[_0xd95a('0x34')],util[_0xd95a('0x49')](_0x4d50d7,{'showHidden':![],'depth':null}));if(this[_0xd95a('0x1b')][_0x4d50d7[_0xd95a('0x34')]]&&_0x4d50d7[_0xd95a('0x3d')]!=_0xd95a('0x4a')){if(this[_0xd95a('0x47')](_0x4d50d7['variable'])){if(this['isNotNull'](_0x4d50d7[_0xd95a('0x80')][_0xd95a('0x81')])){logger[_0xd95a('0x5b')](_0xd95a('0x82'),_0x4d50d7['uniqueid'],_0x4d50d7[_0xd95a('0x83')]);this[_0xd95a('0x84')](_0x4d50d7[_0xd95a('0x34')],_0x4d50d7[_0xd95a('0x83')]);}else if(this['isNotNull'](_0x4d50d7[_0xd95a('0x80')][_0xd95a('0x85')])){logger[_0xd95a('0x5b')](_0xd95a('0x86'),_0x4d50d7[_0xd95a('0x34')],_0x4d50d7[_0xd95a('0x83')]);this[_0xd95a('0x1b')][_0x4d50d7['uniqueid']][_0xd95a('0x36')]=_0x4d50d7[_0xd95a('0x83')];}else if(this[_0xd95a('0x47')](_0x4d50d7[_0xd95a('0x80')]['xmd-callerid'])){logger[_0xd95a('0x5b')](_0xd95a('0x87'),_0x4d50d7['uniqueid'],_0x4d50d7[_0xd95a('0x83')]);this[_0xd95a('0x1b')][_0x4d50d7[_0xd95a('0x34')]][_0xd95a('0x88')]=_0x4d50d7[_0xd95a('0x83')];}else if(this[_0xd95a('0x47')](_0x4d50d7[_0xd95a('0x80')][_0xd95a('0x89')])){logger[_0xd95a('0x5b')](_0xd95a('0x8a'),_0x4d50d7['uniqueid'],_0x4d50d7[_0xd95a('0x83')]);this[_0xd95a('0x1b')][_0x4d50d7[_0xd95a('0x34')]][_0xd95a('0x8b')]=_0x4d50d7['value'];}else if(this[_0xd95a('0x47')](_0x4d50d7['variable']['xmd-queue'])){logger['info'](_0xd95a('0x8c'),_0x4d50d7[_0xd95a('0x34')],_0x4d50d7[_0xd95a('0x83')][_0xd95a('0x40')](',')[0x0]);this[_0xd95a('0x1b')][_0x4d50d7[_0xd95a('0x34')]]['queue']=_0x4d50d7[_0xd95a('0x83')]['split'](',')[0x0];}else if(this['isNotNull'](_0x4d50d7[_0xd95a('0x80')]['xmd-originatecalleridnum'])){logger[_0xd95a('0x5b')](_0xd95a('0x8d'),_0x4d50d7[_0xd95a('0x34')],_0x4d50d7[_0xd95a('0x83')]);this[_0xd95a('0x1b')][_0x4d50d7[_0xd95a('0x34')]][_0xd95a('0x8e')]=_0x4d50d7[_0xd95a('0x83')];}else if(this[_0xd95a('0x47')](_0x4d50d7['variable'][_0xd95a('0x8f')])){logger[_0xd95a('0x5b')](_0xd95a('0x90'),_0x4d50d7['uniqueid'],_0x4d50d7[_0xd95a('0x83')]);this['channels'][_0x4d50d7[_0xd95a('0x34')]]['destination']=_0x4d50d7['value'];}else if(this[_0xd95a('0x47')](_0x4d50d7['variable'][_0xd95a('0x91')])){logger['info'](_0xd95a('0x92'),_0x4d50d7[_0xd95a('0x34')],_0x4d50d7[_0xd95a('0x83')]);this[_0xd95a('0x1b')][_0x4d50d7[_0xd95a('0x34')]]['calleridpreview']=_0x4d50d7[_0xd95a('0x83')];}else if(this[_0xd95a('0x47')](_0x4d50d7[_0xd95a('0x80')]['xmcs-queue'])){logger[_0xd95a('0x5b')]('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x4d50d7[_0xd95a('0x34')],_0x4d50d7['value']);this['channels'][_0x4d50d7['uniqueid']][_0xd95a('0x11')]=_0x4d50d7[_0xd95a('0x83')];}else if(this['isNotNull'](_0x4d50d7[_0xd95a('0x80')][_0xd95a('0x93')])){logger['info'](_0xd95a('0x94'),_0x4d50d7[_0xd95a('0x34')],_0x4d50d7[_0xd95a('0x83')]);this['channels'][_0x4d50d7[_0xd95a('0x34')]][_0xd95a('0x95')]=_0x4d50d7[_0xd95a('0x83')];}}}else if(this[_0xd95a('0x47')](_0x4d50d7[_0xd95a('0x80')][_0xd95a('0x81')])){if(_0x4d50d7[_0xd95a('0x83')]){var _0x284314=path[_0xd95a('0x96')](_0x4d50d7['value'])['name'];logger[_0xd95a('0x5b')](_0xd95a('0x82'),_0x284314,_0x4d50d7[_0xd95a('0x83')]);this[_0xd95a('0x84')](_0x284314,_0x4d50d7[_0xd95a('0x83')]);}}else if(this[_0xd95a('0x1b')][_0x4d50d7[_0xd95a('0x39')]]){if(this[_0xd95a('0x47')](_0x4d50d7[_0xd95a('0x80')])){if(this[_0xd95a('0x47')](_0x4d50d7[_0xd95a('0x80')][_0xd95a('0x93')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x4d50d7['linkedid'],_0x4d50d7[_0xd95a('0x83')]);this[_0xd95a('0x1b')][_0x4d50d7[_0xd95a('0x39')]]['sipcalllinkedid']=_0x4d50d7[_0xd95a('0x83')];}}}}}catch(_0x157ac8){logger[_0xd95a('0x52')](_0xd95a('0x97'),_0x4d50d7[_0xd95a('0x34')],util[_0xd95a('0x49')](_0x157ac8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd95a('0x31')][_0xd95a('0x26')]=function(_0x25f88b){try{if(this['isNotNull'](_0x25f88b)){logger['debug'](_0xd95a('0x98'),_0x25f88b['uniqueid'],util[_0xd95a('0x49')](_0x25f88b,{'showHidden':![],'depth':null}));if(this[_0xd95a('0x1b')][_0x25f88b['uniqueid']]){logger[_0xd95a('0x5b')]('[%s][voiceCallReport][hangup]\x20reason:%s',_0x25f88b[_0xd95a('0x34')],_0x25f88b[_0xd95a('0x99')]);var _0x275c6c=moment();this[_0xd95a('0x1b')][_0x25f88b[_0xd95a('0x34')]][_0xd95a('0x9a')]=_0x275c6c[_0xd95a('0x43')](_0xd95a('0x4d'));this[_0xd95a('0x1b')][_0x25f88b[_0xd95a('0x34')]]['duration']=_0x275c6c[_0xd95a('0x6d')](this[_0xd95a('0x1b')][_0x25f88b[_0xd95a('0x34')]][_0xd95a('0x6b')],_0xd95a('0x5f'));if(this['channels'][_0x25f88b[_0xd95a('0x34')]][_0xd95a('0x69')]){this['channels'][_0x25f88b[_0xd95a('0x34')]][_0xd95a('0x9b')]=_0x275c6c[_0xd95a('0x6d')](this['channels'][_0x25f88b[_0xd95a('0x34')]][_0xd95a('0x6a')],_0xd95a('0x5f'));this[_0xd95a('0x1b')][_0x25f88b['uniqueid']][_0xd95a('0x6c')]=this[_0xd95a('0x1b')][_0x25f88b[_0xd95a('0x34')]]['duration']-this[_0xd95a('0x1b')][_0x25f88b[_0xd95a('0x34')]][_0xd95a('0x9b')];}if(_0x25f88b['context']===_0xd95a('0x3c')){if(this[_0xd95a('0x1c')][_0x25f88b['channel']['split']('-')[0x0]]){this[_0xd95a('0x1c')][_0x25f88b['channel'][_0xd95a('0x40')]('-')[0x0]]=_[_0xd95a('0x9c')](this[_0xd95a('0x1c')][_0x25f88b[_0xd95a('0x3d')]['split']('-')[0x0]],['destconnectedlinenum']);logger[_0xd95a('0x37')]('[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:',_0x25f88b[_0xd95a('0x34')],util[_0xd95a('0x49')]({'id':this[_0xd95a('0x1c')][_0x25f88b[_0xd95a('0x3d')][_0xd95a('0x40')]('-')[0x0]]['id'],'destaccountcode':this[_0xd95a('0x1c')][_0x25f88b[_0xd95a('0x3d')]['split']('-')[0x0]][_0xd95a('0x45')]},{'showHidden':![],'depth':null}));this[_0xd95a('0x32')](util[_0xd95a('0x43')](_0xd95a('0x73'),this[_0xd95a('0x1c')][_0x25f88b[_0xd95a('0x3d')][_0xd95a('0x40')]('-')[0x0]][_0xd95a('0x51')]),_0xd95a('0x9d'),{'id':this['agents'][_0x25f88b[_0xd95a('0x3d')][_0xd95a('0x40')]('-')[0x0]]['id'],'destaccountcode':this[_0xd95a('0x1c')][_0x25f88b['channel'][_0xd95a('0x40')]('-')[0x0]][_0xd95a('0x45')]});}}var _0x29d810=this;Promise[_0xd95a('0x9e')]()[_0xd95a('0x9f')](function(){var _0x5a9f56=_0x29d810[_0xd95a('0x1b')][_0x25f88b[_0xd95a('0x34')]];if(typeof _0x5a9f56['transferType']==='undefined')return;if(_[_0xd95a('0xa0')](_0x5a9f56[_0xd95a('0x7b')]))return;return RpcSetting[_0xd95a('0xa1')]()[_0xd95a('0x9f')](function(_0xeaf555){if(!_0xeaf555[_0xd95a('0xa2')])return;return Promise['resolve']()['then'](function(){return ami[_0xd95a('0xa3')]({'action':_0xd95a('0xa4'),'channel':_0x5a9f56['channel']})[_0xd95a('0xa5')](function(){});})[_0xd95a('0x9f')](function(){return ami['Action']({'action':_0xd95a('0xa4'),'channel':_0x5a9f56[_0xd95a('0x6f')]})[_0xd95a('0xa5')](function(){})[_0xd95a('0xa6')](function(){var _0x712960=_0x29d810[_0xd95a('0x1c')][_0x5a9f56[_0xd95a('0x6f')][_0xd95a('0x40')]('-')[0x0]];if(!_0x712960)return;io[_0xd95a('0x32')](_0xd95a('0xa7'),{'agentId':_0x712960['id'],'uniqueid':_0x5a9f56[_0xd95a('0x34')]});});});});})['then'](function(){if(_0x25f88b[_0xd95a('0xa8')]===_0xd95a('0xa9')){_0x29d810[_0xd95a('0x1d')][_0x25f88b[_0xd95a('0x34')]]=_0x29d810[_0xd95a('0x1b')][_0x25f88b[_0xd95a('0x34')]];}else{if(_0x29d810[_0xd95a('0x1b')][_0x25f88b['uniqueid']][_0xd95a('0x8b')]==='outbound'&&_0x29d810[_0xd95a('0x1d')][_0x25f88b['uniqueid']]){_0x29d810[_0xd95a('0x1b')][_0x25f88b[_0xd95a('0x34')]][_0xd95a('0x34')]=[_0x29d810[_0xd95a('0x1b')][_0x25f88b['uniqueid']][_0xd95a('0x39')],_0x29d810[_0xd95a('0x1b')][_0x25f88b[_0xd95a('0x34')]]['linkedid']=_0x29d810[_0xd95a('0x1b')][_0x25f88b['uniqueid']][_0xd95a('0x34')]][0x0];delete _0x29d810[_0xd95a('0x1d')][_0x25f88b[_0xd95a('0x34')]];}}logger[_0xd95a('0x37')](_0xd95a('0xaa'),_0x25f88b['uniqueid'],util[_0xd95a('0x49')](_0x29d810[_0xd95a('0x1b')][_0x25f88b[_0xd95a('0x34')]],{'showHidden':![],'depth':null}));ami[_0xd95a('0x32')]('custom:voiceCallReport',_0x29d810['channels'][_0x25f88b[_0xd95a('0x34')]]);delete _0x29d810[_0xd95a('0x1b')][_0x25f88b[_0xd95a('0x34')]];});}}}catch(_0x2481a6){logger[_0xd95a('0x52')]('[%s][voiceCallReport][hangup]',_0x25f88b[_0xd95a('0x34')],util[_0xd95a('0x49')](_0x2481a6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd95a('0x31')][_0xd95a('0x29')]=function(_0x2ecd8e){try{if(this[_0xd95a('0x47')](_0x2ecd8e)){logger[_0xd95a('0x5b')]('[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x2ecd8e[_0xd95a('0x34')],_0x2ecd8e[_0xd95a('0xab')],_0x2ecd8e[_0xd95a('0xac')]);logger[_0xd95a('0x37')](_0xd95a('0xad'),_0x2ecd8e[_0xd95a('0x34')],util[_0xd95a('0x49')](_0x2ecd8e,{'showHidden':![],'depth':null}));if(this['channels'][_0x2ecd8e[_0xd95a('0xae')]]){this['channels'][_0x2ecd8e[_0xd95a('0xae')]][_0xd95a('0xaf')]=_0x2ecd8e['origtransferercalleridnum'];this[_0xd95a('0x1b')][_0x2ecd8e['transfereeuniqueid']][_0xd95a('0xb0')]=_0x2ecd8e[_0xd95a('0xac')];if(this[_0xd95a('0x1b')][_0x2ecd8e[_0xd95a('0xb1')]]){var _0x2bfcfe=this[_0xd95a('0x1b')][_0x2ecd8e[_0xd95a('0xb1')]];this[_0xd95a('0x1b')][_0x2ecd8e['secondtransfereruniqueid']]=this['channels'][_0x2ecd8e[_0xd95a('0xae')]];this['channels'][_0x2ecd8e[_0xd95a('0xae')]]=_0x2bfcfe;}}else if(this[_0xd95a('0x1b')][_0x2ecd8e[_0xd95a('0xb2')]]){this[_0xd95a('0x1b')][_0x2ecd8e[_0xd95a('0xb2')]][_0xd95a('0xaf')]=_0x2ecd8e['origtransferercalleridnum'];this['channels'][_0x2ecd8e[_0xd95a('0xb2')]][_0xd95a('0xb0')]=_0x2ecd8e['transfertargetcalleridnum'];if(this[_0xd95a('0x1b')][_0x2ecd8e[_0xd95a('0xb3')]]){var _0x2bfcfe=this['channels'][_0x2ecd8e[_0xd95a('0xb3')]];this[_0xd95a('0x1b')][_0x2ecd8e['origtransfereruniqueid']]=this[_0xd95a('0x1b')][_0x2ecd8e[_0xd95a('0xb2')]];this[_0xd95a('0x1b')][_0x2ecd8e[_0xd95a('0xb2')]]=_0x2bfcfe;}}if((this[_0xd95a('0x1b')][_0x2ecd8e[_0xd95a('0xb3')]]||this['channels'][_0x2ecd8e[_0xd95a('0xb4')]])&&this[_0xd95a('0x1b')][_0x2ecd8e[_0xd95a('0xb1')]]){var _0x46f62e=_['some']([this[_0xd95a('0x1b')][_0x2ecd8e[_0xd95a('0xb3')]],this[_0xd95a('0x1b')][_0x2ecd8e[_0xd95a('0xb4')]],this['channels'][_0x2ecd8e[_0xd95a('0xb1')]]],function(_0x4168a){return _0x4168a&&_0x4168a[_0xd95a('0x8b')]===_0xd95a('0xb5')&&_0x4168a[_0xd95a('0xb6')];});if(_0x46f62e){if(this['channels'][_0x2ecd8e['origtransfereruniqueid']])this['channels'][_0x2ecd8e[_0xd95a('0xb3')]][_0xd95a('0xb7')]=_0xd95a('0xb8');if(this['channels'][_0x2ecd8e[_0xd95a('0xb4')]])this[_0xd95a('0x1b')][_0x2ecd8e[_0xd95a('0xb4')]][_0xd95a('0xb7')]=_0xd95a('0xb8');this['channels'][_0x2ecd8e['secondtransfereruniqueid']][_0xd95a('0xb7')]='ATTENDED';}}}}catch(_0x22ced0){logger[_0xd95a('0x52')](_0xd95a('0xb9'),_0x2ecd8e['uniqueid'],util[_0xd95a('0x49')](_0x22ced0,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncBlindTransfer']=function(_0x1be7d1){try{if(this['isNotNull'](_0x1be7d1)){logger[_0xd95a('0x5b')](_0xd95a('0xba'),_0x1be7d1[_0xd95a('0x34')],_0x1be7d1[_0xd95a('0xbb')],_0x1be7d1[_0xd95a('0xbc')]);logger[_0xd95a('0x37')](_0xd95a('0xbd'),_0x1be7d1['uniqueid'],util['inspect'](_0x1be7d1,{'showHidden':![],'depth':null}));if(this[_0xd95a('0x1b')][_0x1be7d1[_0xd95a('0xae')]]){this['channels'][_0x1be7d1['transfereeuniqueid']]['transfercalleridnum']=_0x1be7d1[_0xd95a('0xbb')];this[_0xd95a('0x1b')][_0x1be7d1[_0xd95a('0xae')]]['transferconnectedlinenum']=_0x1be7d1[_0xd95a('0xbc')];this['channels'][_0x1be7d1[_0xd95a('0xae')]][_0xd95a('0xb7')]=_0xd95a('0xbe');this['syncHangup']({'event':'BlindTransfer','uniqueid':_0x1be7d1[_0xd95a('0xae')],'context':_0x1be7d1[_0xd95a('0x4c')],'channel':_0x1be7d1[_0xd95a('0xbf')]});}else{this[_0xd95a('0x1b')][_0x1be7d1[_0xd95a('0xc0')]]['transferType']=_0xd95a('0xbe');}}}catch(_0x4de8a5){logger['error'](_0xd95a('0xc1'),_0x1be7d1[_0xd95a('0x34')],util[_0xd95a('0x49')](_0x4de8a5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd95a('0x31')][_0xd95a('0xc2')]=function(_0x1e1e0f){try{if(this[_0xd95a('0x47')](_0x1e1e0f)){logger[_0xd95a('0x37')](_0xd95a('0xc3'),_0x1e1e0f[_0xd95a('0x34')],util[_0xd95a('0x49')](_0x1e1e0f,{'showHidden':![],'depth':null}));if(this[_0xd95a('0x1b')][_0x1e1e0f[_0xd95a('0x34')]]){if(!_[_0xd95a('0x7c')](this[_0xd95a('0x1b')][_0x1e1e0f[_0xd95a('0x34')]][_0xd95a('0x6a')])){this[_0xd95a('0x1b')][_0x1e1e0f[_0xd95a('0x34')]][_0xd95a('0xc4')]=moment()[_0xd95a('0x43')](_0xd95a('0x4d'));logger['info']('[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s',_0x1e1e0f[_0xd95a('0x34')],this[_0xd95a('0x1b')][_0x1e1e0f['uniqueid']]['mohstarttime']);}}}}catch(_0x8e005){logger[_0xd95a('0x52')](_0xd95a('0xc5'),_0x1e1e0f[_0xd95a('0x34')],util[_0xd95a('0x49')](_0x8e005,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd95a('0x31')][_0xd95a('0x2c')]=function(_0x5929d6){try{if(this[_0xd95a('0x47')](_0x5929d6)){logger[_0xd95a('0x37')](_0xd95a('0xc6'),_0x5929d6[_0xd95a('0x34')],util['inspect'](_0x5929d6,{'showHidden':![],'depth':null}));if(this[_0xd95a('0x1b')][_0x5929d6[_0xd95a('0x34')]]){if(!_[_0xd95a('0x7c')](this[_0xd95a('0x1b')][_0x5929d6[_0xd95a('0x34')]][_0xd95a('0xc4')])){this[_0xd95a('0x1b')][_0x5929d6[_0xd95a('0x34')]][_0xd95a('0xc7')]+=moment()[_0xd95a('0xc8')](0x0)[_0xd95a('0x6d')](this[_0xd95a('0x1b')][_0x5929d6[_0xd95a('0x34')]]['mohstarttime'],_0xd95a('0x5f'));logger[_0xd95a('0x5b')](_0xd95a('0xc9'),_0x5929d6['uniqueid'],this['channels'][_0x5929d6[_0xd95a('0x34')]]['mohtime']);delete this[_0xd95a('0x1b')][_0x5929d6[_0xd95a('0x34')]][_0xd95a('0xc4')];}}}}catch(_0x36cf9b){logger['error'](_0xd95a('0xca'),_0x5929d6['uniqueid'],util['inspect'](_0x36cf9b,{'showHidden':![],'depth':null}));}};module[_0xd95a('0xcb')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index a9c1c76..09e989a 100644 --- a/server/services/ami/report/voiceDialReport.js +++ b/server/services/ami/report/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x18d2=['voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','syncDialEnd','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','connect','custom:dialconnect','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','outboundrouteid','value','[%s][voiceDialReport][varset]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','syncHangup','[%s][voiceDialReport][hangup]\x20event:','cause-txt','duration','endtime','diff','starttime','complete','total','answered','seconds','billableseconds','sumHoldTime','holdtime','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','syncNewExten','[%s][voiceDialReport][newexten]\x20event:','application','set','appdata','applicationdata','startsWith','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','match','exports','lodash','moment','util','ioredis','../../../config/environment','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','outboundChannels','outbound','applications','variables','dialbegin','syncDialBegin','dialend','varset','syncVarSet','bind','newexten','hangup','prototype','isNotNull','isUndefined','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','inspect','merge','uniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound'];(function(_0x144934,_0x31d36d){var _0x1b3fcf=function(_0x2a84ad){while(--_0x2a84ad){_0x144934['push'](_0x144934['shift']());}};_0x1b3fcf(++_0x31d36d);}(_0x18d2,0x1c4));var _0x218d=function(_0x5dac32,_0x59c8d4){_0x5dac32=_0x5dac32-0x0;var _0x104bbb=_0x18d2[_0x5dac32];return _0x104bbb;};'use strict';var _=require(_0x218d('0x0'));var moment=require(_0x218d('0x1'));var util=require(_0x218d('0x2'));var Redis=require(_0x218d('0x3'));var config=require(_0x218d('0x4'));var logger=require('../../../config/logger')(_0x218d('0x5'));var ami=require(_0x218d('0x6'));config[_0x218d('0x7')]=_[_0x218d('0x8')](config[_0x218d('0x7')],{'host':_0x218d('0x9'),'port':0x18eb});var io=require(_0x218d('0xa'))(new Redis(config[_0x218d('0x7')]));function VoiceDialReport(_0x1404b2){this[_0x218d('0xb')]=_0x1404b2[_0x218d('0xc')];this['outbound']=_0x1404b2[_0x218d('0xd')];this[_0x218d('0xe')]={};this[_0x218d('0xf')]={};ami['on'](_0x218d('0x10'),this[_0x218d('0x11')]['bind'](this));ami['on'](_0x218d('0x12'),this['syncDialEnd']['bind'](this));ami['on'](_0x218d('0x13'),this[_0x218d('0x14')][_0x218d('0x15')](this));ami['on'](_0x218d('0x16'),this['syncNewExten'][_0x218d('0x15')](this));ami['on'](_0x218d('0x17'),this['syncHangup'][_0x218d('0x15')](this));}VoiceDialReport[_0x218d('0x18')][_0x218d('0x19')]=function(_0x364d8e){return _0x364d8e!==null&&!_[_0x218d('0x1a')](_0x364d8e);};VoiceDialReport[_0x218d('0x18')]['emit']=function(_0x7000fa,_0x4ff297,_0x1f5853){io['to'](_0x7000fa)[_0x218d('0x1b')](_0x4ff297,_0x1f5853);};VoiceDialReport['prototype'][_0x218d('0x11')]=function(_0x519688){try{if(this[_0x218d('0x19')](_0x519688)){logger[_0x218d('0x1c')](_0x218d('0x1d'),_0x519688['uniqueid'],util[_0x218d('0x1e')](_0x519688,{'showHidden':![],'depth':null}));if(this['channels'][_0x519688['uniqueid']]){_[_0x218d('0x1f')](this['channels'][_0x519688[_0x218d('0x20')]],{'starttime':moment()[_0x218d('0x21')](_0x218d('0x22')),'lastevent':_0x218d('0x23'),'interface':_0x519688[_0x218d('0x24')][_0x218d('0x25')](0x0,_0x519688[_0x218d('0x24')][_0x218d('0x26')]('-')),'membername':_0x519688['channel']['substring'](_0x519688[_0x218d('0x24')][_0x218d('0x26')]('/')+0x1,_0x519688[_0x218d('0x24')][_0x218d('0x26')]('-'))},_[_0x218d('0x27')](_0x519688,[_0x218d('0x28'),_0x218d('0x29')]));logger[_0x218d('0x2a')](_0x218d('0x2b'),_0x519688['uniqueid'],this[_0x218d('0xb')][_0x519688[_0x218d('0x20')]][_0x218d('0x2c')],this[_0x218d('0xb')][_0x519688['uniqueid']][_0x218d('0x2d')]);logger['debug'](_0x218d('0x2e'),_0x519688[_0x218d('0x20')],util['inspect'](this[_0x218d('0xb')][_0x519688[_0x218d('0x20')]],{'showHidden':![],'depth':null}));if(this['applications'][_0x519688[_0x218d('0x20')]])_['merge'](this[_0x218d('0xb')][_0x519688[_0x218d('0x20')]],this[_0x218d('0xe')][_0x519688[_0x218d('0x20')]]);this[_0x218d('0x1b')](_0x218d('0x2f'),_0x218d('0x30'),this[_0x218d('0xb')][_0x519688['uniqueid']]);logger[_0x218d('0x1c')](_0x218d('0x31'),_0x519688[_0x218d('0x20')],util['inspect'](this['channels'][_0x519688['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x218d('0x1b')](_0x218d('0x32'),this[_0x218d('0xb')][_0x519688[_0x218d('0x20')]]);}}}catch(_0x414536){logger[_0x218d('0x33')]('[%s][voiceDialReport][dialbegin]',_0x519688[_0x218d('0x20')],util[_0x218d('0x1e')](_0x414536,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x218d('0x18')][_0x218d('0x34')]=function(_0x508824){try{if(this['isNotNull'](_0x508824)){logger[_0x218d('0x1c')](_0x218d('0x35'),_0x508824[_0x218d('0x20')],util['inspect'](_0x508824,{'showHidden':![],'depth':null}));if(this[_0x218d('0xb')][_0x508824[_0x218d('0x20')]]){this[_0x218d('0xb')][_0x508824[_0x218d('0x20')]][_0x218d('0x36')]=_0x508824[_0x218d('0x36')];if(_0x508824[_0x218d('0x36')]===_0x218d('0x37')){this[_0x218d('0xb')][_0x508824[_0x218d('0x20')]][_0x218d('0x38')]=_0x508824[_0x218d('0x38')];this[_0x218d('0xb')][_0x508824[_0x218d('0x20')]][_0x218d('0x39')]=_0x508824[_0x218d('0x39')];this[_0x218d('0xb')][_0x508824[_0x218d('0x20')]][_0x218d('0x3a')]=moment()[_0x218d('0x21')](_0x218d('0x22'));this[_0x218d('0xb')][_0x508824[_0x218d('0x20')]][_0x218d('0x3b')]=_0x218d('0x3c');logger[_0x218d('0x2a')]('[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect',_0x508824[_0x218d('0x20')],_0x508824[_0x218d('0x24')][_0x218d('0x25')](_0x508824['channel'][_0x218d('0x26')]('/')+0x1,_0x508824['channel'][_0x218d('0x26')]('-')));logger[_0x218d('0x1c')]('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0x508824[_0x218d('0x20')],util[_0x218d('0x1e')](this[_0x218d('0xb')][_0x508824[_0x218d('0x20')]],{'showHidden':![],'depth':null}));ami[_0x218d('0x1b')](_0x218d('0x3d'),this[_0x218d('0xb')][_0x508824[_0x218d('0x20')]]);}logger[_0x218d('0x1c')]('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x508824[_0x218d('0x20')],util['inspect'](this[_0x218d('0xb')][_0x508824['uniqueid']],{'showHidden':![],'depth':null}));this[_0x218d('0x1b')](_0x218d('0x2f'),_0x218d('0x30'),this[_0x218d('0xb')][_0x508824[_0x218d('0x20')]]);}}}catch(_0x4d0685){logger[_0x218d('0x33')](_0x218d('0x3e'),_0x508824[_0x218d('0x20')],util[_0x218d('0x1e')](_0x4d0685,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x218d('0x14')]=function(_0x6b6bc2){try{if(this[_0x218d('0x19')](_0x6b6bc2)){logger[_0x218d('0x1c')](_0x218d('0x3f'),_0x6b6bc2[_0x218d('0x20')],util[_0x218d('0x1e')](_0x6b6bc2,{'showHidden':![],'depth':null}));this[_0x218d('0x40')](_0x6b6bc2['uniqueid'],_[_0x218d('0x41')](_0x6b6bc2[_0x218d('0x42')])[0x0],_0x6b6bc2['value']);if(this[_0x218d('0x19')](_0x6b6bc2[_0x218d('0x42')])&&this['isNotNull'](_0x6b6bc2[_0x218d('0x42')]['outboundrouteid'])){if(_[_0x218d('0x1a')](this[_0x218d('0xb')][_0x6b6bc2[_0x218d('0x20')]])){this['channels'][_0x6b6bc2[_0x218d('0x20')]]={'routeId':_0x6b6bc2['value'],'variables':this[_0x218d('0xf')][_0x6b6bc2[_0x218d('0x20')]]};logger[_0x218d('0x2a')](_0x218d('0x43'),_0x6b6bc2['uniqueid'],_0x6b6bc2['variable'][_0x218d('0x44')],_[_0x218d('0x41')](_0x6b6bc2[_0x218d('0x42')])[0x0],_0x6b6bc2[_0x218d('0x45')]);logger['debug']('[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:',_0x6b6bc2[_0x218d('0x20')],util[_0x218d('0x1e')](this[_0x218d('0xb')][_0x6b6bc2[_0x218d('0x20')]],{'showHidden':![],'depth':null}));this[_0x218d('0x1b')](_0x218d('0x2f'),'voice_outbound_channel:save',this[_0x218d('0xb')][_0x6b6bc2[_0x218d('0x20')]]);}}}}catch(_0x5c23c0){logger['error'](_0x218d('0x46'),_0x6b6bc2[_0x218d('0x20')],util[_0x218d('0x1e')](_0x5c23c0,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['addVariable']=function(_0x24c35d,_0x67813f,_0xd1877f){var _0x5c69ae=['rtpaudioqos',_0x218d('0x47'),_0x218d('0x48'),_0x218d('0x49'),_0x218d('0x4a'),_0x218d('0x4b'),_0x218d('0x4c'),_0x218d('0x4d'),_0x218d('0x4e'),_0x218d('0x4f'),_0x218d('0x50'),_0x218d('0x51'),'membercalls','memberdynamic',_0x218d('0x52'),_0x218d('0x53'),'membername',_0x218d('0x54'),_0x218d('0x55')];if(!_[_0x218d('0x56')](_0x67813f)&&!_[_0x218d('0x57')](_0x5c69ae,_0x67813f)){if(_[_0x218d('0x1a')](this[_0x218d('0xf')][_0x24c35d])){this[_0x218d('0xf')][_0x24c35d]={};}this[_0x218d('0xf')][_0x24c35d][_0x67813f]=_0xd1877f;}};VoiceDialReport['prototype'][_0x218d('0x58')]=function(_0x5a7a89){try{if(this[_0x218d('0x19')](_0x5a7a89)){logger['debug'](_0x218d('0x59'),_0x5a7a89[_0x218d('0x20')],util[_0x218d('0x1e')](_0x5a7a89,{'showHidden':![],'depth':null}));if(this[_0x218d('0xb')][_0x5a7a89[_0x218d('0x20')]]){logger['info']('[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete',_0x5a7a89[_0x218d('0x20')],_0x5a7a89[_0x218d('0x5a')]);this['channels'][_0x5a7a89[_0x218d('0x20')]]['endtime']=moment()[_0x218d('0x21')](_0x218d('0x22'));this[_0x218d('0xb')][_0x5a7a89[_0x218d('0x20')]][_0x218d('0x5b')]=moment(this[_0x218d('0xb')][_0x5a7a89['uniqueid']][_0x218d('0x5c')])[_0x218d('0x5d')](this[_0x218d('0xb')][_0x5a7a89['uniqueid']][_0x218d('0x5e')],'seconds');this[_0x218d('0xb')][_0x5a7a89[_0x218d('0x20')]][_0x218d('0x3b')]=_0x218d('0x5f');this['outbound'][_0x218d('0x60')]+=0x1;if(this[_0x218d('0xb')][_0x5a7a89[_0x218d('0x20')]][_0x218d('0x3a')]){this[_0x218d('0xd')][_0x218d('0x61')]+=0x1;this[_0x218d('0xb')][_0x5a7a89[_0x218d('0x20')]]['holdtime']=moment(this['channels'][_0x5a7a89[_0x218d('0x20')]][_0x218d('0x3a')])[_0x218d('0x5d')](this[_0x218d('0xb')][_0x5a7a89[_0x218d('0x20')]]['starttime'],_0x218d('0x62'));this[_0x218d('0xb')][_0x5a7a89['uniqueid']][_0x218d('0x63')]=moment(this[_0x218d('0xb')][_0x5a7a89[_0x218d('0x20')]][_0x218d('0x5c')])[_0x218d('0x5d')](this[_0x218d('0xb')][_0x5a7a89['uniqueid']]['answertime'],_0x218d('0x62'));this[_0x218d('0xd')][_0x218d('0x64')]+=this[_0x218d('0xb')][_0x5a7a89[_0x218d('0x20')]][_0x218d('0x65')]||0x0;this[_0x218d('0xd')][_0x218d('0x66')]+=this[_0x218d('0xb')][_0x5a7a89[_0x218d('0x20')]]['billableseconds'];}this[_0x218d('0xd')][_0x218d('0x67')]+=this[_0x218d('0xb')][_0x5a7a89[_0x218d('0x20')]][_0x218d('0x5b')];logger[_0x218d('0x1c')]('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0x5a7a89[_0x218d('0x20')],util[_0x218d('0x1e')](this[_0x218d('0xb')][_0x5a7a89[_0x218d('0x20')]],{'showHidden':![],'depth':null}));ami[_0x218d('0x1b')]('custom:voiceDialReport',this[_0x218d('0xb')][_0x5a7a89[_0x218d('0x20')]]);logger[_0x218d('0x1c')](_0x218d('0x68'),_0x5a7a89[_0x218d('0x20')],util[_0x218d('0x1e')](this[_0x218d('0xb')][_0x5a7a89[_0x218d('0x20')]],{'showHidden':![],'depth':null}));ami[_0x218d('0x1b')](_0x218d('0x69'),this[_0x218d('0xb')][_0x5a7a89[_0x218d('0x20')]]);logger[_0x218d('0x1c')](_0x218d('0x6a'),_0x5a7a89[_0x218d('0x20')],util[_0x218d('0x1e')](this[_0x218d('0xb')][_0x5a7a89[_0x218d('0x20')]],{'showHidden':![],'depth':null}));this[_0x218d('0x1b')](_0x218d('0x2f'),_0x218d('0x6b'),this[_0x218d('0xd')]);logger[_0x218d('0x2a')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON[_0x218d('0x6c')](this[_0x218d('0xb')][_0x5a7a89[_0x218d('0x20')]]));logger[_0x218d('0x1c')](_0x218d('0x6d'),_0x5a7a89[_0x218d('0x20')],util['inspect'](this[_0x218d('0xb')][_0x5a7a89['uniqueid']],{'showHidden':![],'depth':null}));this['emit']('voice:outbound',_0x218d('0x6e'),this['channels'][_0x5a7a89[_0x218d('0x20')]]);delete this['channels'][_0x5a7a89[_0x218d('0x20')]];}else if(this['channels'][_0x5a7a89[_0x218d('0x6f')]]){this['channels'][_0x5a7a89[_0x218d('0x6f')]][_0x218d('0x20')]=this[_0x218d('0xb')][_0x5a7a89['linkedid']][_0x218d('0x70')];}if(this[_0x218d('0xf')][_0x5a7a89[_0x218d('0x20')]]){delete this[_0x218d('0xf')][_0x5a7a89[_0x218d('0x20')]];}}}catch(_0x517b9c){logger[_0x218d('0x33')](_0x218d('0x71'),_0x5a7a89[_0x218d('0x20')],util[_0x218d('0x1e')](_0x517b9c,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x218d('0x18')][_0x218d('0x72')]=function(_0x18232b){try{if(this[_0x218d('0x19')](_0x18232b)){logger[_0x218d('0x1c')](_0x218d('0x73'),_0x18232b[_0x218d('0x20')],util[_0x218d('0x1e')](_0x18232b,{'showHidden':![],'depth':null}));if(_0x18232b[_0x218d('0x74')]['toLowerCase']()===_0x218d('0x75')){_0x18232b['applicationdata']=(_0x18232b[_0x218d('0x76')]||_0x18232b[_0x218d('0x77')])['toLowerCase']();if(_[_0x218d('0x78')](_0x18232b[_0x218d('0x77')],_0x218d('0x79'))){if(_[_0x218d('0x1a')](this['applications'][_0x18232b[_0x218d('0x20')]]))this[_0x218d('0xe')][_0x18232b['uniqueid']]={};logger[_0x218d('0x2a')](_0x218d('0x7a'),_0x18232b[_0x218d('0x20')],_0x18232b[_0x218d('0x74')],_0x18232b['applicationdata']);var _0xee6c58=_0x18232b[_0x218d('0x77')]['split']('=');var _0x161640=_0xee6c58[0x0][_0x218d('0x7b')](/cdr\((.*)\)/);if(_0x161640)this[_0x218d('0xe')][_0x18232b[_0x218d('0x20')]][_0x161640[0x1]]=_0xee6c58[0x1];}}}}catch(_0x5c70b0){logger[_0x218d('0x33')]('[%s][voiceDialReport][newexten]',_0x18232b['uniqueid'],util[_0x218d('0x1e')](_0x5c70b0,{'showHidden':![],'depth':null}));}};module[_0x218d('0x7c')]=VoiceDialReport; \ No newline at end of file +var _0xbdd0=['connectedlinenum','connectedlinename','lastevent','connect','info','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','error','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','value','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','outboundrouteid','variable','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberlastcall','memberpenalty','isNil','includes','syncHangup','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','diff','starttime','seconds','complete','total','answertime','answered','holdtime','billableseconds','sumHoldTime','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','voice_outbound_channel:remove','linkedid','[%s][voiceDialReport][hangup]','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','applicationdata','startsWith','cdr(','split','match','exports','lodash','moment','util','../../../config/environment','ami','../ami','redis','defaults','localhost','socket.io-emitter','outbound','applications','variables','syncDialBegin','dialend','syncDialEnd','varset','syncVarSet','bind','newexten','syncNewExten','prototype','isNotNull','isUndefined','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','channels','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','lastIndexOf','channel','substring','omit','privilege','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','inspect','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER'];(function(_0x44ae0b,_0x3e9865){var _0x69232a=function(_0x5ae588){while(--_0x5ae588){_0x44ae0b['push'](_0x44ae0b['shift']());}};_0x69232a(++_0x3e9865);}(_0xbdd0,0x134));var _0x0bdd=function(_0x17c1d5,_0x150c20){_0x17c1d5=_0x17c1d5-0x0;var _0x1c9e4c=_0xbdd0[_0x17c1d5];return _0x1c9e4c;};'use strict';var _=require(_0x0bdd('0x0'));var moment=require(_0x0bdd('0x1'));var util=require(_0x0bdd('0x2'));var Redis=require('ioredis');var config=require(_0x0bdd('0x3'));var logger=require('../../../config/logger')(_0x0bdd('0x4'));var ami=require(_0x0bdd('0x5'));config[_0x0bdd('0x6')]=_[_0x0bdd('0x7')](config[_0x0bdd('0x6')],{'host':_0x0bdd('0x8'),'port':0x18eb});var io=require(_0x0bdd('0x9'))(new Redis(config[_0x0bdd('0x6')]));function VoiceDialReport(_0x5a9510){this['channels']=_0x5a9510['outboundChannels'];this[_0x0bdd('0xa')]=_0x5a9510[_0x0bdd('0xa')];this[_0x0bdd('0xb')]={};this[_0x0bdd('0xc')]={};ami['on']('dialbegin',this[_0x0bdd('0xd')]['bind'](this));ami['on'](_0x0bdd('0xe'),this[_0x0bdd('0xf')]['bind'](this));ami['on'](_0x0bdd('0x10'),this[_0x0bdd('0x11')][_0x0bdd('0x12')](this));ami['on'](_0x0bdd('0x13'),this[_0x0bdd('0x14')][_0x0bdd('0x12')](this));ami['on']('hangup',this['syncHangup'][_0x0bdd('0x12')](this));}VoiceDialReport[_0x0bdd('0x15')][_0x0bdd('0x16')]=function(_0x346685){return _0x346685!==null&&!_[_0x0bdd('0x17')](_0x346685);};VoiceDialReport[_0x0bdd('0x15')]['emit']=function(_0x162459,_0x4d10da,_0x2dd67c){io['to'](_0x162459)[_0x0bdd('0x18')](_0x4d10da,_0x2dd67c);};VoiceDialReport[_0x0bdd('0x15')][_0x0bdd('0xd')]=function(_0x155ff8){try{if(this[_0x0bdd('0x16')](_0x155ff8)){logger[_0x0bdd('0x19')](_0x0bdd('0x1a'),_0x155ff8[_0x0bdd('0x1b')],util['inspect'](_0x155ff8,{'showHidden':![],'depth':null}));if(this[_0x0bdd('0x1c')][_0x155ff8[_0x0bdd('0x1b')]]){_[_0x0bdd('0x1d')](this[_0x0bdd('0x1c')][_0x155ff8[_0x0bdd('0x1b')]],{'starttime':moment()[_0x0bdd('0x1e')](_0x0bdd('0x1f')),'lastevent':_0x0bdd('0x20'),'interface':_0x155ff8['channel']['substring'](0x0,_0x155ff8['channel'][_0x0bdd('0x21')]('-')),'membername':_0x155ff8[_0x0bdd('0x22')][_0x0bdd('0x23')](_0x155ff8[_0x0bdd('0x22')][_0x0bdd('0x21')]('/')+0x1,_0x155ff8[_0x0bdd('0x22')]['lastIndexOf']('-'))},_[_0x0bdd('0x24')](_0x155ff8,['event',_0x0bdd('0x25')]));logger['info']('[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called',_0x155ff8[_0x0bdd('0x1b')],this[_0x0bdd('0x1c')][_0x155ff8[_0x0bdd('0x1b')]][_0x0bdd('0x26')],this['channels'][_0x155ff8[_0x0bdd('0x1b')]][_0x0bdd('0x27')]);logger[_0x0bdd('0x19')](_0x0bdd('0x28'),_0x155ff8['uniqueid'],util['inspect'](this[_0x0bdd('0x1c')][_0x155ff8[_0x0bdd('0x1b')]],{'showHidden':![],'depth':null}));if(this[_0x0bdd('0xb')][_0x155ff8[_0x0bdd('0x1b')]])_[_0x0bdd('0x1d')](this[_0x0bdd('0x1c')][_0x155ff8[_0x0bdd('0x1b')]],this[_0x0bdd('0xb')][_0x155ff8['uniqueid']]);this[_0x0bdd('0x18')](_0x0bdd('0x29'),_0x0bdd('0x2a'),this[_0x0bdd('0x1c')][_0x155ff8[_0x0bdd('0x1b')]]);logger[_0x0bdd('0x19')](_0x0bdd('0x2b'),_0x155ff8[_0x0bdd('0x1b')],util[_0x0bdd('0x2c')](this[_0x0bdd('0x1c')][_0x155ff8['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x0bdd('0x18')]('custom:dialbegin',this[_0x0bdd('0x1c')][_0x155ff8[_0x0bdd('0x1b')]]);}}}catch(_0x5b04a8){logger['error'](_0x0bdd('0x2d'),_0x155ff8['uniqueid'],util[_0x0bdd('0x2c')](_0x5b04a8,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x0bdd('0x15')][_0x0bdd('0xf')]=function(_0x58e7bf){try{if(this[_0x0bdd('0x16')](_0x58e7bf)){logger[_0x0bdd('0x19')](_0x0bdd('0x2e'),_0x58e7bf['uniqueid'],util[_0x0bdd('0x2c')](_0x58e7bf,{'showHidden':![],'depth':null}));if(this[_0x0bdd('0x1c')][_0x58e7bf[_0x0bdd('0x1b')]]){this['channels'][_0x58e7bf['uniqueid']][_0x0bdd('0x2f')]=_0x58e7bf[_0x0bdd('0x2f')];if(_0x58e7bf[_0x0bdd('0x2f')]===_0x0bdd('0x30')){this[_0x0bdd('0x1c')][_0x58e7bf[_0x0bdd('0x1b')]][_0x0bdd('0x31')]=_0x58e7bf[_0x0bdd('0x31')];this[_0x0bdd('0x1c')][_0x58e7bf[_0x0bdd('0x1b')]][_0x0bdd('0x32')]=_0x58e7bf[_0x0bdd('0x32')];this[_0x0bdd('0x1c')][_0x58e7bf[_0x0bdd('0x1b')]]['answertime']=moment()['format'](_0x0bdd('0x1f'));this[_0x0bdd('0x1c')][_0x58e7bf[_0x0bdd('0x1b')]][_0x0bdd('0x33')]=_0x0bdd('0x34');logger[_0x0bdd('0x35')](_0x0bdd('0x36'),_0x58e7bf['uniqueid'],_0x58e7bf['channel']['substring'](_0x58e7bf[_0x0bdd('0x22')]['lastIndexOf']('/')+0x1,_0x58e7bf['channel']['lastIndexOf']('-')));logger[_0x0bdd('0x19')]('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0x58e7bf['uniqueid'],util[_0x0bdd('0x2c')](this[_0x0bdd('0x1c')][_0x58e7bf[_0x0bdd('0x1b')]],{'showHidden':![],'depth':null}));ami[_0x0bdd('0x18')]('custom:dialconnect',this['channels'][_0x58e7bf['uniqueid']]);}logger[_0x0bdd('0x19')](_0x0bdd('0x37'),_0x58e7bf[_0x0bdd('0x1b')],util[_0x0bdd('0x2c')](this[_0x0bdd('0x1c')][_0x58e7bf[_0x0bdd('0x1b')]],{'showHidden':![],'depth':null}));this[_0x0bdd('0x18')](_0x0bdd('0x29'),_0x0bdd('0x2a'),this[_0x0bdd('0x1c')][_0x58e7bf[_0x0bdd('0x1b')]]);}}}catch(_0x1babbc){logger[_0x0bdd('0x38')](_0x0bdd('0x39'),_0x58e7bf[_0x0bdd('0x1b')],util[_0x0bdd('0x2c')](_0x1babbc,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x0bdd('0x15')][_0x0bdd('0x11')]=function(_0x5287c7){try{if(this['isNotNull'](_0x5287c7)){logger['debug'](_0x0bdd('0x3a'),_0x5287c7[_0x0bdd('0x1b')],util[_0x0bdd('0x2c')](_0x5287c7,{'showHidden':![],'depth':null}));this[_0x0bdd('0x3b')](_0x5287c7[_0x0bdd('0x1b')],_[_0x0bdd('0x3c')](_0x5287c7['variable'])[0x0],_0x5287c7[_0x0bdd('0x3d')]);if(this[_0x0bdd('0x16')](_0x5287c7['variable'])&&this['isNotNull'](_0x5287c7['variable']['outboundrouteid'])){if(_[_0x0bdd('0x17')](this[_0x0bdd('0x1c')][_0x5287c7[_0x0bdd('0x1b')]])){this['channels'][_0x5287c7[_0x0bdd('0x1b')]]={'routeId':_0x5287c7[_0x0bdd('0x3d')],'variables':this['variables'][_0x5287c7[_0x0bdd('0x1b')]]};logger[_0x0bdd('0x35')](_0x0bdd('0x3e'),_0x5287c7[_0x0bdd('0x1b')],_0x5287c7['variable'][_0x0bdd('0x3f')],_['keys'](_0x5287c7[_0x0bdd('0x40')])[0x0],_0x5287c7['value']);logger[_0x0bdd('0x19')](_0x0bdd('0x41'),_0x5287c7['uniqueid'],util[_0x0bdd('0x2c')](this[_0x0bdd('0x1c')][_0x5287c7[_0x0bdd('0x1b')]],{'showHidden':![],'depth':null}));this[_0x0bdd('0x18')](_0x0bdd('0x29'),'voice_outbound_channel:save',this[_0x0bdd('0x1c')][_0x5287c7[_0x0bdd('0x1b')]]);}}}}catch(_0x4784b6){logger[_0x0bdd('0x38')](_0x0bdd('0x42'),_0x5287c7['uniqueid'],util[_0x0bdd('0x2c')](_0x4784b6,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['addVariable']=function(_0x30becb,_0x4f3866,_0x17aeb2){var _0x31fffe=[_0x0bdd('0x43'),_0x0bdd('0x44'),_0x0bdd('0x45'),_0x0bdd('0x46'),_0x0bdd('0x47'),_0x0bdd('0x48'),_0x0bdd('0x49'),_0x0bdd('0x4a'),_0x0bdd('0x4b'),_0x0bdd('0x4c'),_0x0bdd('0x4d'),_0x0bdd('0x4e'),_0x0bdd('0x4f'),'memberdynamic','memberinterface',_0x0bdd('0x50'),_0x0bdd('0x26'),_0x0bdd('0x51'),'memberrealtime'];if(!_[_0x0bdd('0x52')](_0x4f3866)&&!_[_0x0bdd('0x53')](_0x31fffe,_0x4f3866)){if(_[_0x0bdd('0x17')](this[_0x0bdd('0xc')][_0x30becb])){this['variables'][_0x30becb]={};}this[_0x0bdd('0xc')][_0x30becb][_0x4f3866]=_0x17aeb2;}};VoiceDialReport[_0x0bdd('0x15')][_0x0bdd('0x54')]=function(_0x14e4b8){try{if(this[_0x0bdd('0x16')](_0x14e4b8)){logger[_0x0bdd('0x19')](_0x0bdd('0x55'),_0x14e4b8[_0x0bdd('0x1b')],util[_0x0bdd('0x2c')](_0x14e4b8,{'showHidden':![],'depth':null}));if(this[_0x0bdd('0x1c')][_0x14e4b8[_0x0bdd('0x1b')]]){logger[_0x0bdd('0x35')](_0x0bdd('0x56'),_0x14e4b8['uniqueid'],_0x14e4b8[_0x0bdd('0x57')]);this['channels'][_0x14e4b8['uniqueid']][_0x0bdd('0x58')]=moment()[_0x0bdd('0x1e')](_0x0bdd('0x1f'));this[_0x0bdd('0x1c')][_0x14e4b8[_0x0bdd('0x1b')]][_0x0bdd('0x59')]=moment(this['channels'][_0x14e4b8[_0x0bdd('0x1b')]][_0x0bdd('0x58')])[_0x0bdd('0x5a')](this[_0x0bdd('0x1c')][_0x14e4b8['uniqueid']][_0x0bdd('0x5b')],_0x0bdd('0x5c'));this['channels'][_0x14e4b8[_0x0bdd('0x1b')]][_0x0bdd('0x33')]=_0x0bdd('0x5d');this[_0x0bdd('0xa')][_0x0bdd('0x5e')]+=0x1;if(this['channels'][_0x14e4b8['uniqueid']][_0x0bdd('0x5f')]){this[_0x0bdd('0xa')][_0x0bdd('0x60')]+=0x1;this[_0x0bdd('0x1c')][_0x14e4b8['uniqueid']][_0x0bdd('0x61')]=moment(this[_0x0bdd('0x1c')][_0x14e4b8[_0x0bdd('0x1b')]][_0x0bdd('0x5f')])[_0x0bdd('0x5a')](this[_0x0bdd('0x1c')][_0x14e4b8['uniqueid']][_0x0bdd('0x5b')],_0x0bdd('0x5c'));this[_0x0bdd('0x1c')][_0x14e4b8['uniqueid']][_0x0bdd('0x62')]=moment(this['channels'][_0x14e4b8[_0x0bdd('0x1b')]][_0x0bdd('0x58')])[_0x0bdd('0x5a')](this[_0x0bdd('0x1c')][_0x14e4b8['uniqueid']][_0x0bdd('0x5f')],_0x0bdd('0x5c'));this[_0x0bdd('0xa')][_0x0bdd('0x63')]+=this[_0x0bdd('0x1c')][_0x14e4b8[_0x0bdd('0x1b')]][_0x0bdd('0x61')]||0x0;this['outbound'][_0x0bdd('0x64')]+=this[_0x0bdd('0x1c')][_0x14e4b8[_0x0bdd('0x1b')]][_0x0bdd('0x62')];}this[_0x0bdd('0xa')][_0x0bdd('0x65')]+=this[_0x0bdd('0x1c')][_0x14e4b8[_0x0bdd('0x1b')]]['duration'];logger[_0x0bdd('0x19')](_0x0bdd('0x66'),_0x14e4b8[_0x0bdd('0x1b')],util['inspect'](this[_0x0bdd('0x1c')][_0x14e4b8[_0x0bdd('0x1b')]],{'showHidden':![],'depth':null}));ami[_0x0bdd('0x18')]('custom:voiceDialReport',this[_0x0bdd('0x1c')][_0x14e4b8[_0x0bdd('0x1b')]]);logger[_0x0bdd('0x19')](_0x0bdd('0x67'),_0x14e4b8['uniqueid'],util['inspect'](this[_0x0bdd('0x1c')][_0x14e4b8['uniqueid']],{'showHidden':![],'depth':null}));ami['emit']('custom:dialend',this['channels'][_0x14e4b8[_0x0bdd('0x1b')]]);logger['debug']('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0x14e4b8[_0x0bdd('0x1b')],util[_0x0bdd('0x2c')](this['channels'][_0x14e4b8[_0x0bdd('0x1b')]],{'showHidden':![],'depth':null}));this[_0x0bdd('0x18')](_0x0bdd('0x29'),_0x0bdd('0x68'),this[_0x0bdd('0xa')]);logger[_0x0bdd('0x35')](_0x0bdd('0x69'),JSON[_0x0bdd('0x6a')](this[_0x0bdd('0x1c')][_0x14e4b8[_0x0bdd('0x1b')]]));logger[_0x0bdd('0x19')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:',_0x14e4b8[_0x0bdd('0x1b')],util[_0x0bdd('0x2c')](this['channels'][_0x14e4b8[_0x0bdd('0x1b')]],{'showHidden':![],'depth':null}));this['emit'](_0x0bdd('0x29'),_0x0bdd('0x6b'),this['channels'][_0x14e4b8[_0x0bdd('0x1b')]]);delete this['channels'][_0x14e4b8[_0x0bdd('0x1b')]];}else if(this[_0x0bdd('0x1c')][_0x14e4b8[_0x0bdd('0x6c')]]){this[_0x0bdd('0x1c')][_0x14e4b8[_0x0bdd('0x6c')]]['uniqueid']=this[_0x0bdd('0x1c')][_0x14e4b8['linkedid']]['destuniqueid'];}if(this[_0x0bdd('0xc')][_0x14e4b8['uniqueid']]){delete this[_0x0bdd('0xc')][_0x14e4b8[_0x0bdd('0x1b')]];}}}catch(_0x13d183){logger['error'](_0x0bdd('0x6d'),_0x14e4b8[_0x0bdd('0x1b')],util['inspect'](_0x13d183,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x0bdd('0x15')][_0x0bdd('0x14')]=function(_0xa5d6db){try{if(this['isNotNull'](_0xa5d6db)){logger[_0x0bdd('0x19')](_0x0bdd('0x6e'),_0xa5d6db[_0x0bdd('0x1b')],util[_0x0bdd('0x2c')](_0xa5d6db,{'showHidden':![],'depth':null}));if(_0xa5d6db[_0x0bdd('0x6f')][_0x0bdd('0x70')]()==='set'){_0xa5d6db['applicationdata']=(_0xa5d6db['appdata']||_0xa5d6db[_0x0bdd('0x71')])[_0x0bdd('0x70')]();if(_[_0x0bdd('0x72')](_0xa5d6db[_0x0bdd('0x71')],_0x0bdd('0x73'))){if(_[_0x0bdd('0x17')](this[_0x0bdd('0xb')][_0xa5d6db[_0x0bdd('0x1b')]]))this[_0x0bdd('0xb')][_0xa5d6db[_0x0bdd('0x1b')]]={};logger[_0x0bdd('0x35')]('[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s',_0xa5d6db[_0x0bdd('0x1b')],_0xa5d6db[_0x0bdd('0x6f')],_0xa5d6db['applicationdata']);var _0xbe7e92=_0xa5d6db['applicationdata'][_0x0bdd('0x74')]('=');var _0x27e7b4=_0xbe7e92[0x0][_0x0bdd('0x75')](/cdr\((.*)\)/);if(_0x27e7b4)this[_0x0bdd('0xb')][_0xa5d6db[_0x0bdd('0x1b')]][_0x27e7b4[0x1]]=_0xbe7e92[0x1];}}}}catch(_0x4543bb){logger['error']('[%s][voiceDialReport][newexten]',_0xa5d6db[_0x0bdd('0x1b')],util[_0x0bdd('0x2c')](_0x4543bb,{'showHidden':![],'depth':null}));}};module[_0x0bdd('0x76')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index e361bc8..e603141 100644 --- a/server/services/ami/report/voiceQueueReport.js +++ b/server/services/ami/report/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd9dc=['syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','waiting','queueStatusComplete','unlockRR','channels','switch','isNil','Action','channel','message','No\x20such\x20channel','inspect','[%s][voiceQueueReport][checkQueueReport]','error','[%s][voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearqueuereport','emit','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','format','voice:queue:%s','name','voice_queue_channel:save','voice_queue_presence:save','emitVoiceQueueChannelRemove',']\x20sending\x20voice_queue_channel:remove\x20event:','uniqueid','voice_queue_channel:remove','voice_queue_presence:remove','type','inbound','strategy','pTalking','sumBillable','sumHoldTime','talking','total','unmanaged','abandoned','Trunk','active','callerid','Interval','stringify','md5','[voiceQueueReport][',']\x20sending\x20voice_queue:save\x20event:','voice_queue:save','isNotNull','clearZombieChannels','queues','catch','[voiceQueueReport][queues]','flagQueueSummary','then','queue','[voiceQueueReport][queuesummary]\x20name:%s','countBy','toNumber','callers','loggedIn','available','loggedin','emitVoiceQueueSummary','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','[voiceQueueReport][queuesummarycomplete]\x20event:','[%s][voiceQueueReport][queuecallerjoin]','isUndefined','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','routealias','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','merge','pick','keys','push','emitVoiceQueueChannelSave','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercomplete','holdtime','originalposition','queuecallerabandon','queuecallerabandonAt','queuecallerexitreason','ABANDONED','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','info','[%s][voiceQueueReport][agentconnect]','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','assigned','membername','queuecallerexit','queuecallerexitAt','transfer','reason','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','local/','linkedid','add','seconds','FORWARDTRANSFER','transfertype','transferexten','transferuniqueid','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][agentcomplete]','addVariable','variable','value','queuestatus','CONTINUE','TIMEOUT','lastevent','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','queueposition','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','[%s][voiceQueueReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberlastcall','memberpenalty','memberrealtime','includes','syncHangup','[%s][voiceQueueReport][hangup]','length','diff','sumDuration','answered','queuecallercompleteAt','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','cause-txt','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfereruniqueid','ATTENDEDTRANSFER','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','ATTENDED','[%s][voiceQueueReport][blindtransfer]','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','context','transfererchannel','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstop]','milliseconds','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','mohtime','application','toLowerCase','set','appdata','startsWith','CDR(routeAlias)','applicationdata','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','match','moment','util','ioredis','../../../config/environment','../../../config/logger','../ami','../model/queueReport','redis','defaults','socket.io-emitter','prototype','enqueue','tail','finally','sequence','queueReports','agents','queueChannels','voiceQueues','campaigns','variables','syncQueueSummary','queuesummarycomplete','syncQueueSummaryComplete','bind','syncQueueCallerJoin','syncQueueCallerAbandon','queuecallerleave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','varset','syncVarSet','hangup','fullybooted','syncFullyBooted','newexten','syncNewExten','musiconholdstart'];(function(_0x39130f,_0x29bf37){var _0x31d6e7=function(_0x520af7){while(--_0x520af7){_0x39130f['push'](_0x39130f['shift']());}};_0x31d6e7(++_0x29bf37);}(_0xd9dc,0x1be));var _0xcd9d=function(_0x267fea,_0x465cdf){_0x267fea=_0x267fea-0x0;var _0x25c4b4=_0xd9dc[_0x267fea];return _0x25c4b4;};'use strict';var _=require('lodash');var moment=require(_0xcd9d('0x0'));var util=require(_0xcd9d('0x1'));var md5=require('md5');var Redis=require(_0xcd9d('0x2'));var config=require(_0xcd9d('0x3'));var logger=require(_0xcd9d('0x4'))('ami');var ami=require(_0xcd9d('0x5'));var QueueReport=require(_0xcd9d('0x6'));config[_0xcd9d('0x7')]=_[_0xcd9d('0x8')](config[_0xcd9d('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xcd9d('0x9'))(new Redis(config[_0xcd9d('0x7')]));var Sequence=function(){};Sequence[_0xcd9d('0xa')][_0xcd9d('0xb')]=function(_0x45130c){this['tail']=this[_0xcd9d('0xc')]?this[_0xcd9d('0xc')][_0xcd9d('0xd')](_0x45130c):_0x45130c();};function VoiceQueueReport(_0x112c01){this[_0xcd9d('0xe')]=new Sequence();this[_0xcd9d('0xf')]={};this[_0xcd9d('0x10')]=_0x112c01[_0xcd9d('0x10')];this['channels']=_0x112c01[_0xcd9d('0x11')];this['voiceQueues']=_0x112c01[_0xcd9d('0x12')];this['flagQueueSummary']=!![];this[_0xcd9d('0x13')]=_0x112c01[_0xcd9d('0x13')];this[_0xcd9d('0x14')]={};ami['on']('queuesummary',this[_0xcd9d('0x15')]['bind'](this));ami['on'](_0xcd9d('0x16'),this[_0xcd9d('0x17')][_0xcd9d('0x18')](this));ami['on']('queuecallerjoin',this[_0xcd9d('0x19')][_0xcd9d('0x18')](this));ami['on']('queuecallerabandon',this[_0xcd9d('0x1a')]['bind'](this));ami['on'](_0xcd9d('0x1b'),this['syncQueueCallerLeave'][_0xcd9d('0x18')](this));ami['on'](_0xcd9d('0x1c'),this[_0xcd9d('0x1d')][_0xcd9d('0x18')](this));ami['on'](_0xcd9d('0x1e'),this[_0xcd9d('0x1f')][_0xcd9d('0x18')](this));ami['on'](_0xcd9d('0x20'),this[_0xcd9d('0x21')][_0xcd9d('0x18')](this));ami['on'](_0xcd9d('0x22'),this['syncHangup'][_0xcd9d('0x18')](this));ami['on'](_0xcd9d('0x23'),this[_0xcd9d('0x24')]['bind'](this));ami['on'](_0xcd9d('0x25'),this[_0xcd9d('0x26')][_0xcd9d('0x18')](this));ami['on'](_0xcd9d('0x27'),this[_0xcd9d('0x28')][_0xcd9d('0x18')](this));ami['on'](_0xcd9d('0x29'),this[_0xcd9d('0x2a')]['bind'](this));ami['on']('attendedtransfer',this[_0xcd9d('0x2b')][_0xcd9d('0x18')](this));ami['on'](_0xcd9d('0x2c'),this[_0xcd9d('0x2d')]['bind'](this));this[_0xcd9d('0x2e')]();this[_0xcd9d('0x2f')]();}function clearChannels(_0x1cf4f2){if(!_[_0xcd9d('0x30')](_0x1cf4f2)){for(var _0x32686a in _0x1cf4f2){if(_0x1cf4f2[_0xcd9d('0x31')](_0x32686a)){delete _0x1cf4f2[_0x32686a];}}}}function clearCampaigns(_0x33aca7){if(!_[_0xcd9d('0x30')](_0x33aca7)){for(var _0xf21e2 in _0x33aca7){if(_0x33aca7[_0xcd9d('0x31')](_0xf21e2)){_0x33aca7[_0xf21e2][_0xcd9d('0x32')]=0x0;}}}}function clearVoiceQueues(_0x3b1abd){if(!_[_0xcd9d('0x30')](_0x3b1abd)){for(var _0x5ad994 in _0x3b1abd){if(_0x3b1abd[_0xcd9d('0x31')](_0x5ad994)){_0x3b1abd[_0x5ad994][_0xcd9d('0x32')]=0x0;_0x3b1abd[_0x5ad994]['talking']=0x0;_0x3b1abd[_0x5ad994]['pTalking']=0x0;_0x3b1abd[_0x5ad994][_0xcd9d('0x33')]=0x0;_0x3b1abd[_0x5ad994][_0xcd9d('0x34')]=!![];}}}}function clearAgentBooked(_0x5b1fd6){if(!_[_0xcd9d('0x30')](_0x5b1fd6)){for(var _0x2d3347 in _0x5b1fd6){if(_0x5b1fd6[_0xcd9d('0x31')](_0x2d3347)){_0x5b1fd6[_0x2d3347][_0xcd9d('0x35')]=!![];}}}}VoiceQueueReport[_0xcd9d('0xa')]['clearZombieChannels']=function(){var _0x4bd53d=this;for(var _0x2931df in this[_0xcd9d('0x36')]){if(this['channels'][_0xcd9d('0x31')](_0x2931df)&&!this[_0xcd9d('0x36')][_0x2931df][_0xcd9d('0x37')]){this['sequence'][_0xcd9d('0xb')](function(){if(!_[_0xcd9d('0x38')](_0x4bd53d[_0xcd9d('0x36')][_0x2931df])){return ami[_0xcd9d('0x39')]({'action':'status','channel':_0x4bd53d['channels'][_0x2931df][_0xcd9d('0x3a')]})['catch'](function(_0x5a0c5f){if(_0x5a0c5f[_0xcd9d('0x3b')]===_0xcd9d('0x3c')){setTimeout(function(){if(_0x4bd53d[_0xcd9d('0x36')][_0x2931df]){delete _0x4bd53d[_0xcd9d('0x36')][_0x2931df];logger['error']('[%s][voiceQueueReport][checkChannel]',_0x2931df,util[_0xcd9d('0x3d')](_0x5a0c5f,{'showHidden':![],'depth':null}));}if(_0x4bd53d[_0xcd9d('0xf')][_0x2931df]){delete _0x4bd53d[_0xcd9d('0xf')][_0x2931df];logger['error'](_0xcd9d('0x3e'),_0x2931df,util[_0xcd9d('0x3d')](_0x5a0c5f,{'showHidden':![],'depth':null}));}if(_0x4bd53d[_0xcd9d('0x14')][_0x2931df]){delete _0x4bd53d[_0xcd9d('0x14')][_0x2931df];logger[_0xcd9d('0x3f')](_0xcd9d('0x40'),_0x2931df,util[_0xcd9d('0x3d')](_0x5a0c5f,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0xcd9d('0xa')][_0xcd9d('0x24')]=function(){logger[_0xcd9d('0x3f')](_0xcd9d('0x41'));clearChannels(this[_0xcd9d('0x36')]);this['clearQueueReport'](this[_0xcd9d('0xf')]);clearAgentBooked(this[_0xcd9d('0x10')]);clearVoiceQueues(this['voiceQueues']);clearCampaigns(this['campaigns']);};VoiceQueueReport[_0xcd9d('0xa')]['clearQueueReport']=function(_0x4dadc5){var _0x31c5ea=this;if(!_[_0xcd9d('0x30')](_0x4dadc5)){for(var _0x39a654 in _0x4dadc5){if(_0x4dadc5[_0xcd9d('0x31')](_0x39a654)){_0x31c5ea['emitVoiceQueueChannelRemove'](_0x4dadc5[_0x39a654],_0xcd9d('0x42'));delete _0x4dadc5[_0x39a654];}}}};VoiceQueueReport[_0xcd9d('0xa')]['emit']=function(_0x22024e,_0x1cf236,_0x1d7c7a){io['to'](_0x22024e)[_0xcd9d('0x43')](_0x1cf236,_0x1d7c7a);};VoiceQueueReport['prototype']['emitVoiceQueueChannelSave']=function(_0x308488,_0x4ca724){logger[_0xcd9d('0x44')](_0xcd9d('0x45')+_0x4ca724+_0xcd9d('0x46'),_0x308488['uniqueid'],util[_0xcd9d('0x3d')](_0x308488,{'showHidden':![],'depth':null}));this[_0xcd9d('0x43')](util[_0xcd9d('0x47')](_0xcd9d('0x48'),_0x308488[_0xcd9d('0x49')]),_0xcd9d('0x4a'),_0x308488);io[_0xcd9d('0x43')](_0xcd9d('0x4b'),_0x308488);};VoiceQueueReport[_0xcd9d('0xa')][_0xcd9d('0x4c')]=function(_0x3b5573,_0x5e8223){logger['debug']('[%s][voiceQueueReport]['+_0x5e8223+_0xcd9d('0x4d'),_0x3b5573[_0xcd9d('0x4e')],util[_0xcd9d('0x3d')](_0x3b5573,{'showHidden':![],'depth':null}));this['emit'](util[_0xcd9d('0x47')](_0xcd9d('0x48'),_0x3b5573['name']),_0xcd9d('0x4f'),_0x3b5573);io['emit'](_0xcd9d('0x50'),_0x3b5573);};VoiceQueueReport[_0xcd9d('0xa')]['emitVoiceQueueSummary']=function(_0x5224c1,_0x133011){if(_0x5224c1[_0xcd9d('0x51')]===_0xcd9d('0x52')){var _0x2d6370={'id':_0x5224c1['id'],'name':_0x5224c1[_0xcd9d('0x49')],'strategy':_0x5224c1[_0xcd9d('0x53')],'answered':_0x5224c1['answered'],'available':_0x5224c1['available'],'loggedIn':_0x5224c1['loggedIn'],'pTalking':_0x5224c1[_0xcd9d('0x54')],'sumBillable':_0x5224c1[_0xcd9d('0x55')],'sumDuration':_0x5224c1['sumDuration'],'sumHoldTime':_0x5224c1[_0xcd9d('0x56')]||0x0,'talking':_0x5224c1[_0xcd9d('0x57')],'total':_0x5224c1[_0xcd9d('0x58')],'type':_0x5224c1[_0xcd9d('0x51')],'unmanaged':_0x5224c1[_0xcd9d('0x59')],'abandoned':_0x5224c1[_0xcd9d('0x5a')],'waiting':_0x5224c1[_0xcd9d('0x33')]};if(_0x5224c1[_0xcd9d('0x5b')]){_0x2d6370[_0xcd9d('0x5b')]={'id':_0x5224c1[_0xcd9d('0x5b')]['id'],'name':_0x5224c1['Trunk'][_0xcd9d('0x49')],'active':_0x5224c1[_0xcd9d('0x5b')][_0xcd9d('0x5c')],'callerid':_0x5224c1[_0xcd9d('0x5b')][_0xcd9d('0x5d')]};}if(_0x5224c1[_0xcd9d('0x5e')]){_0x2d6370[_0xcd9d('0x5e')]={'id':_0x5224c1[_0xcd9d('0x5e')]['id'],'name':_0x5224c1['Interval'][_0xcd9d('0x49')]};}var _0x308c01=md5(JSON[_0xcd9d('0x5f')](_0x2d6370));if(_0x5224c1['md5']!==_0x308c01){_0x5224c1[_0xcd9d('0x60')]=_0x308c01;logger[_0xcd9d('0x44')](_0xcd9d('0x61')+_0x133011+_0xcd9d('0x62'),util[_0xcd9d('0x3d')](_0x2d6370,{'showHidden':![],'depth':null}));this[_0xcd9d('0x43')](util[_0xcd9d('0x47')](_0xcd9d('0x48'),_0x2d6370['name']),_0xcd9d('0x63'),_0x2d6370);}}};VoiceQueueReport[_0xcd9d('0xa')][_0xcd9d('0x64')]=function(_0x4fd1da){return _0x4fd1da!==null&&!_['isUndefined'](_0x4fd1da);};VoiceQueueReport[_0xcd9d('0xa')][_0xcd9d('0x2f')]=function(){var _0x26b475=this;setInterval(function(){_0x26b475[_0xcd9d('0x65')]();ami['Action']({'action':_0xcd9d('0x66')})[_0xcd9d('0x67')](function(_0x1bf893){logger[_0xcd9d('0x3f')](_0xcd9d('0x68'),util['inspect'](_0x1bf893,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0xcd9d('0xa')][_0xcd9d('0x2e')]=function(){var _0x59fe77=this;setInterval(function(){if(_0x59fe77[_0xcd9d('0x69')]){return ami[_0xcd9d('0x39')]({'action':'queuesummary'})[_0xcd9d('0x6a')](function(_0x1085f5){_0x59fe77[_0xcd9d('0x69')]=![];})[_0xcd9d('0x67')](function(_0x306376){logger[_0xcd9d('0x3f')]('[voiceQueueReport][queuesummary]',util['inspect'](_0x306376,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport['prototype'][_0xcd9d('0x15')]=function(_0x372bce){try{if(this[_0xcd9d('0x64')](_0x372bce)&&this['isNotNull'](_0x372bce[_0xcd9d('0x6b')])){logger[_0xcd9d('0x44')]('[voiceQueueReport][queuesummary]\x20event:',util[_0xcd9d('0x3d')](_0x372bce,{'showHidden':![],'depth':null}));if(this[_0xcd9d('0x12')][_0x372bce[_0xcd9d('0x6b')]]){logger['info'](_0xcd9d('0x6c'),_0x372bce[_0xcd9d('0x6b')]);var _0x5d1150=_[_0xcd9d('0x6d')](this['channels'],_0xcd9d('0x6b'))[_0x372bce[_0xcd9d('0x6b')]]||0x0;var _0x1e350c=_0x5d1150-_0x372bce['callers'];if(this[_0xcd9d('0x12')][_0x372bce[_0xcd9d('0x6b')]][_0xcd9d('0x33')]!==_[_0xcd9d('0x6e')](_0x372bce[_0xcd9d('0x6f')])||this[_0xcd9d('0x12')][_0x372bce[_0xcd9d('0x6b')]][_0xcd9d('0x70')]!==_[_0xcd9d('0x6e')](_0x372bce['loggedin'])||this[_0xcd9d('0x12')][_0x372bce[_0xcd9d('0x6b')]][_0xcd9d('0x71')]!==_['toNumber'](_0x372bce[_0xcd9d('0x71')])||this[_0xcd9d('0x12')][_0x372bce[_0xcd9d('0x6b')]][_0xcd9d('0x57')]!==_0x1e350c){this[_0xcd9d('0x12')][_0x372bce[_0xcd9d('0x6b')]]['waiting']=_['toNumber'](_0x372bce[_0xcd9d('0x6f')]);this[_0xcd9d('0x12')][_0x372bce[_0xcd9d('0x6b')]][_0xcd9d('0x70')]=_[_0xcd9d('0x6e')](_0x372bce['loggedin']);this[_0xcd9d('0x12')][_0x372bce['queue']][_0xcd9d('0x71')]=_['toNumber'](_0x372bce[_0xcd9d('0x71')]);this['voiceQueues'][_0x372bce[_0xcd9d('0x6b')]][_0xcd9d('0x57')]=_0x1e350c>0x0?_0x1e350c:0x0;this['voiceQueues'][_0x372bce[_0xcd9d('0x6b')]]['talking']=this[_0xcd9d('0x12')][_0x372bce[_0xcd9d('0x6b')]]['talking']>_[_0xcd9d('0x6e')](_0x372bce[_0xcd9d('0x72')])?_[_0xcd9d('0x6e')](_0x372bce['loggedin']):this[_0xcd9d('0x12')][_0x372bce['queue']]['talking'];this[_0xcd9d('0x73')](this[_0xcd9d('0x12')][_0x372bce[_0xcd9d('0x6b')]],'queuesummary');}logger[_0xcd9d('0x44')](_0xcd9d('0x74'),util[_0xcd9d('0x3d')](this[_0xcd9d('0x12')][_0x372bce[_0xcd9d('0x6b')]],{'showHidden':![],'depth':null}));ami[_0xcd9d('0x43')]('custom:queuesummary',this[_0xcd9d('0x12')][_0x372bce[_0xcd9d('0x6b')]]);}}}catch(_0x52933d){logger[_0xcd9d('0x3f')]('[voiceQueueReport][queuesummary]',util[_0xcd9d('0x3d')](_0x52933d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xcd9d('0xa')][_0xcd9d('0x17')]=function(_0x26ecba){logger[_0xcd9d('0x44')](_0xcd9d('0x75'),util[_0xcd9d('0x3d')](_0x26ecba,{'showHidden':![],'depth':null}));this[_0xcd9d('0x69')]=!![];};VoiceQueueReport[_0xcd9d('0xa')]['syncQueueCallerJoin']=function(_0x25f758){try{if(this['isNotNull'](_0x25f758)){logger[_0xcd9d('0x44')](_0xcd9d('0x76'),_0x25f758[_0xcd9d('0x4e')],util[_0xcd9d('0x3d')](_0x25f758,{'showHidden':![],'depth':null}));if(_[_0xcd9d('0x77')](this['queueReports'][_0x25f758[_0xcd9d('0x4e')]]))this[_0xcd9d('0xf')][_0x25f758[_0xcd9d('0x4e')]]=[];if(_[_0xcd9d('0x77')](this[_0xcd9d('0x36')][_0x25f758['uniqueid']]))this['channels'][_0x25f758[_0xcd9d('0x4e')]]={};var _0x47da2b=new QueueReport();_0x47da2b[_0xcd9d('0x49')]=_0x25f758[_0xcd9d('0x6b')];_0x47da2b['type']=this[_0xcd9d('0x12')][_0x47da2b[_0xcd9d('0x49')]]&&this[_0xcd9d('0x12')][_0x47da2b[_0xcd9d('0x49')]]['type']?this[_0xcd9d('0x12')][_0x47da2b['name']]['type']||'inbound':_0xcd9d('0x52');_0x47da2b['queue']=_0x25f758[_0xcd9d('0x6b')];_0x47da2b[_0xcd9d('0x78')]=moment()[_0xcd9d('0x47')](_0xcd9d('0x79'));_0x47da2b[_0xcd9d('0x7a')]=_0x25f758[_0xcd9d('0x7a')];_0x47da2b['count']=_0x25f758[_0xcd9d('0x7b')];_0x47da2b[_0xcd9d('0x4e')]=_0x25f758[_0xcd9d('0x4e')];_0x47da2b['routealias']=this[_0xcd9d('0x36')][_0x25f758[_0xcd9d('0x4e')]][_0xcd9d('0x7c')];logger['info'](_0xcd9d('0x7d'),_0x47da2b['name'],_0x47da2b[_0xcd9d('0x51')]);_[_0xcd9d('0x7e')](_0x47da2b,_[_0xcd9d('0x7f')](_0x25f758,_[_0xcd9d('0x80')](_0x47da2b)));this[_0xcd9d('0xf')][_0x25f758[_0xcd9d('0x4e')]][_0xcd9d('0x81')](_0x47da2b);this[_0xcd9d('0x36')][_0x25f758[_0xcd9d('0x4e')]]=_0x47da2b;this[_0xcd9d('0x82')](_0x47da2b,'queuecallerjoin');}}catch(_0x4b2edc){logger[_0xcd9d('0x3f')](_0xcd9d('0x76'),_0x25f758[_0xcd9d('0x4e')],util[_0xcd9d('0x3d')](_0x4b2edc,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerAbandon']=function(_0x4f6261){try{if(this[_0xcd9d('0x64')](_0x4f6261)){logger['debug'](_0xcd9d('0x83'),_0x4f6261[_0xcd9d('0x4e')],util[_0xcd9d('0x3d')](_0x4f6261,{'showHidden':![],'depth':null}));if(this[_0xcd9d('0xf')][_0x4f6261[_0xcd9d('0x4e')]]){var _0x413a95=_[_0xcd9d('0x84')](this[_0xcd9d('0xf')][_0x4f6261[_0xcd9d('0x4e')]]);_0x413a95[_0xcd9d('0x85')]=![];_0x413a95['queuecallercompleteAt']=null;_0x413a95[_0xcd9d('0x86')]=_0x4f6261[_0xcd9d('0x86')];_0x413a95[_0xcd9d('0x87')]=_0x4f6261[_0xcd9d('0x87')];_0x413a95[_0xcd9d('0x88')]=!![];_0x413a95[_0xcd9d('0x89')]=moment()[_0xcd9d('0x47')](_0xcd9d('0x79'));_0x413a95[_0xcd9d('0x8a')]=_0xcd9d('0x8b');_0x413a95[_0xcd9d('0x8c')]=null;logger['info'](_0xcd9d('0x8d'),_0x413a95[_0xcd9d('0x49')],_0x413a95[_0xcd9d('0x51')]);this[_0xcd9d('0x36')][_0x4f6261[_0xcd9d('0x4e')]]=_0x413a95;this[_0xcd9d('0x4c')](_0x413a95,'queuecallerabandon');}}}catch(_0x3736e0){logger[_0xcd9d('0x3f')](_0xcd9d('0x83'),_0x4f6261['uniqueid'],util[_0xcd9d('0x3d')](_0x3736e0,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerLeave']=function(_0x3a5b3f){try{if(this['isNotNull'](_0x3a5b3f)){logger[_0xcd9d('0x44')](_0xcd9d('0x8e'),_0x3a5b3f[_0xcd9d('0x4e')],util['inspect'](_0x3a5b3f,{'showHidden':![],'depth':null}));if(this[_0xcd9d('0xf')][_0x3a5b3f[_0xcd9d('0x4e')]]){var _0x5c609d=_[_0xcd9d('0x84')](this['queueReports'][_0x3a5b3f[_0xcd9d('0x4e')]]);_0x5c609d[_0xcd9d('0x8f')]=moment()['format'](_0xcd9d('0x79'));_0x5c609d[_0xcd9d('0x90')]=_0x3a5b3f['connectedlinenum'];_0x5c609d[_0xcd9d('0x91')]=_0x3a5b3f[_0xcd9d('0x91')];logger[_0xcd9d('0x92')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x5c609d[_0xcd9d('0x49')],_0x5c609d[_0xcd9d('0x51')],_0x3a5b3f['connectedlinenum'],_0x3a5b3f['connectedlinename']);this[_0xcd9d('0x36')][_0x3a5b3f[_0xcd9d('0x4e')]]=_0x5c609d;this['emitVoiceQueueChannelSave'](_0x5c609d,_0xcd9d('0x1b'));}}}catch(_0x308c79){logger[_0xcd9d('0x3f')](_0xcd9d('0x8e'),_0x3a5b3f[_0xcd9d('0x4e')],util[_0xcd9d('0x3d')](_0x308c79,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xcd9d('0x1f')]=function(_0x122a99){try{if(this[_0xcd9d('0x64')](_0x122a99)){logger[_0xcd9d('0x44')](_0xcd9d('0x93'),_0x122a99[_0xcd9d('0x4e')],util[_0xcd9d('0x3d')](_0x122a99,{'showHidden':![],'depth':null}));if(this[_0xcd9d('0xf')][_0x122a99['uniqueid']]){var _0x392000=_[_0xcd9d('0x84')](this[_0xcd9d('0xf')][_0x122a99[_0xcd9d('0x4e')]]);_0x392000[_0xcd9d('0x85')]=!![];_0x392000[_0xcd9d('0x8a')]=_0xcd9d('0x94');logger['info'](_0xcd9d('0x95'),_0x392000[_0xcd9d('0x49')],_0x392000[_0xcd9d('0x51')]);}}}catch(_0x14547f){logger[_0xcd9d('0x3f')](_0xcd9d('0x93'),_0x122a99[_0xcd9d('0x4e')],util[_0xcd9d('0x3d')](_0x14547f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xcd9d('0xa')][_0xcd9d('0x1d')]=function(_0xd87689){try{if(this[_0xcd9d('0x64')](_0xd87689)){logger[_0xcd9d('0x44')]('[%s][voiceQueueReport][agentcomplete]',_0xd87689[_0xcd9d('0x4e')],util[_0xcd9d('0x3d')](_0xd87689,{'showHidden':![],'depth':null}));if(this[_0xcd9d('0xf')][_0xd87689[_0xcd9d('0x4e')]]){var _0x23cd69=_['last'](this[_0xcd9d('0xf')][_0xd87689['uniqueid']]);_0x23cd69['queuecallerabandon']=![];_0x23cd69[_0xcd9d('0x89')]=null;_0x23cd69[_0xcd9d('0x96')]=!![];_0x23cd69[_0xcd9d('0x8c')]=_0xd87689[_0xcd9d('0x97')];_0x23cd69['holdtime']=_0xd87689[_0xcd9d('0x86')];_0x23cd69['queuecallercomplete']=!![];_0x23cd69[_0xcd9d('0x98')]=![];_0x23cd69[_0xcd9d('0x99')]=null;if(!_0x23cd69[_0xcd9d('0x9a')]){if(_0xd87689[_0xcd9d('0x9b')]=='transfer'){_0x23cd69[_0xcd9d('0x8a')]=_0xcd9d('0x9c');logger[_0xcd9d('0x92')](_0xcd9d('0x9d'),_0x23cd69[_0xcd9d('0x49')],_0x23cd69[_0xcd9d('0x51')]);}else{if(_['startsWith'](_0xd87689['channel']['toLowerCase'](),_0xcd9d('0x9e'))){if(this[_0xcd9d('0xf')][_0xd87689[_0xcd9d('0x9f')]]){var _0x4043dd=_[_0xcd9d('0x84')](this[_0xcd9d('0xf')][_0xd87689[_0xcd9d('0x9f')]]);_0x4043dd[_0xcd9d('0x85')]=![];_0x4043dd['queuecallerexit']=!![];_0x4043dd['queuecallerexitAt']=moment(_0x23cd69[_0xcd9d('0x78')])[_0xcd9d('0xa0')](_0xd87689[_0xcd9d('0x86')],_0xcd9d('0xa1'))[_0xcd9d('0x47')](_0xcd9d('0x79'));_0x4043dd['queuecallerexitreason']=_0xcd9d('0xa2');_0x4043dd[_0xcd9d('0x9a')]=!![];_0x4043dd[_0xcd9d('0xa3')]='FORWARD';_0x4043dd[_0xcd9d('0xa4')]=_0xd87689['destexten'];_0x4043dd[_0xcd9d('0xa5')]=_0xd87689[_0xcd9d('0x4e')];logger[_0xcd9d('0x92')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x4043dd[_0xcd9d('0x49')],_0x4043dd['type']);var _0x3da65a=this[_0xcd9d('0xf')][_0xd87689[_0xcd9d('0x9f')]];this[_0xcd9d('0xf')][_0xd87689[_0xcd9d('0x9f')]]=this['queueReports'][_0xd87689[_0xcd9d('0x4e')]];this[_0xcd9d('0xf')][_0xd87689[_0xcd9d('0x4e')]]=_0x3da65a;}}else{_0x23cd69[_0xcd9d('0x8a')]=_0xcd9d('0xa6')+_0xd87689['reason'][_0xcd9d('0xa7')]();logger[_0xcd9d('0x92')](_0xcd9d('0xa8'),_0x23cd69[_0xcd9d('0x49')],_0x23cd69[_0xcd9d('0x51')],_0x23cd69[_0xcd9d('0x8a')]);}}}this[_0xcd9d('0x36')][_0xd87689[_0xcd9d('0x4e')]]=_0x23cd69;this[_0xcd9d('0x4c')](_0x23cd69,'agentcomplete');}}}catch(_0x434b0){logger[_0xcd9d('0x3f')](_0xcd9d('0xa9'),_0xd87689[_0xcd9d('0x4e')],util[_0xcd9d('0x3d')](_0x434b0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xcd9d('0xa')][_0xcd9d('0x21')]=function(_0x252d11){try{if(this[_0xcd9d('0x64')](_0x252d11)){logger[_0xcd9d('0x44')]('[%s][voiceQueueReport][varset]',_0x252d11[_0xcd9d('0x4e')],util['inspect'](_0x252d11,{'showHidden':![],'depth':null}));this[_0xcd9d('0xaa')](_0x252d11[_0xcd9d('0x4e')],_[_0xcd9d('0x80')](_0x252d11[_0xcd9d('0xab')])[0x0],_0x252d11[_0xcd9d('0xac')]);if(this[_0xcd9d('0xf')][_0x252d11[_0xcd9d('0x4e')]]){var _0x29f8e1=_[_0xcd9d('0x84')](this[_0xcd9d('0xf')][_0x252d11['uniqueid']]);if(_0x29f8e1){if(this[_0xcd9d('0x64')](_0x252d11[_0xcd9d('0xab')])&&this[_0xcd9d('0x64')](_0x252d11[_0xcd9d('0xab')][_0xcd9d('0xad')])){switch(_0x252d11[_0xcd9d('0xac')]){case _0xcd9d('0xae'):_0x29f8e1[_0xcd9d('0x98')]=![];_0x29f8e1[_0xcd9d('0x99')]=null;break;case _0xcd9d('0xaf'):_0x29f8e1[_0xcd9d('0xb0')]=_0xcd9d('0xb1');_0x29f8e1['queuecallerexit']=!![];_0x29f8e1[_0xcd9d('0x99')]=moment()[_0xcd9d('0x47')](_0xcd9d('0x79'));_0x29f8e1[_0xcd9d('0x8f')]=moment()[_0xcd9d('0x47')]('YYYY-MM-DD\x20HH:mm:ss');logger['debug'](_0xcd9d('0xb2'),_0x252d11[_0xcd9d('0x4e')],util['inspect'](_0x29f8e1,{'showHidden':![],'depth':null}));ami['emit'](_0xcd9d('0xb3'),_0x29f8e1);break;default:_0x29f8e1[_0xcd9d('0x98')]=!![];_0x29f8e1['queuecallerexitAt']=moment()[_0xcd9d('0x47')](_0xcd9d('0x79'));_0x29f8e1[_0xcd9d('0x8f')]=moment()[_0xcd9d('0x47')](_0xcd9d('0x79'));}_0x29f8e1['queuecallerabandon']=![];_0x29f8e1[_0xcd9d('0x89')]=null;_0x29f8e1[_0xcd9d('0x8a')]=_0x252d11['value'];this[_0xcd9d('0x36')][_0x252d11[_0xcd9d('0x4e')]]=_0x29f8e1;this['emitVoiceQueueChannelRemove'](_0x29f8e1,_0xcd9d('0x20'));}else if(this[_0xcd9d('0x64')](_0x252d11[_0xcd9d('0xab')])&&this[_0xcd9d('0x64')](_0x252d11['variable'][_0xcd9d('0xb4')])){if(!_0x29f8e1[_0xcd9d('0x88')]){_0x29f8e1[_0xcd9d('0x98')]=!![];_0x29f8e1['queuecallerexitAt']=moment()[_0xcd9d('0x47')](_0xcd9d('0x79'));_0x29f8e1[_0xcd9d('0x8a')]='EXITWITHKEY';_0x29f8e1['queuecallerleaveAt']=moment()[_0xcd9d('0x47')](_0xcd9d('0x79'));this[_0xcd9d('0x36')][_0x252d11[_0xcd9d('0x4e')]]=_0x29f8e1;}}logger[_0xcd9d('0x92')](_0xcd9d('0xb5'),_0x252d11[_0xcd9d('0x4e')],_0x29f8e1['name'],_0x29f8e1[_0xcd9d('0x51')],_[_0xcd9d('0x80')](_0x252d11[_0xcd9d('0xab')])[0x0],_0x252d11[_0xcd9d('0xac')]);_0x29f8e1['variables']=this[_0xcd9d('0x14')][_0x252d11[_0xcd9d('0x4e')]];}}}}catch(_0x33c54d){logger['error'](_0xcd9d('0xb6'),_0x252d11[_0xcd9d('0x4e')],util['inspect'](_0x33c54d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xcd9d('0xa')][_0xcd9d('0xaa')]=function(_0x5c7849,_0x29f81f,_0x545bfe){var _0x896fdc=[_0xcd9d('0xb7'),_0xcd9d('0xb8'),'rtpaudioqosjitter',_0xcd9d('0xb9'),_0xcd9d('0xba'),_0xcd9d('0xbb'),_0xcd9d('0xbc'),_0xcd9d('0xbd'),_0xcd9d('0xbe'),_0xcd9d('0xbf'),_0xcd9d('0xc0'),_0xcd9d('0xc1'),'membercalls','memberdynamic','memberinterface',_0xcd9d('0xc2'),'membername',_0xcd9d('0xc3'),_0xcd9d('0xc4')];if(!_[_0xcd9d('0x38')](_0x29f81f)&&!_[_0xcd9d('0xc5')](_0x896fdc,_0x29f81f)){if(_[_0xcd9d('0x77')](this[_0xcd9d('0x14')][_0x5c7849])){this[_0xcd9d('0x14')][_0x5c7849]={};}this[_0xcd9d('0x14')][_0x5c7849][_0x29f81f]=_0x545bfe;}};VoiceQueueReport['prototype'][_0xcd9d('0xc6')]=function(_0x209bde){try{if(this[_0xcd9d('0x64')](_0x209bde)){logger[_0xcd9d('0x44')](_0xcd9d('0xc7'),_0x209bde[_0xcd9d('0x4e')],util['inspect'](_0x209bde,{'showHidden':![],'depth':null}));if(this[_0xcd9d('0xf')][_0x209bde[_0xcd9d('0x4e')]]){for(var _0x141351=0x0,_0x4fa0da={};_0x1413510x0?_0x1fe7f0:0x0;this[_0xd130('0x13')][_0x166e33[_0xd130('0x6b')]][_0xd130('0x35')]=this[_0xd130('0x13')][_0x166e33[_0xd130('0x6b')]][_0xd130('0x35')]>_[_0xd130('0x70')](_0x166e33[_0xd130('0x71')])?_['toNumber'](_0x166e33['loggedin']):this[_0xd130('0x13')][_0x166e33['queue']][_0xd130('0x35')];this[_0xd130('0x54')](this[_0xd130('0x13')][_0x166e33['queue']],'queuesummary');}logger['debug'](_0xd130('0x72'),util['inspect'](this[_0xd130('0x13')][_0x166e33[_0xd130('0x6b')]],{'showHidden':![],'depth':null}));ami[_0xd130('0x4a')](_0xd130('0x73'),this[_0xd130('0x13')][_0x166e33[_0xd130('0x6b')]]);}}}catch(_0x3b5d95){logger[_0xd130('0x42')]('[voiceQueueReport][queuesummary]',util[_0xd130('0x44')](_0x3b5d95,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd130('0xc')]['syncQueueSummaryComplete']=function(_0x2eebf3){logger[_0xd130('0x4b')](_0xd130('0x74'),util[_0xd130('0x44')](_0x2eebf3,{'showHidden':![],'depth':null}));this[_0xd130('0x14')]=!![];};VoiceQueueReport[_0xd130('0xc')][_0xd130('0x1b')]=function(_0x563f43){try{if(this[_0xd130('0x63')](_0x563f43)){logger['debug'](_0xd130('0x75'),_0x563f43[_0xd130('0x52')],util[_0xd130('0x44')](_0x563f43,{'showHidden':![],'depth':null}));if(_[_0xd130('0x76')](this[_0xd130('0x10')][_0x563f43[_0xd130('0x52')]]))this[_0xd130('0x10')][_0x563f43['uniqueid']]=[];if(_[_0xd130('0x76')](this[_0xd130('0x3a')][_0x563f43[_0xd130('0x52')]]))this[_0xd130('0x3a')][_0x563f43[_0xd130('0x52')]]={};var _0x139e1d=new QueueReport();_0x139e1d[_0xd130('0x4f')]=_0x563f43[_0xd130('0x6b')];_0x139e1d['type']=this[_0xd130('0x13')][_0x139e1d['name']]&&this[_0xd130('0x13')][_0x139e1d[_0xd130('0x4f')]][_0xd130('0x55')]?this['voiceQueues'][_0x139e1d[_0xd130('0x4f')]][_0xd130('0x55')]||'inbound':_0xd130('0x56');_0x139e1d[_0xd130('0x6b')]=_0x563f43[_0xd130('0x6b')];_0x139e1d[_0xd130('0x77')]=moment()[_0xd130('0x4d')](_0xd130('0x78'));_0x139e1d['position']=_0x563f43[_0xd130('0x79')];_0x139e1d[_0xd130('0x7a')]=_0x563f43[_0xd130('0x7a')];_0x139e1d[_0xd130('0x52')]=_0x563f43[_0xd130('0x52')];_0x139e1d[_0xd130('0x7b')]=this[_0xd130('0x3a')][_0x563f43['uniqueid']][_0xd130('0x7b')];logger[_0xd130('0x6c')](_0xd130('0x7c'),_0x139e1d[_0xd130('0x4f')],_0x139e1d[_0xd130('0x55')]);_[_0xd130('0x7d')](_0x139e1d,_[_0xd130('0x7e')](_0x563f43,_['keys'](_0x139e1d)));this[_0xd130('0x10')][_0x563f43['uniqueid']][_0xd130('0x7f')](_0x139e1d);this[_0xd130('0x3a')][_0x563f43['uniqueid']]=_0x139e1d;this[_0xd130('0x80')](_0x139e1d,_0xd130('0x1a'));}}catch(_0x47f9d2){logger[_0xd130('0x42')](_0xd130('0x75'),_0x563f43[_0xd130('0x52')],util[_0xd130('0x44')](_0x47f9d2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd130('0xc')][_0xd130('0x1c')]=function(_0x24ad53){try{if(this[_0xd130('0x63')](_0x24ad53)){logger[_0xd130('0x4b')](_0xd130('0x81'),_0x24ad53[_0xd130('0x52')],util[_0xd130('0x44')](_0x24ad53,{'showHidden':![],'depth':null}));if(this[_0xd130('0x10')][_0x24ad53['uniqueid']]){var _0x5ae2aa=_[_0xd130('0x82')](this[_0xd130('0x10')][_0x24ad53[_0xd130('0x52')]]);_0x5ae2aa[_0xd130('0x83')]=![];_0x5ae2aa['queuecallercompleteAt']=null;_0x5ae2aa[_0xd130('0x84')]=_0x24ad53[_0xd130('0x84')];_0x5ae2aa[_0xd130('0x85')]=_0x24ad53[_0xd130('0x85')];_0x5ae2aa[_0xd130('0x86')]=!![];_0x5ae2aa[_0xd130('0x87')]=moment()[_0xd130('0x4d')](_0xd130('0x78'));_0x5ae2aa[_0xd130('0x88')]=_0xd130('0x89');_0x5ae2aa[_0xd130('0x8a')]=null;logger[_0xd130('0x6c')](_0xd130('0x8b'),_0x5ae2aa[_0xd130('0x4f')],_0x5ae2aa[_0xd130('0x55')]);this[_0xd130('0x3a')][_0x24ad53[_0xd130('0x52')]]=_0x5ae2aa;this[_0xd130('0x48')](_0x5ae2aa,_0xd130('0x86'));}}}catch(_0x513c3f){logger[_0xd130('0x42')]('[%s][voiceQueueReport][queuecallerabandon]',_0x24ad53[_0xd130('0x52')],util[_0xd130('0x44')](_0x513c3f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd130('0xc')][_0xd130('0x1e')]=function(_0x308495){try{if(this[_0xd130('0x63')](_0x308495)){logger[_0xd130('0x4b')](_0xd130('0x8c'),_0x308495[_0xd130('0x52')],util[_0xd130('0x44')](_0x308495,{'showHidden':![],'depth':null}));if(this[_0xd130('0x10')][_0x308495[_0xd130('0x52')]]){var _0x222929=_[_0xd130('0x82')](this['queueReports'][_0x308495[_0xd130('0x52')]]);_0x222929[_0xd130('0x8d')]=moment()[_0xd130('0x4d')](_0xd130('0x78'));_0x222929[_0xd130('0x8e')]=_0x308495[_0xd130('0x8e')];_0x222929[_0xd130('0x8f')]=_0x308495[_0xd130('0x8f')];logger[_0xd130('0x6c')](_0xd130('0x90'),_0x222929[_0xd130('0x4f')],_0x222929['type'],_0x308495[_0xd130('0x8e')],_0x308495[_0xd130('0x8f')]);this[_0xd130('0x3a')][_0x308495[_0xd130('0x52')]]=_0x222929;this[_0xd130('0x80')](_0x222929,'queuecallerleave');}}}catch(_0x39def7){logger[_0xd130('0x42')](_0xd130('0x8c'),_0x308495[_0xd130('0x52')],util[_0xd130('0x44')](_0x39def7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd130('0xc')]['syncAgentConnect']=function(_0x5d3d13){try{if(this[_0xd130('0x63')](_0x5d3d13)){logger[_0xd130('0x4b')](_0xd130('0x91'),_0x5d3d13[_0xd130('0x52')],util[_0xd130('0x44')](_0x5d3d13,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x5d3d13['uniqueid']]){var _0x26469b=_[_0xd130('0x82')](this[_0xd130('0x10')][_0x5d3d13[_0xd130('0x52')]]);_0x26469b[_0xd130('0x83')]=!![];_0x26469b[_0xd130('0x88')]=_0xd130('0x92');logger[_0xd130('0x6c')](_0xd130('0x93'),_0x26469b['name'],_0x26469b[_0xd130('0x55')]);}}}catch(_0x30cca3){logger[_0xd130('0x42')]('[%s][voiceQueueReport][agentconnect]',_0x5d3d13[_0xd130('0x52')],util[_0xd130('0x44')](_0x30cca3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd130('0xc')]['syncAgentComplete']=function(_0x3d5564){try{if(this[_0xd130('0x63')](_0x3d5564)){logger['debug']('[%s][voiceQueueReport][agentcomplete]',_0x3d5564['uniqueid'],util[_0xd130('0x44')](_0x3d5564,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x3d5564[_0xd130('0x52')]]){var _0x23fe6e=_['last'](this[_0xd130('0x10')][_0x3d5564[_0xd130('0x52')]]);_0x23fe6e[_0xd130('0x86')]=![];_0x23fe6e[_0xd130('0x87')]=null;_0x23fe6e['assigned']=!![];_0x23fe6e[_0xd130('0x8a')]=_0x3d5564[_0xd130('0x94')];_0x23fe6e[_0xd130('0x84')]=_0x3d5564[_0xd130('0x84')];_0x23fe6e[_0xd130('0x83')]=!![];_0x23fe6e['queuecallerexit']=![];_0x23fe6e[_0xd130('0x95')]=null;if(!_0x23fe6e[_0xd130('0x96')]){if(_0x3d5564['reason']=='transfer'){_0x23fe6e['queuecallerexitreason']=_0xd130('0x97');logger['info'](_0xd130('0x98'),_0x23fe6e['name'],_0x23fe6e[_0xd130('0x55')]);}else{if(_[_0xd130('0x99')](_0x3d5564[_0xd130('0x9a')][_0xd130('0x9b')](),_0xd130('0x9c'))){if(this['queueReports'][_0x3d5564[_0xd130('0x9d')]]){var _0x25a024=_[_0xd130('0x82')](this[_0xd130('0x10')][_0x3d5564[_0xd130('0x9d')]]);_0x25a024['queuecallercomplete']=![];_0x25a024[_0xd130('0x9e')]=!![];_0x25a024[_0xd130('0x95')]=moment(_0x23fe6e[_0xd130('0x77')])[_0xd130('0x9f')](_0x3d5564['holdtime'],_0xd130('0xa0'))[_0xd130('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');_0x25a024[_0xd130('0x88')]=_0xd130('0xa1');_0x25a024[_0xd130('0x96')]=!![];_0x25a024[_0xd130('0xa2')]=_0xd130('0xa3');_0x25a024[_0xd130('0xa4')]=_0x3d5564[_0xd130('0xa5')];_0x25a024[_0xd130('0xa6')]=_0x3d5564[_0xd130('0x52')];logger[_0xd130('0x6c')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x25a024[_0xd130('0x4f')],_0x25a024[_0xd130('0x55')]);var _0x50faa5=this['queueReports'][_0x3d5564[_0xd130('0x9d')]];this[_0xd130('0x10')][_0x3d5564[_0xd130('0x9d')]]=this['queueReports'][_0x3d5564[_0xd130('0x52')]];this[_0xd130('0x10')][_0x3d5564[_0xd130('0x52')]]=_0x50faa5;}}else{_0x23fe6e[_0xd130('0x88')]='COMPLETEDBY'+_0x3d5564['reason'][_0xd130('0xa7')]();logger[_0xd130('0x6c')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x23fe6e[_0xd130('0x4f')],_0x23fe6e[_0xd130('0x55')],_0x23fe6e[_0xd130('0x88')]);}}}this[_0xd130('0x3a')][_0x3d5564[_0xd130('0x52')]]=_0x23fe6e;this[_0xd130('0x48')](_0x23fe6e,_0xd130('0x1f'));}}}catch(_0x180c72){logger[_0xd130('0x42')]('[%s][voiceQueueReport][agentcomplete]',_0x3d5564[_0xd130('0x52')],util[_0xd130('0x44')](_0x180c72,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd130('0xc')]['syncVarSet']=function(_0x398c66){try{if(this[_0xd130('0x63')](_0x398c66)){logger[_0xd130('0x4b')](_0xd130('0xa8'),_0x398c66[_0xd130('0x52')],util[_0xd130('0x44')](_0x398c66,{'showHidden':![],'depth':null}));this[_0xd130('0xa9')](_0x398c66['uniqueid'],_[_0xd130('0xaa')](_0x398c66[_0xd130('0xab')])[0x0],_0x398c66['value']);if(this['queueReports'][_0x398c66[_0xd130('0x52')]]){var _0x2452fb=_[_0xd130('0x82')](this['queueReports'][_0x398c66['uniqueid']]);if(_0x2452fb){if(this[_0xd130('0x63')](_0x398c66[_0xd130('0xab')])&&this[_0xd130('0x63')](_0x398c66['variable'][_0xd130('0xac')])){switch(_0x398c66['value']){case _0xd130('0xad'):_0x2452fb['queuecallerexit']=![];_0x2452fb['queuecallerexitAt']=null;break;case _0xd130('0xae'):_0x2452fb['lastevent']=_0xd130('0xaf');_0x2452fb['queuecallerexit']=!![];_0x2452fb['queuecallerexitAt']=moment()[_0xd130('0x4d')](_0xd130('0x78'));_0x2452fb[_0xd130('0x8d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');logger[_0xd130('0x4b')](_0xd130('0xb0'),_0x398c66['uniqueid'],util['inspect'](_0x2452fb,{'showHidden':![],'depth':null}));ami[_0xd130('0x4a')]('custom:timeout',_0x2452fb);break;default:_0x2452fb[_0xd130('0x9e')]=!![];_0x2452fb['queuecallerexitAt']=moment()['format'](_0xd130('0x78'));_0x2452fb[_0xd130('0x8d')]=moment()[_0xd130('0x4d')](_0xd130('0x78'));}_0x2452fb['queuecallerabandon']=![];_0x2452fb[_0xd130('0x87')]=null;_0x2452fb[_0xd130('0x88')]=_0x398c66['value'];this[_0xd130('0x3a')][_0x398c66[_0xd130('0x52')]]=_0x2452fb;this[_0xd130('0x48')](_0x2452fb,_0xd130('0x23'));}else if(this[_0xd130('0x63')](_0x398c66[_0xd130('0xab')])&&this[_0xd130('0x63')](_0x398c66[_0xd130('0xab')][_0xd130('0xb1')])){if(!_0x2452fb[_0xd130('0x86')]){_0x2452fb[_0xd130('0x9e')]=!![];_0x2452fb[_0xd130('0x95')]=moment()[_0xd130('0x4d')](_0xd130('0x78'));_0x2452fb['queuecallerexitreason']='EXITWITHKEY';_0x2452fb[_0xd130('0x8d')]=moment()[_0xd130('0x4d')](_0xd130('0x78'));this['channels'][_0x398c66[_0xd130('0x52')]]=_0x2452fb;}}logger[_0xd130('0x6c')](_0xd130('0xb2'),_0x398c66[_0xd130('0x52')],_0x2452fb[_0xd130('0x4f')],_0x2452fb[_0xd130('0x55')],_[_0xd130('0xaa')](_0x398c66[_0xd130('0xab')])[0x0],_0x398c66[_0xd130('0xb3')]);_0x2452fb[_0xd130('0x16')]=this['variables'][_0x398c66['uniqueid']];}}}}catch(_0x1a678c){logger[_0xd130('0x42')]('[%s][voiceQueueReport][varset]',_0x398c66[_0xd130('0x52')],util[_0xd130('0x44')](_0x1a678c,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['addVariable']=function(_0xe90a08,_0xe4d48f,_0x2895d8){var _0x14a21d=[_0xd130('0xb4'),'rtpaudioqosbridged','rtpaudioqosjitter',_0xd130('0xb5'),'rtpaudioqosloss',_0xd130('0xb6'),_0xd130('0xb7'),_0xd130('0xb8'),_0xd130('0xb9'),_0xd130('0xba'),_0xd130('0xbb'),_0xd130('0xbc'),_0xd130('0xbd'),'memberdynamic',_0xd130('0xbe'),_0xd130('0xbf'),_0xd130('0x94'),_0xd130('0xc0'),'memberrealtime'];if(!_[_0xd130('0x3d')](_0xe4d48f)&&!_[_0xd130('0xc1')](_0x14a21d,_0xe4d48f)){if(_[_0xd130('0x76')](this[_0xd130('0x16')][_0xe90a08])){this[_0xd130('0x16')][_0xe90a08]={};}this['variables'][_0xe90a08][_0xe4d48f]=_0x2895d8;}};VoiceQueueReport['prototype'][_0xd130('0x25')]=function(_0x1be0fc){try{if(this[_0xd130('0x63')](_0x1be0fc)){logger[_0xd130('0x4b')](_0xd130('0xc2'),_0x1be0fc[_0xd130('0x52')],util[_0xd130('0x44')](_0x1be0fc,{'showHidden':![],'depth':null}));if(this[_0xd130('0x10')][_0x1be0fc[_0xd130('0x52')]]){for(var _0x5ba261=0x0,_0x7b4a8c={};_0x5ba261=0x0?moment(_0x5a49f1[_0x4314('0x19')])[_0x4314('0xd')](_0x5a49f1['starttime'],_0x4314('0xe')):null,'data1':_0x4314('0x1a'),'data2':_0x5a49f1[_0x4314('0x13')],'data3':_0x5a49f1[_0x4314('0x11')],'data4':_0x5a49f1[_0x4314('0x1b')]||null,'role':_0x4314('0x1c'),'internal':_0x5a49f1['accountcode']?_[_0x4314('0x14')](_0x5a49f1['accountcode']):undefined,'uniqueid':_0x5a49f1[_0x4314('0x15')]},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0xf330=['voiceDialReport','membername','TALKING','endtime','starttime','seconds','outbound','util','../client','voiceQueueReport','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','isNil','interface','SIP/%s','queuecallerleaveAt','diff','inbound','exten','queue','agent','accountcode','toNumber','uniqueid'];(function(_0x41d827,_0x5b9f03){var _0x3d82c8=function(_0x1cc28f){while(--_0x1cc28f){_0x41d827['push'](_0x41d827['shift']());}};_0x3d82c8(++_0x5b9f03);}(_0xf330,0x1b7));var _0x0f33=function(_0x51b344,_0xea68db){_0x51b344=_0x51b344-0x0;var _0x2be948=_0xf330[_0x51b344];return _0x2be948;};'use strict';var moment=require('moment');var _=require('lodash');var util=require(_0x0f33('0x0'));var client=require(_0x0f33('0x1'));exports[_0x0f33('0x2')]=function(_0x3f64cd){var _0x559966=_0x3f64cd['queuecallercompleteAt']||_0x3f64cd[_0x0f33('0x3')];return client[_0x0f33('0x4')](_0x0f33('0x5'),{'body':{'channel':_0x0f33('0x6'),'membername':_0x3f64cd[_0x0f33('0x7')],'interface':_[_0x0f33('0x8')](_0x3f64cd[_0x0f33('0x9')])?util['format'](_0x0f33('0xa'),_0x3f64cd['lastAssignedTo']):_0x3f64cd['interface'],'type':'TALKING','enterAt':_0x3f64cd[_0x0f33('0xb')],'exitAt':_0x559966,'duration':moment(_0x559966)[_0x0f33('0xc')](_0x3f64cd[_0x0f33('0xb')],'seconds'),'data1':_0x0f33('0xd'),'data2':_0x3f64cd['calleridnum'],'data3':_0x3f64cd[_0x0f33('0xe')],'data4':null,'data5':_0x3f64cd[_0x0f33('0xf')],'role':_0x0f33('0x10'),'internal':_0x3f64cd[_0x0f33('0x11')]?_[_0x0f33('0x12')](_0x3f64cd[_0x0f33('0x11')]):undefined,'uniqueid':_0x3f64cd[_0x0f33('0x13')]},'log':'CreateMemberReport'});};exports[_0x0f33('0x14')]=function(_0xeda5d7){return client[_0x0f33('0x4')]('CreateMemberReport',{'body':{'channel':_0x0f33('0x6'),'membername':_0xeda5d7[_0x0f33('0x15')],'interface':_0xeda5d7[_0x0f33('0x9')],'type':_0x0f33('0x16'),'enterAt':_0xeda5d7['starttime'],'exitAt':_0xeda5d7[_0x0f33('0x17')],'duration':moment(_0xeda5d7[_0x0f33('0x17')])['diff'](_0xeda5d7[_0x0f33('0x18')],_0x0f33('0x19'))>=0x0?moment(_0xeda5d7[_0x0f33('0x17')])[_0x0f33('0xc')](_0xeda5d7[_0x0f33('0x18')],_0x0f33('0x19')):null,'data1':_0x0f33('0x1a'),'data2':_0xeda5d7[_0x0f33('0x11')],'data3':_0xeda5d7['exten'],'data4':_0xeda5d7['dialstring']||null,'role':_0x0f33('0x10'),'internal':_0xeda5d7[_0x0f33('0x11')]?_[_0x0f33('0x12')](_0xeda5d7[_0x0f33('0x11')]):undefined,'uniqueid':_0xeda5d7[_0x0f33('0x13')]},'log':_0x0f33('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index eee5423..bbc0cad 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 _0x720e=['getSettings','Request','GetSettings','../client'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x720e,0x1cb));var _0xe720=function(_0x4e1a49,_0x4da738){_0x4e1a49=_0x4e1a49-0x0;var _0x136aae=_0x720e[_0x4e1a49];return _0x136aae;};'use strict';var client=require(_0xe720('0x0'));exports[_0xe720('0x1')]=function(){return client[_0xe720('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer']},'log':_0xe720('0x3')});}; \ No newline at end of file +var _0x91a7=['Request','ShowSetting','GetSettings','getSettings'];(function(_0x48a325,_0x325278){var _0x23855b=function(_0x233286){while(--_0x233286){_0x48a325['push'](_0x48a325['shift']());}};_0x23855b(++_0x325278);}(_0x91a7,0xe7));var _0x791a=function(_0x335c99,_0xe6066b){_0x335c99=_0x335c99-0x0;var _0x42df13=_0x91a7[_0x335c99];return _0x42df13;};'use strict';var client=require('../client');exports[_0x791a('0x0')]=function(){return client[_0x791a('0x1')](_0x791a('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer']},'log':_0x791a('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index b59de62..8195e00 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 _0x2d20=['GetTemplate','name','html','../client','getTemplates','Request'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x2d20,0x1d1));var _0x02d2=function(_0x16e8e2,_0x3c0f1d){_0x16e8e2=_0x16e8e2-0x0;var _0x1d1bbc=_0x2d20[_0x16e8e2];return _0x1d1bbc;};'use strict';var client=require(_0x02d2('0x0'));exports[_0x02d2('0x1')]=function(_0x3d5fb2){return function(_0x491af9){return client[_0x02d2('0x2')](_0x02d2('0x3'),{'options':{'raw':!![],'attributes':['id',_0x02d2('0x4'),_0x02d2('0x5')]},'log':_0x02d2('0x3')});};}; \ No newline at end of file +var _0xb06c=['getTemplates','GetTemplate','name'];(function(_0x40f4ca,_0x1f6e83){var _0x1a3c32=function(_0x3a546e){while(--_0x3a546e){_0x40f4ca['push'](_0x40f4ca['shift']());}};_0x1a3c32(++_0x1f6e83);}(_0xb06c,0x141));var _0xcb06=function(_0x50dd6d,_0x35186c){_0x50dd6d=_0x50dd6d-0x0;var _0x55cd2d=_0xb06c[_0x50dd6d];return _0x55cd2d;};'use strict';var client=require('../client');exports[_0xcb06('0x0')]=function(_0x3e9d65){return function(_0x582191){return client['Request'](_0xcb06('0x1'),{'options':{'raw':!![],'attributes':['id',_0xcb06('0x2'),'html']},'log':_0xcb06('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index bbd9737..e256efe 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 _0xf9fa=['getTriggers','Request','GetTrigger','name','channel','Condition','AllConditions','operator','value','AnyConditions','field','Action','Actions','action','data2','data3','data4','data5','data6','data7','../client'];(function(_0x49b69d,_0x4d1245){var _0x529186=function(_0xac7a39){while(--_0xac7a39){_0x49b69d['push'](_0x49b69d['shift']());}};_0x529186(++_0x4d1245);}(_0xf9fa,0xfb));var _0xaf9f=function(_0x4f039a,_0x2bc090){_0x4f039a=_0x4f039a-0x0;var _0x71daa2=_0xf9fa[_0x4f039a];return _0x71daa2;};'use strict';var client=require(_0xaf9f('0x0'));exports[_0xaf9f('0x1')]=function(_0x27c814){return function(_0x99094a){return client[_0xaf9f('0x2')](_0xaf9f('0x3'),{'options':{'raw':![],'attributes':['id',_0xaf9f('0x4'),_0xaf9f('0x5'),'status'],'include':[{'model':_0xaf9f('0x6'),'as':_0xaf9f('0x7'),'attributes':['id','field',_0xaf9f('0x8'),_0xaf9f('0x9')]},{'model':_0xaf9f('0x6'),'as':_0xaf9f('0xa'),'attributes':['id',_0xaf9f('0xb'),_0xaf9f('0x8'),_0xaf9f('0x9')]},{'model':_0xaf9f('0xc'),'as':_0xaf9f('0xd'),'attributes':['id',_0xaf9f('0xe'),'data1',_0xaf9f('0xf'),_0xaf9f('0x10'),_0xaf9f('0x11'),_0xaf9f('0x12'),_0xaf9f('0x13'),_0xaf9f('0x14')]}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0xfce3=['../client','getTriggers','Request','GetTrigger','name','status','Condition','AllConditions','field','operator','AnyConditions','value','Action','Actions','action','data1','data2','data3','data4','data6'];(function(_0x4ccfef,_0x3d7cb5){var _0x3f4d96=function(_0x47d4d6){while(--_0x47d4d6){_0x4ccfef['push'](_0x4ccfef['shift']());}};_0x3f4d96(++_0x3d7cb5);}(_0xfce3,0xf0));var _0x3fce=function(_0x2b6482,_0x95e8a8){_0x2b6482=_0x2b6482-0x0;var _0x53e68f=_0xfce3[_0x2b6482];return _0x53e68f;};'use strict';var client=require(_0x3fce('0x0'));exports[_0x3fce('0x1')]=function(_0x3a7175){return function(_0x2e744e){return client[_0x3fce('0x2')](_0x3fce('0x3'),{'options':{'raw':![],'attributes':['id',_0x3fce('0x4'),'channel',_0x3fce('0x5')],'include':[{'model':_0x3fce('0x6'),'as':_0x3fce('0x7'),'attributes':['id',_0x3fce('0x8'),_0x3fce('0x9'),'value']},{'model':'Condition','as':_0x3fce('0xa'),'attributes':['id',_0x3fce('0x8'),_0x3fce('0x9'),_0x3fce('0xb')]},{'model':_0x3fce('0xc'),'as':_0x3fce('0xd'),'attributes':['id',_0x3fce('0xe'),_0x3fce('0xf'),_0x3fce('0x10'),_0x3fce('0x11'),_0x3fce('0x12'),'data5',_0x3fce('0x13'),'data7']}]},'log':_0x3fce('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index cfb67ed..69ef4eb 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 _0x793b=['name','registry','defaultuser','../client','getTrunks','Request','GetTrunk'];(function(_0x3050a2,_0x506045){var _0x2b069b=function(_0xd8e13e){while(--_0xd8e13e){_0x3050a2['push'](_0x3050a2['shift']());}};_0x2b069b(++_0x506045);}(_0x793b,0x1ae));var _0xb793=function(_0x3bd1a6,_0x4911ea){_0x3bd1a6=_0x3bd1a6-0x0;var _0x184fb1=_0x793b[_0x3bd1a6];return _0x184fb1;};'use strict';var client=require(_0xb793('0x0'));exports[_0xb793('0x1')]=function(_0x7a6b03){return function(_0x4ebad7){return client[_0xb793('0x2')](_0xb793('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xb793('0x4'),_0xb793('0x5'),_0xb793('0x6')]},'log':_0xb793('0x3')});};}; \ No newline at end of file +var _0xd5cd=['../client','getTrunks','Request','GetTrunk','name','defaultuser'];(function(_0x318969,_0x11b9a0){var _0x400c5e=function(_0x1a1f31){while(--_0x1a1f31){_0x318969['push'](_0x318969['shift']());}};_0x400c5e(++_0x11b9a0);}(_0xd5cd,0x7e));var _0xdd5c=function(_0x1ce3b3,_0x59b784){_0x1ce3b3=_0x1ce3b3-0x0;var _0xdfbfb=_0xd5cd[_0x1ce3b3];return _0xdfbfb;};'use strict';var client=require(_0xdd5c('0x0'));exports[_0xdd5c('0x1')]=function(_0x66b732){return function(_0x2702b7){return client[_0xdd5c('0x2')](_0xdd5c('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xdd5c('0x4'),'registry',_0xdd5c('0x5')]},'log':_0xdd5c('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 68b8dbb..b444325 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 _0xe706=['internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','getAgent','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','GetUser','telephone'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xe706,0xa3));var _0x6e70=function(_0x1b1ce5,_0x508743){_0x1b1ce5=_0x1b1ce5-0x0;var _0x432ff6=_0xe706[_0x1b1ce5];return _0x432ff6;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x6e70('0x3')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc'),_0x6e70('0xd'),_0x6e70('0xe'),_0x6e70('0xf')]},'log':_0x6e70('0x1')});};};exports[_0x6e70('0x10')]=function(){return function(){return client[_0x6e70('0x2')](_0x6e70('0x11'),{'options':{'raw':!![],'where':{'role':_0x6e70('0x12')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x6'),_0x6e70('0x13')]},'log':_0x6e70('0x10')});};};exports[_0x6e70('0x14')]=function(_0x4600f9,_0x5b3d07,_0x47f6b2){return client[_0x6e70('0x2')](_0x6e70('0x15'),{'body':{'type':_0x5b3d07,'uniqueid':_0x47f6b2},'options':{'where':{'id':_0x4600f9['id']}},'log':_0x6e70('0x14')});};exports[_0x6e70('0x16')]=function(_0x3b38f3){return client[_0x6e70('0x2')](_0x6e70('0x17'),{'body':{},'options':{'where':{'id':_0x3b38f3['id']}},'log':_0x6e70('0x14')});};exports['getAgent']=function(_0x52737e){return client['Request'](_0x6e70('0x18'),{'options':{'raw':![],'where':{'role':'agent','id':_0x52737e},'attributes':['id','name',_0x6e70('0x5'),_0x6e70('0x6'),'fullname',_0x6e70('0x8'),'lastLoginAt',_0x6e70('0xa'),_0x6e70('0xb'),'voicePause','interface']},'log':_0x6e70('0x19')});}; \ No newline at end of file +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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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 b9e6ba0..7ee6303 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 _0xf968=['Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client'];(function(_0x1c8cc6,_0x411e5c){var _0x522936=function(_0x38d044){while(--_0x38d044){_0x1c8cc6['push'](_0x1c8cc6['shift']());}};_0x522936(++_0x411e5c);}(_0xf968,0x135));var _0x8f96=function(_0x36c65f,_0x576e12){_0x36c65f=_0x36c65f-0x0;var _0x5cbe9b=_0xf968[_0x36c65f];return _0x5cbe9b;};'use strict';var client=require(_0x8f96('0x0'));exports['create']=function(_0x2a2956){return client[_0x8f96('0x1')](_0x8f96('0x2'),{'body':_0x2a2956,'log':'CreateVoiceAgentReport'});};exports[_0x8f96('0x3')]=function(_0x3bba70,_0x1f98be,_0x2116fc){return client[_0x8f96('0x1')](_0x8f96('0x4'),{'body':_0x3bba70,'options':{'where':{'uniqueid':_0x1f98be,'interface':_0x2116fc,'agentcomplete':!![]}},'log':_0x8f96('0x4')});}; \ No newline at end of file +var _0x558f=['Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','create'];(function(_0x4fba16,_0x3fe042){var _0x24fdb1=function(_0x3a2b7c){while(--_0x3a2b7c){_0x4fba16['push'](_0x4fba16['shift']());}};_0x24fdb1(++_0x3fe042);}(_0x558f,0x1e4));var _0xf558=function(_0x254857,_0xd3bee9){_0x254857=_0x254857-0x0;var _0x439b1b=_0x558f[_0x254857];return _0x439b1b;};'use strict';var client=require(_0xf558('0x0'));exports[_0xf558('0x1')]=function(_0x18233c){return client[_0xf558('0x2')](_0xf558('0x3'),{'body':_0x18233c,'log':_0xf558('0x3')});};exports[_0xf558('0x4')]=function(_0x3c7dea,_0x14228b,_0x2a7a2c){return client[_0xf558('0x2')]('UpdateVoiceAgentReport',{'body':_0x3c7dea,'options':{'where':{'uniqueid':_0x14228b,'interface':_0x2a7a2c,'agentcomplete':!![]}},'log':_0xf558('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 3ef7bc2..2eabf6a 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 _0x23c1=['util','lodash','../client','create','Request','CreateVoiceCallReport','merge','context','callerid','GetVoiceCallReport','outbound','startOf','YYYY-MM-DD\x20HH:mm:ss','endOf','format','type','disposition','duration','billableseconds','GetVoiceCallReports','moment'];(function(_0x4b6afc,_0x42a62e){var _0x53a775=function(_0x17aa16){while(--_0x17aa16){_0x4b6afc['push'](_0x4b6afc['shift']());}};_0x53a775(++_0x42a62e);}(_0x23c1,0xe6));var _0x123c=function(_0x19712f,_0x161d4a){_0x19712f=_0x19712f-0x0;var _0x5d1a11=_0x23c1[_0x19712f];return _0x5d1a11;};'use strict';var moment=require(_0x123c('0x0'));var util=require(_0x123c('0x1'));var _=require(_0x123c('0x2'));var client=require(_0x123c('0x3'));exports[_0x123c('0x4')]=function(_0x258a4d){return client[_0x123c('0x5')](_0x123c('0x6'),{'body':_[_0x123c('0x7')](_0x258a4d,{'source':_0x258a4d['calleridnum'],'destinationcontext':_0x258a4d[_0x123c('0x8')],'callerid':_0x258a4d[_0x123c('0x9')],'amaflags':'DOCUMENTATION'}),'log':_0x123c('0x6')});};exports['getVoiceCallReports']=function(){return function(){return client['Request'](_0x123c('0xa'),{'options':{'where':{'type':[_0x123c('0xb')],'createdAt':{'$between':[moment()[_0x123c('0xc')]('day')['format'](_0x123c('0xd')),moment()[_0x123c('0xe')]('day')[_0x123c('0xf')](_0x123c('0xd'))]}},'attributes':[_0x123c('0x10'),_0x123c('0x11'),_0x123c('0x12'),_0x123c('0x13')]},'log':_0x123c('0x14')});};}; \ No newline at end of file +var _0xf66e=['GetVoiceCallReport','startOf','YYYY-MM-DD\x20HH:mm:ss','endOf','day','format','type','disposition','duration','billableseconds','moment','util','lodash','create','Request','CreateVoiceCallReport','context','getVoiceCallReports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xf66e,0x12a));var _0xef66=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xf66e[_0x4c12ec];return _0x3ae42c;};'use strict';var moment=require(_0xef66('0x0'));var util=require(_0xef66('0x1'));var _=require(_0xef66('0x2'));var client=require('../client');exports[_0xef66('0x3')]=function(_0x46ab98){return client[_0xef66('0x4')](_0xef66('0x5'),{'body':_['merge'](_0x46ab98,{'source':_0x46ab98['calleridnum'],'destinationcontext':_0x46ab98[_0xef66('0x6')],'callerid':_0x46ab98['callerid'],'amaflags':'DOCUMENTATION'}),'log':_0xef66('0x5')});};exports[_0xef66('0x7')]=function(){return function(){return client[_0xef66('0x4')](_0xef66('0x8'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0xef66('0x9')]('day')['format'](_0xef66('0xa')),moment()[_0xef66('0xb')](_0xef66('0xc'))[_0xef66('0xd')](_0xef66('0xa'))]}},'attributes':[_0xef66('0xe'),_0xef66('0xf'),_0xef66('0x10'),_0xef66('0x11')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 1a6c184..62973f8 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 _0x232c=['../client','Request','CreateVoiceDialReport'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x232c,0x159));var _0xc232=function(_0x58b1a6,_0x4f1201){_0x58b1a6=_0x58b1a6-0x0;var _0x2c7731=_0x232c[_0x58b1a6];return _0x2c7731;};'use strict';var client=require(_0xc232('0x0'));exports['create']=function(_0x1ec62e){return client[_0xc232('0x1')](_0xc232('0x2'),{'body':_0x1ec62e,'log':_0xc232('0x2')});}; \ No newline at end of file +var _0x0325=['../client','create','Request','CreateVoiceDialReport'];(function(_0x5b8685,_0x281c68){var _0x3fb1a9=function(_0xa69f94){while(--_0xa69f94){_0x5b8685['push'](_0x5b8685['shift']());}};_0x3fb1a9(++_0x281c68);}(_0x0325,0x144));var _0x5032=function(_0x2f2fbf,_0x21dfba){_0x2f2fbf=_0x2f2fbf-0x0;var _0x29f889=_0x0325[_0x2f2fbf];return _0x29f889;};'use strict';var client=require(_0x5032('0x0'));exports[_0x5032('0x1')]=function(_0x359365){return client[_0x5032('0x2')](_0x5032('0x3'),{'body':_0x359365,'log':_0x5032('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 059d22a..4284dc9 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 _0x2bc6=['Request','../client','getVoiceExtensions'];(function(_0x2ae2ad,_0xac5b0c){var _0x26dbd7=function(_0x5e685b){while(--_0x5e685b){_0x2ae2ad['push'](_0x2ae2ad['shift']());}};_0x26dbd7(++_0xac5b0c);}(_0x2bc6,0x163));var _0x62bc=function(_0x3e0156,_0x2b3343){_0x3e0156=_0x3e0156-0x0;var _0x23c1c3=_0x2bc6[_0x3e0156];return _0x23c1c3;};'use strict';var client=require(_0x62bc('0x0'));exports[_0x62bc('0x1')]=function(){return function(){return client[_0x62bc('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id','exten','recordingFormat'],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0x91a7=['Request','GetVoiceExtension','recordingFormat','getVoiceExtensions'];(function(_0x36b19d,_0x45b867){var _0x19a5c6=function(_0x32f664){while(--_0x32f664){_0x36b19d['push'](_0x36b19d['shift']());}};_0x19a5c6(++_0x45b867);}(_0x91a7,0xe7));var _0x791a=function(_0x935920,_0x49105f){_0x935920=_0x935920-0x0;var _0x5edc44=_0x91a7[_0x935920];return _0x5edc44;};'use strict';var client=require('../client');exports[_0x791a('0x0')]=function(){return function(){return client[_0x791a('0x1')](_0x791a('0x2'),{'options':{'raw':!![],'attributes':['id','exten',_0x791a('0x3')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index cfe67ff..6bbf20f 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 _0xa816=['dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','callAdditionalPhoneAfterMin','Trunk','active','Pause','TrunkBackup','callerid','Interval','Intervals','interval','getVoiceQueues','../client','GetVoiceQueue','name','acw','type','dialMethod'];(function(_0x1339a5,_0x7992b4){var _0x5ab4ff=function(_0x3b0583){while(--_0x3b0583){_0x1339a5['push'](_0x1339a5['shift']());}};_0x5ab4ff(++_0x7992b4);}(_0xa816,0x10d));var _0x6a81=function(_0x5e6ea3,_0x9addd2){_0x5e6ea3=_0x5e6ea3-0x0;var _0x4048b5=_0xa816[_0x5e6ea3];return _0x4048b5;};'use strict';var client=require(_0x6a81('0x0'));exports['getVoiceQueues']=function(){return function(){return client['Request'](_0x6a81('0x1'),{'options':{'raw':![],'attributes':['id',_0x6a81('0x2'),_0x6a81('0x3'),'acwTimeout','autopause','monitor_format',_0x6a81('0x4'),'dialActive',_0x6a81('0x5'),_0x6a81('0x6'),'dialLimitQueue',_0x6a81('0x7'),_0x6a81('0x8'),'dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName',_0x6a81('0x9'),_0x6a81('0xa'),_0x6a81('0xb'),_0x6a81('0xc'),'dialQueueProject',_0x6a81('0xd'),_0x6a81('0xe'),'dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry',_0x6a81('0xf'),_0x6a81('0x10'),_0x6a81('0x11'),'dialGlobalInterval',_0x6a81('0x12'),'dialCheckDuplicateType',_0x6a81('0x13'),_0x6a81('0x14'),_0x6a81('0x15'),_0x6a81('0x16'),_0x6a81('0x17'),_0x6a81('0x18'),'dialAMDBetweenWordsSilence',_0x6a81('0x19'),'dialAMDSilenceThreshold',_0x6a81('0x1a'),_0x6a81('0x1b'),_0x6a81('0x1c'),'dialRecallInQueue','dialOrderByScheduledAt',_0x6a81('0x1d'),_0x6a81('0x1e'),_0x6a81('0x1f'),'monitor_format',_0x6a81('0x20'),'dialRandomLastDigitCallerIdNumber',_0x6a81('0x21'),_0x6a81('0x22'),_0x6a81('0x23'),_0x6a81('0x24'),_0x6a81('0x25'),_0x6a81('0x26'),'dialAbandonedRetryFrequency',_0x6a81('0x27'),_0x6a81('0x28'),_0x6a81('0x29'),'dialAgentRejectRetryFrequency',_0x6a81('0x2a'),_0x6a81('0x2b'),_0x6a81('0x2c'),_0x6a81('0x2d')],'include':[{'model':_0x6a81('0x2e'),'as':_0x6a81('0x2e'),'attributes':['id',_0x6a81('0x2'),'callerid',_0x6a81('0x2f')]},{'model':_0x6a81('0x30'),'as':'mandatoryDispositionPause','attributes':['id','name']},{'model':'Trunk','as':_0x6a81('0x31'),'attributes':['id',_0x6a81('0x2'),_0x6a81('0x32'),_0x6a81('0x2f')]},{'model':'Interval','as':_0x6a81('0x33'),'attributes':['id',_0x6a81('0x2')],'include':[{'model':_0x6a81('0x33'),'as':_0x6a81('0x34'),'attributes':['id','name',_0x6a81('0x35')]}]}]},'log':_0x6a81('0x36')});};}; \ No newline at end of file +var _0xa7b1=['dialPowerLevel','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','callAdditionalPhoneAfterMin','Trunk','active','Pause','mandatoryDispositionPause','TrunkBackup','callerid','Interval','interval','../client','getVoiceQueues','Request','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue'];(function(_0x238bce,_0x1fa37a){var _0x127fc9=function(_0x5dbfbb){while(--_0x5dbfbb){_0x238bce['push'](_0x238bce['shift']());}};_0x127fc9(++_0x1fa37a);}(_0xa7b1,0xeb));var _0x1a7b=function(_0x1dea50,_0x3c405c){_0x1dea50=_0x1dea50-0x0;var _0x5aa2cf=_0xa7b1[_0x1dea50];return _0x5aa2cf;};'use strict';var client=require(_0x1a7b('0x0'));exports[_0x1a7b('0x1')]=function(){return function(){return client[_0x1a7b('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x1a7b('0x3'),_0x1a7b('0x4'),_0x1a7b('0x5'),_0x1a7b('0x6'),_0x1a7b('0x7'),_0x1a7b('0x8'),_0x1a7b('0x9'),_0x1a7b('0xa'),_0x1a7b('0xb'),_0x1a7b('0xc'),_0x1a7b('0xd'),'dialPredictiveOptimization',_0x1a7b('0xe'),'dialPredictiveInterval',_0x1a7b('0xf'),'dialOriginateCallerIdNumber',_0x1a7b('0x10'),_0x1a7b('0x11'),'dialQueueTimeout',_0x1a7b('0x12'),'dialCongestionMaxRetry',_0x1a7b('0x13'),_0x1a7b('0x14'),_0x1a7b('0x15'),'dialNoAnswerMaxRetry',_0x1a7b('0x16'),_0x1a7b('0x17'),_0x1a7b('0x18'),_0x1a7b('0x19'),_0x1a7b('0x1a'),_0x1a7b('0x1b'),'dialAMDActive',_0x1a7b('0x1c'),_0x1a7b('0x1d'),'dialAMDAfterGreetingSilence',_0x1a7b('0x1e'),_0x1a7b('0x1f'),_0x1a7b('0x20'),_0x1a7b('0x21'),_0x1a7b('0x22'),_0x1a7b('0x23'),'timeout',_0x1a7b('0x24'),'dialRecallInQueue',_0x1a7b('0x25'),_0x1a7b('0x26'),_0x1a7b('0x27'),'dialQueueProject2',_0x1a7b('0x7'),_0x1a7b('0x28'),_0x1a7b('0x29'),_0x1a7b('0x2a'),'dialNoSuchNumberMaxRetry',_0x1a7b('0x2b'),_0x1a7b('0x2c'),_0x1a7b('0x2d'),_0x1a7b('0x2e'),_0x1a7b('0x2f'),_0x1a7b('0x30'),_0x1a7b('0x31'),_0x1a7b('0x32'),_0x1a7b('0x33'),'mandatoryDisposition',_0x1a7b('0x34'),'dialPredictiveIntervalMinThreshold',_0x1a7b('0x35')],'include':[{'model':_0x1a7b('0x36'),'as':_0x1a7b('0x36'),'attributes':['id','name','callerid',_0x1a7b('0x37')]},{'model':_0x1a7b('0x38'),'as':_0x1a7b('0x39'),'attributes':['id',_0x1a7b('0x3')]},{'model':_0x1a7b('0x36'),'as':_0x1a7b('0x3a'),'attributes':['id',_0x1a7b('0x3'),_0x1a7b('0x3b'),'active']},{'model':_0x1a7b('0x3c'),'as':_0x1a7b('0x3c'),'attributes':['id','name'],'include':[{'model':_0x1a7b('0x3c'),'as':'Intervals','attributes':['id',_0x1a7b('0x3'),_0x1a7b('0x3d')]}]}]},'log':_0x1a7b('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 1ffef55..2726090 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(_0xe36a6,_0x46fa90){var _0x4b032c=function(_0x4bea73){while(--_0x4bea73){_0xe36a6['push'](_0xe36a6['shift']());}};_0x4b032c(++_0x46fa90);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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(_0x5eb48e,_0x1f08cd){var _0x46ab53=function(_0x20155a){while(--_0x20155a){_0x5eb48e['push'](_0x5eb48e['shift']());}};_0x46ab53(++_0x1f08cd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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 8f87732..86433b3 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 _0x9113=['getVoiceQueueRtPauses','../client','Request','GetVoiceQueueRtPauses'];(function(_0xadbc31,_0x165b14){var _0x3de773=function(_0xd75e18){while(--_0xd75e18){_0xadbc31['push'](_0xadbc31['shift']());}};_0x3de773(++_0x165b14);}(_0x9113,0x79));var _0x3911=function(_0x2b8b69,_0x4157b9){_0x2b8b69=_0x2b8b69-0x0;var _0x4bf994=_0x9113[_0x2b8b69];return _0x4bf994;};'use strict';var client=require(_0x3911('0x0'));exports['getVoiceQueueRtPauses']=function(_0x2f4e30){return function(){return client[_0x3911('0x1')](_0x3911('0x2'),{'options':{'where':{'VoiceQueueId':_0x2f4e30,'paused':!![]},'raw':!![]},'log':_0x3911('0x3')});};}; \ No newline at end of file +var _0x6441=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x6441,0x1df));var _0x1644=function(_0x2fb6c2,_0x5b56ca){_0x2fb6c2=_0x2fb6c2-0x0;var _0x4b5d75=_0x6441[_0x2fb6c2];return _0x4b5d75;};'use strict';var client=require(_0x1644('0x0'));exports[_0x1644('0x1')]=function(_0x4f0a7a){return function(){return client[_0x1644('0x2')](_0x1644('0x3'),{'options':{'where':{'VoiceQueueId':_0x4f0a7a,'paused':!![]},'raw':!![]},'log':_0x1644('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index f250848..d2eadb0 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x51fd5a,_0x1e4b1b){var _0x5db726=function(_0x328e01){while(--_0x328e01){_0x51fd5a['push'](_0x51fd5a['shift']());}};_0x5db726(++_0x1e4b1b);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0xd82e92,_0x5bbd75){var _0xea36a=function(_0x27e1b0){while(--_0x27e1b0){_0xd82e92['push'](_0xd82e92['shift']());}};_0xea36a(++_0x5bbd75);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index d55b515..0d1686b 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 _0x8e9c=['origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','attended','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','attendedTransfer','origtransfererchannel','origtransferercalleridnum'];(function(_0x117276,_0x2c725e){var _0x51b05f=function(_0x3c933c){while(--_0x3c933c){_0x117276['push'](_0x117276['shift']());}};_0x51b05f(++_0x2c725e);}(_0x8e9c,0xa6));var _0xc8e9=function(_0x502eea,_0x53532a){_0x502eea=_0x502eea-0x0;var _0x4fb4f7=_0x8e9c[_0x502eea];return _0x4fb4f7;};'use strict';var client=require('../client');exports[_0xc8e9('0x0')]={};exports[_0xc8e9('0x1')]=function(_0x5f4b4b){return client[_0xc8e9('0x2')](_0xc8e9('0x3'),{'body':{'result':_0x5f4b4b[_0xc8e9('0x4')],'transfererchannel':_0x5f4b4b[_0xc8e9('0x5')],'transferercalleridnum':_0x5f4b4b['transferercalleridnum'],'transferercalleridname':_0x5f4b4b['transferercalleridname'],'transfererconnectedlinenum':_0x5f4b4b['transfererconnectedlinenum'],'transfererconnectedlinename':_0x5f4b4b['transfererconnectedlinename'],'transfereraccountcode':_0x5f4b4b['transfereraccountcode'],'transferercontext':_0x5f4b4b[_0xc8e9('0x6')],'transfererexten':_0x5f4b4b[_0xc8e9('0x7')],'transfererlinkedid':_0x5f4b4b[_0xc8e9('0x8')],'transfereechannel':_0x5f4b4b[_0xc8e9('0x9')],'transfereecalleridnum':_0x5f4b4b[_0xc8e9('0xa')],'transfereecalleridname':_0x5f4b4b[_0xc8e9('0xb')],'transfereeconnectedlinenum':_0x5f4b4b[_0xc8e9('0xc')],'transfereeconnectedlinename':_0x5f4b4b[_0xc8e9('0xd')],'transfereeaccountcode':_0x5f4b4b[_0xc8e9('0xe')],'transfereecontext':_0x5f4b4b[_0xc8e9('0xf')],'transfereeexten':_0x5f4b4b[_0xc8e9('0x10')],'transfereelinkedid':_0x5f4b4b[_0xc8e9('0x11')],'isexternal':_0x5f4b4b[_0xc8e9('0x12')],'context':_0x5f4b4b[_0xc8e9('0x13')],'extension':_0x5f4b4b[_0xc8e9('0x14')],'type':'blind'},'log':_0xc8e9('0x3')});};exports[_0xc8e9('0x15')]=function(_0x361a9a){return client[_0xc8e9('0x2')](_0xc8e9('0x3'),{'body':{'result':_0x361a9a[_0xc8e9('0x4')],'transfererchannel':_0x361a9a[_0xc8e9('0x16')],'transferercalleridnum':_0x361a9a[_0xc8e9('0x17')],'transferercalleridname':_0x361a9a[_0xc8e9('0x18')],'transfererconnectedlinenum':_0x361a9a[_0xc8e9('0x19')],'transfererconnectedlinename':_0x361a9a['secondtransfererconnectedlinename'],'transfereraccountcode':_0x361a9a[_0xc8e9('0x1a')],'transferercontext':_0x361a9a[_0xc8e9('0x1b')],'transfererexten':_0x361a9a[_0xc8e9('0x1c')],'transfererlinkedid':_0x361a9a[_0xc8e9('0x1d')],'transfereechannel':_0x361a9a[_0xc8e9('0x1e')],'transfereecalleridnum':_0x361a9a['transfertargetcalleridnum'],'transfereecalleridname':_0x361a9a[_0xc8e9('0x1f')],'transfereeconnectedlinenum':_0x361a9a[_0xc8e9('0x20')],'transfereeconnectedlinename':_0x361a9a[_0xc8e9('0x21')],'transfereeaccountcode':_0x361a9a['transfertargetaccountcode'],'transfereecontext':_0x361a9a[_0xc8e9('0x22')],'transfereeexten':_0x361a9a[_0xc8e9('0x23')],'transfereelinkedid':_0x361a9a[_0xc8e9('0x24')],'isexternal':_0x361a9a[_0xc8e9('0x12')],'context':_0x361a9a['origtransferercontext'],'extension':_0x361a9a['origtransfererexten'],'type':_0xc8e9('0x25')},'log':_0xc8e9('0x3')});}; \ No newline at end of file +var _0x170c=['transfererchannel','transferercalleridname','transfereraccountcode','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','Request','origtransferercalleridname','secondtransfererconnectedlinename','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','CreateVoiceTransferReport','result'];(function(_0x433634,_0x4ea38a){var _0x55ca40=function(_0x35ffcf){while(--_0x35ffcf){_0x433634['push'](_0x433634['shift']());}};_0x55ca40(++_0x4ea38a);}(_0x170c,0xf7));var _0xc170=function(_0x52354c,_0x50e4ee){_0x52354c=_0x52354c-0x0;var _0x1af598=_0x170c[_0x52354c];return _0x1af598;};'use strict';var client=require(_0xc170('0x0'));exports[_0xc170('0x1')]={};exports[_0xc170('0x2')]=function(_0x15e43b){return client['Request'](_0xc170('0x3'),{'body':{'result':_0x15e43b[_0xc170('0x4')],'transfererchannel':_0x15e43b[_0xc170('0x5')],'transferercalleridnum':_0x15e43b['transferercalleridnum'],'transferercalleridname':_0x15e43b[_0xc170('0x6')],'transfererconnectedlinenum':_0x15e43b['transfererconnectedlinenum'],'transfererconnectedlinename':_0x15e43b['transfererconnectedlinename'],'transfereraccountcode':_0x15e43b[_0xc170('0x7')],'transferercontext':_0x15e43b['transferercontext'],'transfererexten':_0x15e43b['transfererexten'],'transfererlinkedid':_0x15e43b[_0xc170('0x8')],'transfereechannel':_0x15e43b['transfereechannel'],'transfereecalleridnum':_0x15e43b[_0xc170('0x9')],'transfereecalleridname':_0x15e43b[_0xc170('0xa')],'transfereeconnectedlinenum':_0x15e43b[_0xc170('0xb')],'transfereeconnectedlinename':_0x15e43b[_0xc170('0xc')],'transfereeaccountcode':_0x15e43b[_0xc170('0xd')],'transfereecontext':_0x15e43b[_0xc170('0xe')],'transfereeexten':_0x15e43b[_0xc170('0xf')],'transfereelinkedid':_0x15e43b[_0xc170('0x10')],'isexternal':_0x15e43b[_0xc170('0x11')],'context':_0x15e43b[_0xc170('0x12')],'extension':_0x15e43b[_0xc170('0x13')],'type':_0xc170('0x14')},'log':_0xc170('0x3')});};exports[_0xc170('0x15')]=function(_0x156472){return client[_0xc170('0x16')](_0xc170('0x3'),{'body':{'result':_0x156472[_0xc170('0x4')],'transfererchannel':_0x156472['origtransfererchannel'],'transferercalleridnum':_0x156472['origtransferercalleridnum'],'transferercalleridname':_0x156472[_0xc170('0x17')],'transfererconnectedlinenum':_0x156472['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x156472[_0xc170('0x18')],'transfereraccountcode':_0x156472['origtransfereraccountcode'],'transferercontext':_0x156472['secondtransferercontext'],'transfererexten':_0x156472['secondtransfererexten'],'transfererlinkedid':_0x156472[_0xc170('0x19')],'transfereechannel':_0x156472[_0xc170('0x1a')],'transfereecalleridnum':_0x156472[_0xc170('0x1b')],'transfereecalleridname':_0x156472['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x156472[_0xc170('0x1c')],'transfereeconnectedlinename':_0x156472[_0xc170('0x1d')],'transfereeaccountcode':_0x156472['transfertargetaccountcode'],'transfereecontext':_0x156472[_0xc170('0x1e')],'transfereeexten':_0x156472[_0xc170('0x1f')],'transfereelinkedid':_0x156472[_0xc170('0x20')],'isexternal':_0x156472[_0xc170('0x11')],'context':_0x156472[_0xc170('0x21')],'extension':_0x156472[_0xc170('0x22')],'type':_0xc170('0x23')},'log':_0xc170('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index fb29c56..fc51e7e 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 _0xa23f=['isConnected','error','asterisk','username','ami\x20disconnected','join','pick','module','action','Reload','Action','then','command','content','message','voiceQueues','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','total','unmanaged','abandoned','loggedInDb','type','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','name','active','callerid','Interval','length','find','omit','undefined','values','channels','validate','map','uniqueid','channel','%s.%s','filename','wav','MixMonitor','monitors','/var/spool/asterisk/monitor/','isNil','push','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','MixMonitor\x20Success','toLowerCase','Channel\x20doesn\x27t\x20exist','resolve','destinationchannel','StopMixMonitor','catch','stop','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','campaigns','run','custom:','event','faxAccounts','send','checkAfterSend','server','http','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','bluebird','moment','../../../config/environment','../properties','listen','format','%s/%s','SIP','timers','timer','updateAcw','agents','pause','QueuePause'];(function(_0x374ac5,_0x1f8cbd){var _0x29e069=function(_0x2a3abc){while(--_0x2a3abc){_0x374ac5['push'](_0x374ac5['shift']());}};_0x29e069(++_0x1f8cbd);}(_0xa23f,0x7c));var _0xfa23=function(_0x51500b,_0x137d5c){_0x51500b=_0x51500b-0x0;var _0x5405df=_0xa23f[_0x51500b];return _0x5405df;};'use strict';var _=require(_0xfa23('0x0'));var util=require(_0xfa23('0x1'));var jayson=require('jayson/promise');var schema=require('validate');var BPromise=require(_0xfa23('0x2'));var moment=require(_0xfa23('0x3'));var config=require(_0xfa23('0x4'));var properties=require(_0xfa23('0x5'));var ami=require('../ami');exports[_0xfa23('0x6')]=function(_0x53d8c8,_0x210057,_0x2df2f5){return new BPromise(function(_0x4c3f4,_0x3696ef){var _0x4fb6e6={'QueuePause':function(_0x5a7882){return new Promise(function(_0x59d53e,_0x19a1ac){var _0x4066a2=util[_0xfa23('0x7')](_0xfa23('0x8'),_0xfa23('0x9'),_0x5a7882['name']);if(_0x53d8c8['timers']&&_0x53d8c8[_0xfa23('0xa')][_0x4066a2]&&_0x53d8c8['timers'][_0x4066a2][_0xfa23('0xb')]){_0x53d8c8['timers'][_0x4066a2][_0xfa23('0xc')]();}if(_0x53d8c8[_0xfa23('0xd')][_0x4066a2]){_0x53d8c8[_0xfa23('0xd')][_0x4066a2]['updateStatusRealtime']({'statePause':_0x5a7882[_0xfa23('0xe')]?!![]:![]});}_0x59d53e({'code':0xc8,'message':_0xfa23('0xf')});});},'Reload':function(_0x46f991){var _0x5ea9ca=this;return new Promise(function(_0x56f927,_0x17e782){if(ami[_0xfa23('0x10')]()==![]){return _0x17e782(_0x5ea9ca[_0xfa23('0x11')](0x1f4,[config[_0xfa23('0x12')]['ip'],config['asterisk'][_0xfa23('0x13')],_0xfa23('0x14')][_0xfa23('0x15')]('\x20')));}_0x46f991=_[_0xfa23('0x16')](_0x46f991,_['keys'](properties[_0xfa23('0x17')]));_0x46f991[_0xfa23('0x18')]=_0xfa23('0x19');return ami[_0xfa23('0x1a')](_0x46f991)[_0xfa23('0x1b')](function(_0x4e5b77){_0x56f927({'code':0xc8,'message':_0x4e5b77['message']});})['catch'](function(_0x445bd0){_0x17e782(_0x5ea9ca[_0xfa23('0x11')](0x1f5,_0x445bd0['message']));});});},'Command':function(_0x9effe6){var _0x2c456b=this;return new Promise(function(_0x1eb87e,_0x54bb04){if(ami[_0xfa23('0x10')]()==![]){return _0x54bb04(_0x2c456b[_0xfa23('0x11')](0x1f4,[config['asterisk']['ip'],config[_0xfa23('0x12')][_0xfa23('0x13')],_0xfa23('0x14')][_0xfa23('0x15')]('\x20')));}_0x9effe6=_[_0xfa23('0x16')](_0x9effe6,_0xfa23('0x1c'));_0x9effe6[_0xfa23('0x18')]='Command';return ami[_0xfa23('0x1a')](_0x9effe6)[_0xfa23('0x1b')](function(_0x34a2ce){_0x1eb87e({'code':0xc8,'message':_0x34a2ce[_0xfa23('0x1d')]});})['catch'](function(_0x4500a2){_0x54bb04(_0x2c456b['error'](0x1f5,_0x4500a2[_0xfa23('0x1e')]));});});},'VoiceQueues':function(_0x1abb42){return new Promise(function(_0x2481e9,_0x26bdce){var _0x3362f3=[];for(var _0x1340d9 in _0x53d8c8[_0xfa23('0x1f')]){if(_0x53d8c8[_0xfa23('0x1f')]['hasOwnProperty'](_0x1340d9)){var _0x2ae826=_0x53d8c8['voiceQueues'][_0x1340d9];var _0x1ae38a={'id':_0x2ae826['id'],'name':_0x2ae826['name'],'strategy':_0x2ae826['strategy'],'answered':_0x2ae826[_0xfa23('0x20')],'available':_0x2ae826[_0xfa23('0x21')],'loggedIn':_0x2ae826[_0xfa23('0x22')],'pTalking':_0x2ae826[_0xfa23('0x23')],'sumBillable':_0x2ae826[_0xfa23('0x24')],'sumDuration':_0x2ae826[_0xfa23('0x25')],'sumHoldTime':_0x2ae826[_0xfa23('0x26')]||0x0,'talking':_0x2ae826['talking'],'total':_0x2ae826[_0xfa23('0x27')],'type':_0x2ae826['type'],'unmanaged':_0x2ae826[_0xfa23('0x28')],'abandoned':_0x2ae826[_0xfa23('0x29')],'waiting':_0x2ae826['waiting'],'loggedInDb':_0x2ae826[_0xfa23('0x2a')]};if(_0x2ae826[_0xfa23('0x2b')]===_0xfa23('0x2c')){_0x1ae38a[_0xfa23('0x2d')]=_0x2ae826[_0xfa23('0x2d')];_0x1ae38a[_0xfa23('0x2e')]=_0x2ae826[_0xfa23('0x2e')];_0x1ae38a[_0xfa23('0x2f')]=_0x2ae826[_0xfa23('0x2f')];_0x1ae38a['dialOriginateCallerIdNumber']=_0x2ae826[_0xfa23('0x30')];_0x1ae38a['dialOriginateTimeout']=_0x2ae826[_0xfa23('0x31')];_0x1ae38a[_0xfa23('0x32')]=_0x2ae826[_0xfa23('0x32')];_0x1ae38a[_0xfa23('0x33')]=_0x2ae826[_0xfa23('0x33')];_0x1ae38a[_0xfa23('0x34')]=_0x2ae826[_0xfa23('0x34')];_0x1ae38a[_0xfa23('0x35')]=_0x2ae826[_0xfa23('0x35')];_0x1ae38a['outboundBlacklistCallsDay']=_0x2ae826[_0xfa23('0x36')];_0x1ae38a['outboundBusyCallsDay']=_0x2ae826[_0xfa23('0x37')];_0x1ae38a[_0xfa23('0x38')]=_0x2ae826[_0xfa23('0x38')];_0x1ae38a[_0xfa23('0x39')]=_0x2ae826[_0xfa23('0x39')];_0x1ae38a[_0xfa23('0x3a')]=_0x2ae826[_0xfa23('0x3a')];_0x1ae38a['outboundDropCallsDayTimeout']=_0x2ae826[_0xfa23('0x3b')];_0x1ae38a[_0xfa23('0x3c')]=_0x2ae826[_0xfa23('0x3c')];_0x1ae38a[_0xfa23('0x3d')]=_0x2ae826['outboundNoSuchCallsDay'];_0x1ae38a['outboundOriginateFailureCallsDay']=_0x2ae826['outboundOriginateFailureCallsDay'];_0x1ae38a[_0xfa23('0x3e')]=_0x2ae826[_0xfa23('0x3e')];_0x1ae38a['outboundRejectCallsDay']=_0x2ae826[_0xfa23('0x3f')];_0x1ae38a[_0xfa23('0x40')]=_0x2ae826[_0xfa23('0x40')];_0x1ae38a['predictiveIntervalAnsweredCalls']=_0x2ae826[_0xfa23('0x41')];_0x1ae38a['predictiveIntervalAvgHoldtime']=_0x2ae826[_0xfa23('0x42')];_0x1ae38a[_0xfa23('0x43')]=_0x2ae826[_0xfa23('0x43')];_0x1ae38a[_0xfa23('0x44')]=_0x2ae826[_0xfa23('0x44')];_0x1ae38a[_0xfa23('0x45')]=_0x2ae826['predictiveIntervalDroppedCallsTimeout'];_0x1ae38a[_0xfa23('0x46')]=_0x2ae826[_0xfa23('0x46')];_0x1ae38a[_0xfa23('0x47')]=_0x2ae826[_0xfa23('0x47')];_0x1ae38a['predictiveIntervalHitRate']=_0x2ae826[_0xfa23('0x48')];_0x1ae38a[_0xfa23('0x49')]=_0x2ae826[_0xfa23('0x49')];_0x1ae38a[_0xfa23('0x4a')]=_0x2ae826[_0xfa23('0x4a')];_0x1ae38a[_0xfa23('0x4b')]=_0x2ae826['predictiveIntervalAvailable'];_0x1ae38a[_0xfa23('0x4c')]=_0x2ae826['predictiveIntervalTotalCalls'];_0x1ae38a['message']=_0x2ae826[_0xfa23('0x1e')];_0x1ae38a[_0xfa23('0x4d')]=_0x2ae826['originated'];_0x1ae38a[_0xfa23('0x4e')]=_0x2ae826[_0xfa23('0x4e')];_0x1ae38a[_0xfa23('0x4f')]=_0x2ae826['erlangCallToSecond'];_0x1ae38a[_0xfa23('0x50')]=_0x2ae826[_0xfa23('0x50')];_0x1ae38a[_0xfa23('0x51')]=_0x2ae826['erlangBusyFactor'];_0x1ae38a['startPredictive']=_0x2ae826[_0xfa23('0x52')];_0x1ae38a['startProgressive']=_0x2ae826[_0xfa23('0x53')];}if(_0x2ae826[_0xfa23('0x54')]){_0x1ae38a[_0xfa23('0x54')]={'id':_0x2ae826['Trunk']['id'],'name':_0x2ae826[_0xfa23('0x54')][_0xfa23('0x55')],'active':_0x2ae826[_0xfa23('0x54')][_0xfa23('0x56')],'callerid':_0x2ae826['Trunk'][_0xfa23('0x57')]};}if(_0x2ae826[_0xfa23('0x58')]){_0x1ae38a[_0xfa23('0x58')]={'id':_0x2ae826['Interval']['id'],'name':_0x2ae826['Interval'][_0xfa23('0x55')]};}_0x3362f3['push'](_0x1ae38a);}}_0x2481e9({'count':_0x3362f3[_0xfa23('0x59')],'rows':_0x3362f3});});},'UpdateVoiceQueue':function(_0x3bddca){return new Promise(function(_0x12b986,_0xf8b228){var _0x2fbf18=_[_0xfa23('0x5a')](_0x53d8c8['voiceQueues'],{'id':parseInt(_0x3bddca['id'])});var _0xd2345d=_[_0xfa23('0x5b')](_0x3bddca,['id']);if(_0x2fbf18){for(var _0x36a795 in _0xd2345d){if(typeof _0xd2345d[_0x36a795]!==_0xfa23('0x5c')&&typeof _0x2fbf18[_0x36a795]!==_0xfa23('0x5c')){_0x2fbf18[_0x36a795]=_0xd2345d[_0x36a795];}}_0x12b986(_0x2fbf18);}else{_0xf8b228();}});},'VoiceChannels':function(_0xf8b8c7){return new Promise(function(_0x4aba2a,_0x9e8cb6){var _0x36a02c=_[_0xfa23('0x5d')](_0x53d8c8[_0xfa23('0x5e')]);_0x4aba2a({'count':_0x36a02c[_0xfa23('0x59')],'rows':_0x36a02c});});},'VoiceChannelMixMonitor':function(_0x4bfe28){var _0x1fbdff=this;return new Promise(function(_0x213fcd,_0x18afb9){if(ami['isConnected']()==![]){return _0x18afb9(_0x1fbdff[_0xfa23('0x11')](0x1f4,[config[_0xfa23('0x12')]['ip'],config[_0xfa23('0x12')][_0xfa23('0x13')],_0xfa23('0x14')][_0xfa23('0x15')]('\x20')));}var _0x709755=schema(properties['voicechannel'])[_0xfa23('0x5f')](_0x4bfe28);if(_0x709755['length']>0x0){return _0x18afb9(_0x1fbdff[_0xfa23('0x11')](0x1f4,_[_0xfa23('0x60')](_0x709755,_0xfa23('0x1e'))[_0xfa23('0x15')](',\x20')));}var _0x12a984=_[_0xfa23('0x5a')](_0x53d8c8['channels'],{'uniqueid':_0x4bfe28[_0xfa23('0x61')]});if(_0x12a984&&_0x12a984[_0xfa23('0x62')]){var _0x2ec20b=util[_0xfa23('0x7')](_0xfa23('0x63'),_0x4bfe28[_0xfa23('0x64')]||_0x4bfe28[_0xfa23('0x61')],_0x4bfe28['format']||_0xfa23('0x65'));return ami[_0xfa23('0x1a')]({'action':_0xfa23('0x66'),'channel':_0x12a984[_0xfa23('0x62')],'file':_0x2ec20b,'options':'ai(mixmonitorid)'})[_0xfa23('0x1b')](function(_0x9bf852){var _0xe6cf80=_[_0xfa23('0x5a')](_0x12a984[_0xfa23('0x67')],{'filename':_0xfa23('0x68')+_0x2ec20b['toLowerCase']()});if(_[_0xfa23('0x69')](_0xe6cf80)){_0x12a984['monitors'][_0xfa23('0x6a')]({'filename':_0xfa23('0x68')+_0x2ec20b['toLowerCase'](),'createdAt':moment()[_0xfa23('0x7')](_0xfa23('0x6b')),'mixmonitorid':_0x9bf852['mixmonitorid'],'status':_0xfa23('0x6c')});}else{_0xe6cf80[_0xfa23('0x6d')]=_0x9bf852['mixmonitorid'];_0xe6cf80[_0xfa23('0x6e')]=_0xfa23('0x6c');}_0x213fcd({'code':0xc8,'message':[_0x4bfe28[_0xfa23('0x61')],_0xfa23('0x6f'),_0x9bf852['mixmonitorid']][_0xfa23('0x15')]('\x20'),'mixmonitorid':_0x9bf852[_0xfa23('0x6d')]});})['catch'](function(_0x2d1c75){_0x18afb9(_0x1fbdff[_0xfa23('0x11')](0x1f5,[_0x4bfe28[_0xfa23('0x61')],_0x2d1c75[_0xfa23('0x1e')][_0xfa23('0x70')]()][_0xfa23('0x15')]('\x20')));});}else{return _0x18afb9(_0x1fbdff['error'](0x1f5,_0xfa23('0x71')));}});},'VoiceChannelStopMixMonitor':function(_0x3a7fcb){var _0x10eb86=this;return new Promise(function(_0x5d479e,_0x125c46){if(ami[_0xfa23('0x10')]()==![]){return _0x125c46(_0x10eb86[_0xfa23('0x11')](0x1f4,[config['asterisk']['ip'],config[_0xfa23('0x12')][_0xfa23('0x13')],_0xfa23('0x14')][_0xfa23('0x15')]('\x20')));}var _0x378d29=schema(properties['voicechannel'])['validate'](_0x3a7fcb);if(_0x378d29[_0xfa23('0x59')]>0x0){return _0x125c46(_0x10eb86[_0xfa23('0x11')](0x1f4,_[_0xfa23('0x60')](_0x378d29,_0xfa23('0x1e'))['join'](',\x20')));}var _0x5275d6=_[_0xfa23('0x5a')](_0x53d8c8[_0xfa23('0x5e')],{'uniqueid':_0x3a7fcb[_0xfa23('0x61')]});if(_0x5275d6){return BPromise[_0xfa23('0x72')]()['then'](function(){if(_0x5275d6[_0xfa23('0x62')]){return ami[_0xfa23('0x1a')]({'action':'StopMixMonitor','channel':_0x5275d6[_0xfa23('0x62')],'mixmonitorid':_0x3a7fcb[_0xfa23('0x6d')]})['catch'](function(_0x13af06){});}})[_0xfa23('0x1b')](function(){if(_0x5275d6[_0xfa23('0x73')]){return ami[_0xfa23('0x1a')]({'action':_0xfa23('0x74'),'channel':_0x5275d6[_0xfa23('0x73')],'mixmonitorid':_0x3a7fcb['mixmonitorid']})[_0xfa23('0x75')](function(_0x591953){});}})[_0xfa23('0x1b')](function(_0x263f8c){var _0x192d28=_[_0xfa23('0x5a')](_0x5275d6[_0xfa23('0x67')],{'mixmonitorid':_0x3a7fcb[_0xfa23('0x6d')]});if(_0x192d28){_0x192d28[_0xfa23('0x6e')]=_0xfa23('0x76');}})[_0xfa23('0x1b')](function(){var _0x4e05f0=util[_0xfa23('0x7')]('%s.%s',_0x3a7fcb[_0xfa23('0x64')]||_0x3a7fcb[_0xfa23('0x61')],_0x3a7fcb['format']||'wav');var _0x3f6070=_['find'](_0x5275d6[_0xfa23('0x67')],{'filename':_0xfa23('0x68')+_0x4e05f0[_0xfa23('0x70')]()});if(_0x3f6070){_0x3f6070[_0xfa23('0x6e')]=_0xfa23('0x76');}})[_0xfa23('0x1b')](function(){_0x5d479e({'code':0xc8,'message':[_0x3a7fcb[_0xfa23('0x61')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xfa23('0x75')](function(_0x1e540d){_0x125c46(_0x10eb86[_0xfa23('0x11')](0x1f5,[_0x3a7fcb[_0xfa23('0x61')],_0x1e540d['message'][_0xfa23('0x70')]()]['join']('\x20')));});}else{return _0x125c46(_0x10eb86[_0xfa23('0x11')](0x1f5,_0xfa23('0x71')));}});},'VoiceQueuesChannels':function(_0x20c757){return new Promise(function(_0x279d86,_0x74a9aa){var _0x3bf459=_[_0xfa23('0x5d')](_0x53d8c8[_0xfa23('0x77')]);_0x279d86({'count':_0x3bf459[_0xfa23('0x59')],'rows':_0x3bf459});});},'VoiceQueuesChannel':function(_0x4130cf){var _0x5c3a1e=this;return new Promise(function(_0x5b1337,_0x146e12){var _0x53fac6=schema(properties[_0xfa23('0x78')])['validate'](_0x4130cf);if(_0x53fac6[_0xfa23('0x59')]>0x0){return _0x146e12(_0x5c3a1e[_0xfa23('0x11')](0x1f4,_['map'](_0x53fac6,_0xfa23('0x1e'))['join'](',\x20')));}var _0x4e0a93=_[_0xfa23('0x5a')](_0x53d8c8[_0xfa23('0x77')],{'uniqueid':_0x4130cf['uniqueid']});if(_0x4e0a93){_0x5b1337(_0x4e0a93);}else{return _0x146e12(_0x5c3a1e[_0xfa23('0x11')](0x1f5,_0xfa23('0x71')));}});},'VoiceQueuesChannelHangup':function(_0x2bd0f9){var _0x41287e=this;return new Promise(function(_0x3da38c,_0x1f359a){if(ami[_0xfa23('0x10')]()==![]){return _0x1f359a(_0x41287e['error'](0x1f4,[config[_0xfa23('0x12')]['ip'],config[_0xfa23('0x12')][_0xfa23('0x13')],_0xfa23('0x14')][_0xfa23('0x15')]('\x20')));}var _0x4c525f=schema(properties[_0xfa23('0x79')])['validate'](_0x2bd0f9);if(_0x4c525f['length']>0x0){return _0x1f359a(_0x41287e['error'](0x1f4,_[_0xfa23('0x60')](_0x4c525f,_0xfa23('0x1e'))[_0xfa23('0x15')](',\x20')));}var _0x4bdfee=_[_0xfa23('0x5a')](_0x53d8c8[_0xfa23('0x77')],{'uniqueid':_0x2bd0f9['uniqueid']});if(_0x4bdfee&&_0x4bdfee[_0xfa23('0x62')]){return ami[_0xfa23('0x1a')]({'action':_0xfa23('0x7a'),'channel':_0x4bdfee[_0xfa23('0x62')]})['then'](function(_0x5ef233){_0x3da38c({'code':0xc8,'message':[_0x2bd0f9[_0xfa23('0x61')],_0x5ef233['message'][_0xfa23('0x70')]()][_0xfa23('0x15')]('\x20')});})[_0xfa23('0x75')](function(_0x4a77e5){_0x1f359a(_0x41287e[_0xfa23('0x11')](0x1f5,[_0x2bd0f9[_0xfa23('0x61')],_0x4a77e5[_0xfa23('0x1e')][_0xfa23('0x70')]()][_0xfa23('0x15')]('\x20')));});}else{return _0x1f359a(_0x41287e[_0xfa23('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x1f2103){var _0x1f28a0=this;return new Promise(function(_0x37548a,_0x37d22c){if(ami[_0xfa23('0x10')]()==![]){return _0x37d22c(_0x1f28a0[_0xfa23('0x11')](0x1f4,[config['asterisk']['ip'],config[_0xfa23('0x12')][_0xfa23('0x13')],'ami\x20disconnected'][_0xfa23('0x15')]('\x20')));}var _0x1f3286=schema(properties[_0xfa23('0x7b')])[_0xfa23('0x5f')](_0x1f2103);if(_0x1f3286[_0xfa23('0x59')]>0x0){return _0x37d22c(_0x1f28a0['error'](0x1f4,_[_0xfa23('0x60')](_0x1f3286,'message')['join'](',\x20')));}var _0x5e54bf=_['find'](_0x53d8c8[_0xfa23('0x77')],{'uniqueid':_0x1f2103['uniqueid']});if(_0x5e54bf&&_0x5e54bf[_0xfa23('0x62')]){return ami[_0xfa23('0x1a')]({'action':_0xfa23('0x7c'),'channel':_0x5e54bf[_0xfa23('0x62')],'exten':_0x1f2103[_0xfa23('0x7d')],'context':_0x1f2103[_0xfa23('0x7e')]||_0x5e54bf[_0xfa23('0x7e')],'priority':0x1})[_0xfa23('0x1b')](function(_0x53d266){_0x37548a({'code':0xc8,'message':[_0x1f2103[_0xfa23('0x61')],_0x53d266['message'][_0xfa23('0x70')]()][_0xfa23('0x15')]('\x20')});})['catch'](function(_0x2c4684){_0x37d22c(_0x1f28a0[_0xfa23('0x11')](0x1f5,[_0x1f2103['uniqueid'],_0x2c4684[_0xfa23('0x1e')]['toLowerCase']()][_0xfa23('0x15')]('\x20')));});}else{return _0x37d22c(_0x1f28a0['error'](0x1f5,_0xfa23('0x71')));}});},'Agents':function(_0x500dde){return new Promise(function(_0xea852,_0x249322){var _0x5751f5=_[_0xfa23('0x5d')](_0x53d8c8[_0xfa23('0xd')]);_0xea852({'count':_0x5751f5[_0xfa23('0x59')],'rows':_0x5751f5});});},'Telephones':function(_0x4c19d3){return new Promise(function(_0xf65690,_0x518e4d){var _0xfee428=_[_0xfa23('0x5d')](_0x53d8c8[_0xfa23('0x7f')]);_0xf65690({'count':_0xfee428[_0xfa23('0x59')],'rows':_0xfee428});});},'Trunks':function(_0x58f34e){return new Promise(function(_0x3e0a3e,_0x4aa9ba){var _0x30c836=_['values'](_0x53d8c8[_0xfa23('0x80')]);_0x3e0a3e({'count':_0x30c836[_0xfa23('0x59')],'rows':_0x30c836});});},'OutboundChannels':function(_0x70ba0f){return new Promise(function(_0x376b22,_0x3b5c4b){var _0x51e5fc=_[_0xfa23('0x5d')](_0x53d8c8['outboundChannels']);_0x376b22({'count':_0x51e5fc['length'],'rows':_0x51e5fc});});},'Outbound':function(_0x1bf189){return new Promise(function(_0x2c1e16,_0x37710e){_0x2c1e16(_0x53d8c8[_0xfa23('0x2c')]);});},'Campaigns':function(_0x49d168){return new Promise(function(_0x367701,_0x3ee296){var _0x1d300b=_[_0xfa23('0x5d')](_0x53d8c8[_0xfa23('0x81')]);_0x367701({'count':_0x1d300b[_0xfa23('0x59')],'rows':_0x1d300b});});},'VoiceQueuesPreview':function(_0x2bdc8e){var _0x331c65=this;return new Promise(function(_0x2afcf4,_0x1d657d){_0x210057[_0xfa23('0x82')](_0x2bdc8e['id'])[_0xfa23('0x1b')](function(_0x561942){_0x2afcf4({'code':0xc8,'message':_0x561942[_0xfa23('0x1e')]});})[_0xfa23('0x75')](function(_0x250869){_0x1d657d(_0x331c65[_0xfa23('0x11')](0x1f4,_0x250869[_0xfa23('0x1e')]));});});},'EventManager':function(_0x1cb225){var _0x43ea=this;return new Promise(function(_0x5a4ec3,_0x16ad12){if(!_0x1cb225['event']){return _0x16ad12(_0x43ea['error'](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0xfa23('0x83')+_0x1cb225[_0xfa23('0x84')],_0x1cb225[_0xfa23('0x1e')]);_0x5a4ec3({'code':0xc8,'message':_0x1cb225});});},'FaxAccounts':function(_0x4da911){return new Promise(function(_0x413eff,_0x1d5f64){var _0x28ed8c=_[_0xfa23('0x5d')](_0x53d8c8[_0xfa23('0x85')]);_0x413eff({'count':_0x28ed8c['length'],'rows':_0x28ed8c});});},'SendFax':function(_0x1633eb){var _0x45c355=this;return new Promise(function(_0x19acfa,_0x154e8c){_0x2df2f5[_0xfa23('0x86')](_0x1633eb)[_0xfa23('0x1b')](function(_0x5618ed){_0x19acfa({'code':0xc8,'message':_0x5618ed['message']});})['catch'](function(_0x590f3f){_0x154e8c(_0x45c355[_0xfa23('0x11')](0x1f4,_0x590f3f[_0xfa23('0x1e')]));});});},'CheckAfterSend':function(_0x27fedb){var _0xa547c4=this;return new Promise(function(_0xed12f2,_0x5d4222){_0x2df2f5[_0xfa23('0x87')](_0x27fedb)[_0xfa23('0x1b')](function(_0x36b9c5){_0xed12f2({'code':0xc8,'message':_0x36b9c5['message']});})[_0xfa23('0x75')](function(_0x4cb34a){_0x5d4222(_0xa547c4['error'](0x1f4,_0x4cb34a[_0xfa23('0x1e')]));});});}};var _0x31b96e=jayson[_0xfa23('0x88')](_0x4fb6e6)[_0xfa23('0x89')]();_0x31b96e['on']('error',function(_0x6bdaf0){return _0x3696ef(_0x6bdaf0);});_0x31b96e[_0xfa23('0x6')](0x232a,'127.0.0.1',function(){console[_0xfa23('0x8a')](_0xfa23('0x8b'),0x232a);return _0x4c3f4('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0xb4c7=['find','omit','undefined','values','channels','uniqueid','channel','%s.%s','filename','wav','MixMonitor','ai(mixmonitorid)','toLowerCase','/var/spool/asterisk/monitor/','rec','mixmonitorid','MixMonitor\x20Success','voicechannel','resolve','StopMixMonitor','destinationchannel','monitors','status','stop','StopMixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','queueChannels','map','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','outboundChannels','outbound','campaigns','run','event','emit','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','../../../config/environment','../properties','../ami','listen','format','%s/%s','SIP','name','timers','timer','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Action','then','message','command','Command','content','catch','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','unmanaged','abandoned','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length'];(function(_0x412c68,_0x4cdc64){var _0x1fc467=function(_0x3f86dc){while(--_0x3f86dc){_0x412c68['push'](_0x412c68['shift']());}};_0x1fc467(++_0x4cdc64);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x460b0d,_0x51c9e4){_0x460b0d=_0x460b0d-0x0;var _0x48079f=_0xb4c7[_0x460b0d];return _0x48079f;};'use strict';var _=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var jayson=require(_0x7b4c('0x2'));var schema=require(_0x7b4c('0x3'));var BPromise=require(_0x7b4c('0x4'));var moment=require('moment');var config=require(_0x7b4c('0x5'));var properties=require(_0x7b4c('0x6'));var ami=require(_0x7b4c('0x7'));exports[_0x7b4c('0x8')]=function(_0x2d9945,_0x5adec9,_0x1b0f57){return new BPromise(function(_0x10e197,_0x2dd5c7){var _0x4bf85d={'QueuePause':function(_0x2d7b7e){return new Promise(function(_0x21687f,_0x570daa){var _0x433aa2=util[_0x7b4c('0x9')](_0x7b4c('0xa'),_0x7b4c('0xb'),_0x2d7b7e[_0x7b4c('0xc')]);if(_0x2d9945[_0x7b4c('0xd')]&&_0x2d9945[_0x7b4c('0xd')][_0x433aa2]&&_0x2d9945[_0x7b4c('0xd')][_0x433aa2][_0x7b4c('0xe')]){_0x2d9945[_0x7b4c('0xd')][_0x433aa2]['updateAcw']();}if(_0x2d9945['agents'][_0x433aa2]){_0x2d9945[_0x7b4c('0xf')][_0x433aa2][_0x7b4c('0x10')]({'statePause':_0x2d7b7e[_0x7b4c('0x11')]?!![]:![]});}_0x21687f({'code':0xc8,'message':_0x7b4c('0x12')});});},'Reload':function(_0x3e1558){var _0x341d36=this;return new Promise(function(_0x3ea0da,_0x40c830){if(ami[_0x7b4c('0x13')]()==![]){return _0x40c830(_0x341d36[_0x7b4c('0x14')](0x1f4,[config['asterisk']['ip'],config[_0x7b4c('0x15')][_0x7b4c('0x16')],_0x7b4c('0x17')][_0x7b4c('0x18')]('\x20')));}_0x3e1558=_[_0x7b4c('0x19')](_0x3e1558,_[_0x7b4c('0x1a')](properties[_0x7b4c('0x1b')]));_0x3e1558[_0x7b4c('0x1c')]='Reload';return ami[_0x7b4c('0x1d')](_0x3e1558)[_0x7b4c('0x1e')](function(_0x15a5a9){_0x3ea0da({'code':0xc8,'message':_0x15a5a9[_0x7b4c('0x1f')]});})['catch'](function(_0x3ce10c){_0x40c830(_0x341d36[_0x7b4c('0x14')](0x1f5,_0x3ce10c[_0x7b4c('0x1f')]));});});},'Command':function(_0x380b79){var _0x2d4c72=this;return new Promise(function(_0x1363b4,_0x237110){if(ami[_0x7b4c('0x13')]()==![]){return _0x237110(_0x2d4c72[_0x7b4c('0x14')](0x1f4,[config['asterisk']['ip'],config[_0x7b4c('0x15')][_0x7b4c('0x16')],_0x7b4c('0x17')][_0x7b4c('0x18')]('\x20')));}_0x380b79=_[_0x7b4c('0x19')](_0x380b79,_0x7b4c('0x20'));_0x380b79[_0x7b4c('0x1c')]=_0x7b4c('0x21');return ami[_0x7b4c('0x1d')](_0x380b79)[_0x7b4c('0x1e')](function(_0x5eec1e){_0x1363b4({'code':0xc8,'message':_0x5eec1e[_0x7b4c('0x22')]});})[_0x7b4c('0x23')](function(_0x276271){_0x237110(_0x2d4c72[_0x7b4c('0x14')](0x1f5,_0x276271[_0x7b4c('0x1f')]));});});},'VoiceQueues':function(_0x2bdc4d){return new Promise(function(_0x37c059,_0x459eb4){var _0x1f311e=[];for(var _0x1a69db in _0x2d9945[_0x7b4c('0x24')]){if(_0x2d9945[_0x7b4c('0x24')][_0x7b4c('0x25')](_0x1a69db)){var _0x501f75=_0x2d9945[_0x7b4c('0x24')][_0x1a69db];var _0x3ab614={'id':_0x501f75['id'],'name':_0x501f75[_0x7b4c('0xc')],'strategy':_0x501f75[_0x7b4c('0x26')],'answered':_0x501f75[_0x7b4c('0x27')],'available':_0x501f75[_0x7b4c('0x28')],'loggedIn':_0x501f75[_0x7b4c('0x29')],'pTalking':_0x501f75[_0x7b4c('0x2a')],'sumBillable':_0x501f75[_0x7b4c('0x2b')],'sumDuration':_0x501f75[_0x7b4c('0x2c')],'sumHoldTime':_0x501f75[_0x7b4c('0x2d')]||0x0,'talking':_0x501f75[_0x7b4c('0x2e')],'total':_0x501f75[_0x7b4c('0x2f')],'type':_0x501f75[_0x7b4c('0x30')],'unmanaged':_0x501f75[_0x7b4c('0x31')],'abandoned':_0x501f75[_0x7b4c('0x32')],'waiting':_0x501f75[_0x7b4c('0x33')],'loggedInDb':_0x501f75[_0x7b4c('0x34')]};if(_0x501f75[_0x7b4c('0x30')]==='outbound'){_0x3ab614['dialActive']=_0x501f75['dialActive'];_0x3ab614[_0x7b4c('0x35')]=_0x501f75[_0x7b4c('0x35')];_0x3ab614[_0x7b4c('0x36')]=_0x501f75[_0x7b4c('0x36')];_0x3ab614['dialOriginateCallerIdNumber']=_0x501f75[_0x7b4c('0x37')];_0x3ab614[_0x7b4c('0x38')]=_0x501f75['dialOriginateTimeout'];_0x3ab614[_0x7b4c('0x39')]=_0x501f75['dialPrefix'];_0x3ab614[_0x7b4c('0x3a')]=_0x501f75[_0x7b4c('0x3a')];_0x3ab614[_0x7b4c('0x3b')]=_0x501f75['outboundAnswerAgiCallsDay'];_0x3ab614[_0x7b4c('0x3c')]=_0x501f75[_0x7b4c('0x3c')];_0x3ab614['outboundBlacklistCallsDay']=_0x501f75[_0x7b4c('0x3d')];_0x3ab614[_0x7b4c('0x3e')]=_0x501f75[_0x7b4c('0x3e')];_0x3ab614[_0x7b4c('0x3f')]=_0x501f75['outboundCongestionCallsDay'];_0x3ab614['outboundDropCallsDayACS']=_0x501f75[_0x7b4c('0x40')];_0x3ab614[_0x7b4c('0x41')]=_0x501f75['outboundDropCallsDayCallersExit'];_0x3ab614[_0x7b4c('0x42')]=_0x501f75['outboundDropCallsDayTimeout'];_0x3ab614['outboundNoAnswerCallsDay']=_0x501f75[_0x7b4c('0x43')];_0x3ab614[_0x7b4c('0x44')]=_0x501f75[_0x7b4c('0x44')];_0x3ab614[_0x7b4c('0x45')]=_0x501f75['outboundOriginateFailureCallsDay'];_0x3ab614[_0x7b4c('0x46')]=_0x501f75[_0x7b4c('0x46')];_0x3ab614[_0x7b4c('0x47')]=_0x501f75[_0x7b4c('0x47')];_0x3ab614[_0x7b4c('0x48')]=_0x501f75[_0x7b4c('0x48')];_0x3ab614[_0x7b4c('0x49')]=_0x501f75['predictiveIntervalAnsweredCalls'];_0x3ab614['predictiveIntervalAvgHoldtime']=_0x501f75[_0x7b4c('0x4a')];_0x3ab614[_0x7b4c('0x4b')]=_0x501f75[_0x7b4c('0x4b')];_0x3ab614[_0x7b4c('0x4c')]=_0x501f75[_0x7b4c('0x4c')];_0x3ab614['predictiveIntervalDroppedCallsTimeout']=_0x501f75[_0x7b4c('0x4d')];_0x3ab614[_0x7b4c('0x4e')]=_0x501f75[_0x7b4c('0x4e')];_0x3ab614[_0x7b4c('0x4f')]=_0x501f75[_0x7b4c('0x4f')];_0x3ab614[_0x7b4c('0x50')]=_0x501f75[_0x7b4c('0x50')];_0x3ab614[_0x7b4c('0x51')]=_0x501f75[_0x7b4c('0x51')];_0x3ab614['predictiveIntervalPauses']=_0x501f75[_0x7b4c('0x52')];_0x3ab614['predictiveIntervalAvailable']=_0x501f75[_0x7b4c('0x53')];_0x3ab614['predictiveIntervalTotalCalls']=_0x501f75[_0x7b4c('0x54')];_0x3ab614[_0x7b4c('0x1f')]=_0x501f75['message'];_0x3ab614['originated']=_0x501f75[_0x7b4c('0x55')];_0x3ab614[_0x7b4c('0x56')]=_0x501f75[_0x7b4c('0x56')];_0x3ab614[_0x7b4c('0x57')]=_0x501f75['erlangCallToSecond'];_0x3ab614[_0x7b4c('0x58')]=_0x501f75[_0x7b4c('0x58')];_0x3ab614[_0x7b4c('0x59')]=_0x501f75['erlangBusyFactor'];_0x3ab614[_0x7b4c('0x5a')]=_0x501f75['startPredictive'];_0x3ab614['startProgressive']=_0x501f75[_0x7b4c('0x5b')];}if(_0x501f75['Trunk']){_0x3ab614[_0x7b4c('0x5c')]={'id':_0x501f75[_0x7b4c('0x5c')]['id'],'name':_0x501f75[_0x7b4c('0x5c')][_0x7b4c('0xc')],'active':_0x501f75[_0x7b4c('0x5c')][_0x7b4c('0x5d')],'callerid':_0x501f75[_0x7b4c('0x5c')][_0x7b4c('0x5e')]};}if(_0x501f75[_0x7b4c('0x5f')]){_0x3ab614['Interval']={'id':_0x501f75[_0x7b4c('0x5f')]['id'],'name':_0x501f75['Interval']['name']};}_0x1f311e[_0x7b4c('0x60')](_0x3ab614);}}_0x37c059({'count':_0x1f311e[_0x7b4c('0x61')],'rows':_0x1f311e});});},'UpdateVoiceQueue':function(_0x54a887){return new Promise(function(_0x529fde,_0x255cca){var _0x2ce694=_[_0x7b4c('0x62')](_0x2d9945[_0x7b4c('0x24')],{'id':parseInt(_0x54a887['id'])});var _0x8ebf9b=_[_0x7b4c('0x63')](_0x54a887,['id']);if(_0x2ce694){for(var _0x336796 in _0x8ebf9b){if(typeof _0x8ebf9b[_0x336796]!==_0x7b4c('0x64')&&typeof _0x2ce694[_0x336796]!=='undefined'){_0x2ce694[_0x336796]=_0x8ebf9b[_0x336796];}}_0x529fde(_0x2ce694);}else{_0x255cca();}});},'VoiceChannels':function(_0xea18c8){return new Promise(function(_0x712081,_0x27ec76){var _0x387efd=_[_0x7b4c('0x65')](_0x2d9945[_0x7b4c('0x66')]);_0x712081({'count':_0x387efd[_0x7b4c('0x61')],'rows':_0x387efd});});},'VoiceChannelMixMonitor':function(_0x2c9cf1){var _0x45957d=this;return new Promise(function(_0x5a1262,_0x4df2fa){if(ami[_0x7b4c('0x13')]()==![]){return _0x4df2fa(_0x45957d[_0x7b4c('0x14')](0x1f4,[config[_0x7b4c('0x15')]['ip'],config['asterisk'][_0x7b4c('0x16')],_0x7b4c('0x17')]['join']('\x20')));}var _0x1d82ee=schema(properties['voicechannel'])[_0x7b4c('0x3')](_0x2c9cf1);if(_0x1d82ee['length']>0x0){return _0x4df2fa(_0x45957d[_0x7b4c('0x14')](0x1f4,_['map'](_0x1d82ee,_0x7b4c('0x1f'))[_0x7b4c('0x18')](',\x20')));}var _0x51f9a8=_['find'](_0x2d9945[_0x7b4c('0x66')],{'uniqueid':_0x2c9cf1[_0x7b4c('0x67')]});if(_0x51f9a8&&_0x51f9a8[_0x7b4c('0x68')]){var _0x4fd536=util['format'](_0x7b4c('0x69'),_0x2c9cf1[_0x7b4c('0x6a')]||_0x2c9cf1['uniqueid'],_0x2c9cf1['format']||_0x7b4c('0x6b'));return ami[_0x7b4c('0x1d')]({'action':_0x7b4c('0x6c'),'channel':_0x51f9a8['channel'],'file':_0x4fd536,'options':_0x7b4c('0x6d')})[_0x7b4c('0x1e')](function(_0x4aaf57){var _0x484e80=_[_0x7b4c('0x62')](_0x51f9a8['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x4fd536[_0x7b4c('0x6e')]()});if(_['isNil'](_0x484e80)){_0x51f9a8['monitors'][_0x7b4c('0x60')]({'filename':_0x7b4c('0x6f')+_0x4fd536[_0x7b4c('0x6e')](),'createdAt':moment()[_0x7b4c('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x4aaf57['mixmonitorid'],'status':_0x7b4c('0x70')});}else{_0x484e80[_0x7b4c('0x71')]=_0x4aaf57[_0x7b4c('0x71')];_0x484e80['status']=_0x7b4c('0x70');}_0x5a1262({'code':0xc8,'message':[_0x2c9cf1[_0x7b4c('0x67')],_0x7b4c('0x72'),_0x4aaf57['mixmonitorid']][_0x7b4c('0x18')]('\x20'),'mixmonitorid':_0x4aaf57[_0x7b4c('0x71')]});})['catch'](function(_0x3db788){_0x4df2fa(_0x45957d[_0x7b4c('0x14')](0x1f5,[_0x2c9cf1[_0x7b4c('0x67')],_0x3db788[_0x7b4c('0x1f')][_0x7b4c('0x6e')]()][_0x7b4c('0x18')]('\x20')));});}else{return _0x4df2fa(_0x45957d[_0x7b4c('0x14')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x4443d0){var _0x2dc79a=this;return new Promise(function(_0x4ab9dc,_0x2f974f){if(ami[_0x7b4c('0x13')]()==![]){return _0x2f974f(_0x2dc79a[_0x7b4c('0x14')](0x1f4,[config[_0x7b4c('0x15')]['ip'],config['asterisk'][_0x7b4c('0x16')],'ami\x20disconnected']['join']('\x20')));}var _0x41deba=schema(properties[_0x7b4c('0x73')])[_0x7b4c('0x3')](_0x4443d0);if(_0x41deba[_0x7b4c('0x61')]>0x0){return _0x2f974f(_0x2dc79a[_0x7b4c('0x14')](0x1f4,_['map'](_0x41deba,'message')[_0x7b4c('0x18')](',\x20')));}var _0x3c84af=_[_0x7b4c('0x62')](_0x2d9945['channels'],{'uniqueid':_0x4443d0[_0x7b4c('0x67')]});if(_0x3c84af){return BPromise[_0x7b4c('0x74')]()[_0x7b4c('0x1e')](function(){if(_0x3c84af['channel']){return ami[_0x7b4c('0x1d')]({'action':_0x7b4c('0x75'),'channel':_0x3c84af[_0x7b4c('0x68')],'mixmonitorid':_0x4443d0['mixmonitorid']})[_0x7b4c('0x23')](function(_0x416935){});}})['then'](function(){if(_0x3c84af[_0x7b4c('0x76')]){return ami['Action']({'action':_0x7b4c('0x75'),'channel':_0x3c84af[_0x7b4c('0x76')],'mixmonitorid':_0x4443d0[_0x7b4c('0x71')]})['catch'](function(_0x5af2af){});}})[_0x7b4c('0x1e')](function(_0x401c4b){var _0x1ea5a3=_['find'](_0x3c84af[_0x7b4c('0x77')],{'mixmonitorid':_0x4443d0['mixmonitorid']});if(_0x1ea5a3){_0x1ea5a3[_0x7b4c('0x78')]=_0x7b4c('0x79');}})[_0x7b4c('0x1e')](function(){var _0x5f3ed5=util[_0x7b4c('0x9')]('%s.%s',_0x4443d0[_0x7b4c('0x6a')]||_0x4443d0[_0x7b4c('0x67')],_0x4443d0['format']||_0x7b4c('0x6b'));var _0x13a882=_[_0x7b4c('0x62')](_0x3c84af[_0x7b4c('0x77')],{'filename':_0x7b4c('0x6f')+_0x5f3ed5[_0x7b4c('0x6e')]()});if(_0x13a882){_0x13a882[_0x7b4c('0x78')]=_0x7b4c('0x79');}})['then'](function(){_0x4ab9dc({'code':0xc8,'message':[_0x4443d0[_0x7b4c('0x67')],_0x7b4c('0x7a')][_0x7b4c('0x18')]('\x20')});})[_0x7b4c('0x23')](function(_0x33c782){_0x2f974f(_0x2dc79a[_0x7b4c('0x14')](0x1f5,[_0x4443d0[_0x7b4c('0x67')],_0x33c782[_0x7b4c('0x1f')][_0x7b4c('0x6e')]()][_0x7b4c('0x18')]('\x20')));});}else{return _0x2f974f(_0x2dc79a[_0x7b4c('0x14')](0x1f5,_0x7b4c('0x7b')));}});},'VoiceQueuesChannels':function(_0x20b1dd){return new Promise(function(_0x225f38,_0xe3900c){var _0x61c7a5=_[_0x7b4c('0x65')](_0x2d9945[_0x7b4c('0x7c')]);_0x225f38({'count':_0x61c7a5[_0x7b4c('0x61')],'rows':_0x61c7a5});});},'VoiceQueuesChannel':function(_0x3b4fda){var _0x520df0=this;return new Promise(function(_0x58a4b7,_0x3d0928){var _0x15033e=schema(properties['voicequeuechannel'])[_0x7b4c('0x3')](_0x3b4fda);if(_0x15033e[_0x7b4c('0x61')]>0x0){return _0x3d0928(_0x520df0[_0x7b4c('0x14')](0x1f4,_[_0x7b4c('0x7d')](_0x15033e,_0x7b4c('0x1f'))[_0x7b4c('0x18')](',\x20')));}var _0x22a254=_[_0x7b4c('0x62')](_0x2d9945[_0x7b4c('0x7c')],{'uniqueid':_0x3b4fda['uniqueid']});if(_0x22a254){_0x58a4b7(_0x22a254);}else{return _0x3d0928(_0x520df0[_0x7b4c('0x14')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x35067f){var _0x5477e3=this;return new Promise(function(_0x5f3070,_0x3515d1){if(ami['isConnected']()==![]){return _0x3515d1(_0x5477e3['error'](0x1f4,[config[_0x7b4c('0x15')]['ip'],config[_0x7b4c('0x15')][_0x7b4c('0x16')],'ami\x20disconnected'][_0x7b4c('0x18')]('\x20')));}var _0xf636b6=schema(properties[_0x7b4c('0x7e')])[_0x7b4c('0x3')](_0x35067f);if(_0xf636b6[_0x7b4c('0x61')]>0x0){return _0x3515d1(_0x5477e3[_0x7b4c('0x14')](0x1f4,_[_0x7b4c('0x7d')](_0xf636b6,_0x7b4c('0x1f'))[_0x7b4c('0x18')](',\x20')));}var _0x4777b5=_[_0x7b4c('0x62')](_0x2d9945[_0x7b4c('0x7c')],{'uniqueid':_0x35067f[_0x7b4c('0x67')]});if(_0x4777b5&&_0x4777b5[_0x7b4c('0x68')]){return ami['Action']({'action':_0x7b4c('0x7f'),'channel':_0x4777b5[_0x7b4c('0x68')]})[_0x7b4c('0x1e')](function(_0x1cc380){_0x5f3070({'code':0xc8,'message':[_0x35067f['uniqueid'],_0x1cc380[_0x7b4c('0x1f')][_0x7b4c('0x6e')]()][_0x7b4c('0x18')]('\x20')});})[_0x7b4c('0x23')](function(_0x3b28a5){_0x3515d1(_0x5477e3[_0x7b4c('0x14')](0x1f5,[_0x35067f[_0x7b4c('0x67')],_0x3b28a5['message'][_0x7b4c('0x6e')]()][_0x7b4c('0x18')]('\x20')));});}else{return _0x3515d1(_0x5477e3['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x5ce786){var _0x36ff91=this;return new Promise(function(_0x3e44af,_0x24d4f9){if(ami[_0x7b4c('0x13')]()==![]){return _0x24d4f9(_0x36ff91[_0x7b4c('0x14')](0x1f4,[config[_0x7b4c('0x15')]['ip'],config[_0x7b4c('0x15')][_0x7b4c('0x16')],_0x7b4c('0x17')][_0x7b4c('0x18')]('\x20')));}var _0x83e8bb=schema(properties[_0x7b4c('0x80')])[_0x7b4c('0x3')](_0x5ce786);if(_0x83e8bb['length']>0x0){return _0x24d4f9(_0x36ff91[_0x7b4c('0x14')](0x1f4,_[_0x7b4c('0x7d')](_0x83e8bb,_0x7b4c('0x1f'))['join'](',\x20')));}var _0x39c01d=_[_0x7b4c('0x62')](_0x2d9945[_0x7b4c('0x7c')],{'uniqueid':_0x5ce786[_0x7b4c('0x67')]});if(_0x39c01d&&_0x39c01d[_0x7b4c('0x68')]){return ami['Action']({'action':_0x7b4c('0x81'),'channel':_0x39c01d[_0x7b4c('0x68')],'exten':_0x5ce786[_0x7b4c('0x82')],'context':_0x5ce786[_0x7b4c('0x83')]||_0x39c01d['context'],'priority':0x1})[_0x7b4c('0x1e')](function(_0x3f2614){_0x3e44af({'code':0xc8,'message':[_0x5ce786[_0x7b4c('0x67')],_0x3f2614['message'][_0x7b4c('0x6e')]()][_0x7b4c('0x18')]('\x20')});})[_0x7b4c('0x23')](function(_0x12b531){_0x24d4f9(_0x36ff91['error'](0x1f5,[_0x5ce786[_0x7b4c('0x67')],_0x12b531[_0x7b4c('0x1f')][_0x7b4c('0x6e')]()][_0x7b4c('0x18')]('\x20')));});}else{return _0x24d4f9(_0x36ff91['error'](0x1f5,_0x7b4c('0x7b')));}});},'Agents':function(_0x4e2cef){return new Promise(function(_0x3b9d97,_0x51f262){var _0x24690a=_[_0x7b4c('0x65')](_0x2d9945[_0x7b4c('0xf')]);_0x3b9d97({'count':_0x24690a['length'],'rows':_0x24690a});});},'Telephones':function(_0x42346a){return new Promise(function(_0x5ee499,_0xb2d616){var _0x251865=_['values'](_0x2d9945[_0x7b4c('0x84')]);_0x5ee499({'count':_0x251865[_0x7b4c('0x61')],'rows':_0x251865});});},'Trunks':function(_0x185caf){return new Promise(function(_0x21161f,_0x5cd515){var _0x3d1450=_[_0x7b4c('0x65')](_0x2d9945['trunks']);_0x21161f({'count':_0x3d1450[_0x7b4c('0x61')],'rows':_0x3d1450});});},'OutboundChannels':function(_0x30c5ef){return new Promise(function(_0x237bc6,_0x12bf50){var _0xf0d136=_[_0x7b4c('0x65')](_0x2d9945[_0x7b4c('0x85')]);_0x237bc6({'count':_0xf0d136['length'],'rows':_0xf0d136});});},'Outbound':function(_0x5ec399){return new Promise(function(_0xdb202,_0x433d74){_0xdb202(_0x2d9945[_0x7b4c('0x86')]);});},'Campaigns':function(_0x797f7){return new Promise(function(_0x7441dd,_0x5eeac4){var _0x228b2b=_[_0x7b4c('0x65')](_0x2d9945[_0x7b4c('0x87')]);_0x7441dd({'count':_0x228b2b[_0x7b4c('0x61')],'rows':_0x228b2b});});},'VoiceQueuesPreview':function(_0x4d7bc4){var _0x56ba6f=this;return new Promise(function(_0x119441,_0x2b1cbe){_0x5adec9[_0x7b4c('0x88')](_0x4d7bc4['id'])[_0x7b4c('0x1e')](function(_0x243e3d){_0x119441({'code':0xc8,'message':_0x243e3d['message']});})[_0x7b4c('0x23')](function(_0x453ef1){_0x2b1cbe(_0x56ba6f[_0x7b4c('0x14')](0x1f4,_0x453ef1[_0x7b4c('0x1f')]));});});},'EventManager':function(_0x5c067a){var _0x50333d=this;return new Promise(function(_0x4fb63e,_0x2d2f1b){if(!_0x5c067a[_0x7b4c('0x89')]){return _0x2d2f1b(_0x50333d[_0x7b4c('0x14')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0x7b4c('0x8a')]('custom:'+_0x5c067a['event'],_0x5c067a[_0x7b4c('0x1f')]);_0x4fb63e({'code':0xc8,'message':_0x5c067a});});},'FaxAccounts':function(_0x4a24d8){return new Promise(function(_0x437ef7,_0x1a7b95){var _0x5e444a=_['values'](_0x2d9945[_0x7b4c('0x8b')]);_0x437ef7({'count':_0x5e444a[_0x7b4c('0x61')],'rows':_0x5e444a});});},'SendFax':function(_0x3fd132){var _0x119426=this;return new Promise(function(_0x47d055,_0x496b6f){_0x1b0f57[_0x7b4c('0x8c')](_0x3fd132)[_0x7b4c('0x1e')](function(_0x2523eb){_0x47d055({'code':0xc8,'message':_0x2523eb[_0x7b4c('0x1f')]});})[_0x7b4c('0x23')](function(_0x14fc2f){_0x496b6f(_0x119426[_0x7b4c('0x14')](0x1f4,_0x14fc2f['message']));});});},'CheckAfterSend':function(_0x31780d){var _0x15e46e=this;return new Promise(function(_0x22ffdb,_0x2ec127){_0x1b0f57[_0x7b4c('0x8d')](_0x31780d)[_0x7b4c('0x1e')](function(_0x25741e){_0x22ffdb({'code':0xc8,'message':_0x25741e[_0x7b4c('0x1f')]});})[_0x7b4c('0x23')](function(_0x5d781e){_0x2ec127(_0x15e46e[_0x7b4c('0x14')](0x1f4,_0x5d781e[_0x7b4c('0x1f')]));});});}};var _0x2fb3d9=jayson[_0x7b4c('0x8e')](_0x4bf85d)[_0x7b4c('0x8f')]();_0x2fb3d9['on'](_0x7b4c('0x14'),function(_0x1aae06){return _0x2dd5c7(_0x1aae06);});_0x2fb3d9[_0x7b4c('0x8')](0x232a,_0x7b4c('0x90'),function(){console['log'](_0x7b4c('0x91'),0x232a);return _0x10e197(_0x7b4c('0x92')+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 2e3d048..275c7e3 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 _0x9d82=['exec','data1','data2','xmd-contactid','ListId','data3','phone','destcalleridnum','calleridnum','lastName','mobile','fax','scheduledAt','union','getContacts','then','length','info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','map','[CM][%s][%s]\x20Contact\x20not\x20found','data4','routeId','firstName','calleridname','','destcalleridname','resolve','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','isNil','format','user:%s','name','trigger:%s','action','toLowerCase','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','defaults','localhost','redis','[CM][%s][%s]','stringify','emit'];(function(_0x57ecbd,_0x4a9c4c){var _0x2c3648=function(_0x1e0318){while(--_0x1e0318){_0x57ecbd['push'](_0x57ecbd['shift']());}};_0x2c3648(++_0x4a9c4c);}(_0x9d82,0x105));var _0x29d8=function(_0x59d719,_0x450f23){_0x59d719=_0x59d719-0x0;var _0x126457=_0x9d82[_0x59d719];return _0x126457;};'use strict';var _=require(_0x29d8('0x0'));var BPromise=require(_0x29d8('0x1'));var Redis=require(_0x29d8('0x2'));var util=require(_0x29d8('0x3'));var config=require(_0x29d8('0x4'));var logger=require(_0x29d8('0x5'))(_0x29d8('0x6'));var cmContactRpc=require(_0x29d8('0x7'));config['redis']=_[_0x29d8('0x8')](config['redis'],{'host':_0x29d8('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x29d8('0xa')]));function emit(_0x76a956,_0x3b74b6,_0x2be9d2,_0x56ef80,_0x46724c){logger['info'](_0x29d8('0xb'),_0x76a956,_0x3b74b6['id'],_0x2be9d2,_0x56ef80,JSON[_0x29d8('0xc')](_0x46724c));io['to'](_0x2be9d2)[_0x29d8('0xd')](_0x56ef80,_0x46724c);}exports[_0x29d8('0xe')]=function(_0x987571,_0x5183bf,_0x5785d4,_0x393e5e){var _0x19507e,_0x73caac;var _0x4a621a={};var _0x451648=Number(_0x5785d4[_0x29d8('0xf')]);var _0x202c4b=_0x5785d4['data2']?Boolean(Number(_0x5785d4[_0x29d8('0x10')])):![];var _0x5246af;if(_0x393e5e[_0x29d8('0x11')]){_0x4a621a['id']=_0x393e5e[_0x29d8('0x11')];}if(!_0x4a621a['id']){_0x4a621a[_0x29d8('0x12')]=_0x451648;_0x5246af=_0x5785d4['data3']&&_0x5785d4[_0x29d8('0x13')]!=='0'?_0x5785d4[_0x29d8('0x13')]['split'](','):[_0x29d8('0x14')];_0x4a621a['$or']=_['map'](_0x5246af,function(_0x25aded){var _0x5af409={};_0x5af409[_0x25aded]=_0x393e5e['routeId']?_0x393e5e[_0x29d8('0x15')]:_0x393e5e[_0x29d8('0x16')];return _0x5af409;});}var _0x17fa76=['id','firstName',_0x29d8('0x17'),'phone',_0x29d8('0x18'),_0x29d8('0x19'),'ListId','createdAt',_0x29d8('0x1a'),'updatedAt'];var _0x350e79=_[_0x29d8('0x1b')](_0x17fa76,_0x5246af);BPromise['resolve']()['then'](cmContactRpc[_0x29d8('0x1c')]({'attributes':_0x350e79,'where':_0x4a621a}))[_0x29d8('0x1d')](function(_0x4edb06){_0x73caac=_0x4edb06;if(!_['isEmpty'](_0x73caac)){if(_0x73caac[_0x29d8('0x1e')]===0x1){_0x19507e=_0x73caac[0x0];logger[_0x29d8('0x1f')](_0x29d8('0x20'),_0x393e5e[_0x29d8('0x21')],_0x5183bf['id'],_0x19507e['id']);}else{logger[_0x29d8('0x1f')](_0x29d8('0x22'),_0x393e5e[_0x29d8('0x21')],_0x5183bf['id'],_[_0x29d8('0x23')](_0x73caac,'id')['join'](','));}return;}else{logger[_0x29d8('0x1f')](_0x29d8('0x24'),_0x393e5e[_0x29d8('0x21')],_0x5183bf['id']);var _0x4d7884={'ListId':_0x451648};var _0x2c36a2=_0x5785d4[_0x29d8('0x25')]&&_0x5785d4['data4']!=='0'?_0x5785d4[_0x29d8('0x25')]:_0x29d8('0x14');if(_0x202c4b){logger[_0x29d8('0x1f')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x393e5e['uniqueid'],_0x5183bf['id']);_0x4d7884[_0x2c36a2]=_['isNil'](_0x393e5e[_0x29d8('0x26')])?_0x393e5e[_0x29d8('0x16')]:_0x393e5e[_0x29d8('0x15')];if(_['isNil'](_0x393e5e['routeId'])){_0x4d7884[_0x29d8('0x27')]=_0x393e5e['calleridname']&&_0x393e5e[_0x29d8('0x28')]!==_0x29d8('0x29')?_0x393e5e['calleridname']:'Unknown';}else{_0x4d7884[_0x29d8('0x27')]=_0x393e5e[_0x29d8('0x2a')]&&_0x393e5e['destcalleridname']!==_0x29d8('0x29')?_0x393e5e[_0x29d8('0x2a')]:'Unknown';}return BPromise[_0x29d8('0x2b')]()[_0x29d8('0x1d')](cmContactRpc[_0x29d8('0x2c')](_0x4d7884))[_0x29d8('0x1d')](function(_0x5d0896){_0x19507e=_0x5d0896;_0x73caac[_0x29d8('0x2d')](_0x5d0896);if(_0x19507e){logger['info'](_0x29d8('0x2e'),_0x393e5e[_0x29d8('0x21')],_0x5183bf['id'],_0x19507e['id']);}return;});}else{logger[_0x29d8('0x1f')](_0x29d8('0x2f'),_0x393e5e[_0x29d8('0x21')],_0x5183bf['id']);_0x4d7884[_0x2c36a2]=_[_0x29d8('0x30')](_0x393e5e[_0x29d8('0x26')])?_0x393e5e[_0x29d8('0x16')]:_0x393e5e['destcalleridnum'];if(_['isNil'](_0x393e5e[_0x29d8('0x26')])){_0x4d7884[_0x29d8('0x27')]=_0x393e5e[_0x29d8('0x28')]&&_0x393e5e[_0x29d8('0x28')]!==_0x29d8('0x29')?_0x393e5e[_0x29d8('0x28')]:'Unknown';}else{_0x4d7884['firstName']=_0x393e5e[_0x29d8('0x2a')]&&_0x393e5e[_0x29d8('0x2a')]!==_0x29d8('0x29')?_0x393e5e[_0x29d8('0x2a')]:'Unknown';}_0x19507e=_0x4d7884;_0x73caac[_0x29d8('0x2d')](_0x4d7884);return;}}})[_0x29d8('0x1d')](function(){if(_0x987571){emit(_0x393e5e['uniqueid'],_0x5183bf,util[_0x29d8('0x31')](_0x29d8('0x32'),_0x987571[_0x29d8('0x33')]),util[_0x29d8('0x31')](_0x29d8('0x34'),_0x5785d4[_0x29d8('0x35')][_0x29d8('0x36')]()),{'evt':_['merge'](_0x393e5e,{'autoCreate':_0x202c4b}),'contact':_0x19507e===undefined?{}:_0x19507e,'contacts':_0x73caac[_0x29d8('0x1e')]===0x0?undefined:_0x73caac});}});}; \ No newline at end of file +var _0x10c3=['[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','action','toLowerCase','merge','length','lodash','bluebird','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','fax','createdAt','scheduledAt','union','resolve','then','getContacts','isEmpty','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s'];(function(_0x18ba37,_0x451ca4){var _0x4105d8=function(_0x13e7e8){while(--_0x13e7e8){_0x18ba37['push'](_0x18ba37['shift']());}};_0x4105d8(++_0x451ca4);}(_0x10c3,0x1ac));var _0x310c=function(_0x46f5a5,_0x34dfa6){_0x46f5a5=_0x46f5a5-0x0;var _0x5a60e3=_0x10c3[_0x46f5a5];return _0x5a60e3;};'use strict';var _=require(_0x310c('0x0'));var BPromise=require(_0x310c('0x1'));var Redis=require('ioredis');var util=require('util');var config=require(_0x310c('0x2'));var logger=require(_0x310c('0x3'))(_0x310c('0x4'));var cmContactRpc=require(_0x310c('0x5'));config[_0x310c('0x6')]=_[_0x310c('0x7')](config[_0x310c('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x310c('0x8'))(new Redis(config[_0x310c('0x6')]));function emit(_0x129a29,_0x3ded42,_0x3faf86,_0x34bd55,_0x123a40){logger[_0x310c('0x9')](_0x310c('0xa'),_0x129a29,_0x3ded42['id'],_0x3faf86,_0x34bd55,JSON[_0x310c('0xb')](_0x123a40));io['to'](_0x3faf86)[_0x310c('0xc')](_0x34bd55,_0x123a40);}exports[_0x310c('0xd')]=function(_0x3312dc,_0xeb278b,_0x356f3e,_0x48f6e6){var _0x11fa8,_0x3b5415;var _0x124e3f={};var _0x28059d=Number(_0x356f3e[_0x310c('0xe')]);var _0x37fc07=_0x356f3e[_0x310c('0xf')]?Boolean(Number(_0x356f3e[_0x310c('0xf')])):![];var _0x5c6585;if(_0x48f6e6[_0x310c('0x10')]){_0x124e3f['id']=_0x48f6e6['xmd-contactid'];}if(!_0x124e3f['id']){_0x124e3f[_0x310c('0x11')]=_0x28059d;_0x5c6585=_0x356f3e[_0x310c('0x12')]&&_0x356f3e[_0x310c('0x12')]!=='0'?_0x356f3e[_0x310c('0x12')][_0x310c('0x13')](','):[_0x310c('0x14')];_0x124e3f[_0x310c('0x15')]=_[_0x310c('0x16')](_0x5c6585,function(_0x45b554){var _0x2efda9={};_0x2efda9[_0x45b554]=_0x48f6e6[_0x310c('0x17')]?_0x48f6e6[_0x310c('0x18')]:_0x48f6e6[_0x310c('0x19')];return _0x2efda9;});}var _0x1fa245=['id',_0x310c('0x1a'),_0x310c('0x1b'),_0x310c('0x14'),_0x310c('0x1c'),_0x310c('0x1d'),_0x310c('0x11'),_0x310c('0x1e'),_0x310c('0x1f'),'updatedAt'];var _0x5b6f6a=_[_0x310c('0x20')](_0x1fa245,_0x5c6585);BPromise[_0x310c('0x21')]()[_0x310c('0x22')](cmContactRpc[_0x310c('0x23')]({'attributes':_0x5b6f6a,'where':_0x124e3f}))[_0x310c('0x22')](function(_0x35465){_0x3b5415=_0x35465;if(!_[_0x310c('0x24')](_0x3b5415)){if(_0x3b5415['length']===0x1){_0x11fa8=_0x3b5415[0x0];logger['info'](_0x310c('0x25'),_0x48f6e6['uniqueid'],_0xeb278b['id'],_0x11fa8['id']);}else{logger[_0x310c('0x9')](_0x310c('0x26'),_0x48f6e6[_0x310c('0x27')],_0xeb278b['id'],_['map'](_0x3b5415,'id')[_0x310c('0x28')](','));}return;}else{logger['info'](_0x310c('0x29'),_0x48f6e6[_0x310c('0x27')],_0xeb278b['id']);var _0x146b4a={'ListId':_0x28059d};var _0x1e527f=_0x356f3e[_0x310c('0x2a')]&&_0x356f3e[_0x310c('0x2a')]!=='0'?_0x356f3e[_0x310c('0x2a')]:_0x310c('0x14');if(_0x37fc07){logger[_0x310c('0x9')](_0x310c('0x2b'),_0x48f6e6[_0x310c('0x27')],_0xeb278b['id']);_0x146b4a[_0x1e527f]=_[_0x310c('0x2c')](_0x48f6e6[_0x310c('0x17')])?_0x48f6e6[_0x310c('0x19')]:_0x48f6e6[_0x310c('0x18')];if(_[_0x310c('0x2c')](_0x48f6e6['routeId'])){_0x146b4a[_0x310c('0x1a')]=_0x48f6e6['calleridname']&&_0x48f6e6[_0x310c('0x2d')]!==_0x310c('0x2e')?_0x48f6e6['calleridname']:_0x310c('0x2f');}else{_0x146b4a[_0x310c('0x1a')]=_0x48f6e6['destcalleridname']&&_0x48f6e6[_0x310c('0x30')]!==_0x310c('0x2e')?_0x48f6e6['destcalleridname']:_0x310c('0x2f');}return BPromise[_0x310c('0x21')]()[_0x310c('0x22')](cmContactRpc[_0x310c('0x31')](_0x146b4a))['then'](function(_0x4d84ea){_0x11fa8=_0x4d84ea;_0x3b5415[_0x310c('0x32')](_0x4d84ea);if(_0x11fa8){logger['info'](_0x310c('0x33'),_0x48f6e6['uniqueid'],_0xeb278b['id'],_0x11fa8['id']);}return;});}else{logger[_0x310c('0x9')](_0x310c('0x34'),_0x48f6e6[_0x310c('0x27')],_0xeb278b['id']);_0x146b4a[_0x1e527f]=_[_0x310c('0x2c')](_0x48f6e6[_0x310c('0x17')])?_0x48f6e6[_0x310c('0x19')]:_0x48f6e6[_0x310c('0x18')];if(_[_0x310c('0x2c')](_0x48f6e6[_0x310c('0x17')])){_0x146b4a[_0x310c('0x1a')]=_0x48f6e6['calleridname']&&_0x48f6e6[_0x310c('0x2d')]!==_0x310c('0x2e')?_0x48f6e6['calleridname']:'Unknown';}else{_0x146b4a[_0x310c('0x1a')]=_0x48f6e6[_0x310c('0x30')]&&_0x48f6e6[_0x310c('0x30')]!==''?_0x48f6e6[_0x310c('0x30')]:_0x310c('0x2f');}_0x11fa8=_0x146b4a;_0x3b5415[_0x310c('0x32')](_0x146b4a);return;}}})['then'](function(){if(_0x3312dc){emit(_0x48f6e6[_0x310c('0x27')],_0xeb278b,util[_0x310c('0x35')](_0x310c('0x36'),_0x3312dc[_0x310c('0x37')]),util[_0x310c('0x35')]('trigger:%s',_0x356f3e[_0x310c('0x38')][_0x310c('0x39')]()),{'evt':_[_0x310c('0x3a')](_0x48f6e6,{'autoCreate':_0x37fc07}),'contact':_0x11fa8===undefined?{}:_0x11fa8,'contacts':_0x3b5415[_0x310c('0x3b')]===0x0?undefined:_0x3b5415});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index f0165c7..99a7c3e 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 _0xbe26=['windowWidth','800','data5','windowHeight','600','data6','winApplication','winArguments','format','user:%s','name','merge','jscripty','exec','routeId','urlforward','script','query','AllConditions','every','AnyConditions','field','account','channel','chat','ChatWebsiteId','operator','upperFirst','AccountId','value','interaction','message','event','queue','agent','membername','lastevent','exports','util','ioredis','./urlforward','./script','../../../config/environment','../../../config/logger','trigger','../ami','defaults','localhost','socket.io-emitter','redis','url','winapp','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','servicenowAccounts','dynamics365Accounts','accounts','vtigerAccounts','freshsalesAccounts','custom:agentcalled','syncCustomEvent','custom:agentconnect','bind','custom:agentringnoanswer','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:amd','custom:queuecallerabandon','custom:dialbegin','custom:dialconnect','syncAgentDial','custom:dialend','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','prototype','info','emit','clone','interface','triggers','status','checkTrigger','variables','length','Actions','action','toLowerCase','contactmanager','motionbar','data1','TemplateId','data2','html','render','template\x20not\x20found','uri','isNil','data3','data4'];(function(_0x4f8b6a,_0x2ead69){var _0x192d31=function(_0x43058f){while(--_0x43058f){_0x4f8b6a['push'](_0x4f8b6a['shift']());}};_0x192d31(++_0x2ead69);}(_0xbe26,0x173));var _0x6be2=function(_0x17d3f1,_0x26bbf4){_0x17d3f1=_0x17d3f1-0x0;var _0x503c61=_0xbe26[_0x17d3f1];return _0x503c61;};'use strict';var util=require(_0x6be2('0x0'));var _=require('lodash');var url=require('url');var Mustache=require('mustache');var Redis=require(_0x6be2('0x1'));var urlforward=require(_0x6be2('0x2'));var integration=require('./integration');var cmContact=require('./cmContact');var script=require(_0x6be2('0x3'));var config=require(_0x6be2('0x4'));var logger=require(_0x6be2('0x5'))(_0x6be2('0x6'));var ami=require(_0x6be2('0x7'));config['redis']=_[_0x6be2('0x8')](config['redis'],{'host':_0x6be2('0x9'),'port':0x18eb});var io=require(_0x6be2('0xa'))(new Redis(config[_0x6be2('0xb')]));var operators={'equals':function(_0x111270,_0x15bd3b){return _0x111270==_0x15bd3b;},'not_equals':function(_0x312954,_0x531670){return _0x312954!=_0x531670;}};var barAndWebActions=['popup',_0x6be2('0xc'),_0x6be2('0xd')];function Trigger(_0x10b2b2){this['triggers']=_0x10b2b2['triggers'];this[_0x6be2('0xe')]=_0x10b2b2[_0x6be2('0xe')];this[_0x6be2('0xf')]=_0x10b2b2[_0x6be2('0xf')];this[_0x6be2('0x10')]=_0x10b2b2[_0x6be2('0x10')];this['voiceExtensions']=_0x10b2b2[_0x6be2('0x11')];this[_0x6be2('0x12')]=_0x10b2b2[_0x6be2('0x12')];this[_0x6be2('0x13')]=_0x10b2b2[_0x6be2('0x13')];this['salesforceAccounts']=_0x10b2b2[_0x6be2('0x14')];this[_0x6be2('0x15')]=_0x10b2b2[_0x6be2('0x15')];this[_0x6be2('0x16')]=_0x10b2b2['zohoAccounts'];this[_0x6be2('0x17')]=_0x10b2b2[_0x6be2('0x17')];this['vtigerAccounts']=_0x10b2b2['vtigerAccounts'];this[_0x6be2('0x18')]=_0x10b2b2[_0x6be2('0x18')];this['dynamics365Accounts']=_0x10b2b2[_0x6be2('0x19')];this['freshsalesAccounts']=_0x10b2b2['freshsalesAccounts'];this[_0x6be2('0x1a')]={'zendesk':this[_0x6be2('0x12')],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0x6be2('0x13')],'sugarcrm':this[_0x6be2('0x15')],'zoho':this[_0x6be2('0x16')],'desk':this[_0x6be2('0x17')],'vtiger':this[_0x6be2('0x1b')],'dynamics365':this[_0x6be2('0x19')],'freshsales':this[_0x6be2('0x1c')],'servicenow':this[_0x6be2('0x18')]};ami['on'](_0x6be2('0x1d'),this[_0x6be2('0x1e')]['bind'](this));ami['on'](_0x6be2('0x1f'),this[_0x6be2('0x1e')][_0x6be2('0x20')](this));ami['on'](_0x6be2('0x21'),this[_0x6be2('0x1e')][_0x6be2('0x20')](this));ami['on']('custom:agentcomplete',this[_0x6be2('0x1e')]['bind'](this));ami['on']('custom:agentnosuchnumber',this['syncCustomEvent'][_0x6be2('0x20')](this));ami['on'](_0x6be2('0x22'),this[_0x6be2('0x1e')][_0x6be2('0x20')](this));ami['on'](_0x6be2('0x23'),this[_0x6be2('0x1e')][_0x6be2('0x20')](this));ami['on'](_0x6be2('0x24'),this[_0x6be2('0x1e')][_0x6be2('0x20')](this));ami['on']('custom:agentreject',this[_0x6be2('0x1e')][_0x6be2('0x20')](this));ami['on'](_0x6be2('0x25'),this[_0x6be2('0x1e')][_0x6be2('0x20')](this));ami['on'](_0x6be2('0x26'),this[_0x6be2('0x1e')][_0x6be2('0x20')](this));ami['on']('custom:timeout',this[_0x6be2('0x1e')][_0x6be2('0x20')](this));ami['on'](_0x6be2('0x27'),this['syncAgentDial'][_0x6be2('0x20')](this));ami['on'](_0x6be2('0x28'),this[_0x6be2('0x29')][_0x6be2('0x20')](this));ami['on'](_0x6be2('0x2a'),this[_0x6be2('0x29')]['bind'](this));ami['on']('custom:newinteraction',this['syncCustomEvent'][_0x6be2('0x20')](this));ami['on'](_0x6be2('0x2b'),this[_0x6be2('0x1e')][_0x6be2('0x20')](this));ami['on'](_0x6be2('0x2c'),this['syncCustomEvent']['bind'](this));ami['on'](_0x6be2('0x2d'),this['syncCustomEvent'][_0x6be2('0x20')](this));ami['on'](_0x6be2('0x2e'),this[_0x6be2('0x1e')][_0x6be2('0x20')](this));ami['on'](_0x6be2('0x2f'),this[_0x6be2('0x1e')]['bind'](this));}Trigger[_0x6be2('0x30')]['emit']=function(_0x321b57,_0x10c3bb,_0x1ed2aa){logger[_0x6be2('0x31')](_0x321b57,_0x10c3bb,JSON['stringify'](_0x1ed2aa));io['to'](_0x321b57)[_0x6be2('0x32')](_0x10c3bb,_0x1ed2aa);};Trigger[_0x6be2('0x30')]['syncCustomEvent']=function(_0x35b009){var _0x6ad904=_[_0x6be2('0x33')](_0x35b009);this['checkTriggers'](_0x6ad904);};Trigger[_0x6be2('0x30')]['syncAgentDial']=function(_0x36ab02){if(this[_0x6be2('0xe')][_0x36ab02[_0x6be2('0x34')]]){this['syncCustomEvent'](_0x36ab02);}};Trigger[_0x6be2('0x30')]['checkTriggers']=function(_0x1c323d){var _0x2c2f0b;for(var _0x3be32e in this[_0x6be2('0x35')]){if(this['triggers']['hasOwnProperty'](_0x3be32e)){if(this[_0x6be2('0x35')][_0x3be32e][_0x6be2('0x36')]){_0x2c2f0b=this[_0x6be2('0x37')](this[_0x6be2('0x35')][_0x3be32e],_0x1c323d);if(_0x2c2f0b){_['merge'](_0x1c323d,_0x1c323d[_0x6be2('0x38')]);for(var _0x4fc5bf=0x0,_0x2e49d4,_0x32beca,_0x3ea81c;_0x4fc5bf0x0){_0x1c9f6b=_['map'](_0x430d55,_0x28814f);}return _0x1c9f6b;}function getCustomFields(_0x1377b0,_0x22f6b6){var _0x1b8388=[];var _0x201941={'custom_fields':{}};if(_0x1377b0[_0xa55c('0x28')]>0x0){_[_0xa55c('0x29')](_0x1377b0,function(_0x52d37f){if(_[_0xa55c('0x2a')](['string',_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x2d')]&&!_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0x52d37f['nameField'][_0xa55c('0x2f')]()]=_0x52d37f[_0xa55c('0x30')][_0xa55c('0x1f')]();}else if(_[_0xa55c('0x2a')]([_0xa55c('0x31'),_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x52d37f['content']['toString']();}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x34')&&_0x52d37f['variableName']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x35')]]&&(_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f[_0xa55c('0x35')]][_0xa55c('0x1f')]());}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x36')&&_0x52d37f['Variable']&&_0x52d37f['Variable']['name']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x37')]['name'][_0xa55c('0x2f')]()]&&(_0x201941['custom_fields'][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f['Variable'][_0xa55c('0x38')][_0xa55c('0x2f')]()][_0xa55c('0x1f')]());}});}if(_0x201941['priority']){_0x201941[_0xa55c('0x39')]=Number(_0x201941[_0xa55c('0x39')]);}return _0x201941;}function getTicket(_0x47e93c,_0x6f9c4c,_0x194e78,_0x4d9083,_0x529ff8){logger[_0xa55c('0xb')]('Creating\x20new\x20ticket...');var _0x1e75dc=_[_0xa55c('0x3a')]({'subject':intUtil['getString'](_0x4d9083['Subjects'],_0x529ff8,'\x20'),'type':'phone','status':'new','labels':[_0xa55c('0x3b'),_0xa55c('0x3c'),_0xa55c('0x3d')][_0xa55c('0x3e')](getTags(_0x4d9083[_0xa55c('0x3f')],'name')),'description':intUtil[_0xa55c('0x40')](_0x4d9083[_0xa55c('0x41')],_0x529ff8,'\x0a'),'_links':{'assigned_user':{'href':util[_0xa55c('0xd')](_0xa55c('0x42'),_0x6f9c4c['id']),'class':_0xa55c('0x43')}},'message':{'direction':'in','body':intUtil[_0xa55c('0x40')](_0x4d9083['Descriptions'],_0x529ff8,'\x0a')}},getCustomFields(_0x4d9083[_0xa55c('0x44')],_0x529ff8));return request({'uri':util['format']('%s/customers/%d/cases',_0x47e93c[_0xa55c('0xf')],_0x194e78['id']),'method':_0xa55c('0x27'),'body':_0x1e75dc});}exports['queue']=function(_0x2bd98b,_0x508bd3,_0x5f25f7,_0x2f8449,_0x3fea03,_0x1630ac){var _0x540337,_0x1b2708;_0x1630ac[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1630ac[_0xa55c('0xf')]);_0x1630ac['serverUrl']=intUtil[_0xa55c('0x45')](_0x1630ac[_0xa55c('0x46')]);if(_0x3fea03&&_0x3fea03['monitor_format']){logger[_0xa55c('0xb')](_0xa55c('0x47'),'Recording\x20is\x20enabled!');_0x508bd3[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1630ac['serverUrl'],_0x508bd3[_0xa55c('0x4a')],md5(_0x508bd3['uniqueid']));}else{_0x508bd3[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1630ac);return getUser(_0x1630ac,_0x2f8449[_0xa55c('0x4c')])['then'](function(_0x41eab1){_0x540337=_0x41eab1;logger[_0xa55c('0xb')]('The\x20User\x20ID\x20is:',_0x540337['id']);return getEndUser(_0x1630ac,_0x508bd3[_0xa55c('0x4d')],_0x508bd3[_0xa55c('0x4e')]);})['then'](function(_0x11ff1d){_0x1b2708=_0x11ff1d;logger[_0xa55c('0xb')]('The\x20Enduser\x20ID\x20is:',_0x1b2708['id']);return getTicket(_0x1630ac,_0x540337,_0x1b2708,_0x5f25f7,_0x508bd3);})[_0xa55c('0x10')](function(_0x81cee8){if(_0x81cee8){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger['info'](_0xa55c('0x50'),_0x81cee8['id']);switch(_0x1630ac['type']){case _0xa55c('0x51'):logger[_0xa55c('0xb')](_0xa55c('0x47'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449['name']),_0xa55c('0x53'),{'recordId':_0x81cee8['id']});break;case _0xa55c('0x54'):logger[_0xa55c('0xb')](_0xa55c('0x47'),_0xa55c('0x55'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449[_0xa55c('0x38')]),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')]('https://xcally.desk.com/web/agent/case/%d',_0x81cee8['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x47'),_0xa55c('0x58'));}}})['catch'](function(_0x4c3095){console[_0xa55c('0x57')](_0x4c3095);logger['error'](_0xa55c('0x47'),JSON['stringify'](_0x4c3095));});};exports[_0xa55c('0x59')]=function(_0x228df4,_0x181802,_0x3f9313,_0x2ecf79,_0x5b1cf3,_0x44b7c1,_0x4607ca){var _0x4b85cc,_0x3929a6;_0x44b7c1[_0xa55c('0xf')]=intUtil[_0xa55c('0x45')](_0x44b7c1[_0xa55c('0xf')]);_0x44b7c1['serverUrl']=intUtil['stripTrailingSlash'](_0x44b7c1[_0xa55c('0x46')]);if(_0x4607ca&&_0x4607ca[_0xa55c('0x5a')]&&_0x4607ca[_0xa55c('0x5a')]!==_0xa55c('0x5b')){logger['info'](_0xa55c('0x5c'),'Recording\x20is\x20enabled!');_0x181802[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x44b7c1[_0xa55c('0x46')],_0x181802[_0xa55c('0x4a')],md5(_0x181802['uniqueid']));}headers[_0xa55c('0x4b')]=getAuth(_0x44b7c1);return getUser(_0x44b7c1,_0x2ecf79['email'])[_0xa55c('0x10')](function(_0x157afe){_0x4b85cc=_0x157afe;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0x4b85cc['id']);return getEndUser(_0x44b7c1,_0x181802[_0xa55c('0x5e')],_0x181802[_0xa55c('0x5f')]);})[_0xa55c('0x10')](function(_0x53e2be){_0x3929a6=_0x53e2be;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3929a6['id']);return getTicket(_0x44b7c1,_0x4b85cc,_0x3929a6,_0x3f9313,_0x181802);})[_0xa55c('0x10')](function(_0x23a30e){if(_0x23a30e){logger[_0xa55c('0xb')]('Ticket\x20created!');logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x23a30e['id']);switch(_0x44b7c1[_0xa55c('0x2c')]){case _0xa55c('0x51'):logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x61'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2ecf79[_0xa55c('0x38')]),_0xa55c('0x53'),{'recordId':_0x23a30e['id']});break;case'newTab':logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x55'));emit(util['format'](_0xa55c('0x52'),_0x2ecf79['name']),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')](_0xa55c('0x62'),_0x44b7c1[_0xa55c('0xf')],_0x23a30e['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x5c'),_0xa55c('0x58'));}}})[_0xa55c('0x63')](function(_0x14b515){logger[_0xa55c('0x57')]('[OUTBOUND]',JSON[_0xa55c('0x17')](_0x14b515));});};exports[_0xa55c('0x64')]=function(_0x4ef914,_0x18b928,_0x2b8b88,_0x3e3b4b,_0x9fe234,_0x1b8b06){var _0xa38271,_0x3cef1f;_0x1b8b06[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1b8b06[_0xa55c('0xf')]);_0x1b8b06[_0xa55c('0x46')]=intUtil[_0xa55c('0x45')](_0x1b8b06[_0xa55c('0x46')]);if(_0x9fe234&&_0x9fe234[_0xa55c('0x65')]){logger[_0xa55c('0xb')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',_0xa55c('0x68'));_0x18b928['recordingURL']=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1b8b06[_0xa55c('0x46')],_0x18b928[_0xa55c('0x4a')],md5(_0x18b928[_0xa55c('0x4a')]));}else{_0x18b928[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1b8b06);return getUser(_0x1b8b06)[_0xa55c('0x10')](function(_0x2e4cf7){_0xa38271=_0x2e4cf7;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0xa38271['id']);return getEndUser(_0x1b8b06,_0x18b928['calleridname'],_0x18b928[_0xa55c('0x4e')]);})['then'](function(_0x1228a4){_0x3cef1f=_0x1228a4;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3cef1f['id']);return getTicket(_0x1b8b06,_0xa38271,_0x3cef1f,_0x2b8b88,_0x18b928);})['then'](function(_0x4d9722){if(_0x4d9722){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x4d9722['id']);}})['catch'](function(_0x149cb9){logger[_0xa55c('0x57')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',JSON[_0xa55c('0x17')](_0x149cb9));});}; \ No newline at end of file +var _0x7217=['format','%s/users','remoteUri','then','total_entries','find','entries','info','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','debug','stringify','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','_embedded','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','length','map','forEach','string','picklist','nameField','customField','content','toString','includes','idField','custom_fields','variable','variableName','type','customVariable','Variable','name','toLowerCase','priority','Creating\x20new\x20ticket...','merge','getString','new','xCALLY','Motion','CTI','Tags','Descriptions','user','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','integrationTab','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','catch','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','The\x20Ticket\x20ID\x20is:','%s/agent/tickets/%s','unmanaged','lastevent','toUpperCase','calleridname','lodash','md5','util','ioredis','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','emit','application/json','validateEmail','Getting\x20agent\x20with\x20email'];(function(_0x160cc3,_0x4f4fd6){var _0x1a4c8e=function(_0x1f3ea4){while(--_0x1f3ea4){_0x160cc3['push'](_0x160cc3['shift']());}};_0x1a4c8e(++_0x4f4fd6);}(_0x7217,0x19e));var _0x7721=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x7217[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0x7721('0x0'));var rp=require('request-promise');var md5=require(_0x7721('0x1'));var util=require(_0x7721('0x2'));var Redis=require(_0x7721('0x3'));var intUtil=require(_0x7721('0x4'));var config=require(_0x7721('0x5'));var logger=require('../../../../config/logger')('desk');config[_0x7721('0x6')]=_[_0x7721('0x7')](config[_0x7721('0x6')],{'host':_0x7721('0x8'),'port':0x18eb});var io=require(_0x7721('0x9'))(new Redis(config[_0x7721('0x6')]));function emit(_0x18ab6b,_0x21f680,_0x225610){io['to'](_0x18ab6b)[_0x7721('0xa')](_0x21f680,_0x225610);}var headers={'Content-Type':_0x7721('0xb'),'Accept':_0x7721('0xb')};function getUser(_0xfa8835,_0x138740){if(intUtil[_0x7721('0xc')](_0x138740)===!![]){logger['info'](_0x7721('0xd'),_0x138740);return request({'uri':util[_0x7721('0xe')](_0x7721('0xf'),_0xfa8835[_0x7721('0x10')])})[_0x7721('0x11')](function(_0x409b37){if(_0x409b37[_0x7721('0x12')]){return _[_0x7721('0x13')](_0x409b37['_embedded'][_0x7721('0x14')],{'email':_0x138740});}})[_0x7721('0x11')](function(_0x57ff6d){if(_0x57ff6d){logger[_0x7721('0x15')](_0x7721('0x16'));return _0x57ff6d;}else{logger[_0x7721('0x15')](_0x7721('0x17'));return request({'uri':util['format'](_0x7721('0x18'),_0xfa8835[_0x7721('0x10')])});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x7721('0x18'),_0xfa8835[_0x7721('0x10')])});}}function request(_0x3cc909){logger[_0x7721('0x19')]('[HTTP]',JSON[_0x7721('0x1a')](_0x3cc909));return rp(_['defaults'](_0x3cc909,{'method':_0x7721('0x1b'),'headers':headers,'json':!![]}));}function getAuth(_0x5cb0e6){var _0xfec626;if(_0x5cb0e6[_0x7721('0x1c')]===_0x7721('0x1d')){_0xfec626=util[_0x7721('0xe')](_0x7721('0x1e'),_0x5cb0e6[_0x7721('0x1f')],_0x5cb0e6[_0x7721('0x20')]);}else if(_0x5cb0e6[_0x7721('0x1c')]===_0x7721('0x21')){_0xfec626=util[_0x7721('0xe')]('%s/token:%s',_0x5cb0e6[_0x7721('0x1f')],_0x5cb0e6[_0x7721('0x21')]);}return util[_0x7721('0xe')](_0x7721('0x22'),new Buffer(_0xfec626)['toString'](_0x7721('0x23')));}function getEndUser(_0x512f31,_0xb9e9dd,_0x288e3a){logger[_0x7721('0x15')](_0x7721('0x24'),_0x288e3a);return request({'uri':util[_0x7721('0xe')](_0x7721('0x25'),_0x512f31[_0x7721('0x10')]),'qs':{'phone':_0x288e3a}})['then'](function(_0x216f20){if(_0x216f20[_0x7721('0x12')]){logger[_0x7721('0x15')](_0x7721('0x26'));return _0x216f20[_0x7721('0x27')][_0x7721('0x14')][0x0];}else{logger[_0x7721('0x15')](_0x7721('0x28'));return request({'uri':util[_0x7721('0xe')]('%s/customers',_0x512f31[_0x7721('0x10')]),'method':'POST','body':{'first_name':_0xb9e9dd,'title':_0xb9e9dd,'phone_numbers':[{'type':'work','value':_0x288e3a}]}});}});}function getTags(_0x315202,_0x343c19){var _0x53c904=[];if(_0x315202&&_0x315202[_0x7721('0x29')]>0x0){_0x53c904=_[_0x7721('0x2a')](_0x315202,_0x343c19);}return _0x53c904;}function getCustomFields(_0x37b9f0,_0xd7d703){var _0x1da2d8=[];var _0x5c54f0={'custom_fields':{}};if(_0x37b9f0[_0x7721('0x29')]>0x0){_[_0x7721('0x2b')](_0x37b9f0,function(_0x497f9f){if(_['includes']([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x2e')]&&!_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x497f9f[_0x7721('0x2e')]['toLowerCase']()]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_[_0x7721('0x32')]([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x7721('0x34')][_0x497f9f['idField']]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_0x497f9f['type']===_0x7721('0x35')&&_0x497f9f['variableName']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0xd7d703[_0x497f9f[_0x7721('0x36')]]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x36')]][_0x7721('0x31')]());}else if(_0x497f9f[_0x7721('0x37')]===_0x7721('0x38')&&_0x497f9f[_0x7721('0x39')]&&_0x497f9f[_0x7721('0x39')]['name']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f['customField']){_0xd7d703[_0x497f9f[_0x7721('0x39')][_0x7721('0x3a')][_0x7721('0x3b')]()]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x39')]['name']['toLowerCase']()]['toString']());}});}if(_0x5c54f0['priority']){_0x5c54f0[_0x7721('0x3c')]=Number(_0x5c54f0[_0x7721('0x3c')]);}return _0x5c54f0;}function getTicket(_0x1acc72,_0x22ef35,_0x4a90ce,_0xa389fa,_0x4cf659){logger[_0x7721('0x15')](_0x7721('0x3d'));var _0x5a278e=_[_0x7721('0x3e')]({'subject':intUtil[_0x7721('0x3f')](_0xa389fa['Subjects'],_0x4cf659,'\x20'),'type':'phone','status':_0x7721('0x40'),'labels':[_0x7721('0x41'),_0x7721('0x42'),_0x7721('0x43')]['concat'](getTags(_0xa389fa[_0x7721('0x44')],_0x7721('0x3a'))),'description':intUtil[_0x7721('0x3f')](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7721('0xe')]('/api/v2/users/%d',_0x22ef35['id']),'class':_0x7721('0x46')}},'message':{'direction':'in','body':intUtil['getString'](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a')}},getCustomFields(_0xa389fa['Fields'],_0x4cf659));return request({'uri':util[_0x7721('0xe')](_0x7721('0x47'),_0x1acc72[_0x7721('0x10')],_0x4a90ce['id']),'method':'POST','body':_0x5a278e});}exports[_0x7721('0x48')]=function(_0x11d853,_0x1ad315,_0x481fa8,_0x9f7b1d,_0x754071,_0xdb3033){var _0x2d5f35,_0x135dbc;_0xdb3033[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0xdb3033['remoteUri']);_0xdb3033['serverUrl']=intUtil[_0x7721('0x49')](_0xdb3033[_0x7721('0x4a')]);if(_0x754071&&_0x754071[_0x7721('0x4b')]){logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x4d'));_0x1ad315[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0xdb3033[_0x7721('0x4a')],_0x1ad315['uniqueid'],md5(_0x1ad315['uniqueid']));}else{_0x1ad315[_0x7721('0x4e')]='';}headers[_0x7721('0x50')]=getAuth(_0xdb3033);return getUser(_0xdb3033,_0x9f7b1d[_0x7721('0x51')])[_0x7721('0x11')](function(_0x589e95){_0x2d5f35=_0x589e95;logger[_0x7721('0x15')](_0x7721('0x52'),_0x2d5f35['id']);return getEndUser(_0xdb3033,_0x1ad315['calleridname'],_0x1ad315[_0x7721('0x53')]);})['then'](function(_0x2682b1){_0x135dbc=_0x2682b1;logger['info'](_0x7721('0x54'),_0x135dbc['id']);return getTicket(_0xdb3033,_0x2d5f35,_0x135dbc,_0x481fa8,_0x1ad315);})[_0x7721('0x11')](function(_0xf17c40){if(_0xf17c40){logger['info'](_0x7721('0x55'));logger[_0x7721('0x15')]('The\x20Ticket\x20ID\x20is:',_0xf17c40['id']);switch(_0xdb3033[_0x7721('0x37')]){case _0x7721('0x56'):logger[_0x7721('0x15')]('[QUEUE]',_0x7721('0x57'));emit(util['format'](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0xf17c40['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x5d'),_0xf17c40['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x4c'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2f6f30){console[_0x7721('0x5e')](_0x2f6f30);logger[_0x7721('0x5e')](_0x7721('0x4c'),JSON[_0x7721('0x1a')](_0x2f6f30));});};exports[_0x7721('0x60')]=function(_0x57484c,_0x234bee,_0x17036e,_0x134908,_0x3b7382,_0x1f1e84,_0x9c0d4){var _0x7fbd6c,_0x33287d;_0x1f1e84[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x10')]);_0x1f1e84['serverUrl']=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x4a')]);if(_0x9c0d4&&_0x9c0d4[_0x7721('0x61')]&&_0x9c0d4[_0x7721('0x61')]!==_0x7721('0x62')){logger[_0x7721('0x15')](_0x7721('0x63'),_0x7721('0x4d'));_0x234bee[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0x1f1e84[_0x7721('0x4a')],_0x234bee[_0x7721('0x64')],md5(_0x234bee[_0x7721('0x64')]));}headers[_0x7721('0x50')]=getAuth(_0x1f1e84);return getUser(_0x1f1e84,_0x134908['email'])['then'](function(_0x4e112e){_0x7fbd6c=_0x4e112e;logger[_0x7721('0x15')]('The\x20User\x20ID\x20is:',_0x7fbd6c['id']);return getEndUser(_0x1f1e84,_0x234bee['destcalleridname'],_0x234bee['destcalleridnum']);})['then'](function(_0x47925a){_0x33287d=_0x47925a;logger[_0x7721('0x15')](_0x7721('0x54'),_0x33287d['id']);return getTicket(_0x1f1e84,_0x7fbd6c,_0x33287d,_0x17036e,_0x234bee);})['then'](function(_0x5181d7){if(_0x5181d7){logger['info']('Ticket\x20created!');logger['info'](_0x7721('0x65'),_0x5181d7['id']);switch(_0x1f1e84['type']){case'integrationTab':logger['info'](_0x7721('0x4c'),_0x7721('0x57'));emit(util[_0x7721('0xe')]('user:%s',_0x134908[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0x5181d7['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x134908[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x66'),_0x1f1e84[_0x7721('0x10')],_0x5181d7['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x63'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2c93b0){logger[_0x7721('0x5e')](_0x7721('0x63'),JSON['stringify'](_0x2c93b0));});};exports[_0x7721('0x67')]=function(_0x104f05,_0x4c8284,_0x3e7df3,_0x5d37ad,_0x1f508d,_0x4bfb48){var _0x36a3a6,_0x3f9eaa;_0x4bfb48[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x4bfb48[_0x7721('0x10')]);_0x4bfb48[_0x7721('0x4a')]=intUtil[_0x7721('0x49')](_0x4bfb48['serverUrl']);if(_0x1f508d&&_0x1f508d[_0x7721('0x4b')]){logger[_0x7721('0x15')]('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',_0x7721('0x4d'));_0x4c8284[_0x7721('0x4e')]=util[_0x7721('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4bfb48[_0x7721('0x4a')],_0x4c8284[_0x7721('0x64')],md5(_0x4c8284['uniqueid']));}else{_0x4c8284[_0x7721('0x4e')]='';}headers['Authorization']=getAuth(_0x4bfb48);return getUser(_0x4bfb48)[_0x7721('0x11')](function(_0x382800){_0x36a3a6=_0x382800;logger[_0x7721('0x15')](_0x7721('0x52'),_0x36a3a6['id']);return getEndUser(_0x4bfb48,_0x4c8284[_0x7721('0x6a')],_0x4c8284[_0x7721('0x53')]);})[_0x7721('0x11')](function(_0x5dca04){_0x3f9eaa=_0x5dca04;logger[_0x7721('0x15')](_0x7721('0x54'),_0x3f9eaa['id']);return getTicket(_0x4bfb48,_0x36a3a6,_0x3f9eaa,_0x3e7df3,_0x4c8284);})[_0x7721('0x11')](function(_0x5f08cc){if(_0x5f08cc){logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x5f08cc['id']);}})[_0x7721('0x5f')](function(_0x2645dd){logger['error']('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',JSON[_0x7721('0x1a')](_0x2645dd));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index f437ba8..3b175ab 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 _0x4881=['uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20Call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','./util','md5','../../../../config/logger','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','clientId','remoteUri','username','password','clientSecret','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','then','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','validateEmail','email','userEmail','length','internalemailaddress','isdisabled',']\x20Agent\x20found\x20','systemuserid','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','toLowerCase','destcalleridnum','calleridnum','POST','contacts','/systemusers(','odata-entityid','substring','lastIndexOf','enduserId','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','telephone1','contactid',']\x20Enduser\x20Created!','includes','string','picklist','type','nameField','customField','idField','indexOf','content','ticketType','incident','getString','Subjects','Descriptions','Fields','phonecalls','assign','callDirection','queue','headers','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','outbound','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId'];(function(_0x31a68c,_0x4c65b5){var _0x113d4e=function(_0x241fab){while(--_0x241fab){_0x31a68c['push'](_0x31a68c['shift']());}};_0x113d4e(++_0x4c65b5);}(_0x4881,0x13b));var _0x1488=function(_0x3f308a,_0xfc681f){_0x3f308a=_0x3f308a-0x0;var _0x5b3cab=_0x4881[_0x3f308a];return _0x5b3cab;};'use strict';var _=require(_0x1488('0x0'));var BPromise=require(_0x1488('0x1'));var rp=require('request-promise');var util=require('util');var intUtil=require(_0x1488('0x2'));var md5=require(_0x1488('0x3'));var Redis=require('ioredis');var logger=require(_0x1488('0x4'))('dynamics365');var config=require(_0x1488('0x5'));config[_0x1488('0x6')]=_[_0x1488('0x7')](config[_0x1488('0x6')],{'host':_0x1488('0x8'),'port':0x18eb});var io=require(_0x1488('0x9'))(new Redis(config[_0x1488('0x6')]));function getAuthToken(_0x146305,_0x3adad4,_0x52d87d){var _0x4cb498={'method':'POST','uri':_0x3adad4,'form':{'client_id':_0x146305[_0x1488('0xa')],'resource':_0x146305[_0x1488('0xb')],'username':_0x146305[_0x1488('0xc')],'password':_0x146305[_0x1488('0xd')],'grant_type':'password','client_secret':_0x146305[_0x1488('0xe')]},'json':!![]};return rp(_0x4cb498)['then'](function(_0x1a5036){return _0x1a5036['access_token'];})[_0x1488('0xf')](function(_0x438794){logger[_0x1488('0x10')]('['+[_0x52d87d[_0x1488('0x11')]()]+_0x1488('0x12'));return _0x438794[_0x1488('0x13')];});}function getUser(_0x637e2d,_0x1695bb,_0x57c511,_0x35f2c2,_0x44034c,_0x2f51fc){return new BPromise(function(_0x2b9dfc,_0x24058b){return getAuthToken(_0x1695bb,_0x35f2c2,_0x2f51fc)[_0x1488('0x14')](function(_0x5b9366){var _0x404b1e={'method':_0x1488('0x15'),'uri':_0x44034c+_0x1488('0x16'),'headers':{'Authorization':_0x1488('0x17')+_0x5b9366,'OData-Version':_0x1488('0x18')},'json':!![]};return rp(_0x404b1e);})['then'](function(_0x5e6c2e){var _0x3845a2=_0x5e6c2e[_0x1488('0x19')];var _0x3e090e=![];var _0x25a9b6=null;if(!_['isNil'](_0x57c511)){if(intUtil[_0x1488('0x1a')](_0x57c511[_0x1488('0x1b')])){_0x637e2d[_0x1488('0x1c')]=_0x57c511[_0x1488('0x1b')];for(_0x25a9b6=0x0;_0x25a9b6<_0x3845a2[_0x1488('0x1d')];_0x25a9b6++){if(_0x3845a2[_0x25a9b6][_0x1488('0x1e')]===_0x57c511['email']&&!_0x3845a2[_0x25a9b6][_0x1488('0x1f')]){_0x3e090e=!![];logger['info']('['+[_0x2f51fc[_0x1488('0x11')]()]+_0x1488('0x20')+_0x3845a2[_0x25a9b6][_0x1488('0x21')]+'!');_0x637e2d['userId']=_0x3845a2[_0x25a9b6][_0x1488('0x21')];}}}}if(!_0x3e090e){logger[_0x1488('0x22')]('['+[_0x2f51fc[_0x1488('0x11')]()]+_0x1488('0x23'));_0x637e2d[_0x1488('0x1c')]=_0x1695bb[_0x1488('0xc')];for(_0x25a9b6=0x0;_0x25a9b6<_0x3845a2['length'];_0x25a9b6++){if(_0x3845a2[_0x25a9b6]['internalemailaddress']===_0x1695bb[_0x1488('0xc')]){_0x637e2d[_0x1488('0x24')]=_0x3845a2[_0x25a9b6][_0x1488('0x21')];}}}_0x2b9dfc(_0x637e2d);})[_0x1488('0xf')](function(_0x2e53ed){_0x24058b(_0x2e53ed[_0x1488('0x13')]);});});}function createEndUser(_0x28957e,_0x350693,_0x9e9bc3,_0x3ec72f,_0x1cf938,_0x1f1199){return new BPromise(function(_0x16ddab,_0x1a8d60){return getAuthToken(_0x350693,_0x9e9bc3,_0x1f1199)[_0x1488('0x14')](function(_0x3d1a68){var _0x4a5c19=_0x1f1199[_0x1488('0x25')]()==='outbound'?_0x1cf938[_0x1488('0x26')]:_0x1cf938[_0x1488('0x27')];var _0x489e5c={'method':_0x1488('0x28'),'uri':_0x3ec72f+_0x1488('0x29'),'body':{'telephone1':_0x4a5c19,'fullname':_0x4a5c19,'firstname':_0x4a5c19,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x1488('0x2a')+_0x28957e[_0x1488('0x24')]+')'},'headers':{'Authorization':_0x1488('0x17')+_0x3d1a68,'OData-Version':_0x1488('0x18')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x489e5c);})['then'](function(_0x3fd26b){var _0x2cbe1e=_0x3fd26b['headers'][_0x1488('0x2b')];var _0x5a805c=_0x2cbe1e[_0x1488('0x2c')](_0x2cbe1e[_0x1488('0x2d')]('(')+0x1,_0x2cbe1e['lastIndexOf'](')'));_0x28957e[_0x1488('0x2e')]=_0x5a805c;_0x16ddab(_0x28957e);})[_0x1488('0xf')](function(_0x1f3b7c){_0x1a8d60(_0x1f3b7c['message']);});});}function getEndUser(_0x226fcd,_0x232bae,_0xc31e6,_0x37993c,_0x542aa4,_0x14a9ad){return new BPromise(function(_0x1ebd07,_0x296aa1){var _0x41bc01=_0x14a9ad[_0x1488('0x25')]()==='outbound'?_0x542aa4[_0x1488('0x26')]:_0x542aa4[_0x1488('0x27')];return getAuthToken(_0x232bae,_0xc31e6,_0x14a9ad)['then'](function(_0x2f0496){var _0x10ca74={'method':'GET','uri':_0x37993c+_0x1488('0x2f')+_0x41bc01[_0x1488('0x30')]('+',_0x1488('0x31'))+'\x27','headers':{'Authorization':_0x1488('0x17')+_0x2f0496,'If-None-Match':null,'OData-Version':_0x1488('0x18')},'json':!![]};return rp(_0x10ca74);})[_0x1488('0x14')](function(_0x30ea76){var _0x581f90=null;if(_0x30ea76){var _0xd8eaa1=_0x30ea76[_0x1488('0x19')];var _0x57c5ac=![];for(_0x581f90=0x0;_0x581f90<_0xd8eaa1[_0x1488('0x1d')];_0x581f90++){if(_0xd8eaa1[_0x581f90][_0x1488('0x32')]===_0x41bc01){_0x57c5ac=!![];_0x226fcd[_0x1488('0x2e')]=_0xd8eaa1[_0x581f90][_0x1488('0x33')];}}if(_0x57c5ac){_0x1ebd07(_0x226fcd);}else{return createEndUser(_0x226fcd,_0x232bae,_0xc31e6,_0x37993c,_0x542aa4,_0x14a9ad)[_0x1488('0x14')](function(_0x515c9e){logger[_0x1488('0x22')]('['+[_0x14a9ad[_0x1488('0x11')]()]+']\x20Enduser\x20created!',_0x515c9e['enduserId']);_0x1ebd07(_0x515c9e);});}}else{return createEndUser(_0x226fcd,_0x232bae,_0xc31e6,_0x37993c,_0x542aa4,_0x14a9ad)['then'](function(_0x1525c9){logger[_0x1488('0x22')]('['+[_0x14a9ad[_0x1488('0x11')]()]+_0x1488('0x34'),_0x1525c9[_0x1488('0x2e')]);_0x1ebd07(_0x1525c9);});}});});}function getCustomFields(_0x18a604,_0x119ebf,_0x2b1b8f){var _0x18fb77={};if(_0x18a604[_0x1488('0x1d')]>0x0){_['forEach'](_0x18a604,function(_0x5310fc){if(_[_0x1488('0x35')]([_0x1488('0x36'),_0x1488('0x37')],_0x5310fc[_0x1488('0x38')])&&_0x5310fc[_0x1488('0x39')]&&!_0x5310fc[_0x1488('0x3a')]){var _0x3c8245=_0x5310fc[_0x1488('0x3b')][_0x1488('0x25')]();var _0x105374=_0x3c8245[_0x1488('0x2c')](0x0,_0x3c8245[_0x1488('0x3c')]('_'));var _0x2498c8=_0x3c8245[_0x1488('0x2c')](_0x3c8245['indexOf']('_')+0x1);if(_0x105374===_0x2b1b8f){_0x18fb77[_0x2498c8]=_0x5310fc[_0x1488('0x3d')];}}});}return _0x18fb77;}function getTicket(_0x4c82dc,_0x19206a,_0x3b16e4,_0x5d7629,_0x20c977,_0x2a234f,_0x27fb96){return new BPromise(function(_0x5456bf,_0xacee49){var _0x21d71e;return getAuthToken(_0x19206a,_0x3b16e4,_0x27fb96)[_0x1488('0x14')](function(_0x490564){if(_0x2a234f[_0x1488('0x3e')]===_0x1488('0x3f')){_0x21d71e={'method':_0x1488('0x28'),'uri':_0x5d7629+'incidents','body':Object['assign']({},{'title':intUtil[_0x1488('0x40')](_0x2a234f[_0x1488('0x41')],_0x20c977,'\x20'),'description':intUtil[_0x1488('0x40')](_0x2a234f[_0x1488('0x42')],_0x20c977,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x4c82dc['enduserId']+')','ownerid@odata.bind':_0x1488('0x2a')+_0x4c82dc[_0x1488('0x24')]+')','caseorigincode':'1'},getCustomFields(_0x2a234f[_0x1488('0x43')],_0x20c977,_0x2a234f[_0x1488('0x3e')])),'headers':{'Authorization':_0x1488('0x17')+_0x490564,'OData-Version':_0x1488('0x18')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2a234f[_0x1488('0x3e')]==='phonecall'){_0x21d71e={'method':_0x1488('0x28'),'uri':_0x5d7629+_0x1488('0x44'),'body':Object[_0x1488('0x45')]({},{'subject':intUtil['getString'](_0x2a234f[_0x1488('0x41')],_0x20c977,'\x20'),'phonenumber':String(_0x20c977[_0x1488('0x27')]),'description':intUtil[_0x1488('0x40')](_0x2a234f[_0x1488('0x42')],_0x20c977,'\x0a'),'regardingobjectid_contact@odata.bind':'/contacts('+_0x4c82dc[_0x1488('0x2e')]+')','ownerid@odata.bind':_0x1488('0x2a')+_0x4c82dc[_0x1488('0x24')]+')','directioncode':_0x4c82dc[_0x1488('0x46')]===_0x1488('0x47')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':'/systemusers('+_0x4c82dc[_0x1488('0x24')]+')','participationtypemask':_0x4c82dc[_0x1488('0x46')]===_0x1488('0x47')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x4c82dc['enduserId']+')','participationtypemask':_0x4c82dc[_0x1488('0x46')]==='queue'?0x1:0x2}]},getCustomFields(_0x2a234f[_0x1488('0x43')],_0x20c977,_0x2a234f[_0x1488('0x3e')])),'headers':{'Authorization':_0x1488('0x17')+_0x490564,'OData-Version':_0x1488('0x18')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x21d71e);})[_0x1488('0x14')](function(_0x3097a9){var _0x240ebb=_0x3097a9[_0x1488('0x48')]['odata-entityid'];var _0x3fc411=_0x240ebb[_0x1488('0x2c')](_0x240ebb['lastIndexOf']('(')+0x1,_0x240ebb[_0x1488('0x2d')](')'));_0x4c82dc[_0x1488('0x49')]=_0x3fc411;_0x5456bf(_0x4c82dc);})[_0x1488('0xf')](function(_0x24b897){_0xacee49(_0x24b897[_0x1488('0x13')]);});});}function emit(_0x3dde22,_0x320736,_0xc49731,_0x4e304c){var _0x4173da={'uri':util['format'](_0x1488('0x4a'),_0x3dde22,_0xc49731,_0x4e304c)};io['to'](util[_0x1488('0x4b')](_0x1488('0x4c'),_0x320736))[_0x1488('0x4d')](_0x1488('0x4e'),_0x4173da);}exports['cs']=function(_0x3903e0,_0x34849c,_0x426226,_0x3c5dcc,_0x109147,_0x4ee6ea,_0x457ac9,_0x5ce875){var _0xff3984={};_0x4ee6ea[_0x1488('0xb')]=intUtil['stripTrailingSlash'](_0x4ee6ea[_0x1488('0xb')]);_0x4ee6ea['serverUrl']=intUtil[_0x1488('0x4f')](_0x4ee6ea[_0x1488('0x50')]);_0xff3984[_0x1488('0x46')]=_0x5ce875===_0x1488('0x47')||_0x5ce875==='unmanaged'?_0x1488('0x47'):_0x1488('0x51');var _0x4e05c4=util[_0x1488('0x4b')](_0x1488('0x52'),_0x4ee6ea['remoteUri']);var _0x663547=util[_0x1488('0x4b')](_0x1488('0x53'),_0x4ee6ea[_0x1488('0x54')]);var _0x35137d=util[_0x1488('0x4b')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4ee6ea['serverUrl'],_0x34849c[_0x1488('0x55')],md5(_0x34849c['uniqueid']));if(_0x109147&&_0x109147[_0x1488('0x56')]){logger['info'](_0x1488('0x57'),_0x1488('0x58'));_0x34849c[_0x1488('0x59')]=_0x35137d;}else if(_0x457ac9&&_0x457ac9[_0x1488('0x5a')]&&_0x457ac9[_0x1488('0x5a')]!==_0x1488('0x5b')){logger[_0x1488('0x22')]('[OUTBOUND]',_0x1488('0x58'));_0x34849c[_0x1488('0x59')]=_0x35137d;}else{_0x34849c[_0x1488('0x59')]='';}return getUser(_0xff3984,_0x4ee6ea,_0x3c5dcc,_0x663547,_0x4e05c4,_0x5ce875)[_0x1488('0x14')](function(_0x549cde){logger[_0x1488('0x22')]('['+_0x5ce875[_0x1488('0x11')]()+_0x1488('0x5c'),_0x549cde['userId']);logger[_0x1488('0x22')]('['+_0x5ce875['toUpperCase']()+_0x1488('0x5d'),_0x549cde[_0x1488('0x1c')]);return getEndUser(_0x549cde,_0x4ee6ea,_0x663547,_0x4e05c4,_0x34849c,_0x5ce875);})['then'](function(_0x393c03){logger[_0x1488('0x22')]('['+_0x5ce875[_0x1488('0x11')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x393c03[_0x1488('0x2e')]);logger['info']('['+_0x5ce875['toUpperCase']()+']\x20The\x20Enduser\x20phone\x20is:',_0x34849c[_0x1488('0x27')]);return getTicket(_0x393c03,_0x4ee6ea,_0x663547,_0x4e05c4,_0x34849c,_0x426226,_0x5ce875);})[_0x1488('0x14')](function(_0x334004){logger[_0x1488('0x22')](util[_0x1488('0x4b')]('['+_0x5ce875[_0x1488('0x11')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x426226[_0x1488('0x3e')],_0x334004[_0x1488('0x49')]));logger[_0x1488('0x22')](util['format']('['+_0x5ce875[_0x1488('0x11')]()+_0x1488('0x5e'),_0x5ce875));if(_0x5ce875!==_0x1488('0x5f')){logger[_0x1488('0x22')]('['+_0x5ce875['toUpperCase']()+']',_0x1488('0x60'));emit(_0x4ee6ea['remoteUri'],_0x3c5dcc[_0x1488('0x61')],_0x426226[_0x1488('0x3e')],_0x334004[_0x1488('0x49')]);}})[_0x1488('0xf')](function(_0x2b5350){logger[_0x1488('0x10')]('['+_0x5ce875[_0x1488('0x11')]()+_0x1488('0x62'),util[_0x1488('0x63')](_0x2b5350,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x1ff6=['bluebird','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','defaults','redis','localhost','socket.io-emitter','POST','clientId','remoteUri','password','clientSecret','access_token','catch','toUpperCase',']\x20Wrong\x20credentials!','then','GET','Bearer\x20','4.0','value','isNil','email','userEmail','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','userId','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','message','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','headers','substring','lastIndexOf','enduserId','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','length','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','includes','string','picklist','nameField','customField','indexOf','content','ticketType','incident','getString','Subjects','Descriptions','/contacts(','Fields','phonecall','phonecalls','assign','callDirection','queue','odata-entityid','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','emit','stripTrailingSlash','serverUrl','%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!','recordingURL','recordingFormat','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','error',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash'];(function(_0x1f5967,_0x31ce3a){var _0x38ead3=function(_0xd737d4){while(--_0xd737d4){_0x1f5967['push'](_0x1f5967['shift']());}};_0x38ead3(++_0x31ce3a);}(_0x1ff6,0x68));var _0x61ff=function(_0x118657,_0x2acddb){_0x118657=_0x118657-0x0;var _0x504b05=_0x1ff6[_0x118657];return _0x504b05;};'use strict';var _=require(_0x61ff('0x0'));var BPromise=require(_0x61ff('0x1'));var rp=require('request-promise');var util=require('util');var intUtil=require(_0x61ff('0x2'));var md5=require(_0x61ff('0x3'));var Redis=require(_0x61ff('0x4'));var logger=require(_0x61ff('0x5'))(_0x61ff('0x6'));var config=require(_0x61ff('0x7'));config['redis']=_[_0x61ff('0x8')](config[_0x61ff('0x9')],{'host':_0x61ff('0xa'),'port':0x18eb});var io=require(_0x61ff('0xb'))(new Redis(config[_0x61ff('0x9')]));function getAuthToken(_0x19aa3d,_0x1b1e3f,_0x2415d6){var _0x24fe3f={'method':_0x61ff('0xc'),'uri':_0x1b1e3f,'form':{'client_id':_0x19aa3d[_0x61ff('0xd')],'resource':_0x19aa3d[_0x61ff('0xe')],'username':_0x19aa3d['username'],'password':_0x19aa3d['password'],'grant_type':_0x61ff('0xf'),'client_secret':_0x19aa3d[_0x61ff('0x10')]},'json':!![]};return rp(_0x24fe3f)['then'](function(_0x1ee988){return _0x1ee988[_0x61ff('0x11')];})[_0x61ff('0x12')](function(_0x1d8272){logger['error']('['+[_0x2415d6[_0x61ff('0x13')]()]+_0x61ff('0x14'));return _0x1d8272['message'];});}function getUser(_0x5bd02d,_0x370805,_0x506005,_0x517e1d,_0x3f7091,_0x5038a7){return new BPromise(function(_0x47ee5c,_0x3e9c5e){return getAuthToken(_0x370805,_0x517e1d,_0x5038a7)[_0x61ff('0x15')](function(_0x5612dd){var _0x4e2bd7={'method':_0x61ff('0x16'),'uri':_0x3f7091+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x61ff('0x17')+_0x5612dd,'OData-Version':_0x61ff('0x18')},'json':!![]};return rp(_0x4e2bd7);})[_0x61ff('0x15')](function(_0x449714){var _0x4fd101=_0x449714[_0x61ff('0x19')];var _0x10fb94=![];var _0x5ad756=null;if(!_[_0x61ff('0x1a')](_0x506005)){if(intUtil['validateEmail'](_0x506005[_0x61ff('0x1b')])){_0x5bd02d[_0x61ff('0x1c')]=_0x506005['email'];for(_0x5ad756=0x0;_0x5ad756<_0x4fd101['length'];_0x5ad756++){if(_0x4fd101[_0x5ad756][_0x61ff('0x1d')]===_0x506005[_0x61ff('0x1b')]&&!_0x4fd101[_0x5ad756][_0x61ff('0x1e')]){_0x10fb94=!![];logger[_0x61ff('0x1f')]('['+[_0x5038a7['toUpperCase']()]+_0x61ff('0x20')+_0x4fd101[_0x5ad756]['systemuserid']+'!');_0x5bd02d[_0x61ff('0x21')]=_0x4fd101[_0x5ad756][_0x61ff('0x22')];}}}}if(!_0x10fb94){logger[_0x61ff('0x1f')]('['+[_0x5038a7[_0x61ff('0x13')]()]+_0x61ff('0x23'));_0x5bd02d['userEmail']=_0x370805[_0x61ff('0x24')];for(_0x5ad756=0x0;_0x5ad756<_0x4fd101['length'];_0x5ad756++){if(_0x4fd101[_0x5ad756][_0x61ff('0x1d')]===_0x370805['username']){_0x5bd02d[_0x61ff('0x21')]=_0x4fd101[_0x5ad756][_0x61ff('0x22')];}}}_0x47ee5c(_0x5bd02d);})[_0x61ff('0x12')](function(_0x1c2990){_0x3e9c5e(_0x1c2990[_0x61ff('0x25')]);});});}function createEndUser(_0x3725b4,_0x4e426c,_0x20c357,_0x44fee5,_0x386b8d,_0x359444){return new BPromise(function(_0x2da1f3,_0x45dea){return getAuthToken(_0x4e426c,_0x20c357,_0x359444)[_0x61ff('0x15')](function(_0x1fc114){var _0x483b68=_0x359444[_0x61ff('0x26')]()===_0x61ff('0x27')?_0x386b8d[_0x61ff('0x28')]:_0x386b8d[_0x61ff('0x29')];var _0x5c512b={'method':_0x61ff('0xc'),'uri':_0x44fee5+_0x61ff('0x2a'),'body':{'telephone1':_0x483b68,'fullname':_0x483b68,'firstname':_0x483b68,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x61ff('0x2b')+_0x3725b4[_0x61ff('0x21')]+')'},'headers':{'Authorization':_0x61ff('0x17')+_0x1fc114,'OData-Version':_0x61ff('0x18')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x5c512b);})['then'](function(_0x504e9c){var _0x5d09cc=_0x504e9c[_0x61ff('0x2c')]['odata-entityid'];var _0x2e80c1=_0x5d09cc[_0x61ff('0x2d')](_0x5d09cc[_0x61ff('0x2e')]('(')+0x1,_0x5d09cc[_0x61ff('0x2e')](')'));_0x3725b4[_0x61ff('0x2f')]=_0x2e80c1;_0x2da1f3(_0x3725b4);})[_0x61ff('0x12')](function(_0x33ccbf){_0x45dea(_0x33ccbf[_0x61ff('0x25')]);});});}function getEndUser(_0x4501d0,_0x401259,_0x3ec6c4,_0x4d6055,_0x245c5e,_0x3bf218){return new BPromise(function(_0x166530,_0x350302){var _0x659a2b=_0x3bf218[_0x61ff('0x26')]()===_0x61ff('0x27')?_0x245c5e[_0x61ff('0x28')]:_0x245c5e['calleridnum'];return getAuthToken(_0x401259,_0x3ec6c4,_0x3bf218)[_0x61ff('0x15')](function(_0x1091f9){var _0x3505fc={'method':_0x61ff('0x16'),'uri':_0x4d6055+_0x61ff('0x30')+_0x659a2b[_0x61ff('0x31')]('+',_0x61ff('0x32'))+'\x27','headers':{'Authorization':_0x61ff('0x17')+_0x1091f9,'If-None-Match':null,'OData-Version':_0x61ff('0x18')},'json':!![]};return rp(_0x3505fc);})[_0x61ff('0x15')](function(_0x19f319){var _0x1e8d05=null;if(_0x19f319){var _0xaf4290=_0x19f319[_0x61ff('0x19')];var _0x274bd8=![];for(_0x1e8d05=0x0;_0x1e8d05<_0xaf4290[_0x61ff('0x33')];_0x1e8d05++){if(_0xaf4290[_0x1e8d05][_0x61ff('0x34')]===_0x659a2b){_0x274bd8=!![];_0x4501d0[_0x61ff('0x2f')]=_0xaf4290[_0x1e8d05][_0x61ff('0x35')];}}if(_0x274bd8){_0x166530(_0x4501d0);}else{return createEndUser(_0x4501d0,_0x401259,_0x3ec6c4,_0x4d6055,_0x245c5e,_0x3bf218)[_0x61ff('0x15')](function(_0x44cb84){logger['info']('['+[_0x3bf218[_0x61ff('0x13')]()]+_0x61ff('0x36'),_0x44cb84[_0x61ff('0x2f')]);_0x166530(_0x44cb84);});}}else{return createEndUser(_0x4501d0,_0x401259,_0x3ec6c4,_0x4d6055,_0x245c5e,_0x3bf218)[_0x61ff('0x15')](function(_0x2c3bd5){logger[_0x61ff('0x1f')]('['+[_0x3bf218[_0x61ff('0x13')]()]+_0x61ff('0x37'),_0x2c3bd5['enduserId']);_0x166530(_0x2c3bd5);});}});});}function getCustomFields(_0x1fe529,_0x1a6e8b,_0x2223e5){var _0x4b47d7={};if(_0x1fe529['length']>0x0){_[_0x61ff('0x38')](_0x1fe529,function(_0x2451b8){if(_[_0x61ff('0x39')]([_0x61ff('0x3a'),_0x61ff('0x3b')],_0x2451b8['type'])&&_0x2451b8[_0x61ff('0x3c')]&&!_0x2451b8[_0x61ff('0x3d')]){var _0x474187=_0x2451b8['idField'][_0x61ff('0x26')]();var _0x1f12ed=_0x474187['substring'](0x0,_0x474187[_0x61ff('0x3e')]('_'));var _0x570ed7=_0x474187[_0x61ff('0x2d')](_0x474187['indexOf']('_')+0x1);if(_0x1f12ed===_0x2223e5){_0x4b47d7[_0x570ed7]=_0x2451b8[_0x61ff('0x3f')];}}});}return _0x4b47d7;}function getTicket(_0x3e71d1,_0x552d6b,_0x5cff2d,_0x51406d,_0x239d50,_0x4de8ca,_0x5ae700){return new BPromise(function(_0x9c4c50,_0x167aad){var _0x4a1ee0;return getAuthToken(_0x552d6b,_0x5cff2d,_0x5ae700)['then'](function(_0x343bba){if(_0x4de8ca[_0x61ff('0x40')]===_0x61ff('0x41')){_0x4a1ee0={'method':_0x61ff('0xc'),'uri':_0x51406d+'incidents','body':Object['assign']({},{'title':intUtil[_0x61ff('0x42')](_0x4de8ca[_0x61ff('0x43')],_0x239d50,'\x20'),'description':intUtil[_0x61ff('0x42')](_0x4de8ca[_0x61ff('0x44')],_0x239d50,'\x0a'),'customerid_contact@odata.bind':_0x61ff('0x45')+_0x3e71d1['enduserId']+')','ownerid@odata.bind':_0x61ff('0x2b')+_0x3e71d1[_0x61ff('0x21')]+')','caseorigincode':'1'},getCustomFields(_0x4de8ca[_0x61ff('0x46')],_0x239d50,_0x4de8ca[_0x61ff('0x40')])),'headers':{'Authorization':_0x61ff('0x17')+_0x343bba,'OData-Version':_0x61ff('0x18')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x4de8ca['ticketType']===_0x61ff('0x47')){_0x4a1ee0={'method':'POST','uri':_0x51406d+_0x61ff('0x48'),'body':Object[_0x61ff('0x49')]({},{'subject':intUtil['getString'](_0x4de8ca[_0x61ff('0x43')],_0x239d50,'\x20'),'phonenumber':String(_0x239d50[_0x61ff('0x29')]),'description':intUtil[_0x61ff('0x42')](_0x4de8ca[_0x61ff('0x44')],_0x239d50,'\x0a'),'regardingobjectid_contact@odata.bind':_0x61ff('0x45')+_0x3e71d1['enduserId']+')','ownerid@odata.bind':_0x61ff('0x2b')+_0x3e71d1[_0x61ff('0x21')]+')','directioncode':_0x3e71d1[_0x61ff('0x4a')]===_0x61ff('0x4b')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x61ff('0x2b')+_0x3e71d1[_0x61ff('0x21')]+')','participationtypemask':_0x3e71d1[_0x61ff('0x4a')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x61ff('0x45')+_0x3e71d1['enduserId']+')','participationtypemask':_0x3e71d1[_0x61ff('0x4a')]===_0x61ff('0x4b')?0x1:0x2}]},getCustomFields(_0x4de8ca[_0x61ff('0x46')],_0x239d50,_0x4de8ca[_0x61ff('0x40')])),'headers':{'Authorization':'Bearer\x20'+_0x343bba,'OData-Version':_0x61ff('0x18')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x4a1ee0);})[_0x61ff('0x15')](function(_0x45a1cb){var _0x8106be=_0x45a1cb[_0x61ff('0x2c')][_0x61ff('0x4c')];var _0x4800c7=_0x8106be[_0x61ff('0x2d')](_0x8106be[_0x61ff('0x2e')]('(')+0x1,_0x8106be[_0x61ff('0x2e')](')'));_0x3e71d1[_0x61ff('0x4d')]=_0x4800c7;_0x9c4c50(_0x3e71d1);})['catch'](function(_0x49e931){_0x167aad(_0x49e931[_0x61ff('0x25')]);});});}function emit(_0x3cef2d,_0x4ca36a,_0x54b20d,_0x1e7d1a){var _0x36f613={'uri':util['format'](_0x61ff('0x4e'),_0x3cef2d,_0x54b20d,_0x1e7d1a)};io['to'](util[_0x61ff('0x4f')](_0x61ff('0x50'),_0x4ca36a))[_0x61ff('0x51')]('trigger:browser:url',_0x36f613);}exports['cs']=function(_0x152969,_0x3090e8,_0x10cfdc,_0x212c17,_0x7159a7,_0x53aa95,_0x38dbfe,_0x5ba6a5){var _0x4b9d7a={};_0x53aa95[_0x61ff('0xe')]=intUtil[_0x61ff('0x52')](_0x53aa95[_0x61ff('0xe')]);_0x53aa95[_0x61ff('0x53')]=intUtil[_0x61ff('0x52')](_0x53aa95[_0x61ff('0x53')]);_0x4b9d7a[_0x61ff('0x4a')]=_0x5ba6a5===_0x61ff('0x4b')||_0x5ba6a5==='unmanaged'?_0x61ff('0x4b'):_0x61ff('0x27');var _0x1bdb09=util[_0x61ff('0x4f')](_0x61ff('0x54'),_0x53aa95[_0x61ff('0xe')]);var _0x3b53ff=util[_0x61ff('0x4f')](_0x61ff('0x55'),_0x53aa95[_0x61ff('0x56')]);var _0xc8744c=util[_0x61ff('0x4f')](_0x61ff('0x57'),_0x53aa95[_0x61ff('0x53')],_0x3090e8[_0x61ff('0x58')],md5(_0x3090e8['uniqueid']));if(_0x7159a7&&_0x7159a7[_0x61ff('0x59')]){logger[_0x61ff('0x1f')](_0x61ff('0x5a'),_0x61ff('0x5b'));_0x3090e8[_0x61ff('0x5c')]=_0xc8744c;}else if(_0x38dbfe&&_0x38dbfe[_0x61ff('0x5d')]&&_0x38dbfe[_0x61ff('0x5d')]!=='none'){logger[_0x61ff('0x1f')](_0x61ff('0x5e'),_0x61ff('0x5b'));_0x3090e8['recordingURL']=_0xc8744c;}else{_0x3090e8['recordingURL']='';}return getUser(_0x4b9d7a,_0x53aa95,_0x212c17,_0x3b53ff,_0x1bdb09,_0x5ba6a5)[_0x61ff('0x15')](function(_0x2233c5){logger[_0x61ff('0x1f')]('['+_0x5ba6a5[_0x61ff('0x13')]()+_0x61ff('0x5f'),_0x2233c5['userId']);logger['info']('['+_0x5ba6a5[_0x61ff('0x13')]()+_0x61ff('0x60'),_0x2233c5[_0x61ff('0x1c')]);return getEndUser(_0x2233c5,_0x53aa95,_0x3b53ff,_0x1bdb09,_0x3090e8,_0x5ba6a5);})[_0x61ff('0x15')](function(_0x1edfcf){logger['info']('['+_0x5ba6a5[_0x61ff('0x13')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x1edfcf[_0x61ff('0x2f')]);logger[_0x61ff('0x1f')]('['+_0x5ba6a5[_0x61ff('0x13')]()+_0x61ff('0x61'),_0x3090e8[_0x61ff('0x29')]);return getTicket(_0x1edfcf,_0x53aa95,_0x3b53ff,_0x1bdb09,_0x3090e8,_0x10cfdc,_0x5ba6a5);})[_0x61ff('0x15')](function(_0x2441e8){logger[_0x61ff('0x1f')](util[_0x61ff('0x4f')]('['+_0x5ba6a5['toUpperCase']()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x10cfdc[_0x61ff('0x40')],_0x2441e8[_0x61ff('0x4d')]));logger['info'](util['format']('['+_0x5ba6a5[_0x61ff('0x13')]()+_0x61ff('0x62'),_0x5ba6a5));if(_0x5ba6a5!==_0x61ff('0x63')){logger[_0x61ff('0x1f')]('['+_0x5ba6a5[_0x61ff('0x13')]()+']',_0x61ff('0x64'));emit(_0x53aa95[_0x61ff('0xe')],_0x212c17[_0x61ff('0x65')],_0x10cfdc[_0x61ff('0x40')],_0x2441e8[_0x61ff('0x4d')]);}})[_0x61ff('0x12')](function(_0x2b8d8a){logger[_0x61ff('0x66')]('['+_0x5ba6a5[_0x61ff('0x13')]()+_0x61ff('0x67'),util[_0x61ff('0x68')](_0x2b8d8a,{'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 49cebba..9723c68 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 _0x7767=['name','Fields','mapValues','custom_fields','value','%s/api/v2/tickets','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','remoteUri','length','Agent\x20found!','find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','push','variable','variableName','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','error','none','Authorization','destcalleridnum','The\x20Enduser\x20ID\x20is:','[OUTBOUND]','catch','lastevent','toUpperCase','lodash','util','ioredis','./util','../../../../config/environment','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','application/json','emit','info','format','Caller\x20-\x20%s','calleridname','calleridnum','Subjects','Descriptions','
'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x7767,0x9e));var _0x7776=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0x7767[_0x5834bc];return _0x3e183a;};'use strict';var _=require(_0x7776('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0x7776('0x1'));var Redis=require(_0x7776('0x2'));var intUtil=require(_0x7776('0x3'));var config=require(_0x7776('0x4'));var logger=require(_0x7776('0x5'))('freshdesk');config['redis']=_[_0x7776('0x6')](config[_0x7776('0x7')],{'host':_0x7776('0x8'),'port':0x18eb});var io=require(_0x7776('0x9'))(new Redis(config['redis']));var headers={'Content-Type':_0x7776('0xa'),'Accept':_0x7776('0xa')};function emit(_0x19ab37,_0x5c81a2,_0x5037d3){io['to'](_0x19ab37)[_0x7776('0xb')](_0x5c81a2,_0x5037d3);}function getTicket(_0x588231,_0x4f791c,_0x105b50,_0x2e4513,_0x473daa){logger[_0x7776('0xc')]('Creating\x20new\x20ticket...');var _0x2665ea=_['merge']({'responder_id':_0x4f791c['id'],'requester_id':_0x105b50['id'],'name':util[_0x7776('0xd')](_0x7776('0xe'),_0x473daa[_0x7776('0xf')]),'phone':_0x473daa[_0x7776('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x2e4513[_0x7776('0x11')],_0x473daa,'\x20'),'description':intUtil['getString'](_0x2e4513[_0x7776('0x12')],_0x473daa,_0x7776('0x13')),'tags':getTags(_0x2e4513['Tags'],_0x7776('0x14'))},getCustomFields(_0x2e4513[_0x7776('0x15')],_0x473daa));_0x2665ea['custom_fields']=_[_0x7776('0x16')](_['keyBy'](_0x2665ea[_0x7776('0x17')],'id'),_0x7776('0x18'));return request({'uri':util['format'](_0x7776('0x19'),_0x588231['remoteUri']),'method':_0x7776('0x1a'),'body':_0x2665ea})[_0x7776('0x1b')](function(_0x5aafaf){logger[_0x7776('0xc')](_0x7776('0x1c'));return _0x5aafaf;});}function getUser(_0x18fa60,_0x28266e){if(intUtil[_0x7776('0x1d')](_0x28266e)){return request({'uri':util[_0x7776('0xd')](_0x7776('0x1e'),_0x18fa60[_0x7776('0x1f')]),'qs':{'email':_0x28266e}})['then'](function(_0x31ebb5){if(_0x31ebb5[_0x7776('0x20')]){logger[_0x7776('0xc')](_0x7776('0x21'));return _[_0x7776('0x22')](_0x31ebb5,function(_0x4065e2){return _0x4065e2['contact'][_0x7776('0x23')]===_0x28266e;});}else{logger[_0x7776('0xc')](_0x7776('0x24'));return request({'uri':util['format'](_0x7776('0x25'),_0x18fa60['remoteUri'])})['then'](function(_0x43b91a){logger[_0x7776('0xc')](_0x7776('0x26'));return _0x43b91a;});}});}else{logger[_0x7776('0xc')](_0x7776('0x27'));return request({'uri':util[_0x7776('0xd')](_0x7776('0x25'),_0x18fa60['remoteUri'])})[_0x7776('0x1b')](function(_0xa42ea9){logger['info']('Admin\x20account\x20selected.');return _0xa42ea9;});}}function getEndUser(_0x258c94,_0x2ba562,_0x17ac2b){logger[_0x7776('0xc')](_0x7776('0x28'),_0x17ac2b);return request({'uri':util[_0x7776('0xd')](_0x7776('0x29'),_0x258c94['remoteUri']),'qs':{'phone':_0x17ac2b}})[_0x7776('0x1b')](function(_0x44d322){if(_0x44d322[_0x7776('0x20')]){logger[_0x7776('0xc')](_0x7776('0x2a'));return _[_0x7776('0x22')](_0x44d322,{'phone':_0x17ac2b});}else{logger[_0x7776('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x7776('0xd')](_0x7776('0x29'),_0x258c94[_0x7776('0x1f')]),'method':_0x7776('0x1a'),'body':{'name':_0x2ba562,'phone':_0x17ac2b}})[_0x7776('0x1b')](function(_0x594011){logger[_0x7776('0xc')]('Enduser\x20created.');return _0x594011;});}});}function getAuth(_0x4fb01f){return util[_0x7776('0xd')](_0x7776('0x2b'),new Buffer(_0x4fb01f['apiKey']+':X')[_0x7776('0x2c')](_0x7776('0x2d')));}function request(_0x3a3f6f){logger[_0x7776('0x2e')](_0x7776('0x2f'),JSON[_0x7776('0x30')](_0x3a3f6f));return rp(_[_0x7776('0x6')](_0x3a3f6f,{'method':_0x7776('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x23a53e,_0x1d364f){var _0x2c03ae=[];if(_0x23a53e&&_0x23a53e['length']>0x0){_0x2c03ae=_[_0x7776('0x32')](_0x23a53e,_0x1d364f);}return _0x2c03ae;}function getCustomFields(_0x5b1b57,_0x8b8758){var _0x2ad39f=[];var _0x47f063={'custom_fields':[]};if(_0x5b1b57[_0x7776('0x20')]>0x0){_[_0x7776('0x33')](_0x5b1b57,function(_0x5c419e){if(_[_0x7776('0x34')]([_0x7776('0x35'),_0x7776('0x36')],_0x5c419e[_0x7776('0x37')])&&_0x5c419e[_0x7776('0x38')]&&!_0x5c419e[_0x7776('0x39')]){_0x47f063[_0x5c419e[_0x7776('0x38')][_0x7776('0x3a')]()]=_0x5c419e[_0x7776('0x3b')][_0x7776('0x2c')]();}else if(_[_0x7776('0x34')]([_0x7776('0x35'),_0x7776('0x36')],_0x5c419e[_0x7776('0x37')])&&_0x5c419e[_0x7776('0x3c')]&&_0x5c419e['customField']){_0x47f063[_0x7776('0x17')][_0x7776('0x3d')]({'id':_0x5c419e[_0x7776('0x3c')],'value':_0x5c419e[_0x7776('0x3b')][_0x7776('0x2c')]()});}else if(_0x5c419e[_0x7776('0x37')]===_0x7776('0x3e')&&_0x5c419e[_0x7776('0x3f')]&&_0x5c419e[_0x7776('0x3c')]&&_0x5c419e[_0x7776('0x39')]){_0x8b8758[_0x5c419e['variableName']]&&_0x47f063[_0x7776('0x17')]['push']({'id':_0x5c419e[_0x7776('0x3c')],'value':_0x8b8758[_0x5c419e[_0x7776('0x3f')]][_0x7776('0x2c')]()});}else if(_0x5c419e[_0x7776('0x37')]==='customVariable'&&_0x5c419e[_0x7776('0x40')]&&_0x5c419e[_0x7776('0x40')]['name']&&_0x5c419e['idField']&&_0x5c419e[_0x7776('0x39')]){_0x8b8758[_0x5c419e[_0x7776('0x40')]['name']['toLowerCase']()]&&_0x47f063[_0x7776('0x17')]['push']({'id':_0x5c419e[_0x7776('0x3c')],'value':_0x8b8758[_0x5c419e[_0x7776('0x40')][_0x7776('0x14')][_0x7776('0x3a')]()][_0x7776('0x2c')]()});}});}return _0x47f063;}exports[_0x7776('0x41')]=function(_0x56188b,_0x57c517,_0x2d9cd1,_0x2c9e58,_0x48045f,_0x4dca2f){var _0x1e8db0,_0xcf3b4b;_0x4dca2f['remoteUri']=intUtil[_0x7776('0x42')](_0x4dca2f[_0x7776('0x1f')]);_0x4dca2f[_0x7776('0x43')]=intUtil[_0x7776('0x42')](_0x4dca2f[_0x7776('0x43')]);if(_0x48045f&&_0x48045f[_0x7776('0x44')]){logger[_0x7776('0xc')](_0x7776('0x45'),_0x7776('0x46'));_0x57c517[_0x7776('0x47')]=util[_0x7776('0xd')](_0x7776('0x48'),_0x4dca2f[_0x7776('0x43')],_0x57c517[_0x7776('0x49')],md5(_0x57c517['uniqueid']));}else{_0x57c517['recordingURL']='';}headers['Authorization']=getAuth(_0x4dca2f);return getUser(_0x4dca2f,_0x2c9e58[_0x7776('0x23')])['then'](function(_0x554de3){_0x1e8db0=_0x554de3;logger['info'](_0x7776('0x4a'),_0x1e8db0['id']);return getEndUser(_0x4dca2f,_0x57c517[_0x7776('0xf')],_0x57c517[_0x7776('0x10')]);})[_0x7776('0x1b')](function(_0x251bf8){_0xcf3b4b=_0x251bf8;logger[_0x7776('0xc')]('The\x20Enduser\x20ID\x20is:',_0xcf3b4b['id']);return getTicket(_0x4dca2f,_0x1e8db0,_0xcf3b4b,_0x2d9cd1,_0x57c517);})[_0x7776('0x1b')](function(_0x53de6f){if(_0x53de6f&&_0x53de6f['id']){logger['info']('Ticket\x20created!');logger['info'](_0x7776('0x4b'),_0x53de6f['id']);logger['info'](_0x7776('0x45'),_0x7776('0x4c'));emit(util['format'](_0x7776('0x4d'),_0x2c9e58[_0x7776('0x14')]),_0x7776('0x4e'),{'uri':util['format'](_0x7776('0x4f'),_0x4dca2f['remoteUri'],_0x53de6f['id'])});}})['catch'](function(_0x2087e2){logger[_0x7776('0x50')](_0x7776('0x45'),JSON['stringify'](_0x2087e2));});};exports['outbound']=function(_0x9e82fd,_0x42e1b0,_0x3d6a11,_0x546f15,_0x309994,_0x11f6ad,_0x42517d){var _0x2126f4,_0x48125d;_0x11f6ad['remoteUri']=intUtil[_0x7776('0x42')](_0x11f6ad[_0x7776('0x1f')]);_0x11f6ad[_0x7776('0x43')]=intUtil[_0x7776('0x42')](_0x11f6ad[_0x7776('0x43')]);if(_0x42517d&&_0x42517d['recordingFormat']&&_0x42517d['recordingFormat']!==_0x7776('0x51')){logger['info']('[OUTBOUND]',_0x7776('0x46'));_0x42e1b0[_0x7776('0x47')]=util[_0x7776('0xd')](_0x7776('0x48'),_0x11f6ad[_0x7776('0x43')],_0x42e1b0[_0x7776('0x49')],md5(_0x42e1b0[_0x7776('0x49')]));}headers[_0x7776('0x52')]=getAuth(_0x11f6ad);return getUser(_0x11f6ad,_0x546f15['email'])['then'](function(_0x48e8f1){_0x2126f4=_0x48e8f1;logger[_0x7776('0xc')](_0x7776('0x4a'),_0x2126f4['id']);return getEndUser(_0x11f6ad,_0x42e1b0['destcalleridname'],_0x42e1b0[_0x7776('0x53')]);})[_0x7776('0x1b')](function(_0x1d197d){_0x48125d=_0x1d197d;logger[_0x7776('0xc')](_0x7776('0x54'),_0x48125d['id']);return getTicket(_0x11f6ad,_0x2126f4,_0x48125d,_0x3d6a11,_0x42e1b0);})[_0x7776('0x1b')](function(_0x1c807e){if(_0x1c807e&&_0x1c807e['id']){logger[_0x7776('0xc')](_0x7776('0x1c'));logger[_0x7776('0xc')](_0x7776('0x4b'),_0x1c807e['id']);logger['info'](_0x7776('0x55'),_0x7776('0x4c'));emit(util[_0x7776('0xd')]('user:%s',_0x546f15['name']),_0x7776('0x4e'),{'uri':util[_0x7776('0xd')]('%s/helpdesk/tickets/%d',_0x11f6ad['remoteUri'],_0x1c807e['id'])});}})[_0x7776('0x56')](function(_0x115c0a){logger['error'](_0x7776('0x55'),JSON[_0x7776('0x30')](_0x115c0a));});};exports['unmanaged']=function(_0x3f6d3b,_0x47a385,_0xbe4de2,_0x3faee5,_0x177dbd,_0x2b9869){var _0xb716b1,_0x4b2b86;_0x2b9869[_0x7776('0x1f')]=intUtil[_0x7776('0x42')](_0x2b9869[_0x7776('0x1f')]);_0x2b9869[_0x7776('0x43')]=intUtil[_0x7776('0x42')](_0x2b9869[_0x7776('0x43')]);if(_0x177dbd&&_0x177dbd[_0x7776('0x44')]){logger[_0x7776('0xc')]('['+_0x47a385[_0x7776('0x57')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x47a385[_0x7776('0x47')]=util[_0x7776('0xd')](_0x7776('0x48'),_0x2b9869[_0x7776('0x43')],_0x47a385['uniqueid'],md5(_0x47a385[_0x7776('0x49')]));}else{_0x47a385[_0x7776('0x47')]='';}headers[_0x7776('0x52')]=getAuth(_0x2b9869);return getUser(_0x2b9869,'')[_0x7776('0x1b')](function(_0x456e9c){_0xb716b1=_0x456e9c;logger[_0x7776('0xc')](_0x7776('0x4a'),_0xb716b1['id']);return getEndUser(_0x2b9869,_0x47a385[_0x7776('0xf')],_0x47a385[_0x7776('0x10')]);})[_0x7776('0x1b')](function(_0x364312){_0x4b2b86=_0x364312;logger[_0x7776('0xc')](_0x7776('0x54'),_0x4b2b86['id']);return getTicket(_0x2b9869,_0xb716b1,_0x4b2b86,_0xbe4de2,_0x47a385);})[_0x7776('0x1b')](function(_0x91548a){if(_0x91548a){logger[_0x7776('0xc')](_0x7776('0x1c'));logger[_0x7776('0xc')](_0x7776('0x4b'),_0x91548a['id']);}})[_0x7776('0x56')](function(_0x11465f){logger[_0x7776('0x50')]('['+_0x47a385[_0x7776('0x57')][_0x7776('0x58')]()+']',JSON[_0x7776('0x30')](_0x11465f));});}; \ No newline at end of file +var _0x1977=['variable','variableName','customVariable','Variable','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','format','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20created.','Basic\x20%s','toString','base64','debug','stringify','GET','map','forEach','includes','picklist','type','nameField','customField','toLowerCase','string','idField','push','content'];(function(_0x593d89,_0x45145f){var _0x4aa403=function(_0x21f674){while(--_0x21f674){_0x593d89['push'](_0x593d89['shift']());}};_0x4aa403(++_0x45145f);}(_0x1977,0x19b));var _0x7197=function(_0x2441f8,_0x30014b){_0x2441f8=_0x2441f8-0x0;var _0x1ed19c=_0x1977[_0x2441f8];return _0x1ed19c;};'use strict';var _=require(_0x7197('0x0'));var rp=require(_0x7197('0x1'));var md5=require(_0x7197('0x2'));var util=require(_0x7197('0x3'));var Redis=require('ioredis');var intUtil=require(_0x7197('0x4'));var config=require(_0x7197('0x5'));var logger=require(_0x7197('0x6'))(_0x7197('0x7'));config[_0x7197('0x8')]=_[_0x7197('0x9')](config[_0x7197('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x7197('0xa'))(new Redis(config['redis']));var headers={'Content-Type':'application/json','Accept':_0x7197('0xb')};function emit(_0x2e2871,_0x2adbac,_0x3d89c2){io['to'](_0x2e2871)[_0x7197('0xc')](_0x2adbac,_0x3d89c2);}function getTicket(_0x4f6fcd,_0x2224ca,_0x242ca1,_0x56e9f9,_0xe4c783){logger[_0x7197('0xd')](_0x7197('0xe'));var _0x12cc0c=_['merge']({'responder_id':_0x2224ca['id'],'requester_id':_0x242ca1['id'],'name':util['format'](_0x7197('0xf'),_0xe4c783[_0x7197('0x10')]),'phone':_0xe4c783[_0x7197('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x7197('0x12')](_0x56e9f9[_0x7197('0x13')],_0xe4c783,'\x20'),'description':intUtil['getString'](_0x56e9f9[_0x7197('0x14')],_0xe4c783,_0x7197('0x15')),'tags':getTags(_0x56e9f9[_0x7197('0x16')],_0x7197('0x17'))},getCustomFields(_0x56e9f9[_0x7197('0x18')],_0xe4c783));_0x12cc0c['custom_fields']=_['mapValues'](_['keyBy'](_0x12cc0c[_0x7197('0x19')],'id'),'value');return request({'uri':util[_0x7197('0x1a')](_0x7197('0x1b'),_0x4f6fcd[_0x7197('0x1c')]),'method':_0x7197('0x1d'),'body':_0x12cc0c})[_0x7197('0x1e')](function(_0x518d80){logger[_0x7197('0xd')](_0x7197('0x1f'));return _0x518d80;});}function getUser(_0x4461a9,_0x259ec8){if(intUtil[_0x7197('0x20')](_0x259ec8)){return request({'uri':util[_0x7197('0x1a')](_0x7197('0x21'),_0x4461a9['remoteUri']),'qs':{'email':_0x259ec8}})['then'](function(_0x386f1e){if(_0x386f1e[_0x7197('0x22')]){logger[_0x7197('0xd')](_0x7197('0x23'));return _[_0x7197('0x24')](_0x386f1e,function(_0x35f849){return _0x35f849[_0x7197('0x25')]['email']===_0x259ec8;});}else{logger[_0x7197('0xd')](_0x7197('0x26'));return request({'uri':util[_0x7197('0x1a')](_0x7197('0x27'),_0x4461a9[_0x7197('0x1c')])})[_0x7197('0x1e')](function(_0x5eb9a6){logger[_0x7197('0xd')](_0x7197('0x28'));return _0x5eb9a6;});}});}else{logger['info'](_0x7197('0x29'));return request({'uri':util['format'](_0x7197('0x27'),_0x4461a9['remoteUri'])})[_0x7197('0x1e')](function(_0x425cd9){logger['info'](_0x7197('0x28'));return _0x425cd9;});}}function getEndUser(_0x38b7bd,_0x35164e,_0xc19b7d){logger['info'](_0x7197('0x2a'),_0xc19b7d);return request({'uri':util[_0x7197('0x1a')](_0x7197('0x2b'),_0x38b7bd[_0x7197('0x1c')]),'qs':{'phone':_0xc19b7d}})[_0x7197('0x1e')](function(_0x3d50bf){if(_0x3d50bf['length']){logger[_0x7197('0xd')](_0x7197('0x2c'));return _[_0x7197('0x24')](_0x3d50bf,{'phone':_0xc19b7d});}else{logger[_0x7197('0xd')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x7197('0x1a')](_0x7197('0x2b'),_0x38b7bd[_0x7197('0x1c')]),'method':_0x7197('0x1d'),'body':{'name':_0x35164e,'phone':_0xc19b7d}})[_0x7197('0x1e')](function(_0x18fcb0){logger['info'](_0x7197('0x2d'));return _0x18fcb0;});}});}function getAuth(_0x569f4a){return util[_0x7197('0x1a')](_0x7197('0x2e'),new Buffer(_0x569f4a['apiKey']+':X')[_0x7197('0x2f')](_0x7197('0x30')));}function request(_0x665d4){logger[_0x7197('0x31')]('[HTTP]',JSON[_0x7197('0x32')](_0x665d4));return rp(_[_0x7197('0x9')](_0x665d4,{'method':_0x7197('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x521091,_0x1bc410){var _0x317707=[];if(_0x521091&&_0x521091['length']>0x0){_0x317707=_[_0x7197('0x34')](_0x521091,_0x1bc410);}return _0x317707;}function getCustomFields(_0x16e47c,_0x3ddcaf){var _0x5966d5=[];var _0x3a4392={'custom_fields':[]};if(_0x16e47c[_0x7197('0x22')]>0x0){_[_0x7197('0x35')](_0x16e47c,function(_0x2737cd){if(_[_0x7197('0x36')](['string',_0x7197('0x37')],_0x2737cd[_0x7197('0x38')])&&_0x2737cd[_0x7197('0x39')]&&!_0x2737cd[_0x7197('0x3a')]){_0x3a4392[_0x2737cd['nameField'][_0x7197('0x3b')]()]=_0x2737cd['content'][_0x7197('0x2f')]();}else if(_[_0x7197('0x36')]([_0x7197('0x3c'),_0x7197('0x37')],_0x2737cd[_0x7197('0x38')])&&_0x2737cd[_0x7197('0x3d')]&&_0x2737cd[_0x7197('0x3a')]){_0x3a4392[_0x7197('0x19')][_0x7197('0x3e')]({'id':_0x2737cd[_0x7197('0x3d')],'value':_0x2737cd[_0x7197('0x3f')][_0x7197('0x2f')]()});}else if(_0x2737cd[_0x7197('0x38')]===_0x7197('0x40')&&_0x2737cd['variableName']&&_0x2737cd[_0x7197('0x3d')]&&_0x2737cd[_0x7197('0x3a')]){_0x3ddcaf[_0x2737cd['variableName']]&&_0x3a4392[_0x7197('0x19')][_0x7197('0x3e')]({'id':_0x2737cd[_0x7197('0x3d')],'value':_0x3ddcaf[_0x2737cd[_0x7197('0x41')]][_0x7197('0x2f')]()});}else if(_0x2737cd[_0x7197('0x38')]===_0x7197('0x42')&&_0x2737cd['Variable']&&_0x2737cd[_0x7197('0x43')][_0x7197('0x17')]&&_0x2737cd[_0x7197('0x3d')]&&_0x2737cd[_0x7197('0x3a')]){_0x3ddcaf[_0x2737cd[_0x7197('0x43')][_0x7197('0x17')]['toLowerCase']()]&&_0x3a4392[_0x7197('0x19')][_0x7197('0x3e')]({'id':_0x2737cd[_0x7197('0x3d')],'value':_0x3ddcaf[_0x2737cd[_0x7197('0x43')][_0x7197('0x17')][_0x7197('0x3b')]()][_0x7197('0x2f')]()});}});}return _0x3a4392;}exports['queue']=function(_0xaa0d4c,_0x46418c,_0x34b2a8,_0x3620b3,_0x14f1be,_0x1110ee){var _0x49f7c1,_0x5b6350;_0x1110ee[_0x7197('0x1c')]=intUtil['stripTrailingSlash'](_0x1110ee[_0x7197('0x1c')]);_0x1110ee[_0x7197('0x44')]=intUtil[_0x7197('0x45')](_0x1110ee[_0x7197('0x44')]);if(_0x14f1be&&_0x14f1be['monitor_format']){logger[_0x7197('0xd')](_0x7197('0x46'),_0x7197('0x47'));_0x46418c['recordingURL']=util[_0x7197('0x1a')](_0x7197('0x48'),_0x1110ee[_0x7197('0x44')],_0x46418c['uniqueid'],md5(_0x46418c[_0x7197('0x49')]));}else{_0x46418c[_0x7197('0x4a')]='';}headers[_0x7197('0x4b')]=getAuth(_0x1110ee);return getUser(_0x1110ee,_0x3620b3[_0x7197('0x4c')])['then'](function(_0x27b2c6){_0x49f7c1=_0x27b2c6;logger[_0x7197('0xd')](_0x7197('0x4d'),_0x49f7c1['id']);return getEndUser(_0x1110ee,_0x46418c[_0x7197('0x10')],_0x46418c[_0x7197('0x11')]);})[_0x7197('0x1e')](function(_0x52e614){_0x5b6350=_0x52e614;logger[_0x7197('0xd')]('The\x20Enduser\x20ID\x20is:',_0x5b6350['id']);return getTicket(_0x1110ee,_0x49f7c1,_0x5b6350,_0x34b2a8,_0x46418c);})[_0x7197('0x1e')](function(_0x253a4a){if(_0x253a4a&&_0x253a4a['id']){logger[_0x7197('0xd')]('Ticket\x20created!');logger[_0x7197('0xd')](_0x7197('0x4e'),_0x253a4a['id']);logger[_0x7197('0xd')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x3620b3[_0x7197('0x17')]),_0x7197('0x4f'),{'uri':util[_0x7197('0x1a')](_0x7197('0x50'),_0x1110ee[_0x7197('0x1c')],_0x253a4a['id'])});}})[_0x7197('0x51')](function(_0x4ea2b0){logger[_0x7197('0x52')]('[QUEUE]',JSON[_0x7197('0x32')](_0x4ea2b0));});};exports[_0x7197('0x53')]=function(_0x19ff20,_0x42b8cf,_0x402799,_0x2062b3,_0x1f30fc,_0x2b924b,_0xfd1dae){var _0x376752,_0x2c1cf8;_0x2b924b['remoteUri']=intUtil['stripTrailingSlash'](_0x2b924b[_0x7197('0x1c')]);_0x2b924b['serverUrl']=intUtil['stripTrailingSlash'](_0x2b924b[_0x7197('0x44')]);if(_0xfd1dae&&_0xfd1dae[_0x7197('0x54')]&&_0xfd1dae[_0x7197('0x54')]!==_0x7197('0x55')){logger['info']('[OUTBOUND]',_0x7197('0x47'));_0x42b8cf[_0x7197('0x4a')]=util[_0x7197('0x1a')](_0x7197('0x48'),_0x2b924b[_0x7197('0x44')],_0x42b8cf[_0x7197('0x49')],md5(_0x42b8cf[_0x7197('0x49')]));}headers[_0x7197('0x4b')]=getAuth(_0x2b924b);return getUser(_0x2b924b,_0x2062b3['email'])['then'](function(_0x1b05bb){_0x376752=_0x1b05bb;logger[_0x7197('0xd')]('The\x20User\x20ID\x20is:',_0x376752['id']);return getEndUser(_0x2b924b,_0x42b8cf[_0x7197('0x56')],_0x42b8cf[_0x7197('0x57')]);})[_0x7197('0x1e')](function(_0x4ce01d){_0x2c1cf8=_0x4ce01d;logger[_0x7197('0xd')](_0x7197('0x58'),_0x2c1cf8['id']);return getTicket(_0x2b924b,_0x376752,_0x2c1cf8,_0x402799,_0x42b8cf);})[_0x7197('0x1e')](function(_0x753b7e){if(_0x753b7e&&_0x753b7e['id']){logger[_0x7197('0xd')]('Ticket\x20created!');logger[_0x7197('0xd')]('The\x20Ticket\x20ID\x20is:',_0x753b7e['id']);logger['info'](_0x7197('0x59'),_0x7197('0x5a'));emit(util['format'](_0x7197('0x5b'),_0x2062b3['name']),_0x7197('0x4f'),{'uri':util[_0x7197('0x1a')](_0x7197('0x50'),_0x2b924b[_0x7197('0x1c')],_0x753b7e['id'])});}})['catch'](function(_0x183dc2){logger[_0x7197('0x52')](_0x7197('0x59'),JSON['stringify'](_0x183dc2));});};exports[_0x7197('0x5c')]=function(_0x477e42,_0x3e3044,_0x21eee4,_0x37ab59,_0x1ab3ff,_0x583647){var _0x4de120,_0x18bf90;_0x583647[_0x7197('0x1c')]=intUtil[_0x7197('0x45')](_0x583647['remoteUri']);_0x583647[_0x7197('0x44')]=intUtil[_0x7197('0x45')](_0x583647[_0x7197('0x44')]);if(_0x1ab3ff&&_0x1ab3ff['monitor_format']){logger[_0x7197('0xd')]('['+_0x3e3044[_0x7197('0x5d')][_0x7197('0x5e')]()+']','Recording\x20is\x20enabled!');_0x3e3044[_0x7197('0x4a')]=util[_0x7197('0x1a')](_0x7197('0x48'),_0x583647[_0x7197('0x44')],_0x3e3044[_0x7197('0x49')],md5(_0x3e3044['uniqueid']));}else{_0x3e3044['recordingURL']='';}headers[_0x7197('0x4b')]=getAuth(_0x583647);return getUser(_0x583647,'')['then'](function(_0x5816b7){_0x4de120=_0x5816b7;logger[_0x7197('0xd')](_0x7197('0x4d'),_0x4de120['id']);return getEndUser(_0x583647,_0x3e3044[_0x7197('0x10')],_0x3e3044[_0x7197('0x11')]);})['then'](function(_0x4872d1){_0x18bf90=_0x4872d1;logger['info']('The\x20Enduser\x20ID\x20is:',_0x18bf90['id']);return getTicket(_0x583647,_0x4de120,_0x18bf90,_0x21eee4,_0x3e3044);})[_0x7197('0x1e')](function(_0x1c1d1c){if(_0x1c1d1c){logger[_0x7197('0xd')](_0x7197('0x1f'));logger[_0x7197('0xd')](_0x7197('0x4e'),_0x1c1d1c['id']);}})[_0x7197('0x51')](function(_0x4cec76){logger[_0x7197('0x52')]('['+_0x3e3044[_0x7197('0x5d')][_0x7197('0x5e')]()+']',JSON[_0x7197('0x32')](_0x4cec76));});}; \ 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 44b90a4..9fa9b9f 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 _0x2e05=['toLowerCase','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','md5','bluebird','ioredis','./util','../../../../config/environment','freshsales','redis','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','adminId','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','email','User\x20found:','userId','Admin\x20selected','adminEmail','catch','/api/lookup?q=','&f=','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','POST','/api/contacts','contactNumber','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','getString','Subjects','Descriptions','add','ticketId','/contacts/','user:%s','emit','trigger:browser:url','remoteUri','stripTrailingSlash','serverUrl'];(function(_0x300f1f,_0x598f68){var _0x430c2f=function(_0x1e479f){while(--_0x1e479f){_0x300f1f['push'](_0x300f1f['shift']());}};_0x430c2f(++_0x598f68);}(_0x2e05,0xfc));var _0x52e0=function(_0x14527b,_0x426577){_0x14527b=_0x14527b-0x0;var _0x2fe75f=_0x2e05[_0x14527b];return _0x2fe75f;};'use strict';var _=require(_0x52e0('0x0'));var rp=require(_0x52e0('0x1'));var md5=require(_0x52e0('0x2'));var util=require('util');var moment=require('moment');var Promise=require(_0x52e0('0x3'));var Redis=require(_0x52e0('0x4'));var intUtil=require(_0x52e0('0x5'));var config=require(_0x52e0('0x6'));var logger=require('../../../../config/logger')(_0x52e0('0x7'));config['redis']=_['defaults'](config[_0x52e0('0x8')],{'host':_0x52e0('0x9'),'port':0x18eb});var io=require(_0x52e0('0xa'))(new Redis(config['redis']));function getAdminId(_0x4b83cc,_0x515bb0,_0x27f70e,_0x5325bc){return new Promise(function(_0x4a3811,_0x5ec3c7){var _0x5e950a=![];var _0x4da6b5={'method':_0x52e0('0xb'),'uri':_0x5325bc+_0x52e0('0xc'),'json':!![]};_0x4da6b5[_0x52e0('0xd')]=_0x27f70e;logger[_0x52e0('0xe')](_0x52e0('0xf'));return rp(_0x4da6b5)[_0x52e0('0x10')](function(_0x4019b6){if(_0x4019b6){var _0x555a40=_0x4019b6[_0x52e0('0x11')];var _0x5e51e1=null;for(_0x5e51e1=0x0;_0x5e51e1<_0x555a40[_0x52e0('0x12')];_0x5e51e1++){if(_0x555a40[_0x5e51e1]['email']===_0x4b83cc['adminEmail']){_0x4b83cc[_0x52e0('0x13')]=_0x555a40[_0x5e51e1]['id'];_0x5e950a=!![];}}if(_0x5e950a){logger[_0x52e0('0xe')]('Admin\x20found:',_0x4b83cc['adminId']);_0x4a3811(_0x4b83cc);}else{_0x5ec3c7({'statusCode':0x194,'message':_0x52e0('0x14')});}}else{_0x5ec3c7({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0x4abb81){logger[_0x52e0('0x15')]('['+[_0x515bb0[_0x52e0('0x16')]()]+']',_0x4abb81[_0x52e0('0x17')]);_0x5ec3c7(_0x4abb81);});});}function getUser(_0x347493,_0x139ce7,_0x38cdd7){return function(_0x502ec7){return new Promise(function(_0x7df860,_0x4e74c2){var _0x4e86ea={'method':_0x52e0('0xb'),'uri':_0x38cdd7+'/api/selector/owners','json':!![]};_0x4e86ea[_0x52e0('0xd')]=_0x139ce7;logger[_0x52e0('0xe')](_0x52e0('0x18'));return rp(_0x4e86ea)[_0x52e0('0x10')](function(_0x2944b8){if(_0x2944b8){var _0x3d44b8=_0x2944b8[_0x52e0('0x11')];var _0x299020=![];var _0xbc0c2=null;if(_0x502ec7[_0x52e0('0x19')]!==null){logger[_0x52e0('0xe')](_0x52e0('0x1a'),_0x502ec7['agentEmail']);_0x502ec7[_0x52e0('0x1b')]=_0x502ec7['agentEmail'];for(_0xbc0c2=0x0;_0xbc0c2<_0x3d44b8[_0x52e0('0x12')];_0xbc0c2++){if(_0x3d44b8[_0xbc0c2][_0x52e0('0x1c')]===_0x502ec7['agentEmail']){_0x299020=!![];_0x502ec7['userId']=_0x3d44b8[_0xbc0c2]['id'];logger[_0x52e0('0xe')](_0x52e0('0x1d'),_0x502ec7[_0x52e0('0x1e')]);}}}if(!_0x299020){logger['info'](_0x52e0('0x1f'));_0x502ec7[_0x52e0('0x1b')]=_0x502ec7[_0x52e0('0x20')];_0x502ec7[_0x52e0('0x1e')]=_0x502ec7[_0x52e0('0x13')];_0x299020=!![];}if(_0x299020){_0x7df860(_0x502ec7);}else{_0x4e74c2({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x4e74c2({'statusCode':0x194,'message':_0x52e0('0x14')});}})[_0x52e0('0x21')](function(_0x48853f){logger[_0x52e0('0x15')]('['+[_0x347493['toUpperCase']()]+']',_0x48853f[_0x52e0('0x17')]);_0x4e74c2(_0x48853f);});});};}function searchContact(_0x2527a5,_0xe638fd,_0x4e4186,_0x36b2a1){return new Promise(function(_0x3e9476,_0x30e9b6){var _0x122443={'method':_0x52e0('0xb'),'headers':_0xe638fd,'uri':_0x2527a5+_0x52e0('0x22')+_0x36b2a1+_0x52e0('0x23')+_0x4e4186+'&entities=contact','json':!![]};rp(_0x122443)['then'](function(_0x47371a){var _0x110a1c=_[_0x52e0('0x24')](_0x47371a['contacts'][_0x52e0('0x25')],[_0x4e4186,_0x36b2a1]);_0x3e9476(_0x110a1c);})[_0x52e0('0x21')](function(_0x270f6c){_0x30e9b6(_0x270f6c);});});}function getEndUser(_0x1663a7,_0x16436d,_0x12ba56){return function(_0x435346){return new Promise(function(_0x1320ca,_0x1d9020){logger['info'](util[_0x52e0('0x26')](_0x52e0('0x27'),_0x435346['contactNumber']));searchContact(_0x12ba56,_0x16436d,_0x52e0('0x28'),_0x435346['contactNumber'])['then'](function(_0x4f9c69){if(_0x4f9c69){_0x435346[_0x52e0('0x29')]=_0x4f9c69['id'];logger[_0x52e0('0xe')](_0x52e0('0x2a'),_0x435346['endUserId']);return _0x1320ca(_0x435346);}searchContact(_0x12ba56,_0x16436d,_0x52e0('0x2b'),_0x435346['contactNumber'])['then'](function(_0x4eab17){if(_0x4eab17){_0x435346[_0x52e0('0x29')]=_0x4eab17['id'];logger[_0x52e0('0xe')](_0x52e0('0x2c'),_0x435346[_0x52e0('0x29')]);return _0x1320ca(_0x435346);}createEndUser(_0x435346,_0x1663a7,_0x16436d,_0x12ba56)[_0x52e0('0x10')](function(_0x26b994){logger[_0x52e0('0xe')]('Contact\x20created:',_0x26b994['endUserId']);return _0x1320ca(_0x26b994);});});})[_0x52e0('0x21')](function(_0x522c69){_0x1d9020(_0x522c69);});});};}function createEndUser(_0x54abac,_0x534475,_0xc40eaa,_0xfaff49){return new Promise(function(_0x4cd942,_0x997fa5){var _0x5240af=moment();var _0x4437e6={'method':_0x52e0('0x2d'),'uri':_0xfaff49+_0x52e0('0x2e'),'body':{'contact':{'last_name':_0x54abac['contactNumber'],'work_number':_0x54abac[_0x52e0('0x2f')],'mobile_number':_0x54abac[_0x52e0('0x2f')],'owner_id':_0x54abac[_0x52e0('0x1e')],'created_at':_0x5240af['format'](_0x52e0('0x30'))}},'json':!![]};_0x4437e6[_0x52e0('0xd')]=_0xc40eaa;logger[_0x52e0('0xe')](_0x52e0('0x31'));return rp(_0x4437e6)[_0x52e0('0x10')](function(_0x5ed90){_0x54abac[_0x52e0('0x29')]=_0x5ed90[_0x52e0('0x32')]['id'];_0x4cd942(_0x54abac);})[_0x52e0('0x21')](function(_0x59f3a2){logger[_0x52e0('0x15')]('['+[_0x534475[_0x52e0('0x16')]()]+']',_0x59f3a2[_0x52e0('0x17')]);_0x997fa5(_0x59f3a2[_0x52e0('0x17')]);});});}function getTicket(_0x299de8,_0x2763a2,_0xf43899,_0x46ea05,_0x49a921){return function(_0x335267){logger['info'](_0x52e0('0x33'));return new Promise(function(_0x348e75,_0x1d5d63){var _0x535e27=moment();var _0x5a3731={'method':_0x52e0('0x2d'),'uri':_0xf43899+'/api/tasks','body':{'title':intUtil[_0x52e0('0x34')](_0x46ea05[_0x52e0('0x35')],_0x49a921,'\x20'),'description':intUtil[_0x52e0('0x34')](_0x46ea05[_0x52e0('0x36')],_0x49a921,'\x0a'),'owner_id':_0x335267[_0x52e0('0x1e')],'creater_id':_0x335267['adminId'],'targetable_id':_0x335267['endUserId'],'targetable_type':'Contact','created_at':_0x535e27[_0x52e0('0x26')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x535e27[_0x52e0('0x37')](0x1e,'m')['format'](_0x52e0('0x30'))},'json':!![]};_0x5a3731[_0x52e0('0xd')]=_0x2763a2;return rp(_0x5a3731)['then'](function(_0x3aabd4){_0x335267[_0x52e0('0x38')]=_0x3aabd4['task']['id'];logger['info']('Task\x20created:',_0x335267[_0x52e0('0x38')]);_0x348e75(_0x335267);})[_0x52e0('0x21')](function(_0xace96a){logger['error']('['+[_0x299de8[_0x52e0('0x16')]()]+']',_0xace96a['message']);_0x1d5d63(_0xace96a[_0x52e0('0x17')]);});});};}function emit(_0x3670a6,_0x382f29,_0x1929f6){var _0x458198={'uri':_0x3670a6+_0x52e0('0x39')+_0x1929f6};io['to'](util[_0x52e0('0x26')](_0x52e0('0x3a'),_0x382f29))[_0x52e0('0x3b')](_0x52e0('0x3c'),_0x458198);}exports['cs']=function(_0x8d9bfd,_0x4d701b,_0x474110,_0x24462d,_0xe914d8,_0xd35c99,_0xfdead,_0x15a186){var _0x5d0c00={};var _0x4bf9e4={'Authorization':'Token\x20token='+_0xd35c99['apiKey']};_0xd35c99[_0x52e0('0x3d')]=intUtil[_0x52e0('0x3e')](_0xd35c99[_0x52e0('0x3d')]);_0xd35c99['serverUrl']=intUtil[_0x52e0('0x3e')](_0xd35c99[_0x52e0('0x3f')]);var _0x112ae5=_0xd35c99[_0x52e0('0x3d')];_0x5d0c00[_0x52e0('0x20')]=_0xd35c99['username'];_0x5d0c00['contactNumber']=_0x15a186[_0x52e0('0x40')]()==='outbound'?_0x4d701b[_0x52e0('0x41')]:_0x4d701b[_0x52e0('0x42')];_0x5d0c00[_0x52e0('0x43')]=_0x15a186===_0x52e0('0x44')||_0x15a186==='unmanaged'?_0x52e0('0x44'):'outbound';if(_0x24462d){_0x5d0c00[_0x52e0('0x19')]=_0x24462d[_0x52e0('0x1c')];}var _0x4f7a44=util[_0x52e0('0x26')](_0x52e0('0x45'),_0xd35c99['serverUrl'],_0x4d701b[_0x52e0('0x46')],md5(_0x4d701b['uniqueid']));if(_0xe914d8&&_0xe914d8['monitor_format']){logger[_0x52e0('0xe')]('[QUEUE]','Recording\x20is\x20enabled!');_0x4d701b[_0x52e0('0x47')]=_0x4f7a44;}else if(_0xfdead&&_0xfdead['recordingFormat']&&_0xfdead['recordingFormat']!==_0x52e0('0x48')){logger['info'](_0x52e0('0x49'),_0x52e0('0x4a'));_0x4d701b[_0x52e0('0x47')]=_0x4f7a44;}else{_0x4d701b['recordingURL']='';}return getAdminId(_0x5d0c00,_0x15a186,_0x4bf9e4,_0x112ae5)[_0x52e0('0x10')](getUser(_0x15a186,_0x4bf9e4,_0x112ae5))[_0x52e0('0x10')](getEndUser(_0x15a186,_0x4bf9e4,_0x112ae5))[_0x52e0('0x10')](getTicket(_0x15a186,_0x4bf9e4,_0x112ae5,_0x474110,_0x4d701b))[_0x52e0('0x10')](function(_0x2026ba){logger[_0x52e0('0xe')](util[_0x52e0('0x26')](_0x52e0('0x4b'),_0x2026ba[_0x52e0('0x38')]));if(_0x15a186!==_0x52e0('0x4c')){logger[_0x52e0('0xe')]('['+[_0x15a186['toUpperCase']()]+']',_0x52e0('0x4d'));emit(_0x112ae5,_0x24462d['name'],_0x2026ba[_0x52e0('0x29')]);}})[_0x52e0('0x21')](function(_0x4fe929){logger[_0x52e0('0x15')]('['+[_0x15a186[_0x52e0('0x16')]()]+_0x52e0('0x4e'),util['inspect'](_0x4fe929,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x0581=['ioredis','./util','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','email','adminEmail','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','message','then','users','agentEmail','Getting\x20user\x20with\x20email','userEmail','length','Admin\x20selected','error','toUpperCase','&entities=contact','find','contacts','catch','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','endUserId','work_number','Contact\x20created:','POST','/api/contacts','userId','YYYY-MM-DDTHH:mm:ss','Creating\x20new\x20task','getString','Contact','add','task','/contacts/','user:%s','trigger:browser:url','apiKey','remoteUri','stripTrailingSlash','serverUrl','toLowerCase','outbound','destcalleridnum','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','ticketId','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','md5','util','bluebird'];(function(_0x11908c,_0x4550dd){var _0x3781b2=function(_0x1d034f){while(--_0x1d034f){_0x11908c['push'](_0x11908c['shift']());}};_0x3781b2(++_0x4550dd);}(_0x0581,0x9a));var _0x1058=function(_0x5e4d7a,_0x474456){_0x5e4d7a=_0x5e4d7a-0x0;var _0x446c84=_0x0581[_0x5e4d7a];return _0x446c84;};'use strict';var _=require('lodash');var rp=require(_0x1058('0x0'));var md5=require(_0x1058('0x1'));var util=require(_0x1058('0x2'));var moment=require('moment');var Promise=require(_0x1058('0x3'));var Redis=require(_0x1058('0x4'));var intUtil=require(_0x1058('0x5'));var config=require('../../../../config/environment');var logger=require(_0x1058('0x6'))(_0x1058('0x7'));config[_0x1058('0x8')]=_[_0x1058('0x9')](config[_0x1058('0x8')],{'host':_0x1058('0xa'),'port':0x18eb});var io=require(_0x1058('0xb'))(new Redis(config[_0x1058('0x8')]));function getAdminId(_0x2a8ec6,_0x307abb,_0x55921b,_0x335d40){return new Promise(function(_0x27c60c,_0x3b9812){var _0x2ff48f=![];var _0x17486c={'method':_0x1058('0xc'),'uri':_0x335d40+_0x1058('0xd'),'json':!![]};_0x17486c[_0x1058('0xe')]=_0x55921b;logger[_0x1058('0xf')](_0x1058('0x10'));return rp(_0x17486c)['then'](function(_0x575a52){if(_0x575a52){var _0x7670f8=_0x575a52['users'];var _0x36d22=null;for(_0x36d22=0x0;_0x36d22<_0x7670f8['length'];_0x36d22++){if(_0x7670f8[_0x36d22][_0x1058('0x11')]===_0x2a8ec6[_0x1058('0x12')]){_0x2a8ec6['adminId']=_0x7670f8[_0x36d22]['id'];_0x2ff48f=!![];}}if(_0x2ff48f){logger[_0x1058('0xf')](_0x1058('0x13'),_0x2a8ec6[_0x1058('0x14')]);_0x27c60c(_0x2a8ec6);}else{_0x3b9812({'statusCode':0x194,'message':_0x1058('0x15')});}}else{_0x3b9812({'statusCode':0x194,'message':_0x1058('0x15')});}})['catch'](function(_0x26faa7){logger['error']('['+[_0x307abb['toUpperCase']()]+']',_0x26faa7[_0x1058('0x16')]);_0x3b9812(_0x26faa7);});});}function getUser(_0x9e41e9,_0x1f8417,_0x2d8b55){return function(_0x59b054){return new Promise(function(_0x1ef2da,_0x3c6dfe){var _0x2c9374={'method':_0x1058('0xc'),'uri':_0x2d8b55+_0x1058('0xd'),'json':!![]};_0x2c9374[_0x1058('0xe')]=_0x1f8417;logger['info']('Getting\x20user\x20list');return rp(_0x2c9374)[_0x1058('0x17')](function(_0x41cad9){if(_0x41cad9){var _0x5e9ba1=_0x41cad9[_0x1058('0x18')];var _0x1ff3a2=![];var _0x45e210=null;if(_0x59b054[_0x1058('0x19')]!==null){logger[_0x1058('0xf')](_0x1058('0x1a'),_0x59b054[_0x1058('0x19')]);_0x59b054[_0x1058('0x1b')]=_0x59b054['agentEmail'];for(_0x45e210=0x0;_0x45e210<_0x5e9ba1[_0x1058('0x1c')];_0x45e210++){if(_0x5e9ba1[_0x45e210][_0x1058('0x11')]===_0x59b054[_0x1058('0x19')]){_0x1ff3a2=!![];_0x59b054['userId']=_0x5e9ba1[_0x45e210]['id'];logger[_0x1058('0xf')]('User\x20found:',_0x59b054['userId']);}}}if(!_0x1ff3a2){logger['info'](_0x1058('0x1d'));_0x59b054[_0x1058('0x1b')]=_0x59b054[_0x1058('0x12')];_0x59b054['userId']=_0x59b054[_0x1058('0x14')];_0x1ff3a2=!![];}if(_0x1ff3a2){_0x1ef2da(_0x59b054);}else{_0x3c6dfe({'statusCode':0x194,'message':_0x1058('0x15')});}}else{_0x3c6dfe({'statusCode':0x194,'message':_0x1058('0x15')});}})['catch'](function(_0x23b6fb){logger[_0x1058('0x1e')]('['+[_0x9e41e9[_0x1058('0x1f')]()]+']',_0x23b6fb['message']);_0x3c6dfe(_0x23b6fb);});});};}function searchContact(_0x17d051,_0x3e03b4,_0x49a616,_0x5b01ec){return new Promise(function(_0x3e011f,_0x42d123){var _0x2d6b56={'method':_0x1058('0xc'),'headers':_0x3e03b4,'uri':_0x17d051+'/api/lookup?q='+_0x5b01ec+'&f='+_0x49a616+_0x1058('0x20'),'json':!![]};rp(_0x2d6b56)['then'](function(_0x2de339){var _0xba5e8b=_[_0x1058('0x21')](_0x2de339['contacts'][_0x1058('0x22')],[_0x49a616,_0x5b01ec]);_0x3e011f(_0xba5e8b);})[_0x1058('0x23')](function(_0x5a8b37){_0x42d123(_0x5a8b37);});});}function getEndUser(_0x4e46c1,_0x485778,_0x3deee5){return function(_0x161a7b){return new Promise(function(_0x3ae013,_0x357059){logger[_0x1058('0xf')](util[_0x1058('0x24')](_0x1058('0x25'),_0x161a7b[_0x1058('0x26')]));searchContact(_0x3deee5,_0x485778,_0x1058('0x27'),_0x161a7b[_0x1058('0x26')])[_0x1058('0x17')](function(_0x54fe4b){if(_0x54fe4b){_0x161a7b['endUserId']=_0x54fe4b['id'];logger[_0x1058('0xf')](_0x1058('0x28'),_0x161a7b[_0x1058('0x29')]);return _0x3ae013(_0x161a7b);}searchContact(_0x3deee5,_0x485778,_0x1058('0x2a'),_0x161a7b[_0x1058('0x26')])[_0x1058('0x17')](function(_0x510b73){if(_0x510b73){_0x161a7b['endUserId']=_0x510b73['id'];logger[_0x1058('0xf')]('Contact\x20found\x20work_number:',_0x161a7b[_0x1058('0x29')]);return _0x3ae013(_0x161a7b);}createEndUser(_0x161a7b,_0x4e46c1,_0x485778,_0x3deee5)['then'](function(_0x1d5a12){logger[_0x1058('0xf')](_0x1058('0x2b'),_0x1d5a12['endUserId']);return _0x3ae013(_0x1d5a12);});});})['catch'](function(_0x44f2a0){_0x357059(_0x44f2a0);});});};}function createEndUser(_0x510dd2,_0x586697,_0x250647,_0x8a8937){return new Promise(function(_0x597803,_0x30e730){var _0x1eda91=moment();var _0x124d55={'method':_0x1058('0x2c'),'uri':_0x8a8937+_0x1058('0x2d'),'body':{'contact':{'last_name':_0x510dd2[_0x1058('0x26')],'work_number':_0x510dd2[_0x1058('0x26')],'mobile_number':_0x510dd2[_0x1058('0x26')],'owner_id':_0x510dd2[_0x1058('0x2e')],'created_at':_0x1eda91[_0x1058('0x24')](_0x1058('0x2f'))}},'json':!![]};_0x124d55['headers']=_0x250647;logger[_0x1058('0xf')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x124d55)[_0x1058('0x17')](function(_0x5b772a){_0x510dd2[_0x1058('0x29')]=_0x5b772a['contact']['id'];_0x597803(_0x510dd2);})[_0x1058('0x23')](function(_0x42b2b4){logger[_0x1058('0x1e')]('['+[_0x586697[_0x1058('0x1f')]()]+']',_0x42b2b4[_0x1058('0x16')]);_0x30e730(_0x42b2b4[_0x1058('0x16')]);});});}function getTicket(_0x79d677,_0x11e955,_0x144125,_0x13b8c9,_0xdbe252){return function(_0x35f656){logger[_0x1058('0xf')](_0x1058('0x30'));return new Promise(function(_0x33a26a,_0x2aff45){var _0x23d0b4=moment();var _0x239f98={'method':'POST','uri':_0x144125+'/api/tasks','body':{'title':intUtil['getString'](_0x13b8c9['Subjects'],_0xdbe252,'\x20'),'description':intUtil[_0x1058('0x31')](_0x13b8c9['Descriptions'],_0xdbe252,'\x0a'),'owner_id':_0x35f656[_0x1058('0x2e')],'creater_id':_0x35f656[_0x1058('0x14')],'targetable_id':_0x35f656[_0x1058('0x29')],'targetable_type':_0x1058('0x32'),'created_at':_0x23d0b4[_0x1058('0x24')](_0x1058('0x2f')),'due_date':_0x23d0b4[_0x1058('0x33')](0x1e,'m')[_0x1058('0x24')](_0x1058('0x2f'))},'json':!![]};_0x239f98['headers']=_0x11e955;return rp(_0x239f98)[_0x1058('0x17')](function(_0x463c5d){_0x35f656['ticketId']=_0x463c5d[_0x1058('0x34')]['id'];logger[_0x1058('0xf')]('Task\x20created:',_0x35f656['ticketId']);_0x33a26a(_0x35f656);})['catch'](function(_0x5898bc){logger['error']('['+[_0x79d677['toUpperCase']()]+']',_0x5898bc[_0x1058('0x16')]);_0x2aff45(_0x5898bc[_0x1058('0x16')]);});});};}function emit(_0x46d659,_0x620199,_0x22d15f){var _0x22798c={'uri':_0x46d659+_0x1058('0x35')+_0x22d15f};io['to'](util[_0x1058('0x24')](_0x1058('0x36'),_0x620199))['emit'](_0x1058('0x37'),_0x22798c);}exports['cs']=function(_0x5a6100,_0x524c0e,_0x21d8ed,_0x19a64d,_0x1d6d97,_0x27e7db,_0x327ecf,_0x39f0c6){var _0x1fdea={};var _0x3b324d={'Authorization':'Token\x20token='+_0x27e7db[_0x1058('0x38')]};_0x27e7db[_0x1058('0x39')]=intUtil[_0x1058('0x3a')](_0x27e7db[_0x1058('0x39')]);_0x27e7db['serverUrl']=intUtil['stripTrailingSlash'](_0x27e7db[_0x1058('0x3b')]);var _0x564d6c=_0x27e7db[_0x1058('0x39')];_0x1fdea[_0x1058('0x12')]=_0x27e7db['username'];_0x1fdea[_0x1058('0x26')]=_0x39f0c6[_0x1058('0x3c')]()===_0x1058('0x3d')?_0x524c0e[_0x1058('0x3e')]:_0x524c0e[_0x1058('0x3f')];_0x1fdea['callDirection']=_0x39f0c6===_0x1058('0x40')||_0x39f0c6===_0x1058('0x41')?_0x1058('0x40'):_0x1058('0x3d');if(_0x19a64d){_0x1fdea[_0x1058('0x19')]=_0x19a64d[_0x1058('0x11')];}var _0x3cbe09=util[_0x1058('0x24')](_0x1058('0x42'),_0x27e7db[_0x1058('0x3b')],_0x524c0e[_0x1058('0x43')],md5(_0x524c0e[_0x1058('0x43')]));if(_0x1d6d97&&_0x1d6d97[_0x1058('0x44')]){logger[_0x1058('0xf')]('[QUEUE]',_0x1058('0x45'));_0x524c0e[_0x1058('0x46')]=_0x3cbe09;}else if(_0x327ecf&&_0x327ecf[_0x1058('0x47')]&&_0x327ecf[_0x1058('0x47')]!=='none'){logger[_0x1058('0xf')](_0x1058('0x48'),_0x1058('0x45'));_0x524c0e[_0x1058('0x46')]=_0x3cbe09;}else{_0x524c0e['recordingURL']='';}return getAdminId(_0x1fdea,_0x39f0c6,_0x3b324d,_0x564d6c)[_0x1058('0x17')](getUser(_0x39f0c6,_0x3b324d,_0x564d6c))[_0x1058('0x17')](getEndUser(_0x39f0c6,_0x3b324d,_0x564d6c))[_0x1058('0x17')](getTicket(_0x39f0c6,_0x3b324d,_0x564d6c,_0x21d8ed,_0x524c0e))['then'](function(_0x2a05b6){logger['info'](util[_0x1058('0x24')](_0x1058('0x49'),_0x2a05b6[_0x1058('0x4a')]));if(_0x39f0c6!=='unmanaged'){logger[_0x1058('0xf')]('['+[_0x39f0c6[_0x1058('0x1f')]()]+']',_0x1058('0x4b'));emit(_0x564d6c,_0x19a64d[_0x1058('0x4c')],_0x2a05b6[_0x1058('0x29')]);}})[_0x1058('0x23')](function(_0x181612){logger[_0x1058('0x1e')]('['+[_0x39f0c6[_0x1058('0x1f')]()]+_0x1058('0x4d'),util[_0x1058('0x4e')](_0x181612,{'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 647eea7..24394da 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 _0x24d8=['./sugarcrm','./freshdesk','./desk','./vtiger','./dynamics365','sugarcrm','freshdesk','zoho','desk','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','zendesk','vtiger','../../../../config/logger','error','[EXEC]','format','%s\x20account\x20#%s\x20not\x20found','lodash','util','./salesforce'];(function(_0x316721,_0x173394){var _0x3695d1=function(_0x5b60cb){while(--_0x5b60cb){_0x316721['push'](_0x316721['shift']());}};_0x3695d1(++_0x173394);}(_0x24d8,0x165));var _0x824d=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0x24d8[_0x2080a3];return _0x8d7d17;};'use strict';var _=require(_0x824d('0x0'));var util=require(_0x824d('0x1'));var zendesk=require('./zendesk');var salesforce=require(_0x824d('0x2'));var sugarcrm=require(_0x824d('0x3'));var freshdesk=require(_0x824d('0x4'));var zoho=require('./zoho');var desk=require(_0x824d('0x5'));var vtiger=require(_0x824d('0x6'));var servicenow=require('./servicenow');var dynamics365=require(_0x824d('0x7'));var freshsales=require('./freshsales');var integrations=['zendesk','salesforce',_0x824d('0x8'),_0x824d('0x9'),_0x824d('0xa'),_0x824d('0xb'),'vtiger',_0x824d('0xc'),_0x824d('0xd'),_0x824d('0xe')];exports[_0x824d('0xf')]=function(_0x3a3af8,_0x4aba37,_0x3b0b3,_0x65437d,_0x3b0bcd,_0x5200e9){if(_0x3b0b3){if(_[_0x824d('0x10')](integrations,_0x3a3af8[_0x824d('0x11')][_0x824d('0x12')]())){try{var _0x3e74f0=null;var _0x3220f0='';var _0x526f05=_0x3b0b3[_0x3a3af8[_0x824d('0x11')][_0x824d('0x12')]()];if(_0x526f05){var _0x14f770=_0x526f05[_0x3a3af8[_0x824d('0x13')]];if(_0x14f770){var _0x14e717=_[_0x824d('0x14')](_0x14f770[_0x824d('0x15')],{'id':parseInt(_0x3a3af8[_0x824d('0x16')],0xa)});if(_0x14e717){if(_0x65437d){if(_0x3b0bcd&&_0x4aba37['queue']){_0x3220f0=_0x824d('0x17');}else if(_0x4aba37[_0x824d('0x18')]){_0x3220f0=_0x824d('0x19');}else{console[_0x824d('0x1a')](_0x824d('0x1b'),_0x4aba37);}}else{_0x3220f0=_0x824d('0x1c');}switch(_0x3a3af8[_0x824d('0x11')][_0x824d('0x12')]()){case _0x824d('0x1d'):zendesk[_0x3220f0](_0x3a3af8,_0x4aba37,_0x14e717,_0x65437d,_0x3b0bcd,_0x14f770,_0x5200e9);break;case'salesforce':salesforce[_0x3220f0](_0x3a3af8,_0x4aba37,_0x14e717,_0x65437d,_0x3b0bcd,_0x14f770,_0x5200e9);break;case _0x824d('0x8'):sugarcrm[_0x3220f0](_0x3a3af8,_0x4aba37,_0x14e717,_0x65437d,_0x3b0bcd,_0x14f770,_0x5200e9);break;case _0x824d('0x9'):freshdesk[_0x3220f0](_0x3a3af8,_0x4aba37,_0x14e717,_0x65437d,_0x3b0bcd,_0x14f770,_0x5200e9);break;case'zoho':zoho[_0x3220f0](_0x3a3af8,_0x4aba37,_0x14e717,_0x65437d,_0x3b0bcd,_0x14f770,_0x5200e9);break;case'desk':desk[_0x3220f0](_0x3a3af8,_0x4aba37,_0x14e717,_0x65437d,_0x3b0bcd,_0x14f770,_0x5200e9);break;case _0x824d('0x1e'):vtiger[_0x3220f0](_0x3a3af8,_0x4aba37,_0x14e717,_0x65437d,_0x3b0bcd,_0x14f770,_0x5200e9);break;case _0x824d('0xd'):freshsales['cs'](_0x3a3af8,_0x4aba37,_0x14e717,_0x65437d,_0x3b0bcd,_0x14f770,_0x5200e9,_0x3220f0);break;case _0x824d('0xe'):servicenow['cs'](_0x3a3af8,_0x4aba37,_0x14e717,_0x65437d,_0x3b0bcd,_0x14f770,_0x5200e9,_0x3220f0);break;case _0x824d('0xc'):dynamics365['cs'](_0x3a3af8,_0x4aba37,_0x14e717,_0x65437d,_0x3b0bcd,_0x14f770,_0x5200e9,_0x3220f0);break;default:console[_0x824d('0x1a')]('unknown\x20integration');}}else{_0x3e74f0=require(_0x824d('0x1f'))(_0x3a3af8[_0x824d('0x11')][_0x824d('0x12')]());_0x3e74f0[_0x824d('0x20')](_0x824d('0x21'),util[_0x824d('0x22')]('%s\x20configuration\x20#%s\x20not\x20found',_0x3a3af8[_0x824d('0x11')]['toLowerCase'](),_0x3a3af8[_0x824d('0x16')]));}}else{_0x3e74f0=require(_0x824d('0x1f'))(_0x3a3af8[_0x824d('0x11')][_0x824d('0x12')]());_0x3e74f0['error'](_0x824d('0x21'),util[_0x824d('0x22')](_0x824d('0x23'),_0x3a3af8[_0x824d('0x11')][_0x824d('0x12')](),_0x3a3af8[_0x824d('0x13')]));}}else{}}catch(_0x4b103b){console[_0x824d('0x20')](_0x4b103b);}}}}; \ No newline at end of file +var _0xd177=['zoho','vtiger','freshsales','servicenow','includes','data1','toLowerCase','data2','find','queue','log','EVENT\x20UNKNOWN','unmanaged','zendesk','desk','dynamics365','unknown\x20integration','../../../../config/logger','error','format','[EXEC]','%s\x20account\x20#%s\x20not\x20found','./zendesk','./salesforce','./sugarcrm','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','salesforce','sugarcrm','freshdesk'];(function(_0x56e5ff,_0x38ad7e){var _0x1a3063=function(_0x456ecd){while(--_0x456ecd){_0x56e5ff['push'](_0x56e5ff['shift']());}};_0x1a3063(++_0x38ad7e);}(_0xd177,0x11e));var _0x7d17=function(_0x2f369f,_0x226439){_0x2f369f=_0x2f369f-0x0;var _0x2fabe3=_0xd177[_0x2f369f];return _0x2fabe3;};'use strict';var _=require('lodash');var util=require('util');var zendesk=require(_0x7d17('0x0'));var salesforce=require(_0x7d17('0x1'));var sugarcrm=require(_0x7d17('0x2'));var freshdesk=require('./freshdesk');var zoho=require('./zoho');var desk=require(_0x7d17('0x3'));var vtiger=require(_0x7d17('0x4'));var servicenow=require(_0x7d17('0x5'));var dynamics365=require(_0x7d17('0x6'));var freshsales=require(_0x7d17('0x7'));var integrations=['zendesk',_0x7d17('0x8'),_0x7d17('0x9'),_0x7d17('0xa'),_0x7d17('0xb'),'desk',_0x7d17('0xc'),'dynamics365',_0x7d17('0xd'),_0x7d17('0xe')];exports['exec']=function(_0x550193,_0x43e92f,_0x552e69,_0x46b53f,_0x4df462,_0x15780d){if(_0x552e69){if(_[_0x7d17('0xf')](integrations,_0x550193[_0x7d17('0x10')][_0x7d17('0x11')]())){try{var _0x222dbc=null;var _0x32e6b2='';var _0x31ce20=_0x552e69[_0x550193[_0x7d17('0x10')]['toLowerCase']()];if(_0x31ce20){var _0x2b39d3=_0x31ce20[_0x550193[_0x7d17('0x12')]];if(_0x2b39d3){var _0x455013=_[_0x7d17('0x13')](_0x2b39d3['Configurations'],{'id':parseInt(_0x550193['data3'],0xa)});if(_0x455013){if(_0x46b53f){if(_0x4df462&&_0x43e92f[_0x7d17('0x14')]){_0x32e6b2=_0x7d17('0x14');}else if(_0x43e92f['routeId']){_0x32e6b2='outbound';}else{console[_0x7d17('0x15')](_0x7d17('0x16'),_0x43e92f);}}else{_0x32e6b2=_0x7d17('0x17');}switch(_0x550193[_0x7d17('0x10')][_0x7d17('0x11')]()){case _0x7d17('0x18'):zendesk[_0x32e6b2](_0x550193,_0x43e92f,_0x455013,_0x46b53f,_0x4df462,_0x2b39d3,_0x15780d);break;case _0x7d17('0x8'):salesforce[_0x32e6b2](_0x550193,_0x43e92f,_0x455013,_0x46b53f,_0x4df462,_0x2b39d3,_0x15780d);break;case _0x7d17('0x9'):sugarcrm[_0x32e6b2](_0x550193,_0x43e92f,_0x455013,_0x46b53f,_0x4df462,_0x2b39d3,_0x15780d);break;case _0x7d17('0xa'):freshdesk[_0x32e6b2](_0x550193,_0x43e92f,_0x455013,_0x46b53f,_0x4df462,_0x2b39d3,_0x15780d);break;case'zoho':zoho[_0x32e6b2](_0x550193,_0x43e92f,_0x455013,_0x46b53f,_0x4df462,_0x2b39d3,_0x15780d);break;case _0x7d17('0x19'):desk[_0x32e6b2](_0x550193,_0x43e92f,_0x455013,_0x46b53f,_0x4df462,_0x2b39d3,_0x15780d);break;case _0x7d17('0xc'):vtiger[_0x32e6b2](_0x550193,_0x43e92f,_0x455013,_0x46b53f,_0x4df462,_0x2b39d3,_0x15780d);break;case'freshsales':freshsales['cs'](_0x550193,_0x43e92f,_0x455013,_0x46b53f,_0x4df462,_0x2b39d3,_0x15780d,_0x32e6b2);break;case _0x7d17('0xe'):servicenow['cs'](_0x550193,_0x43e92f,_0x455013,_0x46b53f,_0x4df462,_0x2b39d3,_0x15780d,_0x32e6b2);break;case _0x7d17('0x1a'):dynamics365['cs'](_0x550193,_0x43e92f,_0x455013,_0x46b53f,_0x4df462,_0x2b39d3,_0x15780d,_0x32e6b2);break;default:console[_0x7d17('0x15')](_0x7d17('0x1b'));}}else{_0x222dbc=require(_0x7d17('0x1c'))(_0x550193[_0x7d17('0x10')]['toLowerCase']());_0x222dbc[_0x7d17('0x1d')]('[EXEC]',util[_0x7d17('0x1e')]('%s\x20configuration\x20#%s\x20not\x20found',_0x550193['data1']['toLowerCase'](),_0x550193['data3']));}}else{_0x222dbc=require('../../../../config/logger')(_0x550193[_0x7d17('0x10')][_0x7d17('0x11')]());_0x222dbc['error'](_0x7d17('0x1f'),util['format'](_0x7d17('0x20'),_0x550193[_0x7d17('0x10')]['toLowerCase'](),_0x550193[_0x7d17('0x12')]));}}else{}}catch(_0x4eceee){console[_0x7d17('0x1d')](_0x4eceee);}}}}; \ 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 8c1c4d0..5b79939 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 _0x312c=['destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','[OUTBOUND]','monitor_format','calleridnum','toUpperCase','lastevent',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','localhost','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsRecurrence','endUserType','lead','WhoId','account','WhatId','Case','ContactId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','find','then','length','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','display_name','identity','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','Contact','execute','additionalSearchLead','$or','Lead','account_contact_lead','additionalSearchAccount','Account','contact','first','Phone','attributes','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','LastName','','format','Caller\x20-\x20%s','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','forEach','includes','picklist','idField','content','toString','type','variable','variableName','customVariable','name','Variable','password','concat','remoteUri','https://login.salesforce.com','login','username','Connection\x20established.','queue','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','calleridname','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','stripTrailingSlash','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0x312c,0x10d));var _0xc312=function(_0x14a652,_0x14ebdf){_0x14a652=_0x14a652-0x0;var _0x190f2c=_0x312c[_0x14a652];return _0x190f2c;};'use strict';var _=require(_0xc312('0x0'));var rp=require(_0xc312('0x1'));var moment=require(_0xc312('0x2'));var BPromise=require(_0xc312('0x3'));var md5=require(_0xc312('0x4'));var jsforce=require(_0xc312('0x5'));var util=require(_0xc312('0x6'));var Redis=require(_0xc312('0x7'));var intUtil=require(_0xc312('0x8'));var config=require(_0xc312('0x9'));var logger=require(_0xc312('0xa'))(_0xc312('0xb'));config[_0xc312('0xc')]=_['defaults'](config[_0xc312('0xc')],{'host':_0xc312('0xd'),'port':0x18eb});var io=require(_0xc312('0xe'))(new Redis(config[_0xc312('0xc')]));function emit(_0x1118a3,_0x4d8213,_0x180d67){io['to'](_0x1118a3)[_0xc312('0xf')](_0x4d8213,_0x180d67);}function getTicket(_0x498663,_0xde05a0,_0x5ec74,_0x45120d,_0x34fbd1,_0x45f522,_0x205f49,_0x5cca17){var _0x26495f=Object[_0xc312('0x10')]({},{'OwnerId':_0xde05a0['id'],'Subject':intUtil[_0xc312('0x11')](_0x45120d[_0xc312('0x12')],_0x34fbd1,'\x20'),'Description':intUtil[_0xc312('0x11')](_0x45120d[_0xc312('0x13')],_0x34fbd1,'\x0a')},getCustomFields(_0x45f522,_0x34fbd1));if(_0x5ec74){if(_0x45120d[_0xc312('0x14')]===_0xc312('0x15')){_0x26495f[_0xc312('0x16')]=moment[_0xc312('0x17')]();_0x26495f['IsReminderSet']=![];_0x26495f[_0xc312('0x18')]=![];if(_0x5ec74[_0xc312('0x19')]==='contact'||_0x5ec74[_0xc312('0x19')]===_0xc312('0x1a')){_0x26495f[_0xc312('0x1b')]=_0x5ec74['id'];}else if(_0x5ec74[_0xc312('0x19')]===_0xc312('0x1c')){_0x26495f[_0xc312('0x1d')]=_0x5ec74['id'];}}else if(_0x45120d[_0xc312('0x14')]===_0xc312('0x1e')){if(_0x5ec74['endUserType']==='contact'){_0x26495f[_0xc312('0x1f')]=_0x5ec74['id'];}else if(_0x5ec74[_0xc312('0x19')]===_0xc312('0x1c')){_0x26495f['AccountId']=_0x5ec74['id'];}else if(_0x5ec74[_0xc312('0x19')]===_0xc312('0x1a')&&_0x45120d[_0xc312('0x20')]){_0x26495f[_0x45120d[_0xc312('0x20')]]=_0x5ec74['id'];}else{logger[_0xc312('0x21')](_0xc312('0x22'));}}}return _0x205f49[_0xc312('0x23')](_0x45120d[_0xc312('0x14')])[_0xc312('0x24')](_0x26495f);}function getUser(_0x314a0e,_0x722e61,_0x10c7c8){if(!_[_0xc312('0x25')](_0x722e61)&&intUtil['validateEmail'](_0x722e61)){var _0x41739e={'Email':_0x722e61};var _0x21fd54={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x10c7c8[_0xc312('0x23')]('User')[_0xc312('0x26')](_0x41739e,_0x21fd54)['execute']()[_0xc312('0x27')](function(_0x1f4160){if(_0x1f4160[_0xc312('0x28')]){var _0x45e32f=_[_0xc312('0x26')](_0x1f4160,function(_0x35adaf){return _0x35adaf['Email']===_0x722e61;});if(_0x45e32f){logger[_0xc312('0x21')](_0xc312('0x29'),_0x722e61);return BPromise[_0xc312('0x2a')]({'id':_0x45e32f['Id'],'name':_0x45e32f[_0xc312('0x2b')]});}}else{logger['info'](_0xc312('0x2c'),_0x722e61);return _0x10c7c8['identity']()[_0xc312('0x27')](function(_0x24a219){return BPromise[_0xc312('0x2a')]({'id':_0x24a219['user_id'],'name':_0x24a219[_0xc312('0x2d')]});});}});}else{logger[_0xc312('0x21')](_0xc312('0x2c'),_0x722e61);return _0x10c7c8[_0xc312('0x2e')]()[_0xc312('0x27')](function(_0x53170f){return BPromise[_0xc312('0x2a')]({'id':_0x53170f['user_id'],'name':_0x53170f['display_name']});});}}function getEndUser(_0x547316,_0x2d8010,_0x3650f5,_0x234340,_0xb77b06){var _0x116c16={'$or':{'Phone':_0x234340}};var _0x3d5aed={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()['then'](function(){logger[_0xc312('0x21')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x234340,_0x2d8010[_0xc312('0x2f')]);switch(_0x2d8010['moduleSearch']){case _0xc312('0x30'):var _0x20113c=_[_0xc312('0x31')](_0x116c16);if(_0x2d8010[_0xc312('0x32')]){var _0x318276={};_0x318276[_0x2d8010[_0xc312('0x32')]]=_0x234340;_[_0xc312('0x33')](_0x20113c['$or'],_0x318276);}return _0xb77b06[_0xc312('0x23')](_0xc312('0x34'))[_0xc312('0x26')](_0x20113c,_0x3d5aed)[_0xc312('0x35')]()['then'](function(_0x1053d4){if(_0x1053d4&&_0x1053d4[_0xc312('0x28')]){return _0x1053d4;}else{var _0x3a152a=_[_0xc312('0x31')](_0x116c16);if(_0x2d8010['additionalSearchLead']){var _0x45ec5d={};_0x45ec5d[_0x2d8010[_0xc312('0x36')]]=_0x234340;_[_0xc312('0x33')](_0x3a152a[_0xc312('0x37')],_0x45ec5d);}return _0xb77b06[_0xc312('0x23')](_0xc312('0x38'))['find'](_0x3a152a,_0x3d5aed);}});case _0xc312('0x39'):var _0x23f7ae=_[_0xc312('0x31')](_0x116c16);if(_0x2d8010[_0xc312('0x3a')]){var _0x318276={};_0x318276[_0x2d8010[_0xc312('0x3a')]]=_0x234340;_[_0xc312('0x33')](_0x23f7ae[_0xc312('0x37')],_0x318276);}return _0xb77b06[_0xc312('0x23')](_0xc312('0x3b'))[_0xc312('0x26')](_0x23f7ae,_0x3d5aed)[_0xc312('0x35')]()[_0xc312('0x27')](function(_0x36c5ac){if(_0x36c5ac&&_0x36c5ac[_0xc312('0x28')]){return _0x36c5ac;}else{var _0xf23533=_[_0xc312('0x31')](_0x116c16);if(_0x2d8010[_0xc312('0x32')]){var _0x3b5851={};_0x3b5851[_0x2d8010[_0xc312('0x32')]]=_0x234340;_[_0xc312('0x33')](_0xf23533[_0xc312('0x37')],_0x3b5851);}return _0xb77b06[_0xc312('0x23')]('Contact')[_0xc312('0x26')](_0xf23533,_0x3d5aed)['then'](function(_0x30cac9){if(_0x30cac9&&_0x30cac9[_0xc312('0x28')]){return _0x30cac9;}else{var _0x12fbff=_[_0xc312('0x31')](_0x116c16);if(_0x2d8010[_0xc312('0x36')]){var _0x271f9a={};_0x271f9a[_0x2d8010[_0xc312('0x36')]]=_0x234340;_[_0xc312('0x33')](_0x12fbff['$or'],_0x271f9a);}return _0xb77b06[_0xc312('0x23')](_0xc312('0x38'))['find'](_0x12fbff,_0x3d5aed);}});}});case _0xc312('0x3c'):var _0x20113c=_[_0xc312('0x31')](_0x116c16);if(_0x2d8010[_0xc312('0x32')]){var _0x318276={};_0x318276[_0x2d8010[_0xc312('0x32')]]=_0x234340;_['merge'](_0x20113c[_0xc312('0x37')],_0x318276);}return _0xb77b06['sobject'](_0xc312('0x34'))[_0xc312('0x26')](_0x20113c,_0x3d5aed)[_0xc312('0x35')]();case _0xc312('0x1a'):var _0x4d0641=_['cloneDeep'](_0x116c16);if(_0x2d8010[_0xc312('0x36')]){var _0x318276={};_0x318276[_0x2d8010[_0xc312('0x36')]]=_0x234340;_[_0xc312('0x33')](_0x4d0641[_0xc312('0x37')],_0x318276);}return _0xb77b06[_0xc312('0x23')](_0xc312('0x38'))['find'](_0x4d0641,_0x3d5aed);case _0xc312('0x1c'):var _0x23f7ae=_['cloneDeep'](_0x116c16);if(_0x2d8010[_0xc312('0x3a')]){var _0x318276={};_0x318276[_0x2d8010[_0xc312('0x3a')]]=_0x234340;_['merge'](_0x23f7ae[_0xc312('0x37')],_0x318276);}return _0xb77b06[_0xc312('0x23')](_0xc312('0x3b'))[_0xc312('0x26')](_0x23f7ae,_0x3d5aed);default:return null;}})[_0xc312('0x27')](function(_0x39ed23){if(_0x39ed23&&_0x39ed23[_0xc312('0x28')]){var _0x25b435=_[_0xc312('0x3d')](_0x39ed23);if(_0x25b435){return BPromise['resolve']({'id':_0x25b435['Id'],'name':_0x25b435[_0xc312('0x2b')],'phone':_0x25b435[_0xc312('0x3e')],'endUserType':_0x25b435[_0xc312('0x3f')]['type']['toLowerCase']()});}}})[_0xc312('0x27')](function(_0x77549b){if(_0x77549b){logger[_0xc312('0x21')](_0xc312('0x40'),_0x77549b[_0xc312('0x19')],_0x234340);return BPromise['resolve'](_0x77549b);}else{logger['info']('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x234340);var _0x3f6e93={'Phone':_0x234340};if(_0x2d8010[_0xc312('0x41')]){if(_0x2d8010[_0xc312('0x41')]===_0xc312('0x3c')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x234340,_0x2d8010[_0xc312('0x41')]);_0x3f6e93[_0xc312('0x42')]=_0x3650f5!==_0xc312('0x43')?_0x3650f5:util[_0xc312('0x44')](_0xc312('0x45'),_0x234340);}else if(_0x2d8010['moduleCreate']==='lead'){logger[_0xc312('0x21')](_0xc312('0x46'),_0x234340,_0x2d8010[_0xc312('0x41')]);_0x3f6e93[_0xc312('0x42')]=_0x3650f5!==_0xc312('0x43')?_0x3650f5:util[_0xc312('0x44')](_0xc312('0x45'),_0x234340);_0x3f6e93[_0xc312('0x47')]=_0xc312('0x48');}else if(_0x2d8010[_0xc312('0x41')]===_0xc312('0x1c')){logger['info'](_0xc312('0x46'),_0x234340,_0x2d8010['moduleCreate']);_0x3f6e93[_0xc312('0x2b')]=_0x3650f5!==_0xc312('0x43')?_0x3650f5:util[_0xc312('0x44')](_0xc312('0x45'),_0x234340);}else{return null;}}return _0xb77b06[_0xc312('0x23')](_['upperFirst'](_0x2d8010[_0xc312('0x41')]))[_0xc312('0x24')](_0x3f6e93)[_0xc312('0x27')](function(_0x3b9d0b){return BPromise[_0xc312('0x2a')]({'id':_0x3b9d0b['id'],'endUserType':_0x2d8010[_0xc312('0x41')]});});}});}function getCustomFields(_0x49fab2,_0x4840f9){var _0x2888b4={};if(_0x49fab2[_0xc312('0x28')]>0x0){_[_0xc312('0x49')](_0x49fab2,function(_0x4c35b1){if(_[_0xc312('0x4a')](['string',_0xc312('0x4b')],_0x4c35b1['type'])&&_0x4c35b1[_0xc312('0x4c')]){_0x2888b4[_0x4c35b1[_0xc312('0x4c')]]=_0x4c35b1[_0xc312('0x4d')][_0xc312('0x4e')]();}else if(_0x4c35b1[_0xc312('0x4f')]===_0xc312('0x50')&&_0x4c35b1[_0xc312('0x51')]&&_0x4c35b1[_0xc312('0x4c')]){_0x4840f9[_0x4c35b1[_0xc312('0x51')]]&&(_0x2888b4[_0x4c35b1['idField']]=_0x4840f9[_0x4c35b1[_0xc312('0x51')]][_0xc312('0x4e')]());}else if(_0x4c35b1['type']===_0xc312('0x52')&&_0x4c35b1['Variable']&&_0x4c35b1['Variable'][_0xc312('0x53')]&&_0x4c35b1[_0xc312('0x4c')]){_0x4840f9[_0x4c35b1[_0xc312('0x54')][_0xc312('0x53')]['toLowerCase']()]&&(_0x2888b4[_0x4c35b1[_0xc312('0x4c')]]=_0x4840f9[_0x4c35b1[_0xc312('0x54')][_0xc312('0x53')]['toLowerCase']()]['toString']());}});}return _0x2888b4;}function getConnection(_0x12ab00){var _0x458058=_0x12ab00[_0xc312('0x55')][_0xc312('0x56')](_0x12ab00['securityToken']);var _0x5bbde3=new jsforce['Connection']({'oauth2':{'loginUrl':_0x12ab00[_0xc312('0x57')]||_0xc312('0x58'),'clientId':_0x12ab00['clientId'],'clientSecret':_0x12ab00['clientSecret']}});return _0x5bbde3[_0xc312('0x59')](_0x12ab00[_0xc312('0x5a')],_0x458058)[_0xc312('0x27')](function(){logger[_0xc312('0x21')](_0xc312('0x5b'));return _0x5bbde3;});}exports[_0xc312('0x5c')]=function(_0x116be8,_0x166487,_0x4001f4,_0x574023,_0x38cb0a,_0xd180d2){var _0x361de3,_0x4a2fe2,_0x494dff,_0x145b01;_0xd180d2[_0xc312('0x5d')]=intUtil['stripTrailingSlash'](_0xd180d2[_0xc312('0x5d')]);_0xd180d2[_0xc312('0x57')]=intUtil['stripTrailingSlash'](_0xd180d2[_0xc312('0x57')]);if(_0x38cb0a&&_0x38cb0a['monitor_format']){logger['info'](_0xc312('0x5e'),_0xc312('0x5f'));_0x166487['recordingURL']=util[_0xc312('0x44')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xd180d2[_0xc312('0x5d')],_0x166487[_0xc312('0x60')],md5(_0x166487[_0xc312('0x60')]));}else{_0x166487[_0xc312('0x61')]='';}return getConnection(_0xd180d2)[_0xc312('0x27')](function(_0x1d1eb0){_0x145b01=_0x1d1eb0;return getUser(_0xd180d2,_0x574023['email'],_0x145b01);})[_0xc312('0x27')](function(_0x35820e){_0x361de3=_0x35820e;return getEndUser(_0xd180d2,_0x4001f4,_0x166487[_0xc312('0x62')],_0x166487['calleridnum'],_0x145b01);})[_0xc312('0x27')](function(_0xd9cac7){_0x4a2fe2=_0xd9cac7;return getTicket(_0xd180d2,_0x361de3,_0x4a2fe2,_0x4001f4,_0x166487,_0x4001f4[_0xc312('0x63')],_0x145b01,_0xc312('0x5c'));})['then'](function(_0x526705){_0x494dff=_0x526705;logger[_0xc312('0x21')](_0xc312('0x64'),_0x494dff['id']);logger[_0xc312('0x21')](_0xc312('0x65'),_0x494dff['id'],_0x574023[_0xc312('0x53')],_0xd180d2[_0xc312('0x4f')]);switch(_0xd180d2[_0xc312('0x4f')]){case _0xc312('0x66'):emit(util[_0xc312('0x44')](_0xc312('0x67'),_0x574023[_0xc312('0x53')]),_0xc312('0x68'),{'recordId':_0x494dff['id']});break;case _0xc312('0x69'):emit(util[_0xc312('0x44')](_0xc312('0x67'),_0x574023[_0xc312('0x53')]),_0xc312('0x6a'),{'uri':util[_0xc312('0x44')](_0xc312('0x6b'),_0x145b01[_0xc312('0x6c')],_0x494dff['id'])});break;default:logger[_0xc312('0x6d')](_0xc312('0x6e'));}})[_0xc312('0x6f')](function(_0x32c5e8){logger[_0xc312('0x6d')]('[QUEUE]',_0x32c5e8);});};exports[_0xc312('0x70')]=function(_0x368a73,_0x5601d5,_0x5335d7,_0x27b005,_0x384182,_0x40b8b8,_0x495add){var _0x41c71f,_0x3b66c7,_0x1205d1,_0x53f36a;_0x40b8b8['serverUrl']=intUtil[_0xc312('0x71')](_0x40b8b8[_0xc312('0x5d')]);_0x40b8b8['remoteUri']=intUtil[_0xc312('0x71')](_0x40b8b8[_0xc312('0x57')]);if(_0x495add&&_0x495add[_0xc312('0x72')]&&_0x495add[_0xc312('0x72')]!==_0xc312('0x73')){logger[_0xc312('0x21')]('[OUTBOUND]',_0xc312('0x5f'));_0x5601d5[_0xc312('0x61')]=util[_0xc312('0x44')](_0xc312('0x74'),_0x40b8b8[_0xc312('0x5d')],_0x5601d5[_0xc312('0x60')],md5(_0x5601d5[_0xc312('0x60')]));}return getConnection(_0x40b8b8)[_0xc312('0x27')](function(_0x1a12f0){_0x53f36a=_0x1a12f0;return getUser(_0x40b8b8,_0x27b005[_0xc312('0x75')],_0x53f36a);})[_0xc312('0x27')](function(_0x5b1c10){_0x41c71f=_0x5b1c10;return getEndUser(_0x40b8b8,_0x5335d7,_0x5601d5[_0xc312('0x76')],_0x5601d5[_0xc312('0x77')],_0x53f36a);})[_0xc312('0x27')](function(_0x31c317){_0x3b66c7=_0x31c317;return getTicket(_0x40b8b8,_0x41c71f,_0x3b66c7,_0x5335d7,_0x5601d5,_0x5335d7[_0xc312('0x63')],_0x53f36a,_0xc312('0x70'));})[_0xc312('0x27')](function(_0x26957d){_0x1205d1=_0x26957d;logger[_0xc312('0x21')](_0xc312('0x78'),_0x1205d1['id']);logger[_0xc312('0x21')](_0xc312('0x79'),_0x1205d1['id'],_0x27b005[_0xc312('0x53')],_0x40b8b8[_0xc312('0x4f')]);switch(_0x40b8b8[_0xc312('0x4f')]){case _0xc312('0x66'):emit(util[_0xc312('0x44')](_0xc312('0x67'),_0x27b005[_0xc312('0x53')]),_0xc312('0x68'),{'recordId':_0x1205d1['id']});break;case _0xc312('0x69'):emit(util['format'](_0xc312('0x67'),_0x27b005[_0xc312('0x53')]),_0xc312('0x6a'),{'uri':util[_0xc312('0x44')](_0xc312('0x6b'),_0x53f36a[_0xc312('0x6c')],_0x1205d1['id'])});break;default:logger['error']('[OUTBOUND]',_0xc312('0x7a'));}})[_0xc312('0x6f')](function(_0x15e679){logger[_0xc312('0x6d')](_0xc312('0x7b'),_0x15e679);});};exports['unmanaged']=function(_0x13edb1,_0x3ed1ed,_0x40916c,_0x5b365b,_0x4bff6d,_0x32116b){var _0xc1e71b,_0x45787f,_0x12a3e1,_0x4b736c;_0x32116b[_0xc312('0x5d')]=intUtil['stripTrailingSlash'](_0x32116b[_0xc312('0x5d')]);_0x32116b[_0xc312('0x57')]=intUtil[_0xc312('0x71')](_0x32116b[_0xc312('0x57')]);if(_0x4bff6d&&_0x4bff6d[_0xc312('0x7c')]){logger[_0xc312('0x21')]('['+_0x3ed1ed['lastevent']['toUpperCase']()+']',_0xc312('0x5f'));_0x3ed1ed[_0xc312('0x61')]=util[_0xc312('0x44')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x32116b[_0xc312('0x5d')],_0x3ed1ed['uniqueid'],md5(_0x3ed1ed[_0xc312('0x60')]));}else{_0x3ed1ed['recordingURL']='';}return getConnection(_0x32116b)['then'](function(_0x4544f6){_0x4b736c=_0x4544f6;if(!_[_0xc312('0x25')](_0x5b365b)){return getUser(_0x32116b,_0x5b365b[_0xc312('0x53')],_0x4b736c);}else{return getUser(_0x32116b,null,_0x4b736c);}})[_0xc312('0x27')](function(_0x1a1534){_0xc1e71b=_0x1a1534;return getEndUser(_0x32116b,_0x40916c,_0x3ed1ed[_0xc312('0x62')],_0x3ed1ed[_0xc312('0x7d')],_0x4b736c);})['then'](function(_0x342ea7){_0x45787f=_0x342ea7;return getTicket(_0x32116b,_0xc1e71b,_0x45787f,_0x40916c,_0x3ed1ed,_0x40916c[_0xc312('0x63')],_0x4b736c);})[_0xc312('0x27')](function(_0x16ea8f){_0x12a3e1=_0x16ea8f;logger[_0xc312('0x21')]('['+_0x3ed1ed['lastevent'][_0xc312('0x7e')]()+']\x20Ticket\x20%s\x20created.',_0x12a3e1['id']);logger[_0xc312('0x21')]('['+_0x3ed1ed[_0xc312('0x7f')][_0xc312('0x7e')]()+_0xc312('0x80'),_0x32116b['type']);})[_0xc312('0x6f')](function(_0xc86ec0){logger[_0xc312('0x6d')]('['+_0x3ed1ed[_0xc312('0x7f')]['toUpperCase']()+']',_0xc86ec0);});}; \ No newline at end of file +var _0xdf3f=['merge','$or','Contact','additionalSearchLead','Lead','additionalSearchAccount','Account','first','Name','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Caller\x20-\x20%s','LastName','','format','Company','No\x20Company','forEach','includes','string','picklist','idField','toString','variable','variableName','customVariable','Variable','name','password','concat','securityToken','https://login.salesforce.com','clientId','login','Connection\x20established.','queue','serverUrl','stripTrailingSlash','remoteUri','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','newTab','%s/%s/e','instanceUrl','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:browser:url','Salesforce\x20account\x20type\x20not\x20recognized','catch','unmanaged','monitor_format','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','md5','jsforce','util','ioredis','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','emit','assign','getString','Subjects','Descriptions','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','account','ticketType','Case','AccountId','leadId','info','sobject','create','isNil','validateEmail','find','execute','then','length','Email','resolve','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'];(function(_0x2ecaa7,_0x279ae5){var _0x4db2a0=function(_0x454f92){while(--_0x454f92){_0x2ecaa7['push'](_0x2ecaa7['shift']());}};_0x4db2a0(++_0x279ae5);}(_0xdf3f,0x1d6));var _0xfdf3=function(_0x208d75,_0x92d742){_0x208d75=_0x208d75-0x0;var _0x382d27=_0xdf3f[_0x208d75];return _0x382d27;};'use strict';var _=require(_0xfdf3('0x0'));var rp=require(_0xfdf3('0x1'));var moment=require(_0xfdf3('0x2'));var BPromise=require('bluebird');var md5=require(_0xfdf3('0x3'));var jsforce=require(_0xfdf3('0x4'));var util=require(_0xfdf3('0x5'));var Redis=require(_0xfdf3('0x6'));var intUtil=require('./util');var config=require(_0xfdf3('0x7'));var logger=require(_0xfdf3('0x8'))(_0xfdf3('0x9'));config[_0xfdf3('0xa')]=_[_0xfdf3('0xb')](config[_0xfdf3('0xa')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xfdf3('0xa')]));function emit(_0x44bade,_0x4f0dd7,_0x112ce6){io['to'](_0x44bade)[_0xfdf3('0xc')](_0x4f0dd7,_0x112ce6);}function getTicket(_0x74c629,_0x509a12,_0x255f0b,_0x3c32e3,_0x1fe054,_0x2d2fd1,_0x43a7ad,_0x47b2fe){var _0x11fbf5=Object[_0xfdf3('0xd')]({},{'OwnerId':_0x509a12['id'],'Subject':intUtil[_0xfdf3('0xe')](_0x3c32e3[_0xfdf3('0xf')],_0x1fe054,'\x20'),'Description':intUtil[_0xfdf3('0xe')](_0x3c32e3[_0xfdf3('0x10')],_0x1fe054,'\x0a')},getCustomFields(_0x2d2fd1,_0x1fe054));if(_0x255f0b){if(_0x3c32e3['ticketType']===_0xfdf3('0x11')){_0x11fbf5[_0xfdf3('0x12')]=moment[_0xfdf3('0x13')]();_0x11fbf5[_0xfdf3('0x14')]=![];_0x11fbf5[_0xfdf3('0x15')]=![];if(_0x255f0b[_0xfdf3('0x16')]===_0xfdf3('0x17')||_0x255f0b['endUserType']===_0xfdf3('0x18')){_0x11fbf5['WhoId']=_0x255f0b['id'];}else if(_0x255f0b['endUserType']===_0xfdf3('0x19')){_0x11fbf5['WhatId']=_0x255f0b['id'];}}else if(_0x3c32e3[_0xfdf3('0x1a')]===_0xfdf3('0x1b')){if(_0x255f0b['endUserType']==='contact'){_0x11fbf5['ContactId']=_0x255f0b['id'];}else if(_0x255f0b[_0xfdf3('0x16')]==='account'){_0x11fbf5[_0xfdf3('0x1c')]=_0x255f0b['id'];}else if(_0x255f0b[_0xfdf3('0x16')]===_0xfdf3('0x18')&&_0x3c32e3[_0xfdf3('0x1d')]){_0x11fbf5[_0x3c32e3[_0xfdf3('0x1d')]]=_0x255f0b['id'];}else{logger[_0xfdf3('0x1e')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x43a7ad[_0xfdf3('0x1f')](_0x3c32e3[_0xfdf3('0x1a')])[_0xfdf3('0x20')](_0x11fbf5);}function getUser(_0x1f212b,_0x428ac4,_0x5dafc7){if(!_[_0xfdf3('0x21')](_0x428ac4)&&intUtil[_0xfdf3('0x22')](_0x428ac4)){var _0xfa0801={'Email':_0x428ac4};var _0x52e5b1={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x5dafc7['sobject']('User')[_0xfdf3('0x23')](_0xfa0801,_0x52e5b1)[_0xfdf3('0x24')]()[_0xfdf3('0x25')](function(_0x252bb7){if(_0x252bb7[_0xfdf3('0x26')]){var _0x5822b8=_[_0xfdf3('0x23')](_0x252bb7,function(_0x819f71){return _0x819f71[_0xfdf3('0x27')]===_0x428ac4;});if(_0x5822b8){logger[_0xfdf3('0x1e')]('Agent\x20%s\x20found.',_0x428ac4);return BPromise[_0xfdf3('0x28')]({'id':_0x5822b8['Id'],'name':_0x5822b8['Name']});}}else{logger['info'](_0xfdf3('0x29'),_0x428ac4);return _0x5dafc7[_0xfdf3('0x2a')]()[_0xfdf3('0x25')](function(_0x32a423){return BPromise[_0xfdf3('0x28')]({'id':_0x32a423[_0xfdf3('0x2b')],'name':_0x32a423[_0xfdf3('0x2c')]});});}});}else{logger[_0xfdf3('0x1e')](_0xfdf3('0x29'),_0x428ac4);return _0x5dafc7['identity']()[_0xfdf3('0x25')](function(_0x6ff4f5){return BPromise[_0xfdf3('0x28')]({'id':_0x6ff4f5['user_id'],'name':_0x6ff4f5['display_name']});});}}function getEndUser(_0x1551ef,_0x444bf7,_0x962dc3,_0x3236c5,_0xc5062b){var _0x2bc5b6={'$or':{'Phone':_0x3236c5}};var _0x5172c4={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0xfdf3('0x25')](function(){logger[_0xfdf3('0x1e')](_0xfdf3('0x2d'),_0x3236c5,_0x444bf7[_0xfdf3('0x2e')]);switch(_0x444bf7[_0xfdf3('0x2e')]){case _0xfdf3('0x2f'):var _0x4f3f90=_[_0xfdf3('0x30')](_0x2bc5b6);if(_0x444bf7[_0xfdf3('0x31')]){var _0x117f98={};_0x117f98[_0x444bf7[_0xfdf3('0x31')]]=_0x3236c5;_[_0xfdf3('0x32')](_0x4f3f90[_0xfdf3('0x33')],_0x117f98);}return _0xc5062b['sobject'](_0xfdf3('0x34'))[_0xfdf3('0x23')](_0x4f3f90,_0x5172c4)[_0xfdf3('0x24')]()[_0xfdf3('0x25')](function(_0x4206ad){if(_0x4206ad&&_0x4206ad[_0xfdf3('0x26')]){return _0x4206ad;}else{var _0x1f452a=_[_0xfdf3('0x30')](_0x2bc5b6);if(_0x444bf7['additionalSearchLead']){var _0x529924={};_0x529924[_0x444bf7[_0xfdf3('0x35')]]=_0x3236c5;_[_0xfdf3('0x32')](_0x1f452a[_0xfdf3('0x33')],_0x529924);}return _0xc5062b['sobject'](_0xfdf3('0x36'))[_0xfdf3('0x23')](_0x1f452a,_0x5172c4);}});case'account_contact_lead':var _0x2f49fe=_[_0xfdf3('0x30')](_0x2bc5b6);if(_0x444bf7[_0xfdf3('0x37')]){var _0x117f98={};_0x117f98[_0x444bf7[_0xfdf3('0x37')]]=_0x3236c5;_[_0xfdf3('0x32')](_0x2f49fe[_0xfdf3('0x33')],_0x117f98);}return _0xc5062b[_0xfdf3('0x1f')](_0xfdf3('0x38'))[_0xfdf3('0x23')](_0x2f49fe,_0x5172c4)[_0xfdf3('0x24')]()[_0xfdf3('0x25')](function(_0x356d78){if(_0x356d78&&_0x356d78[_0xfdf3('0x26')]){return _0x356d78;}else{var _0x6be400=_['cloneDeep'](_0x2bc5b6);if(_0x444bf7['additionalSearchContact']){var _0x493d92={};_0x493d92[_0x444bf7[_0xfdf3('0x31')]]=_0x3236c5;_[_0xfdf3('0x32')](_0x6be400[_0xfdf3('0x33')],_0x493d92);}return _0xc5062b[_0xfdf3('0x1f')](_0xfdf3('0x34'))['find'](_0x6be400,_0x5172c4)[_0xfdf3('0x25')](function(_0x322d55){if(_0x322d55&&_0x322d55[_0xfdf3('0x26')]){return _0x322d55;}else{var _0x1cdbff=_[_0xfdf3('0x30')](_0x2bc5b6);if(_0x444bf7['additionalSearchLead']){var _0x73abea={};_0x73abea[_0x444bf7[_0xfdf3('0x35')]]=_0x3236c5;_[_0xfdf3('0x32')](_0x1cdbff['$or'],_0x73abea);}return _0xc5062b[_0xfdf3('0x1f')](_0xfdf3('0x36'))[_0xfdf3('0x23')](_0x1cdbff,_0x5172c4);}});}});case _0xfdf3('0x17'):var _0x4f3f90=_[_0xfdf3('0x30')](_0x2bc5b6);if(_0x444bf7[_0xfdf3('0x31')]){var _0x117f98={};_0x117f98[_0x444bf7[_0xfdf3('0x31')]]=_0x3236c5;_['merge'](_0x4f3f90[_0xfdf3('0x33')],_0x117f98);}return _0xc5062b[_0xfdf3('0x1f')](_0xfdf3('0x34'))['find'](_0x4f3f90,_0x5172c4)[_0xfdf3('0x24')]();case _0xfdf3('0x18'):var _0x4827f9=_['cloneDeep'](_0x2bc5b6);if(_0x444bf7[_0xfdf3('0x35')]){var _0x117f98={};_0x117f98[_0x444bf7['additionalSearchLead']]=_0x3236c5;_[_0xfdf3('0x32')](_0x4827f9[_0xfdf3('0x33')],_0x117f98);}return _0xc5062b[_0xfdf3('0x1f')](_0xfdf3('0x36'))[_0xfdf3('0x23')](_0x4827f9,_0x5172c4);case _0xfdf3('0x19'):var _0x2f49fe=_[_0xfdf3('0x30')](_0x2bc5b6);if(_0x444bf7['additionalSearchAccount']){var _0x117f98={};_0x117f98[_0x444bf7[_0xfdf3('0x37')]]=_0x3236c5;_[_0xfdf3('0x32')](_0x2f49fe[_0xfdf3('0x33')],_0x117f98);}return _0xc5062b[_0xfdf3('0x1f')](_0xfdf3('0x38'))[_0xfdf3('0x23')](_0x2f49fe,_0x5172c4);default:return null;}})[_0xfdf3('0x25')](function(_0x25122b){if(_0x25122b&&_0x25122b[_0xfdf3('0x26')]){var _0x48e6af=_[_0xfdf3('0x39')](_0x25122b);if(_0x48e6af){return BPromise[_0xfdf3('0x28')]({'id':_0x48e6af['Id'],'name':_0x48e6af[_0xfdf3('0x3a')],'phone':_0x48e6af[_0xfdf3('0x3b')],'endUserType':_0x48e6af[_0xfdf3('0x3c')][_0xfdf3('0x3d')][_0xfdf3('0x3e')]()});}}})[_0xfdf3('0x25')](function(_0x3517b6){if(_0x3517b6){logger[_0xfdf3('0x1e')](_0xfdf3('0x3f'),_0x3517b6[_0xfdf3('0x16')],_0x3236c5);return BPromise[_0xfdf3('0x28')](_0x3517b6);}else{logger[_0xfdf3('0x1e')](_0xfdf3('0x40'),_0x3236c5);var _0x4925a8={'Phone':_0x3236c5};if(_0x444bf7[_0xfdf3('0x41')]){if(_0x444bf7[_0xfdf3('0x41')]===_0xfdf3('0x17')){logger['info'](_0xfdf3('0x42'),_0x3236c5,_0x444bf7[_0xfdf3('0x41')]);_0x4925a8['LastName']=_0x962dc3!==''?_0x962dc3:util['format'](_0xfdf3('0x43'),_0x3236c5);}else if(_0x444bf7[_0xfdf3('0x41')]==='lead'){logger['info'](_0xfdf3('0x42'),_0x3236c5,_0x444bf7[_0xfdf3('0x41')]);_0x4925a8[_0xfdf3('0x44')]=_0x962dc3!==_0xfdf3('0x45')?_0x962dc3:util[_0xfdf3('0x46')](_0xfdf3('0x43'),_0x3236c5);_0x4925a8[_0xfdf3('0x47')]=_0xfdf3('0x48');}else if(_0x444bf7['moduleCreate']==='account'){logger[_0xfdf3('0x1e')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x3236c5,_0x444bf7[_0xfdf3('0x41')]);_0x4925a8[_0xfdf3('0x3a')]=_0x962dc3!==''?_0x962dc3:util[_0xfdf3('0x46')](_0xfdf3('0x43'),_0x3236c5);}else{return null;}}return _0xc5062b['sobject'](_['upperFirst'](_0x444bf7[_0xfdf3('0x41')]))['create'](_0x4925a8)[_0xfdf3('0x25')](function(_0x5b75df){return BPromise[_0xfdf3('0x28')]({'id':_0x5b75df['id'],'endUserType':_0x444bf7[_0xfdf3('0x41')]});});}});}function getCustomFields(_0xf55275,_0x5828a3){var _0x4bb213={};if(_0xf55275['length']>0x0){_[_0xfdf3('0x49')](_0xf55275,function(_0x596aa7){if(_[_0xfdf3('0x4a')]([_0xfdf3('0x4b'),_0xfdf3('0x4c')],_0x596aa7[_0xfdf3('0x3d')])&&_0x596aa7[_0xfdf3('0x4d')]){_0x4bb213[_0x596aa7[_0xfdf3('0x4d')]]=_0x596aa7['content'][_0xfdf3('0x4e')]();}else if(_0x596aa7[_0xfdf3('0x3d')]===_0xfdf3('0x4f')&&_0x596aa7['variableName']&&_0x596aa7[_0xfdf3('0x4d')]){_0x5828a3[_0x596aa7[_0xfdf3('0x50')]]&&(_0x4bb213[_0x596aa7[_0xfdf3('0x4d')]]=_0x5828a3[_0x596aa7[_0xfdf3('0x50')]][_0xfdf3('0x4e')]());}else if(_0x596aa7[_0xfdf3('0x3d')]===_0xfdf3('0x51')&&_0x596aa7['Variable']&&_0x596aa7[_0xfdf3('0x52')][_0xfdf3('0x53')]&&_0x596aa7['idField']){_0x5828a3[_0x596aa7['Variable']['name']['toLowerCase']()]&&(_0x4bb213[_0x596aa7[_0xfdf3('0x4d')]]=_0x5828a3[_0x596aa7[_0xfdf3('0x52')][_0xfdf3('0x53')][_0xfdf3('0x3e')]()][_0xfdf3('0x4e')]());}});}return _0x4bb213;}function getConnection(_0x12c0cb){var _0x43d97e=_0x12c0cb[_0xfdf3('0x54')][_0xfdf3('0x55')](_0x12c0cb[_0xfdf3('0x56')]);var _0x1bdedb=new jsforce['Connection']({'oauth2':{'loginUrl':_0x12c0cb['remoteUri']||_0xfdf3('0x57'),'clientId':_0x12c0cb[_0xfdf3('0x58')],'clientSecret':_0x12c0cb['clientSecret']}});return _0x1bdedb[_0xfdf3('0x59')](_0x12c0cb['username'],_0x43d97e)['then'](function(){logger[_0xfdf3('0x1e')](_0xfdf3('0x5a'));return _0x1bdedb;});}exports[_0xfdf3('0x5b')]=function(_0x19a877,_0x545f31,_0x14f1d9,_0x2003ab,_0x56a53a,_0x1b0e24){var _0x2b74b5,_0x2adaf1,_0x1db3c2,_0x1e8517;_0x1b0e24[_0xfdf3('0x5c')]=intUtil[_0xfdf3('0x5d')](_0x1b0e24[_0xfdf3('0x5c')]);_0x1b0e24['remoteUri']=intUtil[_0xfdf3('0x5d')](_0x1b0e24[_0xfdf3('0x5e')]);if(_0x56a53a&&_0x56a53a['monitor_format']){logger[_0xfdf3('0x1e')](_0xfdf3('0x5f'),_0xfdf3('0x60'));_0x545f31[_0xfdf3('0x61')]=util[_0xfdf3('0x46')](_0xfdf3('0x62'),_0x1b0e24[_0xfdf3('0x5c')],_0x545f31[_0xfdf3('0x63')],md5(_0x545f31['uniqueid']));}else{_0x545f31[_0xfdf3('0x61')]='';}return getConnection(_0x1b0e24)[_0xfdf3('0x25')](function(_0x529da0){_0x1e8517=_0x529da0;return getUser(_0x1b0e24,_0x2003ab[_0xfdf3('0x64')],_0x1e8517);})[_0xfdf3('0x25')](function(_0x4af9ce){_0x2b74b5=_0x4af9ce;return getEndUser(_0x1b0e24,_0x14f1d9,_0x545f31[_0xfdf3('0x65')],_0x545f31[_0xfdf3('0x66')],_0x1e8517);})[_0xfdf3('0x25')](function(_0xf98112){_0x2adaf1=_0xf98112;return getTicket(_0x1b0e24,_0x2b74b5,_0x2adaf1,_0x14f1d9,_0x545f31,_0x14f1d9[_0xfdf3('0x67')],_0x1e8517,'queue');})['then'](function(_0x325cd3){_0x1db3c2=_0x325cd3;logger[_0xfdf3('0x1e')](_0xfdf3('0x68'),_0x1db3c2['id']);logger[_0xfdf3('0x1e')](_0xfdf3('0x69'),_0x1db3c2['id'],_0x2003ab[_0xfdf3('0x53')],_0x1b0e24[_0xfdf3('0x3d')]);switch(_0x1b0e24[_0xfdf3('0x3d')]){case'integrationTab':emit(util[_0xfdf3('0x46')](_0xfdf3('0x6a'),_0x2003ab[_0xfdf3('0x53')]),_0xfdf3('0x6b'),{'recordId':_0x1db3c2['id']});break;case _0xfdf3('0x6c'):emit(util[_0xfdf3('0x46')](_0xfdf3('0x6a'),_0x2003ab[_0xfdf3('0x53')]),'trigger:browser:url',{'uri':util[_0xfdf3('0x46')](_0xfdf3('0x6d'),_0x1e8517[_0xfdf3('0x6e')],_0x1db3c2['id'])});break;default:logger[_0xfdf3('0x6f')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})['catch'](function(_0x23f687){logger[_0xfdf3('0x6f')](_0xfdf3('0x5f'),_0x23f687);});};exports[_0xfdf3('0x70')]=function(_0x7f03f2,_0x3ec3b,_0x3a398b,_0x1321a8,_0x18a902,_0x1ef5f7,_0x30302f){var _0x645a90,_0x2eb9a1,_0x36d415,_0x24853b;_0x1ef5f7[_0xfdf3('0x5c')]=intUtil[_0xfdf3('0x5d')](_0x1ef5f7[_0xfdf3('0x5c')]);_0x1ef5f7[_0xfdf3('0x5e')]=intUtil['stripTrailingSlash'](_0x1ef5f7[_0xfdf3('0x5e')]);if(_0x30302f&&_0x30302f[_0xfdf3('0x71')]&&_0x30302f[_0xfdf3('0x71')]!==_0xfdf3('0x72')){logger[_0xfdf3('0x1e')](_0xfdf3('0x73'),_0xfdf3('0x60'));_0x3ec3b['recordingURL']=util[_0xfdf3('0x46')](_0xfdf3('0x62'),_0x1ef5f7['serverUrl'],_0x3ec3b[_0xfdf3('0x63')],md5(_0x3ec3b['uniqueid']));}return getConnection(_0x1ef5f7)[_0xfdf3('0x25')](function(_0x4656b4){_0x24853b=_0x4656b4;return getUser(_0x1ef5f7,_0x1321a8['email'],_0x24853b);})[_0xfdf3('0x25')](function(_0x548bb4){_0x645a90=_0x548bb4;return getEndUser(_0x1ef5f7,_0x3a398b,_0x3ec3b[_0xfdf3('0x74')],_0x3ec3b[_0xfdf3('0x75')],_0x24853b);})[_0xfdf3('0x25')](function(_0x3c9d20){_0x2eb9a1=_0x3c9d20;return getTicket(_0x1ef5f7,_0x645a90,_0x2eb9a1,_0x3a398b,_0x3ec3b,_0x3a398b[_0xfdf3('0x67')],_0x24853b,_0xfdf3('0x70'));})[_0xfdf3('0x25')](function(_0x2e9db6){_0x36d415=_0x2e9db6;logger['info'](_0xfdf3('0x76'),_0x36d415['id']);logger[_0xfdf3('0x1e')](_0xfdf3('0x77'),_0x36d415['id'],_0x1321a8['name'],_0x1ef5f7['type']);switch(_0x1ef5f7[_0xfdf3('0x3d')]){case _0xfdf3('0x78'):emit(util['format'](_0xfdf3('0x6a'),_0x1321a8[_0xfdf3('0x53')]),_0xfdf3('0x6b'),{'recordId':_0x36d415['id']});break;case _0xfdf3('0x6c'):emit(util[_0xfdf3('0x46')]('user:%s',_0x1321a8[_0xfdf3('0x53')]),_0xfdf3('0x79'),{'uri':util[_0xfdf3('0x46')](_0xfdf3('0x6d'),_0x24853b['instanceUrl'],_0x36d415['id'])});break;default:logger[_0xfdf3('0x6f')](_0xfdf3('0x73'),_0xfdf3('0x7a'));}})[_0xfdf3('0x7b')](function(_0xe9988e){logger[_0xfdf3('0x6f')](_0xfdf3('0x73'),_0xe9988e);});};exports[_0xfdf3('0x7c')]=function(_0xd8abe3,_0x2e1f57,_0x5235dd,_0xf8ee7a,_0x375dc0,_0x48e256){var _0x47b586,_0x393fa2,_0x9d95dd,_0x588c0f;_0x48e256['serverUrl']=intUtil[_0xfdf3('0x5d')](_0x48e256['serverUrl']);_0x48e256[_0xfdf3('0x5e')]=intUtil[_0xfdf3('0x5d')](_0x48e256[_0xfdf3('0x5e')]);if(_0x375dc0&&_0x375dc0[_0xfdf3('0x7d')]){logger[_0xfdf3('0x1e')]('['+_0x2e1f57[_0xfdf3('0x7e')][_0xfdf3('0x7f')]()+']',_0xfdf3('0x60'));_0x2e1f57[_0xfdf3('0x61')]=util[_0xfdf3('0x46')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x48e256[_0xfdf3('0x5c')],_0x2e1f57['uniqueid'],md5(_0x2e1f57[_0xfdf3('0x63')]));}else{_0x2e1f57[_0xfdf3('0x61')]='';}return getConnection(_0x48e256)[_0xfdf3('0x25')](function(_0x2b3f9d){_0x588c0f=_0x2b3f9d;if(!_[_0xfdf3('0x21')](_0xf8ee7a)){return getUser(_0x48e256,_0xf8ee7a['name'],_0x588c0f);}else{return getUser(_0x48e256,null,_0x588c0f);}})[_0xfdf3('0x25')](function(_0x3746df){_0x47b586=_0x3746df;return getEndUser(_0x48e256,_0x5235dd,_0x2e1f57['calleridname'],_0x2e1f57[_0xfdf3('0x66')],_0x588c0f);})[_0xfdf3('0x25')](function(_0x288769){_0x393fa2=_0x288769;return getTicket(_0x48e256,_0x47b586,_0x393fa2,_0x5235dd,_0x2e1f57,_0x5235dd[_0xfdf3('0x67')],_0x588c0f);})[_0xfdf3('0x25')](function(_0x5daa2f){_0x9d95dd=_0x5daa2f;logger[_0xfdf3('0x1e')]('['+_0x2e1f57[_0xfdf3('0x7e')][_0xfdf3('0x7f')]()+_0xfdf3('0x80'),_0x9d95dd['id']);logger[_0xfdf3('0x1e')]('['+_0x2e1f57[_0xfdf3('0x7e')][_0xfdf3('0x7f')]()+_0xfdf3('0x81'),_0x48e256[_0xfdf3('0x3d')]);})[_0xfdf3('0x7b')](function(_0x140989){logger[_0xfdf3('0x6f')]('['+_0x2e1f57[_0xfdf3('0x7e')][_0xfdf3('0x7f')]()+']',_0x140989);});}; \ 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 8f1aaa5..2f1b57d 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 _0xecfd=['bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','],\x20getAdminUser\x20crm','catch','message','toUpperCase','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20entity','active','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','POST','sys_user?','endUserNumber','user','],\x20EndUser\x20schema','endUserId','error','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','nameField','customField','toLowerCase','toString','type','idField','content','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','getString','Subjects','Fields',']\x20POST\x20incident\x20entity\x20schema','number',']\x20getTicket\x20crm','label','label_entry','Incident','ticketNumber','push','all','map','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','user:%s','emit','trigger:browser:url','username','password','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','email','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','ticketId','call\x20direction:\x20%s','unmanaged',']\x20Error\x20running\x20ServiceNow\x20integration','lodash'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0xecfd,0x6c));var _0xdecf=function(_0x5ac30d,_0x4eb709){_0x5ac30d=_0x5ac30d-0x0;var _0x49a9c0=_0xecfd[_0x5ac30d];return _0x49a9c0;};'use strict';var _=require(_0xdecf('0x0'));var Promise=require(_0xdecf('0x1'));var rp=require(_0xdecf('0x2'));var util=require(_0xdecf('0x3'));var md5=require(_0xdecf('0x4'));var Redis=require(_0xdecf('0x5'));var intUtil=require(_0xdecf('0x6'));var config=require(_0xdecf('0x7'));var logger=require(_0xdecf('0x8'))('servicenow');config[_0xdecf('0x9')]=_[_0xdecf('0xa')](config[_0xdecf('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xdecf('0xb'))(new Redis(config['redis']));function getAdminUser(_0xfbf802,_0x59c374,_0x10c5fc,_0x3f42e8,_0x57ced7,_0x27e388){return new Promise(function(_0x923ba4,_0xfe191c){var _0x173ca5={'method':_0xdecf('0xc'),'uri':_0x3f42e8+_0xdecf('0xd')+'&'+_0x57ced7+'&'+_0x27e388,'auth':_0x59c374,'json':!![]};return rp(_0x173ca5)[_0xdecf('0xe')](function(_0x3bda55){if(_0x3bda55[_0xdecf('0xf')][_0xdecf('0x10')]>0x0){_0x10c5fc[_0xdecf('0x11')]=_0x3bda55[_0xdecf('0xf')][0x0][_0xdecf('0x12')];}logger[_0xdecf('0x13')]('['+[_0xfbf802['toUpperCase']()]+_0xdecf('0x14'),_0x10c5fc);_0x923ba4(_0x10c5fc);})[_0xdecf('0x15')](function(_0x383f3d){logger['error']('['+[_0xfbf802['toUpperCase']()]+']',_0x383f3d[_0xdecf('0x16')]);_0xfe191c(_0x383f3d['message']);});});}function getUser(_0x5d39d3,_0x1ea728,_0x39e55b,_0x552a77,_0xff4643){return function(_0x541549){logger[_0xdecf('0x13')]('['+[_0x5d39d3[_0xdecf('0x17')]()]+_0xdecf('0x18'),_0x541549);return new Promise(function(_0x10d0cd,_0x28ea4c){if(intUtil[_0xdecf('0x19')](_0x541549[_0xdecf('0x1a')])){var _0x4815b7={'method':'GET','uri':_0x39e55b+_0xdecf('0x1b')+_0x541549[_0xdecf('0x1a')]+'&'+_0x552a77+'&'+_0xff4643,'auth':_0x1ea728,'json':!![]};logger[_0xdecf('0x13')]('['+[_0x5d39d3[_0xdecf('0x17')]()]+'],\x20getUser\x20rp\x20obj',_0x4815b7);return rp(_0x4815b7)['then'](function(_0x211e48){logger[_0xdecf('0x13')]('['+[_0x5d39d3['toUpperCase']()]+_0xdecf('0x1c'),_0x211e48);if(_0x211e48['result']['length']>0x0&&String(_0x211e48[_0xdecf('0xf')][0x0][_0xdecf('0x1d')])===_0xdecf('0x1e')){_0x541549[_0xdecf('0x1f')]=_0x211e48[_0xdecf('0xf')][0x0]['sys_id'];}else{_0x541549[_0xdecf('0x1f')]=_0x541549[_0xdecf('0x11')];_0x541549[_0xdecf('0x1a')]=_0x541549[_0xdecf('0x20')];}logger['info']('['+[_0x5d39d3[_0xdecf('0x17')]()]+_0xdecf('0x21'),_0x541549);_0x10d0cd(_0x541549);})[_0xdecf('0x15')](function(_0x5e4ec0){logger['error']('['+[_0x5d39d3[_0xdecf('0x17')]()]+']',_0x5e4ec0['message']);_0x28ea4c(_0x5e4ec0[_0xdecf('0x16')]);});}else{logger[_0xdecf('0x13')]('['+[_0x5d39d3[_0xdecf('0x17')]()]+_0xdecf('0x22'));_0x541549[_0xdecf('0x1f')]=_0x541549[_0xdecf('0x11')];_0x541549['userEmail']=_0x541549[_0xdecf('0x20')];_0x10d0cd(_0x541549);}});};}function createEndUser(_0x12b6aa,_0x36de7b,_0x25ea3f,_0x557a86,_0x33a83c){logger['info']('['+[_0x12b6aa[_0xdecf('0x17')]()]+'],\x20createEndUser\x20input\x20crm',_0x25ea3f);return new Promise(function(_0x24572f,_0x229575){var _0xfa7f19={'method':_0xdecf('0x23'),'uri':_0x557a86+_0xdecf('0x24')+_0x33a83c,'body':{'user_name':_0x25ea3f[_0xdecf('0x25')],'roles':_0xdecf('0x26'),'first_name':_0x25ea3f[_0xdecf('0x25')],'active':_0xdecf('0x1e'),'date_format':'System','phone':_0x25ea3f[_0xdecf('0x25')]},'auth':_0x36de7b,'json':!![]};return rp(_0xfa7f19)['then'](function(_0x4591ff){logger['info']('['+[_0x12b6aa[_0xdecf('0x17')]()]+_0xdecf('0x27'),_0x4591ff[_0xdecf('0xf')]);_0x25ea3f[_0xdecf('0x28')]=_0x4591ff[_0xdecf('0xf')][_0xdecf('0x12')];_0x24572f(_0x25ea3f);})[_0xdecf('0x15')](function(_0x3d3552){logger[_0xdecf('0x29')]('['+[_0x12b6aa['toUpperCase']()]+']',_0x3d3552[_0xdecf('0x16')]);_0x229575(_0x3d3552['message']);});});}function getEndUser(_0x44371f,_0x57cee0,_0x20efd6,_0xcf47cc,_0x4d21c1){return function(_0x98b805){logger[_0xdecf('0x13')]('['+[_0x44371f[_0xdecf('0x17')]()]+_0xdecf('0x2a'),_0x98b805);return new Promise(function(_0x1d824e,_0x2bbcba){var _0x44a6a7={'method':_0xdecf('0xc'),'uri':_0x20efd6+_0xdecf('0x2b')+_0x98b805[_0xdecf('0x25')]+'&'+_0xcf47cc+'&'+_0x4d21c1,'auth':_0x57cee0,'json':!![]};return rp(_0x44a6a7)[_0xdecf('0xe')](function(_0x18d5ee){if(_0x18d5ee[_0xdecf('0xf')][_0xdecf('0x10')]>0x0){_0x98b805[_0xdecf('0x28')]=_0x18d5ee['result'][0x0][_0xdecf('0x12')];logger[_0xdecf('0x13')]('['+[_0x44371f[_0xdecf('0x17')]()]+_0xdecf('0x2c'),_0x98b805);_0x1d824e(_0x98b805);}else{return createEndUser(_0x44371f,_0x57cee0,_0x98b805,_0x20efd6,_0xcf47cc)[_0xdecf('0xe')](function(_0x5ed3e3){logger['info']('['+[_0x44371f['toUpperCase']()]+_0xdecf('0x2d'),_0x5ed3e3);_0x1d824e(_0x5ed3e3);});}})['catch'](function(_0x1f5c2f){logger[_0xdecf('0x29')]('['+[_0x44371f[_0xdecf('0x17')]()]+']',_0x1f5c2f[_0xdecf('0x16')]);_0x2bbcba(_0x1f5c2f[_0xdecf('0x16')]);});});};}function getCustomFields(_0x4ab400,_0x4953af){var _0x3c598b={};if(_0x4ab400[_0xdecf('0x10')]>0x0){_[_0xdecf('0x2e')](_0x4ab400,function(_0x3015cc){if(_[_0xdecf('0x2f')]([_0xdecf('0x30'),_0xdecf('0x31')],_0x3015cc['type'])&&_0x3015cc[_0xdecf('0x32')]&&!_0x3015cc[_0xdecf('0x33')]){_0x3c598b[_0x3015cc[_0xdecf('0x32')][_0xdecf('0x34')]()]=_0x3015cc['content'][_0xdecf('0x35')]();}else if(_[_0xdecf('0x2f')]([_0xdecf('0x30'),_0xdecf('0x31')],_0x3015cc[_0xdecf('0x36')])&&_0x3015cc[_0xdecf('0x37')]&&_0x3015cc['customField']){_0x3c598b[_0x3015cc['idField'][_0xdecf('0x34')]()]=_0x3015cc[_0xdecf('0x38')]['toString']();}else if(_0x3015cc[_0xdecf('0x36')]===_0xdecf('0x39')&&_0x3015cc[_0xdecf('0x3a')]&&_0x3015cc[_0xdecf('0x37')]&&_0x3015cc[_0xdecf('0x33')]){_0x3c598b[_0x3015cc['idField'][_0xdecf('0x34')]()]=_0x4953af[_0x3015cc[_0xdecf('0x3a')]][_0xdecf('0x35')]();}else if(_0x3015cc[_0xdecf('0x36')]===_0xdecf('0x3b')&&_0x3015cc[_0xdecf('0x3c')]&&_0x3015cc[_0xdecf('0x3c')][_0xdecf('0x3d')]&&_0x3015cc[_0xdecf('0x37')]&&_0x3015cc[_0xdecf('0x33')]){_0x3c598b[_0x3015cc['idField'][_0xdecf('0x34')]()]=_0x4953af[_0x3015cc[_0xdecf('0x3c')][_0xdecf('0x3d')][_0xdecf('0x34')]()][_0xdecf('0x35')]();}});}return _0x3c598b;}function getTicket(_0x249635,_0x26b035,_0x219380,_0x509fea,_0x1d457f,_0x42add9){return function(_0x2570a3){logger['info']('['+[_0x249635['toUpperCase']()]+_0xdecf('0x3e'),_0x2570a3);return new Promise(function(_0x59942d,_0x10629d){var _0x13ee10=_0x249635['toLowerCase']()===_0xdecf('0x3f')?_0x2570a3['userId']:_0x2570a3[_0xdecf('0x28')];var _0xed4e73={'method':_0xdecf('0x23'),'uri':_0x219380+_0xdecf('0x40')+'?'+_0x42add9,'body':Object['assign']({},{'active':_0xdecf('0x1e'),'caller_id':_0x13ee10,'assigned_to':_0x2570a3[_0xdecf('0x1f')],'short_description':intUtil[_0xdecf('0x41')](_0x509fea[_0xdecf('0x42')],_0x1d457f,'\x20'),'description':intUtil[_0xdecf('0x41')](_0x509fea['Descriptions'],_0x1d457f,'\x0a')},getCustomFields(_0x509fea[_0xdecf('0x43')],_0x1d457f)),'auth':_0x26b035,'json':!![]};return rp(_0xed4e73)[_0xdecf('0xe')](function(_0x39b08a){logger[_0xdecf('0x13')]('['+[_0x249635[_0xdecf('0x17')]()]+_0xdecf('0x44'),_0x39b08a['result']);_0x2570a3['ticketId']=_0x39b08a['result'][_0xdecf('0x12')];_0x2570a3['ticketNumber']=_0x39b08a['result'][_0xdecf('0x45')];logger[_0xdecf('0x13')]('['+[_0x249635[_0xdecf('0x17')]()]+_0xdecf('0x46'),_0x2570a3);_0x59942d(_0x2570a3);})['catch'](function(_0x2b9ca4){logger[_0xdecf('0x29')]('['+[_0x249635[_0xdecf('0x17')]()]+']',_0x2b9ca4[_0xdecf('0x16')]);_0x10629d(_0x2b9ca4[_0xdecf('0x16')]);});});};}function createRemoteTag(_0xbc006c,_0x202bd7,_0x242ebc,_0x30b3b1){return new Promise(function(_0x1d7707,_0x335485){var _0x4e6eed={'method':_0xdecf('0x23'),'uri':_0x242ebc+_0xdecf('0x47')+'?'+_0x30b3b1,'body':{'short_description':_0xbc006c,'global':!![],'active':!![],'name':_0xbc006c},'auth':_0x202bd7,'json':!![]};return rp(_0x4e6eed)[_0xdecf('0xe')](function(_0x4cf23f){var _0x332eb8=_0x4cf23f[_0xdecf('0xf')][_0xdecf('0x12')];_0x1d7707(_0x332eb8);});});}function getRemoteTag(_0x5b82c8,_0x1abb90,_0x43cacd,_0x35c15e,_0x172f19){return new Promise(function(_0x2595e0,_0x57d039){var _0x49ed47={'method':_0xdecf('0xc'),'uri':_0x43cacd+_0xdecf('0x47')+'?sysparm_query=name%3D'+_0x5b82c8+'&'+_0x35c15e,'auth':_0x1abb90,'json':!![]};return rp(_0x49ed47)['then'](function(_0x42c818){if(_0x42c818[_0xdecf('0xf')][_0xdecf('0x10')]>0x0){var _0x29d0b1=_0x42c818[_0xdecf('0xf')][0x0]['sys_id'];_0x2595e0(_0x29d0b1);}else{return createRemoteTag(_0x5b82c8,_0x1abb90,_0x43cacd,_0x35c15e)[_0xdecf('0xe')](function(_0x1cefc7){_0x2595e0(_0x1cefc7);});}});});}function assignTagToIncident(_0x591315,_0x400e34,_0x4a338a,_0x5532b4,_0x586562){return new Promise(function(_0x158b06,_0xf33154){var _0x2d68ce={'method':'POST','uri':_0x4a338a+_0xdecf('0x48')+'?'+_0x586562,'body':{'label':_0x591315,'table':_0xdecf('0x40'),'id_type':_0xdecf('0x49'),'table_key':_0x5532b4['ticketId'],'title':'Incident\x20-\x20'+_0x5532b4[_0xdecf('0x4a')],'id_display':_0x5532b4[_0xdecf('0x4a')]},'auth':_0x400e34,'json':!![]};return rp(_0x2d68ce)['then'](function(_0xce9e2e){_0x158b06();})[_0xdecf('0x15')](function(){_0x158b06();});});}function manageTags(_0x43b3c9,_0x7c2593,_0x3b06c9,_0x456d0b,_0x33c555,_0x388cc5,_0x1b560e){return new Promise(function(_0x433436,_0x3f8c34){var _0xa42bed=[];_0x7c2593[_0xdecf('0x2e')](function(_0x287b1e){_0xa42bed[_0xdecf('0x4b')](getRemoteTag(_0x287b1e,_0x3b06c9,_0x456d0b,_0x388cc5,_0x1b560e));});return Promise[_0xdecf('0x4c')](_0xa42bed)[_0xdecf('0xe')](function(_0x5b772c){if(_0x5b772c[_0xdecf('0x10')]){logger['info']('['+[_0x43b3c9[_0xdecf('0x17')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x5b772c);var _0x299dcf=[];_0x5b772c['forEach'](function(_0x535c6b){_0x299dcf[_0xdecf('0x4b')](assignTagToIncident(_0x535c6b,_0x3b06c9,_0x456d0b,_0x33c555,_0x388cc5));});return Promise[_0xdecf('0x4c')](_0x299dcf)['then'](function(){_0x433436();})['catch'](function(){_0x433436();});}else{_0x433436();}});});}function getTags(_0xa5398e,_0x5358e5,_0x13ba3a,_0x5c7dff,_0x529274,_0x1cd315){return function(_0x51f1ce){return new Promise(function(_0x4f1e40,_0x2ab89e){var _0x237b79=[];var _0x47ed68=_0x5c7dff['Tags'];if(_0x47ed68&&_0x47ed68[_0xdecf('0x10')]>0x0){_0x237b79=_[_0xdecf('0x4d')](_0x47ed68,_0xdecf('0x3d'));}if(_0x237b79[_0xdecf('0x10')]>0x0){return manageTags(_0xa5398e,_0x237b79,_0x5358e5,_0x13ba3a,_0x51f1ce,_0x529274,_0x1cd315)[_0xdecf('0xe')](function(){_0x4f1e40(_0x51f1ce);});}else{_0x4f1e40(_0x51f1ce);}});};}function emit(_0x544a05,_0x2c32ab,_0x4d76a2){var _0x17b67a='%26sysparm_record_target%3Dincident'+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0xdecf('0x4e')+_0xdecf('0x4f');var _0x26685b={'uri':_0x544a05+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x4d76a2+_0x17b67a};io['to'](util[_0xdecf('0x50')](_0xdecf('0x51'),_0x2c32ab))[_0xdecf('0x52')](_0xdecf('0x53'),_0x26685b);}exports['cs']=function(_0x5ca535,_0x5bcc98,_0x3b7b4c,_0x59e5a5,_0xc7a216,_0x29aa75,_0x4ebb7e,_0x257a83){var _0x45aa08={};var _0x5c7e82={'user':_0x29aa75[_0xdecf('0x54')],'pass':_0x29aa75[_0xdecf('0x55')]};var _0x46d56d='sysparm_limit=1';var _0x34ca8b=_0xdecf('0x56');_0x29aa75[_0xdecf('0x57')]=intUtil[_0xdecf('0x58')](_0x29aa75[_0xdecf('0x57')]);_0x29aa75[_0xdecf('0x59')]=intUtil[_0xdecf('0x58')](_0x29aa75[_0xdecf('0x59')]);var _0x13be7b=util['format'](_0xdecf('0x5a'),_0x29aa75['remoteUri']);_0x45aa08['userEmail']=!_['isNil'](_0x59e5a5)?_0x59e5a5[_0xdecf('0x5b')]:null;_0x45aa08[_0xdecf('0x20')]=_0x29aa75[_0xdecf('0x5b')];_0x45aa08[_0xdecf('0x25')]=_0x257a83[_0xdecf('0x34')]()===_0xdecf('0x3f')?_0x5bcc98[_0xdecf('0x5c')]:_0x5bcc98[_0xdecf('0x5d')];_0x45aa08[_0xdecf('0x5e')]=_0x257a83===_0xdecf('0x5f')||_0x257a83==='unmanaged'?_0xdecf('0x5f'):_0xdecf('0x3f');var _0x23f54c=util['format'](_0xdecf('0x60'),_0x29aa75[_0xdecf('0x59')],_0x5bcc98[_0xdecf('0x61')],md5(_0x5bcc98[_0xdecf('0x61')]));if(_0xc7a216&&_0xc7a216[_0xdecf('0x62')]){logger['info'](_0xdecf('0x63'),_0xdecf('0x64'));_0x5bcc98[_0xdecf('0x65')]=_0x23f54c;}else if(_0x4ebb7e&&_0x4ebb7e['recordingFormat']&&_0x4ebb7e['recordingFormat']!==_0xdecf('0x66')){logger[_0xdecf('0x13')](_0xdecf('0x67'),'Recording\x20is\x20enabled!');_0x5bcc98[_0xdecf('0x65')]=_0x23f54c;}else{_0x5bcc98[_0xdecf('0x65')]='';}return getAdminUser(_0x257a83,_0x5c7e82,_0x45aa08,_0x13be7b,_0x34ca8b,_0x46d56d)[_0xdecf('0xe')](getUser(_0x257a83,_0x5c7e82,_0x13be7b,_0x34ca8b,_0x46d56d))['then'](getEndUser(_0x257a83,_0x5c7e82,_0x13be7b,_0x34ca8b,_0x46d56d))[_0xdecf('0xe')](getTicket(_0x257a83,_0x5c7e82,_0x13be7b,_0x3b7b4c,_0x5bcc98,_0x34ca8b))[_0xdecf('0xe')](function(_0x439369){logger['info'](util[_0xdecf('0x50')](_0xdecf('0x68'),_0x439369[_0xdecf('0x69')]));logger[_0xdecf('0x13')](util['format'](_0xdecf('0x6a'),_0x257a83));if(_0x257a83!==_0xdecf('0x6b')){logger[_0xdecf('0x13')]('['+[_0x257a83[_0xdecf('0x17')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x29aa75[_0xdecf('0x57')],_0x59e5a5[_0xdecf('0x3d')],_0x439369[_0xdecf('0x69')]);}})[_0xdecf('0x15')](function(_0x3df584){logger[_0xdecf('0x29')]('['+[_0x257a83[_0xdecf('0x17')]()]+_0xdecf('0x6c'),util['inspect'](_0x3df584,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xa3b5=['monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','request-promise','util','md5','ioredis','./util','../../../../config/logger','servicenow','defaults','redis','localhost','socket.io-emitter','length','result','sys_id','info','],\x20getAdminUser\x20crm','catch','error','toUpperCase','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','GET','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','adminId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','endUserNumber','user','System','then','],\x20EndUser\x20schema','endUserId','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','picklist','type','nameField','customField','toString','string','idField','content','variable','variableName','customVariable','name','toLowerCase','Variable',']\x20getTicket\x20input\x20crm','outbound','POST','incident','assign','getString','Subjects',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber',']\x20getTicket\x20crm','label','label_entry','Incident','Incident\x20-\x20','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','emit','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid'];(function(_0x13f48e,_0xe308bf){var _0x31a468=function(_0x1ddab1){while(--_0x1ddab1){_0x13f48e['push'](_0x13f48e['shift']());}};_0x31a468(++_0xe308bf);}(_0xa3b5,0x78));var _0x5a3b=function(_0x32bd59,_0x4c2921){_0x32bd59=_0x32bd59-0x0;var _0xa24ae4=_0xa3b5[_0x32bd59];return _0xa24ae4;};'use strict';var _=require('lodash');var Promise=require('bluebird');var rp=require(_0x5a3b('0x0'));var util=require(_0x5a3b('0x1'));var md5=require(_0x5a3b('0x2'));var Redis=require(_0x5a3b('0x3'));var intUtil=require(_0x5a3b('0x4'));var config=require('../../../../config/environment');var logger=require(_0x5a3b('0x5'))(_0x5a3b('0x6'));config['redis']=_[_0x5a3b('0x7')](config[_0x5a3b('0x8')],{'host':_0x5a3b('0x9'),'port':0x18eb});var io=require(_0x5a3b('0xa'))(new Redis(config[_0x5a3b('0x8')]));function getAdminUser(_0x473e70,_0x21a658,_0x46ce63,_0x2bcea9,_0x51f270,_0xeb26ad){return new Promise(function(_0x2c1cc3,_0x2781a3){var _0x421141={'method':'GET','uri':_0x2bcea9+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x51f270+'&'+_0xeb26ad,'auth':_0x21a658,'json':!![]};return rp(_0x421141)['then'](function(_0x18305c){if(_0x18305c['result'][_0x5a3b('0xb')]>0x0){_0x46ce63['adminId']=_0x18305c[_0x5a3b('0xc')][0x0][_0x5a3b('0xd')];}logger[_0x5a3b('0xe')]('['+[_0x473e70['toUpperCase']()]+_0x5a3b('0xf'),_0x46ce63);_0x2c1cc3(_0x46ce63);})[_0x5a3b('0x10')](function(_0x2eff40){logger[_0x5a3b('0x11')]('['+[_0x473e70[_0x5a3b('0x12')]()]+']',_0x2eff40[_0x5a3b('0x13')]);_0x2781a3(_0x2eff40['message']);});});}function getUser(_0x14f463,_0xaf992,_0x43231f,_0x4e8ea4,_0x2e6014){return function(_0x953224){logger[_0x5a3b('0xe')]('['+[_0x14f463[_0x5a3b('0x12')]()]+_0x5a3b('0x14'),_0x953224);return new Promise(function(_0x3ebb50,_0xaac25b){if(intUtil[_0x5a3b('0x15')](_0x953224[_0x5a3b('0x16')])){var _0x13adc1={'method':_0x5a3b('0x17'),'uri':_0x43231f+'sys_user?sysparm_query=email%3D'+_0x953224[_0x5a3b('0x16')]+'&'+_0x4e8ea4+'&'+_0x2e6014,'auth':_0xaf992,'json':!![]};logger['info']('['+[_0x14f463[_0x5a3b('0x12')]()]+_0x5a3b('0x18'),_0x13adc1);return rp(_0x13adc1)['then'](function(_0x1f3c83){logger[_0x5a3b('0xe')]('['+[_0x14f463[_0x5a3b('0x12')]()]+_0x5a3b('0x19'),_0x1f3c83);if(_0x1f3c83['result'][_0x5a3b('0xb')]>0x0&&String(_0x1f3c83[_0x5a3b('0xc')][0x0][_0x5a3b('0x1a')])===_0x5a3b('0x1b')){_0x953224[_0x5a3b('0x1c')]=_0x1f3c83[_0x5a3b('0xc')][0x0][_0x5a3b('0xd')];}else{_0x953224[_0x5a3b('0x1c')]=_0x953224[_0x5a3b('0x1d')];_0x953224[_0x5a3b('0x16')]=_0x953224[_0x5a3b('0x1e')];}logger[_0x5a3b('0xe')]('['+[_0x14f463[_0x5a3b('0x12')]()]+_0x5a3b('0x1f'),_0x953224);_0x3ebb50(_0x953224);})[_0x5a3b('0x10')](function(_0x5abf3a){logger[_0x5a3b('0x11')]('['+[_0x14f463[_0x5a3b('0x12')]()]+']',_0x5abf3a[_0x5a3b('0x13')]);_0xaac25b(_0x5abf3a[_0x5a3b('0x13')]);});}else{logger[_0x5a3b('0xe')]('['+[_0x14f463['toUpperCase']()]+_0x5a3b('0x20'));_0x953224['userId']=_0x953224['adminId'];_0x953224[_0x5a3b('0x16')]=_0x953224[_0x5a3b('0x1e')];_0x3ebb50(_0x953224);}});};}function createEndUser(_0x33b5c6,_0x270f46,_0x5d51d4,_0x4a2d4c,_0x2b4fae){logger['info']('['+[_0x33b5c6[_0x5a3b('0x12')]()]+'],\x20createEndUser\x20input\x20crm',_0x5d51d4);return new Promise(function(_0x4ee9d1,_0x45a74b){var _0x3cb95f={'method':'POST','uri':_0x4a2d4c+'sys_user?'+_0x2b4fae,'body':{'user_name':_0x5d51d4[_0x5a3b('0x21')],'roles':_0x5a3b('0x22'),'first_name':_0x5d51d4[_0x5a3b('0x21')],'active':_0x5a3b('0x1b'),'date_format':_0x5a3b('0x23'),'phone':_0x5d51d4[_0x5a3b('0x21')]},'auth':_0x270f46,'json':!![]};return rp(_0x3cb95f)[_0x5a3b('0x24')](function(_0x5c13d5){logger[_0x5a3b('0xe')]('['+[_0x33b5c6[_0x5a3b('0x12')]()]+_0x5a3b('0x25'),_0x5c13d5[_0x5a3b('0xc')]);_0x5d51d4[_0x5a3b('0x26')]=_0x5c13d5[_0x5a3b('0xc')][_0x5a3b('0xd')];_0x4ee9d1(_0x5d51d4);})[_0x5a3b('0x10')](function(_0x35cb06){logger[_0x5a3b('0x11')]('['+[_0x33b5c6[_0x5a3b('0x12')]()]+']',_0x35cb06[_0x5a3b('0x13')]);_0x45a74b(_0x35cb06['message']);});});}function getEndUser(_0x4062f5,_0x481798,_0x2396d4,_0x3dcc38,_0x22f5bb){return function(_0x2332fe){logger['info']('['+[_0x4062f5[_0x5a3b('0x12')]()]+'],\x20getEndUser\x20input\x20crm',_0x2332fe);return new Promise(function(_0x154bd2,_0x16ef1c){var _0x17b4b6={'method':_0x5a3b('0x17'),'uri':_0x2396d4+_0x5a3b('0x27')+_0x2332fe[_0x5a3b('0x21')]+'&'+_0x3dcc38+'&'+_0x22f5bb,'auth':_0x481798,'json':!![]};return rp(_0x17b4b6)[_0x5a3b('0x24')](function(_0x3296db){if(_0x3296db[_0x5a3b('0xc')][_0x5a3b('0xb')]>0x0){_0x2332fe[_0x5a3b('0x26')]=_0x3296db[_0x5a3b('0xc')][0x0]['sys_id'];logger[_0x5a3b('0xe')]('['+[_0x4062f5[_0x5a3b('0x12')]()]+_0x5a3b('0x28'),_0x2332fe);_0x154bd2(_0x2332fe);}else{return createEndUser(_0x4062f5,_0x481798,_0x2332fe,_0x2396d4,_0x3dcc38)[_0x5a3b('0x24')](function(_0x3e56a3){logger[_0x5a3b('0xe')]('['+[_0x4062f5[_0x5a3b('0x12')]()]+_0x5a3b('0x29'),_0x3e56a3);_0x154bd2(_0x3e56a3);});}})[_0x5a3b('0x10')](function(_0x363fd0){logger[_0x5a3b('0x11')]('['+[_0x4062f5['toUpperCase']()]+']',_0x363fd0[_0x5a3b('0x13')]);_0x16ef1c(_0x363fd0['message']);});});};}function getCustomFields(_0x2ab7fd,_0x3b87bd){var _0x48f885={};if(_0x2ab7fd[_0x5a3b('0xb')]>0x0){_[_0x5a3b('0x2a')](_0x2ab7fd,function(_0x3cc82f){if(_[_0x5a3b('0x2b')](['string',_0x5a3b('0x2c')],_0x3cc82f[_0x5a3b('0x2d')])&&_0x3cc82f[_0x5a3b('0x2e')]&&!_0x3cc82f[_0x5a3b('0x2f')]){_0x48f885[_0x3cc82f['nameField']['toLowerCase']()]=_0x3cc82f['content'][_0x5a3b('0x30')]();}else if(_['includes']([_0x5a3b('0x31'),'picklist'],_0x3cc82f['type'])&&_0x3cc82f['idField']&&_0x3cc82f[_0x5a3b('0x2f')]){_0x48f885[_0x3cc82f[_0x5a3b('0x32')]['toLowerCase']()]=_0x3cc82f[_0x5a3b('0x33')]['toString']();}else if(_0x3cc82f[_0x5a3b('0x2d')]===_0x5a3b('0x34')&&_0x3cc82f[_0x5a3b('0x35')]&&_0x3cc82f[_0x5a3b('0x32')]&&_0x3cc82f[_0x5a3b('0x2f')]){_0x48f885[_0x3cc82f[_0x5a3b('0x32')]['toLowerCase']()]=_0x3b87bd[_0x3cc82f['variableName']][_0x5a3b('0x30')]();}else if(_0x3cc82f[_0x5a3b('0x2d')]===_0x5a3b('0x36')&&_0x3cc82f['Variable']&&_0x3cc82f['Variable'][_0x5a3b('0x37')]&&_0x3cc82f[_0x5a3b('0x32')]&&_0x3cc82f[_0x5a3b('0x2f')]){_0x48f885[_0x3cc82f[_0x5a3b('0x32')][_0x5a3b('0x38')]()]=_0x3b87bd[_0x3cc82f[_0x5a3b('0x39')]['name'][_0x5a3b('0x38')]()][_0x5a3b('0x30')]();}});}return _0x48f885;}function getTicket(_0x43e523,_0x58c895,_0x1095ac,_0x28d279,_0x181e92,_0x166b8d){return function(_0x1a3d10){logger[_0x5a3b('0xe')]('['+[_0x43e523['toUpperCase']()]+_0x5a3b('0x3a'),_0x1a3d10);return new Promise(function(_0x5ce142,_0x1ebd32){var _0x8f365a=_0x43e523[_0x5a3b('0x38')]()===_0x5a3b('0x3b')?_0x1a3d10['userId']:_0x1a3d10[_0x5a3b('0x26')];var _0x2bd5a9={'method':_0x5a3b('0x3c'),'uri':_0x1095ac+_0x5a3b('0x3d')+'?'+_0x166b8d,'body':Object[_0x5a3b('0x3e')]({},{'active':_0x5a3b('0x1b'),'caller_id':_0x8f365a,'assigned_to':_0x1a3d10[_0x5a3b('0x1c')],'short_description':intUtil[_0x5a3b('0x3f')](_0x28d279[_0x5a3b('0x40')],_0x181e92,'\x20'),'description':intUtil[_0x5a3b('0x3f')](_0x28d279['Descriptions'],_0x181e92,'\x0a')},getCustomFields(_0x28d279['Fields'],_0x181e92)),'auth':_0x58c895,'json':!![]};return rp(_0x2bd5a9)[_0x5a3b('0x24')](function(_0x19c7a2){logger[_0x5a3b('0xe')]('['+[_0x43e523[_0x5a3b('0x12')]()]+_0x5a3b('0x41'),_0x19c7a2[_0x5a3b('0xc')]);_0x1a3d10[_0x5a3b('0x42')]=_0x19c7a2[_0x5a3b('0xc')][_0x5a3b('0xd')];_0x1a3d10[_0x5a3b('0x43')]=_0x19c7a2[_0x5a3b('0xc')]['number'];logger[_0x5a3b('0xe')]('['+[_0x43e523[_0x5a3b('0x12')]()]+_0x5a3b('0x44'),_0x1a3d10);_0x5ce142(_0x1a3d10);})[_0x5a3b('0x10')](function(_0xff36f2){logger[_0x5a3b('0x11')]('['+[_0x43e523['toUpperCase']()]+']',_0xff36f2['message']);_0x1ebd32(_0xff36f2['message']);});});};}function createRemoteTag(_0x59a641,_0x5009ef,_0x1b0632,_0x5a9791){return new Promise(function(_0x15317a,_0x174f54){var _0x5c5a55={'method':_0x5a3b('0x3c'),'uri':_0x1b0632+_0x5a3b('0x45')+'?'+_0x5a9791,'body':{'short_description':_0x59a641,'global':!![],'active':!![],'name':_0x59a641},'auth':_0x5009ef,'json':!![]};return rp(_0x5c5a55)['then'](function(_0x378cf5){var _0x470e49=_0x378cf5[_0x5a3b('0xc')]['sys_id'];_0x15317a(_0x470e49);});});}function getRemoteTag(_0x167f7a,_0x219fd0,_0x2e2ddd,_0x5ce84e,_0x3c2250){return new Promise(function(_0x1309ae,_0x476e65){var _0x3989b5={'method':'GET','uri':_0x2e2ddd+_0x5a3b('0x45')+'?sysparm_query=name%3D'+_0x167f7a+'&'+_0x5ce84e,'auth':_0x219fd0,'json':!![]};return rp(_0x3989b5)[_0x5a3b('0x24')](function(_0x72b955){if(_0x72b955[_0x5a3b('0xc')][_0x5a3b('0xb')]>0x0){var _0x4e5cff=_0x72b955[_0x5a3b('0xc')][0x0][_0x5a3b('0xd')];_0x1309ae(_0x4e5cff);}else{return createRemoteTag(_0x167f7a,_0x219fd0,_0x2e2ddd,_0x5ce84e)['then'](function(_0x30b3e3){_0x1309ae(_0x30b3e3);});}});});}function assignTagToIncident(_0x103ca3,_0x54aeb9,_0x5e0577,_0x70c4e4,_0x23ec7c){return new Promise(function(_0x4c5e21,_0x434b88){var _0xa1a6d8={'method':_0x5a3b('0x3c'),'uri':_0x5e0577+_0x5a3b('0x46')+'?'+_0x23ec7c,'body':{'label':_0x103ca3,'table':_0x5a3b('0x3d'),'id_type':_0x5a3b('0x47'),'table_key':_0x70c4e4[_0x5a3b('0x42')],'title':_0x5a3b('0x48')+_0x70c4e4['ticketNumber'],'id_display':_0x70c4e4[_0x5a3b('0x43')]},'auth':_0x54aeb9,'json':!![]};return rp(_0xa1a6d8)[_0x5a3b('0x24')](function(_0x1f9425){_0x4c5e21();})[_0x5a3b('0x10')](function(){_0x4c5e21();});});}function manageTags(_0xe0738d,_0x2e13fa,_0x16cad5,_0x550679,_0x5b4a52,_0x390e0c,_0x501299){return new Promise(function(_0x45c9a5,_0x1b44f4){var _0x4c3012=[];_0x2e13fa[_0x5a3b('0x2a')](function(_0x444a93){_0x4c3012[_0x5a3b('0x49')](getRemoteTag(_0x444a93,_0x16cad5,_0x550679,_0x390e0c,_0x501299));});return Promise['all'](_0x4c3012)[_0x5a3b('0x24')](function(_0x123b85){if(_0x123b85[_0x5a3b('0xb')]){logger['info']('['+[_0xe0738d[_0x5a3b('0x12')]()]+_0x5a3b('0x4a'),_0x123b85);var _0x2334df=[];_0x123b85['forEach'](function(_0x2c613d){_0x2334df[_0x5a3b('0x49')](assignTagToIncident(_0x2c613d,_0x16cad5,_0x550679,_0x5b4a52,_0x390e0c));});return Promise[_0x5a3b('0x4b')](_0x2334df)[_0x5a3b('0x24')](function(){_0x45c9a5();})[_0x5a3b('0x10')](function(){_0x45c9a5();});}else{_0x45c9a5();}});});}function getTags(_0x4006da,_0x16a7be,_0x2fa135,_0xc0e187,_0x45ba53,_0x2bb126){return function(_0x453246){return new Promise(function(_0x213cda,_0x246a6d){var _0x4f8292=[];var _0x253ede=_0xc0e187[_0x5a3b('0x4c')];if(_0x253ede&&_0x253ede[_0x5a3b('0xb')]>0x0){_0x4f8292=_[_0x5a3b('0x4d')](_0x253ede,_0x5a3b('0x37'));}if(_0x4f8292[_0x5a3b('0xb')]>0x0){return manageTags(_0x4006da,_0x4f8292,_0x16a7be,_0x2fa135,_0x453246,_0x45ba53,_0x2bb126)['then'](function(){_0x213cda(_0x453246);});}else{_0x213cda(_0x453246);}});};}function emit(_0x1608b0,_0x29558b,_0x18ced4){var _0x5023c2=_0x5a3b('0x4e')+_0x5a3b('0x4f')+_0x5a3b('0x50')+_0x5a3b('0x51');var _0x4fe060={'uri':_0x1608b0+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x18ced4+_0x5023c2};io['to'](util[_0x5a3b('0x52')]('user:%s',_0x29558b))[_0x5a3b('0x53')]('trigger:browser:url',_0x4fe060);}exports['cs']=function(_0x14c78a,_0x5a5fcb,_0x2c7cb9,_0x56ac85,_0x251c10,_0x3960a2,_0x4f3598,_0x3f3f21){var _0x23b97e={};var _0x4e6722={'user':_0x3960a2['username'],'pass':_0x3960a2['password']};var _0x5bdf0c=_0x5a3b('0x54');var _0x48bf31=_0x5a3b('0x55');_0x3960a2[_0x5a3b('0x56')]=intUtil[_0x5a3b('0x57')](_0x3960a2[_0x5a3b('0x56')]);_0x3960a2[_0x5a3b('0x58')]=intUtil[_0x5a3b('0x57')](_0x3960a2[_0x5a3b('0x58')]);var _0x40c115=util[_0x5a3b('0x52')](_0x5a3b('0x59'),_0x3960a2[_0x5a3b('0x56')]);_0x23b97e[_0x5a3b('0x16')]=!_[_0x5a3b('0x5a')](_0x56ac85)?_0x56ac85[_0x5a3b('0x5b')]:null;_0x23b97e['adminEmail']=_0x3960a2[_0x5a3b('0x5b')];_0x23b97e[_0x5a3b('0x21')]=_0x3f3f21[_0x5a3b('0x38')]()==='outbound'?_0x5a5fcb[_0x5a3b('0x5c')]:_0x5a5fcb[_0x5a3b('0x5d')];_0x23b97e[_0x5a3b('0x5e')]=_0x3f3f21===_0x5a3b('0x5f')||_0x3f3f21==='unmanaged'?_0x5a3b('0x5f'):'outbound';var _0x55a254=util[_0x5a3b('0x52')](_0x5a3b('0x60'),_0x3960a2[_0x5a3b('0x58')],_0x5a5fcb[_0x5a3b('0x61')],md5(_0x5a5fcb['uniqueid']));if(_0x251c10&&_0x251c10[_0x5a3b('0x62')]){logger[_0x5a3b('0xe')](_0x5a3b('0x63'),_0x5a3b('0x64'));_0x5a5fcb['recordingURL']=_0x55a254;}else if(_0x4f3598&&_0x4f3598[_0x5a3b('0x65')]&&_0x4f3598[_0x5a3b('0x65')]!==_0x5a3b('0x66')){logger[_0x5a3b('0xe')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x5a5fcb[_0x5a3b('0x67')]=_0x55a254;}else{_0x5a5fcb['recordingURL']='';}return getAdminUser(_0x3f3f21,_0x4e6722,_0x23b97e,_0x40c115,_0x48bf31,_0x5bdf0c)[_0x5a3b('0x24')](getUser(_0x3f3f21,_0x4e6722,_0x40c115,_0x48bf31,_0x5bdf0c))[_0x5a3b('0x24')](getEndUser(_0x3f3f21,_0x4e6722,_0x40c115,_0x48bf31,_0x5bdf0c))['then'](getTicket(_0x3f3f21,_0x4e6722,_0x40c115,_0x2c7cb9,_0x5a5fcb,_0x48bf31))[_0x5a3b('0x24')](function(_0x31fcc5){logger[_0x5a3b('0xe')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x31fcc5[_0x5a3b('0x42')]));logger[_0x5a3b('0xe')](util[_0x5a3b('0x52')](_0x5a3b('0x68'),_0x3f3f21));if(_0x3f3f21!==_0x5a3b('0x69')){logger['info']('['+[_0x3f3f21[_0x5a3b('0x12')]()]+']',_0x5a3b('0x6a'));emit(_0x3960a2['remoteUri'],_0x56ac85[_0x5a3b('0x37')],_0x31fcc5[_0x5a3b('0x42')]);}})[_0x5a3b('0x10')](function(_0x194557){logger['error']('['+[_0x3f3f21['toUpperCase']()]+_0x5a3b('0x6b'),util[_0x5a3b('0x6c')](_0x194557,{'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 37ae5d8..c91e32c 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 _0xfce3=['calleridname','Inbound','lodash','bluebird','md5','util','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','slice','replace','duration_hours','parent_type','Contacts','parent_name','direction','length','idField','variableName','JSON','stringify','Calls','format','get_server_info','isNil','Getting\x20agent\x20with\x20name','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','entry_list','name_value_list','value','Agent\x20found!','resolve','user_id','Searching\x20enduser\x20with\x20phone','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Enduser\x20created.','[HTTP]','merge','map','forEach','type','string','nameField','customField','toLowerCase','push','toString','variable','custom_fields','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','then','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','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','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Outbound','unmanaged','lastevent','toUpperCase'];(function(_0x3ffe40,_0x372c49){var _0x33cbcf=function(_0x44bee6){while(--_0x44bee6){_0x3ffe40['push'](_0x3ffe40['shift']());}};_0x33cbcf(++_0x372c49);}(_0xfce3,0x1e2));var _0x3fce=function(_0x2d24e2,_0x38c3af){_0x2d24e2=_0x2d24e2-0x0;var _0x330f61=_0xfce3[_0x2d24e2];return _0x330f61;};'use strict';var _=require(_0x3fce('0x0'));var rp=require('request-promise');var BPromise=require(_0x3fce('0x1'));var md5=require(_0x3fce('0x2'));var util=require(_0x3fce('0x3'));var Redis=require('ioredis');var intUtil=require(_0x3fce('0x4'));var config=require(_0x3fce('0x5'));var logger=require(_0x3fce('0x6'))(_0x3fce('0x7'));config[_0x3fce('0x8')]=_[_0x3fce('0x9')](config['redis'],{'host':_0x3fce('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3fce('0x8')]));var def={'method':_0x3fce('0xb'),'json':!![]};function emit(_0x3556e0,_0x368998,_0x4c2d8f){io['to'](_0x3556e0)[_0x3fce('0xc')](_0x368998,_0x4c2d8f);}function getTicket(_0x8026d3,_0x28e11f,_0x82e35a,_0x3b4b48,_0x2f46f1,_0x27acf5,_0x4d3ed6,_0x313595){logger[_0x3fce('0xd')](_0x3fce('0xe'));var _0x4f7b24=new Date();var _0x3d8179=[{'name':_0x3fce('0xf'),'value':intUtil[_0x3fce('0x10')](_0x3b4b48[_0x3fce('0x11')],_0x2f46f1,'\x20')},{'name':_0x3fce('0x12'),'value':_0x28e11f['id']},{'name':_0x3fce('0x13'),'value':_0x28e11f['id']},{'name':_0x3fce('0x14'),'value':intUtil[_0x3fce('0x10')](_0x3b4b48[_0x3fce('0x15')],_0x2f46f1,'\x0a')},{'name':_0x3fce('0x16'),'value':_0x4f7b24['toISOString']()[_0x3fce('0x17')](0x0,0x13)[_0x3fce('0x18')]('T','\x20')},{'name':_0x3fce('0x19'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':'parent_id','value':_0x82e35a['id']},{'name':_0x3fce('0x1a'),'value':_0x3fce('0x1b')},{'name':_0x3fce('0x1c'),'value':_0x82e35a['name']},{'name':_0x3fce('0x1d'),'value':_0x313595}];if(_0x27acf5[_0x3fce('0x1e')]){_['forEach'](_0x27acf5,function(_0x21374c){if(_0x2f46f1[_0x21374c['variableName']]){_0x3d8179['push']({'name':_0x21374c[_0x3fce('0x1f')],'value':_0x2f46f1[_0x21374c[_0x3fce('0x20')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x3fce('0x21'),'response_type':_0x3fce('0x21'),'rest_data':JSON[_0x3fce('0x22')]({'session':_0x4d3ed6['id'],'module_name':_0x3fce('0x23'),'name_value_list':_0x3d8179})}});}function getAuth(_0x23c1cf){return util[_0x3fce('0x24')]('Basic\x20%s',new Buffer(_0x23c1cf['apiKey']+':X')['toString']('base64'));}function getServerInfo(_0x31722e){return request({'form':{'method':_0x3fce('0x25'),'input_type':_0x3fce('0x21'),'response_type':_0x3fce('0x21'),'rest_data':JSON[_0x3fce('0x22')]({'session':_0x31722e['id']})}});}function getUser(_0x5b960c,_0x188279,_0x10c601){if(!_[_0x3fce('0x26')](_0x188279)){logger[_0x3fce('0xd')](_0x3fce('0x27'),_0x188279);return request({'form':{'method':'get_entry_list','input_type':_0x3fce('0x21'),'response_type':_0x3fce('0x21'),'rest_data':JSON[_0x3fce('0x22')]({'session':_0x10c601['id'],'module_name':'Employees','query':util['format'](_0x3fce('0x28'),_0x188279),'order_by':'','offset':'0','select_fields':['id','name',_0x3fce('0x29')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x3e1dfc){if(_0x3e1dfc[_0x3fce('0x2a')][_0x3fce('0x1e')]){var _0x31c6dc=_['find'](_0x3e1dfc['entry_list'],function(_0x493d2e){return _0x493d2e[_0x3fce('0x2b')][_0x3fce('0x29')][_0x3fce('0x2c')]===_0x188279;});if(_0x31c6dc){logger[_0x3fce('0xd')](_0x3fce('0x2d'));return BPromise[_0x3fce('0x2e')]({'id':_0x31c6dc[_0x3fce('0x2b')]['id'][_0x3fce('0x2c')],'name':_0x31c6dc[_0x3fce('0x2b')]['name'][_0x3fce('0x2c')]});}}logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x10c601[_0x3fce('0x2b')][_0x3fce('0x2f')]['value'],'name':_0x10c601[_0x3fce('0x2b')]['user_name'][_0x3fce('0x2c')]});});}else{logger[_0x3fce('0xd')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x3fce('0x2e')]({'id':_0x10c601[_0x3fce('0x2b')][_0x3fce('0x2f')][_0x3fce('0x2c')],'name':_0x10c601[_0x3fce('0x2b')][_0x3fce('0x29')]['value']});}}function getEndUser(_0xeaed1c,_0x5354aa,_0x9ca012,_0x61d2f7){logger[_0x3fce('0xd')](_0x3fce('0x30'),_0x9ca012);return request({'form':{'method':_0x3fce('0x31'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x3fce('0x22')]({'session':_0x61d2f7['id'],'module_name':'Contacts','query':util[_0x3fce('0x24')](_0x3fce('0x32'),_0x9ca012),'order_by':'','offset':'0','select_fields':['id',_0x3fce('0xf'),_0x3fce('0x33')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x5cfd9f){if(_0x5cfd9f[_0x3fce('0x2a')][_0x3fce('0x1e')]){var _0x42d177=_[_0x3fce('0x34')](_0x5cfd9f[_0x3fce('0x2a')],function(_0x4a8f90){return _0x4a8f90[_0x3fce('0x2b')][_0x3fce('0x33')][_0x3fce('0x2c')]===_0x9ca012;});if(_0x42d177){logger[_0x3fce('0xd')](_0x3fce('0x35'));return BPromise[_0x3fce('0x2e')]({'id':_0x42d177[_0x3fce('0x2b')]['id'][_0x3fce('0x2c')],'name':_0x42d177[_0x3fce('0x2b')][_0x3fce('0xf')][_0x3fce('0x2c')],'phone':_0x42d177[_0x3fce('0x2b')][_0x3fce('0x33')]['value']});}}else{logger['info'](_0x3fce('0x36'));return request({'form':{'method':'set_entry','input_type':_0x3fce('0x21'),'response_type':'JSON','rest_data':JSON[_0x3fce('0x22')]({'session':_0x61d2f7['id'],'module_name':_0x3fce('0x1b'),'name_value_list':[{'name':_0x3fce('0x37'),'value':_0x5354aa!==''?_0x5354aa:util[_0x3fce('0x24')]('Caller\x20-\x20%s',_0x9ca012)},{'name':'phone_home','value':_0x9ca012}]})}})['then'](function(_0x42ec58){logger[_0x3fce('0xd')](_0x3fce('0x38'));return BPromise[_0x3fce('0x2e')]({'id':_0x42ec58['id'],'name':_0x42ec58[_0x3fce('0x2a')][_0x3fce('0x37')]['value'],'phone':_0x42ec58[_0x3fce('0x2a')][_0x3fce('0x33')][_0x3fce('0x2c')]});});}});}function request(_0x493852){logger['debug'](_0x3fce('0x39'),JSON[_0x3fce('0x22')](_0x493852));return rp(_[_0x3fce('0x3a')](def,_0x493852));}function getTags(_0x474b97,_0xd7fc67){var _0x242198=[];if(_0x474b97&&_0x474b97[_0x3fce('0x1e')]>0x0){_0x242198=_[_0x3fce('0x3b')](_0x474b97,_0xd7fc67);}return _0x242198;}function getCustomFields(_0x488e93,_0x3346e7){var _0xc22b30=[];var _0x171029={'custom_fields':[]};if(_0x488e93['length']>0x0){_[_0x3fce('0x3c')](_0x488e93,function(_0x9a5686){if(_0x9a5686[_0x3fce('0x3d')]===_0x3fce('0x3e')&&_0x9a5686[_0x3fce('0x3f')]&&!_0x9a5686[_0x3fce('0x40')]){_0x171029[_0x9a5686[_0x3fce('0x3f')][_0x3fce('0x41')]()]=_0x9a5686['content']['toString']();}else if(_0x9a5686[_0x3fce('0x3d')]==='string'&&_0x9a5686['idField']&&_0x9a5686[_0x3fce('0x40')]){_0x171029['custom_fields'][_0x3fce('0x42')]({'id':_0x9a5686['idField'],'value':_0x9a5686['content'][_0x3fce('0x43')]()});}else if(_0x9a5686['type']===_0x3fce('0x44')&&_0x9a5686['variableName']&&_0x9a5686[_0x3fce('0x1f')]&&_0x9a5686[_0x3fce('0x40')]){_0x3346e7[_0x9a5686[_0x3fce('0x20')]]&&_0x171029[_0x3fce('0x45')]['push']({'id':_0x9a5686[_0x3fce('0x1f')],'value':_0x3346e7[_0x9a5686[_0x3fce('0x20')]][_0x3fce('0x43')]()});}else if(_0x9a5686[_0x3fce('0x3d')]===_0x3fce('0x46')&&_0x9a5686[_0x3fce('0x47')]&&_0x9a5686['Variable'][_0x3fce('0xf')]&&_0x9a5686['idField']&&_0x9a5686[_0x3fce('0x40')]){_0x3346e7[_0x9a5686['Variable'][_0x3fce('0xf')]['toLowerCase']()]&&_0x171029[_0x3fce('0x45')][_0x3fce('0x42')]({'id':_0x9a5686['idField'],'value':_0x3346e7[_0x9a5686[_0x3fce('0x47')][_0x3fce('0xf')][_0x3fce('0x41')]()][_0x3fce('0x43')]()});}});}return _0x171029;}function getConnection(_0x439892){return request({'method':_0x3fce('0xb'),'form':{'method':_0x3fce('0x48'),'input_type':_0x3fce('0x21'),'response_type':_0x3fce('0x21'),'rest_data':JSON[_0x3fce('0x22')]({'user_auth':{'user_name':_0x439892[_0x3fce('0x49')],'password':_0x439892[_0x3fce('0x4a')],'encryption':_0x3fce('0x4b')},'application':_0x3fce('0x4c')})}})[_0x3fce('0x4d')](function(_0x3f6425){var _0x32ff63=_0x3f6425;if(_0x32ff63['id']){def[_0x3fce('0x4e')]=_0x32ff63['id'];return BPromise[_0x3fce('0x2e')](_0x32ff63);}else{throw new Error(util[_0x3fce('0x24')](_0x3fce('0x4f'),_0x439892['id']));}});}function setRelationship(_0x5c5309,_0x33925b,_0x592c4c,_0x14f9f6){return request({'form':{'method':_0x3fce('0x50'),'input_type':_0x3fce('0x21'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x5c5309['id'],'module_name':_0x3fce('0x23'),'module_id':_0x592c4c['id'],'link_field_name':_0x14f9f6,'related_ids':[_0x33925b['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x3537ab,_0x1fd0e,_0x1e1159,_0xc24a12,_0x335f6b,_0x5ef86b){var _0x154cfe,_0x4a2d66,_0xfc240f,_0x1f14e4;_0x5ef86b[_0x3fce('0x51')]=intUtil[_0x3fce('0x52')](_0x5ef86b[_0x3fce('0x51')]);_0x5ef86b[_0x3fce('0x53')]=intUtil[_0x3fce('0x52')](_0x5ef86b['serverUrl']);def[_0x3fce('0x54')]=util[_0x3fce('0x24')](_0x3fce('0x55'),_0x5ef86b[_0x3fce('0x51')]);if(_0x335f6b&&_0x335f6b[_0x3fce('0x56')]){logger[_0x3fce('0xd')]('[QUEUE]',_0x3fce('0x57'));_0x1fd0e[_0x3fce('0x58')]=util[_0x3fce('0x24')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5ef86b[_0x3fce('0x53')],_0x1fd0e[_0x3fce('0x59')],md5(_0x1fd0e[_0x3fce('0x59')]));}else{_0x1fd0e[_0x3fce('0x58')]='';}return getConnection(_0x5ef86b)[_0x3fce('0x4d')](function(_0x52fecc){_0x1f14e4=_0x52fecc;return getUser(_0x5ef86b,_0xc24a12[_0x3fce('0xf')],_0x1f14e4);})[_0x3fce('0x4d')](function(_0x37d5f5){_0x154cfe=_0x37d5f5;logger[_0x3fce('0xd')](_0x3fce('0x5a'),_0x154cfe['id']);return getEndUser(_0x5ef86b,_0x1fd0e['calleridname'],_0x1fd0e[_0x3fce('0x5b')],_0x1f14e4);})['then'](function(_0x3c1426){_0x4a2d66=_0x3c1426;logger[_0x3fce('0xd')](_0x3fce('0x5c'),_0x4a2d66['id']);return getTicket(_0x5ef86b,_0x154cfe,_0x4a2d66,_0x1e1159,_0x1fd0e,_0x1e1159[_0x3fce('0x5d')],_0x1f14e4,'Inbound');})['then'](function(_0x1a5a31){_0xfc240f=_0x1a5a31;logger[_0x3fce('0xd')](_0x3fce('0x5e'));logger[_0x3fce('0xd')](_0x3fce('0x5f'),_0xfc240f['id']);return setRelationship(_0x1f14e4,_0x154cfe,_0xfc240f,_0x3fce('0x60'));})[_0x3fce('0x4d')](function(){return setRelationship(_0x1f14e4,_0x4a2d66,_0xfc240f,_0x3fce('0x61'));})['then'](function(){return getServerInfo(_0x1f14e4);})[_0x3fce('0x4d')](function(_0x527d88){var _0x2ddb3a=parseInt(_0x527d88['version'][_0x3fce('0x62')](0x0));var _0x10e44f=util[_0x3fce('0x24')](_0x3fce('0x63'),_0x5ef86b[_0x3fce('0x51')],_0xfc240f['id']);if(_0x2ddb3a>0x6){_0x10e44f=util['format'](_0x3fce('0x64'),_0x5ef86b['remoteUri'],_0xfc240f['id']);}logger['info'](_0x3fce('0x65'),_0x3fce('0x66'));emit(util['format'](_0x3fce('0x67'),_0xc24a12[_0x3fce('0xf')]),_0x3fce('0x68'),{'uri':_0x10e44f});})[_0x3fce('0x69')](function(_0x2237ba){logger[_0x3fce('0x6a')]('[QUEUE]',JSON[_0x3fce('0x22')](_0x2237ba));});};exports[_0x3fce('0x6b')]=function(_0x105094,_0xc613c9,_0x39c939,_0x55cc5c,_0x4ff3fb,_0x18a2e1,_0x16dbf1){var _0x254c8b,_0x3cc217,_0x2a2090,_0x797b6a;_0x18a2e1[_0x3fce('0x51')]=intUtil['stripTrailingSlash'](_0x18a2e1[_0x3fce('0x51')]);_0x18a2e1[_0x3fce('0x53')]=intUtil['stripTrailingSlash'](_0x18a2e1[_0x3fce('0x53')]);def[_0x3fce('0x54')]=util['format'](_0x3fce('0x55'),_0x18a2e1['remoteUri']);if(_0x16dbf1&&_0x16dbf1[_0x3fce('0x6c')]&&_0x16dbf1['recordingFormat']!==_0x3fce('0x6d')){logger[_0x3fce('0xd')](_0x3fce('0x6e'),_0x3fce('0x57'));_0xc613c9[_0x3fce('0x58')]=util[_0x3fce('0x24')](_0x3fce('0x6f'),_0x18a2e1[_0x3fce('0x53')],_0xc613c9['uniqueid'],md5(_0xc613c9[_0x3fce('0x59')]));}return getConnection(_0x18a2e1)[_0x3fce('0x4d')](function(_0x27e77a){_0x797b6a=_0x27e77a;return getUser(_0x18a2e1,_0x55cc5c[_0x3fce('0xf')],_0x797b6a);})[_0x3fce('0x4d')](function(_0x5def37){_0x254c8b=_0x5def37;logger['info'](_0x3fce('0x5a'),_0x254c8b['id']);return getEndUser(_0x18a2e1,_0xc613c9[_0x3fce('0x70')],_0xc613c9[_0x3fce('0x71')],_0x797b6a);})[_0x3fce('0x4d')](function(_0x59e82b){_0x3cc217=_0x59e82b;logger[_0x3fce('0xd')](_0x3fce('0x5c'),_0x3cc217['id']);return getTicket(_0x18a2e1,_0x254c8b,_0x3cc217,_0x39c939,_0xc613c9,_0x39c939[_0x3fce('0x5d')],_0x797b6a,_0x3fce('0x72'));})[_0x3fce('0x4d')](function(_0xec21a7){_0x2a2090=_0xec21a7;logger[_0x3fce('0xd')](_0x3fce('0x5e'));logger['info'](_0x3fce('0x5f'),_0x2a2090['id']);return setRelationship(_0x797b6a,_0x254c8b,_0x2a2090,_0x3fce('0x60'));})['then'](function(){return setRelationship(_0x797b6a,_0x3cc217,_0x2a2090,_0x3fce('0x61'));})[_0x3fce('0x4d')](function(){return getServerInfo(_0x797b6a);})['then'](function(_0x5a5ce8){var _0x18b2ef=parseInt(_0x5a5ce8['version']['charAt'](0x0));var _0x1cf314=util[_0x3fce('0x24')](_0x3fce('0x63'),_0x18a2e1[_0x3fce('0x51')],_0x2a2090['id']);if(_0x18b2ef>0x6){_0x1cf314=util[_0x3fce('0x24')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x18a2e1[_0x3fce('0x51')],_0x2a2090['id']);}logger[_0x3fce('0xd')]('[OUTBOUND]',_0x3fce('0x66'));emit(util['format'](_0x3fce('0x67'),_0x55cc5c[_0x3fce('0xf')]),_0x3fce('0x68'),{'uri':_0x1cf314});})[_0x3fce('0x69')](function(_0x7ba823){logger['error'](_0x3fce('0x6e'),JSON[_0x3fce('0x22')](_0x7ba823));});};exports[_0x3fce('0x73')]=function(_0x4334f7,_0x232c39,_0x5afcbc,_0x355f0b,_0x235c8d,_0x11766f){var _0x159af7,_0x4bf80c,_0x126c93,_0x59a1bc;_0x11766f[_0x3fce('0x51')]=intUtil[_0x3fce('0x52')](_0x11766f[_0x3fce('0x51')]);_0x11766f['serverUrl']=intUtil[_0x3fce('0x52')](_0x11766f[_0x3fce('0x53')]);def[_0x3fce('0x54')]=util[_0x3fce('0x24')](_0x3fce('0x55'),_0x11766f[_0x3fce('0x51')]);if(_0x235c8d&&_0x235c8d[_0x3fce('0x56')]){logger[_0x3fce('0xd')]('['+_0x232c39[_0x3fce('0x74')][_0x3fce('0x75')]()+']','Recording\x20is\x20enabled!');_0x232c39['recordingURL']=util[_0x3fce('0x24')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x11766f[_0x3fce('0x53')],_0x232c39[_0x3fce('0x59')],md5(_0x232c39['uniqueid']));}else{_0x232c39[_0x3fce('0x58')]='';}return getConnection(_0x11766f)[_0x3fce('0x4d')](function(_0x141d62){_0x59a1bc=_0x141d62;if(!_[_0x3fce('0x26')](_0x355f0b)){return getUser(_0x11766f,_0x355f0b['name'],_0x59a1bc);}else{return getUser(_0x11766f,null,_0x59a1bc);}})[_0x3fce('0x4d')](function(_0x2fa9f7){_0x159af7=_0x2fa9f7;logger['info'](_0x3fce('0x5a'),_0x159af7['id']);return getEndUser(_0x11766f,_0x232c39[_0x3fce('0x76')],_0x232c39[_0x3fce('0x5b')],_0x59a1bc);})[_0x3fce('0x4d')](function(_0x3a4138){_0x4bf80c=_0x3a4138;logger[_0x3fce('0xd')](_0x3fce('0x5c'),_0x4bf80c['id']);return getTicket(_0x11766f,_0x159af7,_0x4bf80c,_0x5afcbc,_0x232c39,_0x5afcbc['Fields'],_0x59a1bc,_0x3fce('0x77'));})['then'](function(_0x437608){_0x126c93=_0x437608;logger[_0x3fce('0xd')](_0x3fce('0x5e'));logger['info'](_0x3fce('0x5f'),_0x126c93['id']);return setRelationship(_0x59a1bc,_0x159af7,_0x126c93,_0x3fce('0x60'));})[_0x3fce('0x4d')](function(){return setRelationship(_0x59a1bc,_0x4bf80c,_0x126c93,'contacts');})[_0x3fce('0x4d')](function(){return getServerInfo(_0x59a1bc);})[_0x3fce('0x69')](function(_0x2cc039){logger['error']('['+_0x232c39[_0x3fce('0x74')][_0x3fce('0x75')]()+']',JSON['stringify'](_0x2cc039));});}; \ No newline at end of file +var _0x8e0f=['isNil','info','get_entry_list','stringify','Employees','entry_list','user_name','value','Agent\x20found!','name_value_list','user_id','resolve','Searching\x20enduser\x20with\x20phone','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','','Caller\x20-\x20%s','Enduser\x20created.','first_name','debug','merge','map','forEach','type','string','customField','toLowerCase','content','toString','custom_fields','push','variable','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','users','contacts','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','Outbound','The\x20Ticket\x20ID\x20is:','version','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','trigger:browser:url','unmanaged','lastevent','toUpperCase','The\x20User\x20ID\x20is:','catch','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','POST','emit','name','getString','Subjects','assigned_user_id','description','Descriptions','date_start','toISOString','slice','replace','duration_hours','parent_id','parent_name','direction','length','variableName','idField','set_entry','JSON','Calls','format','Basic\x20%s','base64','get_server_info'];(function(_0x1bbfb7,_0x16244a){var _0x39f8bd=function(_0x446986){while(--_0x446986){_0x1bbfb7['push'](_0x1bbfb7['shift']());}};_0x39f8bd(++_0x16244a);}(_0x8e0f,0x148));var _0xf8e0=function(_0x3eb1aa,_0x396dde){_0x3eb1aa=_0x3eb1aa-0x0;var _0x1bf8ff=_0x8e0f[_0x3eb1aa];return _0x1bf8ff;};'use strict';var _=require(_0xf8e0('0x0'));var rp=require(_0xf8e0('0x1'));var BPromise=require('bluebird');var md5=require(_0xf8e0('0x2'));var util=require(_0xf8e0('0x3'));var Redis=require(_0xf8e0('0x4'));var intUtil=require(_0xf8e0('0x5'));var config=require(_0xf8e0('0x6'));var logger=require(_0xf8e0('0x7'))('sugarcrm');config[_0xf8e0('0x8')]=_[_0xf8e0('0x9')](config['redis'],{'host':_0xf8e0('0xa'),'port':0x18eb});var io=require(_0xf8e0('0xb'))(new Redis(config[_0xf8e0('0x8')]));var def={'method':_0xf8e0('0xc'),'json':!![]};function emit(_0x5f473f,_0x32a3b8,_0x6d127e){io['to'](_0x5f473f)[_0xf8e0('0xd')](_0x32a3b8,_0x6d127e);}function getTicket(_0x53ebab,_0x26973c,_0x3f4fe7,_0x24e255,_0x2a89d2,_0x3d6c01,_0x28093b,_0x5dc619){logger['info']('Creating\x20new\x20ticket...');var _0x444995=new Date();var _0x5a45d4=[{'name':_0xf8e0('0xe'),'value':intUtil[_0xf8e0('0xf')](_0x24e255[_0xf8e0('0x10')],_0x2a89d2,'\x20')},{'name':_0xf8e0('0x11'),'value':_0x26973c['id']},{'name':'created_by','value':_0x26973c['id']},{'name':_0xf8e0('0x12'),'value':intUtil[_0xf8e0('0xf')](_0x24e255[_0xf8e0('0x13')],_0x2a89d2,'\x0a')},{'name':_0xf8e0('0x14'),'value':_0x444995[_0xf8e0('0x15')]()[_0xf8e0('0x16')](0x0,0x13)[_0xf8e0('0x17')]('T','\x20')},{'name':_0xf8e0('0x18'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0xf8e0('0x19'),'value':_0x3f4fe7['id']},{'name':'parent_type','value':'Contacts'},{'name':_0xf8e0('0x1a'),'value':_0x3f4fe7['name']},{'name':_0xf8e0('0x1b'),'value':_0x5dc619}];if(_0x3d6c01[_0xf8e0('0x1c')]){_['forEach'](_0x3d6c01,function(_0x4df83e){if(_0x2a89d2[_0x4df83e[_0xf8e0('0x1d')]]){_0x5a45d4['push']({'name':_0x4df83e[_0xf8e0('0x1e')],'value':_0x2a89d2[_0x4df83e[_0xf8e0('0x1d')]]});}});}return request({'form':{'method':_0xf8e0('0x1f'),'input_type':_0xf8e0('0x20'),'response_type':_0xf8e0('0x20'),'rest_data':JSON['stringify']({'session':_0x28093b['id'],'module_name':_0xf8e0('0x21'),'name_value_list':_0x5a45d4})}});}function getAuth(_0x5035f9){return util[_0xf8e0('0x22')](_0xf8e0('0x23'),new Buffer(_0x5035f9['apiKey']+':X')['toString'](_0xf8e0('0x24')));}function getServerInfo(_0x53eea1){return request({'form':{'method':_0xf8e0('0x25'),'input_type':_0xf8e0('0x20'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x53eea1['id']})}});}function getUser(_0x231e4d,_0x2eb26c,_0x37a8b0){if(!_[_0xf8e0('0x26')](_0x2eb26c)){logger[_0xf8e0('0x27')]('Getting\x20agent\x20with\x20name',_0x2eb26c);return request({'form':{'method':_0xf8e0('0x28'),'input_type':_0xf8e0('0x20'),'response_type':'JSON','rest_data':JSON[_0xf8e0('0x29')]({'session':_0x37a8b0['id'],'module_name':_0xf8e0('0x2a'),'query':util[_0xf8e0('0x22')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x2eb26c),'order_by':'','offset':'0','select_fields':['id',_0xf8e0('0xe'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x376540){if(_0x376540['entry_list'][_0xf8e0('0x1c')]){var _0x278a29=_['find'](_0x376540[_0xf8e0('0x2b')],function(_0x17ed2b){return _0x17ed2b['name_value_list'][_0xf8e0('0x2c')][_0xf8e0('0x2d')]===_0x2eb26c;});if(_0x278a29){logger[_0xf8e0('0x27')](_0xf8e0('0x2e'));return BPromise['resolve']({'id':_0x278a29[_0xf8e0('0x2f')]['id'][_0xf8e0('0x2d')],'name':_0x278a29['name_value_list'][_0xf8e0('0xe')]['value']});}}logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x37a8b0[_0xf8e0('0x2f')][_0xf8e0('0x30')][_0xf8e0('0x2d')],'name':_0x37a8b0[_0xf8e0('0x2f')][_0xf8e0('0x2c')][_0xf8e0('0x2d')]});});}else{logger[_0xf8e0('0x27')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0xf8e0('0x31')]({'id':_0x37a8b0[_0xf8e0('0x2f')]['user_id']['value'],'name':_0x37a8b0[_0xf8e0('0x2f')][_0xf8e0('0x2c')]['value']});}}function getEndUser(_0x5ec297,_0x5df9bf,_0x8dbcc9,_0x44c547){logger[_0xf8e0('0x27')](_0xf8e0('0x32'),_0x8dbcc9);return request({'form':{'method':_0xf8e0('0x28'),'input_type':_0xf8e0('0x20'),'response_type':_0xf8e0('0x20'),'rest_data':JSON[_0xf8e0('0x29')]({'session':_0x44c547['id'],'module_name':_0xf8e0('0x33'),'query':util[_0xf8e0('0x22')](_0xf8e0('0x34'),_0x8dbcc9),'order_by':'','offset':'0','select_fields':['id','name',_0xf8e0('0x35')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xf8e0('0x36')](function(_0x50a7e7){if(_0x50a7e7['entry_list'][_0xf8e0('0x1c')]){var _0x597909=_[_0xf8e0('0x37')](_0x50a7e7[_0xf8e0('0x2b')],function(_0x5ec126){return _0x5ec126['name_value_list']['phone_home']['value']===_0x8dbcc9;});if(_0x597909){logger['info']('Enduser\x20found!');return BPromise['resolve']({'id':_0x597909[_0xf8e0('0x2f')]['id'][_0xf8e0('0x2d')],'name':_0x597909[_0xf8e0('0x2f')]['name'][_0xf8e0('0x2d')],'phone':_0x597909['name_value_list'][_0xf8e0('0x35')][_0xf8e0('0x2d')]});}}else{logger[_0xf8e0('0x27')](_0xf8e0('0x38'));return request({'form':{'method':_0xf8e0('0x1f'),'input_type':_0xf8e0('0x20'),'response_type':_0xf8e0('0x20'),'rest_data':JSON[_0xf8e0('0x29')]({'session':_0x44c547['id'],'module_name':_0xf8e0('0x33'),'name_value_list':[{'name':'first_name','value':_0x5df9bf!==_0xf8e0('0x39')?_0x5df9bf:util[_0xf8e0('0x22')](_0xf8e0('0x3a'),_0x8dbcc9)},{'name':_0xf8e0('0x35'),'value':_0x8dbcc9}]})}})[_0xf8e0('0x36')](function(_0x5db0b7){logger[_0xf8e0('0x27')](_0xf8e0('0x3b'));return BPromise[_0xf8e0('0x31')]({'id':_0x5db0b7['id'],'name':_0x5db0b7[_0xf8e0('0x2b')][_0xf8e0('0x3c')][_0xf8e0('0x2d')],'phone':_0x5db0b7[_0xf8e0('0x2b')][_0xf8e0('0x35')]['value']});});}});}function request(_0x21232a){logger[_0xf8e0('0x3d')]('[HTTP]',JSON[_0xf8e0('0x29')](_0x21232a));return rp(_[_0xf8e0('0x3e')](def,_0x21232a));}function getTags(_0x495f24,_0xba1367){var _0x4718da=[];if(_0x495f24&&_0x495f24[_0xf8e0('0x1c')]>0x0){_0x4718da=_[_0xf8e0('0x3f')](_0x495f24,_0xba1367);}return _0x4718da;}function getCustomFields(_0x587c15,_0x53a94f){var _0x5a97f7=[];var _0x15fe79={'custom_fields':[]};if(_0x587c15[_0xf8e0('0x1c')]>0x0){_[_0xf8e0('0x40')](_0x587c15,function(_0xb43b02){if(_0xb43b02[_0xf8e0('0x41')]===_0xf8e0('0x42')&&_0xb43b02['nameField']&&!_0xb43b02[_0xf8e0('0x43')]){_0x15fe79[_0xb43b02['nameField'][_0xf8e0('0x44')]()]=_0xb43b02[_0xf8e0('0x45')][_0xf8e0('0x46')]();}else if(_0xb43b02[_0xf8e0('0x41')]===_0xf8e0('0x42')&&_0xb43b02[_0xf8e0('0x1e')]&&_0xb43b02['customField']){_0x15fe79[_0xf8e0('0x47')][_0xf8e0('0x48')]({'id':_0xb43b02[_0xf8e0('0x1e')],'value':_0xb43b02['content']['toString']()});}else if(_0xb43b02[_0xf8e0('0x41')]===_0xf8e0('0x49')&&_0xb43b02[_0xf8e0('0x1d')]&&_0xb43b02['idField']&&_0xb43b02[_0xf8e0('0x43')]){_0x53a94f[_0xb43b02[_0xf8e0('0x1d')]]&&_0x15fe79[_0xf8e0('0x47')][_0xf8e0('0x48')]({'id':_0xb43b02['idField'],'value':_0x53a94f[_0xb43b02['variableName']][_0xf8e0('0x46')]()});}else if(_0xb43b02['type']===_0xf8e0('0x4a')&&_0xb43b02[_0xf8e0('0x4b')]&&_0xb43b02[_0xf8e0('0x4b')][_0xf8e0('0xe')]&&_0xb43b02[_0xf8e0('0x1e')]&&_0xb43b02[_0xf8e0('0x43')]){_0x53a94f[_0xb43b02[_0xf8e0('0x4b')][_0xf8e0('0xe')]['toLowerCase']()]&&_0x15fe79[_0xf8e0('0x47')][_0xf8e0('0x48')]({'id':_0xb43b02[_0xf8e0('0x1e')],'value':_0x53a94f[_0xb43b02[_0xf8e0('0x4b')][_0xf8e0('0xe')][_0xf8e0('0x44')]()][_0xf8e0('0x46')]()});}});}return _0x15fe79;}function getConnection(_0x2214c3){return request({'method':_0xf8e0('0xc'),'form':{'method':_0xf8e0('0x4c'),'input_type':_0xf8e0('0x20'),'response_type':_0xf8e0('0x20'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x2214c3[_0xf8e0('0x4d')],'password':_0x2214c3[_0xf8e0('0x4e')],'encryption':_0xf8e0('0x4f')},'application':_0xf8e0('0x50')})}})[_0xf8e0('0x36')](function(_0x2a7f52){var _0x3e71ad=_0x2a7f52;if(_0x3e71ad['id']){def[_0xf8e0('0x51')]=_0x3e71ad['id'];return BPromise[_0xf8e0('0x31')](_0x3e71ad);}else{throw new Error(util[_0xf8e0('0x22')](_0xf8e0('0x52'),_0x2214c3['id']));}});}function setRelationship(_0x3e2100,_0x31391e,_0x1c790b,_0x192276){return request({'form':{'method':_0xf8e0('0x53'),'input_type':'JSON','response_type':_0xf8e0('0x20'),'rest_data':JSON[_0xf8e0('0x29')]({'session':_0x3e2100['id'],'module_name':_0xf8e0('0x21'),'module_id':_0x1c790b['id'],'link_field_name':_0x192276,'related_ids':[_0x31391e['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xf8e0('0x54')]=function(_0x39c37d,_0x1560ed,_0x24fb3a,_0x32e04c,_0x84e857,_0x5b3274){var _0x50845e,_0x2a7f78,_0x408044,_0x229610;_0x5b3274[_0xf8e0('0x55')]=intUtil[_0xf8e0('0x56')](_0x5b3274[_0xf8e0('0x55')]);_0x5b3274[_0xf8e0('0x57')]=intUtil['stripTrailingSlash'](_0x5b3274['serverUrl']);def['uri']=util[_0xf8e0('0x22')](_0xf8e0('0x58'),_0x5b3274['remoteUri']);if(_0x84e857&&_0x84e857[_0xf8e0('0x59')]){logger['info']('[QUEUE]',_0xf8e0('0x5a'));_0x1560ed[_0xf8e0('0x5b')]=util['format'](_0xf8e0('0x5c'),_0x5b3274['serverUrl'],_0x1560ed[_0xf8e0('0x5d')],md5(_0x1560ed['uniqueid']));}else{_0x1560ed['recordingURL']='';}return getConnection(_0x5b3274)[_0xf8e0('0x36')](function(_0x246826){_0x229610=_0x246826;return getUser(_0x5b3274,_0x32e04c[_0xf8e0('0xe')],_0x229610);})[_0xf8e0('0x36')](function(_0x212d4c){_0x50845e=_0x212d4c;logger[_0xf8e0('0x27')]('The\x20User\x20ID\x20is:',_0x50845e['id']);return getEndUser(_0x5b3274,_0x1560ed[_0xf8e0('0x5e')],_0x1560ed[_0xf8e0('0x5f')],_0x229610);})[_0xf8e0('0x36')](function(_0x24e8e1){_0x2a7f78=_0x24e8e1;logger[_0xf8e0('0x27')](_0xf8e0('0x60'),_0x2a7f78['id']);return getTicket(_0x5b3274,_0x50845e,_0x2a7f78,_0x24fb3a,_0x1560ed,_0x24fb3a[_0xf8e0('0x61')],_0x229610,_0xf8e0('0x62'));})[_0xf8e0('0x36')](function(_0x455f93){_0x408044=_0x455f93;logger[_0xf8e0('0x27')](_0xf8e0('0x63'));logger[_0xf8e0('0x27')]('The\x20Ticket\x20ID\x20is:',_0x408044['id']);return setRelationship(_0x229610,_0x50845e,_0x408044,_0xf8e0('0x64'));})[_0xf8e0('0x36')](function(){return setRelationship(_0x229610,_0x2a7f78,_0x408044,_0xf8e0('0x65'));})[_0xf8e0('0x36')](function(){return getServerInfo(_0x229610);})['then'](function(_0x12171d){var _0x1d26b8=parseInt(_0x12171d['version'][_0xf8e0('0x66')](0x0));var _0x54b96d=util['format'](_0xf8e0('0x67'),_0x5b3274[_0xf8e0('0x55')],_0x408044['id']);if(_0x1d26b8>0x6){_0x54b96d=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x5b3274[_0xf8e0('0x55')],_0x408044['id']);}logger[_0xf8e0('0x27')](_0xf8e0('0x68'),_0xf8e0('0x69'));emit(util['format']('user:%s',_0x32e04c[_0xf8e0('0xe')]),'trigger:browser:url',{'uri':_0x54b96d});})['catch'](function(_0x327a86){logger[_0xf8e0('0x6a')](_0xf8e0('0x68'),JSON[_0xf8e0('0x29')](_0x327a86));});};exports[_0xf8e0('0x6b')]=function(_0x46db9f,_0x4ba343,_0x7c2c4,_0x591994,_0x2bcdd6,_0x467229,_0x24770c){var _0xe614d2,_0x535947,_0x41fe62,_0x37b633;_0x467229[_0xf8e0('0x55')]=intUtil[_0xf8e0('0x56')](_0x467229[_0xf8e0('0x55')]);_0x467229[_0xf8e0('0x57')]=intUtil[_0xf8e0('0x56')](_0x467229[_0xf8e0('0x57')]);def['uri']=util[_0xf8e0('0x22')](_0xf8e0('0x58'),_0x467229[_0xf8e0('0x55')]);if(_0x24770c&&_0x24770c[_0xf8e0('0x6c')]&&_0x24770c[_0xf8e0('0x6c')]!==_0xf8e0('0x6d')){logger['info'](_0xf8e0('0x6e'),_0xf8e0('0x5a'));_0x4ba343[_0xf8e0('0x5b')]=util[_0xf8e0('0x22')](_0xf8e0('0x5c'),_0x467229[_0xf8e0('0x57')],_0x4ba343[_0xf8e0('0x5d')],md5(_0x4ba343[_0xf8e0('0x5d')]));}return getConnection(_0x467229)['then'](function(_0x144753){_0x37b633=_0x144753;return getUser(_0x467229,_0x591994[_0xf8e0('0xe')],_0x37b633);})[_0xf8e0('0x36')](function(_0xea7620){_0xe614d2=_0xea7620;logger[_0xf8e0('0x27')]('The\x20User\x20ID\x20is:',_0xe614d2['id']);return getEndUser(_0x467229,_0x4ba343[_0xf8e0('0x6f')],_0x4ba343['destcalleridnum'],_0x37b633);})[_0xf8e0('0x36')](function(_0x31381b){_0x535947=_0x31381b;logger[_0xf8e0('0x27')]('The\x20Enduser\x20ID\x20is:',_0x535947['id']);return getTicket(_0x467229,_0xe614d2,_0x535947,_0x7c2c4,_0x4ba343,_0x7c2c4['Fields'],_0x37b633,_0xf8e0('0x70'));})[_0xf8e0('0x36')](function(_0x1f29d8){_0x41fe62=_0x1f29d8;logger[_0xf8e0('0x27')](_0xf8e0('0x63'));logger[_0xf8e0('0x27')](_0xf8e0('0x71'),_0x41fe62['id']);return setRelationship(_0x37b633,_0xe614d2,_0x41fe62,_0xf8e0('0x64'));})['then'](function(){return setRelationship(_0x37b633,_0x535947,_0x41fe62,_0xf8e0('0x65'));})[_0xf8e0('0x36')](function(){return getServerInfo(_0x37b633);})[_0xf8e0('0x36')](function(_0x57f1aa){var _0x4cde28=parseInt(_0x57f1aa[_0xf8e0('0x72')][_0xf8e0('0x66')](0x0));var _0x1f20e6=util[_0xf8e0('0x22')](_0xf8e0('0x67'),_0x467229[_0xf8e0('0x55')],_0x41fe62['id']);if(_0x4cde28>0x6){_0x1f20e6=util['format'](_0xf8e0('0x73'),_0x467229[_0xf8e0('0x55')],_0x41fe62['id']);}logger[_0xf8e0('0x27')]('[OUTBOUND]',_0xf8e0('0x69'));emit(util['format']('user:%s',_0x591994[_0xf8e0('0xe')]),_0xf8e0('0x74'),{'uri':_0x1f20e6});})['catch'](function(_0x124623){logger['error']('[OUTBOUND]',JSON[_0xf8e0('0x29')](_0x124623));});};exports[_0xf8e0('0x75')]=function(_0x553afe,_0x4c55e0,_0x36f105,_0xb51fe,_0x116312,_0xeb0a94){var _0x372676,_0x2f7432,_0x215383,_0x4846ad;_0xeb0a94[_0xf8e0('0x55')]=intUtil[_0xf8e0('0x56')](_0xeb0a94[_0xf8e0('0x55')]);_0xeb0a94[_0xf8e0('0x57')]=intUtil['stripTrailingSlash'](_0xeb0a94[_0xf8e0('0x57')]);def['uri']=util[_0xf8e0('0x22')](_0xf8e0('0x58'),_0xeb0a94[_0xf8e0('0x55')]);if(_0x116312&&_0x116312[_0xf8e0('0x59')]){logger['info']('['+_0x4c55e0[_0xf8e0('0x76')][_0xf8e0('0x77')]()+']','Recording\x20is\x20enabled!');_0x4c55e0[_0xf8e0('0x5b')]=util[_0xf8e0('0x22')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xeb0a94['serverUrl'],_0x4c55e0[_0xf8e0('0x5d')],md5(_0x4c55e0[_0xf8e0('0x5d')]));}else{_0x4c55e0[_0xf8e0('0x5b')]='';}return getConnection(_0xeb0a94)[_0xf8e0('0x36')](function(_0x3d3173){_0x4846ad=_0x3d3173;if(!_[_0xf8e0('0x26')](_0xb51fe)){return getUser(_0xeb0a94,_0xb51fe[_0xf8e0('0xe')],_0x4846ad);}else{return getUser(_0xeb0a94,null,_0x4846ad);}})[_0xf8e0('0x36')](function(_0x40ab5a){_0x372676=_0x40ab5a;logger[_0xf8e0('0x27')](_0xf8e0('0x78'),_0x372676['id']);return getEndUser(_0xeb0a94,_0x4c55e0[_0xf8e0('0x5e')],_0x4c55e0[_0xf8e0('0x5f')],_0x4846ad);})[_0xf8e0('0x36')](function(_0x32374d){_0x2f7432=_0x32374d;logger[_0xf8e0('0x27')](_0xf8e0('0x60'),_0x2f7432['id']);return getTicket(_0xeb0a94,_0x372676,_0x2f7432,_0x36f105,_0x4c55e0,_0x36f105[_0xf8e0('0x61')],_0x4846ad,_0xf8e0('0x62'));})[_0xf8e0('0x36')](function(_0xcfca50){_0x215383=_0xcfca50;logger['info'](_0xf8e0('0x63'));logger[_0xf8e0('0x27')](_0xf8e0('0x71'),_0x215383['id']);return setRelationship(_0x4846ad,_0x372676,_0x215383,'users');})['then'](function(){return setRelationship(_0x4846ad,_0x2f7432,_0x215383,'contacts');})[_0xf8e0('0x36')](function(){return getServerInfo(_0x4846ad);})[_0xf8e0('0x79')](function(_0x2eb6c3){logger['error']('['+_0x4c55e0[_0xf8e0('0x76')][_0xf8e0('0x77')]()+']',JSON[_0xf8e0('0x29')](_0x2eb6c3));});}; \ 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 cbf4b99..f9ded6e 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 _0x84d5=['util','getString','length','sortBy','type','string','push','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyType','key','format','%s:\x20%s','keyContent','join','stripTrailingSlash','lastIndexOf','validateEmail','isNil','test','lodash'];(function(_0x557285,_0x416f13){var _0x32cbb1=function(_0x5a4741){while(--_0x5a4741){_0x557285['push'](_0x557285['shift']());}};_0x32cbb1(++_0x416f13);}(_0x84d5,0x1ed));var _0x584d=function(_0x1f750f,_0x3ebc08){_0x1f750f=_0x1f750f-0x0;var _0x3ac316=_0x84d5[_0x1f750f];return _0x3ac316;};'use strict';var _=require(_0x584d('0x0'));var util=require(_0x584d('0x1'));exports[_0x584d('0x2')]=function(_0x194e76,_0x29c97d,_0x255c01){var _0x5c281b=[];if(_0x194e76[_0x584d('0x3')]>0x0){var _0x7f5edf=_[_0x584d('0x4')](_0x194e76,['id']);for(var _0x335b88=0x0;_0x335b88<_0x7f5edf[_0x584d('0x3')];_0x335b88++){var _0x54e04d=_0x7f5edf[_0x335b88];if(_0x54e04d[_0x584d('0x5')]===_0x584d('0x6')){_0x5c281b[_0x584d('0x7')](_0x54e04d['content']);}else if(_0x54e04d['type']===_0x584d('0x8')&&_0x54e04d['variableName']){_0x29c97d[_0x54e04d['variableName']]&&_0x5c281b[_0x584d('0x7')](_0x29c97d[_0x54e04d[_0x584d('0x9')]][_0x584d('0xa')]());}else if(_0x54e04d[_0x584d('0x5')]===_0x584d('0xb')&&_0x54e04d[_0x584d('0xc')]&&_0x54e04d[_0x584d('0xc')][_0x584d('0xd')]){_0x29c97d[_0x54e04d[_0x584d('0xc')][_0x584d('0xd')]['toLowerCase']()]&&_0x5c281b[_0x584d('0x7')](_0x29c97d[_0x54e04d[_0x584d('0xc')][_0x584d('0xd')][_0x584d('0xe')]()]['toString']());}else if(_0x54e04d['type']==='keyValue'){if(_0x54e04d[_0x584d('0xf')]==='string'&&_0x54e04d[_0x584d('0x10')]){_0x5c281b[_0x584d('0x7')](util[_0x584d('0x11')](_0x584d('0x12'),_0x54e04d[_0x584d('0x10')],_0x54e04d[_0x584d('0x13')]));}else if(_0x54e04d[_0x584d('0xf')]===_0x584d('0x8')&&_0x54e04d[_0x584d('0x9')]&&_0x54e04d[_0x584d('0x10')]){_0x29c97d[_0x54e04d[_0x584d('0x9')]]&&_0x5c281b['push'](util[_0x584d('0x11')](_0x584d('0x12'),_0x54e04d['key'],_0x29c97d[_0x54e04d[_0x584d('0x9')]]));}else if(_0x54e04d[_0x584d('0xf')]===_0x584d('0xb')&&_0x54e04d['Variable']&&_0x54e04d['Variable'][_0x584d('0xd')]&&_0x54e04d[_0x584d('0x10')]){_0x29c97d[_0x54e04d[_0x584d('0xc')]['name'][_0x584d('0xe')]()]&&_0x5c281b[_0x584d('0x7')](util[_0x584d('0x11')](_0x584d('0x12'),_0x54e04d[_0x584d('0x10')],_0x29c97d[_0x54e04d['Variable']['name'][_0x584d('0xe')]()]));}}}}return _0x5c281b[_0x584d('0x14')](_0x255c01);};exports[_0x584d('0x15')]=function(_0x43b489){var _0x2646ab=_0x43b489['slice'](-0x1);if(_0x2646ab==='/'){_0x43b489=_0x43b489['substring'](0x0,_0x43b489[_0x584d('0x16')](_0x2646ab));}return _0x43b489;};exports[_0x584d('0x17')]=function(_0x2e9448){if(!_[_0x584d('0x18')](_0x2e9448)&&_0x2e9448!==''){var _0x51bd9d=/^(([^<>()\[\]\\.,;:\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 _0x51bd9d[_0x584d('0x19')](String(_0x2e9448)[_0x584d('0xe')]());}else{return![];}}; \ No newline at end of file +var _0x1da6=['slice','substring','lastIndexOf','validateEmail','isNil','test','getString','length','push','content','type','variableName','customVariable','Variable','name','toLowerCase','toString','keyValue','keyType','string','key','format','%s:\x20%s','keyContent','join'];(function(_0x3d2e5d,_0xfbf829){var _0x1a71de=function(_0x315b48){while(--_0x315b48){_0x3d2e5d['push'](_0x3d2e5d['shift']());}};_0x1a71de(++_0xfbf829);}(_0x1da6,0x132));var _0x61da=function(_0x114da0,_0x19188f){_0x114da0=_0x114da0-0x0;var _0x5f1d8a=_0x1da6[_0x114da0];return _0x5f1d8a;};'use strict';var _=require('lodash');var util=require('util');exports[_0x61da('0x0')]=function(_0x2667d4,_0x3ec415,_0x60feb){var _0x4c3f15=[];if(_0x2667d4[_0x61da('0x1')]>0x0){var _0x5e03e7=_['sortBy'](_0x2667d4,['id']);for(var _0x4d882=0x0;_0x4d882<_0x5e03e7['length'];_0x4d882++){var _0x266a68=_0x5e03e7[_0x4d882];if(_0x266a68['type']==='string'){_0x4c3f15[_0x61da('0x2')](_0x266a68[_0x61da('0x3')]);}else if(_0x266a68[_0x61da('0x4')]==='variable'&&_0x266a68[_0x61da('0x5')]){_0x3ec415[_0x266a68[_0x61da('0x5')]]&&_0x4c3f15[_0x61da('0x2')](_0x3ec415[_0x266a68[_0x61da('0x5')]]['toString']());}else if(_0x266a68[_0x61da('0x4')]===_0x61da('0x6')&&_0x266a68['Variable']&&_0x266a68[_0x61da('0x7')][_0x61da('0x8')]){_0x3ec415[_0x266a68[_0x61da('0x7')]['name'][_0x61da('0x9')]()]&&_0x4c3f15[_0x61da('0x2')](_0x3ec415[_0x266a68[_0x61da('0x7')][_0x61da('0x8')]['toLowerCase']()][_0x61da('0xa')]());}else if(_0x266a68[_0x61da('0x4')]===_0x61da('0xb')){if(_0x266a68[_0x61da('0xc')]===_0x61da('0xd')&&_0x266a68[_0x61da('0xe')]){_0x4c3f15[_0x61da('0x2')](util[_0x61da('0xf')](_0x61da('0x10'),_0x266a68[_0x61da('0xe')],_0x266a68[_0x61da('0x11')]));}else if(_0x266a68[_0x61da('0xc')]==='variable'&&_0x266a68['variableName']&&_0x266a68[_0x61da('0xe')]){_0x3ec415[_0x266a68[_0x61da('0x5')]]&&_0x4c3f15[_0x61da('0x2')](util[_0x61da('0xf')](_0x61da('0x10'),_0x266a68[_0x61da('0xe')],_0x3ec415[_0x266a68[_0x61da('0x5')]]));}else if(_0x266a68['keyType']===_0x61da('0x6')&&_0x266a68['Variable']&&_0x266a68['Variable'][_0x61da('0x8')]&&_0x266a68[_0x61da('0xe')]){_0x3ec415[_0x266a68[_0x61da('0x7')][_0x61da('0x8')][_0x61da('0x9')]()]&&_0x4c3f15[_0x61da('0x2')](util[_0x61da('0xf')](_0x61da('0x10'),_0x266a68[_0x61da('0xe')],_0x3ec415[_0x266a68[_0x61da('0x7')][_0x61da('0x8')][_0x61da('0x9')]()]));}}}}return _0x4c3f15[_0x61da('0x12')](_0x60feb);};exports['stripTrailingSlash']=function(_0x2f8ecf){var _0x4c71c3=_0x2f8ecf[_0x61da('0x13')](-0x1);if(_0x4c71c3==='/'){_0x2f8ecf=_0x2f8ecf[_0x61da('0x14')](0x0,_0x2f8ecf[_0x61da('0x15')](_0x4c71c3));}return _0x2f8ecf;};exports[_0x61da('0x16')]=function(_0x143822){if(!_[_0x61da('0x17')](_0x143822)&&_0x143822!==''){var _0x548966=/^(([^<>()\[\]\\.,;:\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 _0x548966[_0x61da('0x18')](String(_0x143822)[_0x61da('0x9')]());}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 2f91238..793d371 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 _0xd8b0=['info','Creating\x20new\x20ticket...','merge','Normal','Subjects','POST','format','%s/webservice.php','remoteUri','create','username','sessionName','HelpDesk','stringify','success','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','then','Agent\x20found!','resolve','email1','first_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','admin','catch','userId','getUser','Searching\x20end\x20user\x20with\x20phone','GET','query','Enduser\x20found!','firstname','Enduser\x20created.','lastname','phone','accessKey','getchallenge','login','token','getConnection','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','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]','uniqueid','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','lastevent','toUpperCase','lodash','request-promise','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','localhost','socket.io-emitter','emit','length','forEach','includes','picklist','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase'];(function(_0x435044,_0x36ab8e){var _0x33d4c6=function(_0x15efa0){while(--_0x15efa0){_0x435044['push'](_0x435044['shift']());}};_0x33d4c6(++_0x36ab8e);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var rp=require(_0x0d8b('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require('util');var Redis=require(_0x0d8b('0x2'));var intUtil=require(_0x0d8b('0x3'));var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));config['redis']=_['defaults'](config[_0x0d8b('0x7')],{'host':_0x0d8b('0x8'),'port':0x18eb});var io=require(_0x0d8b('0x9'))(new Redis(config['redis']));function emit(_0x413284,_0x284169,_0x58e4e2){io['to'](_0x413284)[_0x0d8b('0xa')](_0x284169,_0x58e4e2);}function getCustomFields(_0x348e65,_0x3b027f){var _0x1f4800={};if(_0x348e65[_0x0d8b('0xb')]>0x0){_[_0x0d8b('0xc')](_0x348e65,function(_0x2c5e9e){if(_[_0x0d8b('0xd')](['string',_0x0d8b('0xe')],_0x2c5e9e['type'])&&_0x2c5e9e[_0x0d8b('0xf')]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x2c5e9e[_0x0d8b('0x10')][_0x0d8b('0x11')]();}else if(_0x2c5e9e[_0x0d8b('0x12')]===_0x0d8b('0x13')&&_0x2c5e9e[_0x0d8b('0x14')]&&_0x2c5e9e[_0x0d8b('0xf')]&&_0x3b027f[_0x2c5e9e[_0x0d8b('0x14')]]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x3b027f[_0x2c5e9e[_0x0d8b('0x14')]][_0x0d8b('0x11')]();}else if(_0x2c5e9e[_0x0d8b('0x12')]===_0x0d8b('0x15')&&_0x2c5e9e['Variable']&&_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')]&&_0x2c5e9e[_0x0d8b('0xf')]&&_0x3b027f[_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')]['toLowerCase']()]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x3b027f[_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')][_0x0d8b('0x18')]()][_0x0d8b('0x11')]();}});}return _0x1f4800;}function createTicket(_0x18dd2d,_0x264b39,_0xa3612a,_0x4a15bf,_0x27512e,_0x23d58f,_0x196c0a){logger[_0x0d8b('0x19')](_0x0d8b('0x1a'));var _0x5b709c=_[_0x0d8b('0x1b')]({'parent_id':'','assigned_user_id':_0x264b39['id'],'ticketpriorities':_0x0d8b('0x1c'),'ticketstatus':'Open','ticket_title':intUtil['getString'](_0x4a15bf[_0x0d8b('0x1d')],_0x27512e,'\x20'),'description':intUtil['getString'](_0x4a15bf['Descriptions'],_0x27512e,'\x0a'),'contact_id':_0xa3612a['id']},getCustomFields(_0x23d58f,_0x27512e));var _0x5527d8={'method':_0x0d8b('0x1e'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x18dd2d[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x22'),'username':_0x18dd2d[_0x0d8b('0x23')],'sessionName':_0x196c0a[_0x0d8b('0x24')],'elementType':_0x0d8b('0x25'),'element':JSON[_0x0d8b('0x26')](_0x5b709c)},'json':!![]};return request(_0x5527d8)['then'](function(_0xe8bbee){if(_0xe8bbee[_0x0d8b('0x27')]){return BPromise['resolve']({'id':_0xe8bbee[_0x0d8b('0x28')]['id']});}else{throw new Error(util['format'](_0x0d8b('0x29'),JSON[_0x0d8b('0x26')](_0xe8bbee[_0x0d8b('0x2a')])));}})['catch'](function(_0x59a905){var _0x28f639=_0x59a905[_0x0d8b('0x2b')]||0x1f4;logger['error'](_0x0d8b('0x2c'),'createTicket',_0x28f639,JSON[_0x0d8b('0x26')](_0x59a905));});}function getUser(_0x4b59e5,_0x97050a,_0x48f24f){if(intUtil[_0x0d8b('0x2d')](_0x97050a)){logger['info'](_0x0d8b('0x2e'),_0x97050a);return request({'method':'GET','uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x4b59e5[_0x0d8b('0x21')]),'qs':{'operation':'query','username':_0x4b59e5['username'],'sessionName':_0x48f24f['sessionName'],'query':util[_0x0d8b('0x1f')]('SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;',_0x97050a)},'json':!![]})[_0x0d8b('0x2f')](function(_0x54f6f3){if(_0x54f6f3['success']&&_0x54f6f3[_0x0d8b('0x28')][_0x0d8b('0xb')]){logger[_0x0d8b('0x19')](_0x0d8b('0x30'));return BPromise[_0x0d8b('0x31')]({'id':_0x54f6f3[_0x0d8b('0x28')][0x0]['id'],'email':_0x54f6f3[_0x0d8b('0x28')][0x0][_0x0d8b('0x32')],'name':_0x54f6f3['result'][0x0][_0x0d8b('0x33')]+'\x20'+_0x54f6f3[_0x0d8b('0x28')]['last_name']});}else{logger[_0x0d8b('0x19')](_0x0d8b('0x34'));return BPromise[_0x0d8b('0x31')]({'id':_0x48f24f['userId'],'email':_0x4b59e5[_0x0d8b('0x23')],'name':_0x0d8b('0x35')});}})[_0x0d8b('0x36')](function(_0x31ceba){var _0x933e01=_0x31ceba['statusCode']||0x1f4;logger[_0x0d8b('0x2a')](_0x0d8b('0x2c'),'getUser',_0x933e01,JSON[_0x0d8b('0x26')](_0x31ceba));});}else{logger[_0x0d8b('0x19')](_0x0d8b('0x34'));return BPromise[_0x0d8b('0x31')]({'id':_0x48f24f[_0x0d8b('0x37')],'email':_0x4b59e5['username'],'name':'admin'})[_0x0d8b('0x36')](function(_0x5c2c04){var _0x531c55=_0x5c2c04[_0x0d8b('0x2b')]||0x1f4;logger[_0x0d8b('0x2a')](_0x0d8b('0x2c'),_0x0d8b('0x38'),_0x531c55,JSON[_0x0d8b('0x26')](_0x5c2c04));});}}function getEndUser(_0x24c789,_0x579324,_0x6e5bab,_0x6a02ad){logger[_0x0d8b('0x19')](_0x0d8b('0x39'),_0x6e5bab);return request({'method':_0x0d8b('0x3a'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x24c789['remoteUri']),'qs':{'operation':_0x0d8b('0x3b'),'username':_0x24c789[_0x0d8b('0x23')],'sessionName':_0x6a02ad[_0x0d8b('0x24')],'query':util[_0x0d8b('0x1f')]('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;',_0x6e5bab,_0x6e5bab,_0x6e5bab,_0x6e5bab,_0x6e5bab)},'json':!![]})[_0x0d8b('0x2f')](function(_0x4b4bde){if(_0x4b4bde[_0x0d8b('0x27')]&&_0x4b4bde[_0x0d8b('0x28')][_0x0d8b('0xb')]){logger[_0x0d8b('0x19')](_0x0d8b('0x3c'));return BPromise[_0x0d8b('0x31')]({'id':_0x4b4bde[_0x0d8b('0x28')][0x0]['id'],'name':_0x4b4bde[_0x0d8b('0x28')][0x0][_0x0d8b('0x3d')]+'\x20'+_0x4b4bde[_0x0d8b('0x28')][0x0]['lastname'],'phone':_0x6e5bab});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':'POST','uri':util['format'](_0x0d8b('0x20'),_0x24c789[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x22'),'sessionName':_0x6a02ad['sessionName'],'elementType':'Contacts','element':JSON[_0x0d8b('0x26')]({'lastname':_0x579324,'phone':_0x6e5bab,'assigned_user_id':'\x20'})},'json':!![]})[_0x0d8b('0x2f')](function(_0x344278){logger['info'](_0x0d8b('0x3e'));return BPromise[_0x0d8b('0x31')]({'id':_0x344278['result']['id'],'name':_0x344278['result'][_0x0d8b('0x3f')],'phone':_0x344278['result'][_0x0d8b('0x40')]});})['catch'](function(_0x53f643){var _0x30ccee=_0x53f643[_0x0d8b('0x2b')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','getEndUser',_0x30ccee,JSON['stringify'](_0x53f643));});}});}function getConnection(_0x374d40){var _0x1e0498=_0x374d40[_0x0d8b('0x23')];var _0x490eda=_0x374d40[_0x0d8b('0x41')];return request({'method':_0x0d8b('0x3a'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x374d40[_0x0d8b('0x21')]),'qs':{'operation':_0x0d8b('0x42'),'username':_0x1e0498},'json':!![]})[_0x0d8b('0x2f')](function(_0x1d5067){if(_0x1d5067[_0x0d8b('0x27')]){return request({'method':_0x0d8b('0x1e'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x374d40[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x43'),'username':_0x1e0498,'accessKey':md5(_0x1d5067[_0x0d8b('0x28')][_0x0d8b('0x44')]+_0x490eda)},'json':!![]});}})[_0x0d8b('0x2f')](function(_0x1e162c){if(_0x1e162c[_0x0d8b('0x27')]){return BPromise['resolve'](_0x1e162c[_0x0d8b('0x28')]);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x374d40['id']));}})[_0x0d8b('0x36')](function(_0x113fb7){var _0x3f943a=_0x113fb7[_0x0d8b('0x2b')]||0x1f4;logger['error'](_0x0d8b('0x2c'),_0x0d8b('0x45'),_0x3f943a,JSON[_0x0d8b('0x26')](_0x113fb7));});}function request(_0x241587){logger[_0x0d8b('0x19')]('[HTTP]',JSON['stringify'](_0x241587));return rp(_0x241587);}exports['queue']=function(_0x573f4f,_0x368ede,_0xf22c3c,_0x5e3bb4,_0x4950a8,_0x44c5c1){var _0x3d3cb6,_0x5c5bd7,_0x5ef6c3,_0x900906;_0x44c5c1[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x44c5c1[_0x0d8b('0x21')]);if(_0x4950a8&&_0x4950a8[_0x0d8b('0x47')]){logger['info'](_0x0d8b('0x48'),_0x0d8b('0x49'));_0x368ede['recordingURL']=util['format'](_0x0d8b('0x4a'),_0x44c5c1[_0x0d8b('0x4b')],_0x368ede['uniqueid'],md5(_0x368ede['uniqueid']));}else{_0x368ede[_0x0d8b('0x4c')]='';}return getConnection(_0x44c5c1)[_0x0d8b('0x2f')](function(_0x377027){_0x900906=_0x377027;return getUser(_0x44c5c1,_0x5e3bb4[_0x0d8b('0x4d')],_0x900906);})['then'](function(_0x356b3d){_0x3d3cb6=_0x356b3d;logger['info']('The\x20User\x20ID\x20is:',_0x3d3cb6['id']);return getEndUser(_0x44c5c1,_0x368ede[_0x0d8b('0x4e')],_0x368ede[_0x0d8b('0x4f')],_0x900906);})['then'](function(_0x4a8f33){_0x5c5bd7=_0x4a8f33;logger[_0x0d8b('0x19')](_0x0d8b('0x50'),_0x5c5bd7['id']);return createTicket(_0x44c5c1,_0x3d3cb6,_0x5c5bd7,_0xf22c3c,_0x368ede,_0xf22c3c[_0x0d8b('0x51')],_0x900906);})[_0x0d8b('0x2f')](function(_0x3afc3a){_0x5ef6c3=_0x3afc3a;logger[_0x0d8b('0x19')](_0x0d8b('0x52'));logger[_0x0d8b('0x19')]('The\x20Ticket\x20ID\x20is:',_0x5ef6c3['id']);var _0x24a859=util[_0x0d8b('0x1f')](_0x0d8b('0x53'),_0x44c5c1[_0x0d8b('0x21')],_[_0x0d8b('0x54')](_0x5ef6c3['id'],'x')[0x1]);logger[_0x0d8b('0x19')](_0x0d8b('0x48'),_0x0d8b('0x55'));emit(util[_0x0d8b('0x1f')]('user:%s',_0x5e3bb4[_0x0d8b('0x17')]),_0x0d8b('0x56'),{'uri':_0x24a859});})[_0x0d8b('0x36')](function(_0x23de9e){logger[_0x0d8b('0x2a')]('[QUEUE]',JSON[_0x0d8b('0x26')](_0x23de9e));});};exports[_0x0d8b('0x57')]=function(_0x181d49,_0x17a87f,_0x1d6cd4,_0x59ada2,_0x4d0e7c,_0x3b1166,_0x291b83){var _0x3e4a41,_0xbbb520,_0x5a70bd,_0x199122;_0x3b1166[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x3b1166['remoteUri']);_0x3b1166[_0x0d8b('0x4b')]=intUtil['stripTrailingSlash'](_0x3b1166[_0x0d8b('0x4b')]);if(_0x291b83&&_0x291b83[_0x0d8b('0x58')]&&_0x291b83[_0x0d8b('0x58')]!==_0x0d8b('0x59')){logger[_0x0d8b('0x19')](_0x0d8b('0x5a'),'Recording\x20is\x20enabled!');_0x17a87f[_0x0d8b('0x4c')]=util['format'](_0x0d8b('0x4a'),_0x3b1166[_0x0d8b('0x4b')],_0x17a87f[_0x0d8b('0x5b')],md5(_0x17a87f[_0x0d8b('0x5b')]));}return getConnection(_0x3b1166)['then'](function(_0x19e097){_0x199122=_0x19e097;return getUser(_0x3b1166,_0x59ada2[_0x0d8b('0x4d')],_0x199122);})[_0x0d8b('0x2f')](function(_0x2332fc){_0x3e4a41=_0x2332fc;logger[_0x0d8b('0x19')](_0x0d8b('0x5c'),_0x3e4a41['id']);return getEndUser(_0x3b1166,_0x17a87f[_0x0d8b('0x5d')],_0x17a87f[_0x0d8b('0x5e')],_0x199122);})[_0x0d8b('0x2f')](function(_0x34affb){_0xbbb520=_0x34affb;logger['info']('The\x20Enduser\x20ID\x20is:',_0xbbb520['id']);return createTicket(_0x3b1166,_0x3e4a41,_0xbbb520,_0x1d6cd4,_0x17a87f,_0x1d6cd4[_0x0d8b('0x51')],_0x199122);})[_0x0d8b('0x2f')](function(_0x53e399){_0x5a70bd=_0x53e399;logger[_0x0d8b('0x19')]('Ticket\x20created!');logger['info'](_0x0d8b('0x5f'),_0x5a70bd['id']);var _0x1c4e96=util['format']('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x3b1166[_0x0d8b('0x21')],_[_0x0d8b('0x54')](_0x5a70bd['id'],'x')[0x1]);logger[_0x0d8b('0x19')](_0x0d8b('0x5a'),_0x0d8b('0x55'));emit(util[_0x0d8b('0x1f')](_0x0d8b('0x60'),_0x59ada2['name']),_0x0d8b('0x56'),{'uri':_0x1c4e96});})['catch'](function(_0x1a203e){logger[_0x0d8b('0x2a')](_0x0d8b('0x5a'),JSON[_0x0d8b('0x26')](_0x1a203e));});};exports['unmanaged']=function(_0x3fe47d,_0x4a1c4a,_0x3a356b,_0x2c6c5f,_0x1c5fe2,_0x2ebea3){var _0xc5c35f,_0x2b44e5,_0x3e927c,_0x91aa89;_0x2ebea3[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x2ebea3['remoteUri']);_0x2ebea3[_0x0d8b('0x4b')]=intUtil['stripTrailingSlash'](_0x2ebea3[_0x0d8b('0x4b')]);if(_0x1c5fe2&&_0x1c5fe2[_0x0d8b('0x47')]){logger['info']('['+_0x4a1c4a[_0x0d8b('0x61')]['toUpperCase']()+']',_0x0d8b('0x49'));_0x4a1c4a[_0x0d8b('0x4c')]=util[_0x0d8b('0x1f')](_0x0d8b('0x4a'),_0x2ebea3[_0x0d8b('0x4b')],_0x4a1c4a[_0x0d8b('0x5b')],md5(_0x4a1c4a[_0x0d8b('0x5b')]));}else{_0x4a1c4a[_0x0d8b('0x4c')]='';}return getConnection(_0x2ebea3)['then'](function(_0x10eca6){_0x91aa89=_0x10eca6;return getUser(_0x2ebea3,'',_0x91aa89);})[_0x0d8b('0x2f')](function(_0x5b2916){_0xc5c35f=_0x5b2916;logger[_0x0d8b('0x19')](_0x0d8b('0x5c'),_0xc5c35f['id']);return getEndUser(_0x2ebea3,_0x4a1c4a[_0x0d8b('0x4e')],_0x4a1c4a[_0x0d8b('0x4f')],_0x91aa89);})[_0x0d8b('0x2f')](function(_0x9e44b4){_0x2b44e5=_0x9e44b4;logger[_0x0d8b('0x19')](_0x0d8b('0x50'),_0x2b44e5['id']);return createTicket(_0x2ebea3,_0xc5c35f,_0x2b44e5,_0x3a356b,_0x4a1c4a,_0x3a356b[_0x0d8b('0x51')],_0x91aa89);})[_0x0d8b('0x2f')](function(_0xe35028){_0x3e927c=_0xe35028;logger[_0x0d8b('0x19')]('Ticket\x20created!');logger[_0x0d8b('0x19')](_0x0d8b('0x5f'),_0x3e927c['id']);})[_0x0d8b('0x36')](function(_0x58525c){logger['error']('['+_0x4a1c4a[_0x0d8b('0x61')][_0x0d8b('0x62')]()+']',JSON[_0x0d8b('0x26')](_0x58525c));});}; \ No newline at end of file +var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x565d27,_0x21ef33){var _0x5029b2=function(_0x1e92fb){while(--_0x1e92fb){_0x565d27['push'](_0x565d27['shift']());}};_0x5029b2(++_0x21ef33);}(_0x9c44,0x178));var _0x49c4=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x9c44[_0x5d2803];return _0xdcad2c;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index d462961..b8c64d3 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 _0x4a90=['[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','ioredis','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','application/json','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','Tags','name','Subjects','Descriptions','getString','Fields','then','info','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','Agent\x20found!','results','agent','format','%s/users/me.json','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Caller\x20-\x20%s','password','%s:%s','authType','token','%s/token:%s','username','Basic\x20%s','toString','debug','[HTTP]','stringify','GET','map','forEach','string','picklist','type','nameField','customField','toLowerCase','content','includes','idField','custom_fields','push','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format'];(function(_0x4e2852,_0x4e825a){var _0x21efa2=function(_0x5643eb){while(--_0x5643eb){_0x4e2852['push'](_0x4e2852['shift']());}};_0x21efa2(++_0x4e825a);}(_0x4a90,0x1d7));var _0x04a9=function(_0x253c38,_0x55ad76){_0x253c38=_0x253c38-0x0;var _0x223336=_0x4a90[_0x253c38];return _0x223336;};'use strict';var _=require(_0x04a9('0x0'));var rp=require('request-promise');var md5=require(_0x04a9('0x1'));var util=require('util');var Redis=require(_0x04a9('0x2'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x04a9('0x3'))(_0x04a9('0x4'));config[_0x04a9('0x5')]=_[_0x04a9('0x6')](config[_0x04a9('0x5')],{'host':_0x04a9('0x7'),'port':0x18eb});var io=require(_0x04a9('0x8'))(new Redis(config[_0x04a9('0x5')]));function emit(_0x57cd5f,_0x93419,_0x36d9df){io['to'](_0x57cd5f)['emit'](_0x93419,_0x36d9df);}var headers={'Content-Type':_0x04a9('0x9'),'Accept':_0x04a9('0x9')};function getTicket(_0x4804a1,_0x34dbb2,_0x4f03ce,_0x4f7b41,_0x175d21){logger['info'](_0x04a9('0xa'));return request({'uri':util['format'](_0x04a9('0xb'),_0x4804a1[_0x04a9('0xc')]),'method':'POST','body':{'ticket':_['merge']({'requester_id':_0x4f03ce['id'],'submitter_id':_0x34dbb2?_0x34dbb2['id']:undefined,'assignee_id':_0x34dbb2?_0x34dbb2['id']:undefined,'tags':getTags(_0x4f7b41[_0x04a9('0xd')],_0x04a9('0xe')),'subject':intUtil['getString'](_0x4f7b41[_0x04a9('0xf')],_0x175d21,'\x20'),'description':intUtil['getString'](_0x4f7b41[_0x04a9('0x10')],_0x175d21,'\x0a'),'comment':{'public':![],'body':intUtil[_0x04a9('0x11')](_0x4f7b41['Descriptions'],_0x175d21,'\x0a')}},getCustomFields(_0x4f7b41[_0x04a9('0x12')],_0x175d21))}})[_0x04a9('0x13')](function(_0x46d0c4){logger[_0x04a9('0x14')](_0x04a9('0x15'));return _0x46d0c4[_0x04a9('0x16')];});}function getUser(_0x44f8ed,_0x5eb1e6){if(intUtil[_0x04a9('0x17')](_0x5eb1e6)){logger[_0x04a9('0x14')](_0x04a9('0x18'),_0x5eb1e6);return request({'uri':util['format'](_0x04a9('0x19'),_0x44f8ed[_0x04a9('0xc')]),'qs':{'query':util['format']('type:user\x20role:agent\x20email:%s',_0x5eb1e6)}})[_0x04a9('0x13')](function(_0x3d371c){if(_0x3d371c['count']){logger['info'](_0x04a9('0x1a'));return _['find'](_0x3d371c[_0x04a9('0x1b')],{'email':_0x5eb1e6,'role':_0x04a9('0x1c')});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x04a9('0x1d')](_0x04a9('0x1e'),_0x44f8ed['remoteUri'])})[_0x04a9('0x13')](function(_0x3f8fcf){logger[_0x04a9('0x14')]('Admin\x20account\x20selected.');return _0x3f8fcf[_0x04a9('0x1f')];});}});}else{logger[_0x04a9('0x14')](_0x04a9('0x20'));return request({'uri':util[_0x04a9('0x1d')](_0x04a9('0x1e'),_0x44f8ed[_0x04a9('0xc')])})[_0x04a9('0x13')](function(_0x48ddd2){logger['info'](_0x04a9('0x21'));return _0x48ddd2[_0x04a9('0x1f')];});}}function getEndUser(_0x2e534e,_0x21a8f5,_0x55dcf3){logger[_0x04a9('0x14')](_0x04a9('0x22'),_0x55dcf3);return request({'uri':util['format'](_0x04a9('0x19'),_0x2e534e[_0x04a9('0xc')]),'qs':{'query':util[_0x04a9('0x1d')](_0x04a9('0x23'),_0x55dcf3)}})['then'](function(_0xf106a1){var _0x1f7802;if(_0xf106a1[_0x04a9('0x1b')][_0x04a9('0x24')]){_0xf106a1['results']=_[_0x04a9('0x25')](_0xf106a1[_0x04a9('0x1b')],{'suspended':![],'role':_0x04a9('0x26')});if(_0xf106a1[_0x04a9('0x1b')][_0x04a9('0x24')]){_0x1f7802=_['first'](_0xf106a1[_0x04a9('0x1b')]);}}if(_0x1f7802){logger[_0x04a9('0x14')]('Enduser\x20found!');return _0x1f7802;}else{logger[_0x04a9('0x14')](_0x04a9('0x27'));return request({'uri':util['format']('%s/users.json',_0x2e534e['remoteUri']),'method':_0x04a9('0x28'),'body':{'user':{'role':_0x04a9('0x26'),'name':util[_0x04a9('0x1d')](_0x04a9('0x29'),_0x21a8f5||_0x55dcf3),'phone':_0x55dcf3}}})['then'](function(_0x4eedcd){logger[_0x04a9('0x14')]('Enduser\x20created.');return _0x4eedcd[_0x04a9('0x1f')];});}});}function getAuth(_0x598e34){var _0x3c5527;if(_0x598e34['authType']===_0x04a9('0x2a')){_0x3c5527=util[_0x04a9('0x1d')](_0x04a9('0x2b'),_0x598e34['username'],_0x598e34[_0x04a9('0x2a')]);}else if(_0x598e34[_0x04a9('0x2c')]===_0x04a9('0x2d')){_0x3c5527=util[_0x04a9('0x1d')](_0x04a9('0x2e'),_0x598e34[_0x04a9('0x2f')],_0x598e34[_0x04a9('0x2d')]);}return util[_0x04a9('0x1d')](_0x04a9('0x30'),new Buffer(_0x3c5527)[_0x04a9('0x31')]('base64'));}function request(_0x33221b){logger[_0x04a9('0x32')](_0x04a9('0x33'),JSON[_0x04a9('0x34')](_0x33221b));return rp(_[_0x04a9('0x6')](_0x33221b,{'method':_0x04a9('0x35'),'headers':headers,'json':!![]}));}function getTags(_0x58c99e,_0x35cf21){var _0x235001=[];if(_0x58c99e&&_0x58c99e['length']>0x0){_0x235001=_[_0x04a9('0x36')](_0x58c99e,_0x35cf21);}return _0x235001;}function getCustomFields(_0xa96fb4,_0x4a9439){var _0x3182b8=[];var _0xf2f319={'custom_fields':[]};if(_0xa96fb4['length']>0x0){_[_0x04a9('0x37')](_0xa96fb4,function(_0x379ace){if(_['includes']([_0x04a9('0x38'),_0x04a9('0x39')],_0x379ace[_0x04a9('0x3a')])&&_0x379ace[_0x04a9('0x3b')]&&!_0x379ace[_0x04a9('0x3c')]){_0xf2f319[_0x379ace[_0x04a9('0x3b')][_0x04a9('0x3d')]()]=_0x379ace[_0x04a9('0x3e')][_0x04a9('0x31')]();}else if(_[_0x04a9('0x3f')]([_0x04a9('0x38'),_0x04a9('0x39')],_0x379ace['type'])&&_0x379ace[_0x04a9('0x40')]&&_0x379ace[_0x04a9('0x3c')]){_0xf2f319[_0x04a9('0x41')][_0x04a9('0x42')]({'id':_0x379ace[_0x04a9('0x40')],'value':_0x379ace['content']['toString']()});}else if(_0x379ace['type']==='variable'&&_0x379ace['variableName']&&_0x379ace['idField']&&_0x379ace[_0x04a9('0x3c')]){_0x4a9439[_0x379ace[_0x04a9('0x43')]]&&_0xf2f319[_0x04a9('0x41')][_0x04a9('0x42')]({'id':_0x379ace[_0x04a9('0x40')],'value':_0x4a9439[_0x379ace['variableName']][_0x04a9('0x31')]()});}else if(_0x379ace[_0x04a9('0x3a')]===_0x04a9('0x44')&&_0x379ace['Variable']&&_0x379ace[_0x04a9('0x45')]['name']&&_0x379ace[_0x04a9('0x40')]&&_0x379ace['customField']){_0x4a9439[_0x379ace['Variable'][_0x04a9('0xe')][_0x04a9('0x3d')]()]&&_0xf2f319[_0x04a9('0x41')][_0x04a9('0x42')]({'id':_0x379ace[_0x04a9('0x40')],'value':_0x4a9439[_0x379ace['Variable'][_0x04a9('0xe')][_0x04a9('0x3d')]()][_0x04a9('0x31')]()});}});}return _0xf2f319;}exports[_0x04a9('0x46')]=function(_0x249588,_0x7cb0c6,_0x377738,_0x49ee8b,_0x5cd565,_0x32db7d){var _0x29105f,_0x59a577;_0x32db7d['remoteUri']=intUtil[_0x04a9('0x47')](_0x32db7d[_0x04a9('0xc')]);_0x32db7d[_0x04a9('0x48')]=intUtil[_0x04a9('0x47')](_0x32db7d[_0x04a9('0x48')]);if(_0x5cd565&&_0x5cd565[_0x04a9('0x49')]){logger[_0x04a9('0x14')](_0x04a9('0x4a'),_0x04a9('0x4b'));_0x7cb0c6['recordingURL']=util[_0x04a9('0x1d')](_0x04a9('0x4c'),_0x32db7d[_0x04a9('0x48')],_0x7cb0c6['uniqueid'],md5(_0x7cb0c6[_0x04a9('0x4d')]));}else{_0x7cb0c6[_0x04a9('0x4e')]='';}headers[_0x04a9('0x4f')]=getAuth(_0x32db7d);return getUser(_0x32db7d,_0x49ee8b[_0x04a9('0x50')])[_0x04a9('0x13')](function(_0x3d1eb1){_0x29105f=_0x3d1eb1;logger[_0x04a9('0x14')](_0x04a9('0x51'),_0x29105f['id']);return getEndUser(_0x32db7d,_0x7cb0c6[_0x04a9('0x52')],_0x7cb0c6[_0x04a9('0x53')]);})[_0x04a9('0x13')](function(_0x26df78){_0x59a577=_0x26df78;logger[_0x04a9('0x14')](_0x04a9('0x54'),_0x59a577['id']);return getTicket(_0x32db7d,_0x29105f,_0x59a577,_0x377738,_0x7cb0c6);})[_0x04a9('0x13')](function(_0x17d129){if(_0x17d129){logger[_0x04a9('0x14')](_0x04a9('0x55'),_0x17d129['id']);switch(_0x32db7d[_0x04a9('0x3a')]){case'integrationTab':logger[_0x04a9('0x14')]('[QUEUE]',_0x04a9('0x56'));return request({'uri':util[_0x04a9('0x1d')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x32db7d[_0x04a9('0xc')],_0x29105f['id'],_0x17d129['id']),'method':_0x04a9('0x28')});case'newTab':logger[_0x04a9('0x14')](_0x04a9('0x4a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x04a9('0x1d')](_0x04a9('0x57'),_0x49ee8b[_0x04a9('0xe')]),_0x04a9('0x58'),{'uri':util[_0x04a9('0x1d')](_0x04a9('0x59'),_0x32db7d[_0x04a9('0xc')][_0x04a9('0x5a')](_0x04a9('0x5b'),''),_0x17d129['id'])});break;default:logger[_0x04a9('0x5c')](_0x04a9('0x4a'),_0x04a9('0x5d'));}}})[_0x04a9('0x5e')](function(_0x20b6d8){logger[_0x04a9('0x5c')](_0x04a9('0x5f'),util[_0x04a9('0x60')](_0x20b6d8,{'showHidden':!![],'depth':null}));});};exports[_0x04a9('0x61')]=function(_0x29eece,_0x445a61,_0x361400,_0x41145d,_0x3d7294,_0x53c668,_0x1e9877){var _0x3eb05a,_0x330097;_0x53c668['remoteUri']=intUtil['stripTrailingSlash'](_0x53c668[_0x04a9('0xc')]);_0x53c668[_0x04a9('0x48')]=intUtil[_0x04a9('0x47')](_0x53c668[_0x04a9('0x48')]);if(_0x1e9877&&_0x1e9877[_0x04a9('0x62')]&&_0x1e9877['recordingFormat']!==_0x04a9('0x63')){logger[_0x04a9('0x14')](_0x04a9('0x64'),_0x04a9('0x4b'));_0x445a61[_0x04a9('0x4e')]=util[_0x04a9('0x1d')](_0x04a9('0x4c'),_0x53c668[_0x04a9('0x48')],_0x445a61[_0x04a9('0x4d')],md5(_0x445a61[_0x04a9('0x4d')]));}headers[_0x04a9('0x4f')]=getAuth(_0x53c668);return getUser(_0x53c668,_0x41145d[_0x04a9('0x50')])[_0x04a9('0x13')](function(_0x4f3e41){_0x3eb05a=_0x4f3e41;logger['info']('The\x20User\x20ID\x20is:',_0x3eb05a['id']);return getEndUser(_0x53c668,_0x445a61[_0x04a9('0x65')],_0x445a61['destcalleridnum']);})[_0x04a9('0x13')](function(_0x36a544){_0x330097=_0x36a544;logger[_0x04a9('0x14')](_0x04a9('0x54'),_0x330097['id']);return getTicket(_0x53c668,_0x3eb05a,_0x330097,_0x361400,_0x445a61);})['then'](function(_0x122083){if(_0x122083){logger[_0x04a9('0x14')](_0x04a9('0x55'),_0x122083['id']);switch(_0x53c668['type']){case _0x04a9('0x66'):logger['info'](_0x04a9('0x64'),_0x04a9('0x56'));return request({'uri':util[_0x04a9('0x1d')](_0x04a9('0x67'),_0x53c668[_0x04a9('0xc')],_0x3eb05a['id'],_0x122083['id']),'method':'POST'});case'newTab':logger[_0x04a9('0x14')](_0x04a9('0x64'),_0x04a9('0x68'));emit(util[_0x04a9('0x1d')](_0x04a9('0x57'),_0x41145d[_0x04a9('0xe')]),_0x04a9('0x58'),{'uri':util['format'](_0x04a9('0x59'),_0x53c668['remoteUri'][_0x04a9('0x5a')](_0x04a9('0x5b'),''),_0x122083['id'])});break;default:logger[_0x04a9('0x5c')]('[OUTBOUND]',_0x04a9('0x5d'));}}})[_0x04a9('0x5e')](function(_0x489fff){logger[_0x04a9('0x5c')](_0x04a9('0x69'),util[_0x04a9('0x60')](_0x489fff,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x2bdb1d,_0x3af66c,_0x40881b,_0x40a0da,_0x31953e,_0x4f726b){var _0x3a42c8,_0x39d535;_0x4f726b[_0x04a9('0xc')]=intUtil[_0x04a9('0x47')](_0x4f726b['remoteUri']);_0x4f726b['serverUrl']=intUtil[_0x04a9('0x47')](_0x4f726b[_0x04a9('0x48')]);if(_0x31953e&&_0x31953e[_0x04a9('0x49')]){logger['info']('['+_0x3af66c[_0x04a9('0x6a')][_0x04a9('0x6b')]()+']',_0x04a9('0x4b'));_0x3af66c[_0x04a9('0x4e')]=util[_0x04a9('0x1d')](_0x04a9('0x4c'),_0x4f726b[_0x04a9('0x48')],_0x3af66c[_0x04a9('0x4d')],md5(_0x3af66c['uniqueid']));}else{_0x3af66c[_0x04a9('0x4e')]='';}headers[_0x04a9('0x4f')]=getAuth(_0x4f726b);return getUser(_0x4f726b)[_0x04a9('0x13')](function(_0x52b984){_0x3a42c8=_0x52b984;logger[_0x04a9('0x14')](_0x04a9('0x51'),_0x3a42c8['id']);return getEndUser(_0x4f726b,_0x3af66c[_0x04a9('0x52')],_0x3af66c['calleridnum']);})[_0x04a9('0x13')](function(_0x22a722){_0x39d535=_0x22a722;logger[_0x04a9('0x14')](_0x04a9('0x54'),_0x39d535['id']);return getTicket(_0x4f726b,_0x3a42c8,_0x39d535,_0x40881b,_0x3af66c);})[_0x04a9('0x13')](function(_0x520230){if(_0x520230){logger[_0x04a9('0x14')](_0x04a9('0x55'),_0x520230['id']);}})[_0x04a9('0x5e')](function(_0x21bbfb){logger[_0x04a9('0x5c')]('['+_0x3af66c[_0x04a9('0x6a')][_0x04a9('0x6b')]()+']'+_0x04a9('0x6c'),util[_0x04a9('0x60')](_0x21bbfb,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x0d43=['picklist','type','idField','push','variable','variableName','custom_fields','customVariable','Variable','toLowerCase','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','none','[OUTBOUND]','email','destcalleridnum','newTab','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','calleridname','toUpperCase','lodash','request-promise','md5','util','ioredis','../../../../config/environment','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','format','%s/tickets.json','remoteUri','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','POST','Caller\x20-\x20%s','Enduser\x20created.','password','authType','token','%s/token:%s','username','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','map','includes','nameField','customField','content','string'];(function(_0x112363,_0x34a2bc){var _0x5dcedd=function(_0x53df13){while(--_0x53df13){_0x112363['push'](_0x112363['shift']());}};_0x5dcedd(++_0x34a2bc);}(_0x0d43,0x10f));var _0x30d4=function(_0x4729ea,_0x478433){_0x4729ea=_0x4729ea-0x0;var _0x2a3aef=_0x0d43[_0x4729ea];return _0x2a3aef;};'use strict';var _=require(_0x30d4('0x0'));var rp=require(_0x30d4('0x1'));var md5=require(_0x30d4('0x2'));var util=require(_0x30d4('0x3'));var Redis=require(_0x30d4('0x4'));var intUtil=require('./util');var config=require(_0x30d4('0x5'));var logger=require('../../../../config/logger')(_0x30d4('0x6'));config[_0x30d4('0x7')]=_[_0x30d4('0x8')](config[_0x30d4('0x7')],{'host':_0x30d4('0x9'),'port':0x18eb});var io=require(_0x30d4('0xa'))(new Redis(config['redis']));function emit(_0x589a74,_0x5d49a1,_0x3195d8){io['to'](_0x589a74)[_0x30d4('0xb')](_0x5d49a1,_0x3195d8);}var headers={'Content-Type':_0x30d4('0xc'),'Accept':_0x30d4('0xc')};function getTicket(_0x2b6b45,_0x4469dd,_0x4c35a5,_0x458481,_0x57e9fa){logger[_0x30d4('0xd')]('Creating\x20new\x20ticket...');return request({'uri':util[_0x30d4('0xe')](_0x30d4('0xf'),_0x2b6b45[_0x30d4('0x10')]),'method':'POST','body':{'ticket':_[_0x30d4('0x11')]({'requester_id':_0x4c35a5['id'],'submitter_id':_0x4469dd?_0x4469dd['id']:undefined,'assignee_id':_0x4469dd?_0x4469dd['id']:undefined,'tags':getTags(_0x458481[_0x30d4('0x12')],_0x30d4('0x13')),'subject':intUtil[_0x30d4('0x14')](_0x458481[_0x30d4('0x15')],_0x57e9fa,'\x20'),'description':intUtil[_0x30d4('0x14')](_0x458481[_0x30d4('0x16')],_0x57e9fa,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x458481[_0x30d4('0x16')],_0x57e9fa,'\x0a')}},getCustomFields(_0x458481[_0x30d4('0x17')],_0x57e9fa))}})[_0x30d4('0x18')](function(_0x265f70){logger[_0x30d4('0xd')](_0x30d4('0x19'));return _0x265f70[_0x30d4('0x1a')];});}function getUser(_0x56b7a1,_0x51fd43){if(intUtil[_0x30d4('0x1b')](_0x51fd43)){logger[_0x30d4('0xd')]('Getting\x20agent\x20with\x20email',_0x51fd43);return request({'uri':util[_0x30d4('0xe')](_0x30d4('0x1c'),_0x56b7a1[_0x30d4('0x10')]),'qs':{'query':util['format'](_0x30d4('0x1d'),_0x51fd43)}})[_0x30d4('0x18')](function(_0x3a260a){if(_0x3a260a[_0x30d4('0x1e')]){logger[_0x30d4('0xd')](_0x30d4('0x1f'));return _[_0x30d4('0x20')](_0x3a260a[_0x30d4('0x21')],{'email':_0x51fd43,'role':_0x30d4('0x22')});}else{logger[_0x30d4('0xd')](_0x30d4('0x23'));return request({'uri':util[_0x30d4('0xe')](_0x30d4('0x24'),_0x56b7a1[_0x30d4('0x10')])})[_0x30d4('0x18')](function(_0x40e9ae){logger[_0x30d4('0xd')](_0x30d4('0x25'));return _0x40e9ae[_0x30d4('0x26')];});}});}else{logger['info'](_0x30d4('0x23'));return request({'uri':util['format'](_0x30d4('0x24'),_0x56b7a1['remoteUri'])})['then'](function(_0x294666){logger[_0x30d4('0xd')]('Admin\x20account\x20selected.');return _0x294666[_0x30d4('0x26')];});}}function getEndUser(_0x1afedf,_0x15d67d,_0x35aee7){logger[_0x30d4('0xd')](_0x30d4('0x27'),_0x35aee7);return request({'uri':util[_0x30d4('0xe')]('%s/search.json',_0x1afedf[_0x30d4('0x10')]),'qs':{'query':util[_0x30d4('0xe')]('type:user\x20role:end-user\x20phone:%s',_0x35aee7)}})[_0x30d4('0x18')](function(_0x4f81b9){var _0x5e9120;if(_0x4f81b9[_0x30d4('0x21')][_0x30d4('0x28')]){_0x4f81b9[_0x30d4('0x21')]=_[_0x30d4('0x29')](_0x4f81b9[_0x30d4('0x21')],{'suspended':![],'role':_0x30d4('0x2a')});if(_0x4f81b9[_0x30d4('0x21')][_0x30d4('0x28')]){_0x5e9120=_[_0x30d4('0x2b')](_0x4f81b9['results']);}}if(_0x5e9120){logger['info'](_0x30d4('0x2c'));return _0x5e9120;}else{logger[_0x30d4('0xd')](_0x30d4('0x2d'));return request({'uri':util[_0x30d4('0xe')](_0x30d4('0x2e'),_0x1afedf[_0x30d4('0x10')]),'method':_0x30d4('0x2f'),'body':{'user':{'role':_0x30d4('0x2a'),'name':util[_0x30d4('0xe')](_0x30d4('0x30'),_0x15d67d||_0x35aee7),'phone':_0x35aee7}}})['then'](function(_0x2c088d){logger['info'](_0x30d4('0x31'));return _0x2c088d[_0x30d4('0x26')];});}});}function getAuth(_0x4c9fa0){var _0x5bff8d;if(_0x4c9fa0['authType']===_0x30d4('0x32')){_0x5bff8d=util[_0x30d4('0xe')]('%s:%s',_0x4c9fa0['username'],_0x4c9fa0['password']);}else if(_0x4c9fa0[_0x30d4('0x33')]===_0x30d4('0x34')){_0x5bff8d=util[_0x30d4('0xe')](_0x30d4('0x35'),_0x4c9fa0[_0x30d4('0x36')],_0x4c9fa0[_0x30d4('0x34')]);}return util[_0x30d4('0xe')](_0x30d4('0x37'),new Buffer(_0x5bff8d)[_0x30d4('0x38')](_0x30d4('0x39')));}function request(_0x1ed2fa){logger[_0x30d4('0x3a')](_0x30d4('0x3b'),JSON[_0x30d4('0x3c')](_0x1ed2fa));return rp(_['defaults'](_0x1ed2fa,{'method':_0x30d4('0x3d'),'headers':headers,'json':!![]}));}function getTags(_0x3f6332,_0x2edbf5){var _0x4bf155=[];if(_0x3f6332&&_0x3f6332[_0x30d4('0x28')]>0x0){_0x4bf155=_[_0x30d4('0x3e')](_0x3f6332,_0x2edbf5);}return _0x4bf155;}function getCustomFields(_0x23d80e,_0x5b0f6c){var _0x1549ab=[];var _0xf7a5d6={'custom_fields':[]};if(_0x23d80e[_0x30d4('0x28')]>0x0){_['forEach'](_0x23d80e,function(_0x259a00){if(_[_0x30d4('0x3f')](['string','picklist'],_0x259a00['type'])&&_0x259a00[_0x30d4('0x40')]&&!_0x259a00[_0x30d4('0x41')]){_0xf7a5d6[_0x259a00[_0x30d4('0x40')]['toLowerCase']()]=_0x259a00[_0x30d4('0x42')][_0x30d4('0x38')]();}else if(_[_0x30d4('0x3f')]([_0x30d4('0x43'),_0x30d4('0x44')],_0x259a00[_0x30d4('0x45')])&&_0x259a00[_0x30d4('0x46')]&&_0x259a00['customField']){_0xf7a5d6['custom_fields'][_0x30d4('0x47')]({'id':_0x259a00[_0x30d4('0x46')],'value':_0x259a00['content'][_0x30d4('0x38')]()});}else if(_0x259a00[_0x30d4('0x45')]===_0x30d4('0x48')&&_0x259a00[_0x30d4('0x49')]&&_0x259a00['idField']&&_0x259a00[_0x30d4('0x41')]){_0x5b0f6c[_0x259a00[_0x30d4('0x49')]]&&_0xf7a5d6[_0x30d4('0x4a')]['push']({'id':_0x259a00[_0x30d4('0x46')],'value':_0x5b0f6c[_0x259a00['variableName']][_0x30d4('0x38')]()});}else if(_0x259a00[_0x30d4('0x45')]===_0x30d4('0x4b')&&_0x259a00[_0x30d4('0x4c')]&&_0x259a00['Variable'][_0x30d4('0x13')]&&_0x259a00[_0x30d4('0x46')]&&_0x259a00[_0x30d4('0x41')]){_0x5b0f6c[_0x259a00[_0x30d4('0x4c')][_0x30d4('0x13')][_0x30d4('0x4d')]()]&&_0xf7a5d6[_0x30d4('0x4a')]['push']({'id':_0x259a00[_0x30d4('0x46')],'value':_0x5b0f6c[_0x259a00[_0x30d4('0x4c')]['name'][_0x30d4('0x4d')]()][_0x30d4('0x38')]()});}});}return _0xf7a5d6;}exports['queue']=function(_0x2acdd6,_0x1d1e9f,_0xb627de,_0x33fa95,_0x133959,_0x507b69){var _0x4acf82,_0x5ed298;_0x507b69[_0x30d4('0x10')]=intUtil[_0x30d4('0x4e')](_0x507b69['remoteUri']);_0x507b69[_0x30d4('0x4f')]=intUtil[_0x30d4('0x4e')](_0x507b69[_0x30d4('0x4f')]);if(_0x133959&&_0x133959['monitor_format']){logger[_0x30d4('0xd')](_0x30d4('0x50'),_0x30d4('0x51'));_0x1d1e9f[_0x30d4('0x52')]=util[_0x30d4('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x507b69['serverUrl'],_0x1d1e9f['uniqueid'],md5(_0x1d1e9f[_0x30d4('0x53')]));}else{_0x1d1e9f['recordingURL']='';}headers['Authorization']=getAuth(_0x507b69);return getUser(_0x507b69,_0x33fa95['email'])[_0x30d4('0x18')](function(_0x4394bb){_0x4acf82=_0x4394bb;logger[_0x30d4('0xd')](_0x30d4('0x54'),_0x4acf82['id']);return getEndUser(_0x507b69,_0x1d1e9f['calleridname'],_0x1d1e9f[_0x30d4('0x55')]);})[_0x30d4('0x18')](function(_0x2911c2){_0x5ed298=_0x2911c2;logger['info'](_0x30d4('0x56'),_0x5ed298['id']);return getTicket(_0x507b69,_0x4acf82,_0x5ed298,_0xb627de,_0x1d1e9f);})[_0x30d4('0x18')](function(_0x25d181){if(_0x25d181){logger[_0x30d4('0xd')](_0x30d4('0x57'),_0x25d181['id']);switch(_0x507b69[_0x30d4('0x45')]){case _0x30d4('0x58'):logger[_0x30d4('0xd')](_0x30d4('0x50'),_0x30d4('0x59'));return request({'uri':util['format'](_0x30d4('0x5a'),_0x507b69[_0x30d4('0x10')],_0x4acf82['id'],_0x25d181['id']),'method':_0x30d4('0x2f')});case'newTab':logger[_0x30d4('0xd')]('[QUEUE]',_0x30d4('0x5b'));emit(util[_0x30d4('0xe')](_0x30d4('0x5c'),_0x33fa95[_0x30d4('0x13')]),'trigger:browser:url',{'uri':util[_0x30d4('0xe')](_0x30d4('0x5d'),_0x507b69[_0x30d4('0x10')][_0x30d4('0x5e')](_0x30d4('0x5f'),''),_0x25d181['id'])});break;default:logger[_0x30d4('0x60')]('[QUEUE]',_0x30d4('0x61'));}}})['catch'](function(_0x4cb4e9){logger['error'](_0x30d4('0x62'),util[_0x30d4('0x63')](_0x4cb4e9,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x3e415c,_0x5af412,_0x4c2cc7,_0x33f6d4,_0x1dc5fe,_0x4015f9,_0x18128b){var _0x2dc4c4,_0x12bc6b;_0x4015f9[_0x30d4('0x10')]=intUtil['stripTrailingSlash'](_0x4015f9[_0x30d4('0x10')]);_0x4015f9[_0x30d4('0x4f')]=intUtil[_0x30d4('0x4e')](_0x4015f9[_0x30d4('0x4f')]);if(_0x18128b&&_0x18128b['recordingFormat']&&_0x18128b[_0x30d4('0x64')]!==_0x30d4('0x65')){logger[_0x30d4('0xd')](_0x30d4('0x66'),_0x30d4('0x51'));_0x5af412[_0x30d4('0x52')]=util[_0x30d4('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4015f9[_0x30d4('0x4f')],_0x5af412[_0x30d4('0x53')],md5(_0x5af412[_0x30d4('0x53')]));}headers['Authorization']=getAuth(_0x4015f9);return getUser(_0x4015f9,_0x33f6d4[_0x30d4('0x67')])['then'](function(_0xffe587){_0x2dc4c4=_0xffe587;logger[_0x30d4('0xd')](_0x30d4('0x54'),_0x2dc4c4['id']);return getEndUser(_0x4015f9,_0x5af412['destcalleridname'],_0x5af412[_0x30d4('0x68')]);})[_0x30d4('0x18')](function(_0x466de3){_0x12bc6b=_0x466de3;logger[_0x30d4('0xd')](_0x30d4('0x56'),_0x12bc6b['id']);return getTicket(_0x4015f9,_0x2dc4c4,_0x12bc6b,_0x4c2cc7,_0x5af412);})[_0x30d4('0x18')](function(_0x20a8d0){if(_0x20a8d0){logger[_0x30d4('0xd')](_0x30d4('0x57'),_0x20a8d0['id']);switch(_0x4015f9[_0x30d4('0x45')]){case _0x30d4('0x58'):logger[_0x30d4('0xd')](_0x30d4('0x66'),_0x30d4('0x59'));return request({'uri':util['format'](_0x30d4('0x5a'),_0x4015f9[_0x30d4('0x10')],_0x2dc4c4['id'],_0x20a8d0['id']),'method':_0x30d4('0x2f')});case _0x30d4('0x69'):logger['info'](_0x30d4('0x66'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x30d4('0xe')](_0x30d4('0x5c'),_0x33f6d4[_0x30d4('0x13')]),'trigger:browser:url',{'uri':util[_0x30d4('0xe')](_0x30d4('0x5d'),_0x4015f9['remoteUri'][_0x30d4('0x5e')](_0x30d4('0x5f'),''),_0x20a8d0['id'])});break;default:logger[_0x30d4('0x60')](_0x30d4('0x66'),_0x30d4('0x61'));}}})[_0x30d4('0x6a')](function(_0x4ddda5){logger[_0x30d4('0x60')](_0x30d4('0x6b'),util[_0x30d4('0x63')](_0x4ddda5,{'showHidden':!![],'depth':null}));});};exports[_0x30d4('0x6c')]=function(_0x5699f2,_0x350d6b,_0x418886,_0xea70a4,_0x5ecc35,_0x29bd84){var _0x4f914d,_0x55678c;_0x29bd84[_0x30d4('0x10')]=intUtil['stripTrailingSlash'](_0x29bd84[_0x30d4('0x10')]);_0x29bd84['serverUrl']=intUtil['stripTrailingSlash'](_0x29bd84['serverUrl']);if(_0x5ecc35&&_0x5ecc35['monitor_format']){logger['info']('['+_0x350d6b['lastevent']['toUpperCase']()+']',_0x30d4('0x51'));_0x350d6b[_0x30d4('0x52')]=util[_0x30d4('0xe')](_0x30d4('0x6d'),_0x29bd84[_0x30d4('0x4f')],_0x350d6b[_0x30d4('0x53')],md5(_0x350d6b['uniqueid']));}else{_0x350d6b['recordingURL']='';}headers[_0x30d4('0x6e')]=getAuth(_0x29bd84);return getUser(_0x29bd84)[_0x30d4('0x18')](function(_0xb0b32a){_0x4f914d=_0xb0b32a;logger[_0x30d4('0xd')](_0x30d4('0x54'),_0x4f914d['id']);return getEndUser(_0x29bd84,_0x350d6b[_0x30d4('0x6f')],_0x350d6b[_0x30d4('0x55')]);})['then'](function(_0x18b05b){_0x55678c=_0x18b05b;logger['info']('The\x20Enduser\x20ID\x20is:',_0x55678c['id']);return getTicket(_0x29bd84,_0x4f914d,_0x55678c,_0x418886,_0x350d6b);})['then'](function(_0x5c2c25){if(_0x5c2c25){logger[_0x30d4('0xd')](_0x30d4('0x57'),_0x5c2c25['id']);}})['catch'](function(_0x1247a7){logger['error']('['+_0x350d6b['lastevent'][_0x30d4('0x70')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x30d4('0x63')](_0x1247a7,{'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 f305e04..543a599 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 _0xf2f5=['Contacts','Leads','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','Subject','Subjects','Description','getString','Descriptions','Who_Id','Full_Name','Last_Name','What_Id','First_Name','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','starttime','YYYY-MM-DDTHH:mm:ss','lastevent','called','Call_Result','Answered','rejected','abandoned','timeout','Call_Start_Time','outbound','agentcalledAt','Inbound','merge','Fields','details','err','log','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','/api/voice/recordings/','destcalleridname','destcalleridnum','Outbound','https://crm.','unmanaged','Recording\x20is\x20enabled!','toUpperCase','lodash','md5','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','includes','string','type','idField','content','variable','variableName','toString','Variable','name','toLowerCase','indexOf','isNil','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','refresh_token','seconds','access_token','catch','error','stack','info','Search\x20user','GET','format','then','isArrayLikeObject','users','findIndex','email','Agent\x20found!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','enduserType','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','data','code','SUCCESS','CREATE\x20ERROR','moduleSearch','contact_lead','uri','https://www.zohoapis.'];(function(_0x2c6043,_0x453649){var _0x5a4eb6=function(_0x57c6e1){while(--_0x57c6e1){_0x2c6043['push'](_0x2c6043['shift']());}};_0x5a4eb6(++_0x453649);}(_0xf2f5,0x179));var _0x5f2f=function(_0x25324d,_0x4c1281){_0x25324d=_0x25324d-0x0;var _0x9ddc14=_0xf2f5[_0x25324d];return _0x9ddc14;};'use strict';var _=require(_0x5f2f('0x0'));var rp=require('request-promise');var md5=require(_0x5f2f('0x1'));var util=require('util');var intUtil=require(_0x5f2f('0x2'));var moment=require(_0x5f2f('0x3'));var Redis=require(_0x5f2f('0x4'));var BPromise=require(_0x5f2f('0x5'));var config=require(_0x5f2f('0x6'));var logger=require(_0x5f2f('0x7'))(_0x5f2f('0x8'));config[_0x5f2f('0x9')]=_[_0x5f2f('0xa')](config[_0x5f2f('0x9')],{'host':_0x5f2f('0xb'),'port':0x18eb});var io=require(_0x5f2f('0xc'))(new Redis(config[_0x5f2f('0x9')]));function emit(_0x37c15c,_0x55de4c,_0x27eae9){io['to'](_0x37c15c)[_0x5f2f('0xd')](_0x55de4c,_0x27eae9);}function request(_0x57e876){logger[_0x5f2f('0xe')](_0x5f2f('0xf'),JSON[_0x5f2f('0x10')](_0x57e876));return rp(_0x57e876);}function getCustomFields(_0x32cc75,_0x1261af){var _0xe039b8={};if(_0x32cc75[_0x5f2f('0x11')]>0x0){_[_0x5f2f('0x12')](_0x32cc75,function(_0x1a130c){if(_[_0x5f2f('0x13')]([_0x5f2f('0x14'),'picklist'],_0x1a130c[_0x5f2f('0x15')])&&_0x1a130c[_0x5f2f('0x16')]){_0xe039b8[_0x1a130c[_0x5f2f('0x16')]]=_0x1a130c[_0x5f2f('0x17')]['toString']();}else if(_0x1a130c[_0x5f2f('0x15')]===_0x5f2f('0x18')&&_0x1a130c['variableName']&&_0x1a130c[_0x5f2f('0x16')]&&_0x1261af[_0x1a130c[_0x5f2f('0x19')]]){_0xe039b8[_0x1a130c[_0x5f2f('0x16')]]=_0x1261af[_0x1a130c[_0x5f2f('0x19')]][_0x5f2f('0x1a')]();}else if(_0x1a130c[_0x5f2f('0x15')]==='customVariable'&&_0x1a130c[_0x5f2f('0x1b')]&&_0x1a130c['Variable'][_0x5f2f('0x1c')]&&_0x1a130c['idField']&&_0x1261af[_0x1a130c[_0x5f2f('0x1b')][_0x5f2f('0x1c')][_0x5f2f('0x1d')]()]){_0xe039b8[_0x1a130c['idField']]=_0x1261af[_0x1a130c[_0x5f2f('0x1b')][_0x5f2f('0x1c')][_0x5f2f('0x1d')]()]['toString']();}});}return _0xe039b8;}function getName(_0x56224f){if(_0x56224f[_0x5f2f('0x1e')]('\x20')>0x0){var _0x45279b=_0x56224f['split'](/ (.+)/);if(_0x45279b[0x1]){return _0x45279b;}}return[_0x56224f,_0x56224f];}var accountsTokens={};function getAccessToken(_0x187e87){return new Promise(function(_0xe0082b,_0xf31856){if(!_[_0x5f2f('0x1f')](accountsTokens[_0x187e87['id']])&&!_[_0x5f2f('0x1f')](accountsTokens[_0x187e87['id']]['access_token'])){if(moment()[_0x5f2f('0x20')](accountsTokens[_0x187e87['id']][_0x5f2f('0x21')])){_0xe0082b(accountsTokens[_0x187e87['id']]['access_token']);}}var _0x399fef;switch(_0x187e87[_0x5f2f('0x22')]){case'US':_0x399fef=_0x5f2f('0x23');break;case'AU':_0x399fef='https://accounts.zoho.com.au';break;case'EU':_0x399fef=_0x5f2f('0x24');break;case'IN':_0x399fef=_0x5f2f('0x25');break;case'CN':_0x399fef=_0x5f2f('0x26');break;default:_0x399fef='https://accounts.zoho.eu';break;}var _0x202f7d={'method':_0x5f2f('0x27'),'uri':_0x399fef+_0x5f2f('0x28'),'qs':{'refresh_token':_0x187e87[_0x5f2f('0x29')],'client_id':_0x187e87['clientId'],'client_secret':_0x187e87['clientSecret'],'grant_type':_0x5f2f('0x2a')},'json':!![]};return rp(_0x202f7d)['then'](function(_0x117ff0){accountsTokens[_0x187e87['id']]={'access_token':_0x117ff0['access_token'],'expires_in':moment()['add'](_0x117ff0[_0x5f2f('0x21')],_0x5f2f('0x2b'))};_0xe0082b(_0x117ff0[_0x5f2f('0x2c')]);})[_0x5f2f('0x2d')](function(_0x135881){logger[_0x5f2f('0x2e')]('Failing\x20creating\x20the\x20access_token',_0x135881[_0x5f2f('0x2f')]);_0xf31856(_0x135881);});});}function getUser(_0x2d0ff0,_0x3250c9,_0xa07221,_0x2cf5b4){logger[_0x5f2f('0x30')](_0x5f2f('0x31'));return request({'method':_0x5f2f('0x32'),'uri':util[_0x5f2f('0x33')]('https://www.zohoapis.%s/crm/v2/users',_0x3250c9),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x2d0ff0},'json':!![]})[_0x5f2f('0x34')](function(_0x767e45){if(_0x767e45['users']){var _0x184861=-0x1;if(_[_0x5f2f('0x35')](_0x767e45[_0x5f2f('0x36')])){if(!_[_0x5f2f('0x1f')](_0x2cf5b4)){_0x184861=_[_0x5f2f('0x37')](_0x767e45[_0x5f2f('0x36')],function(_0x55fb8a){return _0x55fb8a[_0x5f2f('0x38')]===_0x2cf5b4;});}if(_0x184861>=0x0){logger[_0x5f2f('0x30')](_0x5f2f('0x39'));}else{logger[_0x5f2f('0x30')]('Using\x20the\x20admin\x20account!');_0x184861=_[_0x5f2f('0x37')](_0x767e45[_0x5f2f('0x36')],function(_0x568da2){return _0x568da2[_0x5f2f('0x3a')][_0x5f2f('0x1c')]===_0x5f2f('0x3b');});}return _0x767e45[_0x5f2f('0x36')][_0x184861];}else{if(_0x767e45[_0x5f2f('0x3c')][_0x5f2f('0x3a')][_0x5f2f('0x1c')]===_0x5f2f('0x3b')){logger[_0x5f2f('0x30')]('Using\x20the\x20admin\x20account!');user=_0x767e45['user'];return user;}else{logger['error'](_0x5f2f('0x3d'),JSON[_0x5f2f('0x10')](_0x767e45));throw new Error(_0x5f2f('0x3e')+JSON['stringify'](_0x767e45));}}}else{logger[_0x5f2f('0x2e')](_0x5f2f('0x3d'),JSON['stringify'](_0x767e45));throw new Error(_0x5f2f('0x3e')+JSON[_0x5f2f('0x10')](_0x767e45));}})[_0x5f2f('0x2d')](function(_0x5ba72a){console[_0x5f2f('0x2e')](_0x5ba72a);});}function getZohoUser(_0x4b5b30,_0x395895){return new BPromise(function(_0x4d7073,_0x517848){request(_0x4b5b30)[_0x5f2f('0x34')](function(_0x3e3bb8){var _0x1c436e=null;if(_0x3e3bb8){_0x1c436e=_0x3e3bb8['data'][0x0];_0x1c436e[_0x5f2f('0x3f')]=_0x395895;}_0x4d7073(_0x1c436e);})[_0x5f2f('0x2d')](function(_0x27b077){_0x517848(_0x27b077);});});}function createEndUser(_0x286967,_0x138d41,_0x18e17b,_0x22092d,_0x469673,_0x54f3de){var _0x18e17b=getName(_0x18e17b);return request({'method':'POST','uri':'https://www.zohoapis.'+_0x138d41+_0x5f2f('0x40')+_[_0x5f2f('0x41')](_0x54f3de[_0x5f2f('0x42')])+'s','body':{'data':[{'Last_Name':_0x18e17b[0x1],'First_Name':_0x18e17b[0x0],'Phone':_0x22092d,'Owner':{'name':!_['isNil'](_0x469673[_0x5f2f('0x43')][_0x5f2f('0x1c')])?_0x469673[_0x5f2f('0x43')]['name']:!_[_0x5f2f('0x1f')](_0x469673[_0x5f2f('0x44')])?_0x469673[_0x5f2f('0x44')]+'\x20'+_0x469673['last_name']:_0x469673[_0x5f2f('0x45')],'id':_0x469673['id']}}]},'headers':{'Authorization':_0x5f2f('0x46')+_0x286967},'json':!![]})[_0x5f2f('0x34')](function(_0x376872){if(_0x376872&&_0x376872[_0x5f2f('0x47')][0x0][_0x5f2f('0x48')]===_0x5f2f('0x49')){var _0x1bf16a=_0x376872[_0x5f2f('0x47')][0x0]['details'];_0x1bf16a['enduserType']=_['startCase'](_0x54f3de['moduleCreate'])+'s';return _0x1bf16a;}logger[_0x5f2f('0x2e')](_0x5f2f('0x3d'),JSON[_0x5f2f('0x10')](data));throw new Error('Error:\x20'+JSON['stringify'](data));})[_0x5f2f('0x2d')](function(_0x485041){console['log'](_0x5f2f('0x4a'),_0x485041);});}function getEndUser(_0x6f7e35,_0x3e342a,_0x43638a,_0x30dc13,_0x26b526,_0x64dd09,_0x1933e4){var _0xd10336={'method':_0x5f2f('0x32'),'uri':'','headers':{'Authorization':_0x5f2f('0x46')+_0x6f7e35},'json':!![]};switch(_0x1933e4[_0x5f2f('0x4b')]){case _0x5f2f('0x4c'):_0xd10336[_0x5f2f('0x4d')]=_0x5f2f('0x4e')+_0x3e342a+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x26b526+'))';return getZohoUser(_0xd10336,_0x5f2f('0x4f'))[_0x5f2f('0x34')](function(_0x1db596){if(_0x1db596)return _0x1db596;_0xd10336[_0x5f2f('0x4d')]=_0x5f2f('0x4e')+_0x3e342a+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x26b526+'))';return getZohoUser(_0xd10336,_0x5f2f('0x50'))[_0x5f2f('0x34')](function(_0x1d0cb2){if(_0x1d0cb2)return _0x1d0cb2;if(_0x1933e4[_0x5f2f('0x42')]!=_0x5f2f('0x51')){return createEndUser(_0x6f7e35,_0x3e342a,_0x30dc13,_0x26b526,_0x64dd09,_0x1933e4);}else{return{};}});});break;case _0x5f2f('0x52'):_0xd10336[_0x5f2f('0x4d')]=_0x5f2f('0x4e')+_0x3e342a+_0x5f2f('0x53')+_0x26b526+'))';return getZohoUser(_0xd10336,_0x5f2f('0x4f'))[_0x5f2f('0x34')](function(_0x47fb2e){if(_0x47fb2e)return _0x47fb2e;if(_0x1933e4[_0x5f2f('0x42')]!='nothing'){return createEndUser(_0x6f7e35,_0x3e342a,_0x30dc13,_0x26b526,_0x64dd09,_0x1933e4);}else{return{};}});break;case _0x5f2f('0x54'):_0xd10336[_0x5f2f('0x4d')]=_0x5f2f('0x4e')+_0x3e342a+_0x5f2f('0x55')+_0x26b526+'))';return getZohoUser(_0xd10336,'Leads')[_0x5f2f('0x34')](function(_0xed422){if(_0xed422)return _0xed422;if(_0x1933e4[_0x5f2f('0x42')]!=_0x5f2f('0x51')){return createEndUser(_0x6f7e35,_0x3e342a,_0x30dc13,_0x26b526,_0x64dd09,_0x1933e4);}else{return{};}});break;}}function getCall(_0x34e1a7,_0x3ffe64,_0x16d599,_0x427586,_0x56c6c1,_0x5a3cb2,_0x67015d,_0x2245ad){logger[_0x5f2f('0x30')](_0x5f2f('0x56'));var _0x788030={};_0x788030[_0x5f2f('0x57')]={'name':!_['isNil'](_0x427586[_0x5f2f('0x43')][_0x5f2f('0x1c')])&&!_[_0x5f2f('0x1f')](_0x427586[_0x5f2f('0x3a')][_0x5f2f('0x1c')])&&_0x427586[_0x5f2f('0x3a')][_0x5f2f('0x1c')]==='administrator'?_0x427586[_0x5f2f('0x43')]['name']:!_[_0x5f2f('0x1f')](_0x427586[_0x5f2f('0x44')])?_0x427586[_0x5f2f('0x44')]+'\x20'+_0x427586[_0x5f2f('0x45')]:_0x427586[_0x5f2f('0x45')],'id':_0x427586['id']};_0x788030[_0x5f2f('0x58')]=intUtil['getString'](_0x5a3cb2[_0x5f2f('0x59')],_0x67015d,'\x20');_0x788030[_0x5f2f('0x5a')]=intUtil[_0x5f2f('0x5b')](_0x5a3cb2[_0x5f2f('0x5c')],_0x67015d,'\x0a');if(_0x56c6c1[_0x5f2f('0x3f')]===_0x5f2f('0x4f')){_0x788030[_0x5f2f('0x5d')]={'name':!_['isNil'](_0x56c6c1[_0x5f2f('0x5e')])?_0x56c6c1[_0x5f2f('0x5e')]:!_['isNil'](_0x56c6c1['First_Name'])?_0x56c6c1['First_Name']+'\x20'+_0x56c6c1[_0x5f2f('0x5f')]:_0x56c6c1[_0x5f2f('0x5f')],'id':_0x56c6c1['id']};}if(_0x56c6c1[_0x5f2f('0x3f')]===_0x5f2f('0x50')){_0x788030[_0x5f2f('0x60')]={'name':!_[_0x5f2f('0x1f')](_0x56c6c1[_0x5f2f('0x5e')])?_0x56c6c1['Full_Name']:!_[_0x5f2f('0x1f')](_0x56c6c1['First_Name'])?_0x56c6c1[_0x5f2f('0x61')]+'\x20'+_0x56c6c1['Last_Name']:_0x56c6c1[_0x5f2f('0x5f')],'id':_0x56c6c1['id']};_0x788030[_0x5f2f('0x62')]=_['startCase'](_0x56c6c1['enduserType']);}if(_0x67015d[_0x5f2f('0x63')]){_0x788030[_0x5f2f('0x64')]=moment[_0x5f2f('0x65')](parseInt(_0x67015d['talktime'])*0x3e8)[_0x5f2f('0x33')](_0x5f2f('0x66'));}else if(_0x67015d[_0x5f2f('0x67')]&&_0x67015d[_0x5f2f('0x68')]){_0x788030[_0x5f2f('0x64')]=moment['utc'](moment(_0x67015d['endtime'],'YYYY-MM-DDTHH:mm:ss')['diff'](moment(_0x67015d[_0x5f2f('0x69')],_0x5f2f('0x6a'))))[_0x5f2f('0x33')](_0x5f2f('0x66'));}switch(_0x67015d[_0x5f2f('0x6b')]){case _0x5f2f('0x6c'):_0x788030[_0x5f2f('0x6d')]='Called';break;case'complete':case'connect':_0x788030[_0x5f2f('0x6d')]=_0x5f2f('0x6e');break;case _0x5f2f('0x6f'):_0x788030[_0x5f2f('0x6d')]='Rejected';break;case _0x5f2f('0x70'):_0x788030['Call_Result']='Abandoned';break;case _0x5f2f('0x71'):_0x788030['Call_Result']='Timeout';default:}_0x788030[_0x5f2f('0x72')]=(_0x2245ad===_0x5f2f('0x73')?moment(_0x67015d[_0x5f2f('0x69')])[_0x5f2f('0x33')](_0x5f2f('0x6a')):moment(_0x67015d[_0x5f2f('0x74')])[_0x5f2f('0x33')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x5f2f('0x33')]('YYYY-MM-DDTHH:mm:ss');_0x788030['Call_Type']=_0x2245ad||_0x5f2f('0x75');_0x788030=_[_0x5f2f('0x76')](_0x788030,getCustomFields(_0x5a3cb2[_0x5f2f('0x77')],_0x67015d));return request({'method':_0x5f2f('0x27'),'uri':'https://www.zohoapis.'+_0x3ffe64+'/crm/v2/Calls','headers':{'Authorization':_0x5f2f('0x46')+_0x34e1a7},'body':{'data':[_0x788030]},'json':!![]})[_0x5f2f('0x34')](function(_0xccbcf4){if(_0xccbcf4&&_0xccbcf4[_0x5f2f('0x47')][0x0][_0x5f2f('0x48')]===_0x5f2f('0x49')){logger[_0x5f2f('0x30')]('Call\x20created!');return{'id':_0xccbcf4[_0x5f2f('0x47')][0x0][_0x5f2f('0x78')]['id']};}})[_0x5f2f('0x2d')](function(_0x43c4e8){logger[_0x5f2f('0x30')](_0x5f2f('0x79'),_0x43c4e8[_0x5f2f('0x2f')]);console[_0x5f2f('0x7a')](_0x5f2f('0x79'),_0x43c4e8);});}exports[_0x5f2f('0x7b')]=function(_0x2bac61,_0xbab5fe,_0x34ccf9,_0x117461,_0x1ca26c,_0x58f38e){var _0x16ea77,_0x2dae06,_0x9d3d88;_0x58f38e[_0x5f2f('0x7c')]=intUtil[_0x5f2f('0x7d')](_0x58f38e[_0x5f2f('0x7c')]);_0x58f38e[_0x5f2f('0x7e')]=intUtil[_0x5f2f('0x7d')](_0x58f38e['serverUrl']);if(_0x1ca26c&&_0x1ca26c[_0x5f2f('0x7f')]){logger[_0x5f2f('0x30')](_0x5f2f('0x80'),'Recording\x20is\x20enabled!');_0xbab5fe[_0x5f2f('0x81')]=_0x58f38e[_0x5f2f('0x7e')]+'/api/voice/recordings/'+_0xbab5fe[_0x5f2f('0x82')]+_0x5f2f('0x83')+md5(_0xbab5fe[_0x5f2f('0x82')]);}else{_0xbab5fe[_0x5f2f('0x81')]='';}var _0x582be9=_0x58f38e[_0x5f2f('0x7c')]===_0x5f2f('0x84')?'eu':_0x5f2f('0x85');return getAccessToken(_0x58f38e)[_0x5f2f('0x34')](function(_0xba287c){_0x9d3d88=_0xba287c;return getUser(_0x9d3d88,_0x582be9,_0x58f38e,_0x117461[_0x5f2f('0x38')]);})[_0x5f2f('0x34')](function(_0x3ba8a3){_0x16ea77=_0x3ba8a3;logger[_0x5f2f('0x30')](_0x5f2f('0x86'),_0x16ea77['id']);return getEndUser(_0x9d3d88,_0x582be9,_0x58f38e,_0xbab5fe[_0x5f2f('0x87')],_0xbab5fe[_0x5f2f('0x88')],_0x16ea77,_0x34ccf9);})[_0x5f2f('0x34')](function(_0x55f0c1){_0x2dae06=_0x55f0c1;return getCall(_0x9d3d88,_0x582be9,_0x58f38e,_0x16ea77,_0x2dae06,_0x34ccf9,_0xbab5fe,'Inbound');})['then'](function(_0xda0b2b){if(_0xda0b2b){logger[_0x5f2f('0x30')](_0x5f2f('0x89'),_0xda0b2b['id']);logger[_0x5f2f('0x30')](_0x5f2f('0x80'),_0x5f2f('0x8a'));emit(util['format'](_0x5f2f('0x8b'),_0x117461[_0x5f2f('0x1c')]),_0x5f2f('0x8c'),{'uri':'https://crm.'+_0x58f38e[_0x5f2f('0x7c')]+_0x5f2f('0x8d')+_0xda0b2b['id']});}})[_0x5f2f('0x2d')](function(_0x456d15){logger[_0x5f2f('0x2e')](_0x5f2f('0x80'),JSON[_0x5f2f('0x10')](_0x456d15));});};exports[_0x5f2f('0x73')]=function(_0x20b812,_0x3ca1e4,_0xd36af7,_0xf493d1,_0x4761d2,_0x43f37a,_0x27f91f){var _0x522429,_0x3f839e,_0xc3b76f;_0x43f37a[_0x5f2f('0x7c')]=intUtil[_0x5f2f('0x7d')](_0x43f37a[_0x5f2f('0x7c')]);_0x43f37a[_0x5f2f('0x7e')]=intUtil[_0x5f2f('0x7d')](_0x43f37a[_0x5f2f('0x7e')]);if(_0x27f91f&&_0x27f91f[_0x5f2f('0x8e')]&&_0x27f91f[_0x5f2f('0x8e')]!==_0x5f2f('0x8f')){logger[_0x5f2f('0x30')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x3ca1e4['recordingURL']=_0x43f37a[_0x5f2f('0x7e')]+_0x5f2f('0x90')+_0x3ca1e4[_0x5f2f('0x82')]+_0x5f2f('0x83')+md5(_0x3ca1e4[_0x5f2f('0x82')]);}var _0x258114=_0x43f37a[_0x5f2f('0x7c')]===_0x5f2f('0x84')?'eu':'com';return getAccessToken(_0x43f37a)[_0x5f2f('0x34')](function(_0x238731){_0xc3b76f=_0x238731;return getUser(_0xc3b76f,_0x258114,_0x43f37a,_0xf493d1[_0x5f2f('0x38')]);})[_0x5f2f('0x34')](function(_0x12353b){_0x522429=_0x12353b;logger[_0x5f2f('0x30')](_0x5f2f('0x86'),_0x522429['id']);return getEndUser(_0xc3b76f,_0x258114,_0x43f37a,_0x3ca1e4[_0x5f2f('0x91')],_0x3ca1e4[_0x5f2f('0x92')],_0x522429,_0xd36af7);})['then'](function(_0x5951bb){_0x3f839e=_0x5951bb;return getCall(_0xc3b76f,_0x258114,_0x43f37a,_0x522429,_0x3f839e,_0xd36af7,_0x3ca1e4,_0x5f2f('0x93'));})[_0x5f2f('0x34')](function(_0x570ea5){if(_0x570ea5){logger[_0x5f2f('0x30')]('The\x20Call\x20ID\x20is:',_0x570ea5['id']);logger[_0x5f2f('0x30')]('[OUTBOUND]',_0x5f2f('0x8a'));emit(util['format'](_0x5f2f('0x8b'),_0xf493d1['name']),'trigger:browser:url',{'uri':_0x5f2f('0x94')+_0x43f37a['host']+_0x5f2f('0x8d')+_0x570ea5['id']});}})[_0x5f2f('0x2d')](function(_0x47aaed){logger[_0x5f2f('0x2e')]('[OUTBOUND]',JSON[_0x5f2f('0x10')](_0x47aaed));});};exports[_0x5f2f('0x95')]=function(_0x4f6e75,_0x3db1c9,_0x47338c,_0x530fd2,_0x1e155f,_0x521ada){var _0x395dc2,_0x4f6e9f,_0x389e02;_0x521ada[_0x5f2f('0x7c')]=intUtil['stripTrailingSlash'](_0x521ada[_0x5f2f('0x7c')]);_0x521ada['serverUrl']=intUtil[_0x5f2f('0x7d')](_0x521ada[_0x5f2f('0x7e')]);if(_0x1e155f&&_0x1e155f['monitor_format']){logger[_0x5f2f('0x30')]('['+_0x3db1c9[_0x5f2f('0x6b')]['toUpperCase']()+']',_0x5f2f('0x96'));_0x3db1c9['recordingURL']=_0x521ada[_0x5f2f('0x7e')]+'/api/voice/recordings/'+_0x3db1c9[_0x5f2f('0x82')]+_0x5f2f('0x83')+md5(_0x3db1c9[_0x5f2f('0x82')]);}else{_0x3db1c9[_0x5f2f('0x81')]='';}var _0x3448de=_0x521ada[_0x5f2f('0x7c')]==='zoho.eu'?'eu':_0x5f2f('0x85');return getAccessToken(_0x521ada)[_0x5f2f('0x34')](function(_0x1941b3){_0x389e02=_0x1941b3;return getUser(_0x389e02,_0x3448de,_0x521ada);})[_0x5f2f('0x34')](function(_0x38e6f5){_0x395dc2=_0x38e6f5;logger[_0x5f2f('0x30')](_0x5f2f('0x86'),_0x395dc2['id']);return getEndUser(_0x389e02,_0x3448de,_0x521ada,_0x3db1c9[_0x5f2f('0x87')],_0x3db1c9['calleridnum'],_0x395dc2,_0x47338c);})[_0x5f2f('0x34')](function(_0x3a7c5b){_0x4f6e9f=_0x3a7c5b;return getCall(_0x389e02,_0x3448de,_0x521ada,_0x395dc2,_0x4f6e9f,_0x47338c,_0x3db1c9,_0x5f2f('0x75'));})[_0x5f2f('0x34')](function(_0x5abc3d){if(_0x5abc3d){logger[_0x5f2f('0x30')](_0x5f2f('0x89'),_0x5abc3d['id']);}})['catch'](function(_0x3dacf3){logger[_0x5f2f('0x2e')]('['+_0x3db1c9[_0x5f2f('0x6b')][_0x5f2f('0x97')]()+']',JSON[_0x5f2f('0x10')](_0x3dacf3));});}; \ No newline at end of file +var _0x9bc7=['nothing','contact','lead','Owner','administrator','getString','Subjects','Description','Descriptions','Full_Name','First_Name','Last_Name','$se_module','Call_Duration','utc','talktime','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','Call_Result','Called','complete','connect','rejected','abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Zoho-oauthtoken\x20','Call\x20created!','details','err','queue','stripTrailingSlash','host','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/downloads?type=uniqueid&token=','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','The\x20Call\x20ID\x20is:','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','none','/api/voice/recordings/','destcalleridnum','Outbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','[OUTBOUND]','toUpperCase','calleridname','request-promise','md5','util','./util','moment','../../../../config/environment','../../../../config/logger','zoho','redis','localhost','socket.io-emitter','debug','[HTTP]','stringify','length','forEach','includes','string','type','idField','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','indexOf','isNil','access_token','expires_in','zone','https://accounts.zoho.eu','https://accounts.zoho.in','/oauth/v2/token','refreshToken','clientSecret','refresh_token','then','add','seconds','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','catch','POST','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','Error:\x20','log','CREATE\x20ERROR','GET','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads'];(function(_0x40f720,_0x578de8){var _0x2e0a99=function(_0x1efaf4){while(--_0x1efaf4){_0x40f720['push'](_0x40f720['shift']());}};_0x2e0a99(++_0x578de8);}(_0x9bc7,0x177));var _0x79bc=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9bc7[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var rp=require(_0x79bc('0x0'));var md5=require(_0x79bc('0x1'));var util=require(_0x79bc('0x2'));var intUtil=require(_0x79bc('0x3'));var moment=require(_0x79bc('0x4'));var Redis=require('ioredis');var BPromise=require('bluebird');var config=require(_0x79bc('0x5'));var logger=require(_0x79bc('0x6'))(_0x79bc('0x7'));config[_0x79bc('0x8')]=_['defaults'](config[_0x79bc('0x8')],{'host':_0x79bc('0x9'),'port':0x18eb});var io=require(_0x79bc('0xa'))(new Redis(config[_0x79bc('0x8')]));function emit(_0x5e6c31,_0xf53466,_0x306a7a){io['to'](_0x5e6c31)['emit'](_0xf53466,_0x306a7a);}function request(_0xb2b68d){logger[_0x79bc('0xb')](_0x79bc('0xc'),JSON[_0x79bc('0xd')](_0xb2b68d));return rp(_0xb2b68d);}function getCustomFields(_0x558ad4,_0x44acca){var _0x1ed4e3={};if(_0x558ad4[_0x79bc('0xe')]>0x0){_[_0x79bc('0xf')](_0x558ad4,function(_0x55aea5){if(_[_0x79bc('0x10')]([_0x79bc('0x11'),'picklist'],_0x55aea5[_0x79bc('0x12')])&&_0x55aea5[_0x79bc('0x13')]){_0x1ed4e3[_0x55aea5['idField']]=_0x55aea5[_0x79bc('0x14')]['toString']();}else if(_0x55aea5[_0x79bc('0x12')]===_0x79bc('0x15')&&_0x55aea5[_0x79bc('0x16')]&&_0x55aea5['idField']&&_0x44acca[_0x55aea5['variableName']]){_0x1ed4e3[_0x55aea5['idField']]=_0x44acca[_0x55aea5['variableName']][_0x79bc('0x17')]();}else if(_0x55aea5[_0x79bc('0x12')]===_0x79bc('0x18')&&_0x55aea5[_0x79bc('0x19')]&&_0x55aea5[_0x79bc('0x19')][_0x79bc('0x1a')]&&_0x55aea5[_0x79bc('0x13')]&&_0x44acca[_0x55aea5[_0x79bc('0x19')][_0x79bc('0x1a')][_0x79bc('0x1b')]()]){_0x1ed4e3[_0x55aea5[_0x79bc('0x13')]]=_0x44acca[_0x55aea5[_0x79bc('0x19')]['name'][_0x79bc('0x1b')]()]['toString']();}});}return _0x1ed4e3;}function getName(_0x5c40a6){if(_0x5c40a6[_0x79bc('0x1c')]('\x20')>0x0){var _0x21202d=_0x5c40a6['split'](/ (.+)/);if(_0x21202d[0x1]){return _0x21202d;}}return[_0x5c40a6,_0x5c40a6];}var accountsTokens={};function getAccessToken(_0x5ece0d){return new Promise(function(_0xa61d86,_0x398286){if(!_['isNil'](accountsTokens[_0x5ece0d['id']])&&!_[_0x79bc('0x1d')](accountsTokens[_0x5ece0d['id']][_0x79bc('0x1e')])){if(moment()['isBefore'](accountsTokens[_0x5ece0d['id']][_0x79bc('0x1f')])){_0xa61d86(accountsTokens[_0x5ece0d['id']]['access_token']);}}var _0x258ff5;switch(_0x5ece0d[_0x79bc('0x20')]){case'US':_0x258ff5='https://accounts.zoho.com';break;case'AU':_0x258ff5='https://accounts.zoho.com.au';break;case'EU':_0x258ff5=_0x79bc('0x21');break;case'IN':_0x258ff5=_0x79bc('0x22');break;case'CN':_0x258ff5='https://accounts.zoho.com.cn';break;default:_0x258ff5=_0x79bc('0x21');break;}var _0x57817e={'method':'POST','uri':_0x258ff5+_0x79bc('0x23'),'qs':{'refresh_token':_0x5ece0d[_0x79bc('0x24')],'client_id':_0x5ece0d['clientId'],'client_secret':_0x5ece0d[_0x79bc('0x25')],'grant_type':_0x79bc('0x26')},'json':!![]};return rp(_0x57817e)[_0x79bc('0x27')](function(_0x103c8c){accountsTokens[_0x5ece0d['id']]={'access_token':_0x103c8c[_0x79bc('0x1e')],'expires_in':moment()[_0x79bc('0x28')](_0x103c8c['expires_in'],_0x79bc('0x29'))};_0xa61d86(_0x103c8c[_0x79bc('0x1e')]);})['catch'](function(_0x4cea57){logger[_0x79bc('0x2a')](_0x79bc('0x2b'),_0x4cea57[_0x79bc('0x2c')]);_0x398286(_0x4cea57);});});}function getUser(_0x1f8685,_0x407fa3,_0x531756,_0x576ec8){logger[_0x79bc('0x2d')](_0x79bc('0x2e'));return request({'method':'GET','uri':util[_0x79bc('0x2f')](_0x79bc('0x30'),_0x407fa3),'qs':{'type':_0x79bc('0x31')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1f8685},'json':!![]})[_0x79bc('0x27')](function(_0x331088){if(_0x331088[_0x79bc('0x32')]){var _0x3cb621=-0x1;if(_[_0x79bc('0x33')](_0x331088['users'])){if(!_[_0x79bc('0x1d')](_0x576ec8)){_0x3cb621=_[_0x79bc('0x34')](_0x331088[_0x79bc('0x32')],function(_0x1e163b){return _0x1e163b[_0x79bc('0x35')]===_0x576ec8;});}if(_0x3cb621>=0x0){logger[_0x79bc('0x2d')](_0x79bc('0x36'));}else{logger[_0x79bc('0x2d')](_0x79bc('0x37'));_0x3cb621=_[_0x79bc('0x34')](_0x331088[_0x79bc('0x32')],function(_0x5d5902){return _0x5d5902[_0x79bc('0x38')]['name']===_0x79bc('0x39');});}return _0x331088[_0x79bc('0x32')][_0x3cb621];}else{if(_0x331088[_0x79bc('0x3a')][_0x79bc('0x38')]['name']==='Administrator'){logger[_0x79bc('0x2d')]('Using\x20the\x20admin\x20account!');user=_0x331088[_0x79bc('0x3a')];return user;}else{logger[_0x79bc('0x2a')](_0x79bc('0x3b'),JSON['stringify'](_0x331088));throw new Error(_0x79bc('0x3c')+JSON['stringify'](_0x331088));}}}else{logger[_0x79bc('0x2a')](_0x79bc('0x3b'),JSON[_0x79bc('0xd')](_0x331088));throw new Error(_0x79bc('0x3c')+JSON[_0x79bc('0xd')](_0x331088));}})['catch'](function(_0x52cd1d){console[_0x79bc('0x2a')](_0x52cd1d);});}function getZohoUser(_0x113f1c,_0x799309){return new BPromise(function(_0xdd06bf,_0x39130e){request(_0x113f1c)[_0x79bc('0x27')](function(_0x307989){var _0x1a822f=null;if(_0x307989){_0x1a822f=_0x307989[_0x79bc('0x3d')][0x0];_0x1a822f[_0x79bc('0x3e')]=_0x799309;}_0xdd06bf(_0x1a822f);})[_0x79bc('0x3f')](function(_0x373b47){_0x39130e(_0x373b47);});});}function createEndUser(_0x2d185f,_0x4423e5,_0x2b8d4d,_0x2ee590,_0xebaab1,_0x4ea803){var _0x2b8d4d=getName(_0x2b8d4d);return request({'method':_0x79bc('0x40'),'uri':_0x79bc('0x41')+_0x4423e5+_0x79bc('0x42')+_[_0x79bc('0x43')](_0x4ea803[_0x79bc('0x44')])+'s','body':{'data':[{'Last_Name':_0x2b8d4d[0x1],'First_Name':_0x2b8d4d[0x0],'Phone':_0x2ee590,'Owner':{'name':!_['isNil'](_0xebaab1[_0x79bc('0x45')]['name'])?_0xebaab1[_0x79bc('0x45')]['name']:!_[_0x79bc('0x1d')](_0xebaab1[_0x79bc('0x46')])?_0xebaab1['first_name']+'\x20'+_0xebaab1[_0x79bc('0x47')]:_0xebaab1[_0x79bc('0x47')],'id':_0xebaab1['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x2d185f},'json':!![]})[_0x79bc('0x27')](function(_0x144af5){if(_0x144af5&&_0x144af5[_0x79bc('0x3d')][0x0][_0x79bc('0x48')]===_0x79bc('0x49')){var _0x4c3c91=_0x144af5[_0x79bc('0x3d')][0x0]['details'];_0x4c3c91[_0x79bc('0x3e')]=_['startCase'](_0x4ea803[_0x79bc('0x44')])+'s';return _0x4c3c91;}logger[_0x79bc('0x2a')](_0x79bc('0x3b'),JSON[_0x79bc('0xd')](data));throw new Error(_0x79bc('0x4a')+JSON[_0x79bc('0xd')](data));})[_0x79bc('0x3f')](function(_0x41271a){console[_0x79bc('0x4b')](_0x79bc('0x4c'),_0x41271a);});}function getEndUser(_0x5acfc1,_0x1e414d,_0x107130,_0x139669,_0x5c2520,_0x53a1c6,_0x13430d){var _0x1431a7={'method':_0x79bc('0x4d'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x5acfc1},'json':!![]};switch(_0x13430d[_0x79bc('0x4e')]){case _0x79bc('0x4f'):_0x1431a7[_0x79bc('0x50')]=_0x79bc('0x41')+_0x1e414d+_0x79bc('0x51')+_0x5c2520+'))';return getZohoUser(_0x1431a7,_0x79bc('0x52'))[_0x79bc('0x27')](function(_0x4fb7a3){if(_0x4fb7a3)return _0x4fb7a3;_0x1431a7[_0x79bc('0x50')]=_0x79bc('0x41')+_0x1e414d+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x5c2520+'))';return getZohoUser(_0x1431a7,_0x79bc('0x53'))['then'](function(_0x412fc9){if(_0x412fc9)return _0x412fc9;if(_0x13430d[_0x79bc('0x44')]!=_0x79bc('0x54')){return createEndUser(_0x5acfc1,_0x1e414d,_0x139669,_0x5c2520,_0x53a1c6,_0x13430d);}else{return{};}});});break;case _0x79bc('0x55'):_0x1431a7[_0x79bc('0x50')]=_0x79bc('0x41')+_0x1e414d+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x5c2520+'))';return getZohoUser(_0x1431a7,_0x79bc('0x52'))['then'](function(_0x23a99e){if(_0x23a99e)return _0x23a99e;if(_0x13430d['moduleCreate']!=_0x79bc('0x54')){return createEndUser(_0x5acfc1,_0x1e414d,_0x139669,_0x5c2520,_0x53a1c6,_0x13430d);}else{return{};}});break;case _0x79bc('0x56'):_0x1431a7[_0x79bc('0x50')]=_0x79bc('0x41')+_0x1e414d+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x5c2520+'))';return getZohoUser(_0x1431a7,'Leads')[_0x79bc('0x27')](function(_0xaded98){if(_0xaded98)return _0xaded98;if(_0x13430d[_0x79bc('0x44')]!=_0x79bc('0x54')){return createEndUser(_0x5acfc1,_0x1e414d,_0x139669,_0x5c2520,_0x53a1c6,_0x13430d);}else{return{};}});break;}}function getCall(_0x217feb,_0x383ab1,_0x18cbc9,_0x1a2309,_0x15df5a,_0x565e7c,_0x5d2d95,_0x582646){logger[_0x79bc('0x2d')]('Creating\x20new\x20call...');var _0xaaf4aa={};_0xaaf4aa[_0x79bc('0x57')]={'name':!_[_0x79bc('0x1d')](_0x1a2309['role']['name'])&&!_['isNil'](_0x1a2309['profile'][_0x79bc('0x1a')])&&_0x1a2309[_0x79bc('0x38')][_0x79bc('0x1a')]===_0x79bc('0x58')?_0x1a2309['role'][_0x79bc('0x1a')]:!_[_0x79bc('0x1d')](_0x1a2309[_0x79bc('0x46')])?_0x1a2309[_0x79bc('0x46')]+'\x20'+_0x1a2309[_0x79bc('0x47')]:_0x1a2309[_0x79bc('0x47')],'id':_0x1a2309['id']};_0xaaf4aa['Subject']=intUtil[_0x79bc('0x59')](_0x565e7c[_0x79bc('0x5a')],_0x5d2d95,'\x20');_0xaaf4aa[_0x79bc('0x5b')]=intUtil[_0x79bc('0x59')](_0x565e7c[_0x79bc('0x5c')],_0x5d2d95,'\x0a');if(_0x15df5a[_0x79bc('0x3e')]===_0x79bc('0x52')){_0xaaf4aa['Who_Id']={'name':!_[_0x79bc('0x1d')](_0x15df5a[_0x79bc('0x5d')])?_0x15df5a['Full_Name']:!_[_0x79bc('0x1d')](_0x15df5a['First_Name'])?_0x15df5a[_0x79bc('0x5e')]+'\x20'+_0x15df5a['Last_Name']:_0x15df5a[_0x79bc('0x5f')],'id':_0x15df5a['id']};}if(_0x15df5a[_0x79bc('0x3e')]===_0x79bc('0x53')){_0xaaf4aa['What_Id']={'name':!_['isNil'](_0x15df5a[_0x79bc('0x5d')])?_0x15df5a['Full_Name']:!_[_0x79bc('0x1d')](_0x15df5a[_0x79bc('0x5e')])?_0x15df5a[_0x79bc('0x5e')]+'\x20'+_0x15df5a['Last_Name']:_0x15df5a[_0x79bc('0x5f')],'id':_0x15df5a['id']};_0xaaf4aa[_0x79bc('0x60')]=_[_0x79bc('0x43')](_0x15df5a[_0x79bc('0x3e')]);}if(_0x5d2d95['talktime']){_0xaaf4aa[_0x79bc('0x61')]=moment[_0x79bc('0x62')](parseInt(_0x5d2d95[_0x79bc('0x63')])*0x3e8)[_0x79bc('0x2f')](_0x79bc('0x64'));}else if(_0x5d2d95[_0x79bc('0x65')]&&_0x5d2d95[_0x79bc('0x66')]){_0xaaf4aa[_0x79bc('0x61')]=moment[_0x79bc('0x62')](moment(_0x5d2d95[_0x79bc('0x66')],_0x79bc('0x67'))[_0x79bc('0x68')](moment(_0x5d2d95[_0x79bc('0x69')],_0x79bc('0x67'))))[_0x79bc('0x2f')]('mm:ss');}switch(_0x5d2d95[_0x79bc('0x6a')]){case'called':_0xaaf4aa[_0x79bc('0x6b')]=_0x79bc('0x6c');break;case _0x79bc('0x6d'):case _0x79bc('0x6e'):_0xaaf4aa[_0x79bc('0x6b')]='Answered';break;case _0x79bc('0x6f'):_0xaaf4aa[_0x79bc('0x6b')]='Rejected';break;case _0x79bc('0x70'):_0xaaf4aa[_0x79bc('0x6b')]='Abandoned';break;case _0x79bc('0x71'):_0xaaf4aa['Call_Result']=_0x79bc('0x72');default:}_0xaaf4aa[_0x79bc('0x73')]=(_0x582646===_0x79bc('0x74')?moment(_0x5d2d95[_0x79bc('0x69')])[_0x79bc('0x2f')](_0x79bc('0x67')):moment(_0x5d2d95[_0x79bc('0x75')])[_0x79bc('0x2f')](_0x79bc('0x67')))||moment()['format'](_0x79bc('0x67'));_0xaaf4aa[_0x79bc('0x76')]=_0x582646||_0x79bc('0x77');_0xaaf4aa=_[_0x79bc('0x78')](_0xaaf4aa,getCustomFields(_0x565e7c[_0x79bc('0x79')],_0x5d2d95));return request({'method':_0x79bc('0x40'),'uri':_0x79bc('0x41')+_0x383ab1+_0x79bc('0x7a'),'headers':{'Authorization':_0x79bc('0x7b')+_0x217feb},'body':{'data':[_0xaaf4aa]},'json':!![]})[_0x79bc('0x27')](function(_0x2df129){if(_0x2df129&&_0x2df129[_0x79bc('0x3d')][0x0][_0x79bc('0x48')]===_0x79bc('0x49')){logger[_0x79bc('0x2d')](_0x79bc('0x7c'));return{'id':_0x2df129[_0x79bc('0x3d')][0x0][_0x79bc('0x7d')]['id']};}})['catch'](function(_0x2a3f84){logger[_0x79bc('0x2d')](_0x79bc('0x7e'),_0x2a3f84[_0x79bc('0x2c')]);console[_0x79bc('0x4b')]('err',_0x2a3f84);});}exports[_0x79bc('0x7f')]=function(_0x527751,_0x1d91cb,_0x1baca0,_0x21801e,_0x3adb6a,_0x5bf046){var _0x2729e4,_0x9dd65b,_0x39953d;_0x5bf046['host']=intUtil[_0x79bc('0x80')](_0x5bf046[_0x79bc('0x81')]);_0x5bf046['serverUrl']=intUtil['stripTrailingSlash'](_0x5bf046[_0x79bc('0x82')]);if(_0x3adb6a&&_0x3adb6a[_0x79bc('0x83')]){logger['info'](_0x79bc('0x84'),_0x79bc('0x85'));_0x1d91cb[_0x79bc('0x86')]=_0x5bf046[_0x79bc('0x82')]+'/api/voice/recordings/'+_0x1d91cb['uniqueid']+_0x79bc('0x87')+md5(_0x1d91cb[_0x79bc('0x88')]);}else{_0x1d91cb['recordingURL']='';}var _0x7d7634=_0x5bf046['host']===_0x79bc('0x89')?'eu':_0x79bc('0x8a');return getAccessToken(_0x5bf046)[_0x79bc('0x27')](function(_0x4ac63b){_0x39953d=_0x4ac63b;return getUser(_0x39953d,_0x7d7634,_0x5bf046,_0x21801e['email']);})[_0x79bc('0x27')](function(_0x23c135){_0x2729e4=_0x23c135;logger[_0x79bc('0x2d')](_0x79bc('0x8b'),_0x2729e4['id']);return getEndUser(_0x39953d,_0x7d7634,_0x5bf046,_0x1d91cb['calleridname'],_0x1d91cb['calleridnum'],_0x2729e4,_0x1baca0);})[_0x79bc('0x27')](function(_0x3ffb85){_0x9dd65b=_0x3ffb85;return getCall(_0x39953d,_0x7d7634,_0x5bf046,_0x2729e4,_0x9dd65b,_0x1baca0,_0x1d91cb,_0x79bc('0x77'));})[_0x79bc('0x27')](function(_0x4c2abd){if(_0x4c2abd){logger[_0x79bc('0x2d')](_0x79bc('0x8c'),_0x4c2abd['id']);logger[_0x79bc('0x2d')](_0x79bc('0x84'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x79bc('0x2f')](_0x79bc('0x8d'),_0x21801e['name']),_0x79bc('0x8e'),{'uri':_0x79bc('0x8f')+_0x5bf046[_0x79bc('0x81')]+_0x79bc('0x90')+_0x4c2abd['id']});}})[_0x79bc('0x3f')](function(_0x550c6a){logger[_0x79bc('0x2a')](_0x79bc('0x84'),JSON[_0x79bc('0xd')](_0x550c6a));});};exports['outbound']=function(_0x7ef3b1,_0x1e5dd1,_0xac9739,_0x20b1cc,_0x4dce5d,_0x1746bd,_0x52f640){var _0x399c98,_0x23f4a3,_0x1b5775;_0x1746bd['host']=intUtil[_0x79bc('0x80')](_0x1746bd[_0x79bc('0x81')]);_0x1746bd[_0x79bc('0x82')]=intUtil[_0x79bc('0x80')](_0x1746bd[_0x79bc('0x82')]);if(_0x52f640&&_0x52f640['recordingFormat']&&_0x52f640['recordingFormat']!==_0x79bc('0x91')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x1e5dd1['recordingURL']=_0x1746bd[_0x79bc('0x82')]+_0x79bc('0x92')+_0x1e5dd1[_0x79bc('0x88')]+_0x79bc('0x87')+md5(_0x1e5dd1[_0x79bc('0x88')]);}var _0x553a80=_0x1746bd[_0x79bc('0x81')]==='zoho.eu'?'eu':_0x79bc('0x8a');return getAccessToken(_0x1746bd)[_0x79bc('0x27')](function(_0x4b7f36){_0x1b5775=_0x4b7f36;return getUser(_0x1b5775,_0x553a80,_0x1746bd,_0x20b1cc[_0x79bc('0x35')]);})[_0x79bc('0x27')](function(_0x10476c){_0x399c98=_0x10476c;logger[_0x79bc('0x2d')](_0x79bc('0x8b'),_0x399c98['id']);return getEndUser(_0x1b5775,_0x553a80,_0x1746bd,_0x1e5dd1['destcalleridname'],_0x1e5dd1[_0x79bc('0x93')],_0x399c98,_0xac9739);})[_0x79bc('0x27')](function(_0x294a51){_0x23f4a3=_0x294a51;return getCall(_0x1b5775,_0x553a80,_0x1746bd,_0x399c98,_0x23f4a3,_0xac9739,_0x1e5dd1,_0x79bc('0x94'));})[_0x79bc('0x27')](function(_0x188989){if(_0x188989){logger['info'](_0x79bc('0x8c'),_0x188989['id']);logger[_0x79bc('0x2d')]('[OUTBOUND]',_0x79bc('0x95'));emit(util[_0x79bc('0x2f')]('user:%s',_0x20b1cc[_0x79bc('0x1a')]),'trigger:browser:url',{'uri':_0x79bc('0x8f')+_0x1746bd[_0x79bc('0x81')]+_0x79bc('0x90')+_0x188989['id']});}})[_0x79bc('0x3f')](function(_0x50c1f6){logger[_0x79bc('0x2a')](_0x79bc('0x96'),JSON[_0x79bc('0xd')](_0x50c1f6));});};exports['unmanaged']=function(_0x1482c5,_0x7987c5,_0x87faed,_0x427158,_0x582e8a,_0x3af9fb){var _0x39b6c3,_0xef5d04,_0x136764;_0x3af9fb[_0x79bc('0x81')]=intUtil[_0x79bc('0x80')](_0x3af9fb['host']);_0x3af9fb[_0x79bc('0x82')]=intUtil['stripTrailingSlash'](_0x3af9fb[_0x79bc('0x82')]);if(_0x582e8a&&_0x582e8a[_0x79bc('0x83')]){logger[_0x79bc('0x2d')]('['+_0x7987c5['lastevent'][_0x79bc('0x97')]()+']',_0x79bc('0x85'));_0x7987c5[_0x79bc('0x86')]=_0x3af9fb[_0x79bc('0x82')]+'/api/voice/recordings/'+_0x7987c5[_0x79bc('0x88')]+'/downloads?type=uniqueid&token='+md5(_0x7987c5[_0x79bc('0x88')]);}else{_0x7987c5['recordingURL']='';}var _0xd81ac5=_0x3af9fb['host']===_0x79bc('0x89')?'eu':_0x79bc('0x8a');return getAccessToken(_0x3af9fb)[_0x79bc('0x27')](function(_0x4dffb3){_0x136764=_0x4dffb3;return getUser(_0x136764,_0xd81ac5,_0x3af9fb);})[_0x79bc('0x27')](function(_0x24f32a){_0x39b6c3=_0x24f32a;logger[_0x79bc('0x2d')](_0x79bc('0x8b'),_0x39b6c3['id']);return getEndUser(_0x136764,_0xd81ac5,_0x3af9fb,_0x7987c5[_0x79bc('0x98')],_0x7987c5['calleridnum'],_0x39b6c3,_0x87faed);})[_0x79bc('0x27')](function(_0x952792){_0xef5d04=_0x952792;return getCall(_0x136764,_0xd81ac5,_0x3af9fb,_0x39b6c3,_0xef5d04,_0x87faed,_0x7987c5,'Inbound');})[_0x79bc('0x27')](function(_0x437b94){if(_0x437b94){logger[_0x79bc('0x2d')](_0x79bc('0x8c'),_0x437b94['id']);}})[_0x79bc('0x3f')](function(_0x476c92){logger[_0x79bc('0x2a')]('['+_0x7987c5[_0x79bc('0x6a')][_0x79bc('0x97')]()+']',JSON[_0x79bc('0xd')](_0x476c92));});}; \ 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 a37f6ff..63bb4e3 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 _0xcd72=['util','mustache','../../../../config/logger','trigger','exec','data2','Script','render','data3','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s'];(function(_0x424e27,_0x28164e){var _0xaf8319=function(_0x17e919){while(--_0x17e919){_0x424e27['push'](_0x424e27['shift']());}};_0xaf8319(++_0x28164e);}(_0xcd72,0x180));var _0x2cd7=function(_0x3b5ad9,_0x223867){_0x3b5ad9=_0x3b5ad9-0x0;var _0x611ae9=_0xcd72[_0x3b5ad9];return _0x611ae9;};'use strict';var util=require(_0x2cd7('0x0'));var sh=require('shelljs');var Mustache=require(_0x2cd7('0x1'));var logger=require(_0x2cd7('0x2'))(_0x2cd7('0x3'));exports[_0x2cd7('0x4')]=function(_0x24b374,_0xfe005d){var _0x5d42a2=_0x24b374[_0x2cd7('0x5')]?_0x24b374[_0x2cd7('0x5')]:_0x2cd7('0x6');var _0x13af31=_0x24b374['data3']?Mustache[_0x2cd7('0x7')](_0x24b374[_0x2cd7('0x8')],_0xfe005d):_0xfe005d;sh[_0x2cd7('0x4')](_0x13af31,function(_0x4453dc,_0x284ea5,_0x32f21a){if(_0x4453dc!==0x0){logger['error'](util['format'](_0x2cd7('0x9'),_0x5d42a2,_0x13af31,_0x4453dc,_0x32f21a));}else{logger[_0x2cd7('0xa')](util['format'](_0x2cd7('0xb'),_0x5d42a2,_0x13af31,_0x284ea5));}});}; \ No newline at end of file +var _0x63d7=['%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','mustache','trigger','exec','data2','Script','data3','render','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info'];(function(_0x24e816,_0x1df0e3){var _0x36a6de=function(_0x4e94d0){while(--_0x4e94d0){_0x24e816['push'](_0x24e816['shift']());}};_0x36a6de(++_0x1df0e3);}(_0x63d7,0x12a));var _0x763d=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x63d7[_0x17d9e3];return _0x14192d;};'use strict';var util=require('util');var sh=require('shelljs');var Mustache=require(_0x763d('0x0'));var logger=require('../../../../config/logger')(_0x763d('0x1'));exports[_0x763d('0x2')]=function(_0x51f5d5,_0x452bf6){var _0x188b76=_0x51f5d5['data2']?_0x51f5d5[_0x763d('0x3')]:_0x763d('0x4');var _0x446d33=_0x51f5d5[_0x763d('0x5')]?Mustache[_0x763d('0x6')](_0x51f5d5[_0x763d('0x5')],_0x452bf6):_0x452bf6;sh['exec'](_0x446d33,function(_0x417b95,_0x22b3a0,_0x3795cb){if(_0x417b95!==0x0){logger['error'](util[_0x763d('0x7')](_0x763d('0x8'),_0x188b76,_0x446d33,_0x417b95,_0x3795cb));}else{logger[_0x763d('0x9')](util[_0x763d('0x7')](_0x763d('0xa'),_0x188b76,_0x446d33,_0x22b3a0));}});}; \ 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 4d473dc..1599938 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 _0x0570=['info','then','isNil',',\x20request\x20body:\x20','object','stringify','format','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','util','lodash','mustache','../../../../config/logger','toUpperCase','render','data2','data5','number','headers','data6','parse','error','stack','data1','GET','DELETE','POST','data7','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','body'];(function(_0x3e6ff9,_0x15f2e9){var _0x27e5b8=function(_0x2c3269){while(--_0x2c3269){_0x3e6ff9['push'](_0x3e6ff9['shift']());}};_0x27e5b8(++_0x15f2e9);}(_0x0570,0x1ab));var _0x0057=function(_0x588370,_0x40e2d6){_0x588370=_0x588370-0x0;var _0x285cd3=_0x0570[_0x588370];return _0x285cd3;};'use strict';var rp=require('request-promise');var util=require(_0x0057('0x0'));var _=require(_0x0057('0x1'));var Mustache=require(_0x0057('0x2'));var logger=require(_0x0057('0x3'))('trigger');exports['exec']=function(_0x446893,_0x516157){var _0x3d8711,_0x33d3e6;var _0x3bcd60={'method':_0x446893['data1'][_0x0057('0x4')](),'uri':Mustache[_0x0057('0x5')](_0x446893[_0x0057('0x6')],_0x516157),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x446893[_0x0057('0x7')])===_0x0057('0x8')&&parseInt(_0x446893[_0x0057('0x7')])>=0x1&&parseInt(_0x446893[_0x0057('0x7')])<=0xa?parseInt(_0x446893['data5'])*0x3e8:0x5*0x3e8};try{_0x3bcd60[_0x0057('0x9')]=_0x446893[_0x0057('0xa')]?JSON[_0x0057('0xb')](Mustache[_0x0057('0x5')](_0x446893[_0x0057('0xa')],_0x516157)):{};}catch(_0x5c402f){logger[_0x0057('0xc')](_0x5c402f[_0x0057('0xd')]);}switch(_0x446893[_0x0057('0xe')][_0x0057('0x4')]()){case _0x0057('0xf'):case _0x0057('0x10'):_0x3d8711=null;_0x3bcd60['qs']=_0x516157;break;case _0x0057('0x11'):case'PUT':if(_0x446893[_0x0057('0x12')]){try{_0x3d8711=JSON[_0x0057('0xb')](Mustache[_0x0057('0x5')](_0x446893[_0x0057('0x12')],_0x516157));_0x3bcd60['body']=_0x3d8711;}catch(_0x3751d2){logger['error'](_0x3751d2[_0x0057('0xd')]);logger[_0x0057('0xc')](_0x0057('0x13'));}}else{_0x3d8711=_0x516157;_0x3bcd60[_0x0057('0x14')]=_0x3d8711;}break;}logger[_0x0057('0x15')](util['format']('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x446893['data1'],_0x446893[_0x0057('0x6')],JSON['stringify'](_0x3bcd60)));rp(_0x3bcd60)[_0x0057('0x16')](function(_0x540776){_0x3d8711=!_[_0x0057('0x17')](_0x3d8711)?_0x0057('0x18')+_0x3d8711:'';_0x33d3e6=typeof _0x540776['body']===_0x0057('0x19')?JSON[_0x0057('0x1a')](_0x540776[_0x0057('0x14')]):_0x540776[_0x0057('0x14')];logger[_0x0057('0x15')](util[_0x0057('0x1b')](_0x0057('0x1c'),_0x446893[_0x0057('0xe')],_0x446893['data2'],_0x540776[_0x0057('0x1d')],_0x33d3e6));})['catch'](function(_0x936128){logger[_0x0057('0xc')](util[_0x0057('0x1b')](_0x0057('0x1e'),_0x446893[_0x0057('0xe')],_0x446893[_0x0057('0x6')],_0x936128[_0x0057('0x1d')],_0x936128[_0x0057('0x1f')],_0x936128['message']));});}; \ No newline at end of file +var _0x618e=['DELETE','POST','PUT','data7','stack','body','info','then',',\x20request\x20body:\x20','object','stringify','format','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','trigger','exec','data1','toUpperCase','render','data2','data5','number','data6','parse','error','GET'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x618e,0x71));var _0xe618=function(_0xcde2ee,_0x4d32cc){_0xcde2ee=_0xcde2ee-0x0;var _0x6eb7b2=_0x618e[_0xcde2ee];return _0x6eb7b2;};'use strict';var rp=require(_0xe618('0x0'));var util=require(_0xe618('0x1'));var _=require(_0xe618('0x2'));var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0xe618('0x3'));exports[_0xe618('0x4')]=function(_0x4a717d,_0x3657d6){var _0x124675,_0x419a14;var _0x5bf119={'method':_0x4a717d[_0xe618('0x5')][_0xe618('0x6')](),'uri':Mustache[_0xe618('0x7')](_0x4a717d[_0xe618('0x8')],_0x3657d6),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x4a717d[_0xe618('0x9')])===_0xe618('0xa')&&parseInt(_0x4a717d[_0xe618('0x9')])>=0x1&&parseInt(_0x4a717d[_0xe618('0x9')])<=0xa?parseInt(_0x4a717d[_0xe618('0x9')])*0x3e8:0x5*0x3e8};try{_0x5bf119['headers']=_0x4a717d[_0xe618('0xb')]?JSON[_0xe618('0xc')](Mustache[_0xe618('0x7')](_0x4a717d[_0xe618('0xb')],_0x3657d6)):{};}catch(_0x1235c1){logger[_0xe618('0xd')](_0x1235c1['stack']);}switch(_0x4a717d['data1'][_0xe618('0x6')]()){case _0xe618('0xe'):case _0xe618('0xf'):_0x124675=null;_0x5bf119['qs']=_0x3657d6;break;case _0xe618('0x10'):case _0xe618('0x11'):if(_0x4a717d[_0xe618('0x12')]){try{_0x124675=JSON[_0xe618('0xc')](Mustache['render'](_0x4a717d[_0xe618('0x12')],_0x3657d6));_0x5bf119['body']=_0x124675;}catch(_0x1c5dc2){logger[_0xe618('0xd')](_0x1c5dc2[_0xe618('0x13')]);logger[_0xe618('0xd')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x124675=_0x3657d6;_0x5bf119[_0xe618('0x14')]=_0x124675;}break;}logger[_0xe618('0x15')](util['format']('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x4a717d[_0xe618('0x5')],_0x4a717d[_0xe618('0x8')],JSON['stringify'](_0x5bf119)));rp(_0x5bf119)[_0xe618('0x16')](function(_0x4af3c2){_0x124675=!_['isNil'](_0x124675)?_0xe618('0x17')+_0x124675:'';_0x419a14=typeof _0x4af3c2[_0xe618('0x14')]===_0xe618('0x18')?JSON[_0xe618('0x19')](_0x4af3c2[_0xe618('0x14')]):_0x4af3c2['body'];logger['info'](util[_0xe618('0x1a')](_0xe618('0x1b'),_0x4a717d[_0xe618('0x5')],_0x4a717d[_0xe618('0x8')],_0x4af3c2['statusCode'],_0x419a14));})[_0xe618('0x1c')](function(_0x24d838){logger[_0xe618('0xd')](util[_0xe618('0x1a')](_0xe618('0x1d'),_0x4a717d[_0xe618('0x5')],_0x4a717d['data2'],_0x24d838['statusCode'],_0x24d838[_0xe618('0x1e')],_0x24d838[_0xe618('0x1f')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index f1fc478..d0e98f1 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 _0xba4d=['exports','jayson/promise','bluebird','../../config/logger','then','rpc','error','routing','message','result','catch'];(function(_0x40f109,_0x1fb273){var _0x2c8974=function(_0x2044bc){while(--_0x2044bc){_0x40f109['push'](_0x40f109['shift']());}};_0x2c8974(++_0x1fb273);}(_0xba4d,0x1da));var _0xdba4=function(_0x152121,_0x120c53){_0x152121=_0x152121-0x0;var _0x592a85=_0xba4d[_0x152121];return _0x592a85;};'use strict';var jayson=require(_0xdba4('0x0'));var BPromise=require(_0xdba4('0x1'));var logger=require(_0xdba4('0x2'))('routing');var client=jayson['client']['http']({'port':0x2329});client['Request']=function(_0x3f28f,_0x3bfbcd){return new BPromise(function(_0x463f8c,_0xa3395d){return client['request'](_0x3f28f,_0x3bfbcd)[_0xdba4('0x3')](function(_0x2714e7){logger['debug'](_0xdba4('0x4'),'routing',_0x3f28f,_0x3bfbcd,_0x2714e7);if(_0x2714e7[_0xdba4('0x5')]){logger[_0xdba4('0x5')](_0xdba4('0x4'),_0xdba4('0x6'),_0x3f28f,_0x2714e7['error'][_0xdba4('0x7')],_0x3bfbcd);return _0xa3395d(_0x2714e7[_0xdba4('0x5')][_0xdba4('0x7')]);}else{return _0x463f8c(_0x2714e7[_0xdba4('0x8')]);}})[_0xdba4('0x9')](function(_0x56659f){logger[_0xdba4('0x5')](_0xdba4('0x4'),'routing',_0x3f28f,_0x56659f,_0x3bfbcd);return _0xa3395d(_0x56659f);});});};module[_0xdba4('0xa')]=client; \ No newline at end of file +var _0x8a96=['client','http','debug','rpc','error','message','result','catch','exports','jayson/promise','routing'];(function(_0x1384de,_0x5bd3f7){var _0x50e532=function(_0x169ce0){while(--_0x169ce0){_0x1384de['push'](_0x1384de['shift']());}};_0x50e532(++_0x5bd3f7);}(_0x8a96,0x132));var _0x68a9=function(_0x308a9a,_0xd452bb){_0x308a9a=_0x308a9a-0x0;var _0xf317d1=_0x8a96[_0x308a9a];return _0xf317d1;};'use strict';var jayson=require(_0x68a9('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')(_0x68a9('0x1'));var client=jayson[_0x68a9('0x2')][_0x68a9('0x3')]({'port':0x2329});client['Request']=function(_0x4e6564,_0x11459e){return new BPromise(function(_0x565236,_0x124587){return client['request'](_0x4e6564,_0x11459e)['then'](function(_0x1b4fcc){logger[_0x68a9('0x4')](_0x68a9('0x5'),_0x68a9('0x1'),_0x4e6564,_0x11459e,_0x1b4fcc);if(_0x1b4fcc[_0x68a9('0x6')]){logger[_0x68a9('0x6')]('rpc',_0x68a9('0x1'),_0x4e6564,_0x1b4fcc[_0x68a9('0x6')][_0x68a9('0x7')],_0x11459e);return _0x124587(_0x1b4fcc[_0x68a9('0x6')][_0x68a9('0x7')]);}else{return _0x565236(_0x1b4fcc[_0x68a9('0x8')]);}})[_0x68a9('0x9')](function(_0x3c6c59){logger[_0x68a9('0x6')]('rpc',_0x68a9('0x1'),_0x4e6564,_0x3c6c59,_0x11459e);return _0x124587(_0x3c6c59);});});};module[_0x68a9('0xa')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 04c0d72..d209c0f 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 _0xc542=['catch','bluebird','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','then','initMailAccounts','refresh','listen','getSettings','loginMailFrequency'];(function(_0x7a3247,_0x15cb12){var _0x1bfde5=function(_0x62bbef){while(--_0x62bbef){_0x7a3247['push'](_0x7a3247['shift']());}};_0x1bfde5(++_0x15cb12);}(_0xc542,0xd1));var _0x2c54=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xc542[_0xbb091];return _0x467a04;};'use strict';var BPromise=require(_0x2c54('0x0'));var server=require(_0x2c54('0x1'));var Realtime=require(_0x2c54('0x2'));var EmailChannel=require(_0x2c54('0x3'));var mailAccount=require(_0x2c54('0x4'));var setting=require(_0x2c54('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise['resolve']()['then'](mailAccount['getMailAccounts']())[_0x2c54('0x6')](realtime[_0x2c54('0x7')]())['then'](function(){email[_0x2c54('0x8')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x2c54('0x9')](realtime,email)[_0x2c54('0x6')](function(){return initRealtime();})[_0x2c54('0x6')](function(){return setting[_0x2c54('0xa')]();})['then'](function(_0x340a66){return setInterval(initRealtime,_0x340a66[_0x2c54('0xb')]*0x3e8);})[_0x2c54('0xc')](function(_0x15f751){console['log'](_0x15f751);});}main(); \ No newline at end of file +var _0xbd2c=['./rpc/mailAccount','./rpc/setting','resolve','getMailAccounts','then','initMailAccounts','refresh','loginMailFrequency','bluebird','./server','./realtime'];(function(_0x366e99,_0x15d82d){var _0x180bbe=function(_0x282498){while(--_0x282498){_0x366e99['push'](_0x366e99['shift']());}};_0x180bbe(++_0x15d82d);}(_0xbd2c,0x173));var _0xcbd2=function(_0x595df6,_0x5858d5){_0x595df6=_0x595df6-0x0;var _0x24645e=_0xbd2c[_0x595df6];return _0x24645e;};'use strict';var BPromise=require(_0xcbd2('0x0'));var server=require(_0xcbd2('0x1'));var Realtime=require(_0xcbd2('0x2'));var EmailChannel=require('./lib/email');var mailAccount=require(_0xcbd2('0x3'));var setting=require(_0xcbd2('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0xcbd2('0x5')]()['then'](mailAccount[_0xcbd2('0x6')]())[_0xcbd2('0x7')](realtime[_0xcbd2('0x8')]())[_0xcbd2('0x7')](function(){email[_0xcbd2('0x9')](realtime['mailAccounts']);return realtime;});}function main(){return server['listen'](realtime,email)['then'](function(){return initRealtime();})[_0xcbd2('0x7')](function(){return setting['getSettings']();})[_0xcbd2('0x7')](function(_0xfb2e42){return setInterval(initRealtime,_0xfb2e42[_0xcbd2('0xa')]*0x3e8);})['catch'](function(_0x5e47da){console['log'](_0x5e47da);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 08c92ff..141adcd 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 _0x80e4=['bluebird','md5','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','emit','name','key','active','Imap','status','total','isNil','stringify','refresh','hasOwnProperty','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','disabled','messageStatus','messages','prototype','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapError','sendMail','send','verifySmtp','Smtp','lastSync','verify','verified','catch','exports','lodash','moment'];(function(_0x2b3027,_0x2a227d){var _0x5cbc7b=function(_0x550cea){while(--_0x550cea){_0x2b3027['push'](_0x2b3027['shift']());}};_0x5cbc7b(++_0x2a227d);}(_0x80e4,0x1c6));var _0x480e=function(_0x5f46e7,_0x62f9f8){_0x5f46e7=_0x5f46e7-0x0;var _0x567e95=_0x80e4[_0x5f46e7];return _0x567e95;};'use strict';var _=require(_0x480e('0x0'));var moment=require(_0x480e('0x1'));var BPromise=require(_0x480e('0x2'));var md5=require(_0x480e('0x3'));var Redis=require('ioredis');var config=require(_0x480e('0x4'));var logger=require(_0x480e('0x5'))(_0x480e('0x6'));config[_0x480e('0x7')]=_[_0x480e('0x8')](config['redis'],{'host':_0x480e('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var EmailImap=require(_0x480e('0xa'));var EmailSmtp=require(_0x480e('0xb'));var mailAccount=require(_0x480e('0xc'));var md5Accounts={};function EmailChannel(_0x710cb7){logger[_0x480e('0xd')](_0x480e('0xe'));this[_0x480e('0xf')]=_0x710cb7['mailAccounts'];this[_0x480e('0x10')]={};this[_0x480e('0x11')]=new EmailSmtp();}EmailChannel['prototype'][_0x480e('0x12')]=function(_0x452a67){var _0x584e69=this[_0x480e('0xf')][_0x452a67];var _0x163791={'id':_0x584e69['id'],'name':_0x584e69[_0x480e('0x13')],'key':_0x584e69[_0x480e('0x14')],'active':_0x584e69[_0x480e('0x15')],'Imap':{'status':_0x584e69[_0x480e('0x16')][_0x480e('0x17')],'messageStatus':_0x584e69[_0x480e('0x16')]['messageStatus'],'total':_0x584e69[_0x480e('0x16')][_0x480e('0x18')]}};if(_[_0x480e('0x19')](md5Accounts[_0x452a67])){md5Accounts[_0x452a67]={};}var _0x4c867a=md5(JSON[_0x480e('0x1a')](_0x163791));if(md5Accounts[_0x452a67][_0x480e('0x3')]!==_0x4c867a){md5Accounts[_0x452a67][_0x480e('0x3')]=_0x4c867a;io[_0x480e('0x12')]('mailAccount:update',_0x163791);}};EmailChannel['prototype'][_0x480e('0x1b')]=function(_0x31419e){for(var _0x1a05b3 in _0x31419e){if(_0x31419e['hasOwnProperty'](_0x1a05b3)){if(_0x31419e[_0x1a05b3]['Imap']&&_0x31419e[_0x1a05b3][_0x480e('0x15')]){var _0xa253de=_0x31419e[_0x1a05b3][_0x480e('0x16')];if(!this['imapAccounts'][_0x480e('0x1c')](_0xa253de['id'])){this['imapAccounts'][_0xa253de['id']]=new EmailImap(_0xa253de,_0x31419e[_0x1a05b3][_0x480e('0x6')]);this['imapAccounts'][_0xa253de['id']]['on'](_0x480e('0x1d'),this[_0x480e('0x1e')][_0x480e('0x1f')](this,_0x1a05b3));this['imapAccounts'][_0xa253de['id']]['on'](_0x480e('0x6'),this[_0x480e('0x20')][_0x480e('0x1f')](this,_0x1a05b3));this[_0x480e('0x10')][_0xa253de['id']]['on'](_0x480e('0x21'),this[_0x480e('0x22')]['bind'](this,_0x1a05b3));this[_0x480e('0x10')][_0xa253de['id']]['on']('error',this['handleImapError'][_0x480e('0x1f')](this,_0x1a05b3));}}else{if(_[_0x480e('0x19')](this[_0x480e('0xf')][_0x1a05b3][_0x480e('0x16')])){this['mailAccounts'][_0x1a05b3][_0x480e('0x16')]={};}this['mailAccounts'][_0x1a05b3][_0x480e('0x16')]['status']=_0x480e('0x23');this[_0x480e('0xf')][_0x1a05b3][_0x480e('0x16')][_0x480e('0x24')]='';this[_0x480e('0x12')](_0x1a05b3);}}}};EmailChannel['prototype'][_0x480e('0x1e')]=function(_0x5cb13c,_0x1839c3){if(this['mailAccounts'][_0x5cb13c]){this['mailAccounts'][_0x5cb13c][_0x480e('0x16')][_0x480e('0x17')]='connected';this[_0x480e('0xf')][_0x5cb13c][_0x480e('0x16')]['messageStatus']=_0x1839c3[_0x480e('0x13')];if(_0x1839c3[_0x480e('0x25')]){this[_0x480e('0xf')][_0x5cb13c][_0x480e('0x16')][_0x480e('0x18')]=_0x1839c3[_0x480e('0x25')][_0x480e('0x18')];}return this[_0x480e('0x12')](_0x5cb13c);}};EmailChannel[_0x480e('0x26')][_0x480e('0x20')]=function(_0x31e06e,_0x5ba082){logger['info']('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x5ba082[_0x480e('0x27')],_0x5ba082[_0x480e('0x28')],_0x5ba082[_0x480e('0x29')],_0x31e06e);if(this[_0x480e('0xf')][_0x31e06e]){return mailAccount[_0x480e('0x2a')](_0x31e06e,_0x5ba082)[_0x480e('0x2b')](function(_0x1a0457){if(_0x1a0457){logger[_0x480e('0xd')](_0x480e('0x2c'));}})['catch'](function(_0x22defb){logger[_0x480e('0x2d')](_0x480e('0x2e'),JSON[_0x480e('0x1a')](_0x22defb));});}};EmailChannel[_0x480e('0x26')][_0x480e('0x22')]=function(_0x3a8377){if(this[_0x480e('0xf')][_0x3a8377]&&this['mailAccounts'][_0x3a8377][_0x480e('0x16')]){if(this[_0x480e('0x10')][this['mailAccounts'][_0x3a8377][_0x480e('0x16')]['id']]){delete this[_0x480e('0x10')][this[_0x480e('0xf')][_0x3a8377][_0x480e('0x16')]['id']];}this[_0x480e('0xf')][_0x3a8377][_0x480e('0x16')]['lastSync']=moment();this['emit'](_0x3a8377);}};EmailChannel[_0x480e('0x26')][_0x480e('0x2f')]=function(_0x56c63c,_0xe0fc03){if(this[_0x480e('0xf')][_0x56c63c]){this['mailAccounts'][_0x56c63c][_0x480e('0x16')]['status']=_0x480e('0x2d');this[_0x480e('0xf')][_0x56c63c][_0x480e('0x16')][_0x480e('0x24')]=_0xe0fc03;return this[_0x480e('0x12')](_0x56c63c);}};EmailChannel[_0x480e('0x26')][_0x480e('0x30')]=function(_0x5cb472,_0x1804f7){return this[_0x480e('0x11')][_0x480e('0x31')](_0x5cb472,_0x1804f7);};EmailChannel[_0x480e('0x26')][_0x480e('0x32')]=function(_0x4c558e){var _0x56d280=this;if(this[_0x480e('0xf')][_0x4c558e['id']]){if(_[_0x480e('0x19')](this['mailAccounts'][_0x4c558e['id']][_0x480e('0x33')])){this[_0x480e('0xf')][_0x4c558e['id']][_0x480e('0x33')]={};}this['mailAccounts'][_0x4c558e['id']][_0x480e('0x33')][_0x480e('0x34')]=moment();return new BPromise(function(_0x52d1f9,_0x556f93){return _0x56d280[_0x480e('0x11')][_0x480e('0x35')](_0x4c558e)[_0x480e('0x2b')](function(_0x59f5ca){_0x56d280['mailAccounts'][_0x4c558e['id']][_0x480e('0x33')][_0x480e('0x17')]=_0x480e('0x36');_0x56d280[_0x480e('0xf')][_0x4c558e['id']]['Smtp'][_0x480e('0x24')]='';_0x56d280['emit'](_0x4c558e['id']);_0x52d1f9(_0x59f5ca);})[_0x480e('0x37')](function(_0x55c5ea){_0x56d280[_0x480e('0xf')][_0x4c558e['id']]['Smtp'][_0x480e('0x17')]=_0x480e('0x2d');_0x56d280['mailAccounts'][_0x4c558e['id']][_0x480e('0x33')][_0x480e('0x24')]=_0x55c5ea;_0x56d280[_0x480e('0x12')](_0x4c558e['id']);_0x556f93(_0x55c5ea);});});}return this[_0x480e('0x11')][_0x480e('0x35')](_0x4c558e);};module[_0x480e('0x38')]=EmailChannel; \ No newline at end of file +var _0xdc04=['handleImapBox','handleImapEmail','bind','handleImapEnd','error','status','disabled','connected','messageStatus','messages','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','notify','then','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','verifySmtp','Smtp','verify','verified','lodash','bluebird','md5','../../../config/logger','redis','defaults','localhost','./imap','./smtp','info','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','isNil','stringify','mailAccount:update','hasOwnProperty','email'];(function(_0x22dac7,_0x45d32a){var _0x3e6cfa=function(_0x4c2e9d){while(--_0x4c2e9d){_0x22dac7['push'](_0x22dac7['shift']());}};_0x3e6cfa(++_0x45d32a);}(_0xdc04,0x198));var _0x4dc0=function(_0x5a3698,_0x181b17){_0x5a3698=_0x5a3698-0x0;var _0xa8d64d=_0xdc04[_0x5a3698];return _0xa8d64d;};'use strict';var _=require(_0x4dc0('0x0'));var moment=require('moment');var BPromise=require(_0x4dc0('0x1'));var md5=require(_0x4dc0('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x4dc0('0x3'))('email');config[_0x4dc0('0x4')]=_[_0x4dc0('0x5')](config['redis'],{'host':_0x4dc0('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4dc0('0x4')]));var EmailImap=require(_0x4dc0('0x7'));var EmailSmtp=require(_0x4dc0('0x8'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x81df53){logger[_0x4dc0('0x9')]('start\x20email\x20channel');this[_0x4dc0('0xa')]=_0x81df53[_0x4dc0('0xa')];this[_0x4dc0('0xb')]={};this[_0x4dc0('0xc')]=new EmailSmtp();}EmailChannel[_0x4dc0('0xd')][_0x4dc0('0xe')]=function(_0x2bbd66){var _0x36ef24=this[_0x4dc0('0xa')][_0x2bbd66];var _0x1d777b={'id':_0x36ef24['id'],'name':_0x36ef24[_0x4dc0('0xf')],'key':_0x36ef24[_0x4dc0('0x10')],'active':_0x36ef24[_0x4dc0('0x11')],'Imap':{'status':_0x36ef24[_0x4dc0('0x12')]['status'],'messageStatus':_0x36ef24[_0x4dc0('0x12')]['messageStatus'],'total':_0x36ef24[_0x4dc0('0x12')]['total']}};if(_[_0x4dc0('0x13')](md5Accounts[_0x2bbd66])){md5Accounts[_0x2bbd66]={};}var _0x4eb06f=md5(JSON[_0x4dc0('0x14')](_0x1d777b));if(md5Accounts[_0x2bbd66][_0x4dc0('0x2')]!==_0x4eb06f){md5Accounts[_0x2bbd66][_0x4dc0('0x2')]=_0x4eb06f;io['emit'](_0x4dc0('0x15'),_0x1d777b);}};EmailChannel[_0x4dc0('0xd')]['refresh']=function(_0x362cf5){for(var _0x51679d in _0x362cf5){if(_0x362cf5['hasOwnProperty'](_0x51679d)){if(_0x362cf5[_0x51679d][_0x4dc0('0x12')]&&_0x362cf5[_0x51679d][_0x4dc0('0x11')]){var _0x2f697c=_0x362cf5[_0x51679d][_0x4dc0('0x12')];if(!this['imapAccounts'][_0x4dc0('0x16')](_0x2f697c['id'])){this['imapAccounts'][_0x2f697c['id']]=new EmailImap(_0x2f697c,_0x362cf5[_0x51679d][_0x4dc0('0x17')]);this[_0x4dc0('0xb')][_0x2f697c['id']]['on']('box',this[_0x4dc0('0x18')]['bind'](this,_0x51679d));this[_0x4dc0('0xb')][_0x2f697c['id']]['on'](_0x4dc0('0x17'),this[_0x4dc0('0x19')][_0x4dc0('0x1a')](this,_0x51679d));this['imapAccounts'][_0x2f697c['id']]['on']('end',this[_0x4dc0('0x1b')][_0x4dc0('0x1a')](this,_0x51679d));this[_0x4dc0('0xb')][_0x2f697c['id']]['on'](_0x4dc0('0x1c'),this['handleImapError'][_0x4dc0('0x1a')](this,_0x51679d));}}else{if(_['isNil'](this[_0x4dc0('0xa')][_0x51679d][_0x4dc0('0x12')])){this[_0x4dc0('0xa')][_0x51679d][_0x4dc0('0x12')]={};}this['mailAccounts'][_0x51679d][_0x4dc0('0x12')][_0x4dc0('0x1d')]=_0x4dc0('0x1e');this['mailAccounts'][_0x51679d][_0x4dc0('0x12')]['messageStatus']='';this[_0x4dc0('0xe')](_0x51679d);}}}};EmailChannel[_0x4dc0('0xd')]['handleImapBox']=function(_0x2ede59,_0x34f7a4){if(this[_0x4dc0('0xa')][_0x2ede59]){this[_0x4dc0('0xa')][_0x2ede59]['Imap'][_0x4dc0('0x1d')]=_0x4dc0('0x1f');this[_0x4dc0('0xa')][_0x2ede59]['Imap'][_0x4dc0('0x20')]=_0x34f7a4[_0x4dc0('0xf')];if(_0x34f7a4[_0x4dc0('0x21')]){this[_0x4dc0('0xa')][_0x2ede59]['Imap'][_0x4dc0('0x22')]=_0x34f7a4['messages'][_0x4dc0('0x22')];}return this[_0x4dc0('0xe')](_0x2ede59);}};EmailChannel['prototype'][_0x4dc0('0x19')]=function(_0x4da307,_0x111c89){logger[_0x4dc0('0x9')](_0x4dc0('0x23'),_0x111c89[_0x4dc0('0x24')],_0x111c89['lastName'],_0x111c89['from'],_0x4da307);if(this['mailAccounts'][_0x4da307]){return mailAccount[_0x4dc0('0x25')](_0x4da307,_0x111c89)[_0x4dc0('0x26')](function(_0x3061ca){if(_0x3061ca){logger['info']('Mail\x20accepted\x20from\x20routing');}})[_0x4dc0('0x27')](function(_0x1952b6){logger[_0x4dc0('0x1c')](_0x4dc0('0x28'),JSON['stringify'](_0x1952b6));});}};EmailChannel[_0x4dc0('0xd')][_0x4dc0('0x1b')]=function(_0x320ff4){if(this[_0x4dc0('0xa')][_0x320ff4]&&this[_0x4dc0('0xa')][_0x320ff4]['Imap']){if(this[_0x4dc0('0xb')][this[_0x4dc0('0xa')][_0x320ff4][_0x4dc0('0x12')]['id']]){delete this[_0x4dc0('0xb')][this[_0x4dc0('0xa')][_0x320ff4][_0x4dc0('0x12')]['id']];}this[_0x4dc0('0xa')][_0x320ff4][_0x4dc0('0x12')][_0x4dc0('0x29')]=moment();this[_0x4dc0('0xe')](_0x320ff4);}};EmailChannel[_0x4dc0('0xd')]['handleImapError']=function(_0x2f1e78,_0x47496e){if(this[_0x4dc0('0xa')][_0x2f1e78]){this[_0x4dc0('0xa')][_0x2f1e78][_0x4dc0('0x12')][_0x4dc0('0x1d')]=_0x4dc0('0x1c');this[_0x4dc0('0xa')][_0x2f1e78][_0x4dc0('0x12')][_0x4dc0('0x20')]=_0x47496e;return this[_0x4dc0('0xe')](_0x2f1e78);}};EmailChannel[_0x4dc0('0xd')][_0x4dc0('0x2a')]=function(_0x46ccd0,_0x3b54a3){return this[_0x4dc0('0xc')][_0x4dc0('0x2b')](_0x46ccd0,_0x3b54a3);};EmailChannel[_0x4dc0('0xd')][_0x4dc0('0x2c')]=function(_0x201190){var _0x26c736=this;if(this[_0x4dc0('0xa')][_0x201190['id']]){if(_[_0x4dc0('0x13')](this[_0x4dc0('0xa')][_0x201190['id']][_0x4dc0('0x2d')])){this[_0x4dc0('0xa')][_0x201190['id']][_0x4dc0('0x2d')]={};}this[_0x4dc0('0xa')][_0x201190['id']][_0x4dc0('0x2d')][_0x4dc0('0x29')]=moment();return new BPromise(function(_0xcddff1,_0x52d26c){return _0x26c736['smtp'][_0x4dc0('0x2e')](_0x201190)[_0x4dc0('0x26')](function(_0x593473){_0x26c736[_0x4dc0('0xa')][_0x201190['id']][_0x4dc0('0x2d')]['status']=_0x4dc0('0x2f');_0x26c736[_0x4dc0('0xa')][_0x201190['id']]['Smtp']['messageStatus']='';_0x26c736[_0x4dc0('0xe')](_0x201190['id']);_0xcddff1(_0x593473);})[_0x4dc0('0x27')](function(_0x4266e6){_0x26c736[_0x4dc0('0xa')][_0x201190['id']][_0x4dc0('0x2d')][_0x4dc0('0x1d')]='error';_0x26c736[_0x4dc0('0xa')][_0x201190['id']][_0x4dc0('0x2d')]['messageStatus']=_0x4266e6;_0x26c736[_0x4dc0('0xe')](_0x201190['id']);_0x52d26c(_0x4266e6);});});}return this['smtp'][_0x4dc0('0x2e')](_0x201190);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 1b1e65c..95368ea 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 _0x4944=['EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','account','once','bind','error','handleError','inherits','prototype','getAccount','connTimeout','authTimeout','service','authentication','password','host','port','tls','user','getHost','handleReady','openBox','handleOpenBox','emit','readUnseen','handleCloseBox','end','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleSimpleParser','handleMessageAttributes','handleMessageEnd','stringify','textCode','hasOwnProperty','exports','path','imap','lodash','randomstring','mailparser','simpleParser','Iconv'];(function(_0x4328d3,_0x324552){var _0x137294=function(_0x156e03){while(--_0x156e03){_0x4328d3['push'](_0x4328d3['shift']());}};_0x137294(++_0x324552);}(_0x4944,0x6d));var _0x4494=function(_0x4531a9,_0x4074e2){_0x4531a9=_0x4531a9-0x0;var _0x567a45=_0x4944[_0x4531a9];return _0x567a45;};'use strict';var fs=require('fs');var path=require(_0x4494('0x0'));var util=require('util');var Imap=require(_0x4494('0x1'));var _=require(_0x4494('0x2'));var rs=require(_0x4494('0x3'));var simpleParser=require(_0x4494('0x4'))[_0x4494('0x5')];var Iconv=require('iconv')[_0x4494('0x6')];var EventEmitter=require('events')[_0x4494('0x7')];var utils=require(_0x4494('0x8'));var logger=require(_0x4494('0x9'))(_0x4494('0xa'));function EmailImap(_0x2a4911,_0x1a94d6){this[_0x4494('0xb')]=_0x4494('0xc');this[_0x4494('0xd')]=this['getAccount'](_0x2a4911,_0x1a94d6);this[_0x4494('0x1')]=new Imap(this[_0x4494('0xd')]);this[_0x4494('0x1')][_0x4494('0xe')]('ready',this['handleReady'][_0x4494('0xf')](this));this[_0x4494('0x1')][_0x4494('0xe')]('end',this['handleEnd'][_0x4494('0xf')](this));this[_0x4494('0x1')]['on'](_0x4494('0x10'),this[_0x4494('0x11')][_0x4494('0xf')](this));this[_0x4494('0x1')]['connect']();}util[_0x4494('0x12')](EmailImap,EventEmitter);EmailImap[_0x4494('0x13')][_0x4494('0x14')]=function(_0x259e03,_0x9e92d0){var _0x8506a0={'connTimeout':_0x259e03[_0x4494('0x15')]?_0x259e03['connTimeout']*0x3e8:0x2710,'authTimeout':_0x259e03[_0x4494('0x16')]?_0x259e03['authTimeout']*0x3e8:0x1388};if(_['isNil'](_0x259e03[_0x4494('0x17')])){if(_0x259e03[_0x4494('0x18')]){_0x8506a0['user']=_0x259e03['user'];_0x8506a0[_0x4494('0x19')]=_0x259e03['password'];}_0x8506a0[_0x4494('0x1a')]=_0x259e03[_0x4494('0x1a')];_0x8506a0['port']=_0x259e03[_0x4494('0x1b')]||0x3e1;if(_0x259e03['tls']){_0x8506a0[_0x4494('0x1c')]=!![];}else{_0x8506a0[_0x4494('0x1c')]=![];_0x8506a0['autotls']='required';}}else{_0x8506a0[_0x4494('0x1d')]=_0x259e03[_0x4494('0x1d')];_0x8506a0[_0x4494('0x19')]=_0x259e03[_0x4494('0x19')];_0x8506a0[_0x4494('0x1a')]=utils[_0x4494('0x1e')](_0x259e03[_0x4494('0x17')]);_0x8506a0[_0x4494('0x1b')]=0x3e1;_0x8506a0['tls']=!![];}_0x8506a0['email']=_0x9e92d0||_0x259e03['user']||'anonymous@xcally.com';return _0x8506a0;};EmailImap[_0x4494('0x13')][_0x4494('0x1f')]=function(){this[_0x4494('0x1')][_0x4494('0x20')](this['mailbox'],![],this[_0x4494('0x21')][_0x4494('0xf')](this));};EmailImap['prototype'][_0x4494('0x21')]=function(_0x115520,_0x87d98){if(_0x115520){this['handleError'](_0x115520,!![]);}else{this[_0x4494('0x22')]('box',_0x87d98);this[_0x4494('0x23')]();}};EmailImap['prototype'][_0x4494('0x24')]=function(_0x2fcc43){if(_0x2fcc43){this[_0x4494('0x11')](_0x2fcc43,!![]);}else{this['imap'][_0x4494('0x25')]();}};EmailImap[_0x4494('0x13')]['readUnseen']=function(){this[_0x4494('0x1')][_0x4494('0x26')]([_0x4494('0x27')],this['handleReadUnseen'][_0x4494('0xf')](this));};EmailImap[_0x4494('0x13')][_0x4494('0x28')]=function(_0x19f483,_0x5a8a5b){if(_0x19f483){this[_0x4494('0x11')](_0x19f483,!![]);}else{if(_0x5a8a5b[_0x4494('0x29')]){try{var _0xcce4da=this['imap'][_0x4494('0x2a')](_0x5a8a5b,{'bodies':'','markSeen':!![]});_0xcce4da['on'](_0x4494('0x2b'),this[_0x4494('0x2c')]['bind'](this));_0xcce4da[_0x4494('0xe')](_0x4494('0x10'),this[_0x4494('0x2d')][_0x4494('0xf')](this));_0xcce4da[_0x4494('0xe')](_0x4494('0x25'),this[_0x4494('0x2e')]['bind'](this));}catch(_0x44559f){logger[_0x4494('0x10')](_0x44559f);}}else{this[_0x4494('0x1')][_0x4494('0x2f')](!![],this[_0x4494('0x24')][_0x4494('0xf')](this));}}};EmailImap['prototype'][_0x4494('0x2c')]=function(_0x1009a4,_0x3b3cae){_0x1009a4['on'](_0x4494('0x30'),this[_0x4494('0x31')]['bind'](this));_0x1009a4[_0x4494('0xe')](_0x4494('0x32'),this['handleMessageAttributes'][_0x4494('0xf')](this));_0x1009a4['once']('end',this['handleMessageEnd'][_0x4494('0xf')](this));};EmailImap[_0x4494('0x13')][_0x4494('0x31')]=function(_0x546133,_0x542359){simpleParser(_0x546133,{'Iconv':Iconv},this[_0x4494('0x33')][_0x4494('0xf')](this));};EmailImap[_0x4494('0x13')][_0x4494('0x34')]=function(_0xa80999){};EmailImap[_0x4494('0x13')][_0x4494('0x35')]=function(){};EmailImap[_0x4494('0x13')][_0x4494('0x33')]=function(_0x2498bc,_0x2a80e4){if(_0x2498bc){logger[_0x4494('0x10')](_0x2498bc);}else{var _0x27d93f=this;utils['parser'](this[_0x4494('0xd')],_0x2a80e4,function(_0xd09dbb){_0x27d93f[_0x4494('0x22')](_0x4494('0xa'),_0xd09dbb);});}};EmailImap[_0x4494('0x13')][_0x4494('0x2e')]=function(){this[_0x4494('0x1')][_0x4494('0x2f')](!![],this[_0x4494('0x24')]['bind'](this));};EmailImap['prototype'][_0x4494('0x2d')]=function(_0x55dbb8){this[_0x4494('0x11')](_0x55dbb8);this[_0x4494('0x1')][_0x4494('0x2f')](!![],this[_0x4494('0x24')][_0x4494('0xf')](this));};EmailImap['prototype']['handleEnd']=function(){this[_0x4494('0x22')]('end');};EmailImap[_0x4494('0x13')][_0x4494('0x11')]=function(_0x124d0a,_0x2d10f4){logger[_0x4494('0x10')](_0x4494('0x11'),this[_0x4494('0xd')]['email'],JSON[_0x4494('0x36')](_0x124d0a));var _0xe210c4='';if(_0x124d0a){if(_0x124d0a['textCode']){_0xe210c4=_0x124d0a[_0x4494('0x37')];}else{for(var _0x44953b in _0x124d0a){if(_0x124d0a[_0x4494('0x38')](_0x44953b)){_0xe210c4+=_['upperFirst'](_0x44953b)+':\x20'+_0x124d0a[_0x44953b]+'\x0a';}}}}if(_0x2d10f4){this[_0x4494('0x1')][_0x4494('0x25')]();}else{this[_0x4494('0x22')](_0x4494('0x10'),_0xe210c4);this['emit']('end');}};module[_0x4494('0x39')]=EmailImap; \ No newline at end of file +var _0x56e6=['error','handleError','connect','inherits','connTimeout','authTimeout','isNil','service','authentication','user','host','port','autotls','required','password','getHost','tls','anonymous@xcally.com','prototype','openBox','emit','readUnseen','handleCloseBox','end','search','UNSEEN','handleReadUnseen','fetch','message','handleFetchError','closeBox','handleFetchMessage','body','handleMessageBody','attributes','handleSimpleParser','handleMessageAttributes','handleMessageEnd','handleEnd','stringify','textCode','hasOwnProperty','upperFirst','path','util','imap','lodash','randomstring','mailparser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','account','getAccount','once','ready','handleReady','bind'];(function(_0x22ab41,_0x791127){var _0x3b0f10=function(_0x1136f9){while(--_0x1136f9){_0x22ab41['push'](_0x22ab41['shift']());}};_0x3b0f10(++_0x791127);}(_0x56e6,0x6b));var _0x656e=function(_0xd537c0,_0x42a805){_0xd537c0=_0xd537c0-0x0;var _0x26755=_0x56e6[_0xd537c0];return _0x26755;};'use strict';var fs=require('fs');var path=require(_0x656e('0x0'));var util=require(_0x656e('0x1'));var Imap=require(_0x656e('0x2'));var _=require(_0x656e('0x3'));var rs=require(_0x656e('0x4'));var simpleParser=require(_0x656e('0x5'))['simpleParser'];var Iconv=require(_0x656e('0x6'))[_0x656e('0x7')];var EventEmitter=require(_0x656e('0x8'))[_0x656e('0x9')];var utils=require(_0x656e('0xa'));var logger=require(_0x656e('0xb'))(_0x656e('0xc'));function EmailImap(_0x54eddb,_0x35d629){this[_0x656e('0xd')]=_0x656e('0xe');this[_0x656e('0xf')]=this[_0x656e('0x10')](_0x54eddb,_0x35d629);this[_0x656e('0x2')]=new Imap(this[_0x656e('0xf')]);this[_0x656e('0x2')][_0x656e('0x11')](_0x656e('0x12'),this[_0x656e('0x13')][_0x656e('0x14')](this));this[_0x656e('0x2')][_0x656e('0x11')]('end',this['handleEnd'][_0x656e('0x14')](this));this[_0x656e('0x2')]['on'](_0x656e('0x15'),this[_0x656e('0x16')]['bind'](this));this['imap'][_0x656e('0x17')]();}util[_0x656e('0x18')](EmailImap,EventEmitter);EmailImap['prototype'][_0x656e('0x10')]=function(_0x5059d9,_0x2ce681){var _0x7e4d57={'connTimeout':_0x5059d9[_0x656e('0x19')]?_0x5059d9[_0x656e('0x19')]*0x3e8:0x2710,'authTimeout':_0x5059d9['authTimeout']?_0x5059d9[_0x656e('0x1a')]*0x3e8:0x1388};if(_[_0x656e('0x1b')](_0x5059d9[_0x656e('0x1c')])){if(_0x5059d9[_0x656e('0x1d')]){_0x7e4d57[_0x656e('0x1e')]=_0x5059d9['user'];_0x7e4d57['password']=_0x5059d9['password'];}_0x7e4d57[_0x656e('0x1f')]=_0x5059d9[_0x656e('0x1f')];_0x7e4d57['port']=_0x5059d9[_0x656e('0x20')]||0x3e1;if(_0x5059d9['tls']){_0x7e4d57['tls']=!![];}else{_0x7e4d57['tls']=![];_0x7e4d57[_0x656e('0x21')]=_0x656e('0x22');}}else{_0x7e4d57[_0x656e('0x1e')]=_0x5059d9[_0x656e('0x1e')];_0x7e4d57['password']=_0x5059d9[_0x656e('0x23')];_0x7e4d57[_0x656e('0x1f')]=utils[_0x656e('0x24')](_0x5059d9['service']);_0x7e4d57[_0x656e('0x20')]=0x3e1;_0x7e4d57[_0x656e('0x25')]=!![];}_0x7e4d57[_0x656e('0xc')]=_0x2ce681||_0x5059d9[_0x656e('0x1e')]||_0x656e('0x26');return _0x7e4d57;};EmailImap[_0x656e('0x27')][_0x656e('0x13')]=function(){this['imap'][_0x656e('0x28')](this[_0x656e('0xd')],![],this['handleOpenBox']['bind'](this));};EmailImap[_0x656e('0x27')]['handleOpenBox']=function(_0x33fb09,_0x5b492e){if(_0x33fb09){this['handleError'](_0x33fb09,!![]);}else{this[_0x656e('0x29')]('box',_0x5b492e);this[_0x656e('0x2a')]();}};EmailImap[_0x656e('0x27')][_0x656e('0x2b')]=function(_0x514272){if(_0x514272){this['handleError'](_0x514272,!![]);}else{this[_0x656e('0x2')][_0x656e('0x2c')]();}};EmailImap[_0x656e('0x27')][_0x656e('0x2a')]=function(){this[_0x656e('0x2')][_0x656e('0x2d')]([_0x656e('0x2e')],this['handleReadUnseen'][_0x656e('0x14')](this));};EmailImap['prototype'][_0x656e('0x2f')]=function(_0x33d446,_0x58cf11){if(_0x33d446){this[_0x656e('0x16')](_0x33d446,!![]);}else{if(_0x58cf11['length']){try{var _0x4a7fbb=this[_0x656e('0x2')][_0x656e('0x30')](_0x58cf11,{'bodies':'','markSeen':!![]});_0x4a7fbb['on'](_0x656e('0x31'),this['handleFetchMessage'][_0x656e('0x14')](this));_0x4a7fbb['once'](_0x656e('0x15'),this[_0x656e('0x32')]['bind'](this));_0x4a7fbb[_0x656e('0x11')]('end',this['handleFetchEnd'][_0x656e('0x14')](this));}catch(_0x50ca1a){logger[_0x656e('0x15')](_0x50ca1a);}}else{this[_0x656e('0x2')][_0x656e('0x33')](!![],this[_0x656e('0x2b')]['bind'](this));}}};EmailImap['prototype'][_0x656e('0x34')]=function(_0x54de4d,_0xe0a50a){_0x54de4d['on'](_0x656e('0x35'),this[_0x656e('0x36')][_0x656e('0x14')](this));_0x54de4d[_0x656e('0x11')](_0x656e('0x37'),this['handleMessageAttributes']['bind'](this));_0x54de4d['once']('end',this['handleMessageEnd'][_0x656e('0x14')](this));};EmailImap['prototype']['handleMessageBody']=function(_0x10dfd6,_0x351452){simpleParser(_0x10dfd6,{'Iconv':Iconv},this[_0x656e('0x38')][_0x656e('0x14')](this));};EmailImap[_0x656e('0x27')][_0x656e('0x39')]=function(_0x4353c8){};EmailImap[_0x656e('0x27')][_0x656e('0x3a')]=function(){};EmailImap[_0x656e('0x27')][_0x656e('0x38')]=function(_0x46306a,_0x387bff){if(_0x46306a){logger['error'](_0x46306a);}else{var _0x3c1a70=this;utils['parser'](this['account'],_0x387bff,function(_0x412bec){_0x3c1a70[_0x656e('0x29')](_0x656e('0xc'),_0x412bec);});}};EmailImap['prototype']['handleFetchEnd']=function(){this['imap'][_0x656e('0x33')](!![],this[_0x656e('0x2b')][_0x656e('0x14')](this));};EmailImap[_0x656e('0x27')][_0x656e('0x32')]=function(_0x13ed2d){this[_0x656e('0x16')](_0x13ed2d);this[_0x656e('0x2')][_0x656e('0x33')](!![],this[_0x656e('0x2b')][_0x656e('0x14')](this));};EmailImap[_0x656e('0x27')][_0x656e('0x3b')]=function(){this['emit'](_0x656e('0x2c'));};EmailImap['prototype'][_0x656e('0x16')]=function(_0x3f3d5e,_0x4045c4){logger[_0x656e('0x15')](_0x656e('0x16'),this[_0x656e('0xf')][_0x656e('0xc')],JSON[_0x656e('0x3c')](_0x3f3d5e));var _0x11ff9f='';if(_0x3f3d5e){if(_0x3f3d5e[_0x656e('0x3d')]){_0x11ff9f=_0x3f3d5e['textCode'];}else{for(var _0xf3071a in _0x3f3d5e){if(_0x3f3d5e[_0x656e('0x3e')](_0xf3071a)){_0x11ff9f+=_[_0x656e('0x3f')](_0xf3071a)+':\x20'+_0x3f3d5e[_0xf3071a]+'\x0a';}}}}if(_0x4045c4){this['imap']['end']();}else{this[_0x656e('0x29')](_0x656e('0x15'),_0x11ff9f);this[_0x656e('0x29')](_0x656e('0x2c'));}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index b9dd190..c288815 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 _0xef68=['createTransport','use','compile','toString','verify','Not\x20verifired','nodemailer','bluebird','prototype','send'];(function(_0x512856,_0x1e30c1){var _0x33a1b2=function(_0x19df0b){while(--_0x19df0b){_0x512856['push'](_0x512856['shift']());}};_0x33a1b2(++_0x1e30c1);}(_0xef68,0xce));var _0x8ef6=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xef68[_0x5c2e3e];return _0x53f64a;};'use strict';var nodemailer=require(_0x8ef6('0x0'));var BPromise=require(_0x8ef6('0x1'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x8ef6('0x2')][_0x8ef6('0x3')]=function(_0x231337,_0x1e5bea){return new BPromise(function(_0x53d80c,_0x435803){var _0x105bef=nodemailer[_0x8ef6('0x4')](_0x231337);_0x105bef[_0x8ef6('0x5')](_0x8ef6('0x6'),inlineBase64());_0x105bef['sendMail'](_0x1e5bea,function(_0x1dccc9,_0x37f65e){if(_0x1dccc9){_0x435803(_0x1dccc9[_0x8ef6('0x7')]());}else{_0x53d80c(_0x37f65e);}});});};EmailSmtp['prototype'][_0x8ef6('0x8')]=function(_0x5b0ff2){return new BPromise(function(_0x1d2f8b,_0x74213f){var _0x4b8ac8=nodemailer[_0x8ef6('0x4')](_0x5b0ff2);_0x4b8ac8[_0x8ef6('0x8')](function(_0x365de0,_0x3d4abe){if(_0x365de0){_0x74213f(_0x365de0[_0x8ef6('0x7')]());}else{if(_0x3d4abe){_0x1d2f8b(_0x3d4abe);}else{_0x74213f(_0x8ef6('0x9'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0x804e=['nodemailer-plugin-inline-base64','prototype','send','createTransport','use','compile','toString','verify','nodemailer'];(function(_0x15f522,_0x3584fc){var _0xc2b993=function(_0x14c13b){while(--_0x14c13b){_0x15f522['push'](_0x15f522['shift']());}};_0xc2b993(++_0x3584fc);}(_0x804e,0x1ee));var _0xe804=function(_0x44b778,_0x259b58){_0x44b778=_0x44b778-0x0;var _0x487abe=_0x804e[_0x44b778];return _0x487abe;};'use strict';var nodemailer=require(_0xe804('0x0'));var BPromise=require('bluebird');var inlineBase64=require(_0xe804('0x1'));function EmailSmtp(){}EmailSmtp[_0xe804('0x2')][_0xe804('0x3')]=function(_0x583e4a,_0x474800){return new BPromise(function(_0x528c9c,_0x5c0726){var _0x6bb91c=nodemailer[_0xe804('0x4')](_0x583e4a);_0x6bb91c[_0xe804('0x5')](_0xe804('0x6'),inlineBase64());_0x6bb91c['sendMail'](_0x474800,function(_0x4860bf,_0x3f49fb){if(_0x4860bf){_0x5c0726(_0x4860bf[_0xe804('0x7')]());}else{_0x528c9c(_0x3f49fb);}});});};EmailSmtp[_0xe804('0x2')][_0xe804('0x8')]=function(_0x4a12e6){return new BPromise(function(_0x39fc97,_0x29c39c){var _0x23d07f=nodemailer[_0xe804('0x4')](_0x4a12e6);_0x23d07f[_0xe804('0x8')](function(_0x498a53,_0x5d01c3){if(_0x498a53){_0x29c39c(_0x498a53[_0xe804('0x7')]());}else{if(_0x5d01c3){_0x39fc97(_0x5d01c3);}else{_0x29c39c('Not\x20verifired');}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 952c429..058adfa 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 _0x5eb8=['filename','_SRC','_IMG','\x20[Attachment:\x20','\x20]','body','Empty\x20message

','getHost','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','split','length','slice','Anonymous','pop','isEmpty','html','replace','includes','0x1?_0x4db167[_0x85eb('0x12')]():'';}return'';}function getMails(_0x23a82a,_0x600a7f){var _0x1604ba='';for(var _0x183b0c=0x0;_0x183b0c<_0x600a7f['value'][_0x85eb('0xf')];_0x183b0c+=0x1){if(_0x600a7f['value'][_0x183b0c][_0x85eb('0x9')]!==_0x23a82a){if(!_[_0x85eb('0x13')](_0x1604ba)){_0x1604ba+=',';}_0x1604ba+=_0x600a7f[_0x85eb('0x8')][_0x183b0c][_0x85eb('0xd')]||_0x600a7f['value'][_0x183b0c]['address']||'';_0x1604ba+='\x20<';_0x1604ba+=_0x600a7f['value'][_0x183b0c][_0x85eb('0x9')]?_0x600a7f[_0x85eb('0x8')][_0x183b0c][_0x85eb('0x9')]:_0x85eb('0xa')+random[_0x85eb('0xb')](0x6)+_0x85eb('0xc');_0x1604ba+='>';}}return _0x1604ba;}function parseEmail(_0x5acd3d,_0x24cf28,_0x7244fc){if(_0x24cf28[_0x85eb('0x14')]){var _0x4e8041=/)<[^<]*)*<\/script>/gi;while(_0x4e8041['test'](_0x24cf28['html'])){_0x24cf28['html']=_0x24cf28[_0x85eb('0x14')][_0x85eb('0x15')](_0x4e8041,'');}if(_0x24cf28[_0x85eb('0x14')][_0x85eb('0x16')](_0x85eb('0x17'))){var _0x3fc6da=[];_0x24cf28['attachments']['forEach'](_0x5b48d9=>{_0x3fc6da[_0x85eb('0x18')](_0x5b48d9[_0x85eb('0x19')]);});var _0x3f7a4d=/]+>/g;var _0x28b87d=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x312b3e=_0x24cf28[_0x85eb('0x14')]['replace'](_0x28b87d,_0x85eb('0x1a'));var _0x3453cd=_0x312b3e[_0x85eb('0x15')](_0x3f7a4d,_0x85eb('0x1b'));for(let _0x3e2326=0x0;_0x3e2326<_0x3fc6da['length'];_0x3e2326++){var _0x2e5aa3=_0x3453cd[_0x85eb('0x15')](_0x85eb('0x1b'),_0x85eb('0x1c')+_0x3fc6da[_0x3e2326]+_0x85eb('0x1d'));_0x3453cd=_0x2e5aa3;}_0x24cf28[_0x85eb('0x14')]=_0x3453cd;}_0x7244fc['body']=_0x24cf28['html'];}else{_0x7244fc[_0x85eb('0x1e')]=_0x24cf28['textAsHtml'];}if(_0x7244fc[_0x85eb('0x1e')]){_0x7244fc['body']=_0x7244fc[_0x85eb('0x1e')][_0x85eb('0x15')](/Empty\x20message

';if(_0x540c7a[_0x85eb('0x36')]){for(var _0x201aed=0x0;_0x201aed<_0x540c7a[_0x85eb('0x36')][_0x85eb('0xf')];_0x201aed++){var _0x1b1559=_0x540c7a[_0x85eb('0x36')][_0x201aed];_0x5c0156['message'][_0x85eb('0x22')][_0x85eb('0x18')]({'filename':_0x1b1559[_0x85eb('0x37')],'content':new Buffer(_0x1b1559[_0x85eb('0x38')])});}}}_0x331260(parseEmail(_0x5a1c15,_0x2a6baa,_0x5c0156));});}else{_0x2a6baa[_0x85eb('0x14')]=_0x85eb('0x39');_0x331260(parseEmail(_0x5a1c15,_0x2a6baa,_0x5c0156));}}else{_0x331260(parseEmail(_0x5a1c15,_0x2a6baa,_0x5c0156));}};exports[_0x85eb('0x3a')]=function(_0x202590){switch(_0x202590){case'gmail':return _0x85eb('0x3b');case _0x85eb('0x3c'):return _0x85eb('0x3d');case _0x85eb('0x3e'):return _0x85eb('0x3f');case _0x85eb('0x40'):return _0x85eb('0x41');}return _0x85eb('0x42');}; \ No newline at end of file +var _0xed3c=['_IMG','\x20]','body','textAsHtml','Empty\x20message

','Attachments','Data','getHost','gmail','imap.gmail.com','imap.mail.yahoo.com','hotmail','outlook.office365.com','lodash','moment','randomstring','path','node-tnef','../../../config/logger','email','head','value','address','@xcally.com','name','split','slice','join','length','isEmpty','anonymous','generate','html','test','replace','includes','attachments','push','filename'];(function(_0x1b80cc,_0xe29985){var _0x41a6df=function(_0x221e6e){while(--_0x221e6e){_0x1b80cc['push'](_0x1b80cc['shift']());}};_0x41a6df(++_0xe29985);}(_0xed3c,0x1a6));var _0xced3=function(_0x59ab65,_0x410a52){_0x59ab65=_0x59ab65-0x0;var _0x57db9b=_0xed3c[_0x59ab65];return _0x57db9b;};'use strict';var _=require(_0xced3('0x0'));var moment=require(_0xced3('0x1'));var random=require(_0xced3('0x2'));var fs=require('fs');var path=require(_0xced3('0x3'));var util=require('util');var tnef=require(_0xced3('0x4'));var logger=require(_0xced3('0x5'))(_0xced3('0x6'));var config=require('../../../config/environment');function getAddress(_0x51e500){var _0x3d3aa0=_[_0xced3('0x7')](_0x51e500[_0xced3('0x8')]);return _0x3d3aa0&&_0x3d3aa0[_0xced3('0x9')]?_0x3d3aa0['address']:'anonymous'+random['generate'](0x6)+_0xced3('0xa');}function getFirstName(_0x5f2f90){var _0x5bc7a7=_['head'](_0x5f2f90[_0xced3('0x8')]);if(_0x5bc7a7&&_0x5bc7a7[_0xced3('0xb')]){var _0x3e5a04=_0x5bc7a7[_0xced3('0xb')][_0xced3('0xc')](/\s+/);return _0x3e5a04['length']?_0x3e5a04[_0xced3('0xd')](0x0,-0x1)[_0xced3('0xe')]('\x20'):_0x5bc7a7[_0xced3('0xb')];}return'Anonymous';}function getLastName(_0x14f61c){var _0x19b8c2=_[_0xced3('0x7')](_0x14f61c[_0xced3('0x8')]);if(_0x19b8c2&&_0x19b8c2[_0xced3('0xb')]){var _0x45d9fc=_0x19b8c2[_0xced3('0xb')]['split'](/\s+/);return _0x45d9fc[_0xced3('0xf')]>0x1?_0x45d9fc['pop']():'';}return'';}function getMails(_0xf2db6f,_0x435616){var _0x20d099='';for(var _0x39e4aa=0x0;_0x39e4aa<_0x435616['value'][_0xced3('0xf')];_0x39e4aa+=0x1){if(_0x435616[_0xced3('0x8')][_0x39e4aa]['address']!==_0xf2db6f){if(!_[_0xced3('0x10')](_0x20d099)){_0x20d099+=',';}_0x20d099+=_0x435616[_0xced3('0x8')][_0x39e4aa][_0xced3('0xb')]||_0x435616[_0xced3('0x8')][_0x39e4aa]['address']||'';_0x20d099+='\x20<';_0x20d099+=_0x435616[_0xced3('0x8')][_0x39e4aa]['address']?_0x435616[_0xced3('0x8')][_0x39e4aa][_0xced3('0x9')]:_0xced3('0x11')+random[_0xced3('0x12')](0x6)+_0xced3('0xa');_0x20d099+='>';}}return _0x20d099;}function parseEmail(_0x688c97,_0xe0cf2e,_0x16d30d){if(_0xe0cf2e[_0xced3('0x13')]){var _0x17c011=/)<[^<]*)*<\/script>/gi;while(_0x17c011[_0xced3('0x14')](_0xe0cf2e['html'])){_0xe0cf2e['html']=_0xe0cf2e['html'][_0xced3('0x15')](_0x17c011,'');}if(_0xe0cf2e[_0xced3('0x13')][_0xced3('0x16')]('{_0x19d15c[_0xced3('0x18')](_0x559fa2[_0xced3('0x19')]);});var _0x219fa8=/]+>/g;var _0x15c6c5=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x50f7c1=_0xe0cf2e[_0xced3('0x13')][_0xced3('0x15')](_0x15c6c5,'_SRC');var _0x3fb4f9=_0x50f7c1['replace'](_0x219fa8,_0xced3('0x1a'));for(let _0x4123ba=0x0;_0x4123ba<_0x19d15c[_0xced3('0xf')];_0x4123ba++){var _0x23a570=_0x3fb4f9[_0xced3('0x15')]('_IMG','\x20[Attachment:\x20'+_0x19d15c[_0x4123ba]+_0xced3('0x1b'));_0x3fb4f9=_0x23a570;}_0xe0cf2e['html']=_0x3fb4f9;}_0x16d30d[_0xced3('0x1c')]=_0xe0cf2e[_0xced3('0x13')];}else{_0x16d30d['body']=_0xe0cf2e[_0xced3('0x1d')];}if(_0x16d30d[_0xced3('0x1c')]){_0x16d30d[_0xced3('0x1c')]=_0x16d30d[_0xced3('0x1c')][_0xced3('0x15')](/0x0){if(this[_0x3f152f+_0xa608('0x26')]>0x0&&this[_0x3f152f+_0xa608('0x25')]>=this[_0x3f152f+'Capacity']){return _0xa608('0x27');}else{return'working';}}else{return _0xa608('0x28');}};Agent[_0xa608('0x23')][_0xa608('0x22')]=function(){var _0x239761=[_0xa608('0x29'),_0xa608('0x2a'),_0xa608('0x2b'),_0xa608('0x2c'),_0xa608('0x2d'),'whatsapp'];for(var _0x491f35=0x0;_0x491f35<_0x239761[_0xa608('0x2e')];_0x491f35+=0x1){var _0x464270=this[_0xa608('0x24')](_0x239761[_0x491f35]);if(this[_0x239761[_0x491f35]+_0xa608('0x2f')]!==_0x464270){this[_0x239761[_0x491f35]+'StatusTime']=_[_0xa608('0x30')](moment()[_0xa608('0x31')]('x'));}this[_0x239761[_0x491f35]+_0xa608('0x2f')]=_0x464270;}var _0xf1de10={'id':this['id'],'name':this[_0xa608('0x6')],'online':this['online'],'voicePause':this[_0xa608('0x8')],'chatPause':this[_0xa608('0x9')],'mailPause':this['mailPause'],'smsPause':this[_0xa608('0xc')],'faxPause':this['faxPause'],'openchannelPause':this[_0xa608('0xd')],'chatStatus':this[_0xa608('0x32')],'chatStatusTime':this[_0xa608('0xf')],'chatCapacity':this[_0xa608('0x10')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this['mailStatus'],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0xa608('0x33')],'mailCurrentCapacity':this[_0xa608('0x13')],'faxStatus':this['faxStatus'],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0xa608('0x34')],'smsStatusTime':this[_0xa608('0x18')],'smsCapacity':this[_0xa608('0x35')],'smsCurrentCapacity':this[_0xa608('0x36')],'whatsappStatus':this[_0xa608('0x19')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0xa608('0x37')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0xa608('0x1d')],'openchannelCapacity':this[_0xa608('0x1e')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0xa608('0x20')],'busyQueue':this[_0xa608('0x21')]};var _0x490d71=md5(JSON['stringify'](_0xf1de10));if(this[_0xa608('0x1')]!==_0x490d71){this[_0xa608('0x1')]=_0x490d71;io[_0xa608('0x38')]('user:save',_0xf1de10);}};module[_0xa608('0x39')]=Agent; \ No newline at end of file +var _0xd253=['defaults','socket.io-emitter','name','online','voicePause','chatPause','mailPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','openchannelCapacity','openchannelCurrentCapacity','md5','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','chat','openchannel','sms','whatsapp','length','Status','StatusTime','format','faxPause','openchannelStatus','openchannelStatusTime','busy','stringify','emit','user:save','exports','lodash','moment','ioredis','../../../config/environment'];(function(_0x14ebd4,_0x508d9f){var _0x3bc217=function(_0x4cd781){while(--_0x4cd781){_0x14ebd4['push'](_0x14ebd4['shift']());}};_0x3bc217(++_0x508d9f);}(_0xd253,0x152));var _0x3d25=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xd253[_0x34bc30];return _0x5706de;};'use strict';var _=require(_0x3d25('0x0'));var moment=require(_0x3d25('0x1'));var md5=require('md5');var Redis=require(_0x3d25('0x2'));var config=require(_0x3d25('0x3'));config['redis']=_[_0x3d25('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x3d25('0x5'))(new Redis(config['redis']));function Agent(_0x4665ac){this['id']=_0x4665ac['id']||0x0;this[_0x3d25('0x6')]=_0x4665ac[_0x3d25('0x6')]||'';this[_0x3d25('0x7')]=_0x4665ac['online']||!![];this[_0x3d25('0x8')]=_0x4665ac[_0x3d25('0x8')]||![];this[_0x3d25('0x9')]=_0x4665ac[_0x3d25('0x9')]||![];this['mailPause']=_0x4665ac[_0x3d25('0xa')]||![];this['faxPause']=_0x4665ac['faxPause']||![];this[_0x3d25('0xb')]=_0x4665ac[_0x3d25('0xb')]||![];this[_0x3d25('0xc')]=_0x4665ac[_0x3d25('0xc')]||![];this[_0x3d25('0xd')]=_0x3d25('0xe');this[_0x3d25('0xf')]=0x0;this[_0x3d25('0x10')]=_0x4665ac['chatCapacity']||0x0;this[_0x3d25('0x11')]=0x0;this[_0x3d25('0x12')]=_0x3d25('0xe');this[_0x3d25('0x13')]=0x0;this[_0x3d25('0x14')]=_0x4665ac[_0x3d25('0x14')]||0x0;this[_0x3d25('0x15')]=0x0;this['faxStatus']='unknown';this[_0x3d25('0x16')]=0x0;this[_0x3d25('0x17')]=_0x4665ac['faxCapacity']||0x0;this['faxCurrentCapacity']=0x0;this[_0x3d25('0x18')]='unknown';this[_0x3d25('0x19')]=0x0;this[_0x3d25('0x1a')]=_0x4665ac[_0x3d25('0x1a')]||0x0;this[_0x3d25('0x1b')]=0x0;this[_0x3d25('0x1c')]=_0x3d25('0xe');this['whatsappStatusTime']=0x0;this[_0x3d25('0x1d')]=_0x4665ac[_0x3d25('0x1d')]||0x0;this['whatsappCurrentCapacity']=0x0;this['openchannelStatus']=_0x3d25('0xe');this['openchannelStatusTime']=0x0;this['openchannelCapacity']=_0x4665ac[_0x3d25('0x1e')]||0x0;this[_0x3d25('0x1f')]=0x0;this['busy']=![];this['busyQueue']=undefined;this[_0x3d25('0x20')]='';this['updateRealtime']();}Agent[_0x3d25('0x21')][_0x3d25('0x22')]=function(_0x35b995){if(this[_0x35b995+_0x3d25('0x23')]>0x0){if(this[_0x35b995+_0x3d25('0x24')]>0x0&&this[_0x35b995+_0x3d25('0x23')]>=this[_0x35b995+'Capacity']){return _0x3d25('0x25');}else{return _0x3d25('0x26');}}else{return _0x3d25('0x27');}};Agent[_0x3d25('0x21')]['updateRealtime']=function(){var _0x1387c4=[_0x3d25('0x28'),_0x3d25('0x29'),_0x3d25('0x2a'),'fax',_0x3d25('0x2b'),_0x3d25('0x2c')];for(var _0x4676a0=0x0;_0x4676a0<_0x1387c4[_0x3d25('0x2d')];_0x4676a0+=0x1){var _0x556303=this[_0x3d25('0x22')](_0x1387c4[_0x4676a0]);if(this[_0x1387c4[_0x4676a0]+_0x3d25('0x2e')]!==_0x556303){this[_0x1387c4[_0x4676a0]+_0x3d25('0x2f')]=_['toNumber'](moment()[_0x3d25('0x30')]('x'));}this[_0x1387c4[_0x4676a0]+'Status']=_0x556303;}var _0xa62739={'id':this['id'],'name':this[_0x3d25('0x6')],'online':this[_0x3d25('0x7')],'voicePause':this[_0x3d25('0x8')],'chatPause':this[_0x3d25('0x9')],'mailPause':this[_0x3d25('0xa')],'smsPause':this[_0x3d25('0xb')],'faxPause':this[_0x3d25('0x31')],'openchannelPause':this[_0x3d25('0xc')],'chatStatus':this[_0x3d25('0xd')],'chatStatusTime':this[_0x3d25('0xf')],'chatCapacity':this[_0x3d25('0x10')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x3d25('0x12')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x3d25('0x14')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x3d25('0x16')],'faxCapacity':this[_0x3d25('0x17')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x3d25('0x18')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x3d25('0x1a')],'smsCurrentCapacity':this[_0x3d25('0x1b')],'whatsappStatus':this[_0x3d25('0x1c')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0x3d25('0x1d')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x3d25('0x32')],'openchannelStatusTime':this[_0x3d25('0x33')],'openchannelCapacity':this[_0x3d25('0x1e')],'openchannelCurrentCapacity':this[_0x3d25('0x1f')],'busy':this[_0x3d25('0x34')],'busyQueue':this['busyQueue']};var _0x1e456f=md5(JSON[_0x3d25('0x35')](_0xa62739));if(this[_0x3d25('0x20')]!==_0x1e456f){this[_0x3d25('0x20')]=_0x1e456f;io[_0x3d25('0x36')](_0x3d25('0x37'),_0xa62739);}};module[_0x3d25('0x38')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index beffcaa..1ff101f 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 _0x0931=['map','Agents','prototype','loggedIn','paused','chatPause','available','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','mapAgentsId','waiting','updateRealtime','updateRouting','_rr'];(function(_0x4e8573,_0x12cc02){var _0x1113f5=function(_0x5bad6e){while(--_0x5bad6e){_0x4e8573['push'](_0x4e8573['shift']());}};_0x1113f5(++_0x12cc02);}(_0x0931,0x1cd));var _0x1093=function(_0x2e5cde,_0x37d0f6){_0x2e5cde=_0x2e5cde-0x0;var _0x249aad=_0x0931[_0x2e5cde];return _0x249aad;};'use strict';var _=require(_0x1093('0x0'));var md5=require(_0x1093('0x1'));var util=require(_0x1093('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x1093('0x3')]=_['defaults'](config[_0x1093('0x3')],{'host':_0x1093('0x4'),'port':0x18eb});var io=require(_0x1093('0x5'))(new Redis(config[_0x1093('0x3')]));function ChatQueue(_0x21e77c){this['id']=_0x21e77c['id']||0x0;this[_0x1093('0x6')]=_0x21e77c[_0x1093('0x6')]||'';this['timeout']=_0x21e77c[_0x1093('0x7')]||0xa;this[_0x1093('0x8')]=_0x21e77c[_0x1093('0x8')]||_0x1093('0x9');this['Agents']=_0x21e77c['Agents'];this[_0x1093('0xa')]={};this[_0x1093('0xb')]=0x0;this['md5']='';this['updateRouting']();this[_0x1093('0xc')]();}ChatQueue['prototype'][_0x1093('0xd')]=function(){var _0x48a05e=this[_0x1093('0xa')][_0x1093('0xe')];this['mapAgentsId']=_[_0x1093('0xf')](this[_0x1093('0x10')],'id');this[_0x1093('0xa')][_0x1093('0xe')]=_0x48a05e;};ChatQueue[_0x1093('0x11')][_0x1093('0xc')]=function(){this[_0x1093('0x12')]=0x0;this[_0x1093('0x13')]=0x0;for(var _0x122db9=0x0;_0x122db9=0x0?this[_0x1093('0x15')]:0x0;var _0x513747={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x1093('0x6')],'paused':this[_0x1093('0x13')],'waiting':this['waiting']};var _0x19345f=md5(JSON[_0x1093('0x16')](_0x513747));if(this[_0x1093('0x1')]!==_0x19345f){this[_0x1093('0x1')]=_0x19345f;io['to'](util[_0x1093('0x17')](_0x1093('0x18'),_0x513747[_0x1093('0x6')]))[_0x1093('0x19')](_0x1093('0x1a'),_0x513747);}};module[_0x1093('0x1b')]=ChatQueue; \ No newline at end of file +var _0x63e8=['lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','length','chatPause','paused','available','waiting','chat_queue:save','exports'];(function(_0x31b5de,_0x1c4fee){var _0x16ff09=function(_0x21c18c){while(--_0x21c18c){_0x31b5de['push'](_0x31b5de['shift']());}};_0x16ff09(++_0x1c4fee);}(_0x63e8,0x8c));var _0x863e=function(_0x32fbfe,_0x4e6b3e){_0x32fbfe=_0x32fbfe-0x0;var _0xd73960=_0x63e8[_0x32fbfe];return _0xd73960;};'use strict';var _=require(_0x863e('0x0'));var md5=require(_0x863e('0x1'));var util=require(_0x863e('0x2'));var Redis=require(_0x863e('0x3'));var config=require(_0x863e('0x4'));config[_0x863e('0x5')]=_[_0x863e('0x6')](config[_0x863e('0x5')],{'host':_0x863e('0x7'),'port':0x18eb});var io=require(_0x863e('0x8'))(new Redis(config[_0x863e('0x5')]));function ChatQueue(_0x500f27){this['id']=_0x500f27['id']||0x0;this[_0x863e('0x9')]=_0x500f27[_0x863e('0x9')]||'';this[_0x863e('0xa')]=_0x500f27['timeout']||0xa;this['strategy']=_0x500f27[_0x863e('0xb')]||_0x863e('0xc');this[_0x863e('0xd')]=_0x500f27[_0x863e('0xd')];this[_0x863e('0xe')]={};this['waiting']=0x0;this['md5']='';this[_0x863e('0xf')]();this['updateRealtime']();}ChatQueue[_0x863e('0x10')][_0x863e('0xf')]=function(){var _0x515ed8=this[_0x863e('0xe')][_0x863e('0x11')];this['mapAgentsId']=_[_0x863e('0x12')](this[_0x863e('0xd')],'id');this[_0x863e('0xe')][_0x863e('0x11')]=_0x515ed8;};ChatQueue[_0x863e('0x10')][_0x863e('0x13')]=function(){this[_0x863e('0x14')]=0x0;this['paused']=0x0;for(var _0x475bf4=0x0;_0x475bf4=0x0?this[_0x863e('0x18')]:0x0;var _0x558c8a={'id':this['id'],'available':this[_0x863e('0x18')],'loggedIn':this['loggedIn'],'name':this[_0x863e('0x9')],'paused':this[_0x863e('0x17')],'waiting':this[_0x863e('0x19')]};var _0x35493e=md5(JSON['stringify'](_0x558c8a));if(this[_0x863e('0x1')]!==_0x35493e){this[_0x863e('0x1')]=_0x35493e;io['to'](util['format']('chat:queue:%s',_0x558c8a['name']))['emit'](_0x863e('0x1a'),_0x558c8a);}};module[_0x863e('0x1b')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 91a4096..c079030 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 _0x41a9=['updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','length','online','faxPause','available','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting'];(function(_0x401b4c,_0x59dfec){var _0x165e24=function(_0x40f86a){while(--_0x40f86a){_0x401b4c['push'](_0x401b4c['shift']());}};_0x165e24(++_0x59dfec);}(_0x41a9,0x1b1));var _0x941a=function(_0x1f773d,_0x3b0be2){_0x1f773d=_0x1f773d-0x0;var _0x411122=_0x41a9[_0x1f773d];return _0x411122;};'use strict';var _=require(_0x941a('0x0'));var md5=require(_0x941a('0x1'));var util=require(_0x941a('0x2'));var Redis=require('ioredis');var config=require(_0x941a('0x3'));config[_0x941a('0x4')]=_[_0x941a('0x5')](config[_0x941a('0x4')],{'host':_0x941a('0x6'),'port':0x18eb});var io=require(_0x941a('0x7'))(new Redis(config[_0x941a('0x4')]));function FaxQueue(_0x59ef0e){this['id']=_0x59ef0e['id']||0x0;this[_0x941a('0x8')]=_0x59ef0e[_0x941a('0x8')]||'';this[_0x941a('0x9')]=_0x59ef0e[_0x941a('0x9')]||0xa;this[_0x941a('0xa')]=_0x59ef0e[_0x941a('0xa')]||_0x941a('0xb');this[_0x941a('0xc')]=_0x59ef0e[_0x941a('0xc')];this[_0x941a('0xd')]={};this[_0x941a('0xe')]=0x0;this[_0x941a('0x1')]='';this[_0x941a('0xf')]();this[_0x941a('0x10')]();}FaxQueue[_0x941a('0x11')][_0x941a('0xf')]=function(){var _0xb89bc7=this[_0x941a('0xd')]['_rr'];this['mapAgentsId']=_[_0x941a('0x12')](this['Agents'],'id');this[_0x941a('0xd')][_0x941a('0x13')]=_0xb89bc7;};FaxQueue[_0x941a('0x11')][_0x941a('0x10')]=function(){this[_0x941a('0x14')]=0x0;this[_0x941a('0x15')]=0x0;for(var _0x45ec88=0x0;_0x45ec88=0x0?this[_0x941a('0x19')]:0x0;var _0x1a1968={'id':this['id'],'available':this[_0x941a('0x19')],'loggedIn':this[_0x941a('0x14')],'name':this[_0x941a('0x8')],'paused':this[_0x941a('0x15')],'waiting':this[_0x941a('0xe')]};var _0x439b84=md5(JSON[_0x941a('0x1a')](_0x1a1968));if(this[_0x941a('0x1')]!==_0x439b84){this['md5']=_0x439b84;io['to'](util[_0x941a('0x1b')](_0x941a('0x1c'),_0x1a1968[_0x941a('0x8')]))[_0x941a('0x1d')](_0x941a('0x1e'),_0x1a1968);}};module[_0x941a('0x1f')]=FaxQueue; \ No newline at end of file +var _0x0686=['updateRealtime','prototype','_rr','map','loggedIn','length','faxPause','available','paused','stringify','format','fax:queue:%s','fax_queue:save','exports','lodash','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting'];(function(_0xeaf282,_0x4508ad){var _0x4641b4=function(_0x4a0e3b){while(--_0x4a0e3b){_0xeaf282['push'](_0xeaf282['shift']());}};_0x4641b4(++_0x4508ad);}(_0x0686,0x13a));var _0x6068=function(_0x2b9741,_0x5b9d30){_0x2b9741=_0x2b9741-0x0;var _0x52a7f8=_0x0686[_0x2b9741];return _0x52a7f8;};'use strict';var _=require(_0x6068('0x0'));var md5=require(_0x6068('0x1'));var util=require(_0x6068('0x2'));var Redis=require(_0x6068('0x3'));var config=require('../../../config/environment');config[_0x6068('0x4')]=_[_0x6068('0x5')](config[_0x6068('0x4')],{'host':_0x6068('0x6'),'port':0x18eb});var io=require(_0x6068('0x7'))(new Redis(config[_0x6068('0x4')]));function FaxQueue(_0x1f46f1){this['id']=_0x1f46f1['id']||0x0;this[_0x6068('0x8')]=_0x1f46f1[_0x6068('0x8')]||'';this[_0x6068('0x9')]=_0x1f46f1[_0x6068('0x9')]||0xa;this[_0x6068('0xa')]=_0x1f46f1[_0x6068('0xa')]||_0x6068('0xb');this[_0x6068('0xc')]=_0x1f46f1[_0x6068('0xc')];this[_0x6068('0xd')]={};this[_0x6068('0xe')]=0x0;this[_0x6068('0x1')]='';this[_0x6068('0xf')]();this[_0x6068('0x10')]();}FaxQueue[_0x6068('0x11')][_0x6068('0xf')]=function(){var _0xdf558f=this[_0x6068('0xd')][_0x6068('0x12')];this[_0x6068('0xd')]=_[_0x6068('0x13')](this[_0x6068('0xc')],'id');this[_0x6068('0xd')][_0x6068('0x12')]=_0xdf558f;};FaxQueue['prototype'][_0x6068('0x10')]=function(){this[_0x6068('0x14')]=0x0;this['paused']=0x0;for(var _0x3b1adf=0x0;_0x3b1adf=0x0?this[_0x6068('0x17')]:0x0;var _0x588f6f={'id':this['id'],'available':this[_0x6068('0x17')],'loggedIn':this[_0x6068('0x14')],'name':this[_0x6068('0x8')],'paused':this[_0x6068('0x18')],'waiting':this[_0x6068('0xe')]};var _0x11ca5a=md5(JSON[_0x6068('0x19')](_0x588f6f));if(this[_0x6068('0x1')]!==_0x11ca5a){this[_0x6068('0x1')]=_0x11ca5a;io['to'](util[_0x6068('0x1a')](_0x6068('0x1b'),_0x588f6f[_0x6068('0x8')]))['emit'](_0x6068('0x1c'),_0x588f6f);}};module[_0x6068('0x1d')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index aace815..5547a7d 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 _0x1bfd=['name','Intervals','exports'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x1bfd,0x180));var _0xd1bf=function(_0x578cc3,_0x1c96a4){_0x578cc3=_0x578cc3-0x0;var _0x217377=_0x1bfd[_0x578cc3];return _0x217377;};'use strict';function Interval(_0xfdb40){this['id']=_0xfdb40['id']||0x0;this[_0xd1bf('0x0')]=_0xfdb40[_0xd1bf('0x0')]||'';this[_0xd1bf('0x1')]=_0xfdb40[_0xd1bf('0x1')]||{};}module[_0xd1bf('0x2')]=Interval; \ No newline at end of file +var _0x67b7=['exports','name','Intervals'];(function(_0x33f1e2,_0x2111bb){var _0x581421=function(_0x3a2628){while(--_0x3a2628){_0x33f1e2['push'](_0x33f1e2['shift']());}};_0x581421(++_0x2111bb);}(_0x67b7,0x1c0));var _0x767b=function(_0x52cd61,_0x54d0d3){_0x52cd61=_0x52cd61-0x0;var _0x517ef3=_0x67b7[_0x52cd61];return _0x517ef3;};'use strict';function Interval(_0x52b5c1){this['id']=_0x52b5c1['id']||0x0;this[_0x767b('0x0')]=_0x52b5c1['name']||'';this[_0x767b('0x1')]=_0x52b5c1['Intervals']||{};}module[_0x767b('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 1dd212d..dddde2e 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 _0x81e2=['exports','lodash','defaults','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','length','online','loggedIn','available','paused','stringify','format','emit','mail_queue:save'];(function(_0xb7a68,_0x44335b){var _0x57dad1=function(_0x92294b){while(--_0x92294b){_0xb7a68['push'](_0xb7a68['shift']());}};_0x57dad1(++_0x44335b);}(_0x81e2,0xa3));var _0x281e=function(_0x2e40e5,_0x4514b7){_0x2e40e5=_0x2e40e5-0x0;var _0x16da07=_0x81e2[_0x2e40e5];return _0x16da07;};'use strict';var _=require(_0x281e('0x0'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0x281e('0x1')](config[_0x281e('0x2')],{'host':_0x281e('0x3'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x281e('0x2')]));function MailQueue(_0x43c5ca){this['id']=_0x43c5ca['id']||0x0;this[_0x281e('0x4')]=_0x43c5ca[_0x281e('0x4')]||'';this[_0x281e('0x5')]=_0x43c5ca[_0x281e('0x5')]||0xa;this[_0x281e('0x6')]=_0x43c5ca['strategy']||_0x281e('0x7');this['Agents']=_0x43c5ca[_0x281e('0x8')];this[_0x281e('0x9')]={};this[_0x281e('0xa')]=0x0;this[_0x281e('0xb')]='';this[_0x281e('0xc')]();this[_0x281e('0xd')]();}MailQueue[_0x281e('0xe')][_0x281e('0xc')]=function(){var _0x1a138d=this['mapAgentsId'][_0x281e('0xf')];this[_0x281e('0x9')]=_[_0x281e('0x10')](this[_0x281e('0x8')],'id');this[_0x281e('0x9')][_0x281e('0xf')]=_0x1a138d;};MailQueue[_0x281e('0xe')][_0x281e('0xd')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x3f4688=0x0;_0x3f4688=0x0?this[_0x281e('0x14')]:0x0;var _0x45800f={'id':this['id'],'available':this[_0x281e('0x14')],'loggedIn':this['loggedIn'],'name':this[_0x281e('0x4')],'paused':this['paused'],'waiting':this[_0x281e('0xa')]};var _0x54ad8c=md5(JSON[_0x281e('0x16')](_0x45800f));if(this[_0x281e('0xb')]!==_0x54ad8c){this[_0x281e('0xb')]=_0x54ad8c;io['to'](util[_0x281e('0x17')]('mail:queue:%s',_0x45800f['name']))[_0x281e('0x18')](_0x281e('0x19'),_0x45800f);}};module[_0x281e('0x1a')]=MailQueue; \ No newline at end of file +var _0x5059=['defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','paused','length','online','loggedIn','available','stringify','emit','mail_queue:save','exports','lodash','md5','util','ioredis','redis'];(function(_0x315556,_0x136f08){var _0x8e6b41=function(_0x52ca55){while(--_0x52ca55){_0x315556['push'](_0x315556['shift']());}};_0x8e6b41(++_0x136f08);}(_0x5059,0xb8));var _0x9505=function(_0x3dea7d,_0x2cd4ea){_0x3dea7d=_0x3dea7d-0x0;var _0x53919a=_0x5059[_0x3dea7d];return _0x53919a;};'use strict';var _=require(_0x9505('0x0'));var md5=require(_0x9505('0x1'));var util=require(_0x9505('0x2'));var Redis=require(_0x9505('0x3'));var config=require('../../../config/environment');config[_0x9505('0x4')]=_[_0x9505('0x5')](config[_0x9505('0x4')],{'host':_0x9505('0x6'),'port':0x18eb});var io=require(_0x9505('0x7'))(new Redis(config['redis']));function MailQueue(_0x459868){this['id']=_0x459868['id']||0x0;this['name']=_0x459868[_0x9505('0x8')]||'';this[_0x9505('0x9')]=_0x459868[_0x9505('0x9')]||0xa;this[_0x9505('0xa')]=_0x459868[_0x9505('0xa')]||_0x9505('0xb');this[_0x9505('0xc')]=_0x459868[_0x9505('0xc')];this[_0x9505('0xd')]={};this[_0x9505('0xe')]=0x0;this[_0x9505('0x1')]='';this[_0x9505('0xf')]();this[_0x9505('0x10')]();}MailQueue['prototype'][_0x9505('0xf')]=function(){var _0x1b53d5=this[_0x9505('0xd')][_0x9505('0x11')];this[_0x9505('0xd')]=_['map'](this[_0x9505('0xc')],'id');this[_0x9505('0xd')][_0x9505('0x11')]=_0x1b53d5;};MailQueue['prototype'][_0x9505('0x10')]=function(){this['loggedIn']=0x0;this[_0x9505('0x12')]=0x0;for(var _0x1b0c52=0x0;_0x1b0c52=0x0?this['available']:0x0;var _0x438784={'id':this['id'],'available':this[_0x9505('0x16')],'loggedIn':this[_0x9505('0x15')],'name':this[_0x9505('0x8')],'paused':this[_0x9505('0x12')],'waiting':this[_0x9505('0xe')]};var _0x4b6d70=md5(JSON[_0x9505('0x17')](_0x438784));if(this[_0x9505('0x1')]!==_0x4b6d70){this['md5']=_0x4b6d70;io['to'](util['format']('mail:queue:%s',_0x438784[_0x9505('0x8')]))[_0x9505('0x18')](_0x9505('0x19'),_0x438784);}};module[_0x9505('0x1a')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index fd6f5f0..a64c299 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 _0x5fc3=['format','openchannel:queue:%s','name','emit','openchannel_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','openchannelPause','available'];(function(_0x97d4b6,_0x1b8eab){var _0x364238=function(_0x496705){while(--_0x496705){_0x97d4b6['push'](_0x97d4b6['shift']());}};_0x364238(++_0x1b8eab);}(_0x5fc3,0xa8));var _0x35fc=function(_0x319cb9,_0x4b8d35){_0x319cb9=_0x319cb9-0x0;var _0x1735fc=_0x5fc3[_0x319cb9];return _0x1735fc;};'use strict';var _=require(_0x35fc('0x0'));var md5=require(_0x35fc('0x1'));var util=require('util');var Redis=require(_0x35fc('0x2'));var config=require(_0x35fc('0x3'));config[_0x35fc('0x4')]=_[_0x35fc('0x5')](config[_0x35fc('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0x6'))(new Redis(config[_0x35fc('0x4')]));function OpenchannelQueue(_0x186a06){this['id']=_0x186a06['id']||0x0;this['name']=_0x186a06['name']||'';this[_0x35fc('0x7')]=_0x186a06['timeout']||0xa;this[_0x35fc('0x8')]=_0x186a06[_0x35fc('0x8')]||_0x35fc('0x9');this[_0x35fc('0xa')]=_0x186a06[_0x35fc('0xa')];this[_0x35fc('0xb')]={};this[_0x35fc('0xc')]=0x0;this['md5']='';this[_0x35fc('0xd')]();this[_0x35fc('0xe')]();}OpenchannelQueue['prototype'][_0x35fc('0xd')]=function(){var _0x33f491=this['mapAgentsId'][_0x35fc('0xf')];this[_0x35fc('0xb')]=_['map'](this['Agents'],'id');this[_0x35fc('0xb')]['_rr']=_0x33f491;};OpenchannelQueue[_0x35fc('0x10')][_0x35fc('0xe')]=function(){this[_0x35fc('0x11')]=0x0;this[_0x35fc('0x12')]=0x0;for(var _0x38d9f2=0x0;_0x38d9f2=0x0?this['available']:0x0;var _0x41e165={'id':this['id'],'available':this[_0x35fc('0x14')],'loggedIn':this[_0x35fc('0x11')],'name':this['name'],'paused':this[_0x35fc('0x12')],'waiting':this[_0x35fc('0xc')]};var _0x465eb3=md5(JSON['stringify'](_0x41e165));if(this[_0x35fc('0x1')]!==_0x465eb3){this[_0x35fc('0x1')]=_0x465eb3;io['to'](util[_0x35fc('0x15')](_0x35fc('0x16'),_0x41e165[_0x35fc('0x17')]))[_0x35fc('0x18')](_0x35fc('0x19'),_0x41e165);}};module[_0x35fc('0x1a')]=OpenchannelQueue; \ No newline at end of file +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(_0x329946,_0x45d6ba){var _0x26a81f=function(_0x54ae89){while(--_0x54ae89){_0x329946['push'](_0x329946['shift']());}};_0x26a81f(++_0x45d6ba);}(_0x814b,0x1a2));var _0xb814=function(_0x385c76,_0xb97335){_0x385c76=_0x385c76-0x0;var _0x5c8367=_0x814b[_0x385c76];return _0x5c8367;};'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 diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 27ceff2..a3c34c6 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 _0xd0bb=['available','stringify','sms:queue:%s','emit','exports','lodash','md5','util','../../../config/environment','defaults','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','paused','length','smsPause'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x4b4889,_0x41cc03){_0x4b4889=_0x4b4889-0x0;var _0x38aac9=_0xd0bb[_0x4b4889];return _0x38aac9;};'use strict';var _=require(_0xbd0b('0x0'));var md5=require(_0xbd0b('0x1'));var util=require(_0xbd0b('0x2'));var Redis=require('ioredis');var config=require(_0xbd0b('0x3'));config['redis']=_[_0xbd0b('0x4')](config[_0xbd0b('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xbd0b('0x6'))(new Redis(config['redis']));function SmsQueue(_0x2236ce){this['id']=_0x2236ce['id']||0x0;this[_0xbd0b('0x7')]=_0x2236ce[_0xbd0b('0x7')]||'';this[_0xbd0b('0x8')]=_0x2236ce[_0xbd0b('0x8')]||0xa;this['strategy']=_0x2236ce[_0xbd0b('0x9')]||_0xbd0b('0xa');this[_0xbd0b('0xb')]=_0x2236ce[_0xbd0b('0xb')];this[_0xbd0b('0xc')]={};this['waiting']=0x0;this['md5']='';this[_0xbd0b('0xd')]();this[_0xbd0b('0xe')]();}SmsQueue['prototype'][_0xbd0b('0xd')]=function(){var _0x196beb=this['mapAgentsId'][_0xbd0b('0xf')];this[_0xbd0b('0xc')]=_[_0xbd0b('0x10')](this[_0xbd0b('0xb')],'id');this[_0xbd0b('0xc')][_0xbd0b('0xf')]=_0x196beb;};SmsQueue[_0xbd0b('0x11')][_0xbd0b('0xe')]=function(){this[_0xbd0b('0x12')]=0x0;this[_0xbd0b('0x13')]=0x0;for(var _0x2d4664=0x0;_0x2d4664=0x0?this[_0xbd0b('0x16')]:0x0;var _0x2f58a3={'id':this['id'],'available':this[_0xbd0b('0x16')],'loggedIn':this[_0xbd0b('0x12')],'name':this['name'],'paused':this[_0xbd0b('0x13')],'waiting':this['waiting']};var _0x9c2404=md5(JSON[_0xbd0b('0x17')](_0x2f58a3));if(this[_0xbd0b('0x1')]!==_0x9c2404){this[_0xbd0b('0x1')]=_0x9c2404;io['to'](util['format'](_0xbd0b('0x18'),_0x2f58a3[_0xbd0b('0x7')]))[_0xbd0b('0x19')]('sms_queue:save',_0x2f58a3);}};module[_0xbd0b('0x1a')]=SmsQueue; \ No newline at end of file +var _0x25a3=['md5','util','../../../config/environment','defaults','redis','localhost','name','timeout','strategy','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','Agents','paused','length','online','loggedIn','smsPause','available','stringify','format','sms:queue:%s','emit','exports','lodash'];(function(_0xd40384,_0xdd518e){var _0x2a8cfc=function(_0x309d07){while(--_0x309d07){_0xd40384['push'](_0xd40384['shift']());}};_0x2a8cfc(++_0xdd518e);}(_0x25a3,0x121));var _0x325a=function(_0x1d9774,_0x38278c){_0x1d9774=_0x1d9774-0x0;var _0x30c9a0=_0x25a3[_0x1d9774];return _0x30c9a0;};'use strict';var _=require(_0x325a('0x0'));var md5=require(_0x325a('0x1'));var util=require(_0x325a('0x2'));var Redis=require('ioredis');var config=require(_0x325a('0x3'));config['redis']=_[_0x325a('0x4')](config[_0x325a('0x5')],{'host':_0x325a('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x325a('0x5')]));function SmsQueue(_0x35dea7){this['id']=_0x35dea7['id']||0x0;this[_0x325a('0x7')]=_0x35dea7['name']||'';this['timeout']=_0x35dea7[_0x325a('0x8')]||0xa;this[_0x325a('0x9')]=_0x35dea7[_0x325a('0x9')]||_0x325a('0xa');this['Agents']=_0x35dea7['Agents'];this[_0x325a('0xb')]={};this[_0x325a('0xc')]=0x0;this[_0x325a('0x1')]='';this[_0x325a('0xd')]();this[_0x325a('0xe')]();}SmsQueue[_0x325a('0xf')]['updateRouting']=function(){var _0xaeca66=this[_0x325a('0xb')]['_rr'];this[_0x325a('0xb')]=_[_0x325a('0x10')](this[_0x325a('0x11')],'id');this[_0x325a('0xb')]['_rr']=_0xaeca66;};SmsQueue['prototype'][_0x325a('0xe')]=function(){this['loggedIn']=0x0;this[_0x325a('0x12')]=0x0;for(var _0xa8dc3a=0x0;_0xa8dc3a=0x0?this[_0x325a('0x17')]:0x0;var _0x4fbd50={'id':this['id'],'available':this['available'],'loggedIn':this[_0x325a('0x15')],'name':this[_0x325a('0x7')],'paused':this[_0x325a('0x12')],'waiting':this[_0x325a('0xc')]};var _0x1ea710=md5(JSON[_0x325a('0x18')](_0x4fbd50));if(this[_0x325a('0x1')]!==_0x1ea710){this[_0x325a('0x1')]=_0x1ea710;io['to'](util[_0x325a('0x19')](_0x325a('0x1a'),_0x4fbd50[_0x325a('0x7')]))[_0x325a('0x1b')]('sms_queue:save',_0x4fbd50);}};module[_0x325a('0x1c')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index b24cdea..98e110d 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 _0x5618=['util','ioredis','defaults','redis','localhost','socket.io-emitter','name','timeout','beepall','Agents','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','paused','length','online','whatsappPause','available','waiting','stringify','format','whatsapp:queue:%s','emit','exports','lodash','md5'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x5618,0x10c));var _0x8561=function(_0x58e867,_0x46a0b8){_0x58e867=_0x58e867-0x0;var _0x22f58b=_0x5618[_0x58e867];return _0x22f58b;};'use strict';var _=require(_0x8561('0x0'));var md5=require(_0x8561('0x1'));var util=require(_0x8561('0x2'));var Redis=require(_0x8561('0x3'));var config=require('../../../config/environment');config['redis']=_[_0x8561('0x4')](config[_0x8561('0x5')],{'host':_0x8561('0x6'),'port':0x18eb});var io=require(_0x8561('0x7'))(new Redis(config['redis']));function WhatsappQueue(_0x10b15d){this['id']=_0x10b15d['id']||0x0;this['name']=_0x10b15d[_0x8561('0x8')]||'';this[_0x8561('0x9')]=_0x10b15d['timeout']||0xa;this['strategy']=_0x10b15d['strategy']||_0x8561('0xa');this[_0x8561('0xb')]=_0x10b15d[_0x8561('0xb')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x8561('0x1')]='';this[_0x8561('0xc')]();this[_0x8561('0xd')]();}WhatsappQueue[_0x8561('0xe')][_0x8561('0xc')]=function(){var _0x5cd42e=this[_0x8561('0xf')][_0x8561('0x10')];this[_0x8561('0xf')]=_[_0x8561('0x11')](this[_0x8561('0xb')],'id');this[_0x8561('0xf')][_0x8561('0x10')]=_0x5cd42e;};WhatsappQueue[_0x8561('0xe')][_0x8561('0xd')]=function(){this[_0x8561('0x12')]=0x0;this[_0x8561('0x13')]=0x0;for(var _0x52358c=0x0;_0x52358c=0x0?this[_0x8561('0x17')]:0x0;var _0x3450a7={'id':this['id'],'available':this[_0x8561('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x8561('0x8')],'paused':this[_0x8561('0x13')],'waiting':this[_0x8561('0x18')]};var _0x5ac366=md5(JSON[_0x8561('0x19')](_0x3450a7));if(this[_0x8561('0x1')]!==_0x5ac366){this['md5']=_0x5ac366;io['to'](util[_0x8561('0x1a')](_0x8561('0x1b'),_0x3450a7[_0x8561('0x8')]))[_0x8561('0x1c')]('whatsapp_queue:save',_0x3450a7);}};module[_0x8561('0x1d')]=WhatsappQueue; \ No newline at end of file +var _0xcb86=['whatsapp_queue:save','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','length','online','whatsappPause','paused','available','loggedIn','waiting','whatsapp:queue:%s','emit'];(function(_0x7d7ba7,_0x205b42){var _0x2da964=function(_0x5a83be){while(--_0x5a83be){_0x7d7ba7['push'](_0x7d7ba7['shift']());}};_0x2da964(++_0x205b42);}(_0xcb86,0x92));var _0x6cb8=function(_0xc9e196,_0x2234aa){_0xc9e196=_0xc9e196-0x0;var _0x17f4bc=_0xcb86[_0xc9e196];return _0x17f4bc;};'use strict';var _=require(_0x6cb8('0x0'));var md5=require(_0x6cb8('0x1'));var util=require(_0x6cb8('0x2'));var Redis=require('ioredis');var config=require(_0x6cb8('0x3'));config[_0x6cb8('0x4')]=_[_0x6cb8('0x5')](config[_0x6cb8('0x4')],{'host':_0x6cb8('0x6'),'port':0x18eb});var io=require(_0x6cb8('0x7'))(new Redis(config[_0x6cb8('0x4')]));function WhatsappQueue(_0x353864){this['id']=_0x353864['id']||0x0;this[_0x6cb8('0x8')]=_0x353864['name']||'';this['timeout']=_0x353864[_0x6cb8('0x9')]||0xa;this[_0x6cb8('0xa')]=_0x353864['strategy']||_0x6cb8('0xb');this[_0x6cb8('0xc')]=_0x353864[_0x6cb8('0xc')];this[_0x6cb8('0xd')]={};this['waiting']=0x0;this[_0x6cb8('0x1')]='';this[_0x6cb8('0xe')]();this[_0x6cb8('0xf')]();}WhatsappQueue[_0x6cb8('0x10')]['updateRouting']=function(){var _0x19e81d=this[_0x6cb8('0xd')][_0x6cb8('0x11')];this[_0x6cb8('0xd')]=_[_0x6cb8('0x12')](this['Agents'],'id');this[_0x6cb8('0xd')][_0x6cb8('0x11')]=_0x19e81d;};WhatsappQueue[_0x6cb8('0x10')][_0x6cb8('0xf')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x3e5499=0x0;_0x3e5499=0x0?this['available']:0x0;var _0x53015={'id':this['id'],'available':this[_0x6cb8('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x6cb8('0x8')],'paused':this[_0x6cb8('0x16')],'waiting':this[_0x6cb8('0x19')]};var _0x4f7242=md5(JSON['stringify'](_0x53015));if(this['md5']!==_0x4f7242){this[_0x6cb8('0x1')]=_0x4f7242;io['to'](util['format'](_0x6cb8('0x1a'),_0x53015[_0x6cb8('0x8')]))[_0x6cb8('0x1b')](_0x6cb8('0x1c'),_0x53015);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index b48b4a7..49a2f89 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _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(_0x287fc5,_0x4b3eb1){var _0x24229b=function(_0x70b191){while(--_0x70b191){_0x287fc5['push'](_0x287fc5['shift']());}};_0x24229b(++_0x4b3eb1);}(_0xb10b,0x12a));var _0xbb10=function(_0x241424,_0x25eb5d){_0x241424=_0x241424-0x0;var _0x3da798=_0xb10b[_0x241424];return _0x3da798;};'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 diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 6c21e12..4c89241 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 _0xf526=['AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','Request','UpdateChatInteraction','updateChatInteraction','addTags'];(function(_0x1c78f2,_0xef1192){var _0x2b4e6d=function(_0xd0bc3a){while(--_0xd0bc3a){_0x1c78f2['push'](_0x1c78f2['shift']());}};_0x2b4e6d(++_0xef1192);}(_0xf526,0x10a));var _0x6f52=function(_0x12ea20,_0x5db2b4){_0x12ea20=_0x12ea20-0x0;var _0x43c152=_0xf526[_0x12ea20];return _0x43c152;};'use strict';var client=require(_0x6f52('0x0'));exports[_0x6f52('0x1')]=function(_0x18db4c,_0x3ac56e){return client[_0x6f52('0x2')](_0x6f52('0x3'),{'body':_0x3ac56e,'options':{'where':{'id':_0x18db4c}},'log':_0x6f52('0x4')});};exports[_0x6f52('0x5')]=function(_0x368d18,_0x3cd5c1){return client[_0x6f52('0x2')](_0x6f52('0x6'),{'body':_0x3cd5c1,'options':{'where':{'id':_0x368d18}},'log':_0x6f52('0x7')});}; \ No newline at end of file +var _0xc226=['addTagsToChatInteraction','../client','update','UpdateChatInteraction','updateChatInteraction','addTags','Request'];(function(_0x11c382,_0xb6ada1){var _0x9e2a3a=function(_0x19c9e4){while(--_0x19c9e4){_0x11c382['push'](_0x11c382['shift']());}};_0x9e2a3a(++_0xb6ada1);}(_0xc226,0x120));var _0x6c22=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xc226[_0xf0bcac];return _0x4e4c65;};'use strict';var client=require(_0x6c22('0x0'));exports[_0x6c22('0x1')]=function(_0x11114c,_0x264e2c){return client['Request'](_0x6c22('0x2'),{'body':_0x264e2c,'options':{'where':{'id':_0x11114c}},'log':_0x6c22('0x3')});};exports[_0x6c22('0x4')]=function(_0x53eb4d,_0x50b816){return client[_0x6c22('0x5')]('AddTagsToChatInteraction',{'body':_0x50b816,'options':{'where':{'id':_0x53eb4d}},'log':_0x6c22('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 80d40aa..7051d04 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 _0xe2f8=['Request','createChatMessage','create'];(function(_0x4a363f,_0x36480a){var _0x391de0=function(_0x55a220){while(--_0x55a220){_0x4a363f['push'](_0x4a363f['shift']());}};_0x391de0(++_0x36480a);}(_0xe2f8,0x1d0));var _0x8e2f=function(_0x517cd3,_0x582753){_0x517cd3=_0x517cd3-0x0;var _0x4d1cf1=_0xe2f8[_0x517cd3];return _0x4d1cf1;};'use strict';var client=require('../client');exports[_0x8e2f('0x0')]=function(_0x54513a){return client[_0x8e2f('0x1')]('CreateChatMessage',{'body':_0x54513a,'log':_0x8e2f('0x2')});}; \ No newline at end of file +var _0xaea0=['create','Request','createChatMessage','../client'];(function(_0x12f9e3,_0x3fadc1){var _0x2de0c8=function(_0x31b5c5){while(--_0x31b5c5){_0x12f9e3['push'](_0x12f9e3['shift']());}};_0x2de0c8(++_0x3fadc1);}(_0xaea0,0x137));var _0x0aea=function(_0x231dda,_0x5b04cc){_0x231dda=_0x231dda-0x0;var _0x3f88cb=_0xaea0[_0x231dda];return _0x3f88cb;};'use strict';var client=require(_0x0aea('0x0'));exports[_0x0aea('0x1')]=function(_0x512638){return client[_0x0aea('0x2')]('CreateChatMessage',{'body':_0x512638,'log':_0x0aea('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index e778cc6..d09ae61 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 _0x2b83=['Request','name','timeout','strategy','online','getChatQueues'];(function(_0x3fb225,_0x47d95d){var _0x5122d3=function(_0xa489cc){while(--_0xa489cc){_0x3fb225['push'](_0x3fb225['shift']());}};_0x5122d3(++_0x47d95d);}(_0x2b83,0x1d3));var _0x32b8=function(_0x25289c,_0x16ae20){_0x25289c=_0x25289c-0x0;var _0x48a71e=_0x2b83[_0x25289c];return _0x48a71e;};'use strict';var client=require('../client');exports[_0x32b8('0x0')]=function(){return function(){return client[_0x32b8('0x1')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x32b8('0x2'),_0x32b8('0x3'),_0x32b8('0x4')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x32b8('0x2'),_0x32b8('0x5'),'chatPause']}]},'log':_0x32b8('0x0')});};}; \ No newline at end of file +var _0x6688=['../client','getChatQueues','Request','name','timeout','strategy','User','Agents','online'];(function(_0x13cab0,_0x14d825){var _0x38804f=function(_0x1bffaf){while(--_0x1bffaf){_0x13cab0['push'](_0x13cab0['shift']());}};_0x38804f(++_0x14d825);}(_0x6688,0x10e));var _0x8668=function(_0x529cc7,_0x42a08a){_0x529cc7=_0x529cc7-0x0;var _0x27400b=_0x6688[_0x529cc7];return _0x27400b;};'use strict';var client=require(_0x8668('0x0'));exports[_0x8668('0x1')]=function(){return function(){return client[_0x8668('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x8668('0x3'),_0x8668('0x4'),_0x8668('0x5')],'include':[{'model':_0x8668('0x6'),'as':_0x8668('0x7'),'attributes':['id',_0x8668('0x3'),_0x8668('0x8'),'chatPause']}]},'log':_0x8668('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 817a3ee..03862ef 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 _0x1df5=['DESC','../client','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0x40dd56,_0x726ca5){var _0x4f850f=function(_0x5f899e){while(--_0x5f899e){_0x40dd56['push'](_0x40dd56['shift']());}};_0x4f850f(++_0x726ca5);}(_0x1df5,0xfd));var _0x51df=function(_0x549bdc,_0x3914d7){_0x549bdc=_0x549bdc-0x0;var _0x30b0ad=_0x1df5[_0x549bdc];return _0x30b0ad;};'use strict';var client=require(_0x51df('0x0'));exports[_0x51df('0x1')]=function(_0x22acff){return client[_0x51df('0x2')](_0x51df('0x3'),{'body':_0x22acff,'log':'CreateChatQueueReport'});};exports[_0x51df('0x4')]=function(_0x457292,_0x1c491f){return client[_0x51df('0x2')](_0x51df('0x5'),{'body':_0x1c491f,'options':{'where':{'uniqueid':_0x457292},'order':[['id',_0x51df('0x6')]],'limit':0x1},'log':_0x51df('0x5')});}; \ No newline at end of file +var _0x12fd=['update','UpdateChatQueueReport','DESC','../client','create','Request','CreateChatQueueReport'];(function(_0x47b308,_0xf06c3){var _0x4931cf=function(_0x26b9ed){while(--_0x26b9ed){_0x47b308['push'](_0x47b308['shift']());}};_0x4931cf(++_0xf06c3);}(_0x12fd,0x199));var _0xd12f=function(_0x2a293e,_0x570130){_0x2a293e=_0x2a293e-0x0;var _0x502edb=_0x12fd[_0x2a293e];return _0x502edb;};'use strict';var client=require(_0xd12f('0x0'));exports[_0xd12f('0x1')]=function(_0x718bb5){return client[_0xd12f('0x2')](_0xd12f('0x3'),{'body':_0x718bb5,'log':'CreateChatQueueReport'});};exports[_0xd12f('0x4')]=function(_0x37f6b4,_0x13efed){return client[_0xd12f('0x2')](_0xd12f('0x5'),{'body':_0x13efed,'options':{'where':{'uniqueid':_0x37f6b4},'order':[['id',_0xd12f('0x6')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index d497629..dbae3f1 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x38854e,_0x23cbc9){var _0x3f8415=function(_0x4e493e){while(--_0x4e493e){_0x38854e['push'](_0x38854e['shift']());}};_0x3f8415(++_0x23cbc9);}(_0x7a54,0x106));var _0x47a5=function(_0x4dbf80,_0x1e1353){_0x4dbf80=_0x4dbf80-0x0;var _0x23680d=_0x7a54[_0x4dbf80];return _0x23680d;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x2181b1,_0x569637){var _0x530548=function(_0x4b31f1){while(--_0x4b31f1){_0x2181b1['push'](_0x2181b1['shift']());}};_0x530548(++_0x569637);}(_0x7a54,0x106));var _0x47a5=function(_0x258538,_0x1f1efd){_0x258538=_0x258538-0x0;var _0x1a40a4=_0x7a54[_0x258538];return _0x1a40a4;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 1125b7d..3da3783 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 _0x6a9b=['Request','CreateFaxMessage','createFaxMessage','../client'];(function(_0x3e69ae,_0x366e8d){var _0x3d7f42=function(_0x5df093){while(--_0x5df093){_0x3e69ae['push'](_0x3e69ae['shift']());}};_0x3d7f42(++_0x366e8d);}(_0x6a9b,0x6f));var _0xb6a9=function(_0x51dae4,_0xa7f367){_0x51dae4=_0x51dae4-0x0;var _0x27d0b0=_0x6a9b[_0x51dae4];return _0x27d0b0;};'use strict';var client=require(_0xb6a9('0x0'));exports['create']=function(_0x474c3){return client[_0xb6a9('0x1')](_0xb6a9('0x2'),{'body':_0x474c3,'log':_0xb6a9('0x3')});}; \ No newline at end of file +var _0x4297=['../client','create','Request'];(function(_0x3ba924,_0x3b99f0){var _0x4cc1df=function(_0x15bf28){while(--_0x15bf28){_0x3ba924['push'](_0x3ba924['shift']());}};_0x4cc1df(++_0x3b99f0);}(_0x4297,0x1d7));var _0x7429=function(_0x392373,_0x5258aa){_0x392373=_0x392373-0x0;var _0x185a2f=_0x4297[_0x392373];return _0x185a2f;};'use strict';var client=require(_0x7429('0x0'));exports[_0x7429('0x1')]=function(_0x4eb2a2){return client[_0x7429('0x2')]('CreateFaxMessage',{'body':_0x4eb2a2,'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 623df60..93a126b 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 _0x2ea5=['Agents','online','../client','getFaxQueues','Request','GetFaxQueue','name','timeout','strategy','User'];(function(_0x27f323,_0x2d6212){var _0x557b7b=function(_0x51f28c){while(--_0x51f28c){_0x27f323['push'](_0x27f323['shift']());}};_0x557b7b(++_0x2d6212);}(_0x2ea5,0xfc));var _0x52ea=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x2ea5[_0x1ac595];return _0x455fff;};'use strict';var client=require(_0x52ea('0x0'));exports[_0x52ea('0x1')]=function(){return function(){return client[_0x52ea('0x2')](_0x52ea('0x3'),{'options':{'raw':![],'attributes':['id',_0x52ea('0x4'),_0x52ea('0x5'),_0x52ea('0x6')],'include':[{'model':_0x52ea('0x7'),'as':_0x52ea('0x8'),'attributes':['id',_0x52ea('0x4'),_0x52ea('0x9'),'faxPause']}]},'log':_0x52ea('0x1')});};}; \ No newline at end of file +var _0x3ef8=['strategy','User','Agents','online','faxPause','getFaxQueues','GetFaxQueue'];(function(_0x488019,_0x3428db){var _0x14d9d5=function(_0x2e9941){while(--_0x2e9941){_0x488019['push'](_0x488019['shift']());}};_0x14d9d5(++_0x3428db);}(_0x3ef8,0x12b));var _0x83ef=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x3ef8[_0xa464c9];return _0x3d73c4;};'use strict';var client=require('../client');exports[_0x83ef('0x0')]=function(){return function(){return client['Request'](_0x83ef('0x1'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x83ef('0x2')],'include':[{'model':_0x83ef('0x3'),'as':_0x83ef('0x4'),'attributes':['id','name',_0x83ef('0x5'),_0x83ef('0x6')]}]},'log':_0x83ef('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index ff1c70d..9b440b4 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 _0xfdee=['DESC','../client','create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport'];(function(_0x4811de,_0x59dddc){var _0x4e5fd5=function(_0x1b816e){while(--_0x1b816e){_0x4811de['push'](_0x4811de['shift']());}};_0x4e5fd5(++_0x59dddc);}(_0xfdee,0xf6));var _0xefde=function(_0x56d9c0,_0x23cac4){_0x56d9c0=_0x56d9c0-0x0;var _0x183ba1=_0xfdee[_0x56d9c0];return _0x183ba1;};'use strict';var client=require(_0xefde('0x0'));exports[_0xefde('0x1')]=function(_0xd55f1){return client[_0xefde('0x2')](_0xefde('0x3'),{'body':_0xd55f1,'log':_0xefde('0x3')});};exports[_0xefde('0x4')]=function(_0x3598a2,_0x2cdefe){return client[_0xefde('0x2')](_0xefde('0x5'),{'body':_0x2cdefe,'options':{'where':{'uniqueid':_0x3598a2},'order':[['id',_0xefde('0x6')]],'limit':0x1},'log':_0xefde('0x5')});}; \ No newline at end of file +var _0x4b4e=['Request','UpdateFaxQueueReport','DESC','../client','create','CreateFaxQueueReport'];(function(_0xca52ad,_0x13e88c){var _0x417201=function(_0x53dcc8){while(--_0x53dcc8){_0xca52ad['push'](_0xca52ad['shift']());}};_0x417201(++_0x13e88c);}(_0x4b4e,0x1e3));var _0xe4b4=function(_0x449d6d,_0x51c441){_0x449d6d=_0x449d6d-0x0;var _0x5e2ea7=_0x4b4e[_0x449d6d];return _0x5e2ea7;};'use strict';var client=require(_0xe4b4('0x0'));exports[_0xe4b4('0x1')]=function(_0x55896e){return client['Request']('CreateFaxQueueReport',{'body':_0x55896e,'log':_0xe4b4('0x2')});};exports['update']=function(_0x8bbf56,_0x1a64bc){return client[_0xe4b4('0x3')](_0xe4b4('0x4'),{'body':_0x1a64bc,'options':{'where':{'uniqueid':_0x8bbf56},'order':[['id',_0xe4b4('0x5')]],'limit':0x1},'log':_0xe4b4('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index abfbcf0..de97f93 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 _0x0f05=['../client','getIntervals','name','Interval','interval'];(function(_0x4216ab,_0x531eca){var _0x100516=function(_0x452d55){while(--_0x452d55){_0x4216ab['push'](_0x4216ab['shift']());}};_0x100516(++_0x531eca);}(_0x0f05,0x159));var _0x50f0=function(_0x5661fa,_0x37cb28){_0x5661fa=_0x5661fa-0x0;var _0x581087=_0x0f05[_0x5661fa];return _0x581087;};'use strict';var client=require(_0x50f0('0x0'));exports[_0x50f0('0x1')]=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x50f0('0x2')],'include':[{'model':_0x50f0('0x3'),'as':'Intervals','attributes':['id','name',_0x50f0('0x4')]}]},'log':_0x50f0('0x1')});};}; \ No newline at end of file +var _0xfecc=['Interval','getIntervals','../client','Request','name'];(function(_0x15a563,_0x4334ae){var _0x2b1e54=function(_0x20578e){while(--_0x20578e){_0x15a563['push'](_0x15a563['shift']());}};_0x2b1e54(++_0x4334ae);}(_0xfecc,0x1b0));var _0xcfec=function(_0x5a6db4,_0x42b26a){_0x5a6db4=_0x5a6db4-0x0;var _0x248555=_0xfecc[_0x5a6db4];return _0x248555;};'use strict';var client=require(_0xcfec('0x0'));exports['getIntervals']=function(){return function(){return client[_0xcfec('0x1')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xcfec('0x2')],'include':[{'model':_0xcfec('0x3'),'as':'Intervals','attributes':['id',_0xcfec('0x2'),'interval']}]},'log':_0xcfec('0x4')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 07197c4..1a25dfb 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 _0x7708=['update','AddTagsToMailInteraction','../client'];(function(_0x24a332,_0xdd7a7){var _0x589b19=function(_0x55c710){while(--_0x55c710){_0x24a332['push'](_0x24a332['shift']());}};_0x589b19(++_0xdd7a7);}(_0x7708,0x188));var _0x8770=function(_0x188a93,_0xaf57db){_0x188a93=_0x188a93-0x0;var _0x23b40d=_0x7708[_0x188a93];return _0x23b40d;};'use strict';var client=require(_0x8770('0x0'));exports[_0x8770('0x1')]=function(_0x5ce108,_0x141ddf){return client['Request']('UpdateMailInteraction',{'body':_0x141ddf,'options':{'where':{'id':_0x5ce108}},'log':'updateMailInteraction'});};exports['addTags']=function(_0x182d52,_0x1a796d){return client['Request'](_0x8770('0x2'),{'body':_0x1a796d,'options':{'where':{'id':_0x182d52}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x160f=['UpdateMailInteraction','updateMailInteraction','addTags','Request','addTagsToChatInteraction','../client','update'];(function(_0xfdd6b6,_0x19497a){var _0x464439=function(_0x147e70){while(--_0x147e70){_0xfdd6b6['push'](_0xfdd6b6['shift']());}};_0x464439(++_0x19497a);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xf160('0x0'));exports[_0xf160('0x1')]=function(_0x2d4cde,_0x2966aa){return client['Request'](_0xf160('0x2'),{'body':_0x2966aa,'options':{'where':{'id':_0x2d4cde}},'log':_0xf160('0x3')});};exports[_0xf160('0x4')]=function(_0x3b2d7b,_0x194331){return client[_0xf160('0x5')]('AddTagsToMailInteraction',{'body':_0x194331,'options':{'where':{'id':_0x3b2d7b}},'log':_0xf160('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 1befcec..0db65f9 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 _0xb054=['CreateMailMessage','../client','Request'];(function(_0x1ae91a,_0x122766){var _0x50e53c=function(_0x596334){while(--_0x596334){_0x1ae91a['push'](_0x1ae91a['shift']());}};_0x50e53c(++_0x122766);}(_0xb054,0xa6));var _0x4b05=function(_0x22a81b,_0x51edff){_0x22a81b=_0x22a81b-0x0;var _0x4540aa=_0xb054[_0x22a81b];return _0x4540aa;};'use strict';var client=require(_0x4b05('0x0'));exports['create']=function(_0x287814){return client[_0x4b05('0x1')](_0x4b05('0x2'),{'body':_0x287814,'log':'createMailMessage'});}; \ No newline at end of file +var _0xc7f6=['createMailMessage','../client','create','CreateMailMessage'];(function(_0x215c98,_0x2fc120){var _0x571f0d=function(_0x1cfedd){while(--_0x1cfedd){_0x215c98['push'](_0x215c98['shift']());}};_0x571f0d(++_0x2fc120);}(_0xc7f6,0xe5));var _0x6c7f=function(_0x29dc8b,_0x1db0bb){_0x29dc8b=_0x29dc8b-0x0;var _0x48f174=_0xc7f6[_0x29dc8b];return _0x48f174;};'use strict';var client=require(_0x6c7f('0x0'));exports[_0x6c7f('0x1')]=function(_0x5b6b62){return client['Request'](_0x6c7f('0x2'),{'body':_0x5b6b62,'log':_0x6c7f('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index bf37f28..aae86fb 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 _0xa118=['timeout','strategy','Agents','online','mailPause','../client','getMailQueues'];(function(_0x2461c8,_0x328d5f){var _0x57e245=function(_0xe2d617){while(--_0xe2d617){_0x2461c8['push'](_0x2461c8['shift']());}};_0x57e245(++_0x328d5f);}(_0xa118,0x98));var _0x8a11=function(_0x32aa68,_0x102e89){_0x32aa68=_0x32aa68-0x0;var _0x292133=_0xa118[_0x32aa68];return _0x292133;};'use strict';var client=require(_0x8a11('0x0'));exports[_0x8a11('0x1')]=function(){return function(){return client['Request']('GetMailQueue',{'options':{'raw':![],'attributes':['id','name',_0x8a11('0x2'),_0x8a11('0x3')],'include':[{'model':'User','as':_0x8a11('0x4'),'attributes':['id','name',_0x8a11('0x5'),_0x8a11('0x6')]}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0x02fe=['getMailQueues','Request','GetMailQueue','name','timeout','strategy','User','Agents','online','mailPause'];(function(_0x15ed18,_0x39eeb3){var _0x50292c=function(_0x521a78){while(--_0x521a78){_0x15ed18['push'](_0x15ed18['shift']());}};_0x50292c(++_0x39eeb3);}(_0x02fe,0x1b8));var _0xe02f=function(_0x241dc4,_0x2e79a0){_0x241dc4=_0x241dc4-0x0;var _0x542df2=_0x02fe[_0x241dc4];return _0x542df2;};'use strict';var client=require('../client');exports[_0xe02f('0x0')]=function(){return function(){return client[_0xe02f('0x1')](_0xe02f('0x2'),{'options':{'raw':![],'attributes':['id',_0xe02f('0x3'),_0xe02f('0x4'),_0xe02f('0x5')],'include':[{'model':_0xe02f('0x6'),'as':_0xe02f('0x7'),'attributes':['id',_0xe02f('0x3'),_0xe02f('0x8'),_0xe02f('0x9')]}]},'log':_0xe02f('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 177c193..acd4cf4 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 _0xc8b2=['Request','UpdateMailQueueReport','../client','create','CreateMailQueueReport'];(function(_0x383882,_0x57747d){var _0x53c0e3=function(_0x359ed4){while(--_0x359ed4){_0x383882['push'](_0x383882['shift']());}};_0x53c0e3(++_0x57747d);}(_0xc8b2,0x13d));var _0x2c8b=function(_0x57ccb0,_0x3c127b){_0x57ccb0=_0x57ccb0-0x0;var _0x85da70=_0xc8b2[_0x57ccb0];return _0x85da70;};'use strict';var client=require(_0x2c8b('0x0'));exports[_0x2c8b('0x1')]=function(_0x17017a){return client['Request']('CreateMailQueueReport',{'body':_0x17017a,'log':_0x2c8b('0x2')});};exports['update']=function(_0x4ee40c,_0x1a0813){return client[_0x2c8b('0x3')](_0x2c8b('0x4'),{'body':_0x1a0813,'options':{'where':{'uniqueid':_0x4ee40c},'order':[['id','DESC']],'limit':0x1},'log':_0x2c8b('0x4')});}; \ No newline at end of file +var _0x68ea=['../client','create','Request','CreateMailQueueReport','update','UpdateMailQueueReport'];(function(_0x11d947,_0xcbf4d8){var _0x47929e=function(_0x7771dd){while(--_0x7771dd){_0x11d947['push'](_0x11d947['shift']());}};_0x47929e(++_0xcbf4d8);}(_0x68ea,0x15c));var _0xa68e=function(_0x36d0af,_0x3f6f87){_0x36d0af=_0x36d0af-0x0;var _0x132e35=_0x68ea[_0x36d0af];return _0x132e35;};'use strict';var client=require(_0xa68e('0x0'));exports[_0xa68e('0x1')]=function(_0xb054b0){return client[_0xa68e('0x2')](_0xa68e('0x3'),{'body':_0xb054b0,'log':'CreateMailQueueReport'});};exports[_0xa68e('0x4')]=function(_0x5ad97c,_0xa11a57){return client['Request'](_0xa68e('0x5'),{'body':_0xa11a57,'options':{'where':{'uniqueid':_0x5ad97c},'order':[['id','DESC']],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 1df5c7f..8d4287f 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 _0xb736=['updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','update','Request','UpdateOpenchannelInteraction'];(function(_0x4b9c5d,_0x450ae0){var _0x37a9ee=function(_0x5a8d4f){while(--_0x5a8d4f){_0x4b9c5d['push'](_0x4b9c5d['shift']());}};_0x37a9ee(++_0x450ae0);}(_0xb736,0x19b));var _0x6b73=function(_0x3dfedc,_0x58cf03){_0x3dfedc=_0x3dfedc-0x0;var _0xf30ac1=_0xb736[_0x3dfedc];return _0xf30ac1;};'use strict';var client=require('../client');exports[_0x6b73('0x0')]=function(_0x1f6276,_0x6539c2){return client[_0x6b73('0x1')](_0x6b73('0x2'),{'body':_0x6539c2,'options':{'where':{'id':_0x1f6276}},'log':_0x6b73('0x3')});};exports[_0x6b73('0x4')]=function(_0x18c200,_0x142af1){return client[_0x6b73('0x1')](_0x6b73('0x5'),{'body':_0x142af1,'options':{'where':{'id':_0x18c200}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x7418=['update','Request','updateOpenchannelInteraction','addTagsToChatInteraction'];(function(_0x4c44b2,_0x4d0183){var _0x3d6a36=function(_0x42b9ca){while(--_0x42b9ca){_0x4c44b2['push'](_0x4c44b2['shift']());}};_0x3d6a36(++_0x4d0183);}(_0x7418,0x1b4));var _0x8741=function(_0x16b786,_0x42ec13){_0x16b786=_0x16b786-0x0;var _0xb37261=_0x7418[_0x16b786];return _0xb37261;};'use strict';var client=require('../client');exports[_0x8741('0x0')]=function(_0x40a432,_0x183e13){return client[_0x8741('0x1')]('UpdateOpenchannelInteraction',{'body':_0x183e13,'options':{'where':{'id':_0x40a432}},'log':_0x8741('0x2')});};exports['addTags']=function(_0x54043b,_0x4bcd99){return client[_0x8741('0x1')]('AddTagsToOpenchannelInteraction',{'body':_0x4bcd99,'options':{'where':{'id':_0x54043b}},'log':_0x8741('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index e8f59d8..42066ed 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 _0x20e8=['../client','create','createOpenchannelMessage'];(function(_0x17a2d8,_0x2cf1ae){var _0x10ca3b=function(_0x4e61d4){while(--_0x4e61d4){_0x17a2d8['push'](_0x17a2d8['shift']());}};_0x10ca3b(++_0x2cf1ae);}(_0x20e8,0x1e0));var _0x820e=function(_0x528db6,_0x347ae3){_0x528db6=_0x528db6-0x0;var _0x23f0ca=_0x20e8[_0x528db6];return _0x23f0ca;};'use strict';var client=require(_0x820e('0x0'));exports[_0x820e('0x1')]=function(_0x18a87){return client['Request']('CreateOpenchannelMessage',{'body':_0x18a87,'log':_0x820e('0x2')});}; \ No newline at end of file +var _0xd003=['Request','CreateOpenchannelMessage','createOpenchannelMessage','../client','create'];(function(_0x270a54,_0x307ff6){var _0x4d07d0=function(_0x59ac5a){while(--_0x59ac5a){_0x270a54['push'](_0x270a54['shift']());}};_0x4d07d0(++_0x307ff6);}(_0xd003,0x8f));var _0x3d00=function(_0x257d74,_0x4228fa){_0x257d74=_0x257d74-0x0;var _0x1663c5=_0xd003[_0x257d74];return _0x1663c5;};'use strict';var client=require(_0x3d00('0x0'));exports[_0x3d00('0x1')]=function(_0x70b8ed){return client[_0x3d00('0x2')](_0x3d00('0x3'),{'body':_0x70b8ed,'log':_0x3d00('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 4f691ee..984330a 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 _0xa508=['getOpenchannelQueues','GetOpenchannelQueue','name','User','Agents','openchannelPause','../client'];(function(_0x5af0cf,_0x4d9469){var _0x24a9d7=function(_0x257685){while(--_0x257685){_0x5af0cf['push'](_0x5af0cf['shift']());}};_0x24a9d7(++_0x4d9469);}(_0xa508,0x187));var _0x8a50=function(_0x1705e9,_0x394f32){_0x1705e9=_0x1705e9-0x0;var _0x33285a=_0xa508[_0x1705e9];return _0x33285a;};'use strict';var client=require(_0x8a50('0x0'));exports[_0x8a50('0x1')]=function(){return function(){return client['Request'](_0x8a50('0x2'),{'options':{'raw':![],'attributes':['id',_0x8a50('0x3'),'timeout','strategy'],'include':[{'model':_0x8a50('0x4'),'as':_0x8a50('0x5'),'attributes':['id',_0x8a50('0x3'),'online',_0x8a50('0x6')]}]},'log':_0x8a50('0x1')});};}; \ No newline at end of file +var _0x1542=['name','Agents','online','../client','getOpenchannelQueues','Request','GetOpenchannelQueue'];(function(_0x3f47bd,_0x1b43fe){var _0x4b318e=function(_0x5354b6){while(--_0x5354b6){_0x3f47bd['push'](_0x3f47bd['shift']());}};_0x4b318e(++_0x1b43fe);}(_0x1542,0x73));var _0x2154=function(_0x2f55c2,_0xb0a593){_0x2f55c2=_0x2f55c2-0x0;var _0x9b9cd2=_0x1542[_0x2f55c2];return _0x9b9cd2;};'use strict';var client=require(_0x2154('0x0'));exports[_0x2154('0x1')]=function(){return function(){return client[_0x2154('0x2')](_0x2154('0x3'),{'options':{'raw':![],'attributes':['id',_0x2154('0x4'),'timeout','strategy'],'include':[{'model':'User','as':_0x2154('0x5'),'attributes':['id',_0x2154('0x4'),_0x2154('0x6'),'openchannelPause']}]},'log':_0x2154('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 7d0399a..1169cbc 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 _0x8ee4=['DESC','UpdateOpenchannelQueueReport','../client','Request','CreateOpenchannelQueueReport'];(function(_0x2dae7d,_0x4e5117){var _0x28adfa=function(_0x17cf5b){while(--_0x17cf5b){_0x2dae7d['push'](_0x2dae7d['shift']());}};_0x28adfa(++_0x4e5117);}(_0x8ee4,0x115));var _0x48ee=function(_0x2a6b91,_0x345d4b){_0x2a6b91=_0x2a6b91-0x0;var _0x34d8f4=_0x8ee4[_0x2a6b91];return _0x34d8f4;};'use strict';var client=require(_0x48ee('0x0'));exports['create']=function(_0x10731d){return client[_0x48ee('0x1')]('CreateOpenchannelQueueReport',{'body':_0x10731d,'log':_0x48ee('0x2')});};exports['update']=function(_0x3d1857,_0x397714){return client[_0x48ee('0x1')]('UpdateOpenchannelQueueReport',{'body':_0x397714,'options':{'where':{'uniqueid':_0x3d1857},'order':[['id',_0x48ee('0x3')]],'limit':0x1},'log':_0x48ee('0x4')});}; \ No newline at end of file +var _0xf6ed=['CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','../client','Request'];(function(_0x30fa66,_0x48e393){var _0x345a96=function(_0x25c2d4){while(--_0x25c2d4){_0x30fa66['push'](_0x30fa66['shift']());}};_0x345a96(++_0x48e393);}(_0xf6ed,0x1ce));var _0xdf6e=function(_0x3ecd21,_0x1ecc86){_0x3ecd21=_0x3ecd21-0x0;var _0x424e76=_0xf6ed[_0x3ecd21];return _0x424e76;};'use strict';var client=require(_0xdf6e('0x0'));exports['create']=function(_0x1b5752){return client[_0xdf6e('0x1')](_0xdf6e('0x2'),{'body':_0x1b5752,'log':'CreateOpenchannelQueueReport'});};exports['update']=function(_0x474c72,_0x484a22){return client['Request'](_0xdf6e('0x3'),{'body':_0x484a22,'options':{'where':{'uniqueid':_0x474c72},'order':[['id','DESC']],'limit':0x1},'log':_0xdf6e('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 09be807..7b61be8 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 _0x0a9a=['updateSmsInteraction','AddTagsToSmsInteraction','addTagsToSmsInteraction','update','Request','UpdateSmsInteraction'];(function(_0x2727d5,_0x1b77e){var _0x2c0e50=function(_0x266e0b){while(--_0x266e0b){_0x2727d5['push'](_0x2727d5['shift']());}};_0x2c0e50(++_0x1b77e);}(_0x0a9a,0x183));var _0xa0a9=function(_0x19e985,_0x207f86){_0x19e985=_0x19e985-0x0;var _0xf860ee=_0x0a9a[_0x19e985];return _0xf860ee;};'use strict';var client=require('../client');exports[_0xa0a9('0x0')]=function(_0x51baa8,_0x3b1a40){return client[_0xa0a9('0x1')](_0xa0a9('0x2'),{'body':_0x3b1a40,'options':{'where':{'id':_0x51baa8}},'log':_0xa0a9('0x3')});};exports['addTags']=function(_0x317a94,_0x360be5){return client['Request'](_0xa0a9('0x4'),{'body':_0x360be5,'options':{'where':{'id':_0x317a94}},'log':_0xa0a9('0x5')});}; \ No newline at end of file +var _0x5fd1=['addTagsToSmsInteraction','../client','Request','addTags','AddTagsToSmsInteraction'];(function(_0x23f2ef,_0x15a70f){var _0x443e26=function(_0x34e1ff){while(--_0x34e1ff){_0x23f2ef['push'](_0x23f2ef['shift']());}};_0x443e26(++_0x15a70f);}(_0x5fd1,0x155));var _0x15fd=function(_0x25c968,_0x176e63){_0x25c968=_0x25c968-0x0;var _0x50a6d4=_0x5fd1[_0x25c968];return _0x50a6d4;};'use strict';var client=require(_0x15fd('0x0'));exports['update']=function(_0x1b4cdd,_0x570048){return client[_0x15fd('0x1')]('UpdateSmsInteraction',{'body':_0x570048,'options':{'where':{'id':_0x1b4cdd}},'log':'updateSmsInteraction'});};exports[_0x15fd('0x2')]=function(_0x3138f3,_0x411b0e){return client['Request'](_0x15fd('0x3'),{'body':_0x411b0e,'options':{'where':{'id':_0x3138f3}},'log':_0x15fd('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 709d2f8..bdf3946 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 _0xc6ac=['../client','create','Request','CreateSmsMessage','createSmsMessage'];(function(_0x4012de,_0x4cf8f7){var _0x323aa0=function(_0x275de3){while(--_0x275de3){_0x4012de['push'](_0x4012de['shift']());}};_0x323aa0(++_0x4cf8f7);}(_0xc6ac,0x1e0));var _0xcc6a=function(_0x36c6b8,_0xc912e7){_0x36c6b8=_0x36c6b8-0x0;var _0x2ea5f6=_0xc6ac[_0x36c6b8];return _0x2ea5f6;};'use strict';var client=require(_0xcc6a('0x0'));exports[_0xcc6a('0x1')]=function(_0x12743e){return client[_0xcc6a('0x2')](_0xcc6a('0x3'),{'body':_0x12743e,'log':_0xcc6a('0x4')});}; \ No newline at end of file +var _0x1246=['CreateSmsMessage','createSmsMessage','../client','create','Request'];(function(_0x504592,_0x29271f){var _0x57e564=function(_0x1fbf13){while(--_0x1fbf13){_0x504592['push'](_0x504592['shift']());}};_0x57e564(++_0x29271f);}(_0x1246,0x75));var _0x6124=function(_0x4f06b2,_0x56e4f9){_0x4f06b2=_0x4f06b2-0x0;var _0x4de832=_0x1246[_0x4f06b2];return _0x4de832;};'use strict';var client=require(_0x6124('0x0'));exports[_0x6124('0x1')]=function(_0x4e207c){return client[_0x6124('0x2')](_0x6124('0x3'),{'body':_0x4e207c,'log':_0x6124('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index eb273c0..d917f5c 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 _0xcb91=['smsPause','Request','GetSmsQueue','name','timeout','User','Agents','online'];(function(_0x3a0984,_0x5b1dc4){var _0x5819cc=function(_0x203b98){while(--_0x203b98){_0x3a0984['push'](_0x3a0984['shift']());}};_0x5819cc(++_0x5b1dc4);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xfedc72,_0x292f02){_0xfedc72=_0xfedc72-0x0;var _0x2c7c78=_0xcb91[_0xfedc72];return _0x2c7c78;};'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 +var _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x2e70e1,_0x5976d6){var _0x2b16f5=function(_0x4ac3fa){while(--_0x4ac3fa){_0x2e70e1['push'](_0x2e70e1['shift']());}};_0x2b16f5(++_0x5976d6);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0xb7e7[_0x4d8ed9];return _0x1e2140;};'use strict';var client=require(_0x7b7e('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x7b7e('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x7b7e('0x2'),'timeout',_0x7b7e('0x3')],'include':[{'model':'User','as':_0x7b7e('0x4'),'attributes':['id',_0x7b7e('0x2'),_0x7b7e('0x5'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index c701d71..f7b8649 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x32be74,_0x1c6d78){var _0x59407f=function(_0x3f31e3){while(--_0x3f31e3){_0x32be74['push'](_0x32be74['shift']());}};_0x59407f(++_0x1c6d78);}(_0x008c,0x188));var _0xc008=function(_0x180237,_0xfd4959){_0x180237=_0x180237-0x0;var _0x56fa74=_0x008c[_0x180237];return _0x56fa74;};'use strict';var client=require(_0xc008('0x0'));exports[_0xc008('0x1')]=function(_0x15aadc){return client[_0xc008('0x2')](_0xc008('0x3'),{'body':_0x15aadc,'log':'CreateSmsQueueReport'});};exports[_0xc008('0x4')]=function(_0x47063f,_0x10b33c){return client[_0xc008('0x2')](_0xc008('0x5'),{'body':_0x10b33c,'options':{'where':{'uniqueid':_0x47063f},'order':[['id',_0xc008('0x6')]],'limit':0x1},'log':_0xc008('0x5')});}; \ No newline at end of file +var _0x008c=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x1bf75d,_0x1d3920){var _0x5cce12=function(_0x5b5170){while(--_0x5b5170){_0x1bf75d['push'](_0x1bf75d['shift']());}};_0x5cce12(++_0x1d3920);}(_0x008c,0x188));var _0xc008=function(_0x1c80bd,_0x356976){_0x1c80bd=_0x1c80bd-0x0;var _0x15b7fc=_0x008c[_0x1c80bd];return _0x15b7fc;};'use strict';var client=require(_0xc008('0x0'));exports[_0xc008('0x1')]=function(_0x15aadc){return client[_0xc008('0x2')](_0xc008('0x3'),{'body':_0x15aadc,'log':'CreateSmsQueueReport'});};exports[_0xc008('0x4')]=function(_0x47063f,_0x10b33c){return client[_0xc008('0x2')](_0xc008('0x5'),{'body':_0x10b33c,'options':{'where':{'uniqueid':_0x47063f},'order':[['id',_0xc008('0x6')]],'limit':0x1},'log':_0xc008('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index f24c44b..0cc8cbc 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(_0x216600,_0x1f2edc){var _0x1c029d=function(_0x457bfd){while(--_0x457bfd){_0x216600['push'](_0x216600['shift']());}};_0x1c029d(++_0x1f2edc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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(_0x1c70e2,_0x4dddc2){var _0x5467f5=function(_0x489e43){while(--_0x489e43){_0x1c70e2['push'](_0x1c70e2['shift']());}};_0x5467f5(++_0x4dddc2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index f01c60d..22a573f 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 _0x4d68=['addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0x4d68,0x1c3));var _0x84d6=function(_0x1305e3,_0x43a724){_0x1305e3=_0x1305e3-0x0;var _0x1068e9=_0x4d68[_0x1305e3];return _0x1068e9;};'use strict';var client=require(_0x84d6('0x0'));exports[_0x84d6('0x1')]=function(_0x2e2636,_0xc5c972){return client[_0x84d6('0x2')](_0x84d6('0x3'),{'body':_0xc5c972,'options':{'where':{'id':_0x2e2636}},'log':'updateWhatsappInteraction'});};exports[_0x84d6('0x4')]=function(_0x5ee114,_0x3a2f0b){return client['Request'](_0x84d6('0x5'),{'body':_0x3a2f0b,'options':{'where':{'id':_0x5ee114}},'log':_0x84d6('0x6')});}; \ No newline at end of file +var _0x7e02=['addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','AddTagsToWhatsappInteraction'];(function(_0x5137c9,_0x3d193f){var _0x548778=function(_0x286cab){while(--_0x286cab){_0x5137c9['push'](_0x5137c9['shift']());}};_0x548778(++_0x3d193f);}(_0x7e02,0x71));var _0x27e0=function(_0x1cea7b,_0x37f5f4){_0x1cea7b=_0x1cea7b-0x0;var _0x5618d1=_0x7e02[_0x1cea7b];return _0x5618d1;};'use strict';var client=require(_0x27e0('0x0'));exports[_0x27e0('0x1')]=function(_0x2c4d4d,_0x6bde30){return client[_0x27e0('0x2')](_0x27e0('0x3'),{'body':_0x6bde30,'options':{'where':{'id':_0x2c4d4d}},'log':_0x27e0('0x4')});};exports['addTags']=function(_0x4fa613,_0x3d4f41){return client['Request'](_0x27e0('0x5'),{'body':_0x3d4f41,'options':{'where':{'id':_0x4fa613}},'log':_0x27e0('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 50f80a3..c05f549 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 _0xfab3=['Request','CreateWhatsappMessage','createWhatsappMessage','../client','create'];(function(_0x1177a6,_0x267dc6){var _0x9eaef8=function(_0x44012f){while(--_0x44012f){_0x1177a6['push'](_0x1177a6['shift']());}};_0x9eaef8(++_0x267dc6);}(_0xfab3,0x1bb));var _0x3fab=function(_0x4b4fae,_0x186962){_0x4b4fae=_0x4b4fae-0x0;var _0x2eeaf7=_0xfab3[_0x4b4fae];return _0x2eeaf7;};'use strict';var client=require(_0x3fab('0x0'));exports[_0x3fab('0x1')]=function(_0x5f1ada){return client[_0x3fab('0x2')](_0x3fab('0x3'),{'body':_0x5f1ada,'log':_0x3fab('0x4')});}; \ No newline at end of file +var _0xf23e=['CreateWhatsappMessage','createWhatsappMessage','../client','Request'];(function(_0x192376,_0x3401bd){var _0x5af2cc=function(_0x2c7fa6){while(--_0x2c7fa6){_0x192376['push'](_0x192376['shift']());}};_0x5af2cc(++_0x3401bd);}(_0xf23e,0x196));var _0xef23=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xf23e[_0xaa1b3e];return _0x454d7d;};'use strict';var client=require(_0xef23('0x0'));exports['create']=function(_0x406c37){return client[_0xef23('0x1')](_0xef23('0x2'),{'body':_0x406c37,'log':_0xef23('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index c2d40a6..38dcb31 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 _0xd775=['GetWhatsappQueue','name','timeout','strategy','User','online','getWhatsappQueues','../client'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0xd775,0x7f));var _0x5d77=function(_0x1cad6e,_0x3add35){_0x1cad6e=_0x1cad6e-0x0;var _0x5297d2=_0xd775[_0x1cad6e];return _0x5297d2;};'use strict';var client=require(_0x5d77('0x0'));exports['getWhatsappQueues']=function(){return function(){return client['Request'](_0x5d77('0x1'),{'options':{'raw':![],'attributes':['id',_0x5d77('0x2'),_0x5d77('0x3'),_0x5d77('0x4')],'include':[{'model':_0x5d77('0x5'),'as':'Agents','attributes':['id','name',_0x5d77('0x6'),'whatsappPause']}]},'log':_0x5d77('0x7')});};}; \ No newline at end of file +var _0xa07f=['User','Agents','whatsappPause','../client','getWhatsappQueues','GetWhatsappQueue','name','timeout','strategy'];(function(_0x4e4130,_0x1041a7){var _0x43d996=function(_0x167a98){while(--_0x167a98){_0x4e4130['push'](_0x4e4130['shift']());}};_0x43d996(++_0x1041a7);}(_0xa07f,0xa5));var _0xfa07=function(_0x2ddcaa,_0x5d26eb){_0x2ddcaa=_0x2ddcaa-0x0;var _0x3dc791=_0xa07f[_0x2ddcaa];return _0x3dc791;};'use strict';var client=require(_0xfa07('0x0'));exports[_0xfa07('0x1')]=function(){return function(){return client['Request'](_0xfa07('0x2'),{'options':{'raw':![],'attributes':['id',_0xfa07('0x3'),_0xfa07('0x4'),_0xfa07('0x5')],'include':[{'model':_0xfa07('0x6'),'as':_0xfa07('0x7'),'attributes':['id',_0xfa07('0x3'),'online',_0xfa07('0x8')]}]},'log':_0xfa07('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 81f0181..6d0739a 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 _0xf015=['../client','CreateWhatsappQueueReport','update','Request','UpdateWhatsappQueueReport'];(function(_0x3296fc,_0x51bd2a){var _0x450188=function(_0x466c75){while(--_0x466c75){_0x3296fc['push'](_0x3296fc['shift']());}};_0x450188(++_0x51bd2a);}(_0xf015,0x113));var _0x5f01=function(_0x2a9ea9,_0x24f2a0){_0x2a9ea9=_0x2a9ea9-0x0;var _0x295684=_0xf015[_0x2a9ea9];return _0x295684;};'use strict';var client=require(_0x5f01('0x0'));exports['create']=function(_0x3daa52){return client['Request'](_0x5f01('0x1'),{'body':_0x3daa52,'log':'CreateWhatsappQueueReport'});};exports[_0x5f01('0x2')]=function(_0x39b4be,_0x319bc7){return client[_0x5f01('0x3')]('UpdateWhatsappQueueReport',{'body':_0x319bc7,'options':{'where':{'uniqueid':_0x39b4be},'order':[['id','DESC']],'limit':0x1},'log':_0x5f01('0x4')});}; \ No newline at end of file +var _0x939f=['UpdateWhatsappQueueReport','../client','Request','CreateWhatsappQueueReport','update','DESC'];(function(_0x1ca2d3,_0x196df1){var _0x43565d=function(_0x9f5103){while(--_0x9f5103){_0x1ca2d3['push'](_0x1ca2d3['shift']());}};_0x43565d(++_0x196df1);}(_0x939f,0x1b7));var _0xf939=function(_0x441e17,_0x340ea9){_0x441e17=_0x441e17-0x0;var _0x3c9eb4=_0x939f[_0x441e17];return _0x3c9eb4;};'use strict';var client=require(_0xf939('0x0'));exports['create']=function(_0x5822a6){return client[_0xf939('0x1')](_0xf939('0x2'),{'body':_0x5822a6,'log':'CreateWhatsappQueueReport'});};exports[_0xf939('0x3')]=function(_0x6ab49d,_0x18a0e2){return client[_0xf939('0x1')]('UpdateWhatsappQueueReport',{'body':_0x18a0e2,'options':{'where':{'uniqueid':_0x6ab49d},'order':[['id',_0xf939('0x4')]],'limit':0x1},'log':_0xf939('0x5')});}; \ 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 a225ef6..8042758 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 _0x0a1f=['toLowerCase','consequence','validate','length','error','[%s][AGENT]\x20%s','map','message','join','stop','agents','timeout','atimeout','channel','format','[%s][AGENT]\x20ROUTING\x20STOPPED','close','rules','complete','[%s][AGENT]\x20ROUTING\x20END','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','lodash','util','seq-queue','../../../../config/logger','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0a1f,0x18f));var _0xf0a1=function(_0x4a22e5,_0xffdc52){_0x4a22e5=_0x4a22e5-0x0;var _0x4ebc8d=_0x0a1f[_0x4a22e5];return _0x4ebc8d;};'use strict';var schema=require('validate');var _=require(_0xf0a1('0x0'));var util=require(_0xf0a1('0x1'));var seqqueue=require(_0xf0a1('0x2'));var logger=require(_0xf0a1('0x3'))(_0xf0a1('0x4'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0xf0a1('0x5'),'required':!![],'message':_0xf0a1('0x6')},'timeout':{'type':'number','message':_0xf0a1('0x7')}});function writeLog(_0x4491a8,_0x14fc7e,_0x328be3){return logger['info'](util['format']('[%s][AGENT][NAME:%s][STATUS:%s]',_0x4491a8,_0x14fc7e['name'],_0x328be3));}function handleFindAgent(_0x481e9e){return function(_0x31ca64){return _0x31ca64[_0xf0a1('0x8')]['toLowerCase']()===_0x481e9e[_0xf0a1('0x9')]();};}exports[_0xf0a1('0xa')]=function(_0x1448cf,_0x1096ca,_0x4b1db9,_0x161d4a){return function(_0x53b830){try{var _0x176ab7={'name':_0x1096ca[0x0],'timeout':_0x1096ca[0x1]};var _0x4a7245=queue[_0xf0a1('0xb')](_0x176ab7,{'typecast':!![]});if(_0x4a7245[_0xf0a1('0xc')]){logger[_0xf0a1('0xd')](_0xf0a1('0xe'),_0x1448cf,_[_0xf0a1('0xf')](_0x4a7245,_0xf0a1('0x10'))[_0xf0a1('0x11')](',\x20'));_0x53b830[_0xf0a1('0x12')]();}else{var _0x30f008=_['find'](_0x4b1db9[_0xf0a1('0x13')],handleFindAgent(_0x176ab7[_0xf0a1('0x8')]));if(_0x30f008){var _0x39d8bf=(_0x176ab7[_0xf0a1('0x14')]||0xa)*0x3e8;var _0x347a6a,_0x584d9f;var _0x2d2719=seqqueue['createQueue'](_0x39d8bf);_0x2d2719['id']=_0x1448cf;_0x2d2719[_0xf0a1('0x15')]=_0x39d8bf;_0x2d2719[_0xf0a1('0x16')]=_0x161d4a[_0xf0a1('0x16')];writeLog(_0x1448cf,_0x30f008,util[_0xf0a1('0x17')]('START:%s',_0x39d8bf));_0x4b1db9['rules'][_0x1448cf]['on']('end',function(){logger['info'](_0xf0a1('0x18'),_0x1448cf);clearTimeout(_0x584d9f);_0x584d9f=undefined;_0x2d2719[_0xf0a1('0x19')]();if(_0x4b1db9[_0xf0a1('0x1a')][_0x1448cf]){delete _0x4b1db9[_0xf0a1('0x1a')][_0x1448cf];}_0x53b830[_0xf0a1('0x12')]();});_0x4b1db9['rules'][_0x1448cf]['on'](_0xf0a1('0x1b'),function(){if(_0x4b1db9[_0xf0a1('0x1a')][_0x1448cf]){delete _0x4b1db9[_0xf0a1('0x1a')][_0x1448cf];}});_0x584d9f=setTimeout(function(){logger['info'](_0xf0a1('0x1c'),_0x1448cf);clearTimeout(_0x584d9f);_0x2d2719[_0xf0a1('0x19')]();_0x53b830['next']();},_0x39d8bf);strategy[_0xf0a1('0x1d')](_0x2d2719,_0x30f008,_0x4b1db9,_0x161d4a);}else{logger[_0xf0a1('0xd')](_0xf0a1('0x1e'),_0x1448cf,_0x176ab7[_0xf0a1('0x8')]);_0x53b830['stop']();}}}catch(_0x3ad342){console[_0xf0a1('0x1f')](_0x3ad342);logger[_0xf0a1('0xd')](_0xf0a1('0x20'),_0x1448cf,_0x3ad342[_0xf0a1('0x21')]);_0x53b830['stop']();}};}; \ No newline at end of file +var _0x8ae1=['info','close','complete','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','validate','lodash','util','seq-queue','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','format','name','toLowerCase','consequence','error','[%s][AGENT]\x20%s','message','stop','agents','timeout','createQueue','atimeout','channel','START:%s','rules','end'];(function(_0x5d1d45,_0x3f0342){var _0x14d0e4=function(_0x2d3a76){while(--_0x2d3a76){_0x5d1d45['push'](_0x5d1d45['shift']());}};_0x14d0e4(++_0x3f0342);}(_0x8ae1,0x1d6));var _0x18ae=function(_0x3456d1,_0xe036e4){_0x3456d1=_0x3456d1-0x0;var _0x19c61f=_0x8ae1[_0x3456d1];return _0x19c61f;};'use strict';var schema=require(_0x18ae('0x0'));var _=require(_0x18ae('0x1'));var util=require(_0x18ae('0x2'));var seqqueue=require(_0x18ae('0x3'));var logger=require('../../../../config/logger')('routing');var strategy=require('./strategy');var queue=schema({'name':{'type':_0x18ae('0x4'),'required':!![],'message':_0x18ae('0x5')},'timeout':{'type':'number','message':_0x18ae('0x6')}});function writeLog(_0x3d056b,_0x3887d2,_0x4f865f){return logger['info'](util[_0x18ae('0x7')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x3d056b,_0x3887d2[_0x18ae('0x8')],_0x4f865f));}function handleFindAgent(_0x2d9075){return function(_0xb00e90){return _0xb00e90['name']['toLowerCase']()===_0x2d9075[_0x18ae('0x9')]();};}exports[_0x18ae('0xa')]=function(_0x1efde0,_0x23a15b,_0x3ed6ec,_0x5760c8){return function(_0x23ac28){try{var _0x29371d={'name':_0x23a15b[0x0],'timeout':_0x23a15b[0x1]};var _0x4f06a1=queue[_0x18ae('0x0')](_0x29371d,{'typecast':!![]});if(_0x4f06a1['length']){logger[_0x18ae('0xb')](_0x18ae('0xc'),_0x1efde0,_['map'](_0x4f06a1,_0x18ae('0xd'))['join'](',\x20'));_0x23ac28[_0x18ae('0xe')]();}else{var _0x75313d=_['find'](_0x3ed6ec[_0x18ae('0xf')],handleFindAgent(_0x29371d['name']));if(_0x75313d){var _0x338125=(_0x29371d[_0x18ae('0x10')]||0xa)*0x3e8;var _0x3d1cd9,_0xa424ee;var _0x562e07=seqqueue[_0x18ae('0x11')](_0x338125);_0x562e07['id']=_0x1efde0;_0x562e07[_0x18ae('0x12')]=_0x338125;_0x562e07[_0x18ae('0x13')]=_0x5760c8[_0x18ae('0x13')];writeLog(_0x1efde0,_0x75313d,util[_0x18ae('0x7')](_0x18ae('0x14'),_0x338125));_0x3ed6ec[_0x18ae('0x15')][_0x1efde0]['on'](_0x18ae('0x16'),function(){logger[_0x18ae('0x17')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x1efde0);clearTimeout(_0xa424ee);_0xa424ee=undefined;_0x562e07[_0x18ae('0x18')]();if(_0x3ed6ec[_0x18ae('0x15')][_0x1efde0]){delete _0x3ed6ec['rules'][_0x1efde0];}_0x23ac28[_0x18ae('0xe')]();});_0x3ed6ec[_0x18ae('0x15')][_0x1efde0]['on'](_0x18ae('0x19'),function(){if(_0x3ed6ec['rules'][_0x1efde0]){delete _0x3ed6ec['rules'][_0x1efde0];}});_0xa424ee=setTimeout(function(){logger[_0x18ae('0x17')]('[%s][AGENT]\x20ROUTING\x20END',_0x1efde0);clearTimeout(_0xa424ee);_0x562e07[_0x18ae('0x18')]();_0x23ac28['next']();},_0x338125);strategy[_0x18ae('0x1a')](_0x562e07,_0x75313d,_0x3ed6ec,_0x5760c8);}else{logger[_0x18ae('0xb')](_0x18ae('0x1b'),_0x1efde0,_0x29371d[_0x18ae('0x8')]);_0x23ac28[_0x18ae('0xe')]();}}}catch(_0x43ab1c){console[_0x18ae('0x1c')](_0x43ab1c);logger[_0x18ae('0xb')]('[%s][QUEUE]\x20%s',_0x1efde0,_0x43ab1c['stack']);_0x23ac28[_0x18ae('0xe')]();}};}; \ 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 a92ecc4..80b2094 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 _0x86b8=['account','upperFirst','AccountId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','$LATEST','message','toString','postText','providerName','amazonlex','providerResponse','Failed','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','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','sms','whatsapp','phone','ChatWebsiteId'];(function(_0x433ab5,_0x16e711){var _0x315911=function(_0x2d24a2){while(--_0x2d24a2){_0x433ab5['push'](_0x433ab5['shift']());}};_0x315911(++_0x16e711);}(_0x86b8,0x17e));var _0x886b=function(_0x3e4821,_0x1b83d2){_0x3e4821=_0x3e4821-0x0;var _0x5c9d07=_0x86b8[_0x3e4821];return _0x5c9d07;};'use strict';var _=require('lodash');var moment=require(_0x886b('0x0'));var AWS=require(_0x886b('0x1'));var utils=require(_0x886b('0x2'));var logger=require(_0x886b('0x3'))(_0x886b('0x4'));var rpc={'chatMessage':require(_0x886b('0x5')),'openchannelMessage':require(_0x886b('0x6')),'mailMessage':require(_0x886b('0x7')),'smsMessage':require(_0x886b('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x886b('0x9'))};exports['consequence']=function(_0x190655,_0x3ea478){return function(_0x4a1cf3){try{if(!_[_0x886b('0xa')](this[_0x886b('0xb')][_0x886b('0xc')])){logger[_0x886b('0xd')](_0x886b('0xe'),_0x190655,_0x886b('0xf'));return _0x4a1cf3[_0x886b('0x10')]();}var _0x56bbdd={'ContactId':this[_0x886b('0x11')]['id'],'sentAt':moment()[_0x886b('0x12')](_0x886b('0x13')),'direction':_0x886b('0x14')};if(this[_0x886b('0x15')]===_0x886b('0x16')||this[_0x886b('0x15')]===_0x886b('0x17')){_0x56bbdd['phone']=this[_0x886b('0xb')][_0x886b('0x18')];}var _0x44f92b=this[_0x886b('0x15')];if(_0x44f92b==='chat'){_0x56bbdd[_0x886b('0x19')]=this[_0x886b('0x1a')]['id'];}else{_0x56bbdd[_[_0x886b('0x1b')](_0x44f92b)+_0x886b('0x1c')]=this[_0x886b('0x1a')]['id'];}_0x56bbdd[_[_0x886b('0x1b')](_0x44f92b)+'InteractionId']=this[_0x886b('0xb')]['id'];if(this[_0x886b('0xb')][_0x886b('0x1d')]){var _0x2e1a8a=_0x3ea478[0x4];if(!_[_0x886b('0x1e')](_0x2e1a8a)){_0x56bbdd[_0x886b('0x1f')]=utils[_0x886b('0x20')](_0x2e1a8a,this);return rpc[_0x44f92b+_0x886b('0x21')][_0x886b('0x22')](_0x56bbdd)[_0x886b('0x23')](function(_0x1df340){logger[_0x886b('0xd')](_0x886b('0xe'),_0x190655,_0x56bbdd[_0x886b('0x1f')]);})[_0x886b('0x24')](function(_0x416938){logger[_0x886b('0x25')](_0x886b('0xe'),_0x190655,JSON[_0x886b('0x26')](_0x416938));})[_0x886b('0x27')](function(){logger[_0x886b('0xd')](_0x886b('0x28'),_0x190655);_0x4a1cf3[_0x886b('0x29')]();});}else{logger[_0x886b('0xd')](_0x886b('0x2a'),_0x190655);_0x4a1cf3[_0x886b('0x29')]();}}else{var _0x429329=this;var _0x1ed268=new AWS['LexRuntime']({'accessKeyId':_0x3ea478[0x0],'secretAccessKey':_0x3ea478[0x1],'region':_0x3ea478[0x2]});var _0x4a218d={'botAlias':_0x886b('0x2b'),'botName':_0x3ea478[0x3],'inputText':this[_0x886b('0x2c')][_0x886b('0x1f')],'userId':this[_0x886b('0x15')]+':'+this[_0x886b('0xb')]['id'][_0x886b('0x2d')]()};_0x1ed268[_0x886b('0x2e')](_0x4a218d,function(_0x443f94,_0x18f4e4){if(_0x443f94){logger[_0x886b('0x25')](_0x886b('0xe'),_0x190655,_0x443f94[_0x886b('0x2c')]);_0x4a1cf3[_0x886b('0x10')]();}else if(_0x18f4e4&&_0x18f4e4[_0x886b('0x2c')]){_0x429329[_0x886b('0x1f')]['amazonlex']=_0x18f4e4;_0x56bbdd['body']=_0x18f4e4[_0x886b('0x2c')];_0x56bbdd[_0x886b('0x2f')]=_0x886b('0x30');_0x56bbdd[_0x886b('0x31')]=JSON[_0x886b('0x26')](_0x18f4e4);return rpc[_0x44f92b+_0x886b('0x21')][_0x886b('0x22')](_0x56bbdd)[_0x886b('0x23')](function(_0x3ea700){logger[_0x886b('0xd')]('[%s][AMAZONLEX]\x20%s',_0x190655,_0x56bbdd[_0x886b('0x1f')]);if(_0x18f4e4['dialogState']==_0x886b('0x32')){_0x4a1cf3[_0x886b('0x10')]();}else{_0x4a1cf3['stop']();}})[_0x886b('0x24')](function(_0x51e349){logger[_0x886b('0x25')](_0x886b('0xe'),_0x190655,JSON[_0x886b('0x26')](_0x51e349));_0x4a1cf3[_0x886b('0x10')]();});}else{_0x4a1cf3['next']();}});}}catch(_0x216761){logger[_0x886b('0x25')](_0x886b('0xe'),_0x190655,JSON[_0x886b('0x26')](_0x216761));_0x4a1cf3['stop']();}};}; \ No newline at end of file +var _0x665a=['isEmpty','body','create','then','info','[%s][AMAZONLEX]\x20%s','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','amazonlex','providerName','providerResponse','Message','dialogState','Failed','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','interaction','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','channel','whatsapp','phone','chat','ChatWebsiteId','account','AccountId','created'];(function(_0x381d73,_0x4befa3){var _0x55b6a0=function(_0x3558e7){while(--_0x3558e7){_0x381d73['push'](_0x381d73['shift']());}};_0x55b6a0(++_0x4befa3);}(_0x665a,0x168));var _0xa665=function(_0x28876c,_0x2ea5cc){_0x28876c=_0x28876c-0x0;var _0x48e273=_0x665a[_0x28876c];return _0x48e273;};'use strict';var _=require('lodash');var moment=require(_0xa665('0x0'));var AWS=require(_0xa665('0x1'));var utils=require(_0xa665('0x2'));var logger=require(_0xa665('0x3'))(_0xa665('0x4'));var rpc={'chatMessage':require(_0xa665('0x5')),'openchannelMessage':require(_0xa665('0x6')),'mailMessage':require(_0xa665('0x7')),'smsMessage':require(_0xa665('0x8')),'faxMessage':require(_0xa665('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xa665('0xa')]=function(_0x1a7e1f,_0x4a6d7d){return function(_0x2724f6){try{if(!_['isNil'](this[_0xa665('0xb')]['UserId'])){logger['info']('[%s][AMAZONLEX]\x20%s',_0x1a7e1f,_0xa665('0xc'));return _0x2724f6[_0xa665('0xd')]();}var _0x4b639e={'ContactId':this[_0xa665('0xe')]['id'],'sentAt':moment()['format'](_0xa665('0xf')),'direction':'out'};if(this[_0xa665('0x10')]==='sms'||this['channel']===_0xa665('0x11')){_0x4b639e[_0xa665('0x12')]=this[_0xa665('0xb')][_0xa665('0x12')];}var _0x59c361=this[_0xa665('0x10')];if(_0x59c361===_0xa665('0x13')){_0x4b639e[_0xa665('0x14')]=this[_0xa665('0x15')]['id'];}else{_0x4b639e[_['upperFirst'](_0x59c361)+_0xa665('0x16')]=this[_0xa665('0x15')]['id'];}_0x4b639e[_['upperFirst'](_0x59c361)+'InteractionId']=this[_0xa665('0xb')]['id'];if(this[_0xa665('0xb')][_0xa665('0x17')]){var _0x4e91ab=_0x4a6d7d[0x4];if(!_[_0xa665('0x18')](_0x4e91ab)){_0x4b639e[_0xa665('0x19')]=utils['getMustacheRender'](_0x4e91ab,this);return rpc[_0x59c361+'Message'][_0xa665('0x1a')](_0x4b639e)[_0xa665('0x1b')](function(_0x261dd2){logger[_0xa665('0x1c')](_0xa665('0x1d'),_0x1a7e1f,_0x4b639e[_0xa665('0x19')]);})[_0xa665('0x1e')](function(_0x47bb21){logger[_0xa665('0x1f')](_0xa665('0x1d'),_0x1a7e1f,JSON[_0xa665('0x20')](_0x47bb21));})[_0xa665('0x21')](function(){logger[_0xa665('0x1c')](_0xa665('0x22'),_0x1a7e1f);_0x2724f6[_0xa665('0x23')]();});}else{logger['info'](_0xa665('0x24'),_0x1a7e1f);_0x2724f6[_0xa665('0x23')]();}}else{var _0x5783cc=this;var _0x1a4ca3=new AWS[(_0xa665('0x25'))]({'accessKeyId':_0x4a6d7d[0x0],'secretAccessKey':_0x4a6d7d[0x1],'region':_0x4a6d7d[0x2]});var _0x530de8={'botAlias':_0xa665('0x26'),'botName':_0x4a6d7d[0x3],'inputText':this[_0xa665('0x27')][_0xa665('0x19')],'userId':this[_0xa665('0x10')]+':'+this[_0xa665('0xb')]['id'][_0xa665('0x28')]()};_0x1a4ca3[_0xa665('0x29')](_0x530de8,function(_0x27a329,_0x1caae0){if(_0x27a329){logger[_0xa665('0x1f')]('[%s][AMAZONLEX]\x20%s',_0x1a7e1f,_0x27a329[_0xa665('0x27')]);_0x2724f6[_0xa665('0xd')]();}else if(_0x1caae0&&_0x1caae0[_0xa665('0x27')]){_0x5783cc[_0xa665('0x19')][_0xa665('0x2a')]=_0x1caae0;_0x4b639e[_0xa665('0x19')]=_0x1caae0[_0xa665('0x27')];_0x4b639e[_0xa665('0x2b')]=_0xa665('0x2a');_0x4b639e[_0xa665('0x2c')]=JSON[_0xa665('0x20')](_0x1caae0);return rpc[_0x59c361+_0xa665('0x2d')][_0xa665('0x1a')](_0x4b639e)['then'](function(_0x154b05){logger['info'](_0xa665('0x1d'),_0x1a7e1f,_0x4b639e['body']);if(_0x1caae0[_0xa665('0x2e')]==_0xa665('0x2f')){_0x2724f6[_0xa665('0xd')]();}else{_0x2724f6['stop']();}})['catch'](function(_0x4bd624){logger[_0xa665('0x1f')](_0xa665('0x1d'),_0x1a7e1f,JSON[_0xa665('0x20')](_0x4bd624));_0x2724f6[_0xa665('0xd')]();});}else{_0x2724f6[_0xa665('0xd')]();}});}}catch(_0x53859e){logger[_0xa665('0x1f')]('[%s][AMAZONLEX]\x20%s',_0x1a7e1f,JSON[_0xa665('0x20')](_0x53859e));_0x2724f6[_0xa665('0x23')]();}};}; \ 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 8e29371..d5c7a60 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 _0xbfef=['update','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','interaction','Autoreply\x20already\x20sent','autoreplyExecuted','info','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','next','channel','contact','format','YYYY-MM-DD\x20HH:mm:ss','mail','body','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','Message','Smtp','service','host','port','secure','authentication','auth','pass','messageId','','replace','';_0x422931['headers']={'Auto-Submitted':_0xfbfe('0x37'),'X-Auto-Response-Suppress':_0xfbfe('0x38'),'Precedence':'auto_reply'};return mailRpc['sendMailMessage'](_0x3bc5c9,_0x422931)[_0xfbfe('0x39')](function(_0x2b64eb){logger[_0xfbfe('0x11')](_0xfbfe('0x3a'),_0x45ed20);_0x422931[_0xfbfe('0x32')]=_0x2b64eb['message'][_0xfbfe('0x32')];return rpc[_0x2c9af0+_0xfbfe('0x29')]['create'](_0x422931);})[_0xfbfe('0x39')](function(_0x3655b6){logger['info']('[%s][AUTOREPLY]\x20%s',_0x45ed20,JSON['stringify'](_0x3655b6));})[_0xfbfe('0x3b')](function(_0x5f2366){logger[_0xfbfe('0x3c')](_0xfbfe('0x3d'),_0x45ed20,JSON[_0xfbfe('0x3e')](_0x5f2366));})[_0xfbfe('0x3f')](function(){Promise[_0xfbfe('0x40')]()['then'](function(){if(_0x49767e[0x0]!=='2'||_0x19f0d1[_0xfbfe('0x10')])return;return rpc[_0x2c9af0+_0xfbfe('0x41')]['update'](_0x19f0d1['id'],{'autoreplyExecuted':!![]})[_0xfbfe('0x39')](function(_0x1e87dc){logger[_0xfbfe('0x11')](_0xfbfe('0x12'),_0x45ed20,JSON[_0xfbfe('0x3e')](_0x1e87dc));})['catch'](function(_0x3c29e9){logger[_0xfbfe('0x3c')](_0xfbfe('0x42'),_0x45ed20,JSON[_0xfbfe('0x3e')](_0x3c29e9));});})[_0xfbfe('0x39')](function(){_0x367f96['next']();});});}else{return rpc[this['channel']+_0xfbfe('0x29')][_0xfbfe('0x43')](_0x422931)[_0xfbfe('0x39')](function(_0x4e52a6){logger[_0xfbfe('0x11')](_0xfbfe('0x44'),_0x45ed20,_0x422931[_0xfbfe('0x1a')]);})['catch'](function(_0x366de6){logger[_0xfbfe('0x3c')](_0xfbfe('0x44'),_0x45ed20,JSON[_0xfbfe('0x3e')](_0x366de6));})[_0xfbfe('0x3f')](function(){Promise[_0xfbfe('0x40')]()['then'](function(){if(_0x49767e[0x0]!=='2'||_0x19f0d1[_0xfbfe('0x10')])return;return rpc[_0x2c9af0+'Interaction'][_0xfbfe('0x45')](_0x19f0d1['id'],{'autoreplyExecuted':!![]})[_0xfbfe('0x39')](function(_0x44760b){logger[_0xfbfe('0x11')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x45ed20,JSON[_0xfbfe('0x3e')](_0x44760b));})[_0xfbfe('0x3b')](function(_0x4ffca1){logger['error'](_0xfbfe('0x42'),_0x45ed20,JSON[_0xfbfe('0x3e')](_0x4ffca1));});})[_0xfbfe('0x39')](function(){_0x367f96[_0xfbfe('0x14')]();});});}}}catch(_0x427ad6){logger[_0xfbfe('0x3c')]('[%s][AUTOREPLY]\x20%s',_0x45ed20,JSON['stringify'](_0x427ad6));_0x367f96[_0xfbfe('0x46')]();}};}; \ No newline at end of file +var _0xe623=['auto_reply','sendMailMessage','then','stringify','catch','error','finally','resolve','autoreplyExecuted','Interaction','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','isNil','created','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','next','interaction','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','channel','contact','YYYY-MM-DD\x20HH:mm:ss','out','body','getMustacheRender','message','from','mail','phone','read','subject','startsWith','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','Message','service','Smtp','host','port','authentication','auth','messageId','','replace','','auto-replied','All'];(function(_0x13dcb5,_0x28789f){var _0x486782=function(_0x5bf7c0){while(--_0x5bf7c0){_0x13dcb5['push'](_0x13dcb5['shift']());}};_0x486782(++_0x28789f);}(_0xe623,0x1c2));var _0x3e62=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0xe623[_0x403c20];return _0x2b271a;};'use strict';var _=require(_0x3e62('0x0'));var moment=require(_0x3e62('0x1'));var utils=require(_0x3e62('0x2'));var logger=require(_0x3e62('0x3'))(_0x3e62('0x4'));var rpc={'chatMessage':require(_0x3e62('0x5')),'openchannelMessage':require(_0x3e62('0x6')),'mailMessage':require(_0x3e62('0x7')),'smsMessage':require(_0x3e62('0x8')),'faxMessage':require(_0x3e62('0x9')),'whatsappMessage':require(_0x3e62('0xa')),'chatInteraction':require(_0x3e62('0xb')),'openchannelInteraction':require(_0x3e62('0xc')),'mailInteraction':require(_0x3e62('0xd')),'smsInteraction':require(_0x3e62('0xe')),'faxInteraction':require(_0x3e62('0xf')),'whatsappInteraction':require(_0x3e62('0x10'))};var mailRpc=require(_0x3e62('0x11'));exports[_0x3e62('0x12')]=function(_0x1da358,_0x476d39){return function(_0x3d3221){try{if(_0x476d39[0x0]==='1'&&(_[_0x3e62('0x13')](this['interaction'][_0x3e62('0x14')])||!this['interaction'][_0x3e62('0x14')])){logger[_0x3e62('0x15')](_0x3e62('0x16'),_0x1da358,_0x3e62('0x17'));return _0x3d3221[_0x3e62('0x18')]();}if(_0x476d39[0x0]==='2'&&this[_0x3e62('0x19')]['autoreplyExecuted']){logger[_0x3e62('0x15')](_0x3e62('0x1a'),_0x1da358,_0x3e62('0x1b'));return _0x3d3221[_0x3e62('0x18')]();}var _0x50b4e0=this[_0x3e62('0x1c')];var _0x52b7eb={'ContactId':this[_0x3e62('0x1d')]['id'],'sentAt':moment()['format'](_0x3e62('0x1e')),'direction':_0x3e62('0x1f')};if(this[_0x3e62('0x1c')]==='mail'){_0x52b7eb[_0x3e62('0x20')]=utils[_0x3e62('0x21')](_0x476d39[0x2],this);}else{_0x52b7eb[_0x3e62('0x20')]=utils[_0x3e62('0x21')](_0x476d39[0x1],this);}if(this[_0x3e62('0x22')]){_0x52b7eb['to']=this[_0x3e62('0x22')][_0x3e62('0x23')]||'';if(this['channel']===_0x3e62('0x24')&&_0x476d39[0x1]==='1'){_0x52b7eb['cc']=this[_0x3e62('0x22')]['cc']||'';}_0x52b7eb[_0x3e62('0x23')]=this[_0x3e62('0x22')]['to']||'';_0x52b7eb['phone']=this[_0x3e62('0x22')][_0x3e62('0x25')]||'';_0x52b7eb[_0x3e62('0x26')]=!![];if(this['message'][_0x3e62('0x27')]){_0x52b7eb[_0x3e62('0x27')]='';_0x52b7eb[_0x3e62('0x27')]+=_[_0x3e62('0x28')](this['message'][_0x3e62('0x27')],'Re:')?'':'Re:\x20';_0x52b7eb[_0x3e62('0x27')]+=this['message']['subject'];}}if(this['channel']==='chat'){_0x52b7eb[_0x3e62('0x29')]=this['account']['id'];}else{_0x52b7eb[_[_0x3e62('0x2a')](this[_0x3e62('0x1c')])+_0x3e62('0x2b')]=this[_0x3e62('0x2c')]['id'];}_0x52b7eb[_[_0x3e62('0x2a')](this[_0x3e62('0x1c')])+_0x3e62('0x2d')]=this[_0x3e62('0x19')]['id'];var _0x430059=this[_0x3e62('0x19')];if(rpc[this[_0x3e62('0x1c')]+_0x3e62('0x2e')]){if(this[_0x3e62('0x1c')]===_0x3e62('0x24')){var _0x378721={'tls':{'rejectUnauthorized':![]}};if(this[_0x3e62('0x2c')]['Smtp'][_0x3e62('0x2f')]){_0x378721[_0x3e62('0x2f')]=this[_0x3e62('0x2c')][_0x3e62('0x30')]['service'];}else{_0x378721[_0x3e62('0x31')]=this[_0x3e62('0x2c')]['Smtp']['host'];_0x378721[_0x3e62('0x32')]=this[_0x3e62('0x2c')][_0x3e62('0x30')][_0x3e62('0x32')];_0x378721['secure']=this[_0x3e62('0x2c')][_0x3e62('0x30')]['secure'];}if(this[_0x3e62('0x2c')][_0x3e62('0x30')][_0x3e62('0x33')]){_0x378721[_0x3e62('0x34')]={'user':this[_0x3e62('0x2c')][_0x3e62('0x30')]['user'],'pass':this[_0x3e62('0x2c')][_0x3e62('0x30')]['pass']};}_0x52b7eb['inReplyTo']=this['message'][_0x3e62('0x35')];_0x52b7eb['html']=_0x3e62('0x36')+_[_0x3e62('0x37')](_0x52b7eb[_0x3e62('0x20')],_0x3e62('0x38'),_0x3e62('0x39'))+_0x3e62('0x3a');_0x52b7eb['headers']={'Auto-Submitted':_0x3e62('0x3b'),'X-Auto-Response-Suppress':_0x3e62('0x3c'),'Precedence':_0x3e62('0x3d')};return mailRpc[_0x3e62('0x3e')](_0x378721,_0x52b7eb)['then'](function(_0x2d29bd){logger['info']('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x1da358);_0x52b7eb[_0x3e62('0x35')]=_0x2d29bd['message'][_0x3e62('0x35')];return rpc[_0x50b4e0+_0x3e62('0x2e')]['create'](_0x52b7eb);})[_0x3e62('0x3f')](function(_0x22b846){logger[_0x3e62('0x15')]('[%s][AUTOREPLY]\x20%s',_0x1da358,JSON[_0x3e62('0x40')](_0x22b846));})[_0x3e62('0x41')](function(_0x2410d0){logger[_0x3e62('0x42')]('[RPC][%s][AUTOREPLY]\x20%s',_0x1da358,JSON[_0x3e62('0x40')](_0x2410d0));})[_0x3e62('0x43')](function(){Promise[_0x3e62('0x44')]()['then'](function(){if(_0x476d39[0x0]!=='2'||_0x430059[_0x3e62('0x45')])return;return rpc[_0x50b4e0+_0x3e62('0x46')]['update'](_0x430059['id'],{'autoreplyExecuted':!![]})[_0x3e62('0x3f')](function(_0x5a90fc){logger[_0x3e62('0x15')](_0x3e62('0x1a'),_0x1da358,JSON[_0x3e62('0x40')](_0x5a90fc));})[_0x3e62('0x41')](function(_0x4f053b){logger[_0x3e62('0x42')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x1da358,JSON['stringify'](_0x4f053b));});})['then'](function(){_0x3d3221['next']();});});}else{return rpc[this[_0x3e62('0x1c')]+'Message']['create'](_0x52b7eb)['then'](function(_0x354f43){logger[_0x3e62('0x15')](_0x3e62('0x16'),_0x1da358,_0x52b7eb['body']);})[_0x3e62('0x41')](function(_0x14ad3b){logger[_0x3e62('0x42')](_0x3e62('0x16'),_0x1da358,JSON['stringify'](_0x14ad3b));})[_0x3e62('0x43')](function(){Promise[_0x3e62('0x44')]()[_0x3e62('0x3f')](function(){if(_0x476d39[0x0]!=='2'||_0x430059[_0x3e62('0x45')])return;return rpc[_0x50b4e0+_0x3e62('0x46')]['update'](_0x430059['id'],{'autoreplyExecuted':!![]})[_0x3e62('0x3f')](function(_0x1d0430){logger[_0x3e62('0x15')](_0x3e62('0x1a'),_0x1da358,JSON[_0x3e62('0x40')](_0x1d0430));})[_0x3e62('0x41')](function(_0x2e335a){logger[_0x3e62('0x42')](_0x3e62('0x47'),_0x1da358,JSON[_0x3e62('0x40')](_0x2e335a));});})[_0x3e62('0x3f')](function(){_0x3d3221['next']();});});}}}catch(_0x4bb498){logger[_0x3e62('0x42')](_0x3e62('0x16'),_0x1da358,JSON['stringify'](_0x4bb498));_0x3d3221[_0x3e62('0x48')]();}};}; \ 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 2c51eab..c8b55b9 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 _0xb443=['../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','then','error','[%s][CLOSE]\x20%s','stop','stringify','moment'];(function(_0x40e962,_0x51273a){var _0xe5cd7=function(_0x2b1729){while(--_0x2b1729){_0x40e962['push'](_0x40e962['shift']());}};_0xe5cd7(++_0x51273a);}(_0xb443,0x117));var _0x3b44=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0xb443[_0x1b4b23];return _0x2a325b;};'use strict';var moment=require(_0x3b44('0x0'));var logger=require(_0x3b44('0x1'))(_0x3b44('0x2'));var rpc={'chatInteraction':require(_0x3b44('0x3')),'openchannelInteraction':require(_0x3b44('0x4')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x3b44('0x5')),'faxInteraction':require(_0x3b44('0x6')),'whatsappInteraction':require(_0x3b44('0x7'))};exports[_0x3b44('0x8')]=function(_0x4b6de8,_0x3903dd,_0x52f4f0,_0x3cd5d6){return function(_0x4bb82d){try{logger[_0x3b44('0x9')](_0x3b44('0xa'),_0x4b6de8,_0x3903dd[0x0]);var _0x2a91aa={'closed':0x1,'closedAt':moment()['format'](_0x3b44('0xb')),'closeReason':_0x3b44('0xc'),'disposition':_0x3903dd[0x0]};if(rpc[_0x3cd5d6[_0x3b44('0xd')]+_0x3b44('0xe')]){rpc[_0x3cd5d6[_0x3b44('0xd')]+_0x3b44('0xe')]['update'](_0x3cd5d6['interaction']['id'],_0x2a91aa)[_0x3b44('0xf')](function(_0x3b56dd){logger[_0x3b44('0x9')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x4b6de8,_0x3cd5d6['interaction']['id']);})['catch'](function(_0x2d3dc0){logger[_0x3b44('0x10')](_0x3b44('0x11'),_0x4b6de8,JSON['stringify'](_0x2d3dc0));})['finally'](function(){_0x4bb82d[_0x3b44('0x12')]();});}}catch(_0x311c9b){logger[_0x3b44('0x10')]('[%s][CLOSE]\x20%s',_0x4b6de8,JSON[_0x3b44('0x13')](_0x311c9b));_0x4bb82d[_0x3b44('0x12')]();}};}; \ No newline at end of file +var _0x1cd4=['YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','finally','stop','stringify','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format'];(function(_0x17f59f,_0x167ce0){var _0x49226e=function(_0x4246b6){while(--_0x4246b6){_0x17f59f['push'](_0x17f59f['shift']());}};_0x49226e(++_0x167ce0);}(_0x1cd4,0x1ec));var _0x41cd=function(_0x571baf,_0x3c20e3){_0x571baf=_0x571baf-0x0;var _0x54b3ba=_0x1cd4[_0x571baf];return _0x54b3ba;};'use strict';var moment=require(_0x41cd('0x0'));var logger=require(_0x41cd('0x1'))(_0x41cd('0x2'));var rpc={'chatInteraction':require(_0x41cd('0x3')),'openchannelInteraction':require(_0x41cd('0x4')),'smsInteraction':require(_0x41cd('0x5')),'mailInteraction':require(_0x41cd('0x6')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x41cd('0x7'))};exports[_0x41cd('0x8')]=function(_0xfc5110,_0x5c2174,_0x32afb3,_0x478fdd){return function(_0x1f5cca){try{logger[_0x41cd('0x9')](_0x41cd('0xa'),_0xfc5110,_0x5c2174[0x0]);var _0x5b480e={'closed':0x1,'closedAt':moment()[_0x41cd('0xb')](_0x41cd('0xc')),'closeReason':_0x41cd('0xd'),'disposition':_0x5c2174[0x0]};if(rpc[_0x478fdd[_0x41cd('0xe')]+_0x41cd('0xf')]){rpc[_0x478fdd[_0x41cd('0xe')]+'Interaction']['update'](_0x478fdd['interaction']['id'],_0x5b480e)[_0x41cd('0x10')](function(_0x467913){logger[_0x41cd('0x9')](_0x41cd('0x11'),_0xfc5110,_0x478fdd['interaction']['id']);})[_0x41cd('0x12')](function(_0x1c59e9){logger[_0x41cd('0x13')](_0x41cd('0x14'),_0xfc5110,JSON['stringify'](_0x1c59e9));})[_0x41cd('0x15')](function(){_0x1f5cca[_0x41cd('0x16')]();});}}catch(_0xbc23c1){logger['error'](_0x41cd('0x14'),_0xfc5110,JSON[_0x41cd('0x17')](_0xbc23c1));_0x1f5cca[_0x41cd('0x16')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 5233732..897ce11 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 _0x2aa3=['created','isEmpty','body','getMustacheRender','then','catch','error','[%s][DIALOGFLOW]\x20%s','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','result','fulfillment','speech','providerName','dialogflow','providerResponse','Message','create','endConversation','next','lodash','moment','apiai-promise','md5','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','phone','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId'];(function(_0x475ed4,_0x1fb15f){var _0x1e4f72=function(_0x4e775b){while(--_0x4e775b){_0x475ed4['push'](_0x475ed4['shift']());}};_0x1e4f72(++_0x1fb15f);}(_0x2aa3,0x83));var _0x32aa=function(_0x52a25d,_0x332ac9){_0x52a25d=_0x52a25d-0x0;var _0x3e0471=_0x2aa3[_0x52a25d];return _0x3e0471;};'use strict';var _=require(_0x32aa('0x0'));var moment=require(_0x32aa('0x1'));var apiai=require(_0x32aa('0x2'));var md5=require(_0x32aa('0x3'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x32aa('0x4'));var rpc={'chatMessage':require(_0x32aa('0x5')),'openchannelMessage':require(_0x32aa('0x6')),'mailMessage':require(_0x32aa('0x7')),'smsMessage':require(_0x32aa('0x8')),'faxMessage':require(_0x32aa('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x32aa('0xa')]=function(_0x112396,_0x3ee18a){return function(_0x20efbe){try{if(!_[_0x32aa('0xb')](this[_0x32aa('0xc')][_0x32aa('0xd')])){logger[_0x32aa('0xe')]('[%s][DIALOGFLOW]\x20%s',_0x112396,_0x32aa('0xf'));return _0x20efbe['next']();}var _0x3d61ee={'ContactId':this[_0x32aa('0x10')]['id'],'sentAt':moment()[_0x32aa('0x11')](_0x32aa('0x12')),'direction':'out'};if(this[_0x32aa('0x13')]===_0x32aa('0x14')||this[_0x32aa('0x13')]==='whatsapp'){_0x3d61ee[_0x32aa('0x15')]=this[_0x32aa('0xc')][_0x32aa('0x15')];}var _0x22c07a=this[_0x32aa('0x13')];if(_0x22c07a===_0x32aa('0x16')){_0x3d61ee[_0x32aa('0x17')]=this[_0x32aa('0x18')]['id'];}else{_0x3d61ee[_['upperFirst'](_0x22c07a)+_0x32aa('0x19')]=this[_0x32aa('0x18')]['id'];}_0x3d61ee[_[_0x32aa('0x1a')](_0x22c07a)+_0x32aa('0x1b')]=this[_0x32aa('0xc')]['id'];if(this['interaction'][_0x32aa('0x1c')]){var _0x251fa4=_0x3ee18a[0x2];if(!_[_0x32aa('0x1d')](_0x251fa4)){_0x3d61ee[_0x32aa('0x1e')]=utils[_0x32aa('0x1f')](_0x251fa4,this);return rpc[_0x22c07a+'Message']['create'](_0x3d61ee)[_0x32aa('0x20')](function(_0x34dcaf){logger[_0x32aa('0xe')]('[%s][DIALOGFLOW]\x20%s',_0x112396,_0x3d61ee['body']);})[_0x32aa('0x21')](function(_0x148255){logger[_0x32aa('0x22')](_0x32aa('0x23'),_0x112396,JSON[_0x32aa('0x24')](_0x148255));})[_0x32aa('0x25')](function(){logger['info'](_0x32aa('0x26'),_0x112396);_0x20efbe[_0x32aa('0x27')]();});}else{logger[_0x32aa('0xe')](_0x32aa('0x28'),_0x112396);_0x20efbe[_0x32aa('0x27')]();}}else{var _0x90d165=this;var _0x1ce405=apiai(_0x3ee18a[0x0],{'language':_0x3ee18a[0x1]||'en'});return _0x1ce405[_0x32aa('0x29')](this[_0x32aa('0x2a')]['body'],{'sessionId':md5(this[_0x32aa('0xc')]['id'])})['then'](function(_0x6766da){_0x90d165[_0x32aa('0x1e')]['dialogflow']=_0x6766da;_0x3d61ee['body']=_0x6766da[_0x32aa('0x2b')][_0x32aa('0x2c')][_0x32aa('0x2d')];_0x3d61ee[_0x32aa('0x2e')]=_0x32aa('0x2f');_0x3d61ee[_0x32aa('0x30')]=JSON[_0x32aa('0x24')](_0x6766da);return rpc[_0x22c07a+_0x32aa('0x31')][_0x32aa('0x32')](_0x3d61ee)['then'](function(_0x128774){logger[_0x32aa('0xe')]('[%s][DIALOGFLOW]\x20%s',_0x112396,_0x3d61ee[_0x32aa('0x1e')]);if(_0x6766da['result']['metadata'][_0x32aa('0x33')]){_0x20efbe[_0x32aa('0x34')]();}else{_0x20efbe[_0x32aa('0x27')]();}})[_0x32aa('0x21')](function(_0x5903b8){logger[_0x32aa('0x22')](_0x32aa('0x23'),_0x112396,JSON[_0x32aa('0x24')](_0x5903b8));_0x20efbe[_0x32aa('0x34')]();});})[_0x32aa('0x21')](function(_0x44887c){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x112396,_0x44887c[_0x32aa('0x2a')]);_0x20efbe[_0x32aa('0x34')]();});}}catch(_0x136893){logger[_0x32aa('0x22')]('[%s][DIALOGFLOW]\x20%s',_0x112396,JSON['stringify'](_0x136893));_0x20efbe[_0x32aa('0x27')]();}};}; \ No newline at end of file +var _0x5d58=['info','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','message','dialogflow','result','fulfillment','speech','providerName','providerResponse','metadata','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','created','isEmpty','body','getMustacheRender','Message','create','then'];(function(_0xae5203,_0x4e8888){var _0x1626b0=function(_0xa524dd){while(--_0xa524dd){_0xae5203['push'](_0xae5203['shift']());}};_0x1626b0(++_0x4e8888);}(_0x5d58,0x187));var _0x85d5=function(_0x3da340,_0x10a984){_0x3da340=_0x3da340-0x0;var _0x973874=_0x5d58[_0x3da340];return _0x973874;};'use strict';var _=require('lodash');var moment=require('moment');var apiai=require('apiai-promise');var md5=require('md5');var utils=require('./utils');var logger=require(_0x85d5('0x0'))(_0x85d5('0x1'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x85d5('0x2')),'mailMessage':require(_0x85d5('0x3')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x85d5('0x4')),'whatsappMessage':require(_0x85d5('0x5'))};exports[_0x85d5('0x6')]=function(_0x46e7b4,_0x5f47ec){return function(_0x98c963){try{if(!_[_0x85d5('0x7')](this['interaction'][_0x85d5('0x8')])){logger['info'](_0x85d5('0x9'),_0x46e7b4,_0x85d5('0xa'));return _0x98c963[_0x85d5('0xb')]();}var _0x488dcb={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0x85d5('0xc')),'direction':_0x85d5('0xd')};if(this[_0x85d5('0xe')]===_0x85d5('0xf')||this[_0x85d5('0xe')]===_0x85d5('0x10')){_0x488dcb[_0x85d5('0x11')]=this['interaction']['phone'];}var _0x4869ca=this[_0x85d5('0xe')];if(_0x4869ca===_0x85d5('0x12')){_0x488dcb[_0x85d5('0x13')]=this[_0x85d5('0x14')]['id'];}else{_0x488dcb[_[_0x85d5('0x15')](_0x4869ca)+_0x85d5('0x16')]=this[_0x85d5('0x14')]['id'];}_0x488dcb[_['upperFirst'](_0x4869ca)+_0x85d5('0x17')]=this[_0x85d5('0x18')]['id'];if(this[_0x85d5('0x18')][_0x85d5('0x19')]){var _0x19f7d5=_0x5f47ec[0x2];if(!_[_0x85d5('0x1a')](_0x19f7d5)){_0x488dcb[_0x85d5('0x1b')]=utils[_0x85d5('0x1c')](_0x19f7d5,this);return rpc[_0x4869ca+_0x85d5('0x1d')][_0x85d5('0x1e')](_0x488dcb)[_0x85d5('0x1f')](function(_0x432bd6){logger[_0x85d5('0x20')](_0x85d5('0x9'),_0x46e7b4,_0x488dcb[_0x85d5('0x1b')]);})[_0x85d5('0x21')](function(_0x54e991){logger[_0x85d5('0x22')]('[%s][DIALOGFLOW]\x20%s',_0x46e7b4,JSON[_0x85d5('0x23')](_0x54e991));})[_0x85d5('0x24')](function(){logger['info'](_0x85d5('0x25'),_0x46e7b4);_0x98c963[_0x85d5('0x26')]();});}else{logger['info']('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x46e7b4);_0x98c963[_0x85d5('0x26')]();}}else{var _0x5a1b9a=this;var _0x2f2bae=apiai(_0x5f47ec[0x0],{'language':_0x5f47ec[0x1]||'en'});return _0x2f2bae['textRequest'](this[_0x85d5('0x27')][_0x85d5('0x1b')],{'sessionId':md5(this['interaction']['id'])})['then'](function(_0x4da71b){_0x5a1b9a['body'][_0x85d5('0x28')]=_0x4da71b;_0x488dcb[_0x85d5('0x1b')]=_0x4da71b[_0x85d5('0x29')][_0x85d5('0x2a')][_0x85d5('0x2b')];_0x488dcb[_0x85d5('0x2c')]='dialogflow';_0x488dcb[_0x85d5('0x2d')]=JSON['stringify'](_0x4da71b);return rpc[_0x4869ca+_0x85d5('0x1d')][_0x85d5('0x1e')](_0x488dcb)[_0x85d5('0x1f')](function(_0x5cc2cf){logger[_0x85d5('0x20')](_0x85d5('0x9'),_0x46e7b4,_0x488dcb[_0x85d5('0x1b')]);if(_0x4da71b[_0x85d5('0x29')][_0x85d5('0x2e')]['endConversation']){_0x98c963[_0x85d5('0xb')]();}else{_0x98c963[_0x85d5('0x26')]();}})[_0x85d5('0x21')](function(_0x22a961){logger[_0x85d5('0x22')]('[%s][DIALOGFLOW]\x20%s',_0x46e7b4,JSON['stringify'](_0x22a961));_0x98c963[_0x85d5('0xb')]();});})[_0x85d5('0x21')](function(_0x2d1157){logger[_0x85d5('0x22')](_0x85d5('0x9'),_0x46e7b4,_0x2d1157['message']);_0x98c963[_0x85d5('0xb')]();});}}catch(_0x214908){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x46e7b4,JSON[_0x85d5('0x23')](_0x214908));_0x98c963[_0x85d5('0x26')]();}};}; \ 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 5e25b7e..d5c2539 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 _0x47aa=['DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','isFallback','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_QUERYTEXT','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','dialogflowV2','providerResponse','length','all','message','lodash','dialogflow','md5','bluebird','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','clone','body','Message','create','then','catch','error','[%s][DIALOGFLOWV2]\x20%s','stringify','consequence','isNil','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','channel','sms','phone','interaction','chat','ChatWebsiteId','upperFirst','account','InteractionId','isEmpty','getMustacheRender','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','sessionPath','detectIntent','queryResult','diagnosticInfo','fields','end_conversation','boolValue'];(function(_0x41efee,_0x3b1307){var _0x5c9862=function(_0x59948d){while(--_0x59948d){_0x41efee['push'](_0x41efee['shift']());}};_0x5c9862(++_0x3b1307);}(_0x47aa,0x9e));var _0xa47a=function(_0x51d1dd,_0x1b8827){_0x51d1dd=_0x51d1dd-0x0;var _0x2e7eca=_0x47aa[_0x51d1dd];return _0x2e7eca;};'use strict';var _=require(_0xa47a('0x0'));var dialogflow=require(_0xa47a('0x1'));var md5=require(_0xa47a('0x2'));var moment=require('moment');var Promise=require(_0xa47a('0x3'));var logger=require('../../../../config/logger')(_0xa47a('0x4'));var utils=require(_0xa47a('0x5'));var rpc={'chatMessage':require(_0xa47a('0x6')),'openchannelMessage':require(_0xa47a('0x7')),'mailMessage':require(_0xa47a('0x8')),'smsMessage':require(_0xa47a('0x9')),'faxMessage':require(_0xa47a('0xa')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x1253b2,_0x556777,_0x4480c3,_0x339605){return new Promise(function(_0xc49372,_0x5f085c){var _0x299bce=_[_0xa47a('0xb')](_0x4480c3);_0x299bce[_0xa47a('0xc')]=_0x339605;return rpc[_0x556777+_0xa47a('0xd')][_0xa47a('0xe')](_0x299bce)[_0xa47a('0xf')](function(){logger['info']('[%s][DIALOGFLOWV2]\x20%s',_0x1253b2,_0x299bce[_0xa47a('0xc')]);_0xc49372();})[_0xa47a('0x10')](function(_0x5986cc){logger[_0xa47a('0x11')](_0xa47a('0x12'),_0x1253b2,JSON[_0xa47a('0x13')](_0x5986cc));_0x5f085c(_0x5986cc);});});}exports[_0xa47a('0x14')]=function(_0x2a600c,_0x799da){return function(_0x567b0a){try{if(!_[_0xa47a('0x15')](this['interaction']['UserId'])){logger[_0xa47a('0x16')](_0xa47a('0x12'),_0x2a600c,_0xa47a('0x17'));return _0x567b0a[_0xa47a('0x18')]();}var _0x3a2eb3={'ContactId':this[_0xa47a('0x19')]['id'],'sentAt':moment()[_0xa47a('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xa47a('0x1b')};if(this[_0xa47a('0x1c')]===_0xa47a('0x1d')||this[_0xa47a('0x1c')]==='whatsapp'){_0x3a2eb3[_0xa47a('0x1e')]=this[_0xa47a('0x1f')][_0xa47a('0x1e')];}var _0x543564=this[_0xa47a('0x1c')];if(_0x543564===_0xa47a('0x20')){_0x3a2eb3[_0xa47a('0x21')]=this['account']['id'];}else{_0x3a2eb3[_[_0xa47a('0x22')](_0x543564)+'AccountId']=this[_0xa47a('0x23')]['id'];}_0x3a2eb3[_[_0xa47a('0x22')](_0x543564)+_0xa47a('0x24')]=this[_0xa47a('0x1f')]['id'];if(this['interaction']['created']){var _0x1d57a6=_0x799da[0x4];if(!_[_0xa47a('0x25')](_0x1d57a6)){_0x3a2eb3[_0xa47a('0xc')]=utils[_0xa47a('0x26')](_0x1d57a6,this);return rpc[_0x543564+'Message'][_0xa47a('0xe')](_0x3a2eb3)['then'](function(_0x4b0aab){logger[_0xa47a('0x16')]('[%s][DIALOGFLOWV2]\x20%s',_0x2a600c,_0x3a2eb3[_0xa47a('0xc')]);})[_0xa47a('0x10')](function(_0xde4229){logger[_0xa47a('0x11')](_0xa47a('0x12'),_0x2a600c,JSON[_0xa47a('0x13')](_0xde4229));})['finally'](function(){logger[_0xa47a('0x16')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x2a600c);_0x567b0a[_0xa47a('0x27')]();});}else{logger[_0xa47a('0x16')](_0xa47a('0x28'),_0x2a600c);_0x567b0a[_0xa47a('0x27')]();}}else{var _0x47267f=this;var _0x6a6c6a=_0x799da[0x2][_0xa47a('0x29')](/\\n/g,'\x0a');var _0xabaeb3={'credentials':{'private_key':_0x6a6c6a,'client_email':_0x799da[0x1]}};var _0x154c74=new dialogflow['SessionsClient'](_0xabaeb3);var _0x2b8998=_0x154c74[_0xa47a('0x2a')](_0x799da[0x0],md5(_0x47267f[_0xa47a('0x1f')]['id']));var _0x389a7d={'session':_0x2b8998,'queryInput':{'text':{'text':_0x47267f['message'][_0xa47a('0xc')],'languageCode':_0x799da[0x3]||'en'}}};return _0x154c74[_0xa47a('0x2b')](_0x389a7d)['then'](function(_0x207c14){if(_0x207c14&&_0x207c14['length']){_0x47267f[_0xa47a('0xc')]['dialogflowV2']=_0x207c14;var _0x1d75aa=_0x207c14[0x0];var _0x370811=_0x1d75aa['queryResult']['diagnosticInfo']&&_0x1d75aa[_0xa47a('0x2c')][_0xa47a('0x2d')][_0xa47a('0x2e')]?_0x1d75aa['queryResult'][_0xa47a('0x2d')][_0xa47a('0x2e')][_0xa47a('0x2f')][_0xa47a('0x30')]:![];_0x47267f[_0xa47a('0xc')][_0xa47a('0x31')]=_0x1d75aa[_0xa47a('0x2c')][_0xa47a('0x32')];_0x47267f[_0xa47a('0xc')][_0xa47a('0x33')]=_0x1d75aa['queryResult'][_0xa47a('0x34')];_0x47267f[_0xa47a('0xc')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x1d75aa[_0xa47a('0x2c')]['diagnosticInfo']&&_0x1d75aa[_0xa47a('0x2c')][_0xa47a('0x2d')][_0xa47a('0x2e')]?_0x1d75aa[_0xa47a('0x2c')][_0xa47a('0x2d')][_0xa47a('0x2e')]['end_conversation'][_0xa47a('0x30')]:![];_0x47267f[_0xa47a('0xc')][_0xa47a('0x35')]=_0x1d75aa[_0xa47a('0x2c')][_0xa47a('0x36')][_0xa47a('0x37')];_0x47267f[_0xa47a('0xc')][_0xa47a('0x38')]=_0x1d75aa['queryResult'][_0xa47a('0x36')][_0xa47a('0x39')];_0x47267f[_0xa47a('0xc')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x1d75aa[_0xa47a('0x2c')][_0xa47a('0x36')][_0xa47a('0x3a')];_0x47267f['body'][_0xa47a('0x3b')]=_0x1d75aa[_0xa47a('0x2c')]['languageCode'];_0x47267f[_0xa47a('0xc')][_0xa47a('0x3c')]=_0x1d75aa[_0xa47a('0x2c')]['queryText'];_0x47267f[_0xa47a('0xc')][_0xa47a('0x3d')]=_0x1d75aa[_0xa47a('0x2c')][_0xa47a('0x3e')];_0x3a2eb3[_0xa47a('0x3f')]=_0xa47a('0x40');_0x3a2eb3[_0xa47a('0x41')]=JSON[_0xa47a('0x13')](_0x207c14);var _0x1ce89a=[];for(var _0x4c3baf=0x0;_0x4c3baf<_0x207c14[_0xa47a('0x42')];_0x4c3baf++){var _0x148a58=_0x207c14[_0x4c3baf];if(_0x148a58&&_0x148a58[_0xa47a('0x2c')]&&_0x148a58[_0xa47a('0x2c')]['fulfillmentText']){_0x1ce89a['push'](createMessage(_0x2a600c,_0x543564,_0x3a2eb3,_0x148a58[_0xa47a('0x2c')]['fulfillmentText']));}}return Promise[_0xa47a('0x43')](_0x1ce89a)[_0xa47a('0xf')](function(){if(_0x370811){_0x567b0a[_0xa47a('0x18')]();}else{_0x567b0a[_0xa47a('0x27')]();}})[_0xa47a('0x10')](function(_0x3fc421){logger[_0xa47a('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x2a600c,JSON[_0xa47a('0x13')](_0x3fc421));_0x567b0a[_0xa47a('0x18')]();});}})['catch'](function(_0x30851d){logger['error'](_0xa47a('0x12'),_0x2a600c,_0x30851d[_0xa47a('0x44')]);_0x567b0a['next']();});}}catch(_0x165555){logger[_0xa47a('0x11')](_0xa47a('0x12'),_0x2a600c,JSON[_0xa47a('0x13')](_0x165555));_0x567b0a[_0xa47a('0x27')]();}};}; \ No newline at end of file +var _0x58ef=['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','DIALOGFLOWV2_ENDCONVERSATION','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','intentDetectionConfidence','providerName','providerResponse','push','fulfillmentText','all','then','lodash','md5','moment','bluebird','../../../../config/logger','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','create','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','isNil','interaction','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','Message','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action'];(function(_0xf830c,_0x5b2d6b){var _0xafdedb=function(_0x46f6e2){while(--_0x46f6e2){_0xf830c['push'](_0xf830c['shift']());}};_0xafdedb(++_0x5b2d6b);}(_0x58ef,0x1ce));var _0xf58e=function(_0x11ebd4,_0x5a7788){_0x11ebd4=_0x11ebd4-0x0;var _0x41fca9=_0x58ef[_0x11ebd4];return _0x41fca9;};'use strict';var _=require(_0xf58e('0x0'));var dialogflow=require('dialogflow');var md5=require(_0xf58e('0x1'));var moment=require(_0xf58e('0x2'));var Promise=require(_0xf58e('0x3'));var logger=require(_0xf58e('0x4'))('routing');var utils=require(_0xf58e('0x5'));var rpc={'chatMessage':require(_0xf58e('0x6')),'openchannelMessage':require(_0xf58e('0x7')),'mailMessage':require(_0xf58e('0x8')),'smsMessage':require(_0xf58e('0x9')),'faxMessage':require(_0xf58e('0xa')),'whatsappMessage':require(_0xf58e('0xb'))};function createMessage(_0xdad71,_0x20cbff,_0x5c30b4,_0x28f421){return new Promise(function(_0x590d08,_0x201f83){var _0x2ca613=_[_0xf58e('0xc')](_0x5c30b4);_0x2ca613[_0xf58e('0xd')]=_0x28f421;return rpc[_0x20cbff+'Message'][_0xf58e('0xe')](_0x2ca613)['then'](function(){logger[_0xf58e('0xf')](_0xf58e('0x10'),_0xdad71,_0x2ca613['body']);_0x590d08();})[_0xf58e('0x11')](function(_0x1b5808){logger[_0xf58e('0x12')](_0xf58e('0x10'),_0xdad71,JSON[_0xf58e('0x13')](_0x1b5808));_0x201f83(_0x1b5808);});});}exports[_0xf58e('0x14')]=function(_0x238c23,_0x3e021a){return function(_0x4dfdb3){try{if(!_[_0xf58e('0x15')](this[_0xf58e('0x16')]['UserId'])){logger[_0xf58e('0xf')](_0xf58e('0x10'),_0x238c23,_0xf58e('0x17'));return _0x4dfdb3[_0xf58e('0x18')]();}var _0x565172={'ContactId':this[_0xf58e('0x19')]['id'],'sentAt':moment()[_0xf58e('0x1a')](_0xf58e('0x1b')),'direction':_0xf58e('0x1c')};if(this[_0xf58e('0x1d')]==='sms'||this[_0xf58e('0x1d')]===_0xf58e('0x1e')){_0x565172[_0xf58e('0x1f')]=this[_0xf58e('0x16')][_0xf58e('0x1f')];}var _0x571cfb=this[_0xf58e('0x1d')];if(_0x571cfb===_0xf58e('0x20')){_0x565172[_0xf58e('0x21')]=this[_0xf58e('0x22')]['id'];}else{_0x565172[_[_0xf58e('0x23')](_0x571cfb)+_0xf58e('0x24')]=this[_0xf58e('0x22')]['id'];}_0x565172[_[_0xf58e('0x23')](_0x571cfb)+_0xf58e('0x25')]=this['interaction']['id'];if(this[_0xf58e('0x16')][_0xf58e('0x26')]){var _0x88b5c5=_0x3e021a[0x4];if(!_[_0xf58e('0x27')](_0x88b5c5)){_0x565172['body']=utils['getMustacheRender'](_0x88b5c5,this);return rpc[_0x571cfb+_0xf58e('0x28')][_0xf58e('0xe')](_0x565172)['then'](function(_0xa4ddc9){logger['info'](_0xf58e('0x10'),_0x238c23,_0x565172[_0xf58e('0xd')]);})[_0xf58e('0x11')](function(_0x574365){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x238c23,JSON['stringify'](_0x574365));})[_0xf58e('0x29')](function(){logger[_0xf58e('0xf')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x238c23);_0x4dfdb3['stop']();});}else{logger['info'](_0xf58e('0x2a'),_0x238c23);_0x4dfdb3[_0xf58e('0x2b')]();}}else{var _0x3a98b2=this;var _0x3880b1=_0x3e021a[0x2]['replace'](/\\n/g,'\x0a');var _0x441e71={'credentials':{'private_key':_0x3880b1,'client_email':_0x3e021a[0x1]}};var _0x28f62b=new dialogflow['SessionsClient'](_0x441e71);var _0x5c1af6=_0x28f62b[_0xf58e('0x2c')](_0x3e021a[0x0],md5(_0x3a98b2[_0xf58e('0x16')]['id']));var _0x44af2b={'session':_0x5c1af6,'queryInput':{'text':{'text':_0x3a98b2[_0xf58e('0x2d')][_0xf58e('0xd')],'languageCode':_0x3e021a[0x3]||'en'}}};return _0x28f62b[_0xf58e('0x2e')](_0x44af2b)['then'](function(_0x3ad4c4){if(_0x3ad4c4&&_0x3ad4c4[_0xf58e('0x2f')]){_0x3a98b2[_0xf58e('0xd')][_0xf58e('0x30')]=_0x3ad4c4;var _0x37e03b=_0x3ad4c4[0x0];var _0x36ba5e=_0x37e03b[_0xf58e('0x31')]['diagnosticInfo']&&_0x37e03b['queryResult'][_0xf58e('0x32')][_0xf58e('0x33')]?_0x37e03b[_0xf58e('0x31')]['diagnosticInfo'][_0xf58e('0x33')][_0xf58e('0x34')][_0xf58e('0x35')]:![];_0x3a98b2[_0xf58e('0xd')][_0xf58e('0x36')]=_0x37e03b[_0xf58e('0x31')][_0xf58e('0x37')];_0x3a98b2[_0xf58e('0xd')][_0xf58e('0x38')]=_0x37e03b['queryResult']['allRequiredParamsPresent'];_0x3a98b2[_0xf58e('0xd')][_0xf58e('0x39')]=_0x37e03b[_0xf58e('0x31')][_0xf58e('0x32')]&&_0x37e03b[_0xf58e('0x31')][_0xf58e('0x32')][_0xf58e('0x33')]?_0x37e03b[_0xf58e('0x31')][_0xf58e('0x32')][_0xf58e('0x33')][_0xf58e('0x34')][_0xf58e('0x35')]:![];_0x3a98b2[_0xf58e('0xd')]['DIALOGFLOWV2_INTENTNAME']=_0x37e03b[_0xf58e('0x31')][_0xf58e('0x3a')][_0xf58e('0x3b')];_0x3a98b2[_0xf58e('0xd')][_0xf58e('0x3c')]=_0x37e03b[_0xf58e('0x31')][_0xf58e('0x3a')]['displayName'];_0x3a98b2[_0xf58e('0xd')][_0xf58e('0x3d')]=_0x37e03b[_0xf58e('0x31')][_0xf58e('0x3a')][_0xf58e('0x3e')];_0x3a98b2['body'][_0xf58e('0x3f')]=_0x37e03b[_0xf58e('0x31')][_0xf58e('0x40')];_0x3a98b2['body'][_0xf58e('0x41')]=_0x37e03b[_0xf58e('0x31')][_0xf58e('0x42')];_0x3a98b2[_0xf58e('0xd')]['DIALOGFLOWV2_SCORE']=_0x37e03b[_0xf58e('0x31')][_0xf58e('0x43')];_0x565172[_0xf58e('0x44')]='dialogflowV2';_0x565172[_0xf58e('0x45')]=JSON['stringify'](_0x3ad4c4);var _0x4f7a28=[];for(var _0x12eb59=0x0;_0x12eb59<_0x3ad4c4[_0xf58e('0x2f')];_0x12eb59++){var _0x4939ed=_0x3ad4c4[_0x12eb59];if(_0x4939ed&&_0x4939ed[_0xf58e('0x31')]&&_0x4939ed[_0xf58e('0x31')]['fulfillmentText']){_0x4f7a28[_0xf58e('0x46')](createMessage(_0x238c23,_0x571cfb,_0x565172,_0x4939ed[_0xf58e('0x31')][_0xf58e('0x47')]));}}return Promise[_0xf58e('0x48')](_0x4f7a28)[_0xf58e('0x49')](function(){if(_0x36ba5e){_0x4dfdb3[_0xf58e('0x18')]();}else{_0x4dfdb3[_0xf58e('0x2b')]();}})['catch'](function(_0x50ff6b){logger[_0xf58e('0x12')](_0xf58e('0x10'),_0x238c23,JSON[_0xf58e('0x13')](_0x50ff6b));_0x4dfdb3[_0xf58e('0x18')]();});}})['catch'](function(_0xbdb321){logger[_0xf58e('0x12')](_0xf58e('0x10'),_0x238c23,_0xbdb321[_0xf58e('0x2d')]);_0x4dfdb3[_0xf58e('0x18')]();});}}catch(_0x19bc95){logger['error'](_0xf58e('0x10'),_0x238c23,JSON[_0xf58e('0x13')](_0x19bc95));_0x4dfdb3['stop']();}};}; \ 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 bd911d2..d63a0b7 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 _0x144c=['[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','message','join','stop','condition','priorityTrue','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules'];(function(_0x5b5732,_0x37d358){var _0x2ce779=function(_0x3e891e){while(--_0x3e891e){_0x5b5732['push'](_0x5b5732['shift']());}};_0x2ce779(++_0x37d358);}(_0x144c,0x1de));var _0xc144=function(_0x15de7b,_0x1f9e4e){_0x15de7b=_0x15de7b-0x0;var _0x1456c4=_0x144c[_0x15de7b];return _0x1456c4;};'use strict';var schema=require(_0xc144('0x0'));var _=require(_0xc144('0x1'));var htmlToText=require(_0xc144('0x2'));var utils=require(_0xc144('0x3'));var logger=require(_0xc144('0x4'))('routing');var gotoif=schema({'condition':{'type':_0xc144('0x5'),'required':!![],'message':_0xc144('0x6')},'priorityTrue':{'type':_0xc144('0x7'),'message':_0xc144('0x8')},'priorityFalse':{'type':'number','message':'priority\x20false\x20is\x20a\x20number'}});exports[_0xc144('0x9')]=function(_0x494d54,_0x4ab188){return function(_0x5d1e65){try{var _0x5e71db={'condition':htmlToText[_0xc144('0xa')](utils[_0xc144('0xb')](_0x4ab188[0x0],this),{'wordwrap':![]})[_0xc144('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x4ab188[0x1],'priorityFalse':_0x4ab188[0x2]};var _0x5af2c1=gotoif['validate'](_0x5e71db,{'typecast':!![]});if(_0x5af2c1[_0xc144('0xd')]){logger[_0xc144('0xe')](_0xc144('0xf'),_0x494d54,_['map'](_0x5af2c1,_0xc144('0x10'))[_0xc144('0x11')](',\x20'));_0x5d1e65[_0xc144('0x12')]();}else{try{var _0xfeb5d5=eval('('+_0x5e71db[_0xc144('0x13')]+')');var _0x457769=_0xfeb5d5?_0x5e71db[_0xc144('0x14')]:_0x5e71db['priorityFalse'];logger[_0xc144('0x15')](_0xc144('0x16'),_0x494d54,_0x5e71db[_0xc144('0x13')],_0xfeb5d5,_0x457769||_0xc144('0x17'));if(_0x457769){var _0x31f531=_[_0xc144('0x18')](_0x5d1e65[_0xc144('0x19')](),{'p':_0x457769});if(_0x31f531>=0x0){logger['info'](_0xc144('0x1a'),_0x494d54,_0x457769||_0xc144('0x17'),_0x31f531);_0x5d1e65[_0xc144('0x17')](_0x31f531);}else{logger[_0xc144('0x15')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x494d54,_0x457769||_0xc144('0x17'));_0x5d1e65[_0xc144('0x12')]();}}else{_0x5d1e65[_0xc144('0x17')]();}}catch(_0x4f2a89){logger[_0xc144('0xe')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x494d54,_0x4f2a89[_0xc144('0x10')]);_0x5d1e65['stop']();}}}catch(_0x11c985){logger[_0xc144('0xe')]('[%s][GOTOIF]\x20%s',_0x494d54,JSON[_0xc144('0x1b')](_0x11c985));_0x5d1e65[_0xc144('0x12')]();}};}; \ No newline at end of file +var _0x5c71=['number','priority\x20true\x20is\x20a\x20number','consequence','fromString','getMustacheRender','length','error','message','join','stop','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','[%s][GOTOIF]\x20%s','stringify','validate','lodash','./utils','../../../../config/logger','string'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x5c71,0x15a));var _0x15c7=function(_0x556e06,_0x52a157){_0x556e06=_0x556e06-0x0;var _0x1f54b3=_0x5c71[_0x556e06];return _0x1f54b3;};'use strict';var schema=require(_0x15c7('0x0'));var _=require(_0x15c7('0x1'));var htmlToText=require('html-to-text');var utils=require(_0x15c7('0x2'));var logger=require(_0x15c7('0x3'))('routing');var gotoif=schema({'condition':{'type':_0x15c7('0x4'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x15c7('0x5'),'message':_0x15c7('0x6')},'priorityFalse':{'type':'number','message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x15c7('0x7')]=function(_0x2e5fa9,_0x4be028){return function(_0x52dd29){try{var _0x413854={'condition':htmlToText[_0x15c7('0x8')](utils[_0x15c7('0x9')](_0x4be028[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x4be028[0x1],'priorityFalse':_0x4be028[0x2]};var _0x17b900=gotoif['validate'](_0x413854,{'typecast':!![]});if(_0x17b900[_0x15c7('0xa')]){logger[_0x15c7('0xb')]('[%s][GOTOIF]\x20%s',_0x2e5fa9,_['map'](_0x17b900,_0x15c7('0xc'))[_0x15c7('0xd')](',\x20'));_0x52dd29[_0x15c7('0xe')]();}else{try{var _0xc86af=eval('('+_0x413854['condition']+')');var _0x1d4f33=_0xc86af?_0x413854[_0x15c7('0xf')]:_0x413854[_0x15c7('0x10')];logger[_0x15c7('0x11')](_0x15c7('0x12'),_0x2e5fa9,_0x413854[_0x15c7('0x13')],_0xc86af,_0x1d4f33||_0x15c7('0x14'));if(_0x1d4f33){var _0xcef7f7=_[_0x15c7('0x15')](_0x52dd29['rules'](),{'p':_0x1d4f33});if(_0xcef7f7>=0x0){logger[_0x15c7('0x11')](_0x15c7('0x16'),_0x2e5fa9,_0x1d4f33||_0x15c7('0x14'),_0xcef7f7);_0x52dd29['next'](_0xcef7f7);}else{logger[_0x15c7('0x11')](_0x15c7('0x17'),_0x2e5fa9,_0x1d4f33||_0x15c7('0x14'));_0x52dd29[_0x15c7('0xe')]();}}else{_0x52dd29[_0x15c7('0x14')]();}}catch(_0x1fe215){logger[_0x15c7('0xb')](_0x15c7('0x18'),_0x2e5fa9,_0x1fe215[_0x15c7('0xc')]);_0x52dd29['stop']();}}}catch(_0x553c67){logger[_0x15c7('0xb')](_0x15c7('0x19'),_0x2e5fa9,JSON[_0x15c7('0x1a')](_0x553c67));_0x52dd29[_0x15c7('0xe')]();}};}; \ 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 1539e48..88d912c 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 _0x0d94=['routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error','[%s][GOTOP]\x20%s','map','message','join','stop','priority','findIndex','rules','info','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','lodash','../../../../config/logger'];(function(_0x2244e0,_0x47b532){var _0x1d39b9=function(_0x74e549){while(--_0x74e549){_0x2244e0['push'](_0x2244e0['shift']());}};_0x1d39b9(++_0x47b532);}(_0x0d94,0x10c));var _0x40d9=function(_0x55b22f,_0x22bd34){_0x55b22f=_0x55b22f-0x0;var _0x594fb5=_0x0d94[_0x55b22f];return _0x594fb5;};'use strict';var schema=require('validate');var _=require(_0x40d9('0x0'));var logger=require(_0x40d9('0x1'))(_0x40d9('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x40d9('0x3')}});exports['consequence']=function(_0x5c92d6,_0x401f73){return function(_0x36a964){try{var _0x8fad96={'priority':_0x401f73[0x0]};var _0x4e3302=gotop['validate'](_0x8fad96,{'typecast':!![]});if(_0x4e3302[_0x40d9('0x4')]){logger[_0x40d9('0x5')](_0x40d9('0x6'),_0x5c92d6,_[_0x40d9('0x7')](_0x4e3302,_0x40d9('0x8'))[_0x40d9('0x9')](',\x20'));_0x36a964[_0x40d9('0xa')]();}else{logger['info']('[%s][GOTOP]\x20priority\x20%s',_0x5c92d6,_0x8fad96[_0x40d9('0xb')]);if(_0x8fad96['priority']){var _0x1c8fcc=_[_0x40d9('0xc')](_0x36a964[_0x40d9('0xd')](),{'p':_0x8fad96[_0x40d9('0xb')]});if(_0x1c8fcc>=0x0){logger[_0x40d9('0xe')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x5c92d6,_0x8fad96[_0x40d9('0xb')]||_0x40d9('0xf'),_0x1c8fcc);_0x36a964[_0x40d9('0xf')](_0x1c8fcc);}else{logger[_0x40d9('0xe')](_0x40d9('0x10'),_0x5c92d6,_0x8fad96['priority']||_0x40d9('0xf'));_0x36a964[_0x40d9('0xa')]();}}else{_0x36a964[_0x40d9('0xf')]();}}}catch(_0x483b7a){logger[_0x40d9('0x5')](_0x40d9('0x6'),_0x5c92d6,JSON[_0x40d9('0x11')](_0x483b7a));_0x36a964[_0x40d9('0xa')]();}};}; \ No newline at end of file +var _0x6ebb=['message','join','stop','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stringify','validate','lodash','../../../../config/logger','routing','consequence','length','error','[%s][GOTOP]\x20%s','map'];(function(_0x1139d0,_0x41e5f8){var _0xcc01a6=function(_0x504ffa){while(--_0x504ffa){_0x1139d0['push'](_0x1139d0['shift']());}};_0xcc01a6(++_0x41e5f8);}(_0x6ebb,0x1eb));var _0xb6eb=function(_0x44a05f,_0x3f5f3a){_0x44a05f=_0x44a05f-0x0;var _0x1b5bc2=_0x6ebb[_0x44a05f];return _0x1b5bc2;};'use strict';var schema=require(_0xb6eb('0x0'));var _=require(_0xb6eb('0x1'));var logger=require(_0xb6eb('0x2'))(_0xb6eb('0x3'));var gotop=schema({'priority':{'type':'number','required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xb6eb('0x4')]=function(_0x30b783,_0x169c84){return function(_0x467d7a){try{var _0x43ff45={'priority':_0x169c84[0x0]};var _0x13b951=gotop['validate'](_0x43ff45,{'typecast':!![]});if(_0x13b951[_0xb6eb('0x5')]){logger[_0xb6eb('0x6')](_0xb6eb('0x7'),_0x30b783,_[_0xb6eb('0x8')](_0x13b951,_0xb6eb('0x9'))[_0xb6eb('0xa')](',\x20'));_0x467d7a[_0xb6eb('0xb')]();}else{logger['info'](_0xb6eb('0xc'),_0x30b783,_0x43ff45[_0xb6eb('0xd')]);if(_0x43ff45[_0xb6eb('0xd')]){var _0x9bed84=_[_0xb6eb('0xe')](_0x467d7a[_0xb6eb('0xf')](),{'p':_0x43ff45[_0xb6eb('0xd')]});if(_0x9bed84>=0x0){logger[_0xb6eb('0x10')](_0xb6eb('0x11'),_0x30b783,_0x43ff45['priority']||_0xb6eb('0x12'),_0x9bed84);_0x467d7a[_0xb6eb('0x12')](_0x9bed84);}else{logger[_0xb6eb('0x10')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x30b783,_0x43ff45[_0xb6eb('0xd')]||_0xb6eb('0x12'));_0x467d7a[_0xb6eb('0xb')]();}}else{_0x467d7a[_0xb6eb('0x12')]();}}}catch(_0x26e88a){logger[_0xb6eb('0x6')](_0xb6eb('0x7'),_0x30b783,JSON[_0xb6eb('0x13')](_0x26e88a));_0x467d7a[_0xb6eb('0xb')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index a685688..66c98c0 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 _0x62a5=['stop','lodash','./utils','../../../../config/logger','routing','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','chat','ChatWebsiteId','channel','AccountId','upperFirst','InteractionId','interaction','Message','[%s][MESSAGE]\x20%s','body','next','catch','error'];(function(_0x1cb71e,_0x285a98){var _0x36e252=function(_0x5b9b2f){while(--_0x5b9b2f){_0x1cb71e['push'](_0x1cb71e['shift']());}};_0x36e252(++_0x285a98);}(_0x62a5,0x14b));var _0x562a=function(_0x74e44d,_0x1d311e){_0x74e44d=_0x74e44d-0x0;var _0x3afe1e=_0x62a5[_0x74e44d];return _0x3afe1e;};'use strict';var _=require(_0x562a('0x0'));var utils=require(_0x562a('0x1'));var logger=require(_0x562a('0x2'))(_0x562a('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x562a('0x4')),'faxMessage':require(_0x562a('0x5')),'whatsappMessage':require(_0x562a('0x6'))};exports['consequence']=function(_0x4be437,_0x48420b){return function(_0x21c955){try{var _0x3d4aaf={'body':utils[_0x562a('0x7')](_0x48420b[0x0],this),'ContactId':this['contact']['id']};if(this['channel']===_0x562a('0x8')){_0x3d4aaf[_0x562a('0x9')]=this['account']['id'];}else{_0x3d4aaf[_['upperFirst'](this[_0x562a('0xa')])+_0x562a('0xb')]=this['account']['id'];}_0x3d4aaf[_[_0x562a('0xc')](this[_0x562a('0xa')])+_0x562a('0xd')]=this[_0x562a('0xe')]['id'];if(rpc[this[_0x562a('0xa')]+'Message']){return rpc[this[_0x562a('0xa')]+_0x562a('0xf')]['create'](_0x3d4aaf)['then'](function(_0x5f423d){logger['info'](_0x562a('0x10'),_0x4be437,_0x3d4aaf[_0x562a('0x11')]);_0x21c955[_0x562a('0x12')]();})[_0x562a('0x13')](function(_0x5a4d4a){logger[_0x562a('0x14')](_0x562a('0x10'),_0x4be437,JSON['stringify'](_0x5a4d4a));_0x21c955[_0x562a('0x15')]();});}}catch(_0x355680){logger[_0x562a('0x14')](_0x562a('0x10'),_0x4be437,JSON['stringify'](_0x355680));_0x21c955[_0x562a('0x15')]();}};}; \ No newline at end of file +var _0xa6ea=['stop','error','lodash','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','channel','chat','account','upperFirst','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','next','stringify'];(function(_0x57119b,_0x1ff63d){var _0x15c29b=function(_0x35bb52){while(--_0x35bb52){_0x57119b['push'](_0x57119b['shift']());}};_0x15c29b(++_0x1ff63d);}(_0xa6ea,0x1ce));var _0xaa6e=function(_0x13092c,_0xfceb6d){_0x13092c=_0x13092c-0x0;var _0x4d3f2a=_0xa6ea[_0x13092c];return _0x4d3f2a;};'use strict';var _=require(_0xaa6e('0x0'));var utils=require('./utils');var logger=require(_0xaa6e('0x1'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xaa6e('0x2')),'mailMessage':require(_0xaa6e('0x3')),'smsMessage':require(_0xaa6e('0x4')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xaa6e('0x5'))};exports[_0xaa6e('0x6')]=function(_0x56a9e9,_0x19f1f1){return function(_0x4a4697){try{var _0x2222d8={'body':utils[_0xaa6e('0x7')](_0x19f1f1[0x0],this),'ContactId':this['contact']['id']};if(this[_0xaa6e('0x8')]===_0xaa6e('0x9')){_0x2222d8['ChatWebsiteId']=this[_0xaa6e('0xa')]['id'];}else{_0x2222d8[_[_0xaa6e('0xb')](this[_0xaa6e('0x8')])+'AccountId']=this['account']['id'];}_0x2222d8[_[_0xaa6e('0xb')](this[_0xaa6e('0x8')])+_0xaa6e('0xc')]=this[_0xaa6e('0xd')]['id'];if(rpc[this[_0xaa6e('0x8')]+_0xaa6e('0xe')]){return rpc[this[_0xaa6e('0x8')]+_0xaa6e('0xe')][_0xaa6e('0xf')](_0x2222d8)[_0xaa6e('0x10')](function(_0x2b6467){logger[_0xaa6e('0x11')](_0xaa6e('0x12'),_0x56a9e9,_0x2222d8['body']);_0x4a4697[_0xaa6e('0x13')]();})['catch'](function(_0x373858){logger['error'](_0xaa6e('0x12'),_0x56a9e9,JSON[_0xaa6e('0x14')](_0x373858));_0x4a4697[_0xaa6e('0x15')]();});}}catch(_0xc76ed4){logger[_0xaa6e('0x16')](_0xaa6e('0x12'),_0x56a9e9,JSON['stringify'](_0xc76ed4));_0x4a4697['stop']();}};}; \ 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 0feda5c..677445f 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 _0xd89e=['info','[%s][NOOP]\x20%s','stringify','stop','../../../../config/logger','routing'];(function(_0x4b5813,_0x5769de){var _0x423465=function(_0x18071f){while(--_0x18071f){_0x4b5813['push'](_0x4b5813['shift']());}};_0x423465(++_0x5769de);}(_0xd89e,0x124));var _0xed89=function(_0x497134,_0x45d81c){_0x497134=_0x497134-0x0;var _0x1a1200=_0xd89e[_0x497134];return _0x1a1200;};'use strict';var utils=require('./utils');var logger=require(_0xed89('0x0'))(_0xed89('0x1'));exports['consequence']=function(_0x33969c,_0x32a772){return function(_0x2d2662){try{logger[_0xed89('0x2')](_0xed89('0x3'),_0x33969c,utils['getMustacheRender'](_0x32a772[0x0],this));_0x2d2662['next']();}catch(_0x27c8cb){logger['error'](_0xed89('0x3'),_0x33969c,JSON[_0xed89('0x4')](_0x27c8cb));_0x2d2662[_0xed89('0x5')]();}};}; \ No newline at end of file +var _0x9418=['getMustacheRender','next','error','stringify','./utils','routing','consequence','[%s][NOOP]\x20%s'];(function(_0x1aa049,_0x9ae13c){var _0x357f29=function(_0xfd2f83){while(--_0xfd2f83){_0x1aa049['push'](_0x1aa049['shift']());}};_0x357f29(++_0x9ae13c);}(_0x9418,0x19c));var _0x8941=function(_0x33a6bd,_0x564362){_0x33a6bd=_0x33a6bd-0x0;var _0x339aff=_0x9418[_0x33a6bd];return _0x339aff;};'use strict';var utils=require(_0x8941('0x0'));var logger=require('../../../../config/logger')(_0x8941('0x1'));exports[_0x8941('0x2')]=function(_0x422ffa,_0x23ff93){return function(_0x50157b){try{logger['info'](_0x8941('0x3'),_0x422ffa,utils[_0x8941('0x4')](_0x23ff93[0x0],this));_0x50157b[_0x8941('0x5')]();}catch(_0x130696){logger[_0x8941('0x6')]('[%s][NOOP]\x20%s',_0x422ffa,JSON[_0x8941('0x7')](_0x130696));_0x50157b['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 2db5ee0..3cafd41 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 _0x4ab4=['pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','interaction','MessageId','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','error','create\x20queue\x20report','accepted','message','catch','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','validate','[%s][QUEUE]\x20%s','map','Queues','createQueue','atimeout','qtimeout','[%s][QUEUE]\x20ROUTING\x20STOPPED','rules','stop','complete','[%s][QUEUE]\x20APPLICATION\x20END','close','next','strategy','rrmemory','beepall','log','stack','util','seq-queue','moment','ioredis','../../../../config/environment','routing','./strategy','redis','defaults','localhost','account','queue','from','queue_id','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4ab4,0x1f2));var _0x44ab=function(_0x46f899,_0x26ef5a){_0x46f899=_0x46f899-0x0;var _0x3ac01b=_0x4ab4[_0x46f899];return _0x3ac01b;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0x44ab('0x0'));var seqqueue=require(_0x44ab('0x1'));var moment=require(_0x44ab('0x2'));var Redis=require(_0x44ab('0x3'));var config=require(_0x44ab('0x4'));var logger=require('../../../../config/logger')(_0x44ab('0x5'));var strategy=require(_0x44ab('0x6'));config[_0x44ab('0x7')]=_[_0x44ab('0x8')](config[_0x44ab('0x7')],{'host':_0x44ab('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var attributes=['id','queue_id',_0x44ab('0xa'),_0x44ab('0xb'),_0x44ab('0xc'),'joinAt'];function emit(_0x2906ec,_0x35335b,_0x566820){io['to'](_0x2906ec)['emit'](_0x35335b,_0x566820);}function emitChannelQueueInteraction(_0x49319b,_0x177253,_0x18df25,_0x3c0960,_0x210690,_0x33637d,_0x279e74,_0x4f67f2){var _0x1fc5dc=_['clone'](_0x18df25);_0x1fc5dc[_0x44ab('0xd')]=_0x4f67f2;_0x1fc5dc[_0x44ab('0xb')]=_0x177253;_0x1fc5dc[_0x44ab('0xa')]=_0x3c0960;_0x1fc5dc['id']=_0x210690;if(_0x33637d){_0x279e74[util[_0x44ab('0xe')](_0x44ab('0xf'),_0x49319b)][_0x210690]=_['pick'](_0x1fc5dc,attributes);}else{delete _0x279e74[util['format'](_0x44ab('0xf'),_0x49319b)][_0x210690];}emit(util[_0x44ab('0xe')](_0x44ab('0x10'),_0x49319b,_0x177253),util[_0x44ab('0xe')](_0x44ab('0x11'),_0x49319b,_0x33637d?_0x44ab('0x12'):_0x44ab('0x13')),_[_0x44ab('0x14')](_0x1fc5dc,attributes));}var rpc={'openchannelQueueReport':require(_0x44ab('0x15')),'mailQueueReport':require(_0x44ab('0x16')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x44ab('0x17')),'faxQueueReport':require(_0x44ab('0x18')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x44ab('0x19'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x44ab('0x1a'),'message':_0x44ab('0x1b')}});function startRouting(_0x35b33f,_0x1f2af0,_0xd9c70,_0x4e794c){if(_0x35b33f&&_0x1f2af0&&_0xd9c70){_0x1f2af0[_0x44ab('0x1c')]+=0x1;var _0x303dc3={'uniqueid':_0x35b33f,'from':_0xd9c70[_0x44ab('0x1d')]?_0xd9c70[_0x44ab('0x1d')][_0x44ab('0xc')]:'','joinAt':moment()[_0x44ab('0xe')](_0x44ab('0x1e')),'ContactId':_0xd9c70[_0x44ab('0x1f')]?_0xd9c70[_0x44ab('0x1f')]['id']:null,'ListId':_0xd9c70[_0x44ab('0x20')]?_0xd9c70['list']['id']:null};_0x303dc3[_[_0x44ab('0x21')](_0xd9c70[_0x44ab('0x22')])+'QueueId']=_0x1f2af0['id']||null;_0x303dc3[_[_0x44ab('0x21')](_0xd9c70[_0x44ab('0x22')])+'InteractionId']=_0xd9c70[_0x44ab('0x23')]?_0xd9c70[_0x44ab('0x23')]['id']:null;_0x303dc3[_['upperFirst'](_0xd9c70[_0x44ab('0x22')])+_0x44ab('0x24')]=_0xd9c70['message']?_0xd9c70['message']['id']:null;_0x303dc3[_[_0x44ab('0x21')](_0xd9c70[_0x44ab('0x22')])+(_0xd9c70[_0x44ab('0x22')]!==_0x44ab('0x25')?_0x44ab('0x26'):_0x44ab('0x27'))]=_0xd9c70['account']?_0xd9c70['account']['id']:null;logger[_0x44ab('0x28')](util[_0x44ab('0xe')](_0x44ab('0x29'),_0x35b33f,_0x1f2af0[_0x44ab('0x2a')]));emitChannelQueueInteraction(_0xd9c70[_0x44ab('0x22')],_0x1f2af0[_0x44ab('0x2a')],_0x303dc3,_0xd9c70[_0x44ab('0xa')][_0x44ab('0x2a')],_0xd9c70['message']['id'],!![],_0x4e794c,_0x1f2af0['id']);if(rpc[_0xd9c70[_0x44ab('0x22')]+'QueueReport']){return rpc[_0xd9c70[_0x44ab('0x22')]+_0x44ab('0x2b')][_0x44ab('0x2c')](_0x303dc3)['catch'](function(_0x4d2044){logger[_0x44ab('0x2d')](_0x44ab('0x2e'));});}}}function stopRouting(_0x4c6505,_0x99cda9,_0x2cd9fd,_0x140753){if(_0x4c6505&&_0x99cda9){_0x99cda9['waiting']-=0x1;var _0x5cf3fb={'leaveAt':moment()[_0x44ab('0xe')](_0x44ab('0x1e')),'acceptAt':moment()[_0x44ab('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x44ab('0x2f')};logger[_0x44ab('0x28')](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x4c6505,_0x99cda9[_0x44ab('0x2a')]));emitChannelQueueInteraction(_0x2cd9fd['channel'],_0x99cda9[_0x44ab('0x2a')],_0x2cd9fd[_0x44ab('0x1d')],_0x2cd9fd[_0x44ab('0xa')][_0x44ab('0x2a')],_0x2cd9fd[_0x44ab('0x30')]['id'],![],_0x140753,_0x99cda9['id']);if(rpc[_0x2cd9fd['channel']+_0x44ab('0x2b')]){return rpc[_0x2cd9fd[_0x44ab('0x22')]+_0x44ab('0x2b')]['update'](_0x4c6505,_0x5cf3fb)[_0x44ab('0x31')](function(_0x11383c){logger['error'](_0x44ab('0x32'));});}}}function endRouting(_0x1e8a8d,_0x15c26d,_0x4edaa8,_0x46894a){if(_0x1e8a8d&&_0x15c26d){_0x15c26d['waiting']-=0x1;var _0x1e0b8b={'leaveAt':moment()['format'](_0x44ab('0x1e')),'exitAt':moment()[_0x44ab('0xe')](_0x44ab('0x1e')),'reason':_0x44ab('0x33')};logger['info'](util['format'](_0x44ab('0x34'),_0x1e8a8d,_0x15c26d[_0x44ab('0x2a')]));emitChannelQueueInteraction(_0x4edaa8[_0x44ab('0x22')],_0x15c26d[_0x44ab('0x2a')],_0x4edaa8[_0x44ab('0x1d')],_0x4edaa8[_0x44ab('0xa')][_0x44ab('0x2a')],_0x4edaa8[_0x44ab('0x30')]['id'],![],_0x46894a);if(rpc[_0x4edaa8[_0x44ab('0x22')]+'QueueReport']){return rpc[_0x4edaa8[_0x44ab('0x22')]+_0x44ab('0x2b')][_0x44ab('0x35')](_0x1e8a8d,_0x1e0b8b)[_0x44ab('0x31')](function(_0x4bd73e){logger[_0x44ab('0x2d')](_0x44ab('0x32'));});}}}function handleFindQueue(_0x2b0c9c){return function(_0x38066f){return _0x38066f['name'][_0x44ab('0x36')]()===_0x2b0c9c[_0x44ab('0x36')]();};}exports['consequence']=function(_0x393870,_0x102a7c,_0x340a38,_0x4fcf6b){return function(_0x322f4c){try{var _0x40110b={'name':_0x102a7c[0x0],'timeout':_0x102a7c[0x1]};var _0x4281a7=queue[_0x44ab('0x37')](_0x40110b,{'typecast':!![]});if(_0x4281a7['length']){logger[_0x44ab('0x2d')](_0x44ab('0x38'),_0x393870,_[_0x44ab('0x39')](_0x4281a7,_0x44ab('0x30'))['join'](',\x20'));_0x322f4c['stop']();}else{var _0x43d72b=_['find'](_0x340a38[_0x4fcf6b[_0x44ab('0x22')]+_0x44ab('0x3a')],handleFindQueue(_0x40110b[_0x44ab('0x2a')]));if(_0x43d72b){startRouting(_0x393870,_0x43d72b,_0x4fcf6b,_0x340a38);var _0x8daf72=(_0x43d72b['timeout']||0xa)*0x3e8;var _0x48fdcf=(_0x40110b[_0x44ab('0x33')]||0x14)*0x3e8;var _0x6f98c7,_0x43d820;if(_0x8daf72>_0x48fdcf){_0x48fdcf=_0x8daf72;}var _0x421382=seqqueue[_0x44ab('0x3b')](_0x8daf72);_0x421382['id']=_0x393870;_0x421382[_0x44ab('0x3c')]=_0x8daf72;_0x421382[_0x44ab('0x3d')]=_0x48fdcf;_0x421382['channel']=_0x4fcf6b[_0x44ab('0x22')];_0x340a38['rules'][_0x393870]['on']('end',function(){logger[_0x44ab('0x28')](_0x44ab('0x3e'),_0x393870);stopRouting(_0x393870,_0x43d72b,_0x4fcf6b,_0x340a38);clearTimeout(_0x6f98c7);_0x6f98c7=undefined;_0x421382['close'](!![]);if(_0x340a38[_0x44ab('0x3f')][_0x393870]){delete _0x340a38[_0x44ab('0x3f')][_0x393870];}_0x322f4c[_0x44ab('0x40')]();});_0x340a38['rules'][_0x393870]['on'](_0x44ab('0x41'),function(){if(_0x340a38[_0x44ab('0x3f')][_0x393870]){delete _0x340a38[_0x44ab('0x3f')][_0x393870];}});_0x6f98c7=setTimeout(function(){logger[_0x44ab('0x28')](_0x44ab('0x42'),_0x393870);endRouting(_0x393870,_0x43d72b,_0x4fcf6b,_0x340a38);clearTimeout(_0x6f98c7);_0x421382[_0x44ab('0x43')](!![]);_0x322f4c[_0x44ab('0x44')]();},_0x48fdcf);switch(_0x43d72b[_0x44ab('0x45')]){case _0x44ab('0x46'):strategy[_0x44ab('0x46')](_0x421382,_0x43d72b,_0x340a38,_0x4fcf6b);break;default:strategy[_0x44ab('0x47')](_0x421382,_0x43d72b,_0x340a38,_0x4fcf6b);}}else{logger[_0x44ab('0x2d')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x393870,_0x40110b[_0x44ab('0x2a')]);_0x322f4c['stop']();}}}catch(_0x4a9fa8){console[_0x44ab('0x48')](_0x4a9fa8);logger[_0x44ab('0x2d')]('[%s][QUEUE]\x20%s',_0x393870,_0x4a9fa8[_0x44ab('0x49')]);_0x322f4c[_0x44ab('0x40')]();}};}; \ No newline at end of file +var _0x5d39=['string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','AccountId','WebsiteId','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','info','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','consequence','validate','[%s][QUEUE]\x20%s','map','join','find','Queues','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','stop','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','util','seq-queue','moment','ioredis','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','queue','from','joinAt','clone','account','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport'];(function(_0x48cac8,_0x150d03){var _0x539232=function(_0x2fe472){while(--_0x2fe472){_0x48cac8['push'](_0x48cac8['shift']());}};_0x539232(++_0x150d03);}(_0x5d39,0xcb));var _0x95d3=function(_0x1bc3f8,_0x1dc8cb){_0x1bc3f8=_0x1bc3f8-0x0;var _0x1596b4=_0x5d39[_0x1bc3f8];return _0x1596b4;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0x95d3('0x0'));var seqqueue=require(_0x95d3('0x1'));var moment=require(_0x95d3('0x2'));var Redis=require(_0x95d3('0x3'));var config=require('../../../../config/environment');var logger=require(_0x95d3('0x4'))(_0x95d3('0x5'));var strategy=require(_0x95d3('0x6'));config[_0x95d3('0x7')]=_[_0x95d3('0x8')](config['redis'],{'host':_0x95d3('0x9'),'port':0x18eb});var io=require(_0x95d3('0xa'))(new Redis(config[_0x95d3('0x7')]));var attributes=['id',_0x95d3('0xb'),'account',_0x95d3('0xc'),_0x95d3('0xd'),_0x95d3('0xe')];function emit(_0x49a219,_0xdd06b6,_0xd5c390){io['to'](_0x49a219)['emit'](_0xdd06b6,_0xd5c390);}function emitChannelQueueInteraction(_0x388319,_0x118a3e,_0x1200a2,_0x487fad,_0x5d930e,_0x47d808,_0x49648d,_0x4fe641){var _0x3aca84=_[_0x95d3('0xf')](_0x1200a2);_0x3aca84[_0x95d3('0xb')]=_0x4fe641;_0x3aca84[_0x95d3('0xc')]=_0x118a3e;_0x3aca84[_0x95d3('0x10')]=_0x487fad;_0x3aca84['id']=_0x5d930e;if(_0x47d808){_0x49648d[util[_0x95d3('0x11')](_0x95d3('0x12'),_0x388319)][_0x5d930e]=_[_0x95d3('0x13')](_0x3aca84,attributes);}else{delete _0x49648d[util[_0x95d3('0x11')]('%sQueuesWaitingInteractions',_0x388319)][_0x5d930e];}emit(util[_0x95d3('0x11')](_0x95d3('0x14'),_0x388319,_0x118a3e),util[_0x95d3('0x11')](_0x95d3('0x15'),_0x388319,_0x47d808?'save':_0x95d3('0x16')),_[_0x95d3('0x13')](_0x3aca84,attributes));}var rpc={'openchannelQueueReport':require(_0x95d3('0x17')),'mailQueueReport':require(_0x95d3('0x18')),'chatQueueReport':require(_0x95d3('0x19')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x95d3('0x1a')),'whatsappQueueReport':require(_0x95d3('0x1b'))};var queue=schema({'name':{'type':_0x95d3('0x1c'),'required':!![],'message':_0x95d3('0x1d')},'timeout':{'type':_0x95d3('0x1e'),'message':_0x95d3('0x1f')}});function startRouting(_0x4efa88,_0x13e171,_0x355f88,_0x4d03da){if(_0x4efa88&&_0x13e171&&_0x355f88){_0x13e171[_0x95d3('0x20')]+=0x1;var _0x2aa1a8={'uniqueid':_0x4efa88,'from':_0x355f88[_0x95d3('0x21')]?_0x355f88['body']['from']:'','joinAt':moment()['format'](_0x95d3('0x22')),'ContactId':_0x355f88[_0x95d3('0x23')]?_0x355f88['contact']['id']:null,'ListId':_0x355f88[_0x95d3('0x24')]?_0x355f88[_0x95d3('0x24')]['id']:null};_0x2aa1a8[_[_0x95d3('0x25')](_0x355f88[_0x95d3('0x26')])+_0x95d3('0x27')]=_0x13e171['id']||null;_0x2aa1a8[_[_0x95d3('0x25')](_0x355f88['channel'])+_0x95d3('0x28')]=_0x355f88['interaction']?_0x355f88[_0x95d3('0x29')]['id']:null;_0x2aa1a8[_[_0x95d3('0x25')](_0x355f88[_0x95d3('0x26')])+_0x95d3('0x2a')]=_0x355f88[_0x95d3('0x2b')]?_0x355f88[_0x95d3('0x2b')]['id']:null;_0x2aa1a8[_[_0x95d3('0x25')](_0x355f88['channel'])+(_0x355f88['channel']!=='chat'?_0x95d3('0x2c'):_0x95d3('0x2d'))]=_0x355f88[_0x95d3('0x10')]?_0x355f88[_0x95d3('0x10')]['id']:null;logger['info'](util['format']('[%s][START:QUEUE][NAME:%s]',_0x4efa88,_0x13e171[_0x95d3('0x2e')]));emitChannelQueueInteraction(_0x355f88[_0x95d3('0x26')],_0x13e171[_0x95d3('0x2e')],_0x2aa1a8,_0x355f88[_0x95d3('0x10')][_0x95d3('0x2e')],_0x355f88[_0x95d3('0x2b')]['id'],!![],_0x4d03da,_0x13e171['id']);if(rpc[_0x355f88[_0x95d3('0x26')]+_0x95d3('0x2f')]){return rpc[_0x355f88[_0x95d3('0x26')]+_0x95d3('0x2f')][_0x95d3('0x30')](_0x2aa1a8)[_0x95d3('0x31')](function(_0x2f2b7d){logger[_0x95d3('0x32')](_0x95d3('0x33'));});}}}function stopRouting(_0x45e125,_0x4e7deb,_0xfb8866,_0x2e75b1){if(_0x45e125&&_0x4e7deb){_0x4e7deb['waiting']-=0x1;var _0x5950df={'leaveAt':moment()[_0x95d3('0x11')](_0x95d3('0x22')),'acceptAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x95d3('0x34')};logger[_0x95d3('0x35')](util[_0x95d3('0x11')](_0x95d3('0x36'),_0x45e125,_0x4e7deb[_0x95d3('0x2e')]));emitChannelQueueInteraction(_0xfb8866[_0x95d3('0x26')],_0x4e7deb['name'],_0xfb8866[_0x95d3('0x21')],_0xfb8866[_0x95d3('0x10')]['name'],_0xfb8866[_0x95d3('0x2b')]['id'],![],_0x2e75b1,_0x4e7deb['id']);if(rpc[_0xfb8866[_0x95d3('0x26')]+_0x95d3('0x2f')]){return rpc[_0xfb8866[_0x95d3('0x26')]+_0x95d3('0x2f')][_0x95d3('0x37')](_0x45e125,_0x5950df)['catch'](function(_0x4e7b3f){logger[_0x95d3('0x32')](_0x95d3('0x38'));});}}}function endRouting(_0x57ca92,_0x16a3e8,_0x3bb72c,_0x2f0bdc){if(_0x57ca92&&_0x16a3e8){_0x16a3e8[_0x95d3('0x20')]-=0x1;var _0x48f95d={'leaveAt':moment()[_0x95d3('0x11')](_0x95d3('0x22')),'exitAt':moment()['format'](_0x95d3('0x22')),'reason':_0x95d3('0x39')};logger[_0x95d3('0x35')](util[_0x95d3('0x11')]('[%s][END:QUEUE][NAME:%s]',_0x57ca92,_0x16a3e8[_0x95d3('0x2e')]));emitChannelQueueInteraction(_0x3bb72c[_0x95d3('0x26')],_0x16a3e8[_0x95d3('0x2e')],_0x3bb72c[_0x95d3('0x21')],_0x3bb72c[_0x95d3('0x10')][_0x95d3('0x2e')],_0x3bb72c[_0x95d3('0x2b')]['id'],![],_0x2f0bdc);if(rpc[_0x3bb72c[_0x95d3('0x26')]+_0x95d3('0x2f')]){return rpc[_0x3bb72c['channel']+_0x95d3('0x2f')]['update'](_0x57ca92,_0x48f95d)['catch'](function(_0x1bdb58){logger[_0x95d3('0x32')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x476515){return function(_0x3bd31a){return _0x3bd31a[_0x95d3('0x2e')]['toLowerCase']()===_0x476515['toLowerCase']();};}exports[_0x95d3('0x3a')]=function(_0x181642,_0x4044f5,_0x45d00a,_0x2106a3){return function(_0x4f75a1){try{var _0x304f0d={'name':_0x4044f5[0x0],'timeout':_0x4044f5[0x1]};var _0x568b95=queue[_0x95d3('0x3b')](_0x304f0d,{'typecast':!![]});if(_0x568b95['length']){logger[_0x95d3('0x32')](_0x95d3('0x3c'),_0x181642,_[_0x95d3('0x3d')](_0x568b95,'message')[_0x95d3('0x3e')](',\x20'));_0x4f75a1['stop']();}else{var _0x147f9f=_[_0x95d3('0x3f')](_0x45d00a[_0x2106a3['channel']+_0x95d3('0x40')],handleFindQueue(_0x304f0d[_0x95d3('0x2e')]));if(_0x147f9f){startRouting(_0x181642,_0x147f9f,_0x2106a3,_0x45d00a);var _0x49dcb9=(_0x147f9f[_0x95d3('0x39')]||0xa)*0x3e8;var _0x4fcfeb=(_0x304f0d[_0x95d3('0x39')]||0x14)*0x3e8;var _0x2f694c,_0x56b0e3;if(_0x49dcb9>_0x4fcfeb){_0x4fcfeb=_0x49dcb9;}var _0x3d1c0c=seqqueue['createQueue'](_0x49dcb9);_0x3d1c0c['id']=_0x181642;_0x3d1c0c['atimeout']=_0x49dcb9;_0x3d1c0c[_0x95d3('0x41')]=_0x4fcfeb;_0x3d1c0c[_0x95d3('0x26')]=_0x2106a3[_0x95d3('0x26')];_0x45d00a['rules'][_0x181642]['on'](_0x95d3('0x42'),function(){logger['info'](_0x95d3('0x43'),_0x181642);stopRouting(_0x181642,_0x147f9f,_0x2106a3,_0x45d00a);clearTimeout(_0x2f694c);_0x2f694c=undefined;_0x3d1c0c[_0x95d3('0x44')](!![]);if(_0x45d00a[_0x95d3('0x45')][_0x181642]){delete _0x45d00a[_0x95d3('0x45')][_0x181642];}_0x4f75a1[_0x95d3('0x46')]();});_0x45d00a[_0x95d3('0x45')][_0x181642]['on']('complete',function(){if(_0x45d00a[_0x95d3('0x45')][_0x181642]){delete _0x45d00a[_0x95d3('0x45')][_0x181642];}});_0x2f694c=setTimeout(function(){logger[_0x95d3('0x35')](_0x95d3('0x47'),_0x181642);endRouting(_0x181642,_0x147f9f,_0x2106a3,_0x45d00a);clearTimeout(_0x2f694c);_0x3d1c0c[_0x95d3('0x44')](!![]);_0x4f75a1['next']();},_0x4fcfeb);switch(_0x147f9f[_0x95d3('0x48')]){case _0x95d3('0x49'):strategy['rrmemory'](_0x3d1c0c,_0x147f9f,_0x45d00a,_0x2106a3);break;default:strategy[_0x95d3('0x4a')](_0x3d1c0c,_0x147f9f,_0x45d00a,_0x2106a3);}}else{logger[_0x95d3('0x32')](_0x95d3('0x4b'),_0x181642,_0x304f0d[_0x95d3('0x2e')]);_0x4f75a1[_0x95d3('0x46')]();}}}catch(_0x3cbc1a){console['log'](_0x3cbc1a);logger[_0x95d3('0x32')](_0x95d3('0x3c'),_0x181642,_0x3cbc1a[_0x95d3('0x4c')]);_0x4f75a1[_0x95d3('0x46')]();}};}; \ 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 3870738..567d704 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 _0x98bf=['agent','realtime','push','handleRun','bind','handleTimeout','drained','prototype','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','info','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','busyQueue','showNotification','writeLog','RINGING','forcedOwnership','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','busy','STOP','TIMEOUT','exports','./util','../../../../../config/logger','routing','notificationId','squeue'];(function(_0x37a896,_0x5569de){var _0x510515=function(_0x22eb4b){while(--_0x22eb4b){_0x37a896['push'](_0x37a896['shift']());}};_0x510515(++_0x5569de);}(_0x98bf,0x163));var _0xf98b=function(_0x4ed17b,_0x2b1745){_0x4ed17b=_0x4ed17b-0x0;var _0x24b248=_0x98bf[_0x4ed17b];return _0x24b248;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require(_0xf98b('0x0'));var logger=require(_0xf98b('0x1'))(_0xf98b('0x2'));var Agent=function(_0x55b8be,_0x5c974a,_0x2aaf01,_0x1a4f89){this[_0xf98b('0x3')]=uuid['v4']();this[_0xf98b('0x4')]=_0x55b8be;this[_0xf98b('0x5')]=_0x5c974a;this[_0xf98b('0x6')]=_0x2aaf01;this[_0xf98b('0x2')]=_0x1a4f89;this[_0xf98b('0x4')][_0xf98b('0x7')](this[_0xf98b('0x8')][_0xf98b('0x9')](this),this[_0xf98b('0xa')][_0xf98b('0x9')](this));this[_0xf98b('0x4')]['on']('timeout',this[_0xf98b('0xa')][_0xf98b('0x9')](this));this[_0xf98b('0x4')]['on'](_0xf98b('0xb'),this['handleDrained'][_0xf98b('0x9')](this));};Agent[_0xf98b('0xc')]['push']=function(){this[_0xf98b('0x4')][_0xf98b('0x7')](this[_0xf98b('0x8')]['bind'](this),this[_0xf98b('0xa')][_0xf98b('0x9')](this));};Agent[_0xf98b('0xc')]['handleDrained']=function(){this[_0xf98b('0xa')](!![]);};Agent['prototype']['handleRun']=function(_0x5f58aa){logger['info'](_0xf98b('0xd'),this['squeue']['id'],this[_0xf98b('0x5')]['id']);if(_[_0xf98b('0xe')](this[_0xf98b('0x6')][_0xf98b('0xf')][this[_0xf98b('0x5')]['id']])){logger[_0xf98b('0x10')](_0xf98b('0x11'),this[_0xf98b('0x4')]['id'],this[_0xf98b('0x5')]['id']);setTimeout(this[_0xf98b('0x7')]['bind'](this),0x3e8);}else{if(this[_0xf98b('0x2')]['forcedOwnership']||util[_0xf98b('0x12')](this[_0xf98b('0x4')]['id'],this[_0xf98b('0x6')]['agents'][this[_0xf98b('0x5')]['id']],this[_0xf98b('0x4')]['channel'],![])){this[_0xf98b('0x6')][_0xf98b('0xf')][this[_0xf98b('0x5')]['id']]['busy']=!![];this[_0xf98b('0x6')][_0xf98b('0xf')][this[_0xf98b('0x5')]['id']][_0xf98b('0x13')]=undefined;util[_0xf98b('0x14')](this[_0xf98b('0x3')],this['squeue']['id'],this[_0xf98b('0x6')][_0xf98b('0xf')][this[_0xf98b('0x5')]['id']],null,this['routing']);util[_0xf98b('0x15')](this[_0xf98b('0x4')]['id'],this[_0xf98b('0x6')][_0xf98b('0xf')][this[_0xf98b('0x5')]['id']],_0xf98b('0x16')+(this['routing'][_0xf98b('0x17')]?':FORCED':''));}else{logger[_0xf98b('0x10')](_0xf98b('0x18'),this[_0xf98b('0x4')]['id'],this['agent']['id']);setTimeout(this[_0xf98b('0x7')][_0xf98b('0x9')](this),0x3e8);}}};Agent[_0xf98b('0xc')][_0xf98b('0xa')]=function(_0x4c74f7){if(_[_0xf98b('0xe')](this['realtime']['agents'][this[_0xf98b('0x5')]['id']])){return logger[_0xf98b('0x10')](_0xf98b('0x11'),this[_0xf98b('0x4')]['id'],this[_0xf98b('0x5')]['id']);}else{logger[_0xf98b('0x10')](_0xf98b('0x19'),this[_0xf98b('0x4')]['id'],this[_0xf98b('0x5')]['id']);util['hideNotification'](this['notificationId'],this[_0xf98b('0x4')]['id'],this[_0xf98b('0x6')][_0xf98b('0xf')][this['agent']['id']],null,this['routing']);this[_0xf98b('0x6')][_0xf98b('0xf')][this[_0xf98b('0x5')]['id']][_0xf98b('0x1a')]=![];this[_0xf98b('0x6')][_0xf98b('0xf')][this[_0xf98b('0x5')]['id']][_0xf98b('0x13')]=undefined;util['writeLog'](this[_0xf98b('0x4')]['id'],this['realtime'][_0xf98b('0xf')][this[_0xf98b('0x5')]['id']],_0x4c74f7?_0xf98b('0x1b'):_0xf98b('0x1c'));}if(!_0x4c74f7){setTimeout(this[_0xf98b('0x7')]['bind'](this),0x3e8);}};function agent(_0x568fe6,_0x28d4db,_0x478bd3,_0x3ac10c){return new Agent(_0x568fe6,_0x28d4db,_0x478bd3,_0x3ac10c);}module[_0xf98b('0x1d')]=agent; \ No newline at end of file +var _0x6827=['push','info','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','showNotification','notificationId','writeLog','RINGING',':FORCED','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','TIMEOUT','exports','lodash','./util','../../../../../config/logger','routing','squeue','realtime','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype'];(function(_0xbfcfaa,_0xc0eee8){var _0x2c2fbf=function(_0x44d40b){while(--_0x44d40b){_0xbfcfaa['push'](_0xbfcfaa['shift']());}};_0x2c2fbf(++_0xc0eee8);}(_0x6827,0x197));var _0x7682=function(_0x3f9c41,_0xe25d4c){_0x3f9c41=_0x3f9c41-0x0;var _0x473b0e=_0x6827[_0x3f9c41];return _0x473b0e;};'use strict';var _=require(_0x7682('0x0'));var uuid=require('uuid');var util=require(_0x7682('0x1'));var logger=require(_0x7682('0x2'))(_0x7682('0x3'));var Agent=function(_0x226aec,_0xe36ee5,_0x86b25b,_0x5c19af){this['notificationId']=uuid['v4']();this[_0x7682('0x4')]=_0x226aec;this['agent']=_0xe36ee5;this[_0x7682('0x5')]=_0x86b25b;this[_0x7682('0x3')]=_0x5c19af;this['squeue']['push'](this[_0x7682('0x6')][_0x7682('0x7')](this),this[_0x7682('0x8')]['bind'](this));this[_0x7682('0x4')]['on'](_0x7682('0x9'),this['handleTimeout'][_0x7682('0x7')](this));this[_0x7682('0x4')]['on'](_0x7682('0xa'),this[_0x7682('0xb')]['bind'](this));};Agent[_0x7682('0xc')][_0x7682('0xd')]=function(){this['squeue'][_0x7682('0xd')](this[_0x7682('0x6')][_0x7682('0x7')](this),this[_0x7682('0x8')][_0x7682('0x7')](this));};Agent[_0x7682('0xc')]['handleDrained']=function(){this[_0x7682('0x8')](!![]);};Agent['prototype'][_0x7682('0x6')]=function(_0x51f7e1){logger[_0x7682('0xe')](_0x7682('0xf'),this[_0x7682('0x4')]['id'],this[_0x7682('0x10')]['id']);if(_[_0x7682('0x11')](this[_0x7682('0x5')][_0x7682('0x12')][this['agent']['id']])){logger[_0x7682('0xe')](_0x7682('0x13'),this['squeue']['id'],this[_0x7682('0x10')]['id']);setTimeout(this[_0x7682('0xd')]['bind'](this),0x3e8);}else{if(this[_0x7682('0x3')][_0x7682('0x14')]||util[_0x7682('0x15')](this[_0x7682('0x4')]['id'],this['realtime'][_0x7682('0x12')][this[_0x7682('0x10')]['id']],this['squeue'][_0x7682('0x16')],![])){this['realtime']['agents'][this[_0x7682('0x10')]['id']][_0x7682('0x17')]=!![];this['realtime']['agents'][this['agent']['id']][_0x7682('0x18')]=undefined;util[_0x7682('0x19')](this[_0x7682('0x1a')],this[_0x7682('0x4')]['id'],this[_0x7682('0x5')]['agents'][this['agent']['id']],null,this[_0x7682('0x3')]);util[_0x7682('0x1b')](this[_0x7682('0x4')]['id'],this['realtime'][_0x7682('0x12')][this['agent']['id']],_0x7682('0x1c')+(this[_0x7682('0x3')]['forcedOwnership']?_0x7682('0x1d'):''));}else{logger[_0x7682('0xe')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0x7682('0x4')]['id'],this[_0x7682('0x10')]['id']);setTimeout(this[_0x7682('0xd')][_0x7682('0x7')](this),0x3e8);}}};Agent[_0x7682('0xc')][_0x7682('0x8')]=function(_0x36d80f){if(_[_0x7682('0x11')](this[_0x7682('0x5')]['agents'][this[_0x7682('0x10')]['id']])){return logger['info'](_0x7682('0x13'),this['squeue']['id'],this[_0x7682('0x10')]['id']);}else{logger[_0x7682('0xe')](_0x7682('0x1e'),this[_0x7682('0x4')]['id'],this[_0x7682('0x10')]['id']);util[_0x7682('0x1f')](this[_0x7682('0x1a')],this[_0x7682('0x4')]['id'],this[_0x7682('0x5')][_0x7682('0x12')][this['agent']['id']],null,this[_0x7682('0x3')]);this[_0x7682('0x5')][_0x7682('0x12')][this[_0x7682('0x10')]['id']][_0x7682('0x17')]=![];this[_0x7682('0x5')][_0x7682('0x12')][this[_0x7682('0x10')]['id']][_0x7682('0x18')]=undefined;util[_0x7682('0x1b')](this[_0x7682('0x4')]['id'],this[_0x7682('0x5')][_0x7682('0x12')][this[_0x7682('0x10')]['id']],_0x36d80f?_0x7682('0x20'):_0x7682('0x21'));}if(!_0x36d80f){setTimeout(this['push'][_0x7682('0x7')](this),0x3e8);}};function agent(_0x3ebb27,_0x57af68,_0x2eeeef,_0x1ec805){return new Agent(_0x3ebb27,_0x57af68,_0x2eeeef,_0x1ec805);}module[_0x7682('0x22')]=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 9aa076a..2fd76e6 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 _0x7edb=['info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','writeLog','RINGING','name','notificationId','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','TIMEOUT','busy','busyQueue','exports','uuid','./util','../../../../../config/logger','routing','squeue','queue','realtime','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','isNil','Agents','length','agents'];(function(_0x1e4150,_0x55b02a){var _0x1ce3ee=function(_0x59324e){while(--_0x59324e){_0x1e4150['push'](_0x1e4150['shift']());}};_0x1ce3ee(++_0x55b02a);}(_0x7edb,0x158));var _0xb7ed=function(_0x2e44ee,_0x38990a){_0x2e44ee=_0x2e44ee-0x0;var _0xa854d6=_0x7edb[_0x2e44ee];return _0xa854d6;};'use strict';var _=require('lodash');var uuid=require(_0xb7ed('0x0'));var util=require(_0xb7ed('0x1'));var logger=require(_0xb7ed('0x2'))(_0xb7ed('0x3'));var Beepall=function(_0x15d080,_0x5a485a,_0x94e65b,_0x595b65){this['notificationId']=uuid['v4']();this[_0xb7ed('0x4')]=_0x15d080;this[_0xb7ed('0x5')]=_0x5a485a;this[_0xb7ed('0x6')]=_0x94e65b;this[_0xb7ed('0x3')]=_0x595b65;this[_0xb7ed('0x4')][_0xb7ed('0x7')](this[_0xb7ed('0x8')][_0xb7ed('0x9')](this),this[_0xb7ed('0xa')][_0xb7ed('0x9')](this));this['squeue']['on'](_0xb7ed('0xb'),this[_0xb7ed('0xa')][_0xb7ed('0x9')](this));this[_0xb7ed('0x4')]['on'](_0xb7ed('0xc'),this[_0xb7ed('0xd')][_0xb7ed('0x9')](this));};Beepall['prototype'][_0xb7ed('0x7')]=function(){this[_0xb7ed('0x4')][_0xb7ed('0x7')](this[_0xb7ed('0x8')][_0xb7ed('0x9')](this),this['handleTimeout']['bind'](this));};Beepall[_0xb7ed('0xe')]['handleDrained']=function(_0x3dc68){this[_0xb7ed('0xa')](!![]);};Beepall[_0xb7ed('0xe')][_0xb7ed('0x8')]=function(_0x463c8b){var _0x52a0fa=!![];if(!_[_0xb7ed('0xf')](this[_0xb7ed('0x5')])&&!_[_0xb7ed('0xf')](this[_0xb7ed('0x5')][_0xb7ed('0x10')])&&this[_0xb7ed('0x5')]['Agents'][_0xb7ed('0x11')]>0x0){for(var _0x48d849=0x0,_0x3b5a2b;_0x48d8490x0){for(var _0x352648=0x0,_0x1e3c7f;_0x3526480x0&&_0x2be467[_0x6ae00c+_0x6549('0x22')]>=_0x2be467[_0x6ae00c+_0x6549('0x21')]){writeLog(_0x25bc01,_0x2be467,_0x6ae00c[_0x6549('0x23')]()+_0x6549('0x24'));return![];}}return!![];};exports[_0x6549('0x25')]=function(_0x2f58f7,_0xa6c718,_0x4c52f1,_0x1794bc,_0x136518){return sendNotification(!![],_0x2f58f7,_0xa6c718,_0x4c52f1,_0x1794bc,_0x136518);};exports[_0x6549('0x26')]=function(_0x4c605c,_0x3f1502,_0x4acaf5,_0x4f0ad1,_0x5aa3a6){return sendNotification(![],_0x4c605c,_0x3f1502,_0x4acaf5,_0x4f0ad1,_0x5aa3a6);};exports[_0x6549('0x27')]=writeLog; \ No newline at end of file +var _0x4fb4=['isAgentAvailable','busy','BUSY','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','writeLog','util','../utils','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','format','user:%s','name','user:save','split','\x20interaction','account','notificationShake','body','queue','msg','getMustacheRender','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','save','remove','info'];(function(_0x3687c6,_0xa4bce0){var _0x51af99=function(_0x167164){while(--_0x167164){_0x3687c6['push'](_0x3687c6['shift']());}};_0x51af99(++_0xa4bce0);}(_0x4fb4,0x190));var _0x44fb=function(_0x5b555b,_0x3c4ec5){_0x5b555b=_0x5b555b-0x0;var _0x39728e=_0x4fb4[_0x5b555b];return _0x39728e;};'use strict';var _=require('lodash');var util=require(_0x44fb('0x0'));var utils=require(_0x44fb('0x1'));var Mustache=require(_0x44fb('0x2'));var Redis=require(_0x44fb('0x3'));var config=require(_0x44fb('0x4'));var logger=require(_0x44fb('0x5'))('routing');config[_0x44fb('0x6')]=_[_0x44fb('0x7')](config[_0x44fb('0x6')],{'host':_0x44fb('0x8'),'port':0x18eb});var io=require(_0x44fb('0x9'))(new Redis(config[_0x44fb('0x6')]));function emit(_0x464af5,_0x2a4d75,_0x59aa6d){io['to'](_0x464af5)[_0x44fb('0xa')](_0x2a4d75,_0x59aa6d);}function sendNotification(_0xd4ead0,_0x5405a8,_0x42fcc2,_0x3d9002,_0x2a1cb7,_0x34444f){io['to'](util[_0x44fb('0xb')](_0x44fb('0xc'),_0x3d9002[_0x44fb('0xd')]))[_0x44fb('0xa')](_0x44fb('0xe'),_0x3d9002);var _0x2ae684=_0x34444f||{};var _0x4b202d=_0x42fcc2[_0x44fb('0xf')]('.');var _0x1e8a60={'uniqueid':_0x5405a8,'channel':_0x4b202d[0x0],'id':_0x4b202d[0x1],'title':_0x4b202d[0x0]+_0x44fb('0x10'),'interactionId':_0x4b202d[0x2],'queue':_0x2a1cb7?_0x2a1cb7[_0x44fb('0xd')]:null,'sound':_0x2ae684[_0x44fb('0x11')]['notificationSound'],'shake':_0x2ae684[_0x44fb('0x11')][_0x44fb('0x12')]};try{if(!_0x2ae684[_0x44fb('0x13')]){_0x2ae684[_0x44fb('0x13')]={};}if(_0x2a1cb7){_0x2ae684[_0x44fb('0x13')]['queue']=_0x2a1cb7;}else if(_0x2ae684[_0x44fb('0x13')][_0x44fb('0x14')]){delete _0x2ae684[_0x44fb('0x13')][_0x44fb('0x14')];}_0x1e8a60[_0x44fb('0x15')]=utils[_0x44fb('0x16')](_0x2ae684[_0x44fb('0x11')]['notificationTemplate'],_0x2ae684);}catch(_0x2c622f){_0x1e8a60[_0x44fb('0x15')]=_0x44fb('0x17');logger[_0x44fb('0x18')](util[_0x44fb('0xb')](_0x44fb('0x19'),_0x5405a8,_0x2c622f[_0x44fb('0x1a')]));}io['to'](util[_0x44fb('0xb')](_0x44fb('0xc'),_0x3d9002[_0x44fb('0xd')]))['emit'](util['format']('notification:%s',_0xd4ead0?_0x44fb('0x1b'):_0x44fb('0x1c')),_0x1e8a60);}function writeLog(_0x2dd412,_0x544647,_0x52507a){return logger[_0x44fb('0x1d')](util[_0x44fb('0xb')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x2dd412,_0x544647['name'],_0x52507a));}exports[_0x44fb('0x1e')]=function(_0x5cf7ec,_0x441d79,_0x4fc66d,_0x954b1d){if(_0x441d79[_0x44fb('0x1f')]){writeLog(_0x5cf7ec,_0x441d79,_0x44fb('0x20'));return![];}if(!_0x441d79['online']){writeLog(_0x5cf7ec,_0x441d79,'OFFLINE');return![];}if(_0x441d79[_0x4fc66d+_0x44fb('0x21')]){writeLog(_0x5cf7ec,_0x441d79,_0x44fb('0x22'));return![];}if(_0x954b1d&&_0x441d79[_0x44fb('0x23')](_0x4fc66d+_0x44fb('0x24'))&&_0x441d79['hasOwnProperty'](_0x4fc66d+_0x44fb('0x25'))){if(_0x441d79[_0x4fc66d+_0x44fb('0x24')]>0x0&&_0x441d79[_0x4fc66d+'CurrentCapacity']>=_0x441d79[_0x4fc66d+'Capacity']){writeLog(_0x5cf7ec,_0x441d79,_0x4fc66d[_0x44fb('0x26')]()+_0x44fb('0x27'));return![];}}return!![];};exports[_0x44fb('0x28')]=function(_0x1f5d4c,_0xb7e5e8,_0x15e748,_0x2ce72d,_0x35652e){return sendNotification(!![],_0x1f5d4c,_0xb7e5e8,_0x15e748,_0x2ce72d,_0x35652e);};exports[_0x44fb('0x29')]=function(_0x4f079d,_0x48eb7d,_0x587984,_0x51b40e,_0x4a957f){return sendNotification(![],_0x4f079d,_0x48eb7d,_0x587984,_0x51b40e,_0x4a957f);};exports[_0x44fb('0x2a')]=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 df7567f..a483703 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 _0xbfa3=['body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][SYSTEM]\x20%s','map','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','[%s][SYSTEM]\x20commnad:\x20%s','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable'];(function(_0x1c9222,_0x412996){var _0x3da162=function(_0x595989){while(--_0x595989){_0x1c9222['push'](_0x1c9222['shift']());}};_0x3da162(++_0x412996);}(_0xbfa3,0x70));var _0x3bfa=function(_0x2d3da5,_0x194cd6){_0x2d3da5=_0x2d3da5-0x0;var _0x125e17=_0xbfa3[_0x2d3da5];return _0x125e17;};'use strict';var schema=require(_0x3bfa('0x0'));var sh=require(_0x3bfa('0x1'));var _=require(_0x3bfa('0x2'));var utils=require(_0x3bfa('0x3'));var logger=require(_0x3bfa('0x4'))(_0x3bfa('0x5'));var system=schema({'command':{'type':_0x3bfa('0x6'),'required':!![],'message':_0x3bfa('0x7')}});exports[_0x3bfa('0x8')]=function(_0x45b11c,_0x21038d){return function(_0x1d0aac){try{var _0x120983={'command':_0x21038d[0x0]};var _0x5c8efa=system[_0x3bfa('0x0')](_0x120983,{'typecast':!![]});if(_0x5c8efa[_0x3bfa('0x9')]){logger['error'](_0x3bfa('0xa'),_0x45b11c,_[_0x3bfa('0xb')](_0x5c8efa,_0x3bfa('0xc'))['join'](',\x20'));logger[_0x3bfa('0xd')](_0x3bfa('0xe'),_0x45b11c);_0x1d0aac[_0x3bfa('0xf')]();}else{var _0x4bc627=this;var _0x51e9ca=utils['getMustacheRender'](_0x21038d[0x0],this);logger['info'](_0x3bfa('0x10'),_0x45b11c,_0x51e9ca);sh[_0x3bfa('0x11')](_['trim'](_0x51e9ca),function(_0x2afb82,_0x1e20f5){logger[_0x3bfa('0xd')](_0x3bfa('0x12'),_0x45b11c,_0x2afb82);if(_0x2afb82==0x0){var _0x3f95ee=_0x1e20f5[_0x3bfa('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0x3bfa('0x14')](_0x21038d[0x1])||_[_0x3bfa('0x15')](_0x21038d[0x1])){logger[_0x3bfa('0xd')](_0x3bfa('0x16'),_0x45b11c);_0x4bc627[_0x3bfa('0x17')][_0x21038d[0x1]]=_0x3f95ee;}else{logger['info'](_0x3bfa('0x18'),_0x45b11c,_0x21038d[0x1],_0x3f95ee);_0x4bc627[_0x3bfa('0x17')][_0x21038d[0x1]]=_0x3f95ee;}}_0x1d0aac['next']();});}}catch(_0x56c8bb){logger[_0x3bfa('0x19')](_0x3bfa('0xa'),_0x45b11c,_['isObject'](_0x56c8bb)?JSON[_0x3bfa('0x1a')](_0x56c8bb):_0x56c8bb);logger[_0x3bfa('0xd')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x45b11c);_0x1d0aac[_0x3bfa('0xf')]();}};}; \ No newline at end of file +var _0x6700=['body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','shelljs','lodash','./utils','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','[%s][SYSTEM]\x20commnad:\x20%s','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty'];(function(_0x200aed,_0x37c961){var _0x27db29=function(_0x46c649){while(--_0x46c649){_0x200aed['push'](_0x200aed['shift']());}};_0x27db29(++_0x37c961);}(_0x6700,0xb3));var _0x0670=function(_0x4f5026,_0x4f969b){_0x4f5026=_0x4f5026-0x0;var _0x482b53=_0x6700[_0x4f5026];return _0x482b53;};'use strict';var schema=require(_0x0670('0x0'));var sh=require(_0x0670('0x1'));var _=require(_0x0670('0x2'));var utils=require(_0x0670('0x3'));var logger=require('../../../../config/logger')(_0x0670('0x4'));var system=schema({'command':{'type':_0x0670('0x5'),'required':!![],'message':_0x0670('0x6')}});exports[_0x0670('0x7')]=function(_0x7436b1,_0x1760bc){return function(_0x4f4152){try{var _0x3173cb={'command':_0x1760bc[0x0]};var _0x3a17b7=system[_0x0670('0x0')](_0x3173cb,{'typecast':!![]});if(_0x3a17b7[_0x0670('0x8')]){logger[_0x0670('0x9')](_0x0670('0xa'),_0x7436b1,_[_0x0670('0xb')](_0x3a17b7,'message')[_0x0670('0xc')](',\x20'));logger[_0x0670('0xd')](_0x0670('0xe'),_0x7436b1);_0x4f4152[_0x0670('0xf')]();}else{var _0x1f643f=this;var _0x5b698d=utils['getMustacheRender'](_0x1760bc[0x0],this);logger['info'](_0x0670('0x10'),_0x7436b1,_0x5b698d);sh['exec'](_[_0x0670('0x11')](_0x5b698d),function(_0x30781f,_0x2a85bd){logger[_0x0670('0xd')](_0x0670('0x12'),_0x7436b1,_0x30781f);if(_0x30781f==0x0){var _0x42b322=_0x2a85bd[_0x0670('0x13')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x1760bc[0x1])||_[_0x0670('0x14')](_0x1760bc[0x1])){logger[_0x0670('0xd')]('[%s][SYSTEM]\x20no\x20variable',_0x7436b1);_0x1f643f[_0x0670('0x15')][_0x1760bc[0x1]]=_0x42b322;}else{logger[_0x0670('0xd')](_0x0670('0x16'),_0x7436b1,_0x1760bc[0x1],_0x42b322);_0x1f643f[_0x0670('0x15')][_0x1760bc[0x1]]=_0x42b322;}}_0x4f4152[_0x0670('0xf')]();});}}catch(_0x31f70b){logger[_0x0670('0x9')](_0x0670('0xa'),_0x7436b1,_[_0x0670('0x17')](_0x31f70b)?JSON[_0x0670('0x18')](_0x31f70b):_0x31f70b);logger[_0x0670('0xd')](_0x0670('0xe'),_0x7436b1);_0x4f4152['next']();}};}; \ 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 8d7edb2..d7c6e99 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 _0x260b=['TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][TAG]\x20%s','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','Interaction','channel','then','interaction','catch','stringify','finally','next','isObject','validate','lodash','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../../../config/logger','number'];(function(_0x5cd818,_0x40e317){var _0x15fe50=function(_0x5da969){while(--_0x5da969){_0x5cd818['push'](_0x5cd818['shift']());}};_0x15fe50(++_0x40e317);}(_0x260b,0x16a));var _0xb260=function(_0x26e8f3,_0x2faf14){_0x26e8f3=_0x26e8f3-0x0;var _0x56e48f=_0x260b[_0x26e8f3];return _0x56e48f;};'use strict';var schema=require(_0xb260('0x0'));var _=require(_0xb260('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xb260('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xb260('0x3')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0xb260('0x4'))('routing');var tag=schema({'tag':{'type':_0xb260('0x5'),'required':!![],'message':_0xb260('0x6')}});exports[_0xb260('0x7')]=function(_0xf8765d,_0x2e32d3,_0x49ccd3,_0x45c033){return function(_0x1f44e8){try{var _0xec4416={'tag':_0x2e32d3[0x0]};var _0x4f9829=tag['validate'](_0xec4416,{'typecast':!![]});if(_0x4f9829[_0xb260('0x8')]){logger['error'](_0xb260('0x9'),_0xf8765d,_['map'](_0x4f9829,_0xb260('0xa'))[_0xb260('0xb')](',\x20'));logger[_0xb260('0xc')](_0xb260('0xd'),_0xf8765d);_0x1f44e8['next']();}else{var _0x19049d={'ids':[_0x2e32d3[0x0]]};if(rpc[_0x45c033['channel']+_0xb260('0xe')]){rpc[_0x45c033[_0xb260('0xf')]+'Interaction']['addTags'](_0x45c033['interaction']['id'],_0x19049d)[_0xb260('0x10')](function(_0x20cea2){logger['info']('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0xf8765d,_0x2e32d3[0x1],_0x45c033['channel'],_0x45c033[_0xb260('0x11')]['id']);})[_0xb260('0x12')](function(_0x3ebeaa){logger['error'](_0xb260('0x9'),_0xf8765d,JSON[_0xb260('0x13')](_0x3ebeaa));logger[_0xb260('0xc')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0xf8765d);})[_0xb260('0x14')](function(){_0x1f44e8[_0xb260('0x15')]();});}}}catch(_0x48f87f){logger['error'](_0xb260('0x9'),_0xf8765d,_[_0xb260('0x16')](_0x48f87f)?JSON['stringify'](_0x48f87f):_0x48f87f);logger['info'](_0xb260('0xd'),_0xf8765d);_0x1f44e8['next']();}};}; \ No newline at end of file +var _0xf710=['addTags','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','isObject','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','Interaction','channel'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xf710,0xf1));var _0x0f71=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xf710[_0x484e36];return _0xafc85d;};'use strict';var schema=require(_0x0f71('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0x0f71('0x1')),'openchannelInteraction':require(_0x0f71('0x2')),'smsInteraction':require(_0x0f71('0x3')),'mailInteraction':require(_0x0f71('0x4')),'faxInteraction':require(_0x0f71('0x5')),'whatsappInteraction':require(_0x0f71('0x6'))};var logger=require(_0x0f71('0x7'))('routing');var tag=schema({'tag':{'type':_0x0f71('0x8'),'required':!![],'message':_0x0f71('0x9')}});exports[_0x0f71('0xa')]=function(_0x499e08,_0x1891fb,_0x215f01,_0x3d675d){return function(_0x4e368e){try{var _0x57d589={'tag':_0x1891fb[0x0]};var _0x4ed78d=tag[_0x0f71('0x0')](_0x57d589,{'typecast':!![]});if(_0x4ed78d[_0x0f71('0xb')]){logger[_0x0f71('0xc')](_0x0f71('0xd'),_0x499e08,_['map'](_0x4ed78d,'message')['join'](',\x20'));logger[_0x0f71('0xe')](_0x0f71('0xf'),_0x499e08);_0x4e368e[_0x0f71('0x10')]();}else{var _0x53c3a9={'ids':[_0x1891fb[0x0]]};if(rpc[_0x3d675d['channel']+_0x0f71('0x11')]){rpc[_0x3d675d[_0x0f71('0x12')]+_0x0f71('0x11')][_0x0f71('0x13')](_0x3d675d[_0x0f71('0x14')]['id'],_0x53c3a9)['then'](function(_0x30dcc7){logger['info'](_0x0f71('0x15'),_0x499e08,_0x1891fb[0x1],_0x3d675d[_0x0f71('0x12')],_0x3d675d[_0x0f71('0x14')]['id']);})[_0x0f71('0x16')](function(_0x5cde14){logger[_0x0f71('0xc')](_0x0f71('0xd'),_0x499e08,JSON[_0x0f71('0x17')](_0x5cde14));logger[_0x0f71('0xe')](_0x0f71('0xf'),_0x499e08);})[_0x0f71('0x18')](function(){_0x4e368e[_0x0f71('0x10')]();});}}}catch(_0x20035a){logger[_0x0f71('0xc')](_0x0f71('0xd'),_0x499e08,_[_0x0f71('0x19')](_0x20035a)?JSON[_0x0f71('0x17')](_0x20035a):_0x20035a);logger['info'](_0x0f71('0xf'),_0x499e08);_0x4e368e[_0x0f71('0x10')]();}};}; \ 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 7d92a51..21d2241 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 _0x9c44=['merge','body','account','list','exports','render'];(function(_0x4105fd,_0x100d14){var _0x26b522=function(_0x33d48a){while(--_0x33d48a){_0x4105fd['push'](_0x4105fd['shift']());}};_0x26b522(++_0x100d14);}(_0x9c44,0x178));var _0x49c4=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9c44[_0x3ab51d];return _0x29a04e;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x49c4('0x0')]={'getMustacheRender':function(_0x18bf2d,_0x26844b){return Mustache[_0x49c4('0x1')](_0x18bf2d,_[_0x49c4('0x2')](_0x26844b[_0x49c4('0x3')],{'contact':_0x26844b['contact'],'message':_0x26844b['message'],'account':_0x26844b[_0x49c4('0x4')],'interaction':_0x26844b['interaction'],'list':_0x26844b[_0x49c4('0x5')]}))||'';}}; \ No newline at end of file +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x55c6ee,_0x20119d){var _0x304bed=function(_0x39e626){while(--_0x39e626){_0x55c6ee['push'](_0x55c6ee['shift']());}};_0x304bed(++_0x20119d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index c213892..372c01b 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 _0xc922=['condition','intervals','./applications/','consequence','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','complete','stack','routing\x20is\x20empty','agent','agents','busyQueue','end','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','interaction','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','jayson/promise','bluebird','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','interval','listen','rules','channel','message','applications','length','existsSync','join','app','.js','toLowerCase','appdata','split','mail','push','slice','dialogflow','dialogflowv2','amazonlex','tag','TagId','%s:%s:%s','./interval'];(function(_0x4cd2a7,_0x278721){var _0xbc0f34=function(_0xb402e6){while(--_0xb402e6){_0x4cd2a7['push'](_0x4cd2a7['shift']());}};_0xbc0f34(++_0x278721);}(_0xc922,0x1b0));var _0x2c92=function(_0x383ba9,_0x594faa){_0x383ba9=_0x383ba9-0x0;var _0x3e0b28=_0xc922[_0x383ba9];return _0x3e0b28;};'use strict';var _=require('lodash');var util=require(_0x2c92('0x0'));var path=require('path');var fs=require('fs');var jayson=require(_0x2c92('0x1'));var BPromise=require(_0x2c92('0x2'));var uuid=require('uuid');var config=require(_0x2c92('0x3'));var logger=require(_0x2c92('0x4'))(_0x2c92('0x5'));var rpc={'openchannelQueueReport':require(_0x2c92('0x6')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x2c92('0x7')),'whatsappQueueReport':require(_0x2c92('0x8'))};var RuleEngine=require(_0x2c92('0x9'));function getId(_0x63f080,_0x1ed25f,_0x430ab4){return util[_0x2c92('0xa')]('%s.%s.%s',_0x63f080,_0x1ed25f||0x0,_0x430ab4||0x0);}function getIntervals(_0x4045c9,_0x57ca9b){var _0x2747fe=[];if(!_[_0x2c92('0xb')](_0x57ca9b[_0x2c92('0xc')])&&!_['isNil'](_0x4045c9[_0x57ca9b['IntervalId']])&&!_['isNil'](_0x4045c9[_0x57ca9b[_0x2c92('0xc')]][_0x2c92('0xd')])){_0x2747fe=_['map'](_0x4045c9[_0x57ca9b[_0x2c92('0xc')]][_0x2c92('0xd')],_0x2c92('0xe'));}else if(!_[_0x2c92('0xb')](_0x57ca9b[_0x2c92('0xe')])){_0x2747fe=[_0x57ca9b['interval']];}return _0x2747fe;}exports[_0x2c92('0xf')]=function(_0x46d09f){_0x46d09f[_0x2c92('0x10')]={};return new BPromise(function(_0x595a01,_0x5ab565){var _0x3eb15f={'Start':function(_0x8a41b0){var _0x4831d4=this;return new Promise(function(_0x111cf0,_0x31942e){if(_0x8a41b0){try{var _0x5ed358=[];var _0x3e5193=getId(_0x8a41b0[_0x2c92('0x11')],_0x8a41b0['message']?_0x8a41b0[_0x2c92('0x12')]['id']:0x0,_0x8a41b0['interaction']?_0x8a41b0['interaction']['id']:0x0);if(_0x8a41b0['applications']&&_['isArray'](_0x8a41b0['applications'])&&_0x8a41b0[_0x2c92('0x13')][_0x2c92('0x14')]){for(var _0x1b6ec8=0x0;_0x1b6ec8<_0x8a41b0['applications'][_0x2c92('0x14')];_0x1b6ec8+=0x1){var _0x4b6f8b=_0x8a41b0['applications'][_0x1b6ec8];if(fs[_0x2c92('0x15')](path[_0x2c92('0x16')](__dirname,_0x2c92('0x13'),_0x4b6f8b[_0x2c92('0x17')]+_0x2c92('0x18')))){var _0x544a24=[];switch(_0x4b6f8b[_0x2c92('0x17')][_0x2c92('0x19')]()){case'autoreply':var _0x1bd465=_0x4b6f8b[_0x2c92('0x1a')][_0x2c92('0x1b')](',');if(_0x8a41b0[_0x2c92('0x11')]===_0x2c92('0x1c')){_0x544a24['push'](_0x1bd465[0x0]);_0x544a24[_0x2c92('0x1d')](_0x1bd465[0x1]);_0x544a24[_0x2c92('0x1d')](_0x1bd465[_0x2c92('0x1e')](0x2,_0x1bd465[_0x2c92('0x14')])['join'](','));}else{_0x544a24[_0x2c92('0x1d')](_0x1bd465[0x0]);_0x544a24[_0x2c92('0x1d')](_0x1bd465[_0x2c92('0x1e')](0x1,_0x1bd465[_0x2c92('0x14')])[_0x2c92('0x16')](','));}break;case _0x2c92('0x1f'):var _0x5f3c44=_0x4b6f8b['appdata'][_0x2c92('0x1b')](',');_0x544a24[_0x2c92('0x1d')](_0x5f3c44[0x0]);_0x544a24[_0x2c92('0x1d')](_0x5f3c44[0x1]);_0x544a24[_0x2c92('0x1d')](_0x5f3c44['slice'](0x2,_0x5f3c44['length'])[_0x2c92('0x16')](','));break;case _0x2c92('0x20'):var _0x5eb2d6=_0x4b6f8b['appdata'][_0x2c92('0x1b')](',');_0x544a24[_0x2c92('0x1d')](_0x5eb2d6[0x0]);_0x544a24[_0x2c92('0x1d')](_0x5eb2d6[0x1]);_0x544a24[_0x2c92('0x1d')](_0x5eb2d6[0x2]);_0x544a24[_0x2c92('0x1d')](_0x5eb2d6[0x3]);_0x544a24[_0x2c92('0x1d')](_0x5eb2d6[_0x2c92('0x1e')](0x4,_0x5eb2d6[_0x2c92('0x14')])[_0x2c92('0x16')](','));break;case _0x2c92('0x21'):var _0x2c22a7=_0x4b6f8b[_0x2c92('0x1a')][_0x2c92('0x1b')](',');_0x544a24[_0x2c92('0x1d')](_0x2c22a7[0x0]);_0x544a24[_0x2c92('0x1d')](_0x2c22a7[0x1]);_0x544a24['push'](_0x2c22a7[0x2]);_0x544a24[_0x2c92('0x1d')](_0x2c22a7[0x3]);_0x544a24['push'](_0x2c22a7[_0x2c92('0x1e')](0x4,_0x2c22a7[_0x2c92('0x14')])[_0x2c92('0x16')](','));break;case _0x2c92('0x12'):_0x544a24[_0x2c92('0x1d')](_0x4b6f8b[_0x2c92('0x1a')]);break;case _0x2c92('0x22'):_0x544a24[_0x2c92('0x1d')](_0x4b6f8b[_0x2c92('0x23')]);_0x544a24[_0x2c92('0x1d')](_0x4b6f8b['appdata']);break;default:_0x544a24=_[_0x2c92('0xb')](_0x4b6f8b[_0x2c92('0x1a')])?[]:_0x4b6f8b['appdata'][_0x2c92('0x1b')](',');}var _0x48e84a={'id':util[_0x2c92('0xa')](_0x2c92('0x24'),_0x3e5193,_0x4b6f8b['id'],_0x4b6f8b[_0x2c92('0x17')]),'condition':require(_0x2c92('0x25'))[_0x2c92('0x26')](_0x3e5193,getIntervals(_0x46d09f[_0x2c92('0x27')],_0x4b6f8b),_0x46d09f),'consequence':require(_0x2c92('0x28')+_0x4b6f8b['app'])[_0x2c92('0x29')](_0x3e5193,_0x544a24,_0x46d09f,_0x8a41b0),'p':_0x4b6f8b['priority']||0x0};logger[_0x2c92('0x2a')](_0x2c92('0x2b'),_0x48e84a['id'],_0x2c92('0x2c'),getIntervals(_0x46d09f['intervals'],_0x4b6f8b)[_0x2c92('0x16')](_0x2c92('0x2d')));_0x5ed358[_0x2c92('0x1d')](_0x48e84a);}else{logger[_0x2c92('0x2e')](_0x2c92('0x2f'),path[_0x2c92('0x16')](__dirname,'applications',_0x4b6f8b[_0x2c92('0x17')]+_0x2c92('0x18')));}}_0x46d09f[_0x2c92('0x10')][_0x3e5193]=new RuleEngine(_0x5ed358);_0x46d09f[_0x2c92('0x10')][_0x3e5193][_0x2c92('0x30')](_0x8a41b0,function(_0xf502f9){logger[_0x2c92('0x2a')](_0x2c92('0x31'),JSON[_0x2c92('0x32')](_0xf502f9[_0x2c92('0x33')]));if(_0x46d09f[_0x2c92('0x10')][_0x3e5193]){_0x46d09f['rules'][_0x3e5193][_0x2c92('0x34')](_0x2c92('0x35'));}});return _0x111cf0({'code':0xc8,'message':_0x8a41b0});}else{logger['info']('No\x20applications\x20to\x20execute');return _0x111cf0({'code':0xc8,'message':_0x8a41b0});}}catch(_0x2f2f09){logger[_0x2c92('0x2e')](_0x2f2f09[_0x2c92('0x36')]);return _0x31942e(_0x4831d4['error'](0x1f4,_0x2f2f09));}}return _0x31942e(_0x2c92('0x37'));});},'AcceptMessage':function(_0x2d0ec8){var _0x2034a2=this;return new Promise(function(_0x1522ba,_0x47d5df){if(_0x2d0ec8[_0x2c92('0x38')]&&_0x2d0ec8[_0x2c92('0x38')]['id']){if(_0x46d09f[_0x2c92('0x39')][_0x2d0ec8[_0x2c92('0x38')]['id']]){_0x46d09f[_0x2c92('0x39')][_0x2d0ec8[_0x2c92('0x38')]['id']]['busy']=![];_0x46d09f[_0x2c92('0x39')][_0x2d0ec8['agent']['id']][_0x2c92('0x3a')]=undefined;}}if(_0x2d0ec8['message']&&_0x2d0ec8[_0x2c92('0x12')]['id']){try{var _0x19c2e5=getId(_0x2d0ec8[_0x2c92('0x11')],_0x2d0ec8[_0x2c92('0x12')]?_0x2d0ec8[_0x2c92('0x12')]['id']:0x0,_0x2d0ec8['interaction']?_0x2d0ec8['interaction']['id']:0x0);if(_0x46d09f[_0x2c92('0x10')][_0x19c2e5]){_0x46d09f[_0x2c92('0x10')][_0x19c2e5]['emit'](_0x2c92('0x3b'));if(rpc[_0x2d0ec8[_0x2c92('0x11')]+'QueueReport']){rpc[_0x2d0ec8[_0x2c92('0x11')]+'QueueReport'][_0x2c92('0x3c')](_0x19c2e5,{'UserId':_0x2d0ec8[_0x2c92('0x12')][_0x2c92('0x3d')]})[_0x2c92('0x3e')](function(_0x44647f){logger['error'](_0x2c92('0x3f'));});}}return _0x1522ba({'code':0xc8,'message':_0x2d0ec8});}catch(_0x65e97){logger['error'](_0x65e97['stack']);return _0x47d5df(_0x2034a2[_0x2c92('0x2e')](0x1f4,_0x65e97));}}logger[_0x2c92('0x2e')](_0x2c92('0x40'));return _0x47d5df(_0x2034a2['error'](0x1f4,_0x2c92('0x40')));});},'RejectMessage':function(_0x9ab0d0){var _0x1bc070=this;return new Promise(function(_0x54bee4,_0x20e090){if(_0x9ab0d0[_0x2c92('0x38')]&&_0x9ab0d0[_0x2c92('0x38')]['id']){try{if(_0x46d09f[_0x2c92('0x39')][_0x9ab0d0[_0x2c92('0x38')]['id']]){_0x46d09f[_0x2c92('0x39')][_0x9ab0d0['agent']['id']][_0x2c92('0x41')]=![];_0x46d09f[_0x2c92('0x39')][_0x9ab0d0[_0x2c92('0x38')]['id']][_0x2c92('0x3a')]=undefined;}return _0x54bee4({'code':0xc8,'message':_0x9ab0d0});}catch(_0x5a12c2){logger[_0x2c92('0x2e')](_0x5a12c2['stack']);return _0x20e090(_0x1bc070[_0x2c92('0x2e')](0x1f4,_0x5a12c2));}}logger['error'](_0x2c92('0x40'));return _0x20e090(_0x1bc070[_0x2c92('0x2e')](0x1f4,_0x2c92('0x40')));});},'AbandonInteraction':function(_0x34fb4a){var _0x2f1510=this;return new Promise(function(_0x4f3dfc,_0x9c6af5){if(_0x34fb4a[_0x2c92('0x11')]&&_0x34fb4a[_0x2c92('0x42')]&&_0x34fb4a[_0x2c92('0x42')]['id']){try{var _0x1f9093=getId(_0x34fb4a[_0x2c92('0x11')],_0x34fb4a['message']?_0x34fb4a[_0x2c92('0x12')]['id']:0x0,_0x34fb4a[_0x2c92('0x42')]?_0x34fb4a[_0x2c92('0x42')]['id']:0x0);if(_0x46d09f[_0x2c92('0x10')][_0x1f9093]){_0x46d09f[_0x2c92('0x10')][_0x1f9093][_0x2c92('0x34')](_0x2c92('0x3b'));}return _0x4f3dfc({'code':0xc8,'message':_0x34fb4a});}catch(_0x405e50){logger['error'](_0x405e50['stack']);return _0x9c6af5(_0x2f1510[_0x2c92('0x2e')](0x1f4,_0x405e50));}}logger[_0x2c92('0x2e')](_0x2c92('0x40'));return _0x9c6af5(_0x2f1510[_0x2c92('0x2e')](0x1f4,_0x2c92('0x40')));});},'AgentCapacity':function(_0x19cbe2){var _0xa7fd3e=this;return new Promise(function(_0xce86c8,_0x2c5144){if(_0x46d09f['agents']['hasOwnProperty'](_0x19cbe2['id'])){for(var _0x4ba725 in _0x19cbe2[_0x2c92('0x43')]){if(_0x19cbe2['capacity']['hasOwnProperty'](_0x4ba725)){if(_0x46d09f[_0x2c92('0x39')][_0x19cbe2['id']][_0x2c92('0x44')](_0x4ba725+_0x2c92('0x45'))){_0x46d09f[_0x2c92('0x39')][_0x19cbe2['id']][_0x4ba725+_0x2c92('0x45')]=parseInt(_0x19cbe2[_0x2c92('0x43')][_0x4ba725],0xa);}}}_0x46d09f[_0x2c92('0x39')][_0x19cbe2['id']][_0x2c92('0x46')]();return _0xce86c8({'code':0xc8,'message':_0x46d09f[_0x2c92('0x39')][_0x19cbe2['id']]});}else{return _0x2c5144(_0xa7fd3e[_0x2c92('0x2e')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x36d69f){return new Promise(function(_0x3c3114,_0x5db7d1){var _0x11c510=_[_0x2c92('0x47')](_0x46d09f[_0x2c92('0x39')]);_0x3c3114({'count':_0x11c510['length'],'rows':_0x11c510});});},'ChatQueues':function(_0x2ad966){return new Promise(function(_0x4e899a,_0x59327e){var _0x1132cc=[];for(var _0x325aa8 in _0x46d09f['chatQueues']){if(_0x46d09f[_0x2c92('0x48')]['hasOwnProperty'](_0x325aa8)){var _0x1a8776=_0x46d09f[_0x2c92('0x48')][_0x325aa8];var _0x1e0001={'id':_0x1a8776['id'],'available':_0x1a8776[_0x2c92('0x49')],'loggedIn':_0x1a8776[_0x2c92('0x4a')],'name':_0x1a8776[_0x2c92('0x4b')],'paused':_0x1a8776[_0x2c92('0x4c')],'waiting':_0x1a8776[_0x2c92('0x4d')]};_0x1132cc[_0x2c92('0x1d')](_0x1e0001);}}_0x4e899a({'count':_0x1132cc[_0x2c92('0x14')],'rows':_0x1132cc});});},'MailQueues':function(_0x4f2910){return new Promise(function(_0x15fb65,_0x38b499){var _0x4bab98=[];for(var _0x5246e3 in _0x46d09f[_0x2c92('0x4e')]){if(_0x46d09f['mailQueues'][_0x2c92('0x44')](_0x5246e3)){var _0x199d04=_0x46d09f['mailQueues'][_0x5246e3];var _0x52864b={'id':_0x199d04['id'],'available':_0x199d04['available'],'loggedIn':_0x199d04[_0x2c92('0x4a')],'name':_0x199d04[_0x2c92('0x4b')],'paused':_0x199d04[_0x2c92('0x4c')],'waiting':_0x199d04[_0x2c92('0x4d')]};_0x4bab98[_0x2c92('0x1d')](_0x52864b);}}_0x15fb65({'count':_0x4bab98['length'],'rows':_0x4bab98});});},'OpenchannelQueues':function(_0x12f2e4){return new Promise(function(_0x311b30,_0xab38a7){var _0x17e0cf=[];for(var _0x5c0e7d in _0x46d09f[_0x2c92('0x4f')]){if(_0x46d09f[_0x2c92('0x4f')][_0x2c92('0x44')](_0x5c0e7d)){var _0x4381b1=_0x46d09f['openchannelQueues'][_0x5c0e7d];var _0x430204={'id':_0x4381b1['id'],'available':_0x4381b1[_0x2c92('0x49')],'loggedIn':_0x4381b1[_0x2c92('0x4a')],'name':_0x4381b1[_0x2c92('0x4b')],'paused':_0x4381b1[_0x2c92('0x4c')],'waiting':_0x4381b1['waiting']};_0x17e0cf[_0x2c92('0x1d')](_0x430204);}}_0x311b30({'count':_0x17e0cf[_0x2c92('0x14')],'rows':_0x17e0cf});});},'SmsQueues':function(_0x45e3fe){return new Promise(function(_0x35cfed,_0x20f411){var _0x26e568=[];for(var _0x487f89 in _0x46d09f[_0x2c92('0x50')]){if(_0x46d09f[_0x2c92('0x50')]['hasOwnProperty'](_0x487f89)){var _0x2aa670=_0x46d09f[_0x2c92('0x50')][_0x487f89];var _0x39e919={'id':_0x2aa670['id'],'available':_0x2aa670['available'],'loggedIn':_0x2aa670[_0x2c92('0x4a')],'name':_0x2aa670[_0x2c92('0x4b')],'paused':_0x2aa670[_0x2c92('0x4c')],'waiting':_0x2aa670[_0x2c92('0x4d')]};_0x26e568[_0x2c92('0x1d')](_0x39e919);}}_0x35cfed({'count':_0x26e568[_0x2c92('0x14')],'rows':_0x26e568});});},'FaxQueues':function(_0x51f5fe){return new Promise(function(_0x484264,_0x21a64c){var _0x510dd0=[];for(var _0x3307bd in _0x46d09f[_0x2c92('0x51')]){if(_0x46d09f[_0x2c92('0x51')][_0x2c92('0x44')](_0x3307bd)){var _0x5988e2=_0x46d09f[_0x2c92('0x51')][_0x3307bd];var _0x2f4322={'id':_0x5988e2['id'],'available':_0x5988e2['available'],'loggedIn':_0x5988e2['loggedIn'],'name':_0x5988e2[_0x2c92('0x4b')],'paused':_0x5988e2[_0x2c92('0x4c')],'waiting':_0x5988e2[_0x2c92('0x4d')]};_0x510dd0[_0x2c92('0x1d')](_0x2f4322);}}_0x484264({'count':_0x510dd0[_0x2c92('0x14')],'rows':_0x510dd0});});},'WhatsappQueues':function(_0x10aecd){return new Promise(function(_0xf1b212,_0x534402){var _0x5ebe50=[];for(var _0x5c9b5b in _0x46d09f[_0x2c92('0x52')]){if(_0x46d09f[_0x2c92('0x52')][_0x2c92('0x44')](_0x5c9b5b)){var _0x56a3f5=_0x46d09f[_0x2c92('0x52')][_0x5c9b5b];var _0x5e5ce1={'id':_0x56a3f5['id'],'available':_0x56a3f5[_0x2c92('0x49')],'loggedIn':_0x56a3f5[_0x2c92('0x4a')],'name':_0x56a3f5[_0x2c92('0x4b')],'paused':_0x56a3f5['paused'],'waiting':_0x56a3f5[_0x2c92('0x4d')]};_0x5ebe50[_0x2c92('0x1d')](_0x5e5ce1);}}_0xf1b212({'count':_0x5ebe50[_0x2c92('0x14')],'rows':_0x5ebe50});});},'ChatQueuesWaitingInteractions':function(_0x1863f1){return new Promise(function(_0x3c5686,_0x32f4e6){var _0x1f83a7=_[_0x2c92('0x47')](_0x46d09f[_0x2c92('0x53')]);_0x3c5686({'count':_0x1f83a7[_0x2c92('0x14')],'rows':_0x1f83a7});});},'MailQueuesWaitingInteractions':function(_0x868be5){return new Promise(function(_0x5dde4d,_0x5aaf86){var _0x1ac26d=_[_0x2c92('0x47')](_0x46d09f[_0x2c92('0x54')]);_0x5dde4d({'count':_0x1ac26d[_0x2c92('0x14')],'rows':_0x1ac26d});});},'OpenchannelQueuesWaitingInteractions':function(_0xb51037){return new Promise(function(_0x39b8f5,_0x34f0f5){var _0xb90c02=_[_0x2c92('0x47')](_0x46d09f[_0x2c92('0x55')]);_0x39b8f5({'count':_0xb90c02[_0x2c92('0x14')],'rows':_0xb90c02});});},'SmsQueuesWaitingInteractions':function(_0x1a0820){return new Promise(function(_0x1585cc,_0x5a2904){var _0x4510bd=_[_0x2c92('0x47')](_0x46d09f[_0x2c92('0x56')]);_0x1585cc({'count':_0x4510bd[_0x2c92('0x14')],'rows':_0x4510bd});});},'FaxQueuesWaitingInteractions':function(_0x325cf8){return new Promise(function(_0x487454,_0x393ad0){var _0x55a87b=_['values'](_0x46d09f[_0x2c92('0x57')]);_0x487454({'count':_0x55a87b[_0x2c92('0x14')],'rows':_0x55a87b});});},'WhatsappQueuesWaitingInteractions':function(_0x5d7a31){return new Promise(function(_0x17a942,_0x20e4e6){var _0x96fb8=_[_0x2c92('0x47')](_0x46d09f[_0x2c92('0x58')]);_0x17a942({'count':_0x96fb8[_0x2c92('0x14')],'rows':_0x96fb8});});}};var _0x2ad2eb=jayson[_0x2c92('0x59')](_0x3eb15f)[_0x2c92('0x5a')]();_0x2ad2eb['on'](_0x2c92('0x2e'),function(_0x4c5351){logger['error'](JSON['stringify'](_0x4c5351));return _0x5ab565(_0x4c5351);});_0x2ad2eb[_0x2c92('0xf')](0x232c,_0x2c92('0x5b'),function(){console['log'](_0x2c92('0x5c'),0x232c);return _0x595a01(_0x2c92('0x5d')+0x232c);});});}; \ No newline at end of file +var _0xd1d0=['QueueReport','update','catch','message\x20is\x20empty','busy','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','values','chatQueues','name','paused','waiting','mailQueues','loggedIn','openchannelQueues','available','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','bluebird','uuid','../../../config/environment','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','format','%s.%s.%s','isNil','IntervalId','map','Intervals','listen','rules','channel','message','interaction','applications','isArray','length','join','app','.js','toLowerCase','autoreply','appdata','split','mail','push','slice','amazonlex','tag','TagId','%s:%s:%s','./interval','condition','intervals','./applications/','priority','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','info','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busyQueue','end'];(function(_0x48c615,_0x4cc757){var _0x3d9e22=function(_0x1ee9f2){while(--_0x1ee9f2){_0x48c615['push'](_0x48c615['shift']());}};_0x3d9e22(++_0x4cc757);}(_0xd1d0,0x181));var _0x0d1d=function(_0x43815a,_0x2eb7bc){_0x43815a=_0x43815a-0x0;var _0x2e69e7=_0xd1d0[_0x43815a];return _0x2e69e7;};'use strict';var _=require(_0x0d1d('0x0'));var util=require('util');var path=require('path');var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x0d1d('0x1'));var uuid=require(_0x0d1d('0x2'));var config=require(_0x0d1d('0x3'));var logger=require(_0x0d1d('0x4'))(_0x0d1d('0x5'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x0d1d('0x6')),'chatQueueReport':require(_0x0d1d('0x7')),'smsQueueReport':require(_0x0d1d('0x8')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require('../lib/rule-engine');function getId(_0x5889ee,_0x3082dd,_0x54f8c4){return util[_0x0d1d('0x9')](_0x0d1d('0xa'),_0x5889ee,_0x3082dd||0x0,_0x54f8c4||0x0);}function getIntervals(_0x5c8a4c,_0x26fb90){var _0xf56ab5=[];if(!_[_0x0d1d('0xb')](_0x26fb90[_0x0d1d('0xc')])&&!_[_0x0d1d('0xb')](_0x5c8a4c[_0x26fb90[_0x0d1d('0xc')]])&&!_[_0x0d1d('0xb')](_0x5c8a4c[_0x26fb90[_0x0d1d('0xc')]]['Intervals'])){_0xf56ab5=_[_0x0d1d('0xd')](_0x5c8a4c[_0x26fb90[_0x0d1d('0xc')]][_0x0d1d('0xe')],'interval');}else if(!_['isNil'](_0x26fb90['interval'])){_0xf56ab5=[_0x26fb90['interval']];}return _0xf56ab5;}exports[_0x0d1d('0xf')]=function(_0x3bc4c4){_0x3bc4c4[_0x0d1d('0x10')]={};return new BPromise(function(_0x109183,_0x36e665){var _0x36509d={'Start':function(_0x1a26f3){var _0x53c123=this;return new Promise(function(_0x513f88,_0x1df486){if(_0x1a26f3){try{var _0x52b8c6=[];var _0x6a427c=getId(_0x1a26f3[_0x0d1d('0x11')],_0x1a26f3[_0x0d1d('0x12')]?_0x1a26f3['message']['id']:0x0,_0x1a26f3['interaction']?_0x1a26f3[_0x0d1d('0x13')]['id']:0x0);if(_0x1a26f3[_0x0d1d('0x14')]&&_[_0x0d1d('0x15')](_0x1a26f3[_0x0d1d('0x14')])&&_0x1a26f3[_0x0d1d('0x14')][_0x0d1d('0x16')]){for(var _0x3b245c=0x0;_0x3b245c<_0x1a26f3[_0x0d1d('0x14')][_0x0d1d('0x16')];_0x3b245c+=0x1){var _0x3aeedc=_0x1a26f3['applications'][_0x3b245c];if(fs['existsSync'](path[_0x0d1d('0x17')](__dirname,_0x0d1d('0x14'),_0x3aeedc[_0x0d1d('0x18')]+_0x0d1d('0x19')))){var _0x4d5bf8=[];switch(_0x3aeedc['app'][_0x0d1d('0x1a')]()){case _0x0d1d('0x1b'):var _0x431b63=_0x3aeedc[_0x0d1d('0x1c')][_0x0d1d('0x1d')](',');if(_0x1a26f3[_0x0d1d('0x11')]===_0x0d1d('0x1e')){_0x4d5bf8[_0x0d1d('0x1f')](_0x431b63[0x0]);_0x4d5bf8[_0x0d1d('0x1f')](_0x431b63[0x1]);_0x4d5bf8[_0x0d1d('0x1f')](_0x431b63['slice'](0x2,_0x431b63['length'])['join'](','));}else{_0x4d5bf8[_0x0d1d('0x1f')](_0x431b63[0x0]);_0x4d5bf8[_0x0d1d('0x1f')](_0x431b63[_0x0d1d('0x20')](0x1,_0x431b63[_0x0d1d('0x16')])[_0x0d1d('0x17')](','));}break;case'dialogflow':var _0x4700df=_0x3aeedc[_0x0d1d('0x1c')][_0x0d1d('0x1d')](',');_0x4d5bf8[_0x0d1d('0x1f')](_0x4700df[0x0]);_0x4d5bf8[_0x0d1d('0x1f')](_0x4700df[0x1]);_0x4d5bf8[_0x0d1d('0x1f')](_0x4700df[_0x0d1d('0x20')](0x2,_0x4700df[_0x0d1d('0x16')])[_0x0d1d('0x17')](','));break;case'dialogflowv2':var _0x68f908=_0x3aeedc[_0x0d1d('0x1c')][_0x0d1d('0x1d')](',');_0x4d5bf8[_0x0d1d('0x1f')](_0x68f908[0x0]);_0x4d5bf8[_0x0d1d('0x1f')](_0x68f908[0x1]);_0x4d5bf8[_0x0d1d('0x1f')](_0x68f908[0x2]);_0x4d5bf8['push'](_0x68f908[0x3]);_0x4d5bf8[_0x0d1d('0x1f')](_0x68f908[_0x0d1d('0x20')](0x4,_0x68f908['length'])[_0x0d1d('0x17')](','));break;case _0x0d1d('0x21'):var _0x58d3a9=_0x3aeedc[_0x0d1d('0x1c')][_0x0d1d('0x1d')](',');_0x4d5bf8['push'](_0x58d3a9[0x0]);_0x4d5bf8[_0x0d1d('0x1f')](_0x58d3a9[0x1]);_0x4d5bf8[_0x0d1d('0x1f')](_0x58d3a9[0x2]);_0x4d5bf8[_0x0d1d('0x1f')](_0x58d3a9[0x3]);_0x4d5bf8[_0x0d1d('0x1f')](_0x58d3a9['slice'](0x4,_0x58d3a9['length'])['join'](','));break;case'message':_0x4d5bf8[_0x0d1d('0x1f')](_0x3aeedc[_0x0d1d('0x1c')]);break;case _0x0d1d('0x22'):_0x4d5bf8[_0x0d1d('0x1f')](_0x3aeedc[_0x0d1d('0x23')]);_0x4d5bf8[_0x0d1d('0x1f')](_0x3aeedc['appdata']);break;default:_0x4d5bf8=_[_0x0d1d('0xb')](_0x3aeedc[_0x0d1d('0x1c')])?[]:_0x3aeedc['appdata'][_0x0d1d('0x1d')](',');}var _0x1b0b56={'id':util[_0x0d1d('0x9')](_0x0d1d('0x24'),_0x6a427c,_0x3aeedc['id'],_0x3aeedc[_0x0d1d('0x18')]),'condition':require(_0x0d1d('0x25'))[_0x0d1d('0x26')](_0x6a427c,getIntervals(_0x3bc4c4[_0x0d1d('0x27')],_0x3aeedc),_0x3bc4c4),'consequence':require(_0x0d1d('0x28')+_0x3aeedc['app'])['consequence'](_0x6a427c,_0x4d5bf8,_0x3bc4c4,_0x1a26f3),'p':_0x3aeedc[_0x0d1d('0x29')]||0x0};logger['info']('Push\x20new\x20rule',_0x1b0b56['id'],_0x0d1d('0x2a'),getIntervals(_0x3bc4c4[_0x0d1d('0x27')],_0x3aeedc)['join'](_0x0d1d('0x2b')));_0x52b8c6[_0x0d1d('0x1f')](_0x1b0b56);}else{logger[_0x0d1d('0x2c')](_0x0d1d('0x2d'),path[_0x0d1d('0x17')](__dirname,_0x0d1d('0x14'),_0x3aeedc[_0x0d1d('0x18')]+_0x0d1d('0x19')));}}_0x3bc4c4[_0x0d1d('0x10')][_0x6a427c]=new RuleEngine(_0x52b8c6);_0x3bc4c4[_0x0d1d('0x10')][_0x6a427c][_0x0d1d('0x2e')](_0x1a26f3,function(_0x307989){logger[_0x0d1d('0x2f')](_0x0d1d('0x30'),JSON[_0x0d1d('0x31')](_0x307989[_0x0d1d('0x32')]));if(_0x3bc4c4[_0x0d1d('0x10')][_0x6a427c]){_0x3bc4c4[_0x0d1d('0x10')][_0x6a427c][_0x0d1d('0x33')](_0x0d1d('0x34'));}});return _0x513f88({'code':0xc8,'message':_0x1a26f3});}else{logger[_0x0d1d('0x2f')](_0x0d1d('0x35'));return _0x513f88({'code':0xc8,'message':_0x1a26f3});}}catch(_0xe2c6a4){logger[_0x0d1d('0x2c')](_0xe2c6a4[_0x0d1d('0x36')]);return _0x1df486(_0x53c123[_0x0d1d('0x2c')](0x1f4,_0xe2c6a4));}}return _0x1df486(_0x0d1d('0x37'));});},'AcceptMessage':function(_0xa631e4){var _0x57b562=this;return new Promise(function(_0xd2032f,_0x513f2a){if(_0xa631e4[_0x0d1d('0x38')]&&_0xa631e4['agent']['id']){if(_0x3bc4c4[_0x0d1d('0x39')][_0xa631e4['agent']['id']]){_0x3bc4c4[_0x0d1d('0x39')][_0xa631e4[_0x0d1d('0x38')]['id']]['busy']=![];_0x3bc4c4[_0x0d1d('0x39')][_0xa631e4['agent']['id']][_0x0d1d('0x3a')]=undefined;}}if(_0xa631e4['message']&&_0xa631e4[_0x0d1d('0x12')]['id']){try{var _0x6ac676=getId(_0xa631e4[_0x0d1d('0x11')],_0xa631e4[_0x0d1d('0x12')]?_0xa631e4[_0x0d1d('0x12')]['id']:0x0,_0xa631e4[_0x0d1d('0x13')]?_0xa631e4[_0x0d1d('0x13')]['id']:0x0);if(_0x3bc4c4[_0x0d1d('0x10')][_0x6ac676]){_0x3bc4c4[_0x0d1d('0x10')][_0x6ac676]['emit'](_0x0d1d('0x3b'));if(rpc[_0xa631e4[_0x0d1d('0x11')]+'QueueReport']){rpc[_0xa631e4[_0x0d1d('0x11')]+_0x0d1d('0x3c')][_0x0d1d('0x3d')](_0x6ac676,{'UserId':_0xa631e4[_0x0d1d('0x12')]['UserId']})[_0x0d1d('0x3e')](function(_0x26ec6b){logger['error']('error\x20update\x20queue\x20report');});}}return _0xd2032f({'code':0xc8,'message':_0xa631e4});}catch(_0x50bf0e){logger[_0x0d1d('0x2c')](_0x50bf0e['stack']);return _0x513f2a(_0x57b562[_0x0d1d('0x2c')](0x1f4,_0x50bf0e));}}logger['error'](_0x0d1d('0x3f'));return _0x513f2a(_0x57b562[_0x0d1d('0x2c')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x2af570){var _0x16b304=this;return new Promise(function(_0x1345e8,_0x5c9934){if(_0x2af570[_0x0d1d('0x38')]&&_0x2af570[_0x0d1d('0x38')]['id']){try{if(_0x3bc4c4[_0x0d1d('0x39')][_0x2af570[_0x0d1d('0x38')]['id']]){_0x3bc4c4[_0x0d1d('0x39')][_0x2af570[_0x0d1d('0x38')]['id']][_0x0d1d('0x40')]=![];_0x3bc4c4[_0x0d1d('0x39')][_0x2af570[_0x0d1d('0x38')]['id']][_0x0d1d('0x3a')]=undefined;}return _0x1345e8({'code':0xc8,'message':_0x2af570});}catch(_0x13b867){logger[_0x0d1d('0x2c')](_0x13b867[_0x0d1d('0x36')]);return _0x5c9934(_0x16b304['error'](0x1f4,_0x13b867));}}logger[_0x0d1d('0x2c')](_0x0d1d('0x3f'));return _0x5c9934(_0x16b304[_0x0d1d('0x2c')](0x1f4,_0x0d1d('0x3f')));});},'AbandonInteraction':function(_0x321a1b){var _0x55a75f=this;return new Promise(function(_0x24722e,_0x1738d5){if(_0x321a1b[_0x0d1d('0x11')]&&_0x321a1b[_0x0d1d('0x13')]&&_0x321a1b[_0x0d1d('0x13')]['id']){try{var _0x1c1849=getId(_0x321a1b[_0x0d1d('0x11')],_0x321a1b[_0x0d1d('0x12')]?_0x321a1b[_0x0d1d('0x12')]['id']:0x0,_0x321a1b[_0x0d1d('0x13')]?_0x321a1b[_0x0d1d('0x13')]['id']:0x0);if(_0x3bc4c4[_0x0d1d('0x10')][_0x1c1849]){_0x3bc4c4[_0x0d1d('0x10')][_0x1c1849][_0x0d1d('0x33')](_0x0d1d('0x3b'));}return _0x24722e({'code':0xc8,'message':_0x321a1b});}catch(_0x20094a){logger[_0x0d1d('0x2c')](_0x20094a[_0x0d1d('0x36')]);return _0x1738d5(_0x55a75f[_0x0d1d('0x2c')](0x1f4,_0x20094a));}}logger['error']('message\x20is\x20empty');return _0x1738d5(_0x55a75f[_0x0d1d('0x2c')](0x1f4,_0x0d1d('0x3f')));});},'AgentCapacity':function(_0x2fb985){var _0x4ca399=this;return new Promise(function(_0x24515f,_0x3d324f){if(_0x3bc4c4[_0x0d1d('0x39')][_0x0d1d('0x41')](_0x2fb985['id'])){for(var _0x434ce2 in _0x2fb985[_0x0d1d('0x42')]){if(_0x2fb985[_0x0d1d('0x42')][_0x0d1d('0x41')](_0x434ce2)){if(_0x3bc4c4[_0x0d1d('0x39')][_0x2fb985['id']][_0x0d1d('0x41')](_0x434ce2+'CurrentCapacity')){_0x3bc4c4[_0x0d1d('0x39')][_0x2fb985['id']][_0x434ce2+_0x0d1d('0x43')]=parseInt(_0x2fb985['capacity'][_0x434ce2],0xa);}}}_0x3bc4c4[_0x0d1d('0x39')][_0x2fb985['id']][_0x0d1d('0x44')]();return _0x24515f({'code':0xc8,'message':_0x3bc4c4[_0x0d1d('0x39')][_0x2fb985['id']]});}else{return _0x3d324f(_0x4ca399['error'](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x47f5ea){return new Promise(function(_0x4ac077,_0x41ad4a){var _0x2e84df=_[_0x0d1d('0x45')](_0x3bc4c4[_0x0d1d('0x39')]);_0x4ac077({'count':_0x2e84df['length'],'rows':_0x2e84df});});},'ChatQueues':function(_0x3aabff){return new Promise(function(_0x1c052c,_0x222370){var _0x349e1d=[];for(var _0x2651c5 in _0x3bc4c4[_0x0d1d('0x46')]){if(_0x3bc4c4[_0x0d1d('0x46')][_0x0d1d('0x41')](_0x2651c5)){var _0x474c22=_0x3bc4c4['chatQueues'][_0x2651c5];var _0x269129={'id':_0x474c22['id'],'available':_0x474c22['available'],'loggedIn':_0x474c22['loggedIn'],'name':_0x474c22[_0x0d1d('0x47')],'paused':_0x474c22[_0x0d1d('0x48')],'waiting':_0x474c22[_0x0d1d('0x49')]};_0x349e1d[_0x0d1d('0x1f')](_0x269129);}}_0x1c052c({'count':_0x349e1d[_0x0d1d('0x16')],'rows':_0x349e1d});});},'MailQueues':function(_0xc47a0f){return new Promise(function(_0x1e4ec8,_0x2b5c7d){var _0x633e0d=[];for(var _0x571477 in _0x3bc4c4['mailQueues']){if(_0x3bc4c4[_0x0d1d('0x4a')][_0x0d1d('0x41')](_0x571477)){var _0x57f280=_0x3bc4c4[_0x0d1d('0x4a')][_0x571477];var _0x1693b0={'id':_0x57f280['id'],'available':_0x57f280['available'],'loggedIn':_0x57f280[_0x0d1d('0x4b')],'name':_0x57f280[_0x0d1d('0x47')],'paused':_0x57f280['paused'],'waiting':_0x57f280[_0x0d1d('0x49')]};_0x633e0d[_0x0d1d('0x1f')](_0x1693b0);}}_0x1e4ec8({'count':_0x633e0d[_0x0d1d('0x16')],'rows':_0x633e0d});});},'OpenchannelQueues':function(_0x4581fd){return new Promise(function(_0x359665,_0x2f1e7f){var _0x489197=[];for(var _0x4b860c in _0x3bc4c4[_0x0d1d('0x4c')]){if(_0x3bc4c4[_0x0d1d('0x4c')][_0x0d1d('0x41')](_0x4b860c)){var _0xe619ca=_0x3bc4c4['openchannelQueues'][_0x4b860c];var _0x2b1cbc={'id':_0xe619ca['id'],'available':_0xe619ca[_0x0d1d('0x4d')],'loggedIn':_0xe619ca[_0x0d1d('0x4b')],'name':_0xe619ca['name'],'paused':_0xe619ca[_0x0d1d('0x48')],'waiting':_0xe619ca[_0x0d1d('0x49')]};_0x489197[_0x0d1d('0x1f')](_0x2b1cbc);}}_0x359665({'count':_0x489197[_0x0d1d('0x16')],'rows':_0x489197});});},'SmsQueues':function(_0x1db5af){return new Promise(function(_0x373368,_0x59ef1e){var _0x5be1b0=[];for(var _0x526eaa in _0x3bc4c4['smsQueues']){if(_0x3bc4c4[_0x0d1d('0x4e')][_0x0d1d('0x41')](_0x526eaa)){var _0xc11dc=_0x3bc4c4['smsQueues'][_0x526eaa];var _0x294d38={'id':_0xc11dc['id'],'available':_0xc11dc['available'],'loggedIn':_0xc11dc[_0x0d1d('0x4b')],'name':_0xc11dc[_0x0d1d('0x47')],'paused':_0xc11dc[_0x0d1d('0x48')],'waiting':_0xc11dc[_0x0d1d('0x49')]};_0x5be1b0[_0x0d1d('0x1f')](_0x294d38);}}_0x373368({'count':_0x5be1b0[_0x0d1d('0x16')],'rows':_0x5be1b0});});},'FaxQueues':function(_0x26ab8b){return new Promise(function(_0x4ec1b3,_0x7786a){var _0x2aaf38=[];for(var _0x1f8836 in _0x3bc4c4['faxQueues']){if(_0x3bc4c4['faxQueues'][_0x0d1d('0x41')](_0x1f8836)){var _0x5bb2e8=_0x3bc4c4[_0x0d1d('0x4f')][_0x1f8836];var _0x471e90={'id':_0x5bb2e8['id'],'available':_0x5bb2e8[_0x0d1d('0x4d')],'loggedIn':_0x5bb2e8[_0x0d1d('0x4b')],'name':_0x5bb2e8['name'],'paused':_0x5bb2e8[_0x0d1d('0x48')],'waiting':_0x5bb2e8[_0x0d1d('0x49')]};_0x2aaf38['push'](_0x471e90);}}_0x4ec1b3({'count':_0x2aaf38['length'],'rows':_0x2aaf38});});},'WhatsappQueues':function(_0x29682f){return new Promise(function(_0x566d54,_0xcd534a){var _0x5b4672=[];for(var _0x29d4a5 in _0x3bc4c4[_0x0d1d('0x50')]){if(_0x3bc4c4['whatsappQueues'][_0x0d1d('0x41')](_0x29d4a5)){var _0x4a71b4=_0x3bc4c4[_0x0d1d('0x50')][_0x29d4a5];var _0x2aeb41={'id':_0x4a71b4['id'],'available':_0x4a71b4[_0x0d1d('0x4d')],'loggedIn':_0x4a71b4['loggedIn'],'name':_0x4a71b4['name'],'paused':_0x4a71b4['paused'],'waiting':_0x4a71b4[_0x0d1d('0x49')]};_0x5b4672['push'](_0x2aeb41);}}_0x566d54({'count':_0x5b4672['length'],'rows':_0x5b4672});});},'ChatQueuesWaitingInteractions':function(_0x530893){return new Promise(function(_0x44f100,_0x28c89c){var _0x4e8e2f=_[_0x0d1d('0x45')](_0x3bc4c4[_0x0d1d('0x51')]);_0x44f100({'count':_0x4e8e2f[_0x0d1d('0x16')],'rows':_0x4e8e2f});});},'MailQueuesWaitingInteractions':function(_0x274b1f){return new Promise(function(_0x2f622c,_0xf81c62){var _0x4f49d5=_[_0x0d1d('0x45')](_0x3bc4c4['mailQueuesWaitingInteractions']);_0x2f622c({'count':_0x4f49d5['length'],'rows':_0x4f49d5});});},'OpenchannelQueuesWaitingInteractions':function(_0xd66118){return new Promise(function(_0x391406,_0xc13f33){var _0x4cc3a1=_['values'](_0x3bc4c4[_0x0d1d('0x52')]);_0x391406({'count':_0x4cc3a1['length'],'rows':_0x4cc3a1});});},'SmsQueuesWaitingInteractions':function(_0x170db4){return new Promise(function(_0x433b4b,_0x225036){var _0x2dec17=_['values'](_0x3bc4c4[_0x0d1d('0x53')]);_0x433b4b({'count':_0x2dec17[_0x0d1d('0x16')],'rows':_0x2dec17});});},'FaxQueuesWaitingInteractions':function(_0x18d4e0){return new Promise(function(_0x2517eb,_0x4b1d55){var _0xdeb342=_[_0x0d1d('0x45')](_0x3bc4c4['faxQueuesWaitingInteractions']);_0x2517eb({'count':_0xdeb342[_0x0d1d('0x16')],'rows':_0xdeb342});});},'WhatsappQueuesWaitingInteractions':function(_0x58bda5){return new Promise(function(_0x72193e,_0x48b30c){var _0x36195e=_['values'](_0x3bc4c4[_0x0d1d('0x54')]);_0x72193e({'count':_0x36195e[_0x0d1d('0x16')],'rows':_0x36195e});});}};var _0x4ed757=jayson['server'](_0x36509d)['http']();_0x4ed757['on'](_0x0d1d('0x2c'),function(_0x4c2990){logger[_0x0d1d('0x2c')](JSON[_0x0d1d('0x31')](_0x4c2990));return _0x36e665(_0x4c2990);});_0x4ed757[_0x0d1d('0xf')](0x232c,_0x0d1d('0x55'),function(){console[_0x0d1d('0x56')](_0x0d1d('0x57'),0x232c);return _0x109183(_0x0d1d('0x58')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 67f6ca0..f201222 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 _0xd5c0=['[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','catch','log','stack','stop','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','request','then','error','result','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','push','Command','format','message','indexOf','true','[%s][INTERVAL]\x20%s','all','some'];(function(_0xbe048b,_0x2f8970){var _0x1d9099=function(_0x4920e){while(--_0x4920e){_0xbe048b['push'](_0xbe048b['shift']());}};_0x1d9099(++_0x2f8970);}(_0xd5c0,0xef));var _0x0d5c=function(_0x16c314,_0x4bcd8e){_0x16c314=_0x16c314-0x0;var _0x1b0580=_0xd5c0[_0x16c314];return _0x1b0580;};'use strict';var util=require(_0x0d5c('0x0'));var BPromise=require(_0x0d5c('0x1'));var jayson=require(_0x0d5c('0x2'));var _=require(_0x0d5c('0x3'));var logger=require(_0x0d5c('0x4'))(_0x0d5c('0x5'));var client=jayson[_0x0d5c('0x6')]['http']({'port':0x232a});function request(_0x54fa19,_0x298ee7){return new BPromise(function(_0x3c9b07,_0x5b2b3e){return client[_0x0d5c('0x7')](_0x54fa19,_0x298ee7)[_0x0d5c('0x8')](function(_0x51f275){if(_0x51f275[_0x0d5c('0x9')]){return _0x5b2b3e(_0x51f275[_0x0d5c('0x9')]['message']);}else{return _0x3c9b07(_0x51f275[_0x0d5c('0xa')]);}})['catch'](function(_0x51e0d5){return _0x5b2b3e(_0x51e0d5);});});}exports[_0x0d5c('0xb')]=function(_0x1d43d9,_0x5d046d,_0x22a7a8){return function(_0x5be80e){if(_0x22a7a8[_0x0d5c('0xc')]&&!_0x22a7a8['rules'][_0x1d43d9]){logger[_0x0d5c('0xd')](_0x0d5c('0xe'),_0x1d43d9);return _0x5be80e['stop']();}var _0x1df4b6=[];for(var _0x14aaf9=0x0;_0x14aaf9<_0x5d046d[_0x0d5c('0xf')];_0x14aaf9+=0x1){_0x1df4b6[_0x0d5c('0x10')](request(_0x0d5c('0x11'),{'command':util[_0x0d5c('0x12')]('iftime\x20%s',_0x5d046d[_0x14aaf9])})[_0x0d5c('0x8')](function(_0x1b1b11){return _0x1b1b11&&_0x1b1b11[_0x0d5c('0x13')]&&_0x1b1b11[_0x0d5c('0x13')][_0x0d5c('0x14')](_0x0d5c('0x15'))>=0x0?!![]:![];})['catch'](function(_0x38816c){logger[_0x0d5c('0x9')](_0x0d5c('0x16'),_0x1d43d9,_0x5d046d[_0x14aaf9]);}));}BPromise[_0x0d5c('0x17')](_0x1df4b6)[_0x0d5c('0x8')](function(_0x4e18a4){var _0x36fe7f=_[_0x0d5c('0x18')](_0x4e18a4);logger[_0x0d5c('0xd')](_0x0d5c('0x19'),_0x1d43d9,_0x5d046d[_0x0d5c('0x1a')](_0x0d5c('0x1b')),_0x36fe7f);_0x5be80e[_0x0d5c('0x1c')](_0x36fe7f);})[_0x0d5c('0x1d')](function(_0x50396b){console[_0x0d5c('0x1e')](_0x50396b);logger['error'](_0x0d5c('0x19'),_0x1d43d9,_0x5d046d[_0x0d5c('0x1a')](_0x0d5c('0x1b')),_0x50396b[_0x0d5c('0x1f')]);_0x5be80e[_0x0d5c('0x20')]();});};}; \ No newline at end of file +var _0x2c51=['iftime\x20%s','indexOf','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','catch','log','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','request','then','error','message','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2c51,0x8c));var _0x12c5=function(_0x2486ce,_0x4dd874){_0x2486ce=_0x2486ce-0x0;var _0x13c99d=_0x2c51[_0x2486ce];return _0x13c99d;};'use strict';var util=require(_0x12c5('0x0'));var BPromise=require(_0x12c5('0x1'));var jayson=require(_0x12c5('0x2'));var _=require(_0x12c5('0x3'));var logger=require(_0x12c5('0x4'))(_0x12c5('0x5'));var client=jayson[_0x12c5('0x6')][_0x12c5('0x7')]({'port':0x232a});function request(_0x328deb,_0x1b4cf0){return new BPromise(function(_0x5847e6,_0x164d3b){return client[_0x12c5('0x8')](_0x328deb,_0x1b4cf0)[_0x12c5('0x9')](function(_0x12188b){if(_0x12188b[_0x12c5('0xa')]){return _0x164d3b(_0x12188b[_0x12c5('0xa')][_0x12c5('0xb')]);}else{return _0x5847e6(_0x12188b['result']);}})['catch'](function(_0x33288a){return _0x164d3b(_0x33288a);});});}exports['condition']=function(_0x515dec,_0x12316f,_0x747c4){return function(_0x1af09d){if(_0x747c4['rules']&&!_0x747c4[_0x12c5('0xc')][_0x515dec]){logger[_0x12c5('0xd')](_0x12c5('0xe'),_0x515dec);return _0x1af09d[_0x12c5('0xf')]();}var _0x5483e=[];for(var _0x4a41d5=0x0;_0x4a41d5<_0x12316f[_0x12c5('0x10')];_0x4a41d5+=0x1){_0x5483e[_0x12c5('0x11')](request(_0x12c5('0x12'),{'command':util[_0x12c5('0x13')](_0x12c5('0x14'),_0x12316f[_0x4a41d5])})[_0x12c5('0x9')](function(_0x4d51d1){return _0x4d51d1&&_0x4d51d1[_0x12c5('0xb')]&&_0x4d51d1[_0x12c5('0xb')][_0x12c5('0x15')]('true')>=0x0?!![]:![];})['catch'](function(_0x15dc52){logger['error'](_0x12c5('0x16'),_0x515dec,_0x12316f[_0x4a41d5]);}));}BPromise[_0x12c5('0x17')](_0x5483e)[_0x12c5('0x9')](function(_0x166f24){var _0x4639d9=_[_0x12c5('0x18')](_0x166f24);logger['info'](_0x12c5('0x19'),_0x515dec,_0x12316f[_0x12c5('0x1a')](_0x12c5('0x1b')),_0x4639d9);_0x1af09d[_0x12c5('0x1c')](_0x4639d9);})[_0x12c5('0x1d')](function(_0x194600){console[_0x12c5('0x1e')](_0x194600);logger[_0x12c5('0xa')](_0x12c5('0x19'),_0x515dec,_0x12316f['join'](_0x12c5('0x1b')),_0x194600[_0x12c5('0x1f')]);_0x1af09d[_0x12c5('0xf')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index d583369..15d1da3 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 _0x4fc2=['lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','interface','calleridnum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','connectedlinenum','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','holdtime','ringtime','talktime','push','queuecallerabandon','includes','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','reason','abandoned','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','[%s][agents][agentcomplete]','agentconnectAt','complete','blindtransfer','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfertype','blind','transferexten','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agentcompleteAt','agent','diffTime','transfer'];(function(_0x415c34,_0x523485){var _0xe4fed4=function(_0x32e068){while(--_0x32e068){_0x415c34['push'](_0x415c34['shift']());}};_0xe4fed4(++_0x523485);}(_0x4fc2,0x111));var _0x24fc=function(_0x2db291,_0x1e49b7){_0x2db291=_0x2db291-0x0;var _0x3be614=_0x4fc2[_0x2db291];return _0x3be614;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var utils=require(_0x24fc('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x4390a0,_0x5aaa74){utils[_0x24fc('0x3')](util[_0x24fc('0x4')](_0x24fc('0x5'),_0x4390a0['uniqueid'],_0x4390a0[_0x24fc('0x6')],_0x4390a0[_0x24fc('0x7')],_0x4390a0['membername'],_0x4390a0[_0x24fc('0x8')],_0x4390a0[_0x24fc('0x9')],_0x4390a0['connectedlinenum'],_0x4390a0[_0x24fc('0xa')]));if(_0x4390a0[_0x24fc('0x7')]){utils[_0x24fc('0xb')](_0x4390a0[_0x24fc('0x7')])[_0x24fc('0xc')](function(_0x47349b){if(_0x47349b){_0x4390a0['type']=_0x47349b[_0x24fc('0xd')];_0x4390a0[_0x24fc('0xe')]=_0x4390a0[_0x24fc('0xf')]?_0x47349b[_0x24fc('0x10')]:![];_0x4390a0[_0x24fc('0x11')]=_0x4390a0[_0x24fc('0xe')]?_0x47349b[_0x24fc('0x12')]:0x0;}utils[_0x24fc('0x13')]('CreateVoiceAgentReport',_0x4390a0);});}else{utils[_0x24fc('0x13')](_0x24fc('0x14'),_0x4390a0);}if(_0x5aaa74){delete transfers[_0x4390a0['uniqueid']];}else{delete agents[_0x4390a0[_0x24fc('0x15')]];}}exports[_0x24fc('0x16')]=function(_0x3f6d8b){try{utils[_0x24fc('0x17')](util[_0x24fc('0x4')](_0x24fc('0x18'),_0x3f6d8b['uniqueid']),_0x3f6d8b);agents[_0x3f6d8b[_0x24fc('0x15')]]=_0x3f6d8b;agents[_0x3f6d8b[_0x24fc('0x15')]][_0x24fc('0x19')]=utils[_0x24fc('0x1a')]();agents[_0x3f6d8b['destuniqueid']][_0x24fc('0xa')]='called';agents[_0x3f6d8b[_0x24fc('0x15')]][_0x24fc('0x1b')]=null;agents[_0x3f6d8b[_0x24fc('0x15')]][_0x24fc('0x1c')]=null;utils[_0x24fc('0x3')](util['format'](_0x24fc('0x1d'),_0x3f6d8b[_0x24fc('0x1e')],agents[_0x3f6d8b[_0x24fc('0x15')]][_0x24fc('0x1f')],_0x3f6d8b['destuniqueid']));}catch(_0x5eabee){utils[_0x24fc('0x20')](util[_0x24fc('0x4')]('[%s][agents][agentcalled]',_0x3f6d8b[_0x24fc('0x1e')]),_0x5eabee);}};exports[_0x24fc('0x21')]=function(_0xbf1d6b){try{if(!_[_0x24fc('0x22')](agents[_0xbf1d6b['destuniqueid']])){utils[_0x24fc('0x17')](util['format'](_0x24fc('0x23'),_0xbf1d6b['uniqueid']),_0xbf1d6b);utils[_0x24fc('0x3')](util[_0x24fc('0x4')](_0x24fc('0x24'),_0xbf1d6b['uniqueid'],agents[_0xbf1d6b[_0x24fc('0x15')]]['membername'],_0xbf1d6b[_0x24fc('0x15')]));agents[_0xbf1d6b[_0x24fc('0x15')]][_0x24fc('0x21')]=!![];agents[_0xbf1d6b[_0x24fc('0x15')]][_0x24fc('0x25')]=utils[_0x24fc('0x1a')]();agents[_0xbf1d6b[_0x24fc('0x15')]][_0x24fc('0xa')]=_0x24fc('0x26');agents[_0xbf1d6b[_0x24fc('0x15')]]['reason']=_0x24fc('0x26');agents[_0xbf1d6b[_0x24fc('0x15')]][_0x24fc('0x27')]=_0xbf1d6b['ringtime']?parseInt(_0xbf1d6b[_0x24fc('0x28')])/0x3e8:0x0;agents[_0xbf1d6b[_0x24fc('0x15')]][_0x24fc('0x29')]=0x0;unanswered[_0x24fc('0x2a')](_0xbf1d6b[_0x24fc('0x15')]);}}catch(_0x443796){utils['error'](util[_0x24fc('0x4')](_0x24fc('0x23'),_0xbf1d6b[_0x24fc('0x1e')]),_0x443796);}};exports[_0x24fc('0x2b')]=function(_0x9f7bbc){try{_['forIn'](agents,function(_0x55c27f,_0x4e6f73){if(_0x55c27f[_0x24fc('0x1e')]==_0x9f7bbc['uniqueid']&&!_[_0x24fc('0x2c')](unanswered,_0x55c27f[_0x24fc('0x15')])){utils[_0x24fc('0x17')](util[_0x24fc('0x4')]('[%s][agents][queuecallerabandon]',_0x9f7bbc[_0x24fc('0x1e')]),_0x9f7bbc);utils[_0x24fc('0x3')](util['format'](_0x24fc('0x2d'),_0x9f7bbc[_0x24fc('0x1e')],_0x55c27f['membername'],_0x55c27f['destuniqueid']));_0x55c27f[_0x24fc('0x21')]=!![];_0x55c27f['agentringnoanswerAt']=utils[_0x24fc('0x1a')]();_0x55c27f[_0x24fc('0xa')]='abandoned';_0x55c27f[_0x24fc('0x2e')]=_0x24fc('0x2f');_0x55c27f[_0x24fc('0x27')]=_0x9f7bbc[_0x24fc('0x27')];_0x55c27f[_0x24fc('0x29')]=0x0;writeDB(_0x55c27f);}});}catch(_0x1e205d){utils[_0x24fc('0x20')](util[_0x24fc('0x4')](_0x24fc('0x30'),_0x9f7bbc['uniqueid']),_0x1e205d);}};exports[_0x24fc('0x31')]=function(_0x4224f4){try{if(agents[_0x4224f4[_0x24fc('0x15')]]){utils[_0x24fc('0x17')](util[_0x24fc('0x4')]('[%s][agents][agentconnect]',_0x4224f4['uniqueid']),_0x4224f4);utils[_0x24fc('0x3')](util['format'](_0x24fc('0x32'),_0x4224f4[_0x24fc('0x1e')],agents[_0x4224f4[_0x24fc('0x15')]][_0x24fc('0x1f')],_0x4224f4['destuniqueid']));agents[_0x4224f4[_0x24fc('0x15')]]['agentconnectAt']=utils[_0x24fc('0x1a')]();agents[_0x4224f4[_0x24fc('0x15')]][_0x24fc('0x1b')]=_0x4224f4[_0x24fc('0x1b')];agents[_0x4224f4[_0x24fc('0x15')]]['connectedlinename']=_0x4224f4[_0x24fc('0x1c')];agents[_0x4224f4[_0x24fc('0x15')]][_0x24fc('0x27')]=_0x4224f4[_0x24fc('0x28')];agents[_0x4224f4['destuniqueid']][_0x24fc('0xa')]=_0x24fc('0x33');_['forIn'](agents,function(_0xf40435,_0x52df2e){if(_0xf40435[_0x24fc('0x15')]!=_0x4224f4[_0x24fc('0x15')]&&_0xf40435[_0x24fc('0x1e')]==_0x4224f4[_0x24fc('0x1e')]){_0xf40435[_0x24fc('0x29')]=0x0;_0xf40435[_0x24fc('0x27')]=_0x4224f4[_0x24fc('0x28')];_0xf40435[_0x24fc('0x21')]=!![];_0xf40435['agentringnoanswerAt']=utils[_0x24fc('0x1a')]();_0xf40435[_0x24fc('0xa')]=_0x24fc('0x34');_0xf40435['reason']=_0x24fc('0x34');_0xf40435[_0x24fc('0x35')]=_0x4224f4['destuniqueid'];_0xf40435[_0x24fc('0x36')]=_0x4224f4[_0x24fc('0x1f')];writeDB(_0xf40435);}});}}catch(_0x2c598c){utils['error'](util[_0x24fc('0x4')](_0x24fc('0x37'),_0x4224f4['uniqueid']),_0x2c598c);}};exports[_0x24fc('0xf')]=function(_0x169982){try{if(!_[_0x24fc('0x22')](agents[_0x169982[_0x24fc('0x15')]])){utils['debug'](util[_0x24fc('0x4')](_0x24fc('0x38'),_0x169982[_0x24fc('0x1e')]),_0x169982);utils[_0x24fc('0x3')](util[_0x24fc('0x4')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x169982[_0x24fc('0x1e')],agents[_0x169982[_0x24fc('0x15')]][_0x24fc('0x1f')],_0x169982[_0x24fc('0x15')]));agents[_0x169982['destuniqueid']][_0x24fc('0xf')]=!![];agents[_0x169982[_0x24fc('0x15')]]['agentcompleteAt']=utils['now']();agents[_0x169982[_0x24fc('0x15')]]['talktime']=utils['diffTime'](agents[_0x169982[_0x24fc('0x15')]]['agentcompleteAt'],agents[_0x169982[_0x24fc('0x15')]][_0x24fc('0x39')]);agents[_0x169982[_0x24fc('0x15')]]['reason']=_0x169982[_0x24fc('0x2e')];agents[_0x169982[_0x24fc('0x15')]][_0x24fc('0xa')]=_0x24fc('0x3a');writeDB(agents[_0x169982[_0x24fc('0x15')]]);}}catch(_0x6c6754){utils[_0x24fc('0x20')](util[_0x24fc('0x4')]('[%s][agents][agentcomplete]',_0x169982['uniqueid']),_0x6c6754);}};exports[_0x24fc('0x3b')]=function(_0x2f1a99){try{if(!_[_0x24fc('0x22')](agents[_0x2f1a99['transfereruniqueid']])){utils['debug'](util[_0x24fc('0x4')](_0x24fc('0x3c'),_0x2f1a99[_0x24fc('0x1e')]),_0x2f1a99);utils[_0x24fc('0x3')](util[_0x24fc('0x4')](_0x24fc('0x3d'),_0x2f1a99[_0x24fc('0x1e')],agents[_0x2f1a99[_0x24fc('0x3e')]][_0x24fc('0x1f')],agents[_0x2f1a99[_0x24fc('0x3e')]][_0x24fc('0x1e')]));agents[_0x2f1a99[_0x24fc('0x3e')]]['transfer']=!![];agents[_0x2f1a99[_0x24fc('0x3e')]][_0x24fc('0x3f')]=_0x24fc('0x40');agents[_0x2f1a99[_0x24fc('0x3e')]][_0x24fc('0x41')]=_0x2f1a99['extension'];agents[_0x2f1a99[_0x24fc('0x3e')]]['transferuniqueid']=agents[_0x2f1a99[_0x24fc('0x3e')]][_0x24fc('0x1e')];}}catch(_0x446c14){utils[_0x24fc('0x20')](util[_0x24fc('0x4')](_0x24fc('0x3c'),_0x2f1a99['uniqueid']),_0x446c14);}};exports[_0x24fc('0x42')]=function(_0xc2ba88){try{utils[_0x24fc('0x17')](util[_0x24fc('0x4')](_0x24fc('0x43'),_0xc2ba88[_0x24fc('0x44')]),_0xc2ba88);if(_0xc2ba88['origtransfereruniqueid']==_0xc2ba88[_0x24fc('0x45')]){if(!_[_0x24fc('0x22')](agents[_0xc2ba88[_0x24fc('0x46')]])){utils[_0x24fc('0x3')](util[_0x24fc('0x4')](_0x24fc('0x47'),_0xc2ba88[_0x24fc('0x44')],agents[_0xc2ba88['secondtransfereruniqueid']][_0x24fc('0x1f')]));agents[_0xc2ba88[_0x24fc('0x46')]]['transfer']=!![];agents[_0xc2ba88[_0x24fc('0x46')]][_0x24fc('0x3f')]=_0x24fc('0x48');agents[_0xc2ba88[_0x24fc('0x46')]][_0x24fc('0x41')]=_0xc2ba88[_0x24fc('0x49')];agents[_0xc2ba88['secondtransfereruniqueid']][_0x24fc('0x4a')]=_0xc2ba88['origtransfereruniqueid'];}if(_0xc2ba88[_0x24fc('0x4b')]&&agents[_0xc2ba88[_0x24fc('0x4b')]]){agents[_0xc2ba88['transfereeuniqueid']][_0x24fc('0x4c')]=0x1;transfers[_0xc2ba88['transfereeuniqueid']]=_[_0x24fc('0x4d')](agents[_0xc2ba88['transfereeuniqueid']]);transfers[_0xc2ba88[_0x24fc('0x4b')]][_0x24fc('0x9')]=agents[_0xc2ba88['secondtransfereruniqueid']][_0x24fc('0x9')];transfers[_0xc2ba88['transfereeuniqueid']][_0x24fc('0x4e')]=agents[_0xc2ba88[_0x24fc('0x46')]]['calleridname'];transfers[_0xc2ba88[_0x24fc('0x4b')]][_0x24fc('0x19')]=utils[_0x24fc('0x1a')]();transfers[_0xc2ba88[_0x24fc('0x4b')]][_0x24fc('0x39')]=utils['now']();transfers[_0xc2ba88[_0x24fc('0x4b')]][_0x24fc('0x27')]=0x0;transfers[_0xc2ba88[_0x24fc('0x4b')]][_0x24fc('0x4c')]=0x2;}}else if(_0xc2ba88[_0x24fc('0x46')]==_0xc2ba88['secondtransfererlinkedid']){if(!_['isNil'](agents[_0xc2ba88[_0x24fc('0x44')]])){utils[_0x24fc('0x3')](util['format']('[%s][agents][attendedtransfer]\x20agent:%s',_0xc2ba88[_0x24fc('0x44')],agents[_0xc2ba88[_0x24fc('0x44')]][_0x24fc('0x1f')]));agents[_0xc2ba88[_0x24fc('0x44')]]['transfer']=!![];agents[_0xc2ba88[_0x24fc('0x44')]][_0x24fc('0x3f')]=_0x24fc('0x48');agents[_0xc2ba88[_0x24fc('0x44')]][_0x24fc('0x41')]=_0xc2ba88[_0x24fc('0x4f')];agents[_0xc2ba88[_0x24fc('0x44')]][_0x24fc('0x4a')]=_0xc2ba88[_0x24fc('0x46')];}if(_0xc2ba88[_0x24fc('0x50')]&&agents[_0xc2ba88[_0x24fc('0x50')]]){agents[_0xc2ba88[_0x24fc('0x50')]][_0x24fc('0x4c')]=0x1;transfers[_0xc2ba88[_0x24fc('0x50')]]=_[_0x24fc('0x4d')](agents[_0xc2ba88['transfertargetuniqueid']]);transfers[_0xc2ba88[_0x24fc('0x50')]][_0x24fc('0x9')]=agents[_0xc2ba88[_0x24fc('0x44')]][_0x24fc('0x9')];transfers[_0xc2ba88[_0x24fc('0x50')]][_0x24fc('0x4e')]=agents[_0xc2ba88[_0x24fc('0x44')]][_0x24fc('0x4e')];transfers[_0xc2ba88['transfertargetuniqueid']][_0x24fc('0x19')]=utils[_0x24fc('0x1a')]();transfers[_0xc2ba88[_0x24fc('0x50')]][_0x24fc('0x39')]=utils['now']();transfers[_0xc2ba88[_0x24fc('0x50')]][_0x24fc('0x27')]=0x0;transfers[_0xc2ba88['transfertargetuniqueid']]['agententerreason']=0x2;}}}catch(_0x4f97b7){utils[_0x24fc('0x20')](util[_0x24fc('0x4')](_0x24fc('0x43'),_0xc2ba88[_0x24fc('0x44')]),_0x4f97b7);}};exports[_0x24fc('0x51')]=function(_0x1d0f06){try{utils['debug'](util[_0x24fc('0x4')](_0x24fc('0x52'),_0x1d0f06['uniqueid']),_0x1d0f06);if(agents[_0x1d0f06['uniqueid']]&&agents[_0x1d0f06[_0x24fc('0x1e')]][_0x24fc('0x2e')]===_0x24fc('0x26')){if(_0x1d0f06['cause']==='21'){agents[_0x1d0f06[_0x24fc('0x1e')]][_0x24fc('0x2e')]=_0x24fc('0x53');agents[_0x1d0f06['uniqueid']]['lastevent']='rejected';}utils['info'](util['format'](_0x24fc('0x54'),_0x1d0f06[_0x24fc('0x1e')],agents[_0x1d0f06[_0x24fc('0x1e')]][_0x24fc('0x1f')],agents[_0x1d0f06['uniqueid']][_0x24fc('0x2e')],agents[_0x1d0f06['uniqueid']][_0x24fc('0xa')]));writeDB(agents[_0x1d0f06['uniqueid']]);var _0x368e0a=unanswered[_0x24fc('0x55')](_0x1d0f06[_0x24fc('0x1e')]);if(_0x368e0a>-0x1){unanswered[_0x24fc('0x56')](_0x368e0a,0x1);}}if(transfers[_0x1d0f06[_0x24fc('0x1e')]]){transfers[_0x1d0f06[_0x24fc('0x1e')]][_0x24fc('0xf')]=!![];transfers[_0x1d0f06['uniqueid']][_0x24fc('0x57')]=utils[_0x24fc('0x1a')]();transfers[_0x1d0f06[_0x24fc('0x1e')]]['talktime']=utils['diffTime'](transfers[_0x1d0f06[_0x24fc('0x1e')]][_0x24fc('0x57')],transfers[_0x1d0f06['uniqueid']][_0x24fc('0x39')]);transfers[_0x1d0f06[_0x24fc('0x1e')]]['reason']=_0x24fc('0x58');transfers[_0x1d0f06[_0x24fc('0x1e')]]['lastevent']=_0x24fc('0x3a');utils[_0x24fc('0x3')](util[_0x24fc('0x4')](_0x24fc('0x54'),_0x1d0f06[_0x24fc('0x1e')],transfers[_0x1d0f06[_0x24fc('0x1e')]]['membername'],transfers[_0x1d0f06['uniqueid']][_0x24fc('0x2e')],transfers[_0x1d0f06['uniqueid']][_0x24fc('0xa')]));writeDB(transfers[_0x1d0f06['uniqueid']],!![]);}if(agents[_0x1d0f06['uniqueid']]&&agents[_0x1d0f06[_0x24fc('0x1e')]][_0x24fc('0x39')]){agents[_0x1d0f06[_0x24fc('0x1e')]][_0x24fc('0xf')]=!![];agents[_0x1d0f06[_0x24fc('0x1e')]][_0x24fc('0x57')]=utils[_0x24fc('0x1a')]();agents[_0x1d0f06[_0x24fc('0x1e')]]['talktime']=utils[_0x24fc('0x59')](agents[_0x1d0f06[_0x24fc('0x1e')]]['agentcompleteAt'],agents[_0x1d0f06['uniqueid']][_0x24fc('0x39')]);agents[_0x1d0f06[_0x24fc('0x1e')]][_0x24fc('0x2e')]=agents[_0x1d0f06[_0x24fc('0x1e')]][_0x24fc('0x5a')]?'transfer':_0x24fc('0x58');agents[_0x1d0f06[_0x24fc('0x1e')]]['lastevent']=_0x24fc('0x3a');utils[_0x24fc('0x3')](util[_0x24fc('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x1d0f06[_0x24fc('0x1e')],agents[_0x1d0f06[_0x24fc('0x1e')]][_0x24fc('0x1f')],agents[_0x1d0f06[_0x24fc('0x1e')]][_0x24fc('0x2e')],agents[_0x1d0f06[_0x24fc('0x1e')]][_0x24fc('0xa')]));writeDB(agents[_0x1d0f06[_0x24fc('0x1e')]]);}}catch(_0x188edb){utils['error'](util[_0x24fc('0x4')](_0x24fc('0x52'),_0x1d0f06[_0x24fc('0x1e')]),_0x188edb);}}; \ 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(_0x16d37e,_0x220e36){var _0x15185f=function(_0x1f93b6){while(--_0x1f93b6){_0x16d37e['push'](_0x16d37e['shift']());}};_0x15185f(++_0x220e36);}(_0xda3f,0xec));var _0xfda3=function(_0x59ac61,_0x2badc3){_0x59ac61=_0x59ac61-0x0;var _0x1932d7=_0xda3f[_0x59ac61];return _0x1932d7;};'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 25a2fa0..c26803c 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 _0xb14d=['endtime','duration','billableseconds','diffTime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','transfertargetchannel','origtransfererchannel','_attended','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstop]','mohtime','varset','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','[%s][calls][varset]','newexten','[%s][calls][newexten]','application','toLowerCase','set','startsWith','cdr','appdata','substring','lastIndexOf','execif','lodash','./utils','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','membername','interface','calleridnum','connectedlinenum','accountcode','then','UserId','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','OutgoingSpoolFailed','context','exten','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','linkedid','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','hangup','[%s][calls][hangup]','callerid','calleridname','cause-txt'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xb14d,0x185));var _0xdb14=function(_0x4fd86f,_0x478f36){_0x4fd86f=_0x4fd86f-0x0;var _0x3c8c3d=_0xb14d[_0x4fd86f];return _0x3c8c3d;};'use strict';var _=require(_0xdb14('0x0'));var util=require('util');var utils=require(_0xdb14('0x1'));var transfers=require('./transfers.controller');var dispositions=[_0xdb14('0x2'),'FAILED',_0xdb14('0x3'),_0xdb14('0x2'),_0xdb14('0x2'),_0xdb14('0x2'),_0xdb14('0x4'),_0xdb14('0x5'),'FAILED',_0xdb14('0x3'),'FAILED'];var channels={};function writeDB(_0x43e4e3){var _0x4cb288;if(transfers[_0xdb14('0x6')][_0x43e4e3['uniqueid']]){_0x4cb288=_0x43e4e3[_0xdb14('0x7')];_0x43e4e3[_0xdb14('0x7')]=transfers[_0xdb14('0x6')][_0x43e4e3['uniqueid']]['transfereeuniqueid'];}utils[_0xdb14('0x8')](util[_0xdb14('0x9')](_0xdb14('0xa'),_0x43e4e3[_0xdb14('0x7')],_0x43e4e3[_0xdb14('0xb')],_0x43e4e3['queue'],_0x43e4e3[_0xdb14('0xc')],_0x43e4e3[_0xdb14('0xd')],_0x43e4e3[_0xdb14('0xe')],_0x43e4e3[_0xdb14('0xf')],_0x43e4e3['lastevent']));if(_0x43e4e3[_0xdb14('0x10')]){utils['getUserByInternal'](_0x43e4e3[_0xdb14('0x10')])[_0xdb14('0x11')](function(_0x38a99d){if(_0x38a99d){_0x43e4e3[_0xdb14('0x12')]=_0x38a99d['id'];}utils[_0xdb14('0x13')](_0xdb14('0x14'),_0x43e4e3);});}else{utils['request']('CreateVoiceCallReport',_0x43e4e3);}if(channels[_0x43e4e3[_0xdb14('0x7')]]){delete channels[_0x43e4e3[_0xdb14('0x7')]];}else if(_0x4cb288&&channels[_0x4cb288]){delete transfers[_0xdb14('0x6')][_0x4cb288];delete channels[_0x4cb288];}}exports[_0xdb14('0x15')]=function(_0x2bd095){try{utils[_0xdb14('0x16')](util[_0xdb14('0x9')](_0xdb14('0x17'),_0x2bd095[_0xdb14('0x7')]),_0x2bd095);if(_0x2bd095[_0xdb14('0x7')]==_0x2bd095['linkedid']&&_0x2bd095['channel']!=_0xdb14('0x18')){utils[_0xdb14('0x8')](util[_0xdb14('0x9')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x2bd095[_0xdb14('0x7')],_0x2bd095[_0xdb14('0x19')],_0x2bd095[_0xdb14('0x1a')]));channels[_0x2bd095[_0xdb14('0x7')]]={'uniqueid':_0x2bd095[_0xdb14('0x7')],'accountcode':_0x2bd095['accountcode'],'source':_0x2bd095[_0xdb14('0xe')],'destination':_0x2bd095[_0xdb14('0x1a')],'destinationcontext':_0x2bd095['context'],'channel':_0x2bd095['channel'],'starttime':utils[_0xdb14('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xdb14('0x2'),'amaflags':_0xdb14('0x1c')};}}catch(_0x1b68a1){utils[_0xdb14('0x1d')](util[_0xdb14('0x9')](_0xdb14('0x17'),_0x2bd095[_0xdb14('0x7')]),_0x1b68a1);}};exports[_0xdb14('0x1e')]=function(_0x17d47e){try{utils['debug'](util[_0xdb14('0x9')](_0xdb14('0x1f'),_0x17d47e[_0xdb14('0x7')]),_0x17d47e);if(!_[_0xdb14('0x20')](channels[_0x17d47e[_0xdb14('0x7')]])&&_0x17d47e[_0xdb14('0x21')]==0x6){utils[_0xdb14('0x8')](util[_0xdb14('0x9')](_0xdb14('0x22'),_0x17d47e['uniqueid'],_0x17d47e['context'],_0x17d47e[_0xdb14('0xb')]));if(_[_0xdb14('0x20')](channels[_0x17d47e[_0xdb14('0x7')]]['systemanswertime'])){channels[_0x17d47e['uniqueid']][_0xdb14('0x23')]=utils[_0xdb14('0x1b')]();}}else if(!_[_0xdb14('0x20')](channels[_0x17d47e[_0xdb14('0x24')]])&&_0x17d47e[_0xdb14('0x21')]==0x6&&_0x17d47e[_0xdb14('0x19')]!='transfer'){utils[_0xdb14('0x8')](util[_0xdb14('0x9')](_0xdb14('0x25'),_0x17d47e['uniqueid'],_0x17d47e[_0xdb14('0x24')],_0x17d47e[_0xdb14('0x19')],_0x17d47e[_0xdb14('0xb')]));channels[_0x17d47e[_0xdb14('0x24')]]['accountcode']=_0x17d47e[_0xdb14('0x10')];channels[_0x17d47e[_0xdb14('0x24')]][_0xdb14('0x26')]=_0x17d47e['channel'];if(_[_0xdb14('0x20')](channels[_0x17d47e['linkedid']][_0xdb14('0x27')])){channels[_0x17d47e[_0xdb14('0x24')]][_0xdb14('0x27')]=utils[_0xdb14('0x1b')]();}channels[_0x17d47e[_0xdb14('0x24')]][_0xdb14('0x28')]=dispositions[_[_0xdb14('0x29')](_0x17d47e[_0xdb14('0x21')])]||'ANSWERED';}}catch(_0xfebe80){utils[_0xdb14('0x1d')](util[_0xdb14('0x9')](_0xdb14('0x1f'),_0x17d47e[_0xdb14('0x7')]),_0xfebe80);}};exports[_0xdb14('0x2a')]=function(_0x448c42){try{if(!_[_0xdb14('0x20')](channels[_0x448c42[_0xdb14('0x7')]])){utils[_0xdb14('0x16')](util[_0xdb14('0x9')](_0xdb14('0x2b'),_0x448c42['uniqueid']),_0x448c42);if(_[_0xdb14('0x20')](channels[_0x448c42[_0xdb14('0x7')]]['callerid'])){channels[_0x448c42['uniqueid']][_0xdb14('0x2c')]=_0x448c42[_0xdb14('0x2d')]+'\x20<'+_0x448c42[_0xdb14('0xe')]+'>';}utils[_0xdb14('0x8')](util[_0xdb14('0x9')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x448c42['uniqueid'],channels[_0x448c42['uniqueid']][_0xdb14('0x2c')],_0x448c42[_0xdb14('0x2e')]));channels[_0x448c42['uniqueid']][_0xdb14('0x2f')]=utils[_0xdb14('0x1b')]();channels[_0x448c42[_0xdb14('0x7')]][_0xdb14('0x30')]=utils['diffTime'](channels[_0x448c42['uniqueid']][_0xdb14('0x2f')],channels[_0x448c42[_0xdb14('0x7')]]['starttime']);channels[_0x448c42[_0xdb14('0x7')]][_0xdb14('0x31')]=channels[_0x448c42[_0xdb14('0x7')]][_0xdb14('0x27')]?utils[_0xdb14('0x32')](channels[_0x448c42[_0xdb14('0x7')]][_0xdb14('0x2f')],channels[_0x448c42['uniqueid']][_0xdb14('0x27')]):0x0;writeDB(channels[_0x448c42['uniqueid']]);}}catch(_0x50f8be){utils['error'](util[_0xdb14('0x9')](_0xdb14('0x2b'),_0x448c42[_0xdb14('0x7')]),_0x50f8be);}};exports[_0xdb14('0x33')]=function(_0x37cc82){try{if(!_['isNil'](channels[_0x37cc82[_0xdb14('0x34')]])){utils['debug'](util['format'](_0xdb14('0x35'),_0x37cc82[_0xdb14('0x36')]),_0x37cc82);if(channels[_0x37cc82[_0xdb14('0x34')]]['channel']==_0x37cc82[_0xdb14('0x37')]){utils[_0xdb14('0x8')](util['format'](_0xdb14('0x38'),_0x37cc82[_0xdb14('0x36')],_0x37cc82[_0xdb14('0x34')],_0x37cc82[_0xdb14('0x39')]));channels[_0x37cc82['localtwolinkedid']]['destinationchannel']=_0x37cc82['secondtransfererchannel'];channels[_0x37cc82[_0xdb14('0x34')]]['userfield']='_attended';}else if(channels[_0x37cc82[_0xdb14('0x34')]][_0xdb14('0xb')]=_0x37cc82[_0xdb14('0x3a')]){utils['info'](util[_0xdb14('0x9')](_0xdb14('0x38'),_0x37cc82[_0xdb14('0x36')],_0x37cc82[_0xdb14('0x34')],_0x37cc82[_0xdb14('0x3b')]));channels[_0x37cc82[_0xdb14('0x34')]][_0xdb14('0x26')]=_0x37cc82[_0xdb14('0x3b')];channels[_0x37cc82[_0xdb14('0x34')]]['userfield']=_0xdb14('0x3c');}}}catch(_0x2684ba){utils[_0xdb14('0x1d')](util[_0xdb14('0x9')](_0xdb14('0x35'),_0x37cc82[_0xdb14('0x36')]),_0x2684ba);}};exports[_0xdb14('0x3d')]=function(_0x5c8e27){try{if(!_[_0xdb14('0x20')](channels[_0x5c8e27[_0xdb14('0x7')]])){utils[_0xdb14('0x16')](util['format'](_0xdb14('0x3e'),_0x5c8e27['uniqueid']),_0x5c8e27);channels[_0x5c8e27['uniqueid']][_0xdb14('0x3f')]=utils[_0xdb14('0x1b')]();utils[_0xdb14('0x8')](util[_0xdb14('0x9')](_0xdb14('0x40'),_0x5c8e27['uniqueid'],channels[_0x5c8e27['uniqueid']][_0xdb14('0x3f')]));}}catch(_0x4278f1){utils[_0xdb14('0x1d')](util[_0xdb14('0x9')](_0xdb14('0x3e'),_0x5c8e27[_0xdb14('0x7')]),_0x4278f1);}};exports['musiconholdstop']=function(_0x4e0661){try{if(!_[_0xdb14('0x20')](channels[_0x4e0661['uniqueid']])){utils['debug'](util[_0xdb14('0x9')](_0xdb14('0x41'),_0x4e0661[_0xdb14('0x7')]),_0x4e0661);if(!_['isNil'](channels[_0x4e0661[_0xdb14('0x7')]][_0xdb14('0x3f')])){channels[_0x4e0661['uniqueid']][_0xdb14('0x42')]+=utils[_0xdb14('0x32')](utils[_0xdb14('0x1b')](),channels[_0x4e0661[_0xdb14('0x7')]][_0xdb14('0x3f')]);utils[_0xdb14('0x8')](util[_0xdb14('0x9')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x4e0661[_0xdb14('0x7')],channels[_0x4e0661['uniqueid']][_0xdb14('0x42')]));delete channels[_0x4e0661[_0xdb14('0x7')]][_0xdb14('0x3f')];}}}catch(_0x2872ca){utils[_0xdb14('0x1d')](util[_0xdb14('0x9')](_0xdb14('0x41'),_0x4e0661[_0xdb14('0x7')]),_0x2872ca);}};exports[_0xdb14('0x43')]=function(_0x59bc90){try{if(!_[_0xdb14('0x20')](channels[_0x59bc90[_0xdb14('0x7')]])){utils[_0xdb14('0x16')](util[_0xdb14('0x9')]('[%s][calls][varset]',_0x59bc90[_0xdb14('0x7')]),_0x59bc90);if(!_[_0xdb14('0x20')](_0x59bc90[_0xdb14('0x44')][_0xdb14('0x45')])){utils[_0xdb14('0x8')](util[_0xdb14('0x9')](_0xdb14('0x46'),_0x59bc90[_0xdb14('0x7')],_0x59bc90[_0xdb14('0x47')]));channels[_0x59bc90['uniqueid']][_0xdb14('0x48')]=_0x59bc90[_0xdb14('0x47')];}if(!_['isNil'](_0x59bc90[_0xdb14('0x44')][_0xdb14('0x49')])){utils[_0xdb14('0x8')](util[_0xdb14('0x9')](_0xdb14('0x4a'),_0x59bc90['uniqueid'],_0x59bc90[_0xdb14('0x47')]));channels[_0x59bc90[_0xdb14('0x7')]][_0xdb14('0x4b')]=_0x59bc90['value'];channels[_0x59bc90[_0xdb14('0x7')]][_0xdb14('0x2c')]='\x22'+_0x59bc90['value']+_0xdb14('0x4c')+_0x59bc90[_0xdb14('0x47')]+'>';}if(!_[_0xdb14('0x20')](_0x59bc90[_0xdb14('0x44')][_0xdb14('0x4d')])||!_[_0xdb14('0x20')](_0x59bc90[_0xdb14('0x44')][_0xdb14('0x4e')])){utils[_0xdb14('0x8')](util[_0xdb14('0x9')](_0xdb14('0x4f'),_0x59bc90['uniqueid'],!_['isNil'](_0x59bc90['variable'][_0xdb14('0x4d')])?_0xdb14('0x4d'):_0xdb14('0x4e'),_0x59bc90['value']));channels[_0x59bc90['uniqueid']][_0xdb14('0x2c')]=_0x59bc90[_0xdb14('0x47')];}if(!_['isNil'](_0x59bc90[_0xdb14('0x44')][_0xdb14('0x50')])||!_[_0xdb14('0x20')](_0x59bc90[_0xdb14('0x44')][_0xdb14('0x51')])){utils[_0xdb14('0x8')](util[_0xdb14('0x9')](_0xdb14('0x4f'),_0x59bc90['uniqueid'],!_[_0xdb14('0x20')](_0x59bc90[_0xdb14('0x44')]['xmd-queue'])?_0xdb14('0x50'):_0xdb14('0x51'),_0x59bc90['value']));channels[_0x59bc90[_0xdb14('0x7')]][_0xdb14('0x52')]=_0xdb14('0x53');channels[_0x59bc90[_0xdb14('0x7')]][_0xdb14('0x54')]=_0x59bc90[_0xdb14('0x47')];channels[_0x59bc90[_0xdb14('0x7')]][_0xdb14('0x55')]=!![];}if(!_['isNil'](_0x59bc90['variable'][_0xdb14('0x56')])){utils['info'](util['format'](_0xdb14('0x57'),_0x59bc90[_0xdb14('0x7')],_0x59bc90[_0xdb14('0x47')]));channels[_0x59bc90['uniqueid']][_0xdb14('0x58')]=_0x59bc90[_0xdb14('0x47')];}if(!_[_0xdb14('0x20')](_0x59bc90[_0xdb14('0x44')][_0xdb14('0x59')])){utils[_0xdb14('0x8')](util[_0xdb14('0x9')](_0xdb14('0x5a'),_0x59bc90[_0xdb14('0x7')],_0x59bc90[_0xdb14('0x47')]));channels[_0x59bc90[_0xdb14('0x7')]][_0xdb14('0x5b')]=_0x59bc90[_0xdb14('0x47')];}if(!_['isNil'](_0x59bc90[_0xdb14('0x44')][_0xdb14('0x5c')])){utils[_0xdb14('0x8')](util[_0xdb14('0x9')](_0xdb14('0x5d'),_0x59bc90['uniqueid'],_0x59bc90['value']));channels[_0x59bc90['uniqueid']][_0xdb14('0x5e')]=_0x59bc90[_0xdb14('0x47')];}if(!_[_0xdb14('0x20')](_0x59bc90[_0xdb14('0x44')]['sipcallid'])){utils[_0xdb14('0x8')](util['format'](_0xdb14('0x5f'),_0x59bc90[_0xdb14('0x7')],_0x59bc90[_0xdb14('0x47')]));channels[_0x59bc90[_0xdb14('0x7')]][_0xdb14('0x60')]=_0x59bc90[_0xdb14('0x47')];}}}catch(_0x4b676d){utils['error'](util[_0xdb14('0x9')](_0xdb14('0x61'),_0x59bc90[_0xdb14('0x7')]),_0x4b676d);}};exports[_0xdb14('0x62')]=function(_0x3671e3){try{if(!_[_0xdb14('0x20')](channels[_0x3671e3['uniqueid']])){utils[_0xdb14('0x16')](util[_0xdb14('0x9')](_0xdb14('0x63'),_0x3671e3[_0xdb14('0x7')]),_0x3671e3);utils['info'](util[_0xdb14('0x9')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x3671e3[_0xdb14('0x7')],_0x3671e3[_0xdb14('0x64')],_0x3671e3['appdata']));if(_0x3671e3[_0xdb14('0x64')][_0xdb14('0x65')]()==_0xdb14('0x66')&&_[_0xdb14('0x67')](_0x3671e3['appdata']['toLowerCase'](),_0xdb14('0x68'))){var _0xebf8f9=_0x3671e3[_0xdb14('0x69')]['split']('=');var _0x22a63e=_0xebf8f9[0x0][_0xdb14('0x6a')](_0xebf8f9[0x0]['lastIndexOf']('(')+0x1,_0xebf8f9[0x0][_0xdb14('0x6b')](')'));var _0x1458ae=_0xebf8f9[0x1];channels[_0x3671e3[_0xdb14('0x7')]][_0x22a63e]=_0x1458ae;}if(!_['includes']([_0xdb14('0x2a'),'noop',_0xdb14('0x6c'),_0xdb14('0x66'),'gotoif'],_0x3671e3[_0xdb14('0x64')][_0xdb14('0x65')]())){channels[_0x3671e3['uniqueid']][_0xdb14('0x52')]=_0x3671e3[_0xdb14('0x64')];channels[_0x3671e3[_0xdb14('0x7')]][_0xdb14('0x54')]=_0x3671e3[_0xdb14('0x69')];}}}catch(_0x5cc985){utils['error'](util[_0xdb14('0x9')]('[%s][calls][newexten]',_0x3671e3[_0xdb14('0x7')]),_0x5cc985);}}; \ No newline at end of file +var _0x022f=['blinds','uniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','connectedlinenum','lastevent','getUserByInternal','accountcode','then','UserId','request','CreateVoiceCallReport','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','DOCUMENTATION','error','[%s][calls][newstate]','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','now','isNil','transfer','destinationchannel','answertime','disposition','hangup','[%s][calls][hangup]','callerid','calleridname','calleridnum','endtime','duration','diffTime','starttime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','origtransfererchannel','_attended','musiconholdstart','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstop]','musiconholdstartAt','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','variable','value','source','xmd-phone','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','ContactId','xmd-cdrtype','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','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','substring','lastIndexOf','noop','execif','gotoif','lastdata','./utils','FAILED','NO\x20ANSWER','BUSY'];(function(_0x192327,_0x3b8638){var _0x45fe6e=function(_0x4554e7){while(--_0x4554e7){_0x192327['push'](_0x192327['shift']());}};_0x45fe6e(++_0x3b8638);}(_0x022f,0x188));var _0xf022=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x022f[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xf022('0x0'));var transfers=require('./transfers.controller');var dispositions=['NO\x20ANSWER',_0xf022('0x1'),_0xf022('0x1'),_0xf022('0x2'),'NO\x20ANSWER',_0xf022('0x2'),'ANSWERED',_0xf022('0x3'),_0xf022('0x1'),_0xf022('0x1'),_0xf022('0x1')];var channels={};function writeDB(_0x6e7de){var _0x118cd9;if(transfers[_0xf022('0x4')][_0x6e7de[_0xf022('0x5')]]){_0x118cd9=_0x6e7de[_0xf022('0x5')];_0x6e7de[_0xf022('0x5')]=transfers[_0xf022('0x4')][_0x6e7de['uniqueid']]['transfereeuniqueid'];}utils[_0xf022('0x6')](util[_0xf022('0x7')](_0xf022('0x8'),_0x6e7de[_0xf022('0x5')],_0x6e7de[_0xf022('0x9')],_0x6e7de[_0xf022('0xa')],_0x6e7de[_0xf022('0xb')],_0x6e7de[_0xf022('0xc')],_0x6e7de['calleridnum'],_0x6e7de[_0xf022('0xd')],_0x6e7de[_0xf022('0xe')]));if(_0x6e7de['accountcode']){utils[_0xf022('0xf')](_0x6e7de[_0xf022('0x10')])[_0xf022('0x11')](function(_0x48c683){if(_0x48c683){_0x6e7de[_0xf022('0x12')]=_0x48c683['id'];}utils[_0xf022('0x13')](_0xf022('0x14'),_0x6e7de);});}else{utils[_0xf022('0x13')](_0xf022('0x14'),_0x6e7de);}if(channels[_0x6e7de['uniqueid']]){delete channels[_0x6e7de[_0xf022('0x5')]];}else if(_0x118cd9&&channels[_0x118cd9]){delete transfers[_0xf022('0x4')][_0x118cd9];delete channels[_0x118cd9];}}exports['newchannel']=function(_0x33ba3d){try{utils[_0xf022('0x15')](util[_0xf022('0x7')](_0xf022('0x16'),_0x33ba3d[_0xf022('0x5')]),_0x33ba3d);if(_0x33ba3d[_0xf022('0x5')]==_0x33ba3d[_0xf022('0x17')]&&_0x33ba3d[_0xf022('0x9')]!=_0xf022('0x18')){utils['info'](util[_0xf022('0x7')](_0xf022('0x19'),_0x33ba3d[_0xf022('0x5')],_0x33ba3d[_0xf022('0x1a')],_0x33ba3d[_0xf022('0x1b')]));channels[_0x33ba3d[_0xf022('0x5')]]={'uniqueid':_0x33ba3d[_0xf022('0x5')],'accountcode':_0x33ba3d[_0xf022('0x10')],'source':_0x33ba3d['calleridnum'],'destination':_0x33ba3d[_0xf022('0x1b')],'destinationcontext':_0x33ba3d[_0xf022('0x1a')],'channel':_0x33ba3d['channel'],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xf022('0x2'),'amaflags':_0xf022('0x1c')};}}catch(_0x1d31ad){utils[_0xf022('0x1d')](util[_0xf022('0x7')](_0xf022('0x16'),_0x33ba3d[_0xf022('0x5')]),_0x1d31ad);}};exports['newstate']=function(_0x44cf13){try{utils['debug'](util[_0xf022('0x7')](_0xf022('0x1e'),_0x44cf13[_0xf022('0x5')]),_0x44cf13);if(!_['isNil'](channels[_0x44cf13[_0xf022('0x5')]])&&_0x44cf13[_0xf022('0x1f')]==0x6){utils[_0xf022('0x6')](util[_0xf022('0x7')](_0xf022('0x20'),_0x44cf13[_0xf022('0x5')],_0x44cf13['context'],_0x44cf13[_0xf022('0x9')]));if(_['isNil'](channels[_0x44cf13[_0xf022('0x5')]]['systemanswertime'])){channels[_0x44cf13[_0xf022('0x5')]]['systemanswertime']=utils[_0xf022('0x21')]();}}else if(!_[_0xf022('0x22')](channels[_0x44cf13['linkedid']])&&_0x44cf13[_0xf022('0x1f')]==0x6&&_0x44cf13[_0xf022('0x1a')]!=_0xf022('0x23')){utils[_0xf022('0x6')](util[_0xf022('0x7')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x44cf13['uniqueid'],_0x44cf13[_0xf022('0x17')],_0x44cf13[_0xf022('0x1a')],_0x44cf13[_0xf022('0x9')]));channels[_0x44cf13[_0xf022('0x17')]][_0xf022('0x10')]=_0x44cf13['accountcode'];channels[_0x44cf13['linkedid']][_0xf022('0x24')]=_0x44cf13['channel'];if(_['isNil'](channels[_0x44cf13[_0xf022('0x17')]][_0xf022('0x25')])){channels[_0x44cf13[_0xf022('0x17')]]['answertime']=utils[_0xf022('0x21')]();}channels[_0x44cf13[_0xf022('0x17')]][_0xf022('0x26')]=dispositions[_['toNumber'](_0x44cf13[_0xf022('0x1f')])]||'ANSWERED';}}catch(_0x1ae696){utils[_0xf022('0x1d')](util[_0xf022('0x7')](_0xf022('0x1e'),_0x44cf13[_0xf022('0x5')]),_0x1ae696);}};exports[_0xf022('0x27')]=function(_0x261730){try{if(!_[_0xf022('0x22')](channels[_0x261730[_0xf022('0x5')]])){utils['debug'](util[_0xf022('0x7')](_0xf022('0x28'),_0x261730[_0xf022('0x5')]),_0x261730);if(_[_0xf022('0x22')](channels[_0x261730[_0xf022('0x5')]][_0xf022('0x29')])){channels[_0x261730[_0xf022('0x5')]]['callerid']=_0x261730[_0xf022('0x2a')]+'\x20<'+_0x261730[_0xf022('0x2b')]+'>';}utils[_0xf022('0x6')](util['format']('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x261730['uniqueid'],channels[_0x261730[_0xf022('0x5')]][_0xf022('0x29')],_0x261730['cause-txt']));channels[_0x261730['uniqueid']][_0xf022('0x2c')]=utils[_0xf022('0x21')]();channels[_0x261730[_0xf022('0x5')]][_0xf022('0x2d')]=utils[_0xf022('0x2e')](channels[_0x261730[_0xf022('0x5')]]['endtime'],channels[_0x261730['uniqueid']][_0xf022('0x2f')]);channels[_0x261730[_0xf022('0x5')]]['billableseconds']=channels[_0x261730[_0xf022('0x5')]][_0xf022('0x25')]?utils[_0xf022('0x2e')](channels[_0x261730[_0xf022('0x5')]][_0xf022('0x2c')],channels[_0x261730[_0xf022('0x5')]][_0xf022('0x25')]):0x0;writeDB(channels[_0x261730[_0xf022('0x5')]]);}}catch(_0x161f92){utils[_0xf022('0x1d')](util[_0xf022('0x7')](_0xf022('0x28'),_0x261730['uniqueid']),_0x161f92);}};exports[_0xf022('0x30')]=function(_0x5f1efe){try{if(!_[_0xf022('0x22')](channels[_0x5f1efe[_0xf022('0x31')]])){utils[_0xf022('0x15')](util[_0xf022('0x7')](_0xf022('0x32'),_0x5f1efe[_0xf022('0x33')]),_0x5f1efe);if(channels[_0x5f1efe[_0xf022('0x31')]][_0xf022('0x9')]==_0x5f1efe[_0xf022('0x34')]){utils[_0xf022('0x6')](util[_0xf022('0x7')](_0xf022('0x35'),_0x5f1efe['origtransfereruniqueid'],_0x5f1efe['localtwolinkedid'],_0x5f1efe[_0xf022('0x36')]));channels[_0x5f1efe[_0xf022('0x31')]]['destinationchannel']=_0x5f1efe['secondtransfererchannel'];channels[_0x5f1efe[_0xf022('0x31')]][_0xf022('0x37')]='_attended';}else if(channels[_0x5f1efe[_0xf022('0x31')]][_0xf022('0x9')]=_0x5f1efe['transfertargetchannel']){utils[_0xf022('0x6')](util[_0xf022('0x7')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x5f1efe['origtransfereruniqueid'],_0x5f1efe['localtwolinkedid'],_0x5f1efe['origtransfererchannel']));channels[_0x5f1efe['localtwolinkedid']]['destinationchannel']=_0x5f1efe[_0xf022('0x38')];channels[_0x5f1efe[_0xf022('0x31')]][_0xf022('0x37')]=_0xf022('0x39');}}}catch(_0x33b4a2){utils[_0xf022('0x1d')](util[_0xf022('0x7')](_0xf022('0x32'),_0x5f1efe['origtransfereruniqueid']),_0x33b4a2);}};exports[_0xf022('0x3a')]=function(_0x57cd5e){try{if(!_[_0xf022('0x22')](channels[_0x57cd5e[_0xf022('0x5')]])){utils[_0xf022('0x15')](util['format'](_0xf022('0x3b'),_0x57cd5e[_0xf022('0x5')]),_0x57cd5e);channels[_0x57cd5e['uniqueid']]['musiconholdstartAt']=utils[_0xf022('0x21')]();utils[_0xf022('0x6')](util[_0xf022('0x7')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x57cd5e[_0xf022('0x5')],channels[_0x57cd5e[_0xf022('0x5')]]['musiconholdstartAt']));}}catch(_0x3e3419){utils[_0xf022('0x1d')](util[_0xf022('0x7')](_0xf022('0x3b'),_0x57cd5e[_0xf022('0x5')]),_0x3e3419);}};exports['musiconholdstop']=function(_0x21a902){try{if(!_[_0xf022('0x22')](channels[_0x21a902['uniqueid']])){utils['debug'](util['format'](_0xf022('0x3c'),_0x21a902[_0xf022('0x5')]),_0x21a902);if(!_[_0xf022('0x22')](channels[_0x21a902[_0xf022('0x5')]][_0xf022('0x3d')])){channels[_0x21a902[_0xf022('0x5')]]['mohtime']+=utils[_0xf022('0x2e')](utils[_0xf022('0x21')](),channels[_0x21a902[_0xf022('0x5')]][_0xf022('0x3d')]);utils[_0xf022('0x6')](util[_0xf022('0x7')](_0xf022('0x3e'),_0x21a902[_0xf022('0x5')],channels[_0x21a902['uniqueid']][_0xf022('0x3f')]));delete channels[_0x21a902['uniqueid']][_0xf022('0x3d')];}}}catch(_0x1ac8ec){utils[_0xf022('0x1d')](util[_0xf022('0x7')](_0xf022('0x3c'),_0x21a902[_0xf022('0x5')]),_0x1ac8ec);}};exports['varset']=function(_0x4e59b3){try{if(!_[_0xf022('0x22')](channels[_0x4e59b3['uniqueid']])){utils[_0xf022('0x15')](util[_0xf022('0x7')]('[%s][calls][varset]',_0x4e59b3[_0xf022('0x5')]),_0x4e59b3);if(!_[_0xf022('0x22')](_0x4e59b3[_0xf022('0x40')]['xmd-originatecalleridnum'])){utils[_0xf022('0x6')](util['format']('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x4e59b3[_0xf022('0x5')],_0x4e59b3[_0xf022('0x41')]));channels[_0x4e59b3[_0xf022('0x5')]][_0xf022('0x42')]=_0x4e59b3['value'];}if(!_[_0xf022('0x22')](_0x4e59b3[_0xf022('0x40')][_0xf022('0x43')])){utils['info'](util[_0xf022('0x7')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x4e59b3[_0xf022('0x5')],_0x4e59b3['value']));channels[_0x4e59b3[_0xf022('0x5')]][_0xf022('0x44')]=_0x4e59b3[_0xf022('0x41')];channels[_0x4e59b3[_0xf022('0x5')]]['callerid']='\x22'+_0x4e59b3[_0xf022('0x41')]+_0xf022('0x45')+_0x4e59b3['value']+'>';}if(!_[_0xf022('0x22')](_0x4e59b3[_0xf022('0x40')][_0xf022('0x46')])||!_[_0xf022('0x22')](_0x4e59b3[_0xf022('0x40')][_0xf022('0x47')])){utils[_0xf022('0x6')](util[_0xf022('0x7')](_0xf022('0x48'),_0x4e59b3[_0xf022('0x5')],!_[_0xf022('0x22')](_0x4e59b3['variable'][_0xf022('0x46')])?'xmd-callerid-preview':_0xf022('0x47'),_0x4e59b3[_0xf022('0x41')]));channels[_0x4e59b3[_0xf022('0x5')]][_0xf022('0x29')]=_0x4e59b3[_0xf022('0x41')];}if(!_['isNil'](_0x4e59b3[_0xf022('0x40')][_0xf022('0x49')])||!_['isNil'](_0x4e59b3[_0xf022('0x40')][_0xf022('0x4a')])){utils[_0xf022('0x6')](util[_0xf022('0x7')](_0xf022('0x48'),_0x4e59b3[_0xf022('0x5')],!_[_0xf022('0x22')](_0x4e59b3[_0xf022('0x40')][_0xf022('0x49')])?_0xf022('0x49'):_0xf022('0x4a'),_0x4e59b3[_0xf022('0x41')]));channels[_0x4e59b3[_0xf022('0x5')]][_0xf022('0x4b')]=_0xf022('0x4c');channels[_0x4e59b3[_0xf022('0x5')]]['lastdata']=_0x4e59b3[_0xf022('0x41')];channels[_0x4e59b3['uniqueid']][_0xf022('0xa')]=!![];}if(!_['isNil'](_0x4e59b3[_0xf022('0x40')]['xmd-contactid'])){utils[_0xf022('0x6')](util[_0xf022('0x7')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x4e59b3[_0xf022('0x5')],_0x4e59b3['value']));channels[_0x4e59b3[_0xf022('0x5')]][_0xf022('0x4d')]=_0x4e59b3['value'];}if(!_[_0xf022('0x22')](_0x4e59b3[_0xf022('0x40')][_0xf022('0x4e')])){utils['info'](util[_0xf022('0x7')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x4e59b3[_0xf022('0x5')],_0x4e59b3[_0xf022('0x41')]));channels[_0x4e59b3['uniqueid']][_0xf022('0x4f')]=_0x4e59b3[_0xf022('0x41')];}if(!_[_0xf022('0x22')](_0x4e59b3[_0xf022('0x40')][_0xf022('0x50')])){utils[_0xf022('0x6')](util['format'](_0xf022('0x51'),_0x4e59b3[_0xf022('0x5')],_0x4e59b3[_0xf022('0x41')]));channels[_0x4e59b3[_0xf022('0x5')]]['routeid']=_0x4e59b3[_0xf022('0x41')];}if(!_['isNil'](_0x4e59b3[_0xf022('0x40')][_0xf022('0x52')])){utils[_0xf022('0x6')](util['format'](_0xf022('0x53'),_0x4e59b3[_0xf022('0x5')],_0x4e59b3[_0xf022('0x41')]));channels[_0x4e59b3[_0xf022('0x5')]][_0xf022('0x52')]=_0x4e59b3['value'];}}}catch(_0x4ac20c){utils[_0xf022('0x1d')](util[_0xf022('0x7')]('[%s][calls][varset]',_0x4e59b3['uniqueid']),_0x4ac20c);}};exports[_0xf022('0x54')]=function(_0x5805c0){try{if(!_[_0xf022('0x22')](channels[_0x5805c0[_0xf022('0x5')]])){utils['debug'](util[_0xf022('0x7')](_0xf022('0x55'),_0x5805c0[_0xf022('0x5')]),_0x5805c0);utils[_0xf022('0x6')](util[_0xf022('0x7')](_0xf022('0x56'),_0x5805c0[_0xf022('0x5')],_0x5805c0[_0xf022('0x57')],_0x5805c0[_0xf022('0x58')]));if(_0x5805c0[_0xf022('0x57')][_0xf022('0x59')]()==_0xf022('0x5a')&&_[_0xf022('0x5b')](_0x5805c0[_0xf022('0x58')][_0xf022('0x59')](),_0xf022('0x5c'))){var _0x4f48ac=_0x5805c0['appdata']['split']('=');var _0x174ba3=_0x4f48ac[0x0][_0xf022('0x5d')](_0x4f48ac[0x0][_0xf022('0x5e')]('(')+0x1,_0x4f48ac[0x0][_0xf022('0x5e')](')'));var _0x5d65a4=_0x4f48ac[0x1];channels[_0x5805c0['uniqueid']][_0x174ba3]=_0x5d65a4;}if(!_['includes']([_0xf022('0x27'),_0xf022('0x5f'),_0xf022('0x60'),_0xf022('0x5a'),_0xf022('0x61')],_0x5805c0[_0xf022('0x57')][_0xf022('0x59')]())){channels[_0x5805c0['uniqueid']][_0xf022('0x4b')]=_0x5805c0[_0xf022('0x57')];channels[_0x5805c0['uniqueid']][_0xf022('0x62')]=_0x5805c0['appdata'];}}}catch(_0x59ffc2){utils[_0xf022('0x1d')](util[_0xf022('0x7')](_0xf022('0x55'),_0x5805c0[_0xf022('0x5')]),_0x59ffc2);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index ffa218e..565b01a 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 _0xc522=['info','shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','./utils','connect'];(function(_0x5bcd82,_0x5aa492){var _0x34e619=function(_0x11db75){while(--_0x11db75){_0x5bcd82['push'](_0x5bcd82['shift']());}};_0x34e619(++_0x5aa492);}(_0xc522,0xa3));var _0x2c52=function(_0x61a191,_0x511aaa){_0x61a191=_0x61a191-0x0;var _0xb4307d=_0xc522[_0x61a191];return _0xb4307d;};'use strict';var utils=require(_0x2c52('0x0'));exports[_0x2c52('0x1')]=function(){utils[_0x2c52('0x2')]('[core]\x20connected');};exports[_0x2c52('0x3')]=function(){utils[_0x2c52('0x2')]('[core]\x20shutdown');};exports[_0x2c52('0x4')]=function(){utils['info'](_0x2c52('0x5'));};exports['error']=function(_0x2f1615){utils[_0x2c52('0x6')](_0x2c52('0x7'),_0x2f1615);};exports[_0x2c52('0x8')]=function(){utils[_0x2c52('0x2')](_0x2c52('0x9'));};exports[_0x2c52('0xa')]=function(_0x181d22){}; \ No newline at end of file +var _0x1a14=['close','[core]\x20close','managerevent','./utils','connect','info','[core]\x20connected','shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x1a14,0x15f));var _0x41a1=function(_0xaa8cac,_0x37834b){_0xaa8cac=_0xaa8cac-0x0;var _0xa238a0=_0x1a14[_0xaa8cac];return _0xa238a0;};'use strict';var utils=require(_0x41a1('0x0'));exports[_0x41a1('0x1')]=function(){utils[_0x41a1('0x2')](_0x41a1('0x3'));};exports[_0x41a1('0x4')]=function(){utils['info']('[core]\x20shutdown');};exports[_0x41a1('0x5')]=function(){utils[_0x41a1('0x2')](_0x41a1('0x6'));};exports[_0x41a1('0x7')]=function(_0x2d23e0){utils['error'](_0x41a1('0x8'),_0x2d23e0);};exports[_0x41a1('0x9')]=function(){utils['info'](_0x41a1('0xa'));};exports[_0x41a1('0xb')]=function(_0x189fac){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index aad56d9..d4fc4f4 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 _0xd2ab=['[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialbegin]','dialend','[%s][dials][dialend]','dialstatus','assign','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','duration','diffTime','endtime','holdtime','billableseconds','lodash','util','./utils','info','format','channel','dialstring','calleridnum','connectedlinenum','request','uniqueid','newexten','[%s][dials][newexten]','application','toLowerCase','set','startsWith','cdr(routeid)','error','debug','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','starttime','now','called'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd2ab,0x10e));var _0xbd2a=function(_0x17ea0b,_0x228975){_0x17ea0b=_0x17ea0b-0x0;var _0x8130dd=_0xd2ab[_0x17ea0b];return _0x8130dd;};'use strict';var _=require(_0xbd2a('0x0'));var util=require(_0xbd2a('0x1'));var utils=require(_0xbd2a('0x2'));var dials={};function writeDB(_0x22b491){utils[_0xbd2a('0x3')](util[_0xbd2a('0x4')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x22b491['uniqueid'],_0x22b491[_0xbd2a('0x5')],_0x22b491[_0xbd2a('0x6')],_0x22b491[_0xbd2a('0x7')],_0x22b491[_0xbd2a('0x8')],_0x22b491['dialstatus']));utils[_0xbd2a('0x9')]('CreateVoiceDialReport',_0x22b491);delete dials[_0x22b491[_0xbd2a('0xa')]];}exports[_0xbd2a('0xb')]=function(_0x458c5b){try{utils['debug'](util[_0xbd2a('0x4')](_0xbd2a('0xc'),_0x458c5b['uniqueid']),_0x458c5b);utils['info'](util[_0xbd2a('0x4')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x458c5b['uniqueid'],_0x458c5b[_0xbd2a('0xd')],_0x458c5b['appdata']));if(_0x458c5b['application'][_0xbd2a('0xe')]()==_0xbd2a('0xf')&&_[_0xbd2a('0x10')](_0x458c5b['appdata'][_0xbd2a('0xe')](),_0xbd2a('0x11'))){var _0xad21a1=_0x458c5b['appdata']['split']('=');dials[_0x458c5b['uniqueid']]={'routeId':_0xad21a1[0x1]};}}catch(_0x49b668){utils[_0xbd2a('0x12')](util[_0xbd2a('0x4')](_0xbd2a('0xc'),_0x458c5b[_0xbd2a('0xa')]),_0x49b668);}};exports['varset']=function(_0x244cbc){try{utils[_0xbd2a('0x13')](util[_0xbd2a('0x4')](_0xbd2a('0x14'),_0x244cbc[_0xbd2a('0xa')]),_0x244cbc);if(!_[_0xbd2a('0x15')](_0x244cbc[_0xbd2a('0x16')][_0xbd2a('0x17')])){utils[_0xbd2a('0x3')](util[_0xbd2a('0x4')](_0xbd2a('0x18'),_0x244cbc[_0xbd2a('0xa')],_0x244cbc[_0xbd2a('0x19')]));dials[_0x244cbc[_0xbd2a('0xa')]]={'routeId':_0x244cbc['value']};}}catch(_0x58cfe2){utils[_0xbd2a('0x12')](util[_0xbd2a('0x4')](_0xbd2a('0x14'),_0x244cbc[_0xbd2a('0xa')]),_0x58cfe2);}};exports[_0xbd2a('0x1a')]=function(_0x2decb2){try{if(!_[_0xbd2a('0x15')](dials[_0x2decb2[_0xbd2a('0xa')]])){utils[_0xbd2a('0x13')](util[_0xbd2a('0x4')]('[%s][dials][dialbegin]',_0x2decb2[_0xbd2a('0xa')]),_0x2decb2);dials[_0x2decb2['uniqueid']]=_['assign'](dials[_0x2decb2[_0xbd2a('0xa')]],_0x2decb2);dials[_0x2decb2[_0xbd2a('0xa')]][_0xbd2a('0x1b')]=utils[_0xbd2a('0x1c')]();dials[_0x2decb2[_0xbd2a('0xa')]]['lastevent']=_0xbd2a('0x1d');utils[_0xbd2a('0x3')](util[_0xbd2a('0x4')](_0xbd2a('0x1e'),_0x2decb2[_0xbd2a('0xa')],dials[_0x2decb2[_0xbd2a('0xa')]][_0xbd2a('0x1b')]));}}catch(_0x549280){utils['error'](util[_0xbd2a('0x4')](_0xbd2a('0x1f'),_0x2decb2['uniqueid']),_0x549280);}};exports[_0xbd2a('0x20')]=function(_0x209ce1){try{if(!_[_0xbd2a('0x15')](dials[_0x209ce1[_0xbd2a('0xa')]])){utils['debug'](util[_0xbd2a('0x4')](_0xbd2a('0x21'),_0x209ce1[_0xbd2a('0xa')]),_0x209ce1);dials[_0x209ce1[_0xbd2a('0xa')]]['dialstatus']=_0x209ce1[_0xbd2a('0x22')];if(_0x209ce1[_0xbd2a('0x22')]=='ANSWER'){dials[_0x209ce1['uniqueid']]=_[_0xbd2a('0x23')](dials[_0x209ce1['uniqueid']],_0x209ce1);dials[_0x209ce1[_0xbd2a('0xa')]][_0xbd2a('0x24')]=utils[_0xbd2a('0x1c')]();dials[_0x209ce1[_0xbd2a('0xa')]]['lastevent']=_0xbd2a('0x25');utils[_0xbd2a('0x3')](util[_0xbd2a('0x4')](_0xbd2a('0x26'),_0x209ce1['uniqueid'],_0x209ce1['dialstatus'],dials[_0x209ce1[_0xbd2a('0xa')]]['answertime']));}else{utils[_0xbd2a('0x3')](util[_0xbd2a('0x4')](_0xbd2a('0x27'),_0x209ce1['uniqueid'],_0x209ce1[_0xbd2a('0x22')]));}}}catch(_0x1edf1f){utils[_0xbd2a('0x12')](util[_0xbd2a('0x4')]('[%s][dials][dialend]',_0x209ce1[_0xbd2a('0xa')]),_0x1edf1f);}};exports[_0xbd2a('0x28')]=function(_0x5ef9da){try{if(!_['isNil'](dials[_0x5ef9da[_0xbd2a('0xa')]])){utils[_0xbd2a('0x13')](util['format'](_0xbd2a('0x29'),_0x5ef9da[_0xbd2a('0xa')]),_0x5ef9da);utils['info'](util['format'](_0xbd2a('0x2a'),_0x5ef9da['uniqueid'],_0x5ef9da[_0xbd2a('0x7')],_0x5ef9da[_0xbd2a('0x2b')],_0x5ef9da[_0xbd2a('0x2c')]));dials[_0x5ef9da[_0xbd2a('0xa')]]=_[_0xbd2a('0x23')](dials[_0x5ef9da[_0xbd2a('0xa')]],{'endtime':utils[_0xbd2a('0x1c')](),'lastevent':'complete'});dials[_0x5ef9da[_0xbd2a('0xa')]][_0xbd2a('0x2d')]=utils[_0xbd2a('0x2e')](dials[_0x5ef9da[_0xbd2a('0xa')]][_0xbd2a('0x2f')],dials[_0x5ef9da[_0xbd2a('0xa')]][_0xbd2a('0x1b')]);dials[_0x5ef9da[_0xbd2a('0xa')]][_0xbd2a('0x30')]=utils['diffTime'](dials[_0x5ef9da[_0xbd2a('0xa')]][_0xbd2a('0x24')]||dials[_0x5ef9da[_0xbd2a('0xa')]]['endtime'],dials[_0x5ef9da[_0xbd2a('0xa')]][_0xbd2a('0x1b')]);dials[_0x5ef9da[_0xbd2a('0xa')]][_0xbd2a('0x31')]=dials[_0x5ef9da[_0xbd2a('0xa')]][_0xbd2a('0x24')]?utils['diffTime'](dials[_0x5ef9da[_0xbd2a('0xa')]][_0xbd2a('0x2f')],dials[_0x5ef9da[_0xbd2a('0xa')]]['answertime']):0x0;writeDB(dials[_0x5ef9da[_0xbd2a('0xa')]]);}}catch(_0x499fdb){utils[_0xbd2a('0x12')](util['format'](_0xbd2a('0x29'),_0x5ef9da['uniqueid']),_0x499fdb);}}; \ No newline at end of file +var _0xbc16=['[%s][dials][varset]','variable','outboundrouteid','value','dialbegin','isNil','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','ANSWER','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','hangup','calleridname','complete','duration','diffTime','endtime','holdtime','billableseconds','lodash','./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','appdata','application','set','toLowerCase','cdr(routeid)','split','error','[%s][dials][newexten]'];(function(_0x4fd2d5,_0x116f68){var _0x297758=function(_0x465a4a){while(--_0x465a4a){_0x4fd2d5['push'](_0x4fd2d5['shift']());}};_0x297758(++_0x116f68);}(_0xbc16,0x140));var _0x6bc1=function(_0x2b4bc8,_0x1fa863){_0x2b4bc8=_0x2b4bc8-0x0;var _0x23b71a=_0xbc16[_0x2b4bc8];return _0x23b71a;};'use strict';var _=require(_0x6bc1('0x0'));var util=require('util');var utils=require(_0x6bc1('0x1'));var dials={};function writeDB(_0xa72eec){utils[_0x6bc1('0x2')](util[_0x6bc1('0x3')](_0x6bc1('0x4'),_0xa72eec[_0x6bc1('0x5')],_0xa72eec[_0x6bc1('0x6')],_0xa72eec[_0x6bc1('0x7')],_0xa72eec[_0x6bc1('0x8')],_0xa72eec[_0x6bc1('0x9')],_0xa72eec[_0x6bc1('0xa')]));utils[_0x6bc1('0xb')](_0x6bc1('0xc'),_0xa72eec);delete dials[_0xa72eec[_0x6bc1('0x5')]];}exports[_0x6bc1('0xd')]=function(_0x9d941e){try{utils[_0x6bc1('0xe')](util[_0x6bc1('0x3')]('[%s][dials][newexten]',_0x9d941e['uniqueid']),_0x9d941e);utils[_0x6bc1('0x2')](util[_0x6bc1('0x3')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x9d941e[_0x6bc1('0x5')],_0x9d941e['application'],_0x9d941e[_0x6bc1('0xf')]));if(_0x9d941e[_0x6bc1('0x10')]['toLowerCase']()==_0x6bc1('0x11')&&_['startsWith'](_0x9d941e[_0x6bc1('0xf')][_0x6bc1('0x12')](),_0x6bc1('0x13'))){var _0x34be53=_0x9d941e[_0x6bc1('0xf')][_0x6bc1('0x14')]('=');dials[_0x9d941e[_0x6bc1('0x5')]]={'routeId':_0x34be53[0x1]};}}catch(_0x40911e){utils[_0x6bc1('0x15')](util[_0x6bc1('0x3')](_0x6bc1('0x16'),_0x9d941e[_0x6bc1('0x5')]),_0x40911e);}};exports['varset']=function(_0x5a67a3){try{utils[_0x6bc1('0xe')](util[_0x6bc1('0x3')](_0x6bc1('0x17'),_0x5a67a3[_0x6bc1('0x5')]),_0x5a67a3);if(!_['isNil'](_0x5a67a3[_0x6bc1('0x18')][_0x6bc1('0x19')])){utils['info'](util[_0x6bc1('0x3')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x5a67a3[_0x6bc1('0x5')],_0x5a67a3['value']));dials[_0x5a67a3['uniqueid']]={'routeId':_0x5a67a3[_0x6bc1('0x1a')]};}}catch(_0x80727e){utils[_0x6bc1('0x15')](util[_0x6bc1('0x3')](_0x6bc1('0x17'),_0x5a67a3[_0x6bc1('0x5')]),_0x80727e);}};exports[_0x6bc1('0x1b')]=function(_0x1d4c0f){try{if(!_[_0x6bc1('0x1c')](dials[_0x1d4c0f[_0x6bc1('0x5')]])){utils['debug'](util[_0x6bc1('0x3')](_0x6bc1('0x1d'),_0x1d4c0f[_0x6bc1('0x5')]),_0x1d4c0f);dials[_0x1d4c0f[_0x6bc1('0x5')]]=_[_0x6bc1('0x1e')](dials[_0x1d4c0f['uniqueid']],_0x1d4c0f);dials[_0x1d4c0f[_0x6bc1('0x5')]][_0x6bc1('0x1f')]=utils[_0x6bc1('0x20')]();dials[_0x1d4c0f[_0x6bc1('0x5')]][_0x6bc1('0x21')]=_0x6bc1('0x22');utils[_0x6bc1('0x2')](util[_0x6bc1('0x3')](_0x6bc1('0x23'),_0x1d4c0f[_0x6bc1('0x5')],dials[_0x1d4c0f[_0x6bc1('0x5')]][_0x6bc1('0x1f')]));}}catch(_0x149821){utils['error'](util[_0x6bc1('0x3')](_0x6bc1('0x1d'),_0x1d4c0f[_0x6bc1('0x5')]),_0x149821);}};exports[_0x6bc1('0x24')]=function(_0x39a3e6){try{if(!_[_0x6bc1('0x1c')](dials[_0x39a3e6[_0x6bc1('0x5')]])){utils[_0x6bc1('0xe')](util[_0x6bc1('0x3')]('[%s][dials][dialend]',_0x39a3e6[_0x6bc1('0x5')]),_0x39a3e6);dials[_0x39a3e6[_0x6bc1('0x5')]][_0x6bc1('0xa')]=_0x39a3e6[_0x6bc1('0xa')];if(_0x39a3e6[_0x6bc1('0xa')]==_0x6bc1('0x25')){dials[_0x39a3e6['uniqueid']]=_[_0x6bc1('0x1e')](dials[_0x39a3e6['uniqueid']],_0x39a3e6);dials[_0x39a3e6[_0x6bc1('0x5')]]['answertime']=utils[_0x6bc1('0x20')]();dials[_0x39a3e6['uniqueid']][_0x6bc1('0x21')]=_0x6bc1('0x26');utils[_0x6bc1('0x2')](util[_0x6bc1('0x3')](_0x6bc1('0x27'),_0x39a3e6[_0x6bc1('0x5')],_0x39a3e6['dialstatus'],dials[_0x39a3e6['uniqueid']][_0x6bc1('0x28')]));}else{utils[_0x6bc1('0x2')](util['format']('[%s][dials][dialend]\x20dialstatus:%s',_0x39a3e6['uniqueid'],_0x39a3e6[_0x6bc1('0xa')]));}}}catch(_0x4ed7c2){utils[_0x6bc1('0x15')](util[_0x6bc1('0x3')]('[%s][dials][dialend]',_0x39a3e6[_0x6bc1('0x5')]),_0x4ed7c2);}};exports[_0x6bc1('0x29')]=function(_0x15acd1){try{if(!_[_0x6bc1('0x1c')](dials[_0x15acd1[_0x6bc1('0x5')]])){utils[_0x6bc1('0xe')](util[_0x6bc1('0x3')]('[%s][dials][hangup]',_0x15acd1[_0x6bc1('0x5')]),_0x15acd1);utils[_0x6bc1('0x2')](util[_0x6bc1('0x3')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x15acd1[_0x6bc1('0x5')],_0x15acd1[_0x6bc1('0x8')],_0x15acd1[_0x6bc1('0x2a')],_0x15acd1['cause-txt']));dials[_0x15acd1[_0x6bc1('0x5')]]=_[_0x6bc1('0x1e')](dials[_0x15acd1[_0x6bc1('0x5')]],{'endtime':utils['now'](),'lastevent':_0x6bc1('0x2b')});dials[_0x15acd1[_0x6bc1('0x5')]][_0x6bc1('0x2c')]=utils[_0x6bc1('0x2d')](dials[_0x15acd1[_0x6bc1('0x5')]][_0x6bc1('0x2e')],dials[_0x15acd1[_0x6bc1('0x5')]][_0x6bc1('0x1f')]);dials[_0x15acd1['uniqueid']][_0x6bc1('0x2f')]=utils[_0x6bc1('0x2d')](dials[_0x15acd1[_0x6bc1('0x5')]][_0x6bc1('0x28')]||dials[_0x15acd1[_0x6bc1('0x5')]][_0x6bc1('0x2e')],dials[_0x15acd1[_0x6bc1('0x5')]][_0x6bc1('0x1f')]);dials[_0x15acd1[_0x6bc1('0x5')]][_0x6bc1('0x30')]=dials[_0x15acd1[_0x6bc1('0x5')]][_0x6bc1('0x28')]?utils[_0x6bc1('0x2d')](dials[_0x15acd1[_0x6bc1('0x5')]][_0x6bc1('0x2e')],dials[_0x15acd1[_0x6bc1('0x5')]][_0x6bc1('0x28')]):0x0;writeDB(dials[_0x15acd1[_0x6bc1('0x5')]]);}}catch(_0x1a6e1b){utils[_0x6bc1('0x15')](util[_0x6bc1('0x3')]('[%s][dials][hangup]',_0x15acd1[_0x6bc1('0x5')]),_0x1a6e1b);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 91b7d80..9336e4c 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 _0xa7c2=['[%s][index][dialend]','../../config/environment','./utils','util','asterisk','port','username','password','keepConnected','xdr','disabled','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','agentconnect','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s]dialbegin','dialend'];(function(_0x5c6022,_0x5cd10b){var _0x4ab5af=function(_0x988aff){while(--_0x988aff){_0x5c6022['push'](_0x5c6022['shift']());}};_0x4ab5af(++_0x5cd10b);}(_0xa7c2,0x109));var _0x2a7c=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xa7c2[_0x13b8f3];return _0x1a6d06;};var AsteriskManager=require('asterisk-manager');var config=require(_0x2a7c('0x0'));var utils=require(_0x2a7c('0x1'));var util=require(_0x2a7c('0x2'));var ami=new AsteriskManager(config[_0x2a7c('0x3')][_0x2a7c('0x4')],config[_0x2a7c('0x3')]['ip'],config[_0x2a7c('0x3')][_0x2a7c('0x5')],config[_0x2a7c('0x3')][_0x2a7c('0x6')],!![]);ami[_0x2a7c('0x7')]();if(config['xdr']&&config[_0x2a7c('0x8')][_0x2a7c('0x9')]){utils['info'](_0x2a7c('0xa'));}else{var agents=require(_0x2a7c('0xb'));var calls=require(_0x2a7c('0xc'));var queues=require(_0x2a7c('0xd'));var recordings=require(_0x2a7c('0xe'));var members=require(_0x2a7c('0xf'));var dials=require(_0x2a7c('0x10'));var transfers=require(_0x2a7c('0x11'));var core=require('./core.controller');ami['on'](_0x2a7c('0x12'),core[_0x2a7c('0x12')]);ami['on'](_0x2a7c('0x13'),core[_0x2a7c('0x13')]);ami['on'](_0x2a7c('0x14'),core[_0x2a7c('0x14')]);ami['on'](_0x2a7c('0x15'),core[_0x2a7c('0x15')]);ami['on'](_0x2a7c('0x16'),core[_0x2a7c('0x16')]);ami['on'](_0x2a7c('0x17'),core[_0x2a7c('0x17')]);ami['on'](_0x2a7c('0x18'),function(_0x32619e){try{utils[_0x2a7c('0x19')](util[_0x2a7c('0x1a')](_0x2a7c('0x1b'),_0x32619e['device']),_0x32619e);members[_0x2a7c('0x18')](_0x32619e);}catch(_0x211119){utils[_0x2a7c('0x15')](util[_0x2a7c('0x1a')](_0x2a7c('0x1b'),_0x32619e['device']),_0x211119);}});ami['on'](_0x2a7c('0x1c'),function(_0x2733ca){try{utils[_0x2a7c('0x19')](util[_0x2a7c('0x1a')](_0x2a7c('0x1d'),_0x2733ca[_0x2a7c('0x1e')]),_0x2733ca);agents[_0x2a7c('0x1c')](_0x2733ca);}catch(_0x541895){utils['error'](util[_0x2a7c('0x1a')](_0x2a7c('0x1d'),_0x2733ca[_0x2a7c('0x1e')]),_0x541895);}});ami['on'](_0x2a7c('0x1f'),function(_0x1d10c8){try{utils[_0x2a7c('0x19')](util[_0x2a7c('0x1a')]('[%s][index][agentringnoanswer]',_0x1d10c8[_0x2a7c('0x1e')]),_0x1d10c8);agents[_0x2a7c('0x1f')](_0x1d10c8);}catch(_0x5093f5){utils[_0x2a7c('0x15')](util[_0x2a7c('0x1a')]('[%s][index][agentringnoanswer]',_0x1d10c8[_0x2a7c('0x1e')]),_0x5093f5);}});ami['on'](_0x2a7c('0x20'),function(_0x47b0cd){try{utils[_0x2a7c('0x19')](util[_0x2a7c('0x1a')]('[%s][index][agentconnect]',_0x47b0cd[_0x2a7c('0x1e')]),_0x47b0cd);agents['agentconnect'](_0x47b0cd);queues[_0x2a7c('0x20')](_0x47b0cd);}catch(_0x2edcfc){utils[_0x2a7c('0x15')](util[_0x2a7c('0x1a')]('[%s][index][agentconnect]',_0x47b0cd[_0x2a7c('0x1e')]),_0x2edcfc);}});ami['on']('agentcomplete',function(_0x37f1ec){try{utils['debug'](util[_0x2a7c('0x1a')](_0x2a7c('0x21'),_0x37f1ec[_0x2a7c('0x1e')]),_0x37f1ec);agents[_0x2a7c('0x22')](_0x37f1ec);queues[_0x2a7c('0x22')](_0x37f1ec);members['agentcomplete'](_0x37f1ec);}catch(_0x51592f){utils[_0x2a7c('0x15')](util[_0x2a7c('0x1a')](_0x2a7c('0x21'),_0x37f1ec[_0x2a7c('0x1e')]),_0x51592f);}});ami['on'](_0x2a7c('0x23'),function(_0x2df887){try{utils[_0x2a7c('0x19')](util[_0x2a7c('0x1a')](_0x2a7c('0x24'),_0x2df887[_0x2a7c('0x1e')]),_0x2df887);agents['queuecallerabandon'](_0x2df887);queues[_0x2a7c('0x23')](_0x2df887);}catch(_0x34054c){utils[_0x2a7c('0x15')](util['format']('[%s][index][queuecallerabandon]',_0x2df887[_0x2a7c('0x1e')]),_0x34054c);}});ami['on'](_0x2a7c('0x25'),function(_0x3c0093){try{utils['debug'](util[_0x2a7c('0x1a')]('[%s][index][queuecallerjoin]',_0x3c0093[_0x2a7c('0x1e')]),_0x3c0093);queues[_0x2a7c('0x25')](_0x3c0093);recordings[_0x2a7c('0x25')](_0x3c0093);}catch(_0x30a91a){utils['error'](util[_0x2a7c('0x1a')](_0x2a7c('0x26'),_0x3c0093[_0x2a7c('0x1e')]),_0x30a91a);}});ami['on'](_0x2a7c('0x27'),function(_0x3753f4){try{utils[_0x2a7c('0x19')](util[_0x2a7c('0x1a')](_0x2a7c('0x28'),_0x3753f4[_0x2a7c('0x1e')]),_0x3753f4);queues[_0x2a7c('0x27')](_0x3753f4);}catch(_0x4c9c03){utils[_0x2a7c('0x15')](util[_0x2a7c('0x1a')]('[%s][index][queuecallerleave]',_0x3753f4[_0x2a7c('0x1e')]),_0x4c9c03);}});ami['on'](_0x2a7c('0x29'),function(_0x5db395){try{utils[_0x2a7c('0x19')](util[_0x2a7c('0x1a')]('[%s][index][musiconholdstart]',_0x5db395[_0x2a7c('0x1e')]),_0x5db395);queues['musiconholdstart'](_0x5db395);calls[_0x2a7c('0x29')](_0x5db395);}catch(_0x513388){utils[_0x2a7c('0x15')](util[_0x2a7c('0x1a')](_0x2a7c('0x2a'),_0x5db395[_0x2a7c('0x1e')]),_0x513388);}});ami['on']('musiconholdstop',function(_0x3915b4){try{utils[_0x2a7c('0x19')](util[_0x2a7c('0x1a')](_0x2a7c('0x2b'),_0x3915b4[_0x2a7c('0x1e')]),_0x3915b4);queues[_0x2a7c('0x2c')](_0x3915b4);calls[_0x2a7c('0x2c')](_0x3915b4);}catch(_0x529f49){utils[_0x2a7c('0x15')](util[_0x2a7c('0x1a')](_0x2a7c('0x2b'),_0x3915b4['uniqueid']),_0x529f49);}});ami['on'](_0x2a7c('0x2d'),function(_0x2faab2){try{utils[_0x2a7c('0x19')](util[_0x2a7c('0x1a')](_0x2a7c('0x2e'),_0x2faab2[_0x2a7c('0x1e')]),_0x2faab2);calls[_0x2a7c('0x2d')](_0x2faab2);recordings[_0x2a7c('0x2d')](_0x2faab2);}catch(_0x1b7326){utils[_0x2a7c('0x15')](util[_0x2a7c('0x1a')]('[%s][index][newstate]',_0x2faab2[_0x2a7c('0x1e')]),_0x1b7326);}});ami['on'](_0x2a7c('0x2f'),function(_0x415a28){try{utils[_0x2a7c('0x19')](util['format'](_0x2a7c('0x30'),_0x415a28['uniqueid']),_0x415a28);calls[_0x2a7c('0x2f')](_0x415a28);recordings['hangup'](_0x415a28);dials[_0x2a7c('0x2f')](_0x415a28);agents['hangup'](_0x415a28);queues[_0x2a7c('0x2f')](_0x415a28);}catch(_0x1a32e4){utils[_0x2a7c('0x15')](util[_0x2a7c('0x1a')](_0x2a7c('0x30'),_0x415a28[_0x2a7c('0x1e')]),_0x1a32e4);}});ami['on'](_0x2a7c('0x31'),function(_0x5f37cc){try{utils[_0x2a7c('0x19')](util[_0x2a7c('0x1a')](_0x2a7c('0x32'),_0x5f37cc[_0x2a7c('0x1e')]),_0x5f37cc);members[_0x2a7c('0x31')](_0x5f37cc);}catch(_0x3d32da){utils['error'](util[_0x2a7c('0x1a')](_0x2a7c('0x32'),_0x5f37cc[_0x2a7c('0x1e')]),_0x3d32da);}});ami['on'](_0x2a7c('0x33'),function(_0x56fbfd){try{utils[_0x2a7c('0x19')](util[_0x2a7c('0x1a')](_0x2a7c('0x34'),_0x56fbfd['uniqueid']),_0x56fbfd);queues['blindtransfer'](_0x56fbfd);agents[_0x2a7c('0x33')](_0x56fbfd);transfers['blindtransfer'](_0x56fbfd);}catch(_0x372eab){utils[_0x2a7c('0x15')](util[_0x2a7c('0x1a')](_0x2a7c('0x34'),_0x56fbfd[_0x2a7c('0x1e')]),_0x372eab);}});ami['on'](_0x2a7c('0x35'),function(_0x434465){try{utils['debug'](util['format'](_0x2a7c('0x36'),_0x434465[_0x2a7c('0x37')]),_0x434465);queues[_0x2a7c('0x35')](_0x434465);transfers[_0x2a7c('0x35')](_0x434465);agents[_0x2a7c('0x35')](_0x434465);calls['attendedtransfer'](_0x434465);}catch(_0x22a194){utils[_0x2a7c('0x15')](util[_0x2a7c('0x1a')](_0x2a7c('0x36'),_0x434465['origtransfereruniqueid']),_0x22a194);}});ami['on'](_0x2a7c('0x38'),function(_0x51b4b3){try{utils['debug'](util[_0x2a7c('0x1a')]('[%s][index][varset]',_0x51b4b3['uniqueid']),_0x51b4b3);queues[_0x2a7c('0x38')](_0x51b4b3);recordings[_0x2a7c('0x38')](_0x51b4b3);calls['varset'](_0x51b4b3);dials[_0x2a7c('0x38')](_0x51b4b3);}catch(_0x471c25){utils[_0x2a7c('0x15')](util[_0x2a7c('0x1a')](_0x2a7c('0x39'),_0x51b4b3['uniqueid']),_0x471c25);}});ami['on']('newexten',function(_0x561c8d){try{utils[_0x2a7c('0x19')](util['format'](_0x2a7c('0x3a'),_0x561c8d[_0x2a7c('0x1e')]),_0x561c8d);calls['newexten'](_0x561c8d);recordings[_0x2a7c('0x3b')](_0x561c8d);dials[_0x2a7c('0x3b')](_0x561c8d);}catch(_0xdd8fce){utils['error'](util['format']('[%s][index][newexten]',_0x561c8d[_0x2a7c('0x1e')]),_0xdd8fce);}});ami['on'](_0x2a7c('0x3c'),function(_0x171107){try{utils[_0x2a7c('0x19')](util[_0x2a7c('0x1a')](_0x2a7c('0x3d'),_0x171107[_0x2a7c('0x1e')]),_0x171107);calls[_0x2a7c('0x3c')](_0x171107);recordings[_0x2a7c('0x3c')](_0x171107);}catch(_0x1b015f){utils[_0x2a7c('0x15')](util['format']('[%s][index][newchannel]',_0x171107[_0x2a7c('0x1e')]),_0x1b015f);}});ami['on'](_0x2a7c('0x3e'),function(_0x4ba772){try{utils[_0x2a7c('0x19')](util[_0x2a7c('0x1a')]('[%s][index][dialbegin]',_0x4ba772[_0x2a7c('0x1e')]),_0x4ba772);dials[_0x2a7c('0x3e')](_0x4ba772);}catch(_0x93f399){utils[_0x2a7c('0x15')](util[_0x2a7c('0x1a')](_0x2a7c('0x3f'),_0x4ba772[_0x2a7c('0x1e')]),_0x93f399);}});ami['on'](_0x2a7c('0x40'),function(_0xabc5b2){try{utils[_0x2a7c('0x19')](util[_0x2a7c('0x1a')](_0x2a7c('0x41'),_0xabc5b2['uniqueid']),_0xabc5b2);dials[_0x2a7c('0x40')](_0xabc5b2);}catch(_0x532a77){utils[_0x2a7c('0x15')](util[_0x2a7c('0x1a')](_0x2a7c('0x41'),_0xabc5b2[_0x2a7c('0x1e')]),_0x532a77);}});} \ No newline at end of file +var _0x7eab=['[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','[%s][index][varset]','varset','[%s][index][newexten]','newexten','newchannel','[%s][index][dialbegin]','dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','asterisk','username','password','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','debug','format','device','[%s][index][devicestatechange]','agentcalled','[%s][index][agentcalled]','uniqueid','[%s][index][agentringnoanswer]','agentringnoanswer','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]'];(function(_0x1600b1,_0x443e0e){var _0x322418=function(_0x2cc84f){while(--_0x2cc84f){_0x1600b1['push'](_0x1600b1['shift']());}};_0x322418(++_0x443e0e);}(_0x7eab,0x90));var _0xb7ea=function(_0x34147a,_0x3f70c7){_0x34147a=_0x34147a-0x0;var _0x3018d3=_0x7eab[_0x34147a];return _0x3018d3;};var AsteriskManager=require(_0xb7ea('0x0'));var config=require(_0xb7ea('0x1'));var utils=require(_0xb7ea('0x2'));var util=require(_0xb7ea('0x3'));var ami=new AsteriskManager(config[_0xb7ea('0x4')]['port'],config[_0xb7ea('0x4')]['ip'],config[_0xb7ea('0x4')][_0xb7ea('0x5')],config['asterisk'][_0xb7ea('0x6')],!![]);ami[_0xb7ea('0x7')]();if(config[_0xb7ea('0x8')]&&config[_0xb7ea('0x8')][_0xb7ea('0x9')]){utils[_0xb7ea('0xa')](_0xb7ea('0xb'));}else{var agents=require(_0xb7ea('0xc'));var calls=require('./calls.controller');var queues=require(_0xb7ea('0xd'));var recordings=require(_0xb7ea('0xe'));var members=require(_0xb7ea('0xf'));var dials=require(_0xb7ea('0x10'));var transfers=require(_0xb7ea('0x11'));var core=require(_0xb7ea('0x12'));ami['on'](_0xb7ea('0x13'),core['connect']);ami['on'](_0xb7ea('0x14'),core['shutdown']);ami['on'](_0xb7ea('0x15'),core[_0xb7ea('0x15')]);ami['on'](_0xb7ea('0x16'),core[_0xb7ea('0x16')]);ami['on'](_0xb7ea('0x17'),core['close']);ami['on'](_0xb7ea('0x18'),core['managerevent']);ami['on']('devicestatechange',function(_0x1b7565){try{utils[_0xb7ea('0x19')](util[_0xb7ea('0x1a')]('[%s][index][devicestatechange]',_0x1b7565[_0xb7ea('0x1b')]),_0x1b7565);members['devicestatechange'](_0x1b7565);}catch(_0x23fb98){utils['error'](util[_0xb7ea('0x1a')](_0xb7ea('0x1c'),_0x1b7565[_0xb7ea('0x1b')]),_0x23fb98);}});ami['on'](_0xb7ea('0x1d'),function(_0x1f3c84){try{utils[_0xb7ea('0x19')](util[_0xb7ea('0x1a')](_0xb7ea('0x1e'),_0x1f3c84[_0xb7ea('0x1f')]),_0x1f3c84);agents[_0xb7ea('0x1d')](_0x1f3c84);}catch(_0xc42d22){utils[_0xb7ea('0x16')](util[_0xb7ea('0x1a')](_0xb7ea('0x1e'),_0x1f3c84[_0xb7ea('0x1f')]),_0xc42d22);}});ami['on']('agentringnoanswer',function(_0xfab90f){try{utils['debug'](util[_0xb7ea('0x1a')](_0xb7ea('0x20'),_0xfab90f['uniqueid']),_0xfab90f);agents[_0xb7ea('0x21')](_0xfab90f);}catch(_0x29e225){utils[_0xb7ea('0x16')](util[_0xb7ea('0x1a')](_0xb7ea('0x20'),_0xfab90f[_0xb7ea('0x1f')]),_0x29e225);}});ami['on']('agentconnect',function(_0x40a84a){try{utils[_0xb7ea('0x19')](util[_0xb7ea('0x1a')]('[%s][index][agentconnect]',_0x40a84a[_0xb7ea('0x1f')]),_0x40a84a);agents['agentconnect'](_0x40a84a);queues['agentconnect'](_0x40a84a);}catch(_0x167d21){utils[_0xb7ea('0x16')](util[_0xb7ea('0x1a')](_0xb7ea('0x22'),_0x40a84a[_0xb7ea('0x1f')]),_0x167d21);}});ami['on'](_0xb7ea('0x23'),function(_0x5bba91){try{utils['debug'](util[_0xb7ea('0x1a')](_0xb7ea('0x24'),_0x5bba91['uniqueid']),_0x5bba91);agents[_0xb7ea('0x23')](_0x5bba91);queues[_0xb7ea('0x23')](_0x5bba91);members[_0xb7ea('0x23')](_0x5bba91);}catch(_0x8c7545){utils[_0xb7ea('0x16')](util['format'](_0xb7ea('0x24'),_0x5bba91[_0xb7ea('0x1f')]),_0x8c7545);}});ami['on'](_0xb7ea('0x25'),function(_0x529412){try{utils[_0xb7ea('0x19')](util[_0xb7ea('0x1a')]('[%s][index][queuecallerabandon]',_0x529412['uniqueid']),_0x529412);agents[_0xb7ea('0x25')](_0x529412);queues[_0xb7ea('0x25')](_0x529412);}catch(_0x102917){utils['error'](util[_0xb7ea('0x1a')](_0xb7ea('0x26'),_0x529412[_0xb7ea('0x1f')]),_0x102917);}});ami['on'](_0xb7ea('0x27'),function(_0x5ea09f){try{utils['debug'](util['format'](_0xb7ea('0x28'),_0x5ea09f['uniqueid']),_0x5ea09f);queues['queuecallerjoin'](_0x5ea09f);recordings[_0xb7ea('0x27')](_0x5ea09f);}catch(_0x43dd83){utils['error'](util[_0xb7ea('0x1a')](_0xb7ea('0x28'),_0x5ea09f['uniqueid']),_0x43dd83);}});ami['on'](_0xb7ea('0x29'),function(_0x571c92){try{utils[_0xb7ea('0x19')](util['format'](_0xb7ea('0x2a'),_0x571c92['uniqueid']),_0x571c92);queues[_0xb7ea('0x29')](_0x571c92);}catch(_0x56e17b){utils[_0xb7ea('0x16')](util[_0xb7ea('0x1a')]('[%s][index][queuecallerleave]',_0x571c92[_0xb7ea('0x1f')]),_0x56e17b);}});ami['on']('musiconholdstart',function(_0x1676cf){try{utils['debug'](util[_0xb7ea('0x1a')](_0xb7ea('0x2b'),_0x1676cf[_0xb7ea('0x1f')]),_0x1676cf);queues[_0xb7ea('0x2c')](_0x1676cf);calls[_0xb7ea('0x2c')](_0x1676cf);}catch(_0xb1682e){utils[_0xb7ea('0x16')](util['format']('[%s][index][musiconholdstart]',_0x1676cf['uniqueid']),_0xb1682e);}});ami['on']('musiconholdstop',function(_0x39bfc7){try{utils[_0xb7ea('0x19')](util['format']('[%s][index][musiconholdstop]',_0x39bfc7[_0xb7ea('0x1f')]),_0x39bfc7);queues['musiconholdstop'](_0x39bfc7);calls[_0xb7ea('0x2d')](_0x39bfc7);}catch(_0x1f09bf){utils[_0xb7ea('0x16')](util[_0xb7ea('0x1a')](_0xb7ea('0x2e'),_0x39bfc7[_0xb7ea('0x1f')]),_0x1f09bf);}});ami['on']('newstate',function(_0x4fd368){try{utils[_0xb7ea('0x19')](util[_0xb7ea('0x1a')](_0xb7ea('0x2f'),_0x4fd368['uniqueid']),_0x4fd368);calls['newstate'](_0x4fd368);recordings['newstate'](_0x4fd368);}catch(_0x1dcb03){utils[_0xb7ea('0x16')](util[_0xb7ea('0x1a')]('[%s][index][newstate]',_0x4fd368[_0xb7ea('0x1f')]),_0x1dcb03);}});ami['on']('hangup',function(_0x3ff821){try{utils[_0xb7ea('0x19')](util[_0xb7ea('0x1a')]('[%s][index][hangup]',_0x3ff821[_0xb7ea('0x1f')]),_0x3ff821);calls[_0xb7ea('0x30')](_0x3ff821);recordings[_0xb7ea('0x30')](_0x3ff821);dials[_0xb7ea('0x30')](_0x3ff821);agents[_0xb7ea('0x30')](_0x3ff821);queues['hangup'](_0x3ff821);}catch(_0x5ac914){utils['error'](util[_0xb7ea('0x1a')](_0xb7ea('0x31'),_0x3ff821[_0xb7ea('0x1f')]),_0x5ac914);}});ami['on'](_0xb7ea('0x32'),function(_0x1a24b1){try{utils['debug'](util[_0xb7ea('0x1a')](_0xb7ea('0x33'),_0x1a24b1[_0xb7ea('0x1f')]),_0x1a24b1);members[_0xb7ea('0x32')](_0x1a24b1);}catch(_0x5c3142){utils[_0xb7ea('0x16')](util[_0xb7ea('0x1a')](_0xb7ea('0x33'),_0x1a24b1[_0xb7ea('0x1f')]),_0x5c3142);}});ami['on'](_0xb7ea('0x34'),function(_0x1d1ed4){try{utils[_0xb7ea('0x19')](util['format'](_0xb7ea('0x35'),_0x1d1ed4[_0xb7ea('0x1f')]),_0x1d1ed4);queues[_0xb7ea('0x34')](_0x1d1ed4);agents[_0xb7ea('0x34')](_0x1d1ed4);transfers['blindtransfer'](_0x1d1ed4);}catch(_0x3524b0){utils['error'](util[_0xb7ea('0x1a')](_0xb7ea('0x35'),_0x1d1ed4[_0xb7ea('0x1f')]),_0x3524b0);}});ami['on']('attendedtransfer',function(_0x5509e5){try{utils[_0xb7ea('0x19')](util['format'](_0xb7ea('0x36'),_0x5509e5[_0xb7ea('0x37')]),_0x5509e5);queues[_0xb7ea('0x38')](_0x5509e5);transfers[_0xb7ea('0x38')](_0x5509e5);agents['attendedtransfer'](_0x5509e5);calls[_0xb7ea('0x38')](_0x5509e5);}catch(_0x35e8bd){utils['error'](util['format'](_0xb7ea('0x36'),_0x5509e5[_0xb7ea('0x37')]),_0x35e8bd);}});ami['on']('varset',function(_0x30035a){try{utils[_0xb7ea('0x19')](util['format'](_0xb7ea('0x39'),_0x30035a[_0xb7ea('0x1f')]),_0x30035a);queues['varset'](_0x30035a);recordings[_0xb7ea('0x3a')](_0x30035a);calls['varset'](_0x30035a);dials[_0xb7ea('0x3a')](_0x30035a);}catch(_0x2d0b59){utils[_0xb7ea('0x16')](util['format'](_0xb7ea('0x39'),_0x30035a[_0xb7ea('0x1f')]),_0x2d0b59);}});ami['on']('newexten',function(_0x2adb2f){try{utils[_0xb7ea('0x19')](util[_0xb7ea('0x1a')](_0xb7ea('0x3b'),_0x2adb2f[_0xb7ea('0x1f')]),_0x2adb2f);calls['newexten'](_0x2adb2f);recordings['newexten'](_0x2adb2f);dials[_0xb7ea('0x3c')](_0x2adb2f);}catch(_0x1d2290){utils[_0xb7ea('0x16')](util[_0xb7ea('0x1a')](_0xb7ea('0x3b'),_0x2adb2f[_0xb7ea('0x1f')]),_0x1d2290);}});ami['on'](_0xb7ea('0x3d'),function(_0x8055ce){try{utils[_0xb7ea('0x19')](util[_0xb7ea('0x1a')]('[%s][index][newchannel]',_0x8055ce[_0xb7ea('0x1f')]),_0x8055ce);calls[_0xb7ea('0x3d')](_0x8055ce);recordings[_0xb7ea('0x3d')](_0x8055ce);}catch(_0x2a4897){utils['error'](util[_0xb7ea('0x1a')]('[%s][index][newchannel]',_0x8055ce[_0xb7ea('0x1f')]),_0x2a4897);}});ami['on']('dialbegin',function(_0x1848e6){try{utils[_0xb7ea('0x19')](util[_0xb7ea('0x1a')](_0xb7ea('0x3e'),_0x1848e6[_0xb7ea('0x1f')]),_0x1848e6);dials[_0xb7ea('0x3f')](_0x1848e6);}catch(_0x2b8c98){utils['error'](util[_0xb7ea('0x1a')]('[%s]dialbegin',_0x1848e6[_0xb7ea('0x1f')]),_0x2b8c98);}});ami['on'](_0xb7ea('0x40'),function(_0x3de5b3){try{utils[_0xb7ea('0x19')](util[_0xb7ea('0x1a')](_0xb7ea('0x41'),_0x3de5b3['uniqueid']),_0x3de5b3);dials['dialend'](_0x3de5b3);}catch(_0x2092c8){utils[_0xb7ea('0x16')](util['format'](_0xb7ea('0x41'),_0x3de5b3[_0xb7ea('0x1f')]),_0x2092c8);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 2f613d8..d7b3af1 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 _0xdb49=['source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','data1','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','channel','data2','interface','getUserByInterface','then','membername','internal','CreateMemberReport','getUserByName','split','name','error','[%s][members][writeDB]','uniqueid','some','devicestatechange','[%s][members][devicestatechange]','device','state','INUSE','BUSY','voice','TALKING','now','isNil','exitAt','duration','diffTime','agentcomplete','debug','queue','assign','[%s][members][agentcomplete]','cdr','[%s][members][cdr]','type'];(function(_0x267d8d,_0xe90f65){var _0x11a98f=function(_0x5703c9){while(--_0x5703c9){_0x267d8d['push'](_0x267d8d['shift']());}};_0x11a98f(++_0xe90f65);}(_0xdb49,0x1c8));var _0x9db4=function(_0x40e3ae,_0x432f18){_0x40e3ae=_0x40e3ae-0x0;var _0x3563b7=_0xdb49[_0x40e3ae];return _0x3563b7;};'use strict';var _=require(_0x9db4('0x0'));var util=require(_0x9db4('0x1'));var utils=require(_0x9db4('0x2'));var members={};var exclude=[_0x9db4('0x3'),_0x9db4('0x4')];function writeDB(_0x264973){utils[_0x9db4('0x5')](util[_0x9db4('0x6')](_0x9db4('0x7'),_0x264973['uniqueid'],_0x264973['interface'],_0x264973[_0x9db4('0x8')],_0x264973[_0x9db4('0x9')],_0x264973['membername'],_0x264973['type']));if(_0x264973[_0x9db4('0xa')]){utils[_0x9db4('0xb')](_0x264973[_0x9db4('0xa')])[_0x9db4('0xc')](function(_0x20a470){if(_0x20a470){_0x264973[_0x9db4('0xd')]=_0x20a470['name'];_0x264973[_0x9db4('0xe')]=_0x20a470[_0x9db4('0xe')];utils['request'](_0x9db4('0xf'),_0x264973);}else{utils[_0x9db4('0x10')](_0x264973[_0x9db4('0xa')][_0x9db4('0x11')]('/')[0x1])['then'](function(_0x22efe7){if(_0x22efe7){_0x264973[_0x9db4('0xd')]=_0x22efe7[_0x9db4('0x12')];_0x264973[_0x9db4('0xe')]=_0x22efe7['internal'];utils['request'](_0x9db4('0xf'),_0x264973);}});}})['catch'](function(_0x275c57){utils[_0x9db4('0x13')](util[_0x9db4('0x6')](_0x9db4('0x14'),_0x264973[_0x9db4('0x15')]),_0x275c57);});}delete members[_0x264973[_0x9db4('0xa')]];}function startsWith(_0x1bd82c,_0x573a71){return _[_0x9db4('0x16')](_0x1bd82c,function(_0x21abb2){return _['startsWith'](_0x573a71,_0x21abb2);});}exports[_0x9db4('0x17')]=function(_0x25093f){try{utils['debug'](util['format'](_0x9db4('0x18'),members[_0x25093f[_0x9db4('0x19')]]?members[_0x25093f[_0x9db4('0x19')]][_0x9db4('0x15')]:_0x25093f['device']),_0x25093f);utils[_0x9db4('0x5')](util[_0x9db4('0x6')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x25093f[_0x9db4('0x19')]]?members[_0x25093f[_0x9db4('0x19')]][_0x9db4('0x15')]:_0x25093f['device'],_0x25093f[_0x9db4('0x1a')],_0x25093f['device']));switch(_0x25093f[_0x9db4('0x1a')]){case _0x9db4('0x1b'):case _0x9db4('0x1c'):if(!startsWith(exclude,_0x25093f[_0x9db4('0x19')])){members[_0x25093f[_0x9db4('0x19')]]={'channel':_0x9db4('0x1d'),'interface':_0x25093f[_0x9db4('0x19')],'type':_0x9db4('0x1e'),'enterAt':utils[_0x9db4('0x1f')](),'role':'agent'};}break;case'NOT_INUSE':if(!_[_0x9db4('0x20')](members[_0x25093f[_0x9db4('0x19')]])){members[_0x25093f[_0x9db4('0x19')]][_0x9db4('0x21')]=utils[_0x9db4('0x1f')]();members[_0x25093f[_0x9db4('0x19')]][_0x9db4('0x22')]=utils[_0x9db4('0x23')](members[_0x25093f['device']][_0x9db4('0x21')],members[_0x25093f[_0x9db4('0x19')]]['enterAt']);if(members[_0x25093f['device']]['uniqueid']){writeDB(members[_0x25093f[_0x9db4('0x19')]]);}}break;default:break;}}catch(_0x3c0b86){utils['error'](util[_0x9db4('0x6')](_0x9db4('0x18'),members[_0x25093f[_0x9db4('0x19')]]?members[_0x25093f[_0x9db4('0x19')]]['uniqueid']:_0x25093f[_0x9db4('0x19')]),_0x3c0b86);}};exports[_0x9db4('0x24')]=function(_0x4b1af5){try{if(!_[_0x9db4('0x20')](members[_0x4b1af5['interface']])){utils[_0x9db4('0x25')](util['format']('[%s][members][agentcomplete]',_0x4b1af5['uniqueid']),_0x4b1af5);utils[_0x9db4('0x5')](util['format']('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x4b1af5[_0x9db4('0x15')],_0x4b1af5['interface'],_0x4b1af5[_0x9db4('0x26')]));members[_0x4b1af5[_0x9db4('0xa')]]=_[_0x9db4('0x27')](members[_0x4b1af5[_0x9db4('0xa')]],{'data4':_0x4b1af5[_0x9db4('0x26')],'uniqueid':_0x4b1af5[_0x9db4('0x15')]});}}catch(_0x330d72){utils['error'](util[_0x9db4('0x6')](_0x9db4('0x28'),_0x4b1af5['uniqueid']),_0x330d72);}};exports[_0x9db4('0x29')]=function(_0x4ea0a3){try{utils['debug'](util['format'](_0x9db4('0x2a'),_0x4ea0a3[_0x9db4('0x15')]),_0x4ea0a3);if(_0x4ea0a3[_0x9db4('0x8')]){var _0x1a8093=_0x4ea0a3['channel'][_0x9db4('0x11')]('-')[0x0];if(!_[_0x9db4('0x20')](members[_0x1a8093])){members[_0x1a8093]=_['assign'](members[_0x1a8093],{'data1':members[_0x1a8093]['data1']||_0x4ea0a3[_0x9db4('0x2b')],'data2':members[_0x1a8093]['data2']||_0x4ea0a3[_0x9db4('0x2c')],'data3':members[_0x1a8093][_0x9db4('0x2d')]||_0x4ea0a3[_0x9db4('0x2e')],'uniqueid':members[_0x1a8093][_0x9db4('0x15')]||_0x4ea0a3[_0x9db4('0x15')]});utils['info'](util['format'](_0x9db4('0x2f'),_0x4ea0a3[_0x9db4('0x15')],members[_0x1a8093]['data1'],members[_0x1a8093][_0x9db4('0x9')],members[_0x1a8093][_0x9db4('0x2d')]));if(members[_0x1a8093]['exitAt']){writeDB(members[_0x1a8093]);}}}if(_0x4ea0a3['destinationchannel']){var _0x26ee68=_0x4ea0a3[_0x9db4('0x30')][_0x9db4('0x11')]('-')[0x0];if(!_[_0x9db4('0x20')](members[_0x26ee68])){members[_0x26ee68]=_[_0x9db4('0x27')](members[_0x26ee68],{'data1':members[_0x26ee68][_0x9db4('0x31')]||_0x4ea0a3['type'],'data2':members[_0x26ee68][_0x9db4('0x9')]||_0x4ea0a3[_0x9db4('0x2c')],'data3':members[_0x26ee68][_0x9db4('0x2d')]||_0x4ea0a3['destination'],'uniqueid':members[_0x26ee68][_0x9db4('0x15')]||_0x4ea0a3['uniqueid']});utils[_0x9db4('0x5')](util[_0x9db4('0x6')](_0x9db4('0x2f'),_0x4ea0a3['uniqueid'],members[_0x26ee68][_0x9db4('0x31')],members[_0x26ee68]['data2'],members[_0x26ee68][_0x9db4('0x2d')]));if(members[_0x26ee68][_0x9db4('0x21')]){writeDB(members[_0x26ee68]);}}}}catch(_0x41a3a9){utils['error'](util['format']('[%s][members][cdr]',_0x4ea0a3[_0x9db4('0x15')]),_0x41a3a9);}}; \ No newline at end of file +var _0x6732=['./utils','Local/_attended@transfer','info','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','data2','membername','type','interface','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','split','catch','[%s][members][writeDB]','startsWith','devicestatechange','format','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','voice','TALKING','now','agent','isNil','exitAt','duration','error','agentcomplete','debug','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','channel','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','[%s][members][cdr]','lodash','util'];(function(_0xdfcc55,_0x7d803c){var _0x156d65=function(_0x5b2505){while(--_0x5b2505){_0xdfcc55['push'](_0xdfcc55['shift']());}};_0x156d65(++_0x7d803c);}(_0x6732,0x66));var _0x2673=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6732[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2673('0x0'));var util=require(_0x2673('0x1'));var utils=require(_0x2673('0x2'));var members={};var exclude=[_0x2673('0x3'),'Queue:'];function writeDB(_0x3b698e){utils[_0x2673('0x4')](util['format'](_0x2673('0x5'),_0x3b698e[_0x2673('0x6')],_0x3b698e['interface'],_0x3b698e['channel'],_0x3b698e[_0x2673('0x7')],_0x3b698e[_0x2673('0x8')],_0x3b698e[_0x2673('0x9')]));if(_0x3b698e[_0x2673('0xa')]){utils[_0x2673('0xb')](_0x3b698e[_0x2673('0xa')])[_0x2673('0xc')](function(_0x13dbc0){if(_0x13dbc0){_0x3b698e[_0x2673('0x8')]=_0x13dbc0[_0x2673('0xd')];_0x3b698e[_0x2673('0xe')]=_0x13dbc0[_0x2673('0xe')];utils[_0x2673('0xf')](_0x2673('0x10'),_0x3b698e);}else{utils[_0x2673('0x11')](_0x3b698e[_0x2673('0xa')][_0x2673('0x12')]('/')[0x1])[_0x2673('0xc')](function(_0x1a02fa){if(_0x1a02fa){_0x3b698e['membername']=_0x1a02fa[_0x2673('0xd')];_0x3b698e['internal']=_0x1a02fa[_0x2673('0xe')];utils[_0x2673('0xf')](_0x2673('0x10'),_0x3b698e);}});}})[_0x2673('0x13')](function(_0xde7f4b){utils['error'](util['format'](_0x2673('0x14'),_0x3b698e[_0x2673('0x6')]),_0xde7f4b);});}delete members[_0x3b698e[_0x2673('0xa')]];}function startsWith(_0x1a7326,_0x38fc5f){return _['some'](_0x1a7326,function(_0x404134){return _[_0x2673('0x15')](_0x38fc5f,_0x404134);});}exports[_0x2673('0x16')]=function(_0xd2436d){try{utils['debug'](util[_0x2673('0x17')](_0x2673('0x18'),members[_0xd2436d[_0x2673('0x19')]]?members[_0xd2436d[_0x2673('0x19')]][_0x2673('0x6')]:_0xd2436d['device']),_0xd2436d);utils['info'](util[_0x2673('0x17')](_0x2673('0x1a'),members[_0xd2436d[_0x2673('0x19')]]?members[_0xd2436d[_0x2673('0x19')]][_0x2673('0x6')]:_0xd2436d[_0x2673('0x19')],_0xd2436d[_0x2673('0x1b')],_0xd2436d[_0x2673('0x19')]));switch(_0xd2436d['state']){case _0x2673('0x1c'):case'BUSY':if(!startsWith(exclude,_0xd2436d[_0x2673('0x19')])){members[_0xd2436d[_0x2673('0x19')]]={'channel':_0x2673('0x1d'),'interface':_0xd2436d[_0x2673('0x19')],'type':_0x2673('0x1e'),'enterAt':utils[_0x2673('0x1f')](),'role':_0x2673('0x20')};}break;case'NOT_INUSE':if(!_[_0x2673('0x21')](members[_0xd2436d[_0x2673('0x19')]])){members[_0xd2436d[_0x2673('0x19')]][_0x2673('0x22')]=utils['now']();members[_0xd2436d[_0x2673('0x19')]][_0x2673('0x23')]=utils['diffTime'](members[_0xd2436d['device']]['exitAt'],members[_0xd2436d[_0x2673('0x19')]]['enterAt']);if(members[_0xd2436d[_0x2673('0x19')]][_0x2673('0x6')]){writeDB(members[_0xd2436d['device']]);}}break;default:break;}}catch(_0x4e876b){utils[_0x2673('0x24')](util[_0x2673('0x17')](_0x2673('0x18'),members[_0xd2436d[_0x2673('0x19')]]?members[_0xd2436d['device']][_0x2673('0x6')]:_0xd2436d['device']),_0x4e876b);}};exports[_0x2673('0x25')]=function(_0x16d431){try{if(!_[_0x2673('0x21')](members[_0x16d431['interface']])){utils[_0x2673('0x26')](util[_0x2673('0x17')](_0x2673('0x27'),_0x16d431[_0x2673('0x6')]),_0x16d431);utils[_0x2673('0x4')](util['format'](_0x2673('0x28'),_0x16d431['uniqueid'],_0x16d431[_0x2673('0xa')],_0x16d431[_0x2673('0x29')]));members[_0x16d431[_0x2673('0xa')]]=_[_0x2673('0x2a')](members[_0x16d431[_0x2673('0xa')]],{'data4':_0x16d431[_0x2673('0x29')],'uniqueid':_0x16d431[_0x2673('0x6')]});}}catch(_0xa02926){utils[_0x2673('0x24')](util['format'](_0x2673('0x27'),_0x16d431[_0x2673('0x6')]),_0xa02926);}};exports[_0x2673('0x2b')]=function(_0x2cd839){try{utils[_0x2673('0x26')](util['format']('[%s][members][cdr]',_0x2cd839['uniqueid']),_0x2cd839);if(_0x2cd839[_0x2673('0x2c')]){var _0x326b4f=_0x2cd839[_0x2673('0x2c')]['split']('-')[0x0];if(!_[_0x2673('0x21')](members[_0x326b4f])){members[_0x326b4f]=_[_0x2673('0x2a')](members[_0x326b4f],{'data1':members[_0x326b4f][_0x2673('0x2d')]||_0x2cd839['type'],'data2':members[_0x326b4f][_0x2673('0x7')]||_0x2cd839[_0x2673('0x2e')],'data3':members[_0x326b4f][_0x2673('0x2f')]||_0x2cd839[_0x2673('0x30')],'uniqueid':members[_0x326b4f][_0x2673('0x6')]||_0x2cd839[_0x2673('0x6')]});utils['info'](util['format'](_0x2673('0x31'),_0x2cd839[_0x2673('0x6')],members[_0x326b4f][_0x2673('0x2d')],members[_0x326b4f][_0x2673('0x7')],members[_0x326b4f][_0x2673('0x2f')]));if(members[_0x326b4f][_0x2673('0x22')]){writeDB(members[_0x326b4f]);}}}if(_0x2cd839[_0x2673('0x32')]){var _0x210ee7=_0x2cd839['destinationchannel'][_0x2673('0x12')]('-')[0x0];if(!_[_0x2673('0x21')](members[_0x210ee7])){members[_0x210ee7]=_['assign'](members[_0x210ee7],{'data1':members[_0x210ee7]['data1']||_0x2cd839[_0x2673('0x9')],'data2':members[_0x210ee7][_0x2673('0x7')]||_0x2cd839[_0x2673('0x2e')],'data3':members[_0x210ee7]['data3']||_0x2cd839[_0x2673('0x30')],'uniqueid':members[_0x210ee7][_0x2673('0x6')]||_0x2cd839[_0x2673('0x6')]});utils[_0x2673('0x4')](util[_0x2673('0x17')](_0x2673('0x31'),_0x2cd839[_0x2673('0x6')],members[_0x210ee7][_0x2673('0x2d')],members[_0x210ee7][_0x2673('0x7')],members[_0x210ee7][_0x2673('0x2f')]));if(members[_0x210ee7][_0x2673('0x22')]){writeDB(members[_0x210ee7]);}}}}catch(_0xfab5dc){utils[_0x2673('0x24')](util[_0x2673('0x17')](_0x2673('0x33'),_0x2cd839['uniqueid']),_0xfab5dc);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index b769a1d..7ab49b6 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 _0xe6bc=['[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','membername','destaccountcode','accountcode','agentcomplete','[%s][queues][agentcomplete]','assigned','transfer','TRANSFER','COMPLETEDBY','reason','toUpperCase','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','lodash','./utils','info','format','channel','lastAssignedTo','calleridnum','queuecallerexitreason','queue','then','type','CreateVoiceQueueReport','request','transfereduniqueid','uniqueid','debug','[%s][queues][queuecallerjoin]','position','assign','error','hangup','isNil','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','now','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','variable','value','CONTINUE','queuecallerabandonAt','queueposition','queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','ABANDONED'];(function(_0x595aad,_0x374850){var _0x4c392f=function(_0x2681e3){while(--_0x2681e3){_0x595aad['push'](_0x595aad['shift']());}};_0x4c392f(++_0x374850);}(_0xe6bc,0x15e));var _0xce6b=function(_0x5b004f,_0xd4d052){_0x5b004f=_0x5b004f-0x0;var _0x3b42b3=_0xe6bc[_0x5b004f];return _0x3b42b3;};'use strict';var _=require(_0xce6b('0x0'));var util=require('util');var utils=require(_0xce6b('0x1'));var queues={};function writeDB(_0x391715){utils[_0xce6b('0x2')](util[_0xce6b('0x3')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x391715['uniqueid'],_0x391715[_0xce6b('0x4')],_0x391715['queue'],_0x391715[_0xce6b('0x5')],_0x391715[_0xce6b('0x6')],_0x391715['accountcode'],_0x391715[_0xce6b('0x7')]));if(_0x391715[_0xce6b('0x8')]){utils['getVoiceQueueByName'](_0x391715[_0xce6b('0x8')])[_0xce6b('0x9')](function(_0x5bc9b1){if(_0x5bc9b1){_0x391715[_0xce6b('0xa')]=_0x5bc9b1[_0xce6b('0xa')];}utils['request'](_0xce6b('0xb'),_0x391715);});}else{utils[_0xce6b('0xc')](_0xce6b('0xb'),_0x391715);}if(_0x391715['transfereduniqueid']){delete queues[_0x391715[_0xce6b('0xd')]];}else{delete queues[_0x391715[_0xce6b('0xe')]];}}exports['queuecallerjoin']=function(_0x14cf2f){try{utils[_0xce6b('0xf')](util['format'](_0xce6b('0x10'),_0x14cf2f[_0xce6b('0xe')]),_0x14cf2f);utils[_0xce6b('0x2')](util[_0xce6b('0x3')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x14cf2f[_0xce6b('0xe')],_0x14cf2f['queue'],_0x14cf2f[_0xce6b('0x11')]));queues[_0x14cf2f[_0xce6b('0xe')]]=_[_0xce6b('0x12')](_0x14cf2f,{'originalposition':_0x14cf2f[_0xce6b('0x11')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x2ae369){utils[_0xce6b('0x13')](util[_0xce6b('0x3')]('[%s][queues][queuecallerjoin]',_0x14cf2f[_0xce6b('0xe')]),_0x2ae369);}};exports[_0xce6b('0x14')]=function(_0x482ec0){try{if(!_[_0xce6b('0x15')](queues[_0x482ec0[_0xce6b('0xe')]])){utils['debug'](util[_0xce6b('0x3')]('[%s][queues][hangup]',_0x482ec0['uniqueid']),_0x482ec0);if(queues[_0x482ec0[_0xce6b('0xe')]][_0xce6b('0x16')]){if(!queues[_0x482ec0[_0xce6b('0xe')]][_0xce6b('0x17')]&&!queues[_0x482ec0[_0xce6b('0xe')]][_0xce6b('0x18')]){queues[_0x482ec0[_0xce6b('0xe')]][_0xce6b('0x19')]=!![];queues[_0x482ec0['uniqueid']][_0xce6b('0x1a')]=utils[_0xce6b('0x1b')]();queues[_0x482ec0[_0xce6b('0xe')]][_0xce6b('0x7')]='COMPLETEDBYAGENT';}utils[_0xce6b('0x2')](util[_0xce6b('0x3')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x482ec0[_0xce6b('0xe')],queues[_0x482ec0[_0xce6b('0xe')]][_0xce6b('0x1c')],queues[_0x482ec0[_0xce6b('0xe')]]['queuecallerexitreason']));writeDB(queues[_0x482ec0[_0xce6b('0xe')]]);}else if(queues[_0x482ec0[_0xce6b('0xe')]][_0xce6b('0xd')]){utils[_0xce6b('0x2')](util[_0xce6b('0x3')](_0xce6b('0x1d'),_0x482ec0[_0xce6b('0xe')],queues[_0x482ec0['uniqueid']][_0xce6b('0x1c')],queues[_0x482ec0[_0xce6b('0xe')]][_0xce6b('0xd')]));queues[queues[_0x482ec0[_0xce6b('0xe')]][_0xce6b('0xd')]]=queues[_0x482ec0['uniqueid']];queues[queues[_0x482ec0[_0xce6b('0xe')]][_0xce6b('0xd')]][_0xce6b('0x1e')]=0x2;delete queues[_0x482ec0[_0xce6b('0xe')]];}}}catch(_0x562b3d){utils[_0xce6b('0x13')](util[_0xce6b('0x3')]('[%s][queues][hangup]',_0x482ec0[_0xce6b('0xe')]),_0x562b3d);}};exports[_0xce6b('0x1f')]=function(_0x2dc27f){try{utils['debug'](util[_0xce6b('0x3')](_0xce6b('0x20'),_0x2dc27f[_0xce6b('0xe')]),_0x2dc27f);if(!_[_0xce6b('0x15')](_0x2dc27f[_0xce6b('0x21')]['queuestatus'])&&_0x2dc27f[_0xce6b('0x22')]['toUpperCase']()!==_0xce6b('0x23')){if(!_[_0xce6b('0x15')](queues[_0x2dc27f['uniqueid']])){queues[_0x2dc27f[_0xce6b('0xe')]][_0xce6b('0x17')]=![];queues[_0x2dc27f[_0xce6b('0xe')]][_0xce6b('0x24')]=null;queues[_0x2dc27f[_0xce6b('0xe')]]['queuecallerexit']=!![];queues[_0x2dc27f[_0xce6b('0xe')]]['queuecallerexitAt']=utils['now']();queues[_0x2dc27f[_0xce6b('0xe')]][_0xce6b('0x7')]=_0x2dc27f['value']['toUpperCase']();utils[_0xce6b('0x2')](util[_0xce6b('0x3')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x2dc27f['uniqueid'],queues[_0x2dc27f[_0xce6b('0xe')]][_0xce6b('0x1c')],_0x2dc27f['value'],queues[_0x2dc27f[_0xce6b('0xe')]]['queuecallerexitreason']));writeDB(queues[_0x2dc27f[_0xce6b('0xe')]]);}}else if(!_[_0xce6b('0x15')](_0x2dc27f[_0xce6b('0x21')][_0xce6b('0x25')])){if(!_[_0xce6b('0x15')](queues[_0x2dc27f['uniqueid']])&&!queues[_0x2dc27f[_0xce6b('0xe')]][_0xce6b('0x17')]){queues[_0x2dc27f[_0xce6b('0xe')]][_0xce6b('0x17')]=![];queues[_0x2dc27f[_0xce6b('0xe')]][_0xce6b('0x24')]=null;queues[_0x2dc27f[_0xce6b('0xe')]][_0xce6b('0x18')]=!![];queues[_0x2dc27f[_0xce6b('0xe')]][_0xce6b('0x26')]=utils[_0xce6b('0x1b')]();queues[_0x2dc27f[_0xce6b('0xe')]]['queuecallerexitreason']=_0xce6b('0x27');utils[_0xce6b('0x2')](util[_0xce6b('0x3')](_0xce6b('0x28'),_0x2dc27f[_0xce6b('0xe')],queues[_0x2dc27f[_0xce6b('0xe')]]['name'],_0x2dc27f[_0xce6b('0x22')],queues[_0x2dc27f[_0xce6b('0xe')]][_0xce6b('0x7')]));}}}catch(_0xe7bc89){utils['error'](util[_0xce6b('0x3')](_0xce6b('0x20'),_0x2dc27f[_0xce6b('0xe')]),_0xe7bc89);}};exports[_0xce6b('0x17')]=function(_0x1f3eb4){try{if(!_[_0xce6b('0x15')](queues[_0x1f3eb4[_0xce6b('0xe')]])){utils[_0xce6b('0xf')](util['format']('[%s][queues][queuecallerabandon]',_0x1f3eb4[_0xce6b('0xe')]),_0x1f3eb4);queues[_0x1f3eb4[_0xce6b('0xe')]][_0xce6b('0x18')]=![];queues[_0x1f3eb4[_0xce6b('0xe')]]['queuecallerexitAt']=null;queues[_0x1f3eb4['uniqueid']][_0xce6b('0x17')]=!![];queues[_0x1f3eb4[_0xce6b('0xe')]][_0xce6b('0x24')]=utils['now']();queues[_0x1f3eb4[_0xce6b('0xe')]][_0xce6b('0x7')]=_0xce6b('0x29');utils[_0xce6b('0x2')](util[_0xce6b('0x3')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x1f3eb4[_0xce6b('0xe')],queues[_0x1f3eb4[_0xce6b('0xe')]][_0xce6b('0x1c')],queues[_0x1f3eb4[_0xce6b('0xe')]][_0xce6b('0x7')]));}}catch(_0x46897c){utils['error'](util[_0xce6b('0x3')](_0xce6b('0x2a'),_0x1f3eb4['uniqueid']),_0x46897c);}};exports[_0xce6b('0x2b')]=function(_0x16791e){try{if(!_[_0xce6b('0x15')](queues[_0x16791e['uniqueid']])){utils[_0xce6b('0xf')](util[_0xce6b('0x3')](_0xce6b('0x2c'),_0x16791e['uniqueid']),_0x16791e);utils[_0xce6b('0x2')](util['format'](_0xce6b('0x2d'),_0x16791e[_0xce6b('0xe')],queues[_0x16791e[_0xce6b('0xe')]][_0xce6b('0x1c')],_0x16791e[_0xce6b('0x2e')],_0x16791e[_0xce6b('0x2f')]));queues[_0x16791e[_0xce6b('0xe')]][_0xce6b('0x2b')]=!![];queues[_0x16791e[_0xce6b('0xe')]][_0xce6b('0x16')]=utils['now']();queues[_0x16791e['uniqueid']]['holdtime']=utils[_0xce6b('0x30')](queues[_0x16791e[_0xce6b('0xe')]][_0xce6b('0x16')],queues[_0x16791e[_0xce6b('0xe')]][_0xce6b('0x31')]);queues[_0x16791e[_0xce6b('0xe')]][_0xce6b('0x11')]=_0x16791e['position'];queues[_0x16791e['uniqueid']]['count']=_0x16791e[_0xce6b('0x32')];queues[_0x16791e['uniqueid']][_0xce6b('0x2e')]=_0x16791e[_0xce6b('0x2e')];queues[_0x16791e[_0xce6b('0xe')]][_0xce6b('0x2f')]=_0x16791e[_0xce6b('0x2f')];}}catch(_0x2b7be1){utils[_0xce6b('0x13')](util[_0xce6b('0x3')]('[%s][queues][queuecallerleave]',_0x16791e[_0xce6b('0xe')]),_0x2b7be1);}};exports[_0xce6b('0x33')]=function(_0x4f4f06){try{if(!_[_0xce6b('0x15')](queues[_0x4f4f06['uniqueid']])){utils[_0xce6b('0xf')](util[_0xce6b('0x3')](_0xce6b('0x34'),_0x4f4f06[_0xce6b('0xe')]),_0x4f4f06);utils[_0xce6b('0x2')](util['format']('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x4f4f06['uniqueid'],queues[_0x4f4f06[_0xce6b('0xe')]][_0xce6b('0x1c')],_0x4f4f06[_0xce6b('0x35')],_0x4f4f06[_0xce6b('0x36')]));queues[_0x4f4f06[_0xce6b('0xe')]][_0xce6b('0x17')]=![];queues[_0x4f4f06[_0xce6b('0xe')]]['queuecallerabandon']=![];queues[_0x4f4f06[_0xce6b('0xe')]][_0xce6b('0x24')]=null;queues[_0x4f4f06[_0xce6b('0xe')]][_0xce6b('0x18')]=![];queues[_0x4f4f06[_0xce6b('0xe')]][_0xce6b('0x7')]=null;queues[_0x4f4f06[_0xce6b('0xe')]][_0xce6b('0x26')]=null;queues[_0x4f4f06[_0xce6b('0xe')]]['assigned']=!![];queues[_0x4f4f06[_0xce6b('0xe')]][_0xce6b('0x37')]=_0x4f4f06[_0xce6b('0x36')];queues[_0x4f4f06[_0xce6b('0xe')]]['lastAssignedTo']=_0x4f4f06[_0xce6b('0x35')];}}catch(_0x264def){utils[_0xce6b('0x13')](util[_0xce6b('0x3')](_0xce6b('0x34'),_0x4f4f06[_0xce6b('0xe')]),_0x264def);}};exports[_0xce6b('0x38')]=function(_0x41754c){try{if(!_['isNil'](queues[_0x41754c[_0xce6b('0xe')]])){if(queues[_0x41754c[_0xce6b('0xe')]]['queuecallerleaveAt']){utils[_0xce6b('0xf')](util[_0xce6b('0x3')](_0xce6b('0x39'),_0x41754c[_0xce6b('0xe')]),_0x41754c);queues[_0x41754c[_0xce6b('0xe')]][_0xce6b('0x17')]=![];queues[_0x41754c[_0xce6b('0xe')]]['queuecallerabandon']=![];queues[_0x41754c[_0xce6b('0xe')]][_0xce6b('0x24')]=null;queues[_0x41754c['uniqueid']][_0xce6b('0x18')]=![];queues[_0x41754c['uniqueid']][_0xce6b('0x26')]=null;queues[_0x41754c[_0xce6b('0xe')]][_0xce6b('0x3a')]=!![];queues[_0x41754c[_0xce6b('0xe')]][_0xce6b('0x5')]=_0x41754c[_0xce6b('0x35')];queues[_0x41754c['uniqueid']][_0xce6b('0x19')]=!![];queues[_0x41754c[_0xce6b('0xe')]][_0xce6b('0x1a')]=utils[_0xce6b('0x1b')]();if(_0x41754c['reason']==_0xce6b('0x3b')){if(!queues[_0x41754c[_0xce6b('0xe')]][_0xce6b('0x3b')]){queues[_0x41754c[_0xce6b('0xe')]][_0xce6b('0x7')]=_0xce6b('0x3c');}}else{queues[_0x41754c['uniqueid']][_0xce6b('0x7')]=_0xce6b('0x3d')+_0x41754c[_0xce6b('0x3e')][_0xce6b('0x3f')]();}utils[_0xce6b('0x2')](util[_0xce6b('0x3')](_0xce6b('0x40'),_0x41754c[_0xce6b('0xe')],queues[_0x41754c['uniqueid']][_0xce6b('0x1c')],_0x41754c[_0xce6b('0x35')],queues[_0x41754c[_0xce6b('0xe')]][_0xce6b('0x7')]));writeDB(queues[_0x41754c[_0xce6b('0xe')]]);}}}catch(_0x4e92e2){utils['error'](util[_0xce6b('0x3')](_0xce6b('0x39'),_0x41754c[_0xce6b('0xe')]),_0x4e92e2);}};exports[_0xce6b('0x41')]=function(_0x24090d){try{if(!_[_0xce6b('0x15')](queues[_0x24090d[_0xce6b('0x42')]])){utils[_0xce6b('0xf')](util['format'](_0xce6b('0x43'),_0x24090d[_0xce6b('0xe')]),_0x24090d);queues[_0x24090d[_0xce6b('0x42')]]['transfer']=!![];queues[_0x24090d[_0xce6b('0x42')]][_0xce6b('0x44')]=_0xce6b('0x45');queues[_0x24090d['transfereeuniqueid']][_0xce6b('0x46')]=_0x24090d[_0xce6b('0x47')];queues[_0x24090d['transfereeuniqueid']][_0xce6b('0x48')]=_0x24090d[_0xce6b('0x42')];queues[_0x24090d[_0xce6b('0x42')]][_0xce6b('0x7')]='BLINDTRANSFER';utils[_0xce6b('0x2')](util[_0xce6b('0x3')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x24090d[_0xce6b('0xe')],queues[_0x24090d[_0xce6b('0x42')]]['name'],_0x24090d['transfereeuniqueid'],_0x24090d[_0xce6b('0x47')]));}}catch(_0xb86a74){utils['error'](util['format']('[%s][queues][blindtransfer]',_0x24090d[_0xce6b('0xe')]),_0xb86a74);}};exports[_0xce6b('0x49')]=function(_0xbed1d){try{utils[_0xce6b('0xf')](util[_0xce6b('0x3')]('[%s][queues][attendedtransfer]',_0xbed1d['origtransfereruniqueid']),_0xbed1d);if(_0xbed1d[_0xce6b('0x4a')]==_0xbed1d[_0xce6b('0x4b')]){if(!_['isNil'](queues[_0xbed1d['secondtransfererlinkedid']])){utils['info'](util[_0xce6b('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0xbed1d[_0xce6b('0x4a')],queues[_0xbed1d[_0xce6b('0x4c')]][_0xce6b('0x1c')],_0xbed1d[_0xce6b('0x4d')]));queues[_0xbed1d[_0xce6b('0x4c')]][_0xce6b('0x3b')]=!![];queues[_0xbed1d[_0xce6b('0x4c')]]['transfertype']=_0xce6b('0x4e');queues[_0xbed1d['secondtransfererlinkedid']]['transferexten']=_0xbed1d[_0xce6b('0x4d')];queues[_0xbed1d[_0xce6b('0x4c')]]['transferuniqueid']=_0xbed1d['origtransfereruniqueid'];queues[_0xbed1d[_0xce6b('0x4c')]][_0xce6b('0x7')]=_0xce6b('0x4f');}if(!_['isNil'](queues[_0xbed1d['origtransfererlinkedid']])){if(_0xbed1d[_0xce6b('0x50')]&&queues[_0xbed1d[_0xce6b('0x50')]]){queues[_0xbed1d[_0xce6b('0x50')]][_0xce6b('0x1e')]=0x1;queues[_0xbed1d[_0xce6b('0x42')]]=_[_0xce6b('0x51')](queues[_0xbed1d[_0xce6b('0x50')]]);queues[_0xbed1d['transfereeuniqueid']][_0xce6b('0xd')]=_0xbed1d[_0xce6b('0x52')];queues[_0xbed1d[_0xce6b('0x42')]][_0xce6b('0x1e')]=0x2;queues[_0xbed1d[_0xce6b('0x42')]][_0xce6b('0x6')]=queues[_0xbed1d[_0xce6b('0x4c')]][_0xce6b('0x6')];queues[_0xbed1d[_0xce6b('0x42')]][_0xce6b('0x53')]=queues[_0xbed1d[_0xce6b('0x4c')]]['calleridname'];queues[_0xbed1d[_0xce6b('0x42')]][_0xce6b('0x31')]=utils[_0xce6b('0x1b')]();queues[_0xbed1d[_0xce6b('0x42')]]['queuecallerleaveAt']=utils[_0xce6b('0x1b')]();queues[_0xbed1d[_0xce6b('0x42')]][_0xce6b('0x54')]=0x0;queues[_0xbed1d[_0xce6b('0x42')]][_0xce6b('0x55')]=0x0;utils[_0xce6b('0x2')](util[_0xce6b('0x3')](_0xce6b('0x56'),_0xbed1d[_0xce6b('0x4a')],queues[_0xbed1d[_0xce6b('0x42')]][_0xce6b('0x1c')],queues[_0xbed1d['transfereeuniqueid']]['calleridnum'],queues[_0xbed1d['transfereeuniqueid']][_0xce6b('0x53')]));}else{utils[_0xce6b('0x2')](util[_0xce6b('0x3')](_0xce6b('0x57'),_0xbed1d[_0xce6b('0x4a')],queues[_0xbed1d[_0xce6b('0x4b')]][_0xce6b('0x1c')],_0xbed1d['secondtransfererlinkedid']));queues[_0xbed1d[_0xce6b('0x4b')]][_0xce6b('0xd')]=_0xbed1d['secondtransfererlinkedid'];}}}else if(_0xbed1d[_0xce6b('0x58')]==_0xbed1d[_0xce6b('0x4c')]){if(!_['isNil'](queues[_0xbed1d[_0xce6b('0x4b')]])){utils[_0xce6b('0x2')](util[_0xce6b('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0xbed1d[_0xce6b('0x4a')],queues[_0xbed1d[_0xce6b('0x4b')]][_0xce6b('0x1c')],_0xbed1d['secondtransfereruniqueid'],_0xbed1d['secondtransfererexten']));queues[_0xbed1d[_0xce6b('0x4b')]]['transfer']=!![];queues[_0xbed1d[_0xce6b('0x4b')]][_0xce6b('0x44')]=_0xce6b('0x4e');queues[_0xbed1d[_0xce6b('0x4b')]][_0xce6b('0x46')]=_0xbed1d[_0xce6b('0x59')];queues[_0xbed1d[_0xce6b('0x4b')]][_0xce6b('0x48')]=_0xbed1d[_0xce6b('0x58')];queues[_0xbed1d[_0xce6b('0x4b')]][_0xce6b('0x7')]=_0xce6b('0x4f');}if(!_[_0xce6b('0x15')](queues[_0xbed1d[_0xce6b('0x4c')]])){if(_0xbed1d[_0xce6b('0x5a')]&&queues[_0xbed1d[_0xce6b('0x5a')]]){queues[_0xbed1d['transfertargetlinkedid']]['queuecallerenterreason']=0x1;queues[_0xbed1d['transfertargetuniqueid']]=_[_0xce6b('0x51')](queues[_0xbed1d[_0xce6b('0x5a')]]);queues[_0xbed1d[_0xce6b('0x52')]]['transfereduniqueid']=_0xbed1d[_0xce6b('0x52')];queues[_0xbed1d[_0xce6b('0x52')]][_0xce6b('0x1e')]=0x2;queues[_0xbed1d[_0xce6b('0x52')]][_0xce6b('0x6')]=queues[_0xbed1d['origtransfererlinkedid']][_0xce6b('0x6')];queues[_0xbed1d[_0xce6b('0x52')]][_0xce6b('0x53')]=queues[_0xbed1d['origtransfererlinkedid']][_0xce6b('0x53')];queues[_0xbed1d[_0xce6b('0x52')]][_0xce6b('0x31')]=utils[_0xce6b('0x1b')]();queues[_0xbed1d[_0xce6b('0x52')]][_0xce6b('0x16')]=utils[_0xce6b('0x1b')]();queues[_0xbed1d[_0xce6b('0x52')]][_0xce6b('0x54')]=0x0;queues[_0xbed1d[_0xce6b('0x52')]]['mohtime']=0x0;utils[_0xce6b('0x2')](util[_0xce6b('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0xbed1d[_0xce6b('0x4a')],queues[_0xbed1d[_0xce6b('0x52')]]['name'],queues[_0xbed1d[_0xce6b('0x52')]][_0xce6b('0xd')],queues[_0xbed1d[_0xce6b('0x52')]]['calleridnum'],queues[_0xbed1d[_0xce6b('0x52')]][_0xce6b('0x53')]));}else{utils[_0xce6b('0x2')](util[_0xce6b('0x3')](_0xce6b('0x57'),_0xbed1d['origtransfereruniqueid'],queues[_0xbed1d[_0xce6b('0x4c')]][_0xce6b('0x1c')],_0xbed1d[_0xce6b('0x4b')]));queues[_0xbed1d[_0xce6b('0x4c')]]['transfereduniqueid']=_0xbed1d[_0xce6b('0x4b')];}}}}catch(_0x31daa8){utils[_0xce6b('0x13')](util[_0xce6b('0x3')](_0xce6b('0x5b'),_0xbed1d[_0xce6b('0x4a')]),_0x31daa8);}};exports[_0xce6b('0x5c')]=function(_0x3dd1c6){try{if(!_['isNil'](queues[_0x3dd1c6[_0xce6b('0xe')]])){utils['debug'](util[_0xce6b('0x3')](_0xce6b('0x5d'),_0x3dd1c6[_0xce6b('0xe')]),_0x3dd1c6);queues[_0x3dd1c6['uniqueid']][_0xce6b('0x5e')]=utils[_0xce6b('0x1b')]();utils[_0xce6b('0x2')](util[_0xce6b('0x3')](_0xce6b('0x5f'),_0x3dd1c6[_0xce6b('0xe')],queues[_0x3dd1c6[_0xce6b('0xe')]][_0xce6b('0x1c')],queues[_0x3dd1c6[_0xce6b('0xe')]][_0xce6b('0x5e')]));}}catch(_0x305682){utils['error'](util[_0xce6b('0x3')](_0xce6b('0x5d'),_0x3dd1c6[_0xce6b('0xe')]),_0x305682);}};exports[_0xce6b('0x60')]=function(_0x2f4a01){try{if(!_[_0xce6b('0x15')](queues[_0x2f4a01[_0xce6b('0xe')]])){if(!_['isNil'](queues[_0x2f4a01[_0xce6b('0xe')]]['musiconholdstartAt'])){utils['debug'](util[_0xce6b('0x3')]('[%s][queues][musiconholdstop]',_0x2f4a01[_0xce6b('0xe')]),_0x2f4a01);queues[_0x2f4a01['uniqueid']][_0xce6b('0x55')]+=utils[_0xce6b('0x30')](utils[_0xce6b('0x1b')](),queues[_0x2f4a01['uniqueid']][_0xce6b('0x5e')]);utils['info'](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x2f4a01['uniqueid'],queues[_0x2f4a01[_0xce6b('0xe')]][_0xce6b('0x1c')],queues[_0x2f4a01['uniqueid']][_0xce6b('0x55')]));delete queues[_0x2f4a01[_0xce6b('0xe')]]['musiconholdstartAt'];}}}catch(_0x441750){utils[_0xce6b('0x13')](util[_0xce6b('0x3')](_0xce6b('0x61'),_0x2f4a01[_0xce6b('0xe')]),_0x441750);}}; \ No newline at end of file +var _0x9674=['variable','queuestatus','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','value','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinenum','connectedlinename','holdtime','diffTime','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','agentcomplete','transfer','TRANSFER','reason','toUpperCase','[%s][queues][agentcomplete]','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transferexten','extension','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','transfertype','ATTENDED','transfereelinkedid','queuecallerenterreason','clone','transfertargetuniqueid','calleridname','queuecallerjoinAt','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','format','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','error','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','now','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','debug','[%s][queues][varset]'];(function(_0xdf5fc5,_0x37255b){var _0x52f5a5=function(_0x5e37aa){while(--_0x5e37aa){_0xdf5fc5['push'](_0xdf5fc5['shift']());}};_0x52f5a5(++_0x37255b);}(_0x9674,0x100));var _0x4967=function(_0x16f77c,_0x5256b1){_0x16f77c=_0x16f77c-0x0;var _0x78986e=_0x9674[_0x16f77c];return _0x78986e;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');var queues={};function writeDB(_0x587ab0){utils[_0x4967('0x0')](util['format'](_0x4967('0x1'),_0x587ab0[_0x4967('0x2')],_0x587ab0['channel'],_0x587ab0[_0x4967('0x3')],_0x587ab0[_0x4967('0x4')],_0x587ab0[_0x4967('0x5')],_0x587ab0[_0x4967('0x6')],_0x587ab0[_0x4967('0x7')]));if(_0x587ab0['queue']){utils[_0x4967('0x8')](_0x587ab0['queue'])[_0x4967('0x9')](function(_0x145d9f){if(_0x145d9f){_0x587ab0['type']=_0x145d9f['type'];}utils[_0x4967('0xa')](_0x4967('0xb'),_0x587ab0);});}else{utils[_0x4967('0xa')](_0x4967('0xb'),_0x587ab0);}if(_0x587ab0[_0x4967('0xc')]){delete queues[_0x587ab0['transfereduniqueid']];}else{delete queues[_0x587ab0[_0x4967('0x2')]];}}exports[_0x4967('0xd')]=function(_0x48f2ef){try{utils['debug'](util[_0x4967('0xe')](_0x4967('0xf'),_0x48f2ef[_0x4967('0x2')]),_0x48f2ef);utils[_0x4967('0x0')](util[_0x4967('0xe')](_0x4967('0x10'),_0x48f2ef[_0x4967('0x2')],_0x48f2ef[_0x4967('0x3')],_0x48f2ef[_0x4967('0x11')]));queues[_0x48f2ef[_0x4967('0x2')]]=_[_0x4967('0x12')](_0x48f2ef,{'originalposition':_0x48f2ef[_0x4967('0x11')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0xcaa22f){utils[_0x4967('0x13')](util[_0x4967('0xe')]('[%s][queues][queuecallerjoin]',_0x48f2ef[_0x4967('0x2')]),_0xcaa22f);}};exports['hangup']=function(_0x432646){try{if(!_[_0x4967('0x14')](queues[_0x432646['uniqueid']])){utils['debug'](util[_0x4967('0xe')](_0x4967('0x15'),_0x432646[_0x4967('0x2')]),_0x432646);if(queues[_0x432646[_0x4967('0x2')]][_0x4967('0x16')]){if(!queues[_0x432646[_0x4967('0x2')]][_0x4967('0x17')]&&!queues[_0x432646['uniqueid']]['queuecallerexit']){queues[_0x432646[_0x4967('0x2')]][_0x4967('0x18')]=!![];queues[_0x432646[_0x4967('0x2')]][_0x4967('0x19')]=utils[_0x4967('0x1a')]();queues[_0x432646[_0x4967('0x2')]][_0x4967('0x7')]='COMPLETEDBYAGENT';}utils[_0x4967('0x0')](util[_0x4967('0xe')](_0x4967('0x1b'),_0x432646['uniqueid'],queues[_0x432646[_0x4967('0x2')]][_0x4967('0x1c')],queues[_0x432646[_0x4967('0x2')]][_0x4967('0x7')]));writeDB(queues[_0x432646[_0x4967('0x2')]]);}else if(queues[_0x432646['uniqueid']]['transfereduniqueid']){utils[_0x4967('0x0')](util['format'](_0x4967('0x1d'),_0x432646[_0x4967('0x2')],queues[_0x432646[_0x4967('0x2')]][_0x4967('0x1c')],queues[_0x432646[_0x4967('0x2')]][_0x4967('0xc')]));queues[queues[_0x432646[_0x4967('0x2')]]['transfereduniqueid']]=queues[_0x432646[_0x4967('0x2')]];queues[queues[_0x432646[_0x4967('0x2')]][_0x4967('0xc')]]['queuecallerenterreason']=0x2;delete queues[_0x432646[_0x4967('0x2')]];}}}catch(_0x20632b){utils[_0x4967('0x13')](util[_0x4967('0xe')](_0x4967('0x15'),_0x432646[_0x4967('0x2')]),_0x20632b);}};exports['varset']=function(_0x2a7f3e){try{utils[_0x4967('0x1e')](util[_0x4967('0xe')](_0x4967('0x1f'),_0x2a7f3e[_0x4967('0x2')]),_0x2a7f3e);if(!_['isNil'](_0x2a7f3e[_0x4967('0x20')][_0x4967('0x21')])&&_0x2a7f3e['value']['toUpperCase']()!=='CONTINUE'){if(!_[_0x4967('0x14')](queues[_0x2a7f3e[_0x4967('0x2')]])){queues[_0x2a7f3e[_0x4967('0x2')]][_0x4967('0x17')]=![];queues[_0x2a7f3e[_0x4967('0x2')]][_0x4967('0x22')]=null;queues[_0x2a7f3e[_0x4967('0x2')]][_0x4967('0x23')]=!![];queues[_0x2a7f3e['uniqueid']][_0x4967('0x24')]=utils['now']();queues[_0x2a7f3e[_0x4967('0x2')]][_0x4967('0x7')]=_0x2a7f3e['value']['toUpperCase']();utils[_0x4967('0x0')](util[_0x4967('0xe')](_0x4967('0x25'),_0x2a7f3e[_0x4967('0x2')],queues[_0x2a7f3e['uniqueid']][_0x4967('0x1c')],_0x2a7f3e[_0x4967('0x26')],queues[_0x2a7f3e[_0x4967('0x2')]][_0x4967('0x7')]));writeDB(queues[_0x2a7f3e[_0x4967('0x2')]]);}}else if(!_['isNil'](_0x2a7f3e[_0x4967('0x20')][_0x4967('0x27')])){if(!_['isNil'](queues[_0x2a7f3e[_0x4967('0x2')]])&&!queues[_0x2a7f3e[_0x4967('0x2')]][_0x4967('0x17')]){queues[_0x2a7f3e[_0x4967('0x2')]][_0x4967('0x17')]=![];queues[_0x2a7f3e[_0x4967('0x2')]][_0x4967('0x22')]=null;queues[_0x2a7f3e['uniqueid']][_0x4967('0x23')]=!![];queues[_0x2a7f3e[_0x4967('0x2')]][_0x4967('0x24')]=utils['now']();queues[_0x2a7f3e[_0x4967('0x2')]][_0x4967('0x7')]=_0x4967('0x28');utils[_0x4967('0x0')](util[_0x4967('0xe')](_0x4967('0x29'),_0x2a7f3e[_0x4967('0x2')],queues[_0x2a7f3e[_0x4967('0x2')]][_0x4967('0x1c')],_0x2a7f3e[_0x4967('0x26')],queues[_0x2a7f3e[_0x4967('0x2')]][_0x4967('0x7')]));}}}catch(_0x4aa499){utils[_0x4967('0x13')](util[_0x4967('0xe')](_0x4967('0x1f'),_0x2a7f3e[_0x4967('0x2')]),_0x4aa499);}};exports[_0x4967('0x17')]=function(_0x1a0854){try{if(!_[_0x4967('0x14')](queues[_0x1a0854[_0x4967('0x2')]])){utils[_0x4967('0x1e')](util[_0x4967('0xe')]('[%s][queues][queuecallerabandon]',_0x1a0854[_0x4967('0x2')]),_0x1a0854);queues[_0x1a0854['uniqueid']][_0x4967('0x23')]=![];queues[_0x1a0854[_0x4967('0x2')]]['queuecallerexitAt']=null;queues[_0x1a0854[_0x4967('0x2')]][_0x4967('0x17')]=!![];queues[_0x1a0854['uniqueid']][_0x4967('0x22')]=utils[_0x4967('0x1a')]();queues[_0x1a0854[_0x4967('0x2')]][_0x4967('0x7')]='ABANDONED';utils[_0x4967('0x0')](util['format']('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x1a0854['uniqueid'],queues[_0x1a0854[_0x4967('0x2')]]['name'],queues[_0x1a0854[_0x4967('0x2')]][_0x4967('0x7')]));}}catch(_0x51262c){utils[_0x4967('0x13')](util[_0x4967('0xe')](_0x4967('0x2a'),_0x1a0854[_0x4967('0x2')]),_0x51262c);}};exports[_0x4967('0x2b')]=function(_0x359433){try{if(!_[_0x4967('0x14')](queues[_0x359433[_0x4967('0x2')]])){utils['debug'](util[_0x4967('0xe')](_0x4967('0x2c'),_0x359433[_0x4967('0x2')]),_0x359433);utils[_0x4967('0x0')](util[_0x4967('0xe')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x359433[_0x4967('0x2')],queues[_0x359433['uniqueid']][_0x4967('0x1c')],_0x359433[_0x4967('0x2d')],_0x359433[_0x4967('0x2e')]));queues[_0x359433[_0x4967('0x2')]][_0x4967('0x2b')]=!![];queues[_0x359433['uniqueid']][_0x4967('0x16')]=utils[_0x4967('0x1a')]();queues[_0x359433['uniqueid']][_0x4967('0x2f')]=utils[_0x4967('0x30')](queues[_0x359433[_0x4967('0x2')]][_0x4967('0x16')],queues[_0x359433[_0x4967('0x2')]]['queuecallerjoinAt']);queues[_0x359433[_0x4967('0x2')]][_0x4967('0x11')]=_0x359433['position'];queues[_0x359433[_0x4967('0x2')]][_0x4967('0x31')]=_0x359433[_0x4967('0x31')];queues[_0x359433[_0x4967('0x2')]]['connectedlinenum']=_0x359433['connectedlinenum'];queues[_0x359433[_0x4967('0x2')]][_0x4967('0x2e')]=_0x359433[_0x4967('0x2e')];}}catch(_0x59c153){utils[_0x4967('0x13')](util[_0x4967('0xe')]('[%s][queues][queuecallerleave]',_0x359433[_0x4967('0x2')]),_0x59c153);}};exports[_0x4967('0x32')]=function(_0x2bdd9b){try{if(!_[_0x4967('0x14')](queues[_0x2bdd9b[_0x4967('0x2')]])){utils[_0x4967('0x1e')](util['format'](_0x4967('0x33'),_0x2bdd9b[_0x4967('0x2')]),_0x2bdd9b);utils[_0x4967('0x0')](util[_0x4967('0xe')](_0x4967('0x34'),_0x2bdd9b['uniqueid'],queues[_0x2bdd9b['uniqueid']][_0x4967('0x1c')],_0x2bdd9b[_0x4967('0x35')],_0x2bdd9b['destaccountcode']));queues[_0x2bdd9b['uniqueid']]['queuecallerabandon']=![];queues[_0x2bdd9b[_0x4967('0x2')]][_0x4967('0x17')]=![];queues[_0x2bdd9b[_0x4967('0x2')]][_0x4967('0x22')]=null;queues[_0x2bdd9b[_0x4967('0x2')]][_0x4967('0x23')]=![];queues[_0x2bdd9b[_0x4967('0x2')]]['queuecallerexitreason']=null;queues[_0x2bdd9b[_0x4967('0x2')]][_0x4967('0x24')]=null;queues[_0x2bdd9b['uniqueid']]['assigned']=!![];queues[_0x2bdd9b[_0x4967('0x2')]][_0x4967('0x6')]=_0x2bdd9b[_0x4967('0x36')];queues[_0x2bdd9b[_0x4967('0x2')]]['lastAssignedTo']=_0x2bdd9b[_0x4967('0x35')];}}catch(_0x145392){utils['error'](util[_0x4967('0xe')]('[%s][queues][agentconnect]',_0x2bdd9b[_0x4967('0x2')]),_0x145392);}};exports[_0x4967('0x37')]=function(_0x424325){try{if(!_[_0x4967('0x14')](queues[_0x424325['uniqueid']])){if(queues[_0x424325['uniqueid']][_0x4967('0x16')]){utils[_0x4967('0x1e')](util['format']('[%s][queues][agentcomplete]',_0x424325['uniqueid']),_0x424325);queues[_0x424325[_0x4967('0x2')]]['queuecallerabandon']=![];queues[_0x424325['uniqueid']][_0x4967('0x17')]=![];queues[_0x424325[_0x4967('0x2')]][_0x4967('0x22')]=null;queues[_0x424325[_0x4967('0x2')]][_0x4967('0x23')]=![];queues[_0x424325[_0x4967('0x2')]][_0x4967('0x24')]=null;queues[_0x424325[_0x4967('0x2')]]['assigned']=!![];queues[_0x424325['uniqueid']][_0x4967('0x4')]=_0x424325[_0x4967('0x35')];queues[_0x424325['uniqueid']][_0x4967('0x18')]=!![];queues[_0x424325['uniqueid']][_0x4967('0x19')]=utils['now']();if(_0x424325['reason']=='transfer'){if(!queues[_0x424325['uniqueid']][_0x4967('0x38')]){queues[_0x424325[_0x4967('0x2')]][_0x4967('0x7')]=_0x4967('0x39');}}else{queues[_0x424325[_0x4967('0x2')]]['queuecallerexitreason']='COMPLETEDBY'+_0x424325[_0x4967('0x3a')][_0x4967('0x3b')]();}utils[_0x4967('0x0')](util[_0x4967('0xe')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x424325[_0x4967('0x2')],queues[_0x424325[_0x4967('0x2')]]['name'],_0x424325[_0x4967('0x35')],queues[_0x424325[_0x4967('0x2')]]['queuecallerexitreason']));writeDB(queues[_0x424325[_0x4967('0x2')]]);}}}catch(_0x344a26){utils['error'](util[_0x4967('0xe')](_0x4967('0x3c'),_0x424325[_0x4967('0x2')]),_0x344a26);}};exports[_0x4967('0x3d')]=function(_0x43aa26){try{if(!_[_0x4967('0x14')](queues[_0x43aa26[_0x4967('0x3e')]])){utils[_0x4967('0x1e')](util[_0x4967('0xe')](_0x4967('0x3f'),_0x43aa26['uniqueid']),_0x43aa26);queues[_0x43aa26['transfereeuniqueid']][_0x4967('0x38')]=!![];queues[_0x43aa26[_0x4967('0x3e')]]['transfertype']='BLIND';queues[_0x43aa26['transfereeuniqueid']][_0x4967('0x40')]=_0x43aa26[_0x4967('0x41')];queues[_0x43aa26[_0x4967('0x3e')]][_0x4967('0x42')]=_0x43aa26[_0x4967('0x3e')];queues[_0x43aa26[_0x4967('0x3e')]][_0x4967('0x7')]='BLINDTRANSFER';utils['info'](util[_0x4967('0xe')](_0x4967('0x43'),_0x43aa26[_0x4967('0x2')],queues[_0x43aa26['transfereeuniqueid']][_0x4967('0x1c')],_0x43aa26[_0x4967('0x3e')],_0x43aa26[_0x4967('0x41')]));}}catch(_0xa746b4){utils[_0x4967('0x13')](util['format'](_0x4967('0x3f'),_0x43aa26['uniqueid']),_0xa746b4);}};exports[_0x4967('0x44')]=function(_0x5d221f){try{utils[_0x4967('0x1e')](util[_0x4967('0xe')](_0x4967('0x45'),_0x5d221f[_0x4967('0x46')]),_0x5d221f);if(_0x5d221f[_0x4967('0x46')]==_0x5d221f[_0x4967('0x47')]){if(!_[_0x4967('0x14')](queues[_0x5d221f[_0x4967('0x48')]])){utils['info'](util[_0x4967('0xe')](_0x4967('0x49'),_0x5d221f[_0x4967('0x46')],queues[_0x5d221f['secondtransfererlinkedid']][_0x4967('0x1c')],_0x5d221f['origtransfererexten']));queues[_0x5d221f[_0x4967('0x48')]][_0x4967('0x38')]=!![];queues[_0x5d221f[_0x4967('0x48')]][_0x4967('0x4a')]=_0x4967('0x4b');queues[_0x5d221f[_0x4967('0x48')]][_0x4967('0x40')]=_0x5d221f['origtransfererexten'];queues[_0x5d221f[_0x4967('0x48')]][_0x4967('0x42')]=_0x5d221f[_0x4967('0x46')];queues[_0x5d221f[_0x4967('0x48')]][_0x4967('0x7')]='ATTENDEDTRANSFER';}if(!_[_0x4967('0x14')](queues[_0x5d221f[_0x4967('0x47')]])){if(_0x5d221f[_0x4967('0x4c')]&&queues[_0x5d221f[_0x4967('0x4c')]]){queues[_0x5d221f[_0x4967('0x4c')]][_0x4967('0x4d')]=0x1;queues[_0x5d221f[_0x4967('0x3e')]]=_[_0x4967('0x4e')](queues[_0x5d221f[_0x4967('0x4c')]]);queues[_0x5d221f['transfereeuniqueid']][_0x4967('0xc')]=_0x5d221f[_0x4967('0x4f')];queues[_0x5d221f[_0x4967('0x3e')]][_0x4967('0x4d')]=0x2;queues[_0x5d221f[_0x4967('0x3e')]]['calleridnum']=queues[_0x5d221f[_0x4967('0x48')]][_0x4967('0x5')];queues[_0x5d221f[_0x4967('0x3e')]][_0x4967('0x50')]=queues[_0x5d221f[_0x4967('0x48')]]['calleridname'];queues[_0x5d221f[_0x4967('0x3e')]][_0x4967('0x51')]=utils[_0x4967('0x1a')]();queues[_0x5d221f[_0x4967('0x3e')]]['queuecallerleaveAt']=utils[_0x4967('0x1a')]();queues[_0x5d221f[_0x4967('0x3e')]][_0x4967('0x2f')]=0x0;queues[_0x5d221f[_0x4967('0x3e')]]['mohtime']=0x0;utils[_0x4967('0x0')](util[_0x4967('0xe')](_0x4967('0x52'),_0x5d221f[_0x4967('0x46')],queues[_0x5d221f['transfereeuniqueid']]['name'],queues[_0x5d221f[_0x4967('0x3e')]]['calleridnum'],queues[_0x5d221f['transfereeuniqueid']][_0x4967('0x50')]));}else{utils[_0x4967('0x0')](util[_0x4967('0xe')](_0x4967('0x53'),_0x5d221f['origtransfereruniqueid'],queues[_0x5d221f[_0x4967('0x47')]][_0x4967('0x1c')],_0x5d221f[_0x4967('0x48')]));queues[_0x5d221f[_0x4967('0x47')]][_0x4967('0xc')]=_0x5d221f[_0x4967('0x48')];}}}else if(_0x5d221f[_0x4967('0x54')]==_0x5d221f[_0x4967('0x48')]){if(!_['isNil'](queues[_0x5d221f[_0x4967('0x47')]])){utils[_0x4967('0x0')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x5d221f[_0x4967('0x46')],queues[_0x5d221f['origtransfererlinkedid']][_0x4967('0x1c')],_0x5d221f['secondtransfereruniqueid'],_0x5d221f[_0x4967('0x55')]));queues[_0x5d221f['origtransfererlinkedid']]['transfer']=!![];queues[_0x5d221f['origtransfererlinkedid']][_0x4967('0x4a')]=_0x4967('0x4b');queues[_0x5d221f[_0x4967('0x47')]][_0x4967('0x40')]=_0x5d221f[_0x4967('0x55')];queues[_0x5d221f['origtransfererlinkedid']]['transferuniqueid']=_0x5d221f['secondtransfereruniqueid'];queues[_0x5d221f[_0x4967('0x47')]][_0x4967('0x7')]='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x5d221f[_0x4967('0x48')]])){if(_0x5d221f[_0x4967('0x56')]&&queues[_0x5d221f[_0x4967('0x56')]]){queues[_0x5d221f['transfertargetlinkedid']][_0x4967('0x4d')]=0x1;queues[_0x5d221f['transfertargetuniqueid']]=_[_0x4967('0x4e')](queues[_0x5d221f[_0x4967('0x56')]]);queues[_0x5d221f[_0x4967('0x4f')]][_0x4967('0xc')]=_0x5d221f[_0x4967('0x4f')];queues[_0x5d221f[_0x4967('0x4f')]][_0x4967('0x4d')]=0x2;queues[_0x5d221f[_0x4967('0x4f')]][_0x4967('0x5')]=queues[_0x5d221f['origtransfererlinkedid']]['calleridnum'];queues[_0x5d221f[_0x4967('0x4f')]]['calleridname']=queues[_0x5d221f[_0x4967('0x47')]][_0x4967('0x50')];queues[_0x5d221f['transfertargetuniqueid']][_0x4967('0x51')]=utils['now']();queues[_0x5d221f[_0x4967('0x4f')]][_0x4967('0x16')]=utils[_0x4967('0x1a')]();queues[_0x5d221f[_0x4967('0x4f')]][_0x4967('0x2f')]=0x0;queues[_0x5d221f[_0x4967('0x4f')]][_0x4967('0x57')]=0x0;utils['info'](util['format'](_0x4967('0x58'),_0x5d221f['origtransfereruniqueid'],queues[_0x5d221f['transfertargetuniqueid']][_0x4967('0x1c')],queues[_0x5d221f['transfertargetuniqueid']]['transfereduniqueid'],queues[_0x5d221f['transfertargetuniqueid']]['calleridnum'],queues[_0x5d221f[_0x4967('0x4f')]]['calleridname']));}else{utils[_0x4967('0x0')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x5d221f[_0x4967('0x46')],queues[_0x5d221f[_0x4967('0x48')]][_0x4967('0x1c')],_0x5d221f['origtransfererlinkedid']));queues[_0x5d221f[_0x4967('0x48')]][_0x4967('0xc')]=_0x5d221f['origtransfererlinkedid'];}}}}catch(_0x4754c5){utils[_0x4967('0x13')](util[_0x4967('0xe')]('[%s][queues][attendedtransfer]',_0x5d221f[_0x4967('0x46')]),_0x4754c5);}};exports[_0x4967('0x59')]=function(_0x33f5ec){try{if(!_[_0x4967('0x14')](queues[_0x33f5ec[_0x4967('0x2')]])){utils[_0x4967('0x1e')](util[_0x4967('0xe')]('[%s][queues][musiconholdstart]',_0x33f5ec[_0x4967('0x2')]),_0x33f5ec);queues[_0x33f5ec[_0x4967('0x2')]][_0x4967('0x5a')]=utils['now']();utils[_0x4967('0x0')](util[_0x4967('0xe')](_0x4967('0x5b'),_0x33f5ec[_0x4967('0x2')],queues[_0x33f5ec[_0x4967('0x2')]][_0x4967('0x1c')],queues[_0x33f5ec['uniqueid']][_0x4967('0x5a')]));}}catch(_0x16686f){utils['error'](util[_0x4967('0xe')](_0x4967('0x5c'),_0x33f5ec['uniqueid']),_0x16686f);}};exports[_0x4967('0x5d')]=function(_0xcc5d22){try{if(!_[_0x4967('0x14')](queues[_0xcc5d22[_0x4967('0x2')]])){if(!_['isNil'](queues[_0xcc5d22['uniqueid']][_0x4967('0x5a')])){utils[_0x4967('0x1e')](util['format'](_0x4967('0x5e'),_0xcc5d22[_0x4967('0x2')]),_0xcc5d22);queues[_0xcc5d22['uniqueid']]['mohtime']+=utils['diffTime'](utils[_0x4967('0x1a')](),queues[_0xcc5d22[_0x4967('0x2')]]['musiconholdstartAt']);utils[_0x4967('0x0')](util['format'](_0x4967('0x5f'),_0xcc5d22[_0x4967('0x2')],queues[_0xcc5d22[_0x4967('0x2')]][_0x4967('0x1c')],queues[_0xcc5d22[_0x4967('0x2')]][_0x4967('0x57')]));delete queues[_0xcc5d22[_0x4967('0x2')]]['musiconholdstartAt'];}}}catch(_0x403c3a){utils['error'](util[_0x4967('0xe')]('[%s][queues][musiconholdstop]',_0xcc5d22['uniqueid']),_0x403c3a);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 6e89a60..79db981 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 _0x72bf=['calleridname','cause-txt','connectedlinenum','type','outbound','forEach','clone','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','name','UserId','CreateVoiceRecording','request','newchannel','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','debug','channelstate','isNil','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','[%s][recordings][newstate]','varset','variable','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','replace','.wav49','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum'];(function(_0x519bea,_0x406ee5){var _0x5ccfe4=function(_0x55e911){while(--_0x55e911){_0x519bea['push'](_0x519bea['shift']());}};_0x5ccfe4(++_0x406ee5);}(_0x72bf,0xd9));var _0xf72b=function(_0x486f9d,_0x39f950){_0x486f9d=_0x486f9d-0x0;var _0x2128e9=_0x72bf[_0x486f9d];return _0x2128e9;};'use strict';var _=require(_0xf72b('0x0'));var util=require(_0xf72b('0x1'));var utils=require(_0xf72b('0x2'));var recordings={};function writeDB(_0x539a49){utils[_0xf72b('0x3')](util[_0xf72b('0x4')](_0xf72b('0x5'),_0x539a49[_0xf72b('0x6')]));if(_0x539a49[_0xf72b('0x7')]){utils[_0xf72b('0x8')](_0x539a49[_0xf72b('0x7')])['then'](function(_0x23008f){if(_0x23008f){_0x539a49['membername']=_0x23008f[_0xf72b('0x9')];_0x539a49[_0xf72b('0xa')]=_0x23008f['id'];}utils['request'](_0xf72b('0xb'),_0x539a49);});}else{utils[_0xf72b('0xc')](_0xf72b('0xb'),_0x539a49);}}exports[_0xf72b('0xd')]=function(_0x4ac7fa){try{utils['debug'](util[_0xf72b('0x4')](_0xf72b('0xe'),_0x4ac7fa[_0xf72b('0x6')]),_0x4ac7fa);if(_0x4ac7fa[_0xf72b('0x6')]==_0x4ac7fa[_0xf72b('0xf')]){utils['info'](util[_0xf72b('0x4')](_0xf72b('0x10'),_0x4ac7fa['uniqueid'],_0x4ac7fa[_0xf72b('0x11')],_0x4ac7fa[_0xf72b('0x12')]));recordings[_0x4ac7fa['uniqueid']]={'uniqueid':_0x4ac7fa['uniqueid'],'accountcode':_0x4ac7fa[_0xf72b('0x7')],'exten':_0x4ac7fa[_0xf72b('0x12')],'context':_0x4ac7fa['context'],'channel':_0x4ac7fa[_0xf72b('0x13')],'monitors':[]};}}catch(_0x5a489e){utils[_0xf72b('0x14')](util[_0xf72b('0x4')](_0xf72b('0xe'),_0x4ac7fa[_0xf72b('0x6')]),_0x5a489e);}};exports[_0xf72b('0x15')]=function(_0x17ea93){try{utils[_0xf72b('0x16')](util['format']('[%s][recordings][newstate]',_0x17ea93[_0xf72b('0x6')]),_0x17ea93);if(!_['isNil'](recordings[_0x17ea93[_0xf72b('0x6')]])&&_0x17ea93[_0xf72b('0x17')]==0x6){utils[_0xf72b('0x3')](util[_0xf72b('0x4')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x17ea93[_0xf72b('0x6')],_0x17ea93[_0xf72b('0x11')],_0x17ea93[_0xf72b('0x13')]));}else if(!_[_0xf72b('0x18')](recordings[_0x17ea93[_0xf72b('0xf')]])&&_0x17ea93[_0xf72b('0x17')]==0x6&&_0x17ea93['context']!=_0xf72b('0x19')){utils[_0xf72b('0x3')](util[_0xf72b('0x4')](_0xf72b('0x1a'),_0x17ea93['uniqueid'],_0x17ea93['linkedid'],_0x17ea93[_0xf72b('0x11')],_0x17ea93[_0xf72b('0x13')]));recordings[_0x17ea93[_0xf72b('0xf')]][_0xf72b('0x7')]=_0x17ea93[_0xf72b('0x7')];}}catch(_0x2de40b){utils[_0xf72b('0x14')](util[_0xf72b('0x4')](_0xf72b('0x1b'),_0x17ea93[_0xf72b('0x6')]),_0x2de40b);}};exports[_0xf72b('0x1c')]=function(_0x3fc69){try{if(!_[_0xf72b('0x18')](_0x3fc69[_0xf72b('0x1d')])&&!_[_0xf72b('0x18')](_0x3fc69[_0xf72b('0x1d')]['mixmonitor_filename'])){utils['debug'](util[_0xf72b('0x4')](_0xf72b('0x1e'),_0x3fc69['uniqueid']),_0x3fc69);utils[_0xf72b('0x3')](util[_0xf72b('0x4')](_0xf72b('0x1f'),_0x3fc69['uniqueid'],_0x3fc69[_0xf72b('0x1d')],_0x3fc69['value']));if(_['endsWith'](_0x3fc69[_0xf72b('0x20')],'.wav49')){_0x3fc69[_0xf72b('0x20')]=_0x3fc69[_0xf72b('0x20')][_0xf72b('0x21')](_0xf72b('0x22'),_0xf72b('0x23'));}if(recordings[_0x3fc69[_0xf72b('0xf')]]){var _0x31aa8c=_[_0xf72b('0x24')](recordings[_0x3fc69[_0xf72b('0xf')]][_0xf72b('0x25')],{'value':_0x3fc69[_0xf72b('0x20')]});if(_['isNil'](_0x31aa8c)){recordings[_0x3fc69[_0xf72b('0xf')]][_0xf72b('0x25')][_0xf72b('0x26')]({'value':_0x3fc69['value']});}}}}catch(_0x462d77){utils[_0xf72b('0x14')](util['format'](_0xf72b('0x1e'),_0x3fc69[_0xf72b('0x6')]),_0x462d77);}};exports[_0xf72b('0x27')]=function(_0x466332){try{if(!_['isNil'](recordings[_0x466332[_0xf72b('0x6')]])){utils[_0xf72b('0x16')](util[_0xf72b('0x4')](_0xf72b('0x28'),_0x466332[_0xf72b('0x6')]),_0x466332);utils[_0xf72b('0x3')](util['format'](_0xf72b('0x29'),_0x466332['uniqueid'],_0x466332[_0xf72b('0x2a')],_0x466332[_0xf72b('0x2b')],_0x466332[_0xf72b('0x2c')]));recordings[_0x466332[_0xf72b('0x6')]]['calleridnum']=_0x466332[_0xf72b('0x2a')];recordings[_0x466332[_0xf72b('0x6')]][_0xf72b('0x2b')]=_0x466332[_0xf72b('0x2b')];recordings[_0x466332[_0xf72b('0x6')]][_0xf72b('0x2d')]=_0x466332[_0xf72b('0x2d')];recordings[_0x466332[_0xf72b('0x6')]]['connectedlinename']=_0x466332['connectedlinename'];if(recordings[_0x466332['uniqueid']][_0xf72b('0x2e')]==_0xf72b('0x2f')&&recordings[_0x466332[_0xf72b('0x6')]]['accountcode']){recordings[_0x466332[_0xf72b('0x6')]][_0xf72b('0x2d')]=recordings[_0x466332[_0xf72b('0x6')]][_0xf72b('0x7')];recordings[_0x466332['uniqueid']]['connectedlinename']='';}recordings[_0x466332[_0xf72b('0x6')]][_0xf72b('0x25')][_0xf72b('0x30')](function(_0x46aaa9){var _0x550ac4=_[_0xf72b('0x31')](recordings[_0x466332[_0xf72b('0x6')]]);_0x550ac4[_0xf72b('0x20')]=_0x46aaa9[_0xf72b('0x20')];writeDB(_0x550ac4);});delete recordings[_0x466332[_0xf72b('0x6')]];}}catch(_0x44089d){utils[_0xf72b('0x14')](util[_0xf72b('0x4')]('[%s][recordings][hangup]',_0x466332[_0xf72b('0x6')]),_0x44089d);}};exports['newexten']=function(_0x3561c1){try{if(!_[_0xf72b('0x18')](recordings[_0x3561c1['uniqueid']])){utils[_0xf72b('0x16')](util['format'](_0xf72b('0x32'),_0x3561c1[_0xf72b('0x6')]),_0x3561c1);utils[_0xf72b('0x3')](util['format'](_0xf72b('0x33'),_0x3561c1['uniqueid'],_0x3561c1[_0xf72b('0x34')],_0x3561c1[_0xf72b('0x35')]));if(_0x3561c1['application']['toLowerCase']()==_0xf72b('0x36')&&_[_0xf72b('0x37')](_0x3561c1[_0xf72b('0x35')][_0xf72b('0x38')](),_0xf72b('0x39'))){var _0x3d67d9=_0x3561c1[_0xf72b('0x35')][_0xf72b('0x3a')]('=');var _0x4d348f=_0x3d67d9[0x0][_0xf72b('0x3b')](_0x3d67d9[0x0][_0xf72b('0x3c')]('(')+0x1,_0x3d67d9[0x0][_0xf72b('0x3c')](')'));var _0x5845c3=_0x3d67d9[0x1];recordings[_0x3561c1[_0xf72b('0x6')]][_0x4d348f]=_0x5845c3;}}}catch(_0x5c848b){utils[_0xf72b('0x14')](util[_0xf72b('0x4')]('[%s][recordings][newexten]',_0x3561c1[_0xf72b('0x6')]),_0x5c848b);}};exports[_0xf72b('0x3d')]=function(_0xa70d09){try{if(!_[_0xf72b('0x18')](recordings[_0xa70d09['uniqueid']])){utils[_0xf72b('0x16')](util[_0xf72b('0x4')](_0xf72b('0x3e'),_0xa70d09[_0xf72b('0x6')]),_0xa70d09);utils[_0xf72b('0x3')](util[_0xf72b('0x4')](_0xf72b('0x3f'),_0xa70d09[_0xf72b('0x6')],_0xa70d09[_0xf72b('0x40')]));recordings[_0xa70d09[_0xf72b('0x6')]][_0xf72b('0x40')]=_0xa70d09[_0xf72b('0x40')];}}catch(_0x62f3ef){utils[_0xf72b('0x14')](util['format'](_0xf72b('0x3e'),_0xa70d09[_0xf72b('0x6')]),_0x62f3ef);}}; \ No newline at end of file +var _0xc76d=['[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','.WAV','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinenum','connectedlinename','type','monitors','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','cdr','split','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','[%s][recordings][writeDB]','accountcode','getUserByInternal','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','uniqueid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','[%s][recordings][newchannel]','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','linkedid','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','varset','variable'];(function(_0x38fe7b,_0x3ad5ec){var _0x259778=function(_0x3d9e2f){while(--_0x3d9e2f){_0x38fe7b['push'](_0x38fe7b['shift']());}};_0x259778(++_0x3ad5ec);}(_0xc76d,0x10d));var _0xdc76=function(_0x364471,_0x302e8a){_0x364471=_0x364471-0x0;var _0x59236f=_0xc76d[_0x364471];return _0x59236f;};'use strict';var _=require(_0xdc76('0x0'));var util=require(_0xdc76('0x1'));var utils=require(_0xdc76('0x2'));var recordings={};function writeDB(_0x5d9b10){utils[_0xdc76('0x3')](util[_0xdc76('0x4')](_0xdc76('0x5'),_0x5d9b10['uniqueid']));if(_0x5d9b10[_0xdc76('0x6')]){utils[_0xdc76('0x7')](_0x5d9b10[_0xdc76('0x6')])['then'](function(_0x13659c){if(_0x13659c){_0x5d9b10[_0xdc76('0x8')]=_0x13659c[_0xdc76('0x9')];_0x5d9b10[_0xdc76('0xa')]=_0x13659c['id'];}utils['request']('CreateVoiceRecording',_0x5d9b10);});}else{utils[_0xdc76('0xb')](_0xdc76('0xc'),_0x5d9b10);}}exports[_0xdc76('0xd')]=function(_0x3c9961){try{utils[_0xdc76('0xe')](util[_0xdc76('0x4')]('[%s][recordings][newchannel]',_0x3c9961[_0xdc76('0xf')]),_0x3c9961);if(_0x3c9961['uniqueid']==_0x3c9961['linkedid']){utils['info'](util[_0xdc76('0x4')](_0xdc76('0x10'),_0x3c9961[_0xdc76('0xf')],_0x3c9961[_0xdc76('0x11')],_0x3c9961[_0xdc76('0x12')]));recordings[_0x3c9961[_0xdc76('0xf')]]={'uniqueid':_0x3c9961[_0xdc76('0xf')],'accountcode':_0x3c9961[_0xdc76('0x6')],'exten':_0x3c9961[_0xdc76('0x12')],'context':_0x3c9961['context'],'channel':_0x3c9961[_0xdc76('0x13')],'monitors':[]};}}catch(_0x2375cf){utils['error'](util[_0xdc76('0x4')](_0xdc76('0x14'),_0x3c9961['uniqueid']),_0x2375cf);}};exports[_0xdc76('0x15')]=function(_0x3161e1){try{utils['debug'](util[_0xdc76('0x4')](_0xdc76('0x16'),_0x3161e1[_0xdc76('0xf')]),_0x3161e1);if(!_[_0xdc76('0x17')](recordings[_0x3161e1[_0xdc76('0xf')]])&&_0x3161e1[_0xdc76('0x18')]==0x6){utils['info'](util[_0xdc76('0x4')](_0xdc76('0x19'),_0x3161e1['uniqueid'],_0x3161e1[_0xdc76('0x11')],_0x3161e1[_0xdc76('0x13')]));}else if(!_['isNil'](recordings[_0x3161e1[_0xdc76('0x1a')]])&&_0x3161e1['channelstate']==0x6&&_0x3161e1[_0xdc76('0x11')]!='transfer'){utils['info'](util[_0xdc76('0x4')](_0xdc76('0x1b'),_0x3161e1[_0xdc76('0xf')],_0x3161e1[_0xdc76('0x1a')],_0x3161e1[_0xdc76('0x11')],_0x3161e1[_0xdc76('0x13')]));recordings[_0x3161e1[_0xdc76('0x1a')]][_0xdc76('0x6')]=_0x3161e1[_0xdc76('0x6')];}}catch(_0x36de22){utils[_0xdc76('0x1c')](util[_0xdc76('0x4')](_0xdc76('0x16'),_0x3161e1[_0xdc76('0xf')]),_0x36de22);}};exports[_0xdc76('0x1d')]=function(_0x17232e){try{if(!_[_0xdc76('0x17')](_0x17232e[_0xdc76('0x1e')])&&!_[_0xdc76('0x17')](_0x17232e[_0xdc76('0x1e')]['mixmonitor_filename'])){utils[_0xdc76('0xe')](util[_0xdc76('0x4')]('[%s][recordings][varset]',_0x17232e['uniqueid']),_0x17232e);utils[_0xdc76('0x3')](util['format'](_0xdc76('0x1f'),_0x17232e[_0xdc76('0xf')],_0x17232e[_0xdc76('0x1e')],_0x17232e[_0xdc76('0x20')]));if(_['endsWith'](_0x17232e['value'],_0xdc76('0x21'))){_0x17232e[_0xdc76('0x20')]=_0x17232e['value']['replace'](_0xdc76('0x21'),_0xdc76('0x22'));}if(recordings[_0x17232e[_0xdc76('0x1a')]]){var _0x54d38e=_['find'](recordings[_0x17232e['linkedid']]['monitors'],{'value':_0x17232e[_0xdc76('0x20')]});if(_['isNil'](_0x54d38e)){recordings[_0x17232e[_0xdc76('0x1a')]]['monitors'][_0xdc76('0x23')]({'value':_0x17232e[_0xdc76('0x20')]});}}}}catch(_0x73d2d7){utils[_0xdc76('0x1c')](util[_0xdc76('0x4')]('[%s][recordings][varset]',_0x17232e[_0xdc76('0xf')]),_0x73d2d7);}};exports[_0xdc76('0x24')]=function(_0x3e8317){try{if(!_[_0xdc76('0x17')](recordings[_0x3e8317['uniqueid']])){utils['debug'](util[_0xdc76('0x4')](_0xdc76('0x25'),_0x3e8317[_0xdc76('0xf')]),_0x3e8317);utils[_0xdc76('0x3')](util[_0xdc76('0x4')](_0xdc76('0x26'),_0x3e8317[_0xdc76('0xf')],_0x3e8317[_0xdc76('0x27')],_0x3e8317['calleridname'],_0x3e8317['cause-txt']));recordings[_0x3e8317[_0xdc76('0xf')]][_0xdc76('0x27')]=_0x3e8317[_0xdc76('0x27')];recordings[_0x3e8317[_0xdc76('0xf')]][_0xdc76('0x28')]=_0x3e8317[_0xdc76('0x28')];recordings[_0x3e8317[_0xdc76('0xf')]][_0xdc76('0x29')]=_0x3e8317[_0xdc76('0x29')];recordings[_0x3e8317[_0xdc76('0xf')]]['connectedlinename']=_0x3e8317[_0xdc76('0x2a')];if(recordings[_0x3e8317[_0xdc76('0xf')]][_0xdc76('0x2b')]=='outbound'&&recordings[_0x3e8317['uniqueid']][_0xdc76('0x6')]){recordings[_0x3e8317[_0xdc76('0xf')]][_0xdc76('0x29')]=recordings[_0x3e8317[_0xdc76('0xf')]][_0xdc76('0x6')];recordings[_0x3e8317[_0xdc76('0xf')]]['connectedlinename']='';}recordings[_0x3e8317['uniqueid']][_0xdc76('0x2c')][_0xdc76('0x2d')](function(_0x15a68){var _0x1d91ce=_[_0xdc76('0x2e')](recordings[_0x3e8317[_0xdc76('0xf')]]);_0x1d91ce[_0xdc76('0x20')]=_0x15a68[_0xdc76('0x20')];writeDB(_0x1d91ce);});delete recordings[_0x3e8317[_0xdc76('0xf')]];}}catch(_0x342716){utils[_0xdc76('0x1c')](util[_0xdc76('0x4')](_0xdc76('0x25'),_0x3e8317[_0xdc76('0xf')]),_0x342716);}};exports[_0xdc76('0x2f')]=function(_0x12221d){try{if(!_[_0xdc76('0x17')](recordings[_0x12221d[_0xdc76('0xf')]])){utils[_0xdc76('0xe')](util[_0xdc76('0x4')](_0xdc76('0x30'),_0x12221d[_0xdc76('0xf')]),_0x12221d);utils[_0xdc76('0x3')](util[_0xdc76('0x4')](_0xdc76('0x31'),_0x12221d[_0xdc76('0xf')],_0x12221d[_0xdc76('0x32')],_0x12221d[_0xdc76('0x33')]));if(_0x12221d[_0xdc76('0x32')]['toLowerCase']()=='set'&&_['startsWith'](_0x12221d[_0xdc76('0x33')][_0xdc76('0x34')](),_0xdc76('0x35'))){var _0x5c22bf=_0x12221d['appdata'][_0xdc76('0x36')]('=');var _0x3c0877=_0x5c22bf[0x0]['substring'](_0x5c22bf[0x0][_0xdc76('0x37')]('(')+0x1,_0x5c22bf[0x0][_0xdc76('0x37')](')'));var _0x216624=_0x5c22bf[0x1];recordings[_0x12221d[_0xdc76('0xf')]][_0x3c0877]=_0x216624;}}}catch(_0x53efbe){utils['error'](util[_0xdc76('0x4')](_0xdc76('0x30'),_0x12221d[_0xdc76('0xf')]),_0x53efbe);}};exports[_0xdc76('0x38')]=function(_0x66deba){try{if(!_[_0xdc76('0x17')](recordings[_0x66deba[_0xdc76('0xf')]])){utils[_0xdc76('0xe')](util[_0xdc76('0x4')](_0xdc76('0x39'),_0x66deba[_0xdc76('0xf')]),_0x66deba);utils[_0xdc76('0x3')](util[_0xdc76('0x4')](_0xdc76('0x3a'),_0x66deba[_0xdc76('0xf')],_0x66deba[_0xdc76('0x3b')]));recordings[_0x66deba[_0xdc76('0xf')]][_0xdc76('0x3b')]=_0x66deba[_0xdc76('0x3b')];}}catch(_0x58d1b1){utils[_0xdc76('0x1c')](util[_0xdc76('0x4')](_0xdc76('0x39'),_0x66deba[_0xdc76('0xf')]),_0x58d1b1);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index ba03886..dda2fb9 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 _0xdf43=['[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','assign','secondtransfererconnectedlinenum','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','blinds','debug','[%s][transfers][blindtransfer]','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]'];(function(_0x5e8e80,_0x50079a){var _0x126d56=function(_0x53b198){while(--_0x53b198){_0x5e8e80['push'](_0x5e8e80['shift']());}};_0x126d56(++_0x50079a);}(_0xdf43,0x123));var _0x3df4=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0xdf43[_0x11c573];return _0x6b72de;};'use strict';var _=require(_0x3df4('0x0'));var util=require(_0x3df4('0x1'));var utils=require(_0x3df4('0x2'));function writeDB(_0x434ca2){utils['info'](util[_0x3df4('0x3')](_0x3df4('0x4'),_0x434ca2[_0x3df4('0x5')]===_0x3df4('0x6')?_0x434ca2[_0x3df4('0x7')]:_0x434ca2[_0x3df4('0x8')],_0x434ca2['type']));utils[_0x3df4('0x9')]('CreateVoiceTransferReport',_0x434ca2);}exports[_0x3df4('0xa')]={};exports['blindtransfer']=function(_0x4f243f){try{utils[_0x3df4('0xb')](util[_0x3df4('0x3')](_0x3df4('0xc'),_0x4f243f[_0x3df4('0x8')]),_0x4f243f);utils[_0x3df4('0xd')](util[_0x3df4('0x3')](_0x3df4('0xe'),_0x4f243f[_0x3df4('0x8')],_0x4f243f[_0x3df4('0xf')],_0x4f243f['transferercalleridname'],_0x4f243f[_0x3df4('0x10')],_0x4f243f['transfereecalleridname']));_0x4f243f[_0x3df4('0x5')]=_0x3df4('0x11');exports['blinds'][_0x4f243f['transfereruniqueid']]=_0x4f243f;writeDB(_0x4f243f);}catch(_0x871a26){utils[_0x3df4('0x12')](util['format'](_0x3df4('0xc'),_0x4f243f[_0x3df4('0x8')]),_0x871a26);}};exports[_0x3df4('0x13')]=function(_0x96f51d){try{utils[_0x3df4('0xb')](util[_0x3df4('0x3')](_0x3df4('0x14'),_0x96f51d[_0x3df4('0x7')]),_0x96f51d);utils[_0x3df4('0xd')](util[_0x3df4('0x3')](_0x3df4('0x15'),_0x96f51d[_0x3df4('0x7')],_0x96f51d['origtransferercalleridnum'],_0x96f51d[_0x3df4('0x16')],_0x96f51d[_0x3df4('0x17')],_0x96f51d['transfertargetcalleridname']));_0x96f51d=_[_0x3df4('0x18')](_0x96f51d,{'transfererchannel':_0x96f51d['origtransfererchannel'],'transferercalleridnum':_0x96f51d['origtransferercalleridnum'],'transferercalleridname':_0x96f51d[_0x3df4('0x16')],'transfererconnectedlinenum':_0x96f51d[_0x3df4('0x19')],'transfererconnectedlinename':_0x96f51d['secondtransfererconnectedlinename'],'transfereraccountcode':_0x96f51d['origtransfereraccountcode'],'transferercontext':_0x96f51d[_0x3df4('0x1a')],'transfererexten':_0x96f51d[_0x3df4('0x1b')],'transfererlinkedid':_0x96f51d[_0x3df4('0x1c')],'context':_0x96f51d[_0x3df4('0x1d')],'extension':_0x96f51d['origtransfererexten'],'type':_0x3df4('0x6')});if(_[_0x3df4('0x1e')](_0x96f51d[_0x3df4('0x1f')])){_0x96f51d=_['assign'](_0x96f51d,{'transfereechannel':_0x96f51d[_0x3df4('0x20')],'transfereecalleridnum':_0x96f51d['transfertargetcalleridnum'],'transfereecalleridname':_0x96f51d[_0x3df4('0x21')],'transfereeconnectedlinenum':_0x96f51d[_0x3df4('0x22')],'transfereeconnectedlinename':_0x96f51d['transfertargetconnectedlinename'],'transfereeaccountcode':_0x96f51d[_0x3df4('0x23')],'transfereecontext':_0x96f51d[_0x3df4('0x24')],'transfereeexten':_0x96f51d[_0x3df4('0x25')],'transfereelinkedid':_0x96f51d[_0x3df4('0x26')]});}writeDB(_0x96f51d);}catch(_0x17bafd){utils[_0x3df4('0x12')](util[_0x3df4('0x3')](_0x3df4('0x14'),_0x96f51d['origtransfereruniqueid']),_0x17bafd);}}; \ No newline at end of file +var _0x3fe1=['[%s][transfers][attendedtransfer]','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridname','transfereruniqueid','error','attendedtransfer','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridname','assign','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','origtransfererlinkedid','origtransfererexten','isNil','transfereechannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid'];(function(_0x27c678,_0x5f19ed){var _0x492e5c=function(_0x479e31){while(--_0x479e31){_0x27c678['push'](_0x27c678['shift']());}};_0x492e5c(++_0x5f19ed);}(_0x3fe1,0x1a5));var _0x13fe=function(_0x111347,_0x4c88a4){_0x111347=_0x111347-0x0;var _0x4f8902=_0x3fe1[_0x111347];return _0x4f8902;};'use strict';var _=require(_0x13fe('0x0'));var util=require(_0x13fe('0x1'));var utils=require(_0x13fe('0x2'));function writeDB(_0x18bf85){utils[_0x13fe('0x3')](util[_0x13fe('0x4')](_0x13fe('0x5'),_0x18bf85[_0x13fe('0x6')]===_0x13fe('0x7')?_0x18bf85[_0x13fe('0x8')]:_0x18bf85[_0x13fe('0x9')],_0x18bf85[_0x13fe('0x6')]));utils[_0x13fe('0xa')](_0x13fe('0xb'),_0x18bf85);}exports[_0x13fe('0xc')]={};exports[_0x13fe('0xd')]=function(_0x5323b0){try{utils[_0x13fe('0xe')](util[_0x13fe('0x4')](_0x13fe('0xf'),_0x5323b0[_0x13fe('0x9')]),_0x5323b0);utils[_0x13fe('0x3')](util[_0x13fe('0x4')](_0x13fe('0x10'),_0x5323b0['uniqueid'],_0x5323b0['transferercalleridnum'],_0x5323b0[_0x13fe('0x11')],_0x5323b0['transfereecalleridnum'],_0x5323b0[_0x13fe('0x12')]));_0x5323b0[_0x13fe('0x6')]='blind';exports['blinds'][_0x5323b0[_0x13fe('0x13')]]=_0x5323b0;writeDB(_0x5323b0);}catch(_0x414149){utils[_0x13fe('0x14')](util[_0x13fe('0x4')]('[%s][transfers][blindtransfer]',_0x5323b0[_0x13fe('0x9')]),_0x414149);}};exports[_0x13fe('0x15')]=function(_0x2b8138){try{utils[_0x13fe('0xe')](util[_0x13fe('0x4')]('[%s][transfers][attendedtransfer]',_0x2b8138[_0x13fe('0x8')]),_0x2b8138);utils[_0x13fe('0x3')](util[_0x13fe('0x4')](_0x13fe('0x16'),_0x2b8138[_0x13fe('0x8')],_0x2b8138['origtransferercalleridnum'],_0x2b8138[_0x13fe('0x17')],_0x2b8138['transfertargetcalleridnum'],_0x2b8138[_0x13fe('0x18')]));_0x2b8138=_[_0x13fe('0x19')](_0x2b8138,{'transfererchannel':_0x2b8138['origtransfererchannel'],'transferercalleridnum':_0x2b8138[_0x13fe('0x1a')],'transferercalleridname':_0x2b8138[_0x13fe('0x17')],'transfererconnectedlinenum':_0x2b8138[_0x13fe('0x1b')],'transfererconnectedlinename':_0x2b8138[_0x13fe('0x1c')],'transfereraccountcode':_0x2b8138[_0x13fe('0x1d')],'transferercontext':_0x2b8138['secondtransferercontext'],'transfererexten':_0x2b8138['secondtransfererexten'],'transfererlinkedid':_0x2b8138[_0x13fe('0x1e')],'context':_0x2b8138['origtransferercontext'],'extension':_0x2b8138[_0x13fe('0x1f')],'type':_0x13fe('0x7')});if(_[_0x13fe('0x20')](_0x2b8138[_0x13fe('0x21')])){_0x2b8138=_[_0x13fe('0x19')](_0x2b8138,{'transfereechannel':_0x2b8138['transfertargetchannel'],'transfereecalleridnum':_0x2b8138[_0x13fe('0x22')],'transfereecalleridname':_0x2b8138[_0x13fe('0x18')],'transfereeconnectedlinenum':_0x2b8138[_0x13fe('0x23')],'transfereeconnectedlinename':_0x2b8138[_0x13fe('0x24')],'transfereeaccountcode':_0x2b8138[_0x13fe('0x25')],'transfereecontext':_0x2b8138[_0x13fe('0x26')],'transfereeexten':_0x2b8138[_0x13fe('0x27')],'transfereelinkedid':_0x2b8138[_0x13fe('0x28')]});}writeDB(_0x2b8138);}catch(_0x42c05b){utils['error'](util[_0x13fe('0x4')](_0x13fe('0x29'),_0x2b8138[_0x13fe('0x8')]),_0x42c05b);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index f32aca9..38a885a 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 _0xed3e=['interface','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','catch','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtract','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','http','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','GetUser','internal','name'];(function(_0x1399d6,_0x2c1661){var _0x4a9db4=function(_0x4666b8){while(--_0x4666b8){_0x1399d6['push'](_0x1399d6['shift']());}};_0x4a9db4(++_0x2c1661);}(_0xed3e,0x101));var _0xeed3=function(_0x18707c,_0x3192b6){_0x18707c=_0x18707c-0x0;var _0x208805=_0xed3e[_0x18707c];return _0x208805;};'use strict';var BPromise=require(_0xeed3('0x0'));var jayson=require(_0xeed3('0x1'));var moment=require('moment');var util=require('util');var client=jayson['client'][_0xeed3('0x2')]({'port':0x2329});var logger=require('../../config/logger')('xdr');exports[_0xeed3('0x3')]=function(_0x25564c,_0x254f35){logger[_0xeed3('0x3')](_0x25564c,_0x254f35?util[_0xeed3('0x4')](_0x254f35,{'showHidden':![],'depth':null}):'');};exports[_0xeed3('0x5')]=function(_0x1f81e6,_0x1be1f5){logger[_0xeed3('0x5')](_0x1f81e6,_0x1be1f5?util[_0xeed3('0x4')](_0x1be1f5,{'showHidden':![],'depth':null}):'');};exports[_0xeed3('0x6')]=function(_0x168084,_0xa2ba33){logger[_0xeed3('0x6')](_0x168084,_0xa2ba33?util[_0xeed3('0x4')](_0xa2ba33,{'showHidden':![],'depth':null}):'');};exports[_0xeed3('0x7')]=function(_0x5b80bd,_0x1d66d4){return client[_0xeed3('0x7')](_0x5b80bd,{'body':_0x1d66d4})[_0xeed3('0x8')](function(_0x3a487b){logger[_0xeed3('0x5')]('[utils][request]\x20name:%s',_0x5b80bd,_0x3a487b?util[_0xeed3('0x4')](_0x3a487b,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x3ad521){logger[_0xeed3('0x6')](_0xeed3('0x9'),_0x5b80bd,_0x3ad521?util[_0xeed3('0x4')](_0x3ad521,{'showHidden':![],'depth':null}):'');});};function getUser(_0x68770c){return client[_0xeed3('0x7')](_0xeed3('0xa'),{'options':{'raw':!![],'attributes':['id',_0xeed3('0xb'),_0xeed3('0xc'),_0xeed3('0xd')],'where':_0x68770c,'limit':0x1}})[_0xeed3('0x8')](function(_0x4c7da3){logger[_0xeed3('0x5')](_0xeed3('0xe'),JSON[_0xeed3('0xf')](_0x68770c),_0x4c7da3?util['inspect'](_0x4c7da3,{'showHidden':![],'depth':null}):'');return _0x4c7da3['result'][_0xeed3('0x10')]?_0x4c7da3[_0xeed3('0x11')][0x0]:null;});}exports[_0xeed3('0x12')]=function(_0x2253a9){return new BPromise(function(_0x4753db,_0x3dd42b){if(_0x2253a9){return getUser({'internal':_0x2253a9})[_0xeed3('0x8')](function(_0x401c11){logger[_0xeed3('0x3')](_0xeed3('0x13'),_0x2253a9,_0x401c11?_0xeed3('0x14'):_0xeed3('0x15'));return _0x4753db(_0x401c11);})[_0xeed3('0x16')](function(_0x15b707){logger[_0xeed3('0x6')](_0xeed3('0x17'),_0x15b707?util[_0xeed3('0x4')](_0x15b707,{'showHidden':![],'depth':null}):'');return _0x4753db(null);});}return _0x4753db(null);});};exports[_0xeed3('0x18')]=function(_0x2937b0){return new BPromise(function(_0x3c7493,_0x27d31a){if(_0x2937b0){return getUser({'interface':_0x2937b0})['then'](function(_0x4202c1){logger['info'](_0xeed3('0x19'),_0x2937b0,_0x4202c1?'found':_0xeed3('0x15'));return _0x3c7493(_0x4202c1);})[_0xeed3('0x16')](function(_0x2c01d1){logger[_0xeed3('0x6')](_0xeed3('0x1a'),_0x2c01d1?util['inspect'](_0x2c01d1,{'showHidden':![],'depth':null}):'');return _0x3c7493(null);});}return _0x3c7493(null);});};exports['getUserByName']=function(_0x527d96){return new BPromise(function(_0x120298,_0x4d0074){if(_0x527d96){return getUser({'name':_0x527d96})[_0xeed3('0x8')](function(_0x2bad30){logger['info'](_0xeed3('0x1b'),_0x527d96,_0x2bad30?_0xeed3('0x14'):_0xeed3('0x15'));return _0x120298(_0x2bad30);})[_0xeed3('0x16')](function(_0x4299a9){logger['error'](_0xeed3('0x1c'),_0x4299a9?util['inspect'](_0x4299a9,{'showHidden':![],'depth':null}):'');return _0x120298(null);});}return _0x120298(null);});};exports['getVoiceQueueByName']=function(_0x2c855d){return new BPromise(function(_0xb737aa,_0x383254){if(_0x2c855d){return client[_0xeed3('0x7')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0xeed3('0xc'),_0xeed3('0x1d'),_0xeed3('0x1e'),_0xeed3('0x1f')],'where':{'name':_0x2c855d},'limit':0x1}})[_0xeed3('0x8')](function(_0x13e9b0){logger[_0xeed3('0x5')](_0xeed3('0x20'),_0x2c855d,_0x13e9b0?util[_0xeed3('0x4')](_0x13e9b0,{'showHidden':![],'depth':null}):'');logger[_0xeed3('0x3')](_0xeed3('0x21'),_0x2c855d,_0x13e9b0?_0xeed3('0x14'):_0xeed3('0x15'));return _0xb737aa(_0x13e9b0[_0xeed3('0x11')][_0xeed3('0x10')]?_0x13e9b0[_0xeed3('0x11')][0x0]:null);})['catch'](function(_0x309b78){logger[_0xeed3('0x6')]('[utils][getVoiceQueueByName]',_0x309b78?util['inspect'](_0x309b78,{'showHidden':![],'depth':null}):'');return _0xb737aa(null);});}return _0xb737aa(null);});};exports[_0xeed3('0x22')]=function(_0x37be25,_0x504fb4){return moment(_0x37be25)[_0xeed3('0x23')](_0x504fb4,_0xeed3('0x24'))[_0xeed3('0x25')](_0xeed3('0x26'));};exports['subtractTime']=function(_0x59922c,_0x22dc8e){return moment(_0x59922c)[_0xeed3('0x27')](_0x22dc8e,_0xeed3('0x24'))['format'](_0xeed3('0x26'));};exports['diffTime']=function(_0x35d83e,_0x2580a6){return moment(_0x35d83e)[_0xeed3('0x28')](moment(_0x2580a6),_0xeed3('0x24'));};exports[_0xeed3('0x29')]=function(_0x53c84c,_0x45fb8d){return parseInt(_0x53c84c,0xa)+parseInt(_0x45fb8d,0xa);};exports[_0xeed3('0x2a')]=function(){return moment()[_0xeed3('0x25')](_0xeed3('0x26'));};exports[_0xeed3('0x2b')]=function(_0x2f5ee3,_0x28ecec){if(_0x28ecec){return moment(_0x2f5ee3)[_0xeed3('0x2b')](_0x28ecec);}return!![];};exports[_0xeed3('0x2c')]=function(_0x56a299,_0x3ec9f6){if(_0x3ec9f6){return moment(_0x56a299)[_0xeed3('0x2c')](_0x3ec9f6);}else if(_0x56a299){return!![];}return![];}; \ No newline at end of file +var _0x6de6=['request','then','[utils][request]\x20name:%s','GetUser','name','interface','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal','found','notfound','catch','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','YYYY-MM-DD\x20HH:mm:ss','format','diffTime','diff','sumTime','now','isAfter','bluebird','moment','util','client','http','../../config/logger','info','inspect','debug','error'];(function(_0x137399,_0x3543dd){var _0xac2324=function(_0x1f067a){while(--_0x1f067a){_0x137399['push'](_0x137399['shift']());}};_0xac2324(++_0x3543dd);}(_0x6de6,0x19d));var _0x66de=function(_0x42604d,_0x37d653){_0x42604d=_0x42604d-0x0;var _0x4cd2b0=_0x6de6[_0x42604d];return _0x4cd2b0;};'use strict';var BPromise=require(_0x66de('0x0'));var jayson=require('jayson/promise');var moment=require(_0x66de('0x1'));var util=require(_0x66de('0x2'));var client=jayson[_0x66de('0x3')][_0x66de('0x4')]({'port':0x2329});var logger=require(_0x66de('0x5'))('xdr');exports['info']=function(_0x574044,_0x103c4c){logger[_0x66de('0x6')](_0x574044,_0x103c4c?util[_0x66de('0x7')](_0x103c4c,{'showHidden':![],'depth':null}):'');};exports[_0x66de('0x8')]=function(_0x13e275,_0x25b8d6){logger[_0x66de('0x8')](_0x13e275,_0x25b8d6?util[_0x66de('0x7')](_0x25b8d6,{'showHidden':![],'depth':null}):'');};exports[_0x66de('0x9')]=function(_0x287ca0,_0x1007a2){logger['error'](_0x287ca0,_0x1007a2?util['inspect'](_0x1007a2,{'showHidden':![],'depth':null}):'');};exports[_0x66de('0xa')]=function(_0x3fba36,_0x38a905){return client[_0x66de('0xa')](_0x3fba36,{'body':_0x38a905})[_0x66de('0xb')](function(_0x56c983){logger[_0x66de('0x8')](_0x66de('0xc'),_0x3fba36,_0x56c983?util[_0x66de('0x7')](_0x56c983,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x858305){logger['error'](_0x66de('0xc'),_0x3fba36,_0x858305?util[_0x66de('0x7')](_0x858305,{'showHidden':![],'depth':null}):'');});};function getUser(_0x5e9f6c){return client[_0x66de('0xa')](_0x66de('0xd'),{'options':{'raw':!![],'attributes':['id','internal',_0x66de('0xe'),_0x66de('0xf')],'where':_0x5e9f6c,'limit':0x1}})['then'](function(_0x58a32d){logger[_0x66de('0x8')](_0x66de('0x10'),JSON[_0x66de('0x11')](_0x5e9f6c),_0x58a32d?util[_0x66de('0x7')](_0x58a32d,{'showHidden':![],'depth':null}):'');return _0x58a32d['result'][_0x66de('0x12')]?_0x58a32d[_0x66de('0x13')][0x0]:null;});}exports[_0x66de('0x14')]=function(_0x11a589){return new BPromise(function(_0x2786d5,_0x171177){if(_0x11a589){return getUser({'internal':_0x11a589})[_0x66de('0xb')](function(_0x92865c){logger[_0x66de('0x6')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x11a589,_0x92865c?_0x66de('0x15'):_0x66de('0x16'));return _0x2786d5(_0x92865c);})[_0x66de('0x17')](function(_0x2f86c4){logger[_0x66de('0x9')](_0x66de('0x18'),_0x2f86c4?util[_0x66de('0x7')](_0x2f86c4,{'showHidden':![],'depth':null}):'');return _0x2786d5(null);});}return _0x2786d5(null);});};exports[_0x66de('0x19')]=function(_0x736ba6){return new BPromise(function(_0x2c6b42,_0x533d54){if(_0x736ba6){return getUser({'interface':_0x736ba6})['then'](function(_0x40f7de){logger[_0x66de('0x6')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x736ba6,_0x40f7de?_0x66de('0x15'):_0x66de('0x16'));return _0x2c6b42(_0x40f7de);})[_0x66de('0x17')](function(_0x42769c){logger[_0x66de('0x9')](_0x66de('0x1a'),_0x42769c?util['inspect'](_0x42769c,{'showHidden':![],'depth':null}):'');return _0x2c6b42(null);});}return _0x2c6b42(null);});};exports[_0x66de('0x1b')]=function(_0x331626){return new BPromise(function(_0x54d385,_0x49389b){if(_0x331626){return getUser({'name':_0x331626})[_0x66de('0xb')](function(_0x5e0c2c){logger['info'](_0x66de('0x1c'),_0x331626,_0x5e0c2c?_0x66de('0x15'):_0x66de('0x16'));return _0x54d385(_0x5e0c2c);})[_0x66de('0x17')](function(_0xcb0670){logger[_0x66de('0x9')]('[utils][getUserByName]',_0xcb0670?util[_0x66de('0x7')](_0xcb0670,{'showHidden':![],'depth':null}):'');return _0x54d385(null);});}return _0x54d385(null);});};exports[_0x66de('0x1d')]=function(_0x5c7e00){return new BPromise(function(_0x3b4b23,_0x19f71a){if(_0x5c7e00){return client[_0x66de('0xa')](_0x66de('0x1e'),{'options':{'raw':!![],'attributes':['id',_0x66de('0xe'),_0x66de('0x1f'),_0x66de('0x20'),_0x66de('0x21')],'where':{'name':_0x5c7e00},'limit':0x1}})[_0x66de('0xb')](function(_0x351e9e){logger[_0x66de('0x8')](_0x66de('0x22'),_0x5c7e00,_0x351e9e?util[_0x66de('0x7')](_0x351e9e,{'showHidden':![],'depth':null}):'');logger[_0x66de('0x6')](_0x66de('0x23'),_0x5c7e00,_0x351e9e?_0x66de('0x15'):_0x66de('0x16'));return _0x3b4b23(_0x351e9e[_0x66de('0x13')][_0x66de('0x12')]?_0x351e9e[_0x66de('0x13')][0x0]:null);})[_0x66de('0x17')](function(_0x51d972){logger[_0x66de('0x9')](_0x66de('0x24'),_0x51d972?util[_0x66de('0x7')](_0x51d972,{'showHidden':![],'depth':null}):'');return _0x3b4b23(null);});}return _0x3b4b23(null);});};exports[_0x66de('0x25')]=function(_0x2936dc,_0x4cedf6){return moment(_0x2936dc)[_0x66de('0x26')](_0x4cedf6,_0x66de('0x27'))['format'](_0x66de('0x28'));};exports['subtractTime']=function(_0x1f9d8c,_0x4cb1ef){return moment(_0x1f9d8c)['subtract'](_0x4cb1ef,_0x66de('0x27'))[_0x66de('0x29')](_0x66de('0x28'));};exports[_0x66de('0x2a')]=function(_0x1c0029,_0x1963f4){return moment(_0x1c0029)[_0x66de('0x2b')](moment(_0x1963f4),_0x66de('0x27'));};exports[_0x66de('0x2c')]=function(_0x41346c,_0x1c61f8){return parseInt(_0x41346c,0xa)+parseInt(_0x1c61f8,0xa);};exports[_0x66de('0x2d')]=function(){return moment()['format'](_0x66de('0x28'));};exports[_0x66de('0x2e')]=function(_0x515d12,_0x1f4f59){if(_0x1f4f59){return moment(_0x515d12)[_0x66de('0x2e')](_0x1f4f59);}return!![];};exports['isBefore']=function(_0x366463,_0x5405a1){if(_0x5405a1){return moment(_0x366463)['isBefore'](_0x5405a1);}else if(_0x366463){return!![];}return![];}; \ No newline at end of file